From: support Date: Tue, 22 Mar 2022 13:08:49 +0000 (+0000) Subject: Built motion from commit 5cdd6fa4.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%2011license.mail?a=commitdiff_plain;h=cb7482c3f94fb00ad4b1f98ef3539a864ba30351;p=motion2.git Built motion from commit 5cdd6fa4.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a6e537a..2664ab3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-22T11:19:14.255Z", + "time": "2022-03-22T13:00:47.878Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 1c76504..2071295 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-22T11:19:14.255Z", + "time": "2022-03-22T13:00:47.878Z", "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 7b5d533..998b048 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 _0x4508=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4508,0x1ef));var _0x8450=function(_0x568837,_0x13880a){_0x568837=_0x568837-0x0;var _0x3d4050=_0x4508[_0x568837];return _0x3d4050;};'use strict';var Sequelize=require('sequelize');module[_0x8450('0x0')]={'name':{'type':Sequelize[_0x8450('0x1')],'get':function(_0xb2cb2f){return this['getDataValue'](_0x8450('0x2'));}},'action':{'type':Sequelize[_0x8450('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8450('0x4'),_0x8450('0x5'),_0x8450('0x6'),_0x8450('0x7'),_0x8450('0x8'),_0x8450('0x9'),'bot',_0x8450('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x8450('0xb')},'data1':{'type':Sequelize[_0x8450('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x8450('0xc')},'data4':{'type':Sequelize[_0x8450('0x3')](0x1000),'comments':_0x8450('0xd')},'data5':{'type':Sequelize[_0x8450('0x3')](0x1000),'comments':_0x8450('0xe')},'data6':{'type':Sequelize[_0x8450('0x3')],'comments':_0x8450('0xf')},'data7':{'type':Sequelize[_0x8450('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xe1ff=['contactManager','motionbar','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[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[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x2af336,_0x4c09f7){var _0x2f8aa8=function(_0x1c5972){while(--_0x1c5972){_0x2af336['push'](_0x2af336['shift']());}};_0x2f8aa8(++_0x4c09f7);}(_0xe1ff,0x1e0));var _0xfe1f=function(_0x5367fc,_0x4496e2){_0x5367fc=_0x5367fc-0x0;var _0x2302fa=_0xe1ff[_0x5367fc];return _0x2302fa;};'use strict';var Sequelize=require(_0xfe1f('0x0'));module[_0xfe1f('0x1')]={'name':{'type':Sequelize[_0xfe1f('0x2')],'get':function(_0x53f6cf){return this[_0xfe1f('0x3')](_0xfe1f('0x4'));}},'action':{'type':Sequelize[_0xfe1f('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xfe1f('0x6'),'integration',_0xfe1f('0x7'),_0xfe1f('0x8'),_0xfe1f('0x9'),'browser',_0xfe1f('0xa'),_0xfe1f('0xb')]],'msg':_0xfe1f('0xc')}},'comment':_0xfe1f('0xc')},'data1':{'type':Sequelize[_0xfe1f('0x5')](0x1000),'comment':_0xfe1f('0xd')},'data2':{'type':Sequelize[_0xfe1f('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xfe1f('0x5')](0x1000),'comment':_0xfe1f('0xe')},'data4':{'type':Sequelize[_0xfe1f('0x5')](0x1000),'comments':_0xfe1f('0xf')},'data5':{'type':Sequelize[_0xfe1f('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xfe1f('0x5')],'comments':_0xfe1f('0x10')},'data7':{'type':Sequelize['TEXT'],'comments':_0xfe1f('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 762a366..5d57889 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 _0x5531=['reject','destroy','then','sendStatus','error','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x5531,0x10d));var _0x1553=function(_0x3fdf85,_0xb10e6d){_0x3fdf85=_0x3fdf85-0x0;var _0xbe0352=_0x5531[_0x3fdf85];return _0xbe0352;};'use strict';var emlformat=require(_0x1553('0x0'));var rimraf=require(_0x1553('0x1'));var zipdir=require(_0x1553('0x2'));var jsonpatch=require(_0x1553('0x3'));var rp=require(_0x1553('0x4'));var moment=require(_0x1553('0x5'));var BPromise=require(_0x1553('0x6'));var Mustache=require(_0x1553('0x7'));var util=require(_0x1553('0x8'));var path=require(_0x1553('0x9'));var sox=require(_0x1553('0xa'));var csv=require(_0x1553('0xb'));var ejs=require(_0x1553('0xc'));var fs=require('fs');var fs_extra=require(_0x1553('0xd'));var _=require(_0x1553('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1553('0xf'));var deskjs=require(_0x1553('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1553('0x11'));var Papa=require(_0x1553('0x12'));var Redis=require(_0x1553('0x13'));var authService=require(_0x1553('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1553('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1553('0x16'))(_0x1553('0x17'));var utils=require(_0x1553('0x18'));var config=require(_0x1553('0x19'));var licenseUtil=require(_0x1553('0x1a'));var db=require(_0x1553('0x1b'))['db'];function respondWithStatusCode(_0x35449b,_0x5a7b3f){_0x5a7b3f=_0x5a7b3f||0xcc;return function(_0x4eadf9){if(_0x4eadf9){return _0x35449b['sendStatus'](_0x5a7b3f);}return _0x35449b[_0x1553('0x1c')](_0x5a7b3f)[_0x1553('0x1d')]();};}function respondWithResult(_0x3bda32,_0x35e5b5){_0x35e5b5=_0x35e5b5||0xc8;return function(_0x56fab6){if(_0x56fab6){return _0x3bda32['status'](_0x35e5b5)[_0x1553('0x1e')](_0x56fab6);}};}function respondWithFilteredResult(_0x559270,_0x268d6e){return function(_0x22c57b){if(_0x22c57b){var _0x511ef5=typeof _0x268d6e['offset']==='undefined'&&typeof _0x268d6e['limit']===_0x1553('0x1f');var _0x2dea8e=_0x22c57b[_0x1553('0x20')];var _0x47d1f3=_0x511ef5?0x0:_0x268d6e[_0x1553('0x21')];var _0x5dabd9=_0x511ef5?_0x22c57b[_0x1553('0x20')]:_0x268d6e[_0x1553('0x21')]+_0x268d6e[_0x1553('0x22')];var _0x34976a;if(_0x5dabd9>=_0x2dea8e){_0x5dabd9=_0x2dea8e;_0x34976a=0xc8;}else{_0x34976a=0xce;}_0x559270[_0x1553('0x1c')](_0x34976a);return _0x559270['set'](_0x1553('0x23'),_0x47d1f3+'-'+_0x5dabd9+'/'+_0x2dea8e)['json'](_0x22c57b);}return null;};}function patchUpdates(_0x4cdc1a){return function(_0x4cf974){try{jsonpatch[_0x1553('0x24')](_0x4cf974,_0x4cdc1a,!![]);}catch(_0x2cc776){return BPromise[_0x1553('0x25')](_0x2cc776);}return _0x4cf974['save']();};}function saveUpdates(_0x2fd085,_0x48ed6d){return function(_0x1bb3b6){if(_0x1bb3b6){return _0x1bb3b6['update'](_0x2fd085)['then'](function(_0x134289){return _0x134289;});}return null;};}function removeEntity(_0xe34e7e,_0x19f1d1){return function(_0x1f6c99){if(_0x1f6c99){return _0x1f6c99[_0x1553('0x26')]()[_0x1553('0x27')](function(){_0xe34e7e['status'](0xcc)[_0x1553('0x1d')]();});}};}function handleEntityNotFound(_0x49daf,_0x53e315){return function(_0x436b7c){if(!_0x436b7c){_0x49daf[_0x1553('0x28')](0x194);}return _0x436b7c;};}function handleError(_0x114923,_0x3f7aef){_0x3f7aef=_0x3f7aef||0x1f4;return function(_0x21349e){logger[_0x1553('0x29')](_0x21349e[_0x1553('0x2a')]);if(_0x21349e[_0x1553('0x2b')]){delete _0x21349e[_0x1553('0x2b')];}_0x114923[_0x1553('0x1c')](_0x3f7aef)[_0x1553('0x2c')](_0x21349e);};}exports[_0x1553('0x2d')]=function(_0x4f4d26,_0x2d03da){if(_0x4f4d26[_0x1553('0x2e')]['id']){delete _0x4f4d26[_0x1553('0x2e')]['id'];}return db[_0x1553('0x2f')][_0x1553('0x30')]({'where':{'id':_0x4f4d26[_0x1553('0x31')]['id']}})[_0x1553('0x27')](handleEntityNotFound(_0x2d03da,null))[_0x1553('0x27')](saveUpdates(_0x4f4d26[_0x1553('0x2e')],null))[_0x1553('0x27')](respondWithResult(_0x2d03da,null))['catch'](handleError(_0x2d03da,null));};exports['destroy']=function(_0x53a624,_0x3e2bc6){return db[_0x1553('0x2f')][_0x1553('0x30')]({'where':{'id':_0x53a624['params']['id']}})[_0x1553('0x27')](handleEntityNotFound(_0x3e2bc6,null))[_0x1553('0x27')](removeEntity(_0x3e2bc6,null))[_0x1553('0x32')](handleError(_0x3e2bc6,null));}; \ No newline at end of file +var _0x4196=['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','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','update','body','Action','params','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4ae6e9,_0x4a8468){var _0x2906ec=function(_0x4b4193){while(--_0x4b4193){_0x4ae6e9['push'](_0x4ae6e9['shift']());}};_0x2906ec(++_0x4a8468);}(_0x4196,0x1ee));var _0x6419=function(_0x2045b1,_0x4faa5c){_0x2045b1=_0x2045b1-0x0;var _0xcfdc58=_0x4196[_0x2045b1];return _0xcfdc58;};'use strict';var emlformat=require(_0x6419('0x0'));var rimraf=require(_0x6419('0x1'));var zipdir=require(_0x6419('0x2'));var jsonpatch=require(_0x6419('0x3'));var rp=require(_0x6419('0x4'));var moment=require(_0x6419('0x5'));var BPromise=require(_0x6419('0x6'));var Mustache=require(_0x6419('0x7'));var util=require(_0x6419('0x8'));var path=require(_0x6419('0x9'));var sox=require('sox');var csv=require(_0x6419('0xa'));var ejs=require(_0x6419('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6419('0xc'));var squel=require(_0x6419('0xd'));var crypto=require(_0x6419('0xe'));var jsforce=require(_0x6419('0xf'));var deskjs=require(_0x6419('0x10'));var toCsv=require(_0x6419('0xa'));var querystring=require(_0x6419('0x11'));var Papa=require(_0x6419('0x12'));var Redis=require(_0x6419('0x13'));var authService=require(_0x6419('0x14'));var qs=require(_0x6419('0x15'));var as=require(_0x6419('0x16'));var hardwareService=require(_0x6419('0x17'));var logger=require(_0x6419('0x18'))(_0x6419('0x19'));var utils=require(_0x6419('0x1a'));var config=require(_0x6419('0x1b'));var licenseUtil=require(_0x6419('0x1c'));var db=require(_0x6419('0x1d'))['db'];function respondWithStatusCode(_0x4c7ccf,_0x5eded0){_0x5eded0=_0x5eded0||0xcc;return function(_0x2d068f){if(_0x2d068f){return _0x4c7ccf['sendStatus'](_0x5eded0);}return _0x4c7ccf['status'](_0x5eded0)[_0x6419('0x1e')]();};}function respondWithResult(_0x12e67e,_0x3c4fb0){_0x3c4fb0=_0x3c4fb0||0xc8;return function(_0x12037f){if(_0x12037f){return _0x12e67e[_0x6419('0x1f')](_0x3c4fb0)[_0x6419('0x20')](_0x12037f);}};}function respondWithFilteredResult(_0x32c6c0,_0x21c0c2){return function(_0xc6d75f){if(_0xc6d75f){var _0x1f4273=typeof _0x21c0c2[_0x6419('0x21')]==='undefined'&&typeof _0x21c0c2[_0x6419('0x22')]===_0x6419('0x23');var _0x584185=_0xc6d75f[_0x6419('0x24')];var _0x5563ca=_0x1f4273?0x0:_0x21c0c2[_0x6419('0x21')];var _0x31dce4=_0x1f4273?_0xc6d75f[_0x6419('0x24')]:_0x21c0c2[_0x6419('0x21')]+_0x21c0c2['limit'];var _0x2345f;if(_0x31dce4>=_0x584185){_0x31dce4=_0x584185;_0x2345f=0xc8;}else{_0x2345f=0xce;}_0x32c6c0['status'](_0x2345f);return _0x32c6c0[_0x6419('0x25')](_0x6419('0x26'),_0x5563ca+'-'+_0x31dce4+'/'+_0x584185)[_0x6419('0x20')](_0xc6d75f);}return null;};}function patchUpdates(_0x1061c1){return function(_0x521c59){try{jsonpatch[_0x6419('0x27')](_0x521c59,_0x1061c1,!![]);}catch(_0x239f7d){return BPromise['reject'](_0x239f7d);}return _0x521c59[_0x6419('0x28')]();};}function saveUpdates(_0x35f417,_0x2263ed){return function(_0x3153bf){if(_0x3153bf){return _0x3153bf['update'](_0x35f417)[_0x6419('0x29')](function(_0x53ccef){return _0x53ccef;});}return null;};}function removeEntity(_0x58e076,_0x5c6b1d){return function(_0x141a94){if(_0x141a94){return _0x141a94[_0x6419('0x2a')]()['then'](function(){_0x58e076['status'](0xcc)[_0x6419('0x1e')]();});}};}function handleEntityNotFound(_0x30e10c,_0x27235f){return function(_0x3b420d){if(!_0x3b420d){_0x30e10c['sendStatus'](0x194);}return _0x3b420d;};}function handleError(_0x30f925,_0x51aa29){_0x51aa29=_0x51aa29||0x1f4;return function(_0x105cc2){logger[_0x6419('0x2b')](_0x105cc2[_0x6419('0x2c')]);if(_0x105cc2['name']){delete _0x105cc2['name'];}_0x30f925['status'](_0x51aa29)['send'](_0x105cc2);};}exports[_0x6419('0x2d')]=function(_0x1aaf49,_0x27d015){if(_0x1aaf49[_0x6419('0x2e')]['id']){delete _0x1aaf49[_0x6419('0x2e')]['id'];}return db[_0x6419('0x2f')]['find']({'where':{'id':_0x1aaf49[_0x6419('0x30')]['id']}})[_0x6419('0x29')](handleEntityNotFound(_0x27d015,null))[_0x6419('0x29')](saveUpdates(_0x1aaf49[_0x6419('0x2e')],null))[_0x6419('0x29')](respondWithResult(_0x27d015,null))['catch'](handleError(_0x27d015,null));};exports[_0x6419('0x2a')]=function(_0x5fb698,_0x375371){return db[_0x6419('0x2f')][_0x6419('0x31')]({'where':{'id':_0x5fb698[_0x6419('0x30')]['id']}})[_0x6419('0x29')](handleEntityNotFound(_0x375371,null))[_0x6419('0x29')](removeEntity(_0x375371,null))[_0x6419('0x32')](handleError(_0x375371,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 78dc8c0..063070c 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 _0xf7fe=['Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xf7fe,0xe9));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef7f('0x0'));var util=require(_0xef7f('0x1'));var logger=require(_0xef7f('0x2'))('api');var moment=require(_0xef7f('0x3'));var BPromise=require(_0xef7f('0x4'));var rp=require(_0xef7f('0x5'));var fs=require('fs');var path=require(_0xef7f('0x6'));var rimraf=require('rimraf');var config=require(_0xef7f('0x7'));var attributes=require('./action.attributes');module['exports']=function(_0x20d52f,_0x5e06cd){return _0x20d52f[_0xef7f('0x8')](_0xef7f('0x9'),attributes,{'tableName':_0xef7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c07=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','api'];(function(_0x1fb720,_0x3fb28a){var _0x39a198=function(_0x2cf3cb){while(--_0x2cf3cb){_0x1fb720['push'](_0x1fb720['shift']());}};_0x39a198(++_0x3fb28a);}(_0x0c07,0x8b));var _0x70c0=function(_0x421c7d,_0x4ba011){_0x421c7d=_0x421c7d-0x0;var _0x51acd7=_0x0c07[_0x421c7d];return _0x51acd7;};'use strict';var _=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var logger=require(_0x70c0('0x2'))(_0x70c0('0x3'));var moment=require(_0x70c0('0x4'));var BPromise=require(_0x70c0('0x5'));var rp=require(_0x70c0('0x6'));var fs=require('fs');var path=require(_0x70c0('0x7'));var rimraf=require(_0x70c0('0x8'));var config=require(_0x70c0('0x9'));var attributes=require(_0x70c0('0xa'));module[_0x70c0('0xb')]=function(_0x5b920d,_0x379689){return _0x5b920d['define']('Action',attributes,{'tableName':_0x70c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index cf9e530..1bde4a3 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x56a940,_0x2e20c0){var _0x3392a3=function(_0x3a86a3){while(--_0x3a86a3){_0x56a940['push'](_0x56a940['shift']());}};_0x3392a3(++_0x2e20c0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x5fc3[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2ff43f,_0x50f91f){var _0x4bb161=function(_0x43ad55){while(--_0x43ad55){_0x2ff43f['push'](_0x2ff43f['shift']());}};_0x4bb161(++_0x50f91f);}(_0x1261,0x144));var _0x1126=function(_0x16d24f,_0x4686a5){_0x16d24f=_0x16d24f-0x0;var _0x3beec6=_0x1261[_0x16d24f];return _0x3beec6;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 681ca09..1754108 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 _0x52a0=['isAuthenticated','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./action.controller','/:id'];(function(_0x8e2eeb,_0x195252){var _0x56c8b6=function(_0x207ae0){while(--_0x207ae0){_0x8e2eeb['push'](_0x8e2eeb['shift']());}};_0x56c8b6(++_0x195252);}(_0x52a0,0x198));var _0x052a=function(_0x321b98,_0x4c7b2b){_0x321b98=_0x321b98-0x0;var _0x22948f=_0x52a0[_0x321b98];return _0x22948f;};'use strict';var multer=require(_0x052a('0x0'));var util=require(_0x052a('0x1'));var path=require(_0x052a('0x2'));var timeout=require('connect-timeout');var express=require(_0x052a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x052a('0x4'));var interaction=require(_0x052a('0x5'));var config=require('../../config/environment');var controller=require(_0x052a('0x6'));router['put'](_0x052a('0x7'),auth[_0x052a('0x8')](),controller[_0x052a('0x9')]);router[_0x052a('0xa')](_0x052a('0x7'),auth[_0x052a('0x8')](),controller[_0x052a('0xb')]);module[_0x052a('0xc')]=router; \ No newline at end of file +var _0xff51=['./action.controller','put','/:id','isAuthenticated','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x332fee,_0x3ce326){var _0x570645=function(_0x58812d){while(--_0x58812d){_0x332fee['push'](_0x332fee['shift']());}};_0x570645(++_0x3ce326);}(_0xff51,0xe2));var _0x1ff5=function(_0x37d8ae,_0x17e484){_0x37d8ae=_0x37d8ae-0x0;var _0x4de500=_0xff51[_0x37d8ae];return _0x4de500;};'use strict';var multer=require(_0x1ff5('0x0'));var util=require('util');var path=require(_0x1ff5('0x1'));var timeout=require(_0x1ff5('0x2'));var express=require(_0x1ff5('0x3'));var router=express[_0x1ff5('0x4')]();var fs_extra=require(_0x1ff5('0x5'));var auth=require(_0x1ff5('0x6'));var interaction=require(_0x1ff5('0x7'));var config=require('../../config/environment');var controller=require(_0x1ff5('0x8'));router[_0x1ff5('0x9')](_0x1ff5('0xa'),auth[_0x1ff5('0xb')](),controller['update']);router[_0x1ff5('0xc')](_0x1ff5('0xa'),auth['isAuthenticated'](),controller['destroy']);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 7ce5d88..8b7a3cc 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x24914f,_0x5b68ef){var _0x79156a=function(_0x534e8b){while(--_0x534e8b){_0x24914f['push'](_0x24914f['shift']());}};_0x79156a(++_0x5b68ef);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4e84ed,_0x34a4f4){_0x4e84ed=_0x4e84ed-0x0;var _0x2932d1=_0x3eea[_0x4e84ed];return _0x2932d1;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x14d536,_0x41ebe9){var _0x5e3e1b=function(_0x5338b8){while(--_0x5338b8){_0x14d536['push'](_0x14d536['shift']());}};_0x5e3e1b(++_0x41ebe9);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'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 56ccb8c..5d4cec0 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 _0xb4ac=['findAll','rows','catch','show','params','keys','include','find','create','body','role','user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','type','includes','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20NULL','value','getFields','order','DESC','output','fullPath','%s-%s.%s','randomstring','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','AVG(%s)','metric','debug','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','save','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x198180,_0x12c900){var _0x2747bc=function(_0x54291d){while(--_0x54291d){_0x198180['push'](_0x198180['shift']());}};_0x2747bc(++_0x12c900);}(_0xb4ac,0x109));var _0xcb4a=function(_0x193b52,_0x464c45){_0x193b52=_0x193b52-0x0;var _0x263d34=_0xb4ac[_0x193b52];return _0x263d34;};'use strict';var emlformat=require(_0xcb4a('0x0'));var rimraf=require(_0xcb4a('0x1'));var zipdir=require(_0xcb4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb4a('0x3'));var BPromise=require(_0xcb4a('0x4'));var Mustache=require('mustache');var util=require(_0xcb4a('0x5'));var path=require(_0xcb4a('0x6'));var sox=require(_0xcb4a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb4a('0x8'));var _=require('lodash');var squel=require(_0xcb4a('0x9'));var crypto=require(_0xcb4a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcb4a('0xb'));var toCsv=require(_0xcb4a('0xc'));var querystring=require(_0xcb4a('0xd'));var Papa=require(_0xcb4a('0xe'));var Redis=require('ioredis');var authService=require(_0xcb4a('0xf'));var qs=require(_0xcb4a('0x10'));var as=require(_0xcb4a('0x11'));var hardwareService=require(_0xcb4a('0x12'));var logger=require('../../config/logger')(_0xcb4a('0x13'));var utils=require(_0xcb4a('0x14'));var config=require(_0xcb4a('0x15'));var licenseUtil=require(_0xcb4a('0x16'));var db=require(_0xcb4a('0x17'))['db'];var dbH=require(_0xcb4a('0x17'))[_0xcb4a('0x18')];function respondWithStatusCode(_0x178def,_0x260458){_0x260458=_0x260458||0xcc;return function(_0x4d6264){if(_0x4d6264){return _0x178def[_0xcb4a('0x19')](_0x260458);}return _0x178def[_0xcb4a('0x1a')](_0x260458)['end']();};}function respondWithResult(_0x2473d6,_0x385763){_0x385763=_0x385763||0xc8;return function(_0x129300){if(_0x129300){return _0x2473d6[_0xcb4a('0x1a')](_0x385763)['json'](_0x129300);}};}function respondWithFilteredResult(_0x32506a,_0x26bb1a){return function(_0x9dc600){if(_0x9dc600){var _0x351cb1=typeof _0x26bb1a[_0xcb4a('0x1b')]===_0xcb4a('0x1c')&&typeof _0x26bb1a[_0xcb4a('0x1d')]==='undefined';var _0x55c70b=_0x9dc600[_0xcb4a('0x1e')];var _0x3db74a=_0x351cb1?0x0:_0x26bb1a[_0xcb4a('0x1b')];var _0x4fdfde=_0x351cb1?_0x9dc600[_0xcb4a('0x1e')]:_0x26bb1a['offset']+_0x26bb1a['limit'];var _0x1d6de4;if(_0x4fdfde>=_0x55c70b){_0x4fdfde=_0x55c70b;_0x1d6de4=0xc8;}else{_0x1d6de4=0xce;}_0x32506a[_0xcb4a('0x1a')](_0x1d6de4);return _0x32506a[_0xcb4a('0x1f')]('Content-Range',_0x3db74a+'-'+_0x4fdfde+'/'+_0x55c70b)[_0xcb4a('0x20')](_0x9dc600);}return null;};}function patchUpdates(_0x4ab73d){return function(_0x3c592e){try{jsonpatch['apply'](_0x3c592e,_0x4ab73d,!![]);}catch(_0x2b85ea){return BPromise['reject'](_0x2b85ea);}return _0x3c592e[_0xcb4a('0x21')]();};}function saveUpdates(_0x50d17c,_0x47d866){return function(_0x491878){if(_0x491878){return _0x491878['update'](_0x50d17c)[_0xcb4a('0x22')](function(_0x346879){return _0x346879;});}return null;};}function removeEntity(_0x1db598,_0x2c3280){return function(_0x46ed54){if(_0x46ed54){return _0x46ed54[_0xcb4a('0x23')]()[_0xcb4a('0x22')](function(){var _0x3b5183=_0x46ed54[_0xcb4a('0x24')]({'plain':!![]});var _0x4a75ef=_0xcb4a('0x25');return db[_0xcb4a('0x26')][_0xcb4a('0x23')]({'where':{'type':_0x4a75ef,'resourceId':_0x3b5183['id']}})[_0xcb4a('0x22')](function(){return _0x46ed54;});})[_0xcb4a('0x22')](function(){_0x1db598[_0xcb4a('0x1a')](0xcc)[_0xcb4a('0x27')]();});}};}function handleEntityNotFound(_0x1add9e,_0x8a0dba){return function(_0x4bf17c){if(!_0x4bf17c){_0x1add9e['sendStatus'](0x194);}return _0x4bf17c;};}function handleError(_0x3e0077,_0x30555b){_0x30555b=_0x30555b||0x1f4;return function(_0x54a29b){logger[_0xcb4a('0x28')](_0x54a29b[_0xcb4a('0x29')]);if(_0x54a29b[_0xcb4a('0x2a')]){delete _0x54a29b[_0xcb4a('0x2a')];}_0x3e0077['status'](_0x30555b)[_0xcb4a('0x2b')](_0x54a29b);};}exports[_0xcb4a('0x2c')]=function(_0x5bfd70,_0x3f3a09){var _0x57570e={},_0x103a3c={},_0x57da3b={'count':0x0,'rows':[]};var _0x1b7c7a=_[_0xcb4a('0x2d')](db[_0xcb4a('0x2e')][_0xcb4a('0x2f')],function(_0x393c42){return{'name':_0x393c42[_0xcb4a('0x30')],'type':_0x393c42['type'][_0xcb4a('0x31')]};});_0x103a3c[_0xcb4a('0x32')]=_[_0xcb4a('0x2d')](_0x1b7c7a,_0xcb4a('0x2a'));_0x103a3c[_0xcb4a('0x33')]=_['keys'](_0x5bfd70['query']);_0x103a3c[_0xcb4a('0x34')]=_['intersection'](_0x103a3c[_0xcb4a('0x32')],_0x103a3c[_0xcb4a('0x33')]);_0x57570e[_0xcb4a('0x35')]=_[_0xcb4a('0x36')](_0x103a3c['model'],qs['fields'](_0x5bfd70[_0xcb4a('0x33')][_0xcb4a('0x37')]));_0x57570e[_0xcb4a('0x35')]=_0x57570e[_0xcb4a('0x35')][_0xcb4a('0x38')]?_0x57570e[_0xcb4a('0x35')]:_0x103a3c[_0xcb4a('0x32')];if(!_0x5bfd70[_0xcb4a('0x33')][_0xcb4a('0x39')](_0xcb4a('0x3a'))){_0x57570e[_0xcb4a('0x1d')]=qs['limit'](_0x5bfd70['query'][_0xcb4a('0x1d')]);_0x57570e['offset']=qs[_0xcb4a('0x1b')](_0x5bfd70[_0xcb4a('0x33')][_0xcb4a('0x1b')]);}_0x57570e['order']=qs[_0xcb4a('0x3b')](_0x5bfd70[_0xcb4a('0x33')][_0xcb4a('0x3b')]);_0x57570e[_0xcb4a('0x3c')]=qs[_0xcb4a('0x34')](_[_0xcb4a('0x3d')](_0x5bfd70['query'],_0x103a3c['filters']),_0x1b7c7a);if(_0x5bfd70[_0xcb4a('0x33')][_0xcb4a('0x3e')]){_0x57570e[_0xcb4a('0x3c')]=_[_0xcb4a('0x3f')](_0x57570e['where'],{'$or':_[_0xcb4a('0x2d')](_0x1b7c7a,function(_0x1b9896){if(_0x1b9896['type']!==_0xcb4a('0x40')){var _0x601189={};_0x601189[_0x1b9896[_0xcb4a('0x2a')]]={'$like':'%'+_0x5bfd70[_0xcb4a('0x33')][_0xcb4a('0x3e')]+'%'};return _0x601189;}})});}_0x57570e=_[_0xcb4a('0x3f')]({},_0x57570e,_0x5bfd70[_0xcb4a('0x41')]);var _0x53f91a={'where':_0x57570e[_0xcb4a('0x3c')]};return db[_0xcb4a('0x2e')][_0xcb4a('0x1e')](_0x53f91a)[_0xcb4a('0x22')](function(_0x2641ec){_0x57da3b['count']=_0x2641ec;if(_0x5bfd70['query'][_0xcb4a('0x42')]){_0x57570e['include']=[{'all':!![]}];}return db[_0xcb4a('0x2e')][_0xcb4a('0x43')](_0x57570e);})[_0xcb4a('0x22')](function(_0x354789){_0x57da3b[_0xcb4a('0x44')]=_0x354789;return _0x57da3b;})[_0xcb4a('0x22')](respondWithFilteredResult(_0x3f3a09,_0x57570e))[_0xcb4a('0x45')](handleError(_0x3f3a09,null));};exports[_0xcb4a('0x46')]=function(_0x29653e,_0x98d6fd){var _0x388ba7={'raw':![],'where':{'id':_0x29653e[_0xcb4a('0x47')]['id']}},_0x5cdbaf={};_0x5cdbaf[_0xcb4a('0x32')]=_[_0xcb4a('0x48')](db[_0xcb4a('0x2e')]['rawAttributes']);_0x5cdbaf['query']=_['keys'](_0x29653e[_0xcb4a('0x33')]);_0x5cdbaf[_0xcb4a('0x34')]=_['intersection'](_0x5cdbaf['model'],_0x5cdbaf[_0xcb4a('0x33')]);_0x388ba7[_0xcb4a('0x35')]=_['intersection'](_0x5cdbaf[_0xcb4a('0x32')],qs[_0xcb4a('0x37')](_0x29653e[_0xcb4a('0x33')]['fields']));_0x388ba7[_0xcb4a('0x35')]=_0x388ba7['attributes'][_0xcb4a('0x38')]?_0x388ba7['attributes']:_0x5cdbaf[_0xcb4a('0x32')];if(_0x29653e[_0xcb4a('0x33')]['includeAll']){_0x388ba7[_0xcb4a('0x49')]=[{'all':!![]}];}_0x388ba7=_[_0xcb4a('0x3f')]({},_0x388ba7,_0x29653e['options']);return db[_0xcb4a('0x2e')][_0xcb4a('0x4a')](_0x388ba7)[_0xcb4a('0x22')](handleEntityNotFound(_0x98d6fd,null))['then'](respondWithResult(_0x98d6fd,null))[_0xcb4a('0x45')](handleError(_0x98d6fd,null));};exports[_0xcb4a('0x4b')]=function(_0x1b234a,_0x4fad27){return db['AnalyticCustomReport']['create'](_0x1b234a[_0xcb4a('0x4c')],{})[_0xcb4a('0x22')](function(_0x3bd22e){var _0x3c0a99=_0x1b234a['user'][_0xcb4a('0x24')]({'plain':!![]});if(!_0x3c0a99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c0a99[_0xcb4a('0x4d')]===_0xcb4a('0x4e')){var _0x237f5a=_0x3bd22e[_0xcb4a('0x24')]({'plain':!![]});var _0x34e11e=_0xcb4a('0x4f');return db[_0xcb4a('0x50')][_0xcb4a('0x4a')]({'where':{'name':_0x34e11e,'userProfileId':_0x3c0a99[_0xcb4a('0x51')]},'raw':!![]})[_0xcb4a('0x22')](function(_0x2708bb){if(_0x2708bb&&_0x2708bb['autoAssociation']===0x0){return db[_0xcb4a('0x26')]['create']({'name':_0x237f5a[_0xcb4a('0x2a')],'resourceId':_0x237f5a['id'],'type':_0xcb4a('0x25'),'sectionId':_0x2708bb['id']},{})[_0xcb4a('0x22')](function(){return _0x3bd22e;});}else{return _0x3bd22e;}})[_0xcb4a('0x45')](function(_0x38e010){logger[_0xcb4a('0x28')](_0xcb4a('0x52'),_0x38e010);throw _0x38e010;});}return _0x3bd22e;})[_0xcb4a('0x22')](respondWithResult(_0x4fad27,0xc9))[_0xcb4a('0x45')](handleError(_0x4fad27,null));};exports[_0xcb4a('0x53')]=function(_0x42859c,_0x39041c){if(_0x42859c['body']['id']){delete _0x42859c[_0xcb4a('0x4c')]['id'];}return db['AnalyticCustomReport'][_0xcb4a('0x4a')]({'where':{'id':_0x42859c[_0xcb4a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39041c,null))[_0xcb4a('0x22')](saveUpdates(_0x42859c[_0xcb4a('0x4c')],null))['then'](respondWithResult(_0x39041c,null))[_0xcb4a('0x45')](handleError(_0x39041c,null));};exports[_0xcb4a('0x23')]=function(_0x5a1471,_0x27d0c4){return db[_0xcb4a('0x2e')][_0xcb4a('0x4a')]({'where':{'id':_0x5a1471[_0xcb4a('0x47')]['id']}})['then'](handleEntityNotFound(_0x27d0c4,null))['then'](removeEntity(_0x27d0c4,null))[_0xcb4a('0x45')](handleError(_0x27d0c4,null));};exports[_0xcb4a('0x54')]=function(_0x48835a,_0x2ed13a){var _0x2fee02=0xa;var _0x37b7fb=[_0xcb4a('0x55'),_0xcb4a('0x56'),_0xcb4a('0x57'),_0xcb4a('0x58')];var _0x4da65e={'SUM':_0xcb4a('0x59'),'COUNT':_0xcb4a('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcb4a('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xcb4a('0x5c'),'GROUP_CONCAT ASC':_0xcb4a('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2fb5c5={'SEC_TO_TIME':_0xcb4a('0x5e'),'DATE':_0xcb4a('0x5f'),'HOUR':_0xcb4a('0x60'),'ROUND':_0xcb4a('0x61'),'UNIX_TIMESTAMP':_0xcb4a('0x62')};var _0x339143=function(_0x51acc0){return!_['includes'](['IS\x20NULL',_0xcb4a('0x63'),_0xcb4a('0x64'),_0xcb4a('0x65')],_0x51acc0);};var _0x3ca3b6=function(_0x1cadaa){if(!_0x1cadaa||!_0x1cadaa[_0xcb4a('0x66')]['length']){return'';}for(var _0x4926d0='(',_0x209dca=0x0;_0x209dca<_0x1cadaa[_0xcb4a('0x66')][_0xcb4a('0x38')];_0x209dca+=0x1){_0x209dca>0x0&&(_0x4926d0+='\x20'+_0x1cadaa[_0xcb4a('0x67')]+'\x20');_0x4926d0+=_0x1cadaa['rules'][_0x209dca][_0xcb4a('0x68')]?_0x3ca3b6(_0x1cadaa[_0xcb4a('0x66')][_0x209dca][_0xcb4a('0x68')]):_0x1cadaa[_0xcb4a('0x66')][_0x209dca][_0xcb4a('0x69')]+'\x20'+_0x1cadaa[_0xcb4a('0x66')][_0x209dca][_0xcb4a('0x6a')]+(_0x339143(_0x1cadaa[_0xcb4a('0x66')][_0x209dca][_0xcb4a('0x6a')])?'\x20'+_0x1cadaa[_0xcb4a('0x66')][_0x209dca]['value']:'');}return _0x4926d0+')';};var _0xf9cfdb={'where':{'id':_0x48835a[_0xcb4a('0x47')]['id']}},_0xca7d54,_0x511176,_0x253b05,_0x6ab2e3,_0x6dfbfb;_0xf9cfdb=_[_0xcb4a('0x3f')]({},_0xf9cfdb,_0x48835a[_0xcb4a('0x41')]);return db[_0xcb4a('0x2e')][_0xcb4a('0x4a')](_0xf9cfdb)[_0xcb4a('0x22')](function(_0x40d50f){if(_0x40d50f){_0xca7d54=_0x40d50f;return _0x40d50f['getFields']();}return null;})[_0xcb4a('0x22')](function(_0x5cdae3){if(_0x5cdae3){if(!_0x5cdae3[_0xcb4a('0x38')]){throw new db[(_0xcb4a('0x6b'))][(_0xcb4a('0x6c'))](_0xcb4a('0x6d'),0x193);}_0x511176=_0x5cdae3;return db[_0xcb4a('0x6e')][_0xcb4a('0x43')]({'raw':!![]});}return null;})[_0xcb4a('0x22')](function(_0x1d39be){if(_0x1d39be){_0x253b05=_[_0xcb4a('0x6f')](_0x1d39be,'id');var _0xe3dc16;var _0x22b475=squel[_0xcb4a('0x70')]();_0x22b475[_0xcb4a('0x71')](_0xca7d54[_0xcb4a('0x72')]);for(var _0x1728b8=0x0;_0x1728b8<_0x511176[_0xcb4a('0x38')];_0x1728b8+=0x1){_0xe3dc16=_0x511176[_0x1728b8][_0xcb4a('0x73')]?_0x253b05[_0x511176[_0x1728b8]['MetricId']]['metric']:_0x511176[_0x1728b8][_0xcb4a('0x69')];_0xe3dc16=_0x511176[_0x1728b8][_0xcb4a('0x74')]?_[_0xcb4a('0x75')](_0x4da65e[_0x511176[_0x1728b8]['function']],'%s',_0xe3dc16):_0xe3dc16;_0xe3dc16=_0x511176[_0x1728b8][_0xcb4a('0x76')]?_['replace'](_0x2fb5c5[_0x511176[_0x1728b8][_0xcb4a('0x76')]],'%s',_0xe3dc16):_0xe3dc16;if(_0x511176[_0x1728b8][_0xcb4a('0x77')]){_0x22b475[_0xcb4a('0x68')](_0xe3dc16);}_0x511176[_0x1728b8][_0xcb4a('0x78')]&&_0x22b475['order'](_0xe3dc16,_0x511176[_0x1728b8]['orderBy']==='DESC'?![]:!![]);_0x22b475[_0xcb4a('0x69')](_0xe3dc16,_0x511176[_0x1728b8][_0xcb4a('0x79')]||_0xe3dc16);}if(_0xca7d54[_0xcb4a('0x7a')]){_0xca7d54[_0xcb4a('0x7a')]=JSON['parse'](_0xca7d54[_0xcb4a('0x7a')]);for(var _0x3fc935=0x0;_0x3fc935<_0xca7d54[_0xcb4a('0x7a')][_0xcb4a('0x38')];_0x3fc935+=0x1){if(_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7b')]&&_[_0xcb4a('0x7c')](_0x37b7fb,_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7b')])&&_0xca7d54[_0xcb4a('0x7a')][_0x3fc935]['parentKey']&&_0xca7d54['joins'][_0x3fc935]['foreignTable']&&_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7d')]){_0x22b475[_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7b')]](_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7e')],null,util['format'](_0xcb4a('0x7f'),_0xca7d54['table'],_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x80')],_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7e')],_0xca7d54[_0xcb4a('0x7a')][_0x3fc935][_0xcb4a('0x7d')]));}}}if(_0xca7d54[_0xcb4a('0x81')]){_0xca7d54[_0xcb4a('0x81')]=JSON[_0xcb4a('0x82')](_0xca7d54['conditions']);_0x22b475[_0xcb4a('0x3c')](_0x3ca3b6(_0xca7d54[_0xcb4a('0x81')][_0xcb4a('0x68')]));}_0x6dfbfb=_0x22b475[_0xcb4a('0x83')]();_0x22b475['limit'](_0x2fee02);_0x22b475[_0xcb4a('0x1b')](0x0);logger['debug'](_0xcb4a('0x84'),_0x22b475[_0xcb4a('0x85')]());return dbH[_0xcb4a('0x86')][_0xcb4a('0x33')](_0x22b475[_0xcb4a('0x85')](),{'type':dbH['sequelize'][_0xcb4a('0x87')]['SELECT']});}})[_0xcb4a('0x22')](respondWithResult(_0x2ed13a,null))[_0xcb4a('0x45')](handleError(_0x2ed13a,null));};function runReport(_0x253b1d,_0xf12a16,_0xc26f8f){var _0x153674=_0xf12a16[_0xcb4a('0x2a')];var _0x4eda4d=0xa;var _0x184a33=[_0xcb4a('0x55'),_0xcb4a('0x56'),_0xcb4a('0x57'),_0xcb4a('0x58')];var _0x1069c3={'SUM':'SUM(%s)','COUNT':_0xcb4a('0x5a'),'COUNT DISTINCT':_0xcb4a('0x88'),'MAX':_0xcb4a('0x5b'),'MIN':_0xcb4a('0x89'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcb4a('0x5c'),'GROUP_CONCAT ASC':_0xcb4a('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x7cf6b0={'SEC_TO_TIME':_0xcb4a('0x5e'),'DATE':'DATE(%s)','HOUR':_0xcb4a('0x60'),'ROUND':_0xcb4a('0x61'),'UNIX_TIMESTAMP':_0xcb4a('0x62')};var _0x3f2270=function(_0x9a1018){return!_[_0xcb4a('0x7c')]([_0xcb4a('0x8a'),_0xcb4a('0x63'),_0xcb4a('0x64'),_0xcb4a('0x65')],_0x9a1018);};var _0x2d2635=function(_0x4fa85f){if(!_0x4fa85f||!_0x4fa85f[_0xcb4a('0x66')][_0xcb4a('0x38')]){return'';}for(var _0xf1e506='(',_0x2eebd8=0x0;_0x2eebd8<_0x4fa85f[_0xcb4a('0x66')]['length'];_0x2eebd8+=0x1){_0x2eebd8>0x0&&(_0xf1e506+='\x20'+_0x4fa85f[_0xcb4a('0x67')]+'\x20');_0xf1e506+=_0x4fa85f[_0xcb4a('0x66')][_0x2eebd8]['group']?_0x2d2635(_0x4fa85f['rules'][_0x2eebd8][_0xcb4a('0x68')]):_0x4fa85f[_0xcb4a('0x66')][_0x2eebd8][_0xcb4a('0x69')]+'\x20'+_0x4fa85f[_0xcb4a('0x66')][_0x2eebd8][_0xcb4a('0x6a')]+(_0x3f2270(_0x4fa85f[_0xcb4a('0x66')][_0x2eebd8]['condition'])?'\x20'+_0x4fa85f[_0xcb4a('0x66')][_0x2eebd8][_0xcb4a('0x8b')]:'');}return _0xf1e506+')';};var _0x2d0e72={'where':{'id':_0x253b1d['id']}},_0x2c0c5e,_0x1bc24b,_0x28c3b2,_0x1e37c7,_0x48bec0;_0x2d0e72=_[_0xcb4a('0x3f')]({},_0x2d0e72,_0xc26f8f);return db[_0xcb4a('0x2e')][_0xcb4a('0x4a')](_0x2d0e72)[_0xcb4a('0x22')](function(_0x1e737c){if(_0x1e737c){_0x2c0c5e=_0x1e737c;return _0x1e737c[_0xcb4a('0x8c')]();}return null;})[_0xcb4a('0x22')](function(_0xc23cff){if(_0xc23cff){if(!_0xc23cff[_0xcb4a('0x38')]){throw new db[(_0xcb4a('0x6b'))]['ValidationErrorItem'](_0xcb4a('0x6d'),0x193);}_0x1bc24b=_0xc23cff;return db['AnalyticMetric'][_0xcb4a('0x43')]({'raw':!![]});}return null;})[_0xcb4a('0x22')](function(_0x3c4337){if(_0x3c4337){_0x28c3b2=_['keyBy'](_0x3c4337,'id');var _0x69641a;var _0x20568d=squel['select']();_0x20568d[_0xcb4a('0x71')](_0x2c0c5e[_0xcb4a('0x72')]);for(var _0xc2ba82=0x0;_0xc2ba82<_0x1bc24b[_0xcb4a('0x38')];_0xc2ba82+=0x1){_0x69641a=_0x1bc24b[_0xc2ba82][_0xcb4a('0x73')]?_0x28c3b2[_0x1bc24b[_0xc2ba82][_0xcb4a('0x73')]]['metric']:_0x1bc24b[_0xc2ba82][_0xcb4a('0x69')];_0x69641a=_0x1bc24b[_0xc2ba82]['function']?_[_0xcb4a('0x75')](_0x1069c3[_0x1bc24b[_0xc2ba82][_0xcb4a('0x74')]],'%s',_0x69641a):_0x69641a;_0x69641a=_0x1bc24b[_0xc2ba82]['format']?_[_0xcb4a('0x75')](_0x7cf6b0[_0x1bc24b[_0xc2ba82]['format']],'%s',_0x69641a):_0x69641a;if(_0x1bc24b[_0xc2ba82]['groupBy']){_0x20568d[_0xcb4a('0x68')](_0x69641a);}_0x1bc24b[_0xc2ba82]['orderBy']&&_0x20568d[_0xcb4a('0x8d')](_0x69641a,_0x1bc24b[_0xc2ba82]['orderBy']===_0xcb4a('0x8e')?![]:!![]);_0x20568d[_0xcb4a('0x69')](_0x69641a,_0x1bc24b[_0xc2ba82][_0xcb4a('0x79')]||_0x69641a);}if(_0x2c0c5e['joins']){_0x2c0c5e[_0xcb4a('0x7a')]=JSON[_0xcb4a('0x82')](_0x2c0c5e[_0xcb4a('0x7a')]);for(var _0x4769b7=0x0;_0x4769b7<_0x2c0c5e[_0xcb4a('0x7a')][_0xcb4a('0x38')];_0x4769b7+=0x1){if(_0x2c0c5e['joins'][_0x4769b7][_0xcb4a('0x7b')]&&_['includes'](_0x184a33,_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7][_0xcb4a('0x7b')])&&_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7][_0xcb4a('0x80')]&&_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7][_0xcb4a('0x7e')]&&_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7][_0xcb4a('0x7d')]){_0x20568d[_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7][_0xcb4a('0x7b')]](_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7]['foreignTable'],null,util['format'](_0xcb4a('0x7f'),_0x2c0c5e['table'],_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7]['parentKey'],_0x2c0c5e['joins'][_0x4769b7]['foreignTable'],_0x2c0c5e[_0xcb4a('0x7a')][_0x4769b7][_0xcb4a('0x7d')]));}}}if(_0x2c0c5e[_0xcb4a('0x81')]){_0x2c0c5e[_0xcb4a('0x81')]=JSON['parse'](_0x2c0c5e[_0xcb4a('0x81')]);_0x20568d[_0xcb4a('0x3c')](_0x2d2635(_0x2c0c5e[_0xcb4a('0x81')][_0xcb4a('0x68')]));}_0x48bec0=_0x20568d[_0xcb4a('0x83')]();_0x20568d[_0xcb4a('0x1d')](_0x4eda4d);_0x20568d[_0xcb4a('0x1b')](0x0);return;}})[_0xcb4a('0x22')](function(){if(_0xf12a16[_0xcb4a('0x8f')]==='web'){return null;}var _0x13ae1f=_[_0xcb4a('0x3f')](_0xf12a16,{'name':_0xf12a16[_0xcb4a('0x90')]||_0xf12a16['name']||_0x2c0c5e[_0xcb4a('0x2a')],'basename':_0x153674,'savename':util['format'](_0xcb4a('0x91'),_0xf12a16[_0xcb4a('0x2a')]||_0x2c0c5e['name'],require(_0xcb4a('0x92'))['generate'](0x4),_0xf12a16[_0xcb4a('0x8f')]||'csv'),'reportId':_0x2c0c5e['id'],'reportType':_0xcb4a('0x93')});return db['AnalyticExtractedReport'][_0xcb4a('0x4b')](_0x13ae1f,{'raw':!![]});})[_0xcb4a('0x22')](function(_0x304810){if(_0x2c0c5e[_0xcb4a('0x72')]==='cdr'){_0x48bec0[_0xcb4a('0x3c')](_0x2c0c5e[_0xcb4a('0x72')]+_0xcb4a('0x94'),_0xf12a16['startDate'],_0xf12a16[_0xcb4a('0x95')]);}else{_0x48bec0['where'](_0x2c0c5e['table']+_0xcb4a('0x96'),_0xf12a16['startDate'],_0xf12a16['endDate']);}if(_0x304810){logger[_0xcb4a('0x97')](_0xcb4a('0x98'),_0x48bec0[_0xcb4a('0x85')]());require(_0xcb4a('0x99'))[_0xcb4a('0x9a')](path['join'](__dirname,_0xcb4a('0x9b'),_0x304810[_0xcb4a('0x8f')]),[_0x304810['id'],_0x48bec0['toString'](),path['join'](__dirname,_0xcb4a('0x9c'),_0x304810[_0xcb4a('0x9d')]),_0x153674]);return _0x304810;}else{var _0x201c92=squel[_0xcb4a('0x70')]();_0x201c92[_0xcb4a('0x71')]('('+_0x48bec0[_0xcb4a('0x85')]()+')',_0xcb4a('0x9e'));_0x201c92['field'](_0xcb4a('0x9f'),_0xcb4a('0x1e'));_0x48bec0['limit'](_0xf12a16['limit']||_0x4eda4d);_0x48bec0[_0xcb4a('0x1b')](_0xf12a16[_0xcb4a('0x1b')]||0x0);return dbH['sequelize']['query'](_0x201c92[_0xcb4a('0x85')](),{'type':dbH[_0xcb4a('0x86')][_0xcb4a('0x87')]['SELECT']})[_0xcb4a('0x22')](function(_0x4e837e){if(!_0x4e837e['length']){_0x1e37c7=0x0;}else{_0x1e37c7=_0x4e837e[0x0][_0xcb4a('0x1e')]||0x0;}return dbH['sequelize'][_0xcb4a('0x33')](_0x48bec0['toString'](),{'type':dbH['sequelize'][_0xcb4a('0x87')][_0xcb4a('0xa0')]});})['then'](function(_0xdc0d88){return{'rows':_0xdc0d88||[],'count':_0x1e37c7};});}});}exports[_0xcb4a('0xa1')]=function(_0x2326a0,_0x2ef827){return runReport(_0x2326a0[_0xcb4a('0x47')],_0x2326a0['query'],_0x2326a0[_0xcb4a('0x41')])[_0xcb4a('0x22')](respondWithResult(_0x2ef827,null))[_0xcb4a('0x45')](handleError(_0x2ef827,null));};exports[_0xcb4a('0xa2')]=runReport;exports[_0xcb4a('0x33')]=function(_0x26789b,_0x148268){var _0x5656c8=0xa;var _0xe5ccf3=[_0xcb4a('0x55'),_0xcb4a('0x56'),'right_join',_0xcb4a('0x58')];var _0x2ac3b0={'SUM':_0xcb4a('0x59'),'COUNT':_0xcb4a('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcb4a('0x5b'),'MIN':_0xcb4a('0x89'),'AVG':_0xcb4a('0xa3'),'GROUP_CONCAT':_0xcb4a('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x804c83={'SEC_TO_TIME':_0xcb4a('0x5e'),'DATE':_0xcb4a('0x5f'),'HOUR':_0xcb4a('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcb4a('0x62')};var _0x324ce2=function(_0x259acf){return!_[_0xcb4a('0x7c')]([_0xcb4a('0x8a'),_0xcb4a('0x63'),_0xcb4a('0x64'),_0xcb4a('0x65')],_0x259acf);};var _0x579e33=function(_0x4a1941){if(!_0x4a1941||!_0x4a1941[_0xcb4a('0x66')][_0xcb4a('0x38')]){return'';}for(var _0x45d595='(',_0xbdba7c=0x0;_0xbdba7c<_0x4a1941[_0xcb4a('0x66')][_0xcb4a('0x38')];_0xbdba7c+=0x1){_0xbdba7c>0x0&&(_0x45d595+='\x20'+_0x4a1941[_0xcb4a('0x67')]+'\x20');_0x45d595+=_0x4a1941[_0xcb4a('0x66')][_0xbdba7c]['group']?_0x579e33(_0x4a1941['rules'][_0xbdba7c][_0xcb4a('0x68')]):_0x4a1941[_0xcb4a('0x66')][_0xbdba7c][_0xcb4a('0x69')]+'\x20'+_0x4a1941[_0xcb4a('0x66')][_0xbdba7c]['condition']+(_0x324ce2(_0x4a1941['rules'][_0xbdba7c][_0xcb4a('0x6a')])?'\x20'+_0x4a1941[_0xcb4a('0x66')][_0xbdba7c][_0xcb4a('0x8b')]:'');}return _0x45d595+')';};var _0x3735b3={'where':{'id':_0x26789b['params']['id']}},_0x44cae5,_0x260f98,_0x2133df,_0x302ab6,_0x916884;_0x3735b3=_[_0xcb4a('0x3f')]({},_0x3735b3,_0x26789b[_0xcb4a('0x41')]);return db['AnalyticCustomReport'][_0xcb4a('0x4a')](_0x3735b3)[_0xcb4a('0x22')](function(_0x2f52ef){if(_0x2f52ef){_0x44cae5=_0x2f52ef;return _0x2f52ef[_0xcb4a('0x8c')]();}return null;})[_0xcb4a('0x22')](function(_0x24d548){if(_0x24d548){if(!_0x24d548[_0xcb4a('0x38')]){throw new db[(_0xcb4a('0x6b'))][(_0xcb4a('0x6c'))](_0xcb4a('0x6d'),0x193);}_0x260f98=_0x24d548;return db['AnalyticMetric'][_0xcb4a('0x43')]({'raw':!![]});}return null;})[_0xcb4a('0x22')](function(_0x133a95){if(_0x133a95){_0x2133df=_[_0xcb4a('0x6f')](_0x133a95,'id');var _0x224f11;var _0x3c164a=squel[_0xcb4a('0x70')]();_0x3c164a[_0xcb4a('0x71')](_0x44cae5[_0xcb4a('0x72')]);for(var _0x45158a=0x0;_0x45158a<_0x260f98['length'];_0x45158a+=0x1){_0x224f11=_0x260f98[_0x45158a][_0xcb4a('0x73')]?_0x2133df[_0x260f98[_0x45158a][_0xcb4a('0x73')]][_0xcb4a('0xa4')]:_0x260f98[_0x45158a][_0xcb4a('0x69')];_0x224f11=_0x260f98[_0x45158a][_0xcb4a('0x74')]?_[_0xcb4a('0x75')](_0x2ac3b0[_0x260f98[_0x45158a]['function']],'%s',_0x224f11):_0x224f11;_0x224f11=_0x260f98[_0x45158a][_0xcb4a('0x76')]?_[_0xcb4a('0x75')](_0x804c83[_0x260f98[_0x45158a][_0xcb4a('0x76')]],'%s',_0x224f11):_0x224f11;if(_0x260f98[_0x45158a]['groupBy']){_0x3c164a[_0xcb4a('0x68')](_0x224f11);}_0x260f98[_0x45158a][_0xcb4a('0x78')]&&_0x3c164a[_0xcb4a('0x8d')](_0x224f11,_0x260f98[_0x45158a][_0xcb4a('0x78')]===_0xcb4a('0x8e')?![]:!![]);_0x3c164a[_0xcb4a('0x69')](_0x224f11,_0x260f98[_0x45158a][_0xcb4a('0x79')]||_0x224f11);}if(_0x44cae5[_0xcb4a('0x7a')]){_0x44cae5[_0xcb4a('0x7a')]=JSON[_0xcb4a('0x82')](_0x44cae5[_0xcb4a('0x7a')]);for(var _0x489b8b=0x0;_0x489b8b<_0x44cae5[_0xcb4a('0x7a')][_0xcb4a('0x38')];_0x489b8b+=0x1){if(_0x44cae5[_0xcb4a('0x7a')][_0x489b8b]['type']&&_[_0xcb4a('0x7c')](_0xe5ccf3,_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x7b')])&&_0x44cae5['joins'][_0x489b8b][_0xcb4a('0x80')]&&_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x7e')]&&_0x44cae5[_0xcb4a('0x7a')][_0x489b8b]['foreignKey']){_0x3c164a[_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x7b')]](_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x7e')],null,util['format'](_0xcb4a('0x7f'),_0x44cae5[_0xcb4a('0x72')],_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x80')],_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x7e')],_0x44cae5[_0xcb4a('0x7a')][_0x489b8b][_0xcb4a('0x7d')]));}}}if(_0x44cae5[_0xcb4a('0x81')]){_0x44cae5[_0xcb4a('0x81')]=JSON['parse'](_0x44cae5['conditions']);_0x3c164a['where'](_0x579e33(_0x44cae5[_0xcb4a('0x81')][_0xcb4a('0x68')]));}_0x916884=_0x3c164a[_0xcb4a('0x83')]();_0x3c164a['limit'](_0x5656c8);_0x3c164a[_0xcb4a('0x1b')](0x0);logger[_0xcb4a('0xa5')](_0xcb4a('0x84'),_0x3c164a[_0xcb4a('0x85')]());return dbH[_0xcb4a('0x86')][_0xcb4a('0x33')](_0x3c164a[_0xcb4a('0x85')](),{'type':dbH[_0xcb4a('0x86')][_0xcb4a('0x87')][_0xcb4a('0xa0')]});}})['then'](function(){return{'sql':_0x916884[_0xcb4a('0x85')]()};})[_0xcb4a('0x22')](respondWithResult(_0x148268,null))[_0xcb4a('0x45')](handleError(_0x148268,null));}; \ No newline at end of file +var _0xb14f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','CustomReports','UserProfileResource','end','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','format','replace','groupBy','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','condition','value','Sequelize','AnalyticMetric','function','alias','parse','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','output','savename','countTable','COUNT(*)','SELECT','run','IS\x20NOT\x20EMPTY'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0xb14f,0x152));var _0xfb14=function(_0x5832ad,_0x8bba60){_0x5832ad=_0x5832ad-0x0;var _0x52474c=_0xb14f[_0x5832ad];return _0x52474c;};'use strict';var emlformat=require(_0xfb14('0x0'));var rimraf=require(_0xfb14('0x1'));var zipdir=require(_0xfb14('0x2'));var jsonpatch=require(_0xfb14('0x3'));var rp=require(_0xfb14('0x4'));var moment=require(_0xfb14('0x5'));var BPromise=require(_0xfb14('0x6'));var Mustache=require(_0xfb14('0x7'));var util=require(_0xfb14('0x8'));var path=require('path');var sox=require(_0xfb14('0x9'));var csv=require('to-csv');var ejs=require(_0xfb14('0xa'));var fs=require('fs');var fs_extra=require(_0xfb14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb14('0xc'));var jsforce=require(_0xfb14('0xd'));var deskjs=require(_0xfb14('0xe'));var toCsv=require(_0xfb14('0xf'));var querystring=require(_0xfb14('0x10'));var Papa=require('papaparse');var Redis=require(_0xfb14('0x11'));var authService=require(_0xfb14('0x12'));var qs=require(_0xfb14('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb14('0x14'));var logger=require(_0xfb14('0x15'))('api');var utils=require(_0xfb14('0x16'));var config=require(_0xfb14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb14('0x18'))['db'];var dbH=require(_0xfb14('0x18'))[_0xfb14('0x19')];function respondWithStatusCode(_0x3fee2f,_0x144fba){_0x144fba=_0x144fba||0xcc;return function(_0x44ff5a){if(_0x44ff5a){return _0x3fee2f[_0xfb14('0x1a')](_0x144fba);}return _0x3fee2f['status'](_0x144fba)['end']();};}function respondWithResult(_0x1ad6e1,_0x4a7d88){_0x4a7d88=_0x4a7d88||0xc8;return function(_0x592121){if(_0x592121){return _0x1ad6e1[_0xfb14('0x1b')](_0x4a7d88)['json'](_0x592121);}};}function respondWithFilteredResult(_0x4c22f3,_0xefb7ca){return function(_0x4d6998){if(_0x4d6998){var _0x9b3952=typeof _0xefb7ca['offset']===_0xfb14('0x1c')&&typeof _0xefb7ca[_0xfb14('0x1d')]===_0xfb14('0x1c');var _0x4b3563=_0x4d6998['count'];var _0x278911=_0x9b3952?0x0:_0xefb7ca['offset'];var _0x23b543=_0x9b3952?_0x4d6998[_0xfb14('0x1e')]:_0xefb7ca[_0xfb14('0x1f')]+_0xefb7ca['limit'];var _0x2f42a0;if(_0x23b543>=_0x4b3563){_0x23b543=_0x4b3563;_0x2f42a0=0xc8;}else{_0x2f42a0=0xce;}_0x4c22f3[_0xfb14('0x1b')](_0x2f42a0);return _0x4c22f3[_0xfb14('0x20')]('Content-Range',_0x278911+'-'+_0x23b543+'/'+_0x4b3563)[_0xfb14('0x21')](_0x4d6998);}return null;};}function patchUpdates(_0x333fa5){return function(_0x2cc7c3){try{jsonpatch['apply'](_0x2cc7c3,_0x333fa5,!![]);}catch(_0x143046){return BPromise[_0xfb14('0x22')](_0x143046);}return _0x2cc7c3[_0xfb14('0x23')]();};}function saveUpdates(_0x544bad,_0x46f7a4){return function(_0x1be5ba){if(_0x1be5ba){return _0x1be5ba[_0xfb14('0x24')](_0x544bad)[_0xfb14('0x25')](function(_0x30e997){return _0x30e997;});}return null;};}function removeEntity(_0x22ad07,_0x504feb){return function(_0x39be40){if(_0x39be40){return _0x39be40[_0xfb14('0x26')]()[_0xfb14('0x25')](function(){var _0x295ba8=_0x39be40['get']({'plain':!![]});var _0x5b3932=_0xfb14('0x27');return db[_0xfb14('0x28')][_0xfb14('0x26')]({'where':{'type':_0x5b3932,'resourceId':_0x295ba8['id']}})[_0xfb14('0x25')](function(){return _0x39be40;});})[_0xfb14('0x25')](function(){_0x22ad07[_0xfb14('0x1b')](0xcc)[_0xfb14('0x29')]();});}};}function handleEntityNotFound(_0x54e988,_0x13cf02){return function(_0x2eccc5){if(!_0x2eccc5){_0x54e988['sendStatus'](0x194);}return _0x2eccc5;};}function handleError(_0x14cb06,_0x31bdd9){_0x31bdd9=_0x31bdd9||0x1f4;return function(_0x1f9b9b){logger['error'](_0x1f9b9b['stack']);if(_0x1f9b9b[_0xfb14('0x2a')]){delete _0x1f9b9b[_0xfb14('0x2a')];}_0x14cb06[_0xfb14('0x1b')](_0x31bdd9)[_0xfb14('0x2b')](_0x1f9b9b);};}exports[_0xfb14('0x2c')]=function(_0x3a53ab,_0xc64dda){var _0x4257eb={},_0x474acc={},_0x302248={'count':0x0,'rows':[]};var _0x56b83a=_[_0xfb14('0x2d')](db[_0xfb14('0x2e')][_0xfb14('0x2f')],function(_0x2e6607){return{'name':_0x2e6607[_0xfb14('0x30')],'type':_0x2e6607['type'][_0xfb14('0x31')]};});_0x474acc[_0xfb14('0x32')]=_[_0xfb14('0x2d')](_0x56b83a,_0xfb14('0x2a'));_0x474acc[_0xfb14('0x33')]=_[_0xfb14('0x34')](_0x3a53ab[_0xfb14('0x33')]);_0x474acc[_0xfb14('0x35')]=_['intersection'](_0x474acc[_0xfb14('0x32')],_0x474acc['query']);_0x4257eb[_0xfb14('0x36')]=_['intersection'](_0x474acc[_0xfb14('0x32')],qs['fields'](_0x3a53ab[_0xfb14('0x33')][_0xfb14('0x37')]));_0x4257eb[_0xfb14('0x36')]=_0x4257eb[_0xfb14('0x36')][_0xfb14('0x38')]?_0x4257eb[_0xfb14('0x36')]:_0x474acc[_0xfb14('0x32')];if(!_0x3a53ab['query']['hasOwnProperty'](_0xfb14('0x39'))){_0x4257eb['limit']=qs[_0xfb14('0x1d')](_0x3a53ab[_0xfb14('0x33')][_0xfb14('0x1d')]);_0x4257eb[_0xfb14('0x1f')]=qs[_0xfb14('0x1f')](_0x3a53ab[_0xfb14('0x33')][_0xfb14('0x1f')]);}_0x4257eb[_0xfb14('0x3a')]=qs[_0xfb14('0x3b')](_0x3a53ab[_0xfb14('0x33')]['sort']);_0x4257eb[_0xfb14('0x3c')]=qs[_0xfb14('0x35')](_[_0xfb14('0x3d')](_0x3a53ab[_0xfb14('0x33')],_0x474acc[_0xfb14('0x35')]),_0x56b83a);if(_0x3a53ab[_0xfb14('0x33')][_0xfb14('0x3e')]){_0x4257eb['where']=_[_0xfb14('0x3f')](_0x4257eb[_0xfb14('0x3c')],{'$or':_[_0xfb14('0x2d')](_0x56b83a,function(_0x4f33ba){if(_0x4f33ba[_0xfb14('0x40')]!==_0xfb14('0x41')){var _0xc1b388={};_0xc1b388[_0x4f33ba[_0xfb14('0x2a')]]={'$like':'%'+_0x3a53ab[_0xfb14('0x33')][_0xfb14('0x3e')]+'%'};return _0xc1b388;}})});}_0x4257eb=_[_0xfb14('0x3f')]({},_0x4257eb,_0x3a53ab[_0xfb14('0x42')]);var _0xc68cc1={'where':_0x4257eb[_0xfb14('0x3c')]};return db[_0xfb14('0x2e')][_0xfb14('0x1e')](_0xc68cc1)[_0xfb14('0x25')](function(_0x1311f3){_0x302248[_0xfb14('0x1e')]=_0x1311f3;if(_0x3a53ab['query'][_0xfb14('0x43')]){_0x4257eb['include']=[{'all':!![]}];}return db[_0xfb14('0x2e')][_0xfb14('0x44')](_0x4257eb);})[_0xfb14('0x25')](function(_0x290f80){_0x302248[_0xfb14('0x45')]=_0x290f80;return _0x302248;})[_0xfb14('0x25')](respondWithFilteredResult(_0xc64dda,_0x4257eb))[_0xfb14('0x46')](handleError(_0xc64dda,null));};exports[_0xfb14('0x47')]=function(_0x129511,_0x149b19){var _0x31fe79={'raw':![],'where':{'id':_0x129511[_0xfb14('0x48')]['id']}},_0x3eb6df={};_0x3eb6df[_0xfb14('0x32')]=_['keys'](db['AnalyticCustomReport'][_0xfb14('0x2f')]);_0x3eb6df[_0xfb14('0x33')]=_[_0xfb14('0x34')](_0x129511['query']);_0x3eb6df[_0xfb14('0x35')]=_[_0xfb14('0x49')](_0x3eb6df[_0xfb14('0x32')],_0x3eb6df[_0xfb14('0x33')]);_0x31fe79[_0xfb14('0x36')]=_[_0xfb14('0x49')](_0x3eb6df[_0xfb14('0x32')],qs[_0xfb14('0x37')](_0x129511[_0xfb14('0x33')][_0xfb14('0x37')]));_0x31fe79[_0xfb14('0x36')]=_0x31fe79[_0xfb14('0x36')]['length']?_0x31fe79[_0xfb14('0x36')]:_0x3eb6df[_0xfb14('0x32')];if(_0x129511[_0xfb14('0x33')]['includeAll']){_0x31fe79[_0xfb14('0x4a')]=[{'all':!![]}];}_0x31fe79=_[_0xfb14('0x3f')]({},_0x31fe79,_0x129511[_0xfb14('0x42')]);return db[_0xfb14('0x2e')][_0xfb14('0x4b')](_0x31fe79)[_0xfb14('0x25')](handleEntityNotFound(_0x149b19,null))[_0xfb14('0x25')](respondWithResult(_0x149b19,null))[_0xfb14('0x46')](handleError(_0x149b19,null));};exports[_0xfb14('0x4c')]=function(_0x407db4,_0x5615fd){return db[_0xfb14('0x2e')][_0xfb14('0x4c')](_0x407db4['body'],{})[_0xfb14('0x25')](function(_0x177172){var _0x1f4b3f=_0x407db4[_0xfb14('0x4d')][_0xfb14('0x4e')]({'plain':!![]});if(!_0x1f4b3f)throw new Error(_0xfb14('0x4f'));if(_0x1f4b3f[_0xfb14('0x50')]===_0xfb14('0x4d')){var _0x48bbd5=_0x177172[_0xfb14('0x4e')]({'plain':!![]});var _0x4cc005='Reports';return db[_0xfb14('0x51')][_0xfb14('0x4b')]({'where':{'name':_0x4cc005,'userProfileId':_0x1f4b3f[_0xfb14('0x52')]},'raw':!![]})['then'](function(_0x11b331){if(_0x11b331&&_0x11b331[_0xfb14('0x53')]===0x0){return db[_0xfb14('0x28')][_0xfb14('0x4c')]({'name':_0x48bbd5[_0xfb14('0x2a')],'resourceId':_0x48bbd5['id'],'type':'CustomReports','sectionId':_0x11b331['id']},{})[_0xfb14('0x25')](function(){return _0x177172;});}else{return _0x177172;}})['catch'](function(_0x547cb9){logger[_0xfb14('0x54')](_0xfb14('0x55'),_0x547cb9);throw _0x547cb9;});}return _0x177172;})[_0xfb14('0x25')](respondWithResult(_0x5615fd,0xc9))[_0xfb14('0x46')](handleError(_0x5615fd,null));};exports[_0xfb14('0x24')]=function(_0x11b3c6,_0x1b1f64){if(_0x11b3c6[_0xfb14('0x56')]['id']){delete _0x11b3c6[_0xfb14('0x56')]['id'];}return db['AnalyticCustomReport'][_0xfb14('0x4b')]({'where':{'id':_0x11b3c6[_0xfb14('0x48')]['id']}})[_0xfb14('0x25')](handleEntityNotFound(_0x1b1f64,null))[_0xfb14('0x25')](saveUpdates(_0x11b3c6[_0xfb14('0x56')],null))[_0xfb14('0x25')](respondWithResult(_0x1b1f64,null))[_0xfb14('0x46')](handleError(_0x1b1f64,null));};exports['destroy']=function(_0x4e5f50,_0xa3dfb){return db['AnalyticCustomReport'][_0xfb14('0x4b')]({'where':{'id':_0x4e5f50['params']['id']}})[_0xfb14('0x25')](handleEntityNotFound(_0xa3dfb,null))[_0xfb14('0x25')](removeEntity(_0xa3dfb,null))[_0xfb14('0x46')](handleError(_0xa3dfb,null));};exports['preview']=function(_0x2129d5,_0x27ac27){var _0x37ec4e=0xa;var _0x2fc22d=[_0xfb14('0x57'),_0xfb14('0x58'),_0xfb14('0x59'),_0xfb14('0x5a')];var _0xce9757={'SUM':_0xfb14('0x5b'),'COUNT':_0xfb14('0x5c'),'COUNT DISTINCT':_0xfb14('0x5d'),'MAX':_0xfb14('0x5e'),'MIN':_0xfb14('0x5f'),'AVG':_0xfb14('0x60'),'GROUP_CONCAT':_0xfb14('0x61'),'GROUP_CONCAT ASC':_0xfb14('0x62'),'GROUP_CONCAT DESC':_0xfb14('0x63')};var _0x3903c5={'SEC_TO_TIME':_0xfb14('0x64'),'DATE':'DATE(%s)','HOUR':_0xfb14('0x65'),'ROUND':_0xfb14('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4f71f1=function(_0x5103e0){return!_[_0xfb14('0x67')](['IS\x20NULL',_0xfb14('0x68'),_0xfb14('0x69'),'IS\x20NOT\x20EMPTY'],_0x5103e0);};var _0x55d8bb=function(_0x22d6b9){if(!_0x22d6b9||!_0x22d6b9[_0xfb14('0x6a')][_0xfb14('0x38')]){return'';}for(var _0x306f2d='(',_0x50dc97=0x0;_0x50dc97<_0x22d6b9['rules'][_0xfb14('0x38')];_0x50dc97+=0x1){_0x50dc97>0x0&&(_0x306f2d+='\x20'+_0x22d6b9[_0xfb14('0x6b')]+'\x20');_0x306f2d+=_0x22d6b9[_0xfb14('0x6a')][_0x50dc97][_0xfb14('0x6c')]?_0x55d8bb(_0x22d6b9['rules'][_0x50dc97][_0xfb14('0x6c')]):_0x22d6b9[_0xfb14('0x6a')][_0x50dc97][_0xfb14('0x6d')]+'\x20'+_0x22d6b9[_0xfb14('0x6a')][_0x50dc97]['condition']+(_0x4f71f1(_0x22d6b9[_0xfb14('0x6a')][_0x50dc97]['condition'])?'\x20'+_0x22d6b9[_0xfb14('0x6a')][_0x50dc97]['value']:'');}return _0x306f2d+')';};var _0x114440={'where':{'id':_0x2129d5['params']['id']}},_0x3bc0c7,_0xffa29d,_0x37828b,_0x2665d1,_0x4d9b41;_0x114440=_[_0xfb14('0x3f')]({},_0x114440,_0x2129d5[_0xfb14('0x42')]);return db[_0xfb14('0x2e')]['find'](_0x114440)['then'](function(_0x381f97){if(_0x381f97){_0x3bc0c7=_0x381f97;return _0x381f97[_0xfb14('0x6e')]();}return null;})[_0xfb14('0x25')](function(_0x43ef49){if(_0x43ef49){if(!_0x43ef49[_0xfb14('0x38')]){throw new db['Sequelize'][(_0xfb14('0x6f'))](_0xfb14('0x70'),0x193);}_0xffa29d=_0x43ef49;return db['AnalyticMetric'][_0xfb14('0x44')]({'raw':!![]});}return null;})['then'](function(_0x2b2776){if(_0x2b2776){_0x37828b=_[_0xfb14('0x71')](_0x2b2776,'id');var _0x297b7a;var _0x53c6f3=squel[_0xfb14('0x72')]();_0x53c6f3[_0xfb14('0x73')](_0x3bc0c7[_0xfb14('0x74')]);for(var _0x27e948=0x0;_0x27e948<_0xffa29d[_0xfb14('0x38')];_0x27e948+=0x1){_0x297b7a=_0xffa29d[_0x27e948][_0xfb14('0x75')]?_0x37828b[_0xffa29d[_0x27e948]['MetricId']][_0xfb14('0x76')]:_0xffa29d[_0x27e948][_0xfb14('0x6d')];_0x297b7a=_0xffa29d[_0x27e948]['function']?_['replace'](_0xce9757[_0xffa29d[_0x27e948]['function']],'%s',_0x297b7a):_0x297b7a;_0x297b7a=_0xffa29d[_0x27e948][_0xfb14('0x77')]?_[_0xfb14('0x78')](_0x3903c5[_0xffa29d[_0x27e948][_0xfb14('0x77')]],'%s',_0x297b7a):_0x297b7a;if(_0xffa29d[_0x27e948][_0xfb14('0x79')]){_0x53c6f3['group'](_0x297b7a);}_0xffa29d[_0x27e948][_0xfb14('0x7a')]&&_0x53c6f3[_0xfb14('0x3a')](_0x297b7a,_0xffa29d[_0x27e948]['orderBy']===_0xfb14('0x7b')?![]:!![]);_0x53c6f3[_0xfb14('0x6d')](_0x297b7a,_0xffa29d[_0x27e948]['alias']||_0x297b7a);}if(_0x3bc0c7[_0xfb14('0x7c')]){_0x3bc0c7['joins']=JSON['parse'](_0x3bc0c7['joins']);for(var _0x386de8=0x0;_0x386de8<_0x3bc0c7[_0xfb14('0x7c')][_0xfb14('0x38')];_0x386de8+=0x1){if(_0x3bc0c7[_0xfb14('0x7c')][_0x386de8][_0xfb14('0x40')]&&_[_0xfb14('0x67')](_0x2fc22d,_0x3bc0c7[_0xfb14('0x7c')][_0x386de8][_0xfb14('0x40')])&&_0x3bc0c7[_0xfb14('0x7c')][_0x386de8][_0xfb14('0x7d')]&&_0x3bc0c7['joins'][_0x386de8][_0xfb14('0x7e')]&&_0x3bc0c7['joins'][_0x386de8][_0xfb14('0x7f')]){_0x53c6f3[_0x3bc0c7[_0xfb14('0x7c')][_0x386de8][_0xfb14('0x40')]](_0x3bc0c7['joins'][_0x386de8]['foreignTable'],null,util['format'](_0xfb14('0x80'),_0x3bc0c7['table'],_0x3bc0c7['joins'][_0x386de8][_0xfb14('0x7d')],_0x3bc0c7[_0xfb14('0x7c')][_0x386de8][_0xfb14('0x7e')],_0x3bc0c7[_0xfb14('0x7c')][_0x386de8][_0xfb14('0x7f')]));}}}if(_0x3bc0c7[_0xfb14('0x81')]){_0x3bc0c7[_0xfb14('0x81')]=JSON['parse'](_0x3bc0c7[_0xfb14('0x81')]);_0x53c6f3['where'](_0x55d8bb(_0x3bc0c7['conditions'][_0xfb14('0x6c')]));}_0x4d9b41=_0x53c6f3[_0xfb14('0x82')]();_0x53c6f3['limit'](_0x37ec4e);_0x53c6f3['offset'](0x0);logger['debug'](_0xfb14('0x83'),_0x53c6f3[_0xfb14('0x84')]());return dbH[_0xfb14('0x85')]['query'](_0x53c6f3[_0xfb14('0x84')](),{'type':dbH[_0xfb14('0x85')][_0xfb14('0x86')]['SELECT']});}})['then'](respondWithResult(_0x27ac27,null))['catch'](handleError(_0x27ac27,null));};function runReport(_0x25e41a,_0x581dd7,_0x1512cf){var _0x5e39ed=_0x581dd7[_0xfb14('0x2a')];var _0x1d085a=0xa;var _0x2dec6f=['join',_0xfb14('0x58'),'right_join',_0xfb14('0x5a')];var _0x3abb54={'SUM':_0xfb14('0x5b'),'COUNT':_0xfb14('0x5c'),'COUNT DISTINCT':_0xfb14('0x5d'),'MAX':_0xfb14('0x5e'),'MIN':_0xfb14('0x5f'),'AVG':_0xfb14('0x60'),'GROUP_CONCAT':_0xfb14('0x61'),'GROUP_CONCAT ASC':_0xfb14('0x62'),'GROUP_CONCAT DESC':_0xfb14('0x63')};var _0x3bea49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfb14('0x87'),'HOUR':'HOUR(%s)','ROUND':_0xfb14('0x66'),'UNIX_TIMESTAMP':_0xfb14('0x88')};var _0x141ab6=function(_0x3e20af){return!_[_0xfb14('0x67')]([_0xfb14('0x89'),_0xfb14('0x68'),_0xfb14('0x69'),'IS\x20NOT\x20EMPTY'],_0x3e20af);};var _0x57783f=function(_0x57041f){if(!_0x57041f||!_0x57041f[_0xfb14('0x6a')]['length']){return'';}for(var _0x23aeee='(',_0x156f5b=0x0;_0x156f5b<_0x57041f[_0xfb14('0x6a')]['length'];_0x156f5b+=0x1){_0x156f5b>0x0&&(_0x23aeee+='\x20'+_0x57041f[_0xfb14('0x6b')]+'\x20');_0x23aeee+=_0x57041f['rules'][_0x156f5b][_0xfb14('0x6c')]?_0x57783f(_0x57041f['rules'][_0x156f5b][_0xfb14('0x6c')]):_0x57041f['rules'][_0x156f5b]['field']+'\x20'+_0x57041f[_0xfb14('0x6a')][_0x156f5b][_0xfb14('0x8a')]+(_0x141ab6(_0x57041f[_0xfb14('0x6a')][_0x156f5b][_0xfb14('0x8a')])?'\x20'+_0x57041f[_0xfb14('0x6a')][_0x156f5b][_0xfb14('0x8b')]:'');}return _0x23aeee+')';};var _0x227381={'where':{'id':_0x25e41a['id']}},_0x3f372a,_0x238d89,_0xa8a338,_0x5b39fb,_0x4f60fe;_0x227381=_[_0xfb14('0x3f')]({},_0x227381,_0x1512cf);return db[_0xfb14('0x2e')]['find'](_0x227381)[_0xfb14('0x25')](function(_0x4c9ebe){if(_0x4c9ebe){_0x3f372a=_0x4c9ebe;return _0x4c9ebe[_0xfb14('0x6e')]();}return null;})[_0xfb14('0x25')](function(_0x5c3a60){if(_0x5c3a60){if(!_0x5c3a60[_0xfb14('0x38')]){throw new db[(_0xfb14('0x8c'))][(_0xfb14('0x6f'))](_0xfb14('0x70'),0x193);}_0x238d89=_0x5c3a60;return db[_0xfb14('0x8d')][_0xfb14('0x44')]({'raw':!![]});}return null;})[_0xfb14('0x25')](function(_0x46cf14){if(_0x46cf14){_0xa8a338=_[_0xfb14('0x71')](_0x46cf14,'id');var _0x422e3b;var _0x97361f=squel['select']();_0x97361f[_0xfb14('0x73')](_0x3f372a[_0xfb14('0x74')]);for(var _0x9fb2d7=0x0;_0x9fb2d7<_0x238d89['length'];_0x9fb2d7+=0x1){_0x422e3b=_0x238d89[_0x9fb2d7][_0xfb14('0x75')]?_0xa8a338[_0x238d89[_0x9fb2d7][_0xfb14('0x75')]][_0xfb14('0x76')]:_0x238d89[_0x9fb2d7]['field'];_0x422e3b=_0x238d89[_0x9fb2d7][_0xfb14('0x8e')]?_[_0xfb14('0x78')](_0x3abb54[_0x238d89[_0x9fb2d7]['function']],'%s',_0x422e3b):_0x422e3b;_0x422e3b=_0x238d89[_0x9fb2d7]['format']?_[_0xfb14('0x78')](_0x3bea49[_0x238d89[_0x9fb2d7][_0xfb14('0x77')]],'%s',_0x422e3b):_0x422e3b;if(_0x238d89[_0x9fb2d7][_0xfb14('0x79')]){_0x97361f[_0xfb14('0x6c')](_0x422e3b);}_0x238d89[_0x9fb2d7][_0xfb14('0x7a')]&&_0x97361f[_0xfb14('0x3a')](_0x422e3b,_0x238d89[_0x9fb2d7][_0xfb14('0x7a')]===_0xfb14('0x7b')?![]:!![]);_0x97361f['field'](_0x422e3b,_0x238d89[_0x9fb2d7][_0xfb14('0x8f')]||_0x422e3b);}if(_0x3f372a[_0xfb14('0x7c')]){_0x3f372a[_0xfb14('0x7c')]=JSON[_0xfb14('0x90')](_0x3f372a['joins']);for(var _0xce8aaa=0x0;_0xce8aaa<_0x3f372a['joins'][_0xfb14('0x38')];_0xce8aaa+=0x1){if(_0x3f372a[_0xfb14('0x7c')][_0xce8aaa][_0xfb14('0x40')]&&_[_0xfb14('0x67')](_0x2dec6f,_0x3f372a['joins'][_0xce8aaa][_0xfb14('0x40')])&&_0x3f372a[_0xfb14('0x7c')][_0xce8aaa]['parentKey']&&_0x3f372a[_0xfb14('0x7c')][_0xce8aaa][_0xfb14('0x7e')]&&_0x3f372a[_0xfb14('0x7c')][_0xce8aaa][_0xfb14('0x7f')]){_0x97361f[_0x3f372a[_0xfb14('0x7c')][_0xce8aaa]['type']](_0x3f372a[_0xfb14('0x7c')][_0xce8aaa]['foreignTable'],null,util[_0xfb14('0x77')]('%s.%s\x20=\x20%s.%s',_0x3f372a['table'],_0x3f372a['joins'][_0xce8aaa][_0xfb14('0x7d')],_0x3f372a['joins'][_0xce8aaa][_0xfb14('0x7e')],_0x3f372a[_0xfb14('0x7c')][_0xce8aaa][_0xfb14('0x7f')]));}}}if(_0x3f372a[_0xfb14('0x81')]){_0x3f372a[_0xfb14('0x81')]=JSON[_0xfb14('0x90')](_0x3f372a[_0xfb14('0x81')]);_0x97361f[_0xfb14('0x3c')](_0x57783f(_0x3f372a['conditions']['group']));}_0x4f60fe=_0x97361f[_0xfb14('0x82')]();_0x97361f[_0xfb14('0x1d')](_0x1d085a);_0x97361f[_0xfb14('0x1f')](0x0);return;}})['then'](function(){if(_0x581dd7['output']===_0xfb14('0x91')){return null;}var _0x9b146=_[_0xfb14('0x3f')](_0x581dd7,{'name':_0x581dd7[_0xfb14('0x92')]||_0x581dd7[_0xfb14('0x2a')]||_0x3f372a[_0xfb14('0x2a')],'basename':_0x5e39ed,'savename':util[_0xfb14('0x77')](_0xfb14('0x93'),_0x581dd7['name']||_0x3f372a[_0xfb14('0x2a')],require(_0xfb14('0x94'))[_0xfb14('0x95')](0x4),_0x581dd7['output']||_0xfb14('0x96')),'reportId':_0x3f372a['id'],'reportType':'custom'});return db[_0xfb14('0x97')][_0xfb14('0x4c')](_0x9b146,{'raw':!![]});})[_0xfb14('0x25')](function(_0x357c57){if(_0x3f372a['table']===_0xfb14('0x98')){_0x4f60fe[_0xfb14('0x3c')](_0x3f372a[_0xfb14('0x74')]+_0xfb14('0x99'),_0x581dd7[_0xfb14('0x9a')],_0x581dd7[_0xfb14('0x9b')]);}else{_0x4f60fe[_0xfb14('0x3c')](_0x3f372a[_0xfb14('0x74')]+_0xfb14('0x9c'),_0x581dd7[_0xfb14('0x9a')],_0x581dd7['endDate']);}if(_0x357c57){logger[_0xfb14('0x9d')](_0xfb14('0x9e'),_0x4f60fe['toString']());require(_0xfb14('0x9f'))[_0xfb14('0xa0')](path[_0xfb14('0x57')](__dirname,_0xfb14('0xa1'),_0x357c57[_0xfb14('0xa2')]),[_0x357c57['id'],_0x4f60fe[_0xfb14('0x84')](),path[_0xfb14('0x57')](__dirname,'../../files/reports',_0x357c57[_0xfb14('0xa3')]),_0x5e39ed]);return _0x357c57;}else{var _0x557c53=squel[_0xfb14('0x72')]();_0x557c53[_0xfb14('0x73')]('('+_0x4f60fe[_0xfb14('0x84')]()+')',_0xfb14('0xa4'));_0x557c53[_0xfb14('0x6d')](_0xfb14('0xa5'),'count');_0x4f60fe[_0xfb14('0x1d')](_0x581dd7[_0xfb14('0x1d')]||_0x1d085a);_0x4f60fe[_0xfb14('0x1f')](_0x581dd7[_0xfb14('0x1f')]||0x0);return dbH[_0xfb14('0x85')][_0xfb14('0x33')](_0x557c53[_0xfb14('0x84')](),{'type':dbH[_0xfb14('0x85')][_0xfb14('0x86')]['SELECT']})[_0xfb14('0x25')](function(_0x2fddce){if(!_0x2fddce['length']){_0x5b39fb=0x0;}else{_0x5b39fb=_0x2fddce[0x0]['count']||0x0;}return dbH[_0xfb14('0x85')][_0xfb14('0x33')](_0x4f60fe[_0xfb14('0x84')](),{'type':dbH[_0xfb14('0x85')][_0xfb14('0x86')][_0xfb14('0xa6')]});})[_0xfb14('0x25')](function(_0x4f5adf){return{'rows':_0x4f5adf||[],'count':_0x5b39fb};});}});}exports[_0xfb14('0xa7')]=function(_0x26a9ab,_0xfbab6c){return runReport(_0x26a9ab[_0xfb14('0x48')],_0x26a9ab[_0xfb14('0x33')],_0x26a9ab[_0xfb14('0x42')])['then'](respondWithResult(_0xfbab6c,null))[_0xfb14('0x46')](handleError(_0xfbab6c,null));};exports['runReport']=runReport;exports[_0xfb14('0x33')]=function(_0x269d4e,_0x2dcca4){var _0x116183=0xa;var _0x542622=[_0xfb14('0x57'),'left_join',_0xfb14('0x59'),_0xfb14('0x5a')];var _0x4c0517={'SUM':_0xfb14('0x5b'),'COUNT':_0xfb14('0x5c'),'COUNT DISTINCT':_0xfb14('0x5d'),'MAX':_0xfb14('0x5e'),'MIN':_0xfb14('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfb14('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfb14('0x63')};var _0x13daa1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfb14('0x87'),'HOUR':_0xfb14('0x65'),'ROUND':_0xfb14('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e913c=function(_0x50907a){return!_[_0xfb14('0x67')](['IS\x20NULL',_0xfb14('0x68'),_0xfb14('0x69'),_0xfb14('0xa8')],_0x50907a);};var _0x446a57=function(_0xe923d2){if(!_0xe923d2||!_0xe923d2[_0xfb14('0x6a')][_0xfb14('0x38')]){return'';}for(var _0x5e0453='(',_0x5e6524=0x0;_0x5e6524<_0xe923d2[_0xfb14('0x6a')][_0xfb14('0x38')];_0x5e6524+=0x1){_0x5e6524>0x0&&(_0x5e0453+='\x20'+_0xe923d2['operator']+'\x20');_0x5e0453+=_0xe923d2[_0xfb14('0x6a')][_0x5e6524][_0xfb14('0x6c')]?_0x446a57(_0xe923d2[_0xfb14('0x6a')][_0x5e6524]['group']):_0xe923d2[_0xfb14('0x6a')][_0x5e6524]['field']+'\x20'+_0xe923d2['rules'][_0x5e6524][_0xfb14('0x8a')]+(_0x5e913c(_0xe923d2[_0xfb14('0x6a')][_0x5e6524][_0xfb14('0x8a')])?'\x20'+_0xe923d2[_0xfb14('0x6a')][_0x5e6524][_0xfb14('0x8b')]:'');}return _0x5e0453+')';};var _0x1fa05f={'where':{'id':_0x269d4e[_0xfb14('0x48')]['id']}},_0xacfe78,_0x15d3a8,_0x1e689f,_0x47b481,_0xdf883;_0x1fa05f=_[_0xfb14('0x3f')]({},_0x1fa05f,_0x269d4e[_0xfb14('0x42')]);return db[_0xfb14('0x2e')][_0xfb14('0x4b')](_0x1fa05f)[_0xfb14('0x25')](function(_0x570f30){if(_0x570f30){_0xacfe78=_0x570f30;return _0x570f30[_0xfb14('0x6e')]();}return null;})[_0xfb14('0x25')](function(_0x2a3a81){if(_0x2a3a81){if(!_0x2a3a81['length']){throw new db[(_0xfb14('0x8c'))][(_0xfb14('0x6f'))](_0xfb14('0x70'),0x193);}_0x15d3a8=_0x2a3a81;return db[_0xfb14('0x8d')]['findAll']({'raw':!![]});}return null;})[_0xfb14('0x25')](function(_0x5de9b2){if(_0x5de9b2){_0x1e689f=_[_0xfb14('0x71')](_0x5de9b2,'id');var _0xa3d32;var _0x4de127=squel[_0xfb14('0x72')]();_0x4de127[_0xfb14('0x73')](_0xacfe78['table']);for(var _0x4fa461=0x0;_0x4fa461<_0x15d3a8[_0xfb14('0x38')];_0x4fa461+=0x1){_0xa3d32=_0x15d3a8[_0x4fa461]['MetricId']?_0x1e689f[_0x15d3a8[_0x4fa461]['MetricId']]['metric']:_0x15d3a8[_0x4fa461][_0xfb14('0x6d')];_0xa3d32=_0x15d3a8[_0x4fa461][_0xfb14('0x8e')]?_[_0xfb14('0x78')](_0x4c0517[_0x15d3a8[_0x4fa461][_0xfb14('0x8e')]],'%s',_0xa3d32):_0xa3d32;_0xa3d32=_0x15d3a8[_0x4fa461][_0xfb14('0x77')]?_[_0xfb14('0x78')](_0x13daa1[_0x15d3a8[_0x4fa461][_0xfb14('0x77')]],'%s',_0xa3d32):_0xa3d32;if(_0x15d3a8[_0x4fa461][_0xfb14('0x79')]){_0x4de127[_0xfb14('0x6c')](_0xa3d32);}_0x15d3a8[_0x4fa461][_0xfb14('0x7a')]&&_0x4de127[_0xfb14('0x3a')](_0xa3d32,_0x15d3a8[_0x4fa461][_0xfb14('0x7a')]===_0xfb14('0x7b')?![]:!![]);_0x4de127['field'](_0xa3d32,_0x15d3a8[_0x4fa461][_0xfb14('0x8f')]||_0xa3d32);}if(_0xacfe78[_0xfb14('0x7c')]){_0xacfe78[_0xfb14('0x7c')]=JSON[_0xfb14('0x90')](_0xacfe78['joins']);for(var _0x2b4346=0x0;_0x2b4346<_0xacfe78[_0xfb14('0x7c')]['length'];_0x2b4346+=0x1){if(_0xacfe78['joins'][_0x2b4346][_0xfb14('0x40')]&&_[_0xfb14('0x67')](_0x542622,_0xacfe78['joins'][_0x2b4346][_0xfb14('0x40')])&&_0xacfe78[_0xfb14('0x7c')][_0x2b4346][_0xfb14('0x7d')]&&_0xacfe78['joins'][_0x2b4346][_0xfb14('0x7e')]&&_0xacfe78[_0xfb14('0x7c')][_0x2b4346]['foreignKey']){_0x4de127[_0xacfe78[_0xfb14('0x7c')][_0x2b4346]['type']](_0xacfe78[_0xfb14('0x7c')][_0x2b4346][_0xfb14('0x7e')],null,util[_0xfb14('0x77')](_0xfb14('0x80'),_0xacfe78[_0xfb14('0x74')],_0xacfe78['joins'][_0x2b4346][_0xfb14('0x7d')],_0xacfe78[_0xfb14('0x7c')][_0x2b4346]['foreignTable'],_0xacfe78[_0xfb14('0x7c')][_0x2b4346][_0xfb14('0x7f')]));}}}if(_0xacfe78[_0xfb14('0x81')]){_0xacfe78[_0xfb14('0x81')]=JSON[_0xfb14('0x90')](_0xacfe78[_0xfb14('0x81')]);_0x4de127['where'](_0x446a57(_0xacfe78[_0xfb14('0x81')][_0xfb14('0x6c')]));}_0xdf883=_0x4de127['clone']();_0x4de127['limit'](_0x116183);_0x4de127['offset'](0x0);logger['debug'](_0xfb14('0x83'),_0x4de127[_0xfb14('0x84')]());return dbH[_0xfb14('0x85')][_0xfb14('0x33')](_0x4de127[_0xfb14('0x84')](),{'type':dbH[_0xfb14('0x85')]['QueryTypes']['SELECT']});}})[_0xfb14('0x25')](function(){return{'sql':_0xdf883[_0xfb14('0x84')]()};})[_0xfb14('0x25')](respondWithResult(_0x2dcca4,null))[_0xfb14('0x46')](handleError(_0x2dcca4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index b6dd529..47dc8bb 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 _0x37be=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash'];(function(_0x64abe3,_0x15f562){var _0x322d2f=function(_0x16d3bb){while(--_0x16d3bb){_0x64abe3['push'](_0x64abe3['shift']());}};_0x322d2f(++_0x15f562);}(_0x37be,0xbf));var _0xe37b=function(_0x1083db,_0x4d79ce){_0x1083db=_0x1083db-0x0;var _0x5a932f=_0x37be[_0x1083db];return _0x5a932f;};'use strict';var _=require(_0xe37b('0x0'));var util=require(_0xe37b('0x1'));var logger=require(_0xe37b('0x2'))(_0xe37b('0x3'));var moment=require(_0xe37b('0x4'));var BPromise=require(_0xe37b('0x5'));var rp=require(_0xe37b('0x6'));var fs=require('fs');var path=require(_0xe37b('0x7'));var rimraf=require(_0xe37b('0x8'));var config=require('../../config/environment');var attributes=require(_0xe37b('0x9'));module[_0xe37b('0xa')]=function(_0x140e17,_0x5763aa){return _0x140e17['define']('AnalyticCustomReport',attributes,{'tableName':_0xe37b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x268f=['request-promise','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','lodash','util','api','bluebird'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x268f,0x193));var _0xf268=function(_0x499ccc,_0x45b1a1){_0x499ccc=_0x499ccc-0x0;var _0x1fcbf7=_0x268f[_0x499ccc];return _0x1fcbf7;};'use strict';var _=require(_0xf268('0x0'));var util=require(_0xf268('0x1'));var logger=require('../../config/logger')(_0xf268('0x2'));var moment=require('moment');var BPromise=require(_0xf268('0x3'));var rp=require(_0xf268('0x4'));var fs=require('fs');var path=require(_0xf268('0x5'));var rimraf=require(_0xf268('0x6'));var config=require(_0xf268('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0xf268('0x8')]=function(_0x3c77e3,_0x4638a7){return _0x3c77e3[_0xf268('0x9')](_0xf268('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 06afc73..3b78c84 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 _0x6c3e=['jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc'];(function(_0x2f430a,_0x46d370){var _0x10def3=function(_0x347eaa){while(--_0x347eaa){_0x2f430a['push'](_0x2f430a['shift']());}};_0x10def3(++_0x46d370);}(_0x6c3e,0x117));var _0xe6c3=function(_0x38c34b,_0x583607){_0x38c34b=_0x38c34b-0x0;var _0x3dd7c3=_0x6c3e[_0x38c34b];return _0x3dd7c3;};'use strict';var _=require(_0xe6c3('0x0'));var util=require(_0xe6c3('0x1'));var moment=require(_0xe6c3('0x2'));var BPromise=require('bluebird');var rs=require(_0xe6c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe6c3('0x4'))(_0xe6c3('0x5'));var config=require('../../config/environment');var jayson=require(_0xe6c3('0x6'));var client=jayson[_0xe6c3('0x7')][_0xe6c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58b022,_0x23a1b0,_0xc2f879){return new BPromise(function(_0x4b965d,_0x5bcd41){return client[_0xe6c3('0x9')](_0x58b022,_0xc2f879)[_0xe6c3('0xa')](function(_0x51bf8d){logger[_0xe6c3('0xb')](_0xe6c3('0xc'),_0x23a1b0,_0xe6c3('0xd'));logger['debug'](_0xe6c3('0xe'),_0x23a1b0,_0xe6c3('0xd'),JSON['stringify'](_0x51bf8d));if(_0x51bf8d[_0xe6c3('0xf')]){if(_0x51bf8d[_0xe6c3('0xf')]['code']===0x1f4){logger[_0xe6c3('0xf')](_0xe6c3('0xc'),_0x23a1b0,_0x51bf8d[_0xe6c3('0xf')]['message']);return _0x5bcd41(_0x51bf8d[_0xe6c3('0xf')]['message']);}logger[_0xe6c3('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x23a1b0,_0x51bf8d[_0xe6c3('0xf')][_0xe6c3('0x10')]);return _0x4b965d(_0x51bf8d[_0xe6c3('0xf')][_0xe6c3('0x10')]);}else{logger[_0xe6c3('0xb')](_0xe6c3('0xc'),_0x23a1b0,_0xe6c3('0xd'));_0x4b965d(_0x51bf8d[_0xe6c3('0x11')][_0xe6c3('0x10')]);}})[_0xe6c3('0x12')](function(_0x2e7504){logger[_0xe6c3('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x23a1b0,_0x2e7504);_0x5bcd41(_0x2e7504);});});} \ No newline at end of file +var _0x1357=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1357,0x1e4));var _0x7135=function(_0x497a37,_0x260522){_0x497a37=_0x497a37-0x0;var _0x557e26=_0x1357[_0x497a37];return _0x557e26;};'use strict';var _=require(_0x7135('0x0'));var util=require('util');var moment=require(_0x7135('0x1'));var BPromise=require(_0x7135('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7135('0x3'));var db=require(_0x7135('0x4'))['db'];var utils=require(_0x7135('0x5'));var logger=require(_0x7135('0x6'))(_0x7135('0x7'));var config=require(_0x7135('0x8'));var jayson=require(_0x7135('0x9'));var client=jayson[_0x7135('0xa')][_0x7135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x162206,_0x101849,_0x477577){return new BPromise(function(_0x40bbeb,_0x58e0e6){return client[_0x7135('0xc')](_0x162206,_0x477577)[_0x7135('0xd')](function(_0x2ac707){logger['info'](_0x7135('0xe'),_0x101849,_0x7135('0xf'));logger['debug'](_0x7135('0x10'),_0x101849,'request\x20sent',JSON[_0x7135('0x11')](_0x2ac707));if(_0x2ac707[_0x7135('0x12')]){if(_0x2ac707['error'][_0x7135('0x13')]===0x1f4){logger[_0x7135('0x12')](_0x7135('0xe'),_0x101849,_0x2ac707[_0x7135('0x12')]['message']);return _0x58e0e6(_0x2ac707[_0x7135('0x12')][_0x7135('0x14')]);}logger[_0x7135('0x12')](_0x7135('0xe'),_0x101849,_0x2ac707[_0x7135('0x12')][_0x7135('0x14')]);return _0x40bbeb(_0x2ac707[_0x7135('0x12')][_0x7135('0x14')]);}else{logger[_0x7135('0x15')](_0x7135('0xe'),_0x101849,_0x7135('0xf'));_0x40bbeb(_0x2ac707['result'][_0x7135('0x14')]);}})[_0x7135('0x16')](function(_0x31b017){logger[_0x7135('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x101849,_0x31b017);_0x58e0e6(_0x31b017);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 1c1bb33..38de8fc 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 _0x92f4=['index','get','show','preview','/:id/run','/:id/query','query','create','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated'];(function(_0xdbf30c,_0xa49fb){var _0x1447e8=function(_0x47854d){while(--_0x47854d){_0xdbf30c['push'](_0xdbf30c['shift']());}};_0x1447e8(++_0xa49fb);}(_0x92f4,0x1db));var _0x492f=function(_0x11561a,_0x38d7e0){_0x11561a=_0x11561a-0x0;var _0xb77b8d=_0x92f4[_0x11561a];return _0xb77b8d;};'use strict';var multer=require(_0x492f('0x0'));var util=require(_0x492f('0x1'));var path=require(_0x492f('0x2'));var timeout=require('connect-timeout');var express=require(_0x492f('0x3'));var router=express['Router']();var fs_extra=require(_0x492f('0x4'));var auth=require(_0x492f('0x5'));var interaction=require(_0x492f('0x6'));var config=require('../../config/environment');var controller=require(_0x492f('0x7'));router['get']('/',auth[_0x492f('0x8')](),controller[_0x492f('0x9')]);router[_0x492f('0xa')]('/:id',auth[_0x492f('0x8')](),controller[_0x492f('0xb')]);router['get']('/:id/preview',auth[_0x492f('0x8')](),controller[_0x492f('0xc')]);router['get'](_0x492f('0xd'),auth[_0x492f('0x8')](),controller['run']);router[_0x492f('0xa')](_0x492f('0xe'),auth[_0x492f('0x8')](),controller[_0x492f('0xf')]);router['post']('/',auth[_0x492f('0x8')](),controller[_0x492f('0x10')]);router[_0x492f('0x11')](_0x492f('0x12'),auth['isAuthenticated'](),controller[_0x492f('0x13')]);router[_0x492f('0x14')](_0x492f('0x12'),auth['isAuthenticated'](),controller[_0x492f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3545=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','/:id/run','query','post','create','/:id','update','delete','destroy'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x3545,0x1a5));var _0x5354=function(_0x35083a,_0x50630c){_0x35083a=_0x35083a-0x0;var _0x1c705b=_0x3545[_0x35083a];return _0x1c705b;};'use strict';var multer=require('multer');var util=require(_0x5354('0x0'));var path=require('path');var timeout=require(_0x5354('0x1'));var express=require('express');var router=express[_0x5354('0x2')]();var fs_extra=require(_0x5354('0x3'));var auth=require(_0x5354('0x4'));var interaction=require(_0x5354('0x5'));var config=require('../../config/environment');var controller=require(_0x5354('0x6'));router[_0x5354('0x7')]('/',auth[_0x5354('0x8')](),controller[_0x5354('0x9')]);router[_0x5354('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5354('0x7')](_0x5354('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0x5354('0x7')](_0x5354('0xb'),auth['isAuthenticated'](),controller['run']);router[_0x5354('0x7')]('/:id/query',auth[_0x5354('0x8')](),controller[_0x5354('0xc')]);router[_0x5354('0xd')]('/',auth[_0x5354('0x8')](),controller[_0x5354('0xe')]);router['put'](_0x5354('0xf'),auth[_0x5354('0x8')](),controller[_0x5354('0x10')]);router[_0x5354('0x11')](_0x5354('0xf'),auth['isAuthenticated'](),controller[_0x5354('0x12')]);module[_0x5354('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3b840ec..c949084 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x9b9285,_0xb9aa05){var _0x10e8a1=function(_0x7a3c07){while(--_0x7a3c07){_0x9b9285['push'](_0x9b9285['shift']());}};_0x10e8a1(++_0xb9aa05);}(_0x1883,0xab));var _0x3188=function(_0x523c65,_0x188dc9){_0x523c65=_0x523c65-0x0;var _0x5daee2=_0x1883[_0x523c65];return _0x5daee2;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5771589..a941c05 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 _0x524e=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s)','debug','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','AnalyticDefaultReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','create','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','sequelize','toString','join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','getFields','from','clone','output','web','fullPath','generate','csv','default'];(function(_0x1a25b1,_0x1540e4){var _0x211b9a=function(_0x21c56b){while(--_0x21c56b){_0x1a25b1['push'](_0x1a25b1['shift']());}};_0x211b9a(++_0x1540e4);}(_0x524e,0x15e));var _0xe524=function(_0x1b1286,_0x40d099){_0x1b1286=_0x1b1286-0x0;var _0x9d2c7e=_0x524e[_0x1b1286];return _0x9d2c7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xfdc2a5,_0x1541d8){_0x1541d8=_0x1541d8||0xcc;return function(_0x11adbc){if(_0x11adbc){return _0xfdc2a5[_0xe524('0x1c')](_0x1541d8);}return _0xfdc2a5[_0xe524('0x1d')](_0x1541d8)['end']();};}function respondWithResult(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xc8;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x1d')](_0x51e9fe)['json'](_0x19f013);}};}function respondWithFilteredResult(_0x569660,_0x488fce){return function(_0x109795){if(_0x109795){var _0x538754=typeof _0x488fce[_0xe524('0x1e')]==='undefined'&&typeof _0x488fce['limit']==='undefined';var _0x3a4027=_0x109795['count'];var _0x11b2a1=_0x538754?0x0:_0x488fce[_0xe524('0x1e')];var _0x278de9=_0x538754?_0x109795[_0xe524('0x1f')]:_0x488fce['offset']+_0x488fce[_0xe524('0x20')];var _0x3ccb3f;if(_0x278de9>=_0x3a4027){_0x278de9=_0x3a4027;_0x3ccb3f=0xc8;}else{_0x3ccb3f=0xce;}_0x569660['status'](_0x3ccb3f);return _0x569660[_0xe524('0x21')](_0xe524('0x22'),_0x11b2a1+'-'+_0x278de9+'/'+_0x3a4027)[_0xe524('0x23')](_0x109795);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x24')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x25')](_0xbf059b);}return _0x1c4194[_0xe524('0x26')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x27')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x28')]()['then'](function(){var _0x17e245=_0x599d5d[_0xe524('0x29')]({'plain':!![]});var _0xd62772=_0xe524('0x2a');return db[_0xe524('0x2b')][_0xe524('0x28')]({'where':{'type':_0xd62772,'resourceId':_0x17e245['id']}})[_0xe524('0x27')](function(){return _0x599d5d;});})['then'](function(){_0x1ad106['status'](0xcc)[_0xe524('0x2c')]();});}};}function handleEntityNotFound(_0x45abad,_0x476572){return function(_0x109a96){if(!_0x109a96){_0x45abad[_0xe524('0x1c')](0x194);}return _0x109a96;};}function handleError(_0x5405e4,_0x52f140){_0x52f140=_0x52f140||0x1f4;return function(_0x4b1ff){logger[_0xe524('0x2d')](_0x4b1ff[_0xe524('0x2e')]);if(_0x4b1ff[_0xe524('0x2f')]){delete _0x4b1ff[_0xe524('0x2f')];}_0x5405e4['status'](_0x52f140)[_0xe524('0x30')](_0x4b1ff);};}exports[_0xe524('0x31')]=function(_0x4a4e15,_0x5b7ded){var _0x20688e={},_0x376324={},_0x5b2fc3={'count':0x0,'rows':[]};var _0x31d4a7=_['map'](db[_0xe524('0x32')]['rawAttributes'],function(_0x315e56){return{'name':_0x315e56[_0xe524('0x33')],'type':_0x315e56[_0xe524('0x34')]['key']};});_0x376324[_0xe524('0x35')]=_['map'](_0x31d4a7,_0xe524('0x2f'));_0x376324[_0xe524('0x36')]=_[_0xe524('0x37')](_0x4a4e15['query']);_0x376324[_0xe524('0x38')]=_[_0xe524('0x39')](_0x376324['model'],_0x376324[_0xe524('0x36')]);_0x20688e[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x376324[_0xe524('0x35')],qs['fields'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3b')]));_0x20688e[_0xe524('0x3a')]=_0x20688e[_0xe524('0x3a')][_0xe524('0x3c')]?_0x20688e[_0xe524('0x3a')]:_0x376324[_0xe524('0x35')];if(!_0x4a4e15[_0xe524('0x36')]['hasOwnProperty'](_0xe524('0x3d'))){_0x20688e['limit']=qs[_0xe524('0x20')](_0x4a4e15[_0xe524('0x36')]['limit']);_0x20688e[_0xe524('0x1e')]=qs['offset'](_0x4a4e15[_0xe524('0x36')][_0xe524('0x1e')]);}_0x20688e[_0xe524('0x3e')]=qs[_0xe524('0x3f')](_0x4a4e15[_0xe524('0x36')][_0xe524('0x3f')]);_0x20688e[_0xe524('0x40')]=qs[_0xe524('0x38')](_['pick'](_0x4a4e15[_0xe524('0x36')],_0x376324[_0xe524('0x38')]),_0x31d4a7);if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x41')]){_0x20688e[_0xe524('0x40')]=_[_0xe524('0x42')](_0x20688e[_0xe524('0x40')],{'$or':_[_0xe524('0x43')](_0x31d4a7,function(_0x5d3ea1){if(_0x5d3ea1[_0xe524('0x34')]!==_0xe524('0x44')){var _0x2e4a13={};_0x2e4a13[_0x5d3ea1['name']]={'$like':'%'+_0x4a4e15[_0xe524('0x36')]['filter']+'%'};return _0x2e4a13;}})});}_0x20688e=_[_0xe524('0x42')]({},_0x20688e,_0x4a4e15[_0xe524('0x45')]);var _0x43c314={'where':_0x20688e[_0xe524('0x40')]};return db[_0xe524('0x32')][_0xe524('0x1f')](_0x43c314)[_0xe524('0x27')](function(_0x52cd0e){_0x5b2fc3[_0xe524('0x1f')]=_0x52cd0e;if(_0x4a4e15[_0xe524('0x36')][_0xe524('0x46')]){_0x20688e[_0xe524('0x47')]=[{'all':!![]}];}return db[_0xe524('0x32')][_0xe524('0x48')](_0x20688e);})['then'](function(_0xb694b9){_0x5b2fc3[_0xe524('0x49')]=_0xb694b9;return _0x5b2fc3;})[_0xe524('0x27')](respondWithFilteredResult(_0x5b7ded,_0x20688e))['catch'](handleError(_0x5b7ded,null));};exports[_0xe524('0x4a')]=function(_0x5209dc,_0x4e5d99){var _0x2b9b3b={'raw':!![],'where':{'id':_0x5209dc['params']['id']}},_0x33906d={};_0x33906d[_0xe524('0x35')]=_[_0xe524('0x37')](db[_0xe524('0x32')][_0xe524('0x4b')]);_0x33906d['query']=_['keys'](_0x5209dc[_0xe524('0x36')]);_0x33906d[_0xe524('0x38')]=_['intersection'](_0x33906d[_0xe524('0x35')],_0x33906d['query']);_0x2b9b3b[_0xe524('0x3a')]=_[_0xe524('0x39')](_0x33906d[_0xe524('0x35')],qs[_0xe524('0x3b')](_0x5209dc[_0xe524('0x36')][_0xe524('0x3b')]));_0x2b9b3b[_0xe524('0x3a')]=_0x2b9b3b[_0xe524('0x3a')][_0xe524('0x3c')]?_0x2b9b3b[_0xe524('0x3a')]:_0x33906d[_0xe524('0x35')];if(_0x5209dc[_0xe524('0x36')][_0xe524('0x46')]){_0x2b9b3b[_0xe524('0x47')]=[{'all':!![]}];}_0x2b9b3b=_[_0xe524('0x42')]({},_0x2b9b3b,_0x5209dc['options']);return db[_0xe524('0x32')]['find'](_0x2b9b3b)['then'](handleEntityNotFound(_0x4e5d99,null))[_0xe524('0x27')](respondWithResult(_0x4e5d99,null))['catch'](handleError(_0x4e5d99,null));};exports[_0xe524('0x4c')]=function(_0x15d7ee,_0x561107){return db[_0xe524('0x32')]['create'](_0x15d7ee['body'],{})[_0xe524('0x27')](function(_0x1e5687){var _0x203e71=_0x15d7ee['user']['get']({'plain':!![]});if(!_0x203e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203e71['role']==='user'){var _0x5477ca=_0x1e5687[_0xe524('0x29')]({'plain':!![]});var _0x2ce5c0='Reports';return db[_0xe524('0x4d')][_0xe524('0x4e')]({'where':{'name':_0x2ce5c0,'userProfileId':_0x203e71[_0xe524('0x4f')]},'raw':!![]})[_0xe524('0x27')](function(_0x2fa143){if(_0x2fa143&&_0x2fa143['autoAssociation']===0x0){return db[_0xe524('0x2b')][_0xe524('0x4c')]({'name':_0x5477ca[_0xe524('0x2f')],'resourceId':_0x5477ca['id'],'type':'DefaultReports','sectionId':_0x2fa143['id']},{})[_0xe524('0x27')](function(){return _0x1e5687;});}else{return _0x1e5687;}})['catch'](function(_0x12e5d0){logger[_0xe524('0x2d')](_0xe524('0x50'),_0x12e5d0);throw _0x12e5d0;});}return _0x1e5687;})[_0xe524('0x27')](respondWithResult(_0x561107,0xc9))[_0xe524('0x51')](handleError(_0x561107,null));};exports[_0xe524('0x52')]=function(_0x1cec31,_0x374450){if(_0x1cec31[_0xe524('0x53')]['id']){delete _0x1cec31[_0xe524('0x53')]['id'];}return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x1cec31['params']['id']}})['then'](handleEntityNotFound(_0x374450,null))['then'](saveUpdates(_0x1cec31[_0xe524('0x53')],null))[_0xe524('0x27')](respondWithResult(_0x374450,null))[_0xe524('0x51')](handleError(_0x374450,null));};exports[_0xe524('0x28')]=function(_0x45fb0d,_0xef3d2f){return db[_0xe524('0x32')][_0xe524('0x4e')]({'where':{'id':_0x45fb0d[_0xe524('0x54')]['id']}})[_0xe524('0x27')](handleEntityNotFound(_0xef3d2f,null))[_0xe524('0x27')](removeEntity(_0xef3d2f,null))['catch'](handleError(_0xef3d2f,null));};exports[_0xe524('0x55')]=function(_0x1f0567,_0x4a5f4a){var _0x53da86=0xa;var _0x54adbd=['join',_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x8a2c00={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':_0xe524('0x5a'),'MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x582fbb={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x4f58ff=function(_0x5d0507){return!_[_0xe524('0x63')]([_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x67')],_0x5d0507);};var _0x474ed4=function(_0x5135f0){if(!_0x5135f0||!_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0xc3ccfd='(',_0x5d3b9c=0x0;_0x5d3b9c<_0x5135f0[_0xe524('0x68')][_0xe524('0x3c')];_0x5d3b9c+=0x1){_0x5d3b9c>0x0&&(_0xc3ccfd+='\x20'+_0x5135f0[_0xe524('0x69')]+'\x20');_0xc3ccfd+=_0x5135f0['rules'][_0x5d3b9c]['group']?_0x474ed4(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6a')]):_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6b')]+'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c]['condition']+(_0x4f58ff(_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6c')])?'\x20'+_0x5135f0[_0xe524('0x68')][_0x5d3b9c][_0xe524('0x6d')]:'');}return _0xc3ccfd+')';};var _0x3ce098={'where':{'id':_0x1f0567[_0xe524('0x54')]['id']}},_0x22d06a,_0x35e6b2,_0x1e4b32,_0x27c55c,_0x7e5992;_0x3ce098=_['merge']({},_0x3ce098,_0x1f0567[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x3ce098)[_0xe524('0x27')](function(_0xeec885){if(_0xeec885){_0x22d06a=_0xeec885;return _0xeec885['getFields']();}return null;})[_0xe524('0x27')](function(_0x2341cf){if(_0x2341cf){if(!_0x2341cf[_0xe524('0x3c')]){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x35e6b2=_0x2341cf;return db[_0xe524('0x71')]['findAll']({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x245501){if(_0x245501){_0x1e4b32=_[_0xe524('0x72')](_0x245501,'id');var _0xce15f5;var _0x5ec07c=squel[_0xe524('0x73')]();_0x5ec07c['from'](_0x22d06a[_0xe524('0x74')]);for(var _0x2a88e2=0x0;_0x2a88e2<_0x35e6b2[_0xe524('0x3c')];_0x2a88e2+=0x1){_0xce15f5=_0x35e6b2[_0x2a88e2]['MetricId']?_0x1e4b32[_0x35e6b2[_0x2a88e2][_0xe524('0x75')]][_0xe524('0x76')]:_0x35e6b2[_0x2a88e2][_0xe524('0x6b')];_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x77')]?_[_0xe524('0x78')](_0x8a2c00[_0x35e6b2[_0x2a88e2]['function']],'%s',_0xce15f5):_0xce15f5;_0xce15f5=_0x35e6b2[_0x2a88e2][_0xe524('0x79')]?_[_0xe524('0x78')](_0x582fbb[_0x35e6b2[_0x2a88e2][_0xe524('0x79')]],'%s',_0xce15f5):_0xce15f5;if(_0x35e6b2[_0x2a88e2][_0xe524('0x7a')]){_0x5ec07c[_0xe524('0x6a')](_0xce15f5);}_0x35e6b2[_0x2a88e2]['orderBy']&&_0x5ec07c[_0xe524('0x3e')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7b')]===_0xe524('0x7c')?![]:!![]);_0x5ec07c[_0xe524('0x6b')](_0xce15f5,_0x35e6b2[_0x2a88e2][_0xe524('0x7d')]||_0xce15f5);}if(_0x22d06a[_0xe524('0x7e')]){_0x22d06a['joins']=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x7e')]);for(var _0x1beaa2=0x0;_0x1beaa2<_0x22d06a['joins'][_0xe524('0x3c')];_0x1beaa2+=0x1){if(_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['type']&&_[_0xe524('0x63')](_0x54adbd,_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')])&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')]&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2]['foreignTable']&&_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]){_0x5ec07c[_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x34')]](_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x22d06a[_0xe524('0x74')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x80')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x82')],_0x22d06a[_0xe524('0x7e')][_0x1beaa2][_0xe524('0x81')]));}}}if(_0x22d06a['conditions']){_0x22d06a[_0xe524('0x84')]=JSON[_0xe524('0x7f')](_0x22d06a[_0xe524('0x84')]);_0x5ec07c['where'](_0x474ed4(_0x22d06a[_0xe524('0x84')][_0xe524('0x6a')]));}_0x7e5992=_0x5ec07c['clone']();_0x5ec07c['limit'](_0x53da86);_0x5ec07c[_0xe524('0x1e')](0x0);logger['debug'](_0xe524('0x85'),_0x5ec07c['toString']());return dbH[_0xe524('0x86')][_0xe524('0x36')](_0x5ec07c[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')]['QueryTypes']['SELECT']});}})[_0xe524('0x27')](respondWithResult(_0x4a5f4a,null))[_0xe524('0x51')](handleError(_0x4a5f4a,null));};function runReport(_0x50eb96,_0x45c287,_0x449842){var _0x1f3ed1=_0x45c287['name'];var _0x19b063=0xa;var _0x140a4e=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x54385f={'SUM':'SUM(%s)','COUNT':_0xe524('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':_0xe524('0x5c'),'AVG':_0xe524('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1681c5={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':_0xe524('0x60'),'ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x50f5e3=function(_0x11298c){return!_[_0xe524('0x63')]([_0xe524('0x64'),'IS\x20NOT\x20NULL',_0xe524('0x66'),_0xe524('0x67')],_0x11298c);};var _0x5603d0=function(_0x2712ac){if(!_0x2712ac||!_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')]){return'';}for(var _0x32c9f6='(',_0x58d29e=0x0;_0x58d29e<_0x2712ac[_0xe524('0x68')][_0xe524('0x3c')];_0x58d29e+=0x1){_0x58d29e>0x0&&(_0x32c9f6+='\x20'+_0x2712ac[_0xe524('0x69')]+'\x20');_0x32c9f6+=_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]?_0x5603d0(_0x2712ac['rules'][_0x58d29e][_0xe524('0x6a')]):_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6b')]+'\x20'+_0x2712ac['rules'][_0x58d29e][_0xe524('0x6c')]+(_0x50f5e3(_0x2712ac[_0xe524('0x68')][_0x58d29e][_0xe524('0x6c')])?'\x20'+_0x2712ac['rules'][_0x58d29e]['value']:'');}return _0x32c9f6+')';};var _0x334164={'where':{'id':_0x50eb96['id']}},_0x512572,_0x903e24,_0x4964c3,_0x2dc3f5,_0x246c62;_0x334164=_['merge']({},_0x334164,_0x449842);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x334164)['then'](function(_0x482b72){if(_0x482b72){_0x512572=_0x482b72;return _0x482b72[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x1b3e03){if(_0x1b3e03){if(!_0x1b3e03['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x903e24=_0x1b3e03;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x57501c){if(_0x57501c){_0x4964c3=_[_0xe524('0x72')](_0x57501c,'id');var _0x3a2834;var _0x4c7f45=squel['select']();_0x4c7f45[_0xe524('0x8c')](_0x512572[_0xe524('0x74')]);for(var _0x41f842=0x0;_0x41f842<_0x903e24[_0xe524('0x3c')];_0x41f842+=0x1){_0x3a2834=_0x903e24[_0x41f842]['MetricId']?_0x4964c3[_0x903e24[_0x41f842][_0xe524('0x75')]][_0xe524('0x76')]:_0x903e24[_0x41f842]['field'];_0x3a2834=_0x903e24[_0x41f842]['function']?_[_0xe524('0x78')](_0x54385f[_0x903e24[_0x41f842][_0xe524('0x77')]],'%s',_0x3a2834):_0x3a2834;_0x3a2834=_0x903e24[_0x41f842][_0xe524('0x79')]?_[_0xe524('0x78')](_0x1681c5[_0x903e24[_0x41f842][_0xe524('0x79')]],'%s',_0x3a2834):_0x3a2834;if(_0x903e24[_0x41f842][_0xe524('0x7a')]){_0x4c7f45['group'](_0x3a2834);}_0x903e24[_0x41f842]['orderBy']&&_0x4c7f45[_0xe524('0x3e')](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x4c7f45['field'](_0x3a2834,_0x903e24[_0x41f842][_0xe524('0x7d')]||_0x3a2834);}if(_0x512572[_0xe524('0x7e')]){_0x512572[_0xe524('0x7e')]=JSON[_0xe524('0x7f')](_0x512572[_0xe524('0x7e')]);for(var _0xa820a1=0x0;_0xa820a1<_0x512572['joins']['length'];_0xa820a1+=0x1){if(_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x140a4e,_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x34')])&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x80')]&&_0x512572[_0xe524('0x7e')][_0xa820a1]['foreignTable']&&_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]){_0x4c7f45[_0x512572[_0xe524('0x7e')][_0xa820a1]['type']](_0x512572['joins'][_0xa820a1][_0xe524('0x82')],null,util[_0xe524('0x79')](_0xe524('0x83'),_0x512572[_0xe524('0x74')],_0x512572['joins'][_0xa820a1][_0xe524('0x80')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x82')],_0x512572[_0xe524('0x7e')][_0xa820a1][_0xe524('0x81')]));}}}if(_0x512572['conditions']){_0x512572[_0xe524('0x84')]=JSON['parse'](_0x512572[_0xe524('0x84')]);_0x4c7f45[_0xe524('0x40')](_0x5603d0(_0x512572['conditions'][_0xe524('0x6a')]));}_0x246c62=_0x4c7f45[_0xe524('0x8d')]();_0x4c7f45['limit'](_0x19b063);_0x4c7f45[_0xe524('0x1e')](0x0);return;}})['then'](function(){if(_0x45c287[_0xe524('0x8e')]===_0xe524('0x8f')){return null;}var _0x1be681=_[_0xe524('0x42')](_0x45c287,{'name':_0x45c287[_0xe524('0x90')]||_0x45c287[_0xe524('0x2f')]||_0x512572[_0xe524('0x2f')],'basename':_0x1f3ed1,'savename':util[_0xe524('0x79')]('%s-%s.%s',_0x45c287[_0xe524('0x2f')]||_0x512572['name'],require('randomstring')[_0xe524('0x91')](0x4),_0x45c287['output']||_0xe524('0x92')),'reportId':_0x512572['id'],'reportType':_0xe524('0x93')});return db[_0xe524('0x94')][_0xe524('0x4c')](_0x1be681,{'raw':!![]});})[_0xe524('0x27')](function(_0x26c802){if(_0x512572['table']==='cdr'){_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x95'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}else{_0x246c62[_0xe524('0x40')](_0x512572[_0xe524('0x74')]+_0xe524('0x98'),_0x45c287[_0xe524('0x96')],_0x45c287[_0xe524('0x97')]);}if(_0x26c802){logger['info'](_0xe524('0x99'),_0x246c62[_0xe524('0x87')]());require(_0xe524('0x9a'))[_0xe524('0x9b')](path[_0xe524('0x88')](__dirname,_0xe524('0x9c'),_0x26c802['output']),[_0x26c802['id'],_0x246c62[_0xe524('0x87')](),path[_0xe524('0x88')](__dirname,_0xe524('0x9d'),_0x26c802[_0xe524('0x9e')]),_0x1f3ed1]);return _0x26c802;}else{var _0x84bbd7=squel[_0xe524('0x73')]();_0x84bbd7[_0xe524('0x8c')]('('+_0x246c62[_0xe524('0x87')]()+')','countTable');_0x84bbd7['field']('COUNT(*)',_0xe524('0x1f'));_0x246c62[_0xe524('0x20')](_0x45c287['limit']||_0x19b063);_0x246c62[_0xe524('0x1e')](_0x45c287[_0xe524('0x1e')]||0x0);return dbH['sequelize'][_0xe524('0x36')](_0x84bbd7[_0xe524('0x87')](),{'type':dbH['sequelize'][_0xe524('0x9f')][_0xe524('0xa0')]})[_0xe524('0x27')](function(_0x542182){if(!_0x542182[_0xe524('0x3c')]){_0x2dc3f5=0x0;}else{_0x2dc3f5=_0x542182[0x0][_0xe524('0x1f')]||0x0;}return dbH[_0xe524('0x86')]['query'](_0x246c62[_0xe524('0x87')](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});})['then'](function(_0x5e6a3d){return{'rows':_0x5e6a3d||[],'count':_0x2dc3f5};});}});}exports[_0xe524('0xa1')]=function(_0x33d066,_0x3ea495){return runReport(_0x33d066[_0xe524('0x54')],_0x33d066[_0xe524('0x36')],_0x33d066[_0xe524('0x45')])[_0xe524('0x27')](respondWithResult(_0x3ea495,null))[_0xe524('0x51')](handleError(_0x3ea495,null));};exports[_0xe524('0xa2')]=runReport;exports[_0xe524('0x36')]=function(_0x4505de,_0x292f14){var _0x2d24c1=0xa;var _0x483307=[_0xe524('0x88'),_0xe524('0x56'),_0xe524('0x57'),_0xe524('0x58')];var _0x280022={'SUM':_0xe524('0xa3'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe524('0x5b'),'MIN':'MIN(%s)','AVG':_0xe524('0x89'),'GROUP_CONCAT':_0xe524('0xa4'),'GROUP_CONCAT ASC':_0xe524('0x8a'),'GROUP_CONCAT DESC':_0xe524('0x5d')};var _0x46d6da={'SEC_TO_TIME':_0xe524('0x5e'),'DATE':_0xe524('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xe524('0x61'),'UNIX_TIMESTAMP':_0xe524('0x62')};var _0x39998a=function(_0x107de8){return!_['includes']([_0xe524('0x64'),_0xe524('0x65'),'IS\x20EMPTY',_0xe524('0x67')],_0x107de8);};var _0x458e14=function(_0x4e0886){if(!_0x4e0886||!_0x4e0886['rules'][_0xe524('0x3c')]){return'';}for(var _0x3639cf='(',_0x575c14=0x0;_0x575c14<_0x4e0886['rules'][_0xe524('0x3c')];_0x575c14+=0x1){_0x575c14>0x0&&(_0x3639cf+='\x20'+_0x4e0886['operator']+'\x20');_0x3639cf+=_0x4e0886['rules'][_0x575c14]['group']?_0x458e14(_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6a')]):_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6b')]+'\x20'+_0x4e0886['rules'][_0x575c14]['condition']+(_0x39998a(_0x4e0886['rules'][_0x575c14][_0xe524('0x6c')])?'\x20'+_0x4e0886[_0xe524('0x68')][_0x575c14][_0xe524('0x6d')]:'');}return _0x3639cf+')';};var _0x289720={'where':{'id':_0x4505de[_0xe524('0x54')]['id']}},_0x3fb45c,_0x3362fe,_0x119684,_0x19e4fd,_0x4b4349;_0x289720=_[_0xe524('0x42')]({},_0x289720,_0x4505de[_0xe524('0x45')]);return db[_0xe524('0x32')][_0xe524('0x4e')](_0x289720)[_0xe524('0x27')](function(_0x404a49){if(_0x404a49){_0x3fb45c=_0x404a49;return _0x404a49[_0xe524('0x8b')]();}return null;})[_0xe524('0x27')](function(_0x8e8087){if(_0x8e8087){if(!_0x8e8087['length']){throw new db[(_0xe524('0x6e'))][(_0xe524('0x6f'))](_0xe524('0x70'),0x193);}_0x3362fe=_0x8e8087;return db[_0xe524('0x71')][_0xe524('0x48')]({'raw':!![]});}return null;})[_0xe524('0x27')](function(_0x113a54){if(_0x113a54){_0x119684=_[_0xe524('0x72')](_0x113a54,'id');var _0x4ebca4;var _0x40043c=squel[_0xe524('0x73')]();_0x40043c[_0xe524('0x8c')](_0x3fb45c[_0xe524('0x74')]);for(var _0x19a773=0x0;_0x19a773<_0x3362fe[_0xe524('0x3c')];_0x19a773+=0x1){_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x75')]?_0x119684[_0x3362fe[_0x19a773][_0xe524('0x75')]][_0xe524('0x76')]:_0x3362fe[_0x19a773][_0xe524('0x6b')];_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x77')]?_[_0xe524('0x78')](_0x280022[_0x3362fe[_0x19a773]['function']],'%s',_0x4ebca4):_0x4ebca4;_0x4ebca4=_0x3362fe[_0x19a773][_0xe524('0x79')]?_[_0xe524('0x78')](_0x46d6da[_0x3362fe[_0x19a773][_0xe524('0x79')]],'%s',_0x4ebca4):_0x4ebca4;if(_0x3362fe[_0x19a773]['groupBy']){_0x40043c['group'](_0x4ebca4);}_0x3362fe[_0x19a773][_0xe524('0x7b')]&&_0x40043c[_0xe524('0x3e')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7b')]==='DESC'?![]:!![]);_0x40043c[_0xe524('0x6b')](_0x4ebca4,_0x3362fe[_0x19a773][_0xe524('0x7d')]||_0x4ebca4);}if(_0x3fb45c[_0xe524('0x7e')]){_0x3fb45c['joins']=JSON['parse'](_0x3fb45c[_0xe524('0x7e')]);for(var _0x2a85e5=0x0;_0x2a85e5<_0x3fb45c[_0xe524('0x7e')]['length'];_0x2a85e5+=0x1){if(_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]&&_[_0xe524('0x63')](_0x483307,_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')])&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')]&&_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')]&&_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]){_0x40043c[_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x34')]](_0x3fb45c['joins'][_0x2a85e5][_0xe524('0x82')],null,util[_0xe524('0x79')]('%s.%s\x20=\x20%s.%s',_0x3fb45c[_0xe524('0x74')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x80')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x82')],_0x3fb45c[_0xe524('0x7e')][_0x2a85e5][_0xe524('0x81')]));}}}if(_0x3fb45c[_0xe524('0x84')]){_0x3fb45c[_0xe524('0x84')]=JSON['parse'](_0x3fb45c['conditions']);_0x40043c[_0xe524('0x40')](_0x458e14(_0x3fb45c[_0xe524('0x84')][_0xe524('0x6a')]));}_0x4b4349=_0x40043c[_0xe524('0x8d')]();_0x40043c[_0xe524('0x20')](_0x2d24c1);_0x40043c[_0xe524('0x1e')](0x0);logger[_0xe524('0xa5')]('Limited\x20Query:',_0x40043c['toString']());return dbH[_0xe524('0x86')]['query'](_0x40043c['toString'](),{'type':dbH[_0xe524('0x86')][_0xe524('0x9f')][_0xe524('0xa0')]});}})[_0xe524('0x27')](function(){return{'sql':_0x4b4349[_0xe524('0x87')]()};})[_0xe524('0x27')](respondWithResult(_0x292f14,null))['catch'](handleError(_0x292f14,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x10f0db,_0x3013ea){var _0x3d196f=function(_0x48e36c){while(--_0x48e36c){_0x10f0db['push'](_0x10f0db['shift']());}};_0x3d196f(++_0x3013ea);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4dfefb,_0x161457){_0x4dfefb=_0x4dfefb-0x0;var _0x5748e4=_0x1cb9[_0x4dfefb];return _0x5748e4;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 43593a2..2fc3d57 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 _0x1377=['moment','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1377,0xef));var _0x7137=function(_0x5dd629,_0x387c7c){_0x5dd629=_0x5dd629-0x0;var _0x4a5631=_0x1377[_0x5dd629];return _0x4a5631;};'use strict';var _=require(_0x7137('0x0'));var util=require(_0x7137('0x1'));var logger=require(_0x7137('0x2'))('api');var moment=require(_0x7137('0x3'));var BPromise=require('bluebird');var rp=require(_0x7137('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7137('0x5'));var config=require(_0x7137('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x7137('0x7')]=function(_0x4f11a9,_0x407e75){return _0x4f11a9[_0x7137('0x8')](_0x7137('0x9'),attributes,{'tableName':_0x7137('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaef=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4e4560,_0x2656a5){var _0x321241=function(_0x142ca7){while(--_0x142ca7){_0x4e4560['push'](_0x4e4560['shift']());}};_0x321241(++_0x2656a5);}(_0xeaef,0x1b8));var _0xfeae=function(_0x2b0771,_0x269d71){_0x2b0771=_0x2b0771-0x0;var _0x3d1657=_0xeaef[_0x2b0771];return _0x3d1657;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var logger=require(_0xfeae('0x2'))(_0xfeae('0x3'));var moment=require('moment');var BPromise=require(_0xfeae('0x4'));var rp=require(_0xfeae('0x5'));var fs=require('fs');var path=require(_0xfeae('0x6'));var rimraf=require(_0xfeae('0x7'));var config=require(_0xfeae('0x8'));var attributes=require(_0xfeae('0x9'));module[_0xfeae('0xa')]=function(_0x90afd4,_0x10a4ed){return _0x90afd4[_0xfeae('0xb')](_0xfeae('0xc'),attributes,{'tableName':_0xfeae('0xd'),'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 09f779f..f557228 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 _0x3980=['result','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x404f70,_0x3d80a7){var _0x33e7d3=function(_0x51564b){while(--_0x51564b){_0x404f70['push'](_0x404f70['shift']());}};_0x33e7d3(++_0x3d80a7);}(_0x3980,0x81));var _0x0398=function(_0x6cd560,_0x44938d){_0x6cd560=_0x6cd560-0x0;var _0x4e19bc=_0x3980[_0x6cd560];return _0x4e19bc;};'use strict';var _=require('lodash');var util=require(_0x0398('0x0'));var moment=require('moment');var BPromise=require(_0x0398('0x1'));var rs=require(_0x0398('0x2'));var fs=require('fs');var Redis=require(_0x0398('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0398('0x4'))(_0x0398('0x5'));var config=require(_0x0398('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0398('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x180e9f,_0x45d436,_0x58e691){return new BPromise(function(_0x3df9fd,_0x4421d0){return client['request'](_0x180e9f,_0x58e691)['then'](function(_0x157124){logger[_0x0398('0x8')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x45d436,_0x0398('0x9'));logger[_0x0398('0xa')](_0x0398('0xb'),_0x45d436,_0x0398('0x9'),JSON['stringify'](_0x157124));if(_0x157124[_0x0398('0xc')]){if(_0x157124[_0x0398('0xc')]['code']===0x1f4){logger[_0x0398('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x45d436,_0x157124[_0x0398('0xc')][_0x0398('0xd')]);return _0x4421d0(_0x157124[_0x0398('0xc')]['message']);}logger[_0x0398('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x45d436,_0x157124[_0x0398('0xc')][_0x0398('0xd')]);return _0x3df9fd(_0x157124['error']['message']);}else{logger[_0x0398('0x8')](_0x0398('0xe'),_0x45d436,'request\x20sent');_0x3df9fd(_0x157124[_0x0398('0xf')][_0x0398('0xd')]);}})['catch'](function(_0x5aeda4){logger['error'](_0x0398('0xe'),_0x45d436,_0x5aeda4);_0x4421d0(_0x5aeda4);});});} \ No newline at end of file +var _0xb4bc=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x319c98,_0xb36499){var _0x422df4=function(_0x4d46c9){while(--_0x4d46c9){_0x319c98['push'](_0x319c98['shift']());}};_0x422df4(++_0xb36499);}(_0xb4bc,0x65));var _0xcb4b=function(_0x4d4752,_0x736f87){_0x4d4752=_0x4d4752-0x0;var _0x3932a8=_0xb4bc[_0x4d4752];return _0x3932a8;};'use strict';var _=require(_0xcb4b('0x0'));var util=require(_0xcb4b('0x1'));var moment=require(_0xcb4b('0x2'));var BPromise=require(_0xcb4b('0x3'));var rs=require(_0xcb4b('0x4'));var fs=require('fs');var Redis=require(_0xcb4b('0x5'));var db=require(_0xcb4b('0x6'))['db'];var utils=require(_0xcb4b('0x7'));var logger=require(_0xcb4b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb4b('0x9'));var client=jayson[_0xcb4b('0xa')][_0xcb4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24d3cd,_0x2128d4,_0x2e26b8){return new BPromise(function(_0x27cbed,_0x42fe87){return client[_0xcb4b('0xc')](_0x24d3cd,_0x2e26b8)[_0xcb4b('0xd')](function(_0x1b258){logger[_0xcb4b('0xe')](_0xcb4b('0xf'),_0x2128d4,_0xcb4b('0x10'));logger[_0xcb4b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2128d4,_0xcb4b('0x10'),JSON['stringify'](_0x1b258));if(_0x1b258[_0xcb4b('0x12')]){if(_0x1b258['error'][_0xcb4b('0x13')]===0x1f4){logger['error'](_0xcb4b('0xf'),_0x2128d4,_0x1b258[_0xcb4b('0x12')]['message']);return _0x42fe87(_0x1b258[_0xcb4b('0x12')][_0xcb4b('0x14')]);}logger['error'](_0xcb4b('0xf'),_0x2128d4,_0x1b258['error'][_0xcb4b('0x14')]);return _0x27cbed(_0x1b258[_0xcb4b('0x12')][_0xcb4b('0x14')]);}else{logger[_0xcb4b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2128d4,_0xcb4b('0x10'));_0x27cbed(_0x1b258[_0xcb4b('0x15')]['message']);}})[_0xcb4b('0x16')](function(_0x1adf3c){logger[_0xcb4b('0x12')](_0xcb4b('0xf'),_0x2128d4,_0x1adf3c);_0x42fe87(_0x1adf3c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7886963..4615fc2 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 _0xf5a8=['express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run','/:id/query','post','put','update','destroy','exports','multer','util'];(function(_0x18f90e,_0x25a7f8){var _0x11cb87=function(_0x204815){while(--_0x204815){_0x18f90e['push'](_0x18f90e['shift']());}};_0x11cb87(++_0x25a7f8);}(_0xf5a8,0x91));var _0x8f5a=function(_0x46f62c,_0x49eb41){_0x46f62c=_0x46f62c-0x0;var _0x46d994=_0xf5a8[_0x46f62c];return _0x46d994;};'use strict';var multer=require(_0x8f5a('0x0'));var util=require(_0x8f5a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8f5a('0x2'));var router=express[_0x8f5a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8f5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8f5a('0x5'));var controller=require(_0x8f5a('0x6'));router['get']('/',auth[_0x8f5a('0x7')](),controller[_0x8f5a('0x8')]);router[_0x8f5a('0x9')](_0x8f5a('0xa'),auth[_0x8f5a('0x7')](),controller[_0x8f5a('0xb')]);router['get'](_0x8f5a('0xc'),auth[_0x8f5a('0x7')](),controller[_0x8f5a('0xd')]);router['get']('/:id/run',auth[_0x8f5a('0x7')](),controller[_0x8f5a('0xe')]);router['get'](_0x8f5a('0xf'),auth[_0x8f5a('0x7')](),controller['query']);router[_0x8f5a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8f5a('0x11')](_0x8f5a('0xa'),auth[_0x8f5a('0x7')](),controller[_0x8f5a('0x12')]);router['delete'](_0x8f5a('0xa'),auth[_0x8f5a('0x7')](),controller[_0x8f5a('0x13')]);module[_0x8f5a('0x14')]=router; \ No newline at end of file +var _0x0a71=['isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','./analyticDefaultReport.controller','get','index','/:id'];(function(_0x3ab74a,_0x47c97b){var _0x401bdc=function(_0x15cae2){while(--_0x15cae2){_0x3ab74a['push'](_0x3ab74a['shift']());}};_0x401bdc(++_0x47c97b);}(_0x0a71,0x122));var _0x10a7=function(_0x475518,_0x23116e){_0x475518=_0x475518-0x0;var _0x461168=_0x0a71[_0x475518];return _0x461168;};'use strict';var multer=require(_0x10a7('0x0'));var util=require(_0x10a7('0x1'));var path=require(_0x10a7('0x2'));var timeout=require(_0x10a7('0x3'));var express=require(_0x10a7('0x4'));var router=express['Router']();var fs_extra=require(_0x10a7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x10a7('0x6'));router[_0x10a7('0x7')]('/',auth['isAuthenticated'](),controller[_0x10a7('0x8')]);router[_0x10a7('0x7')](_0x10a7('0x9'),auth[_0x10a7('0xa')](),controller[_0x10a7('0xb')]);router[_0x10a7('0x7')](_0x10a7('0xc'),auth[_0x10a7('0xa')](),controller[_0x10a7('0xd')]);router[_0x10a7('0x7')](_0x10a7('0xe'),auth[_0x10a7('0xa')](),controller[_0x10a7('0xf')]);router[_0x10a7('0x7')](_0x10a7('0x10'),auth[_0x10a7('0xa')](),controller[_0x10a7('0x11')]);router[_0x10a7('0x12')]('/',auth['isAuthenticated'](),controller[_0x10a7('0x13')]);router[_0x10a7('0x14')](_0x10a7('0x9'),auth[_0x10a7('0xa')](),controller[_0x10a7('0x15')]);router[_0x10a7('0x16')](_0x10a7('0x9'),auth[_0x10a7('0xa')](),controller[_0x10a7('0x17')]);module[_0x10a7('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a889fe8..1094269 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 _0x5759=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','STRING','ENUM','csv','pdf'];(function(_0x2145fe,_0x49a3fc){var _0x30dd63=function(_0x3efeb8){while(--_0x3efeb8){_0x2145fe['push'](_0x2145fe['shift']());}};_0x30dd63(++_0x49a3fc);}(_0x5759,0x9c));var _0x9575=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5759[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x9575('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x9575('0x1')](_0x9575('0x2'),_0x9575('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x9575('0x2')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x9575('0x4')]},'endDate':{'type':Sequelize[_0x9575('0x4')]},'status':{'type':Sequelize[_0x9575('0x0')],'defaultValue':_0x9575('0x5')},'type':{'type':Sequelize['ENUM'](_0x9575('0x6'),_0x9575('0x7')),'allowNull':![],'defaultValue':_0x9575('0x6')},'reportId':{'type':Sequelize[_0x9575('0x8')](0xb)[_0x9575('0x9')]},'reportType':{'type':Sequelize[_0x9575('0x0')]}}; \ No newline at end of file +var _0x9b19=['moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x9b19,0x74));var _0x99b1=function(_0x4a1412,_0x2b6ee8){_0x4a1412=_0x4a1412-0x0;var _0x2cc456=_0x9b19[_0x4a1412];return _0x2cc456;};'use strict';var Sequelize=require(_0x99b1('0x0'));var moment=require(_0x99b1('0x1'));module['exports']={'name':{'type':Sequelize[_0x99b1('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x99b1('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x99b1('0x3')](_0x99b1('0x4'),_0x99b1('0x5'),_0x99b1('0x6')),'allowNull':![],'defaultValue':_0x99b1('0x4')},'savename':{'type':Sequelize[_0x99b1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x99b1('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x99b1('0x8')},'type':{'type':Sequelize['ENUM'](_0x99b1('0x9'),_0x99b1('0xa')),'allowNull':![],'defaultValue':_0x99b1('0x9')},'reportId':{'type':Sequelize[_0x99b1('0xb')](0xb)[_0x99b1('0xc')]},'reportType':{'type':Sequelize[_0x99b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 3e18429..1406f18 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 _0x4e19=['VIRTUAL','merge','options','include','findAll','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','get','ExtractedReports','error','stack','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','map'];(function(_0x7e3ee6,_0x2477b7){var _0x30da85=function(_0x1dbfeb){while(--_0x1dbfeb){_0x7e3ee6['push'](_0x7e3ee6['shift']());}};_0x30da85(++_0x2477b7);}(_0x4e19,0x1ea));var _0x94e1=function(_0x4c74f4,_0x2f93c4){_0x4c74f4=_0x4c74f4-0x0;var _0x5aaee1=_0x4e19[_0x4c74f4];return _0x5aaee1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94e1('0x0'));var zipdir=require(_0x94e1('0x1'));var jsonpatch=require(_0x94e1('0x2'));var rp=require(_0x94e1('0x3'));var moment=require(_0x94e1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x94e1('0x5'));var sox=require(_0x94e1('0x6'));var csv=require(_0x94e1('0x7'));var ejs=require(_0x94e1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94e1('0x9'));var squel=require(_0x94e1('0xa'));var crypto=require(_0x94e1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94e1('0x7'));var querystring=require(_0x94e1('0xc'));var Papa=require(_0x94e1('0xd'));var Redis=require(_0x94e1('0xe'));var authService=require(_0x94e1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x94e1('0x10'));var hardwareService=require(_0x94e1('0x11'));var logger=require(_0x94e1('0x12'))(_0x94e1('0x13'));var utils=require(_0x94e1('0x14'));var config=require(_0x94e1('0x15'));var licenseUtil=require(_0x94e1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23902e,_0x3c80ca){_0x3c80ca=_0x3c80ca||0xcc;return function(_0x5e5ae1){if(_0x5e5ae1){return _0x23902e[_0x94e1('0x17')](_0x3c80ca);}return _0x23902e[_0x94e1('0x18')](_0x3c80ca)[_0x94e1('0x19')]();};}function respondWithResult(_0x2f824e,_0x3c4f85){_0x3c4f85=_0x3c4f85||0xc8;return function(_0x220641){if(_0x220641){return _0x2f824e['status'](_0x3c4f85)[_0x94e1('0x1a')](_0x220641);}};}function respondWithFilteredResult(_0x28e0d4,_0xcbae9){return function(_0x3b0711){if(_0x3b0711){var _0x32bf85=typeof _0xcbae9[_0x94e1('0x1b')]===_0x94e1('0x1c')&&typeof _0xcbae9['limit']===_0x94e1('0x1c');var _0x4c51f2=_0x3b0711[_0x94e1('0x1d')];var _0x2fe1d7=_0x32bf85?0x0:_0xcbae9['offset'];var _0x35d529=_0x32bf85?_0x3b0711['count']:_0xcbae9[_0x94e1('0x1b')]+_0xcbae9['limit'];var _0x1678f6;if(_0x35d529>=_0x4c51f2){_0x35d529=_0x4c51f2;_0x1678f6=0xc8;}else{_0x1678f6=0xce;}_0x28e0d4[_0x94e1('0x18')](_0x1678f6);return _0x28e0d4[_0x94e1('0x1e')]('Content-Range',_0x2fe1d7+'-'+_0x35d529+'/'+_0x4c51f2)[_0x94e1('0x1a')](_0x3b0711);}return null;};}function patchUpdates(_0x42090a){return function(_0x329a97){try{jsonpatch[_0x94e1('0x1f')](_0x329a97,_0x42090a,!![]);}catch(_0x50f2ab){return BPromise[_0x94e1('0x20')](_0x50f2ab);}return _0x329a97[_0x94e1('0x21')]();};}function saveUpdates(_0x2f15ef,_0x4b82ef){return function(_0x2ec2e1){if(_0x2ec2e1){return _0x2ec2e1[_0x94e1('0x22')](_0x2f15ef)['then'](function(_0x4c238c){return _0x4c238c;});}return null;};}function removeEntity(_0x1eaea9,_0x265c47){return function(_0x51c1fe){if(_0x51c1fe){return _0x51c1fe[_0x94e1('0x23')]()[_0x94e1('0x24')](function(){var _0x1e4f8d=_0x51c1fe[_0x94e1('0x25')]({'plain':!![]});var _0x2f9080=_0x94e1('0x26');return db['UserProfileResource'][_0x94e1('0x23')]({'where':{'type':_0x2f9080,'resourceId':_0x1e4f8d['id']}})[_0x94e1('0x24')](function(){return _0x51c1fe;});})[_0x94e1('0x24')](function(){_0x1eaea9['status'](0xcc)[_0x94e1('0x19')]();});}};}function handleEntityNotFound(_0x468aaa,_0x4598eb){return function(_0x346ce7){if(!_0x346ce7){_0x468aaa[_0x94e1('0x17')](0x194);}return _0x346ce7;};}function handleError(_0x18ba42,_0x1a4186){_0x1a4186=_0x1a4186||0x1f4;return function(_0x4877d7){logger[_0x94e1('0x27')](_0x4877d7[_0x94e1('0x28')]);if(_0x4877d7['name']){delete _0x4877d7['name'];}_0x18ba42[_0x94e1('0x18')](_0x1a4186)['send'](_0x4877d7);};}exports['index']=function(_0x518dd1,_0x131c16){var _0x15e60e={},_0x30fd96={},_0x272122={'count':0x0,'rows':[]};var _0x20c2ef=_['map'](db[_0x94e1('0x29')][_0x94e1('0x2a')],function(_0x31483b){return{'name':_0x31483b[_0x94e1('0x2b')],'type':_0x31483b[_0x94e1('0x2c')][_0x94e1('0x2d')]};});_0x30fd96[_0x94e1('0x2e')]=_['map'](_0x20c2ef,_0x94e1('0x2f'));_0x30fd96[_0x94e1('0x30')]=_[_0x94e1('0x31')](_0x518dd1[_0x94e1('0x30')]);_0x30fd96[_0x94e1('0x32')]=_[_0x94e1('0x33')](_0x30fd96['model'],_0x30fd96[_0x94e1('0x30')]);_0x15e60e[_0x94e1('0x34')]=_[_0x94e1('0x33')](_0x30fd96[_0x94e1('0x2e')],qs['fields'](_0x518dd1[_0x94e1('0x30')][_0x94e1('0x35')]));_0x15e60e[_0x94e1('0x34')]=_0x15e60e[_0x94e1('0x34')]['length']?_0x15e60e[_0x94e1('0x34')]:_0x30fd96[_0x94e1('0x2e')];if(!_0x518dd1[_0x94e1('0x30')][_0x94e1('0x36')](_0x94e1('0x37'))){_0x15e60e['limit']=qs[_0x94e1('0x38')](_0x518dd1['query']['limit']);_0x15e60e[_0x94e1('0x1b')]=qs['offset'](_0x518dd1[_0x94e1('0x30')][_0x94e1('0x1b')]);}_0x15e60e[_0x94e1('0x39')]=qs[_0x94e1('0x3a')](_0x518dd1[_0x94e1('0x30')]['sort']);_0x15e60e[_0x94e1('0x3b')]=qs[_0x94e1('0x32')](_['pick'](_0x518dd1[_0x94e1('0x30')],_0x30fd96[_0x94e1('0x32')]),_0x20c2ef);if(_0x518dd1[_0x94e1('0x30')][_0x94e1('0x3c')]){_0x15e60e[_0x94e1('0x3b')]=_['merge'](_0x15e60e[_0x94e1('0x3b')],{'$or':_[_0x94e1('0x3d')](_0x20c2ef,function(_0x10c230){if(_0x10c230[_0x94e1('0x2c')]!==_0x94e1('0x3e')){var _0x299e63={};_0x299e63[_0x10c230[_0x94e1('0x2f')]]={'$like':'%'+_0x518dd1[_0x94e1('0x30')][_0x94e1('0x3c')]+'%'};return _0x299e63;}})});}_0x15e60e=_[_0x94e1('0x3f')]({},_0x15e60e,_0x518dd1[_0x94e1('0x40')]);var _0x6c89c8={'where':_0x15e60e['where']};return db[_0x94e1('0x29')][_0x94e1('0x1d')](_0x6c89c8)[_0x94e1('0x24')](function(_0x5adffc){_0x272122[_0x94e1('0x1d')]=_0x5adffc;if(_0x518dd1[_0x94e1('0x30')]['includeAll']){_0x15e60e[_0x94e1('0x41')]=[{'all':!![]}];}return db[_0x94e1('0x29')][_0x94e1('0x42')](_0x15e60e);})[_0x94e1('0x24')](function(_0x392518){_0x272122['rows']=_0x392518;return _0x272122;})[_0x94e1('0x24')](respondWithFilteredResult(_0x131c16,_0x15e60e))[_0x94e1('0x43')](handleError(_0x131c16,null));};exports[_0x94e1('0x44')]=function(_0x258f21,_0x296e2c){var _0x4dd367={'raw':!![],'where':{'id':_0x258f21[_0x94e1('0x45')]['id']}},_0x2c193f={};_0x2c193f[_0x94e1('0x2e')]=_[_0x94e1('0x31')](db[_0x94e1('0x29')][_0x94e1('0x2a')]);_0x2c193f[_0x94e1('0x30')]=_['keys'](_0x258f21['query']);_0x2c193f[_0x94e1('0x32')]=_['intersection'](_0x2c193f[_0x94e1('0x2e')],_0x2c193f[_0x94e1('0x30')]);_0x4dd367['attributes']=_[_0x94e1('0x33')](_0x2c193f[_0x94e1('0x2e')],qs['fields'](_0x258f21[_0x94e1('0x30')][_0x94e1('0x35')]));_0x4dd367[_0x94e1('0x34')]=_0x4dd367[_0x94e1('0x34')][_0x94e1('0x46')]?_0x4dd367['attributes']:_0x2c193f[_0x94e1('0x2e')];if(_0x258f21[_0x94e1('0x30')][_0x94e1('0x47')]){_0x4dd367[_0x94e1('0x41')]=[{'all':!![]}];}_0x4dd367=_[_0x94e1('0x3f')]({},_0x4dd367,_0x258f21['options']);return db['AnalyticExtractedReport'][_0x94e1('0x48')](_0x4dd367)[_0x94e1('0x24')](handleEntityNotFound(_0x296e2c,null))['then'](respondWithResult(_0x296e2c,null))['catch'](handleError(_0x296e2c,null));};exports[_0x94e1('0x49')]=function(_0xc84a37,_0x8c770f){return db[_0x94e1('0x29')][_0x94e1('0x49')](_0xc84a37[_0x94e1('0x4a')],{})[_0x94e1('0x24')](function(_0x4638a5){var _0x5f2517=_0xc84a37['user'][_0x94e1('0x25')]({'plain':!![]});if(!_0x5f2517)throw new Error(_0x94e1('0x4b'));if(_0x5f2517['role']===_0x94e1('0x4c')){var _0x425481=_0x4638a5['get']({'plain':!![]});var _0x148630=_0x94e1('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x148630,'userProfileId':_0x5f2517[_0x94e1('0x4d')]},'raw':!![]})[_0x94e1('0x24')](function(_0xafd71d){if(_0xafd71d&&_0xafd71d['autoAssociation']===0x0){return db[_0x94e1('0x4e')][_0x94e1('0x49')]({'name':_0x425481[_0x94e1('0x2f')],'resourceId':_0x425481['id'],'type':_0xafd71d[_0x94e1('0x2f')],'sectionId':_0xafd71d['id']},{})[_0x94e1('0x24')](function(){return _0x4638a5;});}else{return _0x4638a5;}})[_0x94e1('0x43')](function(_0x5bbe7a){logger[_0x94e1('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bbe7a);throw _0x5bbe7a;});}return _0x4638a5;})['then'](respondWithResult(_0x8c770f,0xc9))[_0x94e1('0x43')](handleError(_0x8c770f,null));};exports[_0x94e1('0x22')]=function(_0x28163d,_0x1b40fe){if(_0x28163d['body']['id']){delete _0x28163d[_0x94e1('0x4a')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x28163d[_0x94e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b40fe,null))[_0x94e1('0x24')](saveUpdates(_0x28163d[_0x94e1('0x4a')],null))[_0x94e1('0x24')](respondWithResult(_0x1b40fe,null))['catch'](handleError(_0x1b40fe,null));};exports[_0x94e1('0x23')]=function(_0x1cb436,_0x4ac327){return db[_0x94e1('0x29')][_0x94e1('0x48')]({'where':{'id':_0x1cb436['params']['id']}})[_0x94e1('0x24')](handleEntityNotFound(_0x4ac327,null))['then'](removeEntity(_0x4ac327,null))[_0x94e1('0x43')](handleError(_0x4ac327,null));};exports[_0x94e1('0x4f')]=function(_0x16d54c,_0x42dc0c,_0x50af80){return db[_0x94e1('0x29')][_0x94e1('0x48')]({'where':{'id':_0x16d54c['params']['id']},'attributes':[_0x94e1('0x2f'),_0x94e1('0x50'),_0x94e1('0x51'),_0x94e1('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x42dc0c,null))[_0x94e1('0x24')](function(_0xaf6d56){if(_0xaf6d56){if(!fs[_0x94e1('0x53')](path[_0x94e1('0x54')](config[_0x94e1('0x55')],_0x94e1('0x56'),_0xaf6d56[_0x94e1('0x51')]))){throw new db[(_0x94e1('0x57'))]['ValidationError'](_0x94e1('0x58'));}if(_0x16d54c[_0x94e1('0x30')][_0x94e1('0x59')]){return _0x42dc0c['sendStatus'](0xc8);}return _0x42dc0c[_0x94e1('0x4f')](path[_0x94e1('0x54')](config['root'],_0x94e1('0x56'),_0xaf6d56[_0x94e1('0x51')]),util[_0x94e1('0x5a')](_0x94e1('0x5b'),_0xaf6d56['basename']||_0xaf6d56[_0x94e1('0x2f')],_0xaf6d56[_0x94e1('0x52')]['toLowerCase']()));}})[_0x94e1('0x43')](handleError(_0x42dc0c,null));}; \ No newline at end of file +var _0xbe64=['apply','update','destroy','then','ExtractedReports','UserProfileResource','end','sendStatus','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','nolimit','order','filter','where','merge','options','includeAll','include','rows','catch','show','params','filters','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','savename','output','existsSync','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range'];(function(_0x357c00,_0x543752){var _0x2d5fb2=function(_0x36e42d){while(--_0x36e42d){_0x357c00['push'](_0x357c00['shift']());}};_0x2d5fb2(++_0x543752);}(_0xbe64,0x93));var _0x4be6=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xbe64[_0x40b493];return _0x548365;};'use strict';var emlformat=require(_0x4be6('0x0'));var rimraf=require(_0x4be6('0x1'));var zipdir=require(_0x4be6('0x2'));var jsonpatch=require(_0x4be6('0x3'));var rp=require(_0x4be6('0x4'));var moment=require(_0x4be6('0x5'));var BPromise=require(_0x4be6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4be6('0x7'));var csv=require(_0x4be6('0x8'));var ejs=require(_0x4be6('0x9'));var fs=require('fs');var fs_extra=require(_0x4be6('0xa'));var _=require(_0x4be6('0xb'));var squel=require(_0x4be6('0xc'));var crypto=require(_0x4be6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4be6('0xe'));var toCsv=require(_0x4be6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4be6('0xf'));var authService=require(_0x4be6('0x10'));var qs=require(_0x4be6('0x11'));var as=require(_0x4be6('0x12'));var hardwareService=require(_0x4be6('0x13'));var logger=require(_0x4be6('0x14'))(_0x4be6('0x15'));var utils=require(_0x4be6('0x16'));var config=require(_0x4be6('0x17'));var licenseUtil=require(_0x4be6('0x18'));var db=require(_0x4be6('0x19'))['db'];function respondWithStatusCode(_0x598da6,_0x310cba){_0x310cba=_0x310cba||0xcc;return function(_0x20ea07){if(_0x20ea07){return _0x598da6['sendStatus'](_0x310cba);}return _0x598da6[_0x4be6('0x1a')](_0x310cba)['end']();};}function respondWithResult(_0x13c07b,_0x544ca7){_0x544ca7=_0x544ca7||0xc8;return function(_0x3240b0){if(_0x3240b0){return _0x13c07b[_0x4be6('0x1a')](_0x544ca7)[_0x4be6('0x1b')](_0x3240b0);}};}function respondWithFilteredResult(_0x51e805,_0x41e948){return function(_0x14125d){if(_0x14125d){var _0xbba55a=typeof _0x41e948['offset']==='undefined'&&typeof _0x41e948[_0x4be6('0x1c')]===_0x4be6('0x1d');var _0x5b5ffc=_0x14125d[_0x4be6('0x1e')];var _0x38788d=_0xbba55a?0x0:_0x41e948[_0x4be6('0x1f')];var _0x470ece=_0xbba55a?_0x14125d['count']:_0x41e948['offset']+_0x41e948[_0x4be6('0x1c')];var _0x1f7b94;if(_0x470ece>=_0x5b5ffc){_0x470ece=_0x5b5ffc;_0x1f7b94=0xc8;}else{_0x1f7b94=0xce;}_0x51e805[_0x4be6('0x1a')](_0x1f7b94);return _0x51e805['set'](_0x4be6('0x20'),_0x38788d+'-'+_0x470ece+'/'+_0x5b5ffc)[_0x4be6('0x1b')](_0x14125d);}return null;};}function patchUpdates(_0x10ebb2){return function(_0x483fd8){try{jsonpatch[_0x4be6('0x21')](_0x483fd8,_0x10ebb2,!![]);}catch(_0x5e0d03){return BPromise['reject'](_0x5e0d03);}return _0x483fd8['save']();};}function saveUpdates(_0x1f01e5,_0x42f949){return function(_0x3eaf99){if(_0x3eaf99){return _0x3eaf99[_0x4be6('0x22')](_0x1f01e5)['then'](function(_0x367f04){return _0x367f04;});}return null;};}function removeEntity(_0x383b49,_0x1b2999){return function(_0x939e33){if(_0x939e33){return _0x939e33[_0x4be6('0x23')]()[_0x4be6('0x24')](function(){var _0x14ad30=_0x939e33['get']({'plain':!![]});var _0xd093c3=_0x4be6('0x25');return db[_0x4be6('0x26')]['destroy']({'where':{'type':_0xd093c3,'resourceId':_0x14ad30['id']}})[_0x4be6('0x24')](function(){return _0x939e33;});})[_0x4be6('0x24')](function(){_0x383b49[_0x4be6('0x1a')](0xcc)[_0x4be6('0x27')]();});}};}function handleEntityNotFound(_0x216b6e,_0x129bdc){return function(_0x56fce6){if(!_0x56fce6){_0x216b6e[_0x4be6('0x28')](0x194);}return _0x56fce6;};}function handleError(_0x206f0d,_0xf33987){_0xf33987=_0xf33987||0x1f4;return function(_0x35edd0){logger[_0x4be6('0x29')](_0x35edd0[_0x4be6('0x2a')]);if(_0x35edd0[_0x4be6('0x2b')]){delete _0x35edd0['name'];}_0x206f0d[_0x4be6('0x1a')](_0xf33987)[_0x4be6('0x2c')](_0x35edd0);};}exports['index']=function(_0x3d95c3,_0x5ca7a9){var _0x1f2478={},_0x28dabc={},_0x2c0cf6={'count':0x0,'rows':[]};var _0xee7473=_[_0x4be6('0x2d')](db[_0x4be6('0x2e')][_0x4be6('0x2f')],function(_0x47cdbb){return{'name':_0x47cdbb[_0x4be6('0x30')],'type':_0x47cdbb[_0x4be6('0x31')]['key']};});_0x28dabc['model']=_[_0x4be6('0x2d')](_0xee7473,_0x4be6('0x2b'));_0x28dabc[_0x4be6('0x32')]=_[_0x4be6('0x33')](_0x3d95c3[_0x4be6('0x32')]);_0x28dabc['filters']=_[_0x4be6('0x34')](_0x28dabc['model'],_0x28dabc[_0x4be6('0x32')]);_0x1f2478['attributes']=_['intersection'](_0x28dabc[_0x4be6('0x35')],qs['fields'](_0x3d95c3['query'][_0x4be6('0x36')]));_0x1f2478[_0x4be6('0x37')]=_0x1f2478[_0x4be6('0x37')][_0x4be6('0x38')]?_0x1f2478[_0x4be6('0x37')]:_0x28dabc[_0x4be6('0x35')];if(!_0x3d95c3[_0x4be6('0x32')]['hasOwnProperty'](_0x4be6('0x39'))){_0x1f2478[_0x4be6('0x1c')]=qs['limit'](_0x3d95c3[_0x4be6('0x32')]['limit']);_0x1f2478[_0x4be6('0x1f')]=qs['offset'](_0x3d95c3['query'][_0x4be6('0x1f')]);}_0x1f2478[_0x4be6('0x3a')]=qs['sort'](_0x3d95c3[_0x4be6('0x32')]['sort']);_0x1f2478['where']=qs['filters'](_['pick'](_0x3d95c3['query'],_0x28dabc['filters']),_0xee7473);if(_0x3d95c3[_0x4be6('0x32')][_0x4be6('0x3b')]){_0x1f2478[_0x4be6('0x3c')]=_[_0x4be6('0x3d')](_0x1f2478['where'],{'$or':_[_0x4be6('0x2d')](_0xee7473,function(_0x2bcaad){if(_0x2bcaad[_0x4be6('0x31')]!=='VIRTUAL'){var _0x2ce26b={};_0x2ce26b[_0x2bcaad[_0x4be6('0x2b')]]={'$like':'%'+_0x3d95c3['query'][_0x4be6('0x3b')]+'%'};return _0x2ce26b;}})});}_0x1f2478=_[_0x4be6('0x3d')]({},_0x1f2478,_0x3d95c3[_0x4be6('0x3e')]);var _0x38c1a5={'where':_0x1f2478[_0x4be6('0x3c')]};return db['AnalyticExtractedReport'][_0x4be6('0x1e')](_0x38c1a5)['then'](function(_0x11b643){_0x2c0cf6['count']=_0x11b643;if(_0x3d95c3[_0x4be6('0x32')][_0x4be6('0x3f')]){_0x1f2478[_0x4be6('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x1f2478);})[_0x4be6('0x24')](function(_0x3c0179){_0x2c0cf6[_0x4be6('0x41')]=_0x3c0179;return _0x2c0cf6;})[_0x4be6('0x24')](respondWithFilteredResult(_0x5ca7a9,_0x1f2478))[_0x4be6('0x42')](handleError(_0x5ca7a9,null));};exports[_0x4be6('0x43')]=function(_0x24919b,_0x55ce87){var _0x402283={'raw':!![],'where':{'id':_0x24919b[_0x4be6('0x44')]['id']}},_0x189fe1={};_0x189fe1[_0x4be6('0x35')]=_['keys'](db[_0x4be6('0x2e')][_0x4be6('0x2f')]);_0x189fe1[_0x4be6('0x32')]=_[_0x4be6('0x33')](_0x24919b['query']);_0x189fe1[_0x4be6('0x45')]=_['intersection'](_0x189fe1['model'],_0x189fe1[_0x4be6('0x32')]);_0x402283['attributes']=_[_0x4be6('0x34')](_0x189fe1[_0x4be6('0x35')],qs[_0x4be6('0x36')](_0x24919b[_0x4be6('0x32')]['fields']));_0x402283[_0x4be6('0x37')]=_0x402283[_0x4be6('0x37')]['length']?_0x402283[_0x4be6('0x37')]:_0x189fe1['model'];if(_0x24919b['query']['includeAll']){_0x402283['include']=[{'all':!![]}];}_0x402283=_[_0x4be6('0x3d')]({},_0x402283,_0x24919b[_0x4be6('0x3e')]);return db[_0x4be6('0x2e')]['find'](_0x402283)['then'](handleEntityNotFound(_0x55ce87,null))['then'](respondWithResult(_0x55ce87,null))[_0x4be6('0x42')](handleError(_0x55ce87,null));};exports[_0x4be6('0x46')]=function(_0x5debfa,_0x8bb779){return db[_0x4be6('0x2e')][_0x4be6('0x46')](_0x5debfa['body'],{})[_0x4be6('0x24')](function(_0x58a6bf){var _0x2eb96b=_0x5debfa[_0x4be6('0x47')]['get']({'plain':!![]});if(!_0x2eb96b)throw new Error(_0x4be6('0x48'));if(_0x2eb96b[_0x4be6('0x49')]===_0x4be6('0x47')){var _0x465602=_0x58a6bf[_0x4be6('0x4a')]({'plain':!![]});var _0x45a8bf=_0x4be6('0x25');return db[_0x4be6('0x4b')]['find']({'where':{'name':_0x45a8bf,'userProfileId':_0x2eb96b['userProfileId']},'raw':!![]})[_0x4be6('0x24')](function(_0x361887){if(_0x361887&&_0x361887['autoAssociation']===0x0){return db[_0x4be6('0x26')][_0x4be6('0x46')]({'name':_0x465602[_0x4be6('0x2b')],'resourceId':_0x465602['id'],'type':_0x361887[_0x4be6('0x2b')],'sectionId':_0x361887['id']},{})['then'](function(){return _0x58a6bf;});}else{return _0x58a6bf;}})[_0x4be6('0x42')](function(_0x5708cb){logger[_0x4be6('0x29')](_0x4be6('0x4c'),_0x5708cb);throw _0x5708cb;});}return _0x58a6bf;})[_0x4be6('0x24')](respondWithResult(_0x8bb779,0xc9))[_0x4be6('0x42')](handleError(_0x8bb779,null));};exports['update']=function(_0x3ba42e,_0x419d98){if(_0x3ba42e[_0x4be6('0x4d')]['id']){delete _0x3ba42e[_0x4be6('0x4d')]['id'];}return db['AnalyticExtractedReport'][_0x4be6('0x4e')]({'where':{'id':_0x3ba42e[_0x4be6('0x44')]['id']}})[_0x4be6('0x24')](handleEntityNotFound(_0x419d98,null))[_0x4be6('0x24')](saveUpdates(_0x3ba42e['body'],null))[_0x4be6('0x24')](respondWithResult(_0x419d98,null))[_0x4be6('0x42')](handleError(_0x419d98,null));};exports[_0x4be6('0x23')]=function(_0x43e5f5,_0xe9dbb1){return db[_0x4be6('0x2e')][_0x4be6('0x4e')]({'where':{'id':_0x43e5f5[_0x4be6('0x44')]['id']}})[_0x4be6('0x24')](handleEntityNotFound(_0xe9dbb1,null))[_0x4be6('0x24')](removeEntity(_0xe9dbb1,null))[_0x4be6('0x42')](handleError(_0xe9dbb1,null));};exports['download']=function(_0x35b84c,_0x1248c3,_0x4c4d70){return db[_0x4be6('0x2e')][_0x4be6('0x4e')]({'where':{'id':_0x35b84c[_0x4be6('0x44')]['id']},'attributes':[_0x4be6('0x2b'),'basename',_0x4be6('0x4f'),_0x4be6('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x1248c3,null))[_0x4be6('0x24')](function(_0x797beb){if(_0x797beb){if(!fs[_0x4be6('0x51')](path[_0x4be6('0x52')](config['root'],_0x4be6('0x53'),_0x797beb[_0x4be6('0x4f')]))){throw new db['Sequelize'][(_0x4be6('0x54'))](_0x4be6('0x55'));}if(_0x35b84c[_0x4be6('0x32')][_0x4be6('0x56')]){return _0x1248c3[_0x4be6('0x28')](0xc8);}return _0x1248c3[_0x4be6('0x57')](path[_0x4be6('0x52')](config['root'],_0x4be6('0x53'),_0x797beb[_0x4be6('0x4f')]),util['format']('%s.%s',_0x797beb[_0x4be6('0x58')]||_0x797beb[_0x4be6('0x2b')],_0x797beb[_0x4be6('0x50')][_0x4be6('0x59')]()));}})[_0x4be6('0x42')](handleError(_0x1248c3,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 274bd58..f14ddd4 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 _0xe731=['../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x258784,_0xbf9d29){var _0x361829=function(_0x4b5e74){while(--_0x4b5e74){_0x258784['push'](_0x258784['shift']());}};_0x361829(++_0xbf9d29);}(_0xe731,0x19e));var _0x1e73=function(_0x551f8b,_0x15fac5){_0x551f8b=_0x551f8b-0x0;var _0x28a22c=_0xe731[_0x551f8b];return _0x28a22c;};'use strict';var _=require('lodash');var util=require(_0x1e73('0x0'));var logger=require(_0x1e73('0x1'))(_0x1e73('0x2'));var moment=require('moment');var BPromise=require(_0x1e73('0x3'));var rp=require(_0x1e73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e73('0x5'));var config=require(_0x1e73('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x1e73('0x7')]=function(_0x12f068,_0x1c21c7){return _0x12f068['define'](_0x1e73('0x8'),attributes,{'tableName':_0x1e73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0338=['lodash','util','api','moment','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x44caf2,_0x8ffb16){var _0x25978d=function(_0x1a2e61){while(--_0x1a2e61){_0x44caf2['push'](_0x44caf2['shift']());}};_0x25978d(++_0x8ffb16);}(_0x0338,0x13f));var _0x8033=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x0338[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x8033('0x0'));var util=require(_0x8033('0x1'));var logger=require('../../config/logger')(_0x8033('0x2'));var moment=require(_0x8033('0x3'));var BPromise=require('bluebird');var rp=require(_0x8033('0x4'));var fs=require('fs');var path=require(_0x8033('0x5'));var rimraf=require('rimraf');var config=require(_0x8033('0x6'));var attributes=require(_0x8033('0x7'));module[_0x8033('0x8')]=function(_0x266f1c,_0x11259c){return _0x266f1c['define'](_0x8033('0x9'),attributes,{'tableName':_0x8033('0xa'),'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 975453e..ee0c28f 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 _0x2327=['jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2327,0x89));var _0x7232=function(_0x1599fc,_0x4e661f){_0x1599fc=_0x1599fc-0x0;var _0x996075=_0x2327[_0x1599fc];return _0x996075;};'use strict';var _=require(_0x7232('0x0'));var util=require(_0x7232('0x1'));var moment=require(_0x7232('0x2'));var BPromise=require('bluebird');var rs=require(_0x7232('0x3'));var fs=require('fs');var Redis=require(_0x7232('0x4'));var db=require(_0x7232('0x5'))['db'];var utils=require(_0x7232('0x6'));var logger=require(_0x7232('0x7'))(_0x7232('0x8'));var config=require(_0x7232('0x9'));var jayson=require(_0x7232('0xa'));var client=jayson['client'][_0x7232('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a19f8,_0x52cf06,_0x4ff155){return new BPromise(function(_0x217532,_0x254bea){return client[_0x7232('0xc')](_0x3a19f8,_0x4ff155)[_0x7232('0xd')](function(_0xd8eb73){logger[_0x7232('0xe')](_0x7232('0xf'),_0x52cf06,_0x7232('0x10'));logger[_0x7232('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x52cf06,_0x7232('0x10'),JSON['stringify'](_0xd8eb73));if(_0xd8eb73[_0x7232('0x12')]){if(_0xd8eb73['error']['code']===0x1f4){logger[_0x7232('0x12')](_0x7232('0xf'),_0x52cf06,_0xd8eb73[_0x7232('0x12')]['message']);return _0x254bea(_0xd8eb73[_0x7232('0x12')][_0x7232('0x13')]);}logger[_0x7232('0x12')](_0x7232('0xf'),_0x52cf06,_0xd8eb73[_0x7232('0x12')][_0x7232('0x13')]);return _0x217532(_0xd8eb73[_0x7232('0x12')][_0x7232('0x13')]);}else{logger[_0x7232('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x52cf06,_0x7232('0x10'));_0x217532(_0xd8eb73[_0x7232('0x14')][_0x7232('0x13')]);}})['catch'](function(_0x4c03b4){logger[_0x7232('0x12')](_0x7232('0xf'),_0x52cf06,_0x4c03b4);_0x254bea(_0x4c03b4);});});} \ No newline at end of file +var _0xc765=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x541e4f,_0x48d7fa){var _0x5c1711=function(_0x10fdb1){while(--_0x10fdb1){_0x541e4f['push'](_0x541e4f['shift']());}};_0x5c1711(++_0x48d7fa);}(_0xc765,0x14b));var _0x5c76=function(_0x1f18ef,_0x1708ba){_0x1f18ef=_0x1f18ef-0x0;var _0x414028=_0xc765[_0x1f18ef];return _0x414028;};'use strict';var _=require(_0x5c76('0x0'));var util=require(_0x5c76('0x1'));var moment=require(_0x5c76('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c76('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c76('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c76('0x5'))(_0x5c76('0x6'));var config=require('../../config/environment');var jayson=require(_0x5c76('0x7'));var client=jayson[_0x5c76('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494c47,_0x27a139,_0x573524){return new BPromise(function(_0x39e03c,_0x39caac){return client[_0x5c76('0x9')](_0x494c47,_0x573524)[_0x5c76('0xa')](function(_0x52aa9d){logger[_0x5c76('0xb')](_0x5c76('0xc'),_0x27a139,'request\x20sent');logger[_0x5c76('0xd')](_0x5c76('0xe'),_0x27a139,'request\x20sent',JSON[_0x5c76('0xf')](_0x52aa9d));if(_0x52aa9d['error']){if(_0x52aa9d[_0x5c76('0x10')][_0x5c76('0x11')]===0x1f4){logger[_0x5c76('0x10')](_0x5c76('0xc'),_0x27a139,_0x52aa9d[_0x5c76('0x10')][_0x5c76('0x12')]);return _0x39caac(_0x52aa9d['error'][_0x5c76('0x12')]);}logger['error'](_0x5c76('0xc'),_0x27a139,_0x52aa9d[_0x5c76('0x10')]['message']);return _0x39e03c(_0x52aa9d[_0x5c76('0x10')][_0x5c76('0x12')]);}else{logger['info'](_0x5c76('0xc'),_0x27a139,'request\x20sent');_0x39e03c(_0x52aa9d[_0x5c76('0x13')][_0x5c76('0x12')]);}})['catch'](function(_0x56b274){logger[_0x5c76('0x10')](_0x5c76('0xc'),_0x27a139,_0x56b274);_0x39caac(_0x56b274);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 26a8eaa..e66f0fc 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 _0xefc5=['download','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x114bdf,_0x119ada){var _0x5658f6=function(_0xff3dc){while(--_0xff3dc){_0x114bdf['push'](_0x114bdf['shift']());}};_0x5658f6(++_0x119ada);}(_0xefc5,0x193));var _0x5efc=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xefc5[_0x61b3ab];return _0x57097f;};'use strict';var multer=require('multer');var util=require(_0x5efc('0x0'));var path=require(_0x5efc('0x1'));var timeout=require(_0x5efc('0x2'));var express=require(_0x5efc('0x3'));var router=express[_0x5efc('0x4')]();var fs_extra=require(_0x5efc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5efc('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x5efc('0x7')]('/',auth[_0x5efc('0x8')](),controller[_0x5efc('0x9')]);router[_0x5efc('0x7')](_0x5efc('0xa'),auth[_0x5efc('0x8')](),controller[_0x5efc('0xb')]);router[_0x5efc('0x7')](_0x5efc('0xc'),auth[_0x5efc('0x8')](),controller[_0x5efc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x5efc('0x8')](),controller[_0x5efc('0xe')]);router[_0x5efc('0xf')](_0x5efc('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd899=['/:id/download','download','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x1f603e,_0x371cf5){var _0x2d70b4=function(_0x3bfcf4){while(--_0x3bfcf4){_0x1f603e['push'](_0x1f603e['shift']());}};_0x2d70b4(++_0x371cf5);}(_0xd899,0x7e));var _0x9d89=function(_0x2d54c2,_0x333c45){_0x2d54c2=_0x2d54c2-0x0;var _0x2f9d51=_0xd899[_0x2d54c2];return _0x2f9d51;};'use strict';var multer=require(_0x9d89('0x0'));var util=require(_0x9d89('0x1'));var path=require(_0x9d89('0x2'));var timeout=require(_0x9d89('0x3'));var express=require(_0x9d89('0x4'));var router=express[_0x9d89('0x5')]();var fs_extra=require(_0x9d89('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9d89('0x7'));var config=require(_0x9d89('0x8'));var controller=require(_0x9d89('0x9'));router[_0x9d89('0xa')]('/',auth[_0x9d89('0xb')](),controller[_0x9d89('0xc')]);router[_0x9d89('0xa')](_0x9d89('0xd'),auth[_0x9d89('0xb')](),controller['show']);router['get'](_0x9d89('0xe'),auth[_0x9d89('0xb')](),controller[_0x9d89('0xf')]);router['post']('/',auth[_0x9d89('0xb')](),controller['create']);router[_0x9d89('0x10')](_0x9d89('0xd'),auth[_0x9d89('0xb')](),controller[_0x9d89('0x11')]);router['delete'](_0x9d89('0xd'),auth['isAuthenticated'](),controller[_0x9d89('0x12')]);module[_0x9d89('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 5194b88..5121f25 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 _0xd171=['BOOLEAN','exports','TEXT','STRING'];(function(_0x117eb9,_0x373dd1){var _0x5ee00b=function(_0x4ac96c){while(--_0x4ac96c){_0x117eb9['push'](_0x117eb9['shift']());}};_0x5ee00b(++_0x373dd1);}(_0xd171,0x7d));var _0x1d17=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xd171[_0x51bb38];return _0x51c09b;};'use strict';var Sequelize=require('sequelize');module[_0x1d17('0x0')]={'field':{'type':Sequelize[_0x1d17('0x1')]},'alias':{'type':Sequelize[_0x1d17('0x2')]},'function':{'type':Sequelize[_0x1d17('0x2')]},'format':{'type':Sequelize[_0x1d17('0x2')]},'groupBy':{'type':Sequelize[_0x1d17('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1d17('0x2')]},'custom':{'type':Sequelize[_0x1d17('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5c72=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x21c601,_0x26f456){var _0xd423f=function(_0x52bc27){while(--_0x52bc27){_0x21c601['push'](_0x21c601['shift']());}};_0xd423f(++_0x26f456);}(_0x5c72,0x77));var _0x25c7=function(_0x29f10f,_0x59cb8a){_0x29f10f=_0x29f10f-0x0;var _0x2e4928=_0x5c72[_0x29f10f];return _0x2e4928;};'use strict';var Sequelize=require(_0x25c7('0x0'));module[_0x25c7('0x1')]={'field':{'type':Sequelize[_0x25c7('0x2')]},'alias':{'type':Sequelize[_0x25c7('0x3')]},'function':{'type':Sequelize[_0x25c7('0x3')]},'format':{'type':Sequelize[_0x25c7('0x3')]},'groupBy':{'type':Sequelize[_0x25c7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x25c7('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9c2411a..b76f9d3 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 _0x9a07=['includeAll','include','find','catch','create','body','bulkCreate','params','bulkDestroy','ids','addFields','findOne','transaction','CustomReportId','findAll','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x2762ea,_0x1dcb38){var _0x51ef71=function(_0x114acd){while(--_0x114acd){_0x2762ea['push'](_0x2762ea['shift']());}};_0x51ef71(++_0x1dcb38);}(_0x9a07,0x108));var _0x79a0=function(_0x214a8c,_0x1a2283){_0x214a8c=_0x214a8c-0x0;var _0x4421c5=_0x9a07[_0x214a8c];return _0x4421c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x79a0('0x0'));var jsonpatch=require(_0x79a0('0x1'));var rp=require(_0x79a0('0x2'));var moment=require('moment');var BPromise=require(_0x79a0('0x3'));var Mustache=require(_0x79a0('0x4'));var util=require(_0x79a0('0x5'));var path=require('path');var sox=require(_0x79a0('0x6'));var csv=require(_0x79a0('0x7'));var ejs=require(_0x79a0('0x8'));var fs=require('fs');var fs_extra=require(_0x79a0('0x9'));var _=require(_0x79a0('0xa'));var squel=require(_0x79a0('0xb'));var crypto=require(_0x79a0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x79a0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x79a0('0xe'));var Redis=require(_0x79a0('0xf'));var authService=require(_0x79a0('0x10'));var qs=require(_0x79a0('0x11'));var as=require(_0x79a0('0x12'));var hardwareService=require(_0x79a0('0x13'));var logger=require(_0x79a0('0x14'))(_0x79a0('0x15'));var utils=require(_0x79a0('0x16'));var config=require(_0x79a0('0x17'));var licenseUtil=require(_0x79a0('0x18'));var db=require(_0x79a0('0x19'))['db'];function respondWithStatusCode(_0x16f73f,_0x17d5b1){_0x17d5b1=_0x17d5b1||0xcc;return function(_0x8aaa50){if(_0x8aaa50){return _0x16f73f[_0x79a0('0x1a')](_0x17d5b1);}return _0x16f73f[_0x79a0('0x1b')](_0x17d5b1)[_0x79a0('0x1c')]();};}function respondWithResult(_0x3c431c,_0x174097){_0x174097=_0x174097||0xc8;return function(_0x31fa1f){if(_0x31fa1f){return _0x3c431c[_0x79a0('0x1b')](_0x174097)['json'](_0x31fa1f);}};}function respondWithFilteredResult(_0x56b07e,_0x37c3c1){return function(_0x289957){if(_0x289957){var _0x76b1f6=typeof _0x37c3c1[_0x79a0('0x1d')]===_0x79a0('0x1e')&&typeof _0x37c3c1[_0x79a0('0x1f')]===_0x79a0('0x1e');var _0x2e7bb9=_0x289957[_0x79a0('0x20')];var _0x39ccb4=_0x76b1f6?0x0:_0x37c3c1['offset'];var _0x479248=_0x76b1f6?_0x289957['count']:_0x37c3c1[_0x79a0('0x1d')]+_0x37c3c1[_0x79a0('0x1f')];var _0x1f26a2;if(_0x479248>=_0x2e7bb9){_0x479248=_0x2e7bb9;_0x1f26a2=0xc8;}else{_0x1f26a2=0xce;}_0x56b07e[_0x79a0('0x1b')](_0x1f26a2);return _0x56b07e[_0x79a0('0x21')]('Content-Range',_0x39ccb4+'-'+_0x479248+'/'+_0x2e7bb9)[_0x79a0('0x22')](_0x289957);}return null;};}function patchUpdates(_0xefdfe4){return function(_0x1c5383){try{jsonpatch['apply'](_0x1c5383,_0xefdfe4,!![]);}catch(_0x3de3f6){return BPromise[_0x79a0('0x23')](_0x3de3f6);}return _0x1c5383[_0x79a0('0x24')]();};}function saveUpdates(_0x1d8ae1,_0x16e583){return function(_0x248d49){if(_0x248d49){return _0x248d49[_0x79a0('0x25')](_0x1d8ae1)[_0x79a0('0x26')](function(_0x54d88f){return _0x54d88f;});}return null;};}function removeEntity(_0x401171,_0x2c9ad0){return function(_0x1b5263){if(_0x1b5263){return _0x1b5263[_0x79a0('0x27')]()[_0x79a0('0x26')](function(){_0x401171[_0x79a0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfe4c,_0x45680b){return function(_0x16fcf1){if(!_0x16fcf1){_0x2cfe4c[_0x79a0('0x1a')](0x194);}return _0x16fcf1;};}function handleError(_0x288f62,_0x34a950){_0x34a950=_0x34a950||0x1f4;return function(_0x3362ce){logger[_0x79a0('0x28')](_0x3362ce[_0x79a0('0x29')]);if(_0x3362ce[_0x79a0('0x2a')]){delete _0x3362ce[_0x79a0('0x2a')];}_0x288f62[_0x79a0('0x1b')](_0x34a950)[_0x79a0('0x2b')](_0x3362ce);};}exports[_0x79a0('0x2c')]=function(_0x139af2,_0x3ea215){var _0x246474={},_0x3d8bb2={},_0x1c8649={'count':0x0,'rows':[]};var _0x40dfb9=_[_0x79a0('0x2d')](db[_0x79a0('0x2e')][_0x79a0('0x2f')],function(_0x1fedaa){return{'name':_0x1fedaa[_0x79a0('0x30')],'type':_0x1fedaa['type'][_0x79a0('0x31')]};});_0x3d8bb2['model']=_[_0x79a0('0x2d')](_0x40dfb9,_0x79a0('0x2a'));_0x3d8bb2[_0x79a0('0x32')]=_[_0x79a0('0x33')](_0x139af2['query']);_0x3d8bb2[_0x79a0('0x34')]=_[_0x79a0('0x35')](_0x3d8bb2[_0x79a0('0x36')],_0x3d8bb2['query']);_0x246474[_0x79a0('0x37')]=_['intersection'](_0x3d8bb2[_0x79a0('0x36')],qs[_0x79a0('0x38')](_0x139af2[_0x79a0('0x32')][_0x79a0('0x38')]));_0x246474[_0x79a0('0x37')]=_0x246474[_0x79a0('0x37')][_0x79a0('0x39')]?_0x246474['attributes']:_0x3d8bb2[_0x79a0('0x36')];if(!_0x139af2[_0x79a0('0x32')][_0x79a0('0x3a')](_0x79a0('0x3b'))){_0x246474[_0x79a0('0x1f')]=qs[_0x79a0('0x1f')](_0x139af2[_0x79a0('0x32')][_0x79a0('0x1f')]);_0x246474[_0x79a0('0x1d')]=qs['offset'](_0x139af2[_0x79a0('0x32')]['offset']);}_0x246474['order']=qs[_0x79a0('0x3c')](_0x139af2[_0x79a0('0x32')][_0x79a0('0x3c')]);_0x246474[_0x79a0('0x3d')]=qs[_0x79a0('0x34')](_[_0x79a0('0x3e')](_0x139af2['query'],_0x3d8bb2[_0x79a0('0x34')]),_0x40dfb9);if(_0x139af2[_0x79a0('0x32')][_0x79a0('0x3f')]){_0x246474[_0x79a0('0x3d')]=_[_0x79a0('0x40')](_0x246474[_0x79a0('0x3d')],{'$or':_[_0x79a0('0x2d')](_0x40dfb9,function(_0x10568d){if(_0x10568d[_0x79a0('0x41')]!==_0x79a0('0x42')){var _0x5f4174={};_0x5f4174[_0x10568d[_0x79a0('0x2a')]]={'$like':'%'+_0x139af2[_0x79a0('0x32')]['filter']+'%'};return _0x5f4174;}})});}_0x246474=_['merge']({},_0x246474,_0x139af2[_0x79a0('0x43')]);var _0x2a56fb={'where':_0x246474[_0x79a0('0x3d')]};return db['AnalyticFieldReport'][_0x79a0('0x20')](_0x2a56fb)[_0x79a0('0x26')](function(_0x43f8c9){_0x1c8649[_0x79a0('0x20')]=_0x43f8c9;if(_0x139af2[_0x79a0('0x32')][_0x79a0('0x44')]){_0x246474['include']=[{'all':!![]}];}return db[_0x79a0('0x2e')]['findAll'](_0x246474);})[_0x79a0('0x26')](function(_0x36ae87){_0x1c8649['rows']=_0x36ae87;return _0x1c8649;})[_0x79a0('0x26')](respondWithFilteredResult(_0x3ea215,_0x246474))['catch'](handleError(_0x3ea215,null));};exports['show']=function(_0x2cb8ef,_0xafc6d5){var _0x38d11b={'raw':![],'where':{'id':_0x2cb8ef['params']['id']}},_0x11acf5={};_0x11acf5[_0x79a0('0x36')]=_[_0x79a0('0x33')](db[_0x79a0('0x2e')][_0x79a0('0x2f')]);_0x11acf5[_0x79a0('0x32')]=_[_0x79a0('0x33')](_0x2cb8ef[_0x79a0('0x32')]);_0x11acf5[_0x79a0('0x34')]=_['intersection'](_0x11acf5[_0x79a0('0x36')],_0x11acf5[_0x79a0('0x32')]);_0x38d11b[_0x79a0('0x37')]=_[_0x79a0('0x35')](_0x11acf5[_0x79a0('0x36')],qs[_0x79a0('0x38')](_0x2cb8ef[_0x79a0('0x32')][_0x79a0('0x38')]));_0x38d11b[_0x79a0('0x37')]=_0x38d11b[_0x79a0('0x37')]['length']?_0x38d11b['attributes']:_0x11acf5['model'];if(_0x2cb8ef[_0x79a0('0x32')][_0x79a0('0x44')]){_0x38d11b[_0x79a0('0x45')]=[{'all':!![]}];}_0x38d11b=_[_0x79a0('0x40')]({},_0x38d11b,_0x2cb8ef['options']);return db['AnalyticFieldReport'][_0x79a0('0x46')](_0x38d11b)[_0x79a0('0x26')](handleEntityNotFound(_0xafc6d5,null))[_0x79a0('0x26')](respondWithResult(_0xafc6d5,null))[_0x79a0('0x47')](handleError(_0xafc6d5,null));};exports[_0x79a0('0x48')]=function(_0x3b8b87,_0x76637){return db[_0x79a0('0x2e')][_0x79a0('0x48')](_0x3b8b87[_0x79a0('0x49')],{})[_0x79a0('0x26')](respondWithResult(_0x76637,0xc9))[_0x79a0('0x47')](handleError(_0x76637,null));};exports[_0x79a0('0x4a')]=function(_0x69c3b3,_0x151b0d){return db['AnalyticFieldReport']['bulkCreate'](_0x69c3b3[_0x79a0('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x151b0d,0xc9))[_0x79a0('0x47')](handleError(_0x151b0d,null));};exports[_0x79a0('0x25')]=function(_0x3da4a4,_0x1be3d5){if(_0x3da4a4['body']['id']){delete _0x3da4a4[_0x79a0('0x49')]['id'];}return db[_0x79a0('0x2e')][_0x79a0('0x46')]({'where':{'id':_0x3da4a4['params']['id']}})[_0x79a0('0x26')](handleEntityNotFound(_0x1be3d5,null))[_0x79a0('0x26')](saveUpdates(_0x3da4a4[_0x79a0('0x49')],null))[_0x79a0('0x26')](respondWithResult(_0x1be3d5,null))['catch'](handleError(_0x1be3d5,null));};exports[_0x79a0('0x27')]=function(_0x5dadcd,_0x4cceb6){return db[_0x79a0('0x2e')][_0x79a0('0x46')]({'where':{'id':_0x5dadcd[_0x79a0('0x4b')]['id']}})[_0x79a0('0x26')](handleEntityNotFound(_0x4cceb6,null))[_0x79a0('0x26')](removeEntity(_0x4cceb6,null))[_0x79a0('0x47')](handleError(_0x4cceb6,null));};exports[_0x79a0('0x4c')]=function(_0x4e2bd7,_0x4892c4){return db[_0x79a0('0x2e')]['destroy']({'where':{'id':_0x4e2bd7[_0x79a0('0x32')][_0x79a0('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x79a0('0x26')](respondWithResult(_0x4892c4,0xcc))['catch'](handleError(_0x4892c4,null));};exports[_0x79a0('0x4e')]=function(_0x4e03e9,_0x12e890,_0x21b9fd){return db['AnalyticCustomReport'][_0x79a0('0x4f')]({'where':{'id':_0x4e03e9[_0x79a0('0x4b')]['id']}})[_0x79a0('0x26')](handleEntityNotFound(_0x12e890,null))['then'](function(_0x5314a3){if(_0x5314a3){return db['sequelize'][_0x79a0('0x50')](function(_0xa70659){return db[_0x79a0('0x2e')][_0x79a0('0x27')]({'where':{'CustomReportId':_0x4e03e9[_0x79a0('0x4b')]['id']},'transaction':_0xa70659})[_0x79a0('0x26')](function(_0x31088b){var _0x4053ae=_['map'](_0x4e03e9[_0x79a0('0x49')],function(_0x3140b3){delete _0x3140b3['id'];_0x3140b3[_0x79a0('0x51')]=_0x4e03e9[_0x79a0('0x4b')]['id'];return _0x3140b3;});return db[_0x79a0('0x2e')][_0x79a0('0x4a')](_0x4053ae,{'transaction':_0xa70659});});})['then'](function(){return db[_0x79a0('0x2e')][_0x79a0('0x52')]({'where':{'CustomReportId':_0x4e03e9[_0x79a0('0x4b')]['id']}});});}})[_0x79a0('0x26')](respondWithResult(_0x12e890,null))[_0x79a0('0x47')](handleError(_0x12e890,null));}; \ No newline at end of file +var _0xab2e=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','transaction','CustomReportId','rimraf','request-promise','moment','bluebird'];(function(_0x25f62a,_0x886f16){var _0x188f54=function(_0x3904ba){while(--_0x3904ba){_0x25f62a['push'](_0x25f62a['shift']());}};_0x188f54(++_0x886f16);}(_0xab2e,0x98));var _0xeab2=function(_0x4a1fa5,_0x251f61){_0x4a1fa5=_0x4a1fa5-0x0;var _0x27fd7c=_0xab2e[_0x4a1fa5];return _0x27fd7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeab2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeab2('0x1'));var moment=require(_0xeab2('0x2'));var BPromise=require(_0xeab2('0x3'));var Mustache=require(_0xeab2('0x4'));var util=require(_0xeab2('0x5'));var path=require('path');var sox=require(_0xeab2('0x6'));var csv=require(_0xeab2('0x7'));var ejs=require(_0xeab2('0x8'));var fs=require('fs');var fs_extra=require(_0xeab2('0x9'));var _=require(_0xeab2('0xa'));var squel=require('squel');var crypto=require(_0xeab2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeab2('0x7'));var querystring=require(_0xeab2('0xc'));var Papa=require(_0xeab2('0xd'));var Redis=require(_0xeab2('0xe'));var authService=require(_0xeab2('0xf'));var qs=require(_0xeab2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeab2('0x11'));var logger=require(_0xeab2('0x12'))(_0xeab2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeab2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27b47a,_0x50e74f){_0x50e74f=_0x50e74f||0xcc;return function(_0x59db3d){if(_0x59db3d){return _0x27b47a[_0xeab2('0x15')](_0x50e74f);}return _0x27b47a[_0xeab2('0x16')](_0x50e74f)[_0xeab2('0x17')]();};}function respondWithResult(_0x55f709,_0x3aecbe){_0x3aecbe=_0x3aecbe||0xc8;return function(_0x4f07e5){if(_0x4f07e5){return _0x55f709[_0xeab2('0x16')](_0x3aecbe)[_0xeab2('0x18')](_0x4f07e5);}};}function respondWithFilteredResult(_0x3d831e,_0x5ef996){return function(_0x3a9d2b){if(_0x3a9d2b){var _0xe7dd6b=typeof _0x5ef996[_0xeab2('0x19')]===_0xeab2('0x1a')&&typeof _0x5ef996['limit']===_0xeab2('0x1a');var _0x520063=_0x3a9d2b[_0xeab2('0x1b')];var _0x1efa9e=_0xe7dd6b?0x0:_0x5ef996[_0xeab2('0x19')];var _0x4fddd0=_0xe7dd6b?_0x3a9d2b['count']:_0x5ef996[_0xeab2('0x19')]+_0x5ef996[_0xeab2('0x1c')];var _0x31728e;if(_0x4fddd0>=_0x520063){_0x4fddd0=_0x520063;_0x31728e=0xc8;}else{_0x31728e=0xce;}_0x3d831e[_0xeab2('0x16')](_0x31728e);return _0x3d831e[_0xeab2('0x1d')](_0xeab2('0x1e'),_0x1efa9e+'-'+_0x4fddd0+'/'+_0x520063)['json'](_0x3a9d2b);}return null;};}function patchUpdates(_0x5b87b4){return function(_0x2dbc52){try{jsonpatch[_0xeab2('0x1f')](_0x2dbc52,_0x5b87b4,!![]);}catch(_0x5d508a){return BPromise[_0xeab2('0x20')](_0x5d508a);}return _0x2dbc52[_0xeab2('0x21')]();};}function saveUpdates(_0x3bfdf7,_0x2f18a4){return function(_0x215647){if(_0x215647){return _0x215647[_0xeab2('0x22')](_0x3bfdf7)[_0xeab2('0x23')](function(_0x3e7c0e){return _0x3e7c0e;});}return null;};}function removeEntity(_0x564883,_0x3b1725){return function(_0xc8db16){if(_0xc8db16){return _0xc8db16[_0xeab2('0x24')]()[_0xeab2('0x23')](function(){_0x564883[_0xeab2('0x16')](0xcc)[_0xeab2('0x17')]();});}};}function handleEntityNotFound(_0x450196,_0x49b4a6){return function(_0x30cbf3){if(!_0x30cbf3){_0x450196[_0xeab2('0x15')](0x194);}return _0x30cbf3;};}function handleError(_0x54aacd,_0x9ae1e6){_0x9ae1e6=_0x9ae1e6||0x1f4;return function(_0x42d38a){logger[_0xeab2('0x25')](_0x42d38a[_0xeab2('0x26')]);if(_0x42d38a[_0xeab2('0x27')]){delete _0x42d38a[_0xeab2('0x27')];}_0x54aacd[_0xeab2('0x16')](_0x9ae1e6)[_0xeab2('0x28')](_0x42d38a);};}exports['index']=function(_0x297de3,_0x2f6aa2){var _0x351a4c={},_0x41de67={},_0x119167={'count':0x0,'rows':[]};var _0x56480a=_[_0xeab2('0x29')](db[_0xeab2('0x2a')]['rawAttributes'],function(_0x1ab6d8){return{'name':_0x1ab6d8[_0xeab2('0x2b')],'type':_0x1ab6d8['type']['key']};});_0x41de67['model']=_['map'](_0x56480a,_0xeab2('0x27'));_0x41de67[_0xeab2('0x2c')]=_[_0xeab2('0x2d')](_0x297de3[_0xeab2('0x2c')]);_0x41de67[_0xeab2('0x2e')]=_[_0xeab2('0x2f')](_0x41de67[_0xeab2('0x30')],_0x41de67[_0xeab2('0x2c')]);_0x351a4c['attributes']=_['intersection'](_0x41de67['model'],qs[_0xeab2('0x31')](_0x297de3[_0xeab2('0x2c')][_0xeab2('0x31')]));_0x351a4c[_0xeab2('0x32')]=_0x351a4c[_0xeab2('0x32')][_0xeab2('0x33')]?_0x351a4c['attributes']:_0x41de67[_0xeab2('0x30')];if(!_0x297de3[_0xeab2('0x2c')][_0xeab2('0x34')](_0xeab2('0x35'))){_0x351a4c[_0xeab2('0x1c')]=qs['limit'](_0x297de3[_0xeab2('0x2c')][_0xeab2('0x1c')]);_0x351a4c[_0xeab2('0x19')]=qs[_0xeab2('0x19')](_0x297de3[_0xeab2('0x2c')]['offset']);}_0x351a4c[_0xeab2('0x36')]=qs[_0xeab2('0x37')](_0x297de3['query'][_0xeab2('0x37')]);_0x351a4c[_0xeab2('0x38')]=qs[_0xeab2('0x2e')](_['pick'](_0x297de3['query'],_0x41de67['filters']),_0x56480a);if(_0x297de3[_0xeab2('0x2c')]['filter']){_0x351a4c[_0xeab2('0x38')]=_['merge'](_0x351a4c[_0xeab2('0x38')],{'$or':_[_0xeab2('0x29')](_0x56480a,function(_0xf0ed81){if(_0xf0ed81[_0xeab2('0x39')]!==_0xeab2('0x3a')){var _0x2e315d={};_0x2e315d[_0xf0ed81['name']]={'$like':'%'+_0x297de3[_0xeab2('0x2c')][_0xeab2('0x3b')]+'%'};return _0x2e315d;}})});}_0x351a4c=_[_0xeab2('0x3c')]({},_0x351a4c,_0x297de3[_0xeab2('0x3d')]);var _0xcf11f={'where':_0x351a4c[_0xeab2('0x38')]};return db[_0xeab2('0x2a')][_0xeab2('0x1b')](_0xcf11f)[_0xeab2('0x23')](function(_0x544433){_0x119167[_0xeab2('0x1b')]=_0x544433;if(_0x297de3[_0xeab2('0x2c')][_0xeab2('0x3e')]){_0x351a4c['include']=[{'all':!![]}];}return db[_0xeab2('0x2a')][_0xeab2('0x3f')](_0x351a4c);})[_0xeab2('0x23')](function(_0x23c750){_0x119167[_0xeab2('0x40')]=_0x23c750;return _0x119167;})['then'](respondWithFilteredResult(_0x2f6aa2,_0x351a4c))[_0xeab2('0x41')](handleError(_0x2f6aa2,null));};exports[_0xeab2('0x42')]=function(_0x18b4be,_0x56d92d){var _0x2bbc8f={'raw':![],'where':{'id':_0x18b4be[_0xeab2('0x43')]['id']}},_0x41a26e={};_0x41a26e['model']=_[_0xeab2('0x2d')](db[_0xeab2('0x2a')][_0xeab2('0x44')]);_0x41a26e[_0xeab2('0x2c')]=_[_0xeab2('0x2d')](_0x18b4be[_0xeab2('0x2c')]);_0x41a26e[_0xeab2('0x2e')]=_[_0xeab2('0x2f')](_0x41a26e[_0xeab2('0x30')],_0x41a26e[_0xeab2('0x2c')]);_0x2bbc8f[_0xeab2('0x32')]=_[_0xeab2('0x2f')](_0x41a26e[_0xeab2('0x30')],qs[_0xeab2('0x31')](_0x18b4be['query'][_0xeab2('0x31')]));_0x2bbc8f[_0xeab2('0x32')]=_0x2bbc8f[_0xeab2('0x32')][_0xeab2('0x33')]?_0x2bbc8f[_0xeab2('0x32')]:_0x41a26e[_0xeab2('0x30')];if(_0x18b4be[_0xeab2('0x2c')][_0xeab2('0x3e')]){_0x2bbc8f['include']=[{'all':!![]}];}_0x2bbc8f=_[_0xeab2('0x3c')]({},_0x2bbc8f,_0x18b4be[_0xeab2('0x3d')]);return db[_0xeab2('0x2a')][_0xeab2('0x45')](_0x2bbc8f)[_0xeab2('0x23')](handleEntityNotFound(_0x56d92d,null))[_0xeab2('0x23')](respondWithResult(_0x56d92d,null))[_0xeab2('0x41')](handleError(_0x56d92d,null));};exports['create']=function(_0x4c44b1,_0x1cff1d){return db[_0xeab2('0x2a')][_0xeab2('0x46')](_0x4c44b1[_0xeab2('0x47')],{})[_0xeab2('0x23')](respondWithResult(_0x1cff1d,0xc9))[_0xeab2('0x41')](handleError(_0x1cff1d,null));};exports[_0xeab2('0x48')]=function(_0x5eaf29,_0x47b96d){return db[_0xeab2('0x2a')][_0xeab2('0x48')](_0x5eaf29[_0xeab2('0x47')],{'raw':![],'individualHooks':!![]})[_0xeab2('0x23')](respondWithResult(_0x47b96d,0xc9))['catch'](handleError(_0x47b96d,null));};exports['update']=function(_0x123d40,_0x538ee0){if(_0x123d40['body']['id']){delete _0x123d40[_0xeab2('0x47')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x123d40[_0xeab2('0x43')]['id']}})[_0xeab2('0x23')](handleEntityNotFound(_0x538ee0,null))['then'](saveUpdates(_0x123d40[_0xeab2('0x47')],null))['then'](respondWithResult(_0x538ee0,null))['catch'](handleError(_0x538ee0,null));};exports[_0xeab2('0x24')]=function(_0x38c4d5,_0x55e5d6){return db[_0xeab2('0x2a')]['find']({'where':{'id':_0x38c4d5[_0xeab2('0x43')]['id']}})[_0xeab2('0x23')](handleEntityNotFound(_0x55e5d6,null))[_0xeab2('0x23')](removeEntity(_0x55e5d6,null))['catch'](handleError(_0x55e5d6,null));};exports['bulkDestroy']=function(_0x227d78,_0x424a02){return db['AnalyticFieldReport'][_0xeab2('0x24')]({'where':{'id':_0x227d78[_0xeab2('0x2c')][_0xeab2('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xeab2('0x23')](respondWithResult(_0x424a02,0xcc))[_0xeab2('0x41')](handleError(_0x424a02,null));};exports[_0xeab2('0x4a')]=function(_0x924872,_0x2cb9a8,_0x2dc3f1){return db[_0xeab2('0x4b')]['findOne']({'where':{'id':_0x924872[_0xeab2('0x43')]['id']}})[_0xeab2('0x23')](handleEntityNotFound(_0x2cb9a8,null))[_0xeab2('0x23')](function(_0xbf27a1){if(_0xbf27a1){return db['sequelize'][_0xeab2('0x4c')](function(_0x174012){return db[_0xeab2('0x2a')][_0xeab2('0x24')]({'where':{'CustomReportId':_0x924872[_0xeab2('0x43')]['id']},'transaction':_0x174012})[_0xeab2('0x23')](function(_0x2de46e){var _0xafc502=_[_0xeab2('0x29')](_0x924872[_0xeab2('0x47')],function(_0x2fe621){delete _0x2fe621['id'];_0x2fe621[_0xeab2('0x4d')]=_0x924872[_0xeab2('0x43')]['id'];return _0x2fe621;});return db['AnalyticFieldReport'][_0xeab2('0x48')](_0xafc502,{'transaction':_0x174012});});})[_0xeab2('0x23')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x924872[_0xeab2('0x43')]['id']}});});}})['then'](respondWithResult(_0x2cb9a8,null))[_0xeab2('0x41')](handleError(_0x2cb9a8,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7b8e2d6..d877424 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 _0x3769=['request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird'];(function(_0x46dd47,_0x65486f){var _0x294b9f=function(_0x118944){while(--_0x118944){_0x46dd47['push'](_0x46dd47['shift']());}};_0x294b9f(++_0x65486f);}(_0x3769,0x1bb));var _0x9376=function(_0x5c7cd4,_0x251f11){_0x5c7cd4=_0x5c7cd4-0x0;var _0x279853=_0x3769[_0x5c7cd4];return _0x279853;};'use strict';var _=require(_0x9376('0x0'));var util=require(_0x9376('0x1'));var logger=require(_0x9376('0x2'))(_0x9376('0x3'));var moment=require('moment');var BPromise=require(_0x9376('0x4'));var rp=require(_0x9376('0x5'));var fs=require('fs');var path=require(_0x9376('0x6'));var rimraf=require(_0x9376('0x7'));var config=require(_0x9376('0x8'));var attributes=require(_0x9376('0x9'));module[_0x9376('0xa')]=function(_0x53e9ce,_0x540dfd){return _0x53e9ce[_0x9376('0xb')](_0x9376('0xc'),attributes,{'tableName':_0x9376('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0838=['../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x5399bb,_0x211c58){var _0x425d64=function(_0x1ba20c){while(--_0x1ba20c){_0x5399bb['push'](_0x5399bb['shift']());}};_0x425d64(++_0x211c58);}(_0x0838,0x10d));var _0x8083=function(_0x540d69,_0x3f03f4){_0x540d69=_0x540d69-0x0;var _0x3057db=_0x0838[_0x540d69];return _0x3057db;};'use strict';var _=require(_0x8083('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8083('0x1'));var moment=require('moment');var BPromise=require(_0x8083('0x2'));var rp=require(_0x8083('0x3'));var fs=require('fs');var path=require(_0x8083('0x4'));var rimraf=require(_0x8083('0x5'));var config=require(_0x8083('0x6'));var attributes=require(_0x8083('0x7'));module[_0x8083('0x8')]=function(_0xb8bf16,_0x53fcda){return _0xb8bf16[_0x8083('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x8083('0xa'),'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 70e9886..8716d1c 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 _0xd89b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xd89b,0x73));var _0xbd89=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xd89b[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0xbd89('0x0'));var util=require(_0xbd89('0x1'));var moment=require('moment');var BPromise=require(_0xbd89('0x2'));var rs=require(_0xbd89('0x3'));var fs=require('fs');var Redis=require(_0xbd89('0x4'));var db=require(_0xbd89('0x5'))['db'];var utils=require(_0xbd89('0x6'));var logger=require(_0xbd89('0x7'))('rpc');var config=require(_0xbd89('0x8'));var jayson=require(_0xbd89('0x9'));var client=jayson[_0xbd89('0xa')][_0xbd89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35af5f,_0x12f3d1,_0x3756cc){return new BPromise(function(_0x41587c,_0x32ba3a){return client[_0xbd89('0xc')](_0x35af5f,_0x3756cc)[_0xbd89('0xd')](function(_0x24cf1c){logger[_0xbd89('0xe')](_0xbd89('0xf'),_0x12f3d1,_0xbd89('0x10'));logger[_0xbd89('0x11')](_0xbd89('0x12'),_0x12f3d1,'request\x20sent',JSON[_0xbd89('0x13')](_0x24cf1c));if(_0x24cf1c[_0xbd89('0x14')]){if(_0x24cf1c[_0xbd89('0x14')][_0xbd89('0x15')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x12f3d1,_0x24cf1c[_0xbd89('0x14')][_0xbd89('0x16')]);return _0x32ba3a(_0x24cf1c['error']['message']);}logger[_0xbd89('0x14')](_0xbd89('0xf'),_0x12f3d1,_0x24cf1c['error']['message']);return _0x41587c(_0x24cf1c[_0xbd89('0x14')][_0xbd89('0x16')]);}else{logger[_0xbd89('0xe')](_0xbd89('0xf'),_0x12f3d1,_0xbd89('0x10'));_0x41587c(_0x24cf1c['result'][_0xbd89('0x16')]);}})[_0xbd89('0x17')](function(_0x5aa928){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x12f3d1,_0x5aa928);_0x32ba3a(_0x5aa928);});});} \ No newline at end of file +var _0x26a0=['result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message'];(function(_0x42d881,_0x3564f6){var _0x5092e7=function(_0x5b07a2){while(--_0x5b07a2){_0x42d881['push'](_0x42d881['shift']());}};_0x5092e7(++_0x3564f6);}(_0x26a0,0x85));var _0x026a=function(_0x539d5d,_0x2cd5d3){_0x539d5d=_0x539d5d-0x0;var _0x227f92=_0x26a0[_0x539d5d];return _0x227f92;};'use strict';var _=require('lodash');var util=require(_0x026a('0x0'));var moment=require(_0x026a('0x1'));var BPromise=require('bluebird');var rs=require(_0x026a('0x2'));var fs=require('fs');var Redis=require(_0x026a('0x3'));var db=require(_0x026a('0x4'))['db'];var utils=require(_0x026a('0x5'));var logger=require(_0x026a('0x6'))(_0x026a('0x7'));var config=require(_0x026a('0x8'));var jayson=require(_0x026a('0x9'));var client=jayson[_0x026a('0xa')][_0x026a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ea7b4,_0x4c11c2,_0x25e97d){return new BPromise(function(_0x1b8d30,_0x1d2aea){return client[_0x026a('0xc')](_0x3ea7b4,_0x25e97d)[_0x026a('0xd')](function(_0x2356b3){logger[_0x026a('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4c11c2,_0x026a('0xf'));logger[_0x026a('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4c11c2,'request\x20sent',JSON[_0x026a('0x11')](_0x2356b3));if(_0x2356b3[_0x026a('0x12')]){if(_0x2356b3[_0x026a('0x12')]['code']===0x1f4){logger[_0x026a('0x12')](_0x026a('0x13'),_0x4c11c2,_0x2356b3[_0x026a('0x12')][_0x026a('0x14')]);return _0x1d2aea(_0x2356b3[_0x026a('0x12')][_0x026a('0x14')]);}logger[_0x026a('0x12')](_0x026a('0x13'),_0x4c11c2,_0x2356b3['error'][_0x026a('0x14')]);return _0x1b8d30(_0x2356b3[_0x026a('0x12')][_0x026a('0x14')]);}else{logger[_0x026a('0xe')](_0x026a('0x13'),_0x4c11c2,'request\x20sent');_0x1b8d30(_0x2356b3[_0x026a('0x15')][_0x026a('0x14')]);}})['catch'](function(_0x2a6584){logger[_0x026a('0x12')](_0x026a('0x13'),_0x4c11c2,_0x2a6584);_0x1d2aea(_0x2a6584);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 59e7361..232b596 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(_0x5b0240,_0x1ca651){var _0xc1be8b=function(_0x1e934d){while(--_0x1e934d){_0x5b0240['push'](_0x5b0240['shift']());}};_0xc1be8b(++_0x1ca651);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x349a3d,_0x12c2a3){var _0x211a04=function(_0x1edaea){while(--_0x1edaea){_0x349a3d['push'](_0x349a3d['shift']());}};_0x211a04(++_0x12c2a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 c09d23f..8473fcd 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 _0xb09d=['name','TEXT','sequelize','exports','STRING'];(function(_0x144399,_0x58bb10){var _0x21567b=function(_0x4414ed){while(--_0x4414ed){_0x144399['push'](_0x144399['shift']());}};_0x21567b(++_0x58bb10);}(_0xb09d,0xed));var _0xdb09=function(_0x35f254,_0x53f62f){_0x35f254=_0x35f254-0x0;var _0x97ac33=_0xb09d[_0x35f254];return _0x97ac33;};'use strict';var Sequelize=require(_0xdb09('0x0'));module[_0xdb09('0x1')]={'name':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'unique':_0xdb09('0x3')},'table':{'type':Sequelize[_0xdb09('0x2')]},'metric':{'type':Sequelize[_0xdb09('0x4')]},'description':{'type':Sequelize[_0xdb09('0x2')]}}; \ No newline at end of file +var _0xa478=['sequelize','exports','STRING','name','TEXT'];(function(_0x3844ab,_0x461e40){var _0x2a3276=function(_0x1d1176){while(--_0x1d1176){_0x3844ab['push'](_0x3844ab['shift']());}};_0x2a3276(++_0x461e40);}(_0xa478,0x136));var _0x8a47=function(_0x155413,_0x1c89b4){_0x155413=_0x155413-0x0;var _0x434c71=_0xa478[_0x155413];return _0x434c71;};'use strict';var Sequelize=require(_0x8a47('0x0'));module[_0x8a47('0x1')]={'name':{'type':Sequelize[_0x8a47('0x2')],'allowNull':![],'unique':_0x8a47('0x3')},'table':{'type':Sequelize[_0x8a47('0x2')]},'metric':{'type':Sequelize[_0x8a47('0x4')]},'description':{'type':Sequelize[_0x8a47('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4774c0b..a99b5d7 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 _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xfc53fc,_0x4204d6){var _0x423828=function(_0x44e877){while(--_0x44e877){_0xfc53fc['push'](_0xfc53fc['shift']());}};_0x423828(++_0x4204d6);}(_0x008c,0x188));var _0xc008=function(_0x17749b,_0x4b4e3e){_0x17749b=_0x17749b-0x0;var _0x37ad41=_0x008c[_0x17749b];return _0x37ad41;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x513bbe,_0x28fffa){var _0x34ae9e=function(_0x1bf9f0){while(--_0x1bf9f0){_0x513bbe['push'](_0x513bbe['shift']());}};_0x34ae9e(++_0x28fffa);}(_0x3e74,0x175));var _0x43e7=function(_0x288503,_0x70285){_0x288503=_0x288503-0x0;var _0x59161b=_0x3e74[_0x288503];return _0x59161b;};'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(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7829670..fd24e9b 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 _0xfc65=['AnalyticMetric','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x404576,_0x256c23){var _0x55d370=function(_0x53c643){while(--_0x53c643){_0x404576['push'](_0x404576['shift']());}};_0x55d370(++_0x256c23);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x6fdbb1,_0x221ef4){_0x6fdbb1=_0x6fdbb1-0x0;var _0x37689d=_0xfc65[_0x6fdbb1];return _0x37689d;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5fc6('0x1'));var moment=require(_0x5fc6('0x2'));var BPromise=require(_0x5fc6('0x3'));var rp=require(_0x5fc6('0x4'));var fs=require('fs');var path=require(_0x5fc6('0x5'));var rimraf=require(_0x5fc6('0x6'));var config=require(_0x5fc6('0x7'));var attributes=require(_0x5fc6('0x8'));module[_0x5fc6('0x9')]=function(_0x441b3e,_0x3100b4){return _0x441b3e[_0x5fc6('0xa')](_0x5fc6('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3981=['AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x5405e0,_0x5a2772){var _0x117914=function(_0x434d3f){while(--_0x434d3f){_0x5405e0['push'](_0x5405e0['shift']());}};_0x117914(++_0x5a2772);}(_0x3981,0x144));var _0x1398=function(_0x43015c,_0x1cd6a6){_0x43015c=_0x43015c-0x0;var _0x5e4f83=_0x3981[_0x43015c];return _0x5e4f83;};'use strict';var _=require(_0x1398('0x0'));var util=require('util');var logger=require(_0x1398('0x1'))(_0x1398('0x2'));var moment=require(_0x1398('0x3'));var BPromise=require(_0x1398('0x4'));var rp=require(_0x1398('0x5'));var fs=require('fs');var path=require(_0x1398('0x6'));var rimraf=require(_0x1398('0x7'));var config=require(_0x1398('0x8'));var attributes=require(_0x1398('0x9'));module[_0x1398('0xa')]=function(_0x199a50,_0x5c5fe0){return _0x199a50[_0x1398('0xb')](_0x1398('0xc'),attributes,{'tableName':_0x1398('0xd'),'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 e430560..dd140f8 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 _0xf3e4=['request\x20sent','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xf3e4,0x128));var _0x4f3e=function(_0x359054,_0x440d6b){_0x359054=_0x359054-0x0;var _0x10793e=_0xf3e4[_0x359054];return _0x10793e;};'use strict';var _=require('lodash');var util=require(_0x4f3e('0x0'));var moment=require('moment');var BPromise=require(_0x4f3e('0x1'));var rs=require(_0x4f3e('0x2'));var fs=require('fs');var Redis=require(_0x4f3e('0x3'));var db=require(_0x4f3e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f3e('0x5'))(_0x4f3e('0x6'));var config=require(_0x4f3e('0x7'));var jayson=require(_0x4f3e('0x8'));var client=jayson[_0x4f3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491d26,_0x490f40,_0x54ae4){return new BPromise(function(_0x692afa,_0x107658){return client[_0x4f3e('0xa')](_0x491d26,_0x54ae4)[_0x4f3e('0xb')](function(_0x2df3ae){logger['info'](_0x4f3e('0xc'),_0x490f40,'request\x20sent');logger[_0x4f3e('0xd')](_0x4f3e('0xe'),_0x490f40,'request\x20sent',JSON[_0x4f3e('0xf')](_0x2df3ae));if(_0x2df3ae[_0x4f3e('0x10')]){if(_0x2df3ae[_0x4f3e('0x10')][_0x4f3e('0x11')]===0x1f4){logger[_0x4f3e('0x10')](_0x4f3e('0xc'),_0x490f40,_0x2df3ae['error']['message']);return _0x107658(_0x2df3ae[_0x4f3e('0x10')]['message']);}logger[_0x4f3e('0x10')](_0x4f3e('0xc'),_0x490f40,_0x2df3ae['error'][_0x4f3e('0x12')]);return _0x692afa(_0x2df3ae[_0x4f3e('0x10')][_0x4f3e('0x12')]);}else{logger['info'](_0x4f3e('0xc'),_0x490f40,_0x4f3e('0x13'));_0x692afa(_0x2df3ae['result'][_0x4f3e('0x12')]);}})[_0x4f3e('0x14')](function(_0x5d6fff){logger[_0x4f3e('0x10')](_0x4f3e('0xc'),_0x490f40,_0x5d6fff);_0x107658(_0x5d6fff);});});} \ No newline at end of file +var _0x9296=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error'];(function(_0x276181,_0x59a2c9){var _0x409987=function(_0x3009d0){while(--_0x3009d0){_0x276181['push'](_0x276181['shift']());}};_0x409987(++_0x59a2c9);}(_0x9296,0x168));var _0x6929=function(_0x423e40,_0x381f80){_0x423e40=_0x423e40-0x0;var _0x585d13=_0x9296[_0x423e40];return _0x585d13;};'use strict';var _=require(_0x6929('0x0'));var util=require(_0x6929('0x1'));var moment=require(_0x6929('0x2'));var BPromise=require(_0x6929('0x3'));var rs=require(_0x6929('0x4'));var fs=require('fs');var Redis=require(_0x6929('0x5'));var db=require(_0x6929('0x6'))['db'];var utils=require(_0x6929('0x7'));var logger=require('../../config/logger')(_0x6929('0x8'));var config=require(_0x6929('0x9'));var jayson=require(_0x6929('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae2a0,_0xfa29dc,_0xc74066){return new BPromise(function(_0x48934d,_0x6734df){return client[_0x6929('0xb')](_0x5ae2a0,_0xc74066)[_0x6929('0xc')](function(_0x4ccb5b){logger[_0x6929('0xd')](_0x6929('0xe'),_0xfa29dc,_0x6929('0xf'));logger['debug'](_0x6929('0x10'),_0xfa29dc,_0x6929('0xf'),JSON['stringify'](_0x4ccb5b));if(_0x4ccb5b['error']){if(_0x4ccb5b[_0x6929('0x11')]['code']===0x1f4){logger[_0x6929('0x11')](_0x6929('0xe'),_0xfa29dc,_0x4ccb5b['error'][_0x6929('0x12')]);return _0x6734df(_0x4ccb5b[_0x6929('0x11')]['message']);}logger[_0x6929('0x11')](_0x6929('0xe'),_0xfa29dc,_0x4ccb5b['error']['message']);return _0x48934d(_0x4ccb5b[_0x6929('0x11')][_0x6929('0x12')]);}else{logger[_0x6929('0xd')](_0x6929('0xe'),_0xfa29dc,_0x6929('0xf'));_0x48934d(_0x4ccb5b[_0x6929('0x13')][_0x6929('0x12')]);}})[_0x6929('0x14')](function(_0xfd9ee8){logger['error'](_0x6929('0xe'),_0xfa29dc,_0xfd9ee8);_0x6734df(_0xfd9ee8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7109031..18073b8 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 _0x0e76=['create','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x20cdca,_0x1c99ec){var _0x5ab50b=function(_0xbf1d7c){while(--_0xbf1d7c){_0x20cdca['push'](_0x20cdca['shift']());}};_0x5ab50b(++_0x1c99ec);}(_0x0e76,0xc4));var _0x60e7=function(_0x11fb47,_0x50fbf8){_0x11fb47=_0x11fb47-0x0;var _0xa0d270=_0x0e76[_0x11fb47];return _0xa0d270;};'use strict';var multer=require(_0x60e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x60e7('0x1'));var express=require('express');var router=express[_0x60e7('0x2')]();var fs_extra=require(_0x60e7('0x3'));var auth=require(_0x60e7('0x4'));var interaction=require(_0x60e7('0x5'));var config=require(_0x60e7('0x6'));var controller=require('./analyticMetric.controller');router[_0x60e7('0x7')]('/',auth[_0x60e7('0x8')](),controller[_0x60e7('0x9')]);router[_0x60e7('0x7')](_0x60e7('0xa'),auth[_0x60e7('0x8')](),controller['show']);router[_0x60e7('0xb')]('/',auth[_0x60e7('0x8')](),controller[_0x60e7('0xc')]);router['put'](_0x60e7('0xa'),auth['isAuthenticated'](),controller[_0x60e7('0xd')]);router[_0x60e7('0xe')]('/:id',auth[_0x60e7('0x8')](),controller['destroy']);module[_0x60e7('0xf')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x25c39b,_0x1dcaf3){var _0x1faa56=function(_0x460ec2){while(--_0x460ec2){_0x25c39b['push'](_0x25c39b['shift']());}};_0x1faa56(++_0x1dcaf3);}(_0x7217,0x19e));var _0x7721=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x7217[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index eb5e8d3..a465d27 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 _0xd764=['sequelize','exports','TEXT'];(function(_0x4a5be1,_0x1390f1){var _0x36d239=function(_0x4b35c2){while(--_0x4b35c2){_0x4a5be1['push'](_0x4a5be1['shift']());}};_0x36d239(++_0x1390f1);}(_0xd764,0x17d));var _0x4d76=function(_0x209345,_0xc32595){_0x209345=_0x209345-0x0;var _0x113297=_0xd764[_0x209345];return _0x113297;};'use strict';var Sequelize=require(_0x4d76('0x0'));module[_0x4d76('0x1')]={'tree':{'type':Sequelize[_0x4d76('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6f65=['exports','TEXT','sequelize'];(function(_0x2ea2f2,_0x763438){var _0x2b71de=function(_0x19682c){while(--_0x19682c){_0x2ea2f2['push'](_0x2ea2f2['shift']());}};_0x2b71de(++_0x763438);}(_0x6f65,0xec));var _0x56f6=function(_0x5c7bb4,_0xc8dccf){_0x5c7bb4=_0x5c7bb4-0x0;var _0x3394f0=_0x6f65[_0x5c7bb4];return _0x3394f0;};'use strict';var Sequelize=require(_0x56f6('0x0'));module[_0x56f6('0x1')]={'tree':{'type':Sequelize[_0x56f6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 98c36b2..4c510da 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 _0xc234=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','sort','where','pick'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc234,0x1c6));var _0x4c23=function(_0x2fa113,_0x2d2314){_0x2fa113=_0x2fa113-0x0;var _0xa5846=_0xc234[_0x2fa113];return _0xa5846;};'use strict';var emlformat=require(_0x4c23('0x0'));var rimraf=require(_0x4c23('0x1'));var zipdir=require(_0x4c23('0x2'));var jsonpatch=require(_0x4c23('0x3'));var rp=require(_0x4c23('0x4'));var moment=require(_0x4c23('0x5'));var BPromise=require(_0x4c23('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c23('0x7'));var sox=require(_0x4c23('0x8'));var csv=require(_0x4c23('0x9'));var ejs=require(_0x4c23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c23('0xb'));var squel=require(_0x4c23('0xc'));var crypto=require('crypto');var jsforce=require(_0x4c23('0xd'));var deskjs=require(_0x4c23('0xe'));var toCsv=require(_0x4c23('0x9'));var querystring=require(_0x4c23('0xf'));var Papa=require(_0x4c23('0x10'));var Redis=require(_0x4c23('0x11'));var authService=require(_0x4c23('0x12'));var qs=require(_0x4c23('0x13'));var as=require(_0x4c23('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c23('0x15'))(_0x4c23('0x16'));var utils=require(_0x4c23('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4c23('0x18'))['db'];function respondWithStatusCode(_0x4d5461,_0x38fa4a){_0x38fa4a=_0x38fa4a||0xcc;return function(_0x43a5c1){if(_0x43a5c1){return _0x4d5461['sendStatus'](_0x38fa4a);}return _0x4d5461[_0x4c23('0x19')](_0x38fa4a)[_0x4c23('0x1a')]();};}function respondWithResult(_0x25f962,_0x5905de){_0x5905de=_0x5905de||0xc8;return function(_0x407d29){if(_0x407d29){return _0x25f962[_0x4c23('0x19')](_0x5905de)[_0x4c23('0x1b')](_0x407d29);}};}function respondWithFilteredResult(_0x51a988,_0x4d5193){return function(_0x58c0e4){if(_0x58c0e4){var _0x45c6e1=typeof _0x4d5193[_0x4c23('0x1c')]===_0x4c23('0x1d')&&typeof _0x4d5193[_0x4c23('0x1e')]===_0x4c23('0x1d');var _0x4e0c7b=_0x58c0e4['count'];var _0x296ccd=_0x45c6e1?0x0:_0x4d5193[_0x4c23('0x1c')];var _0x4449fe=_0x45c6e1?_0x58c0e4[_0x4c23('0x1f')]:_0x4d5193[_0x4c23('0x1c')]+_0x4d5193[_0x4c23('0x1e')];var _0x393534;if(_0x4449fe>=_0x4e0c7b){_0x4449fe=_0x4e0c7b;_0x393534=0xc8;}else{_0x393534=0xce;}_0x51a988[_0x4c23('0x19')](_0x393534);return _0x51a988['set'](_0x4c23('0x20'),_0x296ccd+'-'+_0x4449fe+'/'+_0x4e0c7b)[_0x4c23('0x1b')](_0x58c0e4);}return null;};}function patchUpdates(_0x3be6d0){return function(_0x341f83){try{jsonpatch[_0x4c23('0x21')](_0x341f83,_0x3be6d0,!![]);}catch(_0x34c7ba){return BPromise['reject'](_0x34c7ba);}return _0x341f83[_0x4c23('0x22')]();};}function saveUpdates(_0x48db08,_0x1bad45){return function(_0xda55a0){if(_0xda55a0){return _0xda55a0['update'](_0x48db08)[_0x4c23('0x23')](function(_0x410e57){return _0x410e57;});}return null;};}function removeEntity(_0x544c42,_0x112128){return function(_0x3a0e44){if(_0x3a0e44){return _0x3a0e44[_0x4c23('0x24')]()[_0x4c23('0x23')](function(){_0x544c42['status'](0xcc)[_0x4c23('0x1a')]();});}};}function handleEntityNotFound(_0x1c707e,_0x372971){return function(_0x4925e3){if(!_0x4925e3){_0x1c707e[_0x4c23('0x25')](0x194);}return _0x4925e3;};}function handleError(_0x5476d0,_0x460041){_0x460041=_0x460041||0x1f4;return function(_0x1d6a40){logger[_0x4c23('0x26')](_0x1d6a40[_0x4c23('0x27')]);if(_0x1d6a40[_0x4c23('0x28')]){delete _0x1d6a40['name'];}_0x5476d0[_0x4c23('0x19')](_0x460041)[_0x4c23('0x29')](_0x1d6a40);};}exports[_0x4c23('0x2a')]=function(_0x29b1a6,_0x36c6d7){var _0x2a278c={},_0x416b18={},_0x5412fc={'count':0x0,'rows':[]};var _0x3e8098=_['map'](db[_0x4c23('0x2b')][_0x4c23('0x2c')],function(_0x40736c){return{'name':_0x40736c['fieldName'],'type':_0x40736c['type'][_0x4c23('0x2d')]};});_0x416b18[_0x4c23('0x2e')]=_[_0x4c23('0x2f')](_0x3e8098,'name');_0x416b18[_0x4c23('0x30')]=_[_0x4c23('0x31')](_0x29b1a6[_0x4c23('0x30')]);_0x416b18[_0x4c23('0x32')]=_[_0x4c23('0x33')](_0x416b18[_0x4c23('0x2e')],_0x416b18[_0x4c23('0x30')]);_0x2a278c[_0x4c23('0x34')]=_[_0x4c23('0x33')](_0x416b18[_0x4c23('0x2e')],qs[_0x4c23('0x35')](_0x29b1a6[_0x4c23('0x30')][_0x4c23('0x35')]));_0x2a278c[_0x4c23('0x34')]=_0x2a278c[_0x4c23('0x34')]['length']?_0x2a278c['attributes']:_0x416b18[_0x4c23('0x2e')];if(!_0x29b1a6[_0x4c23('0x30')]['hasOwnProperty']('nolimit')){_0x2a278c[_0x4c23('0x1e')]=qs['limit'](_0x29b1a6[_0x4c23('0x30')][_0x4c23('0x1e')]);_0x2a278c[_0x4c23('0x1c')]=qs[_0x4c23('0x1c')](_0x29b1a6[_0x4c23('0x30')][_0x4c23('0x1c')]);}_0x2a278c['order']=qs['sort'](_0x29b1a6['query'][_0x4c23('0x36')]);_0x2a278c[_0x4c23('0x37')]=qs[_0x4c23('0x32')](_[_0x4c23('0x38')](_0x29b1a6['query'],_0x416b18[_0x4c23('0x32')]),_0x3e8098);if(_0x29b1a6['query'][_0x4c23('0x39')]){_0x2a278c[_0x4c23('0x37')]=_[_0x4c23('0x3a')](_0x2a278c[_0x4c23('0x37')],{'$or':_['map'](_0x3e8098,function(_0x1248e1){if(_0x1248e1['type']!==_0x4c23('0x3b')){var _0x5c94da={};_0x5c94da[_0x1248e1[_0x4c23('0x28')]]={'$like':'%'+_0x29b1a6[_0x4c23('0x30')]['filter']+'%'};return _0x5c94da;}})});}_0x2a278c=_['merge']({},_0x2a278c,_0x29b1a6[_0x4c23('0x3c')]);var _0x1ffc81={'where':_0x2a278c[_0x4c23('0x37')]};return db[_0x4c23('0x2b')][_0x4c23('0x1f')](_0x1ffc81)['then'](function(_0x21e762){_0x5412fc[_0x4c23('0x1f')]=_0x21e762;if(_0x29b1a6[_0x4c23('0x30')][_0x4c23('0x3d')]){_0x2a278c['include']=[{'all':!![]}];}return db[_0x4c23('0x2b')][_0x4c23('0x3e')](_0x2a278c);})['then'](function(_0x104917){_0x5412fc[_0x4c23('0x3f')]=_0x104917;return _0x5412fc;})[_0x4c23('0x23')](respondWithFilteredResult(_0x36c6d7,_0x2a278c))['catch'](handleError(_0x36c6d7,null));};exports[_0x4c23('0x40')]=function(_0x329a73,_0x3324e1){var _0x5cc775={'raw':!![],'where':{'id':_0x329a73[_0x4c23('0x41')]['id']}},_0x1e9d44={};_0x1e9d44[_0x4c23('0x2e')]=_[_0x4c23('0x31')](db['AnalyticTreeReport'][_0x4c23('0x2c')]);_0x1e9d44['query']=_[_0x4c23('0x31')](_0x329a73['query']);_0x1e9d44[_0x4c23('0x32')]=_['intersection'](_0x1e9d44[_0x4c23('0x2e')],_0x1e9d44[_0x4c23('0x30')]);_0x5cc775[_0x4c23('0x34')]=_[_0x4c23('0x33')](_0x1e9d44[_0x4c23('0x2e')],qs[_0x4c23('0x35')](_0x329a73[_0x4c23('0x30')][_0x4c23('0x35')]));_0x5cc775[_0x4c23('0x34')]=_0x5cc775[_0x4c23('0x34')][_0x4c23('0x42')]?_0x5cc775['attributes']:_0x1e9d44['model'];if(_0x329a73['query'][_0x4c23('0x3d')]){_0x5cc775[_0x4c23('0x43')]=[{'all':!![]}];}_0x5cc775=_[_0x4c23('0x3a')]({},_0x5cc775,_0x329a73[_0x4c23('0x3c')]);return db[_0x4c23('0x2b')]['find'](_0x5cc775)[_0x4c23('0x23')](handleEntityNotFound(_0x3324e1,null))[_0x4c23('0x23')](respondWithResult(_0x3324e1,null))[_0x4c23('0x44')](handleError(_0x3324e1,null));};exports[_0x4c23('0x45')]=function(_0x3a1a1d,_0xbd7eae){return db[_0x4c23('0x2b')][_0x4c23('0x45')](_0x3a1a1d[_0x4c23('0x46')],{})[_0x4c23('0x23')](respondWithResult(_0xbd7eae,0xc9))['catch'](handleError(_0xbd7eae,null));};exports[_0x4c23('0x47')]=function(_0x1f07a1,_0x4fc7e2){if(_0x1f07a1[_0x4c23('0x46')]['id']){delete _0x1f07a1[_0x4c23('0x46')]['id'];}return db[_0x4c23('0x2b')][_0x4c23('0x48')]({'where':{'id':_0x1f07a1['params']['id']}})[_0x4c23('0x23')](handleEntityNotFound(_0x4fc7e2,null))[_0x4c23('0x23')](saveUpdates(_0x1f07a1[_0x4c23('0x46')],null))[_0x4c23('0x23')](respondWithResult(_0x4fc7e2,null))['catch'](handleError(_0x4fc7e2,null));};exports[_0x4c23('0x24')]=function(_0x2c1bdf,_0x5bbe33){return db[_0x4c23('0x2b')]['find']({'where':{'id':_0x2c1bdf['params']['id']}})[_0x4c23('0x23')](handleEntityNotFound(_0x5bbe33,null))[_0x4c23('0x23')](removeEntity(_0x5bbe33,null))[_0x4c23('0x44')](handleError(_0x5bbe33,null));}; \ No newline at end of file +var _0xbe39=['end','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','order','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0xbe39,0xfd));var _0x9be3=function(_0x12b002,_0x43b9a7){_0x12b002=_0x12b002-0x0;var _0x4acf7d=_0xbe39[_0x12b002];return _0x4acf7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9be3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9be3('0x1'));var moment=require(_0x9be3('0x2'));var BPromise=require(_0x9be3('0x3'));var Mustache=require(_0x9be3('0x4'));var util=require('util');var path=require(_0x9be3('0x5'));var sox=require(_0x9be3('0x6'));var csv=require(_0x9be3('0x7'));var ejs=require(_0x9be3('0x8'));var fs=require('fs');var fs_extra=require(_0x9be3('0x9'));var _=require(_0x9be3('0xa'));var squel=require(_0x9be3('0xb'));var crypto=require(_0x9be3('0xc'));var jsforce=require(_0x9be3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9be3('0x7'));var querystring=require(_0x9be3('0xe'));var Papa=require(_0x9be3('0xf'));var Redis=require(_0x9be3('0x10'));var authService=require(_0x9be3('0x11'));var qs=require(_0x9be3('0x12'));var as=require(_0x9be3('0x13'));var hardwareService=require(_0x9be3('0x14'));var logger=require(_0x9be3('0x15'))('api');var utils=require(_0x9be3('0x16'));var config=require(_0x9be3('0x17'));var licenseUtil=require(_0x9be3('0x18'));var db=require(_0x9be3('0x19'))['db'];function respondWithStatusCode(_0x42bac8,_0xe88a14){_0xe88a14=_0xe88a14||0xcc;return function(_0x1f09a9){if(_0x1f09a9){return _0x42bac8[_0x9be3('0x1a')](_0xe88a14);}return _0x42bac8[_0x9be3('0x1b')](_0xe88a14)['end']();};}function respondWithResult(_0x25a3f1,_0x1b5b62){_0x1b5b62=_0x1b5b62||0xc8;return function(_0x492882){if(_0x492882){return _0x25a3f1[_0x9be3('0x1b')](_0x1b5b62)[_0x9be3('0x1c')](_0x492882);}};}function respondWithFilteredResult(_0x1c5b1a,_0x30280a){return function(_0x7fe669){if(_0x7fe669){var _0x9285b2=typeof _0x30280a[_0x9be3('0x1d')]==='undefined'&&typeof _0x30280a[_0x9be3('0x1e')]===_0x9be3('0x1f');var _0x5dc513=_0x7fe669['count'];var _0x2f7aa5=_0x9285b2?0x0:_0x30280a[_0x9be3('0x1d')];var _0x1883f1=_0x9285b2?_0x7fe669[_0x9be3('0x20')]:_0x30280a[_0x9be3('0x1d')]+_0x30280a[_0x9be3('0x1e')];var _0x5ef112;if(_0x1883f1>=_0x5dc513){_0x1883f1=_0x5dc513;_0x5ef112=0xc8;}else{_0x5ef112=0xce;}_0x1c5b1a[_0x9be3('0x1b')](_0x5ef112);return _0x1c5b1a[_0x9be3('0x21')](_0x9be3('0x22'),_0x2f7aa5+'-'+_0x1883f1+'/'+_0x5dc513)[_0x9be3('0x1c')](_0x7fe669);}return null;};}function patchUpdates(_0xa8fc33){return function(_0xc79fe4){try{jsonpatch[_0x9be3('0x23')](_0xc79fe4,_0xa8fc33,!![]);}catch(_0x5ea96f){return BPromise['reject'](_0x5ea96f);}return _0xc79fe4[_0x9be3('0x24')]();};}function saveUpdates(_0x2a83b9,_0x586180){return function(_0x29a2a2){if(_0x29a2a2){return _0x29a2a2['update'](_0x2a83b9)[_0x9be3('0x25')](function(_0x595ab5){return _0x595ab5;});}return null;};}function removeEntity(_0x5a5970,_0x42a955){return function(_0x1dbc06){if(_0x1dbc06){return _0x1dbc06[_0x9be3('0x26')]()[_0x9be3('0x25')](function(){_0x5a5970['status'](0xcc)[_0x9be3('0x27')]();});}};}function handleEntityNotFound(_0x145c77,_0x581790){return function(_0x547fed){if(!_0x547fed){_0x145c77[_0x9be3('0x1a')](0x194);}return _0x547fed;};}function handleError(_0x793697,_0x28e0fe){_0x28e0fe=_0x28e0fe||0x1f4;return function(_0x3b63dc){logger[_0x9be3('0x28')](_0x3b63dc['stack']);if(_0x3b63dc['name']){delete _0x3b63dc[_0x9be3('0x29')];}_0x793697[_0x9be3('0x1b')](_0x28e0fe)[_0x9be3('0x2a')](_0x3b63dc);};}exports[_0x9be3('0x2b')]=function(_0x8d1a6a,_0x562b8e){var _0x597dc2={},_0x28962d={},_0x44b9b3={'count':0x0,'rows':[]};var _0x5553a8=_[_0x9be3('0x2c')](db[_0x9be3('0x2d')][_0x9be3('0x2e')],function(_0x48e990){return{'name':_0x48e990[_0x9be3('0x2f')],'type':_0x48e990[_0x9be3('0x30')]['key']};});_0x28962d[_0x9be3('0x31')]=_['map'](_0x5553a8,_0x9be3('0x29'));_0x28962d[_0x9be3('0x32')]=_[_0x9be3('0x33')](_0x8d1a6a[_0x9be3('0x32')]);_0x28962d[_0x9be3('0x34')]=_['intersection'](_0x28962d['model'],_0x28962d['query']);_0x597dc2[_0x9be3('0x35')]=_[_0x9be3('0x36')](_0x28962d[_0x9be3('0x31')],qs[_0x9be3('0x37')](_0x8d1a6a[_0x9be3('0x32')]['fields']));_0x597dc2[_0x9be3('0x35')]=_0x597dc2[_0x9be3('0x35')]['length']?_0x597dc2[_0x9be3('0x35')]:_0x28962d[_0x9be3('0x31')];if(!_0x8d1a6a['query']['hasOwnProperty']('nolimit')){_0x597dc2[_0x9be3('0x1e')]=qs[_0x9be3('0x1e')](_0x8d1a6a['query'][_0x9be3('0x1e')]);_0x597dc2[_0x9be3('0x1d')]=qs[_0x9be3('0x1d')](_0x8d1a6a['query'][_0x9be3('0x1d')]);}_0x597dc2[_0x9be3('0x38')]=qs['sort'](_0x8d1a6a['query']['sort']);_0x597dc2[_0x9be3('0x39')]=qs[_0x9be3('0x34')](_[_0x9be3('0x3a')](_0x8d1a6a[_0x9be3('0x32')],_0x28962d[_0x9be3('0x34')]),_0x5553a8);if(_0x8d1a6a[_0x9be3('0x32')]['filter']){_0x597dc2[_0x9be3('0x39')]=_['merge'](_0x597dc2['where'],{'$or':_['map'](_0x5553a8,function(_0x4eb205){if(_0x4eb205['type']!==_0x9be3('0x3b')){var _0xceecb9={};_0xceecb9[_0x4eb205[_0x9be3('0x29')]]={'$like':'%'+_0x8d1a6a[_0x9be3('0x32')]['filter']+'%'};return _0xceecb9;}})});}_0x597dc2=_[_0x9be3('0x3c')]({},_0x597dc2,_0x8d1a6a[_0x9be3('0x3d')]);var _0x326d26={'where':_0x597dc2['where']};return db[_0x9be3('0x2d')][_0x9be3('0x20')](_0x326d26)['then'](function(_0x310880){_0x44b9b3[_0x9be3('0x20')]=_0x310880;if(_0x8d1a6a[_0x9be3('0x32')][_0x9be3('0x3e')]){_0x597dc2[_0x9be3('0x3f')]=[{'all':!![]}];}return db[_0x9be3('0x2d')][_0x9be3('0x40')](_0x597dc2);})['then'](function(_0x3f235b){_0x44b9b3[_0x9be3('0x41')]=_0x3f235b;return _0x44b9b3;})['then'](respondWithFilteredResult(_0x562b8e,_0x597dc2))[_0x9be3('0x42')](handleError(_0x562b8e,null));};exports[_0x9be3('0x43')]=function(_0x47f5af,_0x4ca572){var _0x4d3854={'raw':!![],'where':{'id':_0x47f5af[_0x9be3('0x44')]['id']}},_0x5251cc={};_0x5251cc['model']=_['keys'](db[_0x9be3('0x2d')][_0x9be3('0x2e')]);_0x5251cc[_0x9be3('0x32')]=_[_0x9be3('0x33')](_0x47f5af[_0x9be3('0x32')]);_0x5251cc[_0x9be3('0x34')]=_[_0x9be3('0x36')](_0x5251cc[_0x9be3('0x31')],_0x5251cc['query']);_0x4d3854['attributes']=_[_0x9be3('0x36')](_0x5251cc[_0x9be3('0x31')],qs[_0x9be3('0x37')](_0x47f5af['query']['fields']));_0x4d3854[_0x9be3('0x35')]=_0x4d3854[_0x9be3('0x35')][_0x9be3('0x45')]?_0x4d3854[_0x9be3('0x35')]:_0x5251cc[_0x9be3('0x31')];if(_0x47f5af[_0x9be3('0x32')][_0x9be3('0x3e')]){_0x4d3854[_0x9be3('0x3f')]=[{'all':!![]}];}_0x4d3854=_['merge']({},_0x4d3854,_0x47f5af[_0x9be3('0x3d')]);return db[_0x9be3('0x2d')][_0x9be3('0x46')](_0x4d3854)[_0x9be3('0x25')](handleEntityNotFound(_0x4ca572,null))[_0x9be3('0x25')](respondWithResult(_0x4ca572,null))[_0x9be3('0x42')](handleError(_0x4ca572,null));};exports[_0x9be3('0x47')]=function(_0x294476,_0x332a97){return db[_0x9be3('0x2d')][_0x9be3('0x47')](_0x294476['body'],{})[_0x9be3('0x25')](respondWithResult(_0x332a97,0xc9))[_0x9be3('0x42')](handleError(_0x332a97,null));};exports['update']=function(_0x106a39,_0x9b0dd4){if(_0x106a39[_0x9be3('0x48')]['id']){delete _0x106a39[_0x9be3('0x48')]['id'];}return db['AnalyticTreeReport'][_0x9be3('0x46')]({'where':{'id':_0x106a39[_0x9be3('0x44')]['id']}})[_0x9be3('0x25')](handleEntityNotFound(_0x9b0dd4,null))[_0x9be3('0x25')](saveUpdates(_0x106a39[_0x9be3('0x48')],null))[_0x9be3('0x25')](respondWithResult(_0x9b0dd4,null))[_0x9be3('0x42')](handleError(_0x9b0dd4,null));};exports['destroy']=function(_0x5bc12c,_0x33c56e){return db['AnalyticTreeReport'][_0x9be3('0x46')]({'where':{'id':_0x5bc12c[_0x9be3('0x44')]['id']}})[_0x9be3('0x25')](handleEntityNotFound(_0x33c56e,null))['then'](removeEntity(_0x33c56e,null))[_0x9be3('0x42')](handleError(_0x33c56e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 092bcb6..e3cb5ea 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 _0xe894=['define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x204b5d,_0x16fda1){var _0x862835=function(_0x6dfaa8){while(--_0x6dfaa8){_0x204b5d['push'](_0x204b5d['shift']());}};_0x862835(++_0x16fda1);}(_0xe894,0xcf));var _0x4e89=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0xe894[_0x221ba2];return _0x47d08e;};'use strict';var _=require('lodash');var util=require(_0x4e89('0x0'));var logger=require(_0x4e89('0x1'))(_0x4e89('0x2'));var moment=require(_0x4e89('0x3'));var BPromise=require(_0x4e89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4e89('0x5'));var config=require(_0x4e89('0x6'));var attributes=require(_0x4e89('0x7'));module[_0x4e89('0x8')]=function(_0x432816,_0x4eba77){return _0x432816[_0x4e89('0x9')](_0x4e89('0xa'),attributes,{'tableName':_0x4e89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5af5=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./analyticTreeReport.attributes','analytics_report_trees','lodash'];(function(_0x27a5bb,_0x3f4cfb){var _0x2e17ea=function(_0x22912d){while(--_0x22912d){_0x27a5bb['push'](_0x27a5bb['shift']());}};_0x2e17ea(++_0x3f4cfb);}(_0x5af5,0x7f));var _0x55af=function(_0x2ea515,_0x1aaec2){_0x2ea515=_0x2ea515-0x0;var _0xf25b2=_0x5af5[_0x2ea515];return _0xf25b2;};'use strict';var _=require(_0x55af('0x0'));var util=require('util');var logger=require(_0x55af('0x1'))('api');var moment=require(_0x55af('0x2'));var BPromise=require(_0x55af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55af('0x4'));var config=require(_0x55af('0x5'));var attributes=require(_0x55af('0x6'));module['exports']=function(_0x54fac7,_0x2314df){return _0x54fac7['define']('AnalyticTreeReport',attributes,{'tableName':_0x55af('0x7'),'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 b6cb9c5..68544df 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x338e21,_0xcd5df4){var _0xabd87d=function(_0x475235){while(--_0x475235){_0x338e21['push'](_0x338e21['shift']());}};_0xabd87d(++_0xcd5df4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _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(_0x1c007c,_0x45d10f){var _0x535276=function(_0x3ba61e){while(--_0x3ba61e){_0x1c007c['push'](_0x1c007c['shift']());}};_0x535276(++_0x45d10f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1558e0,_0x757e2b){_0x1558e0=_0x1558e0-0x0;var _0x37f3c9=_0x5f2f[_0x1558e0];return _0x37f3c9;};'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 ff4694d..21bd40b 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 _0x0f1f=['post','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0f1f,0xc4));var _0xf0f1=function(_0x220d93,_0x129be3){_0x220d93=_0x220d93-0x0;var _0x59e707=_0x0f1f[_0x220d93];return _0x59e707;};'use strict';var multer=require(_0xf0f1('0x0'));var util=require(_0xf0f1('0x1'));var path=require(_0xf0f1('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0f1('0x3'));var router=express[_0xf0f1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf0f1('0x5'));var interaction=require(_0xf0f1('0x6'));var config=require(_0xf0f1('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xf0f1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf0f1('0x9'),auth[_0xf0f1('0xa')](),controller[_0xf0f1('0xb')]);router[_0xf0f1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf0f1('0x9'),auth[_0xf0f1('0xa')](),controller[_0xf0f1('0xd')]);router[_0xf0f1('0xe')](_0xf0f1('0x9'),auth[_0xf0f1('0xa')](),controller['destroy']);module[_0xf0f1('0xf')]=router; \ No newline at end of file +var _0x1a09=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','create','put'];(function(_0x45c19c,_0x5e8b36){var _0x5b1142=function(_0xb485c4){while(--_0xb485c4){_0x45c19c['push'](_0x45c19c['shift']());}};_0x5b1142(++_0x5e8b36);}(_0x1a09,0x1de));var _0x91a0=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x1a09[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x91a0('0x0'));var util=require(_0x91a0('0x1'));var path=require(_0x91a0('0x2'));var timeout=require(_0x91a0('0x3'));var express=require(_0x91a0('0x4'));var router=express[_0x91a0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91a0('0x6'));var interaction=require(_0x91a0('0x7'));var config=require(_0x91a0('0x8'));var controller=require(_0x91a0('0x9'));router[_0x91a0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x91a0('0xb'),auth[_0x91a0('0xc')](),controller[_0x91a0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x91a0('0xe')]);router[_0x91a0('0xf')](_0x91a0('0xb'),auth[_0x91a0('0xc')](),controller[_0x91a0('0x10')]);router['delete'](_0x91a0('0xb'),auth[_0x91a0('0xc')](),controller[_0x91a0('0x11')]);module[_0x91a0('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 58dde95..a0470c5 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 _0x6e12=['STRING','sequelize','exports'];(function(_0x4ac776,_0x17d7c1){var _0x589f5e=function(_0x2a18e1){while(--_0x2a18e1){_0x4ac776['push'](_0x4ac776['shift']());}};_0x589f5e(++_0x17d7c1);}(_0x6e12,0x154));var _0x26e1=function(_0x1f37f3,_0x500d7a){_0x1f37f3=_0x1f37f3-0x0;var _0x59109b=_0x6e12[_0x1f37f3];return _0x59109b;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')]},'basename':{'type':Sequelize[_0x26e1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc818=['sequelize','exports','STRING'];(function(_0x15b179,_0x5d564d){var _0x379f99=function(_0x33cfaa){while(--_0x33cfaa){_0x15b179['push'](_0x15b179['shift']());}};_0x379f99(++_0x5d564d);}(_0xc818,0x1e3));var _0x8c81=function(_0x2b5fea,_0x3b7f23){_0x2b5fea=_0x2b5fea-0x0;var _0x57bd61=_0xc818[_0x2b5fea];return _0x57bd61;};'use strict';var Sequelize=require(_0x8c81('0x0'));module[_0x8c81('0x1')]={'name':{'type':Sequelize[_0x8c81('0x2')]},'basename':{'type':Sequelize[_0x8c81('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fdb8e4f..22d4434 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 _0x0694=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','stack','name','send','index','map','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','rows','catch','show','params','keys','intersection','include','find','clone','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x0694,0x15a));var _0x4069=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x0694[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x4069('0x0'));var rimraf=require(_0x4069('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4069('0x2'));var rp=require(_0x4069('0x3'));var moment=require(_0x4069('0x4'));var BPromise=require(_0x4069('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4069('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4069('0x7'));var fs=require('fs');var fs_extra=require(_0x4069('0x8'));var _=require(_0x4069('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4069('0xa'));var deskjs=require(_0x4069('0xb'));var toCsv=require(_0x4069('0xc'));var querystring=require(_0x4069('0xd'));var Papa=require(_0x4069('0xe'));var Redis=require(_0x4069('0xf'));var authService=require(_0x4069('0x10'));var qs=require(_0x4069('0x11'));var as=require(_0x4069('0x12'));var hardwareService=require(_0x4069('0x13'));var logger=require(_0x4069('0x14'))(_0x4069('0x15'));var utils=require(_0x4069('0x16'));var config=require(_0x4069('0x17'));var licenseUtil=require(_0x4069('0x18'));var db=require(_0x4069('0x19'))['db'];function respondWithStatusCode(_0x1661af,_0x45228c){_0x45228c=_0x45228c||0xcc;return function(_0x4148ca){if(_0x4148ca){return _0x1661af[_0x4069('0x1a')](_0x45228c);}return _0x1661af[_0x4069('0x1b')](_0x45228c)['end']();};}function respondWithResult(_0x17363e,_0x260f9c){_0x260f9c=_0x260f9c||0xc8;return function(_0x4d2914){if(_0x4d2914){return _0x17363e[_0x4069('0x1b')](_0x260f9c)[_0x4069('0x1c')](_0x4d2914);}};}function respondWithFilteredResult(_0x526e94,_0x5e908f){return function(_0x575e03){if(_0x575e03){var _0x2635a4=typeof _0x5e908f[_0x4069('0x1d')]===_0x4069('0x1e')&&typeof _0x5e908f[_0x4069('0x1f')]===_0x4069('0x1e');var _0x5bd32d=_0x575e03[_0x4069('0x20')];var _0x35fa94=_0x2635a4?0x0:_0x5e908f[_0x4069('0x1d')];var _0x3f853a=_0x2635a4?_0x575e03[_0x4069('0x20')]:_0x5e908f[_0x4069('0x1d')]+_0x5e908f[_0x4069('0x1f')];var _0x46091c;if(_0x3f853a>=_0x5bd32d){_0x3f853a=_0x5bd32d;_0x46091c=0xc8;}else{_0x46091c=0xce;}_0x526e94[_0x4069('0x1b')](_0x46091c);return _0x526e94[_0x4069('0x21')](_0x4069('0x22'),_0x35fa94+'-'+_0x3f853a+'/'+_0x5bd32d)[_0x4069('0x1c')](_0x575e03);}return null;};}function patchUpdates(_0x3949f0){return function(_0x10f7f8){try{jsonpatch['apply'](_0x10f7f8,_0x3949f0,!![]);}catch(_0x56a223){return BPromise['reject'](_0x56a223);}return _0x10f7f8[_0x4069('0x23')]();};}function saveUpdates(_0x174241,_0x148ae1){return function(_0x3afb88){if(_0x3afb88){return _0x3afb88[_0x4069('0x24')](_0x174241)['then'](function(_0x43c570){return _0x43c570;});}return null;};}function removeEntity(_0x119fdf,_0xd37a60){return function(_0x171527){if(_0x171527){return _0x171527['destroy']()[_0x4069('0x25')](function(){_0x119fdf[_0x4069('0x1b')](0xcc)[_0x4069('0x26')]();});}};}function handleEntityNotFound(_0xc13df2,_0x1c4e24){return function(_0x3a0cc9){if(!_0x3a0cc9){_0xc13df2[_0x4069('0x1a')](0x194);}return _0x3a0cc9;};}function handleError(_0x3d880,_0x316ebc){_0x316ebc=_0x316ebc||0x1f4;return function(_0x140faf){logger['error'](_0x140faf[_0x4069('0x27')]);if(_0x140faf[_0x4069('0x28')]){delete _0x140faf['name'];}_0x3d880[_0x4069('0x1b')](_0x316ebc)[_0x4069('0x29')](_0x140faf);};}exports[_0x4069('0x2a')]=function(_0x338bb8,_0x220709){var _0x35c8e1={},_0x3e6fb7={},_0x42daaa={'count':0x0,'rows':[]};var _0x40129f=_[_0x4069('0x2b')](db['Attachment']['rawAttributes'],function(_0x2eb914){return{'name':_0x2eb914[_0x4069('0x2c')],'type':_0x2eb914[_0x4069('0x2d')][_0x4069('0x2e')]};});_0x3e6fb7[_0x4069('0x2f')]=_[_0x4069('0x2b')](_0x40129f,_0x4069('0x28'));_0x3e6fb7[_0x4069('0x30')]=_['keys'](_0x338bb8[_0x4069('0x30')]);_0x3e6fb7['filters']=_['intersection'](_0x3e6fb7[_0x4069('0x2f')],_0x3e6fb7[_0x4069('0x30')]);_0x35c8e1[_0x4069('0x31')]=_['intersection'](_0x3e6fb7[_0x4069('0x2f')],qs[_0x4069('0x32')](_0x338bb8['query'][_0x4069('0x32')]));_0x35c8e1[_0x4069('0x31')]=_0x35c8e1['attributes'][_0x4069('0x33')]?_0x35c8e1[_0x4069('0x31')]:_0x3e6fb7[_0x4069('0x2f')];if(!_0x338bb8[_0x4069('0x30')][_0x4069('0x34')](_0x4069('0x35'))){_0x35c8e1[_0x4069('0x1f')]=qs[_0x4069('0x1f')](_0x338bb8[_0x4069('0x30')][_0x4069('0x1f')]);_0x35c8e1[_0x4069('0x1d')]=qs[_0x4069('0x1d')](_0x338bb8[_0x4069('0x30')][_0x4069('0x1d')]);}_0x35c8e1[_0x4069('0x36')]=qs['sort'](_0x338bb8['query'][_0x4069('0x37')]);_0x35c8e1[_0x4069('0x38')]=qs[_0x4069('0x39')](_[_0x4069('0x3a')](_0x338bb8[_0x4069('0x30')],_0x3e6fb7[_0x4069('0x39')]),_0x40129f);if(_0x338bb8[_0x4069('0x30')][_0x4069('0x3b')]){_0x35c8e1[_0x4069('0x38')]=_[_0x4069('0x3c')](_0x35c8e1[_0x4069('0x38')],{'$or':_[_0x4069('0x2b')](_0x40129f,function(_0x14575a){if(_0x14575a[_0x4069('0x2d')]!==_0x4069('0x3d')){var _0x90a125={};_0x90a125[_0x14575a[_0x4069('0x28')]]={'$like':'%'+_0x338bb8[_0x4069('0x30')][_0x4069('0x3b')]+'%'};return _0x90a125;}})});}_0x35c8e1=_[_0x4069('0x3c')]({},_0x35c8e1,_0x338bb8[_0x4069('0x3e')]);var _0x31c8cc={'where':_0x35c8e1['where']};return db[_0x4069('0x3f')][_0x4069('0x20')](_0x31c8cc)['then'](function(_0x57b908){_0x42daaa[_0x4069('0x20')]=_0x57b908;if(_0x338bb8[_0x4069('0x30')][_0x4069('0x40')]){_0x35c8e1['include']=[{'all':!![]}];}return db[_0x4069('0x3f')]['findAll'](_0x35c8e1);})[_0x4069('0x25')](function(_0x521bd6){_0x42daaa[_0x4069('0x41')]=_0x521bd6;return _0x42daaa;})[_0x4069('0x25')](respondWithFilteredResult(_0x220709,_0x35c8e1))[_0x4069('0x42')](handleError(_0x220709,null));};exports[_0x4069('0x43')]=function(_0x18dc97,_0x120083){var _0x5a9d5b={'raw':!![],'where':{'id':_0x18dc97[_0x4069('0x44')]['id']}},_0x465c51={};_0x465c51['model']=_[_0x4069('0x45')](db[_0x4069('0x3f')]['rawAttributes']);_0x465c51['query']=_[_0x4069('0x45')](_0x18dc97[_0x4069('0x30')]);_0x465c51[_0x4069('0x39')]=_[_0x4069('0x46')](_0x465c51[_0x4069('0x2f')],_0x465c51[_0x4069('0x30')]);_0x5a9d5b[_0x4069('0x31')]=_['intersection'](_0x465c51[_0x4069('0x2f')],qs[_0x4069('0x32')](_0x18dc97[_0x4069('0x30')][_0x4069('0x32')]));_0x5a9d5b[_0x4069('0x31')]=_0x5a9d5b[_0x4069('0x31')]['length']?_0x5a9d5b[_0x4069('0x31')]:_0x465c51[_0x4069('0x2f')];if(_0x18dc97[_0x4069('0x30')]['includeAll']){_0x5a9d5b[_0x4069('0x47')]=[{'all':!![]}];}_0x5a9d5b=_[_0x4069('0x3c')]({},_0x5a9d5b,_0x18dc97[_0x4069('0x3e')]);return db[_0x4069('0x3f')][_0x4069('0x48')](_0x5a9d5b)[_0x4069('0x25')](handleEntityNotFound(_0x120083,null))[_0x4069('0x25')](respondWithResult(_0x120083,null))[_0x4069('0x42')](handleError(_0x120083,null));};exports[_0x4069('0x49')]=function(_0x12a12b,_0x15a450){var _0x299f0e={'where':{'id':_0x12a12b[_0x4069('0x44')]['id']}},_0x2c248e={};_0x2c248e[_0x4069('0x2f')]=_[_0x4069('0x45')](db[_0x4069('0x3f')]['rawAttributes']);_0x299f0e['attributes']=_[_0x4069('0x46')](_0x2c248e['model'],qs[_0x4069('0x32')](_0x12a12b[_0x4069('0x30')][_0x4069('0x32')]));_0x299f0e[_0x4069('0x31')]=_0x299f0e[_0x4069('0x31')][_0x4069('0x33')]?_0x299f0e[_0x4069('0x31')]:_0x2c248e[_0x4069('0x2f')];if(_0x12a12b[_0x4069('0x30')]['includeAll']){_0x299f0e['include']=[{'all':!![]}];}_0x299f0e=_['merge']({},_0x299f0e,_0x12a12b['options']);return db['Attachment'][_0x4069('0x48')](_0x299f0e)['then'](handleEntityNotFound(_0x15a450,null))[_0x4069('0x25')](function(_0x2365a7){if(_0x2365a7){var _0x44a4c7=_0x2365a7[_0x4069('0x4a')]({'plain':!![]});_0x44a4c7=qs[_0x4069('0x4b')](_0x44a4c7,['id',_0x4069('0x4c'),_0x4069('0x4d')]);_0x12a12b['body']=_[_0x4069('0x4b')](_0x12a12b[_0x4069('0x4e')],['id','createdAt',_0x4069('0x4d')]);return db[_0x4069('0x3f')][_0x4069('0x4f')](_[_0x4069('0x3c')](_0x44a4c7,_0x12a12b['body']),{'include':_0x12a12b[_0x4069('0x30')][_0x4069('0x40')]?[{'all':!![]}]:undefined});}})[_0x4069('0x25')](respondWithResult(_0x15a450,0xc9))[_0x4069('0x42')](handleError(_0x15a450,null));};exports[_0x4069('0x24')]=function(_0x40cad1,_0x51614d){if(_0x40cad1[_0x4069('0x4e')]['id']){delete _0x40cad1[_0x4069('0x4e')]['id'];}return db['Attachment'][_0x4069('0x48')]({'where':{'id':_0x40cad1[_0x4069('0x44')]['id']}})['then'](handleEntityNotFound(_0x51614d,null))['then'](saveUpdates(_0x40cad1['body'],null))[_0x4069('0x25')](respondWithResult(_0x51614d,null))[_0x4069('0x42')](handleError(_0x51614d,null));};exports[_0x4069('0x50')]=function(_0x5f5a06,_0x12ece6){return db['Attachment'][_0x4069('0x48')]({'where':{'id':_0x5f5a06[_0x4069('0x44')]['id']}})['then'](handleEntityNotFound(_0x12ece6,null))[_0x4069('0x25')](removeEntity(_0x12ece6,null))[_0x4069('0x42')](handleError(_0x12ece6,null));};exports['create']=function(_0x599dd0,_0x539d0f,_0x2cd8d7){_0x599dd0[_0x4069('0x4e')][_0x4069('0x28')]=_0x599dd0[_0x4069('0x51')][_0x4069('0x52')];_0x599dd0['body'][_0x4069('0x53')]=_0x599dd0[_0x4069('0x51')][_0x4069('0x54')];_0x599dd0[_0x4069('0x4e')][_0x4069('0x2d')]=_0x599dd0[_0x4069('0x51')][_0x4069('0x55')];return db[_0x4069('0x3f')][_0x4069('0x4f')](_0x599dd0[_0x4069('0x4e')])[_0x4069('0x25')](respondWithResult(_0x539d0f,0xc9))[_0x4069('0x42')](handleError(_0x539d0f,null));};exports[_0x4069('0x56')]=function(_0x3dc515,_0x59d0fd,_0x5c1d13){return db[_0x4069('0x3f')][_0x4069('0x57')]({'where':{'id':_0x3dc515[_0x4069('0x44')]['id']},'raw':!![]})[_0x4069('0x25')](handleEntityNotFound(_0x59d0fd,null))[_0x4069('0x25')](function(_0x437b91){if(_0x437b91){var _0x1a77d9=_0x437b91[_0x4069('0x58')]!==null;var _0x382dc0=path[_0x4069('0x59')](config[_0x4069('0x5a')],_0x4069('0x5b'));if(_0x1a77d9){_0x382dc0=path[_0x4069('0x59')](_0x382dc0,'offline-chat/');}var _0x63d448=path[_0x4069('0x59')](_0x382dc0,_0x437b91[_0x4069('0x53')]);return _0x59d0fd[_0x4069('0x56')](_0x63d448);}})[_0x4069('0x42')](handleError(_0x59d0fd,null));}; \ No newline at end of file +var _0xcd3a=['key','model','keys','filters','intersection','query','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','clone','params','includeAll','omit','createdAt','body','updatedAt','create','file','originalname','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','Attachment','fieldName','type'];(function(_0x2c4260,_0x19882c){var _0x13972e=function(_0x3e7fe6){while(--_0x3e7fe6){_0x2c4260['push'](_0x2c4260['shift']());}};_0x13972e(++_0x19882c);}(_0xcd3a,0x191));var _0xacd3=function(_0x51f5a5,_0x4134cd){_0x51f5a5=_0x51f5a5-0x0;var _0x54b003=_0xcd3a[_0x51f5a5];return _0x54b003;};'use strict';var emlformat=require(_0xacd3('0x0'));var rimraf=require(_0xacd3('0x1'));var zipdir=require(_0xacd3('0x2'));var jsonpatch=require(_0xacd3('0x3'));var rp=require(_0xacd3('0x4'));var moment=require(_0xacd3('0x5'));var BPromise=require(_0xacd3('0x6'));var Mustache=require(_0xacd3('0x7'));var util=require(_0xacd3('0x8'));var path=require(_0xacd3('0x9'));var sox=require('sox');var csv=require(_0xacd3('0xa'));var ejs=require(_0xacd3('0xb'));var fs=require('fs');var fs_extra=require(_0xacd3('0xc'));var _=require(_0xacd3('0xd'));var squel=require(_0xacd3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xacd3('0xf'));var toCsv=require(_0xacd3('0xa'));var querystring=require(_0xacd3('0x10'));var Papa=require('papaparse');var Redis=require(_0xacd3('0x11'));var authService=require(_0xacd3('0x12'));var qs=require(_0xacd3('0x13'));var as=require(_0xacd3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd3('0x15'))('api');var utils=require(_0xacd3('0x16'));var config=require(_0xacd3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ad988,_0x5565f3){_0x5565f3=_0x5565f3||0xcc;return function(_0x429d2d){if(_0x429d2d){return _0x5ad988[_0xacd3('0x18')](_0x5565f3);}return _0x5ad988['status'](_0x5565f3)[_0xacd3('0x19')]();};}function respondWithResult(_0x8969b4,_0xd64d7b){_0xd64d7b=_0xd64d7b||0xc8;return function(_0x584f60){if(_0x584f60){return _0x8969b4[_0xacd3('0x1a')](_0xd64d7b)['json'](_0x584f60);}};}function respondWithFilteredResult(_0x14a8c9,_0x2901a6){return function(_0x28be3a){if(_0x28be3a){var _0x59e6b1=typeof _0x2901a6[_0xacd3('0x1b')]===_0xacd3('0x1c')&&typeof _0x2901a6['limit']===_0xacd3('0x1c');var _0x83b729=_0x28be3a[_0xacd3('0x1d')];var _0x37ba33=_0x59e6b1?0x0:_0x2901a6[_0xacd3('0x1b')];var _0x2a833b=_0x59e6b1?_0x28be3a['count']:_0x2901a6[_0xacd3('0x1b')]+_0x2901a6['limit'];var _0x87692a;if(_0x2a833b>=_0x83b729){_0x2a833b=_0x83b729;_0x87692a=0xc8;}else{_0x87692a=0xce;}_0x14a8c9[_0xacd3('0x1a')](_0x87692a);return _0x14a8c9[_0xacd3('0x1e')](_0xacd3('0x1f'),_0x37ba33+'-'+_0x2a833b+'/'+_0x83b729)['json'](_0x28be3a);}return null;};}function patchUpdates(_0x380bfc){return function(_0x991d6c){try{jsonpatch['apply'](_0x991d6c,_0x380bfc,!![]);}catch(_0x2251cb){return BPromise['reject'](_0x2251cb);}return _0x991d6c[_0xacd3('0x20')]();};}function saveUpdates(_0x5e613c,_0x9fa65c){return function(_0x25a9ce){if(_0x25a9ce){return _0x25a9ce[_0xacd3('0x21')](_0x5e613c)[_0xacd3('0x22')](function(_0x92e24c){return _0x92e24c;});}return null;};}function removeEntity(_0x3fdf72,_0x183f34){return function(_0x2cfc08){if(_0x2cfc08){return _0x2cfc08[_0xacd3('0x23')]()['then'](function(){_0x3fdf72[_0xacd3('0x1a')](0xcc)[_0xacd3('0x19')]();});}};}function handleEntityNotFound(_0x1418af,_0x4035e3){return function(_0x20487f){if(!_0x20487f){_0x1418af[_0xacd3('0x18')](0x194);}return _0x20487f;};}function handleError(_0x520963,_0x54f4cb){_0x54f4cb=_0x54f4cb||0x1f4;return function(_0x540e41){logger['error'](_0x540e41[_0xacd3('0x24')]);if(_0x540e41['name']){delete _0x540e41[_0xacd3('0x25')];}_0x520963[_0xacd3('0x1a')](_0x54f4cb)[_0xacd3('0x26')](_0x540e41);};}exports[_0xacd3('0x27')]=function(_0x3e087a,_0x1ef8cf){var _0x236f2f={},_0x14caa9={},_0x3f7161={'count':0x0,'rows':[]};var _0xf83650=_[_0xacd3('0x28')](db[_0xacd3('0x29')]['rawAttributes'],function(_0x4ae0b0){return{'name':_0x4ae0b0[_0xacd3('0x2a')],'type':_0x4ae0b0[_0xacd3('0x2b')][_0xacd3('0x2c')]};});_0x14caa9[_0xacd3('0x2d')]=_[_0xacd3('0x28')](_0xf83650,'name');_0x14caa9['query']=_[_0xacd3('0x2e')](_0x3e087a['query']);_0x14caa9[_0xacd3('0x2f')]=_[_0xacd3('0x30')](_0x14caa9[_0xacd3('0x2d')],_0x14caa9[_0xacd3('0x31')]);_0x236f2f['attributes']=_[_0xacd3('0x30')](_0x14caa9[_0xacd3('0x2d')],qs[_0xacd3('0x32')](_0x3e087a['query'][_0xacd3('0x32')]));_0x236f2f['attributes']=_0x236f2f['attributes'][_0xacd3('0x33')]?_0x236f2f[_0xacd3('0x34')]:_0x14caa9[_0xacd3('0x2d')];if(!_0x3e087a[_0xacd3('0x31')][_0xacd3('0x35')](_0xacd3('0x36'))){_0x236f2f[_0xacd3('0x37')]=qs[_0xacd3('0x37')](_0x3e087a['query'][_0xacd3('0x37')]);_0x236f2f[_0xacd3('0x1b')]=qs[_0xacd3('0x1b')](_0x3e087a[_0xacd3('0x31')][_0xacd3('0x1b')]);}_0x236f2f['order']=qs[_0xacd3('0x38')](_0x3e087a[_0xacd3('0x31')][_0xacd3('0x38')]);_0x236f2f[_0xacd3('0x39')]=qs['filters'](_[_0xacd3('0x3a')](_0x3e087a[_0xacd3('0x31')],_0x14caa9[_0xacd3('0x2f')]),_0xf83650);if(_0x3e087a[_0xacd3('0x31')][_0xacd3('0x3b')]){_0x236f2f[_0xacd3('0x39')]=_[_0xacd3('0x3c')](_0x236f2f['where'],{'$or':_[_0xacd3('0x28')](_0xf83650,function(_0x428fcd){if(_0x428fcd[_0xacd3('0x2b')]!==_0xacd3('0x3d')){var _0x55fc8c={};_0x55fc8c[_0x428fcd[_0xacd3('0x25')]]={'$like':'%'+_0x3e087a[_0xacd3('0x31')][_0xacd3('0x3b')]+'%'};return _0x55fc8c;}})});}_0x236f2f=_[_0xacd3('0x3c')]({},_0x236f2f,_0x3e087a[_0xacd3('0x3e')]);var _0x135723={'where':_0x236f2f[_0xacd3('0x39')]};return db[_0xacd3('0x29')][_0xacd3('0x1d')](_0x135723)['then'](function(_0x2784f4){_0x3f7161[_0xacd3('0x1d')]=_0x2784f4;if(_0x3e087a[_0xacd3('0x31')]['includeAll']){_0x236f2f[_0xacd3('0x3f')]=[{'all':!![]}];}return db[_0xacd3('0x29')][_0xacd3('0x40')](_0x236f2f);})[_0xacd3('0x22')](function(_0x36f3ca){_0x3f7161[_0xacd3('0x41')]=_0x36f3ca;return _0x3f7161;})[_0xacd3('0x22')](respondWithFilteredResult(_0x1ef8cf,_0x236f2f))[_0xacd3('0x42')](handleError(_0x1ef8cf,null));};exports[_0xacd3('0x43')]=function(_0x26a59c,_0x2f015a){var _0x5ee910={'raw':!![],'where':{'id':_0x26a59c['params']['id']}},_0x762905={};_0x762905['model']=_[_0xacd3('0x2e')](db['Attachment'][_0xacd3('0x44')]);_0x762905[_0xacd3('0x31')]=_[_0xacd3('0x2e')](_0x26a59c[_0xacd3('0x31')]);_0x762905[_0xacd3('0x2f')]=_[_0xacd3('0x30')](_0x762905['model'],_0x762905[_0xacd3('0x31')]);_0x5ee910[_0xacd3('0x34')]=_[_0xacd3('0x30')](_0x762905['model'],qs[_0xacd3('0x32')](_0x26a59c[_0xacd3('0x31')]['fields']));_0x5ee910['attributes']=_0x5ee910['attributes']['length']?_0x5ee910['attributes']:_0x762905[_0xacd3('0x2d')];if(_0x26a59c[_0xacd3('0x31')]['includeAll']){_0x5ee910['include']=[{'all':!![]}];}_0x5ee910=_['merge']({},_0x5ee910,_0x26a59c[_0xacd3('0x3e')]);return db[_0xacd3('0x29')][_0xacd3('0x45')](_0x5ee910)[_0xacd3('0x22')](handleEntityNotFound(_0x2f015a,null))['then'](respondWithResult(_0x2f015a,null))[_0xacd3('0x42')](handleError(_0x2f015a,null));};exports[_0xacd3('0x46')]=function(_0x1fde1e,_0x3af193){var _0x8edeec={'where':{'id':_0x1fde1e[_0xacd3('0x47')]['id']}},_0x4d97ef={};_0x4d97ef['model']=_[_0xacd3('0x2e')](db[_0xacd3('0x29')][_0xacd3('0x44')]);_0x8edeec['attributes']=_[_0xacd3('0x30')](_0x4d97ef[_0xacd3('0x2d')],qs['fields'](_0x1fde1e[_0xacd3('0x31')][_0xacd3('0x32')]));_0x8edeec[_0xacd3('0x34')]=_0x8edeec['attributes']['length']?_0x8edeec[_0xacd3('0x34')]:_0x4d97ef[_0xacd3('0x2d')];if(_0x1fde1e[_0xacd3('0x31')][_0xacd3('0x48')]){_0x8edeec[_0xacd3('0x3f')]=[{'all':!![]}];}_0x8edeec=_[_0xacd3('0x3c')]({},_0x8edeec,_0x1fde1e[_0xacd3('0x3e')]);return db[_0xacd3('0x29')]['find'](_0x8edeec)[_0xacd3('0x22')](handleEntityNotFound(_0x3af193,null))['then'](function(_0x263980){if(_0x263980){var _0x593f86=_0x263980['get']({'plain':!![]});_0x593f86=qs[_0xacd3('0x49')](_0x593f86,['id',_0xacd3('0x4a'),'updatedAt']);_0x1fde1e[_0xacd3('0x4b')]=_[_0xacd3('0x49')](_0x1fde1e[_0xacd3('0x4b')],['id',_0xacd3('0x4a'),_0xacd3('0x4c')]);return db[_0xacd3('0x29')]['create'](_[_0xacd3('0x3c')](_0x593f86,_0x1fde1e[_0xacd3('0x4b')]),{'include':_0x1fde1e['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xacd3('0x22')](respondWithResult(_0x3af193,0xc9))[_0xacd3('0x42')](handleError(_0x3af193,null));};exports[_0xacd3('0x21')]=function(_0x162308,_0x3cf043){if(_0x162308[_0xacd3('0x4b')]['id']){delete _0x162308[_0xacd3('0x4b')]['id'];}return db[_0xacd3('0x29')][_0xacd3('0x45')]({'where':{'id':_0x162308[_0xacd3('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cf043,null))[_0xacd3('0x22')](saveUpdates(_0x162308[_0xacd3('0x4b')],null))[_0xacd3('0x22')](respondWithResult(_0x3cf043,null))[_0xacd3('0x42')](handleError(_0x3cf043,null));};exports[_0xacd3('0x23')]=function(_0x3b7a2d,_0x4a2737){return db[_0xacd3('0x29')][_0xacd3('0x45')]({'where':{'id':_0x3b7a2d[_0xacd3('0x47')]['id']}})[_0xacd3('0x22')](handleEntityNotFound(_0x4a2737,null))[_0xacd3('0x22')](removeEntity(_0x4a2737,null))[_0xacd3('0x42')](handleError(_0x4a2737,null));};exports[_0xacd3('0x4d')]=function(_0x480a4e,_0x2127d4,_0x320673){_0x480a4e[_0xacd3('0x4b')][_0xacd3('0x25')]=_0x480a4e[_0xacd3('0x4e')][_0xacd3('0x4f')];_0x480a4e[_0xacd3('0x4b')]['basename']=_0x480a4e[_0xacd3('0x4e')][_0xacd3('0x50')];_0x480a4e['body']['type']=_0x480a4e[_0xacd3('0x4e')][_0xacd3('0x51')];return db['Attachment']['create'](_0x480a4e[_0xacd3('0x4b')])[_0xacd3('0x22')](respondWithResult(_0x2127d4,0xc9))[_0xacd3('0x42')](handleError(_0x2127d4,null));};exports['download']=function(_0x1896ca,_0x4d066b,_0x156e60){return db[_0xacd3('0x29')][_0xacd3('0x52')]({'where':{'id':_0x1896ca['params']['id']},'raw':!![]})[_0xacd3('0x22')](handleEntityNotFound(_0x4d066b,null))[_0xacd3('0x22')](function(_0x3a9590){if(_0x3a9590){var _0x3063be=_0x3a9590[_0xacd3('0x53')]!==null;var _0x15c688=path[_0xacd3('0x54')](config[_0xacd3('0x55')],_0xacd3('0x56'));if(_0x3063be){_0x15c688=path['join'](_0x15c688,_0xacd3('0x57'));}var _0x41bbae=path[_0xacd3('0x54')](_0x15c688,_0x3a9590['basename']);return _0x4d066b[_0xacd3('0x58')](_0x41bbae);}})[_0xacd3('0x42')](handleError(_0x4d066b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index dc32b90..0a11339 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 _0x39a6=['Attachment','attachments','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x476a67,_0x4601d8){var _0x5f4a24=function(_0x3ed7be){while(--_0x3ed7be){_0x476a67['push'](_0x476a67['shift']());}};_0x5f4a24(++_0x4601d8);}(_0x39a6,0x157));var _0x639a=function(_0x3ff097,_0x40aa28){_0x3ff097=_0x3ff097-0x0;var _0x15565f=_0x39a6[_0x3ff097];return _0x15565f;};'use strict';var _=require(_0x639a('0x0'));var util=require(_0x639a('0x1'));var logger=require('../../config/logger')(_0x639a('0x2'));var moment=require(_0x639a('0x3'));var BPromise=require('bluebird');var rp=require(_0x639a('0x4'));var fs=require('fs');var path=require(_0x639a('0x5'));var rimraf=require(_0x639a('0x6'));var config=require(_0x639a('0x7'));var attributes=require('./attachment.attributes');module[_0x639a('0x8')]=function(_0x4bf439,_0x451df1){return _0x4bf439['define'](_0x639a('0x9'),attributes,{'tableName':_0x639a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd613=['rimraf','../../config/environment','./attachment.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5d23af,_0x650129){var _0x1f290a=function(_0x164a4d){while(--_0x164a4d){_0x5d23af['push'](_0x5d23af['shift']());}};_0x1f290a(++_0x650129);}(_0xd613,0x1a6));var _0x3d61=function(_0x4932bd,_0x54973c){_0x4932bd=_0x4932bd-0x0;var _0x52876b=_0xd613[_0x4932bd];return _0x52876b;};'use strict';var _=require(_0x3d61('0x0'));var util=require(_0x3d61('0x1'));var logger=require(_0x3d61('0x2'))(_0x3d61('0x3'));var moment=require('moment');var BPromise=require(_0x3d61('0x4'));var rp=require(_0x3d61('0x5'));var fs=require('fs');var path=require(_0x3d61('0x6'));var rimraf=require(_0x3d61('0x7'));var config=require(_0x3d61('0x8'));var attributes=require(_0x3d61('0x9'));module['exports']=function(_0x364360,_0x3b4aff){return _0x364360[_0x3d61('0xa')]('Attachment',attributes,{'tableName':'attachments','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 917c0fd..d882a80 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 _0xa588=['debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','create','body','options','raw'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0xa588,0xe1));var _0x8a58=function(_0x4ac749,_0x3e27a4){_0x4ac749=_0x4ac749-0x0;var _0x358d88=_0xa588[_0x4ac749];return _0x358d88;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var moment=require(_0x8a58('0x1'));var BPromise=require(_0x8a58('0x2'));var rs=require(_0x8a58('0x3'));var fs=require('fs');var Redis=require(_0x8a58('0x4'));var db=require(_0x8a58('0x5'))['db'];var utils=require(_0x8a58('0x6'));var logger=require(_0x8a58('0x7'))(_0x8a58('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a58('0x9'));var client=jayson[_0x8a58('0xa')][_0x8a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35d5ad,_0xe0af18,_0x140f99){return new BPromise(function(_0x77b421,_0x585376){return client['request'](_0x35d5ad,_0x140f99)[_0x8a58('0xc')](function(_0x39a20e){logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));logger['debug'](_0x8a58('0x10'),_0xe0af18,_0x8a58('0xf'),JSON[_0x8a58('0x11')](_0x39a20e));if(_0x39a20e[_0x8a58('0x12')]){if(_0x39a20e['error']['code']===0x1f4){logger[_0x8a58('0x12')]('Attachment,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x585376(_0x39a20e['error'][_0x8a58('0x13')]);}logger[_0x8a58('0x12')]('Attachment,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x77b421(_0x39a20e['error'][_0x8a58('0x13')]);}else{logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));_0x77b421(_0x39a20e[_0x8a58('0x14')][_0x8a58('0x13')]);}})[_0x8a58('0x15')](function(_0x49ee0e){logger['error'](_0x8a58('0xe'),_0xe0af18,_0x49ee0e);_0x585376(_0x49ee0e);});});}exports[_0x8a58('0x16')]=function(_0x18a14d){var _0x4b5012=this;return new Promise(function(_0x282f2d,_0xe73eb9){return db['Attachment'][_0x8a58('0x17')](_0x18a14d[_0x8a58('0x18')],{'raw':_0x18a14d[_0x8a58('0x19')]?_0x18a14d[_0x8a58('0x19')][_0x8a58('0x1a')]===undefined?!![]:![]:!![]})[_0x8a58('0xc')](function(_0x284bb8){logger[_0x8a58('0xd')](_0x8a58('0x16'),_0x18a14d);logger[_0x8a58('0x1b')](_0x8a58('0x16'),_0x18a14d,JSON[_0x8a58('0x11')](_0x284bb8));_0x282f2d(_0x284bb8);})[_0x8a58('0x15')](function(_0x34adb8){logger['error'](_0x8a58('0x16'),_0x34adb8[_0x8a58('0x13')],_0x18a14d);_0xe73eb9(_0x4b5012[_0x8a58('0x12')](0x1f4,_0x34adb8[_0x8a58('0x13')]));});});}; \ No newline at end of file +var _0xe630=['client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','Attachment','body','options','CreateAttachment','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0xe630,0x149));var _0x0e63=function(_0x582f34,_0x50e8a1){_0x582f34=_0x582f34-0x0;var _0x3cc88b=_0xe630[_0x582f34];return _0x3cc88b;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var moment=require('moment');var BPromise=require(_0x0e63('0x2'));var rs=require(_0x0e63('0x3'));var fs=require('fs');var Redis=require(_0x0e63('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e63('0x5'));var logger=require(_0x0e63('0x6'))(_0x0e63('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e63('0x8'));var client=jayson[_0x0e63('0x9')][_0x0e63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e461b,_0x32e418,_0x563ad9){return new BPromise(function(_0x35e304,_0x2db49a){return client[_0x0e63('0xb')](_0x3e461b,_0x563ad9)[_0x0e63('0xc')](function(_0x5efeea){logger[_0x0e63('0xd')](_0x0e63('0xe'),_0x32e418,_0x0e63('0xf'));logger[_0x0e63('0x10')](_0x0e63('0x11'),_0x32e418,_0x0e63('0xf'),JSON['stringify'](_0x5efeea));if(_0x5efeea[_0x0e63('0x12')]){if(_0x5efeea[_0x0e63('0x12')][_0x0e63('0x13')]===0x1f4){logger[_0x0e63('0x12')](_0x0e63('0xe'),_0x32e418,_0x5efeea[_0x0e63('0x12')][_0x0e63('0x14')]);return _0x2db49a(_0x5efeea[_0x0e63('0x12')][_0x0e63('0x14')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x32e418,_0x5efeea[_0x0e63('0x12')][_0x0e63('0x14')]);return _0x35e304(_0x5efeea[_0x0e63('0x12')][_0x0e63('0x14')]);}else{logger[_0x0e63('0xd')](_0x0e63('0xe'),_0x32e418,'request\x20sent');_0x35e304(_0x5efeea['result']['message']);}})['catch'](function(_0x37f6e4){logger[_0x0e63('0x12')](_0x0e63('0xe'),_0x32e418,_0x37f6e4);_0x2db49a(_0x37f6e4);});});}exports['CreateAttachment']=function(_0x4dd1db){var _0x16107b=this;return new Promise(function(_0x5c01e0,_0x58d57e){return db[_0x0e63('0x15')]['create'](_0x4dd1db[_0x0e63('0x16')],{'raw':_0x4dd1db[_0x0e63('0x17')]?_0x4dd1db['options']['raw']===undefined?!![]:![]:!![]})[_0x0e63('0xc')](function(_0x1dfd60){logger[_0x0e63('0xd')](_0x0e63('0x18'),_0x4dd1db);logger[_0x0e63('0x10')](_0x0e63('0x18'),_0x4dd1db,JSON['stringify'](_0x1dfd60));_0x5c01e0(_0x1dfd60);})[_0x0e63('0x19')](function(_0x23ed8c){logger[_0x0e63('0x12')](_0x0e63('0x18'),_0x23ed8c[_0x0e63('0x14')],_0x4dd1db);_0x58d57e(_0x16107b['error'](0x1f4,_0x23ed8c['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 84f6dee..c7f5961 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 _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(_0x42cdeb,_0x465138){var _0xe4a0ca=function(_0x144fe0){while(--_0x144fe0){_0x42cdeb['push'](_0x42cdeb['shift']());}};_0xe4a0ca(++_0x465138);}(_0xadb5,0xad));var _0x5adb=function(_0x5ee45e,_0xeccd98){_0x5ee45e=_0x5ee45e-0x0;var _0x5875a3=_0xadb5[_0x5ee45e];return _0x5875a3;};'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 +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 2c64ea8..55c954b 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 _0x8477=['undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','role','disabled','blocked','blockedAt','admin','agent','then','name','add','minutes','getLicense','catch','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','passport','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8477,0xea));var _0x7847=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x8477[_0x5ac1e5];return _0x1bccc6;};'use strict';var passport=require(_0x7847('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0x7847('0x1'));var ActiveDirectory=require(_0x7847('0x2'));var BPromise=require(_0x7847('0x3'));var util=require(_0x7847('0x4'));var db=require(_0x7847('0x5'))['db'];var authService=require(_0x7847('0x6'));var utils=require('../../config/utils');var config=require(_0x7847('0x7'));var logger=require(_0x7847('0x8'))(_0x7847('0x9'));function isActiveDirectoryConfigured(_0x189b7d){var _0x5944d8=![];if(typeof _0x189b7d[_0x7847('0xa')]!==_0x7847('0xb')){_0x5944d8=_0x189b7d[_0x7847('0xa')][_0x7847('0xc')]&&_0x189b7d[_0x7847('0xa')][_0x7847('0xd')]&&_0x189b7d[_0x7847('0xa')][_0x7847('0xe')];}return _0x5944d8;}function adAuthenticate(_0x59c223,_0x2cc6c5,_0x5ca9ba){return new BPromise(function(_0x5c7f02,_0x283f92){try{var _0x4b9763=new ActiveDirectory(_0x59c223);_0x4b9763['authenticate'](_0x2cc6c5,_0x5ca9ba,function(_0x42d0bb,_0x2b14f6){if(_0x42d0bb){logger[_0x7847('0xf')](_0x7847('0x10'),_0x2cc6c5,util['inspect'](_0x42d0bb,{'showHidden':![],'depth':null}));_0x283f92(_0x7847('0x11'));}else if(!_0x2b14f6){logger[_0x7847('0xf')](_0x7847('0x12'),_0x2cc6c5);_0x283f92(_0x7847('0x11'));}else{_0x5c7f02(_0x2b14f6);}});}catch(_0x18a120){_0x283f92(_0x18a120);}});}function ActiveDirectoryAuthenticate(_0x1abe4e,_0x688007,_0x1d5edf,_0x41d22f){var _0xdf74d1,_0x2737cc;if(!isActiveDirectoryConfigured(config)){logger[_0x7847('0xf')](_0x7847('0x13'),_0x688007);return _0x41d22f(null,![],{'message':_0x7847('0x11')});}return db[_0x7847('0x14')][_0x7847('0x15')]({'where':{'id':0x1},'attributes':[_0x7847('0x16'),_0x7847('0x17')],'raw':!![]})['then'](function(_0x180c68){_0xdf74d1=_0x180c68;if(!_0xdf74d1[_0x7847('0x16')]){logger[_0x7847('0xf')](_0x7847('0x18'),_0x688007);throw new Error(_0x7847('0x11'));}return _0x1abe4e[_0x7847('0x15')]({'attributes':['id','name',_0x7847('0x19'),'salt',_0x7847('0x1a'),_0x7847('0x1b'),_0x7847('0x1c'),_0x7847('0x1d'),'online'],'where':{'name':_0x688007,'role':{'$or':[_0x7847('0x1e'),'user',_0x7847('0x1f')]},'adSsoEnabled':!![]}});})[_0x7847('0x20')](function(_0x1b2347){if(!_0x1b2347||_0x1b2347&&_0x1b2347[_0x7847('0x21')]!==_0x688007){throw new Error(_0x7847('0x11'));}_0x2737cc=_0x1b2347;var _0x420a5c=_0x2737cc[_0x7847('0x21')]+'@'+config[_0x7847('0xa')]['domain'];return adAuthenticate(config[_0x7847('0xa')],_0x420a5c,_0x1d5edf);})['then'](function(_0x19cf92){if(_0x2737cc[_0x7847('0x1b')]){throw new Error(_0x7847('0x11'));}if(_0xdf74d1['blockDuration']>0x0){if(_0x2737cc[_0x7847('0x1c')]){if(moment(_0x2737cc[_0x7847('0x1d')])[_0x7847('0x22')](_0xdf74d1[_0x7847('0x17')],_0x7847('0x23'))>moment()){throw new Error(_0x7847('0x11'));}return utils['clearBlockUser'](_0x2737cc,0x0,![],null)['then'](function(){return utils[_0x7847('0x24')](_0x2737cc);})[_0x7847('0x20')](function(){return _0x41d22f(null,_0x2737cc);});}else{return utils[_0x7847('0x24')](_0x2737cc)[_0x7847('0x20')](function(){return _0x41d22f(null,_0x2737cc);});}}else{return utils[_0x7847('0x24')](_0x2737cc)[_0x7847('0x20')](function(){return _0x41d22f(null,_0x2737cc);});}})[_0x7847('0x25')](function(_0xc8c7b2){return _0x41d22f(null,![],_0xc8c7b2);});}function handleError(_0x3e476b,_0x48c02f,_0x42f37b){return _0x3e476b['status'](_0x48c02f||0x1f4)[_0x7847('0x26')]({'message':_0x42f37b?_0x42f37b[_0x7847('0x27')]||_0x42f37b:''});}exports[_0x7847('0x28')]=function(_0x397df7,_0x27ac27,_0x122a18){passport[_0x7847('0x29')](_0x7847('0x2a'),function(_0x13fc8c,_0x44c365,_0x4ac4fd){var _0x3f20b1=_0x13fc8c||_0x4ac4fd;if(_0x3f20b1){return handleError(_0x27ac27,0x191,_0x3f20b1);}if(!_0x44c365){return handleError(_0x27ac27,0x194,{'message':_0x7847('0x2b')});}else{var _0x2facd6={'payload':{'id':_0x44c365['id'],'role':_0x44c365[_0x7847('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x7847('0x2c')](_0x2facd6)[_0x7847('0x20')](function(_0x4900e5){_0x27ac27[_0x7847('0x2d')]({'id':_0x44c365['id'],'token':_0x4900e5,'statusCall':'','isAlreadyLogged':_0x44c365[_0x7847('0x2e')]});});}})(_0x397df7,_0x27ac27,_0x122a18);};passport[_0x7847('0x2f')](_0x7847('0x2a'),new LocalStrategy({'usernameField':_0x7847('0x21'),'passwordField':_0x7847('0x19')},function(_0x4cc548,_0x3a3fcf,_0x2bd48c){return ActiveDirectoryAuthenticate(db[_0x7847('0x30')],_0x4cc548,_0x3a3fcf,_0x2bd48c);})); \ No newline at end of file +var _0x40cb=['findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','user','domain','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','use','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting'];(function(_0x3ae38e,_0x3aaa14){var _0x483595=function(_0x5c55ff){while(--_0x5c55ff){_0x3ae38e['push'](_0x3ae38e['shift']());}};_0x483595(++_0x3aaa14);}(_0x40cb,0x108));var _0xb40c=function(_0x2fa9bc,_0x1ce9e3){_0x2fa9bc=_0x2fa9bc-0x0;var _0x4b7704=_0x40cb[_0x2fa9bc];return _0x4b7704;};'use strict';var passport=require(_0xb40c('0x0'));var LocalStrategy=require(_0xb40c('0x1'))[_0xb40c('0x2')];var moment=require(_0xb40c('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xb40c('0x4'));var util=require(_0xb40c('0x5'));var db=require(_0xb40c('0x6'))['db'];var authService=require(_0xb40c('0x7'));var utils=require('../../config/utils');var config=require(_0xb40c('0x8'));var logger=require(_0xb40c('0x9'))('api');function isActiveDirectoryConfigured(_0x36120e){var _0xb9fba5=![];if(typeof _0x36120e[_0xb40c('0xa')]!==_0xb40c('0xb')){_0xb9fba5=_0x36120e[_0xb40c('0xa')][_0xb40c('0xc')]&&_0x36120e[_0xb40c('0xa')]['url']&&_0x36120e[_0xb40c('0xa')]['domain'];}return _0xb9fba5;}function adAuthenticate(_0x147094,_0x3c4efa,_0x235d12){return new BPromise(function(_0x7cc254,_0x34f01c){try{var _0x14dae1=new ActiveDirectory(_0x147094);_0x14dae1[_0xb40c('0xd')](_0x3c4efa,_0x235d12,function(_0x10baaa,_0x4f2b5c){if(_0x10baaa){logger[_0xb40c('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x3c4efa,util['inspect'](_0x10baaa,{'showHidden':![],'depth':null}));_0x34f01c(_0xb40c('0xf'));}else if(!_0x4f2b5c){logger[_0xb40c('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3c4efa);_0x34f01c(_0xb40c('0xf'));}else{_0x7cc254(_0x4f2b5c);}});}catch(_0x3975fd){_0x34f01c(_0x3975fd);}});}function ActiveDirectoryAuthenticate(_0x10a379,_0xea8c46,_0xf87a46,_0x58abf7){var _0xd430cb,_0x361bfc;if(!isActiveDirectoryConfigured(config)){logger[_0xb40c('0xe')](_0xb40c('0x10'),_0xea8c46);return _0x58abf7(null,![],{'message':_0xb40c('0xf')});}return db[_0xb40c('0x11')][_0xb40c('0x12')]({'where':{'id':0x1},'attributes':[_0xb40c('0x13'),'blockDuration'],'raw':!![]})[_0xb40c('0x14')](function(_0x34d195){_0xd430cb=_0x34d195;if(!_0xd430cb[_0xb40c('0x13')]){logger['error'](_0xb40c('0x15'),_0xea8c46);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x10a379[_0xb40c('0x12')]({'attributes':['id',_0xb40c('0x16'),_0xb40c('0x17'),_0xb40c('0x18'),'role',_0xb40c('0x19'),_0xb40c('0x1a'),'blockedAt','online'],'where':{'name':_0xea8c46,'role':{'$or':['admin',_0xb40c('0x1b'),'agent']},'adSsoEnabled':!![]}});})[_0xb40c('0x14')](function(_0x2d5deb){if(!_0x2d5deb||_0x2d5deb&&_0x2d5deb[_0xb40c('0x16')]!==_0xea8c46){throw new Error(_0xb40c('0xf'));}_0x361bfc=_0x2d5deb;var _0x23fe9d=_0x361bfc[_0xb40c('0x16')]+'@'+config[_0xb40c('0xa')][_0xb40c('0x1c')];return adAuthenticate(config[_0xb40c('0xa')],_0x23fe9d,_0xf87a46);})[_0xb40c('0x14')](function(_0x595f48){if(_0x361bfc[_0xb40c('0x19')]){throw new Error(_0xb40c('0xf'));}if(_0xd430cb[_0xb40c('0x1d')]>0x0){if(_0x361bfc[_0xb40c('0x1a')]){if(moment(_0x361bfc[_0xb40c('0x1e')])[_0xb40c('0x1f')](_0xd430cb[_0xb40c('0x1d')],_0xb40c('0x20'))>moment()){throw new Error(_0xb40c('0xf'));}return utils[_0xb40c('0x21')](_0x361bfc,0x0,![],null)['then'](function(){return utils[_0xb40c('0x22')](_0x361bfc);})[_0xb40c('0x14')](function(){return _0x58abf7(null,_0x361bfc);});}else{return utils[_0xb40c('0x22')](_0x361bfc)[_0xb40c('0x14')](function(){return _0x58abf7(null,_0x361bfc);});}}else{return utils[_0xb40c('0x22')](_0x361bfc)[_0xb40c('0x14')](function(){return _0x58abf7(null,_0x361bfc);});}})[_0xb40c('0x23')](function(_0x2cb014){return _0x58abf7(null,![],_0x2cb014);});}function handleError(_0x35e616,_0x1c9cf8,_0x488e17){return _0x35e616[_0xb40c('0x24')](_0x1c9cf8||0x1f4)[_0xb40c('0x25')]({'message':_0x488e17?_0x488e17[_0xb40c('0x26')]||_0x488e17:''});}exports[_0xb40c('0x27')]=function(_0x5b028f,_0xd8223a,_0x2d4d50){passport['authenticate'](_0xb40c('0x28'),function(_0xad5c54,_0x462182,_0x2adeb4){var _0x664af1=_0xad5c54||_0x2adeb4;if(_0x664af1){return handleError(_0xd8223a,0x191,_0x664af1);}if(!_0x462182){return handleError(_0xd8223a,0x194,{'message':_0xb40c('0x29')});}else{var _0x101f73={'payload':{'id':_0x462182['id'],'role':_0x462182[_0xb40c('0x2a')]},'options':{'expiresIn':0x15180}};return authService[_0xb40c('0x2b')](_0x101f73)[_0xb40c('0x14')](function(_0x318c22){_0xd8223a[_0xb40c('0x2c')]({'id':_0x462182['id'],'token':_0x318c22,'statusCall':'','isAlreadyLogged':_0x462182[_0xb40c('0x2d')]});});}})(_0x5b028f,_0xd8223a,_0x2d4d50);};passport[_0xb40c('0x2e')](_0xb40c('0x28'),new LocalStrategy({'usernameField':'name','passwordField':_0xb40c('0x17')},function(_0x4096a3,_0x2d3055,_0x18ce64){return ActiveDirectoryAuthenticate(db['User'],_0x4096a3,_0x2d3055,_0x18ce64);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e7cc55b..5fbf7ef 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 _0x2d72=['login','exports','Router','post'];(function(_0x483e14,_0x51ec0d){var _0x37dc42=function(_0x3f29a3){while(--_0x3f29a3){_0x483e14['push'](_0x483e14['shift']());}};_0x37dc42(++_0x51ec0d);}(_0x2d72,0x18a));var _0x22d7=function(_0x4d9841,_0x23e4ae){_0x4d9841=_0x4d9841-0x0;var _0x3e2cbb=_0x2d72[_0x4d9841];return _0x3e2cbb;};'use strict';var express=require('express');var router=express[_0x22d7('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0x22d7('0x1')]('/',controller[_0x22d7('0x2')]);module[_0x22d7('0x3')]=router; \ No newline at end of file +var _0x1103=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x2fa32c,_0x29b141){var _0x5aaa56=function(_0x1d559f){while(--_0x1d559f){_0x2fa32c['push'](_0x2fa32c['shift']());}};_0x5aaa56(++_0x29b141);}(_0x1103,0x1a6));var _0x3110=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1103[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x3110('0x0'));var router=express[_0x3110('0x1')]();var controller=require(_0x3110('0x2'));router[_0x3110('0x3')]('/',controller[_0x3110('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1de83ba..c2a5ae0 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7a54,0x106));var _0x47a5=function(_0x502e40,_0x2cb37c){_0x502e40=_0x502e40-0x0;var _0x2dc4cc=_0x7a54[_0x502e40];return _0x2dc4cc;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x5a6da4,_0x37e9b8){var _0x39d106=function(_0x7c6642){while(--_0x7c6642){_0x5a6da4['push'](_0x5a6da4['shift']());}};_0x39d106(++_0x37e9b8);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index b909679..c8225fb 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 _0x753b=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','passport','Router','../user/user.controller.js'];(function(_0x2fd796,_0x49d677){var _0x303ea6=function(_0x366a9b){while(--_0x366a9b){_0x2fd796['push'](_0x2fd796['shift']());}};_0x303ea6(++_0x49d677);}(_0x753b,0x18d));var _0xb753=function(_0xfc0021,_0x336a32){_0xfc0021=_0xfc0021-0x0;var _0x5f392c=_0x753b[_0xfc0021];return _0x5f392c;};'use strict';var express=require('express');var passport=require(_0xb753('0x0'));var router=express[_0xb753('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xb753('0x2'));var authService=require(_0xb753('0x3'));router[_0xb753('0x4')]('/',controller[_0xb753('0x5')]);router[_0xb753('0x4')](_0xb753('0x6'),controller[_0xb753('0x7')],authService[_0xb753('0x8')],userController[_0xb753('0x5')],authService[_0xb753('0x9')]);module['exports']=router; \ No newline at end of file +var _0x002c=['../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','setTokenCookie','exports','Router'];(function(_0x57807b,_0x2743fc){var _0x55c624=function(_0x4330ba){while(--_0x4330ba){_0x57807b['push'](_0x57807b['shift']());}};_0x55c624(++_0x2743fc);}(_0x002c,0xe9));var _0xc002=function(_0x9f3e89,_0x39b12c){_0x9f3e89=_0x9f3e89-0x0;var _0x12d365=_0x002c[_0x9f3e89];return _0x12d365;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0xc002('0x0')]();var controller=require('./authGoogle.controller');var userController=require(_0xc002('0x1'));var authService=require(_0xc002('0x2'));router[_0xc002('0x3')]('/',controller[_0xc002('0x4')]);router[_0xc002('0x3')](_0xc002('0x5'),controller[_0xc002('0x6')],authService['isMiddleware'],userController['login'],authService[_0xc002('0x7')]);module[_0xc002('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index dd71b95..7c92d0d 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 _0x0d4b=['lodash','randomstring','moment','../../mysqldb','../../config/utils','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','generate','email','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0x0d4b,0x1d1));var _0xb0d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0d4b[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xb0d4('0x0'));var passport=require(_0xb0d4('0x1'));var LocalStrategy=require(_0xb0d4('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0xb0d4('0x3'));var rs=require(_0xb0d4('0x4'));var moment=require(_0xb0d4('0x5'));var db=require(_0xb0d4('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xb0d4('0x7'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x3ffd21,_0x2e34a2,_0x555ff4,_0x59da75){var _0x296a0e,_0xd22925;return db['Setting'][_0xb0d4('0x8')]({'where':{'id':0x1},'attributes':[_0xb0d4('0x9'),_0xb0d4('0xa')],'raw':!![]})[_0xb0d4('0xb')](function(_0x2df8c4){_0x296a0e=_0x2df8c4;return _0x3ffd21[_0xb0d4('0x8')]({'attributes':['id',_0xb0d4('0xc'),_0xb0d4('0xd'),_0xb0d4('0xe'),_0xb0d4('0xf'),_0xb0d4('0x10'),_0xb0d4('0x11'),_0xb0d4('0x12'),_0xb0d4('0x13')],'where':{'name':_0x2e34a2,'role':{'$or':[_0xb0d4('0x14'),_0xb0d4('0x15'),_0xb0d4('0x16')]}}});})[_0xb0d4('0xb')](function(_0x41665c){if(!_0x41665c||_0x41665c&&_0x41665c['name']!==_0x2e34a2){throw new Error(_0xb0d4('0x17'));}else{_0xd22925=_0x41665c;return _0xd22925;}})[_0xb0d4('0xb')](function(){_0xd22925[_0xb0d4('0x18')](_0x555ff4,function(_0x313713,_0x45585a){var _0xb901cf=_0xd22925[_0xb0d4('0x13')]+0x1;if(_0x313713){return _0x59da75(_0x313713);}else if(!_0x45585a){if(_0xd22925['disabled']){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});}else if(_0x296a0e[_0xb0d4('0x9')]>0x0){if(_0xd22925[_0xb0d4('0x11')]){if(_0x296a0e[_0xb0d4('0xa')]>0x0){if(moment(_0xd22925['blockedAt'])[_0xb0d4('0x19')](_0x296a0e[_0xb0d4('0xa')],_0xb0d4('0x1a'))>moment()){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});}else{return utils[_0xb0d4('0x1b')](_0xd22925,_0xb901cf,![],null)[_0xb0d4('0xb')](function(){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});});}}else{return _0x59da75(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xb901cf>=_0x296a0e['allowedLoginAttempts']){return utils[_0xb0d4('0x1b')](_0xd22925,0x0,!![],moment())[_0xb0d4('0xb')](function(){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});});}else{return utils['clearBlockUser'](_0xd22925,_0xb901cf,![],null)[_0xb0d4('0xb')](function(){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});});}}}else{return _0x59da75(null,![],{'message':_0xb0d4('0x17')});}}else{if(_0xd22925[_0xb0d4('0x10')]){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});}else if(_0x296a0e[_0xb0d4('0x9')]>0x0){if(_0xd22925[_0xb0d4('0x11')]){if(_0x296a0e[_0xb0d4('0xa')]>0x0){if(moment(_0xd22925[_0xb0d4('0x12')])[_0xb0d4('0x19')](_0x296a0e[_0xb0d4('0xa')],'minutes')>moment()){return _0x59da75(null,![],{'message':_0xb0d4('0x17')});}else{return utils[_0xb0d4('0x1b')](_0xd22925,0x0,![],null)[_0xb0d4('0xb')](function(){return utils[_0xb0d4('0x1c')](_0xd22925);})[_0xb0d4('0xb')](function(){return _0x59da75(null,_0xd22925);});}}else{return _0x59da75(null,![],{'message':_0xb0d4('0x17')});}}else{return utils[_0xb0d4('0x1b')](_0xd22925,0x0,![],null)['then'](function(){return utils[_0xb0d4('0x1c')](_0xd22925);})['then'](function(){return _0x59da75(null,_0xd22925);})[_0xb0d4('0x1d')](function(_0x5492ae){return _0x59da75(null,![],_0x5492ae);});}}else{if(_0xd22925['blocked']){return _0x59da75(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb0d4('0x1c')](_0xd22925)[_0xb0d4('0xb')](function(){return _0x59da75(null,_0xd22925);});}}}});})[_0xb0d4('0x1d')](function(_0x244539){return _0x59da75(null,![],_0x244539);});}function sendServiceMail(_0x244960){return db['MailAccount'][_0xb0d4('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xb0d4('0xc'),'email'],'include':[{'model':db[_0xb0d4('0x1f')],'as':_0xb0d4('0x20'),'include':[{'model':db['CloudProvider'],'as':_0xb0d4('0x21')}]}]})['then'](function(_0x2615ab){if(!_0x2615ab){throw new Error(_0xb0d4('0x22'));}var _0x2374ed=_0x2615ab[_0xb0d4('0x23')]();var _0x2c6657={'account':_0x2374ed,'message':_['merge']({'from':util[_0xb0d4('0x24')](_0xb0d4('0x25'),_0x2615ab[_0xb0d4('0xc')],_0x2615ab['email']||_0x2615ab[_0xb0d4('0x20')]['user'])},_0x244960)};return client[_0xb0d4('0x26')]('SendMail',_0x2c6657);})[_0xb0d4('0xb')](function(_0x5cdb58){if(_0x5cdb58[_0xb0d4('0x27')]){throw new Error(util[_0xb0d4('0x24')](_0xb0d4('0x28'),_0x5cdb58[_0xb0d4('0x27')][_0xb0d4('0x29')]||JSON['stringify'](_0x5cdb58[_0xb0d4('0x27')])));}return!![];});}function handleError(_0x4e88cd,_0x3e7661,_0xd2a3db){return _0x4e88cd[_0xb0d4('0x2a')](_0x3e7661||0x1f4)[_0xb0d4('0x2b')]({'message':_0xd2a3db?_0xd2a3db[_0xb0d4('0x29')]||_0xd2a3db:''});}exports[_0xb0d4('0x2c')]=function(_0x1d7d16,_0x4599ee,_0x57a368){passport[_0xb0d4('0x18')](_0xb0d4('0x2d'),function(_0x4d7419,_0x81f13d,_0x3112d0){var _0x271989=_0x4d7419||_0x3112d0;if(_0x271989){return handleError(_0x4599ee,0x191,_0x271989);}if(!_0x81f13d){return handleError(_0x4599ee,0x194,{'message':_0xb0d4('0x2e')});}else{var _0xbd604e={'payload':{'id':_0x81f13d['id'],'role':_0x81f13d[_0xb0d4('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xb0d4('0x2f')](_0xbd604e)[_0xb0d4('0xb')](function(_0x2353b9){_0x4599ee[_0xb0d4('0x30')]({'id':_0x81f13d['id'],'token':_0x2353b9,'statusCall':'','isAlreadyLogged':_0x81f13d['online']});});}})(_0x1d7d16,_0x4599ee,_0x57a368);};exports[_0xb0d4('0x31')]=function(_0x5486f6,_0x14efff){if(!_0x5486f6[_0xb0d4('0x32')]['email']){return handleError(_0x14efff,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2c19ee=rs[_0xb0d4('0x33')]();_0x5486f6['body'][_0xb0d4('0x34')]=_0x5486f6[_0xb0d4('0x32')][_0xb0d4('0x34')]['trim']()[_0xb0d4('0x35')]();var _0x5a9902;return db[_0xb0d4('0x36')][_0xb0d4('0x8')]({'where':{'id':0x1},'attributes':[_0xb0d4('0x9'),'blockDuration'],'raw':!![]})['then'](function(_0x9f7032){_0x5a9902=_0x9f7032;return db[_0xb0d4('0x37')]['find']({'where':{'email':_0x5486f6[_0xb0d4('0x32')][_0xb0d4('0x34')]}});})[_0xb0d4('0xb')](function(_0x208994){if(!_0x208994){throw new Error(_0xb0d4('0x38'));}if(_0x208994[_0xb0d4('0x10')]){throw new Error(_0xb0d4('0x39'));}if(_0x208994[_0xb0d4('0x11')]){if(moment(_0x208994[_0xb0d4('0x12')])[_0xb0d4('0x19')](_0x5a9902['blockDuration'],_0xb0d4('0x1a'))>moment()){throw new Error(_0xb0d4('0x3a'));}else{_0x208994[_0xb0d4('0x11')]=![];_0x208994[_0xb0d4('0x12')]=null;}}_0x208994[_0xb0d4('0x3b')]=_0x2c19ee;_0x208994[_0xb0d4('0x3c')]=Date['now']()+0x36ee80;return _0x208994['save']();})['then'](function(){return sendServiceMail({'to':_0x5486f6['body']['email'],'subject':_0xb0d4('0x3d'),'text':_0xb0d4('0x3e')+_0xb0d4('0x3f')+'https://'+_0x5486f6['headers'][_0xb0d4('0x40')]+_0xb0d4('0x41')+_0x2c19ee+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xb0d4('0xb')](function(){_0x14efff[_0xb0d4('0x2a')](0xc8)[_0xb0d4('0x2b')]({'message':_0xb0d4('0x42')});})['catch'](function(_0x39e9e8){return handleError(_0x14efff,0x1f4,_0x39e9e8);});};exports[_0xb0d4('0x43')]=function(_0x352fe8,_0x15e124){return db['User'][_0xb0d4('0x1e')]({'where':{'resetPasswordToken':_0x352fe8[_0xb0d4('0x44')][_0xb0d4('0x45')],'resetPasswordExpires':{'$gt':Date[_0xb0d4('0x46')]()}}})[_0xb0d4('0xb')](function(_0xcb31ad){if(!_0xcb31ad){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id',_0xb0d4('0x47'),_0xb0d4('0x48'),_0xb0d4('0x49')]})[_0xb0d4('0xb')](function(_0x1ce264){if(_0x1ce264[_0xb0d4('0x47')])authService['validatePasswordPattern'](_0x352fe8[_0xb0d4('0x32')][_0xb0d4('0xd')]);if(!_0x1ce264[_0xb0d4('0x48')]||!_0xcb31ad[_0xb0d4('0x4a')])return _0xcb31ad;authService[_0xb0d4('0x4b')](_0x352fe8[_0xb0d4('0x32')][_0xb0d4('0xd')],_0xcb31ad[_0xb0d4('0x4a')],_0x1ce264[_0xb0d4('0x49')]);return _0xcb31ad;})['then'](function(){_0xcb31ad[_0xb0d4('0xd')]=_0x352fe8['body']['password'];_0xcb31ad[_0xb0d4('0x3b')]=null;_0xcb31ad[_0xb0d4('0x3c')]=null;return _0xcb31ad['save']();});})[_0xb0d4('0xb')](function(){_0x15e124[_0xb0d4('0x2a')](0xc8)[_0xb0d4('0x2b')]({'message':_0xb0d4('0x4c')});})[_0xb0d4('0x1d')](function(_0x1a5cb0){return handleError(_0x15e124,0x1f4,_0x1a5cb0);});};passport[_0xb0d4('0x4d')](_0xb0d4('0x2d'),new LocalStrategy({'usernameField':_0xb0d4('0xc'),'passwordField':_0xb0d4('0xd')},function(_0x43f01a,_0x139b93,_0x3e6120){return localAuthenticate(db[_0xb0d4('0x37')],_0x43f01a,_0x139b93,_0x3e6120);})); \ No newline at end of file +var _0x82f2=['validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','Setting','findOne','allowedLoginAttempts','then','name','password','salt','disabled','blockedAt','admin','user','authenticate','blockDuration','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','blocked','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','Email\x20parameter\x20is\x20missing','generate','body','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','securePassword','passwordHistoryLimit'];(function(_0x5279cf,_0x32f60d){var _0x5de6b1=function(_0x5e7b46){while(--_0x5e7b46){_0x5279cf['push'](_0x5279cf['shift']());}};_0x5de6b1(++_0x32f60d);}(_0x82f2,0x1d9));var _0x282f=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x82f2[_0x1a9204];return _0x17ca68;};'use strict';var util=require(_0x282f('0x0'));var passport=require(_0x282f('0x1'));var LocalStrategy=require(_0x282f('0x2'))[_0x282f('0x3')];var jayson=require('jayson/promise');var _=require(_0x282f('0x4'));var rs=require(_0x282f('0x5'));var moment=require(_0x282f('0x6'));var db=require(_0x282f('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x282f('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x3ad52b,_0x439fca,_0xe0858c,_0x2afa91){var _0x21863e,_0x41ef67;return db[_0x282f('0x9')][_0x282f('0xa')]({'where':{'id':0x1},'attributes':[_0x282f('0xb'),'blockDuration'],'raw':!![]})[_0x282f('0xc')](function(_0x37fd60){_0x21863e=_0x37fd60;return _0x3ad52b[_0x282f('0xa')]({'attributes':['id',_0x282f('0xd'),_0x282f('0xe'),_0x282f('0xf'),'role',_0x282f('0x10'),'blocked',_0x282f('0x11'),'loginAttempts'],'where':{'name':_0x439fca,'role':{'$or':[_0x282f('0x12'),_0x282f('0x13'),'agent']}}});})[_0x282f('0xc')](function(_0x371b4c){if(!_0x371b4c||_0x371b4c&&_0x371b4c['name']!==_0x439fca){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x41ef67=_0x371b4c;return _0x41ef67;}})['then'](function(){_0x41ef67[_0x282f('0x14')](_0xe0858c,function(_0xe43f89,_0x941af2){var _0x52798e=_0x41ef67['loginAttempts']+0x1;if(_0xe43f89){return _0x2afa91(_0xe43f89);}else if(!_0x941af2){if(_0x41ef67[_0x282f('0x10')]){return _0x2afa91(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x21863e[_0x282f('0xb')]>0x0){if(_0x41ef67['blocked']){if(_0x21863e[_0x282f('0x15')]>0x0){if(moment(_0x41ef67['blockedAt'])[_0x282f('0x16')](_0x21863e['blockDuration'],_0x282f('0x17'))>moment()){return _0x2afa91(null,![],{'message':_0x282f('0x18')});}else{return utils[_0x282f('0x19')](_0x41ef67,_0x52798e,![],null)[_0x282f('0xc')](function(){return _0x2afa91(null,![],{'message':_0x282f('0x18')});});}}else{return _0x2afa91(null,![],{'message':_0x282f('0x18')});}}else{if(_0x52798e>=_0x21863e[_0x282f('0xb')]){return utils[_0x282f('0x19')](_0x41ef67,0x0,!![],moment())[_0x282f('0xc')](function(){return _0x2afa91(null,![],{'message':_0x282f('0x18')});});}else{return utils[_0x282f('0x19')](_0x41ef67,_0x52798e,![],null)['then'](function(){return _0x2afa91(null,![],{'message':_0x282f('0x18')});});}}}else{return _0x2afa91(null,![],{'message':_0x282f('0x18')});}}else{if(_0x41ef67[_0x282f('0x10')]){return _0x2afa91(null,![],{'message':_0x282f('0x18')});}else if(_0x21863e[_0x282f('0xb')]>0x0){if(_0x41ef67[_0x282f('0x1a')]){if(_0x21863e[_0x282f('0x15')]>0x0){if(moment(_0x41ef67['blockedAt'])[_0x282f('0x16')](_0x21863e[_0x282f('0x15')],'minutes')>moment()){return _0x2afa91(null,![],{'message':_0x282f('0x18')});}else{return utils['clearBlockUser'](_0x41ef67,0x0,![],null)[_0x282f('0xc')](function(){return utils[_0x282f('0x1b')](_0x41ef67);})[_0x282f('0xc')](function(){return _0x2afa91(null,_0x41ef67);});}}else{return _0x2afa91(null,![],{'message':_0x282f('0x18')});}}else{return utils[_0x282f('0x19')](_0x41ef67,0x0,![],null)[_0x282f('0xc')](function(){return utils[_0x282f('0x1b')](_0x41ef67);})['then'](function(){return _0x2afa91(null,_0x41ef67);})[_0x282f('0x1c')](function(_0x4183c8){return _0x2afa91(null,![],_0x4183c8);});}}else{if(_0x41ef67[_0x282f('0x1a')]){return _0x2afa91(null,![],{'message':_0x282f('0x18')});}else{return utils['getLicense'](_0x41ef67)[_0x282f('0xc')](function(){return _0x2afa91(null,_0x41ef67);});}}}});})[_0x282f('0x1c')](function(_0x584762){return _0x2afa91(null,![],_0x584762);});}function sendServiceMail(_0x2e8ad5){return db[_0x282f('0x1d')][_0x282f('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x282f('0xd'),'email'],'include':[{'model':db[_0x282f('0x1f')],'as':_0x282f('0x20'),'include':[{'model':db[_0x282f('0x21')],'as':_0x282f('0x21')}]}]})[_0x282f('0xc')](function(_0x447f48){if(!_0x447f48){throw new Error(_0x282f('0x22'));}var _0x174970=_0x447f48['getSmtpOptions']();var _0x413f8d={'account':_0x174970,'message':_[_0x282f('0x23')]({'from':util[_0x282f('0x24')](_0x282f('0x25'),_0x447f48[_0x282f('0xd')],_0x447f48[_0x282f('0x26')]||_0x447f48[_0x282f('0x20')][_0x282f('0x13')])},_0x2e8ad5)};return client[_0x282f('0x27')](_0x282f('0x28'),_0x413f8d);})[_0x282f('0xc')](function(_0x15c479){if(_0x15c479['error']){throw new Error(util['format'](_0x282f('0x29'),_0x15c479['error'][_0x282f('0x2a')]||JSON['stringify'](_0x15c479[_0x282f('0x2b')])));}return!![];});}function handleError(_0x1e8fa0,_0x17c751,_0x4b2895){return _0x1e8fa0[_0x282f('0x2c')](_0x17c751||0x1f4)[_0x282f('0x2d')]({'message':_0x4b2895?_0x4b2895['message']||_0x4b2895:''});}exports[_0x282f('0x2e')]=function(_0x166107,_0x2dd817,_0x29f043){passport['authenticate'](_0x282f('0x2f'),function(_0x4116cc,_0x133fb1,_0x3cc49a){var _0x552a92=_0x4116cc||_0x3cc49a;if(_0x552a92){return handleError(_0x2dd817,0x191,_0x552a92);}if(!_0x133fb1){return handleError(_0x2dd817,0x194,{'message':_0x282f('0x30')});}else{var _0x24e01d={'payload':{'id':_0x133fb1['id'],'role':_0x133fb1['role']},'options':{'expiresIn':0x15180}};return authService[_0x282f('0x31')](_0x24e01d)[_0x282f('0xc')](function(_0x37ff72){_0x2dd817[_0x282f('0x32')]({'id':_0x133fb1['id'],'token':_0x37ff72,'statusCall':'','isAlreadyLogged':_0x133fb1['online']});});}})(_0x166107,_0x2dd817,_0x29f043);};exports['forgot']=function(_0x327db9,_0x38796b){if(!_0x327db9['body']['email']){return handleError(_0x38796b,0x1f4,{'message':_0x282f('0x33')});}var _0xcb9cef=rs[_0x282f('0x34')]();_0x327db9[_0x282f('0x35')]['email']=_0x327db9[_0x282f('0x35')][_0x282f('0x26')]['trim']()['toLowerCase']();var _0xa607e2;return db['Setting'][_0x282f('0xa')]({'where':{'id':0x1},'attributes':[_0x282f('0xb'),'blockDuration'],'raw':!![]})[_0x282f('0xc')](function(_0x3682c5){_0xa607e2=_0x3682c5;return db[_0x282f('0x36')][_0x282f('0x1e')]({'where':{'email':_0x327db9[_0x282f('0x35')]['email']}});})['then'](function(_0x15c96e){if(!_0x15c96e){throw new Error(_0x282f('0x37'));}if(_0x15c96e[_0x282f('0x10')]){throw new Error(_0x282f('0x38'));}if(_0x15c96e['blocked']){if(moment(_0x15c96e[_0x282f('0x11')])[_0x282f('0x16')](_0xa607e2['blockDuration'],_0x282f('0x17'))>moment()){throw new Error(_0x282f('0x39'));}else{_0x15c96e[_0x282f('0x1a')]=![];_0x15c96e[_0x282f('0x11')]=null;}}_0x15c96e[_0x282f('0x3a')]=_0xcb9cef;_0x15c96e[_0x282f('0x3b')]=Date[_0x282f('0x3c')]()+0x36ee80;return _0x15c96e[_0x282f('0x3d')]();})[_0x282f('0xc')](function(){return sendServiceMail({'to':_0x327db9[_0x282f('0x35')][_0x282f('0x26')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x282f('0x3e')+_0x282f('0x3f')+'https://'+_0x327db9[_0x282f('0x40')][_0x282f('0x41')]+_0x282f('0x42')+_0xcb9cef+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x282f('0xc')](function(){_0x38796b[_0x282f('0x2c')](0xc8)['send']({'message':_0x282f('0x43')});})[_0x282f('0x1c')](function(_0x34a9ea){return handleError(_0x38796b,0x1f4,_0x34a9ea);});};exports[_0x282f('0x44')]=function(_0x2b4ac0,_0x2f5662){return db['User']['find']({'where':{'resetPasswordToken':_0x2b4ac0[_0x282f('0x45')][_0x282f('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x282f('0xc')](function(_0x5e9967){if(!_0x5e9967){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x282f('0x9')]['findOne']({'attributes':['id',_0x282f('0x47'),'enforcePasswordHistory',_0x282f('0x48')]})[_0x282f('0xc')](function(_0x447e85){if(_0x447e85[_0x282f('0x47')])authService[_0x282f('0x49')](_0x2b4ac0[_0x282f('0x35')][_0x282f('0xe')]);if(!_0x447e85[_0x282f('0x4a')]||!_0x5e9967[_0x282f('0x4b')])return _0x5e9967;authService[_0x282f('0x4c')](_0x2b4ac0[_0x282f('0x35')][_0x282f('0xe')],_0x5e9967[_0x282f('0x4b')],_0x447e85[_0x282f('0x48')]);return _0x5e9967;})[_0x282f('0xc')](function(){_0x5e9967[_0x282f('0xe')]=_0x2b4ac0[_0x282f('0x35')]['password'];_0x5e9967[_0x282f('0x3a')]=null;_0x5e9967[_0x282f('0x3b')]=null;return _0x5e9967[_0x282f('0x3d')]();});})['then'](function(){_0x2f5662['status'](0xc8)[_0x282f('0x2d')]({'message':_0x282f('0x4d')});})['catch'](function(_0x473518){return handleError(_0x2f5662,0x1f4,_0x473518);});};passport['use'](_0x282f('0x2f'),new LocalStrategy({'usernameField':_0x282f('0xd'),'passwordField':_0x282f('0xe')},function(_0x32443c,_0x88e121,_0x32883e){return localAuthenticate(db[_0x282f('0x36')],_0x32443c,_0x88e121,_0x32883e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 04edaf8..c58dc8a 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 _0xb311=['post','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','login'];(function(_0xb9bbc0,_0xb59e73){var _0x4dbd8c=function(_0x46e690){while(--_0x46e690){_0xb9bbc0['push'](_0xb9bbc0['shift']());}};_0x4dbd8c(++_0xb59e73);}(_0xb311,0xd4));var _0x1b31=function(_0x2d89e7,_0x54e72f){_0x2d89e7=_0x2d89e7-0x0;var _0x4ea8e5=_0xb311[_0x2d89e7];return _0x4ea8e5;};'use strict';var express=require(_0x1b31('0x0'));var router=express[_0x1b31('0x1')]();var controller=require(_0x1b31('0x2'));router['post']('/',controller[_0x1b31('0x3')]);router[_0x1b31('0x4')]('/forgot',controller[_0x1b31('0x5')]);router['post'](_0x1b31('0x6'),controller[_0x1b31('0x7')]);module[_0x1b31('0x8')]=router; \ No newline at end of file +var _0xc997=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x21e23d,_0x749755){var _0x423baa=function(_0x175290){while(--_0x175290){_0x21e23d['push'](_0x21e23d['shift']());}};_0x423baa(++_0x749755);}(_0xc997,0x1d4));var _0x7c99=function(_0x56880d,_0x315eb5){_0x56880d=_0x56880d-0x0;var _0x3ebe18=_0xc997[_0x56880d];return _0x3ebe18;};'use strict';var express=require(_0x7c99('0x0'));var router=express[_0x7c99('0x1')]();var controller=require(_0x7c99('0x2'));router[_0x7c99('0x3')]('/',controller[_0x7c99('0x4')]);router[_0x7c99('0x3')](_0x7c99('0x5'),controller[_0x7c99('0x6')]);router[_0x7c99('0x3')](_0x7c99('0x7'),controller[_0x7c99('0x8')]);module[_0x7c99('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5d4a6ef..44fb11c 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 _0xb2dc=['sequelize','exports','STRING','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb2dc,0xf4));var _0xcb2d=function(_0x449eb0,_0x524313){_0x449eb0=_0x449eb0-0x0;var _0x5ddd90=_0xb2dc[_0x449eb0];return _0x5ddd90;};'use strict';var Sequelize=require(_0xcb2d('0x0'));module[_0xcb2d('0x1')]={'name':{'type':Sequelize[_0xcb2d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xcb2d('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xcb2d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x18d2=['STRING','sequelize','exports'];(function(_0x4b4d57,_0x2dcdc9){var _0x381427=function(_0x320ea4){while(--_0x320ea4){_0x4b4d57['push'](_0x4b4d57['shift']());}};_0x381427(++_0x2dcdc9);}(_0x18d2,0xb8));var _0x218d=function(_0x23366c,_0x3a9391){_0x23366c=_0x23366c-0x0;var _0x58c67e=_0x18d2[_0x23366c];return _0x58c67e;};'use strict';var Sequelize=require(_0x218d('0x0'));module[_0x218d('0x1')]={'name':{'type':Sequelize[_0x218d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x218d('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fe96cbc..efc4633 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 _0x100d=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','Automation','includeAll','include','findAll','show','length','catch','create','body','find','params','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','pick','rimraf','zip-dir','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x295141,_0xd07cb4){var _0x37e33d=function(_0x237686){while(--_0x237686){_0x295141['push'](_0x295141['shift']());}};_0x37e33d(++_0xd07cb4);}(_0x100d,0x132));var _0xd100=function(_0xbf5c1,_0x406a67){_0xbf5c1=_0xbf5c1-0x0;var _0x5a016d=_0x100d[_0xbf5c1];return _0x5a016d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd100('0x0'));var zipdir=require(_0xd100('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd100('0x2'));var util=require('util');var path=require('path');var sox=require(_0xd100('0x3'));var csv=require('to-csv');var ejs=require(_0xd100('0x4'));var fs=require('fs');var fs_extra=require(_0xd100('0x5'));var _=require(_0xd100('0x6'));var squel=require('squel');var crypto=require(_0xd100('0x7'));var jsforce=require(_0xd100('0x8'));var deskjs=require(_0xd100('0x9'));var toCsv=require(_0xd100('0xa'));var querystring=require(_0xd100('0xb'));var Papa=require(_0xd100('0xc'));var Redis=require(_0xd100('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd100('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd100('0xf'))(_0xd100('0x10'));var utils=require(_0xd100('0x11'));var config=require(_0xd100('0x12'));var licenseUtil=require(_0xd100('0x13'));var db=require(_0xd100('0x14'))['db'];function respondWithStatusCode(_0x229a49,_0x29e3c6){_0x29e3c6=_0x29e3c6||0xcc;return function(_0x5608d7){if(_0x5608d7){return _0x229a49['sendStatus'](_0x29e3c6);}return _0x229a49['status'](_0x29e3c6)[_0xd100('0x15')]();};}function respondWithResult(_0x540551,_0xb56b9d){_0xb56b9d=_0xb56b9d||0xc8;return function(_0x4eb803){if(_0x4eb803){return _0x540551[_0xd100('0x16')](_0xb56b9d)[_0xd100('0x17')](_0x4eb803);}};}function respondWithFilteredResult(_0x578b7e,_0x5b3e43){return function(_0x465735){if(_0x465735){var _0x4a2da8=typeof _0x5b3e43[_0xd100('0x18')]==='undefined'&&typeof _0x5b3e43[_0xd100('0x19')]==='undefined';var _0x4949ca=_0x465735['count'];var _0x461e39=_0x4a2da8?0x0:_0x5b3e43['offset'];var _0x4004df=_0x4a2da8?_0x465735[_0xd100('0x1a')]:_0x5b3e43[_0xd100('0x18')]+_0x5b3e43['limit'];var _0x22f367;if(_0x4004df>=_0x4949ca){_0x4004df=_0x4949ca;_0x22f367=0xc8;}else{_0x22f367=0xce;}_0x578b7e[_0xd100('0x16')](_0x22f367);return _0x578b7e[_0xd100('0x1b')](_0xd100('0x1c'),_0x461e39+'-'+_0x4004df+'/'+_0x4949ca)[_0xd100('0x17')](_0x465735);}return null;};}function patchUpdates(_0x503b83){return function(_0x51cc3f){try{jsonpatch[_0xd100('0x1d')](_0x51cc3f,_0x503b83,!![]);}catch(_0x4c2aa3){return BPromise['reject'](_0x4c2aa3);}return _0x51cc3f[_0xd100('0x1e')]();};}function saveUpdates(_0x42aff2,_0x2886a1){return function(_0x1cc085){if(_0x1cc085){return _0x1cc085[_0xd100('0x1f')](_0x42aff2)['then'](function(_0x1bca00){return _0x1bca00;});}return null;};}function removeEntity(_0x837dba,_0x360d38){return function(_0x5d36df){if(_0x5d36df){return _0x5d36df[_0xd100('0x20')]()[_0xd100('0x21')](function(){_0x837dba[_0xd100('0x16')](0xcc)[_0xd100('0x15')]();});}};}function handleEntityNotFound(_0x52acec,_0x12edd9){return function(_0x4c0a2a){if(!_0x4c0a2a){_0x52acec[_0xd100('0x22')](0x194);}return _0x4c0a2a;};}function handleError(_0x2ddb22,_0xeb0daf){_0xeb0daf=_0xeb0daf||0x1f4;return function(_0x5d6520){logger['error'](_0x5d6520[_0xd100('0x23')]);if(_0x5d6520['name']){delete _0x5d6520[_0xd100('0x24')];}_0x2ddb22['status'](_0xeb0daf)['send'](_0x5d6520);};}exports['index']=function(_0x5174a7,_0xe758b4){var _0x202f75={},_0xc5ad33={},_0x460a06={'count':0x0,'rows':[]};var _0x32135c=_[_0xd100('0x25')](db['Automation'][_0xd100('0x26')],function(_0x1f0885){return{'name':_0x1f0885[_0xd100('0x27')],'type':_0x1f0885[_0xd100('0x28')][_0xd100('0x29')]};});_0xc5ad33[_0xd100('0x2a')]=_['map'](_0x32135c,_0xd100('0x24'));_0xc5ad33[_0xd100('0x2b')]=_[_0xd100('0x2c')](_0x5174a7['query']);_0xc5ad33[_0xd100('0x2d')]=_[_0xd100('0x2e')](_0xc5ad33[_0xd100('0x2a')],_0xc5ad33[_0xd100('0x2b')]);_0x202f75[_0xd100('0x2f')]=_[_0xd100('0x2e')](_0xc5ad33[_0xd100('0x2a')],qs['fields'](_0x5174a7['query'][_0xd100('0x30')]));_0x202f75[_0xd100('0x2f')]=_0x202f75[_0xd100('0x2f')]['length']?_0x202f75['attributes']:_0xc5ad33[_0xd100('0x2a')];if(!_0x5174a7[_0xd100('0x2b')][_0xd100('0x31')](_0xd100('0x32'))){_0x202f75[_0xd100('0x19')]=qs['limit'](_0x5174a7['query'][_0xd100('0x19')]);_0x202f75['offset']=qs[_0xd100('0x18')](_0x5174a7['query']['offset']);}_0x202f75[_0xd100('0x33')]=qs[_0xd100('0x34')](_0x5174a7[_0xd100('0x2b')][_0xd100('0x34')]);_0x202f75['where']=qs[_0xd100('0x2d')](_['pick'](_0x5174a7[_0xd100('0x2b')],_0xc5ad33[_0xd100('0x2d')]),_0x32135c);if(_0x5174a7['query'][_0xd100('0x35')]){_0x202f75['where']=_[_0xd100('0x36')](_0x202f75['where'],{'$or':_['map'](_0x32135c,function(_0x28ef37){if(_0x28ef37[_0xd100('0x28')]!==_0xd100('0x37')){var _0x1aed28={};_0x1aed28[_0x28ef37[_0xd100('0x24')]]={'$like':'%'+_0x5174a7['query'][_0xd100('0x35')]+'%'};return _0x1aed28;}})});}_0x202f75=_[_0xd100('0x36')]({},_0x202f75,_0x5174a7[_0xd100('0x38')]);var _0x41e6ee={'where':_0x202f75[_0xd100('0x39')]};return db[_0xd100('0x3a')][_0xd100('0x1a')](_0x41e6ee)[_0xd100('0x21')](function(_0x1720b){_0x460a06[_0xd100('0x1a')]=_0x1720b;if(_0x5174a7['query'][_0xd100('0x3b')]){_0x202f75[_0xd100('0x3c')]=[{'all':!![]}];}return db[_0xd100('0x3a')][_0xd100('0x3d')](_0x202f75);})[_0xd100('0x21')](function(_0x39047f){_0x460a06['rows']=_0x39047f;return _0x460a06;})[_0xd100('0x21')](respondWithFilteredResult(_0xe758b4,_0x202f75))['catch'](handleError(_0xe758b4,null));};exports[_0xd100('0x3e')]=function(_0x14ee7d,_0x2c4b30){var _0x2edf6f={'raw':![],'where':{'id':_0x14ee7d['params']['id']}},_0x15a423={};_0x15a423[_0xd100('0x2a')]=_[_0xd100('0x2c')](db['Automation'][_0xd100('0x26')]);_0x15a423[_0xd100('0x2b')]=_[_0xd100('0x2c')](_0x14ee7d[_0xd100('0x2b')]);_0x15a423[_0xd100('0x2d')]=_['intersection'](_0x15a423[_0xd100('0x2a')],_0x15a423['query']);_0x2edf6f[_0xd100('0x2f')]=_[_0xd100('0x2e')](_0x15a423[_0xd100('0x2a')],qs[_0xd100('0x30')](_0x14ee7d[_0xd100('0x2b')][_0xd100('0x30')]));_0x2edf6f['attributes']=_0x2edf6f[_0xd100('0x2f')][_0xd100('0x3f')]?_0x2edf6f[_0xd100('0x2f')]:_0x15a423[_0xd100('0x2a')];if(_0x14ee7d[_0xd100('0x2b')]['includeAll']){_0x2edf6f[_0xd100('0x3c')]=[{'all':!![]}];}_0x2edf6f=_[_0xd100('0x36')]({},_0x2edf6f,_0x14ee7d[_0xd100('0x38')]);return db[_0xd100('0x3a')]['find'](_0x2edf6f)[_0xd100('0x21')](handleEntityNotFound(_0x2c4b30,null))[_0xd100('0x21')](respondWithResult(_0x2c4b30,null))[_0xd100('0x40')](handleError(_0x2c4b30,null));};exports[_0xd100('0x41')]=function(_0x3a1977,_0x4f20c5){return db[_0xd100('0x3a')]['create'](_0x3a1977[_0xd100('0x42')],{})[_0xd100('0x21')](respondWithResult(_0x4f20c5,0xc9))[_0xd100('0x40')](handleError(_0x4f20c5,null));};exports['update']=function(_0x2f8147,_0x168494){if(_0x2f8147[_0xd100('0x42')]['id']){delete _0x2f8147[_0xd100('0x42')]['id'];}return db['Automation'][_0xd100('0x43')]({'where':{'id':_0x2f8147[_0xd100('0x44')]['id']}})[_0xd100('0x21')](handleEntityNotFound(_0x168494,null))['then'](saveUpdates(_0x2f8147['body'],null))[_0xd100('0x21')](respondWithResult(_0x168494,null))[_0xd100('0x40')](handleError(_0x168494,null));};exports[_0xd100('0x20')]=function(_0x45363c,_0x183d1d){return db[_0xd100('0x3a')]['find']({'where':{'id':_0x45363c[_0xd100('0x44')]['id']}})[_0xd100('0x21')](handleEntityNotFound(_0x183d1d,null))['then'](removeEntity(_0x183d1d,null))[_0xd100('0x40')](handleError(_0x183d1d,null));};exports[_0xd100('0x45')]=function(_0x5660ba,_0x5c1cc2,_0x5c73b5){return db[_0xd100('0x46')][_0xd100('0x43')]({'where':{'id':_0x5660ba['params']['id']}})[_0xd100('0x21')](handleEntityNotFound(_0x5c1cc2,null))['then'](function(_0x4b46a9){if(_0x4b46a9){return _0x4b46a9[_0xd100('0x45')](_0x5660ba[_0xd100('0x42')]['ids'],_[_0xd100('0x47')](_0x5660ba[_0xd100('0x42')],[_0xd100('0x48'),'id'])||{});}})[_0xd100('0x21')](respondWithResult(_0x5c1cc2,null))['catch'](handleError(_0x5c1cc2,null));};exports[_0xd100('0x49')]=function(_0x18d58e,_0x54b3d7,_0x8e663a){var _0xb56b42={};var _0x59d710={};var _0xe57052;var _0x13193d;return db[_0xd100('0x3a')][_0xd100('0x4a')]({'where':{'id':_0x18d58e[_0xd100('0x44')]['id']}})['then'](handleEntityNotFound(_0x54b3d7,null))[_0xd100('0x21')](function(_0x53340a){if(_0x53340a){_0xe57052=_0x53340a;_0x59d710[_0xd100('0x2a')]=_[_0xd100('0x2c')](db['Condition'][_0xd100('0x26')]);_0x59d710[_0xd100('0x2b')]=_['keys'](_0x18d58e[_0xd100('0x2b')]);_0x59d710[_0xd100('0x2d')]=_[_0xd100('0x2e')](_0x59d710[_0xd100('0x2a')],_0x59d710[_0xd100('0x2b')]);_0xb56b42[_0xd100('0x2f')]=_[_0xd100('0x2e')](_0x59d710[_0xd100('0x2a')],qs['fields'](_0x18d58e[_0xd100('0x2b')][_0xd100('0x30')]));_0xb56b42[_0xd100('0x2f')]=_0xb56b42[_0xd100('0x2f')]['length']?_0xb56b42[_0xd100('0x2f')]:_0x59d710['model'];_0xb56b42[_0xd100('0x33')]=qs[_0xd100('0x34')](_0x18d58e[_0xd100('0x2b')][_0xd100('0x34')]);_0xb56b42[_0xd100('0x39')]=qs[_0xd100('0x2d')](_['pick'](_0x18d58e['query'],_0x59d710[_0xd100('0x2d')]));if(_0x18d58e[_0xd100('0x2b')][_0xd100('0x35')]){_0xb56b42['where']=_[_0xd100('0x36')](_0xb56b42[_0xd100('0x39')],{'$or':_[_0xd100('0x25')](_0xb56b42[_0xd100('0x2f')],function(_0x274e06){var _0x10428d={};_0x10428d[_0x274e06]={'$like':'%'+_0x18d58e[_0xd100('0x2b')][_0xd100('0x35')]+'%'};return _0x10428d;})});}_0xb56b42=_[_0xd100('0x36')]({},_0xb56b42,_0x18d58e[_0xd100('0x38')]);return _0xe57052[_0xd100('0x49')](_0xb56b42);}})[_0xd100('0x21')](function(_0x5d92a4){if(_0x5d92a4){_0x13193d=_0x5d92a4[_0xd100('0x3f')];if(!_0x18d58e[_0xd100('0x2b')][_0xd100('0x31')](_0xd100('0x32'))){_0xb56b42[_0xd100('0x19')]=qs[_0xd100('0x19')](_0x18d58e[_0xd100('0x2b')][_0xd100('0x19')]);_0xb56b42[_0xd100('0x18')]=qs['offset'](_0x18d58e[_0xd100('0x2b')][_0xd100('0x18')]);}return _0xe57052[_0xd100('0x49')](_0xb56b42);}})[_0xd100('0x21')](function(_0x40f57d){if(_0x40f57d){return _0x40f57d?{'count':_0x13193d,'rows':_0x40f57d}:null;}})[_0xd100('0x21')](respondWithResult(_0x54b3d7,null))[_0xd100('0x40')](handleError(_0x54b3d7,null));};exports[_0xd100('0x4b')]=function(_0x3f7238,_0x153382,_0x1c60b6){return db[_0xd100('0x4c')][_0xd100('0x43')]({'where':{'id':_0x3f7238[_0xd100('0x44')]['id']}})[_0xd100('0x21')](handleEntityNotFound(_0x153382,null))[_0xd100('0x21')](function(_0x111829){if(_0x111829){return _0x111829[_0xd100('0x4b')](_0x3f7238['body'][_0xd100('0x48')],_[_0xd100('0x47')](_0x3f7238[_0xd100('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x153382,null))[_0xd100('0x40')](handleError(_0x153382,null));};exports[_0xd100('0x4d')]=function(_0x52733c,_0x19e6d9,_0x328467){var _0x28c9f0={};var _0x3ff72f={};var _0x3fff9c;var _0x9d9f27;return db['Automation'][_0xd100('0x4a')]({'where':{'id':_0x52733c[_0xd100('0x44')]['id']}})[_0xd100('0x21')](handleEntityNotFound(_0x19e6d9,null))['then'](function(_0x224bb7){if(_0x224bb7){_0x3fff9c=_0x224bb7;_0x3ff72f['model']=_['keys'](db[_0xd100('0x4c')][_0xd100('0x26')]);_0x3ff72f[_0xd100('0x2b')]=_[_0xd100('0x2c')](_0x52733c['query']);_0x3ff72f[_0xd100('0x2d')]=_['intersection'](_0x3ff72f[_0xd100('0x2a')],_0x3ff72f[_0xd100('0x2b')]);_0x28c9f0[_0xd100('0x2f')]=_[_0xd100('0x2e')](_0x3ff72f[_0xd100('0x2a')],qs[_0xd100('0x30')](_0x52733c[_0xd100('0x2b')][_0xd100('0x30')]));_0x28c9f0[_0xd100('0x2f')]=_0x28c9f0[_0xd100('0x2f')][_0xd100('0x3f')]?_0x28c9f0[_0xd100('0x2f')]:_0x3ff72f[_0xd100('0x2a')];_0x28c9f0['order']=qs['sort'](_0x52733c[_0xd100('0x2b')][_0xd100('0x34')]);_0x28c9f0[_0xd100('0x39')]=qs[_0xd100('0x2d')](_[_0xd100('0x4e')](_0x52733c[_0xd100('0x2b')],_0x3ff72f['filters']));if(_0x52733c[_0xd100('0x2b')]['filter']){_0x28c9f0[_0xd100('0x39')]=_[_0xd100('0x36')](_0x28c9f0[_0xd100('0x39')],{'$or':_['map'](_0x28c9f0[_0xd100('0x2f')],function(_0x387b8c){var _0x2b34b1={};_0x2b34b1[_0x387b8c]={'$like':'%'+_0x52733c[_0xd100('0x2b')][_0xd100('0x35')]+'%'};return _0x2b34b1;})});}_0x28c9f0=_[_0xd100('0x36')]({},_0x28c9f0,_0x52733c[_0xd100('0x38')]);return _0x3fff9c[_0xd100('0x4d')](_0x28c9f0);}})[_0xd100('0x21')](function(_0x4dc068){if(_0x4dc068){_0x9d9f27=_0x4dc068[_0xd100('0x3f')];if(!_0x52733c['query']['hasOwnProperty']('nolimit')){_0x28c9f0[_0xd100('0x19')]=qs[_0xd100('0x19')](_0x52733c[_0xd100('0x2b')][_0xd100('0x19')]);_0x28c9f0[_0xd100('0x18')]=qs[_0xd100('0x18')](_0x52733c['query'][_0xd100('0x18')]);}return _0x3fff9c[_0xd100('0x4d')](_0x28c9f0);}})['then'](function(_0x3bb54e){if(_0x3bb54e){return _0x3bb54e?{'count':_0x9d9f27,'rows':_0x3bb54e}:null;}})[_0xd100('0x21')](respondWithResult(_0x19e6d9,null))[_0xd100('0x40')](handleError(_0x19e6d9,null));}; \ No newline at end of file +var _0x88ea=['moment','bluebird','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','rawAttributes','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','Automation','includeAll','include','findAll','rows','catch','create','body','find','params','destroy','addConditions','Condition','ids','omit','getConditions','findOne','order','addActions','getActions','Action','pick','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88ea,0xf2));var _0xa88e=function(_0x3ea4aa,_0x4eb554){_0x3ea4aa=_0x3ea4aa-0x0;var _0x22da9c=_0x88ea[_0x3ea4aa];return _0x22da9c;};'use strict';var emlformat=require(_0xa88e('0x0'));var rimraf=require(_0xa88e('0x1'));var zipdir=require(_0xa88e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa88e('0x3'));var moment=require(_0xa88e('0x4'));var BPromise=require(_0xa88e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa88e('0x6'));var csv=require('to-csv');var ejs=require(_0xa88e('0x7'));var fs=require('fs');var fs_extra=require(_0xa88e('0x8'));var _=require('lodash');var squel=require(_0xa88e('0x9'));var crypto=require('crypto');var jsforce=require(_0xa88e('0xa'));var deskjs=require(_0xa88e('0xb'));var toCsv=require(_0xa88e('0xc'));var querystring=require('querystring');var Papa=require(_0xa88e('0xd'));var Redis=require('ioredis');var authService=require(_0xa88e('0xe'));var qs=require(_0xa88e('0xf'));var as=require(_0xa88e('0x10'));var hardwareService=require(_0xa88e('0x11'));var logger=require(_0xa88e('0x12'))(_0xa88e('0x13'));var utils=require('../../config/utils');var config=require(_0xa88e('0x14'));var licenseUtil=require(_0xa88e('0x15'));var db=require(_0xa88e('0x16'))['db'];function respondWithStatusCode(_0x4edcb3,_0x14d75c){_0x14d75c=_0x14d75c||0xcc;return function(_0x55b5b0){if(_0x55b5b0){return _0x4edcb3[_0xa88e('0x17')](_0x14d75c);}return _0x4edcb3[_0xa88e('0x18')](_0x14d75c)[_0xa88e('0x19')]();};}function respondWithResult(_0x5d8cd0,_0x18757b){_0x18757b=_0x18757b||0xc8;return function(_0x1bda9f){if(_0x1bda9f){return _0x5d8cd0[_0xa88e('0x18')](_0x18757b)[_0xa88e('0x1a')](_0x1bda9f);}};}function respondWithFilteredResult(_0x3b2b9b,_0x411b53){return function(_0x4720a6){if(_0x4720a6){var _0x89c590=typeof _0x411b53[_0xa88e('0x1b')]===_0xa88e('0x1c')&&typeof _0x411b53[_0xa88e('0x1d')]===_0xa88e('0x1c');var _0x516233=_0x4720a6[_0xa88e('0x1e')];var _0x2731ea=_0x89c590?0x0:_0x411b53[_0xa88e('0x1b')];var _0x3ea384=_0x89c590?_0x4720a6['count']:_0x411b53[_0xa88e('0x1b')]+_0x411b53['limit'];var _0x16a02e;if(_0x3ea384>=_0x516233){_0x3ea384=_0x516233;_0x16a02e=0xc8;}else{_0x16a02e=0xce;}_0x3b2b9b[_0xa88e('0x18')](_0x16a02e);return _0x3b2b9b[_0xa88e('0x1f')]('Content-Range',_0x2731ea+'-'+_0x3ea384+'/'+_0x516233)[_0xa88e('0x1a')](_0x4720a6);}return null;};}function patchUpdates(_0x119fca){return function(_0x59fd33){try{jsonpatch[_0xa88e('0x20')](_0x59fd33,_0x119fca,!![]);}catch(_0x2bd31c){return BPromise['reject'](_0x2bd31c);}return _0x59fd33[_0xa88e('0x21')]();};}function saveUpdates(_0x42bf2d,_0x235521){return function(_0x140231){if(_0x140231){return _0x140231[_0xa88e('0x22')](_0x42bf2d)[_0xa88e('0x23')](function(_0x24cf8b){return _0x24cf8b;});}return null;};}function removeEntity(_0x54e460,_0x553363){return function(_0x154fe1){if(_0x154fe1){return _0x154fe1['destroy']()[_0xa88e('0x23')](function(){_0x54e460[_0xa88e('0x18')](0xcc)[_0xa88e('0x19')]();});}};}function handleEntityNotFound(_0xf081bb,_0x26b93b){return function(_0x3dd3c5){if(!_0x3dd3c5){_0xf081bb[_0xa88e('0x17')](0x194);}return _0x3dd3c5;};}function handleError(_0x257730,_0x300e0b){_0x300e0b=_0x300e0b||0x1f4;return function(_0x2ab6d8){logger[_0xa88e('0x24')](_0x2ab6d8[_0xa88e('0x25')]);if(_0x2ab6d8[_0xa88e('0x26')]){delete _0x2ab6d8[_0xa88e('0x26')];}_0x257730[_0xa88e('0x18')](_0x300e0b)[_0xa88e('0x27')](_0x2ab6d8);};}exports[_0xa88e('0x28')]=function(_0x22a963,_0x52f6e5){var _0x5e9bb0={},_0x36e8df={},_0x18b862={'count':0x0,'rows':[]};var _0x3348dd=_['map'](db['Automation'][_0xa88e('0x29')],function(_0x4ea650){return{'name':_0x4ea650['fieldName'],'type':_0x4ea650['type'][_0xa88e('0x2a')]};});_0x36e8df['model']=_[_0xa88e('0x2b')](_0x3348dd,_0xa88e('0x26'));_0x36e8df[_0xa88e('0x2c')]=_[_0xa88e('0x2d')](_0x22a963[_0xa88e('0x2c')]);_0x36e8df['filters']=_[_0xa88e('0x2e')](_0x36e8df[_0xa88e('0x2f')],_0x36e8df[_0xa88e('0x2c')]);_0x5e9bb0['attributes']=_['intersection'](_0x36e8df[_0xa88e('0x2f')],qs[_0xa88e('0x30')](_0x22a963[_0xa88e('0x2c')][_0xa88e('0x30')]));_0x5e9bb0[_0xa88e('0x31')]=_0x5e9bb0[_0xa88e('0x31')][_0xa88e('0x32')]?_0x5e9bb0[_0xa88e('0x31')]:_0x36e8df[_0xa88e('0x2f')];if(!_0x22a963[_0xa88e('0x2c')][_0xa88e('0x33')](_0xa88e('0x34'))){_0x5e9bb0['limit']=qs[_0xa88e('0x1d')](_0x22a963[_0xa88e('0x2c')][_0xa88e('0x1d')]);_0x5e9bb0['offset']=qs[_0xa88e('0x1b')](_0x22a963[_0xa88e('0x2c')]['offset']);}_0x5e9bb0['order']=qs[_0xa88e('0x35')](_0x22a963[_0xa88e('0x2c')][_0xa88e('0x35')]);_0x5e9bb0['where']=qs[_0xa88e('0x36')](_['pick'](_0x22a963[_0xa88e('0x2c')],_0x36e8df['filters']),_0x3348dd);if(_0x22a963[_0xa88e('0x2c')][_0xa88e('0x37')]){_0x5e9bb0['where']=_['merge'](_0x5e9bb0[_0xa88e('0x38')],{'$or':_['map'](_0x3348dd,function(_0x2ea6ce){if(_0x2ea6ce['type']!==_0xa88e('0x39')){var _0x2cabbc={};_0x2cabbc[_0x2ea6ce[_0xa88e('0x26')]]={'$like':'%'+_0x22a963[_0xa88e('0x2c')]['filter']+'%'};return _0x2cabbc;}})});}_0x5e9bb0=_[_0xa88e('0x3a')]({},_0x5e9bb0,_0x22a963[_0xa88e('0x3b')]);var _0x1c9e8f={'where':_0x5e9bb0['where']};return db[_0xa88e('0x3c')][_0xa88e('0x1e')](_0x1c9e8f)['then'](function(_0x28dc98){_0x18b862[_0xa88e('0x1e')]=_0x28dc98;if(_0x22a963[_0xa88e('0x2c')][_0xa88e('0x3d')]){_0x5e9bb0[_0xa88e('0x3e')]=[{'all':!![]}];}return db[_0xa88e('0x3c')][_0xa88e('0x3f')](_0x5e9bb0);})['then'](function(_0x2c9380){_0x18b862[_0xa88e('0x40')]=_0x2c9380;return _0x18b862;})['then'](respondWithFilteredResult(_0x52f6e5,_0x5e9bb0))[_0xa88e('0x41')](handleError(_0x52f6e5,null));};exports['show']=function(_0x38afbd,_0x4acd8b){var _0x1297cb={'raw':![],'where':{'id':_0x38afbd['params']['id']}},_0xf935a3={};_0xf935a3[_0xa88e('0x2f')]=_['keys'](db[_0xa88e('0x3c')][_0xa88e('0x29')]);_0xf935a3[_0xa88e('0x2c')]=_[_0xa88e('0x2d')](_0x38afbd[_0xa88e('0x2c')]);_0xf935a3[_0xa88e('0x36')]=_[_0xa88e('0x2e')](_0xf935a3['model'],_0xf935a3[_0xa88e('0x2c')]);_0x1297cb[_0xa88e('0x31')]=_[_0xa88e('0x2e')](_0xf935a3[_0xa88e('0x2f')],qs['fields'](_0x38afbd['query'][_0xa88e('0x30')]));_0x1297cb[_0xa88e('0x31')]=_0x1297cb[_0xa88e('0x31')]['length']?_0x1297cb[_0xa88e('0x31')]:_0xf935a3[_0xa88e('0x2f')];if(_0x38afbd[_0xa88e('0x2c')][_0xa88e('0x3d')]){_0x1297cb[_0xa88e('0x3e')]=[{'all':!![]}];}_0x1297cb=_[_0xa88e('0x3a')]({},_0x1297cb,_0x38afbd[_0xa88e('0x3b')]);return db[_0xa88e('0x3c')]['find'](_0x1297cb)[_0xa88e('0x23')](handleEntityNotFound(_0x4acd8b,null))[_0xa88e('0x23')](respondWithResult(_0x4acd8b,null))[_0xa88e('0x41')](handleError(_0x4acd8b,null));};exports[_0xa88e('0x42')]=function(_0x37aad8,_0x3bfb38){return db['Automation'][_0xa88e('0x42')](_0x37aad8[_0xa88e('0x43')],{})[_0xa88e('0x23')](respondWithResult(_0x3bfb38,0xc9))[_0xa88e('0x41')](handleError(_0x3bfb38,null));};exports[_0xa88e('0x22')]=function(_0x10c44d,_0x592491){if(_0x10c44d[_0xa88e('0x43')]['id']){delete _0x10c44d[_0xa88e('0x43')]['id'];}return db[_0xa88e('0x3c')][_0xa88e('0x44')]({'where':{'id':_0x10c44d[_0xa88e('0x45')]['id']}})['then'](handleEntityNotFound(_0x592491,null))[_0xa88e('0x23')](saveUpdates(_0x10c44d[_0xa88e('0x43')],null))[_0xa88e('0x23')](respondWithResult(_0x592491,null))[_0xa88e('0x41')](handleError(_0x592491,null));};exports[_0xa88e('0x46')]=function(_0x449331,_0x262b3a){return db['Automation'][_0xa88e('0x44')]({'where':{'id':_0x449331[_0xa88e('0x45')]['id']}})[_0xa88e('0x23')](handleEntityNotFound(_0x262b3a,null))[_0xa88e('0x23')](removeEntity(_0x262b3a,null))[_0xa88e('0x41')](handleError(_0x262b3a,null));};exports[_0xa88e('0x47')]=function(_0x199ec0,_0x3e126c,_0x12764c){return db[_0xa88e('0x48')][_0xa88e('0x44')]({'where':{'id':_0x199ec0[_0xa88e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e126c,null))[_0xa88e('0x23')](function(_0x55b131){if(_0x55b131){return _0x55b131[_0xa88e('0x47')](_0x199ec0[_0xa88e('0x43')][_0xa88e('0x49')],_[_0xa88e('0x4a')](_0x199ec0['body'],[_0xa88e('0x49'),'id'])||{});}})[_0xa88e('0x23')](respondWithResult(_0x3e126c,null))['catch'](handleError(_0x3e126c,null));};exports[_0xa88e('0x4b')]=function(_0x3c7966,_0x42cceb,_0x2667d8){var _0x48e39e={};var _0x54c268={};var _0x32e704;var _0x15a3a4;return db[_0xa88e('0x3c')][_0xa88e('0x4c')]({'where':{'id':_0x3c7966[_0xa88e('0x45')]['id']}})['then'](handleEntityNotFound(_0x42cceb,null))['then'](function(_0x5c966c){if(_0x5c966c){_0x32e704=_0x5c966c;_0x54c268['model']=_[_0xa88e('0x2d')](db[_0xa88e('0x48')]['rawAttributes']);_0x54c268['query']=_[_0xa88e('0x2d')](_0x3c7966[_0xa88e('0x2c')]);_0x54c268[_0xa88e('0x36')]=_[_0xa88e('0x2e')](_0x54c268[_0xa88e('0x2f')],_0x54c268[_0xa88e('0x2c')]);_0x48e39e[_0xa88e('0x31')]=_[_0xa88e('0x2e')](_0x54c268['model'],qs[_0xa88e('0x30')](_0x3c7966[_0xa88e('0x2c')]['fields']));_0x48e39e[_0xa88e('0x31')]=_0x48e39e['attributes']['length']?_0x48e39e[_0xa88e('0x31')]:_0x54c268[_0xa88e('0x2f')];_0x48e39e[_0xa88e('0x4d')]=qs[_0xa88e('0x35')](_0x3c7966[_0xa88e('0x2c')][_0xa88e('0x35')]);_0x48e39e[_0xa88e('0x38')]=qs['filters'](_['pick'](_0x3c7966[_0xa88e('0x2c')],_0x54c268[_0xa88e('0x36')]));if(_0x3c7966[_0xa88e('0x2c')][_0xa88e('0x37')]){_0x48e39e[_0xa88e('0x38')]=_[_0xa88e('0x3a')](_0x48e39e[_0xa88e('0x38')],{'$or':_[_0xa88e('0x2b')](_0x48e39e[_0xa88e('0x31')],function(_0x3ec8e6){var _0x1fbf75={};_0x1fbf75[_0x3ec8e6]={'$like':'%'+_0x3c7966['query']['filter']+'%'};return _0x1fbf75;})});}_0x48e39e=_['merge']({},_0x48e39e,_0x3c7966['options']);return _0x32e704['getConditions'](_0x48e39e);}})[_0xa88e('0x23')](function(_0x188f93){if(_0x188f93){_0x15a3a4=_0x188f93['length'];if(!_0x3c7966['query'][_0xa88e('0x33')](_0xa88e('0x34'))){_0x48e39e[_0xa88e('0x1d')]=qs[_0xa88e('0x1d')](_0x3c7966[_0xa88e('0x2c')]['limit']);_0x48e39e[_0xa88e('0x1b')]=qs[_0xa88e('0x1b')](_0x3c7966['query']['offset']);}return _0x32e704[_0xa88e('0x4b')](_0x48e39e);}})[_0xa88e('0x23')](function(_0xcf550f){if(_0xcf550f){return _0xcf550f?{'count':_0x15a3a4,'rows':_0xcf550f}:null;}})['then'](respondWithResult(_0x42cceb,null))[_0xa88e('0x41')](handleError(_0x42cceb,null));};exports[_0xa88e('0x4e')]=function(_0x2137a1,_0x36bc60,_0x4f9bdc){return db['Action'][_0xa88e('0x44')]({'where':{'id':_0x2137a1[_0xa88e('0x45')]['id']}})[_0xa88e('0x23')](handleEntityNotFound(_0x36bc60,null))[_0xa88e('0x23')](function(_0x291b33){if(_0x291b33){return _0x291b33[_0xa88e('0x4e')](_0x2137a1['body'][_0xa88e('0x49')],_[_0xa88e('0x4a')](_0x2137a1[_0xa88e('0x43')],['ids','id'])||{});}})[_0xa88e('0x23')](respondWithResult(_0x36bc60,null))['catch'](handleError(_0x36bc60,null));};exports[_0xa88e('0x4f')]=function(_0x527fa9,_0x3eb2d6,_0xf793e){var _0x2ac0fe={};var _0x4747cf={};var _0x4926a9;var _0x33fcb4;return db[_0xa88e('0x3c')][_0xa88e('0x4c')]({'where':{'id':_0x527fa9[_0xa88e('0x45')]['id']}})[_0xa88e('0x23')](handleEntityNotFound(_0x3eb2d6,null))['then'](function(_0xc177e4){if(_0xc177e4){_0x4926a9=_0xc177e4;_0x4747cf[_0xa88e('0x2f')]=_['keys'](db[_0xa88e('0x50')][_0xa88e('0x29')]);_0x4747cf[_0xa88e('0x2c')]=_['keys'](_0x527fa9['query']);_0x4747cf['filters']=_[_0xa88e('0x2e')](_0x4747cf[_0xa88e('0x2f')],_0x4747cf[_0xa88e('0x2c')]);_0x2ac0fe['attributes']=_[_0xa88e('0x2e')](_0x4747cf[_0xa88e('0x2f')],qs['fields'](_0x527fa9[_0xa88e('0x2c')][_0xa88e('0x30')]));_0x2ac0fe[_0xa88e('0x31')]=_0x2ac0fe[_0xa88e('0x31')][_0xa88e('0x32')]?_0x2ac0fe[_0xa88e('0x31')]:_0x4747cf[_0xa88e('0x2f')];_0x2ac0fe[_0xa88e('0x4d')]=qs['sort'](_0x527fa9['query'][_0xa88e('0x35')]);_0x2ac0fe['where']=qs[_0xa88e('0x36')](_[_0xa88e('0x51')](_0x527fa9[_0xa88e('0x2c')],_0x4747cf[_0xa88e('0x36')]));if(_0x527fa9[_0xa88e('0x2c')][_0xa88e('0x37')]){_0x2ac0fe[_0xa88e('0x38')]=_['merge'](_0x2ac0fe['where'],{'$or':_[_0xa88e('0x2b')](_0x2ac0fe[_0xa88e('0x31')],function(_0x3eb753){var _0x50a7b2={};_0x50a7b2[_0x3eb753]={'$like':'%'+_0x527fa9[_0xa88e('0x2c')]['filter']+'%'};return _0x50a7b2;})});}_0x2ac0fe=_['merge']({},_0x2ac0fe,_0x527fa9[_0xa88e('0x3b')]);return _0x4926a9[_0xa88e('0x4f')](_0x2ac0fe);}})[_0xa88e('0x23')](function(_0x5ef69c){if(_0x5ef69c){_0x33fcb4=_0x5ef69c['length'];if(!_0x527fa9[_0xa88e('0x2c')][_0xa88e('0x33')](_0xa88e('0x34'))){_0x2ac0fe[_0xa88e('0x1d')]=qs[_0xa88e('0x1d')](_0x527fa9['query']['limit']);_0x2ac0fe['offset']=qs['offset'](_0x527fa9[_0xa88e('0x2c')][_0xa88e('0x1b')]);}return _0x4926a9['getActions'](_0x2ac0fe);}})[_0xa88e('0x23')](function(_0x4c75c8){if(_0x4c75c8){return _0x4c75c8?{'count':_0x33fcb4,'rows':_0x4c75c8}:null;}})['then'](respondWithResult(_0x3eb2d6,null))[_0xa88e('0x41')](handleError(_0x3eb2d6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 677942e..3a4622d 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 _0x8e03=['tools_automations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x42c810,_0x3606a3){var _0x5c11e7=function(_0x356ef9){while(--_0x356ef9){_0x42c810['push'](_0x42c810['shift']());}};_0x5c11e7(++_0x3606a3);}(_0x8e03,0x1e2));var _0x38e0=function(_0x43f2be,_0x33f827){_0x43f2be=_0x43f2be-0x0;var _0x27dfa3=_0x8e03[_0x43f2be];return _0x27dfa3;};'use strict';var _=require(_0x38e0('0x0'));var util=require(_0x38e0('0x1'));var logger=require(_0x38e0('0x2'))(_0x38e0('0x3'));var moment=require('moment');var BPromise=require(_0x38e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38e0('0x5'));var rimraf=require(_0x38e0('0x6'));var config=require(_0x38e0('0x7'));var attributes=require(_0x38e0('0x8'));module[_0x38e0('0x9')]=function(_0x105d07,_0x25326c){return _0x105d07[_0x38e0('0xa')](_0x38e0('0xb'),attributes,{'tableName':_0x38e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c75=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger','moment','path','rimraf'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x5c75,0x13a));var _0x55c7=function(_0x4982f6,_0x45ba31){_0x4982f6=_0x4982f6-0x0;var _0x3d8a48=_0x5c75[_0x4982f6];return _0x3d8a48;};'use strict';var _=require('lodash');var util=require(_0x55c7('0x0'));var logger=require(_0x55c7('0x1'))('api');var moment=require(_0x55c7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x55c7('0x3'));var rimraf=require(_0x55c7('0x4'));var config=require(_0x55c7('0x5'));var attributes=require(_0x55c7('0x6'));module[_0x55c7('0x7')]=function(_0x14eaf4,_0x4be056){return _0x14eaf4[_0x55c7('0x8')](_0x55c7('0x9'),attributes,{'tableName':_0x55c7('0xa'),'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 776a253..42eba6b 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 _0xe35d=['rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xe35d,0xd5));var _0xde35=function(_0x2ba96b,_0x3bcefd){_0x2ba96b=_0x2ba96b-0x0;var _0x4b7d33=_0xe35d[_0x2ba96b];return _0x4b7d33;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde35('0x2'));var fs=require('fs');var Redis=require(_0xde35('0x3'));var db=require(_0xde35('0x4'))['db'];var utils=require(_0xde35('0x5'));var logger=require(_0xde35('0x6'))(_0xde35('0x7'));var config=require(_0xde35('0x8'));var jayson=require(_0xde35('0x9'));var client=jayson[_0xde35('0xa')][_0xde35('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57c5a7,_0x1f0541,_0xe542e){return new BPromise(function(_0x3200e1,_0x25c8a1){return client[_0xde35('0xc')](_0x57c5a7,_0xe542e)['then'](function(_0xa3af60){logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,'request\x20sent');logger[_0xde35('0xf')](_0xde35('0x10'),_0x1f0541,'request\x20sent',JSON[_0xde35('0x11')](_0xa3af60));if(_0xa3af60['error']){if(_0xa3af60[_0xde35('0x12')]['code']===0x1f4){logger[_0xde35('0x12')]('Automation,\x20%s,\x20%s',_0x1f0541,_0xa3af60['error']['message']);return _0x25c8a1(_0xa3af60['error']['message']);}logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0xa3af60['error']['message']);return _0x3200e1(_0xa3af60[_0xde35('0x12')][_0xde35('0x13')]);}else{logger[_0xde35('0xd')](_0xde35('0xe'),_0x1f0541,_0xde35('0x14'));_0x3200e1(_0xa3af60['result'][_0xde35('0x13')]);}})[_0xde35('0x15')](function(_0x274de6){logger[_0xde35('0x12')](_0xde35('0xe'),_0x1f0541,_0x274de6);_0x25c8a1(_0x274de6);});});} \ No newline at end of file +var _0xa5c9=['util','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash'];(function(_0x3f4932,_0xa6590b){var _0x3bd538=function(_0x23ea60){while(--_0x23ea60){_0x3f4932['push'](_0x3f4932['shift']());}};_0x3bd538(++_0xa6590b);}(_0xa5c9,0x143));var _0x9a5c=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xa5c9[_0xa79977];return _0x109f10;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var moment=require(_0x9a5c('0x2'));var BPromise=require(_0x9a5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a5c('0x4'))['db'];var utils=require(_0x9a5c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9a5c('0x6'));var client=jayson[_0x9a5c('0x7')][_0x9a5c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bb6f2,_0x594e67,_0x8de4e9){return new BPromise(function(_0x4ea491,_0xc96c1c){return client[_0x9a5c('0x9')](_0x3bb6f2,_0x8de4e9)['then'](function(_0x127932){logger[_0x9a5c('0xa')](_0x9a5c('0xb'),_0x594e67,'request\x20sent');logger['debug'](_0x9a5c('0xc'),_0x594e67,_0x9a5c('0xd'),JSON[_0x9a5c('0xe')](_0x127932));if(_0x127932[_0x9a5c('0xf')]){if(_0x127932[_0x9a5c('0xf')][_0x9a5c('0x10')]===0x1f4){logger[_0x9a5c('0xf')](_0x9a5c('0xb'),_0x594e67,_0x127932[_0x9a5c('0xf')][_0x9a5c('0x11')]);return _0xc96c1c(_0x127932[_0x9a5c('0xf')][_0x9a5c('0x11')]);}logger['error'](_0x9a5c('0xb'),_0x594e67,_0x127932[_0x9a5c('0xf')][_0x9a5c('0x11')]);return _0x4ea491(_0x127932['error'][_0x9a5c('0x11')]);}else{logger[_0x9a5c('0xa')]('Automation,\x20%s,\x20%s',_0x594e67,_0x9a5c('0xd'));_0x4ea491(_0x127932['result'][_0x9a5c('0x11')]);}})['catch'](function(_0x29d3cd){logger[_0x9a5c('0xf')]('Automation,\x20%s,\x20%s',_0x594e67,_0x29d3cd);_0xc96c1c(_0x29d3cd);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 89341ad..d20409c 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 _0xfcda=['./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','put','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4879ff,_0x26bfa9){var _0x5cab3a=function(_0xb0f076){while(--_0xb0f076){_0x4879ff['push'](_0x4879ff['shift']());}};_0x5cab3a(++_0x26bfa9);}(_0xfcda,0x198));var _0xafcd=function(_0x1428ff,_0x38cff9){_0x1428ff=_0x1428ff-0x0;var _0xe42225=_0xfcda[_0x1428ff];return _0xe42225;};'use strict';var multer=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var path=require('path');var timeout=require(_0xafcd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xafcd('0x3'));var interaction=require(_0xafcd('0x4'));var config=require(_0xafcd('0x5'));var controller=require(_0xafcd('0x6'));router[_0xafcd('0x7')]('/',auth[_0xafcd('0x8')](),controller[_0xafcd('0x9')]);router['get'](_0xafcd('0xa'),auth['isAuthenticated'](),controller[_0xafcd('0xb')]);router[_0xafcd('0x7')](_0xafcd('0xc'),auth[_0xafcd('0x8')](),controller[_0xafcd('0xd')]);router[_0xafcd('0x7')]('/:id/actions',auth[_0xafcd('0x8')](),controller[_0xafcd('0xe')]);router[_0xafcd('0xf')]('/',auth[_0xafcd('0x8')](),controller[_0xafcd('0x10')]);router[_0xafcd('0xf')](_0xafcd('0xc'),auth[_0xafcd('0x8')](),controller[_0xafcd('0x11')]);router['post'](_0xafcd('0x12'),auth[_0xafcd('0x8')](),controller['addActions']);router[_0xafcd('0x13')](_0xafcd('0xa'),auth[_0xafcd('0x8')](),controller[_0xafcd('0x14')]);router[_0xafcd('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xafcd('0x16')]=router; \ No newline at end of file +var _0xc18a=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','put'];(function(_0x172057,_0x259f15){var _0x4029c=function(_0x4390e3){while(--_0x4390e3){_0x172057['push'](_0x172057['shift']());}};_0x4029c(++_0x259f15);}(_0xc18a,0x1cf));var _0xac18=function(_0x567ada,_0x33af87){_0x567ada=_0x567ada-0x0;var _0x17edd8=_0xc18a[_0x567ada];return _0x17edd8;};'use strict';var multer=require(_0xac18('0x0'));var util=require(_0xac18('0x1'));var path=require(_0xac18('0x2'));var timeout=require(_0xac18('0x3'));var express=require('express');var router=express[_0xac18('0x4')]();var fs_extra=require(_0xac18('0x5'));var auth=require(_0xac18('0x6'));var interaction=require(_0xac18('0x7'));var config=require(_0xac18('0x8'));var controller=require(_0xac18('0x9'));router[_0xac18('0xa')]('/',auth[_0xac18('0xb')](),controller['index']);router[_0xac18('0xa')](_0xac18('0xc'),auth[_0xac18('0xb')](),controller[_0xac18('0xd')]);router[_0xac18('0xa')](_0xac18('0xe'),auth[_0xac18('0xb')](),controller[_0xac18('0xf')]);router[_0xac18('0xa')](_0xac18('0x10'),auth[_0xac18('0xb')](),controller[_0xac18('0x11')]);router[_0xac18('0x12')]('/',auth[_0xac18('0xb')](),controller['create']);router[_0xac18('0x12')]('/:id/conditions',auth[_0xac18('0xb')](),controller['addConditions']);router['post'](_0xac18('0x10'),auth['isAuthenticated'](),controller['addActions']);router[_0xac18('0x13')](_0xac18('0xc'),auth['isAuthenticated'](),controller[_0xac18('0x14')]);router[_0xac18('0x15')]('/:id',auth[_0xac18('0xb')](),controller['destroy']);module[_0xac18('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c3bff45..a5fd91d 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 _0x61e2=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','INTEGER','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)','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x50846f,_0x113bf3){var _0xd945fe=function(_0x528728){while(--_0x528728){_0x50846f['push'](_0x50846f['shift']());}};_0xd945fe(++_0x113bf3);}(_0x61e2,0xeb));var _0x261e=function(_0x421455,_0x94c640){_0x421455=_0x421455-0x0;var _0x5aa84d=_0x61e2[_0x421455];return _0x5aa84d;};'use strict';var Sequelize=require(_0x261e('0x0'));module[_0x261e('0x1')]={'name':{'type':Sequelize[_0x261e('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x261e('0x3')),'allowNull':![],'defaultValue':_0x261e('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x261e('0x4')],'defaultValue':0x0,'comment':_0x261e('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x261e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x261e('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x261e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x261e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x261e('0xc')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x261e('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)[_0x261e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x261e('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x261e('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x261e('0x11')](_0x261e('0x12'),'never',_0x261e('0x13')),'defaultValue':_0x261e('0x12')},'dialAMDActive':{'type':Sequelize[_0x261e('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x261e('0xc')](0x9)[_0x261e('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x261e('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x261e('0xc')](0x9)[_0x261e('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x261e('0xc')](0x9)[_0x261e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x261e('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x261e('0xc')](0x9)[_0x261e('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x261e('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x261e('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x261e('0xc')](0x9)[_0x261e('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x261e('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x261e('0xc')](0x5)[_0x261e('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x261e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x261e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0x261e('0x1a')},'dialPrefix':{'type':Sequelize[_0x261e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x261e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x261e('0xc')](0x3)[_0x261e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x261e('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x261e('0xc')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)[_0x261e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x261e('0xc')](0x3)[_0x261e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x261e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x261e('0xc')](0x3)[_0x261e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)[_0x261e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x261e('0xc')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x261e('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x261e('0xc')](0x5)[_0x261e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x261e('0x24')}}; \ No newline at end of file +var _0x736e=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x56db28,_0x95952b){var _0x255efc=function(_0x11c095){while(--_0x11c095){_0x56db28['push'](_0x56db28['shift']());}};_0x255efc(++_0x95952b);}(_0x736e,0x73));var _0xe736=function(_0x5b848e,_0x536b96){_0x5b848e=_0x5b848e-0x0;var _0x9ba072=_0x736e[_0x5b848e];return _0x9ba072;};'use strict';var Sequelize=require(_0xe736('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe736('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe736('0x2')](_0xe736('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xe736('0x4')]},'active':{'type':Sequelize[_0xe736('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xe736('0x6')](0x4)[_0xe736('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe736('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe736('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe736('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe736('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe736('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe736('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'defaultValue':0x3,'comment':_0xe736('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe736('0x6')](0x5)[_0xe736('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe736('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe736('0xd')},'dialTimezone':{'type':Sequelize[_0xe736('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe736('0x4')],'defaultValue':_0xe736('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xe736('0x2')](_0xe736('0xf'),_0xe736('0x10'),_0xe736('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe736('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe736('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe736('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xe736('0x6')](0x9)[_0xe736('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe736('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe736('0x6')](0x9)[_0xe736('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe736('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe736('0x6')](0x9)[_0xe736('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe736('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe736('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe736('0x6')](0x9)[_0xe736('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe736('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe736('0x6')](0x9)[_0xe736('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe736('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe736('0x6')](0x5)[_0xe736('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe736('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe736('0x6')](0x9)[_0xe736('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe736('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe736('0x2')](_0xe736('0x1b'),_0xe736('0x1c')),'defaultValue':_0xe736('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe736('0x1d')},'dialCutDigit':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe736('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe736('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe736('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe736('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xe736('0x6')](0x5)[_0xe736('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe736('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe736('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe736('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe736('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe736('0x6')](0x3)[_0xe736('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe736('0x6')](0x5)[_0xe736('0x7')],'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 c5dec17..ad3392b 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 _0xd6cb=['CampaignId\x20=\x20?','from','onlyIfOpen','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper','fromQuery','ListId\x20=\x20?','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','clone','omit','updatedAt','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','CmHopper','pick','CampaignId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xd6cb,0x1cb));var _0xbd6c=function(_0x4dbcd6,_0x34326c){_0x4dbcd6=_0x4dbcd6-0x0;var _0x541e55=_0xd6cb[_0x4dbcd6];return _0x541e55;};'use strict';var emlformat=require(_0xbd6c('0x0'));var rimraf=require(_0xbd6c('0x1'));var zipdir=require(_0xbd6c('0x2'));var jsonpatch=require(_0xbd6c('0x3'));var rp=require(_0xbd6c('0x4'));var moment=require(_0xbd6c('0x5'));var BPromise=require(_0xbd6c('0x6'));var Mustache=require(_0xbd6c('0x7'));var util=require(_0xbd6c('0x8'));var path=require('path');var sox=require(_0xbd6c('0x9'));var csv=require(_0xbd6c('0xa'));var ejs=require(_0xbd6c('0xb'));var fs=require('fs');var fs_extra=require(_0xbd6c('0xc'));var _=require(_0xbd6c('0xd'));var squel=require(_0xbd6c('0xe'));var crypto=require('crypto');var jsforce=require(_0xbd6c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbd6c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd6c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd6c('0x11'));var as=require(_0xbd6c('0x12'));var hardwareService=require(_0xbd6c('0x13'));var logger=require('../../config/logger')(_0xbd6c('0x14'));var utils=require(_0xbd6c('0x15'));var config=require(_0xbd6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd6c('0x17'))['db'];function respondWithStatusCode(_0x2227f3,_0x953ca){_0x953ca=_0x953ca||0xcc;return function(_0x5102d7){if(_0x5102d7){return _0x2227f3[_0xbd6c('0x18')](_0x953ca);}return _0x2227f3['status'](_0x953ca)[_0xbd6c('0x19')]();};}function respondWithResult(_0x1842a8,_0x3494e5){_0x3494e5=_0x3494e5||0xc8;return function(_0xc03b7c){if(_0xc03b7c){return _0x1842a8[_0xbd6c('0x1a')](_0x3494e5)[_0xbd6c('0x1b')](_0xc03b7c);}};}function respondWithFilteredResult(_0x4d0776,_0xc9328b){return function(_0x3f8835){if(_0x3f8835){var _0xc69f45=typeof _0xc9328b['offset']===_0xbd6c('0x1c')&&typeof _0xc9328b[_0xbd6c('0x1d')]==='undefined';var _0x26aef8=_0x3f8835[_0xbd6c('0x1e')];var _0x11adc6=_0xc69f45?0x0:_0xc9328b[_0xbd6c('0x1f')];var _0x359f80=_0xc69f45?_0x3f8835[_0xbd6c('0x1e')]:_0xc9328b[_0xbd6c('0x1f')]+_0xc9328b[_0xbd6c('0x1d')];var _0x3ac9fc;if(_0x359f80>=_0x26aef8){_0x359f80=_0x26aef8;_0x3ac9fc=0xc8;}else{_0x3ac9fc=0xce;}_0x4d0776[_0xbd6c('0x1a')](_0x3ac9fc);return _0x4d0776[_0xbd6c('0x20')](_0xbd6c('0x21'),_0x11adc6+'-'+_0x359f80+'/'+_0x26aef8)['json'](_0x3f8835);}return null;};}function patchUpdates(_0xe9603a){return function(_0x2b5643){try{jsonpatch[_0xbd6c('0x22')](_0x2b5643,_0xe9603a,!![]);}catch(_0x7eba45){return BPromise[_0xbd6c('0x23')](_0x7eba45);}return _0x2b5643['save']();};}function saveUpdates(_0x2a6972,_0x743130){return function(_0x4b9754){if(_0x4b9754){return _0x4b9754['update'](_0x2a6972)[_0xbd6c('0x24')](function(_0x400eca){return _0x400eca;});}return null;};}function removeEntity(_0x533d42,_0x74d03b){return function(_0x292e63){if(_0x292e63){return _0x292e63['destroy']()[_0xbd6c('0x24')](function(){var _0x3ee7e8=_0x292e63['get']({'plain':!![]});var _0xe9bb87=_0xbd6c('0x25');return db[_0xbd6c('0x26')][_0xbd6c('0x27')]({'where':{'type':_0xe9bb87,'resourceId':_0x3ee7e8['id']}})['then'](function(){return _0x292e63;});})[_0xbd6c('0x24')](function(){_0x533d42[_0xbd6c('0x1a')](0xcc)[_0xbd6c('0x19')]();});}};}function handleEntityNotFound(_0x175dd9,_0x19e6cf){return function(_0x40e6f8){if(!_0x40e6f8){_0x175dd9[_0xbd6c('0x18')](0x194);}return _0x40e6f8;};}function handleError(_0x55566c,_0x1b7d8d){_0x1b7d8d=_0x1b7d8d||0x1f4;return function(_0x13d8cd){logger[_0xbd6c('0x28')](_0x13d8cd[_0xbd6c('0x29')]);if(_0x13d8cd[_0xbd6c('0x2a')]){delete _0x13d8cd[_0xbd6c('0x2a')];}_0x55566c[_0xbd6c('0x1a')](_0x1b7d8d)[_0xbd6c('0x2b')](_0x13d8cd);};}exports[_0xbd6c('0x2c')]=function(_0xb35178,_0x489ad4){var _0x224bc3={},_0x5c659f={},_0x5d6a0f={'count':0x0,'rows':[]};var _0x21a440=_[_0xbd6c('0x2d')](db[_0xbd6c('0x2e')][_0xbd6c('0x2f')],function(_0x5b6bb3){return{'name':_0x5b6bb3['fieldName'],'type':_0x5b6bb3['type'][_0xbd6c('0x30')]};});_0x5c659f[_0xbd6c('0x31')]=_[_0xbd6c('0x2d')](_0x21a440,_0xbd6c('0x2a'));_0x5c659f[_0xbd6c('0x32')]=_[_0xbd6c('0x33')](_0xb35178['query']);_0x5c659f[_0xbd6c('0x34')]=_[_0xbd6c('0x35')](_0x5c659f[_0xbd6c('0x31')],_0x5c659f[_0xbd6c('0x32')]);_0x224bc3[_0xbd6c('0x36')]=_[_0xbd6c('0x35')](_0x5c659f[_0xbd6c('0x31')],qs[_0xbd6c('0x37')](_0xb35178[_0xbd6c('0x32')]['fields']));_0x224bc3[_0xbd6c('0x36')]=_0x224bc3[_0xbd6c('0x36')][_0xbd6c('0x38')]?_0x224bc3[_0xbd6c('0x36')]:_0x5c659f[_0xbd6c('0x31')];if(!_0xb35178[_0xbd6c('0x32')][_0xbd6c('0x39')](_0xbd6c('0x3a'))){_0x224bc3['limit']=qs[_0xbd6c('0x1d')](_0xb35178[_0xbd6c('0x32')][_0xbd6c('0x1d')]);_0x224bc3[_0xbd6c('0x1f')]=qs['offset'](_0xb35178[_0xbd6c('0x32')]['offset']);}_0x224bc3[_0xbd6c('0x3b')]=qs[_0xbd6c('0x3c')](_0xb35178['query'][_0xbd6c('0x3c')]);_0x224bc3[_0xbd6c('0x3d')]=qs[_0xbd6c('0x34')](_['pick'](_0xb35178[_0xbd6c('0x32')],_0x5c659f[_0xbd6c('0x34')]),_0x21a440);if(_0xb35178['query'][_0xbd6c('0x3e')]){_0x224bc3[_0xbd6c('0x3d')]=_[_0xbd6c('0x3f')](_0x224bc3[_0xbd6c('0x3d')],{'$or':_[_0xbd6c('0x2d')](_0x21a440,function(_0xad6570){if(_0xad6570[_0xbd6c('0x40')]!==_0xbd6c('0x41')){var _0x2a6e4e={};_0x2a6e4e[_0xad6570['name']]={'$like':'%'+_0xb35178[_0xbd6c('0x32')][_0xbd6c('0x3e')]+'%'};return _0x2a6e4e;}})});}_0x224bc3=_[_0xbd6c('0x3f')]({},_0x224bc3,_0xb35178[_0xbd6c('0x42')]);var _0x24ee0c={'where':_0x224bc3[_0xbd6c('0x3d')]};return db['Campaign'][_0xbd6c('0x1e')](_0x24ee0c)['then'](function(_0x17b2ed){_0x5d6a0f[_0xbd6c('0x1e')]=_0x17b2ed;if(_0xb35178[_0xbd6c('0x32')][_0xbd6c('0x43')]){_0x224bc3['include']=[{'all':!![]}];}return db[_0xbd6c('0x2e')][_0xbd6c('0x44')](_0x224bc3);})['then'](function(_0x5fb461){_0x5d6a0f[_0xbd6c('0x45')]=_0x5fb461;return _0x5d6a0f;})[_0xbd6c('0x24')](respondWithFilteredResult(_0x489ad4,_0x224bc3))['catch'](handleError(_0x489ad4,null));};exports['show']=function(_0x17d8b8,_0x1d64b2){var _0x46ce33={'raw':![],'where':{'id':_0x17d8b8[_0xbd6c('0x46')]['id']}},_0x2d6890={};_0x2d6890[_0xbd6c('0x31')]=_[_0xbd6c('0x33')](db[_0xbd6c('0x2e')][_0xbd6c('0x2f')]);_0x2d6890[_0xbd6c('0x32')]=_[_0xbd6c('0x33')](_0x17d8b8[_0xbd6c('0x32')]);_0x2d6890['filters']=_[_0xbd6c('0x35')](_0x2d6890[_0xbd6c('0x31')],_0x2d6890[_0xbd6c('0x32')]);_0x46ce33[_0xbd6c('0x36')]=_[_0xbd6c('0x35')](_0x2d6890[_0xbd6c('0x31')],qs[_0xbd6c('0x37')](_0x17d8b8[_0xbd6c('0x32')][_0xbd6c('0x37')]));_0x46ce33[_0xbd6c('0x36')]=_0x46ce33['attributes'][_0xbd6c('0x38')]?_0x46ce33[_0xbd6c('0x36')]:_0x2d6890[_0xbd6c('0x31')];if(_0x17d8b8[_0xbd6c('0x32')][_0xbd6c('0x43')]){_0x46ce33[_0xbd6c('0x47')]=[{'all':!![]}];}_0x46ce33=_[_0xbd6c('0x3f')]({},_0x46ce33,_0x17d8b8[_0xbd6c('0x42')]);return db['Campaign'][_0xbd6c('0x48')](_0x46ce33)['then'](handleEntityNotFound(_0x1d64b2,null))[_0xbd6c('0x24')](respondWithResult(_0x1d64b2,null))[_0xbd6c('0x49')](handleError(_0x1d64b2,null));};exports[_0xbd6c('0x4a')]=function(_0x30162f,_0x943ee6){return db[_0xbd6c('0x2e')][_0xbd6c('0x4a')](_0x30162f[_0xbd6c('0x4b')],{})[_0xbd6c('0x24')](function(_0x42833e){var _0x4fe96e=_0x30162f['user'][_0xbd6c('0x4c')]({'plain':!![]});if(!_0x4fe96e)throw new Error(_0xbd6c('0x4d'));if(_0x4fe96e[_0xbd6c('0x4e')]===_0xbd6c('0x4f')){var _0xccbf32=_0x42833e[_0xbd6c('0x4c')]({'plain':!![]});var _0x22428b='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x22428b,'userProfileId':_0x4fe96e['userProfileId']},'raw':!![]})[_0xbd6c('0x24')](function(_0x45d680){if(_0x45d680&&_0x45d680[_0xbd6c('0x50')]===0x0){return db[_0xbd6c('0x26')][_0xbd6c('0x4a')]({'name':_0xccbf32['name'],'resourceId':_0xccbf32['id'],'type':_0x45d680[_0xbd6c('0x2a')],'sectionId':_0x45d680['id']},{})[_0xbd6c('0x24')](function(){return _0x42833e;});}else{return _0x42833e;}})[_0xbd6c('0x49')](function(_0x230602){logger[_0xbd6c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230602);throw _0x230602;});}return _0x42833e;})[_0xbd6c('0x24')](respondWithResult(_0x943ee6,0xc9))['catch'](handleError(_0x943ee6,null));};exports[_0xbd6c('0x51')]=function(_0x1f49ae,_0x29f694){var _0x24e076={'where':{'id':_0x1f49ae['params']['id']}},_0x46a30c={};_0x46a30c[_0xbd6c('0x31')]=_[_0xbd6c('0x33')](db[_0xbd6c('0x2e')][_0xbd6c('0x2f')]);_0x24e076['attributes']=_['intersection'](_0x46a30c[_0xbd6c('0x31')],qs[_0xbd6c('0x37')](_0x1f49ae[_0xbd6c('0x32')]['fields']));_0x24e076[_0xbd6c('0x36')]=_0x24e076['attributes'][_0xbd6c('0x38')]?_0x24e076[_0xbd6c('0x36')]:_0x46a30c[_0xbd6c('0x31')];if(_0x1f49ae[_0xbd6c('0x32')][_0xbd6c('0x43')]){_0x24e076[_0xbd6c('0x47')]=[{'all':!![]}];}_0x24e076=_[_0xbd6c('0x3f')]({},_0x24e076,_0x1f49ae[_0xbd6c('0x42')]);return db[_0xbd6c('0x2e')][_0xbd6c('0x48')](_0x24e076)['then'](handleEntityNotFound(_0x29f694,null))[_0xbd6c('0x24')](function(_0x52601c){if(_0x52601c){var _0x2a2144=_0x52601c[_0xbd6c('0x4c')]({'plain':!![]});_0x2a2144=qs[_0xbd6c('0x52')](_0x2a2144,['id','createdAt',_0xbd6c('0x53')]);_0x1f49ae[_0xbd6c('0x4b')]=_[_0xbd6c('0x52')](_0x1f49ae[_0xbd6c('0x4b')],['id',_0xbd6c('0x54'),'updatedAt']);return db[_0xbd6c('0x2e')][_0xbd6c('0x4a')](_[_0xbd6c('0x3f')](_0x2a2144,_0x1f49ae[_0xbd6c('0x4b')]),{'include':_0x1f49ae[_0xbd6c('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xbd6c('0x24')](function(_0x42740a){var _0x56d937=_0x1f49ae[_0xbd6c('0x4f')][_0xbd6c('0x4c')]({'plain':!![]});if(!_0x56d937)throw new Error(_0xbd6c('0x4d'));if(_0x56d937['role']==='user'){var _0x479802=_0x42740a[_0xbd6c('0x4c')]({'plain':!![]});var _0x39fce4='IvrCampaigns';return db[_0xbd6c('0x55')][_0xbd6c('0x48')]({'where':{'name':_0x39fce4,'userProfileId':_0x56d937['userProfileId']},'raw':!![]})[_0xbd6c('0x24')](function(_0x43d5e9){if(_0x43d5e9&&_0x43d5e9[_0xbd6c('0x50')]===0x0){return db[_0xbd6c('0x26')][_0xbd6c('0x4a')]({'name':_0x479802['name'],'resourceId':_0x479802['id'],'type':_0x43d5e9['name'],'sectionId':_0x43d5e9['id']},{})[_0xbd6c('0x24')](function(){return _0x42740a;});}else{return _0x42740a;}})['catch'](function(_0x8a755f){logger[_0xbd6c('0x28')](_0xbd6c('0x56'),_0x8a755f);throw _0x8a755f;});}return _0x42740a;});}})[_0xbd6c('0x24')](respondWithResult(_0x29f694,0xc9))['catch'](handleError(_0x29f694,null));};exports[_0xbd6c('0x57')]=function(_0x475c2c,_0xb38f8a){if(_0x475c2c['body']['id']){delete _0x475c2c[_0xbd6c('0x4b')]['id'];}return db[_0xbd6c('0x2e')][_0xbd6c('0x48')]({'where':{'id':_0x475c2c['params']['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0xb38f8a,null))[_0xbd6c('0x24')](saveUpdates(_0x475c2c[_0xbd6c('0x4b')],null))[_0xbd6c('0x24')](respondWithResult(_0xb38f8a,null))[_0xbd6c('0x49')](handleError(_0xb38f8a,null));};exports[_0xbd6c('0x27')]=function(_0x3c7677,_0x247f86){return db[_0xbd6c('0x2e')]['find']({'where':{'id':_0x3c7677[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x247f86,null))[_0xbd6c('0x24')](removeEntity(_0x247f86,null))[_0xbd6c('0x49')](handleError(_0x247f86,null));};exports[_0xbd6c('0x58')]=function(_0x28605c,_0x447f2c,_0x3d7409){var _0x78c65e={'raw':!![],'where':{}};var _0x42f717={};var _0x1c5abe={'count':0x0,'rows':[]};return db[_0xbd6c('0x2e')]['findOne']({'where':{'id':_0x28605c[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x447f2c,null))[_0xbd6c('0x24')](function(_0x5dd37f){if(_0x5dd37f){_0x42f717['model']=_[_0xbd6c('0x33')](db[_0xbd6c('0x59')][_0xbd6c('0x2f')]);_0x42f717[_0xbd6c('0x32')]=_['keys'](_0x28605c['query']);_0x42f717[_0xbd6c('0x34')]=_[_0xbd6c('0x35')](_0x42f717[_0xbd6c('0x31')],_0x42f717[_0xbd6c('0x32')]);_0x78c65e['attributes']=_['intersection'](_0x42f717[_0xbd6c('0x31')],qs[_0xbd6c('0x37')](_0x28605c[_0xbd6c('0x32')]['fields']));_0x78c65e[_0xbd6c('0x36')]=_0x78c65e[_0xbd6c('0x36')]['length']?_0x78c65e[_0xbd6c('0x36')]:_0x42f717[_0xbd6c('0x31')];if(!_0x28605c['query'][_0xbd6c('0x39')](_0xbd6c('0x3a'))){_0x78c65e[_0xbd6c('0x1d')]=qs[_0xbd6c('0x1d')](_0x28605c[_0xbd6c('0x32')][_0xbd6c('0x1d')]);_0x78c65e[_0xbd6c('0x1f')]=qs['offset'](_0x28605c[_0xbd6c('0x32')]['offset']);}_0x78c65e[_0xbd6c('0x3b')]=qs[_0xbd6c('0x3c')](_0x28605c['query'][_0xbd6c('0x3c')]);_0x78c65e['where']=qs[_0xbd6c('0x34')](_[_0xbd6c('0x5a')](_0x28605c[_0xbd6c('0x32')],_0x42f717[_0xbd6c('0x34')]));_0x78c65e[_0xbd6c('0x3d')][_0xbd6c('0x5b')]=_0x5dd37f['id'];if(_0x28605c[_0xbd6c('0x32')]['filter']){_0x78c65e[_0xbd6c('0x3d')]=_[_0xbd6c('0x3f')](_0x78c65e[_0xbd6c('0x3d')],{'$or':_[_0xbd6c('0x2d')](_0x78c65e[_0xbd6c('0x36')],function(_0x5aaa26){var _0x576598={};_0x576598[_0x5aaa26]={'$like':'%'+_0x28605c[_0xbd6c('0x32')][_0xbd6c('0x3e')]+'%'};return _0x576598;})});}_0x78c65e=_[_0xbd6c('0x3f')]({},_0x78c65e,_0x28605c[_0xbd6c('0x42')]);return db[_0xbd6c('0x59')]['count']({'where':_0x78c65e[_0xbd6c('0x3d')]})[_0xbd6c('0x24')](function(_0x209c3b){_0x1c5abe[_0xbd6c('0x1e')]=_0x209c3b;if(_0x28605c['query'][_0xbd6c('0x43')]){_0x78c65e[_0xbd6c('0x47')]=[{'all':!![]}];}return db[_0xbd6c('0x59')]['findAll'](_0x78c65e);})[_0xbd6c('0x24')](function(_0x41102e){_0x1c5abe[_0xbd6c('0x45')]=_0x41102e;return _0x1c5abe;});}})['then'](respondWithFilteredResult(_0x447f2c,_0x78c65e))[_0xbd6c('0x49')](handleError(_0x447f2c,null));};exports['getHopperHistories']=function(_0x3b0cbd,_0x424c3a,_0x2bedaa){var _0x52025a={'raw':!![],'where':{}};var _0x504ee9={};var _0x2316b9={'count':0x0,'rows':[]};return db[_0xbd6c('0x2e')][_0xbd6c('0x5c')]({'where':{'id':_0x3b0cbd[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x424c3a,null))[_0xbd6c('0x24')](function(_0x272280){if(_0x272280){_0x504ee9[_0xbd6c('0x31')]=_[_0xbd6c('0x33')](db['CmHopperHistory'][_0xbd6c('0x2f')]);_0x504ee9[_0xbd6c('0x32')]=_[_0xbd6c('0x33')](_0x3b0cbd['query']);_0x504ee9[_0xbd6c('0x34')]=_[_0xbd6c('0x35')](_0x504ee9[_0xbd6c('0x31')],_0x504ee9[_0xbd6c('0x32')]);_0x52025a[_0xbd6c('0x36')]=_['intersection'](_0x504ee9['model'],qs['fields'](_0x3b0cbd[_0xbd6c('0x32')][_0xbd6c('0x37')]));_0x52025a[_0xbd6c('0x36')]=_0x52025a[_0xbd6c('0x36')][_0xbd6c('0x38')]?_0x52025a[_0xbd6c('0x36')]:_0x504ee9[_0xbd6c('0x31')];if(!_0x3b0cbd[_0xbd6c('0x32')]['hasOwnProperty']('nolimit')){_0x52025a[_0xbd6c('0x1d')]=qs[_0xbd6c('0x1d')](_0x3b0cbd[_0xbd6c('0x32')][_0xbd6c('0x1d')]);_0x52025a[_0xbd6c('0x1f')]=qs[_0xbd6c('0x1f')](_0x3b0cbd[_0xbd6c('0x32')][_0xbd6c('0x1f')]);}_0x52025a[_0xbd6c('0x3b')]=qs[_0xbd6c('0x3c')](_0x3b0cbd['query'][_0xbd6c('0x3c')]);_0x52025a[_0xbd6c('0x3d')]=qs[_0xbd6c('0x34')](_['pick'](_0x3b0cbd[_0xbd6c('0x32')],_0x504ee9[_0xbd6c('0x34')]));_0x52025a[_0xbd6c('0x3d')][_0xbd6c('0x5b')]=_0x272280['id'];if(_0x3b0cbd['query'][_0xbd6c('0x3e')]){_0x52025a['where']=_['merge'](_0x52025a[_0xbd6c('0x3d')],{'$or':_['map'](_0x52025a[_0xbd6c('0x36')],function(_0x341988){var _0x3df2f7={};_0x3df2f7[_0x341988]={'$like':'%'+_0x3b0cbd[_0xbd6c('0x32')][_0xbd6c('0x3e')]+'%'};return _0x3df2f7;})});}_0x52025a=_[_0xbd6c('0x3f')]({},_0x52025a,_0x3b0cbd[_0xbd6c('0x42')]);return db['CmHopperHistory'][_0xbd6c('0x1e')]({'where':_0x52025a[_0xbd6c('0x3d')]})[_0xbd6c('0x24')](function(_0x53a68){_0x2316b9['count']=_0x53a68;if(_0x3b0cbd[_0xbd6c('0x32')][_0xbd6c('0x43')]){_0x52025a[_0xbd6c('0x47')]=[{'all':!![]}];}return db[_0xbd6c('0x5d')][_0xbd6c('0x44')](_0x52025a);})[_0xbd6c('0x24')](function(_0x4b6ed4){_0x2316b9[_0xbd6c('0x45')]=_0x4b6ed4;return _0x2316b9;});}})[_0xbd6c('0x24')](respondWithFilteredResult(_0x424c3a,_0x52025a))[_0xbd6c('0x49')](handleError(_0x424c3a,null));};exports[_0xbd6c('0x5e')]=function(_0x8c7ae6,_0x1d8062,_0x26bcf5){var _0x38e9d2={'raw':!![],'where':{}};var _0x118082={};var _0x31c335={'count':0x0,'rows':[]};return db['Campaign'][_0xbd6c('0x5c')]({'where':{'id':_0x8c7ae6[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x1d8062,null))[_0xbd6c('0x24')](function(_0x2d6140){if(_0x2d6140){_0x118082[_0xbd6c('0x31')]=_['keys'](db['CmHopperFinal'][_0xbd6c('0x2f')]);_0x118082['query']=_['keys'](_0x8c7ae6[_0xbd6c('0x32')]);_0x118082['filters']=_[_0xbd6c('0x35')](_0x118082[_0xbd6c('0x31')],_0x118082[_0xbd6c('0x32')]);_0x38e9d2[_0xbd6c('0x36')]=_['intersection'](_0x118082[_0xbd6c('0x31')],qs[_0xbd6c('0x37')](_0x8c7ae6['query']['fields']));_0x38e9d2[_0xbd6c('0x36')]=_0x38e9d2[_0xbd6c('0x36')][_0xbd6c('0x38')]?_0x38e9d2[_0xbd6c('0x36')]:_0x118082[_0xbd6c('0x31')];if(!_0x8c7ae6[_0xbd6c('0x32')][_0xbd6c('0x39')](_0xbd6c('0x3a'))){_0x38e9d2[_0xbd6c('0x1d')]=qs[_0xbd6c('0x1d')](_0x8c7ae6['query'][_0xbd6c('0x1d')]);_0x38e9d2['offset']=qs[_0xbd6c('0x1f')](_0x8c7ae6[_0xbd6c('0x32')][_0xbd6c('0x1f')]);}_0x38e9d2[_0xbd6c('0x3b')]=qs[_0xbd6c('0x3c')](_0x8c7ae6[_0xbd6c('0x32')]['sort']);_0x38e9d2[_0xbd6c('0x3d')]=qs['filters'](_['pick'](_0x8c7ae6['query'],_0x118082[_0xbd6c('0x34')]));_0x38e9d2[_0xbd6c('0x3d')][_0xbd6c('0x5b')]=_0x2d6140['id'];if(_0x8c7ae6['query'][_0xbd6c('0x3e')]){_0x38e9d2[_0xbd6c('0x3d')]=_['merge'](_0x38e9d2[_0xbd6c('0x3d')],{'$or':_['map'](_0x38e9d2['attributes'],function(_0x369015){var _0xe48154={};_0xe48154[_0x369015]={'$like':'%'+_0x8c7ae6[_0xbd6c('0x32')]['filter']+'%'};return _0xe48154;})});}_0x38e9d2=_[_0xbd6c('0x3f')]({},_0x38e9d2,_0x8c7ae6[_0xbd6c('0x42')]);return db[_0xbd6c('0x5f')][_0xbd6c('0x1e')]({'where':_0x38e9d2[_0xbd6c('0x3d')]})[_0xbd6c('0x24')](function(_0x6b9d2){_0x31c335[_0xbd6c('0x1e')]=_0x6b9d2;if(_0x8c7ae6[_0xbd6c('0x32')][_0xbd6c('0x43')]){_0x38e9d2[_0xbd6c('0x47')]=[{'all':!![]}];}return db[_0xbd6c('0x5f')][_0xbd6c('0x44')](_0x38e9d2);})[_0xbd6c('0x24')](function(_0x46410e){_0x31c335[_0xbd6c('0x45')]=_0x46410e;return _0x31c335;});}})[_0xbd6c('0x24')](respondWithFilteredResult(_0x1d8062,_0x38e9d2))[_0xbd6c('0x49')](handleError(_0x1d8062,null));};exports['getHopperBlacks']=function(_0x31957d,_0x3abb15,_0x36b2d9){var _0x1512f8={'raw':!![],'where':{}};var _0x1212b2={};var _0x35386d={'count':0x0,'rows':[]};return db[_0xbd6c('0x2e')]['findOne']({'where':{'id':_0x31957d[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x3abb15,null))[_0xbd6c('0x24')](function(_0x2c0523){if(_0x2c0523){_0x1212b2[_0xbd6c('0x31')]=_[_0xbd6c('0x33')](db[_0xbd6c('0x60')]['rawAttributes']);_0x1212b2[_0xbd6c('0x32')]=_['keys'](_0x31957d[_0xbd6c('0x32')]);_0x1212b2[_0xbd6c('0x34')]=_[_0xbd6c('0x35')](_0x1212b2['model'],_0x1212b2[_0xbd6c('0x32')]);_0x1512f8['attributes']=_[_0xbd6c('0x35')](_0x1212b2[_0xbd6c('0x31')],qs['fields'](_0x31957d[_0xbd6c('0x32')][_0xbd6c('0x37')]));_0x1512f8['attributes']=_0x1512f8[_0xbd6c('0x36')]['length']?_0x1512f8[_0xbd6c('0x36')]:_0x1212b2['model'];if(!_0x31957d[_0xbd6c('0x32')][_0xbd6c('0x39')](_0xbd6c('0x3a'))){_0x1512f8[_0xbd6c('0x1d')]=qs[_0xbd6c('0x1d')](_0x31957d[_0xbd6c('0x32')][_0xbd6c('0x1d')]);_0x1512f8[_0xbd6c('0x1f')]=qs[_0xbd6c('0x1f')](_0x31957d[_0xbd6c('0x32')]['offset']);}_0x1512f8[_0xbd6c('0x3b')]=qs['sort'](_0x31957d['query'][_0xbd6c('0x3c')]);_0x1512f8['where']=qs[_0xbd6c('0x34')](_['pick'](_0x31957d['query'],_0x1212b2[_0xbd6c('0x34')]));_0x1512f8[_0xbd6c('0x3d')][_0xbd6c('0x5b')]=_0x2c0523['id'];if(_0x31957d[_0xbd6c('0x32')][_0xbd6c('0x3e')]){_0x1512f8[_0xbd6c('0x3d')]=_['merge'](_0x1512f8[_0xbd6c('0x3d')],{'$or':_[_0xbd6c('0x2d')](_0x1512f8['attributes'],function(_0x42ed8d){var _0x4b9aa1={};_0x4b9aa1[_0x42ed8d]={'$like':'%'+_0x31957d['query'][_0xbd6c('0x3e')]+'%'};return _0x4b9aa1;})});}_0x1512f8=_['merge']({},_0x1512f8,_0x31957d[_0xbd6c('0x42')]);return db['CmHopperBlack'][_0xbd6c('0x1e')]({'where':_0x1512f8[_0xbd6c('0x3d')]})[_0xbd6c('0x24')](function(_0x371dae){_0x35386d[_0xbd6c('0x1e')]=_0x371dae;if(_0x31957d[_0xbd6c('0x32')][_0xbd6c('0x43')]){_0x1512f8[_0xbd6c('0x47')]=[{'all':!![]}];}return db[_0xbd6c('0x60')][_0xbd6c('0x44')](_0x1512f8);})[_0xbd6c('0x24')](function(_0x2095ce){_0x35386d[_0xbd6c('0x45')]=_0x2095ce;return _0x35386d;});}})[_0xbd6c('0x24')](respondWithFilteredResult(_0x3abb15,_0x1512f8))[_0xbd6c('0x49')](handleError(_0x3abb15,null));};exports[_0xbd6c('0x61')]=function(_0x585444,_0x109488,_0xce1f17){var _0x1b36dd={};var _0x35043f={};var _0x4f9d39;var _0x264220;return db[_0xbd6c('0x2e')][_0xbd6c('0x5c')]({'where':{'id':_0x585444['params']['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x109488,null))['then'](function(_0x400ba9){if(_0x400ba9){_0x4f9d39=_0x400ba9;_0x35043f[_0xbd6c('0x31')]=_[_0xbd6c('0x33')](db[_0xbd6c('0x62')]['rawAttributes']);_0x35043f[_0xbd6c('0x32')]=_[_0xbd6c('0x33')](_0x585444[_0xbd6c('0x32')]);_0x35043f[_0xbd6c('0x34')]=_[_0xbd6c('0x35')](_0x35043f['model'],_0x35043f[_0xbd6c('0x32')]);_0x1b36dd[_0xbd6c('0x36')]=_['intersection'](_0x35043f[_0xbd6c('0x31')],qs['fields'](_0x585444['query']['fields']));_0x1b36dd[_0xbd6c('0x36')]=_0x1b36dd[_0xbd6c('0x36')][_0xbd6c('0x38')]?_0x1b36dd[_0xbd6c('0x36')]:_0x35043f[_0xbd6c('0x31')];_0x1b36dd[_0xbd6c('0x3b')]=qs[_0xbd6c('0x3c')](_0x585444[_0xbd6c('0x32')][_0xbd6c('0x3c')]);_0x1b36dd['where']=qs[_0xbd6c('0x34')](_[_0xbd6c('0x5a')](_0x585444[_0xbd6c('0x32')],_0x35043f[_0xbd6c('0x34')]));if(_0x585444[_0xbd6c('0x32')][_0xbd6c('0x3e')]){_0x1b36dd[_0xbd6c('0x3d')]=_['merge'](_0x1b36dd[_0xbd6c('0x3d')],{'$or':_[_0xbd6c('0x2d')](_0x1b36dd[_0xbd6c('0x36')],function(_0x22e15d){var _0x832618={};_0x832618[_0x22e15d]={'$like':'%'+_0x585444[_0xbd6c('0x32')]['filter']+'%'};return _0x832618;})});}_0x1b36dd=_[_0xbd6c('0x3f')]({},_0x1b36dd,_0x585444[_0xbd6c('0x42')]);return _0x4f9d39['getLists'](_0x1b36dd);}})[_0xbd6c('0x24')](function(_0x18a130){if(_0x18a130){_0x264220=_0x18a130[_0xbd6c('0x38')];if(!_0x585444[_0xbd6c('0x32')][_0xbd6c('0x39')](_0xbd6c('0x3a'))){_0x1b36dd[_0xbd6c('0x1d')]=qs['limit'](_0x585444[_0xbd6c('0x32')][_0xbd6c('0x1d')]);_0x1b36dd[_0xbd6c('0x1f')]=qs['offset'](_0x585444['query']['offset']);}return _0x4f9d39[_0xbd6c('0x61')](_0x1b36dd);}})[_0xbd6c('0x24')](function(_0xc897f7){if(_0xc897f7){return _0xc897f7?{'count':_0x264220,'rows':_0xc897f7}:null;}})[_0xbd6c('0x24')](respondWithResult(_0x109488,null))[_0xbd6c('0x49')](handleError(_0x109488,null));};exports['addLists']=function(_0xbaa95c,_0x2f9c04,_0x3c1f5a){var _0x2b27ab,_0x1e333b;var _0x2ff2e1=[];var _0x2cf25a=moment()['format'](_0xbd6c('0x63'));return db[_0xbd6c('0x2e')][_0xbd6c('0x48')]({'where':{'id':_0xbaa95c[_0xbd6c('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f9c04,null))[_0xbd6c('0x24')](function(_0x32a272){if(_0x32a272){_0x1e333b=_0x32a272;return _0x32a272['addLists'](_0xbaa95c[_0xbd6c('0x4b')][_0xbd6c('0x64')],_[_0xbd6c('0x52')](_0xbaa95c[_0xbd6c('0x4b')],[_0xbd6c('0x64'),'id'])||{});}return null;})['spread'](function(_0x32ee3e){var _0x4f0012;var _0x24dd8b;_0x2b27ab=_0x32ee3e||[];var _0x110907=[];if(_0x32ee3e){for(var _0x3c4de5=0x0;_0x3c4de5<_0x32ee3e['length'];_0x3c4de5+=0x1){var _0x1b7959=_0x32ee3e[_0x3c4de5][_0xbd6c('0x4c')]({'plain':!![]});_0x1e333b[_0xbd6c('0x65')]=_0xbaa95c['body'][_0xbd6c('0x65')]?_0xbaa95c['body'][_0xbd6c('0x65')]:_0x1e333b[_0xbd6c('0x65')];switch(_0x1e333b[_0xbd6c('0x65')]){case _0xbd6c('0x66'):_0x4f0012=squel[_0xbd6c('0x67')]()[_0xbd6c('0x68')]('cm_hopper')['fromQuery']([_0xbd6c('0x69'),_0xbd6c('0x6a'),_0xbd6c('0x6b'),_0xbd6c('0x6c'),_0xbd6c('0x5b'),_0xbd6c('0x54'),'updatedAt'],squel['select']()[_0xbd6c('0x6d')](_0xbd6c('0x69'),_0xbd6c('0x69'))[_0xbd6c('0x6d')](_0xbd6c('0x6e'),_0xbd6c('0x6a'))['field']('id',_0xbd6c('0x6b'))[_0xbd6c('0x6d')](_0x1b7959[_0xbd6c('0x6f')][_0xbd6c('0x70')](),_0xbd6c('0x6c'))[_0xbd6c('0x6d')](_0xbaa95c[_0xbd6c('0x46')]['id'][_0xbd6c('0x70')](),_0xbd6c('0x5b'))[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27',_0xbd6c('0x54'))[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27',_0xbd6c('0x53'))['from']('cm_contacts')[_0xbd6c('0x3d')](_0xbd6c('0x71'))[_0xbd6c('0x3d')]('ListId\x20=\x20?',_0x1b7959[_0xbd6c('0x6f')][_0xbd6c('0x70')]())[_0xbd6c('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xbd6c('0x3d')](_0xbd6c('0x72'),squel[_0xbd6c('0x73')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0xbd6c('0x74'))[_0xbd6c('0x3d')](_0xbd6c('0x75'),_0xbaa95c[_0xbd6c('0x46')]['id'][_0xbd6c('0x70')]()))[_0xbd6c('0x3d')](_0xbd6c('0x72'),squel[_0xbd6c('0x73')]()['field']('COALESCE(phone,\x27\x27)')[_0xbd6c('0x76')]('cm_hopper')['where'](_0xbd6c('0x75'),_0xbaa95c[_0xbd6c('0x46')]['id']['toString']())))[_0xbd6c('0x70')]();break;case _0xbd6c('0x77'):_0x4f0012=squel['insert']()[_0xbd6c('0x68')]('cm_hopper')['fromQuery'](['phone',_0xbd6c('0x6a'),_0xbd6c('0x6b'),'ListId','CampaignId',_0xbd6c('0x54'),_0xbd6c('0x53')],squel[_0xbd6c('0x73')]()[_0xbd6c('0x6d')]('phone',_0xbd6c('0x69'))[_0xbd6c('0x6d')](_0xbd6c('0x6e'),_0xbd6c('0x6a'))[_0xbd6c('0x6d')]('id',_0xbd6c('0x6b'))['field'](_0x1b7959[_0xbd6c('0x6f')][_0xbd6c('0x70')](),_0xbd6c('0x6c'))[_0xbd6c('0x6d')](_0xbaa95c['params']['id']['toString'](),_0xbd6c('0x5b'))[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27',_0xbd6c('0x54'))['field']('\x27'+_0x2cf25a+'\x27','updatedAt')[_0xbd6c('0x76')](_0xbd6c('0x78'))[_0xbd6c('0x3d')](_0xbd6c('0x71'))[_0xbd6c('0x3d')]('ListId\x20=\x20?',_0x1b7959[_0xbd6c('0x6f')]['toString']())['where'](_0xbd6c('0x79'))[_0xbd6c('0x3d')](_0xbd6c('0x72'),squel[_0xbd6c('0x73')]()[_0xbd6c('0x6d')](_0xbd6c('0x7a'))[_0xbd6c('0x76')](_0xbd6c('0x7b'))['where'](_0xbd6c('0x75'),_0xbaa95c['params']['id'][_0xbd6c('0x70')]())))[_0xbd6c('0x70')]();break;default:_0x4f0012=squel[_0xbd6c('0x67')]()['into'](_0xbd6c('0x7b'))[_0xbd6c('0x7c')]([_0xbd6c('0x69'),_0xbd6c('0x6a'),_0xbd6c('0x6b'),'ListId',_0xbd6c('0x5b'),_0xbd6c('0x54'),'updatedAt'],squel[_0xbd6c('0x73')]()[_0xbd6c('0x6d')](_0xbd6c('0x69'),_0xbd6c('0x69'))['field']('NOW()',_0xbd6c('0x6a'))[_0xbd6c('0x6d')]('id',_0xbd6c('0x6b'))['field'](_0x1b7959[_0xbd6c('0x6f')][_0xbd6c('0x70')](),'ListId')[_0xbd6c('0x6d')](_0xbaa95c[_0xbd6c('0x46')]['id'][_0xbd6c('0x70')](),_0xbd6c('0x5b'))[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27','createdAt')[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27',_0xbd6c('0x53'))[_0xbd6c('0x76')](_0xbd6c('0x78'))[_0xbd6c('0x3d')](_0xbd6c('0x71'))['where'](_0xbd6c('0x7d'),_0x1b7959['CmListId'][_0xbd6c('0x70')]())[_0xbd6c('0x3d')](_0xbd6c('0x79')))[_0xbd6c('0x70')]();}_0x24dd8b=squel['insert']()[_0xbd6c('0x68')]('cm_hopper_additional_phones')[_0xbd6c('0x7c')]([_0xbd6c('0x7e'),_0xbd6c('0x6a'),'phone',_0xbd6c('0x7f'),_0xbd6c('0x54'),_0xbd6c('0x53')],squel['select']()[_0xbd6c('0x6d')](_0xbd6c('0x80'),'id')[_0xbd6c('0x6d')](_0xbd6c('0x6e'),_0xbd6c('0x6a'))[_0xbd6c('0x6d')](_0xbd6c('0x81'),_0xbd6c('0x69'))['field']('ci.OrderBY',_0xbd6c('0x7f'))[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27',_0xbd6c('0x54'))[_0xbd6c('0x6d')]('\x27'+_0x2cf25a+'\x27','updatedAt')[_0xbd6c('0x76')](_0xbd6c('0x82'),'ci')[_0xbd6c('0x83')](_0xbd6c('0x7b'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xbd6c('0x3d')](_0xbd6c('0x84'),_0x1b7959[_0xbd6c('0x6f')][_0xbd6c('0x70')]())[_0xbd6c('0x3d')](_0xbd6c('0x85'),_0xbaa95c[_0xbd6c('0x46')]['id']['toString']())[_0xbd6c('0x3d')]('h.createdAt\x20=\x20?',_0x2cf25a))[_0xbd6c('0x70')]();_0x110907[_0xbd6c('0x86')](db[_0xbd6c('0x87')]['query'](_0x4f0012));_0x2ff2e1[_0xbd6c('0x86')](db[_0xbd6c('0x87')][_0xbd6c('0x32')](_0x24dd8b));}return BPromise[_0xbd6c('0x88')](_0x110907);}})[_0xbd6c('0x24')](function(){return BPromise[_0xbd6c('0x88')](_0x2ff2e1);})[_0xbd6c('0x24')](function(){return _0x2b27ab;})[_0xbd6c('0x24')](respondWithResult(_0x2f9c04,null))['catch'](handleError(_0x2f9c04,null));};exports[_0xbd6c('0x89')]=function(_0x54731b,_0x19efa4,_0x4ea28e){return db[_0xbd6c('0x2e')][_0xbd6c('0x48')]({'where':{'id':_0x54731b[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x19efa4,null))[_0xbd6c('0x24')](function(_0x5ec62c){if(_0x5ec62c){return _0x5ec62c['removeLists'](_0x54731b[_0xbd6c('0x32')]['ids']);}})[_0xbd6c('0x24')](function(_0x45231a){if(_0x45231a){return db[_0xbd6c('0x59')][_0xbd6c('0x27')]({'where':{'ListId':_0x54731b[_0xbd6c('0x32')][_0xbd6c('0x64')],'CampaignId':_0x54731b[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](function(){return _0x45231a;});}})['then'](respondWithStatusCode(_0x19efa4,null))['catch'](handleError(_0x19efa4,null));};exports[_0xbd6c('0x8a')]=function(_0x593cd5,_0x55dde4,_0x5d2a0c){var _0x101730={};var _0x5cc03d={};var _0x41e274;var _0x55f80c;return db[_0xbd6c('0x2e')][_0xbd6c('0x5c')]({'where':{'id':_0x593cd5[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0x55dde4,null))[_0xbd6c('0x24')](function(_0x4e2303){if(_0x4e2303){_0x41e274=_0x4e2303;_0x5cc03d[_0xbd6c('0x31')]=_[_0xbd6c('0x33')](db[_0xbd6c('0x62')]['rawAttributes']);_0x5cc03d['query']=_['keys'](_0x593cd5[_0xbd6c('0x32')]);_0x5cc03d['filters']=_[_0xbd6c('0x35')](_0x5cc03d[_0xbd6c('0x31')],_0x5cc03d[_0xbd6c('0x32')]);_0x101730[_0xbd6c('0x36')]=_[_0xbd6c('0x35')](_0x5cc03d[_0xbd6c('0x31')],qs[_0xbd6c('0x37')](_0x593cd5[_0xbd6c('0x32')][_0xbd6c('0x37')]));_0x101730['attributes']=_0x101730['attributes']['length']?_0x101730[_0xbd6c('0x36')]:_0x5cc03d[_0xbd6c('0x31')];_0x101730[_0xbd6c('0x3b')]=qs[_0xbd6c('0x3c')](_0x593cd5['query'][_0xbd6c('0x3c')]);_0x101730[_0xbd6c('0x3d')]=qs[_0xbd6c('0x34')](_['pick'](_0x593cd5['query'],_0x5cc03d[_0xbd6c('0x34')]));if(_0x593cd5[_0xbd6c('0x32')][_0xbd6c('0x3e')]){_0x101730[_0xbd6c('0x3d')]=_[_0xbd6c('0x3f')](_0x101730['where'],{'$or':_[_0xbd6c('0x2d')](_0x101730[_0xbd6c('0x36')],function(_0x5a314d){var _0x817fec={};_0x817fec[_0x5a314d]={'$like':'%'+_0x593cd5[_0xbd6c('0x32')][_0xbd6c('0x3e')]+'%'};return _0x817fec;})});}_0x101730=_[_0xbd6c('0x3f')]({},_0x101730,_0x593cd5[_0xbd6c('0x42')]);return _0x41e274['getBlackLists'](_0x101730);}})[_0xbd6c('0x24')](function(_0x51f8e4){if(_0x51f8e4){_0x55f80c=_0x51f8e4[_0xbd6c('0x38')];if(!_0x593cd5['query'][_0xbd6c('0x39')](_0xbd6c('0x3a'))){_0x101730[_0xbd6c('0x1d')]=qs[_0xbd6c('0x1d')](_0x593cd5[_0xbd6c('0x32')][_0xbd6c('0x1d')]);_0x101730[_0xbd6c('0x1f')]=qs[_0xbd6c('0x1f')](_0x593cd5['query'][_0xbd6c('0x1f')]);}return _0x41e274[_0xbd6c('0x8a')](_0x101730);}})[_0xbd6c('0x24')](function(_0x4024b6){if(_0x4024b6){return _0x4024b6?{'count':_0x55f80c,'rows':_0x4024b6}:null;}})[_0xbd6c('0x24')](respondWithResult(_0x55dde4,null))[_0xbd6c('0x49')](handleError(_0x55dde4,null));};exports[_0xbd6c('0x8b')]=function(_0x3e7797,_0xd21dd0,_0x50c533){var _0x3b8ec4,_0x4998d6;var _0x48bd8d=[];var _0x8e0754=moment()[_0xbd6c('0x8c')](_0xbd6c('0x63'));return db['Campaign'][_0xbd6c('0x48')]({'where':{'id':_0x3e7797[_0xbd6c('0x46')]['id']}})['then'](handleEntityNotFound(_0xd21dd0,null))['then'](function(_0x5329c6){if(_0x5329c6){_0x4998d6=_0x5329c6;return _0x5329c6[_0xbd6c('0x8b')](_0x3e7797['body'][_0xbd6c('0x64')],_[_0xbd6c('0x52')](_0x3e7797[_0xbd6c('0x4b')],[_0xbd6c('0x64'),'id'])||{});}return null;})[_0xbd6c('0x8d')](function(_0x2d5ade){var _0x18ab4d;var _0x4544f8;_0x3b8ec4=_0x2d5ade||[];var _0x1f97ea=[];if(_0x2d5ade){for(var _0x2a4000=0x0;_0x2a4000<_0x2d5ade['length'];_0x2a4000+=0x1){var _0x4b46f2=_0x2d5ade[_0x2a4000][_0xbd6c('0x4c')]({'plain':!![]});_0x18ab4d=squel[_0xbd6c('0x67')]()['into'](_0xbd6c('0x8e'))['fromQuery']([_0xbd6c('0x69'),_0xbd6c('0x6b'),_0xbd6c('0x6c'),_0xbd6c('0x5b'),_0xbd6c('0x54'),'updatedAt'],squel[_0xbd6c('0x73')]()['field'](_0xbd6c('0x69'),'phone')[_0xbd6c('0x6d')]('id','ContactId')[_0xbd6c('0x6d')](_0x4b46f2[_0xbd6c('0x6f')][_0xbd6c('0x70')](),'ListId')[_0xbd6c('0x6d')](_0x3e7797[_0xbd6c('0x46')]['id'][_0xbd6c('0x70')](),_0xbd6c('0x5b'))['field']('NOW()',_0xbd6c('0x54'))[_0xbd6c('0x6d')](_0xbd6c('0x6e'),_0xbd6c('0x53'))[_0xbd6c('0x76')](_0xbd6c('0x78'))['where'](_0xbd6c('0x71'))[_0xbd6c('0x3d')]('ListId\x20=\x20?',_0x4b46f2['CmListId'][_0xbd6c('0x70')]())[_0xbd6c('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x1f97ea[_0xbd6c('0x86')](db['sequelize'][_0xbd6c('0x32')](_0x18ab4d));}return BPromise[_0xbd6c('0x88')](_0x1f97ea);}})['then'](function(){return _0x3b8ec4;})[_0xbd6c('0x24')](respondWithResult(_0xd21dd0,null))['catch'](handleError(_0xd21dd0,null));};exports[_0xbd6c('0x8f')]=function(_0x54da6b,_0xd483ed,_0x573632){return db[_0xbd6c('0x2e')]['find']({'where':{'id':_0x54da6b[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](handleEntityNotFound(_0xd483ed,null))[_0xbd6c('0x24')](function(_0x545b65){if(_0x545b65){return _0x545b65[_0xbd6c('0x8f')](_0x54da6b['query'][_0xbd6c('0x64')]);}})[_0xbd6c('0x24')](function(_0x4cc61f){if(_0x4cc61f){return db['CmHopperBlack'][_0xbd6c('0x27')]({'where':{'ListId':_0x54da6b[_0xbd6c('0x32')][_0xbd6c('0x64')],'CampaignId':_0x54da6b[_0xbd6c('0x46')]['id']}})[_0xbd6c('0x24')](function(){return _0x4cc61f;});}})[_0xbd6c('0x24')](respondWithStatusCode(_0xd483ed,null))[_0xbd6c('0x49')](handleError(_0xd483ed,null));}; \ No newline at end of file +var _0x980c=['reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','error','stack','send','index','map','Campaign','rawAttributes','fieldName','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','getHoppers','CmHopper','pick','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','format','spread','removeBlackLists','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x472bb4,_0x43f4a9){var _0x3b3c18=function(_0x45e265){while(--_0x45e265){_0x472bb4['push'](_0x472bb4['shift']());}};_0x3b3c18(++_0x43f4a9);}(_0x980c,0x100));var _0xc980=function(_0x42878c,_0x303d3b){_0x42878c=_0x42878c-0x0;var _0x1743df=_0x980c[_0x42878c];return _0x1743df;};'use strict';var emlformat=require(_0xc980('0x0'));var rimraf=require(_0xc980('0x1'));var zipdir=require(_0xc980('0x2'));var jsonpatch=require(_0xc980('0x3'));var rp=require(_0xc980('0x4'));var moment=require(_0xc980('0x5'));var BPromise=require(_0xc980('0x6'));var Mustache=require(_0xc980('0x7'));var util=require(_0xc980('0x8'));var path=require(_0xc980('0x9'));var sox=require(_0xc980('0xa'));var csv=require('to-csv');var ejs=require(_0xc980('0xb'));var fs=require('fs');var fs_extra=require(_0xc980('0xc'));var _=require(_0xc980('0xd'));var squel=require(_0xc980('0xe'));var crypto=require(_0xc980('0xf'));var jsforce=require(_0xc980('0x10'));var deskjs=require(_0xc980('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc980('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc980('0x13'));var as=require(_0xc980('0x14'));var hardwareService=require(_0xc980('0x15'));var logger=require('../../config/logger')(_0xc980('0x16'));var utils=require(_0xc980('0x17'));var config=require(_0xc980('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc980('0x19'))['db'];function respondWithStatusCode(_0x42ef16,_0x3101fa){_0x3101fa=_0x3101fa||0xcc;return function(_0x20b510){if(_0x20b510){return _0x42ef16[_0xc980('0x1a')](_0x3101fa);}return _0x42ef16[_0xc980('0x1b')](_0x3101fa)[_0xc980('0x1c')]();};}function respondWithResult(_0x18aef9,_0x3c4ae0){_0x3c4ae0=_0x3c4ae0||0xc8;return function(_0x23e0fc){if(_0x23e0fc){return _0x18aef9[_0xc980('0x1b')](_0x3c4ae0)[_0xc980('0x1d')](_0x23e0fc);}};}function respondWithFilteredResult(_0x20ce6c,_0x5b95ac){return function(_0x59c547){if(_0x59c547){var _0xd12d7e=typeof _0x5b95ac['offset']==='undefined'&&typeof _0x5b95ac[_0xc980('0x1e')]===_0xc980('0x1f');var _0x3b86f1=_0x59c547[_0xc980('0x20')];var _0x32782d=_0xd12d7e?0x0:_0x5b95ac[_0xc980('0x21')];var _0x593e9e=_0xd12d7e?_0x59c547[_0xc980('0x20')]:_0x5b95ac[_0xc980('0x21')]+_0x5b95ac[_0xc980('0x1e')];var _0x5e093c;if(_0x593e9e>=_0x3b86f1){_0x593e9e=_0x3b86f1;_0x5e093c=0xc8;}else{_0x5e093c=0xce;}_0x20ce6c[_0xc980('0x1b')](_0x5e093c);return _0x20ce6c[_0xc980('0x22')](_0xc980('0x23'),_0x32782d+'-'+_0x593e9e+'/'+_0x3b86f1)[_0xc980('0x1d')](_0x59c547);}return null;};}function patchUpdates(_0x3249db){return function(_0x36087f){try{jsonpatch['apply'](_0x36087f,_0x3249db,!![]);}catch(_0x3c17f4){return BPromise[_0xc980('0x24')](_0x3c17f4);}return _0x36087f[_0xc980('0x25')]();};}function saveUpdates(_0x138d77,_0x101947){return function(_0x161c4a){if(_0x161c4a){return _0x161c4a[_0xc980('0x26')](_0x138d77)['then'](function(_0x591619){return _0x591619;});}return null;};}function removeEntity(_0x41f468,_0x39f92c){return function(_0x2fdd99){if(_0x2fdd99){return _0x2fdd99[_0xc980('0x27')]()[_0xc980('0x28')](function(){var _0x32845e=_0x2fdd99['get']({'plain':!![]});var _0x38eaf4=_0xc980('0x29');return db[_0xc980('0x2a')][_0xc980('0x27')]({'where':{'type':_0x38eaf4,'resourceId':_0x32845e['id']}})[_0xc980('0x28')](function(){return _0x2fdd99;});})[_0xc980('0x28')](function(){_0x41f468[_0xc980('0x1b')](0xcc)[_0xc980('0x1c')]();});}};}function handleEntityNotFound(_0x141129,_0x25bff6){return function(_0x893bca){if(!_0x893bca){_0x141129[_0xc980('0x1a')](0x194);}return _0x893bca;};}function handleError(_0x177ef6,_0x505388){_0x505388=_0x505388||0x1f4;return function(_0x4e08f2){logger[_0xc980('0x2b')](_0x4e08f2[_0xc980('0x2c')]);if(_0x4e08f2['name']){delete _0x4e08f2['name'];}_0x177ef6['status'](_0x505388)[_0xc980('0x2d')](_0x4e08f2);};}exports[_0xc980('0x2e')]=function(_0x53670c,_0x19d985){var _0x57912e={},_0x24a485={},_0x5e8435={'count':0x0,'rows':[]};var _0x19139d=_[_0xc980('0x2f')](db[_0xc980('0x30')][_0xc980('0x31')],function(_0x44389f){return{'name':_0x44389f[_0xc980('0x32')],'type':_0x44389f['type']['key']};});_0x24a485[_0xc980('0x33')]=_[_0xc980('0x2f')](_0x19139d,_0xc980('0x34'));_0x24a485[_0xc980('0x35')]=_[_0xc980('0x36')](_0x53670c[_0xc980('0x35')]);_0x24a485[_0xc980('0x37')]=_[_0xc980('0x38')](_0x24a485['model'],_0x24a485[_0xc980('0x35')]);_0x57912e['attributes']=_['intersection'](_0x24a485[_0xc980('0x33')],qs[_0xc980('0x39')](_0x53670c[_0xc980('0x35')][_0xc980('0x39')]));_0x57912e[_0xc980('0x3a')]=_0x57912e[_0xc980('0x3a')]['length']?_0x57912e[_0xc980('0x3a')]:_0x24a485['model'];if(!_0x53670c[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x57912e[_0xc980('0x1e')]=qs['limit'](_0x53670c[_0xc980('0x35')][_0xc980('0x1e')]);_0x57912e[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x53670c[_0xc980('0x35')][_0xc980('0x21')]);}_0x57912e[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x53670c[_0xc980('0x35')][_0xc980('0x3e')]);_0x57912e[_0xc980('0x3f')]=qs[_0xc980('0x37')](_['pick'](_0x53670c['query'],_0x24a485['filters']),_0x19139d);if(_0x53670c['query'][_0xc980('0x40')]){_0x57912e[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x57912e[_0xc980('0x3f')],{'$or':_['map'](_0x19139d,function(_0x54a9e9){if(_0x54a9e9['type']!==_0xc980('0x42')){var _0x16ed12={};_0x16ed12[_0x54a9e9[_0xc980('0x34')]]={'$like':'%'+_0x53670c[_0xc980('0x35')]['filter']+'%'};return _0x16ed12;}})});}_0x57912e=_[_0xc980('0x41')]({},_0x57912e,_0x53670c[_0xc980('0x43')]);var _0x19af3f={'where':_0x57912e[_0xc980('0x3f')]};return db[_0xc980('0x30')][_0xc980('0x20')](_0x19af3f)[_0xc980('0x28')](function(_0x80e624){_0x5e8435['count']=_0x80e624;if(_0x53670c[_0xc980('0x35')][_0xc980('0x44')]){_0x57912e[_0xc980('0x45')]=[{'all':!![]}];}return db[_0xc980('0x30')][_0xc980('0x46')](_0x57912e);})[_0xc980('0x28')](function(_0x3191d7){_0x5e8435[_0xc980('0x47')]=_0x3191d7;return _0x5e8435;})[_0xc980('0x28')](respondWithFilteredResult(_0x19d985,_0x57912e))[_0xc980('0x48')](handleError(_0x19d985,null));};exports['show']=function(_0x58e720,_0x52729c){var _0x21d23c={'raw':![],'where':{'id':_0x58e720[_0xc980('0x49')]['id']}},_0x5c1161={};_0x5c1161[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x30')][_0xc980('0x31')]);_0x5c1161[_0xc980('0x35')]=_['keys'](_0x58e720[_0xc980('0x35')]);_0x5c1161[_0xc980('0x37')]=_[_0xc980('0x38')](_0x5c1161[_0xc980('0x33')],_0x5c1161[_0xc980('0x35')]);_0x21d23c[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x5c1161[_0xc980('0x33')],qs[_0xc980('0x39')](_0x58e720[_0xc980('0x35')][_0xc980('0x39')]));_0x21d23c[_0xc980('0x3a')]=_0x21d23c[_0xc980('0x3a')][_0xc980('0x4a')]?_0x21d23c[_0xc980('0x3a')]:_0x5c1161['model'];if(_0x58e720[_0xc980('0x35')][_0xc980('0x44')]){_0x21d23c[_0xc980('0x45')]=[{'all':!![]}];}_0x21d23c=_['merge']({},_0x21d23c,_0x58e720[_0xc980('0x43')]);return db['Campaign'][_0xc980('0x4b')](_0x21d23c)['then'](handleEntityNotFound(_0x52729c,null))[_0xc980('0x28')](respondWithResult(_0x52729c,null))[_0xc980('0x48')](handleError(_0x52729c,null));};exports[_0xc980('0x4c')]=function(_0x549cc4,_0x562453){return db[_0xc980('0x30')][_0xc980('0x4c')](_0x549cc4[_0xc980('0x4d')],{})[_0xc980('0x28')](function(_0x3e0447){var _0x3b17fe=_0x549cc4[_0xc980('0x4e')][_0xc980('0x4f')]({'plain':!![]});if(!_0x3b17fe)throw new Error(_0xc980('0x50'));if(_0x3b17fe[_0xc980('0x51')]===_0xc980('0x4e')){var _0x25e7eb=_0x3e0447[_0xc980('0x4f')]({'plain':!![]});var _0x3e28e3='IvrCampaigns';return db['UserProfileSection'][_0xc980('0x4b')]({'where':{'name':_0x3e28e3,'userProfileId':_0x3b17fe[_0xc980('0x52')]},'raw':!![]})['then'](function(_0x57c265){if(_0x57c265&&_0x57c265[_0xc980('0x53')]===0x0){return db[_0xc980('0x2a')][_0xc980('0x4c')]({'name':_0x25e7eb[_0xc980('0x34')],'resourceId':_0x25e7eb['id'],'type':_0x57c265[_0xc980('0x34')],'sectionId':_0x57c265['id']},{})[_0xc980('0x28')](function(){return _0x3e0447;});}else{return _0x3e0447;}})[_0xc980('0x48')](function(_0x3b53a3){logger[_0xc980('0x2b')](_0xc980('0x54'),_0x3b53a3);throw _0x3b53a3;});}return _0x3e0447;})[_0xc980('0x28')](respondWithResult(_0x562453,0xc9))['catch'](handleError(_0x562453,null));};exports['clone']=function(_0x43c320,_0x26f9c3){var _0x4a9856={'where':{'id':_0x43c320['params']['id']}},_0x2ab0b0={};_0x2ab0b0['model']=_[_0xc980('0x36')](db[_0xc980('0x30')][_0xc980('0x31')]);_0x4a9856[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x2ab0b0[_0xc980('0x33')],qs[_0xc980('0x39')](_0x43c320[_0xc980('0x35')][_0xc980('0x39')]));_0x4a9856[_0xc980('0x3a')]=_0x4a9856[_0xc980('0x3a')]['length']?_0x4a9856[_0xc980('0x3a')]:_0x2ab0b0[_0xc980('0x33')];if(_0x43c320[_0xc980('0x35')]['includeAll']){_0x4a9856['include']=[{'all':!![]}];}_0x4a9856=_['merge']({},_0x4a9856,_0x43c320[_0xc980('0x43')]);return db[_0xc980('0x30')]['find'](_0x4a9856)[_0xc980('0x28')](handleEntityNotFound(_0x26f9c3,null))['then'](function(_0x26a2d4){if(_0x26a2d4){var _0x3d0d05=_0x26a2d4['get']({'plain':!![]});_0x3d0d05=qs[_0xc980('0x55')](_0x3d0d05,['id',_0xc980('0x56'),'updatedAt']);_0x43c320['body']=_[_0xc980('0x55')](_0x43c320[_0xc980('0x4d')],['id',_0xc980('0x56'),'updatedAt']);return db[_0xc980('0x30')][_0xc980('0x4c')](_[_0xc980('0x41')](_0x3d0d05,_0x43c320[_0xc980('0x4d')]),{'include':_0x43c320[_0xc980('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x120892){var _0x30363b=_0x43c320[_0xc980('0x4e')][_0xc980('0x4f')]({'plain':!![]});if(!_0x30363b)throw new Error(_0xc980('0x50'));if(_0x30363b[_0xc980('0x51')]===_0xc980('0x4e')){var _0x26d73c=_0x120892[_0xc980('0x4f')]({'plain':!![]});var _0x39b56b=_0xc980('0x29');return db['UserProfileSection'][_0xc980('0x4b')]({'where':{'name':_0x39b56b,'userProfileId':_0x30363b[_0xc980('0x52')]},'raw':!![]})[_0xc980('0x28')](function(_0x25120b){if(_0x25120b&&_0x25120b[_0xc980('0x53')]===0x0){return db['UserProfileResource'][_0xc980('0x4c')]({'name':_0x26d73c[_0xc980('0x34')],'resourceId':_0x26d73c['id'],'type':_0x25120b['name'],'sectionId':_0x25120b['id']},{})['then'](function(){return _0x120892;});}else{return _0x120892;}})['catch'](function(_0xa47e03){logger[_0xc980('0x2b')](_0xc980('0x54'),_0xa47e03);throw _0xa47e03;});}return _0x120892;});}})['then'](respondWithResult(_0x26f9c3,0xc9))[_0xc980('0x48')](handleError(_0x26f9c3,null));};exports[_0xc980('0x26')]=function(_0x44d172,_0x9a742f){if(_0x44d172['body']['id']){delete _0x44d172[_0xc980('0x4d')]['id'];}return db['Campaign']['find']({'where':{'id':_0x44d172[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x9a742f,null))[_0xc980('0x28')](saveUpdates(_0x44d172[_0xc980('0x4d')],null))['then'](respondWithResult(_0x9a742f,null))[_0xc980('0x48')](handleError(_0x9a742f,null));};exports[_0xc980('0x27')]=function(_0x4de2df,_0x1db810){return db[_0xc980('0x30')]['find']({'where':{'id':_0x4de2df[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x1db810,null))['then'](removeEntity(_0x1db810,null))[_0xc980('0x48')](handleError(_0x1db810,null));};exports[_0xc980('0x57')]=function(_0x407506,_0x44a05b,_0x381b3b){var _0x19cd8f={'raw':!![],'where':{}};var _0x4261cc={};var _0x28f72e={'count':0x0,'rows':[]};return db[_0xc980('0x30')]['findOne']({'where':{'id':_0x407506[_0xc980('0x49')]['id']}})['then'](handleEntityNotFound(_0x44a05b,null))['then'](function(_0x2fea4f){if(_0x2fea4f){_0x4261cc[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x58')][_0xc980('0x31')]);_0x4261cc[_0xc980('0x35')]=_[_0xc980('0x36')](_0x407506[_0xc980('0x35')]);_0x4261cc[_0xc980('0x37')]=_['intersection'](_0x4261cc[_0xc980('0x33')],_0x4261cc[_0xc980('0x35')]);_0x19cd8f[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x4261cc[_0xc980('0x33')],qs[_0xc980('0x39')](_0x407506['query'][_0xc980('0x39')]));_0x19cd8f[_0xc980('0x3a')]=_0x19cd8f[_0xc980('0x3a')][_0xc980('0x4a')]?_0x19cd8f[_0xc980('0x3a')]:_0x4261cc['model'];if(!_0x407506[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x19cd8f[_0xc980('0x1e')]=qs['limit'](_0x407506[_0xc980('0x35')][_0xc980('0x1e')]);_0x19cd8f[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x407506[_0xc980('0x35')][_0xc980('0x21')]);}_0x19cd8f[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x407506[_0xc980('0x35')]['sort']);_0x19cd8f[_0xc980('0x3f')]=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x407506[_0xc980('0x35')],_0x4261cc['filters']));_0x19cd8f['where'][_0xc980('0x5a')]=_0x2fea4f['id'];if(_0x407506[_0xc980('0x35')]['filter']){_0x19cd8f[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x19cd8f[_0xc980('0x3f')],{'$or':_['map'](_0x19cd8f[_0xc980('0x3a')],function(_0x505bd2){var _0x2500aa={};_0x2500aa[_0x505bd2]={'$like':'%'+_0x407506[_0xc980('0x35')][_0xc980('0x40')]+'%'};return _0x2500aa;})});}_0x19cd8f=_['merge']({},_0x19cd8f,_0x407506['options']);return db[_0xc980('0x58')]['count']({'where':_0x19cd8f[_0xc980('0x3f')]})[_0xc980('0x28')](function(_0x3a49a8){_0x28f72e['count']=_0x3a49a8;if(_0x407506[_0xc980('0x35')]['includeAll']){_0x19cd8f[_0xc980('0x45')]=[{'all':!![]}];}return db[_0xc980('0x58')][_0xc980('0x46')](_0x19cd8f);})['then'](function(_0x1d97b8){_0x28f72e[_0xc980('0x47')]=_0x1d97b8;return _0x28f72e;});}})[_0xc980('0x28')](respondWithFilteredResult(_0x44a05b,_0x19cd8f))[_0xc980('0x48')](handleError(_0x44a05b,null));};exports[_0xc980('0x5b')]=function(_0x283642,_0x2c8b2d,_0x266927){var _0x1a0c18={'raw':!![],'where':{}};var _0x4894c4={};var _0x2168e4={'count':0x0,'rows':[]};return db[_0xc980('0x30')][_0xc980('0x5c')]({'where':{'id':_0x283642[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x2c8b2d,null))['then'](function(_0x4bd44b){if(_0x4bd44b){_0x4894c4[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x5d')][_0xc980('0x31')]);_0x4894c4[_0xc980('0x35')]=_[_0xc980('0x36')](_0x283642[_0xc980('0x35')]);_0x4894c4['filters']=_[_0xc980('0x38')](_0x4894c4[_0xc980('0x33')],_0x4894c4[_0xc980('0x35')]);_0x1a0c18['attributes']=_[_0xc980('0x38')](_0x4894c4[_0xc980('0x33')],qs[_0xc980('0x39')](_0x283642[_0xc980('0x35')][_0xc980('0x39')]));_0x1a0c18[_0xc980('0x3a')]=_0x1a0c18[_0xc980('0x3a')][_0xc980('0x4a')]?_0x1a0c18[_0xc980('0x3a')]:_0x4894c4[_0xc980('0x33')];if(!_0x283642[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x1a0c18[_0xc980('0x1e')]=qs[_0xc980('0x1e')](_0x283642[_0xc980('0x35')][_0xc980('0x1e')]);_0x1a0c18[_0xc980('0x21')]=qs['offset'](_0x283642[_0xc980('0x35')][_0xc980('0x21')]);}_0x1a0c18[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x283642['query'][_0xc980('0x3e')]);_0x1a0c18['where']=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x283642['query'],_0x4894c4[_0xc980('0x37')]));_0x1a0c18[_0xc980('0x3f')]['CampaignId']=_0x4bd44b['id'];if(_0x283642[_0xc980('0x35')][_0xc980('0x40')]){_0x1a0c18[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x1a0c18[_0xc980('0x3f')],{'$or':_[_0xc980('0x2f')](_0x1a0c18['attributes'],function(_0x4b9f51){var _0x429742={};_0x429742[_0x4b9f51]={'$like':'%'+_0x283642[_0xc980('0x35')]['filter']+'%'};return _0x429742;})});}_0x1a0c18=_[_0xc980('0x41')]({},_0x1a0c18,_0x283642[_0xc980('0x43')]);return db[_0xc980('0x5d')][_0xc980('0x20')]({'where':_0x1a0c18[_0xc980('0x3f')]})[_0xc980('0x28')](function(_0x24bcdf){_0x2168e4['count']=_0x24bcdf;if(_0x283642[_0xc980('0x35')]['includeAll']){_0x1a0c18[_0xc980('0x45')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc980('0x46')](_0x1a0c18);})[_0xc980('0x28')](function(_0x388f8c){_0x2168e4[_0xc980('0x47')]=_0x388f8c;return _0x2168e4;});}})['then'](respondWithFilteredResult(_0x2c8b2d,_0x1a0c18))['catch'](handleError(_0x2c8b2d,null));};exports['getHopperFinals']=function(_0x5d60b9,_0x4b8ed6,_0x1ecfe9){var _0x518ebf={'raw':!![],'where':{}};var _0x35b92a={};var _0x45df97={'count':0x0,'rows':[]};return db[_0xc980('0x30')][_0xc980('0x5c')]({'where':{'id':_0x5d60b9[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x4b8ed6,null))['then'](function(_0x4867b8){if(_0x4867b8){_0x35b92a[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x5e')]['rawAttributes']);_0x35b92a[_0xc980('0x35')]=_[_0xc980('0x36')](_0x5d60b9[_0xc980('0x35')]);_0x35b92a[_0xc980('0x37')]=_['intersection'](_0x35b92a[_0xc980('0x33')],_0x35b92a[_0xc980('0x35')]);_0x518ebf[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x35b92a[_0xc980('0x33')],qs[_0xc980('0x39')](_0x5d60b9['query'][_0xc980('0x39')]));_0x518ebf[_0xc980('0x3a')]=_0x518ebf['attributes'][_0xc980('0x4a')]?_0x518ebf[_0xc980('0x3a')]:_0x35b92a[_0xc980('0x33')];if(!_0x5d60b9[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x518ebf[_0xc980('0x1e')]=qs['limit'](_0x5d60b9[_0xc980('0x35')][_0xc980('0x1e')]);_0x518ebf['offset']=qs['offset'](_0x5d60b9[_0xc980('0x35')][_0xc980('0x21')]);}_0x518ebf['order']=qs['sort'](_0x5d60b9[_0xc980('0x35')]['sort']);_0x518ebf[_0xc980('0x3f')]=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x5d60b9['query'],_0x35b92a[_0xc980('0x37')]));_0x518ebf[_0xc980('0x3f')][_0xc980('0x5a')]=_0x4867b8['id'];if(_0x5d60b9[_0xc980('0x35')][_0xc980('0x40')]){_0x518ebf[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x518ebf[_0xc980('0x3f')],{'$or':_['map'](_0x518ebf[_0xc980('0x3a')],function(_0x34c7b5){var _0x1cd1c3={};_0x1cd1c3[_0x34c7b5]={'$like':'%'+_0x5d60b9['query']['filter']+'%'};return _0x1cd1c3;})});}_0x518ebf=_[_0xc980('0x41')]({},_0x518ebf,_0x5d60b9[_0xc980('0x43')]);return db[_0xc980('0x5e')][_0xc980('0x20')]({'where':_0x518ebf['where']})[_0xc980('0x28')](function(_0x4b6d08){_0x45df97[_0xc980('0x20')]=_0x4b6d08;if(_0x5d60b9[_0xc980('0x35')]['includeAll']){_0x518ebf['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc980('0x46')](_0x518ebf);})[_0xc980('0x28')](function(_0x170a28){_0x45df97[_0xc980('0x47')]=_0x170a28;return _0x45df97;});}})[_0xc980('0x28')](respondWithFilteredResult(_0x4b8ed6,_0x518ebf))[_0xc980('0x48')](handleError(_0x4b8ed6,null));};exports[_0xc980('0x5f')]=function(_0x131b9c,_0x426a2e,_0x2dbd0c){var _0x212f15={'raw':!![],'where':{}};var _0x4e26cf={};var _0x4c8475={'count':0x0,'rows':[]};return db[_0xc980('0x30')][_0xc980('0x5c')]({'where':{'id':_0x131b9c[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x426a2e,null))[_0xc980('0x28')](function(_0x598b6e){if(_0x598b6e){_0x4e26cf[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x60')]['rawAttributes']);_0x4e26cf['query']=_[_0xc980('0x36')](_0x131b9c[_0xc980('0x35')]);_0x4e26cf[_0xc980('0x37')]=_['intersection'](_0x4e26cf['model'],_0x4e26cf[_0xc980('0x35')]);_0x212f15[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x4e26cf[_0xc980('0x33')],qs['fields'](_0x131b9c[_0xc980('0x35')][_0xc980('0x39')]));_0x212f15[_0xc980('0x3a')]=_0x212f15[_0xc980('0x3a')]['length']?_0x212f15[_0xc980('0x3a')]:_0x4e26cf['model'];if(!_0x131b9c[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x212f15[_0xc980('0x1e')]=qs[_0xc980('0x1e')](_0x131b9c['query'][_0xc980('0x1e')]);_0x212f15[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x131b9c[_0xc980('0x35')]['offset']);}_0x212f15['order']=qs[_0xc980('0x3e')](_0x131b9c['query']['sort']);_0x212f15[_0xc980('0x3f')]=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x131b9c['query'],_0x4e26cf['filters']));_0x212f15[_0xc980('0x3f')][_0xc980('0x5a')]=_0x598b6e['id'];if(_0x131b9c[_0xc980('0x35')][_0xc980('0x40')]){_0x212f15[_0xc980('0x3f')]=_[_0xc980('0x41')](_0x212f15['where'],{'$or':_[_0xc980('0x2f')](_0x212f15['attributes'],function(_0x171f5d){var _0x5ab905={};_0x5ab905[_0x171f5d]={'$like':'%'+_0x131b9c['query'][_0xc980('0x40')]+'%'};return _0x5ab905;})});}_0x212f15=_[_0xc980('0x41')]({},_0x212f15,_0x131b9c['options']);return db[_0xc980('0x60')][_0xc980('0x20')]({'where':_0x212f15['where']})['then'](function(_0xdd8270){_0x4c8475['count']=_0xdd8270;if(_0x131b9c[_0xc980('0x35')][_0xc980('0x44')]){_0x212f15[_0xc980('0x45')]=[{'all':!![]}];}return db[_0xc980('0x60')][_0xc980('0x46')](_0x212f15);})[_0xc980('0x28')](function(_0xd132b1){_0x4c8475['rows']=_0xd132b1;return _0x4c8475;});}})[_0xc980('0x28')](respondWithFilteredResult(_0x426a2e,_0x212f15))[_0xc980('0x48')](handleError(_0x426a2e,null));};exports['getLists']=function(_0x2fb0c2,_0x41e212,_0x258347){var _0x2f68ec={};var _0x12c15b={};var _0x2333f7;var _0x51417b;return db['Campaign']['findOne']({'where':{'id':_0x2fb0c2['params']['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x41e212,null))[_0xc980('0x28')](function(_0xcbb6b7){if(_0xcbb6b7){_0x2333f7=_0xcbb6b7;_0x12c15b['model']=_[_0xc980('0x36')](db['CmList'][_0xc980('0x31')]);_0x12c15b[_0xc980('0x35')]=_[_0xc980('0x36')](_0x2fb0c2['query']);_0x12c15b['filters']=_[_0xc980('0x38')](_0x12c15b[_0xc980('0x33')],_0x12c15b[_0xc980('0x35')]);_0x2f68ec[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x12c15b[_0xc980('0x33')],qs[_0xc980('0x39')](_0x2fb0c2[_0xc980('0x35')][_0xc980('0x39')]));_0x2f68ec[_0xc980('0x3a')]=_0x2f68ec[_0xc980('0x3a')][_0xc980('0x4a')]?_0x2f68ec['attributes']:_0x12c15b[_0xc980('0x33')];_0x2f68ec[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x2fb0c2['query']['sort']);_0x2f68ec['where']=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x2fb0c2['query'],_0x12c15b[_0xc980('0x37')]));if(_0x2fb0c2[_0xc980('0x35')][_0xc980('0x40')]){_0x2f68ec['where']=_['merge'](_0x2f68ec[_0xc980('0x3f')],{'$or':_[_0xc980('0x2f')](_0x2f68ec[_0xc980('0x3a')],function(_0x5b11a2){var _0x37e437={};_0x37e437[_0x5b11a2]={'$like':'%'+_0x2fb0c2[_0xc980('0x35')][_0xc980('0x40')]+'%'};return _0x37e437;})});}_0x2f68ec=_['merge']({},_0x2f68ec,_0x2fb0c2[_0xc980('0x43')]);return _0x2333f7['getLists'](_0x2f68ec);}})[_0xc980('0x28')](function(_0x1764d0){if(_0x1764d0){_0x51417b=_0x1764d0[_0xc980('0x4a')];if(!_0x2fb0c2[_0xc980('0x35')]['hasOwnProperty'](_0xc980('0x3c'))){_0x2f68ec[_0xc980('0x1e')]=qs[_0xc980('0x1e')](_0x2fb0c2[_0xc980('0x35')][_0xc980('0x1e')]);_0x2f68ec[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x2fb0c2[_0xc980('0x35')][_0xc980('0x21')]);}return _0x2333f7[_0xc980('0x61')](_0x2f68ec);}})[_0xc980('0x28')](function(_0x2488c0){if(_0x2488c0){return _0x2488c0?{'count':_0x51417b,'rows':_0x2488c0}:null;}})[_0xc980('0x28')](respondWithResult(_0x41e212,null))['catch'](handleError(_0x41e212,null));};exports[_0xc980('0x62')]=function(_0xebdaf7,_0x11f096,_0x3c6997){var _0x5589b4,_0x2e61b0;var _0x22eb4a=[];var _0x16270d=moment()['format'](_0xc980('0x63'));return db['Campaign'][_0xc980('0x4b')]({'where':{'id':_0xebdaf7[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x11f096,null))[_0xc980('0x28')](function(_0x4680e8){if(_0x4680e8){_0x2e61b0=_0x4680e8;return _0x4680e8['addLists'](_0xebdaf7[_0xc980('0x4d')][_0xc980('0x64')],_['omit'](_0xebdaf7[_0xc980('0x4d')],[_0xc980('0x64'),'id'])||{});}return null;})['spread'](function(_0x395f07){var _0x40b685;var _0x3a9463;_0x5589b4=_0x395f07||[];var _0x523df8=[];if(_0x395f07){for(var _0x166be0=0x0;_0x166be0<_0x395f07[_0xc980('0x4a')];_0x166be0+=0x1){var _0x8253a5=_0x395f07[_0x166be0][_0xc980('0x4f')]({'plain':!![]});_0x2e61b0['dialCheckDuplicateType']=_0xebdaf7[_0xc980('0x4d')][_0xc980('0x65')]?_0xebdaf7[_0xc980('0x4d')]['dialCheckDuplicateType']:_0x2e61b0[_0xc980('0x65')];switch(_0x2e61b0[_0xc980('0x65')]){case _0xc980('0x66'):_0x40b685=squel[_0xc980('0x67')]()['into'](_0xc980('0x68'))[_0xc980('0x69')]([_0xc980('0x6a'),_0xc980('0x6b'),_0xc980('0x6c'),_0xc980('0x6d'),'CampaignId',_0xc980('0x56'),_0xc980('0x6e')],squel[_0xc980('0x6f')]()[_0xc980('0x70')](_0xc980('0x6a'),'phone')[_0xc980('0x70')](_0xc980('0x71'),'scheduledAt')[_0xc980('0x70')]('id',_0xc980('0x6c'))[_0xc980('0x70')](_0x8253a5[_0xc980('0x72')][_0xc980('0x73')](),'ListId')[_0xc980('0x70')](_0xebdaf7['params']['id'][_0xc980('0x73')](),'CampaignId')['field']('\x27'+_0x16270d+'\x27',_0xc980('0x56'))[_0xc980('0x70')]('\x27'+_0x16270d+'\x27',_0xc980('0x6e'))[_0xc980('0x74')](_0xc980('0x75'))[_0xc980('0x3f')](_0xc980('0x76'))['where'](_0xc980('0x77'),_0x8253a5[_0xc980('0x72')][_0xc980('0x73')]())[_0xc980('0x3f')](_0xc980('0x78'))[_0xc980('0x3f')](_0xc980('0x79'),squel[_0xc980('0x6f')]()[_0xc980('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0xc980('0x74')](_0xc980('0x7a'))[_0xc980('0x3f')](_0xc980('0x7b'),_0xebdaf7['params']['id']['toString']()))[_0xc980('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc980('0x70')](_0xc980('0x7c'))[_0xc980('0x74')]('cm_hopper')[_0xc980('0x3f')](_0xc980('0x7b'),_0xebdaf7[_0xc980('0x49')]['id']['toString']())))[_0xc980('0x73')]();break;case _0xc980('0x7d'):_0x40b685=squel[_0xc980('0x67')]()['into']('cm_hopper')[_0xc980('0x69')]([_0xc980('0x6a'),_0xc980('0x6b'),_0xc980('0x6c'),_0xc980('0x6d'),_0xc980('0x5a'),_0xc980('0x56'),_0xc980('0x6e')],squel[_0xc980('0x6f')]()[_0xc980('0x70')]('phone',_0xc980('0x6a'))[_0xc980('0x70')](_0xc980('0x71'),'scheduledAt')[_0xc980('0x70')]('id',_0xc980('0x6c'))['field'](_0x8253a5[_0xc980('0x72')][_0xc980('0x73')](),_0xc980('0x6d'))['field'](_0xebdaf7['params']['id'][_0xc980('0x73')](),_0xc980('0x5a'))['field']('\x27'+_0x16270d+'\x27',_0xc980('0x56'))[_0xc980('0x70')]('\x27'+_0x16270d+'\x27',_0xc980('0x6e'))[_0xc980('0x74')](_0xc980('0x75'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xc980('0x77'),_0x8253a5[_0xc980('0x72')][_0xc980('0x73')]())[_0xc980('0x3f')](_0xc980('0x78'))[_0xc980('0x3f')](_0xc980('0x79'),squel[_0xc980('0x6f')]()[_0xc980('0x70')]('COALESCE(phone,\x27\x27)')[_0xc980('0x74')](_0xc980('0x68'))[_0xc980('0x3f')](_0xc980('0x7b'),_0xebdaf7[_0xc980('0x49')]['id'][_0xc980('0x73')]())))[_0xc980('0x73')]();break;default:_0x40b685=squel[_0xc980('0x67')]()[_0xc980('0x7e')](_0xc980('0x68'))[_0xc980('0x69')]([_0xc980('0x6a'),_0xc980('0x6b'),'ContactId',_0xc980('0x6d'),_0xc980('0x5a'),_0xc980('0x56'),_0xc980('0x6e')],squel[_0xc980('0x6f')]()[_0xc980('0x70')](_0xc980('0x6a'),_0xc980('0x6a'))[_0xc980('0x70')]('NOW()','scheduledAt')[_0xc980('0x70')]('id',_0xc980('0x6c'))[_0xc980('0x70')](_0x8253a5[_0xc980('0x72')][_0xc980('0x73')](),_0xc980('0x6d'))[_0xc980('0x70')](_0xebdaf7[_0xc980('0x49')]['id'][_0xc980('0x73')](),_0xc980('0x5a'))[_0xc980('0x70')]('\x27'+_0x16270d+'\x27',_0xc980('0x56'))[_0xc980('0x70')]('\x27'+_0x16270d+'\x27','updatedAt')[_0xc980('0x74')](_0xc980('0x75'))[_0xc980('0x3f')](_0xc980('0x76'))[_0xc980('0x3f')](_0xc980('0x77'),_0x8253a5['CmListId'][_0xc980('0x73')]())[_0xc980('0x3f')](_0xc980('0x78')))[_0xc980('0x73')]();}_0x3a9463=squel[_0xc980('0x67')]()['into'](_0xc980('0x7f'))['fromQuery']([_0xc980('0x80'),'scheduledAt',_0xc980('0x6a'),_0xc980('0x81'),_0xc980('0x56'),'updatedAt'],squel['select']()[_0xc980('0x70')](_0xc980('0x82'),'id')[_0xc980('0x70')](_0xc980('0x71'),_0xc980('0x6b'))[_0xc980('0x70')]('ci.item','phone')[_0xc980('0x70')](_0xc980('0x83'),_0xc980('0x81'))[_0xc980('0x70')]('\x27'+_0x16270d+'\x27',_0xc980('0x56'))[_0xc980('0x70')]('\x27'+_0x16270d+'\x27','updatedAt')['from']('cm_contact_has_items','ci')[_0xc980('0x84')]('cm_hopper','h',_0xc980('0x85'))['where']('h.ListId\x20=\x20?',_0x8253a5[_0xc980('0x72')][_0xc980('0x73')]())['where'](_0xc980('0x86'),_0xebdaf7[_0xc980('0x49')]['id'][_0xc980('0x73')]())[_0xc980('0x3f')](_0xc980('0x87'),_0x16270d))[_0xc980('0x73')]();_0x523df8[_0xc980('0x88')](db[_0xc980('0x89')][_0xc980('0x35')](_0x40b685));_0x22eb4a[_0xc980('0x88')](db[_0xc980('0x89')][_0xc980('0x35')](_0x3a9463));}return BPromise[_0xc980('0x8a')](_0x523df8);}})[_0xc980('0x28')](function(){return BPromise[_0xc980('0x8a')](_0x22eb4a);})['then'](function(){return _0x5589b4;})[_0xc980('0x28')](respondWithResult(_0x11f096,null))[_0xc980('0x48')](handleError(_0x11f096,null));};exports[_0xc980('0x8b')]=function(_0x244907,_0x46f2b4,_0x5736dd){return db['Campaign'][_0xc980('0x4b')]({'where':{'id':_0x244907['params']['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x46f2b4,null))[_0xc980('0x28')](function(_0x200873){if(_0x200873){return _0x200873[_0xc980('0x8b')](_0x244907[_0xc980('0x35')][_0xc980('0x64')]);}})[_0xc980('0x28')](function(_0x4806d5){if(_0x4806d5){return db[_0xc980('0x58')][_0xc980('0x27')]({'where':{'ListId':_0x244907['query'][_0xc980('0x64')],'CampaignId':_0x244907[_0xc980('0x49')]['id']}})[_0xc980('0x28')](function(){return _0x4806d5;});}})[_0xc980('0x28')](respondWithStatusCode(_0x46f2b4,null))[_0xc980('0x48')](handleError(_0x46f2b4,null));};exports[_0xc980('0x8c')]=function(_0x6f74d3,_0x326f9c,_0x4a4916){var _0x180ebc={};var _0x589143={};var _0x1c564c;var _0x457e2d;return db[_0xc980('0x30')][_0xc980('0x5c')]({'where':{'id':_0x6f74d3['params']['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x326f9c,null))['then'](function(_0x5afade){if(_0x5afade){_0x1c564c=_0x5afade;_0x589143[_0xc980('0x33')]=_[_0xc980('0x36')](db[_0xc980('0x8d')][_0xc980('0x31')]);_0x589143['query']=_[_0xc980('0x36')](_0x6f74d3['query']);_0x589143['filters']=_['intersection'](_0x589143[_0xc980('0x33')],_0x589143[_0xc980('0x35')]);_0x180ebc[_0xc980('0x3a')]=_[_0xc980('0x38')](_0x589143[_0xc980('0x33')],qs['fields'](_0x6f74d3[_0xc980('0x35')]['fields']));_0x180ebc[_0xc980('0x3a')]=_0x180ebc[_0xc980('0x3a')][_0xc980('0x4a')]?_0x180ebc[_0xc980('0x3a')]:_0x589143[_0xc980('0x33')];_0x180ebc[_0xc980('0x3d')]=qs[_0xc980('0x3e')](_0x6f74d3[_0xc980('0x35')]['sort']);_0x180ebc['where']=qs[_0xc980('0x37')](_[_0xc980('0x59')](_0x6f74d3['query'],_0x589143[_0xc980('0x37')]));if(_0x6f74d3[_0xc980('0x35')]['filter']){_0x180ebc['where']=_[_0xc980('0x41')](_0x180ebc[_0xc980('0x3f')],{'$or':_[_0xc980('0x2f')](_0x180ebc[_0xc980('0x3a')],function(_0x1470b1){var _0x567203={};_0x567203[_0x1470b1]={'$like':'%'+_0x6f74d3['query'][_0xc980('0x40')]+'%'};return _0x567203;})});}_0x180ebc=_['merge']({},_0x180ebc,_0x6f74d3[_0xc980('0x43')]);return _0x1c564c['getBlackLists'](_0x180ebc);}})['then'](function(_0x590f2c){if(_0x590f2c){_0x457e2d=_0x590f2c[_0xc980('0x4a')];if(!_0x6f74d3[_0xc980('0x35')][_0xc980('0x3b')](_0xc980('0x3c'))){_0x180ebc[_0xc980('0x1e')]=qs[_0xc980('0x1e')](_0x6f74d3[_0xc980('0x35')]['limit']);_0x180ebc[_0xc980('0x21')]=qs[_0xc980('0x21')](_0x6f74d3[_0xc980('0x35')][_0xc980('0x21')]);}return _0x1c564c[_0xc980('0x8c')](_0x180ebc);}})[_0xc980('0x28')](function(_0x376331){if(_0x376331){return _0x376331?{'count':_0x457e2d,'rows':_0x376331}:null;}})[_0xc980('0x28')](respondWithResult(_0x326f9c,null))['catch'](handleError(_0x326f9c,null));};exports[_0xc980('0x8e')]=function(_0x428d86,_0x58e2ef,_0x560f7d){var _0x2d754b,_0x210747;var _0x532b31=[];var _0x46aaa2=moment()[_0xc980('0x8f')](_0xc980('0x63'));return db[_0xc980('0x30')][_0xc980('0x4b')]({'where':{'id':_0x428d86[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x58e2ef,null))[_0xc980('0x28')](function(_0x50562e){if(_0x50562e){_0x210747=_0x50562e;return _0x50562e[_0xc980('0x8e')](_0x428d86[_0xc980('0x4d')]['ids'],_[_0xc980('0x55')](_0x428d86[_0xc980('0x4d')],[_0xc980('0x64'),'id'])||{});}return null;})[_0xc980('0x90')](function(_0x283499){var _0x9b3f1;var _0x5804fc;_0x2d754b=_0x283499||[];var _0x369dfc=[];if(_0x283499){for(var _0x579ee3=0x0;_0x579ee3<_0x283499[_0xc980('0x4a')];_0x579ee3+=0x1){var _0x1d96f5=_0x283499[_0x579ee3][_0xc980('0x4f')]({'plain':!![]});_0x9b3f1=squel[_0xc980('0x67')]()[_0xc980('0x7e')]('cm_hopper_black')['fromQuery'](['phone',_0xc980('0x6c'),_0xc980('0x6d'),_0xc980('0x5a'),_0xc980('0x56'),_0xc980('0x6e')],squel[_0xc980('0x6f')]()[_0xc980('0x70')](_0xc980('0x6a'),_0xc980('0x6a'))[_0xc980('0x70')]('id',_0xc980('0x6c'))['field'](_0x1d96f5[_0xc980('0x72')][_0xc980('0x73')](),_0xc980('0x6d'))[_0xc980('0x70')](_0x428d86[_0xc980('0x49')]['id'][_0xc980('0x73')](),'CampaignId')[_0xc980('0x70')](_0xc980('0x71'),_0xc980('0x56'))['field'](_0xc980('0x71'),_0xc980('0x6e'))['from']('cm_contacts')[_0xc980('0x3f')]('deletedAt\x20IS\x20NULL')[_0xc980('0x3f')]('ListId\x20=\x20?',_0x1d96f5[_0xc980('0x72')][_0xc980('0x73')]())[_0xc980('0x3f')](_0xc980('0x78')))[_0xc980('0x73')]();_0x369dfc[_0xc980('0x88')](db[_0xc980('0x89')][_0xc980('0x35')](_0x9b3f1));}return BPromise['all'](_0x369dfc);}})[_0xc980('0x28')](function(){return _0x2d754b;})[_0xc980('0x28')](respondWithResult(_0x58e2ef,null))['catch'](handleError(_0x58e2ef,null));};exports[_0xc980('0x91')]=function(_0x19736a,_0x548d5f,_0x2948e6){return db[_0xc980('0x30')][_0xc980('0x4b')]({'where':{'id':_0x19736a[_0xc980('0x49')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x548d5f,null))[_0xc980('0x28')](function(_0x12bcca){if(_0x12bcca){return _0x12bcca['removeBlackLists'](_0x19736a['query'][_0xc980('0x64')]);}})[_0xc980('0x28')](function(_0x3d6cc1){if(_0x3d6cc1){return db[_0xc980('0x60')][_0xc980('0x27')]({'where':{'ListId':_0x19736a[_0xc980('0x35')][_0xc980('0x64')],'CampaignId':_0x19736a[_0xc980('0x49')]['id']}})['then'](function(){return _0x3d6cc1;});}})[_0xc980('0x28')](respondWithStatusCode(_0x548d5f,null))[_0xc980('0x48')](handleError(_0x548d5f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1fefb97..17dd12b 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3bfbf5,_0x1cd670){var _0x3aaac9=function(_0xa6508c){while(--_0xa6508c){_0x3bfbf5['push'](_0x3bfbf5['shift']());}};_0x3aaac9(++_0x1cd670);}(_0x7a54,0x106));var _0x47a5=function(_0x2e239a,_0x5702e6){_0x2e239a=_0x2e239a-0x0;var _0x27d63c=_0x7a54[_0x2e239a];return _0x27d63c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x64daf7,_0x3ce579){var _0x11d8d8=function(_0x3d986b){while(--_0x3d986b){_0x64daf7['push'](_0x64daf7['shift']());}};_0x11d8d8(++_0x3ce579);}(_0x7a54,0x106));var _0x47a5=function(_0x26db1e,_0x5e42ad){_0x26db1e=_0x26db1e-0x0;var _0x15a6ab=_0x7a54[_0x26db1e];return _0x15a6ab;};'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 75880f9..22c7922 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 _0xd691=['result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd691,0xe6));var _0x1d69=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0xd691[_0x6aad74];return _0x5b1c38;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var moment=require(_0x1d69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d69('0x3'));var fs=require('fs');var Redis=require(_0x1d69('0x4'));var db=require(_0x1d69('0x5'))['db'];var utils=require(_0x1d69('0x6'));var logger=require(_0x1d69('0x7'))(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var jayson=require(_0x1d69('0xa'));var client=jayson[_0x1d69('0xb')][_0x1d69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b0c,_0x520acb,_0x267da3){return new BPromise(function(_0x49f008,_0x369d44){return client[_0x1d69('0xd')](_0x5a5b0c,_0x267da3)[_0x1d69('0xe')](function(_0x364061){logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));logger[_0x1d69('0x11')](_0x1d69('0x12'),_0x520acb,_0x1d69('0x10'),JSON['stringify'](_0x364061));if(_0x364061['error']){if(_0x364061[_0x1d69('0x13')][_0x1d69('0x14')]===0x1f4){logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x369d44(_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);}logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x49f008(_0x364061[_0x1d69('0x13')]['message']);}else{logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));_0x49f008(_0x364061[_0x1d69('0x16')][_0x1d69('0x15')]);}})[_0x1d69('0x17')](function(_0x383771){logger['error'](_0x1d69('0xf'),_0x520acb,_0x383771);_0x369d44(_0x383771);});});}exports[_0x1d69('0x18')]=function(_0x34f6d4){var _0x53915f=this;return new Promise(function(_0x4cebea,_0x258249){return db[_0x1d69('0x19')][_0x1d69('0x1a')]({'raw':_0x34f6d4['options']?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1c')]===undefined?!![]:![]:!![],'where':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1d')]||null:null,'attributes':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1e')]||null:null,'limit':_0x34f6d4['options']?_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x1f')]||null:null,'include':_0x34f6d4[_0x1d69('0x1b')]?_0x34f6d4[_0x1d69('0x1b')]['include']?_[_0x1d69('0x20')](_0x34f6d4[_0x1d69('0x1b')][_0x1d69('0x21')],function(_0x54783d){return{'model':db[_0x54783d['model']],'as':_0x54783d['as'],'attributes':_0x54783d['attributes'],'include':_0x54783d[_0x1d69('0x21')]?_[_0x1d69('0x20')](_0x54783d[_0x1d69('0x21')],function(_0x1c91bf){return{'model':db[_0x1c91bf['model']],'as':_0x1c91bf['as'],'attributes':_0x1c91bf[_0x1d69('0x1e')],'include':_0x1c91bf[_0x1d69('0x21')]?_['map'](_0x1c91bf[_0x1d69('0x21')],function(_0x2dc73f){return{'model':db[_0x2dc73f[_0x1d69('0x22')]],'as':_0x2dc73f['as'],'attributes':_0x2dc73f[_0x1d69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d69('0xe')](function(_0x247130){logger['info'](_0x1d69('0x18'),_0x34f6d4);logger[_0x1d69('0x11')](_0x1d69('0x18'),_0x34f6d4,JSON[_0x1d69('0x23')](_0x247130));_0x4cebea(_0x247130);})[_0x1d69('0x17')](function(_0x1e5818){logger[_0x1d69('0x13')](_0x1d69('0x18'),_0x1e5818[_0x1d69('0x15')],_0x34f6d4);_0x258249(_0x53915f[_0x1d69('0x13')](0x1f4,_0x1e5818[_0x1d69('0x15')]));});});}; \ No newline at end of file +var _0x515d=['include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','limit'];(function(_0x239b75,_0x3b9225){var _0x524678=function(_0x533b01){while(--_0x533b01){_0x239b75['push'](_0x239b75['shift']());}};_0x524678(++_0x3b9225);}(_0x515d,0x104));var _0xd515=function(_0x318154,_0x553853){_0x318154=_0x318154-0x0;var _0x4191bc=_0x515d[_0x318154];return _0x4191bc;};'use strict';var _=require('lodash');var util=require(_0xd515('0x0'));var moment=require(_0xd515('0x1'));var BPromise=require(_0xd515('0x2'));var rs=require(_0xd515('0x3'));var fs=require('fs');var Redis=require(_0xd515('0x4'));var db=require(_0xd515('0x5'))['db'];var utils=require(_0xd515('0x6'));var logger=require(_0xd515('0x7'))('rpc');var config=require(_0xd515('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd515('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1130fc,_0x43d633,_0x26a25d){return new BPromise(function(_0x2ec6e2,_0x55a0da){return client[_0xd515('0xa')](_0x1130fc,_0x26a25d)[_0xd515('0xb')](function(_0x138086){logger[_0xd515('0xc')](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));logger['debug'](_0xd515('0xf'),_0x43d633,_0xd515('0xe'),JSON[_0xd515('0x10')](_0x138086));if(_0x138086[_0xd515('0x11')]){if(_0x138086['error'][_0xd515('0x12')]===0x1f4){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x55a0da(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x2ec6e2(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}else{logger['info'](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));_0x2ec6e2(_0x138086[_0xd515('0x14')][_0xd515('0x13')]);}})[_0xd515('0x15')](function(_0x33dbb6){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x33dbb6);_0x55a0da(_0x33dbb6);});});}exports[_0xd515('0x16')]=function(_0x564c4e){var _0x4ae5b7=this;return new Promise(function(_0x43bb12,_0x2b0173){return db[_0xd515('0x17')][_0xd515('0x18')]({'raw':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')][_0xd515('0x1a')]===undefined?!![]:![]:!![],'where':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')]['where']||null:null,'attributes':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')]['attributes']||null:null,'limit':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')][_0xd515('0x1b')]||null:null,'include':_0x564c4e['options']?_0x564c4e[_0xd515('0x19')][_0xd515('0x1c')]?_[_0xd515('0x1d')](_0x564c4e[_0xd515('0x19')]['include'],function(_0x430153){return{'model':db[_0x430153[_0xd515('0x1e')]],'as':_0x430153['as'],'attributes':_0x430153[_0xd515('0x1f')],'include':_0x430153[_0xd515('0x1c')]?_[_0xd515('0x1d')](_0x430153[_0xd515('0x1c')],function(_0x130533){return{'model':db[_0x130533[_0xd515('0x1e')]],'as':_0x130533['as'],'attributes':_0x130533[_0xd515('0x1f')],'include':_0x130533['include']?_['map'](_0x130533[_0xd515('0x1c')],function(_0x2b803a){return{'model':db[_0x2b803a[_0xd515('0x1e')]],'as':_0x2b803a['as'],'attributes':_0x2b803a[_0xd515('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd515('0xb')](function(_0x2171bc){logger[_0xd515('0xc')](_0xd515('0x16'),_0x564c4e);logger['debug'](_0xd515('0x16'),_0x564c4e,JSON[_0xd515('0x10')](_0x2171bc));_0x43bb12(_0x2171bc);})[_0xd515('0x15')](function(_0x154c02){logger[_0xd515('0x11')](_0xd515('0x16'),_0x154c02[_0xd515('0x13')],_0x564c4e);_0x2b0173(_0x4ae5b7['error'](0x1f4,_0x154c02['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 71ef5e0..41bfa5b 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 _0x3ee9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','post','/:id/clone','addLists','put','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','multer','connect-timeout','Router','fs-extra'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0x3ee9,0xd5));var _0x93ee=function(_0x50a700,_0x5901b1){_0x50a700=_0x50a700-0x0;var _0x3abf0c=_0x3ee9[_0x50a700];return _0x3abf0c;};'use strict';var multer=require(_0x93ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x93ee('0x1'));var express=require('express');var router=express[_0x93ee('0x2')]();var fs_extra=require(_0x93ee('0x3'));var auth=require(_0x93ee('0x4'));var interaction=require(_0x93ee('0x5'));var config=require(_0x93ee('0x6'));var controller=require(_0x93ee('0x7'));router[_0x93ee('0x8')]('/',auth[_0x93ee('0x9')](),controller[_0x93ee('0xa')]);router[_0x93ee('0x8')](_0x93ee('0xb'),auth[_0x93ee('0x9')](),controller[_0x93ee('0xc')]);router[_0x93ee('0x8')](_0x93ee('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x93ee('0x8')](_0x93ee('0xe'),auth[_0x93ee('0x9')](),controller[_0x93ee('0xf')]);router[_0x93ee('0x8')](_0x93ee('0x10'),auth['isAuthenticated'](),controller[_0x93ee('0x11')]);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x93ee('0x12')]);router[_0x93ee('0x8')](_0x93ee('0x13'),auth[_0x93ee('0x9')](),controller[_0x93ee('0x14')]);router[_0x93ee('0x8')]('/:id/blacklists',auth[_0x93ee('0x9')](),controller['getBlackLists']);router[_0x93ee('0x15')]('/',auth[_0x93ee('0x9')](),controller['create']);router['post'](_0x93ee('0x16'),auth['isAuthenticated'](),controller['clone']);router[_0x93ee('0x15')](_0x93ee('0x13'),auth[_0x93ee('0x9')](),controller[_0x93ee('0x17')]);router[_0x93ee('0x15')]('/:id/blacklists',auth[_0x93ee('0x9')](),controller['addBlackLists']);router[_0x93ee('0x18')](_0x93ee('0xb'),auth[_0x93ee('0x9')](),controller[_0x93ee('0x19')]);router[_0x93ee('0x1a')](_0x93ee('0xb'),auth['isAuthenticated'](),controller[_0x93ee('0x1b')]);router['delete'](_0x93ee('0x13'),auth['isAuthenticated'](),controller[_0x93ee('0x1c')]);router['delete'](_0x93ee('0x1d'),auth['isAuthenticated'](),controller[_0x93ee('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x2dae=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0x56bce4,_0x176888){var _0x4eca32=function(_0x54cae9){while(--_0x54cae9){_0x56bce4['push'](_0x56bce4['shift']());}};_0x4eca32(++_0x176888);}(_0x2dae,0xc3));var _0xe2da=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x2dae[_0x256d6a];return _0x460058;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['get'](_0xe2da('0x10'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x11')]);router[_0xe2da('0x9')](_0xe2da('0x12'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x13')]);router[_0xe2da('0x9')]('/:id/hopper_black',auth[_0xe2da('0xc')](),controller['getHopperBlacks']);router[_0xe2da('0x9')](_0xe2da('0x14'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x15')]);router[_0xe2da('0x9')](_0xe2da('0x16'),auth[_0xe2da('0xc')](),controller['getBlackLists']);router[_0xe2da('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2da('0x17')](_0xe2da('0x18'),auth[_0xe2da('0xc')](),controller['clone']);router[_0xe2da('0x17')](_0xe2da('0x14'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x19')]);router['post'](_0xe2da('0x16'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x1a')]);router[_0xe2da('0x1b')](_0xe2da('0xb'),auth['isAuthenticated'](),controller[_0xe2da('0x1c')]);router[_0xe2da('0x1d')]('/:id',auth[_0xe2da('0xc')](),controller[_0xe2da('0x1e')]);router[_0xe2da('0x1d')](_0xe2da('0x14'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x1f')]);router['delete'](_0xe2da('0x16'),auth['isAuthenticated'](),controller[_0xe2da('0x20')]);module[_0xe2da('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 7c2845a..5dc7491 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 _0x6462=['sequelize','exports','STRING','TEXT','key'];(function(_0x200e37,_0xaf3eea){var _0xa2f37f=function(_0x626f5){while(--_0x626f5){_0x200e37['push'](_0x200e37['shift']());}};_0xa2f37f(++_0xaf3eea);}(_0x6462,0xaa));var _0x2646=function(_0x150c9a,_0x26a1f2){_0x150c9a=_0x150c9a-0x0;var _0x4ff46a=_0x6462[_0x150c9a];return _0x4ff46a;};'use strict';var Sequelize=require(_0x2646('0x0'));module[_0x2646('0x1')]={'key':{'type':Sequelize[_0x2646('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2646('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x2646('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2646('0x4'));}}}; \ No newline at end of file +var _0x6c79=['getDataValue','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x3e19f5,_0x58f8a2){var _0x23fe6e=function(_0x2e5cdb){while(--_0x2e5cdb){_0x3e19f5['push'](_0x3e19f5['shift']());}};_0x23fe6e(++_0x58f8a2);}(_0x6c79,0x9d));var _0x96c7=function(_0xddf152,_0x39a677){_0xddf152=_0xddf152-0x0;var _0x2a1e99=_0x6c79[_0xddf152];return _0x2a1e99;};'use strict';var Sequelize=require(_0x96c7('0x0'));module[_0x96c7('0x1')]={'key':{'type':Sequelize[_0x96c7('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x96c7('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x96c7('0x4')],'get':function(){return this[_0x96c7('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 14b36c1..16f3df5 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 _0xd301=['offset','undefined','limit','count','set','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CannedAnswer','includeAll','include','rows','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','role','UserProfileSection','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x40e081,_0x8c0484){var _0x23ac55=function(_0x1bb73b){while(--_0x1bb73b){_0x40e081['push'](_0x40e081['shift']());}};_0x23ac55(++_0x8c0484);}(_0xd301,0x8f));var _0x1d30=function(_0x2a3cb2,_0x55280a){_0x2a3cb2=_0x2a3cb2-0x0;var _0x4120af=_0xd301[_0x2a3cb2];return _0x4120af;};'use strict';var emlformat=require(_0x1d30('0x0'));var rimraf=require(_0x1d30('0x1'));var zipdir=require(_0x1d30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d30('0x3'));var moment=require(_0x1d30('0x4'));var BPromise=require(_0x1d30('0x5'));var Mustache=require(_0x1d30('0x6'));var util=require(_0x1d30('0x7'));var path=require(_0x1d30('0x8'));var sox=require(_0x1d30('0x9'));var csv=require(_0x1d30('0xa'));var ejs=require(_0x1d30('0xb'));var fs=require('fs');var fs_extra=require(_0x1d30('0xc'));var _=require(_0x1d30('0xd'));var squel=require(_0x1d30('0xe'));var crypto=require(_0x1d30('0xf'));var jsforce=require(_0x1d30('0x10'));var deskjs=require(_0x1d30('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1d30('0x12'));var Papa=require(_0x1d30('0x13'));var Redis=require('ioredis');var authService=require(_0x1d30('0x14'));var qs=require(_0x1d30('0x15'));var as=require(_0x1d30('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d30('0x17'))('api');var utils=require(_0x1d30('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1d30('0x19'));var db=require(_0x1d30('0x1a'))['db'];function respondWithStatusCode(_0x2e2af6,_0x476d78){_0x476d78=_0x476d78||0xcc;return function(_0x2e70cd){if(_0x2e70cd){return _0x2e2af6[_0x1d30('0x1b')](_0x476d78);}return _0x2e2af6[_0x1d30('0x1c')](_0x476d78)[_0x1d30('0x1d')]();};}function respondWithResult(_0x378f49,_0x1c670a){_0x1c670a=_0x1c670a||0xc8;return function(_0x28f8fc){if(_0x28f8fc){return _0x378f49[_0x1d30('0x1c')](_0x1c670a)[_0x1d30('0x1e')](_0x28f8fc);}};}function respondWithFilteredResult(_0x5b4190,_0x26ca9d){return function(_0x1a1024){if(_0x1a1024){var _0x5f3964=typeof _0x26ca9d[_0x1d30('0x1f')]===_0x1d30('0x20')&&typeof _0x26ca9d[_0x1d30('0x21')]==='undefined';var _0x22973b=_0x1a1024[_0x1d30('0x22')];var _0x34b828=_0x5f3964?0x0:_0x26ca9d['offset'];var _0x4cddaa=_0x5f3964?_0x1a1024[_0x1d30('0x22')]:_0x26ca9d[_0x1d30('0x1f')]+_0x26ca9d[_0x1d30('0x21')];var _0x1e0635;if(_0x4cddaa>=_0x22973b){_0x4cddaa=_0x22973b;_0x1e0635=0xc8;}else{_0x1e0635=0xce;}_0x5b4190['status'](_0x1e0635);return _0x5b4190[_0x1d30('0x23')]('Content-Range',_0x34b828+'-'+_0x4cddaa+'/'+_0x22973b)[_0x1d30('0x1e')](_0x1a1024);}return null;};}function patchUpdates(_0x28c6e7){return function(_0x6a4411){try{jsonpatch[_0x1d30('0x24')](_0x6a4411,_0x28c6e7,!![]);}catch(_0x1bfc98){return BPromise['reject'](_0x1bfc98);}return _0x6a4411[_0x1d30('0x25')]();};}function saveUpdates(_0x442679,_0x259bb6){return function(_0x5df185){if(_0x5df185){return _0x5df185[_0x1d30('0x26')](_0x442679)[_0x1d30('0x27')](function(_0x30370d){return _0x30370d;});}return null;};}function removeEntity(_0x4622ad,_0x5392fe){return function(_0x42831f){if(_0x42831f){return _0x42831f[_0x1d30('0x28')]()[_0x1d30('0x27')](function(){var _0x3afc7e=_0x42831f[_0x1d30('0x29')]({'plain':!![]});var _0x2b780e=_0x1d30('0x2a');return db['UserProfileResource'][_0x1d30('0x28')]({'where':{'type':_0x2b780e,'resourceId':_0x3afc7e['id']}})[_0x1d30('0x27')](function(){return _0x42831f;});})[_0x1d30('0x27')](function(){_0x4622ad[_0x1d30('0x1c')](0xcc)[_0x1d30('0x1d')]();});}};}function handleEntityNotFound(_0x10b42c,_0x5ec002){return function(_0x5c90ce){if(!_0x5c90ce){_0x10b42c['sendStatus'](0x194);}return _0x5c90ce;};}function handleError(_0x5eab2b,_0x250b24){_0x250b24=_0x250b24||0x1f4;return function(_0x15a5e0){logger[_0x1d30('0x2b')](_0x15a5e0[_0x1d30('0x2c')]);if(_0x15a5e0[_0x1d30('0x2d')]){delete _0x15a5e0[_0x1d30('0x2d')];}_0x5eab2b['status'](_0x250b24)[_0x1d30('0x2e')](_0x15a5e0);};}exports['index']=function(_0x1671f7,_0x51252c){var _0x56b8ec={},_0x510875={},_0x8bf435={'count':0x0,'rows':[]};var _0x54cf2a=_[_0x1d30('0x2f')](db['CannedAnswer'][_0x1d30('0x30')],function(_0x104261){return{'name':_0x104261[_0x1d30('0x31')],'type':_0x104261[_0x1d30('0x32')]['key']};});_0x510875[_0x1d30('0x33')]=_['map'](_0x54cf2a,'name');_0x510875[_0x1d30('0x34')]=_[_0x1d30('0x35')](_0x1671f7[_0x1d30('0x34')]);_0x510875[_0x1d30('0x36')]=_[_0x1d30('0x37')](_0x510875[_0x1d30('0x33')],_0x510875['query']);_0x56b8ec[_0x1d30('0x38')]=_[_0x1d30('0x37')](_0x510875[_0x1d30('0x33')],qs[_0x1d30('0x39')](_0x1671f7[_0x1d30('0x34')]['fields']));_0x56b8ec['attributes']=_0x56b8ec['attributes'][_0x1d30('0x3a')]?_0x56b8ec[_0x1d30('0x38')]:_0x510875[_0x1d30('0x33')];if(!_0x1671f7[_0x1d30('0x34')][_0x1d30('0x3b')](_0x1d30('0x3c'))){_0x56b8ec[_0x1d30('0x21')]=qs[_0x1d30('0x21')](_0x1671f7[_0x1d30('0x34')]['limit']);_0x56b8ec['offset']=qs['offset'](_0x1671f7[_0x1d30('0x34')]['offset']);}_0x56b8ec[_0x1d30('0x3d')]=qs[_0x1d30('0x3e')](_0x1671f7[_0x1d30('0x34')]['sort']);_0x56b8ec[_0x1d30('0x3f')]=qs[_0x1d30('0x36')](_['pick'](_0x1671f7['query'],_0x510875['filters']),_0x54cf2a);if(_0x1671f7['query'][_0x1d30('0x40')]){_0x56b8ec[_0x1d30('0x3f')]=_[_0x1d30('0x41')](_0x56b8ec[_0x1d30('0x3f')],{'$or':[{'key':{'$like':'%'+_0x1671f7[_0x1d30('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x1671f7['query'][_0x1d30('0x40')]+'%'}}]});}_0x56b8ec=_[_0x1d30('0x41')]({},_0x56b8ec,_0x1671f7[_0x1d30('0x42')]);var _0xe6e302={'where':_0x56b8ec[_0x1d30('0x3f')]};return db[_0x1d30('0x43')]['count'](_0xe6e302)[_0x1d30('0x27')](function(_0x3e5a2e){_0x8bf435[_0x1d30('0x22')]=_0x3e5a2e;if(_0x1671f7[_0x1d30('0x34')][_0x1d30('0x44')]){_0x56b8ec[_0x1d30('0x45')]=[{'all':!![]}];}return db[_0x1d30('0x43')]['findAll'](_0x56b8ec);})['then'](function(_0x57d209){_0x8bf435[_0x1d30('0x46')]=_0x57d209;return _0x8bf435;})[_0x1d30('0x27')](respondWithFilteredResult(_0x51252c,_0x56b8ec))[_0x1d30('0x47')](handleError(_0x51252c,null));};exports['show']=function(_0xc4cb1,_0x41c8e8){var _0x119566={'raw':!![],'where':{'id':_0xc4cb1[_0x1d30('0x48')]['id']}},_0x3f3a78={};_0x3f3a78['model']=_[_0x1d30('0x35')](db[_0x1d30('0x43')][_0x1d30('0x30')]);_0x3f3a78[_0x1d30('0x34')]=_[_0x1d30('0x35')](_0xc4cb1[_0x1d30('0x34')]);_0x3f3a78['filters']=_[_0x1d30('0x37')](_0x3f3a78[_0x1d30('0x33')],_0x3f3a78[_0x1d30('0x34')]);_0x119566[_0x1d30('0x38')]=_[_0x1d30('0x37')](_0x3f3a78[_0x1d30('0x33')],qs[_0x1d30('0x39')](_0xc4cb1[_0x1d30('0x34')][_0x1d30('0x39')]));_0x119566[_0x1d30('0x38')]=_0x119566[_0x1d30('0x38')][_0x1d30('0x3a')]?_0x119566[_0x1d30('0x38')]:_0x3f3a78[_0x1d30('0x33')];if(_0xc4cb1['query'][_0x1d30('0x44')]){_0x119566[_0x1d30('0x45')]=[{'all':!![]}];}_0x119566=_[_0x1d30('0x41')]({},_0x119566,_0xc4cb1[_0x1d30('0x42')]);return db[_0x1d30('0x43')][_0x1d30('0x49')](_0x119566)['then'](handleEntityNotFound(_0x41c8e8,null))[_0x1d30('0x27')](respondWithResult(_0x41c8e8,null))[_0x1d30('0x47')](handleError(_0x41c8e8,null));};exports[_0x1d30('0x26')]=function(_0x121943,_0x3a2a58){if(_0x121943[_0x1d30('0x4a')]['id']){delete _0x121943['body']['id'];}return db[_0x1d30('0x43')][_0x1d30('0x49')]({'where':{'id':_0x121943[_0x1d30('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a2a58,null))[_0x1d30('0x27')](saveUpdates(_0x121943[_0x1d30('0x4a')],null))[_0x1d30('0x27')](respondWithResult(_0x3a2a58,null))['catch'](handleError(_0x3a2a58,null));};exports[_0x1d30('0x28')]=function(_0x429896,_0x34b64c){return db[_0x1d30('0x43')]['find']({'where':{'id':_0x429896['params']['id']}})[_0x1d30('0x27')](handleEntityNotFound(_0x34b64c,null))[_0x1d30('0x27')](removeEntity(_0x34b64c,null))['catch'](handleError(_0x34b64c,null));};exports[_0x1d30('0x4b')]=function(_0x26a2fa,_0x2b406e){var _0x3840dc={'key':_0x26a2fa[_0x1d30('0x4a')]['key']};if(_0x26a2fa[_0x1d30('0x4a')][_0x1d30('0x4c')]){_0x3840dc[_0x1d30('0x4c')]=_0x26a2fa[_0x1d30('0x4a')][_0x1d30('0x4c')];}else if(_0x26a2fa[_0x1d30('0x4a')][_0x1d30('0x4d')]){_0x3840dc[_0x1d30('0x4d')]=_0x26a2fa[_0x1d30('0x4a')]['SmsAccountId'];}else if(_0x26a2fa['body'][_0x1d30('0x4e')]){_0x3840dc[_0x1d30('0x4e')]=_0x26a2fa[_0x1d30('0x4a')][_0x1d30('0x4e')];}else if(_0x26a2fa[_0x1d30('0x4a')][_0x1d30('0x4f')]){_0x3840dc['ChatWebsiteId']=_0x26a2fa[_0x1d30('0x4a')]['ChatWebsiteId'];}return db[_0x1d30('0x43')]['find']({'where':_0x3840dc})[_0x1d30('0x27')](function(_0x5cc8ac){if(_0x5cc8ac){throw new db[(_0x1d30('0x50'))][(_0x1d30('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x1d30('0x43')][_0x1d30('0x4b')](_0x26a2fa['body']);})[_0x1d30('0x27')](function(_0x2a78d1){var _0x5ceeb4=_0x26a2fa[_0x1d30('0x52')]['get']({'plain':!![]});if(!_0x5ceeb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ceeb4[_0x1d30('0x53')]==='user'){var _0x53c8bd=_0x2a78d1[_0x1d30('0x29')]({'plain':!![]});return db[_0x1d30('0x54')][_0x1d30('0x49')]({'where':{'name':_0x1d30('0x2a'),'userProfileId':_0x5ceeb4['userProfileId']},'raw':!![]})[_0x1d30('0x27')](function(_0x262329){if(_0x262329&&_0x262329[_0x1d30('0x55')]===0x0){return db[_0x1d30('0x56')][_0x1d30('0x4b')]({'name':_0x53c8bd[_0x1d30('0x2d')],'resourceId':_0x53c8bd['id'],'type':_0x262329['name'],'sectionId':_0x262329['id']},{})[_0x1d30('0x27')](function(){return _0x2a78d1;});}else{return _0x2a78d1;}})[_0x1d30('0x47')](function(_0x240969){logger[_0x1d30('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x240969);throw _0x240969;});}return _0x2a78d1;})[_0x1d30('0x27')](respondWithResult(_0x2b406e,0xc9))[_0x1d30('0x47')](handleError(_0x2b406e,null));}; \ No newline at end of file +var _0x4d52=['pick','filter','merge','include','catch','show','params','rawAttributes','includeAll','options','find','body','MailAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','CannedAnswer','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x38c663,_0x536a09){var _0x571680=function(_0x239476){while(--_0x239476){_0x38c663['push'](_0x38c663['shift']());}};_0x571680(++_0x536a09);}(_0x4d52,0x128));var _0x24d5=function(_0x4306bb,_0x5cf44b){_0x4306bb=_0x4306bb-0x0;var _0x48628a=_0x4d52[_0x4306bb];return _0x48628a;};'use strict';var emlformat=require(_0x24d5('0x0'));var rimraf=require(_0x24d5('0x1'));var zipdir=require(_0x24d5('0x2'));var jsonpatch=require(_0x24d5('0x3'));var rp=require(_0x24d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x24d5('0x5'));var util=require('util');var path=require(_0x24d5('0x6'));var sox=require('sox');var csv=require(_0x24d5('0x7'));var ejs=require(_0x24d5('0x8'));var fs=require('fs');var fs_extra=require(_0x24d5('0x9'));var _=require(_0x24d5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x24d5('0xb'));var deskjs=require(_0x24d5('0xc'));var toCsv=require(_0x24d5('0x7'));var querystring=require(_0x24d5('0xd'));var Papa=require(_0x24d5('0xe'));var Redis=require(_0x24d5('0xf'));var authService=require(_0x24d5('0x10'));var qs=require(_0x24d5('0x11'));var as=require(_0x24d5('0x12'));var hardwareService=require(_0x24d5('0x13'));var logger=require(_0x24d5('0x14'))(_0x24d5('0x15'));var utils=require(_0x24d5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x24d5('0x17'));var db=require(_0x24d5('0x18'))['db'];function respondWithStatusCode(_0x8cbf26,_0x4e5bbc){_0x4e5bbc=_0x4e5bbc||0xcc;return function(_0x598caf){if(_0x598caf){return _0x8cbf26[_0x24d5('0x19')](_0x4e5bbc);}return _0x8cbf26[_0x24d5('0x1a')](_0x4e5bbc)[_0x24d5('0x1b')]();};}function respondWithResult(_0x40927a,_0x4981c8){_0x4981c8=_0x4981c8||0xc8;return function(_0x34be40){if(_0x34be40){return _0x40927a['status'](_0x4981c8)[_0x24d5('0x1c')](_0x34be40);}};}function respondWithFilteredResult(_0x330b50,_0x49c0a6){return function(_0xa47a53){if(_0xa47a53){var _0xb67cd8=typeof _0x49c0a6['offset']===_0x24d5('0x1d')&&typeof _0x49c0a6[_0x24d5('0x1e')]===_0x24d5('0x1d');var _0x3c160c=_0xa47a53[_0x24d5('0x1f')];var _0x2dd49a=_0xb67cd8?0x0:_0x49c0a6[_0x24d5('0x20')];var _0x4c8165=_0xb67cd8?_0xa47a53[_0x24d5('0x1f')]:_0x49c0a6[_0x24d5('0x20')]+_0x49c0a6[_0x24d5('0x1e')];var _0x1a5032;if(_0x4c8165>=_0x3c160c){_0x4c8165=_0x3c160c;_0x1a5032=0xc8;}else{_0x1a5032=0xce;}_0x330b50[_0x24d5('0x1a')](_0x1a5032);return _0x330b50[_0x24d5('0x21')](_0x24d5('0x22'),_0x2dd49a+'-'+_0x4c8165+'/'+_0x3c160c)[_0x24d5('0x1c')](_0xa47a53);}return null;};}function patchUpdates(_0x1ab9ee){return function(_0x2e618f){try{jsonpatch[_0x24d5('0x23')](_0x2e618f,_0x1ab9ee,!![]);}catch(_0x4ff1b3){return BPromise['reject'](_0x4ff1b3);}return _0x2e618f[_0x24d5('0x24')]();};}function saveUpdates(_0x16c34b,_0x2fc940){return function(_0x59fa71){if(_0x59fa71){return _0x59fa71[_0x24d5('0x25')](_0x16c34b)[_0x24d5('0x26')](function(_0x395a7){return _0x395a7;});}return null;};}function removeEntity(_0x1dfdda,_0x26026f){return function(_0x2eb792){if(_0x2eb792){return _0x2eb792[_0x24d5('0x27')]()[_0x24d5('0x26')](function(){var _0x1945d1=_0x2eb792[_0x24d5('0x28')]({'plain':!![]});var _0x29731d='CannedAnswers';return db[_0x24d5('0x29')][_0x24d5('0x27')]({'where':{'type':_0x29731d,'resourceId':_0x1945d1['id']}})[_0x24d5('0x26')](function(){return _0x2eb792;});})[_0x24d5('0x26')](function(){_0x1dfdda[_0x24d5('0x1a')](0xcc)[_0x24d5('0x1b')]();});}};}function handleEntityNotFound(_0x105ecd,_0x480c1a){return function(_0x25ec24){if(!_0x25ec24){_0x105ecd['sendStatus'](0x194);}return _0x25ec24;};}function handleError(_0x431aa4,_0x77a799){_0x77a799=_0x77a799||0x1f4;return function(_0x183a90){logger['error'](_0x183a90[_0x24d5('0x2a')]);if(_0x183a90[_0x24d5('0x2b')]){delete _0x183a90[_0x24d5('0x2b')];}_0x431aa4['status'](_0x77a799)[_0x24d5('0x2c')](_0x183a90);};}exports[_0x24d5('0x2d')]=function(_0x3f0f9a,_0x434846){var _0x4a5853={},_0x501fe1={},_0xfa11ae={'count':0x0,'rows':[]};var _0x41ec6d=_['map'](db[_0x24d5('0x2e')]['rawAttributes'],function(_0x5aa881){return{'name':_0x5aa881[_0x24d5('0x2f')],'type':_0x5aa881[_0x24d5('0x30')][_0x24d5('0x31')]};});_0x501fe1[_0x24d5('0x32')]=_[_0x24d5('0x33')](_0x41ec6d,_0x24d5('0x2b'));_0x501fe1[_0x24d5('0x34')]=_[_0x24d5('0x35')](_0x3f0f9a[_0x24d5('0x34')]);_0x501fe1[_0x24d5('0x36')]=_[_0x24d5('0x37')](_0x501fe1[_0x24d5('0x32')],_0x501fe1[_0x24d5('0x34')]);_0x4a5853[_0x24d5('0x38')]=_[_0x24d5('0x37')](_0x501fe1[_0x24d5('0x32')],qs[_0x24d5('0x39')](_0x3f0f9a['query'][_0x24d5('0x39')]));_0x4a5853[_0x24d5('0x38')]=_0x4a5853[_0x24d5('0x38')][_0x24d5('0x3a')]?_0x4a5853[_0x24d5('0x38')]:_0x501fe1[_0x24d5('0x32')];if(!_0x3f0f9a['query'][_0x24d5('0x3b')](_0x24d5('0x3c'))){_0x4a5853[_0x24d5('0x1e')]=qs[_0x24d5('0x1e')](_0x3f0f9a[_0x24d5('0x34')][_0x24d5('0x1e')]);_0x4a5853[_0x24d5('0x20')]=qs[_0x24d5('0x20')](_0x3f0f9a['query']['offset']);}_0x4a5853[_0x24d5('0x3d')]=qs[_0x24d5('0x3e')](_0x3f0f9a[_0x24d5('0x34')][_0x24d5('0x3e')]);_0x4a5853[_0x24d5('0x3f')]=qs[_0x24d5('0x36')](_[_0x24d5('0x40')](_0x3f0f9a[_0x24d5('0x34')],_0x501fe1[_0x24d5('0x36')]),_0x41ec6d);if(_0x3f0f9a[_0x24d5('0x34')][_0x24d5('0x41')]){_0x4a5853[_0x24d5('0x3f')]=_['merge'](_0x4a5853[_0x24d5('0x3f')],{'$or':[{'key':{'$like':'%'+_0x3f0f9a[_0x24d5('0x34')][_0x24d5('0x41')]+'%'}},{'value':{'$like':'%'+_0x3f0f9a[_0x24d5('0x34')][_0x24d5('0x41')]+'%'}}]});}_0x4a5853=_[_0x24d5('0x42')]({},_0x4a5853,_0x3f0f9a['options']);var _0x4c2950={'where':_0x4a5853[_0x24d5('0x3f')]};return db[_0x24d5('0x2e')][_0x24d5('0x1f')](_0x4c2950)[_0x24d5('0x26')](function(_0x192b76){_0xfa11ae[_0x24d5('0x1f')]=_0x192b76;if(_0x3f0f9a[_0x24d5('0x34')]['includeAll']){_0x4a5853[_0x24d5('0x43')]=[{'all':!![]}];}return db[_0x24d5('0x2e')]['findAll'](_0x4a5853);})[_0x24d5('0x26')](function(_0x1ce546){_0xfa11ae['rows']=_0x1ce546;return _0xfa11ae;})[_0x24d5('0x26')](respondWithFilteredResult(_0x434846,_0x4a5853))[_0x24d5('0x44')](handleError(_0x434846,null));};exports[_0x24d5('0x45')]=function(_0x308ca,_0x2dd5d1){var _0x5cf230={'raw':!![],'where':{'id':_0x308ca[_0x24d5('0x46')]['id']}},_0x566392={};_0x566392['model']=_[_0x24d5('0x35')](db[_0x24d5('0x2e')][_0x24d5('0x47')]);_0x566392['query']=_[_0x24d5('0x35')](_0x308ca[_0x24d5('0x34')]);_0x566392[_0x24d5('0x36')]=_[_0x24d5('0x37')](_0x566392[_0x24d5('0x32')],_0x566392[_0x24d5('0x34')]);_0x5cf230[_0x24d5('0x38')]=_[_0x24d5('0x37')](_0x566392[_0x24d5('0x32')],qs[_0x24d5('0x39')](_0x308ca[_0x24d5('0x34')]['fields']));_0x5cf230[_0x24d5('0x38')]=_0x5cf230[_0x24d5('0x38')][_0x24d5('0x3a')]?_0x5cf230['attributes']:_0x566392[_0x24d5('0x32')];if(_0x308ca[_0x24d5('0x34')][_0x24d5('0x48')]){_0x5cf230[_0x24d5('0x43')]=[{'all':!![]}];}_0x5cf230=_[_0x24d5('0x42')]({},_0x5cf230,_0x308ca[_0x24d5('0x49')]);return db[_0x24d5('0x2e')][_0x24d5('0x4a')](_0x5cf230)[_0x24d5('0x26')](handleEntityNotFound(_0x2dd5d1,null))[_0x24d5('0x26')](respondWithResult(_0x2dd5d1,null))[_0x24d5('0x44')](handleError(_0x2dd5d1,null));};exports[_0x24d5('0x25')]=function(_0x3b2963,_0x389837){if(_0x3b2963[_0x24d5('0x4b')]['id']){delete _0x3b2963[_0x24d5('0x4b')]['id'];}return db[_0x24d5('0x2e')][_0x24d5('0x4a')]({'where':{'id':_0x3b2963[_0x24d5('0x46')]['id']}})[_0x24d5('0x26')](handleEntityNotFound(_0x389837,null))['then'](saveUpdates(_0x3b2963[_0x24d5('0x4b')],null))[_0x24d5('0x26')](respondWithResult(_0x389837,null))[_0x24d5('0x44')](handleError(_0x389837,null));};exports['destroy']=function(_0x1bda1,_0x31f5d4){return db['CannedAnswer']['find']({'where':{'id':_0x1bda1[_0x24d5('0x46')]['id']}})[_0x24d5('0x26')](handleEntityNotFound(_0x31f5d4,null))[_0x24d5('0x26')](removeEntity(_0x31f5d4,null))[_0x24d5('0x44')](handleError(_0x31f5d4,null));};exports['create']=function(_0x4ae45e,_0x1af526){var _0xb6a2c5={'key':_0x4ae45e['body'][_0x24d5('0x31')]};if(_0x4ae45e[_0x24d5('0x4b')][_0x24d5('0x4c')]){_0xb6a2c5['MailAccountId']=_0x4ae45e[_0x24d5('0x4b')][_0x24d5('0x4c')];}else if(_0x4ae45e[_0x24d5('0x4b')]['SmsAccountId']){_0xb6a2c5['SmsAccountId']=_0x4ae45e[_0x24d5('0x4b')]['SmsAccountId'];}else if(_0x4ae45e['body'][_0x24d5('0x4d')]){_0xb6a2c5['OpenchannelAccountId']=_0x4ae45e[_0x24d5('0x4b')][_0x24d5('0x4d')];}else if(_0x4ae45e[_0x24d5('0x4b')][_0x24d5('0x4e')]){_0xb6a2c5[_0x24d5('0x4e')]=_0x4ae45e[_0x24d5('0x4b')][_0x24d5('0x4e')];}return db['CannedAnswer'][_0x24d5('0x4a')]({'where':_0xb6a2c5})[_0x24d5('0x26')](function(_0x278622){if(_0x278622){throw new db[(_0x24d5('0x4f'))]['ValidationError'](_0x24d5('0x50'));}return db[_0x24d5('0x2e')][_0x24d5('0x51')](_0x4ae45e[_0x24d5('0x4b')]);})[_0x24d5('0x26')](function(_0x262cc3){var _0x2316ee=_0x4ae45e['user']['get']({'plain':!![]});if(!_0x2316ee)throw new Error(_0x24d5('0x52'));if(_0x2316ee['role']===_0x24d5('0x53')){var _0x5f593b=_0x262cc3[_0x24d5('0x28')]({'plain':!![]});return db[_0x24d5('0x54')][_0x24d5('0x4a')]({'where':{'name':_0x24d5('0x55'),'userProfileId':_0x2316ee[_0x24d5('0x56')]},'raw':!![]})[_0x24d5('0x26')](function(_0xf9b093){if(_0xf9b093&&_0xf9b093[_0x24d5('0x57')]===0x0){return db['UserProfileResource'][_0x24d5('0x51')]({'name':_0x5f593b['name'],'resourceId':_0x5f593b['id'],'type':_0xf9b093[_0x24d5('0x2b')],'sectionId':_0xf9b093['id']},{})[_0x24d5('0x26')](function(){return _0x262cc3;});}else{return _0x262cc3;}})['catch'](function(_0x79bb54){logger[_0x24d5('0x58')](_0x24d5('0x59'),_0x79bb54);throw _0x79bb54;});}return _0x262cc3;})['then'](respondWithResult(_0x1af526,0xc9))['catch'](handleError(_0x1af526,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1299d35..8bd934e 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 _0x5d22=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5bf454,_0x52707e){var _0x5f00bc=function(_0x4ad19b){while(--_0x4ad19b){_0x5bf454['push'](_0x5bf454['shift']());}};_0x5f00bc(++_0x52707e);}(_0x5d22,0x96));var _0x25d2=function(_0x25b8ae,_0x5029be){_0x25b8ae=_0x25b8ae-0x0;var _0x563951=_0x5d22[_0x25b8ae];return _0x563951;};'use strict';var _=require(_0x25d2('0x0'));var util=require(_0x25d2('0x1'));var logger=require(_0x25d2('0x2'))(_0x25d2('0x3'));var moment=require(_0x25d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x25d2('0x5'));var fs=require('fs');var path=require(_0x25d2('0x6'));var rimraf=require(_0x25d2('0x7'));var config=require(_0x25d2('0x8'));var attributes=require(_0x25d2('0x9'));module['exports']=function(_0x25389e,_0x25de08){return _0x25389e[_0x25d2('0xa')](_0x25d2('0xb'),attributes,{'tableName':_0x25d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25d2('0xd'),'collate':_0x25d2('0xe')});}; \ No newline at end of file +var _0xf41f=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4'];(function(_0x13bfb2,_0x4944f9){var _0x4233e7=function(_0x59c34e){while(--_0x59c34e){_0x13bfb2['push'](_0x13bfb2['shift']());}};_0x4233e7(++_0x4944f9);}(_0xf41f,0x79));var _0xff41=function(_0x16669a,_0x31b97e){_0x16669a=_0x16669a-0x0;var _0x3a2ad5=_0xf41f[_0x16669a];return _0x3a2ad5;};'use strict';var _=require('lodash');var util=require(_0xff41('0x0'));var logger=require(_0xff41('0x1'))(_0xff41('0x2'));var moment=require(_0xff41('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff41('0x4'));var config=require(_0xff41('0x5'));var attributes=require(_0xff41('0x6'));module[_0xff41('0x7')]=function(_0x187535,_0x17dbb5){return _0x187535[_0xff41('0x8')](_0xff41('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff41('0xa'),'collate':_0xff41('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 67bdf29..60959c8 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(_0x520f2a,_0x507c16){var _0x129a6b=function(_0x15c1f0){while(--_0x15c1f0){_0x520f2a['push'](_0x520f2a['shift']());}};_0x129a6b(++_0x507c16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x39b5f4,_0x5eab3b){var _0x3703d7=function(_0x1c1fae){while(--_0x1c1fae){_0x39b5f4['push'](_0x39b5f4['shift']());}};_0x3703d7(++_0x5eab3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 4d1cf0c..a4a881f 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 _0x7e8b=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','post','create','put','/:id','delete','exports'];(function(_0x2b08d8,_0x37a0ba){var _0x185c1f=function(_0x15f3b7){while(--_0x15f3b7){_0x2b08d8['push'](_0x2b08d8['shift']());}};_0x185c1f(++_0x37a0ba);}(_0x7e8b,0x180));var _0xb7e8=function(_0x59f3b0,_0x182830){_0x59f3b0=_0x59f3b0-0x0;var _0x4f5d1c=_0x7e8b[_0x59f3b0];return _0x4f5d1c;};'use strict';var multer=require(_0xb7e8('0x0'));var util=require(_0xb7e8('0x1'));var path=require(_0xb7e8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7e8('0x3'));var router=express[_0xb7e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7e8('0x5'));var interaction=require(_0xb7e8('0x6'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xb7e8('0x7')](),controller[_0xb7e8('0x8')]);router['get']('/:id',auth[_0xb7e8('0x7')](),controller[_0xb7e8('0x9')]);router[_0xb7e8('0xa')]('/',auth[_0xb7e8('0x7')](),controller[_0xb7e8('0xb')]);router[_0xb7e8('0xc')](_0xb7e8('0xd'),auth[_0xb7e8('0x7')](),controller['update']);router[_0xb7e8('0xe')](_0xb7e8('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xb7e8('0xf')]=router; \ No newline at end of file +var _0x58e6=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0x58e6,0x7c));var _0x658e=function(_0x3f85d1,_0x4a454a){_0x3f85d1=_0x3f85d1-0x0;var _0xccec47=_0x58e6[_0x3f85d1];return _0xccec47;};'use strict';var multer=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var path=require(_0x658e('0x2'));var timeout=require(_0x658e('0x3'));var express=require(_0x658e('0x4'));var router=express[_0x658e('0x5')]();var fs_extra=require(_0x658e('0x6'));var auth=require(_0x658e('0x7'));var interaction=require(_0x658e('0x8'));var config=require(_0x658e('0x9'));var controller=require(_0x658e('0xa'));router['get']('/',auth[_0x658e('0xb')](),controller['index']);router[_0x658e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x658e('0xd')]);router[_0x658e('0xe')]('/',auth['isAuthenticated'](),controller[_0x658e('0xf')]);router[_0x658e('0x10')](_0x658e('0x11'),auth[_0x658e('0xb')](),controller[_0x658e('0x12')]);router['delete'](_0x658e('0x11'),auth[_0x658e('0xb')](),controller[_0x658e('0x13')]);module[_0x658e('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 124bb22..20bcbc8 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 _0x0434=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x0434,0x1ad));var _0x4043=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x0434[_0x513545];return _0x18b7c5;};'use strict';var Sequelize=require(_0x4043('0x0'));module[_0x4043('0x1')]={'calldate':{'type':Sequelize[_0x4043('0x2')],'allowNull':![],'defaultValue':_0x4043('0x3')},'clid':{'type':Sequelize[_0x4043('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x4043('0x4')]},'channel':{'type':Sequelize[_0x4043('0x4')]},'dstchannel':{'type':Sequelize[_0x4043('0x4')]},'lastapp':{'type':Sequelize[_0x4043('0x4')]},'lastdata':{'type':Sequelize[_0x4043('0x4')]},'duration':{'type':Sequelize[_0x4043('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4043('0x4')]},'amaflags':{'type':Sequelize[_0x4043('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4043('0x4')]},'linkedid':{'type':Sequelize[_0x4043('0x4')]},'sequence':{'type':Sequelize[_0x4043('0x4')]},'peeraccount':{'type':Sequelize[_0x4043('0x4')]},'type':{'type':Sequelize[_0x4043('0x4')]},'tag':{'type':Sequelize[_0x4043('0x4')]}}; \ No newline at end of file +var _0x780f=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x5282ed,_0x2d4d99){var _0xa10c53=function(_0x2d0911){while(--_0x2d0911){_0x5282ed['push'](_0x5282ed['shift']());}};_0xa10c53(++_0x2d4d99);}(_0x780f,0x6c));var _0xf780=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x780f[_0x4bc4c8];return _0x3bb121;};'use strict';var Sequelize=require(_0xf780('0x0'));module[_0xf780('0x1')]={'calldate':{'type':Sequelize[_0xf780('0x2')],'allowNull':![],'defaultValue':_0xf780('0x3')},'clid':{'type':Sequelize[_0xf780('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xf780('0x4')]},'channel':{'type':Sequelize[_0xf780('0x4')]},'dstchannel':{'type':Sequelize[_0xf780('0x4')]},'lastapp':{'type':Sequelize[_0xf780('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf780('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf780('0x4')]},'amaflags':{'type':Sequelize[_0xf780('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf780('0x4')]},'userfield':{'type':Sequelize[_0xf780('0x4')]},'uniqueid':{'type':Sequelize[_0xf780('0x4')]},'linkedid':{'type':Sequelize[_0xf780('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xf780('0x4')]},'type':{'type':Sequelize[_0xf780('0x4')]},'tag':{'type':Sequelize[_0xf780('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1ad77b1..4c2c1a7 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 _0x60c2=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','filters','filter','merge','where','VIRTUAL','options','includeAll','include','Cdr','findAll','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0xf591b8,_0xb47f74){var _0x3eaf3b=function(_0x3e27a0){while(--_0x3e27a0){_0xf591b8['push'](_0xf591b8['shift']());}};_0x3eaf3b(++_0xb47f74);}(_0x60c2,0x8f));var _0x260c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x60c2[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x260c('0x0'));var zipdir=require(_0x260c('0x1'));var jsonpatch=require(_0x260c('0x2'));var rp=require(_0x260c('0x3'));var moment=require(_0x260c('0x4'));var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require(_0x260c('0x9'));var csv=require(_0x260c('0xa'));var ejs=require(_0x260c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x260c('0xc'));var squel=require(_0x260c('0xd'));var crypto=require(_0x260c('0xe'));var jsforce=require(_0x260c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x260c('0xa'));var querystring=require(_0x260c('0x10'));var Papa=require(_0x260c('0x11'));var Redis=require(_0x260c('0x12'));var authService=require(_0x260c('0x13'));var qs=require(_0x260c('0x14'));var as=require(_0x260c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x16'))(_0x260c('0x17'));var utils=require(_0x260c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x19'));var db=require(_0x260c('0x1a'))['db'];function respondWithStatusCode(_0x191490,_0x5aed37){_0x5aed37=_0x5aed37||0xcc;return function(_0xc44e8d){if(_0xc44e8d){return _0x191490[_0x260c('0x1b')](_0x5aed37);}return _0x191490[_0x260c('0x1c')](_0x5aed37)[_0x260c('0x1d')]();};}function respondWithResult(_0x1d3775,_0x53df53){_0x53df53=_0x53df53||0xc8;return function(_0x3930b6){if(_0x3930b6){return _0x1d3775['status'](_0x53df53)[_0x260c('0x1e')](_0x3930b6);}};}function respondWithFilteredResult(_0x5a021c,_0x47edc1){return function(_0xd8b310){if(_0xd8b310){var _0x5299a4=typeof _0x47edc1[_0x260c('0x1f')]===_0x260c('0x20')&&typeof _0x47edc1[_0x260c('0x21')]===_0x260c('0x20');var _0x2bf3b8=_0xd8b310[_0x260c('0x22')];var _0x11e634=_0x5299a4?0x0:_0x47edc1[_0x260c('0x1f')];var _0x201e59=_0x5299a4?_0xd8b310[_0x260c('0x22')]:_0x47edc1[_0x260c('0x1f')]+_0x47edc1['limit'];var _0xd977b;if(_0x201e59>=_0x2bf3b8){_0x201e59=_0x2bf3b8;_0xd977b=0xc8;}else{_0xd977b=0xce;}_0x5a021c['status'](_0xd977b);return _0x5a021c[_0x260c('0x23')](_0x260c('0x24'),_0x11e634+'-'+_0x201e59+'/'+_0x2bf3b8)['json'](_0xd8b310);}return null;};}function patchUpdates(_0x1ccf81){return function(_0xe824db){try{jsonpatch[_0x260c('0x25')](_0xe824db,_0x1ccf81,!![]);}catch(_0x1c53e1){return BPromise[_0x260c('0x26')](_0x1c53e1);}return _0xe824db[_0x260c('0x27')]();};}function saveUpdates(_0x4b5b7a,_0xd5b7d8){return function(_0x158bc6){if(_0x158bc6){return _0x158bc6[_0x260c('0x28')](_0x4b5b7a)[_0x260c('0x29')](function(_0x58688c){return _0x58688c;});}return null;};}function removeEntity(_0x3f299f,_0x304961){return function(_0x461c8a){if(_0x461c8a){return _0x461c8a[_0x260c('0x2a')]()['then'](function(){_0x3f299f[_0x260c('0x1c')](0xcc)[_0x260c('0x1d')]();});}};}function handleEntityNotFound(_0x3bdfce,_0x29e10e){return function(_0x4cf0f9){if(!_0x4cf0f9){_0x3bdfce[_0x260c('0x1b')](0x194);}return _0x4cf0f9;};}function handleError(_0x2957e5,_0x480179){_0x480179=_0x480179||0x1f4;return function(_0x5def72){logger[_0x260c('0x2b')](_0x5def72[_0x260c('0x2c')]);if(_0x5def72[_0x260c('0x2d')]){delete _0x5def72[_0x260c('0x2d')];}_0x2957e5[_0x260c('0x1c')](_0x480179)[_0x260c('0x2e')](_0x5def72);};}exports['index']=function(_0xf1ad3e,_0x2e49dd){var _0x16b663={},_0x233a61={},_0x5993fd={'count':0x0,'rows':[]};var _0xc6868a=_[_0x260c('0x2f')](db['Cdr'][_0x260c('0x30')],function(_0xcb8c28){return{'name':_0xcb8c28[_0x260c('0x31')],'type':_0xcb8c28[_0x260c('0x32')][_0x260c('0x33')]};});_0x233a61[_0x260c('0x34')]=_[_0x260c('0x2f')](_0xc6868a,_0x260c('0x2d'));_0x233a61['query']=_[_0x260c('0x35')](_0xf1ad3e[_0x260c('0x36')]);_0x233a61['filters']=_[_0x260c('0x37')](_0x233a61['model'],_0x233a61['query']);_0x16b663['attributes']=_[_0x260c('0x37')](_0x233a61[_0x260c('0x34')],qs['fields'](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x38')]));_0x16b663[_0x260c('0x39')]=_0x16b663[_0x260c('0x39')][_0x260c('0x3a')]?_0x16b663[_0x260c('0x39')]:_0x233a61['model'];if(!_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3b')](_0x260c('0x3c'))){_0x16b663[_0x260c('0x21')]=qs[_0x260c('0x21')](_0xf1ad3e[_0x260c('0x36')][_0x260c('0x21')]);_0x16b663[_0x260c('0x1f')]=qs[_0x260c('0x1f')](_0xf1ad3e['query'][_0x260c('0x1f')]);}_0x16b663['order']=qs['sort'](_0xf1ad3e['query']['sort']);_0x16b663['where']=qs['filters'](_['pick'](_0xf1ad3e[_0x260c('0x36')],_0x233a61[_0x260c('0x3d')]),_0xc6868a);if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x3e')]){_0x16b663['where']=_[_0x260c('0x3f')](_0x16b663[_0x260c('0x40')],{'$or':_['map'](_0xc6868a,function(_0x35afd6){if(_0x35afd6[_0x260c('0x32')]!==_0x260c('0x41')){var _0x1dbc8a={};_0x1dbc8a[_0x35afd6[_0x260c('0x2d')]]={'$like':'%'+_0xf1ad3e['query']['filter']+'%'};return _0x1dbc8a;}})});}_0x16b663=_[_0x260c('0x3f')]({},_0x16b663,_0xf1ad3e[_0x260c('0x42')]);var _0x1de711={'where':_0x16b663[_0x260c('0x40')]};return db['Cdr'][_0x260c('0x22')](_0x1de711)[_0x260c('0x29')](function(_0x265bd8){_0x5993fd[_0x260c('0x22')]=_0x265bd8;if(_0xf1ad3e[_0x260c('0x36')][_0x260c('0x43')]){_0x16b663[_0x260c('0x44')]=[{'all':!![]}];}return db[_0x260c('0x45')][_0x260c('0x46')](_0x16b663);})[_0x260c('0x29')](function(_0x3392df){_0x5993fd[_0x260c('0x47')]=_0x3392df;return _0x5993fd;})[_0x260c('0x29')](respondWithFilteredResult(_0x2e49dd,_0x16b663))['catch'](handleError(_0x2e49dd,null));};exports['show']=function(_0x19ab59,_0x30b3f9){var _0xccd9c1={'raw':!![],'where':{'id':_0x19ab59[_0x260c('0x48')]['id']}},_0x50ed87={};_0x50ed87['model']=_['keys'](db[_0x260c('0x45')]['rawAttributes']);_0x50ed87[_0x260c('0x36')]=_[_0x260c('0x35')](_0x19ab59[_0x260c('0x36')]);_0x50ed87[_0x260c('0x3d')]=_['intersection'](_0x50ed87[_0x260c('0x34')],_0x50ed87[_0x260c('0x36')]);_0xccd9c1['attributes']=_[_0x260c('0x37')](_0x50ed87['model'],qs[_0x260c('0x38')](_0x19ab59[_0x260c('0x36')][_0x260c('0x38')]));_0xccd9c1['attributes']=_0xccd9c1[_0x260c('0x39')][_0x260c('0x3a')]?_0xccd9c1[_0x260c('0x39')]:_0x50ed87[_0x260c('0x34')];if(_0x19ab59[_0x260c('0x36')][_0x260c('0x43')]){_0xccd9c1[_0x260c('0x44')]=[{'all':!![]}];}_0xccd9c1=_[_0x260c('0x3f')]({},_0xccd9c1,_0x19ab59[_0x260c('0x42')]);return db[_0x260c('0x45')][_0x260c('0x49')](_0xccd9c1)[_0x260c('0x29')](handleEntityNotFound(_0x30b3f9,null))['then'](respondWithResult(_0x30b3f9,null))['catch'](handleError(_0x30b3f9,null));};exports[_0x260c('0x4a')]=function(_0x4517be,_0x18321f){return db[_0x260c('0x45')]['create'](_0x4517be[_0x260c('0x4b')],{})[_0x260c('0x29')](respondWithResult(_0x18321f,0xc9))[_0x260c('0x4c')](handleError(_0x18321f,null));};exports[_0x260c('0x28')]=function(_0x45175a,_0x1d0890){if(_0x45175a[_0x260c('0x4b')]['id']){delete _0x45175a[_0x260c('0x4b')]['id'];}return db[_0x260c('0x45')]['find']({'where':{'id':_0x45175a[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1d0890,null))['then'](saveUpdates(_0x45175a[_0x260c('0x4b')],null))['then'](respondWithResult(_0x1d0890,null))[_0x260c('0x4c')](handleError(_0x1d0890,null));};exports['destroy']=function(_0x4dcdca,_0x1e34fe){return db[_0x260c('0x45')][_0x260c('0x49')]({'where':{'id':_0x4dcdca[_0x260c('0x48')]['id']}})[_0x260c('0x29')](handleEntityNotFound(_0x1e34fe,null))[_0x260c('0x29')](removeEntity(_0x1e34fe,null))[_0x260c('0x4c')](handleError(_0x1e34fe,null));};exports['describe']=function(_0x12fbe5,_0x49b350){return db[_0x260c('0x45')][_0x260c('0x4d')]()[_0x260c('0x29')](respondWithResult(_0x49b350,null))[_0x260c('0x4c')](handleError(_0x49b350,null));}; \ No newline at end of file +var _0x24ca=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','Cdr','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x24ca[_0x1ee351];return _0x245aaf;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['Cdr'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c'));_0x5e491e[_0xa24c('0x32')]=_['keys'](_0x28675f[_0xa24c('0x32')]);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x32')]);_0x12dbdc['attributes']=_[_0xa24c('0x34')](_0x5e491e[_0xa24c('0x35')],qs['fields'](_0x28675f['query'][_0xa24c('0x36')]));_0x12dbdc[_0xa24c('0x37')]=_0x12dbdc[_0xa24c('0x37')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x37')]:_0x5e491e[_0xa24c('0x35')];if(!_0x28675f[_0xa24c('0x32')]['hasOwnProperty'](_0xa24c('0x39'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x32')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x32')][_0xa24c('0x21')]);}_0x12dbdc[_0xa24c('0x3a')]=qs['sort'](_0x28675f[_0xa24c('0x32')][_0xa24c('0x3b')]);_0x12dbdc[_0xa24c('0x3c')]=qs[_0xa24c('0x33')](_['pick'](_0x28675f['query'],_0x5e491e[_0xa24c('0x33')]),_0xc96ce7);if(_0x28675f['query'][_0xa24c('0x3d')]){_0x12dbdc[_0xa24c('0x3c')]=_[_0xa24c('0x3e')](_0x12dbdc[_0xa24c('0x3c')],{'$or':_[_0xa24c('0x2e')](_0xc96ce7,function(_0x4c0fb9){if(_0x4c0fb9['type']!==_0xa24c('0x3f')){var _0xc661c7={};_0xc661c7[_0x4c0fb9[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x32')][_0xa24c('0x3d')]+'%'};return _0xc661c7;}})});}_0x12dbdc=_[_0xa24c('0x3e')]({},_0x12dbdc,_0x28675f['options']);var _0x56f392={'where':_0x12dbdc[_0xa24c('0x3c')]};return db[_0xa24c('0x40')][_0xa24c('0x20')](_0x56f392)[_0xa24c('0x27')](function(_0x43beff){_0x21d2a8['count']=_0x43beff;if(_0x28675f[_0xa24c('0x32')][_0xa24c('0x41')]){_0x12dbdc['include']=[{'all':!![]}];}return db['Cdr'][_0xa24c('0x42')](_0x12dbdc);})[_0xa24c('0x27')](function(_0x231eea){_0x21d2a8['rows']=_0x231eea;return _0x21d2a8;})['then'](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x43')](handleError(_0x152120,null));};exports[_0xa24c('0x44')]=function(_0x31048c,_0x3ccc37){var _0x3f640e={'raw':!![],'where':{'id':_0x31048c[_0xa24c('0x45')]['id']}},_0x1b7faf={};_0x1b7faf[_0xa24c('0x35')]=_['keys'](db['Cdr'][_0xa24c('0x2f')]);_0x1b7faf[_0xa24c('0x32')]=_[_0xa24c('0x46')](_0x31048c['query']);_0x1b7faf[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x1b7faf[_0xa24c('0x35')],_0x1b7faf[_0xa24c('0x32')]);_0x3f640e[_0xa24c('0x37')]=_[_0xa24c('0x34')](_0x1b7faf[_0xa24c('0x35')],qs[_0xa24c('0x36')](_0x31048c[_0xa24c('0x32')][_0xa24c('0x36')]));_0x3f640e['attributes']=_0x3f640e[_0xa24c('0x37')][_0xa24c('0x38')]?_0x3f640e[_0xa24c('0x37')]:_0x1b7faf['model'];if(_0x31048c[_0xa24c('0x32')][_0xa24c('0x41')]){_0x3f640e[_0xa24c('0x47')]=[{'all':!![]}];}_0x3f640e=_[_0xa24c('0x3e')]({},_0x3f640e,_0x31048c[_0xa24c('0x48')]);return db[_0xa24c('0x40')][_0xa24c('0x49')](_0x3f640e)[_0xa24c('0x27')](handleEntityNotFound(_0x3ccc37,null))[_0xa24c('0x27')](respondWithResult(_0x3ccc37,null))[_0xa24c('0x43')](handleError(_0x3ccc37,null));};exports[_0xa24c('0x4a')]=function(_0x54dc72,_0x29a84d){return db[_0xa24c('0x40')][_0xa24c('0x4a')](_0x54dc72[_0xa24c('0x4b')],{})[_0xa24c('0x27')](respondWithResult(_0x29a84d,0xc9))[_0xa24c('0x43')](handleError(_0x29a84d,null));};exports[_0xa24c('0x26')]=function(_0x2250b9,_0x184179){if(_0x2250b9['body']['id']){delete _0x2250b9['body']['id'];}return db[_0xa24c('0x40')]['find']({'where':{'id':_0x2250b9[_0xa24c('0x45')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x184179,null))['then'](saveUpdates(_0x2250b9[_0xa24c('0x4b')],null))[_0xa24c('0x27')](respondWithResult(_0x184179,null))[_0xa24c('0x43')](handleError(_0x184179,null));};exports['destroy']=function(_0x55978e,_0x87347c){return db['Cdr'][_0xa24c('0x49')]({'where':{'id':_0x55978e[_0xa24c('0x45')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x87347c,null))[_0xa24c('0x27')](removeEntity(_0x87347c,null))[_0xa24c('0x43')](handleError(_0x87347c,null));};exports[_0xa24c('0x4c')]=function(_0x3f3ce6,_0x286d57){return db[_0xa24c('0x40')][_0xa24c('0x4c')]()['then'](respondWithResult(_0x286d57,null))[_0xa24c('0x43')](handleError(_0x286d57,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2b0a48e..495e530 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(_0xc83b17,_0x4e9850){var _0x29ca7d=function(_0x216f76){while(--_0x216f76){_0xc83b17['push'](_0xc83b17['shift']());}};_0x29ca7d(++_0x4e9850);}(_0x7a54,0x106));var _0x47a5=function(_0x1ed8c1,_0x215ea1){_0x1ed8c1=_0x1ed8c1-0x0;var _0x535b3d=_0x7a54[_0x1ed8c1];return _0x535b3d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xaaa493,_0x5195a4){var _0x1281d0=function(_0x1ccd01){while(--_0x1ccd01){_0xaaa493['push'](_0xaaa493['shift']());}};_0x1281d0(++_0x5195a4);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ff38715..8942162 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 _0x4ff0=['catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4ff0,0x79));var _0x04ff=function(_0x474898,_0x4a8cc2){_0x474898=_0x474898-0x0;var _0x342238=_0x4ff0[_0x474898];return _0x342238;};'use strict';var _=require(_0x04ff('0x0'));var util=require(_0x04ff('0x1'));var moment=require(_0x04ff('0x2'));var BPromise=require(_0x04ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x04ff('0x4'));var logger=require('../../config/logger')(_0x04ff('0x5'));var config=require(_0x04ff('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x04ff('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4899c9,_0x1b6377,_0x379174){return new BPromise(function(_0x41a8f0,_0x52ebb3){return client[_0x04ff('0x8')](_0x4899c9,_0x379174)[_0x04ff('0x9')](function(_0x20fb0c){logger[_0x04ff('0xa')](_0x04ff('0xb'),_0x1b6377,_0x04ff('0xc'));logger[_0x04ff('0xd')](_0x04ff('0xe'),_0x1b6377,_0x04ff('0xc'),JSON[_0x04ff('0xf')](_0x20fb0c));if(_0x20fb0c[_0x04ff('0x10')]){if(_0x20fb0c[_0x04ff('0x10')]['code']===0x1f4){logger[_0x04ff('0x10')](_0x04ff('0xb'),_0x1b6377,_0x20fb0c[_0x04ff('0x10')][_0x04ff('0x11')]);return _0x52ebb3(_0x20fb0c[_0x04ff('0x10')][_0x04ff('0x11')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x1b6377,_0x20fb0c['error'][_0x04ff('0x11')]);return _0x41a8f0(_0x20fb0c[_0x04ff('0x10')][_0x04ff('0x11')]);}else{logger[_0x04ff('0xa')]('Cdr,\x20%s,\x20%s',_0x1b6377,_0x04ff('0xc'));_0x41a8f0(_0x20fb0c[_0x04ff('0x12')][_0x04ff('0x11')]);}})[_0x04ff('0x13')](function(_0x5451b4){logger[_0x04ff('0x10')](_0x04ff('0xb'),_0x1b6377,_0x5451b4);_0x52ebb3(_0x5451b4);});});} \ No newline at end of file +var _0x2398=['http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x3abf03,_0x38c28b){var _0x2b67d5=function(_0x46394e){while(--_0x46394e){_0x3abf03['push'](_0x3abf03['shift']());}};_0x2b67d5(++_0x38c28b);}(_0x2398,0x187));var _0x8239=function(_0x18038b,_0x26ddd9){_0x18038b=_0x18038b-0x0;var _0x7f206a=_0x2398[_0x18038b];return _0x7f206a;};'use strict';var _=require(_0x8239('0x0'));var util=require('util');var moment=require(_0x8239('0x1'));var BPromise=require(_0x8239('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8239('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8239('0x4'));var logger=require('../../config/logger')(_0x8239('0x5'));var config=require(_0x8239('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8239('0x7')][_0x8239('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c7b35,_0x540cbe,_0xb79131){return new BPromise(function(_0x2d4335,_0x45b5fa){return client[_0x8239('0x9')](_0x1c7b35,_0xb79131)[_0x8239('0xa')](function(_0x3bb637){logger[_0x8239('0xb')](_0x8239('0xc'),_0x540cbe,_0x8239('0xd'));logger[_0x8239('0xe')](_0x8239('0xf'),_0x540cbe,_0x8239('0xd'),JSON['stringify'](_0x3bb637));if(_0x3bb637[_0x8239('0x10')]){if(_0x3bb637['error'][_0x8239('0x11')]===0x1f4){logger[_0x8239('0x10')](_0x8239('0xc'),_0x540cbe,_0x3bb637[_0x8239('0x10')][_0x8239('0x12')]);return _0x45b5fa(_0x3bb637[_0x8239('0x10')][_0x8239('0x12')]);}logger[_0x8239('0x10')](_0x8239('0xc'),_0x540cbe,_0x3bb637[_0x8239('0x10')]['message']);return _0x2d4335(_0x3bb637[_0x8239('0x10')][_0x8239('0x12')]);}else{logger['info'](_0x8239('0xc'),_0x540cbe,'request\x20sent');_0x2d4335(_0x3bb637['result'][_0x8239('0x12')]);}})['catch'](function(_0x437a26){logger[_0x8239('0x10')](_0x8239('0xc'),_0x540cbe,_0x437a26);_0x45b5fa(_0x437a26);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a2065d4..8442cba 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(_0x44ff66,_0x27f548){var _0x136331=function(_0x4c14b5){while(--_0x4c14b5){_0x44ff66['push'](_0x44ff66['shift']());}};_0x136331(++_0x27f548);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0309859..1f488bc 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 _0x7645=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x22f307,_0x3be2ca){var _0x5cf510=function(_0x3639f5){while(--_0x3639f5){_0x22f307['push'](_0x22f307['shift']());}};_0x5cf510(++_0x3be2ca);}(_0x7645,0x13b));var _0x5764=function(_0x5a31e3,_0x1c5bf7){_0x5a31e3=_0x5a31e3-0x0;var _0x2124ce=_0x7645[_0x5a31e3];return _0x2124ce;};'use strict';var Sequelize=require(_0x5764('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5764('0x1')],'allowNull':![],'defaultValue':_0x5764('0x2')},'appdata':{'type':Sequelize[_0x5764('0x3')]()},'description':{'type':Sequelize[_0x5764('0x1')]},'interval':{'type':Sequelize[_0x5764('0x1')],'defaultValue':_0x5764('0x4')}}; \ No newline at end of file +var _0x790c=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x16e364,_0x567bf5){var _0x315f6b=function(_0x17948c){while(--_0x17948c){_0x16e364['push'](_0x16e364['shift']());}};_0x315f6b(++_0x567bf5);}(_0x790c,0x135));var _0xc790=function(_0x3fc3bf,_0x55a82e){_0x3fc3bf=_0x3fc3bf-0x0;var _0x133351=_0x790c[_0x3fc3bf];return _0x133351;};'use strict';var Sequelize=require('sequelize');module[_0xc790('0x0')]={'priority':{'type':Sequelize[_0xc790('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc790('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc790('0x3')]()},'description':{'type':Sequelize[_0xc790('0x2')]},'interval':{'type':Sequelize[_0xc790('0x2')],'defaultValue':_0xc790('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2d16c20..5e7c774 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 _0x2242=['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/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','name','send','show','keys','rawAttributes','filters','intersection','model','query','fields','attributes','length','includeAll','merge','options','find','catch','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x2242,0x1a3));var _0x2224=function(_0x10d49f,_0x48c074){_0x10d49f=_0x10d49f-0x0;var _0x4a98b5=_0x2242[_0x10d49f];return _0x4a98b5;};'use strict';var emlformat=require(_0x2224('0x0'));var rimraf=require(_0x2224('0x1'));var zipdir=require(_0x2224('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2224('0x3'));var moment=require(_0x2224('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2224('0x5'));var util=require(_0x2224('0x6'));var path=require('path');var sox=require(_0x2224('0x7'));var csv=require(_0x2224('0x8'));var ejs=require(_0x2224('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2224('0xa'));var squel=require(_0x2224('0xb'));var crypto=require(_0x2224('0xc'));var jsforce=require(_0x2224('0xd'));var deskjs=require(_0x2224('0xe'));var toCsv=require(_0x2224('0x8'));var querystring=require(_0x2224('0xf'));var Papa=require(_0x2224('0x10'));var Redis=require(_0x2224('0x11'));var authService=require(_0x2224('0x12'));var qs=require(_0x2224('0x13'));var as=require(_0x2224('0x14'));var hardwareService=require(_0x2224('0x15'));var logger=require(_0x2224('0x16'))(_0x2224('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2224('0x18'));var db=require(_0x2224('0x19'))['db'];function respondWithStatusCode(_0x367085,_0x33582c){_0x33582c=_0x33582c||0xcc;return function(_0x49f1e2){if(_0x49f1e2){return _0x367085[_0x2224('0x1a')](_0x33582c);}return _0x367085[_0x2224('0x1b')](_0x33582c)['end']();};}function respondWithResult(_0x48a1e7,_0x3fcb41){_0x3fcb41=_0x3fcb41||0xc8;return function(_0xd9ca18){if(_0xd9ca18){return _0x48a1e7['status'](_0x3fcb41)['json'](_0xd9ca18);}};}function respondWithFilteredResult(_0x2a5845,_0x2596e0){return function(_0x3c1ecd){if(_0x3c1ecd){var _0x28956b=typeof _0x2596e0[_0x2224('0x1c')]===_0x2224('0x1d')&&typeof _0x2596e0[_0x2224('0x1e')]===_0x2224('0x1d');var _0x5ba07d=_0x3c1ecd[_0x2224('0x1f')];var _0x28e8a1=_0x28956b?0x0:_0x2596e0[_0x2224('0x1c')];var _0x3b47a1=_0x28956b?_0x3c1ecd[_0x2224('0x1f')]:_0x2596e0[_0x2224('0x1c')]+_0x2596e0[_0x2224('0x1e')];var _0x238dc5;if(_0x3b47a1>=_0x5ba07d){_0x3b47a1=_0x5ba07d;_0x238dc5=0xc8;}else{_0x238dc5=0xce;}_0x2a5845[_0x2224('0x1b')](_0x238dc5);return _0x2a5845[_0x2224('0x20')](_0x2224('0x21'),_0x28e8a1+'-'+_0x3b47a1+'/'+_0x5ba07d)[_0x2224('0x22')](_0x3c1ecd);}return null;};}function patchUpdates(_0x30defb){return function(_0x707cc3){try{jsonpatch[_0x2224('0x23')](_0x707cc3,_0x30defb,!![]);}catch(_0x5bdf57){return BPromise['reject'](_0x5bdf57);}return _0x707cc3[_0x2224('0x24')]();};}function saveUpdates(_0x9a842a,_0x14f837){return function(_0x152f76){if(_0x152f76){return _0x152f76[_0x2224('0x25')](_0x9a842a)[_0x2224('0x26')](function(_0x3527b8){return _0x3527b8;});}return null;};}function removeEntity(_0x27cc8e,_0xf9fbae){return function(_0x5559ce){if(_0x5559ce){return _0x5559ce[_0x2224('0x27')]()[_0x2224('0x26')](function(){_0x27cc8e['status'](0xcc)[_0x2224('0x28')]();});}};}function handleEntityNotFound(_0x4c231a,_0x5cf9b9){return function(_0x3e0a84){if(!_0x3e0a84){_0x4c231a[_0x2224('0x1a')](0x194);}return _0x3e0a84;};}function handleError(_0x4c4c64,_0x4da4bd){_0x4da4bd=_0x4da4bd||0x1f4;return function(_0x333e9d){logger[_0x2224('0x29')](_0x333e9d['stack']);if(_0x333e9d[_0x2224('0x2a')]){delete _0x333e9d['name'];}_0x4c4c64[_0x2224('0x1b')](_0x4da4bd)[_0x2224('0x2b')](_0x333e9d);};}exports[_0x2224('0x2c')]=function(_0x1159bf,_0x32132b){var _0x50058d={'raw':!![],'where':{'id':_0x1159bf['params']['id']}},_0x3b3843={};_0x3b3843['model']=_[_0x2224('0x2d')](db['ChatApplication'][_0x2224('0x2e')]);_0x3b3843['query']=_['keys'](_0x1159bf['query']);_0x3b3843[_0x2224('0x2f')]=_[_0x2224('0x30')](_0x3b3843[_0x2224('0x31')],_0x3b3843[_0x2224('0x32')]);_0x50058d['attributes']=_[_0x2224('0x30')](_0x3b3843['model'],qs[_0x2224('0x33')](_0x1159bf[_0x2224('0x32')][_0x2224('0x33')]));_0x50058d['attributes']=_0x50058d[_0x2224('0x34')][_0x2224('0x35')]?_0x50058d[_0x2224('0x34')]:_0x3b3843[_0x2224('0x31')];if(_0x1159bf[_0x2224('0x32')][_0x2224('0x36')]){_0x50058d['include']=[{'all':!![]}];}_0x50058d=_[_0x2224('0x37')]({},_0x50058d,_0x1159bf[_0x2224('0x38')]);return db['ChatApplication'][_0x2224('0x39')](_0x50058d)[_0x2224('0x26')](handleEntityNotFound(_0x32132b,null))[_0x2224('0x26')](respondWithResult(_0x32132b,null))[_0x2224('0x3a')](handleError(_0x32132b,null));};exports[_0x2224('0x25')]=function(_0x36f06d,_0x191c9d){if(_0x36f06d['body']['id']){delete _0x36f06d[_0x2224('0x3b')]['id'];}return db['ChatApplication'][_0x2224('0x39')]({'where':{'id':_0x36f06d['params']['id']}})[_0x2224('0x26')](handleEntityNotFound(_0x191c9d,null))[_0x2224('0x26')](saveUpdates(_0x36f06d['body'],null))[_0x2224('0x26')](respondWithResult(_0x191c9d,null))[_0x2224('0x3a')](handleError(_0x191c9d,null));};exports['destroy']=function(_0x1111e5,_0x213899){return db['ChatApplication'][_0x2224('0x39')]({'where':{'id':_0x1111e5[_0x2224('0x3c')]['id']}})['then'](handleEntityNotFound(_0x213899,null))[_0x2224('0x26')](removeEntity(_0x213899,null))['catch'](handleError(_0x213899,null));}; \ No newline at end of file +var _0x534d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x17a096,_0x1ac38b){var _0x3a6aa0=function(_0x2b574e){while(--_0x2b574e){_0x17a096['push'](_0x17a096['shift']());}};_0x3a6aa0(++_0x1ac38b);}(_0x534d,0x79));var _0xd534=function(_0x44d863,_0x2b9180){_0x44d863=_0x44d863-0x0;var _0x3ffae0=_0x534d[_0x44d863];return _0x3ffae0;};'use strict';var emlformat=require(_0xd534('0x0'));var rimraf=require(_0xd534('0x1'));var zipdir=require(_0xd534('0x2'));var jsonpatch=require(_0xd534('0x3'));var rp=require(_0xd534('0x4'));var moment=require(_0xd534('0x5'));var BPromise=require(_0xd534('0x6'));var Mustache=require(_0xd534('0x7'));var util=require(_0xd534('0x8'));var path=require(_0xd534('0x9'));var sox=require(_0xd534('0xa'));var csv=require(_0xd534('0xb'));var ejs=require(_0xd534('0xc'));var fs=require('fs');var fs_extra=require(_0xd534('0xd'));var _=require(_0xd534('0xe'));var squel=require(_0xd534('0xf'));var crypto=require(_0xd534('0x10'));var jsforce=require(_0xd534('0x11'));var deskjs=require(_0xd534('0x12'));var toCsv=require('to-csv');var querystring=require(_0xd534('0x13'));var Papa=require(_0xd534('0x14'));var Redis=require(_0xd534('0x15'));var authService=require(_0xd534('0x16'));var qs=require(_0xd534('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd534('0x18'));var logger=require(_0xd534('0x19'))(_0xd534('0x1a'));var utils=require(_0xd534('0x1b'));var config=require(_0xd534('0x1c'));var licenseUtil=require(_0xd534('0x1d'));var db=require(_0xd534('0x1e'))['db'];function respondWithStatusCode(_0xc019db,_0x568e0e){_0x568e0e=_0x568e0e||0xcc;return function(_0x518e7d){if(_0x518e7d){return _0xc019db[_0xd534('0x1f')](_0x568e0e);}return _0xc019db[_0xd534('0x20')](_0x568e0e)[_0xd534('0x21')]();};}function respondWithResult(_0x187e0,_0x290b75){_0x290b75=_0x290b75||0xc8;return function(_0x9ecc7d){if(_0x9ecc7d){return _0x187e0[_0xd534('0x20')](_0x290b75)[_0xd534('0x22')](_0x9ecc7d);}};}function respondWithFilteredResult(_0x340dee,_0x1ec85f){return function(_0x502c61){if(_0x502c61){var _0x51e8b2=typeof _0x1ec85f[_0xd534('0x23')]===_0xd534('0x24')&&typeof _0x1ec85f[_0xd534('0x25')]==='undefined';var _0x4f7f45=_0x502c61[_0xd534('0x26')];var _0x477b62=_0x51e8b2?0x0:_0x1ec85f[_0xd534('0x23')];var _0xb097fd=_0x51e8b2?_0x502c61['count']:_0x1ec85f['offset']+_0x1ec85f[_0xd534('0x25')];var _0x65672f;if(_0xb097fd>=_0x4f7f45){_0xb097fd=_0x4f7f45;_0x65672f=0xc8;}else{_0x65672f=0xce;}_0x340dee['status'](_0x65672f);return _0x340dee['set'](_0xd534('0x27'),_0x477b62+'-'+_0xb097fd+'/'+_0x4f7f45)['json'](_0x502c61);}return null;};}function patchUpdates(_0x3c0f39){return function(_0x419e08){try{jsonpatch[_0xd534('0x28')](_0x419e08,_0x3c0f39,!![]);}catch(_0x4464d3){return BPromise[_0xd534('0x29')](_0x4464d3);}return _0x419e08['save']();};}function saveUpdates(_0x59f5d7,_0x25a176){return function(_0x533c13){if(_0x533c13){return _0x533c13[_0xd534('0x2a')](_0x59f5d7)[_0xd534('0x2b')](function(_0x4d139f){return _0x4d139f;});}return null;};}function removeEntity(_0x3138f6,_0x38681b){return function(_0x3c030e){if(_0x3c030e){return _0x3c030e[_0xd534('0x2c')]()['then'](function(){_0x3138f6['status'](0xcc)[_0xd534('0x21')]();});}};}function handleEntityNotFound(_0x269b31,_0x1028b8){return function(_0x4ec7bf){if(!_0x4ec7bf){_0x269b31[_0xd534('0x1f')](0x194);}return _0x4ec7bf;};}function handleError(_0x27d291,_0x46818d){_0x46818d=_0x46818d||0x1f4;return function(_0x4c509d){logger[_0xd534('0x2d')](_0x4c509d[_0xd534('0x2e')]);if(_0x4c509d['name']){delete _0x4c509d[_0xd534('0x2f')];}_0x27d291[_0xd534('0x20')](_0x46818d)[_0xd534('0x30')](_0x4c509d);};}exports[_0xd534('0x31')]=function(_0x2bf346,_0x36ee41){var _0x4d5bbb={'raw':!![],'where':{'id':_0x2bf346[_0xd534('0x32')]['id']}},_0xf3da75={};_0xf3da75[_0xd534('0x33')]=_[_0xd534('0x34')](db[_0xd534('0x35')][_0xd534('0x36')]);_0xf3da75[_0xd534('0x37')]=_[_0xd534('0x34')](_0x2bf346[_0xd534('0x37')]);_0xf3da75[_0xd534('0x38')]=_[_0xd534('0x39')](_0xf3da75[_0xd534('0x33')],_0xf3da75['query']);_0x4d5bbb[_0xd534('0x3a')]=_[_0xd534('0x39')](_0xf3da75['model'],qs[_0xd534('0x3b')](_0x2bf346[_0xd534('0x37')]['fields']));_0x4d5bbb['attributes']=_0x4d5bbb['attributes'][_0xd534('0x3c')]?_0x4d5bbb[_0xd534('0x3a')]:_0xf3da75['model'];if(_0x2bf346[_0xd534('0x37')][_0xd534('0x3d')]){_0x4d5bbb[_0xd534('0x3e')]=[{'all':!![]}];}_0x4d5bbb=_['merge']({},_0x4d5bbb,_0x2bf346[_0xd534('0x3f')]);return db[_0xd534('0x35')][_0xd534('0x40')](_0x4d5bbb)['then'](handleEntityNotFound(_0x36ee41,null))[_0xd534('0x2b')](respondWithResult(_0x36ee41,null))[_0xd534('0x41')](handleError(_0x36ee41,null));};exports[_0xd534('0x2a')]=function(_0x5d0d42,_0x30a4ed){if(_0x5d0d42[_0xd534('0x42')]['id']){delete _0x5d0d42['body']['id'];}return db[_0xd534('0x35')][_0xd534('0x40')]({'where':{'id':_0x5d0d42[_0xd534('0x32')]['id']}})[_0xd534('0x2b')](handleEntityNotFound(_0x30a4ed,null))['then'](saveUpdates(_0x5d0d42[_0xd534('0x42')],null))['then'](respondWithResult(_0x30a4ed,null))['catch'](handleError(_0x30a4ed,null));};exports['destroy']=function(_0x3d7980,_0x25dca3){return db[_0xd534('0x35')][_0xd534('0x40')]({'where':{'id':_0x3d7980['params']['id']}})['then'](handleEntityNotFound(_0x25dca3,null))[_0xd534('0x2b')](removeEntity(_0x25dca3,null))[_0xd534('0x41')](handleError(_0x25dca3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0913493..69e580e 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 _0x40dd=['./chatApplication.attributes','exports','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x368ba4,_0x3c8cba){var _0x8c2c12=function(_0x1bb78d){while(--_0x1bb78d){_0x368ba4['push'](_0x368ba4['shift']());}};_0x8c2c12(++_0x3c8cba);}(_0x40dd,0x18d));var _0xd40d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x40dd[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xd40d('0x0'));var util=require(_0xd40d('0x1'));var logger=require('../../config/logger')(_0xd40d('0x2'));var moment=require(_0xd40d('0x3'));var BPromise=require(_0xd40d('0x4'));var rp=require(_0xd40d('0x5'));var fs=require('fs');var path=require(_0xd40d('0x6'));var rimraf=require(_0xd40d('0x7'));var config=require(_0xd40d('0x8'));var attributes=require(_0xd40d('0x9'));module[_0xd40d('0xa')]=function(_0xa8ee90,_0x510923){return _0xa8ee90['define'](_0xd40d('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd40d('0xc'),'collate':_0xd40d('0xd')});}; \ No newline at end of file +var _0x54a9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x54a9,0x186));var _0x954a=function(_0x159975,_0x51a06a){_0x159975=_0x159975-0x0;var _0x33d8c5=_0x54a9[_0x159975];return _0x33d8c5;};'use strict';var _=require(_0x954a('0x0'));var util=require('util');var logger=require(_0x954a('0x1'))('api');var moment=require(_0x954a('0x2'));var BPromise=require(_0x954a('0x3'));var rp=require(_0x954a('0x4'));var fs=require('fs');var path=require(_0x954a('0x5'));var rimraf=require(_0x954a('0x6'));var config=require(_0x954a('0x7'));var attributes=require(_0x954a('0x8'));module['exports']=function(_0x2066b6,_0x5634fc){return _0x2066b6[_0x954a('0x9')](_0x954a('0xa'),attributes,{'tableName':_0x954a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x954a('0xc'),'collate':_0x954a('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ef5ccf0..d736838 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 _0x4f8d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x341666,_0x3eb443){var _0x35332d=function(_0x2eb6c2){while(--_0x2eb6c2){_0x341666['push'](_0x341666['shift']());}};_0x35332d(++_0x3eb443);}(_0x4f8d,0xc3));var _0xd4f8=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x4f8d[_0x44d9ab];return _0x31485e;};'use strict';var _=require(_0xd4f8('0x0'));var util=require(_0xd4f8('0x1'));var moment=require(_0xd4f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4f8('0x3'));var db=require(_0xd4f8('0x4'))['db'];var utils=require(_0xd4f8('0x5'));var logger=require(_0xd4f8('0x6'))(_0xd4f8('0x7'));var config=require(_0xd4f8('0x8'));var jayson=require(_0xd4f8('0x9'));var client=jayson[_0xd4f8('0xa')][_0xd4f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c5f22,_0xf02824,_0x187048){return new BPromise(function(_0x202612,_0x2e78a4){return client[_0xd4f8('0xc')](_0x5c5f22,_0x187048)[_0xd4f8('0xd')](function(_0x599856){logger[_0xd4f8('0xe')]('ChatApplication,\x20%s,\x20%s',_0xf02824,_0xd4f8('0xf'));logger['debug'](_0xd4f8('0x10'),_0xf02824,_0xd4f8('0xf'),JSON[_0xd4f8('0x11')](_0x599856));if(_0x599856['error']){if(_0x599856[_0xd4f8('0x12')][_0xd4f8('0x13')]===0x1f4){logger[_0xd4f8('0x12')](_0xd4f8('0x14'),_0xf02824,_0x599856[_0xd4f8('0x12')][_0xd4f8('0x15')]);return _0x2e78a4(_0x599856[_0xd4f8('0x12')][_0xd4f8('0x15')]);}logger['error'](_0xd4f8('0x14'),_0xf02824,_0x599856[_0xd4f8('0x12')]['message']);return _0x202612(_0x599856['error'][_0xd4f8('0x15')]);}else{logger[_0xd4f8('0xe')]('ChatApplication,\x20%s,\x20%s',_0xf02824,_0xd4f8('0xf'));_0x202612(_0x599856['result']['message']);}})['catch'](function(_0x216efb){logger['error'](_0xd4f8('0x14'),_0xf02824,_0x216efb);_0x2e78a4(_0x216efb);});});} \ No newline at end of file +var _0x122e=['error','code','message','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x6262fd,_0x343a3d){var _0x256b20=function(_0x39f6c4){while(--_0x39f6c4){_0x6262fd['push'](_0x6262fd['shift']());}};_0x256b20(++_0x343a3d);}(_0x122e,0x1e3));var _0xe122=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x122e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe122('0x0'));var util=require(_0xe122('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe122('0x2'));var db=require(_0xe122('0x3'))['db'];var utils=require(_0xe122('0x4'));var logger=require(_0xe122('0x5'))(_0xe122('0x6'));var config=require(_0xe122('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe122('0x8')][_0xe122('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dd6e6,_0x945eae,_0x364368){return new BPromise(function(_0x4473e0,_0x3928f4){return client[_0xe122('0xa')](_0x4dd6e6,_0x364368)[_0xe122('0xb')](function(_0x3a74dd){logger[_0xe122('0xc')](_0xe122('0xd'),_0x945eae,_0xe122('0xe'));logger[_0xe122('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x945eae,_0xe122('0xe'),JSON[_0xe122('0x10')](_0x3a74dd));if(_0x3a74dd[_0xe122('0x11')]){if(_0x3a74dd[_0xe122('0x11')][_0xe122('0x12')]===0x1f4){logger['error'](_0xe122('0xd'),_0x945eae,_0x3a74dd[_0xe122('0x11')][_0xe122('0x13')]);return _0x3928f4(_0x3a74dd[_0xe122('0x11')]['message']);}logger['error'](_0xe122('0xd'),_0x945eae,_0x3a74dd[_0xe122('0x11')][_0xe122('0x13')]);return _0x4473e0(_0x3a74dd[_0xe122('0x11')][_0xe122('0x13')]);}else{logger['info'](_0xe122('0xd'),_0x945eae,'request\x20sent');_0x4473e0(_0x3a74dd['result'][_0xe122('0x13')]);}})['catch'](function(_0x222b28){logger[_0xe122('0x11')](_0xe122('0xd'),_0x945eae,_0x222b28);_0x3928f4(_0x222b28);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 65530d4..3b15e2f 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 _0x6d65=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show','put','update','destroy','exports','multer'];(function(_0x389136,_0x446ce9){var _0x34ed6c=function(_0x1113ff){while(--_0x1113ff){_0x389136['push'](_0x389136['shift']());}};_0x34ed6c(++_0x446ce9);}(_0x6d65,0xb3));var _0x56d6=function(_0x10f693,_0x455c80){_0x10f693=_0x10f693-0x0;var _0x211686=_0x6d65[_0x10f693];return _0x211686;};'use strict';var multer=require(_0x56d6('0x0'));var util=require(_0x56d6('0x1'));var path=require(_0x56d6('0x2'));var timeout=require('connect-timeout');var express=require(_0x56d6('0x3'));var router=express[_0x56d6('0x4')]();var fs_extra=require(_0x56d6('0x5'));var auth=require(_0x56d6('0x6'));var interaction=require(_0x56d6('0x7'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x56d6('0x8'),auth[_0x56d6('0x9')](),controller[_0x56d6('0xa')]);router[_0x56d6('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x56d6('0xc')]);router['delete'](_0x56d6('0x8'),auth['isAuthenticated'](),controller[_0x56d6('0xd')]);module[_0x56d6('0xe')]=router; \ No newline at end of file +var _0x0110=['Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4aca9b,_0x4498b7){var _0x4d56cd=function(_0x3e1352){while(--_0x3e1352){_0x4aca9b['push'](_0x4aca9b['shift']());}};_0x4d56cd(++_0x4498b7);}(_0x0110,0x1c6));var _0x0011=function(_0x17fb79,_0x1230bc){_0x17fb79=_0x17fb79-0x0;var _0x74e28f=_0x0110[_0x17fb79];return _0x74e28f;};'use strict';var multer=require(_0x0011('0x0'));var util=require(_0x0011('0x1'));var path=require(_0x0011('0x2'));var timeout=require(_0x0011('0x3'));var express=require(_0x0011('0x4'));var router=express[_0x0011('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0011('0x6'));var interaction=require(_0x0011('0x7'));var config=require('../../config/environment');var controller=require(_0x0011('0x8'));router[_0x0011('0x9')](_0x0011('0xa'),auth[_0x0011('0xb')](),controller[_0x0011('0xc')]);router['put'](_0x0011('0xa'),auth['isAuthenticated'](),controller[_0x0011('0xd')]);router[_0x0011('0xe')](_0x0011('0xa'),auth['isAuthenticated'](),controller[_0x0011('0xf')]);module[_0x0011('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 275e727..86fba0f 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 _0xf693=['BOOLEAN','exports','STRING'];(function(_0x1e54a7,_0x38b947){var _0x4c7a88=function(_0x144033){while(--_0x144033){_0x1e54a7['push'](_0x1e54a7['shift']());}};_0x4c7a88(++_0x38b947);}(_0xf693,0x181));var _0x3f69=function(_0x5597a5,_0x5cc2ab){_0x5597a5=_0x5597a5-0x0;var _0xf97015=_0xf693[_0x5597a5];return _0xf97015;};'use strict';var Sequelize=require('sequelize');module[_0x3f69('0x0')]={'name':{'type':Sequelize[_0x3f69('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3f69('0x1')]},'write':{'type':Sequelize[_0x3f69('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa777=['exports','STRING','BOOLEAN'];(function(_0x1716c3,_0x10239c){var _0x3e7cf7=function(_0x51ed19){while(--_0x51ed19){_0x1716c3['push'](_0x1716c3['shift']());}};_0x3e7cf7(++_0x10239c);}(_0xa777,0x102));var _0x7a77=function(_0x99b617,_0x331413){_0x99b617=_0x99b617-0x0;var _0x4d9f42=_0xa777[_0x99b617];return _0x4d9f42;};'use strict';var Sequelize=require('sequelize');module[_0x7a77('0x0')]={'name':{'type':Sequelize[_0x7a77('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7a77('0x1')]},'write':{'type':Sequelize[_0x7a77('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index d204294..43b0108 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 _0x450a=['$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','save','destroy','then','error','name','send','index','map','ChatGroup','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','fields','create','body','update','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','getMembers','User','order','removeMembers','ids','getMessages'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0x450a,0xbd));var _0xa450=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x450a[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xa450('0x0'));var rimraf=require(_0xa450('0x1'));var zipdir=require(_0xa450('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa450('0x3'));var moment=require('moment');var BPromise=require(_0xa450('0x4'));var Mustache=require(_0xa450('0x5'));var util=require(_0xa450('0x6'));var path=require(_0xa450('0x7'));var sox=require(_0xa450('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa450('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa450('0xa'));var jsforce=require(_0xa450('0xb'));var deskjs=require(_0xa450('0xc'));var toCsv=require(_0xa450('0xd'));var querystring=require(_0xa450('0xe'));var Papa=require(_0xa450('0xf'));var Redis=require(_0xa450('0x10'));var authService=require(_0xa450('0x11'));var qs=require(_0xa450('0x12'));var as=require(_0xa450('0x13'));var hardwareService=require(_0xa450('0x14'));var logger=require(_0xa450('0x15'))(_0xa450('0x16'));var utils=require(_0xa450('0x17'));var config=require(_0xa450('0x18'));var licenseUtil=require(_0xa450('0x19'));var db=require(_0xa450('0x1a'))['db'];config[_0xa450('0x1b')]=_['defaults'](config[_0xa450('0x1b')],{'host':_0xa450('0x1c'),'port':0x18eb});var socket=require(_0xa450('0x1d'))(new Redis(config['redis']));require(_0xa450('0x1e'))['register'](socket);function respondWithStatusCode(_0x1c1439,_0x17dc58){_0x17dc58=_0x17dc58||0xcc;return function(_0x1ccf12){if(_0x1ccf12){return _0x1c1439[_0xa450('0x1f')](_0x17dc58);}return _0x1c1439['status'](_0x17dc58)['end']();};}function respondWithResult(_0x42ffca,_0x48028c){_0x48028c=_0x48028c||0xc8;return function(_0x381da9){if(_0x381da9){return _0x42ffca[_0xa450('0x20')](_0x48028c)['json'](_0x381da9);}};}function respondWithFilteredResult(_0x3e84e1,_0x27514d){return function(_0x1c3295){if(_0x1c3295){var _0x3ccf20=typeof _0x27514d['offset']===_0xa450('0x21')&&typeof _0x27514d[_0xa450('0x22')]==='undefined';var _0x1110de=_0x1c3295[_0xa450('0x23')];var _0x46c8d1=_0x3ccf20?0x0:_0x27514d[_0xa450('0x24')];var _0x4a6ea0=_0x3ccf20?_0x1c3295[_0xa450('0x23')]:_0x27514d[_0xa450('0x24')]+_0x27514d['limit'];var _0xfe53f0;if(_0x4a6ea0>=_0x1110de){_0x4a6ea0=_0x1110de;_0xfe53f0=0xc8;}else{_0xfe53f0=0xce;}_0x3e84e1[_0xa450('0x20')](_0xfe53f0);return _0x3e84e1['set'](_0xa450('0x25'),_0x46c8d1+'-'+_0x4a6ea0+'/'+_0x1110de)[_0xa450('0x26')](_0x1c3295);}return null;};}function patchUpdates(_0x4eb8a5){return function(_0x25e4bc){try{jsonpatch[_0xa450('0x27')](_0x25e4bc,_0x4eb8a5,!![]);}catch(_0x5c9944){return BPromise['reject'](_0x5c9944);}return _0x25e4bc[_0xa450('0x28')]();};}function saveUpdates(_0x2954ad,_0x5f4e94){return function(_0x11b29a){if(_0x11b29a){return _0x11b29a['update'](_0x2954ad)['then'](function(_0x1ed89e){return _0x1ed89e;});}return null;};}function removeEntity(_0x10e26f,_0x3b7521){return function(_0x3d1d0c){if(_0x3d1d0c){return _0x3d1d0c[_0xa450('0x29')]()[_0xa450('0x2a')](function(){_0x10e26f[_0xa450('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b8b6c,_0x29b5b6){return function(_0x5681b3){if(!_0x5681b3){_0x2b8b6c[_0xa450('0x1f')](0x194);}return _0x5681b3;};}function handleError(_0x218120,_0x222448){_0x222448=_0x222448||0x1f4;return function(_0x1d66fa){logger[_0xa450('0x2b')](_0x1d66fa['stack']);if(_0x1d66fa[_0xa450('0x2c')]){delete _0x1d66fa[_0xa450('0x2c')];}_0x218120[_0xa450('0x20')](_0x222448)[_0xa450('0x2d')](_0x1d66fa);};}exports[_0xa450('0x2e')]=function(_0x291d16,_0x389098){var _0x542d98={},_0x8f377b={},_0x1358db={'count':0x0,'rows':[]};var _0x550d59=_[_0xa450('0x2f')](db[_0xa450('0x30')][_0xa450('0x31')],function(_0x1598d3){return{'name':_0x1598d3['fieldName'],'type':_0x1598d3[_0xa450('0x32')][_0xa450('0x33')]};});_0x8f377b[_0xa450('0x34')]=_[_0xa450('0x2f')](_0x550d59,_0xa450('0x2c'));_0x8f377b['query']=_[_0xa450('0x35')](_0x291d16[_0xa450('0x36')]);_0x8f377b[_0xa450('0x37')]=_[_0xa450('0x38')](_0x8f377b['model'],_0x8f377b[_0xa450('0x36')]);_0x542d98[_0xa450('0x39')]=_[_0xa450('0x38')](_0x8f377b[_0xa450('0x34')],qs['fields'](_0x291d16[_0xa450('0x36')]['fields']));_0x542d98[_0xa450('0x39')]=_0x542d98[_0xa450('0x39')][_0xa450('0x3a')]?_0x542d98[_0xa450('0x39')]:_0x8f377b[_0xa450('0x34')];if(!_0x291d16[_0xa450('0x36')][_0xa450('0x3b')](_0xa450('0x3c'))){_0x542d98['limit']=qs[_0xa450('0x22')](_0x291d16[_0xa450('0x36')][_0xa450('0x22')]);_0x542d98[_0xa450('0x24')]=qs[_0xa450('0x24')](_0x291d16[_0xa450('0x36')][_0xa450('0x24')]);}_0x542d98['order']=qs[_0xa450('0x3d')](_0x291d16[_0xa450('0x36')][_0xa450('0x3d')]);_0x542d98[_0xa450('0x3e')]=qs['filters'](_[_0xa450('0x3f')](_0x291d16[_0xa450('0x36')],_0x8f377b[_0xa450('0x37')]),_0x550d59);if(_0x291d16[_0xa450('0x36')]['filter']){_0x542d98[_0xa450('0x3e')]=_[_0xa450('0x40')](_0x542d98[_0xa450('0x3e')],{'$or':_[_0xa450('0x2f')](_0x550d59,function(_0x4f288f){if(_0x4f288f[_0xa450('0x32')]!==_0xa450('0x41')){var _0x5244a0={};_0x5244a0[_0x4f288f['name']]={'$like':'%'+_0x291d16[_0xa450('0x36')][_0xa450('0x42')]+'%'};return _0x5244a0;}})});}_0x542d98=_[_0xa450('0x40')]({},_0x542d98,_0x291d16[_0xa450('0x43')]);var _0x2ae60e={'where':_0x542d98['where']};return db[_0xa450('0x30')]['count'](_0x2ae60e)[_0xa450('0x2a')](function(_0x231558){_0x1358db['count']=_0x231558;if(_0x291d16['query'][_0xa450('0x44')]){_0x542d98[_0xa450('0x45')]=[{'all':!![]}];}return db[_0xa450('0x30')][_0xa450('0x46')](_0x542d98);})['then'](function(_0x410f8a){_0x1358db['rows']=_0x410f8a;return _0x1358db;})['then'](respondWithFilteredResult(_0x389098,_0x542d98))[_0xa450('0x47')](handleError(_0x389098,null));};exports['show']=function(_0x3db138,_0x2a6837){var _0x591803={'raw':!![],'where':{'id':_0x3db138['params']['id']}},_0x828a82={};_0x828a82[_0xa450('0x34')]=_[_0xa450('0x35')](db[_0xa450('0x30')][_0xa450('0x31')]);_0x828a82['query']=_['keys'](_0x3db138[_0xa450('0x36')]);_0x828a82[_0xa450('0x37')]=_[_0xa450('0x38')](_0x828a82['model'],_0x828a82[_0xa450('0x36')]);_0x591803[_0xa450('0x39')]=_[_0xa450('0x38')](_0x828a82[_0xa450('0x34')],qs['fields'](_0x3db138['query'][_0xa450('0x48')]));_0x591803['attributes']=_0x591803[_0xa450('0x39')][_0xa450('0x3a')]?_0x591803[_0xa450('0x39')]:_0x828a82[_0xa450('0x34')];if(_0x3db138['query'][_0xa450('0x44')]){_0x591803[_0xa450('0x45')]=[{'all':!![]}];}_0x591803=_['merge']({},_0x591803,_0x3db138['options']);return db[_0xa450('0x30')]['find'](_0x591803)['then'](handleEntityNotFound(_0x2a6837,null))['then'](respondWithResult(_0x2a6837,null))[_0xa450('0x47')](handleError(_0x2a6837,null));};exports[_0xa450('0x49')]=function(_0xb9cb29,_0x50c607){return db['ChatGroup'][_0xa450('0x49')](_0xb9cb29[_0xa450('0x4a')],{})[_0xa450('0x2a')](respondWithResult(_0x50c607,0xc9))[_0xa450('0x47')](handleError(_0x50c607,null));};exports[_0xa450('0x4b')]=function(_0x143a3b,_0x425064){if(_0x143a3b[_0xa450('0x4a')]['id']){delete _0x143a3b['body']['id'];}return db['ChatGroup'][_0xa450('0x4c')]({'where':{'id':_0x143a3b[_0xa450('0x4d')]['id']}})[_0xa450('0x2a')](handleEntityNotFound(_0x425064,null))[_0xa450('0x2a')](saveUpdates(_0x143a3b[_0xa450('0x4a')],null))[_0xa450('0x2a')](respondWithResult(_0x425064,null))[_0xa450('0x47')](handleError(_0x425064,null));};exports[_0xa450('0x29')]=function(_0x439953,_0xc30b4a){return db[_0xa450('0x30')][_0xa450('0x4c')]({'where':{'id':_0x439953[_0xa450('0x4d')]['id']}})[_0xa450('0x2a')](handleEntityNotFound(_0xc30b4a,null))['then'](removeEntity(_0xc30b4a,null))[_0xa450('0x47')](handleError(_0xc30b4a,null));};exports['describe']=function(_0x386ecf,_0xbde737){return db['ChatGroup'][_0xa450('0x4e')]()[_0xa450('0x2a')](respondWithResult(_0xbde737,null))[_0xa450('0x47')](handleError(_0xbde737,null));};exports[_0xa450('0x4f')]=function(_0x1f526b,_0x380a49,_0x4f509b){return db[_0xa450('0x50')]['count']({'where':{'ChatGroupId':_0x1f526b[_0xa450('0x4d')]['id'],'ToId':_0x1f526b[_0xa450('0x51')]['id'],'read':![]}})[_0xa450('0x2a')](function(_0x15a6f8){return{'id':_[_0xa450('0x52')](_0x1f526b[_0xa450('0x4d')]['id']),'count':_0x15a6f8};})[_0xa450('0x2a')](respondWithResult(_0x380a49,null))[_0xa450('0x47')](handleError(_0x380a49,null));};exports[_0xa450('0x53')]=function(_0x5bf105,_0x3778fb,_0x4bcafa){return db[_0xa450('0x30')][_0xa450('0x4c')]({'where':{'id':_0x5bf105['params']['id']}})[_0xa450('0x2a')](handleEntityNotFound(_0x3778fb,null))['then'](function(_0x410077){if(_0x410077){return _0x410077[_0xa450('0x53')](_0x5bf105['body']['ids'],_['omit'](_0x5bf105[_0xa450('0x4a')],['ids','id'])||{});}})[_0xa450('0x2a')](respondWithResult(_0x3778fb,null))[_0xa450('0x47')](handleError(_0x3778fb,null));};exports[_0xa450('0x54')]=function(_0x5b5acd,_0x495949,_0x495b3b){var _0x5cd5ff={};var _0x31eaba={};var _0x3eebc1;var _0x5a08dd;return db['ChatGroup']['findOne']({'where':{'id':_0x5b5acd['params']['id']}})[_0xa450('0x2a')](handleEntityNotFound(_0x495949,null))['then'](function(_0x4b2ef8){if(_0x4b2ef8){_0x3eebc1=_0x4b2ef8;_0x31eaba['model']=_['keys'](db[_0xa450('0x55')]['rawAttributes']);_0x31eaba['query']=_['keys'](_0x5b5acd['query']);_0x31eaba[_0xa450('0x37')]=_['intersection'](_0x31eaba[_0xa450('0x34')],_0x31eaba[_0xa450('0x36')]);_0x5cd5ff[_0xa450('0x39')]=_[_0xa450('0x38')](_0x31eaba[_0xa450('0x34')],qs[_0xa450('0x48')](_0x5b5acd[_0xa450('0x36')][_0xa450('0x48')]));_0x5cd5ff['attributes']=_0x5cd5ff[_0xa450('0x39')]['length']?_0x5cd5ff['attributes']:_0x31eaba[_0xa450('0x34')];_0x5cd5ff[_0xa450('0x56')]=qs[_0xa450('0x3d')](_0x5b5acd[_0xa450('0x36')]['sort']);_0x5cd5ff[_0xa450('0x3e')]=qs['filters'](_[_0xa450('0x3f')](_0x5b5acd[_0xa450('0x36')],_0x31eaba[_0xa450('0x37')]));if(_0x5b5acd[_0xa450('0x36')][_0xa450('0x42')]){_0x5cd5ff['where']=_[_0xa450('0x40')](_0x5cd5ff[_0xa450('0x3e')],{'$or':_[_0xa450('0x2f')](_0x5cd5ff['attributes'],function(_0x57ee67){var _0x5b9b42={};_0x5b9b42[_0x57ee67]={'$like':'%'+_0x5b5acd['query']['filter']+'%'};return _0x5b9b42;})});}_0x5cd5ff=_['merge']({},_0x5cd5ff,_0x5b5acd[_0xa450('0x43')]);return _0x3eebc1[_0xa450('0x54')](_0x5cd5ff);}})[_0xa450('0x2a')](function(_0x5bced6){if(_0x5bced6){_0x5a08dd=_0x5bced6[_0xa450('0x3a')];if(!_0x5b5acd[_0xa450('0x36')][_0xa450('0x3b')](_0xa450('0x3c'))){_0x5cd5ff[_0xa450('0x22')]=qs[_0xa450('0x22')](_0x5b5acd['query'][_0xa450('0x22')]);_0x5cd5ff[_0xa450('0x24')]=qs[_0xa450('0x24')](_0x5b5acd[_0xa450('0x36')][_0xa450('0x24')]);}return _0x3eebc1[_0xa450('0x54')](_0x5cd5ff);}})[_0xa450('0x2a')](function(_0x34f599){if(_0x34f599){return _0x34f599?{'count':_0x5a08dd,'rows':_0x34f599}:null;}})['then'](respondWithResult(_0x495949,null))[_0xa450('0x47')](handleError(_0x495949,null));};exports[_0xa450('0x57')]=function(_0x56b7d3,_0x17d72f,_0x211119){return db[_0xa450('0x30')]['find']({'where':{'id':_0x56b7d3[_0xa450('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17d72f,null))[_0xa450('0x2a')](function(_0x5534f3){if(_0x5534f3){return _0x5534f3['removeMembers'](_0x56b7d3[_0xa450('0x36')][_0xa450('0x58')]);}})[_0xa450('0x2a')](respondWithStatusCode(_0x17d72f,null))[_0xa450('0x47')](handleError(_0x17d72f,null));};exports['addMessage']=function(_0x2eb655,_0x3acbb6,_0x5db78b){if(_0x2eb655[_0xa450('0x4a')]['id']){delete _0x2eb655[_0xa450('0x4a')]['id'];}return db[_0xa450('0x30')]['find']({'where':{'id':_0x2eb655['params']['id']}})[_0xa450('0x2a')](handleEntityNotFound(_0x3acbb6,null))[_0xa450('0x2a')](function(_0x22ce2b){if(_0x22ce2b){_0x2eb655[_0xa450('0x4a')]['ChatGroupId']=_0x22ce2b['id'];return db[_0xa450('0x50')][_0xa450('0x49')](_0x2eb655[_0xa450('0x4a')]);}})[_0xa450('0x2a')](respondWithResult(_0x3acbb6,null))[_0xa450('0x47')](handleError(_0x3acbb6,null));};exports[_0xa450('0x59')]=function(_0x35ec7f,_0x2873c2,_0x19c87d){var _0x43c5b5={};var _0x585db0={};var _0x370974;var _0x4cf456;return db[_0xa450('0x30')]['findOne']({'where':{'id':_0x35ec7f[_0xa450('0x4d')]['id']}})[_0xa450('0x2a')](handleEntityNotFound(_0x2873c2,null))[_0xa450('0x2a')](function(_0x379f5b){if(_0x379f5b){_0x370974=_0x379f5b;_0x585db0['model']=_[_0xa450('0x35')](db['ChatInternalMessage'][_0xa450('0x31')]);_0x585db0[_0xa450('0x36')]=_['keys'](_0x35ec7f[_0xa450('0x36')]);_0x585db0[_0xa450('0x37')]=_[_0xa450('0x38')](_0x585db0[_0xa450('0x34')],_0x585db0[_0xa450('0x36')]);_0x43c5b5[_0xa450('0x39')]=_[_0xa450('0x38')](_0x585db0[_0xa450('0x34')],qs[_0xa450('0x48')](_0x35ec7f[_0xa450('0x36')][_0xa450('0x48')]));_0x43c5b5[_0xa450('0x39')]=_0x43c5b5[_0xa450('0x39')]['length']?_0x43c5b5['attributes']:_0x585db0[_0xa450('0x34')];_0x43c5b5[_0xa450('0x56')]=qs[_0xa450('0x3d')](_0x35ec7f['query'][_0xa450('0x3d')]);_0x43c5b5[_0xa450('0x3e')]=qs[_0xa450('0x37')](_[_0xa450('0x3f')](_0x35ec7f[_0xa450('0x36')],_0x585db0[_0xa450('0x37')]));if(_0x35ec7f['query'][_0xa450('0x42')]){_0x43c5b5[_0xa450('0x3e')]=_[_0xa450('0x40')](_0x43c5b5[_0xa450('0x3e')],{'$or':_[_0xa450('0x2f')](_0x43c5b5[_0xa450('0x39')],function(_0x2d3333){var _0x395413={};_0x395413[_0x2d3333]={'$like':'%'+_0x35ec7f[_0xa450('0x36')][_0xa450('0x42')]+'%'};return _0x395413;})});}if(_0x35ec7f[_0xa450('0x36')][_0xa450('0x5a')]){var _0xcab8e0=_0x35ec7f[_0xa450('0x36')]['$gte'][_0xa450('0x5b')](',');var _0xd47d5f={};_0xd47d5f[_0xcab8e0[0x0]]={'$gte':moment(_0xcab8e0[0x1])['format'](_0xa450('0x5c'))};_0x43c5b5[_0xa450('0x3e')]=_[_0xa450('0x40')](_0x43c5b5[_0xa450('0x3e')],_0xd47d5f);}_0x43c5b5=_[_0xa450('0x40')]({},_0x43c5b5,_0x35ec7f[_0xa450('0x43')]);return _0x370974['getMessages'](_0x43c5b5);}})[_0xa450('0x2a')](function(_0xc2d605){if(_0xc2d605){_0x4cf456=_0xc2d605[_0xa450('0x3a')];if(!_0x35ec7f[_0xa450('0x36')][_0xa450('0x3b')](_0xa450('0x3c'))){_0x43c5b5[_0xa450('0x22')]=qs[_0xa450('0x22')](_0x35ec7f[_0xa450('0x36')][_0xa450('0x22')]);_0x43c5b5['offset']=qs[_0xa450('0x24')](_0x35ec7f[_0xa450('0x36')][_0xa450('0x24')]);}return _0x370974[_0xa450('0x59')](_0x43c5b5);}})['then'](function(_0x360435){if(_0x360435){return _0x360435?{'count':_0x4cf456,'rows':_0x360435}:null;}})[_0xa450('0x2a')](respondWithResult(_0x2873c2,null))[_0xa450('0x47')](handleError(_0x2873c2,null));}; \ No newline at end of file +var _0xb3c7=['sendStatus','error','stack','name','send','ChatGroup','rawAttributes','key','model','map','query','keys','attributes','intersection','length','sort','where','filters','filter','merge','options','count','include','rows','show','params','fields','includeAll','find','catch','create','body','update','describe','getUnread','addMembers','ids','getMembers','findOne','User','order','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','pick','$gte','split','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy'];(function(_0x43c4d4,_0x44d9d9){var _0x3248c4=function(_0x34ef26){while(--_0x34ef26){_0x43c4d4['push'](_0x43c4d4['shift']());}};_0x3248c4(++_0x44d9d9);}(_0xb3c7,0x1bc));var _0x7b3c=function(_0x2975a5,_0x285c85){_0x2975a5=_0x2975a5-0x0;var _0x3ecd4d=_0xb3c7[_0x2975a5];return _0x3ecd4d;};'use strict';var emlformat=require(_0x7b3c('0x0'));var rimraf=require(_0x7b3c('0x1'));var zipdir=require(_0x7b3c('0x2'));var jsonpatch=require(_0x7b3c('0x3'));var rp=require(_0x7b3c('0x4'));var moment=require(_0x7b3c('0x5'));var BPromise=require(_0x7b3c('0x6'));var Mustache=require(_0x7b3c('0x7'));var util=require('util');var path=require(_0x7b3c('0x8'));var sox=require(_0x7b3c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b3c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b3c('0xb'));var _=require(_0x7b3c('0xc'));var squel=require(_0x7b3c('0xd'));var crypto=require(_0x7b3c('0xe'));var jsforce=require(_0x7b3c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7b3c('0x10'));var querystring=require(_0x7b3c('0x11'));var Papa=require(_0x7b3c('0x12'));var Redis=require(_0x7b3c('0x13'));var authService=require(_0x7b3c('0x14'));var qs=require(_0x7b3c('0x15'));var as=require(_0x7b3c('0x16'));var hardwareService=require(_0x7b3c('0x17'));var logger=require('../../config/logger')(_0x7b3c('0x18'));var utils=require(_0x7b3c('0x19'));var config=require(_0x7b3c('0x1a'));var licenseUtil=require(_0x7b3c('0x1b'));var db=require('../../mysqldb')['db'];config[_0x7b3c('0x1c')]=_[_0x7b3c('0x1d')](config['redis'],{'host':_0x7b3c('0x1e'),'port':0x18eb});var socket=require(_0x7b3c('0x1f'))(new Redis(config[_0x7b3c('0x1c')]));require(_0x7b3c('0x20'))[_0x7b3c('0x21')](socket);function respondWithStatusCode(_0x53a93e,_0x5306b6){_0x5306b6=_0x5306b6||0xcc;return function(_0xedcebb){if(_0xedcebb){return _0x53a93e['sendStatus'](_0x5306b6);}return _0x53a93e[_0x7b3c('0x22')](_0x5306b6)[_0x7b3c('0x23')]();};}function respondWithResult(_0x29c7a8,_0x2a57cb){_0x2a57cb=_0x2a57cb||0xc8;return function(_0x1c8a59){if(_0x1c8a59){return _0x29c7a8[_0x7b3c('0x22')](_0x2a57cb)[_0x7b3c('0x24')](_0x1c8a59);}};}function respondWithFilteredResult(_0x128ada,_0x541f63){return function(_0x174d1a){if(_0x174d1a){var _0x2ea8ef=typeof _0x541f63[_0x7b3c('0x25')]===_0x7b3c('0x26')&&typeof _0x541f63[_0x7b3c('0x27')]==='undefined';var _0x491fae=_0x174d1a['count'];var _0x1690de=_0x2ea8ef?0x0:_0x541f63[_0x7b3c('0x25')];var _0xb7c2f0=_0x2ea8ef?_0x174d1a['count']:_0x541f63[_0x7b3c('0x25')]+_0x541f63[_0x7b3c('0x27')];var _0x2f4104;if(_0xb7c2f0>=_0x491fae){_0xb7c2f0=_0x491fae;_0x2f4104=0xc8;}else{_0x2f4104=0xce;}_0x128ada[_0x7b3c('0x22')](_0x2f4104);return _0x128ada[_0x7b3c('0x28')](_0x7b3c('0x29'),_0x1690de+'-'+_0xb7c2f0+'/'+_0x491fae)['json'](_0x174d1a);}return null;};}function patchUpdates(_0x3504cc){return function(_0x2ec4c1){try{jsonpatch[_0x7b3c('0x2a')](_0x2ec4c1,_0x3504cc,!![]);}catch(_0x70399b){return BPromise['reject'](_0x70399b);}return _0x2ec4c1[_0x7b3c('0x2b')]();};}function saveUpdates(_0x3d68ba,_0x2d285b){return function(_0x28f379){if(_0x28f379){return _0x28f379['update'](_0x3d68ba)[_0x7b3c('0x2c')](function(_0x3084e0){return _0x3084e0;});}return null;};}function removeEntity(_0x2998f5,_0x381dbc){return function(_0x4156d5){if(_0x4156d5){return _0x4156d5[_0x7b3c('0x2d')]()['then'](function(){_0x2998f5[_0x7b3c('0x22')](0xcc)[_0x7b3c('0x23')]();});}};}function handleEntityNotFound(_0x86bd76,_0x504a81){return function(_0x22c7fa){if(!_0x22c7fa){_0x86bd76[_0x7b3c('0x2e')](0x194);}return _0x22c7fa;};}function handleError(_0x2f8e97,_0x672856){_0x672856=_0x672856||0x1f4;return function(_0xaadef9){logger[_0x7b3c('0x2f')](_0xaadef9[_0x7b3c('0x30')]);if(_0xaadef9[_0x7b3c('0x31')]){delete _0xaadef9[_0x7b3c('0x31')];}_0x2f8e97[_0x7b3c('0x22')](_0x672856)[_0x7b3c('0x32')](_0xaadef9);};}exports['index']=function(_0x9d6ee6,_0x437293){var _0x8d8fa={},_0x56671a={},_0x190444={'count':0x0,'rows':[]};var _0x41ff48=_['map'](db[_0x7b3c('0x33')][_0x7b3c('0x34')],function(_0x197fe5){return{'name':_0x197fe5['fieldName'],'type':_0x197fe5['type'][_0x7b3c('0x35')]};});_0x56671a[_0x7b3c('0x36')]=_[_0x7b3c('0x37')](_0x41ff48,_0x7b3c('0x31'));_0x56671a[_0x7b3c('0x38')]=_[_0x7b3c('0x39')](_0x9d6ee6[_0x7b3c('0x38')]);_0x56671a['filters']=_['intersection'](_0x56671a[_0x7b3c('0x36')],_0x56671a['query']);_0x8d8fa[_0x7b3c('0x3a')]=_[_0x7b3c('0x3b')](_0x56671a[_0x7b3c('0x36')],qs['fields'](_0x9d6ee6['query']['fields']));_0x8d8fa[_0x7b3c('0x3a')]=_0x8d8fa[_0x7b3c('0x3a')][_0x7b3c('0x3c')]?_0x8d8fa[_0x7b3c('0x3a')]:_0x56671a['model'];if(!_0x9d6ee6['query']['hasOwnProperty']('nolimit')){_0x8d8fa[_0x7b3c('0x27')]=qs['limit'](_0x9d6ee6[_0x7b3c('0x38')][_0x7b3c('0x27')]);_0x8d8fa[_0x7b3c('0x25')]=qs[_0x7b3c('0x25')](_0x9d6ee6[_0x7b3c('0x38')][_0x7b3c('0x25')]);}_0x8d8fa['order']=qs[_0x7b3c('0x3d')](_0x9d6ee6[_0x7b3c('0x38')]['sort']);_0x8d8fa[_0x7b3c('0x3e')]=qs[_0x7b3c('0x3f')](_['pick'](_0x9d6ee6[_0x7b3c('0x38')],_0x56671a[_0x7b3c('0x3f')]),_0x41ff48);if(_0x9d6ee6[_0x7b3c('0x38')][_0x7b3c('0x40')]){_0x8d8fa[_0x7b3c('0x3e')]=_[_0x7b3c('0x41')](_0x8d8fa['where'],{'$or':_['map'](_0x41ff48,function(_0x4ec732){if(_0x4ec732['type']!=='VIRTUAL'){var _0x2b43b4={};_0x2b43b4[_0x4ec732[_0x7b3c('0x31')]]={'$like':'%'+_0x9d6ee6[_0x7b3c('0x38')][_0x7b3c('0x40')]+'%'};return _0x2b43b4;}})});}_0x8d8fa=_[_0x7b3c('0x41')]({},_0x8d8fa,_0x9d6ee6[_0x7b3c('0x42')]);var _0x4b9f7a={'where':_0x8d8fa[_0x7b3c('0x3e')]};return db[_0x7b3c('0x33')][_0x7b3c('0x43')](_0x4b9f7a)[_0x7b3c('0x2c')](function(_0x1c69c8){_0x190444[_0x7b3c('0x43')]=_0x1c69c8;if(_0x9d6ee6[_0x7b3c('0x38')]['includeAll']){_0x8d8fa[_0x7b3c('0x44')]=[{'all':!![]}];}return db[_0x7b3c('0x33')]['findAll'](_0x8d8fa);})['then'](function(_0x58d3dc){_0x190444[_0x7b3c('0x45')]=_0x58d3dc;return _0x190444;})[_0x7b3c('0x2c')](respondWithFilteredResult(_0x437293,_0x8d8fa))['catch'](handleError(_0x437293,null));};exports[_0x7b3c('0x46')]=function(_0x4a39f7,_0x27f7cf){var _0xfaa1db={'raw':!![],'where':{'id':_0x4a39f7[_0x7b3c('0x47')]['id']}},_0x2fefbc={};_0x2fefbc[_0x7b3c('0x36')]=_[_0x7b3c('0x39')](db[_0x7b3c('0x33')][_0x7b3c('0x34')]);_0x2fefbc['query']=_[_0x7b3c('0x39')](_0x4a39f7[_0x7b3c('0x38')]);_0x2fefbc[_0x7b3c('0x3f')]=_[_0x7b3c('0x3b')](_0x2fefbc[_0x7b3c('0x36')],_0x2fefbc[_0x7b3c('0x38')]);_0xfaa1db[_0x7b3c('0x3a')]=_[_0x7b3c('0x3b')](_0x2fefbc[_0x7b3c('0x36')],qs['fields'](_0x4a39f7['query'][_0x7b3c('0x48')]));_0xfaa1db[_0x7b3c('0x3a')]=_0xfaa1db[_0x7b3c('0x3a')]['length']?_0xfaa1db['attributes']:_0x2fefbc[_0x7b3c('0x36')];if(_0x4a39f7['query'][_0x7b3c('0x49')]){_0xfaa1db[_0x7b3c('0x44')]=[{'all':!![]}];}_0xfaa1db=_[_0x7b3c('0x41')]({},_0xfaa1db,_0x4a39f7[_0x7b3c('0x42')]);return db[_0x7b3c('0x33')][_0x7b3c('0x4a')](_0xfaa1db)['then'](handleEntityNotFound(_0x27f7cf,null))[_0x7b3c('0x2c')](respondWithResult(_0x27f7cf,null))[_0x7b3c('0x4b')](handleError(_0x27f7cf,null));};exports[_0x7b3c('0x4c')]=function(_0x3eeb3e,_0x31ccf9){return db[_0x7b3c('0x33')][_0x7b3c('0x4c')](_0x3eeb3e[_0x7b3c('0x4d')],{})[_0x7b3c('0x2c')](respondWithResult(_0x31ccf9,0xc9))['catch'](handleError(_0x31ccf9,null));};exports[_0x7b3c('0x4e')]=function(_0x1e64ed,_0x9476c8){if(_0x1e64ed[_0x7b3c('0x4d')]['id']){delete _0x1e64ed[_0x7b3c('0x4d')]['id'];}return db[_0x7b3c('0x33')][_0x7b3c('0x4a')]({'where':{'id':_0x1e64ed[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x9476c8,null))[_0x7b3c('0x2c')](saveUpdates(_0x1e64ed[_0x7b3c('0x4d')],null))['then'](respondWithResult(_0x9476c8,null))[_0x7b3c('0x4b')](handleError(_0x9476c8,null));};exports[_0x7b3c('0x2d')]=function(_0x5dc5ca,_0x589827){return db[_0x7b3c('0x33')][_0x7b3c('0x4a')]({'where':{'id':_0x5dc5ca[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x589827,null))[_0x7b3c('0x2c')](removeEntity(_0x589827,null))[_0x7b3c('0x4b')](handleError(_0x589827,null));};exports[_0x7b3c('0x4f')]=function(_0x459deb,_0x278240){return db[_0x7b3c('0x33')][_0x7b3c('0x4f')]()['then'](respondWithResult(_0x278240,null))['catch'](handleError(_0x278240,null));};exports[_0x7b3c('0x50')]=function(_0x131995,_0x11147a,_0x5058b1){return db['ChatInternalMessage'][_0x7b3c('0x43')]({'where':{'ChatGroupId':_0x131995['params']['id'],'ToId':_0x131995['user']['id'],'read':![]}})['then'](function(_0x24d6fc){return{'id':_['toInteger'](_0x131995[_0x7b3c('0x47')]['id']),'count':_0x24d6fc};})[_0x7b3c('0x2c')](respondWithResult(_0x11147a,null))[_0x7b3c('0x4b')](handleError(_0x11147a,null));};exports['addMembers']=function(_0x3b57f8,_0x199f16,_0x3ce981){return db['ChatGroup'][_0x7b3c('0x4a')]({'where':{'id':_0x3b57f8[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x199f16,null))[_0x7b3c('0x2c')](function(_0x7f445e){if(_0x7f445e){return _0x7f445e[_0x7b3c('0x51')](_0x3b57f8['body'][_0x7b3c('0x52')],_['omit'](_0x3b57f8[_0x7b3c('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x199f16,null))[_0x7b3c('0x4b')](handleError(_0x199f16,null));};exports[_0x7b3c('0x53')]=function(_0x4f0e86,_0x25cdf0,_0x980284){var _0x12dd4c={};var _0x14a3e0={};var _0x44b745;var _0x524522;return db['ChatGroup'][_0x7b3c('0x54')]({'where':{'id':_0x4f0e86[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x25cdf0,null))['then'](function(_0x4e9691){if(_0x4e9691){_0x44b745=_0x4e9691;_0x14a3e0[_0x7b3c('0x36')]=_[_0x7b3c('0x39')](db[_0x7b3c('0x55')][_0x7b3c('0x34')]);_0x14a3e0[_0x7b3c('0x38')]=_['keys'](_0x4f0e86[_0x7b3c('0x38')]);_0x14a3e0[_0x7b3c('0x3f')]=_['intersection'](_0x14a3e0[_0x7b3c('0x36')],_0x14a3e0[_0x7b3c('0x38')]);_0x12dd4c[_0x7b3c('0x3a')]=_[_0x7b3c('0x3b')](_0x14a3e0[_0x7b3c('0x36')],qs['fields'](_0x4f0e86[_0x7b3c('0x38')][_0x7b3c('0x48')]));_0x12dd4c['attributes']=_0x12dd4c[_0x7b3c('0x3a')][_0x7b3c('0x3c')]?_0x12dd4c[_0x7b3c('0x3a')]:_0x14a3e0[_0x7b3c('0x36')];_0x12dd4c[_0x7b3c('0x56')]=qs[_0x7b3c('0x3d')](_0x4f0e86['query'][_0x7b3c('0x3d')]);_0x12dd4c[_0x7b3c('0x3e')]=qs[_0x7b3c('0x3f')](_['pick'](_0x4f0e86[_0x7b3c('0x38')],_0x14a3e0[_0x7b3c('0x3f')]));if(_0x4f0e86['query'][_0x7b3c('0x40')]){_0x12dd4c[_0x7b3c('0x3e')]=_[_0x7b3c('0x41')](_0x12dd4c[_0x7b3c('0x3e')],{'$or':_[_0x7b3c('0x37')](_0x12dd4c[_0x7b3c('0x3a')],function(_0x57606f){var _0x1c7d5b={};_0x1c7d5b[_0x57606f]={'$like':'%'+_0x4f0e86[_0x7b3c('0x38')][_0x7b3c('0x40')]+'%'};return _0x1c7d5b;})});}_0x12dd4c=_[_0x7b3c('0x41')]({},_0x12dd4c,_0x4f0e86['options']);return _0x44b745[_0x7b3c('0x53')](_0x12dd4c);}})[_0x7b3c('0x2c')](function(_0x2cf7b3){if(_0x2cf7b3){_0x524522=_0x2cf7b3[_0x7b3c('0x3c')];if(!_0x4f0e86[_0x7b3c('0x38')]['hasOwnProperty'](_0x7b3c('0x57'))){_0x12dd4c[_0x7b3c('0x27')]=qs[_0x7b3c('0x27')](_0x4f0e86[_0x7b3c('0x38')][_0x7b3c('0x27')]);_0x12dd4c[_0x7b3c('0x25')]=qs[_0x7b3c('0x25')](_0x4f0e86[_0x7b3c('0x38')][_0x7b3c('0x25')]);}return _0x44b745[_0x7b3c('0x53')](_0x12dd4c);}})[_0x7b3c('0x2c')](function(_0x5d1fa7){if(_0x5d1fa7){return _0x5d1fa7?{'count':_0x524522,'rows':_0x5d1fa7}:null;}})[_0x7b3c('0x2c')](respondWithResult(_0x25cdf0,null))[_0x7b3c('0x4b')](handleError(_0x25cdf0,null));};exports[_0x7b3c('0x58')]=function(_0x5df69a,_0x512c52,_0x2e8960){return db['ChatGroup'][_0x7b3c('0x4a')]({'where':{'id':_0x5df69a[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x512c52,null))['then'](function(_0x296db5){if(_0x296db5){return _0x296db5[_0x7b3c('0x58')](_0x5df69a[_0x7b3c('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x512c52,null))['catch'](handleError(_0x512c52,null));};exports[_0x7b3c('0x59')]=function(_0x1123cc,_0x2923d8,_0x4265c1){if(_0x1123cc['body']['id']){delete _0x1123cc[_0x7b3c('0x4d')]['id'];}return db[_0x7b3c('0x33')][_0x7b3c('0x4a')]({'where':{'id':_0x1123cc[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x2923d8,null))['then'](function(_0x59377c){if(_0x59377c){_0x1123cc[_0x7b3c('0x4d')][_0x7b3c('0x5a')]=_0x59377c['id'];return db[_0x7b3c('0x5b')]['create'](_0x1123cc[_0x7b3c('0x4d')]);}})[_0x7b3c('0x2c')](respondWithResult(_0x2923d8,null))[_0x7b3c('0x4b')](handleError(_0x2923d8,null));};exports[_0x7b3c('0x5c')]=function(_0x1922e2,_0x4e3fd2,_0x2360cd){var _0x160570={};var _0x3a64de={};var _0x4d65f3;var _0x2fd9d4;return db[_0x7b3c('0x33')][_0x7b3c('0x54')]({'where':{'id':_0x1922e2[_0x7b3c('0x47')]['id']}})[_0x7b3c('0x2c')](handleEntityNotFound(_0x4e3fd2,null))[_0x7b3c('0x2c')](function(_0x3e0645){if(_0x3e0645){_0x4d65f3=_0x3e0645;_0x3a64de[_0x7b3c('0x36')]=_[_0x7b3c('0x39')](db['ChatInternalMessage'][_0x7b3c('0x34')]);_0x3a64de[_0x7b3c('0x38')]=_[_0x7b3c('0x39')](_0x1922e2[_0x7b3c('0x38')]);_0x3a64de[_0x7b3c('0x3f')]=_[_0x7b3c('0x3b')](_0x3a64de[_0x7b3c('0x36')],_0x3a64de[_0x7b3c('0x38')]);_0x160570[_0x7b3c('0x3a')]=_[_0x7b3c('0x3b')](_0x3a64de['model'],qs[_0x7b3c('0x48')](_0x1922e2[_0x7b3c('0x38')][_0x7b3c('0x48')]));_0x160570[_0x7b3c('0x3a')]=_0x160570[_0x7b3c('0x3a')]['length']?_0x160570[_0x7b3c('0x3a')]:_0x3a64de['model'];_0x160570['order']=qs['sort'](_0x1922e2['query'][_0x7b3c('0x3d')]);_0x160570['where']=qs['filters'](_[_0x7b3c('0x5d')](_0x1922e2[_0x7b3c('0x38')],_0x3a64de[_0x7b3c('0x3f')]));if(_0x1922e2[_0x7b3c('0x38')]['filter']){_0x160570['where']=_[_0x7b3c('0x41')](_0x160570[_0x7b3c('0x3e')],{'$or':_[_0x7b3c('0x37')](_0x160570['attributes'],function(_0x720aff){var _0x2aa6c6={};_0x2aa6c6[_0x720aff]={'$like':'%'+_0x1922e2['query'][_0x7b3c('0x40')]+'%'};return _0x2aa6c6;})});}if(_0x1922e2[_0x7b3c('0x38')][_0x7b3c('0x5e')]){var _0x457799=_0x1922e2[_0x7b3c('0x38')][_0x7b3c('0x5e')][_0x7b3c('0x5f')](',');var _0x2b8e4c={};_0x2b8e4c[_0x457799[0x0]]={'$gte':moment(_0x457799[0x1])['format'](_0x7b3c('0x60'))};_0x160570[_0x7b3c('0x3e')]=_['merge'](_0x160570['where'],_0x2b8e4c);}_0x160570=_['merge']({},_0x160570,_0x1922e2[_0x7b3c('0x42')]);return _0x4d65f3[_0x7b3c('0x5c')](_0x160570);}})[_0x7b3c('0x2c')](function(_0x5dde87){if(_0x5dde87){_0x2fd9d4=_0x5dde87['length'];if(!_0x1922e2['query'][_0x7b3c('0x61')](_0x7b3c('0x57'))){_0x160570[_0x7b3c('0x27')]=qs[_0x7b3c('0x27')](_0x1922e2[_0x7b3c('0x38')][_0x7b3c('0x27')]);_0x160570[_0x7b3c('0x25')]=qs[_0x7b3c('0x25')](_0x1922e2[_0x7b3c('0x38')]['offset']);}return _0x4d65f3[_0x7b3c('0x5c')](_0x160570);}})[_0x7b3c('0x2c')](function(_0x2dbfba){if(_0x2dbfba){return _0x2dbfba?{'count':_0x2fd9d4,'rows':_0x2dbfba}:null;}})[_0x7b3c('0x2c')](respondWithResult(_0x4e3fd2,null))[_0x7b3c('0x4b')](handleError(_0x4e3fd2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 2d120b6..ea865ef 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 _0x9d76=['../../mysqldb','ChatGroup','update','emit','hook','events'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0x9d76,0x95));var _0x69d7=function(_0x403a5f,_0x3ef894){_0x403a5f=_0x403a5f-0x0;var _0xf64cc2=_0x9d76[_0x403a5f];return _0xf64cc2;};'use strict';var EventEmitter=require(_0x69d7('0x0'));var ChatGroup=require(_0x69d7('0x1'))['db'][_0x69d7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x69d7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x242c63){return function(_0x4763bc,_0x3ebc44,_0x1e7a66){ChatGroupEvents[_0x69d7('0x4')](_0x242c63+':'+_0x4763bc['id'],_0x4763bc);ChatGroupEvents['emit'](_0x242c63,_0x4763bc);_0x1e7a66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x69d7('0x5')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xa899=['exports','events','../../mysqldb','ChatGroup','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b90fc,_0x14bdcd){var _0x2ec7ba=function(_0x1305d7){while(--_0x1305d7){_0x2b90fc['push'](_0x2b90fc['shift']());}};_0x2ec7ba(++_0x14bdcd);}(_0xa899,0x155));var _0x9a89=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa899[_0x176329];return _0x31997c;};'use strict';var EventEmitter=require(_0x9a89('0x0'));var ChatGroup=require(_0x9a89('0x1'))['db'][_0x9a89('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a89('0x3'),'afterUpdate':_0x9a89('0x4'),'afterDestroy':_0x9a89('0x5')};function emitEvent(_0x45233c){return function(_0x405c47,_0x15c431,_0x105758){ChatGroupEvents[_0x9a89('0x6')](_0x45233c+':'+_0x405c47['id'],_0x405c47);ChatGroupEvents[_0x9a89('0x6')](_0x45233c,_0x405c47);_0x105758(null);};}for(var e in events){if(events[_0x9a89('0x7')](e)){var event=events[e];ChatGroup[_0x9a89('0x8')](e,emitEvent(event));}}module[_0x9a89('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 5952ae0..574db3b 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 _0x3605=['bluebird','request-promise','path','rimraf','../../config/environment','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x5ed7be,_0x2ca3fd){var _0x538a76=function(_0x2d3234){while(--_0x2d3234){_0x5ed7be['push'](_0x5ed7be['shift']());}};_0x538a76(++_0x2ca3fd);}(_0x3605,0x1f3));var _0x5360=function(_0x4adebc,_0x53af4a){_0x4adebc=_0x4adebc-0x0;var _0x414436=_0x3605[_0x4adebc];return _0x414436;};'use strict';var _=require(_0x5360('0x0'));var util=require(_0x5360('0x1'));var logger=require(_0x5360('0x2'))(_0x5360('0x3'));var moment=require(_0x5360('0x4'));var BPromise=require(_0x5360('0x5'));var rp=require(_0x5360('0x6'));var fs=require('fs');var path=require(_0x5360('0x7'));var rimraf=require(_0x5360('0x8'));var config=require(_0x5360('0x9'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x5f3a9a,_0x2adb9e){return _0x5f3a9a['define'](_0x5360('0xa'),attributes,{'tableName':_0x5360('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c8d=['ChatGroup','chat_groups','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define'];(function(_0x44b267,_0x54f404){var _0x1efbfc=function(_0x3fe74f){while(--_0x3fe74f){_0x44b267['push'](_0x44b267['shift']());}};_0x1efbfc(++_0x54f404);}(_0x4c8d,0x7a));var _0xd4c8=function(_0x44dce4,_0x9ed619){_0x44dce4=_0x44dce4-0x0;var _0x2966ec=_0x4c8d[_0x44dce4];return _0x2966ec;};'use strict';var _=require(_0xd4c8('0x0'));var util=require('util');var logger=require(_0xd4c8('0x1'))(_0xd4c8('0x2'));var moment=require(_0xd4c8('0x3'));var BPromise=require('bluebird');var rp=require(_0xd4c8('0x4'));var fs=require('fs');var path=require(_0xd4c8('0x5'));var rimraf=require(_0xd4c8('0x6'));var config=require(_0xd4c8('0x7'));var attributes=require(_0xd4c8('0x8'));module['exports']=function(_0x3fae2b,_0x43ae8f){return _0x3fae2b[_0xd4c8('0x9')](_0xd4c8('0xa'),attributes,{'tableName':_0xd4c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index da933f7..40cf42b 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 _0x3d5d=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0xe5f753,_0x52657d){var _0x47e0c3=function(_0x45e36b){while(--_0x45e36b){_0xe5f753['push'](_0xe5f753['shift']());}};_0x47e0c3(++_0x52657d);}(_0x3d5d,0x104));var _0xd3d5=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x3d5d[_0x44c974];return _0x5214c6;};'use strict';var _=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3d5('0x2'));var fs=require('fs');var Redis=require(_0xd3d5('0x3'));var db=require(_0xd3d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3d5('0x5'))(_0xd3d5('0x6'));var config=require(_0xd3d5('0x7'));var jayson=require(_0xd3d5('0x8'));var client=jayson['client'][_0xd3d5('0x9')]({'port':0x232a});config['redis']=_[_0xd3d5('0xa')](config[_0xd3d5('0xb')],{'host':_0xd3d5('0xc'),'port':0x18eb});var socket=require(_0xd3d5('0xd'))(new Redis(config['redis']));require(_0xd3d5('0xe'))[_0xd3d5('0xf')](socket);function respondWithRpcPromise(_0x209305,_0x5c66cf,_0x3e64c4){return new BPromise(function(_0x3fba26,_0x5a2468){return client[_0xd3d5('0x10')](_0x209305,_0x3e64c4)[_0xd3d5('0x11')](function(_0x3e8301){logger[_0xd3d5('0x12')]('ChatGroup,\x20%s,\x20%s',_0x5c66cf,'request\x20sent');logger[_0xd3d5('0x13')](_0xd3d5('0x14'),_0x5c66cf,_0xd3d5('0x15'),JSON[_0xd3d5('0x16')](_0x3e8301));if(_0x3e8301[_0xd3d5('0x17')]){if(_0x3e8301['error'][_0xd3d5('0x18')]===0x1f4){logger[_0xd3d5('0x17')](_0xd3d5('0x19'),_0x5c66cf,_0x3e8301['error'][_0xd3d5('0x1a')]);return _0x5a2468(_0x3e8301['error']['message']);}logger[_0xd3d5('0x17')]('ChatGroup,\x20%s,\x20%s',_0x5c66cf,_0x3e8301[_0xd3d5('0x17')][_0xd3d5('0x1a')]);return _0x3fba26(_0x3e8301[_0xd3d5('0x17')]['message']);}else{logger[_0xd3d5('0x12')](_0xd3d5('0x19'),_0x5c66cf,_0xd3d5('0x15'));_0x3fba26(_0x3e8301[_0xd3d5('0x1b')][_0xd3d5('0x1a')]);}})[_0xd3d5('0x1c')](function(_0x42e079){logger[_0xd3d5('0x17')]('ChatGroup,\x20%s,\x20%s',_0x5c66cf,_0x42e079);_0x5a2468(_0x42e079);});});} \ No newline at end of file +var _0x9b2a=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x59bd19,_0x3a9030){var _0x35526a=function(_0x1b4986){while(--_0x1b4986){_0x59bd19['push'](_0x59bd19['shift']());}};_0x35526a(++_0x3a9030);}(_0x9b2a,0x127));var _0xa9b2=function(_0xf6a7d0,_0x516faf){_0xf6a7d0=_0xf6a7d0-0x0;var _0x2fb1c2=_0x9b2a[_0xf6a7d0];return _0x2fb1c2;};'use strict';var _=require(_0xa9b2('0x0'));var util=require('util');var moment=require(_0xa9b2('0x1'));var BPromise=require(_0xa9b2('0x2'));var rs=require(_0xa9b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9b2('0x4'))['db'];var utils=require(_0xa9b2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa9b2('0x6'));var jayson=require(_0xa9b2('0x7'));var client=jayson[_0xa9b2('0x8')][_0xa9b2('0x9')]({'port':0x232a});config['redis']=_[_0xa9b2('0xa')](config[_0xa9b2('0xb')],{'host':_0xa9b2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9b2('0xb')]));require(_0xa9b2('0xd'))[_0xa9b2('0xe')](socket);function respondWithRpcPromise(_0x404ad5,_0x1c141f,_0x3e04e9){return new BPromise(function(_0x4a2cec,_0x35284b){return client['request'](_0x404ad5,_0x3e04e9)['then'](function(_0x47918e){logger[_0xa9b2('0xf')](_0xa9b2('0x10'),_0x1c141f,_0xa9b2('0x11'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1c141f,_0xa9b2('0x11'),JSON['stringify'](_0x47918e));if(_0x47918e[_0xa9b2('0x12')]){if(_0x47918e[_0xa9b2('0x12')][_0xa9b2('0x13')]===0x1f4){logger['error'](_0xa9b2('0x10'),_0x1c141f,_0x47918e['error']['message']);return _0x35284b(_0x47918e['error']['message']);}logger[_0xa9b2('0x12')](_0xa9b2('0x10'),_0x1c141f,_0x47918e['error'][_0xa9b2('0x14')]);return _0x4a2cec(_0x47918e['error'][_0xa9b2('0x14')]);}else{logger[_0xa9b2('0xf')](_0xa9b2('0x10'),_0x1c141f,_0xa9b2('0x11'));_0x4a2cec(_0x47918e[_0xa9b2('0x15')][_0xa9b2('0x14')]);}})[_0xa9b2('0x16')](function(_0x354b84){logger[_0xa9b2('0x12')]('ChatGroup,\x20%s,\x20%s',_0x1c141f,_0x354b84);_0x35284b(_0x354b84);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6c360ad..edee4b5 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 _0x2834=['removeListener','register','chatGroup:','./chatGroup.events','save','emit'];(function(_0x1cb8d5,_0x8b7ad7){var _0x3fed2b=function(_0x2898b9){while(--_0x2898b9){_0x1cb8d5['push'](_0x1cb8d5['shift']());}};_0x3fed2b(++_0x8b7ad7);}(_0x2834,0x75));var _0x4283=function(_0x42045c,_0x2a1f78){_0x42045c=_0x42045c-0x0;var _0x59f3b1=_0x2834[_0x42045c];return _0x59f3b1;};'use strict';var ChatGroupEvents=require(_0x4283('0x0'));var events=[_0x4283('0x1'),'remove','update'];function createListener(_0x3dfade,_0x3e16bb){return function(_0x39e134){_0x3e16bb[_0x4283('0x2')](_0x3dfade,_0x39e134);};}function removeListener(_0x3cca24,_0x303980){return function(){ChatGroupEvents[_0x4283('0x3')](_0x3cca24,_0x303980);};}exports[_0x4283('0x4')]=function(_0x2b2719){for(var _0x18dae4=0x0,_0xfe4d5a=events['length'];_0x18dae4<_0xfe4d5a;_0x18dae4++){var _0x155e93=events[_0x18dae4];var _0x450393=createListener(_0x4283('0x5')+_0x155e93,_0x2b2719);ChatGroupEvents['on'](_0x155e93,_0x450393);}}; \ No newline at end of file +var _0xaea9=['emit','removeListener','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x38a7f5,_0x413aac){var _0x4f34fc=function(_0x4f5f38){while(--_0x4f5f38){_0x38a7f5['push'](_0x38a7f5['shift']());}};_0x4f34fc(++_0x413aac);}(_0xaea9,0xdc));var _0x9aea=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xaea9[_0x397e5f];return _0x5302b8;};'use strict';var ChatGroupEvents=require(_0x9aea('0x0'));var events=[_0x9aea('0x1'),_0x9aea('0x2'),_0x9aea('0x3')];function createListener(_0x5df38a,_0x1de75f){return function(_0x530989){_0x1de75f[_0x9aea('0x4')](_0x5df38a,_0x530989);};}function removeListener(_0x15ce1f,_0x3aebc1){return function(){ChatGroupEvents[_0x9aea('0x5')](_0x15ce1f,_0x3aebc1);};}exports['register']=function(_0x1e9b2a){for(var _0x318c82=0x0,_0x50cf5a=events[_0x9aea('0x6')];_0x318c82<_0x50cf5a;_0x318c82++){var _0x549522=events[_0x318c82];var _0x55db56=createListener(_0x9aea('0x7')+_0x549522,_0x1e9b2a);ChatGroupEvents['on'](_0x549522,_0x55db56);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 10250ea..6ed1599 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 _0x49f0=['util','connect-timeout','express','fs-extra','../../components/interaction/service','./chatGroup.controller','isAuthenticated','get','/describe','/:id/unread','getUnread','/:id/members','getMembers','post','/:id','update','delete','destroy','removeMembers'];(function(_0x42a12c,_0x59ce0d){var _0x389696=function(_0x52a4e9){while(--_0x52a4e9){_0x42a12c['push'](_0x42a12c['shift']());}};_0x389696(++_0x59ce0d);}(_0x49f0,0x98));var _0x049f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x49f0[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x049f('0x0'));var path=require('path');var timeout=require(_0x049f('0x1'));var express=require(_0x049f('0x2'));var router=express['Router']();var fs_extra=require(_0x049f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x049f('0x4'));var config=require('../../config/environment');var controller=require(_0x049f('0x5'));router['get']('/',auth[_0x049f('0x6')](),controller['index']);router[_0x049f('0x7')](_0x049f('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x049f('0x7')]('/:id',auth[_0x049f('0x6')](),controller['show']);router['get'](_0x049f('0x9'),auth[_0x049f('0x6')](),controller[_0x049f('0xa')]);router[_0x049f('0x7')](_0x049f('0xb'),auth[_0x049f('0x6')](),controller[_0x049f('0xc')]);router[_0x049f('0x7')]('/:id/messages',auth[_0x049f('0x6')](),controller['getMessages']);router[_0x049f('0xd')]('/',auth[_0x049f('0x6')](),controller['create']);router[_0x049f('0xd')]('/:id/members',auth[_0x049f('0x6')](),controller['addMembers']);router[_0x049f('0xd')]('/:id/messages',auth[_0x049f('0x6')](),controller['addMessage']);router['put'](_0x049f('0xe'),auth['isAuthenticated'](),controller[_0x049f('0xf')]);router[_0x049f('0x10')]('/:id',auth[_0x049f('0x6')](),controller[_0x049f('0x11')]);router[_0x049f('0x10')](_0x049f('0xb'),auth[_0x049f('0x6')](),controller[_0x049f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5496=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','/:id/members','/:id/messages','post','create','addMembers','put','update','delete','destroy','removeMembers'];(function(_0x5f39b1,_0x5b1ce7){var _0x270a02=function(_0xdf3f58){while(--_0xdf3f58){_0x5f39b1['push'](_0x5f39b1['shift']());}};_0x270a02(++_0x5b1ce7);}(_0x5496,0x153));var _0x6549=function(_0x869d0d,_0x535b6c){_0x869d0d=_0x869d0d-0x0;var _0x405f8c=_0x5496[_0x869d0d];return _0x405f8c;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require('path');var timeout=require(_0x6549('0x2'));var express=require(_0x6549('0x3'));var router=express[_0x6549('0x4')]();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require('./chatGroup.controller');router[_0x6549('0x8')]('/',auth[_0x6549('0x9')](),controller[_0x6549('0xa')]);router[_0x6549('0x8')](_0x6549('0xb'),auth[_0x6549('0x9')](),controller['describe']);router['get'](_0x6549('0xc'),auth[_0x6549('0x9')](),controller[_0x6549('0xd')]);router[_0x6549('0x8')](_0x6549('0xe'),auth[_0x6549('0x9')](),controller['getUnread']);router['get'](_0x6549('0xf'),auth[_0x6549('0x9')](),controller['getMembers']);router[_0x6549('0x8')](_0x6549('0x10'),auth[_0x6549('0x9')](),controller['getMessages']);router[_0x6549('0x11')]('/',auth[_0x6549('0x9')](),controller[_0x6549('0x12')]);router['post'](_0x6549('0xf'),auth[_0x6549('0x9')](),controller[_0x6549('0x13')]);router[_0x6549('0x11')](_0x6549('0x10'),auth[_0x6549('0x9')](),controller['addMessage']);router[_0x6549('0x14')](_0x6549('0xc'),auth[_0x6549('0x9')](),controller[_0x6549('0x15')]);router[_0x6549('0x16')]('/:id',auth[_0x6549('0x9')](),controller[_0x6549('0x17')]);router[_0x6549('0x16')]('/:id/members',auth[_0x6549('0x9')](),controller[_0x6549('0x18')]);module[_0x6549('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8d43eae..334b0b7 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 _0x01d3=['INTEGER','star','thumb','TEXT','STRING','DATE','long','ENUM','sequelize','exports','BOOLEAN'];(function(_0x46e116,_0x2f377e){var _0x197c8c=function(_0x2a9c89){while(--_0x2a9c89){_0x46e116['push'](_0x46e116['shift']());}};_0x197c8c(++_0x2f377e);}(_0x01d3,0xa2));var _0x301d=function(_0x3803b2,_0x4d47f3){_0x3803b2=_0x3803b2-0x0;var _0xc1c2ac=_0x01d3[_0x3803b2];return _0xc1c2ac;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'closed':{'type':Sequelize[_0x301d('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x301d('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x301d('0x4'),_0x301d('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x301d('0x6')]},'pathTranscript':{'type':Sequelize[_0x301d('0x6')]},'mailTranscript':{'type':Sequelize[_0x301d('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x301d('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x301d('0x7')]},'thirdDisposition':{'type':Sequelize[_0x301d('0x7')]},'note':{'type':Sequelize[_0x301d('0x7')]},'browserName':{'type':Sequelize[_0x301d('0x7')]},'browserVersion':{'type':Sequelize[_0x301d('0x7')]},'osName':{'type':Sequelize[_0x301d('0x7')]},'osVersion':{'type':Sequelize[_0x301d('0x7')]},'deviceModel':{'type':Sequelize[_0x301d('0x7')]},'deviceVendor':{'type':Sequelize[_0x301d('0x7')]},'deviceType':{'type':Sequelize[_0x301d('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x301d('0x7')]},'formData':{'type':Sequelize[_0x301d('0x6')](_0x301d('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x301d('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x301d('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x301d('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x301d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9c02=['out','sequelize','exports','BOOLEAN','star','TEXT','DATE','STRING','ENUM'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9c02,0x196));var _0x29c0=function(_0x44a354,_0x30662b){_0x44a354=_0x44a354-0x0;var _0x36da84=_0x9c02[_0x44a354];return _0x36da84;};'use strict';var Sequelize=require(_0x29c0('0x0'));module[_0x29c0('0x1')]={'closed':{'type':Sequelize[_0x29c0('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x29c0('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x29c0('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x29c0('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x29c0('0x6')]},'thirdDisposition':{'type':Sequelize[_0x29c0('0x6')]},'note':{'type':Sequelize[_0x29c0('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x29c0('0x6')]},'osVersion':{'type':Sequelize[_0x29c0('0x6')]},'deviceModel':{'type':Sequelize[_0x29c0('0x6')]},'deviceVendor':{'type':Sequelize[_0x29c0('0x6')]},'deviceType':{'type':Sequelize[_0x29c0('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x29c0('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x29c0('0x5')]},'lastMsgAt':{'type':Sequelize[_0x29c0('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x29c0('0x7')]('in',_0x29c0('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x29c0('0x6')]},'customerPort':{'type':Sequelize[_0x29c0('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x29c0('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 53adaf2..34bfcfa 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 _0xe14d=['unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','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','buildExpression','text','start','Tag','union','User','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','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?','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','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','groupBy','ChatInteractionId','push','all','rows','show','params','keys','includeAll','include','options','create','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Interaction\x20already\x20assigned','AbandonInteraction','abandon','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','format','%s%d','agentAlias','System','customer','agentIdentifier','alias','fullname','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','referer','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','stack','name','send','render','merge','body','contact','interaction','account','Users','map','TagIds','Tags','split','forEach','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions'];(function(_0x1232df,_0x25eab5){var _0x5f4c5c=function(_0x4cf323){while(--_0x4cf323){_0x1232df['push'](_0x1232df['shift']());}};_0x5f4c5c(++_0x25eab5);}(_0xe14d,0x1ee));var _0xde14=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xe14d[_0xbe200f];return _0x192597;};'use strict';var rimraf=require(_0xde14('0x0'));var zipdir=require(_0xde14('0x1'));var rp=require(_0xde14('0x2'));var moment=require(_0xde14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde14('0x4'));var util=require(_0xde14('0x5'));var path=require('path');var ejs=require(_0xde14('0x6'));var fs=require('fs');var _=require(_0xde14('0x7'));var squel=require(_0xde14('0x8'));var Redis=require(_0xde14('0x9'));var qs=require(_0xde14('0xa'));var as=require(_0xde14('0xb'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xde14('0xc'));var config=require(_0xde14('0xd'));var db=require(_0xde14('0xe'))['db'];config[_0xde14('0xf')]=_[_0xde14('0x10')](config[_0xde14('0xf')],{'host':_0xde14('0x11'),'port':0x18eb});var socket=require(_0xde14('0x12'))(new Redis(config['redis']));require(_0xde14('0x13'))[_0xde14('0x14')](socket);var jayson=require(_0xde14('0x15'));var client=jayson[_0xde14('0x16')][_0xde14('0x17')]({'port':0x232b});var client9004=jayson[_0xde14('0x16')][_0xde14('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x3d5a29,_0x34e28f,_0x29e3ca,_0x105f96){return new BPromise(function(_0x464624,_0x3521d4){var _0x281c54=_0x105f96||client;return _0x281c54[_0xde14('0x18')](_0x3d5a29,_0x29e3ca)['then'](function(_0x584959){logger[_0xde14('0x19')](_0xde14('0x1a'),_0x34e28f,_0xde14('0x1b'));logger['debug'](_0xde14('0x1c'),_0x34e28f,_0xde14('0x1b'),JSON[_0xde14('0x1d')](_0x584959));if(_0x584959[_0xde14('0x1e')]){if(_0x584959[_0xde14('0x1e')][_0xde14('0x1f')]===0x1f4){logger[_0xde14('0x1e')](_0xde14('0x1a'),_0x34e28f,_0x584959[_0xde14('0x1e')][_0xde14('0x20')]);return _0x3521d4(_0x584959['error'][_0xde14('0x20')]);}logger[_0xde14('0x1e')](_0xde14('0x1a'),_0x34e28f,_0x584959[_0xde14('0x1e')]['message']);return _0x464624(_0x584959[_0xde14('0x1e')]['message']);}else{logger[_0xde14('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x34e28f,_0xde14('0x1b'));_0x464624(_0x584959[_0xde14('0x21')][_0xde14('0x20')]);}})[_0xde14('0x22')](function(_0x39bdc5){logger[_0xde14('0x1e')](_0xde14('0x1a'),_0x34e28f,_0x39bdc5);_0x3521d4(_0x39bdc5);});});}function respondWithStatusCode(_0x2dd9e7,_0xdd8d59){_0xdd8d59=_0xdd8d59||0xcc;return function(_0x163b79){if(_0x163b79){return _0x2dd9e7[_0xde14('0x23')](_0xdd8d59);}return _0x2dd9e7[_0xde14('0x24')](_0xdd8d59)[_0xde14('0x25')]();};}function respondWithResult(_0x5ae4c1,_0x42dd4f){_0x42dd4f=_0x42dd4f||0xc8;return function(_0x3ce77c){if(_0x3ce77c){return _0x5ae4c1[_0xde14('0x24')](_0x42dd4f)[_0xde14('0x26')](_0x3ce77c);}};}function respondWithFilteredResult(_0x1bb7be,_0x21ef15){return function(_0x310d75){if(_0x310d75){var _0x23c735=typeof _0x21ef15[_0xde14('0x27')]===_0xde14('0x28')&&typeof _0x21ef15['limit']===_0xde14('0x28');var _0x1696ee=_0x310d75[_0xde14('0x29')];var _0xf8279a=_0x23c735?0x0:_0x21ef15['offset'];var _0x3fc2a4=_0x23c735?_0x310d75[_0xde14('0x29')]:_0x21ef15[_0xde14('0x27')]+_0x21ef15['limit'];var _0x4655fb;if(_0x3fc2a4>=_0x1696ee){_0x3fc2a4=_0x1696ee;_0x4655fb=0xc8;}else{_0x4655fb=0xce;}_0x1bb7be['status'](_0x4655fb);return _0x1bb7be[_0xde14('0x2a')](_0xde14('0x2b'),_0xf8279a+'-'+_0x3fc2a4+'/'+_0x1696ee)[_0xde14('0x26')](_0x310d75);}return null;};}function saveUpdates(_0x1e7906){return function(_0x2aca96){if(_0x2aca96){return _0x2aca96[_0xde14('0x2c')](_0x1e7906)[_0xde14('0x2d')](function(_0x464666){return _0x464666;});}return null;};}function removeEntity(_0x4e7c5b){return function(_0xbfc01b){if(_0xbfc01b){return _0xbfc01b[_0xde14('0x2e')]()['then'](function(){_0x4e7c5b[_0xde14('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e40ad){return function(_0x44e88a){if(!_0x44e88a){_0x2e40ad[_0xde14('0x23')](0x194);}return _0x44e88a;};}function handleError(_0x21a916,_0x13c164){_0x13c164=_0x13c164||0x1f4;return function(_0x57fc47){logger[_0xde14('0x1e')](_0x57fc47[_0xde14('0x2f')]);if(_0x57fc47['name']){delete _0x57fc47[_0xde14('0x30')];}_0x21a916[_0xde14('0x24')](_0x13c164)[_0xde14('0x31')](_0x57fc47);};}function getMustacheRender(_0x319136,_0x2713fb){return Mustache[_0xde14('0x32')](_0x319136,_[_0xde14('0x33')](_0x2713fb[_0xde14('0x34')],{'contact':_0x2713fb[_0xde14('0x35')],'message':_0x2713fb['message'],'agent':_0x2713fb['agent'],'interaction':_0x2713fb[_0xde14('0x36')],'account':_0x2713fb[_0xde14('0x37')]}))||'';}function getInteractionUsers(_0x20913d,_0x38d21c){return new BPromise(function(_0x31cad4,_0x23813f){try{if(_0x38d21c[_0x20913d['id']]){_0x20913d[_0xde14('0x38')]=_[_0xde14('0x39')](_0x38d21c[_0x20913d['id']],function(_0x2ac7ba){return{'id':_0x2ac7ba['id'],'fullname':_0x2ac7ba['fullname']};});}}catch(_0x1854d3){_0x23813f(_0x1854d3);}_0x31cad4(_0x20913d);});}function getInteractionTags(_0x48c043,_0x4a363c){return new BPromise(function(_0x4c1e37,_0xb0eba6){try{if(_0x48c043[_0xde14('0x3a')]){_0x48c043[_0xde14('0x3b')]=[];_0x48c043[_0xde14('0x3a')][_0xde14('0x3c')](',')[_0xde14('0x3d')](function(_0x1e89b6){_0x48c043[_0xde14('0x3b')]['push'](_0x4a363c[_0x1e89b6]);});}delete _0x48c043[_0xde14('0x3a')];}catch(_0x3883b9){_0xb0eba6(_0x3883b9);}_0x4c1e37(_0x48c043);});}function updateChatInteraction(_0x3864ff,_0x2b3004,_0x346566){return new BPromise(function(_0x3e52e4,_0x2ec2f3){return getInteractionUsers(_0x3864ff,_0x346566)[_0xde14('0x2d')](function(_0x50db0d){return getInteractionTags(_0x50db0d,_0x2b3004);})[_0xde14('0x2d')](function(_0xb6b2ee){return getStateInteraction(_0xb6b2ee);})[_0xde14('0x2d')](function(_0x25bd85){_0x3e52e4(_0x25bd85);})['catch'](function(_0x5ebb03){_0x2ec2f3(_0x5ebb03);});});}function getStateInteraction(_0x75d4f1){return new BPromise(function(_0x16e7d1){_0x75d4f1[_0xde14('0x3e')]=0x0;_0x75d4f1[_0xde14('0x3f')]=0x0;_0x75d4f1[_0xde14('0x40')]=0x0;_0x75d4f1['unmanaged']=0x0;_0x75d4f1[_0xde14('0x41')]=0x0;_0x75d4f1[_0xde14('0x42')]=0x0;if(!_0x75d4f1[_0xde14('0x43')]&&!_0x75d4f1['UserId']){_0x75d4f1[_0xde14('0x3e')]+=0x1;}if(!_0x75d4f1['closed']&&_0x75d4f1[_0xde14('0x44')]){_0x75d4f1['talking']+=0x1;if(_0x75d4f1[_0xde14('0x3e')]){_0x75d4f1[_0xde14('0x3e')]-=0x1;}}if(_0x75d4f1[_0xde14('0x43')]&&_0x75d4f1[_0xde14('0x45')]===_0xde14('0x41')){_0x75d4f1[_0xde14('0x41')]+=0x1;if(_0x75d4f1[_0xde14('0x3e')]){_0x75d4f1[_0xde14('0x3e')]-=0x1;}}else if(_0x75d4f1['closed']&&!_0x75d4f1[_0xde14('0x44')]&&_0x75d4f1['disposition']){_0x75d4f1[_0xde14('0x46')]+=0x1;if(_0x75d4f1['waiting']){_0x75d4f1[_0xde14('0x3e')]-=0x1;}}else if(_0x75d4f1[_0xde14('0x43')]&&_0x75d4f1[_0xde14('0x44')]){_0x75d4f1[_0xde14('0x40')]+=0x1;if(_0x75d4f1[_0xde14('0x3f')]){_0x75d4f1[_0xde14('0x3f')]-=0x1;}}_0x75d4f1[_0xde14('0x42')]+=0x1;_0x16e7d1(_0x75d4f1);});}exports[_0xde14('0x47')]=function(_0x4f1b43,_0x15859c){var _0xe3669c={},_0x220ca7={},_0x4b1ef7={'count':0x0,'rows':[]};var _0x5ab2de=_[_0xde14('0x39')](db[_0xde14('0x48')][_0xde14('0x49')],function(_0xdbdab8){return{'name':_0xdbdab8[_0xde14('0x4a')],'type':_0xdbdab8[_0xde14('0x4b')]['key']};});_0x220ca7[_0xde14('0x4c')]=_['map'](_0x5ab2de,_0xde14('0x30'));_0x220ca7[_0xde14('0x4d')]=_['keys'](_0x4f1b43[_0xde14('0x4d')]);_0x220ca7[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x220ca7[_0xde14('0x4c')],_0x220ca7[_0xde14('0x4d')]);_0xe3669c[_0xde14('0x50')]=_[_0xde14('0x4f')](_0x220ca7['model'],qs[_0xde14('0x51')](_0x4f1b43['query'][_0xde14('0x51')]));_0xe3669c[_0xde14('0x50')]=_0xe3669c[_0xde14('0x50')][_0xde14('0x52')]?_0xe3669c[_0xde14('0x50')]:_0x220ca7[_0xde14('0x4c')];if(!_0x4f1b43[_0xde14('0x4d')][_0xde14('0x53')](_0xde14('0x54'))){_0xe3669c[_0xde14('0x55')]=qs['limit'](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x55')]);_0xe3669c[_0xde14('0x27')]=qs[_0xde14('0x27')](_0x4f1b43[_0xde14('0x4d')]['offset']);}_0xe3669c[_0xde14('0x56')]=qs['sort'](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x57')]);_0xe3669c[_0xde14('0x58')]=qs[_0xde14('0x4e')](_[_0xde14('0x59')](_0x4f1b43['query'],_0x220ca7['filters']),_0x5ab2de);var _0x435964=[];var _0x56c3fe=squel[_0xde14('0x5a')]()[_0xde14('0x5b')]('id')[_0xde14('0x5b')](_0xde14('0x30'))[_0xde14('0x5b')](_0xde14('0x5c'))[_0xde14('0x5d')](_0xde14('0x5e'));var _0x423adc=squel['select']()[_0xde14('0x5b')](_0xde14('0x5f'))[_0xde14('0x5b')](_0xde14('0x60'))[_0xde14('0x5b')]('ui.ChatInteractionId')[_0xde14('0x5d')]('user_has_chat_interactions','ui')[_0xde14('0x61')](_0xde14('0x62'),'u',_0xde14('0x63'));var _0x4dbeaf=squel[_0xde14('0x5a')]()[_0xde14('0x5d')](_0xde14('0x64'),'i')[_0xde14('0x61')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xde14('0x62'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xde14('0x65'),'a',_0xde14('0x66'))[_0xde14('0x61')](_0xde14('0x67'),'me',_0xde14('0x68'))[_0xde14('0x61')](_0xde14('0x69'),'it',_0xde14('0x6a'))[_0xde14('0x61')]('tools_tags','t',_0xde14('0x6b'));var _0x1cfc98=squel[_0xde14('0x6c')]();var _0x524e98=[];var _0x2bd32d=squel['expr']();var _0xc98b34;if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x6d')]){_0xc98b34=as[_0xde14('0x6e')](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x6d')]);var _0x1a88b3=_0xc98b34['sqlOperator'];for(var _0x3a357a=0x0;_0x3a357a<_0xc98b34[_0xde14('0x6f')][_0xde14('0x52')];_0x3a357a++){var _0x40fcda=_0xc98b34[_0xde14('0x6f')][_0x3a357a];var _0x70a2e1='i';var _0x439118=_['find'](_0x5ab2de,['name',_0x40fcda[_0xde14('0x5b')]]);if(!_0x439118){switch(_0x40fcda[_0xde14('0x5b')]){case _0xde14('0x70'):if(_0x40fcda['value']==0x1){_0x4dbeaf[_0xde14('0x71')]('`'+_0x40fcda[_0xde14('0x5b')]+_0xde14('0x72'));}else{_0x4dbeaf[_0xde14('0x71')]('`'+_0x40fcda['field']+'`\x20>\x200');}break;case _0xde14('0x73'):if(_0x40fcda[_0xde14('0x74')]===_0xde14('0x75')){if(_0x40fcda[_0xde14('0x76')][_0xde14('0x3c')]('\x20')[_0xde14('0x52')]>0x1){_0x1cfc98[_0x1a88b3](_0xde14('0x77'),qs[_0xde14('0x78')](_0x40fcda[_0xde14('0x76')]),null);}else{var _0x4657d1='%'+_0x40fcda[_0xde14('0x76')]+'%';_0x1cfc98[_0x1a88b3](_0xde14('0x79'),_0x4657d1,_0x4657d1,_0x4657d1);}}else{_0x439118=_[_0xde14('0x7a')](_0x5ab2de,[_0xde14('0x30'),_0xde14('0x7b')]);_0x40fcda[_0xde14('0x5b')]=_0xde14('0x7b');_0x4474c2=as[_0xde14('0x7c')](_0x70a2e1,_0x439118[_0xde14('0x4b')],_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')][_0xde14('0x7e')],_0x4474c2[_0xde14('0x76')]['end']);}break;case _0xde14('0x7f'):var _0x55ddcf=_0x40fcda[_0xde14('0x76')]['split'](',')[_0xde14('0x39')](function(_0xfa9c8d){return Number(_0xfa9c8d);});_0x55ddcf[_0xde14('0x3d')](function(_0x5506e1){_0x2bd32d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5506e1+',%');});_0x524e98=_[_0xde14('0x80')](_0x524e98,_0x55ddcf);break;case _0xde14('0x81'):if(_0x40fcda[_0xde14('0x74')]===_0xde14('0x75')){_0x1cfc98[_0x1a88b3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x40fcda[_0xde14('0x76')]+'%',null);}else{_0x439118=_[_0xde14('0x7a')](_0x5ab2de,[_0xde14('0x30'),'UserId']);_0x40fcda['field']='UserId';_0x4474c2=as['buildExpression'](_0x70a2e1,_0x439118[_0xde14('0x4b')],_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')]['start'],_0x4474c2[_0xde14('0x76')][_0xde14('0x25')]);}break;case _0xde14('0x34'):_0x4474c2=as[_0xde14('0x7c')]('me',null,_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')]['start'],_0x4474c2['value'][_0xde14('0x25')]);break;}}else{var _0x4474c2=as['buildExpression'](_0x70a2e1,_0x439118[_0xde14('0x4b')],_0x40fcda);_0x1cfc98[_0x1a88b3](_0x4474c2[_0xde14('0x7d')],_0x4474c2[_0xde14('0x76')][_0xde14('0x7e')],_0x4474c2[_0xde14('0x76')][_0xde14('0x25')]);}}}else{var _0x2540df=_(_0x4f1b43['query'])['keys']()['map'](function(_0x5d9fa3){return _[_0xde14('0x82')](_0x5ab2de,[_0xde14('0x30'),_0x5d9fa3])?_0x5d9fa3:undefined;})['compact']()['value']();if(!_[_0xde14('0x83')](_0x2540df)){_0x2540df[_0xde14('0x3d')](function(_0xe2b9f5){if(_0xe2b9f5==='ChatWebsiteId'){_0x4dbeaf[_0xde14('0x58')](_0xde14('0x84'),[]['concat'](_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5]));}else if(_0xe2b9f5===_0xde14('0x85')){var _0x11c863=JSON[_0xde14('0x86')](_0x4f1b43['query'][_0xe2b9f5])[_0xde14('0x87')];var _0x5a5b25=JSON[_0xde14('0x86')](_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5])[_0xde14('0x88')];_0x4dbeaf['where'](_0xde14('0x89'),_0x11c863,_0x5a5b25);}else{if(_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5]===_0xde14('0x8a')){_0x4dbeaf[_0xde14('0x58')]('i.'+_0xe2b9f5+_0xde14('0x8b'));}else{_0x4dbeaf['where']('i.'+_0xe2b9f5+'\x20=\x20?',_0x4f1b43[_0xde14('0x4d')][_0xe2b9f5]);}}});}if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8c')]){if(_0x4f1b43['query'][_0xde14('0x8c')]==0x1){_0x4dbeaf[_0xde14('0x71')](_0xde14('0x8d'));}else{_0x4dbeaf[_0xde14('0x71')](_0xde14('0x8e'));}}if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')]){_0x524e98=_['isArray'](_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')])?_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')]:new Array(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x8f')]);_0x524e98[_0xde14('0x3d')](function(_0x57bc16){_0x2bd32d['or'](_0xde14('0x90'),'%,'+_0x57bc16+',%');});}if(_0x4f1b43[_0xde14('0x4d')]['filter']){var _0x4543f1=_0x4f1b43['query'][_0xde14('0x91')]['replace']('\x5c','\x5c\x5c')[_0xde14('0x92')](/'/g,'\x27\x27');if(qs[_0xde14('0x93')](_0x4543f1)){_0x1cfc98['or'](_0xde14('0x94'),_0x4543f1+'%');}else{_0x1cfc98['or'](_0xde14('0x95'),qs[_0xde14('0x78')](_0x4543f1))['or'](_0xde14('0x96'),_0x4543f1+'%');}}}_0x4dbeaf['where'](_0x1cfc98);_0x4dbeaf[_0xde14('0x97')](_0xde14('0x98'));var _0x1db63e={'type':db['Sequelize'][_0xde14('0x99')][_0xde14('0x9a')],'raw':!![]};var _0x411b4f=_0x4dbeaf['clone']();_0x411b4f[_0xde14('0x5b')](_0xde14('0x98'));_0x411b4f[_0xde14('0x5b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xe3669c['order']){_0xe3669c['order'][_0xde14('0x3d')](function(_0x1ce32f){var _0x54ff4c=_0x1ce32f[0x0]===_0xde14('0x9b')?_0x1ce32f[0x0]:'i.'+_0x1ce32f[0x0];_0x4dbeaf[_0xde14('0x56')](_0x54ff4c,_0x1ce32f[0x1]===_0xde14('0x9c')?![]:!![]);});}if(!_[_0xde14('0x83')](_0x524e98)){_0x4dbeaf[_0xde14('0x71')](_0x2bd32d);_0x411b4f['where'](_0xde14('0x9d'),_0x524e98);}BPromise[_0xde14('0x9e')]()[_0xde14('0x2d')](function(){if(!_0xc98b34){if(_0x4f1b43[_0xde14('0x4d')][_0xde14('0x9f')])return;_0x411b4f[_0xde14('0x58')](_0xde14('0xa0'));_0x4dbeaf[_0xde14('0x58')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x4f1b43[_0xde14('0xa1')][_0xde14('0xa2')]!==_0xde14('0xa3'))return;return _0x4f1b43[_0xde14('0xa1')][_0xde14('0xa4')]({'attributes':['id'],'raw':!![]})[_0xde14('0x2d')](function(_0x4fb108){if(_[_0xde14('0x83')](_0x4fb108)){_0x411b4f['where'](_0xde14('0xa5'));_0x4dbeaf[_0xde14('0x58')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x411b4f[_0xde14('0x58')](_0xde14('0x84'),_[_0xde14('0x39')](_0x4fb108,'id'));_0x4dbeaf[_0xde14('0x58')](_0xde14('0x84'),_[_0xde14('0x39')](_0x4fb108,'id'));}});})[_0xde14('0x2d')](function(){if(_0x4f1b43[_0xde14('0xa1')][_0xde14('0xa2')]===_0xde14('0xa3')&&!_0xc98b34&&!_0x4f1b43[_0xde14('0x4d')][_0xde14('0x9f')])return[];return db[_0xde14('0xa6')]['query'](_0x411b4f['toString'](),_0x1db63e);})[_0xde14('0x2d')](function(_0x9f6dad){_0x4b1ef7['count']=_0x9f6dad[_0xde14('0x52')];if(_0x4b1ef7[_0xde14('0x29')]===0x0)return[];return db[_0xde14('0xa6')][_0xde14('0x4d')](_0x56c3fe[_0xde14('0xa7')](),_0x1db63e)[_0xde14('0x2d')](function(_0x2eb881){_0x435964=_[_0xde14('0xa8')](_0x2eb881,'id');_0x1db63e=_[_0xde14('0x33')](_0x1db63e,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f1b43['query'][_0xde14('0x51')]){_0xe3669c[_0xde14('0x50')]['forEach'](function(_0x17b40c){_0x4dbeaf[_0xde14('0x5b')]('i.'+_0x17b40c);});}else{_0x4dbeaf['field'](_0xde14('0xa9'),_0xde14('0x70'));_0x4dbeaf['field'](_0xde14('0xaa'),'Account.key');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xab'),_0xde14('0xac'));_0x4dbeaf[_0xde14('0x5b')]('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',_0xde14('0x9b'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xad'));_0x4dbeaf['field'](_0xde14('0xae'),_0xde14('0xaf'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb0'),'Contact.lastName');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb1'),'Contact.email');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb2'),_0xde14('0xb3'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb4'),_0xde14('0xb5'));_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb6'),'Contact.fax');_0x4dbeaf[_0xde14('0x5b')](_0xde14('0xb7'),_0xde14('0xb8'));_0x4dbeaf[_0xde14('0x5b')]('o.internal','Owner.internal');_0x4dbeaf['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xde14('0x3a'));}if(_0xe3669c[_0xde14('0x55')])_0x4dbeaf[_0xde14('0x55')](_0xe3669c['limit']);if(_0xe3669c['offset'])_0x4dbeaf[_0xde14('0x27')](_0xe3669c['offset']);return db['sequelize']['query'](_0x4dbeaf['toString'](),_0x1db63e);})[_0xde14('0x2d')](function(_0x54fbea){if(_0x54fbea['length']>0x0)_0x423adc['where']('ui.ChatInteractionId\x20IN\x20?',_[_0xde14('0x39')](_0x54fbea,'id'));return db[_0xde14('0xa6')][_0xde14('0x4d')](_0x423adc[_0xde14('0xa7')](),_0x1db63e)[_0xde14('0x2d')](function(_0x35dcce){var _0x4f7484=_[_0xde14('0xb9')](_0x35dcce,_0xde14('0xba'));var _0x63f985=[];_0x54fbea[_0xde14('0x3d')](function(_0x4648f7){_0x63f985[_0xde14('0xbb')](updateChatInteraction(_0x4648f7,_0x435964,_0x4f7484));});return BPromise[_0xde14('0xbc')](_0x63f985);});});})[_0xde14('0x2d')](function(_0x84794b){_0x4b1ef7[_0xde14('0xbd')]=_0x84794b;return _0x4b1ef7;})[_0xde14('0x2d')](respondWithFilteredResult(_0x15859c,_0xe3669c))[_0xde14('0x22')](handleError(_0x15859c,null));};exports[_0xde14('0xbe')]=function(_0xf16def,_0x22ea84){var _0x5b1473={'raw':![],'where':{'id':_0xf16def[_0xde14('0xbf')]['id']}},_0x14fd13={};_0x14fd13[_0xde14('0x4c')]=_[_0xde14('0xc0')](db[_0xde14('0x48')][_0xde14('0x49')]);_0x14fd13['query']=_[_0xde14('0xc0')](_0xf16def[_0xde14('0x4d')]);_0x14fd13[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x14fd13['model'],_0x14fd13['query']);_0x5b1473['attributes']=_[_0xde14('0x4f')](_0x14fd13[_0xde14('0x4c')],qs[_0xde14('0x51')](_0xf16def[_0xde14('0x4d')][_0xde14('0x51')]));_0x5b1473[_0xde14('0x50')]=_0x5b1473[_0xde14('0x50')][_0xde14('0x52')]?_0x5b1473[_0xde14('0x50')]:_0x14fd13[_0xde14('0x4c')];if(_0xf16def[_0xde14('0x4d')][_0xde14('0xc1')]){_0x5b1473[_0xde14('0xc2')]=[{'all':!![]}];}_0x5b1473=_[_0xde14('0x33')]({},_0x5b1473,_0xf16def[_0xde14('0xc3')]);return db[_0xde14('0x48')][_0xde14('0x7a')](_0x5b1473)[_0xde14('0x2d')](handleEntityNotFound(_0x22ea84,null))['then'](respondWithResult(_0x22ea84,null))[_0xde14('0x22')](handleError(_0x22ea84,null));};exports['create']=function(_0x48c0c3,_0x56a9d0){return db['ChatInteraction'][_0xde14('0xc4')](_0x48c0c3[_0xde14('0x34')],{})['then'](respondWithResult(_0x56a9d0,0xc9))[_0xde14('0x22')](handleError(_0x56a9d0,null));};exports['update']=function(_0x153fff,_0x32f18c){if(_0x153fff['body']['id']){delete _0x153fff[_0xde14('0x34')]['id'];}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x153fff[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x32f18c,null))[_0xde14('0x2d')](saveUpdates(_0x153fff[_0xde14('0x34')],null))[_0xde14('0x2d')](respondWithResult(_0x32f18c,null))[_0xde14('0x22')](handleError(_0x32f18c,null));};exports[_0xde14('0x2e')]=function(_0x271f5e,_0x15b4ef){return db['ChatInteraction'][_0xde14('0x7a')]({'where':{'id':_0x271f5e['params']['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x15b4ef,null))[_0xde14('0x2d')](removeEntity(_0x15b4ef,null))[_0xde14('0x22')](handleError(_0x15b4ef,null));};exports['describe']=function(_0x3d9ff9,_0x4a6501){return db[_0xde14('0x48')]['describe']()[_0xde14('0x2d')](respondWithResult(_0x4a6501,null))[_0xde14('0x22')](handleError(_0x4a6501,null));};exports[_0xde14('0xc5')]=function(_0x479caa,_0x5628db){var _0x4f90b0=_0x479caa[_0xde14('0xbf')]['id'];var _0x18ba4b;var _0x44d0ad;var _0x29aed6;return db['ChatInteraction'][_0xde14('0xc6')]({'where':{'id':_0x4f90b0}})[_0xde14('0x2d')](function(_0x56dc1f){_0x18ba4b=_0x56dc1f;return db[_0xde14('0xc7')][_0xde14('0xc6')]({'where':{'id':_0x56dc1f[_0xde14('0x9f')]},'attributes':['id',_0xde14('0xc8'),_0xde14('0xc9'),_0xde14('0xca'),_0xde14('0xcb'),_0xde14('0xcc')],'raw':!![]});})[_0xde14('0x2d')](function(_0xfbc3cc){if(_0xfbc3cc&&_0xfbc3cc[_0xde14('0xc8')]&&_0xfbc3cc[_0xde14('0xc9')]){_0x44d0ad=_0xfbc3cc;var _0x5d8883={'interaction':{'id':_0x4f90b0},'agent':{'id':_0x479caa[_0xde14('0xa1')]['id'],'name':_0x479caa['user'][_0xde14('0x30')],'fullname':_0x479caa[_0xde14('0xa1')]['fullname'],'email':_0x479caa['user'][_0xde14('0xcd')]},'contact':_0x479caa[_0xde14('0x34')][_0xde14('0x35')],'account':_0x479caa[_0xde14('0x34')][_0xde14('0x37')]};var _0x613120={'rejectUnauthorized':![],'method':_0xde14('0xce'),'url':_0xde14('0xcf'),'headers':{'X-APIKEY':_0xfbc3cc['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x479caa[_0xde14('0xa1')][_0xde14('0xcd')]],'buttons':null,'topic':_0x44d0ad[_0xde14('0xca')],'note':_[_0xde14('0xd0')](_0x44d0ad[_0xde14('0xcb')])?null:getMustacheRender(_0x44d0ad['vidaooNote'],_0x5d8883),'metadata':null},'redirect':_0xde14('0xd1'),'json':!![]};try{if(!_[_0xde14('0xd0')](_0x44d0ad[_0xde14('0xcc')])){var _0xd83ac6=getMustacheRender(_0x44d0ad[_0xde14('0xcc')],_0x5d8883);var _0x3a369a=JSON[_0xde14('0x86')](_0xd83ac6);_0x613120[_0xde14('0x34')][_0xde14('0xd2')]=_0x3a369a;}}catch(_0x3af55d){throw new db[(_0xde14('0xd3'))]['ValidationError'](_0xde14('0xd4'));}return rp(_0x613120);}else{throw new db[(_0xde14('0xd3'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xde14('0x2d')](function(_0x31ebdd){_0x29aed6=_0x31ebdd;if(_0x29aed6['id']){var _0x428a64={'body':_0x29aed6[_0xde14('0xd5')],'ChatWebsiteId':_0x44d0ad['id'],'ChatInteractionId':_0x18ba4b['id'],'direction':_0xde14('0xd6'),'UserId':_0x479caa['user']['id']};return db[_0xde14('0xd7')][_0xde14('0xc4')](_0x428a64,{});}else{throw new db[(_0xde14('0xd3'))][(_0xde14('0xd8'))](_0xde14('0xd9'));}})[_0xde14('0x2d')](function(){return _0x18ba4b[_0xde14('0xda')]({'vidaooSessionId':_0x29aed6['id']});})[_0xde14('0x2d')](respondWithResult(_0x5628db,null))[_0xde14('0x22')](handleError(_0x5628db,null));};exports[_0xde14('0xdb')]=function(_0x449748,_0x331c0f){if(_0x449748[_0xde14('0x34')]['id']){delete _0x449748[_0xde14('0x34')]['id'];}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x449748[_0xde14('0xbf')]['id']},'include':[{'model':db[_0xde14('0xdc')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x331c0f,null))[_0xde14('0x2d')](saveUpdates(_0x449748[_0xde14('0x34')],null))['then'](respondWithResult(_0x331c0f,null))[_0xde14('0x22')](handleError(_0x331c0f,null));};exports['abandon']=function(_0x593e49,_0x42c858){if(_0x593e49['body']['id']){delete _0x593e49[_0xde14('0x34')]['id'];}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x593e49[_0xde14('0xbf')]['id']}})['then'](function(_0x34d9fe){if(!_0x34d9fe){logger[_0xde14('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x42c858[_0xde14('0x23')](0x194);}else{if(_0x34d9fe[_0xde14('0x44')]){throw new db[(_0xde14('0xd3'))]['ValidationError'](_0xde14('0xdd'));}}return _0x34d9fe;})[_0xde14('0x2d')](function(_0x4a83c2){if(_0x4a83c2){return _0x4a83c2[_0xde14('0x2c')]({'closed':_0x593e49['body'][_0xde14('0x43')],'disposition':_0x593e49['body'][_0xde14('0x45')]})[_0xde14('0x2d')](function(_0x397686){return _0x397686;});}})['then'](function(){return respondWithRpcPromise(_0xde14('0xde'),_0xde14('0xdf'),_0x593e49[_0xde14('0x34')],client9004);})['then'](respondWithResult(_0x42c858,null))[_0xde14('0x22')](handleError(_0x42c858,null));};exports['attachmentUpload']=function(_0xcb4fe6,_0x3ccccb){_0xcb4fe6[_0xde14('0x34')][_0xde14('0x30')]=_0xcb4fe6['file'][_0xde14('0xe0')];_0xcb4fe6[_0xde14('0x34')][_0xde14('0xe1')]=_0xcb4fe6[_0xde14('0xe2')][_0xde14('0xe3')];_0xcb4fe6[_0xde14('0x34')][_0xde14('0x4b')]=_0xcb4fe6[_0xde14('0xe2')][_0xde14('0xe4')];return db[_0xde14('0xe5')]['create'](_0xcb4fe6[_0xde14('0x34')])[_0xde14('0x2d')](respondWithResult(_0x3ccccb,0xc9))[_0xde14('0x22')](handleError(_0x3ccccb,null));};exports[_0xde14('0xe6')]=function(_0x1d3c21,_0x375d5b){return db['ChatInteraction'][_0xde14('0xc6')]({'where':{'id':_0x1d3c21[_0xde14('0xbf')]['id']},'raw':!![]})[_0xde14('0x2d')](handleEntityNotFound(_0x375d5b,null))[_0xde14('0x2d')](function(_0x5228b9){if(_0x5228b9){if(_0x5228b9[_0xde14('0x43')]){return _0x375d5b[_0xde14('0x24')](0x193)[_0xde14('0x26')]({'status':0x193,'message':_0xde14('0xe7')});}return db[_0xde14('0xe5')][_0xde14('0xc6')]({'where':{'id':_0x1d3c21[_0xde14('0x4d')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x375d5b,null));}})['then'](function(_0x55ee6e){if(_0x55ee6e){var _0x244778=_0x55ee6e[_0xde14('0xe8')]!==null;var _0x36edcc=path[_0xde14('0xe9')](config[_0xde14('0xea')],_0xde14('0xeb'));if(_0x244778){_0x36edcc=path[_0xde14('0xe9')](_0x36edcc,_0xde14('0xec'));}var _0x61812c=path[_0xde14('0xe9')](_0x36edcc,_0x55ee6e[_0xde14('0xe1')]);return _0x375d5b[_0xde14('0xed')](_0x61812c);}})[_0xde14('0x22')](handleError(_0x375d5b,null));};exports[_0xde14('0xee')]=function(_0x324389,_0xc4e7e8){var _0x4c8ddd=null;var _0x973b9f=null;var _0xe7729a=null;if(_0x324389[_0xde14('0x34')]['id']){delete _0x324389[_0xde14('0x34')]['id'];}if(_0x324389[_0xde14('0x34')][_0xde14('0xef')]){_0xe7729a=path[_0xde14('0xe9')](config['root'],'server/files/chat/upload/',util['format'](_0xde14('0xf0'),Date[_0xde14('0xf1')]()));_0x324389[_0xde14('0x34')][_0xde14('0xf2')]=_0xe7729a;}return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x324389[_0xde14('0xbf')]['id']},'include':[{'model':db[_0xde14('0xd7')],'as':_0xde14('0xf3'),'include':[{'model':db[_0xde14('0x81')],'as':_0xde14('0x81')}]}]})[_0xde14('0x2d')](handleEntityNotFound(_0xc4e7e8,null))[_0xde14('0x2d')](saveUpdates(_0x324389[_0xde14('0x34')],null))[_0xde14('0x2d')](function(_0x2a8fcb){if(_0x2a8fcb){_0x4c8ddd=_0x2a8fcb;return db['ChatWebsite']['find']({'where':{'id':_0x4c8ddd['ChatWebsiteId']}});}})[_0xde14('0x2d')](function(_0x84a4a9){if(_0x84a4a9){_0x973b9f=_0x84a4a9;return db[_0xde14('0xdc')]['find']({'where':{'id':_0x4c8ddd[_0xde14('0x7b')]}});}})[_0xde14('0x2d')](function(_0x4d3be2){if(_0x4d3be2){if(_0xe7729a){var _0x2f3517=null;for(var _0x4518cf=0x1;_0x4518cf<_0x4c8ddd[_0xde14('0xf3')][_0xde14('0x52')];++_0x4518cf){_0x2f3517=_0x4c8ddd[_0xde14('0xf3')][_0x4518cf];var _0x55de57=_0x2f3517[_0xde14('0x44')]?util[_0xde14('0xf4')](_0xde14('0xf5'),_0x973b9f[_0xde14('0xf6')],_0x2f3517[_0xde14('0x44')]):_0xde14('0xf7');var _0x221413=_0x324389[_0xde14('0x34')][_0xde14('0xf8')]||util[_0xde14('0xf4')](_0xde14('0xf5'),'Visitor',_0x2f3517[_0xde14('0x7b')]);switch(_0x973b9f[_0xde14('0xf9')]){case'website_alias':_0x55de57=_0x2f3517[_0xde14('0x44')]?util['format'](_0xde14('0xf5'),_0x973b9f['agentAlias'],_0x2f3517[_0xde14('0x44')]):'System';break;case'agent_alias':_0x55de57=_0x2f3517[_0xde14('0x44')]?_0x2f3517[_0xde14('0x81')][_0xde14('0xfa')]||_0x2f3517[_0xde14('0x81')][_0xde14('0xfb')]:_0xde14('0xf7');break;case _0xde14('0xfc'):_0x55de57=_0x2f3517['UserId']?_0x2f3517['User'][_0xde14('0xfb')]:'System';break;default:_0x55de57=_0x2f3517[_0xde14('0x44')]?util[_0xde14('0xf4')]('%s%d',_0x973b9f['agentAlias'],_0x2f3517[_0xde14('0x44')]):'System';}var _0x32ea6f=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x2f3517[_0xde14('0x85')])['format'](_0xde14('0xfd')),_0x2f3517[_0xde14('0xfe')]==='in'?_0x221413:_0x55de57,_0x2f3517[_0xde14('0x34')]);if(!_0x2f3517[_0xde14('0xff')]){fs[_0xde14('0x100')](_0xe7729a,_0x32ea6f);}}return db[_0xde14('0x101')][_0xde14('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0xde14('0x102')],'as':_0xde14('0x103'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xde14('0x104'),'raw':!![]}]}]});}}})['then'](function(_0x46e6c8){if(!_0x46e6c8||!_0x46e6c8[_0xde14('0x103')]||!_0x324389[_0xde14('0x34')])return _0x4c8ddd;var _0xaa98a1=_0x46e6c8[_0xde14('0x105')]();return respondWithRpcPromise(_0xde14('0x106'),_0xde14('0x107'),{'account':_0xaa98a1,'message':{'from':util[_0xde14('0xf4')]('\x22%s\x22\x20<%s>',_0x46e6c8[_0xde14('0x30')],_0x46e6c8[_0xde14('0xcd')]||_0x46e6c8['Smtp'][_0xde14('0xa1')]),'to':_0x324389[_0xde14('0x34')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xde14('0xf4')](_0xde14('0x108'),_0x324389[_0xde14('0x34')][_0xde14('0xef')]),'attachments':[{'path':_0xe7729a}]}})[_0xde14('0x2d')](function(){return _0x4c8ddd;})[_0xde14('0x22')](function(_0x5680d4){logger[_0xde14('0x1e')](_0x5680d4);});})[_0xde14('0x2d')](respondWithStatusCode(_0xc4e7e8,0xc8))[_0xde14('0x22')](handleError(_0xc4e7e8,null));};exports[_0xde14('0x109')]=function(_0x20ad12,_0x2eccf5){return db['ChatMessage']['find']({'where':{'id':_0x20ad12[_0xde14('0xbf')]['id']}})['then'](handleEntityNotFound(_0x2eccf5,null))[_0xde14('0x2d')](function(_0x1b39cf){if(_0x1b39cf){return _0x1b39cf[_0xde14('0x109')](_0x20ad12[_0xde14('0x34')][_0xde14('0x10a')],_[_0xde14('0x10b')](_0x20ad12[_0xde14('0x34')],[_0xde14('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x2eccf5,null))[_0xde14('0x22')](handleError(_0x2eccf5,null));};exports[_0xde14('0x10c')]=function(_0x14b2ee,_0x3b90ff){var _0x3d5fd1={'raw':![],'where':{}};var _0x2a0d68={};var _0x16fb18={'count':0x0,'rows':[]};return db[_0xde14('0x48')][_0xde14('0xc6')]({'where':{'id':_0x14b2ee[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x3b90ff,null))[_0xde14('0x2d')](function(_0x4f0a67){if(_0x4f0a67){_0x2a0d68[_0xde14('0x4c')]=_['keys'](db[_0xde14('0xd7')][_0xde14('0x49')]);_0x2a0d68['query']=_['keys'](_0x14b2ee[_0xde14('0x4d')]);_0x2a0d68[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x2a0d68[_0xde14('0x4c')],_0x2a0d68[_0xde14('0x4d')]);_0x3d5fd1[_0xde14('0x50')]=_[_0xde14('0x4f')](_0x2a0d68[_0xde14('0x4c')],qs[_0xde14('0x51')](_0x14b2ee['query'][_0xde14('0x51')]));_0x3d5fd1['attributes']=_0x3d5fd1[_0xde14('0x50')][_0xde14('0x52')]?_0x3d5fd1[_0xde14('0x50')]:_0x2a0d68[_0xde14('0x4c')];if(!_0x14b2ee[_0xde14('0x4d')][_0xde14('0x53')]('nolimit')){_0x3d5fd1[_0xde14('0x55')]=qs[_0xde14('0x55')](_0x14b2ee[_0xde14('0x4d')][_0xde14('0x55')]);_0x3d5fd1[_0xde14('0x27')]=qs['offset'](_0x14b2ee[_0xde14('0x4d')]['offset']);}_0x3d5fd1['order']=qs[_0xde14('0x57')](_0x14b2ee['query']['sort']);_0x3d5fd1[_0xde14('0x58')]=qs['filters'](_['pick'](_0x14b2ee[_0xde14('0x4d')],_0x2a0d68['filters']));_0x3d5fd1[_0xde14('0x58')][_0xde14('0xba')]=_0x4f0a67['id'];if(_0x14b2ee[_0xde14('0x4d')][_0xde14('0x91')]){_0x3d5fd1[_0xde14('0x58')]=_['merge'](_0x3d5fd1[_0xde14('0x58')],{'$or':_[_0xde14('0x39')](_0x3d5fd1[_0xde14('0x50')],function(_0x57d83d){var _0x59640c={};_0x59640c[_0x57d83d]={'$like':'%'+_0x14b2ee['query']['filter']+'%'};return _0x59640c;})});}if(_0x14b2ee[_0xde14('0x4d')][_0xde14('0x87')]){var _0x38c682=_0x14b2ee['query'][_0xde14('0x87')][_0xde14('0x3c')](',');var _0x5dea0c={};_0x5dea0c[_0x38c682[0x0]]={'$gte':moment(_0x38c682[0x1])['format'](_0xde14('0x10d'))};_0x3d5fd1[_0xde14('0x58')]=_[_0xde14('0x33')](_0x3d5fd1[_0xde14('0x58')],_0x5dea0c);}_0x3d5fd1=_[_0xde14('0x33')]({},_0x3d5fd1,_0x14b2ee[_0xde14('0xc3')]);return db[_0xde14('0xd7')]['count']({'where':_0x3d5fd1[_0xde14('0x58')]})[_0xde14('0x2d')](function(_0x4a6b57){_0x16fb18['count']=_0x4a6b57;if(_0x14b2ee[_0xde14('0x4d')][_0xde14('0xc1')]){_0x3d5fd1[_0xde14('0xc2')]=[{'all':!![]}];}return db['ChatMessage'][_0xde14('0x10e')](_0x3d5fd1);})[_0xde14('0x2d')](function(_0x875097){_0x16fb18[_0xde14('0xbd')]=_0x875097;return _0x16fb18;});}})[_0xde14('0x2d')](respondWithFilteredResult(_0x3b90ff,_0x3d5fd1))[_0xde14('0x22')](handleError(_0x3b90ff,null));};exports[_0xde14('0x10f')]=function(_0x5af548,_0x138f17){var _0x376c6f={'where':{}},_0x29e276={},_0x4c98cc={'count':0x0,'rows':[]};return db[_0xde14('0x48')][_0xde14('0xc6')]({'where':{'id':_0x5af548[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x138f17,null))[_0xde14('0x2d')](function(_0x7100cd){if(_0x7100cd){_0x29e276[_0xde14('0x4c')]=_[_0xde14('0xc0')](db[_0xde14('0xd7')][_0xde14('0x49')]);_0x29e276[_0xde14('0x4d')]=_['keys'](_0x5af548[_0xde14('0x4d')]);_0x29e276[_0xde14('0x4e')]=_[_0xde14('0x4f')](_0x29e276[_0xde14('0x4c')],_0x29e276[_0xde14('0x4d')]);_0x376c6f[_0xde14('0x50')]=_[_0xde14('0x4f')](_0x29e276[_0xde14('0x4c')],qs[_0xde14('0x51')](_0x5af548[_0xde14('0x4d')]['fields']));_0x376c6f[_0xde14('0x50')]=_0x376c6f['attributes']['length']?_0x376c6f[_0xde14('0x50')]:_0x29e276['model'];if(!_0x5af548[_0xde14('0x4d')][_0xde14('0x53')](_0xde14('0x54'))){_0x376c6f[_0xde14('0x55')]=qs[_0xde14('0x55')](_0x5af548[_0xde14('0x4d')]['limit']);_0x376c6f[_0xde14('0x27')]=qs['offset'](_0x5af548['query'][_0xde14('0x27')]);}_0x376c6f['order']=qs[_0xde14('0x57')](_0x5af548[_0xde14('0x4d')][_0xde14('0x57')]);_0x376c6f[_0xde14('0x58')]=qs[_0xde14('0x4e')](_[_0xde14('0x59')](_0x5af548[_0xde14('0x4d')],_0x29e276[_0xde14('0x4e')]));_0x376c6f['where'][_0xde14('0xba')]=_0x7100cd['id'];if(_0x5af548['query'][_0xde14('0x91')]){_0x376c6f[_0xde14('0x58')]=_[_0xde14('0x33')](_0x376c6f[_0xde14('0x58')],{'$or':_[_0xde14('0x39')](_0x376c6f[_0xde14('0x50')],function(_0x27732d){var _0x4ef9e4={};_0x4ef9e4[_0x27732d]={'$like':'%'+_0x5af548[_0xde14('0x4d')][_0xde14('0x91')]+'%'};return _0x4ef9e4;})});}_0x376c6f[_0xde14('0x58')]['secret']=![];if(_0x5af548[_0xde14('0x4d')]['id']){_0x376c6f['where']['id']={'$gt':_0x5af548['query']['id']};}_0x376c6f=_[_0xde14('0x33')]({},_0x376c6f,_0x5af548[_0xde14('0xc3')]);return db[_0xde14('0xd7')][_0xde14('0x29')]({'where':_0x376c6f[_0xde14('0x58')]})[_0xde14('0x2d')](function(_0x37b21d){_0x4c98cc[_0xde14('0x29')]=_0x37b21d;_0x376c6f['include']=[];if(_0x5af548[_0xde14('0x4d')][_0xde14('0x110')]){_0x376c6f['include'][_0xde14('0xbb')]({'model':db[_0xde14('0x81')],'as':'User','attributes':['id',_0xde14('0xfb'),_0xde14('0xfa')]});}if(_0x5af548[_0xde14('0x4d')][_0xde14('0xc1')]){_0x376c6f['include']=[{'all':!![]}];}return db[_0xde14('0xd7')][_0xde14('0x10e')](_0x376c6f);})[_0xde14('0x2d')](function(_0x2fcf14){_0x4c98cc[_0xde14('0xbd')]=_0x2fcf14;return _0x4c98cc;});}})['then'](respondWithFilteredResult(_0x138f17,_0x376c6f))[_0xde14('0x22')](handleError(_0x138f17,null));};exports['addTags']=function(_0x46ccbf,_0x46bb44){return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x46ccbf[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x46bb44,null))[_0xde14('0x2d')](function(_0x4ca1a7){if(_0x4ca1a7){return _0x4ca1a7[_0xde14('0x111')](_0x46ccbf[_0xde14('0x34')]['ids'],_[_0xde14('0x10b')](_0x46ccbf['body'],['ids','id'])||{})[_0xde14('0x112')](function(){return db['Tag']['findAll']({'attributes':['id',_0xde14('0x30'),_0xde14('0x5c')],'where':{'id':_0x46ccbf['body'][_0xde14('0x10a')]}});})[_0xde14('0x2d')](function(_0x433728){socket[_0xde14('0x113')](_0xde14('0x114'),{'id':Number(_0x46ccbf['params']['id']),'tags':_0x433728||[]});return{'id':Number(_0x46ccbf['params']['id']),'tags':_0x433728||[]};});}})[_0xde14('0x2d')](respondWithResult(_0x46bb44,null))[_0xde14('0x22')](handleError(_0x46bb44,null));};exports[_0xde14('0x115')]=function(_0x5a9161,_0x53e0c2){return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x5a9161[_0xde14('0xbf')]['id']}})[_0xde14('0x2d')](handleEntityNotFound(_0x53e0c2,null))['then'](function(_0x533318){if(_0x533318){return _0x533318[_0xde14('0x115')](_0x5a9161[_0xde14('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x53e0c2,null))[_0xde14('0x22')](handleError(_0x53e0c2,null));};exports['download']=function(_0x546b0f,_0x946d49){var _0x3d87e5=moment()['unix']()[_0xde14('0xa7')]();var _0x113d3b=path[_0xde14('0xe9')](config[_0xde14('0xea')],_0xde14('0x116'),_0xde14('0x117'),_0xde14('0x118'));var _0x8e1358=path[_0xde14('0xe9')](config[_0xde14('0xea')],_0xde14('0x116'),_0xde14('0x117'),'attachments');var _0x2513d8=path[_0xde14('0xe9')](_0x113d3b,_0x3d87e5);var _0x5edfa1=util[_0xde14('0xf4')](_0xde14('0x119'),_0x546b0f[_0xde14('0xbf')]['id'],_0x3d87e5);var _0x5a703d=path[_0xde14('0xe9')](_0x113d3b,_0x5edfa1);var _0xbd95d7=[];_0xbd95d7['push']({'model':db[_0xde14('0x81')],'as':_0xde14('0x81'),'attributes':['id',_0xde14('0xfb')],'raw':!![]});_0xbd95d7[_0xde14('0xbb')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xde14('0x11a'),_0xde14('0x11b')],'raw':!![]});if(_0x546b0f[_0xde14('0x4d')][_0xde14('0x11c')]){_0xbd95d7[_0xde14('0xbb')]({'model':db[_0xde14('0xe5')],'as':_0xde14('0xe5'),'raw':!![]});}var _0x3e34af=[{'model':db[_0xde14('0xd7')],'as':_0xde14('0xf3'),'attributes':['id',_0xde14('0x34'),_0xde14('0x85'),'direction',_0xde14('0xff'),'read'],'include':_0xbd95d7}];_0x3e34af[_0xde14('0xbb')]({'model':db['ChatWebsite'],'as':_0xde14('0x11d'),'attributes':['id',_0xde14('0x30')]});_0x3e34af[_0xde14('0xbb')]({'model':db[_0xde14('0x81')],'as':_0xde14('0x11e'),'attributes':['id',_0xde14('0xfb')]});return db[_0xde14('0x48')][_0xde14('0x7a')]({'where':{'id':_0x546b0f[_0xde14('0xbf')]['id']},'include':_0x3e34af})[_0xde14('0x2d')](handleEntityNotFound(_0x946d49,null))[_0xde14('0x2d')](function(_0x84dba9){if(_0x84dba9){var _0x49085d=_0x84dba9[_0xde14('0x11f')]({'plain':!![]});fs[_0xde14('0x120')](_0x2513d8);var _0x569df7={'channel':_0xde14('0x121'),'account':_0x49085d['Account']['name'],'agent':_0x49085d[_0xde14('0x11e')]?_0x49085d[_0xde14('0x11e')][_0xde14('0xfb')]:_0xde14('0x122'),'createdAt':moment(_0x49085d[_0xde14('0x85')])[_0xde14('0xf4')](_0xde14('0x10d'))[_0xde14('0xa7')](),'closedAt':_0x49085d[_0xde14('0x43')]?moment(_0x49085d[_0xde14('0x123')])[_0xde14('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde14('0xa7')]():'','disposition':_0x49085d[_0xde14('0x45')],'chatInfo':{'browser':_0x49085d['browserName'],'os':_0x49085d['osName'],'referer':_0x49085d[_0xde14('0x124')],'customerIp':_0x49085d['customerIp'],'customerPort':_0x49085d['customerPort']?_0x49085d[_0xde14('0x125')]:_0xde14('0x122')},'messages':_(_0x49085d[_0xde14('0xf3')])[_0xde14('0x126')]()[_0xde14('0x91')]({'secret':![]})[_0xde14('0x39')](function(_0x3f2779){if(_0x3f2779[_0xde14('0xe5')]){var _0x1d93f7=path[_0xde14('0xe9')](_0x8e1358,_0x3f2779['Attachment'][_0xde14('0xe1')]);if(fs[_0xde14('0x127')](_0x1d93f7)){fs[_0xde14('0x128')](_0x1d93f7)['pipe'](fs[_0xde14('0x129')](path[_0xde14('0xe9')](_0x2513d8,_0x3f2779[_0xde14('0xe5')][_0xde14('0xe1')])));}}return{'date':moment(_0x3f2779[_0xde14('0x85')])[_0xde14('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde14('0xa7')](),'sender':_0x3f2779[_0xde14('0xfe')]==='out'?_0x3f2779[_0xde14('0x81')]?_0x3f2779['User'][_0xde14('0xfb')]:_0xde14('0xf7'):_0x3f2779[_0xde14('0x73')][_0xde14('0x11a')]+(_0x3f2779[_0xde14('0x73')][_0xde14('0x11b')]?'\x20'+_0x3f2779[_0xde14('0x73')][_0xde14('0x11b')]:''),'body':_0x3f2779[_0xde14('0xe5')]?_0x3f2779[_0xde14('0xe5')]['basename']:_0x3f2779[_0xde14('0x34')],'direction':_0x3f2779['direction']==='out'?'A':'C','secret':_0x3f2779[_0xde14('0xff')],'read':_0x3f2779[_0xde14('0x8c')],'attachment':_0x3f2779['Attachment']};})[_0xde14('0x76')]()};return ejs[_0xde14('0x12a')](path['join'](config[_0xde14('0xea')],_0xde14('0x116'),'views',_0xde14('0x12b')),{'interaction':_0x569df7})[_0xde14('0x2d')](function(_0x568c6d){var _0x4ad0ad=path[_0xde14('0xe9')](_0x2513d8,'transcript-'+_0x49085d['id']+'-'+_0x3d87e5+'.pdf');var _0x168874={'path':_0x4ad0ad,'channel':_0xde14('0x121'),'interactionId':_0x49085d['id']};return pdf[_0xde14('0x12c')](_0x568c6d,_0x168874);})[_0xde14('0x2d')](function(){return new Promise(function(_0x23a7d3,_0x4531b0){zipdir(_0x2513d8,{'saveTo':_0x5a703d},function(_0xb4684f,_0x322641){if(_0xb4684f)return _0x4531b0(_0xb4684f);return _0x23a7d3(_0x322641);});})[_0xde14('0x2d')](function(){return new BPromise(function(_0x4bbbd8,_0xac6cf){rimraf(_0x2513d8,function(_0xd7c682){if(_0xd7c682)_0xac6cf(_0xd7c682);return _0x4bbbd8();});});})[_0xde14('0x2d')](function(){return _0x946d49[_0xde14('0xed')](_0x5a703d,_0x5edfa1,function(_0x3a3dca){if(_0x3a3dca){logger[_0xde14('0x1e')](_0xde14('0x12d'),_0x3a3dca);}else{fs[_0xde14('0x12e')](_0x5a703d);}});});});}else{return _0x946d49['sendStatus'](0xc8);}})['catch'](handleError(_0x946d49,null));}; \ No newline at end of file +var _0xedd9=['account','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','abandoned','closed','UserId','disposition','unmanaged','total','index','ChatInteraction','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','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','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','contactName','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','user','role','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','createVidaooSession','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','Attachment','Unauthorized','attachId','root','server/files/attachments/','offline-chat/','join','download','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','alias','setTags','spread','findAll','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Owner','get','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerPort','tail','basename','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','result','message','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','name','send','render','merge','body','contact','agent','interaction'];(function(_0xe32763,_0x528640){var _0x382d75=function(_0x4aab7e){while(--_0x4aab7e){_0xe32763['push'](_0xe32763['shift']());}};_0x382d75(++_0x528640);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a6a37,_0x30743f){_0x3a6a37=_0x3a6a37-0x0;var _0xd802a8=_0xedd9[_0x3a6a37];return _0xd802a8;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9edd('0x0'));var rp=require(_0x9edd('0x1'));var moment=require(_0x9edd('0x2'));var BPromise=require(_0x9edd('0x3'));var Mustache=require(_0x9edd('0x4'));var util=require(_0x9edd('0x5'));var path=require(_0x9edd('0x6'));var ejs=require(_0x9edd('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0x8'));var Redis=require(_0x9edd('0x9'));var qs=require(_0x9edd('0xa'));var as=require(_0x9edd('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0x9edd('0xc'))('api');var config=require(_0x9edd('0xd'));var db=require(_0x9edd('0xe'))['db'];config[_0x9edd('0xf')]=_[_0x9edd('0x10')](config['redis'],{'host':_0x9edd('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x12'))['register'](socket);var jayson=require(_0x9edd('0x13'));var client=jayson[_0x9edd('0x14')]['http']({'port':0x232b});var client9004=jayson[_0x9edd('0x14')][_0x9edd('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x25e64c,_0xfd544a,_0x287ddd,_0x3a7b84){return new BPromise(function(_0xfca576,_0xef5498){var _0x47eb64=_0x3a7b84||client;return _0x47eb64[_0x9edd('0x16')](_0x25e64c,_0x287ddd)[_0x9edd('0x17')](function(_0x891832){logger[_0x9edd('0x18')](_0x9edd('0x19'),_0xfd544a,_0x9edd('0x1a'));logger[_0x9edd('0x1b')](_0x9edd('0x1c'),_0xfd544a,'request\x20sent',JSON[_0x9edd('0x1d')](_0x891832));if(_0x891832[_0x9edd('0x1e')]){if(_0x891832[_0x9edd('0x1e')]['code']===0x1f4){logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x891832[_0x9edd('0x1e')]['message']);return _0xef5498(_0x891832[_0x9edd('0x1e')]['message']);}logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x891832['error']['message']);return _0xfca576(_0x891832[_0x9edd('0x1e')]['message']);}else{logger[_0x9edd('0x18')]('ChatInteraction,\x20%s,\x20%s',_0xfd544a,'request\x20sent');_0xfca576(_0x891832[_0x9edd('0x1f')][_0x9edd('0x20')]);}})['catch'](function(_0x5823bc){logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x5823bc);_0xef5498(_0x5823bc);});});}function respondWithStatusCode(_0x477878,_0x542172){_0x542172=_0x542172||0xcc;return function(_0x3741c8){if(_0x3741c8){return _0x477878[_0x9edd('0x21')](_0x542172);}return _0x477878[_0x9edd('0x22')](_0x542172)[_0x9edd('0x23')]();};}function respondWithResult(_0x339a0d,_0x4c75d2){_0x4c75d2=_0x4c75d2||0xc8;return function(_0x46c383){if(_0x46c383){return _0x339a0d[_0x9edd('0x22')](_0x4c75d2)[_0x9edd('0x24')](_0x46c383);}};}function respondWithFilteredResult(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(_0x4d507f){var _0x4b3d1b=typeof _0x310a4d[_0x9edd('0x25')]===_0x9edd('0x26')&&typeof _0x310a4d[_0x9edd('0x27')]===_0x9edd('0x26');var _0x3c2227=_0x4d507f['count'];var _0x57a2cc=_0x4b3d1b?0x0:_0x310a4d[_0x9edd('0x25')];var _0x257a26=_0x4b3d1b?_0x4d507f[_0x9edd('0x28')]:_0x310a4d['offset']+_0x310a4d[_0x9edd('0x27')];var _0x28cfae;if(_0x257a26>=_0x3c2227){_0x257a26=_0x3c2227;_0x28cfae=0xc8;}else{_0x28cfae=0xce;}_0x2f9f86[_0x9edd('0x22')](_0x28cfae);return _0x2f9f86[_0x9edd('0x29')]('Content-Range',_0x57a2cc+'-'+_0x257a26+'/'+_0x3c2227)[_0x9edd('0x24')](_0x4d507f);}return null;};}function saveUpdates(_0x3fb556){return function(_0xbe87e1){if(_0xbe87e1){return _0xbe87e1[_0x9edd('0x2a')](_0x3fb556)[_0x9edd('0x17')](function(_0x42e664){return _0x42e664;});}return null;};}function removeEntity(_0x209aba){return function(_0x1fba7b){if(_0x1fba7b){return _0x1fba7b[_0x9edd('0x2b')]()[_0x9edd('0x17')](function(){_0x209aba[_0x9edd('0x22')](0xcc)[_0x9edd('0x23')]();});}};}function handleEntityNotFound(_0x6907a5){return function(_0xa55906){if(!_0xa55906){_0x6907a5[_0x9edd('0x21')](0x194);}return _0xa55906;};}function handleError(_0x5af178,_0x1453d2){_0x1453d2=_0x1453d2||0x1f4;return function(_0x259259){logger[_0x9edd('0x1e')](_0x259259['stack']);if(_0x259259[_0x9edd('0x2c')]){delete _0x259259[_0x9edd('0x2c')];}_0x5af178[_0x9edd('0x22')](_0x1453d2)[_0x9edd('0x2d')](_0x259259);};}function getMustacheRender(_0x21bc30,_0x2bc4ed){return Mustache[_0x9edd('0x2e')](_0x21bc30,_[_0x9edd('0x2f')](_0x2bc4ed[_0x9edd('0x30')],{'contact':_0x2bc4ed[_0x9edd('0x31')],'message':_0x2bc4ed[_0x9edd('0x20')],'agent':_0x2bc4ed[_0x9edd('0x32')],'interaction':_0x2bc4ed[_0x9edd('0x33')],'account':_0x2bc4ed[_0x9edd('0x34')]}))||'';}function getInteractionUsers(_0x5757fc,_0x37fcb2){return new BPromise(function(_0x5ed62d,_0x968303){try{if(_0x37fcb2[_0x5757fc['id']]){_0x5757fc[_0x9edd('0x35')]=_[_0x9edd('0x36')](_0x37fcb2[_0x5757fc['id']],function(_0x434d26){return{'id':_0x434d26['id'],'fullname':_0x434d26[_0x9edd('0x37')]};});}}catch(_0x4fa5ab){_0x968303(_0x4fa5ab);}_0x5ed62d(_0x5757fc);});}function getInteractionTags(_0x6de835,_0x44dbfc){return new BPromise(function(_0x2b3469,_0x38e9be){try{if(_0x6de835[_0x9edd('0x38')]){_0x6de835[_0x9edd('0x39')]=[];_0x6de835[_0x9edd('0x38')][_0x9edd('0x3a')](',')[_0x9edd('0x3b')](function(_0x35c16f){_0x6de835['Tags'][_0x9edd('0x3c')](_0x44dbfc[_0x35c16f]);});}delete _0x6de835['TagIds'];}catch(_0x3ef1d5){_0x38e9be(_0x3ef1d5);}_0x2b3469(_0x6de835);});}function updateChatInteraction(_0x5658d6,_0x30883e,_0x2858b5){return new BPromise(function(_0x34e9d2,_0x479661){return getInteractionUsers(_0x5658d6,_0x2858b5)[_0x9edd('0x17')](function(_0xcbd0ef){return getInteractionTags(_0xcbd0ef,_0x30883e);})[_0x9edd('0x17')](function(_0x48958a){return getStateInteraction(_0x48958a);})[_0x9edd('0x17')](function(_0x51ad91){_0x34e9d2(_0x51ad91);})[_0x9edd('0x3d')](function(_0xfbc492){_0x479661(_0xfbc492);});});}function getStateInteraction(_0x50be2c){return new BPromise(function(_0x315f52){_0x50be2c[_0x9edd('0x3e')]=0x0;_0x50be2c[_0x9edd('0x3f')]=0x0;_0x50be2c[_0x9edd('0x40')]=0x0;_0x50be2c['unmanaged']=0x0;_0x50be2c[_0x9edd('0x41')]=0x0;_0x50be2c['total']=0x0;if(!_0x50be2c[_0x9edd('0x42')]&&!_0x50be2c[_0x9edd('0x43')]){_0x50be2c['waiting']+=0x1;}if(!_0x50be2c[_0x9edd('0x42')]&&_0x50be2c['UserId']){_0x50be2c['talking']+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}if(_0x50be2c[_0x9edd('0x42')]&&_0x50be2c[_0x9edd('0x44')]===_0x9edd('0x41')){_0x50be2c[_0x9edd('0x41')]+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}else if(_0x50be2c[_0x9edd('0x42')]&&!_0x50be2c[_0x9edd('0x43')]&&_0x50be2c[_0x9edd('0x44')]){_0x50be2c[_0x9edd('0x45')]+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}else if(_0x50be2c[_0x9edd('0x42')]&&_0x50be2c['UserId']){_0x50be2c[_0x9edd('0x40')]+=0x1;if(_0x50be2c[_0x9edd('0x3f')]){_0x50be2c[_0x9edd('0x3f')]-=0x1;}}_0x50be2c[_0x9edd('0x46')]+=0x1;_0x315f52(_0x50be2c);});}exports[_0x9edd('0x47')]=function(_0x3ecdfd,_0x10d41e){var _0x4e9ad1={},_0x4a4656={},_0x4bc7a1={'count':0x0,'rows':[]};var _0x4a7dc9=_['map'](db[_0x9edd('0x48')][_0x9edd('0x49')],function(_0x2b06d3){return{'name':_0x2b06d3[_0x9edd('0x4a')],'type':_0x2b06d3[_0x9edd('0x4b')]['key']};});_0x4a4656[_0x9edd('0x4c')]=_[_0x9edd('0x36')](_0x4a7dc9,_0x9edd('0x2c'));_0x4a4656['query']=_[_0x9edd('0x4d')](_0x3ecdfd[_0x9edd('0x4e')]);_0x4a4656[_0x9edd('0x4f')]=_[_0x9edd('0x50')](_0x4a4656[_0x9edd('0x4c')],_0x4a4656[_0x9edd('0x4e')]);_0x4e9ad1['attributes']=_[_0x9edd('0x50')](_0x4a4656[_0x9edd('0x4c')],qs['fields'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x4e9ad1['attributes']=_0x4e9ad1[_0x9edd('0x52')][_0x9edd('0x53')]?_0x4e9ad1[_0x9edd('0x52')]:_0x4a4656['model'];if(!_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x54')](_0x9edd('0x55'))){_0x4e9ad1[_0x9edd('0x27')]=qs['limit'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x4e9ad1[_0x9edd('0x25')]=qs['offset'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x25')]);}_0x4e9ad1['order']=qs[_0x9edd('0x56')](_0x3ecdfd['query'][_0x9edd('0x56')]);_0x4e9ad1[_0x9edd('0x57')]=qs[_0x9edd('0x4f')](_[_0x9edd('0x58')](_0x3ecdfd[_0x9edd('0x4e')],_0x4a4656[_0x9edd('0x4f')]),_0x4a7dc9);var _0x2334d4=[];var _0x14dd27=squel[_0x9edd('0x59')]()[_0x9edd('0x5a')]('id')[_0x9edd('0x5a')]('name')[_0x9edd('0x5a')](_0x9edd('0x5b'))[_0x9edd('0x5c')]('tools_tags');var _0xe96d6a=squel['select']()['field']('u.id')[_0x9edd('0x5a')](_0x9edd('0x5d'))[_0x9edd('0x5a')](_0x9edd('0x5e'))['from']('user_has_chat_interactions','ui')['left_join'](_0x9edd('0x5f'),'u',_0x9edd('0x60'));var _0xd5090a=squel[_0x9edd('0x59')]()[_0x9edd('0x5c')](_0x9edd('0x61'),'i')[_0x9edd('0x62')](_0x9edd('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9edd('0x62')]('users','o',_0x9edd('0x64'))[_0x9edd('0x62')]('chat_websites','a',_0x9edd('0x65'))[_0x9edd('0x62')](_0x9edd('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x9edd('0x62')](_0x9edd('0x67'),'it',_0x9edd('0x68'))[_0x9edd('0x62')](_0x9edd('0x69'),'t',_0x9edd('0x6a'));var _0x53f55b=squel['expr']();var _0x452ca5=[];var _0x54f96c=squel[_0x9edd('0x6b')]();var _0x3e9a3e;if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x6c')]){_0x3e9a3e=as['parseSearch'](_0x3ecdfd[_0x9edd('0x4e')]['search']);var _0x3e5dca=_0x3e9a3e[_0x9edd('0x6d')];for(var _0xc6bde6=0x0;_0xc6bde6<_0x3e9a3e['conditions'][_0x9edd('0x53')];_0xc6bde6++){var _0x57da5b=_0x3e9a3e[_0x9edd('0x6e')][_0xc6bde6];var _0x4e1eda='i';var _0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,['name',_0x57da5b[_0x9edd('0x5a')]]);if(!_0x4915a9){switch(_0x57da5b[_0x9edd('0x5a')]){case _0x9edd('0x70'):if(_0x57da5b['value']==0x1){_0xd5090a[_0x9edd('0x71')]('`'+_0x57da5b[_0x9edd('0x5a')]+_0x9edd('0x72'));}else{_0xd5090a[_0x9edd('0x71')]('`'+_0x57da5b[_0x9edd('0x5a')]+'`\x20>\x200');}break;case'Contact':if(_0x57da5b[_0x9edd('0x73')]===_0x9edd('0x74')){if(_0x57da5b['value']['split']('\x20')['length']>0x1){_0x53f55b[_0x3e5dca](_0x9edd('0x75'),qs['getFullTextValue'](_0x57da5b['value']),null);}else{var _0x3ef9c9='%'+_0x57da5b[_0x9edd('0x76')]+'%';_0x53f55b[_0x3e5dca]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3ef9c9,_0x3ef9c9,_0x3ef9c9);}}else{_0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,[_0x9edd('0x2c'),_0x9edd('0x77')]);_0x57da5b['field']=_0x9edd('0x77');_0x3801c4=as['buildExpression'](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4['value'][_0x9edd('0x79')],_0x3801c4[_0x9edd('0x76')]['end']);}break;case _0x9edd('0x7a'):var _0x475dc3=_0x57da5b[_0x9edd('0x76')][_0x9edd('0x3a')](',')['map'](function(_0x366b04){return Number(_0x366b04);});_0x475dc3['forEach'](function(_0x1a618c){_0x54f96c['or'](_0x9edd('0x7b'),'%,'+_0x1a618c+',%');});_0x452ca5=_[_0x9edd('0x7c')](_0x452ca5,_0x475dc3);break;case'User':if(_0x57da5b[_0x9edd('0x73')]===_0x9edd('0x74')){_0x53f55b[_0x3e5dca](_0x9edd('0x7d'),'%'+_0x57da5b[_0x9edd('0x76')]+'%',null);}else{_0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,[_0x9edd('0x2c'),_0x9edd('0x43')]);_0x57da5b['field']='UserId';_0x3801c4=as[_0x9edd('0x7e')](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4[_0x9edd('0x76')][_0x9edd('0x79')],_0x3801c4['value'][_0x9edd('0x23')]);}break;case _0x9edd('0x30'):_0x3801c4=as[_0x9edd('0x7e')]('me',null,_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4['text'],_0x3801c4[_0x9edd('0x76')][_0x9edd('0x79')],_0x3801c4['value'][_0x9edd('0x23')]);break;}}else{var _0x3801c4=as['buildExpression'](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4['value'][_0x9edd('0x79')],_0x3801c4['value']['end']);}}}else{var _0x45c9ef=_(_0x3ecdfd[_0x9edd('0x4e')])[_0x9edd('0x4d')]()['map'](function(_0x3c7df3){return _[_0x9edd('0x7f')](_0x4a7dc9,['name',_0x3c7df3])?_0x3c7df3:undefined;})[_0x9edd('0x80')]()[_0x9edd('0x76')]();if(!_[_0x9edd('0x81')](_0x45c9ef)){_0x45c9ef[_0x9edd('0x3b')](function(_0x54ac71){if(_0x54ac71==='ChatWebsiteId'){_0xd5090a[_0x9edd('0x57')]('i.ChatWebsiteId\x20IN\x20?',[][_0x9edd('0x82')](_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]));}else if(_0x54ac71===_0x9edd('0x83')){var _0x3cfd35=JSON[_0x9edd('0x84')](_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71])[_0x9edd('0x85')];var _0x5a4d4b=JSON[_0x9edd('0x84')](_0x3ecdfd['query'][_0x54ac71])[_0x9edd('0x86')];_0xd5090a[_0x9edd('0x57')](_0x9edd('0x87'),_0x3cfd35,_0x5a4d4b);}else{if(_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]===_0x9edd('0x88')){_0xd5090a[_0x9edd('0x57')]('i.'+_0x54ac71+_0x9edd('0x89'));}else{_0xd5090a['where']('i.'+_0x54ac71+_0x9edd('0x8a'),_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]);}}});}if(_0x3ecdfd['query'][_0x9edd('0x8b')]){if(_0x3ecdfd[_0x9edd('0x4e')]['read']==0x1){_0xd5090a[_0x9edd('0x71')](_0x9edd('0x8c'));}else{_0xd5090a[_0x9edd('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8d')]){_0x452ca5=_[_0x9edd('0x8e')](_0x3ecdfd['query']['tag'])?_0x3ecdfd['query']['tag']:new Array(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8d')]);_0x452ca5[_0x9edd('0x3b')](function(_0x521810){_0x54f96c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x521810+',%');});}if(_0x3ecdfd['query'][_0x9edd('0x8f')]){var _0x388252=_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8f')][_0x9edd('0x90')]('\x5c','\x5c\x5c')[_0x9edd('0x90')](/'/g,'\x27\x27');if(qs[_0x9edd('0x91')](_0x388252)){_0x53f55b['or'](_0x9edd('0x92'),_0x388252+'%');}else{_0x53f55b['or'](_0x9edd('0x93'),qs[_0x9edd('0x94')](_0x388252))['or'](_0x9edd('0x95'),_0x388252+'%');}}}_0xd5090a[_0x9edd('0x57')](_0x53f55b);_0xd5090a['group'](_0x9edd('0x96'));var _0x29f3b2={'type':db[_0x9edd('0x97')][_0x9edd('0x98')][_0x9edd('0x99')],'raw':!![]};var _0x2d067b=_0xd5090a[_0x9edd('0x9a')]();_0x2d067b[_0x9edd('0x5a')]('i.id');_0x2d067b['field'](_0x9edd('0x9b'),'unreadMessages');if(_0x4e9ad1[_0x9edd('0x9c')]){_0x4e9ad1['order'][_0x9edd('0x3b')](function(_0x3f2452){var _0x554804=_0x3f2452[0x0]===_0x9edd('0x9d')?_0x3f2452[0x0]:'i.'+_0x3f2452[0x0];_0xd5090a[_0x9edd('0x9c')](_0x554804,_0x3f2452[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9edd('0x81')](_0x452ca5)){_0xd5090a[_0x9edd('0x71')](_0x54f96c);_0x2d067b[_0x9edd('0x57')](_0x9edd('0x9e'),_0x452ca5);}BPromise[_0x9edd('0x9f')]()['then'](function(){if(!_0x3e9a3e){if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0xa0')])return;_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa1'));_0xd5090a[_0x9edd('0x57')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x3ecdfd['user']['role']!=='agent')return;return _0x3ecdfd['user'][_0x9edd('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58cb3f){if(_[_0x9edd('0x81')](_0x58cb3f)){_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa3'));_0xd5090a[_0x9edd('0x57')](_0x9edd('0xa3'));}else{_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa4'),_[_0x9edd('0x36')](_0x58cb3f,'id'));_0xd5090a[_0x9edd('0x57')](_0x9edd('0xa4'),_['map'](_0x58cb3f,'id'));}});})[_0x9edd('0x17')](function(){if(_0x3ecdfd[_0x9edd('0xa5')][_0x9edd('0xa6')]===_0x9edd('0x32')&&!_0x3e9a3e&&!_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0xa0')])return[];return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0x2d067b['toString'](),_0x29f3b2);})['then'](function(_0x401ad3){_0x4bc7a1[_0x9edd('0x28')]=_0x401ad3[_0x9edd('0x53')];if(_0x4bc7a1[_0x9edd('0x28')]===0x0)return[];return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0x14dd27[_0x9edd('0xa8')](),_0x29f3b2)[_0x9edd('0x17')](function(_0x93fef1){_0x2334d4=_[_0x9edd('0xa9')](_0x93fef1,'id');_0x29f3b2=_[_0x9edd('0x2f')](_0x29f3b2,{'model':db[_0x9edd('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x51')]){_0x4e9ad1['attributes'][_0x9edd('0x3b')](function(_0x34ee39){_0xd5090a['field']('i.'+_0x34ee39);});}else{_0xd5090a[_0x9edd('0x5a')](_0x9edd('0x9b'),_0x9edd('0x70'));_0xd5090a[_0x9edd('0x5a')]('a.key',_0x9edd('0xaa'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xab'),_0x9edd('0xac'));_0xd5090a[_0x9edd('0x5a')]('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',_0x9edd('0x9d'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xad'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xae'),'Contact.firstName');_0xd5090a['field'](_0x9edd('0xaf'),'Contact.lastName');_0xd5090a[_0x9edd('0x5a')]('c.email',_0x9edd('0xb0'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb1'),_0x9edd('0xb2'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb3'),'Contact.mobile');_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb4'),_0x9edd('0xb5'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb6'),_0x9edd('0xb7'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb8'),'Owner.internal');_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb9'),_0x9edd('0x38'));}if(_0x4e9ad1[_0x9edd('0x27')])_0xd5090a[_0x9edd('0x27')](_0x4e9ad1[_0x9edd('0x27')]);if(_0x4e9ad1[_0x9edd('0x25')])_0xd5090a[_0x9edd('0x25')](_0x4e9ad1[_0x9edd('0x25')]);return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0xd5090a[_0x9edd('0xa8')](),_0x29f3b2);})[_0x9edd('0x17')](function(_0x315a4c){if(_0x315a4c[_0x9edd('0x53')]>0x0)_0xe96d6a[_0x9edd('0x57')](_0x9edd('0xba'),_[_0x9edd('0x36')](_0x315a4c,'id'));return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0xe96d6a[_0x9edd('0xa8')](),_0x29f3b2)['then'](function(_0xa704eb){var _0x553018=_['groupBy'](_0xa704eb,_0x9edd('0xbb'));var _0x108244=[];_0x315a4c[_0x9edd('0x3b')](function(_0x11b556){_0x108244[_0x9edd('0x3c')](updateChatInteraction(_0x11b556,_0x2334d4,_0x553018));});return BPromise[_0x9edd('0xbc')](_0x108244);});});})[_0x9edd('0x17')](function(_0x69925a){_0x4bc7a1[_0x9edd('0xbd')]=_0x69925a;return _0x4bc7a1;})[_0x9edd('0x17')](respondWithFilteredResult(_0x10d41e,_0x4e9ad1))['catch'](handleError(_0x10d41e,null));};exports[_0x9edd('0xbe')]=function(_0x3c2c2c,_0x48f1ae){var _0x568067={'raw':![],'where':{'id':_0x3c2c2c[_0x9edd('0xbf')]['id']}},_0x176427={};_0x176427[_0x9edd('0x4c')]=_[_0x9edd('0x4d')](db['ChatInteraction']['rawAttributes']);_0x176427[_0x9edd('0x4e')]=_['keys'](_0x3c2c2c[_0x9edd('0x4e')]);_0x176427[_0x9edd('0x4f')]=_[_0x9edd('0x50')](_0x176427['model'],_0x176427['query']);_0x568067['attributes']=_[_0x9edd('0x50')](_0x176427[_0x9edd('0x4c')],qs[_0x9edd('0x51')](_0x3c2c2c['query'][_0x9edd('0x51')]));_0x568067[_0x9edd('0x52')]=_0x568067['attributes'][_0x9edd('0x53')]?_0x568067[_0x9edd('0x52')]:_0x176427['model'];if(_0x3c2c2c['query'][_0x9edd('0xc0')]){_0x568067[_0x9edd('0xc1')]=[{'all':!![]}];}_0x568067=_['merge']({},_0x568067,_0x3c2c2c[_0x9edd('0xc2')]);return db[_0x9edd('0x48')]['find'](_0x568067)[_0x9edd('0x17')](handleEntityNotFound(_0x48f1ae,null))['then'](respondWithResult(_0x48f1ae,null))[_0x9edd('0x3d')](handleError(_0x48f1ae,null));};exports[_0x9edd('0xc3')]=function(_0x23eb54,_0x742e13){return db[_0x9edd('0x48')][_0x9edd('0xc3')](_0x23eb54['body'],{})[_0x9edd('0x17')](respondWithResult(_0x742e13,0xc9))[_0x9edd('0x3d')](handleError(_0x742e13,null));};exports[_0x9edd('0x2a')]=function(_0x511ea1,_0x956219){if(_0x511ea1['body']['id']){delete _0x511ea1[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x511ea1[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x956219,null))['then'](saveUpdates(_0x511ea1['body'],null))[_0x9edd('0x17')](respondWithResult(_0x956219,null))[_0x9edd('0x3d')](handleError(_0x956219,null));};exports[_0x9edd('0x2b')]=function(_0x50af78,_0x41a761){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x50af78[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x41a761,null))[_0x9edd('0x17')](removeEntity(_0x41a761,null))['catch'](handleError(_0x41a761,null));};exports['describe']=function(_0x12ceb1,_0x47676c){return db[_0x9edd('0x48')]['describe']()[_0x9edd('0x17')](respondWithResult(_0x47676c,null))[_0x9edd('0x3d')](handleError(_0x47676c,null));};exports[_0x9edd('0xc4')]=function(_0x454cce,_0x524217){var _0x2122de=_0x454cce['params']['id'];var _0x3d8b18;var _0x3eeb0c;var _0x7b0a4f;return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x2122de}})['then'](function(_0x3e07f1){_0x3d8b18=_0x3e07f1;return db['ChatWebsite'][_0x9edd('0xc5')]({'where':{'id':_0x3e07f1['ChatWebsiteId']},'attributes':['id',_0x9edd('0xc6'),'vidaooEscalation',_0x9edd('0xc7'),_0x9edd('0xc8'),_0x9edd('0xc9')],'raw':!![]});})['then'](function(_0x244dce){if(_0x244dce&&_0x244dce[_0x9edd('0xc6')]&&_0x244dce[_0x9edd('0xca')]){_0x3eeb0c=_0x244dce;var _0x2e7b0d={'interaction':{'id':_0x2122de},'agent':{'id':_0x454cce[_0x9edd('0xa5')]['id'],'name':_0x454cce[_0x9edd('0xa5')][_0x9edd('0x2c')],'fullname':_0x454cce[_0x9edd('0xa5')][_0x9edd('0x37')],'email':_0x454cce[_0x9edd('0xa5')][_0x9edd('0xcb')]},'contact':_0x454cce[_0x9edd('0x30')][_0x9edd('0x31')],'account':_0x454cce[_0x9edd('0x30')][_0x9edd('0x34')]};var _0x81dd98={'rejectUnauthorized':![],'method':_0x9edd('0xcc'),'url':_0x9edd('0xcd'),'headers':{'X-APIKEY':_0x244dce[_0x9edd('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x454cce[_0x9edd('0xa5')][_0x9edd('0xcb')]],'buttons':null,'topic':_0x3eeb0c[_0x9edd('0xc7')],'note':_['isNull'](_0x3eeb0c[_0x9edd('0xc8')])?null:getMustacheRender(_0x3eeb0c['vidaooNote'],_0x2e7b0d),'metadata':null},'redirect':_0x9edd('0xce'),'json':!![]};try{if(!_[_0x9edd('0xcf')](_0x3eeb0c[_0x9edd('0xc9')])){var _0x8ab7e8=getMustacheRender(_0x3eeb0c[_0x9edd('0xc9')],_0x2e7b0d);var _0x5465fd=JSON[_0x9edd('0x84')](_0x8ab7e8);_0x81dd98['body'][_0x9edd('0xd0')]=_0x5465fd;}}catch(_0x438cc5){throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xd2'));}return rp(_0x81dd98);}else{throw new db[(_0x9edd('0x97'))]['ValidationError'](_0x9edd('0xd3'));}})[_0x9edd('0x17')](function(_0x5be4a6){_0x7b0a4f=_0x5be4a6;if(_0x7b0a4f['id']){var _0x4f7350={'body':_0x7b0a4f['join_url'],'ChatWebsiteId':_0x3eeb0c['id'],'ChatInteractionId':_0x3d8b18['id'],'direction':'out','UserId':_0x454cce[_0x9edd('0xa5')]['id']};return db[_0x9edd('0xd4')][_0x9edd('0xc3')](_0x4f7350,{});}else{throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xd5'));}})[_0x9edd('0x17')](function(){return _0x3d8b18[_0x9edd('0xd6')]({'vidaooSessionId':_0x7b0a4f['id']});})[_0x9edd('0x17')](respondWithResult(_0x524217,null))[_0x9edd('0x3d')](handleError(_0x524217,null));};exports['customUpdate']=function(_0x361b57,_0x4b3449){if(_0x361b57['body']['id']){delete _0x361b57[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x361b57[_0x9edd('0xbf')]['id']},'include':[{'model':db[_0x9edd('0xd7')],'as':'Contact'}]})[_0x9edd('0x17')](handleEntityNotFound(_0x4b3449,null))[_0x9edd('0x17')](saveUpdates(_0x361b57[_0x9edd('0x30')],null))[_0x9edd('0x17')](respondWithResult(_0x4b3449,null))['catch'](handleError(_0x4b3449,null));};exports[_0x9edd('0xd8')]=function(_0x2a3076,_0x3df631){if(_0x2a3076[_0x9edd('0x30')]['id']){delete _0x2a3076[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x2a3076[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](function(_0xa8c1f7){if(!_0xa8c1f7){logger[_0x9edd('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9edd('0xd8'),0x194,_0x9edd('0xd9'));_0x3df631[_0x9edd('0x21')](0x194);}else{if(_0xa8c1f7[_0x9edd('0x43')]){throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xda'));}}return _0xa8c1f7;})[_0x9edd('0x17')](function(_0x4a3955){if(_0x4a3955){return _0x4a3955['update']({'closed':_0x2a3076['body'][_0x9edd('0x42')],'disposition':_0x2a3076[_0x9edd('0x30')][_0x9edd('0x44')]})[_0x9edd('0x17')](function(_0x223c42){return _0x223c42;});}})[_0x9edd('0x17')](function(){return respondWithRpcPromise(_0x9edd('0xdb'),_0x9edd('0xd8'),_0x2a3076[_0x9edd('0x30')],client9004);})[_0x9edd('0x17')](respondWithResult(_0x3df631,null))['catch'](handleError(_0x3df631,null));};exports[_0x9edd('0xdc')]=function(_0x56dc7e,_0x4db9fc){_0x56dc7e[_0x9edd('0x30')][_0x9edd('0x2c')]=_0x56dc7e[_0x9edd('0xdd')]['originalname'];_0x56dc7e['body']['basename']=_0x56dc7e['file']['filename'];_0x56dc7e[_0x9edd('0x30')][_0x9edd('0x4b')]=_0x56dc7e[_0x9edd('0xdd')]['mimetype'];return db[_0x9edd('0xde')][_0x9edd('0xc3')](_0x56dc7e[_0x9edd('0x30')])['then'](respondWithResult(_0x4db9fc,0xc9))[_0x9edd('0x3d')](handleError(_0x4db9fc,null));};exports['attachmentDownload']=function(_0x16a1c8,_0x1a2376){return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x16a1c8['params']['id']},'raw':!![]})[_0x9edd('0x17')](handleEntityNotFound(_0x1a2376,null))[_0x9edd('0x17')](function(_0x499e2a){if(_0x499e2a){if(_0x499e2a[_0x9edd('0x42')]){return _0x1a2376[_0x9edd('0x22')](0x193)[_0x9edd('0x24')]({'status':0x193,'message':_0x9edd('0xdf')});}return db['Attachment'][_0x9edd('0xc5')]({'where':{'id':_0x16a1c8[_0x9edd('0x4e')][_0x9edd('0xe0')]},'raw':!![]})[_0x9edd('0x17')](handleEntityNotFound(_0x1a2376,null));}})[_0x9edd('0x17')](function(_0x35d21e){if(_0x35d21e){var _0x390354=_0x35d21e['ChatOfflineMessageId']!==null;var _0xb29591=path['join'](config[_0x9edd('0xe1')],_0x9edd('0xe2'));if(_0x390354){_0xb29591=path['join'](_0xb29591,_0x9edd('0xe3'));}var _0x2f212d=path[_0x9edd('0xe4')](_0xb29591,_0x35d21e['basename']);return _0x1a2376[_0x9edd('0xe5')](_0x2f212d);}})[_0x9edd('0x3d')](handleError(_0x1a2376,null));};exports[_0x9edd('0xe6')]=function(_0x52f0e2,_0x155ca5){var _0x517142=null;var _0x288ecc=null;var _0x30d03a=null;if(_0x52f0e2[_0x9edd('0x30')]['id']){delete _0x52f0e2[_0x9edd('0x30')]['id'];}if(_0x52f0e2['body']['mailTranscript']){_0x30d03a=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0xe7'),util[_0x9edd('0xe8')](_0x9edd('0xe9'),Date['now']()));_0x52f0e2[_0x9edd('0x30')][_0x9edd('0xea')]=_0x30d03a;}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x52f0e2[_0x9edd('0xbf')]['id']},'include':[{'model':db[_0x9edd('0xd4')],'as':_0x9edd('0xeb'),'include':[{'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec')}]}]})[_0x9edd('0x17')](handleEntityNotFound(_0x155ca5,null))[_0x9edd('0x17')](saveUpdates(_0x52f0e2[_0x9edd('0x30')],null))[_0x9edd('0x17')](function(_0x549cd6){if(_0x549cd6){_0x517142=_0x549cd6;return db[_0x9edd('0xed')][_0x9edd('0x6f')]({'where':{'id':_0x517142[_0x9edd('0xa0')]}});}})[_0x9edd('0x17')](function(_0x5aab0e){if(_0x5aab0e){_0x288ecc=_0x5aab0e;return db[_0x9edd('0xd7')][_0x9edd('0x6f')]({'where':{'id':_0x517142[_0x9edd('0x77')]}});}})['then'](function(_0x910adf){if(_0x910adf){if(_0x30d03a){var _0x49a24f=null;for(var _0x483d82=0x1;_0x483d82<_0x517142[_0x9edd('0xeb')][_0x9edd('0x53')];++_0x483d82){_0x49a24f=_0x517142[_0x9edd('0xeb')][_0x483d82];var _0x1934d3=_0x49a24f['UserId']?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f[_0x9edd('0x43')]):_0x9edd('0xf0');var _0x38efe5=_0x52f0e2[_0x9edd('0x30')][_0x9edd('0xf1')]||util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x9edd('0xf2'),_0x49a24f[_0x9edd('0x77')]);switch(_0x288ecc['agentIdentifier']){case _0x9edd('0xf3'):_0x1934d3=_0x49a24f[_0x9edd('0x43')]?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f['UserId']):_0x9edd('0xf0');break;case'agent_alias':_0x1934d3=_0x49a24f[_0x9edd('0x43')]?_0x49a24f[_0x9edd('0xec')]['alias']||_0x49a24f['User'][_0x9edd('0x37')]:_0x9edd('0xf0');break;case _0x9edd('0xf4'):_0x1934d3=_0x49a24f[_0x9edd('0x43')]?_0x49a24f[_0x9edd('0xec')]['fullname']:'System';break;default:_0x1934d3=_0x49a24f[_0x9edd('0x43')]?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f['UserId']):_0x9edd('0xf0');}var _0x3b36ed=util[_0x9edd('0xe8')](_0x9edd('0xf5'),moment(_0x49a24f[_0x9edd('0x83')])[_0x9edd('0xe8')](_0x9edd('0xf6')),_0x49a24f['direction']==='in'?_0x38efe5:_0x1934d3,_0x49a24f[_0x9edd('0x30')]);if(!_0x49a24f[_0x9edd('0xf7')]){fs[_0x9edd('0xf8')](_0x30d03a,_0x3b36ed);}}return db[_0x9edd('0xf9')][_0x9edd('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x9edd('0xfa')],'as':_0x9edd('0xfb'),'raw':!![],'include':[{'model':db[_0x9edd('0xfc')],'as':_0x9edd('0xfc'),'raw':!![]}]}]});}}})[_0x9edd('0x17')](function(_0x288bc8){if(!_0x288bc8||!_0x288bc8[_0x9edd('0xfb')]||!_0x52f0e2[_0x9edd('0x30')])return _0x517142;var _0x50bfd5=_0x288bc8[_0x9edd('0xfd')]();return respondWithRpcPromise(_0x9edd('0xfe'),_0x9edd('0xff'),{'account':_0x50bfd5,'message':{'from':util[_0x9edd('0xe8')]('\x22%s\x22\x20<%s>',_0x288bc8[_0x9edd('0x2c')],_0x288bc8[_0x9edd('0xcb')]||_0x288bc8[_0x9edd('0xfb')][_0x9edd('0xa5')]),'to':_0x52f0e2[_0x9edd('0x30')][_0x9edd('0x100')],'subject':_0x9edd('0x101'),'text':util[_0x9edd('0xe8')](_0x9edd('0x102'),_0x52f0e2[_0x9edd('0x30')][_0x9edd('0x100')]),'attachments':[{'path':_0x30d03a}]}})['then'](function(){return _0x517142;})[_0x9edd('0x3d')](function(_0x7916cf){logger[_0x9edd('0x1e')](_0x7916cf);});})[_0x9edd('0x17')](respondWithStatusCode(_0x155ca5,0xc8))[_0x9edd('0x3d')](handleError(_0x155ca5,null));};exports[_0x9edd('0x103')]=function(_0x3bdbed,_0x55d08b){return db[_0x9edd('0xd4')][_0x9edd('0x6f')]({'where':{'id':_0x3bdbed[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x55d08b,null))[_0x9edd('0x17')](function(_0x116fcb){if(_0x116fcb){return _0x116fcb[_0x9edd('0x103')](_0x3bdbed[_0x9edd('0x30')][_0x9edd('0x104')],_[_0x9edd('0x105')](_0x3bdbed[_0x9edd('0x30')],[_0x9edd('0x104'),'id'])||{});}})[_0x9edd('0x17')](respondWithResult(_0x55d08b,null))[_0x9edd('0x3d')](handleError(_0x55d08b,null));};exports[_0x9edd('0x106')]=function(_0xd227fe,_0x106889){var _0x56a952={'raw':![],'where':{}};var _0xadc0be={};var _0x300094={'count':0x0,'rows':[]};return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0xd227fe[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x106889,null))[_0x9edd('0x17')](function(_0x11d72d){if(_0x11d72d){_0xadc0be[_0x9edd('0x4c')]=_['keys'](db[_0x9edd('0xd4')][_0x9edd('0x49')]);_0xadc0be[_0x9edd('0x4e')]=_['keys'](_0xd227fe[_0x9edd('0x4e')]);_0xadc0be['filters']=_[_0x9edd('0x50')](_0xadc0be['model'],_0xadc0be[_0x9edd('0x4e')]);_0x56a952[_0x9edd('0x52')]=_['intersection'](_0xadc0be[_0x9edd('0x4c')],qs[_0x9edd('0x51')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x56a952[_0x9edd('0x52')]=_0x56a952[_0x9edd('0x52')][_0x9edd('0x53')]?_0x56a952['attributes']:_0xadc0be[_0x9edd('0x4c')];if(!_0xd227fe[_0x9edd('0x4e')]['hasOwnProperty'](_0x9edd('0x55'))){_0x56a952['limit']=qs[_0x9edd('0x27')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x56a952[_0x9edd('0x25')]=qs[_0x9edd('0x25')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x25')]);}_0x56a952[_0x9edd('0x9c')]=qs[_0x9edd('0x56')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x56')]);_0x56a952[_0x9edd('0x57')]=qs['filters'](_['pick'](_0xd227fe[_0x9edd('0x4e')],_0xadc0be[_0x9edd('0x4f')]));_0x56a952[_0x9edd('0x57')][_0x9edd('0xbb')]=_0x11d72d['id'];if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x8f')]){_0x56a952[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x56a952[_0x9edd('0x57')],{'$or':_['map'](_0x56a952[_0x9edd('0x52')],function(_0x49181c){var _0x3ca64d={};_0x3ca64d[_0x49181c]={'$like':'%'+_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x8f')]+'%'};return _0x3ca64d;})});}if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x85')]){var _0x12561b=_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x85')][_0x9edd('0x3a')](',');var _0x3fcbc0={};_0x3fcbc0[_0x12561b[0x0]]={'$gte':moment(_0x12561b[0x1])[_0x9edd('0xe8')](_0x9edd('0x107'))};_0x56a952[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x56a952[_0x9edd('0x57')],_0x3fcbc0);}_0x56a952=_[_0x9edd('0x2f')]({},_0x56a952,_0xd227fe[_0x9edd('0xc2')]);return db[_0x9edd('0xd4')][_0x9edd('0x28')]({'where':_0x56a952['where']})['then'](function(_0x33a86d){_0x300094['count']=_0x33a86d;if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0xc0')]){_0x56a952[_0x9edd('0xc1')]=[{'all':!![]}];}return db[_0x9edd('0xd4')]['findAll'](_0x56a952);})['then'](function(_0x593f45){_0x300094[_0x9edd('0xbd')]=_0x593f45;return _0x300094;});}})[_0x9edd('0x17')](respondWithFilteredResult(_0x106889,_0x56a952))[_0x9edd('0x3d')](handleError(_0x106889,null));};exports[_0x9edd('0x108')]=function(_0x51ac25,_0x4707b7){var _0x48f055={'where':{}},_0x43e9fa={},_0x2e260a={'count':0x0,'rows':[]};return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x51ac25['params']['id']}})['then'](handleEntityNotFound(_0x4707b7,null))['then'](function(_0x3bb205){if(_0x3bb205){_0x43e9fa[_0x9edd('0x4c')]=_[_0x9edd('0x4d')](db[_0x9edd('0xd4')][_0x9edd('0x49')]);_0x43e9fa[_0x9edd('0x4e')]=_['keys'](_0x51ac25[_0x9edd('0x4e')]);_0x43e9fa[_0x9edd('0x4f')]=_['intersection'](_0x43e9fa['model'],_0x43e9fa[_0x9edd('0x4e')]);_0x48f055[_0x9edd('0x52')]=_[_0x9edd('0x50')](_0x43e9fa['model'],qs[_0x9edd('0x51')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x48f055[_0x9edd('0x52')]=_0x48f055['attributes'][_0x9edd('0x53')]?_0x48f055[_0x9edd('0x52')]:_0x43e9fa[_0x9edd('0x4c')];if(!_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x54')](_0x9edd('0x55'))){_0x48f055['limit']=qs[_0x9edd('0x27')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x48f055[_0x9edd('0x25')]=qs['offset'](_0x51ac25['query'][_0x9edd('0x25')]);}_0x48f055[_0x9edd('0x9c')]=qs[_0x9edd('0x56')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x56')]);_0x48f055[_0x9edd('0x57')]=qs[_0x9edd('0x4f')](_[_0x9edd('0x58')](_0x51ac25[_0x9edd('0x4e')],_0x43e9fa[_0x9edd('0x4f')]));_0x48f055[_0x9edd('0x57')][_0x9edd('0xbb')]=_0x3bb205['id'];if(_0x51ac25['query']['filter']){_0x48f055[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x48f055[_0x9edd('0x57')],{'$or':_[_0x9edd('0x36')](_0x48f055[_0x9edd('0x52')],function(_0x180c4d){var _0x425948={};_0x425948[_0x180c4d]={'$like':'%'+_0x51ac25[_0x9edd('0x4e')]['filter']+'%'};return _0x425948;})});}_0x48f055[_0x9edd('0x57')][_0x9edd('0xf7')]=![];if(_0x51ac25[_0x9edd('0x4e')]['id']){_0x48f055[_0x9edd('0x57')]['id']={'$gt':_0x51ac25[_0x9edd('0x4e')]['id']};}_0x48f055=_[_0x9edd('0x2f')]({},_0x48f055,_0x51ac25['options']);return db['ChatMessage'][_0x9edd('0x28')]({'where':_0x48f055[_0x9edd('0x57')]})[_0x9edd('0x17')](function(_0x50c328){_0x2e260a['count']=_0x50c328;_0x48f055[_0x9edd('0xc1')]=[];if(_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x109')]){_0x48f055[_0x9edd('0xc1')][_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec'),'attributes':['id',_0x9edd('0x37'),_0x9edd('0x10a')]});}if(_0x51ac25[_0x9edd('0x4e')][_0x9edd('0xc0')]){_0x48f055['include']=[{'all':!![]}];}return db[_0x9edd('0xd4')]['findAll'](_0x48f055);})['then'](function(_0x58756b){_0x2e260a[_0x9edd('0xbd')]=_0x58756b;return _0x2e260a;});}})[_0x9edd('0x17')](respondWithFilteredResult(_0x4707b7,_0x48f055))['catch'](handleError(_0x4707b7,null));};exports['addTags']=function(_0x5e721c,_0x47d20b){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x5e721c[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x47d20b,null))[_0x9edd('0x17')](function(_0x2f99ac){if(_0x2f99ac){return _0x2f99ac[_0x9edd('0x10b')](_0x5e721c[_0x9edd('0x30')][_0x9edd('0x104')],_['omit'](_0x5e721c[_0x9edd('0x30')],['ids','id'])||{})[_0x9edd('0x10c')](function(){return db['Tag'][_0x9edd('0x10d')]({'attributes':['id',_0x9edd('0x2c'),_0x9edd('0x5b')],'where':{'id':_0x5e721c['body'][_0x9edd('0x104')]}});})[_0x9edd('0x17')](function(_0x3e2fc7){socket['emit']('chatInteractionTags:save',{'id':Number(_0x5e721c[_0x9edd('0xbf')]['id']),'tags':_0x3e2fc7||[]});return{'id':Number(_0x5e721c[_0x9edd('0xbf')]['id']),'tags':_0x3e2fc7||[]};});}})[_0x9edd('0x17')](respondWithResult(_0x47d20b,null))[_0x9edd('0x3d')](handleError(_0x47d20b,null));};exports[_0x9edd('0x10e')]=function(_0x83693e,_0x4308a2){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x83693e[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4308a2,null))[_0x9edd('0x17')](function(_0x276a53){if(_0x276a53){return _0x276a53['removeTags'](_0x83693e['query'][_0x9edd('0x104')]);}})[_0x9edd('0x17')](respondWithStatusCode(_0x4308a2,null))[_0x9edd('0x3d')](handleError(_0x4308a2,null));};exports[_0x9edd('0xe5')]=function(_0x5eec20,_0xc23db6){var _0x33a71d=moment()[_0x9edd('0x10f')]()[_0x9edd('0xa8')]();var _0x5d8749=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),'files',_0x9edd('0x111'));var _0x1e9806=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),_0x9edd('0x112'),_0x9edd('0x113'));var _0x4fa1b2=path[_0x9edd('0xe4')](_0x5d8749,_0x33a71d);var _0x2c0620=util['format'](_0x9edd('0x114'),_0x5eec20['params']['id'],_0x33a71d);var _0x5a43af=path[_0x9edd('0xe4')](_0x5d8749,_0x2c0620);var _0x6018fd=[];_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec'),'attributes':['id',_0x9edd('0x37')],'raw':!![]});_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xd7')],'as':_0x9edd('0x115'),'attributes':['id',_0x9edd('0x116'),_0x9edd('0x117')],'raw':!![]});if(_0x5eec20['query']['attachments']){_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xde')],'as':_0x9edd('0xde'),'raw':!![]});}var _0x3a2dad=[{'model':db[_0x9edd('0xd4')],'as':_0x9edd('0xeb'),'attributes':['id','body',_0x9edd('0x83'),_0x9edd('0x118'),_0x9edd('0xf7'),'read'],'include':_0x6018fd}];_0x3a2dad[_0x9edd('0x3c')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id','name']});_0x3a2dad[_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0x119'),'attributes':['id',_0x9edd('0x37')]});return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x5eec20[_0x9edd('0xbf')]['id']},'include':_0x3a2dad})[_0x9edd('0x17')](handleEntityNotFound(_0xc23db6,null))[_0x9edd('0x17')](function(_0x5033e3){if(_0x5033e3){var _0x3a6ffa=_0x5033e3[_0x9edd('0x11a')]({'plain':!![]});fs['mkdirSync'](_0x4fa1b2);var _0x5d7461={'channel':_0x9edd('0x11b'),'account':_0x3a6ffa[_0x9edd('0x11c')]['name'],'agent':_0x3a6ffa[_0x9edd('0x119')]?_0x3a6ffa[_0x9edd('0x119')][_0x9edd('0x37')]:_0x9edd('0x11d'),'createdAt':moment(_0x3a6ffa['createdAt'])[_0x9edd('0xe8')](_0x9edd('0x107'))[_0x9edd('0xa8')](),'closedAt':_0x3a6ffa['closed']?moment(_0x3a6ffa[_0x9edd('0x11e')])[_0x9edd('0xe8')](_0x9edd('0x107'))[_0x9edd('0xa8')]():'','disposition':_0x3a6ffa[_0x9edd('0x44')],'chatInfo':{'browser':_0x3a6ffa[_0x9edd('0x11f')],'os':_0x3a6ffa[_0x9edd('0x120')],'referer':_0x3a6ffa[_0x9edd('0x121')],'customerIp':_0x3a6ffa['customerIp'],'customerPort':_0x3a6ffa[_0x9edd('0x122')]?_0x3a6ffa[_0x9edd('0x122')]:_0x9edd('0x11d')},'messages':_(_0x3a6ffa[_0x9edd('0xeb')])[_0x9edd('0x123')]()[_0x9edd('0x8f')]({'secret':![]})[_0x9edd('0x36')](function(_0x57845c){if(_0x57845c[_0x9edd('0xde')]){var _0x55d8e1=path['join'](_0x1e9806,_0x57845c[_0x9edd('0xde')][_0x9edd('0x124')]);if(fs['existsSync'](_0x55d8e1)){fs[_0x9edd('0x125')](_0x55d8e1)[_0x9edd('0x126')](fs[_0x9edd('0x127')](path['join'](_0x4fa1b2,_0x57845c['Attachment'][_0x9edd('0x124')])));}}return{'date':moment(_0x57845c[_0x9edd('0x83')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9edd('0xa8')](),'sender':_0x57845c[_0x9edd('0x118')]===_0x9edd('0x128')?_0x57845c[_0x9edd('0xec')]?_0x57845c['User']['fullname']:_0x9edd('0xf0'):_0x57845c[_0x9edd('0x115')]['firstName']+(_0x57845c[_0x9edd('0x115')]['lastName']?'\x20'+_0x57845c[_0x9edd('0x115')][_0x9edd('0x117')]:''),'body':_0x57845c[_0x9edd('0xde')]?_0x57845c[_0x9edd('0xde')]['basename']:_0x57845c[_0x9edd('0x30')],'direction':_0x57845c[_0x9edd('0x118')]==='out'?'A':'C','secret':_0x57845c[_0x9edd('0xf7')],'read':_0x57845c['read'],'attachment':_0x57845c[_0x9edd('0xde')]};})[_0x9edd('0x76')]()};return ejs[_0x9edd('0x129')](path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),'views',_0x9edd('0x12a')),{'interaction':_0x5d7461})[_0x9edd('0x17')](function(_0x268088){var _0x3aa372=path[_0x9edd('0xe4')](_0x4fa1b2,_0x9edd('0x12b')+_0x3a6ffa['id']+'-'+_0x33a71d+_0x9edd('0x12c'));var _0x299444={'path':_0x3aa372,'channel':_0x9edd('0x11b'),'interactionId':_0x3a6ffa['id']};return pdf[_0x9edd('0x12d')](_0x268088,_0x299444);})['then'](function(){return new Promise(function(_0x2b7c53,_0x62b689){zipdir(_0x4fa1b2,{'saveTo':_0x5a43af},function(_0x319670,_0x108640){if(_0x319670)return _0x62b689(_0x319670);return _0x2b7c53(_0x108640);});})[_0x9edd('0x17')](function(){return new BPromise(function(_0x350ae2,_0x202f59){rimraf(_0x4fa1b2,function(_0x2f5a6e){if(_0x2f5a6e)_0x202f59(_0x2f5a6e);return _0x350ae2();});});})[_0x9edd('0x17')](function(){return _0xc23db6[_0x9edd('0xe5')](_0x5a43af,_0x2c0620,function(_0x142052){if(_0x142052){logger[_0x9edd('0x1e')](_0x9edd('0x12e'),_0x142052);}else{fs[_0x9edd('0x12f')](_0x5a43af);}});});});}else{return _0xc23db6[_0x9edd('0x21')](0xc8);}})['catch'](handleError(_0xc23db6,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 14d9357..ff77071 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 _0x847b=['ChatMessage','setMaxListeners','save','remove','getUsers','then','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','ChatInteraction'];(function(_0x30730e,_0x1fcd55){var _0x26d715=function(_0x52360e){while(--_0x52360e){_0x30730e['push'](_0x30730e['shift']());}};_0x26d715(++_0x1fcd55);}(_0x847b,0xcf));var _0xb847=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x847b[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0xb847('0x0'));var ChatInteraction=require(_0xb847('0x1'))['db'][_0xb847('0x2')];var ChatMessage=require(_0xb847('0x1'))['db'][_0xb847('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb847('0x4')](0x0);var events={'afterCreate':_0xb847('0x5'),'afterUpdate':'update','afterDestroy':_0xb847('0x6')};function emitEvent(_0x528906){return function(_0x13a1ce,_0x3f1e7c,_0x4c83f8){_0x13a1ce[_0xb847('0x7')]({'attributes':['id'],'raw':!![]})[_0xb847('0x8')](function(_0x3d80d5){_0x13a1ce['setDataValue'](_0xb847('0x9'),_0x3d80d5['map'](function(_0x15e30b){return{'id':_0x15e30b['id']};}));return ChatMessage[_0xb847('0xa')]({'where':{'ChatInteractionId':_0x13a1ce['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x27405d){_0x13a1ce['setDataValue'](_0xb847('0xb'),_0x27405d['length']);ChatInteractionEvents['emit'](_0x528906+':'+_0x13a1ce['id'],_0x13a1ce);ChatInteractionEvents[_0xb847('0xc')](_0x528906,_0x13a1ce);_0x4c83f8(null);})[_0xb847('0xd')](_0x4c83f8(null));};}for(var e in events){if(events[_0xb847('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xf35b=['getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update'];(function(_0x422024,_0x3c5458){var _0x526846=function(_0x53dd2c){while(--_0x53dd2c){_0x422024['push'](_0x422024['shift']());}};_0x526846(++_0x3c5458);}(_0xf35b,0xd8));var _0xbf35=function(_0x2eec76,_0x24ca54){_0x2eec76=_0x2eec76-0x0;var _0x4ba8c3=_0xf35b[_0x2eec76];return _0x4ba8c3;};'use strict';var EventEmitter=require(_0xbf35('0x0'));var ChatInteraction=require(_0xbf35('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xbf35('0x1'))['db'][_0xbf35('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbf35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf35('0x4'),'afterDestroy':'remove'};function emitEvent(_0x455f1e){return function(_0x3abfb4,_0xd38cf0,_0xc2bd24){_0x3abfb4[_0xbf35('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ec00c){_0x3abfb4[_0xbf35('0x6')](_0xbf35('0x7'),_0x1ec00c[_0xbf35('0x8')](function(_0x394e72){return{'id':_0x394e72['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3abfb4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbf35('0x9')](function(_0x2ef98c){_0x3abfb4['setDataValue'](_0xbf35('0xa'),_0x2ef98c[_0xbf35('0xb')]);ChatInteractionEvents[_0xbf35('0xc')](_0x455f1e+':'+_0x3abfb4['id'],_0x3abfb4);ChatInteractionEvents[_0xbf35('0xc')](_0x455f1e,_0x3abfb4);_0xc2bd24(null);})[_0xbf35('0xd')](_0xc2bd24(null));};}for(var e in events){if(events[_0xbf35('0xe')](e)){var event=events[e];ChatInteraction[_0xbf35('0xf')](e,emitEvent(event));}}module[_0xbf35('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 699df63..4c2cd8c 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 _0x90bc=['exports','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18dde5,_0x3f7cd2){var _0x4a4a30=function(_0x2fdf2b){while(--_0x2fdf2b){_0x18dde5['push'](_0x18dde5['shift']());}};_0x4a4a30(++_0x3f7cd2);}(_0x90bc,0x87));var _0xc90b=function(_0x59ea8b,_0x1d407f){_0x59ea8b=_0x59ea8b-0x0;var _0x81cad=_0x90bc[_0x59ea8b];return _0x81cad;};'use strict';var _=require(_0xc90b('0x0'));var util=require(_0xc90b('0x1'));var logger=require(_0xc90b('0x2'))(_0xc90b('0x3'));var moment=require('moment');var BPromise=require(_0xc90b('0x4'));var rp=require(_0xc90b('0x5'));var fs=require('fs');var path=require(_0xc90b('0x6'));var rimraf=require(_0xc90b('0x7'));var config=require(_0xc90b('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xc90b('0x9')]=function(_0x328952,_0x2ed35f){return _0x328952['define'](_0xc90b('0xa'),attributes,{'tableName':_0xc90b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53d478,_0x50287f,_0x1572cd){if(_0x53d478[_0xc90b('0xc')](_0xc90b('0xd'))){_0x53d478['closedAt']=moment()[_0xc90b('0xe')](_0xc90b('0xf'));}_0x1572cd(null,_0x53d478);}},'charset':_0xc90b('0x10'),'collate':_0xc90b('0x11')});}; \ No newline at end of file +var _0xc7b5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x55334a,_0x140452){var _0x2945bd=function(_0x2e3617){while(--_0x2e3617){_0x55334a['push'](_0x55334a['shift']());}};_0x2945bd(++_0x140452);}(_0xc7b5,0x151));var _0x5c7b=function(_0x422475,_0x111bee){_0x422475=_0x422475-0x0;var _0x111c48=_0xc7b5[_0x422475];return _0x111c48;};'use strict';var _=require('lodash');var util=require(_0x5c7b('0x0'));var logger=require(_0x5c7b('0x1'))(_0x5c7b('0x2'));var moment=require(_0x5c7b('0x3'));var BPromise=require(_0x5c7b('0x4'));var rp=require(_0x5c7b('0x5'));var fs=require('fs');var path=require(_0x5c7b('0x6'));var rimraf=require(_0x5c7b('0x7'));var config=require(_0x5c7b('0x8'));var attributes=require(_0x5c7b('0x9'));module[_0x5c7b('0xa')]=function(_0x1409cb,_0x226152){return _0x1409cb[_0x5c7b('0xb')]('ChatInteraction',attributes,{'tableName':_0x5c7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58eed6,_0x158930,_0x3215d8){if(_0x58eed6['changed']('closed')){_0x58eed6['closedAt']=moment()[_0x5c7b('0xd')](_0x5c7b('0xe'));}_0x3215d8(null,_0x58eed6);}},'charset':_0x5c7b('0xf'),'collate':_0x5c7b('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 1704b25..bad8bdd 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 _0x61c1=['spread','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','stringify','ChatInteraction','addTags','omit','ids'];(function(_0xa64da9,_0x549be6){var _0x2e5f3a=function(_0x39a178){while(--_0x39a178){_0xa64da9['push'](_0xa64da9['shift']());}};_0x2e5f3a(++_0x549be6);}(_0x61c1,0x13a));var _0x161c=function(_0x7dc7db,_0x5b8f6d){_0x7dc7db=_0x7dc7db-0x0;var _0x42240b=_0x61c1[_0x7dc7db];return _0x42240b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x161c('0x0'));var BPromise=require(_0x161c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x161c('0x2'));var db=require(_0x161c('0x3'))['db'];var utils=require(_0x161c('0x4'));var logger=require(_0x161c('0x5'))(_0x161c('0x6'));var config=require(_0x161c('0x7'));var jayson=require(_0x161c('0x8'));var client=jayson[_0x161c('0x9')][_0x161c('0xa')]({'port':0x232a});config[_0x161c('0xb')]=_[_0x161c('0xc')](config[_0x161c('0xb')],{'host':_0x161c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0x161c('0xe')](socket);function respondWithRpcPromise(_0xccdc,_0x5bdbb7,_0x3e213f){return new BPromise(function(_0x2961c6,_0x2cf1d6){return client['request'](_0xccdc,_0x3e213f)[_0x161c('0xf')](function(_0x3c594c){logger[_0x161c('0x10')](_0x161c('0x11'),_0x5bdbb7,_0x161c('0x12'));logger[_0x161c('0x13')](_0x161c('0x14'),_0x5bdbb7,'request\x20sent',JSON['stringify'](_0x3c594c));if(_0x3c594c['error']){if(_0x3c594c['error']['code']===0x1f4){logger[_0x161c('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5bdbb7,_0x3c594c[_0x161c('0x15')]['message']);return _0x2cf1d6(_0x3c594c[_0x161c('0x15')][_0x161c('0x16')]);}logger[_0x161c('0x15')](_0x161c('0x11'),_0x5bdbb7,_0x3c594c[_0x161c('0x15')][_0x161c('0x16')]);return _0x2961c6(_0x3c594c[_0x161c('0x15')]['message']);}else{logger[_0x161c('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5bdbb7,_0x161c('0x12'));_0x2961c6(_0x3c594c['result'][_0x161c('0x16')]);}})[_0x161c('0x17')](function(_0x241608){logger[_0x161c('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5bdbb7,_0x241608);_0x2cf1d6(_0x241608);});});}exports[_0x161c('0x18')]=function(_0xb24294){var _0x5cf08d=this;return new Promise(function(_0x98ced5,_0x4458f8){return db['ChatInteraction'][_0x161c('0x19')](_0xb24294[_0x161c('0x1a')],{'raw':_0xb24294[_0x161c('0x1b')]?_0xb24294[_0x161c('0x1b')][_0x161c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb24294[_0x161c('0x1b')]?_0xb24294['options'][_0x161c('0x1d')]||null:null,'attributes':_0xb24294['options']?_0xb24294['options'][_0x161c('0x1e')]||null:null,'limit':_0xb24294['options']?_0xb24294['options'][_0x161c('0x1f')]||null:null})['then'](function(_0x5e4904){logger[_0x161c('0x10')](_0x161c('0x18'),_0xb24294);logger['debug'](_0x161c('0x18'),_0xb24294,JSON[_0x161c('0x20')](_0x5e4904));_0x98ced5(_0x5e4904);})[_0x161c('0x17')](function(_0x2cadc4){logger[_0x161c('0x15')]('UpdateChatInteraction',_0x2cadc4[_0x161c('0x16')],_0xb24294);_0x4458f8(_0x5cf08d[_0x161c('0x15')](0x1f4,_0x2cadc4[_0x161c('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0xf06b40){return new Promise(function(_0x5a58ec,_0x276534){return db[_0x161c('0x21')]['find']({'where':_0xf06b40[_0x161c('0x1b')]?_0xf06b40[_0x161c('0x1b')]['where']||null:null})['then'](function(_0x443d88){if(_0x443d88){return _0x443d88[_0x161c('0x22')](_0xf06b40[_0x161c('0x1a')]['ids'],_[_0x161c('0x23')](_0xf06b40[_0x161c('0x1a')],[_0x161c('0x24'),'id'])||{});}})[_0x161c('0x25')](function(_0x5f2325){logger[_0x161c('0x10')](_0x161c('0x26'),_0xf06b40);logger[_0x161c('0x13')](_0x161c('0x26'),_0xf06b40,JSON[_0x161c('0x20')](_0x5f2325));_0x5a58ec(_0x5f2325);})['catch'](function(_0x2b9f4a){logger[_0x161c('0x15')](_0x161c('0x26'),_0x2b9f4a[_0x161c('0x16')],_0xf06b40);_0x276534(_this[_0x161c('0x15')](0x1f4,_0x2b9f4a[_0x161c('0x16')]));});});}; \ No newline at end of file +var _0x18e8=['redis','localhost','register','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','then','debug','AddTagsToChatInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x264a70,_0x57194a){var _0x3c8638=function(_0x2cc1ae){while(--_0x2cc1ae){_0x264a70['push'](_0x264a70['shift']());}};_0x3c8638(++_0x57194a);}(_0x18e8,0x106));var _0x818e=function(_0x2cdadd,_0x40d6d0){_0x2cdadd=_0x2cdadd-0x0;var _0x3dd479=_0x18e8[_0x2cdadd];return _0x3dd479;};'use strict';var _=require(_0x818e('0x0'));var util=require(_0x818e('0x1'));var moment=require(_0x818e('0x2'));var BPromise=require(_0x818e('0x3'));var rs=require(_0x818e('0x4'));var fs=require('fs');var Redis=require(_0x818e('0x5'));var db=require(_0x818e('0x6'))['db'];var utils=require(_0x818e('0x7'));var logger=require(_0x818e('0x8'))(_0x818e('0x9'));var config=require('../../config/environment');var jayson=require(_0x818e('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x818e('0xb')],{'host':_0x818e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x818e('0xb')]));require('./chatInteraction.socket')[_0x818e('0xd')](socket);function respondWithRpcPromise(_0x26dfc5,_0x27d281,_0x5df5ab){return new BPromise(function(_0x436b2a,_0x2abb44){return client['request'](_0x26dfc5,_0x5df5ab)['then'](function(_0x1117af){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x27d281,_0x818e('0xe'));logger['debug'](_0x818e('0xf'),_0x27d281,'request\x20sent',JSON[_0x818e('0x10')](_0x1117af));if(_0x1117af[_0x818e('0x11')]){if(_0x1117af['error'][_0x818e('0x12')]===0x1f4){logger[_0x818e('0x11')](_0x818e('0x13'),_0x27d281,_0x1117af['error'][_0x818e('0x14')]);return _0x2abb44(_0x1117af[_0x818e('0x11')][_0x818e('0x14')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x27d281,_0x1117af[_0x818e('0x11')][_0x818e('0x14')]);return _0x436b2a(_0x1117af[_0x818e('0x11')]['message']);}else{logger[_0x818e('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x27d281,_0x818e('0xe'));_0x436b2a(_0x1117af[_0x818e('0x16')][_0x818e('0x14')]);}})[_0x818e('0x17')](function(_0x122354){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x27d281,_0x122354);_0x2abb44(_0x122354);});});}exports[_0x818e('0x18')]=function(_0x399b8d){var _0x4b6cad=this;return new Promise(function(_0xd7358e,_0x240b2b){return db[_0x818e('0x19')][_0x818e('0x1a')](_0x399b8d[_0x818e('0x1b')],{'raw':_0x399b8d[_0x818e('0x1c')]?_0x399b8d[_0x818e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399b8d[_0x818e('0x1c')]?_0x399b8d[_0x818e('0x1c')][_0x818e('0x1d')]||null:null,'attributes':_0x399b8d[_0x818e('0x1c')]?_0x399b8d[_0x818e('0x1c')][_0x818e('0x1e')]||null:null,'limit':_0x399b8d['options']?_0x399b8d[_0x818e('0x1c')][_0x818e('0x1f')]||null:null})[_0x818e('0x20')](function(_0xfcdca0){logger[_0x818e('0x15')](_0x818e('0x18'),_0x399b8d);logger[_0x818e('0x21')]('UpdateChatInteraction',_0x399b8d,JSON['stringify'](_0xfcdca0));_0xd7358e(_0xfcdca0);})[_0x818e('0x17')](function(_0x1d2d3f){logger[_0x818e('0x11')]('UpdateChatInteraction',_0x1d2d3f[_0x818e('0x14')],_0x399b8d);_0x240b2b(_0x4b6cad[_0x818e('0x11')](0x1f4,_0x1d2d3f[_0x818e('0x14')]));});});};exports[_0x818e('0x22')]=function(_0x2deb9b){return new Promise(function(_0x1d3c88,_0x5bde13){return db[_0x818e('0x19')][_0x818e('0x23')]({'where':_0x2deb9b[_0x818e('0x1c')]?_0x2deb9b[_0x818e('0x1c')][_0x818e('0x1d')]||null:null})['then'](function(_0x3ea78a){if(_0x3ea78a){return _0x3ea78a['addTags'](_0x2deb9b[_0x818e('0x1b')][_0x818e('0x24')],_['omit'](_0x2deb9b[_0x818e('0x1b')],[_0x818e('0x24'),'id'])||{});}})[_0x818e('0x25')](function(_0x3e5312){logger[_0x818e('0x15')]('AddTags',_0x2deb9b);logger[_0x818e('0x21')](_0x818e('0x26'),_0x2deb9b,JSON[_0x818e('0x10')](_0x3e5312));_0x1d3c88(_0x3e5312);})[_0x818e('0x17')](function(_0x50ee8f){logger[_0x818e('0x11')]('AddTags',_0x50ee8f['message'],_0x2deb9b);_0x5bde13(_this[_0x818e('0x11')](0x1f4,_0x50ee8f[_0x818e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b1d1d4b..8ba6ac8 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 _0x68d7=['emit','removeListener','length','./chatInteraction.events','update'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x68d7,0x102));var _0x768d=function(_0x49d4f5,_0x2364cc){_0x49d4f5=_0x49d4f5-0x0;var _0x1af8e2=_0x68d7[_0x49d4f5];return _0x1af8e2;};'use strict';var ChatInteractionEvents=require(_0x768d('0x0'));var events=['save','remove',_0x768d('0x1')];function createListener(_0x54b0d2,_0x2b0a0e){return function(_0x1d1608){_0x2b0a0e[_0x768d('0x2')](_0x54b0d2,_0x1d1608);};}function removeListener(_0x1ae73b,_0x5553fb){return function(){ChatInteractionEvents[_0x768d('0x3')](_0x1ae73b,_0x5553fb);};}exports['register']=function(_0x4e88b1){for(var _0x118229=0x0,_0x5cd238=events[_0x768d('0x4')];_0x118229<_0x5cd238;_0x118229++){var _0x156b91=events[_0x118229];var _0x292f69=createListener('chatInteraction:'+_0x156b91,_0x4e88b1);ChatInteractionEvents['on'](_0x156b91,_0x292f69);}}; \ No newline at end of file +var _0x9e8e=['update','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x2883f9,_0x3f78ea){var _0x506f0b=function(_0x3afdf7){while(--_0x3afdf7){_0x2883f9['push'](_0x2883f9['shift']());}};_0x506f0b(++_0x3f78ea);}(_0x9e8e,0x1cb));var _0xe9e8=function(_0x1d5991,_0x5adca3){_0x1d5991=_0x1d5991-0x0;var _0x2be9a1=_0x9e8e[_0x1d5991];return _0x2be9a1;};'use strict';var ChatInteractionEvents=require(_0xe9e8('0x0'));var events=[_0xe9e8('0x1'),_0xe9e8('0x2'),_0xe9e8('0x3')];function createListener(_0x5501df,_0x56a8b4){return function(_0x5171f5){_0x56a8b4['emit'](_0x5501df,_0x5171f5);};}function removeListener(_0x2109fb,_0x2df510){return function(){ChatInteractionEvents[_0xe9e8('0x4')](_0x2109fb,_0x2df510);};}exports[_0xe9e8('0x5')]=function(_0x390331){for(var _0x7b5734=0x0,_0x254e8e=events['length'];_0x7b5734<_0x254e8e;_0x7b5734++){var _0x383a3d=events[_0x7b5734];var _0x367e69=createListener(_0xe9e8('0x6')+_0x383a3d,_0x390331);ChatInteractionEvents['on'](_0x383a3d,_0x367e69);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a1d6991..329b65a 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 _0x8393=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','/:id/abandon','/:id/close','delete','chatinteraction:destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8393,0x1eb));var _0x3839=function(_0x884013,_0x1d7d9f){_0x884013=_0x884013-0x0;var _0xbf3b80=_0x8393[_0x884013];return _0xbf3b80;};'use strict';var multer=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var path=require(_0x3839('0x2'));var timeout=require(_0x3839('0x3'));var express=require(_0x3839('0x4'));var router=express[_0x3839('0x5')]();var fs_extra=require(_0x3839('0x6'));var auth=require(_0x3839('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3839('0x8'));var controller=require(_0x3839('0x9'));router[_0x3839('0xa')]('/',auth['isAuthenticated'](),controller[_0x3839('0xb')]);router[_0x3839('0xa')](_0x3839('0xc'),auth[_0x3839('0xd')](),controller[_0x3839('0xe')]);router[_0x3839('0xa')](_0x3839('0xf'),auth[_0x3839('0x10')](),controller[_0x3839('0x11')]);router['get'](_0x3839('0x12'),auth[_0x3839('0x10')](),controller[_0x3839('0x13')]);router[_0x3839('0xa')](_0x3839('0x14'),auth['isAuthenticated'](),controller[_0x3839('0x15')]);router[_0x3839('0xa')](_0x3839('0x16'),auth[_0x3839('0x10')](),controller[_0x3839('0x17')]);router[_0x3839('0xa')](_0x3839('0x18'),auth[_0x3839('0xd')](),controller[_0x3839('0x19')]);router[_0x3839('0x1a')]('/',auth[_0x3839('0xd')](),controller[_0x3839('0x1b')]);router[_0x3839('0x1a')](_0x3839('0x1c'),auth[_0x3839('0xd')](),controller[_0x3839('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ae3eb,_0x571162,_0x1e473b){_0x1e473b(null,path[_0x3839('0x1e')](config['root'],_0x3839('0x1f')));},'filename':function(_0x4d4449,_0x1543ee,_0x2af126){_0x2af126(null,util[_0x3839('0x20')](_0x3839('0x21'),Date[_0x3839('0x22')](),_0x1543ee[_0x3839('0x23')][_0x3839('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3839('0x1a')](_0x3839('0x25'),upload[_0x3839('0x26')]('file'),controller[_0x3839('0x27')]);router[_0x3839('0x1a')]('/:id/messages',auth[_0x3839('0x10')](),controller[_0x3839('0x28')]);router[_0x3839('0x1a')]('/:id/tags',auth[_0x3839('0xd')](),interaction[_0x3839('0x29')](_0x3839('0x2a'),_0x3839('0x2b')),controller[_0x3839('0x2c')]);router[_0x3839('0x2d')]('/:id',auth[_0x3839('0xd')](),interaction[_0x3839('0x29')](_0x3839('0x2a'),'chatinteraction:update'),controller['update']);router[_0x3839('0x2d')](_0x3839('0x2e'),controller['customUpdate']);router[_0x3839('0x2d')](_0x3839('0x2f'),auth[_0x3839('0x10')](),controller['abandon']);router[_0x3839('0x2d')](_0x3839('0x30'),controller['close']);router[_0x3839('0x31')](_0x3839('0xf'),auth['isAuthenticated'](),interaction[_0x3839('0x29')](_0x3839('0x2a'),_0x3839('0x32')),controller['destroy']);router[_0x3839('0x31')]('/:id/tags',auth[_0x3839('0xd')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x2ab7=['/:id/custom_update','customUpdate','abandon','/:id/close','close','chatinteraction:destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','getMyMessages','/:id/download','download','post','create','createVidaooSession','join','server/files/attachments/','format','%s-%s','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','put','chat','update'];(function(_0x162492,_0x496830){var _0x367ea2=function(_0x3a5db3){while(--_0x3a5db3){_0x162492['push'](_0x162492['shift']());}};_0x367ea2(++_0x496830);}(_0x2ab7,0xf3));var _0x72ab=function(_0x3b20f0,_0x9aa74){_0x3b20f0=_0x3b20f0-0x0;var _0x250a11=_0x2ab7[_0x3b20f0];return _0x250a11;};'use strict';var multer=require(_0x72ab('0x0'));var util=require(_0x72ab('0x1'));var path=require(_0x72ab('0x2'));var timeout=require(_0x72ab('0x3'));var express=require(_0x72ab('0x4'));var router=express[_0x72ab('0x5')]();var fs_extra=require(_0x72ab('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x72ab('0x7'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x72ab('0x8')]('/',auth[_0x72ab('0x9')](),controller[_0x72ab('0xa')]);router[_0x72ab('0x8')](_0x72ab('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x72ab('0x8')](_0x72ab('0xc'),auth[_0x72ab('0xd')](),controller[_0x72ab('0xe')]);router[_0x72ab('0x8')](_0x72ab('0xf'),auth[_0x72ab('0xd')](),controller[_0x72ab('0x10')]);router[_0x72ab('0x8')]('/:id/messages',auth[_0x72ab('0x9')](),controller[_0x72ab('0x11')]);router[_0x72ab('0x8')]('/:id/my_messages',auth[_0x72ab('0xd')](),controller[_0x72ab('0x12')]);router[_0x72ab('0x8')](_0x72ab('0x13'),auth[_0x72ab('0x9')](),controller[_0x72ab('0x14')]);router[_0x72ab('0x15')]('/',auth[_0x72ab('0x9')](),controller[_0x72ab('0x16')]);router['post']('/:id/vidaoo',auth[_0x72ab('0x9')](),controller[_0x72ab('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28727b,_0x53c3eb,_0x4050b1){_0x4050b1(null,path[_0x72ab('0x18')](config['root'],_0x72ab('0x19')));},'filename':function(_0x322fed,_0x511fd3,_0x5888d7){_0x5888d7(null,util[_0x72ab('0x1a')](_0x72ab('0x1b'),Date['now'](),_0x511fd3[_0x72ab('0x1c')][_0x72ab('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x72ab('0x15')]('/:id/attachment_upload',upload[_0x72ab('0x1e')](_0x72ab('0x1f')),controller[_0x72ab('0x20')]);router[_0x72ab('0x15')]('/:id/messages',auth[_0x72ab('0xd')](),controller[_0x72ab('0x21')]);router[_0x72ab('0x15')](_0x72ab('0x22'),auth['isAuthenticated'](),interaction[_0x72ab('0x23')]('chat','chatinteraction:addtags'),controller['addTags']);router[_0x72ab('0x24')](_0x72ab('0xc'),auth[_0x72ab('0x9')](),interaction[_0x72ab('0x23')](_0x72ab('0x25'),'chatinteraction:update'),controller[_0x72ab('0x26')]);router[_0x72ab('0x24')](_0x72ab('0x27'),controller[_0x72ab('0x28')]);router[_0x72ab('0x24')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x72ab('0x29')]);router[_0x72ab('0x24')](_0x72ab('0x2a'),controller[_0x72ab('0x2b')]);router['delete'](_0x72ab('0xc'),auth[_0x72ab('0x9')](),interaction[_0x72ab('0x23')](_0x72ab('0x25'),_0x72ab('0x2c')),controller['destroy']);router[_0x72ab('0x2d')](_0x72ab('0x22'),auth[_0x72ab('0x9')](),controller[_0x72ab('0x2e')]);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 2c1e5df..276c4a3 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 _0x8390=['INTEGER','exports','TEXT','BOOLEAN'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8390,0x129));var _0x0839=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x8390[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require('sequelize');module[_0x0839('0x0')]={'body':{'type':Sequelize[_0x0839('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0839('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0839('0x3')]}}; \ No newline at end of file +var _0x076d=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x076d,0xd6));var _0xd076=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x076d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xd076('0x0'));module[_0xd076('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd076('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd076('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd076('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c6571cc..a8ff9b1 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 _0x0cab=['mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./chatInternalMessage.socket','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','ChatInternalMessage','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x0cab,0x1a1));var _0xb0ca=function(_0x396274,_0x14e7c6){_0x396274=_0x396274-0x0;var _0x3af79d=_0x0cab[_0x396274];return _0x3af79d;};'use strict';var emlformat=require(_0xb0ca('0x0'));var rimraf=require(_0xb0ca('0x1'));var zipdir=require(_0xb0ca('0x2'));var jsonpatch=require(_0xb0ca('0x3'));var rp=require(_0xb0ca('0x4'));var moment=require(_0xb0ca('0x5'));var BPromise=require(_0xb0ca('0x6'));var Mustache=require(_0xb0ca('0x7'));var util=require(_0xb0ca('0x8'));var path=require(_0xb0ca('0x9'));var sox=require('sox');var csv=require(_0xb0ca('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0ca('0xb'));var _=require(_0xb0ca('0xc'));var squel=require(_0xb0ca('0xd'));var crypto=require('crypto');var jsforce=require(_0xb0ca('0xe'));var deskjs=require(_0xb0ca('0xf'));var toCsv=require(_0xb0ca('0xa'));var querystring=require(_0xb0ca('0x10'));var Papa=require(_0xb0ca('0x11'));var Redis=require(_0xb0ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb0ca('0x13'));var as=require(_0xb0ca('0x14'));var hardwareService=require(_0xb0ca('0x15'));var logger=require(_0xb0ca('0x16'))('api');var utils=require(_0xb0ca('0x17'));var config=require(_0xb0ca('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb0ca('0x19')]=_[_0xb0ca('0x1a')](config[_0xb0ca('0x19')],{'host':_0xb0ca('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb0ca('0x1c'))['register'](socket);function respondWithStatusCode(_0x3ca58c,_0x3d62b7){_0x3d62b7=_0x3d62b7||0xcc;return function(_0x55f254){if(_0x55f254){return _0x3ca58c[_0xb0ca('0x1d')](_0x3d62b7);}return _0x3ca58c[_0xb0ca('0x1e')](_0x3d62b7)['end']();};}function respondWithResult(_0x2db785,_0x205505){_0x205505=_0x205505||0xc8;return function(_0x4ee436){if(_0x4ee436){return _0x2db785[_0xb0ca('0x1e')](_0x205505)[_0xb0ca('0x1f')](_0x4ee436);}};}function respondWithFilteredResult(_0x14583f,_0x5418ff){return function(_0x4fc9f4){if(_0x4fc9f4){var _0x149e19=typeof _0x5418ff[_0xb0ca('0x20')]===_0xb0ca('0x21')&&typeof _0x5418ff['limit']===_0xb0ca('0x21');var _0x40fe5b=_0x4fc9f4['count'];var _0xa3d9d8=_0x149e19?0x0:_0x5418ff[_0xb0ca('0x20')];var _0x271094=_0x149e19?_0x4fc9f4[_0xb0ca('0x22')]:_0x5418ff[_0xb0ca('0x20')]+_0x5418ff[_0xb0ca('0x23')];var _0x1c9bcd;if(_0x271094>=_0x40fe5b){_0x271094=_0x40fe5b;_0x1c9bcd=0xc8;}else{_0x1c9bcd=0xce;}_0x14583f['status'](_0x1c9bcd);return _0x14583f[_0xb0ca('0x24')]('Content-Range',_0xa3d9d8+'-'+_0x271094+'/'+_0x40fe5b)[_0xb0ca('0x1f')](_0x4fc9f4);}return null;};}function patchUpdates(_0x17f26d){return function(_0x56c7f1){try{jsonpatch[_0xb0ca('0x25')](_0x56c7f1,_0x17f26d,!![]);}catch(_0x6bab54){return BPromise[_0xb0ca('0x26')](_0x6bab54);}return _0x56c7f1[_0xb0ca('0x27')]();};}function saveUpdates(_0x4096b0,_0xdbb3ce){return function(_0x2abf64){if(_0x2abf64){return _0x2abf64[_0xb0ca('0x28')](_0x4096b0)[_0xb0ca('0x29')](function(_0x54fa2c){return _0x54fa2c;});}return null;};}function removeEntity(_0x26921f,_0x2b4f92){return function(_0x580156){if(_0x580156){return _0x580156[_0xb0ca('0x2a')]()[_0xb0ca('0x29')](function(){_0x26921f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52facd,_0x55c185){return function(_0x957194){if(!_0x957194){_0x52facd[_0xb0ca('0x1d')](0x194);}return _0x957194;};}function handleError(_0x396cdf,_0x1e5d8f){_0x1e5d8f=_0x1e5d8f||0x1f4;return function(_0x81205a){logger[_0xb0ca('0x2b')](_0x81205a[_0xb0ca('0x2c')]);if(_0x81205a['name']){delete _0x81205a[_0xb0ca('0x2d')];}_0x396cdf['status'](_0x1e5d8f)[_0xb0ca('0x2e')](_0x81205a);};}exports[_0xb0ca('0x2f')]=function(_0x259e75,_0x54a1d0){var _0x24fa2d={},_0x39c5dc={},_0xfd2597={'count':0x0,'rows':[]};var _0x44b9ff=_[_0xb0ca('0x30')](db['ChatInternalMessage']['rawAttributes'],function(_0x636d67){return{'name':_0x636d67[_0xb0ca('0x31')],'type':_0x636d67['type']['key']};});_0x39c5dc[_0xb0ca('0x32')]=_[_0xb0ca('0x30')](_0x44b9ff,_0xb0ca('0x2d'));_0x39c5dc['query']=_[_0xb0ca('0x33')](_0x259e75[_0xb0ca('0x34')]);_0x39c5dc[_0xb0ca('0x35')]=_[_0xb0ca('0x36')](_0x39c5dc[_0xb0ca('0x32')],_0x39c5dc[_0xb0ca('0x34')]);_0x24fa2d[_0xb0ca('0x37')]=_[_0xb0ca('0x36')](_0x39c5dc['model'],qs[_0xb0ca('0x38')](_0x259e75[_0xb0ca('0x34')][_0xb0ca('0x38')]));_0x24fa2d['attributes']=_0x24fa2d[_0xb0ca('0x37')][_0xb0ca('0x39')]?_0x24fa2d[_0xb0ca('0x37')]:_0x39c5dc[_0xb0ca('0x32')];if(!_0x259e75[_0xb0ca('0x34')][_0xb0ca('0x3a')]('nolimit')){_0x24fa2d[_0xb0ca('0x23')]=qs[_0xb0ca('0x23')](_0x259e75['query']['limit']);_0x24fa2d[_0xb0ca('0x20')]=qs[_0xb0ca('0x20')](_0x259e75['query']['offset']);}_0x24fa2d[_0xb0ca('0x3b')]=qs[_0xb0ca('0x3c')](_0x259e75[_0xb0ca('0x34')][_0xb0ca('0x3c')]);_0x24fa2d[_0xb0ca('0x3d')]=qs['filters'](_['pick'](_0x259e75[_0xb0ca('0x34')],_0x39c5dc['filters']),_0x44b9ff);if(_0x259e75[_0xb0ca('0x34')][_0xb0ca('0x3e')]){_0x24fa2d[_0xb0ca('0x3d')]=_[_0xb0ca('0x3f')](_0x24fa2d[_0xb0ca('0x3d')],{'$or':_[_0xb0ca('0x30')](_0x44b9ff,function(_0x3417ed){if(_0x3417ed[_0xb0ca('0x40')]!=='VIRTUAL'){var _0x4fb639={};_0x4fb639[_0x3417ed[_0xb0ca('0x2d')]]={'$like':'%'+_0x259e75[_0xb0ca('0x34')]['filter']+'%'};return _0x4fb639;}})});}_0x24fa2d=_[_0xb0ca('0x3f')]({},_0x24fa2d,_0x259e75[_0xb0ca('0x41')]);var _0x3c34a2={'where':_0x24fa2d[_0xb0ca('0x3d')]};return db[_0xb0ca('0x42')][_0xb0ca('0x22')](_0x3c34a2)[_0xb0ca('0x29')](function(_0x52d31d){_0xfd2597[_0xb0ca('0x22')]=_0x52d31d;if(_0x259e75['query']['includeAll']){_0x24fa2d[_0xb0ca('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xb0ca('0x44')](_0x24fa2d);})['then'](function(_0x5226bd){_0xfd2597[_0xb0ca('0x45')]=_0x5226bd;return _0xfd2597;})['then'](respondWithFilteredResult(_0x54a1d0,_0x24fa2d))[_0xb0ca('0x46')](handleError(_0x54a1d0,null));};exports['show']=function(_0x261c48,_0x31635c){var _0x2aaf5c={'raw':!![],'where':{'id':_0x261c48[_0xb0ca('0x47')]['id']}},_0x5eaf21={};_0x5eaf21['model']=_[_0xb0ca('0x33')](db[_0xb0ca('0x42')][_0xb0ca('0x48')]);_0x5eaf21[_0xb0ca('0x34')]=_[_0xb0ca('0x33')](_0x261c48[_0xb0ca('0x34')]);_0x5eaf21[_0xb0ca('0x35')]=_[_0xb0ca('0x36')](_0x5eaf21[_0xb0ca('0x32')],_0x5eaf21[_0xb0ca('0x34')]);_0x2aaf5c['attributes']=_[_0xb0ca('0x36')](_0x5eaf21[_0xb0ca('0x32')],qs[_0xb0ca('0x38')](_0x261c48[_0xb0ca('0x34')][_0xb0ca('0x38')]));_0x2aaf5c[_0xb0ca('0x37')]=_0x2aaf5c[_0xb0ca('0x37')][_0xb0ca('0x39')]?_0x2aaf5c['attributes']:_0x5eaf21['model'];if(_0x261c48[_0xb0ca('0x34')][_0xb0ca('0x49')]){_0x2aaf5c[_0xb0ca('0x43')]=[{'all':!![]}];}_0x2aaf5c=_[_0xb0ca('0x3f')]({},_0x2aaf5c,_0x261c48[_0xb0ca('0x41')]);return db['ChatInternalMessage'][_0xb0ca('0x4a')](_0x2aaf5c)['then'](handleEntityNotFound(_0x31635c,null))['then'](respondWithResult(_0x31635c,null))[_0xb0ca('0x46')](handleError(_0x31635c,null));};exports['create']=function(_0x4da005,_0x121eec){return db[_0xb0ca('0x42')][_0xb0ca('0x4b')](_0x4da005['body'],{})[_0xb0ca('0x29')](respondWithResult(_0x121eec,0xc9))['catch'](handleError(_0x121eec,null));};exports[_0xb0ca('0x28')]=function(_0x124e4a,_0x16210b){if(_0x124e4a[_0xb0ca('0x4c')]['id']){delete _0x124e4a[_0xb0ca('0x4c')]['id'];}return db[_0xb0ca('0x42')][_0xb0ca('0x4a')]({'where':{'id':_0x124e4a[_0xb0ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x16210b,null))[_0xb0ca('0x29')](saveUpdates(_0x124e4a[_0xb0ca('0x4c')],null))[_0xb0ca('0x29')](respondWithResult(_0x16210b,null))[_0xb0ca('0x46')](handleError(_0x16210b,null));};exports[_0xb0ca('0x2a')]=function(_0x7d73a9,_0x2af7ba){return db[_0xb0ca('0x42')][_0xb0ca('0x4a')]({'where':{'id':_0x7d73a9[_0xb0ca('0x47')]['id']}})[_0xb0ca('0x29')](handleEntityNotFound(_0x2af7ba,null))[_0xb0ca('0x29')](removeEntity(_0x2af7ba,null))['catch'](handleError(_0x2af7ba,null));};exports['describe']=function(_0x28a471,_0x310d67){return db[_0xb0ca('0x42')][_0xb0ca('0x4d')]()['then'](respondWithResult(_0x310d67,null))[_0xb0ca('0x46')](handleError(_0x310d67,null));};function wrapUser(_0x19d96b){return function(_0x1a9d06){var _0x20b816=_0x19d96b[_0xb0ca('0x4e')]({'plain':!![]});_0x20b816[_0xb0ca('0x4f')]=[];if(_0x1a9d06){_0x20b816[_0xb0ca('0x50')]=_0x1a9d06[_0xb0ca('0x51')];_0x20b816['lastMessage']=_0x1a9d06;}else{_0x20b816[_0xb0ca('0x50')]=moment(0x0)['format'](_0xb0ca('0x52'));_0x20b816[_0xb0ca('0x53')]={};}return _0x20b816;};}exports['getUsers']=function(_0x1127f4,_0x210747,_0x1f7639){var _0x35caa2=[];return db[_0xb0ca('0x54')]['findAll']({'where':{'role':[_0xb0ca('0x55'),'admin','user']},'attributes':['id',_0xb0ca('0x56'),_0xb0ca('0x2d'),_0xb0ca('0x57'),_0xb0ca('0x58'),_0xb0ca('0x59'),_0xb0ca('0x5a'),_0xb0ca('0x5b'),_0xb0ca('0x5c'),_0xb0ca('0x5d')],'order':qs['sort'](_0xb0ca('0x5e')),'include':[{'model':db[_0xb0ca('0x5f')],'as':_0xb0ca('0x60'),'attributes':['id',_0xb0ca('0x2d'),_0xb0ca('0x40')],'through':{'attributes':[]}}]})['then'](function(_0x33d1e){if(_0x33d1e){var _0x5cef49=_0x1127f4[_0xb0ca('0x61')][_0xb0ca('0x4e')]({'plain':!![]});if(!_0x5cef49)throw new Error(_0xb0ca('0x62'));if(_0x5cef49[_0xb0ca('0x57')]==='user'){return db['UserProfileSection'][_0xb0ca('0x4a')]({'where':{'name':_0xb0ca('0x63'),'userProfileId':_0x5cef49['userProfileId']},'raw':!![]})[_0xb0ca('0x29')](function(_0x57ca11){if(_0x57ca11){if(_0x57ca11['autoAssociation']===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x57ca11['id']},'raw':!![]})[_0xb0ca('0x29')](function(_0x9c5c54){var _0x327647=[];if(_['isEmpty'](_0x9c5c54)){_0x327647=_['filter'](_0x33d1e,function(_0x2a7d5f){if(_0x2a7d5f[_0xb0ca('0x57')]!==_0xb0ca('0x55')){return _0x2a7d5f;}});return _0x327647;}else{for(var _0x7f533d=0x0;_0x7f533d<_0x33d1e[_0xb0ca('0x39')];_0x7f533d++){var _0x1a7139=_0x33d1e[_0x7f533d];if(_0x1a7139[_0xb0ca('0x57')]===_0xb0ca('0x55')){var _0x3ac620=_[_0xb0ca('0x4a')](_0x9c5c54,function(_0x115baa){return _0x115baa[_0xb0ca('0x64')]===_0x1a7139['id'];});if(_0x3ac620)_0x327647[_0xb0ca('0x65')](_0x1a7139);}else{_0x327647[_0xb0ca('0x65')](_0x1a7139);}}return _0x327647;}});}else{return _0x33d1e;}}else{var _0x5277a4=_['filter'](_0x33d1e,function(_0x56c042){if(_0x56c042[_0xb0ca('0x57')]!==_0xb0ca('0x55')){return _0x56c042;}});return _0x5277a4;}});}else{return _0x33d1e;}}})[_0xb0ca('0x29')](function(_0x53adb2){var _0x524795=[];if(_0x53adb2){_0x35caa2=_0x53adb2;for(var _0x389800=0x0;_0x389800<_0x53adb2[_0xb0ca('0x39')];_0x389800+=0x1){_0x35caa2[_0x389800][_0xb0ca('0x4f')]=[];_0x524795[_0xb0ca('0x65')](db[_0xb0ca('0x42')]['find']({'where':{'FromId':[_0x1127f4[_0xb0ca('0x61')]['id'],_0x53adb2[_0x389800]['id']],'ToId':[_0x1127f4[_0xb0ca('0x61')]['id'],_0x53adb2[_0x389800]['id']],'ChatGroupId':null},'attributes':['id',_0xb0ca('0x51'),_0xb0ca('0x66'),_0xb0ca('0x67'),_0xb0ca('0x68'),'body'],'order':qs[_0xb0ca('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x53adb2[_0x389800])));}return BPromise[_0xb0ca('0x69')](_0x524795);}return[];})[_0xb0ca('0x29')](function(_0x266735){return{'rows':_0x266735,'count':_0x266735['length']};})['then'](respondWithResult(_0x210747,null))['catch'](handleError(_0x210747,null));}; \ No newline at end of file +var _0x3728=['UserProfileResource','push','messages','FromId','ToId','all','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','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','findAll','agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x4b63f2,_0x5c8951){var _0x549b86=function(_0x2e48b1){while(--_0x2e48b1){_0x4b63f2['push'](_0x4b63f2['shift']());}};_0x549b86(++_0x5c8951);}(_0x3728,0x76));var _0x8372=function(_0x3d62c4,_0x13349d){_0x3d62c4=_0x3d62c4-0x0;var _0x75707=_0x3728[_0x3d62c4];return _0x75707;};'use strict';var emlformat=require(_0x8372('0x0'));var rimraf=require(_0x8372('0x1'));var zipdir=require(_0x8372('0x2'));var jsonpatch=require(_0x8372('0x3'));var rp=require(_0x8372('0x4'));var moment=require(_0x8372('0x5'));var BPromise=require(_0x8372('0x6'));var Mustache=require(_0x8372('0x7'));var util=require(_0x8372('0x8'));var path=require(_0x8372('0x9'));var sox=require(_0x8372('0xa'));var csv=require(_0x8372('0xb'));var ejs=require(_0x8372('0xc'));var fs=require('fs');var fs_extra=require(_0x8372('0xd'));var _=require(_0x8372('0xe'));var squel=require(_0x8372('0xf'));var crypto=require('crypto');var jsforce=require(_0x8372('0x10'));var deskjs=require(_0x8372('0x11'));var toCsv=require(_0x8372('0xb'));var querystring=require(_0x8372('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8372('0x13'));var as=require(_0x8372('0x14'));var hardwareService=require(_0x8372('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8372('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8372('0x17'));var db=require(_0x8372('0x18'))['db'];config[_0x8372('0x19')]=_[_0x8372('0x1a')](config['redis'],{'host':_0x8372('0x1b'),'port':0x18eb});var socket=require(_0x8372('0x1c'))(new Redis(config[_0x8372('0x19')]));require(_0x8372('0x1d'))[_0x8372('0x1e')](socket);function respondWithStatusCode(_0x6e2882,_0x3e205b){_0x3e205b=_0x3e205b||0xcc;return function(_0x29a129){if(_0x29a129){return _0x6e2882[_0x8372('0x1f')](_0x3e205b);}return _0x6e2882[_0x8372('0x20')](_0x3e205b)[_0x8372('0x21')]();};}function respondWithResult(_0x5ba241,_0x5aa6a8){_0x5aa6a8=_0x5aa6a8||0xc8;return function(_0xc03fae){if(_0xc03fae){return _0x5ba241[_0x8372('0x20')](_0x5aa6a8)[_0x8372('0x22')](_0xc03fae);}};}function respondWithFilteredResult(_0x5e5280,_0x133eae){return function(_0x4327d3){if(_0x4327d3){var _0x4b332=typeof _0x133eae[_0x8372('0x23')]===_0x8372('0x24')&&typeof _0x133eae[_0x8372('0x25')]===_0x8372('0x24');var _0x2777d7=_0x4327d3['count'];var _0x1377d4=_0x4b332?0x0:_0x133eae[_0x8372('0x23')];var _0xf546c=_0x4b332?_0x4327d3[_0x8372('0x26')]:_0x133eae[_0x8372('0x23')]+_0x133eae[_0x8372('0x25')];var _0x507d63;if(_0xf546c>=_0x2777d7){_0xf546c=_0x2777d7;_0x507d63=0xc8;}else{_0x507d63=0xce;}_0x5e5280[_0x8372('0x20')](_0x507d63);return _0x5e5280['set'](_0x8372('0x27'),_0x1377d4+'-'+_0xf546c+'/'+_0x2777d7)[_0x8372('0x22')](_0x4327d3);}return null;};}function patchUpdates(_0xa82870){return function(_0x25091c){try{jsonpatch[_0x8372('0x28')](_0x25091c,_0xa82870,!![]);}catch(_0x366976){return BPromise[_0x8372('0x29')](_0x366976);}return _0x25091c[_0x8372('0x2a')]();};}function saveUpdates(_0x3b99c2,_0x3ad84c){return function(_0x39d315){if(_0x39d315){return _0x39d315[_0x8372('0x2b')](_0x3b99c2)[_0x8372('0x2c')](function(_0x2350c6){return _0x2350c6;});}return null;};}function removeEntity(_0x58f5cc,_0x5cdb1c){return function(_0x4729df){if(_0x4729df){return _0x4729df['destroy']()[_0x8372('0x2c')](function(){_0x58f5cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3c42,_0x158800){return function(_0x8d56df){if(!_0x8d56df){_0x5b3c42['sendStatus'](0x194);}return _0x8d56df;};}function handleError(_0x11804c,_0x35c687){_0x35c687=_0x35c687||0x1f4;return function(_0x2c189c){logger[_0x8372('0x2d')](_0x2c189c[_0x8372('0x2e')]);if(_0x2c189c[_0x8372('0x2f')]){delete _0x2c189c[_0x8372('0x2f')];}_0x11804c['status'](_0x35c687)[_0x8372('0x30')](_0x2c189c);};}exports[_0x8372('0x31')]=function(_0x2156d9,_0x2b2b01){var _0x3d30c4={},_0x1573fb={},_0x20fd12={'count':0x0,'rows':[]};var _0x1d1132=_[_0x8372('0x32')](db[_0x8372('0x33')]['rawAttributes'],function(_0x2fe5b2){return{'name':_0x2fe5b2[_0x8372('0x34')],'type':_0x2fe5b2[_0x8372('0x35')][_0x8372('0x36')]};});_0x1573fb[_0x8372('0x37')]=_[_0x8372('0x32')](_0x1d1132,_0x8372('0x2f'));_0x1573fb[_0x8372('0x38')]=_[_0x8372('0x39')](_0x2156d9[_0x8372('0x38')]);_0x1573fb[_0x8372('0x3a')]=_[_0x8372('0x3b')](_0x1573fb[_0x8372('0x37')],_0x1573fb[_0x8372('0x38')]);_0x3d30c4[_0x8372('0x3c')]=_[_0x8372('0x3b')](_0x1573fb[_0x8372('0x37')],qs[_0x8372('0x3d')](_0x2156d9['query'][_0x8372('0x3d')]));_0x3d30c4[_0x8372('0x3c')]=_0x3d30c4['attributes'][_0x8372('0x3e')]?_0x3d30c4[_0x8372('0x3c')]:_0x1573fb[_0x8372('0x37')];if(!_0x2156d9[_0x8372('0x38')][_0x8372('0x3f')](_0x8372('0x40'))){_0x3d30c4[_0x8372('0x25')]=qs['limit'](_0x2156d9[_0x8372('0x38')][_0x8372('0x25')]);_0x3d30c4['offset']=qs['offset'](_0x2156d9['query']['offset']);}_0x3d30c4[_0x8372('0x41')]=qs[_0x8372('0x42')](_0x2156d9[_0x8372('0x38')][_0x8372('0x42')]);_0x3d30c4['where']=qs['filters'](_[_0x8372('0x43')](_0x2156d9['query'],_0x1573fb['filters']),_0x1d1132);if(_0x2156d9[_0x8372('0x38')]['filter']){_0x3d30c4[_0x8372('0x44')]=_[_0x8372('0x45')](_0x3d30c4[_0x8372('0x44')],{'$or':_[_0x8372('0x32')](_0x1d1132,function(_0x1a76f1){if(_0x1a76f1[_0x8372('0x35')]!==_0x8372('0x46')){var _0x17de43={};_0x17de43[_0x1a76f1['name']]={'$like':'%'+_0x2156d9[_0x8372('0x38')][_0x8372('0x47')]+'%'};return _0x17de43;}})});}_0x3d30c4=_['merge']({},_0x3d30c4,_0x2156d9[_0x8372('0x48')]);var _0x2af167={'where':_0x3d30c4[_0x8372('0x44')]};return db[_0x8372('0x33')][_0x8372('0x26')](_0x2af167)['then'](function(_0x2abdee){_0x20fd12['count']=_0x2abdee;if(_0x2156d9['query'][_0x8372('0x49')]){_0x3d30c4[_0x8372('0x4a')]=[{'all':!![]}];}return db[_0x8372('0x33')]['findAll'](_0x3d30c4);})['then'](function(_0x4ffd42){_0x20fd12[_0x8372('0x4b')]=_0x4ffd42;return _0x20fd12;})['then'](respondWithFilteredResult(_0x2b2b01,_0x3d30c4))[_0x8372('0x4c')](handleError(_0x2b2b01,null));};exports[_0x8372('0x4d')]=function(_0x31947a,_0x58cbe3){var _0x3d3769={'raw':!![],'where':{'id':_0x31947a[_0x8372('0x4e')]['id']}},_0x3851b5={};_0x3851b5[_0x8372('0x37')]=_['keys'](db[_0x8372('0x33')][_0x8372('0x4f')]);_0x3851b5[_0x8372('0x38')]=_[_0x8372('0x39')](_0x31947a[_0x8372('0x38')]);_0x3851b5[_0x8372('0x3a')]=_[_0x8372('0x3b')](_0x3851b5[_0x8372('0x37')],_0x3851b5['query']);_0x3d3769[_0x8372('0x3c')]=_['intersection'](_0x3851b5['model'],qs[_0x8372('0x3d')](_0x31947a['query'][_0x8372('0x3d')]));_0x3d3769[_0x8372('0x3c')]=_0x3d3769[_0x8372('0x3c')][_0x8372('0x3e')]?_0x3d3769[_0x8372('0x3c')]:_0x3851b5[_0x8372('0x37')];if(_0x31947a['query']['includeAll']){_0x3d3769[_0x8372('0x4a')]=[{'all':!![]}];}_0x3d3769=_[_0x8372('0x45')]({},_0x3d3769,_0x31947a[_0x8372('0x48')]);return db[_0x8372('0x33')][_0x8372('0x50')](_0x3d3769)[_0x8372('0x2c')](handleEntityNotFound(_0x58cbe3,null))[_0x8372('0x2c')](respondWithResult(_0x58cbe3,null))[_0x8372('0x4c')](handleError(_0x58cbe3,null));};exports[_0x8372('0x51')]=function(_0x2d8e0a,_0x28b628){return db['ChatInternalMessage'][_0x8372('0x51')](_0x2d8e0a[_0x8372('0x52')],{})[_0x8372('0x2c')](respondWithResult(_0x28b628,0xc9))[_0x8372('0x4c')](handleError(_0x28b628,null));};exports[_0x8372('0x2b')]=function(_0x49c7a7,_0x1349bd){if(_0x49c7a7[_0x8372('0x52')]['id']){delete _0x49c7a7['body']['id'];}return db[_0x8372('0x33')]['find']({'where':{'id':_0x49c7a7[_0x8372('0x4e')]['id']}})[_0x8372('0x2c')](handleEntityNotFound(_0x1349bd,null))[_0x8372('0x2c')](saveUpdates(_0x49c7a7[_0x8372('0x52')],null))[_0x8372('0x2c')](respondWithResult(_0x1349bd,null))[_0x8372('0x4c')](handleError(_0x1349bd,null));};exports[_0x8372('0x53')]=function(_0x537bcb,_0x427bdd){return db[_0x8372('0x33')][_0x8372('0x50')]({'where':{'id':_0x537bcb[_0x8372('0x4e')]['id']}})[_0x8372('0x2c')](handleEntityNotFound(_0x427bdd,null))[_0x8372('0x2c')](removeEntity(_0x427bdd,null))[_0x8372('0x4c')](handleError(_0x427bdd,null));};exports[_0x8372('0x54')]=function(_0x597365,_0x863b7f){return db[_0x8372('0x33')][_0x8372('0x54')]()[_0x8372('0x2c')](respondWithResult(_0x863b7f,null))[_0x8372('0x4c')](handleError(_0x863b7f,null));};function wrapUser(_0xb5f46e){return function(_0x361dbb){var _0x1da684=_0xb5f46e[_0x8372('0x55')]({'plain':!![]});_0x1da684['messages']=[];if(_0x361dbb){_0x1da684[_0x8372('0x56')]=_0x361dbb[_0x8372('0x57')];_0x1da684[_0x8372('0x58')]=_0x361dbb;}else{_0x1da684[_0x8372('0x56')]=moment(0x0)['format'](_0x8372('0x59'));_0x1da684[_0x8372('0x58')]={};}return _0x1da684;};}exports['getUsers']=function(_0x6d53ee,_0x551cef,_0x329497){var _0x1ec152=[];return db['User'][_0x8372('0x5a')]({'where':{'role':[_0x8372('0x5b'),'admin',_0x8372('0x5c')]},'attributes':['id',_0x8372('0x5d'),_0x8372('0x2f'),_0x8372('0x5e'),'userpic',_0x8372('0x5f'),_0x8372('0x60'),_0x8372('0x61'),_0x8372('0x62'),_0x8372('0x63')],'order':qs[_0x8372('0x42')]('-online'),'include':[{'model':db[_0x8372('0x64')],'as':_0x8372('0x65'),'attributes':['id',_0x8372('0x2f'),_0x8372('0x35')],'through':{'attributes':[]}}]})[_0x8372('0x2c')](function(_0x138508){if(_0x138508){var _0x5f34af=_0x6d53ee[_0x8372('0x5c')][_0x8372('0x55')]({'plain':!![]});if(!_0x5f34af)throw new Error(_0x8372('0x66'));if(_0x5f34af[_0x8372('0x5e')]===_0x8372('0x5c')){return db[_0x8372('0x67')][_0x8372('0x50')]({'where':{'name':'Agents','userProfileId':_0x5f34af[_0x8372('0x68')]},'raw':!![]})['then'](function(_0x46858a){if(_0x46858a){if(_0x46858a[_0x8372('0x69')]===0x0){return db[_0x8372('0x6a')][_0x8372('0x5a')]({'where':{'sectionId':_0x46858a['id']},'raw':!![]})[_0x8372('0x2c')](function(_0x3706b1){var _0x450833=[];if(_['isEmpty'](_0x3706b1)){_0x450833=_[_0x8372('0x47')](_0x138508,function(_0xae5056){if(_0xae5056[_0x8372('0x5e')]!==_0x8372('0x5b')){return _0xae5056;}});return _0x450833;}else{for(var _0x2b7228=0x0;_0x2b7228<_0x138508[_0x8372('0x3e')];_0x2b7228++){var _0xeff257=_0x138508[_0x2b7228];if(_0xeff257['role']===_0x8372('0x5b')){var _0x4a77a3=_['find'](_0x3706b1,function(_0x5b4b17){return _0x5b4b17['resourceId']===_0xeff257['id'];});if(_0x4a77a3)_0x450833['push'](_0xeff257);}else{_0x450833[_0x8372('0x6b')](_0xeff257);}}return _0x450833;}});}else{return _0x138508;}}else{var _0x320247=_[_0x8372('0x47')](_0x138508,function(_0x6f449f){if(_0x6f449f['role']!==_0x8372('0x5b')){return _0x6f449f;}});return _0x320247;}});}else{return _0x138508;}}})[_0x8372('0x2c')](function(_0x8e3fbb){var _0x383c2c=[];if(_0x8e3fbb){_0x1ec152=_0x8e3fbb;for(var _0x14de2e=0x0;_0x14de2e<_0x8e3fbb[_0x8372('0x3e')];_0x14de2e+=0x1){_0x1ec152[_0x14de2e][_0x8372('0x6c')]=[];_0x383c2c[_0x8372('0x6b')](db[_0x8372('0x33')][_0x8372('0x50')]({'where':{'FromId':[_0x6d53ee[_0x8372('0x5c')]['id'],_0x8e3fbb[_0x14de2e]['id']],'ToId':[_0x6d53ee[_0x8372('0x5c')]['id'],_0x8e3fbb[_0x14de2e]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x8372('0x6d'),_0x8372('0x6e'),'read',_0x8372('0x52')],'order':qs[_0x8372('0x42')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8372('0x2c')](wrapUser(_0x8e3fbb[_0x14de2e])));}return BPromise[_0x8372('0x6f')](_0x383c2c);}return[];})[_0x8372('0x2c')](function(_0x16a707){return{'rows':_0x16a707,'count':_0x16a707[_0x8372('0x3e')]};})[_0x8372('0x2c')](respondWithResult(_0x551cef,null))[_0x8372('0x4c')](handleError(_0x551cef,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 23d126e..3050890 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 _0xb08d=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x4f538,_0x5e6870){var _0x4d3201=function(_0x4e133e){while(--_0x4e133e){_0x4f538['push'](_0x4f538['shift']());}};_0x4d3201(++_0x5e6870);}(_0xb08d,0x79));var _0xdb08=function(_0x51a4dd,_0x1135a7){_0x51a4dd=_0x51a4dd-0x0;var _0x51eee3=_0xb08d[_0x51a4dd];return _0x51eee3;};'use strict';var EventEmitter=require(_0xdb08('0x0'));var ChatInternalMessage=require(_0xdb08('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdb08('0x2')](0x0);var events={'afterCreate':_0xdb08('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b3be0){return function(_0x54f61f,_0x1409fa,_0x159504){ChatInternalMessageEvents[_0xdb08('0x4')](_0x3b3be0+':'+_0x54f61f['id'],_0x54f61f);ChatInternalMessageEvents['emit'](_0x3b3be0,_0x54f61f);_0x159504(null);};}for(var e in events){if(events[_0xdb08('0x5')](e)){var event=events[e];ChatInternalMessage[_0xdb08('0x6')](e,emitEvent(event));}}module[_0xdb08('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb411=['save','update','remove','emit','hasOwnProperty','hook','events','ChatInternalMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb411,0x192));var _0x1b41=function(_0x4a2108,_0x12b0e4){_0x4a2108=_0x4a2108-0x0;var _0xef644f=_0xb411[_0x4a2108];return _0xef644f;};'use strict';var EventEmitter=require(_0x1b41('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x1b41('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1b41('0x2')](0x0);var events={'afterCreate':_0x1b41('0x3'),'afterUpdate':_0x1b41('0x4'),'afterDestroy':_0x1b41('0x5')};function emitEvent(_0x23e3f5){return function(_0x57856b,_0xeaedb8,_0x248474){ChatInternalMessageEvents[_0x1b41('0x6')](_0x23e3f5+':'+_0x57856b['id'],_0x57856b);ChatInternalMessageEvents[_0x1b41('0x6')](_0x23e3f5,_0x57856b);_0x248474(null);};}for(var e in events){if(events[_0x1b41('0x7')](e)){var event=events[e];ChatInternalMessage[_0x1b41('0x8')](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 70677ba..df8efa6 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 _0x66d0=['moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xcd49bd,_0x2a12a3){var _0xb6ee44=function(_0x1f77bb){while(--_0x1f77bb){_0xcd49bd['push'](_0xcd49bd['shift']());}};_0xb6ee44(++_0x2a12a3);}(_0x66d0,0x14c));var _0x066d=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x66d0[_0x179c4a];return _0x5d1879;};'use strict';var _=require(_0x066d('0x0'));var util=require(_0x066d('0x1'));var logger=require(_0x066d('0x2'))(_0x066d('0x3'));var moment=require(_0x066d('0x4'));var BPromise=require(_0x066d('0x5'));var rp=require(_0x066d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x066d('0x7'));var attributes=require(_0x066d('0x8'));module[_0x066d('0x9')]=function(_0x1174e2,_0x507bc6){return _0x1174e2[_0x066d('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x066d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x066d('0xc'),'collate':_0x066d('0xd')});}; \ No newline at end of file +var _0xf8a5=['../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xc4a608,_0x45fecd){var _0x5e2730=function(_0x38c3c5){while(--_0x38c3c5){_0xc4a608['push'](_0xc4a608['shift']());}};_0x5e2730(++_0x45fecd);}(_0xf8a5,0xb8));var _0x5f8a=function(_0x5203e1,_0x2931e6){_0x5203e1=_0x5203e1-0x0;var _0x21af77=_0xf8a5[_0x5203e1];return _0x21af77;};'use strict';var _=require(_0x5f8a('0x0'));var util=require(_0x5f8a('0x1'));var logger=require(_0x5f8a('0x2'))('api');var moment=require(_0x5f8a('0x3'));var BPromise=require(_0x5f8a('0x4'));var rp=require(_0x5f8a('0x5'));var fs=require('fs');var path=require(_0x5f8a('0x6'));var rimraf=require(_0x5f8a('0x7'));var config=require(_0x5f8a('0x8'));var attributes=require(_0x5f8a('0x9'));module['exports']=function(_0x102613,_0x55f7a3){return _0x102613[_0x5f8a('0xa')](_0x5f8a('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 85eb502..da7396f 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 _0xb1dc=['debug','request\x20sent','stringify','error','message','ChatInternalMessage,\x20%s,\x20%s','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','then','info'];(function(_0x3a63f8,_0x12ffb7){var _0xcc3568=function(_0x148b70){while(--_0x148b70){_0x3a63f8['push'](_0x3a63f8['shift']());}};_0xcc3568(++_0x12ffb7);}(_0xb1dc,0x133));var _0xcb1d=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0xb1dc[_0x3a4f18];return _0x4c20fc;};'use strict';var _=require('lodash');var util=require(_0xcb1d('0x0'));var moment=require('moment');var BPromise=require(_0xcb1d('0x1'));var rs=require(_0xcb1d('0x2'));var fs=require('fs');var Redis=require(_0xcb1d('0x3'));var db=require(_0xcb1d('0x4'))['db'];var utils=require(_0xcb1d('0x5'));var logger=require(_0xcb1d('0x6'))(_0xcb1d('0x7'));var config=require(_0xcb1d('0x8'));var jayson=require(_0xcb1d('0x9'));var client=jayson[_0xcb1d('0xa')][_0xcb1d('0xb')]({'port':0x232a});config[_0xcb1d('0xc')]=_['defaults'](config[_0xcb1d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcb1d('0xd'))(new Redis(config[_0xcb1d('0xc')]));require(_0xcb1d('0xe'))[_0xcb1d('0xf')](socket);function respondWithRpcPromise(_0x237f59,_0x34c689,_0x58916a){return new BPromise(function(_0x17eaf8,_0x2737db){return client['request'](_0x237f59,_0x58916a)[_0xcb1d('0x10')](function(_0x715a9f){logger[_0xcb1d('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x34c689,'request\x20sent');logger[_0xcb1d('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x34c689,_0xcb1d('0x13'),JSON[_0xcb1d('0x14')](_0x715a9f));if(_0x715a9f[_0xcb1d('0x15')]){if(_0x715a9f[_0xcb1d('0x15')]['code']===0x1f4){logger[_0xcb1d('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x34c689,_0x715a9f[_0xcb1d('0x15')]['message']);return _0x2737db(_0x715a9f[_0xcb1d('0x15')][_0xcb1d('0x16')]);}logger[_0xcb1d('0x15')](_0xcb1d('0x17'),_0x34c689,_0x715a9f[_0xcb1d('0x15')][_0xcb1d('0x16')]);return _0x17eaf8(_0x715a9f[_0xcb1d('0x15')]['message']);}else{logger[_0xcb1d('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x34c689,_0xcb1d('0x13'));_0x17eaf8(_0x715a9f['result'][_0xcb1d('0x16')]);}})[_0xcb1d('0x18')](function(_0x426289){logger[_0xcb1d('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x34c689,_0x426289);_0x2737db(_0x426289);});});} \ No newline at end of file +var _0x22e4=['stringify','error','message','info','result','catch','util','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x22e4,0x1af));var _0x422e=function(_0x1c0ecd,_0x1fe5db){_0x1c0ecd=_0x1c0ecd-0x0;var _0x40ca97=_0x22e4[_0x1c0ecd];return _0x40ca97;};'use strict';var _=require('lodash');var util=require(_0x422e('0x0'));var moment=require('moment');var BPromise=require(_0x422e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x422e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x422e('0x3'))(_0x422e('0x4'));var config=require('../../config/environment');var jayson=require(_0x422e('0x5'));var client=jayson[_0x422e('0x6')]['http']({'port':0x232a});config['redis']=_[_0x422e('0x7')](config[_0x422e('0x8')],{'host':_0x422e('0x9'),'port':0x18eb});var socket=require(_0x422e('0xa'))(new Redis(config[_0x422e('0x8')]));require(_0x422e('0xb'))[_0x422e('0xc')](socket);function respondWithRpcPromise(_0x1b8d88,_0x16c78a,_0x32d87f){return new BPromise(function(_0x291a72,_0x3e9076){return client[_0x422e('0xd')](_0x1b8d88,_0x32d87f)[_0x422e('0xe')](function(_0x4e4bb3){logger['info'](_0x422e('0xf'),_0x16c78a,'request\x20sent');logger[_0x422e('0x10')](_0x422e('0x11'),_0x16c78a,_0x422e('0x12'),JSON[_0x422e('0x13')](_0x4e4bb3));if(_0x4e4bb3[_0x422e('0x14')]){if(_0x4e4bb3[_0x422e('0x14')]['code']===0x1f4){logger[_0x422e('0x14')](_0x422e('0xf'),_0x16c78a,_0x4e4bb3['error'][_0x422e('0x15')]);return _0x3e9076(_0x4e4bb3[_0x422e('0x14')][_0x422e('0x15')]);}logger[_0x422e('0x14')](_0x422e('0xf'),_0x16c78a,_0x4e4bb3['error'][_0x422e('0x15')]);return _0x291a72(_0x4e4bb3[_0x422e('0x14')][_0x422e('0x15')]);}else{logger[_0x422e('0x16')](_0x422e('0xf'),_0x16c78a,'request\x20sent');_0x291a72(_0x4e4bb3[_0x422e('0x17')][_0x422e('0x15')]);}})[_0x422e('0x18')](function(_0x57fa02){logger[_0x422e('0x14')](_0x422e('0xf'),_0x16c78a,_0x57fa02);_0x3e9076(_0x57fa02);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c10d4ae..02d481b 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 _0x0da5=['register','length','chatInternalMessage:','save','remove','update','emit','removeListener'];(function(_0x5b9729,_0x26d3ec){var _0x2cc597=function(_0x48be36){while(--_0x48be36){_0x5b9729['push'](_0x5b9729['shift']());}};_0x2cc597(++_0x26d3ec);}(_0x0da5,0x13b));var _0x50da=function(_0x14404d,_0xf2427f){_0x14404d=_0x14404d-0x0;var _0x45a7d3=_0x0da5[_0x14404d];return _0x45a7d3;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x50da('0x0'),_0x50da('0x1'),_0x50da('0x2')];function createListener(_0x192eef,_0x58ce05){return function(_0x1e3308){_0x58ce05[_0x50da('0x3')](_0x192eef,_0x1e3308);};}function removeListener(_0x3a24e8,_0x45549b){return function(){ChatInternalMessageEvents[_0x50da('0x4')](_0x3a24e8,_0x45549b);};}exports[_0x50da('0x5')]=function(_0x123a86){for(var _0x4172f5=0x0,_0x1aa13a=events[_0x50da('0x6')];_0x4172f5<_0x1aa13a;_0x4172f5++){var _0x52001a=events[_0x4172f5];var _0x1c312b=createListener(_0x50da('0x7')+_0x52001a,_0x123a86);ChatInternalMessageEvents['on'](_0x52001a,_0x1c312b);}}; \ No newline at end of file +var _0xb815=['chatInternalMessage:','./chatInternalMessage.events','remove','emit','length'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0xb815,0x196));var _0x5b81=function(_0xe17e7f,_0x1aa168){_0xe17e7f=_0xe17e7f-0x0;var _0x213147=_0xb815[_0xe17e7f];return _0x213147;};'use strict';var ChatInternalMessageEvents=require(_0x5b81('0x0'));var events=['save',_0x5b81('0x1'),'update'];function createListener(_0x12f6ed,_0x317e50){return function(_0x47eb81){_0x317e50[_0x5b81('0x2')](_0x12f6ed,_0x47eb81);};}function removeListener(_0x37ef1a,_0x271cae){return function(){ChatInternalMessageEvents['removeListener'](_0x37ef1a,_0x271cae);};}exports['register']=function(_0x1afb5c){for(var _0x33dd01=0x0,_0x1a120e=events[_0x5b81('0x3')];_0x33dd01<_0x1a120e;_0x33dd01++){var _0x4ed970=events[_0x33dd01];var _0x22b12a=createListener(_0x5b81('0x4')+_0x4ed970,_0x1afb5c);ChatInternalMessageEvents['on'](_0x4ed970,_0x22b12a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 328a53b..4ec08c5 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 _0x93d2=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','get','/describe','describe','getUsers'];(function(_0x5f5043,_0x3c1c4b){var _0x1fdfd8=function(_0xcd5d0){while(--_0xcd5d0){_0x5f5043['push'](_0x5f5043['shift']());}};_0x1fdfd8(++_0x3c1c4b);}(_0x93d2,0x110));var _0x293d=function(_0x163938,_0x3e0f76){_0x163938=_0x163938-0x0;var _0x2968a5=_0x93d2[_0x163938];return _0x2968a5;};'use strict';var multer=require(_0x293d('0x0'));var util=require(_0x293d('0x1'));var path=require(_0x293d('0x2'));var timeout=require(_0x293d('0x3'));var express=require(_0x293d('0x4'));var router=express[_0x293d('0x5')]();var fs_extra=require(_0x293d('0x6'));var auth=require(_0x293d('0x7'));var interaction=require(_0x293d('0x8'));var config=require(_0x293d('0x9'));var controller=require(_0x293d('0xa'));router['get']('/',auth[_0x293d('0xb')](),controller['index']);router[_0x293d('0xc')](_0x293d('0xd'),auth['isAuthenticated'](),controller[_0x293d('0xe')]);router[_0x293d('0xc')]('/users',auth[_0x293d('0xb')](),controller[_0x293d('0xf')]);router['get'](_0x293d('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x293d('0x11')]('/',auth['isAuthenticated'](),controller[_0x293d('0x12')]);router[_0x293d('0x13')](_0x293d('0x10'),controller[_0x293d('0x14')]);router[_0x293d('0x15')](_0x293d('0x10'),auth['isAuthenticated'](),controller[_0x293d('0x16')]);module[_0x293d('0x17')]=router; \ No newline at end of file +var _0x7e56=['index','/describe','getUsers','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x5a5987,_0x58bc3a){var _0x366fbb=function(_0x540558){while(--_0x540558){_0x5a5987['push'](_0x5a5987['shift']());}};_0x366fbb(++_0x58bc3a);}(_0x7e56,0xf3));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x67e5('0x0'));var util=require('util');var path=require(_0x67e5('0x1'));var timeout=require(_0x67e5('0x2'));var express=require('express');var router=express[_0x67e5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x67e5('0x4'));var config=require(_0x67e5('0x5'));var controller=require(_0x67e5('0x6'));router[_0x67e5('0x7')]('/',auth[_0x67e5('0x8')](),controller[_0x67e5('0x9')]);router['get'](_0x67e5('0xa'),auth[_0x67e5('0x8')](),controller['describe']);router[_0x67e5('0x7')]('/users',auth['isAuthenticated'](),controller[_0x67e5('0xb')]);router[_0x67e5('0x7')]('/:id',auth[_0x67e5('0x8')](),controller[_0x67e5('0xc')]);router[_0x67e5('0xd')]('/',auth[_0x67e5('0x8')](),controller[_0x67e5('0xe')]);router[_0x67e5('0xf')](_0x67e5('0x10'),controller[_0x67e5('0x11')]);router[_0x67e5('0x12')](_0x67e5('0x10'),auth[_0x67e5('0x8')](),controller[_0x67e5('0x13')]);module[_0x67e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 56a85d6..21cee57 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 _0xceb0=['ENUM','out','TEXT','BOOLEAN'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xceb0,0x173));var _0x0ceb=function(_0x18af3d,_0x508f6f){_0x18af3d=_0x18af3d-0x0;var _0x228369=_0xceb0[_0x18af3d];return _0x228369;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0ceb('0x0')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ceb('0x1')]('in',_0x0ceb('0x2')),'defaultValue':_0x0ceb('0x2'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0ceb('0x3')]}}; \ No newline at end of file +var _0xaf4c=['out','DATE','STRING','exports','TEXT','BOOLEAN','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x1fce4d,_0x5020f3){_0x1fce4d=_0x1fce4d-0x0;var _0x3c0ed7=_0xaf4c[_0x1fce4d];return _0x3c0ed7;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'body':{'type':Sequelize[_0xcaf4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcaf4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcaf4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcaf4('0x3')]('in','out'),'defaultValue':_0xcaf4('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcaf4('0x5')]},'providerName':{'type':Sequelize[_0xcaf4('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 60b33c0..a70d384 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 _0xdce5=['send','map','ChatMessage','rawAttributes','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','find','create','body','describe','chat-interactions','accept','chat','read','UserId','agent','get','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','format','SIP/%s','channel','motionChannel','event','EventManager','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','interface','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','name'];(function(_0x1875ff,_0x3affe1){var _0x22cf85=function(_0x531ff8){while(--_0x531ff8){_0x1875ff['push'](_0x1875ff['shift']());}};_0x22cf85(++_0x3affe1);}(_0xdce5,0x1d7));var _0x5dce=function(_0x1cf7f7,_0x13ee25){_0x1cf7f7=_0x1cf7f7-0x0;var _0x1c364c=_0xdce5[_0x1cf7f7];return _0x1c364c;};'use strict';var emlformat=require(_0x5dce('0x0'));var rimraf=require(_0x5dce('0x1'));var zipdir=require(_0x5dce('0x2'));var jsonpatch=require(_0x5dce('0x3'));var rp=require(_0x5dce('0x4'));var moment=require(_0x5dce('0x5'));var BPromise=require(_0x5dce('0x6'));var Mustache=require(_0x5dce('0x7'));var util=require(_0x5dce('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5dce('0x9'));var ejs=require(_0x5dce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5dce('0xb'));var squel=require('squel');var crypto=require(_0x5dce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5dce('0xd'));var toCsv=require(_0x5dce('0x9'));var querystring=require(_0x5dce('0xe'));var Papa=require(_0x5dce('0xf'));var Redis=require(_0x5dce('0x10'));var authService=require(_0x5dce('0x11'));var qs=require(_0x5dce('0x12'));var as=require(_0x5dce('0x13'));var hardwareService=require(_0x5dce('0x14'));var logger=require(_0x5dce('0x15'))(_0x5dce('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dce('0x17'));var db=require(_0x5dce('0x18'))['db'];config[_0x5dce('0x19')]=_[_0x5dce('0x1a')](config[_0x5dce('0x19')],{'host':_0x5dce('0x1b'),'port':0x18eb});var socket=require(_0x5dce('0x1c'))(new Redis(config[_0x5dce('0x19')]));require(_0x5dce('0x1d'))['register'](socket);var jayson=require(_0x5dce('0x1e'));var client=jayson['client'][_0x5dce('0x1f')]({'port':0x232c});var client9002=jayson[_0x5dce('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e2541,_0x4c6474,_0x50c407,_0x1de28d){return new BPromise(function(_0x1aa0d9,_0x3c5299){var _0x32b6f5=_0x1de28d||client;return _0x32b6f5[_0x5dce('0x21')](_0x3e2541,_0x50c407)[_0x5dce('0x22')](function(_0x521350){logger[_0x5dce('0x23')](_0x5dce('0x24'),_0x4c6474,_0x5dce('0x25'));logger[_0x5dce('0x26')](_0x5dce('0x27'),_0x4c6474,'request\x20sent',JSON[_0x5dce('0x28')](_0x521350));if(_0x521350[_0x5dce('0x29')]){if(_0x521350[_0x5dce('0x29')][_0x5dce('0x2a')]===0x1f4){logger[_0x5dce('0x29')]('ChatMessage,\x20%s,\x20%s',_0x4c6474,_0x521350['error'][_0x5dce('0x2b')]);return _0x3c5299(_0x521350[_0x5dce('0x29')][_0x5dce('0x2b')]);}logger[_0x5dce('0x29')](_0x5dce('0x24'),_0x4c6474,_0x521350['error'][_0x5dce('0x2b')]);return _0x1aa0d9(_0x521350['error'][_0x5dce('0x2b')]);}else{logger[_0x5dce('0x23')](_0x5dce('0x24'),_0x4c6474,_0x5dce('0x25'));_0x1aa0d9(_0x521350[_0x5dce('0x2c')][_0x5dce('0x2b')]);}})[_0x5dce('0x2d')](function(_0x22d622){logger[_0x5dce('0x29')]('ChatMessage,\x20%s,\x20%s',_0x4c6474,_0x22d622);_0x3c5299(_0x22d622);});});}function respondWithStatusCode(_0x325091,_0x245e1d){_0x245e1d=_0x245e1d||0xcc;return function(_0x4afd59){if(_0x4afd59){return _0x325091[_0x5dce('0x2e')](_0x245e1d);}return _0x325091[_0x5dce('0x2f')](_0x245e1d)['end']();};}function respondWithResult(_0x3fea45,_0x56ec0b){_0x56ec0b=_0x56ec0b||0xc8;return function(_0x3dd8fe){if(_0x3dd8fe){return _0x3fea45[_0x5dce('0x2f')](_0x56ec0b)[_0x5dce('0x30')](_0x3dd8fe);}};}function respondWithFilteredResult(_0x462416,_0x4a4afc){return function(_0x110758){if(_0x110758){var _0x230a44=typeof _0x4a4afc[_0x5dce('0x31')]===_0x5dce('0x32')&&typeof _0x4a4afc['limit']==='undefined';var _0x4c715a=_0x110758[_0x5dce('0x33')];var _0xa29510=_0x230a44?0x0:_0x4a4afc[_0x5dce('0x31')];var _0x1a1a66=_0x230a44?_0x110758[_0x5dce('0x33')]:_0x4a4afc['offset']+_0x4a4afc[_0x5dce('0x34')];var _0x139710;if(_0x1a1a66>=_0x4c715a){_0x1a1a66=_0x4c715a;_0x139710=0xc8;}else{_0x139710=0xce;}_0x462416[_0x5dce('0x2f')](_0x139710);return _0x462416[_0x5dce('0x35')](_0x5dce('0x36'),_0xa29510+'-'+_0x1a1a66+'/'+_0x4c715a)[_0x5dce('0x30')](_0x110758);}return null;};}function patchUpdates(_0x51c63b){return function(_0xd4f6cd){try{jsonpatch[_0x5dce('0x37')](_0xd4f6cd,_0x51c63b,!![]);}catch(_0x2f61fd){return BPromise[_0x5dce('0x38')](_0x2f61fd);}return _0xd4f6cd[_0x5dce('0x39')]();};}function saveUpdates(_0x5b2cce,_0x579ef9){return function(_0x25d8d0){if(_0x25d8d0){return _0x25d8d0[_0x5dce('0x3a')](_0x5b2cce)[_0x5dce('0x22')](function(_0x133889){return _0x133889;});}return null;};}function removeEntity(_0x4e3cda,_0x3ad68e){return function(_0x142f36){if(_0x142f36){return _0x142f36[_0x5dce('0x3b')]()['then'](function(){_0x4e3cda[_0x5dce('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b16f0,_0x3445c3){return function(_0x5cef13){if(!_0x5cef13){_0x1b16f0['sendStatus'](0x194);}return _0x5cef13;};}function handleError(_0x57f18d,_0x3e6df9){_0x3e6df9=_0x3e6df9||0x1f4;return function(_0x15146f){logger[_0x5dce('0x29')](_0x15146f['stack']);if(_0x15146f[_0x5dce('0x3c')]){delete _0x15146f[_0x5dce('0x3c')];}_0x57f18d[_0x5dce('0x2f')](_0x3e6df9)[_0x5dce('0x3d')](_0x15146f);};}exports['index']=function(_0x2e9e88,_0x4276e7){var _0x1d3a1c={},_0x478a07={},_0x59910d={'count':0x0,'rows':[]};var _0x481943=_[_0x5dce('0x3e')](db[_0x5dce('0x3f')][_0x5dce('0x40')],function(_0x1f2a2e){return{'name':_0x1f2a2e['fieldName'],'type':_0x1f2a2e['type'][_0x5dce('0x41')]};});_0x478a07[_0x5dce('0x42')]=_[_0x5dce('0x3e')](_0x481943,_0x5dce('0x3c'));_0x478a07[_0x5dce('0x43')]=_[_0x5dce('0x44')](_0x2e9e88['query']);_0x478a07[_0x5dce('0x45')]=_['intersection'](_0x478a07[_0x5dce('0x42')],_0x478a07[_0x5dce('0x43')]);_0x1d3a1c[_0x5dce('0x46')]=_['intersection'](_0x478a07['model'],qs[_0x5dce('0x47')](_0x2e9e88['query']['fields']));_0x1d3a1c[_0x5dce('0x46')]=_0x1d3a1c[_0x5dce('0x46')]['length']?_0x1d3a1c['attributes']:_0x478a07[_0x5dce('0x42')];if(!_0x2e9e88[_0x5dce('0x43')][_0x5dce('0x48')](_0x5dce('0x49'))){_0x1d3a1c[_0x5dce('0x34')]=qs[_0x5dce('0x34')](_0x2e9e88[_0x5dce('0x43')][_0x5dce('0x34')]);_0x1d3a1c['offset']=qs[_0x5dce('0x31')](_0x2e9e88['query']['offset']);}_0x1d3a1c[_0x5dce('0x4a')]=qs['sort'](_0x2e9e88[_0x5dce('0x43')][_0x5dce('0x4b')]);_0x1d3a1c[_0x5dce('0x4c')]=qs[_0x5dce('0x45')](_[_0x5dce('0x4d')](_0x2e9e88[_0x5dce('0x43')],_0x478a07[_0x5dce('0x45')]),_0x481943);if(_0x2e9e88[_0x5dce('0x43')][_0x5dce('0x4e')]){_0x1d3a1c['where']=_[_0x5dce('0x4f')](_0x1d3a1c['where'],{'$or':_[_0x5dce('0x3e')](_0x481943,function(_0x1963fd){if(_0x1963fd['type']!==_0x5dce('0x50')){var _0x383851={};_0x383851[_0x1963fd[_0x5dce('0x3c')]]={'$like':'%'+_0x2e9e88[_0x5dce('0x43')][_0x5dce('0x4e')]+'%'};return _0x383851;}})});}_0x1d3a1c=_[_0x5dce('0x4f')]({},_0x1d3a1c,_0x2e9e88[_0x5dce('0x51')]);var _0x185b9a={'where':_0x1d3a1c[_0x5dce('0x4c')]};return db[_0x5dce('0x3f')][_0x5dce('0x33')](_0x185b9a)['then'](function(_0x23c3b5){_0x59910d[_0x5dce('0x33')]=_0x23c3b5;if(_0x2e9e88[_0x5dce('0x43')][_0x5dce('0x52')]){_0x1d3a1c[_0x5dce('0x53')]=[{'all':!![]}];}return db[_0x5dce('0x3f')][_0x5dce('0x54')](_0x1d3a1c);})['then'](function(_0x2b300c){_0x59910d[_0x5dce('0x55')]=_0x2b300c;return _0x59910d;})['then'](respondWithFilteredResult(_0x4276e7,_0x1d3a1c))[_0x5dce('0x2d')](handleError(_0x4276e7,null));};exports['show']=function(_0x42b8e,_0xa454d7){var _0xa6f16f={'raw':!![],'where':{'id':_0x42b8e[_0x5dce('0x56')]['id']}},_0x4af214={};_0x4af214[_0x5dce('0x42')]=_['keys'](db[_0x5dce('0x3f')][_0x5dce('0x40')]);_0x4af214[_0x5dce('0x43')]=_[_0x5dce('0x44')](_0x42b8e['query']);_0x4af214[_0x5dce('0x45')]=_[_0x5dce('0x57')](_0x4af214[_0x5dce('0x42')],_0x4af214[_0x5dce('0x43')]);_0xa6f16f[_0x5dce('0x46')]=_[_0x5dce('0x57')](_0x4af214[_0x5dce('0x42')],qs[_0x5dce('0x47')](_0x42b8e['query']['fields']));_0xa6f16f['attributes']=_0xa6f16f[_0x5dce('0x46')]['length']?_0xa6f16f[_0x5dce('0x46')]:_0x4af214[_0x5dce('0x42')];if(_0x42b8e[_0x5dce('0x43')][_0x5dce('0x52')]){_0xa6f16f[_0x5dce('0x53')]=[{'all':!![]}];}_0xa6f16f=_[_0x5dce('0x4f')]({},_0xa6f16f,_0x42b8e[_0x5dce('0x51')]);return db[_0x5dce('0x3f')][_0x5dce('0x58')](_0xa6f16f)[_0x5dce('0x22')](handleEntityNotFound(_0xa454d7,null))['then'](respondWithResult(_0xa454d7,null))['catch'](handleError(_0xa454d7,null));};exports[_0x5dce('0x59')]=function(_0x56e38e,_0x228ba2){return db[_0x5dce('0x3f')][_0x5dce('0x59')](_0x56e38e[_0x5dce('0x5a')],{})[_0x5dce('0x22')](respondWithResult(_0x228ba2,0xc9))[_0x5dce('0x2d')](handleError(_0x228ba2,null));};exports['update']=function(_0x20487a,_0x4a89fe){if(_0x20487a[_0x5dce('0x5a')]['id']){delete _0x20487a[_0x5dce('0x5a')]['id'];}return db[_0x5dce('0x3f')][_0x5dce('0x58')]({'where':{'id':_0x20487a[_0x5dce('0x56')]['id']}})[_0x5dce('0x22')](handleEntityNotFound(_0x4a89fe,null))['then'](saveUpdates(_0x20487a['body'],null))[_0x5dce('0x22')](respondWithResult(_0x4a89fe,null))[_0x5dce('0x2d')](handleError(_0x4a89fe,null));};exports['destroy']=function(_0x54dd00,_0x316a1e){return db['ChatMessage'][_0x5dce('0x58')]({'where':{'id':_0x54dd00['params']['id']}})['then'](handleEntityNotFound(_0x316a1e,null))['then'](removeEntity(_0x316a1e,null))['catch'](handleError(_0x316a1e,null));};exports[_0x5dce('0x5b')]=function(_0xc1b03f,_0x5642e6){return db[_0x5dce('0x3f')]['describe']()[_0x5dce('0x22')](respondWithResult(_0x5642e6,null))[_0x5dce('0x2d')](handleError(_0x5642e6,null));};var interaction_log=require(_0x5dce('0x15'))(_0x5dce('0x5c'));exports[_0x5dce('0x5d')]=function(_0x24e44c,_0xbd9a2f,_0x313621){var _0x27d014={'agent':{},'channel':_0x5dce('0x5e')};if(_0x24e44c[_0x5dce('0x5a')]['id']){delete _0x24e44c[_0x5dce('0x5a')]['id'];}_0x24e44c[_0x5dce('0x5a')][_0x5dce('0x5f')]=!![];_0x24e44c[_0x5dce('0x5a')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x24e44c[_0x5dce('0x5a')][_0x5dce('0x60')]=_0x24e44c[_0x5dce('0x5a')][_0x5dce('0x60')]||_0x24e44c['user']['id'];_0x27d014[_0x5dce('0x61')]['id']=_0x24e44c['body'][_0x5dce('0x60')];return db[_0x5dce('0x3f')]['find']({'where':{'id':_0x24e44c['params']['id'],'UserId':null}})[_0x5dce('0x22')](handleEntityNotFound(_0xbd9a2f,null))[_0x5dce('0x22')](saveUpdates(_0x24e44c[_0x5dce('0x5a')],null))['then'](function(_0x2441da){if(_0x2441da){_0x27d014['message']=_0x2441da[_0x5dce('0x62')]({'plain':!![]});return db[_0x5dce('0x63')]['find']({'where':{'id':_0x2441da['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xbd9a2f,null))[_0x5dce('0x22')](function(_0x316d10){if(_0x316d10){return _0x316d10['update']({'UserId':_0x24e44c[_0x5dce('0x5a')]['UserId'],'read1stAt':_[_0x5dce('0x64')](_0x316d10[_0x5dce('0x65')])?moment()['format'](_0x5dce('0x66')):undefined});}return null;})[_0x5dce('0x22')](function(_0x25e818){if(_0x25e818){_0x27d014[_0x5dce('0x67')]=_0x25e818[_0x5dce('0x62')]({'plain':!![]});interaction_log['info'](_0x5dce('0x68'),_0x24e44c[_0x5dce('0x69')]['id'],_0x24e44c['user']['name'],_0x24e44c[_0x5dce('0x69')]['role'],_0x27d014[_0x5dce('0x67')]['id'],_0x24e44c[_0x5dce('0x5a')]?JSON[_0x5dce('0x28')](_0x24e44c[_0x5dce('0x5a')]):_0x5dce('0x6a'));return respondWithRpcPromise(_0x5dce('0x6b'),_0x5dce('0x6c'),_0x27d014);}return null;})['then'](function(_0x131596){var _0x993ede='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x131596[_0x5dce('0x2b')][_0x5dce('0x6d')];return db[_0x5dce('0x6e')][_0x5dce('0x43')](_0x993ede,{'type':db[_0x5dce('0x6f')][_0x5dce('0x70')][_0x5dce('0x71')],'raw':!![]})[_0x5dce('0x22')](function(_0x238bed){return _0x238bed;});})[_0x5dce('0x22')](function(_0x5457ca){if(_0x5457ca){_0x27d014[_0x5dce('0x2b')][_0x5dce('0x72')]=_0x5457ca[0x0];if(!_0x24e44c[_0x5dce('0x5a')]['UserId'])return;return db[_0x5dce('0x73')][_0x5dce('0x58')]({'where':{'id':_0x24e44c[_0x5dce('0x5a')]['UserId'],'role':_0x5dce('0x61')},'attributes':['id','name','fullname','email',_0x5dce('0x74')],'raw':!![]});}return null;})[_0x5dce('0x22')](function(_0x40ab79){if(!_0x40ab79)return null;_0x27d014[_0x5dce('0x2b')][_0x5dce('0x61')]=_0x40ab79;return _0x27d014;})['then'](function(_0x10aaba){if(_0x10aaba){if(_0x24e44c[_0x5dce('0x5a')][_0x5dce('0x75')]){_0x27d014[_0x5dce('0x2b')]['interface']=util[_0x5dce('0x76')](_0x5dce('0x77'),_0x24e44c[_0x5dce('0x69')][_0x5dce('0x3c')]);_0x27d014[_0x5dce('0x2b')][_0x5dce('0x78')]=_0x27d014[_0x5dce('0x78')];_0x27d014[_0x5dce('0x2b')][_0x5dce('0x79')]=_0x27d014[_0x5dce('0x78')];_0x27d014[_0x5dce('0x2b')][_0x5dce('0x7a')]=_0x5dce('0x5d');return respondWithRpcPromise(_0x5dce('0x7b'),_0x5dce('0x7b'),{'event':'acceptmessage','message':_[_0x5dce('0x4f')](_0x27d014['message'],JSON[_0x5dce('0x7c')](_0x27d014[_0x5dce('0x67')]['formData']))},client9002)[_0x5dce('0x22')](function(){return _0x27d014;});}return _0x27d014;}return null;})[_0x5dce('0x22')](respondWithResult(_0xbd9a2f,null))[_0x5dce('0x2d')](handleError(_0xbd9a2f,null));};var interaction_log=require(_0x5dce('0x15'))(_0x5dce('0x5c'));exports['reject']=function(_0x127c70,_0x169c3e,_0x1944e5){var _0x315a88={'agent':{},'channel':_0x5dce('0x5e')};if(_0x127c70[_0x5dce('0x5a')]['id']){delete _0x127c70[_0x5dce('0x5a')]['id'];}_0x127c70[_0x5dce('0x5a')]['UserId']=_0x127c70['body'][_0x5dce('0x60')]||_0x127c70[_0x5dce('0x69')]['id'];_0x315a88['agent']['id']=_0x127c70[_0x5dce('0x5a')][_0x5dce('0x60')];return db['ChatMessage'][_0x5dce('0x58')]({'where':{'id':_0x127c70['params']['id'],'UserId':null}})[_0x5dce('0x22')](handleEntityNotFound(_0x169c3e,null))[_0x5dce('0x22')](function(_0x4b844c){if(_0x4b844c){_0x315a88['message']=_0x4b844c[_0x5dce('0x62')]({'plain':!![]});return db[_0x5dce('0x63')][_0x5dce('0x58')]({'where':{'id':_0x4b844c[_0x5dce('0x7d')]}});}return null;})[_0x5dce('0x22')](handleEntityNotFound(_0x169c3e,null))[_0x5dce('0x22')](function(_0x53d15f){if(_0x53d15f){_0x315a88[_0x5dce('0x67')]=_0x53d15f[_0x5dce('0x62')]({'plain':!![]});interaction_log[_0x5dce('0x23')](_0x5dce('0x7e'),_0x127c70[_0x5dce('0x69')]['id'],_0x127c70[_0x5dce('0x69')][_0x5dce('0x3c')],_0x127c70[_0x5dce('0x69')]['role'],_0x315a88[_0x5dce('0x67')]['id'],_0x127c70[_0x5dce('0x5a')]?JSON['stringify'](_0x127c70[_0x5dce('0x5a')]):_0x5dce('0x6a'));return respondWithRpcPromise('RejectMessage',_0x5dce('0x7f'),_0x315a88);}return null;})[_0x5dce('0x22')](function(_0x116cab){var _0x113096=_0x5dce('0x80')+_0x116cab[_0x5dce('0x2b')][_0x5dce('0x6d')];return db['sequelize'][_0x5dce('0x43')](_0x113096,{'type':db['Sequelize']['QueryTypes'][_0x5dce('0x71')],'raw':!![]})[_0x5dce('0x22')](function(_0x56dc1c){return _0x56dc1c;});})[_0x5dce('0x22')](function(_0x2a2949){if(_0x2a2949){_0x315a88[_0x5dce('0x2b')][_0x5dce('0x72')]=_0x2a2949[0x0];if(!_0x127c70[_0x5dce('0x5a')][_0x5dce('0x60')])return;return db[_0x5dce('0x73')][_0x5dce('0x58')]({'where':{'id':_0x127c70[_0x5dce('0x5a')][_0x5dce('0x60')],'role':_0x5dce('0x61')},'attributes':['id',_0x5dce('0x3c'),_0x5dce('0x81'),'email',_0x5dce('0x74')],'raw':!![]});}return null;})[_0x5dce('0x22')](function(_0x27d425){if(!_0x27d425)return null;_0x315a88[_0x5dce('0x2b')]['agent']=_0x27d425;return _0x315a88;})[_0x5dce('0x22')](function(_0x3bcc67){if(_0x3bcc67){_0x3bcc67[_0x5dce('0x2b')][_0x5dce('0x82')]=util[_0x5dce('0x76')](_0x5dce('0x77'),_0x127c70['user'][_0x5dce('0x3c')]);_0x3bcc67[_0x5dce('0x2b')][_0x5dce('0x78')]=_0x315a88[_0x5dce('0x78')];_0x3bcc67['message'][_0x5dce('0x79')]=_0x315a88[_0x5dce('0x78')];_0x3bcc67[_0x5dce('0x2b')][_0x5dce('0x7a')]=_0x5dce('0x38');respondWithRpcPromise(_0x5dce('0x7b'),_0x5dce('0x7b'),{'event':_0x5dce('0x83'),'message':_[_0x5dce('0x4f')](_0x315a88[_0x5dce('0x2b')],JSON['parse'](_0x315a88[_0x5dce('0x67')][_0x5dce('0x84')]))},client9002);return _0x315a88;}return null;})['then'](respondWithResult(_0x169c3e,null))[_0x5dce('0x2d')](handleError(_0x169c3e,null));}; \ No newline at end of file +var _0x29b9=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','find','create','body','params','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','interaction','get','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','SIP/%s','channel','motionChannel','accept','EventManager','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','parse','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','json','save','update','destroy','end','name','send','index','map','ChatMessage','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x2298f1,_0x1bc08e){var _0x49a4ca=function(_0xb552ad){while(--_0xb552ad){_0x2298f1['push'](_0x2298f1['shift']());}};_0x49a4ca(++_0x1bc08e);}(_0x29b9,0xc2));var _0x929b=function(_0x3d7375,_0x126f35){_0x3d7375=_0x3d7375-0x0;var _0x33c5ae=_0x29b9[_0x3d7375];return _0x33c5ae;};'use strict';var emlformat=require(_0x929b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x929b('0x1'));var jsonpatch=require(_0x929b('0x2'));var rp=require(_0x929b('0x3'));var moment=require(_0x929b('0x4'));var BPromise=require(_0x929b('0x5'));var Mustache=require('mustache');var util=require(_0x929b('0x6'));var path=require(_0x929b('0x7'));var sox=require(_0x929b('0x8'));var csv=require(_0x929b('0x9'));var ejs=require(_0x929b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x929b('0xb'));var squel=require(_0x929b('0xc'));var crypto=require('crypto');var jsforce=require(_0x929b('0xd'));var deskjs=require(_0x929b('0xe'));var toCsv=require(_0x929b('0x9'));var querystring=require(_0x929b('0xf'));var Papa=require(_0x929b('0x10'));var Redis=require(_0x929b('0x11'));var authService=require(_0x929b('0x12'));var qs=require(_0x929b('0x13'));var as=require(_0x929b('0x14'));var hardwareService=require(_0x929b('0x15'));var logger=require(_0x929b('0x16'))(_0x929b('0x17'));var utils=require(_0x929b('0x18'));var config=require(_0x929b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x929b('0x1a'))['db'];config[_0x929b('0x1b')]=_[_0x929b('0x1c')](config['redis'],{'host':_0x929b('0x1d'),'port':0x18eb});var socket=require(_0x929b('0x1e'))(new Redis(config['redis']));require(_0x929b('0x1f'))[_0x929b('0x20')](socket);var jayson=require(_0x929b('0x21'));var client=jayson['client'][_0x929b('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d0bc4,_0x1cc5c2,_0x104091,_0x14380c){return new BPromise(function(_0xc80059,_0x534c3c){var _0x3f8ab5=_0x14380c||client;return _0x3f8ab5['request'](_0x4d0bc4,_0x104091)[_0x929b('0x23')](function(_0x39a51c){logger[_0x929b('0x24')](_0x929b('0x25'),_0x1cc5c2,_0x929b('0x26'));logger[_0x929b('0x27')](_0x929b('0x28'),_0x1cc5c2,_0x929b('0x26'),JSON[_0x929b('0x29')](_0x39a51c));if(_0x39a51c['error']){if(_0x39a51c[_0x929b('0x2a')][_0x929b('0x2b')]===0x1f4){logger[_0x929b('0x2a')](_0x929b('0x25'),_0x1cc5c2,_0x39a51c[_0x929b('0x2a')][_0x929b('0x2c')]);return _0x534c3c(_0x39a51c[_0x929b('0x2a')][_0x929b('0x2c')]);}logger[_0x929b('0x2a')](_0x929b('0x25'),_0x1cc5c2,_0x39a51c[_0x929b('0x2a')][_0x929b('0x2c')]);return _0xc80059(_0x39a51c[_0x929b('0x2a')]['message']);}else{logger[_0x929b('0x24')](_0x929b('0x25'),_0x1cc5c2,_0x929b('0x26'));_0xc80059(_0x39a51c[_0x929b('0x2d')]['message']);}})[_0x929b('0x2e')](function(_0x2ca331){logger[_0x929b('0x2a')](_0x929b('0x25'),_0x1cc5c2,_0x2ca331);_0x534c3c(_0x2ca331);});});}function respondWithStatusCode(_0x490d78,_0x1aff88){_0x1aff88=_0x1aff88||0xcc;return function(_0x2f27f9){if(_0x2f27f9){return _0x490d78[_0x929b('0x2f')](_0x1aff88);}return _0x490d78[_0x929b('0x30')](_0x1aff88)['end']();};}function respondWithResult(_0xf6910c,_0x2434cd){_0x2434cd=_0x2434cd||0xc8;return function(_0x371e07){if(_0x371e07){return _0xf6910c[_0x929b('0x30')](_0x2434cd)['json'](_0x371e07);}};}function respondWithFilteredResult(_0x2dc722,_0x2521d5){return function(_0x4b0e71){if(_0x4b0e71){var _0x3518be=typeof _0x2521d5['offset']===_0x929b('0x31')&&typeof _0x2521d5[_0x929b('0x32')]===_0x929b('0x31');var _0x42bd57=_0x4b0e71[_0x929b('0x33')];var _0x6e0991=_0x3518be?0x0:_0x2521d5[_0x929b('0x34')];var _0x201d16=_0x3518be?_0x4b0e71[_0x929b('0x33')]:_0x2521d5[_0x929b('0x34')]+_0x2521d5[_0x929b('0x32')];var _0xdcb3a5;if(_0x201d16>=_0x42bd57){_0x201d16=_0x42bd57;_0xdcb3a5=0xc8;}else{_0xdcb3a5=0xce;}_0x2dc722[_0x929b('0x30')](_0xdcb3a5);return _0x2dc722['set']('Content-Range',_0x6e0991+'-'+_0x201d16+'/'+_0x42bd57)[_0x929b('0x35')](_0x4b0e71);}return null;};}function patchUpdates(_0x153ebe){return function(_0x36cc94){try{jsonpatch['apply'](_0x36cc94,_0x153ebe,!![]);}catch(_0x34c529){return BPromise['reject'](_0x34c529);}return _0x36cc94[_0x929b('0x36')]();};}function saveUpdates(_0x122cec,_0x19ea7){return function(_0x362caf){if(_0x362caf){return _0x362caf[_0x929b('0x37')](_0x122cec)[_0x929b('0x23')](function(_0x52d225){return _0x52d225;});}return null;};}function removeEntity(_0x2027dc,_0x56119f){return function(_0x3a184f){if(_0x3a184f){return _0x3a184f[_0x929b('0x38')]()[_0x929b('0x23')](function(){_0x2027dc[_0x929b('0x30')](0xcc)[_0x929b('0x39')]();});}};}function handleEntityNotFound(_0x4e142f,_0x5a107c){return function(_0x42fe1e){if(!_0x42fe1e){_0x4e142f['sendStatus'](0x194);}return _0x42fe1e;};}function handleError(_0x1bb6e6,_0x987955){_0x987955=_0x987955||0x1f4;return function(_0x6095a2){logger['error'](_0x6095a2['stack']);if(_0x6095a2['name']){delete _0x6095a2[_0x929b('0x3a')];}_0x1bb6e6[_0x929b('0x30')](_0x987955)[_0x929b('0x3b')](_0x6095a2);};}exports[_0x929b('0x3c')]=function(_0x13d037,_0x3fcc31){var _0x7529={},_0x57b483={},_0x388f69={'count':0x0,'rows':[]};var _0x390628=_[_0x929b('0x3d')](db[_0x929b('0x3e')]['rawAttributes'],function(_0x1e17bf){return{'name':_0x1e17bf['fieldName'],'type':_0x1e17bf['type'][_0x929b('0x3f')]};});_0x57b483['model']=_[_0x929b('0x3d')](_0x390628,_0x929b('0x3a'));_0x57b483[_0x929b('0x40')]=_[_0x929b('0x41')](_0x13d037['query']);_0x57b483[_0x929b('0x42')]=_[_0x929b('0x43')](_0x57b483[_0x929b('0x44')],_0x57b483[_0x929b('0x40')]);_0x7529[_0x929b('0x45')]=_[_0x929b('0x43')](_0x57b483[_0x929b('0x44')],qs['fields'](_0x13d037[_0x929b('0x40')][_0x929b('0x46')]));_0x7529[_0x929b('0x45')]=_0x7529[_0x929b('0x45')][_0x929b('0x47')]?_0x7529[_0x929b('0x45')]:_0x57b483['model'];if(!_0x13d037['query'][_0x929b('0x48')](_0x929b('0x49'))){_0x7529['limit']=qs[_0x929b('0x32')](_0x13d037[_0x929b('0x40')][_0x929b('0x32')]);_0x7529[_0x929b('0x34')]=qs[_0x929b('0x34')](_0x13d037[_0x929b('0x40')][_0x929b('0x34')]);}_0x7529[_0x929b('0x4a')]=qs[_0x929b('0x4b')](_0x13d037['query'][_0x929b('0x4b')]);_0x7529[_0x929b('0x4c')]=qs['filters'](_[_0x929b('0x4d')](_0x13d037[_0x929b('0x40')],_0x57b483['filters']),_0x390628);if(_0x13d037[_0x929b('0x40')][_0x929b('0x4e')]){_0x7529[_0x929b('0x4c')]=_[_0x929b('0x4f')](_0x7529[_0x929b('0x4c')],{'$or':_['map'](_0x390628,function(_0x4e1276){if(_0x4e1276[_0x929b('0x50')]!=='VIRTUAL'){var _0x38dc8f={};_0x38dc8f[_0x4e1276[_0x929b('0x3a')]]={'$like':'%'+_0x13d037[_0x929b('0x40')][_0x929b('0x4e')]+'%'};return _0x38dc8f;}})});}_0x7529=_['merge']({},_0x7529,_0x13d037[_0x929b('0x51')]);var _0x595308={'where':_0x7529['where']};return db[_0x929b('0x3e')][_0x929b('0x33')](_0x595308)['then'](function(_0x1cc0e4){_0x388f69[_0x929b('0x33')]=_0x1cc0e4;if(_0x13d037['query'][_0x929b('0x52')]){_0x7529[_0x929b('0x53')]=[{'all':!![]}];}return db[_0x929b('0x3e')][_0x929b('0x54')](_0x7529);})['then'](function(_0x576a5d){_0x388f69['rows']=_0x576a5d;return _0x388f69;})['then'](respondWithFilteredResult(_0x3fcc31,_0x7529))[_0x929b('0x2e')](handleError(_0x3fcc31,null));};exports[_0x929b('0x55')]=function(_0x440fe4,_0x2dd96c){var _0x23465a={'raw':!![],'where':{'id':_0x440fe4['params']['id']}},_0x28d1b0={};_0x28d1b0[_0x929b('0x44')]=_[_0x929b('0x41')](db[_0x929b('0x3e')]['rawAttributes']);_0x28d1b0['query']=_['keys'](_0x440fe4[_0x929b('0x40')]);_0x28d1b0[_0x929b('0x42')]=_[_0x929b('0x43')](_0x28d1b0[_0x929b('0x44')],_0x28d1b0[_0x929b('0x40')]);_0x23465a['attributes']=_['intersection'](_0x28d1b0[_0x929b('0x44')],qs[_0x929b('0x46')](_0x440fe4['query'][_0x929b('0x46')]));_0x23465a[_0x929b('0x45')]=_0x23465a[_0x929b('0x45')][_0x929b('0x47')]?_0x23465a[_0x929b('0x45')]:_0x28d1b0['model'];if(_0x440fe4['query']['includeAll']){_0x23465a[_0x929b('0x53')]=[{'all':!![]}];}_0x23465a=_['merge']({},_0x23465a,_0x440fe4[_0x929b('0x51')]);return db[_0x929b('0x3e')][_0x929b('0x56')](_0x23465a)['then'](handleEntityNotFound(_0x2dd96c,null))['then'](respondWithResult(_0x2dd96c,null))[_0x929b('0x2e')](handleError(_0x2dd96c,null));};exports['create']=function(_0x125de9,_0x299aa8){return db['ChatMessage'][_0x929b('0x57')](_0x125de9[_0x929b('0x58')],{})[_0x929b('0x23')](respondWithResult(_0x299aa8,0xc9))[_0x929b('0x2e')](handleError(_0x299aa8,null));};exports[_0x929b('0x37')]=function(_0x85032,_0x12bf25){if(_0x85032['body']['id']){delete _0x85032['body']['id'];}return db[_0x929b('0x3e')][_0x929b('0x56')]({'where':{'id':_0x85032[_0x929b('0x59')]['id']}})[_0x929b('0x23')](handleEntityNotFound(_0x12bf25,null))[_0x929b('0x23')](saveUpdates(_0x85032[_0x929b('0x58')],null))[_0x929b('0x23')](respondWithResult(_0x12bf25,null))[_0x929b('0x2e')](handleError(_0x12bf25,null));};exports[_0x929b('0x38')]=function(_0x48bdea,_0x410a2a){return db[_0x929b('0x3e')][_0x929b('0x56')]({'where':{'id':_0x48bdea[_0x929b('0x59')]['id']}})[_0x929b('0x23')](handleEntityNotFound(_0x410a2a,null))[_0x929b('0x23')](removeEntity(_0x410a2a,null))[_0x929b('0x2e')](handleError(_0x410a2a,null));};exports[_0x929b('0x5a')]=function(_0x2bbfc2,_0x21b670){return db['ChatMessage']['describe']()[_0x929b('0x23')](respondWithResult(_0x21b670,null))[_0x929b('0x2e')](handleError(_0x21b670,null));};var interaction_log=require('../../config/logger')(_0x929b('0x5b'));exports['accept']=function(_0x21e9f4,_0x487db7,_0x3e9b7d){var _0x329fad={'agent':{},'channel':_0x929b('0x5c')};if(_0x21e9f4[_0x929b('0x58')]['id']){delete _0x21e9f4[_0x929b('0x58')]['id'];}_0x21e9f4[_0x929b('0x58')][_0x929b('0x5d')]=!![];_0x21e9f4[_0x929b('0x58')][_0x929b('0x5e')]=moment()[_0x929b('0x5f')](_0x929b('0x60'));_0x21e9f4['body'][_0x929b('0x61')]=_0x21e9f4[_0x929b('0x58')]['UserId']||_0x21e9f4[_0x929b('0x62')]['id'];_0x329fad['agent']['id']=_0x21e9f4[_0x929b('0x58')][_0x929b('0x61')];return db[_0x929b('0x3e')][_0x929b('0x56')]({'where':{'id':_0x21e9f4[_0x929b('0x59')]['id'],'UserId':null}})[_0x929b('0x23')](handleEntityNotFound(_0x487db7,null))[_0x929b('0x23')](saveUpdates(_0x21e9f4[_0x929b('0x58')],null))[_0x929b('0x23')](function(_0x4e4941){if(_0x4e4941){_0x329fad[_0x929b('0x2c')]=_0x4e4941['get']({'plain':!![]});return db[_0x929b('0x63')][_0x929b('0x56')]({'where':{'id':_0x4e4941[_0x929b('0x64')]}});}return null;})[_0x929b('0x23')](handleEntityNotFound(_0x487db7,null))[_0x929b('0x23')](function(_0x5aaba0){if(_0x5aaba0){return _0x5aaba0[_0x929b('0x37')]({'UserId':_0x21e9f4[_0x929b('0x58')]['UserId'],'read1stAt':_[_0x929b('0x65')](_0x5aaba0['read1stAt'])?moment()[_0x929b('0x5f')](_0x929b('0x60')):undefined});}return null;})[_0x929b('0x23')](function(_0x1aeb86){if(_0x1aeb86){_0x329fad[_0x929b('0x66')]=_0x1aeb86[_0x929b('0x67')]({'plain':!![]});interaction_log[_0x929b('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21e9f4[_0x929b('0x62')]['id'],_0x21e9f4[_0x929b('0x62')]['name'],_0x21e9f4[_0x929b('0x62')][_0x929b('0x68')],_0x329fad['interaction']['id'],_0x21e9f4[_0x929b('0x58')]?JSON['stringify'](_0x21e9f4[_0x929b('0x58')]):_0x929b('0x69'));return respondWithRpcPromise(_0x929b('0x6a'),_0x929b('0x6b'),_0x329fad);}return null;})[_0x929b('0x23')](function(_0x432129){var _0x243962='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x432129[_0x929b('0x2c')][_0x929b('0x6c')];return db[_0x929b('0x6d')][_0x929b('0x40')](_0x243962,{'type':db[_0x929b('0x6e')][_0x929b('0x6f')][_0x929b('0x70')],'raw':!![]})[_0x929b('0x23')](function(_0x2c0c9d){return _0x2c0c9d;});})[_0x929b('0x23')](function(_0x23ddf1){if(_0x23ddf1){_0x329fad[_0x929b('0x2c')][_0x929b('0x71')]=_0x23ddf1[0x0];if(!_0x21e9f4[_0x929b('0x58')][_0x929b('0x61')])return;return db[_0x929b('0x72')][_0x929b('0x56')]({'where':{'id':_0x21e9f4['body'][_0x929b('0x61')],'role':'agent'},'attributes':['id',_0x929b('0x3a'),_0x929b('0x73'),_0x929b('0x74'),_0x929b('0x75')],'raw':!![]});}return null;})[_0x929b('0x23')](function(_0x22f40a){if(!_0x22f40a)return null;_0x329fad[_0x929b('0x2c')][_0x929b('0x76')]=_0x22f40a;return _0x329fad;})[_0x929b('0x23')](function(_0x3eecfe){if(_0x3eecfe){if(_0x21e9f4[_0x929b('0x58')][_0x929b('0x77')]){_0x329fad[_0x929b('0x2c')]['interface']=util[_0x929b('0x5f')](_0x929b('0x78'),_0x21e9f4[_0x929b('0x62')][_0x929b('0x3a')]);_0x329fad[_0x929b('0x2c')][_0x929b('0x79')]=_0x329fad[_0x929b('0x79')];_0x329fad['message'][_0x929b('0x7a')]=_0x329fad[_0x929b('0x79')];_0x329fad[_0x929b('0x2c')]['event']=_0x929b('0x7b');return respondWithRpcPromise(_0x929b('0x7c'),_0x929b('0x7c'),{'event':'acceptmessage','message':_[_0x929b('0x4f')](_0x329fad['message'],JSON['parse'](_0x329fad[_0x929b('0x66')][_0x929b('0x7d')]))},client9002)['then'](function(){return _0x329fad;});}return _0x329fad;}return null;})[_0x929b('0x23')](respondWithResult(_0x487db7,null))[_0x929b('0x2e')](handleError(_0x487db7,null));};var interaction_log=require(_0x929b('0x16'))(_0x929b('0x5b'));exports[_0x929b('0x7e')]=function(_0x1daaef,_0xe0f3,_0x448749){var _0x5cfcbf={'agent':{},'channel':'chat'};if(_0x1daaef[_0x929b('0x58')]['id']){delete _0x1daaef[_0x929b('0x58')]['id'];}_0x1daaef[_0x929b('0x58')]['UserId']=_0x1daaef[_0x929b('0x58')]['UserId']||_0x1daaef['user']['id'];_0x5cfcbf[_0x929b('0x76')]['id']=_0x1daaef[_0x929b('0x58')][_0x929b('0x61')];return db[_0x929b('0x3e')][_0x929b('0x56')]({'where':{'id':_0x1daaef[_0x929b('0x59')]['id'],'UserId':null}})[_0x929b('0x23')](handleEntityNotFound(_0xe0f3,null))[_0x929b('0x23')](function(_0x18a51b){if(_0x18a51b){_0x5cfcbf['message']=_0x18a51b[_0x929b('0x67')]({'plain':!![]});return db['ChatInteraction'][_0x929b('0x56')]({'where':{'id':_0x18a51b['ChatInteractionId']}});}return null;})[_0x929b('0x23')](handleEntityNotFound(_0xe0f3,null))[_0x929b('0x23')](function(_0x361fcc){if(_0x361fcc){_0x5cfcbf['interaction']=_0x361fcc[_0x929b('0x67')]({'plain':!![]});interaction_log[_0x929b('0x24')](_0x929b('0x7f'),_0x1daaef['user']['id'],_0x1daaef[_0x929b('0x62')]['name'],_0x1daaef[_0x929b('0x62')][_0x929b('0x68')],_0x5cfcbf[_0x929b('0x66')]['id'],_0x1daaef['body']?JSON['stringify'](_0x1daaef['body']):_0x929b('0x69'));return respondWithRpcPromise(_0x929b('0x80'),_0x929b('0x81'),_0x5cfcbf);}return null;})[_0x929b('0x23')](function(_0x2060c9){var _0x4e5037=_0x929b('0x82')+_0x2060c9[_0x929b('0x2c')][_0x929b('0x6c')];return db[_0x929b('0x6d')]['query'](_0x4e5037,{'type':db['Sequelize'][_0x929b('0x6f')][_0x929b('0x70')],'raw':!![]})[_0x929b('0x23')](function(_0x35b4cb){return _0x35b4cb;});})[_0x929b('0x23')](function(_0x2f412a){if(_0x2f412a){_0x5cfcbf['message'][_0x929b('0x71')]=_0x2f412a[0x0];if(!_0x1daaef['body']['UserId'])return;return db['User'][_0x929b('0x56')]({'where':{'id':_0x1daaef['body'][_0x929b('0x61')],'role':'agent'},'attributes':['id','name',_0x929b('0x73'),_0x929b('0x74'),_0x929b('0x75')],'raw':!![]});}return null;})[_0x929b('0x23')](function(_0xd14002){if(!_0xd14002)return null;_0x5cfcbf[_0x929b('0x2c')][_0x929b('0x76')]=_0xd14002;return _0x5cfcbf;})['then'](function(_0x243664){if(_0x243664){_0x243664[_0x929b('0x2c')][_0x929b('0x83')]=util[_0x929b('0x5f')]('SIP/%s',_0x1daaef[_0x929b('0x62')]['name']);_0x243664['message']['channel']=_0x5cfcbf[_0x929b('0x79')];_0x243664[_0x929b('0x2c')]['motionChannel']=_0x5cfcbf[_0x929b('0x79')];_0x243664[_0x929b('0x2c')]['event']=_0x929b('0x7e');respondWithRpcPromise(_0x929b('0x7c'),_0x929b('0x7c'),{'event':'rejectmessage','message':_[_0x929b('0x4f')](_0x5cfcbf[_0x929b('0x2c')],JSON[_0x929b('0x84')](_0x5cfcbf[_0x929b('0x66')][_0x929b('0x7d')]))},client9002);return _0x5cfcbf;}return null;})[_0x929b('0x23')](respondWithResult(_0xe0f3,null))['catch'](handleError(_0xe0f3,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index dfa0173..4936534 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 _0x5c6b=['events','setMaxListeners','save','emit','exports'];(function(_0x14c324,_0x47df95){var _0x42715d=function(_0x5ee708){while(--_0x5ee708){_0x14c324['push'](_0x14c324['shift']());}};_0x42715d(++_0x47df95);}(_0x5c6b,0x131));var _0xb5c6=function(_0x5b2b35,_0x293216){_0x5b2b35=_0x5b2b35-0x0;var _0x4918ba=_0x5c6b[_0x5b2b35];return _0x4918ba;};'use strict';var EventEmitter=require(_0xb5c6('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb5c6('0x1')](0x0);var events={'afterCreate':_0xb5c6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x57abe1){return function(_0x1aef83,_0x3e2d68,_0x42951c){ChatMessageEvents[_0xb5c6('0x3')](_0x57abe1+':'+_0x1aef83['id'],_0x1aef83);ChatMessageEvents[_0xb5c6('0x3')](_0x57abe1,_0x1aef83);_0x42951c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb5c6('0x4')]=ChatMessageEvents; \ No newline at end of file +var _0x42e2=['hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x42e2,0x17a));var _0x242e=function(_0xdff1ad,_0x105f5c){_0xdff1ad=_0xdff1ad-0x0;var _0x27df69=_0x42e2[_0xdff1ad];return _0x27df69;};'use strict';var EventEmitter=require(_0x242e('0x0'));var ChatMessage=require(_0x242e('0x1'))['db'][_0x242e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x242e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x242e('0x4'),'afterDestroy':_0x242e('0x5')};function emitEvent(_0x47b620){return function(_0x2d83a9,_0x5c4d88,_0x4539c2){ChatMessageEvents['emit'](_0x47b620+':'+_0x2d83a9['id'],_0x2d83a9);ChatMessageEvents['emit'](_0x47b620,_0x2d83a9);_0x4539c2(null);};}for(var e in events){if(events[_0x242e('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x242e('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e426175..be0265f 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 _0x7c8e=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','catch','error','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase'];(function(_0x51a8ea,_0x3c6785){var _0x516fb1=function(_0x237192){while(--_0x237192){_0x51a8ea['push'](_0x51a8ea['shift']());}};_0x516fb1(++_0x3c6785);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x369829,_0x5149ad){_0x369829=_0x369829-0x0;var _0xb9c603=_0x7c8e[_0x369829];return _0xb9c603;};'use strict';var _=require('lodash');var util=require(_0xe7c8('0x0'));var logger=require(_0xe7c8('0x1'))(_0xe7c8('0x2'));var moment=require(_0xe7c8('0x3'));var BPromise=require(_0xe7c8('0x4'));var rp=require(_0xe7c8('0x5'));var fs=require('fs');var path=require(_0xe7c8('0x6'));var rimraf=require(_0xe7c8('0x7'));var config=require(_0xe7c8('0x8'));var attributes=require(_0xe7c8('0x9'));module[_0xe7c8('0xa')]=function(_0x1f0a65,_0x293383){return _0x1f0a65[_0xe7c8('0xb')](_0xe7c8('0xc'),attributes,{'tableName':_0xe7c8('0xd'),'paranoid':![],'indexes':[{'name':_0xe7c8('0xe'),'fields':[_0xe7c8('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12ce24,_0xc062a2,_0x321566){var _0x50c222=_0x1f0a65[_0xe7c8('0x10')];var _0x329b4c=_0x12ce24[_0xe7c8('0x11')]({'plain':!![]});if(_0x329b4c[_0xe7c8('0x12')][_0xe7c8('0x13')]()==='in'||_0x329b4c[_0xe7c8('0x12')]['toLowerCase']()==='out'&&!_0x329b4c[_0xe7c8('0x14')]&&!_[_0xe7c8('0x15')](_0x329b4c[_0xe7c8('0x16')])){_0x50c222[_0xe7c8('0x17')][_0xe7c8('0x18')]({'where':{'id':_0x329b4c[_0xe7c8('0x19')]}})['then'](function(_0x53b2ac){if(_0x53b2ac){_0x53b2ac[_0xe7c8('0x1a')]({'lastMsgAt':_0x329b4c['createdAt'],'lastMsgDirection':_0x329b4c['direction'][_0xe7c8('0x13')]()});}})[_0xe7c8('0x1b')](function(_0x564250){console[_0xe7c8('0x1c')](_0x564250);});}_0x321566();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d20=['path','rimraf','../../config/environment','exports','define','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc8aac7,_0x6b014b){var _0x2e5b19=function(_0x47ef32){while(--_0x47ef32){_0xc8aac7['push'](_0xc8aac7['shift']());}};_0x2e5b19(++_0x6b014b);}(_0x8d20,0x1c5));var _0x08d2=function(_0x3f28fa,_0x50cda0){_0x3f28fa=_0x3f28fa-0x0;var _0x206f91=_0x8d20[_0x3f28fa];return _0x206f91;};'use strict';var _=require('lodash');var util=require(_0x08d2('0x0'));var logger=require(_0x08d2('0x1'))(_0x08d2('0x2'));var moment=require(_0x08d2('0x3'));var BPromise=require(_0x08d2('0x4'));var rp=require(_0x08d2('0x5'));var fs=require('fs');var path=require(_0x08d2('0x6'));var rimraf=require(_0x08d2('0x7'));var config=require(_0x08d2('0x8'));var attributes=require('./chatMessage.attributes');module[_0x08d2('0x9')]=function(_0x459e2c,_0x1acbf4){return _0x459e2c[_0x08d2('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x08d2('0xb'),'fields':[_0x08d2('0xc')],'type':_0x08d2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaf964,_0x3ff53f,_0x3f9e21){var _0x3112d0=_0x459e2c['models'];var _0x463135=_0xaf964['get']({'plain':!![]});if(_0x463135[_0x08d2('0xe')][_0x08d2('0xf')]()==='in'||_0x463135[_0x08d2('0xe')]['toLowerCase']()==='out'&&!_0x463135[_0x08d2('0x10')]&&!_[_0x08d2('0x11')](_0x463135[_0x08d2('0x12')])){_0x3112d0[_0x08d2('0x13')][_0x08d2('0x14')]({'where':{'id':_0x463135['ChatInteractionId']}})[_0x08d2('0x15')](function(_0x3c4718){if(_0x3c4718){_0x3c4718[_0x08d2('0x16')]({'lastMsgAt':_0x463135[_0x08d2('0x17')],'lastMsgDirection':_0x463135[_0x08d2('0xe')][_0x08d2('0xf')]()});}})[_0x08d2('0x18')](function(_0x3f355a){console['error'](_0x3f355a);});}_0x3f9e21();}},'charset':_0x08d2('0x19'),'collate':_0x08d2('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index cd0b377..539bc78 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 _0x5abc=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment'];(function(_0x104600,_0x33bb2c){var _0x1b3cca=function(_0x264a1b){while(--_0x264a1b){_0x104600['push'](_0x104600['shift']());}};_0x1b3cca(++_0x33bb2c);}(_0x5abc,0x105));var _0xc5ab=function(_0x364aac,_0x4411a4){_0x364aac=_0x364aac-0x0;var _0x1f330c=_0x5abc[_0x364aac];return _0x1f330c;};'use strict';var _=require(_0xc5ab('0x0'));var util=require(_0xc5ab('0x1'));var moment=require(_0xc5ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5ab('0x3'));var fs=require('fs');var Redis=require(_0xc5ab('0x4'));var db=require(_0xc5ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5ab('0x6'))('rpc');var config=require(_0xc5ab('0x7'));var jayson=require(_0xc5ab('0x8'));var client=jayson[_0xc5ab('0x9')]['http']({'port':0x232a});config[_0xc5ab('0xa')]=_[_0xc5ab('0xb')](config[_0xc5ab('0xa')],{'host':_0xc5ab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5ab('0xa')]));require(_0xc5ab('0xd'))['register'](socket);function respondWithRpcPromise(_0x13358e,_0x1e172,_0x10fcbb){return new BPromise(function(_0x511fb3,_0x14fe45){return client[_0xc5ab('0xe')](_0x13358e,_0x10fcbb)[_0xc5ab('0xf')](function(_0x509941){logger[_0xc5ab('0x10')](_0xc5ab('0x11'),_0x1e172,_0xc5ab('0x12'));logger[_0xc5ab('0x13')](_0xc5ab('0x14'),_0x1e172,_0xc5ab('0x12'),JSON['stringify'](_0x509941));if(_0x509941[_0xc5ab('0x15')]){if(_0x509941[_0xc5ab('0x15')][_0xc5ab('0x16')]===0x1f4){logger[_0xc5ab('0x15')](_0xc5ab('0x11'),_0x1e172,_0x509941[_0xc5ab('0x15')][_0xc5ab('0x17')]);return _0x14fe45(_0x509941['error']['message']);}logger[_0xc5ab('0x15')]('ChatMessage,\x20%s,\x20%s',_0x1e172,_0x509941[_0xc5ab('0x15')][_0xc5ab('0x17')]);return _0x511fb3(_0x509941['error']['message']);}else{logger[_0xc5ab('0x10')](_0xc5ab('0x11'),_0x1e172,_0xc5ab('0x12'));_0x511fb3(_0x509941[_0xc5ab('0x18')]['message']);}})[_0xc5ab('0x19')](function(_0x568a54){logger[_0xc5ab('0x15')](_0xc5ab('0x11'),_0x1e172,_0x568a54);_0x14fe45(_0x568a54);});});}exports[_0xc5ab('0x1a')]=function(_0x3d95c6){var _0x108b42=this;return new Promise(function(_0x295fbb,_0xd86969){return db[_0xc5ab('0x1b')][_0xc5ab('0x1c')](_0x3d95c6[_0xc5ab('0x1d')],{'raw':_0x3d95c6[_0xc5ab('0x1e')]?_0x3d95c6[_0xc5ab('0x1e')][_0xc5ab('0x1f')]===undefined?!![]:![]:!![]})[_0xc5ab('0xf')](function(_0x1818be){logger[_0xc5ab('0x10')](_0xc5ab('0x1a'),_0x3d95c6);logger['debug'](_0xc5ab('0x1a'),_0x3d95c6,JSON[_0xc5ab('0x20')](_0x1818be));_0x295fbb(_0x1818be);})[_0xc5ab('0x19')](function(_0x19355f){logger[_0xc5ab('0x15')](_0xc5ab('0x1a'),_0x19355f[_0xc5ab('0x17')],_0x3d95c6);_0xd86969(_0x108b42[_0xc5ab('0x15')](0x1f4,_0x19355f[_0xc5ab('0x17')]));});});}; \ No newline at end of file +var _0xbb6b=['then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request'];(function(_0x14fa10,_0x1456bd){var _0x14e5fc=function(_0x5501e2){while(--_0x5501e2){_0x14fa10['push'](_0x14fa10['shift']());}};_0x14e5fc(++_0x1456bd);}(_0xbb6b,0x1ed));var _0xbbb6=function(_0x52371a,_0x5c5806){_0x52371a=_0x52371a-0x0;var _0xa155a0=_0xbb6b[_0x52371a];return _0xa155a0;};'use strict';var _=require(_0xbbb6('0x0'));var util=require(_0xbbb6('0x1'));var moment=require('moment');var BPromise=require(_0xbbb6('0x2'));var rs=require(_0xbbb6('0x3'));var fs=require('fs');var Redis=require(_0xbbb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbb6('0x5'));var logger=require('../../config/logger')(_0xbbb6('0x6'));var config=require(_0xbbb6('0x7'));var jayson=require(_0xbbb6('0x8'));var client=jayson[_0xbbb6('0x9')][_0xbbb6('0xa')]({'port':0x232a});config[_0xbbb6('0xb')]=_['defaults'](config[_0xbbb6('0xb')],{'host':_0xbbb6('0xc'),'port':0x18eb});var socket=require(_0xbbb6('0xd'))(new Redis(config[_0xbbb6('0xb')]));require(_0xbbb6('0xe'))[_0xbbb6('0xf')](socket);function respondWithRpcPromise(_0x1e84b5,_0x2d6c46,_0x39e8f6){return new BPromise(function(_0x3032f2,_0x458d17){return client[_0xbbb6('0x10')](_0x1e84b5,_0x39e8f6)[_0xbbb6('0x11')](function(_0x4ebbcf){logger[_0xbbb6('0x12')](_0xbbb6('0x13'),_0x2d6c46,_0xbbb6('0x14'));logger[_0xbbb6('0x15')](_0xbbb6('0x16'),_0x2d6c46,'request\x20sent',JSON[_0xbbb6('0x17')](_0x4ebbcf));if(_0x4ebbcf[_0xbbb6('0x18')]){if(_0x4ebbcf[_0xbbb6('0x18')][_0xbbb6('0x19')]===0x1f4){logger[_0xbbb6('0x18')]('ChatMessage,\x20%s,\x20%s',_0x2d6c46,_0x4ebbcf[_0xbbb6('0x18')]['message']);return _0x458d17(_0x4ebbcf[_0xbbb6('0x18')]['message']);}logger[_0xbbb6('0x18')](_0xbbb6('0x13'),_0x2d6c46,_0x4ebbcf[_0xbbb6('0x18')][_0xbbb6('0x1a')]);return _0x3032f2(_0x4ebbcf['error'][_0xbbb6('0x1a')]);}else{logger[_0xbbb6('0x12')](_0xbbb6('0x13'),_0x2d6c46,_0xbbb6('0x14'));_0x3032f2(_0x4ebbcf[_0xbbb6('0x1b')][_0xbbb6('0x1a')]);}})['catch'](function(_0x4a2f20){logger[_0xbbb6('0x18')](_0xbbb6('0x13'),_0x2d6c46,_0x4a2f20);_0x458d17(_0x4a2f20);});});}exports[_0xbbb6('0x1c')]=function(_0x2e3df8){var _0x55f516=this;return new Promise(function(_0x13e905,_0x56a47d){return db['ChatMessage'][_0xbbb6('0x1d')](_0x2e3df8[_0xbbb6('0x1e')],{'raw':_0x2e3df8[_0xbbb6('0x1f')]?_0x2e3df8['options'][_0xbbb6('0x20')]===undefined?!![]:![]:!![]})[_0xbbb6('0x11')](function(_0x176cd3){logger['info'](_0xbbb6('0x1c'),_0x2e3df8);logger[_0xbbb6('0x15')](_0xbbb6('0x1c'),_0x2e3df8,JSON[_0xbbb6('0x17')](_0x176cd3));_0x13e905(_0x176cd3);})[_0xbbb6('0x21')](function(_0x1032ae){logger[_0xbbb6('0x18')]('CreateChatMessage',_0x1032ae['message'],_0x2e3df8);_0x56a47d(_0x55f516[_0xbbb6('0x18')](0x1f4,_0x1032ae[_0xbbb6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 77953f4..4af9111 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 _0x8819=['removeListener','register','length','chatMessage:','remove','update'];(function(_0xa3d443,_0x121b37){var _0x489486=function(_0x16ecd1){while(--_0x16ecd1){_0xa3d443['push'](_0xa3d443['shift']());}};_0x489486(++_0x121b37);}(_0x8819,0x94));var _0x9881=function(_0x165168,_0x422aec){_0x165168=_0x165168-0x0;var _0x21d907=_0x8819[_0x165168];return _0x21d907;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x9881('0x0'),_0x9881('0x1')];function createListener(_0x317d26,_0x14cd6c){return function(_0x17e6bf){_0x14cd6c['emit'](_0x317d26,_0x17e6bf);};}function removeListener(_0x333d6f,_0x446deb){return function(){ChatMessageEvents[_0x9881('0x2')](_0x333d6f,_0x446deb);};}exports[_0x9881('0x3')]=function(_0x1791fd){for(var _0x2a3664=0x0,_0x5f1d45=events[_0x9881('0x4')];_0x2a3664<_0x5f1d45;_0x2a3664++){var _0x4a6471=events[_0x2a3664];var _0x530547=createListener(_0x9881('0x5')+_0x4a6471,_0x1791fd);ChatMessageEvents['on'](_0x4a6471,_0x530547);}}; \ No newline at end of file +var _0x6dac=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x375c91,_0x3d3ef5){var _0x2ca217=function(_0x2a24a8){while(--_0x2a24a8){_0x375c91['push'](_0x375c91['shift']());}};_0x2ca217(++_0x3d3ef5);}(_0x6dac,0x16e));var _0xc6da=function(_0x1ba798,_0x592e35){_0x1ba798=_0x1ba798-0x0;var _0x2a3c58=_0x6dac[_0x1ba798];return _0x2a3c58;};'use strict';var ChatMessageEvents=require(_0xc6da('0x0'));var events=[_0xc6da('0x1'),_0xc6da('0x2'),_0xc6da('0x3')];function createListener(_0x133ecc,_0x224a52){return function(_0x3391f5){_0x224a52[_0xc6da('0x4')](_0x133ecc,_0x3391f5);};}function removeListener(_0x28663f,_0x338470){return function(){ChatMessageEvents[_0xc6da('0x5')](_0x28663f,_0x338470);};}exports[_0xc6da('0x6')]=function(_0x325f49){for(var _0x5caf49=0x0,_0x1ebd11=events[_0xc6da('0x7')];_0x5caf49<_0x1ebd11;_0x5caf49++){var _0x5a0d8d=events[_0x5caf49];var _0x3047d3=createListener(_0xc6da('0x8')+_0x5a0d8d,_0x325f49);ChatMessageEvents['on'](_0x5a0d8d,_0x3047d3);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 8bc8a34..de7c9b8 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 _0x9efb=['post','tracked','chatmessage:create','create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x3fd27c,_0x291768){var _0x35f210=function(_0x29aa78){while(--_0x29aa78){_0x3fd27c['push'](_0x3fd27c['shift']());}};_0x35f210(++_0x291768);}(_0x9efb,0x9c));var _0xb9ef=function(_0x355c9e,_0x34d280){_0x355c9e=_0x355c9e-0x0;var _0x3c699e=_0x9efb[_0x355c9e];return _0x3c699e;};'use strict';var multer=require(_0xb9ef('0x0'));var util=require(_0xb9ef('0x1'));var path=require(_0xb9ef('0x2'));var timeout=require(_0xb9ef('0x3'));var express=require(_0xb9ef('0x4'));var router=express[_0xb9ef('0x5')]();var fs_extra=require(_0xb9ef('0x6'));var auth=require(_0xb9ef('0x7'));var interaction=require(_0xb9ef('0x8'));var config=require(_0xb9ef('0x9'));var controller=require(_0xb9ef('0xa'));router['get']('/',auth[_0xb9ef('0xb')](),controller[_0xb9ef('0xc')]);router[_0xb9ef('0xd')](_0xb9ef('0xe'),auth[_0xb9ef('0xb')](),controller[_0xb9ef('0xf')]);router[_0xb9ef('0xd')](_0xb9ef('0x10'),auth[_0xb9ef('0xb')](),controller[_0xb9ef('0x11')]);router[_0xb9ef('0x12')]('/',auth[_0xb9ef('0xb')](),interaction[_0xb9ef('0x13')]('chat',_0xb9ef('0x14')),controller[_0xb9ef('0x15')]);router[_0xb9ef('0x16')](_0xb9ef('0x10'),controller['update']);router[_0xb9ef('0x16')]('/:id/accept',auth[_0xb9ef('0xb')](),controller[_0xb9ef('0x17')]);router[_0xb9ef('0x16')](_0xb9ef('0x18'),auth[_0xb9ef('0xb')](),controller[_0xb9ef('0x19')]);router[_0xb9ef('0x1a')](_0xb9ef('0x10'),auth[_0xb9ef('0xb')](),controller[_0xb9ef('0x1b')]);module[_0xb9ef('0x1c')]=router; \ No newline at end of file +var _0x6a84=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','update','put','/:id/reject','reject'];(function(_0xb3b3a0,_0x32567d){var _0x4e3707=function(_0x3f4e84){while(--_0x3f4e84){_0xb3b3a0['push'](_0xb3b3a0['shift']());}};_0x4e3707(++_0x32567d);}(_0x6a84,0x1ce));var _0x46a8=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6a84[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x46a8('0x0'));var util=require(_0x46a8('0x1'));var path=require('path');var timeout=require(_0x46a8('0x2'));var express=require(_0x46a8('0x3'));var router=express[_0x46a8('0x4')]();var fs_extra=require(_0x46a8('0x5'));var auth=require(_0x46a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x46a8('0x7'));var controller=require(_0x46a8('0x8'));router[_0x46a8('0x9')]('/',auth[_0x46a8('0xa')](),controller[_0x46a8('0xb')]);router[_0x46a8('0x9')](_0x46a8('0xc'),auth[_0x46a8('0xa')](),controller[_0x46a8('0xd')]);router['get'](_0x46a8('0xe'),auth[_0x46a8('0xa')](),controller[_0x46a8('0xf')]);router[_0x46a8('0x10')]('/',auth[_0x46a8('0xa')](),interaction['tracked'](_0x46a8('0x11'),_0x46a8('0x12')),controller[_0x46a8('0x13')]);router['put'](_0x46a8('0xe'),controller[_0x46a8('0x14')]);router[_0x46a8('0x15')]('/:id/accept',auth[_0x46a8('0xa')](),controller['accept']);router[_0x46a8('0x15')](_0x46a8('0x16'),auth['isAuthenticated'](),controller[_0x46a8('0x17')]);router[_0x46a8('0x18')](_0x46a8('0xe'),auth['isAuthenticated'](),controller[_0x46a8('0x19')]);module[_0x46a8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9789aa0..7e41317 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 _0x757a=['exports','TEXT'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x757a,0xde));var _0xa757=function(_0x21501c,_0x348a36){_0x21501c=_0x21501c-0x0;var _0x10919e=_0x757a[_0x21501c];return _0x10919e;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x37594c,_0x250938){var _0xc6c829=function(_0x130bba){while(--_0x130bba){_0x37594c['push'](_0x37594c['shift']());}};_0xc6c829(++_0x250938);}(_0x2032,0xd9));var _0x2203=function(_0x1ab733,_0x7c9f0d){_0x1ab733=_0x1ab733-0x0;var _0x3a7aae=_0x2032[_0x1ab733];return _0x3a7aae;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1bb5340..9e3bf76 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(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7a54,0x106));var _0x47a5=function(_0x228f5c,_0x45a7bd){_0x228f5c=_0x228f5c-0x0;var _0x392a3f=_0x7a54[_0x228f5c];return _0x392a3f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x18d049,_0x5c34a2){_0x18d049=_0x18d049-0x0;var _0x3dcb89=_0x7a54[_0x18d049];return _0x3dcb89;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0b3a742..86aee1e 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c1a=['setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2886c6,_0x4c6e6c){var _0x3f0ad0=function(_0x558bc4){while(--_0x558bc4){_0x2886c6['push'](_0x2886c6['shift']());}};_0x3f0ad0(++_0x4c6e6c);}(_0x6c1a,0xf3));var _0xa6c1=function(_0xb1f195,_0x3ad45a){_0xb1f195=_0xb1f195-0x0;var _0x16c1a3=_0x6c1a[_0xb1f195];return _0x16c1a3;};'use strict';var EventEmitter=require(_0xa6c1('0x0'));var ChatOfflineMessage=require(_0xa6c1('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa6c1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa6c1('0x3')};function emitEvent(_0x4b3bcc){return function(_0x200b3a,_0x329395,_0x55f74b){ChatOfflineMessageEvents[_0xa6c1('0x4')](_0x4b3bcc+':'+_0x200b3a['id'],_0x200b3a);ChatOfflineMessageEvents[_0xa6c1('0x4')](_0x4b3bcc,_0x200b3a);_0x55f74b(null);};}for(var e in events){if(events[_0xa6c1('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xa6c1('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe66c=['emit','hasOwnProperty','events','setMaxListeners','save','update','remove'];(function(_0x1bf507,_0x1bc8a3){var _0x589c76=function(_0x1b5b2e){while(--_0x1b5b2e){_0x1bf507['push'](_0x1bf507['shift']());}};_0x589c76(++_0x1bc8a3);}(_0xe66c,0x105));var _0xce66=function(_0x1cfa3c,_0x497aed){_0x1cfa3c=_0x1cfa3c-0x0;var _0x59ca5d=_0xe66c[_0x1cfa3c];return _0x59ca5d;};'use strict';var EventEmitter=require(_0xce66('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xce66('0x1')](0x0);var events={'afterCreate':_0xce66('0x2'),'afterUpdate':_0xce66('0x3'),'afterDestroy':_0xce66('0x4')};function emitEvent(_0x37be0d){return function(_0x15c93a,_0x2fe670,_0x18d8c7){ChatOfflineMessageEvents['emit'](_0x37be0d+':'+_0x15c93a['id'],_0x15c93a);ChatOfflineMessageEvents[_0xce66('0x5')](_0x37be0d,_0x15c93a);_0x18d8c7(null);};}for(var e in events){if(events[_0xce66('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 65af6b3..372150e 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 _0x8eb6=['./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3e04c4,_0x48101b){var _0x543e0f=function(_0x240c8b){while(--_0x240c8b){_0x3e04c4['push'](_0x3e04c4['shift']());}};_0x543e0f(++_0x48101b);}(_0x8eb6,0x15e));var _0x68eb=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x8eb6[_0xbe200f];return _0x192597;};'use strict';var attributes=require(_0x68eb('0x0'));module[_0x68eb('0x1')]=function(_0x103e14){return _0x103e14[_0x68eb('0x2')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68eb('0x3'),'collate':_0x68eb('0x4')});}; \ No newline at end of file +var _0x35d4=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x4637dd,_0x4e2109){var _0x4d97d3=function(_0x3e19cc){while(--_0x3e19cc){_0x4637dd['push'](_0x4637dd['shift']());}};_0x4d97d3(++_0x4e2109);}(_0x35d4,0xcc));var _0x435d=function(_0x1754b3,_0x2bcdba){_0x1754b3=_0x1754b3-0x0;var _0x532628=_0x35d4[_0x1754b3];return _0x532628;};'use strict';var attributes=require(_0x435d('0x0'));module[_0x435d('0x1')]=function(_0x39ecc0){return _0x39ecc0[_0x435d('0x2')](_0x435d('0x3'),attributes,{'tableName':_0x435d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x435d('0x5'),'collate':_0x435d('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4d0ee5b..1a54999 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 _0xa67b=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3a5a57,_0x32a5ab){var _0x7edaa0=function(_0x47e20b){while(--_0x47e20b){_0x3a5a57['push'](_0x3a5a57['shift']());}};_0x7edaa0(++_0x32a5ab);}(_0xa67b,0xc5));var _0xba67=function(_0x336a9f,_0x232328){_0x336a9f=_0x336a9f-0x0;var _0x40831a=_0xa67b[_0x336a9f];return _0x40831a;};'use strict';var _=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var moment=require(_0xba67('0x2'));var BPromise=require('bluebird');var rs=require(_0xba67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba67('0x4'))['db'];var utils=require(_0xba67('0x5'));var logger=require('../../config/logger')(_0xba67('0x6'));var config=require(_0xba67('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba67('0x8')][_0xba67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x375c1c,_0x33cb57,_0x1c9c93){return new BPromise(function(_0xba55d3,_0x5dab7d){return client['request'](_0x375c1c,_0x1c9c93)[_0xba67('0xa')](function(_0x39dc36){logger[_0xba67('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33cb57,_0xba67('0xc'));logger[_0xba67('0xd')](_0xba67('0xe'),_0x33cb57,_0xba67('0xc'),JSON[_0xba67('0xf')](_0x39dc36));if(_0x39dc36['error']){if(_0x39dc36['error'][_0xba67('0x10')]===0x1f4){logger[_0xba67('0x11')](_0xba67('0x12'),_0x33cb57,_0x39dc36[_0xba67('0x11')][_0xba67('0x13')]);return _0x5dab7d(_0x39dc36['error'][_0xba67('0x13')]);}logger[_0xba67('0x11')](_0xba67('0x12'),_0x33cb57,_0x39dc36[_0xba67('0x11')][_0xba67('0x13')]);return _0xba55d3(_0x39dc36[_0xba67('0x11')][_0xba67('0x13')]);}else{logger[_0xba67('0xb')](_0xba67('0x12'),_0x33cb57,_0xba67('0xc'));_0xba55d3(_0x39dc36[_0xba67('0x14')][_0xba67('0x13')]);}})[_0xba67('0x15')](function(_0xe2286c){logger['error'](_0xba67('0x12'),_0x33cb57,_0xe2286c);_0x5dab7d(_0xe2286c);});});} \ No newline at end of file +var _0x5fa1=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','request','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','ChatOfflineMessage,\x20%s,\x20%s','result'];(function(_0x52810b,_0x11859e){var _0x38c9a6=function(_0x3c2ffe){while(--_0x3c2ffe){_0x52810b['push'](_0x52810b['shift']());}};_0x38c9a6(++_0x11859e);}(_0x5fa1,0xbf));var _0x15fa=function(_0x51bed1,_0x459fb8){_0x51bed1=_0x51bed1-0x0;var _0x18b63b=_0x5fa1[_0x51bed1];return _0x18b63b;};'use strict';var _=require('lodash');var util=require(_0x15fa('0x0'));var moment=require(_0x15fa('0x1'));var BPromise=require(_0x15fa('0x2'));var rs=require(_0x15fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x15fa('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x15fa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28230c,_0x181a7f,_0x1de77a){return new BPromise(function(_0x13e1d8,_0x1f1ea9){return client[_0x15fa('0x7')](_0x28230c,_0x1de77a)[_0x15fa('0x8')](function(_0x4d2faa){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x181a7f,_0x15fa('0x9'));logger[_0x15fa('0xa')](_0x15fa('0xb'),_0x181a7f,_0x15fa('0x9'),JSON['stringify'](_0x4d2faa));if(_0x4d2faa['error']){if(_0x4d2faa[_0x15fa('0xc')][_0x15fa('0xd')]===0x1f4){logger[_0x15fa('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x181a7f,_0x4d2faa['error'][_0x15fa('0xe')]);return _0x1f1ea9(_0x4d2faa[_0x15fa('0xc')]['message']);}logger[_0x15fa('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x181a7f,_0x4d2faa[_0x15fa('0xc')][_0x15fa('0xe')]);return _0x13e1d8(_0x4d2faa[_0x15fa('0xc')][_0x15fa('0xe')]);}else{logger[_0x15fa('0xf')](_0x15fa('0x10'),_0x181a7f,_0x15fa('0x9'));_0x13e1d8(_0x4d2faa[_0x15fa('0x11')][_0x15fa('0xe')]);}})[_0x15fa('0x12')](function(_0x3ed2cb){logger[_0x15fa('0xc')](_0x15fa('0x10'),_0x181a7f,_0x3ed2cb);_0x1f1ea9(_0x3ed2cb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 1b3272b..ad6588f 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 _0xd6da=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x205e83,_0x2df5a4){var _0x10bb19=function(_0x41a375){while(--_0x41a375){_0x205e83['push'](_0x205e83['shift']());}};_0x10bb19(++_0x2df5a4);}(_0xd6da,0x192));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xad6d('0x0'));var util=require(_0xad6d('0x1'));var path=require(_0xad6d('0x2'));var timeout=require(_0xad6d('0x3'));var express=require(_0xad6d('0x4'));var router=express[_0xad6d('0x5')]();var fs_extra=require(_0xad6d('0x6'));var auth=require(_0xad6d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xad6d('0x8'));var controller=require(_0xad6d('0x9'));router[_0xad6d('0xa')]('/',auth[_0xad6d('0xb')](),controller[_0xad6d('0xc')]);router[_0xad6d('0xa')](_0xad6d('0xd'),auth['isAuthenticated'](),controller[_0xad6d('0xe')]);router[_0xad6d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xad6d('0xf')]);router[_0xad6d('0x10')]('/',auth[_0xad6d('0xb')](),controller[_0xad6d('0x11')]);router[_0xad6d('0x12')]('/:id',auth[_0xad6d('0xb')](),controller[_0xad6d('0x13')]);router[_0xad6d('0x14')](_0xad6d('0x15'),auth['isAuthenticated'](),controller[_0xad6d('0x16')]);module[_0xad6d('0x17')]=router; \ No newline at end of file +var _0x8d4d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x17b20d,_0x5413b5){var _0x1d9478=function(_0x48023c){while(--_0x48023c){_0x17b20d['push'](_0x17b20d['shift']());}};_0x1d9478(++_0x5413b5);}(_0x8d4d,0x1cb));var _0xd8d4=function(_0x5b9473,_0x5aa60f){_0x5b9473=_0x5b9473-0x0;var _0x2e2b64=_0x8d4d[_0x5b9473];return _0x2e2b64;};'use strict';var multer=require(_0xd8d4('0x0'));var util=require(_0xd8d4('0x1'));var path=require(_0xd8d4('0x2'));var timeout=require(_0xd8d4('0x3'));var express=require(_0xd8d4('0x4'));var router=express[_0xd8d4('0x5')]();var fs_extra=require(_0xd8d4('0x6'));var auth=require(_0xd8d4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd8d4('0x8'));var controller=require(_0xd8d4('0x9'));router[_0xd8d4('0xa')]('/',auth[_0xd8d4('0xb')](),controller[_0xd8d4('0xc')]);router[_0xd8d4('0xa')](_0xd8d4('0xd'),auth[_0xd8d4('0xb')](),controller[_0xd8d4('0xe')]);router[_0xd8d4('0xa')](_0xd8d4('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd8d4('0xb')](),controller[_0xd8d4('0x10')]);router[_0xd8d4('0x11')](_0xd8d4('0xf'),auth[_0xd8d4('0xb')](),controller['update']);router[_0xd8d4('0x12')]('/:id',auth[_0xd8d4('0xb')](),controller[_0xd8d4('0x13')]);module[_0xd8d4('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b1211b1..3084591 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 _0x00fd=['INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x00fd,0x6f));var _0xd00f=function(_0x30a722,_0x19e000){_0x30a722=_0x30a722-0x0;var _0x109700=_0x00fd[_0x30a722];return _0x109700;};'use strict';var Sequelize=require('sequelize');module[_0xd00f('0x0')]={'name':{'type':Sequelize[_0xd00f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd00f('0x2')](_0xd00f('0x3'),'timeout'),'defaultValue':_0xd00f('0x3')},'selector':{'type':Sequelize[_0xd00f('0x1')]},'timeout':{'type':Sequelize[_0xd00f('0x4')]}}; \ No newline at end of file +var _0xe136=['sequelize','exports','STRING','INTEGER'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0xe136,0x17c));var _0x6e13=function(_0x578a39,_0x2c090a){_0x578a39=_0x578a39-0x0;var _0xe100fc=_0xe136[_0x578a39];return _0xe100fc;};'use strict';var Sequelize=require(_0x6e13('0x0'));module[_0x6e13('0x1')]={'name':{'type':Sequelize[_0x6e13('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x6e13('0x2')]},'timeout':{'type':Sequelize[_0x6e13('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 00cdd4f..ba3bd4e 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 _0xa4fb=['rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','show','params','keys','ChatProactiveAction'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xa4fb,0x150));var _0xba4f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa4fb[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xba4f('0x0'));var rimraf=require(_0xba4f('0x1'));var zipdir=require(_0xba4f('0x2'));var jsonpatch=require(_0xba4f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba4f('0x4'));var Mustache=require(_0xba4f('0x5'));var util=require(_0xba4f('0x6'));var path=require('path');var sox=require(_0xba4f('0x7'));var csv=require(_0xba4f('0x8'));var ejs=require(_0xba4f('0x9'));var fs=require('fs');var fs_extra=require(_0xba4f('0xa'));var _=require(_0xba4f('0xb'));var squel=require(_0xba4f('0xc'));var crypto=require(_0xba4f('0xd'));var jsforce=require(_0xba4f('0xe'));var deskjs=require(_0xba4f('0xf'));var toCsv=require(_0xba4f('0x8'));var querystring=require('querystring');var Papa=require(_0xba4f('0x10'));var Redis=require('ioredis');var authService=require(_0xba4f('0x11'));var qs=require(_0xba4f('0x12'));var as=require(_0xba4f('0x13'));var hardwareService=require(_0xba4f('0x14'));var logger=require(_0xba4f('0x15'))(_0xba4f('0x16'));var utils=require('../../config/utils');var config=require(_0xba4f('0x17'));var licenseUtil=require(_0xba4f('0x18'));var db=require(_0xba4f('0x19'))['db'];function respondWithStatusCode(_0x35a461,_0x3a0216){_0x3a0216=_0x3a0216||0xcc;return function(_0x2e4e37){if(_0x2e4e37){return _0x35a461[_0xba4f('0x1a')](_0x3a0216);}return _0x35a461[_0xba4f('0x1b')](_0x3a0216)[_0xba4f('0x1c')]();};}function respondWithResult(_0xbccef6,_0x4b9e86){_0x4b9e86=_0x4b9e86||0xc8;return function(_0x4200a5){if(_0x4200a5){return _0xbccef6[_0xba4f('0x1b')](_0x4b9e86)[_0xba4f('0x1d')](_0x4200a5);}};}function respondWithFilteredResult(_0x5b9334,_0x5ad1e3){return function(_0x5a1e59){if(_0x5a1e59){var _0x26d144=typeof _0x5ad1e3[_0xba4f('0x1e')]===_0xba4f('0x1f')&&typeof _0x5ad1e3[_0xba4f('0x20')]===_0xba4f('0x1f');var _0x2bbbcf=_0x5a1e59['count'];var _0x2ab703=_0x26d144?0x0:_0x5ad1e3[_0xba4f('0x1e')];var _0x567e9d=_0x26d144?_0x5a1e59[_0xba4f('0x21')]:_0x5ad1e3['offset']+_0x5ad1e3[_0xba4f('0x20')];var _0x11e784;if(_0x567e9d>=_0x2bbbcf){_0x567e9d=_0x2bbbcf;_0x11e784=0xc8;}else{_0x11e784=0xce;}_0x5b9334[_0xba4f('0x1b')](_0x11e784);return _0x5b9334[_0xba4f('0x22')](_0xba4f('0x23'),_0x2ab703+'-'+_0x567e9d+'/'+_0x2bbbcf)[_0xba4f('0x1d')](_0x5a1e59);}return null;};}function patchUpdates(_0x516024){return function(_0x254ef9){try{jsonpatch[_0xba4f('0x24')](_0x254ef9,_0x516024,!![]);}catch(_0x4117df){return BPromise['reject'](_0x4117df);}return _0x254ef9[_0xba4f('0x25')]();};}function saveUpdates(_0x5a3ed0,_0x4bdddc){return function(_0x2a7f19){if(_0x2a7f19){return _0x2a7f19[_0xba4f('0x26')](_0x5a3ed0)[_0xba4f('0x27')](function(_0x33cd72){return _0x33cd72;});}return null;};}function removeEntity(_0x1c68a1,_0x277f93){return function(_0x1e9b4f){if(_0x1e9b4f){return _0x1e9b4f['destroy']()['then'](function(){_0x1c68a1[_0xba4f('0x1b')](0xcc)[_0xba4f('0x1c')]();});}};}function handleEntityNotFound(_0x3fa60b,_0x1ebac8){return function(_0x335d37){if(!_0x335d37){_0x3fa60b['sendStatus'](0x194);}return _0x335d37;};}function handleError(_0x573ad1,_0x140fc7){_0x140fc7=_0x140fc7||0x1f4;return function(_0x103f21){logger[_0xba4f('0x28')](_0x103f21[_0xba4f('0x29')]);if(_0x103f21[_0xba4f('0x2a')]){delete _0x103f21[_0xba4f('0x2a')];}_0x573ad1[_0xba4f('0x1b')](_0x140fc7)[_0xba4f('0x2b')](_0x103f21);};}exports[_0xba4f('0x2c')]=function(_0x597270,_0x5871d0){var _0x4944ca={'raw':!![],'where':{'id':_0x597270[_0xba4f('0x2d')]['id']}},_0x9f5d82={};_0x9f5d82['model']=_[_0xba4f('0x2e')](db[_0xba4f('0x2f')][_0xba4f('0x30')]);_0x9f5d82[_0xba4f('0x31')]=_[_0xba4f('0x2e')](_0x597270[_0xba4f('0x31')]);_0x9f5d82[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x9f5d82[_0xba4f('0x34')],_0x9f5d82[_0xba4f('0x31')]);_0x4944ca[_0xba4f('0x35')]=_[_0xba4f('0x33')](_0x9f5d82[_0xba4f('0x34')],qs[_0xba4f('0x36')](_0x597270[_0xba4f('0x31')][_0xba4f('0x36')]));_0x4944ca[_0xba4f('0x35')]=_0x4944ca['attributes'][_0xba4f('0x37')]?_0x4944ca[_0xba4f('0x35')]:_0x9f5d82[_0xba4f('0x34')];if(_0x597270[_0xba4f('0x31')]['includeAll']){_0x4944ca[_0xba4f('0x38')]=[{'all':!![]}];}_0x4944ca=_[_0xba4f('0x39')]({},_0x4944ca,_0x597270[_0xba4f('0x3a')]);return db[_0xba4f('0x2f')][_0xba4f('0x3b')](_0x4944ca)['then'](handleEntityNotFound(_0x5871d0,null))['then'](respondWithResult(_0x5871d0,null))['catch'](handleError(_0x5871d0,null));};exports['create']=function(_0x8ad928,_0x5290f7){return db['ChatProactiveAction'][_0xba4f('0x3c')](_0x8ad928[_0xba4f('0x3d')],{})[_0xba4f('0x27')](respondWithResult(_0x5290f7,0xc9))[_0xba4f('0x3e')](handleError(_0x5290f7,null));};exports[_0xba4f('0x26')]=function(_0x342283,_0x37c1f5){if(_0x342283[_0xba4f('0x3d')]['id']){delete _0x342283[_0xba4f('0x3d')]['id'];}return db[_0xba4f('0x2f')]['find']({'where':{'id':_0x342283[_0xba4f('0x2d')]['id']}})['then'](handleEntityNotFound(_0x37c1f5,null))[_0xba4f('0x27')](saveUpdates(_0x342283[_0xba4f('0x3d')],null))[_0xba4f('0x27')](respondWithResult(_0x37c1f5,null))['catch'](handleError(_0x37c1f5,null));};exports[_0xba4f('0x3f')]=function(_0x3f46e6,_0x578ee5){return db[_0xba4f('0x2f')][_0xba4f('0x3b')]({'where':{'id':_0x3f46e6[_0xba4f('0x2d')]['id']}})['then'](handleEntityNotFound(_0x578ee5,null))[_0xba4f('0x27')](removeEntity(_0x578ee5,null))[_0xba4f('0x3e')](handleError(_0x578ee5,null));}; \ No newline at end of file +var _0x36b2=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x566c40,_0x3c2178){var _0x5152ec=function(_0x3e2112){while(--_0x3e2112){_0x566c40['push'](_0x566c40['shift']());}};_0x5152ec(++_0x3c2178);}(_0x36b2,0x6b));var _0x236b=function(_0x4cab69,_0x376b21){_0x4cab69=_0x4cab69-0x0;var _0x5073a4=_0x36b2[_0x4cab69];return _0x5073a4;};'use strict';var emlformat=require(_0x236b('0x0'));var rimraf=require(_0x236b('0x1'));var zipdir=require(_0x236b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x236b('0x3'));var moment=require(_0x236b('0x4'));var BPromise=require(_0x236b('0x5'));var Mustache=require('mustache');var util=require(_0x236b('0x6'));var path=require(_0x236b('0x7'));var sox=require('sox');var csv=require(_0x236b('0x8'));var ejs=require(_0x236b('0x9'));var fs=require('fs');var fs_extra=require(_0x236b('0xa'));var _=require(_0x236b('0xb'));var squel=require(_0x236b('0xc'));var crypto=require(_0x236b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x236b('0xe'));var toCsv=require(_0x236b('0x8'));var querystring=require(_0x236b('0xf'));var Papa=require(_0x236b('0x10'));var Redis=require('ioredis');var authService=require(_0x236b('0x11'));var qs=require(_0x236b('0x12'));var as=require(_0x236b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x236b('0x14'))(_0x236b('0x15'));var utils=require(_0x236b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x236b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52393a,_0x1ee631){_0x1ee631=_0x1ee631||0xcc;return function(_0x5d5d8a){if(_0x5d5d8a){return _0x52393a[_0x236b('0x18')](_0x1ee631);}return _0x52393a[_0x236b('0x19')](_0x1ee631)[_0x236b('0x1a')]();};}function respondWithResult(_0x2410a5,_0x2df000){_0x2df000=_0x2df000||0xc8;return function(_0xa772f3){if(_0xa772f3){return _0x2410a5[_0x236b('0x19')](_0x2df000)['json'](_0xa772f3);}};}function respondWithFilteredResult(_0x5476ac,_0xcc6d01){return function(_0x13248a){if(_0x13248a){var _0x258935=typeof _0xcc6d01[_0x236b('0x1b')]===_0x236b('0x1c')&&typeof _0xcc6d01['limit']==='undefined';var _0xab13f4=_0x13248a['count'];var _0x18878f=_0x258935?0x0:_0xcc6d01[_0x236b('0x1b')];var _0x5a6c07=_0x258935?_0x13248a['count']:_0xcc6d01[_0x236b('0x1b')]+_0xcc6d01['limit'];var _0x1be23c;if(_0x5a6c07>=_0xab13f4){_0x5a6c07=_0xab13f4;_0x1be23c=0xc8;}else{_0x1be23c=0xce;}_0x5476ac['status'](_0x1be23c);return _0x5476ac['set'](_0x236b('0x1d'),_0x18878f+'-'+_0x5a6c07+'/'+_0xab13f4)[_0x236b('0x1e')](_0x13248a);}return null;};}function patchUpdates(_0x3f4ed3){return function(_0x35e4f1){try{jsonpatch[_0x236b('0x1f')](_0x35e4f1,_0x3f4ed3,!![]);}catch(_0x7a1430){return BPromise[_0x236b('0x20')](_0x7a1430);}return _0x35e4f1[_0x236b('0x21')]();};}function saveUpdates(_0x1159c5,_0x1927a1){return function(_0x168ede){if(_0x168ede){return _0x168ede[_0x236b('0x22')](_0x1159c5)['then'](function(_0xc135e7){return _0xc135e7;});}return null;};}function removeEntity(_0xc8d8cf,_0x5711a9){return function(_0xb18e7){if(_0xb18e7){return _0xb18e7[_0x236b('0x23')]()[_0x236b('0x24')](function(){_0xc8d8cf['status'](0xcc)[_0x236b('0x1a')]();});}};}function handleEntityNotFound(_0x1617f8,_0xd405b3){return function(_0x154905){if(!_0x154905){_0x1617f8[_0x236b('0x18')](0x194);}return _0x154905;};}function handleError(_0x29e0ec,_0x9702b2){_0x9702b2=_0x9702b2||0x1f4;return function(_0x4d319e){logger[_0x236b('0x25')](_0x4d319e[_0x236b('0x26')]);if(_0x4d319e[_0x236b('0x27')]){delete _0x4d319e[_0x236b('0x27')];}_0x29e0ec[_0x236b('0x19')](_0x9702b2)[_0x236b('0x28')](_0x4d319e);};}exports[_0x236b('0x29')]=function(_0x1b5a50,_0x1de15f){var _0x2e7fc5={'raw':!![],'where':{'id':_0x1b5a50[_0x236b('0x2a')]['id']}},_0x15a520={};_0x15a520[_0x236b('0x2b')]=_[_0x236b('0x2c')](db[_0x236b('0x2d')][_0x236b('0x2e')]);_0x15a520['query']=_[_0x236b('0x2c')](_0x1b5a50[_0x236b('0x2f')]);_0x15a520[_0x236b('0x30')]=_['intersection'](_0x15a520[_0x236b('0x2b')],_0x15a520[_0x236b('0x2f')]);_0x2e7fc5[_0x236b('0x31')]=_[_0x236b('0x32')](_0x15a520[_0x236b('0x2b')],qs[_0x236b('0x33')](_0x1b5a50[_0x236b('0x2f')][_0x236b('0x33')]));_0x2e7fc5[_0x236b('0x31')]=_0x2e7fc5[_0x236b('0x31')][_0x236b('0x34')]?_0x2e7fc5[_0x236b('0x31')]:_0x15a520[_0x236b('0x2b')];if(_0x1b5a50[_0x236b('0x2f')][_0x236b('0x35')]){_0x2e7fc5['include']=[{'all':!![]}];}_0x2e7fc5=_[_0x236b('0x36')]({},_0x2e7fc5,_0x1b5a50['options']);return db['ChatProactiveAction'][_0x236b('0x37')](_0x2e7fc5)[_0x236b('0x24')](handleEntityNotFound(_0x1de15f,null))[_0x236b('0x24')](respondWithResult(_0x1de15f,null))[_0x236b('0x38')](handleError(_0x1de15f,null));};exports[_0x236b('0x39')]=function(_0x1aafd8,_0x5a113e){return db[_0x236b('0x2d')]['create'](_0x1aafd8['body'],{})[_0x236b('0x24')](respondWithResult(_0x5a113e,0xc9))[_0x236b('0x38')](handleError(_0x5a113e,null));};exports[_0x236b('0x22')]=function(_0x38664d,_0x2a019c){if(_0x38664d['body']['id']){delete _0x38664d[_0x236b('0x3a')]['id'];}return db[_0x236b('0x2d')][_0x236b('0x37')]({'where':{'id':_0x38664d[_0x236b('0x2a')]['id']}})[_0x236b('0x24')](handleEntityNotFound(_0x2a019c,null))[_0x236b('0x24')](saveUpdates(_0x38664d[_0x236b('0x3a')],null))[_0x236b('0x24')](respondWithResult(_0x2a019c,null))[_0x236b('0x38')](handleError(_0x2a019c,null));};exports[_0x236b('0x23')]=function(_0x19d202,_0x209759){return db[_0x236b('0x2d')][_0x236b('0x37')]({'where':{'id':_0x19d202[_0x236b('0x2a')]['id']}})[_0x236b('0x24')](handleEntityNotFound(_0x209759,null))[_0x236b('0x24')](removeEntity(_0x209759,null))[_0x236b('0x38')](handleError(_0x209759,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1e62dcd..3d919da 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 _0x23b8=['bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','chat_proactive_actions','lodash','../../config/logger','moment'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x23b8,0xc3));var _0x823b=function(_0x2bb930,_0xe92f28){_0x2bb930=_0x2bb930-0x0;var _0x4a7d19=_0x23b8[_0x2bb930];return _0x4a7d19;};'use strict';var _=require(_0x823b('0x0'));var util=require('util');var logger=require(_0x823b('0x1'))('api');var moment=require(_0x823b('0x2'));var BPromise=require(_0x823b('0x3'));var rp=require(_0x823b('0x4'));var fs=require('fs');var path=require(_0x823b('0x5'));var rimraf=require('rimraf');var config=require(_0x823b('0x6'));var attributes=require(_0x823b('0x7'));module['exports']=function(_0xf6232c,_0x46a8c4){return _0xf6232c['define']('ChatProactiveAction',attributes,{'tableName':_0x823b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5885=['ChatProactiveAction','api','moment','path','rimraf','./chatProactiveAction.attributes','exports','define'];(function(_0x573e18,_0x21bfee){var _0x58a314=function(_0x181d14){while(--_0x181d14){_0x573e18['push'](_0x573e18['shift']());}};_0x58a314(++_0x21bfee);}(_0x5885,0x139));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5588('0x0'));var moment=require(_0x5588('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5588('0x2'));var rimraf=require(_0x5588('0x3'));var config=require('../../config/environment');var attributes=require(_0x5588('0x4'));module[_0x5588('0x5')]=function(_0x32f893,_0x5cede1){return _0x32f893[_0x5588('0x6')](_0x5588('0x7'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 3cbf59c..f57477f 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 _0xd7ae=['client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x265722,_0x961f07){var _0x3de691=function(_0x416fc4){while(--_0x416fc4){_0x265722['push'](_0x265722['shift']());}};_0x3de691(++_0x961f07);}(_0xd7ae,0x156));var _0xed7a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd7ae[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xed7a('0x0'));var util=require(_0xed7a('0x1'));var moment=require(_0xed7a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed7a('0x3'));var db=require(_0xed7a('0x4'))['db'];var utils=require(_0xed7a('0x5'));var logger=require(_0xed7a('0x6'))(_0xed7a('0x7'));var config=require(_0xed7a('0x8'));var jayson=require(_0xed7a('0x9'));var client=jayson[_0xed7a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e0568,_0xee4e9e,_0xd7714){return new BPromise(function(_0x3ec549,_0x4ff123){return client[_0xed7a('0xb')](_0x1e0568,_0xd7714)[_0xed7a('0xc')](function(_0x57cb16){logger[_0xed7a('0xd')](_0xed7a('0xe'),_0xee4e9e,_0xed7a('0xf'));logger[_0xed7a('0x10')](_0xed7a('0x11'),_0xee4e9e,_0xed7a('0xf'),JSON[_0xed7a('0x12')](_0x57cb16));if(_0x57cb16['error']){if(_0x57cb16['error']['code']===0x1f4){logger[_0xed7a('0x13')](_0xed7a('0xe'),_0xee4e9e,_0x57cb16[_0xed7a('0x13')][_0xed7a('0x14')]);return _0x4ff123(_0x57cb16[_0xed7a('0x13')][_0xed7a('0x14')]);}logger[_0xed7a('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0xee4e9e,_0x57cb16[_0xed7a('0x13')][_0xed7a('0x14')]);return _0x3ec549(_0x57cb16[_0xed7a('0x13')]['message']);}else{logger[_0xed7a('0xd')](_0xed7a('0xe'),_0xee4e9e,_0xed7a('0xf'));_0x3ec549(_0x57cb16[_0xed7a('0x15')]['message']);}})['catch'](function(_0x18e92f){logger[_0xed7a('0x13')](_0xed7a('0xe'),_0xee4e9e,_0x18e92f);_0x4ff123(_0x18e92f);});});} \ No newline at end of file +var _0x86d4=['info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x86d4,0x14d));var _0x486d=function(_0x66db5b,_0x33723c){_0x66db5b=_0x66db5b-0x0;var _0x50e24f=_0x86d4[_0x66db5b];return _0x50e24f;};'use strict';var _=require(_0x486d('0x0'));var util=require(_0x486d('0x1'));var moment=require(_0x486d('0x2'));var BPromise=require(_0x486d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x486d('0x4'))['db'];var utils=require(_0x486d('0x5'));var logger=require(_0x486d('0x6'))(_0x486d('0x7'));var config=require('../../config/environment');var jayson=require(_0x486d('0x8'));var client=jayson[_0x486d('0x9')][_0x486d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51d890,_0x2a788a,_0xbfb811){return new BPromise(function(_0x5d8647,_0x226c4a){return client[_0x486d('0xb')](_0x51d890,_0xbfb811)[_0x486d('0xc')](function(_0x59d4ae){logger['info'](_0x486d('0xd'),_0x2a788a,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2a788a,_0x486d('0xe'),JSON[_0x486d('0xf')](_0x59d4ae));if(_0x59d4ae[_0x486d('0x10')]){if(_0x59d4ae[_0x486d('0x10')][_0x486d('0x11')]===0x1f4){logger[_0x486d('0x10')](_0x486d('0xd'),_0x2a788a,_0x59d4ae[_0x486d('0x10')][_0x486d('0x12')]);return _0x226c4a(_0x59d4ae['error'][_0x486d('0x12')]);}logger[_0x486d('0x10')](_0x486d('0xd'),_0x2a788a,_0x59d4ae['error'][_0x486d('0x12')]);return _0x5d8647(_0x59d4ae[_0x486d('0x10')]['message']);}else{logger[_0x486d('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a788a,'request\x20sent');_0x5d8647(_0x59d4ae[_0x486d('0x14')][_0x486d('0x12')]);}})[_0x486d('0x15')](function(_0x143c2f){logger[_0x486d('0x10')](_0x486d('0xd'),_0x2a788a,_0x143c2f);_0x226c4a(_0x143c2f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9843631..854333c 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 _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0x7783a5,_0x29c18f){_0x7783a5=_0x7783a5-0x0;var _0x528b83=_0x038b[_0x7783a5];return _0x528b83;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file +var _0xbd51=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','./chatProactiveAction.controller','get','/:id'];(function(_0xdf9472,_0x110712){var _0x256a0d=function(_0x50ce3b){while(--_0x50ce3b){_0xdf9472['push'](_0xdf9472['shift']());}};_0x256a0d(++_0x110712);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3673cd,_0x6016dd){_0x3673cd=_0x3673cd-0x0;var _0x19fa53=_0xbd51[_0x3673cd];return _0x19fa53;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bd5('0x5'));router[_0x1bd5('0x6')](_0x1bd5('0x7'),auth['isAuthenticated'](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0xc')]('/:id',auth[_0x1bd5('0xa')](),controller['update']);router[_0x1bd5('0xd')](_0x1bd5('0x7'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8ed80c9..65bddad 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 _0x991e=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x991e,0x15f));var _0xe991=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x991e[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xe991('0x0'));module['exports']={'name':{'type':Sequelize[_0xe991('0x1')],'unique':_0xe991('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe991('0x1')]},'timeout':{'type':Sequelize[_0xe991('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe991('0x4')]('rrmemory',_0xe991('0x5'),_0xe991('0x6'))}}; \ No newline at end of file +var _0x4bb3=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x8bef34,_0x70c408){var _0x3a4aa0=function(_0x5a2d68){while(--_0x5a2d68){_0x8bef34['push'](_0x8bef34['shift']());}};_0x3a4aa0(++_0x70c408);}(_0x4bb3,0x6b));var _0x34bb=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0x4bb3[_0x1e06f1];return _0x34f77e;};'use strict';var Sequelize=require(_0x34bb('0x0'));module[_0x34bb('0x1')]={'name':{'type':Sequelize[_0x34bb('0x2')],'unique':_0x34bb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x34bb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x34bb('0x4')]('rrmemory',_0x34bb('0x5'),_0x34bb('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9d7ec78..d3df171 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 _0xcf8c=['addTeams','ids','User','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','status','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','ChatQueues','UserProfileResource','end','sendStatus','stack','name','index','map','ChatQueue','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','body','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','ChatQueueId','options','UserId','agent','chatPause','updatedAt','createdAt','SIP','getTeams','Team'];(function(_0x10933c,_0x4d7a54){var _0x4cbf00=function(_0x22d0cc){while(--_0x22d0cc){_0x10933c['push'](_0x10933c['shift']());}};_0x4cbf00(++_0x4d7a54);}(_0xcf8c,0x1e8));var _0xccf8=function(_0x243763,_0x1a9829){_0x243763=_0x243763-0x0;var _0x3f069f=_0xcf8c[_0x243763];return _0x3f069f;};'use strict';var emlformat=require(_0xccf8('0x0'));var rimraf=require(_0xccf8('0x1'));var zipdir=require(_0xccf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccf8('0x3'));var moment=require(_0xccf8('0x4'));var BPromise=require(_0xccf8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xccf8('0x6'));var sox=require(_0xccf8('0x7'));var csv=require('to-csv');var ejs=require(_0xccf8('0x8'));var fs=require('fs');var fs_extra=require(_0xccf8('0x9'));var _=require('lodash');var squel=require(_0xccf8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccf8('0xb'));var querystring=require(_0xccf8('0xc'));var Papa=require(_0xccf8('0xd'));var Redis=require(_0xccf8('0xe'));var authService=require(_0xccf8('0xf'));var qs=require(_0xccf8('0x10'));var as=require(_0xccf8('0x11'));var hardwareService=require(_0xccf8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xccf8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xccf8('0x14'));var db=require(_0xccf8('0x15'))['db'];config[_0xccf8('0x16')]=_[_0xccf8('0x17')](config['redis'],{'host':_0xccf8('0x18'),'port':0x18eb});var socket=require(_0xccf8('0x19'))(new Redis(config['redis']));require(_0xccf8('0x1a'))['register'](socket);var jayson=require(_0xccf8('0x1b'));var client=jayson['client'][_0xccf8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4f3f61,_0x5c1cc8,_0x3246bf,_0x552dbd){return new BPromise(function(_0x2f904d,_0x410f59){var _0x3666ef=_0x552dbd||client;return _0x3666ef[_0xccf8('0x1d')](_0x4f3f61,_0x3246bf)[_0xccf8('0x1e')](function(_0x1854fa){logger['info']('ChatQueue,\x20%s,\x20%s',_0x5c1cc8,_0xccf8('0x1f'));logger[_0xccf8('0x20')](_0xccf8('0x21'),_0x5c1cc8,'request\x20sent',JSON[_0xccf8('0x22')](_0x1854fa));if(_0x1854fa[_0xccf8('0x23')]){if(_0x1854fa[_0xccf8('0x23')]['code']===0x1f4){logger['error'](_0xccf8('0x24'),_0x5c1cc8,_0x1854fa[_0xccf8('0x23')][_0xccf8('0x25')]);return _0x410f59(_0x1854fa[_0xccf8('0x23')][_0xccf8('0x25')]);}logger[_0xccf8('0x23')](_0xccf8('0x24'),_0x5c1cc8,_0x1854fa[_0xccf8('0x23')][_0xccf8('0x25')]);return _0x2f904d(_0x1854fa[_0xccf8('0x23')][_0xccf8('0x25')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5c1cc8,_0xccf8('0x1f'));_0x2f904d(_0x1854fa[_0xccf8('0x26')][_0xccf8('0x25')]);}})['catch'](function(_0x36495f){logger[_0xccf8('0x23')](_0xccf8('0x24'),_0x5c1cc8,_0x36495f);_0x410f59(_0x36495f);});});}function respondWithStatusCode(_0x1c80b6,_0x1a5790){_0x1a5790=_0x1a5790||0xcc;return function(_0x452d1b){if(_0x452d1b){return _0x1c80b6['sendStatus'](_0x1a5790);}return _0x1c80b6[_0xccf8('0x27')](_0x1a5790)['end']();};}function respondWithResult(_0x263c6a,_0x30447a){_0x30447a=_0x30447a||0xc8;return function(_0x31db9d){if(_0x31db9d){return _0x263c6a[_0xccf8('0x27')](_0x30447a)['json'](_0x31db9d);}};}function respondWithFilteredResult(_0x4957a4,_0x4aacaf){return function(_0x1d00b9){if(_0x1d00b9){var _0x76272d=typeof _0x4aacaf[_0xccf8('0x28')]===_0xccf8('0x29')&&typeof _0x4aacaf[_0xccf8('0x2a')]===_0xccf8('0x29');var _0x1bc1c1=_0x1d00b9[_0xccf8('0x2b')];var _0x17f4ff=_0x76272d?0x0:_0x4aacaf[_0xccf8('0x28')];var _0x1ebd8d=_0x76272d?_0x1d00b9[_0xccf8('0x2b')]:_0x4aacaf[_0xccf8('0x28')]+_0x4aacaf[_0xccf8('0x2a')];var _0xbfb3ee;if(_0x1ebd8d>=_0x1bc1c1){_0x1ebd8d=_0x1bc1c1;_0xbfb3ee=0xc8;}else{_0xbfb3ee=0xce;}_0x4957a4[_0xccf8('0x27')](_0xbfb3ee);return _0x4957a4[_0xccf8('0x2c')](_0xccf8('0x2d'),_0x17f4ff+'-'+_0x1ebd8d+'/'+_0x1bc1c1)['json'](_0x1d00b9);}return null;};}function patchUpdates(_0xb189a){return function(_0x3accec){try{jsonpatch[_0xccf8('0x2e')](_0x3accec,_0xb189a,!![]);}catch(_0x14e0de){return BPromise['reject'](_0x14e0de);}return _0x3accec[_0xccf8('0x2f')]();};}function saveUpdates(_0x5de393,_0xd42cf3){return function(_0x31a9c0){if(_0x31a9c0){return _0x31a9c0['update'](_0x5de393)[_0xccf8('0x1e')](function(_0x1f8226){return _0x1f8226;});}return null;};}function removeEntity(_0x1ae3c3,_0x2fdc20){return function(_0x26e5bd){if(_0x26e5bd){return _0x26e5bd[_0xccf8('0x30')]()[_0xccf8('0x1e')](function(){var _0x454f71=_0x26e5bd[_0xccf8('0x31')]({'plain':!![]});var _0x247b5b=_0xccf8('0x32');return db[_0xccf8('0x33')]['destroy']({'where':{'type':_0x247b5b,'resourceId':_0x454f71['id']}})[_0xccf8('0x1e')](function(){return _0x26e5bd;});})[_0xccf8('0x1e')](function(){_0x1ae3c3[_0xccf8('0x27')](0xcc)[_0xccf8('0x34')]();});}};}function handleEntityNotFound(_0x1b0d0a,_0x428f2b){return function(_0x493c9c){if(!_0x493c9c){_0x1b0d0a[_0xccf8('0x35')](0x194);}return _0x493c9c;};}function handleError(_0x427f40,_0x311614){_0x311614=_0x311614||0x1f4;return function(_0x596d4e){logger['error'](_0x596d4e[_0xccf8('0x36')]);if(_0x596d4e[_0xccf8('0x37')]){delete _0x596d4e[_0xccf8('0x37')];}_0x427f40[_0xccf8('0x27')](_0x311614)['send'](_0x596d4e);};}exports[_0xccf8('0x38')]=function(_0x14fafd,_0x42b16e){var _0x4decb0={},_0x3bbdd4={},_0x4f0f10={'count':0x0,'rows':[]};var _0x84a3de=_[_0xccf8('0x39')](db[_0xccf8('0x3a')][_0xccf8('0x3b')],function(_0x77c9a1){return{'name':_0x77c9a1[_0xccf8('0x3c')],'type':_0x77c9a1['type']['key']};});_0x3bbdd4['model']=_[_0xccf8('0x39')](_0x84a3de,'name');_0x3bbdd4[_0xccf8('0x3d')]=_['keys'](_0x14fafd[_0xccf8('0x3d')]);_0x3bbdd4[_0xccf8('0x3e')]=_[_0xccf8('0x3f')](_0x3bbdd4[_0xccf8('0x40')],_0x3bbdd4['query']);_0x4decb0[_0xccf8('0x41')]=_[_0xccf8('0x3f')](_0x3bbdd4[_0xccf8('0x40')],qs[_0xccf8('0x42')](_0x14fafd[_0xccf8('0x3d')][_0xccf8('0x42')]));_0x4decb0[_0xccf8('0x41')]=_0x4decb0['attributes'][_0xccf8('0x43')]?_0x4decb0[_0xccf8('0x41')]:_0x3bbdd4[_0xccf8('0x40')];if(!_0x14fafd[_0xccf8('0x3d')][_0xccf8('0x44')](_0xccf8('0x45'))){_0x4decb0['limit']=qs[_0xccf8('0x2a')](_0x14fafd[_0xccf8('0x3d')]['limit']);_0x4decb0['offset']=qs[_0xccf8('0x28')](_0x14fafd[_0xccf8('0x3d')][_0xccf8('0x28')]);}_0x4decb0[_0xccf8('0x46')]=qs[_0xccf8('0x47')](_0x14fafd[_0xccf8('0x3d')][_0xccf8('0x47')]);_0x4decb0[_0xccf8('0x48')]=qs['filters'](_[_0xccf8('0x49')](_0x14fafd[_0xccf8('0x3d')],_0x3bbdd4[_0xccf8('0x3e')]),_0x84a3de);if(_0x14fafd[_0xccf8('0x3d')][_0xccf8('0x4a')]){_0x4decb0[_0xccf8('0x48')]=_['merge'](_0x4decb0['where'],{'$or':_[_0xccf8('0x39')](_0x84a3de,function(_0x288852){if(_0x288852[_0xccf8('0x4b')]!==_0xccf8('0x4c')){var _0x4f5364={};_0x4f5364[_0x288852[_0xccf8('0x37')]]={'$like':'%'+_0x14fafd[_0xccf8('0x3d')]['filter']+'%'};return _0x4f5364;}})});}_0x4decb0=_[_0xccf8('0x4d')]({},_0x4decb0,_0x14fafd['options']);var _0x46be52={'where':_0x4decb0['where']};return db[_0xccf8('0x3a')][_0xccf8('0x2b')](_0x46be52)[_0xccf8('0x1e')](function(_0x4ba374){_0x4f0f10[_0xccf8('0x2b')]=_0x4ba374;if(_0x14fafd[_0xccf8('0x3d')][_0xccf8('0x4e')]){_0x4decb0[_0xccf8('0x4f')]=[{'all':!![]}];}return db[_0xccf8('0x3a')][_0xccf8('0x50')](_0x4decb0);})[_0xccf8('0x1e')](function(_0x580ecc){_0x4f0f10[_0xccf8('0x51')]=_0x580ecc;return _0x4f0f10;})[_0xccf8('0x1e')](respondWithFilteredResult(_0x42b16e,_0x4decb0))[_0xccf8('0x52')](handleError(_0x42b16e,null));};exports[_0xccf8('0x53')]=function(_0xadf411,_0x409d6c){var _0x2031e={'raw':!![],'where':{'id':_0xadf411[_0xccf8('0x54')]['id']}},_0x314f0c={};_0x314f0c[_0xccf8('0x40')]=_[_0xccf8('0x55')](db[_0xccf8('0x3a')][_0xccf8('0x3b')]);_0x314f0c[_0xccf8('0x3d')]=_[_0xccf8('0x55')](_0xadf411[_0xccf8('0x3d')]);_0x314f0c[_0xccf8('0x3e')]=_[_0xccf8('0x3f')](_0x314f0c[_0xccf8('0x40')],_0x314f0c[_0xccf8('0x3d')]);_0x2031e[_0xccf8('0x41')]=_[_0xccf8('0x3f')](_0x314f0c[_0xccf8('0x40')],qs['fields'](_0xadf411[_0xccf8('0x3d')][_0xccf8('0x42')]));_0x2031e[_0xccf8('0x41')]=_0x2031e[_0xccf8('0x41')][_0xccf8('0x43')]?_0x2031e[_0xccf8('0x41')]:_0x314f0c['model'];if(_0xadf411['query'][_0xccf8('0x4e')]){_0x2031e['include']=[{'all':!![]}];}_0x2031e=_[_0xccf8('0x4d')]({},_0x2031e,_0xadf411['options']);return db['ChatQueue'][_0xccf8('0x56')](_0x2031e)[_0xccf8('0x1e')](handleEntityNotFound(_0x409d6c,null))['then'](respondWithResult(_0x409d6c,null))[_0xccf8('0x52')](handleError(_0x409d6c,null));};exports['create']=function(_0x2ec087,_0x154348){return db[_0xccf8('0x3a')]['create'](_0x2ec087[_0xccf8('0x57')],{})[_0xccf8('0x1e')](function(_0x12c09d){var _0x46e086=_0x2ec087[_0xccf8('0x58')][_0xccf8('0x31')]({'plain':!![]});if(!_0x46e086)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46e086['role']===_0xccf8('0x58')){var _0x12f12a=_0x12c09d[_0xccf8('0x31')]({'plain':!![]});var _0x5882a2='ChatQueues';return db[_0xccf8('0x59')][_0xccf8('0x56')]({'where':{'name':_0x5882a2,'userProfileId':_0x46e086['userProfileId']},'raw':!![]})[_0xccf8('0x1e')](function(_0x5115d3){if(_0x5115d3&&_0x5115d3[_0xccf8('0x5a')]===0x0){return db[_0xccf8('0x33')][_0xccf8('0x5b')]({'name':_0x12f12a['name'],'resourceId':_0x12f12a['id'],'type':_0x5115d3[_0xccf8('0x37')],'sectionId':_0x5115d3['id']},{})[_0xccf8('0x1e')](function(){return _0x12c09d;});}else{return _0x12c09d;}})[_0xccf8('0x52')](function(_0x4ecad9){logger[_0xccf8('0x23')](_0xccf8('0x5c'),_0x4ecad9);throw _0x4ecad9;});}return _0x12c09d;})['then'](respondWithResult(_0x154348,0xc9))[_0xccf8('0x52')](handleError(_0x154348,null));};exports[_0xccf8('0x5d')]=function(_0x2a9f10,_0x119038){if(_0x2a9f10[_0xccf8('0x57')]['id']){delete _0x2a9f10[_0xccf8('0x57')]['id'];}return db[_0xccf8('0x3a')][_0xccf8('0x56')]({'where':{'id':_0x2a9f10[_0xccf8('0x54')]['id']}})['then'](handleEntityNotFound(_0x119038,null))[_0xccf8('0x1e')](saveUpdates(_0x2a9f10[_0xccf8('0x57')],null))[_0xccf8('0x1e')](respondWithResult(_0x119038,null))[_0xccf8('0x52')](handleError(_0x119038,null));};exports[_0xccf8('0x30')]=function(_0x52a2b0,_0x5e2004){return db[_0xccf8('0x3a')][_0xccf8('0x56')]({'where':{'id':_0x52a2b0[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](handleEntityNotFound(_0x5e2004,null))[_0xccf8('0x1e')](removeEntity(_0x5e2004,null))[_0xccf8('0x52')](handleError(_0x5e2004,null));};exports['describe']=function(_0x17da70,_0x380b52){return db[_0xccf8('0x3a')][_0xccf8('0x5e')]()[_0xccf8('0x1e')](respondWithResult(_0x380b52,null))[_0xccf8('0x52')](handleError(_0x380b52,null));};exports[_0xccf8('0x5f')]=function(_0x43335a,_0x365cdf,_0xa8301){var _0x3eae13={'raw':!![],'where':{}},_0x2481c6={},_0x5cd50b;return db['ChatQueue'][_0xccf8('0x60')]({'where':{'id':_0x43335a[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](handleEntityNotFound(_0x365cdf,null))[_0xccf8('0x1e')](function(_0x2ef21f){if(_0x2ef21f){_0x5cd50b=_0x2ef21f[_0xccf8('0x31')]({'plain':!![]});_0x2481c6[_0xccf8('0x40')]=_[_0xccf8('0x55')](db[_0xccf8('0x61')][_0xccf8('0x3b')]);_0x2481c6[_0xccf8('0x3d')]=_[_0xccf8('0x55')](_0x43335a[_0xccf8('0x3d')]);_0x2481c6[_0xccf8('0x3e')]=_[_0xccf8('0x3f')](_0x2481c6[_0xccf8('0x40')],_0x2481c6[_0xccf8('0x3d')]);_0x3eae13[_0xccf8('0x41')]=_[_0xccf8('0x3f')](_0x2481c6[_0xccf8('0x40')],qs[_0xccf8('0x42')](_0x43335a[_0xccf8('0x3d')]['fields']));_0x3eae13[_0xccf8('0x41')]=_0x3eae13[_0xccf8('0x41')]['length']?_0x3eae13[_0xccf8('0x41')]:_0x2481c6[_0xccf8('0x40')];if(!_0x43335a[_0xccf8('0x3d')][_0xccf8('0x44')](_0xccf8('0x45'))){_0x3eae13[_0xccf8('0x2a')]=qs[_0xccf8('0x2a')](_0x43335a['query'][_0xccf8('0x2a')]);_0x3eae13[_0xccf8('0x28')]=qs[_0xccf8('0x28')](_0x43335a[_0xccf8('0x3d')][_0xccf8('0x28')]);}_0x3eae13['order']=qs[_0xccf8('0x47')](_0x43335a[_0xccf8('0x3d')][_0xccf8('0x47')]);_0x3eae13[_0xccf8('0x48')]=qs['filters'](_[_0xccf8('0x49')](_0x43335a[_0xccf8('0x3d')],_0x2481c6['filters']));_0x3eae13[_0xccf8('0x48')][_0xccf8('0x62')]=_0x2ef21f['id'];if(_0x43335a[_0xccf8('0x3d')][_0xccf8('0x4a')]){_0x3eae13[_0xccf8('0x48')]=_[_0xccf8('0x4d')](_0x3eae13['where'],{'$or':_['map'](_0x3eae13[_0xccf8('0x41')],function(_0x328a4c){var _0x28ee50={};_0x28ee50[_0x328a4c]={'$like':'%'+_0x43335a['query'][_0xccf8('0x4a')]+'%'};return _0x28ee50;})});}_0x3eae13=_[_0xccf8('0x4d')]({},_0x3eae13,_0x43335a[_0xccf8('0x63')]);return db[_0xccf8('0x61')][_0xccf8('0x50')](_0x3eae13);}})[_0xccf8('0x1e')](function(_0x531d69){if(_0x531d69){return db['User']['findAndCountAll']({'where':{'id':_[_0xccf8('0x39')](_0x531d69,_0xccf8('0x64')),'role':_0xccf8('0x65')},'attributes':['id',_0xccf8('0x37'),_0xccf8('0x66'),_0xccf8('0x67'),_0xccf8('0x68')]});}})[_0xccf8('0x1e')](function(_0x23fa7c){if(_0x23fa7c){return{'count':_0x23fa7c[_0xccf8('0x2b')],'rows':_['map'](_0x23fa7c[_0xccf8('0x51')],function(_0x2fcd5a){return{'membername':_0x2fcd5a[_0xccf8('0x37')],'UserId':_0x2fcd5a['id'],'queue_name':_0x5cd50b[_0xccf8('0x37')],'ChatQueueId':_0x5cd50b['id'],'interface':util['format']('%s/%s',_0xccf8('0x69'),_0x2fcd5a[_0xccf8('0x37')]),'penalty':0x0,'paused':_0x2fcd5a[_0xccf8('0x66')],'createdAt':_0x2fcd5a['createdAt'],'updatedAt':_0x2fcd5a[_0xccf8('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xccf8('0x1e')](respondWithFilteredResult(_0x365cdf,_0x3eae13))['catch'](handleError(_0x365cdf,null));};exports[_0xccf8('0x6a')]=function(_0x569504,_0x2973b2,_0x28dd07){var _0x5eecbd={};var _0x5bd1df={};var _0x38d38f;var _0x30c2e3;return db[_0xccf8('0x3a')][_0xccf8('0x60')]({'where':{'id':_0x569504[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](handleEntityNotFound(_0x2973b2,null))['then'](function(_0x3a8a1d){if(_0x3a8a1d){_0x38d38f=_0x3a8a1d;_0x5bd1df[_0xccf8('0x40')]=_[_0xccf8('0x55')](db[_0xccf8('0x6b')]['rawAttributes']);_0x5bd1df['query']=_[_0xccf8('0x55')](_0x569504[_0xccf8('0x3d')]);_0x5bd1df[_0xccf8('0x3e')]=_[_0xccf8('0x3f')](_0x5bd1df[_0xccf8('0x40')],_0x5bd1df[_0xccf8('0x3d')]);_0x5eecbd[_0xccf8('0x41')]=_[_0xccf8('0x3f')](_0x5bd1df[_0xccf8('0x40')],qs[_0xccf8('0x42')](_0x569504[_0xccf8('0x3d')][_0xccf8('0x42')]));_0x5eecbd[_0xccf8('0x41')]=_0x5eecbd[_0xccf8('0x41')]['length']?_0x5eecbd[_0xccf8('0x41')]:_0x5bd1df[_0xccf8('0x40')];_0x5eecbd['order']=qs[_0xccf8('0x47')](_0x569504[_0xccf8('0x3d')][_0xccf8('0x47')]);_0x5eecbd[_0xccf8('0x48')]=qs[_0xccf8('0x3e')](_[_0xccf8('0x49')](_0x569504[_0xccf8('0x3d')],_0x5bd1df['filters']));if(_0x569504['query'][_0xccf8('0x4a')]){_0x5eecbd[_0xccf8('0x48')]=_[_0xccf8('0x4d')](_0x5eecbd[_0xccf8('0x48')],{'$or':_[_0xccf8('0x39')](_0x5eecbd['attributes'],function(_0x2a75fd){var _0x4c7bcd={};_0x4c7bcd[_0x2a75fd]={'$like':'%'+_0x569504[_0xccf8('0x3d')][_0xccf8('0x4a')]+'%'};return _0x4c7bcd;})});}_0x5eecbd=_['merge']({},_0x5eecbd,_0x569504[_0xccf8('0x63')]);return _0x38d38f[_0xccf8('0x6a')](_0x5eecbd);}})['then'](function(_0x7e012a){if(_0x7e012a){_0x30c2e3=_0x7e012a[_0xccf8('0x43')];if(!_0x569504[_0xccf8('0x3d')][_0xccf8('0x44')](_0xccf8('0x45'))){_0x5eecbd['limit']=qs['limit'](_0x569504['query'][_0xccf8('0x2a')]);_0x5eecbd[_0xccf8('0x28')]=qs['offset'](_0x569504[_0xccf8('0x3d')][_0xccf8('0x28')]);}return _0x38d38f[_0xccf8('0x6a')](_0x5eecbd);}})[_0xccf8('0x1e')](function(_0x26fe8a){if(_0x26fe8a){return _0x26fe8a?{'count':_0x30c2e3,'rows':_0x26fe8a}:null;}})[_0xccf8('0x1e')](respondWithResult(_0x2973b2,null))[_0xccf8('0x52')](handleError(_0x2973b2,null));};exports[_0xccf8('0x6c')]=function(_0x2c33ee,_0x15cbb1,_0x1cfde0){var _0x59009f=_0x2c33ee['body'][_0xccf8('0x6d')];return db[_0xccf8('0x6b')][_0xccf8('0x50')]({'where':{'id':_0x59009f},'attributes':['id'],'include':[{'model':db[_0xccf8('0x6e')],'as':'Agents','attributes':['id',_0xccf8('0x37'),_0xccf8('0x6f'),_0xccf8('0x70'),_0xccf8('0x71')],'raw':!![]}]})[_0xccf8('0x1e')](function(_0x36b9e6){if(_0x36b9e6){var _0x40ab97=_[_0xccf8('0x72')](_0x36b9e6,function(_0x433b2d){var _0x722daf=_0x433b2d['get']({'plain':!![]});return _0x722daf[_0xccf8('0x73')];});return db[_0xccf8('0x3a')][_0xccf8('0x56')]({'where':{'id':_0x2c33ee[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](function(_0x1351df){return db['sequelize'][_0xccf8('0x74')](function(_0x135f8d){return _0x1351df['addTeams'](_0x59009f,{'transaction':_0x135f8d})['then'](function(){return BPromise[_0xccf8('0x75')](_0x40ab97,function(_0x243b72){return db['UserChatQueue'][_0xccf8('0x76')]({'where':{'UserId':_0x243b72['id'],'ChatQueueId':_0x2c33ee[_0xccf8('0x54')]['id']},'transaction':_0x135f8d});});})['then'](function(){_0x40ab97['forEach'](function(_0x5aeaaf){socket[_0xccf8('0x77')](_0xccf8('0x78'),{'UserId':_0x5aeaaf['id'],'ChatQueueId':_0x1351df['id']});});});});});}})[_0xccf8('0x1e')](respondWithStatusCode(_0x15cbb1,null))['catch'](handleError(_0x15cbb1,null));};exports[_0xccf8('0x79')]=function(_0x284fe8,_0x54d65a,_0xbd3f4a){return db[_0xccf8('0x6b')][_0xccf8('0x50')]({'where':{'id':_0x284fe8['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xccf8('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xccf8('0x1e')](handleEntityNotFound(_0x54d65a,null))[_0xccf8('0x1e')](function(_0x32662f){var _0x340833=_[_0xccf8('0x39')](_0x32662f,'id');var _0x106e29=[];var _0x578853=[];var _0xde426=squel[_0xccf8('0x7a')]();_0xde426[_0xccf8('0x7b')](_0xccf8('0x7c'))[_0xccf8('0x7d')](_0xccf8('0x7e'),'tq')['join'](_0xccf8('0x7f'),'ut',_0xccf8('0x80'))['where'](_0xccf8('0x81'),_0x284fe8[_0xccf8('0x54')]['id']);for(var _0x144d4c=0x0;_0x144d4c<_0x32662f[_0xccf8('0x43')];_0x144d4c+=0x1){let _0x4e6b01=_0x32662f[_0x144d4c];for(var _0x31b442=0x0;_0x31b442<_0x4e6b01['Agents'][_0xccf8('0x43')];_0x31b442+=0x1){let _0x190aed=_0x4e6b01[_0xccf8('0x73')][_0x31b442];var _0x444738=_0xde426['clone']();_0x444738[_0xccf8('0x48')](_0xccf8('0x82'),_0x190aed['id']);_0x578853['push'](db[_0xccf8('0x83')][_0xccf8('0x3d')](_0x444738[_0xccf8('0x84')](),{'type':db[_0xccf8('0x83')][_0xccf8('0x85')]['SELECT']})['then'](function(_0x5a80f4){if(_0x5a80f4[_0xccf8('0x43')]===0x1){return _0x190aed['id'];}else{var _0x5e04dd=_[_0xccf8('0x86')](_[_0xccf8('0x39')](_0x5a80f4,_0xccf8('0x87')),function(_0x58c8fe){return _[_0xccf8('0x88')](_0x340833,_0x58c8fe);});if(_0x5e04dd){return _0x190aed['id'];}}}));}}return BPromise['all'](_0x578853)[_0xccf8('0x1e')](function(_0x3fb371){_0x106e29=_(_0x106e29)[_0xccf8('0x89')](_0x3fb371)[_0xccf8('0x8a')]()[_0xccf8('0x8b')]();return db[_0xccf8('0x3a')][_0xccf8('0x56')]({'where':{'id':_0x284fe8['params']['id']}})[_0xccf8('0x1e')](function(_0x121523){return db[_0xccf8('0x83')]['transaction'](function(_0x493a94){return _0x121523['removeTeams'](_0x284fe8['query']['ids'],{'transaction':_0x493a94})[_0xccf8('0x1e')](function(){if(!_[_0xccf8('0x8c')](_0x106e29)){return _0x121523[_0xccf8('0x8d')](_0x106e29,{'transaction':_0x493a94});}})[_0xccf8('0x1e')](function(){_0x106e29[_0xccf8('0x8e')](function(_0x36c856){socket[_0xccf8('0x77')](_0xccf8('0x8f'),{'UserId':_0x36c856,'ChatQueueId':_0x121523['id']});});});});});});})[_0xccf8('0x1e')](respondWithStatusCode(_0x54d65a,null))[_0xccf8('0x52')](handleError(_0x54d65a,null));};exports['addAgents']=function(_0x10ce97,_0x2396b5,_0x40c9ce){return db[_0xccf8('0x3a')][_0xccf8('0x56')]({'where':{'id':_0x10ce97[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](handleEntityNotFound(_0x2396b5,null))['then'](function(_0x3c4772){if(_0x3c4772){return _0x3c4772[_0xccf8('0x90')](_0x10ce97[_0xccf8('0x57')][_0xccf8('0x6d')],_[_0xccf8('0x91')](_0x10ce97['body'],[_0xccf8('0x6d'),'id'])||{})[_0xccf8('0x92')](function(_0x265fae){for(var _0x42f3d2=0x0;_0x42f3d2<_0x10ce97[_0xccf8('0x57')]['ids'][_0xccf8('0x43')];_0x42f3d2+=0x1){socket[_0xccf8('0x77')](_0xccf8('0x78'),{'UserId':Number(_0x10ce97[_0xccf8('0x57')][_0xccf8('0x6d')][_0x42f3d2]),'ChatQueueId':Number(_0x10ce97[_0xccf8('0x54')]['id'])});}return _0x265fae;});}})[_0xccf8('0x1e')](respondWithResult(_0x2396b5,null))[_0xccf8('0x52')](handleError(_0x2396b5,null));};exports[_0xccf8('0x8d')]=function(_0x185240,_0x45179a,_0x4cefde){return db['ChatQueue'][_0xccf8('0x56')]({'where':{'id':_0x185240[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](handleEntityNotFound(_0x45179a,null))[_0xccf8('0x1e')](function(_0x3fb274){if(_0x3fb274){return _0x3fb274['removeAgents'](_0x185240[_0xccf8('0x3d')]['ids'])[_0xccf8('0x1e')](function(){if(_[_0xccf8('0x93')](_0x185240['query'][_0xccf8('0x6d')])){for(var _0xbfd6d=0x0;_0xbfd6d<_0x185240[_0xccf8('0x3d')]['ids'][_0xccf8('0x43')];_0xbfd6d+=0x1){socket[_0xccf8('0x77')](_0xccf8('0x8f'),{'UserId':Number(_0x185240[_0xccf8('0x3d')][_0xccf8('0x6d')][_0xbfd6d]),'ChatQueueId':Number(_0x185240[_0xccf8('0x54')]['id'])});}}else{socket[_0xccf8('0x77')](_0xccf8('0x8f'),{'UserId':Number(_0x185240[_0xccf8('0x3d')]['ids']),'ChatQueueId':Number(_0x185240['params']['id'])});}});}})[_0xccf8('0x1e')](respondWithStatusCode(_0x45179a,null))[_0xccf8('0x52')](handleError(_0x45179a,null));};exports['getAgents']=function(_0x1816d8,_0x480970,_0x57035b){var _0xc3a94b={};var _0x2e4e9e={};var _0x48e48e;var _0x1477e4;return db[_0xccf8('0x3a')][_0xccf8('0x60')]({'where':{'id':_0x1816d8[_0xccf8('0x54')]['id']}})[_0xccf8('0x1e')](handleEntityNotFound(_0x480970,null))[_0xccf8('0x1e')](function(_0x41a70c){if(_0x41a70c){_0x48e48e=_0x41a70c;_0x2e4e9e[_0xccf8('0x40')]=_[_0xccf8('0x55')](db[_0xccf8('0x6e')][_0xccf8('0x3b')]);_0x2e4e9e[_0xccf8('0x3d')]=_[_0xccf8('0x55')](_0x1816d8[_0xccf8('0x3d')]);_0x2e4e9e['filters']=_['intersection'](_0x2e4e9e['model'],_0x2e4e9e['query']);_0xc3a94b[_0xccf8('0x41')]=_[_0xccf8('0x3f')](_0x2e4e9e['model'],qs[_0xccf8('0x42')](_0x1816d8[_0xccf8('0x3d')][_0xccf8('0x42')]));_0xc3a94b['attributes']=_0xc3a94b['attributes'][_0xccf8('0x43')]?_0xc3a94b['attributes']:_0x2e4e9e[_0xccf8('0x40')];_0xc3a94b[_0xccf8('0x46')]=qs[_0xccf8('0x47')](_0x1816d8['query'][_0xccf8('0x47')]);_0xc3a94b[_0xccf8('0x48')]=qs['filters'](_[_0xccf8('0x49')](_0x1816d8[_0xccf8('0x3d')],_0x2e4e9e['filters']));if(_0x1816d8[_0xccf8('0x3d')][_0xccf8('0x4a')]){_0xc3a94b[_0xccf8('0x48')]=_['merge'](_0xc3a94b['where'],{'$or':_[_0xccf8('0x39')](_0xc3a94b['attributes'],function(_0x2e4260){var _0x258d80={};_0x258d80[_0x2e4260]={'$like':'%'+_0x1816d8['query'][_0xccf8('0x4a')]+'%'};return _0x258d80;})});}_0xc3a94b=_['merge']({},_0xc3a94b,_0x1816d8[_0xccf8('0x63')]);return _0x48e48e['getAgents'](_0xc3a94b);}})[_0xccf8('0x1e')](function(_0xd74e09){if(_0xd74e09){_0x1477e4=_0xd74e09[_0xccf8('0x43')];if(!_0x1816d8['query']['hasOwnProperty'](_0xccf8('0x45'))){_0xc3a94b['limit']=qs['limit'](_0x1816d8['query']['limit']);_0xc3a94b['offset']=qs[_0xccf8('0x28')](_0x1816d8['query'][_0xccf8('0x28')]);}return _0x48e48e[_0xccf8('0x94')](_0xc3a94b);}})[_0xccf8('0x1e')](function(_0x38a669){if(_0x38a669){return _0x38a669?{'count':_0x1477e4,'rows':_0x38a669}:null;}})['then'](respondWithResult(_0x480970,null))['catch'](handleError(_0x480970,null));}; \ No newline at end of file +var _0x9487=['zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','end','stack','name','send','map','ChatQueue','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','spread','isArray','getAgents','eml-format','rimraf'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9487,0x132));var _0x7948=function(_0x13bf70,_0x1d6a0b){_0x13bf70=_0x13bf70-0x0;var _0x2d1e30=_0x9487[_0x13bf70];return _0x2d1e30;};'use strict';var emlformat=require(_0x7948('0x0'));var rimraf=require(_0x7948('0x1'));var zipdir=require(_0x7948('0x2'));var jsonpatch=require(_0x7948('0x3'));var rp=require(_0x7948('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7948('0x5'));var util=require(_0x7948('0x6'));var path=require(_0x7948('0x7'));var sox=require('sox');var csv=require(_0x7948('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7948('0x9'));var _=require(_0x7948('0xa'));var squel=require(_0x7948('0xb'));var crypto=require('crypto');var jsforce=require(_0x7948('0xc'));var deskjs=require(_0x7948('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7948('0xe'));var Papa=require(_0x7948('0xf'));var Redis=require(_0x7948('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7948('0x11'));var as=require(_0x7948('0x12'));var hardwareService=require(_0x7948('0x13'));var logger=require(_0x7948('0x14'))('api');var utils=require(_0x7948('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7948('0x16'));var db=require(_0x7948('0x17'))['db'];config['redis']=_[_0x7948('0x18')](config[_0x7948('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7948('0x1a'))(new Redis(config['redis']));require(_0x7948('0x1b'))[_0x7948('0x1c')](socket);var jayson=require(_0x7948('0x1d'));var client=jayson['client'][_0x7948('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1ae3db,_0x48c194,_0x302f51,_0x4488df){return new BPromise(function(_0x237350,_0x77dd14){var _0x14f1ca=_0x4488df||client;return _0x14f1ca['request'](_0x1ae3db,_0x302f51)[_0x7948('0x1f')](function(_0x444615){logger[_0x7948('0x20')](_0x7948('0x21'),_0x48c194,'request\x20sent');logger[_0x7948('0x22')](_0x7948('0x23'),_0x48c194,_0x7948('0x24'),JSON[_0x7948('0x25')](_0x444615));if(_0x444615[_0x7948('0x26')]){if(_0x444615['error'][_0x7948('0x27')]===0x1f4){logger[_0x7948('0x26')](_0x7948('0x21'),_0x48c194,_0x444615[_0x7948('0x26')][_0x7948('0x28')]);return _0x77dd14(_0x444615[_0x7948('0x26')][_0x7948('0x28')]);}logger['error'](_0x7948('0x21'),_0x48c194,_0x444615['error'][_0x7948('0x28')]);return _0x237350(_0x444615[_0x7948('0x26')][_0x7948('0x28')]);}else{logger[_0x7948('0x20')]('ChatQueue,\x20%s,\x20%s',_0x48c194,'request\x20sent');_0x237350(_0x444615[_0x7948('0x29')][_0x7948('0x28')]);}})['catch'](function(_0x673024){logger['error'](_0x7948('0x21'),_0x48c194,_0x673024);_0x77dd14(_0x673024);});});}function respondWithStatusCode(_0x40ac5f,_0x33319e){_0x33319e=_0x33319e||0xcc;return function(_0x593efb){if(_0x593efb){return _0x40ac5f[_0x7948('0x2a')](_0x33319e);}return _0x40ac5f['status'](_0x33319e)['end']();};}function respondWithResult(_0x273170,_0x1cbe07){_0x1cbe07=_0x1cbe07||0xc8;return function(_0x3e962b){if(_0x3e962b){return _0x273170[_0x7948('0x2b')](_0x1cbe07)[_0x7948('0x2c')](_0x3e962b);}};}function respondWithFilteredResult(_0x275bcb,_0x14baf0){return function(_0x3956f7){if(_0x3956f7){var _0xccc109=typeof _0x14baf0[_0x7948('0x2d')]==='undefined'&&typeof _0x14baf0[_0x7948('0x2e')]===_0x7948('0x2f');var _0x187216=_0x3956f7[_0x7948('0x30')];var _0x585479=_0xccc109?0x0:_0x14baf0[_0x7948('0x2d')];var _0x2ef29b=_0xccc109?_0x3956f7[_0x7948('0x30')]:_0x14baf0[_0x7948('0x2d')]+_0x14baf0['limit'];var _0x4a3268;if(_0x2ef29b>=_0x187216){_0x2ef29b=_0x187216;_0x4a3268=0xc8;}else{_0x4a3268=0xce;}_0x275bcb['status'](_0x4a3268);return _0x275bcb[_0x7948('0x31')]('Content-Range',_0x585479+'-'+_0x2ef29b+'/'+_0x187216)[_0x7948('0x2c')](_0x3956f7);}return null;};}function patchUpdates(_0x1daa19){return function(_0x1e5f15){try{jsonpatch[_0x7948('0x32')](_0x1e5f15,_0x1daa19,!![]);}catch(_0xb594c2){return BPromise[_0x7948('0x33')](_0xb594c2);}return _0x1e5f15[_0x7948('0x34')]();};}function saveUpdates(_0x14c727,_0x4874a0){return function(_0x3802cc){if(_0x3802cc){return _0x3802cc[_0x7948('0x35')](_0x14c727)[_0x7948('0x1f')](function(_0x9eec5d){return _0x9eec5d;});}return null;};}function removeEntity(_0x14c334,_0xe8d3e9){return function(_0x3152ab){if(_0x3152ab){return _0x3152ab['destroy']()[_0x7948('0x1f')](function(){var _0x33fc0e=_0x3152ab[_0x7948('0x36')]({'plain':!![]});var _0x38fb9a=_0x7948('0x37');return db[_0x7948('0x38')][_0x7948('0x39')]({'where':{'type':_0x38fb9a,'resourceId':_0x33fc0e['id']}})[_0x7948('0x1f')](function(){return _0x3152ab;});})[_0x7948('0x1f')](function(){_0x14c334[_0x7948('0x2b')](0xcc)[_0x7948('0x3a')]();});}};}function handleEntityNotFound(_0x3ef689,_0x14a1e9){return function(_0x150ed6){if(!_0x150ed6){_0x3ef689[_0x7948('0x2a')](0x194);}return _0x150ed6;};}function handleError(_0x5881a8,_0x5ed499){_0x5ed499=_0x5ed499||0x1f4;return function(_0x36ad3c){logger[_0x7948('0x26')](_0x36ad3c[_0x7948('0x3b')]);if(_0x36ad3c['name']){delete _0x36ad3c[_0x7948('0x3c')];}_0x5881a8[_0x7948('0x2b')](_0x5ed499)[_0x7948('0x3d')](_0x36ad3c);};}exports['index']=function(_0x44fde7,_0xff31f6){var _0x19834b={},_0x10eb27={},_0x3ba3da={'count':0x0,'rows':[]};var _0x5cf589=_[_0x7948('0x3e')](db[_0x7948('0x3f')]['rawAttributes'],function(_0x522178){return{'name':_0x522178['fieldName'],'type':_0x522178[_0x7948('0x40')][_0x7948('0x41')]};});_0x10eb27[_0x7948('0x42')]=_['map'](_0x5cf589,_0x7948('0x3c'));_0x10eb27['query']=_[_0x7948('0x43')](_0x44fde7[_0x7948('0x44')]);_0x10eb27['filters']=_[_0x7948('0x45')](_0x10eb27[_0x7948('0x42')],_0x10eb27[_0x7948('0x44')]);_0x19834b[_0x7948('0x46')]=_[_0x7948('0x45')](_0x10eb27[_0x7948('0x42')],qs[_0x7948('0x47')](_0x44fde7['query'][_0x7948('0x47')]));_0x19834b[_0x7948('0x46')]=_0x19834b[_0x7948('0x46')][_0x7948('0x48')]?_0x19834b[_0x7948('0x46')]:_0x10eb27['model'];if(!_0x44fde7[_0x7948('0x44')][_0x7948('0x49')](_0x7948('0x4a'))){_0x19834b['limit']=qs['limit'](_0x44fde7['query']['limit']);_0x19834b['offset']=qs['offset'](_0x44fde7['query'][_0x7948('0x2d')]);}_0x19834b[_0x7948('0x4b')]=qs['sort'](_0x44fde7[_0x7948('0x44')][_0x7948('0x4c')]);_0x19834b['where']=qs[_0x7948('0x4d')](_[_0x7948('0x4e')](_0x44fde7[_0x7948('0x44')],_0x10eb27[_0x7948('0x4d')]),_0x5cf589);if(_0x44fde7[_0x7948('0x44')][_0x7948('0x4f')]){_0x19834b[_0x7948('0x50')]=_[_0x7948('0x51')](_0x19834b[_0x7948('0x50')],{'$or':_[_0x7948('0x3e')](_0x5cf589,function(_0xcab2fb){if(_0xcab2fb[_0x7948('0x40')]!=='VIRTUAL'){var _0x5d6e23={};_0x5d6e23[_0xcab2fb[_0x7948('0x3c')]]={'$like':'%'+_0x44fde7[_0x7948('0x44')]['filter']+'%'};return _0x5d6e23;}})});}_0x19834b=_['merge']({},_0x19834b,_0x44fde7[_0x7948('0x52')]);var _0x47f0a7={'where':_0x19834b['where']};return db['ChatQueue'][_0x7948('0x30')](_0x47f0a7)[_0x7948('0x1f')](function(_0x2e8199){_0x3ba3da[_0x7948('0x30')]=_0x2e8199;if(_0x44fde7['query'][_0x7948('0x53')]){_0x19834b[_0x7948('0x54')]=[{'all':!![]}];}return db[_0x7948('0x3f')][_0x7948('0x55')](_0x19834b);})[_0x7948('0x1f')](function(_0x4b3b8f){_0x3ba3da[_0x7948('0x56')]=_0x4b3b8f;return _0x3ba3da;})['then'](respondWithFilteredResult(_0xff31f6,_0x19834b))[_0x7948('0x57')](handleError(_0xff31f6,null));};exports[_0x7948('0x58')]=function(_0x53ac38,_0x353841){var _0x14040f={'raw':!![],'where':{'id':_0x53ac38[_0x7948('0x59')]['id']}},_0x3329c2={};_0x3329c2['model']=_[_0x7948('0x43')](db['ChatQueue'][_0x7948('0x5a')]);_0x3329c2[_0x7948('0x44')]=_['keys'](_0x53ac38[_0x7948('0x44')]);_0x3329c2[_0x7948('0x4d')]=_['intersection'](_0x3329c2[_0x7948('0x42')],_0x3329c2[_0x7948('0x44')]);_0x14040f['attributes']=_[_0x7948('0x45')](_0x3329c2[_0x7948('0x42')],qs[_0x7948('0x47')](_0x53ac38[_0x7948('0x44')][_0x7948('0x47')]));_0x14040f[_0x7948('0x46')]=_0x14040f[_0x7948('0x46')]['length']?_0x14040f[_0x7948('0x46')]:_0x3329c2[_0x7948('0x42')];if(_0x53ac38['query']['includeAll']){_0x14040f[_0x7948('0x54')]=[{'all':!![]}];}_0x14040f=_[_0x7948('0x51')]({},_0x14040f,_0x53ac38[_0x7948('0x52')]);return db['ChatQueue']['find'](_0x14040f)[_0x7948('0x1f')](handleEntityNotFound(_0x353841,null))[_0x7948('0x1f')](respondWithResult(_0x353841,null))[_0x7948('0x57')](handleError(_0x353841,null));};exports['create']=function(_0x5241c3,_0x5998bc){return db[_0x7948('0x3f')][_0x7948('0x5b')](_0x5241c3[_0x7948('0x5c')],{})[_0x7948('0x1f')](function(_0x541568){var _0x3cbdb3=_0x5241c3[_0x7948('0x5d')][_0x7948('0x36')]({'plain':!![]});if(!_0x3cbdb3)throw new Error(_0x7948('0x5e'));if(_0x3cbdb3[_0x7948('0x5f')]===_0x7948('0x5d')){var _0x109f46=_0x541568['get']({'plain':!![]});var _0x10866a=_0x7948('0x37');return db[_0x7948('0x60')][_0x7948('0x61')]({'where':{'name':_0x10866a,'userProfileId':_0x3cbdb3[_0x7948('0x62')]},'raw':!![]})[_0x7948('0x1f')](function(_0x124dd0){if(_0x124dd0&&_0x124dd0[_0x7948('0x63')]===0x0){return db[_0x7948('0x38')][_0x7948('0x5b')]({'name':_0x109f46['name'],'resourceId':_0x109f46['id'],'type':_0x124dd0[_0x7948('0x3c')],'sectionId':_0x124dd0['id']},{})[_0x7948('0x1f')](function(){return _0x541568;});}else{return _0x541568;}})[_0x7948('0x57')](function(_0x47ed09){logger[_0x7948('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47ed09);throw _0x47ed09;});}return _0x541568;})[_0x7948('0x1f')](respondWithResult(_0x5998bc,0xc9))[_0x7948('0x57')](handleError(_0x5998bc,null));};exports['update']=function(_0x320176,_0x2f576a){if(_0x320176['body']['id']){delete _0x320176[_0x7948('0x5c')]['id'];}return db[_0x7948('0x3f')]['find']({'where':{'id':_0x320176[_0x7948('0x59')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x2f576a,null))[_0x7948('0x1f')](saveUpdates(_0x320176[_0x7948('0x5c')],null))[_0x7948('0x1f')](respondWithResult(_0x2f576a,null))[_0x7948('0x57')](handleError(_0x2f576a,null));};exports[_0x7948('0x39')]=function(_0x2c1838,_0x4b5c9d){return db[_0x7948('0x3f')][_0x7948('0x61')]({'where':{'id':_0x2c1838[_0x7948('0x59')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x4b5c9d,null))[_0x7948('0x1f')](removeEntity(_0x4b5c9d,null))[_0x7948('0x57')](handleError(_0x4b5c9d,null));};exports[_0x7948('0x64')]=function(_0x9cdf89,_0x588e98){return db[_0x7948('0x3f')][_0x7948('0x64')]()[_0x7948('0x1f')](respondWithResult(_0x588e98,null))[_0x7948('0x57')](handleError(_0x588e98,null));};exports['getMembers']=function(_0x2b533e,_0x413e6e,_0x35de85){var _0x23ac40={'raw':!![],'where':{}},_0x4dc90e={},_0x2efe98;return db['ChatQueue'][_0x7948('0x65')]({'where':{'id':_0x2b533e[_0x7948('0x59')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x413e6e,null))[_0x7948('0x1f')](function(_0x290544){if(_0x290544){_0x2efe98=_0x290544['get']({'plain':!![]});_0x4dc90e[_0x7948('0x42')]=_[_0x7948('0x43')](db['UserChatQueue'][_0x7948('0x5a')]);_0x4dc90e[_0x7948('0x44')]=_[_0x7948('0x43')](_0x2b533e[_0x7948('0x44')]);_0x4dc90e['filters']=_['intersection'](_0x4dc90e['model'],_0x4dc90e[_0x7948('0x44')]);_0x23ac40[_0x7948('0x46')]=_[_0x7948('0x45')](_0x4dc90e['model'],qs[_0x7948('0x47')](_0x2b533e[_0x7948('0x44')][_0x7948('0x47')]));_0x23ac40[_0x7948('0x46')]=_0x23ac40[_0x7948('0x46')]['length']?_0x23ac40[_0x7948('0x46')]:_0x4dc90e[_0x7948('0x42')];if(!_0x2b533e[_0x7948('0x44')][_0x7948('0x49')]('nolimit')){_0x23ac40[_0x7948('0x2e')]=qs[_0x7948('0x2e')](_0x2b533e[_0x7948('0x44')]['limit']);_0x23ac40[_0x7948('0x2d')]=qs[_0x7948('0x2d')](_0x2b533e[_0x7948('0x44')][_0x7948('0x2d')]);}_0x23ac40['order']=qs['sort'](_0x2b533e[_0x7948('0x44')][_0x7948('0x4c')]);_0x23ac40[_0x7948('0x50')]=qs[_0x7948('0x4d')](_['pick'](_0x2b533e[_0x7948('0x44')],_0x4dc90e[_0x7948('0x4d')]));_0x23ac40[_0x7948('0x50')][_0x7948('0x66')]=_0x290544['id'];if(_0x2b533e[_0x7948('0x44')][_0x7948('0x4f')]){_0x23ac40[_0x7948('0x50')]=_[_0x7948('0x51')](_0x23ac40['where'],{'$or':_[_0x7948('0x3e')](_0x23ac40[_0x7948('0x46')],function(_0x44bc08){var _0x3dc5fb={};_0x3dc5fb[_0x44bc08]={'$like':'%'+_0x2b533e[_0x7948('0x44')][_0x7948('0x4f')]+'%'};return _0x3dc5fb;})});}_0x23ac40=_[_0x7948('0x51')]({},_0x23ac40,_0x2b533e[_0x7948('0x52')]);return db[_0x7948('0x67')]['findAll'](_0x23ac40);}})[_0x7948('0x1f')](function(_0x32ec1d){if(_0x32ec1d){return db[_0x7948('0x68')][_0x7948('0x69')]({'where':{'id':_[_0x7948('0x3e')](_0x32ec1d,_0x7948('0x6a')),'role':'agent'},'attributes':['id',_0x7948('0x3c'),_0x7948('0x6b'),'updatedAt',_0x7948('0x6c')]});}})[_0x7948('0x1f')](function(_0x426e9c){if(_0x426e9c){return{'count':_0x426e9c[_0x7948('0x30')],'rows':_[_0x7948('0x3e')](_0x426e9c[_0x7948('0x56')],function(_0x5545e5){return{'membername':_0x5545e5[_0x7948('0x3c')],'UserId':_0x5545e5['id'],'queue_name':_0x2efe98[_0x7948('0x3c')],'ChatQueueId':_0x2efe98['id'],'interface':util[_0x7948('0x6d')](_0x7948('0x6e'),_0x7948('0x6f'),_0x5545e5['name']),'penalty':0x0,'paused':_0x5545e5[_0x7948('0x6b')],'createdAt':_0x5545e5[_0x7948('0x6c')],'updatedAt':_0x5545e5[_0x7948('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7948('0x1f')](respondWithFilteredResult(_0x413e6e,_0x23ac40))[_0x7948('0x57')](handleError(_0x413e6e,null));};exports['getTeams']=function(_0x1589e5,_0x336f6c,_0x3a234b){var _0x1ce261={};var _0x1016a6={};var _0x18628d;var _0x30efaa;return db[_0x7948('0x3f')]['findOne']({'where':{'id':_0x1589e5['params']['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x336f6c,null))[_0x7948('0x1f')](function(_0x17ccc2){if(_0x17ccc2){_0x18628d=_0x17ccc2;_0x1016a6['model']=_[_0x7948('0x43')](db['Team'][_0x7948('0x5a')]);_0x1016a6[_0x7948('0x44')]=_['keys'](_0x1589e5['query']);_0x1016a6[_0x7948('0x4d')]=_[_0x7948('0x45')](_0x1016a6['model'],_0x1016a6[_0x7948('0x44')]);_0x1ce261[_0x7948('0x46')]=_['intersection'](_0x1016a6[_0x7948('0x42')],qs['fields'](_0x1589e5[_0x7948('0x44')][_0x7948('0x47')]));_0x1ce261[_0x7948('0x46')]=_0x1ce261['attributes'][_0x7948('0x48')]?_0x1ce261[_0x7948('0x46')]:_0x1016a6['model'];_0x1ce261[_0x7948('0x4b')]=qs[_0x7948('0x4c')](_0x1589e5[_0x7948('0x44')][_0x7948('0x4c')]);_0x1ce261['where']=qs[_0x7948('0x4d')](_['pick'](_0x1589e5[_0x7948('0x44')],_0x1016a6[_0x7948('0x4d')]));if(_0x1589e5['query'][_0x7948('0x4f')]){_0x1ce261['where']=_[_0x7948('0x51')](_0x1ce261[_0x7948('0x50')],{'$or':_[_0x7948('0x3e')](_0x1ce261[_0x7948('0x46')],function(_0x38b791){var _0x258313={};_0x258313[_0x38b791]={'$like':'%'+_0x1589e5[_0x7948('0x44')][_0x7948('0x4f')]+'%'};return _0x258313;})});}_0x1ce261=_[_0x7948('0x51')]({},_0x1ce261,_0x1589e5[_0x7948('0x52')]);return _0x18628d[_0x7948('0x71')](_0x1ce261);}})[_0x7948('0x1f')](function(_0x1da96d){if(_0x1da96d){_0x30efaa=_0x1da96d[_0x7948('0x48')];if(!_0x1589e5[_0x7948('0x44')][_0x7948('0x49')](_0x7948('0x4a'))){_0x1ce261['limit']=qs['limit'](_0x1589e5['query']['limit']);_0x1ce261[_0x7948('0x2d')]=qs[_0x7948('0x2d')](_0x1589e5['query'][_0x7948('0x2d')]);}return _0x18628d['getTeams'](_0x1ce261);}})[_0x7948('0x1f')](function(_0x12afb5){if(_0x12afb5){return _0x12afb5?{'count':_0x30efaa,'rows':_0x12afb5}:null;}})[_0x7948('0x1f')](respondWithResult(_0x336f6c,null))[_0x7948('0x57')](handleError(_0x336f6c,null));};exports[_0x7948('0x72')]=function(_0x59d214,_0x40f44a,_0x4ad660){var _0x3bd681=_0x59d214['body'][_0x7948('0x73')];return db[_0x7948('0x74')][_0x7948('0x55')]({'where':{'id':_0x3bd681},'attributes':['id'],'include':[{'model':db[_0x7948('0x68')],'as':_0x7948('0x75'),'attributes':['id',_0x7948('0x3c'),_0x7948('0x76'),'voicePause',_0x7948('0x77')],'raw':!![]}]})[_0x7948('0x1f')](function(_0x2b84ec){if(_0x2b84ec){var _0x38d684=_[_0x7948('0x78')](_0x2b84ec,function(_0xa0a733){var _0xa2c0b=_0xa0a733[_0x7948('0x36')]({'plain':!![]});return _0xa2c0b[_0x7948('0x75')];});return db['ChatQueue'][_0x7948('0x61')]({'where':{'id':_0x59d214[_0x7948('0x59')]['id']}})[_0x7948('0x1f')](function(_0x2353ed){return db[_0x7948('0x79')][_0x7948('0x7a')](function(_0x3681f1){return _0x2353ed[_0x7948('0x72')](_0x3bd681,{'transaction':_0x3681f1})[_0x7948('0x1f')](function(){return BPromise[_0x7948('0x7b')](_0x38d684,function(_0x129e37){return db[_0x7948('0x67')][_0x7948('0x7c')]({'where':{'UserId':_0x129e37['id'],'ChatQueueId':_0x59d214['params']['id']},'transaction':_0x3681f1});});})[_0x7948('0x1f')](function(){_0x38d684['forEach'](function(_0x541e16){socket['emit'](_0x7948('0x7d'),{'UserId':_0x541e16['id'],'ChatQueueId':_0x2353ed['id']});});});});});}})['then'](respondWithStatusCode(_0x40f44a,null))[_0x7948('0x57')](handleError(_0x40f44a,null));};exports[_0x7948('0x7e')]=function(_0x5dea3e,_0x41dc5b,_0x37de7f){return db['Team'][_0x7948('0x55')]({'where':{'id':_0x5dea3e[_0x7948('0x44')][_0x7948('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7948('0x1f')](handleEntityNotFound(_0x41dc5b,null))[_0x7948('0x1f')](function(_0xee15dd){var _0x554870=_['map'](_0xee15dd,'id');var _0x593c7d=[];var _0x3b9366=[];var _0xc49fe3=squel[_0x7948('0x7f')]();_0xc49fe3[_0x7948('0x80')]('tq.TeamId')[_0x7948('0x81')](_0x7948('0x82'),'tq')['join'](_0x7948('0x83'),'ut',_0x7948('0x84'))['where'](_0x7948('0x85'),_0x5dea3e[_0x7948('0x59')]['id']);for(var _0x3a36dd=0x0;_0x3a36dd<_0xee15dd[_0x7948('0x48')];_0x3a36dd+=0x1){let _0x2cc5b2=_0xee15dd[_0x3a36dd];for(var _0x481d3e=0x0;_0x481d3e<_0x2cc5b2['Agents'][_0x7948('0x48')];_0x481d3e+=0x1){let _0x4541b3=_0x2cc5b2[_0x7948('0x75')][_0x481d3e];var _0x5beb1a=_0xc49fe3[_0x7948('0x86')]();_0x5beb1a['where'](_0x7948('0x87'),_0x4541b3['id']);_0x3b9366[_0x7948('0x88')](db[_0x7948('0x79')][_0x7948('0x44')](_0x5beb1a[_0x7948('0x89')](),{'type':db[_0x7948('0x79')][_0x7948('0x8a')][_0x7948('0x8b')]})['then'](function(_0x12c3b7){if(_0x12c3b7[_0x7948('0x48')]===0x1){return _0x4541b3['id'];}else{var _0xacefd4=_[_0x7948('0x8c')](_[_0x7948('0x3e')](_0x12c3b7,_0x7948('0x8d')),function(_0x4cd250){return _['includes'](_0x554870,_0x4cd250);});if(_0xacefd4){return _0x4541b3['id'];}}}));}}return BPromise[_0x7948('0x8e')](_0x3b9366)[_0x7948('0x1f')](function(_0x6a99e0){_0x593c7d=_(_0x593c7d)[_0x7948('0x8f')](_0x6a99e0)[_0x7948('0x90')]()[_0x7948('0x91')]();return db[_0x7948('0x3f')][_0x7948('0x61')]({'where':{'id':_0x5dea3e[_0x7948('0x59')]['id']}})['then'](function(_0x76590f){return db[_0x7948('0x79')][_0x7948('0x7a')](function(_0x5021bf){return _0x76590f[_0x7948('0x7e')](_0x5dea3e[_0x7948('0x44')]['ids'],{'transaction':_0x5021bf})[_0x7948('0x1f')](function(){if(!_[_0x7948('0x92')](_0x593c7d)){return _0x76590f[_0x7948('0x93')](_0x593c7d,{'transaction':_0x5021bf});}})[_0x7948('0x1f')](function(){_0x593c7d[_0x7948('0x94')](function(_0x9ae69c){socket[_0x7948('0x95')](_0x7948('0x96'),{'UserId':_0x9ae69c,'ChatQueueId':_0x76590f['id']});});});});});});})[_0x7948('0x1f')](respondWithStatusCode(_0x41dc5b,null))[_0x7948('0x57')](handleError(_0x41dc5b,null));};exports['addAgents']=function(_0x56044d,_0x51dbdf,_0x17a3a3){return db['ChatQueue'][_0x7948('0x61')]({'where':{'id':_0x56044d['params']['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0x51dbdf,null))[_0x7948('0x1f')](function(_0x64bad4){if(_0x64bad4){return _0x64bad4['addAgents'](_0x56044d[_0x7948('0x5c')]['ids'],_['omit'](_0x56044d['body'],['ids','id'])||{})[_0x7948('0x97')](function(_0x57b729){for(var _0x17d4d5=0x0;_0x17d4d5<_0x56044d[_0x7948('0x5c')][_0x7948('0x73')][_0x7948('0x48')];_0x17d4d5+=0x1){socket[_0x7948('0x95')]('userChatQueue:save',{'UserId':Number(_0x56044d[_0x7948('0x5c')][_0x7948('0x73')][_0x17d4d5]),'ChatQueueId':Number(_0x56044d['params']['id'])});}return _0x57b729;});}})[_0x7948('0x1f')](respondWithResult(_0x51dbdf,null))[_0x7948('0x57')](handleError(_0x51dbdf,null));};exports[_0x7948('0x93')]=function(_0x3e4761,_0xda2dd9,_0x28ae48){return db[_0x7948('0x3f')][_0x7948('0x61')]({'where':{'id':_0x3e4761[_0x7948('0x59')]['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0xda2dd9,null))[_0x7948('0x1f')](function(_0x304d26){if(_0x304d26){return _0x304d26[_0x7948('0x93')](_0x3e4761[_0x7948('0x44')][_0x7948('0x73')])['then'](function(){if(_[_0x7948('0x98')](_0x3e4761[_0x7948('0x44')][_0x7948('0x73')])){for(var _0x21ecc1=0x0;_0x21ecc1<_0x3e4761[_0x7948('0x44')]['ids'][_0x7948('0x48')];_0x21ecc1+=0x1){socket['emit'](_0x7948('0x96'),{'UserId':Number(_0x3e4761[_0x7948('0x44')][_0x7948('0x73')][_0x21ecc1]),'ChatQueueId':Number(_0x3e4761[_0x7948('0x59')]['id'])});}}else{socket[_0x7948('0x95')](_0x7948('0x96'),{'UserId':Number(_0x3e4761[_0x7948('0x44')][_0x7948('0x73')]),'ChatQueueId':Number(_0x3e4761[_0x7948('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0xda2dd9,null))[_0x7948('0x57')](handleError(_0xda2dd9,null));};exports[_0x7948('0x99')]=function(_0x8295b3,_0xc4f49c,_0x4667ee){var _0x507b88={};var _0x1eb2a2={};var _0x56daed;var _0x1329bf;return db[_0x7948('0x3f')]['findOne']({'where':{'id':_0x8295b3['params']['id']}})[_0x7948('0x1f')](handleEntityNotFound(_0xc4f49c,null))[_0x7948('0x1f')](function(_0x579757){if(_0x579757){_0x56daed=_0x579757;_0x1eb2a2[_0x7948('0x42')]=_[_0x7948('0x43')](db[_0x7948('0x68')][_0x7948('0x5a')]);_0x1eb2a2['query']=_[_0x7948('0x43')](_0x8295b3['query']);_0x1eb2a2['filters']=_[_0x7948('0x45')](_0x1eb2a2[_0x7948('0x42')],_0x1eb2a2['query']);_0x507b88[_0x7948('0x46')]=_[_0x7948('0x45')](_0x1eb2a2[_0x7948('0x42')],qs[_0x7948('0x47')](_0x8295b3[_0x7948('0x44')][_0x7948('0x47')]));_0x507b88[_0x7948('0x46')]=_0x507b88[_0x7948('0x46')][_0x7948('0x48')]?_0x507b88[_0x7948('0x46')]:_0x1eb2a2[_0x7948('0x42')];_0x507b88[_0x7948('0x4b')]=qs[_0x7948('0x4c')](_0x8295b3[_0x7948('0x44')]['sort']);_0x507b88[_0x7948('0x50')]=qs[_0x7948('0x4d')](_[_0x7948('0x4e')](_0x8295b3['query'],_0x1eb2a2[_0x7948('0x4d')]));if(_0x8295b3[_0x7948('0x44')][_0x7948('0x4f')]){_0x507b88[_0x7948('0x50')]=_[_0x7948('0x51')](_0x507b88[_0x7948('0x50')],{'$or':_['map'](_0x507b88[_0x7948('0x46')],function(_0x19913f){var _0x1fdee9={};_0x1fdee9[_0x19913f]={'$like':'%'+_0x8295b3[_0x7948('0x44')][_0x7948('0x4f')]+'%'};return _0x1fdee9;})});}_0x507b88=_[_0x7948('0x51')]({},_0x507b88,_0x8295b3[_0x7948('0x52')]);return _0x56daed[_0x7948('0x99')](_0x507b88);}})[_0x7948('0x1f')](function(_0x55585f){if(_0x55585f){_0x1329bf=_0x55585f['length'];if(!_0x8295b3['query']['hasOwnProperty'](_0x7948('0x4a'))){_0x507b88[_0x7948('0x2e')]=qs[_0x7948('0x2e')](_0x8295b3[_0x7948('0x44')][_0x7948('0x2e')]);_0x507b88[_0x7948('0x2d')]=qs[_0x7948('0x2d')](_0x8295b3[_0x7948('0x44')][_0x7948('0x2d')]);}return _0x56daed['getAgents'](_0x507b88);}})['then'](function(_0x31d504){if(_0x31d504){return _0x31d504?{'count':_0x1329bf,'rows':_0x31d504}:null;}})[_0x7948('0x1f')](respondWithResult(_0xc4f49c,null))['catch'](handleError(_0xc4f49c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 225790d..aed582e 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 _0x3954=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x3954,0x16d));var _0x4395=function(_0x122d65,_0xc9da87){_0x122d65=_0x122d65-0x0;var _0x3b2272=_0x3954[_0x122d65];return _0x3b2272;};'use strict';var EventEmitter=require(_0x4395('0x0'));var ChatQueue=require(_0x4395('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4395('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4395('0x3'),'afterDestroy':_0x4395('0x4')};function emitEvent(_0x2bb142){return function(_0x287ff1,_0x4726b1,_0x5a86b1){ChatQueueEvents[_0x4395('0x5')](_0x2bb142+':'+_0x287ff1['id'],_0x287ff1);ChatQueueEvents['emit'](_0x2bb142,_0x287ff1);_0x5a86b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x4395('0x6')](e,emitEvent(event));}}module[_0x4395('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x93eb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4ed038,_0x33f5cd){var _0x1122cc=function(_0x18a208){while(--_0x18a208){_0x4ed038['push'](_0x4ed038['shift']());}};_0x1122cc(++_0x33f5cd);}(_0x93eb,0x7d));var _0xb93e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x93eb[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xb93e('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb93e('0x1')](0x0);var events={'afterCreate':_0xb93e('0x2'),'afterUpdate':_0xb93e('0x3'),'afterDestroy':_0xb93e('0x4')};function emitEvent(_0x2de528){return function(_0x4a3717,_0x409df8,_0x582ea3){ChatQueueEvents[_0xb93e('0x5')](_0x2de528+':'+_0x4a3717['id'],_0x4a3717);ChatQueueEvents[_0xb93e('0x5')](_0x2de528,_0x4a3717);_0x582ea3(null);};}for(var e in events){if(events[_0xb93e('0x6')](e)){var event=events[e];ChatQueue[_0xb93e('0x7')](e,emitEvent(event));}}module[_0xb93e('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 85e0204..b4121c4 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 _0x7cfb=['ChatQueue','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./chatQueue.attributes','exports','define'];(function(_0xb6a0ff,_0x9d92a){var _0x14c4a1=function(_0x49d85a){while(--_0x49d85a){_0xb6a0ff['push'](_0xb6a0ff['shift']());}};_0x14c4a1(++_0x9d92a);}(_0x7cfb,0x9b));var _0xb7cf=function(_0x1091b2,_0x54971a){_0x1091b2=_0x1091b2-0x0;var _0x38a5a1=_0x7cfb[_0x1091b2];return _0x38a5a1;};'use strict';var _=require(_0xb7cf('0x0'));var util=require(_0xb7cf('0x1'));var logger=require(_0xb7cf('0x2'))('api');var moment=require(_0xb7cf('0x3'));var BPromise=require(_0xb7cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7cf('0x5'));var rimraf=require(_0xb7cf('0x6'));var config=require('../../config/environment');var attributes=require(_0xb7cf('0x7'));module[_0xb7cf('0x8')]=function(_0x139972,_0x2a7725){return _0x139972[_0xb7cf('0x9')](_0xb7cf('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7286=['util','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash'];(function(_0x5ef32e,_0x307684){var _0x59b3dd=function(_0x278172){while(--_0x278172){_0x5ef32e['push'](_0x5ef32e['shift']());}};_0x59b3dd(++_0x307684);}(_0x7286,0x1d8));var _0x6728=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7286[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6728('0x0'));var util=require(_0x6728('0x1'));var logger=require('../../config/logger')(_0x6728('0x2'));var moment=require('moment');var BPromise=require(_0x6728('0x3'));var rp=require(_0x6728('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6728('0x5'));var config=require(_0x6728('0x6'));var attributes=require(_0x6728('0x7'));module[_0x6728('0x8')]=function(_0x4eef60,_0x312dc8){return _0x4eef60['define'](_0x6728('0x9'),attributes,{'tableName':_0x6728('0xa'),'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 3412718..efede99 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 _0x6a6e=['options','where','limit','include','model','map','attributes','GetChatQueue','catch','ShowChatQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ChatQueue','findAll'];(function(_0x27ab3a,_0xcb673b){var _0x2e46c0=function(_0x3a7d99){while(--_0x3a7d99){_0x27ab3a['push'](_0x27ab3a['shift']());}};_0x2e46c0(++_0xcb673b);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x230dd3,_0x26024b){_0x230dd3=_0x230dd3-0x0;var _0x7987fa=_0x6a6e[_0x230dd3];return _0x7987fa;};'use strict';var _=require(_0xe6a6('0x0'));var util=require(_0xe6a6('0x1'));var moment=require('moment');var BPromise=require(_0xe6a6('0x2'));var rs=require(_0xe6a6('0x3'));var fs=require('fs');var Redis=require(_0xe6a6('0x4'));var db=require(_0xe6a6('0x5'))['db'];var utils=require(_0xe6a6('0x6'));var logger=require(_0xe6a6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6a6('0x8'));var client=jayson[_0xe6a6('0x9')][_0xe6a6('0xa')]({'port':0x232a});config[_0xe6a6('0xb')]=_[_0xe6a6('0xc')](config[_0xe6a6('0xb')],{'host':_0xe6a6('0xd'),'port':0x18eb});var socket=require(_0xe6a6('0xe'))(new Redis(config[_0xe6a6('0xb')]));require(_0xe6a6('0xf'))[_0xe6a6('0x10')](socket);function respondWithRpcPromise(_0x38de4e,_0x38b9b6,_0x5594e3){return new BPromise(function(_0x40c667,_0x20448a){return client[_0xe6a6('0x11')](_0x38de4e,_0x5594e3)[_0xe6a6('0x12')](function(_0xe7f5ea){logger[_0xe6a6('0x13')](_0xe6a6('0x14'),_0x38b9b6,_0xe6a6('0x15'));logger[_0xe6a6('0x16')](_0xe6a6('0x17'),_0x38b9b6,'request\x20sent',JSON[_0xe6a6('0x18')](_0xe7f5ea));if(_0xe7f5ea[_0xe6a6('0x19')]){if(_0xe7f5ea[_0xe6a6('0x19')][_0xe6a6('0x1a')]===0x1f4){logger[_0xe6a6('0x19')]('ChatQueue,\x20%s,\x20%s',_0x38b9b6,_0xe7f5ea['error'][_0xe6a6('0x1b')]);return _0x20448a(_0xe7f5ea[_0xe6a6('0x19')][_0xe6a6('0x1b')]);}logger[_0xe6a6('0x19')]('ChatQueue,\x20%s,\x20%s',_0x38b9b6,_0xe7f5ea['error'][_0xe6a6('0x1b')]);return _0x40c667(_0xe7f5ea[_0xe6a6('0x19')][_0xe6a6('0x1b')]);}else{logger['info'](_0xe6a6('0x14'),_0x38b9b6,_0xe6a6('0x15'));_0x40c667(_0xe7f5ea[_0xe6a6('0x1c')][_0xe6a6('0x1b')]);}})['catch'](function(_0x3355d1){logger['error'](_0xe6a6('0x14'),_0x38b9b6,_0x3355d1);_0x20448a(_0x3355d1);});});}exports['GetChatQueue']=function(_0x11e4e8){var _0x5e93a9=this;return new Promise(function(_0x269842,_0x155ab0){return db[_0xe6a6('0x1d')][_0xe6a6('0x1e')]({'raw':_0x11e4e8[_0xe6a6('0x1f')]?_0x11e4e8['options']['raw']===undefined?!![]:![]:!![],'where':_0x11e4e8[_0xe6a6('0x1f')]?_0x11e4e8[_0xe6a6('0x1f')][_0xe6a6('0x20')]||null:null,'attributes':_0x11e4e8[_0xe6a6('0x1f')]?_0x11e4e8[_0xe6a6('0x1f')]['attributes']||null:null,'limit':_0x11e4e8[_0xe6a6('0x1f')]?_0x11e4e8[_0xe6a6('0x1f')][_0xe6a6('0x21')]||null:null,'include':_0x11e4e8[_0xe6a6('0x1f')]?_0x11e4e8[_0xe6a6('0x1f')][_0xe6a6('0x22')]?_['map'](_0x11e4e8['options'][_0xe6a6('0x22')],function(_0x128b50){return{'model':db[_0x128b50[_0xe6a6('0x23')]],'as':_0x128b50['as'],'attributes':_0x128b50['attributes'],'include':_0x128b50[_0xe6a6('0x22')]?_[_0xe6a6('0x24')](_0x128b50['include'],function(_0x199b0c){return{'model':db[_0x199b0c['model']],'as':_0x199b0c['as'],'attributes':_0x199b0c[_0xe6a6('0x25')],'include':_0x199b0c[_0xe6a6('0x22')]?_[_0xe6a6('0x24')](_0x199b0c['include'],function(_0x101bca){return{'model':db[_0x101bca[_0xe6a6('0x23')]],'as':_0x101bca['as'],'attributes':_0x101bca['attributes']};}):[]};}):[]};}):[]:[]})[_0xe6a6('0x12')](function(_0x559cd8){logger[_0xe6a6('0x13')](_0xe6a6('0x26'),_0x11e4e8);logger[_0xe6a6('0x16')](_0xe6a6('0x26'),_0x11e4e8,JSON[_0xe6a6('0x18')](_0x559cd8));_0x269842(_0x559cd8);})[_0xe6a6('0x27')](function(_0x4bbe2d){logger[_0xe6a6('0x19')]('GetChatQueue',_0x4bbe2d[_0xe6a6('0x1b')],_0x11e4e8);_0x155ab0(_0x5e93a9[_0xe6a6('0x19')](0x1f4,_0x4bbe2d[_0xe6a6('0x1b')]));});});};exports[_0xe6a6('0x28')]=function(_0x2a4215){var _0x5b0dac=this;return new Promise(function(_0x452d7a,_0x23b9c3){return db[_0xe6a6('0x1d')][_0xe6a6('0x29')]({'raw':_0x2a4215['options']?_0x2a4215['options'][_0xe6a6('0x2a')]===undefined?!![]:![]:!![],'where':_0x2a4215[_0xe6a6('0x1f')]?_0x2a4215[_0xe6a6('0x1f')]['where']||null:null,'attributes':_0x2a4215[_0xe6a6('0x1f')]?_0x2a4215[_0xe6a6('0x1f')][_0xe6a6('0x25')]||null:null,'include':_0x2a4215['options']?_0x2a4215[_0xe6a6('0x1f')][_0xe6a6('0x22')]?_[_0xe6a6('0x24')](_0x2a4215[_0xe6a6('0x1f')]['include'],function(_0x1a1c66){return{'model':db[_0x1a1c66['model']],'as':_0x1a1c66['as'],'attributes':_0x1a1c66[_0xe6a6('0x25')],'include':_0x1a1c66[_0xe6a6('0x22')]?_[_0xe6a6('0x24')](_0x1a1c66[_0xe6a6('0x22')],function(_0x34e9b3){return{'model':db[_0x34e9b3[_0xe6a6('0x23')]],'as':_0x34e9b3['as'],'attributes':_0x34e9b3[_0xe6a6('0x25')],'include':_0x34e9b3[_0xe6a6('0x22')]?_[_0xe6a6('0x24')](_0x34e9b3['include'],function(_0x13d214){return{'model':db[_0x13d214['model']],'as':_0x13d214['as'],'attributes':_0x13d214[_0xe6a6('0x25')]};}):[]};}):[]};}):[]:[]})[_0xe6a6('0x12')](function(_0xd59cf5){logger[_0xe6a6('0x13')]('ShowChatQueue',_0x2a4215);logger[_0xe6a6('0x16')]('ShowChatQueue',_0x2a4215,JSON[_0xe6a6('0x18')](_0xd59cf5));_0x452d7a(_0xd59cf5);})[_0xe6a6('0x27')](function(_0x51a340){logger[_0xe6a6('0x19')](_0xe6a6('0x28'),_0x51a340[_0xe6a6('0x1b')],_0x2a4215);_0x23b9c3(_0x5b0dac['error'](0x1f4,_0x51a340[_0xe6a6('0x1b')]));});});}; \ No newline at end of file +var _0x659c=['jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','options','raw','where','limit','map','include','model','attributes','GetChatQueue','ShowChatQueue','ChatQueue','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x659c,0x1aa));var _0xc659=function(_0x314d1d,_0x1211b8){_0x314d1d=_0x314d1d-0x0;var _0x31e31d=_0x659c[_0x314d1d];return _0x31e31d;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc659('0x1'));var rs=require(_0xc659('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc659('0x3'))['db'];var utils=require(_0xc659('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc659('0x5'));var jayson=require(_0xc659('0x6'));var client=jayson[_0xc659('0x7')][_0xc659('0x8')]({'port':0x232a});config[_0xc659('0x9')]=_[_0xc659('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc659('0xb'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x29a052,_0x2ea975,_0x422e00){return new BPromise(function(_0x35a046,_0x3f6f5a){return client[_0xc659('0xc')](_0x29a052,_0x422e00)[_0xc659('0xd')](function(_0x4267f3){logger['info'](_0xc659('0xe'),_0x2ea975,_0xc659('0xf'));logger[_0xc659('0x10')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2ea975,'request\x20sent',JSON[_0xc659('0x11')](_0x4267f3));if(_0x4267f3[_0xc659('0x12')]){if(_0x4267f3['error'][_0xc659('0x13')]===0x1f4){logger[_0xc659('0x12')](_0xc659('0xe'),_0x2ea975,_0x4267f3[_0xc659('0x12')][_0xc659('0x14')]);return _0x3f6f5a(_0x4267f3[_0xc659('0x12')][_0xc659('0x14')]);}logger[_0xc659('0x12')](_0xc659('0xe'),_0x2ea975,_0x4267f3[_0xc659('0x12')]['message']);return _0x35a046(_0x4267f3[_0xc659('0x12')][_0xc659('0x14')]);}else{logger[_0xc659('0x15')](_0xc659('0xe'),_0x2ea975,_0xc659('0xf'));_0x35a046(_0x4267f3[_0xc659('0x16')]['message']);}})[_0xc659('0x17')](function(_0x33e118){logger[_0xc659('0x12')]('ChatQueue,\x20%s,\x20%s',_0x2ea975,_0x33e118);_0x3f6f5a(_0x33e118);});});}exports['GetChatQueue']=function(_0x163064){var _0x6af6f9=this;return new Promise(function(_0x48be52,_0x463dc1){return db['ChatQueue']['findAll']({'raw':_0x163064['options']?_0x163064[_0xc659('0x18')][_0xc659('0x19')]===undefined?!![]:![]:!![],'where':_0x163064[_0xc659('0x18')]?_0x163064[_0xc659('0x18')][_0xc659('0x1a')]||null:null,'attributes':_0x163064[_0xc659('0x18')]?_0x163064['options']['attributes']||null:null,'limit':_0x163064['options']?_0x163064[_0xc659('0x18')][_0xc659('0x1b')]||null:null,'include':_0x163064['options']?_0x163064[_0xc659('0x18')]['include']?_[_0xc659('0x1c')](_0x163064[_0xc659('0x18')][_0xc659('0x1d')],function(_0x36e194){return{'model':db[_0x36e194[_0xc659('0x1e')]],'as':_0x36e194['as'],'attributes':_0x36e194[_0xc659('0x1f')],'include':_0x36e194[_0xc659('0x1d')]?_[_0xc659('0x1c')](_0x36e194[_0xc659('0x1d')],function(_0x27efe0){return{'model':db[_0x27efe0[_0xc659('0x1e')]],'as':_0x27efe0['as'],'attributes':_0x27efe0[_0xc659('0x1f')],'include':_0x27efe0['include']?_[_0xc659('0x1c')](_0x27efe0[_0xc659('0x1d')],function(_0x5deee1){return{'model':db[_0x5deee1['model']],'as':_0x5deee1['as'],'attributes':_0x5deee1[_0xc659('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc659('0xd')](function(_0x2770d6){logger[_0xc659('0x15')]('GetChatQueue',_0x163064);logger[_0xc659('0x10')](_0xc659('0x20'),_0x163064,JSON[_0xc659('0x11')](_0x2770d6));_0x48be52(_0x2770d6);})['catch'](function(_0x39eec1){logger[_0xc659('0x12')]('GetChatQueue',_0x39eec1['message'],_0x163064);_0x463dc1(_0x6af6f9[_0xc659('0x12')](0x1f4,_0x39eec1['message']));});});};exports[_0xc659('0x21')]=function(_0x290c99){var _0x55dca5=this;return new Promise(function(_0x5181bb,_0x1e1dd0){return db[_0xc659('0x22')][_0xc659('0x23')]({'raw':_0x290c99['options']?_0x290c99[_0xc659('0x18')][_0xc659('0x19')]===undefined?!![]:![]:!![],'where':_0x290c99['options']?_0x290c99[_0xc659('0x18')]['where']||null:null,'attributes':_0x290c99[_0xc659('0x18')]?_0x290c99['options'][_0xc659('0x1f')]||null:null,'include':_0x290c99['options']?_0x290c99[_0xc659('0x18')][_0xc659('0x1d')]?_[_0xc659('0x1c')](_0x290c99[_0xc659('0x18')][_0xc659('0x1d')],function(_0x2596f1){return{'model':db[_0x2596f1[_0xc659('0x1e')]],'as':_0x2596f1['as'],'attributes':_0x2596f1[_0xc659('0x1f')],'include':_0x2596f1[_0xc659('0x1d')]?_[_0xc659('0x1c')](_0x2596f1['include'],function(_0x54b04c){return{'model':db[_0x54b04c[_0xc659('0x1e')]],'as':_0x54b04c['as'],'attributes':_0x54b04c[_0xc659('0x1f')],'include':_0x54b04c[_0xc659('0x1d')]?_['map'](_0x54b04c[_0xc659('0x1d')],function(_0x20d36d){return{'model':db[_0x20d36d[_0xc659('0x1e')]],'as':_0x20d36d['as'],'attributes':_0x20d36d[_0xc659('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc659('0xd')](function(_0x82c490){logger['info']('ShowChatQueue',_0x290c99);logger[_0xc659('0x10')](_0xc659('0x21'),_0x290c99,JSON[_0xc659('0x11')](_0x82c490));_0x5181bb(_0x82c490);})['catch'](function(_0x286843){logger['error']('ShowChatQueue',_0x286843[_0xc659('0x14')],_0x290c99);_0x1e1dd0(_0x55dca5[_0xc659('0x12')](0x1f4,_0x286843[_0xc659('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d2c7ae9..7226813 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 _0xaba6=['emit','removeListener','./chatQueue.events','save'];(function(_0x23d043,_0x23a026){var _0x477c07=function(_0x49cabf){while(--_0x49cabf){_0x23d043['push'](_0x23d043['shift']());}};_0x477c07(++_0x23a026);}(_0xaba6,0xe2));var _0x6aba=function(_0x5ad9c8,_0x1d2d1b){_0x5ad9c8=_0x5ad9c8-0x0;var _0x1f1acc=_0xaba6[_0x5ad9c8];return _0x1f1acc;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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('chatQueue:'+_0x3766d4,_0x4e929a);ChatQueueEvents['on'](_0x3766d4,_0x1a4fbc);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0x204a52,_0x9f6d1c){var _0x389d2c=function(_0x33f633){while(--_0x33f633){_0x204a52['push'](_0x204a52['shift']());}};_0x389d2c(++_0x9f6d1c);}(_0x54ef,0x112));var _0xf54e=function(_0x11eee1,_0x1a15b9){_0x11eee1=_0x11eee1-0x0;var _0x5a211f=_0x54ef[_0x11eee1];return _0x5a211f;};'use strict';var ChatQueueEvents=require(_0xf54e('0x0'));var events=[_0xf54e('0x1'),_0xf54e('0x2'),'update'];function createListener(_0xd936f7,_0x18b7d6){return function(_0x18b1cf){_0x18b7d6[_0xf54e('0x3')](_0xd936f7,_0x18b1cf);};}function removeListener(_0x8b6bb6,_0x431e36){return function(){ChatQueueEvents[_0xf54e('0x4')](_0x8b6bb6,_0x431e36);};}exports['register']=function(_0x55e611){for(var _0x18e84e=0x0,_0x99cf9=events[_0xf54e('0x5')];_0x18e84e<_0x99cf9;_0x18e84e++){var _0x561870=events[_0x18e84e];var _0x27e69b=createListener('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4638b7e..9e0d208 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x5fc3,0xa8));var _0x35fc=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0x5fc3[_0xdefbc3];return _0x367798;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x5fc3[_0x4fa438];return _0x4e3958;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d3ed21d..eff502f 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 _0x149e=['sequelize','STRING','DATE','moment'];(function(_0x12e1df,_0x2c7cec){var _0x4dbd32=function(_0x407449){while(--_0x407449){_0x12e1df['push'](_0x12e1df['shift']());}};_0x4dbd32(++_0x2c7cec);}(_0x149e,0x9b));var _0xe149=function(_0x114792,_0x3fd93a){_0x114792=_0x114792-0x0;var _0x10de8c=_0x149e[_0x114792];return _0x10de8c;};'use strict';var moment=require(_0xe149('0x0'));var Sequelize=require(_0xe149('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe149('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe149('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe149('0x3')]},'reason':{'type':Sequelize[_0xe149('0x2')]}}; \ No newline at end of file +var _0x8e0c=['DATE','moment','exports','STRING'];(function(_0x1152ac,_0x476809){var _0x32343e=function(_0x44801e){while(--_0x44801e){_0x1152ac['push'](_0x1152ac['shift']());}};_0x32343e(++_0x476809);}(_0x8e0c,0xe5));var _0xc8e0=function(_0x2ec37a,_0x267728){_0x2ec37a=_0x2ec37a-0x0;var _0x27c1e1=_0x8e0c[_0x2ec37a];return _0x27c1e1;};'use strict';var moment=require(_0xc8e0('0x0'));var Sequelize=require('sequelize');module[_0xc8e0('0x1')]={'uniqueid':{'type':Sequelize[_0xc8e0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc8e0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc8e0('0x3')]},'exitAt':{'type':Sequelize[_0xc8e0('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a505179..9650402 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 _0x8b0e=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','ChatQueueReport','findAll','rows','catch','show','params','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8b0e,0x166));var _0xe8b0=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x8b0e[_0x47d6dc];return _0x1a1c93;};'use strict';var emlformat=require(_0xe8b0('0x0'));var rimraf=require(_0xe8b0('0x1'));var zipdir=require(_0xe8b0('0x2'));var jsonpatch=require(_0xe8b0('0x3'));var rp=require(_0xe8b0('0x4'));var moment=require(_0xe8b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe8b0('0x6'));var util=require('util');var path=require(_0xe8b0('0x7'));var sox=require(_0xe8b0('0x8'));var csv=require(_0xe8b0('0x9'));var ejs=require(_0xe8b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe8b0('0xb'));var _=require(_0xe8b0('0xc'));var squel=require(_0xe8b0('0xd'));var crypto=require(_0xe8b0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe8b0('0xf'));var toCsv=require(_0xe8b0('0x9'));var querystring=require(_0xe8b0('0x10'));var Papa=require(_0xe8b0('0x11'));var Redis=require(_0xe8b0('0x12'));var authService=require(_0xe8b0('0x13'));var qs=require(_0xe8b0('0x14'));var as=require(_0xe8b0('0x15'));var hardwareService=require(_0xe8b0('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe8b0('0x17'));var config=require(_0xe8b0('0x18'));var licenseUtil=require(_0xe8b0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8714fe,_0x41633d){_0x41633d=_0x41633d||0xcc;return function(_0x2469a2){if(_0x2469a2){return _0x8714fe[_0xe8b0('0x1a')](_0x41633d);}return _0x8714fe[_0xe8b0('0x1b')](_0x41633d)[_0xe8b0('0x1c')]();};}function respondWithResult(_0x27c633,_0x50da0c){_0x50da0c=_0x50da0c||0xc8;return function(_0x1b0368){if(_0x1b0368){return _0x27c633[_0xe8b0('0x1b')](_0x50da0c)[_0xe8b0('0x1d')](_0x1b0368);}};}function respondWithFilteredResult(_0x57ae6e,_0x1a78b4){return function(_0x55d9df){if(_0x55d9df){var _0x5bcc0b=typeof _0x1a78b4['offset']===_0xe8b0('0x1e')&&typeof _0x1a78b4[_0xe8b0('0x1f')]==='undefined';var _0x1a54e0=_0x55d9df[_0xe8b0('0x20')];var _0x1345b3=_0x5bcc0b?0x0:_0x1a78b4[_0xe8b0('0x21')];var _0x34f3b2=_0x5bcc0b?_0x55d9df[_0xe8b0('0x20')]:_0x1a78b4['offset']+_0x1a78b4['limit'];var _0x244412;if(_0x34f3b2>=_0x1a54e0){_0x34f3b2=_0x1a54e0;_0x244412=0xc8;}else{_0x244412=0xce;}_0x57ae6e[_0xe8b0('0x1b')](_0x244412);return _0x57ae6e[_0xe8b0('0x22')](_0xe8b0('0x23'),_0x1345b3+'-'+_0x34f3b2+'/'+_0x1a54e0)[_0xe8b0('0x1d')](_0x55d9df);}return null;};}function patchUpdates(_0x3d7711){return function(_0x2be40){try{jsonpatch[_0xe8b0('0x24')](_0x2be40,_0x3d7711,!![]);}catch(_0x45f5bf){return BPromise[_0xe8b0('0x25')](_0x45f5bf);}return _0x2be40[_0xe8b0('0x26')]();};}function saveUpdates(_0x4e6f22,_0x3a1c9d){return function(_0x30655d){if(_0x30655d){return _0x30655d[_0xe8b0('0x27')](_0x4e6f22)[_0xe8b0('0x28')](function(_0x52072e){return _0x52072e;});}return null;};}function removeEntity(_0x30ac12,_0x292f81){return function(_0x4d7a92){if(_0x4d7a92){return _0x4d7a92[_0xe8b0('0x29')]()[_0xe8b0('0x28')](function(){_0x30ac12[_0xe8b0('0x1b')](0xcc)[_0xe8b0('0x1c')]();});}};}function handleEntityNotFound(_0x58c536,_0x1bbd4e){return function(_0x317495){if(!_0x317495){_0x58c536[_0xe8b0('0x1a')](0x194);}return _0x317495;};}function handleError(_0x298d09,_0x1cd6b1){_0x1cd6b1=_0x1cd6b1||0x1f4;return function(_0x2ba170){logger[_0xe8b0('0x2a')](_0x2ba170[_0xe8b0('0x2b')]);if(_0x2ba170[_0xe8b0('0x2c')]){delete _0x2ba170[_0xe8b0('0x2c')];}_0x298d09[_0xe8b0('0x1b')](_0x1cd6b1)['send'](_0x2ba170);};}exports['index']=function(_0x21be91,_0x35b43d){var _0x1816e3={},_0x3d80d7={},_0xb5c5c6={'count':0x0,'rows':[]};var _0x54c3f9=_[_0xe8b0('0x2d')](db['ChatQueueReport'][_0xe8b0('0x2e')],function(_0x2e1e2c){return{'name':_0x2e1e2c[_0xe8b0('0x2f')],'type':_0x2e1e2c[_0xe8b0('0x30')]['key']};});_0x3d80d7[_0xe8b0('0x31')]=_[_0xe8b0('0x2d')](_0x54c3f9,_0xe8b0('0x2c'));_0x3d80d7[_0xe8b0('0x32')]=_[_0xe8b0('0x33')](_0x21be91['query']);_0x3d80d7[_0xe8b0('0x34')]=_['intersection'](_0x3d80d7[_0xe8b0('0x31')],_0x3d80d7[_0xe8b0('0x32')]);_0x1816e3[_0xe8b0('0x35')]=_[_0xe8b0('0x36')](_0x3d80d7['model'],qs[_0xe8b0('0x37')](_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x37')]));_0x1816e3[_0xe8b0('0x35')]=_0x1816e3[_0xe8b0('0x35')][_0xe8b0('0x38')]?_0x1816e3[_0xe8b0('0x35')]:_0x3d80d7[_0xe8b0('0x31')];if(!_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x39')](_0xe8b0('0x3a'))){_0x1816e3[_0xe8b0('0x1f')]=qs[_0xe8b0('0x1f')](_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x1f')]);_0x1816e3['offset']=qs[_0xe8b0('0x21')](_0x21be91[_0xe8b0('0x32')]['offset']);}_0x1816e3[_0xe8b0('0x3b')]=qs[_0xe8b0('0x3c')](_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x3c')]);_0x1816e3['where']=qs['filters'](_[_0xe8b0('0x3d')](_0x21be91['query'],_0x3d80d7[_0xe8b0('0x34')]),_0x54c3f9);if(_0x21be91[_0xe8b0('0x32')]['filter']){_0x1816e3[_0xe8b0('0x3e')]=_[_0xe8b0('0x3f')](_0x1816e3['where'],{'$or':_['map'](_0x54c3f9,function(_0x296d29){if(_0x296d29['type']!==_0xe8b0('0x40')){var _0x1a6af6={};_0x1a6af6[_0x296d29[_0xe8b0('0x2c')]]={'$like':'%'+_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x41')]+'%'};return _0x1a6af6;}})});}_0x1816e3=_[_0xe8b0('0x3f')]({},_0x1816e3,_0x21be91['options']);var _0x7a2ef2={'where':_0x1816e3[_0xe8b0('0x3e')]};return db['ChatQueueReport'][_0xe8b0('0x20')](_0x7a2ef2)[_0xe8b0('0x28')](function(_0x15f2d6){_0xb5c5c6[_0xe8b0('0x20')]=_0x15f2d6;if(_0x21be91[_0xe8b0('0x32')][_0xe8b0('0x42')]){_0x1816e3[_0xe8b0('0x43')]=[{'all':!![]}];}return db[_0xe8b0('0x44')][_0xe8b0('0x45')](_0x1816e3);})['then'](function(_0x21650e){_0xb5c5c6[_0xe8b0('0x46')]=_0x21650e;return _0xb5c5c6;})[_0xe8b0('0x28')](respondWithFilteredResult(_0x35b43d,_0x1816e3))[_0xe8b0('0x47')](handleError(_0x35b43d,null));};exports[_0xe8b0('0x48')]=function(_0x4d2c10,_0x4d82b2){var _0x3513c1={'raw':!![],'where':{'id':_0x4d2c10[_0xe8b0('0x49')]['id']}},_0x271c4f={};_0x271c4f[_0xe8b0('0x31')]=_[_0xe8b0('0x33')](db[_0xe8b0('0x44')][_0xe8b0('0x2e')]);_0x271c4f[_0xe8b0('0x32')]=_['keys'](_0x4d2c10['query']);_0x271c4f[_0xe8b0('0x34')]=_[_0xe8b0('0x36')](_0x271c4f['model'],_0x271c4f[_0xe8b0('0x32')]);_0x3513c1['attributes']=_[_0xe8b0('0x36')](_0x271c4f[_0xe8b0('0x31')],qs[_0xe8b0('0x37')](_0x4d2c10['query'][_0xe8b0('0x37')]));_0x3513c1['attributes']=_0x3513c1['attributes'][_0xe8b0('0x38')]?_0x3513c1['attributes']:_0x271c4f[_0xe8b0('0x31')];if(_0x4d2c10['query']['includeAll']){_0x3513c1['include']=[{'all':!![]}];}_0x3513c1=_[_0xe8b0('0x3f')]({},_0x3513c1,_0x4d2c10[_0xe8b0('0x4a')]);return db[_0xe8b0('0x44')][_0xe8b0('0x4b')](_0x3513c1)[_0xe8b0('0x28')](handleEntityNotFound(_0x4d82b2,null))[_0xe8b0('0x28')](respondWithResult(_0x4d82b2,null))[_0xe8b0('0x47')](handleError(_0x4d82b2,null));};exports['create']=function(_0x794b34,_0x1f05f8){return db[_0xe8b0('0x44')]['create'](_0x794b34[_0xe8b0('0x4c')],{})['then'](respondWithResult(_0x1f05f8,0xc9))[_0xe8b0('0x47')](handleError(_0x1f05f8,null));};exports[_0xe8b0('0x27')]=function(_0x526d21,_0x2cb065){if(_0x526d21[_0xe8b0('0x4c')]['id']){delete _0x526d21[_0xe8b0('0x4c')]['id'];}return db[_0xe8b0('0x44')]['find']({'where':{'id':_0x526d21[_0xe8b0('0x49')]['id']}})[_0xe8b0('0x28')](handleEntityNotFound(_0x2cb065,null))[_0xe8b0('0x28')](saveUpdates(_0x526d21[_0xe8b0('0x4c')],null))['then'](respondWithResult(_0x2cb065,null))[_0xe8b0('0x47')](handleError(_0x2cb065,null));};exports['destroy']=function(_0x33b9e9,_0x4a7da9){return db[_0xe8b0('0x44')]['find']({'where':{'id':_0x33b9e9[_0xe8b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a7da9,null))['then'](removeEntity(_0x4a7da9,null))[_0xe8b0('0x47')](handleError(_0x4a7da9,null));};exports[_0xe8b0('0x4d')]=function(_0x4d9c48,_0x3474b1){return db[_0xe8b0('0x44')][_0xe8b0('0x4d')]()[_0xe8b0('0x28')](respondWithResult(_0x3474b1,null))[_0xe8b0('0x47')](handleError(_0x3474b1,null));}; \ No newline at end of file +var _0x2d72=['model','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','rows','params','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection'];(function(_0x208f05,_0x3029ba){var _0x155ac4=function(_0x398ad4){while(--_0x398ad4){_0x208f05['push'](_0x208f05['shift']());}};_0x155ac4(++_0x3029ba);}(_0x2d72,0xa8));var _0x22d7=function(_0x45e4ec,_0x596b93){_0x45e4ec=_0x45e4ec-0x0;var _0x42e263=_0x2d72[_0x45e4ec];return _0x42e263;};'use strict';var emlformat=require(_0x22d7('0x0'));var rimraf=require(_0x22d7('0x1'));var zipdir=require(_0x22d7('0x2'));var jsonpatch=require(_0x22d7('0x3'));var rp=require(_0x22d7('0x4'));var moment=require(_0x22d7('0x5'));var BPromise=require(_0x22d7('0x6'));var Mustache=require(_0x22d7('0x7'));var util=require(_0x22d7('0x8'));var path=require(_0x22d7('0x9'));var sox=require(_0x22d7('0xa'));var csv=require(_0x22d7('0xb'));var ejs=require(_0x22d7('0xc'));var fs=require('fs');var fs_extra=require(_0x22d7('0xd'));var _=require('lodash');var squel=require(_0x22d7('0xe'));var crypto=require(_0x22d7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x22d7('0x10'));var toCsv=require(_0x22d7('0xb'));var querystring=require(_0x22d7('0x11'));var Papa=require(_0x22d7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x22d7('0x13'));var as=require(_0x22d7('0x14'));var hardwareService=require(_0x22d7('0x15'));var logger=require(_0x22d7('0x16'))(_0x22d7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x22d7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b725c,_0xec6659){_0xec6659=_0xec6659||0xcc;return function(_0x58bdca){if(_0x58bdca){return _0x3b725c[_0x22d7('0x19')](_0xec6659);}return _0x3b725c[_0x22d7('0x1a')](_0xec6659)[_0x22d7('0x1b')]();};}function respondWithResult(_0x3c443c,_0x1c5c19){_0x1c5c19=_0x1c5c19||0xc8;return function(_0x1b654c){if(_0x1b654c){return _0x3c443c[_0x22d7('0x1a')](_0x1c5c19)[_0x22d7('0x1c')](_0x1b654c);}};}function respondWithFilteredResult(_0x534223,_0x352a78){return function(_0x442ce4){if(_0x442ce4){var _0x3c5f4e=typeof _0x352a78['offset']==='undefined'&&typeof _0x352a78['limit']===_0x22d7('0x1d');var _0x20e157=_0x442ce4[_0x22d7('0x1e')];var _0x3dcca4=_0x3c5f4e?0x0:_0x352a78[_0x22d7('0x1f')];var _0x5b32c0=_0x3c5f4e?_0x442ce4[_0x22d7('0x1e')]:_0x352a78[_0x22d7('0x1f')]+_0x352a78[_0x22d7('0x20')];var _0x5ac2f7;if(_0x5b32c0>=_0x20e157){_0x5b32c0=_0x20e157;_0x5ac2f7=0xc8;}else{_0x5ac2f7=0xce;}_0x534223[_0x22d7('0x1a')](_0x5ac2f7);return _0x534223[_0x22d7('0x21')](_0x22d7('0x22'),_0x3dcca4+'-'+_0x5b32c0+'/'+_0x20e157)[_0x22d7('0x1c')](_0x442ce4);}return null;};}function patchUpdates(_0x6be49e){return function(_0x577400){try{jsonpatch['apply'](_0x577400,_0x6be49e,!![]);}catch(_0x219f7c){return BPromise[_0x22d7('0x23')](_0x219f7c);}return _0x577400[_0x22d7('0x24')]();};}function saveUpdates(_0x4172d3,_0x4f9bc7){return function(_0x3f0148){if(_0x3f0148){return _0x3f0148[_0x22d7('0x25')](_0x4172d3)[_0x22d7('0x26')](function(_0x5b6502){return _0x5b6502;});}return null;};}function removeEntity(_0x459827,_0x523409){return function(_0x219507){if(_0x219507){return _0x219507[_0x22d7('0x27')]()[_0x22d7('0x26')](function(){_0x459827['status'](0xcc)[_0x22d7('0x1b')]();});}};}function handleEntityNotFound(_0x5e4c87,_0x582fe6){return function(_0x238604){if(!_0x238604){_0x5e4c87[_0x22d7('0x19')](0x194);}return _0x238604;};}function handleError(_0x1720f0,_0x27998a){_0x27998a=_0x27998a||0x1f4;return function(_0x2f7e98){logger['error'](_0x2f7e98[_0x22d7('0x28')]);if(_0x2f7e98[_0x22d7('0x29')]){delete _0x2f7e98[_0x22d7('0x29')];}_0x1720f0[_0x22d7('0x1a')](_0x27998a)[_0x22d7('0x2a')](_0x2f7e98);};}exports['index']=function(_0x2606bd,_0x2ec96b){var _0x33c621={},_0x2c0b24={},_0x539ba0={'count':0x0,'rows':[]};var _0x1195bc=_[_0x22d7('0x2b')](db['ChatQueueReport']['rawAttributes'],function(_0x595796){return{'name':_0x595796[_0x22d7('0x2c')],'type':_0x595796[_0x22d7('0x2d')][_0x22d7('0x2e')]};});_0x2c0b24['model']=_[_0x22d7('0x2b')](_0x1195bc,'name');_0x2c0b24[_0x22d7('0x2f')]=_[_0x22d7('0x30')](_0x2606bd[_0x22d7('0x2f')]);_0x2c0b24[_0x22d7('0x31')]=_[_0x22d7('0x32')](_0x2c0b24[_0x22d7('0x33')],_0x2c0b24['query']);_0x33c621['attributes']=_[_0x22d7('0x32')](_0x2c0b24['model'],qs[_0x22d7('0x34')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x34')]));_0x33c621[_0x22d7('0x35')]=_0x33c621[_0x22d7('0x35')]['length']?_0x33c621['attributes']:_0x2c0b24[_0x22d7('0x33')];if(!_0x2606bd['query']['hasOwnProperty'](_0x22d7('0x36'))){_0x33c621['limit']=qs[_0x22d7('0x20')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x20')]);_0x33c621['offset']=qs[_0x22d7('0x1f')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x1f')]);}_0x33c621[_0x22d7('0x37')]=qs[_0x22d7('0x38')](_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x38')]);_0x33c621[_0x22d7('0x39')]=qs['filters'](_['pick'](_0x2606bd[_0x22d7('0x2f')],_0x2c0b24[_0x22d7('0x31')]),_0x1195bc);if(_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x3a')]){_0x33c621['where']=_[_0x22d7('0x3b')](_0x33c621['where'],{'$or':_['map'](_0x1195bc,function(_0x220824){if(_0x220824[_0x22d7('0x2d')]!==_0x22d7('0x3c')){var _0x431592={};_0x431592[_0x220824[_0x22d7('0x29')]]={'$like':'%'+_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x3a')]+'%'};return _0x431592;}})});}_0x33c621=_[_0x22d7('0x3b')]({},_0x33c621,_0x2606bd[_0x22d7('0x3d')]);var _0x61fab={'where':_0x33c621[_0x22d7('0x39')]};return db[_0x22d7('0x3e')][_0x22d7('0x1e')](_0x61fab)['then'](function(_0x3f2cdb){_0x539ba0[_0x22d7('0x1e')]=_0x3f2cdb;if(_0x2606bd[_0x22d7('0x2f')][_0x22d7('0x3f')]){_0x33c621[_0x22d7('0x40')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x33c621);})[_0x22d7('0x26')](function(_0x123af1){_0x539ba0[_0x22d7('0x41')]=_0x123af1;return _0x539ba0;})[_0x22d7('0x26')](respondWithFilteredResult(_0x2ec96b,_0x33c621))['catch'](handleError(_0x2ec96b,null));};exports['show']=function(_0x336269,_0x4613b2){var _0x4d1da2={'raw':!![],'where':{'id':_0x336269[_0x22d7('0x42')]['id']}},_0x233852={};_0x233852[_0x22d7('0x33')]=_[_0x22d7('0x30')](db[_0x22d7('0x3e')]['rawAttributes']);_0x233852['query']=_['keys'](_0x336269[_0x22d7('0x2f')]);_0x233852[_0x22d7('0x31')]=_[_0x22d7('0x32')](_0x233852[_0x22d7('0x33')],_0x233852[_0x22d7('0x2f')]);_0x4d1da2[_0x22d7('0x35')]=_[_0x22d7('0x32')](_0x233852[_0x22d7('0x33')],qs['fields'](_0x336269[_0x22d7('0x2f')]['fields']));_0x4d1da2[_0x22d7('0x35')]=_0x4d1da2[_0x22d7('0x35')][_0x22d7('0x43')]?_0x4d1da2[_0x22d7('0x35')]:_0x233852['model'];if(_0x336269['query'][_0x22d7('0x3f')]){_0x4d1da2[_0x22d7('0x40')]=[{'all':!![]}];}_0x4d1da2=_[_0x22d7('0x3b')]({},_0x4d1da2,_0x336269[_0x22d7('0x3d')]);return db['ChatQueueReport']['find'](_0x4d1da2)[_0x22d7('0x26')](handleEntityNotFound(_0x4613b2,null))['then'](respondWithResult(_0x4613b2,null))[_0x22d7('0x44')](handleError(_0x4613b2,null));};exports[_0x22d7('0x45')]=function(_0x5c0709,_0x36847f){return db[_0x22d7('0x3e')][_0x22d7('0x45')](_0x5c0709[_0x22d7('0x46')],{})[_0x22d7('0x26')](respondWithResult(_0x36847f,0xc9))['catch'](handleError(_0x36847f,null));};exports[_0x22d7('0x25')]=function(_0x3cae9c,_0x43edb0){if(_0x3cae9c[_0x22d7('0x46')]['id']){delete _0x3cae9c[_0x22d7('0x46')]['id'];}return db[_0x22d7('0x3e')][_0x22d7('0x47')]({'where':{'id':_0x3cae9c[_0x22d7('0x42')]['id']}})[_0x22d7('0x26')](handleEntityNotFound(_0x43edb0,null))[_0x22d7('0x26')](saveUpdates(_0x3cae9c[_0x22d7('0x46')],null))['then'](respondWithResult(_0x43edb0,null))[_0x22d7('0x44')](handleError(_0x43edb0,null));};exports[_0x22d7('0x27')]=function(_0xdc630a,_0x266978){return db[_0x22d7('0x3e')][_0x22d7('0x47')]({'where':{'id':_0xdc630a[_0x22d7('0x42')]['id']}})[_0x22d7('0x26')](handleEntityNotFound(_0x266978,null))[_0x22d7('0x26')](removeEntity(_0x266978,null))['catch'](handleError(_0x266978,null));};exports[_0x22d7('0x48')]=function(_0x1858cb,_0x243f2c){return db['ChatQueueReport'][_0x22d7('0x48')]()['then'](respondWithResult(_0x243f2c,null))[_0x22d7('0x44')](handleError(_0x243f2c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index adb59c5..60e8e3c 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x22f275,_0x4e39b3){var _0x3a27e3=function(_0x45a67f){while(--_0x45a67f){_0x22f275['push'](_0x22f275['shift']());}};_0x3a27e3(++_0x4e39b3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0xc8a59b,_0x4132b1){var _0x1ad9af=function(_0x180fbf){while(--_0x180fbf){_0xc8a59b['push'](_0xc8a59b['shift']());}};_0x1ad9af(++_0x4132b1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'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 e54b743..0f024fa 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 _0xa177=['message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','limit','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ChatQueueReport,\x20%s,\x20%s'];(function(_0x353643,_0x568495){var _0x394b32=function(_0x3924ae){while(--_0x3924ae){_0x353643['push'](_0x353643['shift']());}};_0x394b32(++_0x568495);}(_0xa177,0x143));var _0x7a17=function(_0x23ac14,_0x226ac5){_0x23ac14=_0x23ac14-0x0;var _0x5c54a8=_0xa177[_0x23ac14];return _0x5c54a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a17('0x0'));var BPromise=require('bluebird');var rs=require(_0x7a17('0x1'));var fs=require('fs');var Redis=require(_0x7a17('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a17('0x3'));var logger=require(_0x7a17('0x4'))(_0x7a17('0x5'));var config=require(_0x7a17('0x6'));var jayson=require(_0x7a17('0x7'));var client=jayson[_0x7a17('0x8')][_0x7a17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5542c6,_0x5859f7,_0x435a66){return new BPromise(function(_0x15b820,_0x3c81a1){return client[_0x7a17('0xa')](_0x5542c6,_0x435a66)[_0x7a17('0xb')](function(_0x45f36f){logger[_0x7a17('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x5859f7,_0x7a17('0xd'));logger[_0x7a17('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5859f7,'request\x20sent',JSON['stringify'](_0x45f36f));if(_0x45f36f[_0x7a17('0xf')]){if(_0x45f36f[_0x7a17('0xf')][_0x7a17('0x10')]===0x1f4){logger[_0x7a17('0xf')](_0x7a17('0x11'),_0x5859f7,_0x45f36f['error'][_0x7a17('0x12')]);return _0x3c81a1(_0x45f36f[_0x7a17('0xf')][_0x7a17('0x12')]);}logger[_0x7a17('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5859f7,_0x45f36f[_0x7a17('0xf')][_0x7a17('0x12')]);return _0x15b820(_0x45f36f[_0x7a17('0xf')][_0x7a17('0x12')]);}else{logger[_0x7a17('0xc')](_0x7a17('0x11'),_0x5859f7,_0x7a17('0xd'));_0x15b820(_0x45f36f[_0x7a17('0x13')][_0x7a17('0x12')]);}})[_0x7a17('0x14')](function(_0x5bdecc){logger[_0x7a17('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5859f7,_0x5bdecc);_0x3c81a1(_0x5bdecc);});});}exports[_0x7a17('0x15')]=function(_0x2b20bb){var _0x373567=this;return new Promise(function(_0x1be3e0,_0x3403e6){return db[_0x7a17('0x16')][_0x7a17('0x17')](_0x2b20bb[_0x7a17('0x18')],{'raw':_0x2b20bb[_0x7a17('0x19')]?_0x2b20bb[_0x7a17('0x19')][_0x7a17('0x1a')]===undefined?!![]:![]:!![]})[_0x7a17('0xb')](function(_0x1bb65c){logger[_0x7a17('0xc')](_0x7a17('0x15'),_0x2b20bb);logger['debug'](_0x7a17('0x15'),_0x2b20bb,JSON[_0x7a17('0x1b')](_0x1bb65c));_0x1be3e0(_0x1bb65c);})[_0x7a17('0x14')](function(_0x8d46ae){logger[_0x7a17('0xf')](_0x7a17('0x15'),_0x8d46ae[_0x7a17('0x12')],_0x2b20bb);_0x3403e6(_0x373567[_0x7a17('0xf')](0x1f4,_0x8d46ae[_0x7a17('0x12')]));});});};exports[_0x7a17('0x1c')]=function(_0x3181b9){var _0xd26fcd=this;return new Promise(function(_0x581d6d,_0x27c396){return db[_0x7a17('0x16')][_0x7a17('0x1d')](_0x3181b9[_0x7a17('0x18')],{'raw':_0x3181b9[_0x7a17('0x19')]?_0x3181b9[_0x7a17('0x19')][_0x7a17('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3181b9[_0x7a17('0x19')]?_0x3181b9['options']['where']||null:null,'attributes':_0x3181b9[_0x7a17('0x19')]?_0x3181b9['options']['attributes']||null:null,'limit':_0x3181b9[_0x7a17('0x19')]?_0x3181b9['options'][_0x7a17('0x1e')]||null:null})[_0x7a17('0xb')](function(_0x358b5b){logger[_0x7a17('0xc')]('UpdateChatQueueReport',_0x3181b9);logger[_0x7a17('0xe')](_0x7a17('0x1c'),_0x3181b9,JSON['stringify'](_0x358b5b));_0x581d6d(_0x358b5b);})['catch'](function(_0x32d3e9){logger[_0x7a17('0xf')](_0x7a17('0x1c'),_0x32d3e9[_0x7a17('0x12')],_0x3181b9);_0x27c396(_0xd26fcd[_0x7a17('0xf')](0x1f4,_0x32d3e9[_0x7a17('0x12')]));});});}; \ No newline at end of file +var _0x4998=['create','options','UpdateChatQueueReport','update','body','raw','where','attributes','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0x1053b9,_0x56ca74){var _0xa49baf=function(_0x50213c){while(--_0x50213c){_0x1053b9['push'](_0x1053b9['shift']());}};_0xa49baf(++_0x56ca74);}(_0x4998,0x89));var _0x8499=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x4998[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0x8499('0x0'));var util=require('util');var moment=require(_0x8499('0x1'));var BPromise=require(_0x8499('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8499('0x3'))['db'];var utils=require(_0x8499('0x4'));var logger=require(_0x8499('0x5'))(_0x8499('0x6'));var config=require(_0x8499('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8499('0x8')][_0x8499('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a92a3,_0x57b0b5,_0x11ccd8){return new BPromise(function(_0x226b7f,_0x42dfd2){return client[_0x8499('0xa')](_0x2a92a3,_0x11ccd8)[_0x8499('0xb')](function(_0x5e8c65){logger['info'](_0x8499('0xc'),_0x57b0b5,_0x8499('0xd'));logger[_0x8499('0xe')](_0x8499('0xf'),_0x57b0b5,_0x8499('0xd'),JSON[_0x8499('0x10')](_0x5e8c65));if(_0x5e8c65[_0x8499('0x11')]){if(_0x5e8c65[_0x8499('0x11')]['code']===0x1f4){logger[_0x8499('0x11')](_0x8499('0xc'),_0x57b0b5,_0x5e8c65[_0x8499('0x11')][_0x8499('0x12')]);return _0x42dfd2(_0x5e8c65[_0x8499('0x11')]['message']);}logger[_0x8499('0x11')](_0x8499('0xc'),_0x57b0b5,_0x5e8c65[_0x8499('0x11')]['message']);return _0x226b7f(_0x5e8c65[_0x8499('0x11')][_0x8499('0x12')]);}else{logger[_0x8499('0x13')](_0x8499('0xc'),_0x57b0b5,'request\x20sent');_0x226b7f(_0x5e8c65['result']['message']);}})[_0x8499('0x14')](function(_0x1d62a9){logger[_0x8499('0x11')](_0x8499('0xc'),_0x57b0b5,_0x1d62a9);_0x42dfd2(_0x1d62a9);});});}exports[_0x8499('0x15')]=function(_0x26767e){var _0x63f715=this;return new Promise(function(_0x5903b6,_0x6b536c){return db[_0x8499('0x16')][_0x8499('0x17')](_0x26767e['body'],{'raw':_0x26767e['options']?_0x26767e[_0x8499('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x46a489){logger[_0x8499('0x13')]('CreateChatQueueReport',_0x26767e);logger[_0x8499('0xe')]('CreateChatQueueReport',_0x26767e,JSON[_0x8499('0x10')](_0x46a489));_0x5903b6(_0x46a489);})[_0x8499('0x14')](function(_0x24584f){logger[_0x8499('0x11')](_0x8499('0x15'),_0x24584f[_0x8499('0x12')],_0x26767e);_0x6b536c(_0x63f715['error'](0x1f4,_0x24584f[_0x8499('0x12')]));});});};exports[_0x8499('0x19')]=function(_0x3dc60e){var _0x2cb482=this;return new Promise(function(_0x1e1477,_0xbf5192){return db[_0x8499('0x16')][_0x8499('0x1a')](_0x3dc60e[_0x8499('0x1b')],{'raw':_0x3dc60e['options']?_0x3dc60e[_0x8499('0x18')][_0x8499('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc60e[_0x8499('0x18')]?_0x3dc60e[_0x8499('0x18')][_0x8499('0x1d')]||null:null,'attributes':_0x3dc60e[_0x8499('0x18')]?_0x3dc60e[_0x8499('0x18')][_0x8499('0x1e')]||null:null,'limit':_0x3dc60e[_0x8499('0x18')]?_0x3dc60e['options'][_0x8499('0x1f')]||null:null})[_0x8499('0xb')](function(_0x3f2bca){logger[_0x8499('0x13')](_0x8499('0x19'),_0x3dc60e);logger[_0x8499('0xe')](_0x8499('0x19'),_0x3dc60e,JSON[_0x8499('0x10')](_0x3f2bca));_0x1e1477(_0x3f2bca);})[_0x8499('0x14')](function(_0x40afbc){logger['error'](_0x8499('0x19'),_0x40afbc[_0x8499('0x12')],_0x3dc60e);_0xbf5192(_0x2cb482[_0x8499('0x11')](0x1f4,_0x40afbc[_0x8499('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 60d531f..c10a31e 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 _0xa79c=['update','delete','util','path','connect-timeout','../../components/auth/service','./chatQueueReport.controller','get','index','isAuthenticated','/:id','show','post','create','put'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xa79c,0x13d));var _0xca79=function(_0x1afb3f,_0x4a72fb){_0x1afb3f=_0x1afb3f-0x0;var _0x28a4fc=_0xa79c[_0x1afb3f];return _0x28a4fc;};'use strict';var multer=require('multer');var util=require(_0xca79('0x0'));var path=require(_0xca79('0x1'));var timeout=require(_0xca79('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xca79('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xca79('0x4'));router[_0xca79('0x5')]('/',auth['isAuthenticated'](),controller[_0xca79('0x6')]);router[_0xca79('0x5')]('/describe',auth[_0xca79('0x7')](),controller['describe']);router['get'](_0xca79('0x8'),auth[_0xca79('0x7')](),controller[_0xca79('0x9')]);router[_0xca79('0xa')]('/',auth[_0xca79('0x7')](),controller[_0xca79('0xb')]);router[_0xca79('0xc')](_0xca79('0x8'),auth[_0xca79('0x7')](),controller[_0xca79('0xd')]);router[_0xca79('0xe')](_0xca79('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x09c4=['/describe','/:id','show','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0x09c4,0x194));var _0x409c=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x09c4[_0x558e45];return _0x3e9075;};'use strict';var multer=require(_0x409c('0x0'));var util=require('util');var path=require(_0x409c('0x1'));var timeout=require(_0x409c('0x2'));var express=require(_0x409c('0x3'));var router=express[_0x409c('0x4')]();var fs_extra=require(_0x409c('0x5'));var auth=require(_0x409c('0x6'));var interaction=require(_0x409c('0x7'));var config=require('../../config/environment');var controller=require(_0x409c('0x8'));router[_0x409c('0x9')]('/',auth[_0x409c('0xa')](),controller[_0x409c('0xb')]);router[_0x409c('0x9')](_0x409c('0xc'),auth[_0x409c('0xa')](),controller['describe']);router[_0x409c('0x9')](_0x409c('0xd'),auth[_0x409c('0xa')](),controller[_0x409c('0xe')]);router['post']('/',auth[_0x409c('0xa')](),controller['create']);router['put'](_0x409c('0xd'),auth[_0x409c('0xa')](),controller['update']);router[_0x409c('0xf')](_0x409c('0xd'),auth[_0x409c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f8e25bd..bdf6f39 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x25a969,_0x5a6c17){var _0x518215=function(_0x3969fb){while(--_0x3969fb){_0x25a969['push'](_0x25a969['shift']());}};_0x518215(++_0x5a6c17);}(_0x4b84,0x1cc));var _0x44b8=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x4b84[_0x148879];return _0x4f7027;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x6019da,_0x3631ca){var _0x50c537=function(_0x513e99){while(--_0x513e99){_0x6019da['push'](_0x6019da['shift']());}};_0x50c537(++_0x3631ca);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4ae967a..cc504f2 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 _0x5c33=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','destroy','then','error','stack','index','ChatTransferReport','fieldName','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash'];(function(_0x12e631,_0x5126cd){var _0x2aa9dd=function(_0x5187c8){while(--_0x5187c8){_0x12e631['push'](_0x12e631['shift']());}};_0x2aa9dd(++_0x5126cd);}(_0x5c33,0xdb));var _0x35c3=function(_0x2bb398,_0xd7c0dc){_0x2bb398=_0x2bb398-0x0;var _0x4dfefc=_0x5c33[_0x2bb398];return _0x4dfefc;};'use strict';var emlformat=require(_0x35c3('0x0'));var rimraf=require(_0x35c3('0x1'));var zipdir=require(_0x35c3('0x2'));var jsonpatch=require(_0x35c3('0x3'));var rp=require(_0x35c3('0x4'));var moment=require(_0x35c3('0x5'));var BPromise=require(_0x35c3('0x6'));var Mustache=require(_0x35c3('0x7'));var util=require(_0x35c3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x35c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35c3('0xa'));var _=require(_0x35c3('0xb'));var squel=require('squel');var crypto=require(_0x35c3('0xc'));var jsforce=require(_0x35c3('0xd'));var deskjs=require(_0x35c3('0xe'));var toCsv=require(_0x35c3('0x9'));var querystring=require(_0x35c3('0xf'));var Papa=require(_0x35c3('0x10'));var Redis=require(_0x35c3('0x11'));var authService=require(_0x35c3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x35c3('0x13'));var hardwareService=require(_0x35c3('0x14'));var logger=require(_0x35c3('0x15'))(_0x35c3('0x16'));var utils=require(_0x35c3('0x17'));var config=require(_0x35c3('0x18'));var licenseUtil=require(_0x35c3('0x19'));var db=require(_0x35c3('0x1a'))['db'];function respondWithStatusCode(_0x3bf9c3,_0x19868d){_0x19868d=_0x19868d||0xcc;return function(_0x57da0f){if(_0x57da0f){return _0x3bf9c3[_0x35c3('0x1b')](_0x19868d);}return _0x3bf9c3[_0x35c3('0x1c')](_0x19868d)[_0x35c3('0x1d')]();};}function respondWithResult(_0x4c398b,_0xb0095){_0xb0095=_0xb0095||0xc8;return function(_0x300269){if(_0x300269){return _0x4c398b[_0x35c3('0x1c')](_0xb0095)[_0x35c3('0x1e')](_0x300269);}};}function respondWithFilteredResult(_0x37a718,_0x59a6f1){return function(_0x42f8d7){if(_0x42f8d7){var _0x52d21b=typeof _0x59a6f1['offset']===_0x35c3('0x1f')&&typeof _0x59a6f1[_0x35c3('0x20')]===_0x35c3('0x1f');var _0x477842=_0x42f8d7['count'];var _0x1f56a1=_0x52d21b?0x0:_0x59a6f1['offset'];var _0x198aa4=_0x52d21b?_0x42f8d7[_0x35c3('0x21')]:_0x59a6f1[_0x35c3('0x22')]+_0x59a6f1[_0x35c3('0x20')];var _0x47787a;if(_0x198aa4>=_0x477842){_0x198aa4=_0x477842;_0x47787a=0xc8;}else{_0x47787a=0xce;}_0x37a718[_0x35c3('0x1c')](_0x47787a);return _0x37a718['set']('Content-Range',_0x1f56a1+'-'+_0x198aa4+'/'+_0x477842)[_0x35c3('0x1e')](_0x42f8d7);}return null;};}function patchUpdates(_0x5800c4){return function(_0x3b7ea6){try{jsonpatch[_0x35c3('0x23')](_0x3b7ea6,_0x5800c4,!![]);}catch(_0x111190){return BPromise[_0x35c3('0x24')](_0x111190);}return _0x3b7ea6[_0x35c3('0x25')]();};}function saveUpdates(_0x40a010,_0x15d94c){return function(_0x2996d3){if(_0x2996d3){return _0x2996d3['update'](_0x40a010)['then'](function(_0x101426){return _0x101426;});}return null;};}function removeEntity(_0x5669f0,_0x11ef64){return function(_0x1fee16){if(_0x1fee16){return _0x1fee16[_0x35c3('0x26')]()[_0x35c3('0x27')](function(){_0x5669f0['status'](0xcc)[_0x35c3('0x1d')]();});}};}function handleEntityNotFound(_0x47ade0,_0x1243db){return function(_0x4f7479){if(!_0x4f7479){_0x47ade0[_0x35c3('0x1b')](0x194);}return _0x4f7479;};}function handleError(_0x5c221c,_0x4c600e){_0x4c600e=_0x4c600e||0x1f4;return function(_0x11fa62){logger[_0x35c3('0x28')](_0x11fa62[_0x35c3('0x29')]);if(_0x11fa62['name']){delete _0x11fa62['name'];}_0x5c221c[_0x35c3('0x1c')](_0x4c600e)['send'](_0x11fa62);};}exports[_0x35c3('0x2a')]=function(_0x50be39,_0x5c31c0){var _0x4e21cf={},_0x2a9de7={},_0x4e50dd={'count':0x0,'rows':[]};var _0x5e713e=_['map'](db[_0x35c3('0x2b')]['rawAttributes'],function(_0x280f20){return{'name':_0x280f20[_0x35c3('0x2c')],'type':_0x280f20[_0x35c3('0x2d')][_0x35c3('0x2e')]};});_0x2a9de7[_0x35c3('0x2f')]=_[_0x35c3('0x30')](_0x5e713e,_0x35c3('0x31'));_0x2a9de7['query']=_['keys'](_0x50be39[_0x35c3('0x32')]);_0x2a9de7[_0x35c3('0x33')]=_['intersection'](_0x2a9de7[_0x35c3('0x2f')],_0x2a9de7[_0x35c3('0x32')]);_0x4e21cf[_0x35c3('0x34')]=_[_0x35c3('0x35')](_0x2a9de7[_0x35c3('0x2f')],qs[_0x35c3('0x36')](_0x50be39['query']['fields']));_0x4e21cf[_0x35c3('0x34')]=_0x4e21cf[_0x35c3('0x34')][_0x35c3('0x37')]?_0x4e21cf['attributes']:_0x2a9de7[_0x35c3('0x2f')];if(!_0x50be39[_0x35c3('0x32')][_0x35c3('0x38')](_0x35c3('0x39'))){_0x4e21cf[_0x35c3('0x20')]=qs[_0x35c3('0x20')](_0x50be39['query']['limit']);_0x4e21cf[_0x35c3('0x22')]=qs['offset'](_0x50be39[_0x35c3('0x32')][_0x35c3('0x22')]);}_0x4e21cf[_0x35c3('0x3a')]=qs[_0x35c3('0x3b')](_0x50be39[_0x35c3('0x32')]['sort']);_0x4e21cf[_0x35c3('0x3c')]=qs[_0x35c3('0x33')](_['pick'](_0x50be39[_0x35c3('0x32')],_0x2a9de7[_0x35c3('0x33')]),_0x5e713e);if(_0x50be39[_0x35c3('0x32')]['filter']){_0x4e21cf[_0x35c3('0x3c')]=_[_0x35c3('0x3d')](_0x4e21cf['where'],{'$or':_[_0x35c3('0x30')](_0x5e713e,function(_0x5080ea){if(_0x5080ea[_0x35c3('0x2d')]!==_0x35c3('0x3e')){var _0x1b0bf0={};_0x1b0bf0[_0x5080ea['name']]={'$like':'%'+_0x50be39['query'][_0x35c3('0x3f')]+'%'};return _0x1b0bf0;}})});}_0x4e21cf=_['merge']({},_0x4e21cf,_0x50be39[_0x35c3('0x40')]);var _0x48f075={'where':_0x4e21cf[_0x35c3('0x3c')]};return db[_0x35c3('0x2b')][_0x35c3('0x21')](_0x48f075)['then'](function(_0x395a94){_0x4e50dd['count']=_0x395a94;if(_0x50be39[_0x35c3('0x32')][_0x35c3('0x41')]){_0x4e21cf[_0x35c3('0x42')]=[{'all':!![]}];}return db[_0x35c3('0x2b')][_0x35c3('0x43')](_0x4e21cf);})['then'](function(_0x34e69d){_0x4e50dd['rows']=_0x34e69d;return _0x4e50dd;})[_0x35c3('0x27')](respondWithFilteredResult(_0x5c31c0,_0x4e21cf))[_0x35c3('0x44')](handleError(_0x5c31c0,null));};exports[_0x35c3('0x45')]=function(_0x12e6e3,_0xad83e7){var _0x188dde={'raw':!![],'where':{'id':_0x12e6e3['params']['id']}},_0xa6896b={};_0xa6896b[_0x35c3('0x2f')]=_[_0x35c3('0x46')](db[_0x35c3('0x2b')][_0x35c3('0x47')]);_0xa6896b['query']=_['keys'](_0x12e6e3['query']);_0xa6896b[_0x35c3('0x33')]=_[_0x35c3('0x35')](_0xa6896b[_0x35c3('0x2f')],_0xa6896b[_0x35c3('0x32')]);_0x188dde[_0x35c3('0x34')]=_[_0x35c3('0x35')](_0xa6896b[_0x35c3('0x2f')],qs[_0x35c3('0x36')](_0x12e6e3['query'][_0x35c3('0x36')]));_0x188dde[_0x35c3('0x34')]=_0x188dde[_0x35c3('0x34')][_0x35c3('0x37')]?_0x188dde[_0x35c3('0x34')]:_0xa6896b[_0x35c3('0x2f')];if(_0x12e6e3['query'][_0x35c3('0x41')]){_0x188dde[_0x35c3('0x42')]=[{'all':!![]}];}_0x188dde=_['merge']({},_0x188dde,_0x12e6e3[_0x35c3('0x40')]);return db[_0x35c3('0x2b')][_0x35c3('0x48')](_0x188dde)[_0x35c3('0x27')](handleEntityNotFound(_0xad83e7,null))['then'](respondWithResult(_0xad83e7,null))[_0x35c3('0x44')](handleError(_0xad83e7,null));};exports['create']=function(_0x59d36f,_0x3f1430){return db[_0x35c3('0x2b')]['create'](_0x59d36f[_0x35c3('0x49')],{})[_0x35c3('0x27')](respondWithResult(_0x3f1430,0xc9))[_0x35c3('0x44')](handleError(_0x3f1430,null));};exports[_0x35c3('0x4a')]=function(_0x2e21e3,_0x9ece82){if(_0x2e21e3[_0x35c3('0x49')]['id']){delete _0x2e21e3['body']['id'];}return db[_0x35c3('0x2b')]['find']({'where':{'id':_0x2e21e3[_0x35c3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x9ece82,null))[_0x35c3('0x27')](saveUpdates(_0x2e21e3[_0x35c3('0x49')],null))['then'](respondWithResult(_0x9ece82,null))['catch'](handleError(_0x9ece82,null));};exports[_0x35c3('0x26')]=function(_0x392647,_0x450cc0){return db['ChatTransferReport']['find']({'where':{'id':_0x392647['params']['id']}})['then'](handleEntityNotFound(_0x450cc0,null))[_0x35c3('0x27')](removeEntity(_0x450cc0,null))[_0x35c3('0x44')](handleError(_0x450cc0,null));};exports['describe']=function(_0x1dc7e2,_0x3f5ec2){return db['ChatTransferReport'][_0x35c3('0x4c')]()[_0x35c3('0x27')](respondWithResult(_0x3f5ec2,null))[_0x35c3('0x44')](handleError(_0x3f5ec2,null));}; \ No newline at end of file +var _0x0481=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','stack','name','send','ChatTransferReport','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','update','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x0481,0x84));var _0x1048=function(_0x4748a2,_0x5d04bd){_0x4748a2=_0x4748a2-0x0;var _0x16c342=_0x0481[_0x4748a2];return _0x16c342;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1048('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1048('0x1'));var moment=require(_0x1048('0x2'));var BPromise=require(_0x1048('0x3'));var Mustache=require(_0x1048('0x4'));var util=require(_0x1048('0x5'));var path=require(_0x1048('0x6'));var sox=require(_0x1048('0x7'));var csv=require(_0x1048('0x8'));var ejs=require(_0x1048('0x9'));var fs=require('fs');var fs_extra=require(_0x1048('0xa'));var _=require(_0x1048('0xb'));var squel=require(_0x1048('0xc'));var crypto=require(_0x1048('0xd'));var jsforce=require(_0x1048('0xe'));var deskjs=require(_0x1048('0xf'));var toCsv=require(_0x1048('0x8'));var querystring=require(_0x1048('0x10'));var Papa=require(_0x1048('0x11'));var Redis=require(_0x1048('0x12'));var authService=require(_0x1048('0x13'));var qs=require(_0x1048('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1048('0x15'));var logger=require(_0x1048('0x16'))(_0x1048('0x17'));var utils=require('../../config/utils');var config=require(_0x1048('0x18'));var licenseUtil=require(_0x1048('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b69b,_0x26f934){_0x26f934=_0x26f934||0xcc;return function(_0x2b0c2e){if(_0x2b0c2e){return _0x52b69b[_0x1048('0x1a')](_0x26f934);}return _0x52b69b[_0x1048('0x1b')](_0x26f934)[_0x1048('0x1c')]();};}function respondWithResult(_0x28603e,_0x5e71d3){_0x5e71d3=_0x5e71d3||0xc8;return function(_0x31a982){if(_0x31a982){return _0x28603e['status'](_0x5e71d3)['json'](_0x31a982);}};}function respondWithFilteredResult(_0x997e5c,_0x41d108){return function(_0x41cd51){if(_0x41cd51){var _0x4b9911=typeof _0x41d108[_0x1048('0x1d')]==='undefined'&&typeof _0x41d108['limit']===_0x1048('0x1e');var _0x37a3ff=_0x41cd51[_0x1048('0x1f')];var _0x3a549e=_0x4b9911?0x0:_0x41d108[_0x1048('0x1d')];var _0x9d665b=_0x4b9911?_0x41cd51[_0x1048('0x1f')]:_0x41d108[_0x1048('0x1d')]+_0x41d108[_0x1048('0x20')];var _0x40eee0;if(_0x9d665b>=_0x37a3ff){_0x9d665b=_0x37a3ff;_0x40eee0=0xc8;}else{_0x40eee0=0xce;}_0x997e5c[_0x1048('0x1b')](_0x40eee0);return _0x997e5c[_0x1048('0x21')](_0x1048('0x22'),_0x3a549e+'-'+_0x9d665b+'/'+_0x37a3ff)[_0x1048('0x23')](_0x41cd51);}return null;};}function patchUpdates(_0x1b332a){return function(_0x468ea0){try{jsonpatch[_0x1048('0x24')](_0x468ea0,_0x1b332a,!![]);}catch(_0x225d97){return BPromise['reject'](_0x225d97);}return _0x468ea0[_0x1048('0x25')]();};}function saveUpdates(_0x160038,_0x533291){return function(_0x1ddfe1){if(_0x1ddfe1){return _0x1ddfe1['update'](_0x160038)[_0x1048('0x26')](function(_0x30d47d){return _0x30d47d;});}return null;};}function removeEntity(_0x11f736,_0x1099a5){return function(_0x5aed14){if(_0x5aed14){return _0x5aed14['destroy']()['then'](function(){_0x11f736[_0x1048('0x1b')](0xcc)[_0x1048('0x1c')]();});}};}function handleEntityNotFound(_0x7d4dd3,_0x5841d4){return function(_0x2a8447){if(!_0x2a8447){_0x7d4dd3['sendStatus'](0x194);}return _0x2a8447;};}function handleError(_0x1cc66f,_0xc2cb0a){_0xc2cb0a=_0xc2cb0a||0x1f4;return function(_0x5ed88c){logger['error'](_0x5ed88c[_0x1048('0x27')]);if(_0x5ed88c['name']){delete _0x5ed88c[_0x1048('0x28')];}_0x1cc66f[_0x1048('0x1b')](_0xc2cb0a)[_0x1048('0x29')](_0x5ed88c);};}exports['index']=function(_0x5809c7,_0x3c02c7){var _0x315320={},_0x38a9c5={},_0x350bec={'count':0x0,'rows':[]};var _0x1c4c35=_['map'](db[_0x1048('0x2a')]['rawAttributes'],function(_0x467dcf){return{'name':_0x467dcf[_0x1048('0x2b')],'type':_0x467dcf[_0x1048('0x2c')]['key']};});_0x38a9c5[_0x1048('0x2d')]=_[_0x1048('0x2e')](_0x1c4c35,'name');_0x38a9c5[_0x1048('0x2f')]=_[_0x1048('0x30')](_0x5809c7[_0x1048('0x2f')]);_0x38a9c5[_0x1048('0x31')]=_[_0x1048('0x32')](_0x38a9c5['model'],_0x38a9c5[_0x1048('0x2f')]);_0x315320[_0x1048('0x33')]=_[_0x1048('0x32')](_0x38a9c5['model'],qs[_0x1048('0x34')](_0x5809c7[_0x1048('0x2f')]['fields']));_0x315320[_0x1048('0x33')]=_0x315320[_0x1048('0x33')][_0x1048('0x35')]?_0x315320[_0x1048('0x33')]:_0x38a9c5['model'];if(!_0x5809c7[_0x1048('0x2f')][_0x1048('0x36')](_0x1048('0x37'))){_0x315320['limit']=qs[_0x1048('0x20')](_0x5809c7[_0x1048('0x2f')][_0x1048('0x20')]);_0x315320[_0x1048('0x1d')]=qs[_0x1048('0x1d')](_0x5809c7[_0x1048('0x2f')][_0x1048('0x1d')]);}_0x315320[_0x1048('0x38')]=qs[_0x1048('0x39')](_0x5809c7[_0x1048('0x2f')][_0x1048('0x39')]);_0x315320['where']=qs[_0x1048('0x31')](_[_0x1048('0x3a')](_0x5809c7[_0x1048('0x2f')],_0x38a9c5[_0x1048('0x31')]),_0x1c4c35);if(_0x5809c7[_0x1048('0x2f')][_0x1048('0x3b')]){_0x315320[_0x1048('0x3c')]=_[_0x1048('0x3d')](_0x315320['where'],{'$or':_[_0x1048('0x2e')](_0x1c4c35,function(_0x4e182e){if(_0x4e182e[_0x1048('0x2c')]!=='VIRTUAL'){var _0x270f84={};_0x270f84[_0x4e182e[_0x1048('0x28')]]={'$like':'%'+_0x5809c7[_0x1048('0x2f')][_0x1048('0x3b')]+'%'};return _0x270f84;}})});}_0x315320=_['merge']({},_0x315320,_0x5809c7['options']);var _0x499236={'where':_0x315320['where']};return db['ChatTransferReport'][_0x1048('0x1f')](_0x499236)['then'](function(_0x41cb43){_0x350bec[_0x1048('0x1f')]=_0x41cb43;if(_0x5809c7[_0x1048('0x2f')][_0x1048('0x3e')]){_0x315320['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x1048('0x3f')](_0x315320);})[_0x1048('0x26')](function(_0x4667e6){_0x350bec[_0x1048('0x40')]=_0x4667e6;return _0x350bec;})[_0x1048('0x26')](respondWithFilteredResult(_0x3c02c7,_0x315320))['catch'](handleError(_0x3c02c7,null));};exports[_0x1048('0x41')]=function(_0x295179,_0x46c151){var _0xfc6db={'raw':!![],'where':{'id':_0x295179[_0x1048('0x42')]['id']}},_0x38df04={};_0x38df04[_0x1048('0x2d')]=_[_0x1048('0x30')](db['ChatTransferReport'][_0x1048('0x43')]);_0x38df04[_0x1048('0x2f')]=_['keys'](_0x295179[_0x1048('0x2f')]);_0x38df04[_0x1048('0x31')]=_[_0x1048('0x32')](_0x38df04[_0x1048('0x2d')],_0x38df04['query']);_0xfc6db[_0x1048('0x33')]=_['intersection'](_0x38df04[_0x1048('0x2d')],qs[_0x1048('0x34')](_0x295179[_0x1048('0x2f')][_0x1048('0x34')]));_0xfc6db['attributes']=_0xfc6db[_0x1048('0x33')][_0x1048('0x35')]?_0xfc6db[_0x1048('0x33')]:_0x38df04[_0x1048('0x2d')];if(_0x295179[_0x1048('0x2f')][_0x1048('0x3e')]){_0xfc6db['include']=[{'all':!![]}];}_0xfc6db=_[_0x1048('0x3d')]({},_0xfc6db,_0x295179[_0x1048('0x44')]);return db[_0x1048('0x2a')][_0x1048('0x45')](_0xfc6db)[_0x1048('0x26')](handleEntityNotFound(_0x46c151,null))[_0x1048('0x26')](respondWithResult(_0x46c151,null))['catch'](handleError(_0x46c151,null));};exports[_0x1048('0x46')]=function(_0x3d0190,_0x3f1682){return db[_0x1048('0x2a')][_0x1048('0x46')](_0x3d0190[_0x1048('0x47')],{})[_0x1048('0x26')](respondWithResult(_0x3f1682,0xc9))[_0x1048('0x48')](handleError(_0x3f1682,null));};exports[_0x1048('0x49')]=function(_0x28b0b4,_0x406c66){if(_0x28b0b4['body']['id']){delete _0x28b0b4[_0x1048('0x47')]['id'];}return db[_0x1048('0x2a')][_0x1048('0x45')]({'where':{'id':_0x28b0b4[_0x1048('0x42')]['id']}})['then'](handleEntityNotFound(_0x406c66,null))['then'](saveUpdates(_0x28b0b4[_0x1048('0x47')],null))[_0x1048('0x26')](respondWithResult(_0x406c66,null))[_0x1048('0x48')](handleError(_0x406c66,null));};exports['destroy']=function(_0x25d42f,_0x23e3c0){return db[_0x1048('0x2a')]['find']({'where':{'id':_0x25d42f[_0x1048('0x42')]['id']}})[_0x1048('0x26')](handleEntityNotFound(_0x23e3c0,null))[_0x1048('0x26')](removeEntity(_0x23e3c0,null))[_0x1048('0x48')](handleError(_0x23e3c0,null));};exports[_0x1048('0x4a')]=function(_0x28cdb9,_0x37625f){return db[_0x1048('0x2a')][_0x1048('0x4a')]()[_0x1048('0x26')](respondWithResult(_0x37625f,null))['catch'](handleError(_0x37625f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 09cb879..a106d85 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 _0xf97b=['util','moment','bluebird','path','rimraf','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x5648bb,_0x1d0a1a){var _0x5d5c88=function(_0xb533d8){while(--_0xb533d8){_0x5648bb['push'](_0x5648bb['shift']());}};_0x5d5c88(++_0x1d0a1a);}(_0xf97b,0x1b8));var _0xbf97=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xf97b[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbf97('0x2'));var BPromise=require(_0xbf97('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf97('0x4'));var rimraf=require(_0xbf97('0x5'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x303037,_0x5c4430){return _0x303037['define'](_0xbf97('0x6'),attributes,{'tableName':_0xbf97('0x7'),'paranoid':![],'indexes':[{'name':_0xbf97('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd35=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x807bf7,_0x14a895){var _0x1d0ff3=function(_0xe27987){while(--_0xe27987){_0x807bf7['push'](_0x807bf7['shift']());}};_0x1d0ff3(++_0x14a895);}(_0xcd35,0x64));var _0x5cd3=function(_0x184d54,_0x1cfa0f){_0x184d54=_0x184d54-0x0;var _0x2c6aff=_0xcd35[_0x184d54];return _0x2c6aff;};'use strict';var _=require(_0x5cd3('0x0'));var util=require(_0x5cd3('0x1'));var logger=require(_0x5cd3('0x2'))(_0x5cd3('0x3'));var moment=require(_0x5cd3('0x4'));var BPromise=require(_0x5cd3('0x5'));var rp=require(_0x5cd3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cd3('0x7'));var config=require(_0x5cd3('0x8'));var attributes=require(_0x5cd3('0x9'));module['exports']=function(_0x1f77e1,_0xf30f05){return _0x1f77e1[_0x5cd3('0xa')](_0x5cd3('0xb'),attributes,{'tableName':_0x5cd3('0xc'),'paranoid':![],'indexes':[{'name':_0x5cd3('0xd'),'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 d33590b..48a5138 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 _0x3efc=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x316650,_0x4e43b7){var _0x5aaeae=function(_0x4f4fe1){while(--_0x4f4fe1){_0x316650['push'](_0x316650['shift']());}};_0x5aaeae(++_0x4e43b7);}(_0x3efc,0x14c));var _0xc3ef=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3efc[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xc3ef('0x0'));var moment=require(_0xc3ef('0x1'));var BPromise=require(_0xc3ef('0x2'));var rs=require(_0xc3ef('0x3'));var fs=require('fs');var Redis=require(_0xc3ef('0x4'));var db=require(_0xc3ef('0x5'))['db'];var utils=require(_0xc3ef('0x6'));var logger=require(_0xc3ef('0x7'))(_0xc3ef('0x8'));var config=require(_0xc3ef('0x9'));var jayson=require(_0xc3ef('0xa'));var client=jayson[_0xc3ef('0xb')][_0xc3ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ad6c8,_0x42476d,_0x14ca20){return new BPromise(function(_0x527721,_0x47f958){return client[_0xc3ef('0xd')](_0x5ad6c8,_0x14ca20)[_0xc3ef('0xe')](function(_0x5e738c){logger[_0xc3ef('0xf')](_0xc3ef('0x10'),_0x42476d,_0xc3ef('0x11'));logger[_0xc3ef('0x12')](_0xc3ef('0x13'),_0x42476d,_0xc3ef('0x11'),JSON['stringify'](_0x5e738c));if(_0x5e738c[_0xc3ef('0x14')]){if(_0x5e738c[_0xc3ef('0x14')][_0xc3ef('0x15')]===0x1f4){logger[_0xc3ef('0x14')](_0xc3ef('0x10'),_0x42476d,_0x5e738c[_0xc3ef('0x14')]['message']);return _0x47f958(_0x5e738c['error'][_0xc3ef('0x16')]);}logger[_0xc3ef('0x14')](_0xc3ef('0x10'),_0x42476d,_0x5e738c[_0xc3ef('0x14')][_0xc3ef('0x16')]);return _0x527721(_0x5e738c[_0xc3ef('0x14')][_0xc3ef('0x16')]);}else{logger[_0xc3ef('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x42476d,'request\x20sent');_0x527721(_0x5e738c[_0xc3ef('0x17')][_0xc3ef('0x16')]);}})[_0xc3ef('0x18')](function(_0x57f544){logger[_0xc3ef('0x14')](_0xc3ef('0x10'),_0x42476d,_0x57f544);_0x47f958(_0x57f544);});});} \ No newline at end of file +var _0xff2f=['error','code','message','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xff2f,0xae));var _0xfff2=function(_0x33b00c,_0x147745){_0x33b00c=_0x33b00c-0x0;var _0x5697dc=_0xff2f[_0x33b00c];return _0x5697dc;};'use strict';var _=require(_0xfff2('0x0'));var util=require('util');var moment=require(_0xfff2('0x1'));var BPromise=require(_0xfff2('0x2'));var rs=require(_0xfff2('0x3'));var fs=require('fs');var Redis=require(_0xfff2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfff2('0x5'));var logger=require(_0xfff2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfff2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x535e4d,_0x271043,_0x44b1b7){return new BPromise(function(_0x40d489,_0x1e6834){return client[_0xfff2('0x8')](_0x535e4d,_0x44b1b7)[_0xfff2('0x9')](function(_0xae7741){logger[_0xfff2('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x271043,_0xfff2('0xb'));logger[_0xfff2('0xc')](_0xfff2('0xd'),_0x271043,'request\x20sent',JSON[_0xfff2('0xe')](_0xae7741));if(_0xae7741[_0xfff2('0xf')]){if(_0xae7741[_0xfff2('0xf')][_0xfff2('0x10')]===0x1f4){logger[_0xfff2('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x271043,_0xae7741['error'][_0xfff2('0x11')]);return _0x1e6834(_0xae7741[_0xfff2('0xf')][_0xfff2('0x11')]);}logger[_0xfff2('0xf')](_0xfff2('0x12'),_0x271043,_0xae7741[_0xfff2('0xf')][_0xfff2('0x11')]);return _0x40d489(_0xae7741['error'][_0xfff2('0x11')]);}else{logger[_0xfff2('0xa')](_0xfff2('0x12'),_0x271043,_0xfff2('0xb'));_0x40d489(_0xae7741[_0xfff2('0x13')][_0xfff2('0x11')]);}})[_0xfff2('0x14')](function(_0x4bce53){logger[_0xfff2('0xf')](_0xfff2('0x12'),_0x271043,_0x4bce53);_0x1e6834(_0x4bce53);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index da2f031..3d8a7d1 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 _0x3f01=['isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x50bbd9,_0x17d39e){var _0x213693=function(_0x395dbe){while(--_0x395dbe){_0x50bbd9['push'](_0x50bbd9['shift']());}};_0x213693(++_0x17d39e);}(_0x3f01,0xd3));var _0x13f0=function(_0x1d5106,_0x35962f){_0x1d5106=_0x1d5106-0x0;var _0x327197=_0x3f01[_0x1d5106];return _0x327197;};'use strict';var multer=require(_0x13f0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x13f0('0x1'));var express=require(_0x13f0('0x2'));var router=express[_0x13f0('0x3')]();var fs_extra=require(_0x13f0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13f0('0x5'));var config=require(_0x13f0('0x6'));var controller=require(_0x13f0('0x7'));router[_0x13f0('0x8')]('/',auth[_0x13f0('0x9')](),controller['index']);router[_0x13f0('0x8')](_0x13f0('0xa'),auth[_0x13f0('0x9')](),controller['describe']);router[_0x13f0('0x8')](_0x13f0('0xb'),auth[_0x13f0('0x9')](),controller[_0x13f0('0xc')]);router[_0x13f0('0xd')]('/',auth['isAuthenticated'](),controller[_0x13f0('0xe')]);router[_0x13f0('0xf')](_0x13f0('0xb'),auth['isAuthenticated'](),controller[_0x13f0('0x10')]);router[_0x13f0('0x11')](_0x13f0('0xb'),auth[_0x13f0('0x9')](),controller[_0x13f0('0x12')]);module[_0x13f0('0x13')]=router; \ No newline at end of file +var _0x8aae=['create','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/:id','show'];(function(_0x1163db,_0xb9c774){var _0x29fa0f=function(_0x987db1){while(--_0x987db1){_0x1163db['push'](_0x1163db['shift']());}};_0x29fa0f(++_0xb9c774);}(_0x8aae,0x14f));var _0xe8aa=function(_0x46bc58,_0x456a14){_0x46bc58=_0x46bc58-0x0;var _0x1845fd=_0x8aae[_0x46bc58];return _0x1845fd;};'use strict';var multer=require(_0xe8aa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe8aa('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8aa('0x2'));var auth=require(_0xe8aa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe8aa('0x4'));var controller=require(_0xe8aa('0x5'));router[_0xe8aa('0x6')]('/',auth[_0xe8aa('0x7')](),controller['index']);router[_0xe8aa('0x6')]('/describe',auth[_0xe8aa('0x7')](),controller['describe']);router[_0xe8aa('0x6')](_0xe8aa('0x8'),auth[_0xe8aa('0x7')](),controller[_0xe8aa('0x9')]);router['post']('/',auth[_0xe8aa('0x7')](),controller[_0xe8aa('0xa')]);router['put'](_0xe8aa('0x8'),auth[_0xe8aa('0x7')](),controller[_0xe8aa('0xb')]);router[_0xe8aa('0xc')](_0xe8aa('0x8'),auth[_0xe8aa('0x7')](),controller[_0xe8aa('0xd')]);module[_0xe8aa('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0ce582a..f06bca5 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 _0x91a7=['rounded','squared','We\x20are\x20here!','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN'];(function(_0x5586bd,_0x3f9abc){var _0x57a2b4=function(_0x2d9020){while(--_0x2d9020){_0x5586bd['push'](_0x5586bd['shift']());}};_0x57a2b4(++_0x3f9abc);}(_0x91a7,0xe7));var _0x791a=function(_0x5d4bcf,_0x11b260){_0x5d4bcf=_0x5d4bcf-0x0;var _0x12c373=_0x91a7[_0x5d4bcf];return _0x12c373;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x791a('0x0'));module[_0x791a('0x1')]={'name':{'type':Sequelize[_0x791a('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x791a('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x4')},'key':{'type':Sequelize[_0x791a('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x791a('0x2')]},'animation':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x791a('0x9'),_0x791a('0xa')),'defaultValue':_0x791a('0x9')},'header_online':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0xb')},'start_chat_button':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xc')},'header_offline':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x791a('0xf')]},'closingQuestion':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x13')},'ratingType':{'type':Sequelize[_0x791a('0x14')](_0x791a('0x15'),_0x791a('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return JSON[_0x791a('0x17')]({'items':[{'type':_0x791a('0x18'),'variable':null,'config':{'placeholder':_0x791a('0x19'),'type':_0x791a('0x1a'),'required':!![]},'props':{'title':_0x791a('0x19'),'helpText':''}},{'type':_0x791a('0x18'),'props':{'title':_0x791a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x791a('0x4'),'type':_0x791a('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x791a('0x1b'))?JSON[_0x791a('0x1c')](this[_0x791a('0x1d')](_0x791a('0x1b'))):{};},'set':function(_0x4d748a){return this[_0x791a('0x1e')](_0x791a('0x1b'),JSON['stringify'](_0x4d748a));}},'offlineForm':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return JSON[_0x791a('0x17')]({'items':[{'type':_0x791a('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x791a('0x4'),'type':_0x791a('0x4')},'variable':null},{'type':_0x791a('0x1f'),'config':{'placeholder':_0x791a('0x20')},'props':{'title':_0x791a('0x20'),'helpText':_0x791a('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x791a('0x1d')](_0x791a('0x22'))?JSON['parse'](this[_0x791a('0x1d')](_0x791a('0x22'))):{};},'set':function(_0x1b10a7){return this['setDataValue'](_0x791a('0x22'),JSON['stringify'](_0x1b10a7));}},'token':{'type':Sequelize[_0x791a('0x2')],'defaultValue':function(){return rs[_0x791a('0x23')]();}},'autoclose':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x791a('0x2')]},'forwardOffline':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x24')},'waitingMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x28')},'sendUnmanaged':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x791a('0x2')]},'customerAvatar':{'type':Sequelize[_0x791a('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x2b')},'systemAvatar':{'type':Sequelize[_0x791a('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x791a('0xd')],'comment':_0x791a('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15f066){if(!_0x15f066)this[_0x791a('0x1e')](_0x791a('0x2d'),null);this['setDataValue'](_0x791a('0x2e'),_0x15f066);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x2f')},'vidaooNote':{'type':Sequelize[_0x791a('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x791a('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x791a('0xf')]}}; \ No newline at end of file +var _0xd2ea=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0x4fdac2,_0x41a329){var _0x2965ed=function(_0x51c503){while(--_0x51c503){_0x4fdac2['push'](_0x4fdac2['shift']());}};_0x2965ed(++_0x41a329);}(_0xd2ea,0x15f));var _0xad2e=function(_0x109ec6,_0x4aab87){_0x109ec6=_0x109ec6-0x0;var _0x148f05=_0xd2ea[_0x109ec6];return _0x148f05;};'use strict';var Sequelize=require(_0xad2e('0x0'));var rs=require(_0xad2e('0x1'));module[_0xad2e('0x2')]={'name':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xad2e('0x3')]},'mapKey':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'mapKeyOffline':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'key':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xad2e('0x3')]},'animation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xad2e('0x8')]('rounded',_0xad2e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xa')},'start_chat_button':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xad2e('0xe')]},'closingQuestion':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x11')},'noteTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x12')},'placeholderMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x13')},'closingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x14')},'closingMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x16')},'ratingType':{'type':Sequelize[_0xad2e('0x8')](_0xad2e('0x17'),_0xad2e('0x18')),'defaultValue':_0xad2e('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xad2e('0xe')],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':_0xad2e('0x1a'),'variable':null,'config':{'placeholder':_0xad2e('0x1b'),'type':_0xad2e('0x1c'),'required':!![]},'props':{'title':_0xad2e('0x1b'),'helpText':''}},{'type':_0xad2e('0x1a'),'props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x1e'))?JSON[_0xad2e('0x1f')](this[_0xad2e('0x1d')](_0xad2e('0x1e'))):{};},'set':function(_0x58acc8){return this[_0xad2e('0x20')](_0xad2e('0x1e'),JSON[_0xad2e('0x19')](_0x58acc8));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':'input','props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':_0xad2e('0x4')},'variable':null},{'type':_0xad2e('0x21'),'config':{'placeholder':_0xad2e('0x22')},'props':{'title':_0xad2e('0x22'),'helpText':_0xad2e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x24'))?JSON[_0xad2e('0x1f')](this['getDataValue'](_0xad2e('0x24'))):{};},'set':function(_0xfd2087){return this[_0xad2e('0x20')](_0xad2e('0x24'),JSON[_0xad2e('0x19')](_0xfd2087));}},'token':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':function(){return rs[_0xad2e('0x25')]();}},'autoclose':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xad2e('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xad2e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x26')},'waitingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xad2e('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xad2e('0x2b');}},'notificationSound':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xad2e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2e')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2f')},'defaultTitle':{'type':Sequelize[_0xad2e('0x3')]},'customerAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad2e('0x6')],'comment':_0xad2e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'comment':_0xad2e('0x32'),'set':function(_0x6f4fbc){if(!_0x6f4fbc)this[_0xad2e('0x20')](_0xad2e('0x33'),null);this['setDataValue'](_0xad2e('0x34'),_0x6f4fbc);}},'vidaooEscalation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xad2e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xad2e('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xad2e('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 5e3fbcf..ef811b3 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 _0xb8dd=['server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','contact','headers','cf-connecting-ip','first','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','update','autoclose','push','unmanaged','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','findOne','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','true','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-forwarded-for','connection','remoteAddress','replace','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','false','offlineForm','onlineForm','items','fromKey','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','querystring','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','get','ChatWebsites','UserProfileResource','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','mandatoryDispositionPause','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8dd,0x1e0));var _0xdb8d=function(_0xf105c1,_0x30dd5e){_0xf105c1=_0xf105c1-0x0;var _0x450364=_0xb8dd[_0xf105c1];return _0x450364;};'use strict';var BPromise=require(_0xdb8d('0x0'));var Mustache=require(_0xdb8d('0x1'));var util=require(_0xdb8d('0x2'));var path=require(_0xdb8d('0x3'));var ejs=require(_0xdb8d('0x4'));var fs=require('fs');var fs_extra=require(_0xdb8d('0x5'));var _=require('lodash');var querystring=require(_0xdb8d('0x6'));var Redis=require('ioredis');var qs=require(_0xdb8d('0x7'));var logger=require('../../config/logger')(_0xdb8d('0x8'));var config=require(_0xdb8d('0x9'));var db=require(_0xdb8d('0xa'))['db'];config['redis']=_[_0xdb8d('0xb')](config['redis'],{'host':_0xdb8d('0xc'),'port':0x18eb});var socket=require(_0xdb8d('0xd'))(new Redis(config[_0xdb8d('0xe')]));require(_0xdb8d('0xf'))[_0xdb8d('0x10')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xdb8d('0x11'));var client=jayson[_0xdb8d('0x12')][_0xdb8d('0x13')]({'port':0x232c});var client9002=jayson[_0xdb8d('0x12')][_0xdb8d('0x13')]({'port':0x232a});var client9003=jayson['client'][_0xdb8d('0x13')]({'port':0x232b});var client9001=jayson[_0xdb8d('0x12')][_0xdb8d('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x2dd777,_0x4652de,_0x3759ee,_0x64a2ac){return new BPromise(function(_0x415b6b,_0x3c9a12){var _0x5b53a0=_0x64a2ac||client;return _0x5b53a0[_0xdb8d('0x14')](_0x2dd777,_0x3759ee)[_0xdb8d('0x15')](function(_0x40a6b5){logger[_0xdb8d('0x16')](_0xdb8d('0x17'),_0x4652de,_0xdb8d('0x18'));logger[_0xdb8d('0x19')](_0xdb8d('0x1a'),_0x4652de,_0xdb8d('0x18'),JSON[_0xdb8d('0x1b')](_0x40a6b5));if(_0x40a6b5[_0xdb8d('0x1c')]){if(_0x40a6b5['error']['code']===0x1f4){logger[_0xdb8d('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x4652de,_0x40a6b5[_0xdb8d('0x1c')][_0xdb8d('0x1d')]);return _0x3c9a12(_0x40a6b5[_0xdb8d('0x1c')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4652de,_0x40a6b5[_0xdb8d('0x1c')][_0xdb8d('0x1d')]);return _0x415b6b(_0x40a6b5[_0xdb8d('0x1c')]['message']);}else{logger[_0xdb8d('0x16')](_0xdb8d('0x17'),_0x4652de,_0xdb8d('0x18'));_0x415b6b(_0x40a6b5['result'][_0xdb8d('0x1d')]);}})[_0xdb8d('0x1e')](function(_0x58ee33){logger[_0xdb8d('0x1c')](_0xdb8d('0x17'),_0x4652de,_0x58ee33);_0x3c9a12(_0x58ee33);});});}function respondWithStatusCode(_0x54a4c3,_0x5ae366){_0x5ae366=_0x5ae366||0xcc;return function(_0x189fac){if(_0x189fac){return _0x54a4c3[_0xdb8d('0x1f')](_0x5ae366);}return _0x54a4c3[_0xdb8d('0x20')](_0x5ae366)[_0xdb8d('0x21')]();};}function respondWithResult(_0x4e4313,_0x35ca47){_0x35ca47=_0x35ca47||0xc8;return function(_0x20f787){if(_0x20f787){return _0x4e4313[_0xdb8d('0x20')](_0x35ca47)['json'](_0x20f787);}};}function respondWithFilteredResult(_0x1df245,_0x1a0ac6){return function(_0xfd3fe0){if(_0xfd3fe0){var _0x5f33fd=typeof _0x1a0ac6[_0xdb8d('0x22')]===_0xdb8d('0x23')&&typeof _0x1a0ac6[_0xdb8d('0x24')]===_0xdb8d('0x23');var _0x418532=_0xfd3fe0[_0xdb8d('0x25')];var _0x45eee1=_0x5f33fd?0x0:_0x1a0ac6[_0xdb8d('0x22')];var _0x50ab5a=_0x5f33fd?_0xfd3fe0['count']:_0x1a0ac6[_0xdb8d('0x22')]+_0x1a0ac6[_0xdb8d('0x24')];var _0x5cce28;if(_0x50ab5a>=_0x418532){_0x50ab5a=_0x418532;_0x5cce28=0xc8;}else{_0x5cce28=0xce;}_0x1df245['status'](_0x5cce28);return _0x1df245[_0xdb8d('0x26')](_0xdb8d('0x27'),_0x45eee1+'-'+_0x50ab5a+'/'+_0x418532)[_0xdb8d('0x28')](_0xfd3fe0);}return null;};}function saveUpdates(_0x99cfea){return function(_0x5ad770){if(_0x5ad770){return _0x5ad770['update'](_0x99cfea)[_0xdb8d('0x15')](function(_0x32bd91){return _0x32bd91;});}return null;};}function removeEntity(_0x13a7c3){return function(_0x353376){if(_0x353376){return _0x353376[_0xdb8d('0x29')]()[_0xdb8d('0x15')](function(){var _0x26fd61=_0x353376[_0xdb8d('0x2a')]({'plain':!![]});var _0x22757f=_0xdb8d('0x2b');return db[_0xdb8d('0x2c')]['destroy']({'where':{'type':_0x22757f,'resourceId':_0x26fd61['id']}})[_0xdb8d('0x15')](function(){return _0x353376;});})['then'](function(){_0x13a7c3[_0xdb8d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51da64){return function(_0x6ef708){if(!_0x6ef708){_0x51da64['sendStatus'](0x194);}return _0x6ef708;};}function handleError(_0x34719d,_0x164cc1){_0x164cc1=_0x164cc1||0x1f4;return function(_0x2b75ba){logger[_0xdb8d('0x1c')](_0x2b75ba['stack']);if(_0x2b75ba[_0xdb8d('0x2d')]){delete _0x2b75ba[_0xdb8d('0x2d')];}_0x34719d['status'](_0x164cc1)[_0xdb8d('0x2e')](_0x2b75ba);};}exports[_0xdb8d('0x2f')]=function(_0x30bc25,_0x3b8227){var _0x5e6704={'include':[{'model':db[_0xdb8d('0x30')],'as':'mandatoryDispositionPause'}]},_0x2f56a0={},_0x4378ed={'count':0x0,'rows':[]};var _0xdbc316=_[_0xdb8d('0x31')](db[_0xdb8d('0x32')][_0xdb8d('0x33')],function(_0x7b67de){return{'name':_0x7b67de[_0xdb8d('0x34')],'type':_0x7b67de[_0xdb8d('0x35')][_0xdb8d('0x36')]};});_0x2f56a0['model']=_[_0xdb8d('0x31')](_0xdbc316,_0xdb8d('0x2d'));_0x2f56a0[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x30bc25[_0xdb8d('0x37')]);_0x2f56a0[_0xdb8d('0x39')]=_[_0xdb8d('0x3a')](_0x2f56a0[_0xdb8d('0x3b')],_0x2f56a0[_0xdb8d('0x37')]);_0x5e6704[_0xdb8d('0x3c')]=_[_0xdb8d('0x3a')](_0x2f56a0['model'],qs[_0xdb8d('0x3d')](_0x30bc25[_0xdb8d('0x37')][_0xdb8d('0x3d')]));_0x5e6704['attributes']=_0x5e6704[_0xdb8d('0x3c')]['length']?_0x5e6704[_0xdb8d('0x3c')]:_0x2f56a0['model'];if(!_0x30bc25[_0xdb8d('0x37')][_0xdb8d('0x3e')](_0xdb8d('0x3f'))){_0x5e6704[_0xdb8d('0x24')]=qs['limit'](_0x30bc25[_0xdb8d('0x37')][_0xdb8d('0x24')]);_0x5e6704[_0xdb8d('0x22')]=qs[_0xdb8d('0x22')](_0x30bc25[_0xdb8d('0x37')][_0xdb8d('0x22')]);}_0x5e6704[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x30bc25['query']['sort']);_0x5e6704[_0xdb8d('0x42')]=qs['filters'](_[_0xdb8d('0x43')](_0x30bc25[_0xdb8d('0x37')],_0x2f56a0[_0xdb8d('0x39')]),_0xdbc316);if(_0x30bc25['query'][_0xdb8d('0x44')]){_0x5e6704['where']=_['merge'](_0x5e6704[_0xdb8d('0x42')],{'$or':_[_0xdb8d('0x31')](_0xdbc316,function(_0x5b6192){if(_0x5b6192[_0xdb8d('0x35')]!==_0xdb8d('0x45')){var _0xfff42f={};_0xfff42f[_0x5b6192[_0xdb8d('0x2d')]]={'$like':'%'+_0x30bc25[_0xdb8d('0x37')][_0xdb8d('0x44')]+'%'};return _0xfff42f;}})});}_0x5e6704=_[_0xdb8d('0x46')]({},_0x5e6704,_0x30bc25['options']);var _0x16fb22={'where':_0x5e6704[_0xdb8d('0x42')]};return db[_0xdb8d('0x32')][_0xdb8d('0x25')](_0x16fb22)[_0xdb8d('0x15')](function(_0x300bdf){_0x4378ed[_0xdb8d('0x25')]=_0x300bdf;if(_0x30bc25[_0xdb8d('0x37')][_0xdb8d('0x47')]){_0x5e6704[_0xdb8d('0x48')]=[{'all':!![]}];}return db[_0xdb8d('0x32')]['findAll'](_0x5e6704);})[_0xdb8d('0x15')](function(_0x4020f0){_0x4378ed['rows']=_0x4020f0;return _0x4378ed;})[_0xdb8d('0x15')](respondWithFilteredResult(_0x3b8227,_0x5e6704))['catch'](handleError(_0x3b8227,null));};exports[_0xdb8d('0x49')]=function(_0x5a32a7,_0x1e6f2b){var _0x222599={'raw':![],'where':{'id':_0x5a32a7[_0xdb8d('0x4a')]['id']},'include':[{'model':db[_0xdb8d('0x30')],'as':_0xdb8d('0x4b')}]},_0x1ef9bd={};_0x1ef9bd[_0xdb8d('0x3b')]=_['keys'](db[_0xdb8d('0x32')][_0xdb8d('0x33')]);_0x1ef9bd[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x5a32a7['query']);_0x1ef9bd['filters']=_[_0xdb8d('0x3a')](_0x1ef9bd['model'],_0x1ef9bd[_0xdb8d('0x37')]);_0x222599[_0xdb8d('0x3c')]=_[_0xdb8d('0x3a')](_0x1ef9bd['model'],qs['fields'](_0x5a32a7[_0xdb8d('0x37')][_0xdb8d('0x3d')]));_0x222599[_0xdb8d('0x3c')]=_0x222599[_0xdb8d('0x3c')][_0xdb8d('0x4c')]?_0x222599[_0xdb8d('0x3c')]:_0x1ef9bd[_0xdb8d('0x3b')];if(_0x5a32a7[_0xdb8d('0x37')]['includeAll']){_0x222599[_0xdb8d('0x48')]=[{'all':!![]}];}_0x222599=_[_0xdb8d('0x46')]({},_0x222599,_0x5a32a7[_0xdb8d('0x4d')]);return db[_0xdb8d('0x32')]['find'](_0x222599)[_0xdb8d('0x15')](handleEntityNotFound(_0x1e6f2b,null))[_0xdb8d('0x15')](respondWithResult(_0x1e6f2b,null))[_0xdb8d('0x1e')](handleError(_0x1e6f2b,null));};exports['create']=function(_0x23bd43,_0x5eb7f4){return db[_0xdb8d('0x32')][_0xdb8d('0x4e')](_0x23bd43[_0xdb8d('0x4f')],{})[_0xdb8d('0x15')](function(_0x578d44){var _0x14fa9a=_0x23bd43[_0xdb8d('0x50')][_0xdb8d('0x2a')]({'plain':!![]});if(!_0x14fa9a)throw new Error(_0xdb8d('0x51'));if(_0x14fa9a['role']==='user'){var _0x5b2fc5=_0x578d44['get']({'plain':!![]});var _0x52fbc3=_0xdb8d('0x2b');return db[_0xdb8d('0x52')][_0xdb8d('0x53')]({'where':{'name':_0x52fbc3,'userProfileId':_0x14fa9a['userProfileId']},'raw':!![]})[_0xdb8d('0x15')](function(_0x11faa8){if(_0x11faa8&&_0x11faa8['autoAssociation']===0x0){return db[_0xdb8d('0x2c')][_0xdb8d('0x4e')]({'name':_0x5b2fc5[_0xdb8d('0x2d')],'resourceId':_0x5b2fc5['id'],'type':_0x11faa8[_0xdb8d('0x2d')],'sectionId':_0x11faa8['id']},{})[_0xdb8d('0x15')](function(){return _0x578d44;});}else{return _0x578d44;}})[_0xdb8d('0x1e')](function(_0x106382){logger[_0xdb8d('0x1c')](_0xdb8d('0x54'),_0x106382);throw _0x106382;});}return _0x578d44;})['then'](respondWithResult(_0x5eb7f4,0xc9))[_0xdb8d('0x1e')](handleError(_0x5eb7f4,null));};exports['update']=function(_0x217f88,_0x1cf9c0){if(_0x217f88[_0xdb8d('0x4f')]['id']){delete _0x217f88['body']['id'];}return db[_0xdb8d('0x32')]['find']({'where':{'id':_0x217f88[_0xdb8d('0x4a')]['id']},'include':[{'model':db[_0xdb8d('0x30')],'as':_0xdb8d('0x4b')}]})[_0xdb8d('0x15')](handleEntityNotFound(_0x1cf9c0,null))[_0xdb8d('0x15')](saveUpdates(_0x217f88[_0xdb8d('0x4f')],null))['then'](respondWithResult(_0x1cf9c0,null))[_0xdb8d('0x1e')](handleError(_0x1cf9c0,null));};exports[_0xdb8d('0x29')]=function(_0x8f18ac,_0x4125a9){return db['ChatWebsite'][_0xdb8d('0x53')]({'where':{'id':_0x8f18ac[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x4125a9,null))[_0xdb8d('0x15')](removeEntity(_0x4125a9,null))['catch'](handleError(_0x4125a9,null));};exports[_0xdb8d('0x55')]=function(_0xbfcf64,_0x33aa55){return db[_0xdb8d('0x32')]['describe']()['then'](respondWithResult(_0x33aa55,null))[_0xdb8d('0x1e')](handleError(_0x33aa55,null));};exports[_0xdb8d('0x56')]=function(_0x118b7f,_0x3c8462){if(_0x118b7f[_0xdb8d('0x4f')]['id']){delete _0x118b7f[_0xdb8d('0x4f')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x118b7f['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x3c8462,null))['then'](function(_0x1ac614){if(_0x1ac614){_0x118b7f['body'][_0xdb8d('0x57')]=_0x1ac614['id'];return db[_0xdb8d('0x58')]['create'](_0x118b7f[_0xdb8d('0x4f')]);}})['then'](respondWithResult(_0x3c8462,null))[_0xdb8d('0x1e')](handleError(_0x3c8462,null));};exports[_0xdb8d('0x59')]=function(_0x59360d,_0x2d6664){var _0x578c3c={'raw':![],'where':{}};var _0x3a895d={};var _0x35a405={'count':0x0,'rows':[]};return db[_0xdb8d('0x32')]['findOne']({'where':{'id':_0x59360d['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x2d6664,null))[_0xdb8d('0x15')](function(_0x32caa9){if(_0x32caa9){_0x3a895d['model']=_[_0xdb8d('0x38')](db[_0xdb8d('0x58')][_0xdb8d('0x33')]);_0x3a895d[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x59360d[_0xdb8d('0x37')]);_0x3a895d[_0xdb8d('0x39')]=_[_0xdb8d('0x3a')](_0x3a895d[_0xdb8d('0x3b')],_0x3a895d[_0xdb8d('0x37')]);_0x578c3c['attributes']=_['intersection'](_0x3a895d[_0xdb8d('0x3b')],qs['fields'](_0x59360d[_0xdb8d('0x37')]['fields']));_0x578c3c[_0xdb8d('0x3c')]=_0x578c3c[_0xdb8d('0x3c')][_0xdb8d('0x4c')]?_0x578c3c[_0xdb8d('0x3c')]:_0x3a895d[_0xdb8d('0x3b')];if(!_0x59360d[_0xdb8d('0x37')]['hasOwnProperty']('nolimit')){_0x578c3c[_0xdb8d('0x24')]=qs[_0xdb8d('0x24')](_0x59360d[_0xdb8d('0x37')][_0xdb8d('0x24')]);_0x578c3c[_0xdb8d('0x22')]=qs['offset'](_0x59360d[_0xdb8d('0x37')][_0xdb8d('0x22')]);}_0x578c3c[_0xdb8d('0x40')]=qs['sort'](_0x59360d['query'][_0xdb8d('0x41')]);_0x578c3c[_0xdb8d('0x42')]=qs[_0xdb8d('0x39')](_[_0xdb8d('0x43')](_0x59360d['query'],_0x3a895d[_0xdb8d('0x39')]));_0x578c3c['where'][_0xdb8d('0x57')]=_0x32caa9['id'];if(_0x59360d[_0xdb8d('0x37')][_0xdb8d('0x44')]){_0x578c3c[_0xdb8d('0x42')]=_[_0xdb8d('0x46')](_0x578c3c[_0xdb8d('0x42')],{'$or':_[_0xdb8d('0x31')](_0x578c3c[_0xdb8d('0x3c')],function(_0x52654e){var _0x54b885={};_0x54b885[_0x52654e]={'$like':'%'+_0x59360d[_0xdb8d('0x37')]['filter']+'%'};return _0x54b885;})});}_0x578c3c=_[_0xdb8d('0x46')]({},_0x578c3c,_0x59360d[_0xdb8d('0x4d')]);return db[_0xdb8d('0x58')][_0xdb8d('0x25')]({'where':_0x578c3c[_0xdb8d('0x42')]})['then'](function(_0x5e8f7f){_0x35a405['count']=_0x5e8f7f;if(_0x59360d[_0xdb8d('0x37')][_0xdb8d('0x47')]){_0x578c3c['include']=[{'all':!![]}];}return db[_0xdb8d('0x58')]['findAll'](_0x578c3c);})[_0xdb8d('0x15')](function(_0x28d541){_0x35a405[_0xdb8d('0x5a')]=_0x28d541;return _0x35a405;});}})[_0xdb8d('0x15')](respondWithFilteredResult(_0x2d6664,_0x578c3c))['catch'](handleError(_0x2d6664,null));};exports[_0xdb8d('0x5b')]=function(_0x2904e4,_0x201a82){return db[_0xdb8d('0x32')]['find']({'where':{'id':_0x2904e4['params']['id']}})['then'](handleEntityNotFound(_0x201a82,null))['then'](function(_0x47e746){if(_0x47e746){return _0x47e746[_0xdb8d('0x5b')](_0x2904e4['query'][_0xdb8d('0x5c')]);}})[_0xdb8d('0x15')](respondWithStatusCode(_0x201a82,null))[_0xdb8d('0x1e')](handleError(_0x201a82,null));};exports[_0xdb8d('0x5d')]=function(_0x55899a,_0x572678){if(_0x55899a[_0xdb8d('0x4f')]['id']){delete _0x55899a[_0xdb8d('0x4f')]['id'];}return db[_0xdb8d('0x32')][_0xdb8d('0x53')]({'where':{'id':_0x55899a['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x572678,null))[_0xdb8d('0x15')](function(_0x19903a){if(_0x19903a){_0x55899a['body'][_0xdb8d('0x57')]=_0x19903a['id'];return db[_0xdb8d('0x5e')]['create'](_0x55899a['body']);}})[_0xdb8d('0x15')](respondWithResult(_0x572678,null))['catch'](handleError(_0x572678,null));};exports[_0xdb8d('0x5f')]=function(_0x2c829c,_0x47662b){var _0x24f31b={'raw':![],'where':{}};var _0x4be66e={};var _0x5d73be={'count':0x0,'rows':[]};return db[_0xdb8d('0x32')]['findOne']({'where':{'id':_0x2c829c[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x47662b,null))[_0xdb8d('0x15')](function(_0x5d86a3){if(_0x5d86a3){_0x4be66e[_0xdb8d('0x3b')]=_[_0xdb8d('0x38')](db[_0xdb8d('0x5e')][_0xdb8d('0x33')]);_0x4be66e[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x2c829c[_0xdb8d('0x37')]);_0x4be66e[_0xdb8d('0x39')]=_[_0xdb8d('0x3a')](_0x4be66e[_0xdb8d('0x3b')],_0x4be66e[_0xdb8d('0x37')]);_0x24f31b[_0xdb8d('0x3c')]=_['intersection'](_0x4be66e[_0xdb8d('0x3b')],qs[_0xdb8d('0x3d')](_0x2c829c[_0xdb8d('0x37')]['fields']));_0x24f31b['attributes']=_0x24f31b['attributes']['length']?_0x24f31b[_0xdb8d('0x3c')]:_0x4be66e['model'];if(!_0x2c829c[_0xdb8d('0x37')][_0xdb8d('0x3e')](_0xdb8d('0x3f'))){_0x24f31b[_0xdb8d('0x24')]=qs['limit'](_0x2c829c['query'][_0xdb8d('0x24')]);_0x24f31b['offset']=qs['offset'](_0x2c829c[_0xdb8d('0x37')]['offset']);}_0x24f31b[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x2c829c['query'][_0xdb8d('0x41')]);_0x24f31b['where']=qs['filters'](_[_0xdb8d('0x43')](_0x2c829c[_0xdb8d('0x37')],_0x4be66e[_0xdb8d('0x39')]));_0x24f31b['where'][_0xdb8d('0x57')]=_0x5d86a3['id'];if(_0x2c829c['query']['filter']){_0x24f31b[_0xdb8d('0x42')]=_[_0xdb8d('0x46')](_0x24f31b['where'],{'$or':_[_0xdb8d('0x31')](_0x24f31b['attributes'],function(_0x2a126){var _0x329aee={};_0x329aee[_0x2a126]={'$like':'%'+_0x2c829c[_0xdb8d('0x37')][_0xdb8d('0x44')]+'%'};return _0x329aee;})});}_0x24f31b=_[_0xdb8d('0x46')]({},_0x24f31b,_0x2c829c[_0xdb8d('0x4d')]);return db[_0xdb8d('0x5e')][_0xdb8d('0x25')]({'where':_0x24f31b[_0xdb8d('0x42')]})[_0xdb8d('0x15')](function(_0x560e1f){_0x5d73be[_0xdb8d('0x25')]=_0x560e1f;if(_0x2c829c[_0xdb8d('0x37')][_0xdb8d('0x47')]){_0x24f31b['include']=[{'all':!![]}];}return db[_0xdb8d('0x5e')][_0xdb8d('0x60')](_0x24f31b);})['then'](function(_0x26f21b){_0x5d73be[_0xdb8d('0x5a')]=_0x26f21b;return _0x5d73be;});}})[_0xdb8d('0x15')](respondWithFilteredResult(_0x47662b,_0x24f31b))[_0xdb8d('0x1e')](handleError(_0x47662b,null));};exports[_0xdb8d('0x61')]=function(_0x29a3dd,_0x15e960){return db[_0xdb8d('0x32')][_0xdb8d('0x53')]({'where':{'id':_0x29a3dd[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x15e960,null))[_0xdb8d('0x15')](function(_0x4ca373){if(_0x4ca373){return _0x4ca373[_0xdb8d('0x61')](_0x29a3dd[_0xdb8d('0x37')][_0xdb8d('0x5c')]);}})[_0xdb8d('0x15')](respondWithStatusCode(_0x15e960,null))[_0xdb8d('0x1e')](handleError(_0x15e960,null));};exports['addLogo']=function(_0x5666d7,_0x572052){_0x5666d7[_0xdb8d('0x4f')][_0xdb8d('0x62')]=_0x5666d7[_0xdb8d('0x63')][_0xdb8d('0x64')];return db[_0xdb8d('0x32')][_0xdb8d('0x53')]({'where':{'id':_0x5666d7[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x572052,null))[_0xdb8d('0x15')](saveUpdates(_0x5666d7['body'],null))[_0xdb8d('0x15')](respondWithResult(_0x572052,null))[_0xdb8d('0x1e')](handleError(_0x572052,null));};exports[_0xdb8d('0x65')]=function(_0xb77416,_0x5c7386){_0xb77416[_0xdb8d('0x4f')]['agentAvatar']=_0xb77416[_0xdb8d('0x63')]['filename'];return db[_0xdb8d('0x32')]['find']({'where':{'id':_0xb77416['params']['id']}})['then'](handleEntityNotFound(_0x5c7386,null))['then'](saveUpdates(_0xb77416[_0xdb8d('0x4f')],null))['then'](respondWithResult(_0x5c7386,null))[_0xdb8d('0x1e')](handleError(_0x5c7386,null));};exports[_0xdb8d('0x66')]=function(_0x2de515,_0x3b7fec){_0x2de515[_0xdb8d('0x4f')][_0xdb8d('0x67')]=_0x2de515['file'][_0xdb8d('0x64')];return db['ChatWebsite']['find']({'where':{'id':_0x2de515[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x3b7fec,null))['then'](saveUpdates(_0x2de515[_0xdb8d('0x4f')],null))[_0xdb8d('0x15')](respondWithResult(_0x3b7fec,null))[_0xdb8d('0x1e')](handleError(_0x3b7fec,null));};exports[_0xdb8d('0x68')]=function(_0x47a7ba,_0x2cacb5){_0x47a7ba[_0xdb8d('0x4f')][_0xdb8d('0x69')]=_0x47a7ba['file'][_0xdb8d('0x64')];return db['ChatWebsite']['find']({'where':{'id':_0x47a7ba[_0xdb8d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2cacb5,null))['then'](saveUpdates(_0x47a7ba[_0xdb8d('0x4f')],null))[_0xdb8d('0x15')](respondWithResult(_0x2cacb5,null))[_0xdb8d('0x1e')](handleError(_0x2cacb5,null));};exports[_0xdb8d('0x6a')]=function(_0x249dcb,_0x1ca9fd){var _0x8ef947=path['join'](config[_0xdb8d('0x6b')],_0xdb8d('0x6c'));var _0x351805={'where':{'id':_0x249dcb[_0xdb8d('0x4a')]['id']},'attributes':['id',_0xdb8d('0x62')],'raw':!![]};var _0x132196=![];return require(_0xdb8d('0x6d'))[_0xdb8d('0x6e')]()[_0xdb8d('0x15')](function(_0xa5e85){if(_0xa5e85){_0x132196=_0xa5e85[_0xdb8d('0x6f')];}})[_0xdb8d('0x15')](function(){return db[_0xdb8d('0x32')][_0xdb8d('0x53')](_0x351805);})[_0xdb8d('0x15')](handleEntityNotFound(_0x1ca9fd,null))[_0xdb8d('0x15')](function(_0x4a4aff){if(_0x4a4aff){if(!_['isNil'](_0x4a4aff[_0xdb8d('0x62')])){if(fs[_0xdb8d('0x70')](path[_0xdb8d('0x71')](config['root'],_0xdb8d('0x72'),_0x4a4aff[_0xdb8d('0x62')]))&&_0x132196){_0x8ef947=path['join'](config['root'],'server/files/images/logos/',_0x4a4aff[_0xdb8d('0x62')]);}}return _0x1ca9fd[_0xdb8d('0x73')](_0x8ef947);}})['catch'](handleError(_0x1ca9fd,null));};exports[_0xdb8d('0x74')]=function(_0x4d3ef7,_0x4d76c5){var _0x57c9d3=path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0x75'));var _0x2c0f8b={'where':{'id':_0x4d3ef7[_0xdb8d('0x4a')]['id']},'attributes':['id',_0xdb8d('0x76')],'raw':!![]};return db['ChatWebsite'][_0xdb8d('0x53')](_0x2c0f8b)[_0xdb8d('0x15')](handleEntityNotFound(_0x4d76c5,null))[_0xdb8d('0x15')](function(_0x31298c){if(_0x31298c){if(!_[_0xdb8d('0x77')](_0x31298c[_0xdb8d('0x76')])){if(fs[_0xdb8d('0x70')](path['join'](config[_0xdb8d('0x6b')],_0xdb8d('0x78'),_0x31298c[_0xdb8d('0x76')]))){_0x57c9d3=path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],'server/files/images/avatars/',_0x31298c[_0xdb8d('0x76')]);}}return _0x4d76c5[_0xdb8d('0x73')](_0x57c9d3);}})['catch'](handleError(_0x4d76c5,null));};exports['getCustomerAvatar']=function(_0x30d8e9,_0x2c6492){var _0x5d6737=path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0x79'));var _0x56b31e={'where':{'id':_0x30d8e9[_0xdb8d('0x4a')]['id']},'attributes':['id',_0xdb8d('0x67'),_0xdb8d('0x7a')],'raw':!![]};return db[_0xdb8d('0x32')]['find'](_0x56b31e)[_0xdb8d('0x15')](handleEntityNotFound(_0x2c6492,null))[_0xdb8d('0x15')](function(_0x35f97d){if(_0x35f97d){if(!_[_0xdb8d('0x77')](_0x35f97d[_0xdb8d('0x67')])){if(fs[_0xdb8d('0x70')](path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],'server/files/images/avatars/',_0x35f97d[_0xdb8d('0x67')]))&&_0x35f97d['showCustomerAvatar']){_0x5d6737=path[_0xdb8d('0x71')](config['root'],_0xdb8d('0x78'),_0x35f97d[_0xdb8d('0x67')]);}}return _0x2c6492[_0xdb8d('0x73')](_0x5d6737);}})[_0xdb8d('0x1e')](handleError(_0x2c6492,null));};exports['getSystemAvatar']=function(_0x160a77,_0xba1e44){var _0x2cede3=path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0x7b'));var _0x44c7ab={'where':{'id':_0x160a77['params']['id']},'attributes':['id',_0xdb8d('0x69')],'raw':!![]};return db[_0xdb8d('0x32')][_0xdb8d('0x53')](_0x44c7ab)[_0xdb8d('0x15')](handleEntityNotFound(_0xba1e44,null))['then'](function(_0x1effb1){if(_0x1effb1){if(!_[_0xdb8d('0x77')](_0x1effb1[_0xdb8d('0x69')])){if(fs[_0xdb8d('0x70')](path[_0xdb8d('0x71')](config['root'],_0xdb8d('0x78'),_0x1effb1['systemAvatar']))){_0x2cede3=path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0x78'),_0x1effb1[_0xdb8d('0x69')]);}}return _0xba1e44[_0xdb8d('0x73')](_0x2cede3);}})['catch'](handleError(_0xba1e44,null));};exports[_0xdb8d('0x7c')]=function(_0x153926,_0x1e186f){var _0x4a0fa9=require('user-agent-parser');var _0x3df74d=new _0x4a0fa9();var _0x53ff5a=_0x3df74d[_0xdb8d('0x7d')](_0x153926['headers'][_0xdb8d('0x7e')])[_0xdb8d('0x7f')]();var _0x448b12={'body':_0x153926[_0xdb8d('0x4f')],'channel':'chat'};var _0x3bb1d5=[];var _0x2307d4=[];var _0x2c2b9b={};var _0x22b7fe=![];return db['CmContact'][_0xdb8d('0x55')]()['then'](function(_0x5109fc){if(!_0x5109fc){throw new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0x82'));}_0x3bb1d5=_[_0xdb8d('0x83')](_['keys'](_0x5109fc),[_0xdb8d('0x84'),_0xdb8d('0x85')]);_0x2307d4=_[_0xdb8d('0x83')](_['keys'](_0x5109fc),['createdAt',_0xdb8d('0x85'),_0xdb8d('0x86'),_0xdb8d('0x87')]);if(_0x153926['body']['id']){delete _0x153926[_0xdb8d('0x4f')]['id'];}if(_[_0xdb8d('0x77')](_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x88')])){throw new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0x89'));}if(_[_0xdb8d('0x77')](_0x153926[_0xdb8d('0x4f')]['body'])||_0x153926['body']['body']===''){throw new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0x8a'));}if(_['isNil'](_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x8b')])){throw new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0x8c')+_0x2307d4);}if(!_[_0xdb8d('0x8d')](_0x2307d4,_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x8b')])){throw new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0x8e')+_0x2307d4);}_0x2c2b9b[_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x8b')]]=_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x88')];})[_0xdb8d('0x15')](function(){return db['ChatWebsite'][_0xdb8d('0x53')]({'where':{'id':_0x153926[_0xdb8d('0x4a')]['id']},'include':[{'model':db['CmList'],'as':_0xdb8d('0x8f'),'include':[{'model':db[_0xdb8d('0x90')],'as':_0xdb8d('0x91'),'where':_0x2c2b9b,'limit':0x1,'order':[[_0xdb8d('0x85'),_0xdb8d('0x92')]]}]},{'model':db[_0xdb8d('0x93')],'as':_0xdb8d('0x94')}]});})[_0xdb8d('0x15')](handleEntityNotFound(_0x1e186f,null))[_0xdb8d('0x15')](function(_0x2ac627){if(_0x2ac627&&_0x2ac627[_0xdb8d('0x8f')]){_0x448b12[_0xdb8d('0x95')]=_0x2ac627;_0x448b12[_0xdb8d('0x96')]=_0x2ac627[_0xdb8d('0x94')];_0x448b12['list']=_0x2ac627[_0xdb8d('0x8f')];_0x448b12[_0xdb8d('0x96')]=_[_0xdb8d('0x97')](_0x448b12[_0xdb8d('0x96')],[_0xdb8d('0x98')],[_0xdb8d('0x99')]);if(_0x448b12['account'][_0xdb8d('0x94')]){delete _0x448b12[_0xdb8d('0x95')]['Applications'];}if(_0x448b12['account'][_0xdb8d('0x8f')]&&_0x448b12['account'][_0xdb8d('0x8f')]['Contacts']['length']){return _0x448b12['account']['List'][_0xdb8d('0x91')][0x0];}var _0x7d8ffb=_[_0xdb8d('0xb')](_0x153926[_0xdb8d('0x4f')],{'firstName':_0x153926[_0xdb8d('0x4f')]['from'],'ListId':_0x2ac627[_0xdb8d('0x87')]});_0x7d8ffb[_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x8b')]]=_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x88')];return db[_0xdb8d('0x90')][_0xdb8d('0x4e')](_0x7d8ffb,{'fields':_0x3bb1d5,'raw':!![]});}})[_0xdb8d('0x15')](handleEntityNotFound(_0x1e186f,null))[_0xdb8d('0x15')](function(_0x3153ee){_0x448b12[_0xdb8d('0x9a')]=_0x3153ee;var _0x1b2466=_0x153926[_0xdb8d('0x4f')]['customerIp'];if(_0x153926[_0xdb8d('0x9b')][_0xdb8d('0x9c')]){_0x1b2466=_0x153926['headers']['cf-connecting-ip'];}else if(_0x153926['headers']['x-forwarded-for']){_0x1b2466=_[_0xdb8d('0x9d')](_0x153926[_0xdb8d('0x9b')]['x-forwarded-for']['split'](','));}if(_0x3153ee){var _0x2d4ef6={'ContactId':_0x3153ee['id'],'ChatWebsiteId':_0x153926[_0xdb8d('0x4a')]['id'],'from':(_0x3153ee[_0xdb8d('0x9e')]||'')+'\x20'+(_0x3153ee['lastName']||''),'customerIp':_0x1b2466,'customerPort':_0x153926[_0xdb8d('0x9b')][_0xdb8d('0x9f')]?_0x153926['headers'][_0xdb8d('0x9f')]:null,'referer':_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xa0')],'browserName':_0x53ff5a[_0xdb8d('0xa1')][_0xdb8d('0x2d')]&&_0x53ff5a[_0xdb8d('0xa1')][_0xdb8d('0xa2')]?util[_0xdb8d('0xa3')](_0xdb8d('0xa4'),_0x53ff5a[_0xdb8d('0xa1')]['name'],_0x53ff5a[_0xdb8d('0xa1')][_0xdb8d('0xa2')]):_0xdb8d('0xa5'),'browserVersion':_0x53ff5a[_0xdb8d('0xa1')][_0xdb8d('0xa2')]||_0xdb8d('0xa5'),'osName':util[_0xdb8d('0xa3')](_0xdb8d('0xa4'),_0x53ff5a['os'][_0xdb8d('0x2d')],_0x53ff5a['os'][_0xdb8d('0xa2')]),'osVersion':_0x53ff5a['os'][_0xdb8d('0xa2')],'deviceModel':_0x53ff5a[_0xdb8d('0xa6')][_0xdb8d('0x3b')]&&_0x53ff5a[_0xdb8d('0xa6')][_0xdb8d('0xa7')]?util[_0xdb8d('0xa3')](_0xdb8d('0xa8'),_0x53ff5a['device']['model'],_0x53ff5a[_0xdb8d('0xa6')][_0xdb8d('0xa7')],_0x53ff5a['device'][_0xdb8d('0x35')]):null,'deviceVendor':_0x53ff5a['device'][_0xdb8d('0xa7')],'deviceType':_0x53ff5a[_0xdb8d('0xa6')][_0xdb8d('0x35')],'formData':JSON[_0xdb8d('0x1b')](_0x153926['body'])};var _0xb48e71={'ChatWebsiteId':_0x153926[_0xdb8d('0x4a')]['id'],'closed':![]};if(_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xa9')]){_0xb48e71[_0xdb8d('0xa9')]=_0x153926['body'][_0xdb8d('0xa9')];return db[_0xdb8d('0xaa')][_0xdb8d('0x53')]({'where':_0xb48e71})['then'](function(_0x1dbc0b){if(_0x1dbc0b){return[_0x1dbc0b,![]];}_0x2d4ef6[_0xdb8d('0xa9')]=_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xa9')];_0x2d4ef6['externalUrl']=_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xab')];return db[_0xdb8d('0xaa')][_0xdb8d('0x4e')](_0x2d4ef6)[_0xdb8d('0x15')](function(_0x46ed07){return[_0x46ed07,!![]];});});}_0xb48e71[_0xdb8d('0xac')]=_0x3153ee['id'];if(_0x153926['body'][_0xdb8d('0xad')]&&_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xad')]['id']){_0xb48e71['id']=_0x153926[_0xdb8d('0x4f')]['interaction']['id'];return db['ChatInteraction'][_0xdb8d('0x53')]({'where':_0xb48e71})[_0xdb8d('0x15')](function(_0x1a0d66){if(_0x1a0d66){return[_0x1a0d66,![]];}return db[_0xdb8d('0xaa')][_0xdb8d('0x4e')](_0x2d4ef6)[_0xdb8d('0x15')](function(_0x3aef4a){return[_0x3aef4a,!![]];});});}return db['ChatInteraction'][_0xdb8d('0x4e')](_0x2d4ef6)[_0xdb8d('0x15')](function(_0x4b164f){return[_0x4b164f,!![]];});}})[_0xdb8d('0xae')](function(_0x3fac98,_0x5ec191){if(_0x3fac98){_0x22b7fe=_0x5ec191;if(!_0x5ec191){var _0x2b44ba={'from':(_0x448b12[_0xdb8d('0x9a')][_0xdb8d('0x9e')]||'')+'\x20'+(_0x448b12['contact'][_0xdb8d('0xaf')]||'')};if(_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xa9')]&&_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xb0')]&&_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xa9')]!=_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xb0')]){_0x2b44ba['threadId']=_0x153926[_0xdb8d('0x4f')][_0xdb8d('0xb0')];}return _0x3fac98[_0xdb8d('0xb1')](_0x2b44ba);}else{return _0x3fac98;}}})['then'](function(_0x108272){_0x448b12['interaction']=_0x108272[_0xdb8d('0x2a')]({'plain':!![]});_0x448b12[_0xdb8d('0xad')]['created']=_0x22b7fe;if(_0x448b12[_0xdb8d('0xad')]['created']){if(_0x448b12['account'][_0xdb8d('0xb2')]){_0x448b12[_0xdb8d('0x96')][_0xdb8d('0xb3')]({'id':0x0,'priority':_0x448b12[_0xdb8d('0x96')][_0xdb8d('0x4c')]+0x1,'app':'close','appdata':_0xdb8d('0xb4'),'interval':'*,*,*,*'});}}return db[_0xdb8d('0xb5')][_0xdb8d('0x4e')]({'body':_0x153926[_0xdb8d('0x4f')][_0xdb8d('0x4f')],'ChatWebsiteId':_0x153926[_0xdb8d('0x4a')]['id'],'ChatInteractionId':_0x108272['id'],'direction':'in','ContactId':_0x448b12[_0xdb8d('0x9a')]['id'],'AttachmentId':_0x153926[_0xdb8d('0x4f')]['AttachmentId']});})[_0xdb8d('0x15')](function(_0x332d60){_0x448b12['message']=_0x332d60;if(_0x448b12[_0xdb8d('0xad')][_0xdb8d('0xb6')]){return db[_0xdb8d('0xb7')]['find']({'attributes':['id',_0xdb8d('0x2d')],'where':{'id':_0x448b12[_0xdb8d('0xad')][_0xdb8d('0xb6')]}})[_0xdb8d('0x15')](function(_0x16e60f){if(_0x16e60f){_0x448b12[_0xdb8d('0x96')][_0xdb8d('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x16e60f[_0xdb8d('0x2d')]+','+(_0x448b12['account'][_0xdb8d('0xb9')]||0xa),'interval':_0xdb8d('0xba')});_0x448b12['forcedOwnership']=!![];}return respondWithRpcPromise(_0xdb8d('0xbb'),_0xdb8d('0xbc'),_0x448b12);});}return respondWithRpcPromise(_0xdb8d('0xbb'),_0xdb8d('0xbc'),_0x448b12);})['then'](function(_0x115abc){respondWithRpcPromise('EventManager','EventManager',{'event':_0xdb8d('0x7c'),'message':_0x115abc},client9002);return _0x115abc;})[_0xdb8d('0x15')](respondWithResult(_0x1e186f,null))[_0xdb8d('0x1e')](handleError(_0x1e186f,null));};exports[_0xdb8d('0xbd')]=function(_0x516395,_0x555f95){var _0x428e5d,_0x5df82e,_0x3f0cba;var _0xc2ffc3=[];var _0x21c972={};var _0x49fe96=_0x516395['files']||[];var _0x17e9b5=[];var _0x1f11bd;return db[_0xdb8d('0x90')][_0xdb8d('0x55')]()[_0xdb8d('0x15')](function(_0x51c7d6){if(!_0x51c7d6){throw new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0x82'));}_0xc2ffc3=_[_0xdb8d('0x83')](_[_0xdb8d('0x38')](_0x51c7d6),['createdAt',_0xdb8d('0x85'),_0xdb8d('0x86'),_0xdb8d('0x87')]);if(_0x516395['body']['id']){delete _0x516395[_0xdb8d('0x4f')]['id'];}if(_[_0xdb8d('0x77')](_0x516395[_0xdb8d('0x4f')]['from'])){throw _0x555f95['status'](0x1f4)[_0xdb8d('0x2e')](new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))]('from\x20is\x20mandatory'));}if(_[_0xdb8d('0x77')](_0x516395[_0xdb8d('0x4f')][_0xdb8d('0x4f')])||_0x516395[_0xdb8d('0x4f')][_0xdb8d('0x4f')]===''){throw _0x555f95[_0xdb8d('0x20')](0x1f4)['send'](new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xdb8d('0x77')](_0x516395['body'][_0xdb8d('0xbe')])){throw _0x555f95['status'](0x1f4)[_0xdb8d('0x2e')](new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0xbf')+_0xc2ffc3));}if(!_['includes'](_0xc2ffc3,_0x516395['body'][_0xdb8d('0xbe')])){throw _0x555f95[_0xdb8d('0x20')](0x1f4)['send'](new db[(_0xdb8d('0x80'))][(_0xdb8d('0x81'))](_0xdb8d('0xc0')+_0xc2ffc3));}_0x21c972[_0x516395[_0xdb8d('0x4f')]['mapKeyOffline']]=_0x516395[_0xdb8d('0x4f')]['from'];})[_0xdb8d('0x15')](function(){return db['ChatWebsite'][_0xdb8d('0x53')]({'where':{'id':_0x516395['params']['id']},'include':[{'model':db[_0xdb8d('0xc1')],'as':'List'},{'model':db[_0xdb8d('0xc2')],'as':_0xdb8d('0xc2')}]});})[_0xdb8d('0x15')](handleEntityNotFound(_0x555f95,null))[_0xdb8d('0x15')](function(_0xdae50b){if(_0xdae50b&&_0xdae50b[_0xdb8d('0x8f')]){_0x5df82e=_0xdae50b;var _0x289422=_[_0xdb8d('0xb')](_0x516395[_0xdb8d('0x4f')],{'firstName':_0x516395[_0xdb8d('0x4f')][_0xdb8d('0x88')],'phone':_0x516395['body'][_0xdb8d('0x88')],'ListId':_0xdae50b['ListId']});_0x289422[_0x516395['body'][_0xdb8d('0xbe')]]=_0x516395[_0xdb8d('0x4f')]['from'];return db[_0xdb8d('0x90')][_0xdb8d('0xc3')]({'where':_0x21c972,'defaults':_0x289422});}})[_0xdb8d('0xae')](function(_0x446808){if(_0x446808){_0x3f0cba=_0x446808;var _0x38d551=fs[_0xdb8d('0xc4')](path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0xc5')),_0xdb8d('0xc6'));var _0x277098=ejs[_0xdb8d('0xc7')](_0x38d551,{'body':_[_0xdb8d('0xc8')](_0x516395['body']['body']),'bodyTitle':_0x5df82e['offlineMessageBody']});return db[_0xdb8d('0xc9')][_0xdb8d('0x4e')]({'body':_0x277098,'plainBody':htmlToText[_0xdb8d('0xca')](_0x277098),'ContactId':_0x446808['id'],'ChatWebsiteId':_0x5df82e['id']});}})['then'](function(_0x5c03fe){_0x1f11bd=_0x5c03fe;if(_0x49fe96[_0xdb8d('0x4c')]){var _0x552e82=_0x49fe96[_0xdb8d('0x31')](function(_0x58bb5e){return{'name':_0x58bb5e[_0xdb8d('0xcb')],'basename':_0x58bb5e[_0xdb8d('0x64')],'type':_0x58bb5e[_0xdb8d('0xcc')],'ChatOfflineMessageId':_0x5c03fe['id']};});_0x17e9b5=_0x552e82[_0xdb8d('0x31')](_0x3aff4b=>{var _0x1df005={'filename':_0x3aff4b[_0xdb8d('0x2d')],'path':path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0xcd'),'files',_0xdb8d('0xce'),_0xdb8d('0xcf'),_0x3aff4b[_0xdb8d('0xd0')])};return _0x1df005;});if(!_0x5df82e['openNewInteraction']){return db[_0xdb8d('0xd1')][_0xdb8d('0xd2')](function(_0x245371){return db[_0xdb8d('0xd3')]['bulkCreate'](_0x552e82,{'transaction':_0x245371});});}}})['then'](function(){if(_0x1f11bd){_0x428e5d=_0x1f11bd;return db[_0xdb8d('0xc2')][_0xdb8d('0xd4')]({'where':{'service':!![]},'include':[{'model':db[_0xdb8d('0xd5')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xdb8d('0xd6')],'as':_0xdb8d('0xd6'),'raw':!![]}]}]});}})['then'](function(_0x406391){if(_0x406391&&_0x406391[_0xdb8d('0xd7')]&&_0x5df82e[_0xdb8d('0xd8')]&&_0x5df82e[_0xdb8d('0xd9')]){var _0x2df77f=_0x406391[_0xdb8d('0xda')]();return respondWithRpcPromise(_0xdb8d('0xdb'),_0xdb8d('0xdc'),{'account':_0x2df77f,'message':{'from':util['format'](_0xdb8d('0xdd'),_0x406391[_0xdb8d('0x2d')],_0x406391[_0xdb8d('0xde')]||_0x406391['Smtp'][_0xdb8d('0x50')]),'to':_0x5df82e['forwardOfflineAddress'],'subject':_0x5df82e['offlineMessageSubject'],'html':_0x428e5d[_0xdb8d('0x4f')],'attachments':_0x17e9b5}},client9003)[_0xdb8d('0x15')](function(){return _0x428e5d;})[_0xdb8d('0x1e')](function(_0x4e1157){logger[_0xdb8d('0x1c')](_0x4e1157);});}})[_0xdb8d('0x15')](function(){if(_0x5df82e&&_0x5df82e['openNewInteraction']&&_0x5df82e[_0xdb8d('0xdf')]){var _0x1dbcb5=[];if(_0x49fe96[_0xdb8d('0x4c')]){_0x1dbcb5=_0x49fe96[_0xdb8d('0x31')](function(_0x215f70){return{'name':_0x215f70['originalname'],'basename':_0x215f70[_0xdb8d('0x64')],'type':_0x215f70[_0xdb8d('0xcc')],'ChatOfflineMessageId':_0x1f11bd['id']};});}var _0x144eb3;if(!_[_0xdb8d('0x77')](_0x5df82e[_0xdb8d('0xe0')])){var _0x22a8d3=_[_0xdb8d('0x31')](_0x516395['body'],function(_0x2407ed){return _0x2407ed;});var _0x30aeae=_[_0xdb8d('0xe1')](_0x22a8d3)[0x0];var _0x5af3f5=_[_0xdb8d('0xe2')](_0x30aeae,function(_0x4f75f2){return _0x4f75f2;});_0x144eb3=_0x5af3f5[0x1][_0x5df82e[_0xdb8d('0xe0')]];}var _0x42212d={'from':_0x3f0cba['email'],'firstName':_0x3f0cba[_0xdb8d('0x9e')],'lastName':_0x3f0cba['lastName'],'mapKey':'email','message':{'from':_0x3f0cba[_0xdb8d('0xde')],'to':_0x5df82e[_0xdb8d('0xc2')]['email'],'cc':'','subject':_['isNil'](_0x144eb3)?_0x5df82e[_0xdb8d('0xe3')]:_0x144eb3,'messageId':'','sentAt':new Date(),'attach':_0x1dbcb5[_0xdb8d('0x4c')],'attachments':_0x1dbcb5,'originChannel':_0xdb8d('0xe4'),'ChatWebsiteId':_0x5df82e['id'],'ChatOfflineMessageId':_0x428e5d['id'],'originTo':_0x5df82e['MailAccount'][_0xdb8d('0xde')]},'body':_0x428e5d[_0xdb8d('0x4f')]};var _0xf1d617={'account':{'id':_0x5df82e[_0xdb8d('0xdf')]},'body':_0x42212d,'log':_0xdb8d('0xe5')};return respondWithRpcPromise(_0xdb8d('0xe5'),_0xdb8d('0xe6'),_0xf1d617,client9001)[_0xdb8d('0x15')](function(){return _0x428e5d;})[_0xdb8d('0x1e')](function(_0x209fa7){logger['error'](_0x209fa7);});}return;})[_0xdb8d('0x15')](function(){if(_0x428e5d){return _0x428e5d;}})['then'](respondWithResult(_0x555f95,null))['catch'](function(_0x172d52){logger['error'](_0xdb8d('0x1e'),_0x172d52);for(var _0x247205 of _0x49fe96){var _0x337181=path[_0xdb8d('0x71')](config[_0xdb8d('0x6b')],_0xdb8d('0xcd'),_0xdb8d('0xe7'),'attachments','offline-chat',_0x247205[_0xdb8d('0x64')]);fs_extra[_0xdb8d('0xe8')](_0x337181)['catch'](function(_0x231816){logger[_0xdb8d('0x1c')](_0xdb8d('0xe9'),_0x337181,_0x231816);});}});};exports[_0xdb8d('0xea')]=function(_0x4344b2,_0x159a83){return db[_0xdb8d('0xaa')][_0xdb8d('0x53')]({'where':{'id':_0x4344b2['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x159a83,null))[_0xdb8d('0x15')](function(_0x285d3f){if(_0x285d3f){return _0x285d3f[_0xdb8d('0xea')](_0x4344b2[_0xdb8d('0x4f')][_0xdb8d('0x5c')],_[_0xdb8d('0xeb')](_0x4344b2['body'],['ids','id'])||{});}})[_0xdb8d('0x15')](respondWithResult(_0x159a83,null))[_0xdb8d('0x1e')](handleError(_0x159a83,null));};exports[_0xdb8d('0xec')]=function(_0x452f12,_0x3ef640){var _0x2be76c={'raw':![],'where':{}};var _0x2f6d2f={};var _0x1c31df={'count':0x0,'rows':[]};return db[_0xdb8d('0x32')][_0xdb8d('0xd4')]({'where':{'id':_0x452f12['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x3ef640,null))['then'](function(_0x26f57c){if(_0x26f57c){_0x2f6d2f[_0xdb8d('0x3b')]=_[_0xdb8d('0x38')](db['ChatInteraction']['rawAttributes']);_0x2f6d2f[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x452f12[_0xdb8d('0x37')]);_0x2f6d2f[_0xdb8d('0x39')]=_['intersection'](_0x2f6d2f['model'],_0x2f6d2f['query']);_0x2be76c['attributes']=_[_0xdb8d('0x3a')](_0x2f6d2f[_0xdb8d('0x3b')],qs[_0xdb8d('0x3d')](_0x452f12[_0xdb8d('0x37')]['fields']));_0x2be76c[_0xdb8d('0x3c')]=_0x2be76c['attributes'][_0xdb8d('0x4c')]?_0x2be76c[_0xdb8d('0x3c')]:_0x2f6d2f[_0xdb8d('0x3b')];if(!_0x452f12[_0xdb8d('0x37')][_0xdb8d('0x3e')](_0xdb8d('0x3f'))){_0x2be76c[_0xdb8d('0x24')]=qs[_0xdb8d('0x24')](_0x452f12['query']['limit']);_0x2be76c[_0xdb8d('0x22')]=qs[_0xdb8d('0x22')](_0x452f12[_0xdb8d('0x37')][_0xdb8d('0x22')]);}_0x2be76c[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x452f12['query'][_0xdb8d('0x41')]);_0x2be76c[_0xdb8d('0x42')]=qs[_0xdb8d('0x39')](_['pick'](_0x452f12['query'],_0x2f6d2f[_0xdb8d('0x39')]));_0x2be76c[_0xdb8d('0x42')][_0xdb8d('0x57')]=_0x26f57c['id'];if(_0x452f12[_0xdb8d('0x37')][_0xdb8d('0x44')]){_0x2be76c['where']=_[_0xdb8d('0x46')](_0x2be76c['where'],{'$or':_[_0xdb8d('0x31')](_0x2be76c[_0xdb8d('0x3c')],function(_0x3e7262){var _0x4dc6a4={};_0x4dc6a4[_0x3e7262]={'$like':'%'+_0x452f12[_0xdb8d('0x37')]['filter']+'%'};return _0x4dc6a4;})});}_0x2be76c=_[_0xdb8d('0x46')]({},_0x2be76c,_0x452f12['options']);return db['ChatInteraction'][_0xdb8d('0x25')]({'where':_0x2be76c[_0xdb8d('0x42')]})['then'](function(_0x405cc5){_0x1c31df[_0xdb8d('0x25')]=_0x405cc5;if(_0x452f12[_0xdb8d('0x37')]['includeAll']){_0x2be76c[_0xdb8d('0x48')]=[{'model':db[_0xdb8d('0x90')],'as':'Contact','required':![]},{'model':db[_0xdb8d('0xb7')],'as':_0xdb8d('0xed'),'attributes':['name',_0xdb8d('0xee'),_0xdb8d('0xef')],'required':![]},{'model':db['Tag'],'as':_0xdb8d('0xf0'),'attributes':['id',_0xdb8d('0x2d'),'color'],'where':_0x452f12['query'][_0xdb8d('0xf1')]?{'id':_0x452f12[_0xdb8d('0x37')][_0xdb8d('0xf1')]}:undefined,'required':_0x452f12['query'][_0xdb8d('0xf1')]?!![]:![]}];}return db[_0xdb8d('0xaa')][_0xdb8d('0x60')](_0x2be76c);})['then'](function(_0x49c071){_0x1c31df[_0xdb8d('0x5a')]=_0x49c071;return _0x1c31df;});}})[_0xdb8d('0x15')](respondWithFilteredResult(_0x3ef640,_0x2be76c))[_0xdb8d('0x1e')](handleError(_0x3ef640,null));};function iftimePromise(_0x43cdc1,_0x42717f){return respondWithRpcPromise('Command',_0xdb8d('0xf2'),{'command':_0x42717f[_0xdb8d('0xf3')]?util[_0xdb8d('0xa3')](_0xdb8d('0xf4'),_0x43cdc1[_0xdb8d('0xf5')],_0x42717f[_0xdb8d('0xf3')]):util[_0xdb8d('0xa3')]('iftime\x20%s',_0x43cdc1['interval'])},client9002)[_0xdb8d('0x15')](function(_0x4659d3){var _0x89128f=_0x4659d3&&_0x4659d3['indexOf'](_0xdb8d('0xf6'))>=0x0?!![]:![];logger[_0xdb8d('0x16')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x42717f['id'],_0x43cdc1['id'],_0x43cdc1[_0xdb8d('0xf5')],_0x89128f?'ONLINE':'OFFLINE',_0x42717f[_0xdb8d('0xf3')]?_0x42717f[_0xdb8d('0xf3')]:_0xdb8d('0xf7'));return _0x89128f;})[_0xdb8d('0x1e')](function(_0x13960f){logger[_0xdb8d('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x42717f['id'],_0x43cdc1['id'],_0x43cdc1[_0xdb8d('0xf5')],util[_0xdb8d('0xf8')](_0x13960f,{'showHidden':![],'depth':null}),_0x42717f['timezone']?_0x42717f['timezone']:'No\x20timezone');return![];});}exports[_0xdb8d('0xf2')]=function(_0x64b266,_0x180762){var _0x557e94=0x0;var _0x414e61=0x0;var _0x16ace5=![];var _0x2ae5de;var _0xd704fd;return db['ChatWebsite'][_0xdb8d('0x53')]({'where':{'id':_0x64b266[_0xdb8d('0x4a')]['id']},'include':[{'model':db[_0xdb8d('0xf9')],'as':_0xdb8d('0xf9'),'include':[{'model':db[_0xdb8d('0xf9')],'as':'Intervals','attributes':['id',_0xdb8d('0xf5')],'raw':!![]}]}]})[_0xdb8d('0x15')](handleEntityNotFound(_0x180762,null))[_0xdb8d('0x15')](function(_0x2f4707){if(_0x2f4707){_0x2ae5de=_0x2f4707;return _0x2f4707[_0xdb8d('0xfa')]({'raw':!![]});}})[_0xdb8d('0x15')](function(_0x535e00){if(_0x2ae5de){if(_0x535e00){_0xd704fd=_0x535e00;}}return require(_0xdb8d('0x6d'))[_0xdb8d('0x6e')]();})[_0xdb8d('0x15')](function(_0x5c5281){if(_0x5c5281){_0x414e61=_0x5c5281[_0xdb8d('0xfb')];_0x16ace5=_0x5c5281[_0xdb8d('0x6f')];}})[_0xdb8d('0x15')](function(){return db[_0xdb8d('0xaa')][_0xdb8d('0x25')]({'where':{'closed':![]}});})[_0xdb8d('0x15')](function(_0x18afca){_0x557e94=_0x18afca;if(_0x414e61&&_0x18afca>_0x414e61){return db[_0xdb8d('0xfc')]['findOne']({'where':{'id':0x1}})[_0xdb8d('0x15')](function(_0x33900f){if(_0x33900f){_0x33900f[_0xdb8d('0xfd')](_0xdb8d('0xfe'));}});}})['then'](function(){if(_0x2ae5de[_0xdb8d('0xf9')]&&_0x2ae5de[_0xdb8d('0xf9')]['Intervals']){var _0x302b5e=[];for(var _0x45d64c=0x0;_0x45d64c<_0x2ae5de['Interval'][_0xdb8d('0xff')][_0xdb8d('0x4c')];_0x45d64c++){var _0x1a5cc7=_0x2ae5de[_0xdb8d('0xf9')]['Intervals'][_0x45d64c][_0xdb8d('0x2a')]({'plain':!![]});_0x302b5e[_0xdb8d('0xb3')](iftimePromise(_0x1a5cc7,_0x2ae5de));}return BPromise[_0xdb8d('0x100')](_0x302b5e)['then'](function(_0x3a1155){return _[_0xdb8d('0x101')](_0x3a1155);});}else{return!![];}})['then'](function(_0x3d7a36){var _0x99894f=fs[_0xdb8d('0xc4')](path['join'](config[_0xdb8d('0x6b')],_0xdb8d('0x102')),_0xdb8d('0xc6'));var _0x2f06dd={'remote':_0x2ae5de[_0xdb8d('0x103')],'query':querystring[_0xdb8d('0x1b')](_['merge'](_0x2ae5de[_0xdb8d('0x2a')]({'plain':!![]}),{'customerIp':_0x64b266[_0xdb8d('0x9b')][_0xdb8d('0x104')]||_0x64b266['headers']['x-real-ip']||_0x64b266[_0xdb8d('0x105')][_0xdb8d('0x106')]||_0x64b266['ip'],'referer':_0x64b266[_0xdb8d('0x9b')][_0xdb8d('0xa0')],'openedInteractions':_0x557e94,'maxInteractions':_0x414e61,'virtual':_0x16ace5[_0xdb8d('0xfb')],'online':_0x3d7a36,'custom':_0x16ace5}))[_0xdb8d('0x107')](/'/g,'\x5c\x27')};_0x180762[_0xdb8d('0x2e')](ejs[_0xdb8d('0xc7')](Mustache[_0xdb8d('0xc7')](_0x99894f,_0x2f06dd),{'proactiveActions':_0xd704fd,'alignment':_0x2ae5de[_0xdb8d('0x108')],'verticalAlignment':_0x2ae5de[_0xdb8d('0x109')],'div_color':_0x2ae5de[_0xdb8d('0x10a')],'labelText':_0x2ae5de[_0xdb8d('0x10b')],'text_color':_0x2ae5de[_0xdb8d('0x10c')],'text_button_color':_0x2ae5de[_0xdb8d('0x10d')],'button_color':_0x2ae5de[_0xdb8d('0x10e')],'background_color':_0x2ae5de[_0xdb8d('0x10f')],'hideWhenOffline':_0x2ae5de[_0xdb8d('0x110')],'interval':_0x2ae5de['IntervalId']}));})[_0xdb8d('0x1e')](handleError(_0x180762,null));};exports['addApplications']=function(_0x168c55,_0x20c071){var _0x29d70a=_0x168c55[_0xdb8d('0x4a')]['id'];var _0x4d6431=_0x168c55[_0xdb8d('0x4f')];var _0x45ce0f=0xc8;var _0x271986=null;return db[_0xdb8d('0xd1')][_0xdb8d('0xd2')]({'isolationLevel':db[_0xdb8d('0xd1')][_0xdb8d('0x111')][_0xdb8d('0x112')][_0xdb8d('0x113')]},function(_0x5a35e4){return db[_0xdb8d('0x32')][_0xdb8d('0xd4')]({'where':{'id':_0x29d70a},'transaction':_0x5a35e4})[_0xdb8d('0x15')](function(_0x1330ce){if(_0x1330ce){return db[_0xdb8d('0x93')]['destroy']({'where':{'ChatWebsiteId':_0x29d70a},'transaction':_0x5a35e4})[_0xdb8d('0x15')](function(){var _0x469917=_[_0xdb8d('0x31')](_0x4d6431,function(_0x7b2a3){_0x7b2a3[_0xdb8d('0x57')]=_0x29d70a;return _0x7b2a3;});return db[_0xdb8d('0x93')][_0xdb8d('0x114')](_0x469917,{'transaction':_0x5a35e4});});}else{_0x45ce0f=0x194;_0x271986=[];}});})[_0xdb8d('0x15')](function(){if(_0x45ce0f!==0x194){return db[_0xdb8d('0x93')][_0xdb8d('0x115')]({'where':{'ChatWebsiteId':_0x29d70a},'order':'priority'})[_0xdb8d('0x15')](function(_0x38e3e1){_0x271986=_0x38e3e1;});}})[_0xdb8d('0x1e')](function(_0x535dc5){_0x45ce0f=0x1f4;logger['error'](_0x535dc5[_0xdb8d('0x116')]);if(_0x535dc5[_0xdb8d('0x2d')]){delete _0x535dc5[_0xdb8d('0x2d')];}_0x271986=_0x535dc5;})[_0xdb8d('0x117')](function(){if(_0x271986===null){_0x20c071[_0xdb8d('0x1f')](_0x45ce0f);}else{if(_0x45ce0f===0x1f4){_0x20c071[_0xdb8d('0x20')](_0x45ce0f)[_0xdb8d('0x2e')](_0x271986);}else{_0x20c071[_0xdb8d('0x20')](_0x45ce0f)[_0xdb8d('0x28')](_0x271986);}}});};exports[_0xdb8d('0x118')]=function(_0x43ac41,_0x49b13b){var _0x1d5107={};var _0x4cd591={};var _0x37984b;var _0x449d98;return db[_0xdb8d('0x32')][_0xdb8d('0xd4')]({'where':{'id':_0x43ac41['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x49b13b,null))[_0xdb8d('0x15')](function(_0x1e22c1){if(_0x1e22c1){_0x37984b=_0x1e22c1;_0x4cd591[_0xdb8d('0x3b')]=_[_0xdb8d('0x38')](db[_0xdb8d('0x93')][_0xdb8d('0x33')]);_0x4cd591[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x43ac41[_0xdb8d('0x37')]);_0x4cd591[_0xdb8d('0x39')]=_['intersection'](_0x4cd591['model'],_0x4cd591[_0xdb8d('0x37')]);_0x1d5107['attributes']=_[_0xdb8d('0x3a')](_0x4cd591[_0xdb8d('0x3b')],qs[_0xdb8d('0x3d')](_0x43ac41[_0xdb8d('0x37')][_0xdb8d('0x3d')]));_0x1d5107['attributes']=_0x1d5107['attributes'][_0xdb8d('0x4c')]?_0x1d5107[_0xdb8d('0x3c')]:_0x4cd591['model'];_0x1d5107[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x43ac41[_0xdb8d('0x37')][_0xdb8d('0x41')]);_0x1d5107[_0xdb8d('0x42')]=qs['filters'](_['pick'](_0x43ac41['query'],_0x4cd591[_0xdb8d('0x39')]));if(_0x43ac41[_0xdb8d('0x37')]['filter']){_0x1d5107['where']=_[_0xdb8d('0x46')](_0x1d5107['where'],{'$or':_[_0xdb8d('0x31')](_0x1d5107['attributes'],function(_0xa5d8c9){var _0x3fe253={};_0x3fe253[_0xa5d8c9]={'$like':'%'+_0x43ac41['query'][_0xdb8d('0x44')]+'%'};return _0x3fe253;})});}_0x1d5107=_[_0xdb8d('0x46')]({},_0x1d5107,_0x43ac41['options']);return _0x37984b[_0xdb8d('0x118')](_0x1d5107);}})[_0xdb8d('0x15')](function(_0x54ca2f){if(_0x54ca2f){_0x449d98=_0x54ca2f['length'];if(!_0x43ac41[_0xdb8d('0x37')][_0xdb8d('0x3e')]('nolimit')){_0x1d5107[_0xdb8d('0x24')]=qs[_0xdb8d('0x24')](_0x43ac41[_0xdb8d('0x37')][_0xdb8d('0x24')]);_0x1d5107[_0xdb8d('0x22')]=qs[_0xdb8d('0x22')](_0x43ac41['query'][_0xdb8d('0x22')]);}return _0x37984b[_0xdb8d('0x118')](_0x1d5107);}})[_0xdb8d('0x15')](function(_0x174644){if(_0x174644){return _0x174644?{'count':_0x449d98,'rows':_0x174644}:null;}})[_0xdb8d('0x15')](respondWithResult(_0x49b13b,null))[_0xdb8d('0x1e')](handleError(_0x49b13b,null));};exports['addProactiveActions']=function(_0x102407,_0x43f632){return db[_0xdb8d('0x119')][_0xdb8d('0x53')]({'where':{'id':_0x102407['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x43f632,null))['then'](function(_0x39ab90){if(_0x39ab90){return _0x39ab90[_0xdb8d('0x11a')](_0x102407[_0xdb8d('0x4f')]['ids'],_['omit'](_0x102407['body'],[_0xdb8d('0x5c'),'id'])||{});}})[_0xdb8d('0x15')](respondWithResult(_0x43f632,null))['catch'](handleError(_0x43f632,null));};exports[_0xdb8d('0xfa')]=function(_0x24dbad,_0x5d7a6c){var _0x394b1f={};var _0xe61fc7={};var _0x49a96b;var _0xad56b0;return db[_0xdb8d('0x32')][_0xdb8d('0xd4')]({'where':{'id':_0x24dbad['params']['id']}})['then'](handleEntityNotFound(_0x5d7a6c,null))[_0xdb8d('0x15')](function(_0x3c082d){if(_0x3c082d){_0x49a96b=_0x3c082d;_0xe61fc7[_0xdb8d('0x3b')]=_[_0xdb8d('0x38')](db[_0xdb8d('0x11b')]['rawAttributes']);_0xe61fc7['query']=_[_0xdb8d('0x38')](_0x24dbad[_0xdb8d('0x37')]);_0xe61fc7[_0xdb8d('0x39')]=_[_0xdb8d('0x3a')](_0xe61fc7[_0xdb8d('0x3b')],_0xe61fc7['query']);_0x394b1f[_0xdb8d('0x3c')]=_['intersection'](_0xe61fc7[_0xdb8d('0x3b')],qs[_0xdb8d('0x3d')](_0x24dbad['query'][_0xdb8d('0x3d')]));_0x394b1f[_0xdb8d('0x3c')]=_0x394b1f[_0xdb8d('0x3c')]['length']?_0x394b1f[_0xdb8d('0x3c')]:_0xe61fc7[_0xdb8d('0x3b')];_0x394b1f[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x24dbad[_0xdb8d('0x37')][_0xdb8d('0x41')]);_0x394b1f[_0xdb8d('0x42')]=qs[_0xdb8d('0x39')](_[_0xdb8d('0x43')](_0x24dbad[_0xdb8d('0x37')],_0xe61fc7['filters']));if(_0x24dbad[_0xdb8d('0x37')][_0xdb8d('0x44')]){_0x394b1f[_0xdb8d('0x42')]=_[_0xdb8d('0x46')](_0x394b1f[_0xdb8d('0x42')],{'$or':_[_0xdb8d('0x31')](_0x394b1f[_0xdb8d('0x3c')],function(_0x3eb16c){var _0x1604c5={};_0x1604c5[_0x3eb16c]={'$like':'%'+_0x24dbad[_0xdb8d('0x37')][_0xdb8d('0x44')]+'%'};return _0x1604c5;})});}_0x394b1f=_['merge']({},_0x394b1f,_0x24dbad[_0xdb8d('0x4d')]);return _0x49a96b[_0xdb8d('0xfa')](_0x394b1f);}})[_0xdb8d('0x15')](function(_0x229fdf){if(_0x229fdf){_0xad56b0=_0x229fdf['length'];if(!_0x24dbad[_0xdb8d('0x37')]['hasOwnProperty'](_0xdb8d('0x3f'))){_0x394b1f[_0xdb8d('0x24')]=qs[_0xdb8d('0x24')](_0x24dbad['query']['limit']);_0x394b1f['offset']=qs[_0xdb8d('0x22')](_0x24dbad['query']['offset']);}return _0x49a96b[_0xdb8d('0xfa')](_0x394b1f);}})['then'](function(_0x4d003e){if(_0x4d003e){return _0x4d003e?{'count':_0xad56b0,'rows':_0x4d003e}:null;}})[_0xdb8d('0x15')](respondWithResult(_0x5d7a6c,null))[_0xdb8d('0x1e')](handleError(_0x5d7a6c,null));};exports['getFields']=function(_0x223905,_0x5b8b9d){var _0x5b1d50=_0x223905['query']['online']===_0xdb8d('0x11c')?_0xdb8d('0x11d'):_0xdb8d('0x11e');return db['ChatWebsite']['find']({'attributes':['id',_0x5b1d50],'where':{'id':_0x223905[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x5b8b9d,null))[_0xdb8d('0x15')](function(_0x449936){if(_0x449936){var _0x28fcca=_0x449936[_0x5b1d50];var _0x3bd1a1=_0x28fcca&&_0x28fcca[_0xdb8d('0x11f')]?_0x28fcca[_0xdb8d('0x11f')]:[];_0x5b8b9d['send']({'fromKey':_['isNil'](_0x28fcca[_0xdb8d('0x120')])?undefined:_0x28fcca[_0xdb8d('0x120')],'count':_0x3bd1a1[_0xdb8d('0x4c')],'rows':_0x3bd1a1});}})[_0xdb8d('0x1e')](handleError(_0x5b8b9d,null));};exports['getOfflineMessages']=function(_0x280d4c,_0x270ce6){var _0x4fc018={'raw':![],'where':{}};var _0xf66fa7={};var _0x1cb8ed={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdb8d('0xd4')]({'where':{'id':_0x280d4c['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x270ce6,null))['then'](function(_0x2b51bc){if(_0x2b51bc){_0xf66fa7[_0xdb8d('0x3b')]=_[_0xdb8d('0x38')](db[_0xdb8d('0xc9')][_0xdb8d('0x33')]);_0xf66fa7[_0xdb8d('0x37')]=_[_0xdb8d('0x38')](_0x280d4c[_0xdb8d('0x37')]);_0xf66fa7[_0xdb8d('0x39')]=_[_0xdb8d('0x3a')](_0xf66fa7['model'],_0xf66fa7[_0xdb8d('0x37')]);_0x4fc018[_0xdb8d('0x3c')]=_[_0xdb8d('0x3a')](_0xf66fa7[_0xdb8d('0x3b')],qs[_0xdb8d('0x3d')](_0x280d4c[_0xdb8d('0x37')][_0xdb8d('0x3d')]));_0x4fc018['attributes']=_0x4fc018[_0xdb8d('0x3c')][_0xdb8d('0x4c')]?_0x4fc018[_0xdb8d('0x3c')]:_0xf66fa7['model'];if(!_0x280d4c[_0xdb8d('0x37')][_0xdb8d('0x3e')]('nolimit')){_0x4fc018[_0xdb8d('0x24')]=qs[_0xdb8d('0x24')](_0x280d4c[_0xdb8d('0x37')]['limit']);_0x4fc018['offset']=qs[_0xdb8d('0x22')](_0x280d4c[_0xdb8d('0x37')][_0xdb8d('0x22')]);}_0x4fc018[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x280d4c[_0xdb8d('0x37')][_0xdb8d('0x41')]);_0x4fc018[_0xdb8d('0x42')]=qs['filters'](_['pick'](_0x280d4c[_0xdb8d('0x37')],_0xf66fa7['filters']));_0x4fc018['where'][_0xdb8d('0x57')]=_0x2b51bc['id'];if(_0x280d4c['query'][_0xdb8d('0x44')]){_0x4fc018['where']=_[_0xdb8d('0x46')](_0x4fc018[_0xdb8d('0x42')],{'$or':_[_0xdb8d('0x31')](_0x4fc018[_0xdb8d('0x3c')],function(_0x4bd9ab){var _0x246b85={};_0x246b85[_0x4bd9ab]={'$like':'%'+_0x280d4c[_0xdb8d('0x37')][_0xdb8d('0x44')]+'%'};return _0x246b85;})});}_0x4fc018=_['merge']({},_0x4fc018,_0x280d4c[_0xdb8d('0x4d')]);return db[_0xdb8d('0xc9')]['count']({'where':_0x4fc018[_0xdb8d('0x42')]})[_0xdb8d('0x15')](function(_0x4884e1){_0x1cb8ed[_0xdb8d('0x25')]=_0x4884e1;if(_0x280d4c['query'][_0xdb8d('0x47')]){_0x4fc018[_0xdb8d('0x48')]=[{'all':!![]}];}else{_0x4fc018[_0xdb8d('0x48')]=[{'model':db[_0xdb8d('0x90')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xdb8d('0xc9')]['findAll'](_0x4fc018);})[_0xdb8d('0x15')](function(_0x5a69e2){_0x1cb8ed[_0xdb8d('0x5a')]=_0x5a69e2;return _0x1cb8ed;});}})[_0xdb8d('0x15')](respondWithFilteredResult(_0x270ce6,_0x4fc018))['catch'](handleError(_0x270ce6,null));};exports['addAgents']=function(_0x8fe0bc,_0x2bb03b){return db[_0xdb8d('0x32')][_0xdb8d('0x53')]({'where':{'id':_0x8fe0bc[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x2bb03b,null))[_0xdb8d('0x15')](function(_0x5f0608){if(_0x5f0608){return _0x5f0608['addAgents'](_0x8fe0bc[_0xdb8d('0x4f')][_0xdb8d('0x5c')],_['omit'](_0x8fe0bc[_0xdb8d('0x4f')],[_0xdb8d('0x5c'),'id'])||{})[_0xdb8d('0xae')](function(_0x4be144){for(var _0x4d395a=0x0;_0x4d395a<_0x8fe0bc[_0xdb8d('0x4f')][_0xdb8d('0x5c')][_0xdb8d('0x4c')];_0x4d395a+=0x1){socket[_0xdb8d('0x121')](_0xdb8d('0x122'),{'UserId':Number(_0x8fe0bc[_0xdb8d('0x4f')]['ids'][_0x4d395a]),'ChatWebsiteId':Number(_0x8fe0bc['params']['id'])});}return _0x4be144;});}})['then'](respondWithResult(_0x2bb03b,null))[_0xdb8d('0x1e')](handleError(_0x2bb03b,null));};exports[_0xdb8d('0x123')]=function(_0x47779e,_0x464dca){return db[_0xdb8d('0x32')][_0xdb8d('0x53')]({'where':{'id':_0x47779e['params']['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x464dca,null))[_0xdb8d('0x15')](function(_0x22014b){if(_0x22014b){return _0x22014b[_0xdb8d('0x123')](_0x47779e[_0xdb8d('0x37')][_0xdb8d('0x5c')])[_0xdb8d('0x15')](function(){if(_['isArray'](_0x47779e[_0xdb8d('0x37')][_0xdb8d('0x5c')])){for(var _0x2ff556=0x0;_0x2ff556<_0x47779e[_0xdb8d('0x37')][_0xdb8d('0x5c')]['length'];_0x2ff556+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x47779e['query'][_0xdb8d('0x5c')][_0x2ff556]),'ChatWebsiteId':Number(_0x47779e[_0xdb8d('0x4a')]['id'])});}}else{socket[_0xdb8d('0x121')](_0xdb8d('0x124'),{'UserId':Number(_0x47779e[_0xdb8d('0x37')][_0xdb8d('0x5c')]),'ChatWebsiteId':Number(_0x47779e[_0xdb8d('0x4a')]['id'])});}});}})[_0xdb8d('0x15')](respondWithStatusCode(_0x464dca,null))[_0xdb8d('0x1e')](handleError(_0x464dca,null));};exports[_0xdb8d('0x125')]=function(_0x208330,_0x57818a){var _0x410b45={};var _0x27519c={};var _0x3ed102;var _0x263bca;return db[_0xdb8d('0x32')][_0xdb8d('0xd4')]({'where':{'id':_0x208330[_0xdb8d('0x4a')]['id']}})[_0xdb8d('0x15')](handleEntityNotFound(_0x57818a,null))[_0xdb8d('0x15')](function(_0x55f3cf){if(_0x55f3cf){_0x3ed102=_0x55f3cf;_0x27519c[_0xdb8d('0x3b')]=_['keys'](db['User']['rawAttributes']);_0x27519c['query']=_[_0xdb8d('0x38')](_0x208330[_0xdb8d('0x37')]);_0x27519c[_0xdb8d('0x39')]=_[_0xdb8d('0x3a')](_0x27519c[_0xdb8d('0x3b')],_0x27519c[_0xdb8d('0x37')]);_0x410b45[_0xdb8d('0x3c')]=_[_0xdb8d('0x3a')](_0x27519c[_0xdb8d('0x3b')],qs[_0xdb8d('0x3d')](_0x208330[_0xdb8d('0x37')][_0xdb8d('0x3d')]));_0x410b45[_0xdb8d('0x3c')]=_0x410b45[_0xdb8d('0x3c')][_0xdb8d('0x4c')]?_0x410b45[_0xdb8d('0x3c')]:_0x27519c[_0xdb8d('0x3b')];_0x410b45[_0xdb8d('0x40')]=qs[_0xdb8d('0x41')](_0x208330[_0xdb8d('0x37')][_0xdb8d('0x41')]);_0x410b45[_0xdb8d('0x42')]=qs[_0xdb8d('0x39')](_['pick'](_0x208330['query'],_0x27519c['filters']));if(_0x208330[_0xdb8d('0x37')][_0xdb8d('0x44')]){_0x410b45[_0xdb8d('0x42')]=_[_0xdb8d('0x46')](_0x410b45['where'],{'$or':_[_0xdb8d('0x31')](_0x410b45[_0xdb8d('0x3c')],function(_0x57baef){var _0x1bb822={};_0x1bb822[_0x57baef]={'$like':'%'+_0x208330['query'][_0xdb8d('0x44')]+'%'};return _0x1bb822;})});}_0x410b45=_[_0xdb8d('0x46')]({},_0x410b45,_0x208330[_0xdb8d('0x4d')]);return _0x3ed102[_0xdb8d('0x125')](_0x410b45);}})[_0xdb8d('0x15')](function(_0x4b8af9){if(_0x4b8af9){_0x263bca=_0x4b8af9[_0xdb8d('0x4c')];if(!_0x208330[_0xdb8d('0x37')][_0xdb8d('0x3e')](_0xdb8d('0x3f'))){_0x410b45[_0xdb8d('0x24')]=qs[_0xdb8d('0x24')](_0x208330['query'][_0xdb8d('0x24')]);_0x410b45[_0xdb8d('0x22')]=qs[_0xdb8d('0x22')](_0x208330[_0xdb8d('0x37')][_0xdb8d('0x22')]);}return _0x3ed102[_0xdb8d('0x125')](_0x410b45);}})[_0xdb8d('0x15')](function(_0x257ea9){if(_0x257ea9){return _0x257ea9?{'count':_0x263bca,'rows':_0x257ea9}:null;}})[_0xdb8d('0x15')](respondWithResult(_0x57818a,null))[_0xdb8d('0x1e')](handleError(_0x57818a,null));}; \ No newline at end of file +var _0xe22c=['http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','join','server/files/images/logos/','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','customerAvatar','showCustomerAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','mapKey','includes','CmList','List','Contacts','ChatApplication','account','Applications','list','applications','orderBy','priority','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','labelText','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','removeAgents','emit','userChatWebsite:remove','User','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client'];(function(_0x169b61,_0x1ce5d1){var _0x1df30b=function(_0x3ff914){while(--_0x3ff914){_0x169b61['push'](_0x169b61['shift']());}};_0x1df30b(++_0x1ce5d1);}(_0xe22c,0x116));var _0xce22=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe22c[_0x59ee6f];return _0x4c0979;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xce22('0x0'));var util=require(_0xce22('0x1'));var path=require(_0xce22('0x2'));var ejs=require(_0xce22('0x3'));var fs=require('fs');var fs_extra=require(_0xce22('0x4'));var _=require(_0xce22('0x5'));var querystring=require(_0xce22('0x6'));var Redis=require(_0xce22('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xce22('0x8'))(_0xce22('0x9'));var config=require(_0xce22('0xa'));var db=require(_0xce22('0xb'))['db'];config[_0xce22('0xc')]=_[_0xce22('0xd')](config[_0xce22('0xc')],{'host':_0xce22('0xe'),'port':0x18eb});var socket=require(_0xce22('0xf'))(new Redis(config[_0xce22('0xc')]));require('./chatWebsite.socket')['register'](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0xce22('0x10')][_0xce22('0x11')]({'port':0x232c});var client9002=jayson[_0xce22('0x10')][_0xce22('0x11')]({'port':0x232a});var client9003=jayson['client'][_0xce22('0x11')]({'port':0x232b});var client9001=jayson[_0xce22('0x10')][_0xce22('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x33a6e5,_0x524cca,_0x53f6fe,_0xeecf93){return new BPromise(function(_0x1857e6,_0x122cbe){var _0x27896f=_0xeecf93||client;return _0x27896f['request'](_0x33a6e5,_0x53f6fe)[_0xce22('0x12')](function(_0x57a1ee){logger[_0xce22('0x13')](_0xce22('0x14'),_0x524cca,_0xce22('0x15'));logger[_0xce22('0x16')](_0xce22('0x17'),_0x524cca,_0xce22('0x15'),JSON['stringify'](_0x57a1ee));if(_0x57a1ee[_0xce22('0x18')]){if(_0x57a1ee['error'][_0xce22('0x19')]===0x1f4){logger[_0xce22('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x524cca,_0x57a1ee[_0xce22('0x18')][_0xce22('0x1a')]);return _0x122cbe(_0x57a1ee[_0xce22('0x18')]['message']);}logger[_0xce22('0x18')](_0xce22('0x14'),_0x524cca,_0x57a1ee['error'][_0xce22('0x1a')]);return _0x1857e6(_0x57a1ee['error'][_0xce22('0x1a')]);}else{logger[_0xce22('0x13')](_0xce22('0x14'),_0x524cca,'request\x20sent');_0x1857e6(_0x57a1ee['result'][_0xce22('0x1a')]);}})[_0xce22('0x1b')](function(_0x32f00f){logger[_0xce22('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x524cca,_0x32f00f);_0x122cbe(_0x32f00f);});});}function respondWithStatusCode(_0x535156,_0x4d8050){_0x4d8050=_0x4d8050||0xcc;return function(_0x2db80f){if(_0x2db80f){return _0x535156[_0xce22('0x1c')](_0x4d8050);}return _0x535156[_0xce22('0x1d')](_0x4d8050)[_0xce22('0x1e')]();};}function respondWithResult(_0x1d2b56,_0x57f9d){_0x57f9d=_0x57f9d||0xc8;return function(_0x5594b4){if(_0x5594b4){return _0x1d2b56[_0xce22('0x1d')](_0x57f9d)[_0xce22('0x1f')](_0x5594b4);}};}function respondWithFilteredResult(_0x460863,_0x1775a8){return function(_0x15b577){if(_0x15b577){var _0x2c9f5a=typeof _0x1775a8['offset']===_0xce22('0x20')&&typeof _0x1775a8[_0xce22('0x21')]==='undefined';var _0x5a1c56=_0x15b577['count'];var _0x9b74b6=_0x2c9f5a?0x0:_0x1775a8[_0xce22('0x22')];var _0x4f273f=_0x2c9f5a?_0x15b577[_0xce22('0x23')]:_0x1775a8[_0xce22('0x22')]+_0x1775a8[_0xce22('0x21')];var _0x20455f;if(_0x4f273f>=_0x5a1c56){_0x4f273f=_0x5a1c56;_0x20455f=0xc8;}else{_0x20455f=0xce;}_0x460863['status'](_0x20455f);return _0x460863[_0xce22('0x24')](_0xce22('0x25'),_0x9b74b6+'-'+_0x4f273f+'/'+_0x5a1c56)[_0xce22('0x1f')](_0x15b577);}return null;};}function saveUpdates(_0x142e1d){return function(_0x5ed74a){if(_0x5ed74a){return _0x5ed74a[_0xce22('0x26')](_0x142e1d)[_0xce22('0x12')](function(_0x284552){return _0x284552;});}return null;};}function removeEntity(_0x11dbba){return function(_0x44f5e6){if(_0x44f5e6){return _0x44f5e6['destroy']()[_0xce22('0x12')](function(){var _0x33dcef=_0x44f5e6[_0xce22('0x27')]({'plain':!![]});var _0x805a1c=_0xce22('0x28');return db[_0xce22('0x29')][_0xce22('0x2a')]({'where':{'type':_0x805a1c,'resourceId':_0x33dcef['id']}})[_0xce22('0x12')](function(){return _0x44f5e6;});})[_0xce22('0x12')](function(){_0x11dbba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a055e){return function(_0x19f19f){if(!_0x19f19f){_0x4a055e['sendStatus'](0x194);}return _0x19f19f;};}function handleError(_0x2da66d,_0x320862){_0x320862=_0x320862||0x1f4;return function(_0x1d09a1){logger[_0xce22('0x18')](_0x1d09a1[_0xce22('0x2b')]);if(_0x1d09a1[_0xce22('0x2c')]){delete _0x1d09a1[_0xce22('0x2c')];}_0x2da66d[_0xce22('0x1d')](_0x320862)[_0xce22('0x2d')](_0x1d09a1);};}exports[_0xce22('0x2e')]=function(_0x27df23,_0x1208d3){var _0x4c324d={'include':[{'model':db[_0xce22('0x2f')],'as':'mandatoryDispositionPause'}]},_0x536ec8={},_0x3b861a={'count':0x0,'rows':[]};var _0x44e26c=_[_0xce22('0x30')](db[_0xce22('0x31')][_0xce22('0x32')],function(_0x14a43e){return{'name':_0x14a43e[_0xce22('0x33')],'type':_0x14a43e['type'][_0xce22('0x34')]};});_0x536ec8[_0xce22('0x35')]=_['map'](_0x44e26c,_0xce22('0x2c'));_0x536ec8[_0xce22('0x36')]=_[_0xce22('0x37')](_0x27df23['query']);_0x536ec8[_0xce22('0x38')]=_[_0xce22('0x39')](_0x536ec8[_0xce22('0x35')],_0x536ec8[_0xce22('0x36')]);_0x4c324d[_0xce22('0x3a')]=_[_0xce22('0x39')](_0x536ec8[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x27df23[_0xce22('0x36')][_0xce22('0x3b')]));_0x4c324d[_0xce22('0x3a')]=_0x4c324d['attributes'][_0xce22('0x3c')]?_0x4c324d[_0xce22('0x3a')]:_0x536ec8[_0xce22('0x35')];if(!_0x27df23[_0xce22('0x36')][_0xce22('0x3d')](_0xce22('0x3e'))){_0x4c324d['limit']=qs[_0xce22('0x21')](_0x27df23['query'][_0xce22('0x21')]);_0x4c324d[_0xce22('0x22')]=qs[_0xce22('0x22')](_0x27df23[_0xce22('0x36')][_0xce22('0x22')]);}_0x4c324d[_0xce22('0x3f')]=qs['sort'](_0x27df23[_0xce22('0x36')][_0xce22('0x40')]);_0x4c324d[_0xce22('0x41')]=qs[_0xce22('0x38')](_[_0xce22('0x42')](_0x27df23[_0xce22('0x36')],_0x536ec8[_0xce22('0x38')]),_0x44e26c);if(_0x27df23[_0xce22('0x36')][_0xce22('0x43')]){_0x4c324d[_0xce22('0x41')]=_[_0xce22('0x44')](_0x4c324d[_0xce22('0x41')],{'$or':_[_0xce22('0x30')](_0x44e26c,function(_0xcf01e3){if(_0xcf01e3[_0xce22('0x45')]!=='VIRTUAL'){var _0x42c183={};_0x42c183[_0xcf01e3['name']]={'$like':'%'+_0x27df23[_0xce22('0x36')][_0xce22('0x43')]+'%'};return _0x42c183;}})});}_0x4c324d=_[_0xce22('0x44')]({},_0x4c324d,_0x27df23[_0xce22('0x46')]);var _0x364d47={'where':_0x4c324d[_0xce22('0x41')]};return db['ChatWebsite'][_0xce22('0x23')](_0x364d47)[_0xce22('0x12')](function(_0xb07536){_0x3b861a['count']=_0xb07536;if(_0x27df23[_0xce22('0x36')][_0xce22('0x47')]){_0x4c324d['include']=[{'all':!![]}];}return db[_0xce22('0x31')][_0xce22('0x48')](_0x4c324d);})[_0xce22('0x12')](function(_0x150dd3){_0x3b861a[_0xce22('0x49')]=_0x150dd3;return _0x3b861a;})[_0xce22('0x12')](respondWithFilteredResult(_0x1208d3,_0x4c324d))[_0xce22('0x1b')](handleError(_0x1208d3,null));};exports[_0xce22('0x4a')]=function(_0x392663,_0x949849){var _0x1f9155={'raw':![],'where':{'id':_0x392663[_0xce22('0x4b')]['id']},'include':[{'model':db[_0xce22('0x2f')],'as':_0xce22('0x4c')}]},_0x1650ce={};_0x1650ce['model']=_[_0xce22('0x37')](db[_0xce22('0x31')][_0xce22('0x32')]);_0x1650ce[_0xce22('0x36')]=_[_0xce22('0x37')](_0x392663['query']);_0x1650ce[_0xce22('0x38')]=_[_0xce22('0x39')](_0x1650ce[_0xce22('0x35')],_0x1650ce[_0xce22('0x36')]);_0x1f9155['attributes']=_[_0xce22('0x39')](_0x1650ce[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x392663['query'][_0xce22('0x3b')]));_0x1f9155['attributes']=_0x1f9155[_0xce22('0x3a')][_0xce22('0x3c')]?_0x1f9155['attributes']:_0x1650ce[_0xce22('0x35')];if(_0x392663[_0xce22('0x36')][_0xce22('0x47')]){_0x1f9155[_0xce22('0x4d')]=[{'all':!![]}];}_0x1f9155=_[_0xce22('0x44')]({},_0x1f9155,_0x392663[_0xce22('0x46')]);return db['ChatWebsite']['find'](_0x1f9155)['then'](handleEntityNotFound(_0x949849,null))[_0xce22('0x12')](respondWithResult(_0x949849,null))['catch'](handleError(_0x949849,null));};exports[_0xce22('0x4e')]=function(_0xe7cab6,_0x3d37cd){return db[_0xce22('0x31')]['create'](_0xe7cab6[_0xce22('0x4f')],{})[_0xce22('0x12')](function(_0x407793){var _0x45e094=_0xe7cab6[_0xce22('0x50')][_0xce22('0x27')]({'plain':!![]});if(!_0x45e094)throw new Error(_0xce22('0x51'));if(_0x45e094['role']===_0xce22('0x50')){var _0x2aaea1=_0x407793['get']({'plain':!![]});var _0x322ae2=_0xce22('0x28');return db[_0xce22('0x52')][_0xce22('0x53')]({'where':{'name':_0x322ae2,'userProfileId':_0x45e094[_0xce22('0x54')]},'raw':!![]})[_0xce22('0x12')](function(_0x2482ed){if(_0x2482ed&&_0x2482ed[_0xce22('0x55')]===0x0){return db[_0xce22('0x29')]['create']({'name':_0x2aaea1[_0xce22('0x2c')],'resourceId':_0x2aaea1['id'],'type':_0x2482ed[_0xce22('0x2c')],'sectionId':_0x2482ed['id']},{})[_0xce22('0x12')](function(){return _0x407793;});}else{return _0x407793;}})[_0xce22('0x1b')](function(_0x1e3ad2){logger[_0xce22('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e3ad2);throw _0x1e3ad2;});}return _0x407793;})[_0xce22('0x12')](respondWithResult(_0x3d37cd,0xc9))[_0xce22('0x1b')](handleError(_0x3d37cd,null));};exports[_0xce22('0x26')]=function(_0x5ab1c5,_0x11af11){if(_0x5ab1c5[_0xce22('0x4f')]['id']){delete _0x5ab1c5[_0xce22('0x4f')]['id'];}return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x5ab1c5['params']['id']},'include':[{'model':db['Pause'],'as':_0xce22('0x4c')}]})[_0xce22('0x12')](handleEntityNotFound(_0x11af11,null))[_0xce22('0x12')](saveUpdates(_0x5ab1c5['body'],null))[_0xce22('0x12')](respondWithResult(_0x11af11,null))[_0xce22('0x1b')](handleError(_0x11af11,null));};exports['destroy']=function(_0x1a0244,_0x437c05){return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x1a0244[_0xce22('0x4b')]['id']}})['then'](handleEntityNotFound(_0x437c05,null))['then'](removeEntity(_0x437c05,null))['catch'](handleError(_0x437c05,null));};exports['describe']=function(_0x91b420,_0x56fbb1){return db[_0xce22('0x31')][_0xce22('0x56')]()[_0xce22('0x12')](respondWithResult(_0x56fbb1,null))['catch'](handleError(_0x56fbb1,null));};exports[_0xce22('0x57')]=function(_0x240b6d,_0x9ef03b){if(_0x240b6d[_0xce22('0x4f')]['id']){delete _0x240b6d[_0xce22('0x4f')]['id'];}return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x240b6d['params']['id']}})['then'](handleEntityNotFound(_0x9ef03b,null))[_0xce22('0x12')](function(_0x3aee52){if(_0x3aee52){_0x240b6d[_0xce22('0x4f')][_0xce22('0x58')]=_0x3aee52['id'];return db[_0xce22('0x59')][_0xce22('0x4e')](_0x240b6d[_0xce22('0x4f')]);}})[_0xce22('0x12')](respondWithResult(_0x9ef03b,null))['catch'](handleError(_0x9ef03b,null));};exports[_0xce22('0x5a')]=function(_0x3ba6e5,_0x363f1a){var _0x292605={'raw':![],'where':{}};var _0x7abb91={};var _0xf9fc76={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xce22('0x5b')]({'where':{'id':_0x3ba6e5['params']['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x363f1a,null))[_0xce22('0x12')](function(_0x35d1a2){if(_0x35d1a2){_0x7abb91['model']=_[_0xce22('0x37')](db[_0xce22('0x59')][_0xce22('0x32')]);_0x7abb91[_0xce22('0x36')]=_[_0xce22('0x37')](_0x3ba6e5['query']);_0x7abb91[_0xce22('0x38')]=_[_0xce22('0x39')](_0x7abb91[_0xce22('0x35')],_0x7abb91['query']);_0x292605[_0xce22('0x3a')]=_['intersection'](_0x7abb91[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x3ba6e5[_0xce22('0x36')][_0xce22('0x3b')]));_0x292605[_0xce22('0x3a')]=_0x292605[_0xce22('0x3a')][_0xce22('0x3c')]?_0x292605[_0xce22('0x3a')]:_0x7abb91[_0xce22('0x35')];if(!_0x3ba6e5[_0xce22('0x36')][_0xce22('0x3d')](_0xce22('0x3e'))){_0x292605[_0xce22('0x21')]=qs[_0xce22('0x21')](_0x3ba6e5[_0xce22('0x36')][_0xce22('0x21')]);_0x292605[_0xce22('0x22')]=qs['offset'](_0x3ba6e5[_0xce22('0x36')][_0xce22('0x22')]);}_0x292605[_0xce22('0x3f')]=qs[_0xce22('0x40')](_0x3ba6e5[_0xce22('0x36')]['sort']);_0x292605['where']=qs[_0xce22('0x38')](_[_0xce22('0x42')](_0x3ba6e5[_0xce22('0x36')],_0x7abb91[_0xce22('0x38')]));_0x292605[_0xce22('0x41')][_0xce22('0x58')]=_0x35d1a2['id'];if(_0x3ba6e5[_0xce22('0x36')][_0xce22('0x43')]){_0x292605['where']=_[_0xce22('0x44')](_0x292605[_0xce22('0x41')],{'$or':_[_0xce22('0x30')](_0x292605[_0xce22('0x3a')],function(_0x48ad92){var _0x4e0758={};_0x4e0758[_0x48ad92]={'$like':'%'+_0x3ba6e5[_0xce22('0x36')][_0xce22('0x43')]+'%'};return _0x4e0758;})});}_0x292605=_[_0xce22('0x44')]({},_0x292605,_0x3ba6e5[_0xce22('0x46')]);return db[_0xce22('0x59')]['count']({'where':_0x292605[_0xce22('0x41')]})[_0xce22('0x12')](function(_0x3de9d4){_0xf9fc76[_0xce22('0x23')]=_0x3de9d4;if(_0x3ba6e5['query'][_0xce22('0x47')]){_0x292605[_0xce22('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x292605);})['then'](function(_0x165762){_0xf9fc76[_0xce22('0x49')]=_0x165762;return _0xf9fc76;});}})[_0xce22('0x12')](respondWithFilteredResult(_0x363f1a,_0x292605))[_0xce22('0x1b')](handleError(_0x363f1a,null));};exports['removeDispositions']=function(_0x30bf50,_0x37d4ca){return db['ChatWebsite'][_0xce22('0x53')]({'where':{'id':_0x30bf50[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x37d4ca,null))[_0xce22('0x12')](function(_0x27917c){if(_0x27917c){return _0x27917c[_0xce22('0x5c')](_0x30bf50[_0xce22('0x36')][_0xce22('0x5d')]);}})[_0xce22('0x12')](respondWithStatusCode(_0x37d4ca,null))[_0xce22('0x1b')](handleError(_0x37d4ca,null));};exports['addAnswer']=function(_0x1214b1,_0xabda19){if(_0x1214b1[_0xce22('0x4f')]['id']){delete _0x1214b1['body']['id'];}return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x1214b1['params']['id']}})[_0xce22('0x12')](handleEntityNotFound(_0xabda19,null))[_0xce22('0x12')](function(_0xa63137){if(_0xa63137){_0x1214b1[_0xce22('0x4f')]['ChatWebsiteId']=_0xa63137['id'];return db[_0xce22('0x5e')][_0xce22('0x4e')](_0x1214b1[_0xce22('0x4f')]);}})[_0xce22('0x12')](respondWithResult(_0xabda19,null))[_0xce22('0x1b')](handleError(_0xabda19,null));};exports[_0xce22('0x5f')]=function(_0x5eedff,_0x3a644b){var _0x35fed2={'raw':![],'where':{}};var _0x4d1bd6={};var _0x2872c0={'count':0x0,'rows':[]};return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0x5eedff[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x3a644b,null))[_0xce22('0x12')](function(_0x1473ee){if(_0x1473ee){_0x4d1bd6[_0xce22('0x35')]=_[_0xce22('0x37')](db['CannedAnswer']['rawAttributes']);_0x4d1bd6[_0xce22('0x36')]=_['keys'](_0x5eedff[_0xce22('0x36')]);_0x4d1bd6['filters']=_['intersection'](_0x4d1bd6[_0xce22('0x35')],_0x4d1bd6['query']);_0x35fed2[_0xce22('0x3a')]=_[_0xce22('0x39')](_0x4d1bd6[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x5eedff[_0xce22('0x36')]['fields']));_0x35fed2[_0xce22('0x3a')]=_0x35fed2[_0xce22('0x3a')]['length']?_0x35fed2[_0xce22('0x3a')]:_0x4d1bd6[_0xce22('0x35')];if(!_0x5eedff[_0xce22('0x36')]['hasOwnProperty'](_0xce22('0x3e'))){_0x35fed2[_0xce22('0x21')]=qs[_0xce22('0x21')](_0x5eedff['query'][_0xce22('0x21')]);_0x35fed2['offset']=qs[_0xce22('0x22')](_0x5eedff[_0xce22('0x36')][_0xce22('0x22')]);}_0x35fed2[_0xce22('0x3f')]=qs[_0xce22('0x40')](_0x5eedff[_0xce22('0x36')][_0xce22('0x40')]);_0x35fed2[_0xce22('0x41')]=qs[_0xce22('0x38')](_['pick'](_0x5eedff[_0xce22('0x36')],_0x4d1bd6[_0xce22('0x38')]));_0x35fed2[_0xce22('0x41')][_0xce22('0x58')]=_0x1473ee['id'];if(_0x5eedff[_0xce22('0x36')][_0xce22('0x43')]){_0x35fed2[_0xce22('0x41')]=_[_0xce22('0x44')](_0x35fed2['where'],{'$or':_[_0xce22('0x30')](_0x35fed2[_0xce22('0x3a')],function(_0x5a5db2){var _0x524ae8={};_0x524ae8[_0x5a5db2]={'$like':'%'+_0x5eedff[_0xce22('0x36')][_0xce22('0x43')]+'%'};return _0x524ae8;})});}_0x35fed2=_[_0xce22('0x44')]({},_0x35fed2,_0x5eedff[_0xce22('0x46')]);return db['CannedAnswer'][_0xce22('0x23')]({'where':_0x35fed2[_0xce22('0x41')]})[_0xce22('0x12')](function(_0x2d0884){_0x2872c0[_0xce22('0x23')]=_0x2d0884;if(_0x5eedff[_0xce22('0x36')][_0xce22('0x47')]){_0x35fed2[_0xce22('0x4d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xce22('0x48')](_0x35fed2);})['then'](function(_0x5283fe){_0x2872c0[_0xce22('0x49')]=_0x5283fe;return _0x2872c0;});}})[_0xce22('0x12')](respondWithFilteredResult(_0x3a644b,_0x35fed2))['catch'](handleError(_0x3a644b,null));};exports[_0xce22('0x60')]=function(_0x5168b9,_0x2d5098){return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x5168b9[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x2d5098,null))[_0xce22('0x12')](function(_0x395954){if(_0x395954){return _0x395954[_0xce22('0x60')](_0x5168b9[_0xce22('0x36')][_0xce22('0x5d')]);}})['then'](respondWithStatusCode(_0x2d5098,null))[_0xce22('0x1b')](handleError(_0x2d5098,null));};exports[_0xce22('0x61')]=function(_0x9e22e,_0x435c90){_0x9e22e[_0xce22('0x4f')][_0xce22('0x62')]=_0x9e22e[_0xce22('0x63')][_0xce22('0x64')];return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x9e22e[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x435c90,null))[_0xce22('0x12')](saveUpdates(_0x9e22e[_0xce22('0x4f')],null))[_0xce22('0x12')](respondWithResult(_0x435c90,null))[_0xce22('0x1b')](handleError(_0x435c90,null));};exports['addAvatar']=function(_0x4fe4c2,_0x243e3d){_0x4fe4c2[_0xce22('0x4f')][_0xce22('0x65')]=_0x4fe4c2[_0xce22('0x63')][_0xce22('0x64')];return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x4fe4c2['params']['id']}})['then'](handleEntityNotFound(_0x243e3d,null))['then'](saveUpdates(_0x4fe4c2[_0xce22('0x4f')],null))[_0xce22('0x12')](respondWithResult(_0x243e3d,null))[_0xce22('0x1b')](handleError(_0x243e3d,null));};exports[_0xce22('0x66')]=function(_0x387017,_0x40cb76){_0x387017[_0xce22('0x4f')]['customerAvatar']=_0x387017['file'][_0xce22('0x64')];return db['ChatWebsite'][_0xce22('0x53')]({'where':{'id':_0x387017[_0xce22('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40cb76,null))[_0xce22('0x12')](saveUpdates(_0x387017[_0xce22('0x4f')],null))[_0xce22('0x12')](respondWithResult(_0x40cb76,null))[_0xce22('0x1b')](handleError(_0x40cb76,null));};exports[_0xce22('0x67')]=function(_0x5315a8,_0x1dd602){_0x5315a8[_0xce22('0x4f')][_0xce22('0x68')]=_0x5315a8['file'][_0xce22('0x64')];return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x5315a8[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x1dd602,null))[_0xce22('0x12')](saveUpdates(_0x5315a8[_0xce22('0x4f')],null))[_0xce22('0x12')](respondWithResult(_0x1dd602,null))['catch'](handleError(_0x1dd602,null));};exports[_0xce22('0x69')]=function(_0x2c5370,_0x279f51){var _0x38839f=path['join'](config[_0xce22('0x6a')],_0xce22('0x6b'));var _0x2fef28={'where':{'id':_0x2c5370[_0xce22('0x4b')]['id']},'attributes':['id',_0xce22('0x62')],'raw':!![]};var _0x20bbf7=![];return require(_0xce22('0x6c'))[_0xce22('0x6d')]()[_0xce22('0x12')](function(_0x4b782b){if(_0x4b782b){_0x20bbf7=_0x4b782b['custom'];}})[_0xce22('0x12')](function(){return db[_0xce22('0x31')][_0xce22('0x53')](_0x2fef28);})['then'](handleEntityNotFound(_0x279f51,null))[_0xce22('0x12')](function(_0x5be468){if(_0x5be468){if(!_['isNil'](_0x5be468['sitepic'])){if(fs[_0xce22('0x6e')](path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x70'),_0x5be468[_0xce22('0x62')]))&&_0x20bbf7){_0x38839f=path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x70'),_0x5be468['sitepic']);}}return _0x279f51['download'](_0x38839f);}})[_0xce22('0x1b')](handleError(_0x279f51,null));};exports['getAvatar']=function(_0x584481,_0x25525b){var _0x136f4e=path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x71'));var _0x416901={'where':{'id':_0x584481[_0xce22('0x4b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xce22('0x31')][_0xce22('0x53')](_0x416901)[_0xce22('0x12')](handleEntityNotFound(_0x25525b,null))[_0xce22('0x12')](function(_0x4d9a0e){if(_0x4d9a0e){if(!_[_0xce22('0x72')](_0x4d9a0e['agentAvatar'])){if(fs[_0xce22('0x6e')](path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x73'),_0x4d9a0e['agentAvatar']))){_0x136f4e=path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x73'),_0x4d9a0e['agentAvatar']);}}return _0x25525b[_0xce22('0x74')](_0x136f4e);}})[_0xce22('0x1b')](handleError(_0x25525b,null));};exports['getCustomerAvatar']=function(_0xaf3ed,_0x203a77){var _0x106ebd=path['join'](config[_0xce22('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x4256e8={'where':{'id':_0xaf3ed[_0xce22('0x4b')]['id']},'attributes':['id',_0xce22('0x75'),_0xce22('0x76')],'raw':!![]};return db[_0xce22('0x31')][_0xce22('0x53')](_0x4256e8)[_0xce22('0x12')](handleEntityNotFound(_0x203a77,null))[_0xce22('0x12')](function(_0x51ed72){if(_0x51ed72){if(!_[_0xce22('0x72')](_0x51ed72[_0xce22('0x75')])){if(fs['existsSync'](path['join'](config[_0xce22('0x6a')],_0xce22('0x73'),_0x51ed72[_0xce22('0x75')]))&&_0x51ed72[_0xce22('0x76')]){_0x106ebd=path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x73'),_0x51ed72['customerAvatar']);}}return _0x203a77[_0xce22('0x74')](_0x106ebd);}})['catch'](handleError(_0x203a77,null));};exports['getSystemAvatar']=function(_0x202f9c,_0x5e038e){var _0x20bc98=path[_0xce22('0x6f')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x217160={'where':{'id':_0x202f9c[_0xce22('0x4b')]['id']},'attributes':['id',_0xce22('0x68')],'raw':!![]};return db['ChatWebsite'][_0xce22('0x53')](_0x217160)[_0xce22('0x12')](handleEntityNotFound(_0x5e038e,null))['then'](function(_0x43fb48){if(_0x43fb48){if(!_[_0xce22('0x72')](_0x43fb48['systemAvatar'])){if(fs[_0xce22('0x6e')](path['join'](config[_0xce22('0x6a')],_0xce22('0x73'),_0x43fb48['systemAvatar']))){_0x20bc98=path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0x73'),_0x43fb48[_0xce22('0x68')]);}}return _0x5e038e[_0xce22('0x74')](_0x20bc98);}})[_0xce22('0x1b')](handleError(_0x5e038e,null));};exports[_0xce22('0x77')]=function(_0x3fe2e4,_0x33c399){var _0xe6be26=require(_0xce22('0x78'));var _0x479be7=new _0xe6be26();var _0x31d154=_0x479be7[_0xce22('0x79')](_0x3fe2e4['headers'][_0xce22('0x7a')])[_0xce22('0x7b')]();var _0x564c0f={'body':_0x3fe2e4['body'],'channel':_0xce22('0x7c')};var _0x3d267e=[];var _0x34898d=[];var _0x57ff82={};var _0x2c1500=![];return db[_0xce22('0x7d')][_0xce22('0x56')]()[_0xce22('0x12')](function(_0x2035f3){if(!_0x2035f3){throw new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))]('no\x20available\x20attributes');}_0x3d267e=_[_0xce22('0x80')](_[_0xce22('0x37')](_0x2035f3),[_0xce22('0x81'),_0xce22('0x82')]);_0x34898d=_[_0xce22('0x80')](_[_0xce22('0x37')](_0x2035f3),[_0xce22('0x81'),'updatedAt',_0xce22('0x83'),_0xce22('0x84')]);if(_0x3fe2e4[_0xce22('0x4f')]['id']){delete _0x3fe2e4[_0xce22('0x4f')]['id'];}if(_[_0xce22('0x72')](_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x85')])){throw new db[(_0xce22('0x7e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x4f')])||_0x3fe2e4['body'][_0xce22('0x4f')]===''){throw new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xce22('0x72')](_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x86')])){throw new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34898d);}if(!_[_0xce22('0x87')](_0x34898d,_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x86')])){throw new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34898d);}_0x57ff82[_0x3fe2e4[_0xce22('0x4f')]['mapKey']]=_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x85')];})[_0xce22('0x12')](function(){return db['ChatWebsite'][_0xce22('0x53')]({'where':{'id':_0x3fe2e4[_0xce22('0x4b')]['id']},'include':[{'model':db[_0xce22('0x88')],'as':_0xce22('0x89'),'include':[{'model':db['CmContact'],'as':_0xce22('0x8a'),'where':_0x57ff82,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xce22('0x8b')],'as':'Applications'}]});})[_0xce22('0x12')](handleEntityNotFound(_0x33c399,null))[_0xce22('0x12')](function(_0x5695c6){if(_0x5695c6&&_0x5695c6['List']){_0x564c0f[_0xce22('0x8c')]=_0x5695c6;_0x564c0f['applications']=_0x5695c6[_0xce22('0x8d')];_0x564c0f[_0xce22('0x8e')]=_0x5695c6['List'];_0x564c0f[_0xce22('0x8f')]=_[_0xce22('0x90')](_0x564c0f[_0xce22('0x8f')],[_0xce22('0x91')],['asc']);if(_0x564c0f[_0xce22('0x8c')][_0xce22('0x8d')]){delete _0x564c0f['account'][_0xce22('0x8d')];}if(_0x564c0f[_0xce22('0x8c')][_0xce22('0x89')]&&_0x564c0f[_0xce22('0x8c')][_0xce22('0x89')]['Contacts']['length']){return _0x564c0f[_0xce22('0x8c')][_0xce22('0x89')]['Contacts'][0x0];}var _0xdc366d=_[_0xce22('0xd')](_0x3fe2e4['body'],{'firstName':_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x85')],'ListId':_0x5695c6[_0xce22('0x84')]});_0xdc366d[_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x86')]]=_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x85')];return db[_0xce22('0x7d')][_0xce22('0x4e')](_0xdc366d,{'fields':_0x3d267e,'raw':!![]});}})['then'](handleEntityNotFound(_0x33c399,null))[_0xce22('0x12')](function(_0x53049c){_0x564c0f[_0xce22('0x92')]=_0x53049c;var _0x20cf20=_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x93')];if(_0x3fe2e4[_0xce22('0x94')]['cf-connecting-ip']){_0x20cf20=_0x3fe2e4[_0xce22('0x94')][_0xce22('0x95')];}else if(_0x3fe2e4[_0xce22('0x94')][_0xce22('0x96')]){_0x20cf20=_[_0xce22('0x97')](_0x3fe2e4[_0xce22('0x94')][_0xce22('0x96')][_0xce22('0x98')](','));}if(_0x53049c){var _0x2e16dc={'ContactId':_0x53049c['id'],'ChatWebsiteId':_0x3fe2e4['params']['id'],'from':(_0x53049c[_0xce22('0x99')]||'')+'\x20'+(_0x53049c[_0xce22('0x9a')]||''),'customerIp':_0x20cf20,'customerPort':_0x3fe2e4[_0xce22('0x94')][_0xce22('0x9b')]?_0x3fe2e4['headers'][_0xce22('0x9b')]:null,'referer':_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x9c')],'browserName':_0x31d154[_0xce22('0x9d')][_0xce22('0x2c')]&&_0x31d154[_0xce22('0x9d')][_0xce22('0x9e')]?util[_0xce22('0x9f')](_0xce22('0xa0'),_0x31d154[_0xce22('0x9d')][_0xce22('0x2c')],_0x31d154[_0xce22('0x9d')][_0xce22('0x9e')]):_0xce22('0xa1'),'browserVersion':_0x31d154[_0xce22('0x9d')]['version']||_0xce22('0xa1'),'osName':util[_0xce22('0x9f')](_0xce22('0xa0'),_0x31d154['os']['name'],_0x31d154['os'][_0xce22('0x9e')]),'osVersion':_0x31d154['os'][_0xce22('0x9e')],'deviceModel':_0x31d154[_0xce22('0xa2')][_0xce22('0x35')]&&_0x31d154[_0xce22('0xa2')][_0xce22('0xa3')]?util[_0xce22('0x9f')](_0xce22('0xa4'),_0x31d154[_0xce22('0xa2')][_0xce22('0x35')],_0x31d154[_0xce22('0xa2')][_0xce22('0xa3')],_0x31d154[_0xce22('0xa2')][_0xce22('0x45')]):null,'deviceVendor':_0x31d154[_0xce22('0xa2')][_0xce22('0xa3')],'deviceType':_0x31d154[_0xce22('0xa2')][_0xce22('0x45')],'formData':JSON['stringify'](_0x3fe2e4[_0xce22('0x4f')])};var _0x38615f={'ChatWebsiteId':_0x3fe2e4[_0xce22('0x4b')]['id'],'closed':![]};if(_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xa5')]){_0x38615f[_0xce22('0xa5')]=_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xa5')];return db[_0xce22('0xa6')]['find']({'where':_0x38615f})[_0xce22('0x12')](function(_0x2e7537){if(_0x2e7537){return[_0x2e7537,![]];}_0x2e16dc[_0xce22('0xa5')]=_0x3fe2e4['body'][_0xce22('0xa5')];_0x2e16dc[_0xce22('0xa7')]=_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xa7')];return db[_0xce22('0xa6')][_0xce22('0x4e')](_0x2e16dc)[_0xce22('0x12')](function(_0x5d20d3){return[_0x5d20d3,!![]];});});}_0x38615f[_0xce22('0xa8')]=_0x53049c['id'];if(_0x3fe2e4[_0xce22('0x4f')]['interaction']&&_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xa9')]['id']){_0x38615f['id']=_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xa9')]['id'];return db[_0xce22('0xa6')][_0xce22('0x53')]({'where':_0x38615f})['then'](function(_0x143614){if(_0x143614){return[_0x143614,![]];}return db[_0xce22('0xa6')][_0xce22('0x4e')](_0x2e16dc)[_0xce22('0x12')](function(_0x5d4c04){return[_0x5d4c04,!![]];});});}return db['ChatInteraction'][_0xce22('0x4e')](_0x2e16dc)[_0xce22('0x12')](function(_0x59715c){return[_0x59715c,!![]];});}})[_0xce22('0xaa')](function(_0x21df3f,_0x7290ef){if(_0x21df3f){_0x2c1500=_0x7290ef;if(!_0x7290ef){var _0x2da306={'from':(_0x564c0f[_0xce22('0x92')][_0xce22('0x99')]||'')+'\x20'+(_0x564c0f[_0xce22('0x92')][_0xce22('0x9a')]||'')};if(_0x3fe2e4[_0xce22('0x4f')]['threadId']&&_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xab')]&&_0x3fe2e4[_0xce22('0x4f')]['threadId']!=_0x3fe2e4[_0xce22('0x4f')]['messageId']){_0x2da306[_0xce22('0xa5')]=_0x3fe2e4['body'][_0xce22('0xab')];}return _0x21df3f['update'](_0x2da306);}else{return _0x21df3f;}}})[_0xce22('0x12')](function(_0x2b6a5f){_0x564c0f[_0xce22('0xa9')]=_0x2b6a5f[_0xce22('0x27')]({'plain':!![]});_0x564c0f[_0xce22('0xa9')][_0xce22('0xac')]=_0x2c1500;if(_0x564c0f[_0xce22('0xa9')][_0xce22('0xac')]){if(_0x564c0f[_0xce22('0x8c')][_0xce22('0xad')]){_0x564c0f[_0xce22('0x8f')]['push']({'id':0x0,'priority':_0x564c0f[_0xce22('0x8f')]['length']+0x1,'app':_0xce22('0xae'),'appdata':_0xce22('0xaf'),'interval':_0xce22('0xb0')});}}return db[_0xce22('0xb1')][_0xce22('0x4e')]({'body':_0x3fe2e4[_0xce22('0x4f')][_0xce22('0x4f')],'ChatWebsiteId':_0x3fe2e4['params']['id'],'ChatInteractionId':_0x2b6a5f['id'],'direction':'in','ContactId':_0x564c0f[_0xce22('0x92')]['id'],'AttachmentId':_0x3fe2e4[_0xce22('0x4f')][_0xce22('0xb2')]});})[_0xce22('0x12')](function(_0x24a110){_0x564c0f[_0xce22('0x1a')]=_0x24a110;if(_0x564c0f['interaction']['UserId']){return db['User'][_0xce22('0x53')]({'attributes':['id',_0xce22('0x2c')],'where':{'id':_0x564c0f['interaction'][_0xce22('0xb3')]}})[_0xce22('0x12')](function(_0x129da5){if(_0x129da5){_0x564c0f[_0xce22('0x8f')][_0xce22('0xb4')]({'id':0x0,'priority':0x0,'app':_0xce22('0xb5'),'appdata':_0x129da5[_0xce22('0x2c')]+','+(_0x564c0f[_0xce22('0x8c')][_0xce22('0xb6')]||0xa),'interval':'*,*,*,*'});_0x564c0f['forcedOwnership']=!![];}return respondWithRpcPromise(_0xce22('0xb7'),_0xce22('0xb8'),_0x564c0f);});}return respondWithRpcPromise(_0xce22('0xb7'),'startRouting',_0x564c0f);})['then'](function(_0x3d98e2){respondWithRpcPromise(_0xce22('0xb9'),_0xce22('0xb9'),{'event':_0xce22('0x77'),'message':_0x3d98e2},client9002);return _0x3d98e2;})[_0xce22('0x12')](respondWithResult(_0x33c399,null))[_0xce22('0x1b')](handleError(_0x33c399,null));};exports['offline']=function(_0x41fc36,_0x2fb2c3){var _0xad28b5,_0x230429,_0x2275d3;var _0xe64fd9=[];var _0x239737={};var _0x3ac6db=_0x41fc36['files']||[];var _0x307c3b=[];var _0x8ff514;return db[_0xce22('0x7d')]['describe']()['then'](function(_0x1f298c){if(!_0x1f298c){throw new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))]('no\x20available\x20attributes');}_0xe64fd9=_[_0xce22('0x80')](_['keys'](_0x1f298c),[_0xce22('0x81'),'updatedAt',_0xce22('0x83'),_0xce22('0x84')]);if(_0x41fc36[_0xce22('0x4f')]['id']){delete _0x41fc36[_0xce22('0x4f')]['id'];}if(_[_0xce22('0x72')](_0x41fc36[_0xce22('0x4f')][_0xce22('0x85')])){throw _0x2fb2c3['status'](0x1f4)['send'](new db['Sequelize'][(_0xce22('0x7f'))](_0xce22('0xba')));}if(_[_0xce22('0x72')](_0x41fc36['body'][_0xce22('0x4f')])||_0x41fc36[_0xce22('0x4f')][_0xce22('0x4f')]===''){throw _0x2fb2c3[_0xce22('0x1d')](0x1f4)['send'](new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))](_0xce22('0xbb')));}if(_[_0xce22('0x72')](_0x41fc36[_0xce22('0x4f')][_0xce22('0xbc')])){throw _0x2fb2c3['status'](0x1f4)['send'](new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))](_0xce22('0xbd')+_0xe64fd9));}if(!_[_0xce22('0x87')](_0xe64fd9,_0x41fc36['body'][_0xce22('0xbc')])){throw _0x2fb2c3[_0xce22('0x1d')](0x1f4)['send'](new db[(_0xce22('0x7e'))][(_0xce22('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe64fd9));}_0x239737[_0x41fc36[_0xce22('0x4f')][_0xce22('0xbc')]]=_0x41fc36[_0xce22('0x4f')][_0xce22('0x85')];})[_0xce22('0x12')](function(){return db['ChatWebsite'][_0xce22('0x53')]({'where':{'id':_0x41fc36[_0xce22('0x4b')]['id']},'include':[{'model':db[_0xce22('0x88')],'as':_0xce22('0x89')},{'model':db[_0xce22('0xbe')],'as':_0xce22('0xbe')}]});})[_0xce22('0x12')](handleEntityNotFound(_0x2fb2c3,null))[_0xce22('0x12')](function(_0x3a75da){if(_0x3a75da&&_0x3a75da[_0xce22('0x89')]){_0x230429=_0x3a75da;var _0x54bd80=_[_0xce22('0xd')](_0x41fc36[_0xce22('0x4f')],{'firstName':_0x41fc36['body'][_0xce22('0x85')],'phone':_0x41fc36[_0xce22('0x4f')][_0xce22('0x85')],'ListId':_0x3a75da[_0xce22('0x84')]});_0x54bd80[_0x41fc36[_0xce22('0x4f')]['mapKeyOffline']]=_0x41fc36[_0xce22('0x4f')][_0xce22('0x85')];return db[_0xce22('0x7d')][_0xce22('0xbf')]({'where':_0x239737,'defaults':_0x54bd80});}})[_0xce22('0xaa')](function(_0x26aa60){if(_0x26aa60){_0x2275d3=_0x26aa60;var _0x39f957=fs[_0xce22('0xc0')](path['join'](config[_0xce22('0x6a')],_0xce22('0xc1')),_0xce22('0xc2'));var _0x5b31b2=ejs[_0xce22('0xc3')](_0x39f957,{'body':_[_0xce22('0xc4')](_0x41fc36[_0xce22('0x4f')][_0xce22('0x4f')]),'bodyTitle':_0x230429[_0xce22('0xc5')]});return db[_0xce22('0xc6')][_0xce22('0x4e')]({'body':_0x5b31b2,'plainBody':htmlToText[_0xce22('0xc7')](_0x5b31b2),'ContactId':_0x26aa60['id'],'ChatWebsiteId':_0x230429['id']});}})[_0xce22('0x12')](function(_0x591dfc){_0x8ff514=_0x591dfc;if(_0x3ac6db[_0xce22('0x3c')]){var _0x2d0e03=_0x3ac6db[_0xce22('0x30')](function(_0x2283b5){return{'name':_0x2283b5[_0xce22('0xc8')],'basename':_0x2283b5[_0xce22('0x64')],'type':_0x2283b5[_0xce22('0xc9')],'ChatOfflineMessageId':_0x591dfc['id']};});_0x307c3b=_0x2d0e03[_0xce22('0x30')](_0x27fd51=>{var _0x4bccfc={'filename':_0x27fd51[_0xce22('0x2c')],'path':path[_0xce22('0x6f')](config['root'],_0xce22('0xca'),_0xce22('0xcb'),_0xce22('0xcc'),'offline-chat',_0x27fd51['basename'])};return _0x4bccfc;});if(!_0x230429[_0xce22('0xcd')]){return db[_0xce22('0xce')]['transaction'](function(_0x1b3082){return db[_0xce22('0xcf')][_0xce22('0xd0')](_0x2d0e03,{'transaction':_0x1b3082});});}}})[_0xce22('0x12')](function(){if(_0x8ff514){_0xad28b5=_0x8ff514;return db[_0xce22('0xbe')][_0xce22('0x5b')]({'where':{'service':!![]},'include':[{'model':db[_0xce22('0xd1')],'as':_0xce22('0xd2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xce22('0xd3'),'raw':!![]}]}]});}})[_0xce22('0x12')](function(_0xcdf939){if(_0xcdf939&&_0xcdf939['Smtp']&&_0x230429[_0xce22('0xd4')]&&_0x230429[_0xce22('0xd5')]){var _0x457d34=_0xcdf939[_0xce22('0xd6')]();return respondWithRpcPromise(_0xce22('0xd7'),_0xce22('0xd8'),{'account':_0x457d34,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0xcdf939[_0xce22('0x2c')],_0xcdf939[_0xce22('0xd9')]||_0xcdf939[_0xce22('0xd2')]['user']),'to':_0x230429[_0xce22('0xd5')],'subject':_0x230429[_0xce22('0xda')],'html':_0xad28b5[_0xce22('0x4f')],'attachments':_0x307c3b}},client9003)['then'](function(){return _0xad28b5;})['catch'](function(_0x2a01db){logger[_0xce22('0x18')](_0x2a01db);});}})['then'](function(){if(_0x230429&&_0x230429['openNewInteraction']&&_0x230429['MailAccountId']){var _0x5a2844=[];if(_0x3ac6db[_0xce22('0x3c')]){_0x5a2844=_0x3ac6db['map'](function(_0x489c3d){return{'name':_0x489c3d['originalname'],'basename':_0x489c3d[_0xce22('0x64')],'type':_0x489c3d['mimetype'],'ChatOfflineMessageId':_0x8ff514['id']};});}var _0x9e0991;if(!_['isNil'](_0x230429[_0xce22('0xdb')])){var _0x824f6b=_[_0xce22('0x30')](_0x41fc36[_0xce22('0x4f')],function(_0x53742e){return _0x53742e;});var _0x1c187b=_[_0xce22('0xdc')](_0x824f6b)[0x0];var _0x42c7fc=_[_0xce22('0xdd')](_0x1c187b,function(_0x56535a){return _0x56535a;});_0x9e0991=_0x42c7fc[0x1][_0x230429[_0xce22('0xdb')]];}var _0x474214={'from':_0x2275d3[_0xce22('0xd9')],'firstName':_0x2275d3[_0xce22('0x99')],'lastName':_0x2275d3[_0xce22('0x9a')],'mapKey':'email','message':{'from':_0x2275d3[_0xce22('0xd9')],'to':_0x230429[_0xce22('0xbe')][_0xce22('0xd9')],'cc':'','subject':_[_0xce22('0x72')](_0x9e0991)?_0x230429[_0xce22('0xda')]:_0x9e0991,'messageId':'','sentAt':new Date(),'attach':_0x5a2844[_0xce22('0x3c')],'attachments':_0x5a2844,'originChannel':_0xce22('0xde'),'ChatWebsiteId':_0x230429['id'],'ChatOfflineMessageId':_0xad28b5['id'],'originTo':_0x230429[_0xce22('0xbe')][_0xce22('0xd9')]},'body':_0xad28b5[_0xce22('0x4f')]};var _0x467dce={'account':{'id':_0x230429[_0xce22('0xdf')]},'body':_0x474214,'log':_0xce22('0xe0')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x467dce,client9001)[_0xce22('0x12')](function(){return _0xad28b5;})[_0xce22('0x1b')](function(_0x2c2b55){logger[_0xce22('0x18')](_0x2c2b55);});}return;})[_0xce22('0x12')](function(){if(_0xad28b5){return _0xad28b5;}})[_0xce22('0x12')](respondWithResult(_0x2fb2c3,null))[_0xce22('0x1b')](function(_0x486969){logger[_0xce22('0x18')](_0xce22('0x1b'),_0x486969);for(var _0x1146c4 of _0x3ac6db){var _0x2bc2b0=path[_0xce22('0x6f')](config[_0xce22('0x6a')],_0xce22('0xca'),_0xce22('0xcb'),_0xce22('0xcc'),_0xce22('0xe1'),_0x1146c4[_0xce22('0x64')]);fs_extra[_0xce22('0xe2')](_0x2bc2b0)[_0xce22('0x1b')](function(_0x309151){logger['error'](_0xce22('0xe3'),_0x2bc2b0,_0x309151);});}});};exports[_0xce22('0xe4')]=function(_0x57cb84,_0x39ccc3){return db[_0xce22('0xa6')][_0xce22('0x53')]({'where':{'id':_0x57cb84['params']['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x39ccc3,null))[_0xce22('0x12')](function(_0x18e695){if(_0x18e695){return _0x18e695['addInteraction'](_0x57cb84[_0xce22('0x4f')][_0xce22('0x5d')],_[_0xce22('0xe5')](_0x57cb84[_0xce22('0x4f')],[_0xce22('0x5d'),'id'])||{});}})[_0xce22('0x12')](respondWithResult(_0x39ccc3,null))[_0xce22('0x1b')](handleError(_0x39ccc3,null));};exports[_0xce22('0xe6')]=function(_0xad4946,_0x402908){var _0x39c1f6={'raw':![],'where':{}};var _0x43f6da={};var _0x38e587={'count':0x0,'rows':[]};return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0xad4946['params']['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x402908,null))[_0xce22('0x12')](function(_0x5df677){if(_0x5df677){_0x43f6da[_0xce22('0x35')]=_[_0xce22('0x37')](db[_0xce22('0xa6')][_0xce22('0x32')]);_0x43f6da[_0xce22('0x36')]=_['keys'](_0xad4946['query']);_0x43f6da['filters']=_[_0xce22('0x39')](_0x43f6da[_0xce22('0x35')],_0x43f6da[_0xce22('0x36')]);_0x39c1f6[_0xce22('0x3a')]=_[_0xce22('0x39')](_0x43f6da['model'],qs[_0xce22('0x3b')](_0xad4946[_0xce22('0x36')]['fields']));_0x39c1f6[_0xce22('0x3a')]=_0x39c1f6['attributes'][_0xce22('0x3c')]?_0x39c1f6[_0xce22('0x3a')]:_0x43f6da['model'];if(!_0xad4946[_0xce22('0x36')]['hasOwnProperty'](_0xce22('0x3e'))){_0x39c1f6[_0xce22('0x21')]=qs[_0xce22('0x21')](_0xad4946['query'][_0xce22('0x21')]);_0x39c1f6[_0xce22('0x22')]=qs[_0xce22('0x22')](_0xad4946[_0xce22('0x36')]['offset']);}_0x39c1f6[_0xce22('0x3f')]=qs[_0xce22('0x40')](_0xad4946[_0xce22('0x36')][_0xce22('0x40')]);_0x39c1f6[_0xce22('0x41')]=qs[_0xce22('0x38')](_[_0xce22('0x42')](_0xad4946[_0xce22('0x36')],_0x43f6da[_0xce22('0x38')]));_0x39c1f6['where'][_0xce22('0x58')]=_0x5df677['id'];if(_0xad4946['query'][_0xce22('0x43')]){_0x39c1f6['where']=_['merge'](_0x39c1f6[_0xce22('0x41')],{'$or':_['map'](_0x39c1f6['attributes'],function(_0x2d0e76){var _0x570426={};_0x570426[_0x2d0e76]={'$like':'%'+_0xad4946[_0xce22('0x36')][_0xce22('0x43')]+'%'};return _0x570426;})});}_0x39c1f6=_[_0xce22('0x44')]({},_0x39c1f6,_0xad4946[_0xce22('0x46')]);return db[_0xce22('0xa6')][_0xce22('0x23')]({'where':_0x39c1f6[_0xce22('0x41')]})['then'](function(_0x755efd){_0x38e587[_0xce22('0x23')]=_0x755efd;if(_0xad4946['query']['includeAll']){_0x39c1f6[_0xce22('0x4d')]=[{'model':db['CmContact'],'as':_0xce22('0xe7'),'required':![]},{'model':db['User'],'as':_0xce22('0xe8'),'attributes':[_0xce22('0x2c'),_0xce22('0xe9'),_0xce22('0xea')],'required':![]},{'model':db[_0xce22('0xeb')],'as':_0xce22('0xec'),'attributes':['id',_0xce22('0x2c'),_0xce22('0xed')],'where':_0xad4946[_0xce22('0x36')][_0xce22('0xee')]?{'id':_0xad4946['query'][_0xce22('0xee')]}:undefined,'required':_0xad4946[_0xce22('0x36')]['tag']?!![]:![]}];}return db[_0xce22('0xa6')]['findAll'](_0x39c1f6);})['then'](function(_0x341215){_0x38e587[_0xce22('0x49')]=_0x341215;return _0x38e587;});}})[_0xce22('0x12')](respondWithFilteredResult(_0x402908,_0x39c1f6))[_0xce22('0x1b')](handleError(_0x402908,null));};function iftimePromise(_0x594694,_0x454534){return respondWithRpcPromise(_0xce22('0xef'),_0xce22('0xf0'),{'command':_0x454534[_0xce22('0xf1')]?util[_0xce22('0x9f')](_0xce22('0xf2'),_0x594694[_0xce22('0xf3')],_0x454534[_0xce22('0xf1')]):util['format'](_0xce22('0xf4'),_0x594694['interval'])},client9002)[_0xce22('0x12')](function(_0x7f61){var _0x304bbc=_0x7f61&&_0x7f61[_0xce22('0xf5')](_0xce22('0xf6'))>=0x0?!![]:![];logger[_0xce22('0x13')](_0xce22('0xf7'),_0x454534['id'],_0x594694['id'],_0x594694[_0xce22('0xf3')],_0x304bbc?_0xce22('0xf8'):_0xce22('0xf9'),_0x454534[_0xce22('0xf1')]?_0x454534['timezone']:'No\x20timezone');return _0x304bbc;})[_0xce22('0x1b')](function(_0x49a252){logger[_0xce22('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x454534['id'],_0x594694['id'],_0x594694[_0xce22('0xf3')],util[_0xce22('0xfa')](_0x49a252,{'showHidden':![],'depth':null}),_0x454534[_0xce22('0xf1')]?_0x454534['timezone']:_0xce22('0xfb'));return![];});}exports[_0xce22('0xf0')]=function(_0x1dd73a,_0x564be5){var _0x64ccd=0x0;var _0x369124=0x0;var _0x5cc592=![];var _0x4e7f46;var _0x58fea8;return db[_0xce22('0x31')]['find']({'where':{'id':_0x1dd73a[_0xce22('0x4b')]['id']},'include':[{'model':db[_0xce22('0xfc')],'as':'Interval','include':[{'model':db[_0xce22('0xfc')],'as':_0xce22('0xfd'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xce22('0x12')](handleEntityNotFound(_0x564be5,null))[_0xce22('0x12')](function(_0x17aedc){if(_0x17aedc){_0x4e7f46=_0x17aedc;return _0x17aedc[_0xce22('0xfe')]({'raw':!![]});}})[_0xce22('0x12')](function(_0x3e4d95){if(_0x4e7f46){if(_0x3e4d95){_0x58fea8=_0x3e4d95;}}return require('../../config/license/util')[_0xce22('0x6d')]();})[_0xce22('0x12')](function(_0x2fd98c){if(_0x2fd98c){_0x369124=_0x2fd98c['virtual'];_0x5cc592=_0x2fd98c[_0xce22('0xff')];}})[_0xce22('0x12')](function(){return db[_0xce22('0xa6')][_0xce22('0x23')]({'where':{'closed':![]}});})[_0xce22('0x12')](function(_0x17a311){_0x64ccd=_0x17a311;if(_0x369124&&_0x17a311>_0x369124){return db[_0xce22('0x100')][_0xce22('0x5b')]({'where':{'id':0x1}})[_0xce22('0x12')](function(_0x49b6d1){if(_0x49b6d1){_0x49b6d1[_0xce22('0x101')](_0xce22('0x102'));}});}})['then'](function(){if(_0x4e7f46[_0xce22('0xfc')]&&_0x4e7f46[_0xce22('0xfc')][_0xce22('0xfd')]){var _0xce781d=[];for(var _0x2057eb=0x0;_0x2057eb<_0x4e7f46[_0xce22('0xfc')]['Intervals']['length'];_0x2057eb++){var _0x2ce93b=_0x4e7f46[_0xce22('0xfc')][_0xce22('0xfd')][_0x2057eb][_0xce22('0x27')]({'plain':!![]});_0xce781d['push'](iftimePromise(_0x2ce93b,_0x4e7f46));}return BPromise['all'](_0xce781d)[_0xce22('0x12')](function(_0x5ca364){return _['some'](_0x5ca364);});}else{return!![];}})[_0xce22('0x12')](function(_0x51286a){var _0xecda4e=fs[_0xce22('0xc0')](path['join'](config['root'],_0xce22('0x103')),'utf8');var _0x587fa2={'remote':_0x4e7f46[_0xce22('0x104')],'query':querystring['stringify'](_[_0xce22('0x44')](_0x4e7f46[_0xce22('0x27')]({'plain':!![]}),{'customerIp':_0x1dd73a[_0xce22('0x94')][_0xce22('0x96')]||_0x1dd73a[_0xce22('0x94')][_0xce22('0x105')]||_0x1dd73a[_0xce22('0x106')][_0xce22('0x107')]||_0x1dd73a['ip'],'referer':_0x1dd73a[_0xce22('0x94')]['referer'],'openedInteractions':_0x64ccd,'maxInteractions':_0x369124,'virtual':_0x5cc592[_0xce22('0x108')],'online':_0x51286a,'custom':_0x5cc592}))[_0xce22('0x109')](/'/g,'\x5c\x27')};_0x564be5['send'](ejs[_0xce22('0xc3')](Mustache[_0xce22('0xc3')](_0xecda4e,_0x587fa2),{'proactiveActions':_0x58fea8,'alignment':_0x4e7f46[_0xce22('0x10a')],'verticalAlignment':_0x4e7f46[_0xce22('0x10b')],'div_color':_0x4e7f46[_0xce22('0xed')],'labelText':_0x4e7f46[_0xce22('0x10c')],'text_color':_0x4e7f46['textColor'],'text_button_color':_0x4e7f46['textButtonColor'],'button_color':_0x4e7f46[_0xce22('0x10d')],'background_color':_0x4e7f46[_0xce22('0x10e')],'hideWhenOffline':_0x4e7f46['hideWhenOffline'],'interval':_0x4e7f46[_0xce22('0x10f')]}));})[_0xce22('0x1b')](handleError(_0x564be5,null));};exports[_0xce22('0x110')]=function(_0x4cb1ae,_0x3087ec){var _0x5ab44a=_0x4cb1ae[_0xce22('0x4b')]['id'];var _0x3b434b=_0x4cb1ae[_0xce22('0x4f')];var _0x23606b=0xc8;var _0x44939f=null;return db[_0xce22('0xce')][_0xce22('0x111')]({'isolationLevel':db[_0xce22('0xce')][_0xce22('0x112')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x383194){return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0x5ab44a},'transaction':_0x383194})['then'](function(_0x16ab6b){if(_0x16ab6b){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x5ab44a},'transaction':_0x383194})[_0xce22('0x12')](function(){var _0x521810=_[_0xce22('0x30')](_0x3b434b,function(_0x4a66f0){_0x4a66f0[_0xce22('0x58')]=_0x5ab44a;return _0x4a66f0;});return db[_0xce22('0x8b')][_0xce22('0xd0')](_0x521810,{'transaction':_0x383194});});}else{_0x23606b=0x194;_0x44939f=[];}});})[_0xce22('0x12')](function(){if(_0x23606b!==0x194){return db[_0xce22('0x8b')][_0xce22('0x113')]({'where':{'ChatWebsiteId':_0x5ab44a},'order':_0xce22('0x91')})[_0xce22('0x12')](function(_0x194060){_0x44939f=_0x194060;});}})[_0xce22('0x1b')](function(_0x139189){_0x23606b=0x1f4;logger[_0xce22('0x18')](_0x139189[_0xce22('0x2b')]);if(_0x139189[_0xce22('0x2c')]){delete _0x139189[_0xce22('0x2c')];}_0x44939f=_0x139189;})[_0xce22('0x114')](function(){if(_0x44939f===null){_0x3087ec['sendStatus'](_0x23606b);}else{if(_0x23606b===0x1f4){_0x3087ec['status'](_0x23606b)[_0xce22('0x2d')](_0x44939f);}else{_0x3087ec[_0xce22('0x1d')](_0x23606b)['json'](_0x44939f);}}});};exports[_0xce22('0x115')]=function(_0x51af22,_0xdcce71){var _0x57be5a={};var _0x1316d5={};var _0x13a9f4;var _0x81f555;return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0x51af22['params']['id']}})[_0xce22('0x12')](handleEntityNotFound(_0xdcce71,null))[_0xce22('0x12')](function(_0x19d8d3){if(_0x19d8d3){_0x13a9f4=_0x19d8d3;_0x1316d5['model']=_['keys'](db[_0xce22('0x8b')][_0xce22('0x32')]);_0x1316d5[_0xce22('0x36')]=_[_0xce22('0x37')](_0x51af22['query']);_0x1316d5[_0xce22('0x38')]=_[_0xce22('0x39')](_0x1316d5[_0xce22('0x35')],_0x1316d5[_0xce22('0x36')]);_0x57be5a[_0xce22('0x3a')]=_[_0xce22('0x39')](_0x1316d5[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x51af22[_0xce22('0x36')][_0xce22('0x3b')]));_0x57be5a['attributes']=_0x57be5a[_0xce22('0x3a')][_0xce22('0x3c')]?_0x57be5a[_0xce22('0x3a')]:_0x1316d5['model'];_0x57be5a['order']=qs[_0xce22('0x40')](_0x51af22[_0xce22('0x36')][_0xce22('0x40')]);_0x57be5a['where']=qs[_0xce22('0x38')](_['pick'](_0x51af22['query'],_0x1316d5[_0xce22('0x38')]));if(_0x51af22[_0xce22('0x36')][_0xce22('0x43')]){_0x57be5a[_0xce22('0x41')]=_[_0xce22('0x44')](_0x57be5a['where'],{'$or':_[_0xce22('0x30')](_0x57be5a[_0xce22('0x3a')],function(_0x41ac25){var _0x197423={};_0x197423[_0x41ac25]={'$like':'%'+_0x51af22['query']['filter']+'%'};return _0x197423;})});}_0x57be5a=_[_0xce22('0x44')]({},_0x57be5a,_0x51af22['options']);return _0x13a9f4[_0xce22('0x115')](_0x57be5a);}})['then'](function(_0x3ea076){if(_0x3ea076){_0x81f555=_0x3ea076[_0xce22('0x3c')];if(!_0x51af22[_0xce22('0x36')][_0xce22('0x3d')](_0xce22('0x3e'))){_0x57be5a[_0xce22('0x21')]=qs[_0xce22('0x21')](_0x51af22['query'][_0xce22('0x21')]);_0x57be5a[_0xce22('0x22')]=qs[_0xce22('0x22')](_0x51af22[_0xce22('0x36')][_0xce22('0x22')]);}return _0x13a9f4[_0xce22('0x115')](_0x57be5a);}})[_0xce22('0x12')](function(_0x4b1973){if(_0x4b1973){return _0x4b1973?{'count':_0x81f555,'rows':_0x4b1973}:null;}})[_0xce22('0x12')](respondWithResult(_0xdcce71,null))[_0xce22('0x1b')](handleError(_0xdcce71,null));};exports[_0xce22('0x116')]=function(_0x9c6de8,_0x3766ae){return db[_0xce22('0x117')][_0xce22('0x53')]({'where':{'id':_0x9c6de8[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x3766ae,null))['then'](function(_0x30dfbb){if(_0x30dfbb){return _0x30dfbb['addProactiveActions'](_0x9c6de8[_0xce22('0x4f')][_0xce22('0x5d')],_[_0xce22('0xe5')](_0x9c6de8[_0xce22('0x4f')],['ids','id'])||{});}})[_0xce22('0x12')](respondWithResult(_0x3766ae,null))[_0xce22('0x1b')](handleError(_0x3766ae,null));};exports[_0xce22('0xfe')]=function(_0x2f6573,_0x352c0b){var _0x2e954f={};var _0x3a0e38={};var _0x53eb9c;var _0x58c57d;return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0x2f6573[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x352c0b,null))[_0xce22('0x12')](function(_0x1ba7f0){if(_0x1ba7f0){_0x53eb9c=_0x1ba7f0;_0x3a0e38[_0xce22('0x35')]=_[_0xce22('0x37')](db[_0xce22('0x118')][_0xce22('0x32')]);_0x3a0e38['query']=_[_0xce22('0x37')](_0x2f6573[_0xce22('0x36')]);_0x3a0e38[_0xce22('0x38')]=_['intersection'](_0x3a0e38[_0xce22('0x35')],_0x3a0e38[_0xce22('0x36')]);_0x2e954f[_0xce22('0x3a')]=_['intersection'](_0x3a0e38['model'],qs[_0xce22('0x3b')](_0x2f6573['query']['fields']));_0x2e954f[_0xce22('0x3a')]=_0x2e954f[_0xce22('0x3a')]['length']?_0x2e954f[_0xce22('0x3a')]:_0x3a0e38[_0xce22('0x35')];_0x2e954f[_0xce22('0x3f')]=qs['sort'](_0x2f6573['query'][_0xce22('0x40')]);_0x2e954f['where']=qs[_0xce22('0x38')](_[_0xce22('0x42')](_0x2f6573[_0xce22('0x36')],_0x3a0e38[_0xce22('0x38')]));if(_0x2f6573[_0xce22('0x36')][_0xce22('0x43')]){_0x2e954f['where']=_['merge'](_0x2e954f['where'],{'$or':_[_0xce22('0x30')](_0x2e954f['attributes'],function(_0x33e845){var _0x3fafab={};_0x3fafab[_0x33e845]={'$like':'%'+_0x2f6573['query']['filter']+'%'};return _0x3fafab;})});}_0x2e954f=_['merge']({},_0x2e954f,_0x2f6573[_0xce22('0x46')]);return _0x53eb9c[_0xce22('0xfe')](_0x2e954f);}})[_0xce22('0x12')](function(_0x32ce0e){if(_0x32ce0e){_0x58c57d=_0x32ce0e[_0xce22('0x3c')];if(!_0x2f6573[_0xce22('0x36')][_0xce22('0x3d')]('nolimit')){_0x2e954f[_0xce22('0x21')]=qs[_0xce22('0x21')](_0x2f6573[_0xce22('0x36')][_0xce22('0x21')]);_0x2e954f[_0xce22('0x22')]=qs[_0xce22('0x22')](_0x2f6573[_0xce22('0x36')][_0xce22('0x22')]);}return _0x53eb9c[_0xce22('0xfe')](_0x2e954f);}})[_0xce22('0x12')](function(_0x8fc537){if(_0x8fc537){return _0x8fc537?{'count':_0x58c57d,'rows':_0x8fc537}:null;}})[_0xce22('0x12')](respondWithResult(_0x352c0b,null))[_0xce22('0x1b')](handleError(_0x352c0b,null));};exports[_0xce22('0x119')]=function(_0x1b57b9,_0x185b3b){var _0x4cca3a=_0x1b57b9[_0xce22('0x36')][_0xce22('0x11a')]===_0xce22('0x11b')?_0xce22('0x11c'):_0xce22('0x11d');return db[_0xce22('0x31')]['find']({'attributes':['id',_0x4cca3a],'where':{'id':_0x1b57b9[_0xce22('0x4b')]['id']}})['then'](handleEntityNotFound(_0x185b3b,null))[_0xce22('0x12')](function(_0x534316){if(_0x534316){var _0x280c80=_0x534316[_0x4cca3a];var _0x5b5326=_0x280c80&&_0x280c80['items']?_0x280c80[_0xce22('0x11e')]:[];_0x185b3b[_0xce22('0x2d')]({'fromKey':_[_0xce22('0x72')](_0x280c80[_0xce22('0x11f')])?undefined:_0x280c80[_0xce22('0x11f')],'count':_0x5b5326[_0xce22('0x3c')],'rows':_0x5b5326});}})[_0xce22('0x1b')](handleError(_0x185b3b,null));};exports[_0xce22('0x120')]=function(_0x45778d,_0x2f17f6){var _0x5ddff1={'raw':![],'where':{}};var _0x2d9921={};var _0x46b7e9={'count':0x0,'rows':[]};return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0x45778d[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x2f17f6,null))['then'](function(_0x2481c){if(_0x2481c){_0x2d9921[_0xce22('0x35')]=_[_0xce22('0x37')](db[_0xce22('0xc6')][_0xce22('0x32')]);_0x2d9921['query']=_[_0xce22('0x37')](_0x45778d['query']);_0x2d9921[_0xce22('0x38')]=_['intersection'](_0x2d9921['model'],_0x2d9921['query']);_0x5ddff1[_0xce22('0x3a')]=_[_0xce22('0x39')](_0x2d9921[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x45778d[_0xce22('0x36')][_0xce22('0x3b')]));_0x5ddff1[_0xce22('0x3a')]=_0x5ddff1[_0xce22('0x3a')]['length']?_0x5ddff1[_0xce22('0x3a')]:_0x2d9921['model'];if(!_0x45778d[_0xce22('0x36')][_0xce22('0x3d')](_0xce22('0x3e'))){_0x5ddff1[_0xce22('0x21')]=qs['limit'](_0x45778d[_0xce22('0x36')][_0xce22('0x21')]);_0x5ddff1[_0xce22('0x22')]=qs[_0xce22('0x22')](_0x45778d[_0xce22('0x36')][_0xce22('0x22')]);}_0x5ddff1[_0xce22('0x3f')]=qs[_0xce22('0x40')](_0x45778d[_0xce22('0x36')][_0xce22('0x40')]);_0x5ddff1[_0xce22('0x41')]=qs[_0xce22('0x38')](_[_0xce22('0x42')](_0x45778d[_0xce22('0x36')],_0x2d9921['filters']));_0x5ddff1[_0xce22('0x41')][_0xce22('0x58')]=_0x2481c['id'];if(_0x45778d[_0xce22('0x36')]['filter']){_0x5ddff1[_0xce22('0x41')]=_[_0xce22('0x44')](_0x5ddff1[_0xce22('0x41')],{'$or':_[_0xce22('0x30')](_0x5ddff1[_0xce22('0x3a')],function(_0x5ecac1){var _0x49afe9={};_0x49afe9[_0x5ecac1]={'$like':'%'+_0x45778d[_0xce22('0x36')]['filter']+'%'};return _0x49afe9;})});}_0x5ddff1=_[_0xce22('0x44')]({},_0x5ddff1,_0x45778d[_0xce22('0x46')]);return db['ChatOfflineMessage']['count']({'where':_0x5ddff1[_0xce22('0x41')]})[_0xce22('0x12')](function(_0x4498bf){_0x46b7e9[_0xce22('0x23')]=_0x4498bf;if(_0x45778d['query'][_0xce22('0x47')]){_0x5ddff1[_0xce22('0x4d')]=[{'all':!![]}];}else{_0x5ddff1[_0xce22('0x4d')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xce22('0xcf')],'as':_0xce22('0x121'),'required':![]}];}return db[_0xce22('0xc6')][_0xce22('0x48')](_0x5ddff1);})['then'](function(_0x21194a){_0x46b7e9['rows']=_0x21194a;return _0x46b7e9;});}})[_0xce22('0x12')](respondWithFilteredResult(_0x2f17f6,_0x5ddff1))[_0xce22('0x1b')](handleError(_0x2f17f6,null));};exports['addAgents']=function(_0x3bce1f,_0x4ab40f){return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x3bce1f[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x4ab40f,null))[_0xce22('0x12')](function(_0x36bf2b){if(_0x36bf2b){return _0x36bf2b['addAgents'](_0x3bce1f[_0xce22('0x4f')][_0xce22('0x5d')],_[_0xce22('0xe5')](_0x3bce1f['body'],[_0xce22('0x5d'),'id'])||{})[_0xce22('0xaa')](function(_0x238b5d){for(var _0x127734=0x0;_0x127734<_0x3bce1f[_0xce22('0x4f')][_0xce22('0x5d')]['length'];_0x127734+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x3bce1f['body'][_0xce22('0x5d')][_0x127734]),'ChatWebsiteId':Number(_0x3bce1f['params']['id'])});}return _0x238b5d;});}})[_0xce22('0x12')](respondWithResult(_0x4ab40f,null))[_0xce22('0x1b')](handleError(_0x4ab40f,null));};exports[_0xce22('0x122')]=function(_0x515693,_0xb067f3){return db[_0xce22('0x31')][_0xce22('0x53')]({'where':{'id':_0x515693['params']['id']}})['then'](handleEntityNotFound(_0xb067f3,null))[_0xce22('0x12')](function(_0x483943){if(_0x483943){return _0x483943[_0xce22('0x122')](_0x515693[_0xce22('0x36')]['ids'])[_0xce22('0x12')](function(){if(_['isArray'](_0x515693[_0xce22('0x36')]['ids'])){for(var _0x2cc4ce=0x0;_0x2cc4ce<_0x515693[_0xce22('0x36')][_0xce22('0x5d')][_0xce22('0x3c')];_0x2cc4ce+=0x1){socket[_0xce22('0x123')](_0xce22('0x124'),{'UserId':Number(_0x515693[_0xce22('0x36')][_0xce22('0x5d')][_0x2cc4ce]),'ChatWebsiteId':Number(_0x515693[_0xce22('0x4b')]['id'])});}}else{socket['emit'](_0xce22('0x124'),{'UserId':Number(_0x515693[_0xce22('0x36')][_0xce22('0x5d')]),'ChatWebsiteId':Number(_0x515693[_0xce22('0x4b')]['id'])});}});}})[_0xce22('0x12')](respondWithStatusCode(_0xb067f3,null))[_0xce22('0x1b')](handleError(_0xb067f3,null));};exports['getAgents']=function(_0x333b12,_0x5b2443){var _0x44792b={};var _0x2f22c9={};var _0x3295ee;var _0x47a47f;return db[_0xce22('0x31')][_0xce22('0x5b')]({'where':{'id':_0x333b12[_0xce22('0x4b')]['id']}})[_0xce22('0x12')](handleEntityNotFound(_0x5b2443,null))[_0xce22('0x12')](function(_0x13cb43){if(_0x13cb43){_0x3295ee=_0x13cb43;_0x2f22c9[_0xce22('0x35')]=_['keys'](db[_0xce22('0x125')][_0xce22('0x32')]);_0x2f22c9[_0xce22('0x36')]=_[_0xce22('0x37')](_0x333b12[_0xce22('0x36')]);_0x2f22c9[_0xce22('0x38')]=_[_0xce22('0x39')](_0x2f22c9['model'],_0x2f22c9[_0xce22('0x36')]);_0x44792b[_0xce22('0x3a')]=_['intersection'](_0x2f22c9[_0xce22('0x35')],qs[_0xce22('0x3b')](_0x333b12[_0xce22('0x36')]['fields']));_0x44792b[_0xce22('0x3a')]=_0x44792b[_0xce22('0x3a')][_0xce22('0x3c')]?_0x44792b[_0xce22('0x3a')]:_0x2f22c9['model'];_0x44792b[_0xce22('0x3f')]=qs[_0xce22('0x40')](_0x333b12[_0xce22('0x36')][_0xce22('0x40')]);_0x44792b['where']=qs[_0xce22('0x38')](_['pick'](_0x333b12[_0xce22('0x36')],_0x2f22c9[_0xce22('0x38')]));if(_0x333b12[_0xce22('0x36')][_0xce22('0x43')]){_0x44792b[_0xce22('0x41')]=_[_0xce22('0x44')](_0x44792b['where'],{'$or':_[_0xce22('0x30')](_0x44792b[_0xce22('0x3a')],function(_0x2b401c){var _0x2f135a={};_0x2f135a[_0x2b401c]={'$like':'%'+_0x333b12[_0xce22('0x36')][_0xce22('0x43')]+'%'};return _0x2f135a;})});}_0x44792b=_['merge']({},_0x44792b,_0x333b12['options']);return _0x3295ee[_0xce22('0x126')](_0x44792b);}})['then'](function(_0x515b9f){if(_0x515b9f){_0x47a47f=_0x515b9f[_0xce22('0x3c')];if(!_0x333b12[_0xce22('0x36')][_0xce22('0x3d')](_0xce22('0x3e'))){_0x44792b[_0xce22('0x21')]=qs[_0xce22('0x21')](_0x333b12[_0xce22('0x36')]['limit']);_0x44792b[_0xce22('0x22')]=qs[_0xce22('0x22')](_0x333b12[_0xce22('0x36')][_0xce22('0x22')]);}return _0x3295ee['getAgents'](_0x44792b);}})[_0xce22('0x12')](function(_0x1e4467){if(_0x1e4467){return _0x1e4467?{'count':_0x47a47f,'rows':_0x1e4467}:null;}})[_0xce22('0x12')](respondWithResult(_0x5b2443,null))['catch'](handleError(_0x5b2443,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c47b9a5..92c2b18 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 _0x7cab=['hook','events','../../mysqldb','ChatWebsite','save','update','remove','emit'];(function(_0x11897d,_0xe37a3e){var _0x1b9c0e=function(_0x52068c){while(--_0x52068c){_0x11897d['push'](_0x11897d['shift']());}};_0x1b9c0e(++_0xe37a3e);}(_0x7cab,0x91));var _0xb7ca=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x7cab[_0x4b4f24];return _0x1c13d4;};'use strict';var EventEmitter=require(_0xb7ca('0x0'));var ChatWebsite=require(_0xb7ca('0x1'))['db'][_0xb7ca('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7ca('0x3'),'afterUpdate':_0xb7ca('0x4'),'afterDestroy':_0xb7ca('0x5')};function emitEvent(_0x57d409){return function(_0x37e571,_0x5014c1,_0x4b793a){ChatWebsiteEvents[_0xb7ca('0x6')](_0x57d409+':'+_0x37e571['id'],_0x37e571);ChatWebsiteEvents[_0xb7ca('0x6')](_0x57d409,_0x37e571);_0x4b793a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xb7ca('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x616c=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','save'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x616c,0x1b6));var _0xc616=function(_0x27d78d,_0x11567e){_0x27d78d=_0x27d78d-0x0;var _0x2cf55a=_0x616c[_0x27d78d];return _0x2cf55a;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xc616('0x0'))['db'][_0xc616('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc616('0x2'),'afterUpdate':_0xc616('0x3'),'afterDestroy':_0xc616('0x4')};function emitEvent(_0x3e3bc4){return function(_0x52b492,_0x5f2d88,_0x2a34db){ChatWebsiteEvents[_0xc616('0x5')](_0x3e3bc4+':'+_0x52b492['id'],_0x52b492);ChatWebsiteEvents[_0xc616('0x5')](_0x3e3bc4,_0x52b492);_0x2a34db(null);};}for(var e in events){if(events[_0xc616('0x6')](e)){var event=events[e];ChatWebsite[_0xc616('0x7')](e,emitEvent(event));}}module[_0xc616('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6651e75..b644dcf 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 _0x0e52=['../../config/environment','define','chat_websites','lodash','util','request-promise','path','rimraf'];(function(_0x206510,_0x170973){var _0x87aba=function(_0x116e8e){while(--_0x116e8e){_0x206510['push'](_0x206510['shift']());}};_0x87aba(++_0x170973);}(_0x0e52,0x153));var _0x20e5=function(_0x5d3046,_0x3747c3){_0x5d3046=_0x5d3046-0x0;var _0x35a16d=_0x0e52[_0x5d3046];return _0x35a16d;};'use strict';var _=require(_0x20e5('0x0'));var util=require(_0x20e5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20e5('0x2'));var fs=require('fs');var path=require(_0x20e5('0x3'));var rimraf=require(_0x20e5('0x4'));var config=require(_0x20e5('0x5'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x24cff1,_0x2f5717){return _0x24cff1[_0x20e5('0x6')]('ChatWebsite',attributes,{'tableName':_0x20e5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc73=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x4f1924,_0x47d070){var _0x5e6aa0=function(_0x34e78e){while(--_0x34e78e){_0x4f1924['push'](_0x4f1924['shift']());}};_0x5e6aa0(++_0x47d070);}(_0xfc73,0x150));var _0x3fc7=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xfc73[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var logger=require(_0x3fc7('0x2'))(_0x3fc7('0x3'));var moment=require('moment');var BPromise=require(_0x3fc7('0x4'));var rp=require(_0x3fc7('0x5'));var fs=require('fs');var path=require(_0x3fc7('0x6'));var rimraf=require(_0x3fc7('0x7'));var config=require('../../config/environment');var attributes=require(_0x3fc7('0x8'));module[_0x3fc7('0x9')]=function(_0x14cab2,_0x2a5229){return _0x14cab2[_0x3fc7('0xa')](_0x3fc7('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 9711d31..e5345c0 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 _0x9766=['socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x29872c,_0x14dc3d){var _0x4561b3=function(_0x32ed9a){while(--_0x32ed9a){_0x29872c['push'](_0x29872c['shift']());}};_0x4561b3(++_0x14dc3d);}(_0x9766,0x1c7));var _0x6976=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x9766[_0xea6018];return _0x57b54d;};'use strict';var _=require(_0x6976('0x0'));var util=require(_0x6976('0x1'));var moment=require(_0x6976('0x2'));var BPromise=require('bluebird');var rs=require(_0x6976('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6976('0x4'))['db'];var utils=require(_0x6976('0x5'));var logger=require('../../config/logger')(_0x6976('0x6'));var config=require(_0x6976('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6976('0x8')][_0x6976('0x9')]({'port':0x232a});config[_0x6976('0xa')]=_[_0x6976('0xb')](config[_0x6976('0xa')],{'host':_0x6976('0xc'),'port':0x18eb});var socket=require(_0x6976('0xd'))(new Redis(config[_0x6976('0xa')]));require(_0x6976('0xe'))[_0x6976('0xf')](socket);function respondWithRpcPromise(_0x46b5cc,_0x350e79,_0xa15dc){return new BPromise(function(_0xbcdef9,_0x56dbb1){return client['request'](_0x46b5cc,_0xa15dc)[_0x6976('0x10')](function(_0x376d1c){logger[_0x6976('0x11')](_0x6976('0x12'),_0x350e79,_0x6976('0x13'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x350e79,_0x6976('0x13'),JSON[_0x6976('0x14')](_0x376d1c));if(_0x376d1c[_0x6976('0x15')]){if(_0x376d1c[_0x6976('0x15')][_0x6976('0x16')]===0x1f4){logger[_0x6976('0x15')](_0x6976('0x12'),_0x350e79,_0x376d1c[_0x6976('0x15')][_0x6976('0x17')]);return _0x56dbb1(_0x376d1c[_0x6976('0x15')][_0x6976('0x17')]);}logger[_0x6976('0x15')](_0x6976('0x12'),_0x350e79,_0x376d1c['error']['message']);return _0xbcdef9(_0x376d1c[_0x6976('0x15')]['message']);}else{logger[_0x6976('0x11')](_0x6976('0x12'),_0x350e79,_0x6976('0x13'));_0xbcdef9(_0x376d1c[_0x6976('0x18')][_0x6976('0x17')]);}})[_0x6976('0x19')](function(_0x1ec379){logger[_0x6976('0x15')](_0x6976('0x12'),_0x350e79,_0x1ec379);_0x56dbb1(_0x1ec379);});});} \ No newline at end of file +var _0x4ad6=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f1eca,_0x46c4bf){var _0x49bae5=function(_0x4f476e){while(--_0x4f476e){_0x2f1eca['push'](_0x2f1eca['shift']());}};_0x49bae5(++_0x46c4bf);}(_0x4ad6,0xa3));var _0x64ad=function(_0x2f060a,_0x23732d){_0x2f060a=_0x2f060a-0x0;var _0x578f90=_0x4ad6[_0x2f060a];return _0x578f90;};'use strict';var _=require(_0x64ad('0x0'));var util=require(_0x64ad('0x1'));var moment=require(_0x64ad('0x2'));var BPromise=require(_0x64ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ad('0x4'))['db'];var utils=require(_0x64ad('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x64ad('0x6'));var jayson=require(_0x64ad('0x7'));var client=jayson[_0x64ad('0x8')]['http']({'port':0x232a});config['redis']=_[_0x64ad('0x9')](config[_0x64ad('0xa')],{'host':_0x64ad('0xb'),'port':0x18eb});var socket=require(_0x64ad('0xc'))(new Redis(config[_0x64ad('0xa')]));require(_0x64ad('0xd'))[_0x64ad('0xe')](socket);function respondWithRpcPromise(_0x3761ed,_0x5e936e,_0x11f471){return new BPromise(function(_0x5deb01,_0x213829){return client[_0x64ad('0xf')](_0x3761ed,_0x11f471)['then'](function(_0xe0ce21){logger['info'](_0x64ad('0x10'),_0x5e936e,_0x64ad('0x11'));logger[_0x64ad('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5e936e,_0x64ad('0x11'),JSON[_0x64ad('0x13')](_0xe0ce21));if(_0xe0ce21[_0x64ad('0x14')]){if(_0xe0ce21[_0x64ad('0x14')][_0x64ad('0x15')]===0x1f4){logger[_0x64ad('0x14')](_0x64ad('0x10'),_0x5e936e,_0xe0ce21[_0x64ad('0x14')][_0x64ad('0x16')]);return _0x213829(_0xe0ce21[_0x64ad('0x14')][_0x64ad('0x16')]);}logger['error'](_0x64ad('0x10'),_0x5e936e,_0xe0ce21[_0x64ad('0x14')]['message']);return _0x5deb01(_0xe0ce21['error'][_0x64ad('0x16')]);}else{logger[_0x64ad('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5e936e,'request\x20sent');_0x5deb01(_0xe0ce21[_0x64ad('0x18')][_0x64ad('0x16')]);}})[_0x64ad('0x19')](function(_0x53449b){logger[_0x64ad('0x14')](_0x64ad('0x10'),_0x5e936e,_0x53449b);_0x213829(_0x53449b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0fc570b..c492c7b 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 _0x4852=['remove','removeListener','register','./chatWebsite.events','save'];(function(_0xfdbc0,_0x3d360d){var _0x2e8d80=function(_0x3c5753){while(--_0x3c5753){_0xfdbc0['push'](_0xfdbc0['shift']());}};_0x2e8d80(++_0x3d360d);}(_0x4852,0xdf));var _0x2485=function(_0x310acc,_0x1ed1cf){_0x310acc=_0x310acc-0x0;var _0x3f6b95=_0x4852[_0x310acc];return _0x3f6b95;};'use strict';var ChatWebsiteEvents=require(_0x2485('0x0'));var events=[_0x2485('0x1'),_0x2485('0x2'),'update'];function createListener(_0x5cfd39,_0x418d49){return function(_0x3c9dd9){_0x418d49['emit'](_0x5cfd39,_0x3c9dd9);};}function removeListener(_0x499c82,_0x4d64ab){return function(){ChatWebsiteEvents[_0x2485('0x3')](_0x499c82,_0x4d64ab);};}exports[_0x2485('0x4')]=function(_0x578c5d){for(var _0x464142=0x0,_0x48bba1=events['length'];_0x464142<_0x48bba1;_0x464142++){var _0x3b56f9=events[_0x464142];var _0x41b127=createListener('chatWebsite:'+_0x3b56f9,_0x578c5d);ChatWebsiteEvents['on'](_0x3b56f9,_0x41b127);}}; \ No newline at end of file +var _0x13d7=['length','chatWebsite:','save','remove','update'];(function(_0x51a3c4,_0x5bd591){var _0x1930a6=function(_0x1ef7e4){while(--_0x1ef7e4){_0x51a3c4['push'](_0x51a3c4['shift']());}};_0x1930a6(++_0x5bd591);}(_0x13d7,0x93));var _0x713d=function(_0x23fdfd,_0xbc2fc4){_0x23fdfd=_0x23fdfd-0x0;var _0xa8491e=_0x13d7[_0x23fdfd];return _0xa8491e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x713d('0x0'),_0x713d('0x1'),_0x713d('0x2')];function createListener(_0x550108,_0xc62ee1){return function(_0x511e3d){_0xc62ee1['emit'](_0x550108,_0x511e3d);};}function removeListener(_0x14b63b,_0x4ab99a){return function(){ChatWebsiteEvents['removeListener'](_0x14b63b,_0x4ab99a);};}exports['register']=function(_0x562208){for(var _0x1131af=0x0,_0x1cf910=events[_0x713d('0x3')];_0x1131af<_0x1cf910;_0x1131af++){var _0x402dda=events[_0x1131af];var _0x50113e=createListener(_0x713d('0x4')+_0x402dda,_0x562208);ChatWebsiteEvents['on'](_0x402dda,_0x50113e);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 29b553d..ddf3192 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 _0x0a2a=['diskStorage','format','%s-%s','now','originalname','single','file','addLogo','join','root','server/files/images/avatars/','addAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','addDisposition'];(function(_0xdb1da9,_0x53f173){var _0x15da74=function(_0x40ccd2){while(--_0x40ccd2){_0xdb1da9['push'](_0xdb1da9['shift']());}};_0x15da74(++_0x53f173);}(_0x0a2a,0x103));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa0a2('0x0'));var util=require(_0xa0a2('0x1'));var path=require(_0xa0a2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0a2('0x3'));var router=express['Router']();var fs_extra=require(_0xa0a2('0x4'));var auth=require(_0xa0a2('0x5'));var interaction=require(_0xa0a2('0x6'));var config=require(_0xa0a2('0x7'));var controller=require(_0xa0a2('0x8'));router[_0xa0a2('0x9')]('/',auth[_0xa0a2('0xa')](),controller[_0xa0a2('0xb')]);router['get'](_0xa0a2('0xc'),auth[_0xa0a2('0xa')](),controller['describe']);router[_0xa0a2('0x9')](_0xa0a2('0xd'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0xe')]);router[_0xa0a2('0x9')](_0xa0a2('0xf'),auth['isAuthenticated'](),controller[_0xa0a2('0x10')]);router[_0xa0a2('0x9')](_0xa0a2('0x11'),auth['isAuthenticated'](),controller[_0xa0a2('0x12')]);router[_0xa0a2('0x9')]('/:id/logo',controller[_0xa0a2('0x13')]);router[_0xa0a2('0x9')](_0xa0a2('0x14'),controller[_0xa0a2('0x15')]);router['get'](_0xa0a2('0x16'),controller[_0xa0a2('0x17')]);router['get'](_0xa0a2('0x18'),controller[_0xa0a2('0x19')]);router[_0xa0a2('0x9')](_0xa0a2('0x1a'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x1b')]);router['get'](_0xa0a2('0x1c'),controller[_0xa0a2('0x1d')]);router[_0xa0a2('0x9')](_0xa0a2('0x1e'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x1f')]);router[_0xa0a2('0x9')](_0xa0a2('0x20'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x21')]);router[_0xa0a2('0x9')](_0xa0a2('0x22'),controller[_0xa0a2('0x23')]);router[_0xa0a2('0x9')](_0xa0a2('0x24'),auth['isAuthenticated'](),controller[_0xa0a2('0x25')]);router[_0xa0a2('0x9')]('/:id/users',auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x26')]);router[_0xa0a2('0x27')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa0a2('0x27')](_0xa0a2('0xf'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x28')]);router[_0xa0a2('0x27')](_0xa0a2('0x11'),auth[_0xa0a2('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xa0a2('0x29')]({'destination':function(_0xb4024a,_0x2f1683,_0x4720d5){_0x4720d5(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x1e1751,_0x45cf66,_0x4febdc){_0x4febdc(null,util[_0xa0a2('0x2a')](_0xa0a2('0x2b'),Date[_0xa0a2('0x2c')](),_0x45cf66[_0xa0a2('0x2d')]));}})});router[_0xa0a2('0x27')]('/:id/logo',upload[_0xa0a2('0x2e')](_0xa0a2('0x2f')),controller[_0xa0a2('0x30')]);var upload=multer({'storage':multer[_0xa0a2('0x29')]({'destination':function(_0x9e61ab,_0x3269e4,_0x2b1406){_0x2b1406(null,path[_0xa0a2('0x31')](config[_0xa0a2('0x32')],_0xa0a2('0x33')));},'filename':function(_0x14ad89,_0x427d61,_0x250387){_0x250387(null,util[_0xa0a2('0x2a')](_0xa0a2('0x2b'),Date[_0xa0a2('0x2c')](),_0x427d61[_0xa0a2('0x2d')]));}})});router[_0xa0a2('0x27')]('/:id/avatar',upload[_0xa0a2('0x2e')](_0xa0a2('0x2f')),controller[_0xa0a2('0x34')]);var upload=multer({'storage':multer[_0xa0a2('0x29')]({'destination':function(_0x5ada9f,_0x54d67f,_0x3d5b6a){_0x3d5b6a(null,path[_0xa0a2('0x31')](config[_0xa0a2('0x32')],_0xa0a2('0x33')));},'filename':function(_0x1e6cbd,_0x5cb78a,_0x47c3a1){_0x47c3a1(null,util[_0xa0a2('0x2a')](_0xa0a2('0x2b'),Date[_0xa0a2('0x2c')](),_0x5cb78a[_0xa0a2('0x2d')]));}})});router['post']('/:id/customer_avatar',upload[_0xa0a2('0x2e')](_0xa0a2('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa0a2('0x29')]({'destination':function(_0x2f8e41,_0x4787a4,_0x3d2c7a){_0x3d2c7a(null,path[_0xa0a2('0x31')](config[_0xa0a2('0x32')],_0xa0a2('0x33')));},'filename':function(_0x1024b8,_0x1592ce,_0x272286){_0x272286(null,util['format'](_0xa0a2('0x2b'),Date['now'](),_0x1592ce[_0xa0a2('0x2d')]));}})});router[_0xa0a2('0x27')](_0xa0a2('0x18'),upload[_0xa0a2('0x2e')](_0xa0a2('0x2f')),controller[_0xa0a2('0x35')]);router[_0xa0a2('0x27')](_0xa0a2('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5d2e40,_0x606bc,_0x2e20f1){const _0x89939d=path[_0xa0a2('0x31')](config[_0xa0a2('0x32')],_0xa0a2('0x37'),_0xa0a2('0x38'),_0xa0a2('0x39'));fs_extra[_0xa0a2('0x3a')](_0x89939d,function(){_0x2e20f1(null,_0x89939d);});},'filename':function(_0x2b0619,_0x4ce220,_0x37dc4a){const _0x103e41=_0x4ce220['originalname'][_0xa0a2('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xfaf99e=path[_0xa0a2('0x3c')](_0x103e41);const _0x6adae4=Date['now']()+'-'+_0x103e41[_0xa0a2('0x3b')](_0xfaf99e,'')+_0xfaf99e;_0x37dc4a(null,_0x6adae4);}})});router[_0xa0a2('0x27')](_0xa0a2('0x3d'),offlineUploadMulter[_0xa0a2('0x3e')](),controller[_0xa0a2('0x3f')]);router[_0xa0a2('0x27')](_0xa0a2('0x1a'),auth[_0xa0a2('0xa')](),controller['addInteraction']);router[_0xa0a2('0x27')](_0xa0a2('0x1e'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x40')]);router[_0xa0a2('0x27')]('/:id/proactive_actions',auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x41')]);router['post'](_0xa0a2('0x42'),auth['isAuthenticated'](),controller[_0xa0a2('0x43')]);router[_0xa0a2('0x44')](_0xa0a2('0xd'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x45')]);router[_0xa0a2('0x46')]('/:id',auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x47')]);router[_0xa0a2('0x46')](_0xa0a2('0xf'),auth['isAuthenticated'](),controller[_0xa0a2('0x48')]);router[_0xa0a2('0x46')]('/:id/canned_answers',auth[_0xa0a2('0xa')](),controller['removeAnswers']);router[_0xa0a2('0x46')](_0xa0a2('0x42'),auth[_0xa0a2('0xa')](),controller[_0xa0a2('0x49')]);module[_0xa0a2('0x4a')]=router; \ No newline at end of file +var _0x229d=['/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','addAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','offline','addInteraction','addProactiveActions','/:id/users','put','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe'];(function(_0x4de4a0,_0x1a4ded){var _0x5e8e22=function(_0x168b8a){while(--_0x168b8a){_0x4de4a0['push'](_0x4de4a0['shift']());}};_0x5e8e22(++_0x1a4ded);}(_0x229d,0x153));var _0xd229=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x229d[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xd229('0x0'));var util=require(_0xd229('0x1'));var path=require(_0xd229('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd229('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd229('0x4'));var config=require(_0xd229('0x5'));var controller=require(_0xd229('0x6'));router[_0xd229('0x7')]('/',auth[_0xd229('0x8')](),controller[_0xd229('0x9')]);router[_0xd229('0x7')](_0xd229('0xa'),auth[_0xd229('0x8')](),controller['describe']);router['get'](_0xd229('0xb'),auth[_0xd229('0x8')](),controller[_0xd229('0xc')]);router[_0xd229('0x7')](_0xd229('0xd'),auth[_0xd229('0x8')](),controller[_0xd229('0xe')]);router['get']('/:id/canned_answers',auth[_0xd229('0x8')](),controller[_0xd229('0xf')]);router['get'](_0xd229('0x10'),controller['getLogo']);router[_0xd229('0x7')]('/:id/avatar',controller[_0xd229('0x11')]);router[_0xd229('0x7')](_0xd229('0x12'),controller[_0xd229('0x13')]);router[_0xd229('0x7')](_0xd229('0x14'),controller[_0xd229('0x15')]);router[_0xd229('0x7')](_0xd229('0x16'),auth[_0xd229('0x8')](),controller[_0xd229('0x17')]);router['get'](_0xd229('0x18'),controller[_0xd229('0x19')]);router[_0xd229('0x7')](_0xd229('0x1a'),auth[_0xd229('0x8')](),controller[_0xd229('0x1b')]);router[_0xd229('0x7')](_0xd229('0x1c'),auth[_0xd229('0x8')](),controller[_0xd229('0x1d')]);router[_0xd229('0x7')]('/:id/fields',controller[_0xd229('0x1e')]);router['get'](_0xd229('0x1f'),auth['isAuthenticated'](),controller[_0xd229('0x20')]);router[_0xd229('0x7')]('/:id/users',auth[_0xd229('0x8')](),controller[_0xd229('0x21')]);router[_0xd229('0x22')]('/',auth[_0xd229('0x8')](),controller[_0xd229('0x23')]);router[_0xd229('0x22')](_0xd229('0xd'),auth[_0xd229('0x8')](),controller[_0xd229('0x24')]);router[_0xd229('0x22')](_0xd229('0x25'),auth[_0xd229('0x8')](),controller[_0xd229('0x26')]);var upload=multer({'storage':multer[_0xd229('0x27')]({'destination':function(_0x1b3c8e,_0xb7359,_0xcf605c){_0xcf605c(null,path['join'](config[_0xd229('0x28')],_0xd229('0x29')));},'filename':function(_0x3fce4a,_0x365e27,_0x4bb8a1){_0x4bb8a1(null,util[_0xd229('0x2a')](_0xd229('0x2b'),Date[_0xd229('0x2c')](),_0x365e27[_0xd229('0x2d')]));}})});router[_0xd229('0x22')](_0xd229('0x10'),upload[_0xd229('0x2e')](_0xd229('0x2f')),controller[_0xd229('0x30')]);var upload=multer({'storage':multer[_0xd229('0x27')]({'destination':function(_0x24963c,_0x26ce15,_0x46f580){_0x46f580(null,path[_0xd229('0x31')](config[_0xd229('0x28')],_0xd229('0x32')));},'filename':function(_0xd84f67,_0x8ecb51,_0x48328c){_0x48328c(null,util[_0xd229('0x2a')](_0xd229('0x2b'),Date['now'](),_0x8ecb51[_0xd229('0x2d')]));}})});router[_0xd229('0x22')]('/:id/avatar',upload[_0xd229('0x2e')](_0xd229('0x2f')),controller[_0xd229('0x33')]);var upload=multer({'storage':multer[_0xd229('0x27')]({'destination':function(_0xbcb28b,_0x477775,_0x3ceb50){_0x3ceb50(null,path[_0xd229('0x31')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x48852a,_0x188b16,_0xa20f8b){_0xa20f8b(null,util['format'](_0xd229('0x2b'),Date[_0xd229('0x2c')](),_0x188b16[_0xd229('0x2d')]));}})});router[_0xd229('0x22')](_0xd229('0x12'),upload[_0xd229('0x2e')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xd229('0x27')]({'destination':function(_0x3b2cc1,_0x37e0ad,_0x3fe16c){_0x3fe16c(null,path[_0xd229('0x31')](config[_0xd229('0x28')],_0xd229('0x32')));},'filename':function(_0x26c1d6,_0x41adc7,_0x548089){_0x548089(null,util[_0xd229('0x2a')](_0xd229('0x2b'),Date[_0xd229('0x2c')](),_0x41adc7['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xd229('0x2e')](_0xd229('0x2f')),controller['addSystemAvatar']);router[_0xd229('0x22')](_0xd229('0x34'),controller[_0xd229('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1068a2,_0x5cafed,_0x54cd91){const _0x174fcb=path[_0xd229('0x31')](config['root'],_0xd229('0x36'),_0xd229('0x37'),_0xd229('0x38'));fs_extra[_0xd229('0x39')](_0x174fcb,function(){_0x54cd91(null,_0x174fcb);});},'filename':function(_0x57e754,_0x10e476,_0x3520fe){const _0x5d1ec4=_0x10e476[_0xd229('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x400cc1=path['extname'](_0x5d1ec4);const _0x3d9fc0=Date[_0xd229('0x2c')]()+'-'+_0x5d1ec4[_0xd229('0x3a')](_0x400cc1,'')+_0x400cc1;_0x3520fe(null,_0x3d9fc0);}})});router[_0xd229('0x22')](_0xd229('0x3b'),offlineUploadMulter['any'](),controller[_0xd229('0x3c')]);router[_0xd229('0x22')](_0xd229('0x16'),auth[_0xd229('0x8')](),controller[_0xd229('0x3d')]);router['post'](_0xd229('0x1a'),auth[_0xd229('0x8')](),controller['addApplications']);router[_0xd229('0x22')](_0xd229('0x1c'),auth['isAuthenticated'](),controller[_0xd229('0x3e')]);router[_0xd229('0x22')](_0xd229('0x3f'),auth[_0xd229('0x8')](),controller['addAgents']);router[_0xd229('0x40')](_0xd229('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd229('0xb'),auth[_0xd229('0x8')](),controller[_0xd229('0x41')]);router['delete'](_0xd229('0xd'),auth[_0xd229('0x8')](),controller[_0xd229('0x42')]);router['delete'](_0xd229('0x25'),auth[_0xd229('0x8')](),controller[_0xd229('0x43')]);router['delete'](_0xd229('0x3f'),auth[_0xd229('0x8')](),controller[_0xd229('0x44')]);module[_0xd229('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index b822dd2..b88beda 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89ce=['exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x235f89,_0x366bd5){var _0x51326e=function(_0x47cec6){while(--_0x47cec6){_0x235f89['push'](_0x235f89['shift']());}};_0x51326e(++_0x366bd5);}(_0x89ce,0x12c));var _0xe89c=function(_0x247f53,_0x3784fc){_0x247f53=_0x247f53-0x0;var _0x13d519=_0x89ce[_0x247f53];return _0x13d519;};var beaverLogger=require(_0xe89c('0x0'));var express=require(_0xe89c('0x1'));var auth=require(_0xe89c('0x2'));var config=require(_0xe89c('0x3'));var router=express[_0xe89c('0x4')]();var isProduction=config[_0xe89c('0x5')]===_0xe89c('0x6')||![];function clientSideLogs(_0x36ab3f,_0x380d5b,_0x8316a9){var _0x56115f=_0x36ab3f['app'][_0xe89c('0x7')]('client-side-logger');if(!_0x56115f){throw new Error(_0xe89c('0x8'));}return beaverLogger[_0xe89c('0x9')]({'uri':_0xe89c('0xa'),'logger':_0x56115f,'enableCors':!isProduction})(_0x36ab3f,_0x380d5b,_0x8316a9);}router[_0xe89c('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0xe89c('0xc')]=router; \ No newline at end of file +var _0x6dba=['../config/environment','Router','env','production','client-side-logger','expressEndpoint','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x1383fe,_0x5f398d){var _0x2368c4=function(_0x2b23f1){while(--_0x2b23f1){_0x1383fe['push'](_0x1383fe['shift']());}};_0x2368c4(++_0x5f398d);}(_0x6dba,0x13c));var _0xa6db=function(_0x1dfa55,_0x1d2007){_0x1dfa55=_0x1dfa55-0x0;var _0x893d0e=_0x6dba[_0x1dfa55];return _0x893d0e;};var beaverLogger=require(_0xa6db('0x0'));var express=require(_0xa6db('0x1'));var auth=require(_0xa6db('0x2'));var config=require(_0xa6db('0x3'));var router=express[_0xa6db('0x4')]();var isProduction=config[_0xa6db('0x5')]===_0xa6db('0x6')||![];function clientSideLogs(_0xd91d17,_0x56ba78,_0xf09ca4){var _0x383ce4=_0xd91d17['app']['get'](_0xa6db('0x7'));if(!_0x383ce4){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xa6db('0x8')]({'uri':'/client-logs','logger':_0x383ce4,'enableCors':!isProduction})(_0xd91d17,_0x56ba78,_0xf09ca4);}router['use'](auth[_0xa6db('0x9')](),clientSideLogs);module[_0xa6db('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e72cd24..d8f79a3 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 _0x7138=['MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x9061b7,_0x357112){var _0x3823ab=function(_0x16b466){while(--_0x16b466){_0x9061b7['push'](_0x9061b7['shift']());}};_0x3823ab(++_0x357112);}(_0x7138,0x79));var _0x8713=function(_0x5767d1,_0x20323b){_0x5767d1=_0x5767d1-0x0;var _0x37b060=_0x7138[_0x5767d1];return _0x37b060;};'use strict';var Sequelize=require(_0x8713('0x0'));module[_0x8713('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8713('0x2')](_0x8713('0x3'),_0x8713('0x4'),_0x8713('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8713('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x8713('0x6')],'comment':_0x8713('0x7')},'data2':{'type':Sequelize[_0x8713('0x6')],'comment':_0x8713('0x8')},'data3':{'type':Sequelize[_0x8713('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x8713('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x8713('0x9')],'comment':_0x8713('0xa')},'data6':{'type':Sequelize[_0x8713('0x9')],'comment':_0x8713('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xb279=['MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','Google'];(function(_0x14076f,_0x64215){var _0x4c5c33=function(_0x644be9){while(--_0x644be9){_0x14076f['push'](_0x14076f['shift']());}};_0x4c5c33(++_0x64215);}(_0xb279,0x19b));var _0x9b27=function(_0x5ca7e4,_0x31fb83){_0x5ca7e4=_0x5ca7e4-0x0;var _0x3ff5fe=_0xb279[_0x5ca7e4];return _0x3ff5fe;};'use strict';var Sequelize=require(_0x9b27('0x0'));module[_0x9b27('0x1')]={'name':{'type':Sequelize[_0x9b27('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9b27('0x3')]('AmazonAWS',_0x9b27('0x4'),_0x9b27('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9b27('0x3')]('Outlook365',_0x9b27('0x6'))},'data1':{'type':Sequelize[_0x9b27('0x2')],'comment':_0x9b27('0x7')},'data2':{'type':Sequelize[_0x9b27('0x2')],'comment':_0x9b27('0x8')},'data3':{'type':Sequelize[_0x9b27('0x2')],'comment':_0x9b27('0x9')},'data4':{'type':Sequelize[_0x9b27('0x2')],'comment':_0x9b27('0xa')},'data5':{'type':Sequelize[_0x9b27('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x9b27('0xb')],'comment':_0x9b27('0xc')},'data7':{'type':Sequelize[_0x9b27('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b0fa820..b1baa2f 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 _0xe77c=['encryptString','create','oauth2MicrosoftAuthorize','findOne','sendStatus','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','access_token','data6','refresh_token','data5','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','name','send','padEnd','slice','index','map','CloudProvider','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','findAll','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','keys','includeAll','include','find','service','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x48f0f8,_0x8b2a3a){var _0x44c67b=function(_0xea1b96){while(--_0xea1b96){_0x48f0f8['push'](_0x48f0f8['shift']());}};_0x44c67b(++_0x8b2a3a);}(_0xe77c,0xe0));var _0xce77=function(_0x485507,_0x9ab47f){_0x485507=_0x485507-0x0;var _0x1f79e7=_0xe77c[_0x485507];return _0x1f79e7;};'use strict';var _=require(_0xce77('0x0'));var Redis=require(_0xce77('0x1'));var qs=require(_0xce77('0x2'));var encryptor=require(_0xce77('0x3'));var config=require('../../config/environment');var logger=require(_0xce77('0x4'))('api');var db=require(_0xce77('0x5'))['db'];var oauth=require(_0xce77('0x6'));config['redis']=_[_0xce77('0x7')](config[_0xce77('0x8')],{'host':_0xce77('0x9'),'port':0x18eb});var socket=require(_0xce77('0xa'))(new Redis(config[_0xce77('0x8')]));var redis=new Redis(config[_0xce77('0x8')]);function respondWithStatusCode(_0x5e6391,_0x351983){_0x351983=_0x351983||0xcc;return function(_0x47a079){if(_0x47a079){return _0x5e6391['sendStatus'](_0x351983);}return _0x5e6391[_0xce77('0xb')](_0x351983)[_0xce77('0xc')]();};}function respondWithResult(_0x450b33,_0x2b11ff){_0x2b11ff=_0x2b11ff||0xc8;return function(_0x2a0bf0){if(_0x2a0bf0){return _0x450b33[_0xce77('0xb')](_0x2b11ff)[_0xce77('0xd')](_0x2a0bf0);}};}function respondWithFilteredResult(_0x47b414,_0x55d7af){return function(_0xb77809){if(_0xb77809){var _0xaa26b2=typeof _0x55d7af[_0xce77('0xe')]===_0xce77('0xf')&&typeof _0x55d7af[_0xce77('0x10')]===_0xce77('0xf');var _0x49d216=_0xb77809[_0xce77('0x11')];var _0x5a9441=_0xaa26b2?0x0:_0x55d7af[_0xce77('0xe')];var _0x2b4ed7=_0xaa26b2?_0xb77809['count']:_0x55d7af[_0xce77('0xe')]+_0x55d7af[_0xce77('0x10')];var _0x878a39;if(_0x2b4ed7>=_0x49d216){_0x2b4ed7=_0x49d216;_0x878a39=0xc8;}else{_0x878a39=0xce;}_0x47b414[_0xce77('0xb')](_0x878a39);return _0x47b414[_0xce77('0x12')](_0xce77('0x13'),_0x5a9441+'-'+_0x2b4ed7+'/'+_0x49d216)[_0xce77('0xd')](_0xb77809);}return null;};}function saveUpdates(_0x585749){return function(_0x1affcb){if(_0x1affcb){return _0x1affcb[_0xce77('0x14')](_0x585749)['then'](function(_0x53c831){return _0x53c831;});}return null;};}function removeEntity(_0x33e2e1){return function(_0x31a779){if(_0x31a779){return _0x31a779[_0xce77('0x15')]()[_0xce77('0x16')](function(){_0x33e2e1[_0xce77('0xb')](0xcc)[_0xce77('0xc')]();});}};}function handleEntityNotFound(_0x15484b){return function(_0x28cdd8){if(!_0x28cdd8){_0x15484b['sendStatus'](0x194);}return _0x28cdd8;};}function handleError(_0xba1884,_0x16e866){_0x16e866=_0x16e866||0x1f4;return function(_0x50b474){logger[_0xce77('0x17')](_0x50b474['stack']);if(_0x50b474[_0xce77('0x18')]){delete _0x50b474['name'];}_0xba1884[_0xce77('0xb')](_0x16e866)[_0xce77('0x19')](_0x50b474);};}function maskClientSecret(_0x4fdca7){return _[_0xce77('0x1a')](_0x4fdca7[_0xce77('0x1b')](0x0,0x3),0x14,'*');}exports[_0xce77('0x1c')]=function(_0x3ec4ab,_0x1d6c54){var _0x3fe0e9={},_0x3b625b={},_0x526b82={'count':0x0,'rows':[]};var _0x3f727a=_[_0xce77('0x1d')](db[_0xce77('0x1e')]['rawAttributes'],function(_0xb41c65){return{'name':_0xb41c65['fieldName'],'type':_0xb41c65['type'][_0xce77('0x1f')]};});_0x3b625b['model']=_[_0xce77('0x1d')](_0x3f727a,'name');_0x3b625b[_0xce77('0x20')]=_['keys'](_0x3ec4ab['query']);_0x3b625b['filters']=_[_0xce77('0x21')](_0x3b625b['model'],_0x3b625b[_0xce77('0x20')]);_0x3fe0e9['attributes']=_[_0xce77('0x21')](_0x3b625b[_0xce77('0x22')],qs['fields'](_0x3ec4ab[_0xce77('0x20')][_0xce77('0x23')]));_0x3fe0e9[_0xce77('0x24')]=_0x3fe0e9[_0xce77('0x24')][_0xce77('0x25')]?_0x3fe0e9[_0xce77('0x24')]:_0x3b625b[_0xce77('0x22')];if(!_0x3ec4ab[_0xce77('0x20')][_0xce77('0x26')](_0xce77('0x27'))){_0x3fe0e9[_0xce77('0x10')]=qs[_0xce77('0x10')](_0x3ec4ab[_0xce77('0x20')][_0xce77('0x10')]);_0x3fe0e9[_0xce77('0xe')]=qs['offset'](_0x3ec4ab[_0xce77('0x20')]['offset']);}_0x3fe0e9[_0xce77('0x28')]=qs[_0xce77('0x29')](_0x3ec4ab[_0xce77('0x20')][_0xce77('0x29')]);_0x3fe0e9[_0xce77('0x2a')]=qs[_0xce77('0x2b')](_[_0xce77('0x2c')](_0x3ec4ab['query'],_0x3b625b[_0xce77('0x2b')]),_0x3f727a);if(_0x3ec4ab[_0xce77('0x20')][_0xce77('0x2d')]){_0x3fe0e9[_0xce77('0x2a')]=_[_0xce77('0x2e')](_0x3fe0e9[_0xce77('0x2a')],{'$or':_[_0xce77('0x1d')](_0x3f727a,function(_0x50c15f){if(_0x50c15f[_0xce77('0x2f')]!=='VIRTUAL'){var _0x44eff3={};_0x44eff3[_0x50c15f[_0xce77('0x18')]]={'$like':'%'+_0x3ec4ab[_0xce77('0x20')]['filter']+'%'};return _0x44eff3;}})});}_0x3fe0e9=_['merge']({},_0x3fe0e9,_0x3ec4ab[_0xce77('0x30')]);var _0x1775a5={'where':_0x3fe0e9[_0xce77('0x2a')]};return db['CloudProvider']['count'](_0x1775a5)[_0xce77('0x16')](function(_0x564e0a){_0x526b82[_0xce77('0x11')]=_0x564e0a;if(_0x3ec4ab[_0xce77('0x20')]['includeAll']){_0x3fe0e9['include']=[{'all':!![]}];}return db[_0xce77('0x1e')][_0xce77('0x31')](_0x3fe0e9);})['then'](function(_0x33d369){_0x526b82['rows']=_[_0xce77('0x1d')](_0x33d369,function(_0x2cbe37){if(_0x2cbe37['service']===_0xce77('0x32')){var _0x1c012a=encryptor[_0xce77('0x33')](_0x2cbe37[_0xce77('0x34')]);_0x2cbe37['data3']=maskClientSecret(_0x1c012a);}return _0x2cbe37;});return _0x526b82;})[_0xce77('0x16')](respondWithFilteredResult(_0x1d6c54,_0x3fe0e9))[_0xce77('0x35')](handleError(_0x1d6c54,null));};exports[_0xce77('0x36')]=function(_0x1592e3,_0x585f1b){var _0x13d3b9={'raw':!![],'where':{'id':_0x1592e3[_0xce77('0x37')]['id']}},_0x513fe1={};_0x513fe1[_0xce77('0x22')]=_['keys'](db[_0xce77('0x1e')][_0xce77('0x38')]);_0x513fe1[_0xce77('0x20')]=_[_0xce77('0x39')](_0x1592e3[_0xce77('0x20')]);_0x513fe1[_0xce77('0x2b')]=_['intersection'](_0x513fe1[_0xce77('0x22')],_0x513fe1[_0xce77('0x20')]);_0x13d3b9[_0xce77('0x24')]=_[_0xce77('0x21')](_0x513fe1[_0xce77('0x22')],qs['fields'](_0x1592e3[_0xce77('0x20')]['fields']));_0x13d3b9[_0xce77('0x24')]=_0x13d3b9[_0xce77('0x24')][_0xce77('0x25')]?_0x13d3b9[_0xce77('0x24')]:_0x513fe1[_0xce77('0x22')];if(_0x1592e3[_0xce77('0x20')][_0xce77('0x3a')]){_0x13d3b9[_0xce77('0x3b')]=[{'all':!![]}];}_0x13d3b9=_[_0xce77('0x2e')]({},_0x13d3b9,_0x1592e3['options']);return db[_0xce77('0x1e')][_0xce77('0x3c')](_0x13d3b9)[_0xce77('0x16')](handleEntityNotFound(_0x585f1b,null))[_0xce77('0x16')](function(_0x195dbc){if(_0x195dbc[_0xce77('0x3d')]===_0xce77('0x32')){var _0x3d0d9b=encryptor[_0xce77('0x33')](_0x195dbc['data3']);_0x195dbc[_0xce77('0x34')]=maskClientSecret(_0x3d0d9b);}return _0x195dbc;})[_0xce77('0x16')](respondWithResult(_0x585f1b,null))[_0xce77('0x35')](handleError(_0x585f1b,null));};exports['create']=function(_0x1b6287,_0x1f7211){if(!_0x1b6287[_0xce77('0x3e')]['name'])throw new Error(_0xce77('0x3f'));if(!_0x1b6287['body'][_0xce77('0x3d')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x43bef5=db[_0xce77('0x1e')][_0xce77('0x38')]['service'][_0xce77('0x40')];if(!_0x43bef5[_0xce77('0x41')](_0x1b6287['body'][_0xce77('0x3d')]))throw new Error(_0xce77('0x42')+_0x43bef5['join'](',\x20'));if(_0x1b6287[_0xce77('0x3e')][_0xce77('0x3d')]===_0xce77('0x32')&&_0x1b6287['body'][_0xce77('0x34')]){_0x1b6287[_0xce77('0x3e')][_0xce77('0x34')]=encryptor[_0xce77('0x43')](_0x1b6287[_0xce77('0x3e')][_0xce77('0x34')]);}return db[_0xce77('0x1e')][_0xce77('0x44')](_0x1b6287[_0xce77('0x3e')],{})['then'](respondWithResult(_0x1f7211,0xc9))[_0xce77('0x35')](handleError(_0x1f7211,null));};exports[_0xce77('0x14')]=function(_0x49a2b0,_0x3b9e90){if(_0x49a2b0[_0xce77('0x3e')]['id']){delete _0x49a2b0['body']['id'];}return db['CloudProvider'][_0xce77('0x3c')]({'where':{'id':_0x49a2b0[_0xce77('0x37')]['id']}})[_0xce77('0x16')](handleEntityNotFound(_0x3b9e90,null))[_0xce77('0x16')](function(_0x2b5726){if(_0x2b5726[_0xce77('0x3d')]===_0xce77('0x32')&&_0x49a2b0[_0xce77('0x3e')][_0xce77('0x34')]){_0x49a2b0[_0xce77('0x3e')][_0xce77('0x34')]=encryptor['encryptString'](_0x49a2b0[_0xce77('0x3e')][_0xce77('0x34')]);}return _0x2b5726;})['then'](saveUpdates(_0x49a2b0['body'],null))[_0xce77('0x16')](respondWithResult(_0x3b9e90,null))[_0xce77('0x35')](handleError(_0x3b9e90,null));};exports[_0xce77('0x15')]=function(_0xc75658,_0x31bd10){return db[_0xce77('0x1e')][_0xce77('0x3c')]({'where':{'id':_0xc75658['params']['id']}})[_0xce77('0x16')](handleEntityNotFound(_0x31bd10,null))[_0xce77('0x16')](removeEntity(_0x31bd10,null))[_0xce77('0x35')](handleError(_0x31bd10,null));};exports[_0xce77('0x45')]=function(_0x2da344,_0x1ed0f6){return db[_0xce77('0x1e')][_0xce77('0x46')]({'where':{'id':_0x2da344['params']['id']},'raw':!![]})[_0xce77('0x16')](function(_0x502520){if(!_0x502520)return _0x1ed0f6[_0xce77('0x47')](0x194);return{'url':oauth[_0xce77('0x48')](_0x502520,_0x2da344[_0xce77('0x49')]['id'])};})[_0xce77('0x16')](respondWithResult(_0x1ed0f6,null))['catch'](handleError(_0x1ed0f6,null));};exports[_0xce77('0x4a')]=function(_0x4f82af,_0x31c136){var _0x355540=_0x4f82af[_0xce77('0x3e')];var _0x46dd0f;var _0x2423d9;if(_0x355540['error'])throw _0x355540;redis[_0xce77('0x4b')](_0x355540[_0xce77('0x4c')])['then'](function(_0x32ca82){if(!_0x32ca82)throw new Error(_0xce77('0x4d'));_0x46dd0f=JSON[_0xce77('0x4e')](_0x32ca82);var _0x2966c1=Buffer['from'](_0x355540[_0xce77('0x4c')],_0xce77('0x4f'))[_0xce77('0x50')](_0xce77('0x51'));_0x2423d9=JSON['parse'](_0x2966c1);if(!oauth[_0xce77('0x52')](_0x355540[_0xce77('0x53')],_0x46dd0f[_0xce77('0x54')]))throw new Error(_0xce77('0x55'));redis[_0xce77('0x56')](_0x355540['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x355540['code'],_0x46dd0f);})[_0xce77('0x16')](function(_0x5a1de8){_0x46dd0f['data5']=_0x5a1de8[_0xce77('0x57')];_0x46dd0f[_0xce77('0x58')]=_0x5a1de8[_0xce77('0x59')];return db[_0xce77('0x1e')][_0xce77('0x14')]({'data5':_0x46dd0f[_0xce77('0x5a')],'data6':_0x46dd0f[_0xce77('0x58')]},{'where':{'id':_0x46dd0f['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x46dd0f);socket[_0xce77('0x5b')](_0xce77('0x5c'),{'id':_0x2423d9['id']});return;})['then'](respondWithStatusCode(_0x31c136,null))[_0xce77('0x35')](function(_0x4b0758){if(_0x2423d9){socket['emit'](_0xce77('0x5d'),{'id':_0x2423d9['id']});}if(!_0x46dd0f){logger[_0xce77('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x4b0758);return _0x31c136[_0xce77('0xb')](0x1f4)[_0xce77('0x19')](_0x4b0758[_0xce77('0x5e')]);}logger['error'](_0xce77('0x5f'),_0x46dd0f['id'],JSON[_0xce77('0x60')](_0x4b0758));});}; \ No newline at end of file +var _0x55aa=['Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','error','stack','name','send','slice','index','map','fieldName','key','keys','filters','intersection','query','model','fields','attributes','length','order','sort','where','pick','filter','merge','options','CloudProvider','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','find','create','body','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','params','findOne','generateMicrosoftAuthorizationUrl','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','Invalid\x20authentication\x20state\x20parameter','message'];(function(_0x48138d,_0x2442b1){var _0xd0c1f5=function(_0x7a7710){while(--_0x7a7710){_0x48138d['push'](_0x48138d['shift']());}};_0xd0c1f5(++_0x2442b1);}(_0x55aa,0x1d3));var _0xa55a=function(_0x10e106,_0x24ce0b){_0x10e106=_0x10e106-0x0;var _0x393565=_0x55aa[_0x10e106];return _0x393565;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xa55a('0x0'));var encryptor=require(_0xa55a('0x1'));var config=require(_0xa55a('0x2'));var logger=require(_0xa55a('0x3'))(_0xa55a('0x4'));var db=require(_0xa55a('0x5'))['db'];var oauth=require(_0xa55a('0x6'));config[_0xa55a('0x7')]=_[_0xa55a('0x8')](config[_0xa55a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xa55a('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0xa55a('0x7')]);function respondWithStatusCode(_0x2ba6d5,_0xe43776){_0xe43776=_0xe43776||0xcc;return function(_0x3639db){if(_0x3639db){return _0x2ba6d5[_0xa55a('0xa')](_0xe43776);}return _0x2ba6d5[_0xa55a('0xb')](_0xe43776)[_0xa55a('0xc')]();};}function respondWithResult(_0x3e3e4f,_0x3a5003){_0x3a5003=_0x3a5003||0xc8;return function(_0x28f2d7){if(_0x28f2d7){return _0x3e3e4f['status'](_0x3a5003)[_0xa55a('0xd')](_0x28f2d7);}};}function respondWithFilteredResult(_0x18a8c5,_0x3929fc){return function(_0x598dbb){if(_0x598dbb){var _0x4b05d1=typeof _0x3929fc['offset']===_0xa55a('0xe')&&typeof _0x3929fc[_0xa55a('0xf')]===_0xa55a('0xe');var _0x20cd7a=_0x598dbb[_0xa55a('0x10')];var _0x166425=_0x4b05d1?0x0:_0x3929fc[_0xa55a('0x11')];var _0x3ea1b1=_0x4b05d1?_0x598dbb[_0xa55a('0x10')]:_0x3929fc[_0xa55a('0x11')]+_0x3929fc[_0xa55a('0xf')];var _0x580121;if(_0x3ea1b1>=_0x20cd7a){_0x3ea1b1=_0x20cd7a;_0x580121=0xc8;}else{_0x580121=0xce;}_0x18a8c5[_0xa55a('0xb')](_0x580121);return _0x18a8c5[_0xa55a('0x12')]('Content-Range',_0x166425+'-'+_0x3ea1b1+'/'+_0x20cd7a)['json'](_0x598dbb);}return null;};}function saveUpdates(_0x4a820e){return function(_0x1142a3){if(_0x1142a3){return _0x1142a3[_0xa55a('0x13')](_0x4a820e)[_0xa55a('0x14')](function(_0x24eec2){return _0x24eec2;});}return null;};}function removeEntity(_0x27cce0){return function(_0x403415){if(_0x403415){return _0x403415['destroy']()[_0xa55a('0x14')](function(){_0x27cce0[_0xa55a('0xb')](0xcc)[_0xa55a('0xc')]();});}};}function handleEntityNotFound(_0x3bae3a){return function(_0x342f3e){if(!_0x342f3e){_0x3bae3a[_0xa55a('0xa')](0x194);}return _0x342f3e;};}function handleError(_0x351eb8,_0x1504c2){_0x1504c2=_0x1504c2||0x1f4;return function(_0xc94b04){logger[_0xa55a('0x15')](_0xc94b04[_0xa55a('0x16')]);if(_0xc94b04[_0xa55a('0x17')]){delete _0xc94b04[_0xa55a('0x17')];}_0x351eb8[_0xa55a('0xb')](_0x1504c2)[_0xa55a('0x18')](_0xc94b04);};}function maskClientSecret(_0x46df9b){return _['padEnd'](_0x46df9b[_0xa55a('0x19')](0x0,0x3),0x14,'*');}exports[_0xa55a('0x1a')]=function(_0x226cea,_0x368d38){var _0x3a08f6={},_0x2a9be6={},_0xdea6ee={'count':0x0,'rows':[]};var _0xf2ab0c=_[_0xa55a('0x1b')](db['CloudProvider']['rawAttributes'],function(_0x22ce0d){return{'name':_0x22ce0d[_0xa55a('0x1c')],'type':_0x22ce0d['type'][_0xa55a('0x1d')]};});_0x2a9be6['model']=_[_0xa55a('0x1b')](_0xf2ab0c,_0xa55a('0x17'));_0x2a9be6['query']=_[_0xa55a('0x1e')](_0x226cea['query']);_0x2a9be6[_0xa55a('0x1f')]=_[_0xa55a('0x20')](_0x2a9be6['model'],_0x2a9be6[_0xa55a('0x21')]);_0x3a08f6['attributes']=_[_0xa55a('0x20')](_0x2a9be6[_0xa55a('0x22')],qs[_0xa55a('0x23')](_0x226cea[_0xa55a('0x21')][_0xa55a('0x23')]));_0x3a08f6[_0xa55a('0x24')]=_0x3a08f6[_0xa55a('0x24')][_0xa55a('0x25')]?_0x3a08f6[_0xa55a('0x24')]:_0x2a9be6[_0xa55a('0x22')];if(!_0x226cea['query']['hasOwnProperty']('nolimit')){_0x3a08f6[_0xa55a('0xf')]=qs['limit'](_0x226cea['query'][_0xa55a('0xf')]);_0x3a08f6[_0xa55a('0x11')]=qs[_0xa55a('0x11')](_0x226cea[_0xa55a('0x21')][_0xa55a('0x11')]);}_0x3a08f6[_0xa55a('0x26')]=qs['sort'](_0x226cea[_0xa55a('0x21')][_0xa55a('0x27')]);_0x3a08f6[_0xa55a('0x28')]=qs[_0xa55a('0x1f')](_[_0xa55a('0x29')](_0x226cea[_0xa55a('0x21')],_0x2a9be6['filters']),_0xf2ab0c);if(_0x226cea[_0xa55a('0x21')][_0xa55a('0x2a')]){_0x3a08f6[_0xa55a('0x28')]=_['merge'](_0x3a08f6[_0xa55a('0x28')],{'$or':_['map'](_0xf2ab0c,function(_0x501121){if(_0x501121['type']!=='VIRTUAL'){var _0x139a4e={};_0x139a4e[_0x501121[_0xa55a('0x17')]]={'$like':'%'+_0x226cea[_0xa55a('0x21')][_0xa55a('0x2a')]+'%'};return _0x139a4e;}})});}_0x3a08f6=_[_0xa55a('0x2b')]({},_0x3a08f6,_0x226cea[_0xa55a('0x2c')]);var _0x559da5={'where':_0x3a08f6[_0xa55a('0x28')]};return db[_0xa55a('0x2d')][_0xa55a('0x10')](_0x559da5)[_0xa55a('0x14')](function(_0x82270){_0xdea6ee[_0xa55a('0x10')]=_0x82270;if(_0x226cea[_0xa55a('0x21')][_0xa55a('0x2e')]){_0x3a08f6[_0xa55a('0x2f')]=[{'all':!![]}];}return db[_0xa55a('0x2d')][_0xa55a('0x30')](_0x3a08f6);})[_0xa55a('0x14')](function(_0x1e5e72){_0xdea6ee['rows']=_['map'](_0x1e5e72,function(_0x411842){if(_0x411842[_0xa55a('0x31')]===_0xa55a('0x32')){var _0x2f7594=encryptor[_0xa55a('0x33')](_0x411842[_0xa55a('0x34')]);_0x411842[_0xa55a('0x34')]=maskClientSecret(_0x2f7594);}return _0x411842;});return _0xdea6ee;})[_0xa55a('0x14')](respondWithFilteredResult(_0x368d38,_0x3a08f6))[_0xa55a('0x35')](handleError(_0x368d38,null));};exports[_0xa55a('0x36')]=function(_0x18d274,_0x48d6b8){var _0x59f949={'raw':!![],'where':{'id':_0x18d274['params']['id']}},_0xb7c026={};_0xb7c026[_0xa55a('0x22')]=_['keys'](db[_0xa55a('0x2d')]['rawAttributes']);_0xb7c026[_0xa55a('0x21')]=_[_0xa55a('0x1e')](_0x18d274[_0xa55a('0x21')]);_0xb7c026[_0xa55a('0x1f')]=_[_0xa55a('0x20')](_0xb7c026[_0xa55a('0x22')],_0xb7c026[_0xa55a('0x21')]);_0x59f949['attributes']=_[_0xa55a('0x20')](_0xb7c026['model'],qs[_0xa55a('0x23')](_0x18d274[_0xa55a('0x21')]['fields']));_0x59f949[_0xa55a('0x24')]=_0x59f949[_0xa55a('0x24')][_0xa55a('0x25')]?_0x59f949[_0xa55a('0x24')]:_0xb7c026['model'];if(_0x18d274[_0xa55a('0x21')][_0xa55a('0x2e')]){_0x59f949[_0xa55a('0x2f')]=[{'all':!![]}];}_0x59f949=_[_0xa55a('0x2b')]({},_0x59f949,_0x18d274[_0xa55a('0x2c')]);return db[_0xa55a('0x2d')][_0xa55a('0x37')](_0x59f949)[_0xa55a('0x14')](handleEntityNotFound(_0x48d6b8,null))[_0xa55a('0x14')](function(_0x1ffc79){if(_0x1ffc79[_0xa55a('0x31')]===_0xa55a('0x32')){var _0x4e6300=encryptor['decryptString'](_0x1ffc79['data3']);_0x1ffc79[_0xa55a('0x34')]=maskClientSecret(_0x4e6300);}return _0x1ffc79;})['then'](respondWithResult(_0x48d6b8,null))[_0xa55a('0x35')](handleError(_0x48d6b8,null));};exports[_0xa55a('0x38')]=function(_0x947d5a,_0x29c6cb){if(!_0x947d5a[_0xa55a('0x39')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x947d5a['body']['service'])throw new Error(_0xa55a('0x3a'));var _0x135169=db['CloudProvider'][_0xa55a('0x3b')][_0xa55a('0x31')][_0xa55a('0x3c')];if(!_0x135169[_0xa55a('0x3d')](_0x947d5a['body']['service']))throw new Error(_0xa55a('0x3e')+_0x135169['join'](',\x20'));if(_0x947d5a['body']['service']===_0xa55a('0x32')&&_0x947d5a[_0xa55a('0x39')][_0xa55a('0x34')]){_0x947d5a[_0xa55a('0x39')]['data3']=encryptor[_0xa55a('0x3f')](_0x947d5a['body']['data3']);}return db[_0xa55a('0x2d')][_0xa55a('0x38')](_0x947d5a['body'],{})[_0xa55a('0x14')](respondWithResult(_0x29c6cb,0xc9))[_0xa55a('0x35')](handleError(_0x29c6cb,null));};exports[_0xa55a('0x13')]=function(_0x13a3ee,_0x6cd52b){if(_0x13a3ee['body']['id']){delete _0x13a3ee['body']['id'];}return db[_0xa55a('0x2d')]['find']({'where':{'id':_0x13a3ee[_0xa55a('0x40')]['id']}})['then'](handleEntityNotFound(_0x6cd52b,null))[_0xa55a('0x14')](function(_0x5bd374){if(_0x5bd374['service']===_0xa55a('0x32')&&_0x13a3ee[_0xa55a('0x39')]['data3']){_0x13a3ee[_0xa55a('0x39')][_0xa55a('0x34')]=encryptor[_0xa55a('0x3f')](_0x13a3ee[_0xa55a('0x39')][_0xa55a('0x34')]);}return _0x5bd374;})[_0xa55a('0x14')](saveUpdates(_0x13a3ee[_0xa55a('0x39')],null))[_0xa55a('0x14')](respondWithResult(_0x6cd52b,null))[_0xa55a('0x35')](handleError(_0x6cd52b,null));};exports['destroy']=function(_0x363a1e,_0x36a324){return db['CloudProvider'][_0xa55a('0x37')]({'where':{'id':_0x363a1e[_0xa55a('0x40')]['id']}})[_0xa55a('0x14')](handleEntityNotFound(_0x36a324,null))[_0xa55a('0x14')](removeEntity(_0x36a324,null))[_0xa55a('0x35')](handleError(_0x36a324,null));};exports['oauth2MicrosoftAuthorize']=function(_0x377b9f,_0x3534fd){return db[_0xa55a('0x2d')][_0xa55a('0x41')]({'where':{'id':_0x377b9f[_0xa55a('0x40')]['id']},'raw':!![]})['then'](function(_0x2723dc){if(!_0x2723dc)return _0x3534fd[_0xa55a('0xa')](0x194);return{'url':oauth[_0xa55a('0x42')](_0x2723dc,_0x377b9f['user']['id'])};})['then'](respondWithResult(_0x3534fd,null))[_0xa55a('0x35')](handleError(_0x3534fd,null));};exports['oauth2MicrosoftCallback']=function(_0xb1adf9,_0x4b4b10){var _0x6ccb56=_0xb1adf9[_0xa55a('0x39')];var _0x228499;var _0x292d80;if(_0x6ccb56[_0xa55a('0x15')])throw _0x6ccb56;redis[_0xa55a('0x43')](_0x6ccb56['state'])[_0xa55a('0x14')](function(_0x1ac8c6){if(!_0x1ac8c6)throw new Error(_0xa55a('0x44'));_0x228499=JSON[_0xa55a('0x45')](_0x1ac8c6);var _0x2fc731=Buffer[_0xa55a('0x46')](_0x6ccb56[_0xa55a('0x47')],_0xa55a('0x48'))[_0xa55a('0x49')](_0xa55a('0x4a'));_0x292d80=JSON['parse'](_0x2fc731);if(!oauth[_0xa55a('0x4b')](_0x6ccb56[_0xa55a('0x4c')],_0x228499[_0xa55a('0x4d')]))throw new Error(_0xa55a('0x4e'));redis[_0xa55a('0x4f')](_0x6ccb56['state']);return oauth[_0xa55a('0x50')](_0x6ccb56[_0xa55a('0x51')],_0x228499);})[_0xa55a('0x14')](function(_0x1948da){_0x228499[_0xa55a('0x52')]=_0x1948da[_0xa55a('0x53')];_0x228499[_0xa55a('0x54')]=_0x1948da[_0xa55a('0x55')];return db[_0xa55a('0x2d')][_0xa55a('0x13')]({'data5':_0x228499[_0xa55a('0x52')],'data6':_0x228499['data6']},{'where':{'id':_0x228499['id']}});})['then'](function(){oauth[_0xa55a('0x56')](_0x228499);socket['emit'](_0xa55a('0x57'),{'id':_0x292d80['id']});return;})[_0xa55a('0x14')](respondWithStatusCode(_0x4b4b10,null))['catch'](function(_0x28113c){if(_0x292d80){socket[_0xa55a('0x58')]('microsoftAuthorization:error',{'id':_0x292d80['id']});}if(!_0x228499){logger[_0xa55a('0x15')](_0xa55a('0x59'),_0x28113c);return _0x4b4b10[_0xa55a('0xb')](0x1f4)[_0xa55a('0x18')](_0x28113c[_0xa55a('0x5a')]);}logger[_0xa55a('0x15')](_0xa55a('0x5b'),_0x228499['id'],JSON[_0xa55a('0x5c')](_0x28113c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d721c5a..a1dd392 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 _0x3e9f=['exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x7fc04c,_0x1d87ff){var _0x3ffad0=function(_0x551ce5){while(--_0x551ce5){_0x7fc04c['push'](_0x7fc04c['shift']());}};_0x3ffad0(++_0x1d87ff);}(_0x3e9f,0x11b));var _0xf3e9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x3e9f[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xf3e9('0x0'));var util=require(_0xf3e9('0x1'));var logger=require(_0xf3e9('0x2'))(_0xf3e9('0x3'));var moment=require(_0xf3e9('0x4'));var BPromise=require(_0xf3e9('0x5'));var rp=require(_0xf3e9('0x6'));var fs=require('fs');var path=require(_0xf3e9('0x7'));var rimraf=require(_0xf3e9('0x8'));var config=require(_0xf3e9('0x9'));var attributes=require(_0xf3e9('0xa'));module[_0xf3e9('0xb')]=function(_0x3e461d,_0x5ddc24){return _0x3e461d['define'](_0xf3e9('0xc'),attributes,{'tableName':_0xf3e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e16=['../../config/logger','api','moment','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x57ff91,_0x55645f){var _0x2adba3=function(_0x3c82e4){while(--_0x3c82e4){_0x57ff91['push'](_0x57ff91['shift']());}};_0x2adba3(++_0x55645f);}(_0x7e16,0xd6));var _0x67e1=function(_0x1649e5,_0x324bc5){_0x1649e5=_0x1649e5-0x0;var _0x861e1f=_0x7e16[_0x1649e5];return _0x861e1f;};'use strict';var _=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var logger=require(_0x67e1('0x2'))(_0x67e1('0x3'));var moment=require(_0x67e1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x67e1('0x5'));var rimraf=require(_0x67e1('0x6'));var config=require('../../config/environment');var attributes=require(_0x67e1('0x7'));module[_0x67e1('0x8')]=function(_0x4bf49f,_0x2006e0){return _0x4bf49f[_0x67e1('0x9')](_0x67e1('0xa'),attributes,{'tableName':_0x67e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 6f5cc99..2ef662e 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12c1=['data1','join','data4','response_mode','form_post','scope','state','nonce','login','value','oauth2Claims','oauth2/','set','decode','iss','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','data6','decryptString','POST','access_token','refresh_token','update','data5','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','intervals','findAll','all','catch','inspect','error','exports','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../config/environment','../../config/logger','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','push','data7','/.default','type','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes'];(function(_0x22259a,_0xdd9141){var _0x365fbe=function(_0x426d88){while(--_0x426d88){_0x22259a['push'](_0x22259a['shift']());}};_0x365fbe(++_0xdd9141);}(_0x12c1,0x110));var _0x112c=function(_0xd1afda,_0x572fe4){_0xd1afda=_0xd1afda-0x0;var _0x596c69=_0x12c1[_0xd1afda];return _0x596c69;};'use strict';var _=require(_0x112c('0x0'));var crypto=require(_0x112c('0x1'));var jwt=require(_0x112c('0x2'));var moment=require(_0x112c('0x3'));var Redis=require(_0x112c('0x4'));var rp=require('request-promise');var util=require(_0x112c('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0x112c('0x6'));var logger=require(_0x112c('0x7'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x112c('0x8'))['db'];config[_0x112c('0x9')]=_['defaults'](config[_0x112c('0x9')],{'host':_0x112c('0xa'),'port':0x18eb});var redis=new Redis(config[_0x112c('0x9')]);var MICROSOFT_AUTH_URL=_0x112c('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x112c('0xc'),'email',_0x112c('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x112c('0xe'),_0x112c('0xf')],'Dynamics365':[_0x112c('0x10'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x112c('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x112c('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x455fae){var _0x348eab=_[_0x112c('0x13')](AZURE_AUTH_SCOPES[_0x455fae['type']]);if(_0x455fae['type']==='Dynamics365')_0x348eab[_0x112c('0x14')](_0x455fae[_0x112c('0x15')]+_0x112c('0x16'));return _0x348eab['join']('\x20');}function getAccessTokenScope(_0x4f38ba){if(_0x4f38ba[_0x112c('0x17')]===_0x112c('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x4f38ba['type']===_0x112c('0x19'))return _0x4f38ba['data7']+_0x112c('0x16');}function generateMicrosoftAuthorizationUrl(_0x17a9cf,_0x4af0bd){var _0x389cf6=MICROSOFT_AUTH_URL[_0x112c('0x1a')](_0x112c('0x1b'),_0x17a9cf[_0x112c('0x1c')]);var _0x2cab7a=[_0x112c('0x1d'),_0x112c('0x1e')];var _0x29b8a2=Buffer[_0x112c('0x1f')](JSON[_0x112c('0x20')]({'id':_0x4af0bd}))[_0x112c('0x21')](_0x112c('0x22'));var _0x190fa2=crypto[_0x112c('0x23')](0x10)[_0x112c('0x21')]('hex');var _0x569cee=getAuthorizationScopes(_0x17a9cf);var _0x16c8c0=[{'key':'client_id','value':_0x17a9cf[_0x112c('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x2cab7a[_0x112c('0x25')]('\x20'))},{'key':'redirect_uri','value':_0x17a9cf[_0x112c('0x26')]},{'key':_0x112c('0x27'),'value':_0x112c('0x28')},{'key':_0x112c('0x29'),'value':encodeURIComponent(_0x569cee)},{'key':_0x112c('0x2a'),'value':_0x29b8a2},{'key':_0x112c('0x2b'),'value':_0x190fa2},{'key':'prompt','value':_0x112c('0x2c')}];var _0x79ce71=_0x389cf6+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x112c('0x13')](_0x16c8c0,function(_0x5226f0){return _0x5226f0['key']+'='+_0x5226f0[_0x112c('0x2d')];})['join']('&');_0x17a9cf[_0x112c('0x2e')]={'issuer':_0x389cf6[_0x112c('0x1a')](_0x112c('0x2f'),''),'audience':_0x17a9cf[_0x112c('0x24')],'state':_0x29b8a2,'nonce':_0x190fa2};redis[_0x112c('0x30')](_0x29b8a2,JSON[_0x112c('0x20')](_0x17a9cf));return _0x79ce71;}function isValidIdToken(_0x3bae3d,_0x447412){try{var _0x494998=jwt[_0x112c('0x31')](_0x3bae3d,{'complete':!![]});var _0xb1c465=_0x494998['payload'];if(_0xb1c465[_0x112c('0x32')]!==_0x447412['issuer'])return![];if(_0xb1c465[_0x112c('0x33')]!==_0x447412[_0x112c('0x34')])return![];if(_0xb1c465[_0x112c('0x2b')]!==_0x447412[_0x112c('0x2b')])return![];if(moment()[_0x112c('0x35')](moment[_0x112c('0x36')](_0xb1c465[_0x112c('0x37')])))return![];return!![];}catch(_0x1627f6){throw _0x1627f6;}}function refreshOauth2MicrosoftAccessToken(_0x3bcf50){return Promise[_0x112c('0x38')]()[_0x112c('0x39')](function(){if(_0x3bcf50[_0x112c('0x3a')])return _0x3bcf50;return db[_0x112c('0x3b')]['findOne']({'where':{'id':_0x3bcf50['id']},'raw':!![]});})['then'](function(_0x39e2dc){var _0x2f32dc={'grant_type':'refresh_token','refresh_token':_0x39e2dc[_0x112c('0x3c')],'scope':getAccessTokenScope(_0x39e2dc),'redirect_uri':_0x39e2dc[_0x112c('0x26')],'client_id':_0x39e2dc[_0x112c('0x24')],'client_secret':encryptor[_0x112c('0x3d')](_0x39e2dc[_0x112c('0x3a')])};var _0x401a94={'method':_0x112c('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x112c('0x1a')](_0x112c('0x1b'),_0x39e2dc[_0x112c('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2f32dc,'json':!![]};return rp(_0x401a94);})[_0x112c('0x39')](function(_0x2af23b){_0x3bcf50['data5']=_0x2af23b[_0x112c('0x3f')];_0x3bcf50[_0x112c('0x3c')]=_0x2af23b[_0x112c('0x40')];return db['CloudProvider'][_0x112c('0x41')]({'data5':_0x3bcf50[_0x112c('0x42')],'data6':_0x3bcf50['data6']},{'where':{'id':_0x3bcf50['id']}});})[_0x112c('0x39')](function(){return _0x3bcf50;})['catch'](function(_0x233ed5){logger['error'](_0x112c('0x43'),_0x3bcf50['id'],_0x233ed5);});}function getOauth2MicrosoftAccessToken(_0x592f21,_0x36878d){var _0x11caad={'grant_type':_0x112c('0x44'),'code':_0x592f21,'scope':getAccessTokenScope(_0x36878d),'redirect_uri':_0x36878d[_0x112c('0x26')],'client_id':_0x36878d[_0x112c('0x24')],'client_secret':encryptor[_0x112c('0x3d')](_0x36878d[_0x112c('0x3a')])};var _0x3b121b={'method':_0x112c('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x112c('0x1b'),_0x36878d[_0x112c('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11caad,'json':!![]};return rp(_0x3b121b);}function startRefreshInterval(_0x1ed6b8){var _0x7f2dc8=schedule['intervals'];if(_0x7f2dc8[_0x1ed6b8['id']])clearInterval(_0x7f2dc8[_0x1ed6b8['id']]);_0x7f2dc8[_0x1ed6b8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x112c('0x45')](this,{'id':_0x1ed6b8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x112c('0x46')]=_0x7f2dc8;}function startAllRefreshIntervals(){return db[_0x112c('0x3b')][_0x112c('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x55c76a){var _0x4f93b4=_0x55c76a[_0x112c('0x13')](function(_0x43cb1d){return refreshOauth2MicrosoftAccessToken(_0x43cb1d)[_0x112c('0x39')](function(_0x2246d8){startRefreshInterval(_0x2246d8);});});return Promise[_0x112c('0x48')](_0x4f93b4);})[_0x112c('0x49')](function(_0x24556a){var _0x528feb=_0x24556a?util[_0x112c('0x4a')](_0x24556a,{'showHidden':![],'depth':null}):'';logger[_0x112c('0x4b')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x528feb);});}module[_0x112c('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xcbc1=['scope','state','nonce','prompt','login','oauth2/','set','payload','iss','issuer','audience','isAfter','exp','resolve','then','data3','CloudProvider','data6','decryptString','POST','access_token','refresh_token','update','data5','catch','authorization_code','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','base64','toString','hex','client_id','data1','response_type','redirect_uri','data4','form_post'];(function(_0x20b677,_0x1a7eaa){var _0x3455fa=function(_0x566772){while(--_0x566772){_0x20b677['push'](_0x20b677['shift']());}};_0x3455fa(++_0x1a7eaa);}(_0xcbc1,0x10a));var _0x1cbc=function(_0x32088f,_0x538e0a){_0x32088f=_0x32088f-0x0;var _0x43abf1=_0xcbc1[_0x32088f];return _0x43abf1;};'use strict';var _=require(_0x1cbc('0x0'));var crypto=require(_0x1cbc('0x1'));var jwt=require(_0x1cbc('0x2'));var moment=require(_0x1cbc('0x3'));var Redis=require(_0x1cbc('0x4'));var rp=require('request-promise');var util=require(_0x1cbc('0x5'));var encryptor=require(_0x1cbc('0x6'));var config=require(_0x1cbc('0x7'));var logger=require(_0x1cbc('0x8'))(_0x1cbc('0x9'));var schedule=require(_0x1cbc('0xa'));var db=require(_0x1cbc('0xb'))['db'];config[_0x1cbc('0xc')]=_[_0x1cbc('0xd')](config[_0x1cbc('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x1cbc('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x1cbc('0xe'),_0x1cbc('0xf'),_0x1cbc('0x10'),_0x1cbc('0x11'),_0x1cbc('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x1cbc('0x13')],'Dynamics365':[_0x1cbc('0xe'),_0x1cbc('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x1cbc('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x1cbc('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5f914){var _0x211d8b=_[_0x1cbc('0x16')](AZURE_AUTH_SCOPES[_0x5f914['type']]);if(_0x5f914[_0x1cbc('0x17')]===_0x1cbc('0x18'))_0x211d8b[_0x1cbc('0x19')](_0x5f914[_0x1cbc('0x1a')]+_0x1cbc('0x1b'));return _0x211d8b[_0x1cbc('0x1c')]('\x20');}function getAccessTokenScope(_0x4c8709){if(_0x4c8709[_0x1cbc('0x17')]===_0x1cbc('0x1d'))return _0x1cbc('0x12');if(_0x4c8709['type']===_0x1cbc('0x18'))return _0x4c8709[_0x1cbc('0x1a')]+_0x1cbc('0x1b');}function generateMicrosoftAuthorizationUrl(_0x42d5d0,_0x3c5686){var _0x4d3c74=MICROSOFT_AUTH_URL[_0x1cbc('0x1e')](_0x1cbc('0x1f'),_0x42d5d0[_0x1cbc('0x20')]);var _0x1b1dba=[_0x1cbc('0x21'),_0x1cbc('0x22')];var _0x41feb5=Buffer[_0x1cbc('0x23')](JSON[_0x1cbc('0x24')]({'id':_0x3c5686}))['toString'](_0x1cbc('0x25'));var _0x39a32d=crypto['randomBytes'](0x10)[_0x1cbc('0x26')](_0x1cbc('0x27'));var _0x4e992c=getAuthorizationScopes(_0x42d5d0);var _0x3be5ea=[{'key':_0x1cbc('0x28'),'value':_0x42d5d0[_0x1cbc('0x29')]},{'key':_0x1cbc('0x2a'),'value':encodeURIComponent(_0x1b1dba[_0x1cbc('0x1c')]('\x20'))},{'key':_0x1cbc('0x2b'),'value':_0x42d5d0[_0x1cbc('0x2c')]},{'key':'response_mode','value':_0x1cbc('0x2d')},{'key':_0x1cbc('0x2e'),'value':encodeURIComponent(_0x4e992c)},{'key':_0x1cbc('0x2f'),'value':_0x41feb5},{'key':_0x1cbc('0x30'),'value':_0x39a32d},{'key':_0x1cbc('0x31'),'value':_0x1cbc('0x32')}];var _0x39b7bc=_0x4d3c74+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1cbc('0x16')](_0x3be5ea,function(_0x58992f){return _0x58992f['key']+'='+_0x58992f['value'];})[_0x1cbc('0x1c')]('&');_0x42d5d0['oauth2Claims']={'issuer':_0x4d3c74['replace'](_0x1cbc('0x33'),''),'audience':_0x42d5d0[_0x1cbc('0x29')],'state':_0x41feb5,'nonce':_0x39a32d};redis[_0x1cbc('0x34')](_0x41feb5,JSON[_0x1cbc('0x24')](_0x42d5d0));return _0x39b7bc;}function isValidIdToken(_0x149ec8,_0x330f37){try{var _0x40f5c5=jwt['decode'](_0x149ec8,{'complete':!![]});var _0x431152=_0x40f5c5[_0x1cbc('0x35')];if(_0x431152[_0x1cbc('0x36')]!==_0x330f37[_0x1cbc('0x37')])return![];if(_0x431152['aud']!==_0x330f37[_0x1cbc('0x38')])return![];if(_0x431152[_0x1cbc('0x30')]!==_0x330f37[_0x1cbc('0x30')])return![];if(moment()[_0x1cbc('0x39')](moment['unix'](_0x431152[_0x1cbc('0x3a')])))return![];return!![];}catch(_0x12489e){throw _0x12489e;}}function refreshOauth2MicrosoftAccessToken(_0xb72d0e){return Promise[_0x1cbc('0x3b')]()[_0x1cbc('0x3c')](function(){if(_0xb72d0e[_0x1cbc('0x3d')])return _0xb72d0e;return db[_0x1cbc('0x3e')]['findOne']({'where':{'id':_0xb72d0e['id']},'raw':!![]});})['then'](function(_0x552339){var _0x1a03cd={'grant_type':'refresh_token','refresh_token':_0x552339[_0x1cbc('0x3f')],'scope':getAccessTokenScope(_0x552339),'redirect_uri':_0x552339[_0x1cbc('0x2c')],'client_id':_0x552339[_0x1cbc('0x29')],'client_secret':encryptor[_0x1cbc('0x40')](_0x552339[_0x1cbc('0x3d')])};var _0x583c4a={'method':_0x1cbc('0x41'),'uri':MICROSOFT_AUTH_URL[_0x1cbc('0x1e')](_0x1cbc('0x1f'),_0x552339[_0x1cbc('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1a03cd,'json':!![]};return rp(_0x583c4a);})[_0x1cbc('0x3c')](function(_0x5d26e0){_0xb72d0e['data5']=_0x5d26e0[_0x1cbc('0x42')];_0xb72d0e[_0x1cbc('0x3f')]=_0x5d26e0[_0x1cbc('0x43')];return db[_0x1cbc('0x3e')][_0x1cbc('0x44')]({'data5':_0xb72d0e[_0x1cbc('0x45')],'data6':_0xb72d0e[_0x1cbc('0x3f')]},{'where':{'id':_0xb72d0e['id']}});})[_0x1cbc('0x3c')](function(){return _0xb72d0e;})[_0x1cbc('0x46')](function(_0x346a1d){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xb72d0e['id'],_0x346a1d);});}function getOauth2MicrosoftAccessToken(_0x19c1ac,_0x49c799){var _0x5ebc87={'grant_type':_0x1cbc('0x47'),'code':_0x19c1ac,'scope':getAccessTokenScope(_0x49c799),'redirect_uri':_0x49c799[_0x1cbc('0x2c')],'client_id':_0x49c799[_0x1cbc('0x29')],'client_secret':encryptor[_0x1cbc('0x40')](_0x49c799[_0x1cbc('0x3d')])};var _0x8aac56={'method':_0x1cbc('0x41'),'uri':MICROSOFT_AUTH_URL[_0x1cbc('0x1e')](_0x1cbc('0x1f'),_0x49c799['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5ebc87,'json':!![]};return rp(_0x8aac56);}function startRefreshInterval(_0x617e7a){var _0x29bce3=schedule[_0x1cbc('0x48')];if(_0x29bce3[_0x617e7a['id']])clearInterval(_0x29bce3[_0x617e7a['id']]);_0x29bce3[_0x617e7a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1cbc('0x49')](this,{'id':_0x617e7a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x29bce3;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x1cbc('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x48f017){var _0x2c4f3d=_0x48f017[_0x1cbc('0x16')](function(_0x344831){return refreshOauth2MicrosoftAccessToken(_0x344831)[_0x1cbc('0x3c')](function(_0x50e65f){startRefreshInterval(_0x50e65f);});});return Promise['all'](_0x2c4f3d);})['catch'](function(_0x138688){var _0xf3be3c=_0x138688?util[_0x1cbc('0x4b')](_0x138688,{'showHidden':![],'depth':null}):'';logger[_0x1cbc('0x4c')](_0x1cbc('0x4d'),_0xf3be3c);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 6f11c73..6467e4d 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 _0x4991=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x4991,0xf7));var _0x1499=function(_0x1cb40e,_0x46a670){_0x1cb40e=_0x1cb40e-0x0;var _0x445b12=_0x4991[_0x1cb40e];return _0x445b12;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});} \ No newline at end of file +var _0x9a2a=['request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x449a3e,_0x35f5d7){var _0xf99bac=function(_0x21b191){while(--_0x21b191){_0x449a3e['push'](_0x449a3e['shift']());}};_0xf99bac(++_0x35f5d7);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x9a2a[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a2('0x3'))['db'];var utils=require(_0xa9a2('0x4'));var logger=require(_0xa9a2('0x5'))(_0xa9a2('0x6'));var config=require(_0xa9a2('0x7'));var jayson=require(_0xa9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388689,_0xb51739,_0xedae90){return new BPromise(function(_0x287343,_0xcd2750){return client[_0xa9a2('0x9')](_0x388689,_0xedae90)[_0xa9a2('0xa')](function(_0x26f1ce){logger[_0xa9a2('0xb')]('CloudProvider,\x20%s,\x20%s',_0xb51739,_0xa9a2('0xc'));logger[_0xa9a2('0xd')](_0xa9a2('0xe'),_0xb51739,_0xa9a2('0xc'),JSON[_0xa9a2('0xf')](_0x26f1ce));if(_0x26f1ce[_0xa9a2('0x10')]){if(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x11')]===0x1f4){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce['error'][_0xa9a2('0x13')]);return _0xcd2750(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);return _0x287343(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}else{logger[_0xa9a2('0xb')](_0xa9a2('0x12'),_0xb51739,_0xa9a2('0xc'));_0x287343(_0x26f1ce[_0xa9a2('0x14')]['message']);}})[_0xa9a2('0x15')](function(_0xbb6546){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0xbb6546);_0xcd2750(_0xbb6546);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1fe140d..5890b3b 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x22ab89,_0x3c4bf0){var _0x5abf0c=function(_0x284135){while(--_0x284135){_0x22ab89['push'](_0x22ab89['shift']());}};_0x5abf0c(++_0x3c4bf0);}(_0xdb28,0x106));var _0x8db2=function(_0x499834,_0x2fc2c2){_0x499834=_0x499834-0x0;var _0x45aeba=_0xdb28[_0x499834];return _0x45aeba;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x175c67,_0x53a327){_0x175c67=_0x175c67-0x0;var _0x5d4406=_0x5f2f[_0x175c67];return _0x5d4406;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cf32326..fb91818 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 _0x29fc=['name','STRING','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x29fc,0xb0));var _0xc29f=function(_0x31b998,_0x49a668){_0x31b998=_0x31b998-0x0;var _0x55e885=_0x29fc[_0x31b998];return _0x55e885;};'use strict';var Sequelize=require('sequelize');module[_0xc29f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc29f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc29f('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc29f('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc29f('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc29f('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc29f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc29f('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xc29f('0x2')]},'sCountry':{'type':Sequelize[_0xc29f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6074=['STRING','exports','name'];(function(_0x207dde,_0x18cb24){var _0x215596=function(_0x59258e){while(--_0x59258e){_0x207dde['push'](_0x207dde['shift']());}};_0x215596(++_0x18cb24);}(_0x6074,0x76));var _0x4607=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6074[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require('sequelize');module[_0x4607('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4607('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4607('0x2')]},'phone':{'type':Sequelize[_0x4607('0x2')]},'fax':{'type':Sequelize[_0x4607('0x2')]},'type':{'type':Sequelize[_0x4607('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x4607('0x2')]},'city':{'type':Sequelize[_0x4607('0x2')]},'country':{'type':Sequelize[_0x4607('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4607('0x2')]},'sStreet':{'type':Sequelize[_0x4607('0x2')]},'sPostalCode':{'type':Sequelize[_0x4607('0x2')]},'sCity':{'type':Sequelize[_0x4607('0x2')]},'sCountry':{'type':Sequelize[_0x4607('0x2')]},'description':{'type':Sequelize[_0x4607('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 757ba82..a8c2a2a 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 _0x454e=['merge','map','count','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','addContacts','CmContact','ids','omit','getContacts','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','then','get','UserProfileResource','error','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x454e,0x70));var _0xe454=function(_0x381024,_0x46e792){_0x381024=_0x381024-0x0;var _0x421ead=_0x454e[_0x381024];return _0x421ead;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe454('0x0'));var rp=require('request-promise');var moment=require(_0xe454('0x1'));var BPromise=require(_0xe454('0x2'));var Mustache=require(_0xe454('0x3'));var util=require(_0xe454('0x4'));var path=require(_0xe454('0x5'));var sox=require(_0xe454('0x6'));var csv=require('to-csv');var ejs=require(_0xe454('0x7'));var fs=require('fs');var fs_extra=require(_0xe454('0x8'));var _=require(_0xe454('0x9'));var squel=require(_0xe454('0xa'));var crypto=require('crypto');var jsforce=require(_0xe454('0xb'));var deskjs=require(_0xe454('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe454('0xd'));var Papa=require('papaparse');var Redis=require(_0xe454('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe454('0xf'));var as=require(_0xe454('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe454('0x11'))('api');var utils=require(_0xe454('0x12'));var config=require(_0xe454('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe454('0x14'))['db'];function respondWithStatusCode(_0x2fc2b2,_0xd6aee3){_0xd6aee3=_0xd6aee3||0xcc;return function(_0x1729c0){if(_0x1729c0){return _0x2fc2b2[_0xe454('0x15')](_0xd6aee3);}return _0x2fc2b2[_0xe454('0x16')](_0xd6aee3)[_0xe454('0x17')]();};}function respondWithResult(_0x52f19f,_0x22cb5f){_0x22cb5f=_0x22cb5f||0xc8;return function(_0x26ec36){if(_0x26ec36){return _0x52f19f['status'](_0x22cb5f)[_0xe454('0x18')](_0x26ec36);}};}function respondWithFilteredResult(_0x24d599,_0x34f75d){return function(_0x505b5e){if(_0x505b5e){var _0x56a848=typeof _0x34f75d[_0xe454('0x19')]===_0xe454('0x1a')&&typeof _0x34f75d[_0xe454('0x1b')]==='undefined';var _0xc6ceb6=_0x505b5e['count'];var _0x2a5daf=_0x56a848?0x0:_0x34f75d['offset'];var _0x4f2869=_0x56a848?_0x505b5e['count']:_0x34f75d[_0xe454('0x19')]+_0x34f75d[_0xe454('0x1b')];var _0x57b1cd;if(_0x4f2869>=_0xc6ceb6){_0x4f2869=_0xc6ceb6;_0x57b1cd=0xc8;}else{_0x57b1cd=0xce;}_0x24d599[_0xe454('0x16')](_0x57b1cd);return _0x24d599['set'](_0xe454('0x1c'),_0x2a5daf+'-'+_0x4f2869+'/'+_0xc6ceb6)['json'](_0x505b5e);}return null;};}function patchUpdates(_0xf66cb4){return function(_0x15530d){try{jsonpatch['apply'](_0x15530d,_0xf66cb4,!![]);}catch(_0x12c5b0){return BPromise[_0xe454('0x1d')](_0x12c5b0);}return _0x15530d[_0xe454('0x1e')]();};}function saveUpdates(_0x4b389f,_0x4e3559){return function(_0x47d900){if(_0x47d900){return _0x47d900['update'](_0x4b389f)[_0xe454('0x1f')](function(_0x57c8e7){return _0x57c8e7;});}return null;};}function removeEntity(_0x336582,_0x479de1){return function(_0x21539b){if(_0x21539b){return _0x21539b['destroy']()[_0xe454('0x1f')](function(){var _0x57ad90=_0x21539b[_0xe454('0x20')]({'plain':!![]});var _0x165a9d='Companies';return db[_0xe454('0x21')]['destroy']({'where':{'type':_0x165a9d,'resourceId':_0x57ad90['id']}})['then'](function(){return _0x21539b;});})['then'](function(){_0x336582[_0xe454('0x16')](0xcc)[_0xe454('0x17')]();});}};}function handleEntityNotFound(_0x4bad7b,_0x80100){return function(_0x44d4a2){if(!_0x44d4a2){_0x4bad7b[_0xe454('0x15')](0x194);}return _0x44d4a2;};}function handleError(_0x13afde,_0x34fcce){_0x34fcce=_0x34fcce||0x1f4;return function(_0x1198bd){logger[_0xe454('0x22')](_0x1198bd['stack']);if(_0x1198bd[_0xe454('0x23')]){delete _0x1198bd[_0xe454('0x23')];}_0x13afde['status'](_0x34fcce)[_0xe454('0x24')](_0x1198bd);};}exports[_0xe454('0x25')]=function(_0x424aec,_0x3feb23){var _0x44f854={},_0x1d58a2={},_0xe522db={'count':0x0,'rows':[]};return db[_0xe454('0x26')][_0xe454('0x27')]()[_0xe454('0x1f')](function(_0x299728){_0x1d58a2['model']=_[_0xe454('0x28')](_0x299728);_0x1d58a2[_0xe454('0x29')]=_['keys'](_0x424aec[_0xe454('0x29')]);_0x1d58a2[_0xe454('0x2a')]=_[_0xe454('0x2b')](_0x1d58a2[_0xe454('0x2c')],_0x1d58a2[_0xe454('0x29')]);_0x44f854[_0xe454('0x2d')]=_[_0xe454('0x2b')](_0x1d58a2[_0xe454('0x2c')],qs[_0xe454('0x2e')](_0x424aec[_0xe454('0x29')][_0xe454('0x2e')]));_0x44f854[_0xe454('0x2d')]=_0x44f854[_0xe454('0x2d')]['length']?_0x44f854[_0xe454('0x2d')]:_0x1d58a2['model'];if(!_0x424aec[_0xe454('0x29')][_0xe454('0x2f')](_0xe454('0x30'))){_0x44f854[_0xe454('0x1b')]=qs['limit'](_0x424aec[_0xe454('0x29')][_0xe454('0x1b')]);_0x44f854['offset']=qs[_0xe454('0x19')](_0x424aec['query'][_0xe454('0x19')]);}_0x44f854[_0xe454('0x31')]=qs[_0xe454('0x32')](_0x424aec[_0xe454('0x29')][_0xe454('0x32')]);_0x44f854['where']=qs[_0xe454('0x2a')](_[_0xe454('0x33')](_0x424aec[_0xe454('0x29')],_0x1d58a2[_0xe454('0x2a')]),_0x299728);if(_0x424aec[_0xe454('0x29')][_0xe454('0x34')]){_0x44f854[_0xe454('0x35')]=_[_0xe454('0x36')](_0x44f854[_0xe454('0x35')],{'$or':_[_0xe454('0x37')](_0x44f854[_0xe454('0x2d')],function(_0x578d6a){var _0x5be270={};_0x5be270[_0x578d6a]={'$like':'%'+_0x424aec[_0xe454('0x29')][_0xe454('0x34')]+'%'};return _0x5be270;})});}_0x44f854=_[_0xe454('0x36')]({},_0x44f854,_0x424aec['options']);var _0x5620bf={'where':_0x44f854[_0xe454('0x35')]};return db[_0xe454('0x26')][_0xe454('0x38')](_0x5620bf)[_0xe454('0x1f')](function(_0x4a2be2){_0xe522db[_0xe454('0x38')]=_0x4a2be2;if(_0x424aec[_0xe454('0x29')][_0xe454('0x39')]){_0x44f854['include']=[{'all':!![]}];}return db[_0xe454('0x26')][_0xe454('0x3a')](_0x44f854);})['then'](function(_0x452f8e){_0xe522db[_0xe454('0x3b')]=_0x452f8e;return _0xe522db;})[_0xe454('0x1f')](respondWithFilteredResult(_0x3feb23,_0x44f854))[_0xe454('0x3c')](handleError(_0x3feb23,null));})['catch'](handleError(_0x3feb23,null));};exports[_0xe454('0x3d')]=function(_0x7447cc,_0x49d027){var _0x5277df={'raw':![],'where':{'id':_0x7447cc[_0xe454('0x3e')]['id']}},_0x20fe92={};_0x20fe92[_0xe454('0x2c')]=_[_0xe454('0x28')](db['CmCompany'][_0xe454('0x3f')]);_0x20fe92[_0xe454('0x29')]=_[_0xe454('0x28')](_0x7447cc[_0xe454('0x29')]);_0x20fe92[_0xe454('0x2a')]=_[_0xe454('0x2b')](_0x20fe92[_0xe454('0x2c')],_0x20fe92['query']);_0x5277df[_0xe454('0x2d')]=_[_0xe454('0x2b')](_0x20fe92[_0xe454('0x2c')],qs['fields'](_0x7447cc[_0xe454('0x29')]['fields']));_0x5277df['attributes']=_0x5277df[_0xe454('0x2d')][_0xe454('0x40')]?_0x5277df['attributes']:_0x20fe92[_0xe454('0x2c')];if(_0x7447cc[_0xe454('0x29')][_0xe454('0x39')]){_0x5277df[_0xe454('0x41')]=[{'all':!![]}];}_0x5277df=_[_0xe454('0x36')]({},_0x5277df,_0x7447cc[_0xe454('0x42')]);return db[_0xe454('0x26')]['find'](_0x5277df)['then'](handleEntityNotFound(_0x49d027,null))['then'](respondWithResult(_0x49d027,null))[_0xe454('0x3c')](handleError(_0x49d027,null));};exports[_0xe454('0x43')]=function(_0x115f6d,_0x37f748){return db[_0xe454('0x26')]['create'](_0x115f6d['body'],{})[_0xe454('0x1f')](function(_0xbbb1c8){var _0x19173f=_0x115f6d[_0xe454('0x44')][_0xe454('0x20')]({'plain':!![]});if(!_0x19173f)throw new Error(_0xe454('0x45'));if(_0x19173f[_0xe454('0x46')]===_0xe454('0x44')){var _0x3e02ce=_0xbbb1c8[_0xe454('0x20')]({'plain':!![]});var _0xf8a295='Companies';return db[_0xe454('0x47')][_0xe454('0x48')]({'where':{'name':_0xf8a295,'userProfileId':_0x19173f['userProfileId']},'raw':!![]})[_0xe454('0x1f')](function(_0x50a09b){if(_0x50a09b&&_0x50a09b[_0xe454('0x49')]===0x0){return db[_0xe454('0x21')]['create']({'name':_0x3e02ce[_0xe454('0x23')],'resourceId':_0x3e02ce['id'],'type':_0x50a09b[_0xe454('0x23')],'sectionId':_0x50a09b['id']},{})[_0xe454('0x1f')](function(){return _0xbbb1c8;});}else{return _0xbbb1c8;}})[_0xe454('0x3c')](function(_0x47ca86){logger[_0xe454('0x22')](_0xe454('0x4a'),_0x47ca86);throw _0x47ca86;});}return _0xbbb1c8;})[_0xe454('0x1f')](respondWithResult(_0x37f748,0xc9))[_0xe454('0x3c')](handleError(_0x37f748,null));};exports[_0xe454('0x4b')]=function(_0x147ccc,_0x2301af){if(_0x147ccc[_0xe454('0x4c')]['id']){delete _0x147ccc['body']['id'];}return db[_0xe454('0x26')][_0xe454('0x48')]({'where':{'id':_0x147ccc[_0xe454('0x3e')]['id']}})[_0xe454('0x1f')](handleEntityNotFound(_0x2301af,null))[_0xe454('0x1f')](saveUpdates(_0x147ccc['body'],null))[_0xe454('0x1f')](respondWithResult(_0x2301af,null))['catch'](handleError(_0x2301af,null));};exports[_0xe454('0x4d')]=function(_0x1e2c07,_0x2af4f9){return db[_0xe454('0x26')][_0xe454('0x48')]({'where':{'id':_0x1e2c07[_0xe454('0x3e')]['id']}})[_0xe454('0x1f')](handleEntityNotFound(_0x2af4f9,null))[_0xe454('0x1f')](removeEntity(_0x2af4f9,null))[_0xe454('0x3c')](handleError(_0x2af4f9,null));};exports['describe']=function(_0x26e898,_0x362ddf){return db[_0xe454('0x26')][_0xe454('0x27')]()[_0xe454('0x1f')](respondWithResult(_0x362ddf,null))[_0xe454('0x3c')](handleError(_0x362ddf,null));};exports[_0xe454('0x4e')]=function(_0x41373f,_0x212313,_0x21376d){return db[_0xe454('0x4f')][_0xe454('0x48')]({'where':{'id':_0x41373f[_0xe454('0x3e')]['id']}})['then'](handleEntityNotFound(_0x212313,null))[_0xe454('0x1f')](function(_0x21a1da){if(_0x21a1da){return _0x21a1da[_0xe454('0x4e')](_0x41373f[_0xe454('0x4c')][_0xe454('0x50')],_[_0xe454('0x51')](_0x41373f['body'],[_0xe454('0x50'),'id'])||{});}})[_0xe454('0x1f')](respondWithResult(_0x212313,null))['catch'](handleError(_0x212313,null));};exports[_0xe454('0x52')]=function(_0x2280d6,_0x5c1b72,_0x31af47){var _0x2fcda4={};var _0x5d8be8={};var _0x1c0c8b;var _0x7f2737;return db[_0xe454('0x26')]['findOne']({'where':{'id':_0x2280d6['params']['id']}})[_0xe454('0x1f')](handleEntityNotFound(_0x5c1b72,null))[_0xe454('0x1f')](function(_0x5c4900){if(_0x5c4900){_0x1c0c8b=_0x5c4900;_0x5d8be8[_0xe454('0x2c')]=_[_0xe454('0x28')](db[_0xe454('0x4f')][_0xe454('0x3f')]);_0x5d8be8['query']=_[_0xe454('0x28')](_0x2280d6[_0xe454('0x29')]);_0x5d8be8[_0xe454('0x2a')]=_[_0xe454('0x2b')](_0x5d8be8[_0xe454('0x2c')],_0x5d8be8[_0xe454('0x29')]);_0x2fcda4[_0xe454('0x2d')]=_[_0xe454('0x2b')](_0x5d8be8[_0xe454('0x2c')],qs[_0xe454('0x2e')](_0x2280d6[_0xe454('0x29')][_0xe454('0x2e')]));_0x2fcda4[_0xe454('0x2d')]=_0x2fcda4['attributes']['length']?_0x2fcda4[_0xe454('0x2d')]:_0x5d8be8[_0xe454('0x2c')];_0x2fcda4[_0xe454('0x31')]=qs['sort'](_0x2280d6['query'][_0xe454('0x32')]);_0x2fcda4[_0xe454('0x35')]=qs[_0xe454('0x2a')](_[_0xe454('0x33')](_0x2280d6['query'],_0x5d8be8[_0xe454('0x2a')]));if(_0x2280d6['query'][_0xe454('0x34')]){_0x2fcda4[_0xe454('0x35')]=_[_0xe454('0x36')](_0x2fcda4[_0xe454('0x35')],{'$or':_[_0xe454('0x37')](_0x2fcda4[_0xe454('0x2d')],function(_0x510f60){var _0x513b80={};_0x513b80[_0x510f60]={'$like':'%'+_0x2280d6[_0xe454('0x29')][_0xe454('0x34')]+'%'};return _0x513b80;})});}_0x2fcda4=_['merge']({},_0x2fcda4,_0x2280d6[_0xe454('0x42')]);return _0x1c0c8b[_0xe454('0x52')](_0x2fcda4);}})[_0xe454('0x1f')](function(_0x501a9a){if(_0x501a9a){_0x7f2737=_0x501a9a[_0xe454('0x40')];if(!_0x2280d6['query'][_0xe454('0x2f')](_0xe454('0x30'))){_0x2fcda4[_0xe454('0x1b')]=qs[_0xe454('0x1b')](_0x2280d6['query'][_0xe454('0x1b')]);_0x2fcda4[_0xe454('0x19')]=qs[_0xe454('0x19')](_0x2280d6[_0xe454('0x29')][_0xe454('0x19')]);}return _0x1c0c8b[_0xe454('0x52')](_0x2fcda4);}})['then'](function(_0xdd7bb4){if(_0xdd7bb4){return _0xdd7bb4?{'count':_0x7f2737,'rows':_0xdd7bb4}:null;}})[_0xe454('0x1f')](respondWithResult(_0x5c1b72,null))['catch'](handleError(_0x5c1b72,null));}; \ No newline at end of file +var _0xc1ed=['getContacts','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','merge','include','findAll','rows','params','rawAttributes','options','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','update','addContacts','CmContact','ids','omit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc1ed,0x161));var _0xdc1e=function(_0x57318d,_0x16bc7e){_0x57318d=_0x57318d-0x0;var _0x28c146=_0xc1ed[_0x57318d];return _0x28c146;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc1e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc1e('0x1'));var rp=require(_0xdc1e('0x2'));var moment=require(_0xdc1e('0x3'));var BPromise=require(_0xdc1e('0x4'));var Mustache=require(_0xdc1e('0x5'));var util=require(_0xdc1e('0x6'));var path=require(_0xdc1e('0x7'));var sox=require('sox');var csv=require(_0xdc1e('0x8'));var ejs=require(_0xdc1e('0x9'));var fs=require('fs');var fs_extra=require(_0xdc1e('0xa'));var _=require('lodash');var squel=require(_0xdc1e('0xb'));var crypto=require(_0xdc1e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdc1e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc1e('0xe'));var Redis=require(_0xdc1e('0xf'));var authService=require(_0xdc1e('0x10'));var qs=require(_0xdc1e('0x11'));var as=require(_0xdc1e('0x12'));var hardwareService=require(_0xdc1e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdc1e('0x14'));var config=require(_0xdc1e('0x15'));var licenseUtil=require(_0xdc1e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd122,_0xea143f){_0xea143f=_0xea143f||0xcc;return function(_0x1343ec){if(_0x1343ec){return _0x3fd122[_0xdc1e('0x17')](_0xea143f);}return _0x3fd122[_0xdc1e('0x18')](_0xea143f)[_0xdc1e('0x19')]();};}function respondWithResult(_0x46a13e,_0x1d5359){_0x1d5359=_0x1d5359||0xc8;return function(_0x93876a){if(_0x93876a){return _0x46a13e['status'](_0x1d5359)[_0xdc1e('0x1a')](_0x93876a);}};}function respondWithFilteredResult(_0x1dfedf,_0x153483){return function(_0x3aa8ea){if(_0x3aa8ea){var _0x3e4847=typeof _0x153483[_0xdc1e('0x1b')]===_0xdc1e('0x1c')&&typeof _0x153483[_0xdc1e('0x1d')]==='undefined';var _0xfd958=_0x3aa8ea[_0xdc1e('0x1e')];var _0xed6203=_0x3e4847?0x0:_0x153483[_0xdc1e('0x1b')];var _0x4873c7=_0x3e4847?_0x3aa8ea['count']:_0x153483['offset']+_0x153483[_0xdc1e('0x1d')];var _0x1d28b6;if(_0x4873c7>=_0xfd958){_0x4873c7=_0xfd958;_0x1d28b6=0xc8;}else{_0x1d28b6=0xce;}_0x1dfedf[_0xdc1e('0x18')](_0x1d28b6);return _0x1dfedf[_0xdc1e('0x1f')](_0xdc1e('0x20'),_0xed6203+'-'+_0x4873c7+'/'+_0xfd958)[_0xdc1e('0x1a')](_0x3aa8ea);}return null;};}function patchUpdates(_0x4e03f9){return function(_0x3c6c3f){try{jsonpatch[_0xdc1e('0x21')](_0x3c6c3f,_0x4e03f9,!![]);}catch(_0x485c01){return BPromise[_0xdc1e('0x22')](_0x485c01);}return _0x3c6c3f[_0xdc1e('0x23')]();};}function saveUpdates(_0x5a7886,_0x5c5568){return function(_0x3d69fa){if(_0x3d69fa){return _0x3d69fa['update'](_0x5a7886)[_0xdc1e('0x24')](function(_0x17f26f){return _0x17f26f;});}return null;};}function removeEntity(_0x2000bc,_0x5d749d){return function(_0x1396b0){if(_0x1396b0){return _0x1396b0[_0xdc1e('0x25')]()['then'](function(){var _0x35b962=_0x1396b0[_0xdc1e('0x26')]({'plain':!![]});var _0xc092ee=_0xdc1e('0x27');return db[_0xdc1e('0x28')][_0xdc1e('0x25')]({'where':{'type':_0xc092ee,'resourceId':_0x35b962['id']}})['then'](function(){return _0x1396b0;});})[_0xdc1e('0x24')](function(){_0x2000bc[_0xdc1e('0x18')](0xcc)[_0xdc1e('0x19')]();});}};}function handleEntityNotFound(_0x50b6b3,_0x30386b){return function(_0x1f38a6){if(!_0x1f38a6){_0x50b6b3[_0xdc1e('0x17')](0x194);}return _0x1f38a6;};}function handleError(_0x25eeaf,_0x244fc1){_0x244fc1=_0x244fc1||0x1f4;return function(_0x16e5ef){logger[_0xdc1e('0x29')](_0x16e5ef[_0xdc1e('0x2a')]);if(_0x16e5ef[_0xdc1e('0x2b')]){delete _0x16e5ef[_0xdc1e('0x2b')];}_0x25eeaf[_0xdc1e('0x18')](_0x244fc1)[_0xdc1e('0x2c')](_0x16e5ef);};}exports[_0xdc1e('0x2d')]=function(_0x4149c8,_0x31c920){var _0x931b8={},_0x86b4a1={},_0x595581={'count':0x0,'rows':[]};return db[_0xdc1e('0x2e')][_0xdc1e('0x2f')]()['then'](function(_0x485152){_0x86b4a1[_0xdc1e('0x30')]=_[_0xdc1e('0x31')](_0x485152);_0x86b4a1[_0xdc1e('0x32')]=_[_0xdc1e('0x31')](_0x4149c8[_0xdc1e('0x32')]);_0x86b4a1['filters']=_[_0xdc1e('0x33')](_0x86b4a1[_0xdc1e('0x30')],_0x86b4a1[_0xdc1e('0x32')]);_0x931b8[_0xdc1e('0x34')]=_[_0xdc1e('0x33')](_0x86b4a1['model'],qs[_0xdc1e('0x35')](_0x4149c8[_0xdc1e('0x32')][_0xdc1e('0x35')]));_0x931b8['attributes']=_0x931b8[_0xdc1e('0x34')][_0xdc1e('0x36')]?_0x931b8[_0xdc1e('0x34')]:_0x86b4a1[_0xdc1e('0x30')];if(!_0x4149c8[_0xdc1e('0x32')][_0xdc1e('0x37')](_0xdc1e('0x38'))){_0x931b8[_0xdc1e('0x1d')]=qs[_0xdc1e('0x1d')](_0x4149c8[_0xdc1e('0x32')][_0xdc1e('0x1d')]);_0x931b8[_0xdc1e('0x1b')]=qs[_0xdc1e('0x1b')](_0x4149c8['query'][_0xdc1e('0x1b')]);}_0x931b8[_0xdc1e('0x39')]=qs['sort'](_0x4149c8[_0xdc1e('0x32')][_0xdc1e('0x3a')]);_0x931b8[_0xdc1e('0x3b')]=qs[_0xdc1e('0x3c')](_[_0xdc1e('0x3d')](_0x4149c8[_0xdc1e('0x32')],_0x86b4a1['filters']),_0x485152);if(_0x4149c8[_0xdc1e('0x32')][_0xdc1e('0x3e')]){_0x931b8[_0xdc1e('0x3b')]=_['merge'](_0x931b8[_0xdc1e('0x3b')],{'$or':_[_0xdc1e('0x3f')](_0x931b8[_0xdc1e('0x34')],function(_0x1711bd){var _0x231a17={};_0x231a17[_0x1711bd]={'$like':'%'+_0x4149c8['query']['filter']+'%'};return _0x231a17;})});}_0x931b8=_[_0xdc1e('0x40')]({},_0x931b8,_0x4149c8['options']);var _0x3f03f2={'where':_0x931b8[_0xdc1e('0x3b')]};return db[_0xdc1e('0x2e')]['count'](_0x3f03f2)[_0xdc1e('0x24')](function(_0x2e0168){_0x595581[_0xdc1e('0x1e')]=_0x2e0168;if(_0x4149c8['query']['includeAll']){_0x931b8[_0xdc1e('0x41')]=[{'all':!![]}];}return db[_0xdc1e('0x2e')][_0xdc1e('0x42')](_0x931b8);})['then'](function(_0x3a2e1c){_0x595581[_0xdc1e('0x43')]=_0x3a2e1c;return _0x595581;})[_0xdc1e('0x24')](respondWithFilteredResult(_0x31c920,_0x931b8))['catch'](handleError(_0x31c920,null));})['catch'](handleError(_0x31c920,null));};exports['show']=function(_0x1677d2,_0xceb315){var _0x18f6d2={'raw':![],'where':{'id':_0x1677d2[_0xdc1e('0x44')]['id']}},_0x3e41a1={};_0x3e41a1[_0xdc1e('0x30')]=_['keys'](db[_0xdc1e('0x2e')][_0xdc1e('0x45')]);_0x3e41a1[_0xdc1e('0x32')]=_[_0xdc1e('0x31')](_0x1677d2[_0xdc1e('0x32')]);_0x3e41a1['filters']=_['intersection'](_0x3e41a1[_0xdc1e('0x30')],_0x3e41a1[_0xdc1e('0x32')]);_0x18f6d2[_0xdc1e('0x34')]=_[_0xdc1e('0x33')](_0x3e41a1[_0xdc1e('0x30')],qs['fields'](_0x1677d2[_0xdc1e('0x32')][_0xdc1e('0x35')]));_0x18f6d2[_0xdc1e('0x34')]=_0x18f6d2['attributes'][_0xdc1e('0x36')]?_0x18f6d2[_0xdc1e('0x34')]:_0x3e41a1[_0xdc1e('0x30')];if(_0x1677d2[_0xdc1e('0x32')]['includeAll']){_0x18f6d2[_0xdc1e('0x41')]=[{'all':!![]}];}_0x18f6d2=_[_0xdc1e('0x40')]({},_0x18f6d2,_0x1677d2[_0xdc1e('0x46')]);return db[_0xdc1e('0x2e')][_0xdc1e('0x47')](_0x18f6d2)['then'](handleEntityNotFound(_0xceb315,null))[_0xdc1e('0x24')](respondWithResult(_0xceb315,null))[_0xdc1e('0x48')](handleError(_0xceb315,null));};exports[_0xdc1e('0x49')]=function(_0x5986f4,_0x31c91a){return db['CmCompany'][_0xdc1e('0x49')](_0x5986f4[_0xdc1e('0x4a')],{})[_0xdc1e('0x24')](function(_0x231b3e){var _0x5f37a4=_0x5986f4[_0xdc1e('0x4b')]['get']({'plain':!![]});if(!_0x5f37a4)throw new Error(_0xdc1e('0x4c'));if(_0x5f37a4[_0xdc1e('0x4d')]==='user'){var _0x46e80c=_0x231b3e[_0xdc1e('0x26')]({'plain':!![]});var _0x1c7104='Companies';return db[_0xdc1e('0x4e')][_0xdc1e('0x47')]({'where':{'name':_0x1c7104,'userProfileId':_0x5f37a4[_0xdc1e('0x4f')]},'raw':!![]})[_0xdc1e('0x24')](function(_0x49810d){if(_0x49810d&&_0x49810d[_0xdc1e('0x50')]===0x0){return db[_0xdc1e('0x28')]['create']({'name':_0x46e80c[_0xdc1e('0x2b')],'resourceId':_0x46e80c['id'],'type':_0x49810d[_0xdc1e('0x2b')],'sectionId':_0x49810d['id']},{})[_0xdc1e('0x24')](function(){return _0x231b3e;});}else{return _0x231b3e;}})[_0xdc1e('0x48')](function(_0x5e8eb9){logger[_0xdc1e('0x29')](_0xdc1e('0x51'),_0x5e8eb9);throw _0x5e8eb9;});}return _0x231b3e;})['then'](respondWithResult(_0x31c91a,0xc9))['catch'](handleError(_0x31c91a,null));};exports[_0xdc1e('0x52')]=function(_0x2a8350,_0x5be339){if(_0x2a8350[_0xdc1e('0x4a')]['id']){delete _0x2a8350[_0xdc1e('0x4a')]['id'];}return db[_0xdc1e('0x2e')][_0xdc1e('0x47')]({'where':{'id':_0x2a8350[_0xdc1e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5be339,null))[_0xdc1e('0x24')](saveUpdates(_0x2a8350['body'],null))[_0xdc1e('0x24')](respondWithResult(_0x5be339,null))[_0xdc1e('0x48')](handleError(_0x5be339,null));};exports[_0xdc1e('0x25')]=function(_0x4e514c,_0x8b800c){return db[_0xdc1e('0x2e')][_0xdc1e('0x47')]({'where':{'id':_0x4e514c[_0xdc1e('0x44')]['id']}})[_0xdc1e('0x24')](handleEntityNotFound(_0x8b800c,null))[_0xdc1e('0x24')](removeEntity(_0x8b800c,null))['catch'](handleError(_0x8b800c,null));};exports[_0xdc1e('0x2f')]=function(_0x247d69,_0x2b59da){return db[_0xdc1e('0x2e')]['describe']()['then'](respondWithResult(_0x2b59da,null))['catch'](handleError(_0x2b59da,null));};exports[_0xdc1e('0x53')]=function(_0x12808d,_0x302613,_0x40c74c){return db[_0xdc1e('0x54')][_0xdc1e('0x47')]({'where':{'id':_0x12808d['params']['id']}})['then'](handleEntityNotFound(_0x302613,null))[_0xdc1e('0x24')](function(_0x48b4ce){if(_0x48b4ce){return _0x48b4ce[_0xdc1e('0x53')](_0x12808d['body'][_0xdc1e('0x55')],_[_0xdc1e('0x56')](_0x12808d[_0xdc1e('0x4a')],[_0xdc1e('0x55'),'id'])||{});}})[_0xdc1e('0x24')](respondWithResult(_0x302613,null))[_0xdc1e('0x48')](handleError(_0x302613,null));};exports[_0xdc1e('0x57')]=function(_0x111d7c,_0x1e672b,_0x5cf564){var _0x18280c={};var _0x8079e7={};var _0x3e73f7;var _0x9e0843;return db[_0xdc1e('0x2e')]['findOne']({'where':{'id':_0x111d7c[_0xdc1e('0x44')]['id']}})[_0xdc1e('0x24')](handleEntityNotFound(_0x1e672b,null))[_0xdc1e('0x24')](function(_0x31b0a2){if(_0x31b0a2){_0x3e73f7=_0x31b0a2;_0x8079e7['model']=_['keys'](db[_0xdc1e('0x54')][_0xdc1e('0x45')]);_0x8079e7[_0xdc1e('0x32')]=_[_0xdc1e('0x31')](_0x111d7c[_0xdc1e('0x32')]);_0x8079e7[_0xdc1e('0x3c')]=_[_0xdc1e('0x33')](_0x8079e7[_0xdc1e('0x30')],_0x8079e7[_0xdc1e('0x32')]);_0x18280c[_0xdc1e('0x34')]=_[_0xdc1e('0x33')](_0x8079e7[_0xdc1e('0x30')],qs[_0xdc1e('0x35')](_0x111d7c[_0xdc1e('0x32')][_0xdc1e('0x35')]));_0x18280c[_0xdc1e('0x34')]=_0x18280c[_0xdc1e('0x34')]['length']?_0x18280c[_0xdc1e('0x34')]:_0x8079e7['model'];_0x18280c[_0xdc1e('0x39')]=qs[_0xdc1e('0x3a')](_0x111d7c['query'][_0xdc1e('0x3a')]);_0x18280c[_0xdc1e('0x3b')]=qs[_0xdc1e('0x3c')](_['pick'](_0x111d7c[_0xdc1e('0x32')],_0x8079e7[_0xdc1e('0x3c')]));if(_0x111d7c[_0xdc1e('0x32')]['filter']){_0x18280c[_0xdc1e('0x3b')]=_['merge'](_0x18280c[_0xdc1e('0x3b')],{'$or':_[_0xdc1e('0x3f')](_0x18280c['attributes'],function(_0x238b22){var _0x359b59={};_0x359b59[_0x238b22]={'$like':'%'+_0x111d7c[_0xdc1e('0x32')]['filter']+'%'};return _0x359b59;})});}_0x18280c=_[_0xdc1e('0x40')]({},_0x18280c,_0x111d7c['options']);return _0x3e73f7[_0xdc1e('0x57')](_0x18280c);}})['then'](function(_0x82dc53){if(_0x82dc53){_0x9e0843=_0x82dc53['length'];if(!_0x111d7c['query']['hasOwnProperty'](_0xdc1e('0x38'))){_0x18280c[_0xdc1e('0x1d')]=qs[_0xdc1e('0x1d')](_0x111d7c[_0xdc1e('0x32')][_0xdc1e('0x1d')]);_0x18280c['offset']=qs[_0xdc1e('0x1b')](_0x111d7c['query'][_0xdc1e('0x1b')]);}return _0x3e73f7[_0xdc1e('0x57')](_0x18280c);}})[_0xdc1e('0x24')](function(_0x48242c){if(_0x48242c){return _0x48242c?{'count':_0x9e0843,'rows':_0x48242c}:null;}})[_0xdc1e('0x24')](respondWithResult(_0x1e672b,null))[_0xdc1e('0x48')](handleError(_0x1e672b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4017f02..0df2d64 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 _0x712c=['exports','define','cm_companies','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x712c,0x1b3));var _0xc712=function(_0x1bff44,_0x205404){_0x1bff44=_0x1bff44-0x0;var _0x437d25=_0x712c[_0x1bff44];return _0x437d25;};'use strict';var _=require(_0xc712('0x0'));var util=require('util');var logger=require(_0xc712('0x1'))('api');var moment=require(_0xc712('0x2'));var BPromise=require('bluebird');var rp=require(_0xc712('0x3'));var fs=require('fs');var path=require(_0xc712('0x4'));var rimraf=require(_0xc712('0x5'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xc712('0x6')]=function(_0x54f74a,_0x49e860){return _0x54f74a[_0xc712('0x7')]('CmCompany',attributes,{'tableName':_0xc712('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fec=['define','CmCompany','cm_companies','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x158875,_0x19e50c){var _0x104a1a=function(_0x54b629){while(--_0x54b629){_0x158875['push'](_0x158875['shift']());}};_0x104a1a(++_0x19e50c);}(_0x8fec,0xa8));var _0xc8fe=function(_0x4f249f,_0x658670){_0x4f249f=_0x4f249f-0x0;var _0x2e56b1=_0x8fec[_0x4f249f];return _0x2e56b1;};'use strict';var _=require(_0xc8fe('0x0'));var util=require('util');var logger=require(_0xc8fe('0x1'))(_0xc8fe('0x2'));var moment=require(_0xc8fe('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8fe('0x4'));var fs=require('fs');var path=require(_0xc8fe('0x5'));var rimraf=require(_0xc8fe('0x6'));var config=require(_0xc8fe('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x244c3c,_0x250975){return _0x244c3c[_0xc8fe('0x8')](_0xc8fe('0x9'),attributes,{'tableName':_0xc8fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index cac547d..4a73673 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 _0xefdf=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','message','info','CmCompany,\x20%s,\x20%s','catch'];(function(_0x58980d,_0x1f44b7){var _0x2bc1ce=function(_0x2e69ec){while(--_0x2e69ec){_0x58980d['push'](_0x58980d['shift']());}};_0x2bc1ce(++_0x1f44b7);}(_0xefdf,0xd2));var _0xfefd=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0xefdf[_0x32665e];return _0x10be45;};'use strict';var _=require(_0xfefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfefd('0x1'));var rs=require(_0xfefd('0x2'));var fs=require('fs');var Redis=require(_0xfefd('0x3'));var db=require(_0xfefd('0x4'))['db'];var utils=require(_0xfefd('0x5'));var logger=require(_0xfefd('0x6'))(_0xfefd('0x7'));var config=require('../../config/environment');var jayson=require(_0xfefd('0x8'));var client=jayson[_0xfefd('0x9')][_0xfefd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7055dd,_0x44cbd2,_0x5a8946){return new BPromise(function(_0x493dee,_0x4a1d3d){return client[_0xfefd('0xb')](_0x7055dd,_0x5a8946)['then'](function(_0x245d8b){logger['info']('CmCompany,\x20%s,\x20%s',_0x44cbd2,_0xfefd('0xc'));logger[_0xfefd('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x44cbd2,_0xfefd('0xc'),JSON[_0xfefd('0xe')](_0x245d8b));if(_0x245d8b[_0xfefd('0xf')]){if(_0x245d8b[_0xfefd('0xf')][_0xfefd('0x10')]===0x1f4){logger[_0xfefd('0xf')]('CmCompany,\x20%s,\x20%s',_0x44cbd2,_0x245d8b[_0xfefd('0xf')][_0xfefd('0x11')]);return _0x4a1d3d(_0x245d8b[_0xfefd('0xf')][_0xfefd('0x11')]);}logger[_0xfefd('0xf')]('CmCompany,\x20%s,\x20%s',_0x44cbd2,_0x245d8b['error'][_0xfefd('0x11')]);return _0x493dee(_0x245d8b['error'][_0xfefd('0x11')]);}else{logger[_0xfefd('0x12')](_0xfefd('0x13'),_0x44cbd2,'request\x20sent');_0x493dee(_0x245d8b['result']['message']);}})[_0xfefd('0x14')](function(_0x219303){logger['error'](_0xfefd('0x13'),_0x44cbd2,_0x219303);_0x4a1d3d(_0x219303);});});} \ No newline at end of file +var _0xeed3=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xeed3,0xde));var _0x3eed=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xeed3[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x3eed('0x0'));var moment=require(_0x3eed('0x1'));var BPromise=require(_0x3eed('0x2'));var rs=require(_0x3eed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3eed('0x4'))['db'];var utils=require(_0x3eed('0x5'));var logger=require('../../config/logger')(_0x3eed('0x6'));var config=require('../../config/environment');var jayson=require(_0x3eed('0x7'));var client=jayson['client'][_0x3eed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28a635,_0x4d4b67,_0x17f976){return new BPromise(function(_0x5885a7,_0x2c9ea3){return client[_0x3eed('0x9')](_0x28a635,_0x17f976)[_0x3eed('0xa')](function(_0x19c2a1){logger[_0x3eed('0xb')](_0x3eed('0xc'),_0x4d4b67,_0x3eed('0xd'));logger[_0x3eed('0xe')](_0x3eed('0xf'),_0x4d4b67,_0x3eed('0xd'),JSON['stringify'](_0x19c2a1));if(_0x19c2a1['error']){if(_0x19c2a1[_0x3eed('0x10')]['code']===0x1f4){logger['error'](_0x3eed('0xc'),_0x4d4b67,_0x19c2a1[_0x3eed('0x10')][_0x3eed('0x11')]);return _0x2c9ea3(_0x19c2a1[_0x3eed('0x10')][_0x3eed('0x11')]);}logger[_0x3eed('0x10')](_0x3eed('0xc'),_0x4d4b67,_0x19c2a1[_0x3eed('0x10')][_0x3eed('0x11')]);return _0x5885a7(_0x19c2a1[_0x3eed('0x10')][_0x3eed('0x11')]);}else{logger[_0x3eed('0xb')](_0x3eed('0xc'),_0x4d4b67,_0x3eed('0xd'));_0x5885a7(_0x19c2a1[_0x3eed('0x12')][_0x3eed('0x11')]);}})[_0x3eed('0x13')](function(_0x266554){logger['error'](_0x3eed('0xc'),_0x4d4b67,_0x266554);_0x2c9ea3(_0x266554);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index edb3c78..7a251b0 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 _0x4327=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4327,0x1dd));var _0x7432=function(_0x1c80bd,_0x356976){_0x1c80bd=_0x1c80bd-0x0;var _0x15b7fc=_0x4327[_0x1c80bd];return _0x15b7fc;};'use strict';var multer=require(_0x7432('0x0'));var util=require('util');var path=require(_0x7432('0x1'));var timeout=require(_0x7432('0x2'));var express=require(_0x7432('0x3'));var router=express[_0x7432('0x4')]();var fs_extra=require(_0x7432('0x5'));var auth=require(_0x7432('0x6'));var interaction=require(_0x7432('0x7'));var config=require(_0x7432('0x8'));var controller=require(_0x7432('0x9'));router[_0x7432('0xa')]('/',auth[_0x7432('0xb')](),controller[_0x7432('0xc')]);router[_0x7432('0xa')](_0x7432('0xd'),auth[_0x7432('0xb')](),controller[_0x7432('0xe')]);router[_0x7432('0xa')](_0x7432('0xf'),auth[_0x7432('0xb')](),controller['show']);router[_0x7432('0xa')](_0x7432('0x10'),auth[_0x7432('0xb')](),controller[_0x7432('0x11')]);router[_0x7432('0x12')]('/',auth[_0x7432('0xb')](),controller[_0x7432('0x13')]);router[_0x7432('0x12')](_0x7432('0x10'),auth[_0x7432('0xb')](),controller[_0x7432('0x14')]);router[_0x7432('0x15')](_0x7432('0xf'),auth[_0x7432('0xb')](),controller[_0x7432('0x16')]);router[_0x7432('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7432('0x18')]);module['exports']=router; \ No newline at end of file +var _0x124e=['getContacts','post','create','addContacts','put','update','delete','destroy','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/contacts'];(function(_0x5868ad,_0x47d39d){var _0x473caa=function(_0x111b85){while(--_0x111b85){_0x5868ad['push'](_0x5868ad['shift']());}};_0x473caa(++_0x47d39d);}(_0x124e,0x11a));var _0xe124=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x124e[_0x1deb03];return _0x189fe7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe124('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe124('0x1'));var interaction=require(_0xe124('0x2'));var config=require(_0xe124('0x3'));var controller=require(_0xe124('0x4'));router['get']('/',auth[_0xe124('0x5')](),controller[_0xe124('0x6')]);router[_0xe124('0x7')](_0xe124('0x8'),auth[_0xe124('0x5')](),controller['describe']);router[_0xe124('0x7')](_0xe124('0x9'),auth[_0xe124('0x5')](),controller[_0xe124('0xa')]);router[_0xe124('0x7')](_0xe124('0xb'),auth[_0xe124('0x5')](),controller[_0xe124('0xc')]);router[_0xe124('0xd')]('/',auth[_0xe124('0x5')](),controller[_0xe124('0xe')]);router[_0xe124('0xd')](_0xe124('0xb'),auth[_0xe124('0x5')](),controller[_0xe124('0xf')]);router[_0xe124('0x10')](_0xe124('0x9'),auth['isAuthenticated'](),controller[_0xe124('0x11')]);router[_0xe124('0x12')]('/:id',auth[_0xe124('0x5')](),controller[_0xe124('0x13')]);module[_0xe124('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 1135d01..e8f8d0a 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 _0x9d3e=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x1c57a5,_0x433064){var _0x3dadb9=function(_0x5cf957){while(--_0x5cf957){_0x1c57a5['push'](_0x1c57a5['shift']());}};_0x3dadb9(++_0x433064);}(_0x9d3e,0x13e));var _0xe9d3=function(_0x246500,_0x32af5d){_0x246500=_0x246500-0x0;var _0x456758=_0x9d3e[_0x246500];return _0x456758;};'use strict';var _=require(_0xe9d3('0x0'));var Sequelize=require(_0xe9d3('0x1'));module[_0xe9d3('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe9d3('0x3')]},'postalCode':{'type':Sequelize[_0xe9d3('0x3')]},'city':{'type':Sequelize[_0xe9d3('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe9d3('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xe9d3('0x3')]},'mobile':{'type':Sequelize[_0xe9d3('0x3')]},'fax':{'type':Sequelize[_0xe9d3('0x3')]},'email':{'type':Sequelize[_0xe9d3('0x3')]},'url':{'type':Sequelize[_0xe9d3('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xe9d3('0x3')]},'skype':{'type':Sequelize[_0xe9d3('0x3')]},'teams':{'type':Sequelize[_0xe9d3('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe9d3('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xe9d3('0x3')]},'UserId':{'type':Sequelize[_0xe9d3('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xe9d3('0x3')]},'priority':{'type':Sequelize[_0xe9d3('0x4')](0x2)[_0xe9d3('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe9d3('0x6')],'defaultValue':Sequelize[_0xe9d3('0x7')]},'dialTimezone':{'type':Sequelize[_0xe9d3('0x3')]},'utcOffset':{'type':Sequelize[_0xe9d3('0x4')]}}; \ No newline at end of file +var _0x9d3f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x3ec5ce,_0x4b97aa){var _0x3a9e68=function(_0x2e2be4){while(--_0x2e2be4){_0x3ec5ce['push'](_0x3ec5ce['shift']());}};_0x3a9e68(++_0x4b97aa);}(_0x9d3f,0xf3));var _0xf9d3=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x9d3f[_0x590a38];return _0xf36626;};'use strict';var _=require(_0xf9d3('0x0'));var Sequelize=require(_0xf9d3('0x1'));module[_0xf9d3('0x2')]={'firstName':{'type':Sequelize[_0xf9d3('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf9d3('0x3')]},'street':{'type':Sequelize[_0xf9d3('0x3')]},'postalCode':{'type':Sequelize[_0xf9d3('0x3')]},'city':{'type':Sequelize[_0xf9d3('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xf9d3('0x3')]},'description':{'type':Sequelize[_0xf9d3('0x4')]},'phone':{'type':Sequelize[_0xf9d3('0x3')]},'mobile':{'type':Sequelize[_0xf9d3('0x3')]},'fax':{'type':Sequelize[_0xf9d3('0x3')]},'email':{'type':Sequelize[_0xf9d3('0x3')]},'url':{'type':Sequelize[_0xf9d3('0x3')]},'facebook':{'type':Sequelize[_0xf9d3('0x3')]},'fb_data':{'type':Sequelize[_0xf9d3('0x3')]},'twitter':{'type':Sequelize[_0xf9d3('0x3')]},'skype':{'type':Sequelize[_0xf9d3('0x3')]},'teams':{'type':Sequelize[_0xf9d3('0x3')]},'viber':{'type':Sequelize[_0xf9d3('0x3')]},'line':{'type':Sequelize[_0xf9d3('0x3')]},'wechat':{'type':Sequelize[_0xf9d3('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf9d3('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xf9d3('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf9d3('0x6')],'defaultValue':Sequelize[_0xf9d3('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf9d3('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bf992ea..e33abaa 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 _0xdb96=['c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','toString','Tags','catch','params','columnName','analytics','findAll','displayName','alias','custom','values','body','get','mergeWith','tags','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','update','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','findOrCreate','contact','all','show','Tag','color','ContactItemType','ItemType','Phones.OrderBy','omit','pickBy','format','table','phone','CmHopper','getTags','sort','setTags','findOne','ids','setAdditionalPhones','CmContactHasItem','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','ContactId','options','include','rows','getHopperHistories','includeAll','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','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','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','send','upload','parse','meta','import','binding','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','importUpdates','../../components/import/cm/csvUpdates','error\x20child\x20process','mail','openchannel','fax','channel','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','userDisposition','userSecondDisposition','UserId','fullname','createdAt','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','Owner','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','Interaction','sortBy','reverse','slice','moment','bluebird','path','squel','papaparse','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','undefined','count','set','Content-Range','destroy','then','end','sendStatus','error','stack','name','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','trimStart','fieldType','type','query','intersection','model','fields','attributes','nolimit','limit','order','where','filters','pick','select','field','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','conditions','find','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','castTo','DATE','buildExpression','text','start','hasOwnProperty','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','split','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','QueryTypes','SELECT','clone','DESC','having','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','role','sequelize','keyBy','merge','c.id'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xdb96,0xc3));var _0x6db9=function(_0xbc75c2,_0x371823){_0xbc75c2=_0xbc75c2-0x0;var _0x134d21=_0xdb96[_0xbc75c2];return _0x134d21;};'use strict';var moment=require(_0x6db9('0x0'));var BPromise=require(_0x6db9('0x1'));var util=require('util');var path=require(_0x6db9('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6db9('0x3'));var Papa=require(_0x6db9('0x4'));var Redis=require('ioredis');var qs=require(_0x6db9('0x5'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x6db9('0x6'));var config=require(_0x6db9('0x7'));var shared=require(_0x6db9('0x8'));var db=require(_0x6db9('0x9'))['db'];config[_0x6db9('0xa')]=_[_0x6db9('0xb')](config['redis'],{'host':_0x6db9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6db9('0xa')]));require(_0x6db9('0xd'))[_0x6db9('0xe')](socket);function respondWithResult(_0x1edad9,_0x5ce1e4){_0x5ce1e4=_0x5ce1e4||0xc8;return function(_0xdf7fea){if(_0xdf7fea){return _0x1edad9[_0x6db9('0xf')](_0x5ce1e4)[_0x6db9('0x10')](_0xdf7fea);}};}function respondWithFilteredResult(_0x3ab10c,_0xad0d9f){return function(_0x3ef7dc){if(_0x3ef7dc){var _0x5e1d19=typeof _0xad0d9f[_0x6db9('0x11')]===_0x6db9('0x12')&&typeof _0xad0d9f['limit']==='undefined';var _0x3b90bc=_0x3ef7dc[_0x6db9('0x13')];var _0x1b3aa5=_0x5e1d19?0x0:_0xad0d9f['offset'];var _0x14de7e=_0x5e1d19?_0x3ef7dc[_0x6db9('0x13')]:_0xad0d9f[_0x6db9('0x11')]+_0xad0d9f['limit'];var _0x3ceadf;if(_0x14de7e>=_0x3b90bc){_0x14de7e=_0x3b90bc;_0x3ceadf=0xc8;}else{_0x3ceadf=0xce;}_0x3ab10c[_0x6db9('0xf')](_0x3ceadf);return _0x3ab10c[_0x6db9('0x14')](_0x6db9('0x15'),_0x1b3aa5+'-'+_0x14de7e+'/'+_0x3b90bc)[_0x6db9('0x10')](_0x3ef7dc);}return null;};}function saveUpdates(_0x38458a){return function(_0xa9834){if(_0xa9834){return _0xa9834['update'](_0x38458a)['then'](function(_0x29ee67){return _0x29ee67;});}return null;};}function removeEntity(_0x5afbd0){return function(_0x139d03){if(_0x139d03){return _0x139d03[_0x6db9('0x16')]()[_0x6db9('0x17')](function(){_0x5afbd0['status'](0xcc)[_0x6db9('0x18')]();});}};}function handleEntityNotFound(_0x165196){return function(_0x4fc318){if(!_0x4fc318){_0x165196[_0x6db9('0x19')](0x194);}return _0x4fc318;};}function handleError(_0x4c4571,_0x626531){_0x626531=_0x626531||0x1f4;return function(_0x5bf748){logger[_0x6db9('0x1a')](_0x5bf748[_0x6db9('0x1b')]);if(_0x5bf748[_0x6db9('0x1c')]){delete _0x5bf748[_0x6db9('0x1c')];}_0x4c4571[_0x6db9('0xf')](_0x626531)['send'](_0x5bf748);};}exports[_0x6db9('0x1d')]=function(_0x2f1f65,_0x1a6407){var _0x2bc035={},_0x33619e={},_0x57d3f0={'count':0x0,'rows':[]};return db[_0x6db9('0x1e')][_0x6db9('0x1f')]()['then'](function(_0x568c44){var _0x574b0d=[];for(var _0x3359c0=0x0;_0x3359c00x1){_0x2a9112['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x54084e),null);}else{if(qs[_0x6db9('0x60')](_0x54084e)){_0x2a9112['or'](_0x6db9('0x61'),_0x54084e+'%');_0x2a9112['or']('c.phone\x20LIKE\x20?',_0x54084e+'%');_0x2a9112['or']('c.mobile\x20LIKE\x20?',_0x54084e+'%');_0x2a9112['or'](_0x6db9('0x62'),_0x54084e+'%');}else if(qs[_0x6db9('0x63')](_0x54084e)){_0x2a9112['or']('c.email\x20LIKE\x20?',_0x54084e+'%');}else{_0x2a9112['or'](_0x6db9('0x64'),'%'+_0x54084e+'%');_0x2a9112['or'](_0x6db9('0x65'),'%'+_0x54084e+'%');_0x2a9112['or'](_0x6db9('0x66'),'%'+_0x54084e+'%');}}}}_0x4e2d3b[_0x6db9('0x31')](_0x2a9112);_0x4e2d3b['group']('c.id');var _0x19540d={'type':db['Sequelize'][_0x6db9('0x67')][_0x6db9('0x68')],'raw':!![]};var _0xf1ca32=_0x4e2d3b[_0x6db9('0x69')]()['field']('c.id');if(_0x2bc035['order']){_0x2bc035['order']['forEach'](function(_0x94a264){_0x4e2d3b['order']('c.'+_0x94a264[0x0],_0x94a264[0x1]===_0x6db9('0x6a')?![]:!![]);});}if(!_[_0x6db9('0x56')](_0x3bdc94)){_0x4e2d3b[_0x6db9('0x6b')](_0x9cb407);_0xf1ca32[_0x6db9('0x31')]('t.id\x20IN\x20?',_0x3bdc94);}BPromise[_0x6db9('0x6c')]()[_0x6db9('0x17')](function(){if(!_0x2e0e77)return;if(_0x2f1f65[_0x6db9('0x6d')]['role']!==_0x6db9('0x6e'))return;if(!_[_0x6db9('0x6f')](_0x2e0e77['conditions'],[_0x6db9('0x35'),_0x6db9('0x49')])){return _0x2f1f65[_0x6db9('0x6d')][_0x6db9('0x70')]({'attributes':['id'],'raw':!![]})[_0x6db9('0x17')](function(_0x1a6a5a){if(_[_0x6db9('0x56')](_0x1a6a5a)){_0xf1ca32[_0x6db9('0x31')](_0x6db9('0x71'));_0x4e2d3b[_0x6db9('0x31')](_0x6db9('0x71'));}else{_0xf1ca32[_0x6db9('0x31')](_0x6db9('0x58'),_[_0x6db9('0x45')](_0x1a6a5a,'id'));_0x4e2d3b[_0x6db9('0x31')]('c.ListId\x20IN\x20?',_[_0x6db9('0x45')](_0x1a6a5a,'id'));}});}})[_0x6db9('0x17')](function(){if(_0x2f1f65[_0x6db9('0x6d')][_0x6db9('0x72')]==='agent'&&!_0x2e0e77&&!_0x2f1f65['query']['ListId'])return[];return db[_0x6db9('0x73')][_0x6db9('0x29')](_0xf1ca32['toString'](),_0x19540d);})['then'](function(_0x4dd6fd){_0x57d3f0[_0x6db9('0x13')]=_0x4dd6fd[_0x6db9('0x21')];if(_0x57d3f0[_0x6db9('0x13')]===0x0)return[];return db[_0x6db9('0x73')][_0x6db9('0x29')](_0x1d346c['toString'](),_0x19540d)[_0x6db9('0x17')](function(_0x118ac0){_0x411ad1=_[_0x6db9('0x74')](_0x118ac0,'id');_0x19540d=_[_0x6db9('0x75')](_0x19540d,{'model':db[_0x6db9('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f1f65[_0x6db9('0x29')]['fields']){_0x2bc035[_0x6db9('0x2d')][_0x6db9('0x46')](function(_0x1aa625){_0x4e2d3b[_0x6db9('0x35')]('c.'+_0x1aa625);});}else{_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x76'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x77'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x78'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x79'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x7a'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x7b'));_0x4e2d3b['field'](_0x6db9('0x7c'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x7d'));_0x4e2d3b['field'](_0x6db9('0x7e'));_0x4e2d3b['field']('c.deletedAt');_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x7f'));_0x4e2d3b[_0x6db9('0x35')](_0x6db9('0x80'),_0x6db9('0x81'));}if(_0x2bc035[_0x6db9('0x2f')])_0x4e2d3b[_0x6db9('0x2f')](_0x2bc035['limit']);if(_0x2bc035[_0x6db9('0x11')])_0x4e2d3b[_0x6db9('0x11')](_0x2bc035[_0x6db9('0x11')]);return db[_0x6db9('0x73')][_0x6db9('0x29')](_0x4e2d3b[_0x6db9('0x82')](),_0x19540d);});})[_0x6db9('0x17')](function(_0x33a68e){_0x33a68e[_0x6db9('0x46')](function(_0xdd7045){if(_0xdd7045['TagIds']){_0xdd7045[_0x6db9('0x83')]=[];_0xdd7045[_0x6db9('0x81')][_0x6db9('0x5f')](',')[_0x6db9('0x46')](function(_0x77d4b){_0xdd7045[_0x6db9('0x83')][_0x6db9('0x24')](_0x411ad1[_0x77d4b]);});}delete _0xdd7045[_0x6db9('0x81')];});_0x57d3f0['rows']=_0x33a68e;return _0x57d3f0;})[_0x6db9('0x17')](respondWithFilteredResult(_0x1a6407,_0x2bc035));})[_0x6db9('0x84')](handleError(_0x1a6407,null));};exports['destroy']=function(_0x573065,_0x1e0c3d){return db['CmContact'][_0x6db9('0x44')]({'where':{'id':_0x573065[_0x6db9('0x85')]['id']}})[_0x6db9('0x17')](handleEntityNotFound(_0x1e0c3d,null))[_0x6db9('0x17')](removeEntity(_0x1e0c3d,null))[_0x6db9('0x84')](handleError(_0x1e0c3d,null));};exports[_0x6db9('0x1f')]=function(_0x5b46e0,_0x12127d){return db['CmContact'][_0x6db9('0x1f')]()[_0x6db9('0x17')](function(_0x5f0e1d){delete _0x5f0e1d['tags'];for(var _0x4b9443=0x0;_0x4b94430x0){return new Promise(function(_0x2dcce4,_0x186dba){var _0x102310=[];for(var _0x20263a=0x0;_0x20263a<_0x4722b5[_0x6db9('0x21')];_0x20263a++){_0x102310[_0x6db9('0x24')](insertAdditionalPhones(_0x4722b5[_0x20263a][_0x6db9('0xb5')],_0x4722b5[_0x20263a][_0x6db9('0xb1')]));}Promise[_0x6db9('0xb6')](_0x102310)['then'](function(){_0x2dcce4(0x1);});})['then'](function(){return{'success':_0x5f1ea5,'failure':_0x57a013,'duplicates':_0x4e3d72};});}else{return{'success':_0x5f1ea5,'failure':_0x57a013,'duplicates':_0x4e3d72};}}})[_0x6db9('0x17')](respondWithResult(_0x3b2ea0,0xc9))[_0x6db9('0x84')](handleError(_0x3b2ea0,null));};exports[_0x6db9('0xb7')]=function(_0x2e3ae3,_0x111795){var _0x26cdb2;return db[_0x6db9('0x1e')]['describe']()[_0x6db9('0x17')](function(_0x4aad6d){return db['CmContact'][_0x6db9('0x44')]({'where':{'id':_0x2e3ae3['params']['id']},'include':[{'model':db[_0x6db9('0xb8')],'as':_0x6db9('0x83'),'attributes':['id','name',_0x6db9('0xb9')],'required':_0x2e3ae3[_0x6db9('0x29')][_0x6db9('0x5c')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x2e3ae3[_0x6db9('0x85')]['id']},'required':![],'include':[{'model':db[_0x6db9('0xba')],'as':_0x6db9('0xbb')}]}],'order':[db[_0x6db9('0x73')]['literal'](_0x6db9('0xbc'))],'attributes':_[_0x6db9('0x20')](_0x4aad6d)});})[_0x6db9('0x17')](function(_0x3fa38c){if(!_[_0x6db9('0x54')](_0x3fa38c)){_0x26cdb2=_0x3fa38c[_0x6db9('0x8e')]({'plain':!![]});var _0x4e41a4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3fa38c&&_0x3fa38c[_0x6db9('0x57')]){if(_0x3fa38c[_0x6db9('0x57')]){_0x4e41a4[_0x6db9('0x31')]['$and']['push']({'ListId':{'$ne':_0x3fa38c['ListId']}});}}return db[_0x6db9('0x25')][_0x6db9('0x88')](_0x4e41a4);}})[_0x6db9('0x17')](function(_0x23c8ca){if(!_[_0x6db9('0x54')](_0x23c8ca)){return _[_0x6db9('0xbd')](_0x26cdb2,_[_0x6db9('0x45')](_0x23c8ca,function(_0x499ef0){return util['format']('cf_%d',_0x499ef0['id']);}));}})[_0x6db9('0x17')](handleEntityNotFound(_0x111795,null))['then'](respondWithResult(_0x111795,null))[_0x6db9('0x84')](handleError(_0x111795,null));};exports[_0x6db9('0x99')]=function(_0x5dd6d8,_0x54f199){var _0x2a9fe7;if(_0x5dd6d8['body']['id']){delete _0x5dd6d8[_0x6db9('0x8d')]['id'];}if(!_[_0x6db9('0x54')](_0x5dd6d8[_0x6db9('0x8d')]['dialTimezone'])){var _0xcfc391=_0x5dd6d8[_0x6db9('0x8d')]['dialTimezone'];if(!_['isNil'](shared[_0x6db9('0xaf')][_0xcfc391]))_0x5dd6d8[_0x6db9('0x8d')][_0x6db9('0xb0')]=shared[_0x6db9('0xaf')][_0xcfc391][_0x6db9('0xb0')];}return db['CmContact'][_0x6db9('0x44')]({'where':{'id':_0x5dd6d8[_0x6db9('0x85')]['id']}})['then'](handleEntityNotFound(_0x54f199,null))[_0x6db9('0x17')](saveUpdates(_0x5dd6d8[_0x6db9('0x8d')],null))[_0x6db9('0x17')](function(_0x6a6ca1){_0x2a9fe7=_0x6a6ca1;var _0x14c143={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x6a6ca1&&_0x6a6ca1[_0x6db9('0x57')]){if(_0x6a6ca1[_0x6db9('0x57')]){_0x14c143[_0x6db9('0x31')]['$and'][_0x6db9('0x24')]({'ListId':{'$ne':_0x6a6ca1['ListId']}});}}return db['CmCustomField']['findAll'](_0x14c143);})[_0x6db9('0x17')](function(_0x217dea){if(_0x217dea){return _[_0x6db9('0xbd')](_[_0x6db9('0xbe')](_0x5dd6d8[_0x6db9('0x8d')],function(_0x50106e,_0x2393e8){return _['startsWith'](_0x2393e8,_0x6db9('0x23'));}),_[_0x6db9('0x45')](_0x217dea,function(_0x553590){return util[_0x6db9('0xbf')]('cf_%d',_0x553590['id']);}));}})[_0x6db9('0x17')](function(_0x4f1319){if(_0x4f1319&&!_['isEmpty'](_0x4f1319)){var _0x30cc89=squel[_0x6db9('0x99')]()[_0x6db9('0xc0')](_0x6db9('0x38'))['setFields'](_0x4f1319)['where']('id\x20=\x20?',_0x5dd6d8[_0x6db9('0x85')]['id'])['toParam']();return db['sequelize'][_0x6db9('0x29')](_0x30cc89[_0x6db9('0x51')],{'replacements':_0x30cc89['values']});}})['then'](function(){if(_0x5dd6d8[_0x6db9('0x8d')][_0x6db9('0xc1')]&&_0x2a9fe7){return db[_0x6db9('0xc2')]['update']({'phone':_0x5dd6d8[_0x6db9('0x8d')][_0x6db9('0xc1')],'OrderBy':0x0},{'where':{'ContactId':_0x2a9fe7['id']}});}})['then'](function(){return _0x2a9fe7;})[_0x6db9('0x17')](respondWithResult(_0x54f199,null))['catch'](handleError(_0x54f199,null));};exports[_0x6db9('0xc3')]=function(_0x1594c8,_0x57da33){var _0x489dee={};var _0x2ecd8d={};var _0x243539;var _0x42c7da;return db[_0x6db9('0x1e')]['findOne']({'where':{'id':_0x1594c8[_0x6db9('0x85')]['id']}})[_0x6db9('0x17')](handleEntityNotFound(_0x57da33,null))[_0x6db9('0x17')](function(_0x57b5dd){if(_0x57b5dd){_0x243539=_0x57b5dd;_0x2ecd8d[_0x6db9('0x2b')]=_[_0x6db9('0x20')](db['Tag']['rawAttributes']);_0x2ecd8d[_0x6db9('0x29')]=_[_0x6db9('0x20')](_0x1594c8[_0x6db9('0x29')]);_0x2ecd8d[_0x6db9('0x32')]=_['intersection'](_0x2ecd8d['model'],_0x2ecd8d[_0x6db9('0x29')]);_0x489dee[_0x6db9('0x2d')]=_[_0x6db9('0x2a')](_0x2ecd8d[_0x6db9('0x2b')],qs['fields'](_0x1594c8['query']['fields']));_0x489dee[_0x6db9('0x2d')]=_0x489dee['attributes']['length']?_0x489dee['attributes']:_0x2ecd8d['model'];_0x489dee[_0x6db9('0x30')]=qs['sort'](_0x1594c8['query'][_0x6db9('0xc4')]);_0x489dee['where']=qs[_0x6db9('0x32')](_[_0x6db9('0x33')](_0x1594c8[_0x6db9('0x29')],_0x2ecd8d[_0x6db9('0x32')]));if(_0x1594c8[_0x6db9('0x29')][_0x6db9('0x5d')]){_0x489dee[_0x6db9('0x31')]=_[_0x6db9('0x75')](_0x489dee['where'],{'$or':_[_0x6db9('0x45')](_0x489dee['attributes'],function(_0x3167cc){var _0x471ac9={};_0x471ac9[_0x3167cc]={'$like':'%'+_0x1594c8['query'][_0x6db9('0x5d')]+'%'};return _0x471ac9;})});}_0x489dee=_[_0x6db9('0x75')]({},_0x489dee,_0x1594c8['options']);return _0x243539[_0x6db9('0xc3')](_0x489dee);}})['then'](function(_0x7253f){if(_0x7253f){_0x42c7da=_0x7253f[_0x6db9('0x21')];if(!_0x1594c8[_0x6db9('0x29')][_0x6db9('0x53')]('nolimit')){_0x489dee['limit']=qs[_0x6db9('0x2f')](_0x1594c8[_0x6db9('0x29')]['limit']);_0x489dee[_0x6db9('0x11')]=qs[_0x6db9('0x11')](_0x1594c8[_0x6db9('0x29')][_0x6db9('0x11')]);}return _0x243539[_0x6db9('0xc3')](_0x489dee);}})[_0x6db9('0x17')](function(_0xf8c4ea){if(_0xf8c4ea){return _0xf8c4ea?{'count':_0x42c7da,'rows':_0xf8c4ea}:null;}})[_0x6db9('0x17')](respondWithResult(_0x57da33,null))['catch'](handleError(_0x57da33,null));};exports[_0x6db9('0xc5')]=function(_0x3f1451,_0x502745){if(_0x3f1451[_0x6db9('0x8d')]['id']){delete _0x3f1451['body']['id'];}return db['CmContact'][_0x6db9('0xc6')]({'where':{'id':_0x3f1451[_0x6db9('0x85')]['id']}})['then'](handleEntityNotFound(_0x502745,null))[_0x6db9('0x17')](function(_0x2431a6){if(_0x2431a6){return _0x2431a6[_0x6db9('0xc5')](_0x3f1451['body'][_0x6db9('0xc7')]||[]);}return null;})[_0x6db9('0x17')](respondWithResult(_0x502745,null))[_0x6db9('0x84')](handleError(_0x502745,null));};exports[_0x6db9('0xc8')]=function(_0x1baefd,_0x527df2){var _0x268aaf=[];_0x268aaf[_0x6db9('0x24')](addAdditionalPhones(_0x1baefd[_0x6db9('0x8d')]));Promise['all'](_0x268aaf)[_0x6db9('0x17')](function(){_0x268aaf=[];_0x268aaf['push'](deleteCmHopperPhones(_0x1baefd[_0x6db9('0x8d')]['id']));_0x268aaf[_0x6db9('0x24')](addCmHopperPhones(_0x1baefd[_0x6db9('0x8d')]['id']));Promise[_0x6db9('0xb6')](_0x268aaf)[_0x6db9('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x527df2,null));});};function addAdditionalPhones(_0x1f0765){var _0x480aef;return new Promise(function(_0x1c146c,_0x3cc51f){return db[_0x6db9('0xc9')][_0x6db9('0x16')]({'where':{'CmContactId':_0x1f0765['id']}})[_0x6db9('0x17')](function(){db[_0x6db9('0xba')][_0x6db9('0x88')]({'raw':!![],'attributes':['id','OrderBy']})[_0x6db9('0x17')](function(_0x48d6f7){var _0x52bb36=[];for(var _0x2bacfc=0x0;_0x2bacfc<_0x1f0765[_0x6db9('0xca')][_0x6db9('0x21')];_0x2bacfc++){var _0x4f4a81=_0x1f0765['item_types']?_['isNil'](_0x1f0765['item_types'][_0x2bacfc])?'':_0x1f0765[_0x6db9('0xcb')][_0x2bacfc]:_0x1f0765[_0x6db9('0xca')][_0x2bacfc][_0x6db9('0xcc')]?_0x1f0765[_0x6db9('0xca')][_0x2bacfc]['ItemTypeId']:'';var _0x593cb8=_[_0x6db9('0x54')](_0x1f0765[_0x6db9('0xca')][_0x2bacfc][_0x6db9('0xcd')])?'':_0x1f0765[_0x6db9('0xca')][_0x2bacfc][_0x6db9('0xcd')];var _0x58d46d=_0x4f4a81+':'+_0x1f0765[_0x6db9('0xca')][_0x2bacfc]['phone']+'§'+_0x593cb8;if(_[_0x6db9('0x54')](_0x480aef))_0x480aef=_0x58d46d;else _0x480aef+=';'+_0x58d46d;var _0x274482=null;if(_0x1f0765[_0x6db9('0xcb')]){if(!_['isNil'](_0x1f0765[_0x6db9('0xcb')][_0x2bacfc])){var _0x9203ee=_[_0x6db9('0x44')](_0x48d6f7,function(_0x11054b){return _0x11054b['id']===_0x1f0765[_0x6db9('0xcb')][_0x2bacfc];});if(!_[_0x6db9('0x54')](_0x9203ee)){_0x274482=_0x9203ee[_0x6db9('0xce')];}}}else{if(!_[_0x6db9('0x54')](_0x1f0765[_0x6db9('0xca')][_0x2bacfc])){var _0x9203ee=_[_0x6db9('0x44')](_0x48d6f7,function(_0x33aabe){return _0x33aabe['id']===_0x1f0765[_0x6db9('0xca')][_0x2bacfc][_0x6db9('0xcc')];});if(!_[_0x6db9('0x54')](_0x9203ee)){_0x274482=_0x2bacfc;}}}if(_[_0x6db9('0x54')](_0x274482)){_0x274482=0x64;}_0x52bb36[_0x6db9('0x24')](addAdditionalPhone(_0x1f0765['id'],_0x1f0765['items'][_0x2bacfc][_0x6db9('0xc1')],_0x1f0765[_0x6db9('0xcb')]?_['isNil'](_0x1f0765['item_types'][_0x2bacfc])?null:_0x1f0765['item_types'][_0x2bacfc]:_0x1f0765[_0x6db9('0xca')][_0x2bacfc]['ItemTypeId']?_0x1f0765['items'][_0x2bacfc][_0x6db9('0xcc')]:null,_0x274482,_0x593cb8));}Promise[_0x6db9('0xb6')](_0x52bb36)[_0x6db9('0x17')](function(){db[_0x6db9('0x1e')][_0x6db9('0x99')]({'AdditionalPhones':_0x480aef},{'where':{'id':_0x1f0765['id']}})[_0x6db9('0x17')](function(){_0x1c146c(0x1);});});});});});}function addAdditionalPhone(_0x65030f,_0x1d0711,_0x42b430,_0x17ecd4,_0x1e323b){return db[_0x6db9('0xc9')][_0x6db9('0x44')]({'where':{'CmContactId':_0x65030f,'item':_0x1d0711}})['then'](function(_0x1aa994){if(_0x1aa994)logger['info'](_0x6db9('0xcf'),_0x1aa994);else{db['CmContactHasItem'][_0x6db9('0x98')]({'CmContactId':_0x65030f,'item':_0x1d0711,'ItemTypeId':_0x42b430,'OrderBy':_0x17ecd4,'ItemClass':'PHONE','description':_0x1e323b});}});}function deletePhones(_0x2fdb7c){return db[_0x6db9('0xc9')][_0x6db9('0x16')]({'where':{'CmContactId':_0x2fdb7c}});}function deleteCmHopperPhones(_0x157799){return new Promise(function(_0x198fce,_0x74c8f7){return db[_0x6db9('0xc2')][_0x6db9('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x157799}})[_0x6db9('0x17')](function(_0xf00503){db[_0x6db9('0xd0')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x6db9('0x45')](_0xf00503,'id')}}});})['then'](function(){_0x198fce(0x1);});});}function addCmHopperPhones(_0x346529){return new Promise(function(_0x3c471a,_0xa01e49){return db['CmHopper'][_0x6db9('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x346529}})[_0x6db9('0x17')](function(_0x52b0e9){var _0x56f522=[];_[_0x6db9('0x45')](_0x52b0e9,function(_0x47cc2a){_0x56f522['push'](createCmHopperPhone(_0x346529,_0x47cc2a['id']));});Promise[_0x6db9('0xb6')](_0x56f522)[_0x6db9('0x17')](function(){_0x3c471a(0x1);});});});}function createCmHopperPhone(_0x13a1d2,_0xaf3b51){return new Promise(function(_0x4458ed,_0x47a188){db[_0x6db9('0xc9')][_0x6db9('0x88')]({'raw':!![],'attributes':[_0x6db9('0xd1'),_0x6db9('0xce')],'where':{'CmContactId':_0x13a1d2,'ItemClass':_0x6db9('0xd2')},'include':[{'model':db[_0x6db9('0xba')],'attributes':['OrderBy'],'as':_0x6db9('0xbb')}],'order':[_0x6db9('0xce'),db[_0x6db9('0x73')][_0x6db9('0xd3')](_0x6db9('0xd4'))]})[_0x6db9('0x17')](function(_0x147fee){var _0xe00bbd=0x1;var _0x539157=_[_0x6db9('0x45')](_0x147fee,function(_0x4a9c95){_0x4a9c95[_0x6db9('0xd5')]=_0xaf3b51;_0x4a9c95[_0x6db9('0xc1')]=_0x4a9c95[_0x6db9('0xd1')];_0x4a9c95[_0x6db9('0xce')]=_0xe00bbd;delete _0x4a9c95[_0x6db9('0xd6')];_0xe00bbd=_0xe00bbd+0x1;return _0x4a9c95;});return db[_0x6db9('0xd0')]['bulkCreate'](_0x539157,{});})[_0x6db9('0x17')](function(){_0x4458ed(0x1);});});}function insertAdditionalPhones(_0x4dfd85,_0x530e59){return new Promise(function(_0x2024a6,_0x5c3244){var _0x23ac64=[];for(var _0x2d768f=0x0;_0x2d768f<_0x530e59[_0x6db9('0x21')];_0x2d768f++){var _0x147b44=_0x530e59[_0x2d768f];_0x23ac64[_0x6db9('0x24')](parseContactItemType(_0x147b44));}Promise[_0x6db9('0xb6')](_0x23ac64)[_0x6db9('0x17')](function(){var _0x190695={'id':_0x4dfd85['id'],'items':_0x530e59};return addAdditionalPhones(_0x190695)['then'](function(_0x445d0d){return addCmHopperPhones(_0x4dfd85['id']);});})[_0x6db9('0x17')](function(){_0x2024a6(_0x4dfd85);});});}function parseContactItemType(_0x4fba68){return new Promise(function(_0x4da011,_0x56235e){if(_0x4fba68['hasOwnProperty'](_0x6db9('0xcc'))){_0x4da011(_0x4fba68);}else{return db[_0x6db9('0xba')][_0x6db9('0x44')]({'where':{'name':_0x4fba68[_0x6db9('0xbb')]}})['then'](function(_0x2b0064){if(_[_0x6db9('0x54')](_0x2b0064))_0x4fba68[_0x6db9('0xcc')]=null;else _0x4fba68[_0x6db9('0xcc')]=_0x2b0064['id'];_0x4da011(_0x4fba68);});}});}exports['getAdditionalPhones']=function(_0x3b909e,_0x2fa1ac){return db[_0x6db9('0xc9')][_0x6db9('0x88')]({'raw':!![],'where':{'CmContactId':_0x3b909e[_0x6db9('0x85')]['id'],'ItemClass':_0x6db9('0xd2')},'include':[{'model':db[_0x6db9('0xba')],'as':_0x6db9('0xbb')}],'order':[[_0x6db9('0xce')],[db[_0x6db9('0x73')][_0x6db9('0xd3')](_0x6db9('0xd4'))]]})['then'](function(_0x4cd670){return _0x4cd670;})['then'](respondWithResult(_0x2fa1ac,null))[_0x6db9('0x84')](handleError(_0x2fa1ac,null));};exports['duplicateAdditionalPhones']=function(_0x548a7a,_0x51ce12){return db[_0x6db9('0xc9')][_0x6db9('0x88')]({'raw':!![],'where':{'CmContactId':_0x548a7a[_0x6db9('0x8d')][_0x6db9('0xd7')]}})[_0x6db9('0x17')](function(_0x35f34a){var _0x328d6a=_[_0x6db9('0x45')](_0x35f34a,function(_0x32664f){_0x32664f['CmContactId']=_0x548a7a[_0x6db9('0x8d')][_0x6db9('0xd8')];return _0x32664f;});return db[_0x6db9('0xc9')][_0x6db9('0xb2')](_0x328d6a,{});})['then'](function(_0x3bbd1e){return addCmHopperPhones(_0x548a7a['body']['toContactId']);})[_0x6db9('0x17')](function(_0x445d03){return['ok'];})[_0x6db9('0x17')](respondWithResult(_0x51ce12,null))[_0x6db9('0x84')](handleError(_0x51ce12,null));};exports[_0x6db9('0xd9')]=function(_0x5b3202,_0x31bb0c){var _0x3f563d=[];_0x3f563d[_0x6db9('0x24')](createCmHopperPhone(_0x5b3202[_0x6db9('0x8d')]['id'],_0x5b3202[_0x6db9('0x8d')][_0x6db9('0xda')]));Promise[_0x6db9('0xb6')](_0x3f563d)[_0x6db9('0x17')](function(){return[0x1];})[_0x6db9('0x17')](respondWithResult(_0x31bb0c,null));};exports[_0x6db9('0xdb')]=function(_0x4e1308,_0x4c138b){var _0x269c86={'raw':![],'where':{}};var _0x36440b={};var _0x362df4={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x4e1308['params']['id']}})['then'](handleEntityNotFound(_0x4c138b,null))[_0x6db9('0x17')](function(_0x484d93){if(_0x484d93){_0x36440b[_0x6db9('0x2b')]=_['keys'](db[_0x6db9('0xc2')][_0x6db9('0xdc')]);_0x36440b['query']=_['keys'](_0x4e1308[_0x6db9('0x29')]);_0x36440b[_0x6db9('0x32')]=_[_0x6db9('0x2a')](_0x36440b[_0x6db9('0x2b')],_0x36440b['query']);_0x269c86['attributes']=_['intersection'](_0x36440b[_0x6db9('0x2b')],qs[_0x6db9('0x2c')](_0x4e1308[_0x6db9('0x29')][_0x6db9('0x2c')]));_0x269c86[_0x6db9('0x2d')]=_0x269c86[_0x6db9('0x2d')][_0x6db9('0x21')]?_0x269c86[_0x6db9('0x2d')]:_0x36440b[_0x6db9('0x2b')];if(!_0x4e1308[_0x6db9('0x29')]['hasOwnProperty'](_0x6db9('0x2e'))){_0x269c86[_0x6db9('0x2f')]=qs['limit'](_0x4e1308[_0x6db9('0x29')][_0x6db9('0x2f')]);_0x269c86[_0x6db9('0x11')]=qs[_0x6db9('0x11')](_0x4e1308['query']['offset']);}_0x269c86[_0x6db9('0x30')]=qs[_0x6db9('0xc4')](_0x4e1308['query'][_0x6db9('0xc4')]);_0x269c86['where']=qs['filters'](_[_0x6db9('0x33')](_0x4e1308[_0x6db9('0x29')],_0x36440b['filters']));_0x269c86[_0x6db9('0x31')][_0x6db9('0xdd')]=_0x484d93['id'];if(_0x4e1308[_0x6db9('0x29')][_0x6db9('0x5d')]){_0x269c86[_0x6db9('0x31')]=_[_0x6db9('0x75')](_0x269c86['where'],{'$or':_[_0x6db9('0x45')](_0x269c86[_0x6db9('0x2d')],function(_0x15dcd5){var _0x5eb651={};_0x5eb651[_0x15dcd5]={'$like':'%'+_0x4e1308[_0x6db9('0x29')][_0x6db9('0x5d')]+'%'};return _0x5eb651;})});}_0x269c86=_[_0x6db9('0x75')]({},_0x269c86,_0x4e1308[_0x6db9('0xde')]);return db[_0x6db9('0xc2')]['count']({'where':_0x269c86['where']})['then'](function(_0x354c0c){_0x362df4[_0x6db9('0x13')]=_0x354c0c;if(_0x4e1308[_0x6db9('0x29')]['includeAll']){_0x269c86[_0x6db9('0xdf')]=[{'all':!![]}];}return db[_0x6db9('0xc2')][_0x6db9('0x88')](_0x269c86);})['then'](function(_0x172074){_0x362df4[_0x6db9('0xe0')]=_0x172074;return _0x362df4;});}})[_0x6db9('0x17')](respondWithFilteredResult(_0x4c138b,_0x269c86))['catch'](handleError(_0x4c138b,null));};exports[_0x6db9('0xe1')]=function(_0x458ef6,_0x211099){var _0x386c70={'raw':!![],'where':{}};var _0x32ca8c={};var _0x433cfb={'count':0x0,'rows':[]};return db[_0x6db9('0x1e')][_0x6db9('0xc6')]({'where':{'id':_0x458ef6[_0x6db9('0x85')]['id']}})[_0x6db9('0x17')](handleEntityNotFound(_0x211099,null))[_0x6db9('0x17')](function(_0x9619f4){if(_0x9619f4){_0x32ca8c[_0x6db9('0x2b')]=_[_0x6db9('0x20')](db[_0x6db9('0xa3')][_0x6db9('0xdc')]);_0x32ca8c[_0x6db9('0x29')]=_[_0x6db9('0x20')](_0x458ef6[_0x6db9('0x29')]);_0x32ca8c[_0x6db9('0x32')]=_[_0x6db9('0x2a')](_0x32ca8c[_0x6db9('0x2b')],_0x32ca8c[_0x6db9('0x29')]);_0x386c70[_0x6db9('0x2d')]=_[_0x6db9('0x2a')](_0x32ca8c[_0x6db9('0x2b')],qs['fields'](_0x458ef6[_0x6db9('0x29')]['fields']));_0x386c70[_0x6db9('0x2d')]=_0x386c70[_0x6db9('0x2d')]['length']?_0x386c70[_0x6db9('0x2d')]:_0x32ca8c[_0x6db9('0x2b')];if(!_0x458ef6[_0x6db9('0x29')][_0x6db9('0x53')](_0x6db9('0x2e'))){_0x386c70[_0x6db9('0x2f')]=qs[_0x6db9('0x2f')](_0x458ef6['query']['limit']);_0x386c70[_0x6db9('0x11')]=qs[_0x6db9('0x11')](_0x458ef6[_0x6db9('0x29')][_0x6db9('0x11')]);}_0x386c70[_0x6db9('0x30')]=qs[_0x6db9('0xc4')](_0x458ef6['query'][_0x6db9('0xc4')]);_0x386c70[_0x6db9('0x31')]=qs[_0x6db9('0x32')](_['pick'](_0x458ef6['query'],_0x32ca8c[_0x6db9('0x32')]));_0x386c70['where'][_0x6db9('0xdd')]=_0x9619f4['id'];if(_0x458ef6['query']['filter']){_0x386c70[_0x6db9('0x31')]=_[_0x6db9('0x75')](_0x386c70[_0x6db9('0x31')],{'$or':_[_0x6db9('0x45')](_0x386c70[_0x6db9('0x2d')],function(_0x1d0eb3){var _0x1bb1ee={};_0x1bb1ee[_0x1d0eb3]={'$like':'%'+_0x458ef6[_0x6db9('0x29')][_0x6db9('0x5d')]+'%'};return _0x1bb1ee;})});}_0x386c70=_[_0x6db9('0x75')]({},_0x386c70,_0x458ef6['options']);return db[_0x6db9('0xa3')][_0x6db9('0x13')]({'where':_0x386c70['where']})[_0x6db9('0x17')](function(_0x4200f3){_0x433cfb[_0x6db9('0x13')]=_0x4200f3;if(_0x458ef6[_0x6db9('0x29')][_0x6db9('0xe2')]){_0x386c70[_0x6db9('0xdf')]=[{'all':!![]}];}return db[_0x6db9('0xa3')][_0x6db9('0x88')](_0x386c70);})['then'](function(_0x3e4ee4){_0x433cfb[_0x6db9('0xe0')]=_0x3e4ee4;return _0x433cfb;});}})['then'](respondWithFilteredResult(_0x211099,_0x386c70))[_0x6db9('0x84')](handleError(_0x211099,null));};exports[_0x6db9('0xe3')]=function(_0x4e1bfd,_0x43748f){var _0x1f0d80={'raw':!![],'where':{}};var _0x4c7e9d={};var _0x54fdb7={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x4e1bfd['params']['id']}})[_0x6db9('0x17')](handleEntityNotFound(_0x43748f,null))[_0x6db9('0x17')](function(_0x50129a){if(_0x50129a){_0x4c7e9d[_0x6db9('0x2b')]=_['keys'](db[_0x6db9('0xe4')]['rawAttributes']);_0x4c7e9d[_0x6db9('0x29')]=_['keys'](_0x4e1bfd[_0x6db9('0x29')]);_0x4c7e9d[_0x6db9('0x32')]=_[_0x6db9('0x2a')](_0x4c7e9d[_0x6db9('0x2b')],_0x4c7e9d[_0x6db9('0x29')]);_0x1f0d80[_0x6db9('0x2d')]=_['intersection'](_0x4c7e9d['model'],qs['fields'](_0x4e1bfd[_0x6db9('0x29')]['fields']));_0x1f0d80[_0x6db9('0x2d')]=_0x1f0d80[_0x6db9('0x2d')][_0x6db9('0x21')]?_0x1f0d80['attributes']:_0x4c7e9d[_0x6db9('0x2b')];if(!_0x4e1bfd[_0x6db9('0x29')]['hasOwnProperty'](_0x6db9('0x2e'))){_0x1f0d80['limit']=qs[_0x6db9('0x2f')](_0x4e1bfd[_0x6db9('0x29')][_0x6db9('0x2f')]);_0x1f0d80[_0x6db9('0x11')]=qs['offset'](_0x4e1bfd[_0x6db9('0x29')]['offset']);}_0x1f0d80[_0x6db9('0x30')]=qs[_0x6db9('0xc4')](_0x4e1bfd[_0x6db9('0x29')][_0x6db9('0xc4')]);_0x1f0d80[_0x6db9('0x31')]=qs['filters'](_['pick'](_0x4e1bfd['query'],_0x4c7e9d['filters']));_0x1f0d80[_0x6db9('0x31')][_0x6db9('0xdd')]=_0x50129a['id'];if(_0x4e1bfd[_0x6db9('0x29')][_0x6db9('0x5d')]){_0x1f0d80[_0x6db9('0x31')]=_[_0x6db9('0x75')](_0x1f0d80[_0x6db9('0x31')],{'$or':_[_0x6db9('0x45')](_0x1f0d80[_0x6db9('0x2d')],function(_0x3dce02){var _0x33b102={};_0x33b102[_0x3dce02]={'$like':'%'+_0x4e1bfd[_0x6db9('0x29')][_0x6db9('0x5d')]+'%'};return _0x33b102;})});}_0x1f0d80=_[_0x6db9('0x75')]({},_0x1f0d80,_0x4e1bfd[_0x6db9('0xde')]);return db['CmHopperFinal'][_0x6db9('0x13')]({'where':_0x1f0d80[_0x6db9('0x31')]})[_0x6db9('0x17')](function(_0x5d919a){_0x54fdb7[_0x6db9('0x13')]=_0x5d919a;if(_0x4e1bfd[_0x6db9('0x29')][_0x6db9('0xe2')]){_0x1f0d80[_0x6db9('0xdf')]=[{'all':!![]}];}return db[_0x6db9('0xe4')]['findAll'](_0x1f0d80);})['then'](function(_0x359024){_0x54fdb7[_0x6db9('0xe0')]=_0x359024;return _0x54fdb7;});}})[_0x6db9('0x17')](respondWithFilteredResult(_0x43748f,_0x1f0d80))['catch'](handleError(_0x43748f,null));};exports[_0x6db9('0xe5')]=function(_0x38519f,_0x45f7aa){var _0x5b6ca1={'raw':!![],'where':{}};var _0x419172={};var _0x298402={'count':0x0,'rows':[]};return db[_0x6db9('0x1e')][_0x6db9('0xc6')]({'where':{'id':_0x38519f['params']['id']}})[_0x6db9('0x17')](handleEntityNotFound(_0x45f7aa,null))['then'](function(_0x7a3420){if(_0x7a3420){_0x419172[_0x6db9('0x2b')]=_[_0x6db9('0x20')](db[_0x6db9('0xe6')][_0x6db9('0xdc')]);_0x419172[_0x6db9('0x29')]=_['keys'](_0x38519f[_0x6db9('0x29')]);_0x419172['filters']=_[_0x6db9('0x2a')](_0x419172[_0x6db9('0x2b')],_0x419172[_0x6db9('0x29')]);_0x5b6ca1['attributes']=_[_0x6db9('0x2a')](_0x419172['model'],qs['fields'](_0x38519f[_0x6db9('0x29')][_0x6db9('0x2c')]));_0x5b6ca1[_0x6db9('0x2d')]=_0x5b6ca1['attributes'][_0x6db9('0x21')]?_0x5b6ca1['attributes']:_0x419172[_0x6db9('0x2b')];if(!_0x38519f[_0x6db9('0x29')][_0x6db9('0x53')](_0x6db9('0x2e'))){_0x5b6ca1['limit']=qs[_0x6db9('0x2f')](_0x38519f[_0x6db9('0x29')][_0x6db9('0x2f')]);_0x5b6ca1[_0x6db9('0x11')]=qs['offset'](_0x38519f['query'][_0x6db9('0x11')]);}_0x5b6ca1['order']=qs['sort'](_0x38519f[_0x6db9('0x29')][_0x6db9('0xc4')]);_0x5b6ca1[_0x6db9('0x31')]=qs['filters'](_['pick'](_0x38519f[_0x6db9('0x29')],_0x419172[_0x6db9('0x32')]));_0x5b6ca1[_0x6db9('0x31')][_0x6db9('0xdd')]=_0x7a3420['id'];if(_0x38519f[_0x6db9('0x29')][_0x6db9('0x5d')]){_0x5b6ca1['where']=_[_0x6db9('0x75')](_0x5b6ca1[_0x6db9('0x31')],{'$or':_['map'](_0x5b6ca1[_0x6db9('0x2d')],function(_0x2dee90){var _0x519a5d={};_0x519a5d[_0x2dee90]={'$like':'%'+_0x38519f[_0x6db9('0x29')][_0x6db9('0x5d')]+'%'};return _0x519a5d;})});}_0x5b6ca1=_[_0x6db9('0x75')]({},_0x5b6ca1,_0x38519f[_0x6db9('0xde')]);return db['JscriptySessionReport']['count']({'where':_0x5b6ca1[_0x6db9('0x31')]})['then'](function(_0x24c280){_0x298402[_0x6db9('0x13')]=_0x24c280;if(_0x38519f[_0x6db9('0x29')][_0x6db9('0xe2')]){_0x5b6ca1[_0x6db9('0xdf')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6db9('0x88')](_0x5b6ca1);})[_0x6db9('0x17')](function(_0xa0761c){_0x298402[_0x6db9('0xe0')]=_0xa0761c;return _0x298402;});}})[_0x6db9('0x17')](respondWithFilteredResult(_0x45f7aa,_0x5b6ca1))[_0x6db9('0x84')](handleError(_0x45f7aa,null));};exports['uploadCsv']=function(_0xb3ebf,_0x5b6a80){try{if(!_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0x57')]){throw new Error(_0x6db9('0xe7'));}if(!_0xb3ebf['body']['binding_keys']){throw new Error(_0x6db9('0xe8'));}if(!_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0xe9')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0xb3ebf[_0x6db9('0x8d')]['socket_timestamp']){throw new Error(_0x6db9('0xea'));}var _0x191198=_0xb3ebf['body'][_0x6db9('0xeb')][_0x6db9('0x5f')](',');var _0xeb2831=_0xb3ebf['body'][_0x6db9('0xe9')][_0x6db9('0x5f')](',');if(!_0x191198[_0x6db9('0x21')]||!_0xeb2831[_0x6db9('0x21')]||_0x191198[_0x6db9('0x21')]!==_0xeb2831[_0x6db9('0x21')]){throw new Error(_0x6db9('0xec'));}_0xb3ebf['body'][_0x6db9('0x2c')]=_[_0x6db9('0xed')](_0x191198,_0xeb2831);if(!_0xb3ebf[_0x6db9('0x8d')]['fields']['phone']){throw new Error(_0x6db9('0xee'));}if(!_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0x2c')][_0x6db9('0xef')]){throw new Error(_0x6db9('0xf0'));}var _0x1648a6=path[_0x6db9('0x92')](config['root'],_0x6db9('0xf1'),_0xb3ebf[_0x6db9('0xf2')][_0x6db9('0xf3')]);fs[_0x6db9('0xf4')](_0x1648a6,parseInt(_0x6db9('0xf5'),0x8));var _0x4b2c2b=require(_0x6db9('0xf6'))['fork'](path[_0x6db9('0x92')](__dirname,_0x6db9('0xf7')),[_0x1648a6,_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0xeb')],_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0xe9')],_0xb3ebf['body'][_0x6db9('0x57')],_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0xf8')],_0xb3ebf[_0x6db9('0x8d')][_0x6db9('0xb3')],_0xb3ebf['body'][_0x6db9('0xf9')]]);return _0x5b6a80[_0x6db9('0xf')](0xc8)[_0x6db9('0x10')]({'message':_0x6db9('0xfa'),'pid':_0x4b2c2b['pid']});}catch(_0x5dbbe3){return _0x5b6a80[_0x6db9('0xf')](0x1f4)[_0x6db9('0xfb')](_0x5dbbe3);}};exports[_0x6db9('0xfc')]=function(_0x4bfa7b,_0x49926f){var _0x2d2de8=fs['createReadStream'](_0x4bfa7b[_0x6db9('0xf2')][_0x6db9('0x2')]);Papa[_0x6db9('0xfd')](_0x2d2de8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x34bc39){return _0x49926f['status'](0xc8)[_0x6db9('0x10')]({'file':_0x4bfa7b['file'],'fields':_0x34bc39[_0x6db9('0xfe')][_0x6db9('0x2c')]});}});};exports[_0x6db9('0xff')]=function(_0x40f68c,_0xdc5274){return db[_0x6db9('0x49')][_0x6db9('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x6db9('0x17')](function(_0x154b9e){var _0x5d2039=![];if(!_0x40f68c['body']['ListId']){throw new Error(_0x6db9('0xe7'));}if(!_0x40f68c[_0x6db9('0x8d')][_0x6db9('0x100')][_0x6db9('0xc1')]){throw new Error(_0x6db9('0xee'));}if(!_0x40f68c[_0x6db9('0x8d')][_0x6db9('0x100')][_0x6db9('0xef')]){throw new Error(_0x6db9('0xf0'));}if(!_0x40f68c[_0x6db9('0x8d')][_0x6db9('0xf9')]){throw new Error(_0x6db9('0xea'));}var _0x23f2b5=require(_0x6db9('0xf6'))[_0x6db9('0x101')](path['join'](__dirname,_0x6db9('0x102')),[_0x40f68c[_0x6db9('0x85')]['id'],JSON['stringify'](_0x40f68c['body']),JSON[_0x6db9('0x103')](_0x154b9e)]);_0x23f2b5['on'](_0x6db9('0x104'),function(){_0x5d2039=!![];return _0xdc5274['status'](0xc8)[_0x6db9('0x10')]({'message':_0x6db9('0x105'),'pid':_0x23f2b5[_0x6db9('0x106')]});});_0x23f2b5['on'](_0x6db9('0x107'),function(_0x164dc6){if(_0x164dc6&&!_0x5d2039){return _0xdc5274[_0x6db9('0xf')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x23f2b5['pid']});}});})[_0x6db9('0x84')](handleError(_0xdc5274,null));};exports[_0x6db9('0x108')]=function(_0x179f0a,_0x5b69ba,_0x544211){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x6db9('0x6e')}})[_0x6db9('0x17')](function(_0xe96d44){var _0x1ebd58=![];if(!_0x179f0a[_0x6db9('0x8d')][_0x6db9('0x57')]){throw new Error(_0x6db9('0xe7'));}if(!_0x179f0a[_0x6db9('0x8d')]['binding'][_0x6db9('0xc1')]){throw new Error(_0x6db9('0xee'));}if(!_0x179f0a[_0x6db9('0x8d')][_0x6db9('0x100')][_0x6db9('0xef')]){throw new Error(_0x6db9('0xf0'));}if(!_0x179f0a[_0x6db9('0x8d')][_0x6db9('0xf9')]){throw new Error(_0x6db9('0xea'));}var _0x200897=require('child_process')[_0x6db9('0x101')](path['join'](__dirname,_0x6db9('0x109')),[_0x179f0a[_0x6db9('0x85')]['id'],JSON[_0x6db9('0x103')](_0x179f0a[_0x6db9('0x8d')]),JSON[_0x6db9('0x103')](_0xe96d44)]);_0x200897['on'](_0x6db9('0x104'),function(_0x57da00){_0x1ebd58=!![];return _0x5b69ba[_0x6db9('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x200897[_0x6db9('0x106')]});});_0x200897['on'](_0x6db9('0x107'),function(_0x2d3f70){if(_0x2d3f70&&!_0x1ebd58){return _0x5b69ba[_0x6db9('0xf')](0x1f4)[_0x6db9('0x10')]({'message':_0x6db9('0x10a'),'pid':_0x200897[_0x6db9('0x106')]});}});})[_0x6db9('0x84')](handleError(_0x5b69ba,null));};exports['getJourney']=function(_0x324f68,_0x40c442){var _0x2b57bd=[_0x6db9('0x10b'),'chat','sms',_0x6db9('0x10c'),_0x6db9('0x10d'),'whatsapp','voice'];var _0x241c1d={'offset':0x0,'order':qs[_0x6db9('0xc4')]('-createdAt')},_0x598562={'count':0x0,'rows':[]};Promise[_0x6db9('0x6c')]()[_0x6db9('0x17')](function(){if(_0x324f68[_0x6db9('0x29')][_0x6db9('0x10e')]){if(!_['includes'](_0x2b57bd,_0x324f68['query']['channel']['toLowerCase']())){throw new Error(_0x6db9('0x10f'));}_0x2b57bd=[_0x324f68[_0x6db9('0x29')]['channel'][_0x6db9('0x110')]()];}if(_0x324f68[_0x6db9('0x29')][_0x6db9('0x111')]){try{var _0x41e111=JSON[_0x6db9('0xfd')](_0x324f68[_0x6db9('0x29')][_0x6db9('0x111')]);if(!moment(_0x41e111[_0x6db9('0x36')])[_0x6db9('0x112')]()){throw new Error(_0x6db9('0x113'));}if(!moment(_0x41e111['to'])[_0x6db9('0x112')]()){throw new Error(_0x6db9('0x114'));}}catch(_0x4a98a6){throw new Error(_0x6db9('0x115'));}}if(!_0x324f68['query'][_0x6db9('0x53')]('nolimit')){_0x241c1d[_0x6db9('0x2f')]=qs[_0x6db9('0x2f')](_0x324f68[_0x6db9('0x29')][_0x6db9('0x2f')]||0xa);_0x241c1d[_0x6db9('0x11')]=qs[_0x6db9('0x11')](_0x324f68[_0x6db9('0x29')]['offset']);}var _0x50b7a6=_0x2b57bd[_0x6db9('0x45')](function(_0x35892f){if(_0x35892f==='voice'){var _0xcb74c={'attributes':['id',_0x6db9('0x116'),_0x6db9('0x28'),_0x6db9('0x117'),_0x6db9('0x118'),_0x6db9('0x119'),_0x6db9('0x11a'),_0x6db9('0x11b'),'duration','note','createdAt',_0x6db9('0x11c'),_0x6db9('0x11d'),'userThirdDisposition',_0x6db9('0x11e')],'where':{'ContactId':_0x324f68[_0x6db9('0x85')]['id']},'include':[{'model':db['User'],'as':_0x6db9('0x49'),'attributes':['id','name',_0x6db9('0x11f'),_0x6db9('0x8a')]}],'order':[[_0x6db9('0x120'),_0x6db9('0x6a')]]};if(_0x324f68[_0x6db9('0x29')][_0x6db9('0x111')]){_0xcb74c['where']['createdAt']={'$gte':_0x41e111[_0x6db9('0x36')],'$lte':_0x41e111['to']};}return db[_0x6db9('0xa5')][_0x6db9('0x121')](_0xcb74c)['then'](function(_0x319e5e){_0x598562[_0x6db9('0x13')]+=_0x319e5e['count'];return _['map'](_0x319e5e[_0x6db9('0xe0')],function(_0x22cc56){var _0x588e20=_0x22cc56[_0x6db9('0x8e')]({'plain':!![]});_0x588e20[_0x6db9('0x10e')]=_0x35892f;if(_0x588e20['User']){_0x588e20[_0x6db9('0x49')]={'id':_0x588e20[_0x6db9('0x49')]['id'],'name':_0x588e20[_0x6db9('0x49')][_0x6db9('0x1c')],'fullname':_0x588e20[_0x6db9('0x49')][_0x6db9('0x11f')],'alias':_0x588e20['User'][_0x6db9('0x8a')]};}return _0x588e20;});});}else{var _0x555069=_[_0x6db9('0x122')](_0x35892f)+(_0x35892f===_0x6db9('0x123')?_0x6db9('0x124'):_0x6db9('0x125'));var _0x75a227={'attributes':['id',_0x6db9('0x126'),_0x6db9('0x127'),'createdAt','note','disposition',_0x6db9('0x128'),_0x6db9('0x129'),_0x6db9('0x11e'),_0x555069+'Id'],'where':{'ContactId':_0x324f68['params']['id']},'include':[{'model':db[_0x555069],'as':_0x6db9('0x125'),'attributes':['id','name','key']},{'model':db[_0x6db9('0x49')],'as':_0x6db9('0x12a'),'attributes':['id','name',_0x6db9('0x11f')]},{'model':db[_0x6db9('0xb8')],'as':_0x6db9('0x83'),'attributes':['id','name',_0x6db9('0xb9')],'through':{'attributes':[]}}],'order':[[_0x6db9('0x120'),_0x6db9('0x6a')]]};if(_0x324f68[_0x6db9('0x29')]['range']){_0x75a227[_0x6db9('0x31')][_0x6db9('0x120')]={'$gte':_0x41e111['from'],'$lte':_0x41e111['to']};}switch(_0x35892f){case'chat':_0x75a227[_0x6db9('0x2d')]['push'](_0x6db9('0x12b'),'customerIp',_0x6db9('0x12c'),_0x6db9('0x12d'),_0x6db9('0x12e'),_0x6db9('0x12f'),_0x6db9('0x130'),_0x6db9('0x131'),_0x6db9('0x132'));break;case _0x6db9('0x10b'):_0x75a227[_0x6db9('0x2d')][_0x6db9('0x24')](_0x6db9('0x133'),'substatus');break;case _0x6db9('0x10c'):_0x75a227[_0x6db9('0x2d')][_0x6db9('0x24')](_0x6db9('0x134'),_0x6db9('0x135'));break;}return db[_[_0x6db9('0x122')](_0x35892f)+_0x6db9('0x136')]['findAndCountAll'](_0x75a227)[_0x6db9('0x17')](function(_0x32222c){_0x598562[_0x6db9('0x13')]+=_0x32222c[_0x6db9('0x13')];return _[_0x6db9('0x45')](_0x32222c[_0x6db9('0xe0')],function(_0x57ac1e){var _0x47d5fd=_0x57ac1e[_0x6db9('0x8e')]({'plain':!![]});_0x47d5fd[_0x6db9('0x10e')]=_0x35892f;if(_0x47d5fd[_0x6db9('0x12a')]){_0x47d5fd[_0x6db9('0x12a')]={'id':_0x47d5fd[_0x6db9('0x12a')]['id'],'name':_0x47d5fd[_0x6db9('0x12a')]['name'],'fullname':_0x47d5fd[_0x6db9('0x12a')][_0x6db9('0x11f')]};}return _0x47d5fd;});});}});return Promise[_0x6db9('0xb6')](_0x50b7a6);})[_0x6db9('0x17')](function(_0x57330f){return _(_0x57330f)['flatten']()[_0x6db9('0x137')](_0x6db9('0x120'))[_0x6db9('0x138')]()[_0x6db9('0x4c')]();})[_0x6db9('0x17')](function(_0x10d151){_0x598562[_0x6db9('0xe0')]=_0x241c1d['limit']?_0x10d151[_0x6db9('0x139')](_0x241c1d[_0x6db9('0x11')],_0x241c1d[_0x6db9('0x11')]+_0x241c1d[_0x6db9('0x2f')]):_0x10d151;return _0x598562;})[_0x6db9('0x17')](respondWithFilteredResult(_0x40c442,_0x241c1d))[_0x6db9('0x84')](handleError(_0x40c442,null));}; \ No newline at end of file +var _0x0b29=['SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','findOrCreate','spread','contact','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','isNil','omit','format','$and','pickBy','cf_%d','table','id\x20=\x20?','toParam','getTags','rawAttributes','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','phone','PHONE','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','ContactId','include','getHopperHistories','includeAll','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20firstName\x20column\x20specified','file','filename','0777','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','parse','meta','import','binding','No\x20phone\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','firstName','../../components/import/cm/csvUpdates','exit','getJourney','sms','openchannel','fax','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','DESC','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','disposition','key','chat','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','bluebird','path','lodash','squel','papaparse','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','set','update','then','destroy','end','sendStatus','stack','name','send','index','CmContact','describe','keys','cf_','push','CmCustomField','findOne','all','fieldType','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','forEach','User','and','dateOfBirth','datetime','castTo','buildExpression','text','start','map','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','having','resolve','user','role','some','getLists','c.ListId\x20IN\x20?','agent','sequelize','toString','count','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','startsWith','columnName','displayName','analytics','findAll','custom','type','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0x0b29,0x99));var _0x90b2=function(_0x31d217,_0xa38636){_0x31d217=_0x31d217-0x0;var _0x3eaacb=_0x0b29[_0x31d217];return _0x3eaacb;};'use strict';var moment=require('moment');var BPromise=require(_0x90b2('0x0'));var util=require('util');var path=require(_0x90b2('0x1'));var fs=require('fs');var _=require(_0x90b2('0x2'));var squel=require(_0x90b2('0x3'));var Papa=require(_0x90b2('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x90b2('0x5'));var logger=require('../../config/logger')(_0x90b2('0x6'));var config=require(_0x90b2('0x7'));var shared=require(_0x90b2('0x8'));var db=require(_0x90b2('0x9'))['db'];config['redis']=_['defaults'](config[_0x90b2('0xa')],{'host':_0x90b2('0xb'),'port':0x18eb});var socket=require(_0x90b2('0xc'))(new Redis(config[_0x90b2('0xa')]));require(_0x90b2('0xd'))[_0x90b2('0xe')](socket);function respondWithResult(_0x12cc8f,_0x48090e){_0x48090e=_0x48090e||0xc8;return function(_0x1120ab){if(_0x1120ab){return _0x12cc8f[_0x90b2('0xf')](_0x48090e)[_0x90b2('0x10')](_0x1120ab);}};}function respondWithFilteredResult(_0x49947e,_0x1e487b){return function(_0x218b15){if(_0x218b15){var _0x391e12=typeof _0x1e487b[_0x90b2('0x11')]===_0x90b2('0x12')&&typeof _0x1e487b[_0x90b2('0x13')]===_0x90b2('0x12');var _0x24065a=_0x218b15['count'];var _0x11bbdb=_0x391e12?0x0:_0x1e487b[_0x90b2('0x11')];var _0x269e0b=_0x391e12?_0x218b15['count']:_0x1e487b[_0x90b2('0x11')]+_0x1e487b[_0x90b2('0x13')];var _0x395805;if(_0x269e0b>=_0x24065a){_0x269e0b=_0x24065a;_0x395805=0xc8;}else{_0x395805=0xce;}_0x49947e[_0x90b2('0xf')](_0x395805);return _0x49947e[_0x90b2('0x14')]('Content-Range',_0x11bbdb+'-'+_0x269e0b+'/'+_0x24065a)['json'](_0x218b15);}return null;};}function saveUpdates(_0x17b133){return function(_0x129c04){if(_0x129c04){return _0x129c04[_0x90b2('0x15')](_0x17b133)[_0x90b2('0x16')](function(_0x553480){return _0x553480;});}return null;};}function removeEntity(_0x3a8e50){return function(_0x43340a){if(_0x43340a){return _0x43340a[_0x90b2('0x17')]()['then'](function(){_0x3a8e50[_0x90b2('0xf')](0xcc)[_0x90b2('0x18')]();});}};}function handleEntityNotFound(_0x2fb163){return function(_0x17f47a){if(!_0x17f47a){_0x2fb163[_0x90b2('0x19')](0x194);}return _0x17f47a;};}function handleError(_0x2375ed,_0x568ea1){_0x568ea1=_0x568ea1||0x1f4;return function(_0x2a30f0){logger['error'](_0x2a30f0[_0x90b2('0x1a')]);if(_0x2a30f0['name']){delete _0x2a30f0[_0x90b2('0x1b')];}_0x2375ed['status'](_0x568ea1)[_0x90b2('0x1c')](_0x2a30f0);};}exports[_0x90b2('0x1d')]=function(_0x1abf84,_0x562880){var _0x257559={},_0x141986={},_0x3e9fb5={'count':0x0,'rows':[]};return db[_0x90b2('0x1e')][_0x90b2('0x1f')]()[_0x90b2('0x16')](function(_0x1f8c17){var _0x56d7b0=[];for(var _0x5280e9=0x0;_0x5280e90x1){_0x1a9024['or'](_0x90b2('0x5d'),qs[_0x90b2('0x5e')](_0xe609b0),null);}else{if(qs[_0x90b2('0x5f')](_0xe609b0)){_0x1a9024['or']('c.id\x20LIKE\x20?',_0xe609b0+'%');_0x1a9024['or'](_0x90b2('0x60'),_0xe609b0+'%');_0x1a9024['or']('c.mobile\x20LIKE\x20?',_0xe609b0+'%');_0x1a9024['or']('c.fax\x20LIKE\x20?',_0xe609b0+'%');}else if(qs['isEmail'](_0xe609b0)){_0x1a9024['or'](_0x90b2('0x61'),_0xe609b0+'%');}else{_0x1a9024['or']('c.firstName\x20LIKE\x20?','%'+_0xe609b0+'%');_0x1a9024['or']('c.lastName\x20LIKE\x20?','%'+_0xe609b0+'%');_0x1a9024['or'](_0x90b2('0x61'),'%'+_0xe609b0+'%');}}}}_0x3ce353['where'](_0x1a9024);_0x3ce353[_0x90b2('0x62')](_0x90b2('0x63'));var _0x43d822={'type':db[_0x90b2('0x64')][_0x90b2('0x65')][_0x90b2('0x66')],'raw':!![]};var _0x159ec1=_0x3ce353['clone']()[_0x90b2('0x34')](_0x90b2('0x63'));if(_0x257559[_0x90b2('0x2e')]){_0x257559['order']['forEach'](function(_0x5e906c){_0x3ce353['order']('c.'+_0x5e906c[0x0],_0x5e906c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x90b2('0x52')](_0x4dc751)){_0x3ce353[_0x90b2('0x67')](_0x533b0e);_0x159ec1['where']('t.id\x20IN\x20?',_0x4dc751);}BPromise[_0x90b2('0x68')]()['then'](function(){if(!_0x4a9b23)return;if(_0x1abf84[_0x90b2('0x69')][_0x90b2('0x6a')]!=='agent')return;if(!_[_0x90b2('0x6b')](_0x4a9b23[_0x90b2('0x42')],[_0x90b2('0x34'),'User'])){return _0x1abf84[_0x90b2('0x69')][_0x90b2('0x6c')]({'attributes':['id'],'raw':!![]})[_0x90b2('0x16')](function(_0x137b7d){if(_[_0x90b2('0x52')](_0x137b7d)){_0x159ec1[_0x90b2('0x30')]('c.ListId\x20IS\x20NULL');_0x3ce353[_0x90b2('0x30')]('c.ListId\x20IS\x20NULL');}else{_0x159ec1[_0x90b2('0x30')]('c.ListId\x20IN\x20?',_['map'](_0x137b7d,'id'));_0x3ce353[_0x90b2('0x30')](_0x90b2('0x6d'),_[_0x90b2('0x50')](_0x137b7d,'id'));}});}})[_0x90b2('0x16')](function(){if(_0x1abf84['user']['role']===_0x90b2('0x6e')&&!_0x4a9b23&&!_0x1abf84[_0x90b2('0x28')][_0x90b2('0x53')])return[];return db[_0x90b2('0x6f')]['query'](_0x159ec1[_0x90b2('0x70')](),_0x43d822);})['then'](function(_0x3a272e){_0x3e9fb5[_0x90b2('0x71')]=_0x3a272e[_0x90b2('0x5c')];if(_0x3e9fb5[_0x90b2('0x71')]===0x0)return[];return db['sequelize'][_0x90b2('0x28')](_0x591808['toString'](),_0x43d822)[_0x90b2('0x16')](function(_0x4053a2){_0x38079d=_[_0x90b2('0x72')](_0x4053a2,'id');_0x43d822=_[_0x90b2('0x73')](_0x43d822,{'model':db[_0x90b2('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1abf84['query']['fields']){_0x257559[_0x90b2('0x2a')]['forEach'](function(_0x12c3c9){_0x3ce353[_0x90b2('0x34')]('c.'+_0x12c3c9);});}else{_0x3ce353[_0x90b2('0x34')]('c.id');_0x3ce353['field'](_0x90b2('0x74'));_0x3ce353[_0x90b2('0x34')](_0x90b2('0x75'));_0x3ce353[_0x90b2('0x34')](_0x90b2('0x76'));_0x3ce353[_0x90b2('0x34')]('c.mobile');_0x3ce353[_0x90b2('0x34')](_0x90b2('0x77'));_0x3ce353[_0x90b2('0x34')](_0x90b2('0x78'));_0x3ce353['field'](_0x90b2('0x79'));_0x3ce353[_0x90b2('0x34')](_0x90b2('0x7a'));_0x3ce353[_0x90b2('0x34')](_0x90b2('0x7b'));_0x3ce353[_0x90b2('0x34')]('c.CompanyId');_0x3ce353[_0x90b2('0x34')](_0x90b2('0x7c'),_0x90b2('0x7d'));}if(_0x257559[_0x90b2('0x13')])_0x3ce353['limit'](_0x257559[_0x90b2('0x13')]);if(_0x257559[_0x90b2('0x11')])_0x3ce353['offset'](_0x257559[_0x90b2('0x11')]);return db[_0x90b2('0x6f')][_0x90b2('0x28')](_0x3ce353[_0x90b2('0x70')](),_0x43d822);});})['then'](function(_0x37e4e1){_0x37e4e1['forEach'](function(_0x422787){if(_0x422787['TagIds']){_0x422787[_0x90b2('0x7e')]=[];_0x422787[_0x90b2('0x7d')][_0x90b2('0x46')](',')['forEach'](function(_0x53714e){_0x422787['Tags'][_0x90b2('0x22')](_0x38079d[_0x53714e]);});}delete _0x422787[_0x90b2('0x7d')];});_0x3e9fb5[_0x90b2('0x7f')]=_0x37e4e1;return _0x3e9fb5;})[_0x90b2('0x16')](respondWithFilteredResult(_0x562880,_0x257559));})[_0x90b2('0x80')](handleError(_0x562880,null));};exports['destroy']=function(_0x3dd9c2,_0x5d4752){return db[_0x90b2('0x1e')][_0x90b2('0x43')]({'where':{'id':_0x3dd9c2[_0x90b2('0x81')]['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x5d4752,null))['then'](removeEntity(_0x5d4752,null))[_0x90b2('0x80')](handleError(_0x5d4752,null));};exports[_0x90b2('0x1f')]=function(_0x366e7a,_0x316a2b){return db[_0x90b2('0x1e')][_0x90b2('0x1f')]()[_0x90b2('0x16')](function(_0x1ba8ac){delete _0x1ba8ac[_0x90b2('0x82')];for(var _0x3d168e=0x0;_0x3d168e0x0){return new Promise(function(_0x26112d,_0xf794c1){var _0xd19988=[];for(var _0x36e369=0x0;_0x36e369<_0x1194c2[_0x90b2('0x5c')];_0x36e369++){_0xd19988[_0x90b2('0x22')](insertAdditionalPhones(_0x1194c2[_0x36e369][_0x90b2('0xb0')],_0x1194c2[_0x36e369][_0x90b2('0xaa')]));}Promise[_0x90b2('0x25')](_0xd19988)[_0x90b2('0x16')](function(){_0x26112d(0x1);});})[_0x90b2('0x16')](function(){return{'success':_0x3188cd,'failure':_0x178bfb,'duplicates':_0x53c065};});}else{return{'success':_0x3188cd,'failure':_0x178bfb,'duplicates':_0x53c065};}}})[_0x90b2('0x16')](respondWithResult(_0x5c4921,0xc9))[_0x90b2('0x80')](handleError(_0x5c4921,null));};exports['show']=function(_0xc9c7e9,_0xa48c98){var _0x46d343;return db['CmContact'][_0x90b2('0x1f')]()['then'](function(_0x67793e){return db[_0x90b2('0x1e')][_0x90b2('0x43')]({'where':{'id':_0xc9c7e9[_0x90b2('0x81')]['id']},'include':[{'model':db[_0x90b2('0x44')],'as':'Tags','attributes':['id',_0x90b2('0x1b'),_0x90b2('0x35')],'required':_0xc9c7e9[_0x90b2('0x28')][_0x90b2('0x58')]?!![]:![]},{'model':db[_0x90b2('0x9e')],'as':_0x90b2('0xb1'),'where':{'CmContactId':_0xc9c7e9[_0x90b2('0x81')]['id']},'required':![],'include':[{'model':db[_0x90b2('0xb2')],'as':_0x90b2('0xb3')}]}],'order':[db[_0x90b2('0x6f')][_0x90b2('0xb4')](_0x90b2('0xb5'))],'attributes':_['keys'](_0x67793e)});})[_0x90b2('0x16')](function(_0x17579e){if(!_[_0x90b2('0xb6')](_0x17579e)){_0x46d343=_0x17579e['get']({'plain':!![]});var _0x3ce5ca={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x17579e&&_0x17579e[_0x90b2('0x53')]){if(_0x17579e[_0x90b2('0x53')]){_0x3ce5ca['where']['$and'][_0x90b2('0x22')]({'ListId':{'$ne':_0x17579e['ListId']}});}}return db[_0x90b2('0x23')][_0x90b2('0x87')](_0x3ce5ca);}})[_0x90b2('0x16')](function(_0x5ee99c){if(!_['isNil'](_0x5ee99c)){return _[_0x90b2('0xb7')](_0x46d343,_[_0x90b2('0x50')](_0x5ee99c,function(_0x41ed9f){return util[_0x90b2('0xb8')]('cf_%d',_0x41ed9f['id']);}));}})[_0x90b2('0x16')](handleEntityNotFound(_0xa48c98,null))['then'](respondWithResult(_0xa48c98,null))[_0x90b2('0x80')](handleError(_0xa48c98,null));};exports[_0x90b2('0x15')]=function(_0x144249,_0x2637e3){var _0x42105b;if(_0x144249[_0x90b2('0x8b')]['id']){delete _0x144249[_0x90b2('0x8b')]['id'];}if(!_[_0x90b2('0xb6')](_0x144249[_0x90b2('0x8b')][_0x90b2('0xa7')])){var _0x59aadf=_0x144249[_0x90b2('0x8b')]['dialTimezone'];if(!_[_0x90b2('0xb6')](shared[_0x90b2('0xa8')][_0x59aadf]))_0x144249['body'][_0x90b2('0xa9')]=shared[_0x90b2('0xa8')][_0x59aadf][_0x90b2('0xa9')];}return db['CmContact'][_0x90b2('0x43')]({'where':{'id':_0x144249[_0x90b2('0x81')]['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x2637e3,null))[_0x90b2('0x16')](saveUpdates(_0x144249[_0x90b2('0x8b')],null))[_0x90b2('0x16')](function(_0x594fd6){_0x42105b=_0x594fd6;var _0x37ce69={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x594fd6&&_0x594fd6[_0x90b2('0x53')]){if(_0x594fd6['ListId']){_0x37ce69[_0x90b2('0x30')][_0x90b2('0xb9')]['push']({'ListId':{'$ne':_0x594fd6[_0x90b2('0x53')]}});}}return db[_0x90b2('0x23')]['findAll'](_0x37ce69);})[_0x90b2('0x16')](function(_0x55212f){if(_0x55212f){return _['omit'](_[_0x90b2('0xba')](_0x144249[_0x90b2('0x8b')],function(_0x2f1665,_0x508174){return _[_0x90b2('0x83')](_0x508174,'cf_');}),_[_0x90b2('0x50')](_0x55212f,function(_0x2727a0){return util['format'](_0x90b2('0xbb'),_0x2727a0['id']);}));}})['then'](function(_0x243387){if(_0x243387&&!_[_0x90b2('0x52')](_0x243387)){var _0x52123b=squel[_0x90b2('0x15')]()[_0x90b2('0xbc')](_0x90b2('0x38'))['setFields'](_0x243387)['where'](_0x90b2('0xbd'),_0x144249[_0x90b2('0x81')]['id'])[_0x90b2('0xbe')]();return db[_0x90b2('0x6f')][_0x90b2('0x28')](_0x52123b[_0x90b2('0x4e')],{'replacements':_0x52123b['values']});}})[_0x90b2('0x16')](function(){if(_0x144249['body']['phone']&&_0x42105b){return db['CmHopper'][_0x90b2('0x15')]({'phone':_0x144249[_0x90b2('0x8b')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x42105b['id']}});}})[_0x90b2('0x16')](function(){return _0x42105b;})[_0x90b2('0x16')](respondWithResult(_0x2637e3,null))['catch'](handleError(_0x2637e3,null));};exports[_0x90b2('0xbf')]=function(_0x45674a,_0x38adf7){var _0x79e6b9={};var _0x48f387={};var _0xee10bd;var _0x3b80d4;return db[_0x90b2('0x1e')][_0x90b2('0x24')]({'where':{'id':_0x45674a[_0x90b2('0x81')]['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x38adf7,null))[_0x90b2('0x16')](function(_0x5e98e7){if(_0x5e98e7){_0xee10bd=_0x5e98e7;_0x48f387[_0x90b2('0x27')]=_[_0x90b2('0x20')](db['Tag'][_0x90b2('0xc0')]);_0x48f387[_0x90b2('0x28')]=_[_0x90b2('0x20')](_0x45674a['query']);_0x48f387[_0x90b2('0x31')]=_['intersection'](_0x48f387['model'],_0x48f387['query']);_0x79e6b9[_0x90b2('0x2a')]=_[_0x90b2('0x29')](_0x48f387[_0x90b2('0x27')],qs[_0x90b2('0x2b')](_0x45674a[_0x90b2('0x28')][_0x90b2('0x2b')]));_0x79e6b9['attributes']=_0x79e6b9[_0x90b2('0x2a')][_0x90b2('0x5c')]?_0x79e6b9[_0x90b2('0x2a')]:_0x48f387['model'];_0x79e6b9[_0x90b2('0x2e')]=qs[_0x90b2('0x2f')](_0x45674a['query'][_0x90b2('0x2f')]);_0x79e6b9['where']=qs[_0x90b2('0x31')](_[_0x90b2('0x32')](_0x45674a[_0x90b2('0x28')],_0x48f387[_0x90b2('0x31')]));if(_0x45674a['query'][_0x90b2('0x5a')]){_0x79e6b9[_0x90b2('0x30')]=_['merge'](_0x79e6b9[_0x90b2('0x30')],{'$or':_[_0x90b2('0x50')](_0x79e6b9['attributes'],function(_0x4055dc){var _0x54f190={};_0x54f190[_0x4055dc]={'$like':'%'+_0x45674a[_0x90b2('0x28')]['filter']+'%'};return _0x54f190;})});}_0x79e6b9=_[_0x90b2('0x73')]({},_0x79e6b9,_0x45674a[_0x90b2('0xc1')]);return _0xee10bd[_0x90b2('0xbf')](_0x79e6b9);}})[_0x90b2('0x16')](function(_0x87b8aa){if(_0x87b8aa){_0x3b80d4=_0x87b8aa['length'];if(!_0x45674a[_0x90b2('0x28')][_0x90b2('0x2c')](_0x90b2('0x2d'))){_0x79e6b9[_0x90b2('0x13')]=qs[_0x90b2('0x13')](_0x45674a[_0x90b2('0x28')]['limit']);_0x79e6b9[_0x90b2('0x11')]=qs[_0x90b2('0x11')](_0x45674a[_0x90b2('0x28')][_0x90b2('0x11')]);}return _0xee10bd['getTags'](_0x79e6b9);}})[_0x90b2('0x16')](function(_0x23b9fe){if(_0x23b9fe){return _0x23b9fe?{'count':_0x3b80d4,'rows':_0x23b9fe}:null;}})['then'](respondWithResult(_0x38adf7,null))[_0x90b2('0x80')](handleError(_0x38adf7,null));};exports['setTags']=function(_0x3880a5,_0x2e94ed){if(_0x3880a5[_0x90b2('0x8b')]['id']){delete _0x3880a5[_0x90b2('0x8b')]['id'];}return db[_0x90b2('0x1e')][_0x90b2('0x24')]({'where':{'id':_0x3880a5[_0x90b2('0x81')]['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x2e94ed,null))[_0x90b2('0x16')](function(_0x2497b3){if(_0x2497b3){return _0x2497b3[_0x90b2('0xc2')](_0x3880a5[_0x90b2('0x8b')][_0x90b2('0xc3')]||[]);}return null;})['then'](respondWithResult(_0x2e94ed,null))[_0x90b2('0x80')](handleError(_0x2e94ed,null));};exports[_0x90b2('0xc4')]=function(_0x1b7191,_0x5cfdb8){var _0x46471e=[];_0x46471e['push'](addAdditionalPhones(_0x1b7191[_0x90b2('0x8b')]));Promise[_0x90b2('0x25')](_0x46471e)[_0x90b2('0x16')](function(){_0x46471e=[];_0x46471e['push'](deleteCmHopperPhones(_0x1b7191[_0x90b2('0x8b')]['id']));_0x46471e[_0x90b2('0x22')](addCmHopperPhones(_0x1b7191[_0x90b2('0x8b')]['id']));Promise[_0x90b2('0x25')](_0x46471e)[_0x90b2('0x16')](function(){return[0x1];})[_0x90b2('0x16')](respondWithResult(_0x5cfdb8,null));});};function addAdditionalPhones(_0x46df88){var _0x478cb6;return new Promise(function(_0x427669,_0x270716){return db['CmContactHasItem'][_0x90b2('0x17')]({'where':{'CmContactId':_0x46df88['id']}})['then'](function(){db[_0x90b2('0xb2')][_0x90b2('0x87')]({'raw':!![],'attributes':['id',_0x90b2('0xc5')]})[_0x90b2('0x16')](function(_0x489f9a){var _0x2985be=[];for(var _0x108607=0x0;_0x108607<_0x46df88[_0x90b2('0xc6')][_0x90b2('0x5c')];_0x108607++){var _0x4475f8=_0x46df88[_0x90b2('0xc7')]?_[_0x90b2('0xb6')](_0x46df88[_0x90b2('0xc7')][_0x108607])?'':_0x46df88[_0x90b2('0xc7')][_0x108607]:_0x46df88[_0x90b2('0xc6')][_0x108607][_0x90b2('0xc8')]?_0x46df88['items'][_0x108607][_0x90b2('0xc8')]:'';var _0xdeb684=_[_0x90b2('0xb6')](_0x46df88[_0x90b2('0xc6')][_0x108607]['description'])?'':_0x46df88['items'][_0x108607][_0x90b2('0xc9')];var _0x1b7175=_0x4475f8+':'+_0x46df88['items'][_0x108607][_0x90b2('0xca')]+'§'+_0xdeb684;if(_[_0x90b2('0xb6')](_0x478cb6))_0x478cb6=_0x1b7175;else _0x478cb6+=';'+_0x1b7175;var _0x46dd19=null;if(_0x46df88[_0x90b2('0xc7')]){if(!_[_0x90b2('0xb6')](_0x46df88[_0x90b2('0xc7')][_0x108607])){var _0x771350=_['find'](_0x489f9a,function(_0x70030){return _0x70030['id']===_0x46df88['item_types'][_0x108607];});if(!_[_0x90b2('0xb6')](_0x771350)){_0x46dd19=_0x771350[_0x90b2('0xc5')];}}}else{if(!_[_0x90b2('0xb6')](_0x46df88[_0x90b2('0xc6')][_0x108607])){var _0x771350=_[_0x90b2('0x43')](_0x489f9a,function(_0x3f5c0f){return _0x3f5c0f['id']===_0x46df88[_0x90b2('0xc6')][_0x108607]['ItemTypeId'];});if(!_[_0x90b2('0xb6')](_0x771350)){_0x46dd19=_0x108607;}}}if(_[_0x90b2('0xb6')](_0x46dd19)){_0x46dd19=0x64;}_0x2985be['push'](addAdditionalPhone(_0x46df88['id'],_0x46df88[_0x90b2('0xc6')][_0x108607][_0x90b2('0xca')],_0x46df88[_0x90b2('0xc7')]?_[_0x90b2('0xb6')](_0x46df88['item_types'][_0x108607])?null:_0x46df88[_0x90b2('0xc7')][_0x108607]:_0x46df88[_0x90b2('0xc6')][_0x108607][_0x90b2('0xc8')]?_0x46df88[_0x90b2('0xc6')][_0x108607][_0x90b2('0xc8')]:null,_0x46dd19,_0xdeb684));}Promise[_0x90b2('0x25')](_0x2985be)[_0x90b2('0x16')](function(){db[_0x90b2('0x1e')][_0x90b2('0x15')]({'AdditionalPhones':_0x478cb6},{'where':{'id':_0x46df88['id']}})[_0x90b2('0x16')](function(){_0x427669(0x1);});});});});});}function addAdditionalPhone(_0x40789e,_0x47b762,_0x11cdce,_0xda498f,_0x48005a){return db[_0x90b2('0x9e')][_0x90b2('0x43')]({'where':{'CmContactId':_0x40789e,'item':_0x47b762}})[_0x90b2('0x16')](function(_0x3bce59){if(_0x3bce59)logger[_0x90b2('0x8f')]('contact\x20phone\x20exists',_0x3bce59);else{db[_0x90b2('0x9e')][_0x90b2('0x94')]({'CmContactId':_0x40789e,'item':_0x47b762,'ItemTypeId':_0x11cdce,'OrderBy':_0xda498f,'ItemClass':_0x90b2('0xcb'),'description':_0x48005a});}});}function deletePhones(_0x10e972){return db[_0x90b2('0x9e')][_0x90b2('0x17')]({'where':{'CmContactId':_0x10e972}});}function deleteCmHopperPhones(_0x134f40){return new Promise(function(_0x386893,_0x508149){return db[_0x90b2('0x91')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x134f40}})[_0x90b2('0x16')](function(_0x157193){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x90b2('0x50')](_0x157193,'id')}}});})[_0x90b2('0x16')](function(){_0x386893(0x1);});});}function addCmHopperPhones(_0x190ac0){return new Promise(function(_0x3ee837,_0x46d8d3){return db[_0x90b2('0x91')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x190ac0}})[_0x90b2('0x16')](function(_0x127c56){var _0x815afa=[];_[_0x90b2('0x50')](_0x127c56,function(_0x420af0){_0x815afa[_0x90b2('0x22')](createCmHopperPhone(_0x190ac0,_0x420af0['id']));});Promise[_0x90b2('0x25')](_0x815afa)[_0x90b2('0x16')](function(){_0x3ee837(0x1);});});});}function createCmHopperPhone(_0x4323c1,_0x5b96c5){return new Promise(function(_0x7bcd84,_0x3ae576){db[_0x90b2('0x9e')][_0x90b2('0x87')]({'raw':!![],'attributes':['item',_0x90b2('0xc5')],'where':{'CmContactId':_0x4323c1,'ItemClass':_0x90b2('0xcb')},'include':[{'model':db[_0x90b2('0xb2')],'attributes':[_0x90b2('0xc5')],'as':'ItemType'}],'order':[_0x90b2('0xc5'),db['sequelize'][_0x90b2('0xb4')](_0x90b2('0xcc'))]})[_0x90b2('0x16')](function(_0x4d9c98){var _0x37db06=0x1;var _0x5648a8=_[_0x90b2('0x50')](_0x4d9c98,function(_0x29fb7a){_0x29fb7a[_0x90b2('0xcd')]=_0x5b96c5;_0x29fb7a[_0x90b2('0xca')]=_0x29fb7a[_0x90b2('0xce')];_0x29fb7a[_0x90b2('0xc5')]=_0x37db06;delete _0x29fb7a[_0x90b2('0xcf')];_0x37db06=_0x37db06+0x1;return _0x29fb7a;});return db[_0x90b2('0xd0')]['bulkCreate'](_0x5648a8,{});})[_0x90b2('0x16')](function(){_0x7bcd84(0x1);});});}function insertAdditionalPhones(_0x471365,_0x4b3a99){return new Promise(function(_0x451ac1,_0xeb319a){var _0x2746fb=[];for(var _0x48c247=0x0;_0x48c247<_0x4b3a99[_0x90b2('0x5c')];_0x48c247++){var _0x319854=_0x4b3a99[_0x48c247];_0x2746fb[_0x90b2('0x22')](parseContactItemType(_0x319854));}Promise['all'](_0x2746fb)[_0x90b2('0x16')](function(){var _0x131bc5={'id':_0x471365['id'],'items':_0x4b3a99};return addAdditionalPhones(_0x131bc5)[_0x90b2('0x16')](function(_0x37d10f){return addCmHopperPhones(_0x471365['id']);});})['then'](function(){_0x451ac1(_0x471365);});});}function parseContactItemType(_0x2e8f50){return new Promise(function(_0x2d0462,_0x2f332c){if(_0x2e8f50[_0x90b2('0x2c')](_0x90b2('0xc8'))){_0x2d0462(_0x2e8f50);}else{return db[_0x90b2('0xb2')]['find']({'where':{'name':_0x2e8f50[_0x90b2('0xb3')]}})[_0x90b2('0x16')](function(_0x305fa7){if(_[_0x90b2('0xb6')](_0x305fa7))_0x2e8f50[_0x90b2('0xc8')]=null;else _0x2e8f50['ItemTypeId']=_0x305fa7['id'];_0x2d0462(_0x2e8f50);});}});}exports[_0x90b2('0xd1')]=function(_0x4bb743,_0x2fcc3b){return db[_0x90b2('0x9e')][_0x90b2('0x87')]({'raw':!![],'where':{'CmContactId':_0x4bb743[_0x90b2('0x81')]['id'],'ItemClass':_0x90b2('0xcb')},'include':[{'model':db[_0x90b2('0xb2')],'as':_0x90b2('0xb3')}],'order':[[_0x90b2('0xc5')],[db['sequelize'][_0x90b2('0xb4')]('`ItemType`.OrderBy')]]})[_0x90b2('0x16')](function(_0x52c0cf){return _0x52c0cf;})[_0x90b2('0x16')](respondWithResult(_0x2fcc3b,null))[_0x90b2('0x80')](handleError(_0x2fcc3b,null));};exports[_0x90b2('0xd2')]=function(_0x29128d,_0x1535de){return db[_0x90b2('0x9e')][_0x90b2('0x87')]({'raw':!![],'where':{'CmContactId':_0x29128d[_0x90b2('0x8b')][_0x90b2('0xd3')]}})[_0x90b2('0x16')](function(_0x31a1a8){var _0x50d87a=_[_0x90b2('0x50')](_0x31a1a8,function(_0x5ec07b){_0x5ec07b[_0x90b2('0xd4')]=_0x29128d[_0x90b2('0x8b')]['toContactId'];return _0x5ec07b;});return db[_0x90b2('0x9e')][_0x90b2('0xab')](_0x50d87a,{});})[_0x90b2('0x16')](function(_0x355317){return addCmHopperPhones(_0x29128d['body'][_0x90b2('0xd5')]);})[_0x90b2('0x16')](function(_0x399d63){return['ok'];})[_0x90b2('0x16')](respondWithResult(_0x1535de,null))[_0x90b2('0x80')](handleError(_0x1535de,null));};exports['rescheduleAdditionalPhones']=function(_0x4592dd,_0x1e0a79){var _0x1f971d=[];_0x1f971d[_0x90b2('0x22')](createCmHopperPhone(_0x4592dd[_0x90b2('0x8b')]['id'],_0x4592dd['body'][_0x90b2('0xd6')]));Promise[_0x90b2('0x25')](_0x1f971d)[_0x90b2('0x16')](function(){return[0x1];})[_0x90b2('0x16')](respondWithResult(_0x1e0a79,null));};exports['getHoppers']=function(_0x270103,_0x293830){var _0xd461ee={'raw':![],'where':{}};var _0x812f6e={};var _0x28a581={'count':0x0,'rows':[]};return db[_0x90b2('0x1e')][_0x90b2('0x24')]({'where':{'id':_0x270103['params']['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x293830,null))['then'](function(_0x5d3fde){if(_0x5d3fde){_0x812f6e[_0x90b2('0x27')]=_[_0x90b2('0x20')](db[_0x90b2('0x91')][_0x90b2('0xc0')]);_0x812f6e[_0x90b2('0x28')]=_['keys'](_0x270103[_0x90b2('0x28')]);_0x812f6e[_0x90b2('0x31')]=_[_0x90b2('0x29')](_0x812f6e['model'],_0x812f6e[_0x90b2('0x28')]);_0xd461ee['attributes']=_['intersection'](_0x812f6e[_0x90b2('0x27')],qs[_0x90b2('0x2b')](_0x270103[_0x90b2('0x28')][_0x90b2('0x2b')]));_0xd461ee[_0x90b2('0x2a')]=_0xd461ee['attributes'][_0x90b2('0x5c')]?_0xd461ee[_0x90b2('0x2a')]:_0x812f6e['model'];if(!_0x270103[_0x90b2('0x28')]['hasOwnProperty'](_0x90b2('0x2d'))){_0xd461ee[_0x90b2('0x13')]=qs[_0x90b2('0x13')](_0x270103['query'][_0x90b2('0x13')]);_0xd461ee['offset']=qs[_0x90b2('0x11')](_0x270103[_0x90b2('0x28')][_0x90b2('0x11')]);}_0xd461ee['order']=qs[_0x90b2('0x2f')](_0x270103['query']['sort']);_0xd461ee[_0x90b2('0x30')]=qs['filters'](_[_0x90b2('0x32')](_0x270103[_0x90b2('0x28')],_0x812f6e[_0x90b2('0x31')]));_0xd461ee[_0x90b2('0x30')][_0x90b2('0xd7')]=_0x5d3fde['id'];if(_0x270103['query'][_0x90b2('0x5a')]){_0xd461ee[_0x90b2('0x30')]=_['merge'](_0xd461ee[_0x90b2('0x30')],{'$or':_[_0x90b2('0x50')](_0xd461ee[_0x90b2('0x2a')],function(_0x56c212){var _0x3e4c03={};_0x3e4c03[_0x56c212]={'$like':'%'+_0x270103[_0x90b2('0x28')][_0x90b2('0x5a')]+'%'};return _0x3e4c03;})});}_0xd461ee=_['merge']({},_0xd461ee,_0x270103[_0x90b2('0xc1')]);return db[_0x90b2('0x91')]['count']({'where':_0xd461ee['where']})[_0x90b2('0x16')](function(_0x240084){_0x28a581['count']=_0x240084;if(_0x270103[_0x90b2('0x28')]['includeAll']){_0xd461ee[_0x90b2('0xd8')]=[{'all':!![]}];}return db[_0x90b2('0x91')][_0x90b2('0x87')](_0xd461ee);})[_0x90b2('0x16')](function(_0x212c94){_0x28a581['rows']=_0x212c94;return _0x28a581;});}})[_0x90b2('0x16')](respondWithFilteredResult(_0x293830,_0xd461ee))[_0x90b2('0x80')](handleError(_0x293830,null));};exports[_0x90b2('0xd9')]=function(_0x284678,_0x47ae5b){var _0x4a0abe={'raw':!![],'where':{}};var _0x1b5bbe={};var _0x59ab29={'count':0x0,'rows':[]};return db[_0x90b2('0x1e')][_0x90b2('0x24')]({'where':{'id':_0x284678['params']['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x47ae5b,null))[_0x90b2('0x16')](function(_0x376c1e){if(_0x376c1e){_0x1b5bbe[_0x90b2('0x27')]=_[_0x90b2('0x20')](db[_0x90b2('0xa0')][_0x90b2('0xc0')]);_0x1b5bbe[_0x90b2('0x28')]=_[_0x90b2('0x20')](_0x284678[_0x90b2('0x28')]);_0x1b5bbe[_0x90b2('0x31')]=_[_0x90b2('0x29')](_0x1b5bbe['model'],_0x1b5bbe[_0x90b2('0x28')]);_0x4a0abe[_0x90b2('0x2a')]=_['intersection'](_0x1b5bbe[_0x90b2('0x27')],qs['fields'](_0x284678[_0x90b2('0x28')][_0x90b2('0x2b')]));_0x4a0abe[_0x90b2('0x2a')]=_0x4a0abe[_0x90b2('0x2a')][_0x90b2('0x5c')]?_0x4a0abe[_0x90b2('0x2a')]:_0x1b5bbe[_0x90b2('0x27')];if(!_0x284678[_0x90b2('0x28')][_0x90b2('0x2c')](_0x90b2('0x2d'))){_0x4a0abe[_0x90b2('0x13')]=qs['limit'](_0x284678['query'][_0x90b2('0x13')]);_0x4a0abe[_0x90b2('0x11')]=qs[_0x90b2('0x11')](_0x284678[_0x90b2('0x28')][_0x90b2('0x11')]);}_0x4a0abe[_0x90b2('0x2e')]=qs[_0x90b2('0x2f')](_0x284678['query'][_0x90b2('0x2f')]);_0x4a0abe[_0x90b2('0x30')]=qs[_0x90b2('0x31')](_[_0x90b2('0x32')](_0x284678[_0x90b2('0x28')],_0x1b5bbe[_0x90b2('0x31')]));_0x4a0abe['where'][_0x90b2('0xd7')]=_0x376c1e['id'];if(_0x284678[_0x90b2('0x28')][_0x90b2('0x5a')]){_0x4a0abe[_0x90b2('0x30')]=_[_0x90b2('0x73')](_0x4a0abe['where'],{'$or':_[_0x90b2('0x50')](_0x4a0abe['attributes'],function(_0x123431){var _0xfad1e0={};_0xfad1e0[_0x123431]={'$like':'%'+_0x284678['query'][_0x90b2('0x5a')]+'%'};return _0xfad1e0;})});}_0x4a0abe=_[_0x90b2('0x73')]({},_0x4a0abe,_0x284678['options']);return db['CmHopperHistory'][_0x90b2('0x71')]({'where':_0x4a0abe[_0x90b2('0x30')]})[_0x90b2('0x16')](function(_0x15b72b){_0x59ab29[_0x90b2('0x71')]=_0x15b72b;if(_0x284678['query'][_0x90b2('0xda')]){_0x4a0abe['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x4a0abe);})['then'](function(_0x45b6f2){_0x59ab29['rows']=_0x45b6f2;return _0x59ab29;});}})[_0x90b2('0x16')](respondWithFilteredResult(_0x47ae5b,_0x4a0abe))[_0x90b2('0x80')](handleError(_0x47ae5b,null));};exports['getHopperFinals']=function(_0x3fe08a,_0x165674){var _0x3d0e9d={'raw':!![],'where':{}};var _0x3628ff={};var _0x35acb1={'count':0x0,'rows':[]};return db[_0x90b2('0x1e')]['findOne']({'where':{'id':_0x3fe08a[_0x90b2('0x81')]['id']}})[_0x90b2('0x16')](handleEntityNotFound(_0x165674,null))[_0x90b2('0x16')](function(_0x1a1780){if(_0x1a1780){_0x3628ff[_0x90b2('0x27')]=_['keys'](db[_0x90b2('0x9f')][_0x90b2('0xc0')]);_0x3628ff[_0x90b2('0x28')]=_[_0x90b2('0x20')](_0x3fe08a['query']);_0x3628ff[_0x90b2('0x31')]=_['intersection'](_0x3628ff['model'],_0x3628ff[_0x90b2('0x28')]);_0x3d0e9d[_0x90b2('0x2a')]=_['intersection'](_0x3628ff[_0x90b2('0x27')],qs[_0x90b2('0x2b')](_0x3fe08a[_0x90b2('0x28')][_0x90b2('0x2b')]));_0x3d0e9d[_0x90b2('0x2a')]=_0x3d0e9d[_0x90b2('0x2a')][_0x90b2('0x5c')]?_0x3d0e9d[_0x90b2('0x2a')]:_0x3628ff['model'];if(!_0x3fe08a[_0x90b2('0x28')][_0x90b2('0x2c')](_0x90b2('0x2d'))){_0x3d0e9d[_0x90b2('0x13')]=qs['limit'](_0x3fe08a[_0x90b2('0x28')][_0x90b2('0x13')]);_0x3d0e9d[_0x90b2('0x11')]=qs[_0x90b2('0x11')](_0x3fe08a[_0x90b2('0x28')]['offset']);}_0x3d0e9d[_0x90b2('0x2e')]=qs[_0x90b2('0x2f')](_0x3fe08a['query'][_0x90b2('0x2f')]);_0x3d0e9d[_0x90b2('0x30')]=qs['filters'](_['pick'](_0x3fe08a[_0x90b2('0x28')],_0x3628ff[_0x90b2('0x31')]));_0x3d0e9d['where'][_0x90b2('0xd7')]=_0x1a1780['id'];if(_0x3fe08a[_0x90b2('0x28')][_0x90b2('0x5a')]){_0x3d0e9d[_0x90b2('0x30')]=_[_0x90b2('0x73')](_0x3d0e9d[_0x90b2('0x30')],{'$or':_[_0x90b2('0x50')](_0x3d0e9d[_0x90b2('0x2a')],function(_0x2f5b76){var _0x57a88c={};_0x57a88c[_0x2f5b76]={'$like':'%'+_0x3fe08a[_0x90b2('0x28')]['filter']+'%'};return _0x57a88c;})});}_0x3d0e9d=_[_0x90b2('0x73')]({},_0x3d0e9d,_0x3fe08a['options']);return db['CmHopperFinal'][_0x90b2('0x71')]({'where':_0x3d0e9d[_0x90b2('0x30')]})['then'](function(_0x3ecb4a){_0x35acb1['count']=_0x3ecb4a;if(_0x3fe08a[_0x90b2('0x28')][_0x90b2('0xda')]){_0x3d0e9d[_0x90b2('0xd8')]=[{'all':!![]}];}return db[_0x90b2('0x9f')][_0x90b2('0x87')](_0x3d0e9d);})['then'](function(_0x16b8ae){_0x35acb1[_0x90b2('0x7f')]=_0x16b8ae;return _0x35acb1;});}})[_0x90b2('0x16')](respondWithFilteredResult(_0x165674,_0x3d0e9d))['catch'](handleError(_0x165674,null));};exports[_0x90b2('0xdb')]=function(_0x1e55b2,_0x355b49){var _0x99e0fa={'raw':!![],'where':{}};var _0x46eb39={};var _0x47dc0b={'count':0x0,'rows':[]};return db[_0x90b2('0x1e')][_0x90b2('0x24')]({'where':{'id':_0x1e55b2['params']['id']}})['then'](handleEntityNotFound(_0x355b49,null))[_0x90b2('0x16')](function(_0x4f3c06){if(_0x4f3c06){_0x46eb39['model']=_[_0x90b2('0x20')](db['JscriptySessionReport']['rawAttributes']);_0x46eb39[_0x90b2('0x28')]=_[_0x90b2('0x20')](_0x1e55b2[_0x90b2('0x28')]);_0x46eb39[_0x90b2('0x31')]=_[_0x90b2('0x29')](_0x46eb39[_0x90b2('0x27')],_0x46eb39[_0x90b2('0x28')]);_0x99e0fa[_0x90b2('0x2a')]=_[_0x90b2('0x29')](_0x46eb39[_0x90b2('0x27')],qs['fields'](_0x1e55b2[_0x90b2('0x28')][_0x90b2('0x2b')]));_0x99e0fa[_0x90b2('0x2a')]=_0x99e0fa[_0x90b2('0x2a')]['length']?_0x99e0fa[_0x90b2('0x2a')]:_0x46eb39['model'];if(!_0x1e55b2[_0x90b2('0x28')][_0x90b2('0x2c')](_0x90b2('0x2d'))){_0x99e0fa[_0x90b2('0x13')]=qs['limit'](_0x1e55b2['query'][_0x90b2('0x13')]);_0x99e0fa[_0x90b2('0x11')]=qs['offset'](_0x1e55b2[_0x90b2('0x28')]['offset']);}_0x99e0fa[_0x90b2('0x2e')]=qs['sort'](_0x1e55b2['query'][_0x90b2('0x2f')]);_0x99e0fa[_0x90b2('0x30')]=qs[_0x90b2('0x31')](_['pick'](_0x1e55b2[_0x90b2('0x28')],_0x46eb39[_0x90b2('0x31')]));_0x99e0fa[_0x90b2('0x30')][_0x90b2('0xd7')]=_0x4f3c06['id'];if(_0x1e55b2['query'][_0x90b2('0x5a')]){_0x99e0fa[_0x90b2('0x30')]=_[_0x90b2('0x73')](_0x99e0fa[_0x90b2('0x30')],{'$or':_[_0x90b2('0x50')](_0x99e0fa[_0x90b2('0x2a')],function(_0x173e74){var _0x5a59e4={};_0x5a59e4[_0x173e74]={'$like':'%'+_0x1e55b2[_0x90b2('0x28')]['filter']+'%'};return _0x5a59e4;})});}_0x99e0fa=_['merge']({},_0x99e0fa,_0x1e55b2[_0x90b2('0xc1')]);return db[_0x90b2('0xdc')][_0x90b2('0x71')]({'where':_0x99e0fa[_0x90b2('0x30')]})[_0x90b2('0x16')](function(_0x444092){_0x47dc0b[_0x90b2('0x71')]=_0x444092;if(_0x1e55b2[_0x90b2('0x28')]['includeAll']){_0x99e0fa['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x90b2('0x87')](_0x99e0fa);})['then'](function(_0x17bd77){_0x47dc0b[_0x90b2('0x7f')]=_0x17bd77;return _0x47dc0b;});}})['then'](respondWithFilteredResult(_0x355b49,_0x99e0fa))['catch'](handleError(_0x355b49,null));};exports['uploadCsv']=function(_0x32fce1,_0x1ca5b5){try{if(!_0x32fce1[_0x90b2('0x8b')][_0x90b2('0x53')]){throw new Error(_0x90b2('0xdd'));}if(!_0x32fce1[_0x90b2('0x8b')][_0x90b2('0xde')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x32fce1['body'][_0x90b2('0xdf')]){throw new Error(_0x90b2('0xe0'));}if(!_0x32fce1[_0x90b2('0x8b')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x542676=_0x32fce1[_0x90b2('0x8b')][_0x90b2('0xde')][_0x90b2('0x46')](',');var _0x1b2baa=_0x32fce1[_0x90b2('0x8b')]['binding_values']['split'](',');if(!_0x542676[_0x90b2('0x5c')]||!_0x1b2baa[_0x90b2('0x5c')]||_0x542676[_0x90b2('0x5c')]!==_0x1b2baa[_0x90b2('0x5c')]){throw new Error(_0x90b2('0xe1'));}_0x32fce1['body'][_0x90b2('0x2b')]=_[_0x90b2('0xe2')](_0x542676,_0x1b2baa);if(!_0x32fce1[_0x90b2('0x8b')][_0x90b2('0x2b')][_0x90b2('0xca')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x32fce1['body'][_0x90b2('0x2b')]['firstName']){throw new Error(_0x90b2('0xe3'));}var _0x5327f0=path[_0x90b2('0x8e')](config['root'],'server/files/tmp',_0x32fce1[_0x90b2('0xe4')][_0x90b2('0xe5')]);fs['chmodSync'](_0x5327f0,parseInt(_0x90b2('0xe6'),0x8));var _0x3ebaa4=require(_0x90b2('0xe7'))[_0x90b2('0xe8')](path['join'](__dirname,_0x90b2('0xe9')),[_0x5327f0,_0x32fce1['body'][_0x90b2('0xde')],_0x32fce1['body']['binding_values'],_0x32fce1['body']['ListId'],_0x32fce1[_0x90b2('0x8b')]['CompanyId'],_0x32fce1[_0x90b2('0x8b')][_0x90b2('0xad')],_0x32fce1['body'][_0x90b2('0xea')]]);return _0x1ca5b5[_0x90b2('0xf')](0xc8)[_0x90b2('0x10')]({'message':_0x90b2('0xeb'),'pid':_0x3ebaa4[_0x90b2('0xec')]});}catch(_0x5f25de){return _0x1ca5b5[_0x90b2('0xf')](0x1f4)[_0x90b2('0x1c')](_0x5f25de);}};exports[_0x90b2('0xed')]=function(_0x37f65d,_0xf1b086){var _0x273cc2=fs['createReadStream'](_0x37f65d[_0x90b2('0xe4')][_0x90b2('0x1')]);Papa[_0x90b2('0xee')](_0x273cc2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x315109){return _0xf1b086[_0x90b2('0xf')](0xc8)['json']({'file':_0x37f65d['file'],'fields':_0x315109[_0x90b2('0xef')][_0x90b2('0x2b')]});}});};exports[_0x90b2('0xf0')]=function(_0x14fb20,_0x2c3f2f){return db[_0x90b2('0x48')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x90b2('0x6e')}})[_0x90b2('0x16')](function(_0x23d10c){var _0x196808=![];if(!_0x14fb20[_0x90b2('0x8b')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x14fb20[_0x90b2('0x8b')][_0x90b2('0xf1')][_0x90b2('0xca')]){throw new Error(_0x90b2('0xf2'));}if(!_0x14fb20[_0x90b2('0x8b')][_0x90b2('0xf1')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x14fb20[_0x90b2('0x8b')][_0x90b2('0xea')]){throw new Error(_0x90b2('0xf3'));}var _0xd9bb8d=require(_0x90b2('0xe7'))['fork'](path['join'](__dirname,_0x90b2('0xf4')),[_0x14fb20[_0x90b2('0x81')]['id'],JSON[_0x90b2('0xf5')](_0x14fb20[_0x90b2('0x8b')]),JSON[_0x90b2('0xf5')](_0x23d10c)]);_0xd9bb8d['on'](_0x90b2('0xf6'),function(){_0x196808=!![];return _0x2c3f2f[_0x90b2('0xf')](0xc8)['json']({'message':_0x90b2('0xf7'),'pid':_0xd9bb8d['pid']});});_0xd9bb8d['on']('exit',function(_0x5889ae){if(_0x5889ae&&!_0x196808){return _0x2c3f2f[_0x90b2('0xf')](0x1f4)['json']({'message':_0x90b2('0xf8'),'pid':_0xd9bb8d[_0x90b2('0xec')]});}});})[_0x90b2('0x80')](handleError(_0x2c3f2f,null));};exports[_0x90b2('0xf9')]=function(_0x41e072,_0x3ab693,_0xe3b902){return db[_0x90b2('0x48')][_0x90b2('0x87')]({'raw':!![],'attributes':['id'],'where':{'role':_0x90b2('0x6e')}})[_0x90b2('0x16')](function(_0x2a6a90){var _0x6c155a=![];if(!_0x41e072[_0x90b2('0x8b')][_0x90b2('0x53')]){throw new Error('No\x20ListId\x20specified');}if(!_0x41e072[_0x90b2('0x8b')][_0x90b2('0xf1')]['phone']){throw new Error(_0x90b2('0xf2'));}if(!_0x41e072[_0x90b2('0x8b')][_0x90b2('0xf1')][_0x90b2('0xfa')]){throw new Error(_0x90b2('0xe3'));}if(!_0x41e072[_0x90b2('0x8b')][_0x90b2('0xea')]){throw new Error(_0x90b2('0xf3'));}var _0x50ce9b=require(_0x90b2('0xe7'))[_0x90b2('0xe8')](path[_0x90b2('0x8e')](__dirname,_0x90b2('0xfb')),[_0x41e072['params']['id'],JSON[_0x90b2('0xf5')](_0x41e072[_0x90b2('0x8b')]),JSON[_0x90b2('0xf5')](_0x2a6a90)]);_0x50ce9b['on'](_0x90b2('0xf6'),function(_0x351984){_0x6c155a=!![];return _0x3ab693[_0x90b2('0xf')](0xc8)['json']({'message':_0x90b2('0xf7'),'pid':_0x50ce9b[_0x90b2('0xec')]});});_0x50ce9b['on'](_0x90b2('0xfc'),function(_0x48322f){if(_0x48322f&&!_0x6c155a){return _0x3ab693[_0x90b2('0xf')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x50ce9b[_0x90b2('0xec')]});}});})[_0x90b2('0x80')](handleError(_0x3ab693,null));};exports[_0x90b2('0xfd')]=function(_0x43cb70,_0x40de22){var _0x40726a=['mail','chat',_0x90b2('0xfe'),_0x90b2('0xff'),_0x90b2('0x100'),_0x90b2('0x101'),_0x90b2('0x102')];var _0x4fdeeb={'offset':0x0,'order':qs['sort']('-createdAt')},_0x36445b={'count':0x0,'rows':[]};Promise[_0x90b2('0x68')]()[_0x90b2('0x16')](function(){if(_0x43cb70['query'][_0x90b2('0x103')]){if(!_[_0x90b2('0x104')](_0x40726a,_0x43cb70[_0x90b2('0x28')][_0x90b2('0x103')][_0x90b2('0x105')]())){throw new Error(_0x90b2('0x106'));}_0x40726a=[_0x43cb70[_0x90b2('0x28')][_0x90b2('0x103')]['toLowerCase']()];}if(_0x43cb70[_0x90b2('0x28')][_0x90b2('0x107')]){try{var _0x1b4e82=JSON[_0x90b2('0xee')](_0x43cb70[_0x90b2('0x28')][_0x90b2('0x107')]);if(!moment(_0x1b4e82[_0x90b2('0x36')])[_0x90b2('0x108')]()){throw new Error(_0x90b2('0x109'));}if(!moment(_0x1b4e82['to'])[_0x90b2('0x108')]()){throw new Error(_0x90b2('0x10a'));}}catch(_0x2ac55f){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x43cb70['query'][_0x90b2('0x2c')](_0x90b2('0x2d'))){_0x4fdeeb[_0x90b2('0x13')]=qs[_0x90b2('0x13')](_0x43cb70[_0x90b2('0x28')][_0x90b2('0x13')]||0xa);_0x4fdeeb[_0x90b2('0x11')]=qs[_0x90b2('0x11')](_0x43cb70[_0x90b2('0x28')][_0x90b2('0x11')]);}var _0x21079a=_0x40726a['map'](function(_0x250a3d){if(_0x250a3d===_0x90b2('0x102')){var _0x251f5c={'attributes':['id',_0x90b2('0x10b'),_0x90b2('0x89'),'source',_0x90b2('0x10c'),'callerid',_0x90b2('0x10d'),_0x90b2('0x10e'),_0x90b2('0x10f'),_0x90b2('0x110'),_0x90b2('0x111'),_0x90b2('0x112'),_0x90b2('0x113'),_0x90b2('0x114'),_0x90b2('0x115')],'where':{'ContactId':_0x43cb70[_0x90b2('0x81')]['id']},'include':[{'model':db[_0x90b2('0x48')],'as':_0x90b2('0x48'),'attributes':['id',_0x90b2('0x1b'),'fullname',_0x90b2('0x116')]}],'order':[[_0x90b2('0x111'),_0x90b2('0x117')]]};if(_0x43cb70[_0x90b2('0x28')]['range']){_0x251f5c['where']['createdAt']={'$gte':_0x1b4e82[_0x90b2('0x36')],'$lte':_0x1b4e82['to']};}return db['VoiceCallReport'][_0x90b2('0x118')](_0x251f5c)[_0x90b2('0x16')](function(_0x5c0fbf){_0x36445b[_0x90b2('0x71')]+=_0x5c0fbf['count'];return _[_0x90b2('0x50')](_0x5c0fbf[_0x90b2('0x7f')],function(_0x3d3b80){var _0x3dd2bb=_0x3d3b80[_0x90b2('0x8c')]({'plain':!![]});_0x3dd2bb[_0x90b2('0x103')]=_0x250a3d;if(_0x3dd2bb[_0x90b2('0x48')]){_0x3dd2bb[_0x90b2('0x48')]={'id':_0x3dd2bb[_0x90b2('0x48')]['id'],'name':_0x3dd2bb[_0x90b2('0x48')]['name'],'fullname':_0x3dd2bb[_0x90b2('0x48')][_0x90b2('0x119')],'alias':_0x3dd2bb[_0x90b2('0x48')]['alias']};}return _0x3dd2bb;});});}else{var _0x1f9b85=_[_0x90b2('0x11a')](_0x250a3d)+(_0x250a3d==='chat'?_0x90b2('0x11b'):_0x90b2('0x11c'));var _0x50e02c={'attributes':['id',_0x90b2('0x11d'),_0x90b2('0x11e'),_0x90b2('0x111'),'note',_0x90b2('0x11f'),'secondDisposition','thirdDisposition','UserId',_0x1f9b85+'Id'],'where':{'ContactId':_0x43cb70[_0x90b2('0x81')]['id']},'include':[{'model':db[_0x1f9b85],'as':'Account','attributes':['id','name',_0x90b2('0x120')]},{'model':db[_0x90b2('0x48')],'as':'Owner','attributes':['id','name','fullname']},{'model':db[_0x90b2('0x44')],'as':_0x90b2('0x7e'),'attributes':['id',_0x90b2('0x1b'),_0x90b2('0x35')],'through':{'attributes':[]}}],'order':[[_0x90b2('0x111'),_0x90b2('0x117')]]};if(_0x43cb70['query'][_0x90b2('0x107')]){_0x50e02c[_0x90b2('0x30')][_0x90b2('0x111')]={'$gte':_0x1b4e82[_0x90b2('0x36')],'$lte':_0x1b4e82['to']};}switch(_0x250a3d){case _0x90b2('0x121'):_0x50e02c['attributes'][_0x90b2('0x22')]('browserName',_0x90b2('0x122'),_0x90b2('0x123'),_0x90b2('0x124'),_0x90b2('0x125'),_0x90b2('0x126'),_0x90b2('0x127'),_0x90b2('0x128'),_0x90b2('0x129'));break;case _0x90b2('0x12a'):_0x50e02c[_0x90b2('0x2a')][_0x90b2('0x22')]('subject',_0x90b2('0x12b'));break;case _0x90b2('0xff'):_0x50e02c[_0x90b2('0x2a')][_0x90b2('0x22')](_0x90b2('0x12c'),_0x90b2('0x12d'));break;}return db[_['startCase'](_0x250a3d)+_0x90b2('0x12e')][_0x90b2('0x118')](_0x50e02c)[_0x90b2('0x16')](function(_0x2104a9){_0x36445b[_0x90b2('0x71')]+=_0x2104a9[_0x90b2('0x71')];return _[_0x90b2('0x50')](_0x2104a9[_0x90b2('0x7f')],function(_0xd60f63){var _0x469df9=_0xd60f63['get']({'plain':!![]});_0x469df9[_0x90b2('0x103')]=_0x250a3d;if(_0x469df9[_0x90b2('0x12f')]){_0x469df9[_0x90b2('0x12f')]={'id':_0x469df9[_0x90b2('0x12f')]['id'],'name':_0x469df9[_0x90b2('0x12f')]['name'],'fullname':_0x469df9[_0x90b2('0x12f')][_0x90b2('0x119')]};}return _0x469df9;});});}});return Promise['all'](_0x21079a);})[_0x90b2('0x16')](function(_0xc22f58){return _(_0xc22f58)[_0x90b2('0x130')]()[_0x90b2('0x131')]('createdAt')[_0x90b2('0x132')]()[_0x90b2('0x45')]();})[_0x90b2('0x16')](function(_0x201ae9){_0x36445b[_0x90b2('0x7f')]=_0x4fdeeb[_0x90b2('0x13')]?_0x201ae9['slice'](_0x4fdeeb[_0x90b2('0x11')],_0x4fdeeb[_0x90b2('0x11')]+_0x4fdeeb[_0x90b2('0x13')]):_0x201ae9;return _0x36445b;})[_0x90b2('0x16')](respondWithFilteredResult(_0x40de22,_0x4fdeeb))['catch'](handleError(_0x40de22,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 6a1b82a..210699b 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc00a=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x56c7c5,_0x10c180){var _0x460261=function(_0x2580ba){while(--_0x2580ba){_0x56c7c5['push'](_0x56c7c5['shift']());}};_0x460261(++_0x10c180);}(_0xc00a,0x138));var _0xac00=function(_0x31ee6c,_0x3c4217){_0x31ee6c=_0x31ee6c-0x0;var _0x8fae3a=_0xc00a[_0x31ee6c];return _0x8fae3a;};'use strict';var EventEmitter=require(_0xac00('0x0'));var CmContact=require(_0xac00('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xac00('0x2')](0x0);var events={'afterCreate':_0xac00('0x3'),'afterUpdate':_0xac00('0x4'),'afterDestroy':_0xac00('0x5')};function emitEvent(_0x5b1fc1){return function(_0x534991,_0x154108,_0x532c44){CmContactEvents['emit'](_0x5b1fc1+':'+_0x534991['id'],_0x534991);CmContactEvents[_0xac00('0x6')](_0x5b1fc1,_0x534991);_0x532c44(null);};}for(var e in events){if(events[_0xac00('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xac00('0x8')]=CmContactEvents; \ No newline at end of file +var _0x2ade=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update'];(function(_0x4e8147,_0x15717b){var _0x49285b=function(_0x13b7ab){while(--_0x13b7ab){_0x4e8147['push'](_0x4e8147['shift']());}};_0x49285b(++_0x15717b);}(_0x2ade,0x177));var _0xe2ad=function(_0x22f4d6,_0x18244a){_0x22f4d6=_0x22f4d6-0x0;var _0x3180e2=_0x2ade[_0x22f4d6];return _0x3180e2;};'use strict';var EventEmitter=require(_0xe2ad('0x0'));var CmContact=require(_0xe2ad('0x1'))['db'][_0xe2ad('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2ad('0x3'),'afterUpdate':_0xe2ad('0x4'),'afterDestroy':_0xe2ad('0x5')};function emitEvent(_0x1f453c){return function(_0x36d8b4,_0x4d66b5,_0x20383c){CmContactEvents['emit'](_0x1f453c+':'+_0x36d8b4['id'],_0x36d8b4);CmContactEvents[_0xe2ad('0x6')](_0x1f453c,_0x36d8b4);_0x20383c(null);};}for(var e in events){if(events[_0xe2ad('0x7')](e)){var event=events[e];CmContact[_0xe2ad('0x8')](e,emitEvent(event));}}module[_0xe2ad('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 52ec612..1d6c15c 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe50=['afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','cmContact','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','message','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','utf8mb4','models','get'];(function(_0x236801,_0x1868b6){var _0x32d366=function(_0x16adea){while(--_0x16adea){_0x236801['push'](_0x236801['shift']());}};_0x32d366(++_0x1868b6);}(_0xbe50,0xd1));var _0x0be5=function(_0x492f93,_0x2bcdea){_0x492f93=_0x492f93-0x0;var _0x4d90fe=_0xbe50[_0x492f93];return _0x4d90fe;};'use strict';var _=require(_0x0be5('0x0'));var util=require(_0x0be5('0x1'));var logger=require(_0x0be5('0x2'))(_0x0be5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0be5('0x4'));var fs=require('fs');var path=require(_0x0be5('0x5'));var rimraf=require(_0x0be5('0x6'));var config=require(_0x0be5('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x0be5('0x8'));module[_0x0be5('0x9')]=function(_0x28ce07,_0x4ccd89){return _0x28ce07[_0x0be5('0xa')](_0x0be5('0xb'),attributes,{'tableName':_0x0be5('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x0be5('0xd')]},{'name':_0x0be5('0xe'),'fields':[_0x0be5('0xf'),_0x0be5('0x10'),'phone',_0x0be5('0x11'),'fax',_0x0be5('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x0be5('0x13'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x439c1b,_0x40eacf,_0x83d35d){var _0x501dbb=_0x28ce07[_0x0be5('0x14')];var _0x51326c=_0x439c1b[_0x0be5('0x15')]({'plain':!![]});function _0x9894fa(){return function(_0x458ec8){logger['error']('cmContact',_0x0be5('0x16'),util[_0x0be5('0x17')](_0x458ec8,{'showHidden':![],'depth':null}));};}function _0x52faee(_0x55023e,_0x47632e){var _0x43b3d9=_0x47632e[_0x0be5('0x18')]?_0x47632e['scheduledat']:moment()[_0x0be5('0x19')](_0x0be5('0x1a'));return new BPromise(function(_0x2cd4a9,_0x11afd8){if(_[_0x0be5('0x1b')](_0x47632e[_0x0be5('0x1c')])){_0x2cd4a9({'ret':_0x43b3d9});}else{_0x501dbb[_0x0be5('0x1d')][_0x0be5('0x1e')]({'where':{'id':_0x55023e['id']}})[_0x0be5('0x1f')](function(_0x1a7118){if(!_[_0x0be5('0x1b')](_0x1a7118)){var _0xf0edd0=_0x1a7118[_0x0be5('0x1c')];if(!_[_0x0be5('0x1b')](_0xf0edd0)){var _0x46f5fd=shared[_0x0be5('0x20')];var _0x176149=_0x46f5fd[_0xf0edd0];var _0x25b8d3=_0x46f5fd[_0x47632e[_0x0be5('0x1c')]];if(!_[_0x0be5('0x1b')](_0x176149)&&!_[_0x0be5('0x1b')](_0x25b8d3)){var _0x469025=_0x176149[_0x0be5('0x21')]-_0x25b8d3[_0x0be5('0x21')];_0x43b3d9=_0x47632e['scheduledat']?_0x47632e[_0x0be5('0x18')]:moment();var _0x34b57d=moment(_0x43b3d9)['add'](_0x469025,_0x0be5('0x22'));_0x2cd4a9({'ret':_0x34b57d['format'](_0x0be5('0x1a'))});}else _0x2cd4a9({'ret':_0x43b3d9});}else _0x2cd4a9({'ret':_0x43b3d9});}else{_0x2cd4a9({'ret':_0x43b3d9});}});}});return 0xa;}var _0x141474=function(_0x3bffad){return new BPromise(function(_0x41197a,_0x3ee3c3){_0x52faee(_0x3bffad,_0x51326c)[_0x0be5('0x1f')](function(_0x791894){_0x51326c[_0x0be5('0x18')]=_0x791894[_0x0be5('0x23')];_0x501dbb[_0x0be5('0x24')][_0x0be5('0x1e')]({'where':{'phone':_0x51326c[_0x0be5('0xd')],'VoiceQueueId':_0x3bffad['id']}})[_0x0be5('0x1f')](function(_0x268858){if(!_[_0x0be5('0x1b')](_0x268858)){throw new Error(_0x0be5('0x25')+_0x51326c['phone']+_0x0be5('0x26')+_0x3bffad['id']);}return _0x501dbb[_0x0be5('0x24')][_0x0be5('0x27')]({'phone':_0x51326c[_0x0be5('0xd')],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'priority':_0x51326c[_0x0be5('0x29')]?_0x51326c[_0x0be5('0x29')]:0x2,'scheduledat':_0x51326c[_0x0be5('0x18')]?_0x51326c['scheduledat']:moment()['format'](_0x0be5('0x1a')),'callback':_0x51326c[_0x0be5('0x2a')]?!![]:![],'callbackuniqueid':_0x51326c[_0x0be5('0x2a')]?_0x51326c[_0x0be5('0x2a')]:undefined,'callbackat':_0x51326c[_0x0be5('0x2a')]?moment()[_0x0be5('0x19')](_0x0be5('0x1a')):undefined,'VoiceQueueId':_0x3bffad['id']});})['catch'](function(_0x2f57c5){_0x3ee3c3(_0x2f57c5);});});});};var _0x1e0002=function(_0x5536cb){return new BPromise(function(_0x496c61,_0x24cf5f){_0x52faee(_0x5536cb,_0x51326c)[_0x0be5('0x1f')](function(_0x57ec2b){_0x51326c['scheduledat']=_0x57ec2b[_0x0be5('0x23')];_0x501dbb[_0x0be5('0x24')][_0x0be5('0x1e')]({'where':{'phone':_0x51326c[_0x0be5('0xd')],'VoiceQueueId':_0x5536cb['id']}})[_0x0be5('0x1f')](function(_0x2a660b){if(!_[_0x0be5('0x1b')](_0x2a660b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x51326c[_0x0be5('0xd')]+_0x0be5('0x2b')+_0x5536cb['id']);}return _0x501dbb[_0x0be5('0x2c')][_0x0be5('0x1e')]({'where':{'calleridnum':_0x51326c[_0x0be5('0xd')],'VoiceQueueId':_0x5536cb['id']}});})[_0x0be5('0x1f')](function(_0x551748){if(!_[_0x0be5('0x1b')](_0x551748)){throw new Error(_0x0be5('0x2d')+_0x51326c[_0x0be5('0xd')]+_0x0be5('0x2e')+_0x5536cb['id']);}return _0x501dbb[_0x0be5('0x24')]['create']({'phone':_0x51326c[_0x0be5('0xd')],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'priority':_0x51326c[_0x0be5('0x29')]?_0x51326c[_0x0be5('0x29')]:0x2,'scheduledat':_0x51326c[_0x0be5('0x18')]?_0x51326c[_0x0be5('0x18')]:moment()[_0x0be5('0x19')](_0x0be5('0x1a')),'callback':_0x51326c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51326c[_0x0be5('0x2a')]?_0x51326c['callbackUniqueid']:undefined,'callbackat':_0x51326c[_0x0be5('0x2a')]?moment()[_0x0be5('0x19')](_0x0be5('0x1a')):undefined,'VoiceQueueId':_0x5536cb['id']});})['catch'](function(_0x557422){_0x24cf5f(_0x557422);});});});};function _0x4489d9(){return function(_0x42eed4){logger[_0x0be5('0x2f')](_0x0be5('0x30'),'afterCreate',util['inspect'](_0x42eed4,{'showHidden':![],'depth':null}));};}function _0x421fab(_0x5b3495,_0xbfcaa0){var _0x1c0095=_0xbfcaa0[_0x0be5('0x18')]?_0xbfcaa0[_0x0be5('0x18')]:moment()[_0x0be5('0x19')](_0x0be5('0x1a'));return new BPromise(function(_0x1484f7,_0x5bae7f){if(_[_0x0be5('0x1b')](_0xbfcaa0[_0x0be5('0x1c')])){_0x1484f7({'ret':_0x1c0095});}else{_0x501dbb[_0x0be5('0x31')][_0x0be5('0x1e')]({'where':{'id':_0x5b3495['id']}})['then'](function(_0x2c41b9){if(!_[_0x0be5('0x1b')](_0x2c41b9)){var _0x219078=_0x2c41b9[_0x0be5('0x1c')];if(!_[_0x0be5('0x1b')](_0x219078)){var _0x2cb0f3=shared[_0x0be5('0x20')];var _0x3dc5fe=_0x2cb0f3[_0x219078];var _0x54da32=_0x2cb0f3[_0xbfcaa0[_0x0be5('0x1c')]];if(!_[_0x0be5('0x1b')](_0x3dc5fe)&&!_['isNil'](_0x54da32)){var _0x298fd6=_0x3dc5fe[_0x0be5('0x21')]-_0x54da32['utcOffset'];_0x1c0095=_0xbfcaa0[_0x0be5('0x18')]?_0xbfcaa0[_0x0be5('0x18')]:moment();var _0x4b90c3=moment(_0x1c0095)[_0x0be5('0x32')](_0x298fd6,_0x0be5('0x22'));_0x1484f7({'ret':_0x4b90c3[_0x0be5('0x19')](_0x0be5('0x1a'))});}else _0x1484f7({'ret':_0x1c0095});}else _0x1484f7({'ret':_0x1c0095});}else{_0x1484f7({'ret':_0x1c0095});}});}});return 0xa;}var _0x571a1c=function(_0x10ee74){return new BPromise(function(_0x4bc268,_0x524bd2){_0x421fab(_0x10ee74,_0x51326c)[_0x0be5('0x1f')](function(_0x3cb280){_0x51326c['scheduledat']=_0x3cb280[_0x0be5('0x23')];_0x501dbb[_0x0be5('0x24')][_0x0be5('0x1e')]({'where':{'phone':_0x51326c[_0x0be5('0xd')],'CampaignId':_0x10ee74['id']}})[_0x0be5('0x1f')](function(_0x174237){if(!_[_0x0be5('0x1b')](_0x174237)){throw new Error('cmContact,\x20afterCreate\x20'+_0x51326c[_0x0be5('0xd')]+_0x0be5('0x33')+_0x10ee74['id']);}return _0x501dbb[_0x0be5('0x24')][_0x0be5('0x27')]({'phone':_0x51326c[_0x0be5('0xd')],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'priority':_0x51326c[_0x0be5('0x29')]?_0x51326c[_0x0be5('0x29')]:0x2,'scheduledat':_0x51326c[_0x0be5('0x18')]?_0x51326c[_0x0be5('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x51326c[_0x0be5('0x2a')]?!![]:![],'callbackuniqueid':_0x51326c[_0x0be5('0x2a')]?_0x51326c[_0x0be5('0x2a')]:undefined,'callbackat':_0x51326c[_0x0be5('0x2a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x10ee74['id']});})[_0x0be5('0x34')](function(_0x3476b0){_0x524bd2(_0x3476b0);});});});};var _0x7a411a=function(_0xb2f88c){return new BPromise(function(_0x4a93ef,_0x10577a){_0x421fab(_0xb2f88c,_0x51326c)[_0x0be5('0x1f')](function(_0x5dcf10){_0x51326c[_0x0be5('0x18')]=_0x5dcf10['ret'];_0x501dbb[_0x0be5('0x24')][_0x0be5('0x1e')]({'where':{'phone':_0x51326c[_0x0be5('0xd')],'CampaignId':_0xb2f88c['id']}})[_0x0be5('0x1f')](function(_0x3d3b3e){if(!_[_0x0be5('0x1b')](_0x3d3b3e)){throw new Error('cmContact,\x20afterCreate\x20'+_0x51326c[_0x0be5('0xd')]+_0x0be5('0x35')+_0xb2f88c['id']);}return _0x501dbb[_0x0be5('0x2c')][_0x0be5('0x1e')]({'where':{'calleridnum':_0x51326c[_0x0be5('0xd')],'CampaignId':_0xb2f88c['id']}});})[_0x0be5('0x1f')](function(_0x3691bc){if(!_[_0x0be5('0x1b')](_0x3691bc)){throw new Error(_0x0be5('0x2d')+_0x51326c[_0x0be5('0xd')]+_0x0be5('0x36')+_0xb2f88c['id']);}return _0x501dbb[_0x0be5('0x24')][_0x0be5('0x27')]({'phone':_0x51326c['phone'],'ContactId':_0x51326c['id'],'ListId':_0x51326c['ListId'],'priority':_0x51326c[_0x0be5('0x29')]?_0x51326c['priority']:0x2,'scheduledat':_0x51326c[_0x0be5('0x18')]?_0x51326c['scheduledat']:moment()[_0x0be5('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x51326c[_0x0be5('0x2a')]?!![]:![],'callbackuniqueid':_0x51326c[_0x0be5('0x2a')]?_0x51326c[_0x0be5('0x2a')]:undefined,'callbackat':_0x51326c[_0x0be5('0x2a')]?moment()[_0x0be5('0x19')](_0x0be5('0x1a')):undefined,'CampaignId':_0xb2f88c['id']});})[_0x0be5('0x34')](function(_0x40e9d8){_0x10577a(_0x40e9d8);});});});};if(_0x51326c[_0x0be5('0x28')]){_0x501dbb[_0x0be5('0x1d')]['findAll']({'where':{'type':_0x0be5('0x37')},'attributes':['id',_0x0be5('0x38'),_0x0be5('0x1c')],'include':[{'model':_0x501dbb[_0x0be5('0x39')],'as':_0x0be5('0x3a'),'where':{'id':_0x51326c['ListId']}}]})['then'](function(_0x2648eb){if(_0x2648eb){var _0x547856=[];for(var _0x5cac7c=0x0,_0x50ddc7;_0x5cac7c<_0x2648eb[_0x0be5('0x3b')];_0x5cac7c+=0x1){_0x50ddc7=_0x2648eb[_0x5cac7c]['get']({'plain':!![]});switch(_0x50ddc7[_0x0be5('0x38')]){case _0x0be5('0x3c'):_0x1e0002(_0x50ddc7)[_0x0be5('0x34')](_0x9894fa());break;case _0x0be5('0x3d'):_0x141474(_0x50ddc7)[_0x0be5('0x34')](_0x9894fa());break;default:_0x421fab(_0x50ddc7,_0x51326c)['then'](function(_0x1aecb5){_0x51326c[_0x0be5('0x18')]=_0x1aecb5['ret'];_0x501dbb[_0x0be5('0x24')][_0x0be5('0x27')]({'phone':_0x51326c[_0x0be5('0xd')],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'scheduledat':_0x51326c[_0x0be5('0x18')]?_0x51326c[_0x0be5('0x18')]:moment()[_0x0be5('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x51326c['priority']?_0x51326c[_0x0be5('0x29')]:0x2,'callback':_0x51326c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51326c[_0x0be5('0x2a')]?_0x51326c[_0x0be5('0x2a')]:undefined,'callbackat':_0x51326c[_0x0be5('0x2a')]?moment()[_0x0be5('0x19')](_0x0be5('0x1a')):undefined,'VoiceQueueId':_0x50ddc7['id']})[_0x0be5('0x34')](_0x9894fa());});}}}})[_0x0be5('0x1f')](function(){return _0x501dbb['VoiceQueue'][_0x0be5('0x3e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x501dbb[_0x0be5('0x39')],'as':_0x0be5('0x3f'),'where':{'id':_0x51326c['ListId']}}]})['then'](function(_0x2ca1a9){if(_0x2ca1a9){var _0x4c3d57=[];for(var _0x450a0d=0x0,_0x191dae;_0x450a0d<_0x2ca1a9[_0x0be5('0x3b')];_0x450a0d+=0x1){_0x191dae=_0x2ca1a9[_0x450a0d][_0x0be5('0x15')]({'plain':!![]});_0x501dbb[_0x0be5('0x40')]['create']({'phone':_0x51326c['phone'],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'VoiceQueueId':_0x191dae['id']})[_0x0be5('0x34')](function(_0x252324){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x252324[_0x0be5('0x41')]);});}}});})[_0x0be5('0x1f')](function(){return _0x501dbb[_0x0be5('0x31')]['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x501dbb[_0x0be5('0x39')],'as':_0x0be5('0x3a'),'where':{'id':_0x51326c[_0x0be5('0x28')]}}]})[_0x0be5('0x1f')](function(_0x1d8140){if(_0x1d8140){var _0x3b41e9=[];for(var _0x24dc03=0x0,_0x1969e8;_0x24dc03<_0x1d8140[_0x0be5('0x3b')];_0x24dc03+=0x1){_0x1969e8=_0x1d8140[_0x24dc03][_0x0be5('0x15')]({'plain':!![]});switch(_0x1969e8[_0x0be5('0x38')]){case _0x0be5('0x3c'):_0x7a411a(_0x1969e8)[_0x0be5('0x34')](_0x4489d9());break;case _0x0be5('0x3d'):_0x571a1c(_0x1969e8)[_0x0be5('0x34')](_0x4489d9());break;default:_0x501dbb['CmHopper'][_0x0be5('0x27')]({'phone':_0x51326c[_0x0be5('0xd')],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'scheduledat':_0x51326c[_0x0be5('0x18')]?_0x51326c[_0x0be5('0x18')]:moment()[_0x0be5('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x51326c[_0x0be5('0x29')]?_0x51326c[_0x0be5('0x29')]:0x2,'callback':_0x51326c[_0x0be5('0x2a')]?!![]:![],'callbackuniqueid':_0x51326c[_0x0be5('0x2a')]?_0x51326c[_0x0be5('0x2a')]:undefined,'callbackat':_0x51326c[_0x0be5('0x2a')]?moment()['format'](_0x0be5('0x1a')):undefined,'CampaignId':_0x1969e8['id']})[_0x0be5('0x34')](_0x4489d9());}}}});})[_0x0be5('0x1f')](function(){return _0x501dbb[_0x0be5('0x31')]['findAll']({'attributes':['id'],'include':[{'model':_0x501dbb[_0x0be5('0x39')],'as':_0x0be5('0x3f'),'where':{'id':_0x51326c[_0x0be5('0x28')]}}]})[_0x0be5('0x1f')](function(_0x3e55fd){if(_0x3e55fd){var _0x374ee3=[];for(var _0x16a6c3=0x0,_0x15adef;_0x16a6c3<_0x3e55fd['length'];_0x16a6c3+=0x1){_0x15adef=_0x3e55fd[_0x16a6c3]['get']({'plain':!![]});_0x501dbb[_0x0be5('0x40')][_0x0be5('0x27')]({'phone':_0x51326c[_0x0be5('0xd')],'ContactId':_0x51326c['id'],'ListId':_0x51326c[_0x0be5('0x28')],'CampaignId':_0x15adef['id']})[_0x0be5('0x34')](function(_0x182f81){logger[_0x0be5('0x2f')](_0x0be5('0x42'),_0x0be5('0x16'),_0x182f81[_0x0be5('0x41')]);});}}});})[_0x0be5('0x1f')](function(){_0x83d35d();})['catch'](function(_0x25fd43){logger[_0x0be5('0x2f')](_0x0be5('0x42'),_0x0be5('0x16'),_0x25fd43['message']);_0x83d35d(_0x25fd43);});}else{_0x83d35d(new Error(_0x0be5('0x43')));}},'afterDestroy':function(_0x2970b6,_0x358aa3,_0x44fe93){var _0x222443=_0x28ce07[_0x0be5('0x14')];var _0xa9152e=_0x2970b6[_0x0be5('0x15')]({'plain':!![]});return _0x222443['CmHopper'][_0x0be5('0x3e')]({'raw':!![],'where':{'ListId':_0xa9152e[_0x0be5('0x28')],'ContactId':_0xa9152e['id']}})['then'](function(_0x38de7f){if(!_[_0x0be5('0x44')](_0x38de7f)){var _0x3c14f1=[];for(var _0x54f123=0x0;_0x54f123<_0x38de7f[_0x0be5('0x3b')];_0x54f123+=0x1){var _0x1804ce=_0x222443[_0x0be5('0x24')][_0x0be5('0x45')]({'where':{'ListId':_0x38de7f[_0x54f123]['ListId'],'ContactId':_0x38de7f[_0x54f123][_0x0be5('0x46')],'VoiceQueueId':_0x38de7f[_0x54f123][_0x0be5('0x47')],'CampaignId':_0x38de7f[_0x54f123][_0x0be5('0x48')]}});_0x3c14f1[_0x0be5('0x49')](_0x1804ce);}return BPromise[_0x0be5('0x4a')](_0x3c14f1);}})[_0x0be5('0x1f')](function(_0x79f672){logger['info'](_0x0be5('0x4b'),util[_0x0be5('0x17')](_0x79f672,{'showHidden':![],'depth':null}));_0x44fe93();})[_0x0be5('0x34')](function(_0x22c4a5){logger[_0x0be5('0x2f')](_0x0be5('0x4c'),util['inspect'](_0x22c4a5,{'showHidden':![],'depth':null}));_0x44fe93(_0x22c4a5);});}}});}; \ No newline at end of file +var _0xd155=['always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','format','ret','CmHopper','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','create','ListId','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','outbound','CmList','Lists','length','dialCheckDuplicateType'];(function(_0x57f590,_0x31e929){var _0x3181dd=function(_0x9bb1c5){while(--_0x9bb1c5){_0x57f590['push'](_0x57f590['shift']());}};_0x3181dd(++_0x31e929);}(_0xd155,0x1cd));var _0x5d15=function(_0x229101,_0x31339d){_0x229101=_0x229101-0x0;var _0xc93cb=_0xd155[_0x229101];return _0xc93cb;};'use strict';var _=require(_0x5d15('0x0'));var util=require(_0x5d15('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5d15('0x2'));var BPromise=require(_0x5d15('0x3'));var rp=require(_0x5d15('0x4'));var fs=require('fs');var path=require(_0x5d15('0x5'));var rimraf=require(_0x5d15('0x6'));var config=require(_0x5d15('0x7'));var shared=require(_0x5d15('0x8'));var attributes=require(_0x5d15('0x9'));module[_0x5d15('0xa')]=function(_0x50cfe6,_0x1b1499){return _0x50cfe6[_0x5d15('0xb')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x5d15('0xc'),'fields':[_0x5d15('0xc')]},{'name':_0x5d15('0xd'),'fields':[_0x5d15('0xe'),'lastName','phone',_0x5d15('0xf'),_0x5d15('0x10'),_0x5d15('0x11')],'type':_0x5d15('0x12')}],'timestamps':!![],'charset':_0x5d15('0x13'),'collate':_0x5d15('0x14'),'hooks':{'afterCreate':function(_0x523d17,_0x470b8a,_0x556b47){var _0xd2b960=_0x50cfe6[_0x5d15('0x15')];var _0x45b97d=_0x523d17[_0x5d15('0x16')]({'plain':!![]});function _0x2d7f76(){return function(_0x4e5894){logger[_0x5d15('0x17')](_0x5d15('0x18'),_0x5d15('0x19'),util[_0x5d15('0x1a')](_0x4e5894,{'showHidden':![],'depth':null}));};}function _0x5b7460(_0x208e02,_0x51c822){var _0x31e2c9=_0x51c822[_0x5d15('0x1b')]?_0x51c822[_0x5d15('0x1b')]:moment()['format'](_0x5d15('0x1c'));return new BPromise(function(_0x4d7f80,_0x12991c){if(_[_0x5d15('0x1d')](_0x51c822[_0x5d15('0x1e')])){_0x4d7f80({'ret':_0x31e2c9});}else{_0xd2b960[_0x5d15('0x1f')]['findOne']({'where':{'id':_0x208e02['id']}})[_0x5d15('0x20')](function(_0x5eed87){if(!_[_0x5d15('0x1d')](_0x5eed87)){var _0x4db4b8=_0x5eed87['dialTimezone'];if(!_[_0x5d15('0x1d')](_0x4db4b8)){var _0x2163d7=shared[_0x5d15('0x21')];var _0x449b7f=_0x2163d7[_0x4db4b8];var _0x1ddd85=_0x2163d7[_0x51c822[_0x5d15('0x1e')]];if(!_[_0x5d15('0x1d')](_0x449b7f)&&!_['isNil'](_0x1ddd85)){var _0x51580d=_0x449b7f[_0x5d15('0x22')]-_0x1ddd85[_0x5d15('0x22')];_0x31e2c9=_0x51c822[_0x5d15('0x1b')]?_0x51c822[_0x5d15('0x1b')]:moment();var _0x489c2d=moment(_0x31e2c9)['add'](_0x51580d,'minutes');_0x4d7f80({'ret':_0x489c2d[_0x5d15('0x23')](_0x5d15('0x1c'))});}else _0x4d7f80({'ret':_0x31e2c9});}else _0x4d7f80({'ret':_0x31e2c9});}else{_0x4d7f80({'ret':_0x31e2c9});}});}});return 0xa;}var _0x1a5116=function(_0x317026){return new BPromise(function(_0x5ecb6b,_0x2d219d){_0x5b7460(_0x317026,_0x45b97d)[_0x5d15('0x20')](function(_0x4a2ef6){_0x45b97d['scheduledat']=_0x4a2ef6[_0x5d15('0x24')];_0xd2b960[_0x5d15('0x25')][_0x5d15('0x26')]({'where':{'phone':_0x45b97d[_0x5d15('0xc')],'VoiceQueueId':_0x317026['id']}})[_0x5d15('0x20')](function(_0x420996){if(!_[_0x5d15('0x1d')](_0x420996)){throw new Error('cmContact,\x20afterCreate\x20'+_0x45b97d['phone']+_0x5d15('0x27')+_0x317026['id']);}return _0xd2b960[_0x5d15('0x25')]['create']({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d['ListId'],'priority':_0x45b97d[_0x5d15('0x28')]?_0x45b97d[_0x5d15('0x28')]:0x2,'scheduledat':_0x45b97d[_0x5d15('0x1b')]?_0x45b97d[_0x5d15('0x1b')]:moment()[_0x5d15('0x23')](_0x5d15('0x1c')),'callback':_0x45b97d[_0x5d15('0x29')]?!![]:![],'callbackuniqueid':_0x45b97d[_0x5d15('0x29')]?_0x45b97d[_0x5d15('0x29')]:undefined,'callbackat':_0x45b97d[_0x5d15('0x29')]?moment()['format'](_0x5d15('0x1c')):undefined,'VoiceQueueId':_0x317026['id']});})[_0x5d15('0x2a')](function(_0x2e6c76){_0x2d219d(_0x2e6c76);});});});};var _0x245bc9=function(_0x72a381){return new BPromise(function(_0x390b40,_0x7732f1){_0x5b7460(_0x72a381,_0x45b97d)[_0x5d15('0x20')](function(_0x318fd0){_0x45b97d[_0x5d15('0x1b')]=_0x318fd0[_0x5d15('0x24')];_0xd2b960[_0x5d15('0x25')][_0x5d15('0x26')]({'where':{'phone':_0x45b97d[_0x5d15('0xc')],'VoiceQueueId':_0x72a381['id']}})['then'](function(_0x9adada){if(!_[_0x5d15('0x1d')](_0x9adada)){throw new Error(_0x5d15('0x2b')+_0x45b97d[_0x5d15('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x72a381['id']);}return _0xd2b960[_0x5d15('0x2c')][_0x5d15('0x26')]({'where':{'calleridnum':_0x45b97d[_0x5d15('0xc')],'VoiceQueueId':_0x72a381['id']}});})[_0x5d15('0x20')](function(_0x6dd6d8){if(!_[_0x5d15('0x1d')](_0x6dd6d8)){throw new Error(_0x5d15('0x2d')+_0x45b97d['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x72a381['id']);}return _0xd2b960[_0x5d15('0x25')][_0x5d15('0x2e')]({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d[_0x5d15('0x2f')],'priority':_0x45b97d[_0x5d15('0x28')]?_0x45b97d[_0x5d15('0x28')]:0x2,'scheduledat':_0x45b97d[_0x5d15('0x1b')]?_0x45b97d[_0x5d15('0x1b')]:moment()[_0x5d15('0x23')](_0x5d15('0x1c')),'callback':_0x45b97d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45b97d[_0x5d15('0x29')]?_0x45b97d['callbackUniqueid']:undefined,'callbackat':_0x45b97d[_0x5d15('0x29')]?moment()[_0x5d15('0x23')](_0x5d15('0x1c')):undefined,'VoiceQueueId':_0x72a381['id']});})[_0x5d15('0x2a')](function(_0xeefc48){_0x7732f1(_0xeefc48);});});});};function _0x213bcf(){return function(_0x4a0002){logger[_0x5d15('0x17')](_0x5d15('0x18'),_0x5d15('0x19'),util['inspect'](_0x4a0002,{'showHidden':![],'depth':null}));};}function _0x1fad2c(_0x1fe91b,_0xeccf14){var _0x10e5e3=_0xeccf14['scheduledat']?_0xeccf14[_0x5d15('0x1b')]:moment()[_0x5d15('0x23')](_0x5d15('0x1c'));return new BPromise(function(_0x19ac26,_0x4a00d0){if(_[_0x5d15('0x1d')](_0xeccf14[_0x5d15('0x1e')])){_0x19ac26({'ret':_0x10e5e3});}else{_0xd2b960[_0x5d15('0x30')][_0x5d15('0x26')]({'where':{'id':_0x1fe91b['id']}})[_0x5d15('0x20')](function(_0x1ad8fb){if(!_[_0x5d15('0x1d')](_0x1ad8fb)){var _0x410e64=_0x1ad8fb[_0x5d15('0x1e')];if(!_[_0x5d15('0x1d')](_0x410e64)){var _0x5cb785=shared[_0x5d15('0x21')];var _0x455140=_0x5cb785[_0x410e64];var _0x40e506=_0x5cb785[_0xeccf14[_0x5d15('0x1e')]];if(!_[_0x5d15('0x1d')](_0x455140)&&!_[_0x5d15('0x1d')](_0x40e506)){var _0x504936=_0x455140[_0x5d15('0x22')]-_0x40e506['utcOffset'];_0x10e5e3=_0xeccf14['scheduledat']?_0xeccf14[_0x5d15('0x1b')]:moment();var _0x121677=moment(_0x10e5e3)[_0x5d15('0x31')](_0x504936,'minutes');_0x19ac26({'ret':_0x121677['format'](_0x5d15('0x1c'))});}else _0x19ac26({'ret':_0x10e5e3});}else _0x19ac26({'ret':_0x10e5e3});}else{_0x19ac26({'ret':_0x10e5e3});}});}});return 0xa;}var _0x13b023=function(_0x452754){return new BPromise(function(_0x1ad239,_0x4ee1a7){_0x1fad2c(_0x452754,_0x45b97d)[_0x5d15('0x20')](function(_0x1007b0){_0x45b97d[_0x5d15('0x1b')]=_0x1007b0[_0x5d15('0x24')];_0xd2b960[_0x5d15('0x25')]['findOne']({'where':{'phone':_0x45b97d[_0x5d15('0xc')],'CampaignId':_0x452754['id']}})['then'](function(_0x95892b){if(!_[_0x5d15('0x1d')](_0x95892b)){throw new Error(_0x5d15('0x2b')+_0x45b97d[_0x5d15('0xc')]+_0x5d15('0x32')+_0x452754['id']);}return _0xd2b960[_0x5d15('0x25')][_0x5d15('0x2e')]({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d[_0x5d15('0x2f')],'priority':_0x45b97d[_0x5d15('0x28')]?_0x45b97d[_0x5d15('0x28')]:0x2,'scheduledat':_0x45b97d[_0x5d15('0x1b')]?_0x45b97d[_0x5d15('0x1b')]:moment()[_0x5d15('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x45b97d[_0x5d15('0x29')]?!![]:![],'callbackuniqueid':_0x45b97d[_0x5d15('0x29')]?_0x45b97d[_0x5d15('0x29')]:undefined,'callbackat':_0x45b97d['callbackUniqueid']?moment()[_0x5d15('0x23')](_0x5d15('0x1c')):undefined,'CampaignId':_0x452754['id']});})[_0x5d15('0x2a')](function(_0x10d048){_0x4ee1a7(_0x10d048);});});});};var _0x15f29c=function(_0x366b17){return new BPromise(function(_0x506ae0,_0x7dc52d){_0x1fad2c(_0x366b17,_0x45b97d)[_0x5d15('0x20')](function(_0x1facf4){_0x45b97d[_0x5d15('0x1b')]=_0x1facf4[_0x5d15('0x24')];_0xd2b960[_0x5d15('0x25')]['findOne']({'where':{'phone':_0x45b97d[_0x5d15('0xc')],'CampaignId':_0x366b17['id']}})['then'](function(_0x28a93e){if(!_['isNil'](_0x28a93e)){throw new Error(_0x5d15('0x2b')+_0x45b97d['phone']+_0x5d15('0x33')+_0x366b17['id']);}return _0xd2b960[_0x5d15('0x2c')][_0x5d15('0x26')]({'where':{'calleridnum':_0x45b97d[_0x5d15('0xc')],'CampaignId':_0x366b17['id']}});})[_0x5d15('0x20')](function(_0x592557){if(!_[_0x5d15('0x1d')](_0x592557)){throw new Error(_0x5d15('0x2d')+_0x45b97d['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x366b17['id']);}return _0xd2b960[_0x5d15('0x25')][_0x5d15('0x2e')]({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d['ListId'],'priority':_0x45b97d[_0x5d15('0x28')]?_0x45b97d[_0x5d15('0x28')]:0x2,'scheduledat':_0x45b97d[_0x5d15('0x1b')]?_0x45b97d[_0x5d15('0x1b')]:moment()['format'](_0x5d15('0x1c')),'callback':_0x45b97d[_0x5d15('0x29')]?!![]:![],'callbackuniqueid':_0x45b97d['callbackUniqueid']?_0x45b97d['callbackUniqueid']:undefined,'callbackat':_0x45b97d[_0x5d15('0x29')]?moment()['format'](_0x5d15('0x1c')):undefined,'CampaignId':_0x366b17['id']});})['catch'](function(_0x4b0d24){_0x7dc52d(_0x4b0d24);});});});};if(_0x45b97d[_0x5d15('0x2f')]){_0xd2b960[_0x5d15('0x1f')]['findAll']({'where':{'type':_0x5d15('0x34')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0xd2b960[_0x5d15('0x35')],'as':_0x5d15('0x36'),'where':{'id':_0x45b97d[_0x5d15('0x2f')]}}]})[_0x5d15('0x20')](function(_0x234c07){if(_0x234c07){var _0x3d16c7=[];for(var _0x3386ef=0x0,_0x253207;_0x3386ef<_0x234c07[_0x5d15('0x37')];_0x3386ef+=0x1){_0x253207=_0x234c07[_0x3386ef]['get']({'plain':!![]});switch(_0x253207[_0x5d15('0x38')]){case _0x5d15('0x39'):_0x245bc9(_0x253207)['catch'](_0x2d7f76());break;case _0x5d15('0x3a'):_0x1a5116(_0x253207)['catch'](_0x2d7f76());break;default:_0x1fad2c(_0x253207,_0x45b97d)[_0x5d15('0x20')](function(_0x2ece81){_0x45b97d[_0x5d15('0x1b')]=_0x2ece81['ret'];_0xd2b960[_0x5d15('0x25')][_0x5d15('0x2e')]({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d['ListId'],'scheduledat':_0x45b97d[_0x5d15('0x1b')]?_0x45b97d[_0x5d15('0x1b')]:moment()[_0x5d15('0x23')](_0x5d15('0x1c')),'priority':_0x45b97d[_0x5d15('0x28')]?_0x45b97d[_0x5d15('0x28')]:0x2,'callback':_0x45b97d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45b97d[_0x5d15('0x29')]?_0x45b97d[_0x5d15('0x29')]:undefined,'callbackat':_0x45b97d[_0x5d15('0x29')]?moment()[_0x5d15('0x23')](_0x5d15('0x1c')):undefined,'VoiceQueueId':_0x253207['id']})[_0x5d15('0x2a')](_0x2d7f76());});}}}})[_0x5d15('0x20')](function(){return _0xd2b960[_0x5d15('0x1f')]['findAll']({'where':{'type':_0x5d15('0x34')},'attributes':['id'],'include':[{'model':_0xd2b960[_0x5d15('0x35')],'as':_0x5d15('0x3b'),'where':{'id':_0x45b97d[_0x5d15('0x2f')]}}]})[_0x5d15('0x20')](function(_0x1e4e82){if(_0x1e4e82){var _0x12d75f=[];for(var _0x545330=0x0,_0x4eec9c;_0x545330<_0x1e4e82[_0x5d15('0x37')];_0x545330+=0x1){_0x4eec9c=_0x1e4e82[_0x545330][_0x5d15('0x16')]({'plain':!![]});_0xd2b960[_0x5d15('0x3c')]['create']({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d[_0x5d15('0x2f')],'VoiceQueueId':_0x4eec9c['id']})[_0x5d15('0x2a')](function(_0x3a9c1e){logger[_0x5d15('0x17')](_0x5d15('0x3d'),_0x5d15('0x19'),_0x3a9c1e[_0x5d15('0x3e')]);});}}});})['then'](function(){return _0xd2b960[_0x5d15('0x30')]['findAll']({'attributes':['id',_0x5d15('0x38'),_0x5d15('0x1e')],'include':[{'model':_0xd2b960[_0x5d15('0x35')],'as':_0x5d15('0x36'),'where':{'id':_0x45b97d['ListId']}}]})[_0x5d15('0x20')](function(_0x199f0b){if(_0x199f0b){var _0x37c30d=[];for(var _0x1a45f4=0x0,_0x109454;_0x1a45f4<_0x199f0b['length'];_0x1a45f4+=0x1){_0x109454=_0x199f0b[_0x1a45f4][_0x5d15('0x16')]({'plain':!![]});switch(_0x109454[_0x5d15('0x38')]){case _0x5d15('0x39'):_0x15f29c(_0x109454)[_0x5d15('0x2a')](_0x213bcf());break;case _0x5d15('0x3a'):_0x13b023(_0x109454)['catch'](_0x213bcf());break;default:_0xd2b960[_0x5d15('0x25')]['create']({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d[_0x5d15('0x2f')],'scheduledat':_0x45b97d[_0x5d15('0x1b')]?_0x45b97d[_0x5d15('0x1b')]:moment()[_0x5d15('0x23')](_0x5d15('0x1c')),'priority':_0x45b97d[_0x5d15('0x28')]?_0x45b97d[_0x5d15('0x28')]:0x2,'callback':_0x45b97d[_0x5d15('0x29')]?!![]:![],'callbackuniqueid':_0x45b97d[_0x5d15('0x29')]?_0x45b97d[_0x5d15('0x29')]:undefined,'callbackat':_0x45b97d[_0x5d15('0x29')]?moment()[_0x5d15('0x23')](_0x5d15('0x1c')):undefined,'CampaignId':_0x109454['id']})[_0x5d15('0x2a')](_0x213bcf());}}}});})[_0x5d15('0x20')](function(){return _0xd2b960[_0x5d15('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0xd2b960['CmList'],'as':_0x5d15('0x3b'),'where':{'id':_0x45b97d['ListId']}}]})['then'](function(_0x4eb488){if(_0x4eb488){var _0x26fbab=[];for(var _0x3da315=0x0,_0x41d097;_0x3da315<_0x4eb488['length'];_0x3da315+=0x1){_0x41d097=_0x4eb488[_0x3da315][_0x5d15('0x16')]({'plain':!![]});_0xd2b960[_0x5d15('0x3c')][_0x5d15('0x2e')]({'phone':_0x45b97d[_0x5d15('0xc')],'ContactId':_0x45b97d['id'],'ListId':_0x45b97d['ListId'],'CampaignId':_0x41d097['id']})[_0x5d15('0x2a')](function(_0x4c7aaa){logger[_0x5d15('0x17')]('cmContact,\x20%s,\x20%s',_0x5d15('0x19'),_0x4c7aaa[_0x5d15('0x3e')]);});}}});})[_0x5d15('0x20')](function(){_0x556b47();})[_0x5d15('0x2a')](function(_0x42f65f){logger['error'](_0x5d15('0x3d'),'afterCreate',_0x42f65f[_0x5d15('0x3e')]);_0x556b47(_0x42f65f);});}else{_0x556b47(new Error(_0x5d15('0x3f')));}},'afterDestroy':function(_0x1283ff,_0x36acd8,_0x533151){var _0x1aefc0=_0x50cfe6[_0x5d15('0x15')];var _0x5b37fb=_0x1283ff['get']({'plain':!![]});return _0x1aefc0[_0x5d15('0x25')]['findAll']({'raw':!![],'where':{'ListId':_0x5b37fb[_0x5d15('0x2f')],'ContactId':_0x5b37fb['id']}})['then'](function(_0x4429ab){if(!_[_0x5d15('0x40')](_0x4429ab)){var _0x5a9610=[];for(var _0x2d02f6=0x0;_0x2d02f6<_0x4429ab[_0x5d15('0x37')];_0x2d02f6+=0x1){var _0x30947b=_0x1aefc0['CmHopper'][_0x5d15('0x41')]({'where':{'ListId':_0x4429ab[_0x2d02f6][_0x5d15('0x2f')],'ContactId':_0x4429ab[_0x2d02f6][_0x5d15('0x42')],'VoiceQueueId':_0x4429ab[_0x2d02f6][_0x5d15('0x43')],'CampaignId':_0x4429ab[_0x2d02f6][_0x5d15('0x44')]}});_0x5a9610[_0x5d15('0x45')](_0x30947b);}return BPromise[_0x5d15('0x46')](_0x5a9610);}})[_0x5d15('0x20')](function(_0x1c9c03){logger[_0x5d15('0x47')](_0x5d15('0x48'),util[_0x5d15('0x1a')](_0x1c9c03,{'showHidden':![],'depth':null}));_0x533151();})[_0x5d15('0x2a')](function(_0x2c21de){logger['error'](_0x5d15('0x49'),util['inspect'](_0x2c21de,{'showHidden':![],'depth':null}));_0x533151(_0x2c21de);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index fe5435b..0bd7e2c 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x1b00d4,_0x2a9885){var _0x2b423f=function(_0x427b61){while(--_0x427b61){_0x1b00d4['push'](_0x1b00d4['shift']());}};_0x2b423f(++_0x2a9885);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c5e623d..c3f2243 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd957=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x41be50,_0x5ab8c6){var _0x15ed0d=function(_0x88b79a){while(--_0x88b79a){_0x41be50['push'](_0x41be50['shift']());}};_0x15ed0d(++_0x5ab8c6);}(_0xd957,0x153));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7d95('0x0'));module[_0x7d95('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x7d95('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7d95('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x7d95('0x4')},'OrderBy':{'type':Sequelize[_0x7d95('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x7d95('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x5d70=['PHONE','sequelize','exports','STRING','INTEGER'];(function(_0x1b45c8,_0x326332){var _0x2c418b=function(_0x3aeee0){while(--_0x3aeee0){_0x1b45c8['push'](_0x1b45c8['shift']());}};_0x2c418b(++_0x326332);}(_0x5d70,0x8d));var _0x05d7=function(_0x2ab08f,_0x39d88c){_0x2ab08f=_0x2ab08f-0x0;var _0x475a3d=_0x5d70[_0x2ab08f];return _0x475a3d;};'use strict';var Sequelize=require(_0x05d7('0x0'));module[_0x05d7('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x05d7('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x05d7('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x05d7('0x2')],'defaultValue':_0x05d7('0x4')},'OrderBy':{'type':Sequelize[_0x05d7('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x05d7('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 43affd7..8837b69 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x810a=['update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','moment','mustache','util','sox','ejs','lodash','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save'];(function(_0x3116c9,_0x1db034){var _0x2ca671=function(_0x24dae4){while(--_0x24dae4){_0x3116c9['push'](_0x3116c9['shift']());}};_0x2ca671(++_0x1db034);}(_0x810a,0x1bf));var _0xa810=function(_0x4c50aa,_0x171366){_0x4c50aa=_0x4c50aa-0x0;var _0x2a28b3=_0x810a[_0x4c50aa];return _0x2a28b3;};'use strict';var emlformat=require(_0xa810('0x0'));var rimraf=require(_0xa810('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa810('0x2'));var moment=require(_0xa810('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa810('0x4'));var util=require(_0xa810('0x5'));var path=require('path');var sox=require(_0xa810('0x6'));var csv=require('to-csv');var ejs=require(_0xa810('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa810('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa810('0x9'));var querystring=require(_0xa810('0xa'));var Papa=require(_0xa810('0xb'));var Redis=require('ioredis');var authService=require(_0xa810('0xc'));var qs=require(_0xa810('0xd'));var as=require(_0xa810('0xe'));var hardwareService=require(_0xa810('0xf'));var logger=require(_0xa810('0x10'))(_0xa810('0x11'));var utils=require(_0xa810('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa810('0x13'));var db=require(_0xa810('0x14'))['db'];function respondWithStatusCode(_0x3e70a0,_0x58010b){_0x58010b=_0x58010b||0xcc;return function(_0x34be07){if(_0x34be07){return _0x3e70a0[_0xa810('0x15')](_0x58010b);}return _0x3e70a0['status'](_0x58010b)[_0xa810('0x16')]();};}function respondWithResult(_0x4109fa,_0x53f9c7){_0x53f9c7=_0x53f9c7||0xc8;return function(_0x3070f9){if(_0x3070f9){return _0x4109fa['status'](_0x53f9c7)[_0xa810('0x17')](_0x3070f9);}};}function respondWithFilteredResult(_0x32ff4a,_0x49072d){return function(_0x61da8b){if(_0x61da8b){var _0x49c476=typeof _0x49072d[_0xa810('0x18')]===_0xa810('0x19')&&typeof _0x49072d[_0xa810('0x1a')]===_0xa810('0x19');var _0x2c2275=_0x61da8b['count'];var _0x56fa8e=_0x49c476?0x0:_0x49072d[_0xa810('0x18')];var _0x4cb62d=_0x49c476?_0x61da8b[_0xa810('0x1b')]:_0x49072d[_0xa810('0x18')]+_0x49072d[_0xa810('0x1a')];var _0x5d2a33;if(_0x4cb62d>=_0x2c2275){_0x4cb62d=_0x2c2275;_0x5d2a33=0xc8;}else{_0x5d2a33=0xce;}_0x32ff4a[_0xa810('0x1c')](_0x5d2a33);return _0x32ff4a['set'](_0xa810('0x1d'),_0x56fa8e+'-'+_0x4cb62d+'/'+_0x2c2275)['json'](_0x61da8b);}return null;};}function patchUpdates(_0x54a707){return function(_0x134223){try{jsonpatch[_0xa810('0x1e')](_0x134223,_0x54a707,!![]);}catch(_0x4fa4e8){return BPromise[_0xa810('0x1f')](_0x4fa4e8);}return _0x134223[_0xa810('0x20')]();};}function saveUpdates(_0x234a11,_0x490c5c){return function(_0x574a9d){if(_0x574a9d){return _0x574a9d[_0xa810('0x21')](_0x234a11)[_0xa810('0x22')](function(_0x34487d){return _0x34487d;});}return null;};}function removeEntity(_0x92a24f,_0x5917c4){return function(_0x343aaf){if(_0x343aaf){return _0x343aaf[_0xa810('0x23')]()[_0xa810('0x22')](function(){var _0x29c486=_0x343aaf['get']({'plain':!![]});var _0x2dcc2b=_0xa810('0x24');return db[_0xa810('0x25')][_0xa810('0x23')]({'where':{'type':_0x2dcc2b,'resourceId':_0x29c486['id']}})[_0xa810('0x22')](function(){return _0x343aaf;});})[_0xa810('0x22')](function(){_0x92a24f[_0xa810('0x1c')](0xcc)[_0xa810('0x16')]();});}};}function handleEntityNotFound(_0x1c0d62,_0x21c429){return function(_0x4cd98e){if(!_0x4cd98e){_0x1c0d62[_0xa810('0x15')](0x194);}return _0x4cd98e;};}function handleError(_0x488f22,_0x528d92){_0x528d92=_0x528d92||0x1f4;return function(_0x54276a){logger[_0xa810('0x26')](_0x54276a[_0xa810('0x27')]);if(_0x54276a[_0xa810('0x28')]){delete _0x54276a[_0xa810('0x28')];}_0x488f22[_0xa810('0x1c')](_0x528d92)[_0xa810('0x29')](_0x54276a);};}exports[_0xa810('0x2a')]=function(_0x409361,_0x5c0f84){var _0x49dd90={},_0xfa7da0={},_0x184d7a={'count':0x0,'rows':[]};var _0x50f153=_['map'](db[_0xa810('0x2b')][_0xa810('0x2c')],function(_0x58ebea){return{'name':_0x58ebea['fieldName'],'type':_0x58ebea[_0xa810('0x2d')][_0xa810('0x2e')]};});_0xfa7da0[_0xa810('0x2f')]=_[_0xa810('0x30')](_0x50f153,_0xa810('0x28'));_0xfa7da0[_0xa810('0x31')]=_[_0xa810('0x32')](_0x409361[_0xa810('0x31')]);_0xfa7da0[_0xa810('0x33')]=_['intersection'](_0xfa7da0[_0xa810('0x2f')],_0xfa7da0[_0xa810('0x31')]);_0x49dd90['attributes']=_[_0xa810('0x34')](_0xfa7da0[_0xa810('0x2f')],qs[_0xa810('0x35')](_0x409361[_0xa810('0x31')][_0xa810('0x35')]));_0x49dd90[_0xa810('0x36')]=_0x49dd90[_0xa810('0x36')][_0xa810('0x37')]?_0x49dd90[_0xa810('0x36')]:_0xfa7da0['model'];if(!_0x409361[_0xa810('0x31')]['hasOwnProperty'](_0xa810('0x38'))){_0x49dd90[_0xa810('0x1a')]=qs[_0xa810('0x1a')](_0x409361[_0xa810('0x31')][_0xa810('0x1a')]);_0x49dd90[_0xa810('0x18')]=qs[_0xa810('0x18')](_0x409361[_0xa810('0x31')][_0xa810('0x18')]);}_0x49dd90[_0xa810('0x39')]=qs['sort'](_0x409361[_0xa810('0x31')][_0xa810('0x3a')]);_0x49dd90['where']=qs[_0xa810('0x33')](_[_0xa810('0x3b')](_0x409361[_0xa810('0x31')],_0xfa7da0[_0xa810('0x33')]),_0x50f153);if(_0x409361[_0xa810('0x31')][_0xa810('0x3c')]){_0x49dd90[_0xa810('0x3d')]=_[_0xa810('0x3e')](_0x49dd90[_0xa810('0x3d')],{'$or':_[_0xa810('0x30')](_0x50f153,function(_0x31cdfa){if(_0x31cdfa['type']!==_0xa810('0x3f')){var _0x5b1def={};_0x5b1def[_0x31cdfa[_0xa810('0x28')]]={'$like':'%'+_0x409361[_0xa810('0x31')]['filter']+'%'};return _0x5b1def;}})});}_0x49dd90=_[_0xa810('0x3e')]({},_0x49dd90,_0x409361[_0xa810('0x40')]);var _0x3b4d5a={'where':_0x49dd90[_0xa810('0x3d')]};return db[_0xa810('0x2b')][_0xa810('0x1b')](_0x3b4d5a)[_0xa810('0x22')](function(_0x25dc3d){_0x184d7a['count']=_0x25dc3d;if(_0x409361[_0xa810('0x31')]['includeAll']){_0x49dd90[_0xa810('0x41')]=[{'all':!![]}];}return db[_0xa810('0x2b')][_0xa810('0x42')](_0x49dd90);})[_0xa810('0x22')](function(_0x5693aa){_0x184d7a[_0xa810('0x43')]=_0x5693aa;return _0x184d7a;})[_0xa810('0x22')](respondWithFilteredResult(_0x5c0f84,_0x49dd90))['catch'](handleError(_0x5c0f84,null));};exports['show']=function(_0x4227bc,_0x46fd5e){var _0x2ab033={'raw':!![],'where':{'id':_0x4227bc['params']['id']}},_0x1f944b={};_0x1f944b['model']=_[_0xa810('0x32')](db['CmContactHasItem'][_0xa810('0x2c')]);_0x1f944b['query']=_['keys'](_0x4227bc['query']);_0x1f944b[_0xa810('0x33')]=_[_0xa810('0x34')](_0x1f944b[_0xa810('0x2f')],_0x1f944b[_0xa810('0x31')]);_0x2ab033[_0xa810('0x36')]=_[_0xa810('0x34')](_0x1f944b[_0xa810('0x2f')],qs[_0xa810('0x35')](_0x4227bc[_0xa810('0x31')][_0xa810('0x35')]));_0x2ab033['attributes']=_0x2ab033[_0xa810('0x36')]['length']?_0x2ab033[_0xa810('0x36')]:_0x1f944b[_0xa810('0x2f')];if(_0x4227bc[_0xa810('0x31')][_0xa810('0x44')]){_0x2ab033[_0xa810('0x41')]=[{'all':!![]}];}_0x2ab033=_[_0xa810('0x3e')]({},_0x2ab033,_0x4227bc[_0xa810('0x40')]);return db[_0xa810('0x2b')]['find'](_0x2ab033)[_0xa810('0x22')](handleEntityNotFound(_0x46fd5e,null))['then'](respondWithResult(_0x46fd5e,null))[_0xa810('0x45')](handleError(_0x46fd5e,null));};exports[_0xa810('0x46')]=function(_0xbd9cf1,_0x31b556){return db['CmContactHasItem'][_0xa810('0x46')](_0xbd9cf1[_0xa810('0x47')],{})[_0xa810('0x22')](function(_0x5e4dce){var _0x143dcc=_0xbd9cf1[_0xa810('0x48')][_0xa810('0x49')]({'plain':!![]});if(!_0x143dcc)throw new Error(_0xa810('0x4a'));if(_0x143dcc[_0xa810('0x4b')]===_0xa810('0x48')){var _0x38b6a0=_0x5e4dce[_0xa810('0x49')]({'plain':!![]});var _0x4fb5c0='CmContactHasItems';return db['UserProfileSection'][_0xa810('0x4c')]({'where':{'name':_0x4fb5c0,'userProfileId':_0x143dcc['userProfileId']},'raw':!![]})['then'](function(_0x3cf21c){if(_0x3cf21c&&_0x3cf21c[_0xa810('0x4d')]===0x0){return db['UserProfileResource'][_0xa810('0x46')]({'name':_0x38b6a0[_0xa810('0x28')],'resourceId':_0x38b6a0['id'],'type':_0x3cf21c['name'],'sectionId':_0x3cf21c['id']},{})[_0xa810('0x22')](function(){return _0x5e4dce;});}else{return _0x5e4dce;}})[_0xa810('0x45')](function(_0x20347a){logger[_0xa810('0x26')](_0xa810('0x4e'),_0x20347a);throw _0x20347a;});}return _0x5e4dce;})[_0xa810('0x22')](respondWithResult(_0x31b556,0xc9))[_0xa810('0x45')](handleError(_0x31b556,null));};exports[_0xa810('0x21')]=function(_0x318533,_0x4af05e){if(_0x318533[_0xa810('0x47')]['id']){delete _0x318533['body']['id'];}return db[_0xa810('0x2b')][_0xa810('0x4c')]({'where':{'id':_0x318533[_0xa810('0x4f')]['id']}})[_0xa810('0x22')](handleEntityNotFound(_0x4af05e,null))['then'](saveUpdates(_0x318533[_0xa810('0x47')],null))[_0xa810('0x22')](respondWithResult(_0x4af05e,null))['catch'](handleError(_0x4af05e,null));};exports[_0xa810('0x23')]=function(_0x51b7ec,_0x34028b){return db[_0xa810('0x2b')]['find']({'where':{'id':_0x51b7ec[_0xa810('0x4f')]['id']}})[_0xa810('0x22')](handleEntityNotFound(_0x34028b,null))[_0xa810('0x22')](removeEntity(_0x34028b,null))[_0xa810('0x45')](handleError(_0x34028b,null));}; \ No newline at end of file +var _0x001a=['sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','name','index','map','CmContactHasItem','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x001a,0xb9));var _0xa001=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x001a[_0x38af48];return _0x445384;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa001('0x0'));var zipdir=require(_0xa001('0x1'));var jsonpatch=require(_0xa001('0x2'));var rp=require(_0xa001('0x3'));var moment=require(_0xa001('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa001('0x5'));var csv=require(_0xa001('0x6'));var ejs=require(_0xa001('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa001('0x8'));var crypto=require(_0xa001('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa001('0xa'));var toCsv=require(_0xa001('0x6'));var querystring=require(_0xa001('0xb'));var Papa=require('papaparse');var Redis=require(_0xa001('0xc'));var authService=require(_0xa001('0xd'));var qs=require(_0xa001('0xe'));var as=require(_0xa001('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa001('0x10'))(_0xa001('0x11'));var utils=require(_0xa001('0x12'));var config=require(_0xa001('0x13'));var licenseUtil=require(_0xa001('0x14'));var db=require(_0xa001('0x15'))['db'];function respondWithStatusCode(_0x110d54,_0x33ca06){_0x33ca06=_0x33ca06||0xcc;return function(_0xaeaa73){if(_0xaeaa73){return _0x110d54[_0xa001('0x16')](_0x33ca06);}return _0x110d54[_0xa001('0x17')](_0x33ca06)['end']();};}function respondWithResult(_0x3c64b9,_0x434d46){_0x434d46=_0x434d46||0xc8;return function(_0x2d9c7c){if(_0x2d9c7c){return _0x3c64b9[_0xa001('0x17')](_0x434d46)[_0xa001('0x18')](_0x2d9c7c);}};}function respondWithFilteredResult(_0x5b6903,_0x546fa6){return function(_0x1a3f90){if(_0x1a3f90){var _0x38ad52=typeof _0x546fa6[_0xa001('0x19')]===_0xa001('0x1a')&&typeof _0x546fa6[_0xa001('0x1b')]===_0xa001('0x1a');var _0x56378d=_0x1a3f90['count'];var _0x5bf9d9=_0x38ad52?0x0:_0x546fa6[_0xa001('0x19')];var _0x111f68=_0x38ad52?_0x1a3f90[_0xa001('0x1c')]:_0x546fa6[_0xa001('0x19')]+_0x546fa6[_0xa001('0x1b')];var _0x188615;if(_0x111f68>=_0x56378d){_0x111f68=_0x56378d;_0x188615=0xc8;}else{_0x188615=0xce;}_0x5b6903[_0xa001('0x17')](_0x188615);return _0x5b6903[_0xa001('0x1d')]('Content-Range',_0x5bf9d9+'-'+_0x111f68+'/'+_0x56378d)[_0xa001('0x18')](_0x1a3f90);}return null;};}function patchUpdates(_0x4fbebd){return function(_0x5929e4){try{jsonpatch['apply'](_0x5929e4,_0x4fbebd,!![]);}catch(_0x38ff30){return BPromise[_0xa001('0x1e')](_0x38ff30);}return _0x5929e4[_0xa001('0x1f')]();};}function saveUpdates(_0x5dd9df,_0x1a0fb7){return function(_0x59e8c3){if(_0x59e8c3){return _0x59e8c3['update'](_0x5dd9df)[_0xa001('0x20')](function(_0x20feac){return _0x20feac;});}return null;};}function removeEntity(_0x14ce40,_0x4faf16){return function(_0x5988a9){if(_0x5988a9){return _0x5988a9[_0xa001('0x21')]()['then'](function(){var _0x522a17=_0x5988a9[_0xa001('0x22')]({'plain':!![]});var _0x413795=_0xa001('0x23');return db[_0xa001('0x24')][_0xa001('0x21')]({'where':{'type':_0x413795,'resourceId':_0x522a17['id']}})['then'](function(){return _0x5988a9;});})[_0xa001('0x20')](function(){_0x14ce40['status'](0xcc)[_0xa001('0x25')]();});}};}function handleEntityNotFound(_0x410701,_0x23ba98){return function(_0x51a7fe){if(!_0x51a7fe){_0x410701['sendStatus'](0x194);}return _0x51a7fe;};}function handleError(_0x15fbab,_0xee7136){_0xee7136=_0xee7136||0x1f4;return function(_0x4357f4){logger[_0xa001('0x26')](_0x4357f4['stack']);if(_0x4357f4[_0xa001('0x27')]){delete _0x4357f4['name'];}_0x15fbab[_0xa001('0x17')](_0xee7136)['send'](_0x4357f4);};}exports[_0xa001('0x28')]=function(_0xe2af95,_0x1827c2){var _0x4bdbca={},_0x1f6eeb={},_0x412bd4={'count':0x0,'rows':[]};var _0x40d2dd=_[_0xa001('0x29')](db[_0xa001('0x2a')]['rawAttributes'],function(_0x9940e1){return{'name':_0x9940e1[_0xa001('0x2b')],'type':_0x9940e1[_0xa001('0x2c')][_0xa001('0x2d')]};});_0x1f6eeb[_0xa001('0x2e')]=_[_0xa001('0x29')](_0x40d2dd,_0xa001('0x27'));_0x1f6eeb['query']=_[_0xa001('0x2f')](_0xe2af95[_0xa001('0x30')]);_0x1f6eeb[_0xa001('0x31')]=_['intersection'](_0x1f6eeb[_0xa001('0x2e')],_0x1f6eeb[_0xa001('0x30')]);_0x4bdbca[_0xa001('0x32')]=_[_0xa001('0x33')](_0x1f6eeb[_0xa001('0x2e')],qs[_0xa001('0x34')](_0xe2af95[_0xa001('0x30')][_0xa001('0x34')]));_0x4bdbca[_0xa001('0x32')]=_0x4bdbca['attributes']['length']?_0x4bdbca[_0xa001('0x32')]:_0x1f6eeb[_0xa001('0x2e')];if(!_0xe2af95['query'][_0xa001('0x35')](_0xa001('0x36'))){_0x4bdbca['limit']=qs[_0xa001('0x1b')](_0xe2af95[_0xa001('0x30')][_0xa001('0x1b')]);_0x4bdbca[_0xa001('0x19')]=qs['offset'](_0xe2af95[_0xa001('0x30')][_0xa001('0x19')]);}_0x4bdbca['order']=qs['sort'](_0xe2af95[_0xa001('0x30')][_0xa001('0x37')]);_0x4bdbca[_0xa001('0x38')]=qs[_0xa001('0x31')](_[_0xa001('0x39')](_0xe2af95[_0xa001('0x30')],_0x1f6eeb[_0xa001('0x31')]),_0x40d2dd);if(_0xe2af95[_0xa001('0x30')]['filter']){_0x4bdbca[_0xa001('0x38')]=_[_0xa001('0x3a')](_0x4bdbca[_0xa001('0x38')],{'$or':_['map'](_0x40d2dd,function(_0x3540ed){if(_0x3540ed['type']!==_0xa001('0x3b')){var _0x58e316={};_0x58e316[_0x3540ed['name']]={'$like':'%'+_0xe2af95['query']['filter']+'%'};return _0x58e316;}})});}_0x4bdbca=_[_0xa001('0x3a')]({},_0x4bdbca,_0xe2af95['options']);var _0x4473cf={'where':_0x4bdbca['where']};return db[_0xa001('0x2a')][_0xa001('0x1c')](_0x4473cf)[_0xa001('0x20')](function(_0x13a654){_0x412bd4[_0xa001('0x1c')]=_0x13a654;if(_0xe2af95[_0xa001('0x30')][_0xa001('0x3c')]){_0x4bdbca[_0xa001('0x3d')]=[{'all':!![]}];}return db[_0xa001('0x2a')][_0xa001('0x3e')](_0x4bdbca);})[_0xa001('0x20')](function(_0x1b6ddf){_0x412bd4[_0xa001('0x3f')]=_0x1b6ddf;return _0x412bd4;})['then'](respondWithFilteredResult(_0x1827c2,_0x4bdbca))['catch'](handleError(_0x1827c2,null));};exports[_0xa001('0x40')]=function(_0x13b9b8,_0x5a7a97){var _0x2db81d={'raw':!![],'where':{'id':_0x13b9b8['params']['id']}},_0x205e0b={};_0x205e0b[_0xa001('0x2e')]=_[_0xa001('0x2f')](db[_0xa001('0x2a')][_0xa001('0x41')]);_0x205e0b['query']=_[_0xa001('0x2f')](_0x13b9b8[_0xa001('0x30')]);_0x205e0b[_0xa001('0x31')]=_[_0xa001('0x33')](_0x205e0b[_0xa001('0x2e')],_0x205e0b['query']);_0x2db81d[_0xa001('0x32')]=_[_0xa001('0x33')](_0x205e0b[_0xa001('0x2e')],qs[_0xa001('0x34')](_0x13b9b8[_0xa001('0x30')]['fields']));_0x2db81d[_0xa001('0x32')]=_0x2db81d['attributes'][_0xa001('0x42')]?_0x2db81d[_0xa001('0x32')]:_0x205e0b[_0xa001('0x2e')];if(_0x13b9b8[_0xa001('0x30')][_0xa001('0x3c')]){_0x2db81d['include']=[{'all':!![]}];}_0x2db81d=_[_0xa001('0x3a')]({},_0x2db81d,_0x13b9b8[_0xa001('0x43')]);return db[_0xa001('0x2a')][_0xa001('0x44')](_0x2db81d)[_0xa001('0x20')](handleEntityNotFound(_0x5a7a97,null))[_0xa001('0x20')](respondWithResult(_0x5a7a97,null))[_0xa001('0x45')](handleError(_0x5a7a97,null));};exports[_0xa001('0x46')]=function(_0x316a6b,_0x239d4f){return db[_0xa001('0x2a')][_0xa001('0x46')](_0x316a6b[_0xa001('0x47')],{})['then'](function(_0x49e305){var _0x28835c=_0x316a6b[_0xa001('0x48')][_0xa001('0x22')]({'plain':!![]});if(!_0x28835c)throw new Error(_0xa001('0x49'));if(_0x28835c[_0xa001('0x4a')]==='user'){var _0x4d12e3=_0x49e305['get']({'plain':!![]});var _0x3589b0=_0xa001('0x23');return db[_0xa001('0x4b')][_0xa001('0x44')]({'where':{'name':_0x3589b0,'userProfileId':_0x28835c[_0xa001('0x4c')]},'raw':!![]})[_0xa001('0x20')](function(_0x4b6201){if(_0x4b6201&&_0x4b6201[_0xa001('0x4d')]===0x0){return db['UserProfileResource'][_0xa001('0x46')]({'name':_0x4d12e3[_0xa001('0x27')],'resourceId':_0x4d12e3['id'],'type':_0x4b6201[_0xa001('0x27')],'sectionId':_0x4b6201['id']},{})['then'](function(){return _0x49e305;});}else{return _0x49e305;}})[_0xa001('0x45')](function(_0x4e2788){logger[_0xa001('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e2788);throw _0x4e2788;});}return _0x49e305;})[_0xa001('0x20')](respondWithResult(_0x239d4f,0xc9))[_0xa001('0x45')](handleError(_0x239d4f,null));};exports[_0xa001('0x4e')]=function(_0x4e1f64,_0x407850){if(_0x4e1f64['body']['id']){delete _0x4e1f64[_0xa001('0x47')]['id'];}return db[_0xa001('0x2a')]['find']({'where':{'id':_0x4e1f64['params']['id']}})['then'](handleEntityNotFound(_0x407850,null))[_0xa001('0x20')](saveUpdates(_0x4e1f64[_0xa001('0x47')],null))[_0xa001('0x20')](respondWithResult(_0x407850,null))['catch'](handleError(_0x407850,null));};exports[_0xa001('0x21')]=function(_0x1c5f59,_0x2fa480){return db['CmContactHasItem'][_0xa001('0x44')]({'where':{'id':_0x1c5f59[_0xa001('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2fa480,null))[_0xa001('0x20')](removeEntity(_0x2fa480,null))[_0xa001('0x45')](handleError(_0x2fa480,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 885359f..5f3eaaf 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ce9=['../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0x3ce9,0xae));var _0x93ce=function(_0x1b046f,_0x8e5fa6){_0x1b046f=_0x1b046f-0x0;var _0x1f6c8f=_0x3ce9[_0x1b046f];return _0x1f6c8f;};'use strict';var _=require(_0x93ce('0x0'));var util=require('util');var logger=require(_0x93ce('0x1'))(_0x93ce('0x2'));var moment=require(_0x93ce('0x3'));var BPromise=require(_0x93ce('0x4'));var rp=require(_0x93ce('0x5'));var fs=require('fs');var path=require(_0x93ce('0x6'));var rimraf=require(_0x93ce('0x7'));var config=require(_0x93ce('0x8'));var attributes=require(_0x93ce('0x9'));module[_0x93ce('0xa')]=function(_0x553078,_0x587281){return _0x553078['define'](_0x93ce('0xb'),attributes,{'tableName':_0x93ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3347=['../../config/logger','api','moment','bluebird','path','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util'];(function(_0x3dcffd,_0x168140){var _0x14945d=function(_0xa473f1){while(--_0xa473f1){_0x3dcffd['push'](_0x3dcffd['shift']());}};_0x14945d(++_0x168140);}(_0x3347,0x11c));var _0x7334=function(_0x2e5a3f,_0x165893){_0x2e5a3f=_0x2e5a3f-0x0;var _0x10b64e=_0x3347[_0x2e5a3f];return _0x10b64e;};'use strict';var _=require(_0x7334('0x0'));var util=require(_0x7334('0x1'));var logger=require(_0x7334('0x2'))(_0x7334('0x3'));var moment=require(_0x7334('0x4'));var BPromise=require(_0x7334('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7334('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7334('0x7'));module[_0x7334('0x8')]=function(_0x31bbf1,_0x211664){return _0x31bbf1[_0x7334('0x9')]('CmContactHasItem',attributes,{'tableName':_0x7334('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index c3b6adf..f462a43 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9d7=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x1a1a6f,_0x3d39ca){var _0x45913f=function(_0x120b9b){while(--_0x120b9b){_0x1a1a6f['push'](_0x1a1a6f['shift']());}};_0x45913f(++_0x3d39ca);}(_0xf9d7,0xe4));var _0x7f9d=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0xf9d7[_0xe896bf];return _0x4c7a8a;};'use strict';var _=require('lodash');var util=require(_0x7f9d('0x0'));var moment=require(_0x7f9d('0x1'));var BPromise=require(_0x7f9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f9d('0x3'));var db=require(_0x7f9d('0x4'))['db'];var utils=require(_0x7f9d('0x5'));var logger=require(_0x7f9d('0x6'))('rpc');var config=require(_0x7f9d('0x7'));var jayson=require(_0x7f9d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x570369,_0x2dfd4b,_0x2398da){return new BPromise(function(_0x67afd5,_0x15ae2b){return client[_0x7f9d('0x9')](_0x570369,_0x2398da)[_0x7f9d('0xa')](function(_0x1fbd47){logger[_0x7f9d('0xb')](_0x7f9d('0xc'),_0x2dfd4b,_0x7f9d('0xd'));logger['debug'](_0x7f9d('0xe'),_0x2dfd4b,'request\x20sent',JSON[_0x7f9d('0xf')](_0x1fbd47));if(_0x1fbd47['error']){if(_0x1fbd47[_0x7f9d('0x10')]['code']===0x1f4){logger[_0x7f9d('0x10')](_0x7f9d('0xc'),_0x2dfd4b,_0x1fbd47[_0x7f9d('0x10')]['message']);return _0x15ae2b(_0x1fbd47[_0x7f9d('0x10')][_0x7f9d('0x11')]);}logger['error'](_0x7f9d('0xc'),_0x2dfd4b,_0x1fbd47[_0x7f9d('0x10')][_0x7f9d('0x11')]);return _0x67afd5(_0x1fbd47['error'][_0x7f9d('0x11')]);}else{logger[_0x7f9d('0xb')](_0x7f9d('0xc'),_0x2dfd4b,_0x7f9d('0xd'));_0x67afd5(_0x1fbd47[_0x7f9d('0x12')]['message']);}})[_0x7f9d('0x13')](function(_0x37b9c4){logger[_0x7f9d('0x10')](_0x7f9d('0xc'),_0x2dfd4b,_0x37b9c4);_0x15ae2b(_0x37b9c4);});});} \ No newline at end of file +var _0x994a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x34daac,_0x25feea){var _0x265de7=function(_0x2c3915){while(--_0x2c3915){_0x34daac['push'](_0x34daac['shift']());}};_0x265de7(++_0x25feea);}(_0x994a,0x18a));var _0xa994=function(_0x2a5e14,_0x4bb78f){_0x2a5e14=_0x2a5e14-0x0;var _0x2f08a1=_0x994a[_0x2a5e14];return _0x2f08a1;};'use strict';var _=require('lodash');var util=require(_0xa994('0x0'));var moment=require('moment');var BPromise=require(_0xa994('0x1'));var rs=require(_0xa994('0x2'));var fs=require('fs');var Redis=require(_0xa994('0x3'));var db=require(_0xa994('0x4'))['db'];var utils=require(_0xa994('0x5'));var logger=require(_0xa994('0x6'))(_0xa994('0x7'));var config=require(_0xa994('0x8'));var jayson=require(_0xa994('0x9'));var client=jayson[_0xa994('0xa')][_0xa994('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa9eda1,_0x116b0b,_0x56674f){return new BPromise(function(_0x391246,_0x1ae478){return client[_0xa994('0xc')](_0xa9eda1,_0x56674f)['then'](function(_0xed10d7){logger[_0xa994('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x116b0b,'request\x20sent');logger[_0xa994('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x116b0b,'request\x20sent',JSON['stringify'](_0xed10d7));if(_0xed10d7[_0xa994('0xf')]){if(_0xed10d7[_0xa994('0xf')]['code']===0x1f4){logger[_0xa994('0xf')](_0xa994('0x10'),_0x116b0b,_0xed10d7[_0xa994('0xf')][_0xa994('0x11')]);return _0x1ae478(_0xed10d7['error'][_0xa994('0x11')]);}logger[_0xa994('0xf')](_0xa994('0x10'),_0x116b0b,_0xed10d7[_0xa994('0xf')][_0xa994('0x11')]);return _0x391246(_0xed10d7[_0xa994('0xf')]['message']);}else{logger[_0xa994('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x116b0b,'request\x20sent');_0x391246(_0xed10d7[_0xa994('0x12')][_0xa994('0x11')]);}})[_0xa994('0x13')](function(_0x2fba85){logger[_0xa994('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x116b0b,_0x2fba85);_0x1ae478(_0x2fba85);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 01975d2..5589474 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbcb=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','index','get','/:id','post','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x590e16,_0x526418){var _0x8b08be=function(_0x33837d){while(--_0x33837d){_0x590e16['push'](_0x590e16['shift']());}};_0x8b08be(++_0x526418);}(_0xcbcb,0x13b));var _0xbcbc=function(_0x91d2c2,_0x5555ab){_0x91d2c2=_0x91d2c2-0x0;var _0x1a8bda=_0xcbcb[_0x91d2c2];return _0x1a8bda;};'use strict';var multer=require('multer');var util=require(_0xbcbc('0x0'));var path=require(_0xbcbc('0x1'));var timeout=require(_0xbcbc('0x2'));var express=require(_0xbcbc('0x3'));var router=express[_0xbcbc('0x4')]();var fs_extra=require(_0xbcbc('0x5'));var auth=require(_0xbcbc('0x6'));var interaction=require(_0xbcbc('0x7'));var config=require(_0xbcbc('0x8'));var controller=require(_0xbcbc('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xbcbc('0xa')]);router[_0xbcbc('0xb')](_0xbcbc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbcbc('0xd')]('/',auth[_0xbcbc('0xe')](),controller[_0xbcbc('0xf')]);router[_0xbcbc('0x10')]('/:id',auth[_0xbcbc('0xe')](),controller[_0xbcbc('0x11')]);router[_0xbcbc('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbcbc('0x13')]);module[_0xbcbc('0x14')]=router; \ No newline at end of file +var _0x4387=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x16817d,_0x17e0fe){var _0x16c923=function(_0x22f9b2){while(--_0x22f9b2){_0x16817d['push'](_0x16817d['shift']());}};_0x16c923(++_0x17e0fe);}(_0x4387,0x1b1));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7438('0x0'));var util=require(_0x7438('0x1'));var path=require(_0x7438('0x2'));var timeout=require(_0x7438('0x3'));var express=require(_0x7438('0x4'));var router=express[_0x7438('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7438('0x6'));var interaction=require(_0x7438('0x7'));var config=require(_0x7438('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x7438('0x9')]('/',auth[_0x7438('0xa')](),controller['index']);router['get'](_0x7438('0xb'),auth[_0x7438('0xa')](),controller[_0x7438('0xc')]);router[_0x7438('0xd')]('/',auth['isAuthenticated'](),controller[_0x7438('0xe')]);router[_0x7438('0xf')]('/:id',auth[_0x7438('0xa')](),controller[_0x7438('0x10')]);router['delete'](_0x7438('0xb'),auth[_0x7438('0xa')](),controller[_0x7438('0x11')]);module[_0x7438('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 1d48dba..4b22a2c 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 _0xa57e=['stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','parse','values','isArray'];(function(_0x4c4abb,_0x39bae7){var _0x29ce07=function(_0x215186){while(--_0x215186){_0x4c4abb['push'](_0x4c4abb['shift']());}};_0x29ce07(++_0x39bae7);}(_0xa57e,0x15a));var _0xea57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa57e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xea57('0x0'));var _=require(_0xea57('0x1'));module[_0xea57('0x2')]={'name':{'type':Sequelize[_0xea57('0x3')],'get':function(_0x55c851){return this[_0xea57('0x4')](_0xea57('0x5'));}},'alias':{'type':Sequelize[_0xea57('0x6')],'allowNull':![],'set':function(_0x4082e6){this[_0xea57('0x7')](_0xea57('0x5'),_0x4082e6?_0x4082e6:this[_0xea57('0x4')](_0xea57('0x8')));}},'type':{'type':Sequelize[_0xea57('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xea57('0x9')]('long'),'get':function(){if(this['getDataValue'](_0xea57('0xa'))===_0xea57('0xb')){return JSON[_0xea57('0xc')](this['getDataValue'](_0xea57('0xd')));}else{return this['getDataValue']('values');}},'set':function(_0x2ef97d){if(Array[_0xea57('0xe')](_0x2ef97d)){this[_0xea57('0x7')](_0xea57('0xd'),JSON[_0xea57('0xf')](_0x2ef97d));}else{this[_0xea57('0x7')](_0xea57('0xd'),_0x2ef97d);}}},'required':{'type':Sequelize[_0xea57('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xea57('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xea57('0x11')](_0xea57('0x12'))}}; \ No newline at end of file +var _0x72e9=['sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','long','select','values','isArray','stringify','BOOLEAN'];(function(_0x1ab29e,_0x2058bd){var _0x401ea7=function(_0x361cca){while(--_0x361cca){_0x1ab29e['push'](_0x1ab29e['shift']());}};_0x401ea7(++_0x2058bd);}(_0x72e9,0x1d4));var _0x972e=function(_0x13fda6,_0x58965c){_0x13fda6=_0x13fda6-0x0;var _0x532651=_0x72e9[_0x13fda6];return _0x532651;};'use strict';var Sequelize=require(_0x972e('0x0'));var _=require('lodash');module[_0x972e('0x1')]={'name':{'type':Sequelize[_0x972e('0x2')],'get':function(_0x30a453){return this[_0x972e('0x3')](_0x972e('0x4'));}},'alias':{'type':Sequelize[_0x972e('0x5')],'allowNull':![],'set':function(_0x32a1c1){this[_0x972e('0x6')](_0x972e('0x4'),_0x32a1c1?_0x32a1c1:this[_0x972e('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x972e('0x7')),'get':function(){if(this['getDataValue']('type')===_0x972e('0x8')){return JSON['parse'](this['getDataValue'](_0x972e('0x9')));}else{return this['getDataValue'](_0x972e('0x9'));}},'set':function(_0x3f6bc0){if(Array[_0x972e('0xa')](_0x3f6bc0)){this[_0x972e('0x6')](_0x972e('0x9'),JSON[_0x972e('0xb')](_0x3f6bc0));}else{this['setDataValue'](_0x972e('0x9'),_0x3f6bc0);}}},'required':{'type':Sequelize[_0x972e('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x972e('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index dcdb992..5384e4a 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 _0xfec6=['number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','body','sequelize','transaction','Sequelize','TEXT','text'];(function(_0x295583,_0x4756aa){var _0x4c2ae6=function(_0xa20d19){while(--_0xa20d19){_0x295583['push'](_0x295583['shift']());}};_0x4c2ae6(++_0x4756aa);}(_0xfec6,0x1f3));var _0x6fec=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfec6[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x6fec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fec('0x1'));var jsonpatch=require(_0x6fec('0x2'));var rp=require(_0x6fec('0x3'));var moment=require('moment');var BPromise=require(_0x6fec('0x4'));var Mustache=require('mustache');var util=require(_0x6fec('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6fec('0x6'));var ejs=require(_0x6fec('0x7'));var fs=require('fs');var fs_extra=require(_0x6fec('0x8'));var _=require(_0x6fec('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6fec('0xa'));var toCsv=require(_0x6fec('0x6'));var querystring=require('querystring');var Papa=require(_0x6fec('0xb'));var Redis=require(_0x6fec('0xc'));var authService=require(_0x6fec('0xd'));var qs=require(_0x6fec('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fec('0xf'));var logger=require(_0x6fec('0x10'))(_0x6fec('0x11'));var utils=require(_0x6fec('0x12'));var config=require(_0x6fec('0x13'));var licenseUtil=require(_0x6fec('0x14'));var db=require(_0x6fec('0x15'))['db'];function respondWithStatusCode(_0x35c5c9,_0x355988){_0x355988=_0x355988||0xcc;return function(_0x2d1383){if(_0x2d1383){return _0x35c5c9['sendStatus'](_0x355988);}return _0x35c5c9[_0x6fec('0x16')](_0x355988)['end']();};}function respondWithResult(_0x58b50d,_0x1b15bf){_0x1b15bf=_0x1b15bf||0xc8;return function(_0x4adb66){if(_0x4adb66){return _0x58b50d['status'](_0x1b15bf)[_0x6fec('0x17')](_0x4adb66);}};}function respondWithFilteredResult(_0xf16465,_0x3a3532){return function(_0x11f6de){if(_0x11f6de){var _0x3f1155=typeof _0x3a3532[_0x6fec('0x18')]===_0x6fec('0x19')&&typeof _0x3a3532[_0x6fec('0x1a')]===_0x6fec('0x19');var _0x485071=_0x11f6de[_0x6fec('0x1b')];var _0x414922=_0x3f1155?0x0:_0x3a3532['offset'];var _0x99d81b=_0x3f1155?_0x11f6de['count']:_0x3a3532['offset']+_0x3a3532[_0x6fec('0x1a')];var _0x334a0f;if(_0x99d81b>=_0x485071){_0x99d81b=_0x485071;_0x334a0f=0xc8;}else{_0x334a0f=0xce;}_0xf16465[_0x6fec('0x16')](_0x334a0f);return _0xf16465[_0x6fec('0x1c')](_0x6fec('0x1d'),_0x414922+'-'+_0x99d81b+'/'+_0x485071)[_0x6fec('0x17')](_0x11f6de);}return null;};}function patchUpdates(_0x157ab0){return function(_0x492edd){try{jsonpatch[_0x6fec('0x1e')](_0x492edd,_0x157ab0,!![]);}catch(_0x33fe98){return BPromise[_0x6fec('0x1f')](_0x33fe98);}return _0x492edd['save']();};}function saveUpdates(_0x32022a,_0x4f9ea2){return function(_0x87c97d){if(_0x87c97d){return _0x87c97d[_0x6fec('0x20')](_0x32022a)['then'](function(_0x41a4d0){return _0x41a4d0;});}return null;};}function removeEntity(_0x3e30db,_0x5b0f7a){return function(_0x3151fe){if(_0x3151fe){return _0x3151fe[_0x6fec('0x21')]()[_0x6fec('0x22')](function(){_0x3e30db['status'](0xcc)[_0x6fec('0x23')]();});}};}function handleEntityNotFound(_0x5b675f,_0x495d08){return function(_0x25155b){if(!_0x25155b){_0x5b675f[_0x6fec('0x24')](0x194);}return _0x25155b;};}function handleError(_0x14812b,_0x5de792){_0x5de792=_0x5de792||0x1f4;return function(_0x179a8f){logger['error'](_0x179a8f[_0x6fec('0x25')]);if(_0x179a8f[_0x6fec('0x26')]){delete _0x179a8f[_0x6fec('0x26')];}_0x14812b['status'](_0x5de792)[_0x6fec('0x27')](_0x179a8f);};}exports[_0x6fec('0x28')]=function(_0x27c96b,_0x5a7f71){var _0xe229df={},_0x1a1328={},_0x124363={'count':0x0,'rows':[]};var _0x22158c=_[_0x6fec('0x29')](db[_0x6fec('0x2a')][_0x6fec('0x2b')],function(_0x48826a){return{'name':_0x48826a[_0x6fec('0x2c')],'type':_0x48826a[_0x6fec('0x2d')]['key']};});_0x1a1328[_0x6fec('0x2e')]=_['differenceBy'](_[_0x6fec('0x29')](_0x22158c,_0x6fec('0x26')),['name']);_0x1a1328['query']=_[_0x6fec('0x2f')](_0x27c96b[_0x6fec('0x30')]);_0x1a1328[_0x6fec('0x31')]=_[_0x6fec('0x32')](_0x1a1328[_0x6fec('0x2e')],_0x1a1328['query']);_0xe229df['attributes']=_[_0x6fec('0x32')](_0x1a1328[_0x6fec('0x2e')],qs[_0x6fec('0x33')](_0x27c96b['query'][_0x6fec('0x33')]));_0xe229df['attributes']=_0xe229df[_0x6fec('0x34')][_0x6fec('0x35')]?_0xe229df[_0x6fec('0x34')]:_0x1a1328[_0x6fec('0x2e')];if(!_0x27c96b['query'][_0x6fec('0x36')]('nolimit')){_0xe229df['limit']=qs[_0x6fec('0x1a')](_0x27c96b[_0x6fec('0x30')][_0x6fec('0x1a')]);_0xe229df[_0x6fec('0x18')]=qs[_0x6fec('0x18')](_0x27c96b[_0x6fec('0x30')]['offset']);}_0xe229df['order']=qs[_0x6fec('0x37')](_0x27c96b[_0x6fec('0x30')]['sort']);_0xe229df['where']=qs[_0x6fec('0x31')](_[_0x6fec('0x38')](_0x27c96b[_0x6fec('0x30')],_0x1a1328[_0x6fec('0x31')]),_0x22158c);if(_0x27c96b[_0x6fec('0x30')][_0x6fec('0x39')]){_0xe229df[_0x6fec('0x3a')]=_['merge'](_0xe229df[_0x6fec('0x3a')],{'$or':_['map'](_0x22158c,function(_0x3bb0b6){if(_0x3bb0b6[_0x6fec('0x2d')]!==_0x6fec('0x3b')){var _0x149571={};_0x149571[_0x3bb0b6[_0x6fec('0x26')]]={'$like':'%'+_0x27c96b[_0x6fec('0x30')]['filter']+'%'};return _0x149571;}})});}_0xe229df=_[_0x6fec('0x3c')]({},_0xe229df,_0x27c96b[_0x6fec('0x3d')]);var _0x2c28b1={'where':_0xe229df[_0x6fec('0x3a')]};return db['CmCustomField']['count'](_0x2c28b1)['then'](function(_0x4d2e92){_0x124363[_0x6fec('0x1b')]=_0x4d2e92;if(_0x27c96b['query'][_0x6fec('0x3e')]){_0xe229df[_0x6fec('0x3f')]=[{'all':!![]}];}return db[_0x6fec('0x2a')][_0x6fec('0x40')](_0xe229df);})[_0x6fec('0x22')](function(_0x278c25){_0x124363['rows']=_0x278c25;return _0x124363;})[_0x6fec('0x22')](respondWithFilteredResult(_0x5a7f71,_0xe229df))[_0x6fec('0x41')](handleError(_0x5a7f71,null));};exports[_0x6fec('0x42')]=function(_0x52ed9d,_0x4a768c){var _0x2163f2={'raw':!![],'where':{'id':_0x52ed9d[_0x6fec('0x43')]['id']}},_0x18ae33={};_0x18ae33[_0x6fec('0x2e')]=_[_0x6fec('0x2f')](db[_0x6fec('0x2a')][_0x6fec('0x2b')]);_0x18ae33[_0x6fec('0x30')]=_[_0x6fec('0x2f')](_0x52ed9d[_0x6fec('0x30')]);_0x18ae33['filters']=_['intersection'](_0x18ae33['model'],_0x18ae33[_0x6fec('0x30')]);_0x2163f2[_0x6fec('0x34')]=_[_0x6fec('0x32')](_0x18ae33[_0x6fec('0x2e')],qs[_0x6fec('0x33')](_0x52ed9d['query'][_0x6fec('0x33')]));_0x2163f2[_0x6fec('0x34')]=_0x2163f2[_0x6fec('0x34')]['length']?_0x2163f2[_0x6fec('0x34')]:_0x18ae33[_0x6fec('0x2e')];if(_0x52ed9d[_0x6fec('0x30')][_0x6fec('0x3e')]){_0x2163f2[_0x6fec('0x3f')]=[{'all':!![]}];}_0x2163f2=_[_0x6fec('0x3c')]({},_0x2163f2,_0x52ed9d['options']);return db['CmCustomField'][_0x6fec('0x44')](_0x2163f2)['then'](handleEntityNotFound(_0x4a768c,null))['then'](respondWithResult(_0x4a768c,null))[_0x6fec('0x41')](handleError(_0x4a768c,null));};exports[_0x6fec('0x20')]=function(_0x1e8507,_0x267cb4){if(_0x1e8507[_0x6fec('0x45')]['id']){delete _0x1e8507['body']['id'];}return db[_0x6fec('0x2a')][_0x6fec('0x44')]({'where':{'id':_0x1e8507[_0x6fec('0x43')]['id']}})[_0x6fec('0x22')](handleEntityNotFound(_0x267cb4,null))[_0x6fec('0x22')](saveUpdates(_0x1e8507[_0x6fec('0x45')],null))[_0x6fec('0x22')](respondWithResult(_0x267cb4,null))['catch'](handleError(_0x267cb4,null));};exports[_0x6fec('0x21')]=function(_0x559c0e,_0x496c1b){return db['CmCustomField']['find']({'where':{'id':_0x559c0e[_0x6fec('0x43')]['id']}})[_0x6fec('0x22')](handleEntityNotFound(_0x496c1b,null))['then'](removeEntity(_0x496c1b,null))['catch'](handleError(_0x496c1b,null));};exports['create']=function(_0x89b81f,_0xb7f298){var _0x4c146b;return db[_0x6fec('0x46')][_0x6fec('0x47')](function(_0x3a78b3){return db[_0x6fec('0x2a')]['create'](_0x89b81f[_0x6fec('0x45')],{'transaction':_0x3a78b3})[_0x6fec('0x22')](function(_0x33f909){_0x4c146b=_0x33f909;var _0xb5c3ef={'type':db[_0x6fec('0x48')][_0x6fec('0x49')],'transaction':_0x3a78b3};switch(_0x89b81f[_0x6fec('0x45')]['type']){case _0x6fec('0x4a'):_0xb5c3ef[_0x6fec('0x2d')]=db[_0x6fec('0x48')][_0x6fec('0x49')];break;case _0x6fec('0x4b'):_0xb5c3ef[_0x6fec('0x2d')]=db[_0x6fec('0x48')][_0x6fec('0x4c')];break;case _0x6fec('0x4d'):_0xb5c3ef[_0x6fec('0x2d')]=db[_0x6fec('0x48')]['BOOLEAN'];_0xb5c3ef[_0x6fec('0x4e')]=![];break;default:}return db[_0x6fec('0x46')][_0x6fec('0x4f')][_0x6fec('0x50')](_0x6fec('0x51'),util['format']('cf_%d',_0x4c146b['id']),_0xb5c3ef);})['then'](function(){return _0x4c146b;});})[_0x6fec('0x22')](respondWithResult(_0xb7f298,0xc9))[_0x6fec('0x41')](handleError(_0xb7f298,null));}; \ No newline at end of file +var _0x4f9a=['cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','body','destroy','create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format'];(function(_0x40c5d9,_0x2be0d2){var _0x2660c0=function(_0x5d3ca0){while(--_0x5d3ca0){_0x40c5d9['push'](_0x40c5d9['shift']());}};_0x2660c0(++_0x2be0d2);}(_0x4f9a,0x169));var _0xa4f9=function(_0x4179a0,_0xf2bfd7){_0x4179a0=_0x4179a0-0x0;var _0x3d8a19=_0x4f9a[_0x4179a0];return _0x3d8a19;};'use strict';var emlformat=require(_0xa4f9('0x0'));var rimraf=require(_0xa4f9('0x1'));var zipdir=require(_0xa4f9('0x2'));var jsonpatch=require(_0xa4f9('0x3'));var rp=require(_0xa4f9('0x4'));var moment=require(_0xa4f9('0x5'));var BPromise=require(_0xa4f9('0x6'));var Mustache=require('mustache');var util=require(_0xa4f9('0x7'));var path=require(_0xa4f9('0x8'));var sox=require(_0xa4f9('0x9'));var csv=require(_0xa4f9('0xa'));var ejs=require(_0xa4f9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4f9('0xc'));var squel=require(_0xa4f9('0xd'));var crypto=require(_0xa4f9('0xe'));var jsforce=require(_0xa4f9('0xf'));var deskjs=require(_0xa4f9('0x10'));var toCsv=require(_0xa4f9('0xa'));var querystring=require(_0xa4f9('0x11'));var Papa=require('papaparse');var Redis=require(_0xa4f9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa4f9('0x13'));var as=require(_0xa4f9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4f9('0x15'))(_0xa4f9('0x16'));var utils=require(_0xa4f9('0x17'));var config=require(_0xa4f9('0x18'));var licenseUtil=require(_0xa4f9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e2aab,_0x55a206){_0x55a206=_0x55a206||0xcc;return function(_0x2a7710){if(_0x2a7710){return _0x5e2aab[_0xa4f9('0x1a')](_0x55a206);}return _0x5e2aab['status'](_0x55a206)[_0xa4f9('0x1b')]();};}function respondWithResult(_0x423372,_0x44ff8a){_0x44ff8a=_0x44ff8a||0xc8;return function(_0x4cf865){if(_0x4cf865){return _0x423372[_0xa4f9('0x1c')](_0x44ff8a)[_0xa4f9('0x1d')](_0x4cf865);}};}function respondWithFilteredResult(_0x410ccc,_0x2afdc6){return function(_0xe9927){if(_0xe9927){var _0x258954=typeof _0x2afdc6[_0xa4f9('0x1e')]===_0xa4f9('0x1f')&&typeof _0x2afdc6['limit']==='undefined';var _0x405b06=_0xe9927[_0xa4f9('0x20')];var _0x25bd77=_0x258954?0x0:_0x2afdc6[_0xa4f9('0x1e')];var _0x377974=_0x258954?_0xe9927['count']:_0x2afdc6[_0xa4f9('0x1e')]+_0x2afdc6[_0xa4f9('0x21')];var _0x186b1d;if(_0x377974>=_0x405b06){_0x377974=_0x405b06;_0x186b1d=0xc8;}else{_0x186b1d=0xce;}_0x410ccc[_0xa4f9('0x1c')](_0x186b1d);return _0x410ccc[_0xa4f9('0x22')](_0xa4f9('0x23'),_0x25bd77+'-'+_0x377974+'/'+_0x405b06)[_0xa4f9('0x1d')](_0xe9927);}return null;};}function patchUpdates(_0x5c2044){return function(_0x30bc54){try{jsonpatch[_0xa4f9('0x24')](_0x30bc54,_0x5c2044,!![]);}catch(_0x17f4d8){return BPromise['reject'](_0x17f4d8);}return _0x30bc54[_0xa4f9('0x25')]();};}function saveUpdates(_0x9fac7c,_0x60acc8){return function(_0x5c73dd){if(_0x5c73dd){return _0x5c73dd[_0xa4f9('0x26')](_0x9fac7c)[_0xa4f9('0x27')](function(_0x54ba29){return _0x54ba29;});}return null;};}function removeEntity(_0x4b8625,_0x45719d){return function(_0x153f17){if(_0x153f17){return _0x153f17['destroy']()['then'](function(){_0x4b8625['status'](0xcc)[_0xa4f9('0x1b')]();});}};}function handleEntityNotFound(_0x4eb363,_0x4b2371){return function(_0x8a759f){if(!_0x8a759f){_0x4eb363['sendStatus'](0x194);}return _0x8a759f;};}function handleError(_0x1407d0,_0x45606c){_0x45606c=_0x45606c||0x1f4;return function(_0x2a8547){logger[_0xa4f9('0x28')](_0x2a8547[_0xa4f9('0x29')]);if(_0x2a8547[_0xa4f9('0x2a')]){delete _0x2a8547['name'];}_0x1407d0[_0xa4f9('0x1c')](_0x45606c)[_0xa4f9('0x2b')](_0x2a8547);};}exports[_0xa4f9('0x2c')]=function(_0x1dcca3,_0x5ebdf6){var _0x580621={},_0x1c939c={},_0x4f6474={'count':0x0,'rows':[]};var _0x2c3529=_[_0xa4f9('0x2d')](db[_0xa4f9('0x2e')][_0xa4f9('0x2f')],function(_0x137c76){return{'name':_0x137c76[_0xa4f9('0x30')],'type':_0x137c76[_0xa4f9('0x31')][_0xa4f9('0x32')]};});_0x1c939c[_0xa4f9('0x33')]=_[_0xa4f9('0x34')](_['map'](_0x2c3529,_0xa4f9('0x2a')),[_0xa4f9('0x2a')]);_0x1c939c[_0xa4f9('0x35')]=_[_0xa4f9('0x36')](_0x1dcca3[_0xa4f9('0x35')]);_0x1c939c[_0xa4f9('0x37')]=_[_0xa4f9('0x38')](_0x1c939c[_0xa4f9('0x33')],_0x1c939c[_0xa4f9('0x35')]);_0x580621[_0xa4f9('0x39')]=_[_0xa4f9('0x38')](_0x1c939c[_0xa4f9('0x33')],qs[_0xa4f9('0x3a')](_0x1dcca3['query'][_0xa4f9('0x3a')]));_0x580621[_0xa4f9('0x39')]=_0x580621[_0xa4f9('0x39')][_0xa4f9('0x3b')]?_0x580621[_0xa4f9('0x39')]:_0x1c939c[_0xa4f9('0x33')];if(!_0x1dcca3[_0xa4f9('0x35')][_0xa4f9('0x3c')]('nolimit')){_0x580621[_0xa4f9('0x21')]=qs[_0xa4f9('0x21')](_0x1dcca3[_0xa4f9('0x35')][_0xa4f9('0x21')]);_0x580621[_0xa4f9('0x1e')]=qs[_0xa4f9('0x1e')](_0x1dcca3[_0xa4f9('0x35')][_0xa4f9('0x1e')]);}_0x580621[_0xa4f9('0x3d')]=qs[_0xa4f9('0x3e')](_0x1dcca3[_0xa4f9('0x35')][_0xa4f9('0x3e')]);_0x580621[_0xa4f9('0x3f')]=qs[_0xa4f9('0x37')](_['pick'](_0x1dcca3[_0xa4f9('0x35')],_0x1c939c[_0xa4f9('0x37')]),_0x2c3529);if(_0x1dcca3[_0xa4f9('0x35')][_0xa4f9('0x40')]){_0x580621[_0xa4f9('0x3f')]=_[_0xa4f9('0x41')](_0x580621[_0xa4f9('0x3f')],{'$or':_[_0xa4f9('0x2d')](_0x2c3529,function(_0x3b111b){if(_0x3b111b['type']!==_0xa4f9('0x42')){var _0xb090cd={};_0xb090cd[_0x3b111b[_0xa4f9('0x2a')]]={'$like':'%'+_0x1dcca3[_0xa4f9('0x35')][_0xa4f9('0x40')]+'%'};return _0xb090cd;}})});}_0x580621=_[_0xa4f9('0x41')]({},_0x580621,_0x1dcca3[_0xa4f9('0x43')]);var _0x17f38b={'where':_0x580621[_0xa4f9('0x3f')]};return db[_0xa4f9('0x2e')][_0xa4f9('0x20')](_0x17f38b)[_0xa4f9('0x27')](function(_0x3ff36b){_0x4f6474[_0xa4f9('0x20')]=_0x3ff36b;if(_0x1dcca3[_0xa4f9('0x35')]['includeAll']){_0x580621['include']=[{'all':!![]}];}return db[_0xa4f9('0x2e')][_0xa4f9('0x44')](_0x580621);})['then'](function(_0x14d025){_0x4f6474[_0xa4f9('0x45')]=_0x14d025;return _0x4f6474;})[_0xa4f9('0x27')](respondWithFilteredResult(_0x5ebdf6,_0x580621))[_0xa4f9('0x46')](handleError(_0x5ebdf6,null));};exports[_0xa4f9('0x47')]=function(_0x450e95,_0x3c2e23){var _0x175bb3={'raw':!![],'where':{'id':_0x450e95[_0xa4f9('0x48')]['id']}},_0x13a331={};_0x13a331[_0xa4f9('0x33')]=_[_0xa4f9('0x36')](db['CmCustomField'][_0xa4f9('0x2f')]);_0x13a331['query']=_[_0xa4f9('0x36')](_0x450e95[_0xa4f9('0x35')]);_0x13a331[_0xa4f9('0x37')]=_[_0xa4f9('0x38')](_0x13a331[_0xa4f9('0x33')],_0x13a331[_0xa4f9('0x35')]);_0x175bb3['attributes']=_['intersection'](_0x13a331['model'],qs[_0xa4f9('0x3a')](_0x450e95[_0xa4f9('0x35')][_0xa4f9('0x3a')]));_0x175bb3[_0xa4f9('0x39')]=_0x175bb3[_0xa4f9('0x39')][_0xa4f9('0x3b')]?_0x175bb3['attributes']:_0x13a331[_0xa4f9('0x33')];if(_0x450e95[_0xa4f9('0x35')]['includeAll']){_0x175bb3[_0xa4f9('0x49')]=[{'all':!![]}];}_0x175bb3=_[_0xa4f9('0x41')]({},_0x175bb3,_0x450e95['options']);return db[_0xa4f9('0x2e')][_0xa4f9('0x4a')](_0x175bb3)[_0xa4f9('0x27')](handleEntityNotFound(_0x3c2e23,null))[_0xa4f9('0x27')](respondWithResult(_0x3c2e23,null))[_0xa4f9('0x46')](handleError(_0x3c2e23,null));};exports['update']=function(_0x4a0324,_0x432639){if(_0x4a0324[_0xa4f9('0x4b')]['id']){delete _0x4a0324[_0xa4f9('0x4b')]['id'];}return db['CmCustomField'][_0xa4f9('0x4a')]({'where':{'id':_0x4a0324[_0xa4f9('0x48')]['id']}})[_0xa4f9('0x27')](handleEntityNotFound(_0x432639,null))['then'](saveUpdates(_0x4a0324[_0xa4f9('0x4b')],null))[_0xa4f9('0x27')](respondWithResult(_0x432639,null))[_0xa4f9('0x46')](handleError(_0x432639,null));};exports[_0xa4f9('0x4c')]=function(_0x48639b,_0x5c5742){return db[_0xa4f9('0x2e')][_0xa4f9('0x4a')]({'where':{'id':_0x48639b[_0xa4f9('0x48')]['id']}})[_0xa4f9('0x27')](handleEntityNotFound(_0x5c5742,null))[_0xa4f9('0x27')](removeEntity(_0x5c5742,null))[_0xa4f9('0x46')](handleError(_0x5c5742,null));};exports[_0xa4f9('0x4d')]=function(_0x3b1cc3,_0x11d177){var _0x4d5877;return db['sequelize'][_0xa4f9('0x4e')](function(_0x492c05){return db[_0xa4f9('0x2e')][_0xa4f9('0x4d')](_0x3b1cc3[_0xa4f9('0x4b')],{'transaction':_0x492c05})[_0xa4f9('0x27')](function(_0x24fb84){_0x4d5877=_0x24fb84;var _0x4433a0={'type':db[_0xa4f9('0x4f')][_0xa4f9('0x50')],'transaction':_0x492c05};switch(_0x3b1cc3['body'][_0xa4f9('0x31')]){case'text':_0x4433a0[_0xa4f9('0x31')]=db[_0xa4f9('0x4f')][_0xa4f9('0x50')];break;case _0xa4f9('0x51'):_0x4433a0[_0xa4f9('0x31')]=db[_0xa4f9('0x4f')][_0xa4f9('0x52')];break;case _0xa4f9('0x53'):_0x4433a0[_0xa4f9('0x31')]=db['Sequelize'][_0xa4f9('0x54')];_0x4433a0[_0xa4f9('0x55')]=![];break;default:}return db['sequelize']['queryInterface'][_0xa4f9('0x56')](_0xa4f9('0x57'),util[_0xa4f9('0x58')](_0xa4f9('0x59'),_0x4d5877['id']),_0x4433a0);})[_0xa4f9('0x27')](function(){return _0x4d5877;});})[_0xa4f9('0x27')](respondWithResult(_0x11d177,0xc9))[_0xa4f9('0x46')](handleError(_0x11d177,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 06e3997..ed76118 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 _0x648b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x5b98af,_0x2e78f9){var _0x1913c1=function(_0x5e153e){while(--_0x5e153e){_0x5b98af['push'](_0x5b98af['shift']());}};_0x1913c1(++_0x2e78f9);}(_0x648b,0x67));var _0xb648=function(_0x428e3e,_0x46db2f){_0x428e3e=_0x428e3e-0x0;var _0x4569d6=_0x648b[_0x428e3e];return _0x4569d6;};'use strict';var _=require(_0xb648('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb648('0x1'));var moment=require(_0xb648('0x2'));var BPromise=require(_0xb648('0x3'));var rp=require(_0xb648('0x4'));var fs=require('fs');var path=require(_0xb648('0x5'));var rimraf=require(_0xb648('0x6'));var config=require(_0xb648('0x7'));var attributes=require(_0xb648('0x8'));module[_0xb648('0x9')]=function(_0x441e4c,_0xf5915c){return _0x441e4c[_0xb648('0xa')](_0xb648('0xb'),attributes,{'tableName':_0xb648('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6ed=['request-promise','../../config/environment','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x479c4f,_0x56b51d){var _0x21e733=function(_0xa852d1){while(--_0xa852d1){_0x479c4f['push'](_0x479c4f['shift']());}};_0x21e733(++_0x56b51d);}(_0xa6ed,0x1ef));var _0xda6e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa6ed[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xda6e('0x0'));var util=require('util');var logger=require(_0xda6e('0x1'))(_0xda6e('0x2'));var moment=require(_0xda6e('0x3'));var BPromise=require(_0xda6e('0x4'));var rp=require(_0xda6e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xda6e('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x53fe06,_0x377b91){return _0x53fe06[_0xda6e('0x7')](_0xda6e('0x8'),attributes,{'tableName':_0xda6e('0x9'),'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 78b38f1..c89cdda 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 _0x87d1=['moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x87d1,0x1a2));var _0x187d=function(_0x4f86cb,_0x5b1ca4){_0x4f86cb=_0x4f86cb-0x0;var _0x47748c=_0x87d1[_0x4f86cb];return _0x47748c;};'use strict';var _=require(_0x187d('0x0'));var util=require(_0x187d('0x1'));var moment=require(_0x187d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x187d('0x3'));var db=require(_0x187d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x187d('0x5'))('rpc');var config=require(_0x187d('0x6'));var jayson=require(_0x187d('0x7'));var client=jayson['client'][_0x187d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582aef,_0x4f2006,_0xf620c){return new BPromise(function(_0x3733b7,_0x3031f7){return client[_0x187d('0x9')](_0x582aef,_0xf620c)[_0x187d('0xa')](function(_0x427896){logger['info'](_0x187d('0xb'),_0x4f2006,_0x187d('0xc'));logger['debug'](_0x187d('0xd'),_0x4f2006,_0x187d('0xc'),JSON[_0x187d('0xe')](_0x427896));if(_0x427896[_0x187d('0xf')]){if(_0x427896[_0x187d('0xf')][_0x187d('0x10')]===0x1f4){logger['error'](_0x187d('0xb'),_0x4f2006,_0x427896[_0x187d('0xf')][_0x187d('0x11')]);return _0x3031f7(_0x427896['error']['message']);}logger[_0x187d('0xf')](_0x187d('0xb'),_0x4f2006,_0x427896[_0x187d('0xf')][_0x187d('0x11')]);return _0x3733b7(_0x427896[_0x187d('0xf')][_0x187d('0x11')]);}else{logger['info'](_0x187d('0xb'),_0x4f2006,_0x187d('0xc'));_0x3733b7(_0x427896[_0x187d('0x12')][_0x187d('0x11')]);}})[_0x187d('0x13')](function(_0x1281d3){logger[_0x187d('0xf')](_0x187d('0xb'),_0x4f2006,_0x1281d3);_0x3031f7(_0x1281d3);});});} \ No newline at end of file +var _0x0f11=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x30c92b,_0x154324){var _0x33837b=function(_0x3366e6){while(--_0x3366e6){_0x30c92b['push'](_0x30c92b['shift']());}};_0x33837b(++_0x154324);}(_0x0f11,0x190));var _0x10f1=function(_0x298c4a,_0x38c569){_0x298c4a=_0x298c4a-0x0;var _0x1f0b54=_0x0f11[_0x298c4a];return _0x1f0b54;};'use strict';var _=require(_0x10f1('0x0'));var util=require('util');var moment=require(_0x10f1('0x1'));var BPromise=require(_0x10f1('0x2'));var rs=require(_0x10f1('0x3'));var fs=require('fs');var Redis=require(_0x10f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x10f1('0x5'));var logger=require(_0x10f1('0x6'))(_0x10f1('0x7'));var config=require(_0x10f1('0x8'));var jayson=require(_0x10f1('0x9'));var client=jayson[_0x10f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x129c78,_0x5b3bb2,_0x3f76d8){return new BPromise(function(_0x3f7376,_0x5af3df){return client[_0x10f1('0xb')](_0x129c78,_0x3f76d8)[_0x10f1('0xc')](function(_0x245495){logger[_0x10f1('0xd')](_0x10f1('0xe'),_0x5b3bb2,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5b3bb2,_0x10f1('0xf'),JSON[_0x10f1('0x10')](_0x245495));if(_0x245495[_0x10f1('0x11')]){if(_0x245495[_0x10f1('0x11')][_0x10f1('0x12')]===0x1f4){logger[_0x10f1('0x11')](_0x10f1('0xe'),_0x5b3bb2,_0x245495['error'][_0x10f1('0x13')]);return _0x5af3df(_0x245495[_0x10f1('0x11')][_0x10f1('0x13')]);}logger[_0x10f1('0x11')](_0x10f1('0xe'),_0x5b3bb2,_0x245495[_0x10f1('0x11')][_0x10f1('0x13')]);return _0x3f7376(_0x245495[_0x10f1('0x11')][_0x10f1('0x13')]);}else{logger[_0x10f1('0xd')](_0x10f1('0xe'),_0x5b3bb2,_0x10f1('0xf'));_0x3f7376(_0x245495[_0x10f1('0x14')]['message']);}})[_0x10f1('0x15')](function(_0x2fc429){logger[_0x10f1('0x11')](_0x10f1('0xe'),_0x5b3bb2,_0x2fc429);_0x5af3df(_0x2fc429);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index db9e291..6701404 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 _0x1a8f=['multer','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/:id','show','post','put','delete','destroy'];(function(_0xc99439,_0x38b352){var _0x33693c=function(_0x52ba13){while(--_0x52ba13){_0xc99439['push'](_0xc99439['shift']());}};_0x33693c(++_0x38b352);}(_0x1a8f,0x87));var _0xf1a8=function(_0x29ca3a,_0x118266){_0x29ca3a=_0x29ca3a-0x0;var _0x45371e=_0x1a8f[_0x29ca3a];return _0x45371e;};'use strict';var multer=require(_0xf1a8('0x0'));var util=require('util');var path=require(_0xf1a8('0x1'));var timeout=require(_0xf1a8('0x2'));var express=require(_0xf1a8('0x3'));var router=express[_0xf1a8('0x4')]();var fs_extra=require(_0xf1a8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xf1a8('0x6')]('/',auth[_0xf1a8('0x7')](),controller[_0xf1a8('0x8')]);router['get'](_0xf1a8('0x9'),auth['isAuthenticated'](),controller[_0xf1a8('0xa')]);router[_0xf1a8('0xb')]('/',auth[_0xf1a8('0x7')](),controller['create']);router[_0xf1a8('0xc')]('/:id',auth[_0xf1a8('0x7')](),controller['update']);router[_0xf1a8('0xd')](_0xf1a8('0x9'),auth[_0xf1a8('0x7')](),controller[_0xf1a8('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4a80=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4a80,0xbe));var _0x04a8=function(_0x1a22ef,_0x1ef6df){_0x1a22ef=_0x1a22ef-0x0;var _0x4a8226=_0x4a80[_0x1a22ef];return _0x4a8226;};'use strict';var multer=require(_0x04a8('0x0'));var util=require('util');var path=require(_0x04a8('0x1'));var timeout=require(_0x04a8('0x2'));var express=require('express');var router=express[_0x04a8('0x3')]();var fs_extra=require(_0x04a8('0x4'));var auth=require(_0x04a8('0x5'));var interaction=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var controller=require(_0x04a8('0x8'));router[_0x04a8('0x9')]('/',auth[_0x04a8('0xa')](),controller[_0x04a8('0xb')]);router[_0x04a8('0x9')]('/:id',auth[_0x04a8('0xa')](),controller[_0x04a8('0xc')]);router[_0x04a8('0xd')]('/',auth[_0x04a8('0xa')](),controller[_0x04a8('0xe')]);router[_0x04a8('0xf')](_0x04a8('0x10'),auth[_0x04a8('0xa')](),controller[_0x04a8('0x11')]);router[_0x04a8('0x12')]('/:id',auth[_0x04a8('0xa')](),controller[_0x04a8('0x13')]);module[_0x04a8('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index b5fd81c..4e17d3b 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 _0xae6a=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xae6a,0x159));var _0xaae6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xae6a[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0xaae6('0x0'));var Sequelize=require(_0xaae6('0x1'));module[_0xaae6('0x2')]={'phone':{'type':Sequelize[_0xaae6('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xaae6('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xaae6('0x5')],'defaultValue':moment()[_0xaae6('0x6')](_0xaae6('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaae6('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaae6('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xaae6('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaae6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaae6('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xaae6('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xaae6('0x9')},'UserId':{'type':Sequelize[_0xaae6('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xaae6('0x9')},'CampaignId':{'type':Sequelize[_0xaae6('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0xaae6('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaae6('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaae6('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaae6('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xaae6('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xaae6('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xaae6('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xd907=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x429d68,_0x1aa5a2){var _0x172ef0=function(_0x3b7d7d){while(--_0x3b7d7d){_0x429d68['push'](_0x429d68['shift']());}};_0x172ef0(++_0x1aa5a2);}(_0xd907,0x139));var _0x7d90=function(_0x48bb8f,_0x15ae9f){_0x48bb8f=_0x48bb8f-0x0;var _0x115417=_0xd907[_0x48bb8f];return _0x115417;};'use strict';var moment=require(_0x7d90('0x0'));var Sequelize=require(_0x7d90('0x1'));module[_0x7d90('0x2')]={'phone':{'type':Sequelize[_0x7d90('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7d90('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7d90('0x5')],'defaultValue':moment()[_0x7d90('0x6')](_0x7d90('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7d90('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7d90('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7d90('0x5')]},'priority':{'type':Sequelize[_0x7d90('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7d90('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7d90('0x8')],'unique':_0x7d90('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x7d90('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x7d90('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x7d90('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7d90('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7d90('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7d90('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7d90('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7d90('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7d90('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7d90('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 41472bd..f2fc26a 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 _0xa7e6=['fieldName','type','key','model','map','query','keys','filters','intersection','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','merge','options','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','name','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','hopperIds','priority','ASC','scheduledAt','DESC','literal','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','Queue','dialActive','getPreviewRecall','transaction','findOne','CmList','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','update','then','sendStatus','stack','index','CmHopper','rawAttributes'];(function(_0x444e5f,_0x3ac9ee){var _0x4ac2ba=function(_0x511470){while(--_0x511470){_0x444e5f['push'](_0x444e5f['shift']());}};_0x4ac2ba(++_0x3ac9ee);}(_0xa7e6,0x74));var _0x6a7e=function(_0x58b920,_0x204a5d){_0x58b920=_0x58b920-0x0;var _0x22a99b=_0xa7e6[_0x58b920];return _0x22a99b;};'use strict';var moment=require(_0x6a7e('0x0'));var _=require(_0x6a7e('0x1'));var qs=require(_0x6a7e('0x2'));var logger=require(_0x6a7e('0x3'))(_0x6a7e('0x4'));var shared=require(_0x6a7e('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3ccca2,_0x8787b5){_0x8787b5=_0x8787b5||0xc8;return function(_0x1ea310){if(_0x1ea310){return _0x3ccca2[_0x6a7e('0x6')](_0x8787b5)[_0x6a7e('0x7')](_0x1ea310);}};}function respondWithFilteredResult(_0x599006,_0x79df6f){return function(_0x16249d){if(_0x16249d){var _0x37165d=typeof _0x79df6f[_0x6a7e('0x8')]===_0x6a7e('0x9')&&typeof _0x79df6f[_0x6a7e('0xa')]===_0x6a7e('0x9');var _0x403962=_0x16249d[_0x6a7e('0xb')];var _0x5f4ff2=_0x37165d?0x0:_0x79df6f['offset'];var _0x557627=_0x37165d?_0x16249d['count']:_0x79df6f[_0x6a7e('0x8')]+_0x79df6f[_0x6a7e('0xa')];var _0x292822;if(_0x557627>=_0x403962){_0x557627=_0x403962;_0x292822=0xc8;}else{_0x292822=0xce;}_0x599006[_0x6a7e('0x6')](_0x292822);return _0x599006[_0x6a7e('0xc')]('Content-Range',_0x5f4ff2+'-'+_0x557627+'/'+_0x403962)[_0x6a7e('0x7')](_0x16249d);}return null;};}function saveUpdates(_0x4754ef,_0x5c0c74){return function(_0x50dcc1){if(_0x50dcc1){return _0x50dcc1[_0x6a7e('0xd')](_0x4754ef)[_0x6a7e('0xe')](function(_0x1ac6da){return _0x1ac6da;});}return null;};}function handleEntityNotFound(_0x374763,_0x4faca9){return function(_0x3137bc){if(!_0x3137bc){_0x374763[_0x6a7e('0xf')](0x194);}return _0x3137bc;};}function handleError(_0x306b83,_0x4576fe){_0x4576fe=_0x4576fe||0x1f4;return function(_0x465566){logger['error'](_0x465566[_0x6a7e('0x10')]);if(_0x465566['name']){delete _0x465566['name'];}_0x306b83[_0x6a7e('0x6')](_0x4576fe)['send'](_0x465566);};}exports[_0x6a7e('0x11')]=function(_0x195761,_0x470197){var _0x470d49={},_0x20e90a={},_0x53abe9={'count':0x0,'rows':[]};var _0x4c3763=_['map'](db[_0x6a7e('0x12')][_0x6a7e('0x13')],function(_0x327565){return{'name':_0x327565[_0x6a7e('0x14')],'type':_0x327565[_0x6a7e('0x15')][_0x6a7e('0x16')]};});_0x20e90a[_0x6a7e('0x17')]=_[_0x6a7e('0x18')](_0x4c3763,'name');_0x20e90a[_0x6a7e('0x19')]=_[_0x6a7e('0x1a')](_0x195761['query']);_0x20e90a[_0x6a7e('0x1b')]=_[_0x6a7e('0x1c')](_0x20e90a[_0x6a7e('0x17')],_0x20e90a['query']);_0x20e90a[_0x6a7e('0x1b')]=_[_0x6a7e('0x1d')](_0x20e90a['filters'],[_0x6a7e('0x1e'),'$or',_0x6a7e('0x1f'),_0x6a7e('0x20'),'$lt',_0x6a7e('0x21'),_0x6a7e('0x22'),_0x6a7e('0x23'),_0x6a7e('0x24'),_0x6a7e('0x25'),_0x6a7e('0x26'),'$in',_0x6a7e('0x27'),_0x6a7e('0x28'),_0x6a7e('0x29'),_0x6a7e('0x2a'),_0x6a7e('0x2b'),'$like','$overlap',_0x6a7e('0x2c'),_0x6a7e('0x2d'),_0x6a7e('0x2e')]);_0x470d49['attributes']=_[_0x6a7e('0x1c')](_0x20e90a['model'],qs[_0x6a7e('0x2f')](_0x195761['query']['fields']));_0x470d49[_0x6a7e('0x30')]=_0x470d49['attributes'][_0x6a7e('0x31')]?_0x470d49['attributes']:_0x20e90a['model'];if(!_0x195761[_0x6a7e('0x19')][_0x6a7e('0x32')](_0x6a7e('0x33'))){_0x470d49[_0x6a7e('0xa')]=qs[_0x6a7e('0xa')](_0x195761[_0x6a7e('0x19')][_0x6a7e('0xa')]);_0x470d49[_0x6a7e('0x8')]=qs[_0x6a7e('0x8')](_0x195761[_0x6a7e('0x19')][_0x6a7e('0x8')]);}_0x470d49[_0x6a7e('0x34')]=qs['sort'](_0x195761[_0x6a7e('0x19')][_0x6a7e('0x35')]);_0x470d49[_0x6a7e('0x36')]=qs['filters'](_[_0x6a7e('0x37')](_0x195761[_0x6a7e('0x19')],_0x20e90a[_0x6a7e('0x1b')]),_0x4c3763);if(_0x195761[_0x6a7e('0x19')][_0x6a7e('0x38')]){_0x470d49[_0x6a7e('0x36')]=_['merge'](_0x470d49['where'],{'$or':_[_0x6a7e('0x18')](_0x4c3763,function(_0x5d3789){if(_0x5d3789[_0x6a7e('0x15')]!==_0x6a7e('0x39')){var _0x5e30cd={};_0x5e30cd[_0x5d3789['name']]={'$like':'%'+_0x195761['query'][_0x6a7e('0x38')]+'%'};return _0x5e30cd;}})});}_0x470d49=_['merge']({},_0x470d49,_0x195761['options']);var _0x512430={'where':_0x470d49['where']};return db[_0x6a7e('0x12')]['count'](_0x512430)[_0x6a7e('0xe')](function(_0x39d544){_0x53abe9[_0x6a7e('0xb')]=_0x39d544;if(_0x195761[_0x6a7e('0x19')][_0x6a7e('0x3a')]){_0x470d49['include']=[{'all':!![]}];}return db[_0x6a7e('0x12')][_0x6a7e('0x3b')](_0x470d49);})['then'](function(_0x3d146f){_0x53abe9[_0x6a7e('0x3c')]=_0x3d146f;return _0x53abe9;})['then'](respondWithFilteredResult(_0x470197,_0x470d49))[_0x6a7e('0x3d')](handleError(_0x470197,null));};exports[_0x6a7e('0x3e')]=function(_0x34b0ef,_0x920c54){var _0x2827f7={'raw':!![],'where':{'id':_0x34b0ef[_0x6a7e('0x3f')]['id']}},_0x28a62e={};_0x28a62e[_0x6a7e('0x17')]=_[_0x6a7e('0x1a')](db[_0x6a7e('0x12')][_0x6a7e('0x13')]);_0x28a62e['query']=_['keys'](_0x34b0ef[_0x6a7e('0x19')]);_0x28a62e[_0x6a7e('0x1b')]=_['intersection'](_0x28a62e[_0x6a7e('0x17')],_0x28a62e[_0x6a7e('0x19')]);_0x2827f7[_0x6a7e('0x30')]=_[_0x6a7e('0x1c')](_0x28a62e[_0x6a7e('0x17')],qs[_0x6a7e('0x2f')](_0x34b0ef[_0x6a7e('0x19')][_0x6a7e('0x2f')]));_0x2827f7[_0x6a7e('0x30')]=_0x2827f7[_0x6a7e('0x30')][_0x6a7e('0x31')]?_0x2827f7[_0x6a7e('0x30')]:_0x28a62e[_0x6a7e('0x17')];if(_0x34b0ef[_0x6a7e('0x19')]['includeAll']){_0x2827f7['include']=[{'all':!![]}];}_0x2827f7=_[_0x6a7e('0x40')]({},_0x2827f7,_0x34b0ef[_0x6a7e('0x41')]);return db[_0x6a7e('0x12')][_0x6a7e('0x42')](_0x2827f7)[_0x6a7e('0xe')](handleEntityNotFound(_0x920c54,null))[_0x6a7e('0xe')](respondWithResult(_0x920c54,null))[_0x6a7e('0x3d')](handleError(_0x920c54,null));};exports[_0x6a7e('0x43')]=function(_0x5cdd48,_0x380e24){return db['CmHopper'][_0x6a7e('0x43')](_0x5cdd48[_0x6a7e('0x44')],{})[_0x6a7e('0xe')](respondWithResult(_0x380e24,0xc9))[_0x6a7e('0x3d')](handleError(_0x380e24,null));};exports['update']=function(_0x248189,_0xc7f6b9){if(_0x248189[_0x6a7e('0x44')]['id']){delete _0x248189['body']['id'];}return db[_0x6a7e('0x12')]['find']({'where':{'id':_0x248189[_0x6a7e('0x3f')]['id']}})[_0x6a7e('0xe')](handleEntityNotFound(_0xc7f6b9,null))[_0x6a7e('0xe')](saveUpdates(_0x248189[_0x6a7e('0x44')],null))['then'](respondWithResult(_0xc7f6b9,null))[_0x6a7e('0x3d')](handleError(_0xc7f6b9,null));};exports[_0x6a7e('0x45')]=function(_0x188ab5,_0x3991bc){return db['CmHopper'][_0x6a7e('0x45')]()['then'](respondWithResult(_0x3991bc,null))[_0x6a7e('0x3d')](handleError(_0x3991bc,null));};exports[_0x6a7e('0x46')]=function(_0x25c2bb,_0x4a7465){var _0xd3252d;var _0x58f58b=_0x25c2bb[_0x6a7e('0x3f')]['id'];return db['CmHopper'][_0x6a7e('0x42')]({'where':{'id':_0x25c2bb[_0x6a7e('0x3f')]['id']}})[_0x6a7e('0xe')](handleEntityNotFound(_0x4a7465,null))[_0x6a7e('0xe')](function(_0x2f2874){if(_0x2f2874){return _0x2f2874[_0x6a7e('0x46')]()['then'](function(_0x3d4395){return _0x3d4395;});}})[_0x6a7e('0xe')](function(_0x27c1e9){_0xd3252d=_0x27c1e9;if(_0x27c1e9){if(_0x27c1e9[_0x6a7e('0x47')]||_0x27c1e9['CampaignId']){return db[_0x27c1e9['VoiceQueueId']?_0x6a7e('0x48'):_0x6a7e('0x49')][_0x6a7e('0x42')]({'where':{'id':_0x27c1e9[_0x6a7e('0x47')]?_0x27c1e9[_0x6a7e('0x47')]:_0x27c1e9['CampaignId']},'attributes':['id',_0x6a7e('0x4a')],'raw':!![]});}}})[_0x6a7e('0xe')](function(_0xe1b38e){var _0x367b8b={};if(_0xe1b38e){_['merge'](_0x367b8b,_['omit'](_0xd3252d[_0x6a7e('0x4b')],[_0x6a7e('0x4c'),'updatedAt','id']));_0x367b8b[_0x6a7e('0x4d')]=0x15;_0x367b8b[_0x6a7e('0x4e')]=_0x6a7e('0x4f');_0x367b8b[_0x6a7e('0x50')]=_0xe1b38e[_0x6a7e('0x4a')];_0x367b8b[_0x6a7e('0x51')]=_0x25c2bb[_0x6a7e('0x52')][_0x6a7e('0x4a')];_0x367b8b['UserId']=_0x25c2bb[_0x6a7e('0x52')]['id'];_0x367b8b[_0x6a7e('0x4f')]=!![];_0x367b8b[_0x6a7e('0x53')]=moment()[_0x6a7e('0x54')](_0x6a7e('0x55'));_0x367b8b['calleridnum']=_0xd3252d[_0x6a7e('0x56')];_0x367b8b[_0x6a7e('0x57')]=_0xd3252d[_0x6a7e('0x47')]?_0x6a7e('0x58'):_0x6a7e('0x59');return db['CmContact'][_0x6a7e('0x42')]({'where':{'id':_0x367b8b[_0x6a7e('0x5a')]},'attributes':[_0x6a7e('0x5b'),_0x6a7e('0x5c')]})['then'](function(_0x2a0592){if(!_[_0x6a7e('0x5d')](_0x4a7465)&&!_[_0x6a7e('0x5d')](_0x2a0592[_0x6a7e('0x5b')])){_0x367b8b[_0x6a7e('0x5e')]=_0x2a0592[_0x6a7e('0x5b')];if(!_['isNil'](_0x2a0592[_0x6a7e('0x5c')])){_0x367b8b[_0x6a7e('0x5e')]+='\x20'+_0x2a0592[_0x6a7e('0x5c')];}}})[_0x6a7e('0x5f')](function(){return db[_0x6a7e('0x60')]['create'](_0x367b8b);});}})[_0x6a7e('0xe')](function(_0x61a72){return db[_0x6a7e('0x61')][_0x6a7e('0x46')]({'where':{'CmHopperId':_0x58f58b}});})['then'](function(){return _0x4a7465[_0x6a7e('0x6')](0xcc)['end']();})['catch'](handleError(_0x4a7465,null));};exports['getPreview']=function(_0x368ffb,_0x3374c7){var _0x5dc96c=[];return db[_0x6a7e('0x62')][_0x6a7e('0x45')]()[_0x6a7e('0xe')](function(_0x512d15){_0x5dc96c=_[_0x6a7e('0x1a')](_0x512d15);return _0x368ffb[_0x6a7e('0x52')][_0x6a7e('0x63')]({'where':{'type':_0x6a7e('0x64'),'dialActive':!![],'dialMethod':_0x6a7e('0x65')},'attributes':['id',_0x6a7e('0x66'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x6a7e('0xe')](function(_0x1f76ea){if(_0x1f76ea&&_0x1f76ea[_0x6a7e('0x31')]){return db['sequelize']['transaction'](function(_0x13e653){var _0x231dd1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a7e('0x54')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x1f76ea,'id')},'$or':[{'UserId':null},{'UserId':_0x368ffb[_0x6a7e('0x52')]['id']}]};var _0x2ea436={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1f76ea)[_0x6a7e('0x38')]([_0x6a7e('0x67'),0x0])[_0x6a7e('0x18')]('id')[_0x6a7e('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x368ffb[_0x6a7e('0x52')]['id']}]};var _0x450dd7={'$or':[_0x231dd1,_0x2ea436]};var _0x4cee5f=[];if(_0x368ffb[_0x6a7e('0x44')]['direction']&&_0x368ffb[_0x6a7e('0x44')]['direction']==='prev'){if(!_['isEmpty'](_0x368ffb[_0x6a7e('0x44')]['hopperIds'])){_0x450dd7['id']={'$in':_0x368ffb[_0x6a7e('0x44')][_0x6a7e('0x69')]};}_0x4cee5f=[[_0x6a7e('0x6a'),_0x6a7e('0x6b')],[_0x6a7e('0x6c'),_0x1f76ea[0x0][_0x6a7e('0x66')]===_0x6a7e('0x6b')?_0x6a7e('0x6d'):_0x6a7e('0x6b')],db['sequelize'][_0x6a7e('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x6a7e('0x6d')]];}else{if(!_['isEmpty'](_0x368ffb['body'][_0x6a7e('0x69')])){_0x450dd7['id']={'$notIn':_0x368ffb[_0x6a7e('0x44')][_0x6a7e('0x69')]};}_0x4cee5f=[[_0x6a7e('0x6a'),_0x6a7e('0x6d')],[_0x6a7e('0x6c'),_0x1f76ea[0x0][_0x6a7e('0x66')]],db[_0x6a7e('0x6f')]['literal'](_0x6a7e('0x70')),['id','ASC']];}return db[_0x6a7e('0x12')]['findOne']({'attributes':['id',_0x6a7e('0x71'),_0x6a7e('0x56'),_0x6a7e('0x72')],'where':_0x450dd7,'order':_0x4cee5f,'transaction':_0x13e653,'lock':_0x13e653[_0x6a7e('0x73')][_0x6a7e('0x74')],'include':[{'model':db[_0x6a7e('0x62')],'as':_0x6a7e('0x75'),'attributes':_0x5dc96c,'include':[{'model':db[_0x6a7e('0x76')],'as':_0x6a7e('0x77'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x6a7e('0x4a')]},{'model':db[_0x6a7e('0x48')],'as':_0x6a7e('0x78'),'attributes':['id',_0x6a7e('0x4a'),_0x6a7e('0x79')]}]})[_0x6a7e('0xe')](function(_0x272095){if(_0x272095){return _0x272095[_0x6a7e('0xd')]({'UserId':_0x368ffb[_0x6a7e('0x52')]['id']},{'transaction':_0x13e653});}});});}})[_0x6a7e('0xe')](handleEntityNotFound(_0x3374c7,null))['then'](respondWithResult(_0x3374c7,null))[_0x6a7e('0x3d')](handleError(_0x3374c7,null));};exports[_0x6a7e('0x7a')]=function(_0x209e33,_0x441118,_0x1e278b){var _0x51bc53=[];var _0x1d4a2d=_0x209e33[_0x6a7e('0x3f')]['id'];var _0x5bf64a=_0x209e33[_0x6a7e('0x52')]['id'];return db[_0x6a7e('0x62')][_0x6a7e('0x45')]()['then'](function(_0x42f01c){_0x51bc53=_[_0x6a7e('0x1a')](_0x42f01c);return db[_0x6a7e('0x6f')][_0x6a7e('0x7b')](function(_0x2e8c01){const _0x4ee7e5={'id':_0x1d4a2d};return db['CmHopper'][_0x6a7e('0x7c')]({'attributes':['id',_0x6a7e('0x71'),_0x6a7e('0x72')],'where':_0x4ee7e5,'transaction':_0x2e8c01,'lock':_0x2e8c01[_0x6a7e('0x73')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6a7e('0x75'),'attributes':_0x51bc53,'include':[{'model':db['CmCompany'],'as':_0x6a7e('0x77'),'attributes':['id',_0x6a7e('0x4a')]}]},{'model':db[_0x6a7e('0x7d')],'as':'List','attributes':['id',_0x6a7e('0x4a')]},{'model':db[_0x6a7e('0x48')],'as':_0x6a7e('0x78'),'attributes':['id',_0x6a7e('0x4a'),_0x6a7e('0x79')]}]})['then'](function(_0x3cc9d9){if(_0x3cc9d9){return _0x3cc9d9['update']({'UserId':_0x5bf64a},{'transaction':_0x2e8c01});}});});})[_0x6a7e('0xe')](handleEntityNotFound(_0x441118,null))[_0x6a7e('0xe')](respondWithResult(_0x441118,null))[_0x6a7e('0x3d')](handleError(_0x441118,null));};exports[_0x6a7e('0x7e')]=function(_0x4ece6e,_0xd1b6ed){return _0x4ece6e[_0x6a7e('0x52')][_0x6a7e('0x63')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6a7e('0xe')](function(_0xcf4ba4){if(_0xcf4ba4&&_0xcf4ba4[_0x6a7e('0x31')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6a7e('0x55'))},'VoiceQueueId':{'$in':_[_0x6a7e('0x18')](_0xcf4ba4,'id')},'$or':[{'UserId':null},{'UserId':_0x4ece6e[_0x6a7e('0x52')]['id']}]}});}return 0x0;})[_0x6a7e('0xe')](function(_0x412db8){if(!_[_0x6a7e('0x5d')](_0x412db8)&&_[_0x6a7e('0x7f')](_0x412db8)){return _0xd1b6ed[_0x6a7e('0x6')](0xc8)[_0x6a7e('0x7')]({'contacts':_0x412db8});}else{logger[_0x6a7e('0x80')](_0x6a7e('0x81'),'getOpenContacts',0x194,_0x6a7e('0x82'));_0xd1b6ed[_0x6a7e('0xf')](0x194);}})[_0x6a7e('0x3d')](handleError(_0xd1b6ed,null));};exports[_0x6a7e('0x83')]=function(_0x33c930,_0x540998){var _0x340e63=shared['timezones'];var _0x42aac=[];_['map'](_0x340e63,function(_0x2f7e23){_0x42aac[_0x6a7e('0x84')]({'id':_0x2f7e23[_0x6a7e('0x4a')],'name':_0x2f7e23[_0x6a7e('0x4a')],'utcOffset':_0x2f7e23[_0x6a7e('0x85')]});});return _0x540998[_0x6a7e('0x6')](0xc8)['json']({'tz':_0x42aac});};exports[_0x6a7e('0x86')]=function(_0x2ac6f,_0x4ee0de){var _0x481c8b=shared[_0x6a7e('0x87')];var _0x37fd3e={};if(!_[_0x6a7e('0x5d')](_0x481c8b[_0x2ac6f[_0x6a7e('0x44')]['id']]))_0x37fd3e=_0x481c8b[_0x2ac6f['body']['id']];return _0x4ee0de[_0x6a7e('0x6')](0xc8)['json'](_0x37fd3e);}; \ No newline at end of file +var _0x5636=['offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','$or','$gt','$gte','$lte','$eq','$not','$notBetween','$in','$like','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','intersection','options','find','create','body','params','describe','destroy','CampaignId','VoiceQueueId','Campaign','omit','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','end','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','recallme','CmCompany','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','utcOffset','getTimezone','moment','lodash','../../config/environment','../../mysqldb','status','json'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x5636,0x102));var _0x6563=function(_0x77e40a,_0x2bd7ee){_0x77e40a=_0x77e40a-0x0;var _0x410c5c=_0x5636[_0x77e40a];return _0x410c5c;};'use strict';var moment=require(_0x6563('0x0'));var _=require(_0x6563('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var shared=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];function respondWithResult(_0x115cc1,_0x4ac653){_0x4ac653=_0x4ac653||0xc8;return function(_0x166a58){if(_0x166a58){return _0x115cc1[_0x6563('0x4')](_0x4ac653)[_0x6563('0x5')](_0x166a58);}};}function respondWithFilteredResult(_0x39792f,_0x29f687){return function(_0x193942){if(_0x193942){var _0x9884a9=typeof _0x29f687[_0x6563('0x6')]===_0x6563('0x7')&&typeof _0x29f687[_0x6563('0x8')]===_0x6563('0x7');var _0x5f1db3=_0x193942[_0x6563('0x9')];var _0x516d1a=_0x9884a9?0x0:_0x29f687['offset'];var _0x2946f3=_0x9884a9?_0x193942[_0x6563('0x9')]:_0x29f687['offset']+_0x29f687['limit'];var _0x5da960;if(_0x2946f3>=_0x5f1db3){_0x2946f3=_0x5f1db3;_0x5da960=0xc8;}else{_0x5da960=0xce;}_0x39792f[_0x6563('0x4')](_0x5da960);return _0x39792f[_0x6563('0xa')](_0x6563('0xb'),_0x516d1a+'-'+_0x2946f3+'/'+_0x5f1db3)[_0x6563('0x5')](_0x193942);}return null;};}function saveUpdates(_0x33816e,_0x2ed676){return function(_0x31d3fa){if(_0x31d3fa){return _0x31d3fa[_0x6563('0xc')](_0x33816e)[_0x6563('0xd')](function(_0x51aeca){return _0x51aeca;});}return null;};}function handleEntityNotFound(_0xa0a0b6,_0x5e9329){return function(_0x37131e){if(!_0x37131e){_0xa0a0b6[_0x6563('0xe')](0x194);}return _0x37131e;};}function handleError(_0x33f8e4,_0x10d08c){_0x10d08c=_0x10d08c||0x1f4;return function(_0x5af5d0){logger[_0x6563('0xf')](_0x5af5d0[_0x6563('0x10')]);if(_0x5af5d0[_0x6563('0x11')]){delete _0x5af5d0[_0x6563('0x11')];}_0x33f8e4['status'](_0x10d08c)[_0x6563('0x12')](_0x5af5d0);};}exports['index']=function(_0x502694,_0x47972a){var _0x14c6a6={},_0x4f5609={},_0x54e69c={'count':0x0,'rows':[]};var _0x27651b=_[_0x6563('0x13')](db[_0x6563('0x14')][_0x6563('0x15')],function(_0xf8b544){return{'name':_0xf8b544[_0x6563('0x16')],'type':_0xf8b544[_0x6563('0x17')][_0x6563('0x18')]};});_0x4f5609[_0x6563('0x19')]=_['map'](_0x27651b,_0x6563('0x11'));_0x4f5609[_0x6563('0x1a')]=_[_0x6563('0x1b')](_0x502694['query']);_0x4f5609[_0x6563('0x1c')]=_['intersection'](_0x4f5609[_0x6563('0x19')],_0x4f5609[_0x6563('0x1a')]);_0x4f5609['filters']=_['concat'](_0x4f5609[_0x6563('0x1c')],['$and',_0x6563('0x1d'),_0x6563('0x1e'),_0x6563('0x1f'),'$lt',_0x6563('0x20'),'$ne',_0x6563('0x21'),_0x6563('0x22'),'$between',_0x6563('0x23'),_0x6563('0x24'),'$notIn',_0x6563('0x25'),'$notLike',_0x6563('0x26'),'$notILike','$like',_0x6563('0x27'),_0x6563('0x28'),_0x6563('0x29'),_0x6563('0x2a')]);_0x14c6a6[_0x6563('0x2b')]=_['intersection'](_0x4f5609[_0x6563('0x19')],qs['fields'](_0x502694['query'][_0x6563('0x2c')]));_0x14c6a6[_0x6563('0x2b')]=_0x14c6a6[_0x6563('0x2b')][_0x6563('0x2d')]?_0x14c6a6[_0x6563('0x2b')]:_0x4f5609[_0x6563('0x19')];if(!_0x502694[_0x6563('0x1a')][_0x6563('0x2e')](_0x6563('0x2f'))){_0x14c6a6[_0x6563('0x8')]=qs['limit'](_0x502694[_0x6563('0x1a')][_0x6563('0x8')]);_0x14c6a6[_0x6563('0x6')]=qs[_0x6563('0x6')](_0x502694[_0x6563('0x1a')][_0x6563('0x6')]);}_0x14c6a6[_0x6563('0x30')]=qs['sort'](_0x502694[_0x6563('0x1a')][_0x6563('0x31')]);_0x14c6a6[_0x6563('0x32')]=qs[_0x6563('0x1c')](_[_0x6563('0x33')](_0x502694[_0x6563('0x1a')],_0x4f5609['filters']),_0x27651b);if(_0x502694[_0x6563('0x1a')][_0x6563('0x34')]){_0x14c6a6[_0x6563('0x32')]=_[_0x6563('0x35')](_0x14c6a6[_0x6563('0x32')],{'$or':_[_0x6563('0x13')](_0x27651b,function(_0x3f578a){if(_0x3f578a['type']!==_0x6563('0x36')){var _0x394120={};_0x394120[_0x3f578a['name']]={'$like':'%'+_0x502694[_0x6563('0x1a')][_0x6563('0x34')]+'%'};return _0x394120;}})});}_0x14c6a6=_['merge']({},_0x14c6a6,_0x502694['options']);var _0x38fef5={'where':_0x14c6a6[_0x6563('0x32')]};return db[_0x6563('0x14')][_0x6563('0x9')](_0x38fef5)['then'](function(_0x2d36d4){_0x54e69c[_0x6563('0x9')]=_0x2d36d4;if(_0x502694['query'][_0x6563('0x37')]){_0x14c6a6[_0x6563('0x38')]=[{'all':!![]}];}return db[_0x6563('0x14')][_0x6563('0x39')](_0x14c6a6);})[_0x6563('0xd')](function(_0x1f6341){_0x54e69c[_0x6563('0x3a')]=_0x1f6341;return _0x54e69c;})[_0x6563('0xd')](respondWithFilteredResult(_0x47972a,_0x14c6a6))[_0x6563('0x3b')](handleError(_0x47972a,null));};exports['show']=function(_0x130a88,_0x772286){var _0x3b7a24={'raw':!![],'where':{'id':_0x130a88['params']['id']}},_0x1c53c4={};_0x1c53c4['model']=_[_0x6563('0x1b')](db[_0x6563('0x14')][_0x6563('0x15')]);_0x1c53c4['query']=_[_0x6563('0x1b')](_0x130a88['query']);_0x1c53c4[_0x6563('0x1c')]=_[_0x6563('0x3c')](_0x1c53c4['model'],_0x1c53c4[_0x6563('0x1a')]);_0x3b7a24[_0x6563('0x2b')]=_[_0x6563('0x3c')](_0x1c53c4[_0x6563('0x19')],qs[_0x6563('0x2c')](_0x130a88[_0x6563('0x1a')][_0x6563('0x2c')]));_0x3b7a24[_0x6563('0x2b')]=_0x3b7a24[_0x6563('0x2b')][_0x6563('0x2d')]?_0x3b7a24[_0x6563('0x2b')]:_0x1c53c4['model'];if(_0x130a88['query'][_0x6563('0x37')]){_0x3b7a24[_0x6563('0x38')]=[{'all':!![]}];}_0x3b7a24=_[_0x6563('0x35')]({},_0x3b7a24,_0x130a88[_0x6563('0x3d')]);return db[_0x6563('0x14')][_0x6563('0x3e')](_0x3b7a24)[_0x6563('0xd')](handleEntityNotFound(_0x772286,null))['then'](respondWithResult(_0x772286,null))[_0x6563('0x3b')](handleError(_0x772286,null));};exports[_0x6563('0x3f')]=function(_0x41fff0,_0xdb9a23){return db['CmHopper'][_0x6563('0x3f')](_0x41fff0[_0x6563('0x40')],{})[_0x6563('0xd')](respondWithResult(_0xdb9a23,0xc9))[_0x6563('0x3b')](handleError(_0xdb9a23,null));};exports[_0x6563('0xc')]=function(_0x4e0f0a,_0x496602){if(_0x4e0f0a[_0x6563('0x40')]['id']){delete _0x4e0f0a[_0x6563('0x40')]['id'];}return db[_0x6563('0x14')]['find']({'where':{'id':_0x4e0f0a[_0x6563('0x41')]['id']}})[_0x6563('0xd')](handleEntityNotFound(_0x496602,null))[_0x6563('0xd')](saveUpdates(_0x4e0f0a[_0x6563('0x40')],null))['then'](respondWithResult(_0x496602,null))[_0x6563('0x3b')](handleError(_0x496602,null));};exports[_0x6563('0x42')]=function(_0xd54477,_0x55e927){return db[_0x6563('0x14')]['describe']()[_0x6563('0xd')](respondWithResult(_0x55e927,null))['catch'](handleError(_0x55e927,null));};exports['destroy']=function(_0x1ef2da,_0x11617b){var _0x2ebab0;var _0xb84325=_0x1ef2da[_0x6563('0x41')]['id'];return db[_0x6563('0x14')][_0x6563('0x3e')]({'where':{'id':_0x1ef2da[_0x6563('0x41')]['id']}})[_0x6563('0xd')](handleEntityNotFound(_0x11617b,null))[_0x6563('0xd')](function(_0x4951a6){if(_0x4951a6){return _0x4951a6[_0x6563('0x43')]()['then'](function(_0x22306a){return _0x22306a;});}})[_0x6563('0xd')](function(_0x19062a){_0x2ebab0=_0x19062a;if(_0x19062a){if(_0x19062a['VoiceQueueId']||_0x19062a[_0x6563('0x44')]){return db[_0x19062a[_0x6563('0x45')]?'VoiceQueue':_0x6563('0x46')][_0x6563('0x3e')]({'where':{'id':_0x19062a[_0x6563('0x45')]?_0x19062a[_0x6563('0x45')]:_0x19062a[_0x6563('0x44')]},'attributes':['id','name'],'raw':!![]});}}})[_0x6563('0xd')](function(_0x5c4cfa){var _0x22656f={};if(_0x5c4cfa){_['merge'](_0x22656f,_[_0x6563('0x47')](_0x2ebab0['dataValues'],['createdAt','updatedAt','id']));_0x22656f['state']=0x15;_0x22656f[_0x6563('0x48')]='deleted';_0x22656f[_0x6563('0x49')]=_0x5c4cfa['name'];_0x22656f[_0x6563('0x4a')]=_0x1ef2da[_0x6563('0x4b')][_0x6563('0x11')];_0x22656f[_0x6563('0x4c')]=_0x1ef2da[_0x6563('0x4b')]['id'];_0x22656f[_0x6563('0x4d')]=!![];_0x22656f[_0x6563('0x4e')]=moment()[_0x6563('0x4f')](_0x6563('0x50'));_0x22656f['calleridnum']=_0x2ebab0[_0x6563('0x51')];_0x22656f[_0x6563('0x52')]=_0x2ebab0[_0x6563('0x45')]?_0x6563('0x53'):_0x6563('0x54');return db[_0x6563('0x55')][_0x6563('0x3e')]({'where':{'id':_0x22656f[_0x6563('0x56')]},'attributes':[_0x6563('0x57'),_0x6563('0x58')]})[_0x6563('0xd')](function(_0x5c456b){if(!_[_0x6563('0x59')](_0x11617b)&&!_[_0x6563('0x59')](_0x5c456b[_0x6563('0x57')])){_0x22656f[_0x6563('0x5a')]=_0x5c456b[_0x6563('0x57')];if(!_[_0x6563('0x59')](_0x5c456b[_0x6563('0x58')])){_0x22656f[_0x6563('0x5a')]+='\x20'+_0x5c456b['lastName'];}}})[_0x6563('0x5b')](function(){return db['CmHopperFinal'][_0x6563('0x3f')](_0x22656f);});}})[_0x6563('0xd')](function(_0x58b81e){return db['CmHopperAdditionalPhone'][_0x6563('0x43')]({'where':{'CmHopperId':_0xb84325}});})[_0x6563('0xd')](function(){return _0x11617b[_0x6563('0x4')](0xcc)[_0x6563('0x5c')]();})['catch'](handleError(_0x11617b,null));};exports[_0x6563('0x5d')]=function(_0x49c1e0,_0x12eaf6){var _0x29aecb=[];return db['CmContact']['describe']()[_0x6563('0xd')](function(_0x5bae4c){_0x29aecb=_['keys'](_0x5bae4c);return _0x49c1e0[_0x6563('0x4b')]['getVoiceQueues']({'where':{'type':_0x6563('0x5e'),'dialActive':!![],'dialMethod':_0x6563('0x5f')},'attributes':['id',_0x6563('0x60'),_0x6563('0x61')],'raw':!![]});})['then'](function(_0x83d5c){if(_0x83d5c&&_0x83d5c[_0x6563('0x2d')]){return db[_0x6563('0x62')][_0x6563('0x63')](function(_0x3ffb7f){var _0x2d4694={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6563('0x4f')](_0x6563('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x83d5c,'id')},'$or':[{'UserId':null},{'UserId':_0x49c1e0['user']['id']}]};var _0x2c855f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x83d5c)[_0x6563('0x34')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x49c1e0[_0x6563('0x4b')]['id']}]};var _0x2c02d6={'$or':[_0x2d4694,_0x2c855f]};var _0x463df4=[];if(_0x49c1e0[_0x6563('0x40')]['direction']&&_0x49c1e0[_0x6563('0x40')][_0x6563('0x64')]===_0x6563('0x65')){if(!_[_0x6563('0x66')](_0x49c1e0[_0x6563('0x40')]['hopperIds'])){_0x2c02d6['id']={'$in':_0x49c1e0['body'][_0x6563('0x67')]};}_0x463df4=[[_0x6563('0x68'),_0x6563('0x69')],['scheduledAt',_0x83d5c[0x0][_0x6563('0x60')]==='ASC'?_0x6563('0x6a'):_0x6563('0x69')],db[_0x6563('0x62')][_0x6563('0x6b')](_0x6563('0x6c')),['id',_0x6563('0x6a')]];}else{if(!_[_0x6563('0x66')](_0x49c1e0['body']['hopperIds'])){_0x2c02d6['id']={'$notIn':_0x49c1e0[_0x6563('0x40')][_0x6563('0x67')]};}_0x463df4=[[_0x6563('0x68'),_0x6563('0x6a')],[_0x6563('0x6d'),_0x83d5c[0x0][_0x6563('0x60')]],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6563('0x69')]];}return db[_0x6563('0x14')][_0x6563('0x6e')]({'attributes':['id',_0x6563('0x6f'),_0x6563('0x51'),'recallme'],'where':_0x2c02d6,'order':_0x463df4,'transaction':_0x3ffb7f,'lock':_0x3ffb7f[_0x6563('0x70')][_0x6563('0x71')],'include':[{'model':db[_0x6563('0x55')],'as':_0x6563('0x72'),'attributes':_0x29aecb,'include':[{'model':db['CmCompany'],'as':_0x6563('0x73'),'attributes':['id',_0x6563('0x11')]}]},{'model':db[_0x6563('0x74')],'as':_0x6563('0x75'),'attributes':['id',_0x6563('0x11')]},{'model':db[_0x6563('0x76')],'as':_0x6563('0x77'),'attributes':['id',_0x6563('0x11'),_0x6563('0x78')]}]})[_0x6563('0xd')](function(_0x222a9c){if(_0x222a9c){return _0x222a9c[_0x6563('0xc')]({'UserId':_0x49c1e0[_0x6563('0x4b')]['id']},{'transaction':_0x3ffb7f});}});});}})[_0x6563('0xd')](handleEntityNotFound(_0x12eaf6,null))[_0x6563('0xd')](respondWithResult(_0x12eaf6,null))['catch'](handleError(_0x12eaf6,null));};exports[_0x6563('0x79')]=function(_0x3594f7,_0x3a36f3,_0x2b8fbc){var _0x2b4801=[];var _0x339285=_0x3594f7[_0x6563('0x41')]['id'];var _0x23551d=_0x3594f7[_0x6563('0x4b')]['id'];return db[_0x6563('0x55')]['describe']()[_0x6563('0xd')](function(_0x1e2dba){_0x2b4801=_[_0x6563('0x1b')](_0x1e2dba);return db[_0x6563('0x62')][_0x6563('0x63')](function(_0xf37913){const _0x30fd2f={'id':_0x339285};return db['CmHopper'][_0x6563('0x6e')]({'attributes':['id',_0x6563('0x6f'),_0x6563('0x7a')],'where':_0x30fd2f,'transaction':_0xf37913,'lock':_0xf37913[_0x6563('0x70')][_0x6563('0x71')],'include':[{'model':db[_0x6563('0x55')],'as':'Contact','attributes':_0x2b4801,'include':[{'model':db[_0x6563('0x7b')],'as':_0x6563('0x73'),'attributes':['id',_0x6563('0x11')]}]},{'model':db['CmList'],'as':_0x6563('0x75'),'attributes':['id',_0x6563('0x11')]},{'model':db[_0x6563('0x76')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x6563('0xd')](function(_0x144f9d){if(_0x144f9d){return _0x144f9d[_0x6563('0xc')]({'UserId':_0x23551d},{'transaction':_0xf37913});}});});})[_0x6563('0xd')](handleEntityNotFound(_0x3a36f3,null))['then'](respondWithResult(_0x3a36f3,null))[_0x6563('0x3b')](handleError(_0x3a36f3,null));};exports[_0x6563('0x7c')]=function(_0x50e7b4,_0x4ef39c){return _0x50e7b4[_0x6563('0x4b')][_0x6563('0x7d')]({'where':{'type':_0x6563('0x5e'),'dialActive':!![],'dialMethod':_0x6563('0x5f')},'attributes':['id'],'raw':!![]})['then'](function(_0x1c195c){if(_0x1c195c&&_0x1c195c[_0x6563('0x2d')]){return db[_0x6563('0x14')][_0x6563('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6563('0x4f')](_0x6563('0x50'))},'VoiceQueueId':{'$in':_[_0x6563('0x13')](_0x1c195c,'id')},'$or':[{'UserId':null},{'UserId':_0x50e7b4[_0x6563('0x4b')]['id']}]}});}return 0x0;})[_0x6563('0xd')](function(_0x5797a5){if(!_[_0x6563('0x59')](_0x5797a5)&&_[_0x6563('0x7e')](_0x5797a5)){return _0x4ef39c[_0x6563('0x4')](0xc8)[_0x6563('0x5')]({'contacts':_0x5797a5});}else{logger[_0x6563('0xf')](_0x6563('0x7f'),'getOpenContacts',0x194,_0x6563('0x80'));_0x4ef39c[_0x6563('0xe')](0x194);}})[_0x6563('0x3b')](handleError(_0x4ef39c,null));};exports['getTimezones']=function(_0x4e63f3,_0x121c23){var _0xfb9595=shared[_0x6563('0x81')];var _0x2c761b=[];_[_0x6563('0x13')](_0xfb9595,function(_0x4ea209){_0x2c761b['push']({'id':_0x4ea209[_0x6563('0x11')],'name':_0x4ea209['name'],'utcOffset':_0x4ea209[_0x6563('0x82')]});});return _0x121c23['status'](0xc8)['json']({'tz':_0x2c761b});};exports[_0x6563('0x83')]=function(_0x9eee43,_0x270e37){var _0xdff3ae=shared[_0x6563('0x81')];var _0x42f676={};if(!_[_0x6563('0x59')](_0xdff3ae[_0x9eee43[_0x6563('0x40')]['id']]))_0x42f676=_0xdff3ae[_0x9eee43['body']['id']];return _0x270e37[_0x6563('0x4')](0xc8)[_0x6563('0x5')](_0x42f676);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8edf404..e3a03c9 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 _0x2ef3=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bb47b,_0x54e02e){var _0x566418=function(_0x4ceb66){while(--_0x4ceb66){_0x1bb47b['push'](_0x1bb47b['shift']());}};_0x566418(++_0x54e02e);}(_0x2ef3,0xba));var _0x32ef=function(_0x4cdbc4,_0xd73a0){_0x4cdbc4=_0x4cdbc4-0x0;var _0x287d91=_0x2ef3[_0x4cdbc4];return _0x287d91;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]},{'name':_0x32ef('0xe'),'fields':[_0x32ef('0xe')]},{'name':_0x32ef('0xf'),'fields':[_0x32ef('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x90b1,0x1bb));var _0x190b=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x90b1[_0x4b6830];return _0x239e4a;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8bdfef2..8984220 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 _0x6e08=['GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetCmHopperPreview','limit','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','CmList','List','util','moment','bluebird','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','raw','options','where','attributes','include','map','model','GetCmHopper','ShowCmHopper','CmHopper','find','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','CmContact','keys','User','Agent','name','length','UserId','includes','push','update','all'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e08,0x196));var _0x86e0=function(_0x4f22fe,_0x23f451){_0x4f22fe=_0x4f22fe-0x0;var _0x12adca=_0x6e08[_0x4f22fe];return _0x12adca;};'use strict';var _=require('lodash');var util=require(_0x86e0('0x0'));var moment=require(_0x86e0('0x1'));var BPromise=require(_0x86e0('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x86e0('0x3'))('rpc');var jayson=require(_0x86e0('0x4'));var client=jayson[_0x86e0('0x5')][_0x86e0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x10c807,_0x388929,_0x15bdcb){return new BPromise(function(_0x34be13,_0x7057ad){return client[_0x86e0('0x7')](_0x10c807,_0x15bdcb)[_0x86e0('0x8')](function(_0x27ad1f){logger[_0x86e0('0x9')](_0x86e0('0xa'),_0x388929,_0x86e0('0xb'));logger[_0x86e0('0xc')](_0x86e0('0xd'),_0x388929,'request\x20sent',JSON[_0x86e0('0xe')](_0x27ad1f));if(_0x27ad1f[_0x86e0('0xf')]){if(_0x27ad1f['error'][_0x86e0('0x10')]===0x1f4){logger[_0x86e0('0xf')](_0x86e0('0xa'),_0x388929,_0x27ad1f[_0x86e0('0xf')][_0x86e0('0x11')]);return _0x7057ad(_0x27ad1f['error']['message']);}logger[_0x86e0('0xf')](_0x86e0('0xa'),_0x388929,_0x27ad1f['error'][_0x86e0('0x11')]);return _0x34be13(_0x27ad1f['error'][_0x86e0('0x11')]);}else{logger['info'](_0x86e0('0xa'),_0x388929,_0x86e0('0xb'));_0x34be13(_0x27ad1f['result']['message']);}})[_0x86e0('0x12')](function(_0x5c7bda){logger[_0x86e0('0xf')](_0x86e0('0xa'),_0x388929,_0x5c7bda);_0x7057ad(_0x5c7bda);});});}exports['GetCmHopper']=function(_0x3877f0){var _0x4ec399=this;return new Promise(function(_0x5009b9,_0x421b03){return db['CmHopper'][_0x86e0('0x13')]({'raw':_0x3877f0['options']?_0x3877f0['options'][_0x86e0('0x14')]===undefined?!![]:![]:!![],'where':_0x3877f0[_0x86e0('0x15')]?_0x3877f0[_0x86e0('0x15')][_0x86e0('0x16')]||null:null,'attributes':_0x3877f0['options']?_0x3877f0[_0x86e0('0x15')][_0x86e0('0x17')]||null:null,'limit':_0x3877f0[_0x86e0('0x15')]?_0x3877f0[_0x86e0('0x15')]['limit']||null:null,'include':_0x3877f0['options']?_0x3877f0['options'][_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x3877f0[_0x86e0('0x15')][_0x86e0('0x18')],function(_0x29a909){return{'model':db[_0x29a909[_0x86e0('0x1a')]],'as':_0x29a909['as'],'attributes':_0x29a909[_0x86e0('0x17')],'include':_0x29a909[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x29a909[_0x86e0('0x18')],function(_0x840f36){return{'model':db[_0x840f36[_0x86e0('0x1a')]],'as':_0x840f36['as'],'attributes':_0x840f36[_0x86e0('0x17')],'include':_0x840f36[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x840f36['include'],function(_0x3c6cd1){return{'model':db[_0x3c6cd1['model']],'as':_0x3c6cd1['as'],'attributes':_0x3c6cd1['attributes']};}):[]};}):[]};}):[]:[]})[_0x86e0('0x8')](function(_0x251993){logger[_0x86e0('0x9')](_0x86e0('0x1b'),_0x3877f0);logger['debug'](_0x86e0('0x1b'),_0x3877f0,JSON[_0x86e0('0xe')](_0x251993));_0x5009b9(_0x251993);})[_0x86e0('0x12')](function(_0x1799aa){logger['error'](_0x86e0('0x1b'),_0x1799aa[_0x86e0('0x11')],_0x3877f0);_0x421b03(_0x4ec399['error'](0x1f4,_0x1799aa['message']));});});};exports[_0x86e0('0x1c')]=function(_0x278f1c){var _0x3c7e57=this;return new Promise(function(_0x18f573,_0x1638f0){return db[_0x86e0('0x1d')][_0x86e0('0x1e')]({'raw':_0x278f1c[_0x86e0('0x15')]?_0x278f1c[_0x86e0('0x15')][_0x86e0('0x14')]===undefined?!![]:![]:!![],'where':_0x278f1c[_0x86e0('0x15')]?_0x278f1c[_0x86e0('0x15')][_0x86e0('0x16')]||null:null,'attributes':_0x278f1c[_0x86e0('0x15')]?_0x278f1c[_0x86e0('0x15')]['attributes']||null:null,'include':_0x278f1c[_0x86e0('0x15')]?_0x278f1c['options'][_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x278f1c[_0x86e0('0x15')][_0x86e0('0x18')],function(_0x2641af){return{'model':db[_0x2641af[_0x86e0('0x1a')]],'as':_0x2641af['as'],'attributes':_0x2641af[_0x86e0('0x17')],'include':_0x2641af[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x2641af[_0x86e0('0x18')],function(_0x4c1cb3){return{'model':db[_0x4c1cb3['model']],'as':_0x4c1cb3['as'],'attributes':_0x4c1cb3['attributes'],'include':_0x4c1cb3[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x4c1cb3[_0x86e0('0x18')],function(_0x1e8d0d){return{'model':db[_0x1e8d0d['model']],'as':_0x1e8d0d['as'],'attributes':_0x1e8d0d[_0x86e0('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x282daf){logger[_0x86e0('0x9')]('ShowCmHopper',_0x278f1c);logger[_0x86e0('0xc')]('ShowCmHopper',_0x278f1c,JSON[_0x86e0('0xe')](_0x282daf));_0x18f573(_0x282daf);})[_0x86e0('0x12')](function(_0x5cd190){logger['error'](_0x86e0('0x1c'),_0x5cd190['message'],_0x278f1c);_0x1638f0(_0x3c7e57[_0x86e0('0xf')](0x1f4,_0x5cd190[_0x86e0('0x11')]));});});};exports[_0x86e0('0x1f')]=function(_0x200276){var _0x287668=this;return new Promise(function(_0x486695,_0x4c2950){return db['CmHopper']['create'](_0x200276['body'],{'raw':_0x200276['options']?_0x200276[_0x86e0('0x15')][_0x86e0('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x9c14f0){logger['info']('CreateCmHopper',_0x200276);logger['debug'](_0x86e0('0x1f'),_0x200276,JSON['stringify'](_0x9c14f0));_0x486695(_0x9c14f0);})[_0x86e0('0x12')](function(_0x20f493){logger['error'](_0x86e0('0x1f'),_0x20f493['message'],_0x200276);_0x4c2950(_0x287668['error'](0x1f4,_0x20f493[_0x86e0('0x11')]));});});};exports[_0x86e0('0x20')]=function(_0x4f90bb){var _0x1315ee=this;return new Promise(function(_0x4b4942,_0x22f903){return db[_0x86e0('0x1d')]['update'](_0x4f90bb['body'],{'raw':_0x4f90bb['options']?_0x4f90bb[_0x86e0('0x15')][_0x86e0('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f90bb[_0x86e0('0x15')]?_0x4f90bb['options'][_0x86e0('0x16')]||null:null,'attributes':_0x4f90bb[_0x86e0('0x15')]?_0x4f90bb['options'][_0x86e0('0x17')]||null:null,'limit':_0x4f90bb[_0x86e0('0x15')]?_0x4f90bb[_0x86e0('0x15')]['limit']||null:null})['then'](function(_0x22f198){logger[_0x86e0('0x9')](_0x86e0('0x20'),_0x4f90bb);logger[_0x86e0('0x9')](_0x86e0('0x21'),JSON[_0x86e0('0xe')](_0x4f90bb[_0x86e0('0x15')]['where']),_0x4f90bb[_0x86e0('0x22')][_0x86e0('0x23')]);logger[_0x86e0('0xc')](_0x86e0('0x20'),_0x4f90bb,JSON['stringify'](_0x22f198));_0x4b4942(_0x22f198);})['catch'](function(_0x2dff10){logger[_0x86e0('0xf')]('UpdateCmHopper',_0x2dff10['message'],_0x4f90bb);_0x22f903(_0x1315ee['error'](0x1f4,_0x2dff10['message']));});});};exports[_0x86e0('0x24')]=function(_0xd7590e){var _0x430dd2=this;return new Promise(function(_0x58719e,_0x593888){return db[_0x86e0('0x1d')][_0x86e0('0x25')]({'where':_0xd7590e[_0x86e0('0x15')]?_0xd7590e[_0x86e0('0x15')][_0x86e0('0x16')]||null:null})[_0x86e0('0x8')](function(_0x2530c2){logger[_0x86e0('0x9')](_0x86e0('0x24'),_0xd7590e);logger[_0x86e0('0xc')](_0x86e0('0x24'),_0xd7590e,JSON['stringify'](_0x2530c2));_0x58719e(_0x2530c2);})[_0x86e0('0x12')](function(_0xc76cb0){logger[_0x86e0('0xf')]('DestroyCmHopper',_0xc76cb0[_0x86e0('0x11')],_0xd7590e);_0x593888(_0x430dd2[_0x86e0('0xf')](0x1f4,_0xc76cb0[_0x86e0('0x11')]));});});};exports[_0x86e0('0x26')]=function(_0x4c945f){var _0x3b61e6=this;return new Promise(function(_0x10bb45,_0x164c0b){return db['CmContact'][_0x86e0('0x27')]()['then'](function(_0x15963c){return db[_0x86e0('0x28')][_0x86e0('0x29')](function(_0x2071af){return db[_0x86e0('0x1d')][_0x86e0('0x13')]({'where':_0x4c945f[_0x86e0('0x15')]?_0x4c945f['options'][_0x86e0('0x16')]||null:null,'attributes':_0x4c945f[_0x86e0('0x15')]?_0x4c945f[_0x86e0('0x15')]['attributes']||null:null,'limit':_0x4c945f[_0x86e0('0x15')]?_0x4c945f[_0x86e0('0x15')]['limit']||null:null,'order':_0x4c945f['options']?_0x4c945f['options'][_0x86e0('0x2a')]||null:null,'transaction':_0x2071af,'lock':_0x2071af['LOCK']['UPDATE'],'include':[{'model':db[_0x86e0('0x2b')],'as':'Contact','attributes':_[_0x86e0('0x2c')](_0x15963c)},{'model':db[_0x86e0('0x2d')],'as':_0x86e0('0x2e'),'attributes':['id',_0x86e0('0x2f'),'voicePause']}]})['then'](function(_0x51b38b){var _0x8c28e5=[];var _0x45eec3=[];for(var _0xaa1bbc=0x0;_0xaa1bbc<_0x51b38b[_0x86e0('0x30')];_0xaa1bbc+=0x1){var _0x28d0ca=_0x51b38b[_0xaa1bbc][_0x86e0('0x31')];if(_0x28d0ca===null){_0x8c28e5['push'](_0x51b38b[_0xaa1bbc]['update'](_0x4c945f[_0x86e0('0x22')],{'transaction':_0x2071af}));}else if(!_0x45eec3[_0x86e0('0x32')](_0x28d0ca)){_0x45eec3[_0x86e0('0x33')](_0x28d0ca);_0x8c28e5[_0x86e0('0x33')](_0x51b38b[_0xaa1bbc][_0x86e0('0x34')](_0x4c945f[_0x86e0('0x22')],{'transaction':_0x2071af}));}}return BPromise[_0x86e0('0x35')](_0x8c28e5);});})[_0x86e0('0x8')](function(_0x11b2d3){logger[_0x86e0('0x9')](_0x86e0('0x26'),_0x4c945f);if(_0x11b2d3[_0x86e0('0x30')]>0x0){logger[_0x86e0('0x9')](_0x86e0('0x36'),_0x11b2d3[0x0]['dataValues']['id'],_0x11b2d3[0x0][_0x86e0('0x37')][_0x86e0('0x38')],_0x11b2d3[0x0][_0x86e0('0x37')]['active']);}logger[_0x86e0('0xc')](_0x86e0('0x26'),_0x4c945f,JSON[_0x86e0('0xe')](_0x11b2d3));_0x10bb45(_0x11b2d3);})['catch'](function(_0x174191){logger['error'](_0x86e0('0x26'),_0x174191[_0x86e0('0x11')],_0x4c945f);_0x164c0b(_0x3b61e6[_0x86e0('0xf')](0x1f4,_0x174191['message']));});});});};exports[_0x86e0('0x39')]=function(_0x11769a){var _0x2c2d9e=this;return new Promise(function(_0x316829,_0x34ce48){return db[_0x86e0('0x28')][_0x86e0('0x29')](function(_0x27aa5b){return db['CmHopperFinal'][_0x86e0('0x3a')](_0x11769a[_0x86e0('0x22')],{'raw':_0x11769a[_0x86e0('0x15')]?_0x11769a[_0x86e0('0x15')]['raw']===undefined?!![]:![]:!![],'transaction':_0x27aa5b})[_0x86e0('0x8')](function(){logger['info'](_0x86e0('0x3b'),JSON[_0x86e0('0xe')](_0x11769a[_0x86e0('0x15')][_0x86e0('0x16')]),_0x11769a[_0x86e0('0x15')][_0x86e0('0x16')][_0x86e0('0x23')]);return db[_0x86e0('0x1d')][_0x86e0('0x25')]({'where':_0x11769a[_0x86e0('0x15')]?_0x11769a['options'][_0x86e0('0x16')]||null:null,'transaction':_0x27aa5b});});})[_0x86e0('0x8')](function(_0x2668fc){logger[_0x86e0('0x9')](_0x86e0('0x39'),_0x11769a);logger[_0x86e0('0xc')](_0x86e0('0x39'),_0x11769a,JSON['stringify'](_0x2668fc));_0x316829(_0x2668fc);})[_0x86e0('0x12')](function(_0x207f2b){logger[_0x86e0('0xf')]('MoveContactManagedDialer',_0x207f2b['message'],_0x11769a);_0x34ce48(_0x2c2d9e[_0x86e0('0xf')](0x1f4,_0x207f2b[_0x86e0('0x11')]));});});};exports[_0x86e0('0x3c')]=function(_0x37cafb){var _0x4d3888=this;return new Promise(function(_0x1e67ab,_0x16f97b){return db['CmHopper']['findAll']({'raw':_0x37cafb[_0x86e0('0x15')]?_0x37cafb[_0x86e0('0x15')][_0x86e0('0x14')]===undefined?!![]:![]:!![],'where':_0x37cafb['options']?_0x37cafb[_0x86e0('0x15')][_0x86e0('0x16')]||null:null,'attributes':[[db[_0x86e0('0x28')]['fn'](_0x86e0('0x3d'),db[_0x86e0('0x28')]['fn']('IF',db[_0x86e0('0x28')]['literal'](_0x86e0('0x3e')+util[_0x86e0('0x3f')](_0x86e0('0x40'),moment()[_0x86e0('0x3f')](_0x86e0('0x41')))+_0x86e0('0x42')))),_0x86e0('0x43')]]})[_0x86e0('0x8')](function(_0x273e94){logger[_0x86e0('0x9')](_0x86e0('0x3c'),_0x37cafb);logger[_0x86e0('0xc')](_0x86e0('0x3c'),_0x37cafb,JSON['stringify'](_0x273e94));_0x1e67ab(_0x273e94);})[_0x86e0('0x12')](function(_0x4f57e7){logger[_0x86e0('0xf')](_0x86e0('0x3c'),_0x4f57e7['message'],_0x37cafb);_0x16f97b(_0x4d3888[_0x86e0('0xf')](0x1f4,_0x4f57e7[_0x86e0('0x11')]));});});};exports[_0x86e0('0x44')]=function(_0x1b2a27){var _0x104736=this;return new Promise(function(_0x1a0e6b,_0x5f10a6){return db[_0x86e0('0x2b')][_0x86e0('0x27')]()[_0x86e0('0x8')](function(_0x4f0315){return db[_0x86e0('0x28')]['transaction'](function(_0x337c25){return db[_0x86e0('0x1d')]['findAll']({'where':_0x1b2a27[_0x86e0('0x15')]?_0x1b2a27[_0x86e0('0x15')][_0x86e0('0x16')]||null:null,'attributes':_0x1b2a27[_0x86e0('0x15')]?_0x1b2a27[_0x86e0('0x15')][_0x86e0('0x17')]||null:null,'limit':0x1,'order':_0x1b2a27[_0x86e0('0x15')]?_0x1b2a27[_0x86e0('0x15')][_0x86e0('0x2a')]||null:null,'group':db[_0x86e0('0x1d')][_0x86e0('0x31')],'transaction':_0x337c25,'lock':_0x337c25[_0x86e0('0x45')][_0x86e0('0x46')],'include':_0x1b2a27[_0x86e0('0x15')]?_0x1b2a27[_0x86e0('0x15')][_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x1b2a27['options'][_0x86e0('0x18')],function(_0x4273f4){return{'model':db[_0x4273f4[_0x86e0('0x1a')]],'as':_0x4273f4['as'],'attributes':_0x4273f4[_0x86e0('0x17')],'include':_0x4273f4[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x4273f4[_0x86e0('0x18')],function(_0x518c4e){return{'model':db[_0x518c4e[_0x86e0('0x1a')]],'as':_0x518c4e['as'],'attributes':_0x518c4e[_0x86e0('0x17')],'include':_0x518c4e[_0x86e0('0x18')]?_['map'](_0x518c4e[_0x86e0('0x18')],function(_0x569416){return{'model':db[_0x569416[_0x86e0('0x1a')]],'as':_0x569416['as'],'attributes':_0x569416[_0x86e0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x86e0('0x8')](function(_0x41d108){var _0x5b0b48=[];for(var _0x2115f8=0x0;_0x2115f8<_0x41d108[_0x86e0('0x30')];_0x2115f8+=0x1){_0x5b0b48[_0x86e0('0x33')](_0x41d108[_0x2115f8][_0x86e0('0x34')](_0x1b2a27[_0x86e0('0x22')],{'transaction':_0x337c25}));}return BPromise['all'](_0x5b0b48);});})[_0x86e0('0x8')](function(_0x2bb1a6){logger[_0x86e0('0x9')]('GetContactRecallMe',_0x1b2a27);logger[_0x86e0('0xc')](_0x86e0('0x44'),_0x1b2a27,JSON['stringify'](_0x2bb1a6));_0x1a0e6b(_0x2bb1a6);})[_0x86e0('0x12')](function(_0x3e9c81){logger[_0x86e0('0xf')](_0x86e0('0x44'),_0x3e9c81[_0x86e0('0x11')],_0x1b2a27);_0x5f10a6(_0x104736[_0x86e0('0xf')](0x1f4,_0x3e9c81['message']));});});});};exports[_0x86e0('0x47')]=function(_0x33f45e){var _0x5838ec=this;return new Promise(function(_0x1e7094,_0x176906){db[_0x86e0('0x2b')][_0x86e0('0x27')]()[_0x86e0('0x8')](function(_0x3d8c26){return db['CmHopper'][_0x86e0('0x13')]({'raw':_0x33f45e[_0x86e0('0x15')]?_0x33f45e[_0x86e0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x33f45e['options']?_0x33f45e[_0x86e0('0x15')]['where']||null:null,'attributes':_0x33f45e[_0x86e0('0x15')]?_0x33f45e[_0x86e0('0x15')][_0x86e0('0x17')]||null:null,'limit':_0x33f45e[_0x86e0('0x15')]?_0x33f45e[_0x86e0('0x15')][_0x86e0('0x48')]||null:null,'include':_0x33f45e['options']?_0x33f45e['options'][_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x33f45e[_0x86e0('0x15')][_0x86e0('0x18')],function(_0x46e06c){return{'model':db[_0x46e06c[_0x86e0('0x1a')]],'as':_0x46e06c['as'],'attributes':_0x46e06c['as']===_0x86e0('0x49')?_['keys'](_0x3d8c26):_0x46e06c[_0x86e0('0x17')],'include':_0x46e06c[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x46e06c[_0x86e0('0x18')],function(_0x4ce632){return{'model':db[_0x4ce632[_0x86e0('0x1a')]],'as':_0x4ce632['as'],'attributes':_0x4ce632['attributes'],'include':_0x4ce632[_0x86e0('0x18')]?_[_0x86e0('0x19')](_0x4ce632['include'],function(_0x280d06){return{'model':db[_0x280d06[_0x86e0('0x1a')]],'as':_0x280d06['as'],'attributes':_0x280d06[_0x86e0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x86e0('0x8')](function(_0x319a06){logger['info'](_0x86e0('0x1b'),_0x33f45e);logger[_0x86e0('0xc')](_0x86e0('0x1b'),_0x33f45e,JSON[_0x86e0('0xe')](_0x319a06));_0x1e7094(_0x319a06);})[_0x86e0('0x12')](function(_0x2f9439){logger[_0x86e0('0xf')](_0x86e0('0x1b'),_0x2f9439[_0x86e0('0x11')],_0x33f45e);_0x176906(_0x5838ec[_0x86e0('0xf')](0x1f4,_0x2f9439[_0x86e0('0x11')]));});});});};exports[_0x86e0('0x4a')]=function(_0x384967){var _0x5a73be=this;return new Promise(function(_0x51f3bd,_0x1717a8){return db[_0x86e0('0x2b')][_0x86e0('0x4b')]({'raw':!![],'where':{'phone':_0x384967[_0x86e0('0x15')][_0x86e0('0x16')][_0x86e0('0x4c')]},'attributes':['id',_0x86e0('0x4d')],'order':[['id',_0x86e0('0x4e')]]})[_0x86e0('0x8')](function(_0xa3be98){logger[_0x86e0('0x9')](_0x86e0('0x4f'),_0x384967);logger[_0x86e0('0xc')](_0x86e0('0x4f'),_0x384967,JSON[_0x86e0('0xe')](_0xa3be98));_0x51f3bd(_0xa3be98);})[_0x86e0('0x12')](function(_0x2a2705){logger[_0x86e0('0xf')]('getContactByPhone',_0x2a2705[_0x86e0('0x11')],_0x384967);_0x1717a8(_0x5a73be[_0x86e0('0xf')](0x1f4,_0x2a2705['message']));});});};exports[_0x86e0('0x50')]=function(_0x5c93ef){var _0x39e808=this;return new Promise(function(_0x231d6f,_0x4a95e5){return db[_0x86e0('0x28')][_0x86e0('0x29')](function(_0x10b043){return db[_0x86e0('0x1d')][_0x86e0('0x34')](_0x5c93ef[_0x86e0('0x22')],{'where':{},'transaction':_0x10b043})[_0x86e0('0x8')](function(_0x22fa70){logger[_0x86e0('0x9')]('ResetActiveCalls',_0x5c93ef);logger[_0x86e0('0xc')]('ResetActiveCalls',_0x5c93ef,JSON['stringify'](_0x22fa70));_0x231d6f(_0x22fa70);})[_0x86e0('0x12')](function(_0x5d5799){logger[_0x86e0('0xf')](_0x86e0('0x50'),_0x5d5799[_0x86e0('0x11')],_0x5c93ef);_0x4a95e5(_0x39e808[_0x86e0('0xf')](0x1f4,_0x5d5799[_0x86e0('0x11')]));});});});};exports[_0x86e0('0x51')]=function(_0x26b3fb){var _0x516fb2=this;var _0x363c6c=_0x26b3fb[_0x86e0('0x22')][_0x86e0('0x16')][_0x86e0('0x52')];var _0x1c92bf=_0x26b3fb[_0x86e0('0x22')][_0x86e0('0x16')][_0x86e0('0x53')];var _0x1dda92=_0x26b3fb[_0x86e0('0x22')]['where'][_0x86e0('0x54')];return new Promise(function(_0x1b6760,_0xd139ca){return db[_0x86e0('0x1d')][_0x86e0('0x13')]({'where':{'voiceQueueId':{'$in':_0x363c6c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x86e0('0x28')][_0x86e0('0x55')](_0x86e0('0x56')+_0x1c92bf+_0x86e0('0x57')),'$gt':db['sequelize'][_0x86e0('0x55')](_0x86e0('0x58'))}},'UserId':{'$in':_0x1dda92}},'include':[{'model':db[_0x86e0('0x2b')],'as':_0x86e0('0x49')},{'model':db[_0x86e0('0x2d')],'as':_0x86e0('0x2e'),'attributes':['id','name',_0x86e0('0x59')]},{'model':db[_0x86e0('0x5a')],'as':_0x86e0('0x5b')}]})[_0x86e0('0x8')](function(_0x31d706){if(_0x31d706[_0x86e0('0x30')]>0x0){return db[_0x86e0('0x28')][_0x86e0('0x29')](function(_0x1805cc){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x86e0('0x28')][_0x86e0('0x55')](_0x86e0('0x58'))},{'where':{'id':{'$in':_[_0x86e0('0x19')](_0x31d706,'id')}},'transaction':_0x1805cc})[_0x86e0('0x8')](function(){_0x1b6760(_0x31d706);})['catch'](function(_0x1121d1){logger[_0x86e0('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x1121d1[_0x86e0('0x11')],_0x26b3fb);_0xd139ca(_0x516fb2[_0x86e0('0xf')](0x1f4,_0x1121d1[_0x86e0('0x11')]));});})[_0x86e0('0x12')](function(_0x5baa08){logger['error'](_0x86e0('0x51'),_0x5baa08[_0x86e0('0x11')],_0x26b3fb);_0xd139ca(_0x516fb2[_0x86e0('0xf')](0x1f4,_0x5baa08[_0x86e0('0x11')]));});}else{_0x1b6760(_0x31d706);}});});}; \ No newline at end of file +var _0x2837=['GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','CmHopperFinal','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','LOCK','GetContactRecallMe','GetCmHopperPreview','CmContact','describe','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','lodash','util','moment','../../mysqldb','../../config/logger','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','map','include','attributes','model','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','transaction','order','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all'];(function(_0x4ee73d,_0x2ac6a5){var _0x556b7a=function(_0x4bc01b){while(--_0x4bc01b){_0x4ee73d['push'](_0x4ee73d['shift']());}};_0x556b7a(++_0x2ac6a5);}(_0x2837,0x12b));var _0x7283=function(_0x3c05f4,_0x55f1ba){_0x3c05f4=_0x3c05f4-0x0;var _0x4e02e1=_0x2837[_0x3c05f4];return _0x4e02e1;};'use strict';var _=require(_0x7283('0x0'));var util=require(_0x7283('0x1'));var moment=require(_0x7283('0x2'));var BPromise=require('bluebird');var db=require(_0x7283('0x3'))['db'];var logger=require(_0x7283('0x4'))('rpc');var jayson=require('jayson/promise');var client=jayson[_0x7283('0x5')][_0x7283('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xdc68e3,_0x4899f4,_0x30e082){return new BPromise(function(_0x5ee4f1,_0x2d7504){return client[_0x7283('0x7')](_0xdc68e3,_0x30e082)[_0x7283('0x8')](function(_0x1e560f){logger[_0x7283('0x9')](_0x7283('0xa'),_0x4899f4,_0x7283('0xb'));logger[_0x7283('0xc')](_0x7283('0xd'),_0x4899f4,_0x7283('0xb'),JSON[_0x7283('0xe')](_0x1e560f));if(_0x1e560f[_0x7283('0xf')]){if(_0x1e560f[_0x7283('0xf')][_0x7283('0x10')]===0x1f4){logger['error'](_0x7283('0xa'),_0x4899f4,_0x1e560f['error']['message']);return _0x2d7504(_0x1e560f[_0x7283('0xf')][_0x7283('0x11')]);}logger[_0x7283('0xf')](_0x7283('0xa'),_0x4899f4,_0x1e560f['error'][_0x7283('0x11')]);return _0x5ee4f1(_0x1e560f[_0x7283('0xf')][_0x7283('0x11')]);}else{logger[_0x7283('0x9')](_0x7283('0xa'),_0x4899f4,_0x7283('0xb'));_0x5ee4f1(_0x1e560f[_0x7283('0x12')]['message']);}})[_0x7283('0x13')](function(_0x28979f){logger[_0x7283('0xf')]('CmHopper,\x20%s,\x20%s',_0x4899f4,_0x28979f);_0x2d7504(_0x28979f);});});}exports[_0x7283('0x14')]=function(_0x2eead7){var _0x5b3d86=this;return new Promise(function(_0x4fa4ff,_0x395c81){return db['CmHopper'][_0x7283('0x15')]({'raw':_0x2eead7[_0x7283('0x16')]?_0x2eead7[_0x7283('0x16')][_0x7283('0x17')]===undefined?!![]:![]:!![],'where':_0x2eead7[_0x7283('0x16')]?_0x2eead7['options'][_0x7283('0x18')]||null:null,'attributes':_0x2eead7[_0x7283('0x16')]?_0x2eead7[_0x7283('0x16')]['attributes']||null:null,'limit':_0x2eead7[_0x7283('0x16')]?_0x2eead7[_0x7283('0x16')]['limit']||null:null,'include':_0x2eead7[_0x7283('0x16')]?_0x2eead7['options']['include']?_[_0x7283('0x19')](_0x2eead7[_0x7283('0x16')][_0x7283('0x1a')],function(_0x9e0198){return{'model':db[_0x9e0198['model']],'as':_0x9e0198['as'],'attributes':_0x9e0198[_0x7283('0x1b')],'include':_0x9e0198[_0x7283('0x1a')]?_[_0x7283('0x19')](_0x9e0198['include'],function(_0x1215e9){return{'model':db[_0x1215e9['model']],'as':_0x1215e9['as'],'attributes':_0x1215e9[_0x7283('0x1b')],'include':_0x1215e9[_0x7283('0x1a')]?_[_0x7283('0x19')](_0x1215e9[_0x7283('0x1a')],function(_0x212a8c){return{'model':db[_0x212a8c[_0x7283('0x1c')]],'as':_0x212a8c['as'],'attributes':_0x212a8c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7283('0x8')](function(_0x2d919d){logger[_0x7283('0x9')]('GetCmHopper',_0x2eead7);logger[_0x7283('0xc')](_0x7283('0x14'),_0x2eead7,JSON[_0x7283('0xe')](_0x2d919d));_0x4fa4ff(_0x2d919d);})[_0x7283('0x13')](function(_0x1c8a9c){logger[_0x7283('0xf')](_0x7283('0x14'),_0x1c8a9c[_0x7283('0x11')],_0x2eead7);_0x395c81(_0x5b3d86['error'](0x1f4,_0x1c8a9c['message']));});});};exports[_0x7283('0x1d')]=function(_0x4426fb){var _0x488b2d=this;return new Promise(function(_0x290fdf,_0x2e9940){return db[_0x7283('0x1e')][_0x7283('0x1f')]({'raw':_0x4426fb[_0x7283('0x16')]?_0x4426fb[_0x7283('0x16')][_0x7283('0x17')]===undefined?!![]:![]:!![],'where':_0x4426fb[_0x7283('0x16')]?_0x4426fb[_0x7283('0x16')][_0x7283('0x18')]||null:null,'attributes':_0x4426fb[_0x7283('0x16')]?_0x4426fb[_0x7283('0x16')][_0x7283('0x1b')]||null:null,'include':_0x4426fb['options']?_0x4426fb[_0x7283('0x16')][_0x7283('0x1a')]?_[_0x7283('0x19')](_0x4426fb[_0x7283('0x16')][_0x7283('0x1a')],function(_0xaa4f5){return{'model':db[_0xaa4f5[_0x7283('0x1c')]],'as':_0xaa4f5['as'],'attributes':_0xaa4f5[_0x7283('0x1b')],'include':_0xaa4f5[_0x7283('0x1a')]?_[_0x7283('0x19')](_0xaa4f5['include'],function(_0x3829a2){return{'model':db[_0x3829a2['model']],'as':_0x3829a2['as'],'attributes':_0x3829a2[_0x7283('0x1b')],'include':_0x3829a2[_0x7283('0x1a')]?_[_0x7283('0x19')](_0x3829a2[_0x7283('0x1a')],function(_0x54e703){return{'model':db[_0x54e703[_0x7283('0x1c')]],'as':_0x54e703['as'],'attributes':_0x54e703[_0x7283('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7283('0x8')](function(_0x5abd26){logger['info']('ShowCmHopper',_0x4426fb);logger[_0x7283('0xc')]('ShowCmHopper',_0x4426fb,JSON[_0x7283('0xe')](_0x5abd26));_0x290fdf(_0x5abd26);})[_0x7283('0x13')](function(_0xa780fb){logger['error']('ShowCmHopper',_0xa780fb[_0x7283('0x11')],_0x4426fb);_0x2e9940(_0x488b2d[_0x7283('0xf')](0x1f4,_0xa780fb[_0x7283('0x11')]));});});};exports[_0x7283('0x20')]=function(_0x32b60f){var _0x1ecc26=this;return new Promise(function(_0x1db344,_0x2d6d1c){return db['CmHopper'][_0x7283('0x21')](_0x32b60f[_0x7283('0x22')],{'raw':_0x32b60f[_0x7283('0x16')]?_0x32b60f['options']['raw']===undefined?!![]:![]:!![]})[_0x7283('0x8')](function(_0x345833){logger[_0x7283('0x9')](_0x7283('0x20'),_0x32b60f);logger[_0x7283('0xc')](_0x7283('0x20'),_0x32b60f,JSON[_0x7283('0xe')](_0x345833));_0x1db344(_0x345833);})[_0x7283('0x13')](function(_0x1483af){logger[_0x7283('0xf')](_0x7283('0x20'),_0x1483af[_0x7283('0x11')],_0x32b60f);_0x2d6d1c(_0x1ecc26[_0x7283('0xf')](0x1f4,_0x1483af[_0x7283('0x11')]));});});};exports[_0x7283('0x23')]=function(_0x5cb1b3){var _0x25d372=this;return new Promise(function(_0x84cdb6,_0xe9758c){return db[_0x7283('0x1e')][_0x7283('0x24')](_0x5cb1b3[_0x7283('0x22')],{'raw':_0x5cb1b3[_0x7283('0x16')]?_0x5cb1b3['options'][_0x7283('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cb1b3[_0x7283('0x16')]?_0x5cb1b3[_0x7283('0x16')][_0x7283('0x18')]||null:null,'attributes':_0x5cb1b3[_0x7283('0x16')]?_0x5cb1b3[_0x7283('0x16')][_0x7283('0x1b')]||null:null,'limit':_0x5cb1b3['options']?_0x5cb1b3[_0x7283('0x16')][_0x7283('0x25')]||null:null})[_0x7283('0x8')](function(_0x365c13){logger[_0x7283('0x9')](_0x7283('0x23'),_0x5cb1b3);logger[_0x7283('0x9')](_0x7283('0x26'),JSON[_0x7283('0xe')](_0x5cb1b3[_0x7283('0x16')][_0x7283('0x18')]),_0x5cb1b3[_0x7283('0x22')][_0x7283('0x27')]);logger[_0x7283('0xc')]('UpdateCmHopper',_0x5cb1b3,JSON[_0x7283('0xe')](_0x365c13));_0x84cdb6(_0x365c13);})['catch'](function(_0xae4ad2){logger[_0x7283('0xf')](_0x7283('0x23'),_0xae4ad2[_0x7283('0x11')],_0x5cb1b3);_0xe9758c(_0x25d372[_0x7283('0xf')](0x1f4,_0xae4ad2['message']));});});};exports[_0x7283('0x28')]=function(_0x1c027c){var _0x14ce6b=this;return new Promise(function(_0x46dcda,_0x568e02){return db['CmHopper'][_0x7283('0x29')]({'where':_0x1c027c[_0x7283('0x16')]?_0x1c027c[_0x7283('0x16')][_0x7283('0x18')]||null:null})[_0x7283('0x8')](function(_0x57f9ed){logger[_0x7283('0x9')](_0x7283('0x28'),_0x1c027c);logger[_0x7283('0xc')](_0x7283('0x28'),_0x1c027c,JSON[_0x7283('0xe')](_0x57f9ed));_0x46dcda(_0x57f9ed);})['catch'](function(_0x116216){logger[_0x7283('0xf')]('DestroyCmHopper',_0x116216['message'],_0x1c027c);_0x568e02(_0x14ce6b[_0x7283('0xf')](0x1f4,_0x116216[_0x7283('0x11')]));});});};exports[_0x7283('0x2a')]=function(_0x116106){var _0x58b857=this;return new Promise(function(_0x17c6d0,_0x4005c9){return db['CmContact']['describe']()[_0x7283('0x8')](function(_0x2da548){return db['sequelize'][_0x7283('0x2b')](function(_0x3efacd){return db[_0x7283('0x1e')][_0x7283('0x15')]({'where':_0x116106[_0x7283('0x16')]?_0x116106[_0x7283('0x16')][_0x7283('0x18')]||null:null,'attributes':_0x116106[_0x7283('0x16')]?_0x116106[_0x7283('0x16')][_0x7283('0x1b')]||null:null,'limit':_0x116106['options']?_0x116106[_0x7283('0x16')][_0x7283('0x25')]||null:null,'order':_0x116106[_0x7283('0x16')]?_0x116106[_0x7283('0x16')][_0x7283('0x2c')]||null:null,'transaction':_0x3efacd,'lock':_0x3efacd['LOCK'][_0x7283('0x2d')],'include':[{'model':db['CmContact'],'as':_0x7283('0x2e'),'attributes':_[_0x7283('0x2f')](_0x2da548)},{'model':db[_0x7283('0x30')],'as':_0x7283('0x31'),'attributes':['id',_0x7283('0x32'),_0x7283('0x33')]}]})[_0x7283('0x8')](function(_0x3ae740){var _0x22d67e=[];var _0x94efee=[];for(var _0x492188=0x0;_0x492188<_0x3ae740[_0x7283('0x34')];_0x492188+=0x1){var _0x5bbc2f=_0x3ae740[_0x492188][_0x7283('0x35')];if(_0x5bbc2f===null){_0x22d67e['push'](_0x3ae740[_0x492188][_0x7283('0x24')](_0x116106['body'],{'transaction':_0x3efacd}));}else if(!_0x94efee[_0x7283('0x36')](_0x5bbc2f)){_0x94efee[_0x7283('0x37')](_0x5bbc2f);_0x22d67e[_0x7283('0x37')](_0x3ae740[_0x492188][_0x7283('0x24')](_0x116106['body'],{'transaction':_0x3efacd}));}}return BPromise[_0x7283('0x38')](_0x22d67e);});})[_0x7283('0x8')](function(_0x1ebaa5){logger[_0x7283('0x9')](_0x7283('0x2a'),_0x116106);if(_0x1ebaa5[_0x7283('0x34')]>0x0){logger[_0x7283('0x9')](_0x7283('0x39'),_0x1ebaa5[0x0][_0x7283('0x3a')]['id'],_0x1ebaa5[0x0][_0x7283('0x3a')]['ContactId'],_0x1ebaa5[0x0][_0x7283('0x3a')]['active']);}logger[_0x7283('0xc')](_0x7283('0x2a'),_0x116106,JSON[_0x7283('0xe')](_0x1ebaa5));_0x17c6d0(_0x1ebaa5);})[_0x7283('0x13')](function(_0xc2254f){logger[_0x7283('0xf')](_0x7283('0x2a'),_0xc2254f[_0x7283('0x11')],_0x116106);_0x4005c9(_0x58b857['error'](0x1f4,_0xc2254f[_0x7283('0x11')]));});});});};exports[_0x7283('0x3b')]=function(_0x244904){var _0x386849=this;return new Promise(function(_0x4892c5,_0x2d778c){return db[_0x7283('0x3c')][_0x7283('0x2b')](function(_0x180be4){return db[_0x7283('0x3d')][_0x7283('0x21')](_0x244904[_0x7283('0x22')],{'raw':_0x244904[_0x7283('0x16')]?_0x244904[_0x7283('0x16')][_0x7283('0x17')]===undefined?!![]:![]:!![],'transaction':_0x180be4})[_0x7283('0x8')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x244904['options'][_0x7283('0x18')]),_0x244904[_0x7283('0x16')][_0x7283('0x18')][_0x7283('0x27')]);return db['CmHopper'][_0x7283('0x29')]({'where':_0x244904[_0x7283('0x16')]?_0x244904[_0x7283('0x16')][_0x7283('0x18')]||null:null,'transaction':_0x180be4});});})['then'](function(_0x3979b6){logger[_0x7283('0x9')](_0x7283('0x3b'),_0x244904);logger[_0x7283('0xc')]('MoveContactManagedDialer',_0x244904,JSON[_0x7283('0xe')](_0x3979b6));_0x4892c5(_0x3979b6);})[_0x7283('0x13')](function(_0x28962e){logger['error'](_0x7283('0x3b'),_0x28962e[_0x7283('0x11')],_0x244904);_0x2d778c(_0x386849[_0x7283('0xf')](0x1f4,_0x28962e[_0x7283('0x11')]));});});};exports['CountReScheduled']=function(_0x3510b3){var _0x4905c1=this;return new Promise(function(_0x10c0ca,_0x488301){return db[_0x7283('0x1e')][_0x7283('0x15')]({'raw':_0x3510b3[_0x7283('0x16')]?_0x3510b3[_0x7283('0x16')][_0x7283('0x17')]===undefined?!![]:![]:!![],'where':_0x3510b3[_0x7283('0x16')]?_0x3510b3[_0x7283('0x16')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x7283('0x3e'),db[_0x7283('0x3c')]['fn']('IF',db[_0x7283('0x3c')]['literal'](_0x7283('0x3f')+util[_0x7283('0x40')](_0x7283('0x41'),moment()[_0x7283('0x40')](_0x7283('0x42')))+_0x7283('0x43')))),_0x7283('0x44')]]})[_0x7283('0x8')](function(_0xa6392c){logger[_0x7283('0x9')](_0x7283('0x45'),_0x3510b3);logger[_0x7283('0xc')](_0x7283('0x45'),_0x3510b3,JSON['stringify'](_0xa6392c));_0x10c0ca(_0xa6392c);})[_0x7283('0x13')](function(_0x37d282){logger[_0x7283('0xf')](_0x7283('0x45'),_0x37d282[_0x7283('0x11')],_0x3510b3);_0x488301(_0x4905c1[_0x7283('0xf')](0x1f4,_0x37d282[_0x7283('0x11')]));});});};exports['GetContactRecallMe']=function(_0x3ae9af){var _0x4f6f65=this;return new Promise(function(_0x4cae17,_0x2f25ef){return db['CmContact']['describe']()[_0x7283('0x8')](function(_0x30ce13){return db[_0x7283('0x3c')]['transaction'](function(_0x13cae2){return db[_0x7283('0x1e')][_0x7283('0x15')]({'where':_0x3ae9af[_0x7283('0x16')]?_0x3ae9af[_0x7283('0x16')][_0x7283('0x18')]||null:null,'attributes':_0x3ae9af[_0x7283('0x16')]?_0x3ae9af[_0x7283('0x16')][_0x7283('0x1b')]||null:null,'limit':0x1,'order':_0x3ae9af[_0x7283('0x16')]?_0x3ae9af[_0x7283('0x16')][_0x7283('0x2c')]||null:null,'group':db[_0x7283('0x1e')]['UserId'],'transaction':_0x13cae2,'lock':_0x13cae2[_0x7283('0x46')][_0x7283('0x2d')],'include':_0x3ae9af[_0x7283('0x16')]?_0x3ae9af[_0x7283('0x16')]['include']?_[_0x7283('0x19')](_0x3ae9af[_0x7283('0x16')][_0x7283('0x1a')],function(_0x2c8245){return{'model':db[_0x2c8245[_0x7283('0x1c')]],'as':_0x2c8245['as'],'attributes':_0x2c8245['attributes'],'include':_0x2c8245[_0x7283('0x1a')]?_[_0x7283('0x19')](_0x2c8245['include'],function(_0x57e163){return{'model':db[_0x57e163[_0x7283('0x1c')]],'as':_0x57e163['as'],'attributes':_0x57e163[_0x7283('0x1b')],'include':_0x57e163[_0x7283('0x1a')]?_[_0x7283('0x19')](_0x57e163[_0x7283('0x1a')],function(_0x433642){return{'model':db[_0x433642[_0x7283('0x1c')]],'as':_0x433642['as'],'attributes':_0x433642[_0x7283('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7283('0x8')](function(_0x3ae036){var _0x42e180=[];for(var _0x4bf69b=0x0;_0x4bf69b<_0x3ae036[_0x7283('0x34')];_0x4bf69b+=0x1){_0x42e180[_0x7283('0x37')](_0x3ae036[_0x4bf69b][_0x7283('0x24')](_0x3ae9af['body'],{'transaction':_0x13cae2}));}return BPromise[_0x7283('0x38')](_0x42e180);});})[_0x7283('0x8')](function(_0x20d453){logger[_0x7283('0x9')](_0x7283('0x47'),_0x3ae9af);logger[_0x7283('0xc')](_0x7283('0x47'),_0x3ae9af,JSON[_0x7283('0xe')](_0x20d453));_0x4cae17(_0x20d453);})[_0x7283('0x13')](function(_0x29aa7c){logger['error']('GetContactRecallMe',_0x29aa7c[_0x7283('0x11')],_0x3ae9af);_0x2f25ef(_0x4f6f65[_0x7283('0xf')](0x1f4,_0x29aa7c[_0x7283('0x11')]));});});});};exports[_0x7283('0x48')]=function(_0x5e2d60){var _0xd17c40=this;return new Promise(function(_0x9a9ef,_0x480de2){db[_0x7283('0x49')][_0x7283('0x4a')]()[_0x7283('0x8')](function(_0x121471){return db[_0x7283('0x1e')]['findAll']({'raw':_0x5e2d60[_0x7283('0x16')]?_0x5e2d60['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e2d60['options']?_0x5e2d60[_0x7283('0x16')]['where']||null:null,'attributes':_0x5e2d60[_0x7283('0x16')]?_0x5e2d60[_0x7283('0x16')]['attributes']||null:null,'limit':_0x5e2d60['options']?_0x5e2d60[_0x7283('0x16')][_0x7283('0x25')]||null:null,'include':_0x5e2d60[_0x7283('0x16')]?_0x5e2d60[_0x7283('0x16')][_0x7283('0x1a')]?_['map'](_0x5e2d60['options'][_0x7283('0x1a')],function(_0x3ba2fb){return{'model':db[_0x3ba2fb[_0x7283('0x1c')]],'as':_0x3ba2fb['as'],'attributes':_0x3ba2fb['as']==='Contact'?_[_0x7283('0x2f')](_0x121471):_0x3ba2fb[_0x7283('0x1b')],'include':_0x3ba2fb[_0x7283('0x1a')]?_[_0x7283('0x19')](_0x3ba2fb[_0x7283('0x1a')],function(_0x5e7c91){return{'model':db[_0x5e7c91['model']],'as':_0x5e7c91['as'],'attributes':_0x5e7c91[_0x7283('0x1b')],'include':_0x5e7c91[_0x7283('0x1a')]?_['map'](_0x5e7c91[_0x7283('0x1a')],function(_0x31bff3){return{'model':db[_0x31bff3[_0x7283('0x1c')]],'as':_0x31bff3['as'],'attributes':_0x31bff3[_0x7283('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7283('0x8')](function(_0x39d4a8){logger[_0x7283('0x9')]('GetCmHopper',_0x5e2d60);logger[_0x7283('0xc')](_0x7283('0x14'),_0x5e2d60,JSON['stringify'](_0x39d4a8));_0x9a9ef(_0x39d4a8);})['catch'](function(_0x1e6aa9){logger[_0x7283('0xf')](_0x7283('0x14'),_0x1e6aa9[_0x7283('0x11')],_0x5e2d60);_0x480de2(_0xd17c40['error'](0x1f4,_0x1e6aa9[_0x7283('0x11')]));});});});};exports[_0x7283('0x4b')]=function(_0x188533){var _0x5cfba3=this;return new Promise(function(_0x3e8b44,_0x445a87){return db[_0x7283('0x49')][_0x7283('0x4c')]({'raw':!![],'where':{'phone':_0x188533[_0x7283('0x16')][_0x7283('0x18')][_0x7283('0x4d')]},'attributes':['id','dialTimezone'],'order':[['id',_0x7283('0x4e')]]})[_0x7283('0x8')](function(_0xe67015){logger[_0x7283('0x9')](_0x7283('0x4f'),_0x188533);logger[_0x7283('0xc')]('getContactByPhone',_0x188533,JSON[_0x7283('0xe')](_0xe67015));_0x3e8b44(_0xe67015);})[_0x7283('0x13')](function(_0x4f91a1){logger[_0x7283('0xf')]('getContactByPhone',_0x4f91a1['message'],_0x188533);_0x445a87(_0x5cfba3['error'](0x1f4,_0x4f91a1[_0x7283('0x11')]));});});};exports['ResetActiveCalls']=function(_0x96e3f8){var _0x545e90=this;return new Promise(function(_0x192427,_0x48a807){return db[_0x7283('0x3c')][_0x7283('0x2b')](function(_0x242d13){return db[_0x7283('0x1e')]['update']({'active':![]},{'where':{},'transaction':_0x242d13})[_0x7283('0x8')](function(_0xbf5f0c){logger['info']('ResetActiveCalls',_0x96e3f8);logger[_0x7283('0xc')](_0x7283('0x50'),_0x96e3f8,JSON[_0x7283('0xe')](_0xbf5f0c));_0x192427(_0xbf5f0c);})[_0x7283('0x13')](function(_0x250c61){logger[_0x7283('0xf')](_0x7283('0x50'),_0x250c61[_0x7283('0x11')],_0x96e3f8);_0x48a807(_0x545e90[_0x7283('0xf')](0x1f4,_0x250c61['message']));});});});};exports[_0x7283('0x51')]=function(_0x21b174){var _0x1ed744=this;var _0x2de750=_0x21b174[_0x7283('0x22')]['where'][_0x7283('0x52')];var _0x2ed431=_0x21b174[_0x7283('0x22')][_0x7283('0x18')]['interval'];var _0x394ebe=_0x21b174[_0x7283('0x22')]['where'][_0x7283('0x53')];return new Promise(function(_0x3612ac,_0x1f16c8){return db['CmHopper'][_0x7283('0x15')]({'where':{'voiceQueueId':{'$in':_0x2de750},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7283('0x3c')][_0x7283('0x54')](_0x7283('0x55')+_0x2ed431+'\x20MINUTE'),'$gt':db[_0x7283('0x3c')]['literal'](_0x7283('0x56'))}},'UserId':{'$in':_0x394ebe}},'include':[{'model':db[_0x7283('0x49')],'as':_0x7283('0x2e')},{'model':db[_0x7283('0x30')],'as':_0x7283('0x31'),'attributes':['id',_0x7283('0x32'),'voicePause']},{'model':db[_0x7283('0x57')],'as':_0x7283('0x58')}]})[_0x7283('0x8')](function(_0x11958e){if(_0x11958e[_0x7283('0x34')]>0x0){return db[_0x7283('0x3c')]['transaction'](function(_0x578671){return db[_0x7283('0x1e')][_0x7283('0x24')]({'recallmeNotifiedDate':db[_0x7283('0x3c')][_0x7283('0x54')](_0x7283('0x56'))},{'where':{'id':{'$in':_['map'](_0x11958e,'id')}},'transaction':_0x578671})[_0x7283('0x8')](function(){_0x3612ac(_0x11958e);})[_0x7283('0x13')](function(_0xf02217){logger[_0x7283('0xf')](_0x7283('0x51'),_0xf02217[_0x7283('0x11')],_0x21b174);_0x1f16c8(_0x1ed744[_0x7283('0xf')](0x1f4,_0xf02217['message']));});})[_0x7283('0x13')](function(_0x3ae432){logger[_0x7283('0xf')](_0x7283('0x51'),_0x3ae432['message'],_0x21b174);_0x1f16c8(_0x1ed744['error'](0x1f4,_0x3ae432[_0x7283('0x11')]));});}else{_0x3612ac(_0x11958e);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index da05bee..80221b1 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 _0x2690=['/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','express','Router','./cmHopper.controller','get','/describe','isAuthenticated','describe','getTimezones','/:id','show'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x2690,0xfa));var _0x0269=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x2690[_0x32b122];return _0x4ad25a;};'use strict';var express=require(_0x0269('0x0'));var router=express[_0x0269('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x0269('0x2'));router[_0x0269('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0269('0x3')](_0x0269('0x4'),auth[_0x0269('0x5')](),controller[_0x0269('0x6')]);router['get']('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router['get']('/timezones',auth[_0x0269('0x5')](),controller[_0x0269('0x7')]);router[_0x0269('0x3')](_0x0269('0x8'),auth[_0x0269('0x5')](),controller[_0x0269('0x9')]);router[_0x0269('0x3')](_0x0269('0xa'),auth[_0x0269('0x5')](),controller[_0x0269('0xb')]);router[_0x0269('0xc')]('/',auth[_0x0269('0x5')](),controller[_0x0269('0xd')]);router['post'](_0x0269('0xe'),auth['isAuthenticated'](),controller[_0x0269('0xf')]);router[_0x0269('0xc')]('/timezone',auth[_0x0269('0x5')](),controller[_0x0269('0x10')]);router[_0x0269('0x11')](_0x0269('0x8'),auth[_0x0269('0x5')](),controller[_0x0269('0x12')]);router[_0x0269('0x13')](_0x0269('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xccd3=['update','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','create','post','getPreview','/timezone','getTimezone','put'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xccd3,0x1a5));var _0x3ccd=function(_0x551d68,_0x47cf2a){_0x551d68=_0x551d68-0x0;var _0x1db586=_0xccd3[_0x551d68];return _0x1db586;};'use strict';var express=require(_0x3ccd('0x0'));var router=express[_0x3ccd('0x1')]();var auth=require(_0x3ccd('0x2'));var controller=require('./cmHopper.controller');router[_0x3ccd('0x3')]('/',auth[_0x3ccd('0x4')](),controller['index']);router[_0x3ccd('0x3')](_0x3ccd('0x5'),auth[_0x3ccd('0x4')](),controller[_0x3ccd('0x6')]);router[_0x3ccd('0x3')](_0x3ccd('0x7'),auth[_0x3ccd('0x4')](),controller[_0x3ccd('0x8')]);router[_0x3ccd('0x3')]('/timezones',auth[_0x3ccd('0x4')](),controller[_0x3ccd('0x9')]);router[_0x3ccd('0x3')](_0x3ccd('0xa'),auth[_0x3ccd('0x4')](),controller['show']);router[_0x3ccd('0x3')](_0x3ccd('0xb'),auth[_0x3ccd('0x4')](),controller[_0x3ccd('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3ccd('0xd')]);router[_0x3ccd('0xe')]('/preview',auth[_0x3ccd('0x4')](),controller[_0x3ccd('0xf')]);router['post'](_0x3ccd('0x10'),auth[_0x3ccd('0x4')](),controller[_0x3ccd('0x11')]);router[_0x3ccd('0x12')](_0x3ccd('0xa'),auth[_0x3ccd('0x4')](),controller[_0x3ccd('0x13')]);router['delete'](_0x3ccd('0xa'),auth['isAuthenticated'](),controller[_0x3ccd('0x14')]);module[_0x3ccd('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 14e73fb..bb24dfb 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e22=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x8e22,0x15b));var _0x28e2=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x8e22[_0x471a85];return _0x5f2039;};'use strict';var moment=require(_0x28e2('0x0'));var Sequelize=require(_0x28e2('0x1'));module[_0x28e2('0x2')]={'CmHopperId':{'type':Sequelize[_0x28e2('0x3')]},'phone':{'type':Sequelize[_0x28e2('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x28e2('0x5')],'defaultValue':moment()[_0x28e2('0x6')](_0x28e2('0x7'))},'countbusyretry':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2205=['moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x4f71a1,_0x371447){var _0x2a416f=function(_0x228c9f){while(--_0x228c9f){_0x4f71a1['push'](_0x4f71a1['shift']());}};_0x2a416f(++_0x371447);}(_0x2205,0x18f));var _0x5220=function(_0x22c400,_0x4823e6){_0x22c400=_0x22c400-0x0;var _0x1b49b7=_0x2205[_0x22c400];return _0x1b49b7;};'use strict';var moment=require(_0x5220('0x0'));var Sequelize=require(_0x5220('0x1'));module[_0x5220('0x2')]={'CmHopperId':{'type':Sequelize[_0x5220('0x3')]},'phone':{'type':Sequelize[_0x5220('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5220('0x5')],'defaultValue':moment()[_0x5220('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5220('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index e11d5f3..2937f89 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f6d=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','destroy','error','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','name','findAll','rows','catch','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x2f6d,0x198));var _0xd2f6=function(_0x4ce84c,_0x56b698){_0x4ce84c=_0x4ce84c-0x0;var _0x3a4601=_0x2f6d[_0x4ce84c];return _0x3a4601;};'use strict';var emlformat=require(_0xd2f6('0x0'));var rimraf=require(_0xd2f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2f6('0x2'));var rp=require(_0xd2f6('0x3'));var moment=require(_0xd2f6('0x4'));var BPromise=require(_0xd2f6('0x5'));var Mustache=require(_0xd2f6('0x6'));var util=require(_0xd2f6('0x7'));var path=require(_0xd2f6('0x8'));var sox=require(_0xd2f6('0x9'));var csv=require('to-csv');var ejs=require(_0xd2f6('0xa'));var fs=require('fs');var fs_extra=require(_0xd2f6('0xb'));var _=require(_0xd2f6('0xc'));var squel=require(_0xd2f6('0xd'));var crypto=require('crypto');var jsforce=require(_0xd2f6('0xe'));var deskjs=require(_0xd2f6('0xf'));var toCsv=require(_0xd2f6('0x10'));var querystring=require('querystring');var Papa=require(_0xd2f6('0x11'));var Redis=require(_0xd2f6('0x12'));var authService=require(_0xd2f6('0x13'));var qs=require(_0xd2f6('0x14'));var as=require(_0xd2f6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2f6('0x16'))(_0xd2f6('0x17'));var utils=require('../../config/utils');var config=require(_0xd2f6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2f6('0x19'))['db'];function respondWithStatusCode(_0x8ecf6f,_0x44d358){_0x44d358=_0x44d358||0xcc;return function(_0xd8477e){if(_0xd8477e){return _0x8ecf6f[_0xd2f6('0x1a')](_0x44d358);}return _0x8ecf6f[_0xd2f6('0x1b')](_0x44d358)[_0xd2f6('0x1c')]();};}function respondWithResult(_0x1af16c,_0x1eb044){_0x1eb044=_0x1eb044||0xc8;return function(_0x179477){if(_0x179477){return _0x1af16c['status'](_0x1eb044)[_0xd2f6('0x1d')](_0x179477);}};}function respondWithFilteredResult(_0x595c8e,_0x26674a){return function(_0x19bd42){if(_0x19bd42){var _0x42181f=typeof _0x26674a[_0xd2f6('0x1e')]===_0xd2f6('0x1f')&&typeof _0x26674a[_0xd2f6('0x20')]==='undefined';var _0x329155=_0x19bd42['count'];var _0x5460bd=_0x42181f?0x0:_0x26674a[_0xd2f6('0x1e')];var _0x3bcfc1=_0x42181f?_0x19bd42[_0xd2f6('0x21')]:_0x26674a['offset']+_0x26674a[_0xd2f6('0x20')];var _0xacafe1;if(_0x3bcfc1>=_0x329155){_0x3bcfc1=_0x329155;_0xacafe1=0xc8;}else{_0xacafe1=0xce;}_0x595c8e['status'](_0xacafe1);return _0x595c8e['set'](_0xd2f6('0x22'),_0x5460bd+'-'+_0x3bcfc1+'/'+_0x329155)[_0xd2f6('0x1d')](_0x19bd42);}return null;};}function patchUpdates(_0x53213c){return function(_0x1833aa){try{jsonpatch[_0xd2f6('0x23')](_0x1833aa,_0x53213c,!![]);}catch(_0x4d29c6){return BPromise['reject'](_0x4d29c6);}return _0x1833aa[_0xd2f6('0x24')]();};}function saveUpdates(_0x5d86bc,_0x2bdd3c){return function(_0x59cd13){if(_0x59cd13){return _0x59cd13[_0xd2f6('0x25')](_0x5d86bc)[_0xd2f6('0x26')](function(_0x493365){return _0x493365;});}return null;};}function removeEntity(_0x1dd70e,_0x1da89a){return function(_0xa3fde6){if(_0xa3fde6){return _0xa3fde6['destroy']()['then'](function(){var _0x4b0784=_0xa3fde6[_0xd2f6('0x27')]({'plain':!![]});var _0x503926='CmHopperAdditionalPhones';return db['UserProfileResource'][_0xd2f6('0x28')]({'where':{'type':_0x503926,'resourceId':_0x4b0784['id']}})[_0xd2f6('0x26')](function(){return _0xa3fde6;});})['then'](function(){_0x1dd70e[_0xd2f6('0x1b')](0xcc)[_0xd2f6('0x1c')]();});}};}function handleEntityNotFound(_0x427555,_0x44bcc1){return function(_0x20a930){if(!_0x20a930){_0x427555[_0xd2f6('0x1a')](0x194);}return _0x20a930;};}function handleError(_0x590240,_0x304f4a){_0x304f4a=_0x304f4a||0x1f4;return function(_0xbb9c4a){logger[_0xd2f6('0x29')](_0xbb9c4a['stack']);if(_0xbb9c4a['name']){delete _0xbb9c4a['name'];}_0x590240[_0xd2f6('0x1b')](_0x304f4a)['send'](_0xbb9c4a);};}exports[_0xd2f6('0x2a')]=function(_0x4fa166,_0x381abd){var _0x1d7055={},_0x3437d6={},_0x164930={'count':0x0,'rows':[]};var _0x2570ed=_[_0xd2f6('0x2b')](db[_0xd2f6('0x2c')][_0xd2f6('0x2d')],function(_0x51a9e5){return{'name':_0x51a9e5[_0xd2f6('0x2e')],'type':_0x51a9e5[_0xd2f6('0x2f')][_0xd2f6('0x30')]};});_0x3437d6[_0xd2f6('0x31')]=_[_0xd2f6('0x2b')](_0x2570ed,'name');_0x3437d6[_0xd2f6('0x32')]=_[_0xd2f6('0x33')](_0x4fa166[_0xd2f6('0x32')]);_0x3437d6[_0xd2f6('0x34')]=_[_0xd2f6('0x35')](_0x3437d6['model'],_0x3437d6[_0xd2f6('0x32')]);_0x1d7055[_0xd2f6('0x36')]=_['intersection'](_0x3437d6[_0xd2f6('0x31')],qs['fields'](_0x4fa166[_0xd2f6('0x32')][_0xd2f6('0x37')]));_0x1d7055[_0xd2f6('0x36')]=_0x1d7055[_0xd2f6('0x36')][_0xd2f6('0x38')]?_0x1d7055[_0xd2f6('0x36')]:_0x3437d6[_0xd2f6('0x31')];if(!_0x4fa166[_0xd2f6('0x32')][_0xd2f6('0x39')]('nolimit')){_0x1d7055[_0xd2f6('0x20')]=qs['limit'](_0x4fa166['query'][_0xd2f6('0x20')]);_0x1d7055[_0xd2f6('0x1e')]=qs[_0xd2f6('0x1e')](_0x4fa166['query'][_0xd2f6('0x1e')]);}_0x1d7055[_0xd2f6('0x3a')]=qs['sort'](_0x4fa166['query'][_0xd2f6('0x3b')]);_0x1d7055[_0xd2f6('0x3c')]=qs[_0xd2f6('0x34')](_['pick'](_0x4fa166[_0xd2f6('0x32')],_0x3437d6[_0xd2f6('0x34')]),_0x2570ed);if(_0x4fa166['query'][_0xd2f6('0x3d')]){_0x1d7055[_0xd2f6('0x3c')]=_[_0xd2f6('0x3e')](_0x1d7055[_0xd2f6('0x3c')],{'$or':_[_0xd2f6('0x2b')](_0x2570ed,function(_0x732961){if(_0x732961[_0xd2f6('0x2f')]!==_0xd2f6('0x3f')){var _0x96176a={};_0x96176a[_0x732961[_0xd2f6('0x40')]]={'$like':'%'+_0x4fa166['query'][_0xd2f6('0x3d')]+'%'};return _0x96176a;}})});}_0x1d7055=_['merge']({},_0x1d7055,_0x4fa166['options']);var _0x1e9104={'where':_0x1d7055[_0xd2f6('0x3c')]};return db[_0xd2f6('0x2c')][_0xd2f6('0x21')](_0x1e9104)[_0xd2f6('0x26')](function(_0x47a751){_0x164930['count']=_0x47a751;if(_0x4fa166['query']['includeAll']){_0x1d7055['include']=[{'all':!![]}];}return db[_0xd2f6('0x2c')][_0xd2f6('0x41')](_0x1d7055);})[_0xd2f6('0x26')](function(_0x1df157){_0x164930[_0xd2f6('0x42')]=_0x1df157;return _0x164930;})[_0xd2f6('0x26')](respondWithFilteredResult(_0x381abd,_0x1d7055))[_0xd2f6('0x43')](handleError(_0x381abd,null));};exports['show']=function(_0x39466d,_0x1647eb){var _0x45681e={'raw':!![],'where':{'id':_0x39466d[_0xd2f6('0x44')]['id']}},_0x32a503={};_0x32a503[_0xd2f6('0x31')]=_[_0xd2f6('0x33')](db['CmHopperAdditionalPhone'][_0xd2f6('0x2d')]);_0x32a503[_0xd2f6('0x32')]=_['keys'](_0x39466d[_0xd2f6('0x32')]);_0x32a503[_0xd2f6('0x34')]=_[_0xd2f6('0x35')](_0x32a503[_0xd2f6('0x31')],_0x32a503[_0xd2f6('0x32')]);_0x45681e[_0xd2f6('0x36')]=_[_0xd2f6('0x35')](_0x32a503[_0xd2f6('0x31')],qs[_0xd2f6('0x37')](_0x39466d[_0xd2f6('0x32')][_0xd2f6('0x37')]));_0x45681e[_0xd2f6('0x36')]=_0x45681e[_0xd2f6('0x36')][_0xd2f6('0x38')]?_0x45681e[_0xd2f6('0x36')]:_0x32a503[_0xd2f6('0x31')];if(_0x39466d[_0xd2f6('0x32')][_0xd2f6('0x45')]){_0x45681e['include']=[{'all':!![]}];}_0x45681e=_['merge']({},_0x45681e,_0x39466d[_0xd2f6('0x46')]);return db[_0xd2f6('0x2c')][_0xd2f6('0x47')](_0x45681e)['then'](handleEntityNotFound(_0x1647eb,null))['then'](respondWithResult(_0x1647eb,null))[_0xd2f6('0x43')](handleError(_0x1647eb,null));};exports[_0xd2f6('0x48')]=function(_0x29bee5,_0x4fdedb){return db[_0xd2f6('0x2c')][_0xd2f6('0x48')](_0x29bee5[_0xd2f6('0x49')],{})[_0xd2f6('0x26')](function(_0x21f3cf){var _0x3dff0a=_0x29bee5['user'][_0xd2f6('0x27')]({'plain':!![]});if(!_0x3dff0a)throw new Error(_0xd2f6('0x4a'));if(_0x3dff0a[_0xd2f6('0x4b')]==='user'){var _0x345c28=_0x21f3cf[_0xd2f6('0x27')]({'plain':!![]});var _0x403bb5=_0xd2f6('0x4c');return db[_0xd2f6('0x4d')][_0xd2f6('0x47')]({'where':{'name':_0x403bb5,'userProfileId':_0x3dff0a[_0xd2f6('0x4e')]},'raw':!![]})['then'](function(_0x5b9d9c){if(_0x5b9d9c&&_0x5b9d9c[_0xd2f6('0x4f')]===0x0){return db[_0xd2f6('0x50')][_0xd2f6('0x48')]({'name':_0x345c28[_0xd2f6('0x40')],'resourceId':_0x345c28['id'],'type':_0x5b9d9c[_0xd2f6('0x40')],'sectionId':_0x5b9d9c['id']},{})[_0xd2f6('0x26')](function(){return _0x21f3cf;});}else{return _0x21f3cf;}})[_0xd2f6('0x43')](function(_0x46b825){logger[_0xd2f6('0x29')](_0xd2f6('0x51'),_0x46b825);throw _0x46b825;});}return _0x21f3cf;})[_0xd2f6('0x26')](respondWithResult(_0x4fdedb,0xc9))[_0xd2f6('0x43')](handleError(_0x4fdedb,null));};exports['update']=function(_0x25cb11,_0x5d4d49){if(_0x25cb11[_0xd2f6('0x49')]['id']){delete _0x25cb11[_0xd2f6('0x49')]['id'];}return db[_0xd2f6('0x2c')][_0xd2f6('0x47')]({'where':{'id':_0x25cb11[_0xd2f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d4d49,null))[_0xd2f6('0x26')](saveUpdates(_0x25cb11[_0xd2f6('0x49')],null))['then'](respondWithResult(_0x5d4d49,null))[_0xd2f6('0x43')](handleError(_0x5d4d49,null));};exports[_0xd2f6('0x28')]=function(_0x53554d,_0x28f21f){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x53554d[_0xd2f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x28f21f,null))['then'](removeEntity(_0x28f21f,null))[_0xd2f6('0x43')](handleError(_0x28f21f,null));}; \ No newline at end of file +var _0xf847=['CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf847,0x183));var _0x7f84=function(_0x4c6845,_0x4265ae){_0x4c6845=_0x4c6845-0x0;var _0x41987b=_0xf847[_0x4c6845];return _0x41987b;};'use strict';var emlformat=require(_0x7f84('0x0'));var rimraf=require(_0x7f84('0x1'));var zipdir=require(_0x7f84('0x2'));var jsonpatch=require(_0x7f84('0x3'));var rp=require(_0x7f84('0x4'));var moment=require(_0x7f84('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7f84('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7f84('0x7'));var csv=require(_0x7f84('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f84('0x9'));var _=require(_0x7f84('0xa'));var squel=require(_0x7f84('0xb'));var crypto=require(_0x7f84('0xc'));var jsforce=require(_0x7f84('0xd'));var deskjs=require(_0x7f84('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f84('0xf'));var Redis=require('ioredis');var authService=require(_0x7f84('0x10'));var qs=require(_0x7f84('0x11'));var as=require(_0x7f84('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f84('0x13'))(_0x7f84('0x14'));var utils=require('../../config/utils');var config=require(_0x7f84('0x15'));var licenseUtil=require(_0x7f84('0x16'));var db=require(_0x7f84('0x17'))['db'];function respondWithStatusCode(_0x4fdbc0,_0x4edb83){_0x4edb83=_0x4edb83||0xcc;return function(_0x1f1f7d){if(_0x1f1f7d){return _0x4fdbc0['sendStatus'](_0x4edb83);}return _0x4fdbc0[_0x7f84('0x18')](_0x4edb83)[_0x7f84('0x19')]();};}function respondWithResult(_0x17f4ce,_0x23492c){_0x23492c=_0x23492c||0xc8;return function(_0xe29d6f){if(_0xe29d6f){return _0x17f4ce['status'](_0x23492c)[_0x7f84('0x1a')](_0xe29d6f);}};}function respondWithFilteredResult(_0x49ccf5,_0x21e19b){return function(_0x4e1e21){if(_0x4e1e21){var _0x535862=typeof _0x21e19b[_0x7f84('0x1b')]===_0x7f84('0x1c')&&typeof _0x21e19b[_0x7f84('0x1d')]===_0x7f84('0x1c');var _0x4d454a=_0x4e1e21[_0x7f84('0x1e')];var _0x251c84=_0x535862?0x0:_0x21e19b[_0x7f84('0x1b')];var _0x52c835=_0x535862?_0x4e1e21[_0x7f84('0x1e')]:_0x21e19b['offset']+_0x21e19b[_0x7f84('0x1d')];var _0x29056f;if(_0x52c835>=_0x4d454a){_0x52c835=_0x4d454a;_0x29056f=0xc8;}else{_0x29056f=0xce;}_0x49ccf5[_0x7f84('0x18')](_0x29056f);return _0x49ccf5['set'](_0x7f84('0x1f'),_0x251c84+'-'+_0x52c835+'/'+_0x4d454a)['json'](_0x4e1e21);}return null;};}function patchUpdates(_0x5e0f53){return function(_0x243748){try{jsonpatch[_0x7f84('0x20')](_0x243748,_0x5e0f53,!![]);}catch(_0x3c66c5){return BPromise[_0x7f84('0x21')](_0x3c66c5);}return _0x243748[_0x7f84('0x22')]();};}function saveUpdates(_0x3a387f,_0x37abea){return function(_0x568ae8){if(_0x568ae8){return _0x568ae8[_0x7f84('0x23')](_0x3a387f)['then'](function(_0x4d6caf){return _0x4d6caf;});}return null;};}function removeEntity(_0x4f4e67,_0x1033a4){return function(_0x551eeb){if(_0x551eeb){return _0x551eeb[_0x7f84('0x24')]()[_0x7f84('0x25')](function(){var _0x371067=_0x551eeb['get']({'plain':!![]});var _0x253384=_0x7f84('0x26');return db[_0x7f84('0x27')]['destroy']({'where':{'type':_0x253384,'resourceId':_0x371067['id']}})[_0x7f84('0x25')](function(){return _0x551eeb;});})[_0x7f84('0x25')](function(){_0x4f4e67[_0x7f84('0x18')](0xcc)[_0x7f84('0x19')]();});}};}function handleEntityNotFound(_0x2b9f3c,_0x4a3549){return function(_0x58f3dd){if(!_0x58f3dd){_0x2b9f3c['sendStatus'](0x194);}return _0x58f3dd;};}function handleError(_0x1a3bc4,_0x39834e){_0x39834e=_0x39834e||0x1f4;return function(_0x5ba7a7){logger[_0x7f84('0x28')](_0x5ba7a7[_0x7f84('0x29')]);if(_0x5ba7a7[_0x7f84('0x2a')]){delete _0x5ba7a7[_0x7f84('0x2a')];}_0x1a3bc4[_0x7f84('0x18')](_0x39834e)[_0x7f84('0x2b')](_0x5ba7a7);};}exports[_0x7f84('0x2c')]=function(_0x73b480,_0x7a4abe){var _0x51c0c6={},_0xce2205={},_0x26a398={'count':0x0,'rows':[]};var _0x13a5c4=_['map'](db[_0x7f84('0x2d')][_0x7f84('0x2e')],function(_0x5c1d9e){return{'name':_0x5c1d9e[_0x7f84('0x2f')],'type':_0x5c1d9e[_0x7f84('0x30')][_0x7f84('0x31')]};});_0xce2205[_0x7f84('0x32')]=_[_0x7f84('0x33')](_0x13a5c4,'name');_0xce2205[_0x7f84('0x34')]=_[_0x7f84('0x35')](_0x73b480['query']);_0xce2205[_0x7f84('0x36')]=_[_0x7f84('0x37')](_0xce2205[_0x7f84('0x32')],_0xce2205[_0x7f84('0x34')]);_0x51c0c6['attributes']=_[_0x7f84('0x37')](_0xce2205[_0x7f84('0x32')],qs['fields'](_0x73b480[_0x7f84('0x34')][_0x7f84('0x38')]));_0x51c0c6[_0x7f84('0x39')]=_0x51c0c6[_0x7f84('0x39')][_0x7f84('0x3a')]?_0x51c0c6[_0x7f84('0x39')]:_0xce2205['model'];if(!_0x73b480[_0x7f84('0x34')][_0x7f84('0x3b')]('nolimit')){_0x51c0c6[_0x7f84('0x1d')]=qs[_0x7f84('0x1d')](_0x73b480[_0x7f84('0x34')]['limit']);_0x51c0c6[_0x7f84('0x1b')]=qs[_0x7f84('0x1b')](_0x73b480[_0x7f84('0x34')][_0x7f84('0x1b')]);}_0x51c0c6[_0x7f84('0x3c')]=qs[_0x7f84('0x3d')](_0x73b480[_0x7f84('0x34')][_0x7f84('0x3d')]);_0x51c0c6[_0x7f84('0x3e')]=qs['filters'](_[_0x7f84('0x3f')](_0x73b480[_0x7f84('0x34')],_0xce2205[_0x7f84('0x36')]),_0x13a5c4);if(_0x73b480['query'][_0x7f84('0x40')]){_0x51c0c6['where']=_[_0x7f84('0x41')](_0x51c0c6['where'],{'$or':_[_0x7f84('0x33')](_0x13a5c4,function(_0x404dcd){if(_0x404dcd[_0x7f84('0x30')]!==_0x7f84('0x42')){var _0x2172b1={};_0x2172b1[_0x404dcd['name']]={'$like':'%'+_0x73b480[_0x7f84('0x34')][_0x7f84('0x40')]+'%'};return _0x2172b1;}})});}_0x51c0c6=_['merge']({},_0x51c0c6,_0x73b480[_0x7f84('0x43')]);var _0x2810ca={'where':_0x51c0c6[_0x7f84('0x3e')]};return db[_0x7f84('0x2d')][_0x7f84('0x1e')](_0x2810ca)['then'](function(_0x2b0166){_0x26a398[_0x7f84('0x1e')]=_0x2b0166;if(_0x73b480[_0x7f84('0x34')]['includeAll']){_0x51c0c6[_0x7f84('0x44')]=[{'all':!![]}];}return db[_0x7f84('0x2d')][_0x7f84('0x45')](_0x51c0c6);})[_0x7f84('0x25')](function(_0x8c5aa){_0x26a398[_0x7f84('0x46')]=_0x8c5aa;return _0x26a398;})[_0x7f84('0x25')](respondWithFilteredResult(_0x7a4abe,_0x51c0c6))['catch'](handleError(_0x7a4abe,null));};exports[_0x7f84('0x47')]=function(_0xadf3e6,_0x13b0b8){var _0x302ccc={'raw':!![],'where':{'id':_0xadf3e6[_0x7f84('0x48')]['id']}},_0x54ee95={};_0x54ee95[_0x7f84('0x32')]=_[_0x7f84('0x35')](db[_0x7f84('0x2d')][_0x7f84('0x2e')]);_0x54ee95[_0x7f84('0x34')]=_[_0x7f84('0x35')](_0xadf3e6[_0x7f84('0x34')]);_0x54ee95['filters']=_['intersection'](_0x54ee95[_0x7f84('0x32')],_0x54ee95['query']);_0x302ccc[_0x7f84('0x39')]=_[_0x7f84('0x37')](_0x54ee95[_0x7f84('0x32')],qs['fields'](_0xadf3e6[_0x7f84('0x34')][_0x7f84('0x38')]));_0x302ccc[_0x7f84('0x39')]=_0x302ccc[_0x7f84('0x39')][_0x7f84('0x3a')]?_0x302ccc[_0x7f84('0x39')]:_0x54ee95[_0x7f84('0x32')];if(_0xadf3e6[_0x7f84('0x34')][_0x7f84('0x49')]){_0x302ccc[_0x7f84('0x44')]=[{'all':!![]}];}_0x302ccc=_[_0x7f84('0x41')]({},_0x302ccc,_0xadf3e6[_0x7f84('0x43')]);return db['CmHopperAdditionalPhone'][_0x7f84('0x4a')](_0x302ccc)[_0x7f84('0x25')](handleEntityNotFound(_0x13b0b8,null))[_0x7f84('0x25')](respondWithResult(_0x13b0b8,null))['catch'](handleError(_0x13b0b8,null));};exports[_0x7f84('0x4b')]=function(_0x62a713,_0x2e5f90){return db[_0x7f84('0x2d')][_0x7f84('0x4b')](_0x62a713[_0x7f84('0x4c')],{})[_0x7f84('0x25')](function(_0x2c7da3){var _0x48be4b=_0x62a713['user']['get']({'plain':!![]});if(!_0x48be4b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48be4b[_0x7f84('0x4d')]===_0x7f84('0x4e')){var _0x115e90=_0x2c7da3[_0x7f84('0x4f')]({'plain':!![]});var _0x40725f=_0x7f84('0x26');return db[_0x7f84('0x50')]['find']({'where':{'name':_0x40725f,'userProfileId':_0x48be4b[_0x7f84('0x51')]},'raw':!![]})['then'](function(_0x16631a){if(_0x16631a&&_0x16631a[_0x7f84('0x52')]===0x0){return db[_0x7f84('0x27')][_0x7f84('0x4b')]({'name':_0x115e90[_0x7f84('0x2a')],'resourceId':_0x115e90['id'],'type':_0x16631a['name'],'sectionId':_0x16631a['id']},{})[_0x7f84('0x25')](function(){return _0x2c7da3;});}else{return _0x2c7da3;}})['catch'](function(_0x5e0f69){logger['error'](_0x7f84('0x53'),_0x5e0f69);throw _0x5e0f69;});}return _0x2c7da3;})[_0x7f84('0x25')](respondWithResult(_0x2e5f90,0xc9))[_0x7f84('0x54')](handleError(_0x2e5f90,null));};exports[_0x7f84('0x23')]=function(_0x3a11a4,_0x1661e7){if(_0x3a11a4[_0x7f84('0x4c')]['id']){delete _0x3a11a4[_0x7f84('0x4c')]['id'];}return db[_0x7f84('0x2d')][_0x7f84('0x4a')]({'where':{'id':_0x3a11a4[_0x7f84('0x48')]['id']}})[_0x7f84('0x25')](handleEntityNotFound(_0x1661e7,null))[_0x7f84('0x25')](saveUpdates(_0x3a11a4[_0x7f84('0x4c')],null))[_0x7f84('0x25')](respondWithResult(_0x1661e7,null))[_0x7f84('0x54')](handleError(_0x1661e7,null));};exports[_0x7f84('0x24')]=function(_0x3427df,_0x3f0878){return db['CmHopperAdditionalPhone'][_0x7f84('0x4a')]({'where':{'id':_0x3427df['params']['id']}})['then'](handleEntityNotFound(_0x3f0878,null))[_0x7f84('0x25')](removeEntity(_0x3f0878,null))[_0x7f84('0x54')](handleError(_0x3f0878,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d9a2a74..11e116f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd05=['./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x119a02,_0x20b139){var _0x90a2e2=function(_0x4ec471){while(--_0x4ec471){_0x119a02['push'](_0x119a02['shift']());}};_0x90a2e2(++_0x20b139);}(_0xdd05,0xcb));var _0x5dd0=function(_0x247b2c,_0x52354c){_0x247b2c=_0x247b2c-0x0;var _0x14986e=_0xdd05[_0x247b2c];return _0x14986e;};'use strict';var _=require(_0x5dd0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5dd0('0x1'));var moment=require('moment');var BPromise=require(_0x5dd0('0x2'));var rp=require(_0x5dd0('0x3'));var fs=require('fs');var path=require(_0x5dd0('0x4'));var rimraf=require(_0x5dd0('0x5'));var config=require(_0x5dd0('0x6'));var attributes=require(_0x5dd0('0x7'));module[_0x5dd0('0x8')]=function(_0x1c3209,_0x3ef9e6){return _0x1c3209['define'](_0x5dd0('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9c5=['./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','../../config/logger','api','request-promise'];(function(_0x945098,_0x1845a6){var _0x4565ec=function(_0x29a362){while(--_0x29a362){_0x945098['push'](_0x945098['shift']());}};_0x4565ec(++_0x1845a6);}(_0xd9c5,0x115));var _0x5d9c=function(_0x34cd7c,_0x3ac2e5){_0x34cd7c=_0x34cd7c-0x0;var _0xb1328f=_0xd9c5[_0x34cd7c];return _0xb1328f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d9c('0x0'))(_0x5d9c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d9c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d9c('0x3'));module[_0x5d9c('0x4')]=function(_0x104ccf,_0x18149d){return _0x104ccf[_0x5d9c('0x5')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x5d9c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 7750ea5..0695bf0 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07c3=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','SwapAdditionalPhones','ContactId','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field'];(function(_0x5e9a24,_0x52fd96){var _0x28293e=function(_0x1bfbb8){while(--_0x1bfbb8){_0x5e9a24['push'](_0x5e9a24['shift']());}};_0x28293e(++_0x52fd96);}(_0x07c3,0xe0));var _0x307c=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x07c3[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x307c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x307c('0x1'));var rs=require(_0x307c('0x2'));var fs=require('fs');var Redis=require(_0x307c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x307c('0x4'));var logger=require(_0x307c('0x5'))(_0x307c('0x6'));var config=require('../../config/environment');var jayson=require(_0x307c('0x7'));var client=jayson[_0x307c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51df5c,_0x597ee8,_0x5f1d3d){return new BPromise(function(_0x481bd7,_0x509b60){return client[_0x307c('0x9')](_0x51df5c,_0x5f1d3d)[_0x307c('0xa')](function(_0x4abfea){logger[_0x307c('0xb')](_0x307c('0xc'),_0x597ee8,_0x307c('0xd'));logger['debug'](_0x307c('0xe'),_0x597ee8,_0x307c('0xd'),JSON[_0x307c('0xf')](_0x4abfea));if(_0x4abfea['error']){if(_0x4abfea['error']['code']===0x1f4){logger[_0x307c('0x10')](_0x307c('0xc'),_0x597ee8,_0x4abfea['error']['message']);return _0x509b60(_0x4abfea[_0x307c('0x10')][_0x307c('0x11')]);}logger[_0x307c('0x10')](_0x307c('0xc'),_0x597ee8,_0x4abfea[_0x307c('0x10')][_0x307c('0x11')]);return _0x481bd7(_0x4abfea['error'][_0x307c('0x11')]);}else{logger[_0x307c('0xb')](_0x307c('0xc'),_0x597ee8,_0x307c('0xd'));_0x481bd7(_0x4abfea[_0x307c('0x12')][_0x307c('0x11')]);}})[_0x307c('0x13')](function(_0x36545e){logger[_0x307c('0x10')](_0x307c('0xc'),_0x597ee8,_0x36545e);_0x509b60(_0x36545e);});});}exports[_0x307c('0x14')]=function(_0x1aabac){var _0x5d3a53=this;return new Promise(function(_0x36f2f6,_0x463853){return db[_0x307c('0x15')][_0x307c('0x16')]({'raw':!![],'where':{'ContactId':_0x1aabac['body']['ContactId'],'ListId':_0x1aabac[_0x307c('0x17')][_0x307c('0x18')],'VoiceQueueId':_0x1aabac[_0x307c('0x17')]['VoiceQueueId']===undefined?null:_0x1aabac[_0x307c('0x17')][_0x307c('0x19')],'CampaignId':_0x1aabac['body'][_0x307c('0x1a')]===undefined?null:_0x1aabac[_0x307c('0x17')][_0x307c('0x1a')]}})['then'](function(_0x2f2b1a){if(_0x2f2b1a!=null){return db['CmHopperAdditionalPhone'][_0x307c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2f2b1a['id'],'OrderBy':{'$gt':_0x2f2b1a['OrderBy']}},'order':[[_0x307c('0x1b'),'ASC']]})[_0x307c('0xa')](function(_0x12dfa8){var _0x36c5be=0x0;if(_0x12dfa8){if(_0x12dfa8[_0x307c('0x1c')]+_0x12dfa8[_0x307c('0x1d')]+_0x12dfa8[_0x307c('0x1e')]+_0x12dfa8[_0x307c('0x1f')]+_0x12dfa8[_0x307c('0x20')]+_0x12dfa8[_0x307c('0x21')]+_0x12dfa8[_0x307c('0x22')]+_0x12dfa8[_0x307c('0x23')]<_0x1aabac[_0x307c('0x24')][_0x307c('0x25')])_0x36c5be=0x1;_0x36f2f6({'additional':_0x36c5be});}else{return db[_0x307c('0x26')][_0x307c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2f2b1a['id']},'order':[[_0x307c('0x1b'),_0x307c('0x27')]]})['then'](function(_0x57dd7a){var _0x7db744=0x0;if(_0x57dd7a){if(_0x57dd7a[_0x307c('0x1c')]+_0x57dd7a[_0x307c('0x1d')]+_0x57dd7a['countnoanswerretry']+_0x57dd7a[_0x307c('0x1f')]+_0x57dd7a['countdropretry']+_0x57dd7a['countabandonedretry']+_0x57dd7a[_0x307c('0x22')]+_0x57dd7a[_0x307c('0x23')]<_0x1aabac[_0x307c('0x24')][_0x307c('0x25')])_0x7db744=0x1;_0x36f2f6({'additional':_0x7db744});}else{_0x36f2f6({'additional':0x0});}})[_0x307c('0x13')](function(_0x5befa3){logger[_0x307c('0x10')]('VerifyAdditionalPhones',_0x5befa3[_0x307c('0x11')]);_0x463853(_0x5d3a53[_0x307c('0x10')](0x1f4,_0x5befa3[_0x307c('0x11')]));});}})[_0x307c('0x13')](function(_0x5b75eb){logger[_0x307c('0x10')](_0x307c('0x14'),_0x5b75eb[_0x307c('0x11')]);_0x463853(_0x5d3a53[_0x307c('0x10')](0x1f4,_0x5b75eb[_0x307c('0x11')]));});}else _0x36f2f6({'additional':0x0});});});};exports[_0x307c('0x28')]=function(_0x574c4b){var _0x2f046e=this;return new Promise(function(_0x26c546,_0x1fc1e0){return db['CmHopper'][_0x307c('0x16')]({'raw':!![],'where':{'ContactId':_0x574c4b['body'][_0x307c('0x29')],'ListId':_0x574c4b[_0x307c('0x17')]['ListId'],'VoiceQueueId':_0x574c4b[_0x307c('0x17')][_0x307c('0x19')]===undefined?null:_0x574c4b[_0x307c('0x17')][_0x307c('0x19')],'CampaignId':_0x574c4b[_0x307c('0x17')][_0x307c('0x1a')]===undefined?null:_0x574c4b['body'][_0x307c('0x1a')]}})['then'](function(_0x27be92){if(_0x27be92!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x27be92['id'],'OrderBy':{'$gte':_0x27be92[_0x307c('0x1b')]}},'order':[[_0x307c('0x1b'),_0x307c('0x27')]]})[_0x307c('0xa')](function(_0x3ed982){if(_0x3ed982)return activateAdditionalPhone(_0x27be92,_0x574c4b[_0x307c('0x17')],_0x3ed982,_0x574c4b['duration'],_0x574c4b[_0x307c('0x2a')])[_0x307c('0xa')](function(_0x57c13c){_0x26c546(_0x57c13c);});else{return db[_0x307c('0x26')][_0x307c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x27be92['id']},'order':[[_0x307c('0x1b'),_0x307c('0x27')]]})[_0x307c('0xa')](function(_0x532f42){if(_0x532f42)return activateAdditionalPhone(_0x27be92,_0x574c4b[_0x307c('0x17')],_0x532f42,_0x574c4b[_0x307c('0x2b')],_0x574c4b[_0x307c('0x2a')])['then'](function(_0x136f9f){_0x26c546(_0x136f9f);});else{_0x26c546({'id':_0x27be92['id'],'phone':''});}})['catch'](function(_0x3aa494){logger[_0x307c('0x10')](_0x307c('0x14'),_0x3aa494[_0x307c('0x11')]);_0x1fc1e0(_0x2f046e['error'](0x1f4,_0x3aa494[_0x307c('0x11')]));});}})['catch'](function(_0x396095){logger[_0x307c('0x10')](_0x307c('0x14'),_0x396095['message']);_0x1fc1e0(_0x2f046e[_0x307c('0x10')](0x1f4,_0x396095[_0x307c('0x11')]));});}else _0x26c546(0x1);});});};function activateAdditionalPhone(_0x2d6c3c,_0x5bae39,_0x17b280,_0x45ab31,_0x2f5ea4){return new Promise(function(_0x3c399f,_0x3e5459){var _0xf4ea32;if(_[_0x307c('0x2c')](_0x17b280[_0x307c('0x2d')])){_0x17b280[_0x307c('0x2d')]=moment();}if(moment()>moment(_0x17b280[_0x307c('0x2d')])){_0xf4ea32=moment()[_0x307c('0x2e')](_0x2f5ea4||0x3,_0x307c('0x2f'));}else{if(_0x17b280[_0x307c('0x1b')]==0x0){_0xf4ea32=moment(_0x17b280[_0x307c('0x2d')]);}else{_0xf4ea32=moment()[_0x307c('0x2e')](_0x2f5ea4||0x3,_0x307c('0x2f'));}}if(_['isNil'](_0xf4ea32)){_0xf4ea32=moment()[_0x307c('0x2e')](_0x2f5ea4||0x3,_0x307c('0x2f'));}var _0x45d1d1={'phone':_0x2d6c3c[_0x307c('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x2d6c3c[_0x307c('0x1b')])?0x0:_0x2d6c3c[_0x307c('0x1b')],'scheduledat':moment()[_0x307c('0x2e')](_0x45ab31||0x1,'minutes'),'countbusyretry':_0x5bae39['countbusyretry'],'countcongestionretry':_0x5bae39[_0x307c('0x1d')],'countnoanswerretry':_0x5bae39['countnoanswerretry'],'countnosuchnumberretry':_0x5bae39[_0x307c('0x1f')],'countdropretry':_0x5bae39[_0x307c('0x20')],'countabandonedretry':_0x5bae39[_0x307c('0x21')],'countmachineretry':_0x5bae39['countmachineretry'],'countagentrejectretry':_0x5bae39['countagentrejectretry'],'createdAt':_0x5bae39[_0x307c('0x31')],'updatedAt':_0x5bae39[_0x307c('0x32')]};var _0x41eed8={'CmHopperId':_0x2d6c3c['id'],'phone':_0x17b280[_0x307c('0x30')],'active':0x0,'OrderBy':_[_0x307c('0x2c')](_0x17b280[_0x307c('0x1b')])?0x0:_0x17b280[_0x307c('0x1b')],'scheduledat':_0xf4ea32,'countbusyretry':_0x17b280[_0x307c('0x1c')],'countcongestionretry':_0x17b280['countcongestionretry'],'countnoanswerretry':_0x17b280[_0x307c('0x1e')],'countnosuchnumberretry':_0x17b280['countnosuchnumberretry'],'countdropretry':_0x17b280[_0x307c('0x20')],'countabandonedretry':_0x17b280[_0x307c('0x21')],'countmachineretry':_0x17b280[_0x307c('0x22')],'countagentrejectretry':_0x17b280['countagentrejectretry'],'createdAt':_0x17b280['createdAt'],'updatedAt':_0x17b280[_0x307c('0x32')]};return db['sequelize'][_0x307c('0x33')](function(_0xe41be5){return db['CmHopperAdditionalPhone'][_0x307c('0x34')](_0x45d1d1,{'where':{'id':_0x17b280['id']}},{'transaction':_0xe41be5})[_0x307c('0xa')](function(){return db[_0x307c('0x15')][_0x307c('0x34')](_0x41eed8,{'where':{'id':_0x2d6c3c['id']}},{'transaction':_0xe41be5});});})[_0x307c('0xa')](function(_0x521443){_0x3c399f({'id':_0x2d6c3c['id'],'phone':_0x17b280[_0x307c('0x30')]});})['catch'](function(_0x219366){logger[_0x307c('0x10')](_0x307c('0x35'),_0x219366['message']);_0x3e5459({'error':_0x219366['message']});});});}exports[_0x307c('0x36')]=function(_0x2ea7a6){var _0x346173=this;return new Promise(function(_0x12be6c,_0xcfa326){return db[_0x307c('0x15')][_0x307c('0x34')](_0x2ea7a6['body'][_0x307c('0x37')],{'where':{'id':_0x2ea7a6[_0x307c('0x17')]['id']}})['then'](function(_0x14ff69){_0x12be6c(_0x14ff69);})[_0x307c('0x13')](function(_0x136d1a){logger[_0x307c('0x10')](_0x307c('0x36'),_0x136d1a[_0x307c('0x11')]);_0xcfa326(_0x346173[_0x307c('0x10')](0x1f4,_0x136d1a[_0x307c('0x11')]));});});}; \ No newline at end of file +var _0x4e56=['CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones'];(function(_0x4ed5e0,_0x51cc17){var _0x3d9ff0=function(_0x767297){while(--_0x767297){_0x4ed5e0['push'](_0x4ed5e0['shift']());}};_0x3d9ff0(++_0x51cc17);}(_0x4e56,0x1bf));var _0x64e5=function(_0x273c28,_0x4af89f){_0x273c28=_0x273c28-0x0;var _0x1c707c=_0x4e56[_0x273c28];return _0x1c707c;};'use strict';var _=require(_0x64e5('0x0'));var util=require(_0x64e5('0x1'));var moment=require(_0x64e5('0x2'));var BPromise=require(_0x64e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64e5('0x4'))['db'];var utils=require(_0x64e5('0x5'));var logger=require(_0x64e5('0x6'))(_0x64e5('0x7'));var config=require(_0x64e5('0x8'));var jayson=require(_0x64e5('0x9'));var client=jayson[_0x64e5('0xa')][_0x64e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cd8f0,_0x153177,_0x453431){return new BPromise(function(_0x2398bb,_0x59dc3d){return client[_0x64e5('0xc')](_0x1cd8f0,_0x453431)[_0x64e5('0xd')](function(_0x17b76f){logger['info'](_0x64e5('0xe'),_0x153177,'request\x20sent');logger[_0x64e5('0xf')](_0x64e5('0x10'),_0x153177,_0x64e5('0x11'),JSON[_0x64e5('0x12')](_0x17b76f));if(_0x17b76f['error']){if(_0x17b76f[_0x64e5('0x13')][_0x64e5('0x14')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x153177,_0x17b76f['error'][_0x64e5('0x15')]);return _0x59dc3d(_0x17b76f[_0x64e5('0x13')]['message']);}logger['error'](_0x64e5('0xe'),_0x153177,_0x17b76f['error'][_0x64e5('0x15')]);return _0x2398bb(_0x17b76f[_0x64e5('0x13')]['message']);}else{logger['info'](_0x64e5('0xe'),_0x153177,_0x64e5('0x11'));_0x2398bb(_0x17b76f[_0x64e5('0x16')][_0x64e5('0x15')]);}})[_0x64e5('0x17')](function(_0x478764){logger[_0x64e5('0x13')](_0x64e5('0xe'),_0x153177,_0x478764);_0x59dc3d(_0x478764);});});}exports[_0x64e5('0x18')]=function(_0x25d26a){var _0x2a451a=this;return new Promise(function(_0x333367,_0x421cc8){return db[_0x64e5('0x19')][_0x64e5('0x1a')]({'raw':!![],'where':{'ContactId':_0x25d26a[_0x64e5('0x1b')][_0x64e5('0x1c')],'ListId':_0x25d26a[_0x64e5('0x1b')][_0x64e5('0x1d')],'VoiceQueueId':_0x25d26a[_0x64e5('0x1b')][_0x64e5('0x1e')]===undefined?null:_0x25d26a[_0x64e5('0x1b')]['VoiceQueueId'],'CampaignId':_0x25d26a['body'][_0x64e5('0x1f')]===undefined?null:_0x25d26a[_0x64e5('0x1b')][_0x64e5('0x1f')]}})[_0x64e5('0xd')](function(_0x1d516c){if(_0x1d516c!=null){return db[_0x64e5('0x20')][_0x64e5('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x1d516c['id'],'OrderBy':{'$gt':_0x1d516c[_0x64e5('0x21')]}},'order':[['OrderBy',_0x64e5('0x22')]]})[_0x64e5('0xd')](function(_0x58e5de){var _0x39425a=0x0;if(_0x58e5de){if(_0x58e5de[_0x64e5('0x23')]+_0x58e5de[_0x64e5('0x24')]+_0x58e5de[_0x64e5('0x25')]+_0x58e5de[_0x64e5('0x26')]+_0x58e5de[_0x64e5('0x27')]+_0x58e5de[_0x64e5('0x28')]+_0x58e5de[_0x64e5('0x29')]+_0x58e5de[_0x64e5('0x2a')]<_0x25d26a[_0x64e5('0x2b')][_0x64e5('0x2c')])_0x39425a=0x1;_0x333367({'additional':_0x39425a});}else{return db[_0x64e5('0x20')][_0x64e5('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x1d516c['id']},'order':[[_0x64e5('0x21'),_0x64e5('0x22')]]})['then'](function(_0x435f65){var _0x148a19=0x0;if(_0x435f65){if(_0x435f65['countbusyretry']+_0x435f65[_0x64e5('0x24')]+_0x435f65[_0x64e5('0x25')]+_0x435f65['countnosuchnumberretry']+_0x435f65[_0x64e5('0x27')]+_0x435f65[_0x64e5('0x28')]+_0x435f65[_0x64e5('0x29')]+_0x435f65[_0x64e5('0x2a')]<_0x25d26a['entity'][_0x64e5('0x2c')])_0x148a19=0x1;_0x333367({'additional':_0x148a19});}else{_0x333367({'additional':0x0});}})['catch'](function(_0x83c161){logger[_0x64e5('0x13')](_0x64e5('0x18'),_0x83c161['message']);_0x421cc8(_0x2a451a[_0x64e5('0x13')](0x1f4,_0x83c161[_0x64e5('0x15')]));});}})[_0x64e5('0x17')](function(_0x2c6752){logger[_0x64e5('0x13')](_0x64e5('0x18'),_0x2c6752[_0x64e5('0x15')]);_0x421cc8(_0x2a451a[_0x64e5('0x13')](0x1f4,_0x2c6752[_0x64e5('0x15')]));});}else _0x333367({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1988ce){var _0x24b64c=this;return new Promise(function(_0x4defb3,_0xdbac36){return db[_0x64e5('0x19')][_0x64e5('0x1a')]({'raw':!![],'where':{'ContactId':_0x1988ce[_0x64e5('0x1b')][_0x64e5('0x1c')],'ListId':_0x1988ce[_0x64e5('0x1b')][_0x64e5('0x1d')],'VoiceQueueId':_0x1988ce[_0x64e5('0x1b')]['VoiceQueueId']===undefined?null:_0x1988ce[_0x64e5('0x1b')][_0x64e5('0x1e')],'CampaignId':_0x1988ce[_0x64e5('0x1b')][_0x64e5('0x1f')]===undefined?null:_0x1988ce['body']['CampaignId']}})['then'](function(_0x1dc182){if(_0x1dc182!=null){return db[_0x64e5('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1dc182['id'],'OrderBy':{'$gte':_0x1dc182[_0x64e5('0x21')]}},'order':[[_0x64e5('0x21'),_0x64e5('0x22')]]})[_0x64e5('0xd')](function(_0x15015f){if(_0x15015f)return activateAdditionalPhone(_0x1dc182,_0x1988ce[_0x64e5('0x1b')],_0x15015f,_0x1988ce[_0x64e5('0x2d')],_0x1988ce[_0x64e5('0x2e')])['then'](function(_0x2d0ff2){_0x4defb3(_0x2d0ff2);});else{return db[_0x64e5('0x20')][_0x64e5('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x1dc182['id']},'order':[[_0x64e5('0x21'),_0x64e5('0x22')]]})['then'](function(_0x234579){if(_0x234579)return activateAdditionalPhone(_0x1dc182,_0x1988ce[_0x64e5('0x1b')],_0x234579,_0x1988ce[_0x64e5('0x2d')],_0x1988ce['waitTime'])[_0x64e5('0xd')](function(_0x26bf09){_0x4defb3(_0x26bf09);});else{_0x4defb3({'id':_0x1dc182['id'],'phone':''});}})['catch'](function(_0x1929b2){logger[_0x64e5('0x13')](_0x64e5('0x18'),_0x1929b2[_0x64e5('0x15')]);_0xdbac36(_0x24b64c[_0x64e5('0x13')](0x1f4,_0x1929b2[_0x64e5('0x15')]));});}})[_0x64e5('0x17')](function(_0x25a97d){logger[_0x64e5('0x13')](_0x64e5('0x18'),_0x25a97d['message']);_0xdbac36(_0x24b64c['error'](0x1f4,_0x25a97d[_0x64e5('0x15')]));});}else _0x4defb3(0x1);});});};function activateAdditionalPhone(_0x2b8e05,_0x2e449f,_0x58ab69,_0x1bf9c2,_0x4c9da5){return new Promise(function(_0x18bbf3,_0x5cdd07){var _0x28a551;if(_['isNil'](_0x58ab69['scheduledat'])){_0x58ab69[_0x64e5('0x2f')]=moment();}if(moment()>moment(_0x58ab69[_0x64e5('0x2f')])){_0x28a551=moment()[_0x64e5('0x30')](_0x4c9da5||0x3,'minutes');}else{if(_0x58ab69[_0x64e5('0x21')]==0x0){_0x28a551=moment(_0x58ab69[_0x64e5('0x2f')]);}else{_0x28a551=moment()[_0x64e5('0x30')](_0x4c9da5||0x3,_0x64e5('0x31'));}}if(_[_0x64e5('0x32')](_0x28a551)){_0x28a551=moment()[_0x64e5('0x30')](_0x4c9da5||0x3,'minutes');}var _0x488287={'phone':_0x2b8e05[_0x64e5('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x2b8e05[_0x64e5('0x21')])?0x0:_0x2b8e05[_0x64e5('0x21')],'scheduledat':moment()[_0x64e5('0x30')](_0x1bf9c2||0x1,_0x64e5('0x31')),'countbusyretry':_0x2e449f['countbusyretry'],'countcongestionretry':_0x2e449f['countcongestionretry'],'countnoanswerretry':_0x2e449f[_0x64e5('0x25')],'countnosuchnumberretry':_0x2e449f[_0x64e5('0x26')],'countdropretry':_0x2e449f['countdropretry'],'countabandonedretry':_0x2e449f[_0x64e5('0x28')],'countmachineretry':_0x2e449f[_0x64e5('0x29')],'countagentrejectretry':_0x2e449f[_0x64e5('0x2a')],'createdAt':_0x2e449f[_0x64e5('0x34')],'updatedAt':_0x2e449f['updatedAt']};var _0x59e653={'CmHopperId':_0x2b8e05['id'],'phone':_0x58ab69[_0x64e5('0x33')],'active':0x0,'OrderBy':_[_0x64e5('0x32')](_0x58ab69[_0x64e5('0x21')])?0x0:_0x58ab69[_0x64e5('0x21')],'scheduledat':_0x28a551,'countbusyretry':_0x58ab69[_0x64e5('0x23')],'countcongestionretry':_0x58ab69['countcongestionretry'],'countnoanswerretry':_0x58ab69[_0x64e5('0x25')],'countnosuchnumberretry':_0x58ab69[_0x64e5('0x26')],'countdropretry':_0x58ab69['countdropretry'],'countabandonedretry':_0x58ab69[_0x64e5('0x28')],'countmachineretry':_0x58ab69[_0x64e5('0x29')],'countagentrejectretry':_0x58ab69[_0x64e5('0x2a')],'createdAt':_0x58ab69['createdAt'],'updatedAt':_0x58ab69['updatedAt']};return db[_0x64e5('0x35')][_0x64e5('0x36')](function(_0x30c5d6){return db[_0x64e5('0x20')][_0x64e5('0x37')](_0x488287,{'where':{'id':_0x58ab69['id']}},{'transaction':_0x30c5d6})[_0x64e5('0xd')](function(){return db[_0x64e5('0x19')][_0x64e5('0x37')](_0x59e653,{'where':{'id':_0x2b8e05['id']}},{'transaction':_0x30c5d6});});})[_0x64e5('0xd')](function(_0x54da82){_0x18bbf3({'id':_0x2b8e05['id'],'phone':_0x58ab69['phone']});})[_0x64e5('0x17')](function(_0x472ed0){logger[_0x64e5('0x13')](_0x64e5('0x38'),_0x472ed0[_0x64e5('0x15')]);_0x5cdd07({'error':_0x472ed0[_0x64e5('0x15')]});});});}exports[_0x64e5('0x39')]=function(_0x2820d2){var _0x19a887=this;return new Promise(function(_0x228a54,_0x89fe6e){return db[_0x64e5('0x19')]['update'](_0x2820d2[_0x64e5('0x1b')][_0x64e5('0x3a')],{'where':{'id':_0x2820d2[_0x64e5('0x1b')]['id']}})[_0x64e5('0xd')](function(_0x2cd77b){_0x228a54(_0x2cd77b);})[_0x64e5('0x17')](function(_0x463eb7){logger[_0x64e5('0x13')]('IncrementPreviewCounters',_0x463eb7[_0x64e5('0x15')]);_0x89fe6e(_0x19a887[_0x64e5('0x13')](0x1f4,_0x463eb7[_0x64e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 9f63008..44ebba5 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x188d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get'];(function(_0x4ec0d0,_0x3eb21e){var _0x319e6d=function(_0x2342a4){while(--_0x2342a4){_0x4ec0d0['push'](_0x4ec0d0['shift']());}};_0x319e6d(++_0x3eb21e);}(_0x188d,0xdc));var _0xd188=function(_0x358927,_0x1eee11){_0x358927=_0x358927-0x0;var _0x4d5873=_0x188d[_0x358927];return _0x4d5873;};'use strict';var multer=require(_0xd188('0x0'));var util=require('util');var path=require(_0xd188('0x1'));var timeout=require(_0xd188('0x2'));var express=require(_0xd188('0x3'));var router=express[_0xd188('0x4')]();var fs_extra=require(_0xd188('0x5'));var auth=require(_0xd188('0x6'));var interaction=require(_0xd188('0x7'));var config=require(_0xd188('0x8'));var controller=require(_0xd188('0x9'));router[_0xd188('0xa')]('/',auth[_0xd188('0xb')](),controller[_0xd188('0xc')]);router[_0xd188('0xa')](_0xd188('0xd'),auth[_0xd188('0xb')](),controller[_0xd188('0xe')]);router[_0xd188('0xf')]('/',auth['isAuthenticated'](),controller[_0xd188('0x10')]);router[_0xd188('0x11')](_0xd188('0xd'),auth[_0xd188('0xb')](),controller[_0xd188('0x12')]);router[_0xd188('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd188('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe12f=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','/:id','isAuthenticated','put'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0xe12f,0x83));var _0xfe12=function(_0x341eac,_0x1906b5){_0x341eac=_0x341eac-0x0;var _0x4e04f4=_0xe12f[_0x341eac];return _0x4e04f4;};'use strict';var multer=require(_0xfe12('0x0'));var util=require(_0xfe12('0x1'));var path=require(_0xfe12('0x2'));var timeout=require(_0xfe12('0x3'));var express=require('express');var router=express[_0xfe12('0x4')]();var fs_extra=require(_0xfe12('0x5'));var auth=require(_0xfe12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe12('0x7'));var controller=require(_0xfe12('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe12('0x9')]);router['get'](_0xfe12('0xa'),auth[_0xfe12('0xb')](),controller['show']);router['post']('/',auth[_0xfe12('0xb')](),controller['create']);router[_0xfe12('0xc')]('/:id',auth[_0xfe12('0xb')](),controller[_0xfe12('0xd')]);router[_0xfe12('0xe')](_0xfe12('0xa'),auth[_0xfe12('0xb')](),controller['destroy']);module[_0xfe12('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f35b86d..afc2e63 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 _0x5655=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x5856af,_0x6a158d){var _0x22a93a=function(_0x732b60){while(--_0x732b60){_0x5856af['push'](_0x5856af['shift']());}};_0x22a93a(++_0x6a158d);}(_0x5655,0x15e));var _0x5565=function(_0x48d259,_0x59c9cd){_0x48d259=_0x48d259-0x0;var _0x24c817=_0x5655[_0x48d259];return _0x24c817;};'use strict';var moment=require(_0x5565('0x0'));var Sequelize=require(_0x5565('0x1'));module[_0x5565('0x2')]={'phone':{'type':Sequelize[_0x5565('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5565('0x4')],'unique':_0x5565('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x5565('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xafec=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x4c8fd7,_0x5ac749){var _0xd77a98=function(_0x3a5f2a){while(--_0x3a5f2a){_0x4c8fd7['push'](_0x4c8fd7['shift']());}};_0xd77a98(++_0x5ac749);}(_0xafec,0x161));var _0xcafe=function(_0x4e4d44,_0x3836ed){_0x4e4d44=_0x4e4d44-0x0;var _0x429cf0=_0xafec[_0x4e4d44];return _0x429cf0;};'use strict';var moment=require('moment');var Sequelize=require(_0xcafe('0x0'));module[_0xcafe('0x1')]={'phone':{'type':Sequelize[_0xcafe('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcafe('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xcafe('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xcafe('0x3')],'unique':_0xcafe('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1409229..44ab83f 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 _0x2791=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','catch','keys','find','body','params','describe','zip-dir','moment','mustache','util'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x2791,0x15a));var _0x1279=function(_0x4bd709,_0x28a25f){_0x4bd709=_0x4bd709-0x0;var _0x2cc8aa=_0x2791[_0x4bd709];return _0x2cc8aa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1279('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1279('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1279('0x2'));var util=require(_0x1279('0x3'));var path=require('path');var sox=require(_0x1279('0x4'));var csv=require(_0x1279('0x5'));var ejs=require(_0x1279('0x6'));var fs=require('fs');var fs_extra=require(_0x1279('0x7'));var _=require(_0x1279('0x8'));var squel=require(_0x1279('0x9'));var crypto=require(_0x1279('0xa'));var jsforce=require(_0x1279('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1279('0x5'));var querystring=require(_0x1279('0xc'));var Papa=require(_0x1279('0xd'));var Redis=require(_0x1279('0xe'));var authService=require(_0x1279('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1279('0x10'));var logger=require('../../config/logger')(_0x1279('0x11'));var utils=require(_0x1279('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1279('0x13'))['db'];function respondWithStatusCode(_0x5adddf,_0x4889d4){_0x4889d4=_0x4889d4||0xcc;return function(_0x39624d){if(_0x39624d){return _0x5adddf[_0x1279('0x14')](_0x4889d4);}return _0x5adddf[_0x1279('0x15')](_0x4889d4)[_0x1279('0x16')]();};}function respondWithResult(_0x47991e,_0x2a1d1b){_0x2a1d1b=_0x2a1d1b||0xc8;return function(_0xc73e5f){if(_0xc73e5f){return _0x47991e[_0x1279('0x15')](_0x2a1d1b)[_0x1279('0x17')](_0xc73e5f);}};}function respondWithFilteredResult(_0x385931,_0x3fa3e9){return function(_0x31fa92){if(_0x31fa92){var _0x4f498e=typeof _0x3fa3e9[_0x1279('0x18')]==='undefined'&&typeof _0x3fa3e9[_0x1279('0x19')]===_0x1279('0x1a');var _0x2f01cb=_0x31fa92['count'];var _0x37769d=_0x4f498e?0x0:_0x3fa3e9[_0x1279('0x18')];var _0x194656=_0x4f498e?_0x31fa92[_0x1279('0x1b')]:_0x3fa3e9['offset']+_0x3fa3e9[_0x1279('0x19')];var _0x578482;if(_0x194656>=_0x2f01cb){_0x194656=_0x2f01cb;_0x578482=0xc8;}else{_0x578482=0xce;}_0x385931[_0x1279('0x15')](_0x578482);return _0x385931['set'](_0x1279('0x1c'),_0x37769d+'-'+_0x194656+'/'+_0x2f01cb)['json'](_0x31fa92);}return null;};}function patchUpdates(_0x120b9e){return function(_0x7f11f5){try{jsonpatch[_0x1279('0x1d')](_0x7f11f5,_0x120b9e,!![]);}catch(_0x2de218){return BPromise['reject'](_0x2de218);}return _0x7f11f5[_0x1279('0x1e')]();};}function saveUpdates(_0x4d630f,_0x23f545){return function(_0x747efd){if(_0x747efd){return _0x747efd[_0x1279('0x1f')](_0x4d630f)['then'](function(_0x54a844){return _0x54a844;});}return null;};}function removeEntity(_0x4ffc58,_0x3e9c7d){return function(_0x351426){if(_0x351426){return _0x351426[_0x1279('0x20')]()[_0x1279('0x21')](function(){_0x4ffc58[_0x1279('0x15')](0xcc)[_0x1279('0x16')]();});}};}function handleEntityNotFound(_0x59432f,_0x57808c){return function(_0xd0fe9d){if(!_0xd0fe9d){_0x59432f['sendStatus'](0x194);}return _0xd0fe9d;};}function handleError(_0xa357c6,_0x114e05){_0x114e05=_0x114e05||0x1f4;return function(_0x2d7044){logger['error'](_0x2d7044[_0x1279('0x22')]);if(_0x2d7044[_0x1279('0x23')]){delete _0x2d7044[_0x1279('0x23')];}_0xa357c6['status'](_0x114e05)[_0x1279('0x24')](_0x2d7044);};}exports[_0x1279('0x25')]=function(_0x3cd8b0,_0x99ccec){var _0x454c0c={},_0x2509c5={},_0x1e9dac={'count':0x0,'rows':[]};var _0x33cfec=_['map'](db['CmHopperBlack'][_0x1279('0x26')],function(_0x168910){return{'name':_0x168910[_0x1279('0x27')],'type':_0x168910['type']['key']};});_0x2509c5[_0x1279('0x28')]=_[_0x1279('0x29')](_0x33cfec,_0x1279('0x23'));_0x2509c5[_0x1279('0x2a')]=_['keys'](_0x3cd8b0[_0x1279('0x2a')]);_0x2509c5[_0x1279('0x2b')]=_[_0x1279('0x2c')](_0x2509c5['model'],_0x2509c5[_0x1279('0x2a')]);_0x454c0c[_0x1279('0x2d')]=_[_0x1279('0x2c')](_0x2509c5[_0x1279('0x28')],qs[_0x1279('0x2e')](_0x3cd8b0[_0x1279('0x2a')][_0x1279('0x2e')]));_0x454c0c[_0x1279('0x2d')]=_0x454c0c[_0x1279('0x2d')][_0x1279('0x2f')]?_0x454c0c[_0x1279('0x2d')]:_0x2509c5['model'];if(!_0x3cd8b0[_0x1279('0x2a')][_0x1279('0x30')](_0x1279('0x31'))){_0x454c0c['limit']=qs[_0x1279('0x19')](_0x3cd8b0[_0x1279('0x2a')][_0x1279('0x19')]);_0x454c0c[_0x1279('0x18')]=qs[_0x1279('0x18')](_0x3cd8b0[_0x1279('0x2a')]['offset']);}_0x454c0c[_0x1279('0x32')]=qs[_0x1279('0x33')](_0x3cd8b0[_0x1279('0x2a')]['sort']);_0x454c0c[_0x1279('0x34')]=qs[_0x1279('0x2b')](_[_0x1279('0x35')](_0x3cd8b0[_0x1279('0x2a')],_0x2509c5[_0x1279('0x2b')]),_0x33cfec);if(_0x3cd8b0[_0x1279('0x2a')][_0x1279('0x36')]){_0x454c0c['where']=_[_0x1279('0x37')](_0x454c0c['where'],{'$or':_[_0x1279('0x29')](_0x33cfec,function(_0x58d21a){if(_0x58d21a[_0x1279('0x38')]!==_0x1279('0x39')){var _0x3e3169={};_0x3e3169[_0x58d21a[_0x1279('0x23')]]={'$like':'%'+_0x3cd8b0[_0x1279('0x2a')][_0x1279('0x36')]+'%'};return _0x3e3169;}})});}_0x454c0c=_[_0x1279('0x37')]({},_0x454c0c,_0x3cd8b0[_0x1279('0x3a')]);var _0x21c7d2={'where':_0x454c0c[_0x1279('0x34')]};return db[_0x1279('0x3b')][_0x1279('0x1b')](_0x21c7d2)[_0x1279('0x21')](function(_0x5762f6){_0x1e9dac[_0x1279('0x1b')]=_0x5762f6;if(_0x3cd8b0[_0x1279('0x2a')][_0x1279('0x3c')]){_0x454c0c[_0x1279('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1279('0x3e')](_0x454c0c);})['then'](function(_0x4e35df){_0x1e9dac[_0x1279('0x3f')]=_0x4e35df;return _0x1e9dac;})['then'](respondWithFilteredResult(_0x99ccec,_0x454c0c))[_0x1279('0x40')](handleError(_0x99ccec,null));};exports['show']=function(_0xe2cdbd,_0x543d7b){var _0x38e713={'raw':!![],'where':{'id':_0xe2cdbd['params']['id']}},_0x9d9940={};_0x9d9940[_0x1279('0x28')]=_[_0x1279('0x41')](db[_0x1279('0x3b')][_0x1279('0x26')]);_0x9d9940['query']=_[_0x1279('0x41')](_0xe2cdbd[_0x1279('0x2a')]);_0x9d9940[_0x1279('0x2b')]=_[_0x1279('0x2c')](_0x9d9940[_0x1279('0x28')],_0x9d9940[_0x1279('0x2a')]);_0x38e713[_0x1279('0x2d')]=_[_0x1279('0x2c')](_0x9d9940['model'],qs[_0x1279('0x2e')](_0xe2cdbd['query']['fields']));_0x38e713[_0x1279('0x2d')]=_0x38e713[_0x1279('0x2d')][_0x1279('0x2f')]?_0x38e713[_0x1279('0x2d')]:_0x9d9940[_0x1279('0x28')];if(_0xe2cdbd[_0x1279('0x2a')][_0x1279('0x3c')]){_0x38e713[_0x1279('0x3d')]=[{'all':!![]}];}_0x38e713=_[_0x1279('0x37')]({},_0x38e713,_0xe2cdbd[_0x1279('0x3a')]);return db[_0x1279('0x3b')][_0x1279('0x42')](_0x38e713)[_0x1279('0x21')](handleEntityNotFound(_0x543d7b,null))['then'](respondWithResult(_0x543d7b,null))[_0x1279('0x40')](handleError(_0x543d7b,null));};exports[_0x1279('0x1f')]=function(_0x57fec8,_0x4b163f){if(_0x57fec8[_0x1279('0x43')]['id']){delete _0x57fec8[_0x1279('0x43')]['id'];}return db[_0x1279('0x3b')]['find']({'where':{'id':_0x57fec8['params']['id']}})[_0x1279('0x21')](handleEntityNotFound(_0x4b163f,null))[_0x1279('0x21')](saveUpdates(_0x57fec8[_0x1279('0x43')],null))[_0x1279('0x21')](respondWithResult(_0x4b163f,null))[_0x1279('0x40')](handleError(_0x4b163f,null));};exports['destroy']=function(_0x1f11b7,_0x1bbedd){return db[_0x1279('0x3b')][_0x1279('0x42')]({'where':{'id':_0x1f11b7[_0x1279('0x44')]['id']}})[_0x1279('0x21')](handleEntityNotFound(_0x1bbedd,null))[_0x1279('0x21')](removeEntity(_0x1bbedd,null))[_0x1279('0x40')](handleError(_0x1bbedd,null));};exports[_0x1279('0x45')]=function(_0x57ce59,_0xf86ce6){return db['CmHopperBlack'][_0x1279('0x45')]()[_0x1279('0x21')](respondWithResult(_0xf86ce6,null))['catch'](handleError(_0xf86ce6,null));}; \ No newline at end of file +var _0x93b9=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','status','end','offset','undefined','count','limit','set','json','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x93b9,0xb1));var _0x993b=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0x93b9[_0x6aad74];return _0x5b1c38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x993b('0x0'));var zipdir=require(_0x993b('0x1'));var jsonpatch=require(_0x993b('0x2'));var rp=require(_0x993b('0x3'));var moment=require('moment');var BPromise=require(_0x993b('0x4'));var Mustache=require(_0x993b('0x5'));var util=require(_0x993b('0x6'));var path=require('path');var sox=require(_0x993b('0x7'));var csv=require(_0x993b('0x8'));var ejs=require(_0x993b('0x9'));var fs=require('fs');var fs_extra=require(_0x993b('0xa'));var _=require(_0x993b('0xb'));var squel=require(_0x993b('0xc'));var crypto=require(_0x993b('0xd'));var jsforce=require(_0x993b('0xe'));var deskjs=require(_0x993b('0xf'));var toCsv=require(_0x993b('0x8'));var querystring=require(_0x993b('0x10'));var Papa=require(_0x993b('0x11'));var Redis=require(_0x993b('0x12'));var authService=require(_0x993b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x993b('0x14'));var hardwareService=require(_0x993b('0x15'));var logger=require(_0x993b('0x16'))(_0x993b('0x17'));var utils=require(_0x993b('0x18'));var config=require(_0x993b('0x19'));var licenseUtil=require(_0x993b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x167acd,_0x31d9a0){_0x31d9a0=_0x31d9a0||0xcc;return function(_0x115f07){if(_0x115f07){return _0x167acd['sendStatus'](_0x31d9a0);}return _0x167acd[_0x993b('0x1b')](_0x31d9a0)[_0x993b('0x1c')]();};}function respondWithResult(_0x5636d9,_0x46cba5){_0x46cba5=_0x46cba5||0xc8;return function(_0x452c25){if(_0x452c25){return _0x5636d9['status'](_0x46cba5)['json'](_0x452c25);}};}function respondWithFilteredResult(_0x136a15,_0x18a4c5){return function(_0x3faa48){if(_0x3faa48){var _0x47daae=typeof _0x18a4c5[_0x993b('0x1d')]===_0x993b('0x1e')&&typeof _0x18a4c5['limit']===_0x993b('0x1e');var _0x42c792=_0x3faa48[_0x993b('0x1f')];var _0xe58e4d=_0x47daae?0x0:_0x18a4c5[_0x993b('0x1d')];var _0x2f0b75=_0x47daae?_0x3faa48[_0x993b('0x1f')]:_0x18a4c5[_0x993b('0x1d')]+_0x18a4c5[_0x993b('0x20')];var _0x2e7584;if(_0x2f0b75>=_0x42c792){_0x2f0b75=_0x42c792;_0x2e7584=0xc8;}else{_0x2e7584=0xce;}_0x136a15['status'](_0x2e7584);return _0x136a15[_0x993b('0x21')]('Content-Range',_0xe58e4d+'-'+_0x2f0b75+'/'+_0x42c792)[_0x993b('0x22')](_0x3faa48);}return null;};}function patchUpdates(_0xbb61e8){return function(_0x2c09a6){try{jsonpatch[_0x993b('0x23')](_0x2c09a6,_0xbb61e8,!![]);}catch(_0x5da5ec){return BPromise[_0x993b('0x24')](_0x5da5ec);}return _0x2c09a6['save']();};}function saveUpdates(_0x452fb1,_0x4e2f57){return function(_0x562fc3){if(_0x562fc3){return _0x562fc3['update'](_0x452fb1)['then'](function(_0x1e4ce8){return _0x1e4ce8;});}return null;};}function removeEntity(_0x5ae239,_0xd102c2){return function(_0x153b2b){if(_0x153b2b){return _0x153b2b[_0x993b('0x25')]()[_0x993b('0x26')](function(){_0x5ae239[_0x993b('0x1b')](0xcc)[_0x993b('0x1c')]();});}};}function handleEntityNotFound(_0x3dd30a,_0x517639){return function(_0x1b08ca){if(!_0x1b08ca){_0x3dd30a[_0x993b('0x27')](0x194);}return _0x1b08ca;};}function handleError(_0x44bb82,_0x418331){_0x418331=_0x418331||0x1f4;return function(_0x3ec561){logger[_0x993b('0x28')](_0x3ec561[_0x993b('0x29')]);if(_0x3ec561[_0x993b('0x2a')]){delete _0x3ec561[_0x993b('0x2a')];}_0x44bb82[_0x993b('0x1b')](_0x418331)[_0x993b('0x2b')](_0x3ec561);};}exports[_0x993b('0x2c')]=function(_0x56b08a,_0x28f7c2){var _0x32cd12={},_0x19e4b7={},_0x55a33e={'count':0x0,'rows':[]};var _0x1c699f=_[_0x993b('0x2d')](db[_0x993b('0x2e')][_0x993b('0x2f')],function(_0x581ae7){return{'name':_0x581ae7[_0x993b('0x30')],'type':_0x581ae7[_0x993b('0x31')][_0x993b('0x32')]};});_0x19e4b7[_0x993b('0x33')]=_[_0x993b('0x2d')](_0x1c699f,_0x993b('0x2a'));_0x19e4b7[_0x993b('0x34')]=_[_0x993b('0x35')](_0x56b08a[_0x993b('0x34')]);_0x19e4b7[_0x993b('0x36')]=_[_0x993b('0x37')](_0x19e4b7[_0x993b('0x33')],_0x19e4b7[_0x993b('0x34')]);_0x32cd12[_0x993b('0x38')]=_['intersection'](_0x19e4b7[_0x993b('0x33')],qs[_0x993b('0x39')](_0x56b08a['query'][_0x993b('0x39')]));_0x32cd12[_0x993b('0x38')]=_0x32cd12[_0x993b('0x38')][_0x993b('0x3a')]?_0x32cd12[_0x993b('0x38')]:_0x19e4b7[_0x993b('0x33')];if(!_0x56b08a[_0x993b('0x34')][_0x993b('0x3b')](_0x993b('0x3c'))){_0x32cd12['limit']=qs[_0x993b('0x20')](_0x56b08a['query'][_0x993b('0x20')]);_0x32cd12['offset']=qs[_0x993b('0x1d')](_0x56b08a[_0x993b('0x34')]['offset']);}_0x32cd12[_0x993b('0x3d')]=qs[_0x993b('0x3e')](_0x56b08a[_0x993b('0x34')][_0x993b('0x3e')]);_0x32cd12['where']=qs[_0x993b('0x36')](_['pick'](_0x56b08a[_0x993b('0x34')],_0x19e4b7[_0x993b('0x36')]),_0x1c699f);if(_0x56b08a[_0x993b('0x34')][_0x993b('0x3f')]){_0x32cd12[_0x993b('0x40')]=_[_0x993b('0x41')](_0x32cd12[_0x993b('0x40')],{'$or':_[_0x993b('0x2d')](_0x1c699f,function(_0x3fc931){if(_0x3fc931[_0x993b('0x31')]!==_0x993b('0x42')){var _0x231185={};_0x231185[_0x3fc931[_0x993b('0x2a')]]={'$like':'%'+_0x56b08a[_0x993b('0x34')]['filter']+'%'};return _0x231185;}})});}_0x32cd12=_['merge']({},_0x32cd12,_0x56b08a[_0x993b('0x43')]);var _0x2e5559={'where':_0x32cd12[_0x993b('0x40')]};return db[_0x993b('0x2e')][_0x993b('0x1f')](_0x2e5559)[_0x993b('0x26')](function(_0x217829){_0x55a33e[_0x993b('0x1f')]=_0x217829;if(_0x56b08a[_0x993b('0x34')][_0x993b('0x44')]){_0x32cd12[_0x993b('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x993b('0x46')](_0x32cd12);})['then'](function(_0x605e74){_0x55a33e['rows']=_0x605e74;return _0x55a33e;})[_0x993b('0x26')](respondWithFilteredResult(_0x28f7c2,_0x32cd12))[_0x993b('0x47')](handleError(_0x28f7c2,null));};exports['show']=function(_0x43f998,_0x1f4dd9){var _0x31039c={'raw':!![],'where':{'id':_0x43f998[_0x993b('0x48')]['id']}},_0x4c4b72={};_0x4c4b72['model']=_[_0x993b('0x35')](db[_0x993b('0x2e')][_0x993b('0x2f')]);_0x4c4b72[_0x993b('0x34')]=_[_0x993b('0x35')](_0x43f998[_0x993b('0x34')]);_0x4c4b72[_0x993b('0x36')]=_['intersection'](_0x4c4b72[_0x993b('0x33')],_0x4c4b72[_0x993b('0x34')]);_0x31039c[_0x993b('0x38')]=_[_0x993b('0x37')](_0x4c4b72[_0x993b('0x33')],qs['fields'](_0x43f998['query'][_0x993b('0x39')]));_0x31039c[_0x993b('0x38')]=_0x31039c[_0x993b('0x38')][_0x993b('0x3a')]?_0x31039c[_0x993b('0x38')]:_0x4c4b72[_0x993b('0x33')];if(_0x43f998[_0x993b('0x34')][_0x993b('0x44')]){_0x31039c[_0x993b('0x45')]=[{'all':!![]}];}_0x31039c=_[_0x993b('0x41')]({},_0x31039c,_0x43f998[_0x993b('0x43')]);return db[_0x993b('0x2e')]['find'](_0x31039c)[_0x993b('0x26')](handleEntityNotFound(_0x1f4dd9,null))[_0x993b('0x26')](respondWithResult(_0x1f4dd9,null))['catch'](handleError(_0x1f4dd9,null));};exports[_0x993b('0x49')]=function(_0x3f83a9,_0x194d88){if(_0x3f83a9[_0x993b('0x4a')]['id']){delete _0x3f83a9[_0x993b('0x4a')]['id'];}return db[_0x993b('0x2e')]['find']({'where':{'id':_0x3f83a9[_0x993b('0x48')]['id']}})[_0x993b('0x26')](handleEntityNotFound(_0x194d88,null))['then'](saveUpdates(_0x3f83a9[_0x993b('0x4a')],null))[_0x993b('0x26')](respondWithResult(_0x194d88,null))[_0x993b('0x47')](handleError(_0x194d88,null));};exports[_0x993b('0x25')]=function(_0x33aedf,_0x53ad74){return db['CmHopperBlack'][_0x993b('0x4b')]({'where':{'id':_0x33aedf['params']['id']}})[_0x993b('0x26')](handleEntityNotFound(_0x53ad74,null))['then'](removeEntity(_0x53ad74,null))[_0x993b('0x47')](handleError(_0x53ad74,null));};exports[_0x993b('0x4c')]=function(_0x11884b,_0x37bd3b){return db[_0x993b('0x2e')][_0x993b('0x4c')]()['then'](respondWithResult(_0x37bd3b,null))[_0x993b('0x47')](handleError(_0x37bd3b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 788c5c1..89f447e 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 _0xef83=['moment','bluebird','path','rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xef83,0x128));var _0x3ef8=function(_0x580409,_0x11a6e8){_0x580409=_0x580409-0x0;var _0x126a85=_0xef83[_0x580409];return _0x126a85;};'use strict';var _=require(_0x3ef8('0x0'));var util=require(_0x3ef8('0x1'));var logger=require(_0x3ef8('0x2'))(_0x3ef8('0x3'));var moment=require(_0x3ef8('0x4'));var BPromise=require(_0x3ef8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ef8('0x6'));var rimraf=require(_0x3ef8('0x7'));var config=require(_0x3ef8('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x3ef8('0x9')]=function(_0x155217,_0x43bb9d){return _0x155217['define'](_0x3ef8('0xa'),attributes,{'tableName':_0x3ef8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba19=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x26c781,_0x79b768){var _0x58ea20=function(_0x471a68){while(--_0x471a68){_0x26c781['push'](_0x26c781['shift']());}};_0x58ea20(++_0x79b768);}(_0xba19,0xef));var _0x9ba1=function(_0x1b36d3,_0x4fc9c1){_0x1b36d3=_0x1b36d3-0x0;var _0x2f82b3=_0xba19[_0x1b36d3];return _0x2f82b3;};'use strict';var _=require(_0x9ba1('0x0'));var util=require(_0x9ba1('0x1'));var logger=require(_0x9ba1('0x2'))(_0x9ba1('0x3'));var moment=require(_0x9ba1('0x4'));var BPromise=require(_0x9ba1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba1('0x6'));var config=require(_0x9ba1('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x9ba1('0x8')]=function(_0x387cf6,_0x1ff909){return _0x387cf6[_0x9ba1('0x9')](_0x9ba1('0xa'),attributes,{'tableName':_0x9ba1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index d32a002..e88399f 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 _0xb2f0=['options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','raw','destroy','DestroyCmHopperBlack','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll'];(function(_0x54ccda,_0x5a0d57){var _0x3c81cc=function(_0x4b0877){while(--_0x4b0877){_0x54ccda['push'](_0x54ccda['shift']());}};_0x3c81cc(++_0x5a0d57);}(_0xb2f0,0x76));var _0x0b2f=function(_0xcf1206,_0x48ca8a){_0xcf1206=_0xcf1206-0x0;var _0x4271ef=_0xb2f0[_0xcf1206];return _0x4271ef;};'use strict';var _=require(_0x0b2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0b2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b2f('0x2'));var db=require(_0x0b2f('0x3'))['db'];var utils=require(_0x0b2f('0x4'));var logger=require('../../config/logger')(_0x0b2f('0x5'));var config=require(_0x0b2f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0b2f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x118c4e,_0x1d248d,_0x6475a7){return new BPromise(function(_0x6ad0de,_0x1f9c66){return client[_0x0b2f('0x8')](_0x118c4e,_0x6475a7)[_0x0b2f('0x9')](function(_0x484ebb){logger['info'](_0x0b2f('0xa'),_0x1d248d,'request\x20sent');logger[_0x0b2f('0xb')](_0x0b2f('0xc'),_0x1d248d,_0x0b2f('0xd'),JSON[_0x0b2f('0xe')](_0x484ebb));if(_0x484ebb[_0x0b2f('0xf')]){if(_0x484ebb[_0x0b2f('0xf')]['code']===0x1f4){logger[_0x0b2f('0xf')](_0x0b2f('0xa'),_0x1d248d,_0x484ebb['error'][_0x0b2f('0x10')]);return _0x1f9c66(_0x484ebb[_0x0b2f('0xf')]['message']);}logger[_0x0b2f('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x1d248d,_0x484ebb[_0x0b2f('0xf')]['message']);return _0x6ad0de(_0x484ebb[_0x0b2f('0xf')][_0x0b2f('0x10')]);}else{logger[_0x0b2f('0x11')](_0x0b2f('0xa'),_0x1d248d,_0x0b2f('0xd'));_0x6ad0de(_0x484ebb['result'][_0x0b2f('0x10')]);}})[_0x0b2f('0x12')](function(_0x339b1c){logger[_0x0b2f('0xf')](_0x0b2f('0xa'),_0x1d248d,_0x339b1c);_0x1f9c66(_0x339b1c);});});}exports[_0x0b2f('0x13')]=function(_0x240813){var _0x30d3e7=this;return new Promise(function(_0x159442,_0x4277ee){return db[_0x0b2f('0x14')][_0x0b2f('0x15')]({'raw':_0x240813[_0x0b2f('0x16')]?_0x240813[_0x0b2f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x240813[_0x0b2f('0x16')]?_0x240813[_0x0b2f('0x16')][_0x0b2f('0x17')]||null:null,'attributes':_0x240813[_0x0b2f('0x16')]?_0x240813[_0x0b2f('0x16')][_0x0b2f('0x18')]||null:null,'limit':_0x240813[_0x0b2f('0x16')]?_0x240813[_0x0b2f('0x16')][_0x0b2f('0x19')]||null:null,'include':_0x240813[_0x0b2f('0x16')]?_0x240813[_0x0b2f('0x16')][_0x0b2f('0x1a')]?_[_0x0b2f('0x1b')](_0x240813['options'][_0x0b2f('0x1a')],function(_0x2d0c24){return{'model':db[_0x2d0c24['model']],'as':_0x2d0c24['as'],'attributes':_0x2d0c24['attributes'],'include':_0x2d0c24['include']?_[_0x0b2f('0x1b')](_0x2d0c24[_0x0b2f('0x1a')],function(_0x29c9bc){return{'model':db[_0x29c9bc['model']],'as':_0x29c9bc['as'],'attributes':_0x29c9bc[_0x0b2f('0x18')],'include':_0x29c9bc[_0x0b2f('0x1a')]?_[_0x0b2f('0x1b')](_0x29c9bc[_0x0b2f('0x1a')],function(_0x4e6867){return{'model':db[_0x4e6867[_0x0b2f('0x1c')]],'as':_0x4e6867['as'],'attributes':_0x4e6867[_0x0b2f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b2f('0x9')](function(_0x22da52){logger[_0x0b2f('0x11')](_0x0b2f('0x13'),_0x240813);logger[_0x0b2f('0xb')]('GetCmHopperBlack',_0x240813,JSON[_0x0b2f('0xe')](_0x22da52));_0x159442(_0x22da52);})['catch'](function(_0x180a20){logger[_0x0b2f('0xf')](_0x0b2f('0x13'),_0x180a20['message'],_0x240813);_0x4277ee(_0x30d3e7[_0x0b2f('0xf')](0x1f4,_0x180a20['message']));});});};exports[_0x0b2f('0x1d')]=function(_0x494c5a){var _0x2f4c03=this;return new Promise(function(_0x3eb9b5,_0x5d889a){return db[_0x0b2f('0x14')][_0x0b2f('0x1e')](_0x494c5a[_0x0b2f('0x1f')],{'raw':_0x494c5a[_0x0b2f('0x16')]?_0x494c5a['options'][_0x0b2f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x494c5a[_0x0b2f('0x16')]?_0x494c5a[_0x0b2f('0x16')][_0x0b2f('0x17')]||null:null,'attributes':_0x494c5a[_0x0b2f('0x16')]?_0x494c5a[_0x0b2f('0x16')][_0x0b2f('0x18')]||null:null,'limit':_0x494c5a[_0x0b2f('0x16')]?_0x494c5a[_0x0b2f('0x16')]['limit']||null:null})[_0x0b2f('0x9')](function(_0x4b9b90){logger['info'](_0x0b2f('0x1d'),_0x494c5a);logger[_0x0b2f('0xb')]('UpdateCmHopperBlack',_0x494c5a,JSON[_0x0b2f('0xe')](_0x4b9b90));_0x3eb9b5(_0x4b9b90);})[_0x0b2f('0x12')](function(_0x17a0d4){logger[_0x0b2f('0xf')](_0x0b2f('0x1d'),_0x17a0d4[_0x0b2f('0x10')],_0x494c5a);_0x5d889a(_0x2f4c03[_0x0b2f('0xf')](0x1f4,_0x17a0d4[_0x0b2f('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x37ca8c){var _0x19fe76=this;return new Promise(function(_0x337cb4,_0x41f800){return db[_0x0b2f('0x14')][_0x0b2f('0x21')]({'where':_0x37ca8c[_0x0b2f('0x16')]?_0x37ca8c[_0x0b2f('0x16')][_0x0b2f('0x17')]||null:null})[_0x0b2f('0x9')](function(_0x320b29){logger[_0x0b2f('0x11')]('DestroyCmHopperBlack',_0x37ca8c);logger[_0x0b2f('0xb')](_0x0b2f('0x22'),_0x37ca8c,JSON[_0x0b2f('0xe')](_0x320b29));_0x337cb4(_0x320b29);})['catch'](function(_0x75fd15){logger[_0x0b2f('0xf')](_0x0b2f('0x22'),_0x75fd15[_0x0b2f('0x10')],_0x37ca8c);_0x41f800(_0x19fe76[_0x0b2f('0xf')](0x1f4,_0x75fd15[_0x0b2f('0x10')]));});});}; \ No newline at end of file +var _0xe21c=['code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','then','stringify','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5d1b44,_0x4113bc){var _0x26f8cf=function(_0x24d573){while(--_0x24d573){_0x5d1b44['push'](_0x5d1b44['shift']());}};_0x26f8cf(++_0x4113bc);}(_0xe21c,0x118));var _0xce21=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xe21c[_0x599c94];return _0x34e215;};'use strict';var _=require('lodash');var util=require(_0xce21('0x0'));var moment=require(_0xce21('0x1'));var BPromise=require('bluebird');var rs=require(_0xce21('0x2'));var fs=require('fs');var Redis=require(_0xce21('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce21('0x4'));var logger=require('../../config/logger')(_0xce21('0x5'));var config=require(_0xce21('0x6'));var jayson=require(_0xce21('0x7'));var client=jayson[_0xce21('0x8')][_0xce21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f4ec8,_0x22f0bf,_0x193d00){return new BPromise(function(_0xbb7a8e,_0x2e4638){return client[_0xce21('0xa')](_0x4f4ec8,_0x193d00)['then'](function(_0x1ee309){logger[_0xce21('0xb')](_0xce21('0xc'),_0x22f0bf,_0xce21('0xd'));logger[_0xce21('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x22f0bf,_0xce21('0xd'),JSON['stringify'](_0x1ee309));if(_0x1ee309[_0xce21('0xf')]){if(_0x1ee309[_0xce21('0xf')][_0xce21('0x10')]===0x1f4){logger[_0xce21('0xf')](_0xce21('0xc'),_0x22f0bf,_0x1ee309['error'][_0xce21('0x11')]);return _0x2e4638(_0x1ee309[_0xce21('0xf')][_0xce21('0x11')]);}logger[_0xce21('0xf')](_0xce21('0xc'),_0x22f0bf,_0x1ee309[_0xce21('0xf')][_0xce21('0x11')]);return _0xbb7a8e(_0x1ee309[_0xce21('0xf')][_0xce21('0x11')]);}else{logger['info'](_0xce21('0xc'),_0x22f0bf,_0xce21('0xd'));_0xbb7a8e(_0x1ee309[_0xce21('0x12')]['message']);}})[_0xce21('0x13')](function(_0x292e81){logger[_0xce21('0xf')](_0xce21('0xc'),_0x22f0bf,_0x292e81);_0x2e4638(_0x292e81);});});}exports[_0xce21('0x14')]=function(_0x20fce){var _0x51e75e=this;return new Promise(function(_0x301179,_0x3a861f){return db[_0xce21('0x15')][_0xce21('0x16')]({'raw':_0x20fce['options']?_0x20fce[_0xce21('0x17')][_0xce21('0x18')]===undefined?!![]:![]:!![],'where':_0x20fce[_0xce21('0x17')]?_0x20fce[_0xce21('0x17')]['where']||null:null,'attributes':_0x20fce[_0xce21('0x17')]?_0x20fce[_0xce21('0x17')][_0xce21('0x19')]||null:null,'limit':_0x20fce[_0xce21('0x17')]?_0x20fce[_0xce21('0x17')][_0xce21('0x1a')]||null:null,'include':_0x20fce[_0xce21('0x17')]?_0x20fce[_0xce21('0x17')][_0xce21('0x1b')]?_[_0xce21('0x1c')](_0x20fce[_0xce21('0x17')][_0xce21('0x1b')],function(_0x3e7145){return{'model':db[_0x3e7145[_0xce21('0x1d')]],'as':_0x3e7145['as'],'attributes':_0x3e7145[_0xce21('0x19')],'include':_0x3e7145['include']?_[_0xce21('0x1c')](_0x3e7145[_0xce21('0x1b')],function(_0x3b0ae9){return{'model':db[_0x3b0ae9[_0xce21('0x1d')]],'as':_0x3b0ae9['as'],'attributes':_0x3b0ae9[_0xce21('0x19')],'include':_0x3b0ae9['include']?_[_0xce21('0x1c')](_0x3b0ae9['include'],function(_0x5126c4){return{'model':db[_0x5126c4['model']],'as':_0x5126c4['as'],'attributes':_0x5126c4[_0xce21('0x19')]};}):[]};}):[]};}):[]:[]})[_0xce21('0x1e')](function(_0x2b7df1){logger['info'](_0xce21('0x14'),_0x20fce);logger[_0xce21('0xe')](_0xce21('0x14'),_0x20fce,JSON[_0xce21('0x1f')](_0x2b7df1));_0x301179(_0x2b7df1);})[_0xce21('0x13')](function(_0x52fe90){logger[_0xce21('0xf')]('GetCmHopperBlack',_0x52fe90[_0xce21('0x11')],_0x20fce);_0x3a861f(_0x51e75e[_0xce21('0xf')](0x1f4,_0x52fe90[_0xce21('0x11')]));});});};exports[_0xce21('0x20')]=function(_0x19e207){var _0x1932b9=this;return new Promise(function(_0x2bc360,_0x56dca8){return db['CmHopperBlack'][_0xce21('0x21')](_0x19e207['body'],{'raw':_0x19e207[_0xce21('0x17')]?_0x19e207[_0xce21('0x17')][_0xce21('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e207[_0xce21('0x17')]?_0x19e207[_0xce21('0x17')][_0xce21('0x22')]||null:null,'attributes':_0x19e207['options']?_0x19e207[_0xce21('0x17')][_0xce21('0x19')]||null:null,'limit':_0x19e207[_0xce21('0x17')]?_0x19e207['options'][_0xce21('0x1a')]||null:null})[_0xce21('0x1e')](function(_0x452c68){logger['info'](_0xce21('0x20'),_0x19e207);logger['debug'](_0xce21('0x20'),_0x19e207,JSON[_0xce21('0x1f')](_0x452c68));_0x2bc360(_0x452c68);})[_0xce21('0x13')](function(_0xf5c1ec){logger['error']('UpdateCmHopperBlack',_0xf5c1ec[_0xce21('0x11')],_0x19e207);_0x56dca8(_0x1932b9[_0xce21('0xf')](0x1f4,_0xf5c1ec[_0xce21('0x11')]));});});};exports[_0xce21('0x23')]=function(_0x117bd6){var _0x397a39=this;return new Promise(function(_0x367435,_0x250b16){return db[_0xce21('0x15')][_0xce21('0x24')]({'where':_0x117bd6[_0xce21('0x17')]?_0x117bd6[_0xce21('0x17')][_0xce21('0x22')]||null:null})['then'](function(_0x1ce692){logger[_0xce21('0xb')](_0xce21('0x23'),_0x117bd6);logger[_0xce21('0xe')]('DestroyCmHopperBlack',_0x117bd6,JSON[_0xce21('0x1f')](_0x1ce692));_0x367435(_0x1ce692);})[_0xce21('0x13')](function(_0x320028){logger[_0xce21('0xf')](_0xce21('0x23'),_0x320028[_0xce21('0x11')],_0x117bd6);_0x250b16(_0x397a39[_0xce21('0xf')](0x1f4,_0x320028[_0xce21('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d56c872..205f33d 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 _0xef17=['show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','describe'];(function(_0x5d8949,_0x11c2cb){var _0x506102=function(_0x223859){while(--_0x223859){_0x5d8949['push'](_0x5d8949['shift']());}};_0x506102(++_0x11c2cb);}(_0xef17,0x136));var _0x7ef1=function(_0xf1b8e9,_0x33a8e5){_0xf1b8e9=_0xf1b8e9-0x0;var _0x574a15=_0xef17[_0xf1b8e9];return _0x574a15;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xe')](_0x7ef1('0xf'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3eab91,_0x35c439){_0x3eab91=_0x3eab91-0x0;var _0x1fbf45=_0xc2c7[_0x3eab91];return _0x1fbf45;};'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('./cmHopperBlack.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['put'](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);module[_0x7c2c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8810c8a..c8ece8f 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 _0x46fb=['DATE','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment','STRING','INTEGER'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x46fb,0x165));var _0xb46f=function(_0x2ab12c,_0x520137){_0x2ab12c=_0x2ab12c-0x0;var _0x5c803d=_0x46fb[_0x2ab12c];return _0x5c803d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb46f('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb46f('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb46f('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xb46f('0x1')]},'originatecalleridname':{'type':Sequelize[_0xb46f('0x1')]},'calleridnum':{'type':Sequelize[_0xb46f('0x1')]},'calleridname':{'type':Sequelize[_0xb46f('0x1')]},'starttime':{'type':Sequelize[_0xb46f('0x3')]},'responsetime':{'type':Sequelize[_0xb46f('0x3')]},'answertime':{'type':Sequelize[_0xb46f('0x3')]},'droptime':{'type':Sequelize[_0xb46f('0x3')]},'endtime':{'type':Sequelize[_0xb46f('0x3')]},'ringtime':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb46f('0x1')]},'membername':{'type':Sequelize[_0xb46f('0x1')]},'reason':{'type':Sequelize[_0xb46f('0x1')]},'disposition':{'type':Sequelize[_0xb46f('0x1')]},'secondDisposition':{'type':Sequelize[_0xb46f('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb46f('0x3')],'set':function(_0x3a54ea){var _0x4f21c6=this['getDataValue'](_0xb46f('0x4'));if(_0x4f21c6&&_0x3a54ea){this[_0xb46f('0x5')](_0xb46f('0x6'),moment(_0x3a54ea)[_0xb46f('0x7')](moment(_0x4f21c6),_0xb46f('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb46f('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb46f('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb46f('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb46f('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb46f('0x3')]},'recallme':{'type':Sequelize[_0xb46f('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb46f('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb46f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x07ab=['endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x07ab,0x14a));var _0xb07a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x07ab[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb07a('0x0'));module[_0xb07a('0x1')]={'state':{'type':Sequelize[_0xb07a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb07a('0x3')]},'scheduledat':{'type':Sequelize[_0xb07a('0x4')]},'countbusyretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb07a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb07a('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb07a('0x3')]},'calleridname':{'type':Sequelize[_0xb07a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb07a('0x4')]},'answertime':{'type':Sequelize[_0xb07a('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb07a('0x3')]},'campaign':{'type':Sequelize[_0xb07a('0x3')]},'campaigntype':{'type':Sequelize[_0xb07a('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb07a('0x3')]},'disposition':{'type':Sequelize[_0xb07a('0x3')]},'secondDisposition':{'type':Sequelize[_0xb07a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb07a('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x45baf6){var _0x196850=this[_0xb07a('0x5')](_0xb07a('0x6'));if(_0x196850&&_0x45baf6){this[_0xb07a('0x7')](_0xb07a('0x8'),moment(_0x45baf6)[_0xb07a('0x9')](moment(_0x196850),_0xb07a('0xa')));}}},'amd':{'type':Sequelize[_0xb07a('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb07a('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb07a('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb07a('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb07a('0x4')]},'callback':{'type':Sequelize[_0xb07a('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb07a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb07a('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb07a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d025879..3ba41e5 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 _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x8fa6ea,_0x338e56){var _0x3ed940=function(_0x1d1880){while(--_0x1d1880){_0x8fa6ea['push'](_0x8fa6ea['shift']());}};_0x3ed940(++_0x338e56);}(_0xacf4,0xe7));var _0x4acf=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xacf4[_0x48e1ec];return _0x3b33eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file +var _0xc1c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4e753e,_0x11b764){_0x4e753e=_0x4e753e-0x0;var _0x150630=_0xc1c6[_0x4e753e];return _0x150630;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3439d9a..5bc23f6 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 _0x0d58=['api','bluebird','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x0d58,0xf4));var _0x80d5=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x0d58[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0x80d5('0x0'));var util=require(_0x80d5('0x1'));var logger=require(_0x80d5('0x2'))(_0x80d5('0x3'));var moment=require('moment');var BPromise=require(_0x80d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80d5('0x5'));var config=require('../../config/environment');var attributes=require(_0x80d5('0x6'));module[_0x80d5('0x7')]=function(_0x28c7ef,_0x38d9de){return _0x28c7ef[_0x80d5('0x8')](_0x80d5('0x9'),attributes,{'tableName':_0x80d5('0xa'),'paranoid':![],'indexes':[{'name':_0x80d5('0xb'),'fields':[_0x80d5('0xb')]},{'name':'uniqueid','fields':[_0x80d5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c0d=['path','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','uniqueid','lodash','api','moment'];(function(_0x53a382,_0x21cfcf){var _0x150aca=function(_0x51ecd9){while(--_0x51ecd9){_0x53a382['push'](_0x53a382['shift']());}};_0x150aca(++_0x21cfcf);}(_0x8c0d,0x15b));var _0xd8c0=function(_0x4571ad,_0x48bfb3){_0x4571ad=_0x4571ad-0x0;var _0x402178=_0x8c0d[_0x4571ad];return _0x402178;};'use strict';var _=require(_0xd8c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd8c0('0x1'));var moment=require(_0xd8c0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8c0('0x3'));var rimraf=require(_0xd8c0('0x4'));var config=require('../../config/environment');var attributes=require(_0xd8c0('0x5'));module[_0xd8c0('0x6')]=function(_0x2f4171,_0x4b8e7f){return _0x2f4171[_0xd8c0('0x7')]('CmHopperFinal',attributes,{'tableName':_0xd8c0('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':[_0xd8c0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 46825a4..2b4028b 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(_0x53bcb3,_0x529bb7){var _0xfcd23b=function(_0x522cb8){while(--_0x522cb8){_0x53bcb3['push'](_0x53bcb3['shift']());}};_0xfcd23b(++_0x529bb7);}(_0xb10b,0x12a));var _0xbb10=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0xb10b[_0x462fe4];return _0x82b23a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5686a4,_0x4649d2){var _0x389472=function(_0x1a2b54){while(--_0x1a2b54){_0x5686a4['push'](_0x5686a4['shift']());}};_0x389472(++_0x4649d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0xb10b[_0x3d8d0a];return _0x5b9df5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 732fc6a..2054f50 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 _0xe61c=['../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','checkContactHopper','put','multer','path','connect-timeout','express'];(function(_0x341d74,_0x2d3080){var _0x20f66a=function(_0x2f5116){while(--_0x2f5116){_0x341d74['push'](_0x341d74['shift']());}};_0x20f66a(++_0x2d3080);}(_0xe61c,0xee));var _0xce61=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xe61c[_0x422be2];return _0x1b820e;};'use strict';var multer=require(_0xce61('0x0'));var util=require('util');var path=require(_0xce61('0x1'));var timeout=require(_0xce61('0x2'));var express=require(_0xce61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce61('0x5'));var controller=require(_0xce61('0x6'));router[_0xce61('0x7')]('/',auth[_0xce61('0x8')](),controller[_0xce61('0x9')]);router[_0xce61('0x7')](_0xce61('0xa'),auth['isAuthenticated'](),controller[_0xce61('0xb')]);router[_0xce61('0x7')](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0xd')]);router[_0xce61('0x7')](_0xce61('0xe'),auth['isAuthenticated'](),controller[_0xce61('0xf')]);router[_0xce61('0x7')]('/campaign/countAttributes/:id',auth[_0xce61('0x8')](),controller[_0xce61('0x10')]);router['post'](_0xce61('0x11'),auth['isAuthenticated'](),controller[_0xce61('0x12')]);router[_0xce61('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xce61('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xce61('0x13')]('/checkContactHopper',auth[_0xce61('0x8')](),controller[_0xce61('0x14')]);router[_0xce61('0x15')](_0xce61('0xc'),auth[_0xce61('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x6737=['checkContactHopper','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6737,0x11b));var _0x7673=function(_0x2b12a7,_0x374e60){_0x2b12a7=_0x2b12a7-0x0;var _0x33dd4c=_0x6737[_0x2b12a7];return _0x33dd4c;};'use strict';var multer=require(_0x7673('0x0'));var util=require(_0x7673('0x1'));var path=require(_0x7673('0x2'));var timeout=require(_0x7673('0x3'));var express=require('express');var router=express[_0x7673('0x4')]();var fs_extra=require(_0x7673('0x5'));var auth=require(_0x7673('0x6'));var interaction=require(_0x7673('0x7'));var config=require('../../config/environment');var controller=require(_0x7673('0x8'));router[_0x7673('0x9')]('/',auth[_0x7673('0xa')](),controller[_0x7673('0xb')]);router[_0x7673('0x9')](_0x7673('0xc'),auth[_0x7673('0xa')](),controller[_0x7673('0xd')]);router[_0x7673('0x9')](_0x7673('0xe'),auth[_0x7673('0xa')](),controller[_0x7673('0xf')]);router['get'](_0x7673('0x10'),auth[_0x7673('0xa')](),controller[_0x7673('0x11')]);router[_0x7673('0x9')](_0x7673('0x12'),auth[_0x7673('0xa')](),controller[_0x7673('0x13')]);router['post'](_0x7673('0x14'),auth[_0x7673('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x7673('0x15')](_0x7673('0x16'),auth[_0x7673('0xa')](),controller[_0x7673('0x17')]);router['post'](_0x7673('0x18'),auth[_0x7673('0xa')](),controller[_0x7673('0x19')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7673('0x1a')]);module[_0x7673('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 506f2d0..df405f6 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 _0x428b=['STRING','INTEGER','DATE','BOOLEAN','sequelize','exports'];(function(_0x3f9d5c,_0x385498){var _0x3d9e0b=function(_0x50739a){while(--_0x50739a){_0x3f9d5c['push'](_0x3f9d5c['shift']());}};_0x3d9e0b(++_0x385498);}(_0x428b,0xd0));var _0xb428=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x428b[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xb428('0x0'));module[_0xb428('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb428('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb428('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb428('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb428('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb428('0x2')]},'starttime':{'type':Sequelize[_0xb428('0x4')]},'responsetime':{'type':Sequelize[_0xb428('0x4')]},'answertime':{'type':Sequelize[_0xb428('0x4')]},'droptime':{'type':Sequelize[_0xb428('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb428('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb428('0x2')]},'amd':{'type':Sequelize[_0xb428('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb428('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb428('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb428('0x4')]},'edited':{'type':Sequelize[_0xb428('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb428('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb428('0x2')]}}; \ No newline at end of file +var _0xe5a6=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe5a6,0x104));var _0x6e5a=function(_0x919bbb,_0x55ef48){_0x919bbb=_0x919bbb-0x0;var _0x40971a=_0xe5a6[_0x919bbb];return _0x40971a;};'use strict';var Sequelize=require(_0x6e5a('0x0'));module[_0x6e5a('0x1')]={'state':{'type':Sequelize[_0x6e5a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6e5a('0x3')]},'scheduledat':{'type':Sequelize[_0x6e5a('0x4')]},'countbusyretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x6e5a('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6e5a('0x3')]},'calleridnum':{'type':Sequelize[_0x6e5a('0x3')]},'calleridname':{'type':Sequelize[_0x6e5a('0x3')]},'starttime':{'type':Sequelize[_0x6e5a('0x4')]},'responsetime':{'type':Sequelize[_0x6e5a('0x4')]},'answertime':{'type':Sequelize[_0x6e5a('0x4')]},'droptime':{'type':Sequelize[_0x6e5a('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6e5a('0x3')]},'campaign':{'type':Sequelize[_0x6e5a('0x3')]},'campaigntype':{'type':Sequelize[_0x6e5a('0x3')]},'membername':{'type':Sequelize[_0x6e5a('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x6e5a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6e5a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6e5a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6e5a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e5a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6e5a('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6e5a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6e5a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ba0376c..2a42a46 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 _0x64f0=['undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','CmHopperHistory','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','then','includeAll','include','rows','catch','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x64f0,0x15a));var _0x064f=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x64f0[_0x53b594];return _0x1e616f;};'use strict';var emlformat=require(_0x064f('0x0'));var rimraf=require(_0x064f('0x1'));var zipdir=require(_0x064f('0x2'));var jsonpatch=require(_0x064f('0x3'));var rp=require(_0x064f('0x4'));var moment=require(_0x064f('0x5'));var BPromise=require(_0x064f('0x6'));var Mustache=require(_0x064f('0x7'));var util=require('util');var path=require('path');var sox=require(_0x064f('0x8'));var csv=require(_0x064f('0x9'));var ejs=require(_0x064f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x064f('0xb'));var squel=require('squel');var crypto=require(_0x064f('0xc'));var jsforce=require(_0x064f('0xd'));var deskjs=require(_0x064f('0xe'));var toCsv=require(_0x064f('0x9'));var querystring=require(_0x064f('0xf'));var Papa=require('papaparse');var Redis=require(_0x064f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x064f('0x11'));var as=require(_0x064f('0x12'));var hardwareService=require(_0x064f('0x13'));var logger=require('../../config/logger')(_0x064f('0x14'));var utils=require('../../config/utils');var config=require(_0x064f('0x15'));var licenseUtil=require(_0x064f('0x16'));var db=require(_0x064f('0x17'))['db'];function respondWithStatusCode(_0x260ee5,_0x2c50f5){_0x2c50f5=_0x2c50f5||0xcc;return function(_0x3bd78b){if(_0x3bd78b){return _0x260ee5[_0x064f('0x18')](_0x2c50f5);}return _0x260ee5[_0x064f('0x19')](_0x2c50f5)[_0x064f('0x1a')]();};}function respondWithResult(_0x4e9111,_0x501ff8){_0x501ff8=_0x501ff8||0xc8;return function(_0x296c99){if(_0x296c99){return _0x4e9111[_0x064f('0x19')](_0x501ff8)[_0x064f('0x1b')](_0x296c99);}};}function respondWithFilteredResult(_0x58f639,_0x57af77){return function(_0x51f519){if(_0x51f519){var _0x542421=typeof _0x57af77[_0x064f('0x1c')]===_0x064f('0x1d')&&typeof _0x57af77[_0x064f('0x1e')]===_0x064f('0x1d');var _0x123e45=_0x51f519[_0x064f('0x1f')];var _0x16799c=_0x542421?0x0:_0x57af77['offset'];var _0x352831=_0x542421?_0x51f519[_0x064f('0x1f')]:_0x57af77['offset']+_0x57af77[_0x064f('0x1e')];var _0x53abc4;if(_0x352831>=_0x123e45){_0x352831=_0x123e45;_0x53abc4=0xc8;}else{_0x53abc4=0xce;}_0x58f639['status'](_0x53abc4);return _0x58f639[_0x064f('0x20')](_0x064f('0x21'),_0x16799c+'-'+_0x352831+'/'+_0x123e45)[_0x064f('0x1b')](_0x51f519);}return null;};}function patchUpdates(_0x1f8d70){return function(_0x412e1f){try{jsonpatch[_0x064f('0x22')](_0x412e1f,_0x1f8d70,!![]);}catch(_0x302426){return BPromise[_0x064f('0x23')](_0x302426);}return _0x412e1f[_0x064f('0x24')]();};}function saveUpdates(_0x565085,_0x53b7d9){return function(_0x488ec5){if(_0x488ec5){return _0x488ec5[_0x064f('0x25')](_0x565085)['then'](function(_0x14c2ff){return _0x14c2ff;});}return null;};}function removeEntity(_0x13e8f7,_0x1f5f1a){return function(_0x38319b){if(_0x38319b){return _0x38319b[_0x064f('0x26')]()['then'](function(){_0x13e8f7['status'](0xcc)[_0x064f('0x1a')]();});}};}function handleEntityNotFound(_0x225b3f,_0x1ae885){return function(_0xac1281){if(!_0xac1281){_0x225b3f[_0x064f('0x18')](0x194);}return _0xac1281;};}function handleError(_0x5d14a5,_0x3682c0){_0x3682c0=_0x3682c0||0x1f4;return function(_0x404612){logger[_0x064f('0x27')](_0x404612[_0x064f('0x28')]);if(_0x404612['name']){delete _0x404612['name'];}_0x5d14a5[_0x064f('0x19')](_0x3682c0)[_0x064f('0x29')](_0x404612);};}exports[_0x064f('0x2a')]=function(_0xb0c353,_0x183f18){var _0x34a505={},_0x2a2ce0={},_0x255764={'count':0x0,'rows':[]};var _0x479bb8=_['map'](db[_0x064f('0x2b')]['rawAttributes'],function(_0x823074){return{'name':_0x823074['fieldName'],'type':_0x823074[_0x064f('0x2c')][_0x064f('0x2d')]};});_0x2a2ce0[_0x064f('0x2e')]=_[_0x064f('0x2f')](_0x479bb8,_0x064f('0x30'));_0x2a2ce0[_0x064f('0x31')]=_['keys'](_0xb0c353[_0x064f('0x31')]);_0x2a2ce0[_0x064f('0x32')]=_[_0x064f('0x33')](_0x2a2ce0[_0x064f('0x2e')],_0x2a2ce0['query']);_0x34a505[_0x064f('0x34')]=_['intersection'](_0x2a2ce0[_0x064f('0x2e')],qs[_0x064f('0x35')](_0xb0c353[_0x064f('0x31')]['fields']));_0x34a505[_0x064f('0x34')]=_0x34a505[_0x064f('0x34')][_0x064f('0x36')]?_0x34a505[_0x064f('0x34')]:_0x2a2ce0[_0x064f('0x2e')];if(!_0xb0c353['query'][_0x064f('0x37')]('nolimit')){_0x34a505[_0x064f('0x1e')]=qs[_0x064f('0x1e')](_0xb0c353[_0x064f('0x31')][_0x064f('0x1e')]);_0x34a505[_0x064f('0x1c')]=qs[_0x064f('0x1c')](_0xb0c353[_0x064f('0x31')][_0x064f('0x1c')]);}_0x34a505[_0x064f('0x38')]=qs['sort'](_0xb0c353[_0x064f('0x31')][_0x064f('0x39')]);_0x34a505[_0x064f('0x3a')]=qs['filters'](_[_0x064f('0x3b')](_0xb0c353[_0x064f('0x31')],_0x2a2ce0[_0x064f('0x32')]),_0x479bb8);if(_0xb0c353['query'][_0x064f('0x3c')]){_0x34a505['where']=_[_0x064f('0x3d')](_0x34a505[_0x064f('0x3a')],{'$or':_[_0x064f('0x2f')](_0x479bb8,function(_0x270de0){if(_0x270de0['type']!=='VIRTUAL'){var _0x5f9ca6={};_0x5f9ca6[_0x270de0['name']]={'$like':'%'+_0xb0c353[_0x064f('0x31')][_0x064f('0x3c')]+'%'};return _0x5f9ca6;}})});}_0x34a505=_[_0x064f('0x3d')]({},_0x34a505,_0xb0c353[_0x064f('0x3e')]);var _0x124e52={'where':_0x34a505[_0x064f('0x3a')]};return db['CmHopperHistory'][_0x064f('0x1f')](_0x124e52)[_0x064f('0x3f')](function(_0x4bfafa){_0x255764[_0x064f('0x1f')]=_0x4bfafa;if(_0xb0c353['query'][_0x064f('0x40')]){_0x34a505[_0x064f('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x34a505);})['then'](function(_0x36f957){_0x255764[_0x064f('0x42')]=_0x36f957;return _0x255764;})['then'](respondWithFilteredResult(_0x183f18,_0x34a505))[_0x064f('0x43')](handleError(_0x183f18,null));};exports['show']=function(_0x4ad9cf,_0x305761){var _0x599a04={'raw':!![],'where':{'id':_0x4ad9cf[_0x064f('0x44')]['id']}},_0x47e264={};_0x47e264[_0x064f('0x2e')]=_[_0x064f('0x45')](db['CmHopperHistory']['rawAttributes']);_0x47e264['query']=_[_0x064f('0x45')](_0x4ad9cf[_0x064f('0x31')]);_0x47e264[_0x064f('0x32')]=_[_0x064f('0x33')](_0x47e264['model'],_0x47e264['query']);_0x599a04[_0x064f('0x34')]=_[_0x064f('0x33')](_0x47e264[_0x064f('0x2e')],qs[_0x064f('0x35')](_0x4ad9cf[_0x064f('0x31')][_0x064f('0x35')]));_0x599a04[_0x064f('0x34')]=_0x599a04[_0x064f('0x34')][_0x064f('0x36')]?_0x599a04[_0x064f('0x34')]:_0x47e264[_0x064f('0x2e')];if(_0x4ad9cf[_0x064f('0x31')][_0x064f('0x40')]){_0x599a04[_0x064f('0x41')]=[{'all':!![]}];}_0x599a04=_[_0x064f('0x3d')]({},_0x599a04,_0x4ad9cf['options']);return db['CmHopperHistory'][_0x064f('0x46')](_0x599a04)[_0x064f('0x3f')](handleEntityNotFound(_0x305761,null))[_0x064f('0x3f')](respondWithResult(_0x305761,null))['catch'](handleError(_0x305761,null));};exports[_0x064f('0x47')]=function(_0x4f18e9,_0x3c502a){return db[_0x064f('0x2b')][_0x064f('0x47')](_0x4f18e9[_0x064f('0x48')],{})[_0x064f('0x3f')](respondWithResult(_0x3c502a,0xc9))[_0x064f('0x43')](handleError(_0x3c502a,null));};exports['describe']=function(_0x5f2cdd,_0x59d36c){return db['CmHopperHistory'][_0x064f('0x49')]()[_0x064f('0x3f')](respondWithResult(_0x59d36c,null))['catch'](handleError(_0x59d36c,null));};exports['update']=function(_0xfa04bb,_0x30c776){if(_0xfa04bb['body'][_0x064f('0x4a')]){delete _0xfa04bb[_0x064f('0x48')][_0x064f('0x4a')];}return db[_0x064f('0x2b')][_0x064f('0x46')]({'where':{'uniqueid':_0xfa04bb['params']['id']}})['then'](handleEntityNotFound(_0x30c776,null))[_0x064f('0x3f')](saveUpdates(_0xfa04bb[_0x064f('0x48')],null))[_0x064f('0x3f')](respondWithResult(_0x30c776,null))['catch'](handleError(_0x30c776,null));}; \ No newline at end of file +var _0xe06a=['merge','options','CmHopperHistory','includeAll','include','rows','catch','show','intersection','length','create','describe','body','uniqueid','find','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL'];(function(_0x3f7226,_0x21405a){var _0xd800b=function(_0x539636){while(--_0x539636){_0x3f7226['push'](_0x3f7226['shift']());}};_0xd800b(++_0x21405a);}(_0xe06a,0x18c));var _0xae06=function(_0x5de8af,_0x2e45b9){_0x5de8af=_0x5de8af-0x0;var _0x275f02=_0xe06a[_0x5de8af];return _0x275f02;};'use strict';var emlformat=require(_0xae06('0x0'));var rimraf=require(_0xae06('0x1'));var zipdir=require(_0xae06('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae06('0x3'));var moment=require(_0xae06('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae06('0x5'));var util=require('util');var path=require('path');var sox=require(_0xae06('0x6'));var csv=require('to-csv');var ejs=require(_0xae06('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xae06('0x8'));var jsforce=require(_0xae06('0x9'));var deskjs=require(_0xae06('0xa'));var toCsv=require(_0xae06('0xb'));var querystring=require('querystring');var Papa=require(_0xae06('0xc'));var Redis=require(_0xae06('0xd'));var authService=require(_0xae06('0xe'));var qs=require(_0xae06('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae06('0x10'));var logger=require(_0xae06('0x11'))(_0xae06('0x12'));var utils=require(_0xae06('0x13'));var config=require(_0xae06('0x14'));var licenseUtil=require(_0xae06('0x15'));var db=require(_0xae06('0x16'))['db'];function respondWithStatusCode(_0x5589b4,_0xbfd9ae){_0xbfd9ae=_0xbfd9ae||0xcc;return function(_0xa66529){if(_0xa66529){return _0x5589b4[_0xae06('0x17')](_0xbfd9ae);}return _0x5589b4[_0xae06('0x18')](_0xbfd9ae)['end']();};}function respondWithResult(_0x3d1dab,_0x43f502){_0x43f502=_0x43f502||0xc8;return function(_0x196503){if(_0x196503){return _0x3d1dab[_0xae06('0x18')](_0x43f502)[_0xae06('0x19')](_0x196503);}};}function respondWithFilteredResult(_0x3d1b67,_0x42f8cf){return function(_0x255040){if(_0x255040){var _0xd27398=typeof _0x42f8cf[_0xae06('0x1a')]===_0xae06('0x1b')&&typeof _0x42f8cf['limit']===_0xae06('0x1b');var _0x2b38d4=_0x255040[_0xae06('0x1c')];var _0x5753bd=_0xd27398?0x0:_0x42f8cf['offset'];var _0x4606e2=_0xd27398?_0x255040['count']:_0x42f8cf[_0xae06('0x1a')]+_0x42f8cf[_0xae06('0x1d')];var _0x2a2e7e;if(_0x4606e2>=_0x2b38d4){_0x4606e2=_0x2b38d4;_0x2a2e7e=0xc8;}else{_0x2a2e7e=0xce;}_0x3d1b67['status'](_0x2a2e7e);return _0x3d1b67['set'](_0xae06('0x1e'),_0x5753bd+'-'+_0x4606e2+'/'+_0x2b38d4)['json'](_0x255040);}return null;};}function patchUpdates(_0x5243b6){return function(_0x3b395d){try{jsonpatch['apply'](_0x3b395d,_0x5243b6,!![]);}catch(_0x211875){return BPromise[_0xae06('0x1f')](_0x211875);}return _0x3b395d[_0xae06('0x20')]();};}function saveUpdates(_0x3a8e00,_0x3be980){return function(_0x23ed4a){if(_0x23ed4a){return _0x23ed4a[_0xae06('0x21')](_0x3a8e00)[_0xae06('0x22')](function(_0x3e59a7){return _0x3e59a7;});}return null;};}function removeEntity(_0x2ebc30,_0x2a727d){return function(_0x10a7b3){if(_0x10a7b3){return _0x10a7b3[_0xae06('0x23')]()[_0xae06('0x22')](function(){_0x2ebc30[_0xae06('0x18')](0xcc)[_0xae06('0x24')]();});}};}function handleEntityNotFound(_0x1fcdca,_0x5603aa){return function(_0x4c4cdd){if(!_0x4c4cdd){_0x1fcdca[_0xae06('0x17')](0x194);}return _0x4c4cdd;};}function handleError(_0x5c307,_0x11503c){_0x11503c=_0x11503c||0x1f4;return function(_0x29df6f){logger[_0xae06('0x25')](_0x29df6f[_0xae06('0x26')]);if(_0x29df6f[_0xae06('0x27')]){delete _0x29df6f[_0xae06('0x27')];}_0x5c307[_0xae06('0x18')](_0x11503c)['send'](_0x29df6f);};}exports[_0xae06('0x28')]=function(_0x2214b2,_0x421d7a){var _0x5eb198={},_0x37a154={},_0x55fec1={'count':0x0,'rows':[]};var _0x1bb206=_['map'](db['CmHopperHistory'][_0xae06('0x29')],function(_0x55c196){return{'name':_0x55c196[_0xae06('0x2a')],'type':_0x55c196[_0xae06('0x2b')][_0xae06('0x2c')]};});_0x37a154[_0xae06('0x2d')]=_['map'](_0x1bb206,_0xae06('0x27'));_0x37a154[_0xae06('0x2e')]=_[_0xae06('0x2f')](_0x2214b2[_0xae06('0x2e')]);_0x37a154[_0xae06('0x30')]=_['intersection'](_0x37a154['model'],_0x37a154[_0xae06('0x2e')]);_0x5eb198['attributes']=_['intersection'](_0x37a154[_0xae06('0x2d')],qs[_0xae06('0x31')](_0x2214b2[_0xae06('0x2e')]['fields']));_0x5eb198[_0xae06('0x32')]=_0x5eb198[_0xae06('0x32')]['length']?_0x5eb198[_0xae06('0x32')]:_0x37a154[_0xae06('0x2d')];if(!_0x2214b2['query'][_0xae06('0x33')](_0xae06('0x34'))){_0x5eb198[_0xae06('0x1d')]=qs[_0xae06('0x1d')](_0x2214b2[_0xae06('0x2e')]['limit']);_0x5eb198['offset']=qs['offset'](_0x2214b2['query'][_0xae06('0x1a')]);}_0x5eb198[_0xae06('0x35')]=qs[_0xae06('0x36')](_0x2214b2[_0xae06('0x2e')][_0xae06('0x36')]);_0x5eb198['where']=qs['filters'](_[_0xae06('0x37')](_0x2214b2['query'],_0x37a154[_0xae06('0x30')]),_0x1bb206);if(_0x2214b2[_0xae06('0x2e')][_0xae06('0x38')]){_0x5eb198[_0xae06('0x39')]=_['merge'](_0x5eb198[_0xae06('0x39')],{'$or':_[_0xae06('0x3a')](_0x1bb206,function(_0x3574c3){if(_0x3574c3['type']!==_0xae06('0x3b')){var _0x16180f={};_0x16180f[_0x3574c3[_0xae06('0x27')]]={'$like':'%'+_0x2214b2[_0xae06('0x2e')][_0xae06('0x38')]+'%'};return _0x16180f;}})});}_0x5eb198=_[_0xae06('0x3c')]({},_0x5eb198,_0x2214b2[_0xae06('0x3d')]);var _0xd3771b={'where':_0x5eb198[_0xae06('0x39')]};return db[_0xae06('0x3e')][_0xae06('0x1c')](_0xd3771b)['then'](function(_0x4f8d9e){_0x55fec1['count']=_0x4f8d9e;if(_0x2214b2[_0xae06('0x2e')][_0xae06('0x3f')]){_0x5eb198[_0xae06('0x40')]=[{'all':!![]}];}return db[_0xae06('0x3e')]['findAll'](_0x5eb198);})[_0xae06('0x22')](function(_0x166613){_0x55fec1[_0xae06('0x41')]=_0x166613;return _0x55fec1;})['then'](respondWithFilteredResult(_0x421d7a,_0x5eb198))[_0xae06('0x42')](handleError(_0x421d7a,null));};exports[_0xae06('0x43')]=function(_0xffe523,_0x37fce5){var _0x180ea2={'raw':!![],'where':{'id':_0xffe523['params']['id']}},_0x14d250={};_0x14d250[_0xae06('0x2d')]=_[_0xae06('0x2f')](db['CmHopperHistory'][_0xae06('0x29')]);_0x14d250[_0xae06('0x2e')]=_[_0xae06('0x2f')](_0xffe523[_0xae06('0x2e')]);_0x14d250[_0xae06('0x30')]=_[_0xae06('0x44')](_0x14d250[_0xae06('0x2d')],_0x14d250[_0xae06('0x2e')]);_0x180ea2[_0xae06('0x32')]=_[_0xae06('0x44')](_0x14d250[_0xae06('0x2d')],qs[_0xae06('0x31')](_0xffe523[_0xae06('0x2e')]['fields']));_0x180ea2[_0xae06('0x32')]=_0x180ea2['attributes'][_0xae06('0x45')]?_0x180ea2[_0xae06('0x32')]:_0x14d250[_0xae06('0x2d')];if(_0xffe523['query'][_0xae06('0x3f')]){_0x180ea2[_0xae06('0x40')]=[{'all':!![]}];}_0x180ea2=_[_0xae06('0x3c')]({},_0x180ea2,_0xffe523[_0xae06('0x3d')]);return db[_0xae06('0x3e')]['find'](_0x180ea2)['then'](handleEntityNotFound(_0x37fce5,null))[_0xae06('0x22')](respondWithResult(_0x37fce5,null))[_0xae06('0x42')](handleError(_0x37fce5,null));};exports['create']=function(_0xff4fdd,_0x2a8fc1){return db['CmHopperHistory'][_0xae06('0x46')](_0xff4fdd['body'],{})[_0xae06('0x22')](respondWithResult(_0x2a8fc1,0xc9))[_0xae06('0x42')](handleError(_0x2a8fc1,null));};exports[_0xae06('0x47')]=function(_0x3fe229,_0x11ff81){return db[_0xae06('0x3e')]['describe']()[_0xae06('0x22')](respondWithResult(_0x11ff81,null))[_0xae06('0x42')](handleError(_0x11ff81,null));};exports[_0xae06('0x21')]=function(_0xa4b1a8,_0x19a4fe){if(_0xa4b1a8[_0xae06('0x48')][_0xae06('0x49')]){delete _0xa4b1a8[_0xae06('0x48')]['uniqueid'];}return db[_0xae06('0x3e')][_0xae06('0x4a')]({'where':{'uniqueid':_0xa4b1a8[_0xae06('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19a4fe,null))[_0xae06('0x22')](saveUpdates(_0xa4b1a8[_0xae06('0x48')],null))['then'](respondWithResult(_0x19a4fe,null))['catch'](handleError(_0x19a4fe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a1afaa1..b33f09b 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 _0x1574=['../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3f758f,_0x302451){var _0x26e4ae=function(_0x54beae){while(--_0x54beae){_0x3f758f['push'](_0x3f758f['shift']());}};_0x26e4ae(++_0x302451);}(_0x1574,0x148));var _0x4157=function(_0x11a02d,_0x1b6368){_0x11a02d=_0x11a02d-0x0;var _0x316f3e=_0x1574[_0x11a02d];return _0x316f3e;};'use strict';var _=require(_0x4157('0x0'));var util=require(_0x4157('0x1'));var logger=require(_0x4157('0x2'))(_0x4157('0x3'));var moment=require('moment');var BPromise=require(_0x4157('0x4'));var rp=require(_0x4157('0x5'));var fs=require('fs');var path=require(_0x4157('0x6'));var rimraf=require(_0x4157('0x7'));var config=require(_0x4157('0x8'));var attributes=require(_0x4157('0x9'));module[_0x4157('0xa')]=function(_0x43c6dc,_0xbd0cf7){return _0x43c6dc[_0x4157('0xb')](_0x4157('0xc'),attributes,{'tableName':_0x4157('0xd'),'paranoid':![],'indexes':[{'name':_0x4157('0xe'),'fields':[_0x4157('0xe')]},{'name':_0x4157('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2e=['./cmHopperHistory.attributes','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x414fdc,_0x5e35a2){var _0x264c7a=function(_0x342503){while(--_0x342503){_0x414fdc['push'](_0x414fdc['shift']());}};_0x264c7a(++_0x5e35a2);}(_0x3f2e,0x9d));var _0xe3f2=function(_0xfdd6b6,_0x19497a){_0xfdd6b6=_0xfdd6b6-0x0;var _0x464439=_0x3f2e[_0xfdd6b6];return _0x464439;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var logger=require(_0xe3f2('0x1'))(_0xe3f2('0x2'));var moment=require(_0xe3f2('0x3'));var BPromise=require(_0xe3f2('0x4'));var rp=require(_0xe3f2('0x5'));var fs=require('fs');var path=require(_0xe3f2('0x6'));var rimraf=require(_0xe3f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xe3f2('0x8'));module['exports']=function(_0x7cdd2e,_0x2d6460){return _0x7cdd2e['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xe3f2('0x9'),'fields':[_0xe3f2('0x9')]},{'name':_0xe3f2('0xa'),'fields':[_0xe3f2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e5e3aa0..c18a19a 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 _0x976a=['name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`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','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CmHopperHistory','create','options','raw','debug','CreateCmHopperHistory','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory'];(function(_0x3b5b1b,_0x2645af){var _0x3563a5=function(_0x252192){while(--_0x252192){_0x3b5b1b['push'](_0x3b5b1b['shift']());}};_0x3563a5(++_0x2645af);}(_0x976a,0xf4));var _0xa976=function(_0x5ce2e3,_0x3dc503){_0x5ce2e3=_0x5ce2e3-0x0;var _0x3b53ab=_0x976a[_0x5ce2e3];return _0x3b53ab;};'use strict';var _=require(_0xa976('0x0'));var util=require(_0xa976('0x1'));var moment=require(_0xa976('0x2'));var BPromise=require('bluebird');var rs=require(_0xa976('0x3'));var fs=require('fs');var Redis=require(_0xa976('0x4'));var db=require(_0xa976('0x5'))['db'];var utils=require(_0xa976('0x6'));var logger=require(_0xa976('0x7'))(_0xa976('0x8'));var config=require(_0xa976('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5caa7a,_0x3a4a2,_0x12a073){return new BPromise(function(_0x1a9983,_0xc3661d){return client[_0xa976('0xa')](_0x5caa7a,_0x12a073)[_0xa976('0xb')](function(_0x197ebf){logger[_0xa976('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x3a4a2,'request\x20sent');logger['debug'](_0xa976('0xd'),_0x3a4a2,_0xa976('0xe'),JSON[_0xa976('0xf')](_0x197ebf));if(_0x197ebf[_0xa976('0x10')]){if(_0x197ebf['error'][_0xa976('0x11')]===0x1f4){logger[_0xa976('0x10')](_0xa976('0x12'),_0x3a4a2,_0x197ebf[_0xa976('0x10')][_0xa976('0x13')]);return _0xc3661d(_0x197ebf[_0xa976('0x10')]['message']);}logger[_0xa976('0x10')](_0xa976('0x12'),_0x3a4a2,_0x197ebf[_0xa976('0x10')][_0xa976('0x13')]);return _0x1a9983(_0x197ebf[_0xa976('0x10')][_0xa976('0x13')]);}else{logger[_0xa976('0xc')](_0xa976('0x12'),_0x3a4a2,_0xa976('0xe'));_0x1a9983(_0x197ebf[_0xa976('0x14')][_0xa976('0x13')]);}})['catch'](function(_0xf5f9b){logger[_0xa976('0x10')](_0xa976('0x12'),_0x3a4a2,_0xf5f9b);_0xc3661d(_0xf5f9b);});});}exports['CreateCmHopperHistory']=function(_0x4848d8){var _0x3f2cd5=this;return new Promise(function(_0x36b47a,_0x3ca2dd){return db[_0xa976('0x15')][_0xa976('0x16')](_0x4848d8['body'],{'raw':_0x4848d8[_0xa976('0x17')]?_0x4848d8[_0xa976('0x17')][_0xa976('0x18')]===undefined?!![]:![]:!![]})[_0xa976('0xb')](function(_0x44f7d4){logger['info']('CreateCmHopperHistory',_0x4848d8);logger[_0xa976('0x19')](_0xa976('0x1a'),_0x4848d8,JSON['stringify'](_0x44f7d4));_0x36b47a(_0x44f7d4);})[_0xa976('0x1b')](function(_0x4f60ff){logger['error'](_0xa976('0x1a'),_0x4f60ff[_0xa976('0x13')],_0x4848d8);_0x3ca2dd(_0x3f2cd5[_0xa976('0x10')](0x1f4,_0x4f60ff[_0xa976('0x13')]));});});};exports[_0xa976('0x1c')]=function(_0xe572fe){var _0x31231f=this;return new Promise(function(_0x54b5ba,_0x5a2f6f){return db['CmHopperHistory'][_0xa976('0x1d')]({'raw':_0xe572fe[_0xa976('0x17')]?_0xe572fe[_0xa976('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xe572fe['options']?_0xe572fe[_0xa976('0x17')][_0xa976('0x1e')]||null:null,'attributes':[[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')][_0xa976('0x21')]('id')),_0xa976('0x22')],[db[_0xa976('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xa976('0x1f')]['fn']('COUNT',db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x25')))),_0xa976('0x26')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x27'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x28')))),_0xa976('0x29')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x27'),db[_0xa976('0x1f')]['fn']('IF',db['sequelize'][_0xa976('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xa976('0x2a')]]})[_0xa976('0xb')](function(_0x1f8e7e){logger[_0xa976('0xc')](_0xa976('0x1c'),_0xe572fe);logger[_0xa976('0x19')](_0xa976('0x1c'),_0xe572fe,JSON[_0xa976('0xf')](_0x1f8e7e));_0x54b5ba(_0x1f8e7e);})[_0xa976('0x1b')](function(_0x3e9baa){logger[_0xa976('0x10')](_0xa976('0x1c'),_0x3e9baa[_0xa976('0x13')],_0xe572fe);_0x5a2f6f(_0x31231f['error'](0x1f4,_0x3e9baa[_0xa976('0x13')]));});});};exports[_0xa976('0x2b')]=function(_0x16c6b4){var _0x545320=this;return new Promise(function(_0x1c6728,_0x37eeb7){return db[_0xa976('0x15')][_0xa976('0x1d')]({'raw':_0x16c6b4[_0xa976('0x17')]?_0x16c6b4['options'][_0xa976('0x18')]===undefined?!![]:![]:!![],'where':_0x16c6b4['options']?_0x16c6b4[_0xa976('0x17')][_0xa976('0x1e')]||null:null,'attributes':[['campaign',_0xa976('0x2c')],[db[_0xa976('0x1f')]['fn']('COUNT',db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')]['literal'](_0xa976('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa976('0x23')](_0xa976('0x2e')))),_0xa976('0x2f')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x30')))),_0xa976('0x31')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x32')))),_0xa976('0x33')],[db[_0xa976('0x1f')]['fn']('COUNT',db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x34')))),_0xa976('0x35')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa976('0x36')))),_0xa976('0x37')],[db['sequelize']['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x38')))),_0xa976('0x39')],[db[_0xa976('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x3a')))),'outboundUnknownCallsDay'],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')]['literal'](_0xa976('0x3b')))),_0xa976('0x3c')],[db['sequelize']['fn'](_0xa976('0x20'),db['sequelize']['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x3d')))),_0xa976('0x3e')],[db['sequelize']['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa976('0x3f')],[db['sequelize']['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x40')))),_0xa976('0x41')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')](_0xa976('0x42')))),_0xa976('0x3f')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')][_0xa976('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xa976('0x43')]],'group':[_0xa976('0x44')]})[_0xa976('0xb')](function(_0x9b72a){logger['info']('GetVoiceQueueHopperHistory',_0x16c6b4);logger['debug']('GetVoiceQueueHopperHistory',_0x16c6b4,JSON[_0xa976('0xf')](_0x9b72a));_0x1c6728(_0x9b72a);})[_0xa976('0x1b')](function(_0x1fdf63){logger['error'](_0xa976('0x2b'),_0x1fdf63['message'],_0x16c6b4);_0x37eeb7(_0x545320[_0xa976('0x10')](0x1f4,_0x1fdf63[_0xa976('0x13')]));});});};exports[_0xa976('0x45')]=function(_0x3e6893){var _0x50b875=this;return new Promise(function(_0x89b850,_0x830789){return db[_0xa976('0x15')][_0xa976('0x1d')]({'raw':_0x3e6893[_0xa976('0x17')]?_0x3e6893[_0xa976('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6893[_0xa976('0x17')]?_0x3e6893[_0xa976('0x17')][_0xa976('0x1e')]||null:null,'attributes':[['campaign',_0xa976('0x2c')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')][_0xa976('0x21')]('id')),_0xa976('0x46')],[db[_0xa976('0x1f')]['fn'](_0xa976('0x20'),db[_0xa976('0x1f')]['fn']('IF',db[_0xa976('0x1f')]['literal'](_0xa976('0x30')))),_0xa976('0x47')]],'group':['campaign']})[_0xa976('0xb')](function(_0x4f7178){logger['info']('GetCampaignHopperHistory',_0x3e6893);logger[_0xa976('0x19')]('GetCampaignHopperHistory',_0x3e6893,JSON[_0xa976('0xf')](_0x4f7178));_0x89b850(_0x4f7178);})[_0xa976('0x1b')](function(_0x40da22){logger['error'](_0xa976('0x45'),_0x40da22['message'],_0x3e6893);_0x830789(_0x50b875[_0xa976('0x10')](0x1f4,_0x40da22[_0xa976('0x13')]));});});}; \ No newline at end of file +var _0xbdb8=['`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','stringify','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x2d687f,_0x900630){var _0x244166=function(_0x1344f1){while(--_0x1344f1){_0x2d687f['push'](_0x2d687f['shift']());}};_0x244166(++_0x900630);}(_0xbdb8,0xe2));var _0x8bdb=function(_0x25a86b,_0x269489){_0x25a86b=_0x25a86b-0x0;var _0x584cac=_0xbdb8[_0x25a86b];return _0x584cac;};'use strict';var _=require(_0x8bdb('0x0'));var util=require(_0x8bdb('0x1'));var moment=require('moment');var BPromise=require(_0x8bdb('0x2'));var rs=require(_0x8bdb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bdb('0x4'))['db'];var utils=require(_0x8bdb('0x5'));var logger=require(_0x8bdb('0x6'))('rpc');var config=require(_0x8bdb('0x7'));var jayson=require(_0x8bdb('0x8'));var client=jayson['client'][_0x8bdb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50cb04,_0x2a5d64,_0x5a758b){return new BPromise(function(_0x4d6748,_0x1e41e8){return client[_0x8bdb('0xa')](_0x50cb04,_0x5a758b)[_0x8bdb('0xb')](function(_0x5a65ba){logger[_0x8bdb('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x2a5d64,'request\x20sent');logger[_0x8bdb('0xd')](_0x8bdb('0xe'),_0x2a5d64,_0x8bdb('0xf'),JSON['stringify'](_0x5a65ba));if(_0x5a65ba['error']){if(_0x5a65ba[_0x8bdb('0x10')]['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2a5d64,_0x5a65ba[_0x8bdb('0x10')][_0x8bdb('0x11')]);return _0x1e41e8(_0x5a65ba[_0x8bdb('0x10')]['message']);}logger[_0x8bdb('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x2a5d64,_0x5a65ba[_0x8bdb('0x10')][_0x8bdb('0x11')]);return _0x4d6748(_0x5a65ba['error'][_0x8bdb('0x11')]);}else{logger['info'](_0x8bdb('0x12'),_0x2a5d64,_0x8bdb('0xf'));_0x4d6748(_0x5a65ba[_0x8bdb('0x13')][_0x8bdb('0x11')]);}})[_0x8bdb('0x14')](function(_0x478287){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2a5d64,_0x478287);_0x1e41e8(_0x478287);});});}exports[_0x8bdb('0x15')]=function(_0x2d417a){var _0x11b769=this;return new Promise(function(_0x470d17,_0x3341a5){return db[_0x8bdb('0x16')][_0x8bdb('0x17')](_0x2d417a['body'],{'raw':_0x2d417a[_0x8bdb('0x18')]?_0x2d417a[_0x8bdb('0x18')][_0x8bdb('0x19')]===undefined?!![]:![]:!![]})[_0x8bdb('0xb')](function(_0xfc2878){logger[_0x8bdb('0xc')](_0x8bdb('0x15'),_0x2d417a);logger[_0x8bdb('0xd')]('CreateCmHopperHistory',_0x2d417a,JSON[_0x8bdb('0x1a')](_0xfc2878));_0x470d17(_0xfc2878);})['catch'](function(_0x4f8437){logger[_0x8bdb('0x10')]('CreateCmHopperHistory',_0x4f8437[_0x8bdb('0x11')],_0x2d417a);_0x3341a5(_0x11b769[_0x8bdb('0x10')](0x1f4,_0x4f8437[_0x8bdb('0x11')]));});});};exports[_0x8bdb('0x1b')]=function(_0x225d3f){var _0x2013f3=this;return new Promise(function(_0x88986d,_0x309e3a){return db['CmHopperHistory']['findAll']({'raw':_0x225d3f[_0x8bdb('0x18')]?_0x225d3f['options'][_0x8bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x225d3f[_0x8bdb('0x18')]?_0x225d3f[_0x8bdb('0x18')][_0x8bdb('0x1c')]||null:null,'attributes':[[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')][_0x8bdb('0x1f')]('id')),_0x8bdb('0x20')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x22')))),_0x8bdb('0x23')],[db['sequelize']['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x8bdb('0x24')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db['sequelize'][_0x8bdb('0x21')](_0x8bdb('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x26'),db['sequelize']['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x27')))),_0x8bdb('0x28')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x26'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x8bdb('0x29')]]})['then'](function(_0x4a973d){logger[_0x8bdb('0xc')](_0x8bdb('0x1b'),_0x225d3f);logger['debug'](_0x8bdb('0x1b'),_0x225d3f,JSON[_0x8bdb('0x1a')](_0x4a973d));_0x88986d(_0x4a973d);})[_0x8bdb('0x14')](function(_0x1a1173){logger['error']('AvgHandleTime',_0x1a1173['message'],_0x225d3f);_0x309e3a(_0x2013f3['error'](0x1f4,_0x1a1173[_0x8bdb('0x11')]));});});};exports[_0x8bdb('0x2a')]=function(_0x1be7ad){var _0x5c6b43=this;return new Promise(function(_0xe0726c,_0x3921a4){return db[_0x8bdb('0x16')][_0x8bdb('0x2b')]({'raw':_0x1be7ad['options']?_0x1be7ad['options'][_0x8bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x1be7ad[_0x8bdb('0x18')]?_0x1be7ad[_0x8bdb('0x18')][_0x8bdb('0x1c')]||null:null,'attributes':[['campaign',_0x8bdb('0x2c')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x8bdb('0x1d')]['fn']('COUNT',db[_0x8bdb('0x1d')]['fn']('IF',db['sequelize'][_0x8bdb('0x21')](_0x8bdb('0x2d')))),_0x8bdb('0x2e')],[db[_0x8bdb('0x1d')]['fn']('COUNT',db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x22')))),'outboundAnswerCallsDay'],[db[_0x8bdb('0x1d')]['fn']('COUNT',db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')]['literal'](_0x8bdb('0x2f')))),_0x8bdb('0x30')],[db['sequelize']['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x31')))),'outboundCongestionCallsDay'],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x32')))),_0x8bdb('0x33')],[db[_0x8bdb('0x1d')]['fn']('COUNT',db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x34')))),_0x8bdb('0x35')],[db['sequelize']['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x36')))),_0x8bdb('0x37')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db['sequelize'][_0x8bdb('0x21')](_0x8bdb('0x38')))),_0x8bdb('0x39')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x8bdb('0x3a')],[db['sequelize']['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db['sequelize'][_0x8bdb('0x21')](_0x8bdb('0x3b')))),_0x8bdb('0x3c')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')]['literal'](_0x8bdb('0x3d')))),_0x8bdb('0x3e')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')]['fn']('IF',db[_0x8bdb('0x1d')][_0x8bdb('0x21')](_0x8bdb('0x3f')))),_0x8bdb('0x3c')],[db['sequelize']['fn'](_0x8bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x8bdb('0x1d')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x8bdb('0x40')]],'group':[_0x8bdb('0x41')]})['then'](function(_0x32d81e){logger[_0x8bdb('0xc')](_0x8bdb('0x2a'),_0x1be7ad);logger[_0x8bdb('0xd')](_0x8bdb('0x2a'),_0x1be7ad,JSON['stringify'](_0x32d81e));_0xe0726c(_0x32d81e);})[_0x8bdb('0x14')](function(_0x7d7300){logger[_0x8bdb('0x10')]('GetVoiceQueueHopperHistory',_0x7d7300[_0x8bdb('0x11')],_0x1be7ad);_0x3921a4(_0x5c6b43[_0x8bdb('0x10')](0x1f4,_0x7d7300['message']));});});};exports[_0x8bdb('0x42')]=function(_0x3185fc){var _0x5ee2b2=this;return new Promise(function(_0x50a55b,_0x607743){return db[_0x8bdb('0x16')][_0x8bdb('0x2b')]({'raw':_0x3185fc[_0x8bdb('0x18')]?_0x3185fc[_0x8bdb('0x18')][_0x8bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x3185fc[_0x8bdb('0x18')]?_0x3185fc[_0x8bdb('0x18')][_0x8bdb('0x1c')]||null:null,'attributes':[['campaign',_0x8bdb('0x2c')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db[_0x8bdb('0x1d')][_0x8bdb('0x1f')]('id')),_0x8bdb('0x43')],[db[_0x8bdb('0x1d')]['fn'](_0x8bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x8bdb('0x22')))),_0x8bdb('0x44')]],'group':[_0x8bdb('0x41')]})[_0x8bdb('0xb')](function(_0x18060b){logger[_0x8bdb('0xc')]('GetCampaignHopperHistory',_0x3185fc);logger[_0x8bdb('0xd')](_0x8bdb('0x42'),_0x3185fc,JSON[_0x8bdb('0x1a')](_0x18060b));_0x50a55b(_0x18060b);})['catch'](function(_0x374d56){logger[_0x8bdb('0x10')]('GetCampaignHopperHistory',_0x374d56[_0x8bdb('0x11')],_0x3185fc);_0x607743(_0x5ee2b2[_0x8bdb('0x10')](0x1f4,_0x374d56[_0x8bdb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4cdb56d..35c599d 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 _0x6490=['/:id','update','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','create','put'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x6490,0x135));var _0x0649=function(_0x3220bb,_0x342a03){_0x3220bb=_0x3220bb-0x0;var _0x23415c=_0x6490[_0x3220bb];return _0x23415c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0649('0x0'));var express=require(_0x0649('0x1'));var router=express['Router']();var fs_extra=require(_0x0649('0x2'));var auth=require(_0x0649('0x3'));var interaction=require(_0x0649('0x4'));var config=require(_0x0649('0x5'));var controller=require(_0x0649('0x6'));router[_0x0649('0x7')]('/',auth[_0x0649('0x8')](),controller[_0x0649('0x9')]);router['get'](_0x0649('0xa'),auth['isAuthenticated'](),controller[_0x0649('0xb')]);router[_0x0649('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0649('0x8')](),controller[_0x0649('0xc')]);router[_0x0649('0xd')](_0x0649('0xe'),auth['isAuthenticated'](),controller[_0x0649('0xf')]);module[_0x0649('0x10')]=router; \ No newline at end of file +var _0xe3cf=['isAuthenticated','index','/describe','describe','get','/:id','post','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x3fba41,_0x39825c){var _0x12e6a2=function(_0x5dda68){while(--_0x5dda68){_0x3fba41['push'](_0x3fba41['shift']());}};_0x12e6a2(++_0x39825c);}(_0xe3cf,0x170));var _0xfe3c=function(_0x591a96,_0x3d4763){_0x591a96=_0x591a96-0x0;var _0x32d257=_0xe3cf[_0x591a96];return _0x32d257;};'use strict';var multer=require(_0xfe3c('0x0'));var util=require(_0xfe3c('0x1'));var path=require(_0xfe3c('0x2'));var timeout=require(_0xfe3c('0x3'));var express=require(_0xfe3c('0x4'));var router=express[_0xfe3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfe3c('0x6'));var interaction=require(_0xfe3c('0x7'));var config=require(_0xfe3c('0x8'));var controller=require(_0xfe3c('0x9'));router['get']('/',auth[_0xfe3c('0xa')](),controller[_0xfe3c('0xb')]);router['get'](_0xfe3c('0xc'),auth[_0xfe3c('0xa')](),controller[_0xfe3c('0xd')]);router[_0xfe3c('0xe')](_0xfe3c('0xf'),auth[_0xfe3c('0xa')](),controller['show']);router[_0xfe3c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xfe3c('0xa')](),controller['update']);module[_0xfe3c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 84efed9..45b6c89 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 _0x6c7b=['STRING','sequelize'];(function(_0x48f0f4,_0x52bdb8){var _0x549f8c=function(_0x9b3dbf){while(--_0x9b3dbf){_0x48f0f4['push'](_0x48f0f4['shift']());}};_0x549f8c(++_0x52bdb8);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x144725,_0x2ad835){_0x144725=_0x144725-0x0;var _0x516c96=_0x6c7b[_0x144725];return _0x516c96;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6688=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6688,0x10e));var _0x8668=function(_0xd174c5,_0x177065){_0xd174c5=_0xd174c5-0x0;var _0x4c0895=_0x6688[_0xd174c5];return _0x4c0895;};'use strict';var Sequelize=require(_0x8668('0x0'));module[_0x8668('0x1')]={'name':{'type':Sequelize[_0x8668('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8668('0x2')]},'dialPrefix':{'type':Sequelize[_0x8668('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6bdd06e..e2a17fd 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 _0x1420=['catch','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','getDispositions','hasOwnProperty','pick','rows','removeDispositions','ids','addContacts','CmContact','tags','join','ListId','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','OrderBy','findAll','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','customField_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','isArray','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','name','map','CmList','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include'];(function(_0x40da6f,_0x4953b4){var _0x24246a=function(_0x13c4fc){while(--_0x13c4fc){_0x40da6f['push'](_0x40da6f['shift']());}};_0x24246a(++_0x4953b4);}(_0x1420,0xff));var _0x0142=function(_0x3d5138,_0x1114e0){_0x3d5138=_0x3d5138-0x0;var _0xd9b29b=_0x1420[_0x3d5138];return _0xd9b29b;};'use strict';var emlformat=require(_0x0142('0x0'));var rimraf=require(_0x0142('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0142('0x2'));var rp=require(_0x0142('0x3'));var moment=require(_0x0142('0x4'));var BPromise=require(_0x0142('0x5'));var Mustache=require(_0x0142('0x6'));var util=require(_0x0142('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0142('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0142('0x9'));var _=require(_0x0142('0xa'));var squel=require(_0x0142('0xb'));var crypto=require(_0x0142('0xc'));var jsforce=require(_0x0142('0xd'));var deskjs=require(_0x0142('0xe'));var toCsv=require(_0x0142('0x8'));var querystring=require(_0x0142('0xf'));var Papa=require('papaparse');var Redis=require(_0x0142('0x10'));var authService=require(_0x0142('0x11'));var qs=require(_0x0142('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0142('0x13'));var logger=require('../../config/logger')(_0x0142('0x14'));var utils=require(_0x0142('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0142('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x0142('0x17')]=_[_0x0142('0x18')](config[_0x0142('0x17')],{'host':_0x0142('0x19'),'port':0x18eb});var socket=require(_0x0142('0x1a'))(new Redis(config['redis']));require(_0x0142('0x1b'))['register'](socket);function respondWithStatusCode(_0x515262,_0x53addf){_0x53addf=_0x53addf||0xcc;return function(_0x33af9a){if(_0x33af9a){return _0x515262[_0x0142('0x1c')](_0x53addf);}return _0x515262['status'](_0x53addf)[_0x0142('0x1d')]();};}function respondWithResult(_0x420b35,_0x1df8b0){_0x1df8b0=_0x1df8b0||0xc8;return function(_0x563b4d){if(_0x563b4d){return _0x420b35['status'](_0x1df8b0)[_0x0142('0x1e')](_0x563b4d);}};}function respondWithFilteredResult(_0xd6d013,_0x3bf70b){return function(_0x572f0d){if(_0x572f0d){var _0x53345a=typeof _0x3bf70b['offset']===_0x0142('0x1f')&&typeof _0x3bf70b['limit']===_0x0142('0x1f');var _0x304b5a=_0x572f0d[_0x0142('0x20')];var _0x184ae8=_0x53345a?0x0:_0x3bf70b[_0x0142('0x21')];var _0x2a67c5=_0x53345a?_0x572f0d[_0x0142('0x20')]:_0x3bf70b[_0x0142('0x21')]+_0x3bf70b[_0x0142('0x22')];var _0x39054a;if(_0x2a67c5>=_0x304b5a){_0x2a67c5=_0x304b5a;_0x39054a=0xc8;}else{_0x39054a=0xce;}_0xd6d013[_0x0142('0x23')](_0x39054a);return _0xd6d013[_0x0142('0x24')](_0x0142('0x25'),_0x184ae8+'-'+_0x2a67c5+'/'+_0x304b5a)[_0x0142('0x1e')](_0x572f0d);}return null;};}function patchUpdates(_0x3aa5a9){return function(_0x1a52e4){try{jsonpatch[_0x0142('0x26')](_0x1a52e4,_0x3aa5a9,!![]);}catch(_0x3e23dc){return BPromise[_0x0142('0x27')](_0x3e23dc);}return _0x1a52e4[_0x0142('0x28')]();};}function saveUpdates(_0x46ea90,_0x119152){return function(_0x39f4ac){if(_0x39f4ac){return _0x39f4ac['update'](_0x46ea90)[_0x0142('0x29')](function(_0x42ac10){return _0x42ac10;});}return null;};}function removeEntity(_0x49b9c6,_0xbeabb6){return function(_0x2dfa51){if(_0x2dfa51){return _0x2dfa51[_0x0142('0x2a')]()[_0x0142('0x29')](function(){var _0x1ee25a=_0x2dfa51[_0x0142('0x2b')]({'plain':!![]});var _0xb8efc8='Lists';return db[_0x0142('0x2c')][_0x0142('0x2a')]({'where':{'type':_0xb8efc8,'resourceId':_0x1ee25a['id']}})[_0x0142('0x29')](function(){return _0x2dfa51;});})[_0x0142('0x29')](function(){_0x49b9c6[_0x0142('0x23')](0xcc)[_0x0142('0x1d')]();});}};}function handleEntityNotFound(_0x3fa69f,_0x16379e){return function(_0x31de55){if(!_0x31de55){_0x3fa69f[_0x0142('0x1c')](0x194);}return _0x31de55;};}function handleError(_0x306852,_0x5b4086){_0x5b4086=_0x5b4086||0x1f4;return function(_0x5bd2f7){logger['error'](_0x5bd2f7['stack']);if(_0x5bd2f7['name']){delete _0x5bd2f7[_0x0142('0x2d')];}_0x306852[_0x0142('0x23')](_0x5b4086)['send'](_0x5bd2f7);};}exports['index']=function(_0x48b3aa,_0x52a870){var _0x254d47={},_0x2ec397={},_0xe3c13d={'count':0x0,'rows':[]};var _0x4af43f=_[_0x0142('0x2e')](db[_0x0142('0x2f')][_0x0142('0x30')],function(_0x62a871){return{'name':_0x62a871[_0x0142('0x31')],'type':_0x62a871['type']['key']};});_0x2ec397[_0x0142('0x32')]=_[_0x0142('0x2e')](_0x4af43f,_0x0142('0x2d'));_0x2ec397[_0x0142('0x33')]=_[_0x0142('0x34')](_0x48b3aa['query']);_0x2ec397[_0x0142('0x35')]=_[_0x0142('0x36')](_0x2ec397[_0x0142('0x32')],_0x2ec397[_0x0142('0x33')]);_0x254d47[_0x0142('0x37')]=_[_0x0142('0x36')](_0x2ec397[_0x0142('0x32')],qs[_0x0142('0x38')](_0x48b3aa[_0x0142('0x33')][_0x0142('0x38')]));_0x254d47['attributes']=_0x254d47['attributes'][_0x0142('0x39')]?_0x254d47[_0x0142('0x37')]:_0x2ec397[_0x0142('0x32')];if(!_0x48b3aa[_0x0142('0x33')]['hasOwnProperty'](_0x0142('0x3a'))){_0x254d47[_0x0142('0x22')]=qs[_0x0142('0x22')](_0x48b3aa[_0x0142('0x33')][_0x0142('0x22')]);_0x254d47['offset']=qs[_0x0142('0x21')](_0x48b3aa[_0x0142('0x33')]['offset']);}_0x254d47[_0x0142('0x3b')]=qs[_0x0142('0x3c')](_0x48b3aa[_0x0142('0x33')]['sort']);_0x254d47[_0x0142('0x3d')]=qs[_0x0142('0x35')](_['pick'](_0x48b3aa[_0x0142('0x33')],_0x2ec397[_0x0142('0x35')]),_0x4af43f);if(_0x48b3aa[_0x0142('0x33')][_0x0142('0x3e')]){_0x254d47[_0x0142('0x3d')]=_[_0x0142('0x3f')](_0x254d47[_0x0142('0x3d')],{'$or':_[_0x0142('0x2e')](_0x4af43f,function(_0x47b486){if(_0x47b486[_0x0142('0x40')]!==_0x0142('0x41')){var _0x13773c={};_0x13773c[_0x47b486[_0x0142('0x2d')]]={'$like':'%'+_0x48b3aa[_0x0142('0x33')][_0x0142('0x3e')]+'%'};return _0x13773c;}})});}_0x254d47=_[_0x0142('0x3f')]({},_0x254d47,_0x48b3aa['options']);var _0x5d09b1={'where':_0x254d47[_0x0142('0x3d')]};return db[_0x0142('0x2f')][_0x0142('0x20')](_0x5d09b1)['then'](function(_0x4c83ed){_0xe3c13d[_0x0142('0x20')]=_0x4c83ed;if(_0x48b3aa[_0x0142('0x33')]['includeAll']){_0x254d47[_0x0142('0x42')]=[{'all':!![]}];}return db[_0x0142('0x2f')]['findAll'](_0x254d47);})['then'](function(_0x4c9600){_0xe3c13d['rows']=_0x4c9600;return _0xe3c13d;})[_0x0142('0x29')](respondWithFilteredResult(_0x52a870,_0x254d47))[_0x0142('0x43')](handleError(_0x52a870,null));};exports['show']=function(_0x2f5047,_0x5a0426){var _0x1f00c5={'raw':![],'where':{'id':_0x2f5047[_0x0142('0x44')]['id']}},_0x9f9eab={};_0x9f9eab[_0x0142('0x32')]=_['keys'](db[_0x0142('0x2f')]['rawAttributes']);_0x9f9eab[_0x0142('0x33')]=_[_0x0142('0x34')](_0x2f5047['query']);_0x9f9eab[_0x0142('0x35')]=_[_0x0142('0x36')](_0x9f9eab['model'],_0x9f9eab[_0x0142('0x33')]);_0x1f00c5[_0x0142('0x37')]=_['intersection'](_0x9f9eab['model'],qs[_0x0142('0x38')](_0x2f5047[_0x0142('0x33')]['fields']));_0x1f00c5[_0x0142('0x37')]=_0x1f00c5['attributes'][_0x0142('0x39')]?_0x1f00c5[_0x0142('0x37')]:_0x9f9eab[_0x0142('0x32')];if(_0x2f5047['query'][_0x0142('0x45')]){_0x1f00c5['include']=[{'all':!![]}];}_0x1f00c5=_['merge']({},_0x1f00c5,_0x2f5047[_0x0142('0x46')]);return db['CmList'][_0x0142('0x47')](_0x1f00c5)['then'](handleEntityNotFound(_0x5a0426,null))[_0x0142('0x29')](respondWithResult(_0x5a0426,null))[_0x0142('0x43')](handleError(_0x5a0426,null));};exports[_0x0142('0x48')]=function(_0x456ed0,_0x2c57df){return db['CmList'][_0x0142('0x48')](_0x456ed0['body'],{})[_0x0142('0x29')](function(_0xfa6fdc){var _0x4e579d=_0x456ed0[_0x0142('0x49')][_0x0142('0x2b')]({'plain':!![]});if(!_0x4e579d)throw new Error(_0x0142('0x4a'));if(_0x4e579d['role']===_0x0142('0x49')){var _0x50a3c7=_0xfa6fdc[_0x0142('0x2b')]({'plain':!![]});var _0x38bf8c=_0x0142('0x4b');return db[_0x0142('0x4c')][_0x0142('0x47')]({'where':{'name':_0x38bf8c,'userProfileId':_0x4e579d[_0x0142('0x4d')]},'raw':!![]})[_0x0142('0x29')](function(_0x33db94){if(_0x33db94&&_0x33db94[_0x0142('0x4e')]===0x0){return db[_0x0142('0x2c')][_0x0142('0x48')]({'name':_0x50a3c7['name'],'resourceId':_0x50a3c7['id'],'type':_0x33db94[_0x0142('0x2d')],'sectionId':_0x33db94['id']},{})[_0x0142('0x29')](function(){return _0xfa6fdc;});}else{return _0xfa6fdc;}})['catch'](function(_0x3d817f){logger[_0x0142('0x4f')](_0x0142('0x50'),_0x3d817f);throw _0x3d817f;});}return _0xfa6fdc;})['then'](respondWithResult(_0x2c57df,0xc9))[_0x0142('0x43')](handleError(_0x2c57df,null));};exports['update']=function(_0x4ad6ab,_0x51d67a){if(_0x4ad6ab[_0x0142('0x51')]['id']){delete _0x4ad6ab[_0x0142('0x51')]['id'];}return db[_0x0142('0x2f')][_0x0142('0x47')]({'where':{'id':_0x4ad6ab['params']['id']}})['then'](handleEntityNotFound(_0x51d67a,null))['then'](saveUpdates(_0x4ad6ab[_0x0142('0x51')],null))['then'](respondWithResult(_0x51d67a,null))[_0x0142('0x43')](handleError(_0x51d67a,null));};exports['destroy']=function(_0x50d79a,_0x4fcdfc){return db['CmList']['find']({'where':{'id':_0x50d79a[_0x0142('0x44')]['id']}})[_0x0142('0x29')](handleEntityNotFound(_0x4fcdfc,null))[_0x0142('0x29')](removeEntity(_0x4fcdfc,null))[_0x0142('0x43')](handleError(_0x4fcdfc,null));};exports[_0x0142('0x52')]=function(_0x3901cf,_0x234941){return db[_0x0142('0x2f')][_0x0142('0x52')]()[_0x0142('0x29')](respondWithResult(_0x234941,null))[_0x0142('0x43')](handleError(_0x234941,null));};exports['addDisposition']=function(_0x5071b7,_0x93500,_0x4126c3){if(_0x5071b7[_0x0142('0x51')]['id']){delete _0x5071b7[_0x0142('0x51')]['id'];}return db[_0x0142('0x2f')][_0x0142('0x47')]({'where':{'id':_0x5071b7[_0x0142('0x44')]['id']}})['then'](handleEntityNotFound(_0x93500,null))[_0x0142('0x29')](function(_0x27bcd8){if(_0x27bcd8){_0x5071b7[_0x0142('0x51')]['ListId']=_0x27bcd8['id'];return db[_0x0142('0x53')][_0x0142('0x48')](_0x5071b7['body']);}})['then'](respondWithResult(_0x93500,null))['catch'](handleError(_0x93500,null));};exports[_0x0142('0x54')]=function(_0x1bd4d5,_0x5988e7,_0x253bda){var _0x18c8b6={'raw':![],'where':{}};var _0x2d5c7d={};var _0x1d7014={'count':0x0,'rows':[]};return db[_0x0142('0x2f')]['findOne']({'where':{'id':_0x1bd4d5[_0x0142('0x44')]['id']}})[_0x0142('0x29')](handleEntityNotFound(_0x5988e7,null))[_0x0142('0x29')](function(_0x5a6a96){if(_0x5a6a96){_0x2d5c7d[_0x0142('0x32')]=_[_0x0142('0x34')](db['Disposition'][_0x0142('0x30')]);_0x2d5c7d[_0x0142('0x33')]=_[_0x0142('0x34')](_0x1bd4d5[_0x0142('0x33')]);_0x2d5c7d[_0x0142('0x35')]=_['intersection'](_0x2d5c7d[_0x0142('0x32')],_0x2d5c7d[_0x0142('0x33')]);_0x18c8b6['attributes']=_[_0x0142('0x36')](_0x2d5c7d[_0x0142('0x32')],qs['fields'](_0x1bd4d5[_0x0142('0x33')][_0x0142('0x38')]));_0x18c8b6['attributes']=_0x18c8b6[_0x0142('0x37')][_0x0142('0x39')]?_0x18c8b6[_0x0142('0x37')]:_0x2d5c7d['model'];if(!_0x1bd4d5[_0x0142('0x33')][_0x0142('0x55')](_0x0142('0x3a'))){_0x18c8b6[_0x0142('0x22')]=qs['limit'](_0x1bd4d5[_0x0142('0x33')][_0x0142('0x22')]);_0x18c8b6[_0x0142('0x21')]=qs['offset'](_0x1bd4d5[_0x0142('0x33')][_0x0142('0x21')]);}_0x18c8b6['order']=qs[_0x0142('0x3c')](_0x1bd4d5[_0x0142('0x33')][_0x0142('0x3c')]);_0x18c8b6[_0x0142('0x3d')]=qs[_0x0142('0x35')](_[_0x0142('0x56')](_0x1bd4d5['query'],_0x2d5c7d[_0x0142('0x35')]));_0x18c8b6['where']['ListId']=_0x5a6a96['id'];if(_0x1bd4d5[_0x0142('0x33')]['filter']){_0x18c8b6[_0x0142('0x3d')]=_['merge'](_0x18c8b6[_0x0142('0x3d')],{'$or':_[_0x0142('0x2e')](_0x18c8b6['attributes'],function(_0xaf9888){var _0x436e3b={};_0x436e3b[_0xaf9888]={'$like':'%'+_0x1bd4d5[_0x0142('0x33')]['filter']+'%'};return _0x436e3b;})});}_0x18c8b6=_[_0x0142('0x3f')]({},_0x18c8b6,_0x1bd4d5[_0x0142('0x46')]);return db[_0x0142('0x53')][_0x0142('0x20')]({'where':_0x18c8b6['where']})[_0x0142('0x29')](function(_0x34e3bc){_0x1d7014[_0x0142('0x20')]=_0x34e3bc;if(_0x1bd4d5['query'][_0x0142('0x45')]){_0x18c8b6['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x18c8b6);})[_0x0142('0x29')](function(_0x24262e){_0x1d7014[_0x0142('0x57')]=_0x24262e;return _0x1d7014;});}})[_0x0142('0x29')](respondWithFilteredResult(_0x5988e7,_0x18c8b6))[_0x0142('0x43')](handleError(_0x5988e7,null));};exports[_0x0142('0x58')]=function(_0x45457d,_0x2607d3,_0x4e0ae3){return db[_0x0142('0x2f')][_0x0142('0x47')]({'where':{'id':_0x45457d[_0x0142('0x44')]['id']}})[_0x0142('0x29')](handleEntityNotFound(_0x2607d3,null))['then'](function(_0x113a73){if(_0x113a73){return _0x113a73['removeDispositions'](_0x45457d[_0x0142('0x33')][_0x0142('0x59')]);}})['then'](respondWithStatusCode(_0x2607d3,null))[_0x0142('0x43')](handleError(_0x2607d3,null));};exports[_0x0142('0x5a')]=function(_0x598184,_0x29233a,_0x3eef7a){return db['CmList']['find']({'where':{'id':_0x598184[_0x0142('0x44')]['id']}})['then'](handleEntityNotFound(_0x29233a,null))[_0x0142('0x29')](function(_0x478ed5){if(_0x478ed5){var _0x347f75=[];var _0x28c006={'success':[],'errors':[]};return db[_0x0142('0x5b')][_0x0142('0x52')]()[_0x0142('0x29')](function(_0x10ab20){if(_0x598184[_0x0142('0x51')][_0x0142('0x5c')]&&_['isArray'](_0x598184[_0x0142('0x51')][_0x0142('0x5c')])){if(_0x598184[_0x0142('0x51')]['tags'][_0x0142('0x39')]){_0x598184['body'][_0x0142('0x5c')]=_0x598184['body'][_0x0142('0x5c')][_0x0142('0x5d')](';')+';';}else{_0x598184[_0x0142('0x51')][_0x0142('0x5c')]=null;}}else{_0x598184[_0x0142('0x51')][_0x0142('0x5c')]=null;}if(_0x598184[_0x0142('0x51')]&&_['isArray'](_0x598184['body'])){for(var _0x4c3cb8=0x0;_0x4c3cb8<_0x598184['body'][_0x0142('0x39')];_0x4c3cb8+=0x1){_0x598184[_0x0142('0x51')][_0x4c3cb8][_0x0142('0x5e')]=_0x598184['params']['id'];_0x347f75[_0x0142('0x5f')](_0x598184[_0x0142('0x51')][_0x4c3cb8]);}return BPromise[_0x0142('0x60')](_0x347f75,function(_0x19fc6c){return db[_0x0142('0x5b')][_0x0142('0x48')](_[_0x0142('0x61')](_0x19fc6c,['ids','id'])||{},{'fields':_[_0x0142('0x34')](_0x10ab20),'raw':!![]})[_0x0142('0x29')](function(_0x5513f8){_0x28c006['success'][_0x0142('0x5f')](_0x5513f8[_0x0142('0x62')]);})[_0x0142('0x43')](function(_0x3af19b){_0x28c006[_0x0142('0x63')][_0x0142('0x5f')]({'data':_0x19fc6c,'error':_0x3af19b[_0x0142('0x64')]});});})['then'](function(_0x22b9f0){return _0x28c006;})['catch'](function(_0x58331e){return _0x58331e;});}else{_0x29233a[_0x0142('0x23')](0x190)[_0x0142('0x1e')]({'message':_0x0142('0x65')});}});}})[_0x0142('0x29')](respondWithResult(_0x29233a,null))[_0x0142('0x43')](handleError(_0x29233a,null));};exports['getContacts']=function(_0x385083,_0x2a74c4,_0x428e04){var _0x2365be;return db[_0x0142('0x2f')][_0x0142('0x47')]({'where':{'id':_0x385083['params']['id']},'include':[{'model':db[_0x0142('0x66')],'as':_0x0142('0x67')}]})[_0x0142('0x29')](handleEntityNotFound(_0x2a74c4,null))[_0x0142('0x29')](function(_0x19480d){if(_0x19480d){_0x2365be=_0x19480d;return db[_0x0142('0x5b')]['rawAttributes'];}})[_0x0142('0x29')](function(_0x39a46d){if(_0x39a46d){var _0x1bfda6={};var _0x30eec8={};_0x30eec8[_0x0142('0x32')]=_[_0x0142('0x68')](_[_0x0142('0x34')](_0x39a46d),_[_0x0142('0x2e')](_0x2365be[_0x0142('0x67')],function(_0x4fb259){return util[_0x0142('0x69')](_0x0142('0x6a'),_0x4fb259['id']);}));_0x30eec8[_0x0142('0x33')]=_[_0x0142('0x34')](_0x385083[_0x0142('0x33')]);_0x30eec8[_0x0142('0x35')]=_[_0x0142('0x36')](_0x30eec8[_0x0142('0x32')],_0x30eec8[_0x0142('0x33')]);_0x1bfda6[_0x0142('0x37')]=_[_0x0142('0x36')](_0x30eec8['model'],qs['fields'](_0x385083['query'][_0x0142('0x38')]));_0x1bfda6['attributes']=_0x1bfda6[_0x0142('0x37')]['length']?_0x1bfda6[_0x0142('0x37')]:_0x30eec8['model'];if(!_0x385083[_0x0142('0x33')][_0x0142('0x55')](_0x0142('0x3a'))){_0x1bfda6[_0x0142('0x22')]=qs[_0x0142('0x22')](_0x385083[_0x0142('0x33')][_0x0142('0x22')]);_0x1bfda6[_0x0142('0x21')]=qs['offset'](_0x385083[_0x0142('0x33')]['offset']);}_0x1bfda6['order']=qs[_0x0142('0x3c')](_0x385083[_0x0142('0x33')][_0x0142('0x3c')]);_0x1bfda6['where']=qs[_0x0142('0x35')](_[_0x0142('0x56')](_0x385083['query'],_0x30eec8[_0x0142('0x35')]));_0x1bfda6[_0x0142('0x6b')]=!![];if(_0x385083[_0x0142('0x33')][_0x0142('0x3e')]){_0x1bfda6[_0x0142('0x3d')]=_[_0x0142('0x3f')](_0x1bfda6[_0x0142('0x3d')],{'$or':_[_0x0142('0x2e')](_0x1bfda6[_0x0142('0x37')],function(_0x4febdb){var _0x7fcc04={};_0x7fcc04[_0x4febdb]={'$like':'%'+_0x385083[_0x0142('0x33')][_0x0142('0x3e')]+'%'};return _0x7fcc04;})});}_0x1bfda6=_[_0x0142('0x3f')]({},_0x1bfda6,_0x385083[_0x0142('0x46')]);return _0x2365be[_0x0142('0x6c')](_0x1bfda6);}})['then'](respondWithResult(_0x2a74c4,null))['catch'](handleError(_0x2a74c4,null));};exports['getContactsCsv']=function(_0x205353,_0x18faf7,_0x3bf70f){var _0x486a17;var _0x1b366b;var _0x26ea81;var _0x1d757e=_0x205353[_0x0142('0x44')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0x0142('0x6d')]})[_0x0142('0x29')](function(_0x4e97ee){_0x486a17=_0x4e97ee;var _0x1b37c5=_['keys'](db['CmContact'][_0x0142('0x30')]);return db[_0x0142('0x66')][_0x0142('0x6e')]({'raw':!![],'attributes':['id',_0x0142('0x6f')]})[_0x0142('0x29')](function(_0x4374ef){_0x1b366b=_0x4374ef;var _0x3bb795=squel[_0x0142('0x70')]()[_0x0142('0x38')](_0x1b37c5)[_0x0142('0x71')](_0x0142('0x72'),'c')['where']('c.ListId\x20=\x20?',_0x1d757e)[_0x0142('0x3d')](_0x0142('0x73'))['distinct']();for(var _0x55611f=0x0;_0x55611f<_0x1b366b[_0x0142('0x39')];_0x55611f++){_0x3bb795[_0x0142('0x74')]('c.cf_'+_0x1b366b[_0x55611f]['id'],_0x0142('0x75')+_0x1b366b[_0x55611f][_0x0142('0x6f')]);}for(var _0x55611f=0x0;_0x55611f<_0x486a17[_0x0142('0x39')];_0x55611f++){_0x3bb795[_0x0142('0x74')](squel['select']()[_0x0142('0x74')]('item')[_0x0142('0x71')]('cm_contact_has_items')[_0x0142('0x3d')](_0x0142('0x76'),_0x486a17[_0x55611f]['id'])[_0x0142('0x3d')](_0x0142('0x77')),'additionalPhone_'+_0x486a17[_0x55611f]['name']);_0x3bb795['field'](squel['select']()['field'](_0x0142('0x78'))['from'](_0x0142('0x79'))['where'](_0x0142('0x76'),_0x486a17[_0x55611f]['id'])[_0x0142('0x3d')](_0x0142('0x77')),_0x0142('0x7a')+_0x486a17[_0x55611f][_0x0142('0x2d')]);}var _0x4f1d53=[];_0x4f1d53['push'](_0x3bb795[_0x0142('0x7b')]());BPromise[_0x0142('0x60')](_0x4f1d53,handleQuery)[_0x0142('0x29')](function(_0x427c9b){handleQuery(_0x3bb795['toString']());var _0x5b5dc4=csv_results[0x0];if(!_[_0x0142('0x7c')](_0x5b5dc4)){var _0x326d1f=toCsv(_0x5b5dc4);var _0x2aadbf=Date[_0x0142('0x7d')]();fs['writeFileSync'](util[_0x0142('0x69')]('/tmp/list_%d_%s.csv',_0x1d757e,_0x2aadbf),_0x326d1f);_0x18faf7['setHeader'](_0x0142('0x7e'),_0x0142('0x7f')+util[_0x0142('0x69')](_0x0142('0x80'),_0x1d757e,_0x2aadbf));_0x18faf7[_0x0142('0x81')](_0x0142('0x82'),_0x0142('0x83'));return _0x18faf7[_0x0142('0x84')](util[_0x0142('0x69')](_0x0142('0x85'),_0x1d757e,_0x2aadbf));}else{return _0x18faf7['sendStatus'](0xcc);}});});});};exports[_0x0142('0x86')]=function(_0x551f49,_0x168af5,_0x343c5b){var _0x2afd2a;delete _0x551f49[_0x0142('0x51')]['id'];return db[_0x0142('0x2f')][_0x0142('0x87')]({'where':{'id':_0x551f49[_0x0142('0x44')]['id']}})['then'](handleEntityNotFound(_0x168af5,null))[_0x0142('0x29')](function(_0x59c88c){if(_0x59c88c){return db[_0x0142('0x88')][_0x0142('0x89')](function(_0xd1aacb){return db['CmCustomField'][_0x0142('0x48')](_0x551f49['body'],{'transaction':_0xd1aacb})[_0x0142('0x29')](function(_0x5c4149){_0x2afd2a=_0x5c4149;return _0x59c88c[_0x0142('0x8a')](_0x5c4149,{'transaction':_0xd1aacb});})['then'](function(){var _0xfbf53b={'type':db['Sequelize']['TEXT'],'transaction':_0xd1aacb};switch(_0x551f49[_0x0142('0x51')][_0x0142('0x40')]){case'text':_0xfbf53b[_0x0142('0x40')]=db[_0x0142('0x8b')][_0x0142('0x8c')];break;case _0x0142('0x8d'):_0xfbf53b[_0x0142('0x40')]=db[_0x0142('0x8b')]['INTEGER'];break;case _0x0142('0x8e'):_0xfbf53b[_0x0142('0x40')]=db[_0x0142('0x8b')][_0x0142('0x8f')];_0xfbf53b[_0x0142('0x90')]=![];break;default:}return db[_0x0142('0x88')][_0x0142('0x91')][_0x0142('0x92')]('cm_contacts',util[_0x0142('0x69')](_0x0142('0x93'),_0x2afd2a['id']),_0xfbf53b);})['then'](function(){return _0x2afd2a;});});}})[_0x0142('0x29')](respondWithResult(_0x168af5,null))[_0x0142('0x43')](handleError(_0x168af5,null));};exports[_0x0142('0x94')]=function(_0x213d25,_0x4cbd3d,_0x3a7fb2){var _0x10889f={};var _0x3bf98f={};var _0x3d67b9;var _0x245679;return db[_0x0142('0x2f')][_0x0142('0x87')]({'where':{'id':_0x213d25[_0x0142('0x44')]['id']}})[_0x0142('0x29')](handleEntityNotFound(_0x4cbd3d,null))[_0x0142('0x29')](function(_0x30327b){if(_0x30327b){_0x3d67b9=_0x30327b;_0x3bf98f['model']=_[_0x0142('0x34')](db[_0x0142('0x66')][_0x0142('0x30')]);_0x3bf98f[_0x0142('0x33')]=_[_0x0142('0x34')](_0x213d25[_0x0142('0x33')]);_0x3bf98f['filters']=_[_0x0142('0x36')](_0x3bf98f[_0x0142('0x32')],_0x3bf98f[_0x0142('0x33')]);_0x10889f['attributes']=_['intersection'](_0x3bf98f[_0x0142('0x32')],qs[_0x0142('0x38')](_0x213d25[_0x0142('0x33')][_0x0142('0x38')]));_0x10889f['attributes']=_0x10889f[_0x0142('0x37')][_0x0142('0x39')]?_0x10889f[_0x0142('0x37')]:_0x3bf98f[_0x0142('0x32')];_0x10889f['order']=qs['sort'](_0x213d25[_0x0142('0x33')][_0x0142('0x3c')]);_0x10889f[_0x0142('0x3d')]=qs[_0x0142('0x35')](_[_0x0142('0x56')](_0x213d25[_0x0142('0x33')],_0x3bf98f['filters']));_0x10889f[_0x0142('0x3d')]=_[_0x0142('0x3f')](_0x10889f[_0x0142('0x3d')],{'$or':[{'ListId':_0x30327b['id']},{'ListId':null}]});if(_0x213d25['query'][_0x0142('0x3e')]){_0x10889f[_0x0142('0x3d')]=_['merge'](_0x10889f[_0x0142('0x3d')],{'$or':_[_0x0142('0x2e')](_0x10889f[_0x0142('0x37')],function(_0x2894e0){var _0x59581a={};_0x59581a[_0x2894e0]={'$like':'%'+_0x213d25['query'][_0x0142('0x3e')]+'%'};return _0x59581a;})});}_0x10889f=_[_0x0142('0x3f')]({},_0x10889f,_0x213d25['options']);return db[_0x0142('0x66')][_0x0142('0x95')](_0x10889f);}})['then'](respondWithResult(_0x4cbd3d,null))[_0x0142('0x43')](handleError(_0x4cbd3d,null));};exports[_0x0142('0x96')]=function(_0x7ec025,_0x887083){return db[_0x0142('0x66')][_0x0142('0x95')]({'where':{'ListId':null}})[_0x0142('0x29')](handleEntityNotFound(_0x887083,null))[_0x0142('0x29')](function(_0x1153f1){return _0x1153f1;})['then'](respondWithResult(_0x887083,null))[_0x0142('0x43')](handleError(_0x887083,null));};exports[_0x0142('0x97')]=function(_0x3fef22,_0x57f6c0,_0x20a068){return db['CmList'][_0x0142('0x47')]({'where':{'id':_0x3fef22[_0x0142('0x44')]['id']}})[_0x0142('0x29')](handleEntityNotFound(_0x57f6c0,null))[_0x0142('0x29')](function(_0x19a5f2){if(_0x19a5f2){return _0x19a5f2['addAgents'](_0x3fef22[_0x0142('0x51')][_0x0142('0x59')],_[_0x0142('0x61')](_0x3fef22[_0x0142('0x51')],[_0x0142('0x59'),'id'])||{})[_0x0142('0x98')](function(_0x392aed){for(var _0x1b146e=0x0;_0x1b146e<_0x3fef22[_0x0142('0x51')][_0x0142('0x59')][_0x0142('0x39')];_0x1b146e+=0x1){socket['emit'](_0x0142('0x99'),{'UserId':Number(_0x3fef22[_0x0142('0x51')]['ids'][_0x1b146e]),'CmListId':Number(_0x3fef22[_0x0142('0x44')]['id'])});}return _0x392aed;});}})[_0x0142('0x29')](respondWithResult(_0x57f6c0,null))[_0x0142('0x43')](handleError(_0x57f6c0,null));};exports[_0x0142('0x9a')]=function(_0x1aa753,_0x2c3844,_0x3d8649){return db[_0x0142('0x2f')]['find']({'where':{'id':_0x1aa753['params']['id']}})[_0x0142('0x29')](handleEntityNotFound(_0x2c3844,null))['then'](function(_0x19aa72){if(_0x19aa72){return _0x19aa72[_0x0142('0x9a')](_0x1aa753['query'][_0x0142('0x59')])[_0x0142('0x29')](function(){if(_[_0x0142('0x9b')](_0x1aa753[_0x0142('0x33')]['ids'])){for(var _0x240d55=0x0;_0x240d55<_0x1aa753[_0x0142('0x33')][_0x0142('0x59')]['length'];_0x240d55+=0x1){socket[_0x0142('0x9c')](_0x0142('0x9d'),{'UserId':Number(_0x1aa753[_0x0142('0x33')][_0x0142('0x59')][_0x240d55]),'CmListId':Number(_0x1aa753[_0x0142('0x44')]['id'])});}}else{socket[_0x0142('0x9c')]('userCmList:remove',{'UserId':Number(_0x1aa753[_0x0142('0x33')][_0x0142('0x59')]),'CmListId':Number(_0x1aa753['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2c3844,null))['catch'](handleError(_0x2c3844,null));};exports[_0x0142('0x9e')]=function(_0x5d7b6e,_0x4b25ea,_0x62e463){var _0x1ce240={};var _0x16b0ff={};var _0x24e701;var _0x1c9545;return db[_0x0142('0x2f')][_0x0142('0x87')]({'where':{'id':_0x5d7b6e[_0x0142('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b25ea,null))[_0x0142('0x29')](function(_0x1ef64){if(_0x1ef64){_0x24e701=_0x1ef64;_0x16b0ff[_0x0142('0x32')]=_[_0x0142('0x34')](db[_0x0142('0x9f')][_0x0142('0x30')]);_0x16b0ff[_0x0142('0x33')]=_['keys'](_0x5d7b6e[_0x0142('0x33')]);_0x16b0ff[_0x0142('0x35')]=_[_0x0142('0x36')](_0x16b0ff[_0x0142('0x32')],_0x16b0ff[_0x0142('0x33')]);_0x1ce240[_0x0142('0x37')]=_['intersection'](_0x16b0ff[_0x0142('0x32')],qs[_0x0142('0x38')](_0x5d7b6e[_0x0142('0x33')][_0x0142('0x38')]));_0x1ce240[_0x0142('0x37')]=_0x1ce240[_0x0142('0x37')][_0x0142('0x39')]?_0x1ce240['attributes']:_0x16b0ff[_0x0142('0x32')];_0x1ce240[_0x0142('0x3b')]=qs[_0x0142('0x3c')](_0x5d7b6e[_0x0142('0x33')][_0x0142('0x3c')]);_0x1ce240[_0x0142('0x3d')]=qs[_0x0142('0x35')](_['pick'](_0x5d7b6e[_0x0142('0x33')],_0x16b0ff[_0x0142('0x35')]));if(_0x5d7b6e[_0x0142('0x33')][_0x0142('0x3e')]){_0x1ce240[_0x0142('0x3d')]=_[_0x0142('0x3f')](_0x1ce240[_0x0142('0x3d')],{'$or':_['map'](_0x1ce240['attributes'],function(_0x6e4721){var _0x787ca6={};_0x787ca6[_0x6e4721]={'$like':'%'+_0x5d7b6e[_0x0142('0x33')][_0x0142('0x3e')]+'%'};return _0x787ca6;})});}_0x1ce240=_[_0x0142('0x3f')]({},_0x1ce240,_0x5d7b6e[_0x0142('0x46')]);return _0x24e701[_0x0142('0x9e')](_0x1ce240);}})[_0x0142('0x29')](function(_0x3a3a99){if(_0x3a3a99){_0x1c9545=_0x3a3a99['length'];if(!_0x5d7b6e[_0x0142('0x33')][_0x0142('0x55')](_0x0142('0x3a'))){_0x1ce240['limit']=qs[_0x0142('0x22')](_0x5d7b6e[_0x0142('0x33')]['limit']);_0x1ce240[_0x0142('0x21')]=qs[_0x0142('0x21')](_0x5d7b6e['query']['offset']);}return _0x24e701[_0x0142('0x9e')](_0x1ce240);}})[_0x0142('0x29')](function(_0x11cccc){if(_0x11cccc){return _0x11cccc?{'count':_0x1c9545,'rows':_0x11cccc}:null;}})[_0x0142('0x29')](respondWithResult(_0x4b25ea,null))['catch'](handleError(_0x4b25ea,null));};function handleQuery(_0x370681){logger[_0x0142('0xa0')](_0x370681);return db['sequelize']['query'](_0x370681)['spread'](function(_0x1b9f89){csv_results[_0x0142('0x5f')](_0x1b9f89);})[_0x0142('0x43')](function(_0x3de34e){logger['error'](_0x3de34e[_0x0142('0x64')]);});} \ No newline at end of file +var _0x8471=['VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addContacts','CmContact','tags','join','push','each','omit','success','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','BOOLEAN','sequelize','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','info','message','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','Lists','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8471,0xfd));var _0x1847=function(_0x1b489b,_0x5d5a0b){_0x1b489b=_0x1b489b-0x0;var _0x1ebe10=_0x8471[_0x1b489b];return _0x1ebe10;};'use strict';var emlformat=require(_0x1847('0x0'));var rimraf=require(_0x1847('0x1'));var zipdir=require(_0x1847('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1847('0x3'));var moment=require(_0x1847('0x4'));var BPromise=require(_0x1847('0x5'));var Mustache=require(_0x1847('0x6'));var util=require(_0x1847('0x7'));var path=require(_0x1847('0x8'));var sox=require(_0x1847('0x9'));var csv=require('to-csv');var ejs=require(_0x1847('0xa'));var fs=require('fs');var fs_extra=require(_0x1847('0xb'));var _=require(_0x1847('0xc'));var squel=require(_0x1847('0xd'));var crypto=require(_0x1847('0xe'));var jsforce=require(_0x1847('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1847('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1847('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1847('0x12'));var utils=require('../../config/utils');var config=require(_0x1847('0x13'));var licenseUtil=require(_0x1847('0x14'));var db=require(_0x1847('0x15'))['db'];var csv_results;config[_0x1847('0x16')]=_[_0x1847('0x17')](config[_0x1847('0x16')],{'host':_0x1847('0x18'),'port':0x18eb});var socket=require(_0x1847('0x19'))(new Redis(config['redis']));require(_0x1847('0x1a'))[_0x1847('0x1b')](socket);function respondWithStatusCode(_0x9b5b5f,_0x4e62ec){_0x4e62ec=_0x4e62ec||0xcc;return function(_0x1eb2e8){if(_0x1eb2e8){return _0x9b5b5f[_0x1847('0x1c')](_0x4e62ec);}return _0x9b5b5f[_0x1847('0x1d')](_0x4e62ec)[_0x1847('0x1e')]();};}function respondWithResult(_0x5cdaea,_0x361b59){_0x361b59=_0x361b59||0xc8;return function(_0x516c34){if(_0x516c34){return _0x5cdaea[_0x1847('0x1d')](_0x361b59)['json'](_0x516c34);}};}function respondWithFilteredResult(_0x3ffe6c,_0x5071fb){return function(_0x569e8c){if(_0x569e8c){var _0x467e0b=typeof _0x5071fb[_0x1847('0x1f')]===_0x1847('0x20')&&typeof _0x5071fb[_0x1847('0x21')]===_0x1847('0x20');var _0x5ca911=_0x569e8c['count'];var _0x786f74=_0x467e0b?0x0:_0x5071fb[_0x1847('0x1f')];var _0x5a164b=_0x467e0b?_0x569e8c[_0x1847('0x22')]:_0x5071fb[_0x1847('0x1f')]+_0x5071fb['limit'];var _0x35f9a0;if(_0x5a164b>=_0x5ca911){_0x5a164b=_0x5ca911;_0x35f9a0=0xc8;}else{_0x35f9a0=0xce;}_0x3ffe6c[_0x1847('0x1d')](_0x35f9a0);return _0x3ffe6c['set'](_0x1847('0x23'),_0x786f74+'-'+_0x5a164b+'/'+_0x5ca911)['json'](_0x569e8c);}return null;};}function patchUpdates(_0x5e0399){return function(_0x318407){try{jsonpatch[_0x1847('0x24')](_0x318407,_0x5e0399,!![]);}catch(_0x4ba6bd){return BPromise[_0x1847('0x25')](_0x4ba6bd);}return _0x318407[_0x1847('0x26')]();};}function saveUpdates(_0xd0bfb5,_0x69ae06){return function(_0x191fcf){if(_0x191fcf){return _0x191fcf['update'](_0xd0bfb5)[_0x1847('0x27')](function(_0x3056d5){return _0x3056d5;});}return null;};}function removeEntity(_0x135f22,_0x1a0894){return function(_0x443822){if(_0x443822){return _0x443822[_0x1847('0x28')]()[_0x1847('0x27')](function(){var _0x2e7bf5=_0x443822[_0x1847('0x29')]({'plain':!![]});var _0x5d4890=_0x1847('0x2a');return db['UserProfileResource'][_0x1847('0x28')]({'where':{'type':_0x5d4890,'resourceId':_0x2e7bf5['id']}})[_0x1847('0x27')](function(){return _0x443822;});})[_0x1847('0x27')](function(){_0x135f22[_0x1847('0x1d')](0xcc)[_0x1847('0x1e')]();});}};}function handleEntityNotFound(_0x21cec8,_0x8f9365){return function(_0x2f9bcc){if(!_0x2f9bcc){_0x21cec8[_0x1847('0x1c')](0x194);}return _0x2f9bcc;};}function handleError(_0x1595aa,_0x279a04){_0x279a04=_0x279a04||0x1f4;return function(_0x5256b2){logger[_0x1847('0x2b')](_0x5256b2[_0x1847('0x2c')]);if(_0x5256b2[_0x1847('0x2d')]){delete _0x5256b2['name'];}_0x1595aa[_0x1847('0x1d')](_0x279a04)[_0x1847('0x2e')](_0x5256b2);};}exports[_0x1847('0x2f')]=function(_0x4041c6,_0x2811dc){var _0x3a7f35={},_0x5d98a4={},_0x255843={'count':0x0,'rows':[]};var _0x4c57cf=_[_0x1847('0x30')](db[_0x1847('0x31')][_0x1847('0x32')],function(_0x36b488){return{'name':_0x36b488['fieldName'],'type':_0x36b488[_0x1847('0x33')][_0x1847('0x34')]};});_0x5d98a4[_0x1847('0x35')]=_[_0x1847('0x30')](_0x4c57cf,_0x1847('0x2d'));_0x5d98a4[_0x1847('0x36')]=_[_0x1847('0x37')](_0x4041c6['query']);_0x5d98a4[_0x1847('0x38')]=_['intersection'](_0x5d98a4[_0x1847('0x35')],_0x5d98a4['query']);_0x3a7f35['attributes']=_['intersection'](_0x5d98a4['model'],qs[_0x1847('0x39')](_0x4041c6[_0x1847('0x36')]['fields']));_0x3a7f35[_0x1847('0x3a')]=_0x3a7f35['attributes']['length']?_0x3a7f35[_0x1847('0x3a')]:_0x5d98a4['model'];if(!_0x4041c6['query'][_0x1847('0x3b')](_0x1847('0x3c'))){_0x3a7f35[_0x1847('0x21')]=qs['limit'](_0x4041c6['query'][_0x1847('0x21')]);_0x3a7f35[_0x1847('0x1f')]=qs['offset'](_0x4041c6['query'][_0x1847('0x1f')]);}_0x3a7f35[_0x1847('0x3d')]=qs['sort'](_0x4041c6['query'][_0x1847('0x3e')]);_0x3a7f35[_0x1847('0x3f')]=qs[_0x1847('0x38')](_['pick'](_0x4041c6[_0x1847('0x36')],_0x5d98a4[_0x1847('0x38')]),_0x4c57cf);if(_0x4041c6['query'][_0x1847('0x40')]){_0x3a7f35[_0x1847('0x3f')]=_['merge'](_0x3a7f35[_0x1847('0x3f')],{'$or':_[_0x1847('0x30')](_0x4c57cf,function(_0x2b107c){if(_0x2b107c['type']!==_0x1847('0x41')){var _0x33a0d8={};_0x33a0d8[_0x2b107c[_0x1847('0x2d')]]={'$like':'%'+_0x4041c6['query'][_0x1847('0x40')]+'%'};return _0x33a0d8;}})});}_0x3a7f35=_[_0x1847('0x42')]({},_0x3a7f35,_0x4041c6['options']);var _0x12585a={'where':_0x3a7f35['where']};return db[_0x1847('0x31')][_0x1847('0x22')](_0x12585a)[_0x1847('0x27')](function(_0x3f7e69){_0x255843[_0x1847('0x22')]=_0x3f7e69;if(_0x4041c6[_0x1847('0x36')][_0x1847('0x43')]){_0x3a7f35[_0x1847('0x44')]=[{'all':!![]}];}return db[_0x1847('0x31')][_0x1847('0x45')](_0x3a7f35);})['then'](function(_0x3577ff){_0x255843[_0x1847('0x46')]=_0x3577ff;return _0x255843;})['then'](respondWithFilteredResult(_0x2811dc,_0x3a7f35))[_0x1847('0x47')](handleError(_0x2811dc,null));};exports[_0x1847('0x48')]=function(_0x5684b5,_0x56c641){var _0x581cce={'raw':![],'where':{'id':_0x5684b5[_0x1847('0x49')]['id']}},_0x30539a={};_0x30539a[_0x1847('0x35')]=_[_0x1847('0x37')](db[_0x1847('0x31')][_0x1847('0x32')]);_0x30539a[_0x1847('0x36')]=_[_0x1847('0x37')](_0x5684b5[_0x1847('0x36')]);_0x30539a[_0x1847('0x38')]=_[_0x1847('0x4a')](_0x30539a[_0x1847('0x35')],_0x30539a[_0x1847('0x36')]);_0x581cce[_0x1847('0x3a')]=_[_0x1847('0x4a')](_0x30539a[_0x1847('0x35')],qs[_0x1847('0x39')](_0x5684b5['query'][_0x1847('0x39')]));_0x581cce['attributes']=_0x581cce[_0x1847('0x3a')][_0x1847('0x4b')]?_0x581cce[_0x1847('0x3a')]:_0x30539a['model'];if(_0x5684b5[_0x1847('0x36')]['includeAll']){_0x581cce[_0x1847('0x44')]=[{'all':!![]}];}_0x581cce=_[_0x1847('0x42')]({},_0x581cce,_0x5684b5[_0x1847('0x4c')]);return db['CmList'][_0x1847('0x4d')](_0x581cce)[_0x1847('0x27')](handleEntityNotFound(_0x56c641,null))[_0x1847('0x27')](respondWithResult(_0x56c641,null))['catch'](handleError(_0x56c641,null));};exports[_0x1847('0x4e')]=function(_0x3dac4f,_0x5e426b){return db['CmList'][_0x1847('0x4e')](_0x3dac4f[_0x1847('0x4f')],{})['then'](function(_0x2805f7){var _0x20f1cb=_0x3dac4f[_0x1847('0x50')][_0x1847('0x29')]({'plain':!![]});if(!_0x20f1cb)throw new Error(_0x1847('0x51'));if(_0x20f1cb[_0x1847('0x52')]===_0x1847('0x50')){var _0x345ad7=_0x2805f7[_0x1847('0x29')]({'plain':!![]});var _0x29536b=_0x1847('0x2a');return db[_0x1847('0x53')][_0x1847('0x4d')]({'where':{'name':_0x29536b,'userProfileId':_0x20f1cb[_0x1847('0x54')]},'raw':!![]})[_0x1847('0x27')](function(_0x16a446){if(_0x16a446&&_0x16a446[_0x1847('0x55')]===0x0){return db['UserProfileResource'][_0x1847('0x4e')]({'name':_0x345ad7[_0x1847('0x2d')],'resourceId':_0x345ad7['id'],'type':_0x16a446[_0x1847('0x2d')],'sectionId':_0x16a446['id']},{})[_0x1847('0x27')](function(){return _0x2805f7;});}else{return _0x2805f7;}})[_0x1847('0x47')](function(_0x561d79){logger[_0x1847('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x561d79);throw _0x561d79;});}return _0x2805f7;})['then'](respondWithResult(_0x5e426b,0xc9))[_0x1847('0x47')](handleError(_0x5e426b,null));};exports[_0x1847('0x56')]=function(_0x28e8c2,_0x55eafe){if(_0x28e8c2['body']['id']){delete _0x28e8c2[_0x1847('0x4f')]['id'];}return db[_0x1847('0x31')][_0x1847('0x4d')]({'where':{'id':_0x28e8c2[_0x1847('0x49')]['id']}})['then'](handleEntityNotFound(_0x55eafe,null))[_0x1847('0x27')](saveUpdates(_0x28e8c2[_0x1847('0x4f')],null))[_0x1847('0x27')](respondWithResult(_0x55eafe,null))['catch'](handleError(_0x55eafe,null));};exports[_0x1847('0x28')]=function(_0x37e501,_0x430540){return db['CmList'][_0x1847('0x4d')]({'where':{'id':_0x37e501[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x430540,null))['then'](removeEntity(_0x430540,null))[_0x1847('0x47')](handleError(_0x430540,null));};exports[_0x1847('0x57')]=function(_0x322b94,_0x5dcb33){return db['CmList'][_0x1847('0x57')]()[_0x1847('0x27')](respondWithResult(_0x5dcb33,null))[_0x1847('0x47')](handleError(_0x5dcb33,null));};exports[_0x1847('0x58')]=function(_0x1be797,_0x42e919,_0x24031b){if(_0x1be797[_0x1847('0x4f')]['id']){delete _0x1be797[_0x1847('0x4f')]['id'];}return db[_0x1847('0x31')][_0x1847('0x4d')]({'where':{'id':_0x1be797[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x42e919,null))[_0x1847('0x27')](function(_0x2a215c){if(_0x2a215c){_0x1be797[_0x1847('0x4f')][_0x1847('0x59')]=_0x2a215c['id'];return db[_0x1847('0x5a')][_0x1847('0x4e')](_0x1be797[_0x1847('0x4f')]);}})[_0x1847('0x27')](respondWithResult(_0x42e919,null))[_0x1847('0x47')](handleError(_0x42e919,null));};exports[_0x1847('0x5b')]=function(_0x580834,_0x3ac731,_0x5bd79f){var _0xc35439={'raw':![],'where':{}};var _0x5ee598={};var _0x24ed6e={'count':0x0,'rows':[]};return db[_0x1847('0x31')][_0x1847('0x5c')]({'where':{'id':_0x580834[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x3ac731,null))['then'](function(_0x472c58){if(_0x472c58){_0x5ee598[_0x1847('0x35')]=_[_0x1847('0x37')](db[_0x1847('0x5a')][_0x1847('0x32')]);_0x5ee598[_0x1847('0x36')]=_[_0x1847('0x37')](_0x580834['query']);_0x5ee598[_0x1847('0x38')]=_['intersection'](_0x5ee598[_0x1847('0x35')],_0x5ee598[_0x1847('0x36')]);_0xc35439['attributes']=_[_0x1847('0x4a')](_0x5ee598[_0x1847('0x35')],qs[_0x1847('0x39')](_0x580834['query'][_0x1847('0x39')]));_0xc35439[_0x1847('0x3a')]=_0xc35439[_0x1847('0x3a')][_0x1847('0x4b')]?_0xc35439[_0x1847('0x3a')]:_0x5ee598[_0x1847('0x35')];if(!_0x580834['query'][_0x1847('0x3b')](_0x1847('0x3c'))){_0xc35439['limit']=qs['limit'](_0x580834[_0x1847('0x36')][_0x1847('0x21')]);_0xc35439[_0x1847('0x1f')]=qs[_0x1847('0x1f')](_0x580834[_0x1847('0x36')][_0x1847('0x1f')]);}_0xc35439[_0x1847('0x3d')]=qs[_0x1847('0x3e')](_0x580834[_0x1847('0x36')][_0x1847('0x3e')]);_0xc35439[_0x1847('0x3f')]=qs['filters'](_[_0x1847('0x5d')](_0x580834['query'],_0x5ee598[_0x1847('0x38')]));_0xc35439['where']['ListId']=_0x472c58['id'];if(_0x580834[_0x1847('0x36')]['filter']){_0xc35439[_0x1847('0x3f')]=_[_0x1847('0x42')](_0xc35439[_0x1847('0x3f')],{'$or':_[_0x1847('0x30')](_0xc35439[_0x1847('0x3a')],function(_0x398ff8){var _0x25289e={};_0x25289e[_0x398ff8]={'$like':'%'+_0x580834[_0x1847('0x36')]['filter']+'%'};return _0x25289e;})});}_0xc35439=_[_0x1847('0x42')]({},_0xc35439,_0x580834[_0x1847('0x4c')]);return db[_0x1847('0x5a')][_0x1847('0x22')]({'where':_0xc35439['where']})[_0x1847('0x27')](function(_0x1e9caf){_0x24ed6e[_0x1847('0x22')]=_0x1e9caf;if(_0x580834['query'][_0x1847('0x43')]){_0xc35439[_0x1847('0x44')]=[{'all':!![]}];}return db[_0x1847('0x5a')][_0x1847('0x45')](_0xc35439);})[_0x1847('0x27')](function(_0x17e903){_0x24ed6e[_0x1847('0x46')]=_0x17e903;return _0x24ed6e;});}})['then'](respondWithFilteredResult(_0x3ac731,_0xc35439))[_0x1847('0x47')](handleError(_0x3ac731,null));};exports[_0x1847('0x5e')]=function(_0x50b840,_0x60fcff,_0x59adc2){return db[_0x1847('0x31')][_0x1847('0x4d')]({'where':{'id':_0x50b840['params']['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x60fcff,null))[_0x1847('0x27')](function(_0x5c6e38){if(_0x5c6e38){return _0x5c6e38[_0x1847('0x5e')](_0x50b840[_0x1847('0x36')][_0x1847('0x5f')]);}})[_0x1847('0x27')](respondWithStatusCode(_0x60fcff,null))[_0x1847('0x47')](handleError(_0x60fcff,null));};exports[_0x1847('0x60')]=function(_0x540ec1,_0x1306ed,_0x2e26f3){return db[_0x1847('0x31')][_0x1847('0x4d')]({'where':{'id':_0x540ec1[_0x1847('0x49')]['id']}})['then'](handleEntityNotFound(_0x1306ed,null))['then'](function(_0x1d5345){if(_0x1d5345){var _0x5a3e88=[];var _0xc84bef={'success':[],'errors':[]};return db[_0x1847('0x61')][_0x1847('0x57')]()[_0x1847('0x27')](function(_0xcf5bd6){if(_0x540ec1['body']['tags']&&_['isArray'](_0x540ec1[_0x1847('0x4f')][_0x1847('0x62')])){if(_0x540ec1['body'][_0x1847('0x62')][_0x1847('0x4b')]){_0x540ec1['body']['tags']=_0x540ec1[_0x1847('0x4f')]['tags'][_0x1847('0x63')](';')+';';}else{_0x540ec1['body'][_0x1847('0x62')]=null;}}else{_0x540ec1['body'][_0x1847('0x62')]=null;}if(_0x540ec1[_0x1847('0x4f')]&&_['isArray'](_0x540ec1[_0x1847('0x4f')])){for(var _0x30a34a=0x0;_0x30a34a<_0x540ec1[_0x1847('0x4f')][_0x1847('0x4b')];_0x30a34a+=0x1){_0x540ec1[_0x1847('0x4f')][_0x30a34a][_0x1847('0x59')]=_0x540ec1[_0x1847('0x49')]['id'];_0x5a3e88[_0x1847('0x64')](_0x540ec1['body'][_0x30a34a]);}return BPromise[_0x1847('0x65')](_0x5a3e88,function(_0x2ce41f){return db[_0x1847('0x61')][_0x1847('0x4e')](_[_0x1847('0x66')](_0x2ce41f,['ids','id'])||{},{'fields':_[_0x1847('0x37')](_0xcf5bd6),'raw':!![]})[_0x1847('0x27')](function(_0x3a31d6){_0xc84bef[_0x1847('0x67')]['push'](_0x3a31d6['dataValues']);})[_0x1847('0x47')](function(_0x51247e){_0xc84bef[_0x1847('0x68')][_0x1847('0x64')]({'data':_0x2ce41f,'error':_0x51247e['message']});});})[_0x1847('0x27')](function(_0x16f991){return _0xc84bef;})['catch'](function(_0xb0ca31){return _0xb0ca31;});}else{_0x1306ed[_0x1847('0x1d')](0x190)['json']({'message':_0x1847('0x69')});}});}})[_0x1847('0x27')](respondWithResult(_0x1306ed,null))[_0x1847('0x47')](handleError(_0x1306ed,null));};exports['getContacts']=function(_0x10feb9,_0x279a25,_0x4c7835){var _0x56af6b;return db[_0x1847('0x31')]['find']({'where':{'id':_0x10feb9[_0x1847('0x49')]['id']},'include':[{'model':db[_0x1847('0x6a')],'as':_0x1847('0x6b')}]})[_0x1847('0x27')](handleEntityNotFound(_0x279a25,null))[_0x1847('0x27')](function(_0x2ea5e2){if(_0x2ea5e2){_0x56af6b=_0x2ea5e2;return db[_0x1847('0x61')][_0x1847('0x32')];}})[_0x1847('0x27')](function(_0x1cf1ab){if(_0x1cf1ab){var _0x2732dd={};var _0xbc837a={};_0xbc837a[_0x1847('0x35')]=_['concat'](_[_0x1847('0x37')](_0x1cf1ab),_['map'](_0x56af6b[_0x1847('0x6b')],function(_0x8d1439){return util[_0x1847('0x6c')](_0x1847('0x6d'),_0x8d1439['id']);}));_0xbc837a[_0x1847('0x36')]=_[_0x1847('0x37')](_0x10feb9[_0x1847('0x36')]);_0xbc837a[_0x1847('0x38')]=_['intersection'](_0xbc837a[_0x1847('0x35')],_0xbc837a[_0x1847('0x36')]);_0x2732dd['attributes']=_[_0x1847('0x4a')](_0xbc837a[_0x1847('0x35')],qs['fields'](_0x10feb9['query'][_0x1847('0x39')]));_0x2732dd[_0x1847('0x3a')]=_0x2732dd['attributes'][_0x1847('0x4b')]?_0x2732dd[_0x1847('0x3a')]:_0xbc837a[_0x1847('0x35')];if(!_0x10feb9['query']['hasOwnProperty'](_0x1847('0x3c'))){_0x2732dd[_0x1847('0x21')]=qs[_0x1847('0x21')](_0x10feb9['query'][_0x1847('0x21')]);_0x2732dd[_0x1847('0x1f')]=qs['offset'](_0x10feb9['query'][_0x1847('0x1f')]);}_0x2732dd['order']=qs[_0x1847('0x3e')](_0x10feb9['query'][_0x1847('0x3e')]);_0x2732dd[_0x1847('0x3f')]=qs[_0x1847('0x38')](_[_0x1847('0x5d')](_0x10feb9[_0x1847('0x36')],_0xbc837a[_0x1847('0x38')]));_0x2732dd[_0x1847('0x6e')]=!![];if(_0x10feb9[_0x1847('0x36')][_0x1847('0x40')]){_0x2732dd[_0x1847('0x3f')]=_[_0x1847('0x42')](_0x2732dd[_0x1847('0x3f')],{'$or':_[_0x1847('0x30')](_0x2732dd[_0x1847('0x3a')],function(_0x4cecca){var _0x3d3804={};_0x3d3804[_0x4cecca]={'$like':'%'+_0x10feb9['query'][_0x1847('0x40')]+'%'};return _0x3d3804;})});}_0x2732dd=_[_0x1847('0x42')]({},_0x2732dd,_0x10feb9['options']);return _0x56af6b['getContacts'](_0x2732dd);}})[_0x1847('0x27')](respondWithResult(_0x279a25,null))[_0x1847('0x47')](handleError(_0x279a25,null));};exports[_0x1847('0x6f')]=function(_0x4f8c6f,_0xc3a892,_0x151677){var _0x352d8e;var _0x493147;var _0x4bd5b6;var _0x1eb715=_0x4f8c6f['params']['id'];csv_results=[];return db[_0x1847('0x70')]['findAll']({'attributes':['id',_0x1847('0x2d')],'raw':!![],'order':[_0x1847('0x71')]})[_0x1847('0x27')](function(_0x3d81a0){_0x352d8e=_0x3d81a0;var _0x181306=_[_0x1847('0x37')](db[_0x1847('0x61')]['rawAttributes']);return db['CmCustomField'][_0x1847('0x45')]({'raw':!![],'attributes':['id',_0x1847('0x72')]})['then'](function(_0x231e04){_0x493147=_0x231e04;var _0x557d2a=squel[_0x1847('0x73')]()['fields'](_0x181306)[_0x1847('0x74')](_0x1847('0x75'),'c')[_0x1847('0x3f')](_0x1847('0x76'),_0x1eb715)['where']('c.deletedAt\x20is\x20null')[_0x1847('0x77')]();for(var _0x59f5f4=0x0;_0x59f5f4<_0x493147[_0x1847('0x4b')];_0x59f5f4++){_0x557d2a['field'](_0x1847('0x78')+_0x493147[_0x59f5f4]['id'],_0x1847('0x79')+_0x493147[_0x59f5f4][_0x1847('0x72')]);}for(var _0x59f5f4=0x0;_0x59f5f4<_0x352d8e['length'];_0x59f5f4++){_0x557d2a[_0x1847('0x7a')](squel[_0x1847('0x73')]()[_0x1847('0x7a')](_0x1847('0x7b'))[_0x1847('0x74')](_0x1847('0x7c'))[_0x1847('0x3f')](_0x1847('0x7d'),_0x352d8e[_0x59f5f4]['id'])[_0x1847('0x3f')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x352d8e[_0x59f5f4][_0x1847('0x2d')]);_0x557d2a[_0x1847('0x7a')](squel['select']()[_0x1847('0x7a')]('description')['from'](_0x1847('0x7c'))['where']('ItemTypeId\x20=\x20?',_0x352d8e[_0x59f5f4]['id'])[_0x1847('0x3f')](_0x1847('0x7e')),_0x1847('0x7f')+_0x352d8e[_0x59f5f4]['name']);}var _0x48e344=[];_0x48e344[_0x1847('0x64')](_0x557d2a['toString']());BPromise[_0x1847('0x65')](_0x48e344,handleQuery)[_0x1847('0x27')](function(_0xcdc956){handleQuery(_0x557d2a[_0x1847('0x80')]());var _0x148933=csv_results[0x0];if(!_[_0x1847('0x81')](_0x148933)){var _0x683825=toCsv(_0x148933);var _0x3f0add=Date[_0x1847('0x82')]();fs[_0x1847('0x83')](util[_0x1847('0x6c')](_0x1847('0x84'),_0x1eb715,_0x3f0add),_0x683825);_0xc3a892[_0x1847('0x85')](_0x1847('0x86'),_0x1847('0x87')+util['format'](_0x1847('0x88'),_0x1eb715,_0x3f0add));_0xc3a892['setHeader']('Content-type','text/csv');return _0xc3a892[_0x1847('0x89')](util['format'](_0x1847('0x84'),_0x1eb715,_0x3f0add));}else{return _0xc3a892[_0x1847('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x56e4e9,_0x34af85,_0x46d748){var _0x4f72b4;delete _0x56e4e9[_0x1847('0x4f')]['id'];return db[_0x1847('0x31')][_0x1847('0x5c')]({'where':{'id':_0x56e4e9[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x34af85,null))[_0x1847('0x27')](function(_0x35a6bf){if(_0x35a6bf){return db['sequelize'][_0x1847('0x8a')](function(_0x25e3a8){return db['CmCustomField'][_0x1847('0x4e')](_0x56e4e9[_0x1847('0x4f')],{'transaction':_0x25e3a8})[_0x1847('0x27')](function(_0x384755){_0x4f72b4=_0x384755;return _0x35a6bf[_0x1847('0x8b')](_0x384755,{'transaction':_0x25e3a8});})[_0x1847('0x27')](function(){var _0x188084={'type':db[_0x1847('0x8c')][_0x1847('0x8d')],'transaction':_0x25e3a8};switch(_0x56e4e9[_0x1847('0x4f')][_0x1847('0x33')]){case'text':_0x188084[_0x1847('0x33')]=db['Sequelize'][_0x1847('0x8d')];break;case _0x1847('0x8e'):_0x188084[_0x1847('0x33')]=db[_0x1847('0x8c')][_0x1847('0x8f')];break;case'switch':_0x188084[_0x1847('0x33')]=db[_0x1847('0x8c')][_0x1847('0x90')];_0x188084['defaultValue']=![];break;default:}return db[_0x1847('0x91')]['queryInterface'][_0x1847('0x92')](_0x1847('0x75'),util[_0x1847('0x6c')](_0x1847('0x93'),_0x4f72b4['id']),_0x188084);})[_0x1847('0x27')](function(){return _0x4f72b4;});});}})[_0x1847('0x27')](respondWithResult(_0x34af85,null))[_0x1847('0x47')](handleError(_0x34af85,null));};exports['getCustomFields']=function(_0x592f68,_0x3ece85,_0x38d0f4){var _0xba8f92={};var _0x94d2f3={};var _0x1da4be;var _0x47b58c;return db['CmList'][_0x1847('0x5c')]({'where':{'id':_0x592f68[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x3ece85,null))[_0x1847('0x27')](function(_0x10e2ab){if(_0x10e2ab){_0x1da4be=_0x10e2ab;_0x94d2f3[_0x1847('0x35')]=_[_0x1847('0x37')](db[_0x1847('0x6a')][_0x1847('0x32')]);_0x94d2f3[_0x1847('0x36')]=_[_0x1847('0x37')](_0x592f68[_0x1847('0x36')]);_0x94d2f3['filters']=_[_0x1847('0x4a')](_0x94d2f3[_0x1847('0x35')],_0x94d2f3['query']);_0xba8f92[_0x1847('0x3a')]=_['intersection'](_0x94d2f3[_0x1847('0x35')],qs[_0x1847('0x39')](_0x592f68['query'][_0x1847('0x39')]));_0xba8f92['attributes']=_0xba8f92['attributes'][_0x1847('0x4b')]?_0xba8f92['attributes']:_0x94d2f3[_0x1847('0x35')];_0xba8f92[_0x1847('0x3d')]=qs['sort'](_0x592f68[_0x1847('0x36')][_0x1847('0x3e')]);_0xba8f92['where']=qs['filters'](_[_0x1847('0x5d')](_0x592f68[_0x1847('0x36')],_0x94d2f3[_0x1847('0x38')]));_0xba8f92[_0x1847('0x3f')]=_[_0x1847('0x42')](_0xba8f92['where'],{'$or':[{'ListId':_0x10e2ab['id']},{'ListId':null}]});if(_0x592f68[_0x1847('0x36')][_0x1847('0x40')]){_0xba8f92[_0x1847('0x3f')]=_[_0x1847('0x42')](_0xba8f92['where'],{'$or':_[_0x1847('0x30')](_0xba8f92['attributes'],function(_0x151ff9){var _0x17f42a={};_0x17f42a[_0x151ff9]={'$like':'%'+_0x592f68[_0x1847('0x36')][_0x1847('0x40')]+'%'};return _0x17f42a;})});}_0xba8f92=_[_0x1847('0x42')]({},_0xba8f92,_0x592f68[_0x1847('0x4c')]);return db[_0x1847('0x6a')][_0x1847('0x94')](_0xba8f92);}})[_0x1847('0x27')](respondWithResult(_0x3ece85,null))[_0x1847('0x47')](handleError(_0x3ece85,null));};exports['getGlobalCustomFields']=function(_0x659950,_0x13fd5b){return db[_0x1847('0x6a')][_0x1847('0x94')]({'where':{'ListId':null}})[_0x1847('0x27')](handleEntityNotFound(_0x13fd5b,null))[_0x1847('0x27')](function(_0x212540){return _0x212540;})[_0x1847('0x27')](respondWithResult(_0x13fd5b,null))[_0x1847('0x47')](handleError(_0x13fd5b,null));};exports[_0x1847('0x95')]=function(_0x2bc8ac,_0x5ef427,_0x27328b){return db[_0x1847('0x31')][_0x1847('0x4d')]({'where':{'id':_0x2bc8ac['params']['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x5ef427,null))[_0x1847('0x27')](function(_0x96444c){if(_0x96444c){return _0x96444c[_0x1847('0x95')](_0x2bc8ac['body']['ids'],_[_0x1847('0x66')](_0x2bc8ac[_0x1847('0x4f')],['ids','id'])||{})[_0x1847('0x96')](function(_0x4ba13d){for(var _0x55bccc=0x0;_0x55bccc<_0x2bc8ac[_0x1847('0x4f')][_0x1847('0x5f')][_0x1847('0x4b')];_0x55bccc+=0x1){socket[_0x1847('0x97')](_0x1847('0x98'),{'UserId':Number(_0x2bc8ac[_0x1847('0x4f')][_0x1847('0x5f')][_0x55bccc]),'CmListId':Number(_0x2bc8ac[_0x1847('0x49')]['id'])});}return _0x4ba13d;});}})[_0x1847('0x27')](respondWithResult(_0x5ef427,null))[_0x1847('0x47')](handleError(_0x5ef427,null));};exports['removeAgents']=function(_0x2edb37,_0x4fefb4,_0xa03b64){return db[_0x1847('0x31')][_0x1847('0x4d')]({'where':{'id':_0x2edb37[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x4fefb4,null))[_0x1847('0x27')](function(_0x17a5d4){if(_0x17a5d4){return _0x17a5d4[_0x1847('0x99')](_0x2edb37[_0x1847('0x36')][_0x1847('0x5f')])['then'](function(){if(_[_0x1847('0x9a')](_0x2edb37[_0x1847('0x36')][_0x1847('0x5f')])){for(var _0x3383fe=0x0;_0x3383fe<_0x2edb37[_0x1847('0x36')][_0x1847('0x5f')][_0x1847('0x4b')];_0x3383fe+=0x1){socket['emit'](_0x1847('0x9b'),{'UserId':Number(_0x2edb37[_0x1847('0x36')][_0x1847('0x5f')][_0x3383fe]),'CmListId':Number(_0x2edb37[_0x1847('0x49')]['id'])});}}else{socket[_0x1847('0x97')](_0x1847('0x9b'),{'UserId':Number(_0x2edb37[_0x1847('0x36')][_0x1847('0x5f')]),'CmListId':Number(_0x2edb37[_0x1847('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x4fefb4,null))[_0x1847('0x47')](handleError(_0x4fefb4,null));};exports[_0x1847('0x9c')]=function(_0x73f319,_0x60195d,_0x4c3ca5){var _0x5a6401={};var _0x345f25={};var _0x123780;var _0x4ffc26;return db['CmList'][_0x1847('0x5c')]({'where':{'id':_0x73f319[_0x1847('0x49')]['id']}})[_0x1847('0x27')](handleEntityNotFound(_0x60195d,null))[_0x1847('0x27')](function(_0x41197e){if(_0x41197e){_0x123780=_0x41197e;_0x345f25[_0x1847('0x35')]=_[_0x1847('0x37')](db['User']['rawAttributes']);_0x345f25[_0x1847('0x36')]=_[_0x1847('0x37')](_0x73f319['query']);_0x345f25[_0x1847('0x38')]=_[_0x1847('0x4a')](_0x345f25[_0x1847('0x35')],_0x345f25[_0x1847('0x36')]);_0x5a6401[_0x1847('0x3a')]=_[_0x1847('0x4a')](_0x345f25[_0x1847('0x35')],qs[_0x1847('0x39')](_0x73f319[_0x1847('0x36')][_0x1847('0x39')]));_0x5a6401['attributes']=_0x5a6401[_0x1847('0x3a')]['length']?_0x5a6401[_0x1847('0x3a')]:_0x345f25[_0x1847('0x35')];_0x5a6401[_0x1847('0x3d')]=qs[_0x1847('0x3e')](_0x73f319[_0x1847('0x36')][_0x1847('0x3e')]);_0x5a6401[_0x1847('0x3f')]=qs[_0x1847('0x38')](_[_0x1847('0x5d')](_0x73f319[_0x1847('0x36')],_0x345f25[_0x1847('0x38')]));if(_0x73f319['query'][_0x1847('0x40')]){_0x5a6401[_0x1847('0x3f')]=_[_0x1847('0x42')](_0x5a6401['where'],{'$or':_[_0x1847('0x30')](_0x5a6401['attributes'],function(_0x405894){var _0x4d782a={};_0x4d782a[_0x405894]={'$like':'%'+_0x73f319['query'][_0x1847('0x40')]+'%'};return _0x4d782a;})});}_0x5a6401=_[_0x1847('0x42')]({},_0x5a6401,_0x73f319[_0x1847('0x4c')]);return _0x123780['getAgents'](_0x5a6401);}})[_0x1847('0x27')](function(_0x434332){if(_0x434332){_0x4ffc26=_0x434332[_0x1847('0x4b')];if(!_0x73f319[_0x1847('0x36')]['hasOwnProperty']('nolimit')){_0x5a6401[_0x1847('0x21')]=qs[_0x1847('0x21')](_0x73f319[_0x1847('0x36')][_0x1847('0x21')]);_0x5a6401[_0x1847('0x1f')]=qs['offset'](_0x73f319[_0x1847('0x36')][_0x1847('0x1f')]);}return _0x123780[_0x1847('0x9c')](_0x5a6401);}})[_0x1847('0x27')](function(_0x26a19e){if(_0x26a19e){return _0x26a19e?{'count':_0x4ffc26,'rows':_0x26a19e}:null;}})['then'](respondWithResult(_0x60195d,null))[_0x1847('0x47')](handleError(_0x60195d,null));};function handleQuery(_0xf1e9d3){logger[_0x1847('0x9d')](_0xf1e9d3);return db[_0x1847('0x91')][_0x1847('0x36')](_0xf1e9d3)[_0x1847('0x96')](function(_0x2d7474){csv_results[_0x1847('0x64')](_0x2d7474);})[_0x1847('0x47')](function(_0x3f855a){logger[_0x1847('0x2b')](_0x3f855a[_0x1847('0x9e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6a71dda..8d04c4e 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x221637,_0x42a5e0){var _0x11bf9e=function(_0xbc416e){while(--_0xbc416e){_0x221637['push'](_0x221637['shift']());}};_0x11bf9e(++_0x42a5e0);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x23e2bb,_0xd82b6d){var _0x2dd8ed=function(_0x4af0ce){while(--_0x4af0ce){_0x23e2bb['push'](_0x23e2bb['shift']());}};_0x2dd8ed(++_0xd82b6d);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index abeda1a..a705041 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x389ae8,_0x3ee595){var _0x735d66=function(_0x4f7346){while(--_0x4f7346){_0x389ae8['push'](_0x389ae8['shift']());}};_0x735d66(++_0x3ee595);}(_0xa8a8,0xec));var _0x8a8a=function(_0x19cea4,_0x49608c){_0x19cea4=_0x19cea4-0x0;var _0x399524=_0xa8a8[_0x19cea4];return _0x399524;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x29df32,_0x47d533){var _0x3da58c=function(_0x447e73){while(--_0x447e73){_0x29df32['push'](_0x29df32['shift']());}};_0x3da58c(++_0x47d533);}(_0x702d,0x147));var _0xd702=function(_0x33e9cf,_0x997ec9){_0x33e9cf=_0x33e9cf-0x0;var _0x388ca0=_0x702d[_0x33e9cf];return _0x388ca0;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2359818..5c73ddb 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 _0x97b4=['localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x53bf84,_0x498cc3){var _0x494d59=function(_0x78d427){while(--_0x78d427){_0x53bf84['push'](_0x53bf84['shift']());}};_0x494d59(++_0x498cc3);}(_0x97b4,0xff));var _0x497b=function(_0x5e83f9,_0xc1303f){_0x5e83f9=_0x5e83f9-0x0;var _0x2a3196=_0x97b4[_0x5e83f9];return _0x2a3196;};'use strict';var _=require(_0x497b('0x0'));var util=require(_0x497b('0x1'));var moment=require(_0x497b('0x2'));var BPromise=require(_0x497b('0x3'));var rs=require(_0x497b('0x4'));var fs=require('fs');var Redis=require(_0x497b('0x5'));var db=require(_0x497b('0x6'))['db'];var utils=require(_0x497b('0x7'));var logger=require(_0x497b('0x8'))(_0x497b('0x9'));var config=require(_0x497b('0xa'));var jayson=require(_0x497b('0xb'));var client=jayson[_0x497b('0xc')]['http']({'port':0x232a});config['redis']=_[_0x497b('0xd')](config[_0x497b('0xe')],{'host':_0x497b('0xf'),'port':0x18eb});var socket=require(_0x497b('0x10'))(new Redis(config['redis']));require(_0x497b('0x11'))['register'](socket);function respondWithRpcPromise(_0x9590c5,_0x367c79,_0x166969){return new BPromise(function(_0x50a0bf,_0x5cf878){return client[_0x497b('0x12')](_0x9590c5,_0x166969)[_0x497b('0x13')](function(_0x1ff744){logger[_0x497b('0x14')](_0x497b('0x15'),_0x367c79,_0x497b('0x16'));logger[_0x497b('0x17')](_0x497b('0x18'),_0x367c79,_0x497b('0x16'),JSON['stringify'](_0x1ff744));if(_0x1ff744['error']){if(_0x1ff744['error'][_0x497b('0x19')]===0x1f4){logger['error'](_0x497b('0x15'),_0x367c79,_0x1ff744[_0x497b('0x1a')]['message']);return _0x5cf878(_0x1ff744[_0x497b('0x1a')][_0x497b('0x1b')]);}logger['error'](_0x497b('0x15'),_0x367c79,_0x1ff744['error'][_0x497b('0x1b')]);return _0x50a0bf(_0x1ff744[_0x497b('0x1a')][_0x497b('0x1b')]);}else{logger[_0x497b('0x14')](_0x497b('0x15'),_0x367c79,_0x497b('0x16'));_0x50a0bf(_0x1ff744[_0x497b('0x1c')]['message']);}})[_0x497b('0x1d')](function(_0x11247e){logger[_0x497b('0x1a')](_0x497b('0x15'),_0x367c79,_0x11247e);_0x5cf878(_0x11247e);});});} \ No newline at end of file +var _0x76e9=['stringify','error','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x52c932,_0x4f8bc2){var _0x8ac4bf=function(_0x55b334){while(--_0x55b334){_0x52c932['push'](_0x52c932['shift']());}};_0x8ac4bf(++_0x4f8bc2);}(_0x76e9,0x7d));var _0x976e=function(_0x740cbf,_0x1bf6f6){_0x740cbf=_0x740cbf-0x0;var _0x2ec36e=_0x76e9[_0x740cbf];return _0x2ec36e;};'use strict';var _=require(_0x976e('0x0'));var util=require('util');var moment=require(_0x976e('0x1'));var BPromise=require(_0x976e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x976e('0x3'));var db=require(_0x976e('0x4'))['db'];var utils=require(_0x976e('0x5'));var logger=require('../../config/logger')(_0x976e('0x6'));var config=require(_0x976e('0x7'));var jayson=require(_0x976e('0x8'));var client=jayson[_0x976e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x976e('0xa')](config[_0x976e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x976e('0xb')]));require(_0x976e('0xc'))['register'](socket);function respondWithRpcPromise(_0x2a2166,_0x4054f6,_0x594c32){return new BPromise(function(_0x129353,_0x2fdfc9){return client[_0x976e('0xd')](_0x2a2166,_0x594c32)[_0x976e('0xe')](function(_0x26ed83){logger['info'](_0x976e('0xf'),_0x4054f6,_0x976e('0x10'));logger[_0x976e('0x11')](_0x976e('0x12'),_0x4054f6,_0x976e('0x10'),JSON[_0x976e('0x13')](_0x26ed83));if(_0x26ed83[_0x976e('0x14')]){if(_0x26ed83['error']['code']===0x1f4){logger['error'](_0x976e('0xf'),_0x4054f6,_0x26ed83[_0x976e('0x14')][_0x976e('0x15')]);return _0x2fdfc9(_0x26ed83[_0x976e('0x14')][_0x976e('0x15')]);}logger[_0x976e('0x14')]('CmList,\x20%s,\x20%s',_0x4054f6,_0x26ed83[_0x976e('0x14')]['message']);return _0x129353(_0x26ed83[_0x976e('0x14')][_0x976e('0x15')]);}else{logger[_0x976e('0x16')](_0x976e('0xf'),_0x4054f6,'request\x20sent');_0x129353(_0x26ed83['result'][_0x976e('0x15')]);}})[_0x976e('0x17')](function(_0x135ed0){logger['error']('CmList,\x20%s,\x20%s',_0x4054f6,_0x135ed0);_0x2fdfc9(_0x135ed0);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4290945..1fb4d2a 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 _0x5e03=['length','cmList:','save','remove','update','emit','register'];(function(_0x23aaf4,_0x3e539e){var _0x4016a2=function(_0x21f164){while(--_0x21f164){_0x23aaf4['push'](_0x23aaf4['shift']());}};_0x4016a2(++_0x3e539e);}(_0x5e03,0xbf));var _0x35e0=function(_0x51d526,_0x2e2798){_0x51d526=_0x51d526-0x0;var _0xdb88a8=_0x5e03[_0x51d526];return _0xdb88a8;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x35e0('0x0'),_0x35e0('0x1'),_0x35e0('0x2')];function createListener(_0x3f703e,_0x1d1d4f){return function(_0x1f5e10){_0x1d1d4f[_0x35e0('0x3')](_0x3f703e,_0x1f5e10);};}function removeListener(_0x22be9e,_0x453087){return function(){CmListEvents['removeListener'](_0x22be9e,_0x453087);};}exports[_0x35e0('0x4')]=function(_0xb658c1){for(var _0x253125=0x0,_0xfc0608=events[_0x35e0('0x5')];_0x253125<_0xfc0608;_0x253125++){var _0x3b85d0=events[_0x253125];var _0xe1c4d7=createListener(_0x35e0('0x6')+_0x3b85d0,_0xb658c1);CmListEvents['on'](_0x3b85d0,_0xe1c4d7);}}; \ No newline at end of file +var _0x92e7=['remove','removeListener','length','cmList:','save'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x92e7,0x171));var _0x792e=function(_0x44c5cd,_0x57307b){_0x44c5cd=_0x44c5cd-0x0;var _0x1bc102=_0x92e7[_0x44c5cd];return _0x1bc102;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x792e('0x0'),_0x792e('0x1'),'update'];function createListener(_0x5b00df,_0x466cad){return function(_0x363cdd){_0x466cad['emit'](_0x5b00df,_0x363cdd);};}function removeListener(_0x4e1088,_0x276cc5){return function(){CmListEvents[_0x792e('0x2')](_0x4e1088,_0x276cc5);};}exports['register']=function(_0x2e081b){for(var _0xbda4a8=0x0,_0x5e9618=events[_0x792e('0x3')];_0xbda4a8<_0x5e9618;_0xbda4a8++){var _0x1d6c37=events[_0xbda4a8];var _0x6ac29c=createListener(_0x792e('0x4')+_0x1d6c37,_0x2e081b);CmListEvents['on'](_0x1d6c37,_0x6ac29c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 88672a5..12b2bdd 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 _0xad9c=['./cmList.controller','index','get','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','put','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0xad9c,0x143));var _0xcad9=function(_0x15a669,_0x339060){_0x15a669=_0x15a669-0x0;var _0x4b641e=_0xad9c[_0x15a669];return _0x4b641e;};'use strict';var multer=require(_0xcad9('0x0'));var util=require(_0xcad9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcad9('0x2'));var router=express['Router']();var fs_extra=require(_0xcad9('0x3'));var auth=require(_0xcad9('0x4'));var interaction=require(_0xcad9('0x5'));var config=require(_0xcad9('0x6'));var controller=require(_0xcad9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcad9('0x8')]);router[_0xcad9('0x9')](_0xcad9('0xa'),auth[_0xcad9('0xb')](),controller[_0xcad9('0xc')]);router[_0xcad9('0x9')](_0xcad9('0xd'),auth[_0xcad9('0xb')](),controller[_0xcad9('0xe')]);router[_0xcad9('0x9')](_0xcad9('0xf'),auth[_0xcad9('0xb')](),controller['show']);router[_0xcad9('0x9')](_0xcad9('0x10'),auth[_0xcad9('0xb')](),controller[_0xcad9('0x11')]);router['get'](_0xcad9('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0xcad9('0x9')](_0xcad9('0x13'),auth[_0xcad9('0xb')](),controller[_0xcad9('0x14')]);router[_0xcad9('0x9')](_0xcad9('0x15'),auth['isAuthenticated'](),controller[_0xcad9('0x16')]);router[_0xcad9('0x9')](_0xcad9('0x17'),auth['isAuthenticated'](),controller[_0xcad9('0x18')]);router[_0xcad9('0x19')]('/',auth[_0xcad9('0xb')](),controller[_0xcad9('0x1a')]);router['post'](_0xcad9('0x10'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xcad9('0x19')](_0xcad9('0x12'),auth['isAuthenticated'](),controller[_0xcad9('0x1b')]);router[_0xcad9('0x19')](_0xcad9('0x15'),auth['isAuthenticated'](),controller[_0xcad9('0x1c')]);router[_0xcad9('0x19')](_0xcad9('0x17'),auth[_0xcad9('0xb')](),controller['addAgents']);router[_0xcad9('0x1d')](_0xcad9('0xf'),auth[_0xcad9('0xb')](),controller[_0xcad9('0x1e')]);router[_0xcad9('0x1f')]('/:id',auth[_0xcad9('0xb')](),controller['destroy']);router[_0xcad9('0x1f')](_0xcad9('0x10'),auth[_0xcad9('0xb')](),controller['removeDispositions']);router[_0xcad9('0x1f')](_0xcad9('0x17'),auth[_0xcad9('0xb')](),controller['removeAgents']);module[_0xcad9('0x20')]=router; \ No newline at end of file +var _0x2c35=['get','isAuthenticated','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','post','create','addDisposition','addContacts','addCustomField','addAgents','update','destroy','delete','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x2c35,0xe5));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x52c3('0x0'));var util=require(_0x52c3('0x1'));var path=require(_0x52c3('0x2'));var timeout=require(_0x52c3('0x3'));var express=require('express');var router=express[_0x52c3('0x4')]();var fs_extra=require(_0x52c3('0x5'));var auth=require(_0x52c3('0x6'));var interaction=require(_0x52c3('0x7'));var config=require(_0x52c3('0x8'));var controller=require('./cmList.controller');router[_0x52c3('0x9')]('/',auth[_0x52c3('0xa')](),controller['index']);router[_0x52c3('0x9')](_0x52c3('0xb'),auth[_0x52c3('0xa')](),controller['describe']);router['get'](_0x52c3('0xc'),auth[_0x52c3('0xa')](),controller[_0x52c3('0xd')]);router[_0x52c3('0x9')](_0x52c3('0xe'),auth[_0x52c3('0xa')](),controller[_0x52c3('0xf')]);router[_0x52c3('0x9')](_0x52c3('0x10'),auth[_0x52c3('0xa')](),controller[_0x52c3('0x11')]);router[_0x52c3('0x9')](_0x52c3('0x12'),auth[_0x52c3('0xa')](),controller[_0x52c3('0x13')]);router['get'](_0x52c3('0x14'),auth['isAuthenticated'](),controller[_0x52c3('0x15')]);router['get']('/:id/fields',auth[_0x52c3('0xa')](),controller['getCustomFields']);router[_0x52c3('0x9')](_0x52c3('0x16'),auth[_0x52c3('0xa')](),controller['getAgents']);router[_0x52c3('0x17')]('/',auth[_0x52c3('0xa')](),controller[_0x52c3('0x18')]);router[_0x52c3('0x17')]('/:id/dispositions',auth[_0x52c3('0xa')](),controller[_0x52c3('0x19')]);router[_0x52c3('0x17')](_0x52c3('0x12'),auth[_0x52c3('0xa')](),controller[_0x52c3('0x1a')]);router[_0x52c3('0x17')]('/:id/fields',auth[_0x52c3('0xa')](),controller[_0x52c3('0x1b')]);router[_0x52c3('0x17')](_0x52c3('0x16'),auth['isAuthenticated'](),controller[_0x52c3('0x1c')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x52c3('0x1d')]);router['delete'](_0x52c3('0xe'),auth['isAuthenticated'](),controller[_0x52c3('0x1e')]);router[_0x52c3('0x1f')](_0x52c3('0x10'),auth[_0x52c3('0xa')](),controller[_0x52c3('0x20')]);router['delete'](_0x52c3('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x52c3('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e431a13..0638206 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 _0x4ed7=['sequelize','exports','getDataValue','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4ed7,0x110));var _0x74ed=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0x4ed7[_0x1c0f3d];return _0x4d71a8;};'use strict';var Sequelize=require(_0x74ed('0x0'));module[_0x74ed('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x8458d5){return this[_0x74ed('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x74ed('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x74ed('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5d2e=['VIRTUAL','STRING','exports'];(function(_0x51f1d1,_0x3ca3a8){var _0x1b4451=function(_0x1243db){while(--_0x1243db){_0x51f1d1['push'](_0x51f1d1['shift']());}};_0x1b4451(++_0x3ca3a8);}(_0x5d2e,0x1c1));var _0xe5d2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5d2e[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0xe5d2('0x0')]={'name':{'type':Sequelize[_0xe5d2('0x1')],'get':function(_0x1545fa){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xe5d2('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0xe5d2('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe5d2('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 6ad482f..28cc252 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x38905d,_0x422206){var _0x462ecd=function(_0xdd2cc0){while(--_0xdd2cc0){_0x38905d['push'](_0x38905d['shift']());}};_0x462ecd(++_0x422206);}(_0x7a54,0x106));var _0x47a5=function(_0x236860,_0x563225){_0x236860=_0x236860-0x0;var _0x18425b=_0x7a54[_0x236860];return _0x18425b;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x404476,_0x7cc9f1){var _0x241d22=function(_0x416454){while(--_0x416454){_0x404476['push'](_0x404476['shift']());}};_0x241d22(++_0x7cc9f1);}(_0x7a54,0x106));var _0x47a5=function(_0x4dc75b,_0x39e176){_0x4dc75b=_0x4dc75b-0x0;var _0x2a6e59=_0x7a54[_0x4dc75b];return _0x2a6e59;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 3531d9f..9aaedee 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 _0xd72d=['exports','Condition','tools_conditions','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0xd72d,0xa3));var _0xdd72=function(_0x5c5877,_0xa2ca2b){_0x5c5877=_0x5c5877-0x0;var _0x2c8ddd=_0xd72d[_0x5c5877];return _0x2c8ddd;};'use strict';var _=require('lodash');var util=require(_0xdd72('0x0'));var logger=require(_0xdd72('0x1'))(_0xdd72('0x2'));var moment=require('moment');var BPromise=require(_0xdd72('0x3'));var rp=require(_0xdd72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd72('0x5'));var config=require(_0xdd72('0x6'));var attributes=require('./condition.attributes');module[_0xdd72('0x7')]=function(_0x2361ac,_0xc34b37){return _0x2361ac['define'](_0xdd72('0x8'),attributes,{'tableName':_0xdd72('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x241b=['tools_conditions','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Condition'];(function(_0x561f69,_0x1a6fd1){var _0x564eca=function(_0x4e37b1){while(--_0x4e37b1){_0x561f69['push'](_0x561f69['shift']());}};_0x564eca(++_0x1a6fd1);}(_0x241b,0xa9));var _0xb241=function(_0x56687c,_0x14140d){_0x56687c=_0x56687c-0x0;var _0x211f57=_0x241b[_0x56687c];return _0x211f57;};'use strict';var _=require('lodash');var util=require(_0xb241('0x0'));var logger=require('../../config/logger')(_0xb241('0x1'));var moment=require(_0xb241('0x2'));var BPromise=require(_0xb241('0x3'));var rp=require(_0xb241('0x4'));var fs=require('fs');var path=require(_0xb241('0x5'));var rimraf=require(_0xb241('0x6'));var config=require(_0xb241('0x7'));var attributes=require('./condition.attributes');module[_0xb241('0x8')]=function(_0x552576,_0x528495){return _0x552576[_0xb241('0x9')](_0xb241('0xa'),attributes,{'tableName':_0xb241('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index f8c1cde..b52cef6 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 _0x9cd2=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x531a04,_0x2fcc65){var _0x8ed848=function(_0x1228d8){while(--_0x1228d8){_0x531a04['push'](_0x531a04['shift']());}};_0x8ed848(++_0x2fcc65);}(_0x9cd2,0xc1));var _0x29cd=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9cd2[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x29cd('0x0'));var util=require(_0x29cd('0x1'));var moment=require(_0x29cd('0x2'));var BPromise=require('bluebird');var rs=require(_0x29cd('0x3'));var fs=require('fs');var Redis=require(_0x29cd('0x4'));var db=require(_0x29cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x29cd('0x6'))(_0x29cd('0x7'));var config=require(_0x29cd('0x8'));var jayson=require(_0x29cd('0x9'));var client=jayson['client'][_0x29cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9bef25,_0x34fb37,_0x5867b5){return new BPromise(function(_0x2d7344,_0x15a1b2){return client[_0x29cd('0xb')](_0x9bef25,_0x5867b5)[_0x29cd('0xc')](function(_0x15cef0){logger[_0x29cd('0xd')](_0x29cd('0xe'),_0x34fb37,'request\x20sent');logger[_0x29cd('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x34fb37,'request\x20sent',JSON[_0x29cd('0x10')](_0x15cef0));if(_0x15cef0[_0x29cd('0x11')]){if(_0x15cef0['error'][_0x29cd('0x12')]===0x1f4){logger['error'](_0x29cd('0xe'),_0x34fb37,_0x15cef0['error'][_0x29cd('0x13')]);return _0x15a1b2(_0x15cef0[_0x29cd('0x11')]['message']);}logger[_0x29cd('0x11')](_0x29cd('0xe'),_0x34fb37,_0x15cef0[_0x29cd('0x11')]['message']);return _0x2d7344(_0x15cef0[_0x29cd('0x11')]['message']);}else{logger[_0x29cd('0xd')](_0x29cd('0xe'),_0x34fb37,_0x29cd('0x14'));_0x2d7344(_0x15cef0['result']['message']);}})[_0x29cd('0x15')](function(_0x251690){logger[_0x29cd('0x11')](_0x29cd('0xe'),_0x34fb37,_0x251690);_0x15a1b2(_0x251690);});});} \ No newline at end of file +var _0x2090=['client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3fa9aa,_0x4beb5c){var _0x2ecd69=function(_0x210124){while(--_0x210124){_0x3fa9aa['push'](_0x3fa9aa['shift']());}};_0x2ecd69(++_0x4beb5c);}(_0x2090,0x160));var _0x0209=function(_0x10b013,_0x2aeb74){_0x10b013=_0x10b013-0x0;var _0x11f27a=_0x2090[_0x10b013];return _0x11f27a;};'use strict';var _=require('lodash');var util=require(_0x0209('0x0'));var moment=require(_0x0209('0x1'));var BPromise=require(_0x0209('0x2'));var rs=require(_0x0209('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0209('0x4'));var logger=require(_0x0209('0x5'))(_0x0209('0x6'));var config=require('../../config/environment');var jayson=require(_0x0209('0x7'));var client=jayson[_0x0209('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554178,_0x32a000,_0x17e57e){return new BPromise(function(_0x20dc31,_0x140e08){return client[_0x0209('0x9')](_0x554178,_0x17e57e)[_0x0209('0xa')](function(_0x37632a){logger[_0x0209('0xb')](_0x0209('0xc'),_0x32a000,_0x0209('0xd'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x32a000,_0x0209('0xd'),JSON[_0x0209('0xe')](_0x37632a));if(_0x37632a[_0x0209('0xf')]){if(_0x37632a[_0x0209('0xf')][_0x0209('0x10')]===0x1f4){logger[_0x0209('0xf')](_0x0209('0xc'),_0x32a000,_0x37632a['error']['message']);return _0x140e08(_0x37632a[_0x0209('0xf')][_0x0209('0x11')]);}logger['error'](_0x0209('0xc'),_0x32a000,_0x37632a[_0x0209('0xf')]['message']);return _0x20dc31(_0x37632a[_0x0209('0xf')][_0x0209('0x11')]);}else{logger['info'](_0x0209('0xc'),_0x32a000,_0x0209('0xd'));_0x20dc31(_0x37632a[_0x0209('0x12')][_0x0209('0x11')]);}})[_0x0209('0x13')](function(_0x5c27af){logger[_0x0209('0xf')](_0x0209('0xc'),_0x32a000,_0x5c27af);_0x140e08(_0x5c27af);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 07522c5..8dd06dc 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 _0xacdd=['/:id','update','delete','isAuthenticated','multer','util','path','express','Router','fs-extra','../../components/auth/service','./condition.controller','put'];(function(_0x377d12,_0x37769b){var _0x84eda9=function(_0x5637a1){while(--_0x5637a1){_0x377d12['push'](_0x377d12['shift']());}};_0x84eda9(++_0x37769b);}(_0xacdd,0x12f));var _0xdacd=function(_0x218fdc,_0x3b552b){_0x218fdc=_0x218fdc-0x0;var _0x54f74e=_0xacdd[_0x218fdc];return _0x54f74e;};'use strict';var multer=require(_0xdacd('0x0'));var util=require(_0xdacd('0x1'));var path=require(_0xdacd('0x2'));var timeout=require('connect-timeout');var express=require(_0xdacd('0x3'));var router=express[_0xdacd('0x4')]();var fs_extra=require(_0xdacd('0x5'));var auth=require(_0xdacd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdacd('0x7'));router[_0xdacd('0x8')](_0xdacd('0x9'),auth['isAuthenticated'](),controller[_0xdacd('0xa')]);router[_0xdacd('0xb')](_0xdacd('0x9'),auth[_0xdacd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x07a2=['../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x221ae8,_0x4f24a7){var _0x7482e8=function(_0x98ad70){while(--_0x98ad70){_0x221ae8['push'](_0x221ae8['shift']());}};_0x7482e8(++_0x4f24a7);}(_0x07a2,0x1ea));var _0x207a=function(_0x5e5f5a,_0x5cb19a){_0x5e5f5a=_0x5e5f5a-0x0;var _0x4141ae=_0x07a2[_0x5e5f5a];return _0x4141ae;};'use strict';var multer=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var path=require(_0x207a('0x2'));var timeout=require('connect-timeout');var express=require(_0x207a('0x3'));var router=express['Router']();var fs_extra=require(_0x207a('0x4'));var auth=require(_0x207a('0x5'));var interaction=require(_0x207a('0x6'));var config=require(_0x207a('0x7'));var controller=require('./condition.controller');router[_0x207a('0x8')](_0x207a('0x9'),auth[_0x207a('0xa')](),controller[_0x207a('0xb')]);router[_0x207a('0xc')](_0x207a('0x9'),auth[_0x207a('0xa')](),controller[_0x207a('0xd')]);module[_0x207a('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index ae5fff4..fb7d735 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe768=['name','sequelize','exports','STRING'];(function(_0x1e9df7,_0x4e669a){var _0x269372=function(_0x18aba9){while(--_0x18aba9){_0x1e9df7['push'](_0x1e9df7['shift']());}};_0x269372(++_0x4e669a);}(_0xe768,0x7d));var _0x8e76=function(_0x4aa7d3,_0x5fe2c8){_0x4aa7d3=_0x4aa7d3-0x0;var _0x13988f=_0xe768[_0x4aa7d3];return _0x13988f;};'use strict';var Sequelize=require(_0x8e76('0x0'));module[_0x8e76('0x1')]={'name':{'type':Sequelize[_0x8e76('0x2')],'allowNull':![],'unique':_0x8e76('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8e76('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3cc0=['sequelize','STRING','name'];(function(_0x1546ce,_0xf08c9b){var _0x5b09ca=function(_0x4fee5c){while(--_0x4fee5c){_0x1546ce['push'](_0x1546ce['shift']());}};_0x5b09ca(++_0xf08c9b);}(_0x3cc0,0xe1));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x03cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x03cc('0x1')],'allowNull':![],'unique':_0x03cc('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x03cc('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8353002..3742302 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2272=['then','destroy','ContactItemTypes','UserProfileResource','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','ContactItemType','find','create','body','role','user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];function respondWithStatusCode(_0x2e19fb,_0x125c3b){_0x125c3b=_0x125c3b||0xcc;return function(_0x18a2c0){if(_0x18a2c0){return _0x2e19fb['sendStatus'](_0x125c3b);}return _0x2e19fb['status'](_0x125c3b)['end']();};}function respondWithResult(_0x136f6b,_0x571dd1){_0x571dd1=_0x571dd1||0xc8;return function(_0x42f60b){if(_0x42f60b){return _0x136f6b[_0x2227('0x1a')](_0x571dd1)['json'](_0x42f60b);}};}function respondWithFilteredResult(_0x3da09c,_0x4fa23d){return function(_0x1df1ef){if(_0x1df1ef){var _0x43e174=typeof _0x4fa23d[_0x2227('0x1b')]===_0x2227('0x1c')&&typeof _0x4fa23d['limit']===_0x2227('0x1c');var _0x1cf016=_0x1df1ef[_0x2227('0x1d')];var _0x531f75=_0x43e174?0x0:_0x4fa23d[_0x2227('0x1b')];var _0x620012=_0x43e174?_0x1df1ef[_0x2227('0x1d')]:_0x4fa23d[_0x2227('0x1b')]+_0x4fa23d[_0x2227('0x1e')];var _0x28e642;if(_0x620012>=_0x1cf016){_0x620012=_0x1cf016;_0x28e642=0xc8;}else{_0x28e642=0xce;}_0x3da09c[_0x2227('0x1a')](_0x28e642);return _0x3da09c['set'](_0x2227('0x1f'),_0x531f75+'-'+_0x620012+'/'+_0x1cf016)['json'](_0x1df1ef);}return null;};}function patchUpdates(_0x2b26b7){return function(_0x3aed68){try{jsonpatch[_0x2227('0x20')](_0x3aed68,_0x2b26b7,!![]);}catch(_0x1f28ef){return BPromise[_0x2227('0x21')](_0x1f28ef);}return _0x3aed68[_0x2227('0x22')]();};}function saveUpdates(_0x19ab59,_0x10d9ca){return function(_0x3299fd){if(_0x3299fd){return _0x3299fd[_0x2227('0x23')](_0x19ab59)[_0x2227('0x24')](function(_0x5a454f){return _0x5a454f;});}return null;};}function removeEntity(_0x45def5,_0x42d500){return function(_0x5b3a09){if(_0x5b3a09){return _0x5b3a09[_0x2227('0x25')]()[_0x2227('0x24')](function(){var _0x5ea1c3=_0x5b3a09['get']({'plain':!![]});var _0x17c7a4=_0x2227('0x26');return db[_0x2227('0x27')][_0x2227('0x25')]({'where':{'type':_0x17c7a4,'resourceId':_0x5ea1c3['id']}})['then'](function(){return _0x5b3a09;});})[_0x2227('0x24')](function(){_0x45def5[_0x2227('0x1a')](0xcc)[_0x2227('0x28')]();});}};}function handleEntityNotFound(_0x1957ee,_0x5d852f){return function(_0x204def){if(!_0x204def){_0x1957ee[_0x2227('0x29')](0x194);}return _0x204def;};}function handleError(_0xedd3d9,_0x20bd12){_0x20bd12=_0x20bd12||0x1f4;return function(_0x1627d3){logger['error'](_0x1627d3['stack']);if(_0x1627d3['name']){delete _0x1627d3[_0x2227('0x2a')];}_0xedd3d9['status'](_0x20bd12)[_0x2227('0x2b')](_0x1627d3);};}exports[_0x2227('0x2c')]=function(_0x58609e,_0x5916d4){var _0x1f1ba7={},_0x1818ba={},_0x21838a={'count':0x0,'rows':[]};var _0x4cc1e1=_[_0x2227('0x2d')](db['ContactItemType'][_0x2227('0x2e')],function(_0x3f108b){return{'name':_0x3f108b[_0x2227('0x2f')],'type':_0x3f108b[_0x2227('0x30')][_0x2227('0x31')]};});_0x1818ba[_0x2227('0x32')]=_[_0x2227('0x2d')](_0x4cc1e1,_0x2227('0x2a'));_0x1818ba[_0x2227('0x33')]=_[_0x2227('0x34')](_0x58609e[_0x2227('0x33')]);_0x1818ba['filters']=_[_0x2227('0x35')](_0x1818ba[_0x2227('0x32')],_0x1818ba[_0x2227('0x33')]);_0x1f1ba7[_0x2227('0x36')]=_['intersection'](_0x1818ba[_0x2227('0x32')],qs[_0x2227('0x37')](_0x58609e[_0x2227('0x33')][_0x2227('0x37')]));_0x1f1ba7['attributes']=_0x1f1ba7[_0x2227('0x36')][_0x2227('0x38')]?_0x1f1ba7[_0x2227('0x36')]:_0x1818ba['model'];if(!_0x58609e['query'][_0x2227('0x39')](_0x2227('0x3a'))){_0x1f1ba7['limit']=qs[_0x2227('0x1e')](_0x58609e[_0x2227('0x33')]['limit']);_0x1f1ba7[_0x2227('0x1b')]=qs['offset'](_0x58609e[_0x2227('0x33')][_0x2227('0x1b')]);}_0x1f1ba7[_0x2227('0x3b')]=qs[_0x2227('0x3c')](_0x58609e['query'][_0x2227('0x3c')]);_0x1f1ba7['where']=qs[_0x2227('0x3d')](_[_0x2227('0x3e')](_0x58609e[_0x2227('0x33')],_0x1818ba['filters']),_0x4cc1e1);if(_0x58609e[_0x2227('0x33')][_0x2227('0x3f')]){_0x1f1ba7[_0x2227('0x40')]=_[_0x2227('0x41')](_0x1f1ba7[_0x2227('0x40')],{'$or':_['map'](_0x4cc1e1,function(_0x4d9b1d){if(_0x4d9b1d[_0x2227('0x30')]!=='VIRTUAL'){var _0x17137d={};_0x17137d[_0x4d9b1d[_0x2227('0x2a')]]={'$like':'%'+_0x58609e[_0x2227('0x33')][_0x2227('0x3f')]+'%'};return _0x17137d;}})});}_0x1f1ba7=_[_0x2227('0x41')]({},_0x1f1ba7,_0x58609e[_0x2227('0x42')]);var _0x351a6f={'where':_0x1f1ba7[_0x2227('0x40')]};return db['ContactItemType'][_0x2227('0x1d')](_0x351a6f)['then'](function(_0x3c67c6){_0x21838a['count']=_0x3c67c6;if(_0x58609e[_0x2227('0x33')]['includeAll']){_0x1f1ba7[_0x2227('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0x2227('0x44')](_0x1f1ba7);})[_0x2227('0x24')](function(_0x46eb0f){_0x21838a[_0x2227('0x45')]=_0x46eb0f;return _0x21838a;})[_0x2227('0x24')](respondWithFilteredResult(_0x5916d4,_0x1f1ba7))[_0x2227('0x46')](handleError(_0x5916d4,null));};exports['show']=function(_0x5d58a1,_0x42d40d){var _0x4c7458={'raw':!![],'where':{'id':_0x5d58a1['params']['id']}},_0x3552db={};_0x3552db[_0x2227('0x32')]=_[_0x2227('0x34')](db[_0x2227('0x47')][_0x2227('0x2e')]);_0x3552db[_0x2227('0x33')]=_[_0x2227('0x34')](_0x5d58a1['query']);_0x3552db[_0x2227('0x3d')]=_[_0x2227('0x35')](_0x3552db[_0x2227('0x32')],_0x3552db[_0x2227('0x33')]);_0x4c7458[_0x2227('0x36')]=_[_0x2227('0x35')](_0x3552db[_0x2227('0x32')],qs[_0x2227('0x37')](_0x5d58a1['query'][_0x2227('0x37')]));_0x4c7458[_0x2227('0x36')]=_0x4c7458[_0x2227('0x36')][_0x2227('0x38')]?_0x4c7458['attributes']:_0x3552db[_0x2227('0x32')];if(_0x5d58a1[_0x2227('0x33')]['includeAll']){_0x4c7458[_0x2227('0x43')]=[{'all':!![]}];}_0x4c7458=_[_0x2227('0x41')]({},_0x4c7458,_0x5d58a1[_0x2227('0x42')]);return db[_0x2227('0x47')][_0x2227('0x48')](_0x4c7458)[_0x2227('0x24')](handleEntityNotFound(_0x42d40d,null))[_0x2227('0x24')](respondWithResult(_0x42d40d,null))['catch'](handleError(_0x42d40d,null));};exports[_0x2227('0x49')]=function(_0x3155dd,_0x482bf9){return db[_0x2227('0x47')]['create'](_0x3155dd[_0x2227('0x4a')],{})[_0x2227('0x24')](function(_0x31a544){var _0x2e4b92=_0x3155dd['user']['get']({'plain':!![]});if(!_0x2e4b92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e4b92[_0x2227('0x4b')]===_0x2227('0x4c')){var _0x5b0e5b=_0x31a544[_0x2227('0x4d')]({'plain':!![]});var _0x3e5e7b=_0x2227('0x26');return db[_0x2227('0x4e')]['find']({'where':{'name':_0x3e5e7b,'userProfileId':_0x2e4b92['userProfileId']},'raw':!![]})[_0x2227('0x24')](function(_0x1f1f1f){if(_0x1f1f1f&&_0x1f1f1f[_0x2227('0x4f')]===0x0){return db[_0x2227('0x27')]['create']({'name':_0x5b0e5b[_0x2227('0x2a')],'resourceId':_0x5b0e5b['id'],'type':_0x1f1f1f[_0x2227('0x2a')],'sectionId':_0x1f1f1f['id']},{})[_0x2227('0x24')](function(){return _0x31a544;});}else{return _0x31a544;}})[_0x2227('0x46')](function(_0x125fa8){logger[_0x2227('0x50')](_0x2227('0x51'),_0x125fa8);throw _0x125fa8;});}return _0x31a544;})[_0x2227('0x24')](respondWithResult(_0x482bf9,0xc9))[_0x2227('0x46')](handleError(_0x482bf9,null));};exports[_0x2227('0x23')]=function(_0x443dc2,_0x8c8857){if(_0x443dc2[_0x2227('0x4a')]['id']){delete _0x443dc2[_0x2227('0x4a')]['id'];}return db[_0x2227('0x47')][_0x2227('0x48')]({'where':{'id':_0x443dc2['params']['id']}})[_0x2227('0x24')](handleEntityNotFound(_0x8c8857,null))[_0x2227('0x24')](saveUpdates(_0x443dc2['body'],null))[_0x2227('0x24')](respondWithResult(_0x8c8857,null))[_0x2227('0x46')](handleError(_0x8c8857,null));};exports[_0x2227('0x25')]=function(_0x4e8622,_0x523b75){return db['ContactItemType'][_0x2227('0x48')]({'where':{'id':_0x4e8622[_0x2227('0x52')]['id']}})['then'](handleEntityNotFound(_0x523b75,null))[_0x2227('0x24')](db[_0x2227('0x53')][_0x2227('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4e8622['params']['id']}}))[_0x2227('0x24')](removeEntity(_0x523b75,null))[_0x2227('0x46')](handleError(_0x523b75,null));}; \ No newline at end of file +var _0xfef3=['catch','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0xfef3,0x118));var _0x3fef=function(_0x330e03,_0x2f8432){_0x330e03=_0x330e03-0x0;var _0x5884b5=_0xfef3[_0x330e03];return _0x5884b5;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){var _0x4d462c=_0x3ba38d['get']({'plain':!![]});var _0x45464b=_0x3fef('0x28');return db[_0x3fef('0x29')][_0x3fef('0x27')]({'where':{'type':_0x45464b,'resourceId':_0x4d462c['id']}})[_0x3fef('0x2a')](function(){return _0x3ba38d;});})['then'](function(){_0x50025f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x121ff0,_0x3baa52){return function(_0x4ea2ab){if(!_0x4ea2ab){_0x121ff0[_0x3fef('0x19')](0x194);}return _0x4ea2ab;};}function handleError(_0x6d08cd,_0x4e08d8){_0x4e08d8=_0x4e08d8||0x1f4;return function(_0x30a954){logger[_0x3fef('0x2b')](_0x30a954[_0x3fef('0x2c')]);if(_0x30a954[_0x3fef('0x2d')]){delete _0x30a954[_0x3fef('0x2d')];}_0x6d08cd[_0x3fef('0x20')](_0x4e08d8)[_0x3fef('0x2e')](_0x30a954);};}exports['index']=function(_0x34576a,_0xc20ce5){var _0x21aad4={},_0x11bd40={},_0x5dbbc0={'count':0x0,'rows':[]};var _0xcd635d=_['map'](db[_0x3fef('0x2f')][_0x3fef('0x30')],function(_0x16009a){return{'name':_0x16009a[_0x3fef('0x31')],'type':_0x16009a[_0x3fef('0x32')][_0x3fef('0x33')]};});_0x11bd40[_0x3fef('0x34')]=_[_0x3fef('0x35')](_0xcd635d,_0x3fef('0x2d'));_0x11bd40[_0x3fef('0x36')]=_['keys'](_0x34576a['query']);_0x11bd40[_0x3fef('0x37')]=_['intersection'](_0x11bd40[_0x3fef('0x34')],_0x11bd40[_0x3fef('0x36')]);_0x21aad4[_0x3fef('0x38')]=_[_0x3fef('0x39')](_0x11bd40[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x34576a[_0x3fef('0x36')][_0x3fef('0x3a')]));_0x21aad4[_0x3fef('0x38')]=_0x21aad4[_0x3fef('0x38')][_0x3fef('0x3b')]?_0x21aad4[_0x3fef('0x38')]:_0x11bd40[_0x3fef('0x34')];if(!_0x34576a[_0x3fef('0x36')]['hasOwnProperty'](_0x3fef('0x3c'))){_0x21aad4[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x34576a[_0x3fef('0x36')][_0x3fef('0x1d')]);_0x21aad4[_0x3fef('0x1c')]=qs['offset'](_0x34576a['query'][_0x3fef('0x1c')]);}_0x21aad4[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x34576a[_0x3fef('0x36')][_0x3fef('0x3e')]);_0x21aad4[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x40')](_0x34576a[_0x3fef('0x36')],_0x11bd40[_0x3fef('0x37')]),_0xcd635d);if(_0x34576a[_0x3fef('0x36')]['filter']){_0x21aad4[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x21aad4['where'],{'$or':_['map'](_0xcd635d,function(_0x37c4af){if(_0x37c4af[_0x3fef('0x32')]!==_0x3fef('0x42')){var _0x21c531={};_0x21c531[_0x37c4af[_0x3fef('0x2d')]]={'$like':'%'+_0x34576a[_0x3fef('0x36')][_0x3fef('0x43')]+'%'};return _0x21c531;}})});}_0x21aad4=_[_0x3fef('0x41')]({},_0x21aad4,_0x34576a['options']);var _0x107d42={'where':_0x21aad4[_0x3fef('0x3f')]};return db[_0x3fef('0x2f')][_0x3fef('0x1f')](_0x107d42)[_0x3fef('0x2a')](function(_0x2143ec){_0x5dbbc0[_0x3fef('0x1f')]=_0x2143ec;if(_0x34576a[_0x3fef('0x36')][_0x3fef('0x44')]){_0x21aad4[_0x3fef('0x45')]=[{'all':!![]}];}return db[_0x3fef('0x2f')][_0x3fef('0x46')](_0x21aad4);})[_0x3fef('0x2a')](function(_0x15d2c7){_0x5dbbc0[_0x3fef('0x47')]=_0x15d2c7;return _0x5dbbc0;})['then'](respondWithFilteredResult(_0xc20ce5,_0x21aad4))[_0x3fef('0x48')](handleError(_0xc20ce5,null));};exports[_0x3fef('0x49')]=function(_0x421fd1,_0x2120fd){var _0x1879c1={'raw':!![],'where':{'id':_0x421fd1['params']['id']}},_0x33b145={};_0x33b145[_0x3fef('0x34')]=_['keys'](db[_0x3fef('0x2f')][_0x3fef('0x30')]);_0x33b145['query']=_[_0x3fef('0x4a')](_0x421fd1['query']);_0x33b145[_0x3fef('0x37')]=_[_0x3fef('0x39')](_0x33b145[_0x3fef('0x34')],_0x33b145[_0x3fef('0x36')]);_0x1879c1[_0x3fef('0x38')]=_[_0x3fef('0x39')](_0x33b145[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x421fd1[_0x3fef('0x36')][_0x3fef('0x3a')]));_0x1879c1[_0x3fef('0x38')]=_0x1879c1[_0x3fef('0x38')][_0x3fef('0x3b')]?_0x1879c1['attributes']:_0x33b145[_0x3fef('0x34')];if(_0x421fd1[_0x3fef('0x36')]['includeAll']){_0x1879c1[_0x3fef('0x45')]=[{'all':!![]}];}_0x1879c1=_[_0x3fef('0x41')]({},_0x1879c1,_0x421fd1[_0x3fef('0x4b')]);return db['ContactItemType'][_0x3fef('0x4c')](_0x1879c1)[_0x3fef('0x2a')](handleEntityNotFound(_0x2120fd,null))['then'](respondWithResult(_0x2120fd,null))[_0x3fef('0x48')](handleError(_0x2120fd,null));};exports['create']=function(_0x48322c,_0x15fb2c){return db['ContactItemType'][_0x3fef('0x4d')](_0x48322c[_0x3fef('0x4e')],{})['then'](function(_0x4535e8){var _0x2823f4=_0x48322c[_0x3fef('0x4f')]['get']({'plain':!![]});if(!_0x2823f4)throw new Error(_0x3fef('0x50'));if(_0x2823f4[_0x3fef('0x51')]===_0x3fef('0x4f')){var _0x5b1acb=_0x4535e8[_0x3fef('0x52')]({'plain':!![]});var _0x154311=_0x3fef('0x28');return db[_0x3fef('0x53')][_0x3fef('0x4c')]({'where':{'name':_0x154311,'userProfileId':_0x2823f4['userProfileId']},'raw':!![]})[_0x3fef('0x2a')](function(_0xbbf255){if(_0xbbf255&&_0xbbf255[_0x3fef('0x54')]===0x0){return db[_0x3fef('0x29')][_0x3fef('0x4d')]({'name':_0x5b1acb[_0x3fef('0x2d')],'resourceId':_0x5b1acb['id'],'type':_0xbbf255[_0x3fef('0x2d')],'sectionId':_0xbbf255['id']},{})[_0x3fef('0x2a')](function(){return _0x4535e8;});}else{return _0x4535e8;}})[_0x3fef('0x48')](function(_0x4862a5){logger['error'](_0x3fef('0x55'),_0x4862a5);throw _0x4862a5;});}return _0x4535e8;})[_0x3fef('0x2a')](respondWithResult(_0x15fb2c,0xc9))[_0x3fef('0x48')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x26')]=function(_0xd57af2,_0x192f91){if(_0xd57af2[_0x3fef('0x4e')]['id']){delete _0xd57af2[_0x3fef('0x4e')]['id'];}return db[_0x3fef('0x2f')][_0x3fef('0x4c')]({'where':{'id':_0xd57af2[_0x3fef('0x56')]['id']}})[_0x3fef('0x2a')](handleEntityNotFound(_0x192f91,null))['then'](saveUpdates(_0xd57af2[_0x3fef('0x4e')],null))[_0x3fef('0x2a')](respondWithResult(_0x192f91,null))[_0x3fef('0x48')](handleError(_0x192f91,null));};exports[_0x3fef('0x27')]=function(_0x5b0415,_0x114191){return db[_0x3fef('0x2f')][_0x3fef('0x4c')]({'where':{'id':_0x5b0415[_0x3fef('0x56')]['id']}})['then'](handleEntityNotFound(_0x114191,null))[_0x3fef('0x2a')](db[_0x3fef('0x57')][_0x3fef('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5b0415['params']['id']}}))['then'](removeEntity(_0x114191,null))[_0x3fef('0x48')](handleError(_0x114191,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0c7b5b1..a161a6b 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0x2d3000,_0x424572){var _0xab6ac8=function(_0x213e49){while(--_0x213e49){_0x2d3000['push'](_0x2d3000['shift']());}};_0xab6ac8(++_0x424572);}(_0x68b4,0x15a));var _0x468b=function(_0x2594bf,_0x42ddfc){_0x2594bf=_0x2594bf-0x0;var _0x3e377e=_0x68b4[_0x2594bf];return _0x3e377e;};'use strict';var _=require(_0x468b('0x0'));var util=require(_0x468b('0x1'));var logger=require(_0x468b('0x2'))(_0x468b('0x3'));var moment=require(_0x468b('0x4'));var BPromise=require(_0x468b('0x5'));var rp=require(_0x468b('0x6'));var fs=require('fs');var path=require(_0x468b('0x7'));var rimraf=require(_0x468b('0x8'));var config=require(_0x468b('0x9'));var attributes=require(_0x468b('0xa'));module[_0x468b('0xb')]=function(_0x1c8a31,_0x9aa6f5){return _0x1c8a31[_0x468b('0xc')]('ContactItemType',attributes,{'tableName':_0x468b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb343=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xb343,0x1c1));var _0x3b34=function(_0x45315c,_0x2d2833){_0x45315c=_0x45315c-0x0;var _0x50dee3=_0xb343[_0x45315c];return _0x50dee3;};'use strict';var _=require(_0x3b34('0x0'));var util=require(_0x3b34('0x1'));var logger=require(_0x3b34('0x2'))(_0x3b34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3b34('0x4'));var fs=require('fs');var path=require(_0x3b34('0x5'));var rimraf=require(_0x3b34('0x6'));var config=require(_0x3b34('0x7'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x34bc09,_0x3b8367){return _0x34bc09[_0x3b34('0x8')](_0x3b34('0x9'),attributes,{'tableName':_0x3b34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index f9d54c8..1e249bf 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x301e=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','catch'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x301e,0x6e));var _0xe301=function(_0x8ed364,_0xf255a3){_0x8ed364=_0x8ed364-0x0;var _0x4dadd1=_0x301e[_0x8ed364];return _0x4dadd1;};'use strict';var _=require(_0xe301('0x0'));var util=require(_0xe301('0x1'));var moment=require(_0xe301('0x2'));var BPromise=require('bluebird');var rs=require(_0xe301('0x3'));var fs=require('fs');var Redis=require(_0xe301('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe301('0x5'));var logger=require(_0xe301('0x6'))(_0xe301('0x7'));var config=require(_0xe301('0x8'));var jayson=require(_0xe301('0x9'));var client=jayson['client'][_0xe301('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230946,_0x3edea1,_0x36357d){return new BPromise(function(_0x3cc54c,_0x305ea1){return client[_0xe301('0xb')](_0x230946,_0x36357d)[_0xe301('0xc')](function(_0xaa4b2){logger[_0xe301('0xd')]('ContactItemType,\x20%s,\x20%s',_0x3edea1,_0xe301('0xe'));logger['debug'](_0xe301('0xf'),_0x3edea1,'request\x20sent',JSON[_0xe301('0x10')](_0xaa4b2));if(_0xaa4b2[_0xe301('0x11')]){if(_0xaa4b2[_0xe301('0x11')][_0xe301('0x12')]===0x1f4){logger[_0xe301('0x11')](_0xe301('0x13'),_0x3edea1,_0xaa4b2[_0xe301('0x11')]['message']);return _0x305ea1(_0xaa4b2[_0xe301('0x11')][_0xe301('0x14')]);}logger[_0xe301('0x11')](_0xe301('0x13'),_0x3edea1,_0xaa4b2[_0xe301('0x11')][_0xe301('0x14')]);return _0x3cc54c(_0xaa4b2[_0xe301('0x11')][_0xe301('0x14')]);}else{logger[_0xe301('0xd')](_0xe301('0x13'),_0x3edea1,_0xe301('0xe'));_0x3cc54c(_0xaa4b2['result']['message']);}})[_0xe301('0x15')](function(_0x33b871){logger['error'](_0xe301('0x13'),_0x3edea1,_0x33b871);_0x305ea1(_0x33b871);});});} \ No newline at end of file +var _0xd3f9=['error','code','message','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0xd3f9,0x7d));var _0x9d3f=function(_0x30c2ad,_0x2e05d4){_0x30c2ad=_0x30c2ad-0x0;var _0x42e563=_0xd3f9[_0x30c2ad];return _0x42e563;};'use strict';var _=require(_0x9d3f('0x0'));var util=require('util');var moment=require(_0x9d3f('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d3f('0x2'));var fs=require('fs');var Redis=require(_0x9d3f('0x3'));var db=require(_0x9d3f('0x4'))['db'];var utils=require(_0x9d3f('0x5'));var logger=require('../../config/logger')(_0x9d3f('0x6'));var config=require(_0x9d3f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9d3f('0x8')][_0x9d3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dd72e,_0x2cb877,_0xd4d1bf){return new BPromise(function(_0x22ec01,_0x4ade84){return client[_0x9d3f('0xa')](_0x1dd72e,_0xd4d1bf)[_0x9d3f('0xb')](function(_0x1b261f){logger['info'](_0x9d3f('0xc'),_0x2cb877,_0x9d3f('0xd'));logger[_0x9d3f('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x2cb877,'request\x20sent',JSON['stringify'](_0x1b261f));if(_0x1b261f['error']){if(_0x1b261f[_0x9d3f('0xf')][_0x9d3f('0x10')]===0x1f4){logger[_0x9d3f('0xf')](_0x9d3f('0xc'),_0x2cb877,_0x1b261f[_0x9d3f('0xf')][_0x9d3f('0x11')]);return _0x4ade84(_0x1b261f[_0x9d3f('0xf')][_0x9d3f('0x11')]);}logger[_0x9d3f('0xf')]('ContactItemType,\x20%s,\x20%s',_0x2cb877,_0x1b261f[_0x9d3f('0xf')][_0x9d3f('0x11')]);return _0x22ec01(_0x1b261f[_0x9d3f('0xf')][_0x9d3f('0x11')]);}else{logger[_0x9d3f('0x12')](_0x9d3f('0xc'),_0x2cb877,_0x9d3f('0xd'));_0x22ec01(_0x1b261f['result'][_0x9d3f('0x11')]);}})[_0x9d3f('0x13')](function(_0x1b5329){logger[_0x9d3f('0xf')](_0x9d3f('0xc'),_0x2cb877,_0x1b5329);_0x4ade84(_0x1b5329);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 40ff8f2..5e2eeaf 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4ff=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','put','delete'];(function(_0x1bb030,_0x27d05f){var _0x28ef4f=function(_0xb1150e){while(--_0xb1150e){_0x1bb030['push'](_0x1bb030['shift']());}};_0x28ef4f(++_0x27d05f);}(_0xa4ff,0x121));var _0xfa4f=function(_0x278acd,_0x16d3fc){_0x278acd=_0x278acd-0x0;var _0x330bc8=_0xa4ff[_0x278acd];return _0x330bc8;};'use strict';var multer=require(_0xfa4f('0x0'));var util=require(_0xfa4f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa4f('0x2'));var router=express[_0xfa4f('0x3')]();var fs_extra=require(_0xfa4f('0x4'));var auth=require(_0xfa4f('0x5'));var interaction=require(_0xfa4f('0x6'));var config=require(_0xfa4f('0x7'));var controller=require(_0xfa4f('0x8'));router[_0xfa4f('0x9')]('/',auth[_0xfa4f('0xa')](),controller[_0xfa4f('0xb')]);router[_0xfa4f('0x9')](_0xfa4f('0xc'),auth[_0xfa4f('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfa4f('0xd')](_0xfa4f('0xc'),auth[_0xfa4f('0xa')](),controller['update']);router[_0xfa4f('0xe')](_0xfa4f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa4f('0xf')]=router; \ No newline at end of file +var _0x2377=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','index','show','post','isAuthenticated','create','put'];(function(_0x2c7c56,_0x41d33e){var _0x54c97f=function(_0x22b137){while(--_0x22b137){_0x2c7c56['push'](_0x2c7c56['shift']());}};_0x54c97f(++_0x41d33e);}(_0x2377,0x1d3));var _0x7237=function(_0x4cc69a,_0x3716dc){_0x4cc69a=_0x4cc69a-0x0;var _0x26f58e=_0x2377[_0x4cc69a];return _0x26f58e;};'use strict';var multer=require(_0x7237('0x0'));var util=require(_0x7237('0x1'));var path=require(_0x7237('0x2'));var timeout=require(_0x7237('0x3'));var express=require(_0x7237('0x4'));var router=express[_0x7237('0x5')]();var fs_extra=require(_0x7237('0x6'));var auth=require(_0x7237('0x7'));var interaction=require(_0x7237('0x8'));var config=require(_0x7237('0x9'));var controller=require(_0x7237('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x7237('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7237('0xc')]);router[_0x7237('0xd')]('/',auth[_0x7237('0xe')](),controller[_0x7237('0xf')]);router[_0x7237('0x10')](_0x7237('0x11'),auth[_0x7237('0xe')](),controller[_0x7237('0x12')]);router[_0x7237('0x13')](_0x7237('0x11'),auth[_0x7237('0xe')](),controller[_0x7237('0x14')]);module[_0x7237('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 3c2672e..6290ce0 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 _0x2032=['name','exports','STRING'];(function(_0x4ee59d,_0x4fee63){var _0x4c5876=function(_0x213c75){while(--_0x213c75){_0x4ee59d['push'](_0x4ee59d['shift']());}};_0x4c5876(++_0x4fee63);}(_0x2032,0xd9));var _0x2203=function(_0x1d40a0,_0x443c1f){_0x1d40a0=_0x1d40a0-0x0;var _0x125572=_0x2032[_0x1d40a0];return _0x125572;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x366d7a,_0x20f68b){var _0x5270ab=function(_0x33d5b6){while(--_0x33d5b6){_0x366d7a['push'](_0x366d7a['shift']());}};_0x5270ab(++_0x20f68b);}(_0xb10b,0x12a));var _0xbb10=function(_0x12551a,_0x5af080){_0x12551a=_0x12551a-0x0;var _0x6f8fc0=_0xb10b[_0x12551a];return _0x6f8fc0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5972a9c..8e585a7 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 _0x55f1=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','map','VIRTUAL','filter','merge','options','Dashboard','includeAll','include','findAll','show','params','find','catch','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x55f1,0xf7));var _0x155f=function(_0x5e28ee,_0x4d0c0e){_0x5e28ee=_0x5e28ee-0x0;var _0x505c34=_0x55f1[_0x5e28ee];return _0x505c34;};'use strict';var emlformat=require(_0x155f('0x0'));var rimraf=require(_0x155f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x155f('0x2'));var rp=require('request-promise');var moment=require(_0x155f('0x3'));var BPromise=require(_0x155f('0x4'));var Mustache=require('mustache');var util=require(_0x155f('0x5'));var path=require(_0x155f('0x6'));var sox=require(_0x155f('0x7'));var csv=require(_0x155f('0x8'));var ejs=require(_0x155f('0x9'));var fs=require('fs');var fs_extra=require(_0x155f('0xa'));var _=require(_0x155f('0xb'));var squel=require(_0x155f('0xc'));var crypto=require('crypto');var jsforce=require(_0x155f('0xd'));var deskjs=require(_0x155f('0xe'));var toCsv=require(_0x155f('0x8'));var querystring=require('querystring');var Papa=require(_0x155f('0xf'));var Redis=require(_0x155f('0x10'));var authService=require(_0x155f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x155f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x155f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x155f('0x14'));var licenseUtil=require(_0x155f('0x15'));var db=require(_0x155f('0x16'))['db'];config[_0x155f('0x17')]=_[_0x155f('0x18')](config[_0x155f('0x17')],{'host':_0x155f('0x19'),'port':0x18eb});var socket=require(_0x155f('0x1a'))(new Redis(config[_0x155f('0x17')]));require(_0x155f('0x1b'))[_0x155f('0x1c')](socket);function respondWithStatusCode(_0x55f4b4,_0x589906){_0x589906=_0x589906||0xcc;return function(_0x3c8034){if(_0x3c8034){return _0x55f4b4[_0x155f('0x1d')](_0x589906);}return _0x55f4b4['status'](_0x589906)[_0x155f('0x1e')]();};}function respondWithResult(_0x234418,_0x4f5599){_0x4f5599=_0x4f5599||0xc8;return function(_0x1e9eac){if(_0x1e9eac){return _0x234418[_0x155f('0x1f')](_0x4f5599)[_0x155f('0x20')](_0x1e9eac);}};}function respondWithFilteredResult(_0x441f91,_0x8054c0){return function(_0x1039a7){if(_0x1039a7){var _0x41aaea=typeof _0x8054c0[_0x155f('0x21')]===_0x155f('0x22')&&typeof _0x8054c0[_0x155f('0x23')]===_0x155f('0x22');var _0x56f999=_0x1039a7[_0x155f('0x24')];var _0x5b8957=_0x41aaea?0x0:_0x8054c0[_0x155f('0x21')];var _0x1ef0ca=_0x41aaea?_0x1039a7['count']:_0x8054c0[_0x155f('0x21')]+_0x8054c0['limit'];var _0x1cdf74;if(_0x1ef0ca>=_0x56f999){_0x1ef0ca=_0x56f999;_0x1cdf74=0xc8;}else{_0x1cdf74=0xce;}_0x441f91[_0x155f('0x1f')](_0x1cdf74);return _0x441f91['set'](_0x155f('0x25'),_0x5b8957+'-'+_0x1ef0ca+'/'+_0x56f999)[_0x155f('0x20')](_0x1039a7);}return null;};}function patchUpdates(_0x3f3c46){return function(_0x28e90f){try{jsonpatch[_0x155f('0x26')](_0x28e90f,_0x3f3c46,!![]);}catch(_0x932c19){return BPromise[_0x155f('0x27')](_0x932c19);}return _0x28e90f[_0x155f('0x28')]();};}function saveUpdates(_0x2bf3a8,_0xa1f102){return function(_0x5d05db){if(_0x5d05db){return _0x5d05db[_0x155f('0x29')](_0x2bf3a8)[_0x155f('0x2a')](function(_0x1aa7d6){return _0x1aa7d6;});}return null;};}function removeEntity(_0x41640e,_0x46f4a1){return function(_0x171f5d){if(_0x171f5d){return _0x171f5d[_0x155f('0x2b')]()[_0x155f('0x2a')](function(){var _0x5b3425=_0x171f5d[_0x155f('0x2c')]({'plain':!![]});var _0xee7ffc=_0x155f('0x2d');return db['UserProfileResource'][_0x155f('0x2b')]({'where':{'type':_0xee7ffc,'resourceId':_0x5b3425['id']}})[_0x155f('0x2a')](function(){return _0x171f5d;});})['then'](function(){_0x41640e[_0x155f('0x1f')](0xcc)[_0x155f('0x1e')]();});}};}function handleEntityNotFound(_0x2cabbd,_0x4a987b){return function(_0xc7eeba){if(!_0xc7eeba){_0x2cabbd[_0x155f('0x1d')](0x194);}return _0xc7eeba;};}function handleError(_0x297b8f,_0x29e3c4){_0x29e3c4=_0x29e3c4||0x1f4;return function(_0x57dbb5){logger[_0x155f('0x2e')](_0x57dbb5[_0x155f('0x2f')]);if(_0x57dbb5[_0x155f('0x30')]){delete _0x57dbb5[_0x155f('0x30')];}_0x297b8f[_0x155f('0x1f')](_0x29e3c4)[_0x155f('0x31')](_0x57dbb5);};}exports[_0x155f('0x32')]=function(_0x435934,_0x1b4851){var _0x531bf5={},_0x3ad2a5={},_0x52639b={'count':0x0,'rows':[]};var _0x5533b8=_['map'](db['Dashboard'][_0x155f('0x33')],function(_0x548e54){return{'name':_0x548e54[_0x155f('0x34')],'type':_0x548e54[_0x155f('0x35')][_0x155f('0x36')]};});_0x3ad2a5['model']=_['map'](_0x5533b8,_0x155f('0x30'));_0x3ad2a5[_0x155f('0x37')]=_[_0x155f('0x38')](_0x435934['query']);_0x3ad2a5[_0x155f('0x39')]=_['intersection'](_0x3ad2a5[_0x155f('0x3a')],_0x3ad2a5['query']);_0x531bf5[_0x155f('0x3b')]=_[_0x155f('0x3c')](_0x3ad2a5[_0x155f('0x3a')],qs[_0x155f('0x3d')](_0x435934[_0x155f('0x37')][_0x155f('0x3d')]));_0x531bf5[_0x155f('0x3b')]=_0x531bf5[_0x155f('0x3b')][_0x155f('0x3e')]?_0x531bf5[_0x155f('0x3b')]:_0x3ad2a5[_0x155f('0x3a')];if(!_0x435934[_0x155f('0x37')][_0x155f('0x3f')](_0x155f('0x40'))){_0x531bf5['limit']=qs[_0x155f('0x23')](_0x435934[_0x155f('0x37')][_0x155f('0x23')]);_0x531bf5['offset']=qs[_0x155f('0x21')](_0x435934['query'][_0x155f('0x21')]);}_0x531bf5['order']=qs[_0x155f('0x41')](_0x435934['query'][_0x155f('0x41')]);_0x531bf5['where']=qs[_0x155f('0x39')](_[_0x155f('0x42')](_0x435934[_0x155f('0x37')],_0x3ad2a5[_0x155f('0x39')]),_0x5533b8);if(_0x435934['query']['filter']){_0x531bf5[_0x155f('0x43')]=_['merge'](_0x531bf5[_0x155f('0x43')],{'$or':_[_0x155f('0x44')](_0x5533b8,function(_0x2ddf62){if(_0x2ddf62['type']!==_0x155f('0x45')){var _0x58387a={};_0x58387a[_0x2ddf62[_0x155f('0x30')]]={'$like':'%'+_0x435934[_0x155f('0x37')][_0x155f('0x46')]+'%'};return _0x58387a;}})});}_0x531bf5=_[_0x155f('0x47')]({},_0x531bf5,_0x435934[_0x155f('0x48')]);var _0x2a7668={'where':_0x531bf5['where']};return db[_0x155f('0x49')][_0x155f('0x24')](_0x2a7668)[_0x155f('0x2a')](function(_0x3aa583){_0x52639b['count']=_0x3aa583;if(_0x435934['query'][_0x155f('0x4a')]){_0x531bf5[_0x155f('0x4b')]=[{'all':!![]}];}return db['Dashboard'][_0x155f('0x4c')](_0x531bf5);})['then'](function(_0x5b6f88){_0x52639b['rows']=_0x5b6f88;return _0x52639b;})[_0x155f('0x2a')](respondWithFilteredResult(_0x1b4851,_0x531bf5))['catch'](handleError(_0x1b4851,null));};exports[_0x155f('0x4d')]=function(_0x551b58,_0x581d13){var _0x1597e5={'raw':![],'where':{'id':_0x551b58[_0x155f('0x4e')]['id']}},_0x19b5d1={};_0x19b5d1[_0x155f('0x3a')]=_[_0x155f('0x38')](db['Dashboard'][_0x155f('0x33')]);_0x19b5d1[_0x155f('0x37')]=_[_0x155f('0x38')](_0x551b58[_0x155f('0x37')]);_0x19b5d1[_0x155f('0x39')]=_[_0x155f('0x3c')](_0x19b5d1['model'],_0x19b5d1[_0x155f('0x37')]);_0x1597e5[_0x155f('0x3b')]=_[_0x155f('0x3c')](_0x19b5d1[_0x155f('0x3a')],qs[_0x155f('0x3d')](_0x551b58[_0x155f('0x37')][_0x155f('0x3d')]));_0x1597e5['attributes']=_0x1597e5['attributes'][_0x155f('0x3e')]?_0x1597e5[_0x155f('0x3b')]:_0x19b5d1[_0x155f('0x3a')];if(_0x551b58[_0x155f('0x37')]['includeAll']){_0x1597e5['include']=[{'all':!![]}];}_0x1597e5=_[_0x155f('0x47')]({},_0x1597e5,_0x551b58[_0x155f('0x48')]);return db[_0x155f('0x49')][_0x155f('0x4f')](_0x1597e5)[_0x155f('0x2a')](handleEntityNotFound(_0x581d13,null))[_0x155f('0x2a')](respondWithResult(_0x581d13,null))[_0x155f('0x50')](handleError(_0x581d13,null));};exports[_0x155f('0x51')]=function(_0x347437,_0x5ddab7){return db[_0x155f('0x49')][_0x155f('0x51')](_0x347437[_0x155f('0x52')],{})[_0x155f('0x2a')](function(_0x40981e){var _0x15dd33=_0x347437['user'][_0x155f('0x2c')]({'plain':!![]});if(!_0x15dd33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15dd33['role']==='user'){var _0xa6fa96=_0x40981e[_0x155f('0x2c')]({'plain':!![]});var _0x3d1dcc=_0x155f('0x2d');return db[_0x155f('0x53')][_0x155f('0x4f')]({'where':{'name':_0x3d1dcc,'userProfileId':_0x15dd33[_0x155f('0x54')]},'raw':!![]})[_0x155f('0x2a')](function(_0x34d368){if(_0x34d368&&_0x34d368[_0x155f('0x55')]===0x0){return db['UserProfileResource'][_0x155f('0x51')]({'name':_0xa6fa96[_0x155f('0x30')],'resourceId':_0xa6fa96['id'],'type':_0x34d368[_0x155f('0x30')],'sectionId':_0x34d368['id']},{})[_0x155f('0x2a')](function(){return _0x40981e;});}else{return _0x40981e;}})[_0x155f('0x50')](function(_0x188bfd){logger[_0x155f('0x2e')](_0x155f('0x56'),_0x188bfd);throw _0x188bfd;});}return _0x40981e;})['then'](respondWithResult(_0x5ddab7,0xc9))[_0x155f('0x50')](handleError(_0x5ddab7,null));};exports['clone']=function(_0x1fbff6,_0x3ab4e4){var _0x376d8e={'where':{'id':_0x1fbff6['params']['id']}},_0x90ef69={};_0x90ef69[_0x155f('0x3a')]=_['keys'](db['Dashboard'][_0x155f('0x33')]);_0x376d8e[_0x155f('0x3b')]=_[_0x155f('0x3c')](_0x90ef69[_0x155f('0x3a')],qs['fields'](_0x1fbff6['query'][_0x155f('0x3d')]));_0x376d8e['attributes']=_0x376d8e[_0x155f('0x3b')][_0x155f('0x3e')]?_0x376d8e[_0x155f('0x3b')]:_0x90ef69[_0x155f('0x3a')];if(_0x1fbff6['query'][_0x155f('0x4a')]){_0x376d8e[_0x155f('0x4b')]=[{'all':!![]}];}_0x376d8e=_['merge']({},_0x376d8e,_0x1fbff6[_0x155f('0x48')]);return db[_0x155f('0x49')][_0x155f('0x4f')](_0x376d8e)[_0x155f('0x2a')](handleEntityNotFound(_0x3ab4e4,null))[_0x155f('0x2a')](function(_0x48d834){if(_0x48d834){var _0x4ab0c3=_0x48d834[_0x155f('0x2c')]({'plain':!![]});_0x4ab0c3=qs[_0x155f('0x57')](_0x4ab0c3,['id',_0x155f('0x58'),'updatedAt']);_0x1fbff6[_0x155f('0x52')]=_[_0x155f('0x57')](_0x1fbff6['body'],['id',_0x155f('0x58'),_0x155f('0x59')]);return db[_0x155f('0x49')][_0x155f('0x51')](_[_0x155f('0x47')](_0x4ab0c3,_0x1fbff6[_0x155f('0x52')]),{'include':_0x1fbff6[_0x155f('0x37')][_0x155f('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x29ae19){var _0x4370ad=_0x1fbff6[_0x155f('0x5a')][_0x155f('0x2c')]({'plain':!![]});if(!_0x4370ad)throw new Error(_0x155f('0x5b'));if(_0x4370ad[_0x155f('0x5c')]==='user'){var _0x3f627e=_0x29ae19[_0x155f('0x2c')]({'plain':!![]});var _0x206ed8=_0x155f('0x2d');return db[_0x155f('0x53')][_0x155f('0x4f')]({'where':{'name':_0x206ed8,'userProfileId':_0x4370ad['userProfileId']},'raw':!![]})[_0x155f('0x2a')](function(_0x3ee43f){if(_0x3ee43f&&_0x3ee43f[_0x155f('0x55')]===0x0){return db[_0x155f('0x5d')][_0x155f('0x51')]({'name':_0x3f627e[_0x155f('0x30')],'resourceId':_0x3f627e['id'],'type':_0x3ee43f[_0x155f('0x30')],'sectionId':_0x3ee43f['id']},{})['then'](function(){return _0x29ae19;});}else{return _0x29ae19;}})[_0x155f('0x50')](function(_0x212cbb){logger[_0x155f('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x212cbb);throw _0x212cbb;});}return _0x29ae19;});}})[_0x155f('0x2a')](respondWithResult(_0x3ab4e4,0xc9))[_0x155f('0x50')](handleError(_0x3ab4e4,null));};exports[_0x155f('0x29')]=function(_0x263b1b,_0x25ea21){if(_0x263b1b[_0x155f('0x52')]['id']){delete _0x263b1b[_0x155f('0x52')]['id'];}return db[_0x155f('0x49')][_0x155f('0x4f')]({'where':{'id':_0x263b1b[_0x155f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x25ea21,null))[_0x155f('0x2a')](saveUpdates(_0x263b1b[_0x155f('0x52')],null))[_0x155f('0x2a')](respondWithResult(_0x25ea21,null))[_0x155f('0x50')](handleError(_0x25ea21,null));};exports[_0x155f('0x2b')]=function(_0x29b34d,_0x267087){return db[_0x155f('0x49')][_0x155f('0x4f')]({'where':{'id':_0x29b34d['params']['id']}})[_0x155f('0x2a')](handleEntityNotFound(_0x267087,null))[_0x155f('0x2a')](removeEntity(_0x267087,null))['catch'](handleError(_0x267087,null));};function widgetAttributes(_0x31c6d6){try{switch(_0x31c6d6[_0x155f('0x35')]){case _0x155f('0x5e'):return[{'name':_0x155f('0x5f'),'value':_0x31c6d6[_0x155f('0x5f')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x0]?_0x31c6d6[_0x155f('0x60')][0x0][_0x155f('0x61')]:undefined)||_0x155f('0x62')}];case _0x155f('0x63'):return[{'name':_0x155f('0x64'),'value':_0x31c6d6[_0x155f('0x64')]||(_0x31c6d6['attrs']&&_0x31c6d6['attrs'][0x0]?_0x31c6d6[_0x155f('0x60')][0x0][_0x155f('0x61')]:undefined)||''}];case _0x155f('0x65'):return[{'name':_0x155f('0x66'),'value':_0x31c6d6[_0x155f('0x66')]||(_0x31c6d6['attrs']&&_0x31c6d6[_0x155f('0x60')][0x0]?_0x31c6d6[_0x155f('0x60')][0x0][_0x155f('0x61')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x31c6d6[_0x155f('0x67')]||(_0x31c6d6['attrs']&&_0x31c6d6['attrs'][0x1]?_0x31c6d6[_0x155f('0x60')][0x1][_0x155f('0x61')]:undefined)||'0.00'},{'name':_0x155f('0x68'),'value':_0x31c6d6['attrFontSize']||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x2]?_0x31c6d6['attrs'][0x2][_0x155f('0x61')]:undefined)||0xc}];case'counter':return[{'name':_0x155f('0x69'),'value':_0x31c6d6[_0x155f('0x69')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x0]?_0x31c6d6['attrs'][0x0]['value']:undefined)||_0x155f('0x6a')},{'name':_0x155f('0x6b'),'value':_0x31c6d6[_0x155f('0x6b')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x1]?_0x31c6d6[_0x155f('0x60')][0x1][_0x155f('0x61')]:undefined)||[]},{'name':_0x155f('0x68'),'value':_0x31c6d6['attrFontSize']||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x2]?_0x31c6d6[_0x155f('0x60')][0x2][_0x155f('0x61')]:undefined)||0x14},{'name':_0x155f('0x6c'),'value':_0x31c6d6[_0x155f('0x6c')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6['attrs'][0x3]?_0x31c6d6['attrs'][0x3][_0x155f('0x61')]:undefined)||_0x155f('0x6d')},{'name':'attrEmailAccounts','value':_0x31c6d6[_0x155f('0x6e')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x4]?_0x31c6d6[_0x155f('0x60')][0x4][_0x155f('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x31c6d6['attrFaxAccounts']||(_0x31c6d6['attrs']&&_0x31c6d6[_0x155f('0x60')][0x5]?_0x31c6d6[_0x155f('0x60')][0x5][_0x155f('0x61')]:undefined)||''},{'name':_0x155f('0x6f'),'value':_0x31c6d6['attrSmsAccounts']||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x6]?_0x31c6d6['attrs'][0x6]['value']:undefined)||''},{'name':_0x155f('0x70'),'value':_0x31c6d6[_0x155f('0x70')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x7]?_0x31c6d6[_0x155f('0x60')][0x7][_0x155f('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x31c6d6[_0x155f('0x71')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x8]?_0x31c6d6['attrs'][0x8]['value']:undefined)||''},{'name':_0x155f('0x72'),'value':_0x31c6d6[_0x155f('0x72')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x9]?_0x31c6d6[_0x155f('0x60')][0x9][_0x155f('0x61')]:undefined)||''}];case _0x155f('0x73'):case _0x155f('0x74'):return[{'name':_0x155f('0x75'),'value':_0x31c6d6[_0x155f('0x75')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x0]?_0x31c6d6[_0x155f('0x60')][0x0][_0x155f('0x61')]:undefined)||_0x155f('0x6a')},{'name':_0x155f('0x76'),'value':_0x31c6d6[_0x155f('0x76')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x1]?_0x31c6d6[_0x155f('0x60')][0x1]['value']:undefined)||null},{'name':_0x155f('0x77'),'value':_0x31c6d6[_0x155f('0x77')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x2]?_0x31c6d6[_0x155f('0x60')][0x2]['value']:undefined)||null},{'name':_0x155f('0x6b'),'value':_0x31c6d6[_0x155f('0x6b')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6['attrs'][0x3]?_0x31c6d6[_0x155f('0x60')][0x3][_0x155f('0x61')]:undefined)||[]},{'name':_0x155f('0x6c'),'value':_0x31c6d6[_0x155f('0x6c')]||(_0x31c6d6['attrs']&&_0x31c6d6[_0x155f('0x60')][0x4]?_0x31c6d6['attrs'][0x4][_0x155f('0x61')]:undefined)||'voice'},{'name':_0x155f('0x6e'),'value':_0x31c6d6[_0x155f('0x6e')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x5]?_0x31c6d6[_0x155f('0x60')][0x5][_0x155f('0x61')]:undefined)||''},{'name':_0x155f('0x78'),'value':_0x31c6d6[_0x155f('0x78')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x6]?_0x31c6d6[_0x155f('0x60')][0x6][_0x155f('0x61')]:undefined)||''},{'name':_0x155f('0x6f'),'value':_0x31c6d6[_0x155f('0x6f')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x7]?_0x31c6d6[_0x155f('0x60')][0x7]['value']:undefined)||''},{'name':_0x155f('0x70'),'value':_0x31c6d6[_0x155f('0x70')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x8]?_0x31c6d6[_0x155f('0x60')][0x8][_0x155f('0x61')]:undefined)||''},{'name':_0x155f('0x71'),'value':_0x31c6d6[_0x155f('0x71')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x9]?_0x31c6d6[_0x155f('0x60')][0x9][_0x155f('0x61')]:undefined)||''},{'name':_0x155f('0x72'),'value':_0x31c6d6['attrChatWebsites']||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6['attrs'][0xa]?_0x31c6d6[_0x155f('0x60')][0xa][_0x155f('0x61')]:undefined)||''}];case _0x155f('0x79'):return[{'name':_0x155f('0x7a'),'type':_0x31c6d6['reportType']||(_0x31c6d6['attrs']&&_0x31c6d6[_0x155f('0x60')][0x0]?_0x31c6d6['attrs'][0x0][_0x155f('0x35')]:undefined)||null,'value':_0x31c6d6[_0x155f('0x7a')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x0]?_0x31c6d6[_0x155f('0x60')][0x0][_0x155f('0x61')]:undefined)||null},{'name':_0x155f('0x7b'),'value':_0x31c6d6[_0x155f('0x7b')]||(_0x31c6d6[_0x155f('0x60')]&&_0x31c6d6[_0x155f('0x60')][0x1]?_0x31c6d6[_0x155f('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2cff89){logger[_0x155f('0x2e')]('widgetAttributes:\x20%s',JSON[_0x155f('0x7c')](_0x2cff89));return[];}}exports[_0x155f('0x7d')]=function(_0x400470,_0x1272ee,_0x42d6b1){if(_0x400470[_0x155f('0x52')]['id']){delete _0x400470[_0x155f('0x52')]['id'];}return db[_0x155f('0x49')]['find']({'where':{'id':_0x400470[_0x155f('0x4e')]['id']}})[_0x155f('0x2a')](handleEntityNotFound(_0x1272ee,null))[_0x155f('0x2a')](function(_0x1093cd){if(_0x1093cd){_0x400470[_0x155f('0x52')][_0x155f('0x7e')]=_0x1093cd['id'];_0x400470[_0x155f('0x52')]['attrs']=widgetAttributes(_0x400470['body']);return db[_0x155f('0x7f')][_0x155f('0x51')](_0x400470[_0x155f('0x52')]);}})[_0x155f('0x2a')](respondWithResult(_0x1272ee,null))[_0x155f('0x50')](handleError(_0x1272ee,null));};exports[_0x155f('0x80')]=function(_0x110c28,_0x4d55d9,_0x2c24e4){var _0x39e5c1={};var _0x47acce={};var _0x166275;var _0x188b8a;return db[_0x155f('0x49')][_0x155f('0x81')]({'where':{'id':_0x110c28['params']['id']}})[_0x155f('0x2a')](handleEntityNotFound(_0x4d55d9,null))[_0x155f('0x2a')](function(_0x5059a9){if(_0x5059a9){_0x166275=_0x5059a9;_0x47acce[_0x155f('0x3a')]=_[_0x155f('0x38')](db[_0x155f('0x7f')][_0x155f('0x33')]);_0x47acce[_0x155f('0x37')]=_[_0x155f('0x38')](_0x110c28[_0x155f('0x37')]);_0x47acce[_0x155f('0x39')]=_[_0x155f('0x3c')](_0x47acce['model'],_0x47acce[_0x155f('0x37')]);_0x39e5c1[_0x155f('0x3b')]=_[_0x155f('0x3c')](_0x47acce[_0x155f('0x3a')],qs[_0x155f('0x3d')](_0x110c28[_0x155f('0x37')][_0x155f('0x3d')]));_0x39e5c1[_0x155f('0x3b')]=_0x39e5c1[_0x155f('0x3b')][_0x155f('0x3e')]?_0x39e5c1['attributes']:_0x47acce[_0x155f('0x3a')];_0x39e5c1[_0x155f('0x82')]=qs[_0x155f('0x41')](_0x110c28[_0x155f('0x37')]['sort']);_0x39e5c1[_0x155f('0x43')]=qs[_0x155f('0x39')](_['pick'](_0x110c28[_0x155f('0x37')],_0x47acce['filters']));if(_0x110c28[_0x155f('0x37')][_0x155f('0x46')]){_0x39e5c1[_0x155f('0x43')]=_[_0x155f('0x47')](_0x39e5c1['where'],{'$or':_[_0x155f('0x44')](_0x39e5c1[_0x155f('0x3b')],function(_0x48714c){var _0x14c30e={};_0x14c30e[_0x48714c]={'$like':'%'+_0x110c28[_0x155f('0x37')]['filter']+'%'};return _0x14c30e;})});}_0x39e5c1=_['merge']({},_0x39e5c1,_0x110c28[_0x155f('0x48')]);return _0x166275['getItems'](_0x39e5c1);}})[_0x155f('0x2a')](function(_0x1e27a6){if(_0x1e27a6){_0x188b8a=_0x1e27a6[_0x155f('0x3e')];if(!_0x110c28[_0x155f('0x37')][_0x155f('0x3f')](_0x155f('0x40'))){_0x39e5c1[_0x155f('0x23')]=qs[_0x155f('0x23')](_0x110c28['query'][_0x155f('0x23')]);_0x39e5c1[_0x155f('0x21')]=qs[_0x155f('0x21')](_0x110c28['query'][_0x155f('0x21')]);}return _0x166275['getItems'](_0x39e5c1);}})[_0x155f('0x2a')](function(_0x41277f){if(_0x41277f){return _0x41277f?{'count':_0x188b8a,'rows':_0x41277f}:null;}})['then'](respondWithResult(_0x4d55d9,null))['catch'](handleError(_0x4d55d9,null));}; \ No newline at end of file +var _0x70cc=['mustache','sox','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','iframe','attrUrl','attrs','https://','custom','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','total','attrSerie2','attrSerie3','attrSmsAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70cc,0x1e7));var _0xc70c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x70cc[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc70c('0x0'));var jsonpatch=require(_0xc70c('0x1'));var rp=require(_0xc70c('0x2'));var moment=require(_0xc70c('0x3'));var BPromise=require(_0xc70c('0x4'));var Mustache=require(_0xc70c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc70c('0x6'));var csv=require('to-csv');var ejs=require(_0xc70c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc70c('0x8'));var squel=require('squel');var crypto=require(_0xc70c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc70c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc70c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc70c('0xc'));var qs=require(_0xc70c('0xd'));var as=require(_0xc70c('0xe'));var hardwareService=require(_0xc70c('0xf'));var logger=require(_0xc70c('0x10'))(_0xc70c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc70c('0x12'));var db=require('../../mysqldb')['db'];config[_0xc70c('0x13')]=_['defaults'](config[_0xc70c('0x13')],{'host':_0xc70c('0x14'),'port':0x18eb});var socket=require(_0xc70c('0x15'))(new Redis(config['redis']));require(_0xc70c('0x16'))[_0xc70c('0x17')](socket);function respondWithStatusCode(_0x5b2fdc,_0x3c6049){_0x3c6049=_0x3c6049||0xcc;return function(_0x25f6e5){if(_0x25f6e5){return _0x5b2fdc['sendStatus'](_0x3c6049);}return _0x5b2fdc[_0xc70c('0x18')](_0x3c6049)[_0xc70c('0x19')]();};}function respondWithResult(_0x111b0b,_0x21aee5){_0x21aee5=_0x21aee5||0xc8;return function(_0x53624f){if(_0x53624f){return _0x111b0b[_0xc70c('0x18')](_0x21aee5)[_0xc70c('0x1a')](_0x53624f);}};}function respondWithFilteredResult(_0x1e8e01,_0x17012b){return function(_0x2a06e7){if(_0x2a06e7){var _0x391585=typeof _0x17012b[_0xc70c('0x1b')]===_0xc70c('0x1c')&&typeof _0x17012b[_0xc70c('0x1d')]===_0xc70c('0x1c');var _0x416749=_0x2a06e7[_0xc70c('0x1e')];var _0x58daca=_0x391585?0x0:_0x17012b[_0xc70c('0x1b')];var _0x221ac3=_0x391585?_0x2a06e7['count']:_0x17012b[_0xc70c('0x1b')]+_0x17012b[_0xc70c('0x1d')];var _0xf16e2c;if(_0x221ac3>=_0x416749){_0x221ac3=_0x416749;_0xf16e2c=0xc8;}else{_0xf16e2c=0xce;}_0x1e8e01['status'](_0xf16e2c);return _0x1e8e01[_0xc70c('0x1f')](_0xc70c('0x20'),_0x58daca+'-'+_0x221ac3+'/'+_0x416749)[_0xc70c('0x1a')](_0x2a06e7);}return null;};}function patchUpdates(_0x35a16c){return function(_0x569a53){try{jsonpatch['apply'](_0x569a53,_0x35a16c,!![]);}catch(_0x20d741){return BPromise[_0xc70c('0x21')](_0x20d741);}return _0x569a53[_0xc70c('0x22')]();};}function saveUpdates(_0x2eef29,_0x280dbc){return function(_0x187edc){if(_0x187edc){return _0x187edc[_0xc70c('0x23')](_0x2eef29)[_0xc70c('0x24')](function(_0x319d49){return _0x319d49;});}return null;};}function removeEntity(_0x56b417,_0x3155a8){return function(_0x4930a0){if(_0x4930a0){return _0x4930a0[_0xc70c('0x25')]()['then'](function(){var _0x352fdc=_0x4930a0['get']({'plain':!![]});var _0x85134c=_0xc70c('0x26');return db[_0xc70c('0x27')]['destroy']({'where':{'type':_0x85134c,'resourceId':_0x352fdc['id']}})['then'](function(){return _0x4930a0;});})[_0xc70c('0x24')](function(){_0x56b417[_0xc70c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fd15,_0x472de0){return function(_0x1a97f3){if(!_0x1a97f3){_0x28fd15[_0xc70c('0x28')](0x194);}return _0x1a97f3;};}function handleError(_0x470a66,_0x5b71ce){_0x5b71ce=_0x5b71ce||0x1f4;return function(_0x5b353c){logger[_0xc70c('0x29')](_0x5b353c[_0xc70c('0x2a')]);if(_0x5b353c[_0xc70c('0x2b')]){delete _0x5b353c[_0xc70c('0x2b')];}_0x470a66[_0xc70c('0x18')](_0x5b71ce)[_0xc70c('0x2c')](_0x5b353c);};}exports[_0xc70c('0x2d')]=function(_0x4339d6,_0x3545da){var _0x366dd8={},_0x1806ca={},_0x1ed938={'count':0x0,'rows':[]};var _0x44ecf5=_[_0xc70c('0x2e')](db[_0xc70c('0x2f')][_0xc70c('0x30')],function(_0x3245d8){return{'name':_0x3245d8[_0xc70c('0x31')],'type':_0x3245d8[_0xc70c('0x32')][_0xc70c('0x33')]};});_0x1806ca[_0xc70c('0x34')]=_[_0xc70c('0x2e')](_0x44ecf5,_0xc70c('0x2b'));_0x1806ca['query']=_[_0xc70c('0x35')](_0x4339d6[_0xc70c('0x36')]);_0x1806ca[_0xc70c('0x37')]=_['intersection'](_0x1806ca[_0xc70c('0x34')],_0x1806ca[_0xc70c('0x36')]);_0x366dd8[_0xc70c('0x38')]=_[_0xc70c('0x39')](_0x1806ca[_0xc70c('0x34')],qs[_0xc70c('0x3a')](_0x4339d6['query']['fields']));_0x366dd8[_0xc70c('0x38')]=_0x366dd8[_0xc70c('0x38')]['length']?_0x366dd8[_0xc70c('0x38')]:_0x1806ca['model'];if(!_0x4339d6[_0xc70c('0x36')][_0xc70c('0x3b')]('nolimit')){_0x366dd8[_0xc70c('0x1d')]=qs[_0xc70c('0x1d')](_0x4339d6[_0xc70c('0x36')][_0xc70c('0x1d')]);_0x366dd8[_0xc70c('0x1b')]=qs['offset'](_0x4339d6[_0xc70c('0x36')][_0xc70c('0x1b')]);}_0x366dd8[_0xc70c('0x3c')]=qs[_0xc70c('0x3d')](_0x4339d6[_0xc70c('0x36')][_0xc70c('0x3d')]);_0x366dd8['where']=qs[_0xc70c('0x37')](_[_0xc70c('0x3e')](_0x4339d6['query'],_0x1806ca[_0xc70c('0x37')]),_0x44ecf5);if(_0x4339d6[_0xc70c('0x36')][_0xc70c('0x3f')]){_0x366dd8[_0xc70c('0x40')]=_['merge'](_0x366dd8[_0xc70c('0x40')],{'$or':_['map'](_0x44ecf5,function(_0x5715){if(_0x5715[_0xc70c('0x32')]!==_0xc70c('0x41')){var _0x48ebfc={};_0x48ebfc[_0x5715[_0xc70c('0x2b')]]={'$like':'%'+_0x4339d6[_0xc70c('0x36')]['filter']+'%'};return _0x48ebfc;}})});}_0x366dd8=_[_0xc70c('0x42')]({},_0x366dd8,_0x4339d6[_0xc70c('0x43')]);var _0x525fec={'where':_0x366dd8[_0xc70c('0x40')]};return db[_0xc70c('0x2f')][_0xc70c('0x1e')](_0x525fec)['then'](function(_0x585aa5){_0x1ed938[_0xc70c('0x1e')]=_0x585aa5;if(_0x4339d6['query'][_0xc70c('0x44')]){_0x366dd8[_0xc70c('0x45')]=[{'all':!![]}];}return db[_0xc70c('0x2f')][_0xc70c('0x46')](_0x366dd8);})[_0xc70c('0x24')](function(_0x149b00){_0x1ed938['rows']=_0x149b00;return _0x1ed938;})[_0xc70c('0x24')](respondWithFilteredResult(_0x3545da,_0x366dd8))[_0xc70c('0x47')](handleError(_0x3545da,null));};exports[_0xc70c('0x48')]=function(_0x5c5d74,_0x54f907){var _0x19d760={'raw':![],'where':{'id':_0x5c5d74[_0xc70c('0x49')]['id']}},_0x384b99={};_0x384b99['model']=_['keys'](db['Dashboard'][_0xc70c('0x30')]);_0x384b99[_0xc70c('0x36')]=_[_0xc70c('0x35')](_0x5c5d74[_0xc70c('0x36')]);_0x384b99[_0xc70c('0x37')]=_[_0xc70c('0x39')](_0x384b99[_0xc70c('0x34')],_0x384b99[_0xc70c('0x36')]);_0x19d760['attributes']=_[_0xc70c('0x39')](_0x384b99[_0xc70c('0x34')],qs[_0xc70c('0x3a')](_0x5c5d74[_0xc70c('0x36')]['fields']));_0x19d760[_0xc70c('0x38')]=_0x19d760[_0xc70c('0x38')][_0xc70c('0x4a')]?_0x19d760[_0xc70c('0x38')]:_0x384b99[_0xc70c('0x34')];if(_0x5c5d74[_0xc70c('0x36')][_0xc70c('0x44')]){_0x19d760[_0xc70c('0x45')]=[{'all':!![]}];}_0x19d760=_[_0xc70c('0x42')]({},_0x19d760,_0x5c5d74[_0xc70c('0x43')]);return db[_0xc70c('0x2f')][_0xc70c('0x4b')](_0x19d760)[_0xc70c('0x24')](handleEntityNotFound(_0x54f907,null))[_0xc70c('0x24')](respondWithResult(_0x54f907,null))[_0xc70c('0x47')](handleError(_0x54f907,null));};exports[_0xc70c('0x4c')]=function(_0x56416e,_0x268e4e){return db[_0xc70c('0x2f')]['create'](_0x56416e[_0xc70c('0x4d')],{})['then'](function(_0xc8e641){var _0x42d0e7=_0x56416e[_0xc70c('0x4e')][_0xc70c('0x4f')]({'plain':!![]});if(!_0x42d0e7)throw new Error(_0xc70c('0x50'));if(_0x42d0e7['role']==='user'){var _0x4f161f=_0xc8e641[_0xc70c('0x4f')]({'plain':!![]});var _0x535ee2=_0xc70c('0x26');return db[_0xc70c('0x51')][_0xc70c('0x4b')]({'where':{'name':_0x535ee2,'userProfileId':_0x42d0e7['userProfileId']},'raw':!![]})[_0xc70c('0x24')](function(_0x5b10f5){if(_0x5b10f5&&_0x5b10f5[_0xc70c('0x52')]===0x0){return db[_0xc70c('0x27')][_0xc70c('0x4c')]({'name':_0x4f161f[_0xc70c('0x2b')],'resourceId':_0x4f161f['id'],'type':_0x5b10f5[_0xc70c('0x2b')],'sectionId':_0x5b10f5['id']},{})[_0xc70c('0x24')](function(){return _0xc8e641;});}else{return _0xc8e641;}})[_0xc70c('0x47')](function(_0x228755){logger['error'](_0xc70c('0x53'),_0x228755);throw _0x228755;});}return _0xc8e641;})['then'](respondWithResult(_0x268e4e,0xc9))[_0xc70c('0x47')](handleError(_0x268e4e,null));};exports['clone']=function(_0x25523c,_0x1d22cf){var _0x36bac4={'where':{'id':_0x25523c['params']['id']}},_0x341af0={};_0x341af0[_0xc70c('0x34')]=_[_0xc70c('0x35')](db[_0xc70c('0x2f')][_0xc70c('0x30')]);_0x36bac4['attributes']=_[_0xc70c('0x39')](_0x341af0[_0xc70c('0x34')],qs['fields'](_0x25523c[_0xc70c('0x36')][_0xc70c('0x3a')]));_0x36bac4[_0xc70c('0x38')]=_0x36bac4[_0xc70c('0x38')][_0xc70c('0x4a')]?_0x36bac4[_0xc70c('0x38')]:_0x341af0[_0xc70c('0x34')];if(_0x25523c[_0xc70c('0x36')][_0xc70c('0x44')]){_0x36bac4['include']=[{'all':!![]}];}_0x36bac4=_['merge']({},_0x36bac4,_0x25523c[_0xc70c('0x43')]);return db['Dashboard']['find'](_0x36bac4)['then'](handleEntityNotFound(_0x1d22cf,null))[_0xc70c('0x24')](function(_0x482d06){if(_0x482d06){var _0x279a9a=_0x482d06[_0xc70c('0x4f')]({'plain':!![]});_0x279a9a=qs['omit'](_0x279a9a,['id','createdAt','updatedAt']);_0x25523c['body']=_[_0xc70c('0x54')](_0x25523c[_0xc70c('0x4d')],['id','createdAt',_0xc70c('0x55')]);return db['Dashboard']['create'](_['merge'](_0x279a9a,_0x25523c[_0xc70c('0x4d')]),{'include':_0x25523c[_0xc70c('0x36')][_0xc70c('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x346c29){var _0x5d6f3f=_0x25523c[_0xc70c('0x4e')][_0xc70c('0x4f')]({'plain':!![]});if(!_0x5d6f3f)throw new Error(_0xc70c('0x50'));if(_0x5d6f3f['role']===_0xc70c('0x4e')){var _0x1d8682=_0x346c29['get']({'plain':!![]});var _0x4bae2b='CustomDashboards';return db[_0xc70c('0x51')][_0xc70c('0x4b')]({'where':{'name':_0x4bae2b,'userProfileId':_0x5d6f3f['userProfileId']},'raw':!![]})[_0xc70c('0x24')](function(_0xe2213d){if(_0xe2213d&&_0xe2213d[_0xc70c('0x52')]===0x0){return db[_0xc70c('0x27')][_0xc70c('0x4c')]({'name':_0x1d8682['name'],'resourceId':_0x1d8682['id'],'type':_0xe2213d[_0xc70c('0x2b')],'sectionId':_0xe2213d['id']},{})[_0xc70c('0x24')](function(){return _0x346c29;});}else{return _0x346c29;}})[_0xc70c('0x47')](function(_0x2017e6){logger['error'](_0xc70c('0x53'),_0x2017e6);throw _0x2017e6;});}return _0x346c29;});}})[_0xc70c('0x24')](respondWithResult(_0x1d22cf,0xc9))[_0xc70c('0x47')](handleError(_0x1d22cf,null));};exports[_0xc70c('0x23')]=function(_0x8a4ff4,_0x4369bf){if(_0x8a4ff4[_0xc70c('0x4d')]['id']){delete _0x8a4ff4[_0xc70c('0x4d')]['id'];}return db[_0xc70c('0x2f')][_0xc70c('0x4b')]({'where':{'id':_0x8a4ff4['params']['id']}})[_0xc70c('0x24')](handleEntityNotFound(_0x4369bf,null))[_0xc70c('0x24')](saveUpdates(_0x8a4ff4[_0xc70c('0x4d')],null))[_0xc70c('0x24')](respondWithResult(_0x4369bf,null))[_0xc70c('0x47')](handleError(_0x4369bf,null));};exports[_0xc70c('0x25')]=function(_0x9a7ac1,_0x524e33){return db[_0xc70c('0x2f')]['find']({'where':{'id':_0x9a7ac1[_0xc70c('0x49')]['id']}})[_0xc70c('0x24')](handleEntityNotFound(_0x524e33,null))[_0xc70c('0x24')](removeEntity(_0x524e33,null))[_0xc70c('0x47')](handleError(_0x524e33,null));};function widgetAttributes(_0x2abf3d){try{switch(_0x2abf3d[_0xc70c('0x32')]){case _0xc70c('0x56'):return[{'name':_0xc70c('0x57'),'value':_0x2abf3d[_0xc70c('0x57')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x0]?_0x2abf3d[_0xc70c('0x58')][0x0]['value']:undefined)||_0xc70c('0x59')}];case _0xc70c('0x5a'):return[{'name':'attrPath','value':_0x2abf3d['attrPath']||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d['attrs'][0x0]?_0x2abf3d[_0xc70c('0x58')][0x0][_0xc70c('0x5b')]:undefined)||''}];case'clock':return[{'name':_0xc70c('0x5c'),'value':_0x2abf3d[_0xc70c('0x5c')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x0]?_0x2abf3d[_0xc70c('0x58')][0x0][_0xc70c('0x5b')]:undefined)||_0xc70c('0x5d')},{'name':_0xc70c('0x5e'),'value':_0x2abf3d[_0xc70c('0x5e')]||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x1]?_0x2abf3d[_0xc70c('0x58')][0x1][_0xc70c('0x5b')]:undefined)||_0xc70c('0x5f')},{'name':_0xc70c('0x60'),'value':_0x2abf3d[_0xc70c('0x60')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d['attrs'][0x2]?_0x2abf3d[_0xc70c('0x58')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xc70c('0x61'),'value':_0x2abf3d[_0xc70c('0x61')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x0]?_0x2abf3d['attrs'][0x0][_0xc70c('0x5b')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x2abf3d[_0xc70c('0x62')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x1]?_0x2abf3d[_0xc70c('0x58')][0x1][_0xc70c('0x5b')]:undefined)||[]},{'name':_0xc70c('0x60'),'value':_0x2abf3d['attrFontSize']||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x2]?_0x2abf3d[_0xc70c('0x58')][0x2][_0xc70c('0x5b')]:undefined)||0x14},{'name':_0xc70c('0x63'),'value':_0x2abf3d[_0xc70c('0x63')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x3]?_0x2abf3d[_0xc70c('0x58')][0x3]['value']:undefined)||_0xc70c('0x64')},{'name':_0xc70c('0x65'),'value':_0x2abf3d['attrEmailAccounts']||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x4]?_0x2abf3d[_0xc70c('0x58')][0x4][_0xc70c('0x5b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2abf3d[_0xc70c('0x66')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x5]?_0x2abf3d[_0xc70c('0x58')][0x5][_0xc70c('0x5b')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2abf3d['attrSmsAccounts']||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x6]?_0x2abf3d[_0xc70c('0x58')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2abf3d[_0xc70c('0x67')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x7]?_0x2abf3d[_0xc70c('0x58')][0x7][_0xc70c('0x5b')]:undefined)||''},{'name':_0xc70c('0x68'),'value':_0x2abf3d['attrWhatsappAccounts']||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x8]?_0x2abf3d[_0xc70c('0x58')][0x8][_0xc70c('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2abf3d[_0xc70c('0x69')]||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x9]?_0x2abf3d['attrs'][0x9][_0xc70c('0x5b')]:undefined)||''}];case _0xc70c('0x6a'):case _0xc70c('0x6b'):return[{'name':'attrSerie1','value':_0x2abf3d['attrSerie1']||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x0]?_0x2abf3d['attrs'][0x0][_0xc70c('0x5b')]:undefined)||_0xc70c('0x6c')},{'name':_0xc70c('0x6d'),'value':_0x2abf3d[_0xc70c('0x6d')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d['attrs'][0x1]?_0x2abf3d[_0xc70c('0x58')][0x1][_0xc70c('0x5b')]:undefined)||null},{'name':_0xc70c('0x6e'),'value':_0x2abf3d['attrSerie3']||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x2]?_0x2abf3d[_0xc70c('0x58')][0x2][_0xc70c('0x5b')]:undefined)||null},{'name':_0xc70c('0x62'),'value':_0x2abf3d[_0xc70c('0x62')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d['attrs'][0x3]?_0x2abf3d[_0xc70c('0x58')][0x3][_0xc70c('0x5b')]:undefined)||[]},{'name':_0xc70c('0x63'),'value':_0x2abf3d[_0xc70c('0x63')]||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x4]?_0x2abf3d[_0xc70c('0x58')][0x4][_0xc70c('0x5b')]:undefined)||'voice'},{'name':_0xc70c('0x65'),'value':_0x2abf3d['attrEmailAccounts']||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x5]?_0x2abf3d[_0xc70c('0x58')][0x5]['value']:undefined)||''},{'name':_0xc70c('0x66'),'value':_0x2abf3d[_0xc70c('0x66')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x6]?_0x2abf3d[_0xc70c('0x58')][0x6][_0xc70c('0x5b')]:undefined)||''},{'name':_0xc70c('0x6f'),'value':_0x2abf3d[_0xc70c('0x6f')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x7]?_0x2abf3d[_0xc70c('0x58')][0x7][_0xc70c('0x5b')]:undefined)||''},{'name':_0xc70c('0x67'),'value':_0x2abf3d[_0xc70c('0x67')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x8]?_0x2abf3d['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2abf3d[_0xc70c('0x68')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x9]?_0x2abf3d['attrs'][0x9]['value']:undefined)||''},{'name':_0xc70c('0x69'),'value':_0x2abf3d[_0xc70c('0x69')]||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0xa]?_0x2abf3d['attrs'][0xa][_0xc70c('0x5b')]:undefined)||''}];case _0xc70c('0x70'):return[{'name':'attrReport','type':_0x2abf3d[_0xc70c('0x71')]||(_0x2abf3d['attrs']&&_0x2abf3d[_0xc70c('0x58')][0x0]?_0x2abf3d[_0xc70c('0x58')][0x0][_0xc70c('0x32')]:undefined)||null,'value':_0x2abf3d[_0xc70c('0x72')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d[_0xc70c('0x58')][0x0]?_0x2abf3d['attrs'][0x0][_0xc70c('0x5b')]:undefined)||null},{'name':_0xc70c('0x73'),'value':_0x2abf3d[_0xc70c('0x73')]||(_0x2abf3d[_0xc70c('0x58')]&&_0x2abf3d['attrs'][0x1]?_0x2abf3d[_0xc70c('0x58')][0x1][_0xc70c('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x2ffa6e){logger[_0xc70c('0x29')](_0xc70c('0x74'),JSON[_0xc70c('0x75')](_0x2ffa6e));return[];}}exports['addItem']=function(_0x37e3e2,_0x38b249,_0x14c124){if(_0x37e3e2[_0xc70c('0x4d')]['id']){delete _0x37e3e2[_0xc70c('0x4d')]['id'];}return db['Dashboard'][_0xc70c('0x4b')]({'where':{'id':_0x37e3e2[_0xc70c('0x49')]['id']}})[_0xc70c('0x24')](handleEntityNotFound(_0x38b249,null))['then'](function(_0x3ba20a){if(_0x3ba20a){_0x37e3e2[_0xc70c('0x4d')][_0xc70c('0x76')]=_0x3ba20a['id'];_0x37e3e2[_0xc70c('0x4d')]['attrs']=widgetAttributes(_0x37e3e2[_0xc70c('0x4d')]);return db[_0xc70c('0x77')]['create'](_0x37e3e2[_0xc70c('0x4d')]);}})['then'](respondWithResult(_0x38b249,null))[_0xc70c('0x47')](handleError(_0x38b249,null));};exports[_0xc70c('0x78')]=function(_0x869ae,_0x2371d8,_0x352788){var _0x305a1={};var _0x627c76={};var _0x26302a;var _0x4ebb40;return db['Dashboard'][_0xc70c('0x79')]({'where':{'id':_0x869ae[_0xc70c('0x49')]['id']}})[_0xc70c('0x24')](handleEntityNotFound(_0x2371d8,null))[_0xc70c('0x24')](function(_0x382d2a){if(_0x382d2a){_0x26302a=_0x382d2a;_0x627c76[_0xc70c('0x34')]=_[_0xc70c('0x35')](db[_0xc70c('0x77')]['rawAttributes']);_0x627c76[_0xc70c('0x36')]=_[_0xc70c('0x35')](_0x869ae[_0xc70c('0x36')]);_0x627c76[_0xc70c('0x37')]=_['intersection'](_0x627c76[_0xc70c('0x34')],_0x627c76[_0xc70c('0x36')]);_0x305a1[_0xc70c('0x38')]=_['intersection'](_0x627c76[_0xc70c('0x34')],qs[_0xc70c('0x3a')](_0x869ae[_0xc70c('0x36')][_0xc70c('0x3a')]));_0x305a1[_0xc70c('0x38')]=_0x305a1['attributes'][_0xc70c('0x4a')]?_0x305a1[_0xc70c('0x38')]:_0x627c76[_0xc70c('0x34')];_0x305a1[_0xc70c('0x3c')]=qs[_0xc70c('0x3d')](_0x869ae[_0xc70c('0x36')]['sort']);_0x305a1['where']=qs[_0xc70c('0x37')](_[_0xc70c('0x3e')](_0x869ae['query'],_0x627c76[_0xc70c('0x37')]));if(_0x869ae['query'][_0xc70c('0x3f')]){_0x305a1['where']=_[_0xc70c('0x42')](_0x305a1[_0xc70c('0x40')],{'$or':_[_0xc70c('0x2e')](_0x305a1[_0xc70c('0x38')],function(_0x1992d2){var _0x4f27a6={};_0x4f27a6[_0x1992d2]={'$like':'%'+_0x869ae[_0xc70c('0x36')][_0xc70c('0x3f')]+'%'};return _0x4f27a6;})});}_0x305a1=_['merge']({},_0x305a1,_0x869ae['options']);return _0x26302a[_0xc70c('0x78')](_0x305a1);}})[_0xc70c('0x24')](function(_0x34164e){if(_0x34164e){_0x4ebb40=_0x34164e[_0xc70c('0x4a')];if(!_0x869ae['query']['hasOwnProperty'](_0xc70c('0x7a'))){_0x305a1[_0xc70c('0x1d')]=qs[_0xc70c('0x1d')](_0x869ae[_0xc70c('0x36')]['limit']);_0x305a1[_0xc70c('0x1b')]=qs[_0xc70c('0x1b')](_0x869ae['query']['offset']);}return _0x26302a['getItems'](_0x305a1);}})[_0xc70c('0x24')](function(_0x5d64aa){if(_0x5d64aa){return _0x5d64aa?{'count':_0x4ebb40,'rows':_0x5d64aa}:null;}})['then'](respondWithResult(_0x2371d8,null))[_0xc70c('0x47')](handleError(_0x2371d8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d918c19..f7db300 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 _0x1ef4=['hook','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x49abf4,_0x2c47a4){var _0x489ed2=function(_0x1a9af3){while(--_0x1a9af3){_0x49abf4['push'](_0x49abf4['shift']());}};_0x489ed2(++_0x2c47a4);}(_0x1ef4,0x17d));var _0x41ef=function(_0x104819,_0x437046){_0x104819=_0x104819-0x0;var _0x57f8a1=_0x1ef4[_0x104819];return _0x57f8a1;};'use strict';var EventEmitter=require(_0x41ef('0x0'));var Dashboard=require(_0x41ef('0x1'))['db'][_0x41ef('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x41ef('0x3')](0x0);var events={'afterCreate':_0x41ef('0x4'),'afterUpdate':_0x41ef('0x5'),'afterDestroy':_0x41ef('0x6')};function emitEvent(_0x1fa9ed){return function(_0x3b2868,_0x42185,_0x4b72e1){DashboardEvents['emit'](_0x1fa9ed+':'+_0x3b2868['id'],_0x3b2868);DashboardEvents[_0x41ef('0x7')](_0x1fa9ed,_0x3b2868);_0x4b72e1(null);};}for(var e in events){if(events[_0x41ef('0x8')](e)){var event=events[e];Dashboard[_0x41ef('0x9')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x8572=['Dashboard','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x8572,0xdf));var _0x2857=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x8572[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x2857('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x2857('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2857('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2857('0x3')};function emitEvent(_0x54c3c2){return function(_0x485d23,_0x34bc39,_0x349420){DashboardEvents['emit'](_0x54c3c2+':'+_0x485d23['id'],_0x485d23);DashboardEvents[_0x2857('0x4')](_0x54c3c2,_0x485d23);_0x349420(null);};}for(var e in events){if(events[_0x2857('0x5')](e)){var event=events[e];Dashboard[_0x2857('0x6')](e,emitEvent(event));}}module[_0x2857('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 6f938d9..ada4d9c 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 _0x912f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','Dashboard','dashboards'];(function(_0x6522af,_0x200962){var _0x39f7de=function(_0x2da9f7){while(--_0x2da9f7){_0x6522af['push'](_0x6522af['shift']());}};_0x39f7de(++_0x200962);}(_0x912f,0x1d9));var _0xf912=function(_0xf072c6,_0x45bd6b){_0xf072c6=_0xf072c6-0x0;var _0x4a3430=_0x912f[_0xf072c6];return _0x4a3430;};'use strict';var _=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var logger=require(_0xf912('0x2'))('api');var moment=require(_0xf912('0x3'));var BPromise=require(_0xf912('0x4'));var rp=require(_0xf912('0x5'));var fs=require('fs');var path=require(_0xf912('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xf912('0x7')]=function(_0x43132c,_0x5840fc){return _0x43132c[_0xf912('0x8')](_0xf912('0x9'),attributes,{'tableName':_0xf912('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bdd=['./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x403ac7,_0x3b4cc1){var _0x399175=function(_0x3e7c9f){while(--_0x3e7c9f){_0x403ac7['push'](_0x403ac7['shift']());}};_0x399175(++_0x3b4cc1);}(_0x6bdd,0x1d9));var _0xd6bd=function(_0x3c719e,_0x19719d){_0x3c719e=_0x3c719e-0x0;var _0x2d09af=_0x6bdd[_0x3c719e];return _0x2d09af;};'use strict';var _=require(_0xd6bd('0x0'));var util=require(_0xd6bd('0x1'));var logger=require('../../config/logger')(_0xd6bd('0x2'));var moment=require(_0xd6bd('0x3'));var BPromise=require(_0xd6bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6bd('0x5'));var rimraf=require(_0xd6bd('0x6'));var config=require(_0xd6bd('0x7'));var attributes=require(_0xd6bd('0x8'));module[_0xd6bd('0x9')]=function(_0x4a6d67,_0x233ead){return _0x4a6d67[_0xd6bd('0xa')](_0xd6bd('0xb'),attributes,{'tableName':_0xd6bd('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 e9fe2dd..0ca8c5b 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 _0xcb20=['./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x4d6ea5,_0x410771){var _0x255c8d=function(_0x163e52){while(--_0x163e52){_0x4d6ea5['push'](_0x4d6ea5['shift']());}};_0x255c8d(++_0x410771);}(_0xcb20,0x80));var _0x0cb2=function(_0x2f6584,_0x513b28){_0x2f6584=_0x2f6584-0x0;var _0x50cd3a=_0xcb20[_0x2f6584];return _0x50cd3a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0cb2('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cb2('0x1'))(_0x0cb2('0x2'));var config=require(_0x0cb2('0x3'));var jayson=require(_0x0cb2('0x4'));var client=jayson[_0x0cb2('0x5')][_0x0cb2('0x6')]({'port':0x232a});config[_0x0cb2('0x7')]=_[_0x0cb2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0cb2('0x9'))(new Redis(config[_0x0cb2('0x7')]));require(_0x0cb2('0xa'))[_0x0cb2('0xb')](socket);function respondWithRpcPromise(_0x5d7ed7,_0x109424,_0x44b577){return new BPromise(function(_0x915f49,_0x34eccd){return client[_0x0cb2('0xc')](_0x5d7ed7,_0x44b577)['then'](function(_0x3b3777){logger[_0x0cb2('0xd')](_0x0cb2('0xe'),_0x109424,_0x0cb2('0xf'));logger[_0x0cb2('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x109424,'request\x20sent',JSON[_0x0cb2('0x11')](_0x3b3777));if(_0x3b3777['error']){if(_0x3b3777['error'][_0x0cb2('0x12')]===0x1f4){logger[_0x0cb2('0x13')](_0x0cb2('0xe'),_0x109424,_0x3b3777[_0x0cb2('0x13')]['message']);return _0x34eccd(_0x3b3777[_0x0cb2('0x13')][_0x0cb2('0x14')]);}logger[_0x0cb2('0x13')](_0x0cb2('0xe'),_0x109424,_0x3b3777[_0x0cb2('0x13')][_0x0cb2('0x14')]);return _0x915f49(_0x3b3777[_0x0cb2('0x13')][_0x0cb2('0x14')]);}else{logger['info'](_0x0cb2('0xe'),_0x109424,_0x0cb2('0xf'));_0x915f49(_0x3b3777[_0x0cb2('0x15')][_0x0cb2('0x14')]);}})[_0x0cb2('0x16')](function(_0x57a00e){logger[_0x0cb2('0x13')]('Dashboard,\x20%s,\x20%s',_0x109424,_0x57a00e);_0x34eccd(_0x57a00e);});});} \ No newline at end of file +var _0xe132=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ea338,_0x39230a){var _0x4029f3=function(_0x7c9caf){while(--_0x7c9caf){_0x2ea338['push'](_0x2ea338['shift']());}};_0x4029f3(++_0x39230a);}(_0xe132,0x162));var _0x2e13=function(_0x50def3,_0x376c74){_0x50def3=_0x50def3-0x0;var _0x28a31c=_0xe132[_0x50def3];return _0x28a31c;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var moment=require(_0x2e13('0x1'));var BPromise=require(_0x2e13('0x2'));var rs=require(_0x2e13('0x3'));var fs=require('fs');var Redis=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e13('0x6'))(_0x2e13('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e13('0x8')][_0x2e13('0x9')]({'port':0x232a});config[_0x2e13('0xa')]=_[_0x2e13('0xb')](config[_0x2e13('0xa')],{'host':_0x2e13('0xc'),'port':0x18eb});var socket=require(_0x2e13('0xd'))(new Redis(config[_0x2e13('0xa')]));require(_0x2e13('0xe'))[_0x2e13('0xf')](socket);function respondWithRpcPromise(_0x5122a2,_0x1fc092,_0x20fe3e){return new BPromise(function(_0x31b284,_0x40c2eb){return client[_0x2e13('0x10')](_0x5122a2,_0x20fe3e)[_0x2e13('0x11')](function(_0x302718){logger['info'](_0x2e13('0x12'),_0x1fc092,_0x2e13('0x13'));logger[_0x2e13('0x14')](_0x2e13('0x15'),_0x1fc092,_0x2e13('0x13'),JSON[_0x2e13('0x16')](_0x302718));if(_0x302718[_0x2e13('0x17')]){if(_0x302718['error'][_0x2e13('0x18')]===0x1f4){logger[_0x2e13('0x17')](_0x2e13('0x12'),_0x1fc092,_0x302718['error'][_0x2e13('0x19')]);return _0x40c2eb(_0x302718[_0x2e13('0x17')][_0x2e13('0x19')]);}logger['error'](_0x2e13('0x12'),_0x1fc092,_0x302718[_0x2e13('0x17')][_0x2e13('0x19')]);return _0x31b284(_0x302718['error']['message']);}else{logger[_0x2e13('0x1a')](_0x2e13('0x12'),_0x1fc092,_0x2e13('0x13'));_0x31b284(_0x302718[_0x2e13('0x1b')][_0x2e13('0x19')]);}})[_0x2e13('0x1c')](function(_0x2496ee){logger[_0x2e13('0x17')]('Dashboard,\x20%s,\x20%s',_0x1fc092,_0x2496ee);_0x40c2eb(_0x2496ee);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 69c4405..1c37a17 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 _0x8a46=['register','length','./dashboard.events','save','remove','emit','removeListener'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0x8a46,0x19f));var _0x68a4=function(_0x334aa1,_0x54a722){_0x334aa1=_0x334aa1-0x0;var _0x203303=_0x8a46[_0x334aa1];return _0x203303;};'use strict';var DashboardEvents=require(_0x68a4('0x0'));var events=[_0x68a4('0x1'),_0x68a4('0x2'),'update'];function createListener(_0x141743,_0x388c5e){return function(_0x4457b2){_0x388c5e[_0x68a4('0x3')](_0x141743,_0x4457b2);};}function removeListener(_0x373a54,_0x29b493){return function(){DashboardEvents[_0x68a4('0x4')](_0x373a54,_0x29b493);};}exports[_0x68a4('0x5')]=function(_0x557d9c){for(var _0x3db8c1=0x0,_0x340b5c=events[_0x68a4('0x6')];_0x3db8c1<_0x340b5c;_0x3db8c1++){var _0x214fd4=events[_0x3db8c1];var _0x542fb9=createListener('dashboard:'+_0x214fd4,_0x557d9c);DashboardEvents['on'](_0x214fd4,_0x542fb9);}}; \ No newline at end of file +var _0xe453=['register','length','dashboard:','./dashboard.events','save','update','removeListener'];(function(_0x43c6dd,_0x8adc97){var _0x19508e=function(_0x57f3f0){while(--_0x57f3f0){_0x43c6dd['push'](_0x43c6dd['shift']());}};_0x19508e(++_0x8adc97);}(_0xe453,0x1bc));var _0x3e45=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe453[_0x57b54c];return _0x59cc19;};'use strict';var DashboardEvents=require(_0x3e45('0x0'));var events=[_0x3e45('0x1'),'remove',_0x3e45('0x2')];function createListener(_0x20fb54,_0x8d9f10){return function(_0x5c3aa3){_0x8d9f10['emit'](_0x20fb54,_0x5c3aa3);};}function removeListener(_0x5dd2f1,_0x233c86){return function(){DashboardEvents[_0x3e45('0x3')](_0x5dd2f1,_0x233c86);};}exports[_0x3e45('0x4')]=function(_0x421351){for(var _0xe970d=0x0,_0x49de9b=events[_0x3e45('0x5')];_0xe970d<_0x49de9b;_0xe970d++){var _0x5eb549=events[_0xe970d];var _0x92926=createListener(_0x3e45('0x6')+_0x5eb549,_0x421351);DashboardEvents['on'](_0x5eb549,_0x92926);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6784a22..5856166 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 _0x05a5=['get','index','/:id','show','/:id/items','isAuthenticated','post','create','/:id/clone','clone','addItem','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x43506e,_0x671bd7){var _0x88dd16=function(_0x4b243e){while(--_0x4b243e){_0x43506e['push'](_0x43506e['shift']());}};_0x88dd16(++_0x671bd7);}(_0x05a5,0x1ef));var _0x505a=function(_0x24c5db,_0x2be89e){_0x24c5db=_0x24c5db-0x0;var _0x22f64a=_0x05a5[_0x24c5db];return _0x22f64a;};'use strict';var multer=require(_0x505a('0x0'));var util=require(_0x505a('0x1'));var path=require(_0x505a('0x2'));var timeout=require(_0x505a('0x3'));var express=require('express');var router=express[_0x505a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x505a('0x5'));var interaction=require(_0x505a('0x6'));var config=require(_0x505a('0x7'));var controller=require(_0x505a('0x8'));router[_0x505a('0x9')]('/',auth['isAuthenticated'](),controller[_0x505a('0xa')]);router[_0x505a('0x9')](_0x505a('0xb'),auth['isAuthenticated'](),controller[_0x505a('0xc')]);router[_0x505a('0x9')](_0x505a('0xd'),auth[_0x505a('0xe')](),controller['getItems']);router[_0x505a('0xf')]('/',auth[_0x505a('0xe')](),controller[_0x505a('0x10')]);router['post'](_0x505a('0x11'),auth[_0x505a('0xe')](),controller[_0x505a('0x12')]);router[_0x505a('0xf')](_0x505a('0xd'),auth[_0x505a('0xe')](),controller[_0x505a('0x13')]);router[_0x505a('0x14')]('/:id',auth[_0x505a('0xe')](),controller['update']);router[_0x505a('0x15')](_0x505a('0xb'),auth[_0x505a('0xe')](),controller[_0x505a('0x16')]);module[_0x505a('0x17')]=router; \ No newline at end of file +var _0x2656=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','/:id/clone','clone','addItem','put','delete','exports','util','express'];(function(_0x5cb459,_0xff9134){var _0x358dda=function(_0x59cab2){while(--_0x59cab2){_0x5cb459['push'](_0x5cb459['shift']());}};_0x358dda(++_0xff9134);}(_0x2656,0x139));var _0x6265=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x2656[_0x383356];return _0x32ee5a;};'use strict';var multer=require('multer');var util=require(_0x6265('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6265('0x1'));var router=express[_0x6265('0x2')]();var fs_extra=require(_0x6265('0x3'));var auth=require(_0x6265('0x4'));var interaction=require(_0x6265('0x5'));var config=require(_0x6265('0x6'));var controller=require(_0x6265('0x7'));router[_0x6265('0x8')]('/',auth[_0x6265('0x9')](),controller[_0x6265('0xa')]);router[_0x6265('0x8')](_0x6265('0xb'),auth[_0x6265('0x9')](),controller[_0x6265('0xc')]);router[_0x6265('0x8')]('/:id/items',auth['isAuthenticated'](),controller[_0x6265('0xd')]);router[_0x6265('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6265('0xe')](_0x6265('0xf'),auth[_0x6265('0x9')](),controller[_0x6265('0x10')]);router[_0x6265('0xe')]('/:id/items',auth[_0x6265('0x9')](),controller[_0x6265('0x11')]);router[_0x6265('0x12')](_0x6265('0xb'),auth[_0x6265('0x9')](),controller['update']);router[_0x6265('0x13')](_0x6265('0xb'),auth[_0x6265('0x9')](),controller['destroy']);module[_0x6265('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d5552fa..c664e9e 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 _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x189bdc,_0xcca79a){_0x189bdc=_0x189bdc-0x0;var _0x9c14f7=_0xb4c7[_0x189bdc];return _0x9c14f7;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x33b645,_0x1913a8){_0x33b645=_0x33b645-0x0;var _0x462041=_0x7a54[_0x33b645];return _0x462041;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ba6aa93..90eeb6e 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 _0x9536=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','fields','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x589449,_0xadacc6){var _0x288459=function(_0x2b3f47){while(--_0x2b3f47){_0x589449['push'](_0x589449['shift']());}};_0x288459(++_0xadacc6);}(_0x9536,0x179));var _0x6953=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x9536[_0x23a79e];return _0x3dab57;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];config[_0x6953('0x1a')]=_['defaults'](config[_0x6953('0x1a')],{'host':_0x6953('0x1b'),'port':0x18eb});var socket=require(_0x6953('0x1c'))(new Redis(config[_0x6953('0x1a')]));require(_0x6953('0x1d'))[_0x6953('0x1e')](socket);function respondWithStatusCode(_0x175fa9,_0x27a57c){_0x27a57c=_0x27a57c||0xcc;return function(_0x28433e){if(_0x28433e){return _0x175fa9[_0x6953('0x1f')](_0x27a57c);}return _0x175fa9[_0x6953('0x20')](_0x27a57c)['end']();};}function respondWithResult(_0x5f49db,_0x399b9b){_0x399b9b=_0x399b9b||0xc8;return function(_0x44e8a2){if(_0x44e8a2){return _0x5f49db[_0x6953('0x20')](_0x399b9b)[_0x6953('0x21')](_0x44e8a2);}};}function respondWithFilteredResult(_0x510d46,_0x1b6dcb){return function(_0x2da771){if(_0x2da771){var _0x4b43ae=typeof _0x1b6dcb[_0x6953('0x22')]===_0x6953('0x23')&&typeof _0x1b6dcb[_0x6953('0x24')]===_0x6953('0x23');var _0xc714d3=_0x2da771['count'];var _0x3a93e1=_0x4b43ae?0x0:_0x1b6dcb[_0x6953('0x22')];var _0x31d5fd=_0x4b43ae?_0x2da771[_0x6953('0x25')]:_0x1b6dcb[_0x6953('0x22')]+_0x1b6dcb['limit'];var _0xf96d07;if(_0x31d5fd>=_0xc714d3){_0x31d5fd=_0xc714d3;_0xf96d07=0xc8;}else{_0xf96d07=0xce;}_0x510d46[_0x6953('0x20')](_0xf96d07);return _0x510d46['set'](_0x6953('0x26'),_0x3a93e1+'-'+_0x31d5fd+'/'+_0xc714d3)[_0x6953('0x21')](_0x2da771);}return null;};}function patchUpdates(_0xb92529){return function(_0x171dd8){try{jsonpatch['apply'](_0x171dd8,_0xb92529,!![]);}catch(_0x37f339){return BPromise[_0x6953('0x27')](_0x37f339);}return _0x171dd8[_0x6953('0x28')]();};}function saveUpdates(_0x508ea7,_0x495ebd){return function(_0x5a4cd7){if(_0x5a4cd7){return _0x5a4cd7[_0x6953('0x29')](_0x508ea7)[_0x6953('0x2a')](function(_0x550be4){return _0x550be4;});}return null;};}function removeEntity(_0x1a32f4,_0x587df0){return function(_0x328f67){if(_0x328f67){return _0x328f67[_0x6953('0x2b')]()[_0x6953('0x2a')](function(){_0x1a32f4[_0x6953('0x20')](0xcc)[_0x6953('0x2c')]();});}};}function handleEntityNotFound(_0x1497e3,_0x53d3dc){return function(_0x3dd890){if(!_0x3dd890){_0x1497e3[_0x6953('0x1f')](0x194);}return _0x3dd890;};}function handleError(_0x527b9a,_0x3be82d){_0x3be82d=_0x3be82d||0x1f4;return function(_0x4af39d){logger[_0x6953('0x2d')](_0x4af39d[_0x6953('0x2e')]);if(_0x4af39d[_0x6953('0x2f')]){delete _0x4af39d['name'];}_0x527b9a[_0x6953('0x20')](_0x3be82d)[_0x6953('0x30')](_0x4af39d);};}exports[_0x6953('0x31')]=function(_0x47ed2f,_0x4c49fc){var _0x132a71={'raw':![],'where':{'id':_0x47ed2f['params']['id']}},_0x481c6a={};_0x481c6a[_0x6953('0x32')]=_[_0x6953('0x33')](db[_0x6953('0x34')][_0x6953('0x35')]);_0x481c6a[_0x6953('0x36')]=_['keys'](_0x47ed2f[_0x6953('0x36')]);_0x481c6a['filters']=_[_0x6953('0x37')](_0x481c6a[_0x6953('0x32')],_0x481c6a['query']);_0x132a71['attributes']=_[_0x6953('0x37')](_0x481c6a[_0x6953('0x32')],qs[_0x6953('0x38')](_0x47ed2f['query'][_0x6953('0x38')]));_0x132a71['attributes']=_0x132a71['attributes']['length']?_0x132a71['attributes']:_0x481c6a[_0x6953('0x32')];if(_0x47ed2f[_0x6953('0x36')][_0x6953('0x39')]){_0x132a71[_0x6953('0x3a')]=[{'all':!![]}];}_0x132a71=_[_0x6953('0x3b')]({},_0x132a71,_0x47ed2f[_0x6953('0x3c')]);return db['DashboardItem'][_0x6953('0x3d')](_0x132a71)['then'](handleEntityNotFound(_0x4c49fc,null))[_0x6953('0x2a')](respondWithResult(_0x4c49fc,null))['catch'](handleError(_0x4c49fc,null));};exports[_0x6953('0x2b')]=function(_0x383e31,_0xd81149){return db[_0x6953('0x34')]['find']({'where':{'id':_0x383e31[_0x6953('0x3e')]['id']}})[_0x6953('0x2a')](handleEntityNotFound(_0xd81149,null))[_0x6953('0x2a')](removeEntity(_0xd81149,null))[_0x6953('0x3f')](handleError(_0xd81149,null));};function widgetAttributes(_0x40b6ea){try{switch(_0x40b6ea[_0x6953('0x40')]){case _0x6953('0x41'):return[{'name':_0x6953('0x42'),'value':_0x40b6ea[_0x6953('0x42')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x0]?_0x40b6ea['attrs'][0x0][_0x6953('0x44')]:undefined)||_0x6953('0x45')}];case _0x6953('0x46'):return[{'name':'attrPath','value':_0x40b6ea['attrPath']||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x0]?_0x40b6ea['attrs'][0x0][_0x6953('0x44')]:undefined)||''}];case _0x6953('0x47'):return[{'name':'attrHourFormat','value':_0x40b6ea[_0x6953('0x48')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x0]?_0x40b6ea[_0x6953('0x43')][0x0][_0x6953('0x44')]:undefined)||_0x6953('0x49')},{'name':'attrTimezone','value':_0x40b6ea[_0x6953('0x4a')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x1]?_0x40b6ea[_0x6953('0x43')][0x1][_0x6953('0x44')]:undefined)||_0x6953('0x4b')},{'name':'attrFontSize','value':_0x40b6ea['attrFontSize']||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x2]?_0x40b6ea['attrs'][0x2][_0x6953('0x44')]:undefined)||0xc}];case _0x6953('0x4c'):return[{'name':_0x6953('0x4d'),'value':_0x40b6ea[_0x6953('0x4d')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x0]?_0x40b6ea['attrs'][0x0][_0x6953('0x44')]:undefined)||_0x6953('0x4e')},{'name':'attrVoiceQueues','value':_0x40b6ea[_0x6953('0x4f')]||(_0x40b6ea['attrs']&&_0x40b6ea[_0x6953('0x43')][0x1]?_0x40b6ea[_0x6953('0x43')][0x1][_0x6953('0x44')]:undefined)||[]},{'name':_0x6953('0x50'),'value':_0x40b6ea['attrFontSize']||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x2]?_0x40b6ea['attrs'][0x2][_0x6953('0x44')]:undefined)||0x14},{'name':_0x6953('0x51'),'value':_0x40b6ea[_0x6953('0x51')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x3]?_0x40b6ea[_0x6953('0x43')][0x3][_0x6953('0x44')]:undefined)||_0x6953('0x52')},{'name':_0x6953('0x53'),'value':_0x40b6ea[_0x6953('0x53')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x4]?_0x40b6ea[_0x6953('0x43')][0x4]['value']:undefined)||''},{'name':_0x6953('0x54'),'value':_0x40b6ea[_0x6953('0x54')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x5]?_0x40b6ea[_0x6953('0x43')][0x5][_0x6953('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x40b6ea['attrSmsAccounts']||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x6]?_0x40b6ea[_0x6953('0x43')][0x6][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x55'),'value':_0x40b6ea[_0x6953('0x55')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x7]?_0x40b6ea[_0x6953('0x43')][0x7][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x56'),'value':_0x40b6ea['attrWhatsappAccounts']||(_0x40b6ea['attrs']&&_0x40b6ea[_0x6953('0x43')][0x8]?_0x40b6ea[_0x6953('0x43')][0x8][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x57'),'value':_0x40b6ea[_0x6953('0x57')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x9]?_0x40b6ea[_0x6953('0x43')][0x9][_0x6953('0x44')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x40b6ea['attrSerie1']||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x0]?_0x40b6ea[_0x6953('0x43')][0x0]['value']:undefined)||'total'},{'name':_0x6953('0x58'),'value':_0x40b6ea[_0x6953('0x58')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x1]?_0x40b6ea['attrs'][0x1][_0x6953('0x44')]:undefined)||null},{'name':_0x6953('0x59'),'value':_0x40b6ea['attrSerie3']||(_0x40b6ea['attrs']&&_0x40b6ea[_0x6953('0x43')][0x2]?_0x40b6ea[_0x6953('0x43')][0x2][_0x6953('0x44')]:undefined)||null},{'name':_0x6953('0x4f'),'value':_0x40b6ea[_0x6953('0x4f')]||(_0x40b6ea['attrs']&&_0x40b6ea[_0x6953('0x43')][0x3]?_0x40b6ea[_0x6953('0x43')][0x3]['value']:undefined)||[]},{'name':_0x6953('0x51'),'value':_0x40b6ea['attrChannel']||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x4]?_0x40b6ea[_0x6953('0x43')][0x4][_0x6953('0x44')]:undefined)||'voice'},{'name':_0x6953('0x53'),'value':_0x40b6ea[_0x6953('0x53')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x5]?_0x40b6ea['attrs'][0x5][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x54'),'value':_0x40b6ea[_0x6953('0x54')]||(_0x40b6ea['attrs']&&_0x40b6ea['attrs'][0x6]?_0x40b6ea[_0x6953('0x43')][0x6][_0x6953('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x40b6ea[_0x6953('0x5a')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x7]?_0x40b6ea[_0x6953('0x43')][0x7][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x55'),'value':_0x40b6ea[_0x6953('0x55')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea['attrs'][0x8]?_0x40b6ea[_0x6953('0x43')][0x8][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x56'),'value':_0x40b6ea['attrWhatsappAccounts']||(_0x40b6ea['attrs']&&_0x40b6ea[_0x6953('0x43')][0x9]?_0x40b6ea[_0x6953('0x43')][0x9][_0x6953('0x44')]:undefined)||''},{'name':_0x6953('0x57'),'value':_0x40b6ea[_0x6953('0x57')]||(_0x40b6ea['attrs']&&_0x40b6ea[_0x6953('0x43')][0xa]?_0x40b6ea[_0x6953('0x43')][0xa][_0x6953('0x44')]:undefined)||''}];case _0x6953('0x5b'):return[{'name':_0x6953('0x5c'),'type':_0x40b6ea[_0x6953('0x5d')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x0]?_0x40b6ea[_0x6953('0x43')][0x0][_0x6953('0x40')]:undefined)||null,'value':_0x40b6ea[_0x6953('0x5c')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x0]?_0x40b6ea['attrs'][0x0][_0x6953('0x44')]:undefined)||null},{'name':_0x6953('0x5e'),'value':_0x40b6ea[_0x6953('0x5e')]||(_0x40b6ea[_0x6953('0x43')]&&_0x40b6ea[_0x6953('0x43')][0x1]?_0x40b6ea['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x310a90){logger['error'](_0x6953('0x5f'),JSON[_0x6953('0x60')](_0x310a90));return[];}}exports[_0x6953('0x61')]=function(_0x235739,_0x4c8e6c){if(_0x235739[_0x6953('0x62')]){_0x235739[_0x6953('0x62')][_0x6953('0x43')]=widgetAttributes(_0x235739[_0x6953('0x62')]);}return db[_0x6953('0x34')][_0x6953('0x61')](_0x235739[_0x6953('0x62')],{})[_0x6953('0x2a')](respondWithResult(_0x4c8e6c,0xc9))[_0x6953('0x3f')](handleError(_0x4c8e6c,null));};exports[_0x6953('0x29')]=function(_0xb2ce56,_0xce3eef){if(_0xb2ce56[_0x6953('0x62')]['id']){delete _0xb2ce56[_0x6953('0x62')]['id'];}_0xb2ce56[_0x6953('0x62')]['attrs']=widgetAttributes(_0xb2ce56[_0x6953('0x62')]);return db[_0x6953('0x34')][_0x6953('0x3d')]({'where':{'id':_0xb2ce56[_0x6953('0x3e')]['id']}})[_0x6953('0x2a')](handleEntityNotFound(_0xce3eef,null))[_0x6953('0x2a')](saveUpdates(_0xb2ce56[_0x6953('0x62')],null))['then'](respondWithResult(_0xce3eef,null))[_0x6953('0x3f')](handleError(_0xce3eef,null));}; \ No newline at end of file +var _0xdc59=['stringify','body','create','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','undefined','limit','status','Content-Range','apply','reject','update','destroy','error','stack','name','show','keys','DashboardItem','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','then','catch','params','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s'];(function(_0xe973f7,_0x3c1c67){var _0x4f804d=function(_0x180ce){while(--_0x180ce){_0xe973f7['push'](_0xe973f7['shift']());}};_0x4f804d(++_0x3c1c67);}(_0xdc59,0x12c));var _0x9dc5=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xdc59[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0x9dc5('0x0'));var rimraf=require(_0x9dc5('0x1'));var zipdir=require(_0x9dc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dc5('0x3'));var BPromise=require(_0x9dc5('0x4'));var Mustache=require(_0x9dc5('0x5'));var util=require(_0x9dc5('0x6'));var path=require(_0x9dc5('0x7'));var sox=require(_0x9dc5('0x8'));var csv=require(_0x9dc5('0x9'));var ejs=require(_0x9dc5('0xa'));var fs=require('fs');var fs_extra=require(_0x9dc5('0xb'));var _=require('lodash');var squel=require(_0x9dc5('0xc'));var crypto=require(_0x9dc5('0xd'));var jsforce=require(_0x9dc5('0xe'));var deskjs=require(_0x9dc5('0xf'));var toCsv=require(_0x9dc5('0x9'));var querystring=require(_0x9dc5('0x10'));var Papa=require(_0x9dc5('0x11'));var Redis=require(_0x9dc5('0x12'));var authService=require(_0x9dc5('0x13'));var qs=require(_0x9dc5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dc5('0x15'));var logger=require(_0x9dc5('0x16'))(_0x9dc5('0x17'));var utils=require(_0x9dc5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9dc5('0x19'));var db=require(_0x9dc5('0x1a'))['db'];config[_0x9dc5('0x1b')]=_['defaults'](config[_0x9dc5('0x1b')],{'host':_0x9dc5('0x1c'),'port':0x18eb});var socket=require(_0x9dc5('0x1d'))(new Redis(config[_0x9dc5('0x1b')]));require(_0x9dc5('0x1e'))[_0x9dc5('0x1f')](socket);function respondWithStatusCode(_0x786239,_0x1abc3f){_0x1abc3f=_0x1abc3f||0xcc;return function(_0x755ef){if(_0x755ef){return _0x786239[_0x9dc5('0x20')](_0x1abc3f);}return _0x786239['status'](_0x1abc3f)[_0x9dc5('0x21')]();};}function respondWithResult(_0x5ebe8b,_0x76737f){_0x76737f=_0x76737f||0xc8;return function(_0x9c1b35){if(_0x9c1b35){return _0x5ebe8b['status'](_0x76737f)[_0x9dc5('0x22')](_0x9c1b35);}};}function respondWithFilteredResult(_0x2f195a,_0x17e8d1){return function(_0x16fca8){if(_0x16fca8){var _0x4e1529=typeof _0x17e8d1[_0x9dc5('0x23')]===_0x9dc5('0x24')&&typeof _0x17e8d1[_0x9dc5('0x25')]===_0x9dc5('0x24');var _0x4100e7=_0x16fca8['count'];var _0x6355d2=_0x4e1529?0x0:_0x17e8d1[_0x9dc5('0x23')];var _0x8e7b1c=_0x4e1529?_0x16fca8['count']:_0x17e8d1['offset']+_0x17e8d1[_0x9dc5('0x25')];var _0x5e2da8;if(_0x8e7b1c>=_0x4100e7){_0x8e7b1c=_0x4100e7;_0x5e2da8=0xc8;}else{_0x5e2da8=0xce;}_0x2f195a[_0x9dc5('0x26')](_0x5e2da8);return _0x2f195a['set'](_0x9dc5('0x27'),_0x6355d2+'-'+_0x8e7b1c+'/'+_0x4100e7)['json'](_0x16fca8);}return null;};}function patchUpdates(_0x100ae7){return function(_0x4c885f){try{jsonpatch[_0x9dc5('0x28')](_0x4c885f,_0x100ae7,!![]);}catch(_0x1c3726){return BPromise[_0x9dc5('0x29')](_0x1c3726);}return _0x4c885f['save']();};}function saveUpdates(_0x184d78,_0x319d42){return function(_0xa55ce){if(_0xa55ce){return _0xa55ce[_0x9dc5('0x2a')](_0x184d78)['then'](function(_0x4ba5d2){return _0x4ba5d2;});}return null;};}function removeEntity(_0xdeab68,_0xf6da02){return function(_0x4570ed){if(_0x4570ed){return _0x4570ed[_0x9dc5('0x2b')]()['then'](function(){_0xdeab68['status'](0xcc)[_0x9dc5('0x21')]();});}};}function handleEntityNotFound(_0x427cc3,_0x483778){return function(_0xd1b613){if(!_0xd1b613){_0x427cc3[_0x9dc5('0x20')](0x194);}return _0xd1b613;};}function handleError(_0x3ddade,_0x5742e8){_0x5742e8=_0x5742e8||0x1f4;return function(_0x4777f0){logger[_0x9dc5('0x2c')](_0x4777f0[_0x9dc5('0x2d')]);if(_0x4777f0[_0x9dc5('0x2e')]){delete _0x4777f0[_0x9dc5('0x2e')];}_0x3ddade[_0x9dc5('0x26')](_0x5742e8)['send'](_0x4777f0);};}exports[_0x9dc5('0x2f')]=function(_0x25e8e9,_0x21b243){var _0x19b9b5={'raw':![],'where':{'id':_0x25e8e9['params']['id']}},_0x420158={};_0x420158['model']=_[_0x9dc5('0x30')](db[_0x9dc5('0x31')]['rawAttributes']);_0x420158[_0x9dc5('0x32')]=_[_0x9dc5('0x30')](_0x25e8e9[_0x9dc5('0x32')]);_0x420158[_0x9dc5('0x33')]=_[_0x9dc5('0x34')](_0x420158[_0x9dc5('0x35')],_0x420158[_0x9dc5('0x32')]);_0x19b9b5[_0x9dc5('0x36')]=_[_0x9dc5('0x34')](_0x420158['model'],qs[_0x9dc5('0x37')](_0x25e8e9[_0x9dc5('0x32')][_0x9dc5('0x37')]));_0x19b9b5[_0x9dc5('0x36')]=_0x19b9b5[_0x9dc5('0x36')][_0x9dc5('0x38')]?_0x19b9b5['attributes']:_0x420158[_0x9dc5('0x35')];if(_0x25e8e9['query'][_0x9dc5('0x39')]){_0x19b9b5['include']=[{'all':!![]}];}_0x19b9b5=_[_0x9dc5('0x3a')]({},_0x19b9b5,_0x25e8e9[_0x9dc5('0x3b')]);return db[_0x9dc5('0x31')][_0x9dc5('0x3c')](_0x19b9b5)[_0x9dc5('0x3d')](handleEntityNotFound(_0x21b243,null))[_0x9dc5('0x3d')](respondWithResult(_0x21b243,null))[_0x9dc5('0x3e')](handleError(_0x21b243,null));};exports[_0x9dc5('0x2b')]=function(_0x1c23fd,_0x216622){return db[_0x9dc5('0x31')]['find']({'where':{'id':_0x1c23fd[_0x9dc5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x216622,null))[_0x9dc5('0x3d')](removeEntity(_0x216622,null))[_0x9dc5('0x3e')](handleError(_0x216622,null));};function widgetAttributes(_0x2fb7ea){try{switch(_0x2fb7ea['type']){case _0x9dc5('0x40'):return[{'name':_0x9dc5('0x41'),'value':_0x2fb7ea[_0x9dc5('0x41')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x44')}];case'custom':return[{'name':_0x9dc5('0x45'),'value':_0x2fb7ea[_0x9dc5('0x45')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea['attrs'][0x0][_0x9dc5('0x43')]:undefined)||''}];case'clock':return[{'name':_0x9dc5('0x46'),'value':_0x2fb7ea[_0x9dc5('0x46')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x9dc5('0x47'),'value':_0x2fb7ea[_0x9dc5('0x47')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x1]?_0x2fb7ea['attrs'][0x1][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x48')},{'name':_0x9dc5('0x49'),'value':_0x2fb7ea[_0x9dc5('0x49')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea['attrs'][0x2]?_0x2fb7ea['attrs'][0x2][_0x9dc5('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x9dc5('0x4a'),'value':_0x2fb7ea[_0x9dc5('0x4a')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x4b')},{'name':_0x9dc5('0x4c'),'value':_0x2fb7ea[_0x9dc5('0x4c')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x1]?_0x2fb7ea[_0x9dc5('0x42')][0x1]['value']:undefined)||[]},{'name':_0x9dc5('0x49'),'value':_0x2fb7ea[_0x9dc5('0x49')]||(_0x2fb7ea['attrs']&&_0x2fb7ea['attrs'][0x2]?_0x2fb7ea[_0x9dc5('0x42')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x2fb7ea[_0x9dc5('0x4d')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x3]?_0x2fb7ea[_0x9dc5('0x42')][0x3]['value']:undefined)||_0x9dc5('0x4e')},{'name':'attrEmailAccounts','value':_0x2fb7ea[_0x9dc5('0x4f')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x4]?_0x2fb7ea['attrs'][0x4]['value']:undefined)||''},{'name':_0x9dc5('0x50'),'value':_0x2fb7ea[_0x9dc5('0x50')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x5]?_0x2fb7ea['attrs'][0x5][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x51'),'value':_0x2fb7ea['attrSmsAccounts']||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x6]?_0x2fb7ea[_0x9dc5('0x42')][0x6][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x52'),'value':_0x2fb7ea[_0x9dc5('0x52')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea['attrs'][0x7]?_0x2fb7ea[_0x9dc5('0x42')][0x7][_0x9dc5('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2fb7ea[_0x9dc5('0x53')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x8]?_0x2fb7ea[_0x9dc5('0x42')][0x8]['value']:undefined)||''},{'name':_0x9dc5('0x54'),'value':_0x2fb7ea[_0x9dc5('0x54')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x9]?_0x2fb7ea[_0x9dc5('0x42')][0x9][_0x9dc5('0x43')]:undefined)||''}];case _0x9dc5('0x55'):case _0x9dc5('0x56'):return[{'name':_0x9dc5('0x57'),'value':_0x2fb7ea['attrSerie1']||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea['attrs'][0x0][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x4b')},{'name':_0x9dc5('0x58'),'value':_0x2fb7ea[_0x9dc5('0x58')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x1]?_0x2fb7ea[_0x9dc5('0x42')][0x1][_0x9dc5('0x43')]:undefined)||null},{'name':_0x9dc5('0x59'),'value':_0x2fb7ea[_0x9dc5('0x59')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea['attrs'][0x2]?_0x2fb7ea[_0x9dc5('0x42')][0x2]['value']:undefined)||null},{'name':_0x9dc5('0x4c'),'value':_0x2fb7ea[_0x9dc5('0x4c')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x3]?_0x2fb7ea[_0x9dc5('0x42')][0x3][_0x9dc5('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x2fb7ea[_0x9dc5('0x4d')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x4]?_0x2fb7ea[_0x9dc5('0x42')][0x4][_0x9dc5('0x43')]:undefined)||_0x9dc5('0x4e')},{'name':_0x9dc5('0x4f'),'value':_0x2fb7ea[_0x9dc5('0x4f')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x5]?_0x2fb7ea[_0x9dc5('0x42')][0x5][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x50'),'value':_0x2fb7ea[_0x9dc5('0x50')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x6]?_0x2fb7ea[_0x9dc5('0x42')][0x6][_0x9dc5('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2fb7ea['attrSmsAccounts']||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x7]?_0x2fb7ea[_0x9dc5('0x42')][0x7][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x52'),'value':_0x2fb7ea[_0x9dc5('0x52')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x8]?_0x2fb7ea[_0x9dc5('0x42')][0x8][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x53'),'value':_0x2fb7ea[_0x9dc5('0x53')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x9]?_0x2fb7ea[_0x9dc5('0x42')][0x9][_0x9dc5('0x43')]:undefined)||''},{'name':_0x9dc5('0x54'),'value':_0x2fb7ea[_0x9dc5('0x54')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0xa]?_0x2fb7ea[_0x9dc5('0x42')][0xa][_0x9dc5('0x43')]:undefined)||''}];case _0x9dc5('0x5a'):return[{'name':_0x9dc5('0x5b'),'type':_0x2fb7ea[_0x9dc5('0x5c')]||(_0x2fb7ea['attrs']&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x5d')]:undefined)||null,'value':_0x2fb7ea[_0x9dc5('0x5b')]||(_0x2fb7ea[_0x9dc5('0x42')]&&_0x2fb7ea[_0x9dc5('0x42')][0x0]?_0x2fb7ea[_0x9dc5('0x42')][0x0][_0x9dc5('0x43')]:undefined)||null},{'name':_0x9dc5('0x5e'),'value':_0x2fb7ea['attrRefresh']||(_0x2fb7ea['attrs']&&_0x2fb7ea['attrs'][0x1]?_0x2fb7ea['attrs'][0x1][_0x9dc5('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x9ec9e6){logger[_0x9dc5('0x2c')](_0x9dc5('0x5f'),JSON[_0x9dc5('0x60')](_0x9ec9e6));return[];}}exports['create']=function(_0x379fe6,_0x141c26){if(_0x379fe6[_0x9dc5('0x61')]){_0x379fe6[_0x9dc5('0x61')]['attrs']=widgetAttributes(_0x379fe6['body']);}return db['DashboardItem'][_0x9dc5('0x62')](_0x379fe6['body'],{})['then'](respondWithResult(_0x141c26,0xc9))[_0x9dc5('0x3e')](handleError(_0x141c26,null));};exports[_0x9dc5('0x2a')]=function(_0x36b51,_0x414e7d){if(_0x36b51[_0x9dc5('0x61')]['id']){delete _0x36b51[_0x9dc5('0x61')]['id'];}_0x36b51['body'][_0x9dc5('0x42')]=widgetAttributes(_0x36b51['body']);return db[_0x9dc5('0x31')][_0x9dc5('0x3c')]({'where':{'id':_0x36b51['params']['id']}})[_0x9dc5('0x3d')](handleEntityNotFound(_0x414e7d,null))[_0x9dc5('0x3d')](saveUpdates(_0x36b51[_0x9dc5('0x61')],null))[_0x9dc5('0x3d')](respondWithResult(_0x414e7d,null))['catch'](handleError(_0x414e7d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index c5d547a..c7af565 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 _0x6d73=['DashboardItem','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x363618,_0x5ebf3a){var _0x496dee=function(_0x3b312a){while(--_0x3b312a){_0x363618['push'](_0x363618['shift']());}};_0x496dee(++_0x5ebf3a);}(_0x6d73,0x132));var _0x36d7=function(_0x3a3500,_0x37c562){_0x3a3500=_0x3a3500-0x0;var _0x84a50d=_0x6d73[_0x3a3500];return _0x84a50d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x36d7('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x36d7('0x1')](0x0);var events={'afterCreate':_0x36d7('0x2'),'afterUpdate':'update','afterDestroy':_0x36d7('0x3')};function emitEvent(_0x3fe4a2){return function(_0x36195c,_0x4dfe92,_0x704d55){DashboardItemEvents['emit'](_0x3fe4a2+':'+_0x36195c['id'],_0x36195c);DashboardItemEvents['emit'](_0x3fe4a2,_0x36195c);_0x704d55(null);};}for(var e in events){if(events[_0x36d7('0x4')](e)){var event=events[e];DashboardItem[_0x36d7('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x7fad=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x4ef026,_0x564b03){var _0x1dbc6c=function(_0x19ef73){while(--_0x19ef73){_0x4ef026['push'](_0x4ef026['shift']());}};_0x1dbc6c(++_0x564b03);}(_0x7fad,0x111));var _0xd7fa=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x7fad[_0x438fe1];return _0x3c8e1b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd7fa('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd7fa('0x1')](0x0);var events={'afterCreate':_0xd7fa('0x2'),'afterUpdate':_0xd7fa('0x3'),'afterDestroy':_0xd7fa('0x4')};function emitEvent(_0x4141d3){return function(_0x5caa2f,_0x27473f,_0x5eb62f){DashboardItemEvents[_0xd7fa('0x5')](_0x4141d3+':'+_0x5caa2f['id'],_0x5caa2f);DashboardItemEvents[_0xd7fa('0x5')](_0x4141d3,_0x5caa2f);_0x5eb62f(null);};}for(var e in events){if(events[_0xd7fa('0x6')](e)){var event=events[e];DashboardItem[_0xd7fa('0x7')](e,emitEvent(event));}}module[_0xd7fa('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a9e713a..67ac37b 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 _0x5e93=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0x5e93,0x174));var _0x35e9=function(_0x47e3d8,_0x2653ed){_0x47e3d8=_0x47e3d8-0x0;var _0x2e1d64=_0x5e93[_0x47e3d8];return _0x2e1d64;};'use strict';var _=require(_0x35e9('0x0'));var util=require(_0x35e9('0x1'));var logger=require(_0x35e9('0x2'))(_0x35e9('0x3'));var moment=require(_0x35e9('0x4'));var BPromise=require(_0x35e9('0x5'));var rp=require(_0x35e9('0x6'));var fs=require('fs');var path=require(_0x35e9('0x7'));var rimraf=require(_0x35e9('0x8'));var config=require(_0x35e9('0x9'));var attributes=require(_0x35e9('0xa'));module[_0x35e9('0xb')]=function(_0x47d2a8,_0x115d4c){return _0x47d2a8[_0x35e9('0xc')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7005=['define','DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0x7005,0x148));var _0x5700=function(_0x11a4f8,_0x45795c){_0x11a4f8=_0x11a4f8-0x0;var _0x36bb09=_0x7005[_0x11a4f8];return _0x36bb09;};'use strict';var _=require('lodash');var util=require(_0x5700('0x0'));var logger=require(_0x5700('0x1'))(_0x5700('0x2'));var moment=require(_0x5700('0x3'));var BPromise=require(_0x5700('0x4'));var rp=require(_0x5700('0x5'));var fs=require('fs');var path=require(_0x5700('0x6'));var rimraf=require(_0x5700('0x7'));var config=require(_0x5700('0x8'));var attributes=require(_0x5700('0x9'));module['exports']=function(_0x97c365,_0x212fab){return _0x97c365[_0x5700('0xa')](_0x5700('0xb'),attributes,{'tableName':_0x5700('0xc'),'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 9e169af..c7c07ba 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 _0x741d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x50f9b9,_0x248106){var _0x484aaf=function(_0x443064){while(--_0x443064){_0x50f9b9['push'](_0x50f9b9['shift']());}};_0x484aaf(++_0x248106);}(_0x741d,0x1c9));var _0xd741=function(_0x46ba20,_0x48368b){_0x46ba20=_0x46ba20-0x0;var _0xfffa9e=_0x741d[_0x46ba20];return _0xfffa9e;};'use strict';var _=require(_0xd741('0x0'));var util=require('util');var moment=require(_0xd741('0x1'));var BPromise=require(_0xd741('0x2'));var rs=require(_0xd741('0x3'));var fs=require('fs');var Redis=require(_0xd741('0x4'));var db=require(_0xd741('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd741('0x6'))(_0xd741('0x7'));var config=require('../../config/environment');var jayson=require(_0xd741('0x8'));var client=jayson[_0xd741('0x9')][_0xd741('0xa')]({'port':0x232a});config[_0xd741('0xb')]=_[_0xd741('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd741('0xb')]));require(_0xd741('0xd'))[_0xd741('0xe')](socket);function respondWithRpcPromise(_0x22d910,_0x4e6a7b,_0x33abaf){return new BPromise(function(_0x3e305c,_0x37c04c){return client['request'](_0x22d910,_0x33abaf)[_0xd741('0xf')](function(_0x43eb80){logger[_0xd741('0x10')](_0xd741('0x11'),_0x4e6a7b,'request\x20sent');logger[_0xd741('0x12')](_0xd741('0x13'),_0x4e6a7b,_0xd741('0x14'),JSON[_0xd741('0x15')](_0x43eb80));if(_0x43eb80[_0xd741('0x16')]){if(_0x43eb80[_0xd741('0x16')][_0xd741('0x17')]===0x1f4){logger[_0xd741('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4e6a7b,_0x43eb80[_0xd741('0x16')]['message']);return _0x37c04c(_0x43eb80[_0xd741('0x16')][_0xd741('0x18')]);}logger[_0xd741('0x16')](_0xd741('0x11'),_0x4e6a7b,_0x43eb80['error'][_0xd741('0x18')]);return _0x3e305c(_0x43eb80[_0xd741('0x16')]['message']);}else{logger[_0xd741('0x10')](_0xd741('0x11'),_0x4e6a7b,_0xd741('0x14'));_0x3e305c(_0x43eb80[_0xd741('0x19')][_0xd741('0x18')]);}})[_0xd741('0x1a')](function(_0x458ba6){logger[_0xd741('0x16')](_0xd741('0x11'),_0x4e6a7b,_0x458ba6);_0x37c04c(_0x458ba6);});});} \ No newline at end of file +var _0xe9fe=['DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9fe,0xd8));var _0xee9f=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0xe9fe[_0x2e986d];return _0x351c79;};'use strict';var _=require('lodash');var util=require(_0xee9f('0x0'));var moment=require(_0xee9f('0x1'));var BPromise=require(_0xee9f('0x2'));var rs=require(_0xee9f('0x3'));var fs=require('fs');var Redis=require(_0xee9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xee9f('0x5'));var logger=require('../../config/logger')(_0xee9f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee9f('0x7'));var client=jayson[_0xee9f('0x8')][_0xee9f('0x9')]({'port':0x232a});config[_0xee9f('0xa')]=_[_0xee9f('0xb')](config['redis'],{'host':_0xee9f('0xc'),'port':0x18eb});var socket=require(_0xee9f('0xd'))(new Redis(config[_0xee9f('0xa')]));require('./dashboardItem.socket')[_0xee9f('0xe')](socket);function respondWithRpcPromise(_0x4027d8,_0x2b8d67,_0x2ac81e){return new BPromise(function(_0x4b3681,_0x2cacce){return client[_0xee9f('0xf')](_0x4027d8,_0x2ac81e)[_0xee9f('0x10')](function(_0x1f8fed){logger[_0xee9f('0x11')](_0xee9f('0x12'),_0x2b8d67,'request\x20sent');logger[_0xee9f('0x13')](_0xee9f('0x14'),_0x2b8d67,_0xee9f('0x15'),JSON[_0xee9f('0x16')](_0x1f8fed));if(_0x1f8fed['error']){if(_0x1f8fed[_0xee9f('0x17')]['code']===0x1f4){logger[_0xee9f('0x17')](_0xee9f('0x12'),_0x2b8d67,_0x1f8fed['error'][_0xee9f('0x18')]);return _0x2cacce(_0x1f8fed['error']['message']);}logger['error'](_0xee9f('0x12'),_0x2b8d67,_0x1f8fed[_0xee9f('0x17')][_0xee9f('0x18')]);return _0x4b3681(_0x1f8fed[_0xee9f('0x17')][_0xee9f('0x18')]);}else{logger[_0xee9f('0x11')](_0xee9f('0x12'),_0x2b8d67,_0xee9f('0x15'));_0x4b3681(_0x1f8fed['result']['message']);}})[_0xee9f('0x19')](function(_0x52cf25){logger[_0xee9f('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2b8d67,_0x52cf25);_0x2cacce(_0x52cf25);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5e5ba98..eb61e10 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 _0x26e0=['register','length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x26e0,0x133));var _0x026e=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x26e0[_0x2353fe];return _0x4d43f6;};'use strict';var DashboardItemEvents=require(_0x026e('0x0'));var events=['save',_0x026e('0x1'),_0x026e('0x2')];function createListener(_0x1a514f,_0x4191ad){return function(_0x563fd3){_0x4191ad[_0x026e('0x3')](_0x1a514f,_0x563fd3);};}function removeListener(_0x727ffb,_0x2183e0){return function(){DashboardItemEvents[_0x026e('0x4')](_0x727ffb,_0x2183e0);};}exports[_0x026e('0x5')]=function(_0x4107a3){for(var _0x51b54b=0x0,_0x3eabf6=events[_0x026e('0x6')];_0x51b54b<_0x3eabf6;_0x51b54b++){var _0x5665ce=events[_0x51b54b];var _0x7c3627=createListener(_0x026e('0x7')+_0x5665ce,_0x4107a3);DashboardItemEvents['on'](_0x5665ce,_0x7c3627);}}; \ No newline at end of file +var _0x898a=['emit','removeListener','register','dashboardItem:','save','update'];(function(_0x4d6099,_0x2d39f7){var _0x1c62a6=function(_0x54589a){while(--_0x54589a){_0x4d6099['push'](_0x4d6099['shift']());}};_0x1c62a6(++_0x2d39f7);}(_0x898a,0x148));var _0xa898=function(_0x250ce5,_0x3ea442){_0x250ce5=_0x250ce5-0x0;var _0x1b5fc2=_0x898a[_0x250ce5];return _0x1b5fc2;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xa898('0x0'),'remove',_0xa898('0x1')];function createListener(_0x5cd018,_0x213aea){return function(_0x309396){_0x213aea[_0xa898('0x2')](_0x5cd018,_0x309396);};}function removeListener(_0x229442,_0x146710){return function(){DashboardItemEvents[_0xa898('0x3')](_0x229442,_0x146710);};}exports[_0xa898('0x4')]=function(_0x38deed){for(var _0x2014dc=0x0,_0x1ef16e=events['length'];_0x2014dc<_0x1ef16e;_0x2014dc++){var _0x1dca11=events[_0x2014dc];var _0x434bc7=createListener(_0xa898('0x5')+_0x1dca11,_0x38deed);DashboardItemEvents['on'](_0x1dca11,_0x434bc7);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 68af86f..6dc7903 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 _0x5bec=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','isAuthenticated','create','put','delete','destroy'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x5bec,0x16a));var _0xc5be=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5bec[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xc5be('0x0'));var util=require(_0xc5be('0x1'));var path=require(_0xc5be('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5be('0x3'));var router=express[_0xc5be('0x4')]();var fs_extra=require(_0xc5be('0x5'));var auth=require(_0xc5be('0x6'));var interaction=require(_0xc5be('0x7'));var config=require(_0xc5be('0x8'));var controller=require(_0xc5be('0x9'));router[_0xc5be('0xa')](_0xc5be('0xb'),auth['isAuthenticated'](),controller[_0xc5be('0xc')]);router['post']('/',auth[_0xc5be('0xd')](),controller[_0xc5be('0xe')]);router[_0xc5be('0xf')]('/:id',auth[_0xc5be('0xd')](),controller['update']);router[_0xc5be('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc5be('0x11')]);module[_0xc5be('0x12')]=router; \ No newline at end of file +var _0xe551=['../../config/environment','./dashboardItem.controller','get','/:id','show','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe551,0x1ad));var _0x1e55=function(_0x405c05,_0xc11553){_0x405c05=_0x405c05-0x0;var _0x4d48fe=_0xe551[_0x405c05];return _0x4d48fe;};'use strict';var multer=require(_0x1e55('0x0'));var util=require('util');var path=require(_0x1e55('0x1'));var timeout=require(_0x1e55('0x2'));var express=require(_0x1e55('0x3'));var router=express[_0x1e55('0x4')]();var fs_extra=require(_0x1e55('0x5'));var auth=require(_0x1e55('0x6'));var interaction=require(_0x1e55('0x7'));var config=require(_0x1e55('0x8'));var controller=require(_0x1e55('0x9'));router[_0x1e55('0xa')](_0x1e55('0xb'),auth['isAuthenticated'](),controller[_0x1e55('0xc')]);router['post']('/',auth[_0x1e55('0xd')](),controller[_0x1e55('0xe')]);router[_0x1e55('0xf')](_0x1e55('0xb'),auth[_0x1e55('0xd')](),controller['update']);router[_0x1e55('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1e55('0x11')]);module[_0x1e55('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 8eb271f..a724cb4 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 _0xf81e=['sequelize','STRING','ENUM','first','second'];(function(_0x1c2c28,_0x3857f7){var _0x23a521=function(_0x4ba1c8){while(--_0x4ba1c8){_0x1c2c28['push'](_0x1c2c28['shift']());}};_0x23a521(++_0x3857f7);}(_0xf81e,0xcd));var _0xef81=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf81e[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xef81('0x0'));module['exports']={'name':{'type':Sequelize[_0xef81('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xef81('0x2')](_0xef81('0x3'),_0xef81('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xef81('0x1')]}}; \ No newline at end of file +var _0x50ed=['ENUM','second','third','first','exports','STRING'];(function(_0x320726,_0x384376){var _0x59ee29=function(_0x4bb8e2){while(--_0x4bb8e2){_0x320726['push'](_0x320726['shift']());}};_0x59ee29(++_0x384376);}(_0x50ed,0x1ea));var _0xd50e=function(_0x1ea63d,_0x4482c5){_0x1ea63d=_0x1ea63d-0x0;var _0x15e5a6=_0x50ed[_0x1ea63d];return _0x15e5a6;};'use strict';var Sequelize=require('sequelize');module[_0xd50e('0x0')]={'name':{'type':Sequelize[_0xd50e('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xd50e('0x2')]('first',_0xd50e('0x3'),_0xd50e('0x4')),'allowNull':![],'defaultValue':_0xd50e('0x5')},'description':{'type':Sequelize[_0xd50e('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 770f516..4ad9f07 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 _0xf901=['create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','then','destroy','Dispositions','UserProfileResource','end','error','name','send','Disposition','rawAttributes','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf901,0xa4));var _0x1f90=function(_0xe168fc,_0x134509){_0xe168fc=_0xe168fc-0x0;var _0x726d34=_0xf901[_0xe168fc];return _0x726d34;};'use strict';var emlformat=require(_0x1f90('0x0'));var rimraf=require(_0x1f90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f90('0x2'));var rp=require('request-promise');var moment=require(_0x1f90('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f90('0x4'));var util=require('util');var path=require(_0x1f90('0x5'));var sox=require(_0x1f90('0x6'));var csv=require('to-csv');var ejs=require(_0x1f90('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f90('0x8'));var deskjs=require(_0x1f90('0x9'));var toCsv=require('to-csv');var querystring=require(_0x1f90('0xa'));var Papa=require(_0x1f90('0xb'));var Redis=require(_0x1f90('0xc'));var authService=require(_0x1f90('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f90('0xe'));var logger=require(_0x1f90('0xf'))(_0x1f90('0x10'));var utils=require(_0x1f90('0x11'));var config=require(_0x1f90('0x12'));var licenseUtil=require(_0x1f90('0x13'));var db=require(_0x1f90('0x14'))['db'];function respondWithStatusCode(_0x485c9f,_0x2812dc){_0x2812dc=_0x2812dc||0xcc;return function(_0x4219a1){if(_0x4219a1){return _0x485c9f[_0x1f90('0x15')](_0x2812dc);}return _0x485c9f['status'](_0x2812dc)['end']();};}function respondWithResult(_0x4c2ede,_0xea13b9){_0xea13b9=_0xea13b9||0xc8;return function(_0x1947a8){if(_0x1947a8){return _0x4c2ede[_0x1f90('0x16')](_0xea13b9)[_0x1f90('0x17')](_0x1947a8);}};}function respondWithFilteredResult(_0x5d2029,_0x2c0590){return function(_0x5eca8){if(_0x5eca8){var _0xc2573=typeof _0x2c0590[_0x1f90('0x18')]===_0x1f90('0x19')&&typeof _0x2c0590['limit']===_0x1f90('0x19');var _0x39c303=_0x5eca8[_0x1f90('0x1a')];var _0x35b279=_0xc2573?0x0:_0x2c0590[_0x1f90('0x18')];var _0x44a103=_0xc2573?_0x5eca8['count']:_0x2c0590[_0x1f90('0x18')]+_0x2c0590[_0x1f90('0x1b')];var _0x50417e;if(_0x44a103>=_0x39c303){_0x44a103=_0x39c303;_0x50417e=0xc8;}else{_0x50417e=0xce;}_0x5d2029[_0x1f90('0x16')](_0x50417e);return _0x5d2029[_0x1f90('0x1c')](_0x1f90('0x1d'),_0x35b279+'-'+_0x44a103+'/'+_0x39c303)[_0x1f90('0x17')](_0x5eca8);}return null;};}function patchUpdates(_0x27eb70){return function(_0x11c759){try{jsonpatch[_0x1f90('0x1e')](_0x11c759,_0x27eb70,!![]);}catch(_0x1e23d5){return BPromise['reject'](_0x1e23d5);}return _0x11c759[_0x1f90('0x1f')]();};}function saveUpdates(_0x325b51,_0x4916f1){return function(_0x3c1ebb){if(_0x3c1ebb){return _0x3c1ebb['update'](_0x325b51)[_0x1f90('0x20')](function(_0x4c2f58){return _0x4c2f58;});}return null;};}function removeEntity(_0x5eddca,_0x3baf){return function(_0x54f0cb){if(_0x54f0cb){return _0x54f0cb[_0x1f90('0x21')]()[_0x1f90('0x20')](function(){var _0x24a2c3=_0x54f0cb['get']({'plain':!![]});var _0xd642ee=_0x1f90('0x22');return db[_0x1f90('0x23')]['destroy']({'where':{'type':_0xd642ee,'resourceId':_0x24a2c3['id']}})[_0x1f90('0x20')](function(){return _0x54f0cb;});})['then'](function(){_0x5eddca[_0x1f90('0x16')](0xcc)[_0x1f90('0x24')]();});}};}function handleEntityNotFound(_0x2ce40f,_0x36caff){return function(_0x513017){if(!_0x513017){_0x2ce40f[_0x1f90('0x15')](0x194);}return _0x513017;};}function handleError(_0x4e3b60,_0x511d58){_0x511d58=_0x511d58||0x1f4;return function(_0x1c4c64){logger[_0x1f90('0x25')](_0x1c4c64['stack']);if(_0x1c4c64[_0x1f90('0x26')]){delete _0x1c4c64['name'];}_0x4e3b60[_0x1f90('0x16')](_0x511d58)[_0x1f90('0x27')](_0x1c4c64);};}exports['index']=function(_0x73d718,_0x4ce8f5){var _0x3c4abd={},_0x51119e={},_0xf6f23={'count':0x0,'rows':[]};var _0x54c5cc=_['map'](db[_0x1f90('0x28')][_0x1f90('0x29')],function(_0x4c778b){return{'name':_0x4c778b['fieldName'],'type':_0x4c778b['type'][_0x1f90('0x2a')]};});_0x51119e['model']=_[_0x1f90('0x2b')](_0x54c5cc,_0x1f90('0x26'));_0x51119e[_0x1f90('0x2c')]=_[_0x1f90('0x2d')](_0x73d718['query']);_0x51119e['filters']=_[_0x1f90('0x2e')](_0x51119e[_0x1f90('0x2f')],_0x51119e['query']);_0x3c4abd['attributes']=_[_0x1f90('0x2e')](_0x51119e[_0x1f90('0x2f')],qs[_0x1f90('0x30')](_0x73d718['query'][_0x1f90('0x30')]));_0x3c4abd['attributes']=_0x3c4abd[_0x1f90('0x31')][_0x1f90('0x32')]?_0x3c4abd['attributes']:_0x51119e['model'];if(!_0x73d718[_0x1f90('0x2c')][_0x1f90('0x33')]('nolimit')){_0x3c4abd[_0x1f90('0x1b')]=qs[_0x1f90('0x1b')](_0x73d718['query']['limit']);_0x3c4abd['offset']=qs['offset'](_0x73d718[_0x1f90('0x2c')][_0x1f90('0x18')]);}_0x3c4abd['order']=qs['sort'](_0x73d718[_0x1f90('0x2c')][_0x1f90('0x34')]);_0x3c4abd[_0x1f90('0x35')]=qs[_0x1f90('0x36')](_[_0x1f90('0x37')](_0x73d718[_0x1f90('0x2c')],_0x51119e[_0x1f90('0x36')]),_0x54c5cc);if(_0x73d718[_0x1f90('0x2c')][_0x1f90('0x38')]){_0x3c4abd['where']=_[_0x1f90('0x39')](_0x3c4abd[_0x1f90('0x35')],{'$or':_[_0x1f90('0x2b')](_0x54c5cc,function(_0x29d824){if(_0x29d824[_0x1f90('0x3a')]!==_0x1f90('0x3b')){var _0x8c30f6={};_0x8c30f6[_0x29d824['name']]={'$like':'%'+_0x73d718[_0x1f90('0x2c')]['filter']+'%'};return _0x8c30f6;}})});}_0x3c4abd=_[_0x1f90('0x39')]({},_0x3c4abd,_0x73d718[_0x1f90('0x3c')]);var _0x4ea927={'where':_0x3c4abd[_0x1f90('0x35')]};return db[_0x1f90('0x28')]['count'](_0x4ea927)[_0x1f90('0x20')](function(_0x55bae0){_0xf6f23[_0x1f90('0x1a')]=_0x55bae0;if(_0x73d718[_0x1f90('0x2c')][_0x1f90('0x3d')]){_0x3c4abd[_0x1f90('0x3e')]=[{'all':!![]}];}return db['Disposition'][_0x1f90('0x3f')](_0x3c4abd);})[_0x1f90('0x20')](function(_0x127946){_0xf6f23['rows']=_0x127946;return _0xf6f23;})[_0x1f90('0x20')](respondWithFilteredResult(_0x4ce8f5,_0x3c4abd))[_0x1f90('0x40')](handleError(_0x4ce8f5,null));};exports['show']=function(_0xec7df6,_0x22a140){var _0x177e11={'raw':!![],'where':{'id':_0xec7df6[_0x1f90('0x41')]['id']}},_0x4ea5a2={};_0x4ea5a2[_0x1f90('0x2f')]=_[_0x1f90('0x2d')](db['Disposition'][_0x1f90('0x29')]);_0x4ea5a2[_0x1f90('0x2c')]=_[_0x1f90('0x2d')](_0xec7df6[_0x1f90('0x2c')]);_0x4ea5a2[_0x1f90('0x36')]=_[_0x1f90('0x2e')](_0x4ea5a2[_0x1f90('0x2f')],_0x4ea5a2[_0x1f90('0x2c')]);_0x177e11[_0x1f90('0x31')]=_['intersection'](_0x4ea5a2[_0x1f90('0x2f')],qs['fields'](_0xec7df6[_0x1f90('0x2c')]['fields']));_0x177e11[_0x1f90('0x31')]=_0x177e11[_0x1f90('0x31')][_0x1f90('0x32')]?_0x177e11[_0x1f90('0x31')]:_0x4ea5a2[_0x1f90('0x2f')];if(_0xec7df6['query']['includeAll']){_0x177e11[_0x1f90('0x3e')]=[{'all':!![]}];}_0x177e11=_[_0x1f90('0x39')]({},_0x177e11,_0xec7df6[_0x1f90('0x3c')]);return db[_0x1f90('0x28')][_0x1f90('0x42')](_0x177e11)[_0x1f90('0x20')](handleEntityNotFound(_0x22a140,null))['then'](respondWithResult(_0x22a140,null))[_0x1f90('0x40')](handleError(_0x22a140,null));};exports['create']=function(_0x57c438,_0x460333){return db[_0x1f90('0x28')][_0x1f90('0x43')](_0x57c438['body'],{})[_0x1f90('0x20')](function(_0x35838b){var _0x4f492b=_0x57c438[_0x1f90('0x44')][_0x1f90('0x45')]({'plain':!![]});if(!_0x4f492b)throw new Error(_0x1f90('0x46'));if(_0x4f492b[_0x1f90('0x47')]==='user'){var _0xb9eae2=_0x35838b[_0x1f90('0x45')]({'plain':!![]});var _0x15cb72=_0x1f90('0x22');return db[_0x1f90('0x48')][_0x1f90('0x42')]({'where':{'name':_0x15cb72,'userProfileId':_0x4f492b[_0x1f90('0x49')]},'raw':!![]})[_0x1f90('0x20')](function(_0xef3a4e){if(_0xef3a4e&&_0xef3a4e['autoAssociation']===0x0){return db[_0x1f90('0x23')]['create']({'name':_0xb9eae2[_0x1f90('0x26')],'resourceId':_0xb9eae2['id'],'type':_0xef3a4e[_0x1f90('0x26')],'sectionId':_0xef3a4e['id']},{})[_0x1f90('0x20')](function(){return _0x35838b;});}else{return _0x35838b;}})[_0x1f90('0x40')](function(_0x5ea91c){logger[_0x1f90('0x25')](_0x1f90('0x4a'),_0x5ea91c);throw _0x5ea91c;});}return _0x35838b;})['then'](respondWithResult(_0x460333,0xc9))['catch'](handleError(_0x460333,null));};exports[_0x1f90('0x4b')]=function(_0x5cbb6e,_0x217d41){if(_0x5cbb6e[_0x1f90('0x4c')]['id']){delete _0x5cbb6e[_0x1f90('0x4c')]['id'];}return db[_0x1f90('0x28')][_0x1f90('0x42')]({'where':{'id':_0x5cbb6e[_0x1f90('0x41')]['id']}})['then'](handleEntityNotFound(_0x217d41,null))[_0x1f90('0x20')](saveUpdates(_0x5cbb6e[_0x1f90('0x4c')],null))['then'](respondWithResult(_0x217d41,null))[_0x1f90('0x40')](handleError(_0x217d41,null));};exports[_0x1f90('0x21')]=function(_0x2fde63,_0x20eec0){return db['Disposition'][_0x1f90('0x42')]({'where':{'id':_0x2fde63['params']['id']}})[_0x1f90('0x20')](handleEntityNotFound(_0x20eec0,null))[_0x1f90('0x20')](removeEntity(_0x20eec0,null))['catch'](handleError(_0x20eec0,null));}; \ No newline at end of file +var _0xf0c2=['pick','where','merge','filter','options','Disposition','includeAll','include','findAll','rows','catch','show','params','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Dispositions','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','then','destroy','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort'];(function(_0x32b9ad,_0x2e8a4b){var _0x3529fd=function(_0x296d02){while(--_0x296d02){_0x32b9ad['push'](_0x32b9ad['shift']());}};_0x3529fd(++_0x2e8a4b);}(_0xf0c2,0x6e));var _0x2f0c=function(_0x153962,_0x269cf7){_0x153962=_0x153962-0x0;var _0x591c7f=_0xf0c2[_0x153962];return _0x591c7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f0c('0x0'));var zipdir=require(_0x2f0c('0x1'));var jsonpatch=require(_0x2f0c('0x2'));var rp=require(_0x2f0c('0x3'));var moment=require(_0x2f0c('0x4'));var BPromise=require(_0x2f0c('0x5'));var Mustache=require(_0x2f0c('0x6'));var util=require(_0x2f0c('0x7'));var path=require(_0x2f0c('0x8'));var sox=require(_0x2f0c('0x9'));var csv=require(_0x2f0c('0xa'));var ejs=require(_0x2f0c('0xb'));var fs=require('fs');var fs_extra=require(_0x2f0c('0xc'));var _=require('lodash');var squel=require(_0x2f0c('0xd'));var crypto=require(_0x2f0c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2f0c('0xf'));var toCsv=require(_0x2f0c('0xa'));var querystring=require(_0x2f0c('0x10'));var Papa=require(_0x2f0c('0x11'));var Redis=require(_0x2f0c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2f0c('0x13'));var as=require(_0x2f0c('0x14'));var hardwareService=require(_0x2f0c('0x15'));var logger=require(_0x2f0c('0x16'))(_0x2f0c('0x17'));var utils=require(_0x2f0c('0x18'));var config=require(_0x2f0c('0x19'));var licenseUtil=require(_0x2f0c('0x1a'));var db=require(_0x2f0c('0x1b'))['db'];function respondWithStatusCode(_0x19882e,_0x2431b3){_0x2431b3=_0x2431b3||0xcc;return function(_0xecea3b){if(_0xecea3b){return _0x19882e[_0x2f0c('0x1c')](_0x2431b3);}return _0x19882e['status'](_0x2431b3)['end']();};}function respondWithResult(_0x12237f,_0x1175d1){_0x1175d1=_0x1175d1||0xc8;return function(_0x147501){if(_0x147501){return _0x12237f[_0x2f0c('0x1d')](_0x1175d1)['json'](_0x147501);}};}function respondWithFilteredResult(_0x1e30b8,_0x3f4ca0){return function(_0xa3f8e2){if(_0xa3f8e2){var _0x31ab32=typeof _0x3f4ca0[_0x2f0c('0x1e')]==='undefined'&&typeof _0x3f4ca0[_0x2f0c('0x1f')]===_0x2f0c('0x20');var _0x5dad52=_0xa3f8e2[_0x2f0c('0x21')];var _0x32642e=_0x31ab32?0x0:_0x3f4ca0['offset'];var _0x54e503=_0x31ab32?_0xa3f8e2[_0x2f0c('0x21')]:_0x3f4ca0[_0x2f0c('0x1e')]+_0x3f4ca0[_0x2f0c('0x1f')];var _0x37d913;if(_0x54e503>=_0x5dad52){_0x54e503=_0x5dad52;_0x37d913=0xc8;}else{_0x37d913=0xce;}_0x1e30b8[_0x2f0c('0x1d')](_0x37d913);return _0x1e30b8[_0x2f0c('0x22')](_0x2f0c('0x23'),_0x32642e+'-'+_0x54e503+'/'+_0x5dad52)[_0x2f0c('0x24')](_0xa3f8e2);}return null;};}function patchUpdates(_0x4441de){return function(_0x220eda){try{jsonpatch[_0x2f0c('0x25')](_0x220eda,_0x4441de,!![]);}catch(_0x46763c){return BPromise[_0x2f0c('0x26')](_0x46763c);}return _0x220eda['save']();};}function saveUpdates(_0x3c8bec,_0x3783e1){return function(_0x4f6370){if(_0x4f6370){return _0x4f6370['update'](_0x3c8bec)[_0x2f0c('0x27')](function(_0x93c4c){return _0x93c4c;});}return null;};}function removeEntity(_0x2471b9,_0x2385e5){return function(_0x15b98b){if(_0x15b98b){return _0x15b98b[_0x2f0c('0x28')]()[_0x2f0c('0x27')](function(){var _0x431858=_0x15b98b['get']({'plain':!![]});var _0x2d9053='Dispositions';return db[_0x2f0c('0x29')][_0x2f0c('0x28')]({'where':{'type':_0x2d9053,'resourceId':_0x431858['id']}})[_0x2f0c('0x27')](function(){return _0x15b98b;});})[_0x2f0c('0x27')](function(){_0x2471b9['status'](0xcc)[_0x2f0c('0x2a')]();});}};}function handleEntityNotFound(_0x3cf772,_0x9b9273){return function(_0x3edbc2){if(!_0x3edbc2){_0x3cf772['sendStatus'](0x194);}return _0x3edbc2;};}function handleError(_0x5df018,_0x2c8f58){_0x2c8f58=_0x2c8f58||0x1f4;return function(_0x415c7a){logger[_0x2f0c('0x2b')](_0x415c7a[_0x2f0c('0x2c')]);if(_0x415c7a[_0x2f0c('0x2d')]){delete _0x415c7a[_0x2f0c('0x2d')];}_0x5df018[_0x2f0c('0x1d')](_0x2c8f58)['send'](_0x415c7a);};}exports[_0x2f0c('0x2e')]=function(_0x145441,_0x3a3885){var _0x4f3a99={},_0x12402a={},_0xaa2b97={'count':0x0,'rows':[]};var _0x1a0e1d=_[_0x2f0c('0x2f')](db['Disposition'][_0x2f0c('0x30')],function(_0x4d8fe5){return{'name':_0x4d8fe5[_0x2f0c('0x31')],'type':_0x4d8fe5[_0x2f0c('0x32')][_0x2f0c('0x33')]};});_0x12402a[_0x2f0c('0x34')]=_[_0x2f0c('0x2f')](_0x1a0e1d,_0x2f0c('0x2d'));_0x12402a['query']=_[_0x2f0c('0x35')](_0x145441[_0x2f0c('0x36')]);_0x12402a[_0x2f0c('0x37')]=_[_0x2f0c('0x38')](_0x12402a['model'],_0x12402a[_0x2f0c('0x36')]);_0x4f3a99[_0x2f0c('0x39')]=_['intersection'](_0x12402a[_0x2f0c('0x34')],qs[_0x2f0c('0x3a')](_0x145441[_0x2f0c('0x36')]['fields']));_0x4f3a99[_0x2f0c('0x39')]=_0x4f3a99[_0x2f0c('0x39')][_0x2f0c('0x3b')]?_0x4f3a99['attributes']:_0x12402a[_0x2f0c('0x34')];if(!_0x145441['query']['hasOwnProperty']('nolimit')){_0x4f3a99[_0x2f0c('0x1f')]=qs['limit'](_0x145441[_0x2f0c('0x36')]['limit']);_0x4f3a99[_0x2f0c('0x1e')]=qs[_0x2f0c('0x1e')](_0x145441[_0x2f0c('0x36')]['offset']);}_0x4f3a99[_0x2f0c('0x3c')]=qs[_0x2f0c('0x3d')](_0x145441[_0x2f0c('0x36')][_0x2f0c('0x3d')]);_0x4f3a99['where']=qs[_0x2f0c('0x37')](_[_0x2f0c('0x3e')](_0x145441[_0x2f0c('0x36')],_0x12402a['filters']),_0x1a0e1d);if(_0x145441[_0x2f0c('0x36')]['filter']){_0x4f3a99[_0x2f0c('0x3f')]=_[_0x2f0c('0x40')](_0x4f3a99[_0x2f0c('0x3f')],{'$or':_[_0x2f0c('0x2f')](_0x1a0e1d,function(_0x2fe9ed){if(_0x2fe9ed[_0x2f0c('0x32')]!=='VIRTUAL'){var _0x95721f={};_0x95721f[_0x2fe9ed['name']]={'$like':'%'+_0x145441[_0x2f0c('0x36')][_0x2f0c('0x41')]+'%'};return _0x95721f;}})});}_0x4f3a99=_[_0x2f0c('0x40')]({},_0x4f3a99,_0x145441[_0x2f0c('0x42')]);var _0x515e06={'where':_0x4f3a99[_0x2f0c('0x3f')]};return db[_0x2f0c('0x43')][_0x2f0c('0x21')](_0x515e06)[_0x2f0c('0x27')](function(_0x3231f4){_0xaa2b97[_0x2f0c('0x21')]=_0x3231f4;if(_0x145441['query'][_0x2f0c('0x44')]){_0x4f3a99[_0x2f0c('0x45')]=[{'all':!![]}];}return db[_0x2f0c('0x43')][_0x2f0c('0x46')](_0x4f3a99);})[_0x2f0c('0x27')](function(_0x298820){_0xaa2b97[_0x2f0c('0x47')]=_0x298820;return _0xaa2b97;})[_0x2f0c('0x27')](respondWithFilteredResult(_0x3a3885,_0x4f3a99))[_0x2f0c('0x48')](handleError(_0x3a3885,null));};exports[_0x2f0c('0x49')]=function(_0x5c4075,_0x41ff9b){var _0x497f90={'raw':!![],'where':{'id':_0x5c4075[_0x2f0c('0x4a')]['id']}},_0x42a240={};_0x42a240[_0x2f0c('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x42a240[_0x2f0c('0x36')]=_[_0x2f0c('0x35')](_0x5c4075[_0x2f0c('0x36')]);_0x42a240[_0x2f0c('0x37')]=_[_0x2f0c('0x38')](_0x42a240['model'],_0x42a240[_0x2f0c('0x36')]);_0x497f90[_0x2f0c('0x39')]=_[_0x2f0c('0x38')](_0x42a240[_0x2f0c('0x34')],qs[_0x2f0c('0x3a')](_0x5c4075[_0x2f0c('0x36')]['fields']));_0x497f90['attributes']=_0x497f90[_0x2f0c('0x39')]['length']?_0x497f90[_0x2f0c('0x39')]:_0x42a240[_0x2f0c('0x34')];if(_0x5c4075[_0x2f0c('0x36')][_0x2f0c('0x44')]){_0x497f90['include']=[{'all':!![]}];}_0x497f90=_[_0x2f0c('0x40')]({},_0x497f90,_0x5c4075[_0x2f0c('0x42')]);return db[_0x2f0c('0x43')]['find'](_0x497f90)[_0x2f0c('0x27')](handleEntityNotFound(_0x41ff9b,null))[_0x2f0c('0x27')](respondWithResult(_0x41ff9b,null))[_0x2f0c('0x48')](handleError(_0x41ff9b,null));};exports['create']=function(_0xf344db,_0x28b99b){return db[_0x2f0c('0x43')][_0x2f0c('0x4b')](_0xf344db['body'],{})[_0x2f0c('0x27')](function(_0x1bbc1a){var _0x1c5fcf=_0xf344db['user'][_0x2f0c('0x4c')]({'plain':!![]});if(!_0x1c5fcf)throw new Error(_0x2f0c('0x4d'));if(_0x1c5fcf[_0x2f0c('0x4e')]===_0x2f0c('0x4f')){var _0x23456a=_0x1bbc1a[_0x2f0c('0x4c')]({'plain':!![]});var _0x3f6c68=_0x2f0c('0x50');return db[_0x2f0c('0x51')][_0x2f0c('0x52')]({'where':{'name':_0x3f6c68,'userProfileId':_0x1c5fcf[_0x2f0c('0x53')]},'raw':!![]})['then'](function(_0x3bb5e8){if(_0x3bb5e8&&_0x3bb5e8['autoAssociation']===0x0){return db['UserProfileResource'][_0x2f0c('0x4b')]({'name':_0x23456a['name'],'resourceId':_0x23456a['id'],'type':_0x3bb5e8[_0x2f0c('0x2d')],'sectionId':_0x3bb5e8['id']},{})[_0x2f0c('0x27')](function(){return _0x1bbc1a;});}else{return _0x1bbc1a;}})[_0x2f0c('0x48')](function(_0x3baea3){logger[_0x2f0c('0x2b')](_0x2f0c('0x54'),_0x3baea3);throw _0x3baea3;});}return _0x1bbc1a;})[_0x2f0c('0x27')](respondWithResult(_0x28b99b,0xc9))['catch'](handleError(_0x28b99b,null));};exports['update']=function(_0x375b88,_0x436d63){if(_0x375b88[_0x2f0c('0x55')]['id']){delete _0x375b88[_0x2f0c('0x55')]['id'];}return db[_0x2f0c('0x43')][_0x2f0c('0x52')]({'where':{'id':_0x375b88[_0x2f0c('0x4a')]['id']}})[_0x2f0c('0x27')](handleEntityNotFound(_0x436d63,null))['then'](saveUpdates(_0x375b88[_0x2f0c('0x55')],null))['then'](respondWithResult(_0x436d63,null))[_0x2f0c('0x48')](handleError(_0x436d63,null));};exports[_0x2f0c('0x28')]=function(_0x399dc3,_0x4d68c8){return db[_0x2f0c('0x43')][_0x2f0c('0x52')]({'where':{'id':_0x399dc3[_0x2f0c('0x4a')]['id']}})[_0x2f0c('0x27')](handleEntityNotFound(_0x4d68c8,null))[_0x2f0c('0x27')](removeEntity(_0x4d68c8,null))[_0x2f0c('0x48')](handleError(_0x4d68c8,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 873c229..f1d2870 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 _0x9721=['name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_dispositions'];(function(_0x5f0c5f,_0x1a58ae){var _0x2112e3=function(_0x419017){while(--_0x419017){_0x5f0c5f['push'](_0x5f0c5f['shift']());}};_0x2112e3(++_0x1a58ae);}(_0x9721,0x9c));var _0x1972=function(_0x22a2cd,_0x20681f){_0x22a2cd=_0x22a2cd-0x0;var _0x53109e=_0x9721[_0x22a2cd];return _0x53109e;};'use strict';var _=require(_0x1972('0x0'));var util=require(_0x1972('0x1'));var logger=require(_0x1972('0x2'))(_0x1972('0x3'));var moment=require(_0x1972('0x4'));var BPromise=require(_0x1972('0x5'));var rp=require(_0x1972('0x6'));var fs=require('fs');var path=require(_0x1972('0x7'));var rimraf=require('rimraf');var config=require(_0x1972('0x8'));var attributes=require('./disposition.attributes');module[_0x1972('0x9')]=function(_0x488fa8,_0x5a0dfa){return _0x488fa8[_0x1972('0xa')]('Disposition',attributes,{'tableName':_0x1972('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1972('0xc'),'fields':[_0x1972('0xd'),_0x1972('0xe')]},{'unique':!![],'name':_0x1972('0xf'),'fields':[_0x1972('0xd'),_0x1972('0x10')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0x1972('0x11'),'fields':[_0x1972('0xd'),_0x1972('0x12')]},{'unique':!![],'name':_0x1972('0x13'),'fields':['name',_0x1972('0x14')]},{'unique':!![],'name':_0x1972('0x15'),'fields':['name',_0x1972('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x1972('0xd'),_0x1972('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9077=['exports','define','Disposition','tools_dispositions','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes'];(function(_0x41d902,_0x29d0b){var _0x360fb1=function(_0x2517ae){while(--_0x2517ae){_0x41d902['push'](_0x41d902['shift']());}};_0x360fb1(++_0x29d0b);}(_0x9077,0xcf));var _0x7907=function(_0x5146c1,_0xfa91af){_0x5146c1=_0x5146c1-0x0;var _0x5cda76=_0x9077[_0x5146c1];return _0x5cda76;};'use strict';var _=require(_0x7907('0x0'));var util=require('util');var logger=require(_0x7907('0x1'))(_0x7907('0x2'));var moment=require(_0x7907('0x3'));var BPromise=require(_0x7907('0x4'));var rp=require(_0x7907('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7907('0x6'));var config=require(_0x7907('0x7'));var attributes=require(_0x7907('0x8'));module[_0x7907('0x9')]=function(_0x5120ea,_0x3b6a90){return _0x5120ea[_0x7907('0xa')](_0x7907('0xb'),attributes,{'tableName':_0x7907('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x7907('0xd'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x7907('0xd'),_0x7907('0xe')]},{'unique':!![],'name':_0x7907('0xf'),'fields':[_0x7907('0xd'),_0x7907('0x10')]},{'unique':!![],'name':_0x7907('0x11'),'fields':[_0x7907('0xd'),_0x7907('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x7907('0xd'),_0x7907('0x13')]},{'unique':!![],'name':_0x7907('0x14'),'fields':[_0x7907('0xd'),_0x7907('0x15')]},{'unique':!![],'name':_0x7907('0x16'),'fields':['name',_0x7907('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b47caa1..8c64920 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(_0xe24b63,_0x2e78fa){var _0x2f87c6=function(_0x457b22){while(--_0x457b22){_0xe24b63['push'](_0xe24b63['shift']());}};_0x2f87c6(++_0x2e78fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x8a19ea,_0x22a0da){var _0x4bc790=function(_0x2a6458){while(--_0x2a6458){_0x8a19ea['push'](_0x8a19ea['shift']());}};_0x4bc790(++_0x22a0da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 677d83e..5ff9ef9 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 _0xb0fb=['/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','./disposition.controller','get','isAuthenticated','post','create'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xb0fb,0x1a9));var _0xbb0f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xb0fb[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0xbb0f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbb0f('0x1'));var router=express[_0xbb0f('0x2')]();var fs_extra=require(_0xbb0f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb0f('0x4'));router[_0xbb0f('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb0f('0x5')]('/:id',auth[_0xbb0f('0x6')](),controller['show']);router[_0xbb0f('0x7')]('/',auth[_0xbb0f('0x6')](),controller[_0xbb0f('0x8')]);router['put'](_0xbb0f('0x9'),auth[_0xbb0f('0x6')](),controller[_0xbb0f('0xa')]);router[_0xbb0f('0xb')]('/:id',auth[_0xbb0f('0x6')](),controller[_0xbb0f('0xc')]);module[_0xbb0f('0xd')]=router; \ No newline at end of file +var _0xa521=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x23d3bc,_0x5d9168){var _0x3695da=function(_0x450f5e){while(--_0x450f5e){_0x23d3bc['push'](_0x23d3bc['shift']());}};_0x3695da(++_0x5d9168);}(_0xa521,0x1c8));var _0x1a52=function(_0x398909,_0x5a13a5){_0x398909=_0x398909-0x0;var _0x196931=_0xa521[_0x398909];return _0x196931;};'use strict';var multer=require(_0x1a52('0x0'));var util=require(_0x1a52('0x1'));var path=require(_0x1a52('0x2'));var timeout=require(_0x1a52('0x3'));var express=require('express');var router=express[_0x1a52('0x4')]();var fs_extra=require(_0x1a52('0x5'));var auth=require(_0x1a52('0x6'));var interaction=require(_0x1a52('0x7'));var config=require(_0x1a52('0x8'));var controller=require(_0x1a52('0x9'));router['get']('/',auth[_0x1a52('0xa')](),controller[_0x1a52('0xb')]);router[_0x1a52('0xc')](_0x1a52('0xd'),auth[_0x1a52('0xa')](),controller[_0x1a52('0xe')]);router[_0x1a52('0xf')]('/',auth['isAuthenticated'](),controller[_0x1a52('0x10')]);router['put'](_0x1a52('0xd'),auth[_0x1a52('0xa')](),controller['update']);router[_0x1a52('0x11')](_0x1a52('0xd'),auth['isAuthenticated'](),controller[_0x1a52('0x12')]);module[_0x1a52('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3e1562a..bc93e3f 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 _0xf05d=['14400','2400','7200','v17,v27,v29','INTEGER','SIP','KHOMP','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','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','9600','12000'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xf05d,0xd4));var _0xdf05=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf05d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xdf05('0x0')]={'name':{'type':Sequelize[_0xdf05('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdf05('0x1')]},'ecm':{'type':Sequelize[_0xdf05('0x2')]('yes','no'),'defaultValue':_0xdf05('0x3')},'headerinfo':{'type':Sequelize[_0xdf05('0x1')],'defaultValue':_0xdf05('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xdf05('0x2')]('2400',_0xdf05('0x5'),'7200',_0xdf05('0x6'),_0xdf05('0x7'),_0xdf05('0x8')),'defaultValue':_0xdf05('0x5')},'maxrate':{'type':Sequelize[_0xdf05('0x2')](_0xdf05('0x9'),_0xdf05('0x5'),_0xdf05('0xa'),_0xdf05('0x6'),_0xdf05('0x7'),_0xdf05('0x8')),'defaultValue':_0xdf05('0x8')},'modem':{'type':Sequelize[_0xdf05('0x1')],'defaultValue':_0xdf05('0xb')},'gateway':{'type':Sequelize[_0xdf05('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdf05('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdf05('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdf05('0x2')](_0xdf05('0xd'),'IAX','DADHI',_0xdf05('0xe')),'defaultValue':_0xdf05('0xd')},'key':{'type':Sequelize[_0xdf05('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdf05('0xf')],'defaultValue':function(){return _0xdf05('0x10');}},'notificationSound':{'type':Sequelize[_0xdf05('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf05('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdf05('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdf05('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf05('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf05('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xdf05('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xdf05('0x11')],'defaultValue':![],'comment':_0xdf05('0x13'),'set':function(_0x11feaa){if(!_0x11feaa)this[_0xdf05('0x14')]('mandatoryDispositionPauseId',null);this[_0xdf05('0x14')](_0xdf05('0x15'),_0x11feaa);}}}; \ No newline at end of file +var _0xdbef=['12000','4800','7200','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600'];(function(_0x497f6c,_0x24993d){var _0x1526b6=function(_0x382061){while(--_0x382061){_0x497f6c['push'](_0x497f6c['shift']());}};_0x1526b6(++_0x24993d);}(_0xdbef,0xad));var _0xfdbe=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xdbef[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xfdbe('0x0'));module[_0xfdbe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfdbe('0x2')]},'ecm':{'type':Sequelize[_0xfdbe('0x3')](_0xfdbe('0x4'),'no'),'defaultValue':_0xfdbe('0x4')},'headerinfo':{'type':Sequelize[_0xfdbe('0x2')],'defaultValue':_0xfdbe('0x5')},'localstationid':{'type':Sequelize[_0xfdbe('0x2')],'unique':_0xfdbe('0x6')},'minrate':{'type':Sequelize[_0xfdbe('0x3')](_0xfdbe('0x7'),'4800','7200',_0xfdbe('0x8'),_0xfdbe('0x9'),'14400'),'defaultValue':_0xfdbe('0xa')},'maxrate':{'type':Sequelize[_0xfdbe('0x3')](_0xfdbe('0x7'),'4800',_0xfdbe('0xb'),_0xfdbe('0x8'),_0xfdbe('0x9'),_0xfdbe('0xc')),'defaultValue':_0xfdbe('0xc')},'modem':{'type':Sequelize[_0xfdbe('0x2')],'defaultValue':_0xfdbe('0xd')},'gateway':{'type':Sequelize[_0xfdbe('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfdbe('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfdbe('0x3')](_0xfdbe('0xe'),_0xfdbe('0xf'),_0xfdbe('0x10'),'KHOMP'),'defaultValue':_0xfdbe('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfdbe('0x11')],'defaultValue':function(){return _0xfdbe('0x12');}},'notificationSound':{'type':Sequelize[_0xfdbe('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfdbe('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfdbe('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfdbe('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfdbe('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfdbe('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xfdbe('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xfdbe('0x13')],'defaultValue':![],'comment':_0xfdbe('0x16'),'set':function(_0x2c3218){if(!_0x2c3218)this['setDataValue'](_0xfdbe('0x17'),null);this[_0xfdbe('0x18')](_0xfdbe('0x19'),_0x2c3218);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d2f9072..aa2cc94 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 _0x0300=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Pause','Disposition','getDispositions','pick','FaxAccountId','ids','addAnswer','CannedAnswer','rows','removeAnswers','addInteraction','omit','findOne','FaxInteraction','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','faxdetect','maxrate','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0300,0xab));var _0x0030=function(_0x11b134,_0x215eee){_0x11b134=_0x11b134-0x0;var _0x1f5a77=_0x0300[_0x11b134];return _0x1f5a77;};'use strict';var emlformat=require(_0x0030('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0030('0x1'));var jsonpatch=require(_0x0030('0x2'));var rp=require(_0x0030('0x3'));var moment=require(_0x0030('0x4'));var BPromise=require(_0x0030('0x5'));var Mustache=require(_0x0030('0x6'));var util=require(_0x0030('0x7'));var path=require(_0x0030('0x8'));var sox=require(_0x0030('0x9'));var csv=require(_0x0030('0xa'));var ejs=require(_0x0030('0xb'));var fs=require('fs');var fs_extra=require(_0x0030('0xc'));var _=require('lodash');var squel=require(_0x0030('0xd'));var crypto=require(_0x0030('0xe'));var jsforce=require(_0x0030('0xf'));var deskjs=require(_0x0030('0x10'));var toCsv=require(_0x0030('0xa'));var querystring=require(_0x0030('0x11'));var Papa=require(_0x0030('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0030('0x13'));var logger=require(_0x0030('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0030('0x15'));var db=require(_0x0030('0x16'))['db'];config[_0x0030('0x17')]=_[_0x0030('0x18')](config[_0x0030('0x17')],{'host':_0x0030('0x19'),'port':0x18eb});var socket=require(_0x0030('0x1a'))(new Redis(config[_0x0030('0x17')]));require(_0x0030('0x1b'))[_0x0030('0x1c')](socket);var jayson=require(_0x0030('0x1d'));var client=jayson[_0x0030('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x0030('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x224ce9,_0x46c641,_0x4d909e,_0xc9aa07){return new BPromise(function(_0x15f9be,_0x5e2dea){var _0x3b4eeb=_0xc9aa07||client;return _0x3b4eeb[_0x0030('0x1f')](_0x224ce9,_0x4d909e)[_0x0030('0x20')](function(_0x2da833){logger[_0x0030('0x21')]('FaxAccount,\x20%s,\x20%s',_0x46c641,'request\x20sent');logger['debug'](_0x0030('0x22'),_0x46c641,_0x0030('0x23'),JSON[_0x0030('0x24')](_0x2da833));if(_0x2da833[_0x0030('0x25')]){if(_0x2da833[_0x0030('0x25')][_0x0030('0x26')]===0x1f4){logger[_0x0030('0x25')](_0x0030('0x27'),_0x46c641,_0x2da833[_0x0030('0x25')][_0x0030('0x28')]);return _0x5e2dea(_0x2da833['error']['message']);}logger[_0x0030('0x25')](_0x0030('0x27'),_0x46c641,_0x2da833[_0x0030('0x25')][_0x0030('0x28')]);return _0x15f9be(_0x2da833[_0x0030('0x25')][_0x0030('0x28')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x46c641,'request\x20sent');_0x15f9be(_0x2da833[_0x0030('0x29')][_0x0030('0x28')]);}})['catch'](function(_0x40d229){logger['error']('FaxAccount,\x20%s,\x20%s',_0x46c641,_0x40d229);_0x5e2dea(_0x40d229);});});}function respondWithStatusCode(_0x35bb13,_0x48774b){_0x48774b=_0x48774b||0xcc;return function(_0x140447){if(_0x140447){return _0x35bb13[_0x0030('0x2a')](_0x48774b);}return _0x35bb13[_0x0030('0x2b')](_0x48774b)['end']();};}function respondWithResult(_0x138192,_0x164240){_0x164240=_0x164240||0xc8;return function(_0x280230){if(_0x280230){return _0x138192['status'](_0x164240)[_0x0030('0x2c')](_0x280230);}};}function respondWithFilteredResult(_0x143d9b,_0x467076){return function(_0x18bb5f){if(_0x18bb5f){var _0x1266aa=typeof _0x467076[_0x0030('0x2d')]==='undefined'&&typeof _0x467076[_0x0030('0x2e')]===_0x0030('0x2f');var _0xb177ea=_0x18bb5f[_0x0030('0x30')];var _0x5bb222=_0x1266aa?0x0:_0x467076[_0x0030('0x2d')];var _0x4d26d1=_0x1266aa?_0x18bb5f[_0x0030('0x30')]:_0x467076['offset']+_0x467076['limit'];var _0x361e30;if(_0x4d26d1>=_0xb177ea){_0x4d26d1=_0xb177ea;_0x361e30=0xc8;}else{_0x361e30=0xce;}_0x143d9b[_0x0030('0x2b')](_0x361e30);return _0x143d9b[_0x0030('0x31')](_0x0030('0x32'),_0x5bb222+'-'+_0x4d26d1+'/'+_0xb177ea)[_0x0030('0x2c')](_0x18bb5f);}return null;};}function patchUpdates(_0x52b4d5){return function(_0x462f56){try{jsonpatch[_0x0030('0x33')](_0x462f56,_0x52b4d5,!![]);}catch(_0x46e912){return BPromise[_0x0030('0x34')](_0x46e912);}return _0x462f56[_0x0030('0x35')]();};}function saveUpdates(_0x58fd09,_0x328372){return function(_0x233773){if(_0x233773){return _0x233773[_0x0030('0x36')](_0x58fd09)[_0x0030('0x20')](function(_0x37580e){return _0x37580e;});}return null;};}function removeEntity(_0x42662a,_0x417187){return function(_0x1e45e5){if(_0x1e45e5){return _0x1e45e5[_0x0030('0x37')]()[_0x0030('0x20')](function(){var _0x5f2a6b=_0x1e45e5[_0x0030('0x38')]({'plain':!![]});var _0x7c4717=_0x0030('0x39');return db[_0x0030('0x3a')]['destroy']({'where':{'type':_0x7c4717,'resourceId':_0x5f2a6b['id']}})[_0x0030('0x20')](function(){return _0x1e45e5;});})['then'](function(){_0x42662a[_0x0030('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a506b,_0x487e15){return function(_0x468665){if(!_0x468665){_0x2a506b[_0x0030('0x2a')](0x194);}return _0x468665;};}function handleError(_0x1da1bb,_0x3f4657){_0x3f4657=_0x3f4657||0x1f4;return function(_0x1583eb){logger[_0x0030('0x25')](_0x1583eb[_0x0030('0x3b')]);if(_0x1583eb['name']){delete _0x1583eb[_0x0030('0x3c')];}_0x1da1bb[_0x0030('0x2b')](_0x3f4657)[_0x0030('0x3d')](_0x1583eb);};}exports[_0x0030('0x3e')]=function(_0x59e547,_0x133868){var _0x522d2b={'include':[{'model':db['Pause'],'as':_0x0030('0x3f')}]},_0x2ec343={},_0x4eb15f={'count':0x0,'rows':[]};var _0x37a0f9=_[_0x0030('0x40')](db[_0x0030('0x41')][_0x0030('0x42')],function(_0x5f4bb7){return{'name':_0x5f4bb7[_0x0030('0x43')],'type':_0x5f4bb7[_0x0030('0x44')][_0x0030('0x45')]};});_0x2ec343[_0x0030('0x46')]=_[_0x0030('0x40')](_0x37a0f9,_0x0030('0x3c'));_0x2ec343[_0x0030('0x47')]=_[_0x0030('0x48')](_0x59e547['query']);_0x2ec343['filters']=_['intersection'](_0x2ec343[_0x0030('0x46')],_0x2ec343[_0x0030('0x47')]);_0x522d2b['attributes']=_[_0x0030('0x49')](_0x2ec343[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x59e547[_0x0030('0x47')]['fields']));_0x522d2b['attributes']=_0x522d2b[_0x0030('0x4b')]['length']?_0x522d2b[_0x0030('0x4b')]:_0x2ec343[_0x0030('0x46')];if(!_0x59e547['query'][_0x0030('0x4c')](_0x0030('0x4d'))){_0x522d2b[_0x0030('0x2e')]=qs[_0x0030('0x2e')](_0x59e547[_0x0030('0x47')][_0x0030('0x2e')]);_0x522d2b[_0x0030('0x2d')]=qs['offset'](_0x59e547['query'][_0x0030('0x2d')]);}_0x522d2b[_0x0030('0x4e')]=qs[_0x0030('0x4f')](_0x59e547[_0x0030('0x47')][_0x0030('0x4f')]);_0x522d2b[_0x0030('0x50')]=qs['filters'](_['pick'](_0x59e547['query'],_0x2ec343[_0x0030('0x51')]),_0x37a0f9);if(_0x59e547[_0x0030('0x47')][_0x0030('0x52')]){_0x522d2b[_0x0030('0x50')]=_[_0x0030('0x53')](_0x522d2b['where'],{'$or':_[_0x0030('0x40')](_0x37a0f9,function(_0x2b52d9){if(_0x2b52d9[_0x0030('0x44')]!==_0x0030('0x54')){var _0x46c7e6={};_0x46c7e6[_0x2b52d9[_0x0030('0x3c')]]={'$like':'%'+_0x59e547['query']['filter']+'%'};return _0x46c7e6;}})});}_0x522d2b=_['merge']({},_0x522d2b,_0x59e547[_0x0030('0x55')]);var _0x5dc7be={'where':_0x522d2b['where']};return db[_0x0030('0x41')][_0x0030('0x30')](_0x5dc7be)[_0x0030('0x20')](function(_0x13b04f){_0x4eb15f[_0x0030('0x30')]=_0x13b04f;if(_0x59e547['query'][_0x0030('0x56')]){_0x522d2b[_0x0030('0x57')]=[{'all':!![]}];}return db['FaxAccount'][_0x0030('0x58')](_0x522d2b);})[_0x0030('0x20')](function(_0x373fad){_0x4eb15f['rows']=_0x373fad;return _0x4eb15f;})[_0x0030('0x20')](respondWithFilteredResult(_0x133868,_0x522d2b))[_0x0030('0x59')](handleError(_0x133868,null));};exports[_0x0030('0x5a')]=function(_0x52dd24,_0x4e7a93){var _0x40a489={'raw':![],'where':{'id':_0x52dd24[_0x0030('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x14aece={};_0x14aece[_0x0030('0x46')]=_['keys'](db['FaxAccount']['rawAttributes']);_0x14aece[_0x0030('0x47')]=_[_0x0030('0x48')](_0x52dd24[_0x0030('0x47')]);_0x14aece[_0x0030('0x51')]=_['intersection'](_0x14aece[_0x0030('0x46')],_0x14aece['query']);_0x40a489[_0x0030('0x4b')]=_[_0x0030('0x49')](_0x14aece[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x52dd24[_0x0030('0x47')][_0x0030('0x4a')]));_0x40a489[_0x0030('0x4b')]=_0x40a489[_0x0030('0x4b')][_0x0030('0x5c')]?_0x40a489['attributes']:_0x14aece[_0x0030('0x46')];if(_0x52dd24['query'][_0x0030('0x56')]){_0x40a489[_0x0030('0x57')]=[{'all':!![]}];}_0x40a489=_[_0x0030('0x53')]({},_0x40a489,_0x52dd24['options']);return db[_0x0030('0x41')][_0x0030('0x5d')](_0x40a489)[_0x0030('0x20')](handleEntityNotFound(_0x4e7a93,null))[_0x0030('0x20')](respondWithResult(_0x4e7a93,null))[_0x0030('0x59')](handleError(_0x4e7a93,null));};exports[_0x0030('0x5e')]=function(_0x204f34,_0x14cd73){return db[_0x0030('0x41')][_0x0030('0x5e')](_0x204f34[_0x0030('0x5f')],{})[_0x0030('0x20')](function(_0x3d30e9){var _0x1bef4b=_0x204f34[_0x0030('0x60')][_0x0030('0x38')]({'plain':!![]});if(!_0x1bef4b)throw new Error(_0x0030('0x61'));if(_0x1bef4b[_0x0030('0x62')]===_0x0030('0x60')){var _0x29f885=_0x3d30e9[_0x0030('0x38')]({'plain':!![]});var _0x1eb8f1=_0x0030('0x39');return db[_0x0030('0x63')][_0x0030('0x5d')]({'where':{'name':_0x1eb8f1,'userProfileId':_0x1bef4b[_0x0030('0x64')]},'raw':!![]})[_0x0030('0x20')](function(_0x13f0df){if(_0x13f0df&&_0x13f0df['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x29f885[_0x0030('0x3c')],'resourceId':_0x29f885['id'],'type':_0x13f0df['name'],'sectionId':_0x13f0df['id']},{})[_0x0030('0x20')](function(){return _0x3d30e9;});}else{return _0x3d30e9;}})[_0x0030('0x59')](function(_0x16f4b9){logger[_0x0030('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16f4b9);throw _0x16f4b9;});}return _0x3d30e9;})[_0x0030('0x20')](respondWithResult(_0x14cd73,0xc9))[_0x0030('0x59')](handleError(_0x14cd73,null));};exports[_0x0030('0x36')]=function(_0x3e3d51,_0x49da06){if(_0x3e3d51[_0x0030('0x5f')]['id']){delete _0x3e3d51[_0x0030('0x5f')]['id'];}return db[_0x0030('0x41')][_0x0030('0x5d')]({'where':{'id':_0x3e3d51[_0x0030('0x5b')]['id']},'include':[{'model':db[_0x0030('0x65')],'as':_0x0030('0x3f')}]})[_0x0030('0x20')](handleEntityNotFound(_0x49da06,null))['then'](saveUpdates(_0x3e3d51['body'],null))['then'](respondWithResult(_0x49da06,null))[_0x0030('0x59')](handleError(_0x49da06,null));};exports['destroy']=function(_0x525e28,_0x561a1e){return db[_0x0030('0x41')]['find']({'where':{'id':_0x525e28[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x561a1e,null))['then'](removeEntity(_0x561a1e,null))[_0x0030('0x59')](handleError(_0x561a1e,null));};exports['describe']=function(_0x2385e0,_0x409c86){return db[_0x0030('0x41')]['describe']()[_0x0030('0x20')](respondWithResult(_0x409c86,null))[_0x0030('0x59')](handleError(_0x409c86,null));};exports['addDisposition']=function(_0x1e2581,_0x96442a,_0x40dc42){if(_0x1e2581[_0x0030('0x5f')]['id']){delete _0x1e2581[_0x0030('0x5f')]['id'];}return db[_0x0030('0x41')]['find']({'where':{'id':_0x1e2581['params']['id']}})['then'](handleEntityNotFound(_0x96442a,null))[_0x0030('0x20')](function(_0x123937){if(_0x123937){_0x1e2581[_0x0030('0x5f')]['FaxAccountId']=_0x123937['id'];return db[_0x0030('0x66')][_0x0030('0x5e')](_0x1e2581['body']);}})['then'](respondWithResult(_0x96442a,null))[_0x0030('0x59')](handleError(_0x96442a,null));};exports[_0x0030('0x67')]=function(_0x5a3a6c,_0x45e1d6,_0x1afe29){var _0x387420={'raw':![],'where':{}};var _0x117c89={};var _0x15c025={'count':0x0,'rows':[]};return db[_0x0030('0x41')]['findOne']({'where':{'id':_0x5a3a6c['params']['id']}})['then'](handleEntityNotFound(_0x45e1d6,null))[_0x0030('0x20')](function(_0x32445b){if(_0x32445b){_0x117c89[_0x0030('0x46')]=_['keys'](db[_0x0030('0x66')][_0x0030('0x42')]);_0x117c89[_0x0030('0x47')]=_['keys'](_0x5a3a6c[_0x0030('0x47')]);_0x117c89[_0x0030('0x51')]=_['intersection'](_0x117c89[_0x0030('0x46')],_0x117c89[_0x0030('0x47')]);_0x387420[_0x0030('0x4b')]=_[_0x0030('0x49')](_0x117c89[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x5a3a6c[_0x0030('0x47')]['fields']));_0x387420['attributes']=_0x387420['attributes']['length']?_0x387420[_0x0030('0x4b')]:_0x117c89['model'];if(!_0x5a3a6c[_0x0030('0x47')][_0x0030('0x4c')]('nolimit')){_0x387420['limit']=qs[_0x0030('0x2e')](_0x5a3a6c[_0x0030('0x47')][_0x0030('0x2e')]);_0x387420['offset']=qs[_0x0030('0x2d')](_0x5a3a6c[_0x0030('0x47')][_0x0030('0x2d')]);}_0x387420[_0x0030('0x4e')]=qs[_0x0030('0x4f')](_0x5a3a6c[_0x0030('0x47')][_0x0030('0x4f')]);_0x387420[_0x0030('0x50')]=qs[_0x0030('0x51')](_[_0x0030('0x68')](_0x5a3a6c['query'],_0x117c89[_0x0030('0x51')]));_0x387420['where'][_0x0030('0x69')]=_0x32445b['id'];if(_0x5a3a6c[_0x0030('0x47')][_0x0030('0x52')]){_0x387420['where']=_['merge'](_0x387420['where'],{'$or':_[_0x0030('0x40')](_0x387420['attributes'],function(_0x2f9bcc){var _0x32c120={};_0x32c120[_0x2f9bcc]={'$like':'%'+_0x5a3a6c['query'][_0x0030('0x52')]+'%'};return _0x32c120;})});}_0x387420=_[_0x0030('0x53')]({},_0x387420,_0x5a3a6c[_0x0030('0x55')]);return db[_0x0030('0x66')]['count']({'where':_0x387420['where']})[_0x0030('0x20')](function(_0x2a192b){_0x15c025[_0x0030('0x30')]=_0x2a192b;if(_0x5a3a6c['query']['includeAll']){_0x387420[_0x0030('0x57')]=[{'all':!![]}];}return db[_0x0030('0x66')][_0x0030('0x58')](_0x387420);})[_0x0030('0x20')](function(_0x684d78){_0x15c025['rows']=_0x684d78;return _0x15c025;});}})[_0x0030('0x20')](respondWithFilteredResult(_0x45e1d6,_0x387420))[_0x0030('0x59')](handleError(_0x45e1d6,null));};exports['removeDispositions']=function(_0x25053d,_0x121914,_0x2bf4f9){return db[_0x0030('0x41')][_0x0030('0x5d')]({'where':{'id':_0x25053d[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x121914,null))['then'](function(_0x14266f){if(_0x14266f){return _0x14266f['removeDispositions'](_0x25053d[_0x0030('0x47')][_0x0030('0x6a')]);}})['then'](respondWithStatusCode(_0x121914,null))[_0x0030('0x59')](handleError(_0x121914,null));};exports[_0x0030('0x6b')]=function(_0x2be350,_0x5eb5bc,_0x364502){if(_0x2be350['body']['id']){delete _0x2be350['body']['id'];}return db[_0x0030('0x41')][_0x0030('0x5d')]({'where':{'id':_0x2be350[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x5eb5bc,null))['then'](function(_0x365fa6){if(_0x365fa6){_0x2be350[_0x0030('0x5f')]['FaxAccountId']=_0x365fa6['id'];return db['CannedAnswer'][_0x0030('0x5e')](_0x2be350[_0x0030('0x5f')]);}})[_0x0030('0x20')](respondWithResult(_0x5eb5bc,null))[_0x0030('0x59')](handleError(_0x5eb5bc,null));};exports['getAnswers']=function(_0x6421f6,_0x3b49ab,_0x3cbbe2){var _0x2bbc32={'raw':![],'where':{}};var _0x526791={};var _0x301e5e={'count':0x0,'rows':[]};return db[_0x0030('0x41')]['findOne']({'where':{'id':_0x6421f6[_0x0030('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b49ab,null))[_0x0030('0x20')](function(_0x554139){if(_0x554139){_0x526791[_0x0030('0x46')]=_[_0x0030('0x48')](db[_0x0030('0x6c')][_0x0030('0x42')]);_0x526791[_0x0030('0x47')]=_[_0x0030('0x48')](_0x6421f6[_0x0030('0x47')]);_0x526791[_0x0030('0x51')]=_['intersection'](_0x526791[_0x0030('0x46')],_0x526791[_0x0030('0x47')]);_0x2bbc32[_0x0030('0x4b')]=_['intersection'](_0x526791[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x6421f6[_0x0030('0x47')][_0x0030('0x4a')]));_0x2bbc32[_0x0030('0x4b')]=_0x2bbc32[_0x0030('0x4b')][_0x0030('0x5c')]?_0x2bbc32[_0x0030('0x4b')]:_0x526791[_0x0030('0x46')];if(!_0x6421f6[_0x0030('0x47')]['hasOwnProperty'](_0x0030('0x4d'))){_0x2bbc32[_0x0030('0x2e')]=qs[_0x0030('0x2e')](_0x6421f6[_0x0030('0x47')][_0x0030('0x2e')]);_0x2bbc32['offset']=qs[_0x0030('0x2d')](_0x6421f6[_0x0030('0x47')][_0x0030('0x2d')]);}_0x2bbc32[_0x0030('0x4e')]=qs[_0x0030('0x4f')](_0x6421f6[_0x0030('0x47')][_0x0030('0x4f')]);_0x2bbc32[_0x0030('0x50')]=qs[_0x0030('0x51')](_[_0x0030('0x68')](_0x6421f6['query'],_0x526791[_0x0030('0x51')]));_0x2bbc32[_0x0030('0x50')][_0x0030('0x69')]=_0x554139['id'];if(_0x6421f6[_0x0030('0x47')][_0x0030('0x52')]){_0x2bbc32[_0x0030('0x50')]=_[_0x0030('0x53')](_0x2bbc32[_0x0030('0x50')],{'$or':_[_0x0030('0x40')](_0x2bbc32[_0x0030('0x4b')],function(_0x522bc3){var _0x38fd6e={};_0x38fd6e[_0x522bc3]={'$like':'%'+_0x6421f6[_0x0030('0x47')][_0x0030('0x52')]+'%'};return _0x38fd6e;})});}_0x2bbc32=_[_0x0030('0x53')]({},_0x2bbc32,_0x6421f6['options']);return db[_0x0030('0x6c')][_0x0030('0x30')]({'where':_0x2bbc32[_0x0030('0x50')]})[_0x0030('0x20')](function(_0x3b95a8){_0x301e5e['count']=_0x3b95a8;if(_0x6421f6['query'][_0x0030('0x56')]){_0x2bbc32[_0x0030('0x57')]=[{'all':!![]}];}return db[_0x0030('0x6c')]['findAll'](_0x2bbc32);})[_0x0030('0x20')](function(_0x2bb27c){_0x301e5e[_0x0030('0x6d')]=_0x2bb27c;return _0x301e5e;});}})[_0x0030('0x20')](respondWithFilteredResult(_0x3b49ab,_0x2bbc32))[_0x0030('0x59')](handleError(_0x3b49ab,null));};exports[_0x0030('0x6e')]=function(_0x87f7f0,_0x4d14c4,_0x34a7d4){return db[_0x0030('0x41')][_0x0030('0x5d')]({'where':{'id':_0x87f7f0[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x4d14c4,null))[_0x0030('0x20')](function(_0xf1d848){if(_0xf1d848){return _0xf1d848[_0x0030('0x6e')](_0x87f7f0[_0x0030('0x47')][_0x0030('0x6a')]);}})[_0x0030('0x20')](respondWithStatusCode(_0x4d14c4,null))[_0x0030('0x59')](handleError(_0x4d14c4,null));};exports[_0x0030('0x6f')]=function(_0x2ad209,_0x333ff8,_0x38994e){return db['FaxInteraction']['find']({'where':{'id':_0x2ad209[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x333ff8,null))[_0x0030('0x20')](function(_0x5797e5){if(_0x5797e5){return _0x5797e5[_0x0030('0x6f')](_0x2ad209[_0x0030('0x5f')][_0x0030('0x6a')],_[_0x0030('0x70')](_0x2ad209['body'],[_0x0030('0x6a'),'id'])||{});}})[_0x0030('0x20')](respondWithResult(_0x333ff8,null))[_0x0030('0x59')](handleError(_0x333ff8,null));};exports['getInteractions']=function(_0x4c1a84,_0x20c2d5,_0x1d5b74){var _0x28bd4d={'raw':![],'where':{}};var _0x2397d9={};var _0x2b4e9f={'count':0x0,'rows':[]};return db[_0x0030('0x41')][_0x0030('0x71')]({'where':{'id':_0x4c1a84[_0x0030('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20c2d5,null))[_0x0030('0x20')](function(_0x1ead3d){if(_0x1ead3d){_0x2397d9[_0x0030('0x46')]=_['keys'](db[_0x0030('0x72')][_0x0030('0x42')]);_0x2397d9[_0x0030('0x47')]=_[_0x0030('0x48')](_0x4c1a84[_0x0030('0x47')]);_0x2397d9[_0x0030('0x51')]=_['intersection'](_0x2397d9[_0x0030('0x46')],_0x2397d9[_0x0030('0x47')]);_0x28bd4d[_0x0030('0x4b')]=_[_0x0030('0x49')](_0x2397d9[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x4c1a84[_0x0030('0x47')][_0x0030('0x4a')]));_0x28bd4d[_0x0030('0x4b')]=_0x28bd4d['attributes'][_0x0030('0x5c')]?_0x28bd4d['attributes']:_0x2397d9[_0x0030('0x46')];if(!_0x4c1a84['query'][_0x0030('0x4c')](_0x0030('0x4d'))){_0x28bd4d['limit']=qs[_0x0030('0x2e')](_0x4c1a84[_0x0030('0x47')][_0x0030('0x2e')]);_0x28bd4d[_0x0030('0x2d')]=qs[_0x0030('0x2d')](_0x4c1a84[_0x0030('0x47')]['offset']);}_0x28bd4d[_0x0030('0x4e')]=qs[_0x0030('0x4f')](_0x4c1a84[_0x0030('0x47')]['sort']);_0x28bd4d[_0x0030('0x50')]=qs[_0x0030('0x51')](_[_0x0030('0x68')](_0x4c1a84[_0x0030('0x47')],_0x2397d9['filters']));_0x28bd4d[_0x0030('0x50')]['FaxAccountId']=_0x1ead3d['id'];if(_0x4c1a84[_0x0030('0x47')][_0x0030('0x52')]){_0x28bd4d[_0x0030('0x50')]=_[_0x0030('0x53')](_0x28bd4d[_0x0030('0x50')],{'$or':_[_0x0030('0x40')](_0x28bd4d['attributes'],function(_0x4e8445){var _0x3f0667={};_0x3f0667[_0x4e8445]={'$like':'%'+_0x4c1a84['query'][_0x0030('0x52')]+'%'};return _0x3f0667;})});}_0x28bd4d=_[_0x0030('0x53')]({},_0x28bd4d,_0x4c1a84[_0x0030('0x55')]);return db['FaxInteraction'][_0x0030('0x30')]({'where':_0x28bd4d['where']})[_0x0030('0x20')](function(_0x5cc0ca){_0x2b4e9f[_0x0030('0x30')]=_0x5cc0ca;if(_0x4c1a84[_0x0030('0x47')][_0x0030('0x56')]){_0x28bd4d[_0x0030('0x57')]=[{'model':db[_0x0030('0x73')],'as':_0x0030('0x74'),'required':![]},{'model':db[_0x0030('0x75')],'as':'Owner','attributes':[_0x0030('0x3c'),'fullname',_0x0030('0x76')],'required':![]},{'model':db[_0x0030('0x77')],'as':_0x0030('0x78'),'attributes':['id',_0x0030('0x3c'),_0x0030('0x79')],'where':_0x4c1a84['query'][_0x0030('0x7a')]?{'id':_0x4c1a84['query'][_0x0030('0x7a')]}:undefined,'required':_0x4c1a84[_0x0030('0x47')][_0x0030('0x7a')]?!![]:![]}];}return db[_0x0030('0x72')]['findAll'](_0x28bd4d);})[_0x0030('0x20')](function(_0x4042a8){_0x2b4e9f[_0x0030('0x6d')]=_0x4042a8;return _0x2b4e9f;});}})[_0x0030('0x20')](respondWithFilteredResult(_0x20c2d5,_0x28bd4d))[_0x0030('0x59')](handleError(_0x20c2d5,null));};exports[_0x0030('0x7b')]=function(_0x21d69e,_0x925de8){var _0x49c25b=_0x21d69e[_0x0030('0x5b')]['id'];var _0xcdcd9c=_0x21d69e[_0x0030('0x5f')];var _0x472f0c=0xc8;var _0x3dc9cf=null;return db[_0x0030('0x7c')][_0x0030('0x7d')]({'isolationLevel':db['sequelize'][_0x0030('0x7e')][_0x0030('0x7f')][_0x0030('0x80')]},function(_0x1d602){return db[_0x0030('0x41')]['findOne']({'where':{'id':_0x49c25b},'transaction':_0x1d602})[_0x0030('0x20')](function(_0x54e7f9){if(_0x54e7f9){return db[_0x0030('0x81')][_0x0030('0x37')]({'where':{'FaxAccountId':_0x49c25b},'transaction':_0x1d602})['then'](function(){var _0x25e0c0=_[_0x0030('0x40')](_0xcdcd9c,function(_0x4e0ecc){_0x4e0ecc[_0x0030('0x69')]=_0x49c25b;return _0x4e0ecc;});return db[_0x0030('0x81')][_0x0030('0x82')](_0x25e0c0,{'transaction':_0x1d602});});}else{_0x472f0c=0x194;_0x3dc9cf=[];}});})[_0x0030('0x20')](function(){if(_0x472f0c!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x49c25b},'order':_0x0030('0x83')})[_0x0030('0x20')](function(_0x2dcc18){_0x3dc9cf=_0x2dcc18;});}})[_0x0030('0x59')](function(_0x445c80){_0x472f0c=0x1f4;logger[_0x0030('0x25')](_0x445c80[_0x0030('0x3b')]);if(_0x445c80['name']){delete _0x445c80['name'];}_0x3dc9cf=_0x445c80;})[_0x0030('0x84')](function(){if(_0x3dc9cf===null){_0x925de8[_0x0030('0x2a')](_0x472f0c);}else{if(_0x472f0c===0x1f4){_0x925de8['status'](_0x472f0c)[_0x0030('0x3d')](_0x3dc9cf);}else{_0x925de8[_0x0030('0x2b')](_0x472f0c)[_0x0030('0x2c')](_0x3dc9cf);}}});};exports[_0x0030('0x85')]=function(_0x557770,_0x230e5e,_0x46c155){var _0x51fcae={};var _0x9b87e8={};var _0x2af968;var _0x1eaf9b;return db[_0x0030('0x41')][_0x0030('0x71')]({'where':{'id':_0x557770[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x230e5e,null))[_0x0030('0x20')](function(_0x3b2e47){if(_0x3b2e47){_0x2af968=_0x3b2e47;_0x9b87e8[_0x0030('0x46')]=_[_0x0030('0x48')](db[_0x0030('0x81')][_0x0030('0x42')]);_0x9b87e8['query']=_[_0x0030('0x48')](_0x557770['query']);_0x9b87e8[_0x0030('0x51')]=_[_0x0030('0x49')](_0x9b87e8[_0x0030('0x46')],_0x9b87e8[_0x0030('0x47')]);_0x51fcae[_0x0030('0x4b')]=_[_0x0030('0x49')](_0x9b87e8[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x557770[_0x0030('0x47')][_0x0030('0x4a')]));_0x51fcae['attributes']=_0x51fcae[_0x0030('0x4b')][_0x0030('0x5c')]?_0x51fcae['attributes']:_0x9b87e8[_0x0030('0x46')];_0x51fcae[_0x0030('0x4e')]=qs[_0x0030('0x4f')](_0x557770[_0x0030('0x47')][_0x0030('0x4f')]);_0x51fcae[_0x0030('0x50')]=qs[_0x0030('0x51')](_[_0x0030('0x68')](_0x557770[_0x0030('0x47')],_0x9b87e8[_0x0030('0x51')]));if(_0x557770['query'][_0x0030('0x52')]){_0x51fcae[_0x0030('0x50')]=_['merge'](_0x51fcae[_0x0030('0x50')],{'$or':_[_0x0030('0x40')](_0x51fcae['attributes'],function(_0x20f99f){var _0x5f4db3={};_0x5f4db3[_0x20f99f]={'$like':'%'+_0x557770[_0x0030('0x47')]['filter']+'%'};return _0x5f4db3;})});}_0x51fcae=_[_0x0030('0x53')]({},_0x51fcae,_0x557770[_0x0030('0x55')]);return _0x2af968[_0x0030('0x85')](_0x51fcae);}})['then'](function(_0x1a7b75){if(_0x1a7b75){_0x1eaf9b=_0x1a7b75['length'];if(!_0x557770[_0x0030('0x47')][_0x0030('0x4c')](_0x0030('0x4d'))){_0x51fcae[_0x0030('0x2e')]=qs[_0x0030('0x2e')](_0x557770[_0x0030('0x47')]['limit']);_0x51fcae[_0x0030('0x2d')]=qs[_0x0030('0x2d')](_0x557770['query'][_0x0030('0x2d')]);}return _0x2af968[_0x0030('0x85')](_0x51fcae);}})[_0x0030('0x20')](function(_0x29c94f){if(_0x29c94f){return _0x29c94f?{'count':_0x1eaf9b,'rows':_0x29c94f}:null;}})['then'](respondWithResult(_0x230e5e,null))[_0x0030('0x59')](handleError(_0x230e5e,null));};function Extension(_0x2aadf7,_0x56ebd7,_0x4baa88,_0x319077){this[_0x0030('0x86')]=_0x0030('0x87');this[_0x0030('0x88')]=_0x2aadf7['localstationid'];this[_0x0030('0x89')]=_0x319077;this['type']=_0x0030('0x8a');this[_0x0030('0x8b')]=_0x0030('0x8c');this[_0x0030('0x69')]=_0x2aadf7['id'];this['priority']=_0x56ebd7;this[_0x0030('0x8d')]=_0x4baa88;}function createExtensionsReciveFax(_0x4e43c7){var _0x3d593e=0x1;var _0x8fc618=[];_0x8fc618[_0x0030('0x8e')](new Extension(_0x4e43c7,_0x3d593e,'',_0x0030('0x8f')));_0x3d593e+=0x1;_0x8fc618[_0x0030('0x8e')](new Extension(_0x4e43c7,_0x3d593e,'CDR(type)=inbound-fax',_0x0030('0x90')));_0x3d593e+=0x1;for(var _0x22147c in _0x4e43c7){if(_0x4e43c7[_0x0030('0x4c')](_0x22147c)&&(_0x22147c===_0x0030('0x91')||_0x22147c==='localstationid'||_0x22147c==='gateway'||_0x22147c===_0x0030('0x92')||_0x22147c==='headerinfo'||_0x22147c===_0x0030('0x93')||_0x22147c===_0x0030('0x94')||_0x22147c===_0x0030('0x95')||_0x22147c==='t38timeout')){_0x8fc618['push'](new Extension(_0x4e43c7,_0x3d593e,'FAXOPT('+_0x22147c+')='+_0x4e43c7[_0x22147c],_0x0030('0x90')));_0x3d593e+=0x1;}}_0x8fc618[_0x0030('0x8e')](new Extension(_0x4e43c7,_0x3d593e,'6',_0x0030('0x96')));_0x3d593e+=0x1;_0x8fc618['push'](new Extension(_0x4e43c7,_0x3d593e,_0x0030('0x97'),'ReceiveFax'));_0x3d593e=0x0;return _0x8fc618;}exports[_0x0030('0x98')]=function(_0x2ed0be,_0x18814e,_0x7c3b56){var _0x24b7aa;return db['sequelize'][_0x0030('0x7d')](function(_0x51fdae){return db[_0x0030('0x41')]['create'](_0x2ed0be[_0x0030('0x5f')],{'transaction':_0x51fdae})[_0x0030('0x20')](function(_0x1233b9){_0x24b7aa=_0x1233b9[_0x0030('0x38')]({'plain':!![]});return db[_0x0030('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x24b7aa),{'transaction':_0x51fdae});});})[_0x0030('0x20')](function(){return _0x24b7aa;})[_0x0030('0x20')](respondWithResult(_0x18814e,null))[_0x0030('0x59')](handleError(_0x18814e,null));};exports['updateAccountApplications']=function(_0x3e9bf7,_0x314711,_0x6c6a01){var _0x566a49;return db[_0x0030('0x7c')][_0x0030('0x7d')](function(_0x477cad){return db[_0x0030('0x41')]['update'](_0x3e9bf7['body'],{'where':{'id':_0x3e9bf7[_0x0030('0x5f')]['id']},'transaction':_0x477cad})[_0x0030('0x20')](function(_0x25ec48){return db[_0x0030('0x99')][_0x0030('0x37')]({'where':{'FaxAccountId':_0x3e9bf7[_0x0030('0x5f')]['id']},'transaction':_0x477cad})['then'](function(_0x4d7f6e){return db['VoiceExtension'][_0x0030('0x82')](createExtensionsReciveFax(_[_0x0030('0x70')](_0x3e9bf7[_0x0030('0x5f')],['tech',_0x0030('0x45'),_0x0030('0x9a'),_0x0030('0x9b'),'TrunkId',_0x0030('0x9c')])),{'transaction':_0x477cad});});});})[_0x0030('0x20')](function(){return db[_0x0030('0x41')]['findById'](_0x3e9bf7[_0x0030('0x5f')]['id']);})['then'](respondWithResult(_0x314711,null))['catch'](handleError(_0x314711,null));};exports[_0x0030('0x9d')]=function(_0x246fd4,_0x62a650,_0x5797d1){var _0x94899c={'raw':!![],'where':{}};var _0xf3cc8a={};var _0x123781={'count':0x0,'rows':[]};return db[_0x0030('0x41')]['findOne']({'where':{'id':_0x246fd4[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x62a650,null))[_0x0030('0x20')](function(_0x4fb78c){if(_0x4fb78c){_0xf3cc8a[_0x0030('0x46')]=_[_0x0030('0x48')](db[_0x0030('0x9e')][_0x0030('0x42')]);_0xf3cc8a[_0x0030('0x47')]=_['keys'](_0x246fd4['query']);_0xf3cc8a[_0x0030('0x51')]=_[_0x0030('0x49')](_0xf3cc8a[_0x0030('0x46')],_0xf3cc8a[_0x0030('0x47')]);_0x94899c[_0x0030('0x4b')]=_['intersection'](_0xf3cc8a[_0x0030('0x46')],qs[_0x0030('0x4a')](_0x246fd4['query'][_0x0030('0x4a')]));_0x94899c[_0x0030('0x4b')]=_0x94899c[_0x0030('0x4b')][_0x0030('0x5c')]?_0x94899c[_0x0030('0x4b')]:_0xf3cc8a[_0x0030('0x46')];if(!_0x246fd4[_0x0030('0x47')][_0x0030('0x4c')](_0x0030('0x4d'))){_0x94899c['limit']=qs[_0x0030('0x2e')](_0x246fd4[_0x0030('0x47')]['limit']);_0x94899c['offset']=qs[_0x0030('0x2d')](_0x246fd4[_0x0030('0x47')][_0x0030('0x2d')]);}_0x94899c[_0x0030('0x4e')]=qs['sort'](_0x246fd4[_0x0030('0x47')][_0x0030('0x4f')]);_0x94899c[_0x0030('0x50')]=qs[_0x0030('0x51')](_[_0x0030('0x68')](_0x246fd4['query'],_0xf3cc8a[_0x0030('0x51')]));_0x94899c[_0x0030('0x50')][_0x0030('0x69')]=_0x4fb78c['id'];if(_0x246fd4[_0x0030('0x47')][_0x0030('0x52')]){_0x94899c[_0x0030('0x50')]=_[_0x0030('0x53')](_0x94899c['where'],{'$or':_['map'](_0x94899c[_0x0030('0x4b')],function(_0x4e15ac){var _0x2ed227={};_0x2ed227[_0x4e15ac]={'$like':'%'+_0x246fd4[_0x0030('0x47')]['filter']+'%'};return _0x2ed227;})});}if(_0x246fd4[_0x0030('0x47')][_0x0030('0x9f')]){var _0x5a2956=_0x246fd4[_0x0030('0x47')][_0x0030('0x9f')][_0x0030('0xa0')](',');var _0x3095c6={};_0x3095c6[_0x5a2956[0x0]]={'$gte':moment(_0x5a2956[0x1])[_0x0030('0xa1')](_0x0030('0xa2'))};_0x94899c['where']=_[_0x0030('0x53')](_0x94899c[_0x0030('0x50')],_0x3095c6);}_0x94899c=_['merge']({},_0x94899c,_0x246fd4[_0x0030('0x55')]);return db[_0x0030('0x9e')][_0x0030('0x30')]({'where':_0x94899c[_0x0030('0x50')]})[_0x0030('0x20')](function(_0x3607b3){_0x123781[_0x0030('0x30')]=_0x3607b3;if(_0x246fd4[_0x0030('0x47')]['includeAll']){_0x94899c[_0x0030('0x57')]=[{'all':!![]}];}return db[_0x0030('0x9e')]['findAll'](_0x94899c);})[_0x0030('0x20')](function(_0x17cc43){_0x123781['rows']=_0x17cc43;return _0x123781;});}})[_0x0030('0x20')](respondWithFilteredResult(_0x62a650,_0x94899c))[_0x0030('0x59')](handleError(_0x62a650,null));};exports[_0x0030('0x3d')]=function(_0x505d5b,_0x4893aa,_0x4dc24f){var _0x209879,_0x2314a3={},_0x3b9e67;if(_0x505d5b['body']['to']){_0x3b9e67=_0x505d5b[_0x0030('0x5f')]['to'][0x0];}return db[_0x0030('0x41')][_0x0030('0x5d')]({'where':{'id':_0x505d5b[_0x0030('0x5b')]['id']},'include':[{'model':db[_0x0030('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0030('0xa4'),'where':{'fax':_0x3b9e67},'limit':0x1,'order':[[_0x0030('0x9b'),_0x0030('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x4893aa,null))['then'](function(_0x1dd8bb){_0x209879=_0x1dd8bb;if(_0x505d5b['body']['attachments']&&_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][_0x0030('0x5c')]){for(var _0x5ce439=0x0;_0x5ce439<_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][_0x0030('0x5c')];_0x5ce439+=0x1){_0x505d5b[_0x0030('0x5f')]['attachments'][_0x5ce439]={'filename':_0x505d5b['body'][_0x0030('0xa6')][_0x5ce439][_0x0030('0x3c')],'id':_0x505d5b[_0x0030('0x5f')]['attachments'][_0x5ce439]['id'],'path':path[_0x0030('0xa7')](config[_0x0030('0xa8')],'server/files/attachments',_0x505d5b[_0x0030('0x5f')]['attachments'][_0x5ce439]['basename'])};}}return respondWithRpcPromise(_0x0030('0xa9'),_0x0030('0xa9'),{'FaxAccountId':_['isNil'](_0x505d5b[_0x0030('0x5b')]['id'])?undefined:_0x505d5b[_0x0030('0x5b')]['id'],'path':_[_0x0030('0xaa')](_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][0x0][_0x0030('0x8')])?undefined:_0x505d5b['body']['attachments'][0x0][_0x0030('0x8')],'fax':_[_0x0030('0xaa')](_0x505d5b['body']['to'][0x0])?undefined:_0x505d5b['body']['to'][0x0]},client9002);})['then'](function(){if(_0x209879){if(_['isNil'](_0x505d5b['body'][_0x0030('0xab')])){_0x505d5b[_0x0030('0x5f')]['from']=util[_0x0030('0xa1')](_0x0030('0xac'),_0x209879[_0x0030('0x3c')],_0x209879['fax']);}if(_0x209879[_0x0030('0xad')]){if(_0x209879[_0x0030('0xad')][_0x0030('0xa4')][_0x0030('0x5c')]){return _0x209879[_0x0030('0xad')][_0x0030('0xa4')][0x0];}else{return db['CmContact'][_0x0030('0x5e')](_[_0x0030('0x18')](_0x505d5b[_0x0030('0x5f')],{'firstName':_0x505d5b['body']['to'][0x0],'phone':_0x505d5b[_0x0030('0x5f')]['to'][0x0],'fax':_0x505d5b['body']['to'][0x0],'ListId':_0x209879[_0x0030('0x9c')]}));}}else{throw new Error(_0x0030('0xae'));}}else{throw new Error(_0x0030('0xaf'));}})['then'](function(_0x965b83){if(_0x965b83){return db[_0x0030('0x72')]['find']({'where':{'ContactId':_0x965b83['id'],'closed':![],'FaxAccountId':_0x209879['id']}})['then'](function(_0x386e4d){if(_0x386e4d){return[_0x386e4d,![]];}return db['FaxInteraction'][_0x0030('0x5e')]({'UserId':_0x505d5b['user']['id'],'ContactId':_0x965b83['id'],'FaxAccountId':_0x209879['id'],'fax':_0x505d5b[_0x0030('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0030('0x53')](_0x505d5b[_0x0030('0x5f')],{'read':![],'body':_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][0x0][_0x0030('0xb0')],'FaxAccountId':_0x209879['id'],'UserId':_0x505d5b[_0x0030('0x60')]['id'],'ContactId':_0x965b83['id'],'AttachmentId':_0x505d5b['body'][_0x0030('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x0030('0xb1')}]})[_0x0030('0x20')](function(_0x58f26b){return[_0x58f26b,!![]];});});}else{throw new Error(_0x0030('0xb2'));}})[_0x0030('0xb3')](function(_0x8daab,_0x5eccdd){if(_0x5eccdd){return _0x8daab;}return db[_0x0030('0x9e')][_0x0030('0x5e')]({'direction':_0x0030('0xb4'),'read':![],'body':_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][0x0][_0x0030('0xb0')],'FaxAccountId':_0x209879['id'],'FaxInteractionId':_0x8daab['id'],'UserId':_0x505d5b[_0x0030('0x60')]['id'],'ContactId':_0x8daab['ContactId'],'AttachmentId':_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][0x0]['id']})[_0x0030('0x20')](function(_0x15e937){_0x8daab[_0x0030('0xb5')][_0x0030('0xb1')]=[];_0x8daab[_0x0030('0xb5')][_0x0030('0xb1')][_0x0030('0x8e')](_0x15e937['dataValues']);return _0x8daab;});})[_0x0030('0x20')](function(_0x3293bd){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x0030('0xaa')](_0x505d5b['params']['id'])?undefined:_0x505d5b[_0x0030('0x5b')]['id'],'path':_[_0x0030('0xaa')](_0x505d5b['body'][_0x0030('0xa6')][0x0]['path'])?undefined:_0x505d5b['body'][_0x0030('0xa6')][0x0][_0x0030('0x8')],'fax':_[_0x0030('0xaa')](_0x505d5b[_0x0030('0x5f')]['to'][0x0])?undefined:_0x505d5b[_0x0030('0x5f')]['to'][0x0],'AttachmentId':_0x505d5b[_0x0030('0x5f')][_0x0030('0xa6')][0x0]['id']},client9002)['then'](function(_0x4e4153){logger[_0x0030('0x21')](_0x0030('0xb6'),_0x4e4153);})['catch'](function(_0x227f41){logger[_0x0030('0x21')](_0x0030('0xb6'),_0x227f41);});return _0x3293bd;})[_0x0030('0x20')](respondWithResult(_0x4893aa,null))['catch'](handleError(_0x4893aa,null));};exports[_0x0030('0xb7')]=function(_0x425947,_0x1ebf7d,_0x5bbccc){return db[_0x0030('0x41')][_0x0030('0x5d')]({'where':{'id':_0x425947[_0x0030('0x5b')]['id']}})[_0x0030('0x20')](handleEntityNotFound(_0x1ebf7d,null))['then'](function(_0x44f448){if(_0x44f448){return _0x44f448[_0x0030('0xb7')](_0x425947[_0x0030('0x5f')]['ids'],_[_0x0030('0x70')](_0x425947[_0x0030('0x5f')],[_0x0030('0x6a'),'id'])||{})[_0x0030('0xb3')](function(_0x3628cc){for(var _0x407280=0x0;_0x407280<_0x425947[_0x0030('0x5f')]['ids'][_0x0030('0x5c')];_0x407280+=0x1){socket[_0x0030('0xb8')](_0x0030('0xb9'),{'UserId':Number(_0x425947['body'][_0x0030('0x6a')][_0x407280]),'FaxAccountId':Number(_0x425947[_0x0030('0x5b')]['id'])});}return _0x3628cc;});}})[_0x0030('0x20')](respondWithResult(_0x1ebf7d,null))[_0x0030('0x59')](handleError(_0x1ebf7d,null));};exports[_0x0030('0xba')]=function(_0x56a900,_0x13679d,_0x20c0a9){return db['FaxAccount'][_0x0030('0x5d')]({'where':{'id':_0x56a900[_0x0030('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13679d,null))['then'](function(_0x490990){if(_0x490990){return _0x490990['removeAgents'](_0x56a900['query'][_0x0030('0x6a')])[_0x0030('0x20')](function(){if(_[_0x0030('0xbb')](_0x56a900['query'][_0x0030('0x6a')])){for(var _0x56609c=0x0;_0x56609c<_0x56a900[_0x0030('0x47')][_0x0030('0x6a')][_0x0030('0x5c')];_0x56609c+=0x1){socket[_0x0030('0xb8')](_0x0030('0xbc'),{'UserId':Number(_0x56a900[_0x0030('0x47')][_0x0030('0x6a')][_0x56609c]),'FaxAccountId':Number(_0x56a900[_0x0030('0x5b')]['id'])});}}else{socket['emit'](_0x0030('0xbc'),{'UserId':Number(_0x56a900[_0x0030('0x47')][_0x0030('0x6a')]),'FaxAccountId':Number(_0x56a900[_0x0030('0x5b')]['id'])});}});}})[_0x0030('0x20')](respondWithStatusCode(_0x13679d,null))[_0x0030('0x59')](handleError(_0x13679d,null));};exports[_0x0030('0xbd')]=function(_0xc2264d,_0x5940cf,_0x120d54){var _0xe0bca5={};var _0x17d491={};var _0x57f4a8;var _0xfe7c16;return db[_0x0030('0x41')]['findOne']({'where':{'id':_0xc2264d['params']['id']}})['then'](handleEntityNotFound(_0x5940cf,null))[_0x0030('0x20')](function(_0x527131){if(_0x527131){_0x57f4a8=_0x527131;_0x17d491[_0x0030('0x46')]=_[_0x0030('0x48')](db['User'][_0x0030('0x42')]);_0x17d491['query']=_['keys'](_0xc2264d[_0x0030('0x47')]);_0x17d491[_0x0030('0x51')]=_[_0x0030('0x49')](_0x17d491['model'],_0x17d491[_0x0030('0x47')]);_0xe0bca5[_0x0030('0x4b')]=_[_0x0030('0x49')](_0x17d491[_0x0030('0x46')],qs['fields'](_0xc2264d['query'][_0x0030('0x4a')]));_0xe0bca5[_0x0030('0x4b')]=_0xe0bca5[_0x0030('0x4b')][_0x0030('0x5c')]?_0xe0bca5[_0x0030('0x4b')]:_0x17d491[_0x0030('0x46')];_0xe0bca5['order']=qs['sort'](_0xc2264d['query'][_0x0030('0x4f')]);_0xe0bca5['where']=qs[_0x0030('0x51')](_[_0x0030('0x68')](_0xc2264d[_0x0030('0x47')],_0x17d491[_0x0030('0x51')]));if(_0xc2264d[_0x0030('0x47')]['filter']){_0xe0bca5[_0x0030('0x50')]=_['merge'](_0xe0bca5[_0x0030('0x50')],{'$or':_[_0x0030('0x40')](_0xe0bca5['attributes'],function(_0x33985c){var _0x4a1653={};_0x4a1653[_0x33985c]={'$like':'%'+_0xc2264d['query']['filter']+'%'};return _0x4a1653;})});}_0xe0bca5=_[_0x0030('0x53')]({},_0xe0bca5,_0xc2264d['options']);return _0x57f4a8[_0x0030('0xbd')](_0xe0bca5);}})[_0x0030('0x20')](function(_0x476717){if(_0x476717){_0xfe7c16=_0x476717[_0x0030('0x5c')];if(!_0xc2264d[_0x0030('0x47')][_0x0030('0x4c')](_0x0030('0x4d'))){_0xe0bca5[_0x0030('0x2e')]=qs[_0x0030('0x2e')](_0xc2264d[_0x0030('0x47')][_0x0030('0x2e')]);_0xe0bca5['offset']=qs[_0x0030('0x2d')](_0xc2264d['query'][_0x0030('0x2d')]);}return _0x57f4a8[_0x0030('0xbd')](_0xe0bca5);}})[_0x0030('0x20')](function(_0x2a3707){if(_0x2a3707){return _0x2a3707?{'count':_0xfe7c16,'rows':_0x2a3707}:null;}})['then'](respondWithResult(_0x5940cf,null))[_0x0030('0x59')](handleError(_0x5940cf,null));}; \ No newline at end of file +var _0x4e7e=['nolimit','where','pick','type','VIRTUAL','filter','FaxAccount','count','include','rows','show','params','length','includeAll','options','find','create','body','user','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','Disposition','getDispositions','findOne','FaxAccountId','merge','findAll','removeDispositions','ids','CannedAnswer','order','sort','removeAnswers','omit','getInteractions','FaxInteraction','Contact','User','Owner','fullname','internal','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','send','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','Set','ecm','headerinfo','minrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','index','Pause','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x43cdc5,_0x2f19ba){var _0x2da6c5=function(_0x1bf4f7){while(--_0x1bf4f7){_0x43cdc5['push'](_0x43cdc5['shift']());}};_0x2da6c5(++_0x2f19ba);}(_0x4e7e,0x137));var _0xe4e7=function(_0xb3dfc4,_0x2a2c47){_0xb3dfc4=_0xb3dfc4-0x0;var _0x4e060a=_0x4e7e[_0xb3dfc4];return _0x4e060a;};'use strict';var emlformat=require(_0xe4e7('0x0'));var rimraf=require(_0xe4e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4e7('0x2'));var rp=require(_0xe4e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe4e7('0x4'));var path=require(_0xe4e7('0x5'));var sox=require(_0xe4e7('0x6'));var csv=require('to-csv');var ejs=require(_0xe4e7('0x7'));var fs=require('fs');var fs_extra=require(_0xe4e7('0x8'));var _=require(_0xe4e7('0x9'));var squel=require(_0xe4e7('0xa'));var crypto=require(_0xe4e7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe4e7('0xc'));var Papa=require(_0xe4e7('0xd'));var Redis=require(_0xe4e7('0xe'));var authService=require(_0xe4e7('0xf'));var qs=require(_0xe4e7('0x10'));var as=require(_0xe4e7('0x11'));var hardwareService=require(_0xe4e7('0x12'));var logger=require(_0xe4e7('0x13'))(_0xe4e7('0x14'));var utils=require('../../config/utils');var config=require(_0xe4e7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe4e7('0x16')]=_[_0xe4e7('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4e7('0x16')]));require('./faxAccount.socket')[_0xe4e7('0x18')](socket);var jayson=require(_0xe4e7('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe4e7('0x1a')][_0xe4e7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x53d4e,_0x5c4d37,_0xb90c2f,_0xd3c9b8){return new BPromise(function(_0x13415f,_0x56a7e7){var _0x130f5b=_0xd3c9b8||client;return _0x130f5b[_0xe4e7('0x1c')](_0x53d4e,_0xb90c2f)[_0xe4e7('0x1d')](function(_0x3e98b1){logger['info'](_0xe4e7('0x1e'),_0x5c4d37,_0xe4e7('0x1f'));logger['debug'](_0xe4e7('0x20'),_0x5c4d37,_0xe4e7('0x1f'),JSON[_0xe4e7('0x21')](_0x3e98b1));if(_0x3e98b1[_0xe4e7('0x22')]){if(_0x3e98b1[_0xe4e7('0x22')][_0xe4e7('0x23')]===0x1f4){logger[_0xe4e7('0x22')]('FaxAccount,\x20%s,\x20%s',_0x5c4d37,_0x3e98b1[_0xe4e7('0x22')][_0xe4e7('0x24')]);return _0x56a7e7(_0x3e98b1[_0xe4e7('0x22')][_0xe4e7('0x24')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5c4d37,_0x3e98b1[_0xe4e7('0x22')][_0xe4e7('0x24')]);return _0x13415f(_0x3e98b1[_0xe4e7('0x22')][_0xe4e7('0x24')]);}else{logger[_0xe4e7('0x25')]('FaxAccount,\x20%s,\x20%s',_0x5c4d37,_0xe4e7('0x1f'));_0x13415f(_0x3e98b1[_0xe4e7('0x26')][_0xe4e7('0x24')]);}})[_0xe4e7('0x27')](function(_0x4e6e92){logger[_0xe4e7('0x22')]('FaxAccount,\x20%s,\x20%s',_0x5c4d37,_0x4e6e92);_0x56a7e7(_0x4e6e92);});});}function respondWithStatusCode(_0x3c681d,_0x1cc762){_0x1cc762=_0x1cc762||0xcc;return function(_0x402f2b){if(_0x402f2b){return _0x3c681d[_0xe4e7('0x28')](_0x1cc762);}return _0x3c681d['status'](_0x1cc762)['end']();};}function respondWithResult(_0x91f40e,_0xade02a){_0xade02a=_0xade02a||0xc8;return function(_0x4e4642){if(_0x4e4642){return _0x91f40e[_0xe4e7('0x29')](_0xade02a)[_0xe4e7('0x2a')](_0x4e4642);}};}function respondWithFilteredResult(_0x5e6001,_0x111a59){return function(_0xf9413a){if(_0xf9413a){var _0x364d97=typeof _0x111a59['offset']===_0xe4e7('0x2b')&&typeof _0x111a59[_0xe4e7('0x2c')]===_0xe4e7('0x2b');var _0x46ef71=_0xf9413a['count'];var _0x5cb6cc=_0x364d97?0x0:_0x111a59[_0xe4e7('0x2d')];var _0x3b6e13=_0x364d97?_0xf9413a['count']:_0x111a59['offset']+_0x111a59[_0xe4e7('0x2c')];var _0x2773a6;if(_0x3b6e13>=_0x46ef71){_0x3b6e13=_0x46ef71;_0x2773a6=0xc8;}else{_0x2773a6=0xce;}_0x5e6001['status'](_0x2773a6);return _0x5e6001[_0xe4e7('0x2e')](_0xe4e7('0x2f'),_0x5cb6cc+'-'+_0x3b6e13+'/'+_0x46ef71)[_0xe4e7('0x2a')](_0xf9413a);}return null;};}function patchUpdates(_0x91dddd){return function(_0x5a0bb3){try{jsonpatch[_0xe4e7('0x30')](_0x5a0bb3,_0x91dddd,!![]);}catch(_0x46ea04){return BPromise[_0xe4e7('0x31')](_0x46ea04);}return _0x5a0bb3[_0xe4e7('0x32')]();};}function saveUpdates(_0x431dc1,_0x3b5cdf){return function(_0x205d21){if(_0x205d21){return _0x205d21[_0xe4e7('0x33')](_0x431dc1)[_0xe4e7('0x1d')](function(_0x5ca386){return _0x5ca386;});}return null;};}function removeEntity(_0xb53fb8,_0x5e389f){return function(_0x12892a){if(_0x12892a){return _0x12892a[_0xe4e7('0x34')]()[_0xe4e7('0x1d')](function(){var _0x59fc8d=_0x12892a[_0xe4e7('0x35')]({'plain':!![]});var _0xc12a8c='FaxAccounts';return db[_0xe4e7('0x36')][_0xe4e7('0x34')]({'where':{'type':_0xc12a8c,'resourceId':_0x59fc8d['id']}})[_0xe4e7('0x1d')](function(){return _0x12892a;});})['then'](function(){_0xb53fb8['status'](0xcc)[_0xe4e7('0x37')]();});}};}function handleEntityNotFound(_0x11f717,_0x9dd87f){return function(_0x3da9a4){if(!_0x3da9a4){_0x11f717['sendStatus'](0x194);}return _0x3da9a4;};}function handleError(_0xcc5912,_0x315c39){_0x315c39=_0x315c39||0x1f4;return function(_0x4cc4bd){logger['error'](_0x4cc4bd[_0xe4e7('0x38')]);if(_0x4cc4bd[_0xe4e7('0x39')]){delete _0x4cc4bd[_0xe4e7('0x39')];}_0xcc5912[_0xe4e7('0x29')](_0x315c39)['send'](_0x4cc4bd);};}exports[_0xe4e7('0x3a')]=function(_0x18a8f9,_0x360554){var _0x5891bb={'include':[{'model':db[_0xe4e7('0x3b')],'as':'mandatoryDispositionPause'}]},_0xd8de61={},_0x49e967={'count':0x0,'rows':[]};var _0x21a21d=_['map'](db['FaxAccount'][_0xe4e7('0x3c')],function(_0x43c91b){return{'name':_0x43c91b['fieldName'],'type':_0x43c91b['type'][_0xe4e7('0x3d')]};});_0xd8de61[_0xe4e7('0x3e')]=_[_0xe4e7('0x3f')](_0x21a21d,_0xe4e7('0x39'));_0xd8de61['query']=_[_0xe4e7('0x40')](_0x18a8f9[_0xe4e7('0x41')]);_0xd8de61[_0xe4e7('0x42')]=_[_0xe4e7('0x43')](_0xd8de61['model'],_0xd8de61[_0xe4e7('0x41')]);_0x5891bb[_0xe4e7('0x44')]=_[_0xe4e7('0x43')](_0xd8de61[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x18a8f9[_0xe4e7('0x41')][_0xe4e7('0x45')]));_0x5891bb['attributes']=_0x5891bb['attributes']['length']?_0x5891bb[_0xe4e7('0x44')]:_0xd8de61[_0xe4e7('0x3e')];if(!_0x18a8f9['query'][_0xe4e7('0x46')](_0xe4e7('0x47'))){_0x5891bb[_0xe4e7('0x2c')]=qs['limit'](_0x18a8f9['query'][_0xe4e7('0x2c')]);_0x5891bb[_0xe4e7('0x2d')]=qs['offset'](_0x18a8f9[_0xe4e7('0x41')][_0xe4e7('0x2d')]);}_0x5891bb['order']=qs['sort'](_0x18a8f9['query']['sort']);_0x5891bb[_0xe4e7('0x48')]=qs['filters'](_[_0xe4e7('0x49')](_0x18a8f9[_0xe4e7('0x41')],_0xd8de61[_0xe4e7('0x42')]),_0x21a21d);if(_0x18a8f9[_0xe4e7('0x41')]['filter']){_0x5891bb[_0xe4e7('0x48')]=_['merge'](_0x5891bb[_0xe4e7('0x48')],{'$or':_['map'](_0x21a21d,function(_0x2c6833){if(_0x2c6833[_0xe4e7('0x4a')]!==_0xe4e7('0x4b')){var _0x359362={};_0x359362[_0x2c6833[_0xe4e7('0x39')]]={'$like':'%'+_0x18a8f9[_0xe4e7('0x41')][_0xe4e7('0x4c')]+'%'};return _0x359362;}})});}_0x5891bb=_['merge']({},_0x5891bb,_0x18a8f9['options']);var _0x388678={'where':_0x5891bb[_0xe4e7('0x48')]};return db[_0xe4e7('0x4d')][_0xe4e7('0x4e')](_0x388678)[_0xe4e7('0x1d')](function(_0x21fe5b){_0x49e967['count']=_0x21fe5b;if(_0x18a8f9['query']['includeAll']){_0x5891bb[_0xe4e7('0x4f')]=[{'all':!![]}];}return db[_0xe4e7('0x4d')]['findAll'](_0x5891bb);})['then'](function(_0x2a771a){_0x49e967[_0xe4e7('0x50')]=_0x2a771a;return _0x49e967;})[_0xe4e7('0x1d')](respondWithFilteredResult(_0x360554,_0x5891bb))[_0xe4e7('0x27')](handleError(_0x360554,null));};exports[_0xe4e7('0x51')]=function(_0x172411,_0x344b3f){var _0x292995={'raw':![],'where':{'id':_0x172411[_0xe4e7('0x52')]['id']},'include':[{'model':db[_0xe4e7('0x3b')],'as':'mandatoryDispositionPause'}]},_0x530c39={};_0x530c39['model']=_[_0xe4e7('0x40')](db[_0xe4e7('0x4d')][_0xe4e7('0x3c')]);_0x530c39[_0xe4e7('0x41')]=_['keys'](_0x172411[_0xe4e7('0x41')]);_0x530c39[_0xe4e7('0x42')]=_['intersection'](_0x530c39[_0xe4e7('0x3e')],_0x530c39[_0xe4e7('0x41')]);_0x292995['attributes']=_[_0xe4e7('0x43')](_0x530c39['model'],qs[_0xe4e7('0x45')](_0x172411[_0xe4e7('0x41')]['fields']));_0x292995[_0xe4e7('0x44')]=_0x292995[_0xe4e7('0x44')][_0xe4e7('0x53')]?_0x292995[_0xe4e7('0x44')]:_0x530c39[_0xe4e7('0x3e')];if(_0x172411[_0xe4e7('0x41')][_0xe4e7('0x54')]){_0x292995[_0xe4e7('0x4f')]=[{'all':!![]}];}_0x292995=_['merge']({},_0x292995,_0x172411[_0xe4e7('0x55')]);return db[_0xe4e7('0x4d')][_0xe4e7('0x56')](_0x292995)[_0xe4e7('0x1d')](handleEntityNotFound(_0x344b3f,null))[_0xe4e7('0x1d')](respondWithResult(_0x344b3f,null))[_0xe4e7('0x27')](handleError(_0x344b3f,null));};exports[_0xe4e7('0x57')]=function(_0x25e373,_0x51ed60){return db[_0xe4e7('0x4d')][_0xe4e7('0x57')](_0x25e373[_0xe4e7('0x58')],{})[_0xe4e7('0x1d')](function(_0x157a85){var _0x144fb2=_0x25e373[_0xe4e7('0x59')][_0xe4e7('0x35')]({'plain':!![]});if(!_0x144fb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x144fb2['role']===_0xe4e7('0x59')){var _0x3a85a2=_0x157a85['get']({'plain':!![]});var _0x591087=_0xe4e7('0x5a');return db[_0xe4e7('0x5b')][_0xe4e7('0x56')]({'where':{'name':_0x591087,'userProfileId':_0x144fb2['userProfileId']},'raw':!![]})[_0xe4e7('0x1d')](function(_0x5a14b1){if(_0x5a14b1&&_0x5a14b1[_0xe4e7('0x5c')]===0x0){return db[_0xe4e7('0x36')][_0xe4e7('0x57')]({'name':_0x3a85a2[_0xe4e7('0x39')],'resourceId':_0x3a85a2['id'],'type':_0x5a14b1[_0xe4e7('0x39')],'sectionId':_0x5a14b1['id']},{})[_0xe4e7('0x1d')](function(){return _0x157a85;});}else{return _0x157a85;}})['catch'](function(_0x4bd7fe){logger[_0xe4e7('0x22')](_0xe4e7('0x5d'),_0x4bd7fe);throw _0x4bd7fe;});}return _0x157a85;})[_0xe4e7('0x1d')](respondWithResult(_0x51ed60,0xc9))['catch'](handleError(_0x51ed60,null));};exports[_0xe4e7('0x33')]=function(_0x250c2e,_0x2da96a){if(_0x250c2e[_0xe4e7('0x58')]['id']){delete _0x250c2e[_0xe4e7('0x58')]['id'];}return db[_0xe4e7('0x4d')]['find']({'where':{'id':_0x250c2e[_0xe4e7('0x52')]['id']},'include':[{'model':db[_0xe4e7('0x3b')],'as':_0xe4e7('0x5e')}]})[_0xe4e7('0x1d')](handleEntityNotFound(_0x2da96a,null))['then'](saveUpdates(_0x250c2e[_0xe4e7('0x58')],null))[_0xe4e7('0x1d')](respondWithResult(_0x2da96a,null))['catch'](handleError(_0x2da96a,null));};exports[_0xe4e7('0x34')]=function(_0x99be70,_0x711a1c){return db[_0xe4e7('0x4d')][_0xe4e7('0x56')]({'where':{'id':_0x99be70[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x711a1c,null))[_0xe4e7('0x1d')](removeEntity(_0x711a1c,null))[_0xe4e7('0x27')](handleError(_0x711a1c,null));};exports['describe']=function(_0x194d19,_0x2ed5a7){return db[_0xe4e7('0x4d')][_0xe4e7('0x5f')]()[_0xe4e7('0x1d')](respondWithResult(_0x2ed5a7,null))[_0xe4e7('0x27')](handleError(_0x2ed5a7,null));};exports['addDisposition']=function(_0x4c258b,_0xfc9a47,_0xb805a){if(_0x4c258b['body']['id']){delete _0x4c258b[_0xe4e7('0x58')]['id'];}return db[_0xe4e7('0x4d')]['find']({'where':{'id':_0x4c258b[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0xfc9a47,null))[_0xe4e7('0x1d')](function(_0x45fac9){if(_0x45fac9){_0x4c258b[_0xe4e7('0x58')]['FaxAccountId']=_0x45fac9['id'];return db[_0xe4e7('0x60')]['create'](_0x4c258b[_0xe4e7('0x58')]);}})['then'](respondWithResult(_0xfc9a47,null))[_0xe4e7('0x27')](handleError(_0xfc9a47,null));};exports[_0xe4e7('0x61')]=function(_0x5e4603,_0x512e94,_0x53c2af){var _0x4507fc={'raw':![],'where':{}};var _0x514008={};var _0x408f20={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe4e7('0x62')]({'where':{'id':_0x5e4603[_0xe4e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x512e94,null))['then'](function(_0x26bddb){if(_0x26bddb){_0x514008['model']=_['keys'](db[_0xe4e7('0x60')]['rawAttributes']);_0x514008[_0xe4e7('0x41')]=_[_0xe4e7('0x40')](_0x5e4603[_0xe4e7('0x41')]);_0x514008[_0xe4e7('0x42')]=_[_0xe4e7('0x43')](_0x514008['model'],_0x514008[_0xe4e7('0x41')]);_0x4507fc[_0xe4e7('0x44')]=_[_0xe4e7('0x43')](_0x514008[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x5e4603[_0xe4e7('0x41')]['fields']));_0x4507fc[_0xe4e7('0x44')]=_0x4507fc['attributes']['length']?_0x4507fc['attributes']:_0x514008[_0xe4e7('0x3e')];if(!_0x5e4603['query'][_0xe4e7('0x46')](_0xe4e7('0x47'))){_0x4507fc[_0xe4e7('0x2c')]=qs[_0xe4e7('0x2c')](_0x5e4603[_0xe4e7('0x41')][_0xe4e7('0x2c')]);_0x4507fc[_0xe4e7('0x2d')]=qs[_0xe4e7('0x2d')](_0x5e4603[_0xe4e7('0x41')][_0xe4e7('0x2d')]);}_0x4507fc['order']=qs['sort'](_0x5e4603[_0xe4e7('0x41')]['sort']);_0x4507fc['where']=qs['filters'](_['pick'](_0x5e4603['query'],_0x514008[_0xe4e7('0x42')]));_0x4507fc['where'][_0xe4e7('0x63')]=_0x26bddb['id'];if(_0x5e4603['query'][_0xe4e7('0x4c')]){_0x4507fc['where']=_[_0xe4e7('0x64')](_0x4507fc['where'],{'$or':_['map'](_0x4507fc[_0xe4e7('0x44')],function(_0x207627){var _0x1b47c1={};_0x1b47c1[_0x207627]={'$like':'%'+_0x5e4603[_0xe4e7('0x41')][_0xe4e7('0x4c')]+'%'};return _0x1b47c1;})});}_0x4507fc=_[_0xe4e7('0x64')]({},_0x4507fc,_0x5e4603[_0xe4e7('0x55')]);return db['Disposition'][_0xe4e7('0x4e')]({'where':_0x4507fc[_0xe4e7('0x48')]})['then'](function(_0x3e42ee){_0x408f20[_0xe4e7('0x4e')]=_0x3e42ee;if(_0x5e4603[_0xe4e7('0x41')][_0xe4e7('0x54')]){_0x4507fc[_0xe4e7('0x4f')]=[{'all':!![]}];}return db[_0xe4e7('0x60')][_0xe4e7('0x65')](_0x4507fc);})[_0xe4e7('0x1d')](function(_0x210ee8){_0x408f20['rows']=_0x210ee8;return _0x408f20;});}})['then'](respondWithFilteredResult(_0x512e94,_0x4507fc))[_0xe4e7('0x27')](handleError(_0x512e94,null));};exports[_0xe4e7('0x66')]=function(_0xc0292c,_0x58a072,_0x2bfcc6){return db['FaxAccount'][_0xe4e7('0x56')]({'where':{'id':_0xc0292c[_0xe4e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x58a072,null))[_0xe4e7('0x1d')](function(_0x3a26ea){if(_0x3a26ea){return _0x3a26ea[_0xe4e7('0x66')](_0xc0292c['query'][_0xe4e7('0x67')]);}})[_0xe4e7('0x1d')](respondWithStatusCode(_0x58a072,null))[_0xe4e7('0x27')](handleError(_0x58a072,null));};exports['addAnswer']=function(_0x4f830a,_0x2a1f16,_0x97f8b2){if(_0x4f830a[_0xe4e7('0x58')]['id']){delete _0x4f830a[_0xe4e7('0x58')]['id'];}return db[_0xe4e7('0x4d')][_0xe4e7('0x56')]({'where':{'id':_0x4f830a[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x2a1f16,null))['then'](function(_0x57b912){if(_0x57b912){_0x4f830a['body'][_0xe4e7('0x63')]=_0x57b912['id'];return db[_0xe4e7('0x68')][_0xe4e7('0x57')](_0x4f830a[_0xe4e7('0x58')]);}})[_0xe4e7('0x1d')](respondWithResult(_0x2a1f16,null))[_0xe4e7('0x27')](handleError(_0x2a1f16,null));};exports['getAnswers']=function(_0x4813b7,_0x4cd772,_0x17a743){var _0x2d64da={'raw':![],'where':{}};var _0x2a6c36={};var _0xa4bcf7={'count':0x0,'rows':[]};return db[_0xe4e7('0x4d')][_0xe4e7('0x62')]({'where':{'id':_0x4813b7['params']['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x4cd772,null))[_0xe4e7('0x1d')](function(_0x383f81){if(_0x383f81){_0x2a6c36[_0xe4e7('0x3e')]=_['keys'](db[_0xe4e7('0x68')]['rawAttributes']);_0x2a6c36[_0xe4e7('0x41')]=_['keys'](_0x4813b7[_0xe4e7('0x41')]);_0x2a6c36[_0xe4e7('0x42')]=_[_0xe4e7('0x43')](_0x2a6c36['model'],_0x2a6c36[_0xe4e7('0x41')]);_0x2d64da[_0xe4e7('0x44')]=_[_0xe4e7('0x43')](_0x2a6c36[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x4813b7[_0xe4e7('0x41')][_0xe4e7('0x45')]));_0x2d64da[_0xe4e7('0x44')]=_0x2d64da[_0xe4e7('0x44')][_0xe4e7('0x53')]?_0x2d64da[_0xe4e7('0x44')]:_0x2a6c36[_0xe4e7('0x3e')];if(!_0x4813b7[_0xe4e7('0x41')][_0xe4e7('0x46')](_0xe4e7('0x47'))){_0x2d64da[_0xe4e7('0x2c')]=qs[_0xe4e7('0x2c')](_0x4813b7[_0xe4e7('0x41')][_0xe4e7('0x2c')]);_0x2d64da['offset']=qs[_0xe4e7('0x2d')](_0x4813b7[_0xe4e7('0x41')]['offset']);}_0x2d64da[_0xe4e7('0x69')]=qs['sort'](_0x4813b7[_0xe4e7('0x41')][_0xe4e7('0x6a')]);_0x2d64da[_0xe4e7('0x48')]=qs[_0xe4e7('0x42')](_[_0xe4e7('0x49')](_0x4813b7[_0xe4e7('0x41')],_0x2a6c36[_0xe4e7('0x42')]));_0x2d64da['where'][_0xe4e7('0x63')]=_0x383f81['id'];if(_0x4813b7[_0xe4e7('0x41')][_0xe4e7('0x4c')]){_0x2d64da['where']=_[_0xe4e7('0x64')](_0x2d64da['where'],{'$or':_[_0xe4e7('0x3f')](_0x2d64da[_0xe4e7('0x44')],function(_0x5b630d){var _0x21ff14={};_0x21ff14[_0x5b630d]={'$like':'%'+_0x4813b7[_0xe4e7('0x41')]['filter']+'%'};return _0x21ff14;})});}_0x2d64da=_[_0xe4e7('0x64')]({},_0x2d64da,_0x4813b7['options']);return db[_0xe4e7('0x68')]['count']({'where':_0x2d64da[_0xe4e7('0x48')]})['then'](function(_0x4de52e){_0xa4bcf7[_0xe4e7('0x4e')]=_0x4de52e;if(_0x4813b7[_0xe4e7('0x41')][_0xe4e7('0x54')]){_0x2d64da['include']=[{'all':!![]}];}return db[_0xe4e7('0x68')][_0xe4e7('0x65')](_0x2d64da);})[_0xe4e7('0x1d')](function(_0x5a20f7){_0xa4bcf7[_0xe4e7('0x50')]=_0x5a20f7;return _0xa4bcf7;});}})[_0xe4e7('0x1d')](respondWithFilteredResult(_0x4cd772,_0x2d64da))['catch'](handleError(_0x4cd772,null));};exports[_0xe4e7('0x6b')]=function(_0x8a0132,_0x4bbcd4,_0x1e5d43){return db['FaxAccount'][_0xe4e7('0x56')]({'where':{'id':_0x8a0132['params']['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x4bbcd4,null))[_0xe4e7('0x1d')](function(_0x1c640b){if(_0x1c640b){return _0x1c640b[_0xe4e7('0x6b')](_0x8a0132[_0xe4e7('0x41')]['ids']);}})[_0xe4e7('0x1d')](respondWithStatusCode(_0x4bbcd4,null))[_0xe4e7('0x27')](handleError(_0x4bbcd4,null));};exports['addInteraction']=function(_0x1f6c91,_0x5b4198,_0x6a711a){return db['FaxInteraction'][_0xe4e7('0x56')]({'where':{'id':_0x1f6c91[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x5b4198,null))[_0xe4e7('0x1d')](function(_0x56695b){if(_0x56695b){return _0x56695b['addInteraction'](_0x1f6c91['body'][_0xe4e7('0x67')],_[_0xe4e7('0x6c')](_0x1f6c91[_0xe4e7('0x58')],[_0xe4e7('0x67'),'id'])||{});}})[_0xe4e7('0x1d')](respondWithResult(_0x5b4198,null))[_0xe4e7('0x27')](handleError(_0x5b4198,null));};exports[_0xe4e7('0x6d')]=function(_0x2437ee,_0x432f10,_0x179458){var _0xf29f7b={'raw':![],'where':{}};var _0x42bbc9={};var _0xf32e58={'count':0x0,'rows':[]};return db[_0xe4e7('0x4d')][_0xe4e7('0x62')]({'where':{'id':_0x2437ee['params']['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x432f10,null))[_0xe4e7('0x1d')](function(_0xbcfa8){if(_0xbcfa8){_0x42bbc9[_0xe4e7('0x3e')]=_[_0xe4e7('0x40')](db[_0xe4e7('0x6e')]['rawAttributes']);_0x42bbc9['query']=_[_0xe4e7('0x40')](_0x2437ee[_0xe4e7('0x41')]);_0x42bbc9[_0xe4e7('0x42')]=_[_0xe4e7('0x43')](_0x42bbc9[_0xe4e7('0x3e')],_0x42bbc9[_0xe4e7('0x41')]);_0xf29f7b[_0xe4e7('0x44')]=_[_0xe4e7('0x43')](_0x42bbc9[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x45')]));_0xf29f7b['attributes']=_0xf29f7b[_0xe4e7('0x44')][_0xe4e7('0x53')]?_0xf29f7b['attributes']:_0x42bbc9[_0xe4e7('0x3e')];if(!_0x2437ee[_0xe4e7('0x41')]['hasOwnProperty']('nolimit')){_0xf29f7b['limit']=qs['limit'](_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x2c')]);_0xf29f7b['offset']=qs[_0xe4e7('0x2d')](_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x2d')]);}_0xf29f7b[_0xe4e7('0x69')]=qs[_0xe4e7('0x6a')](_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x6a')]);_0xf29f7b[_0xe4e7('0x48')]=qs['filters'](_[_0xe4e7('0x49')](_0x2437ee[_0xe4e7('0x41')],_0x42bbc9[_0xe4e7('0x42')]));_0xf29f7b['where'][_0xe4e7('0x63')]=_0xbcfa8['id'];if(_0x2437ee[_0xe4e7('0x41')]['filter']){_0xf29f7b[_0xe4e7('0x48')]=_[_0xe4e7('0x64')](_0xf29f7b[_0xe4e7('0x48')],{'$or':_[_0xe4e7('0x3f')](_0xf29f7b['attributes'],function(_0x35d948){var _0x53d50d={};_0x53d50d[_0x35d948]={'$like':'%'+_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x4c')]+'%'};return _0x53d50d;})});}_0xf29f7b=_[_0xe4e7('0x64')]({},_0xf29f7b,_0x2437ee['options']);return db[_0xe4e7('0x6e')]['count']({'where':_0xf29f7b['where']})['then'](function(_0x1f9c6b){_0xf32e58['count']=_0x1f9c6b;if(_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x54')]){_0xf29f7b[_0xe4e7('0x4f')]=[{'model':db['CmContact'],'as':_0xe4e7('0x6f'),'required':![]},{'model':db[_0xe4e7('0x70')],'as':_0xe4e7('0x71'),'attributes':[_0xe4e7('0x39'),_0xe4e7('0x72'),_0xe4e7('0x73')],'required':![]},{'model':db[_0xe4e7('0x74')],'as':'Tags','attributes':['id',_0xe4e7('0x39'),_0xe4e7('0x75')],'where':_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x76')]?{'id':_0x2437ee['query'][_0xe4e7('0x76')]}:undefined,'required':_0x2437ee[_0xe4e7('0x41')][_0xe4e7('0x76')]?!![]:![]}];}return db[_0xe4e7('0x6e')][_0xe4e7('0x65')](_0xf29f7b);})[_0xe4e7('0x1d')](function(_0x2e701e){_0xf32e58[_0xe4e7('0x50')]=_0x2e701e;return _0xf32e58;});}})['then'](respondWithFilteredResult(_0x432f10,_0xf29f7b))[_0xe4e7('0x27')](handleError(_0x432f10,null));};exports['addApplications']=function(_0x3f61e4,_0x22aff7){var _0x336d27=_0x3f61e4[_0xe4e7('0x52')]['id'];var _0x207db4=_0x3f61e4[_0xe4e7('0x58')];var _0x1b3756=0xc8;var _0x595c5a=null;return db[_0xe4e7('0x77')][_0xe4e7('0x78')]({'isolationLevel':db[_0xe4e7('0x77')][_0xe4e7('0x79')][_0xe4e7('0x7a')][_0xe4e7('0x7b')]},function(_0x57ced4){return db[_0xe4e7('0x4d')][_0xe4e7('0x62')]({'where':{'id':_0x336d27},'transaction':_0x57ced4})['then'](function(_0x5c7451){if(_0x5c7451){return db[_0xe4e7('0x7c')][_0xe4e7('0x34')]({'where':{'FaxAccountId':_0x336d27},'transaction':_0x57ced4})['then'](function(){var _0x1436fb=_[_0xe4e7('0x3f')](_0x207db4,function(_0x4b89be){_0x4b89be['FaxAccountId']=_0x336d27;return _0x4b89be;});return db[_0xe4e7('0x7c')]['bulkCreate'](_0x1436fb,{'transaction':_0x57ced4});});}else{_0x1b3756=0x194;_0x595c5a=[];}});})[_0xe4e7('0x1d')](function(){if(_0x1b3756!==0x194){return db[_0xe4e7('0x7c')][_0xe4e7('0x7d')]({'where':{'FaxAccountId':_0x336d27},'order':'priority'})['then'](function(_0x2d425d){_0x595c5a=_0x2d425d;});}})[_0xe4e7('0x27')](function(_0x3aebcf){_0x1b3756=0x1f4;logger[_0xe4e7('0x22')](_0x3aebcf[_0xe4e7('0x38')]);if(_0x3aebcf[_0xe4e7('0x39')]){delete _0x3aebcf[_0xe4e7('0x39')];}_0x595c5a=_0x3aebcf;})[_0xe4e7('0x7e')](function(){if(_0x595c5a===null){_0x22aff7[_0xe4e7('0x28')](_0x1b3756);}else{if(_0x1b3756===0x1f4){_0x22aff7[_0xe4e7('0x29')](_0x1b3756)[_0xe4e7('0x7f')](_0x595c5a);}else{_0x22aff7['status'](_0x1b3756)[_0xe4e7('0x2a')](_0x595c5a);}}});};exports['getApplications']=function(_0x30f81c,_0x3af192,_0x172c6f){var _0x362ac3={};var _0x32c9d5={};var _0x3a5cf7;var _0x591d73;return db[_0xe4e7('0x4d')][_0xe4e7('0x62')]({'where':{'id':_0x30f81c[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x3af192,null))[_0xe4e7('0x1d')](function(_0x2036ee){if(_0x2036ee){_0x3a5cf7=_0x2036ee;_0x32c9d5[_0xe4e7('0x3e')]=_['keys'](db[_0xe4e7('0x7c')]['rawAttributes']);_0x32c9d5[_0xe4e7('0x41')]=_['keys'](_0x30f81c['query']);_0x32c9d5['filters']=_[_0xe4e7('0x43')](_0x32c9d5[_0xe4e7('0x3e')],_0x32c9d5[_0xe4e7('0x41')]);_0x362ac3['attributes']=_['intersection'](_0x32c9d5[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x30f81c[_0xe4e7('0x41')][_0xe4e7('0x45')]));_0x362ac3[_0xe4e7('0x44')]=_0x362ac3[_0xe4e7('0x44')][_0xe4e7('0x53')]?_0x362ac3[_0xe4e7('0x44')]:_0x32c9d5[_0xe4e7('0x3e')];_0x362ac3[_0xe4e7('0x69')]=qs[_0xe4e7('0x6a')](_0x30f81c['query'][_0xe4e7('0x6a')]);_0x362ac3[_0xe4e7('0x48')]=qs[_0xe4e7('0x42')](_['pick'](_0x30f81c['query'],_0x32c9d5[_0xe4e7('0x42')]));if(_0x30f81c['query'][_0xe4e7('0x4c')]){_0x362ac3[_0xe4e7('0x48')]=_['merge'](_0x362ac3[_0xe4e7('0x48')],{'$or':_['map'](_0x362ac3[_0xe4e7('0x44')],function(_0x1ab4f7){var _0x224224={};_0x224224[_0x1ab4f7]={'$like':'%'+_0x30f81c[_0xe4e7('0x41')]['filter']+'%'};return _0x224224;})});}_0x362ac3=_['merge']({},_0x362ac3,_0x30f81c['options']);return _0x3a5cf7['getApplications'](_0x362ac3);}})['then'](function(_0x552664){if(_0x552664){_0x591d73=_0x552664[_0xe4e7('0x53')];if(!_0x30f81c[_0xe4e7('0x41')]['hasOwnProperty'](_0xe4e7('0x47'))){_0x362ac3['limit']=qs[_0xe4e7('0x2c')](_0x30f81c[_0xe4e7('0x41')]['limit']);_0x362ac3['offset']=qs[_0xe4e7('0x2d')](_0x30f81c[_0xe4e7('0x41')]['offset']);}return _0x3a5cf7[_0xe4e7('0x80')](_0x362ac3);}})['then'](function(_0x250770){if(_0x250770){return _0x250770?{'count':_0x591d73,'rows':_0x250770}:null;}})[_0xe4e7('0x1d')](respondWithResult(_0x3af192,null))[_0xe4e7('0x27')](handleError(_0x3af192,null));};function Extension(_0xdc774e,_0x1d1801,_0x5cc34b,_0xca5331){this['context']=_0xe4e7('0x81');this[_0xe4e7('0x82')]=_0xdc774e[_0xe4e7('0x83')];this[_0xe4e7('0x84')]=_0xca5331;this[_0xe4e7('0x4a')]=_0xe4e7('0x85');this[_0xe4e7('0x86')]=_0xe4e7('0x87');this['FaxAccountId']=_0xdc774e['id'];this[_0xe4e7('0x88')]=_0x1d1801;this[_0xe4e7('0x89')]=_0x5cc34b;}function createExtensionsReciveFax(_0x12ba22){var _0x51b11a=0x1;var _0x7069d1=[];_0x7069d1['push'](new Extension(_0x12ba22,_0x51b11a,'','Answer'));_0x51b11a+=0x1;_0x7069d1[_0xe4e7('0x8a')](new Extension(_0x12ba22,_0x51b11a,_0xe4e7('0x8b'),_0xe4e7('0x8c')));_0x51b11a+=0x1;for(var _0x1b2423 in _0x12ba22){if(_0x12ba22['hasOwnProperty'](_0x1b2423)&&(_0x1b2423===_0xe4e7('0x8d')||_0x1b2423===_0xe4e7('0x83')||_0x1b2423==='gateway'||_0x1b2423==='faxdetect'||_0x1b2423===_0xe4e7('0x8e')||_0x1b2423==='maxrate'||_0x1b2423===_0xe4e7('0x8f')||_0x1b2423===_0xe4e7('0x90')||_0x1b2423===_0xe4e7('0x91'))){_0x7069d1['push'](new Extension(_0x12ba22,_0x51b11a,'FAXOPT('+_0x1b2423+')='+_0x12ba22[_0x1b2423],_0xe4e7('0x8c')));_0x51b11a+=0x1;}}_0x7069d1['push'](new Extension(_0x12ba22,_0x51b11a,'6','Wait'));_0x51b11a+=0x1;_0x7069d1[_0xe4e7('0x8a')](new Extension(_0x12ba22,_0x51b11a,_0xe4e7('0x92'),'ReceiveFax'));_0x51b11a=0x0;return _0x7069d1;}exports[_0xe4e7('0x93')]=function(_0x1f2163,_0x1e381b,_0x5ccb6b){var _0x9c3aef;return db[_0xe4e7('0x77')]['transaction'](function(_0x41fe86){return db[_0xe4e7('0x4d')][_0xe4e7('0x57')](_0x1f2163[_0xe4e7('0x58')],{'transaction':_0x41fe86})['then'](function(_0x33745d){_0x9c3aef=_0x33745d[_0xe4e7('0x35')]({'plain':!![]});return db[_0xe4e7('0x94')][_0xe4e7('0x95')](createExtensionsReciveFax(_0x9c3aef),{'transaction':_0x41fe86});});})[_0xe4e7('0x1d')](function(){return _0x9c3aef;})[_0xe4e7('0x1d')](respondWithResult(_0x1e381b,null))['catch'](handleError(_0x1e381b,null));};exports[_0xe4e7('0x96')]=function(_0x31acd7,_0x4b4d4d,_0x25d278){var _0x20d2b5;return db[_0xe4e7('0x77')][_0xe4e7('0x78')](function(_0x57d332){return db['FaxAccount'][_0xe4e7('0x33')](_0x31acd7['body'],{'where':{'id':_0x31acd7['body']['id']},'transaction':_0x57d332})[_0xe4e7('0x1d')](function(_0x1dd59d){return db[_0xe4e7('0x94')]['destroy']({'where':{'FaxAccountId':_0x31acd7[_0xe4e7('0x58')]['id']},'transaction':_0x57d332})[_0xe4e7('0x1d')](function(_0x4a85db){return db['VoiceExtension'][_0xe4e7('0x95')](createExtensionsReciveFax(_[_0xe4e7('0x6c')](_0x31acd7[_0xe4e7('0x58')],['tech',_0xe4e7('0x3d'),_0xe4e7('0x97'),_0xe4e7('0x98'),_0xe4e7('0x99'),_0xe4e7('0x9a')])),{'transaction':_0x57d332});});});})[_0xe4e7('0x1d')](function(){return db[_0xe4e7('0x4d')][_0xe4e7('0x9b')](_0x31acd7[_0xe4e7('0x58')]['id']);})[_0xe4e7('0x1d')](respondWithResult(_0x4b4d4d,null))[_0xe4e7('0x27')](handleError(_0x4b4d4d,null));};exports[_0xe4e7('0x9c')]=function(_0x349e2f,_0x4ad25c,_0x370b9f){var _0xb0781c={'raw':!![],'where':{}};var _0x5efbe3={};var _0x56a22d={'count':0x0,'rows':[]};return db[_0xe4e7('0x4d')][_0xe4e7('0x62')]({'where':{'id':_0x349e2f[_0xe4e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ad25c,null))[_0xe4e7('0x1d')](function(_0x1c361a){if(_0x1c361a){_0x5efbe3['model']=_[_0xe4e7('0x40')](db[_0xe4e7('0x9d')][_0xe4e7('0x3c')]);_0x5efbe3['query']=_['keys'](_0x349e2f[_0xe4e7('0x41')]);_0x5efbe3[_0xe4e7('0x42')]=_[_0xe4e7('0x43')](_0x5efbe3[_0xe4e7('0x3e')],_0x5efbe3[_0xe4e7('0x41')]);_0xb0781c['attributes']=_[_0xe4e7('0x43')](_0x5efbe3[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x45')]));_0xb0781c['attributes']=_0xb0781c[_0xe4e7('0x44')]['length']?_0xb0781c[_0xe4e7('0x44')]:_0x5efbe3[_0xe4e7('0x3e')];if(!_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x46')]('nolimit')){_0xb0781c['limit']=qs[_0xe4e7('0x2c')](_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x2c')]);_0xb0781c[_0xe4e7('0x2d')]=qs[_0xe4e7('0x2d')](_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x2d')]);}_0xb0781c[_0xe4e7('0x69')]=qs['sort'](_0x349e2f['query'][_0xe4e7('0x6a')]);_0xb0781c[_0xe4e7('0x48')]=qs[_0xe4e7('0x42')](_[_0xe4e7('0x49')](_0x349e2f[_0xe4e7('0x41')],_0x5efbe3[_0xe4e7('0x42')]));_0xb0781c['where'][_0xe4e7('0x63')]=_0x1c361a['id'];if(_0x349e2f[_0xe4e7('0x41')]['filter']){_0xb0781c[_0xe4e7('0x48')]=_[_0xe4e7('0x64')](_0xb0781c[_0xe4e7('0x48')],{'$or':_[_0xe4e7('0x3f')](_0xb0781c[_0xe4e7('0x44')],function(_0x553b31){var _0x5cada8={};_0x5cada8[_0x553b31]={'$like':'%'+_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x4c')]+'%'};return _0x5cada8;})});}if(_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x9e')]){var _0x3cdcc4=_0x349e2f[_0xe4e7('0x41')]['$gte'][_0xe4e7('0x9f')](',');var _0x22f158={};_0x22f158[_0x3cdcc4[0x0]]={'$gte':moment(_0x3cdcc4[0x1])[_0xe4e7('0xa0')](_0xe4e7('0xa1'))};_0xb0781c[_0xe4e7('0x48')]=_[_0xe4e7('0x64')](_0xb0781c['where'],_0x22f158);}_0xb0781c=_[_0xe4e7('0x64')]({},_0xb0781c,_0x349e2f[_0xe4e7('0x55')]);return db[_0xe4e7('0x9d')]['count']({'where':_0xb0781c['where']})[_0xe4e7('0x1d')](function(_0xcd9d35){_0x56a22d[_0xe4e7('0x4e')]=_0xcd9d35;if(_0x349e2f[_0xe4e7('0x41')][_0xe4e7('0x54')]){_0xb0781c[_0xe4e7('0x4f')]=[{'all':!![]}];}return db[_0xe4e7('0x9d')]['findAll'](_0xb0781c);})[_0xe4e7('0x1d')](function(_0x4c95b4){_0x56a22d[_0xe4e7('0x50')]=_0x4c95b4;return _0x56a22d;});}})[_0xe4e7('0x1d')](respondWithFilteredResult(_0x4ad25c,_0xb0781c))[_0xe4e7('0x27')](handleError(_0x4ad25c,null));};exports[_0xe4e7('0x7f')]=function(_0xf0a4cc,_0x1b47d6,_0x499ad0){var _0x38f87a,_0x7ae68c={},_0x18b30d;if(_0xf0a4cc[_0xe4e7('0x58')]['to']){_0x18b30d=_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0xf0a4cc['params']['id']},'include':[{'model':db[_0xe4e7('0xa2')],'as':_0xe4e7('0xa3'),'include':[{'model':db[_0xe4e7('0xa4')],'as':_0xe4e7('0xa5'),'where':{'fax':_0x18b30d},'limit':0x1,'order':[[_0xe4e7('0x98'),_0xe4e7('0xa6')]]}]}]})[_0xe4e7('0x1d')](handleEntityNotFound(_0x1b47d6,null))['then'](function(_0x82ddd3){_0x38f87a=_0x82ddd3;if(_0xf0a4cc[_0xe4e7('0x58')][_0xe4e7('0xa7')]&&_0xf0a4cc[_0xe4e7('0x58')][_0xe4e7('0xa7')]['length']){for(var _0x2cb3b1=0x0;_0x2cb3b1<_0xf0a4cc['body'][_0xe4e7('0xa7')][_0xe4e7('0x53')];_0x2cb3b1+=0x1){_0xf0a4cc[_0xe4e7('0x58')][_0xe4e7('0xa7')][_0x2cb3b1]={'filename':_0xf0a4cc['body'][_0xe4e7('0xa7')][_0x2cb3b1]['name'],'id':_0xf0a4cc[_0xe4e7('0x58')]['attachments'][_0x2cb3b1]['id'],'path':path[_0xe4e7('0xa8')](config[_0xe4e7('0xa9')],_0xe4e7('0xaa'),_0xf0a4cc['body'][_0xe4e7('0xa7')][_0x2cb3b1][_0xe4e7('0xab')])};}}return respondWithRpcPromise(_0xe4e7('0xac'),_0xe4e7('0xac'),{'FaxAccountId':_['isNil'](_0xf0a4cc[_0xe4e7('0x52')]['id'])?undefined:_0xf0a4cc[_0xe4e7('0x52')]['id'],'path':_[_0xe4e7('0xad')](_0xf0a4cc['body']['attachments'][0x0][_0xe4e7('0x5')])?undefined:_0xf0a4cc['body'][_0xe4e7('0xa7')][0x0]['path'],'fax':_['isNil'](_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0])?undefined:_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0]},client9002);})[_0xe4e7('0x1d')](function(){if(_0x38f87a){if(_[_0xe4e7('0xad')](_0xf0a4cc[_0xe4e7('0x58')][_0xe4e7('0xae')])){_0xf0a4cc[_0xe4e7('0x58')]['from']=util[_0xe4e7('0xa0')](_0xe4e7('0xaf'),_0x38f87a['name'],_0x38f87a['fax']);}if(_0x38f87a[_0xe4e7('0xa3')]){if(_0x38f87a[_0xe4e7('0xa3')][_0xe4e7('0xa5')][_0xe4e7('0x53')]){return _0x38f87a['List']['Contacts'][0x0];}else{return db['CmContact'][_0xe4e7('0x57')](_['defaults'](_0xf0a4cc[_0xe4e7('0x58')],{'firstName':_0xf0a4cc['body']['to'][0x0],'phone':_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0],'fax':_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0],'ListId':_0x38f87a[_0xe4e7('0x9a')]}));}}else{throw new Error(_0xe4e7('0xb0'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x15a192){if(_0x15a192){return db[_0xe4e7('0x6e')]['find']({'where':{'ContactId':_0x15a192['id'],'closed':![],'FaxAccountId':_0x38f87a['id']}})['then'](function(_0x3105e6){if(_0x3105e6){return[_0x3105e6,![]];}return db[_0xe4e7('0x6e')]['create']({'UserId':_0xf0a4cc[_0xe4e7('0x59')]['id'],'ContactId':_0x15a192['id'],'FaxAccountId':_0x38f87a['id'],'fax':_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0],'firstMsgDirection':_0xe4e7('0xb1'),'Messages':[_[_0xe4e7('0x64')](_0xf0a4cc['body'],{'read':![],'body':_0xf0a4cc[_0xe4e7('0x58')][_0xe4e7('0xa7')][0x0]['filename'],'FaxAccountId':_0x38f87a['id'],'UserId':_0xf0a4cc[_0xe4e7('0x59')]['id'],'ContactId':_0x15a192['id'],'AttachmentId':_0xf0a4cc['body'][_0xe4e7('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xe4e7('0x9d')],'as':_0xe4e7('0xb2')}]})[_0xe4e7('0x1d')](function(_0x2b4249){return[_0x2b4249,!![]];});});}else{throw new Error(_0xe4e7('0xb3'));}})[_0xe4e7('0xb4')](function(_0x3ab251,_0x162feb){if(_0x162feb){return _0x3ab251;}return db[_0xe4e7('0x9d')]['create']({'direction':_0xe4e7('0xb1'),'read':![],'body':_0xf0a4cc['body'][_0xe4e7('0xa7')][0x0]['filename'],'FaxAccountId':_0x38f87a['id'],'FaxInteractionId':_0x3ab251['id'],'UserId':_0xf0a4cc['user']['id'],'ContactId':_0x3ab251[_0xe4e7('0xb5')],'AttachmentId':_0xf0a4cc[_0xe4e7('0x58')][_0xe4e7('0xa7')][0x0]['id']})['then'](function(_0x32dd85){_0x3ab251[_0xe4e7('0xb6')][_0xe4e7('0xb2')]=[];_0x3ab251['dataValues']['Messages'][_0xe4e7('0x8a')](_0x32dd85[_0xe4e7('0xb6')]);return _0x3ab251;});})[_0xe4e7('0x1d')](function(_0x1feeb3){respondWithRpcPromise(_0xe4e7('0xb7'),'SendFax',{'FaxAccountId':_['isNil'](_0xf0a4cc[_0xe4e7('0x52')]['id'])?undefined:_0xf0a4cc[_0xe4e7('0x52')]['id'],'path':_['isNil'](_0xf0a4cc['body'][_0xe4e7('0xa7')][0x0]['path'])?undefined:_0xf0a4cc['body']['attachments'][0x0][_0xe4e7('0x5')],'fax':_[_0xe4e7('0xad')](_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0])?undefined:_0xf0a4cc[_0xe4e7('0x58')]['to'][0x0],'AttachmentId':_0xf0a4cc[_0xe4e7('0x58')]['attachments'][0x0]['id']},client9002)[_0xe4e7('0x1d')](function(_0x1dcde4){logger['info'](_0xe4e7('0xb8'),_0x1dcde4);})[_0xe4e7('0x27')](function(_0x5e9fc7){logger[_0xe4e7('0x25')](_0xe4e7('0xb8'),_0x5e9fc7);});return _0x1feeb3;})[_0xe4e7('0x1d')](respondWithResult(_0x1b47d6,null))[_0xe4e7('0x27')](handleError(_0x1b47d6,null));};exports[_0xe4e7('0xb9')]=function(_0xe2cf08,_0x40bef6,_0x1792ae){return db[_0xe4e7('0x4d')][_0xe4e7('0x56')]({'where':{'id':_0xe2cf08[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x40bef6,null))[_0xe4e7('0x1d')](function(_0xf5231b){if(_0xf5231b){return _0xf5231b['addAgents'](_0xe2cf08['body'][_0xe4e7('0x67')],_[_0xe4e7('0x6c')](_0xe2cf08[_0xe4e7('0x58')],[_0xe4e7('0x67'),'id'])||{})[_0xe4e7('0xb4')](function(_0x22679c){for(var _0x139276=0x0;_0x139276<_0xe2cf08[_0xe4e7('0x58')]['ids'][_0xe4e7('0x53')];_0x139276+=0x1){socket[_0xe4e7('0xba')](_0xe4e7('0xbb'),{'UserId':Number(_0xe2cf08[_0xe4e7('0x58')][_0xe4e7('0x67')][_0x139276]),'FaxAccountId':Number(_0xe2cf08[_0xe4e7('0x52')]['id'])});}return _0x22679c;});}})[_0xe4e7('0x1d')](respondWithResult(_0x40bef6,null))['catch'](handleError(_0x40bef6,null));};exports[_0xe4e7('0xbc')]=function(_0x4ec1cf,_0x493dbd,_0x49af69){return db['FaxAccount'][_0xe4e7('0x56')]({'where':{'id':_0x4ec1cf[_0xe4e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x493dbd,null))['then'](function(_0x8aed22){if(_0x8aed22){return _0x8aed22[_0xe4e7('0xbc')](_0x4ec1cf[_0xe4e7('0x41')]['ids'])[_0xe4e7('0x1d')](function(){if(_['isArray'](_0x4ec1cf[_0xe4e7('0x41')][_0xe4e7('0x67')])){for(var _0x59250a=0x0;_0x59250a<_0x4ec1cf['query'][_0xe4e7('0x67')]['length'];_0x59250a+=0x1){socket[_0xe4e7('0xba')](_0xe4e7('0xbd'),{'UserId':Number(_0x4ec1cf[_0xe4e7('0x41')]['ids'][_0x59250a]),'FaxAccountId':Number(_0x4ec1cf[_0xe4e7('0x52')]['id'])});}}else{socket[_0xe4e7('0xba')](_0xe4e7('0xbd'),{'UserId':Number(_0x4ec1cf[_0xe4e7('0x41')][_0xe4e7('0x67')]),'FaxAccountId':Number(_0x4ec1cf['params']['id'])});}});}})[_0xe4e7('0x1d')](respondWithStatusCode(_0x493dbd,null))[_0xe4e7('0x27')](handleError(_0x493dbd,null));};exports[_0xe4e7('0xbe')]=function(_0x33214d,_0x42afaf,_0x18b5ef){var _0x55a618={};var _0x2cc1ce={};var _0x3fdc8a;var _0x3dc84a;return db[_0xe4e7('0x4d')][_0xe4e7('0x62')]({'where':{'id':_0x33214d[_0xe4e7('0x52')]['id']}})[_0xe4e7('0x1d')](handleEntityNotFound(_0x42afaf,null))[_0xe4e7('0x1d')](function(_0x4ca304){if(_0x4ca304){_0x3fdc8a=_0x4ca304;_0x2cc1ce['model']=_[_0xe4e7('0x40')](db['User'][_0xe4e7('0x3c')]);_0x2cc1ce[_0xe4e7('0x41')]=_[_0xe4e7('0x40')](_0x33214d[_0xe4e7('0x41')]);_0x2cc1ce['filters']=_['intersection'](_0x2cc1ce['model'],_0x2cc1ce['query']);_0x55a618['attributes']=_[_0xe4e7('0x43')](_0x2cc1ce[_0xe4e7('0x3e')],qs[_0xe4e7('0x45')](_0x33214d[_0xe4e7('0x41')][_0xe4e7('0x45')]));_0x55a618[_0xe4e7('0x44')]=_0x55a618['attributes'][_0xe4e7('0x53')]?_0x55a618['attributes']:_0x2cc1ce['model'];_0x55a618[_0xe4e7('0x69')]=qs['sort'](_0x33214d[_0xe4e7('0x41')][_0xe4e7('0x6a')]);_0x55a618[_0xe4e7('0x48')]=qs[_0xe4e7('0x42')](_[_0xe4e7('0x49')](_0x33214d[_0xe4e7('0x41')],_0x2cc1ce['filters']));if(_0x33214d['query']['filter']){_0x55a618['where']=_['merge'](_0x55a618[_0xe4e7('0x48')],{'$or':_[_0xe4e7('0x3f')](_0x55a618[_0xe4e7('0x44')],function(_0xe8a704){var _0x3ea701={};_0x3ea701[_0xe8a704]={'$like':'%'+_0x33214d[_0xe4e7('0x41')][_0xe4e7('0x4c')]+'%'};return _0x3ea701;})});}_0x55a618=_[_0xe4e7('0x64')]({},_0x55a618,_0x33214d[_0xe4e7('0x55')]);return _0x3fdc8a[_0xe4e7('0xbe')](_0x55a618);}})[_0xe4e7('0x1d')](function(_0x49fb12){if(_0x49fb12){_0x3dc84a=_0x49fb12[_0xe4e7('0x53')];if(!_0x33214d[_0xe4e7('0x41')][_0xe4e7('0x46')](_0xe4e7('0x47'))){_0x55a618[_0xe4e7('0x2c')]=qs[_0xe4e7('0x2c')](_0x33214d[_0xe4e7('0x41')][_0xe4e7('0x2c')]);_0x55a618[_0xe4e7('0x2d')]=qs[_0xe4e7('0x2d')](_0x33214d[_0xe4e7('0x41')][_0xe4e7('0x2d')]);}return _0x3fdc8a[_0xe4e7('0xbe')](_0x55a618);}})[_0xe4e7('0x1d')](function(_0x3aab3){if(_0x3aab3){return _0x3aab3?{'count':_0x3dc84a,'rows':_0x3aab3}:null;}})[_0xe4e7('0x1d')](respondWithResult(_0x42afaf,null))['catch'](handleError(_0x42afaf,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 521a658..afcd5f6 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 _0xd23f=['emit','hook','exports','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x757aee,_0x38eb09){var _0xb5512c=function(_0x4a89ed){while(--_0x4a89ed){_0x757aee['push'](_0x757aee['shift']());}};_0xb5512c(++_0x38eb09);}(_0xd23f,0x83));var _0xfd23=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd23f[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xfd23('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfd23('0x1')](0x0);var events={'afterCreate':_0xfd23('0x2'),'afterUpdate':_0xfd23('0x3'),'afterDestroy':_0xfd23('0x4')};function emitEvent(_0x5f3866){return function(_0x473aaa,_0x392b5a,_0x2f832d){FaxAccountEvents['emit'](_0x5f3866+':'+_0x473aaa['id'],_0x473aaa);FaxAccountEvents[_0xfd23('0x5')](_0x5f3866,_0x473aaa);_0x2f832d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xfd23('0x6')](e,emitEvent(event));}}module[_0xfd23('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x7d60=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x56ce52,_0x16c546){var _0x467970=function(_0x3ed7b8){while(--_0x3ed7b8){_0x56ce52['push'](_0x56ce52['shift']());}};_0x467970(++_0x16c546);}(_0x7d60,0xd0));var _0x07d6=function(_0x12aac1,_0x1b7ccc){_0x12aac1=_0x12aac1-0x0;var _0x9eb31d=_0x7d60[_0x12aac1];return _0x9eb31d;};'use strict';var EventEmitter=require(_0x07d6('0x0'));var FaxAccount=require(_0x07d6('0x1'))['db'][_0x07d6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x07d6('0x3')](0x0);var events={'afterCreate':_0x07d6('0x4'),'afterUpdate':_0x07d6('0x5'),'afterDestroy':_0x07d6('0x6')};function emitEvent(_0x35c6f7){return function(_0x357c6f,_0x48c711,_0x4bf156){FaxAccountEvents[_0x07d6('0x7')](_0x35c6f7+':'+_0x357c6f['id'],_0x357c6f);FaxAccountEvents['emit'](_0x35c6f7,_0x357c6f);_0x4bf156(null);};}for(var e in events){if(events[_0x07d6('0x8')](e)){var event=events[e];FaxAccount[_0x07d6('0x9')](e,emitEvent(event));}}module[_0x07d6('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index cdf0253..4ba3937 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 _0x8b7c=['rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x454997,_0x10dc14){var _0x1f47d5=function(_0x34b7b5){while(--_0x34b7b5){_0x454997['push'](_0x454997['shift']());}};_0x1f47d5(++_0x10dc14);}(_0x8b7c,0x17f));var _0xc8b7=function(_0x3b677a,_0x274ecc){_0x3b677a=_0x3b677a-0x0;var _0x2e2eb6=_0x8b7c[_0x3b677a];return _0x2e2eb6;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8b7('0x7'));var config=require('../../config/environment');var attributes=require(_0xc8b7('0x8'));module[_0xc8b7('0x9')]=function(_0xbfa28c,_0x33095f){return _0xbfa28c[_0xc8b7('0xa')](_0xc8b7('0xb'),attributes,{'tableName':_0xc8b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79c0=['api','moment','bluebird','request-promise','path','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x79c0,0x76));var _0x079c=function(_0x24bdba,_0x3113bd){_0x24bdba=_0x24bdba-0x0;var _0x40a370=_0x79c0[_0x24bdba];return _0x40a370;};'use strict';var _=require(_0x079c('0x0'));var util=require(_0x079c('0x1'));var logger=require('../../config/logger')(_0x079c('0x2'));var moment=require(_0x079c('0x3'));var BPromise=require(_0x079c('0x4'));var rp=require(_0x079c('0x5'));var fs=require('fs');var path=require(_0x079c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x079c('0x7'));module[_0x079c('0x8')]=function(_0x1a7e62,_0x33bb63){return _0x1a7e62[_0x079c('0x9')](_0x079c('0xa'),attributes,{'tableName':_0x079c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 89024b6..7b2c398 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 _0x1419=['FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','created','FaxMessage','ContactId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1419,0x9f));var _0x9141=function(_0x4564f6,_0x4135c6){_0x4564f6=_0x4564f6-0x0;var _0x323e00=_0x1419[_0x4564f6];return _0x323e00;};'use strict';var _=require(_0x9141('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9141('0x1'));var fs=require('fs');var Redis=require(_0x9141('0x2'));var db=require(_0x9141('0x3'))['db'];var utils=require(_0x9141('0x4'));var logger=require(_0x9141('0x5'))(_0x9141('0x6'));var config=require(_0x9141('0x7'));var jayson=require(_0x9141('0x8'));var client=jayson[_0x9141('0x9')]['http']({'port':0x232c});config[_0x9141('0xa')]=_[_0x9141('0xb')](config[_0x9141('0xa')],{'host':_0x9141('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9141('0xa')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4100d7,_0x5624d7,_0x1c1fe4){return new BPromise(function(_0x5e700f,_0x229108){return client[_0x9141('0xd')](_0x4100d7,_0x1c1fe4)['then'](function(_0x2fcd43){logger[_0x9141('0xe')](_0x9141('0xf'),_0x5624d7,'request\x20sent');logger[_0x9141('0x10')](_0x9141('0x11'),_0x5624d7,_0x9141('0x12'),JSON['stringify'](_0x2fcd43));if(_0x2fcd43['error']){if(_0x2fcd43[_0x9141('0x13')]['code']===0x1f4){logger['error'](_0x9141('0xf'),_0x5624d7,_0x2fcd43[_0x9141('0x13')][_0x9141('0x14')]);return _0x229108(_0x2fcd43[_0x9141('0x13')][_0x9141('0x14')]);}logger[_0x9141('0x13')](_0x9141('0xf'),_0x5624d7,_0x2fcd43[_0x9141('0x13')][_0x9141('0x14')]);return _0x5e700f(_0x2fcd43[_0x9141('0x13')][_0x9141('0x14')]);}else{logger[_0x9141('0xe')](_0x9141('0xf'),_0x5624d7,'request\x20sent');_0x5e700f(_0x2fcd43[_0x9141('0x15')][_0x9141('0x14')]);}})[_0x9141('0x16')](function(_0x4b29fe){logger[_0x9141('0x13')]('FaxAccount,\x20%s,\x20%s',_0x5624d7,_0x4b29fe);_0x229108(_0x4b29fe);});});}exports[_0x9141('0x17')]=function(_0x429de6){var _0x29e191=this;return new Promise(function(_0xdbd231,_0x55fd04){return db[_0x9141('0x18')][_0x9141('0x19')]({'raw':_0x429de6[_0x9141('0x1a')]?_0x429de6[_0x9141('0x1a')][_0x9141('0x1b')]===undefined?!![]:![]:!![],'where':_0x429de6[_0x9141('0x1a')]?_0x429de6['options'][_0x9141('0x1c')]||null:null,'attributes':_0x429de6[_0x9141('0x1a')]?_0x429de6[_0x9141('0x1a')][_0x9141('0x1d')]||null:null,'limit':_0x429de6['options']?_0x429de6['options'][_0x9141('0x1e')]||null:null,'include':_0x429de6[_0x9141('0x1a')]?_0x429de6[_0x9141('0x1a')]['include']?_[_0x9141('0x1f')](_0x429de6['options'][_0x9141('0x20')],function(_0x5a13f5){return{'model':db[_0x5a13f5['model']],'as':_0x5a13f5['as'],'attributes':_0x5a13f5[_0x9141('0x1d')],'include':_0x5a13f5[_0x9141('0x20')]?_[_0x9141('0x1f')](_0x5a13f5[_0x9141('0x20')],function(_0x1d1d10){return{'model':db[_0x1d1d10[_0x9141('0x21')]],'as':_0x1d1d10['as'],'attributes':_0x1d1d10[_0x9141('0x1d')],'include':_0x1d1d10[_0x9141('0x20')]?_[_0x9141('0x1f')](_0x1d1d10['include'],function(_0x55d4aa){return{'model':db[_0x55d4aa[_0x9141('0x21')]],'as':_0x55d4aa['as'],'attributes':_0x55d4aa[_0x9141('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9141('0x22')](function(_0x33fd79){logger[_0x9141('0xe')](_0x9141('0x17'),_0x429de6);logger[_0x9141('0x10')](_0x9141('0x17'),_0x429de6,JSON[_0x9141('0x23')](_0x33fd79));_0xdbd231(_0x33fd79);})[_0x9141('0x16')](function(_0x30a917){logger['error']('GetFaxAccount',_0x30a917[_0x9141('0x14')],_0x429de6);_0x55fd04(_0x29e191[_0x9141('0x13')](0x1f4,_0x30a917[_0x9141('0x14')]));});});};exports[_0x9141('0x24')]=function(_0x205065,_0x34743f,_0x59dd6c){var _0x6d9cf5=this;return new Promise(function(_0x421ff9,_0x3037f9){var _0x5e3f83={'body':_0x205065[_0x9141('0x25')],'channel':_0x9141('0x26')};var _0x4984eb=[];var _0x50f73f=[];var _0x2cc563={};return db[_0x9141('0x27')]['describe']()[_0x9141('0x22')](function(_0x5ba81f){if(!_0x5ba81f){throw new db['Sequelize'][(_0x9141('0x28'))](_0x9141('0x29'));}_0x4984eb=_[_0x9141('0x2a')](_[_0x9141('0x2b')](_0x5ba81f),[_0x9141('0x2c'),_0x9141('0x2d')]);_0x50f73f=_[_0x9141('0x2a')](_[_0x9141('0x2b')](_0x5ba81f),[_0x9141('0x2c'),_0x9141('0x2d'),_0x9141('0x2e'),_0x9141('0x2f')]);if(_0x205065[_0x9141('0x25')]['id']){delete _0x205065[_0x9141('0x25')]['id'];}if(_['isNil'](_0x205065[_0x9141('0x25')][_0x9141('0x30')])){throw new db[(_0x9141('0x31'))][(_0x9141('0x28'))](_0x9141('0x32'));}if(_[_0x9141('0x33')](_0x205065['body']['body'])||_0x205065['body']['body']===''){throw new db[(_0x9141('0x31'))][(_0x9141('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x205065[_0x9141('0x25')][_0x9141('0x34')])){throw new db['Sequelize'][(_0x9141('0x28'))](_0x9141('0x35')+_0x50f73f);}if(!_[_0x9141('0x36')](_0x50f73f,_0x205065[_0x9141('0x25')][_0x9141('0x34')])){throw new db[(_0x9141('0x31'))][(_0x9141('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x50f73f);}_0x2cc563[_0x205065[_0x9141('0x25')][_0x9141('0x34')]]=_0x205065[_0x9141('0x25')][_0x9141('0x30')];})['then'](function(){return db[_0x9141('0x18')][_0x9141('0x37')]({'where':{'id':_0x205065[_0x9141('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x9141('0x39'),'include':[{'model':db[_0x9141('0x27')],'as':_0x9141('0x3a'),'where':_0x2cc563,'limit':0x1,'order':[[_0x9141('0x2d'),_0x9141('0x3b')]]}]},{'model':db[_0x9141('0x3c')],'as':_0x9141('0x3d')}]});})[_0x9141('0x22')](function(_0x29a97c){if(_0x29a97c&&_0x29a97c[_0x9141('0x39')]){var _0x1043ee=_0x29a97c['get']({'plain':!![]});_0x5e3f83['account']=_0x1043ee;_0x5e3f83[_0x9141('0x3e')]=_0x1043ee['Applications'];_0x5e3f83[_0x9141('0x3f')]=_0x1043ee[_0x9141('0x39')];_0x5e3f83[_0x9141('0x3e')]=_[_0x9141('0x40')](_0x5e3f83[_0x9141('0x3e')],['priority'],['asc']);if(_0x5e3f83[_0x9141('0x38')][_0x9141('0x3d')]){delete _0x5e3f83[_0x9141('0x38')]['Applications'];}if(_0x5e3f83[_0x9141('0x38')][_0x9141('0x39')]&&_0x5e3f83[_0x9141('0x38')][_0x9141('0x39')][_0x9141('0x3a')][_0x9141('0x41')]){return _0x5e3f83[_0x9141('0x38')][_0x9141('0x39')][_0x9141('0x3a')][0x0];}var _0x3725ff=_[_0x9141('0xb')](_0x205065[_0x9141('0x25')],{'firstName':_0x205065[_0x9141('0x25')]['from'],'ListId':_0x1043ee[_0x9141('0x2f')]});_0x3725ff[_0x205065[_0x9141('0x25')]['mapKey']]=_0x205065[_0x9141('0x25')]['from'];return db[_0x9141('0x27')][_0x9141('0x42')](_0x3725ff,{'fields':_0x4984eb,'raw':!![]});}})[_0x9141('0x22')](function(_0x5c5e54){_0x5e3f83[_0x9141('0x43')]=_0x5c5e54;if(_0x5c5e54){var _0xbdfee6={'ContactId':_0x5c5e54['id'],'FaxAccountId':_0x205065[_0x9141('0x38')]['id'],'fax':_0x5c5e54[_0x9141('0x26')]};return db[_0x9141('0x44')][_0x9141('0x37')]({'where':{'ContactId':_0x5c5e54['id'],'closed':![],'FaxAccountId':_0x205065[_0x9141('0x38')]['id']}})[_0x9141('0x22')](function(_0x5c4e76){if(_0x5c4e76){return[_0x5c4e76,![]];}return db[_0x9141('0x44')][_0x9141('0x42')](_0xbdfee6)[_0x9141('0x22')](function(_0x4053fa){return[_0x4053fa,!![]];});});}else{throw new Error(_0x9141('0x45'));}})[_0x9141('0x46')](function(_0x59a799,_0x44177e){var _0x4d587e=_0x59a799['get']({'plain':!![]});if(_0x44177e){if(_0x5e3f83[_0x9141('0x38')][_0x9141('0x47')]){_0x5e3f83[_0x9141('0x3e')]['push']({'id':0x0,'priority':_0x5e3f83[_0x9141('0x3e')]['length']+0x1,'app':_0x9141('0x48'),'appdata':_0x9141('0x49'),'interval':'*,*,*,*'});}_0x4d587e[_0x9141('0x4a')]=!![];}else{_0x4d587e[_0x9141('0x4a')]=![];}_0x5e3f83['interaction']=_0x4d587e;return db[_0x9141('0x4b')][_0x9141('0x42')]({'body':_0x205065[_0x9141('0x25')][_0x9141('0x25')],'FaxAccountId':_0x205065[_0x9141('0x38')]['id'],'FaxInteractionId':_0x59a799['id'],'direction':'in','ContactId':_0x59a799[_0x9141('0x4c')],'AttachmentId':_0x205065['body']['AttachmentId']});})['then'](function(_0x422cf1){_0x5e3f83[_0x9141('0x14')]=_0x422cf1;if(_0x5e3f83[_0x9141('0x4d')][_0x9141('0x4e')]){return db[_0x9141('0x4f')][_0x9141('0x37')]({'attributes':['id','name'],'where':{'id':_0x5e3f83[_0x9141('0x4d')][_0x9141('0x4e')]}})[_0x9141('0x22')](function(_0x2a18bb){if(_0x2a18bb){_0x5e3f83[_0x9141('0x3e')][_0x9141('0x50')]({'id':0x0,'priority':0x0,'app':_0x9141('0x51'),'appdata':_0x2a18bb[_0x9141('0x52')]+','+(_0x5e3f83[_0x9141('0x38')][_0x9141('0x53')]||0xa),'interval':_0x9141('0x54')});}return respondWithRpcPromise(_0x9141('0x55'),_0x9141('0x56'),_0x5e3f83);});}return respondWithRpcPromise(_0x9141('0x55'),_0x9141('0x56'),_0x5e3f83);})['then'](function(_0x324f28){_0x421ff9(_0x324f28);})[_0x9141('0x16')](function(_0xa8f240){_0x3037f9(_0x6d9cf5[_0x9141('0x13')](0x1f4,_0xa8f240[_0x9141('0x14')]));});});}; \ No newline at end of file +var _0x0904=['ListId','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','get','applications','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','FaxAccount','options','raw','where','attributes','map','include','model','GetFaxAccount','NotifyFaxAccount','body','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0904,0x1d3));var _0x4090=function(_0x208f80,_0x2522c6){_0x208f80=_0x208f80-0x0;var _0x71c40c=_0x0904[_0x208f80];return _0x71c40c;};'use strict';var _=require(_0x4090('0x0'));var util=require(_0x4090('0x1'));var moment=require('moment');var BPromise=require(_0x4090('0x2'));var rs=require(_0x4090('0x3'));var fs=require('fs');var Redis=require(_0x4090('0x4'));var db=require(_0x4090('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4090('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4090('0x7'));var client=jayson['client'][_0x4090('0x8')]({'port':0x232c});config[_0x4090('0x9')]=_[_0x4090('0xa')](config[_0x4090('0x9')],{'host':_0x4090('0xb'),'port':0x18eb});var socket=require(_0x4090('0xc'))(new Redis(config[_0x4090('0x9')]));require('./faxAccount.socket')[_0x4090('0xd')](socket);function respondWithRpcPromise(_0x1cfbff,_0x4a90be,_0x131ce5){return new BPromise(function(_0x3496a1,_0xe957a8){return client[_0x4090('0xe')](_0x1cfbff,_0x131ce5)[_0x4090('0xf')](function(_0x3b432d){logger['info'](_0x4090('0x10'),_0x4a90be,'request\x20sent');logger[_0x4090('0x11')](_0x4090('0x12'),_0x4a90be,'request\x20sent',JSON[_0x4090('0x13')](_0x3b432d));if(_0x3b432d[_0x4090('0x14')]){if(_0x3b432d[_0x4090('0x14')][_0x4090('0x15')]===0x1f4){logger[_0x4090('0x14')](_0x4090('0x10'),_0x4a90be,_0x3b432d['error'][_0x4090('0x16')]);return _0xe957a8(_0x3b432d['error'][_0x4090('0x16')]);}logger['error'](_0x4090('0x10'),_0x4a90be,_0x3b432d[_0x4090('0x14')][_0x4090('0x16')]);return _0x3496a1(_0x3b432d[_0x4090('0x14')][_0x4090('0x16')]);}else{logger[_0x4090('0x17')](_0x4090('0x10'),_0x4a90be,_0x4090('0x18'));_0x3496a1(_0x3b432d['result']['message']);}})[_0x4090('0x19')](function(_0x4600a8){logger['error'](_0x4090('0x10'),_0x4a90be,_0x4600a8);_0xe957a8(_0x4600a8);});});}exports['GetFaxAccount']=function(_0xd3d09a){var _0x195288=this;return new Promise(function(_0x1bb24c,_0x554546){return db[_0x4090('0x1a')]['findAll']({'raw':_0xd3d09a[_0x4090('0x1b')]?_0xd3d09a[_0x4090('0x1b')][_0x4090('0x1c')]===undefined?!![]:![]:!![],'where':_0xd3d09a[_0x4090('0x1b')]?_0xd3d09a[_0x4090('0x1b')][_0x4090('0x1d')]||null:null,'attributes':_0xd3d09a[_0x4090('0x1b')]?_0xd3d09a[_0x4090('0x1b')][_0x4090('0x1e')]||null:null,'limit':_0xd3d09a[_0x4090('0x1b')]?_0xd3d09a[_0x4090('0x1b')]['limit']||null:null,'include':_0xd3d09a[_0x4090('0x1b')]?_0xd3d09a[_0x4090('0x1b')]['include']?_[_0x4090('0x1f')](_0xd3d09a[_0x4090('0x1b')][_0x4090('0x20')],function(_0x32bace){return{'model':db[_0x32bace['model']],'as':_0x32bace['as'],'attributes':_0x32bace[_0x4090('0x1e')],'include':_0x32bace['include']?_[_0x4090('0x1f')](_0x32bace[_0x4090('0x20')],function(_0x496245){return{'model':db[_0x496245[_0x4090('0x21')]],'as':_0x496245['as'],'attributes':_0x496245['attributes'],'include':_0x496245['include']?_['map'](_0x496245[_0x4090('0x20')],function(_0x4aef79){return{'model':db[_0x4aef79[_0x4090('0x21')]],'as':_0x4aef79['as'],'attributes':_0x4aef79[_0x4090('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4090('0xf')](function(_0x4515d3){logger[_0x4090('0x17')]('GetFaxAccount',_0xd3d09a);logger[_0x4090('0x11')](_0x4090('0x22'),_0xd3d09a,JSON[_0x4090('0x13')](_0x4515d3));_0x1bb24c(_0x4515d3);})[_0x4090('0x19')](function(_0x29034b){logger[_0x4090('0x14')]('GetFaxAccount',_0x29034b[_0x4090('0x16')],_0xd3d09a);_0x554546(_0x195288[_0x4090('0x14')](0x1f4,_0x29034b[_0x4090('0x16')]));});});};exports[_0x4090('0x23')]=function(_0x3dee07,_0x29ed9a,_0x3b279e){var _0x41e000=this;return new Promise(function(_0x4d046d,_0x69d5c9){var _0x5c5428={'body':_0x3dee07[_0x4090('0x24')],'channel':'fax'};var _0x426365=[];var _0x303ca8=[];var _0x4fcb90={};return db['CmContact']['describe']()['then'](function(_0x2963a5){if(!_0x2963a5){throw new db['Sequelize'][(_0x4090('0x25'))](_0x4090('0x26'));}_0x426365=_['difference'](_[_0x4090('0x27')](_0x2963a5),[_0x4090('0x28'),_0x4090('0x29')]);_0x303ca8=_['difference'](_['keys'](_0x2963a5),[_0x4090('0x28'),'updatedAt',_0x4090('0x2a'),_0x4090('0x2b')]);if(_0x3dee07[_0x4090('0x24')]['id']){delete _0x3dee07[_0x4090('0x24')]['id'];}if(_[_0x4090('0x2c')](_0x3dee07[_0x4090('0x24')]['from'])){throw new db['Sequelize'][(_0x4090('0x25'))](_0x4090('0x2d'));}if(_['isNil'](_0x3dee07[_0x4090('0x24')][_0x4090('0x24')])||_0x3dee07['body'][_0x4090('0x24')]===''){throw new db[(_0x4090('0x2e'))]['ValidationError'](_0x4090('0x2f'));}if(_[_0x4090('0x2c')](_0x3dee07[_0x4090('0x24')][_0x4090('0x30')])){throw new db[(_0x4090('0x2e'))][(_0x4090('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x303ca8);}if(!_['includes'](_0x303ca8,_0x3dee07[_0x4090('0x24')][_0x4090('0x30')])){throw new db[(_0x4090('0x2e'))][(_0x4090('0x25'))](_0x4090('0x31')+_0x303ca8);}_0x4fcb90[_0x3dee07['body'][_0x4090('0x30')]]=_0x3dee07[_0x4090('0x24')][_0x4090('0x32')];})[_0x4090('0xf')](function(){return db[_0x4090('0x1a')][_0x4090('0x33')]({'where':{'id':_0x3dee07[_0x4090('0x34')]['id']},'include':[{'model':db[_0x4090('0x35')],'as':_0x4090('0x36'),'include':[{'model':db[_0x4090('0x37')],'as':_0x4090('0x38'),'where':_0x4fcb90,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x4090('0x39')],'as':_0x4090('0x3a')}]});})[_0x4090('0xf')](function(_0xcf96e8){if(_0xcf96e8&&_0xcf96e8[_0x4090('0x36')]){var _0x4c0acb=_0xcf96e8[_0x4090('0x3b')]({'plain':!![]});_0x5c5428['account']=_0x4c0acb;_0x5c5428[_0x4090('0x3c')]=_0x4c0acb[_0x4090('0x3a')];_0x5c5428['list']=_0x4c0acb[_0x4090('0x36')];_0x5c5428[_0x4090('0x3c')]=_['orderBy'](_0x5c5428['applications'],[_0x4090('0x3d')],[_0x4090('0x3e')]);if(_0x5c5428[_0x4090('0x34')][_0x4090('0x3a')]){delete _0x5c5428[_0x4090('0x34')][_0x4090('0x3a')];}if(_0x5c5428[_0x4090('0x34')]['List']&&_0x5c5428[_0x4090('0x34')][_0x4090('0x36')][_0x4090('0x38')][_0x4090('0x3f')]){return _0x5c5428[_0x4090('0x34')][_0x4090('0x36')]['Contacts'][0x0];}var _0x4e0d46=_[_0x4090('0xa')](_0x3dee07[_0x4090('0x24')],{'firstName':_0x3dee07[_0x4090('0x24')][_0x4090('0x32')],'ListId':_0x4c0acb[_0x4090('0x2b')]});_0x4e0d46[_0x3dee07[_0x4090('0x24')][_0x4090('0x30')]]=_0x3dee07[_0x4090('0x24')][_0x4090('0x32')];return db['CmContact'][_0x4090('0x40')](_0x4e0d46,{'fields':_0x426365,'raw':!![]});}})[_0x4090('0xf')](function(_0x24f8fa){_0x5c5428[_0x4090('0x41')]=_0x24f8fa;if(_0x24f8fa){var _0x316db3={'ContactId':_0x24f8fa['id'],'FaxAccountId':_0x3dee07[_0x4090('0x34')]['id'],'fax':_0x24f8fa[_0x4090('0x42')]};return db[_0x4090('0x43')]['find']({'where':{'ContactId':_0x24f8fa['id'],'closed':![],'FaxAccountId':_0x3dee07[_0x4090('0x34')]['id']}})[_0x4090('0xf')](function(_0x188364){if(_0x188364){return[_0x188364,![]];}return db[_0x4090('0x43')][_0x4090('0x40')](_0x316db3)[_0x4090('0xf')](function(_0x179ffe){return[_0x179ffe,!![]];});});}else{throw new Error(_0x4090('0x44'));}})['spread'](function(_0x2c1cdb,_0x1b6b90){var _0x28bf68=_0x2c1cdb[_0x4090('0x3b')]({'plain':!![]});if(_0x1b6b90){if(_0x5c5428[_0x4090('0x34')][_0x4090('0x45')]){_0x5c5428['applications'][_0x4090('0x46')]({'id':0x0,'priority':_0x5c5428['applications']['length']+0x1,'app':_0x4090('0x47'),'appdata':_0x4090('0x48'),'interval':'*,*,*,*'});}_0x28bf68[_0x4090('0x49')]=!![];}else{_0x28bf68['created']=![];}_0x5c5428[_0x4090('0x4a')]=_0x28bf68;return db[_0x4090('0x4b')][_0x4090('0x40')]({'body':_0x3dee07[_0x4090('0x24')][_0x4090('0x24')],'FaxAccountId':_0x3dee07[_0x4090('0x34')]['id'],'FaxInteractionId':_0x2c1cdb['id'],'direction':'in','ContactId':_0x2c1cdb[_0x4090('0x4c')],'AttachmentId':_0x3dee07[_0x4090('0x24')][_0x4090('0x4d')]});})[_0x4090('0xf')](function(_0x5aaf8a){_0x5c5428['message']=_0x5aaf8a;if(_0x5c5428['interaction'][_0x4090('0x4e')]){return db[_0x4090('0x4f')][_0x4090('0x33')]({'attributes':['id','name'],'where':{'id':_0x5c5428['interaction']['UserId']}})[_0x4090('0xf')](function(_0x5598d4){if(_0x5598d4){_0x5c5428[_0x4090('0x3c')][_0x4090('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5598d4['name']+','+(_0x5c5428[_0x4090('0x34')][_0x4090('0x51')]||0xa),'interval':_0x4090('0x52')});}return respondWithRpcPromise(_0x4090('0x53'),_0x4090('0x54'),_0x5c5428);});}return respondWithRpcPromise(_0x4090('0x53'),_0x4090('0x54'),_0x5c5428);})['then'](function(_0x20a776){_0x4d046d(_0x20a776);})['catch'](function(_0x370ff5){_0x69d5c9(_0x41e000[_0x4090('0x14')](0x1f4,_0x370ff5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ca3bb7a..65a097f 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 _0xa9f9=['length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener'];(function(_0x5b9132,_0xa374d2){var _0x4a9e05=function(_0x1b2cf9){while(--_0x1b2cf9){_0x5b9132['push'](_0x5b9132['shift']());}};_0x4a9e05(++_0xa374d2);}(_0xa9f9,0x18a));var _0x9a9f=function(_0x5799f8,_0x10cb10){_0x5799f8=_0x5799f8-0x0;var _0x33b26a=_0xa9f9[_0x5799f8];return _0x33b26a;};'use strict';var FaxAccountEvents=require(_0x9a9f('0x0'));var events=[_0x9a9f('0x1'),_0x9a9f('0x2'),'update'];function createListener(_0x386af1,_0x5a5357){return function(_0x16deb5){_0x5a5357[_0x9a9f('0x3')](_0x386af1,_0x16deb5);};}function removeListener(_0x300fa9,_0x2406fb){return function(){FaxAccountEvents[_0x9a9f('0x4')](_0x300fa9,_0x2406fb);};}exports['register']=function(_0x2295ee){for(var _0x1fb4db=0x0,_0x5a8d81=events[_0x9a9f('0x5')];_0x1fb4db<_0x5a8d81;_0x1fb4db++){var _0x2f2aec=events[_0x1fb4db];var _0x59d15c=createListener(_0x9a9f('0x6')+_0x2f2aec,_0x2295ee);FaxAccountEvents['on'](_0x2f2aec,_0x59d15c);}}; \ No newline at end of file +var _0x0ccd=['length','faxAccount:','./faxAccount.events','remove','update','emit','removeListener','register'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0ccd,0x19a));var _0xd0cc=function(_0x1c1fba,_0xd5872d){_0x1c1fba=_0x1c1fba-0x0;var _0x37e346=_0x0ccd[_0x1c1fba];return _0x37e346;};'use strict';var FaxAccountEvents=require(_0xd0cc('0x0'));var events=['save',_0xd0cc('0x1'),_0xd0cc('0x2')];function createListener(_0x3c3ddc,_0x29d88f){return function(_0x6d9503){_0x29d88f[_0xd0cc('0x3')](_0x3c3ddc,_0x6d9503);};}function removeListener(_0x3c7e30,_0x2af2f4){return function(){FaxAccountEvents[_0xd0cc('0x4')](_0x3c7e30,_0x2af2f4);};}exports[_0xd0cc('0x5')]=function(_0x374d69){for(var _0x429d80=0x0,_0x2bbe08=events[_0xd0cc('0x6')];_0x429d80<_0x2bbe08;_0x429d80++){var _0x57638e=events[_0x429d80];var _0x5af867=createListener(_0xd0cc('0x7')+_0x57638e,_0x374d69);FaxAccountEvents['on'](_0x57638e,_0x5af867);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d13eae8..a3ea5f5 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(_0x38ffd6,_0x54c358){var _0x131bdb=function(_0x36aac3){while(--_0x36aac3){_0x38ffd6['push'](_0x38ffd6['shift']());}};_0x131bdb(++_0x54c358);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x2b5bab,_0x2018e1){var _0x243b04=function(_0x3b880f){while(--_0x3b880f){_0x2b5bab['push'](_0x2b5bab['shift']());}};_0x243b04(++_0x2018e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 23b7179..ea5b5b8 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 _0x4418=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4418,0xca));var _0x8441=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x4418[_0x145b3c];return _0x1b6e36;};'use strict';var Sequelize=require(_0x8441('0x0'));module[_0x8441('0x1')]={'priority':{'type':Sequelize[_0x8441('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8441('0x3')],'allowNull':![],'defaultValue':_0x8441('0x4')},'appdata':{'type':Sequelize[_0x8441('0x5')]()},'description':{'type':Sequelize[_0x8441('0x3')]},'interval':{'type':Sequelize[_0x8441('0x3')],'defaultValue':_0x8441('0x6')}}; \ No newline at end of file +var _0x6b2b=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x2b9b90,_0x3bb97e){var _0x2a14d1=function(_0x4e2584){while(--_0x4e2584){_0x2b9b90['push'](_0x2b9b90['shift']());}};_0x2a14d1(++_0x3bb97e);}(_0x6b2b,0x169));var _0xb6b2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6b2b[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xb6b2('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb6b2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb6b2('0x2')],'allowNull':![],'defaultValue':_0xb6b2('0x3')},'appdata':{'type':Sequelize[_0xb6b2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb6b2('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ebb70f7..a7e3d08 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 _0x7b5d=['index','map','FaxApplication','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','show','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','sox','ejs','fs-extra','lodash','squel','crypto','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','count','limit','Content-Range','reject','save','update','destroy','error','stack','send'];(function(_0xf80f32,_0x56bb76){var _0x15a45e=function(_0xd7306d){while(--_0xd7306d){_0xf80f32['push'](_0xf80f32['shift']());}};_0x15a45e(++_0x56bb76);}(_0x7b5d,0x18f));var _0xd7b5=function(_0x2ec792,_0x3c227f){_0x2ec792=_0x2ec792-0x0;var _0x509fca=_0x7b5d[_0x2ec792];return _0x509fca;};'use strict';var emlformat=require(_0xd7b5('0x0'));var rimraf=require(_0xd7b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7b5('0x2'));var rp=require(_0xd7b5('0x3'));var moment=require(_0xd7b5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd7b5('0x5'));var csv=require('to-csv');var ejs=require(_0xd7b5('0x6'));var fs=require('fs');var fs_extra=require(_0xd7b5('0x7'));var _=require(_0xd7b5('0x8'));var squel=require(_0xd7b5('0x9'));var crypto=require(_0xd7b5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd7b5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd7b5('0xc'));var Papa=require(_0xd7b5('0xd'));var Redis=require(_0xd7b5('0xe'));var authService=require(_0xd7b5('0xf'));var qs=require(_0xd7b5('0x10'));var as=require(_0xd7b5('0x11'));var hardwareService=require(_0xd7b5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd7b5('0x13'));var config=require(_0xd7b5('0x14'));var licenseUtil=require(_0xd7b5('0x15'));var db=require(_0xd7b5('0x16'))['db'];function respondWithStatusCode(_0x4ef2fd,_0x536b8b){_0x536b8b=_0x536b8b||0xcc;return function(_0x277d62){if(_0x277d62){return _0x4ef2fd[_0xd7b5('0x17')](_0x536b8b);}return _0x4ef2fd[_0xd7b5('0x18')](_0x536b8b)[_0xd7b5('0x19')]();};}function respondWithResult(_0x4f195b,_0x7d3405){_0x7d3405=_0x7d3405||0xc8;return function(_0x2a474f){if(_0x2a474f){return _0x4f195b[_0xd7b5('0x18')](_0x7d3405)[_0xd7b5('0x1a')](_0x2a474f);}};}function respondWithFilteredResult(_0x153836,_0x4967c4){return function(_0x3c2f14){if(_0x3c2f14){var _0x5b1779=typeof _0x4967c4[_0xd7b5('0x1b')]===_0xd7b5('0x1c')&&typeof _0x4967c4['limit']===_0xd7b5('0x1c');var _0x23ce6a=_0x3c2f14[_0xd7b5('0x1d')];var _0x3dd79c=_0x5b1779?0x0:_0x4967c4[_0xd7b5('0x1b')];var _0x3a1fa7=_0x5b1779?_0x3c2f14['count']:_0x4967c4[_0xd7b5('0x1b')]+_0x4967c4[_0xd7b5('0x1e')];var _0x2eb960;if(_0x3a1fa7>=_0x23ce6a){_0x3a1fa7=_0x23ce6a;_0x2eb960=0xc8;}else{_0x2eb960=0xce;}_0x153836[_0xd7b5('0x18')](_0x2eb960);return _0x153836['set'](_0xd7b5('0x1f'),_0x3dd79c+'-'+_0x3a1fa7+'/'+_0x23ce6a)[_0xd7b5('0x1a')](_0x3c2f14);}return null;};}function patchUpdates(_0x5832ac){return function(_0x301598){try{jsonpatch['apply'](_0x301598,_0x5832ac,!![]);}catch(_0x270ff4){return BPromise[_0xd7b5('0x20')](_0x270ff4);}return _0x301598[_0xd7b5('0x21')]();};}function saveUpdates(_0x239460,_0x393415){return function(_0x27b804){if(_0x27b804){return _0x27b804[_0xd7b5('0x22')](_0x239460)['then'](function(_0x578de5){return _0x578de5;});}return null;};}function removeEntity(_0x446605,_0x15a41d){return function(_0x1f0ea8){if(_0x1f0ea8){return _0x1f0ea8[_0xd7b5('0x23')]()['then'](function(){_0x446605['status'](0xcc)[_0xd7b5('0x19')]();});}};}function handleEntityNotFound(_0xd51ff3,_0x26f052){return function(_0x175a69){if(!_0x175a69){_0xd51ff3['sendStatus'](0x194);}return _0x175a69;};}function handleError(_0x176acd,_0x1e556d){_0x1e556d=_0x1e556d||0x1f4;return function(_0x468462){logger[_0xd7b5('0x24')](_0x468462[_0xd7b5('0x25')]);if(_0x468462['name']){delete _0x468462['name'];}_0x176acd[_0xd7b5('0x18')](_0x1e556d)[_0xd7b5('0x26')](_0x468462);};}exports[_0xd7b5('0x27')]=function(_0x444698,_0x36b7fa){var _0x3e3899={},_0x55b7b9={},_0x4c5e40={'count':0x0,'rows':[]};var _0x28f5f4=_[_0xd7b5('0x28')](db[_0xd7b5('0x29')][_0xd7b5('0x2a')],function(_0x119176){return{'name':_0x119176[_0xd7b5('0x2b')],'type':_0x119176[_0xd7b5('0x2c')][_0xd7b5('0x2d')]};});_0x55b7b9[_0xd7b5('0x2e')]=_['map'](_0x28f5f4,_0xd7b5('0x2f'));_0x55b7b9['query']=_[_0xd7b5('0x30')](_0x444698[_0xd7b5('0x31')]);_0x55b7b9[_0xd7b5('0x32')]=_[_0xd7b5('0x33')](_0x55b7b9[_0xd7b5('0x2e')],_0x55b7b9[_0xd7b5('0x31')]);_0x3e3899[_0xd7b5('0x34')]=_[_0xd7b5('0x33')](_0x55b7b9[_0xd7b5('0x2e')],qs[_0xd7b5('0x35')](_0x444698[_0xd7b5('0x31')]['fields']));_0x3e3899['attributes']=_0x3e3899['attributes']['length']?_0x3e3899[_0xd7b5('0x34')]:_0x55b7b9['model'];if(!_0x444698[_0xd7b5('0x31')][_0xd7b5('0x36')](_0xd7b5('0x37'))){_0x3e3899[_0xd7b5('0x1e')]=qs[_0xd7b5('0x1e')](_0x444698[_0xd7b5('0x31')][_0xd7b5('0x1e')]);_0x3e3899[_0xd7b5('0x1b')]=qs[_0xd7b5('0x1b')](_0x444698[_0xd7b5('0x31')][_0xd7b5('0x1b')]);}_0x3e3899['order']=qs[_0xd7b5('0x38')](_0x444698[_0xd7b5('0x31')][_0xd7b5('0x38')]);_0x3e3899[_0xd7b5('0x39')]=qs['filters'](_[_0xd7b5('0x3a')](_0x444698[_0xd7b5('0x31')],_0x55b7b9[_0xd7b5('0x32')]),_0x28f5f4);if(_0x444698['query'][_0xd7b5('0x3b')]){_0x3e3899[_0xd7b5('0x39')]=_[_0xd7b5('0x3c')](_0x3e3899[_0xd7b5('0x39')],{'$or':_[_0xd7b5('0x28')](_0x28f5f4,function(_0xf94456){if(_0xf94456[_0xd7b5('0x2c')]!=='VIRTUAL'){var _0x1c1047={};_0x1c1047[_0xf94456[_0xd7b5('0x2f')]]={'$like':'%'+_0x444698[_0xd7b5('0x31')]['filter']+'%'};return _0x1c1047;}})});}_0x3e3899=_[_0xd7b5('0x3c')]({},_0x3e3899,_0x444698[_0xd7b5('0x3d')]);var _0x14cdd1={'where':_0x3e3899[_0xd7b5('0x39')]};return db['FaxApplication']['count'](_0x14cdd1)[_0xd7b5('0x3e')](function(_0x22fbc3){_0x4c5e40[_0xd7b5('0x1d')]=_0x22fbc3;if(_0x444698['query'][_0xd7b5('0x3f')]){_0x3e3899[_0xd7b5('0x40')]=[{'all':!![]}];}return db[_0xd7b5('0x29')][_0xd7b5('0x41')](_0x3e3899);})[_0xd7b5('0x3e')](function(_0x2b83c6){_0x4c5e40['rows']=_0x2b83c6;return _0x4c5e40;})[_0xd7b5('0x3e')](respondWithFilteredResult(_0x36b7fa,_0x3e3899))['catch'](handleError(_0x36b7fa,null));};exports[_0xd7b5('0x42')]=function(_0x3a06d3,_0x56eda2){var _0x23b9d2={'raw':!![],'where':{'id':_0x3a06d3[_0xd7b5('0x43')]['id']}},_0x1543d8={};_0x1543d8['model']=_[_0xd7b5('0x30')](db['FaxApplication']['rawAttributes']);_0x1543d8['query']=_[_0xd7b5('0x30')](_0x3a06d3[_0xd7b5('0x31')]);_0x1543d8['filters']=_[_0xd7b5('0x33')](_0x1543d8[_0xd7b5('0x2e')],_0x1543d8[_0xd7b5('0x31')]);_0x23b9d2['attributes']=_['intersection'](_0x1543d8[_0xd7b5('0x2e')],qs[_0xd7b5('0x35')](_0x3a06d3[_0xd7b5('0x31')][_0xd7b5('0x35')]));_0x23b9d2[_0xd7b5('0x34')]=_0x23b9d2[_0xd7b5('0x34')][_0xd7b5('0x44')]?_0x23b9d2['attributes']:_0x1543d8[_0xd7b5('0x2e')];if(_0x3a06d3[_0xd7b5('0x31')][_0xd7b5('0x3f')]){_0x23b9d2[_0xd7b5('0x40')]=[{'all':!![]}];}_0x23b9d2=_[_0xd7b5('0x3c')]({},_0x23b9d2,_0x3a06d3[_0xd7b5('0x3d')]);return db[_0xd7b5('0x29')][_0xd7b5('0x45')](_0x23b9d2)['then'](handleEntityNotFound(_0x56eda2,null))[_0xd7b5('0x3e')](respondWithResult(_0x56eda2,null))[_0xd7b5('0x46')](handleError(_0x56eda2,null));};exports[_0xd7b5('0x47')]=function(_0x1af0c1,_0x335a5f){return db[_0xd7b5('0x29')][_0xd7b5('0x47')](_0x1af0c1[_0xd7b5('0x48')],{})[_0xd7b5('0x3e')](respondWithResult(_0x335a5f,0xc9))[_0xd7b5('0x46')](handleError(_0x335a5f,null));};exports['update']=function(_0x4a1bc8,_0x4fca80){if(_0x4a1bc8['body']['id']){delete _0x4a1bc8[_0xd7b5('0x48')]['id'];}return db[_0xd7b5('0x29')][_0xd7b5('0x45')]({'where':{'id':_0x4a1bc8['params']['id']}})['then'](handleEntityNotFound(_0x4fca80,null))['then'](saveUpdates(_0x4a1bc8[_0xd7b5('0x48')],null))[_0xd7b5('0x3e')](respondWithResult(_0x4fca80,null))[_0xd7b5('0x46')](handleError(_0x4fca80,null));};exports['destroy']=function(_0x234d14,_0x57045a){return db[_0xd7b5('0x29')][_0xd7b5('0x45')]({'where':{'id':_0x234d14[_0xd7b5('0x43')]['id']}})[_0xd7b5('0x3e')](handleEntityNotFound(_0x57045a,null))[_0xd7b5('0x3e')](removeEntity(_0x57045a,null))['catch'](handleError(_0x57045a,null));}; \ No newline at end of file +var _0x99e3=['VIRTUAL','options','FaxApplication','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','rimraf','fast-json-patch','request-promise','mustache','sox','fs-extra','lodash','squel','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','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','end','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','type'];(function(_0x2349d7,_0x2f3a9b){var _0x573535=function(_0x1a20bc){while(--_0x1a20bc){_0x2349d7['push'](_0x2349d7['shift']());}};_0x573535(++_0x2f3a9b);}(_0x99e3,0x1c4));var _0x399e=function(_0x1f336d,_0x4540f4){_0x1f336d=_0x1f336d-0x0;var _0x3bdf46=_0x99e3[_0x1f336d];return _0x3bdf46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x399e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x399e('0x1'));var rp=require(_0x399e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x399e('0x3'));var util=require('util');var path=require('path');var sox=require(_0x399e('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x399e('0x5'));var _=require(_0x399e('0x6'));var squel=require(_0x399e('0x7'));var crypto=require('crypto');var jsforce=require(_0x399e('0x8'));var deskjs=require(_0x399e('0x9'));var toCsv=require(_0x399e('0xa'));var querystring=require(_0x399e('0xb'));var Papa=require(_0x399e('0xc'));var Redis=require(_0x399e('0xd'));var authService=require(_0x399e('0xe'));var qs=require(_0x399e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x399e('0x10'));var logger=require(_0x399e('0x11'))('api');var utils=require(_0x399e('0x12'));var config=require(_0x399e('0x13'));var licenseUtil=require(_0x399e('0x14'));var db=require(_0x399e('0x15'))['db'];function respondWithStatusCode(_0x2bd193,_0x38909d){_0x38909d=_0x38909d||0xcc;return function(_0x107fdd){if(_0x107fdd){return _0x2bd193[_0x399e('0x16')](_0x38909d);}return _0x2bd193[_0x399e('0x17')](_0x38909d)['end']();};}function respondWithResult(_0x3dd98b,_0x586ab9){_0x586ab9=_0x586ab9||0xc8;return function(_0xe0b9a0){if(_0xe0b9a0){return _0x3dd98b[_0x399e('0x17')](_0x586ab9)[_0x399e('0x18')](_0xe0b9a0);}};}function respondWithFilteredResult(_0x518d7a,_0x480c67){return function(_0x471322){if(_0x471322){var _0x3f0412=typeof _0x480c67['offset']===_0x399e('0x19')&&typeof _0x480c67[_0x399e('0x1a')]===_0x399e('0x19');var _0x2f862d=_0x471322[_0x399e('0x1b')];var _0x21d07a=_0x3f0412?0x0:_0x480c67['offset'];var _0x42bc32=_0x3f0412?_0x471322[_0x399e('0x1b')]:_0x480c67[_0x399e('0x1c')]+_0x480c67[_0x399e('0x1a')];var _0x226435;if(_0x42bc32>=_0x2f862d){_0x42bc32=_0x2f862d;_0x226435=0xc8;}else{_0x226435=0xce;}_0x518d7a[_0x399e('0x17')](_0x226435);return _0x518d7a[_0x399e('0x1d')](_0x399e('0x1e'),_0x21d07a+'-'+_0x42bc32+'/'+_0x2f862d)[_0x399e('0x18')](_0x471322);}return null;};}function patchUpdates(_0x1deda9){return function(_0x3920a9){try{jsonpatch['apply'](_0x3920a9,_0x1deda9,!![]);}catch(_0x4ea3cb){return BPromise[_0x399e('0x1f')](_0x4ea3cb);}return _0x3920a9[_0x399e('0x20')]();};}function saveUpdates(_0x5d4503,_0x165209){return function(_0x11d1e6){if(_0x11d1e6){return _0x11d1e6['update'](_0x5d4503)['then'](function(_0x5538d6){return _0x5538d6;});}return null;};}function removeEntity(_0x16574c,_0x1b6058){return function(_0x5ea0fe){if(_0x5ea0fe){return _0x5ea0fe[_0x399e('0x21')]()[_0x399e('0x22')](function(){_0x16574c[_0x399e('0x17')](0xcc)[_0x399e('0x23')]();});}};}function handleEntityNotFound(_0x541b6a,_0x560933){return function(_0x15d6b5){if(!_0x15d6b5){_0x541b6a['sendStatus'](0x194);}return _0x15d6b5;};}function handleError(_0x10e5c0,_0x4dd6f2){_0x4dd6f2=_0x4dd6f2||0x1f4;return function(_0x57084d){logger[_0x399e('0x24')](_0x57084d[_0x399e('0x25')]);if(_0x57084d[_0x399e('0x26')]){delete _0x57084d[_0x399e('0x26')];}_0x10e5c0[_0x399e('0x17')](_0x4dd6f2)[_0x399e('0x27')](_0x57084d);};}exports[_0x399e('0x28')]=function(_0x177a0b,_0x41fafb){var _0x1ea90f={},_0x5e699e={},_0x4325d1={'count':0x0,'rows':[]};var _0x33bd01=_[_0x399e('0x29')](db['FaxApplication']['rawAttributes'],function(_0xbb4bcb){return{'name':_0xbb4bcb[_0x399e('0x2a')],'type':_0xbb4bcb['type']['key']};});_0x5e699e[_0x399e('0x2b')]=_[_0x399e('0x29')](_0x33bd01,_0x399e('0x26'));_0x5e699e[_0x399e('0x2c')]=_[_0x399e('0x2d')](_0x177a0b[_0x399e('0x2c')]);_0x5e699e[_0x399e('0x2e')]=_[_0x399e('0x2f')](_0x5e699e['model'],_0x5e699e[_0x399e('0x2c')]);_0x1ea90f['attributes']=_['intersection'](_0x5e699e['model'],qs[_0x399e('0x30')](_0x177a0b[_0x399e('0x2c')][_0x399e('0x30')]));_0x1ea90f['attributes']=_0x1ea90f['attributes'][_0x399e('0x31')]?_0x1ea90f[_0x399e('0x32')]:_0x5e699e['model'];if(!_0x177a0b[_0x399e('0x2c')][_0x399e('0x33')](_0x399e('0x34'))){_0x1ea90f[_0x399e('0x1a')]=qs[_0x399e('0x1a')](_0x177a0b[_0x399e('0x2c')]['limit']);_0x1ea90f[_0x399e('0x1c')]=qs[_0x399e('0x1c')](_0x177a0b['query'][_0x399e('0x1c')]);}_0x1ea90f[_0x399e('0x35')]=qs[_0x399e('0x36')](_0x177a0b[_0x399e('0x2c')][_0x399e('0x36')]);_0x1ea90f['where']=qs[_0x399e('0x2e')](_['pick'](_0x177a0b[_0x399e('0x2c')],_0x5e699e[_0x399e('0x2e')]),_0x33bd01);if(_0x177a0b[_0x399e('0x2c')][_0x399e('0x37')]){_0x1ea90f[_0x399e('0x38')]=_[_0x399e('0x39')](_0x1ea90f[_0x399e('0x38')],{'$or':_[_0x399e('0x29')](_0x33bd01,function(_0x197027){if(_0x197027[_0x399e('0x3a')]!==_0x399e('0x3b')){var _0x27250d={};_0x27250d[_0x197027[_0x399e('0x26')]]={'$like':'%'+_0x177a0b[_0x399e('0x2c')][_0x399e('0x37')]+'%'};return _0x27250d;}})});}_0x1ea90f=_[_0x399e('0x39')]({},_0x1ea90f,_0x177a0b[_0x399e('0x3c')]);var _0x30e7e3={'where':_0x1ea90f['where']};return db[_0x399e('0x3d')][_0x399e('0x1b')](_0x30e7e3)[_0x399e('0x22')](function(_0x41d55e){_0x4325d1['count']=_0x41d55e;if(_0x177a0b['query'][_0x399e('0x3e')]){_0x1ea90f['include']=[{'all':!![]}];}return db[_0x399e('0x3d')][_0x399e('0x3f')](_0x1ea90f);})[_0x399e('0x22')](function(_0xd71254){_0x4325d1[_0x399e('0x40')]=_0xd71254;return _0x4325d1;})['then'](respondWithFilteredResult(_0x41fafb,_0x1ea90f))[_0x399e('0x41')](handleError(_0x41fafb,null));};exports[_0x399e('0x42')]=function(_0x3f3998,_0x4a3346){var _0x17e400={'raw':!![],'where':{'id':_0x3f3998[_0x399e('0x43')]['id']}},_0x2667ef={};_0x2667ef['model']=_['keys'](db[_0x399e('0x3d')]['rawAttributes']);_0x2667ef[_0x399e('0x2c')]=_[_0x399e('0x2d')](_0x3f3998[_0x399e('0x2c')]);_0x2667ef[_0x399e('0x2e')]=_[_0x399e('0x2f')](_0x2667ef['model'],_0x2667ef[_0x399e('0x2c')]);_0x17e400[_0x399e('0x32')]=_[_0x399e('0x2f')](_0x2667ef[_0x399e('0x2b')],qs['fields'](_0x3f3998[_0x399e('0x2c')][_0x399e('0x30')]));_0x17e400['attributes']=_0x17e400[_0x399e('0x32')][_0x399e('0x31')]?_0x17e400[_0x399e('0x32')]:_0x2667ef['model'];if(_0x3f3998[_0x399e('0x2c')][_0x399e('0x3e')]){_0x17e400[_0x399e('0x44')]=[{'all':!![]}];}_0x17e400=_[_0x399e('0x39')]({},_0x17e400,_0x3f3998[_0x399e('0x3c')]);return db['FaxApplication'][_0x399e('0x45')](_0x17e400)[_0x399e('0x22')](handleEntityNotFound(_0x4a3346,null))[_0x399e('0x22')](respondWithResult(_0x4a3346,null))[_0x399e('0x41')](handleError(_0x4a3346,null));};exports[_0x399e('0x46')]=function(_0x435153,_0x2eb3d2){return db[_0x399e('0x3d')][_0x399e('0x46')](_0x435153['body'],{})[_0x399e('0x22')](respondWithResult(_0x2eb3d2,0xc9))[_0x399e('0x41')](handleError(_0x2eb3d2,null));};exports[_0x399e('0x47')]=function(_0x4a25e0,_0x57a654){if(_0x4a25e0[_0x399e('0x48')]['id']){delete _0x4a25e0['body']['id'];}return db['FaxApplication']['find']({'where':{'id':_0x4a25e0[_0x399e('0x43')]['id']}})['then'](handleEntityNotFound(_0x57a654,null))[_0x399e('0x22')](saveUpdates(_0x4a25e0[_0x399e('0x48')],null))[_0x399e('0x22')](respondWithResult(_0x57a654,null))[_0x399e('0x41')](handleError(_0x57a654,null));};exports[_0x399e('0x21')]=function(_0x3393ac,_0x1974d9){return db[_0x399e('0x3d')][_0x399e('0x45')]({'where':{'id':_0x3393ac[_0x399e('0x43')]['id']}})[_0x399e('0x22')](handleEntityNotFound(_0x1974d9,null))[_0x399e('0x22')](removeEntity(_0x1974d9,null))['catch'](handleError(_0x1974d9,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 9ef470b..91e3f2e 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 _0x8ff5=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','FaxApplication','fax_applications'];(function(_0x45da55,_0x63f4e4){var _0x2689ab=function(_0x535712){while(--_0x535712){_0x45da55['push'](_0x45da55['shift']());}};_0x2689ab(++_0x63f4e4);}(_0x8ff5,0x1ca));var _0x58ff=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8ff5[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x58ff('0x0'))(_0x58ff('0x1'));var moment=require(_0x58ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x58ff('0x3'));var fs=require('fs');var path=require(_0x58ff('0x4'));var rimraf=require(_0x58ff('0x5'));var config=require(_0x58ff('0x6'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x562724,_0x49bbad){return _0x562724[_0x58ff('0x7')](_0x58ff('0x8'),attributes,{'tableName':_0x58ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58ff('0xa'),'collate':_0x58ff('0xb')});}; \ No newline at end of file +var _0x787d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x787d,0x1bc));var _0xd787=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x787d[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xd787('0x0'));var util=require(_0xd787('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd787('0x2'));var BPromise=require(_0xd787('0x3'));var rp=require(_0xd787('0x4'));var fs=require('fs');var path=require(_0xd787('0x5'));var rimraf=require(_0xd787('0x6'));var config=require(_0xd787('0x7'));var attributes=require(_0xd787('0x8'));module[_0xd787('0x9')]=function(_0x12c19d,_0x10b54f){return _0x12c19d[_0xd787('0xa')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd787('0xb'),'collate':_0xd787('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 20f2bf3..ef7fbbf 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 _0xf134=['http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','FaxApplication','update','body','raw','options','attributes','UpdateFaxApplication','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x29e8fb,_0x585913){var _0x1f5b03=function(_0x4ea12a){while(--_0x4ea12a){_0x29e8fb['push'](_0x29e8fb['shift']());}};_0x1f5b03(++_0x585913);}(_0xf134,0x17d));var _0x4f13=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf134[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4f13('0x0'));var util=require(_0x4f13('0x1'));var moment=require(_0x4f13('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f13('0x3'));var fs=require('fs');var Redis=require(_0x4f13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f13('0x5'));var logger=require('../../config/logger')(_0x4f13('0x6'));var config=require(_0x4f13('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f13('0x8')][_0x4f13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42f15c,_0x278878,_0x2fafee){return new BPromise(function(_0x2812b6,_0x5b6745){return client['request'](_0x42f15c,_0x2fafee)[_0x4f13('0xa')](function(_0x423545){logger[_0x4f13('0xb')](_0x4f13('0xc'),_0x278878,_0x4f13('0xd'));logger[_0x4f13('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x278878,'request\x20sent',JSON[_0x4f13('0xf')](_0x423545));if(_0x423545[_0x4f13('0x10')]){if(_0x423545[_0x4f13('0x10')]['code']===0x1f4){logger['error'](_0x4f13('0xc'),_0x278878,_0x423545[_0x4f13('0x10')][_0x4f13('0x11')]);return _0x5b6745(_0x423545[_0x4f13('0x10')][_0x4f13('0x11')]);}logger[_0x4f13('0x10')]('FaxApplication,\x20%s,\x20%s',_0x278878,_0x423545[_0x4f13('0x10')][_0x4f13('0x11')]);return _0x2812b6(_0x423545['error'][_0x4f13('0x11')]);}else{logger[_0x4f13('0xb')]('FaxApplication,\x20%s,\x20%s',_0x278878,_0x4f13('0xd'));_0x2812b6(_0x423545['result'][_0x4f13('0x11')]);}})['catch'](function(_0xbdaaa2){logger[_0x4f13('0x10')](_0x4f13('0xc'),_0x278878,_0xbdaaa2);_0x5b6745(_0xbdaaa2);});});}exports['UpdateFaxApplication']=function(_0x259cd0){var _0x1ff05e=this;return new Promise(function(_0x410b77,_0x46abf9){return db[_0x4f13('0x12')][_0x4f13('0x13')](_0x259cd0[_0x4f13('0x14')],{'raw':_0x259cd0['options']?_0x259cd0['options'][_0x4f13('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x259cd0[_0x4f13('0x16')]?_0x259cd0[_0x4f13('0x16')]['where']||null:null,'attributes':_0x259cd0[_0x4f13('0x16')]?_0x259cd0[_0x4f13('0x16')][_0x4f13('0x17')]||null:null,'limit':_0x259cd0['options']?_0x259cd0['options']['limit']||null:null})[_0x4f13('0xa')](function(_0x4e3b3d){logger[_0x4f13('0xb')](_0x4f13('0x18'),_0x259cd0);logger[_0x4f13('0xe')](_0x4f13('0x18'),_0x259cd0,JSON[_0x4f13('0xf')](_0x4e3b3d));_0x410b77(_0x4e3b3d);})[_0x4f13('0x19')](function(_0x4aa4e7){logger['error']('UpdateFaxApplication',_0x4aa4e7['message'],_0x259cd0);_0x46abf9(_0x1ff05e[_0x4f13('0x10')](0x1f4,_0x4aa4e7[_0x4f13('0x11')]));});});}; \ No newline at end of file +var _0xc005=['request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxApplication,\x20%s,\x20%s','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x40cbea,_0x52b6ba){var _0x503ca0=function(_0x1f166c){while(--_0x1f166c){_0x40cbea['push'](_0x40cbea['shift']());}};_0x503ca0(++_0x52b6ba);}(_0xc005,0x1f2));var _0x5c00=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xc005[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require(_0x5c00('0x0'));var util=require(_0x5c00('0x1'));var moment=require(_0x5c00('0x2'));var BPromise=require(_0x5c00('0x3'));var rs=require(_0x5c00('0x4'));var fs=require('fs');var Redis=require(_0x5c00('0x5'));var db=require(_0x5c00('0x6'))['db'];var utils=require(_0x5c00('0x7'));var logger=require('../../config/logger')(_0x5c00('0x8'));var config=require(_0x5c00('0x9'));var jayson=require(_0x5c00('0xa'));var client=jayson['client'][_0x5c00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2134a5,_0x5d75e8,_0x42095e){return new BPromise(function(_0x4a59fa,_0x503b4e){return client[_0x5c00('0xc')](_0x2134a5,_0x42095e)[_0x5c00('0xd')](function(_0x52b298){logger[_0x5c00('0xe')]('FaxApplication,\x20%s,\x20%s',_0x5d75e8,_0x5c00('0xf'));logger[_0x5c00('0x10')](_0x5c00('0x11'),_0x5d75e8,_0x5c00('0xf'),JSON[_0x5c00('0x12')](_0x52b298));if(_0x52b298['error']){if(_0x52b298['error'][_0x5c00('0x13')]===0x1f4){logger[_0x5c00('0x14')]('FaxApplication,\x20%s,\x20%s',_0x5d75e8,_0x52b298[_0x5c00('0x14')][_0x5c00('0x15')]);return _0x503b4e(_0x52b298[_0x5c00('0x14')]['message']);}logger[_0x5c00('0x14')](_0x5c00('0x16'),_0x5d75e8,_0x52b298['error']['message']);return _0x4a59fa(_0x52b298['error'][_0x5c00('0x15')]);}else{logger['info'](_0x5c00('0x16'),_0x5d75e8,_0x5c00('0xf'));_0x4a59fa(_0x52b298['result'][_0x5c00('0x15')]);}})[_0x5c00('0x17')](function(_0x45af5d){logger[_0x5c00('0x14')](_0x5c00('0x16'),_0x5d75e8,_0x45af5d);_0x503b4e(_0x45af5d);});});}exports[_0x5c00('0x18')]=function(_0x60f15e){var _0x3779bd=this;return new Promise(function(_0xae1969,_0x3f5917){return db[_0x5c00('0x19')][_0x5c00('0x1a')](_0x60f15e[_0x5c00('0x1b')],{'raw':_0x60f15e['options']?_0x60f15e[_0x5c00('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60f15e['options']?_0x60f15e['options'][_0x5c00('0x1d')]||null:null,'attributes':_0x60f15e[_0x5c00('0x1c')]?_0x60f15e['options']['attributes']||null:null,'limit':_0x60f15e[_0x5c00('0x1c')]?_0x60f15e[_0x5c00('0x1c')]['limit']||null:null})['then'](function(_0x50145f){logger[_0x5c00('0xe')](_0x5c00('0x18'),_0x60f15e);logger['debug'](_0x5c00('0x18'),_0x60f15e,JSON[_0x5c00('0x12')](_0x50145f));_0xae1969(_0x50145f);})[_0x5c00('0x17')](function(_0x40f01f){logger[_0x5c00('0x14')](_0x5c00('0x18'),_0x40f01f[_0x5c00('0x15')],_0x60f15e);_0x3f5917(_0x3779bd['error'](0x1f4,_0x40f01f[_0x5c00('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c7434ed..e2913e6 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 _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(_0x5d7598,_0x3eb227){var _0x3b81d4=function(_0x117960){while(--_0x117960){_0x5d7598['push'](_0x5d7598['shift']());}};_0x3b81d4(++_0x3eb227);}(_0x6324,0x142));var _0x4632=function(_0x111777,_0x43e893){_0x111777=_0x111777-0x0;var _0x18b652=_0x6324[_0x111777];return _0x18b652;};'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 +var _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1d4197,_0xf9b376){var _0x2a12e1=function(_0x49bf03){while(--_0x49bf03){_0x1d4197['push'](_0x1d4197['shift']());}};_0x2a12e1(++_0xf9b376);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index cd4ccd8..2c21d26 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 _0x60e3=['STRING','ENUM','out','DATE'];(function(_0x41ed43,_0x421bd0){var _0x24c8d9=function(_0xe41236){while(--_0xe41236){_0x41ed43['push'](_0x41ed43['shift']());}};_0x24c8d9(++_0x421bd0);}(_0x60e3,0xab));var _0x360e=function(_0x134ead,_0x4f0ed7){_0x134ead=_0x134ead-0x0;var _0x4a1ff2=_0x60e3[_0x134ead];return _0x4a1ff2;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x360e('0x0')]},'disposition':{'type':Sequelize[_0x360e('0x1')]},'secondDisposition':{'type':Sequelize[_0x360e('0x1')]},'thirdDisposition':{'type':Sequelize[_0x360e('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x360e('0x0')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x360e('0x2')]('in',_0x360e('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x360e('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x360e('0x2')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe6b8=['STRING','ENUM','BOOLEAN','DATE'];(function(_0x39de58,_0x158a4c){var _0x5ce2d1=function(_0x39fc9e){while(--_0x39fc9e){_0x39de58['push'](_0x39de58['shift']());}};_0x5ce2d1(++_0x158a4c);}(_0xe6b8,0x1ae));var _0x8e6b=function(_0x2db6a2,_0x16bd30){_0x2db6a2=_0x2db6a2-0x0;var _0x3f47d9=_0xe6b8[_0x2db6a2];return _0x3f47d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x8e6b('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8e6b('0x1')]},'disposition':{'type':Sequelize[_0x8e6b('0x2')]},'secondDisposition':{'type':Sequelize[_0x8e6b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8e6b('0x2')]},'note':{'type':Sequelize[_0x8e6b('0x2')]},'read1stAt':{'type':Sequelize[_0x8e6b('0x1')]},'fax':{'type':Sequelize[_0x8e6b('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8e6b('0x3')]('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 39691b6..cfb8c97 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 _0xa899=['findAll','addTags','spread','faxInteractionTags:save','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','pipe','createWriteStream','log','unlinkSync','eml-format','rimraf','moment','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','redis','defaults','localhost','./faxInteraction.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','save','then','end','sendStatus','name','Users','map','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','total','closed','UserId','waiting','answered','index','FaxInteraction','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','select','field','u.id','u.fullname','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','$substring','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?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','type','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','a.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','i.*','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','merge','options','create','update','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','pick','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xa899,0x1b5));var _0x9a89=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xa899[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0x9a89('0x0'));var rimraf=require(_0x9a89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a89('0x2'));var BPromise=require(_0x9a89('0x3'));var Mustache=require(_0x9a89('0x4'));var util=require(_0x9a89('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a89('0x6'));var _=require(_0x9a89('0x7'));var squel=require(_0x9a89('0x8'));var crypto=require('crypto');var jsforce=require(_0x9a89('0x9'));var deskjs=require(_0x9a89('0xa'));var toCsv=require(_0x9a89('0xb'));var querystring=require(_0x9a89('0xc'));var Papa=require(_0x9a89('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a89('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a89('0xf'))('api');var utils=require(_0x9a89('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9a89('0x11')]=_[_0x9a89('0x12')](config[_0x9a89('0x11')],{'host':_0x9a89('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a89('0x11')]));require(_0x9a89('0x14'))[_0x9a89('0x15')](socket);function respondWithStatusCode(_0x3a91b6,_0x2e3056){_0x2e3056=_0x2e3056||0xcc;return function(_0x54f39e){if(_0x54f39e){return _0x3a91b6['sendStatus'](_0x2e3056);}return _0x3a91b6[_0x9a89('0x16')](_0x2e3056)['end']();};}function respondWithResult(_0x5a0f6f,_0x1f4604){_0x1f4604=_0x1f4604||0xc8;return function(_0x1597b3){if(_0x1597b3){return _0x5a0f6f[_0x9a89('0x16')](_0x1f4604)['json'](_0x1597b3);}};}function respondWithFilteredResult(_0x492981,_0x44c690){return function(_0x5c5fdd){if(_0x5c5fdd){var _0x112846=typeof _0x44c690[_0x9a89('0x17')]===_0x9a89('0x18')&&typeof _0x44c690[_0x9a89('0x19')]==='undefined';var _0x1452cf=_0x5c5fdd[_0x9a89('0x1a')];var _0x304943=_0x112846?0x0:_0x44c690[_0x9a89('0x17')];var _0x4d549f=_0x112846?_0x5c5fdd[_0x9a89('0x1a')]:_0x44c690[_0x9a89('0x17')]+_0x44c690[_0x9a89('0x19')];var _0x303ca2;if(_0x4d549f>=_0x1452cf){_0x4d549f=_0x1452cf;_0x303ca2=0xc8;}else{_0x303ca2=0xce;}_0x492981[_0x9a89('0x16')](_0x303ca2);return _0x492981['set'](_0x9a89('0x1b'),_0x304943+'-'+_0x4d549f+'/'+_0x1452cf)[_0x9a89('0x1c')](_0x5c5fdd);}return null;};}function patchUpdates(_0x11f227){return function(_0x15ba8e){try{jsonpatch[_0x9a89('0x1d')](_0x15ba8e,_0x11f227,!![]);}catch(_0x7dec8e){return BPromise['reject'](_0x7dec8e);}return _0x15ba8e[_0x9a89('0x1e')]();};}function saveUpdates(_0x38df42,_0x3d4681){return function(_0x52954a){if(_0x52954a){return _0x52954a['update'](_0x38df42)[_0x9a89('0x1f')](function(_0x399a1f){return _0x399a1f;});}return null;};}function removeEntity(_0xb660f4,_0x10668a){return function(_0x529748){if(_0x529748){return _0x529748['destroy']()[_0x9a89('0x1f')](function(){_0xb660f4[_0x9a89('0x16')](0xcc)[_0x9a89('0x20')]();});}};}function handleEntityNotFound(_0x5661e3,_0x16b20b){return function(_0x36ec79){if(!_0x36ec79){_0x5661e3[_0x9a89('0x21')](0x194);}return _0x36ec79;};}function handleError(_0x5844d6,_0x1bc17e){_0x1bc17e=_0x1bc17e||0x1f4;return function(_0x2d955b){logger['error'](_0x2d955b['stack']);if(_0x2d955b['name']){delete _0x2d955b[_0x9a89('0x22')];}_0x5844d6[_0x9a89('0x16')](_0x1bc17e)['send'](_0x2d955b);};}function getInteractionUsers(_0xa9fb26,_0x52b782){return new BPromise(function(_0x22a548,_0x2e3452){try{if(_0x52b782[_0xa9fb26['id']]){_0xa9fb26[_0x9a89('0x23')]=_[_0x9a89('0x24')](_0x52b782[_0xa9fb26['id']],function(_0xf8ca68){return{'id':_0xf8ca68['id'],'fullname':_0xf8ca68['fullname']};});}}catch(_0x3d1e41){_0x2e3452(_0x3d1e41);}_0x22a548(_0xa9fb26);});}function getInteractionTags(_0x447b0d,_0x1dbf74){return new BPromise(function(_0x2b6fcc,_0x4dec03){try{if(_0x447b0d[_0x9a89('0x25')]){_0x447b0d[_0x9a89('0x26')]=[];_0x447b0d[_0x9a89('0x25')][_0x9a89('0x27')](',')[_0x9a89('0x28')](function(_0x27e345){_0x447b0d[_0x9a89('0x26')][_0x9a89('0x29')](_0x1dbf74[_0x27e345]);});}delete _0x447b0d[_0x9a89('0x25')];}catch(_0x1acb05){_0x4dec03(_0x1acb05);}_0x2b6fcc(_0x447b0d);});}function updateFaxInteraction(_0x2383f3,_0x4e2156,_0x454264){return new BPromise(function(_0x2743ed,_0x11c111){return getInteractionUsers(_0x2383f3,_0x454264)[_0x9a89('0x1f')](function(_0x423cc1){return getInteractionTags(_0x423cc1,_0x4e2156);})[_0x9a89('0x1f')](function(_0x1c43b2){return getStateInteraction(_0x1c43b2);})[_0x9a89('0x1f')](function(_0x3150f1){_0x2743ed(_0x3150f1);})[_0x9a89('0x2a')](function(_0x30f837){_0x11c111(_0x30f837);});});}function getStateInteraction(_0x5563d5){return new BPromise(function(_0x4ca6e5){_0x5563d5['waiting']=0x0;_0x5563d5[_0x9a89('0x2b')]=0x0;_0x5563d5['answered']=0x0;_0x5563d5[_0x9a89('0x2c')]=0x0;_0x5563d5[_0x9a89('0x2d')]=0x0;if(!_0x5563d5[_0x9a89('0x2e')]&&!_0x5563d5[_0x9a89('0x2f')]){_0x5563d5[_0x9a89('0x30')]+=0x1;}if(!_0x5563d5['closed']&&_0x5563d5[_0x9a89('0x2f')]){_0x5563d5[_0x9a89('0x2b')]+=0x1;if(_0x5563d5[_0x9a89('0x30')]){_0x5563d5['waiting']-=0x1;}}if(_0x5563d5['closed']&&_0x5563d5[_0x9a89('0x2f')]){_0x5563d5[_0x9a89('0x31')]+=0x1;if(_0x5563d5[_0x9a89('0x2b')]){_0x5563d5['talking']-=0x1;}}if(_0x5563d5[_0x9a89('0x2e')]&&!_0x5563d5[_0x9a89('0x2f')]){_0x5563d5[_0x9a89('0x2c')]+=0x1;if(_0x5563d5[_0x9a89('0x30')]){_0x5563d5[_0x9a89('0x30')]-=0x1;}}_0x5563d5['total']+=0x1;_0x4ca6e5(_0x5563d5);});}exports[_0x9a89('0x32')]=function(_0x538b72,_0x532c59){var _0x3cb7a6={},_0x7d173a={},_0x1c7e75={'count':0x0,'rows':[]};var _0x398219=_[_0x9a89('0x24')](db[_0x9a89('0x33')][_0x9a89('0x34')],function(_0x2946a0){return{'name':_0x2946a0[_0x9a89('0x35')],'type':_0x2946a0['type'][_0x9a89('0x36')]};});_0x7d173a['model']=_[_0x9a89('0x24')](_0x398219,'name');_0x7d173a['query']=_[_0x9a89('0x37')](_0x538b72[_0x9a89('0x38')]);_0x7d173a[_0x9a89('0x39')]=_[_0x9a89('0x3a')](_0x7d173a[_0x9a89('0x3b')],_0x7d173a['query']);_0x3cb7a6[_0x9a89('0x3c')]=_[_0x9a89('0x3a')](_0x7d173a[_0x9a89('0x3b')],qs['fields'](_0x538b72['query'][_0x9a89('0x3d')]));_0x3cb7a6['attributes']=_0x3cb7a6['attributes'][_0x9a89('0x3e')]?_0x3cb7a6['attributes']:_0x7d173a[_0x9a89('0x3b')];if(!_0x538b72[_0x9a89('0x38')][_0x9a89('0x3f')](_0x9a89('0x40'))){_0x3cb7a6[_0x9a89('0x19')]=qs[_0x9a89('0x19')](_0x538b72[_0x9a89('0x38')][_0x9a89('0x19')]);_0x3cb7a6[_0x9a89('0x17')]=qs['offset'](_0x538b72[_0x9a89('0x38')][_0x9a89('0x17')]);}_0x3cb7a6['order']=qs[_0x9a89('0x41')](_0x538b72[_0x9a89('0x38')][_0x9a89('0x41')]);_0x3cb7a6['where']=qs['filters'](_['pick'](_0x538b72[_0x9a89('0x38')],_0x7d173a[_0x9a89('0x39')]),_0x398219);var _0x443cd6=[];var _0x224307=squel[_0x9a89('0x42')]()['field']('id')[_0x9a89('0x43')](_0x9a89('0x22'))['field']('color')['from']('tools_tags');var _0x36ecf4=squel[_0x9a89('0x42')]()[_0x9a89('0x43')](_0x9a89('0x44'))['field'](_0x9a89('0x45'))[_0x9a89('0x43')]('ui.FaxInteractionId')[_0x9a89('0x46')](_0x9a89('0x47'),'ui')[_0x9a89('0x48')](_0x9a89('0x49'),'u',_0x9a89('0x4a'));var _0x28ca6c=squel[_0x9a89('0x42')]()[_0x9a89('0x46')](_0x9a89('0x4b'),'i')['left_join'](_0x9a89('0x4c'),'c',_0x9a89('0x4d'))[_0x9a89('0x48')](_0x9a89('0x49'),'o',_0x9a89('0x4e'))[_0x9a89('0x48')](_0x9a89('0x4f'),'a','a.id\x20=\x20i.FaxAccountId')[_0x9a89('0x48')](_0x9a89('0x50'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x9a89('0x48')]('fax_interaction_has_tags','it',_0x9a89('0x51'))['left_join'](_0x9a89('0x52'),'t',_0x9a89('0x53'));var _0x809994=squel[_0x9a89('0x54')]();var _0x176224=[];var _0xaa3147=squel['expr']();var _0x9be052;if(_0x538b72[_0x9a89('0x38')]['search']){_0x9be052=as['parseSearch'](_0x538b72['query'][_0x9a89('0x55')]);var _0x2a8d06=_0x9be052[_0x9a89('0x56')];for(var _0x367561=0x0;_0x367561<_0x9be052[_0x9a89('0x57')][_0x9a89('0x3e')];_0x367561++){var _0x3387d7=_0x9be052['conditions'][_0x367561];var _0x4d7726='i';var _0x2e42a1=_[_0x9a89('0x58')](_0x398219,['name',_0x3387d7[_0x9a89('0x43')]]);if(!_0x2e42a1){switch(_0x3387d7[_0x9a89('0x43')]){case _0x9a89('0x59'):if(_0x3387d7[_0x9a89('0x5a')]==0x1){_0x28ca6c[_0x9a89('0x5b')]('`'+_0x3387d7['field']+'`\x20=\x200');}else{_0x28ca6c[_0x9a89('0x5b')]('`'+_0x3387d7[_0x9a89('0x43')]+'`\x20>\x200');}break;case _0x9a89('0x5c'):if(_0x3387d7[_0x9a89('0x5d')]===_0x9a89('0x5e')){if(_0x3387d7[_0x9a89('0x5a')][_0x9a89('0x27')]('\x20')[_0x9a89('0x3e')]>0x1){_0x809994[_0x2a8d06]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9a89('0x5f')](_0x3387d7[_0x9a89('0x5a')]),null);}else{var _0x20b94a='%'+_0x3387d7['value']+'%';_0x809994[_0x2a8d06](_0x9a89('0x60'),_0x20b94a,_0x20b94a,_0x20b94a);}}else{_0x2e42a1=_[_0x9a89('0x58')](_0x398219,[_0x9a89('0x22'),_0x9a89('0x61')]);_0x3387d7[_0x9a89('0x43')]=_0x9a89('0x61');_0x50b69d=as['buildExpression'](_0x4d7726,_0x2e42a1['type'],_0x3387d7);_0x809994[_0x2a8d06](_0x50b69d[_0x9a89('0x62')],_0x50b69d['value'][_0x9a89('0x63')],_0x50b69d[_0x9a89('0x5a')]['end']);}break;case _0x9a89('0x64'):var _0x1bf866=_0x3387d7[_0x9a89('0x5a')][_0x9a89('0x27')](',')[_0x9a89('0x24')](function(_0x3135a0){return Number(_0x3135a0);});_0x1bf866[_0x9a89('0x28')](function(_0x49f16f){_0xaa3147['or'](_0x9a89('0x65'),'%,'+_0x49f16f+',%');});_0x176224=_['union'](_0x176224,_0x1bf866);break;case _0x9a89('0x66'):if(_0x3387d7['operator']===_0x9a89('0x5e')){_0x809994[_0x2a8d06](_0x9a89('0x67'),'%'+_0x3387d7[_0x9a89('0x5a')]+'%',null);}else{_0x2e42a1=_[_0x9a89('0x58')](_0x398219,[_0x9a89('0x22'),_0x9a89('0x2f')]);_0x3387d7[_0x9a89('0x43')]=_0x9a89('0x2f');_0x50b69d=as[_0x9a89('0x68')](_0x4d7726,_0x2e42a1[_0x9a89('0x69')],_0x3387d7);_0x809994[_0x2a8d06](_0x50b69d[_0x9a89('0x62')],_0x50b69d['value'][_0x9a89('0x63')],_0x50b69d[_0x9a89('0x5a')]['end']);}break;case'body':_0x50b69d=as[_0x9a89('0x68')]('me',null,_0x3387d7);_0x809994[_0x2a8d06](_0x50b69d[_0x9a89('0x62')],_0x50b69d[_0x9a89('0x5a')]['start'],_0x50b69d['value'][_0x9a89('0x20')]);break;}}else{var _0x50b69d=as[_0x9a89('0x68')](_0x4d7726,_0x2e42a1['type'],_0x3387d7);_0x809994[_0x2a8d06](_0x50b69d[_0x9a89('0x62')],_0x50b69d[_0x9a89('0x5a')][_0x9a89('0x63')],_0x50b69d[_0x9a89('0x5a')]['end']);}}}else{var _0x44907f=_(_0x538b72[_0x9a89('0x38')])['keys']()[_0x9a89('0x24')](function(_0x788ef9){return _[_0x9a89('0x6a')](_0x398219,[_0x9a89('0x22'),_0x788ef9])?_0x788ef9:undefined;})[_0x9a89('0x6b')]()[_0x9a89('0x5a')]();if(!_[_0x9a89('0x6c')](_0x44907f)){_0x44907f[_0x9a89('0x28')](function(_0xa29ab5){if(_0xa29ab5===_0x9a89('0x6d')){_0x28ca6c[_0x9a89('0x6e')](_0x9a89('0x6f'),[][_0x9a89('0x70')](_0x538b72[_0x9a89('0x38')][_0xa29ab5]));}else if(_0xa29ab5===_0x9a89('0x71')){var _0x55c21f=JSON['parse'](_0x538b72['query'][_0xa29ab5])[_0x9a89('0x72')];var _0x4249d5=JSON['parse'](_0x538b72[_0x9a89('0x38')][_0xa29ab5])[_0x9a89('0x73')];_0x28ca6c['where'](_0x9a89('0x74'),_0x55c21f,_0x4249d5);}else{if(_0x538b72[_0x9a89('0x38')][_0xa29ab5]==='null'){_0x28ca6c[_0x9a89('0x6e')]('i.'+_0xa29ab5+_0x9a89('0x75'));}else{_0x28ca6c[_0x9a89('0x6e')]('i.'+_0xa29ab5+'\x20=\x20?',_0x538b72['query'][_0xa29ab5]);}}});}if(_0x538b72[_0x9a89('0x38')][_0x9a89('0x76')]){if(_0x538b72['query']['read']==0x1){_0x28ca6c['having'](_0x9a89('0x77'));}else{_0x28ca6c[_0x9a89('0x5b')](_0x9a89('0x78'));}}if(_0x538b72['query'][_0x9a89('0x79')]){_0x176224=_['isArray'](_0x538b72[_0x9a89('0x38')][_0x9a89('0x79')])?_0x538b72[_0x9a89('0x38')]['tag']:new Array(_0x538b72[_0x9a89('0x38')][_0x9a89('0x79')]);_0x176224[_0x9a89('0x28')](function(_0x8a9ef8){_0xaa3147['or'](_0x9a89('0x65'),'%,'+_0x8a9ef8+',%');});}if(_0x538b72[_0x9a89('0x38')][_0x9a89('0x7a')]){var _0x356915=_0x538b72[_0x9a89('0x38')]['filter'][_0x9a89('0x7b')]('\x5c','\x5c\x5c')[_0x9a89('0x7b')](/'/g,'\x27\x27');if(qs[_0x9a89('0x7c')](_0x356915)){_0x809994['or'](_0x9a89('0x7d'),_0x356915+'%')['or'](_0x9a89('0x7e'),_0x356915+'%');}_0x809994['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x356915+'%');}}_0x28ca6c[_0x9a89('0x6e')](_0x809994);_0x28ca6c[_0x9a89('0x7f')](_0x9a89('0x80'));var _0xa81dd0={'type':db['Sequelize'][_0x9a89('0x81')][_0x9a89('0x82')],'raw':!![]};var _0x413bfd=_0x28ca6c[_0x9a89('0x83')]();_0x413bfd[_0x9a89('0x43')]('i.id');_0x413bfd[_0x9a89('0x43')](_0x9a89('0x84'),_0x9a89('0x59'));if(_0x3cb7a6[_0x9a89('0x85')]){_0x3cb7a6['order'][_0x9a89('0x28')](function(_0x20b694){var _0x50bb30=_0x20b694[0x0]===_0x9a89('0x86')?_0x20b694[0x0]:'i.'+_0x20b694[0x0];_0x28ca6c[_0x9a89('0x85')](_0x50bb30,_0x20b694[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9a89('0x6c')](_0x176224)){_0x28ca6c[_0x9a89('0x5b')](_0xaa3147);_0x413bfd[_0x9a89('0x6e')]('t.id\x20IN\x20?',_0x176224);}BPromise[_0x9a89('0x87')]()[_0x9a89('0x1f')](function(){if(!_0x9be052){if(_0x538b72[_0x9a89('0x38')][_0x9a89('0x6d')])return;_0x413bfd[_0x9a89('0x6e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x28ca6c[_0x9a89('0x6e')](_0x9a89('0x88'));return;}if(_0x538b72[_0x9a89('0x89')][_0x9a89('0x8a')]!==_0x9a89('0x8b'))return;return _0x538b72[_0x9a89('0x89')][_0x9a89('0x8c')]({'attributes':['id'],'raw':!![]})[_0x9a89('0x1f')](function(_0x5d3218){if(_['isEmpty'](_0x5d3218)){_0x413bfd[_0x9a89('0x6e')](_0x9a89('0x8d'));_0x28ca6c[_0x9a89('0x6e')](_0x9a89('0x8d'));}else{_0x413bfd[_0x9a89('0x6e')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x5d3218,'id'));_0x28ca6c[_0x9a89('0x6e')](_0x9a89('0x6f'),_['map'](_0x5d3218,'id'));}});})[_0x9a89('0x1f')](function(){if(_0x538b72[_0x9a89('0x89')][_0x9a89('0x8a')]===_0x9a89('0x8b')&&!_0x9be052&&!_0x538b72[_0x9a89('0x38')][_0x9a89('0x6d')])return[];return db['sequelize']['query'](_0x413bfd[_0x9a89('0x8e')](),_0xa81dd0);})['then'](function(_0x1f0b83){_0x1c7e75[_0x9a89('0x1a')]=_0x1f0b83[_0x9a89('0x3e')];if(_0x1c7e75[_0x9a89('0x1a')]===0x0)return[];return db[_0x9a89('0x8f')][_0x9a89('0x38')](_0x224307['toString'](),_0xa81dd0)['then'](function(_0x5db3b5){_0x443cd6=_[_0x9a89('0x90')](_0x5db3b5,'id');_0xa81dd0=_['merge'](_0xa81dd0,{'model':db[_0x9a89('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x538b72[_0x9a89('0x38')][_0x9a89('0x3d')]){_0x3cb7a6[_0x9a89('0x3c')][_0x9a89('0x28')](function(_0x1e04a4){_0x28ca6c[_0x9a89('0x43')]('i.'+_0x1e04a4);});}else{_0x28ca6c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9a89('0x59'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x91'),'Account.key');_0x28ca6c[_0x9a89('0x43')]('a.mandatoryDisposition',_0x9a89('0x92'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x93'),_0x9a89('0x86'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x94'));_0x28ca6c[_0x9a89('0x43')]('c.firstName',_0x9a89('0x95'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x96'),'Contact.lastName');_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x97'),'Contact.email');_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x98'),_0x9a89('0x99'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x9a'),_0x9a89('0x9b'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x9c'),_0x9a89('0x9d'));_0x28ca6c[_0x9a89('0x43')]('o.fullname',_0x9a89('0x9e'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0x9f'),_0x9a89('0xa0'));_0x28ca6c[_0x9a89('0x43')](_0x9a89('0xa1'),_0x9a89('0x25'));}if(_0x3cb7a6[_0x9a89('0x19')])_0x28ca6c[_0x9a89('0x19')](_0x3cb7a6[_0x9a89('0x19')]);if(_0x3cb7a6[_0x9a89('0x17')])_0x28ca6c['offset'](_0x3cb7a6[_0x9a89('0x17')]);return db[_0x9a89('0x8f')][_0x9a89('0x38')](_0x28ca6c['toString'](),_0xa81dd0);})['then'](function(_0x272680){if(_0x272680['length']>0x0)_0x36ecf4[_0x9a89('0x6e')](_0x9a89('0xa2'),_[_0x9a89('0x24')](_0x272680,'id'));return db[_0x9a89('0x8f')]['query'](_0x36ecf4['toString'](),_0xa81dd0)['then'](function(_0x4a98f0){var _0x1d4942=_[_0x9a89('0xa3')](_0x4a98f0,_0x9a89('0xa4'));var _0x22271=[];_0x272680['forEach'](function(_0x227d8a){_0x22271['push'](updateFaxInteraction(_0x227d8a,_0x443cd6,_0x1d4942));});return BPromise[_0x9a89('0xa5')](_0x22271);});});})[_0x9a89('0x1f')](function(_0x47aefb){_0x1c7e75[_0x9a89('0xa6')]=_0x47aefb;return _0x1c7e75;})[_0x9a89('0x1f')](respondWithFilteredResult(_0x532c59,_0x3cb7a6))[_0x9a89('0x2a')](handleError(_0x532c59,null));};exports[_0x9a89('0xa7')]=function(_0x2bbc44,_0x2707dd){var _0x49ecff={'raw':![],'where':{'id':_0x2bbc44[_0x9a89('0xa8')]['id']}},_0x43537c={};_0x43537c['model']=_[_0x9a89('0x37')](db['FaxInteraction'][_0x9a89('0x34')]);_0x43537c[_0x9a89('0x38')]=_['keys'](_0x2bbc44[_0x9a89('0x38')]);_0x43537c[_0x9a89('0x39')]=_[_0x9a89('0x3a')](_0x43537c[_0x9a89('0x3b')],_0x43537c['query']);_0x49ecff[_0x9a89('0x3c')]=_[_0x9a89('0x3a')](_0x43537c[_0x9a89('0x3b')],qs['fields'](_0x2bbc44[_0x9a89('0x38')][_0x9a89('0x3d')]));_0x49ecff[_0x9a89('0x3c')]=_0x49ecff[_0x9a89('0x3c')][_0x9a89('0x3e')]?_0x49ecff[_0x9a89('0x3c')]:_0x43537c[_0x9a89('0x3b')];if(_0x2bbc44['query'][_0x9a89('0xa9')]){_0x49ecff[_0x9a89('0xaa')]=[{'all':!![]}];}_0x49ecff=_[_0x9a89('0xab')]({},_0x49ecff,_0x2bbc44[_0x9a89('0xac')]);return db[_0x9a89('0x33')][_0x9a89('0x58')](_0x49ecff)[_0x9a89('0x1f')](handleEntityNotFound(_0x2707dd,null))[_0x9a89('0x1f')](respondWithResult(_0x2707dd,null))[_0x9a89('0x2a')](handleError(_0x2707dd,null));};exports[_0x9a89('0xad')]=function(_0x4c109b,_0x2dc387){return db[_0x9a89('0x33')][_0x9a89('0xad')](_0x4c109b['body'],{})[_0x9a89('0x1f')](respondWithResult(_0x2dc387,0xc9))[_0x9a89('0x2a')](handleError(_0x2dc387,null));};exports[_0x9a89('0xae')]=function(_0x1a937b,_0x55264a){if(_0x1a937b[_0x9a89('0xaf')]['id']){delete _0x1a937b[_0x9a89('0xaf')]['id'];}return db[_0x9a89('0x33')][_0x9a89('0x58')]({'where':{'id':_0x1a937b[_0x9a89('0xa8')]['id']}})[_0x9a89('0x1f')](handleEntityNotFound(_0x55264a,null))[_0x9a89('0x1f')](saveUpdates(_0x1a937b['body'],null))[_0x9a89('0x1f')](respondWithResult(_0x55264a,null))['catch'](handleError(_0x55264a,null));};exports[_0x9a89('0xb0')]=function(_0x82d849,_0xb07638){return db[_0x9a89('0x33')]['find']({'where':{'id':_0x82d849[_0x9a89('0xa8')]['id']}})[_0x9a89('0x1f')](handleEntityNotFound(_0xb07638,null))[_0x9a89('0x1f')](removeEntity(_0xb07638,null))[_0x9a89('0x2a')](handleError(_0xb07638,null));};exports['describe']=function(_0x28489b,_0x16f920){return db[_0x9a89('0x33')][_0x9a89('0xb1')]()[_0x9a89('0x1f')](respondWithResult(_0x16f920,null))[_0x9a89('0x2a')](handleError(_0x16f920,null));};exports[_0x9a89('0xb2')]=function(_0x179262,_0x228e22,_0x1ca862){return db['FaxMessage'][_0x9a89('0x58')]({'where':{'id':_0x179262['params']['id']}})[_0x9a89('0x1f')](handleEntityNotFound(_0x228e22,null))[_0x9a89('0x1f')](function(_0x487330){if(_0x487330){return _0x487330['addMessage'](_0x179262[_0x9a89('0xaf')][_0x9a89('0xb3')],_[_0x9a89('0xb4')](_0x179262['body'],['ids','id'])||{});}})[_0x9a89('0x1f')](respondWithResult(_0x228e22,null))[_0x9a89('0x2a')](handleError(_0x228e22,null));};exports[_0x9a89('0xb5')]=function(_0x14657f,_0x3da3f5,_0x1632af){var _0x2ea22b={'raw':![],'where':{}};var _0x3ae07c={};var _0x33baca={'count':0x0,'rows':[]};return db[_0x9a89('0x33')][_0x9a89('0xb6')]({'where':{'id':_0x14657f[_0x9a89('0xa8')]['id']}})[_0x9a89('0x1f')](handleEntityNotFound(_0x3da3f5,null))[_0x9a89('0x1f')](function(_0x5a7474){if(_0x5a7474){_0x3ae07c[_0x9a89('0x3b')]=_[_0x9a89('0x37')](db[_0x9a89('0xb7')][_0x9a89('0x34')]);_0x3ae07c[_0x9a89('0x38')]=_[_0x9a89('0x37')](_0x14657f[_0x9a89('0x38')]);_0x3ae07c[_0x9a89('0x39')]=_['intersection'](_0x3ae07c[_0x9a89('0x3b')],_0x3ae07c[_0x9a89('0x38')]);_0x2ea22b[_0x9a89('0x3c')]=_[_0x9a89('0x3a')](_0x3ae07c[_0x9a89('0x3b')],qs[_0x9a89('0x3d')](_0x14657f[_0x9a89('0x38')][_0x9a89('0x3d')]));_0x2ea22b[_0x9a89('0x3c')]=_0x2ea22b[_0x9a89('0x3c')][_0x9a89('0x3e')]?_0x2ea22b['attributes']:_0x3ae07c[_0x9a89('0x3b')];if(!_0x14657f['query']['hasOwnProperty'](_0x9a89('0x40'))){_0x2ea22b['limit']=qs[_0x9a89('0x19')](_0x14657f[_0x9a89('0x38')]['limit']);_0x2ea22b['offset']=qs[_0x9a89('0x17')](_0x14657f[_0x9a89('0x38')][_0x9a89('0x17')]);}_0x2ea22b[_0x9a89('0x85')]=qs[_0x9a89('0x41')](_0x14657f[_0x9a89('0x38')]['sort']);_0x2ea22b[_0x9a89('0x6e')]=qs[_0x9a89('0x39')](_[_0x9a89('0xb8')](_0x14657f[_0x9a89('0x38')],_0x3ae07c[_0x9a89('0x39')]));_0x2ea22b[_0x9a89('0x6e')][_0x9a89('0xa4')]=_0x5a7474['id'];if(_0x14657f[_0x9a89('0x38')][_0x9a89('0x7a')]){_0x2ea22b['where']=_[_0x9a89('0xab')](_0x2ea22b['where'],{'$or':_[_0x9a89('0x24')](_0x2ea22b['attributes'],function(_0x5c7068){var _0x883ee4={};_0x883ee4[_0x5c7068]={'$like':'%'+_0x14657f[_0x9a89('0x38')][_0x9a89('0x7a')]+'%'};return _0x883ee4;})});}if(_0x14657f[_0x9a89('0x38')][_0x9a89('0x72')]){var _0x41bb26=_0x14657f['query'][_0x9a89('0x72')][_0x9a89('0x27')](',');var _0x4c5815={};_0x4c5815[_0x41bb26[0x0]]={'$gte':moment(_0x41bb26[0x1])[_0x9a89('0xb9')](_0x9a89('0xba'))};_0x2ea22b['where']=_[_0x9a89('0xab')](_0x2ea22b['where'],_0x4c5815);}_0x2ea22b=_[_0x9a89('0xab')]({},_0x2ea22b,_0x14657f[_0x9a89('0xac')]);return db[_0x9a89('0xb7')][_0x9a89('0x1a')]({'where':_0x2ea22b['where']})[_0x9a89('0x1f')](function(_0x1e79d3){_0x33baca[_0x9a89('0x1a')]=_0x1e79d3;if(_0x14657f['query'][_0x9a89('0xa9')]){_0x2ea22b[_0x9a89('0xaa')]=[{'all':!![]}];}return db['FaxMessage'][_0x9a89('0xbb')](_0x2ea22b);})[_0x9a89('0x1f')](function(_0x1a6bd1){_0x33baca[_0x9a89('0xa6')]=_0x1a6bd1;return _0x33baca;});}})[_0x9a89('0x1f')](respondWithFilteredResult(_0x3da3f5,_0x2ea22b))[_0x9a89('0x2a')](handleError(_0x3da3f5,null));};exports[_0x9a89('0xbc')]=function(_0x335648,_0x5dacc2,_0x445b18){return db[_0x9a89('0x33')][_0x9a89('0x58')]({'where':{'id':_0x335648[_0x9a89('0xa8')]['id']}})[_0x9a89('0x1f')](handleEntityNotFound(_0x5dacc2,null))[_0x9a89('0x1f')](function(_0x55e962){if(_0x55e962){return _0x55e962['setTags'](_0x335648[_0x9a89('0xaf')]['ids'],_[_0x9a89('0xb4')](_0x335648[_0x9a89('0xaf')],[_0x9a89('0xb3'),'id'])||{})[_0x9a89('0xbd')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x335648[_0x9a89('0xaf')][_0x9a89('0xb3')]}});})[_0x9a89('0x1f')](function(_0x833eaa){socket['emit'](_0x9a89('0xbe'),{'id':Number(_0x335648[_0x9a89('0xa8')]['id']),'tags':_0x833eaa||[]});return{'id':Number(_0x335648['params']['id']),'tags':_0x833eaa||[]};});}})[_0x9a89('0x1f')](respondWithResult(_0x5dacc2,null))[_0x9a89('0x2a')](handleError(_0x5dacc2,null));};exports['removeTags']=function(_0x2f2799,_0x79d854,_0x2692bf){return db['FaxInteraction'][_0x9a89('0x58')]({'where':{'id':_0x2f2799[_0x9a89('0xa8')]['id']}})[_0x9a89('0x1f')](handleEntityNotFound(_0x79d854,null))[_0x9a89('0x1f')](function(_0x220aad){if(_0x220aad){return _0x220aad['removeTags'](_0x2f2799['query'][_0x9a89('0xb3')]);}})[_0x9a89('0x1f')](respondWithStatusCode(_0x79d854,null))[_0x9a89('0x2a')](handleError(_0x79d854,null));};exports['download']=function(_0x3c73e1,_0x2f889c){var _0x5986a1=moment()[_0x9a89('0xbf')]()[_0x9a89('0x8e')]();var _0xf6e3fd=path[_0x9a89('0xc0')](config[_0x9a89('0xc1')],_0x9a89('0xc2'),_0x9a89('0xc3'),_0x9a89('0xc4'));var _0x459776=path['join'](config[_0x9a89('0xc1')],_0x9a89('0xc2'),_0x9a89('0xc3'),_0x9a89('0xc5'));var _0x19d4d2=path[_0x9a89('0xc0')](_0xf6e3fd,_0x5986a1);var _0x1a5a6d=util['format'](_0x9a89('0xc6'),_0x3c73e1[_0x9a89('0xa8')]['id'],_0x5986a1);var _0xc80497=path[_0x9a89('0xc0')](_0xf6e3fd,_0x1a5a6d);var _0x2ca583=[];_0x2ca583['push']({'model':db[_0x9a89('0xc7')],'as':_0x9a89('0xc7'),'raw':!![]});var _0x2b1823=[{'model':db['FaxMessage'],'as':_0x9a89('0xc8'),'attributes':['id',_0x9a89('0xaf'),_0x9a89('0x71')],'include':_0x2ca583}];return db['FaxInteraction'][_0x9a89('0x58')]({'where':{'id':_0x3c73e1[_0x9a89('0xa8')]['id']},'include':_0x2b1823})[_0x9a89('0x1f')](handleEntityNotFound(_0x2f889c,null))[_0x9a89('0x1f')](function(_0x1092cf){if(_0x1092cf&&_0x1092cf['Messages']){var _0x2d1fa7=_0x1092cf['get']({'plain':!![]});fs[_0x9a89('0xc9')](_0x19d4d2);for(var _0x122363=0x0;_0x122363<_0x2d1fa7[_0x9a89('0xc8')][_0x9a89('0x3e')];_0x122363++){var _0x3f9a0f=_0x2d1fa7[_0x9a89('0xc8')][_0x122363][_0x9a89('0xc7')];if(_0x3f9a0f){var _0x1f16f5=path[_0x9a89('0xc0')](_0x459776,_0x3f9a0f[_0x9a89('0xca')]);if(fs[_0x9a89('0xcb')](_0x1f16f5)){fs['createReadStream'](_0x1f16f5)[_0x9a89('0xcc')](fs[_0x9a89('0xcd')](path[_0x9a89('0xc0')](_0x19d4d2,_0x3f9a0f['basename'])));}}}return BPromise[_0x9a89('0x87')]()[_0x9a89('0x1f')](function(){return new BPromise(function(_0xe44c76,_0x7fa4ee){zipdir(_0x19d4d2,{'saveTo':_0xc80497},function(_0x1fafb5,_0x2ed7fc){if(_0x1fafb5)return _0x7fa4ee(_0x1fafb5);return _0xe44c76(_0x2ed7fc);});})['then'](function(){return new BPromise(function(_0x562b8b,_0x58b4d0){rimraf(_0x19d4d2,function(_0x479a35){if(_0x479a35)_0x58b4d0(_0x479a35);return _0x562b8b();});});})[_0x9a89('0x1f')](function(){return _0x2f889c['download'](_0xc80497,_0x1a5a6d,function(_0x259877){if(_0x259877){console[_0x9a89('0xce')]('err',_0x259877);}else{fs[_0x9a89('0xcf')](_0xc80497);}});});});}else{return _0x2f889c[_0x9a89('0x21')](0xc8);}})[_0x9a89('0x2a')](handleError(_0x2f889c,null));}; \ No newline at end of file +var _0x22f4=['format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','join','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../mysqldb','redis','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','send','Users','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','FaxInteraction','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\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)','order','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','a.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','c.firstName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','show','includeAll','include','merge','options','create','body','describe','addMessage','ids','getMessages','findOne','params','FaxMessage','pick'];(function(_0x2d1772,_0x37a476){var _0x330834=function(_0x41298c){while(--_0x41298c){_0x2d1772['push'](_0x2d1772['shift']());}};_0x330834(++_0x37a476);}(_0x22f4,0x1df));var _0x422f=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x22f4[_0xcfc44];return _0x307a25;};'use strict';var emlformat=require(_0x422f('0x0'));var rimraf=require(_0x422f('0x1'));var zipdir=require(_0x422f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x422f('0x3'));var moment=require(_0x422f('0x4'));var BPromise=require(_0x422f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x422f('0x6'));var sox=require('sox');var csv=require(_0x422f('0x7'));var ejs=require(_0x422f('0x8'));var fs=require('fs');var fs_extra=require(_0x422f('0x9'));var _=require(_0x422f('0xa'));var squel=require(_0x422f('0xb'));var crypto=require(_0x422f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x422f('0xd'));var toCsv=require(_0x422f('0x7'));var querystring=require(_0x422f('0xe'));var Papa=require(_0x422f('0xf'));var Redis=require(_0x422f('0x10'));var authService=require(_0x422f('0x11'));var qs=require(_0x422f('0x12'));var as=require(_0x422f('0x13'));var hardwareService=require(_0x422f('0x14'));var logger=require('../../config/logger')(_0x422f('0x15'));var utils=require(_0x422f('0x16'));var config=require(_0x422f('0x17'));var licenseUtil=require(_0x422f('0x18'));var db=require(_0x422f('0x19'))['db'];config[_0x422f('0x1a')]=_['defaults'](config[_0x422f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x422f('0x1b'))[_0x422f('0x1c')](socket);function respondWithStatusCode(_0x246a05,_0x487647){_0x487647=_0x487647||0xcc;return function(_0x2a6597){if(_0x2a6597){return _0x246a05[_0x422f('0x1d')](_0x487647);}return _0x246a05['status'](_0x487647)[_0x422f('0x1e')]();};}function respondWithResult(_0x3d0a18,_0x1f9594){_0x1f9594=_0x1f9594||0xc8;return function(_0x30e1fe){if(_0x30e1fe){return _0x3d0a18[_0x422f('0x1f')](_0x1f9594)[_0x422f('0x20')](_0x30e1fe);}};}function respondWithFilteredResult(_0x206b37,_0x1a743f){return function(_0x337b24){if(_0x337b24){var _0x1e159c=typeof _0x1a743f[_0x422f('0x21')]===_0x422f('0x22')&&typeof _0x1a743f['limit']===_0x422f('0x22');var _0x58219e=_0x337b24[_0x422f('0x23')];var _0x1e9bca=_0x1e159c?0x0:_0x1a743f[_0x422f('0x21')];var _0x6fc9a6=_0x1e159c?_0x337b24[_0x422f('0x23')]:_0x1a743f[_0x422f('0x21')]+_0x1a743f[_0x422f('0x24')];var _0x21aabd;if(_0x6fc9a6>=_0x58219e){_0x6fc9a6=_0x58219e;_0x21aabd=0xc8;}else{_0x21aabd=0xce;}_0x206b37[_0x422f('0x1f')](_0x21aabd);return _0x206b37['set'](_0x422f('0x25'),_0x1e9bca+'-'+_0x6fc9a6+'/'+_0x58219e)[_0x422f('0x20')](_0x337b24);}return null;};}function patchUpdates(_0x211c22){return function(_0x5ec02b){try{jsonpatch[_0x422f('0x26')](_0x5ec02b,_0x211c22,!![]);}catch(_0xe07b40){return BPromise[_0x422f('0x27')](_0xe07b40);}return _0x5ec02b['save']();};}function saveUpdates(_0x82a527,_0x22e1e5){return function(_0x549072){if(_0x549072){return _0x549072[_0x422f('0x28')](_0x82a527)[_0x422f('0x29')](function(_0xe766fd){return _0xe766fd;});}return null;};}function removeEntity(_0x3ab35c,_0xa32467){return function(_0x1f8141){if(_0x1f8141){return _0x1f8141[_0x422f('0x2a')]()[_0x422f('0x29')](function(){_0x3ab35c[_0x422f('0x1f')](0xcc)[_0x422f('0x1e')]();});}};}function handleEntityNotFound(_0x2694c0,_0x298b9b){return function(_0x2f3a1b){if(!_0x2f3a1b){_0x2694c0['sendStatus'](0x194);}return _0x2f3a1b;};}function handleError(_0x281870,_0x1c9f2c){_0x1c9f2c=_0x1c9f2c||0x1f4;return function(_0x5c4662){logger[_0x422f('0x2b')](_0x5c4662[_0x422f('0x2c')]);if(_0x5c4662['name']){delete _0x5c4662['name'];}_0x281870[_0x422f('0x1f')](_0x1c9f2c)[_0x422f('0x2d')](_0x5c4662);};}function getInteractionUsers(_0x6333e2,_0x2628fe){return new BPromise(function(_0x4351d2,_0x585a13){try{if(_0x2628fe[_0x6333e2['id']]){_0x6333e2[_0x422f('0x2e')]=_['map'](_0x2628fe[_0x6333e2['id']],function(_0x21d6d8){return{'id':_0x21d6d8['id'],'fullname':_0x21d6d8[_0x422f('0x2f')]};});}}catch(_0x306dfe){_0x585a13(_0x306dfe);}_0x4351d2(_0x6333e2);});}function getInteractionTags(_0xdd6243,_0x33c833){return new BPromise(function(_0x59b302,_0x235082){try{if(_0xdd6243[_0x422f('0x30')]){_0xdd6243[_0x422f('0x31')]=[];_0xdd6243[_0x422f('0x30')]['split'](',')[_0x422f('0x32')](function(_0x48cae4){_0xdd6243[_0x422f('0x31')][_0x422f('0x33')](_0x33c833[_0x48cae4]);});}delete _0xdd6243[_0x422f('0x30')];}catch(_0x26c090){_0x235082(_0x26c090);}_0x59b302(_0xdd6243);});}function updateFaxInteraction(_0x1c746d,_0x1fc073,_0x353f53){return new BPromise(function(_0x3c1c75,_0x18412f){return getInteractionUsers(_0x1c746d,_0x353f53)['then'](function(_0x2855f6){return getInteractionTags(_0x2855f6,_0x1fc073);})['then'](function(_0x237b42){return getStateInteraction(_0x237b42);})['then'](function(_0x10977b){_0x3c1c75(_0x10977b);})[_0x422f('0x34')](function(_0x193dd5){_0x18412f(_0x193dd5);});});}function getStateInteraction(_0x3f555c){return new BPromise(function(_0x29b34e){_0x3f555c[_0x422f('0x35')]=0x0;_0x3f555c[_0x422f('0x36')]=0x0;_0x3f555c[_0x422f('0x37')]=0x0;_0x3f555c[_0x422f('0x38')]=0x0;_0x3f555c[_0x422f('0x39')]=0x0;if(!_0x3f555c['closed']&&!_0x3f555c[_0x422f('0x3a')]){_0x3f555c[_0x422f('0x35')]+=0x1;}if(!_0x3f555c[_0x422f('0x3b')]&&_0x3f555c[_0x422f('0x3a')]){_0x3f555c['talking']+=0x1;if(_0x3f555c['waiting']){_0x3f555c[_0x422f('0x35')]-=0x1;}}if(_0x3f555c[_0x422f('0x3b')]&&_0x3f555c[_0x422f('0x3a')]){_0x3f555c[_0x422f('0x37')]+=0x1;if(_0x3f555c['talking']){_0x3f555c[_0x422f('0x36')]-=0x1;}}if(_0x3f555c[_0x422f('0x3b')]&&!_0x3f555c[_0x422f('0x3a')]){_0x3f555c[_0x422f('0x38')]+=0x1;if(_0x3f555c[_0x422f('0x35')]){_0x3f555c[_0x422f('0x35')]-=0x1;}}_0x3f555c[_0x422f('0x39')]+=0x1;_0x29b34e(_0x3f555c);});}exports[_0x422f('0x3c')]=function(_0x400f97,_0x43bd6d){var _0x275f25={},_0x40d3df={},_0xf1f31b={'count':0x0,'rows':[]};var _0x2b8047=_['map'](db[_0x422f('0x3d')][_0x422f('0x3e')],function(_0x336df3){return{'name':_0x336df3[_0x422f('0x3f')],'type':_0x336df3[_0x422f('0x40')][_0x422f('0x41')]};});_0x40d3df[_0x422f('0x42')]=_[_0x422f('0x43')](_0x2b8047,_0x422f('0x44'));_0x40d3df[_0x422f('0x45')]=_[_0x422f('0x46')](_0x400f97[_0x422f('0x45')]);_0x40d3df[_0x422f('0x47')]=_[_0x422f('0x48')](_0x40d3df['model'],_0x40d3df[_0x422f('0x45')]);_0x275f25[_0x422f('0x49')]=_[_0x422f('0x48')](_0x40d3df[_0x422f('0x42')],qs['fields'](_0x400f97[_0x422f('0x45')][_0x422f('0x4a')]));_0x275f25[_0x422f('0x49')]=_0x275f25[_0x422f('0x49')][_0x422f('0x4b')]?_0x275f25['attributes']:_0x40d3df[_0x422f('0x42')];if(!_0x400f97[_0x422f('0x45')][_0x422f('0x4c')](_0x422f('0x4d'))){_0x275f25[_0x422f('0x24')]=qs[_0x422f('0x24')](_0x400f97[_0x422f('0x45')][_0x422f('0x24')]);_0x275f25['offset']=qs['offset'](_0x400f97[_0x422f('0x45')][_0x422f('0x21')]);}_0x275f25['order']=qs[_0x422f('0x4e')](_0x400f97[_0x422f('0x45')][_0x422f('0x4e')]);_0x275f25[_0x422f('0x4f')]=qs['filters'](_['pick'](_0x400f97[_0x422f('0x45')],_0x40d3df[_0x422f('0x47')]),_0x2b8047);var _0x3e66d3=[];var _0xaae705=squel[_0x422f('0x50')]()[_0x422f('0x51')]('id')['field'](_0x422f('0x44'))[_0x422f('0x51')]('color')[_0x422f('0x52')](_0x422f('0x53'));var _0x382ae0=squel[_0x422f('0x50')]()[_0x422f('0x51')]('u.id')['field'](_0x422f('0x54'))['field'](_0x422f('0x55'))['from']('user_has_fax_interactions','ui')[_0x422f('0x56')](_0x422f('0x57'),'u',_0x422f('0x58'));var _0x1b9ca2=squel[_0x422f('0x50')]()['from'](_0x422f('0x59'),'i')[_0x422f('0x56')](_0x422f('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x422f('0x56')](_0x422f('0x57'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x422f('0x5b'),'a','a.id\x20=\x20i.FaxAccountId')[_0x422f('0x56')](_0x422f('0x5c'),'me',_0x422f('0x5d'))['left_join'](_0x422f('0x5e'),'it',_0x422f('0x5f'))[_0x422f('0x56')]('tools_tags','t',_0x422f('0x60'));var _0x49f4fd=squel['expr']();var _0x127b04=[];var _0x448489=squel[_0x422f('0x61')]();var _0x3184bf;if(_0x400f97[_0x422f('0x45')][_0x422f('0x62')]){_0x3184bf=as['parseSearch'](_0x400f97[_0x422f('0x45')][_0x422f('0x62')]);var _0x46a317=_0x3184bf['sqlOperator'];for(var _0x13098c=0x0;_0x13098c<_0x3184bf[_0x422f('0x63')][_0x422f('0x4b')];_0x13098c++){var _0x1de5ee=_0x3184bf[_0x422f('0x63')][_0x13098c];var _0x4b7602='i';var _0x190668=_[_0x422f('0x64')](_0x2b8047,[_0x422f('0x44'),_0x1de5ee[_0x422f('0x51')]]);if(!_0x190668){switch(_0x1de5ee['field']){case _0x422f('0x65'):if(_0x1de5ee['value']==0x1){_0x1b9ca2[_0x422f('0x66')]('`'+_0x1de5ee[_0x422f('0x51')]+_0x422f('0x67'));}else{_0x1b9ca2[_0x422f('0x66')]('`'+_0x1de5ee[_0x422f('0x51')]+_0x422f('0x68'));}break;case _0x422f('0x69'):if(_0x1de5ee[_0x422f('0x6a')]===_0x422f('0x6b')){if(_0x1de5ee[_0x422f('0x6c')][_0x422f('0x6d')]('\x20')['length']>0x1){_0x49f4fd[_0x46a317](_0x422f('0x6e'),qs[_0x422f('0x6f')](_0x1de5ee[_0x422f('0x6c')]),null);}else{var _0xec1dfb='%'+_0x1de5ee['value']+'%';_0x49f4fd[_0x46a317]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xec1dfb,_0xec1dfb,_0xec1dfb);}}else{_0x190668=_[_0x422f('0x64')](_0x2b8047,[_0x422f('0x44'),_0x422f('0x70')]);_0x1de5ee[_0x422f('0x51')]='ContactId';_0x419c43=as[_0x422f('0x71')](_0x4b7602,_0x190668[_0x422f('0x40')],_0x1de5ee);_0x49f4fd[_0x46a317](_0x419c43[_0x422f('0x72')],_0x419c43[_0x422f('0x6c')][_0x422f('0x73')],_0x419c43[_0x422f('0x6c')]['end']);}break;case'Tag':var _0x275a8b=_0x1de5ee[_0x422f('0x6c')][_0x422f('0x6d')](',')[_0x422f('0x43')](function(_0xbee65c){return Number(_0xbee65c);});_0x275a8b['forEach'](function(_0x1c59fe){_0x448489['or'](_0x422f('0x74'),'%,'+_0x1c59fe+',%');});_0x127b04=_[_0x422f('0x75')](_0x127b04,_0x275a8b);break;case _0x422f('0x76'):if(_0x1de5ee[_0x422f('0x6a')]===_0x422f('0x6b')){_0x49f4fd[_0x46a317](_0x422f('0x77'),'%'+_0x1de5ee[_0x422f('0x6c')]+'%',null);}else{_0x190668=_[_0x422f('0x64')](_0x2b8047,[_0x422f('0x44'),'UserId']);_0x1de5ee[_0x422f('0x51')]=_0x422f('0x3a');_0x419c43=as[_0x422f('0x71')](_0x4b7602,_0x190668[_0x422f('0x40')],_0x1de5ee);_0x49f4fd[_0x46a317](_0x419c43['text'],_0x419c43['value'][_0x422f('0x73')],_0x419c43[_0x422f('0x6c')][_0x422f('0x1e')]);}break;case'body':_0x419c43=as[_0x422f('0x71')]('me',null,_0x1de5ee);_0x49f4fd[_0x46a317](_0x419c43[_0x422f('0x72')],_0x419c43['value']['start'],_0x419c43[_0x422f('0x6c')][_0x422f('0x1e')]);break;}}else{var _0x419c43=as[_0x422f('0x71')](_0x4b7602,_0x190668[_0x422f('0x40')],_0x1de5ee);_0x49f4fd[_0x46a317](_0x419c43[_0x422f('0x72')],_0x419c43[_0x422f('0x6c')][_0x422f('0x73')],_0x419c43[_0x422f('0x6c')][_0x422f('0x1e')]);}}}else{var _0x36c7d4=_(_0x400f97[_0x422f('0x45')])[_0x422f('0x46')]()[_0x422f('0x43')](function(_0x481bb5){return _['some'](_0x2b8047,[_0x422f('0x44'),_0x481bb5])?_0x481bb5:undefined;})[_0x422f('0x78')]()['value']();if(!_[_0x422f('0x79')](_0x36c7d4)){_0x36c7d4[_0x422f('0x32')](function(_0x4782b1){if(_0x4782b1===_0x422f('0x7a')){_0x1b9ca2[_0x422f('0x4f')](_0x422f('0x7b'),[]['concat'](_0x400f97[_0x422f('0x45')][_0x4782b1]));}else if(_0x4782b1===_0x422f('0x7c')){var _0x27000f=JSON[_0x422f('0x7d')](_0x400f97[_0x422f('0x45')][_0x4782b1])[_0x422f('0x7e')];var _0x484124=JSON[_0x422f('0x7d')](_0x400f97[_0x422f('0x45')][_0x4782b1])[_0x422f('0x7f')];_0x1b9ca2['where'](_0x422f('0x80'),_0x27000f,_0x484124);}else{if(_0x400f97[_0x422f('0x45')][_0x4782b1]===_0x422f('0x81')){_0x1b9ca2[_0x422f('0x4f')]('i.'+_0x4782b1+_0x422f('0x82'));}else{_0x1b9ca2[_0x422f('0x4f')]('i.'+_0x4782b1+_0x422f('0x83'),_0x400f97['query'][_0x4782b1]);}}});}if(_0x400f97[_0x422f('0x45')][_0x422f('0x84')]){if(_0x400f97[_0x422f('0x45')][_0x422f('0x84')]==0x1){_0x1b9ca2[_0x422f('0x66')]('`unreadMessages`\x20=\x200');}else{_0x1b9ca2['having'](_0x422f('0x85'));}}if(_0x400f97[_0x422f('0x45')][_0x422f('0x86')]){_0x127b04=_[_0x422f('0x87')](_0x400f97[_0x422f('0x45')][_0x422f('0x86')])?_0x400f97[_0x422f('0x45')][_0x422f('0x86')]:new Array(_0x400f97[_0x422f('0x45')][_0x422f('0x86')]);_0x127b04[_0x422f('0x32')](function(_0x67c824){_0x448489['or'](_0x422f('0x74'),'%,'+_0x67c824+',%');});}if(_0x400f97[_0x422f('0x45')][_0x422f('0x88')]){var _0x1c2f1c=_0x400f97[_0x422f('0x45')][_0x422f('0x88')][_0x422f('0x89')]('\x5c','\x5c\x5c')[_0x422f('0x89')](/'/g,'\x27\x27');if(qs[_0x422f('0x8a')](_0x1c2f1c)){_0x49f4fd['or'](_0x422f('0x8b'),_0x1c2f1c+'%')['or'](_0x422f('0x8c'),_0x1c2f1c+'%');}_0x49f4fd['or'](_0x422f('0x8d'),_0x1c2f1c+'%');}}_0x1b9ca2[_0x422f('0x4f')](_0x49f4fd);_0x1b9ca2[_0x422f('0x8e')](_0x422f('0x8f'));var _0x304163={'type':db[_0x422f('0x90')][_0x422f('0x91')][_0x422f('0x92')],'raw':!![]};var _0x4eb9c0=_0x1b9ca2[_0x422f('0x93')]();_0x4eb9c0['field'](_0x422f('0x8f'));_0x4eb9c0['field'](_0x422f('0x94'),_0x422f('0x65'));if(_0x275f25[_0x422f('0x95')]){_0x275f25['order'][_0x422f('0x32')](function(_0x567082){var _0x2415cf=_0x567082[0x0]===_0x422f('0x96')?_0x567082[0x0]:'i.'+_0x567082[0x0];_0x1b9ca2['order'](_0x2415cf,_0x567082[0x1]===_0x422f('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x127b04)){_0x1b9ca2['having'](_0x448489);_0x4eb9c0['where'](_0x422f('0x98'),_0x127b04);}BPromise['resolve']()['then'](function(){if(!_0x3184bf){if(_0x400f97[_0x422f('0x45')][_0x422f('0x7a')])return;_0x4eb9c0[_0x422f('0x4f')](_0x422f('0x99'));_0x1b9ca2[_0x422f('0x4f')](_0x422f('0x99'));return;}if(_0x400f97[_0x422f('0x9a')][_0x422f('0x9b')]!==_0x422f('0x9c'))return;return _0x400f97[_0x422f('0x9a')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2871b5){if(_[_0x422f('0x79')](_0x2871b5)){_0x4eb9c0[_0x422f('0x4f')](_0x422f('0x9d'));_0x1b9ca2[_0x422f('0x4f')](_0x422f('0x9d'));}else{_0x4eb9c0[_0x422f('0x4f')]('i.FaxAccountId\x20IN\x20?',_[_0x422f('0x43')](_0x2871b5,'id'));_0x1b9ca2['where'](_0x422f('0x7b'),_[_0x422f('0x43')](_0x2871b5,'id'));}});})[_0x422f('0x29')](function(){if(_0x400f97['user'][_0x422f('0x9b')]==='agent'&&!_0x3184bf&&!_0x400f97[_0x422f('0x45')][_0x422f('0x7a')])return[];return db[_0x422f('0x9e')]['query'](_0x4eb9c0[_0x422f('0x9f')](),_0x304163);})['then'](function(_0x32db04){_0xf1f31b[_0x422f('0x23')]=_0x32db04[_0x422f('0x4b')];if(_0xf1f31b[_0x422f('0x23')]===0x0)return[];return db['sequelize']['query'](_0xaae705[_0x422f('0x9f')](),_0x304163)[_0x422f('0x29')](function(_0x40cf62){_0x3e66d3=_['keyBy'](_0x40cf62,'id');_0x304163=_['merge'](_0x304163,{'model':db[_0x422f('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x400f97[_0x422f('0x45')][_0x422f('0x4a')]){_0x275f25[_0x422f('0x49')]['forEach'](function(_0x5a2c02){_0x1b9ca2['field']('i.'+_0x5a2c02);});}else{_0x1b9ca2[_0x422f('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x422f('0x65'));_0x1b9ca2[_0x422f('0x51')](_0x422f('0xa0'),'Account.key');_0x1b9ca2['field'](_0x422f('0xa1'),_0x422f('0xa2'));_0x1b9ca2['field'](_0x422f('0xa3'),_0x422f('0x96'));_0x1b9ca2[_0x422f('0x51')]('i.*');_0x1b9ca2['field'](_0x422f('0xa4'),_0x422f('0xa5'));_0x1b9ca2[_0x422f('0x51')]('c.lastName',_0x422f('0xa6'));_0x1b9ca2[_0x422f('0x51')]('c.email','Contact.email');_0x1b9ca2[_0x422f('0x51')](_0x422f('0xa7'),_0x422f('0xa8'));_0x1b9ca2[_0x422f('0x51')]('c.mobile',_0x422f('0xa9'));_0x1b9ca2['field']('c.fax',_0x422f('0xaa'));_0x1b9ca2[_0x422f('0x51')](_0x422f('0xab'),'Owner.fullname');_0x1b9ca2[_0x422f('0x51')](_0x422f('0xac'),_0x422f('0xad'));_0x1b9ca2[_0x422f('0x51')](_0x422f('0xae'),_0x422f('0x30'));}if(_0x275f25[_0x422f('0x24')])_0x1b9ca2['limit'](_0x275f25[_0x422f('0x24')]);if(_0x275f25[_0x422f('0x21')])_0x1b9ca2[_0x422f('0x21')](_0x275f25['offset']);return db['sequelize'][_0x422f('0x45')](_0x1b9ca2['toString'](),_0x304163);})['then'](function(_0x194492){if(_0x194492[_0x422f('0x4b')]>0x0)_0x382ae0[_0x422f('0x4f')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x194492,'id'));return db[_0x422f('0x9e')][_0x422f('0x45')](_0x382ae0[_0x422f('0x9f')](),_0x304163)[_0x422f('0x29')](function(_0x27a060){var _0x305bbc=_[_0x422f('0xaf')](_0x27a060,_0x422f('0xb0'));var _0x2459c3=[];_0x194492[_0x422f('0x32')](function(_0x35a958){_0x2459c3[_0x422f('0x33')](updateFaxInteraction(_0x35a958,_0x3e66d3,_0x305bbc));});return BPromise[_0x422f('0xb1')](_0x2459c3);});});})['then'](function(_0x4b51d5){_0xf1f31b['rows']=_0x4b51d5;return _0xf1f31b;})['then'](respondWithFilteredResult(_0x43bd6d,_0x275f25))[_0x422f('0x34')](handleError(_0x43bd6d,null));};exports[_0x422f('0xb2')]=function(_0x188499,_0x3f1db1){var _0x3813e3={'raw':![],'where':{'id':_0x188499['params']['id']}},_0x51fc79={};_0x51fc79['model']=_['keys'](db[_0x422f('0x3d')][_0x422f('0x3e')]);_0x51fc79[_0x422f('0x45')]=_[_0x422f('0x46')](_0x188499[_0x422f('0x45')]);_0x51fc79[_0x422f('0x47')]=_[_0x422f('0x48')](_0x51fc79[_0x422f('0x42')],_0x51fc79['query']);_0x3813e3[_0x422f('0x49')]=_[_0x422f('0x48')](_0x51fc79['model'],qs[_0x422f('0x4a')](_0x188499[_0x422f('0x45')][_0x422f('0x4a')]));_0x3813e3['attributes']=_0x3813e3[_0x422f('0x49')][_0x422f('0x4b')]?_0x3813e3[_0x422f('0x49')]:_0x51fc79[_0x422f('0x42')];if(_0x188499['query'][_0x422f('0xb3')]){_0x3813e3[_0x422f('0xb4')]=[{'all':!![]}];}_0x3813e3=_[_0x422f('0xb5')]({},_0x3813e3,_0x188499[_0x422f('0xb6')]);return db[_0x422f('0x3d')][_0x422f('0x64')](_0x3813e3)[_0x422f('0x29')](handleEntityNotFound(_0x3f1db1,null))[_0x422f('0x29')](respondWithResult(_0x3f1db1,null))[_0x422f('0x34')](handleError(_0x3f1db1,null));};exports['create']=function(_0x2b2824,_0x118fea){return db[_0x422f('0x3d')][_0x422f('0xb7')](_0x2b2824[_0x422f('0xb8')],{})[_0x422f('0x29')](respondWithResult(_0x118fea,0xc9))[_0x422f('0x34')](handleError(_0x118fea,null));};exports['update']=function(_0x34249a,_0x494967){if(_0x34249a[_0x422f('0xb8')]['id']){delete _0x34249a[_0x422f('0xb8')]['id'];}return db[_0x422f('0x3d')][_0x422f('0x64')]({'where':{'id':_0x34249a['params']['id']}})[_0x422f('0x29')](handleEntityNotFound(_0x494967,null))[_0x422f('0x29')](saveUpdates(_0x34249a[_0x422f('0xb8')],null))[_0x422f('0x29')](respondWithResult(_0x494967,null))['catch'](handleError(_0x494967,null));};exports['destroy']=function(_0x42c816,_0x28e7c0){return db[_0x422f('0x3d')][_0x422f('0x64')]({'where':{'id':_0x42c816['params']['id']}})[_0x422f('0x29')](handleEntityNotFound(_0x28e7c0,null))[_0x422f('0x29')](removeEntity(_0x28e7c0,null))['catch'](handleError(_0x28e7c0,null));};exports[_0x422f('0xb9')]=function(_0x5d928c,_0x175b9d){return db[_0x422f('0x3d')][_0x422f('0xb9')]()[_0x422f('0x29')](respondWithResult(_0x175b9d,null))['catch'](handleError(_0x175b9d,null));};exports[_0x422f('0xba')]=function(_0x25cce3,_0x1ecdae,_0x87708f){return db['FaxMessage'][_0x422f('0x64')]({'where':{'id':_0x25cce3['params']['id']}})[_0x422f('0x29')](handleEntityNotFound(_0x1ecdae,null))[_0x422f('0x29')](function(_0x48ff6c){if(_0x48ff6c){return _0x48ff6c[_0x422f('0xba')](_0x25cce3[_0x422f('0xb8')][_0x422f('0xbb')],_['omit'](_0x25cce3[_0x422f('0xb8')],[_0x422f('0xbb'),'id'])||{});}})[_0x422f('0x29')](respondWithResult(_0x1ecdae,null))[_0x422f('0x34')](handleError(_0x1ecdae,null));};exports[_0x422f('0xbc')]=function(_0x426443,_0x259fec,_0x2a312a){var _0x48381f={'raw':![],'where':{}};var _0x157f8a={};var _0x49fa07={'count':0x0,'rows':[]};return db[_0x422f('0x3d')][_0x422f('0xbd')]({'where':{'id':_0x426443[_0x422f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x259fec,null))['then'](function(_0x411bc8){if(_0x411bc8){_0x157f8a[_0x422f('0x42')]=_[_0x422f('0x46')](db[_0x422f('0xbf')][_0x422f('0x3e')]);_0x157f8a['query']=_[_0x422f('0x46')](_0x426443['query']);_0x157f8a[_0x422f('0x47')]=_['intersection'](_0x157f8a['model'],_0x157f8a[_0x422f('0x45')]);_0x48381f[_0x422f('0x49')]=_['intersection'](_0x157f8a[_0x422f('0x42')],qs['fields'](_0x426443['query']['fields']));_0x48381f[_0x422f('0x49')]=_0x48381f[_0x422f('0x49')][_0x422f('0x4b')]?_0x48381f['attributes']:_0x157f8a['model'];if(!_0x426443[_0x422f('0x45')][_0x422f('0x4c')](_0x422f('0x4d'))){_0x48381f[_0x422f('0x24')]=qs[_0x422f('0x24')](_0x426443[_0x422f('0x45')]['limit']);_0x48381f[_0x422f('0x21')]=qs[_0x422f('0x21')](_0x426443[_0x422f('0x45')][_0x422f('0x21')]);}_0x48381f[_0x422f('0x95')]=qs[_0x422f('0x4e')](_0x426443[_0x422f('0x45')][_0x422f('0x4e')]);_0x48381f[_0x422f('0x4f')]=qs[_0x422f('0x47')](_[_0x422f('0xc0')](_0x426443['query'],_0x157f8a[_0x422f('0x47')]));_0x48381f[_0x422f('0x4f')][_0x422f('0xb0')]=_0x411bc8['id'];if(_0x426443[_0x422f('0x45')][_0x422f('0x88')]){_0x48381f['where']=_[_0x422f('0xb5')](_0x48381f[_0x422f('0x4f')],{'$or':_[_0x422f('0x43')](_0x48381f[_0x422f('0x49')],function(_0x1004eb){var _0x3e19c9={};_0x3e19c9[_0x1004eb]={'$like':'%'+_0x426443[_0x422f('0x45')][_0x422f('0x88')]+'%'};return _0x3e19c9;})});}if(_0x426443[_0x422f('0x45')][_0x422f('0x7e')]){var _0x5d9a3b=_0x426443[_0x422f('0x45')][_0x422f('0x7e')][_0x422f('0x6d')](',');var _0x32d485={};_0x32d485[_0x5d9a3b[0x0]]={'$gte':moment(_0x5d9a3b[0x1])[_0x422f('0xc1')](_0x422f('0xc2'))};_0x48381f['where']=_[_0x422f('0xb5')](_0x48381f[_0x422f('0x4f')],_0x32d485);}_0x48381f=_[_0x422f('0xb5')]({},_0x48381f,_0x426443[_0x422f('0xb6')]);return db[_0x422f('0xbf')][_0x422f('0x23')]({'where':_0x48381f[_0x422f('0x4f')]})[_0x422f('0x29')](function(_0x248e64){_0x49fa07[_0x422f('0x23')]=_0x248e64;if(_0x426443[_0x422f('0x45')]['includeAll']){_0x48381f[_0x422f('0xb4')]=[{'all':!![]}];}return db[_0x422f('0xbf')][_0x422f('0xc3')](_0x48381f);})['then'](function(_0x846057){_0x49fa07[_0x422f('0xc4')]=_0x846057;return _0x49fa07;});}})[_0x422f('0x29')](respondWithFilteredResult(_0x259fec,_0x48381f))['catch'](handleError(_0x259fec,null));};exports[_0x422f('0xc5')]=function(_0x477066,_0x19ec8e,_0x3f2c87){return db[_0x422f('0x3d')][_0x422f('0x64')]({'where':{'id':_0x477066['params']['id']}})[_0x422f('0x29')](handleEntityNotFound(_0x19ec8e,null))[_0x422f('0x29')](function(_0xc6eba0){if(_0xc6eba0){return _0xc6eba0[_0x422f('0xc6')](_0x477066[_0x422f('0xb8')][_0x422f('0xbb')],_[_0x422f('0xc7')](_0x477066[_0x422f('0xb8')],['ids','id'])||{})[_0x422f('0xc8')](function(){return db['Tag'][_0x422f('0xc3')]({'attributes':['id',_0x422f('0x44'),_0x422f('0xc9')],'where':{'id':_0x477066[_0x422f('0xb8')][_0x422f('0xbb')]}});})[_0x422f('0x29')](function(_0x266c23){socket[_0x422f('0xca')](_0x422f('0xcb'),{'id':Number(_0x477066[_0x422f('0xbe')]['id']),'tags':_0x266c23||[]});return{'id':Number(_0x477066['params']['id']),'tags':_0x266c23||[]};});}})[_0x422f('0x29')](respondWithResult(_0x19ec8e,null))[_0x422f('0x34')](handleError(_0x19ec8e,null));};exports['removeTags']=function(_0xf94bac,_0x4607d7,_0x4bf932){return db[_0x422f('0x3d')][_0x422f('0x64')]({'where':{'id':_0xf94bac[_0x422f('0xbe')]['id']}})[_0x422f('0x29')](handleEntityNotFound(_0x4607d7,null))[_0x422f('0x29')](function(_0x59bb49){if(_0x59bb49){return _0x59bb49[_0x422f('0xcc')](_0xf94bac['query'][_0x422f('0xbb')]);}})[_0x422f('0x29')](respondWithStatusCode(_0x4607d7,null))[_0x422f('0x34')](handleError(_0x4607d7,null));};exports[_0x422f('0xcd')]=function(_0x36edb0,_0x4244e0){var _0x13344a=moment()[_0x422f('0xce')]()['toString']();var _0x1b1e00=path['join'](config[_0x422f('0xcf')],_0x422f('0xd0'),_0x422f('0xd1'),'tmp');var _0x67b5f=path['join'](config[_0x422f('0xcf')],'server',_0x422f('0xd1'),'attachments');var _0x29d187=path[_0x422f('0xd2')](_0x1b1e00,_0x13344a);var _0x3fc6b4=util[_0x422f('0xc1')](_0x422f('0xd3'),_0x36edb0[_0x422f('0xbe')]['id'],_0x13344a);var _0x5b8477=path[_0x422f('0xd2')](_0x1b1e00,_0x3fc6b4);var _0x5cb412=[];_0x5cb412['push']({'model':db['Attachment'],'as':_0x422f('0xd4'),'raw':!![]});var _0x4e5ef7=[{'model':db[_0x422f('0xbf')],'as':_0x422f('0xd5'),'attributes':['id',_0x422f('0xb8'),_0x422f('0x7c')],'include':_0x5cb412}];return db['FaxInteraction'][_0x422f('0x64')]({'where':{'id':_0x36edb0[_0x422f('0xbe')]['id']},'include':_0x4e5ef7})[_0x422f('0x29')](handleEntityNotFound(_0x4244e0,null))['then'](function(_0x293da9){if(_0x293da9&&_0x293da9[_0x422f('0xd5')]){var _0x5671d9=_0x293da9[_0x422f('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x29d187);for(var _0x5cc767=0x0;_0x5cc767<_0x5671d9[_0x422f('0xd5')][_0x422f('0x4b')];_0x5cc767++){var _0x5b570f=_0x5671d9[_0x422f('0xd5')][_0x5cc767]['Attachment'];if(_0x5b570f){var _0x939321=path[_0x422f('0xd2')](_0x67b5f,_0x5b570f['basename']);if(fs[_0x422f('0xd7')](_0x939321)){fs[_0x422f('0xd8')](_0x939321)[_0x422f('0xd9')](fs[_0x422f('0xda')](path['join'](_0x29d187,_0x5b570f[_0x422f('0xdb')])));}}}return BPromise[_0x422f('0xdc')]()[_0x422f('0x29')](function(){return new BPromise(function(_0x369f10,_0x40e823){zipdir(_0x29d187,{'saveTo':_0x5b8477},function(_0x6f67be,_0xda2f49){if(_0x6f67be)return _0x40e823(_0x6f67be);return _0x369f10(_0xda2f49);});})['then'](function(){return new BPromise(function(_0x17d2fa,_0x4ada9c){rimraf(_0x29d187,function(_0x44428d){if(_0x44428d)_0x4ada9c(_0x44428d);return _0x17d2fa();});});})['then'](function(){return _0x4244e0[_0x422f('0xcd')](_0x5b8477,_0x3fc6b4,function(_0x198b73){if(_0x198b73){console[_0x422f('0xdd')](_0x422f('0xde'),_0x198b73);}else{fs[_0x422f('0xdf')](_0x5b8477);}});});});}else{return _0x4244e0[_0x422f('0x1d')](0xc8);}})['catch'](handleError(_0x4244e0,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bf40973..9920f64 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 _0x4f8b=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x4db537,_0x53a37b){var _0x25d062=function(_0x5954b1){while(--_0x5954b1){_0x4db537['push'](_0x4db537['shift']());}};_0x25d062(++_0x53a37b);}(_0x4f8b,0x83));var _0xb4f8=function(_0x176f2e,_0x440325){_0x176f2e=_0x176f2e-0x0;var _0x221d7f=_0x4f8b[_0x176f2e];return _0x221d7f;};'use strict';var EventEmitter=require(_0xb4f8('0x0'));var FaxInteraction=require(_0xb4f8('0x1'))['db'][_0xb4f8('0x2')];var FaxMessage=require(_0xb4f8('0x1'))['db'][_0xb4f8('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb4f8('0x4')](0x0);var events={'afterCreate':_0xb4f8('0x5'),'afterUpdate':_0xb4f8('0x6'),'afterDestroy':_0xb4f8('0x7')};function emitEvent(_0x5241bd){return function(_0x248aed,_0x4fe950,_0x2662da){_0x248aed[_0xb4f8('0x8')]({'attributes':['id'],'raw':!![]})[_0xb4f8('0x9')](function(_0x426902){_0x248aed[_0xb4f8('0xa')](_0xb4f8('0xb'),_0x426902[_0xb4f8('0xc')](function(_0x381efc){return{'id':_0x381efc['id']};}));return FaxMessage[_0xb4f8('0xd')]({'where':{'FaxInteractionId':_0x248aed['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4f8('0x9')](function(_0xc7e8c5){_0x248aed['setDataValue'](_0xb4f8('0xe'),_0xc7e8c5[_0xb4f8('0xf')]);FaxInteractionEvents['emit'](_0x5241bd+':'+_0x248aed['id'],_0x248aed);FaxInteractionEvents[_0xb4f8('0x10')](_0x5241bd,_0x248aed);_0x2662da(null);})[_0xb4f8('0x11')](_0x2662da(null));};}for(var e in events){if(events[_0xb4f8('0x12')](e)){var event=events[e];FaxInteraction[_0xb4f8('0x13')](e,emitEvent(event));}}module[_0xb4f8('0x14')]=FaxInteractionEvents; \ No newline at end of file +var _0x74c2=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages'];(function(_0x1e8ac9,_0x1bd0fe){var _0x4c895c=function(_0x3cc2f5){while(--_0x3cc2f5){_0x1e8ac9['push'](_0x1e8ac9['shift']());}};_0x4c895c(++_0x1bd0fe);}(_0x74c2,0xe2));var _0x274c=function(_0x1bc416,_0x1dad4f){_0x1bc416=_0x1bc416-0x0;var _0x5f12e8=_0x74c2[_0x1bc416];return _0x5f12e8;};'use strict';var EventEmitter=require(_0x274c('0x0'));var FaxInteraction=require(_0x274c('0x1'))['db'][_0x274c('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x274c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x274c('0x4')](0x0);var events={'afterCreate':_0x274c('0x5'),'afterUpdate':_0x274c('0x6'),'afterDestroy':_0x274c('0x7')};function emitEvent(_0x2b4e1d){return function(_0x2b400b,_0x15ad62,_0x2ffe60){_0x2b400b[_0x274c('0x8')]({'attributes':['id'],'raw':!![]})[_0x274c('0x9')](function(_0x75eaec){_0x2b400b[_0x274c('0xa')](_0x274c('0xb'),_0x75eaec['map'](function(_0x1aebbd){return{'id':_0x1aebbd['id']};}));return FaxMessage[_0x274c('0xc')]({'where':{'FaxInteractionId':_0x2b400b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1dc03e){_0x2b400b['setDataValue'](_0x274c('0xd'),_0x1dc03e[_0x274c('0xe')]);FaxInteractionEvents[_0x274c('0xf')](_0x2b4e1d+':'+_0x2b400b['id'],_0x2b400b);FaxInteractionEvents[_0x274c('0xf')](_0x2b4e1d,_0x2b400b);_0x2ffe60(null);})[_0x274c('0x10')](_0x2ffe60(null));};}for(var e in events){if(events[_0x274c('0x11')](e)){var event=events[e];FaxInteraction[_0x274c('0x12')](e,emitEvent(event));}}module[_0x274c('0x13')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9df4ee6..60f07f6 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 _0x4a6d=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','../../config/environment','define','FaxInteraction','fax_interactions','changed'];(function(_0x391656,_0x5c5083){var _0x7d2116=function(_0xe8cadc){while(--_0xe8cadc){_0x391656['push'](_0x391656['shift']());}};_0x7d2116(++_0x5c5083);}(_0x4a6d,0x121));var _0xd4a6=function(_0x2be3d2,_0x297bd8){_0x2be3d2=_0x2be3d2-0x0;var _0x3d4500=_0x4a6d[_0x2be3d2];return _0x3d4500;};'use strict';var _=require('lodash');var util=require(_0xd4a6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd4a6('0x1'));var BPromise=require(_0xd4a6('0x2'));var rp=require(_0xd4a6('0x3'));var fs=require('fs');var path=require(_0xd4a6('0x4'));var rimraf=require('rimraf');var config=require(_0xd4a6('0x5'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x4b35b1,_0x315fa3){return _0x4b35b1[_0xd4a6('0x6')](_0xd4a6('0x7'),attributes,{'tableName':_0xd4a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4889be,_0x4deea3,_0x109105){if(_0x4889be[_0xd4a6('0x9')](_0xd4a6('0xa'))){_0x4889be[_0xd4a6('0xb')]=moment()['format'](_0xd4a6('0xc'));}_0x109105(null,_0x4889be);}}});}; \ No newline at end of file +var _0x32b6=['fax_interactions','changed','closed','lodash','util','api','moment','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x4a130a,_0x13000e){var _0x2135c2=function(_0x5ac5a4){while(--_0x5ac5a4){_0x4a130a['push'](_0x4a130a['shift']());}};_0x2135c2(++_0x13000e);}(_0x32b6,0x1d1));var _0x632b=function(_0x5119eb,_0x3d011f){_0x5119eb=_0x5119eb-0x0;var _0x398537=_0x32b6[_0x5119eb];return _0x398537;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5128f5,_0x33d711,_0x173270){if(_0x5128f5[_0x632b('0xc')](_0x632b('0xd'))){_0x5128f5['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x173270(null,_0x5128f5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c510c23..26190d5 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 _0xe1df=['ids','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','FaxInteraction','find','addTags'];(function(_0x180df1,_0x4ff1e1){var _0x1834ee=function(_0x1c3a88){while(--_0x1c3a88){_0x180df1['push'](_0x180df1['shift']());}};_0x1834ee(++_0x4ff1e1);}(_0xe1df,0x1d7));var _0xfe1d=function(_0x45deb4,_0x6c7833){_0x45deb4=_0x45deb4-0x0;var _0x5b8539=_0xe1df[_0x45deb4];return _0x5b8539;};'use strict';var _=require(_0xfe1d('0x0'));var util=require(_0xfe1d('0x1'));var moment=require(_0xfe1d('0x2'));var BPromise=require(_0xfe1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe1d('0x4'));var db=require(_0xfe1d('0x5'))['db'];var utils=require(_0xfe1d('0x6'));var logger=require(_0xfe1d('0x7'))(_0xfe1d('0x8'));var config=require(_0xfe1d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfe1d('0xa')][_0xfe1d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfe1d('0xc')],{'host':_0xfe1d('0xd'),'port':0x18eb});var socket=require(_0xfe1d('0xe'))(new Redis(config[_0xfe1d('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x46787f,_0x4fffec,_0x250dff){return new BPromise(function(_0x5df5fb,_0x2cf2b4){return client[_0xfe1d('0xf')](_0x46787f,_0x250dff)[_0xfe1d('0x10')](function(_0x3e412e){logger[_0xfe1d('0x11')](_0xfe1d('0x12'),_0x4fffec,_0xfe1d('0x13'));logger['debug'](_0xfe1d('0x14'),_0x4fffec,_0xfe1d('0x13'),JSON['stringify'](_0x3e412e));if(_0x3e412e[_0xfe1d('0x15')]){if(_0x3e412e[_0xfe1d('0x15')][_0xfe1d('0x16')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4fffec,_0x3e412e[_0xfe1d('0x15')][_0xfe1d('0x17')]);return _0x2cf2b4(_0x3e412e[_0xfe1d('0x15')][_0xfe1d('0x17')]);}logger[_0xfe1d('0x15')](_0xfe1d('0x12'),_0x4fffec,_0x3e412e[_0xfe1d('0x15')][_0xfe1d('0x17')]);return _0x5df5fb(_0x3e412e[_0xfe1d('0x15')][_0xfe1d('0x17')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4fffec,_0xfe1d('0x13'));_0x5df5fb(_0x3e412e[_0xfe1d('0x18')]['message']);}})[_0xfe1d('0x19')](function(_0x6b59ec){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4fffec,_0x6b59ec);_0x2cf2b4(_0x6b59ec);});});}exports['UpdateFaxInteraction']=function(_0x20db40){var _0x51d56b=this;return new Promise(function(_0x54f353,_0x486167){return db['FaxInteraction']['update'](_0x20db40[_0xfe1d('0x1a')],{'raw':_0x20db40[_0xfe1d('0x1b')]?_0x20db40['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20db40['options']?_0x20db40['options']['where']||null:null,'attributes':_0x20db40[_0xfe1d('0x1b')]?_0x20db40['options'][_0xfe1d('0x1c')]||null:null,'limit':_0x20db40[_0xfe1d('0x1b')]?_0x20db40[_0xfe1d('0x1b')][_0xfe1d('0x1d')]||null:null})[_0xfe1d('0x10')](function(_0x502017){logger['info'](_0xfe1d('0x1e'),_0x20db40);logger['debug']('UpdateFaxInteraction',_0x20db40,JSON[_0xfe1d('0x1f')](_0x502017));_0x54f353(_0x502017);})['catch'](function(_0x16273d){logger[_0xfe1d('0x15')](_0xfe1d('0x1e'),_0x16273d['message'],_0x20db40);_0x486167(_0x51d56b[_0xfe1d('0x15')](0x1f4,_0x16273d[_0xfe1d('0x17')]));});});};exports[_0xfe1d('0x20')]=function(_0xa82305){return new Promise(function(_0x482544,_0x281f58){return db[_0xfe1d('0x21')][_0xfe1d('0x22')]({'where':_0xa82305['options']?_0xa82305[_0xfe1d('0x1b')]['where']||null:null})[_0xfe1d('0x10')](function(_0x132b36){if(_0x132b36){return _0x132b36[_0xfe1d('0x23')](_0xa82305[_0xfe1d('0x1a')]['ids'],_['omit'](_0xa82305[_0xfe1d('0x1a')],[_0xfe1d('0x24'),'id'])||{});}})['spread'](function(_0x3a5db1){logger['info'](_0xfe1d('0x25'),_0xa82305);logger[_0xfe1d('0x26')](_0xfe1d('0x25'),_0xa82305,JSON[_0xfe1d('0x1f')](_0x3a5db1));_0x482544(_0x3a5db1);})['catch'](function(_0x2d8b27){logger['error'](_0xfe1d('0x25'),_0x2d8b27[_0xfe1d('0x17')],_0xa82305);_0x281f58(_this[_0xfe1d('0x15')](0x1f4,_0x2d8b27[_0xfe1d('0x17')]));});});}; \ No newline at end of file +var _0x61de=['AddTags','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','FaxInteraction','update','body','options','raw','where','limit','UpdateFaxInteraction','stringify','find','spread','info'];(function(_0x3b314c,_0x325205){var _0x2a0bdf=function(_0x39a5ef){while(--_0x39a5ef){_0x3b314c['push'](_0x3b314c['shift']());}};_0x2a0bdf(++_0x325205);}(_0x61de,0x157));var _0xe61d=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x61de[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0xe61d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe61d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe61d('0x2'))['db'];var utils=require(_0xe61d('0x3'));var logger=require(_0xe61d('0x4'))(_0xe61d('0x5'));var config=require(_0xe61d('0x6'));var jayson=require(_0xe61d('0x7'));var client=jayson[_0xe61d('0x8')][_0xe61d('0x9')]({'port':0x232a});config[_0xe61d('0xa')]=_[_0xe61d('0xb')](config[_0xe61d('0xa')],{'host':_0xe61d('0xc'),'port':0x18eb});var socket=require(_0xe61d('0xd'))(new Redis(config[_0xe61d('0xa')]));require(_0xe61d('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e04e3,_0xfaba00,_0x377f2f){return new BPromise(function(_0x206669,_0x72c4aa){return client[_0xe61d('0xf')](_0x1e04e3,_0x377f2f)[_0xe61d('0x10')](function(_0x9c554d){logger['info'](_0xe61d('0x11'),_0xfaba00,_0xe61d('0x12'));logger[_0xe61d('0x13')](_0xe61d('0x14'),_0xfaba00,_0xe61d('0x12'),JSON['stringify'](_0x9c554d));if(_0x9c554d['error']){if(_0x9c554d[_0xe61d('0x15')]['code']===0x1f4){logger[_0xe61d('0x15')](_0xe61d('0x11'),_0xfaba00,_0x9c554d['error'][_0xe61d('0x16')]);return _0x72c4aa(_0x9c554d[_0xe61d('0x15')][_0xe61d('0x16')]);}logger[_0xe61d('0x15')](_0xe61d('0x11'),_0xfaba00,_0x9c554d[_0xe61d('0x15')]['message']);return _0x206669(_0x9c554d[_0xe61d('0x15')][_0xe61d('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0xfaba00,_0xe61d('0x12'));_0x206669(_0x9c554d[_0xe61d('0x17')][_0xe61d('0x16')]);}})[_0xe61d('0x18')](function(_0x28395a){logger['error'](_0xe61d('0x11'),_0xfaba00,_0x28395a);_0x72c4aa(_0x28395a);});});}exports['UpdateFaxInteraction']=function(_0x1af083){var _0x236f65=this;return new Promise(function(_0x1b526d,_0x164fa7){return db[_0xe61d('0x19')][_0xe61d('0x1a')](_0x1af083[_0xe61d('0x1b')],{'raw':_0x1af083[_0xe61d('0x1c')]?_0x1af083['options'][_0xe61d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af083[_0xe61d('0x1c')]?_0x1af083[_0xe61d('0x1c')][_0xe61d('0x1e')]||null:null,'attributes':_0x1af083['options']?_0x1af083[_0xe61d('0x1c')]['attributes']||null:null,'limit':_0x1af083['options']?_0x1af083[_0xe61d('0x1c')][_0xe61d('0x1f')]||null:null})[_0xe61d('0x10')](function(_0x18e504){logger['info']('UpdateFaxInteraction',_0x1af083);logger[_0xe61d('0x13')](_0xe61d('0x20'),_0x1af083,JSON[_0xe61d('0x21')](_0x18e504));_0x1b526d(_0x18e504);})['catch'](function(_0x4ff4ee){logger[_0xe61d('0x15')](_0xe61d('0x20'),_0x4ff4ee[_0xe61d('0x16')],_0x1af083);_0x164fa7(_0x236f65['error'](0x1f4,_0x4ff4ee[_0xe61d('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x349734){return new Promise(function(_0x3dd7fa,_0x1bc483){return db['FaxInteraction'][_0xe61d('0x22')]({'where':_0x349734[_0xe61d('0x1c')]?_0x349734['options']['where']||null:null})[_0xe61d('0x10')](function(_0x1f5bf8){if(_0x1f5bf8){return _0x1f5bf8['addTags'](_0x349734[_0xe61d('0x1b')]['ids'],_['omit'](_0x349734[_0xe61d('0x1b')],['ids','id'])||{});}})[_0xe61d('0x23')](function(_0x4410ee){logger[_0xe61d('0x24')](_0xe61d('0x25'),_0x349734);logger[_0xe61d('0x13')]('AddTags',_0x349734,JSON[_0xe61d('0x21')](_0x4410ee));_0x3dd7fa(_0x4410ee);})['catch'](function(_0x338d12){logger[_0xe61d('0x15')]('AddTags',_0x338d12[_0xe61d('0x16')],_0x349734);_0x1bc483(_this['error'](0x1f4,_0x338d12['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 22b3da0..8622c70 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 _0xe000=['length','faxInteraction:','save','remove','update','removeListener'];(function(_0x24a992,_0x5c49eb){var _0x26e1d4=function(_0x149d3d){while(--_0x149d3d){_0x24a992['push'](_0x24a992['shift']());}};_0x26e1d4(++_0x5c49eb);}(_0xe000,0xc8));var _0x0e00=function(_0x1b70c9,_0x51c45d){_0x1b70c9=_0x1b70c9-0x0;var _0x55fdce=_0xe000[_0x1b70c9];return _0x55fdce;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0e00('0x0'),_0x0e00('0x1'),_0x0e00('0x2')];function createListener(_0x335bc0,_0x4db2cc){return function(_0x4566dd){_0x4db2cc['emit'](_0x335bc0,_0x4566dd);};}function removeListener(_0x15d864,_0x3ad80a){return function(){FaxInteractionEvents[_0x0e00('0x3')](_0x15d864,_0x3ad80a);};}exports['register']=function(_0x20c91e){for(var _0x57e97e=0x0,_0x27ec7e=events[_0x0e00('0x4')];_0x57e97e<_0x27ec7e;_0x57e97e++){var _0x1d213f=events[_0x57e97e];var _0x44131f=createListener(_0x0e00('0x5')+_0x1d213f,_0x20c91e);FaxInteractionEvents['on'](_0x1d213f,_0x44131f);}}; \ No newline at end of file +var _0xccea=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x581143,_0x397738){var _0x23e8d9=function(_0x38647a){while(--_0x38647a){_0x581143['push'](_0x581143['shift']());}};_0x23e8d9(++_0x397738);}(_0xccea,0x13c));var _0xacce=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xccea[_0x424a9a];return _0xa7831c;};'use strict';var FaxInteractionEvents=require(_0xacce('0x0'));var events=[_0xacce('0x1'),_0xacce('0x2'),_0xacce('0x3')];function createListener(_0x43a558,_0xc32c44){return function(_0x2687d6){_0xc32c44['emit'](_0x43a558,_0x2687d6);};}function removeListener(_0x1f4023,_0x37db91){return function(){FaxInteractionEvents[_0xacce('0x4')](_0x1f4023,_0x37db91);};}exports[_0xacce('0x5')]=function(_0x239926){for(var _0x14c766=0x0,_0xae706d=events[_0xacce('0x6')];_0x14c766<_0xae706d;_0x14c766++){var _0x5eea30=events[_0x14c766];var _0x548025=createListener(_0xacce('0x7')+_0x5eea30,_0x239926);FaxInteractionEvents['on'](_0x5eea30,_0x548025);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b0de3bf..d90d3ea 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 _0x3e38=['delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','addMessage','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e38,0x68));var _0x83e3=function(_0x3a052f,_0x50104b){_0x3a052f=_0x3a052f-0x0;var _0x2ca36f=_0x3e38[_0x3a052f];return _0x2ca36f;};'use strict';var multer=require(_0x83e3('0x0'));var util=require(_0x83e3('0x1'));var path=require('path');var timeout=require(_0x83e3('0x2'));var express=require(_0x83e3('0x3'));var router=express[_0x83e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x83e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x83e3('0x6'));var controller=require(_0x83e3('0x7'));router[_0x83e3('0x8')]('/',auth['isAuthenticated'](),controller[_0x83e3('0x9')]);router[_0x83e3('0x8')](_0x83e3('0xa'),auth['isAuthenticated'](),controller[_0x83e3('0xb')]);router[_0x83e3('0x8')](_0x83e3('0xc'),auth[_0x83e3('0xd')](),controller[_0x83e3('0xe')]);router[_0x83e3('0x8')](_0x83e3('0xf'),auth['isAuthenticated'](),controller[_0x83e3('0x10')]);router['get'](_0x83e3('0x11'),auth['isAuthenticated'](),controller[_0x83e3('0x12')]);router['post']('/',auth[_0x83e3('0xd')](),controller['create']);router['post'](_0x83e3('0xf'),auth[_0x83e3('0xd')](),controller[_0x83e3('0x13')]);router[_0x83e3('0x14')](_0x83e3('0x15'),auth[_0x83e3('0xd')](),interaction[_0x83e3('0x16')](_0x83e3('0x17'),_0x83e3('0x18')),controller[_0x83e3('0x19')]);router[_0x83e3('0x1a')](_0x83e3('0xc'),auth[_0x83e3('0xd')](),interaction[_0x83e3('0x16')](_0x83e3('0x17'),'faxinteraction:update'),controller[_0x83e3('0x1b')]);router[_0x83e3('0x1c')](_0x83e3('0xc'),auth[_0x83e3('0xd')](),interaction['tracked'](_0x83e3('0x17'),_0x83e3('0x1d')),controller[_0x83e3('0x1e')]);router[_0x83e3('0x1c')](_0x83e3('0x15'),auth[_0x83e3('0xd')](),controller[_0x83e3('0x1f')]);module[_0x83e3('0x20')]=router; \ No newline at end of file +var _0x6c21=['/:id','show','getMessages','/:id/download','download','create','/:id/messages','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','update','faxinteraction:destroy','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1eaafc,_0x1f5f0c){var _0x45cfc1=function(_0x5f2f1f){while(--_0x5f2f1f){_0x1eaafc['push'](_0x1eaafc['shift']());}};_0x45cfc1(++_0x1f5f0c);}(_0x6c21,0x1b2));var _0x16c2=function(_0x314d99,_0xb8c0df){_0x314d99=_0x314d99-0x0;var _0x31d8c4=_0x6c21[_0x314d99];return _0x31d8c4;};'use strict';var multer=require(_0x16c2('0x0'));var util=require(_0x16c2('0x1'));var path=require(_0x16c2('0x2'));var timeout=require(_0x16c2('0x3'));var express=require('express');var router=express[_0x16c2('0x4')]();var fs_extra=require(_0x16c2('0x5'));var auth=require(_0x16c2('0x6'));var interaction=require(_0x16c2('0x7'));var config=require(_0x16c2('0x8'));var controller=require('./faxInteraction.controller');router[_0x16c2('0x9')]('/',auth[_0x16c2('0xa')](),controller[_0x16c2('0xb')]);router[_0x16c2('0x9')](_0x16c2('0xc'),auth[_0x16c2('0xa')](),controller[_0x16c2('0xd')]);router[_0x16c2('0x9')](_0x16c2('0xe'),auth[_0x16c2('0xa')](),controller[_0x16c2('0xf')]);router[_0x16c2('0x9')]('/:id/messages',auth[_0x16c2('0xa')](),controller[_0x16c2('0x10')]);router['get'](_0x16c2('0x11'),auth[_0x16c2('0xa')](),controller[_0x16c2('0x12')]);router['post']('/',auth[_0x16c2('0xa')](),controller[_0x16c2('0x13')]);router['post'](_0x16c2('0x14'),auth[_0x16c2('0xa')](),controller[_0x16c2('0x15')]);router['post'](_0x16c2('0x16'),auth[_0x16c2('0xa')](),interaction[_0x16c2('0x17')]('fax',_0x16c2('0x18')),controller[_0x16c2('0x19')]);router[_0x16c2('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x16c2('0x17')](_0x16c2('0x1b'),'faxinteraction:update'),controller[_0x16c2('0x1c')]);router['delete'](_0x16c2('0xe'),auth[_0x16c2('0xa')](),interaction[_0x16c2('0x17')](_0x16c2('0x1b'),_0x16c2('0x1d')),controller['destroy']);router[_0x16c2('0x1e')](_0x16c2('0x16'),auth[_0x16c2('0xa')](),controller['removeTags']);module[_0x16c2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 281625f..5d1c359 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 _0x0ba7=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x54783e,_0xe85a52){var _0x4b03f4=function(_0x4095ba){while(--_0x4095ba){_0x54783e['push'](_0x54783e['shift']());}};_0x4b03f4(++_0xe85a52);}(_0x0ba7,0x16d));var _0x70ba=function(_0x5d7496,_0x20f65b){_0x5d7496=_0x5d7496-0x0;var _0x191c4d=_0x0ba7[_0x5d7496];return _0x191c4d;};'use strict';var Sequelize=require(_0x70ba('0x0'));module['exports']={'body':{'type':Sequelize[_0x70ba('0x1')](_0x70ba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x70ba('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x70ba('0x4')]('in','out'),'defaultValue':_0x70ba('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x70ba('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x70ba('0x6')]}}; \ No newline at end of file +var _0x6308=['ENUM','out','DATE','sequelize','TEXT'];(function(_0x5ad4e6,_0x12361f){var _0x511972=function(_0x292354){while(--_0x292354){_0x5ad4e6['push'](_0x5ad4e6['shift']());}};_0x511972(++_0x12361f);}(_0x6308,0x1f2));var _0x8630=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x6308[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x8630('0x0'));module['exports']={'body':{'type':Sequelize[_0x8630('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8630('0x2')]('in',_0x8630('0x3')),'defaultValue':_0x8630('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8630('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8630('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6387b86..29e89c2 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 _0x854f=['filter','options','includeAll','findAll','show','params','include','find','update','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','fullname','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','attachments','join','rimraf','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','destroy','end','stack','name','send','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL'];(function(_0x545090,_0x4f93b8){var _0x56c600=function(_0x1ff94d){while(--_0x1ff94d){_0x545090['push'](_0x545090['shift']());}};_0x56c600(++_0x4f93b8);}(_0x854f,0x1db));var _0xf854=function(_0x5c1d7b,_0x972f80){_0x5c1d7b=_0x5c1d7b-0x0;var _0x4e67c1=_0x854f[_0x5c1d7b];return _0x4e67c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf854('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf854('0x1'));var rp=require(_0xf854('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf854('0x3'));var sox=require(_0xf854('0x4'));var csv=require(_0xf854('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf854('0x6'));var _=require(_0xf854('0x7'));var squel=require('squel');var crypto=require(_0xf854('0x8'));var jsforce=require(_0xf854('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf854('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf854('0xa'));var authService=require(_0xf854('0xb'));var qs=require(_0xf854('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf854('0xd'));var logger=require(_0xf854('0xe'))(_0xf854('0xf'));var utils=require('../../config/utils');var config=require(_0xf854('0x10'));var licenseUtil=require(_0xf854('0x11'));var db=require('../../mysqldb')['db'];config[_0xf854('0x12')]=_[_0xf854('0x13')](config[_0xf854('0x12')],{'host':_0xf854('0x14'),'port':0x18eb});var socket=require(_0xf854('0x15'))(new Redis(config['redis']));require(_0xf854('0x16'))[_0xf854('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf854('0x18')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf854('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x257f2c,_0x2ec2ce,_0x5d6374,_0x212c2f){return new BPromise(function(_0x41bb1f,_0x456033){var _0x21c18b=_0x212c2f||client;return _0x21c18b[_0xf854('0x1a')](_0x257f2c,_0x5d6374)[_0xf854('0x1b')](function(_0x222cd8){logger[_0xf854('0x1c')]('FaxMessage,\x20%s,\x20%s',_0x2ec2ce,_0xf854('0x1d'));logger['debug'](_0xf854('0x1e'),_0x2ec2ce,_0xf854('0x1d'),JSON[_0xf854('0x1f')](_0x222cd8));if(_0x222cd8[_0xf854('0x20')]){if(_0x222cd8['error'][_0xf854('0x21')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2ec2ce,_0x222cd8['error']['message']);return _0x456033(_0x222cd8['error'][_0xf854('0x22')]);}logger[_0xf854('0x20')](_0xf854('0x23'),_0x2ec2ce,_0x222cd8[_0xf854('0x20')][_0xf854('0x22')]);return _0x41bb1f(_0x222cd8[_0xf854('0x20')][_0xf854('0x22')]);}else{logger[_0xf854('0x1c')](_0xf854('0x23'),_0x2ec2ce,_0xf854('0x1d'));_0x41bb1f(_0x222cd8[_0xf854('0x24')]['message']);}})[_0xf854('0x25')](function(_0x401258){logger[_0xf854('0x20')](_0xf854('0x23'),_0x2ec2ce,_0x401258);_0x456033(_0x401258);});});}function respondWithStatusCode(_0xff6c99,_0x15e8f7){_0x15e8f7=_0x15e8f7||0xcc;return function(_0x151282){if(_0x151282){return _0xff6c99[_0xf854('0x26')](_0x15e8f7);}return _0xff6c99[_0xf854('0x27')](_0x15e8f7)['end']();};}function respondWithResult(_0x2dc452,_0x23e924){_0x23e924=_0x23e924||0xc8;return function(_0x20b285){if(_0x20b285){return _0x2dc452[_0xf854('0x27')](_0x23e924)[_0xf854('0x28')](_0x20b285);}};}function respondWithFilteredResult(_0x2c3a92,_0x22d2ac){return function(_0x335757){if(_0x335757){var _0x401b78=typeof _0x22d2ac[_0xf854('0x29')]==='undefined'&&typeof _0x22d2ac[_0xf854('0x2a')]==='undefined';var _0x1dbcfa=_0x335757['count'];var _0x465eb0=_0x401b78?0x0:_0x22d2ac[_0xf854('0x29')];var _0x219a85=_0x401b78?_0x335757[_0xf854('0x2b')]:_0x22d2ac[_0xf854('0x29')]+_0x22d2ac['limit'];var _0x158ba8;if(_0x219a85>=_0x1dbcfa){_0x219a85=_0x1dbcfa;_0x158ba8=0xc8;}else{_0x158ba8=0xce;}_0x2c3a92[_0xf854('0x27')](_0x158ba8);return _0x2c3a92[_0xf854('0x2c')](_0xf854('0x2d'),_0x465eb0+'-'+_0x219a85+'/'+_0x1dbcfa)['json'](_0x335757);}return null;};}function patchUpdates(_0x543513){return function(_0x1a9976){try{jsonpatch[_0xf854('0x2e')](_0x1a9976,_0x543513,!![]);}catch(_0x386b55){return BPromise['reject'](_0x386b55);}return _0x1a9976[_0xf854('0x2f')]();};}function saveUpdates(_0x26d866,_0x347c1c){return function(_0x39c77f){if(_0x39c77f){return _0x39c77f['update'](_0x26d866)[_0xf854('0x1b')](function(_0x199e4d){return _0x199e4d;});}return null;};}function removeEntity(_0x49a806,_0x161f80){return function(_0x57b6e2){if(_0x57b6e2){return _0x57b6e2[_0xf854('0x30')]()[_0xf854('0x1b')](function(){_0x49a806[_0xf854('0x27')](0xcc)[_0xf854('0x31')]();});}};}function handleEntityNotFound(_0x153491,_0x361fcd){return function(_0x512348){if(!_0x512348){_0x153491[_0xf854('0x26')](0x194);}return _0x512348;};}function handleError(_0x22104a,_0x20dd30){_0x20dd30=_0x20dd30||0x1f4;return function(_0x4d2e82){logger['error'](_0x4d2e82[_0xf854('0x32')]);if(_0x4d2e82['name']){delete _0x4d2e82[_0xf854('0x33')];}_0x22104a[_0xf854('0x27')](_0x20dd30)[_0xf854('0x34')](_0x4d2e82);};}exports['index']=function(_0x5d37e3,_0x23173c){var _0x327e09={},_0x2cb0be={},_0x3e7816={'count':0x0,'rows':[]};var _0x2fec81=_[_0xf854('0x35')](db[_0xf854('0x36')][_0xf854('0x37')],function(_0x65d5ad){return{'name':_0x65d5ad['fieldName'],'type':_0x65d5ad[_0xf854('0x38')][_0xf854('0x39')]};});_0x2cb0be[_0xf854('0x3a')]=_[_0xf854('0x35')](_0x2fec81,_0xf854('0x33'));_0x2cb0be[_0xf854('0x3b')]=_[_0xf854('0x3c')](_0x5d37e3[_0xf854('0x3b')]);_0x2cb0be[_0xf854('0x3d')]=_['intersection'](_0x2cb0be[_0xf854('0x3a')],_0x2cb0be['query']);_0x327e09[_0xf854('0x3e')]=_[_0xf854('0x3f')](_0x2cb0be['model'],qs[_0xf854('0x40')](_0x5d37e3[_0xf854('0x3b')]['fields']));_0x327e09['attributes']=_0x327e09[_0xf854('0x3e')][_0xf854('0x41')]?_0x327e09[_0xf854('0x3e')]:_0x2cb0be[_0xf854('0x3a')];if(!_0x5d37e3[_0xf854('0x3b')][_0xf854('0x42')]('nolimit')){_0x327e09[_0xf854('0x2a')]=qs[_0xf854('0x2a')](_0x5d37e3[_0xf854('0x3b')][_0xf854('0x2a')]);_0x327e09[_0xf854('0x29')]=qs['offset'](_0x5d37e3[_0xf854('0x3b')]['offset']);}_0x327e09[_0xf854('0x43')]=qs[_0xf854('0x44')](_0x5d37e3['query'][_0xf854('0x44')]);_0x327e09[_0xf854('0x45')]=qs['filters'](_[_0xf854('0x46')](_0x5d37e3[_0xf854('0x3b')],_0x2cb0be[_0xf854('0x3d')]),_0x2fec81);if(_0x5d37e3[_0xf854('0x3b')]['filter']){_0x327e09[_0xf854('0x45')]=_[_0xf854('0x47')](_0x327e09[_0xf854('0x45')],{'$or':_['map'](_0x2fec81,function(_0x24bd53){if(_0x24bd53['type']!==_0xf854('0x48')){var _0x5ac2ee={};_0x5ac2ee[_0x24bd53[_0xf854('0x33')]]={'$like':'%'+_0x5d37e3[_0xf854('0x3b')][_0xf854('0x49')]+'%'};return _0x5ac2ee;}})});}_0x327e09=_[_0xf854('0x47')]({},_0x327e09,_0x5d37e3[_0xf854('0x4a')]);var _0x20cb36={'where':_0x327e09[_0xf854('0x45')]};return db[_0xf854('0x36')][_0xf854('0x2b')](_0x20cb36)[_0xf854('0x1b')](function(_0x2274ae){_0x3e7816[_0xf854('0x2b')]=_0x2274ae;if(_0x5d37e3[_0xf854('0x3b')][_0xf854('0x4b')]){_0x327e09['include']=[{'all':!![]}];}return db[_0xf854('0x36')][_0xf854('0x4c')](_0x327e09);})[_0xf854('0x1b')](function(_0x585115){_0x3e7816['rows']=_0x585115;return _0x3e7816;})[_0xf854('0x1b')](respondWithFilteredResult(_0x23173c,_0x327e09))[_0xf854('0x25')](handleError(_0x23173c,null));};exports[_0xf854('0x4d')]=function(_0x4fbf9e,_0x21fc5e){var _0x1f6b52={'raw':!![],'where':{'id':_0x4fbf9e[_0xf854('0x4e')]['id']}},_0x4c3427={};_0x4c3427[_0xf854('0x3a')]=_[_0xf854('0x3c')](db[_0xf854('0x36')][_0xf854('0x37')]);_0x4c3427[_0xf854('0x3b')]=_[_0xf854('0x3c')](_0x4fbf9e[_0xf854('0x3b')]);_0x4c3427[_0xf854('0x3d')]=_[_0xf854('0x3f')](_0x4c3427[_0xf854('0x3a')],_0x4c3427['query']);_0x1f6b52[_0xf854('0x3e')]=_[_0xf854('0x3f')](_0x4c3427[_0xf854('0x3a')],qs[_0xf854('0x40')](_0x4fbf9e[_0xf854('0x3b')][_0xf854('0x40')]));_0x1f6b52[_0xf854('0x3e')]=_0x1f6b52[_0xf854('0x3e')]['length']?_0x1f6b52['attributes']:_0x4c3427[_0xf854('0x3a')];if(_0x4fbf9e[_0xf854('0x3b')]['includeAll']){_0x1f6b52[_0xf854('0x4f')]=[{'all':!![]}];}_0x1f6b52=_[_0xf854('0x47')]({},_0x1f6b52,_0x4fbf9e[_0xf854('0x4a')]);return db['FaxMessage'][_0xf854('0x50')](_0x1f6b52)['then'](handleEntityNotFound(_0x21fc5e,null))[_0xf854('0x1b')](respondWithResult(_0x21fc5e,null))[_0xf854('0x25')](handleError(_0x21fc5e,null));};exports[_0xf854('0x51')]=function(_0x471c11,_0x4b72e1){if(_0x471c11[_0xf854('0x52')]['id']){delete _0x471c11['body']['id'];}return db[_0xf854('0x36')][_0xf854('0x50')]({'where':{'id':_0x471c11['params']['id']}})[_0xf854('0x1b')](handleEntityNotFound(_0x4b72e1,null))[_0xf854('0x1b')](saveUpdates(_0x471c11['body'],null))[_0xf854('0x1b')](respondWithResult(_0x4b72e1,null))[_0xf854('0x25')](handleError(_0x4b72e1,null));};exports[_0xf854('0x30')]=function(_0x3d60d5,_0xb3a53b){return db[_0xf854('0x36')][_0xf854('0x50')]({'where':{'id':_0x3d60d5[_0xf854('0x4e')]['id']}})['then'](handleEntityNotFound(_0xb3a53b,null))[_0xf854('0x1b')](removeEntity(_0xb3a53b,null))[_0xf854('0x25')](handleError(_0xb3a53b,null));};exports[_0xf854('0x53')]=function(_0x51b156,_0xbe36a4){return db[_0xf854('0x36')][_0xf854('0x53')]()[_0xf854('0x1b')](respondWithResult(_0xbe36a4,null))[_0xf854('0x25')](handleError(_0xbe36a4,null));};var interaction_log=require(_0xf854('0xe'))(_0xf854('0x54'));exports[_0xf854('0x55')]=function(_0x2a36ac,_0x32568f,_0xa58df8){var _0x4af8ab={'agent':{},'channel':_0xf854('0x56')};if(_0x2a36ac[_0xf854('0x52')]['id']){delete _0x2a36ac[_0xf854('0x52')]['id'];}_0x2a36ac[_0xf854('0x52')][_0xf854('0x57')]=!![];_0x2a36ac[_0xf854('0x52')][_0xf854('0x58')]=moment()[_0xf854('0x59')](_0xf854('0x5a'));_0x2a36ac['body']['UserId']=_0x2a36ac[_0xf854('0x52')][_0xf854('0x5b')]||_0x2a36ac['user']['id'];_0x4af8ab['agent']['id']=_0x2a36ac[_0xf854('0x52')]['UserId'];return db[_0xf854('0x36')][_0xf854('0x50')]({'where':{'id':_0x2a36ac[_0xf854('0x4e')]['id'],'UserId':null}})[_0xf854('0x1b')](handleEntityNotFound(_0x32568f,null))[_0xf854('0x1b')](saveUpdates(_0x2a36ac[_0xf854('0x52')],null))[_0xf854('0x1b')](function(_0x1ee498){if(_0x1ee498){_0x4af8ab[_0xf854('0x22')]=_0x1ee498[_0xf854('0x5c')]({'plain':!![]});return db[_0xf854('0x5d')]['find']({'where':{'id':_0x1ee498['FaxInteractionId']}});}return null;})[_0xf854('0x1b')](handleEntityNotFound(_0x32568f,null))[_0xf854('0x1b')](function(_0x322bde){if(_0x322bde){return _0x322bde[_0xf854('0x51')]({'UserId':_0x2a36ac[_0xf854('0x52')][_0xf854('0x5b')],'read1stAt':_['isNil'](_0x322bde[_0xf854('0x5e')])?moment()['format'](_0xf854('0x5a')):undefined});}return null;})['then'](function(_0x185e96){if(_0x185e96){_0x4af8ab['interaction']=_0x185e96[_0xf854('0x5c')]({'plain':!![]});interaction_log['info'](_0xf854('0x5f'),_0x2a36ac[_0xf854('0x60')]['id'],_0x2a36ac[_0xf854('0x60')][_0xf854('0x33')],_0x2a36ac[_0xf854('0x60')]['role'],_0x4af8ab['interaction']['id'],_0x2a36ac[_0xf854('0x52')]?JSON[_0xf854('0x1f')](_0x2a36ac[_0xf854('0x52')]):'null');return respondWithRpcPromise(_0xf854('0x61'),_0xf854('0x62'),_0x4af8ab);}return null;})[_0xf854('0x1b')](function(_0x5bba){var _0xba6c88=_0xf854('0x63')+_0x5bba[_0xf854('0x22')]['ContactId'];return db[_0xf854('0x64')][_0xf854('0x3b')](_0xba6c88,{'type':db[_0xf854('0x65')][_0xf854('0x66')][_0xf854('0x67')],'raw':!![]})[_0xf854('0x1b')](function(_0x5f2760){return _0x5f2760;});})[_0xf854('0x1b')](function(_0x2bef8c){if(_0x2bef8c){_0x4af8ab[_0xf854('0x22')][_0xf854('0x68')]=_0x2bef8c[0x0];if(!_0x2a36ac[_0xf854('0x52')][_0xf854('0x5b')])return;return db[_0xf854('0x69')][_0xf854('0x50')]({'where':{'id':_0x2a36ac[_0xf854('0x52')][_0xf854('0x5b')],'role':_0xf854('0x6a')},'attributes':['id',_0xf854('0x33'),'fullname',_0xf854('0x6b'),_0xf854('0x6c')],'raw':!![]});}return null;})[_0xf854('0x1b')](function(_0x171249){if(!_0x171249)return null;_0x4af8ab['message'][_0xf854('0x6a')]=_0x171249;return _0x4af8ab;})[_0xf854('0x1b')](function(_0x2556ed){if(_0x2556ed){if(_0x2a36ac[_0xf854('0x52')][_0xf854('0x6d')]){_0x4af8ab['message'][_0xf854('0x6e')]=util[_0xf854('0x59')](_0xf854('0x6f'),_0x2a36ac['user'][_0xf854('0x33')]);_0x4af8ab['message'][_0xf854('0x70')]=_0x4af8ab['channel'];_0x4af8ab[_0xf854('0x22')][_0xf854('0x71')]=_0x4af8ab[_0xf854('0x70')];_0x4af8ab['message'][_0xf854('0x72')]=_0xf854('0x55');return respondWithRpcPromise(_0xf854('0x73'),_0xf854('0x73'),{'event':'acceptmessage','message':_0x4af8ab['message']},client9002)[_0xf854('0x1b')](function(){return _0x4af8ab;});}return _0x4af8ab;}return null;})[_0xf854('0x1b')](respondWithResult(_0x32568f,null))[_0xf854('0x25')](handleError(_0x32568f,null));};var interaction_log=require(_0xf854('0xe'))(_0xf854('0x54'));exports[_0xf854('0x74')]=function(_0x287396,_0x2464bc,_0x4719c2){var _0xcf6cae={'agent':{},'channel':_0xf854('0x56')};if(_0x287396['body']['id']){delete _0x287396[_0xf854('0x52')]['id'];}_0x287396['body'][_0xf854('0x5b')]=_0x287396[_0xf854('0x52')][_0xf854('0x5b')]||_0x287396['user']['id'];_0xcf6cae[_0xf854('0x6a')]['id']=_0x287396[_0xf854('0x52')][_0xf854('0x5b')];return db[_0xf854('0x36')][_0xf854('0x50')]({'where':{'id':_0x287396[_0xf854('0x4e')]['id'],'UserId':null}})[_0xf854('0x1b')](handleEntityNotFound(_0x2464bc,null))[_0xf854('0x1b')](function(_0x3bb338){if(_0x3bb338){_0xcf6cae[_0xf854('0x22')]=_0x3bb338[_0xf854('0x5c')]({'plain':!![]});return db[_0xf854('0x5d')][_0xf854('0x50')]({'where':{'id':_0x3bb338['FaxInteractionId']}});}return null;})[_0xf854('0x1b')](handleEntityNotFound(_0x2464bc,null))[_0xf854('0x1b')](function(_0x3cb298){if(_0x3cb298){_0xcf6cae[_0xf854('0x75')]=_0x3cb298[_0xf854('0x5c')]({'plain':!![]});interaction_log[_0xf854('0x1c')](_0xf854('0x76'),_0x287396['user']['id'],_0x287396[_0xf854('0x60')][_0xf854('0x33')],_0x287396[_0xf854('0x60')][_0xf854('0x77')],_0xcf6cae[_0xf854('0x75')]['id'],_0x287396[_0xf854('0x52')]?JSON['stringify'](_0x287396[_0xf854('0x52')]):'null');return respondWithRpcPromise(_0xf854('0x78'),_0xf854('0x79'),_0xcf6cae);}return null;})[_0xf854('0x1b')](function(_0x261723){var _0x5f039c=_0xf854('0x63')+_0x261723[_0xf854('0x22')]['ContactId'];return db[_0xf854('0x64')]['query'](_0x5f039c,{'type':db['Sequelize'][_0xf854('0x66')][_0xf854('0x67')],'raw':!![]})[_0xf854('0x1b')](function(_0x476472){return _0x476472;});})[_0xf854('0x1b')](function(_0x3be438){if(_0x3be438){_0xcf6cae[_0xf854('0x22')][_0xf854('0x68')]=_0x3be438[0x0];if(!_0x287396['body']['UserId'])return;return db[_0xf854('0x69')][_0xf854('0x50')]({'where':{'id':_0x287396['body'][_0xf854('0x5b')],'role':_0xf854('0x6a')},'attributes':['id','name',_0xf854('0x7a'),_0xf854('0x6b'),_0xf854('0x6c')],'raw':!![]});}return null;})['then'](function(_0x332b8b){if(!_0x332b8b)return null;_0xcf6cae[_0xf854('0x22')][_0xf854('0x6a')]=_0x332b8b;return _0xcf6cae;})[_0xf854('0x1b')](function(_0x3150a1){if(_0x3150a1){_0x3150a1[_0xf854('0x22')][_0xf854('0x6e')]=util[_0xf854('0x59')]('SIP/%s',_0x287396[_0xf854('0x60')][_0xf854('0x33')]);_0x3150a1['message']['channel']=_0xcf6cae[_0xf854('0x70')];_0x3150a1[_0xf854('0x22')]['motionChannel']=_0xcf6cae[_0xf854('0x70')];_0x3150a1['message'][_0xf854('0x72')]=_0xf854('0x74');respondWithRpcPromise('EventManager',_0xf854('0x73'),{'event':_0xf854('0x7b'),'message':_0x3150a1[_0xf854('0x22')]},client9002);return _0xcf6cae;}return null;})[_0xf854('0x1b')](respondWithResult(_0x2464bc,null))[_0xf854('0x25')](handleError(_0x2464bc,null));};exports[_0xf854('0x7c')]=function(_0x191230,_0x4175bd){var _0x57c39e;return db[_0xf854('0x36')][_0xf854('0x7c')](_0x191230[_0xf854('0x52')],{})[_0xf854('0x1b')](function(_0x126c21){_0x57c39e=_0x126c21;return db[_0xf854('0x7d')][_0xf854('0x7e')]({'where':{'id':_0x57c39e[_0xf854('0x7f')]}});})[_0xf854('0x1b')](function(_0x43ad4c){if(_['isNil'](_0x43ad4c)){return;}else{_0x57c39e[_0xf854('0x56')]=_0x43ad4c[_0xf854('0x56')];return db[_0xf854('0x80')][_0xf854('0x7e')]({'where':{'id':_0x57c39e[_0xf854('0x81')]}});}})[_0xf854('0x1b')](function(_0x14e9a9){return respondWithRpcPromise(_0xf854('0x82'),'SendFax',{'FaxAccountId':_[_0xf854('0x83')](_0x191230[_0xf854('0x52')])?undefined:_0x191230[_0xf854('0x52')][_0xf854('0x84')],'path':_[_0xf854('0x83')](_0x14e9a9)?undefined:util['format'](_0xf854('0x85'),_0x14e9a9[_0xf854('0x86')]),'fax':_[_0xf854('0x83')](_0x57c39e[_0xf854('0x56')])?undefined:_0x57c39e[_0xf854('0x56')],'AttachmentId':_0x57c39e[_0xf854('0x81')]},client9002);})['then'](respondWithResult(_0x4175bd,0xc9))[_0xf854('0x25')](handleError(_0x4175bd,null));};exports['download']=function(_0x45c497,_0x8d8110){var _0x1c1bba=path['join'](config['root'],'server','files',_0xf854('0x87'));return db[_0xf854('0x36')][_0xf854('0x50')]({'where':{'id':_0x45c497[_0xf854('0x4e')]['id']},'include':[{'model':db[_0xf854('0x80')],'as':_0xf854('0x80')}]})['then'](handleEntityNotFound(_0x8d8110,null))[_0xf854('0x1b')](function(_0x2397e5){if(_0x2397e5){return _0x8d8110['download'](path[_0xf854('0x88')](_0x1c1bba,_0x2397e5['Attachment']['basename']));}})[_0xf854('0x25')](handleError(_0x8d8110,null));}; \ No newline at end of file +var _0xa4b8=['fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../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','jayson/promise','client','http','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','map','FaxMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','length','options','body','find','params','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User'];(function(_0x35ecd1,_0xfd0161){var _0x1f4fdd=function(_0x40581b){while(--_0x40581b){_0x35ecd1['push'](_0x35ecd1['shift']());}};_0x1f4fdd(++_0xfd0161);}(_0xa4b8,0x1db));var _0x8a4b=function(_0x1946ec,_0x27c21b){_0x1946ec=_0x1946ec-0x0;var _0x2e3bb3=_0xa4b8[_0x1946ec];return _0x2e3bb3;};'use strict';var emlformat=require(_0x8a4b('0x0'));var rimraf=require(_0x8a4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a4b('0x2'));var rp=require(_0x8a4b('0x3'));var moment=require('moment');var BPromise=require(_0x8a4b('0x4'));var Mustache=require(_0x8a4b('0x5'));var util=require('util');var path=require(_0x8a4b('0x6'));var sox=require(_0x8a4b('0x7'));var csv=require(_0x8a4b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a4b('0x9'));var _=require(_0x8a4b('0xa'));var squel=require('squel');var crypto=require(_0x8a4b('0xb'));var jsforce=require(_0x8a4b('0xc'));var deskjs=require(_0x8a4b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8a4b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a4b('0xf'));var qs=require(_0x8a4b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a4b('0x11'));var logger=require(_0x8a4b('0x12'))(_0x8a4b('0x13'));var utils=require(_0x8a4b('0x14'));var config=require(_0x8a4b('0x15'));var licenseUtil=require(_0x8a4b('0x16'));var db=require(_0x8a4b('0x17'))['db'];config[_0x8a4b('0x18')]=_[_0x8a4b('0x19')](config[_0x8a4b('0x18')],{'host':_0x8a4b('0x1a'),'port':0x18eb});var socket=require(_0x8a4b('0x1b'))(new Redis(config[_0x8a4b('0x18')]));require('./faxMessage.socket')[_0x8a4b('0x1c')](socket);var jayson=require(_0x8a4b('0x1d'));var client=jayson[_0x8a4b('0x1e')][_0x8a4b('0x1f')]({'port':0x232c});var client9002=jayson[_0x8a4b('0x1e')][_0x8a4b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x152c2d,_0x1d5ac0,_0x1da385,_0x54bda8){return new BPromise(function(_0x677cfc,_0x5e55cb){var _0x2d7ab1=_0x54bda8||client;return _0x2d7ab1['request'](_0x152c2d,_0x1da385)[_0x8a4b('0x20')](function(_0xfafbc9){logger[_0x8a4b('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1d5ac0,_0x8a4b('0x22'));logger[_0x8a4b('0x23')](_0x8a4b('0x24'),_0x1d5ac0,_0x8a4b('0x22'),JSON[_0x8a4b('0x25')](_0xfafbc9));if(_0xfafbc9[_0x8a4b('0x26')]){if(_0xfafbc9[_0x8a4b('0x26')]['code']===0x1f4){logger[_0x8a4b('0x26')](_0x8a4b('0x27'),_0x1d5ac0,_0xfafbc9[_0x8a4b('0x26')][_0x8a4b('0x28')]);return _0x5e55cb(_0xfafbc9[_0x8a4b('0x26')][_0x8a4b('0x28')]);}logger['error'](_0x8a4b('0x27'),_0x1d5ac0,_0xfafbc9[_0x8a4b('0x26')][_0x8a4b('0x28')]);return _0x677cfc(_0xfafbc9[_0x8a4b('0x26')]['message']);}else{logger[_0x8a4b('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1d5ac0,_0x8a4b('0x22'));_0x677cfc(_0xfafbc9[_0x8a4b('0x29')]['message']);}})['catch'](function(_0x265c85){logger[_0x8a4b('0x26')](_0x8a4b('0x27'),_0x1d5ac0,_0x265c85);_0x5e55cb(_0x265c85);});});}function respondWithStatusCode(_0x1c3cc8,_0x2c307f){_0x2c307f=_0x2c307f||0xcc;return function(_0x4ed866){if(_0x4ed866){return _0x1c3cc8[_0x8a4b('0x2a')](_0x2c307f);}return _0x1c3cc8[_0x8a4b('0x2b')](_0x2c307f)[_0x8a4b('0x2c')]();};}function respondWithResult(_0x481e5a,_0x2db662){_0x2db662=_0x2db662||0xc8;return function(_0x3e4466){if(_0x3e4466){return _0x481e5a[_0x8a4b('0x2b')](_0x2db662)[_0x8a4b('0x2d')](_0x3e4466);}};}function respondWithFilteredResult(_0x2f189d,_0x2a0f02){return function(_0x4d2c9a){if(_0x4d2c9a){var _0x530797=typeof _0x2a0f02[_0x8a4b('0x2e')]===_0x8a4b('0x2f')&&typeof _0x2a0f02[_0x8a4b('0x30')]==='undefined';var _0x37f0a0=_0x4d2c9a[_0x8a4b('0x31')];var _0x1ced42=_0x530797?0x0:_0x2a0f02[_0x8a4b('0x2e')];var _0x3b5f03=_0x530797?_0x4d2c9a[_0x8a4b('0x31')]:_0x2a0f02['offset']+_0x2a0f02[_0x8a4b('0x30')];var _0x4172d9;if(_0x3b5f03>=_0x37f0a0){_0x3b5f03=_0x37f0a0;_0x4172d9=0xc8;}else{_0x4172d9=0xce;}_0x2f189d[_0x8a4b('0x2b')](_0x4172d9);return _0x2f189d[_0x8a4b('0x32')](_0x8a4b('0x33'),_0x1ced42+'-'+_0x3b5f03+'/'+_0x37f0a0)[_0x8a4b('0x2d')](_0x4d2c9a);}return null;};}function patchUpdates(_0x3361e6){return function(_0x3bf98d){try{jsonpatch[_0x8a4b('0x34')](_0x3bf98d,_0x3361e6,!![]);}catch(_0x1443ab){return BPromise['reject'](_0x1443ab);}return _0x3bf98d[_0x8a4b('0x35')]();};}function saveUpdates(_0x5606fd,_0x3d1be8){return function(_0x12e8f0){if(_0x12e8f0){return _0x12e8f0[_0x8a4b('0x36')](_0x5606fd)[_0x8a4b('0x20')](function(_0x311efd){return _0x311efd;});}return null;};}function removeEntity(_0x4ee0e4,_0x36a0fa){return function(_0x1e3af9){if(_0x1e3af9){return _0x1e3af9[_0x8a4b('0x37')]()[_0x8a4b('0x20')](function(){_0x4ee0e4[_0x8a4b('0x2b')](0xcc)[_0x8a4b('0x2c')]();});}};}function handleEntityNotFound(_0x46197d,_0x59271e){return function(_0x31f1ca){if(!_0x31f1ca){_0x46197d[_0x8a4b('0x2a')](0x194);}return _0x31f1ca;};}function handleError(_0x4a1c27,_0x5e76d4){_0x5e76d4=_0x5e76d4||0x1f4;return function(_0x1169f6){logger[_0x8a4b('0x26')](_0x1169f6[_0x8a4b('0x38')]);if(_0x1169f6['name']){delete _0x1169f6[_0x8a4b('0x39')];}_0x4a1c27[_0x8a4b('0x2b')](_0x5e76d4)[_0x8a4b('0x3a')](_0x1169f6);};}exports['index']=function(_0x552841,_0x544312){var _0x4ce661={},_0x310eb8={},_0x29f908={'count':0x0,'rows':[]};var _0x1fcfb2=_[_0x8a4b('0x3b')](db[_0x8a4b('0x3c')][_0x8a4b('0x3d')],function(_0x17a06a){return{'name':_0x17a06a[_0x8a4b('0x3e')],'type':_0x17a06a['type']['key']};});_0x310eb8[_0x8a4b('0x3f')]=_[_0x8a4b('0x3b')](_0x1fcfb2,_0x8a4b('0x39'));_0x310eb8[_0x8a4b('0x40')]=_[_0x8a4b('0x41')](_0x552841[_0x8a4b('0x40')]);_0x310eb8[_0x8a4b('0x42')]=_[_0x8a4b('0x43')](_0x310eb8[_0x8a4b('0x3f')],_0x310eb8[_0x8a4b('0x40')]);_0x4ce661[_0x8a4b('0x44')]=_['intersection'](_0x310eb8[_0x8a4b('0x3f')],qs['fields'](_0x552841['query'][_0x8a4b('0x45')]));_0x4ce661[_0x8a4b('0x44')]=_0x4ce661[_0x8a4b('0x44')]['length']?_0x4ce661[_0x8a4b('0x44')]:_0x310eb8['model'];if(!_0x552841['query'][_0x8a4b('0x46')](_0x8a4b('0x47'))){_0x4ce661['limit']=qs[_0x8a4b('0x30')](_0x552841[_0x8a4b('0x40')][_0x8a4b('0x30')]);_0x4ce661['offset']=qs[_0x8a4b('0x2e')](_0x552841[_0x8a4b('0x40')][_0x8a4b('0x2e')]);}_0x4ce661[_0x8a4b('0x48')]=qs['sort'](_0x552841[_0x8a4b('0x40')]['sort']);_0x4ce661[_0x8a4b('0x49')]=qs[_0x8a4b('0x42')](_[_0x8a4b('0x4a')](_0x552841['query'],_0x310eb8['filters']),_0x1fcfb2);if(_0x552841[_0x8a4b('0x40')][_0x8a4b('0x4b')]){_0x4ce661[_0x8a4b('0x49')]=_[_0x8a4b('0x4c')](_0x4ce661[_0x8a4b('0x49')],{'$or':_[_0x8a4b('0x3b')](_0x1fcfb2,function(_0x33c6fe){if(_0x33c6fe[_0x8a4b('0x4d')]!=='VIRTUAL'){var _0x194409={};_0x194409[_0x33c6fe[_0x8a4b('0x39')]]={'$like':'%'+_0x552841[_0x8a4b('0x40')][_0x8a4b('0x4b')]+'%'};return _0x194409;}})});}_0x4ce661=_[_0x8a4b('0x4c')]({},_0x4ce661,_0x552841['options']);var _0x45a7f3={'where':_0x4ce661[_0x8a4b('0x49')]};return db[_0x8a4b('0x3c')]['count'](_0x45a7f3)[_0x8a4b('0x20')](function(_0x3f6037){_0x29f908[_0x8a4b('0x31')]=_0x3f6037;if(_0x552841[_0x8a4b('0x40')][_0x8a4b('0x4e')]){_0x4ce661[_0x8a4b('0x4f')]=[{'all':!![]}];}return db['FaxMessage'][_0x8a4b('0x50')](_0x4ce661);})[_0x8a4b('0x20')](function(_0x442be9){_0x29f908[_0x8a4b('0x51')]=_0x442be9;return _0x29f908;})[_0x8a4b('0x20')](respondWithFilteredResult(_0x544312,_0x4ce661))[_0x8a4b('0x52')](handleError(_0x544312,null));};exports['show']=function(_0x4f4d79,_0x22f46c){var _0x3747ca={'raw':!![],'where':{'id':_0x4f4d79['params']['id']}},_0xa7759c={};_0xa7759c[_0x8a4b('0x3f')]=_[_0x8a4b('0x41')](db['FaxMessage']['rawAttributes']);_0xa7759c['query']=_[_0x8a4b('0x41')](_0x4f4d79[_0x8a4b('0x40')]);_0xa7759c['filters']=_['intersection'](_0xa7759c['model'],_0xa7759c['query']);_0x3747ca[_0x8a4b('0x44')]=_[_0x8a4b('0x43')](_0xa7759c[_0x8a4b('0x3f')],qs['fields'](_0x4f4d79[_0x8a4b('0x40')][_0x8a4b('0x45')]));_0x3747ca[_0x8a4b('0x44')]=_0x3747ca['attributes'][_0x8a4b('0x53')]?_0x3747ca[_0x8a4b('0x44')]:_0xa7759c[_0x8a4b('0x3f')];if(_0x4f4d79[_0x8a4b('0x40')][_0x8a4b('0x4e')]){_0x3747ca[_0x8a4b('0x4f')]=[{'all':!![]}];}_0x3747ca=_[_0x8a4b('0x4c')]({},_0x3747ca,_0x4f4d79[_0x8a4b('0x54')]);return db[_0x8a4b('0x3c')]['find'](_0x3747ca)[_0x8a4b('0x20')](handleEntityNotFound(_0x22f46c,null))[_0x8a4b('0x20')](respondWithResult(_0x22f46c,null))['catch'](handleError(_0x22f46c,null));};exports[_0x8a4b('0x36')]=function(_0x38bafc,_0x21299){if(_0x38bafc['body']['id']){delete _0x38bafc[_0x8a4b('0x55')]['id'];}return db['FaxMessage'][_0x8a4b('0x56')]({'where':{'id':_0x38bafc[_0x8a4b('0x57')]['id']}})[_0x8a4b('0x20')](handleEntityNotFound(_0x21299,null))[_0x8a4b('0x20')](saveUpdates(_0x38bafc[_0x8a4b('0x55')],null))[_0x8a4b('0x20')](respondWithResult(_0x21299,null))[_0x8a4b('0x52')](handleError(_0x21299,null));};exports[_0x8a4b('0x37')]=function(_0x4a4ca2,_0x2950da){return db[_0x8a4b('0x3c')][_0x8a4b('0x56')]({'where':{'id':_0x4a4ca2[_0x8a4b('0x57')]['id']}})[_0x8a4b('0x20')](handleEntityNotFound(_0x2950da,null))[_0x8a4b('0x20')](removeEntity(_0x2950da,null))[_0x8a4b('0x52')](handleError(_0x2950da,null));};exports[_0x8a4b('0x58')]=function(_0x334840,_0x27bc65){return db[_0x8a4b('0x3c')]['describe']()['then'](respondWithResult(_0x27bc65,null))[_0x8a4b('0x52')](handleError(_0x27bc65,null));};var interaction_log=require(_0x8a4b('0x12'))(_0x8a4b('0x59'));exports[_0x8a4b('0x5a')]=function(_0x2f73b9,_0x23785a,_0x43ed60){var _0x1a2b08={'agent':{},'channel':'fax'};if(_0x2f73b9['body']['id']){delete _0x2f73b9['body']['id'];}_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5b')]=!![];_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5c')]=moment()[_0x8a4b('0x5d')](_0x8a4b('0x5e'));_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5f')]=_0x2f73b9[_0x8a4b('0x55')]['UserId']||_0x2f73b9[_0x8a4b('0x60')]['id'];_0x1a2b08[_0x8a4b('0x61')]['id']=_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5f')];return db[_0x8a4b('0x3c')][_0x8a4b('0x56')]({'where':{'id':_0x2f73b9[_0x8a4b('0x57')]['id'],'UserId':null}})[_0x8a4b('0x20')](handleEntityNotFound(_0x23785a,null))[_0x8a4b('0x20')](saveUpdates(_0x2f73b9[_0x8a4b('0x55')],null))['then'](function(_0x5881bf){if(_0x5881bf){_0x1a2b08[_0x8a4b('0x28')]=_0x5881bf[_0x8a4b('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x8a4b('0x56')]({'where':{'id':_0x5881bf['FaxInteractionId']}});}return null;})[_0x8a4b('0x20')](handleEntityNotFound(_0x23785a,null))[_0x8a4b('0x20')](function(_0x13f88f){if(_0x13f88f){return _0x13f88f['update']({'UserId':_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5f')],'read1stAt':_[_0x8a4b('0x63')](_0x13f88f[_0x8a4b('0x64')])?moment()[_0x8a4b('0x5d')](_0x8a4b('0x5e')):undefined});}return null;})['then'](function(_0x59e8c7){if(_0x59e8c7){_0x1a2b08['interaction']=_0x59e8c7[_0x8a4b('0x62')]({'plain':!![]});interaction_log['info'](_0x8a4b('0x65'),_0x2f73b9[_0x8a4b('0x60')]['id'],_0x2f73b9[_0x8a4b('0x60')][_0x8a4b('0x39')],_0x2f73b9[_0x8a4b('0x60')][_0x8a4b('0x66')],_0x1a2b08[_0x8a4b('0x67')]['id'],_0x2f73b9[_0x8a4b('0x55')]?JSON[_0x8a4b('0x25')](_0x2f73b9[_0x8a4b('0x55')]):_0x8a4b('0x68'));return respondWithRpcPromise(_0x8a4b('0x69'),_0x8a4b('0x6a'),_0x1a2b08);}return null;})[_0x8a4b('0x20')](function(_0x3c181d){var _0x3298ca=_0x8a4b('0x6b')+_0x3c181d[_0x8a4b('0x28')][_0x8a4b('0x6c')];return db[_0x8a4b('0x6d')][_0x8a4b('0x40')](_0x3298ca,{'type':db['Sequelize'][_0x8a4b('0x6e')][_0x8a4b('0x6f')],'raw':!![]})['then'](function(_0x276037){return _0x276037;});})[_0x8a4b('0x20')](function(_0x4718af){if(_0x4718af){_0x1a2b08[_0x8a4b('0x28')]['contact']=_0x4718af[0x0];if(!_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5f')])return;return db[_0x8a4b('0x70')]['find']({'where':{'id':_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x5f')],'role':_0x8a4b('0x61')},'attributes':['id',_0x8a4b('0x39'),_0x8a4b('0x71'),_0x8a4b('0x72'),_0x8a4b('0x73')],'raw':!![]});}return null;})['then'](function(_0x63d54f){if(!_0x63d54f)return null;_0x1a2b08[_0x8a4b('0x28')][_0x8a4b('0x61')]=_0x63d54f;return _0x1a2b08;})[_0x8a4b('0x20')](function(_0x2d3fdf){if(_0x2d3fdf){if(_0x2f73b9[_0x8a4b('0x55')][_0x8a4b('0x74')]){_0x1a2b08[_0x8a4b('0x28')][_0x8a4b('0x75')]=util[_0x8a4b('0x5d')](_0x8a4b('0x76'),_0x2f73b9[_0x8a4b('0x60')]['name']);_0x1a2b08[_0x8a4b('0x28')][_0x8a4b('0x77')]=_0x1a2b08[_0x8a4b('0x77')];_0x1a2b08['message'][_0x8a4b('0x78')]=_0x1a2b08[_0x8a4b('0x77')];_0x1a2b08[_0x8a4b('0x28')][_0x8a4b('0x79')]=_0x8a4b('0x5a');return respondWithRpcPromise(_0x8a4b('0x7a'),_0x8a4b('0x7a'),{'event':'acceptmessage','message':_0x1a2b08[_0x8a4b('0x28')]},client9002)[_0x8a4b('0x20')](function(){return _0x1a2b08;});}return _0x1a2b08;}return null;})['then'](respondWithResult(_0x23785a,null))[_0x8a4b('0x52')](handleError(_0x23785a,null));};var interaction_log=require(_0x8a4b('0x12'))(_0x8a4b('0x59'));exports[_0x8a4b('0x7b')]=function(_0x506a07,_0x8be037,_0x37229c){var _0x4ed8b3={'agent':{},'channel':_0x8a4b('0x7c')};if(_0x506a07[_0x8a4b('0x55')]['id']){delete _0x506a07[_0x8a4b('0x55')]['id'];}_0x506a07[_0x8a4b('0x55')][_0x8a4b('0x5f')]=_0x506a07['body'][_0x8a4b('0x5f')]||_0x506a07[_0x8a4b('0x60')]['id'];_0x4ed8b3[_0x8a4b('0x61')]['id']=_0x506a07[_0x8a4b('0x55')][_0x8a4b('0x5f')];return db[_0x8a4b('0x3c')][_0x8a4b('0x56')]({'where':{'id':_0x506a07[_0x8a4b('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x8be037,null))[_0x8a4b('0x20')](function(_0x3be469){if(_0x3be469){_0x4ed8b3[_0x8a4b('0x28')]=_0x3be469[_0x8a4b('0x62')]({'plain':!![]});return db[_0x8a4b('0x7d')]['find']({'where':{'id':_0x3be469['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x8be037,null))['then'](function(_0x37c484){if(_0x37c484){_0x4ed8b3[_0x8a4b('0x67')]=_0x37c484['get']({'plain':!![]});interaction_log[_0x8a4b('0x21')](_0x8a4b('0x7e'),_0x506a07[_0x8a4b('0x60')]['id'],_0x506a07[_0x8a4b('0x60')][_0x8a4b('0x39')],_0x506a07[_0x8a4b('0x60')][_0x8a4b('0x66')],_0x4ed8b3[_0x8a4b('0x67')]['id'],_0x506a07[_0x8a4b('0x55')]?JSON[_0x8a4b('0x25')](_0x506a07[_0x8a4b('0x55')]):'null');return respondWithRpcPromise(_0x8a4b('0x7f'),_0x8a4b('0x80'),_0x4ed8b3);}return null;})[_0x8a4b('0x20')](function(_0x53dcd4){var _0x2ceef2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53dcd4[_0x8a4b('0x28')][_0x8a4b('0x6c')];return db[_0x8a4b('0x6d')][_0x8a4b('0x40')](_0x2ceef2,{'type':db[_0x8a4b('0x81')][_0x8a4b('0x6e')]['SELECT'],'raw':!![]})[_0x8a4b('0x20')](function(_0x26c513){return _0x26c513;});})[_0x8a4b('0x20')](function(_0x59b639){if(_0x59b639){_0x4ed8b3[_0x8a4b('0x28')][_0x8a4b('0x82')]=_0x59b639[0x0];if(!_0x506a07['body'][_0x8a4b('0x5f')])return;return db[_0x8a4b('0x70')]['find']({'where':{'id':_0x506a07['body'][_0x8a4b('0x5f')],'role':_0x8a4b('0x61')},'attributes':['id','name',_0x8a4b('0x71'),_0x8a4b('0x72'),'internal'],'raw':!![]});}return null;})[_0x8a4b('0x20')](function(_0x437484){if(!_0x437484)return null;_0x4ed8b3[_0x8a4b('0x28')][_0x8a4b('0x61')]=_0x437484;return _0x4ed8b3;})[_0x8a4b('0x20')](function(_0x38a567){if(_0x38a567){_0x38a567['message'][_0x8a4b('0x75')]=util['format'](_0x8a4b('0x76'),_0x506a07[_0x8a4b('0x60')]['name']);_0x38a567[_0x8a4b('0x28')][_0x8a4b('0x77')]=_0x4ed8b3[_0x8a4b('0x77')];_0x38a567['message'][_0x8a4b('0x78')]=_0x4ed8b3[_0x8a4b('0x77')];_0x38a567[_0x8a4b('0x28')][_0x8a4b('0x79')]=_0x8a4b('0x7b');respondWithRpcPromise(_0x8a4b('0x7a'),'EventManager',{'event':_0x8a4b('0x83'),'message':_0x38a567[_0x8a4b('0x28')]},client9002);return _0x4ed8b3;}return null;})[_0x8a4b('0x20')](respondWithResult(_0x8be037,null))['catch'](handleError(_0x8be037,null));};exports[_0x8a4b('0x84')]=function(_0x4ec605,_0x198a03){var _0x9c4096;return db[_0x8a4b('0x3c')][_0x8a4b('0x84')](_0x4ec605[_0x8a4b('0x55')],{})[_0x8a4b('0x20')](function(_0x5f3136){_0x9c4096=_0x5f3136;return db[_0x8a4b('0x85')][_0x8a4b('0x86')]({'where':{'id':_0x9c4096[_0x8a4b('0x6c')]}});})[_0x8a4b('0x20')](function(_0x361eff){if(_[_0x8a4b('0x63')](_0x361eff)){return;}else{_0x9c4096[_0x8a4b('0x7c')]=_0x361eff[_0x8a4b('0x7c')];return db[_0x8a4b('0x87')][_0x8a4b('0x86')]({'where':{'id':_0x9c4096[_0x8a4b('0x88')]}});}})[_0x8a4b('0x20')](function(_0x3999f1){return respondWithRpcPromise('SendFax',_0x8a4b('0x89'),{'FaxAccountId':_[_0x8a4b('0x63')](_0x4ec605[_0x8a4b('0x55')])?undefined:_0x4ec605[_0x8a4b('0x55')][_0x8a4b('0x8a')],'path':_[_0x8a4b('0x63')](_0x3999f1)?undefined:util[_0x8a4b('0x5d')](_0x8a4b('0x8b'),_0x3999f1[_0x8a4b('0x8c')]),'fax':_[_0x8a4b('0x63')](_0x9c4096[_0x8a4b('0x7c')])?undefined:_0x9c4096[_0x8a4b('0x7c')],'AttachmentId':_0x9c4096['AttachmentId']},client9002);})[_0x8a4b('0x20')](respondWithResult(_0x198a03,0xc9))[_0x8a4b('0x52')](handleError(_0x198a03,null));};exports['download']=function(_0x27d702,_0x57d0d8){var _0xdf9c35=path[_0x8a4b('0x8d')](config[_0x8a4b('0x8e')],_0x8a4b('0x8f'),_0x8a4b('0x90'),_0x8a4b('0x91'));return db['FaxMessage'][_0x8a4b('0x56')]({'where':{'id':_0x27d702['params']['id']},'include':[{'model':db[_0x8a4b('0x87')],'as':_0x8a4b('0x87')}]})[_0x8a4b('0x20')](handleEntityNotFound(_0x57d0d8,null))[_0x8a4b('0x20')](function(_0x2477b6){if(_0x2477b6){return _0x57d0d8[_0x8a4b('0x92')](path[_0x8a4b('0x8d')](_0xdf9c35,_0x2477b6['Attachment'][_0x8a4b('0x8c')]));}})['catch'](handleError(_0x57d0d8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index fa86578..646fb8d 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 _0xc14a=['FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5459b0,_0x4d2ef8){var _0x675a35=function(_0x538e11){while(--_0x538e11){_0x5459b0['push'](_0x5459b0['shift']());}};_0x675a35(++_0x4d2ef8);}(_0xc14a,0xa9));var _0xac14=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc14a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xac14('0x0'));var FaxMessage=require(_0xac14('0x1'))['db'][_0xac14('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xac14('0x3')](0x0);var events={'afterCreate':_0xac14('0x4'),'afterUpdate':'update','afterDestroy':_0xac14('0x5')};function emitEvent(_0x21c4da){return function(_0x53f3d1,_0x412485,_0x525320){FaxMessageEvents[_0xac14('0x6')](_0x21c4da+':'+_0x53f3d1['id'],_0x53f3d1);FaxMessageEvents[_0xac14('0x6')](_0x21c4da,_0x53f3d1);_0x525320(null);};}for(var e in events){if(events[_0xac14('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xac14('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x89b8=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0x89b8,0x19f));var _0x889b=function(_0x56d6a7,_0x53db8d){_0x56d6a7=_0x56d6a7-0x0;var _0x2ed1bc=_0x89b8[_0x56d6a7];return _0x2ed1bc;};'use strict';var EventEmitter=require(_0x889b('0x0'));var FaxMessage=require(_0x889b('0x1'))['db'][_0x889b('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x889b('0x3')](0x0);var events={'afterCreate':_0x889b('0x4'),'afterUpdate':_0x889b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x383d3c){return function(_0x1d4725,_0x3db972,_0x58ae50){FaxMessageEvents[_0x889b('0x6')](_0x383d3c+':'+_0x1d4725['id'],_0x1d4725);FaxMessageEvents[_0x889b('0x6')](_0x383d3c,_0x1d4725);_0x58ae50(null);};}for(var e in events){if(events[_0x889b('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x889b('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 8697568..aa805a8 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 _0xfa83=['moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa83,0x1cd));var _0x3fa8=function(_0x217abd,_0x4206f6){_0x217abd=_0x217abd-0x0;var _0x5d165d=_0xfa83[_0x217abd];return _0x5d165d;};'use strict';var _=require(_0x3fa8('0x0'));var util=require(_0x3fa8('0x1'));var logger=require('../../config/logger')(_0x3fa8('0x2'));var moment=require(_0x3fa8('0x3'));var BPromise=require(_0x3fa8('0x4'));var rp=require(_0x3fa8('0x5'));var fs=require('fs');var path=require(_0x3fa8('0x6'));var rimraf=require('rimraf');var config=require(_0x3fa8('0x7'));var attributes=require(_0x3fa8('0x8'));module['exports']=function(_0x137475,_0x1b145a){return _0x137475[_0x3fa8('0x9')]('FaxMessage',attributes,{'tableName':_0x3fa8('0xa'),'paranoid':![],'indexes':[{'name':_0x3fa8('0xb'),'fields':[_0x3fa8('0xc')],'type':_0x3fa8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26941d,_0x164d02,_0x2ea406){var _0x53f469=_0x137475[_0x3fa8('0xe')];var _0x3a3089=_0x26941d[_0x3fa8('0xf')]({'plain':!![]});if(_0x3a3089['direction'][_0x3fa8('0x10')]()==='in'||_0x3a3089[_0x3fa8('0x11')][_0x3fa8('0x10')]()===_0x3fa8('0x12')&&!_0x3a3089[_0x3fa8('0x13')]&&!_[_0x3fa8('0x14')](_0x3a3089[_0x3fa8('0x15')])){_0x53f469[_0x3fa8('0x16')]['findOne']({'where':{'id':_0x3a3089[_0x3fa8('0x17')]}})[_0x3fa8('0x18')](function(_0x579756){if(_0x579756){_0x579756[_0x3fa8('0x19')]({'lastMsgAt':_0x3a3089[_0x3fa8('0x1a')],'lastMsgDirection':_0x3a3089[_0x3fa8('0x11')]['toLowerCase']()});}})[_0x3fa8('0x1b')](function(_0x2ec8a7){console['error'](_0x2ec8a7);});}_0x2ea406();}},'charset':'utf8mb4','collate':_0x3fa8('0x1c')});}; \ No newline at end of file +var _0xc19f=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','toLowerCase','catch','utf8mb4','lodash','util','api','moment','rimraf','../../config/environment'];(function(_0x56a5a4,_0x6ca1b4){var _0x5aeed6=function(_0x101097){while(--_0x101097){_0x56a5a4['push'](_0x56a5a4['shift']());}};_0x5aeed6(++_0x6ca1b4);}(_0xc19f,0x123));var _0xfc19=function(_0x5d5ead,_0x4034ac){_0x5d5ead=_0x5d5ead-0x0;var _0x4eb7ba=_0xc19f[_0x5d5ead];return _0x4eb7ba;};'use strict';var _=require(_0xfc19('0x0'));var util=require(_0xfc19('0x1'));var logger=require('../../config/logger')(_0xfc19('0x2'));var moment=require(_0xfc19('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc19('0x4'));var config=require(_0xfc19('0x5'));var attributes=require(_0xfc19('0x6'));module[_0xfc19('0x7')]=function(_0x90f688,_0x3edfba){return _0x90f688[_0xfc19('0x8')](_0xfc19('0x9'),attributes,{'tableName':_0xfc19('0xa'),'paranoid':![],'indexes':[{'name':_0xfc19('0xb'),'fields':['body'],'type':_0xfc19('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x587220,_0x97b16c,_0x47b341){var _0x1acb3a=_0x90f688[_0xfc19('0xd')];var _0x140374=_0x587220[_0xfc19('0xe')]({'plain':!![]});if(_0x140374[_0xfc19('0xf')]['toLowerCase']()==='in'||_0x140374[_0xfc19('0xf')]['toLowerCase']()===_0xfc19('0x10')&&!_0x140374['secret']&&!_['isNil'](_0x140374[_0xfc19('0x11')])){_0x1acb3a[_0xfc19('0x12')][_0xfc19('0x13')]({'where':{'id':_0x140374[_0xfc19('0x14')]}})[_0xfc19('0x15')](function(_0x21b96d){if(_0x21b96d){_0x21b96d[_0xfc19('0x16')]({'lastMsgAt':_0x140374[_0xfc19('0x17')],'lastMsgDirection':_0x140374[_0xfc19('0xf')][_0xfc19('0x18')]()});}})[_0xfc19('0x19')](function(_0x742c6d){console['error'](_0x742c6d);});}_0x47b341();}},'charset':_0xfc19('0x1a'),'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 edc9645..19c4789 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 _0x4ea3=['message','result','catch','body','options','CreateFaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3394a6,_0x7b1ede){var _0x4a7909=function(_0x20451f){while(--_0x20451f){_0x3394a6['push'](_0x3394a6['shift']());}};_0x4a7909(++_0x7b1ede);}(_0x4ea3,0x70));var _0x34ea=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4ea3[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});config[_0x34ea('0xa')]=_[_0x34ea('0xb')](config[_0x34ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34ea('0xc'))(new Redis(config[_0x34ea('0xa')]));require(_0x34ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x301b98,_0xea1be2,_0x5126de){return new BPromise(function(_0x4a76b1,_0x5bd8b6){return client[_0x34ea('0xe')](_0x301b98,_0x5126de)[_0x34ea('0xf')](function(_0x58bb0d){logger[_0x34ea('0x10')](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));logger[_0x34ea('0x13')](_0x34ea('0x14'),_0xea1be2,_0x34ea('0x12'),JSON[_0x34ea('0x15')](_0x58bb0d));if(_0x58bb0d[_0x34ea('0x16')]){if(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x17')]===0x1f4){logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x5bd8b6(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x4a76b1(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}else{logger['info'](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));_0x4a76b1(_0x58bb0d[_0x34ea('0x19')]['message']);}})[_0x34ea('0x1a')](function(_0x1353de){logger[_0x34ea('0x16')](_0x34ea('0x11'),_0xea1be2,_0x1353de);_0x5bd8b6(_0x1353de);});});}exports['CreateFaxMessage']=function(_0x2eea57){var _0x35328c=this;return new Promise(function(_0x287aaa,_0x247ee7){return db['FaxMessage']['create'](_0x2eea57[_0x34ea('0x1b')],{'raw':_0x2eea57[_0x34ea('0x1c')]?_0x2eea57[_0x34ea('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2eafc6){logger[_0x34ea('0x10')](_0x34ea('0x1d'),_0x2eea57);logger[_0x34ea('0x13')](_0x34ea('0x1d'),_0x2eea57,JSON[_0x34ea('0x15')](_0x2eafc6));_0x287aaa(_0x2eafc6);})['catch'](function(_0xf24962){logger[_0x34ea('0x16')](_0x34ea('0x1d'),_0xf24962[_0x34ea('0x18')],_0x2eea57);_0x247ee7(_0x35328c['error'](0x1f4,_0xf24962['message']));});});};exports['UpdateFaxMessage']=function(_0x142709){var _0x187306=this;return new Promise(function(_0x37c214,_0x4204d7){return db['FaxMessage'][_0x34ea('0x1e')](_0x142709[_0x34ea('0x1b')],{'raw':_0x142709[_0x34ea('0x1c')]?_0x142709['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142709['options']?_0x142709['options'][_0x34ea('0x1f')]||null:null,'attributes':_0x142709[_0x34ea('0x1c')]?_0x142709[_0x34ea('0x1c')][_0x34ea('0x20')]||null:null,'limit':_0x142709['options']?_0x142709[_0x34ea('0x1c')]['limit']||null:null})[_0x34ea('0xf')](function(_0x4f2b77){logger[_0x34ea('0x10')](_0x34ea('0x21'),_0x142709);logger[_0x34ea('0x13')]('UpdateFaxMessage',_0x142709,JSON[_0x34ea('0x15')](_0x4f2b77));_0x37c214(_0x4f2b77);})[_0x34ea('0x1a')](function(_0x55c8ba){logger[_0x34ea('0x16')]('UpdateFaxMessage',_0x55c8ba[_0x34ea('0x18')],_0x142709);_0x4204d7(_0x187306[_0x34ea('0x16')](0x1f4,_0x55c8ba[_0x34ea('0x18')]));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x34e22c,_0x10357a){var _0x38d5cd=function(_0x300f10){while(--_0x300f10){_0x34e22c['push'](_0x34e22c['shift']());}};_0x38d5cd(++_0x10357a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x4b84[_0x118139];return _0x2fece9;};'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});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4c379ee..ce3ad58 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 _0x48da=['save','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x7758ad,_0x1e7e62){var _0x30d766=function(_0x156b4a){while(--_0x156b4a){_0x7758ad['push'](_0x7758ad['shift']());}};_0x30d766(++_0x1e7e62);}(_0x48da,0x67));var _0xa48d=function(_0x296916,_0x349f20){_0x296916=_0x296916-0x0;var _0x1b1cf9=_0x48da[_0x296916];return _0x1b1cf9;};'use strict';var FaxMessageEvents=require(_0xa48d('0x0'));var events=[_0xa48d('0x1'),'remove',_0xa48d('0x2')];function createListener(_0x28a9af,_0x292db1){return function(_0x150ede){_0x292db1[_0xa48d('0x3')](_0x28a9af,_0x150ede);};}function removeListener(_0x180f3,_0x53ac23){return function(){FaxMessageEvents[_0xa48d('0x4')](_0x180f3,_0x53ac23);};}exports[_0xa48d('0x5')]=function(_0x208c5b){for(var _0x179204=0x0,_0x376c20=events[_0xa48d('0x6')];_0x179204<_0x376c20;_0x179204++){var _0x463dc6=events[_0x179204];var _0x49a13c=createListener(_0xa48d('0x7')+_0x463dc6,_0x208c5b);FaxMessageEvents['on'](_0x463dc6,_0x49a13c);}}; \ No newline at end of file +var _0xb429=['./faxMessage.events','save','remove','update','removeListener','faxMessage:'];(function(_0x13bea0,_0x210a0c){var _0x3f12df=function(_0x11ef1c){while(--_0x11ef1c){_0x13bea0['push'](_0x13bea0['shift']());}};_0x3f12df(++_0x210a0c);}(_0xb429,0x198));var _0x9b42=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb429[_0x1e3c16];return _0x47a0c9;};'use strict';var FaxMessageEvents=require(_0x9b42('0x0'));var events=[_0x9b42('0x1'),_0x9b42('0x2'),_0x9b42('0x3')];function createListener(_0x555cc5,_0x24fdf1){return function(_0x386eda){_0x24fdf1['emit'](_0x555cc5,_0x386eda);};}function removeListener(_0x20b9c6,_0x20fce4){return function(){FaxMessageEvents[_0x9b42('0x4')](_0x20b9c6,_0x20fce4);};}exports['register']=function(_0x28825b){for(var _0x32452e=0x0,_0x35d5d1=events['length'];_0x32452e<_0x35d5d1;_0x32452e++){var _0x84d190=events[_0x32452e];var _0x22806f=createListener(_0x9b42('0x5')+_0x84d190,_0x28825b);FaxMessageEvents['on'](_0x84d190,_0x22806f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 9984b57..9dcf34f 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 _0x0565=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','tracked','create','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer'];(function(_0x5c06fe,_0x12193a){var _0xf8ec9a=function(_0x3a7026){while(--_0x3a7026){_0x5c06fe['push'](_0x5c06fe['shift']());}};_0xf8ec9a(++_0x12193a);}(_0x0565,0xf2));var _0x5056=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0565[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var path=require(_0x5056('0x2'));var timeout=require(_0x5056('0x3'));var express=require(_0x5056('0x4'));var router=express[_0x5056('0x5')]();var fs_extra=require(_0x5056('0x6'));var auth=require(_0x5056('0x7'));var interaction=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var controller=require('./faxMessage.controller');router[_0x5056('0xa')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0xc')]);router[_0x5056('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5056('0xd')]);router[_0x5056('0xa')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller[_0x5056('0xf')]);router[_0x5056('0xa')](_0x5056('0x10'),auth[_0x5056('0xb')](),controller['download']);router[_0x5056('0x11')]('/',auth[_0x5056('0xb')](),interaction[_0x5056('0x12')]('fax','faxmessage:create'),controller[_0x5056('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5056('0x14')]);router['put'](_0x5056('0x15'),auth[_0x5056('0xb')](),controller[_0x5056('0x16')]);router['put'](_0x5056('0x17'),auth[_0x5056('0xb')](),controller[_0x5056('0x18')]);router[_0x5056('0x19')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller['destroy']);module[_0x5056('0x1a')]=router; \ No newline at end of file +var _0xd3d1=['put','update','accept','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create'];(function(_0x2ebcdc,_0x3d222f){var _0x2f161d=function(_0x44e41a){while(--_0x44e41a){_0x2ebcdc['push'](_0x2ebcdc['shift']());}};_0x2f161d(++_0x3d222f);}(_0xd3d1,0x172));var _0x1d3d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd3d1[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['show']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),interaction[_0x1d3d('0x12')](_0x1d3d('0x13'),_0x1d3d('0x14')),controller[_0x1d3d('0x15')]);router[_0x1d3d('0x16')]('/:id',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x17')]);router['put']('/:id/accept',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x16')]('/:id/reject',auth[_0x1d3d('0xa')](),controller['reject']);router[_0x1d3d('0x19')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x1a')]);module[_0x1d3d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 08998d4..8929062 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 _0xf722=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x352b7c,_0xf3c28b){var _0x2f96ff=function(_0x393352){while(--_0x393352){_0x352b7c['push'](_0x352b7c['shift']());}};_0x2f96ff(++_0xf3c28b);}(_0xf722,0x18f));var _0x2f72=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf722[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x2f72('0x0'));module[_0x2f72('0x1')]={'name':{'type':Sequelize[_0x2f72('0x2')],'unique':_0x2f72('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2f72('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2f72('0x5')](_0x2f72('0x6'),_0x2f72('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2f72('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x234b=['exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x2922f7,_0x5dfca8){var _0x44971d=function(_0x3301a8){while(--_0x3301a8){_0x2922f7['push'](_0x2922f7['shift']());}};_0x44971d(++_0x5dfca8);}(_0x234b,0xc6));var _0xb234=function(_0x5dd093,_0x4a1468){_0x5dd093=_0x5dd093-0x0;var _0xf9a369=_0x234b[_0x5dd093];return _0xf9a369;};'use strict';var Sequelize=require('sequelize');module[_0xb234('0x0')]={'name':{'type':Sequelize[_0xb234('0x1')],'unique':_0xb234('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb234('0x1')]},'timeout':{'type':Sequelize[_0xb234('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb234('0x4')]('rrmemory',_0xb234('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb234('0x3')],'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 4faa456..50bb994 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 _0x03a2=['getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','User','UserId','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','Agents','online','interface','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','findAll','ids','select','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','get','destroy','error','send','index','map','rawAttributes','name','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x03a2,0xbe));var _0x203a=function(_0x359125,_0x2297aa){_0x359125=_0x359125-0x0;var _0x1429d7=_0x03a2[_0x359125];return _0x1429d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x203a('0x0'));var zipdir=require(_0x203a('0x1'));var jsonpatch=require(_0x203a('0x2'));var rp=require(_0x203a('0x3'));var moment=require(_0x203a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x203a('0x5'));var util=require(_0x203a('0x6'));var path=require(_0x203a('0x7'));var sox=require(_0x203a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x203a('0x9'));var _=require(_0x203a('0xa'));var squel=require('squel');var crypto=require(_0x203a('0xb'));var jsforce=require(_0x203a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x203a('0xd'));var querystring=require(_0x203a('0xe'));var Papa=require(_0x203a('0xf'));var Redis=require(_0x203a('0x10'));var authService=require(_0x203a('0x11'));var qs=require(_0x203a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x203a('0x13'));var logger=require(_0x203a('0x14'))('api');var utils=require(_0x203a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x203a('0x16'));var db=require(_0x203a('0x17'))['db'];config[_0x203a('0x18')]=_[_0x203a('0x19')](config['redis'],{'host':_0x203a('0x1a'),'port':0x18eb});var socket=require(_0x203a('0x1b'))(new Redis(config[_0x203a('0x18')]));require(_0x203a('0x1c'))[_0x203a('0x1d')](socket);function respondWithStatusCode(_0x16f4a5,_0x3ddfd0){_0x3ddfd0=_0x3ddfd0||0xcc;return function(_0x5ec5c4){if(_0x5ec5c4){return _0x16f4a5[_0x203a('0x1e')](_0x3ddfd0);}return _0x16f4a5[_0x203a('0x1f')](_0x3ddfd0)[_0x203a('0x20')]();};}function respondWithResult(_0x589778,_0x180b90){_0x180b90=_0x180b90||0xc8;return function(_0x1c255c){if(_0x1c255c){return _0x589778[_0x203a('0x1f')](_0x180b90)[_0x203a('0x21')](_0x1c255c);}};}function respondWithFilteredResult(_0x7ca8ef,_0x276075){return function(_0xdcda60){if(_0xdcda60){var _0x428f35=typeof _0x276075['offset']===_0x203a('0x22')&&typeof _0x276075[_0x203a('0x23')]==='undefined';var _0x2801fd=_0xdcda60[_0x203a('0x24')];var _0x4dc69e=_0x428f35?0x0:_0x276075['offset'];var _0x44030c=_0x428f35?_0xdcda60[_0x203a('0x24')]:_0x276075[_0x203a('0x25')]+_0x276075['limit'];var _0x2502d8;if(_0x44030c>=_0x2801fd){_0x44030c=_0x2801fd;_0x2502d8=0xc8;}else{_0x2502d8=0xce;}_0x7ca8ef[_0x203a('0x1f')](_0x2502d8);return _0x7ca8ef[_0x203a('0x26')](_0x203a('0x27'),_0x4dc69e+'-'+_0x44030c+'/'+_0x2801fd)[_0x203a('0x21')](_0xdcda60);}return null;};}function patchUpdates(_0x2548de){return function(_0x28eb48){try{jsonpatch[_0x203a('0x28')](_0x28eb48,_0x2548de,!![]);}catch(_0x93c7c8){return BPromise[_0x203a('0x29')](_0x93c7c8);}return _0x28eb48['save']();};}function saveUpdates(_0x8a8d5e,_0x104aa9){return function(_0x3da8ef){if(_0x3da8ef){return _0x3da8ef['update'](_0x8a8d5e)[_0x203a('0x2a')](function(_0x564a1a){return _0x564a1a;});}return null;};}function removeEntity(_0x4d6ab4,_0x51ac73){return function(_0x2b2e0d){if(_0x2b2e0d){return _0x2b2e0d['destroy']()[_0x203a('0x2a')](function(){var _0x3d9740=_0x2b2e0d[_0x203a('0x2b')]({'plain':!![]});var _0x50b69e='FaxQueues';return db['UserProfileResource'][_0x203a('0x2c')]({'where':{'type':_0x50b69e,'resourceId':_0x3d9740['id']}})[_0x203a('0x2a')](function(){return _0x2b2e0d;});})[_0x203a('0x2a')](function(){_0x4d6ab4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd0b2,_0x1d91c7){return function(_0x251245){if(!_0x251245){_0x4fd0b2[_0x203a('0x1e')](0x194);}return _0x251245;};}function handleError(_0x2666e0,_0x1decc3){_0x1decc3=_0x1decc3||0x1f4;return function(_0x80bc54){logger[_0x203a('0x2d')](_0x80bc54['stack']);if(_0x80bc54['name']){delete _0x80bc54['name'];}_0x2666e0[_0x203a('0x1f')](_0x1decc3)[_0x203a('0x2e')](_0x80bc54);};}exports[_0x203a('0x2f')]=function(_0x19189c,_0x229998){var _0x43d161={},_0x11774e={},_0x2b5d98={'count':0x0,'rows':[]};var _0x50c898=_[_0x203a('0x30')](db['FaxQueue'][_0x203a('0x31')],function(_0x53e11a){return{'name':_0x53e11a['fieldName'],'type':_0x53e11a['type']['key']};});_0x11774e['model']=_[_0x203a('0x30')](_0x50c898,_0x203a('0x32'));_0x11774e[_0x203a('0x33')]=_[_0x203a('0x34')](_0x19189c[_0x203a('0x33')]);_0x11774e['filters']=_[_0x203a('0x35')](_0x11774e[_0x203a('0x36')],_0x11774e[_0x203a('0x33')]);_0x43d161[_0x203a('0x37')]=_[_0x203a('0x35')](_0x11774e[_0x203a('0x36')],qs[_0x203a('0x38')](_0x19189c[_0x203a('0x33')]['fields']));_0x43d161[_0x203a('0x37')]=_0x43d161[_0x203a('0x37')]['length']?_0x43d161[_0x203a('0x37')]:_0x11774e[_0x203a('0x36')];if(!_0x19189c[_0x203a('0x33')]['hasOwnProperty'](_0x203a('0x39'))){_0x43d161[_0x203a('0x23')]=qs[_0x203a('0x23')](_0x19189c[_0x203a('0x33')]['limit']);_0x43d161['offset']=qs[_0x203a('0x25')](_0x19189c[_0x203a('0x33')][_0x203a('0x25')]);}_0x43d161[_0x203a('0x3a')]=qs[_0x203a('0x3b')](_0x19189c['query']['sort']);_0x43d161[_0x203a('0x3c')]=qs[_0x203a('0x3d')](_[_0x203a('0x3e')](_0x19189c[_0x203a('0x33')],_0x11774e[_0x203a('0x3d')]),_0x50c898);if(_0x19189c['query'][_0x203a('0x3f')]){_0x43d161[_0x203a('0x3c')]=_[_0x203a('0x40')](_0x43d161[_0x203a('0x3c')],{'$or':_[_0x203a('0x30')](_0x50c898,function(_0x2432f0){if(_0x2432f0['type']!==_0x203a('0x41')){var _0x245138={};_0x245138[_0x2432f0['name']]={'$like':'%'+_0x19189c[_0x203a('0x33')][_0x203a('0x3f')]+'%'};return _0x245138;}})});}_0x43d161=_[_0x203a('0x40')]({},_0x43d161,_0x19189c[_0x203a('0x42')]);var _0x3bddcf={'where':_0x43d161['where']};return db[_0x203a('0x43')][_0x203a('0x24')](_0x3bddcf)[_0x203a('0x2a')](function(_0x5492e1){_0x2b5d98[_0x203a('0x24')]=_0x5492e1;if(_0x19189c[_0x203a('0x33')][_0x203a('0x44')]){_0x43d161[_0x203a('0x45')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x43d161);})[_0x203a('0x2a')](function(_0x140b8c){_0x2b5d98[_0x203a('0x46')]=_0x140b8c;return _0x2b5d98;})[_0x203a('0x2a')](respondWithFilteredResult(_0x229998,_0x43d161))[_0x203a('0x47')](handleError(_0x229998,null));};exports[_0x203a('0x48')]=function(_0xd9ddce,_0x2eba6f){var _0x38f751={'raw':!![],'where':{'id':_0xd9ddce[_0x203a('0x49')]['id']}},_0x55de51={};_0x55de51['model']=_[_0x203a('0x34')](db[_0x203a('0x43')][_0x203a('0x31')]);_0x55de51[_0x203a('0x33')]=_['keys'](_0xd9ddce[_0x203a('0x33')]);_0x55de51[_0x203a('0x3d')]=_[_0x203a('0x35')](_0x55de51['model'],_0x55de51[_0x203a('0x33')]);_0x38f751[_0x203a('0x37')]=_[_0x203a('0x35')](_0x55de51['model'],qs[_0x203a('0x38')](_0xd9ddce[_0x203a('0x33')][_0x203a('0x38')]));_0x38f751[_0x203a('0x37')]=_0x38f751[_0x203a('0x37')]['length']?_0x38f751[_0x203a('0x37')]:_0x55de51[_0x203a('0x36')];if(_0xd9ddce[_0x203a('0x33')][_0x203a('0x44')]){_0x38f751[_0x203a('0x45')]=[{'all':!![]}];}_0x38f751=_[_0x203a('0x40')]({},_0x38f751,_0xd9ddce['options']);return db['FaxQueue'][_0x203a('0x4a')](_0x38f751)[_0x203a('0x2a')](handleEntityNotFound(_0x2eba6f,null))[_0x203a('0x2a')](respondWithResult(_0x2eba6f,null))[_0x203a('0x47')](handleError(_0x2eba6f,null));};exports[_0x203a('0x4b')]=function(_0x505668,_0x7d103c){return db[_0x203a('0x43')]['create'](_0x505668[_0x203a('0x4c')],{})['then'](function(_0x3e8cb3){var _0x84394d=_0x505668[_0x203a('0x4d')]['get']({'plain':!![]});if(!_0x84394d)throw new Error(_0x203a('0x4e'));if(_0x84394d[_0x203a('0x4f')]===_0x203a('0x4d')){var _0x53064d=_0x3e8cb3[_0x203a('0x2b')]({'plain':!![]});var _0x3b821c='FaxQueues';return db['UserProfileSection'][_0x203a('0x4a')]({'where':{'name':_0x3b821c,'userProfileId':_0x84394d[_0x203a('0x50')]},'raw':!![]})[_0x203a('0x2a')](function(_0x11ce9c){if(_0x11ce9c&&_0x11ce9c['autoAssociation']===0x0){return db['UserProfileResource'][_0x203a('0x4b')]({'name':_0x53064d[_0x203a('0x32')],'resourceId':_0x53064d['id'],'type':_0x11ce9c['name'],'sectionId':_0x11ce9c['id']},{})[_0x203a('0x2a')](function(){return _0x3e8cb3;});}else{return _0x3e8cb3;}})[_0x203a('0x47')](function(_0x9de5ab){logger['error'](_0x203a('0x51'),_0x9de5ab);throw _0x9de5ab;});}return _0x3e8cb3;})[_0x203a('0x2a')](respondWithResult(_0x7d103c,0xc9))[_0x203a('0x47')](handleError(_0x7d103c,null));};exports[_0x203a('0x52')]=function(_0x4f8251,_0x4c9be9){if(_0x4f8251[_0x203a('0x4c')]['id']){delete _0x4f8251[_0x203a('0x4c')]['id'];}return db[_0x203a('0x43')][_0x203a('0x4a')]({'where':{'id':_0x4f8251[_0x203a('0x49')]['id']}})[_0x203a('0x2a')](handleEntityNotFound(_0x4c9be9,null))['then'](saveUpdates(_0x4f8251[_0x203a('0x4c')],null))[_0x203a('0x2a')](respondWithResult(_0x4c9be9,null))[_0x203a('0x47')](handleError(_0x4c9be9,null));};exports[_0x203a('0x2c')]=function(_0x19690b,_0x5ea167){return db['FaxQueue'][_0x203a('0x4a')]({'where':{'id':_0x19690b['params']['id']}})[_0x203a('0x2a')](handleEntityNotFound(_0x5ea167,null))[_0x203a('0x2a')](removeEntity(_0x5ea167,null))[_0x203a('0x47')](handleError(_0x5ea167,null));};exports[_0x203a('0x53')]=function(_0x5cec3a,_0x2530c2){return db[_0x203a('0x43')][_0x203a('0x53')]()[_0x203a('0x2a')](respondWithResult(_0x2530c2,null))[_0x203a('0x47')](handleError(_0x2530c2,null));};exports[_0x203a('0x54')]=function(_0x5e3893,_0x15f1cc,_0x12c6c8){var _0x3eb4b2={'raw':!![],'where':{}},_0x1ac7ae={},_0x3e47e;return db['FaxQueue'][_0x203a('0x55')]({'where':{'id':_0x5e3893[_0x203a('0x49')]['id']}})[_0x203a('0x2a')](handleEntityNotFound(_0x15f1cc,null))['then'](function(_0x2d519f){if(_0x2d519f){_0x3e47e=_0x2d519f['get']({'plain':!![]});_0x1ac7ae[_0x203a('0x36')]=_[_0x203a('0x34')](db[_0x203a('0x56')]['rawAttributes']);_0x1ac7ae[_0x203a('0x33')]=_[_0x203a('0x34')](_0x5e3893['query']);_0x1ac7ae[_0x203a('0x3d')]=_[_0x203a('0x35')](_0x1ac7ae['model'],_0x1ac7ae[_0x203a('0x33')]);_0x3eb4b2[_0x203a('0x37')]=_[_0x203a('0x35')](_0x1ac7ae[_0x203a('0x36')],qs[_0x203a('0x38')](_0x5e3893[_0x203a('0x33')][_0x203a('0x38')]));_0x3eb4b2['attributes']=_0x3eb4b2[_0x203a('0x37')]['length']?_0x3eb4b2[_0x203a('0x37')]:_0x1ac7ae[_0x203a('0x36')];if(!_0x5e3893['query'][_0x203a('0x57')](_0x203a('0x39'))){_0x3eb4b2['limit']=qs[_0x203a('0x23')](_0x5e3893['query'][_0x203a('0x23')]);_0x3eb4b2['offset']=qs['offset'](_0x5e3893[_0x203a('0x33')][_0x203a('0x25')]);}_0x3eb4b2[_0x203a('0x3a')]=qs[_0x203a('0x3b')](_0x5e3893[_0x203a('0x33')][_0x203a('0x3b')]);_0x3eb4b2[_0x203a('0x3c')]=qs[_0x203a('0x3d')](_[_0x203a('0x3e')](_0x5e3893[_0x203a('0x33')],_0x1ac7ae[_0x203a('0x3d')]));_0x3eb4b2[_0x203a('0x3c')][_0x203a('0x58')]=_0x2d519f['id'];if(_0x5e3893[_0x203a('0x33')][_0x203a('0x3f')]){_0x3eb4b2[_0x203a('0x3c')]=_[_0x203a('0x40')](_0x3eb4b2[_0x203a('0x3c')],{'$or':_[_0x203a('0x30')](_0x3eb4b2[_0x203a('0x37')],function(_0x266aad){var _0x981731={};_0x981731[_0x266aad]={'$like':'%'+_0x5e3893[_0x203a('0x33')]['filter']+'%'};return _0x981731;})});}_0x3eb4b2=_[_0x203a('0x40')]({},_0x3eb4b2,_0x5e3893[_0x203a('0x42')]);return db[_0x203a('0x56')]['findAll'](_0x3eb4b2);}})['then'](function(_0xdec71c){if(_0xdec71c){return db[_0x203a('0x59')]['findAndCountAll']({'where':{'id':_[_0x203a('0x30')](_0xdec71c,_0x203a('0x5a')),'role':'agent'},'attributes':['id',_0x203a('0x32'),_0x203a('0x5b'),_0x203a('0x5c'),'createdAt']});}})[_0x203a('0x2a')](function(_0x1a5855){if(_0x1a5855){return{'count':_0x1a5855[_0x203a('0x24')],'rows':_[_0x203a('0x30')](_0x1a5855[_0x203a('0x46')],function(_0x13b1af){return{'membername':_0x13b1af['name'],'UserId':_0x13b1af['id'],'queue_name':_0x3e47e['name'],'FaxQueueId':_0x3e47e['id'],'interface':util[_0x203a('0x5d')](_0x203a('0x5e'),_0x203a('0x5f'),_0x13b1af[_0x203a('0x32')]),'penalty':0x0,'paused':_0x13b1af['faxPause'],'createdAt':_0x13b1af[_0x203a('0x60')],'updatedAt':_0x13b1af[_0x203a('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x203a('0x2a')](respondWithFilteredResult(_0x15f1cc,_0x3eb4b2))[_0x203a('0x47')](handleError(_0x15f1cc,null));};exports[_0x203a('0x61')]=function(_0xd9c5d7,_0x2ad0f4,_0x1564ed){var _0xbd4b79={};var _0x37022e={};var _0x1cd6c2;var _0x3959ab;return db['FaxQueue'][_0x203a('0x55')]({'where':{'id':_0xd9c5d7['params']['id']}})[_0x203a('0x2a')](handleEntityNotFound(_0x2ad0f4,null))['then'](function(_0x408057){if(_0x408057){_0x1cd6c2=_0x408057;_0x37022e[_0x203a('0x36')]=_[_0x203a('0x34')](db[_0x203a('0x62')][_0x203a('0x31')]);_0x37022e['query']=_[_0x203a('0x34')](_0xd9c5d7[_0x203a('0x33')]);_0x37022e[_0x203a('0x3d')]=_['intersection'](_0x37022e[_0x203a('0x36')],_0x37022e[_0x203a('0x33')]);_0xbd4b79[_0x203a('0x37')]=_[_0x203a('0x35')](_0x37022e[_0x203a('0x36')],qs['fields'](_0xd9c5d7[_0x203a('0x33')][_0x203a('0x38')]));_0xbd4b79[_0x203a('0x37')]=_0xbd4b79[_0x203a('0x37')]['length']?_0xbd4b79['attributes']:_0x37022e['model'];_0xbd4b79['order']=qs[_0x203a('0x3b')](_0xd9c5d7['query'][_0x203a('0x3b')]);_0xbd4b79['where']=qs[_0x203a('0x3d')](_[_0x203a('0x3e')](_0xd9c5d7['query'],_0x37022e[_0x203a('0x3d')]));if(_0xd9c5d7[_0x203a('0x33')][_0x203a('0x3f')]){_0xbd4b79[_0x203a('0x3c')]=_['merge'](_0xbd4b79[_0x203a('0x3c')],{'$or':_[_0x203a('0x30')](_0xbd4b79[_0x203a('0x37')],function(_0x28ba0b){var _0x11301f={};_0x11301f[_0x28ba0b]={'$like':'%'+_0xd9c5d7[_0x203a('0x33')]['filter']+'%'};return _0x11301f;})});}_0xbd4b79=_[_0x203a('0x40')]({},_0xbd4b79,_0xd9c5d7[_0x203a('0x42')]);return _0x1cd6c2[_0x203a('0x61')](_0xbd4b79);}})[_0x203a('0x2a')](function(_0x31651f){if(_0x31651f){_0x3959ab=_0x31651f[_0x203a('0x63')];if(!_0xd9c5d7[_0x203a('0x33')][_0x203a('0x57')](_0x203a('0x39'))){_0xbd4b79[_0x203a('0x23')]=qs[_0x203a('0x23')](_0xd9c5d7[_0x203a('0x33')]['limit']);_0xbd4b79[_0x203a('0x25')]=qs[_0x203a('0x25')](_0xd9c5d7[_0x203a('0x33')][_0x203a('0x25')]);}return _0x1cd6c2[_0x203a('0x61')](_0xbd4b79);}})['then'](function(_0x24f1c3){if(_0x24f1c3){return _0x24f1c3?{'count':_0x3959ab,'rows':_0x24f1c3}:null;}})[_0x203a('0x2a')](respondWithResult(_0x2ad0f4,null))[_0x203a('0x47')](handleError(_0x2ad0f4,null));};exports[_0x203a('0x64')]=function(_0x504740,_0xdd865a,_0x535dd2){var _0x2afa64=_0x504740[_0x203a('0x4c')]['ids'];return db[_0x203a('0x62')]['findAll']({'where':{'id':_0x2afa64},'attributes':['id'],'include':[{'model':db[_0x203a('0x59')],'as':_0x203a('0x65'),'attributes':['id',_0x203a('0x32'),_0x203a('0x66'),'voicePause',_0x203a('0x67')],'raw':!![]}]})[_0x203a('0x2a')](function(_0x114fca){if(_0x114fca){var _0x3cf6c6=_[_0x203a('0x68')](_0x114fca,function(_0x34bdc3){var _0x1b85d9=_0x34bdc3[_0x203a('0x2b')]({'plain':!![]});return _0x1b85d9[_0x203a('0x65')];});return db[_0x203a('0x43')][_0x203a('0x4a')]({'where':{'id':_0x504740[_0x203a('0x49')]['id']}})[_0x203a('0x2a')](function(_0x3e678d){return db[_0x203a('0x69')]['transaction'](function(_0xdcda8b){return _0x3e678d[_0x203a('0x64')](_0x2afa64,{'transaction':_0xdcda8b})['then'](function(){return BPromise[_0x203a('0x6a')](_0x3cf6c6,function(_0x27c8bc){return db[_0x203a('0x56')][_0x203a('0x6b')]({'where':{'UserId':_0x27c8bc['id'],'FaxQueueId':_0x504740['params']['id']},'transaction':_0xdcda8b});});})[_0x203a('0x2a')](function(){_0x3cf6c6['forEach'](function(_0x1d6b69){socket[_0x203a('0x6c')](_0x203a('0x6d'),{'UserId':_0x1d6b69['id'],'FaxQueueId':_0x3e678d['id']});});});});});}})[_0x203a('0x2a')](respondWithStatusCode(_0xdd865a,null))[_0x203a('0x47')](handleError(_0xdd865a,null));};exports[_0x203a('0x6e')]=function(_0x41b4f2,_0x2159cb,_0x3f8ac7){return db[_0x203a('0x62')][_0x203a('0x6f')]({'where':{'id':_0x41b4f2[_0x203a('0x33')][_0x203a('0x70')]},'attributes':['id'],'include':[{'model':db[_0x203a('0x59')],'as':_0x203a('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2159cb,null))[_0x203a('0x2a')](function(_0x3a0bf8){var _0x19a8c3=_[_0x203a('0x30')](_0x3a0bf8,'id');var _0x29dd5a=[];var _0x3bbf8a=[];var _0x5810d1=squel[_0x203a('0x71')]();_0x5810d1['field'](_0x203a('0x72'))[_0x203a('0x73')]('team_has_fax_queues','tq')['join']('user_has_teams','ut',_0x203a('0x74'))[_0x203a('0x3c')](_0x203a('0x75'),_0x41b4f2['params']['id']);for(var _0x3a5825=0x0;_0x3a5825<_0x3a0bf8['length'];_0x3a5825+=0x1){let _0xe0c048=_0x3a0bf8[_0x3a5825];for(var _0x4c48f6=0x0;_0x4c48f6<_0xe0c048['Agents'][_0x203a('0x63')];_0x4c48f6+=0x1){let _0x41bbfe=_0xe0c048['Agents'][_0x4c48f6];var _0xc1198a=_0x5810d1[_0x203a('0x76')]();_0xc1198a[_0x203a('0x3c')](_0x203a('0x77'),_0x41bbfe['id']);_0x3bbf8a[_0x203a('0x78')](db[_0x203a('0x69')][_0x203a('0x33')](_0xc1198a[_0x203a('0x79')](),{'type':db['sequelize'][_0x203a('0x7a')][_0x203a('0x7b')]})[_0x203a('0x2a')](function(_0x228bef){if(_0x228bef[_0x203a('0x63')]===0x1){return _0x41bbfe['id'];}else{var _0x309cf7=_['every'](_[_0x203a('0x30')](_0x228bef,'TeamId'),function(_0x53afc1){return _[_0x203a('0x7c')](_0x19a8c3,_0x53afc1);});if(_0x309cf7){return _0x41bbfe['id'];}}}));}}return BPromise[_0x203a('0x7d')](_0x3bbf8a)[_0x203a('0x2a')](function(_0x255b9c){_0x29dd5a=_(_0x29dd5a)[_0x203a('0x7e')](_0x255b9c)['compact']()[_0x203a('0x7f')]();return db['FaxQueue'][_0x203a('0x4a')]({'where':{'id':_0x41b4f2[_0x203a('0x49')]['id']}})['then'](function(_0x2d3178){return db[_0x203a('0x69')]['transaction'](function(_0xdafe98){return _0x2d3178[_0x203a('0x6e')](_0x41b4f2[_0x203a('0x33')][_0x203a('0x70')],{'transaction':_0xdafe98})['then'](function(){if(!_[_0x203a('0x80')](_0x29dd5a)){return _0x2d3178[_0x203a('0x81')](_0x29dd5a,{'transaction':_0xdafe98});}})[_0x203a('0x2a')](function(){_0x29dd5a[_0x203a('0x82')](function(_0x20eef2){socket[_0x203a('0x6c')](_0x203a('0x83'),{'UserId':_0x20eef2,'FaxQueueId':_0x2d3178['id']});});});});});});})[_0x203a('0x2a')](respondWithStatusCode(_0x2159cb,null))[_0x203a('0x47')](handleError(_0x2159cb,null));};exports[_0x203a('0x84')]=function(_0x1b1267,_0x1597ad,_0x1a851a){return db['FaxQueue'][_0x203a('0x4a')]({'where':{'id':_0x1b1267[_0x203a('0x49')]['id']}})[_0x203a('0x2a')](handleEntityNotFound(_0x1597ad,null))[_0x203a('0x2a')](function(_0x1ffbac){if(_0x1ffbac){return _0x1ffbac[_0x203a('0x84')](_0x1b1267[_0x203a('0x4c')][_0x203a('0x70')],_[_0x203a('0x85')](_0x1b1267['body'],[_0x203a('0x70'),'id'])||{})[_0x203a('0x86')](function(_0x10e3a9){for(var _0x33c20d=0x0;_0x33c20d<_0x1b1267[_0x203a('0x4c')][_0x203a('0x70')]['length'];_0x33c20d+=0x1){socket[_0x203a('0x6c')](_0x203a('0x6d'),{'UserId':Number(_0x1b1267['body'][_0x203a('0x70')][_0x33c20d]),'FaxQueueId':Number(_0x1b1267[_0x203a('0x49')]['id'])});}return _0x10e3a9;});}})[_0x203a('0x2a')](respondWithResult(_0x1597ad,null))['catch'](handleError(_0x1597ad,null));};exports['removeAgents']=function(_0x3311f6,_0x4371da,_0x2e32b5){return db['FaxQueue'][_0x203a('0x4a')]({'where':{'id':_0x3311f6[_0x203a('0x49')]['id']}})[_0x203a('0x2a')](handleEntityNotFound(_0x4371da,null))['then'](function(_0x5e86f4){if(_0x5e86f4){return _0x5e86f4[_0x203a('0x81')](_0x3311f6[_0x203a('0x33')][_0x203a('0x70')])[_0x203a('0x2a')](function(){if(_[_0x203a('0x87')](_0x3311f6[_0x203a('0x33')]['ids'])){for(var _0x3f0ae5=0x0;_0x3f0ae5<_0x3311f6['query'][_0x203a('0x70')][_0x203a('0x63')];_0x3f0ae5+=0x1){socket[_0x203a('0x6c')](_0x203a('0x83'),{'UserId':Number(_0x3311f6['query']['ids'][_0x3f0ae5]),'FaxQueueId':Number(_0x3311f6['params']['id'])});}}else{socket[_0x203a('0x6c')](_0x203a('0x83'),{'UserId':Number(_0x3311f6[_0x203a('0x33')][_0x203a('0x70')]),'FaxQueueId':Number(_0x3311f6['params']['id'])});}});}})[_0x203a('0x2a')](respondWithStatusCode(_0x4371da,null))['catch'](handleError(_0x4371da,null));};exports[_0x203a('0x88')]=function(_0x30f8d4,_0x3b566a,_0xcbd361){var _0x255645={};var _0xe574e6={};var _0x22b4f3;var _0x2d4e47;return db[_0x203a('0x43')][_0x203a('0x55')]({'where':{'id':_0x30f8d4['params']['id']}})['then'](handleEntityNotFound(_0x3b566a,null))[_0x203a('0x2a')](function(_0x1e9f81){if(_0x1e9f81){_0x22b4f3=_0x1e9f81;_0xe574e6['model']=_['keys'](db[_0x203a('0x59')]['rawAttributes']);_0xe574e6[_0x203a('0x33')]=_['keys'](_0x30f8d4['query']);_0xe574e6[_0x203a('0x3d')]=_[_0x203a('0x35')](_0xe574e6[_0x203a('0x36')],_0xe574e6[_0x203a('0x33')]);_0x255645[_0x203a('0x37')]=_[_0x203a('0x35')](_0xe574e6[_0x203a('0x36')],qs[_0x203a('0x38')](_0x30f8d4['query'][_0x203a('0x38')]));_0x255645[_0x203a('0x37')]=_0x255645[_0x203a('0x37')][_0x203a('0x63')]?_0x255645[_0x203a('0x37')]:_0xe574e6[_0x203a('0x36')];_0x255645[_0x203a('0x3a')]=qs[_0x203a('0x3b')](_0x30f8d4['query'][_0x203a('0x3b')]);_0x255645[_0x203a('0x3c')]=qs[_0x203a('0x3d')](_['pick'](_0x30f8d4[_0x203a('0x33')],_0xe574e6[_0x203a('0x3d')]));if(_0x30f8d4['query']['filter']){_0x255645[_0x203a('0x3c')]=_[_0x203a('0x40')](_0x255645[_0x203a('0x3c')],{'$or':_[_0x203a('0x30')](_0x255645[_0x203a('0x37')],function(_0x3a1a0e){var _0x417b8a={};_0x417b8a[_0x3a1a0e]={'$like':'%'+_0x30f8d4[_0x203a('0x33')][_0x203a('0x3f')]+'%'};return _0x417b8a;})});}_0x255645=_[_0x203a('0x40')]({},_0x255645,_0x30f8d4[_0x203a('0x42')]);return _0x22b4f3[_0x203a('0x88')](_0x255645);}})[_0x203a('0x2a')](function(_0x215934){if(_0x215934){_0x2d4e47=_0x215934[_0x203a('0x63')];if(!_0x30f8d4['query'][_0x203a('0x57')](_0x203a('0x39'))){_0x255645[_0x203a('0x23')]=qs[_0x203a('0x23')](_0x30f8d4[_0x203a('0x33')][_0x203a('0x23')]);_0x255645[_0x203a('0x25')]=qs['offset'](_0x30f8d4[_0x203a('0x33')]['offset']);}return _0x22b4f3[_0x203a('0x88')](_0x255645);}})['then'](function(_0x1d8e71){if(_0x1d8e71){return _0x1d8e71?{'count':_0x2d4e47,'rows':_0x1d8e71}:null;}})[_0x203a('0x2a')](respondWithResult(_0x3b566a,null))[_0x203a('0x47')](handleError(_0x3b566a,null));}; \ No newline at end of file +var _0x49d1=['redis','defaults','localhost','./faxQueue.socket','sendStatus','end','json','offset','count','limit','status','set','Content-Range','apply','save','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','sort','FaxQueueId','options','UserFaxQueue','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','userFaxQueue:save','userFaxQueue:remove','getAgents','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1e8162,_0x40e6fa){var _0x17785f=function(_0x1d7c7d){while(--_0x1d7c7d){_0x1e8162['push'](_0x1e8162['shift']());}};_0x17785f(++_0x40e6fa);}(_0x49d1,0x75));var _0x149d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x49d1[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x149d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x149d('0x1'));var BPromise=require(_0x149d('0x2'));var Mustache=require(_0x149d('0x3'));var util=require(_0x149d('0x4'));var path=require('path');var sox=require(_0x149d('0x5'));var csv=require(_0x149d('0x6'));var ejs=require(_0x149d('0x7'));var fs=require('fs');var fs_extra=require(_0x149d('0x8'));var _=require(_0x149d('0x9'));var squel=require('squel');var crypto=require(_0x149d('0xa'));var jsforce=require(_0x149d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x149d('0x6'));var querystring=require(_0x149d('0xc'));var Papa=require(_0x149d('0xd'));var Redis=require(_0x149d('0xe'));var authService=require(_0x149d('0xf'));var qs=require(_0x149d('0x10'));var as=require(_0x149d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x149d('0x12'))(_0x149d('0x13'));var utils=require(_0x149d('0x14'));var config=require(_0x149d('0x15'));var licenseUtil=require(_0x149d('0x16'));var db=require(_0x149d('0x17'))['db'];config[_0x149d('0x18')]=_[_0x149d('0x19')](config[_0x149d('0x18')],{'host':_0x149d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x149d('0x18')]));require(_0x149d('0x1b'))['register'](socket);function respondWithStatusCode(_0x2ad97c,_0x43ebdb){_0x43ebdb=_0x43ebdb||0xcc;return function(_0x23f012){if(_0x23f012){return _0x2ad97c[_0x149d('0x1c')](_0x43ebdb);}return _0x2ad97c['status'](_0x43ebdb)[_0x149d('0x1d')]();};}function respondWithResult(_0xe283c2,_0x5a6d4c){_0x5a6d4c=_0x5a6d4c||0xc8;return function(_0x5bb0f7){if(_0x5bb0f7){return _0xe283c2['status'](_0x5a6d4c)[_0x149d('0x1e')](_0x5bb0f7);}};}function respondWithFilteredResult(_0x50e0c0,_0x257259){return function(_0x4b5f68){if(_0x4b5f68){var _0xd202ca=typeof _0x257259[_0x149d('0x1f')]==='undefined'&&typeof _0x257259['limit']==='undefined';var _0x17b22=_0x4b5f68[_0x149d('0x20')];var _0x444edd=_0xd202ca?0x0:_0x257259[_0x149d('0x1f')];var _0x2731d1=_0xd202ca?_0x4b5f68[_0x149d('0x20')]:_0x257259[_0x149d('0x1f')]+_0x257259[_0x149d('0x21')];var _0x29a427;if(_0x2731d1>=_0x17b22){_0x2731d1=_0x17b22;_0x29a427=0xc8;}else{_0x29a427=0xce;}_0x50e0c0[_0x149d('0x22')](_0x29a427);return _0x50e0c0[_0x149d('0x23')](_0x149d('0x24'),_0x444edd+'-'+_0x2731d1+'/'+_0x17b22)[_0x149d('0x1e')](_0x4b5f68);}return null;};}function patchUpdates(_0x4a7fad){return function(_0x4d46d8){try{jsonpatch[_0x149d('0x25')](_0x4d46d8,_0x4a7fad,!![]);}catch(_0x32833e){return BPromise['reject'](_0x32833e);}return _0x4d46d8[_0x149d('0x26')]();};}function saveUpdates(_0x1aeb49,_0x44d7fa){return function(_0x286eca){if(_0x286eca){return _0x286eca[_0x149d('0x27')](_0x1aeb49)[_0x149d('0x28')](function(_0x126edf){return _0x126edf;});}return null;};}function removeEntity(_0x450e0a,_0x34cf08){return function(_0x292bf1){if(_0x292bf1){return _0x292bf1[_0x149d('0x29')]()[_0x149d('0x28')](function(){var _0x5ecfcc=_0x292bf1['get']({'plain':!![]});var _0x28fec1=_0x149d('0x2a');return db[_0x149d('0x2b')][_0x149d('0x29')]({'where':{'type':_0x28fec1,'resourceId':_0x5ecfcc['id']}})['then'](function(){return _0x292bf1;});})[_0x149d('0x28')](function(){_0x450e0a[_0x149d('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38706f,_0x26670c){return function(_0x3159c1){if(!_0x3159c1){_0x38706f[_0x149d('0x1c')](0x194);}return _0x3159c1;};}function handleError(_0x444eca,_0x3a20c4){_0x3a20c4=_0x3a20c4||0x1f4;return function(_0x41c827){logger[_0x149d('0x2c')](_0x41c827[_0x149d('0x2d')]);if(_0x41c827[_0x149d('0x2e')]){delete _0x41c827[_0x149d('0x2e')];}_0x444eca[_0x149d('0x22')](_0x3a20c4)[_0x149d('0x2f')](_0x41c827);};}exports['index']=function(_0x319228,_0x520234){var _0x407fe0={},_0x1fc31b={},_0x3ec488={'count':0x0,'rows':[]};var _0x305e94=_[_0x149d('0x30')](db[_0x149d('0x31')][_0x149d('0x32')],function(_0x2921bf){return{'name':_0x2921bf[_0x149d('0x33')],'type':_0x2921bf[_0x149d('0x34')][_0x149d('0x35')]};});_0x1fc31b[_0x149d('0x36')]=_[_0x149d('0x30')](_0x305e94,_0x149d('0x2e'));_0x1fc31b[_0x149d('0x37')]=_[_0x149d('0x38')](_0x319228[_0x149d('0x37')]);_0x1fc31b[_0x149d('0x39')]=_[_0x149d('0x3a')](_0x1fc31b[_0x149d('0x36')],_0x1fc31b['query']);_0x407fe0[_0x149d('0x3b')]=_[_0x149d('0x3a')](_0x1fc31b['model'],qs[_0x149d('0x3c')](_0x319228[_0x149d('0x37')][_0x149d('0x3c')]));_0x407fe0['attributes']=_0x407fe0[_0x149d('0x3b')]['length']?_0x407fe0['attributes']:_0x1fc31b[_0x149d('0x36')];if(!_0x319228[_0x149d('0x37')][_0x149d('0x3d')](_0x149d('0x3e'))){_0x407fe0[_0x149d('0x21')]=qs[_0x149d('0x21')](_0x319228['query'][_0x149d('0x21')]);_0x407fe0[_0x149d('0x1f')]=qs[_0x149d('0x1f')](_0x319228['query'][_0x149d('0x1f')]);}_0x407fe0[_0x149d('0x3f')]=qs['sort'](_0x319228[_0x149d('0x37')]['sort']);_0x407fe0['where']=qs[_0x149d('0x39')](_[_0x149d('0x40')](_0x319228[_0x149d('0x37')],_0x1fc31b[_0x149d('0x39')]),_0x305e94);if(_0x319228[_0x149d('0x37')]['filter']){_0x407fe0['where']=_[_0x149d('0x41')](_0x407fe0[_0x149d('0x42')],{'$or':_[_0x149d('0x30')](_0x305e94,function(_0x2d3713){if(_0x2d3713[_0x149d('0x34')]!==_0x149d('0x43')){var _0x3c01b7={};_0x3c01b7[_0x2d3713[_0x149d('0x2e')]]={'$like':'%'+_0x319228[_0x149d('0x37')][_0x149d('0x44')]+'%'};return _0x3c01b7;}})});}_0x407fe0=_['merge']({},_0x407fe0,_0x319228['options']);var _0x2c7ab4={'where':_0x407fe0[_0x149d('0x42')]};return db[_0x149d('0x31')][_0x149d('0x20')](_0x2c7ab4)['then'](function(_0x3aeb4d){_0x3ec488[_0x149d('0x20')]=_0x3aeb4d;if(_0x319228[_0x149d('0x37')][_0x149d('0x45')]){_0x407fe0[_0x149d('0x46')]=[{'all':!![]}];}return db[_0x149d('0x31')][_0x149d('0x47')](_0x407fe0);})[_0x149d('0x28')](function(_0x696e1e){_0x3ec488['rows']=_0x696e1e;return _0x3ec488;})[_0x149d('0x28')](respondWithFilteredResult(_0x520234,_0x407fe0))[_0x149d('0x48')](handleError(_0x520234,null));};exports[_0x149d('0x49')]=function(_0x339743,_0x486f5b){var _0x4840ce={'raw':!![],'where':{'id':_0x339743[_0x149d('0x4a')]['id']}},_0x4090ea={};_0x4090ea[_0x149d('0x36')]=_[_0x149d('0x38')](db[_0x149d('0x31')][_0x149d('0x32')]);_0x4090ea[_0x149d('0x37')]=_[_0x149d('0x38')](_0x339743['query']);_0x4090ea[_0x149d('0x39')]=_[_0x149d('0x3a')](_0x4090ea[_0x149d('0x36')],_0x4090ea[_0x149d('0x37')]);_0x4840ce['attributes']=_['intersection'](_0x4090ea[_0x149d('0x36')],qs['fields'](_0x339743[_0x149d('0x37')]['fields']));_0x4840ce[_0x149d('0x3b')]=_0x4840ce[_0x149d('0x3b')][_0x149d('0x4b')]?_0x4840ce[_0x149d('0x3b')]:_0x4090ea[_0x149d('0x36')];if(_0x339743[_0x149d('0x37')]['includeAll']){_0x4840ce[_0x149d('0x46')]=[{'all':!![]}];}_0x4840ce=_[_0x149d('0x41')]({},_0x4840ce,_0x339743['options']);return db[_0x149d('0x31')][_0x149d('0x4c')](_0x4840ce)[_0x149d('0x28')](handleEntityNotFound(_0x486f5b,null))['then'](respondWithResult(_0x486f5b,null))['catch'](handleError(_0x486f5b,null));};exports[_0x149d('0x4d')]=function(_0x2d2ce9,_0x2a96a4){return db[_0x149d('0x31')][_0x149d('0x4d')](_0x2d2ce9[_0x149d('0x4e')],{})[_0x149d('0x28')](function(_0x373a4a){var _0x592473=_0x2d2ce9[_0x149d('0x4f')]['get']({'plain':!![]});if(!_0x592473)throw new Error(_0x149d('0x50'));if(_0x592473[_0x149d('0x51')]===_0x149d('0x4f')){var _0x159347=_0x373a4a[_0x149d('0x52')]({'plain':!![]});var _0x33d1bf=_0x149d('0x2a');return db['UserProfileSection'][_0x149d('0x4c')]({'where':{'name':_0x33d1bf,'userProfileId':_0x592473['userProfileId']},'raw':!![]})[_0x149d('0x28')](function(_0x25272a){if(_0x25272a&&_0x25272a[_0x149d('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x159347[_0x149d('0x2e')],'resourceId':_0x159347['id'],'type':_0x25272a[_0x149d('0x2e')],'sectionId':_0x25272a['id']},{})[_0x149d('0x28')](function(){return _0x373a4a;});}else{return _0x373a4a;}})[_0x149d('0x48')](function(_0x381048){logger[_0x149d('0x2c')](_0x149d('0x54'),_0x381048);throw _0x381048;});}return _0x373a4a;})[_0x149d('0x28')](respondWithResult(_0x2a96a4,0xc9))[_0x149d('0x48')](handleError(_0x2a96a4,null));};exports[_0x149d('0x27')]=function(_0x59b6da,_0x2c5a76){if(_0x59b6da['body']['id']){delete _0x59b6da['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x59b6da[_0x149d('0x4a')]['id']}})[_0x149d('0x28')](handleEntityNotFound(_0x2c5a76,null))[_0x149d('0x28')](saveUpdates(_0x59b6da[_0x149d('0x4e')],null))[_0x149d('0x28')](respondWithResult(_0x2c5a76,null))['catch'](handleError(_0x2c5a76,null));};exports['destroy']=function(_0x2ad199,_0x20dcf5){return db[_0x149d('0x31')][_0x149d('0x4c')]({'where':{'id':_0x2ad199['params']['id']}})[_0x149d('0x28')](handleEntityNotFound(_0x20dcf5,null))[_0x149d('0x28')](removeEntity(_0x20dcf5,null))['catch'](handleError(_0x20dcf5,null));};exports[_0x149d('0x55')]=function(_0x3af452,_0x9e88a0){return db[_0x149d('0x31')][_0x149d('0x55')]()[_0x149d('0x28')](respondWithResult(_0x9e88a0,null))[_0x149d('0x48')](handleError(_0x9e88a0,null));};exports[_0x149d('0x56')]=function(_0x3f97af,_0x2ecf50,_0x4e101e){var _0x5f2972={'raw':!![],'where':{}},_0x4672e2={},_0x5a003f;return db[_0x149d('0x31')][_0x149d('0x57')]({'where':{'id':_0x3f97af['params']['id']}})[_0x149d('0x28')](handleEntityNotFound(_0x2ecf50,null))[_0x149d('0x28')](function(_0x3baf5c){if(_0x3baf5c){_0x5a003f=_0x3baf5c[_0x149d('0x52')]({'plain':!![]});_0x4672e2[_0x149d('0x36')]=_[_0x149d('0x38')](db['UserFaxQueue'][_0x149d('0x32')]);_0x4672e2[_0x149d('0x37')]=_[_0x149d('0x38')](_0x3f97af[_0x149d('0x37')]);_0x4672e2['filters']=_[_0x149d('0x3a')](_0x4672e2[_0x149d('0x36')],_0x4672e2[_0x149d('0x37')]);_0x5f2972['attributes']=_[_0x149d('0x3a')](_0x4672e2['model'],qs['fields'](_0x3f97af[_0x149d('0x37')]['fields']));_0x5f2972[_0x149d('0x3b')]=_0x5f2972[_0x149d('0x3b')][_0x149d('0x4b')]?_0x5f2972[_0x149d('0x3b')]:_0x4672e2['model'];if(!_0x3f97af[_0x149d('0x37')][_0x149d('0x3d')](_0x149d('0x3e'))){_0x5f2972[_0x149d('0x21')]=qs[_0x149d('0x21')](_0x3f97af[_0x149d('0x37')][_0x149d('0x21')]);_0x5f2972['offset']=qs[_0x149d('0x1f')](_0x3f97af[_0x149d('0x37')]['offset']);}_0x5f2972[_0x149d('0x3f')]=qs[_0x149d('0x58')](_0x3f97af[_0x149d('0x37')][_0x149d('0x58')]);_0x5f2972[_0x149d('0x42')]=qs[_0x149d('0x39')](_[_0x149d('0x40')](_0x3f97af[_0x149d('0x37')],_0x4672e2['filters']));_0x5f2972['where'][_0x149d('0x59')]=_0x3baf5c['id'];if(_0x3f97af[_0x149d('0x37')][_0x149d('0x44')]){_0x5f2972[_0x149d('0x42')]=_[_0x149d('0x41')](_0x5f2972['where'],{'$or':_[_0x149d('0x30')](_0x5f2972[_0x149d('0x3b')],function(_0x144744){var _0x19777d={};_0x19777d[_0x144744]={'$like':'%'+_0x3f97af[_0x149d('0x37')][_0x149d('0x44')]+'%'};return _0x19777d;})});}_0x5f2972=_['merge']({},_0x5f2972,_0x3f97af[_0x149d('0x5a')]);return db[_0x149d('0x5b')][_0x149d('0x47')](_0x5f2972);}})['then'](function(_0x3cded1){if(_0x3cded1){return db[_0x149d('0x5c')][_0x149d('0x5d')]({'where':{'id':_['map'](_0x3cded1,'UserId'),'role':_0x149d('0x5e')},'attributes':['id','name',_0x149d('0x5f'),'updatedAt',_0x149d('0x60')]});}})['then'](function(_0x1c49ef){if(_0x1c49ef){return{'count':_0x1c49ef['count'],'rows':_[_0x149d('0x30')](_0x1c49ef['rows'],function(_0x3ec059){return{'membername':_0x3ec059['name'],'UserId':_0x3ec059['id'],'queue_name':_0x5a003f[_0x149d('0x2e')],'FaxQueueId':_0x5a003f['id'],'interface':util[_0x149d('0x61')](_0x149d('0x62'),_0x149d('0x63'),_0x3ec059['name']),'penalty':0x0,'paused':_0x3ec059[_0x149d('0x5f')],'createdAt':_0x3ec059[_0x149d('0x60')],'updatedAt':_0x3ec059['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ecf50,_0x5f2972))[_0x149d('0x48')](handleError(_0x2ecf50,null));};exports[_0x149d('0x64')]=function(_0x2ce7c7,_0x3fd857,_0x3b046d){var _0x57365d={};var _0x250ea5={};var _0x55e9f4;var _0x59c885;return db[_0x149d('0x31')][_0x149d('0x57')]({'where':{'id':_0x2ce7c7[_0x149d('0x4a')]['id']}})[_0x149d('0x28')](handleEntityNotFound(_0x3fd857,null))[_0x149d('0x28')](function(_0x52b506){if(_0x52b506){_0x55e9f4=_0x52b506;_0x250ea5[_0x149d('0x36')]=_[_0x149d('0x38')](db[_0x149d('0x65')]['rawAttributes']);_0x250ea5[_0x149d('0x37')]=_['keys'](_0x2ce7c7['query']);_0x250ea5['filters']=_[_0x149d('0x3a')](_0x250ea5[_0x149d('0x36')],_0x250ea5[_0x149d('0x37')]);_0x57365d[_0x149d('0x3b')]=_['intersection'](_0x250ea5[_0x149d('0x36')],qs[_0x149d('0x3c')](_0x2ce7c7[_0x149d('0x37')][_0x149d('0x3c')]));_0x57365d[_0x149d('0x3b')]=_0x57365d[_0x149d('0x3b')][_0x149d('0x4b')]?_0x57365d[_0x149d('0x3b')]:_0x250ea5[_0x149d('0x36')];_0x57365d[_0x149d('0x3f')]=qs[_0x149d('0x58')](_0x2ce7c7[_0x149d('0x37')][_0x149d('0x58')]);_0x57365d[_0x149d('0x42')]=qs[_0x149d('0x39')](_[_0x149d('0x40')](_0x2ce7c7[_0x149d('0x37')],_0x250ea5[_0x149d('0x39')]));if(_0x2ce7c7[_0x149d('0x37')][_0x149d('0x44')]){_0x57365d[_0x149d('0x42')]=_['merge'](_0x57365d[_0x149d('0x42')],{'$or':_[_0x149d('0x30')](_0x57365d['attributes'],function(_0x58ea4b){var _0x3ef9ca={};_0x3ef9ca[_0x58ea4b]={'$like':'%'+_0x2ce7c7[_0x149d('0x37')][_0x149d('0x44')]+'%'};return _0x3ef9ca;})});}_0x57365d=_['merge']({},_0x57365d,_0x2ce7c7['options']);return _0x55e9f4[_0x149d('0x64')](_0x57365d);}})[_0x149d('0x28')](function(_0x530813){if(_0x530813){_0x59c885=_0x530813[_0x149d('0x4b')];if(!_0x2ce7c7['query'][_0x149d('0x3d')](_0x149d('0x3e'))){_0x57365d[_0x149d('0x21')]=qs[_0x149d('0x21')](_0x2ce7c7[_0x149d('0x37')][_0x149d('0x21')]);_0x57365d['offset']=qs[_0x149d('0x1f')](_0x2ce7c7[_0x149d('0x37')][_0x149d('0x1f')]);}return _0x55e9f4['getTeams'](_0x57365d);}})[_0x149d('0x28')](function(_0x32ea99){if(_0x32ea99){return _0x32ea99?{'count':_0x59c885,'rows':_0x32ea99}:null;}})[_0x149d('0x28')](respondWithResult(_0x3fd857,null))['catch'](handleError(_0x3fd857,null));};exports[_0x149d('0x66')]=function(_0x3e8698,_0x11460d,_0x1b6758){var _0x2b5332=_0x3e8698[_0x149d('0x4e')][_0x149d('0x67')];return db[_0x149d('0x65')][_0x149d('0x47')]({'where':{'id':_0x2b5332},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x149d('0x2e'),_0x149d('0x68'),_0x149d('0x69'),'interface'],'raw':!![]}]})[_0x149d('0x28')](function(_0x3eb0d3){if(_0x3eb0d3){var _0x124c4e=_['flatMap'](_0x3eb0d3,function(_0x4df251){var _0x44552a=_0x4df251[_0x149d('0x52')]({'plain':!![]});return _0x44552a[_0x149d('0x6a')];});return db['FaxQueue']['find']({'where':{'id':_0x3e8698[_0x149d('0x4a')]['id']}})[_0x149d('0x28')](function(_0x3ab368){return db[_0x149d('0x6b')][_0x149d('0x6c')](function(_0x5863c7){return _0x3ab368['addTeams'](_0x2b5332,{'transaction':_0x5863c7})[_0x149d('0x28')](function(){return BPromise[_0x149d('0x6d')](_0x124c4e,function(_0x176e6b){return db[_0x149d('0x5b')][_0x149d('0x6e')]({'where':{'UserId':_0x176e6b['id'],'FaxQueueId':_0x3e8698['params']['id']},'transaction':_0x5863c7});});})['then'](function(){_0x124c4e[_0x149d('0x6f')](function(_0x349151){socket[_0x149d('0x70')]('userFaxQueue:save',{'UserId':_0x349151['id'],'FaxQueueId':_0x3ab368['id']});});});});});}})[_0x149d('0x28')](respondWithStatusCode(_0x11460d,null))['catch'](handleError(_0x11460d,null));};exports[_0x149d('0x71')]=function(_0x5529c4,_0x11cb2e,_0x401672){return db[_0x149d('0x65')][_0x149d('0x47')]({'where':{'id':_0x5529c4[_0x149d('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x149d('0x5c')],'as':_0x149d('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x149d('0x28')](handleEntityNotFound(_0x11cb2e,null))[_0x149d('0x28')](function(_0x419099){var _0x430796=_['map'](_0x419099,'id');var _0x571383=[];var _0x43ce63=[];var _0x2a1887=squel[_0x149d('0x72')]();_0x2a1887[_0x149d('0x73')](_0x149d('0x74'))['from'](_0x149d('0x75'),'tq')[_0x149d('0x76')](_0x149d('0x77'),'ut',_0x149d('0x78'))[_0x149d('0x42')](_0x149d('0x79'),_0x5529c4[_0x149d('0x4a')]['id']);for(var _0x591bdd=0x0;_0x591bdd<_0x419099['length'];_0x591bdd+=0x1){let _0x1b1bda=_0x419099[_0x591bdd];for(var _0x51cc54=0x0;_0x51cc54<_0x1b1bda['Agents'][_0x149d('0x4b')];_0x51cc54+=0x1){let _0x40ed1c=_0x1b1bda[_0x149d('0x6a')][_0x51cc54];var _0x1141c7=_0x2a1887[_0x149d('0x7a')]();_0x1141c7[_0x149d('0x42')](_0x149d('0x7b'),_0x40ed1c['id']);_0x43ce63[_0x149d('0x7c')](db['sequelize'][_0x149d('0x37')](_0x1141c7['toString'](),{'type':db[_0x149d('0x6b')][_0x149d('0x7d')][_0x149d('0x7e')]})[_0x149d('0x28')](function(_0x305e73){if(_0x305e73['length']===0x1){return _0x40ed1c['id'];}else{var _0x50860c=_[_0x149d('0x7f')](_[_0x149d('0x30')](_0x305e73,_0x149d('0x80')),function(_0xcf3a37){return _[_0x149d('0x81')](_0x430796,_0xcf3a37);});if(_0x50860c){return _0x40ed1c['id'];}}}));}}return BPromise[_0x149d('0x82')](_0x43ce63)[_0x149d('0x28')](function(_0x18da4b){_0x571383=_(_0x571383)[_0x149d('0x83')](_0x18da4b)[_0x149d('0x84')]()[_0x149d('0x85')]();return db[_0x149d('0x31')][_0x149d('0x4c')]({'where':{'id':_0x5529c4[_0x149d('0x4a')]['id']}})[_0x149d('0x28')](function(_0x8e0881){return db[_0x149d('0x6b')]['transaction'](function(_0x7e4bd3){return _0x8e0881[_0x149d('0x71')](_0x5529c4[_0x149d('0x37')][_0x149d('0x67')],{'transaction':_0x7e4bd3})[_0x149d('0x28')](function(){if(!_[_0x149d('0x86')](_0x571383)){return _0x8e0881[_0x149d('0x87')](_0x571383,{'transaction':_0x7e4bd3});}})[_0x149d('0x28')](function(){_0x571383[_0x149d('0x6f')](function(_0x3fd09e){socket[_0x149d('0x70')]('userFaxQueue:remove',{'UserId':_0x3fd09e,'FaxQueueId':_0x8e0881['id']});});});});});});})[_0x149d('0x28')](respondWithStatusCode(_0x11cb2e,null))[_0x149d('0x48')](handleError(_0x11cb2e,null));};exports[_0x149d('0x88')]=function(_0x472e03,_0x59ded3,_0x5d37fc){return db[_0x149d('0x31')][_0x149d('0x4c')]({'where':{'id':_0x472e03[_0x149d('0x4a')]['id']}})[_0x149d('0x28')](handleEntityNotFound(_0x59ded3,null))[_0x149d('0x28')](function(_0x4f06ec){if(_0x4f06ec){return _0x4f06ec[_0x149d('0x88')](_0x472e03[_0x149d('0x4e')][_0x149d('0x67')],_['omit'](_0x472e03[_0x149d('0x4e')],['ids','id'])||{})[_0x149d('0x89')](function(_0x5ec548){for(var _0x45f9be=0x0;_0x45f9be<_0x472e03[_0x149d('0x4e')][_0x149d('0x67')][_0x149d('0x4b')];_0x45f9be+=0x1){socket[_0x149d('0x70')](_0x149d('0x8a'),{'UserId':Number(_0x472e03['body'][_0x149d('0x67')][_0x45f9be]),'FaxQueueId':Number(_0x472e03['params']['id'])});}return _0x5ec548;});}})[_0x149d('0x28')](respondWithResult(_0x59ded3,null))[_0x149d('0x48')](handleError(_0x59ded3,null));};exports['removeAgents']=function(_0x56e4df,_0x524888,_0x2a783d){return db['FaxQueue'][_0x149d('0x4c')]({'where':{'id':_0x56e4df['params']['id']}})[_0x149d('0x28')](handleEntityNotFound(_0x524888,null))[_0x149d('0x28')](function(_0x24ca81){if(_0x24ca81){return _0x24ca81[_0x149d('0x87')](_0x56e4df[_0x149d('0x37')]['ids'])[_0x149d('0x28')](function(){if(_['isArray'](_0x56e4df[_0x149d('0x37')][_0x149d('0x67')])){for(var _0x16704f=0x0;_0x16704f<_0x56e4df[_0x149d('0x37')][_0x149d('0x67')][_0x149d('0x4b')];_0x16704f+=0x1){socket[_0x149d('0x70')](_0x149d('0x8b'),{'UserId':Number(_0x56e4df[_0x149d('0x37')]['ids'][_0x16704f]),'FaxQueueId':Number(_0x56e4df['params']['id'])});}}else{socket[_0x149d('0x70')](_0x149d('0x8b'),{'UserId':Number(_0x56e4df[_0x149d('0x37')][_0x149d('0x67')]),'FaxQueueId':Number(_0x56e4df[_0x149d('0x4a')]['id'])});}});}})[_0x149d('0x28')](respondWithStatusCode(_0x524888,null))['catch'](handleError(_0x524888,null));};exports['getAgents']=function(_0x1d42c7,_0x3111fd,_0x49afae){var _0x23ab1d={};var _0x438a19={};var _0x1d9632;var _0x122652;return db[_0x149d('0x31')][_0x149d('0x57')]({'where':{'id':_0x1d42c7[_0x149d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3111fd,null))[_0x149d('0x28')](function(_0x47e740){if(_0x47e740){_0x1d9632=_0x47e740;_0x438a19[_0x149d('0x36')]=_[_0x149d('0x38')](db[_0x149d('0x5c')][_0x149d('0x32')]);_0x438a19[_0x149d('0x37')]=_[_0x149d('0x38')](_0x1d42c7[_0x149d('0x37')]);_0x438a19[_0x149d('0x39')]=_['intersection'](_0x438a19[_0x149d('0x36')],_0x438a19[_0x149d('0x37')]);_0x23ab1d[_0x149d('0x3b')]=_[_0x149d('0x3a')](_0x438a19[_0x149d('0x36')],qs[_0x149d('0x3c')](_0x1d42c7[_0x149d('0x37')][_0x149d('0x3c')]));_0x23ab1d[_0x149d('0x3b')]=_0x23ab1d[_0x149d('0x3b')][_0x149d('0x4b')]?_0x23ab1d['attributes']:_0x438a19['model'];_0x23ab1d[_0x149d('0x3f')]=qs['sort'](_0x1d42c7[_0x149d('0x37')]['sort']);_0x23ab1d[_0x149d('0x42')]=qs[_0x149d('0x39')](_['pick'](_0x1d42c7['query'],_0x438a19[_0x149d('0x39')]));if(_0x1d42c7['query'][_0x149d('0x44')]){_0x23ab1d[_0x149d('0x42')]=_[_0x149d('0x41')](_0x23ab1d[_0x149d('0x42')],{'$or':_['map'](_0x23ab1d[_0x149d('0x3b')],function(_0x38f497){var _0x3f16b9={};_0x3f16b9[_0x38f497]={'$like':'%'+_0x1d42c7['query'][_0x149d('0x44')]+'%'};return _0x3f16b9;})});}_0x23ab1d=_[_0x149d('0x41')]({},_0x23ab1d,_0x1d42c7[_0x149d('0x5a')]);return _0x1d9632[_0x149d('0x8c')](_0x23ab1d);}})[_0x149d('0x28')](function(_0x460d28){if(_0x460d28){_0x122652=_0x460d28[_0x149d('0x4b')];if(!_0x1d42c7[_0x149d('0x37')][_0x149d('0x3d')](_0x149d('0x3e'))){_0x23ab1d[_0x149d('0x21')]=qs[_0x149d('0x21')](_0x1d42c7['query']['limit']);_0x23ab1d['offset']=qs['offset'](_0x1d42c7[_0x149d('0x37')]['offset']);}return _0x1d9632['getAgents'](_0x23ab1d);}})[_0x149d('0x28')](function(_0x23971d){if(_0x23971d){return _0x23971d?{'count':_0x122652,'rows':_0x23971d}:null;}})[_0x149d('0x28')](respondWithResult(_0x3111fd,null))[_0x149d('0x48')](handleError(_0x3111fd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 64f644c..8da13c7 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 _0x04d1=['exports','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x58472a,_0x371629){var _0x54ce0f=function(_0x8fbbe6){while(--_0x8fbbe6){_0x58472a['push'](_0x58472a['shift']());}};_0x54ce0f(++_0x371629);}(_0x04d1,0xf1));var _0x104d=function(_0x453df9,_0x57bf79){_0x453df9=_0x453df9-0x0;var _0x20e847=_0x04d1[_0x453df9];return _0x20e847;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x104d('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x104d('0x1')](0x0);var events={'afterCreate':_0x104d('0x2'),'afterUpdate':'update','afterDestroy':_0x104d('0x3')};function emitEvent(_0x33205c){return function(_0x1812a5,_0x47a81b,_0x1df518){FaxQueueEvents[_0x104d('0x4')](_0x33205c+':'+_0x1812a5['id'],_0x1812a5);FaxQueueEvents[_0x104d('0x4')](_0x33205c,_0x1812a5);_0x1df518(null);};}for(var e in events){if(events[_0x104d('0x5')](e)){var event=events[e];FaxQueue[_0x104d('0x6')](e,emitEvent(event));}}module[_0x104d('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xd675=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x44dacb,_0x5da477){var _0x1d1bb3=function(_0x3a4783){while(--_0x3a4783){_0x44dacb['push'](_0x44dacb['shift']());}};_0x1d1bb3(++_0x5da477);}(_0xd675,0x121));var _0x5d67=function(_0x225074,_0x1abb16){_0x225074=_0x225074-0x0;var _0x3fb50c=_0xd675[_0x225074];return _0x3fb50c;};'use strict';var EventEmitter=require(_0x5d67('0x0'));var FaxQueue=require(_0x5d67('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5d67('0x2')](0x0);var events={'afterCreate':_0x5d67('0x3'),'afterUpdate':_0x5d67('0x4'),'afterDestroy':'remove'};function emitEvent(_0x55a123){return function(_0x13ca4b,_0x377f23,_0x1057cd){FaxQueueEvents[_0x5d67('0x5')](_0x55a123+':'+_0x13ca4b['id'],_0x13ca4b);FaxQueueEvents['emit'](_0x55a123,_0x13ca4b);_0x1057cd(null);};}for(var e in events){if(events[_0x5d67('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5d67('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6db5afd..655ee41 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 _0xc1f1=['../../config/environment','./faxQueue.attributes','exports','define','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x54bd71,_0x4e5482){var _0x2e6a6f=function(_0x181ff9){while(--_0x181ff9){_0x54bd71['push'](_0x54bd71['shift']());}};_0x2e6a6f(++_0x4e5482);}(_0xc1f1,0xea));var _0x1c1f=function(_0x3fe0fe,_0x3bdc49){_0x3fe0fe=_0x3fe0fe-0x0;var _0x5c11f4=_0xc1f1[_0x3fe0fe];return _0x5c11f4;};'use strict';var _=require(_0x1c1f('0x0'));var util=require(_0x1c1f('0x1'));var logger=require(_0x1c1f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c1f('0x3'));var rp=require(_0x1c1f('0x4'));var fs=require('fs');var path=require(_0x1c1f('0x5'));var rimraf=require('rimraf');var config=require(_0x1c1f('0x6'));var attributes=require(_0x1c1f('0x7'));module[_0x1c1f('0x8')]=function(_0x168c57,_0x1102eb){return _0x168c57[_0x1c1f('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb535=['./faxQueue.attributes','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x480aaf,_0x1fec98){var _0x435d64=function(_0x286427){while(--_0x286427){_0x480aaf['push'](_0x480aaf['shift']());}};_0x435d64(++_0x1fec98);}(_0xb535,0xc9));var _0x5b53=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xb535[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x5b53('0x0'));var util=require(_0x5b53('0x1'));var logger=require(_0x5b53('0x2'))(_0x5b53('0x3'));var moment=require(_0x5b53('0x4'));var BPromise=require(_0x5b53('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b53('0x6'));var config=require(_0x5b53('0x7'));var attributes=require(_0x5b53('0x8'));module['exports']=function(_0x574256,_0x176308){return _0x574256['define'](_0x5b53('0x9'),attributes,{'tableName':_0x5b53('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 3dc2a42..7ffb1bf 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 _0xd7b7=['register','request','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue','ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./faxQueue.socket'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xd7b7,0xba));var _0x7d7b=function(_0x20817f,_0x36b788){_0x20817f=_0x20817f-0x0;var _0xde945=_0xd7b7[_0x20817f];return _0xde945;};'use strict';var _=require('lodash');var util=require(_0x7d7b('0x0'));var moment=require(_0x7d7b('0x1'));var BPromise=require(_0x7d7b('0x2'));var rs=require(_0x7d7b('0x3'));var fs=require('fs');var Redis=require(_0x7d7b('0x4'));var db=require(_0x7d7b('0x5'))['db'];var utils=require(_0x7d7b('0x6'));var logger=require(_0x7d7b('0x7'))(_0x7d7b('0x8'));var config=require(_0x7d7b('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7d7b('0xa')]=_[_0x7d7b('0xb')](config['redis'],{'host':_0x7d7b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d7b('0xd'))[_0x7d7b('0xe')](socket);function respondWithRpcPromise(_0x5c2357,_0x338177,_0x3d898e){return new BPromise(function(_0x39fe25,_0x17318c){return client[_0x7d7b('0xf')](_0x5c2357,_0x3d898e)['then'](function(_0x35ca2c){logger['info'](_0x7d7b('0x10'),_0x338177,'request\x20sent');logger[_0x7d7b('0x11')](_0x7d7b('0x12'),_0x338177,'request\x20sent',JSON[_0x7d7b('0x13')](_0x35ca2c));if(_0x35ca2c[_0x7d7b('0x14')]){if(_0x35ca2c['error'][_0x7d7b('0x15')]===0x1f4){logger[_0x7d7b('0x14')](_0x7d7b('0x10'),_0x338177,_0x35ca2c[_0x7d7b('0x14')][_0x7d7b('0x16')]);return _0x17318c(_0x35ca2c['error'][_0x7d7b('0x16')]);}logger[_0x7d7b('0x14')](_0x7d7b('0x10'),_0x338177,_0x35ca2c[_0x7d7b('0x14')][_0x7d7b('0x16')]);return _0x39fe25(_0x35ca2c['error']['message']);}else{logger[_0x7d7b('0x17')]('FaxQueue,\x20%s,\x20%s',_0x338177,'request\x20sent');_0x39fe25(_0x35ca2c[_0x7d7b('0x18')][_0x7d7b('0x16')]);}})[_0x7d7b('0x19')](function(_0x5dd672){logger['error'](_0x7d7b('0x10'),_0x338177,_0x5dd672);_0x17318c(_0x5dd672);});});}exports['GetFaxQueue']=function(_0x4b021b){var _0x428ebc=this;return new Promise(function(_0x3841ea,_0x34278b){return db[_0x7d7b('0x1a')][_0x7d7b('0x1b')]({'raw':_0x4b021b[_0x7d7b('0x1c')]?_0x4b021b['options'][_0x7d7b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b021b[_0x7d7b('0x1c')]?_0x4b021b[_0x7d7b('0x1c')][_0x7d7b('0x1e')]||null:null,'attributes':_0x4b021b['options']?_0x4b021b[_0x7d7b('0x1c')][_0x7d7b('0x1f')]||null:null,'limit':_0x4b021b[_0x7d7b('0x1c')]?_0x4b021b['options'][_0x7d7b('0x20')]||null:null,'include':_0x4b021b[_0x7d7b('0x1c')]?_0x4b021b[_0x7d7b('0x1c')][_0x7d7b('0x21')]?_[_0x7d7b('0x22')](_0x4b021b[_0x7d7b('0x1c')][_0x7d7b('0x21')],function(_0x256bed){return{'model':db[_0x256bed[_0x7d7b('0x23')]],'as':_0x256bed['as'],'attributes':_0x256bed[_0x7d7b('0x1f')],'include':_0x256bed['include']?_[_0x7d7b('0x22')](_0x256bed[_0x7d7b('0x21')],function(_0x3eb009){return{'model':db[_0x3eb009[_0x7d7b('0x23')]],'as':_0x3eb009['as'],'attributes':_0x3eb009['attributes'],'include':_0x3eb009[_0x7d7b('0x21')]?_[_0x7d7b('0x22')](_0x3eb009['include'],function(_0x111320){return{'model':db[_0x111320[_0x7d7b('0x23')]],'as':_0x111320['as'],'attributes':_0x111320[_0x7d7b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7d7b('0x24')](function(_0x2b956a){logger[_0x7d7b('0x17')](_0x7d7b('0x25'),_0x4b021b);logger[_0x7d7b('0x11')](_0x7d7b('0x25'),_0x4b021b,JSON[_0x7d7b('0x13')](_0x2b956a));_0x3841ea(_0x2b956a);})[_0x7d7b('0x19')](function(_0x2ea03c){logger[_0x7d7b('0x14')](_0x7d7b('0x25'),_0x2ea03c[_0x7d7b('0x16')],_0x4b021b);_0x34278b(_0x428ebc[_0x7d7b('0x14')](0x1f4,_0x2ea03c['message']));});});};exports[_0x7d7b('0x26')]=function(_0x534ac6){var _0x21e806=this;return new Promise(function(_0x30dda3,_0x2588f3){return db[_0x7d7b('0x1a')][_0x7d7b('0x27')]({'raw':_0x534ac6[_0x7d7b('0x1c')]?_0x534ac6[_0x7d7b('0x1c')][_0x7d7b('0x1d')]===undefined?!![]:![]:!![],'where':_0x534ac6[_0x7d7b('0x1c')]?_0x534ac6['options'][_0x7d7b('0x1e')]||null:null,'attributes':_0x534ac6[_0x7d7b('0x1c')]?_0x534ac6[_0x7d7b('0x1c')][_0x7d7b('0x1f')]||null:null,'include':_0x534ac6[_0x7d7b('0x1c')]?_0x534ac6['options'][_0x7d7b('0x21')]?_[_0x7d7b('0x22')](_0x534ac6[_0x7d7b('0x1c')][_0x7d7b('0x21')],function(_0x56a74d){return{'model':db[_0x56a74d['model']],'as':_0x56a74d['as'],'attributes':_0x56a74d[_0x7d7b('0x1f')],'include':_0x56a74d[_0x7d7b('0x21')]?_[_0x7d7b('0x22')](_0x56a74d[_0x7d7b('0x21')],function(_0xe33123){return{'model':db[_0xe33123[_0x7d7b('0x23')]],'as':_0xe33123['as'],'attributes':_0xe33123[_0x7d7b('0x1f')],'include':_0xe33123[_0x7d7b('0x21')]?_['map'](_0xe33123[_0x7d7b('0x21')],function(_0x35f87a){return{'model':db[_0x35f87a[_0x7d7b('0x23')]],'as':_0x35f87a['as'],'attributes':_0x35f87a[_0x7d7b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22514d){logger['info']('ShowFaxQueue',_0x534ac6);logger['debug'](_0x7d7b('0x26'),_0x534ac6,JSON[_0x7d7b('0x13')](_0x22514d));_0x30dda3(_0x22514d);})['catch'](function(_0x3176f1){logger[_0x7d7b('0x14')](_0x7d7b('0x26'),_0x3176f1[_0x7d7b('0x16')],_0x534ac6);_0x2588f3(_0x21e806['error'](0x1f4,_0x3176f1[_0x7d7b('0x16')]));});});}; \ No newline at end of file +var _0x3f1f=['client','http','redis','defaults','localhost','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','map','model','include','GetFaxQueue','FaxQueue','where','ShowFaxQueue','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x32d1b2,_0x26b4a3){var _0x1b1c9f=function(_0x5308a7){while(--_0x5308a7){_0x32d1b2['push'](_0x32d1b2['shift']());}};_0x1b1c9f(++_0x26b4a3);}(_0x3f1f,0x1f2));var _0xf3f1=function(_0x137cb4,_0x90bbf8){_0x137cb4=_0x137cb4-0x0;var _0x2f9041=_0x3f1f[_0x137cb4];return _0x2f9041;};'use strict';var _=require(_0xf3f1('0x0'));var util=require('util');var moment=require(_0xf3f1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3f1('0x2'));var fs=require('fs');var Redis=require(_0xf3f1('0x3'));var db=require(_0xf3f1('0x4'))['db'];var utils=require(_0xf3f1('0x5'));var logger=require(_0xf3f1('0x6'))(_0xf3f1('0x7'));var config=require('../../config/environment');var jayson=require(_0xf3f1('0x8'));var client=jayson[_0xf3f1('0x9')][_0xf3f1('0xa')]({'port':0x232a});config[_0xf3f1('0xb')]=_[_0xf3f1('0xc')](config['redis'],{'host':_0xf3f1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3f1('0xb')]));require(_0xf3f1('0xe'))[_0xf3f1('0xf')](socket);function respondWithRpcPromise(_0x234e5f,_0x3ae0bd,_0x55340d){return new BPromise(function(_0x5bf7a4,_0x5e519a){return client['request'](_0x234e5f,_0x55340d)[_0xf3f1('0x10')](function(_0x78265f){logger[_0xf3f1('0x11')](_0xf3f1('0x12'),_0x3ae0bd,_0xf3f1('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3ae0bd,_0xf3f1('0x13'),JSON[_0xf3f1('0x14')](_0x78265f));if(_0x78265f[_0xf3f1('0x15')]){if(_0x78265f[_0xf3f1('0x15')][_0xf3f1('0x16')]===0x1f4){logger['error'](_0xf3f1('0x12'),_0x3ae0bd,_0x78265f[_0xf3f1('0x15')][_0xf3f1('0x17')]);return _0x5e519a(_0x78265f[_0xf3f1('0x15')][_0xf3f1('0x17')]);}logger[_0xf3f1('0x15')](_0xf3f1('0x12'),_0x3ae0bd,_0x78265f['error'][_0xf3f1('0x17')]);return _0x5bf7a4(_0x78265f['error'][_0xf3f1('0x17')]);}else{logger[_0xf3f1('0x11')](_0xf3f1('0x12'),_0x3ae0bd,_0xf3f1('0x13'));_0x5bf7a4(_0x78265f[_0xf3f1('0x18')]['message']);}})[_0xf3f1('0x19')](function(_0x1e5e5e){logger['error'](_0xf3f1('0x12'),_0x3ae0bd,_0x1e5e5e);_0x5e519a(_0x1e5e5e);});});}exports['GetFaxQueue']=function(_0x2201ea){var _0x12b40f=this;return new Promise(function(_0x1e5446,_0x4b50b7){return db['FaxQueue'][_0xf3f1('0x1a')]({'raw':_0x2201ea[_0xf3f1('0x1b')]?_0x2201ea[_0xf3f1('0x1b')][_0xf3f1('0x1c')]===undefined?!![]:![]:!![],'where':_0x2201ea[_0xf3f1('0x1b')]?_0x2201ea[_0xf3f1('0x1b')]['where']||null:null,'attributes':_0x2201ea[_0xf3f1('0x1b')]?_0x2201ea[_0xf3f1('0x1b')][_0xf3f1('0x1d')]||null:null,'limit':_0x2201ea[_0xf3f1('0x1b')]?_0x2201ea[_0xf3f1('0x1b')][_0xf3f1('0x1e')]||null:null,'include':_0x2201ea[_0xf3f1('0x1b')]?_0x2201ea['options']['include']?_[_0xf3f1('0x1f')](_0x2201ea[_0xf3f1('0x1b')]['include'],function(_0x2dc20c){return{'model':db[_0x2dc20c[_0xf3f1('0x20')]],'as':_0x2dc20c['as'],'attributes':_0x2dc20c[_0xf3f1('0x1d')],'include':_0x2dc20c[_0xf3f1('0x21')]?_[_0xf3f1('0x1f')](_0x2dc20c[_0xf3f1('0x21')],function(_0x5aa444){return{'model':db[_0x5aa444['model']],'as':_0x5aa444['as'],'attributes':_0x5aa444[_0xf3f1('0x1d')],'include':_0x5aa444['include']?_[_0xf3f1('0x1f')](_0x5aa444[_0xf3f1('0x21')],function(_0x542398){return{'model':db[_0x542398[_0xf3f1('0x20')]],'as':_0x542398['as'],'attributes':_0x542398[_0xf3f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf3f1('0x10')](function(_0x2ec1b7){logger['info']('GetFaxQueue',_0x2201ea);logger['debug'](_0xf3f1('0x22'),_0x2201ea,JSON[_0xf3f1('0x14')](_0x2ec1b7));_0x1e5446(_0x2ec1b7);})['catch'](function(_0xd66b54){logger[_0xf3f1('0x15')](_0xf3f1('0x22'),_0xd66b54[_0xf3f1('0x17')],_0x2201ea);_0x4b50b7(_0x12b40f[_0xf3f1('0x15')](0x1f4,_0xd66b54[_0xf3f1('0x17')]));});});};exports['ShowFaxQueue']=function(_0x41a610){var _0x32752d=this;return new Promise(function(_0x397cf5,_0x23aedb){return db[_0xf3f1('0x23')]['find']({'raw':_0x41a610[_0xf3f1('0x1b')]?_0x41a610['options'][_0xf3f1('0x1c')]===undefined?!![]:![]:!![],'where':_0x41a610[_0xf3f1('0x1b')]?_0x41a610[_0xf3f1('0x1b')][_0xf3f1('0x24')]||null:null,'attributes':_0x41a610[_0xf3f1('0x1b')]?_0x41a610[_0xf3f1('0x1b')][_0xf3f1('0x1d')]||null:null,'include':_0x41a610[_0xf3f1('0x1b')]?_0x41a610[_0xf3f1('0x1b')][_0xf3f1('0x21')]?_['map'](_0x41a610[_0xf3f1('0x1b')]['include'],function(_0x1c90a0){return{'model':db[_0x1c90a0[_0xf3f1('0x20')]],'as':_0x1c90a0['as'],'attributes':_0x1c90a0[_0xf3f1('0x1d')],'include':_0x1c90a0[_0xf3f1('0x21')]?_['map'](_0x1c90a0[_0xf3f1('0x21')],function(_0x1b1b1d){return{'model':db[_0x1b1b1d[_0xf3f1('0x20')]],'as':_0x1b1b1d['as'],'attributes':_0x1b1b1d[_0xf3f1('0x1d')],'include':_0x1b1b1d[_0xf3f1('0x21')]?_['map'](_0x1b1b1d[_0xf3f1('0x21')],function(_0x3996f4){return{'model':db[_0x3996f4[_0xf3f1('0x20')]],'as':_0x3996f4['as'],'attributes':_0x3996f4[_0xf3f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf3f1('0x10')](function(_0x254d74){logger[_0xf3f1('0x11')](_0xf3f1('0x25'),_0x41a610);logger[_0xf3f1('0x26')](_0xf3f1('0x25'),_0x41a610,JSON[_0xf3f1('0x14')](_0x254d74));_0x397cf5(_0x254d74);})[_0xf3f1('0x19')](function(_0x15137c){logger[_0xf3f1('0x15')](_0xf3f1('0x25'),_0x15137c['message'],_0x41a610);_0x23aedb(_0x32752d['error'](0x1f4,_0x15137c[_0xf3f1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 8c264d5..70d45b6 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 _0x484e=['update','removeListener','register','length','faxQueue:','save','remove'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x484e,0x194));var _0xe484=function(_0x1b2604,_0x2f8ccc){_0x1b2604=_0x1b2604-0x0;var _0x1cbdaa=_0x484e[_0x1b2604];return _0x1cbdaa;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xe484('0x0'),_0xe484('0x1'),_0xe484('0x2')];function createListener(_0x3b24da,_0x306316){return function(_0x22bed2){_0x306316['emit'](_0x3b24da,_0x22bed2);};}function removeListener(_0x534e7f,_0x5f20bf){return function(){FaxQueueEvents[_0xe484('0x3')](_0x534e7f,_0x5f20bf);};}exports[_0xe484('0x4')]=function(_0x267d58){for(var _0x577e92=0x0,_0x460c3e=events[_0xe484('0x5')];_0x577e92<_0x460c3e;_0x577e92++){var _0x275b3f=events[_0x577e92];var _0x5a0384=createListener(_0xe484('0x6')+_0x275b3f,_0x267d58);FaxQueueEvents['on'](_0x275b3f,_0x5a0384);}}; \ No newline at end of file +var _0xc9b9=['remove','update','length'];(function(_0x39db05,_0x3868d0){var _0x3f0e22=function(_0x532c4f){while(--_0x532c4f){_0x39db05['push'](_0x39db05['shift']());}};_0x3f0e22(++_0x3868d0);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xc9b9[_0x29ce14];return _0x48f289;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x9c9b('0x0'),_0x9c9b('0x1')];function createListener(_0x3418ab,_0x4e2e8d){return function(_0x5ee8f8){_0x4e2e8d['emit'](_0x3418ab,_0x5ee8f8);};}function removeListener(_0x497d53,_0x38a64b){return function(){FaxQueueEvents['removeListener'](_0x497d53,_0x38a64b);};}exports['register']=function(_0x51abae){for(var _0x1f29f3=0x0,_0x15d94b=events[_0x9c9b('0x2')];_0x1f29f3<_0x15d94b;_0x1f29f3++){var _0x193305=events[_0x1f29f3];var _0xbbd998=createListener('faxQueue:'+_0x193305,_0x51abae);FaxQueueEvents['on'](_0x193305,_0xbbd998);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 99554f6..13ca2b5 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 _0xd101=['addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post'];(function(_0x2e1e82,_0x5e9aec){var _0x1f8117=function(_0xd69113){while(--_0xd69113){_0x2e1e82['push'](_0x2e1e82['shift']());}};_0x1f8117(++_0x5e9aec);}(_0xd101,0xc1));var _0x1d10=function(_0x3073a6,_0x50c2f4){_0x3073a6=_0x3073a6-0x0;var _0x319803=_0xd101[_0x3073a6];return _0x319803;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./faxQueue.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x9')](_0x1d10('0x10'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x9')](_0x1d10('0x12'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);router[_0x1d10('0x9')](_0x1d10('0x14'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x15')]);router['post']('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0x16')]);router[_0x1d10('0x17')](_0x1d10('0x12'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x18')]);router['post'](_0x1d10('0x14'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x19')]);router[_0x1d10('0x1a')]('/:id',auth[_0x1d10('0xa')](),controller[_0x1d10('0x1b')]);router[_0x1d10('0x1c')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x1d')]);router[_0x1d10('0x1c')]('/:id/teams',auth[_0x1d10('0xa')](),controller[_0x1d10('0x1e')]);router[_0x1d10('0x1c')](_0x1d10('0x14'),auth[_0x1d10('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xeda8=['get','isAuthenticated','index','describe','/:id','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','/:id/teams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x520593,_0x47b72a){var _0x4618ba=function(_0x303b8d){while(--_0x303b8d){_0x520593['push'](_0x520593['shift']());}};_0x4618ba(++_0x47b72a);}(_0xeda8,0x104));var _0x8eda=function(_0x53311b,_0x369022){_0x53311b=_0x53311b-0x0;var _0x2f8cc2=_0xeda8[_0x53311b];return _0x2f8cc2;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0xa')]('/:id/teams',auth[_0x8eda('0xb')](),controller['getTeams']);router[_0x8eda('0xa')](_0x8eda('0x10'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x11')]);router[_0x8eda('0x12')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);router[_0x8eda('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8eda('0x14')]);router[_0x8eda('0x12')]('/:id/users',auth[_0x8eda('0xb')](),controller[_0x8eda('0x15')]);router[_0x8eda('0x16')]('/:id',auth[_0x8eda('0xb')](),controller['update']);router[_0x8eda('0x17')]('/:id',auth[_0x8eda('0xb')](),controller['destroy']);router[_0x8eda('0x17')](_0x8eda('0x18'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x8eda('0x17')](_0x8eda('0x10'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x19')]);module[_0x8eda('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 20d79eb..5b9a2c7 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 _0x04f5=['sequelize','exports','STRING','DATE','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04f5,0x9f));var _0x504f=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x04f5[_0x2ca9d4];return _0x258956;};'use strict';var moment=require(_0x504f('0x0'));var Sequelize=require(_0x504f('0x1'));module[_0x504f('0x2')]={'uniqueid':{'type':Sequelize[_0x504f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x504f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x504f('0x4')]},'acceptAt':{'type':Sequelize[_0x504f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x504f('0x3')]}}; \ No newline at end of file +var _0xd436=['exports','STRING','DATE','sequelize'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xd436,0x1af));var _0x6d43=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0xd436[_0x92713a];return _0x1893e1;};'use strict';var moment=require('moment');var Sequelize=require(_0x6d43('0x0'));module[_0x6d43('0x1')]={'uniqueid':{'type':Sequelize[_0x6d43('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6d43('0x2')]},'joinAt':{'type':Sequelize[_0x6d43('0x3')]},'leaveAt':{'type':Sequelize[_0x6d43('0x3')]},'acceptAt':{'type':Sequelize[_0x6d43('0x3')]},'exitAt':{'type':Sequelize[_0x6d43('0x3')]},'reason':{'type':Sequelize[_0x6d43('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5aabc28..4c7eb86 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 _0xd136=['body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','index','map','FaxQueueReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create'];(function(_0x34d6f4,_0x37435f){var _0x1ae55c=function(_0xf83ffe){while(--_0xf83ffe){_0x34d6f4['push'](_0x34d6f4['shift']());}};_0x1ae55c(++_0x37435f);}(_0xd136,0x94));var _0x6d13=function(_0x4f46ff,_0x31a152){_0x4f46ff=_0x4f46ff-0x0;var _0x5d9381=_0xd136[_0x4f46ff];return _0x5d9381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d13('0x0'));var zipdir=require(_0x6d13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d13('0x2'));var moment=require(_0x6d13('0x3'));var BPromise=require(_0x6d13('0x4'));var Mustache=require(_0x6d13('0x5'));var util=require(_0x6d13('0x6'));var path=require(_0x6d13('0x7'));var sox=require(_0x6d13('0x8'));var csv=require(_0x6d13('0x9'));var ejs=require(_0x6d13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d13('0xb'));var squel=require(_0x6d13('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d13('0xd'));var toCsv=require(_0x6d13('0x9'));var querystring=require(_0x6d13('0xe'));var Papa=require(_0x6d13('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d13('0x10'));var as=require(_0x6d13('0x11'));var hardwareService=require(_0x6d13('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6d13('0x13'));var config=require(_0x6d13('0x14'));var licenseUtil=require(_0x6d13('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4cc3,_0x5ef7e6){_0x5ef7e6=_0x5ef7e6||0xcc;return function(_0x37d3c1){if(_0x37d3c1){return _0x1b4cc3[_0x6d13('0x16')](_0x5ef7e6);}return _0x1b4cc3['status'](_0x5ef7e6)['end']();};}function respondWithResult(_0x4ca95d,_0x37efd8){_0x37efd8=_0x37efd8||0xc8;return function(_0x10709d){if(_0x10709d){return _0x4ca95d[_0x6d13('0x17')](_0x37efd8)[_0x6d13('0x18')](_0x10709d);}};}function respondWithFilteredResult(_0x2f4c2b,_0x4f1bdf){return function(_0xf27049){if(_0xf27049){var _0x405368=typeof _0x4f1bdf[_0x6d13('0x19')]===_0x6d13('0x1a')&&typeof _0x4f1bdf[_0x6d13('0x1b')]===_0x6d13('0x1a');var _0xb17857=_0xf27049[_0x6d13('0x1c')];var _0xc6c2b=_0x405368?0x0:_0x4f1bdf['offset'];var _0x276fdd=_0x405368?_0xf27049[_0x6d13('0x1c')]:_0x4f1bdf[_0x6d13('0x19')]+_0x4f1bdf[_0x6d13('0x1b')];var _0x1f3603;if(_0x276fdd>=_0xb17857){_0x276fdd=_0xb17857;_0x1f3603=0xc8;}else{_0x1f3603=0xce;}_0x2f4c2b[_0x6d13('0x17')](_0x1f3603);return _0x2f4c2b[_0x6d13('0x1d')](_0x6d13('0x1e'),_0xc6c2b+'-'+_0x276fdd+'/'+_0xb17857)[_0x6d13('0x18')](_0xf27049);}return null;};}function patchUpdates(_0x427bb8){return function(_0x40f629){try{jsonpatch[_0x6d13('0x1f')](_0x40f629,_0x427bb8,!![]);}catch(_0x18889d){return BPromise[_0x6d13('0x20')](_0x18889d);}return _0x40f629[_0x6d13('0x21')]();};}function saveUpdates(_0x208876,_0x5619fc){return function(_0x387de2){if(_0x387de2){return _0x387de2['update'](_0x208876)[_0x6d13('0x22')](function(_0x204438){return _0x204438;});}return null;};}function removeEntity(_0x151aa4,_0x5bbc9d){return function(_0x1b0f94){if(_0x1b0f94){return _0x1b0f94[_0x6d13('0x23')]()[_0x6d13('0x22')](function(){_0x151aa4[_0x6d13('0x17')](0xcc)[_0x6d13('0x24')]();});}};}function handleEntityNotFound(_0x361432,_0x66e464){return function(_0x821eea){if(!_0x821eea){_0x361432['sendStatus'](0x194);}return _0x821eea;};}function handleError(_0xacf472,_0x4f70e2){_0x4f70e2=_0x4f70e2||0x1f4;return function(_0x4c8526){logger[_0x6d13('0x25')](_0x4c8526['stack']);if(_0x4c8526[_0x6d13('0x26')]){delete _0x4c8526[_0x6d13('0x26')];}_0xacf472[_0x6d13('0x17')](_0x4f70e2)['send'](_0x4c8526);};}exports[_0x6d13('0x27')]=function(_0xd469b6,_0x573080){var _0x2fcdfd={},_0x1eda96={},_0xb82395={'count':0x0,'rows':[]};var _0x438e93=_[_0x6d13('0x28')](db[_0x6d13('0x29')][_0x6d13('0x2a')],function(_0x34abc4){return{'name':_0x34abc4['fieldName'],'type':_0x34abc4[_0x6d13('0x2b')][_0x6d13('0x2c')]};});_0x1eda96['model']=_[_0x6d13('0x28')](_0x438e93,_0x6d13('0x26'));_0x1eda96[_0x6d13('0x2d')]=_['keys'](_0xd469b6[_0x6d13('0x2d')]);_0x1eda96[_0x6d13('0x2e')]=_[_0x6d13('0x2f')](_0x1eda96[_0x6d13('0x30')],_0x1eda96[_0x6d13('0x2d')]);_0x2fcdfd[_0x6d13('0x31')]=_[_0x6d13('0x2f')](_0x1eda96['model'],qs[_0x6d13('0x32')](_0xd469b6['query'][_0x6d13('0x32')]));_0x2fcdfd[_0x6d13('0x31')]=_0x2fcdfd[_0x6d13('0x31')][_0x6d13('0x33')]?_0x2fcdfd[_0x6d13('0x31')]:_0x1eda96[_0x6d13('0x30')];if(!_0xd469b6['query']['hasOwnProperty'](_0x6d13('0x34'))){_0x2fcdfd[_0x6d13('0x1b')]=qs[_0x6d13('0x1b')](_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x1b')]);_0x2fcdfd[_0x6d13('0x19')]=qs['offset'](_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x19')]);}_0x2fcdfd[_0x6d13('0x35')]=qs[_0x6d13('0x36')](_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x36')]);_0x2fcdfd[_0x6d13('0x37')]=qs[_0x6d13('0x2e')](_[_0x6d13('0x38')](_0xd469b6[_0x6d13('0x2d')],_0x1eda96['filters']),_0x438e93);if(_0xd469b6['query'][_0x6d13('0x39')]){_0x2fcdfd['where']=_['merge'](_0x2fcdfd[_0x6d13('0x37')],{'$or':_[_0x6d13('0x28')](_0x438e93,function(_0xba5453){if(_0xba5453['type']!==_0x6d13('0x3a')){var _0x3c5b61={};_0x3c5b61[_0xba5453[_0x6d13('0x26')]]={'$like':'%'+_0xd469b6['query'][_0x6d13('0x39')]+'%'};return _0x3c5b61;}})});}_0x2fcdfd=_['merge']({},_0x2fcdfd,_0xd469b6[_0x6d13('0x3b')]);var _0x4d2bdd={'where':_0x2fcdfd['where']};return db[_0x6d13('0x29')][_0x6d13('0x1c')](_0x4d2bdd)['then'](function(_0x4c31fe){_0xb82395[_0x6d13('0x1c')]=_0x4c31fe;if(_0xd469b6[_0x6d13('0x2d')][_0x6d13('0x3c')]){_0x2fcdfd[_0x6d13('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x6d13('0x3e')](_0x2fcdfd);})[_0x6d13('0x22')](function(_0x4b4cc5){_0xb82395[_0x6d13('0x3f')]=_0x4b4cc5;return _0xb82395;})[_0x6d13('0x22')](respondWithFilteredResult(_0x573080,_0x2fcdfd))[_0x6d13('0x40')](handleError(_0x573080,null));};exports[_0x6d13('0x41')]=function(_0x19456c,_0x112bfd){var _0x289170={'raw':!![],'where':{'id':_0x19456c[_0x6d13('0x42')]['id']}},_0x5f1238={};_0x5f1238[_0x6d13('0x30')]=_[_0x6d13('0x43')](db[_0x6d13('0x29')][_0x6d13('0x2a')]);_0x5f1238[_0x6d13('0x2d')]=_[_0x6d13('0x43')](_0x19456c['query']);_0x5f1238[_0x6d13('0x2e')]=_['intersection'](_0x5f1238[_0x6d13('0x30')],_0x5f1238[_0x6d13('0x2d')]);_0x289170[_0x6d13('0x31')]=_[_0x6d13('0x2f')](_0x5f1238[_0x6d13('0x30')],qs[_0x6d13('0x32')](_0x19456c[_0x6d13('0x2d')][_0x6d13('0x32')]));_0x289170['attributes']=_0x289170[_0x6d13('0x31')]['length']?_0x289170[_0x6d13('0x31')]:_0x5f1238[_0x6d13('0x30')];if(_0x19456c[_0x6d13('0x2d')][_0x6d13('0x3c')]){_0x289170[_0x6d13('0x3d')]=[{'all':!![]}];}_0x289170=_[_0x6d13('0x44')]({},_0x289170,_0x19456c[_0x6d13('0x3b')]);return db[_0x6d13('0x29')][_0x6d13('0x45')](_0x289170)[_0x6d13('0x22')](handleEntityNotFound(_0x112bfd,null))[_0x6d13('0x22')](respondWithResult(_0x112bfd,null))['catch'](handleError(_0x112bfd,null));};exports[_0x6d13('0x46')]=function(_0x3f6821,_0x3ae25c){return db['FaxQueueReport']['create'](_0x3f6821[_0x6d13('0x47')],{})[_0x6d13('0x22')](respondWithResult(_0x3ae25c,0xc9))[_0x6d13('0x40')](handleError(_0x3ae25c,null));};exports['update']=function(_0x3ac978,_0x31872b){if(_0x3ac978[_0x6d13('0x47')]['id']){delete _0x3ac978['body']['id'];}return db[_0x6d13('0x29')][_0x6d13('0x45')]({'where':{'id':_0x3ac978['params']['id']}})['then'](handleEntityNotFound(_0x31872b,null))[_0x6d13('0x22')](saveUpdates(_0x3ac978[_0x6d13('0x47')],null))[_0x6d13('0x22')](respondWithResult(_0x31872b,null))[_0x6d13('0x40')](handleError(_0x31872b,null));};exports[_0x6d13('0x23')]=function(_0x3d3244,_0x5037a3){return db['FaxQueueReport'][_0x6d13('0x45')]({'where':{'id':_0x3d3244[_0x6d13('0x42')]['id']}})[_0x6d13('0x22')](handleEntityNotFound(_0x5037a3,null))[_0x6d13('0x22')](removeEntity(_0x5037a3,null))[_0x6d13('0x40')](handleError(_0x5037a3,null));};exports['describe']=function(_0x1bb289,_0x48ea56){return db[_0x6d13('0x29')][_0x6d13('0x48')]()[_0x6d13('0x22')](respondWithResult(_0x48ea56,null))['catch'](handleError(_0x48ea56,null));}; \ No newline at end of file +var _0x136c=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','keys','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type'];(function(_0x18fe1d,_0x596d69){var _0x37b103=function(_0x10ea2f){while(--_0x10ea2f){_0x18fe1d['push'](_0x18fe1d['shift']());}};_0x37b103(++_0x596d69);}(_0x136c,0x1d2));var _0xc136=function(_0x5df2b4,_0xebbff7){_0x5df2b4=_0x5df2b4-0x0;var _0x1e51f5=_0x136c[_0x5df2b4];return _0x1e51f5;};'use strict';var emlformat=require(_0xc136('0x0'));var rimraf=require(_0xc136('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc136('0x2'));var rp=require(_0xc136('0x3'));var moment=require(_0xc136('0x4'));var BPromise=require(_0xc136('0x5'));var Mustache=require(_0xc136('0x6'));var util=require(_0xc136('0x7'));var path=require(_0xc136('0x8'));var sox=require(_0xc136('0x9'));var csv=require(_0xc136('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc136('0xb'));var _=require('lodash');var squel=require(_0xc136('0xc'));var crypto=require(_0xc136('0xd'));var jsforce=require(_0xc136('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc136('0xa'));var querystring=require('querystring');var Papa=require(_0xc136('0xf'));var Redis=require(_0xc136('0x10'));var authService=require(_0xc136('0x11'));var qs=require(_0xc136('0x12'));var as=require(_0xc136('0x13'));var hardwareService=require(_0xc136('0x14'));var logger=require(_0xc136('0x15'))(_0xc136('0x16'));var utils=require(_0xc136('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc136('0x18'))['db'];function respondWithStatusCode(_0x5d0c62,_0x17b00b){_0x17b00b=_0x17b00b||0xcc;return function(_0x473a8b){if(_0x473a8b){return _0x5d0c62[_0xc136('0x19')](_0x17b00b);}return _0x5d0c62['status'](_0x17b00b)['end']();};}function respondWithResult(_0x15be1a,_0x36d55d){_0x36d55d=_0x36d55d||0xc8;return function(_0x4e2674){if(_0x4e2674){return _0x15be1a['status'](_0x36d55d)['json'](_0x4e2674);}};}function respondWithFilteredResult(_0x2e28ba,_0x16e87f){return function(_0x4fa765){if(_0x4fa765){var _0x4e24fb=typeof _0x16e87f['offset']===_0xc136('0x1a')&&typeof _0x16e87f[_0xc136('0x1b')]===_0xc136('0x1a');var _0x155929=_0x4fa765[_0xc136('0x1c')];var _0x1ccf5f=_0x4e24fb?0x0:_0x16e87f['offset'];var _0x5df9b7=_0x4e24fb?_0x4fa765['count']:_0x16e87f[_0xc136('0x1d')]+_0x16e87f['limit'];var _0x238f8c;if(_0x5df9b7>=_0x155929){_0x5df9b7=_0x155929;_0x238f8c=0xc8;}else{_0x238f8c=0xce;}_0x2e28ba[_0xc136('0x1e')](_0x238f8c);return _0x2e28ba[_0xc136('0x1f')](_0xc136('0x20'),_0x1ccf5f+'-'+_0x5df9b7+'/'+_0x155929)['json'](_0x4fa765);}return null;};}function patchUpdates(_0x2b8527){return function(_0x1f942b){try{jsonpatch['apply'](_0x1f942b,_0x2b8527,!![]);}catch(_0xc26366){return BPromise['reject'](_0xc26366);}return _0x1f942b['save']();};}function saveUpdates(_0x5ac0bf,_0x1a350a){return function(_0x4f766d){if(_0x4f766d){return _0x4f766d[_0xc136('0x21')](_0x5ac0bf)[_0xc136('0x22')](function(_0x279c07){return _0x279c07;});}return null;};}function removeEntity(_0x45e5fe,_0x5d8300){return function(_0x6f0831){if(_0x6f0831){return _0x6f0831[_0xc136('0x23')]()['then'](function(){_0x45e5fe[_0xc136('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a163,_0x16109f){return function(_0x4a9dad){if(!_0x4a9dad){_0x21a163['sendStatus'](0x194);}return _0x4a9dad;};}function handleError(_0x106222,_0x10bda3){_0x10bda3=_0x10bda3||0x1f4;return function(_0x549a60){logger[_0xc136('0x24')](_0x549a60[_0xc136('0x25')]);if(_0x549a60[_0xc136('0x26')]){delete _0x549a60[_0xc136('0x26')];}_0x106222[_0xc136('0x1e')](_0x10bda3)[_0xc136('0x27')](_0x549a60);};}exports[_0xc136('0x28')]=function(_0x5f3027,_0x436db5){var _0x1e023a={},_0x1ad50f={},_0x1b5a23={'count':0x0,'rows':[]};var _0x2bd5df=_[_0xc136('0x29')](db[_0xc136('0x2a')][_0xc136('0x2b')],function(_0x24632e){return{'name':_0x24632e['fieldName'],'type':_0x24632e[_0xc136('0x2c')][_0xc136('0x2d')]};});_0x1ad50f[_0xc136('0x2e')]=_['map'](_0x2bd5df,_0xc136('0x26'));_0x1ad50f['query']=_['keys'](_0x5f3027[_0xc136('0x2f')]);_0x1ad50f[_0xc136('0x30')]=_[_0xc136('0x31')](_0x1ad50f['model'],_0x1ad50f[_0xc136('0x2f')]);_0x1e023a[_0xc136('0x32')]=_['intersection'](_0x1ad50f[_0xc136('0x2e')],qs[_0xc136('0x33')](_0x5f3027['query'][_0xc136('0x33')]));_0x1e023a[_0xc136('0x32')]=_0x1e023a[_0xc136('0x32')][_0xc136('0x34')]?_0x1e023a[_0xc136('0x32')]:_0x1ad50f[_0xc136('0x2e')];if(!_0x5f3027[_0xc136('0x2f')][_0xc136('0x35')](_0xc136('0x36'))){_0x1e023a[_0xc136('0x1b')]=qs[_0xc136('0x1b')](_0x5f3027[_0xc136('0x2f')]['limit']);_0x1e023a[_0xc136('0x1d')]=qs[_0xc136('0x1d')](_0x5f3027[_0xc136('0x2f')][_0xc136('0x1d')]);}_0x1e023a[_0xc136('0x37')]=qs[_0xc136('0x38')](_0x5f3027[_0xc136('0x2f')]['sort']);_0x1e023a[_0xc136('0x39')]=qs[_0xc136('0x30')](_[_0xc136('0x3a')](_0x5f3027[_0xc136('0x2f')],_0x1ad50f[_0xc136('0x30')]),_0x2bd5df);if(_0x5f3027[_0xc136('0x2f')][_0xc136('0x3b')]){_0x1e023a['where']=_[_0xc136('0x3c')](_0x1e023a[_0xc136('0x39')],{'$or':_[_0xc136('0x29')](_0x2bd5df,function(_0x376846){if(_0x376846[_0xc136('0x2c')]!=='VIRTUAL'){var _0x27ac5f={};_0x27ac5f[_0x376846[_0xc136('0x26')]]={'$like':'%'+_0x5f3027['query'][_0xc136('0x3b')]+'%'};return _0x27ac5f;}})});}_0x1e023a=_[_0xc136('0x3c')]({},_0x1e023a,_0x5f3027[_0xc136('0x3d')]);var _0xd7ca2a={'where':_0x1e023a[_0xc136('0x39')]};return db['FaxQueueReport']['count'](_0xd7ca2a)[_0xc136('0x22')](function(_0x5d8d1e){_0x1b5a23[_0xc136('0x1c')]=_0x5d8d1e;if(_0x5f3027[_0xc136('0x2f')][_0xc136('0x3e')]){_0x1e023a[_0xc136('0x3f')]=[{'all':!![]}];}return db[_0xc136('0x2a')][_0xc136('0x40')](_0x1e023a);})[_0xc136('0x22')](function(_0x51af1e){_0x1b5a23['rows']=_0x51af1e;return _0x1b5a23;})[_0xc136('0x22')](respondWithFilteredResult(_0x436db5,_0x1e023a))['catch'](handleError(_0x436db5,null));};exports[_0xc136('0x41')]=function(_0x38e84d,_0x5434d0){var _0x126000={'raw':!![],'where':{'id':_0x38e84d['params']['id']}},_0x2c18c6={};_0x2c18c6['model']=_['keys'](db[_0xc136('0x2a')][_0xc136('0x2b')]);_0x2c18c6['query']=_[_0xc136('0x42')](_0x38e84d[_0xc136('0x2f')]);_0x2c18c6[_0xc136('0x30')]=_['intersection'](_0x2c18c6[_0xc136('0x2e')],_0x2c18c6[_0xc136('0x2f')]);_0x126000[_0xc136('0x32')]=_[_0xc136('0x31')](_0x2c18c6[_0xc136('0x2e')],qs['fields'](_0x38e84d[_0xc136('0x2f')][_0xc136('0x33')]));_0x126000[_0xc136('0x32')]=_0x126000[_0xc136('0x32')][_0xc136('0x34')]?_0x126000[_0xc136('0x32')]:_0x2c18c6[_0xc136('0x2e')];if(_0x38e84d[_0xc136('0x2f')][_0xc136('0x3e')]){_0x126000[_0xc136('0x3f')]=[{'all':!![]}];}_0x126000=_[_0xc136('0x3c')]({},_0x126000,_0x38e84d[_0xc136('0x3d')]);return db[_0xc136('0x2a')][_0xc136('0x43')](_0x126000)[_0xc136('0x22')](handleEntityNotFound(_0x5434d0,null))[_0xc136('0x22')](respondWithResult(_0x5434d0,null))[_0xc136('0x44')](handleError(_0x5434d0,null));};exports[_0xc136('0x45')]=function(_0x18b615,_0x18345f){return db['FaxQueueReport'][_0xc136('0x45')](_0x18b615[_0xc136('0x46')],{})[_0xc136('0x22')](respondWithResult(_0x18345f,0xc9))['catch'](handleError(_0x18345f,null));};exports['update']=function(_0x34193c,_0x24f258){if(_0x34193c[_0xc136('0x46')]['id']){delete _0x34193c[_0xc136('0x46')]['id'];}return db[_0xc136('0x2a')]['find']({'where':{'id':_0x34193c[_0xc136('0x47')]['id']}})[_0xc136('0x22')](handleEntityNotFound(_0x24f258,null))[_0xc136('0x22')](saveUpdates(_0x34193c[_0xc136('0x46')],null))[_0xc136('0x22')](respondWithResult(_0x24f258,null))[_0xc136('0x44')](handleError(_0x24f258,null));};exports[_0xc136('0x23')]=function(_0x4ea74f,_0x3283f8){return db[_0xc136('0x2a')][_0xc136('0x43')]({'where':{'id':_0x4ea74f[_0xc136('0x47')]['id']}})['then'](handleEntityNotFound(_0x3283f8,null))['then'](removeEntity(_0x3283f8,null))[_0xc136('0x44')](handleError(_0x3283f8,null));};exports[_0xc136('0x48')]=function(_0x4bf684,_0x1bd1f7){return db[_0xc136('0x2a')][_0xc136('0x48')]()[_0xc136('0x22')](respondWithResult(_0x1bd1f7,null))[_0xc136('0x44')](handleError(_0x1bd1f7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index faf5778..a5ad9db 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x510ee9,_0xfd8b59){var _0xc4e23=function(_0x1d19c8){while(--_0x1d19c8){_0x510ee9['push'](_0x510ee9['shift']());}};_0xc4e23(++_0xfd8b59);}(_0x5fc3,0xa8));var _0x35fc=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x5fc3[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x32755b,_0x5776b5){var _0x30da79=function(_0x3f89c4){while(--_0x3f89c4){_0x32755b['push'](_0x32755b['shift']());}};_0x30da79(++_0x5776b5);}(_0x7a54,0x106));var _0x47a5=function(_0x5cea34,_0x502587){_0x5cea34=_0x5cea34-0x0;var _0x502398=_0x7a54[_0x5cea34];return _0x502398;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 87f5fa3..95a5809 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 _0xa5cc=['jayson/promise','client','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','create','body','options','CreateFaxQueueReport','FaxQueueReport','update','raw','where','attributes','UpdateFaxQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x49c2cb,_0x1d86a9){var _0x12eeb7=function(_0x497cc9){while(--_0x497cc9){_0x49c2cb['push'](_0x49c2cb['shift']());}};_0x12eeb7(++_0x1d86a9);}(_0xa5cc,0xa5));var _0xca5c=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa5cc[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xca5c('0x0'));var util=require(_0xca5c('0x1'));var moment=require('moment');var BPromise=require(_0xca5c('0x2'));var rs=require(_0xca5c('0x3'));var fs=require('fs');var Redis=require(_0xca5c('0x4'));var db=require(_0xca5c('0x5'))['db'];var utils=require(_0xca5c('0x6'));var logger=require(_0xca5c('0x7'))(_0xca5c('0x8'));var config=require(_0xca5c('0x9'));var jayson=require(_0xca5c('0xa'));var client=jayson[_0xca5c('0xb')][_0xca5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14f0e3,_0x35f308,_0x2140c6){return new BPromise(function(_0x39dbae,_0x1c769b){return client['request'](_0x14f0e3,_0x2140c6)[_0xca5c('0xd')](function(_0x2e7c54){logger[_0xca5c('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x35f308,_0xca5c('0xf'));logger[_0xca5c('0x10')](_0xca5c('0x11'),_0x35f308,'request\x20sent',JSON[_0xca5c('0x12')](_0x2e7c54));if(_0x2e7c54[_0xca5c('0x13')]){if(_0x2e7c54[_0xca5c('0x13')][_0xca5c('0x14')]===0x1f4){logger[_0xca5c('0x13')](_0xca5c('0x15'),_0x35f308,_0x2e7c54[_0xca5c('0x13')][_0xca5c('0x16')]);return _0x1c769b(_0x2e7c54[_0xca5c('0x13')][_0xca5c('0x16')]);}logger['error'](_0xca5c('0x15'),_0x35f308,_0x2e7c54['error'][_0xca5c('0x16')]);return _0x39dbae(_0x2e7c54[_0xca5c('0x13')]['message']);}else{logger[_0xca5c('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x35f308,_0xca5c('0xf'));_0x39dbae(_0x2e7c54[_0xca5c('0x17')]['message']);}})[_0xca5c('0x18')](function(_0x2af285){logger['error'](_0xca5c('0x15'),_0x35f308,_0x2af285);_0x1c769b(_0x2af285);});});}exports['CreateFaxQueueReport']=function(_0x575549){var _0x2f4d39=this;return new Promise(function(_0x5186bd,_0x583b4c){return db['FaxQueueReport'][_0xca5c('0x19')](_0x575549[_0xca5c('0x1a')],{'raw':_0x575549[_0xca5c('0x1b')]?_0x575549['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d83d2){logger['info'](_0xca5c('0x1c'),_0x575549);logger['debug'](_0xca5c('0x1c'),_0x575549,JSON[_0xca5c('0x12')](_0x3d83d2));_0x5186bd(_0x3d83d2);})[_0xca5c('0x18')](function(_0x4c3d4e){logger[_0xca5c('0x13')](_0xca5c('0x1c'),_0x4c3d4e[_0xca5c('0x16')],_0x575549);_0x583b4c(_0x2f4d39[_0xca5c('0x13')](0x1f4,_0x4c3d4e[_0xca5c('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0x9d8112){var _0x17cd27=this;return new Promise(function(_0x5946b0,_0x2f89b2){return db[_0xca5c('0x1d')][_0xca5c('0x1e')](_0x9d8112[_0xca5c('0x1a')],{'raw':_0x9d8112[_0xca5c('0x1b')]?_0x9d8112[_0xca5c('0x1b')][_0xca5c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9d8112[_0xca5c('0x1b')]?_0x9d8112[_0xca5c('0x1b')][_0xca5c('0x20')]||null:null,'attributes':_0x9d8112[_0xca5c('0x1b')]?_0x9d8112[_0xca5c('0x1b')][_0xca5c('0x21')]||null:null,'limit':_0x9d8112['options']?_0x9d8112[_0xca5c('0x1b')]['limit']||null:null})['then'](function(_0x473994){logger[_0xca5c('0xe')](_0xca5c('0x22'),_0x9d8112);logger[_0xca5c('0x10')](_0xca5c('0x22'),_0x9d8112,JSON[_0xca5c('0x12')](_0x473994));_0x5946b0(_0x473994);})[_0xca5c('0x18')](function(_0x3cb5c4){logger[_0xca5c('0x13')]('UpdateFaxQueueReport',_0x3cb5c4[_0xca5c('0x16')],_0x9d8112);_0x2f89b2(_0x17cd27[_0xca5c('0x13')](0x1f4,_0x3cb5c4[_0xca5c('0x16')]));});});}; \ No newline at end of file +var _0x6f31=['message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x6f31,0xe5));var _0x16f3=function(_0x182d51,_0x4e0a81){_0x182d51=_0x182d51-0x0;var _0x58dfc7=_0x6f31[_0x182d51];return _0x58dfc7;};'use strict';var _=require(_0x16f3('0x0'));var util=require('util');var moment=require(_0x16f3('0x1'));var BPromise=require(_0x16f3('0x2'));var rs=require(_0x16f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16f3('0x4'))['db'];var utils=require(_0x16f3('0x5'));var logger=require(_0x16f3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x16f3('0x7'));var client=jayson[_0x16f3('0x8')][_0x16f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x451787,_0x41b936,_0x58cac1){return new BPromise(function(_0x5bb610,_0x2b95f4){return client['request'](_0x451787,_0x58cac1)[_0x16f3('0xa')](function(_0x108f9d){logger[_0x16f3('0xb')](_0x16f3('0xc'),_0x41b936,_0x16f3('0xd'));logger[_0x16f3('0xe')](_0x16f3('0xf'),_0x41b936,_0x16f3('0xd'),JSON[_0x16f3('0x10')](_0x108f9d));if(_0x108f9d[_0x16f3('0x11')]){if(_0x108f9d[_0x16f3('0x11')][_0x16f3('0x12')]===0x1f4){logger[_0x16f3('0x11')](_0x16f3('0xc'),_0x41b936,_0x108f9d[_0x16f3('0x11')][_0x16f3('0x13')]);return _0x2b95f4(_0x108f9d[_0x16f3('0x11')][_0x16f3('0x13')]);}logger[_0x16f3('0x11')](_0x16f3('0xc'),_0x41b936,_0x108f9d[_0x16f3('0x11')][_0x16f3('0x13')]);return _0x5bb610(_0x108f9d[_0x16f3('0x11')][_0x16f3('0x13')]);}else{logger[_0x16f3('0xb')](_0x16f3('0xc'),_0x41b936,_0x16f3('0xd'));_0x5bb610(_0x108f9d[_0x16f3('0x14')][_0x16f3('0x13')]);}})[_0x16f3('0x15')](function(_0x3ef61b){logger[_0x16f3('0x11')](_0x16f3('0xc'),_0x41b936,_0x3ef61b);_0x2b95f4(_0x3ef61b);});});}exports[_0x16f3('0x16')]=function(_0xa65410){var _0x53ea3c=this;return new Promise(function(_0x4af66d,_0x274d00){return db[_0x16f3('0x17')][_0x16f3('0x18')](_0xa65410[_0x16f3('0x19')],{'raw':_0xa65410[_0x16f3('0x1a')]?_0xa65410[_0x16f3('0x1a')][_0x16f3('0x1b')]===undefined?!![]:![]:!![]})[_0x16f3('0xa')](function(_0xd73582){logger[_0x16f3('0xb')](_0x16f3('0x16'),_0xa65410);logger['debug']('CreateFaxQueueReport',_0xa65410,JSON[_0x16f3('0x10')](_0xd73582));_0x4af66d(_0xd73582);})['catch'](function(_0x216f43){logger['error'](_0x16f3('0x16'),_0x216f43[_0x16f3('0x13')],_0xa65410);_0x274d00(_0x53ea3c[_0x16f3('0x11')](0x1f4,_0x216f43[_0x16f3('0x13')]));});});};exports[_0x16f3('0x1c')]=function(_0x34da3c){var _0x29f973=this;return new Promise(function(_0x28e284,_0x580b1a){return db[_0x16f3('0x17')][_0x16f3('0x1d')](_0x34da3c[_0x16f3('0x19')],{'raw':_0x34da3c[_0x16f3('0x1a')]?_0x34da3c[_0x16f3('0x1a')][_0x16f3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34da3c[_0x16f3('0x1a')]?_0x34da3c[_0x16f3('0x1a')]['where']||null:null,'attributes':_0x34da3c[_0x16f3('0x1a')]?_0x34da3c[_0x16f3('0x1a')][_0x16f3('0x1e')]||null:null,'limit':_0x34da3c['options']?_0x34da3c[_0x16f3('0x1a')]['limit']||null:null})[_0x16f3('0xa')](function(_0xa2a997){logger[_0x16f3('0xb')](_0x16f3('0x1c'),_0x34da3c);logger[_0x16f3('0xe')](_0x16f3('0x1c'),_0x34da3c,JSON[_0x16f3('0x10')](_0xa2a997));_0x28e284(_0xa2a997);})['catch'](function(_0x297685){logger[_0x16f3('0x11')](_0x16f3('0x1c'),_0x297685[_0x16f3('0x13')],_0x34da3c);_0x580b1a(_0x29f973[_0x16f3('0x11')](0x1f4,_0x297685[_0x16f3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 14b4658..2eda7e9 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 _0xa07e=['../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x28f1ce,_0x49b512){var _0x595d90=function(_0x54b935){while(--_0x54b935){_0x28f1ce['push'](_0x28f1ce['shift']());}};_0x595d90(++_0x49b512);}(_0xa07e,0x150));var _0xea07=function(_0x40b694,_0x4c3059){_0x40b694=_0x40b694-0x0;var _0x3d9c67=_0xa07e[_0x40b694];return _0x3d9c67;};'use strict';var multer=require(_0xea07('0x0'));var util=require(_0xea07('0x1'));var path=require(_0xea07('0x2'));var timeout=require('connect-timeout');var express=require(_0xea07('0x3'));var router=express[_0xea07('0x4')]();var fs_extra=require(_0xea07('0x5'));var auth=require(_0xea07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xea07('0x7'));var controller=require(_0xea07('0x8'));router['get']('/',auth[_0xea07('0x9')](),controller[_0xea07('0xa')]);router[_0xea07('0xb')](_0xea07('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xea07('0xb')](_0xea07('0xd'),auth[_0xea07('0x9')](),controller['show']);router['post']('/',auth[_0xea07('0x9')](),controller['create']);router['put']('/:id',auth[_0xea07('0x9')](),controller[_0xea07('0xe')]);router[_0xea07('0xf')](_0xea07('0xd'),auth['isAuthenticated'](),controller[_0xea07('0x10')]);module[_0xea07('0x11')]=router; \ No newline at end of file +var _0x6bc3=['./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4dd786,_0x1383fe){var _0xd8fee=function(_0x51fc5f){while(--_0x51fc5f){_0x4dd786['push'](_0x4dd786['shift']());}};_0xd8fee(++_0x1383fe);}(_0x6bc3,0x1c6));var _0x36bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x36bc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x36bc('0x1'));var express=require(_0x36bc('0x2'));var router=express[_0x36bc('0x3')]();var fs_extra=require(_0x36bc('0x4'));var auth=require(_0x36bc('0x5'));var interaction=require(_0x36bc('0x6'));var config=require(_0x36bc('0x7'));var controller=require(_0x36bc('0x8'));router[_0x36bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x36bc('0xa')]);router[_0x36bc('0x9')](_0x36bc('0xb'),auth[_0x36bc('0xc')](),controller[_0x36bc('0xd')]);router[_0x36bc('0x9')](_0x36bc('0xe'),auth['isAuthenticated'](),controller[_0x36bc('0xf')]);router[_0x36bc('0x10')]('/',auth['isAuthenticated'](),controller[_0x36bc('0x11')]);router['put'](_0x36bc('0xe'),auth['isAuthenticated'](),controller[_0x36bc('0x12')]);router[_0x36bc('0x13')](_0x36bc('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x36bc('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e693a7d..362c408 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x35fe6a,_0x4b46df){var _0x5d66ca=function(_0x1e753f){while(--_0x1e753f){_0x35fe6a['push'](_0x35fe6a['shift']());}};_0x5d66ca(++_0x4b46df);}(_0xedd9,0xfc));var _0x9edd=function(_0x245d07,_0x22652c){_0x245d07=_0x245d07-0x0;var _0x1ffa28=_0xedd9[_0x245d07];return _0x1ffa28;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1ccda4,_0x1647d3){var _0x334196=function(_0x470901){while(--_0x470901){_0x1ccda4['push'](_0x1ccda4['shift']());}};_0x334196(++_0x1647d3);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f7c24ec..f444fa7 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 _0x35f8=['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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','FaxTransferReport','includeAll','include','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x35f8,0x92));var _0x835f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x35f8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x835f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x835f('0x1'));var jsonpatch=require(_0x835f('0x2'));var rp=require(_0x835f('0x3'));var moment=require('moment');var BPromise=require(_0x835f('0x4'));var Mustache=require(_0x835f('0x5'));var util=require(_0x835f('0x6'));var path=require(_0x835f('0x7'));var sox=require('sox');var csv=require(_0x835f('0x8'));var ejs=require(_0x835f('0x9'));var fs=require('fs');var fs_extra=require(_0x835f('0xa'));var _=require(_0x835f('0xb'));var squel=require(_0x835f('0xc'));var crypto=require(_0x835f('0xd'));var jsforce=require(_0x835f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x835f('0x8'));var querystring=require(_0x835f('0xf'));var Papa=require(_0x835f('0x10'));var Redis=require(_0x835f('0x11'));var authService=require(_0x835f('0x12'));var qs=require(_0x835f('0x13'));var as=require(_0x835f('0x14'));var hardwareService=require(_0x835f('0x15'));var logger=require(_0x835f('0x16'))(_0x835f('0x17'));var utils=require('../../config/utils');var config=require(_0x835f('0x18'));var licenseUtil=require(_0x835f('0x19'));var db=require(_0x835f('0x1a'))['db'];function respondWithStatusCode(_0x559a4e,_0xd661f3){_0xd661f3=_0xd661f3||0xcc;return function(_0x4f87d8){if(_0x4f87d8){return _0x559a4e[_0x835f('0x1b')](_0xd661f3);}return _0x559a4e[_0x835f('0x1c')](_0xd661f3)[_0x835f('0x1d')]();};}function respondWithResult(_0xf0ff8e,_0x12f2c5){_0x12f2c5=_0x12f2c5||0xc8;return function(_0x481c6e){if(_0x481c6e){return _0xf0ff8e[_0x835f('0x1c')](_0x12f2c5)[_0x835f('0x1e')](_0x481c6e);}};}function respondWithFilteredResult(_0x52f3f5,_0x16762c){return function(_0x22eaa1){if(_0x22eaa1){var _0x31a80a=typeof _0x16762c[_0x835f('0x1f')]===_0x835f('0x20')&&typeof _0x16762c['limit']===_0x835f('0x20');var _0x59ac83=_0x22eaa1['count'];var _0x127630=_0x31a80a?0x0:_0x16762c[_0x835f('0x1f')];var _0x529b88=_0x31a80a?_0x22eaa1['count']:_0x16762c[_0x835f('0x1f')]+_0x16762c['limit'];var _0x4d28f0;if(_0x529b88>=_0x59ac83){_0x529b88=_0x59ac83;_0x4d28f0=0xc8;}else{_0x4d28f0=0xce;}_0x52f3f5[_0x835f('0x1c')](_0x4d28f0);return _0x52f3f5['set'](_0x835f('0x21'),_0x127630+'-'+_0x529b88+'/'+_0x59ac83)[_0x835f('0x1e')](_0x22eaa1);}return null;};}function patchUpdates(_0x209278){return function(_0x1e5a56){try{jsonpatch[_0x835f('0x22')](_0x1e5a56,_0x209278,!![]);}catch(_0xa3a823){return BPromise['reject'](_0xa3a823);}return _0x1e5a56[_0x835f('0x23')]();};}function saveUpdates(_0x177079,_0x5152ed){return function(_0x49e0e5){if(_0x49e0e5){return _0x49e0e5[_0x835f('0x24')](_0x177079)[_0x835f('0x25')](function(_0x4a6563){return _0x4a6563;});}return null;};}function removeEntity(_0x2c72b0,_0x1ca401){return function(_0x13326e){if(_0x13326e){return _0x13326e[_0x835f('0x26')]()['then'](function(){_0x2c72b0[_0x835f('0x1c')](0xcc)[_0x835f('0x1d')]();});}};}function handleEntityNotFound(_0x4f6c87,_0x12250e){return function(_0x304717){if(!_0x304717){_0x4f6c87[_0x835f('0x1b')](0x194);}return _0x304717;};}function handleError(_0x1831a7,_0x579fd0){_0x579fd0=_0x579fd0||0x1f4;return function(_0x1bafde){logger[_0x835f('0x27')](_0x1bafde[_0x835f('0x28')]);if(_0x1bafde['name']){delete _0x1bafde[_0x835f('0x29')];}_0x1831a7['status'](_0x579fd0)[_0x835f('0x2a')](_0x1bafde);};}exports['index']=function(_0x293198,_0x3e2f52){var _0x1dce2e={},_0x224ecd={},_0x28e907={'count':0x0,'rows':[]};var _0x1bc298=_[_0x835f('0x2b')](db['FaxTransferReport'][_0x835f('0x2c')],function(_0x4ddd52){return{'name':_0x4ddd52['fieldName'],'type':_0x4ddd52[_0x835f('0x2d')]['key']};});_0x224ecd[_0x835f('0x2e')]=_[_0x835f('0x2b')](_0x1bc298,_0x835f('0x29'));_0x224ecd['query']=_[_0x835f('0x2f')](_0x293198[_0x835f('0x30')]);_0x224ecd[_0x835f('0x31')]=_[_0x835f('0x32')](_0x224ecd[_0x835f('0x2e')],_0x224ecd[_0x835f('0x30')]);_0x1dce2e['attributes']=_[_0x835f('0x32')](_0x224ecd['model'],qs[_0x835f('0x33')](_0x293198[_0x835f('0x30')][_0x835f('0x33')]));_0x1dce2e[_0x835f('0x34')]=_0x1dce2e[_0x835f('0x34')]['length']?_0x1dce2e[_0x835f('0x34')]:_0x224ecd[_0x835f('0x2e')];if(!_0x293198[_0x835f('0x30')][_0x835f('0x35')](_0x835f('0x36'))){_0x1dce2e['limit']=qs[_0x835f('0x37')](_0x293198['query']['limit']);_0x1dce2e['offset']=qs['offset'](_0x293198[_0x835f('0x30')][_0x835f('0x1f')]);}_0x1dce2e[_0x835f('0x38')]=qs[_0x835f('0x39')](_0x293198[_0x835f('0x30')][_0x835f('0x39')]);_0x1dce2e[_0x835f('0x3a')]=qs[_0x835f('0x31')](_[_0x835f('0x3b')](_0x293198[_0x835f('0x30')],_0x224ecd[_0x835f('0x31')]),_0x1bc298);if(_0x293198[_0x835f('0x30')][_0x835f('0x3c')]){_0x1dce2e[_0x835f('0x3a')]=_['merge'](_0x1dce2e[_0x835f('0x3a')],{'$or':_['map'](_0x1bc298,function(_0x8c1856){if(_0x8c1856[_0x835f('0x2d')]!=='VIRTUAL'){var _0x351b2a={};_0x351b2a[_0x8c1856[_0x835f('0x29')]]={'$like':'%'+_0x293198[_0x835f('0x30')][_0x835f('0x3c')]+'%'};return _0x351b2a;}})});}_0x1dce2e=_[_0x835f('0x3d')]({},_0x1dce2e,_0x293198[_0x835f('0x3e')]);var _0x26038b={'where':_0x1dce2e[_0x835f('0x3a')]};return db[_0x835f('0x3f')]['count'](_0x26038b)[_0x835f('0x25')](function(_0x169492){_0x28e907['count']=_0x169492;if(_0x293198['query'][_0x835f('0x40')]){_0x1dce2e[_0x835f('0x41')]=[{'all':!![]}];}return db[_0x835f('0x3f')]['findAll'](_0x1dce2e);})['then'](function(_0x103a59){_0x28e907[_0x835f('0x42')]=_0x103a59;return _0x28e907;})[_0x835f('0x25')](respondWithFilteredResult(_0x3e2f52,_0x1dce2e))[_0x835f('0x43')](handleError(_0x3e2f52,null));};exports[_0x835f('0x44')]=function(_0x593bae,_0xc7e7ba){var _0x323109={'raw':!![],'where':{'id':_0x593bae[_0x835f('0x45')]['id']}},_0xca1067={};_0xca1067[_0x835f('0x2e')]=_[_0x835f('0x2f')](db['FaxTransferReport'][_0x835f('0x2c')]);_0xca1067[_0x835f('0x30')]=_[_0x835f('0x2f')](_0x593bae[_0x835f('0x30')]);_0xca1067['filters']=_[_0x835f('0x32')](_0xca1067['model'],_0xca1067['query']);_0x323109['attributes']=_[_0x835f('0x32')](_0xca1067[_0x835f('0x2e')],qs[_0x835f('0x33')](_0x593bae[_0x835f('0x30')][_0x835f('0x33')]));_0x323109[_0x835f('0x34')]=_0x323109['attributes'][_0x835f('0x46')]?_0x323109[_0x835f('0x34')]:_0xca1067['model'];if(_0x593bae['query']['includeAll']){_0x323109['include']=[{'all':!![]}];}_0x323109=_[_0x835f('0x3d')]({},_0x323109,_0x593bae['options']);return db[_0x835f('0x3f')][_0x835f('0x47')](_0x323109)[_0x835f('0x25')](handleEntityNotFound(_0xc7e7ba,null))[_0x835f('0x25')](respondWithResult(_0xc7e7ba,null))[_0x835f('0x43')](handleError(_0xc7e7ba,null));};exports[_0x835f('0x48')]=function(_0x2eaa67,_0x1e8eaf){return db['FaxTransferReport'][_0x835f('0x48')](_0x2eaa67[_0x835f('0x49')],{})['then'](respondWithResult(_0x1e8eaf,0xc9))[_0x835f('0x43')](handleError(_0x1e8eaf,null));};exports[_0x835f('0x24')]=function(_0xf53afb,_0x36d3f3){if(_0xf53afb['body']['id']){delete _0xf53afb['body']['id'];}return db[_0x835f('0x3f')][_0x835f('0x47')]({'where':{'id':_0xf53afb[_0x835f('0x45')]['id']}})['then'](handleEntityNotFound(_0x36d3f3,null))['then'](saveUpdates(_0xf53afb[_0x835f('0x49')],null))[_0x835f('0x25')](respondWithResult(_0x36d3f3,null))['catch'](handleError(_0x36d3f3,null));};exports[_0x835f('0x26')]=function(_0x439804,_0x291256){return db[_0x835f('0x3f')]['find']({'where':{'id':_0x439804[_0x835f('0x45')]['id']}})[_0x835f('0x25')](handleEntityNotFound(_0x291256,null))['then'](removeEntity(_0x291256,null))[_0x835f('0x43')](handleError(_0x291256,null));};exports[_0x835f('0x4a')]=function(_0x2b3031,_0x6660f2){return db[_0x835f('0x3f')][_0x835f('0x4a')]()[_0x835f('0x25')](respondWithResult(_0x6660f2,null))[_0x835f('0x43')](handleError(_0x6660f2,null));}; \ No newline at end of file +var _0x9dc7=['fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','FaxTransferReport','rows','catch','show','params','rawAttributes','includeAll','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0xe53a71,_0x56ba57){var _0x4713fb=function(_0x1f624a){while(--_0x1f624a){_0xe53a71['push'](_0xe53a71['shift']());}};_0x4713fb(++_0x56ba57);}(_0x9dc7,0x65));var _0x79dc=function(_0x438c5a,_0x4846f8){_0x438c5a=_0x438c5a-0x0;var _0x4cef44=_0x9dc7[_0x438c5a];return _0x4cef44;};'use strict';var emlformat=require(_0x79dc('0x0'));var rimraf=require(_0x79dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79dc('0x2'));var rp=require(_0x79dc('0x3'));var moment=require(_0x79dc('0x4'));var BPromise=require(_0x79dc('0x5'));var Mustache=require(_0x79dc('0x6'));var util=require(_0x79dc('0x7'));var path=require(_0x79dc('0x8'));var sox=require(_0x79dc('0x9'));var csv=require(_0x79dc('0xa'));var ejs=require(_0x79dc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x79dc('0xc'));var crypto=require(_0x79dc('0xd'));var jsforce=require(_0x79dc('0xe'));var deskjs=require(_0x79dc('0xf'));var toCsv=require(_0x79dc('0xa'));var querystring=require('querystring');var Papa=require(_0x79dc('0x10'));var Redis=require(_0x79dc('0x11'));var authService=require(_0x79dc('0x12'));var qs=require(_0x79dc('0x13'));var as=require(_0x79dc('0x14'));var hardwareService=require(_0x79dc('0x15'));var logger=require(_0x79dc('0x16'))(_0x79dc('0x17'));var utils=require(_0x79dc('0x18'));var config=require(_0x79dc('0x19'));var licenseUtil=require(_0x79dc('0x1a'));var db=require(_0x79dc('0x1b'))['db'];function respondWithStatusCode(_0xa95e9,_0x73b505){_0x73b505=_0x73b505||0xcc;return function(_0x438a2c){if(_0x438a2c){return _0xa95e9['sendStatus'](_0x73b505);}return _0xa95e9[_0x79dc('0x1c')](_0x73b505)[_0x79dc('0x1d')]();};}function respondWithResult(_0x3279c7,_0x440468){_0x440468=_0x440468||0xc8;return function(_0x4f35e3){if(_0x4f35e3){return _0x3279c7[_0x79dc('0x1c')](_0x440468)[_0x79dc('0x1e')](_0x4f35e3);}};}function respondWithFilteredResult(_0x2fe7e9,_0x1ae7ca){return function(_0x2655a3){if(_0x2655a3){var _0x5ee0b1=typeof _0x1ae7ca[_0x79dc('0x1f')]===_0x79dc('0x20')&&typeof _0x1ae7ca[_0x79dc('0x21')]===_0x79dc('0x20');var _0x3a1b1f=_0x2655a3['count'];var _0xa525dd=_0x5ee0b1?0x0:_0x1ae7ca[_0x79dc('0x1f')];var _0x3e2495=_0x5ee0b1?_0x2655a3[_0x79dc('0x22')]:_0x1ae7ca[_0x79dc('0x1f')]+_0x1ae7ca['limit'];var _0x2ea056;if(_0x3e2495>=_0x3a1b1f){_0x3e2495=_0x3a1b1f;_0x2ea056=0xc8;}else{_0x2ea056=0xce;}_0x2fe7e9['status'](_0x2ea056);return _0x2fe7e9[_0x79dc('0x23')](_0x79dc('0x24'),_0xa525dd+'-'+_0x3e2495+'/'+_0x3a1b1f)['json'](_0x2655a3);}return null;};}function patchUpdates(_0x451761){return function(_0x203f6b){try{jsonpatch[_0x79dc('0x25')](_0x203f6b,_0x451761,!![]);}catch(_0x3728ad){return BPromise['reject'](_0x3728ad);}return _0x203f6b[_0x79dc('0x26')]();};}function saveUpdates(_0x564b89,_0x790c10){return function(_0x1554a4){if(_0x1554a4){return _0x1554a4[_0x79dc('0x27')](_0x564b89)[_0x79dc('0x28')](function(_0x20bf86){return _0x20bf86;});}return null;};}function removeEntity(_0x15c50e,_0x5b0d96){return function(_0x3575c3){if(_0x3575c3){return _0x3575c3[_0x79dc('0x29')]()[_0x79dc('0x28')](function(){_0x15c50e[_0x79dc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x757c51,_0x571250){return function(_0x3897f7){if(!_0x3897f7){_0x757c51[_0x79dc('0x2a')](0x194);}return _0x3897f7;};}function handleError(_0x1754cc,_0x3098a4){_0x3098a4=_0x3098a4||0x1f4;return function(_0x2a7cb9){logger[_0x79dc('0x2b')](_0x2a7cb9[_0x79dc('0x2c')]);if(_0x2a7cb9[_0x79dc('0x2d')]){delete _0x2a7cb9[_0x79dc('0x2d')];}_0x1754cc[_0x79dc('0x1c')](_0x3098a4)[_0x79dc('0x2e')](_0x2a7cb9);};}exports[_0x79dc('0x2f')]=function(_0x2e1cd8,_0x81caf1){var _0x4f56a9={},_0x5b54bf={},_0x426e52={'count':0x0,'rows':[]};var _0x1ffd46=_[_0x79dc('0x30')](db['FaxTransferReport']['rawAttributes'],function(_0x39994e){return{'name':_0x39994e[_0x79dc('0x31')],'type':_0x39994e[_0x79dc('0x32')][_0x79dc('0x33')]};});_0x5b54bf[_0x79dc('0x34')]=_[_0x79dc('0x30')](_0x1ffd46,_0x79dc('0x2d'));_0x5b54bf[_0x79dc('0x35')]=_[_0x79dc('0x36')](_0x2e1cd8['query']);_0x5b54bf[_0x79dc('0x37')]=_['intersection'](_0x5b54bf[_0x79dc('0x34')],_0x5b54bf[_0x79dc('0x35')]);_0x4f56a9['attributes']=_[_0x79dc('0x38')](_0x5b54bf['model'],qs[_0x79dc('0x39')](_0x2e1cd8[_0x79dc('0x35')][_0x79dc('0x39')]));_0x4f56a9[_0x79dc('0x3a')]=_0x4f56a9[_0x79dc('0x3a')][_0x79dc('0x3b')]?_0x4f56a9[_0x79dc('0x3a')]:_0x5b54bf['model'];if(!_0x2e1cd8['query'][_0x79dc('0x3c')](_0x79dc('0x3d'))){_0x4f56a9['limit']=qs[_0x79dc('0x21')](_0x2e1cd8[_0x79dc('0x35')][_0x79dc('0x21')]);_0x4f56a9[_0x79dc('0x1f')]=qs['offset'](_0x2e1cd8[_0x79dc('0x35')][_0x79dc('0x1f')]);}_0x4f56a9['order']=qs[_0x79dc('0x3e')](_0x2e1cd8['query'][_0x79dc('0x3e')]);_0x4f56a9['where']=qs[_0x79dc('0x37')](_[_0x79dc('0x3f')](_0x2e1cd8[_0x79dc('0x35')],_0x5b54bf[_0x79dc('0x37')]),_0x1ffd46);if(_0x2e1cd8[_0x79dc('0x35')]['filter']){_0x4f56a9['where']=_[_0x79dc('0x40')](_0x4f56a9[_0x79dc('0x41')],{'$or':_[_0x79dc('0x30')](_0x1ffd46,function(_0x38505e){if(_0x38505e['type']!==_0x79dc('0x42')){var _0x2d9a15={};_0x2d9a15[_0x38505e['name']]={'$like':'%'+_0x2e1cd8['query'][_0x79dc('0x43')]+'%'};return _0x2d9a15;}})});}_0x4f56a9=_['merge']({},_0x4f56a9,_0x2e1cd8[_0x79dc('0x44')]);var _0x4fca96={'where':_0x4f56a9[_0x79dc('0x41')]};return db['FaxTransferReport'][_0x79dc('0x22')](_0x4fca96)['then'](function(_0x438a08){_0x426e52[_0x79dc('0x22')]=_0x438a08;if(_0x2e1cd8['query']['includeAll']){_0x4f56a9['include']=[{'all':!![]}];}return db[_0x79dc('0x45')]['findAll'](_0x4f56a9);})[_0x79dc('0x28')](function(_0x100af8){_0x426e52[_0x79dc('0x46')]=_0x100af8;return _0x426e52;})[_0x79dc('0x28')](respondWithFilteredResult(_0x81caf1,_0x4f56a9))[_0x79dc('0x47')](handleError(_0x81caf1,null));};exports[_0x79dc('0x48')]=function(_0xfc98e9,_0x13e6e1){var _0xeac74e={'raw':!![],'where':{'id':_0xfc98e9[_0x79dc('0x49')]['id']}},_0x4bd864={};_0x4bd864[_0x79dc('0x34')]=_[_0x79dc('0x36')](db[_0x79dc('0x45')][_0x79dc('0x4a')]);_0x4bd864['query']=_['keys'](_0xfc98e9[_0x79dc('0x35')]);_0x4bd864[_0x79dc('0x37')]=_[_0x79dc('0x38')](_0x4bd864[_0x79dc('0x34')],_0x4bd864['query']);_0xeac74e['attributes']=_['intersection'](_0x4bd864[_0x79dc('0x34')],qs[_0x79dc('0x39')](_0xfc98e9['query'][_0x79dc('0x39')]));_0xeac74e[_0x79dc('0x3a')]=_0xeac74e[_0x79dc('0x3a')]['length']?_0xeac74e[_0x79dc('0x3a')]:_0x4bd864['model'];if(_0xfc98e9['query'][_0x79dc('0x4b')]){_0xeac74e['include']=[{'all':!![]}];}_0xeac74e=_[_0x79dc('0x40')]({},_0xeac74e,_0xfc98e9[_0x79dc('0x44')]);return db[_0x79dc('0x45')][_0x79dc('0x4c')](_0xeac74e)[_0x79dc('0x28')](handleEntityNotFound(_0x13e6e1,null))[_0x79dc('0x28')](respondWithResult(_0x13e6e1,null))[_0x79dc('0x47')](handleError(_0x13e6e1,null));};exports['create']=function(_0x2eeb6b,_0x57102b){return db['FaxTransferReport']['create'](_0x2eeb6b[_0x79dc('0x4d')],{})[_0x79dc('0x28')](respondWithResult(_0x57102b,0xc9))[_0x79dc('0x47')](handleError(_0x57102b,null));};exports['update']=function(_0x15908d,_0x292839){if(_0x15908d[_0x79dc('0x4d')]['id']){delete _0x15908d[_0x79dc('0x4d')]['id'];}return db[_0x79dc('0x45')][_0x79dc('0x4c')]({'where':{'id':_0x15908d[_0x79dc('0x49')]['id']}})['then'](handleEntityNotFound(_0x292839,null))[_0x79dc('0x28')](saveUpdates(_0x15908d[_0x79dc('0x4d')],null))[_0x79dc('0x28')](respondWithResult(_0x292839,null))[_0x79dc('0x47')](handleError(_0x292839,null));};exports['destroy']=function(_0x28409c,_0x3fa6d8){return db['FaxTransferReport'][_0x79dc('0x4c')]({'where':{'id':_0x28409c[_0x79dc('0x49')]['id']}})[_0x79dc('0x28')](handleEntityNotFound(_0x3fa6d8,null))[_0x79dc('0x28')](removeEntity(_0x3fa6d8,null))[_0x79dc('0x47')](handleError(_0x3fa6d8,null));};exports[_0x79dc('0x4e')]=function(_0xf02904,_0x14dea6){return db[_0x79dc('0x45')][_0x79dc('0x4e')]()[_0x79dc('0x28')](respondWithResult(_0x14dea6,null))[_0x79dc('0x47')](handleError(_0x14dea6,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7b647c2..79eab86 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 _0x89b9=['define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x540887,_0x4c02cb){var _0xd7642d=function(_0x4f7694){while(--_0x4f7694){_0x540887['push'](_0x540887['shift']());}};_0xd7642d(++_0x4c02cb);}(_0x89b9,0x9e));var _0x989b=function(_0x1827b7,_0x15c25d){_0x1827b7=_0x1827b7-0x0;var _0x1f83d8=_0x89b9[_0x1827b7];return _0x1f83d8;};'use strict';var _=require('lodash');var util=require(_0x989b('0x0'));var logger=require(_0x989b('0x1'))(_0x989b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x989b('0x3'));var rimraf=require('rimraf');var config=require(_0x989b('0x4'));var attributes=require(_0x989b('0x5'));module[_0x989b('0x6')]=function(_0x186d84,_0x40d8dd){return _0x186d84[_0x989b('0x7')](_0x989b('0x8'),attributes,{'tableName':_0x989b('0x9'),'paranoid':![],'indexes':[{'name':_0x989b('0xa'),'fields':[_0x989b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4b3=['request-promise','path','./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2361a2,_0x33c4b6){var _0x23eb98=function(_0x3ff445){while(--_0x3ff445){_0x2361a2['push'](_0x2361a2['shift']());}};_0x23eb98(++_0x33c4b6);}(_0xc4b3,0x192));var _0x3c4b=function(_0xfc425a,_0x16a344){_0xfc425a=_0xfc425a-0x0;var _0x20d1a8=_0xc4b3[_0xfc425a];return _0x20d1a8;};'use strict';var _=require(_0x3c4b('0x0'));var util=require(_0x3c4b('0x1'));var logger=require(_0x3c4b('0x2'))(_0x3c4b('0x3'));var moment=require('moment');var BPromise=require(_0x3c4b('0x4'));var rp=require(_0x3c4b('0x5'));var fs=require('fs');var path=require(_0x3c4b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c4b('0x7'));module[_0x3c4b('0x8')]=function(_0x24bd59,_0x56b788){return _0x24bd59['define']('FaxTransferReport',attributes,{'tableName':_0x3c4b('0x9'),'paranoid':![],'indexes':[{'name':_0x3c4b('0xa'),'fields':[_0x3c4b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 325cd8a..f495816 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 _0xe3c7=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3c7,0x1ec));var _0x7e3c=function(_0x414806,_0x12a8c2){_0x414806=_0x414806-0x0;var _0x14e039=_0xe3c7[_0x414806];return _0x14e039;};'use strict';var _=require(_0x7e3c('0x0'));var util=require(_0x7e3c('0x1'));var moment=require(_0x7e3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e3c('0x3'));var fs=require('fs');var Redis=require(_0x7e3c('0x4'));var db=require(_0x7e3c('0x5'))['db'];var utils=require(_0x7e3c('0x6'));var logger=require(_0x7e3c('0x7'))('rpc');var config=require(_0x7e3c('0x8'));var jayson=require(_0x7e3c('0x9'));var client=jayson[_0x7e3c('0xa')][_0x7e3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x137d6b,_0x5cd90e,_0x434d65){return new BPromise(function(_0x5f4463,_0x13a37f){return client[_0x7e3c('0xc')](_0x137d6b,_0x434d65)['then'](function(_0x365f23){logger[_0x7e3c('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x5cd90e,_0x7e3c('0xe'));logger[_0x7e3c('0xf')](_0x7e3c('0x10'),_0x5cd90e,'request\x20sent',JSON[_0x7e3c('0x11')](_0x365f23));if(_0x365f23[_0x7e3c('0x12')]){if(_0x365f23[_0x7e3c('0x12')][_0x7e3c('0x13')]===0x1f4){logger[_0x7e3c('0x12')](_0x7e3c('0x14'),_0x5cd90e,_0x365f23[_0x7e3c('0x12')]['message']);return _0x13a37f(_0x365f23['error']['message']);}logger['error'](_0x7e3c('0x14'),_0x5cd90e,_0x365f23[_0x7e3c('0x12')][_0x7e3c('0x15')]);return _0x5f4463(_0x365f23[_0x7e3c('0x12')][_0x7e3c('0x15')]);}else{logger[_0x7e3c('0xd')](_0x7e3c('0x14'),_0x5cd90e,_0x7e3c('0xe'));_0x5f4463(_0x365f23[_0x7e3c('0x16')]['message']);}})['catch'](function(_0x3c662f){logger[_0x7e3c('0x12')](_0x7e3c('0x14'),_0x5cd90e,_0x3c662f);_0x13a37f(_0x3c662f);});});} \ No newline at end of file +var _0x1753=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3c62ab,_0x33f23d){var _0x536970=function(_0x3a4759){while(--_0x3a4759){_0x3c62ab['push'](_0x3c62ab['shift']());}};_0x536970(++_0x33f23d);}(_0x1753,0xa2));var _0x3175=function(_0x5afa82,_0x1ffc1a){_0x5afa82=_0x5afa82-0x0;var _0x3f5511=_0x1753[_0x5afa82];return _0x3f5511;};'use strict';var _=require(_0x3175('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3175('0x1'));var rs=require(_0x3175('0x2'));var fs=require('fs');var Redis=require(_0x3175('0x3'));var db=require(_0x3175('0x4'))['db'];var utils=require(_0x3175('0x5'));var logger=require(_0x3175('0x6'))(_0x3175('0x7'));var config=require(_0x3175('0x8'));var jayson=require(_0x3175('0x9'));var client=jayson[_0x3175('0xa')][_0x3175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x315062,_0xfee760,_0x2a3dd1){return new BPromise(function(_0x4e8168,_0xeb261c){return client[_0x3175('0xc')](_0x315062,_0x2a3dd1)['then'](function(_0x16cdbd){logger[_0x3175('0xd')](_0x3175('0xe'),_0xfee760,'request\x20sent');logger['debug'](_0x3175('0xf'),_0xfee760,_0x3175('0x10'),JSON[_0x3175('0x11')](_0x16cdbd));if(_0x16cdbd[_0x3175('0x12')]){if(_0x16cdbd[_0x3175('0x12')][_0x3175('0x13')]===0x1f4){logger[_0x3175('0x12')](_0x3175('0xe'),_0xfee760,_0x16cdbd[_0x3175('0x12')]['message']);return _0xeb261c(_0x16cdbd[_0x3175('0x12')][_0x3175('0x14')]);}logger[_0x3175('0x12')](_0x3175('0xe'),_0xfee760,_0x16cdbd[_0x3175('0x12')][_0x3175('0x14')]);return _0x4e8168(_0x16cdbd[_0x3175('0x12')][_0x3175('0x14')]);}else{logger['info'](_0x3175('0xe'),_0xfee760,_0x3175('0x10'));_0x4e8168(_0x16cdbd[_0x3175('0x15')]['message']);}})[_0x3175('0x16')](function(_0x593892){logger[_0x3175('0x12')](_0x3175('0xe'),_0xfee760,_0x593892);_0xeb261c(_0x593892);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0b127c9..c47ad9e 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 _0x304b=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','index','isAuthenticated','/:id','show'];(function(_0x1bb6dc,_0x3703f3){var _0x242c5c=function(_0xf5cfff){while(--_0xf5cfff){_0x1bb6dc['push'](_0x1bb6dc['shift']());}};_0x242c5c(++_0x3703f3);}(_0x304b,0x105));var _0xb304=function(_0x382072,_0x2c1130){_0x382072=_0x382072-0x0;var _0x1e2408=_0x304b[_0x382072];return _0x1e2408;};'use strict';var multer=require(_0xb304('0x0'));var util=require('util');var path=require(_0xb304('0x1'));var timeout=require(_0xb304('0x2'));var express=require(_0xb304('0x3'));var router=express['Router']();var fs_extra=require(_0xb304('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb304('0x5'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xb304('0x6')]('/',auth['isAuthenticated'](),controller[_0xb304('0x7')]);router[_0xb304('0x6')]('/describe',auth[_0xb304('0x8')](),controller['describe']);router['get'](_0xb304('0x9'),auth[_0xb304('0x8')](),controller[_0xb304('0xa')]);router[_0xb304('0xb')]('/',auth[_0xb304('0x8')](),controller[_0xb304('0xc')]);router['put'](_0xb304('0x9'),auth[_0xb304('0x8')](),controller[_0xb304('0xd')]);router[_0xb304('0xe')](_0xb304('0x9'),auth['isAuthenticated'](),controller[_0xb304('0xf')]);module[_0xb304('0x10')]=router; \ No newline at end of file +var _0xe7c8=['/describe','describe','show','create','put','/:id','update','delete','destroy','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x5510f2,_0x50affb){var _0x3a15db=function(_0x2d2cf6){while(--_0x2d2cf6){_0x5510f2['push'](_0x5510f2['shift']());}};_0x3a15db(++_0x50affb);}(_0xe7c8,0xbd));var _0x8e7c=function(_0x4a26a9,_0x109438){_0x4a26a9=_0x4a26a9-0x0;var _0x3ff10f=_0xe7c8[_0x4a26a9];return _0x3ff10f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e7c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8e7c('0x1'));var auth=require(_0x8e7c('0x2'));var interaction=require(_0x8e7c('0x3'));var config=require(_0x8e7c('0x4'));var controller=require(_0x8e7c('0x5'));router[_0x8e7c('0x6')]('/',auth[_0x8e7c('0x7')](),controller[_0x8e7c('0x8')]);router[_0x8e7c('0x6')](_0x8e7c('0x9'),auth[_0x8e7c('0x7')](),controller[_0x8e7c('0xa')]);router[_0x8e7c('0x6')]('/:id',auth[_0x8e7c('0x7')](),controller[_0x8e7c('0xb')]);router['post']('/',auth[_0x8e7c('0x7')](),controller[_0x8e7c('0xc')]);router[_0x8e7c('0xd')](_0x8e7c('0xe'),auth[_0x8e7c('0x7')](),controller[_0x8e7c('0xf')]);router[_0x8e7c('0x10')](_0x8e7c('0xe'),auth[_0x8e7c('0x7')](),controller[_0x8e7c('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 d7b8f99..ffd0ba4 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 _0xf446=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf446,0xa8));var _0x6f44=function(_0x1b713d,_0x5d875e){_0x1b713d=_0x1b713d-0x0;var _0x3627de=_0xf446[_0x1b713d];return _0x3627de;};'use strict';var multer=require(_0x6f44('0x0'));var util=require(_0x6f44('0x1'));var path=require(_0x6f44('0x2'));var timeout=require(_0x6f44('0x3'));var express=require(_0x6f44('0x4'));var router=express[_0x6f44('0x5')]();var fs_extra=require(_0x6f44('0x6'));var auth=require(_0x6f44('0x7'));var interaction=require(_0x6f44('0x8'));var config=require(_0x6f44('0x9'));var controller=require(_0x6f44('0xa'));router[_0x6f44('0xb')]('/',auth[_0x6f44('0xc')](),controller[_0x6f44('0xd')]);router[_0x6f44('0xb')](_0x6f44('0xe'),auth[_0x6f44('0xc')](),controller[_0x6f44('0xf')]);router[_0x6f44('0xb')](_0x6f44('0x10'),auth[_0x6f44('0xc')](),controller[_0x6f44('0x11')]);router['get'](_0x6f44('0x12'),auth[_0x6f44('0xc')](),controller[_0x6f44('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6f44('0x14')](_0x6f44('0x10'),auth[_0x6f44('0xc')](),controller[_0x6f44('0x15')]);router[_0x6f44('0x16')](_0x6f44('0xe'),auth[_0x6f44('0xc')](),controller[_0x6f44('0x17')]);router[_0x6f44('0x18')](_0x6f44('0xe'),auth[_0x6f44('0xc')](),controller[_0x6f44('0x19')]);module[_0x6f44('0x1a')]=router; \ No newline at end of file +var _0x21b0=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21b0,0x11c));var _0x021b=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x21b0[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x021b('0x0'));var timeout=require(_0x021b('0x1'));var express=require(_0x021b('0x2'));var router=express[_0x021b('0x3')]();var fs_extra=require(_0x021b('0x4'));var auth=require(_0x021b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x021b('0x6'));var controller=require(_0x021b('0x7'));router[_0x021b('0x8')]('/',auth[_0x021b('0x9')](),controller[_0x021b('0xa')]);router[_0x021b('0x8')](_0x021b('0xb'),auth[_0x021b('0x9')](),controller[_0x021b('0xc')]);router[_0x021b('0x8')](_0x021b('0xd'),auth[_0x021b('0x9')](),controller[_0x021b('0xe')]);router[_0x021b('0x8')]('/:id/fields',auth[_0x021b('0x9')](),controller['getFields']);router[_0x021b('0xf')]('/',auth[_0x021b('0x9')](),controller[_0x021b('0x10')]);router[_0x021b('0xf')](_0x021b('0xd'),auth['isAuthenticated'](),controller[_0x021b('0x11')]);router[_0x021b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x021b('0x13')]);router[_0x021b('0x14')](_0x021b('0xb'),auth['isAuthenticated'](),controller[_0x021b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 17d5b92..55b7769 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 _0xddc3=['integrationTab','exports','STRING','basic'];(function(_0x5b5442,_0x13b341){var _0x2af50a=function(_0x510e24){while(--_0x510e24){_0x5b5442['push'](_0x5b5442['shift']());}};_0x2af50a(++_0x13b341);}(_0xddc3,0x8d));var _0x3ddc=function(_0x56e1b4,_0x36a7ee){_0x56e1b4=_0x56e1b4-0x0;var _0x3a4f5d=_0xddc3[_0x56e1b4];return _0x3a4f5d;};'use strict';var Sequelize=require('sequelize');module[_0x3ddc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3ddc('0x1')]},'username':{'type':Sequelize[_0x3ddc('0x1')]},'remoteUri':{'type':Sequelize[_0x3ddc('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x3ddc('0x2')),'defaultValue':_0x3ddc('0x2')},'password':{'type':Sequelize[_0x3ddc('0x1')]},'consumerKey':{'type':Sequelize[_0x3ddc('0x1')]},'consumerSecret':{'type':Sequelize[_0x3ddc('0x1')]},'token':{'type':Sequelize[_0x3ddc('0x1')]},'tokenSecret':{'type':Sequelize[_0x3ddc('0x1')]},'serverUrl':{'type':Sequelize[_0x3ddc('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3ddc('0x3'),'newTab'),'defaultValue':_0x3ddc('0x3')}}; \ No newline at end of file +var _0xd5fb=['exports','STRING','basic','integrationTab','newTab','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5fb,0x137));var _0xbd5f=function(_0x1c08f6,_0x14c077){_0x1c08f6=_0x1c08f6-0x0;var _0xbc156a=_0xd5fb[_0x1c08f6];return _0xbc156a;};'use strict';var Sequelize=require(_0xbd5f('0x0'));module[_0xbd5f('0x1')]={'name':{'type':Sequelize[_0xbd5f('0x2')]},'description':{'type':Sequelize[_0xbd5f('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xbd5f('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xbd5f('0x2')]},'consumerKey':{'type':Sequelize[_0xbd5f('0x2')]},'consumerSecret':{'type':Sequelize[_0xbd5f('0x2')]},'token':{'type':Sequelize[_0xbd5f('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbd5f('0x4'),_0xbd5f('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index af1e6e4..c81c503 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 _0xb73d=['stringify','test','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','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','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','DeskField','Subjects','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields'];(function(_0x34ed0d,_0x2c94bc){var _0x38cc25=function(_0x523024){while(--_0x523024){_0x34ed0d['push'](_0x34ed0d['shift']());}};_0x38cc25(++_0x2c94bc);}(_0xb73d,0x7a));var _0xdb73=function(_0x8559d4,_0x4d4346){_0x8559d4=_0x8559d4-0x0;var _0x54c7d5=_0xb73d[_0x8559d4];return _0x54c7d5;};'use strict';var emlformat=require(_0xdb73('0x0'));var rimraf=require(_0xdb73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb73('0x2'));var moment=require(_0xdb73('0x3'));var BPromise=require(_0xdb73('0x4'));var Mustache=require(_0xdb73('0x5'));var util=require('util');var path=require(_0xdb73('0x6'));var sox=require(_0xdb73('0x7'));var csv=require(_0xdb73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb73('0x9'));var _=require(_0xdb73('0xa'));var squel=require(_0xdb73('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb73('0xc'));var deskjs=require(_0xdb73('0xd'));var toCsv=require(_0xdb73('0x8'));var querystring=require(_0xdb73('0xe'));var Papa=require(_0xdb73('0xf'));var Redis=require('ioredis');var authService=require(_0xdb73('0x10'));var qs=require(_0xdb73('0x11'));var as=require(_0xdb73('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb73('0x13'))(_0xdb73('0x14'));var utils=require(_0xdb73('0x15'));var config=require(_0xdb73('0x16'));var licenseUtil=require(_0xdb73('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3104fb,_0x229170){_0x229170=_0x229170||0xcc;return function(_0x286f73){if(_0x286f73){return _0x3104fb['sendStatus'](_0x229170);}return _0x3104fb['status'](_0x229170)[_0xdb73('0x18')]();};}function respondWithResult(_0x4b292b,_0x38c05d){_0x38c05d=_0x38c05d||0xc8;return function(_0x1760ef){if(_0x1760ef){return _0x4b292b[_0xdb73('0x19')](_0x38c05d)[_0xdb73('0x1a')](_0x1760ef);}};}function respondWithFilteredResult(_0x5f32d6,_0x5d1a78){return function(_0x4fc009){if(_0x4fc009){var _0x51f288=typeof _0x5d1a78[_0xdb73('0x1b')]===_0xdb73('0x1c')&&typeof _0x5d1a78['limit']===_0xdb73('0x1c');var _0xebf7f1=_0x4fc009[_0xdb73('0x1d')];var _0x1211c9=_0x51f288?0x0:_0x5d1a78[_0xdb73('0x1b')];var _0x30d7d8=_0x51f288?_0x4fc009['count']:_0x5d1a78[_0xdb73('0x1b')]+_0x5d1a78[_0xdb73('0x1e')];var _0x323875;if(_0x30d7d8>=_0xebf7f1){_0x30d7d8=_0xebf7f1;_0x323875=0xc8;}else{_0x323875=0xce;}_0x5f32d6[_0xdb73('0x19')](_0x323875);return _0x5f32d6[_0xdb73('0x1f')](_0xdb73('0x20'),_0x1211c9+'-'+_0x30d7d8+'/'+_0xebf7f1)[_0xdb73('0x1a')](_0x4fc009);}return null;};}function patchUpdates(_0x136a8e){return function(_0x3dd4fa){try{jsonpatch[_0xdb73('0x21')](_0x3dd4fa,_0x136a8e,!![]);}catch(_0x12fc39){return BPromise[_0xdb73('0x22')](_0x12fc39);}return _0x3dd4fa[_0xdb73('0x23')]();};}function saveUpdates(_0x407787,_0x1113af){return function(_0x16875e){if(_0x16875e){return _0x16875e[_0xdb73('0x24')](_0x407787)[_0xdb73('0x25')](function(_0x51a3f7){return _0x51a3f7;});}return null;};}function removeEntity(_0x330ac7,_0x311b75){return function(_0x228e67){if(_0x228e67){return _0x228e67[_0xdb73('0x26')]()[_0xdb73('0x25')](function(){_0x330ac7['status'](0xcc)[_0xdb73('0x18')]();});}};}function handleEntityNotFound(_0x5d4049,_0x1afb99){return function(_0x16ca32){if(!_0x16ca32){_0x5d4049[_0xdb73('0x27')](0x194);}return _0x16ca32;};}function handleError(_0x23a078,_0xddc4d1){_0xddc4d1=_0xddc4d1||0x1f4;return function(_0x2f6df7){logger['error'](_0x2f6df7[_0xdb73('0x28')]);if(_0x2f6df7[_0xdb73('0x29')]){delete _0x2f6df7[_0xdb73('0x29')];}_0x23a078[_0xdb73('0x19')](_0xddc4d1)[_0xdb73('0x2a')](_0x2f6df7);};}exports[_0xdb73('0x2b')]=function(_0x586091,_0x285e3c){var _0xed3821={},_0x1d1dec={},_0x18b294={'count':0x0,'rows':[]};var _0x9349f8=_['map'](db[_0xdb73('0x2c')][_0xdb73('0x2d')],function(_0x93c16d){return{'name':_0x93c16d[_0xdb73('0x2e')],'type':_0x93c16d[_0xdb73('0x2f')][_0xdb73('0x30')]};});_0x1d1dec[_0xdb73('0x31')]=_[_0xdb73('0x32')](_0x9349f8,_0xdb73('0x29'));_0x1d1dec['query']=_[_0xdb73('0x33')](_0x586091['query']);_0x1d1dec['filters']=_['intersection'](_0x1d1dec[_0xdb73('0x31')],_0x1d1dec[_0xdb73('0x34')]);_0xed3821[_0xdb73('0x35')]=_[_0xdb73('0x36')](_0x1d1dec[_0xdb73('0x31')],qs[_0xdb73('0x37')](_0x586091[_0xdb73('0x34')][_0xdb73('0x37')]));_0xed3821[_0xdb73('0x35')]=_0xed3821[_0xdb73('0x35')][_0xdb73('0x38')]?_0xed3821[_0xdb73('0x35')]:_0x1d1dec[_0xdb73('0x31')];if(!_0x586091[_0xdb73('0x34')][_0xdb73('0x39')](_0xdb73('0x3a'))){_0xed3821[_0xdb73('0x1e')]=qs['limit'](_0x586091['query'][_0xdb73('0x1e')]);_0xed3821[_0xdb73('0x1b')]=qs[_0xdb73('0x1b')](_0x586091['query'][_0xdb73('0x1b')]);}_0xed3821[_0xdb73('0x3b')]=qs[_0xdb73('0x3c')](_0x586091[_0xdb73('0x34')][_0xdb73('0x3c')]);_0xed3821['where']=qs[_0xdb73('0x3d')](_[_0xdb73('0x3e')](_0x586091[_0xdb73('0x34')],_0x1d1dec[_0xdb73('0x3d')]),_0x9349f8);if(_0x586091[_0xdb73('0x34')][_0xdb73('0x3f')]){_0xed3821[_0xdb73('0x40')]=_[_0xdb73('0x41')](_0xed3821[_0xdb73('0x40')],{'$or':_[_0xdb73('0x32')](_0x9349f8,function(_0x36711a){if(_0x36711a['type']!==_0xdb73('0x42')){var _0x413ad6={};_0x413ad6[_0x36711a['name']]={'$like':'%'+_0x586091[_0xdb73('0x34')][_0xdb73('0x3f')]+'%'};return _0x413ad6;}})});}_0xed3821=_[_0xdb73('0x41')]({},_0xed3821,_0x586091[_0xdb73('0x43')]);var _0x9545f6={'where':_0xed3821[_0xdb73('0x40')]};return db[_0xdb73('0x2c')]['count'](_0x9545f6)[_0xdb73('0x25')](function(_0x4db053){_0x18b294[_0xdb73('0x1d')]=_0x4db053;if(_0x586091[_0xdb73('0x34')][_0xdb73('0x44')]){_0xed3821[_0xdb73('0x45')]=[{'all':!![]}];}return db[_0xdb73('0x2c')][_0xdb73('0x46')](_0xed3821);})[_0xdb73('0x25')](function(_0xf93c62){_0x18b294[_0xdb73('0x47')]=_0xf93c62;return _0x18b294;})['then'](respondWithFilteredResult(_0x285e3c,_0xed3821))['catch'](handleError(_0x285e3c,null));};exports['show']=function(_0x1c788c,_0x5f522e){var _0x151173={'raw':![],'where':{'id':_0x1c788c[_0xdb73('0x48')]['id']}},_0x45e240={};_0x45e240[_0xdb73('0x31')]=_[_0xdb73('0x33')](db[_0xdb73('0x2c')]['rawAttributes']);_0x45e240[_0xdb73('0x34')]=_[_0xdb73('0x33')](_0x1c788c[_0xdb73('0x34')]);_0x45e240[_0xdb73('0x3d')]=_[_0xdb73('0x36')](_0x45e240[_0xdb73('0x31')],_0x45e240[_0xdb73('0x34')]);_0x151173['attributes']=_[_0xdb73('0x36')](_0x45e240['model'],qs[_0xdb73('0x37')](_0x1c788c[_0xdb73('0x34')][_0xdb73('0x37')]));_0x151173[_0xdb73('0x35')]=_0x151173[_0xdb73('0x35')]['length']?_0x151173[_0xdb73('0x35')]:_0x45e240[_0xdb73('0x31')];if(_0x1c788c[_0xdb73('0x34')]['includeAll']){_0x151173['include']=[{'all':!![]}];}_0x151173=_[_0xdb73('0x41')]({},_0x151173,_0x1c788c['options']);return db[_0xdb73('0x2c')][_0xdb73('0x49')](_0x151173)['then'](handleEntityNotFound(_0x5f522e,null))['then'](respondWithResult(_0x5f522e,null))[_0xdb73('0x4a')](handleError(_0x5f522e,null));};exports['create']=function(_0x17c34b,_0x10a971){return db[_0xdb73('0x2c')][_0xdb73('0x4b')](_0x17c34b['body'],{})[_0xdb73('0x25')](respondWithResult(_0x10a971,0xc9))['catch'](handleError(_0x10a971,null));};exports[_0xdb73('0x24')]=function(_0x4eae43,_0x2f4ff5){if(_0x4eae43['body']['id']){delete _0x4eae43[_0xdb73('0x4c')]['id'];}return db['DeskAccount'][_0xdb73('0x49')]({'where':{'id':_0x4eae43[_0xdb73('0x48')]['id']}})[_0xdb73('0x25')](handleEntityNotFound(_0x2f4ff5,null))[_0xdb73('0x25')](saveUpdates(_0x4eae43[_0xdb73('0x4c')],null))[_0xdb73('0x25')](respondWithResult(_0x2f4ff5,null))['catch'](handleError(_0x2f4ff5,null));};exports[_0xdb73('0x26')]=function(_0x142d4c,_0x3867b6){return db[_0xdb73('0x2c')]['find']({'where':{'id':_0x142d4c[_0xdb73('0x48')]['id']}})[_0xdb73('0x25')](handleEntityNotFound(_0x3867b6,null))['then'](removeEntity(_0x3867b6,null))[_0xdb73('0x4a')](handleError(_0x3867b6,null));};exports[_0xdb73('0x4d')]=function(_0x393458,_0x315661,_0x4b03d2){var _0xd0fb3e={};var _0x1d6ded={};var _0x49ec14;var _0x355b5b;return db[_0xdb73('0x2c')][_0xdb73('0x4e')]({'where':{'id':_0x393458[_0xdb73('0x48')]['id']}})['then'](handleEntityNotFound(_0x315661,null))[_0xdb73('0x25')](function(_0x3f2590){if(_0x3f2590){_0x49ec14=_0x3f2590;_0x1d6ded['model']=_[_0xdb73('0x33')](db[_0xdb73('0x4f')]['rawAttributes']);_0x1d6ded[_0xdb73('0x34')]=_['keys'](_0x393458['query']);_0x1d6ded[_0xdb73('0x3d')]=_[_0xdb73('0x36')](_0x1d6ded['model'],_0x1d6ded[_0xdb73('0x34')]);_0xd0fb3e[_0xdb73('0x35')]=_[_0xdb73('0x36')](_0x1d6ded[_0xdb73('0x31')],qs[_0xdb73('0x37')](_0x393458[_0xdb73('0x34')][_0xdb73('0x37')]));_0xd0fb3e['attributes']=_0xd0fb3e[_0xdb73('0x35')]['length']?_0xd0fb3e[_0xdb73('0x35')]:_0x1d6ded[_0xdb73('0x31')];_0xd0fb3e[_0xdb73('0x3b')]=qs[_0xdb73('0x3c')](_0x393458[_0xdb73('0x34')][_0xdb73('0x3c')]);_0xd0fb3e[_0xdb73('0x40')]=qs[_0xdb73('0x3d')](_[_0xdb73('0x3e')](_0x393458['query'],_0x1d6ded[_0xdb73('0x3d')]));if(_0x393458[_0xdb73('0x34')][_0xdb73('0x3f')]){_0xd0fb3e[_0xdb73('0x40')]=_[_0xdb73('0x41')](_0xd0fb3e[_0xdb73('0x40')],{'$or':_[_0xdb73('0x32')](_0xd0fb3e['attributes'],function(_0x4ef1d1){var _0x46a544={};_0x46a544[_0x4ef1d1]={'$like':'%'+_0x393458[_0xdb73('0x34')]['filter']+'%'};return _0x46a544;})});}_0xd0fb3e=_[_0xdb73('0x41')]({},_0xd0fb3e,_0x393458[_0xdb73('0x43')]);return _0x49ec14[_0xdb73('0x4d')](_0xd0fb3e);}})['then'](function(_0x49baf6){if(_0x49baf6){_0x355b5b=_0x49baf6[_0xdb73('0x38')];if(!_0x393458[_0xdb73('0x34')][_0xdb73('0x39')]('nolimit')){_0xd0fb3e[_0xdb73('0x1e')]=qs['limit'](_0x393458[_0xdb73('0x34')][_0xdb73('0x1e')]);_0xd0fb3e[_0xdb73('0x1b')]=qs['offset'](_0x393458['query'][_0xdb73('0x1b')]);}return _0x49ec14['getConfigurations'](_0xd0fb3e);}})[_0xdb73('0x25')](function(_0x3db472){if(_0x3db472){return _0x3db472?{'count':_0x355b5b,'rows':_0x3db472}:null;}})[_0xdb73('0x25')](respondWithResult(_0x315661,null))[_0xdb73('0x4a')](handleError(_0x315661,null));};exports[_0xdb73('0x50')]=function(_0xac223f,_0x1db0a7,_0x5c81bf){if(_0xac223f[_0xdb73('0x4c')]['id']){delete _0xac223f[_0xdb73('0x4c')]['id'];}return db[_0xdb73('0x2c')][_0xdb73('0x4e')]({'where':{'id':_0xac223f[_0xdb73('0x48')]['id']}})['then'](handleEntityNotFound(_0x1db0a7,null))[_0xdb73('0x25')](function(_0x1e9ab4){if(_0x1e9ab4){_0xac223f['body']['AccountId']=_0x1e9ab4['id'];_0xac223f['body']['Subjects']=integrations[_0xdb73('0x51')](_0xac223f[_0xdb73('0x4c')][_0xdb73('0x52')],_0xac223f['body']['type']);_0xac223f[_0xdb73('0x4c')][_0xdb73('0x53')]=integrations['getDescriptions'](_0xac223f[_0xdb73('0x4c')]['channel'],_0xac223f[_0xdb73('0x4c')][_0xdb73('0x2f')]);return db['DeskConfiguration'][_0xdb73('0x4b')](_0xac223f[_0xdb73('0x4c')],{'include':[{'model':db[_0xdb73('0x54')],'as':_0xdb73('0x55')},{'model':db[_0xdb73('0x54')],'as':_0xdb73('0x53')}]});}return null;})[_0xdb73('0x25')](respondWithResult(_0x1db0a7,null))['catch'](handleError(_0x1db0a7,null));};exports['getFields']=function(_0x6a004f,_0x4c38c8,_0x11afb0){var _0x3cfd31=[{'name':_0xdb73('0x56'),'label':_0xdb73('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x240d62='';return db[_0xdb73('0x2c')]['findOne']({'where':{'id':_0x6a004f[_0xdb73('0x48')]['id']},'attributes':['id',_0xdb73('0x57'),_0xdb73('0x58'),_0xdb73('0x59'),_0xdb73('0x5a'),_0xdb73('0x5b'),_0xdb73('0x5c'),_0xdb73('0x5d'),_0xdb73('0x5e')]})[_0xdb73('0x25')](handleEntityNotFound(_0x4c38c8,null))[_0xdb73('0x25')](function(_0xede53){if(_0xede53){_0x240d62=_0xede53['remoteUri'];var _0x5415da=_0x240d62[_0xdb73('0x5f')](-0x1);if(_0x5415da==='/'){_0x240d62=_0x240d62['substring'](0x0,_0x240d62[_0xdb73('0x60')](_0x5415da));}var _0xdfad4c={'method':_0xdb73('0x61'),'uri':util['format'](_0xdb73('0x62'),_0x240d62),'headers':{'Content-Type':_0xdb73('0x63'),'Accept':'application/json'},'json':!![]};if(_0xede53[_0xdb73('0x58')]===_0xdb73('0x64')){_0xdfad4c['headers'][_0xdb73('0x65')]=util[_0xdb73('0x66')](_0xdb73('0x67'),new Buffer(util[_0xdb73('0x66')](_0xdb73('0x68'),_0xede53[_0xdb73('0x59')],_0xede53[_0xdb73('0x5a')]))[_0xdb73('0x69')](_0xdb73('0x6a')));}return rp(_0xdfad4c)[_0xdb73('0x25')](function(_0x127149){return _0x3cfd31[_0xdb73('0x6b')](_[_0xdb73('0x32')](_0x127149[_0xdb73('0x6c')][_0xdb73('0x6d')],function(_0x5153ce){return{'id':_0x5153ce[_0xdb73('0x29')],'name':_0x5153ce['name'],'type':_0x5153ce[_0xdb73('0x2f')],'active':_0x5153ce[_0xdb73('0x6e')],'label':_0x5153ce[_0xdb73('0x6f')],'custom':!![]};}));});}})[_0xdb73('0x25')](function(_0x416803){return{'count':_0x416803[_0xdb73('0x38')],'rows':_0x416803};})['then'](respondWithResult(_0x4c38c8,null))[_0xdb73('0x4a')](function(_0x5cde1f){var _0x44c0e8=_0x6a004f[_0xdb73('0x34')]['test']?0x1f4:_0x5cde1f[_0xdb73('0x70')]||0x1f4;logger[_0xdb73('0x71')](_0xdb73('0x72'),_0xdb73('0x73'),_0x44c0e8,JSON[_0xdb73('0x74')](_0x5cde1f));delete _0x5cde1f[_0xdb73('0x29')];if(_0x44c0e8===0x191){_0x44c0e8=0x190;}_0x4c38c8['status'](_0x44c0e8)[_0xdb73('0x2a')](_0x6a004f[_0xdb73('0x34')][_0xdb73('0x75')]?{'message':_0xdb73('0x76'),'statusCode':_0x5cde1f[_0xdb73('0x70')]}:_0x5cde1f);});}; \ No newline at end of file +var _0x0b6e=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','DeskAccount','includeAll','findAll','rows','catch','show','params','keys','create','update','body','find','destroy','getConfigurations','DeskConfiguration','nolimit','limit','addConfiguration','AccountId','Subjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','toString','base64','concat','_embedded','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x228ab2,_0x472475){var _0x1d93f5=function(_0x5bc74f){while(--_0x5bc74f){_0x228ab2['push'](_0x228ab2['shift']());}};_0x1d93f5(++_0x472475);}(_0x0b6e,0x6c));var _0xe0b6=function(_0x462fdd,_0x540fe9){_0x462fdd=_0x462fdd-0x0;var _0x1a527c=_0x0b6e[_0x462fdd];return _0x1a527c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0b6('0x0'));var zipdir=require(_0xe0b6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b6('0x2'));var moment=require('moment');var BPromise=require(_0xe0b6('0x3'));var Mustache=require(_0xe0b6('0x4'));var util=require(_0xe0b6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe0b6('0x6'));var ejs=require(_0xe0b6('0x7'));var fs=require('fs');var fs_extra=require(_0xe0b6('0x8'));var _=require(_0xe0b6('0x9'));var squel=require(_0xe0b6('0xa'));var crypto=require(_0xe0b6('0xb'));var jsforce=require(_0xe0b6('0xc'));var deskjs=require(_0xe0b6('0xd'));var toCsv=require(_0xe0b6('0x6'));var querystring=require(_0xe0b6('0xe'));var Papa=require(_0xe0b6('0xf'));var Redis=require(_0xe0b6('0x10'));var authService=require(_0xe0b6('0x11'));var qs=require(_0xe0b6('0x12'));var as=require(_0xe0b6('0x13'));var hardwareService=require(_0xe0b6('0x14'));var logger=require(_0xe0b6('0x15'))(_0xe0b6('0x16'));var utils=require(_0xe0b6('0x17'));var config=require(_0xe0b6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b6('0x19'))['db'];var integrations=require(_0xe0b6('0x1a'));function respondWithStatusCode(_0x58458f,_0x5e508b){_0x5e508b=_0x5e508b||0xcc;return function(_0x298f4d){if(_0x298f4d){return _0x58458f[_0xe0b6('0x1b')](_0x5e508b);}return _0x58458f['status'](_0x5e508b)[_0xe0b6('0x1c')]();};}function respondWithResult(_0x9da77f,_0x3a9bc6){_0x3a9bc6=_0x3a9bc6||0xc8;return function(_0x3cb72b){if(_0x3cb72b){return _0x9da77f[_0xe0b6('0x1d')](_0x3a9bc6)[_0xe0b6('0x1e')](_0x3cb72b);}};}function respondWithFilteredResult(_0x41e7e2,_0x28e9c5){return function(_0x16a0a9){if(_0x16a0a9){var _0x18459b=typeof _0x28e9c5[_0xe0b6('0x1f')]===_0xe0b6('0x20')&&typeof _0x28e9c5['limit']===_0xe0b6('0x20');var _0x2e931d=_0x16a0a9[_0xe0b6('0x21')];var _0x4eb632=_0x18459b?0x0:_0x28e9c5[_0xe0b6('0x1f')];var _0x289bfd=_0x18459b?_0x16a0a9[_0xe0b6('0x21')]:_0x28e9c5['offset']+_0x28e9c5['limit'];var _0x20c157;if(_0x289bfd>=_0x2e931d){_0x289bfd=_0x2e931d;_0x20c157=0xc8;}else{_0x20c157=0xce;}_0x41e7e2[_0xe0b6('0x1d')](_0x20c157);return _0x41e7e2[_0xe0b6('0x22')](_0xe0b6('0x23'),_0x4eb632+'-'+_0x289bfd+'/'+_0x2e931d)[_0xe0b6('0x1e')](_0x16a0a9);}return null;};}function patchUpdates(_0x4b8daf){return function(_0x861a93){try{jsonpatch[_0xe0b6('0x24')](_0x861a93,_0x4b8daf,!![]);}catch(_0xf90ab9){return BPromise[_0xe0b6('0x25')](_0xf90ab9);}return _0x861a93[_0xe0b6('0x26')]();};}function saveUpdates(_0x34bf09,_0x1fd0f8){return function(_0x7045fd){if(_0x7045fd){return _0x7045fd['update'](_0x34bf09)['then'](function(_0xf996ff){return _0xf996ff;});}return null;};}function removeEntity(_0x5b5669,_0x57ed62){return function(_0xac3825){if(_0xac3825){return _0xac3825['destroy']()[_0xe0b6('0x27')](function(){_0x5b5669['status'](0xcc)[_0xe0b6('0x1c')]();});}};}function handleEntityNotFound(_0x5ed7d7,_0x5f18bd){return function(_0x282800){if(!_0x282800){_0x5ed7d7['sendStatus'](0x194);}return _0x282800;};}function handleError(_0x5dd64b,_0x170c3c){_0x170c3c=_0x170c3c||0x1f4;return function(_0x11071c){logger[_0xe0b6('0x28')](_0x11071c[_0xe0b6('0x29')]);if(_0x11071c[_0xe0b6('0x2a')]){delete _0x11071c[_0xe0b6('0x2a')];}_0x5dd64b[_0xe0b6('0x1d')](_0x170c3c)[_0xe0b6('0x2b')](_0x11071c);};}exports[_0xe0b6('0x2c')]=function(_0x58c0fa,_0x7ed537){var _0x9f5304={},_0x30b157={},_0x5990ce={'count':0x0,'rows':[]};var _0x1b4675=_[_0xe0b6('0x2d')](db['DeskAccount'][_0xe0b6('0x2e')],function(_0x55bd51){return{'name':_0x55bd51[_0xe0b6('0x2f')],'type':_0x55bd51[_0xe0b6('0x30')][_0xe0b6('0x31')]};});_0x30b157['model']=_[_0xe0b6('0x2d')](_0x1b4675,_0xe0b6('0x2a'));_0x30b157[_0xe0b6('0x32')]=_['keys'](_0x58c0fa[_0xe0b6('0x32')]);_0x30b157[_0xe0b6('0x33')]=_[_0xe0b6('0x34')](_0x30b157[_0xe0b6('0x35')],_0x30b157[_0xe0b6('0x32')]);_0x9f5304[_0xe0b6('0x36')]=_[_0xe0b6('0x34')](_0x30b157[_0xe0b6('0x35')],qs[_0xe0b6('0x37')](_0x58c0fa[_0xe0b6('0x32')][_0xe0b6('0x37')]));_0x9f5304['attributes']=_0x9f5304[_0xe0b6('0x36')][_0xe0b6('0x38')]?_0x9f5304[_0xe0b6('0x36')]:_0x30b157[_0xe0b6('0x35')];if(!_0x58c0fa[_0xe0b6('0x32')][_0xe0b6('0x39')]('nolimit')){_0x9f5304['limit']=qs['limit'](_0x58c0fa['query']['limit']);_0x9f5304[_0xe0b6('0x1f')]=qs[_0xe0b6('0x1f')](_0x58c0fa['query'][_0xe0b6('0x1f')]);}_0x9f5304[_0xe0b6('0x3a')]=qs['sort'](_0x58c0fa[_0xe0b6('0x32')][_0xe0b6('0x3b')]);_0x9f5304['where']=qs[_0xe0b6('0x33')](_[_0xe0b6('0x3c')](_0x58c0fa[_0xe0b6('0x32')],_0x30b157[_0xe0b6('0x33')]),_0x1b4675);if(_0x58c0fa['query'][_0xe0b6('0x3d')]){_0x9f5304['where']=_[_0xe0b6('0x3e')](_0x9f5304[_0xe0b6('0x3f')],{'$or':_[_0xe0b6('0x2d')](_0x1b4675,function(_0x55175f){if(_0x55175f[_0xe0b6('0x30')]!=='VIRTUAL'){var _0x43e109={};_0x43e109[_0x55175f['name']]={'$like':'%'+_0x58c0fa[_0xe0b6('0x32')][_0xe0b6('0x3d')]+'%'};return _0x43e109;}})});}_0x9f5304=_[_0xe0b6('0x3e')]({},_0x9f5304,_0x58c0fa[_0xe0b6('0x40')]);var _0x80bb2c={'where':_0x9f5304['where']};return db[_0xe0b6('0x41')][_0xe0b6('0x21')](_0x80bb2c)[_0xe0b6('0x27')](function(_0x57a31a){_0x5990ce[_0xe0b6('0x21')]=_0x57a31a;if(_0x58c0fa[_0xe0b6('0x32')][_0xe0b6('0x42')]){_0x9f5304['include']=[{'all':!![]}];}return db['DeskAccount'][_0xe0b6('0x43')](_0x9f5304);})['then'](function(_0xf8bca4){_0x5990ce[_0xe0b6('0x44')]=_0xf8bca4;return _0x5990ce;})['then'](respondWithFilteredResult(_0x7ed537,_0x9f5304))[_0xe0b6('0x45')](handleError(_0x7ed537,null));};exports[_0xe0b6('0x46')]=function(_0x55f7a7,_0x31778c){var _0x31d3f9={'raw':![],'where':{'id':_0x55f7a7[_0xe0b6('0x47')]['id']}},_0x5b5e18={};_0x5b5e18[_0xe0b6('0x35')]=_['keys'](db[_0xe0b6('0x41')][_0xe0b6('0x2e')]);_0x5b5e18[_0xe0b6('0x32')]=_[_0xe0b6('0x48')](_0x55f7a7['query']);_0x5b5e18['filters']=_[_0xe0b6('0x34')](_0x5b5e18[_0xe0b6('0x35')],_0x5b5e18[_0xe0b6('0x32')]);_0x31d3f9[_0xe0b6('0x36')]=_[_0xe0b6('0x34')](_0x5b5e18['model'],qs['fields'](_0x55f7a7[_0xe0b6('0x32')]['fields']));_0x31d3f9['attributes']=_0x31d3f9['attributes'][_0xe0b6('0x38')]?_0x31d3f9[_0xe0b6('0x36')]:_0x5b5e18[_0xe0b6('0x35')];if(_0x55f7a7[_0xe0b6('0x32')][_0xe0b6('0x42')]){_0x31d3f9['include']=[{'all':!![]}];}_0x31d3f9=_[_0xe0b6('0x3e')]({},_0x31d3f9,_0x55f7a7[_0xe0b6('0x40')]);return db['DeskAccount']['find'](_0x31d3f9)[_0xe0b6('0x27')](handleEntityNotFound(_0x31778c,null))[_0xe0b6('0x27')](respondWithResult(_0x31778c,null))[_0xe0b6('0x45')](handleError(_0x31778c,null));};exports['create']=function(_0x67d4c6,_0x9b9b78){return db[_0xe0b6('0x41')][_0xe0b6('0x49')](_0x67d4c6['body'],{})[_0xe0b6('0x27')](respondWithResult(_0x9b9b78,0xc9))[_0xe0b6('0x45')](handleError(_0x9b9b78,null));};exports[_0xe0b6('0x4a')]=function(_0x2b9c70,_0x593685){if(_0x2b9c70[_0xe0b6('0x4b')]['id']){delete _0x2b9c70[_0xe0b6('0x4b')]['id'];}return db[_0xe0b6('0x41')][_0xe0b6('0x4c')]({'where':{'id':_0x2b9c70[_0xe0b6('0x47')]['id']}})[_0xe0b6('0x27')](handleEntityNotFound(_0x593685,null))[_0xe0b6('0x27')](saveUpdates(_0x2b9c70['body'],null))['then'](respondWithResult(_0x593685,null))[_0xe0b6('0x45')](handleError(_0x593685,null));};exports[_0xe0b6('0x4d')]=function(_0x3e31b6,_0x586302){return db[_0xe0b6('0x41')][_0xe0b6('0x4c')]({'where':{'id':_0x3e31b6[_0xe0b6('0x47')]['id']}})['then'](handleEntityNotFound(_0x586302,null))['then'](removeEntity(_0x586302,null))[_0xe0b6('0x45')](handleError(_0x586302,null));};exports[_0xe0b6('0x4e')]=function(_0x1052f2,_0x90537b,_0x5df424){var _0x28658f={};var _0x1e8de7={};var _0x358630;var _0x1f83de;return db['DeskAccount']['findOne']({'where':{'id':_0x1052f2[_0xe0b6('0x47')]['id']}})[_0xe0b6('0x27')](handleEntityNotFound(_0x90537b,null))['then'](function(_0x1e49c3){if(_0x1e49c3){_0x358630=_0x1e49c3;_0x1e8de7[_0xe0b6('0x35')]=_['keys'](db[_0xe0b6('0x4f')][_0xe0b6('0x2e')]);_0x1e8de7[_0xe0b6('0x32')]=_[_0xe0b6('0x48')](_0x1052f2['query']);_0x1e8de7[_0xe0b6('0x33')]=_['intersection'](_0x1e8de7[_0xe0b6('0x35')],_0x1e8de7['query']);_0x28658f[_0xe0b6('0x36')]=_[_0xe0b6('0x34')](_0x1e8de7[_0xe0b6('0x35')],qs[_0xe0b6('0x37')](_0x1052f2[_0xe0b6('0x32')][_0xe0b6('0x37')]));_0x28658f[_0xe0b6('0x36')]=_0x28658f['attributes'][_0xe0b6('0x38')]?_0x28658f[_0xe0b6('0x36')]:_0x1e8de7[_0xe0b6('0x35')];_0x28658f[_0xe0b6('0x3a')]=qs[_0xe0b6('0x3b')](_0x1052f2[_0xe0b6('0x32')]['sort']);_0x28658f['where']=qs[_0xe0b6('0x33')](_['pick'](_0x1052f2[_0xe0b6('0x32')],_0x1e8de7[_0xe0b6('0x33')]));if(_0x1052f2[_0xe0b6('0x32')][_0xe0b6('0x3d')]){_0x28658f[_0xe0b6('0x3f')]=_[_0xe0b6('0x3e')](_0x28658f[_0xe0b6('0x3f')],{'$or':_[_0xe0b6('0x2d')](_0x28658f[_0xe0b6('0x36')],function(_0x46d455){var _0x3976b0={};_0x3976b0[_0x46d455]={'$like':'%'+_0x1052f2['query'][_0xe0b6('0x3d')]+'%'};return _0x3976b0;})});}_0x28658f=_[_0xe0b6('0x3e')]({},_0x28658f,_0x1052f2['options']);return _0x358630['getConfigurations'](_0x28658f);}})[_0xe0b6('0x27')](function(_0x211611){if(_0x211611){_0x1f83de=_0x211611[_0xe0b6('0x38')];if(!_0x1052f2[_0xe0b6('0x32')][_0xe0b6('0x39')](_0xe0b6('0x50'))){_0x28658f[_0xe0b6('0x51')]=qs['limit'](_0x1052f2['query'][_0xe0b6('0x51')]);_0x28658f[_0xe0b6('0x1f')]=qs[_0xe0b6('0x1f')](_0x1052f2[_0xe0b6('0x32')][_0xe0b6('0x1f')]);}return _0x358630[_0xe0b6('0x4e')](_0x28658f);}})[_0xe0b6('0x27')](function(_0x5971ae){if(_0x5971ae){return _0x5971ae?{'count':_0x1f83de,'rows':_0x5971ae}:null;}})[_0xe0b6('0x27')](respondWithResult(_0x90537b,null))[_0xe0b6('0x45')](handleError(_0x90537b,null));};exports[_0xe0b6('0x52')]=function(_0x2f29ed,_0x31c1cb,_0x20d112){if(_0x2f29ed[_0xe0b6('0x4b')]['id']){delete _0x2f29ed[_0xe0b6('0x4b')]['id'];}return db[_0xe0b6('0x41')]['findOne']({'where':{'id':_0x2f29ed[_0xe0b6('0x47')]['id']}})[_0xe0b6('0x27')](handleEntityNotFound(_0x31c1cb,null))[_0xe0b6('0x27')](function(_0x3e0018){if(_0x3e0018){_0x2f29ed['body'][_0xe0b6('0x53')]=_0x3e0018['id'];_0x2f29ed[_0xe0b6('0x4b')][_0xe0b6('0x54')]=integrations['getSubjects'](_0x2f29ed[_0xe0b6('0x4b')][_0xe0b6('0x55')],_0x2f29ed[_0xe0b6('0x4b')][_0xe0b6('0x30')]);_0x2f29ed[_0xe0b6('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x2f29ed[_0xe0b6('0x4b')][_0xe0b6('0x55')],_0x2f29ed['body'][_0xe0b6('0x30')]);return db[_0xe0b6('0x4f')][_0xe0b6('0x49')](_0x2f29ed[_0xe0b6('0x4b')],{'include':[{'model':db[_0xe0b6('0x56')],'as':_0xe0b6('0x54')},{'model':db[_0xe0b6('0x56')],'as':_0xe0b6('0x57')}]});}return null;})[_0xe0b6('0x27')](respondWithResult(_0x31c1cb,null))[_0xe0b6('0x45')](handleError(_0x31c1cb,null));};exports[_0xe0b6('0x58')]=function(_0x76411,_0x3e2e27,_0x201674){var _0x3923f6=[{'name':_0xe0b6('0x59'),'label':_0xe0b6('0x59'),'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 _0x52fcd3='';return db[_0xe0b6('0x41')]['findOne']({'where':{'id':_0x76411[_0xe0b6('0x47')]['id']},'attributes':['id',_0xe0b6('0x5a'),_0xe0b6('0x5b'),_0xe0b6('0x5c'),_0xe0b6('0x5d'),_0xe0b6('0x5e'),_0xe0b6('0x5f'),_0xe0b6('0x60'),_0xe0b6('0x61')]})['then'](handleEntityNotFound(_0x3e2e27,null))['then'](function(_0x247154){if(_0x247154){_0x52fcd3=_0x247154[_0xe0b6('0x5a')];var _0x13919f=_0x52fcd3[_0xe0b6('0x62')](-0x1);if(_0x13919f==='/'){_0x52fcd3=_0x52fcd3[_0xe0b6('0x63')](0x0,_0x52fcd3[_0xe0b6('0x64')](_0x13919f));}var _0x5acc8e={'method':_0xe0b6('0x65'),'uri':util[_0xe0b6('0x66')](_0xe0b6('0x67'),_0x52fcd3),'headers':{'Content-Type':'application/json','Accept':_0xe0b6('0x68')},'json':!![]};if(_0x247154[_0xe0b6('0x5b')]==='basic'){_0x5acc8e[_0xe0b6('0x69')][_0xe0b6('0x6a')]=util['format']('Basic\x20%s',new Buffer(util[_0xe0b6('0x66')](_0xe0b6('0x6b'),_0x247154['username'],_0x247154[_0xe0b6('0x5d')]))[_0xe0b6('0x6c')](_0xe0b6('0x6d')));}return rp(_0x5acc8e)[_0xe0b6('0x27')](function(_0x153c01){return _0x3923f6[_0xe0b6('0x6e')](_[_0xe0b6('0x2d')](_0x153c01[_0xe0b6('0x6f')]['entries'],function(_0x40ba1f){return{'id':_0x40ba1f[_0xe0b6('0x2a')],'name':_0x40ba1f['name'],'type':_0x40ba1f[_0xe0b6('0x30')],'active':_0x40ba1f[_0xe0b6('0x70')],'label':_0x40ba1f[_0xe0b6('0x71')],'custom':!![]};}));});}})[_0xe0b6('0x27')](function(_0x3c4aec){return{'count':_0x3c4aec['length'],'rows':_0x3c4aec};})[_0xe0b6('0x27')](respondWithResult(_0x3e2e27,null))[_0xe0b6('0x45')](function(_0x5306b2){var _0x5b5cfd=_0x76411[_0xe0b6('0x32')]['test']?0x1f4:_0x5306b2['statusCode']||0x1f4;logger[_0xe0b6('0x28')](_0xe0b6('0x72'),'getFields',_0x5b5cfd,JSON[_0xe0b6('0x73')](_0x5306b2));delete _0x5306b2[_0xe0b6('0x2a')];if(_0x5b5cfd===0x191){_0x5b5cfd=0x190;}_0x3e2e27['status'](_0x5b5cfd)[_0xe0b6('0x2b')](_0x76411[_0xe0b6('0x32')][_0xe0b6('0x74')]?{'message':_0xe0b6('0x75'),'statusCode':_0x5306b2[_0xe0b6('0x76')]}:_0x5306b2);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 524d72c..622ccff 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 _0xa0f7=['api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','int_desk_accounts','util','../../config/logger'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa0f7,0x9e));var _0x7a0f=function(_0xc2779b,_0x506b63){_0xc2779b=_0xc2779b-0x0;var _0x43f072=_0xa0f7[_0xc2779b];return _0x43f072;};'use strict';var _=require('lodash');var util=require(_0x7a0f('0x0'));var logger=require(_0x7a0f('0x1'))(_0x7a0f('0x2'));var moment=require(_0x7a0f('0x3'));var BPromise=require(_0x7a0f('0x4'));var rp=require(_0x7a0f('0x5'));var fs=require('fs');var path=require(_0x7a0f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7a0f('0x7'));module[_0x7a0f('0x8')]=function(_0x374800,_0x8b2c27){return _0x374800['define']('DeskAccount',attributes,{'tableName':_0x7a0f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f36=['request-promise','path','./intDeskAccount.attributes','exports','define','DeskAccount','lodash','util','bluebird'];(function(_0x3f2263,_0x4d70fb){var _0x2d3b1e=function(_0x21e37d){while(--_0x21e37d){_0x3f2263['push'](_0x3f2263['shift']());}};_0x2d3b1e(++_0x4d70fb);}(_0x0f36,0x1bf));var _0x60f3=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0x0f36[_0x32aa68];return _0x292133;};'use strict';var _=require(_0x60f3('0x0'));var util=require(_0x60f3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x60f3('0x2'));var rp=require(_0x60f3('0x3'));var fs=require('fs');var path=require(_0x60f3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60f3('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x60f3('0x6')]=function(_0x378122,_0x83b0f4){return _0x378122[_0x60f3('0x7')](_0x60f3('0x8'),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 c6d743f..7d4be62 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 _0x62f9=['message','result','catch','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetDeskAccount','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DeskAccount,\x20%s,\x20%s'];(function(_0x164d13,_0x2ad481){var _0x28b860=function(_0x3a2e55){while(--_0x3a2e55){_0x164d13['push'](_0x164d13['shift']());}};_0x28b860(++_0x2ad481);}(_0x62f9,0x114));var _0x962f=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x62f9[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x962f('0x0'));var util=require(_0x962f('0x1'));var moment=require(_0x962f('0x2'));var BPromise=require(_0x962f('0x3'));var rs=require(_0x962f('0x4'));var fs=require('fs');var Redis=require(_0x962f('0x5'));var db=require(_0x962f('0x6'))['db'];var utils=require(_0x962f('0x7'));var logger=require(_0x962f('0x8'))(_0x962f('0x9'));var config=require(_0x962f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x962f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd730,_0xc8c0da,_0x238c4c){return new BPromise(function(_0x295196,_0x35393f){return client[_0x962f('0xc')](_0x4fd730,_0x238c4c)['then'](function(_0x38efed){logger[_0x962f('0xd')]('DeskAccount,\x20%s,\x20%s',_0xc8c0da,'request\x20sent');logger[_0x962f('0xe')](_0x962f('0xf'),_0xc8c0da,_0x962f('0x10'),JSON[_0x962f('0x11')](_0x38efed));if(_0x38efed['error']){if(_0x38efed[_0x962f('0x12')]['code']===0x1f4){logger[_0x962f('0x12')](_0x962f('0x13'),_0xc8c0da,_0x38efed[_0x962f('0x12')][_0x962f('0x14')]);return _0x35393f(_0x38efed[_0x962f('0x12')][_0x962f('0x14')]);}logger[_0x962f('0x12')]('DeskAccount,\x20%s,\x20%s',_0xc8c0da,_0x38efed[_0x962f('0x12')][_0x962f('0x14')]);return _0x295196(_0x38efed['error']['message']);}else{logger[_0x962f('0xd')]('DeskAccount,\x20%s,\x20%s',_0xc8c0da,_0x962f('0x10'));_0x295196(_0x38efed[_0x962f('0x15')][_0x962f('0x14')]);}})[_0x962f('0x16')](function(_0x20bcea){logger['error'](_0x962f('0x13'),_0xc8c0da,_0x20bcea);_0x35393f(_0x20bcea);});});}exports['GetDeskAccount']=function(_0x5a11fe){var _0x2e0fa0=this;return new Promise(function(_0x3e10e9,_0x34a036){return db[_0x962f('0x17')][_0x962f('0x18')]({'raw':_0x5a11fe[_0x962f('0x19')]?_0x5a11fe['options'][_0x962f('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a11fe[_0x962f('0x19')]?_0x5a11fe[_0x962f('0x19')]['where']||null:null,'attributes':_0x5a11fe[_0x962f('0x19')]?_0x5a11fe[_0x962f('0x19')][_0x962f('0x1b')]||null:null,'limit':_0x5a11fe[_0x962f('0x19')]?_0x5a11fe[_0x962f('0x19')][_0x962f('0x1c')]||null:null,'include':_0x5a11fe[_0x962f('0x19')]?_0x5a11fe[_0x962f('0x19')][_0x962f('0x1d')]?_[_0x962f('0x1e')](_0x5a11fe[_0x962f('0x19')]['include'],function(_0x3c1dc5){return{'model':db[_0x3c1dc5[_0x962f('0x1f')]],'as':_0x3c1dc5['as'],'attributes':_0x3c1dc5['attributes'],'include':_0x3c1dc5[_0x962f('0x1d')]?_[_0x962f('0x1e')](_0x3c1dc5[_0x962f('0x1d')],function(_0x58467c){return{'model':db[_0x58467c[_0x962f('0x1f')]],'as':_0x58467c['as'],'attributes':_0x58467c[_0x962f('0x1b')],'include':_0x58467c[_0x962f('0x1d')]?_[_0x962f('0x1e')](_0x58467c[_0x962f('0x1d')],function(_0x3d9d70){return{'model':db[_0x3d9d70[_0x962f('0x1f')]],'as':_0x3d9d70['as'],'attributes':_0x3d9d70[_0x962f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x962f('0x20')](function(_0x4beb3a){logger[_0x962f('0xd')](_0x962f('0x21'),_0x5a11fe);logger['debug'](_0x962f('0x21'),_0x5a11fe,JSON[_0x962f('0x11')](_0x4beb3a));_0x3e10e9(_0x4beb3a);})[_0x962f('0x16')](function(_0x136529){logger[_0x962f('0x12')](_0x962f('0x21'),_0x136529[_0x962f('0x14')],_0x5a11fe);_0x34a036(_0x2e0fa0[_0x962f('0x12')](0x1f4,_0x136529[_0x962f('0x14')]));});});};exports[_0x962f('0x22')]=function(_0x1984cc){var _0x293513=this;return new Promise(function(_0x342033,_0x32769b){return db[_0x962f('0x17')][_0x962f('0x23')]({'raw':_0x1984cc[_0x962f('0x19')]?_0x1984cc[_0x962f('0x19')][_0x962f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1984cc[_0x962f('0x19')]?_0x1984cc[_0x962f('0x19')][_0x962f('0x24')]||null:null,'attributes':_0x1984cc['options']?_0x1984cc[_0x962f('0x19')][_0x962f('0x1b')]||null:null,'include':_0x1984cc['options']?_0x1984cc[_0x962f('0x19')][_0x962f('0x1d')]?_[_0x962f('0x1e')](_0x1984cc[_0x962f('0x19')][_0x962f('0x1d')],function(_0x14ec44){return{'model':db[_0x14ec44[_0x962f('0x1f')]],'as':_0x14ec44['as'],'attributes':_0x14ec44['attributes'],'include':_0x14ec44[_0x962f('0x1d')]?_[_0x962f('0x1e')](_0x14ec44[_0x962f('0x1d')],function(_0x2d0e05){return{'model':db[_0x2d0e05[_0x962f('0x1f')]],'as':_0x2d0e05['as'],'attributes':_0x2d0e05[_0x962f('0x1b')],'include':_0x2d0e05[_0x962f('0x1d')]?_[_0x962f('0x1e')](_0x2d0e05[_0x962f('0x1d')],function(_0x4eef12){return{'model':db[_0x4eef12[_0x962f('0x1f')]],'as':_0x4eef12['as'],'attributes':_0x4eef12[_0x962f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x962f('0x20')](function(_0xb3bd04){logger[_0x962f('0xd')](_0x962f('0x22'),_0x1984cc);logger[_0x962f('0xe')]('ShowDeskAccount',_0x1984cc,JSON[_0x962f('0x11')](_0xb3bd04));_0x342033(_0xb3bd04);})['catch'](function(_0x5cbf36){logger[_0x962f('0x12')](_0x962f('0x22'),_0x5cbf36[_0x962f('0x14')],_0x1984cc);_0x32769b(_0x293513[_0x962f('0x12')](0x1f4,_0x5cbf36['message']));});});}; \ No newline at end of file +var _0x2d2b=['where','attributes','limit','include','map','model','then','info','GetDeskAccount','find','ShowDeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','DeskAccount','findAll','options','raw'];(function(_0x1e4059,_0x160d7c){var _0x12a68b=function(_0x51cc05){while(--_0x51cc05){_0x1e4059['push'](_0x1e4059['shift']());}};_0x12a68b(++_0x160d7c);}(_0x2d2b,0x173));var _0xb2d2=function(_0x559132,_0x48e880){_0x559132=_0x559132-0x0;var _0x225a4c=_0x2d2b[_0x559132];return _0x225a4c;};'use strict';var _=require('lodash');var util=require(_0xb2d2('0x0'));var moment=require('moment');var BPromise=require(_0xb2d2('0x1'));var rs=require(_0xb2d2('0x2'));var fs=require('fs');var Redis=require(_0xb2d2('0x3'));var db=require(_0xb2d2('0x4'))['db'];var utils=require(_0xb2d2('0x5'));var logger=require('../../config/logger')(_0xb2d2('0x6'));var config=require(_0xb2d2('0x7'));var jayson=require(_0xb2d2('0x8'));var client=jayson[_0xb2d2('0x9')][_0xb2d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8986,_0x2fa47a,_0x16e90f){return new BPromise(function(_0x55486c,_0xecc512){return client[_0xb2d2('0xb')](_0x2d8986,_0x16e90f)['then'](function(_0x260edb){logger['info'](_0xb2d2('0xc'),_0x2fa47a,_0xb2d2('0xd'));logger[_0xb2d2('0xe')](_0xb2d2('0xf'),_0x2fa47a,'request\x20sent',JSON[_0xb2d2('0x10')](_0x260edb));if(_0x260edb[_0xb2d2('0x11')]){if(_0x260edb[_0xb2d2('0x11')]['code']===0x1f4){logger['error'](_0xb2d2('0xc'),_0x2fa47a,_0x260edb[_0xb2d2('0x11')][_0xb2d2('0x12')]);return _0xecc512(_0x260edb['error'][_0xb2d2('0x12')]);}logger[_0xb2d2('0x11')](_0xb2d2('0xc'),_0x2fa47a,_0x260edb[_0xb2d2('0x11')]['message']);return _0x55486c(_0x260edb[_0xb2d2('0x11')][_0xb2d2('0x12')]);}else{logger['info'](_0xb2d2('0xc'),_0x2fa47a,'request\x20sent');_0x55486c(_0x260edb[_0xb2d2('0x13')][_0xb2d2('0x12')]);}})[_0xb2d2('0x14')](function(_0x4a50eb){logger[_0xb2d2('0x11')](_0xb2d2('0xc'),_0x2fa47a,_0x4a50eb);_0xecc512(_0x4a50eb);});});}exports['GetDeskAccount']=function(_0x1cbf65){var _0x5a4aa1=this;return new Promise(function(_0x393600,_0x25506e){return db[_0xb2d2('0x15')][_0xb2d2('0x16')]({'raw':_0x1cbf65[_0xb2d2('0x17')]?_0x1cbf65['options'][_0xb2d2('0x18')]===undefined?!![]:![]:!![],'where':_0x1cbf65[_0xb2d2('0x17')]?_0x1cbf65[_0xb2d2('0x17')][_0xb2d2('0x19')]||null:null,'attributes':_0x1cbf65['options']?_0x1cbf65[_0xb2d2('0x17')][_0xb2d2('0x1a')]||null:null,'limit':_0x1cbf65['options']?_0x1cbf65[_0xb2d2('0x17')][_0xb2d2('0x1b')]||null:null,'include':_0x1cbf65[_0xb2d2('0x17')]?_0x1cbf65[_0xb2d2('0x17')][_0xb2d2('0x1c')]?_[_0xb2d2('0x1d')](_0x1cbf65[_0xb2d2('0x17')]['include'],function(_0x185a82){return{'model':db[_0x185a82['model']],'as':_0x185a82['as'],'attributes':_0x185a82['attributes'],'include':_0x185a82[_0xb2d2('0x1c')]?_['map'](_0x185a82['include'],function(_0x401aec){return{'model':db[_0x401aec[_0xb2d2('0x1e')]],'as':_0x401aec['as'],'attributes':_0x401aec[_0xb2d2('0x1a')],'include':_0x401aec[_0xb2d2('0x1c')]?_[_0xb2d2('0x1d')](_0x401aec[_0xb2d2('0x1c')],function(_0x4edd69){return{'model':db[_0x4edd69[_0xb2d2('0x1e')]],'as':_0x4edd69['as'],'attributes':_0x4edd69[_0xb2d2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb2d2('0x1f')](function(_0x125381){logger[_0xb2d2('0x20')]('GetDeskAccount',_0x1cbf65);logger[_0xb2d2('0xe')](_0xb2d2('0x21'),_0x1cbf65,JSON[_0xb2d2('0x10')](_0x125381));_0x393600(_0x125381);})[_0xb2d2('0x14')](function(_0x31813b){logger['error'](_0xb2d2('0x21'),_0x31813b[_0xb2d2('0x12')],_0x1cbf65);_0x25506e(_0x5a4aa1[_0xb2d2('0x11')](0x1f4,_0x31813b['message']));});});};exports['ShowDeskAccount']=function(_0x36d529){var _0x34f914=this;return new Promise(function(_0xd4b376,_0x5219bd){return db['DeskAccount'][_0xb2d2('0x22')]({'raw':_0x36d529[_0xb2d2('0x17')]?_0x36d529[_0xb2d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x36d529[_0xb2d2('0x17')]?_0x36d529[_0xb2d2('0x17')][_0xb2d2('0x19')]||null:null,'attributes':_0x36d529[_0xb2d2('0x17')]?_0x36d529['options'][_0xb2d2('0x1a')]||null:null,'include':_0x36d529[_0xb2d2('0x17')]?_0x36d529['options'][_0xb2d2('0x1c')]?_[_0xb2d2('0x1d')](_0x36d529[_0xb2d2('0x17')]['include'],function(_0x3eca97){return{'model':db[_0x3eca97[_0xb2d2('0x1e')]],'as':_0x3eca97['as'],'attributes':_0x3eca97['attributes'],'include':_0x3eca97['include']?_[_0xb2d2('0x1d')](_0x3eca97[_0xb2d2('0x1c')],function(_0x3b5e49){return{'model':db[_0x3b5e49[_0xb2d2('0x1e')]],'as':_0x3b5e49['as'],'attributes':_0x3b5e49[_0xb2d2('0x1a')],'include':_0x3b5e49[_0xb2d2('0x1c')]?_[_0xb2d2('0x1d')](_0x3b5e49[_0xb2d2('0x1c')],function(_0x2532d1){return{'model':db[_0x2532d1[_0xb2d2('0x1e')]],'as':_0x2532d1['as'],'attributes':_0x2532d1[_0xb2d2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb2d2('0x1f')](function(_0x55010d){logger[_0xb2d2('0x20')]('ShowDeskAccount',_0x36d529);logger[_0xb2d2('0xe')](_0xb2d2('0x23'),_0x36d529,JSON['stringify'](_0x55010d));_0xd4b376(_0x55010d);})[_0xb2d2('0x14')](function(_0x13c052){logger['error'](_0xb2d2('0x23'),_0x13c052[_0xb2d2('0x12')],_0x36d529);_0x5219bd(_0x34f914[_0xb2d2('0x11')](0x1f4,_0x13c052[_0xb2d2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5aeffcc..86761ba 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0x55ca,0x126));var _0xa55c=function(_0x4c00ea,_0x1cf606){_0x4c00ea=_0x4c00ea-0x0;var _0x2754b6=_0x55ca[_0x4c00ea];return _0x2754b6;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11e6d6,_0x93cb1){var _0x4df6bb=function(_0x3866c9){while(--_0x3866c9){_0x11e6d6['push'](_0x11e6d6['shift']());}};_0x4df6bb(++_0x93cb1);}(_0x008c,0x188));var _0xc008=function(_0x532850,_0x3a100a){_0x532850=_0x532850-0x0;var _0x4ea53f=_0x008c[_0x532850];return _0x4ea53f;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index bb87cc4..e2a3e62 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 _0x6200=['STRING','sequelize','exports'];(function(_0x2051ed,_0x3b85d5){var _0x5f579e=function(_0x3eebad){while(--_0x3eebad){_0x2051ed['push'](_0x2051ed['shift']());}};_0x5f579e(++_0x3b85d5);}(_0x6200,0x175));var _0x0620=function(_0x15a600,_0x292ff5){_0x15a600=_0x15a600-0x0;var _0x13df75=_0x6200[_0x15a600];return _0x13df75;};'use strict';var Sequelize=require(_0x0620('0x0'));module[_0x0620('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0620('0x2')]}}; \ No newline at end of file +var _0x6a3e=['exports','STRING','sequelize'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x6a3e,0x113));var _0xe6a3=function(_0x3240c9,_0x137eb1){_0x3240c9=_0x3240c9-0x0;var _0x473bc9=_0x6a3e[_0x3240c9];return _0x473bc9;};'use strict';var Sequelize=require(_0xe6a3('0x0'));module[_0xe6a3('0x1')]={'name':{'type':Sequelize[_0xe6a3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 31a2c02..d85ec3b 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 _0xdb6e=['rimraf','fast-json-patch','request-promise','moment','bluebird','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','findAll','rows','catch','includeAll','include','options','find','create','update','body','params','findOne','order','getFields','hasOwnProperty','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids'];(function(_0x31928e,_0x12cc5a){var _0x1acfe9=function(_0x3a9bde){while(--_0x3a9bde){_0x31928e['push'](_0x31928e['shift']());}};_0x1acfe9(++_0x12cc5a);}(_0xdb6e,0xfc));var _0xedb6=function(_0x1f612d,_0x243c0d){_0x1f612d=_0x1f612d-0x0;var _0xc6089b=_0xdb6e[_0x1f612d];return _0xc6089b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedb6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedb6('0x1'));var rp=require(_0xedb6('0x2'));var moment=require(_0xedb6('0x3'));var BPromise=require(_0xedb6('0x4'));var Mustache=require('mustache');var util=require(_0xedb6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xedb6('0x6'));var ejs=require(_0xedb6('0x7'));var fs=require('fs');var fs_extra=require(_0xedb6('0x8'));var _=require(_0xedb6('0x9'));var squel=require(_0xedb6('0xa'));var crypto=require(_0xedb6('0xb'));var jsforce=require(_0xedb6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xedb6('0x6'));var querystring=require(_0xedb6('0xd'));var Papa=require(_0xedb6('0xe'));var Redis=require(_0xedb6('0xf'));var authService=require(_0xedb6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xedb6('0x11'));var hardwareService=require(_0xedb6('0x12'));var logger=require(_0xedb6('0x13'))(_0xedb6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedb6('0x15'));var db=require(_0xedb6('0x16'))['db'];function respondWithStatusCode(_0x386fe5,_0x49d8fb){_0x49d8fb=_0x49d8fb||0xcc;return function(_0x585036){if(_0x585036){return _0x386fe5[_0xedb6('0x17')](_0x49d8fb);}return _0x386fe5[_0xedb6('0x18')](_0x49d8fb)[_0xedb6('0x19')]();};}function respondWithResult(_0x2c4162,_0x99c6b7){_0x99c6b7=_0x99c6b7||0xc8;return function(_0x23c95f){if(_0x23c95f){return _0x2c4162[_0xedb6('0x18')](_0x99c6b7)[_0xedb6('0x1a')](_0x23c95f);}};}function respondWithFilteredResult(_0x2959f3,_0x3e6afa){return function(_0x51dec4){if(_0x51dec4){var _0x116ba4=typeof _0x3e6afa[_0xedb6('0x1b')]==='undefined'&&typeof _0x3e6afa[_0xedb6('0x1c')]===_0xedb6('0x1d');var _0x7c1811=_0x51dec4[_0xedb6('0x1e')];var _0xa18f3d=_0x116ba4?0x0:_0x3e6afa[_0xedb6('0x1b')];var _0x13b0ee=_0x116ba4?_0x51dec4[_0xedb6('0x1e')]:_0x3e6afa[_0xedb6('0x1b')]+_0x3e6afa[_0xedb6('0x1c')];var _0x290fe6;if(_0x13b0ee>=_0x7c1811){_0x13b0ee=_0x7c1811;_0x290fe6=0xc8;}else{_0x290fe6=0xce;}_0x2959f3['status'](_0x290fe6);return _0x2959f3[_0xedb6('0x1f')](_0xedb6('0x20'),_0xa18f3d+'-'+_0x13b0ee+'/'+_0x7c1811)[_0xedb6('0x1a')](_0x51dec4);}return null;};}function patchUpdates(_0x1f2b5d){return function(_0x462d88){try{jsonpatch[_0xedb6('0x21')](_0x462d88,_0x1f2b5d,!![]);}catch(_0xf92234){return BPromise[_0xedb6('0x22')](_0xf92234);}return _0x462d88['save']();};}function saveUpdates(_0x32f62c,_0x13589e){return function(_0x579a94){if(_0x579a94){return _0x579a94['update'](_0x32f62c)[_0xedb6('0x23')](function(_0x28dcbf){return _0x28dcbf;});}return null;};}function removeEntity(_0x541f87,_0x4a1858){return function(_0x3aade5){if(_0x3aade5){return _0x3aade5[_0xedb6('0x24')]()[_0xedb6('0x23')](function(){_0x541f87[_0xedb6('0x18')](0xcc)[_0xedb6('0x19')]();});}};}function handleEntityNotFound(_0x22fc33,_0x394891){return function(_0x77c875){if(!_0x77c875){_0x22fc33[_0xedb6('0x17')](0x194);}return _0x77c875;};}function handleError(_0x3ace14,_0xfea45c){_0xfea45c=_0xfea45c||0x1f4;return function(_0x4a2037){logger[_0xedb6('0x25')](_0x4a2037[_0xedb6('0x26')]);if(_0x4a2037['name']){delete _0x4a2037[_0xedb6('0x27')];}_0x3ace14[_0xedb6('0x18')](_0xfea45c)[_0xedb6('0x28')](_0x4a2037);};}exports[_0xedb6('0x29')]=function(_0x53e177,_0x568bd2){var _0x3e4250={},_0x5a9107={},_0x37a8fe={'count':0x0,'rows':[]};var _0x54d93e=_[_0xedb6('0x2a')](db[_0xedb6('0x2b')][_0xedb6('0x2c')],function(_0x351f25){return{'name':_0x351f25[_0xedb6('0x2d')],'type':_0x351f25[_0xedb6('0x2e')][_0xedb6('0x2f')]};});_0x5a9107['model']=_['map'](_0x54d93e,_0xedb6('0x27'));_0x5a9107[_0xedb6('0x30')]=_[_0xedb6('0x31')](_0x53e177[_0xedb6('0x30')]);_0x5a9107[_0xedb6('0x32')]=_['intersection'](_0x5a9107[_0xedb6('0x33')],_0x5a9107[_0xedb6('0x30')]);_0x3e4250[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x5a9107[_0xedb6('0x33')],qs['fields'](_0x53e177['query'][_0xedb6('0x36')]));_0x3e4250[_0xedb6('0x34')]=_0x3e4250[_0xedb6('0x34')][_0xedb6('0x37')]?_0x3e4250[_0xedb6('0x34')]:_0x5a9107[_0xedb6('0x33')];if(!_0x53e177[_0xedb6('0x30')]['hasOwnProperty'](_0xedb6('0x38'))){_0x3e4250[_0xedb6('0x1c')]=qs[_0xedb6('0x1c')](_0x53e177[_0xedb6('0x30')][_0xedb6('0x1c')]);_0x3e4250[_0xedb6('0x1b')]=qs[_0xedb6('0x1b')](_0x53e177[_0xedb6('0x30')]['offset']);}_0x3e4250['order']=qs[_0xedb6('0x39')](_0x53e177[_0xedb6('0x30')][_0xedb6('0x39')]);_0x3e4250[_0xedb6('0x3a')]=qs[_0xedb6('0x32')](_[_0xedb6('0x3b')](_0x53e177['query'],_0x5a9107[_0xedb6('0x32')]),_0x54d93e);if(_0x53e177['query'][_0xedb6('0x3c')]){_0x3e4250[_0xedb6('0x3a')]=_[_0xedb6('0x3d')](_0x3e4250[_0xedb6('0x3a')],{'$or':_['map'](_0x54d93e,function(_0x22af37){if(_0x22af37['type']!=='VIRTUAL'){var _0x5dc3e1={};_0x5dc3e1[_0x22af37[_0xedb6('0x27')]]={'$like':'%'+_0x53e177[_0xedb6('0x30')][_0xedb6('0x3c')]+'%'};return _0x5dc3e1;}})});}_0x3e4250=_['merge']({},_0x3e4250,_0x53e177['options']);var _0x3f7d50={'where':_0x3e4250[_0xedb6('0x3a')]};return db[_0xedb6('0x2b')][_0xedb6('0x1e')](_0x3f7d50)[_0xedb6('0x23')](function(_0x217f19){_0x37a8fe[_0xedb6('0x1e')]=_0x217f19;if(_0x53e177[_0xedb6('0x30')]['includeAll']){_0x3e4250['include']=[{'all':!![]}];}return db[_0xedb6('0x2b')][_0xedb6('0x3e')](_0x3e4250);})[_0xedb6('0x23')](function(_0x208de6){_0x37a8fe[_0xedb6('0x3f')]=_0x208de6;return _0x37a8fe;})[_0xedb6('0x23')](respondWithFilteredResult(_0x568bd2,_0x3e4250))[_0xedb6('0x40')](handleError(_0x568bd2,null));};exports['show']=function(_0x2a24e8,_0x9e9cde){var _0xd794ed={'raw':![],'where':{'id':_0x2a24e8['params']['id']}},_0x584484={};_0x584484[_0xedb6('0x33')]=_[_0xedb6('0x31')](db[_0xedb6('0x2b')][_0xedb6('0x2c')]);_0x584484[_0xedb6('0x30')]=_[_0xedb6('0x31')](_0x2a24e8[_0xedb6('0x30')]);_0x584484[_0xedb6('0x32')]=_[_0xedb6('0x35')](_0x584484[_0xedb6('0x33')],_0x584484[_0xedb6('0x30')]);_0xd794ed['attributes']=_[_0xedb6('0x35')](_0x584484[_0xedb6('0x33')],qs[_0xedb6('0x36')](_0x2a24e8[_0xedb6('0x30')][_0xedb6('0x36')]));_0xd794ed[_0xedb6('0x34')]=_0xd794ed[_0xedb6('0x34')][_0xedb6('0x37')]?_0xd794ed[_0xedb6('0x34')]:_0x584484['model'];if(_0x2a24e8[_0xedb6('0x30')][_0xedb6('0x41')]){_0xd794ed[_0xedb6('0x42')]=[{'all':!![]}];}_0xd794ed=_[_0xedb6('0x3d')]({},_0xd794ed,_0x2a24e8[_0xedb6('0x43')]);return db['DeskConfiguration'][_0xedb6('0x44')](_0xd794ed)[_0xedb6('0x23')](handleEntityNotFound(_0x9e9cde,null))[_0xedb6('0x23')](respondWithResult(_0x9e9cde,null))[_0xedb6('0x40')](handleError(_0x9e9cde,null));};exports[_0xedb6('0x45')]=function(_0x3f9421,_0x35312d){return db[_0xedb6('0x2b')][_0xedb6('0x45')](_0x3f9421['body'],{})['then'](respondWithResult(_0x35312d,0xc9))[_0xedb6('0x40')](handleError(_0x35312d,null));};exports[_0xedb6('0x46')]=function(_0x1317cc,_0x3da4db){if(_0x1317cc[_0xedb6('0x47')]['id']){delete _0x1317cc[_0xedb6('0x47')]['id'];}return db['DeskConfiguration'][_0xedb6('0x44')]({'where':{'id':_0x1317cc[_0xedb6('0x48')]['id']}})[_0xedb6('0x23')](handleEntityNotFound(_0x3da4db,null))['then'](saveUpdates(_0x1317cc['body'],null))[_0xedb6('0x23')](respondWithResult(_0x3da4db,null))[_0xedb6('0x40')](handleError(_0x3da4db,null));};exports[_0xedb6('0x24')]=function(_0x1e58dc,_0xa89ef8){return db[_0xedb6('0x2b')]['find']({'where':{'id':_0x1e58dc['params']['id']}})[_0xedb6('0x23')](handleEntityNotFound(_0xa89ef8,null))[_0xedb6('0x23')](removeEntity(_0xa89ef8,null))[_0xedb6('0x40')](handleError(_0xa89ef8,null));};exports['getFields']=function(_0x3c3671,_0x5d6ce4,_0x49f186){var _0x32472c={};var _0x473656={};var _0x47c3d2;var _0x3cbe9d;return db['DeskConfiguration'][_0xedb6('0x49')]({'where':{'id':_0x3c3671['params']['id']}})[_0xedb6('0x23')](handleEntityNotFound(_0x5d6ce4,null))[_0xedb6('0x23')](function(_0x75f053){if(_0x75f053){_0x47c3d2=_0x75f053;_0x473656[_0xedb6('0x33')]=_[_0xedb6('0x31')](db['DeskField'][_0xedb6('0x2c')]);_0x473656[_0xedb6('0x30')]=_[_0xedb6('0x31')](_0x3c3671[_0xedb6('0x30')]);_0x473656[_0xedb6('0x32')]=_['intersection'](_0x473656[_0xedb6('0x33')],_0x473656[_0xedb6('0x30')]);_0x32472c[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x473656[_0xedb6('0x33')],qs[_0xedb6('0x36')](_0x3c3671[_0xedb6('0x30')]['fields']));_0x32472c[_0xedb6('0x34')]=_0x32472c['attributes']['length']?_0x32472c['attributes']:_0x473656[_0xedb6('0x33')];_0x32472c[_0xedb6('0x4a')]=qs[_0xedb6('0x39')](_0x3c3671['query'][_0xedb6('0x39')]);_0x32472c[_0xedb6('0x3a')]=qs['filters'](_[_0xedb6('0x3b')](_0x3c3671[_0xedb6('0x30')],_0x473656[_0xedb6('0x32')]));if(_0x3c3671[_0xedb6('0x30')][_0xedb6('0x3c')]){_0x32472c['where']=_['merge'](_0x32472c[_0xedb6('0x3a')],{'$or':_['map'](_0x32472c[_0xedb6('0x34')],function(_0x3dbdc3){var _0x512db5={};_0x512db5[_0x3dbdc3]={'$like':'%'+_0x3c3671[_0xedb6('0x30')][_0xedb6('0x3c')]+'%'};return _0x512db5;})});}_0x32472c=_[_0xedb6('0x3d')]({},_0x32472c,_0x3c3671['options']);return _0x47c3d2[_0xedb6('0x4b')](_0x32472c);}})['then'](function(_0x4c516c){if(_0x4c516c){_0x3cbe9d=_0x4c516c[_0xedb6('0x37')];if(!_0x3c3671[_0xedb6('0x30')][_0xedb6('0x4c')](_0xedb6('0x38'))){_0x32472c[_0xedb6('0x1c')]=qs[_0xedb6('0x1c')](_0x3c3671[_0xedb6('0x30')][_0xedb6('0x1c')]);_0x32472c['offset']=qs[_0xedb6('0x1b')](_0x3c3671[_0xedb6('0x30')][_0xedb6('0x1b')]);}return _0x47c3d2[_0xedb6('0x4b')](_0x32472c);}})[_0xedb6('0x23')](function(_0x12536d){if(_0x12536d){return _0x12536d?{'count':_0x3cbe9d,'rows':_0x12536d}:null;}})[_0xedb6('0x23')](respondWithResult(_0x5d6ce4,null))[_0xedb6('0x40')](handleError(_0x5d6ce4,null));};exports[_0xedb6('0x4d')]=function(_0x3bf9c0,_0x2ce45e,_0x58aa5e){var _0x1972ef={};var _0x3834bc={};var _0x4a03ac;var _0x384e99;return db[_0xedb6('0x2b')][_0xedb6('0x49')]({'where':{'id':_0x3bf9c0['params']['id']}})['then'](handleEntityNotFound(_0x2ce45e,null))[_0xedb6('0x23')](function(_0x947e3d){if(_0x947e3d){_0x4a03ac=_0x947e3d;_0x3834bc[_0xedb6('0x33')]=_[_0xedb6('0x31')](db['DeskField']['rawAttributes']);_0x3834bc[_0xedb6('0x30')]=_['keys'](_0x3bf9c0[_0xedb6('0x30')]);_0x3834bc['filters']=_[_0xedb6('0x35')](_0x3834bc['model'],_0x3834bc[_0xedb6('0x30')]);_0x1972ef[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x3834bc[_0xedb6('0x33')],qs[_0xedb6('0x36')](_0x3bf9c0['query'][_0xedb6('0x36')]));_0x1972ef[_0xedb6('0x34')]=_0x1972ef[_0xedb6('0x34')][_0xedb6('0x37')]?_0x1972ef[_0xedb6('0x34')]:_0x3834bc[_0xedb6('0x33')];_0x1972ef[_0xedb6('0x4a')]=qs['sort'](_0x3bf9c0[_0xedb6('0x30')][_0xedb6('0x39')]);_0x1972ef['where']=qs[_0xedb6('0x32')](_[_0xedb6('0x3b')](_0x3bf9c0[_0xedb6('0x30')],_0x3834bc[_0xedb6('0x32')]));if(_0x3bf9c0[_0xedb6('0x30')][_0xedb6('0x3c')]){_0x1972ef['where']=_[_0xedb6('0x3d')](_0x1972ef[_0xedb6('0x3a')],{'$or':_[_0xedb6('0x2a')](_0x1972ef[_0xedb6('0x34')],function(_0x45e482){var _0x5d47eb={};_0x5d47eb[_0x45e482]={'$like':'%'+_0x3bf9c0[_0xedb6('0x30')][_0xedb6('0x3c')]+'%'};return _0x5d47eb;})});}_0x1972ef=_[_0xedb6('0x3d')]({},_0x1972ef,_0x3bf9c0['options']);return _0x4a03ac[_0xedb6('0x4d')](_0x1972ef);}})[_0xedb6('0x23')](function(_0x43f38a){if(_0x43f38a){_0x384e99=_0x43f38a[_0xedb6('0x37')];if(!_0x3bf9c0[_0xedb6('0x30')][_0xedb6('0x4c')](_0xedb6('0x38'))){_0x1972ef[_0xedb6('0x1c')]=qs[_0xedb6('0x1c')](_0x3bf9c0['query'][_0xedb6('0x1c')]);_0x1972ef[_0xedb6('0x1b')]=qs[_0xedb6('0x1b')](_0x3bf9c0[_0xedb6('0x30')][_0xedb6('0x1b')]);}return _0x4a03ac[_0xedb6('0x4d')](_0x1972ef);}})[_0xedb6('0x23')](function(_0x2ef21f){if(_0x2ef21f){return _0x2ef21f?{'count':_0x384e99,'rows':_0x2ef21f}:null;}})[_0xedb6('0x23')](respondWithResult(_0x2ce45e,null))['catch'](handleError(_0x2ce45e,null));};exports[_0xedb6('0x4e')]=function(_0x3241c6,_0x577556,_0x47864e){var _0x4569ce={};var _0x133b3d={};var _0x225488;var _0x4c11f0;return db[_0xedb6('0x2b')]['findOne']({'where':{'id':_0x3241c6[_0xedb6('0x48')]['id']}})[_0xedb6('0x23')](handleEntityNotFound(_0x577556,null))['then'](function(_0x14c09f){if(_0x14c09f){_0x225488=_0x14c09f;_0x133b3d[_0xedb6('0x33')]=_[_0xedb6('0x31')](db[_0xedb6('0x4f')][_0xedb6('0x2c')]);_0x133b3d['query']=_[_0xedb6('0x31')](_0x3241c6[_0xedb6('0x30')]);_0x133b3d[_0xedb6('0x32')]=_[_0xedb6('0x35')](_0x133b3d[_0xedb6('0x33')],_0x133b3d[_0xedb6('0x30')]);_0x4569ce[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x133b3d[_0xedb6('0x33')],qs['fields'](_0x3241c6[_0xedb6('0x30')][_0xedb6('0x36')]));_0x4569ce[_0xedb6('0x34')]=_0x4569ce[_0xedb6('0x34')][_0xedb6('0x37')]?_0x4569ce['attributes']:_0x133b3d[_0xedb6('0x33')];_0x4569ce[_0xedb6('0x4a')]=qs[_0xedb6('0x39')](_0x3241c6[_0xedb6('0x30')][_0xedb6('0x39')]);_0x4569ce[_0xedb6('0x3a')]=qs['filters'](_['pick'](_0x3241c6[_0xedb6('0x30')],_0x133b3d['filters']));if(_0x3241c6['query'][_0xedb6('0x3c')]){_0x4569ce['where']=_[_0xedb6('0x3d')](_0x4569ce[_0xedb6('0x3a')],{'$or':_[_0xedb6('0x2a')](_0x4569ce[_0xedb6('0x34')],function(_0x4b16a6){var _0x1bb5ca={};_0x1bb5ca[_0x4b16a6]={'$like':'%'+_0x3241c6[_0xedb6('0x30')][_0xedb6('0x3c')]+'%'};return _0x1bb5ca;})});}_0x4569ce=_[_0xedb6('0x3d')]({},_0x4569ce,_0x3241c6[_0xedb6('0x43')]);return _0x225488[_0xedb6('0x4e')](_0x4569ce);}})[_0xedb6('0x23')](function(_0x507784){if(_0x507784){_0x4c11f0=_0x507784[_0xedb6('0x37')];if(!_0x3241c6[_0xedb6('0x30')][_0xedb6('0x4c')](_0xedb6('0x38'))){_0x4569ce[_0xedb6('0x1c')]=qs[_0xedb6('0x1c')](_0x3241c6['query'][_0xedb6('0x1c')]);_0x4569ce['offset']=qs[_0xedb6('0x1b')](_0x3241c6[_0xedb6('0x30')][_0xedb6('0x1b')]);}return _0x225488[_0xedb6('0x4e')](_0x4569ce);}})[_0xedb6('0x23')](function(_0x9c1e82){if(_0x9c1e82){return _0x9c1e82?{'count':_0x4c11f0,'rows':_0x9c1e82}:null;}})['then'](respondWithResult(_0x577556,null))[_0xedb6('0x40')](handleError(_0x577556,null));};exports[_0xedb6('0x50')]=function(_0xe4755c,_0x5e900b,_0x3ac6ec){var _0x123098={};var _0x3a5a08={};var _0x4247ee;var _0xbac4ef;return db[_0xedb6('0x2b')][_0xedb6('0x49')]({'where':{'id':_0xe4755c[_0xedb6('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e900b,null))[_0xedb6('0x23')](function(_0x4d3124){if(_0x4d3124){_0x4247ee=_0x4d3124;_0x3a5a08['model']=_[_0xedb6('0x31')](db[_0xedb6('0x51')][_0xedb6('0x2c')]);_0x3a5a08['query']=_[_0xedb6('0x31')](_0xe4755c['query']);_0x3a5a08[_0xedb6('0x32')]=_[_0xedb6('0x35')](_0x3a5a08[_0xedb6('0x33')],_0x3a5a08[_0xedb6('0x30')]);_0x123098[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x3a5a08[_0xedb6('0x33')],qs['fields'](_0xe4755c[_0xedb6('0x30')][_0xedb6('0x36')]));_0x123098[_0xedb6('0x34')]=_0x123098[_0xedb6('0x34')][_0xedb6('0x37')]?_0x123098['attributes']:_0x3a5a08[_0xedb6('0x33')];_0x123098[_0xedb6('0x4a')]=qs[_0xedb6('0x39')](_0xe4755c['query'][_0xedb6('0x39')]);_0x123098[_0xedb6('0x3a')]=qs[_0xedb6('0x32')](_[_0xedb6('0x3b')](_0xe4755c['query'],_0x3a5a08[_0xedb6('0x32')]));if(_0xe4755c[_0xedb6('0x30')][_0xedb6('0x3c')]){_0x123098[_0xedb6('0x3a')]=_[_0xedb6('0x3d')](_0x123098[_0xedb6('0x3a')],{'$or':_[_0xedb6('0x2a')](_0x123098[_0xedb6('0x34')],function(_0x2ba86a){var _0x4572f5={};_0x4572f5[_0x2ba86a]={'$like':'%'+_0xe4755c[_0xedb6('0x30')][_0xedb6('0x3c')]+'%'};return _0x4572f5;})});}_0x123098=_['merge']({},_0x123098,_0xe4755c[_0xedb6('0x43')]);return _0x4247ee[_0xedb6('0x50')](_0x123098);}})[_0xedb6('0x23')](function(_0x41f8f1){if(_0x41f8f1){_0xbac4ef=_0x41f8f1['length'];if(!_0xe4755c['query'][_0xedb6('0x4c')](_0xedb6('0x38'))){_0x123098['limit']=qs['limit'](_0xe4755c[_0xedb6('0x30')][_0xedb6('0x1c')]);_0x123098[_0xedb6('0x1b')]=qs['offset'](_0xe4755c[_0xedb6('0x30')][_0xedb6('0x1b')]);}return _0x4247ee[_0xedb6('0x50')](_0x123098);}})[_0xedb6('0x23')](function(_0x21dfb2){if(_0x21dfb2){return _0x21dfb2?{'count':_0xbac4ef,'rows':_0x21dfb2}:null;}})['then'](respondWithResult(_0x5e900b,null))[_0xedb6('0x40')](handleError(_0x5e900b,null));};exports[_0xedb6('0x52')]=function(_0xb927fa,_0x3419d5,_0x142961){if(_0xb927fa[_0xedb6('0x47')]['id']){delete _0xb927fa[_0xedb6('0x47')]['id'];}return db[_0xedb6('0x2b')][_0xedb6('0x49')]({'where':{'id':_0xb927fa[_0xedb6('0x48')]['id']}})['then'](handleEntityNotFound(_0x3419d5,null))[_0xedb6('0x23')](function(_0x96927a){if(_0x96927a){return _0x96927a[_0xedb6('0x52')](_0xb927fa[_0xedb6('0x47')][_0xedb6('0x53')]||[]);}return null;})[_0xedb6('0x23')](respondWithResult(_0x3419d5,null))[_0xedb6('0x40')](handleError(_0x3419d5,null));}; \ No newline at end of file +var _0x50db=['findOne','DeskField','rawAttributes','sort','merge','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','catch','getFields'];(function(_0x15ff04,_0x4cda55){var _0x361c4e=function(_0x1990e8){while(--_0x1990e8){_0x15ff04['push'](_0x15ff04['shift']());}};_0x361c4e(++_0x4cda55);}(_0x50db,0x1aa));var _0xb50d=function(_0x1a77ee,_0x413fea){_0x1a77ee=_0x1a77ee-0x0;var _0x5587ee=_0x50db[_0x1a77ee];return _0x5587ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb50d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb50d('0x1'));var rp=require(_0xb50d('0x2'));var moment=require(_0xb50d('0x3'));var BPromise=require(_0xb50d('0x4'));var Mustache=require('mustache');var util=require(_0xb50d('0x5'));var path=require('path');var sox=require(_0xb50d('0x6'));var csv=require(_0xb50d('0x7'));var ejs=require(_0xb50d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb50d('0x9'));var crypto=require(_0xb50d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb50d('0xb'));var toCsv=require(_0xb50d('0x7'));var querystring=require(_0xb50d('0xc'));var Papa=require(_0xb50d('0xd'));var Redis=require(_0xb50d('0xe'));var authService=require(_0xb50d('0xf'));var qs=require(_0xb50d('0x10'));var as=require(_0xb50d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb50d('0x12'))(_0xb50d('0x13'));var utils=require('../../config/utils');var config=require(_0xb50d('0x14'));var licenseUtil=require(_0xb50d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ed0d8,_0x24693f){_0x24693f=_0x24693f||0xcc;return function(_0x36c5ad){if(_0x36c5ad){return _0x2ed0d8[_0xb50d('0x16')](_0x24693f);}return _0x2ed0d8[_0xb50d('0x17')](_0x24693f)[_0xb50d('0x18')]();};}function respondWithResult(_0x57ff3d,_0x444d5c){_0x444d5c=_0x444d5c||0xc8;return function(_0x525642){if(_0x525642){return _0x57ff3d[_0xb50d('0x17')](_0x444d5c)[_0xb50d('0x19')](_0x525642);}};}function respondWithFilteredResult(_0x55777b,_0x4b2c7a){return function(_0x34dbb3){if(_0x34dbb3){var _0x461a03=typeof _0x4b2c7a[_0xb50d('0x1a')]===_0xb50d('0x1b')&&typeof _0x4b2c7a[_0xb50d('0x1c')]==='undefined';var _0x32aebe=_0x34dbb3['count'];var _0x1555cd=_0x461a03?0x0:_0x4b2c7a['offset'];var _0x52aa65=_0x461a03?_0x34dbb3[_0xb50d('0x1d')]:_0x4b2c7a[_0xb50d('0x1a')]+_0x4b2c7a[_0xb50d('0x1c')];var _0x46868b;if(_0x52aa65>=_0x32aebe){_0x52aa65=_0x32aebe;_0x46868b=0xc8;}else{_0x46868b=0xce;}_0x55777b[_0xb50d('0x17')](_0x46868b);return _0x55777b[_0xb50d('0x1e')](_0xb50d('0x1f'),_0x1555cd+'-'+_0x52aa65+'/'+_0x32aebe)['json'](_0x34dbb3);}return null;};}function patchUpdates(_0x31385b){return function(_0x1352e1){try{jsonpatch[_0xb50d('0x20')](_0x1352e1,_0x31385b,!![]);}catch(_0x6ed94f){return BPromise['reject'](_0x6ed94f);}return _0x1352e1[_0xb50d('0x21')]();};}function saveUpdates(_0x5ca267,_0x5d8292){return function(_0x2f5a34){if(_0x2f5a34){return _0x2f5a34['update'](_0x5ca267)['then'](function(_0x4f313d){return _0x4f313d;});}return null;};}function removeEntity(_0x5c8381,_0xa8f97c){return function(_0x12f118){if(_0x12f118){return _0x12f118[_0xb50d('0x22')]()[_0xb50d('0x23')](function(){_0x5c8381[_0xb50d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e677b,_0x3d68dd){return function(_0x564f40){if(!_0x564f40){_0x1e677b[_0xb50d('0x16')](0x194);}return _0x564f40;};}function handleError(_0x149203,_0x54148d){_0x54148d=_0x54148d||0x1f4;return function(_0x8583c2){logger[_0xb50d('0x24')](_0x8583c2[_0xb50d('0x25')]);if(_0x8583c2[_0xb50d('0x26')]){delete _0x8583c2[_0xb50d('0x26')];}_0x149203[_0xb50d('0x17')](_0x54148d)['send'](_0x8583c2);};}exports[_0xb50d('0x27')]=function(_0x956617,_0x530132){var _0x34e65c={},_0x5df975={},_0x47e6ac={'count':0x0,'rows':[]};var _0x2106c8=_[_0xb50d('0x28')](db[_0xb50d('0x29')]['rawAttributes'],function(_0x40e630){return{'name':_0x40e630[_0xb50d('0x2a')],'type':_0x40e630[_0xb50d('0x2b')][_0xb50d('0x2c')]};});_0x5df975[_0xb50d('0x2d')]=_['map'](_0x2106c8,_0xb50d('0x26'));_0x5df975[_0xb50d('0x2e')]=_[_0xb50d('0x2f')](_0x956617[_0xb50d('0x2e')]);_0x5df975[_0xb50d('0x30')]=_['intersection'](_0x5df975[_0xb50d('0x2d')],_0x5df975[_0xb50d('0x2e')]);_0x34e65c[_0xb50d('0x31')]=_[_0xb50d('0x32')](_0x5df975['model'],qs['fields'](_0x956617[_0xb50d('0x2e')]['fields']));_0x34e65c[_0xb50d('0x31')]=_0x34e65c['attributes'][_0xb50d('0x33')]?_0x34e65c['attributes']:_0x5df975[_0xb50d('0x2d')];if(!_0x956617[_0xb50d('0x2e')][_0xb50d('0x34')](_0xb50d('0x35'))){_0x34e65c[_0xb50d('0x1c')]=qs[_0xb50d('0x1c')](_0x956617['query']['limit']);_0x34e65c[_0xb50d('0x1a')]=qs['offset'](_0x956617[_0xb50d('0x2e')][_0xb50d('0x1a')]);}_0x34e65c[_0xb50d('0x36')]=qs['sort'](_0x956617[_0xb50d('0x2e')]['sort']);_0x34e65c[_0xb50d('0x37')]=qs[_0xb50d('0x30')](_[_0xb50d('0x38')](_0x956617['query'],_0x5df975[_0xb50d('0x30')]),_0x2106c8);if(_0x956617['query'][_0xb50d('0x39')]){_0x34e65c[_0xb50d('0x37')]=_['merge'](_0x34e65c['where'],{'$or':_[_0xb50d('0x28')](_0x2106c8,function(_0x35c565){if(_0x35c565[_0xb50d('0x2b')]!==_0xb50d('0x3a')){var _0x3b626c={};_0x3b626c[_0x35c565[_0xb50d('0x26')]]={'$like':'%'+_0x956617['query']['filter']+'%'};return _0x3b626c;}})});}_0x34e65c=_['merge']({},_0x34e65c,_0x956617[_0xb50d('0x3b')]);var _0x4ebb4a={'where':_0x34e65c['where']};return db[_0xb50d('0x29')][_0xb50d('0x1d')](_0x4ebb4a)[_0xb50d('0x23')](function(_0x4b2277){_0x47e6ac[_0xb50d('0x1d')]=_0x4b2277;if(_0x956617['query'][_0xb50d('0x3c')]){_0x34e65c[_0xb50d('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xb50d('0x3e')](_0x34e65c);})[_0xb50d('0x23')](function(_0x250036){_0x47e6ac[_0xb50d('0x3f')]=_0x250036;return _0x47e6ac;})[_0xb50d('0x23')](respondWithFilteredResult(_0x530132,_0x34e65c))['catch'](handleError(_0x530132,null));};exports[_0xb50d('0x40')]=function(_0x1da594,_0x36cdf8){var _0x1c9b9b={'raw':![],'where':{'id':_0x1da594[_0xb50d('0x41')]['id']}},_0x127422={};_0x127422[_0xb50d('0x2d')]=_[_0xb50d('0x2f')](db[_0xb50d('0x29')]['rawAttributes']);_0x127422['query']=_['keys'](_0x1da594[_0xb50d('0x2e')]);_0x127422[_0xb50d('0x30')]=_['intersection'](_0x127422[_0xb50d('0x2d')],_0x127422['query']);_0x1c9b9b[_0xb50d('0x31')]=_['intersection'](_0x127422['model'],qs[_0xb50d('0x42')](_0x1da594[_0xb50d('0x2e')][_0xb50d('0x42')]));_0x1c9b9b[_0xb50d('0x31')]=_0x1c9b9b[_0xb50d('0x31')][_0xb50d('0x33')]?_0x1c9b9b[_0xb50d('0x31')]:_0x127422[_0xb50d('0x2d')];if(_0x1da594[_0xb50d('0x2e')][_0xb50d('0x3c')]){_0x1c9b9b['include']=[{'all':!![]}];}_0x1c9b9b=_['merge']({},_0x1c9b9b,_0x1da594['options']);return db[_0xb50d('0x29')][_0xb50d('0x43')](_0x1c9b9b)['then'](handleEntityNotFound(_0x36cdf8,null))[_0xb50d('0x23')](respondWithResult(_0x36cdf8,null))['catch'](handleError(_0x36cdf8,null));};exports[_0xb50d('0x44')]=function(_0x4c7161,_0xf69e94){return db['DeskConfiguration']['create'](_0x4c7161[_0xb50d('0x45')],{})['then'](respondWithResult(_0xf69e94,0xc9))['catch'](handleError(_0xf69e94,null));};exports['update']=function(_0x32c6f6,_0x59b0e5){if(_0x32c6f6[_0xb50d('0x45')]['id']){delete _0x32c6f6[_0xb50d('0x45')]['id'];}return db[_0xb50d('0x29')]['find']({'where':{'id':_0x32c6f6[_0xb50d('0x41')]['id']}})[_0xb50d('0x23')](handleEntityNotFound(_0x59b0e5,null))[_0xb50d('0x23')](saveUpdates(_0x32c6f6['body'],null))['then'](respondWithResult(_0x59b0e5,null))[_0xb50d('0x46')](handleError(_0x59b0e5,null));};exports['destroy']=function(_0x1f9654,_0x2c32f1){return db[_0xb50d('0x29')][_0xb50d('0x43')]({'where':{'id':_0x1f9654[_0xb50d('0x41')]['id']}})[_0xb50d('0x23')](handleEntityNotFound(_0x2c32f1,null))[_0xb50d('0x23')](removeEntity(_0x2c32f1,null))[_0xb50d('0x46')](handleError(_0x2c32f1,null));};exports[_0xb50d('0x47')]=function(_0x169019,_0x3c94a1,_0x37457a){var _0x2f697c={};var _0x55343a={};var _0x36d4ae;var _0xff580;return db[_0xb50d('0x29')][_0xb50d('0x48')]({'where':{'id':_0x169019[_0xb50d('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c94a1,null))[_0xb50d('0x23')](function(_0x200181){if(_0x200181){_0x36d4ae=_0x200181;_0x55343a[_0xb50d('0x2d')]=_[_0xb50d('0x2f')](db[_0xb50d('0x49')][_0xb50d('0x4a')]);_0x55343a['query']=_[_0xb50d('0x2f')](_0x169019[_0xb50d('0x2e')]);_0x55343a[_0xb50d('0x30')]=_[_0xb50d('0x32')](_0x55343a[_0xb50d('0x2d')],_0x55343a[_0xb50d('0x2e')]);_0x2f697c[_0xb50d('0x31')]=_['intersection'](_0x55343a[_0xb50d('0x2d')],qs['fields'](_0x169019['query']['fields']));_0x2f697c['attributes']=_0x2f697c[_0xb50d('0x31')]['length']?_0x2f697c[_0xb50d('0x31')]:_0x55343a[_0xb50d('0x2d')];_0x2f697c[_0xb50d('0x36')]=qs[_0xb50d('0x4b')](_0x169019[_0xb50d('0x2e')][_0xb50d('0x4b')]);_0x2f697c[_0xb50d('0x37')]=qs['filters'](_[_0xb50d('0x38')](_0x169019[_0xb50d('0x2e')],_0x55343a[_0xb50d('0x30')]));if(_0x169019[_0xb50d('0x2e')][_0xb50d('0x39')]){_0x2f697c['where']=_[_0xb50d('0x4c')](_0x2f697c['where'],{'$or':_[_0xb50d('0x28')](_0x2f697c['attributes'],function(_0x54f41f){var _0x5a2aa6={};_0x5a2aa6[_0x54f41f]={'$like':'%'+_0x169019[_0xb50d('0x2e')][_0xb50d('0x39')]+'%'};return _0x5a2aa6;})});}_0x2f697c=_['merge']({},_0x2f697c,_0x169019[_0xb50d('0x3b')]);return _0x36d4ae['getFields'](_0x2f697c);}})[_0xb50d('0x23')](function(_0x38d56d){if(_0x38d56d){_0xff580=_0x38d56d[_0xb50d('0x33')];if(!_0x169019['query'][_0xb50d('0x34')](_0xb50d('0x35'))){_0x2f697c[_0xb50d('0x1c')]=qs[_0xb50d('0x1c')](_0x169019[_0xb50d('0x2e')][_0xb50d('0x1c')]);_0x2f697c[_0xb50d('0x1a')]=qs[_0xb50d('0x1a')](_0x169019[_0xb50d('0x2e')][_0xb50d('0x1a')]);}return _0x36d4ae['getFields'](_0x2f697c);}})[_0xb50d('0x23')](function(_0x191c3d){if(_0x191c3d){return _0x191c3d?{'count':_0xff580,'rows':_0x191c3d}:null;}})[_0xb50d('0x23')](respondWithResult(_0x3c94a1,null))[_0xb50d('0x46')](handleError(_0x3c94a1,null));};exports[_0xb50d('0x4d')]=function(_0x367e36,_0x19698d,_0x5bd44e){var _0x20b347={};var _0x5d12f5={};var _0x3c44af;var _0x3bad8f;return db[_0xb50d('0x29')]['findOne']({'where':{'id':_0x367e36['params']['id']}})[_0xb50d('0x23')](handleEntityNotFound(_0x19698d,null))[_0xb50d('0x23')](function(_0xd66f12){if(_0xd66f12){_0x3c44af=_0xd66f12;_0x5d12f5['model']=_[_0xb50d('0x2f')](db[_0xb50d('0x49')][_0xb50d('0x4a')]);_0x5d12f5[_0xb50d('0x2e')]=_[_0xb50d('0x2f')](_0x367e36[_0xb50d('0x2e')]);_0x5d12f5[_0xb50d('0x30')]=_[_0xb50d('0x32')](_0x5d12f5[_0xb50d('0x2d')],_0x5d12f5[_0xb50d('0x2e')]);_0x20b347[_0xb50d('0x31')]=_[_0xb50d('0x32')](_0x5d12f5[_0xb50d('0x2d')],qs[_0xb50d('0x42')](_0x367e36[_0xb50d('0x2e')][_0xb50d('0x42')]));_0x20b347[_0xb50d('0x31')]=_0x20b347[_0xb50d('0x31')][_0xb50d('0x33')]?_0x20b347[_0xb50d('0x31')]:_0x5d12f5[_0xb50d('0x2d')];_0x20b347[_0xb50d('0x36')]=qs[_0xb50d('0x4b')](_0x367e36[_0xb50d('0x2e')][_0xb50d('0x4b')]);_0x20b347['where']=qs[_0xb50d('0x30')](_[_0xb50d('0x38')](_0x367e36[_0xb50d('0x2e')],_0x5d12f5[_0xb50d('0x30')]));if(_0x367e36[_0xb50d('0x2e')]['filter']){_0x20b347[_0xb50d('0x37')]=_[_0xb50d('0x4c')](_0x20b347[_0xb50d('0x37')],{'$or':_[_0xb50d('0x28')](_0x20b347[_0xb50d('0x31')],function(_0x33e2ea){var _0x5c5fb9={};_0x5c5fb9[_0x33e2ea]={'$like':'%'+_0x367e36[_0xb50d('0x2e')][_0xb50d('0x39')]+'%'};return _0x5c5fb9;})});}_0x20b347=_['merge']({},_0x20b347,_0x367e36[_0xb50d('0x3b')]);return _0x3c44af['getSubjects'](_0x20b347);}})[_0xb50d('0x23')](function(_0x2b072b){if(_0x2b072b){_0x3bad8f=_0x2b072b[_0xb50d('0x33')];if(!_0x367e36[_0xb50d('0x2e')][_0xb50d('0x34')](_0xb50d('0x35'))){_0x20b347[_0xb50d('0x1c')]=qs[_0xb50d('0x1c')](_0x367e36[_0xb50d('0x2e')][_0xb50d('0x1c')]);_0x20b347[_0xb50d('0x1a')]=qs[_0xb50d('0x1a')](_0x367e36[_0xb50d('0x2e')][_0xb50d('0x1a')]);}return _0x3c44af['getSubjects'](_0x20b347);}})['then'](function(_0x4fb841){if(_0x4fb841){return _0x4fb841?{'count':_0x3bad8f,'rows':_0x4fb841}:null;}})[_0xb50d('0x23')](respondWithResult(_0x19698d,null))[_0xb50d('0x46')](handleError(_0x19698d,null));};exports[_0xb50d('0x4e')]=function(_0xebcffb,_0x4015ca,_0x539652){var _0x3c563c={};var _0x2c7973={};var _0xc6b5d3;var _0x2e35fa;return db['DeskConfiguration'][_0xb50d('0x48')]({'where':{'id':_0xebcffb[_0xb50d('0x41')]['id']}})[_0xb50d('0x23')](handleEntityNotFound(_0x4015ca,null))[_0xb50d('0x23')](function(_0x552e72){if(_0x552e72){_0xc6b5d3=_0x552e72;_0x2c7973['model']=_[_0xb50d('0x2f')](db[_0xb50d('0x49')]['rawAttributes']);_0x2c7973[_0xb50d('0x2e')]=_[_0xb50d('0x2f')](_0xebcffb['query']);_0x2c7973[_0xb50d('0x30')]=_['intersection'](_0x2c7973[_0xb50d('0x2d')],_0x2c7973['query']);_0x3c563c[_0xb50d('0x31')]=_[_0xb50d('0x32')](_0x2c7973[_0xb50d('0x2d')],qs[_0xb50d('0x42')](_0xebcffb['query'][_0xb50d('0x42')]));_0x3c563c[_0xb50d('0x31')]=_0x3c563c[_0xb50d('0x31')][_0xb50d('0x33')]?_0x3c563c[_0xb50d('0x31')]:_0x2c7973['model'];_0x3c563c[_0xb50d('0x36')]=qs['sort'](_0xebcffb[_0xb50d('0x2e')][_0xb50d('0x4b')]);_0x3c563c[_0xb50d('0x37')]=qs[_0xb50d('0x30')](_['pick'](_0xebcffb[_0xb50d('0x2e')],_0x2c7973['filters']));if(_0xebcffb[_0xb50d('0x2e')][_0xb50d('0x39')]){_0x3c563c[_0xb50d('0x37')]=_[_0xb50d('0x4c')](_0x3c563c[_0xb50d('0x37')],{'$or':_[_0xb50d('0x28')](_0x3c563c['attributes'],function(_0x47441c){var _0x4c68bb={};_0x4c68bb[_0x47441c]={'$like':'%'+_0xebcffb[_0xb50d('0x2e')][_0xb50d('0x39')]+'%'};return _0x4c68bb;})});}_0x3c563c=_[_0xb50d('0x4c')]({},_0x3c563c,_0xebcffb[_0xb50d('0x3b')]);return _0xc6b5d3[_0xb50d('0x4e')](_0x3c563c);}})[_0xb50d('0x23')](function(_0x3a5ddb){if(_0x3a5ddb){_0x2e35fa=_0x3a5ddb[_0xb50d('0x33')];if(!_0xebcffb['query'][_0xb50d('0x34')]('nolimit')){_0x3c563c[_0xb50d('0x1c')]=qs['limit'](_0xebcffb['query'][_0xb50d('0x1c')]);_0x3c563c[_0xb50d('0x1a')]=qs['offset'](_0xebcffb[_0xb50d('0x2e')][_0xb50d('0x1a')]);}return _0xc6b5d3[_0xb50d('0x4e')](_0x3c563c);}})[_0xb50d('0x23')](function(_0x24b179){if(_0x24b179){return _0x24b179?{'count':_0x2e35fa,'rows':_0x24b179}:null;}})[_0xb50d('0x23')](respondWithResult(_0x4015ca,null))[_0xb50d('0x46')](handleError(_0x4015ca,null));};exports[_0xb50d('0x4f')]=function(_0xe0e19a,_0x541edb,_0x4c2d1c){var _0x421cf9={};var _0x33f08c={};var _0x32e362;var _0x21e05d;return db['DeskConfiguration'][_0xb50d('0x48')]({'where':{'id':_0xe0e19a['params']['id']}})['then'](handleEntityNotFound(_0x541edb,null))[_0xb50d('0x23')](function(_0x7633e1){if(_0x7633e1){_0x32e362=_0x7633e1;_0x33f08c[_0xb50d('0x2d')]=_[_0xb50d('0x2f')](db[_0xb50d('0x50')][_0xb50d('0x4a')]);_0x33f08c[_0xb50d('0x2e')]=_[_0xb50d('0x2f')](_0xe0e19a[_0xb50d('0x2e')]);_0x33f08c[_0xb50d('0x30')]=_[_0xb50d('0x32')](_0x33f08c[_0xb50d('0x2d')],_0x33f08c['query']);_0x421cf9[_0xb50d('0x31')]=_[_0xb50d('0x32')](_0x33f08c[_0xb50d('0x2d')],qs[_0xb50d('0x42')](_0xe0e19a[_0xb50d('0x2e')][_0xb50d('0x42')]));_0x421cf9[_0xb50d('0x31')]=_0x421cf9[_0xb50d('0x31')]['length']?_0x421cf9[_0xb50d('0x31')]:_0x33f08c[_0xb50d('0x2d')];_0x421cf9['order']=qs[_0xb50d('0x4b')](_0xe0e19a[_0xb50d('0x2e')]['sort']);_0x421cf9[_0xb50d('0x37')]=qs[_0xb50d('0x30')](_['pick'](_0xe0e19a[_0xb50d('0x2e')],_0x33f08c['filters']));if(_0xe0e19a[_0xb50d('0x2e')]['filter']){_0x421cf9['where']=_['merge'](_0x421cf9[_0xb50d('0x37')],{'$or':_[_0xb50d('0x28')](_0x421cf9[_0xb50d('0x31')],function(_0x45a566){var _0x1bc537={};_0x1bc537[_0x45a566]={'$like':'%'+_0xe0e19a[_0xb50d('0x2e')][_0xb50d('0x39')]+'%'};return _0x1bc537;})});}_0x421cf9=_[_0xb50d('0x4c')]({},_0x421cf9,_0xe0e19a['options']);return _0x32e362[_0xb50d('0x4f')](_0x421cf9);}})[_0xb50d('0x23')](function(_0x41d4ff){if(_0x41d4ff){_0x21e05d=_0x41d4ff[_0xb50d('0x33')];if(!_0xe0e19a['query'][_0xb50d('0x34')]('nolimit')){_0x421cf9['limit']=qs[_0xb50d('0x1c')](_0xe0e19a[_0xb50d('0x2e')]['limit']);_0x421cf9[_0xb50d('0x1a')]=qs[_0xb50d('0x1a')](_0xe0e19a['query'][_0xb50d('0x1a')]);}return _0x32e362[_0xb50d('0x4f')](_0x421cf9);}})[_0xb50d('0x23')](function(_0x551b83){if(_0x551b83){return _0x551b83?{'count':_0x21e05d,'rows':_0x551b83}:null;}})[_0xb50d('0x23')](respondWithResult(_0x541edb,null))[_0xb50d('0x46')](handleError(_0x541edb,null));};exports[_0xb50d('0x51')]=function(_0x215062,_0xcd5576,_0x2e203f){if(_0x215062[_0xb50d('0x45')]['id']){delete _0x215062['body']['id'];}return db['DeskConfiguration'][_0xb50d('0x48')]({'where':{'id':_0x215062['params']['id']}})[_0xb50d('0x23')](handleEntityNotFound(_0xcd5576,null))['then'](function(_0x35f4ef){if(_0x35f4ef){return _0x35f4ef[_0xb50d('0x51')](_0x215062[_0xb50d('0x45')][_0xb50d('0x52')]||[]);}return null;})['then'](respondWithResult(_0xcd5576,null))[_0xb50d('0x46')](handleError(_0xcd5576,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9e77002..6c19cd5 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 _0xdcb9=['../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','../../config/logger','api','bluebird'];(function(_0x427cec,_0x58dc37){var _0x4779f6=function(_0x1cb10e){while(--_0x1cb10e){_0x427cec['push'](_0x427cec['shift']());}};_0x4779f6(++_0x58dc37);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x1eca9e,_0x409cf9){_0x1eca9e=_0x1eca9e-0x0;var _0x12a59f=_0xdcb9[_0x1eca9e];return _0x12a59f;};'use strict';var _=require(_0x9dcb('0x0'));var util=require('util');var logger=require(_0x9dcb('0x1'))(_0x9dcb('0x2'));var moment=require('moment');var BPromise=require(_0x9dcb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9dcb('0x4'));var attributes=require(_0x9dcb('0x5'));module[_0x9dcb('0x6')]=function(_0x15ee97,_0x4f9b4c){return _0x15ee97[_0x9dcb('0x7')]('DeskConfiguration',attributes,{'tableName':_0x9dcb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x175e=['moment','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0x175e,0xe6));var _0xe175=function(_0x65f1d4,_0x531efc){_0x65f1d4=_0x65f1d4-0x0;var _0x2cce9b=_0x175e[_0x65f1d4];return _0x2cce9b;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var logger=require(_0xe175('0x2'))(_0xe175('0x3'));var moment=require(_0xe175('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe175('0x5'));var rimraf=require(_0xe175('0x6'));var config=require(_0xe175('0x7'));var attributes=require(_0xe175('0x8'));module[_0xe175('0x9')]=function(_0x278a8d,_0x7eba){return _0x278a8d[_0xe175('0xa')](_0xe175('0xb'),attributes,{'tableName':_0xe175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 62287ec..4d02484 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 _0x672d=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x216a8d,_0x5473bb){var _0xb21f7b=function(_0x3cf6e9){while(--_0x3cf6e9){_0x216a8d['push'](_0x216a8d['shift']());}};_0xb21f7b(++_0x5473bb);}(_0x672d,0x181));var _0xd672=function(_0x49c04b,_0x1f79ea){_0x49c04b=_0x49c04b-0x0;var _0x425816=_0x672d[_0x49c04b];return _0x425816;};'use strict';var _=require(_0xd672('0x0'));var util=require('util');var moment=require(_0xd672('0x1'));var BPromise=require(_0xd672('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd672('0x3'));var logger=require(_0xd672('0x4'))('rpc');var config=require(_0xd672('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd672('0x6')][_0xd672('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x276ecb,_0x1dab08,_0x189274){return new BPromise(function(_0x2a5267,_0x4da6f7){return client[_0xd672('0x8')](_0x276ecb,_0x189274)[_0xd672('0x9')](function(_0x44a188){logger[_0xd672('0xa')](_0xd672('0xb'),_0x1dab08,_0xd672('0xc'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1dab08,_0xd672('0xc'),JSON[_0xd672('0xd')](_0x44a188));if(_0x44a188[_0xd672('0xe')]){if(_0x44a188[_0xd672('0xe')][_0xd672('0xf')]===0x1f4){logger['error'](_0xd672('0xb'),_0x1dab08,_0x44a188['error'][_0xd672('0x10')]);return _0x4da6f7(_0x44a188[_0xd672('0xe')][_0xd672('0x10')]);}logger['error'](_0xd672('0xb'),_0x1dab08,_0x44a188[_0xd672('0xe')][_0xd672('0x10')]);return _0x2a5267(_0x44a188[_0xd672('0xe')][_0xd672('0x10')]);}else{logger[_0xd672('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x1dab08,_0xd672('0xc'));_0x2a5267(_0x44a188[_0xd672('0x11')][_0xd672('0x10')]);}})['catch'](function(_0x1c5ba1){logger[_0xd672('0xe')](_0xd672('0xb'),_0x1dab08,_0x1c5ba1);_0x4da6f7(_0x1c5ba1);});});} \ No newline at end of file +var _0x11c8=['jayson/promise','client','request\x20sent','debug','stringify','error','code','message','info','DeskConfiguration,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x11c8,0x19a));var _0x811c=function(_0x332ef9,_0x387cb2){_0x332ef9=_0x332ef9-0x0;var _0x64da7d=_0x11c8[_0x332ef9];return _0x64da7d;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0555dc7..9413f78 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 _0xbb8b=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put','update'];(function(_0x25762c,_0x2709df){var _0x2f77a8=function(_0x9f133f){while(--_0x9f133f){_0x25762c['push'](_0x25762c['shift']());}};_0x2f77a8(++_0x2709df);}(_0xbb8b,0x101));var _0xbbb8=function(_0x2b7db8,_0x43ce90){_0x2b7db8=_0x2b7db8-0x0;var _0x3ccdb3=_0xbb8b[_0x2b7db8];return _0x3ccdb3;};'use strict';var multer=require(_0xbbb8('0x0'));var util=require(_0xbbb8('0x1'));var path=require(_0xbbb8('0x2'));var timeout=require(_0xbbb8('0x3'));var express=require('express');var router=express[_0xbbb8('0x4')]();var fs_extra=require(_0xbbb8('0x5'));var auth=require(_0xbbb8('0x6'));var interaction=require(_0xbbb8('0x7'));var config=require(_0xbbb8('0x8'));var controller=require('./intDeskField.controller');router[_0xbbb8('0x9')]('/',auth[_0xbbb8('0xa')](),controller['index']);router[_0xbbb8('0x9')](_0xbbb8('0xb'),auth[_0xbbb8('0xa')](),controller[_0xbbb8('0xc')]);router['post']('/',auth[_0xbbb8('0xa')](),controller['create']);router[_0xbbb8('0xd')]('/:id',auth[_0xbbb8('0xa')](),controller[_0xbbb8('0xe')]);router['delete'](_0xbbb8('0xb'),auth[_0xbbb8('0xa')](),controller[_0xbbb8('0xf')]);module[_0xbbb8('0x10')]=router; \ No newline at end of file +var _0x3c8e=['./intDeskField.controller','get','index','/:id','isAuthenticated','show','put','update','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x44895b,_0x12754b){var _0x5f1d0c=function(_0x2c58e0){while(--_0x2c58e0){_0x44895b['push'](_0x44895b['shift']());}};_0x5f1d0c(++_0x12754b);}(_0x3c8e,0x89));var _0xe3c8=function(_0x231b85,_0x36a384){_0x231b85=_0x231b85-0x0;var _0x27d27f=_0x3c8e[_0x231b85];return _0x27d27f;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var fs_extra=require(_0xe3c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe3c8('0x5'));var config=require(_0xe3c8('0x6'));var controller=require(_0xe3c8('0x7'));router[_0xe3c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3c8('0x9')]);router[_0xe3c8('0x8')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xc')]);router['post']('/',auth[_0xe3c8('0xb')](),controller['create']);router[_0xe3c8('0xd')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xe')]);router['delete'](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2ee66ed..b2c8e03 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 _0x1cd8=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x11c22a,_0x5db920){var _0x3c74e6=function(_0x4648be){while(--_0x4648be){_0x11c22a['push'](_0x11c22a['shift']());}};_0x3c74e6(++_0x5db920);}(_0x1cd8,0xda));var _0x81cd=function(_0x8a850b,_0x5158f5){_0x8a850b=_0x8a850b-0x0;var _0x1c5abd=_0x1cd8[_0x8a850b];return _0x1c5abd;};'use strict';var Sequelize=require('sequelize');module[_0x81cd('0x0')]={'type':{'type':Sequelize[_0x81cd('0x1')](_0x81cd('0x2'),_0x81cd('0x3'),_0x81cd('0x4'),_0x81cd('0x5'),_0x81cd('0x6')),'defaultValue':_0x81cd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x81cd('0x1')](_0x81cd('0x2'),_0x81cd('0x3'),_0x81cd('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x81cd('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x81cd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81cd('0x7')]}}; \ No newline at end of file +var _0xee3d=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x300a4d,_0x30dd6f){var _0x291ef5=function(_0x287fcf){while(--_0x287fcf){_0x300a4d['push'](_0x300a4d['shift']());}};_0x291ef5(++_0x30dd6f);}(_0xee3d,0x1e0));var _0xdee3=function(_0x24ff00,_0x566433){_0x24ff00=_0x24ff00-0x0;var _0x114f93=_0xee3d[_0x24ff00];return _0x114f93;};'use strict';var Sequelize=require(_0xdee3('0x0'));module[_0xdee3('0x1')]={'type':{'type':Sequelize[_0xdee3('0x2')]('string',_0xdee3('0x3'),_0xdee3('0x4'),_0xdee3('0x5'),_0xdee3('0x6')),'defaultValue':_0xdee3('0x7')},'content':{'type':Sequelize[_0xdee3('0x8')]},'key':{'type':Sequelize[_0xdee3('0x8')]},'keyType':{'type':Sequelize[_0xdee3('0x2')](_0xdee3('0x7'),_0xdee3('0x3'),_0xdee3('0x4'))},'keyContent':{'type':Sequelize[_0xdee3('0x8')]},'idField':{'type':Sequelize[_0xdee3('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdee3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdee3('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 9360667..c40ffaa 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 _0x6b4c=['squel','crypto','jsforce','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','status','end','json','offset','limit','undefined','count','set','reject','save','destroy','sendStatus','name','send','index','map','DeskField','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','then','includeAll','include','rows','catch','show','keys','rawAttributes','length','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash'];(function(_0x2df2ac,_0x3b2f7d){var _0x2442f5=function(_0x5f4f6b){while(--_0x5f4f6b){_0x2df2ac['push'](_0x2df2ac['shift']());}};_0x2442f5(++_0x3b2f7d);}(_0x6b4c,0x8c));var _0xc6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc6b4('0x0'));var rimraf=require(_0xc6b4('0x1'));var zipdir=require(_0xc6b4('0x2'));var jsonpatch=require(_0xc6b4('0x3'));var rp=require(_0xc6b4('0x4'));var moment=require(_0xc6b4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc6b4('0x6'));var path=require(_0xc6b4('0x7'));var sox=require(_0xc6b4('0x8'));var csv=require('to-csv');var ejs=require(_0xc6b4('0x9'));var fs=require('fs');var fs_extra=require(_0xc6b4('0xa'));var _=require(_0xc6b4('0xb'));var squel=require(_0xc6b4('0xc'));var crypto=require(_0xc6b4('0xd'));var jsforce=require(_0xc6b4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc6b4('0xf'));var querystring=require(_0xc6b4('0x10'));var Papa=require(_0xc6b4('0x11'));var Redis=require(_0xc6b4('0x12'));var authService=require(_0xc6b4('0x13'));var qs=require(_0xc6b4('0x14'));var as=require(_0xc6b4('0x15'));var hardwareService=require(_0xc6b4('0x16'));var logger=require(_0xc6b4('0x17'))(_0xc6b4('0x18'));var utils=require('../../config/utils');var config=require(_0xc6b4('0x19'));var licenseUtil=require(_0xc6b4('0x1a'));var db=require(_0xc6b4('0x1b'))['db'];function respondWithStatusCode(_0x37a6fe,_0x3e9bdd){_0x3e9bdd=_0x3e9bdd||0xcc;return function(_0xc50e17){if(_0xc50e17){return _0x37a6fe['sendStatus'](_0x3e9bdd);}return _0x37a6fe[_0xc6b4('0x1c')](_0x3e9bdd)[_0xc6b4('0x1d')]();};}function respondWithResult(_0x106481,_0x178115){_0x178115=_0x178115||0xc8;return function(_0x3a34a8){if(_0x3a34a8){return _0x106481[_0xc6b4('0x1c')](_0x178115)[_0xc6b4('0x1e')](_0x3a34a8);}};}function respondWithFilteredResult(_0x4c9e58,_0x82a2ae){return function(_0x473f2d){if(_0x473f2d){var _0x60b8ef=typeof _0x82a2ae[_0xc6b4('0x1f')]==='undefined'&&typeof _0x82a2ae[_0xc6b4('0x20')]===_0xc6b4('0x21');var _0x369cbd=_0x473f2d[_0xc6b4('0x22')];var _0x167bb4=_0x60b8ef?0x0:_0x82a2ae[_0xc6b4('0x1f')];var _0x50b8f0=_0x60b8ef?_0x473f2d[_0xc6b4('0x22')]:_0x82a2ae['offset']+_0x82a2ae['limit'];var _0x2d5c21;if(_0x50b8f0>=_0x369cbd){_0x50b8f0=_0x369cbd;_0x2d5c21=0xc8;}else{_0x2d5c21=0xce;}_0x4c9e58[_0xc6b4('0x1c')](_0x2d5c21);return _0x4c9e58[_0xc6b4('0x23')]('Content-Range',_0x167bb4+'-'+_0x50b8f0+'/'+_0x369cbd)['json'](_0x473f2d);}return null;};}function patchUpdates(_0x164d34){return function(_0x4eff46){try{jsonpatch['apply'](_0x4eff46,_0x164d34,!![]);}catch(_0x29cb78){return BPromise[_0xc6b4('0x24')](_0x29cb78);}return _0x4eff46[_0xc6b4('0x25')]();};}function saveUpdates(_0x17291d,_0x43e70e){return function(_0x1e7007){if(_0x1e7007){return _0x1e7007['update'](_0x17291d)['then'](function(_0x281516){return _0x281516;});}return null;};}function removeEntity(_0x470549,_0x58272f){return function(_0x454e5b){if(_0x454e5b){return _0x454e5b[_0xc6b4('0x26')]()['then'](function(){_0x470549[_0xc6b4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e5b7,_0x2bb5d1){return function(_0x55ef13){if(!_0x55ef13){_0x25e5b7[_0xc6b4('0x27')](0x194);}return _0x55ef13;};}function handleError(_0x373171,_0x5a0d36){_0x5a0d36=_0x5a0d36||0x1f4;return function(_0x4eb951){logger['error'](_0x4eb951['stack']);if(_0x4eb951[_0xc6b4('0x28')]){delete _0x4eb951[_0xc6b4('0x28')];}_0x373171[_0xc6b4('0x1c')](_0x5a0d36)[_0xc6b4('0x29')](_0x4eb951);};}exports[_0xc6b4('0x2a')]=function(_0x4c9569,_0x4719c7){var _0x5799e0={},_0x182ae4={},_0x56d4d4={'count':0x0,'rows':[]};var _0x427b07=_[_0xc6b4('0x2b')](db[_0xc6b4('0x2c')]['rawAttributes'],function(_0x3d2521){return{'name':_0x3d2521[_0xc6b4('0x2d')],'type':_0x3d2521[_0xc6b4('0x2e')]['key']};});_0x182ae4[_0xc6b4('0x2f')]=_[_0xc6b4('0x2b')](_0x427b07,'name');_0x182ae4['query']=_['keys'](_0x4c9569[_0xc6b4('0x30')]);_0x182ae4[_0xc6b4('0x31')]=_[_0xc6b4('0x32')](_0x182ae4[_0xc6b4('0x2f')],_0x182ae4[_0xc6b4('0x30')]);_0x5799e0[_0xc6b4('0x33')]=_['intersection'](_0x182ae4['model'],qs['fields'](_0x4c9569[_0xc6b4('0x30')][_0xc6b4('0x34')]));_0x5799e0[_0xc6b4('0x33')]=_0x5799e0[_0xc6b4('0x33')]['length']?_0x5799e0[_0xc6b4('0x33')]:_0x182ae4['model'];if(!_0x4c9569['query'][_0xc6b4('0x35')](_0xc6b4('0x36'))){_0x5799e0[_0xc6b4('0x20')]=qs[_0xc6b4('0x20')](_0x4c9569[_0xc6b4('0x30')][_0xc6b4('0x20')]);_0x5799e0[_0xc6b4('0x1f')]=qs[_0xc6b4('0x1f')](_0x4c9569['query'][_0xc6b4('0x1f')]);}_0x5799e0[_0xc6b4('0x37')]=qs[_0xc6b4('0x38')](_0x4c9569['query']['sort']);_0x5799e0['where']=qs['filters'](_[_0xc6b4('0x39')](_0x4c9569[_0xc6b4('0x30')],_0x182ae4[_0xc6b4('0x31')]),_0x427b07);if(_0x4c9569[_0xc6b4('0x30')][_0xc6b4('0x3a')]){_0x5799e0['where']=_[_0xc6b4('0x3b')](_0x5799e0[_0xc6b4('0x3c')],{'$or':_[_0xc6b4('0x2b')](_0x427b07,function(_0xf7d992){if(_0xf7d992['type']!==_0xc6b4('0x3d')){var _0x416ff9={};_0x416ff9[_0xf7d992[_0xc6b4('0x28')]]={'$like':'%'+_0x4c9569[_0xc6b4('0x30')][_0xc6b4('0x3a')]+'%'};return _0x416ff9;}})});}_0x5799e0=_[_0xc6b4('0x3b')]({},_0x5799e0,_0x4c9569['options']);var _0x4749d2={'where':_0x5799e0[_0xc6b4('0x3c')]};return db[_0xc6b4('0x2c')][_0xc6b4('0x22')](_0x4749d2)[_0xc6b4('0x3e')](function(_0x5f04b5){_0x56d4d4[_0xc6b4('0x22')]=_0x5f04b5;if(_0x4c9569[_0xc6b4('0x30')][_0xc6b4('0x3f')]){_0x5799e0[_0xc6b4('0x40')]=[{'all':!![]}];}return db[_0xc6b4('0x2c')]['findAll'](_0x5799e0);})[_0xc6b4('0x3e')](function(_0x420821){_0x56d4d4[_0xc6b4('0x41')]=_0x420821;return _0x56d4d4;})[_0xc6b4('0x3e')](respondWithFilteredResult(_0x4719c7,_0x5799e0))[_0xc6b4('0x42')](handleError(_0x4719c7,null));};exports[_0xc6b4('0x43')]=function(_0x22b951,_0x1b3731){var _0x3468e2={'raw':!![],'where':{'id':_0x22b951['params']['id']}},_0x234d91={};_0x234d91['model']=_[_0xc6b4('0x44')](db[_0xc6b4('0x2c')][_0xc6b4('0x45')]);_0x234d91[_0xc6b4('0x30')]=_[_0xc6b4('0x44')](_0x22b951['query']);_0x234d91['filters']=_[_0xc6b4('0x32')](_0x234d91['model'],_0x234d91[_0xc6b4('0x30')]);_0x3468e2[_0xc6b4('0x33')]=_[_0xc6b4('0x32')](_0x234d91['model'],qs[_0xc6b4('0x34')](_0x22b951['query'][_0xc6b4('0x34')]));_0x3468e2['attributes']=_0x3468e2[_0xc6b4('0x33')][_0xc6b4('0x46')]?_0x3468e2['attributes']:_0x234d91[_0xc6b4('0x2f')];if(_0x22b951[_0xc6b4('0x30')]['includeAll']){_0x3468e2[_0xc6b4('0x40')]=[{'all':!![]}];}_0x3468e2=_[_0xc6b4('0x3b')]({},_0x3468e2,_0x22b951[_0xc6b4('0x47')]);return db[_0xc6b4('0x2c')]['find'](_0x3468e2)[_0xc6b4('0x3e')](handleEntityNotFound(_0x1b3731,null))[_0xc6b4('0x3e')](respondWithResult(_0x1b3731,null))[_0xc6b4('0x42')](handleError(_0x1b3731,null));};exports['create']=function(_0x29688b,_0x418a07){return db[_0xc6b4('0x2c')][_0xc6b4('0x48')](_0x29688b['body'],{})[_0xc6b4('0x3e')](respondWithResult(_0x418a07,0xc9))[_0xc6b4('0x42')](handleError(_0x418a07,null));};exports['update']=function(_0x36592c,_0xe775fa){if(_0x36592c[_0xc6b4('0x49')]['id']){delete _0x36592c[_0xc6b4('0x49')]['id'];}return db[_0xc6b4('0x2c')][_0xc6b4('0x4a')]({'where':{'id':_0x36592c[_0xc6b4('0x4b')]['id']}})[_0xc6b4('0x3e')](handleEntityNotFound(_0xe775fa,null))[_0xc6b4('0x3e')](saveUpdates(_0x36592c['body'],null))[_0xc6b4('0x3e')](respondWithResult(_0xe775fa,null))[_0xc6b4('0x42')](handleError(_0xe775fa,null));};exports[_0xc6b4('0x26')]=function(_0x386622,_0x5a745e){return db['DeskField'][_0xc6b4('0x4a')]({'where':{'id':_0x386622[_0xc6b4('0x4b')]['id']}})[_0xc6b4('0x3e')](handleEntityNotFound(_0x5a745e,null))[_0xc6b4('0x3e')](removeEntity(_0x5a745e,null))[_0xc6b4('0x42')](handleError(_0x5a745e,null));}; \ No newline at end of file +var _0x1bec=['options','find','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','save','update','destroy','then','error','stack','name','index','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','DeskField','includeAll','include','findAll','rows','catch','rawAttributes','length'];(function(_0x394ed6,_0x335ff8){var _0x3237fa=function(_0x219113){while(--_0x219113){_0x394ed6['push'](_0x394ed6['shift']());}};_0x3237fa(++_0x335ff8);}(_0x1bec,0x168));var _0xc1be=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0x1bec[_0x545b71];return _0x26e587;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc1be('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1be('0x1'));var moment=require(_0xc1be('0x2'));var BPromise=require(_0xc1be('0x3'));var Mustache=require(_0xc1be('0x4'));var util=require('util');var path=require(_0xc1be('0x5'));var sox=require(_0xc1be('0x6'));var csv=require(_0xc1be('0x7'));var ejs=require(_0xc1be('0x8'));var fs=require('fs');var fs_extra=require(_0xc1be('0x9'));var _=require(_0xc1be('0xa'));var squel=require(_0xc1be('0xb'));var crypto=require(_0xc1be('0xc'));var jsforce=require(_0xc1be('0xd'));var deskjs=require(_0xc1be('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1be('0xf'));var Papa=require(_0xc1be('0x10'));var Redis=require(_0xc1be('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc1be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1be('0x13'));var logger=require(_0xc1be('0x14'))(_0xc1be('0x15'));var utils=require(_0xc1be('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc1be('0x17'));var db=require(_0xc1be('0x18'))['db'];function respondWithStatusCode(_0x2a7c93,_0x2314c4){_0x2314c4=_0x2314c4||0xcc;return function(_0x21dc81){if(_0x21dc81){return _0x2a7c93[_0xc1be('0x19')](_0x2314c4);}return _0x2a7c93[_0xc1be('0x1a')](_0x2314c4)[_0xc1be('0x1b')]();};}function respondWithResult(_0x2e22ba,_0x5c3f35){_0x5c3f35=_0x5c3f35||0xc8;return function(_0x4658ac){if(_0x4658ac){return _0x2e22ba[_0xc1be('0x1a')](_0x5c3f35)[_0xc1be('0x1c')](_0x4658ac);}};}function respondWithFilteredResult(_0x576126,_0x318c33){return function(_0x4123e2){if(_0x4123e2){var _0x468ae8=typeof _0x318c33['offset']==='undefined'&&typeof _0x318c33[_0xc1be('0x1d')]===_0xc1be('0x1e');var _0x13e037=_0x4123e2[_0xc1be('0x1f')];var _0x65a73b=_0x468ae8?0x0:_0x318c33[_0xc1be('0x20')];var _0x5ee960=_0x468ae8?_0x4123e2[_0xc1be('0x1f')]:_0x318c33[_0xc1be('0x20')]+_0x318c33[_0xc1be('0x1d')];var _0x5795af;if(_0x5ee960>=_0x13e037){_0x5ee960=_0x13e037;_0x5795af=0xc8;}else{_0x5795af=0xce;}_0x576126[_0xc1be('0x1a')](_0x5795af);return _0x576126['set']('Content-Range',_0x65a73b+'-'+_0x5ee960+'/'+_0x13e037)[_0xc1be('0x1c')](_0x4123e2);}return null;};}function patchUpdates(_0x42a9fc){return function(_0x26e994){try{jsonpatch[_0xc1be('0x21')](_0x26e994,_0x42a9fc,!![]);}catch(_0xefa1ca){return BPromise['reject'](_0xefa1ca);}return _0x26e994[_0xc1be('0x22')]();};}function saveUpdates(_0x26de41,_0x23c0ee){return function(_0x356f71){if(_0x356f71){return _0x356f71[_0xc1be('0x23')](_0x26de41)['then'](function(_0x1533c8){return _0x1533c8;});}return null;};}function removeEntity(_0x180b22,_0x319a48){return function(_0x5a9d62){if(_0x5a9d62){return _0x5a9d62[_0xc1be('0x24')]()[_0xc1be('0x25')](function(){_0x180b22[_0xc1be('0x1a')](0xcc)[_0xc1be('0x1b')]();});}};}function handleEntityNotFound(_0x178a1a,_0x519d0f){return function(_0x42ac19){if(!_0x42ac19){_0x178a1a[_0xc1be('0x19')](0x194);}return _0x42ac19;};}function handleError(_0x21e979,_0xfd9196){_0xfd9196=_0xfd9196||0x1f4;return function(_0x4dcf5){logger[_0xc1be('0x26')](_0x4dcf5[_0xc1be('0x27')]);if(_0x4dcf5[_0xc1be('0x28')]){delete _0x4dcf5['name'];}_0x21e979[_0xc1be('0x1a')](_0xfd9196)['send'](_0x4dcf5);};}exports[_0xc1be('0x29')]=function(_0x1bd5f5,_0x56bcd9){var _0x132a39={},_0x199de2={},_0x11730f={'count':0x0,'rows':[]};var _0x195333=_['map'](db['DeskField']['rawAttributes'],function(_0x5e48a3){return{'name':_0x5e48a3[_0xc1be('0x2a')],'type':_0x5e48a3[_0xc1be('0x2b')]['key']};});_0x199de2[_0xc1be('0x2c')]=_[_0xc1be('0x2d')](_0x195333,_0xc1be('0x28'));_0x199de2[_0xc1be('0x2e')]=_[_0xc1be('0x2f')](_0x1bd5f5[_0xc1be('0x2e')]);_0x199de2['filters']=_[_0xc1be('0x30')](_0x199de2[_0xc1be('0x2c')],_0x199de2['query']);_0x132a39[_0xc1be('0x31')]=_['intersection'](_0x199de2[_0xc1be('0x2c')],qs['fields'](_0x1bd5f5[_0xc1be('0x2e')][_0xc1be('0x32')]));_0x132a39['attributes']=_0x132a39[_0xc1be('0x31')]['length']?_0x132a39[_0xc1be('0x31')]:_0x199de2[_0xc1be('0x2c')];if(!_0x1bd5f5[_0xc1be('0x2e')][_0xc1be('0x33')]('nolimit')){_0x132a39[_0xc1be('0x1d')]=qs[_0xc1be('0x1d')](_0x1bd5f5['query'][_0xc1be('0x1d')]);_0x132a39[_0xc1be('0x20')]=qs['offset'](_0x1bd5f5[_0xc1be('0x2e')][_0xc1be('0x20')]);}_0x132a39['order']=qs[_0xc1be('0x34')](_0x1bd5f5[_0xc1be('0x2e')][_0xc1be('0x34')]);_0x132a39[_0xc1be('0x35')]=qs['filters'](_[_0xc1be('0x36')](_0x1bd5f5['query'],_0x199de2[_0xc1be('0x37')]),_0x195333);if(_0x1bd5f5[_0xc1be('0x2e')][_0xc1be('0x38')]){_0x132a39[_0xc1be('0x35')]=_['merge'](_0x132a39[_0xc1be('0x35')],{'$or':_[_0xc1be('0x2d')](_0x195333,function(_0x4b44d8){if(_0x4b44d8['type']!==_0xc1be('0x39')){var _0x57e271={};_0x57e271[_0x4b44d8['name']]={'$like':'%'+_0x1bd5f5['query'][_0xc1be('0x38')]+'%'};return _0x57e271;}})});}_0x132a39=_['merge']({},_0x132a39,_0x1bd5f5['options']);var _0x2945f7={'where':_0x132a39[_0xc1be('0x35')]};return db[_0xc1be('0x3a')][_0xc1be('0x1f')](_0x2945f7)[_0xc1be('0x25')](function(_0x445200){_0x11730f[_0xc1be('0x1f')]=_0x445200;if(_0x1bd5f5[_0xc1be('0x2e')][_0xc1be('0x3b')]){_0x132a39[_0xc1be('0x3c')]=[{'all':!![]}];}return db[_0xc1be('0x3a')][_0xc1be('0x3d')](_0x132a39);})[_0xc1be('0x25')](function(_0x3e36ff){_0x11730f[_0xc1be('0x3e')]=_0x3e36ff;return _0x11730f;})[_0xc1be('0x25')](respondWithFilteredResult(_0x56bcd9,_0x132a39))[_0xc1be('0x3f')](handleError(_0x56bcd9,null));};exports['show']=function(_0x3dd76d,_0x2c0961){var _0x2eea6f={'raw':!![],'where':{'id':_0x3dd76d['params']['id']}},_0x42f427={};_0x42f427[_0xc1be('0x2c')]=_[_0xc1be('0x2f')](db[_0xc1be('0x3a')][_0xc1be('0x40')]);_0x42f427[_0xc1be('0x2e')]=_[_0xc1be('0x2f')](_0x3dd76d[_0xc1be('0x2e')]);_0x42f427[_0xc1be('0x37')]=_[_0xc1be('0x30')](_0x42f427[_0xc1be('0x2c')],_0x42f427[_0xc1be('0x2e')]);_0x2eea6f['attributes']=_[_0xc1be('0x30')](_0x42f427[_0xc1be('0x2c')],qs[_0xc1be('0x32')](_0x3dd76d['query'][_0xc1be('0x32')]));_0x2eea6f['attributes']=_0x2eea6f['attributes'][_0xc1be('0x41')]?_0x2eea6f['attributes']:_0x42f427[_0xc1be('0x2c')];if(_0x3dd76d['query']['includeAll']){_0x2eea6f[_0xc1be('0x3c')]=[{'all':!![]}];}_0x2eea6f=_['merge']({},_0x2eea6f,_0x3dd76d[_0xc1be('0x42')]);return db['DeskField'][_0xc1be('0x43')](_0x2eea6f)[_0xc1be('0x25')](handleEntityNotFound(_0x2c0961,null))['then'](respondWithResult(_0x2c0961,null))[_0xc1be('0x3f')](handleError(_0x2c0961,null));};exports[_0xc1be('0x44')]=function(_0x3ead7c,_0x146438){return db[_0xc1be('0x3a')]['create'](_0x3ead7c[_0xc1be('0x45')],{})[_0xc1be('0x25')](respondWithResult(_0x146438,0xc9))[_0xc1be('0x3f')](handleError(_0x146438,null));};exports[_0xc1be('0x23')]=function(_0x30ec49,_0x2852fa){if(_0x30ec49['body']['id']){delete _0x30ec49['body']['id'];}return db[_0xc1be('0x3a')]['find']({'where':{'id':_0x30ec49[_0xc1be('0x46')]['id']}})['then'](handleEntityNotFound(_0x2852fa,null))[_0xc1be('0x25')](saveUpdates(_0x30ec49[_0xc1be('0x45')],null))[_0xc1be('0x25')](respondWithResult(_0x2852fa,null))['catch'](handleError(_0x2852fa,null));};exports[_0xc1be('0x24')]=function(_0x5ad403,_0x23e676){return db[_0xc1be('0x3a')][_0xc1be('0x43')]({'where':{'id':_0x5ad403[_0xc1be('0x46')]['id']}})['then'](handleEntityNotFound(_0x23e676,null))[_0xc1be('0x25')](removeEntity(_0x23e676,null))[_0xc1be('0x3f')](handleError(_0x23e676,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 52543c9..eec8e0d 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 _0xff40=['request-promise','path','exports','int_desk_fields','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x2b6a50,_0x1ede3c){var _0x1b52fb=function(_0x12d202){while(--_0x12d202){_0x2b6a50['push'](_0x2b6a50['shift']());}};_0x1b52fb(++_0x1ede3c);}(_0xff40,0xba));var _0x0ff4=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xff40[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require('lodash');var util=require(_0x0ff4('0x0'));var logger=require(_0x0ff4('0x1'))(_0x0ff4('0x2'));var moment=require(_0x0ff4('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ff4('0x4'));var fs=require('fs');var path=require(_0x0ff4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x0ff4('0x6')]=function(_0x4088f2,_0x2cd5b0){return _0x4088f2['define']('DeskField',attributes,{'tableName':_0x0ff4('0x7'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x0ff4('0x8'),_0x0ff4('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x396d=['DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x3b5e6f,_0x45fa8c){var _0x29ca36=function(_0x34970d){while(--_0x34970d){_0x3b5e6f['push'](_0x3b5e6f['shift']());}};_0x29ca36(++_0x45fa8c);}(_0x396d,0xd4));var _0xd396=function(_0x3f8280,_0x12c4c3){_0x3f8280=_0x3f8280-0x0;var _0x350e79=_0x396d[_0x3f8280];return _0x350e79;};'use strict';var _=require(_0xd396('0x0'));var util=require(_0xd396('0x1'));var logger=require(_0xd396('0x2'))(_0xd396('0x3'));var moment=require(_0xd396('0x4'));var BPromise=require('bluebird');var rp=require(_0xd396('0x5'));var fs=require('fs');var path=require(_0xd396('0x6'));var rimraf=require(_0xd396('0x7'));var config=require(_0xd396('0x8'));var attributes=require(_0xd396('0x9'));module[_0xd396('0xa')]=function(_0x1d6cb8,_0x4d9ef2){return _0x1d6cb8[_0xd396('0xb')](_0xd396('0xc'),attributes,{'tableName':_0xd396('0xd'),'paranoid':![],'indexes':[{'name':_0xd396('0xe'),'fields':['idField',_0xd396('0xf')],'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 d571c5d..e2d6b0f 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 _0x64d3=['code','DeskField,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0x335450,_0x56e309){var _0x3ae2fc=function(_0x4adde1){while(--_0x4adde1){_0x335450['push'](_0x335450['shift']());}};_0x3ae2fc(++_0x56e309);}(_0x64d3,0x191));var _0x364d=function(_0x10e5d9,_0x52e4fd){_0x10e5d9=_0x10e5d9-0x0;var _0x5df441=_0x64d3[_0x10e5d9];return _0x5df441;};'use strict';var _=require(_0x364d('0x0'));var util=require(_0x364d('0x1'));var moment=require(_0x364d('0x2'));var BPromise=require(_0x364d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x364d('0x4'));var db=require(_0x364d('0x5'))['db'];var utils=require(_0x364d('0x6'));var logger=require('../../config/logger')(_0x364d('0x7'));var config=require('../../config/environment');var jayson=require(_0x364d('0x8'));var client=jayson[_0x364d('0x9')][_0x364d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39de45,_0x180e72,_0x4e2cfb){return new BPromise(function(_0x32c7d0,_0x2cf3af){return client[_0x364d('0xb')](_0x39de45,_0x4e2cfb)[_0x364d('0xc')](function(_0x3b2f03){logger['info']('DeskField,\x20%s,\x20%s',_0x180e72,_0x364d('0xd'));logger[_0x364d('0xe')](_0x364d('0xf'),_0x180e72,_0x364d('0xd'),JSON['stringify'](_0x3b2f03));if(_0x3b2f03[_0x364d('0x10')]){if(_0x3b2f03['error'][_0x364d('0x11')]===0x1f4){logger['error'](_0x364d('0x12'),_0x180e72,_0x3b2f03[_0x364d('0x10')][_0x364d('0x13')]);return _0x2cf3af(_0x3b2f03[_0x364d('0x10')][_0x364d('0x13')]);}logger[_0x364d('0x10')](_0x364d('0x12'),_0x180e72,_0x3b2f03[_0x364d('0x10')][_0x364d('0x13')]);return _0x32c7d0(_0x3b2f03[_0x364d('0x10')][_0x364d('0x13')]);}else{logger[_0x364d('0x14')]('DeskField,\x20%s,\x20%s',_0x180e72,_0x364d('0xd'));_0x32c7d0(_0x3b2f03[_0x364d('0x15')][_0x364d('0x13')]);}})['catch'](function(_0x20a290){logger[_0x364d('0x10')]('DeskField,\x20%s,\x20%s',_0x180e72,_0x20a290);_0x2cf3af(_0x20a290);});});} \ No newline at end of file +var _0x5326=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x37357d,_0x3a734b){var _0x4bfb29=function(_0x27c190){while(--_0x27c190){_0x37357d['push'](_0x37357d['shift']());}};_0x4bfb29(++_0x3a734b);}(_0x5326,0xf8));var _0x6532=function(_0x3879f5,_0x5b4fe8){_0x3879f5=_0x3879f5-0x0;var _0x27ee90=_0x5326[_0x3879f5];return _0x27ee90;};'use strict';var _=require(_0x6532('0x0'));var util=require(_0x6532('0x1'));var moment=require(_0x6532('0x2'));var BPromise=require(_0x6532('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6532('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6532('0x5'));var logger=require(_0x6532('0x6'))(_0x6532('0x7'));var config=require(_0x6532('0x8'));var jayson=require(_0x6532('0x9'));var client=jayson[_0x6532('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5098,_0x4e3d6f,_0x1480db){return new BPromise(function(_0x295a3e,_0x17a98e){return client[_0x6532('0xb')](_0x1c5098,_0x1480db)[_0x6532('0xc')](function(_0x2a3aec){logger[_0x6532('0xd')](_0x6532('0xe'),_0x4e3d6f,_0x6532('0xf'));logger[_0x6532('0x10')](_0x6532('0x11'),_0x4e3d6f,_0x6532('0xf'),JSON[_0x6532('0x12')](_0x2a3aec));if(_0x2a3aec[_0x6532('0x13')]){if(_0x2a3aec[_0x6532('0x13')][_0x6532('0x14')]===0x1f4){logger[_0x6532('0x13')](_0x6532('0xe'),_0x4e3d6f,_0x2a3aec[_0x6532('0x13')]['message']);return _0x17a98e(_0x2a3aec['error'][_0x6532('0x15')]);}logger[_0x6532('0x13')](_0x6532('0xe'),_0x4e3d6f,_0x2a3aec[_0x6532('0x13')][_0x6532('0x15')]);return _0x295a3e(_0x2a3aec[_0x6532('0x13')][_0x6532('0x15')]);}else{logger[_0x6532('0xd')](_0x6532('0xe'),_0x4e3d6f,_0x6532('0xf'));_0x295a3e(_0x2a3aec[_0x6532('0x16')]['message']);}})[_0x6532('0x17')](function(_0x4b18d6){logger[_0x6532('0x13')](_0x6532('0xe'),_0x4e3d6f,_0x4b18d6);_0x17a98e(_0x4b18d6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8d75d88..ea063d4 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 _0x4c04=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy'];(function(_0x24fca0,_0x3fabd3){var _0x53ae6b=function(_0x171faa){while(--_0x171faa){_0x24fca0['push'](_0x24fca0['shift']());}};_0x53ae6b(++_0x3fabd3);}(_0x4c04,0xb1));var _0x44c0=function(_0x58986a,_0x5e003d){_0x58986a=_0x58986a-0x0;var _0x1361ad=_0x4c04[_0x58986a];return _0x1361ad;};'use strict';var multer=require('multer');var util=require(_0x44c0('0x0'));var path=require(_0x44c0('0x1'));var timeout=require(_0x44c0('0x2'));var express=require('express');var router=express[_0x44c0('0x3')]();var fs_extra=require(_0x44c0('0x4'));var auth=require(_0x44c0('0x5'));var interaction=require(_0x44c0('0x6'));var config=require(_0x44c0('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x44c0('0x8')]('/',auth[_0x44c0('0x9')](),controller[_0x44c0('0xa')]);router['get'](_0x44c0('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x44c0('0xc'),auth[_0x44c0('0x9')](),controller[_0x44c0('0xd')]);router['get'](_0x44c0('0xe'),auth['isAuthenticated'](),controller[_0x44c0('0xf')]);router['post']('/',auth[_0x44c0('0x9')](),controller['create']);router[_0x44c0('0x10')](_0x44c0('0xc'),auth[_0x44c0('0x9')](),controller[_0x44c0('0x11')]);router['put'](_0x44c0('0xb'),auth[_0x44c0('0x9')](),controller[_0x44c0('0x12')]);router[_0x44c0('0x13')](_0x44c0('0xb'),auth['isAuthenticated'](),controller[_0x44c0('0x14')]);module[_0x44c0('0x15')]=router; \ No newline at end of file +var _0x746a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x82e5f3,_0x1cde33){var _0xac092b=function(_0x325760){while(--_0x325760){_0x82e5f3['push'](_0x82e5f3['shift']());}};_0xac092b(++_0x1cde33);}(_0x746a,0xed));var _0xa746=function(_0x2ff17b,_0x1ce9dd){_0x2ff17b=_0x2ff17b-0x0;var _0x59bbe8=_0x746a[_0x2ff17b];return _0x59bbe8;};'use strict';var multer=require(_0xa746('0x0'));var util=require(_0xa746('0x1'));var path=require(_0xa746('0x2'));var timeout=require(_0xa746('0x3'));var express=require(_0xa746('0x4'));var router=express['Router']();var fs_extra=require(_0xa746('0x5'));var auth=require(_0xa746('0x6'));var interaction=require(_0xa746('0x7'));var config=require('../../config/environment');var controller=require(_0xa746('0x8'));router[_0xa746('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa746('0x9')](_0xa746('0xa'),auth[_0xa746('0xb')](),controller[_0xa746('0xc')]);router[_0xa746('0x9')](_0xa746('0xd'),auth['isAuthenticated'](),controller[_0xa746('0xe')]);router[_0xa746('0x9')](_0xa746('0xf'),auth['isAuthenticated'](),controller[_0xa746('0x10')]);router[_0xa746('0x11')]('/',auth[_0xa746('0xb')](),controller[_0xa746('0x12')]);router[_0xa746('0x11')](_0xa746('0xd'),auth[_0xa746('0xb')](),controller[_0xa746('0x13')]);router[_0xa746('0x14')](_0xa746('0xa'),auth['isAuthenticated'](),controller[_0xa746('0x15')]);router['delete'](_0xa746('0xa'),auth[_0xa746('0xb')](),controller[_0xa746('0x16')]);module[_0xa746('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1f1acea..ca4dc21 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 _0xca84=['BOOLEAN','sequelize','exports','STRING'];(function(_0xd8345d,_0x4d0a93){var _0x3c6290=function(_0x4ad373){while(--_0x4ad373){_0xd8345d['push'](_0xd8345d['shift']());}};_0x3c6290(++_0x4d0a93);}(_0xca84,0xf5));var _0x4ca8=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0xca84[_0x16051a];return _0x35d20d;};'use strict';var Sequelize=require(_0x4ca8('0x0'));module[_0x4ca8('0x1')]={'name':{'type':Sequelize[_0x4ca8('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4ca8('0x2')]},'remoteUri':{'type':Sequelize[_0x4ca8('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4ca8('0x2')]},'clientSecret':{'type':Sequelize[_0x4ca8('0x2')]},'serverUrl':{'type':Sequelize[_0x4ca8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4ca8('0x2')]},'modernAuthentication':{'type':Sequelize[_0x4ca8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x975f=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x975f,0x109));var _0xf975=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0x975f[_0x2fa1c6];return _0x5f3257;};'use strict';var Sequelize=require(_0xf975('0x0'));module[_0xf975('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf975('0x2')]},'remoteUri':{'type':Sequelize[_0xf975('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf975('0x2')]},'clientSecret':{'type':Sequelize[_0xf975('0x2')]},'serverUrl':{'type':Sequelize[_0xf975('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf975('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9d1f386..f086726 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 _0x8a91=['json','offset','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','Dynamics365Account','findAll','catch','params','include','find','create','body','getConfigurations','findOne','filter','hasOwnProperty','limit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','PicklistAttributeMetadata','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode',')/Attributes(','OptionSet','Options','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','Label','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status'];(function(_0x5f0301,_0x34bb65){var _0x34cb5d=function(_0x2c927d){while(--_0x2c927d){_0x5f0301['push'](_0x5f0301['shift']());}};_0x34cb5d(++_0x34bb65);}(_0x8a91,0xb7));var _0x18a9=function(_0x2b89a3,_0x33807c){_0x2b89a3=_0x2b89a3-0x0;var _0x425bef=_0x8a91[_0x2b89a3];return _0x425bef;};'use strict';var rp=require(_0x18a9('0x0'));var util=require(_0x18a9('0x1'));var _=require(_0x18a9('0x2'));var qs=require(_0x18a9('0x3'));var logger=require(_0x18a9('0x4'))('api');var db=require(_0x18a9('0x5'))['db'];var integrations=require(_0x18a9('0x6'));function respondWithResult(_0x52177a,_0x4e1e09){_0x4e1e09=_0x4e1e09||0xc8;return function(_0x356f52){if(_0x356f52){return _0x52177a[_0x18a9('0x7')](_0x4e1e09)[_0x18a9('0x8')](_0x356f52);}};}function respondWithFilteredResult(_0x35fe07,_0x483c3a){return function(_0x36bb1f){if(_0x36bb1f){var _0x47b5fd=typeof _0x483c3a[_0x18a9('0x9')]==='undefined'&&typeof _0x483c3a['limit']===_0x18a9('0xa');var _0x324d9f=_0x36bb1f[_0x18a9('0xb')];var _0x36a408=_0x47b5fd?0x0:_0x483c3a[_0x18a9('0x9')];var _0x33e57=_0x47b5fd?_0x36bb1f[_0x18a9('0xb')]:_0x483c3a['offset']+_0x483c3a['limit'];var _0x2b8eca;if(_0x33e57>=_0x324d9f){_0x33e57=_0x324d9f;_0x2b8eca=0xc8;}else{_0x2b8eca=0xce;}_0x35fe07['status'](_0x2b8eca);return _0x35fe07[_0x18a9('0xc')](_0x18a9('0xd'),_0x36a408+'-'+_0x33e57+'/'+_0x324d9f)[_0x18a9('0x8')](_0x36bb1f);}return null;};}function saveUpdates(_0x47e3e8){return function(_0x4da1e7){if(_0x4da1e7){return _0x4da1e7[_0x18a9('0xe')](_0x47e3e8)[_0x18a9('0xf')](function(_0x50a7ad){return _0x50a7ad;});}return null;};}function removeEntity(_0x207a53){return function(_0x359368){if(_0x359368){return _0x359368[_0x18a9('0x10')]()['then'](function(){_0x207a53[_0x18a9('0x7')](0xcc)[_0x18a9('0x11')]();});}};}function handleEntityNotFound(_0x385c9d){return function(_0x373804){if(!_0x373804){_0x385c9d[_0x18a9('0x12')](0x194);}return _0x373804;};}function handleError(_0x5b43ad,_0x27c463){_0x27c463=_0x27c463||0x1f4;return function(_0x4c5d71){logger[_0x18a9('0x13')](_0x4c5d71[_0x18a9('0x14')]);if(_0x4c5d71[_0x18a9('0x15')]){delete _0x4c5d71['name'];}_0x5b43ad[_0x18a9('0x7')](_0x27c463)[_0x18a9('0x16')](_0x4c5d71);};}exports[_0x18a9('0x17')]=function(_0x4b0f9e,_0x53a480){var _0x48f650={},_0xd2a087={},_0x2a0c7d={'count':0x0,'rows':[]};var _0x25a751=_['map'](db['Dynamics365Account'][_0x18a9('0x18')],function(_0x33e996){return{'name':_0x33e996['fieldName'],'type':_0x33e996[_0x18a9('0x19')][_0x18a9('0x1a')]};});_0xd2a087['model']=_[_0x18a9('0x1b')](_0x25a751,'name');_0xd2a087[_0x18a9('0x1c')]=_[_0x18a9('0x1d')](_0x4b0f9e[_0x18a9('0x1c')]);_0xd2a087[_0x18a9('0x1e')]=_[_0x18a9('0x1f')](_0xd2a087[_0x18a9('0x20')],_0xd2a087[_0x18a9('0x1c')]);_0x48f650[_0x18a9('0x21')]=_[_0x18a9('0x1f')](_0xd2a087[_0x18a9('0x20')],qs[_0x18a9('0x22')](_0x4b0f9e[_0x18a9('0x1c')][_0x18a9('0x22')]));_0x48f650['attributes']=_0x48f650['attributes'][_0x18a9('0x23')]?_0x48f650[_0x18a9('0x21')]:_0xd2a087['model'];if(!_0x4b0f9e['query']['hasOwnProperty'](_0x18a9('0x24'))){_0x48f650['limit']=qs['limit'](_0x4b0f9e[_0x18a9('0x1c')]['limit']);_0x48f650[_0x18a9('0x9')]=qs['offset'](_0x4b0f9e[_0x18a9('0x1c')][_0x18a9('0x9')]);}_0x48f650[_0x18a9('0x25')]=qs[_0x18a9('0x26')](_0x4b0f9e[_0x18a9('0x1c')][_0x18a9('0x26')]);_0x48f650[_0x18a9('0x27')]=qs[_0x18a9('0x1e')](_[_0x18a9('0x28')](_0x4b0f9e['query'],_0xd2a087[_0x18a9('0x1e')]),_0x25a751);if(_0x4b0f9e[_0x18a9('0x1c')]['filter']){_0x48f650['where']=_[_0x18a9('0x29')](_0x48f650['where'],{'$or':_[_0x18a9('0x1b')](_0x25a751,function(_0x347673){if(_0x347673[_0x18a9('0x19')]!==_0x18a9('0x2a')){var _0x3fb8f2={};_0x3fb8f2[_0x347673[_0x18a9('0x15')]]={'$like':'%'+_0x4b0f9e['query']['filter']+'%'};return _0x3fb8f2;}})});}_0x48f650=_[_0x18a9('0x29')]({},_0x48f650,_0x4b0f9e[_0x18a9('0x2b')]);var _0x294e44={'where':_0x48f650[_0x18a9('0x27')]};return db['Dynamics365Account'][_0x18a9('0xb')](_0x294e44)['then'](function(_0x3c70d0){_0x2a0c7d[_0x18a9('0xb')]=_0x3c70d0;if(_0x4b0f9e[_0x18a9('0x1c')][_0x18a9('0x2c')]){_0x48f650['include']=[{'all':!![]}];}return db[_0x18a9('0x2d')][_0x18a9('0x2e')](_0x48f650);})[_0x18a9('0xf')](function(_0x101ebe){_0x2a0c7d['rows']=_0x101ebe;return _0x2a0c7d;})[_0x18a9('0xf')](respondWithFilteredResult(_0x53a480,_0x48f650))[_0x18a9('0x2f')](handleError(_0x53a480,null));};exports['show']=function(_0x1d3743,_0x18eb19){var _0x2eee5c={'raw':![],'where':{'id':_0x1d3743[_0x18a9('0x30')]['id']}},_0x1602bb={};_0x1602bb[_0x18a9('0x20')]=_[_0x18a9('0x1d')](db[_0x18a9('0x2d')][_0x18a9('0x18')]);_0x1602bb[_0x18a9('0x1c')]=_[_0x18a9('0x1d')](_0x1d3743[_0x18a9('0x1c')]);_0x1602bb[_0x18a9('0x1e')]=_['intersection'](_0x1602bb['model'],_0x1602bb[_0x18a9('0x1c')]);_0x2eee5c[_0x18a9('0x21')]=_[_0x18a9('0x1f')](_0x1602bb[_0x18a9('0x20')],qs['fields'](_0x1d3743[_0x18a9('0x1c')][_0x18a9('0x22')]));_0x2eee5c[_0x18a9('0x21')]=_0x2eee5c[_0x18a9('0x21')]['length']?_0x2eee5c['attributes']:_0x1602bb[_0x18a9('0x20')];if(_0x1d3743['query']['includeAll']){_0x2eee5c[_0x18a9('0x31')]=[{'all':!![]}];}_0x2eee5c=_[_0x18a9('0x29')]({},_0x2eee5c,_0x1d3743[_0x18a9('0x2b')]);return db[_0x18a9('0x2d')][_0x18a9('0x32')](_0x2eee5c)['then'](handleEntityNotFound(_0x18eb19,null))['then'](respondWithResult(_0x18eb19,null))[_0x18a9('0x2f')](handleError(_0x18eb19,null));};exports[_0x18a9('0x33')]=function(_0xd5814c,_0x104df8){return db[_0x18a9('0x2d')][_0x18a9('0x33')](_0xd5814c[_0x18a9('0x34')],{})[_0x18a9('0xf')](respondWithResult(_0x104df8,0xc9))[_0x18a9('0x2f')](handleError(_0x104df8,null));};exports[_0x18a9('0xe')]=function(_0x1fe643,_0x316724){if(_0x1fe643[_0x18a9('0x34')]['id']){delete _0x1fe643[_0x18a9('0x34')]['id'];}return db[_0x18a9('0x2d')][_0x18a9('0x32')]({'where':{'id':_0x1fe643[_0x18a9('0x30')]['id']}})[_0x18a9('0xf')](handleEntityNotFound(_0x316724,null))[_0x18a9('0xf')](saveUpdates(_0x1fe643[_0x18a9('0x34')],null))['then'](respondWithResult(_0x316724,null))[_0x18a9('0x2f')](handleError(_0x316724,null));};exports[_0x18a9('0x10')]=function(_0x2d8949,_0x3eca4c){return db[_0x18a9('0x2d')][_0x18a9('0x32')]({'where':{'id':_0x2d8949[_0x18a9('0x30')]['id']}})[_0x18a9('0xf')](handleEntityNotFound(_0x3eca4c,null))['then'](removeEntity(_0x3eca4c,null))[_0x18a9('0x2f')](handleError(_0x3eca4c,null));};exports[_0x18a9('0x35')]=function(_0x4bd909,_0x42ff40){var _0x1271f7={};var _0x12dc8d={};var _0x3fda50;var _0x7def55;return db[_0x18a9('0x2d')][_0x18a9('0x36')]({'where':{'id':_0x4bd909['params']['id']}})[_0x18a9('0xf')](handleEntityNotFound(_0x42ff40,null))[_0x18a9('0xf')](function(_0x155b1a){if(_0x155b1a){_0x3fda50=_0x155b1a;_0x12dc8d[_0x18a9('0x20')]=_[_0x18a9('0x1d')](db['Dynamics365Configuration'][_0x18a9('0x18')]);_0x12dc8d[_0x18a9('0x1c')]=_['keys'](_0x4bd909[_0x18a9('0x1c')]);_0x12dc8d[_0x18a9('0x1e')]=_[_0x18a9('0x1f')](_0x12dc8d[_0x18a9('0x20')],_0x12dc8d['query']);_0x1271f7[_0x18a9('0x21')]=_[_0x18a9('0x1f')](_0x12dc8d[_0x18a9('0x20')],qs[_0x18a9('0x22')](_0x4bd909[_0x18a9('0x1c')]['fields']));_0x1271f7[_0x18a9('0x21')]=_0x1271f7[_0x18a9('0x21')][_0x18a9('0x23')]?_0x1271f7[_0x18a9('0x21')]:_0x12dc8d[_0x18a9('0x20')];_0x1271f7['order']=qs['sort'](_0x4bd909[_0x18a9('0x1c')][_0x18a9('0x26')]);_0x1271f7[_0x18a9('0x27')]=qs[_0x18a9('0x1e')](_[_0x18a9('0x28')](_0x4bd909[_0x18a9('0x1c')],_0x12dc8d[_0x18a9('0x1e')]));if(_0x4bd909['query'][_0x18a9('0x37')]){_0x1271f7[_0x18a9('0x27')]=_[_0x18a9('0x29')](_0x1271f7[_0x18a9('0x27')],{'$or':_[_0x18a9('0x1b')](_0x1271f7['attributes'],function(_0x32200f){var _0x203fab={};_0x203fab[_0x32200f]={'$like':'%'+_0x4bd909['query'][_0x18a9('0x37')]+'%'};return _0x203fab;})});}_0x1271f7=_[_0x18a9('0x29')]({},_0x1271f7,_0x4bd909[_0x18a9('0x2b')]);return _0x3fda50[_0x18a9('0x35')](_0x1271f7);}})['then'](function(_0x4d054f){if(_0x4d054f){_0x7def55=_0x4d054f[_0x18a9('0x23')];if(!_0x4bd909[_0x18a9('0x1c')][_0x18a9('0x38')](_0x18a9('0x24'))){_0x1271f7[_0x18a9('0x39')]=qs[_0x18a9('0x39')](_0x4bd909[_0x18a9('0x1c')][_0x18a9('0x39')]);_0x1271f7['offset']=qs[_0x18a9('0x9')](_0x4bd909[_0x18a9('0x1c')][_0x18a9('0x9')]);}return _0x3fda50[_0x18a9('0x35')](_0x1271f7);}})['then'](function(_0x43f851){if(_0x43f851){return _0x43f851?{'count':_0x7def55,'rows':_0x43f851}:null;}})[_0x18a9('0xf')](respondWithResult(_0x42ff40,null))['catch'](handleError(_0x42ff40,null));};exports[_0x18a9('0x3a')]=function(_0x1df2bf,_0x49c1dc){if(_0x1df2bf[_0x18a9('0x34')]['id']){delete _0x1df2bf['body']['id'];}return db[_0x18a9('0x2d')][_0x18a9('0x36')]({'where':{'id':_0x1df2bf['params']['id']}})['then'](handleEntityNotFound(_0x49c1dc,null))[_0x18a9('0xf')](function(_0x50b2e5){if(_0x50b2e5){_0x1df2bf['body']['AccountId']=_0x50b2e5['id'];_0x1df2bf[_0x18a9('0x34')][_0x18a9('0x3b')]=integrations[_0x18a9('0x3c')](_0x1df2bf['body'][_0x18a9('0x3d')],_0x1df2bf['body']['type']);_0x1df2bf[_0x18a9('0x34')][_0x18a9('0x3e')]=integrations[_0x18a9('0x3f')](_0x1df2bf[_0x18a9('0x34')][_0x18a9('0x3d')],_0x1df2bf[_0x18a9('0x34')][_0x18a9('0x19')]);return db[_0x18a9('0x40')][_0x18a9('0x33')](_0x1df2bf[_0x18a9('0x34')],{'include':[{'model':db[_0x18a9('0x41')],'as':_0x18a9('0x3b')},{'model':db[_0x18a9('0x41')],'as':_0x18a9('0x3e')}]});}return null;})[_0x18a9('0xf')](respondWithResult(_0x49c1dc,null))[_0x18a9('0x2f')](handleError(_0x49c1dc,null));};function sanitizeRemoteUri(_0x5e5837){var _0x45327f=_0x5e5837[_0x18a9('0x42')](-0x1);if(_0x45327f==='/')return _0x5e5837[_0x18a9('0x43')](0x0,_0x5e5837[_0x18a9('0x44')](_0x45327f));return _0x5e5837;}function getWebApiUrl(_0x526812){return util[_0x18a9('0x45')](_0x18a9('0x46'),_0x526812);}exports[_0x18a9('0x47')]=function(_0x5c0556,_0x4b5dd2){var _0x5a2dbf=_0x5c0556['query']['ticketType'];var _0x39b902=_0x5a2dbf===_0x18a9('0x48')?'Incident':_0x18a9('0x49');var _0x1d88c9='';var _0x21f653='';var _0x42101e='';var _0x2b946c='';var _0x570fd4='';var _0x413355='';var _0x1ae535='';var _0x1aead5='';var _0x507ef4=[_0x18a9('0x4a'),_0x18a9('0x4b'),_0x18a9('0x4c'),_0x18a9('0x4d'),_0x18a9('0x4e'),'subject',_0x18a9('0x4f'),_0x18a9('0x50'),_0x18a9('0x51'),'phonecall_activity_parties'];var _0x2d0bda=[_0x18a9('0x52'),_0x18a9('0x53'),_0x18a9('0x54'),_0x18a9('0x55'),_0x18a9('0x56'),_0x18a9('0x57'),_0x18a9('0x58'),_0x18a9('0x59'),_0x18a9('0x5a'),_0x18a9('0x5b'),'createdbyname',_0x18a9('0x5c'),'createdon',_0x18a9('0x5d'),_0x18a9('0x5e'),_0x18a9('0x5f'),_0x18a9('0x60'),_0x18a9('0x61'),_0x18a9('0x62'),_0x18a9('0x63'),'entityimage_timestamp','entityimage_url',_0x18a9('0x64'),'exchangerate','firstresponsebykpiidname','followupby',_0x18a9('0x65'),_0x18a9('0x66'),_0x18a9('0x67'),'lastonholdtime',_0x18a9('0x68'),_0x18a9('0x69'),_0x18a9('0x6a'),_0x18a9('0x6b'),_0x18a9('0x6c'),_0x18a9('0x6d'),_0x18a9('0x6e'),_0x18a9('0x6f'),_0x18a9('0x70'),_0x18a9('0x71'),_0x18a9('0x72'),_0x18a9('0x73'),_0x18a9('0x74'),_0x18a9('0x75'),_0x18a9('0x76'),_0x18a9('0x77'),_0x18a9('0x78'),'primarycontactidname',_0x18a9('0x79'),_0x18a9('0x7a'),_0x18a9('0x7b'),'productserialnumber',_0x18a9('0x7c'),_0x18a9('0x7d'),_0x18a9('0x7e'),_0x18a9('0x7f'),_0x18a9('0x80'),_0x18a9('0x81'),_0x18a9('0x82'),'slaname',_0x18a9('0x83'),'statecode',_0x18a9('0x84'),_0x18a9('0x85'),_0x18a9('0x86'),_0x18a9('0x87'),_0x18a9('0x88'),'traversedpath',_0x18a9('0x89'),_0x18a9('0x8a')];var _0x567110=_0x507ef4[_0x18a9('0x8b')](_0x2d0bda);return db[_0x18a9('0x2d')][_0x18a9('0x36')]({'where':{'id':_0x5c0556[_0x18a9('0x30')]['id']},'attributes':['id',_0x18a9('0x8c'),_0x18a9('0x8d'),_0x18a9('0x8e'),_0x18a9('0x8f'),_0x18a9('0x90'),'clientSecret',_0x18a9('0x91')],'include':[{'model':db[_0x18a9('0x92')],'as':_0x18a9('0x92'),'attributes':['id',_0x18a9('0x93'),'data7']}]})[_0x18a9('0xf')](handleEntityNotFound(_0x4b5dd2,null))[_0x18a9('0xf')](function(_0x3ab8ff){if(_0x3ab8ff){if(_0x3ab8ff[_0x18a9('0x91')]){_0x3ab8ff[_0x18a9('0x94')]=_0x3ab8ff[_0x18a9('0x92')][_0x18a9('0x93')];_0x1aead5=sanitizeRemoteUri(_0x3ab8ff['CloudProvider']['data7']);_0x1ae535=getWebApiUrl(_0x1aead5);return _0x3ab8ff;}_0x1aead5=sanitizeRemoteUri(_0x3ab8ff[_0x18a9('0x8e')]);_0x1ae535=getWebApiUrl(_0x1aead5);var _0x41e62b={'method':_0x18a9('0x95'),'uri':_0x18a9('0x96')+_0x3ab8ff[_0x18a9('0x8f')]+_0x18a9('0x97'),'form':{'client_id':_0x3ab8ff[_0x18a9('0x90')],'resource':_0x1aead5,'username':_0x3ab8ff[_0x18a9('0x8c')],'password':_0x3ab8ff[_0x18a9('0x8d')],'grant_type':_0x18a9('0x8d'),'client_secret':_0x3ab8ff[_0x18a9('0x98')]},'json':!![]};return rp(_0x41e62b);}})[_0x18a9('0xf')](function(_0x53c0e5){_0x413355=_0x53c0e5[_0x18a9('0x94')];var _0x3815df={'method':_0x18a9('0x99'),'uri':encodeURI(_0x1ae535+_0x18a9('0x9a')+_0x39b902+'\x27'),'headers':{'Authorization':_0x18a9('0x9b')+_0x413355,'If-None-Match':null,'OData-Version':_0x18a9('0x9c')},'json':!![]};return rp(_0x3815df);})[_0x18a9('0xf')](function(_0x3cc2ee){var _0x58451e=_0x3cc2ee[_0x18a9('0x9d')][0x0];var _0x583836=_0x58451e[_0x18a9('0x9e')];var _0x24c820={'method':'GET','uri':_0x1ae535+_0x18a9('0x9f')+_0x583836+_0x18a9('0xa0'),'headers':{'Authorization':_0x18a9('0x9b')+_0x413355,'If-None-Match':null,'OData-Version':_0x18a9('0x9c')},'json':!![]};return rp(_0x24c820);})['then'](function(_0x2dc33a){_0x1d88c9=_0x2dc33a;_0x21f653=_0x1d88c9[_0x18a9('0xa1')];_0x21f653=_[_0x18a9('0xa2')](_0x21f653,function(_0x2cf27c){return!_0x567110['includes'](_0x2cf27c['LogicalName']);});var _0x21f95f=[];var _0x2d0d7e=[];_0x21f653[_0x18a9('0xa3')](function(_0x1fb4b2){if(_0x1fb4b2[_0x18a9('0xa4')]){var _0x515e27=_0x1fb4b2[_0x18a9('0xa4')][_0x18a9('0x43')](_0x1fb4b2[_0x18a9('0xa4')][_0x18a9('0x44')]('.')+0x1);if(_0x515e27===_0x18a9('0xa5')){_0x21f95f['push'](getSelectList(_0x1ae535,_0x5a2dbf,_0x2d0d7e,_0x1d88c9[_0x18a9('0x9e')],_0x1fb4b2['MetadataId'],_0x413355));}}});return Promise['all'](_0x21f95f);})[_0x18a9('0xf')](function(_0x45e398){_0x42101e=_0x45e398[0x0];var _0x37c24c=[];var _0x4b9db3=[];_0x21f653[_0x18a9('0xa3')](function(_0x1c4e01){if(!_[_0x18a9('0xa6')](_0x1c4e01['@odata.type'])){var _0xdf1a72=_0x1c4e01['@odata.type']['substring'](_0x1c4e01['@odata.type'][_0x18a9('0x44')]('.')+0x1);if(_0xdf1a72==='BooleanAttributeMetadata'){_0x37c24c['push'](getBooleanList(_0x1ae535,_0x5a2dbf,_0x4b9db3,_0x1d88c9[_0x18a9('0x9e')],_0x1c4e01['MetadataId'],_0x413355));}}});return Promise[_0x18a9('0xa7')](_0x37c24c);})[_0x18a9('0xf')](function(_0x30aca1){_0x2b946c=_0x30aca1[0x0];var _0x261601=[];var _0x2f1ef7=[];_0x21f653[_0x18a9('0xa3')](function(_0x103675){if(_0x103675[_0x18a9('0xa4')]){var _0x1cb887=_0x103675[_0x18a9('0xa4')][_0x18a9('0x43')](_0x103675[_0x18a9('0xa4')][_0x18a9('0x44')]('.')+0x1);if(_0x1cb887===_0x18a9('0xa8')||_0x1cb887===_0x18a9('0xa9')||_0x1cb887===_0x18a9('0xaa')||_0x1cb887===_0x18a9('0xab')||_0x1cb887===_0x18a9('0xac')||_0x1cb887===_0x18a9('0xad')||_0x1cb887===_0x18a9('0xae')||_0x1cb887==='EntityNameAttributeMetadata'||_0x1cb887===_0x18a9('0xaf')||_0x1cb887===_0x18a9('0xb0')){_0x261601[_0x18a9('0xb1')](getInputList(_0x1ae535,_0x5a2dbf,_0x1cb887,_0x2f1ef7,_0x1d88c9[_0x18a9('0x9e')],_0x103675['MetadataId'],_0x413355));}}});return Promise['all'](_0x261601);})[_0x18a9('0xf')](function(_0x48c665){_0x570fd4=_0x48c665[0x0];var _0x33ad9f=_0x42101e[_0x18a9('0x8b')](_0x2b946c)['concat'](_0x570fd4);var _0x2bf5e4={'count':_0x33ad9f['length'],'rows':_0x33ad9f};return _0x2bf5e4;})['then'](respondWithResult(_0x4b5dd2,null))[_0x18a9('0x2f')](function(_0x132b8c){var _0x418745=_0x5c0556['query'][_0x18a9('0xb2')]?0x1f4:_0x132b8c[_0x18a9('0xb3')]||0x1f4;logger[_0x18a9('0x13')](_0x132b8c[_0x18a9('0x14')]);delete _0x132b8c[_0x18a9('0x15')];if(_0x418745===0x191){_0x418745=0x190;}_0x4b5dd2[_0x18a9('0x7')](_0x418745)[_0x18a9('0x16')](_0x5c0556[_0x18a9('0x1c')][_0x18a9('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x132b8c[_0x18a9('0xb3')]}:_0x132b8c);});};function getSelectList(_0x1e3291,_0x18cea9,_0x2cbd67,_0x4bbf4a,_0x36eedc,_0x59ed66){var _0xa9934d={'method':_0x18a9('0x99'),'uri':_0x1e3291+_0x18a9('0x9f')+_0x4bbf4a+_0x18a9('0xb4')+_0x36eedc+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x18a9('0x9b')+_0x59ed66,'If-None-Match':null,'OData-Version':_0x18a9('0x9c')},'json':!![]};return rp(_0xa9934d)[_0x18a9('0xf')](function(_0x56e43b){var _0x596ea8=[];var _0x1087df=_0x56e43b[_0x18a9('0xb5')][_0x18a9('0xb6')];_0x1087df[_0x18a9('0xa3')](function(_0x99c179){_0x596ea8[_0x18a9('0xb1')]({'name':_0x99c179['Label'][_0x18a9('0xb7')]['Label'],'value':String(_0x99c179[_0x18a9('0xb8')])});});var _0x281866={'id':_0x18cea9+'_'+_0x56e43b[_0x18a9('0xb9')],'name':_0x56e43b[_0x18a9('0xba')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x596ea8};_0x2cbd67[_0x18a9('0xb1')](_0x281866);return _0x2cbd67;});}function getBooleanList(_0x4ed7f1,_0x36d473,_0x389ccf,_0x19152b,_0x3bc650,_0x1ea804){var _0x5f5386={'method':'GET','uri':_0x4ed7f1+'EntityDefinitions('+_0x19152b+_0x18a9('0xb4')+_0x3bc650+_0x18a9('0xbb'),'headers':{'Authorization':_0x18a9('0x9b')+_0x1ea804,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f5386)['then'](function(_0x2c925e){var _0x1b6288=[];_0x1b6288['push']({'name':_0x2c925e[_0x18a9('0xb5')]['TrueOption'][_0x18a9('0xbc')][_0x18a9('0xb7')][_0x18a9('0xbc')],'value':'true'},{'name':_0x2c925e[_0x18a9('0xb5')]['FalseOption'][_0x18a9('0xbc')][_0x18a9('0xb7')][_0x18a9('0xbc')],'value':_0x18a9('0xbd')});var _0x3afb4d={'id':_0x36d473+'_'+_0x2c925e[_0x18a9('0xb9')],'name':_0x2c925e[_0x18a9('0xba')][_0x18a9('0xb7')]['Label'],'custom':![],'options':_0x1b6288};_0x389ccf[_0x18a9('0xb1')](_0x3afb4d);return _0x389ccf;});}function getInputList(_0xa600e1,_0x51630c,_0xa39fd5,_0xd5c4e9,_0x25a085,_0x374bb2,_0x12289e){var _0x162193={'method':_0x18a9('0x99'),'uri':_0xa600e1+'EntityDefinitions('+_0x25a085+_0x18a9('0xb4')+_0x374bb2+_0x18a9('0xbe')+_0xa39fd5+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x12289e,'If-None-Match':null,'OData-Version':_0x18a9('0x9c')},'json':!![]};return rp(_0x162193)[_0x18a9('0xf')](function(_0x496fab){var _0x142c1d={'id':_0x51630c+'_'+_0x496fab[_0x18a9('0xb9')],'name':_0x496fab[_0x18a9('0xba')][_0x18a9('0xb7')]?_0x496fab[_0x18a9('0xba')]['UserLocalizedLabel'][_0x18a9('0xbc')]:_0x496fab[_0x18a9('0xb9')],'custom':![],'options':[]};_0xd5c4e9[_0x18a9('0xb1')](_0x142c1d);return _0xd5c4e9;});} \ No newline at end of file +var _0x0d7b=['TrueOption','FalseOption','false','DisplayName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','update','then','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','format','getFields','ticketType','incident','Incident','PhoneCall','title','ownerid','caseorigincode','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','test','statusCode','stack',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)'];(function(_0x2a0b9a,_0x322c5b){var _0x4dfd83=function(_0x2b976e){while(--_0x2b976e){_0x2a0b9a['push'](_0x2a0b9a['shift']());}};_0x4dfd83(++_0x322c5b);}(_0x0d7b,0xc4));var _0xb0d7=function(_0x25c16f,_0x45a7a8){_0x25c16f=_0x25c16f-0x0;var _0x5c574c=_0x0d7b[_0x25c16f];return _0x5c574c;};'use strict';var rp=require(_0xb0d7('0x0'));var util=require(_0xb0d7('0x1'));var _=require(_0xb0d7('0x2'));var qs=require(_0xb0d7('0x3'));var logger=require(_0xb0d7('0x4'))(_0xb0d7('0x5'));var db=require(_0xb0d7('0x6'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x3cf015,_0x439b39){_0x439b39=_0x439b39||0xc8;return function(_0x426d29){if(_0x426d29){return _0x3cf015[_0xb0d7('0x7')](_0x439b39)[_0xb0d7('0x8')](_0x426d29);}};}function respondWithFilteredResult(_0x13ef3b,_0x2f1846){return function(_0x248833){if(_0x248833){var _0x49b730=typeof _0x2f1846['offset']===_0xb0d7('0x9')&&typeof _0x2f1846[_0xb0d7('0xa')]===_0xb0d7('0x9');var _0x27456a=_0x248833[_0xb0d7('0xb')];var _0x33f9fa=_0x49b730?0x0:_0x2f1846[_0xb0d7('0xc')];var _0x33c4b8=_0x49b730?_0x248833[_0xb0d7('0xb')]:_0x2f1846[_0xb0d7('0xc')]+_0x2f1846[_0xb0d7('0xa')];var _0x4f1c3e;if(_0x33c4b8>=_0x27456a){_0x33c4b8=_0x27456a;_0x4f1c3e=0xc8;}else{_0x4f1c3e=0xce;}_0x13ef3b['status'](_0x4f1c3e);return _0x13ef3b[_0xb0d7('0xd')](_0xb0d7('0xe'),_0x33f9fa+'-'+_0x33c4b8+'/'+_0x27456a)['json'](_0x248833);}return null;};}function saveUpdates(_0x1d313f){return function(_0x4c49b3){if(_0x4c49b3){return _0x4c49b3[_0xb0d7('0xf')](_0x1d313f)[_0xb0d7('0x10')](function(_0x5db59f){return _0x5db59f;});}return null;};}function removeEntity(_0x2d0850){return function(_0x3e0d57){if(_0x3e0d57){return _0x3e0d57['destroy']()['then'](function(){_0x2d0850[_0xb0d7('0x7')](0xcc)[_0xb0d7('0x11')]();});}};}function handleEntityNotFound(_0x5b711e){return function(_0x3947ba){if(!_0x3947ba){_0x5b711e[_0xb0d7('0x12')](0x194);}return _0x3947ba;};}function handleError(_0x377443,_0x53ec34){_0x53ec34=_0x53ec34||0x1f4;return function(_0x2fb0a5){logger[_0xb0d7('0x13')](_0x2fb0a5['stack']);if(_0x2fb0a5[_0xb0d7('0x14')]){delete _0x2fb0a5[_0xb0d7('0x14')];}_0x377443[_0xb0d7('0x7')](_0x53ec34)[_0xb0d7('0x15')](_0x2fb0a5);};}exports[_0xb0d7('0x16')]=function(_0xd754a5,_0x34da23){var _0x261348={},_0x3231e1={},_0x286e44={'count':0x0,'rows':[]};var _0x4e0cb9=_[_0xb0d7('0x17')](db[_0xb0d7('0x18')][_0xb0d7('0x19')],function(_0x3c3ac8){return{'name':_0x3c3ac8[_0xb0d7('0x1a')],'type':_0x3c3ac8[_0xb0d7('0x1b')][_0xb0d7('0x1c')]};});_0x3231e1['model']=_[_0xb0d7('0x17')](_0x4e0cb9,_0xb0d7('0x14'));_0x3231e1[_0xb0d7('0x1d')]=_[_0xb0d7('0x1e')](_0xd754a5[_0xb0d7('0x1d')]);_0x3231e1[_0xb0d7('0x1f')]=_[_0xb0d7('0x20')](_0x3231e1['model'],_0x3231e1[_0xb0d7('0x1d')]);_0x261348['attributes']=_[_0xb0d7('0x20')](_0x3231e1[_0xb0d7('0x21')],qs[_0xb0d7('0x22')](_0xd754a5['query']['fields']));_0x261348[_0xb0d7('0x23')]=_0x261348[_0xb0d7('0x23')][_0xb0d7('0x24')]?_0x261348['attributes']:_0x3231e1[_0xb0d7('0x21')];if(!_0xd754a5['query']['hasOwnProperty'](_0xb0d7('0x25'))){_0x261348[_0xb0d7('0xa')]=qs[_0xb0d7('0xa')](_0xd754a5['query']['limit']);_0x261348[_0xb0d7('0xc')]=qs[_0xb0d7('0xc')](_0xd754a5[_0xb0d7('0x1d')][_0xb0d7('0xc')]);}_0x261348[_0xb0d7('0x26')]=qs[_0xb0d7('0x27')](_0xd754a5[_0xb0d7('0x1d')][_0xb0d7('0x27')]);_0x261348[_0xb0d7('0x28')]=qs['filters'](_['pick'](_0xd754a5['query'],_0x3231e1[_0xb0d7('0x1f')]),_0x4e0cb9);if(_0xd754a5[_0xb0d7('0x1d')][_0xb0d7('0x29')]){_0x261348[_0xb0d7('0x28')]=_[_0xb0d7('0x2a')](_0x261348[_0xb0d7('0x28')],{'$or':_['map'](_0x4e0cb9,function(_0x2bf490){if(_0x2bf490[_0xb0d7('0x1b')]!=='VIRTUAL'){var _0x293d2c={};_0x293d2c[_0x2bf490[_0xb0d7('0x14')]]={'$like':'%'+_0xd754a5[_0xb0d7('0x1d')]['filter']+'%'};return _0x293d2c;}})});}_0x261348=_[_0xb0d7('0x2a')]({},_0x261348,_0xd754a5[_0xb0d7('0x2b')]);var _0xfd6173={'where':_0x261348[_0xb0d7('0x28')]};return db['Dynamics365Account'][_0xb0d7('0xb')](_0xfd6173)[_0xb0d7('0x10')](function(_0x38bbb1){_0x286e44[_0xb0d7('0xb')]=_0x38bbb1;if(_0xd754a5['query'][_0xb0d7('0x2c')]){_0x261348[_0xb0d7('0x2d')]=[{'all':!![]}];}return db[_0xb0d7('0x18')][_0xb0d7('0x2e')](_0x261348);})[_0xb0d7('0x10')](function(_0x355864){_0x286e44[_0xb0d7('0x2f')]=_0x355864;return _0x286e44;})[_0xb0d7('0x10')](respondWithFilteredResult(_0x34da23,_0x261348))[_0xb0d7('0x30')](handleError(_0x34da23,null));};exports[_0xb0d7('0x31')]=function(_0x4a1a89,_0x4cb6af){var _0x1d94c2={'raw':![],'where':{'id':_0x4a1a89[_0xb0d7('0x32')]['id']}},_0x2c1c63={};_0x2c1c63[_0xb0d7('0x21')]=_['keys'](db['Dynamics365Account']['rawAttributes']);_0x2c1c63[_0xb0d7('0x1d')]=_[_0xb0d7('0x1e')](_0x4a1a89[_0xb0d7('0x1d')]);_0x2c1c63[_0xb0d7('0x1f')]=_[_0xb0d7('0x20')](_0x2c1c63[_0xb0d7('0x21')],_0x2c1c63[_0xb0d7('0x1d')]);_0x1d94c2[_0xb0d7('0x23')]=_['intersection'](_0x2c1c63['model'],qs[_0xb0d7('0x22')](_0x4a1a89[_0xb0d7('0x1d')][_0xb0d7('0x22')]));_0x1d94c2[_0xb0d7('0x23')]=_0x1d94c2['attributes']['length']?_0x1d94c2[_0xb0d7('0x23')]:_0x2c1c63[_0xb0d7('0x21')];if(_0x4a1a89[_0xb0d7('0x1d')][_0xb0d7('0x2c')]){_0x1d94c2['include']=[{'all':!![]}];}_0x1d94c2=_[_0xb0d7('0x2a')]({},_0x1d94c2,_0x4a1a89['options']);return db[_0xb0d7('0x18')][_0xb0d7('0x33')](_0x1d94c2)[_0xb0d7('0x10')](handleEntityNotFound(_0x4cb6af,null))[_0xb0d7('0x10')](respondWithResult(_0x4cb6af,null))[_0xb0d7('0x30')](handleError(_0x4cb6af,null));};exports[_0xb0d7('0x34')]=function(_0x6fda2c,_0xb15a50){return db['Dynamics365Account'][_0xb0d7('0x34')](_0x6fda2c[_0xb0d7('0x35')],{})[_0xb0d7('0x10')](respondWithResult(_0xb15a50,0xc9))[_0xb0d7('0x30')](handleError(_0xb15a50,null));};exports[_0xb0d7('0xf')]=function(_0x5e6386,_0x3776ca){if(_0x5e6386[_0xb0d7('0x35')]['id']){delete _0x5e6386[_0xb0d7('0x35')]['id'];}return db[_0xb0d7('0x18')][_0xb0d7('0x33')]({'where':{'id':_0x5e6386[_0xb0d7('0x32')]['id']}})[_0xb0d7('0x10')](handleEntityNotFound(_0x3776ca,null))['then'](saveUpdates(_0x5e6386[_0xb0d7('0x35')],null))[_0xb0d7('0x10')](respondWithResult(_0x3776ca,null))[_0xb0d7('0x30')](handleError(_0x3776ca,null));};exports[_0xb0d7('0x36')]=function(_0x24bf5c,_0x30a540){return db[_0xb0d7('0x18')][_0xb0d7('0x33')]({'where':{'id':_0x24bf5c[_0xb0d7('0x32')]['id']}})[_0xb0d7('0x10')](handleEntityNotFound(_0x30a540,null))[_0xb0d7('0x10')](removeEntity(_0x30a540,null))[_0xb0d7('0x30')](handleError(_0x30a540,null));};exports[_0xb0d7('0x37')]=function(_0x71696c,_0xccaa6e){var _0x379539={};var _0xe10a3b={};var _0x5bb6b3;var _0x480b24;return db[_0xb0d7('0x18')][_0xb0d7('0x38')]({'where':{'id':_0x71696c[_0xb0d7('0x32')]['id']}})[_0xb0d7('0x10')](handleEntityNotFound(_0xccaa6e,null))['then'](function(_0x690968){if(_0x690968){_0x5bb6b3=_0x690968;_0xe10a3b[_0xb0d7('0x21')]=_['keys'](db[_0xb0d7('0x39')][_0xb0d7('0x19')]);_0xe10a3b[_0xb0d7('0x1d')]=_[_0xb0d7('0x1e')](_0x71696c[_0xb0d7('0x1d')]);_0xe10a3b[_0xb0d7('0x1f')]=_[_0xb0d7('0x20')](_0xe10a3b[_0xb0d7('0x21')],_0xe10a3b[_0xb0d7('0x1d')]);_0x379539[_0xb0d7('0x23')]=_[_0xb0d7('0x20')](_0xe10a3b[_0xb0d7('0x21')],qs['fields'](_0x71696c[_0xb0d7('0x1d')][_0xb0d7('0x22')]));_0x379539[_0xb0d7('0x23')]=_0x379539[_0xb0d7('0x23')][_0xb0d7('0x24')]?_0x379539[_0xb0d7('0x23')]:_0xe10a3b[_0xb0d7('0x21')];_0x379539['order']=qs['sort'](_0x71696c['query'][_0xb0d7('0x27')]);_0x379539[_0xb0d7('0x28')]=qs['filters'](_[_0xb0d7('0x3a')](_0x71696c[_0xb0d7('0x1d')],_0xe10a3b[_0xb0d7('0x1f')]));if(_0x71696c[_0xb0d7('0x1d')][_0xb0d7('0x29')]){_0x379539['where']=_[_0xb0d7('0x2a')](_0x379539['where'],{'$or':_[_0xb0d7('0x17')](_0x379539[_0xb0d7('0x23')],function(_0x1410c5){var _0x4a15a4={};_0x4a15a4[_0x1410c5]={'$like':'%'+_0x71696c[_0xb0d7('0x1d')][_0xb0d7('0x29')]+'%'};return _0x4a15a4;})});}_0x379539=_[_0xb0d7('0x2a')]({},_0x379539,_0x71696c['options']);return _0x5bb6b3[_0xb0d7('0x37')](_0x379539);}})[_0xb0d7('0x10')](function(_0x4adbc4){if(_0x4adbc4){_0x480b24=_0x4adbc4['length'];if(!_0x71696c[_0xb0d7('0x1d')][_0xb0d7('0x3b')](_0xb0d7('0x25'))){_0x379539[_0xb0d7('0xa')]=qs['limit'](_0x71696c[_0xb0d7('0x1d')][_0xb0d7('0xa')]);_0x379539[_0xb0d7('0xc')]=qs['offset'](_0x71696c['query'][_0xb0d7('0xc')]);}return _0x5bb6b3['getConfigurations'](_0x379539);}})[_0xb0d7('0x10')](function(_0x1d2b9d){if(_0x1d2b9d){return _0x1d2b9d?{'count':_0x480b24,'rows':_0x1d2b9d}:null;}})['then'](respondWithResult(_0xccaa6e,null))[_0xb0d7('0x30')](handleError(_0xccaa6e,null));};exports[_0xb0d7('0x3c')]=function(_0x550243,_0x231d5a){if(_0x550243[_0xb0d7('0x35')]['id']){delete _0x550243[_0xb0d7('0x35')]['id'];}return db[_0xb0d7('0x18')][_0xb0d7('0x38')]({'where':{'id':_0x550243['params']['id']}})[_0xb0d7('0x10')](handleEntityNotFound(_0x231d5a,null))[_0xb0d7('0x10')](function(_0x3e1e40){if(_0x3e1e40){_0x550243[_0xb0d7('0x35')][_0xb0d7('0x3d')]=_0x3e1e40['id'];_0x550243[_0xb0d7('0x35')][_0xb0d7('0x3e')]=integrations[_0xb0d7('0x3f')](_0x550243[_0xb0d7('0x35')][_0xb0d7('0x40')],_0x550243[_0xb0d7('0x35')][_0xb0d7('0x1b')]);_0x550243[_0xb0d7('0x35')]['Descriptions']=integrations[_0xb0d7('0x41')](_0x550243[_0xb0d7('0x35')]['channel'],_0x550243['body'][_0xb0d7('0x1b')]);return db[_0xb0d7('0x39')]['create'](_0x550243[_0xb0d7('0x35')],{'include':[{'model':db[_0xb0d7('0x42')],'as':'Subjects'},{'model':db[_0xb0d7('0x42')],'as':_0xb0d7('0x43')}]});}return null;})['then'](respondWithResult(_0x231d5a,null))[_0xb0d7('0x30')](handleError(_0x231d5a,null));};function sanitizeRemoteUri(_0x396c5d){var _0x68d28e=_0x396c5d['slice'](-0x1);if(_0x68d28e==='/')return _0x396c5d['substring'](0x0,_0x396c5d['lastIndexOf'](_0x68d28e));return _0x396c5d;}function getWebApiUrl(_0x1228e3){return util[_0xb0d7('0x44')]('%s/api/data/v9.0/',_0x1228e3);}exports[_0xb0d7('0x45')]=function(_0x547f08,_0x519437){var _0x4a288f=_0x547f08[_0xb0d7('0x1d')][_0xb0d7('0x46')];var _0x4d953a=_0x4a288f===_0xb0d7('0x47')?_0xb0d7('0x48'):_0xb0d7('0x49');var _0x3b2395='';var _0x23a56e='';var _0xb83db5='';var _0x164f9f='';var _0x52a3b6='';var _0x3d6511='';var _0x4e85dc='';var _0x5f3a78='';var _0x4e9b9a=[_0xb0d7('0x4a'),'description','customerid',_0xb0d7('0x4b'),_0xb0d7('0x4c'),'subject','phonenumber','regardingobjectid',_0xb0d7('0x4d'),_0xb0d7('0x4e')];var _0x4744ed=[_0xb0d7('0x4f'),_0xb0d7('0x50'),_0xb0d7('0x51'),_0xb0d7('0x52'),'contactidname',_0xb0d7('0x53'),_0xb0d7('0x54'),_0xb0d7('0x55'),_0xb0d7('0x56'),_0xb0d7('0x57'),'createdbyname',_0xb0d7('0x58'),_0xb0d7('0x59'),_0xb0d7('0x5a'),_0xb0d7('0x5b'),_0xb0d7('0x5c'),_0xb0d7('0x5d'),_0xb0d7('0x5e'),_0xb0d7('0x5f'),_0xb0d7('0x60'),_0xb0d7('0x61'),_0xb0d7('0x62'),_0xb0d7('0x63'),_0xb0d7('0x64'),_0xb0d7('0x65'),'followupby','importsequencenumber',_0xb0d7('0x66'),_0xb0d7('0x67'),'lastonholdtime',_0xb0d7('0x68'),_0xb0d7('0x69'),'modifiedbyexternalpartyyominame',_0xb0d7('0x6a'),_0xb0d7('0x6b'),_0xb0d7('0x6c'),_0xb0d7('0x6d'),_0xb0d7('0x6e'),_0xb0d7('0x6f'),_0xb0d7('0x70'),_0xb0d7('0x71'),_0xb0d7('0x72'),_0xb0d7('0x73'),_0xb0d7('0x74'),_0xb0d7('0x75'),_0xb0d7('0x76'),_0xb0d7('0x77'),_0xb0d7('0x78'),'primarycontactidyominame','prioritycodename',_0xb0d7('0x79'),_0xb0d7('0x7a'),_0xb0d7('0x7b'),_0xb0d7('0x7c'),'responseby',_0xb0d7('0x7d'),_0xb0d7('0x7e'),_0xb0d7('0x7f'),_0xb0d7('0x80'),'slaname',_0xb0d7('0x81'),_0xb0d7('0x82'),_0xb0d7('0x83'),_0xb0d7('0x84'),_0xb0d7('0x85'),'timezoneruleversionnumber',_0xb0d7('0x86'),_0xb0d7('0x87'),_0xb0d7('0x88'),'versionnumber'];var _0x1a3eb7=_0x4e9b9a[_0xb0d7('0x89')](_0x4744ed);return db[_0xb0d7('0x18')]['findOne']({'where':{'id':_0x547f08[_0xb0d7('0x32')]['id']},'attributes':['id',_0xb0d7('0x8a'),'password',_0xb0d7('0x8b'),_0xb0d7('0x8c'),'clientId',_0xb0d7('0x8d'),_0xb0d7('0x8e')],'include':[{'model':db[_0xb0d7('0x8f')],'as':'CloudProvider','attributes':['id',_0xb0d7('0x90'),_0xb0d7('0x91')]}]})['then'](handleEntityNotFound(_0x519437,null))[_0xb0d7('0x10')](function(_0x13ddfc){if(_0x13ddfc){if(_0x13ddfc[_0xb0d7('0x8e')]){_0x13ddfc['access_token']=_0x13ddfc[_0xb0d7('0x8f')]['data5'];_0x5f3a78=sanitizeRemoteUri(_0x13ddfc['CloudProvider'][_0xb0d7('0x91')]);_0x4e85dc=getWebApiUrl(_0x5f3a78);return _0x13ddfc;}_0x5f3a78=sanitizeRemoteUri(_0x13ddfc[_0xb0d7('0x8b')]);_0x4e85dc=getWebApiUrl(_0x5f3a78);var _0x5d38ed={'method':_0xb0d7('0x92'),'uri':_0xb0d7('0x93')+_0x13ddfc['tenantId']+'/oauth2/token','form':{'client_id':_0x13ddfc['clientId'],'resource':_0x5f3a78,'username':_0x13ddfc[_0xb0d7('0x8a')],'password':_0x13ddfc['password'],'grant_type':'password','client_secret':_0x13ddfc['clientSecret']},'json':!![]};return rp(_0x5d38ed);}})[_0xb0d7('0x10')](function(_0x331a70){_0x3d6511=_0x331a70[_0xb0d7('0x94')];var _0xcef4f5={'method':_0xb0d7('0x95'),'uri':encodeURI(_0x4e85dc+_0xb0d7('0x96')+_0x4d953a+'\x27'),'headers':{'Authorization':_0xb0d7('0x97')+_0x3d6511,'If-None-Match':null,'OData-Version':_0xb0d7('0x98')},'json':!![]};return rp(_0xcef4f5);})['then'](function(_0x178b7f){var _0x47c037=_0x178b7f[_0xb0d7('0x99')][0x0];var _0x312f47=_0x47c037[_0xb0d7('0x9a')];var _0x4d48ce={'method':'GET','uri':_0x4e85dc+_0xb0d7('0x9b')+_0x312f47+_0xb0d7('0x9c'),'headers':{'Authorization':'Bearer\x20'+_0x3d6511,'If-None-Match':null,'OData-Version':_0xb0d7('0x98')},'json':!![]};return rp(_0x4d48ce);})[_0xb0d7('0x10')](function(_0x2b52ba){_0x3b2395=_0x2b52ba;_0x23a56e=_0x3b2395[_0xb0d7('0x9d')];_0x23a56e=_[_0xb0d7('0x9e')](_0x23a56e,function(_0x846fa7){return!_0x1a3eb7[_0xb0d7('0x9f')](_0x846fa7[_0xb0d7('0xa0')]);});var _0xcb86e6=[];var _0x25facf=[];_0x23a56e[_0xb0d7('0xa1')](function(_0xc7dc0a){if(_0xc7dc0a[_0xb0d7('0xa2')]){var _0x6950d3=_0xc7dc0a['@odata.type']['substring'](_0xc7dc0a[_0xb0d7('0xa2')][_0xb0d7('0xa3')]('.')+0x1);if(_0x6950d3===_0xb0d7('0xa4')){_0xcb86e6['push'](getSelectList(_0x4e85dc,_0x4a288f,_0x25facf,_0x3b2395['MetadataId'],_0xc7dc0a[_0xb0d7('0x9a')],_0x3d6511));}}});return Promise['all'](_0xcb86e6);})[_0xb0d7('0x10')](function(_0x58b33d){_0xb83db5=_0x58b33d[0x0];var _0x1d3e3a=[];var _0x3e6376=[];_0x23a56e['forEach'](function(_0x5ae682){if(!_[_0xb0d7('0xa5')](_0x5ae682[_0xb0d7('0xa2')])){var _0x257b5a=_0x5ae682['@odata.type']['substring'](_0x5ae682[_0xb0d7('0xa2')]['lastIndexOf']('.')+0x1);if(_0x257b5a==='BooleanAttributeMetadata'){_0x1d3e3a[_0xb0d7('0xa6')](getBooleanList(_0x4e85dc,_0x4a288f,_0x3e6376,_0x3b2395[_0xb0d7('0x9a')],_0x5ae682['MetadataId'],_0x3d6511));}}});return Promise['all'](_0x1d3e3a);})[_0xb0d7('0x10')](function(_0x15b96b){_0x164f9f=_0x15b96b[0x0];var _0x4b57f7=[];var _0x1e1b9f=[];_0x23a56e[_0xb0d7('0xa1')](function(_0x7e0705){if(_0x7e0705[_0xb0d7('0xa2')]){var _0x39b56a=_0x7e0705[_0xb0d7('0xa2')]['substring'](_0x7e0705[_0xb0d7('0xa2')]['lastIndexOf']('.')+0x1);if(_0x39b56a===_0xb0d7('0xa7')||_0x39b56a===_0xb0d7('0xa8')||_0x39b56a===_0xb0d7('0xa9')||_0x39b56a===_0xb0d7('0xaa')||_0x39b56a===_0xb0d7('0xab')||_0x39b56a===_0xb0d7('0xac')||_0x39b56a===_0xb0d7('0xad')||_0x39b56a===_0xb0d7('0xae')||_0x39b56a===_0xb0d7('0xaf')||_0x39b56a==='DecimalAttributeMetadata'){_0x4b57f7[_0xb0d7('0xa6')](getInputList(_0x4e85dc,_0x4a288f,_0x39b56a,_0x1e1b9f,_0x3b2395[_0xb0d7('0x9a')],_0x7e0705[_0xb0d7('0x9a')],_0x3d6511));}}});return Promise[_0xb0d7('0xb0')](_0x4b57f7);})[_0xb0d7('0x10')](function(_0x3161ba){_0x52a3b6=_0x3161ba[0x0];var _0x408c56=_0xb83db5[_0xb0d7('0x89')](_0x164f9f)[_0xb0d7('0x89')](_0x52a3b6);var _0x1c913e={'count':_0x408c56[_0xb0d7('0x24')],'rows':_0x408c56};return _0x1c913e;})[_0xb0d7('0x10')](respondWithResult(_0x519437,null))[_0xb0d7('0x30')](function(_0x4da983){var _0x4d7063=_0x547f08[_0xb0d7('0x1d')][_0xb0d7('0xb1')]?0x1f4:_0x4da983[_0xb0d7('0xb2')]||0x1f4;logger[_0xb0d7('0x13')](_0x4da983[_0xb0d7('0xb3')]);delete _0x4da983[_0xb0d7('0x14')];if(_0x4d7063===0x191){_0x4d7063=0x190;}_0x519437[_0xb0d7('0x7')](_0x4d7063)[_0xb0d7('0x15')](_0x547f08[_0xb0d7('0x1d')][_0xb0d7('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x4da983['statusCode']}:_0x4da983);});};function getSelectList(_0x1f9892,_0x591bad,_0x3c3280,_0x46bcbb,_0x50fa48,_0x4dae71){var _0xdc979={'method':_0xb0d7('0x95'),'uri':_0x1f9892+_0xb0d7('0x9b')+_0x46bcbb+_0xb0d7('0xb4')+_0x50fa48+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xb0d7('0xb5'),'headers':{'Authorization':_0xb0d7('0x97')+_0x4dae71,'If-None-Match':null,'OData-Version':_0xb0d7('0x98')},'json':!![]};return rp(_0xdc979)[_0xb0d7('0x10')](function(_0x3ff547){var _0x154f7b=[];var _0x20bf65=_0x3ff547[_0xb0d7('0xb6')][_0xb0d7('0xb7')];_0x20bf65[_0xb0d7('0xa1')](function(_0x574685){_0x154f7b[_0xb0d7('0xa6')]({'name':_0x574685[_0xb0d7('0xb8')][_0xb0d7('0xb9')]['Label'],'value':String(_0x574685[_0xb0d7('0xba')])});});var _0x340f63={'id':_0x591bad+'_'+_0x3ff547['LogicalName'],'name':_0x3ff547['DisplayName'][_0xb0d7('0xb9')][_0xb0d7('0xb8')],'custom':![],'options':_0x154f7b};_0x3c3280[_0xb0d7('0xa6')](_0x340f63);return _0x3c3280;});}function getBooleanList(_0x255f19,_0x13f8a6,_0x31ec7f,_0x1dcb4c,_0x3a4859,_0x2880c0){var _0x1520ac={'method':'GET','uri':_0x255f19+_0xb0d7('0x9b')+_0x1dcb4c+_0xb0d7('0xb4')+_0x3a4859+_0xb0d7('0xbb'),'headers':{'Authorization':_0xb0d7('0x97')+_0x2880c0,'If-None-Match':null,'OData-Version':_0xb0d7('0x98')},'json':!![]};return rp(_0x1520ac)[_0xb0d7('0x10')](function(_0x58dbd8){var _0x4b5c1e=[];_0x4b5c1e[_0xb0d7('0xa6')]({'name':_0x58dbd8[_0xb0d7('0xb6')][_0xb0d7('0xbc')]['Label']['UserLocalizedLabel'][_0xb0d7('0xb8')],'value':'true'},{'name':_0x58dbd8[_0xb0d7('0xb6')][_0xb0d7('0xbd')][_0xb0d7('0xb8')][_0xb0d7('0xb9')][_0xb0d7('0xb8')],'value':_0xb0d7('0xbe')});var _0x4c1777={'id':_0x13f8a6+'_'+_0x58dbd8[_0xb0d7('0xa0')],'name':_0x58dbd8[_0xb0d7('0xbf')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4b5c1e};_0x31ec7f[_0xb0d7('0xa6')](_0x4c1777);return _0x31ec7f;});}function getInputList(_0x2233de,_0x8d87f8,_0x1881b5,_0x3ee733,_0x5faff8,_0x3b1cf9,_0x27fbb5){var _0x282d02={'method':_0xb0d7('0x95'),'uri':_0x2233de+'EntityDefinitions('+_0x5faff8+_0xb0d7('0xb4')+_0x3b1cf9+')/Microsoft.Dynamics.CRM.'+_0x1881b5+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x27fbb5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x282d02)[_0xb0d7('0x10')](function(_0x4af153){var _0x356195={'id':_0x8d87f8+'_'+_0x4af153[_0xb0d7('0xa0')],'name':_0x4af153[_0xb0d7('0xbf')][_0xb0d7('0xb9')]?_0x4af153['DisplayName']['UserLocalizedLabel'][_0xb0d7('0xb8')]:_0x4af153[_0xb0d7('0xa0')],'custom':![],'options':[]};_0x3ee733[_0xb0d7('0xa6')](_0x356195);return _0x3ee733;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e836b3a..52c2ee2 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x5db971,_0x51f6f0){var _0x16b2da=function(_0x1d5eb6){while(--_0x1d5eb6){_0x5db971['push'](_0x5db971['shift']());}};_0x16b2da(++_0x51f6f0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0xcb91[_0x4d7379];return _0x46d7cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2d7e2e,_0xd3ad36){var _0x7e92ae=function(_0x117963){while(--_0x117963){_0x2d7e2e['push'](_0x2d7e2e['shift']());}};_0x7e92ae(++_0xd3ad36);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'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 e3e4f27..ba687ca 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 _0x9d1c=['error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','then','GetDynamics365Account','ShowDynamics365Account','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9d1c,0xf2));var _0xc9d1=function(_0x2c35f8,_0x39f9e8){_0x2c35f8=_0x2c35f8-0x0;var _0x433b3a=_0x9d1c[_0x2c35f8];return _0x433b3a;};'use strict';var _=require(_0xc9d1('0x0'));var util=require('util');var moment=require(_0xc9d1('0x1'));var BPromise=require(_0xc9d1('0x2'));var rs=require(_0xc9d1('0x3'));var fs=require('fs');var Redis=require(_0xc9d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9d1('0x5'));var logger=require(_0xc9d1('0x6'))(_0xc9d1('0x7'));var config=require('../../config/environment');var jayson=require(_0xc9d1('0x8'));var client=jayson[_0xc9d1('0x9')][_0xc9d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x991f28,_0x1c2af8,_0x94988d){return new BPromise(function(_0x4a308c,_0xe99efb){return client[_0xc9d1('0xb')](_0x991f28,_0x94988d)['then'](function(_0x5ef6b3){logger[_0xc9d1('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1c2af8,'request\x20sent');logger[_0xc9d1('0xd')](_0xc9d1('0xe'),_0x1c2af8,_0xc9d1('0xf'),JSON[_0xc9d1('0x10')](_0x5ef6b3));if(_0x5ef6b3[_0xc9d1('0x11')]){if(_0x5ef6b3['error'][_0xc9d1('0x12')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1c2af8,_0x5ef6b3[_0xc9d1('0x11')][_0xc9d1('0x13')]);return _0xe99efb(_0x5ef6b3[_0xc9d1('0x11')][_0xc9d1('0x13')]);}logger[_0xc9d1('0x11')](_0xc9d1('0x14'),_0x1c2af8,_0x5ef6b3[_0xc9d1('0x11')][_0xc9d1('0x13')]);return _0x4a308c(_0x5ef6b3[_0xc9d1('0x11')][_0xc9d1('0x13')]);}else{logger['info'](_0xc9d1('0x14'),_0x1c2af8,'request\x20sent');_0x4a308c(_0x5ef6b3[_0xc9d1('0x15')]['message']);}})[_0xc9d1('0x16')](function(_0x554f16){logger[_0xc9d1('0x11')](_0xc9d1('0x14'),_0x1c2af8,_0x554f16);_0xe99efb(_0x554f16);});});}exports['GetDynamics365Account']=function(_0x215438){var _0x62c7be=this;return new Promise(function(_0x2335ca,_0x1ba8b4){return db[_0xc9d1('0x17')][_0xc9d1('0x18')]({'raw':_0x215438[_0xc9d1('0x19')]?_0x215438['options'][_0xc9d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x215438[_0xc9d1('0x19')]?_0x215438[_0xc9d1('0x19')][_0xc9d1('0x1b')]||null:null,'attributes':_0x215438[_0xc9d1('0x19')]?_0x215438[_0xc9d1('0x19')]['attributes']||null:null,'limit':_0x215438['options']?_0x215438[_0xc9d1('0x19')][_0xc9d1('0x1c')]||null:null,'include':_0x215438[_0xc9d1('0x19')]?_0x215438['options'][_0xc9d1('0x1d')]?_['map'](_0x215438[_0xc9d1('0x19')][_0xc9d1('0x1d')],function(_0x1082eb){return{'model':db[_0x1082eb['model']],'as':_0x1082eb['as'],'attributes':_0x1082eb[_0xc9d1('0x1e')],'include':_0x1082eb['include']?_[_0xc9d1('0x1f')](_0x1082eb[_0xc9d1('0x1d')],function(_0x4e6f8e){return{'model':db[_0x4e6f8e[_0xc9d1('0x20')]],'as':_0x4e6f8e['as'],'attributes':_0x4e6f8e['attributes'],'include':_0x4e6f8e[_0xc9d1('0x1d')]?_[_0xc9d1('0x1f')](_0x4e6f8e['include'],function(_0xae680){return{'model':db[_0xae680[_0xc9d1('0x20')]],'as':_0xae680['as'],'attributes':_0xae680[_0xc9d1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc9d1('0x21')](function(_0x512e6e){logger['info'](_0xc9d1('0x22'),_0x215438);logger[_0xc9d1('0xd')](_0xc9d1('0x22'),_0x215438,JSON['stringify'](_0x512e6e));_0x2335ca(_0x512e6e);})[_0xc9d1('0x16')](function(_0x5c4c88){logger[_0xc9d1('0x11')]('GetDynamics365Account',_0x5c4c88['message'],_0x215438);_0x1ba8b4(_0x62c7be[_0xc9d1('0x11')](0x1f4,_0x5c4c88[_0xc9d1('0x13')]));});});};exports[_0xc9d1('0x23')]=function(_0x2580a7){var _0x549a00=this;return new Promise(function(_0x20b920,_0x5aadc7){return db['Dynamics365Account'][_0xc9d1('0x24')]({'raw':_0x2580a7[_0xc9d1('0x19')]?_0x2580a7[_0xc9d1('0x19')][_0xc9d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x2580a7[_0xc9d1('0x19')]?_0x2580a7[_0xc9d1('0x19')]['where']||null:null,'attributes':_0x2580a7[_0xc9d1('0x19')]?_0x2580a7[_0xc9d1('0x19')][_0xc9d1('0x1e')]||null:null,'include':_0x2580a7[_0xc9d1('0x19')]?_0x2580a7[_0xc9d1('0x19')][_0xc9d1('0x1d')]?_['map'](_0x2580a7['options'][_0xc9d1('0x1d')],function(_0x486b9b){return{'model':db[_0x486b9b[_0xc9d1('0x20')]],'as':_0x486b9b['as'],'attributes':_0x486b9b[_0xc9d1('0x1e')],'include':_0x486b9b[_0xc9d1('0x1d')]?_[_0xc9d1('0x1f')](_0x486b9b['include'],function(_0x4e0570){return{'model':db[_0x4e0570[_0xc9d1('0x20')]],'as':_0x4e0570['as'],'attributes':_0x4e0570['attributes'],'include':_0x4e0570[_0xc9d1('0x1d')]?_[_0xc9d1('0x1f')](_0x4e0570[_0xc9d1('0x1d')],function(_0x43b742){return{'model':db[_0x43b742['model']],'as':_0x43b742['as'],'attributes':_0x43b742[_0xc9d1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc9d1('0x21')](function(_0x51f738){logger[_0xc9d1('0xc')](_0xc9d1('0x23'),_0x2580a7);logger['debug']('ShowDynamics365Account',_0x2580a7,JSON[_0xc9d1('0x10')](_0x51f738));_0x20b920(_0x51f738);})[_0xc9d1('0x16')](function(_0x40b51f){logger[_0xc9d1('0x11')](_0xc9d1('0x23'),_0x40b51f[_0xc9d1('0x13')],_0x2580a7);_0x5aadc7(_0x549a00[_0xc9d1('0x11')](0x1f4,_0x40b51f[_0xc9d1('0x13')]));});});}; \ No newline at end of file +var _0x5bba=['attributes','limit','map','include','model','debug','ShowDynamics365Account','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5bba,0x17d));var _0xa5bb=function(_0x484cab,_0x15c23a){_0x484cab=_0x484cab-0x0;var _0x40ea87=_0x5bba[_0x484cab];return _0x40ea87;};'use strict';var _=require(_0xa5bb('0x0'));var util=require(_0xa5bb('0x1'));var moment=require(_0xa5bb('0x2'));var BPromise=require('bluebird');var rs=require(_0xa5bb('0x3'));var fs=require('fs');var Redis=require(_0xa5bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5bb('0x5'));var logger=require('../../config/logger')(_0xa5bb('0x6'));var config=require(_0xa5bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa5bb('0x8')][_0xa5bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x509dff,_0x25c056,_0x1d0e35){return new BPromise(function(_0x5d11e9,_0x386a44){return client['request'](_0x509dff,_0x1d0e35)[_0xa5bb('0xa')](function(_0x1b7478){logger[_0xa5bb('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x25c056,_0xa5bb('0xc'));logger['debug'](_0xa5bb('0xd'),_0x25c056,_0xa5bb('0xc'),JSON[_0xa5bb('0xe')](_0x1b7478));if(_0x1b7478[_0xa5bb('0xf')]){if(_0x1b7478[_0xa5bb('0xf')][_0xa5bb('0x10')]===0x1f4){logger[_0xa5bb('0xf')](_0xa5bb('0x11'),_0x25c056,_0x1b7478[_0xa5bb('0xf')][_0xa5bb('0x12')]);return _0x386a44(_0x1b7478['error'][_0xa5bb('0x12')]);}logger[_0xa5bb('0xf')](_0xa5bb('0x11'),_0x25c056,_0x1b7478['error'][_0xa5bb('0x12')]);return _0x5d11e9(_0x1b7478[_0xa5bb('0xf')]['message']);}else{logger['info'](_0xa5bb('0x11'),_0x25c056,_0xa5bb('0xc'));_0x5d11e9(_0x1b7478[_0xa5bb('0x13')]['message']);}})[_0xa5bb('0x14')](function(_0x3fa031){logger[_0xa5bb('0xf')](_0xa5bb('0x11'),_0x25c056,_0x3fa031);_0x386a44(_0x3fa031);});});}exports[_0xa5bb('0x15')]=function(_0x18a39c){var _0x1c39fa=this;return new Promise(function(_0x3a39d1,_0x118bd5){return db[_0xa5bb('0x16')][_0xa5bb('0x17')]({'raw':_0x18a39c[_0xa5bb('0x18')]?_0x18a39c['options'][_0xa5bb('0x19')]===undefined?!![]:![]:!![],'where':_0x18a39c[_0xa5bb('0x18')]?_0x18a39c[_0xa5bb('0x18')][_0xa5bb('0x1a')]||null:null,'attributes':_0x18a39c['options']?_0x18a39c['options'][_0xa5bb('0x1b')]||null:null,'limit':_0x18a39c['options']?_0x18a39c[_0xa5bb('0x18')][_0xa5bb('0x1c')]||null:null,'include':_0x18a39c['options']?_0x18a39c[_0xa5bb('0x18')]['include']?_[_0xa5bb('0x1d')](_0x18a39c[_0xa5bb('0x18')]['include'],function(_0xec7ee1){return{'model':db[_0xec7ee1['model']],'as':_0xec7ee1['as'],'attributes':_0xec7ee1[_0xa5bb('0x1b')],'include':_0xec7ee1['include']?_['map'](_0xec7ee1[_0xa5bb('0x1e')],function(_0x2a78a2){return{'model':db[_0x2a78a2[_0xa5bb('0x1f')]],'as':_0x2a78a2['as'],'attributes':_0x2a78a2[_0xa5bb('0x1b')],'include':_0x2a78a2[_0xa5bb('0x1e')]?_[_0xa5bb('0x1d')](_0x2a78a2['include'],function(_0x21ee90){return{'model':db[_0x21ee90['model']],'as':_0x21ee90['as'],'attributes':_0x21ee90[_0xa5bb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa5bb('0xa')](function(_0x37aa1d){logger[_0xa5bb('0xb')](_0xa5bb('0x15'),_0x18a39c);logger[_0xa5bb('0x20')](_0xa5bb('0x15'),_0x18a39c,JSON[_0xa5bb('0xe')](_0x37aa1d));_0x3a39d1(_0x37aa1d);})[_0xa5bb('0x14')](function(_0x322271){logger[_0xa5bb('0xf')](_0xa5bb('0x15'),_0x322271['message'],_0x18a39c);_0x118bd5(_0x1c39fa['error'](0x1f4,_0x322271['message']));});});};exports[_0xa5bb('0x21')]=function(_0x501c64){var _0x58875d=this;return new Promise(function(_0x5e45e5,_0x449837){return db['Dynamics365Account']['find']({'raw':_0x501c64[_0xa5bb('0x18')]?_0x501c64[_0xa5bb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x501c64[_0xa5bb('0x18')]?_0x501c64['options'][_0xa5bb('0x1a')]||null:null,'attributes':_0x501c64['options']?_0x501c64['options'][_0xa5bb('0x1b')]||null:null,'include':_0x501c64[_0xa5bb('0x18')]?_0x501c64[_0xa5bb('0x18')]['include']?_['map'](_0x501c64['options'][_0xa5bb('0x1e')],function(_0x534942){return{'model':db[_0x534942[_0xa5bb('0x1f')]],'as':_0x534942['as'],'attributes':_0x534942[_0xa5bb('0x1b')],'include':_0x534942[_0xa5bb('0x1e')]?_[_0xa5bb('0x1d')](_0x534942[_0xa5bb('0x1e')],function(_0x4ac529){return{'model':db[_0x4ac529['model']],'as':_0x4ac529['as'],'attributes':_0x4ac529[_0xa5bb('0x1b')],'include':_0x4ac529[_0xa5bb('0x1e')]?_[_0xa5bb('0x1d')](_0x4ac529[_0xa5bb('0x1e')],function(_0x48742d){return{'model':db[_0x48742d['model']],'as':_0x48742d['as'],'attributes':_0x48742d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18a0d4){logger[_0xa5bb('0xb')]('ShowDynamics365Account',_0x501c64);logger[_0xa5bb('0x20')](_0xa5bb('0x21'),_0x501c64,JSON['stringify'](_0x18a0d4));_0x5e45e5(_0x18a0d4);})[_0xa5bb('0x14')](function(_0x4cf848){logger['error'](_0xa5bb('0x21'),_0x4cf848[_0xa5bb('0x12')],_0x501c64);_0x449837(_0x58875d[_0xa5bb('0xf')](0x1f4,_0x4cf848['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a26ccc6..74c9c22 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 _0x8ce8=['./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a1806,_0x8e118d){var _0x42daf5=function(_0x43b813){while(--_0x43b813){_0x2a1806['push'](_0x2a1806['shift']());}};_0x42daf5(++_0x8e118d);}(_0x8ce8,0xd3));var _0x88ce=function(_0x461987,_0x48d6f7){_0x461987=_0x461987-0x0;var _0xd9e39a=_0x8ce8[_0x461987];return _0xd9e39a;};'use strict';var multer=require(_0x88ce('0x0'));var util=require('util');var path=require(_0x88ce('0x1'));var timeout=require(_0x88ce('0x2'));var express=require(_0x88ce('0x3'));var router=express[_0x88ce('0x4')]();var fs_extra=require(_0x88ce('0x5'));var auth=require(_0x88ce('0x6'));var interaction=require(_0x88ce('0x7'));var config=require(_0x88ce('0x8'));var controller=require(_0x88ce('0x9'));router[_0x88ce('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88ce('0xa')](_0x88ce('0xb'),auth[_0x88ce('0xc')](),controller[_0x88ce('0xd')]);router[_0x88ce('0xa')]('/:id/fields',auth[_0x88ce('0xc')](),controller['getFields']);router[_0x88ce('0xa')](_0x88ce('0xe'),auth[_0x88ce('0xc')](),controller[_0x88ce('0xf')]);router[_0x88ce('0xa')](_0x88ce('0x10'),auth[_0x88ce('0xc')](),controller[_0x88ce('0x11')]);router['post']('/',auth[_0x88ce('0xc')](),controller['create']);router[_0x88ce('0x12')](_0x88ce('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x88ce('0x13')](_0x88ce('0xb'),auth[_0x88ce('0xc')](),controller[_0x88ce('0x14')]);module[_0x88ce('0x15')]=router; \ No newline at end of file +var _0x9f0e=['./intDynamics365Configuration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x225a00,_0x172657){var _0x3d9d3e=function(_0x1fe2a1){while(--_0x1fe2a1){_0x225a00['push'](_0x225a00['shift']());}};_0x3d9d3e(++_0x172657);}(_0x9f0e,0x116));var _0xe9f0=function(_0x386311,_0x2d6cb9){_0x386311=_0x386311-0x0;var _0x5b4878=_0x9f0e[_0x386311];return _0x5b4878;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['show']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/descriptions',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe9f0('0x12')]);router['put'](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x13')]);router[_0xe9f0('0x14')]('/:id',auth[_0xe9f0('0xb')](),controller['destroy']);module[_0xe9f0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 4e1c7c5..dd1b7f7 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 _0x7101=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','phonecall','incident','contact'];(function(_0x3ac71b,_0x584a85){var _0x147198=function(_0x340f79){while(--_0x340f79){_0x3ac71b['push'](_0x3ac71b['shift']());}};_0x147198(++_0x584a85);}(_0x7101,0x146));var _0x1710=function(_0x24fe48,_0x10e97e){_0x24fe48=_0x24fe48-0x0;var _0x51e7d5=_0x7101[_0x24fe48];return _0x51e7d5;};'use strict';var Sequelize=require(_0x1710('0x0'));module[_0x1710('0x1')]={'name':{'type':Sequelize[_0x1710('0x2')]},'description':{'type':Sequelize[_0x1710('0x2')]},'ticketType':{'type':Sequelize[_0x1710('0x3')]('incident',_0x1710('0x4')),'defaultValue':_0x1710('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x1710('0x6'),_0x1710('0x7')),'defaultValue':_0x1710('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1710('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x1710('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x08b3=['exports','STRING','ENUM','incident','phonecall','nothing','contact','BOOLEAN','sequelize'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x08b3,0x131));var _0x308b=function(_0x5b7ec7,_0x50bf3b){_0x5b7ec7=_0x5b7ec7-0x0;var _0x3c1fe9=_0x08b3[_0x5b7ec7];return _0x3c1fe9;};'use strict';var Sequelize=require(_0x308b('0x0'));module[_0x308b('0x1')]={'name':{'type':Sequelize[_0x308b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x308b('0x3')](_0x308b('0x4'),_0x308b('0x5')),'defaultValue':_0x308b('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x308b('0x6')),'defaultValue':_0x308b('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x308b('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x308b('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2060715..14e8ed0 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 _0x1520=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','stack','name','send','index','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','Dynamics365Configuration','then','includeAll','include','findAll','catch','show','params','create','body','find','destroy','getFields','findOne','Dynamics365Field','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x57c1d2,_0x4d8449){var _0x24218b=function(_0x56230d){while(--_0x56230d){_0x57c1d2['push'](_0x57c1d2['shift']());}};_0x24218b(++_0x4d8449);}(_0x1520,0xda));var _0x0152=function(_0x377c03,_0x523c41){_0x377c03=_0x377c03-0x0;var _0xd1d170=_0x1520[_0x377c03];return _0xd1d170;};'use strict';var emlformat=require(_0x0152('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0152('0x1'));var jsonpatch=require(_0x0152('0x2'));var rp=require(_0x0152('0x3'));var moment=require('moment');var BPromise=require(_0x0152('0x4'));var Mustache=require('mustache');var util=require(_0x0152('0x5'));var path=require(_0x0152('0x6'));var sox=require(_0x0152('0x7'));var csv=require(_0x0152('0x8'));var ejs=require(_0x0152('0x9'));var fs=require('fs');var fs_extra=require(_0x0152('0xa'));var _=require(_0x0152('0xb'));var squel=require(_0x0152('0xc'));var crypto=require(_0x0152('0xd'));var jsforce=require(_0x0152('0xe'));var deskjs=require(_0x0152('0xf'));var toCsv=require(_0x0152('0x8'));var querystring=require(_0x0152('0x10'));var Papa=require('papaparse');var Redis=require(_0x0152('0x11'));var authService=require(_0x0152('0x12'));var qs=require(_0x0152('0x13'));var as=require(_0x0152('0x14'));var hardwareService=require(_0x0152('0x15'));var logger=require('../../config/logger')(_0x0152('0x16'));var utils=require(_0x0152('0x17'));var config=require(_0x0152('0x18'));var licenseUtil=require(_0x0152('0x19'));var db=require(_0x0152('0x1a'))['db'];function respondWithStatusCode(_0x3ef69e,_0x2da51d){_0x2da51d=_0x2da51d||0xcc;return function(_0x4049c2){if(_0x4049c2){return _0x3ef69e['sendStatus'](_0x2da51d);}return _0x3ef69e[_0x0152('0x1b')](_0x2da51d)[_0x0152('0x1c')]();};}function respondWithResult(_0xa4c99,_0x5e8d2c){_0x5e8d2c=_0x5e8d2c||0xc8;return function(_0x1a8ebd){if(_0x1a8ebd){return _0xa4c99['status'](_0x5e8d2c)['json'](_0x1a8ebd);}};}function respondWithFilteredResult(_0x4f0f5a,_0x387e93){return function(_0x88f09b){if(_0x88f09b){var _0x2bb5e2=typeof _0x387e93['offset']==='undefined'&&typeof _0x387e93[_0x0152('0x1d')]===_0x0152('0x1e');var _0x2828d2=_0x88f09b[_0x0152('0x1f')];var _0x23b449=_0x2bb5e2?0x0:_0x387e93[_0x0152('0x20')];var _0xfe49e9=_0x2bb5e2?_0x88f09b[_0x0152('0x1f')]:_0x387e93['offset']+_0x387e93[_0x0152('0x1d')];var _0x4108eb;if(_0xfe49e9>=_0x2828d2){_0xfe49e9=_0x2828d2;_0x4108eb=0xc8;}else{_0x4108eb=0xce;}_0x4f0f5a[_0x0152('0x1b')](_0x4108eb);return _0x4f0f5a[_0x0152('0x21')](_0x0152('0x22'),_0x23b449+'-'+_0xfe49e9+'/'+_0x2828d2)[_0x0152('0x23')](_0x88f09b);}return null;};}function patchUpdates(_0x5e3001){return function(_0x5a42ee){try{jsonpatch['apply'](_0x5a42ee,_0x5e3001,!![]);}catch(_0x235f4b){return BPromise[_0x0152('0x24')](_0x235f4b);}return _0x5a42ee[_0x0152('0x25')]();};}function saveUpdates(_0x270bc0,_0x5b1814){return function(_0x2d288d){if(_0x2d288d){return _0x2d288d[_0x0152('0x26')](_0x270bc0)['then'](function(_0x35ca1c){return _0x35ca1c;});}return null;};}function removeEntity(_0x5a1f57,_0x2c01d1){return function(_0x128991){if(_0x128991){return _0x128991['destroy']()['then'](function(){_0x5a1f57[_0x0152('0x1b')](0xcc)[_0x0152('0x1c')]();});}};}function handleEntityNotFound(_0x574f8b,_0x489861){return function(_0x3cb748){if(!_0x3cb748){_0x574f8b['sendStatus'](0x194);}return _0x3cb748;};}function handleError(_0x5ce1e7,_0x4d29c2){_0x4d29c2=_0x4d29c2||0x1f4;return function(_0x162e12){logger['error'](_0x162e12[_0x0152('0x27')]);if(_0x162e12[_0x0152('0x28')]){delete _0x162e12['name'];}_0x5ce1e7[_0x0152('0x1b')](_0x4d29c2)[_0x0152('0x29')](_0x162e12);};}exports[_0x0152('0x2a')]=function(_0xe7f694,_0x5bf191){var _0x3d8b18={},_0x4b92d9={},_0x3f4a1e={'count':0x0,'rows':[]};var _0x3877b2=_['map'](db['Dynamics365Configuration'][_0x0152('0x2b')],function(_0x3cddac){return{'name':_0x3cddac['fieldName'],'type':_0x3cddac[_0x0152('0x2c')]['key']};});_0x4b92d9[_0x0152('0x2d')]=_['map'](_0x3877b2,'name');_0x4b92d9[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0xe7f694[_0x0152('0x2e')]);_0x4b92d9[_0x0152('0x30')]=_[_0x0152('0x31')](_0x4b92d9[_0x0152('0x2d')],_0x4b92d9[_0x0152('0x2e')]);_0x3d8b18[_0x0152('0x32')]=_[_0x0152('0x31')](_0x4b92d9[_0x0152('0x2d')],qs[_0x0152('0x33')](_0xe7f694[_0x0152('0x2e')][_0x0152('0x33')]));_0x3d8b18[_0x0152('0x32')]=_0x3d8b18[_0x0152('0x32')][_0x0152('0x34')]?_0x3d8b18[_0x0152('0x32')]:_0x4b92d9[_0x0152('0x2d')];if(!_0xe7f694[_0x0152('0x2e')]['hasOwnProperty'](_0x0152('0x35'))){_0x3d8b18[_0x0152('0x1d')]=qs[_0x0152('0x1d')](_0xe7f694['query'][_0x0152('0x1d')]);_0x3d8b18[_0x0152('0x20')]=qs[_0x0152('0x20')](_0xe7f694[_0x0152('0x2e')][_0x0152('0x20')]);}_0x3d8b18[_0x0152('0x36')]=qs[_0x0152('0x37')](_0xe7f694[_0x0152('0x2e')][_0x0152('0x37')]);_0x3d8b18[_0x0152('0x38')]=qs[_0x0152('0x30')](_[_0x0152('0x39')](_0xe7f694[_0x0152('0x2e')],_0x4b92d9[_0x0152('0x30')]),_0x3877b2);if(_0xe7f694[_0x0152('0x2e')][_0x0152('0x3a')]){_0x3d8b18[_0x0152('0x38')]=_[_0x0152('0x3b')](_0x3d8b18[_0x0152('0x38')],{'$or':_[_0x0152('0x3c')](_0x3877b2,function(_0x22da29){if(_0x22da29[_0x0152('0x2c')]!=='VIRTUAL'){var _0x102fa5={};_0x102fa5[_0x22da29[_0x0152('0x28')]]={'$like':'%'+_0xe7f694[_0x0152('0x2e')][_0x0152('0x3a')]+'%'};return _0x102fa5;}})});}_0x3d8b18=_[_0x0152('0x3b')]({},_0x3d8b18,_0xe7f694[_0x0152('0x3d')]);var _0x36f407={'where':_0x3d8b18[_0x0152('0x38')]};return db[_0x0152('0x3e')][_0x0152('0x1f')](_0x36f407)[_0x0152('0x3f')](function(_0x198e36){_0x3f4a1e['count']=_0x198e36;if(_0xe7f694[_0x0152('0x2e')][_0x0152('0x40')]){_0x3d8b18[_0x0152('0x41')]=[{'all':!![]}];}return db[_0x0152('0x3e')][_0x0152('0x42')](_0x3d8b18);})[_0x0152('0x3f')](function(_0x3b6cf5){_0x3f4a1e['rows']=_0x3b6cf5;return _0x3f4a1e;})[_0x0152('0x3f')](respondWithFilteredResult(_0x5bf191,_0x3d8b18))[_0x0152('0x43')](handleError(_0x5bf191,null));};exports[_0x0152('0x44')]=function(_0x195223,_0x1780b0){var _0x3c0d0e={'raw':![],'where':{'id':_0x195223[_0x0152('0x45')]['id']}},_0x14e4d3={};_0x14e4d3[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x3e')]['rawAttributes']);_0x14e4d3[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x195223[_0x0152('0x2e')]);_0x14e4d3['filters']=_[_0x0152('0x31')](_0x14e4d3[_0x0152('0x2d')],_0x14e4d3[_0x0152('0x2e')]);_0x3c0d0e[_0x0152('0x32')]=_[_0x0152('0x31')](_0x14e4d3['model'],qs[_0x0152('0x33')](_0x195223['query']['fields']));_0x3c0d0e[_0x0152('0x32')]=_0x3c0d0e[_0x0152('0x32')][_0x0152('0x34')]?_0x3c0d0e[_0x0152('0x32')]:_0x14e4d3[_0x0152('0x2d')];if(_0x195223[_0x0152('0x2e')][_0x0152('0x40')]){_0x3c0d0e[_0x0152('0x41')]=[{'all':!![]}];}_0x3c0d0e=_[_0x0152('0x3b')]({},_0x3c0d0e,_0x195223[_0x0152('0x3d')]);return db[_0x0152('0x3e')]['find'](_0x3c0d0e)[_0x0152('0x3f')](handleEntityNotFound(_0x1780b0,null))[_0x0152('0x3f')](respondWithResult(_0x1780b0,null))[_0x0152('0x43')](handleError(_0x1780b0,null));};exports[_0x0152('0x46')]=function(_0x1d251b,_0x5b0c6f){return db['Dynamics365Configuration'][_0x0152('0x46')](_0x1d251b['body'],{})['then'](respondWithResult(_0x5b0c6f,0xc9))[_0x0152('0x43')](handleError(_0x5b0c6f,null));};exports[_0x0152('0x26')]=function(_0x2be7b8,_0x298755){if(_0x2be7b8['body']['id']){delete _0x2be7b8[_0x0152('0x47')]['id'];}return db[_0x0152('0x3e')][_0x0152('0x48')]({'where':{'id':_0x2be7b8[_0x0152('0x45')]['id']}})['then'](handleEntityNotFound(_0x298755,null))[_0x0152('0x3f')](saveUpdates(_0x2be7b8[_0x0152('0x47')],null))[_0x0152('0x3f')](respondWithResult(_0x298755,null))['catch'](handleError(_0x298755,null));};exports[_0x0152('0x49')]=function(_0x13df15,_0x570c02){return db['Dynamics365Configuration'][_0x0152('0x48')]({'where':{'id':_0x13df15[_0x0152('0x45')]['id']}})[_0x0152('0x3f')](handleEntityNotFound(_0x570c02,null))[_0x0152('0x3f')](removeEntity(_0x570c02,null))['catch'](handleError(_0x570c02,null));};exports[_0x0152('0x4a')]=function(_0x43559b,_0x719b6c,_0x321469){var _0x3c5164={};var _0x5edeae={};var _0x242915;var _0x5deb42;return db['Dynamics365Configuration'][_0x0152('0x4b')]({'where':{'id':_0x43559b[_0x0152('0x45')]['id']}})[_0x0152('0x3f')](handleEntityNotFound(_0x719b6c,null))['then'](function(_0x16c23b){if(_0x16c23b){_0x242915=_0x16c23b;_0x5edeae[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x4c')][_0x0152('0x2b')]);_0x5edeae[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x43559b[_0x0152('0x2e')]);_0x5edeae[_0x0152('0x30')]=_['intersection'](_0x5edeae[_0x0152('0x2d')],_0x5edeae[_0x0152('0x2e')]);_0x3c5164['attributes']=_[_0x0152('0x31')](_0x5edeae['model'],qs[_0x0152('0x33')](_0x43559b[_0x0152('0x2e')][_0x0152('0x33')]));_0x3c5164[_0x0152('0x32')]=_0x3c5164[_0x0152('0x32')][_0x0152('0x34')]?_0x3c5164[_0x0152('0x32')]:_0x5edeae[_0x0152('0x2d')];_0x3c5164[_0x0152('0x36')]=qs[_0x0152('0x37')](_0x43559b[_0x0152('0x2e')][_0x0152('0x37')]);_0x3c5164[_0x0152('0x38')]=qs[_0x0152('0x30')](_['pick'](_0x43559b[_0x0152('0x2e')],_0x5edeae[_0x0152('0x30')]));if(_0x43559b['query'][_0x0152('0x3a')]){_0x3c5164[_0x0152('0x38')]=_['merge'](_0x3c5164['where'],{'$or':_[_0x0152('0x3c')](_0x3c5164[_0x0152('0x32')],function(_0x1c794e){var _0x55faf5={};_0x55faf5[_0x1c794e]={'$like':'%'+_0x43559b[_0x0152('0x2e')]['filter']+'%'};return _0x55faf5;})});}_0x3c5164=_['merge']({},_0x3c5164,_0x43559b[_0x0152('0x3d')]);return _0x242915[_0x0152('0x4a')](_0x3c5164);}})[_0x0152('0x3f')](function(_0x4129ac){if(_0x4129ac){_0x5deb42=_0x4129ac[_0x0152('0x34')];if(!_0x43559b[_0x0152('0x2e')]['hasOwnProperty'](_0x0152('0x35'))){_0x3c5164['limit']=qs[_0x0152('0x1d')](_0x43559b[_0x0152('0x2e')][_0x0152('0x1d')]);_0x3c5164[_0x0152('0x20')]=qs[_0x0152('0x20')](_0x43559b[_0x0152('0x2e')][_0x0152('0x20')]);}return _0x242915[_0x0152('0x4a')](_0x3c5164);}})[_0x0152('0x3f')](function(_0x5c52bc){if(_0x5c52bc){return _0x5c52bc?{'count':_0x5deb42,'rows':_0x5c52bc}:null;}})[_0x0152('0x3f')](respondWithResult(_0x719b6c,null))['catch'](handleError(_0x719b6c,null));};exports[_0x0152('0x4d')]=function(_0x12ede0,_0x21c103,_0x159b1d){var _0x422168={};var _0x5a0550={};var _0x5c3b88;var _0x2b9099;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x12ede0[_0x0152('0x45')]['id']}})[_0x0152('0x3f')](handleEntityNotFound(_0x21c103,null))['then'](function(_0x9176b){if(_0x9176b){_0x5c3b88=_0x9176b;_0x5a0550[_0x0152('0x2d')]=_['keys'](db[_0x0152('0x4c')][_0x0152('0x2b')]);_0x5a0550['query']=_[_0x0152('0x2f')](_0x12ede0[_0x0152('0x2e')]);_0x5a0550[_0x0152('0x30')]=_[_0x0152('0x31')](_0x5a0550[_0x0152('0x2d')],_0x5a0550[_0x0152('0x2e')]);_0x422168[_0x0152('0x32')]=_['intersection'](_0x5a0550[_0x0152('0x2d')],qs['fields'](_0x12ede0[_0x0152('0x2e')][_0x0152('0x33')]));_0x422168[_0x0152('0x32')]=_0x422168['attributes'][_0x0152('0x34')]?_0x422168[_0x0152('0x32')]:_0x5a0550['model'];_0x422168[_0x0152('0x36')]=qs['sort'](_0x12ede0[_0x0152('0x2e')][_0x0152('0x37')]);_0x422168['where']=qs[_0x0152('0x30')](_[_0x0152('0x39')](_0x12ede0[_0x0152('0x2e')],_0x5a0550[_0x0152('0x30')]));if(_0x12ede0['query']['filter']){_0x422168[_0x0152('0x38')]=_[_0x0152('0x3b')](_0x422168[_0x0152('0x38')],{'$or':_[_0x0152('0x3c')](_0x422168[_0x0152('0x32')],function(_0x605d01){var _0x187c57={};_0x187c57[_0x605d01]={'$like':'%'+_0x12ede0[_0x0152('0x2e')]['filter']+'%'};return _0x187c57;})});}_0x422168=_['merge']({},_0x422168,_0x12ede0[_0x0152('0x3d')]);return _0x5c3b88[_0x0152('0x4d')](_0x422168);}})[_0x0152('0x3f')](function(_0x10e3db){if(_0x10e3db){_0x2b9099=_0x10e3db[_0x0152('0x34')];if(!_0x12ede0['query'][_0x0152('0x4e')]('nolimit')){_0x422168[_0x0152('0x1d')]=qs['limit'](_0x12ede0[_0x0152('0x2e')]['limit']);_0x422168[_0x0152('0x20')]=qs['offset'](_0x12ede0[_0x0152('0x2e')][_0x0152('0x20')]);}return _0x5c3b88['getSubjects'](_0x422168);}})[_0x0152('0x3f')](function(_0x34d333){if(_0x34d333){return _0x34d333?{'count':_0x2b9099,'rows':_0x34d333}:null;}})[_0x0152('0x3f')](respondWithResult(_0x21c103,null))[_0x0152('0x43')](handleError(_0x21c103,null));};exports[_0x0152('0x4f')]=function(_0x22965b,_0x14262e,_0x3cd47a){var _0x20ae5e={};var _0x3fb33b={};var _0x292b2e;var _0x2e1baa;return db[_0x0152('0x3e')]['findOne']({'where':{'id':_0x22965b['params']['id']}})['then'](handleEntityNotFound(_0x14262e,null))[_0x0152('0x3f')](function(_0x4a05b6){if(_0x4a05b6){_0x292b2e=_0x4a05b6;_0x3fb33b[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x4c')][_0x0152('0x2b')]);_0x3fb33b[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x22965b[_0x0152('0x2e')]);_0x3fb33b[_0x0152('0x30')]=_[_0x0152('0x31')](_0x3fb33b[_0x0152('0x2d')],_0x3fb33b[_0x0152('0x2e')]);_0x20ae5e[_0x0152('0x32')]=_[_0x0152('0x31')](_0x3fb33b['model'],qs[_0x0152('0x33')](_0x22965b[_0x0152('0x2e')]['fields']));_0x20ae5e[_0x0152('0x32')]=_0x20ae5e[_0x0152('0x32')][_0x0152('0x34')]?_0x20ae5e[_0x0152('0x32')]:_0x3fb33b[_0x0152('0x2d')];_0x20ae5e[_0x0152('0x36')]=qs['sort'](_0x22965b[_0x0152('0x2e')][_0x0152('0x37')]);_0x20ae5e[_0x0152('0x38')]=qs[_0x0152('0x30')](_['pick'](_0x22965b[_0x0152('0x2e')],_0x3fb33b['filters']));if(_0x22965b[_0x0152('0x2e')]['filter']){_0x20ae5e[_0x0152('0x38')]=_[_0x0152('0x3b')](_0x20ae5e['where'],{'$or':_[_0x0152('0x3c')](_0x20ae5e[_0x0152('0x32')],function(_0x56a768){var _0x322286={};_0x322286[_0x56a768]={'$like':'%'+_0x22965b[_0x0152('0x2e')]['filter']+'%'};return _0x322286;})});}_0x20ae5e=_[_0x0152('0x3b')]({},_0x20ae5e,_0x22965b[_0x0152('0x3d')]);return _0x292b2e[_0x0152('0x4f')](_0x20ae5e);}})[_0x0152('0x3f')](function(_0x3c89f4){if(_0x3c89f4){_0x2e1baa=_0x3c89f4[_0x0152('0x34')];if(!_0x22965b[_0x0152('0x2e')][_0x0152('0x4e')](_0x0152('0x35'))){_0x20ae5e[_0x0152('0x1d')]=qs['limit'](_0x22965b['query'][_0x0152('0x1d')]);_0x20ae5e[_0x0152('0x20')]=qs['offset'](_0x22965b[_0x0152('0x2e')][_0x0152('0x20')]);}return _0x292b2e[_0x0152('0x4f')](_0x20ae5e);}})['then'](function(_0x1d4b01){if(_0x1d4b01){return _0x1d4b01?{'count':_0x2e1baa,'rows':_0x1d4b01}:null;}})[_0x0152('0x3f')](respondWithResult(_0x14262e,null))['catch'](handleError(_0x14262e,null));}; \ No newline at end of file +var _0xc602=['count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','params','find','catch','create','body','destroy','findOne','Dynamics365Field','merge','getFields','getSubjects','options','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x547533,_0x870c79){var _0x12eac2=function(_0x4cce67){while(--_0x4cce67){_0x547533['push'](_0x547533['shift']());}};_0x12eac2(++_0x870c79);}(_0xc602,0x83));var _0x2c60=function(_0x228e72,_0x3dc34c){_0x228e72=_0x228e72-0x0;var _0x1a88f8=_0xc602[_0x228e72];return _0x1a88f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c60('0x0'));var zipdir=require(_0x2c60('0x1'));var jsonpatch=require(_0x2c60('0x2'));var rp=require(_0x2c60('0x3'));var moment=require('moment');var BPromise=require(_0x2c60('0x4'));var Mustache=require(_0x2c60('0x5'));var util=require(_0x2c60('0x6'));var path=require(_0x2c60('0x7'));var sox=require('sox');var csv=require(_0x2c60('0x8'));var ejs=require(_0x2c60('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c60('0xa'));var squel=require('squel');var crypto=require(_0x2c60('0xb'));var jsforce=require(_0x2c60('0xc'));var deskjs=require(_0x2c60('0xd'));var toCsv=require(_0x2c60('0x8'));var querystring=require(_0x2c60('0xe'));var Papa=require(_0x2c60('0xf'));var Redis=require(_0x2c60('0x10'));var authService=require(_0x2c60('0x11'));var qs=require(_0x2c60('0x12'));var as=require(_0x2c60('0x13'));var hardwareService=require(_0x2c60('0x14'));var logger=require(_0x2c60('0x15'))(_0x2c60('0x16'));var utils=require('../../config/utils');var config=require(_0x2c60('0x17'));var licenseUtil=require(_0x2c60('0x18'));var db=require(_0x2c60('0x19'))['db'];function respondWithStatusCode(_0x344139,_0x3a4ad3){_0x3a4ad3=_0x3a4ad3||0xcc;return function(_0x52d080){if(_0x52d080){return _0x344139[_0x2c60('0x1a')](_0x3a4ad3);}return _0x344139['status'](_0x3a4ad3)[_0x2c60('0x1b')]();};}function respondWithResult(_0x516ef4,_0x3a636c){_0x3a636c=_0x3a636c||0xc8;return function(_0x1a72c4){if(_0x1a72c4){return _0x516ef4[_0x2c60('0x1c')](_0x3a636c)['json'](_0x1a72c4);}};}function respondWithFilteredResult(_0x4b2993,_0x3f7d6e){return function(_0x13a21b){if(_0x13a21b){var _0x36b601=typeof _0x3f7d6e[_0x2c60('0x1d')]===_0x2c60('0x1e')&&typeof _0x3f7d6e['limit']===_0x2c60('0x1e');var _0x5ee4a2=_0x13a21b[_0x2c60('0x1f')];var _0xf73bbb=_0x36b601?0x0:_0x3f7d6e['offset'];var _0x5bbf69=_0x36b601?_0x13a21b['count']:_0x3f7d6e[_0x2c60('0x1d')]+_0x3f7d6e[_0x2c60('0x20')];var _0x7e66b1;if(_0x5bbf69>=_0x5ee4a2){_0x5bbf69=_0x5ee4a2;_0x7e66b1=0xc8;}else{_0x7e66b1=0xce;}_0x4b2993[_0x2c60('0x1c')](_0x7e66b1);return _0x4b2993[_0x2c60('0x21')](_0x2c60('0x22'),_0xf73bbb+'-'+_0x5bbf69+'/'+_0x5ee4a2)[_0x2c60('0x23')](_0x13a21b);}return null;};}function patchUpdates(_0x174d16){return function(_0x309983){try{jsonpatch[_0x2c60('0x24')](_0x309983,_0x174d16,!![]);}catch(_0x11c480){return BPromise[_0x2c60('0x25')](_0x11c480);}return _0x309983[_0x2c60('0x26')]();};}function saveUpdates(_0x265df9,_0x472729){return function(_0x4ef830){if(_0x4ef830){return _0x4ef830['update'](_0x265df9)[_0x2c60('0x27')](function(_0x35aaa4){return _0x35aaa4;});}return null;};}function removeEntity(_0xc556e3,_0x4f8634){return function(_0x319941){if(_0x319941){return _0x319941['destroy']()[_0x2c60('0x27')](function(){_0xc556e3[_0x2c60('0x1c')](0xcc)[_0x2c60('0x1b')]();});}};}function handleEntityNotFound(_0x47bf17,_0x35e42b){return function(_0x5c99d1){if(!_0x5c99d1){_0x47bf17[_0x2c60('0x1a')](0x194);}return _0x5c99d1;};}function handleError(_0x398270,_0x5b88e2){_0x5b88e2=_0x5b88e2||0x1f4;return function(_0x3edd25){logger[_0x2c60('0x28')](_0x3edd25[_0x2c60('0x29')]);if(_0x3edd25[_0x2c60('0x2a')]){delete _0x3edd25['name'];}_0x398270[_0x2c60('0x1c')](_0x5b88e2)[_0x2c60('0x2b')](_0x3edd25);};}exports[_0x2c60('0x2c')]=function(_0x285a7f,_0x2bc1ce){var _0xfa0ca4={},_0x52a813={},_0x1b80f0={'count':0x0,'rows':[]};var _0x11b7b8=_['map'](db[_0x2c60('0x2d')][_0x2c60('0x2e')],function(_0x11cc61){return{'name':_0x11cc61[_0x2c60('0x2f')],'type':_0x11cc61['type']['key']};});_0x52a813[_0x2c60('0x30')]=_[_0x2c60('0x31')](_0x11b7b8,_0x2c60('0x2a'));_0x52a813[_0x2c60('0x32')]=_[_0x2c60('0x33')](_0x285a7f[_0x2c60('0x32')]);_0x52a813[_0x2c60('0x34')]=_[_0x2c60('0x35')](_0x52a813[_0x2c60('0x30')],_0x52a813['query']);_0xfa0ca4[_0x2c60('0x36')]=_[_0x2c60('0x35')](_0x52a813[_0x2c60('0x30')],qs[_0x2c60('0x37')](_0x285a7f[_0x2c60('0x32')][_0x2c60('0x37')]));_0xfa0ca4[_0x2c60('0x36')]=_0xfa0ca4[_0x2c60('0x36')][_0x2c60('0x38')]?_0xfa0ca4[_0x2c60('0x36')]:_0x52a813[_0x2c60('0x30')];if(!_0x285a7f[_0x2c60('0x32')][_0x2c60('0x39')](_0x2c60('0x3a'))){_0xfa0ca4['limit']=qs[_0x2c60('0x20')](_0x285a7f['query'][_0x2c60('0x20')]);_0xfa0ca4[_0x2c60('0x1d')]=qs[_0x2c60('0x1d')](_0x285a7f[_0x2c60('0x32')][_0x2c60('0x1d')]);}_0xfa0ca4[_0x2c60('0x3b')]=qs[_0x2c60('0x3c')](_0x285a7f[_0x2c60('0x32')][_0x2c60('0x3c')]);_0xfa0ca4[_0x2c60('0x3d')]=qs[_0x2c60('0x34')](_[_0x2c60('0x3e')](_0x285a7f['query'],_0x52a813[_0x2c60('0x34')]),_0x11b7b8);if(_0x285a7f[_0x2c60('0x32')][_0x2c60('0x3f')]){_0xfa0ca4[_0x2c60('0x3d')]=_['merge'](_0xfa0ca4[_0x2c60('0x3d')],{'$or':_[_0x2c60('0x31')](_0x11b7b8,function(_0x5524d0){if(_0x5524d0[_0x2c60('0x40')]!==_0x2c60('0x41')){var _0x5236b9={};_0x5236b9[_0x5524d0[_0x2c60('0x2a')]]={'$like':'%'+_0x285a7f[_0x2c60('0x32')][_0x2c60('0x3f')]+'%'};return _0x5236b9;}})});}_0xfa0ca4=_['merge']({},_0xfa0ca4,_0x285a7f['options']);var _0x4722fb={'where':_0xfa0ca4['where']};return db[_0x2c60('0x2d')]['count'](_0x4722fb)[_0x2c60('0x27')](function(_0xa8a311){_0x1b80f0[_0x2c60('0x1f')]=_0xa8a311;if(_0x285a7f[_0x2c60('0x32')][_0x2c60('0x42')]){_0xfa0ca4[_0x2c60('0x43')]=[{'all':!![]}];}return db[_0x2c60('0x2d')]['findAll'](_0xfa0ca4);})[_0x2c60('0x27')](function(_0x2cadd2){_0x1b80f0['rows']=_0x2cadd2;return _0x1b80f0;})[_0x2c60('0x27')](respondWithFilteredResult(_0x2bc1ce,_0xfa0ca4))['catch'](handleError(_0x2bc1ce,null));};exports['show']=function(_0x431512,_0x45eaf3){var _0x1fdfcd={'raw':![],'where':{'id':_0x431512[_0x2c60('0x44')]['id']}},_0x601a61={};_0x601a61['model']=_['keys'](db[_0x2c60('0x2d')][_0x2c60('0x2e')]);_0x601a61[_0x2c60('0x32')]=_['keys'](_0x431512['query']);_0x601a61[_0x2c60('0x34')]=_[_0x2c60('0x35')](_0x601a61[_0x2c60('0x30')],_0x601a61[_0x2c60('0x32')]);_0x1fdfcd[_0x2c60('0x36')]=_[_0x2c60('0x35')](_0x601a61[_0x2c60('0x30')],qs[_0x2c60('0x37')](_0x431512[_0x2c60('0x32')]['fields']));_0x1fdfcd[_0x2c60('0x36')]=_0x1fdfcd[_0x2c60('0x36')][_0x2c60('0x38')]?_0x1fdfcd[_0x2c60('0x36')]:_0x601a61[_0x2c60('0x30')];if(_0x431512['query'][_0x2c60('0x42')]){_0x1fdfcd['include']=[{'all':!![]}];}_0x1fdfcd=_['merge']({},_0x1fdfcd,_0x431512['options']);return db['Dynamics365Configuration'][_0x2c60('0x45')](_0x1fdfcd)['then'](handleEntityNotFound(_0x45eaf3,null))[_0x2c60('0x27')](respondWithResult(_0x45eaf3,null))[_0x2c60('0x46')](handleError(_0x45eaf3,null));};exports[_0x2c60('0x47')]=function(_0x4527a1,_0x2c5847){return db[_0x2c60('0x2d')][_0x2c60('0x47')](_0x4527a1[_0x2c60('0x48')],{})['then'](respondWithResult(_0x2c5847,0xc9))['catch'](handleError(_0x2c5847,null));};exports['update']=function(_0x4c8b23,_0xc48b14){if(_0x4c8b23[_0x2c60('0x48')]['id']){delete _0x4c8b23[_0x2c60('0x48')]['id'];}return db[_0x2c60('0x2d')][_0x2c60('0x45')]({'where':{'id':_0x4c8b23[_0x2c60('0x44')]['id']}})[_0x2c60('0x27')](handleEntityNotFound(_0xc48b14,null))[_0x2c60('0x27')](saveUpdates(_0x4c8b23[_0x2c60('0x48')],null))[_0x2c60('0x27')](respondWithResult(_0xc48b14,null))[_0x2c60('0x46')](handleError(_0xc48b14,null));};exports[_0x2c60('0x49')]=function(_0x960005,_0x2cb6f0){return db['Dynamics365Configuration'][_0x2c60('0x45')]({'where':{'id':_0x960005[_0x2c60('0x44')]['id']}})[_0x2c60('0x27')](handleEntityNotFound(_0x2cb6f0,null))[_0x2c60('0x27')](removeEntity(_0x2cb6f0,null))[_0x2c60('0x46')](handleError(_0x2cb6f0,null));};exports['getFields']=function(_0xed349e,_0x3cf3e9,_0x4dc85b){var _0x320f68={};var _0x2a8773={};var _0x5660e8;var _0x3757f3;return db['Dynamics365Configuration'][_0x2c60('0x4a')]({'where':{'id':_0xed349e['params']['id']}})['then'](handleEntityNotFound(_0x3cf3e9,null))[_0x2c60('0x27')](function(_0x32aa5e){if(_0x32aa5e){_0x5660e8=_0x32aa5e;_0x2a8773[_0x2c60('0x30')]=_[_0x2c60('0x33')](db[_0x2c60('0x4b')][_0x2c60('0x2e')]);_0x2a8773[_0x2c60('0x32')]=_[_0x2c60('0x33')](_0xed349e[_0x2c60('0x32')]);_0x2a8773[_0x2c60('0x34')]=_[_0x2c60('0x35')](_0x2a8773[_0x2c60('0x30')],_0x2a8773[_0x2c60('0x32')]);_0x320f68['attributes']=_[_0x2c60('0x35')](_0x2a8773[_0x2c60('0x30')],qs[_0x2c60('0x37')](_0xed349e['query']['fields']));_0x320f68['attributes']=_0x320f68[_0x2c60('0x36')]['length']?_0x320f68[_0x2c60('0x36')]:_0x2a8773['model'];_0x320f68['order']=qs[_0x2c60('0x3c')](_0xed349e['query'][_0x2c60('0x3c')]);_0x320f68[_0x2c60('0x3d')]=qs[_0x2c60('0x34')](_[_0x2c60('0x3e')](_0xed349e[_0x2c60('0x32')],_0x2a8773['filters']));if(_0xed349e[_0x2c60('0x32')]['filter']){_0x320f68['where']=_[_0x2c60('0x4c')](_0x320f68[_0x2c60('0x3d')],{'$or':_[_0x2c60('0x31')](_0x320f68[_0x2c60('0x36')],function(_0x152d06){var _0x39011b={};_0x39011b[_0x152d06]={'$like':'%'+_0xed349e['query'][_0x2c60('0x3f')]+'%'};return _0x39011b;})});}_0x320f68=_[_0x2c60('0x4c')]({},_0x320f68,_0xed349e['options']);return _0x5660e8[_0x2c60('0x4d')](_0x320f68);}})[_0x2c60('0x27')](function(_0x1bdbcb){if(_0x1bdbcb){_0x3757f3=_0x1bdbcb[_0x2c60('0x38')];if(!_0xed349e[_0x2c60('0x32')]['hasOwnProperty'](_0x2c60('0x3a'))){_0x320f68[_0x2c60('0x20')]=qs['limit'](_0xed349e[_0x2c60('0x32')]['limit']);_0x320f68[_0x2c60('0x1d')]=qs['offset'](_0xed349e[_0x2c60('0x32')][_0x2c60('0x1d')]);}return _0x5660e8[_0x2c60('0x4d')](_0x320f68);}})['then'](function(_0x4f5df1){if(_0x4f5df1){return _0x4f5df1?{'count':_0x3757f3,'rows':_0x4f5df1}:null;}})[_0x2c60('0x27')](respondWithResult(_0x3cf3e9,null))[_0x2c60('0x46')](handleError(_0x3cf3e9,null));};exports[_0x2c60('0x4e')]=function(_0x5e8867,_0x3365ca,_0x500e18){var _0x4dd886={};var _0x303634={};var _0x425e73;var _0x546896;return db[_0x2c60('0x2d')][_0x2c60('0x4a')]({'where':{'id':_0x5e8867[_0x2c60('0x44')]['id']}})[_0x2c60('0x27')](handleEntityNotFound(_0x3365ca,null))[_0x2c60('0x27')](function(_0x1b4da3){if(_0x1b4da3){_0x425e73=_0x1b4da3;_0x303634[_0x2c60('0x30')]=_[_0x2c60('0x33')](db[_0x2c60('0x4b')][_0x2c60('0x2e')]);_0x303634[_0x2c60('0x32')]=_[_0x2c60('0x33')](_0x5e8867[_0x2c60('0x32')]);_0x303634['filters']=_[_0x2c60('0x35')](_0x303634[_0x2c60('0x30')],_0x303634['query']);_0x4dd886[_0x2c60('0x36')]=_[_0x2c60('0x35')](_0x303634[_0x2c60('0x30')],qs[_0x2c60('0x37')](_0x5e8867[_0x2c60('0x32')][_0x2c60('0x37')]));_0x4dd886[_0x2c60('0x36')]=_0x4dd886[_0x2c60('0x36')][_0x2c60('0x38')]?_0x4dd886[_0x2c60('0x36')]:_0x303634[_0x2c60('0x30')];_0x4dd886['order']=qs['sort'](_0x5e8867[_0x2c60('0x32')][_0x2c60('0x3c')]);_0x4dd886[_0x2c60('0x3d')]=qs['filters'](_[_0x2c60('0x3e')](_0x5e8867[_0x2c60('0x32')],_0x303634['filters']));if(_0x5e8867[_0x2c60('0x32')]['filter']){_0x4dd886['where']=_[_0x2c60('0x4c')](_0x4dd886[_0x2c60('0x3d')],{'$or':_[_0x2c60('0x31')](_0x4dd886[_0x2c60('0x36')],function(_0x233acd){var _0x45c829={};_0x45c829[_0x233acd]={'$like':'%'+_0x5e8867[_0x2c60('0x32')][_0x2c60('0x3f')]+'%'};return _0x45c829;})});}_0x4dd886=_[_0x2c60('0x4c')]({},_0x4dd886,_0x5e8867[_0x2c60('0x4f')]);return _0x425e73['getSubjects'](_0x4dd886);}})['then'](function(_0x4b8ab1){if(_0x4b8ab1){_0x546896=_0x4b8ab1[_0x2c60('0x38')];if(!_0x5e8867[_0x2c60('0x32')][_0x2c60('0x39')](_0x2c60('0x3a'))){_0x4dd886[_0x2c60('0x20')]=qs[_0x2c60('0x20')](_0x5e8867[_0x2c60('0x32')][_0x2c60('0x20')]);_0x4dd886[_0x2c60('0x1d')]=qs[_0x2c60('0x1d')](_0x5e8867['query'][_0x2c60('0x1d')]);}return _0x425e73[_0x2c60('0x4e')](_0x4dd886);}})[_0x2c60('0x27')](function(_0x16720f){if(_0x16720f){return _0x16720f?{'count':_0x546896,'rows':_0x16720f}:null;}})[_0x2c60('0x27')](respondWithResult(_0x3365ca,null))[_0x2c60('0x46')](handleError(_0x3365ca,null));};exports['getDescriptions']=function(_0x164b8d,_0x40d7fb,_0x256ed9){var _0x49e8f2={};var _0x16bf35={};var _0x4c110e;var _0x1671d0;return db[_0x2c60('0x2d')][_0x2c60('0x4a')]({'where':{'id':_0x164b8d[_0x2c60('0x44')]['id']}})['then'](handleEntityNotFound(_0x40d7fb,null))[_0x2c60('0x27')](function(_0x393e31){if(_0x393e31){_0x4c110e=_0x393e31;_0x16bf35[_0x2c60('0x30')]=_['keys'](db[_0x2c60('0x4b')]['rawAttributes']);_0x16bf35[_0x2c60('0x32')]=_[_0x2c60('0x33')](_0x164b8d[_0x2c60('0x32')]);_0x16bf35[_0x2c60('0x34')]=_[_0x2c60('0x35')](_0x16bf35[_0x2c60('0x30')],_0x16bf35['query']);_0x49e8f2[_0x2c60('0x36')]=_['intersection'](_0x16bf35['model'],qs['fields'](_0x164b8d[_0x2c60('0x32')][_0x2c60('0x37')]));_0x49e8f2[_0x2c60('0x36')]=_0x49e8f2[_0x2c60('0x36')]['length']?_0x49e8f2[_0x2c60('0x36')]:_0x16bf35['model'];_0x49e8f2[_0x2c60('0x3b')]=qs[_0x2c60('0x3c')](_0x164b8d[_0x2c60('0x32')][_0x2c60('0x3c')]);_0x49e8f2['where']=qs[_0x2c60('0x34')](_['pick'](_0x164b8d['query'],_0x16bf35[_0x2c60('0x34')]));if(_0x164b8d[_0x2c60('0x32')][_0x2c60('0x3f')]){_0x49e8f2[_0x2c60('0x3d')]=_['merge'](_0x49e8f2[_0x2c60('0x3d')],{'$or':_['map'](_0x49e8f2['attributes'],function(_0x33330a){var _0x18730a={};_0x18730a[_0x33330a]={'$like':'%'+_0x164b8d[_0x2c60('0x32')]['filter']+'%'};return _0x18730a;})});}_0x49e8f2=_[_0x2c60('0x4c')]({},_0x49e8f2,_0x164b8d['options']);return _0x4c110e[_0x2c60('0x50')](_0x49e8f2);}})[_0x2c60('0x27')](function(_0x3ebdf8){if(_0x3ebdf8){_0x1671d0=_0x3ebdf8[_0x2c60('0x38')];if(!_0x164b8d[_0x2c60('0x32')][_0x2c60('0x39')](_0x2c60('0x3a'))){_0x49e8f2[_0x2c60('0x20')]=qs[_0x2c60('0x20')](_0x164b8d[_0x2c60('0x32')][_0x2c60('0x20')]);_0x49e8f2['offset']=qs['offset'](_0x164b8d[_0x2c60('0x32')][_0x2c60('0x1d')]);}return _0x4c110e[_0x2c60('0x50')](_0x49e8f2);}})[_0x2c60('0x27')](function(_0x104356){if(_0x104356){return _0x104356?{'count':_0x1671d0,'rows':_0x104356}:null;}})[_0x2c60('0x27')](respondWithResult(_0x40d7fb,null))[_0x2c60('0x46')](handleError(_0x40d7fb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f327e3e..84f85a0 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x9a19,0x114));var _0x99a1=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x9a19[_0x2cc569];return _0x1bfc2e;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x1dfa31,_0x466d93){var _0x5dee10=function(_0x227710){while(--_0x227710){_0x1dfa31['push'](_0x1dfa31['shift']());}};_0x5dee10(++_0x466d93);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('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 5753721..03a1d0c 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 _0x07e0=['error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x346df7,_0x3404ad){var _0x504fd8=function(_0x5874e6){while(--_0x5874e6){_0x346df7['push'](_0x346df7['shift']());}};_0x504fd8(++_0x3404ad);}(_0x07e0,0x1cb));var _0x007e=function(_0x5b5226,_0x471fe7){_0x5b5226=_0x5b5226-0x0;var _0x14f76e=_0x07e0[_0x5b5226];return _0x14f76e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x007e('0x0'));var BPromise=require(_0x007e('0x1'));var rs=require(_0x007e('0x2'));var fs=require('fs');var Redis=require(_0x007e('0x3'));var db=require(_0x007e('0x4'))['db'];var utils=require(_0x007e('0x5'));var logger=require(_0x007e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x007e('0x7'));var client=jayson[_0x007e('0x8')][_0x007e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44e628,_0x3e4adb,_0x2e0978){return new BPromise(function(_0x2f3564,_0x4c8f49){return client[_0x007e('0xa')](_0x44e628,_0x2e0978)[_0x007e('0xb')](function(_0x21ac2c){logger[_0x007e('0xc')](_0x007e('0xd'),_0x3e4adb,_0x007e('0xe'));logger[_0x007e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3e4adb,_0x007e('0xe'),JSON['stringify'](_0x21ac2c));if(_0x21ac2c[_0x007e('0x10')]){if(_0x21ac2c[_0x007e('0x10')]['code']===0x1f4){logger[_0x007e('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3e4adb,_0x21ac2c['error'][_0x007e('0x11')]);return _0x4c8f49(_0x21ac2c[_0x007e('0x10')][_0x007e('0x11')]);}logger[_0x007e('0x10')](_0x007e('0xd'),_0x3e4adb,_0x21ac2c['error']['message']);return _0x2f3564(_0x21ac2c[_0x007e('0x10')]['message']);}else{logger[_0x007e('0xc')](_0x007e('0xd'),_0x3e4adb,'request\x20sent');_0x2f3564(_0x21ac2c[_0x007e('0x12')]['message']);}})['catch'](function(_0x1fa01e){logger[_0x007e('0x10')](_0x007e('0xd'),_0x3e4adb,_0x1fa01e);_0x4c8f49(_0x1fa01e);});});} \ No newline at end of file +var _0xb25a=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x56e2a0,_0x13b891){var _0x1b3b78=function(_0x79e8b1){while(--_0x79e8b1){_0x56e2a0['push'](_0x56e2a0['shift']());}};_0x1b3b78(++_0x13b891);}(_0xb25a,0x156));var _0xab25=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb25a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xab25('0x0'));var util=require(_0xab25('0x1'));var moment=require(_0xab25('0x2'));var BPromise=require(_0xab25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab25('0x4'));var db=require(_0xab25('0x5'))['db'];var utils=require(_0xab25('0x6'));var logger=require(_0xab25('0x7'))(_0xab25('0x8'));var config=require('../../config/environment');var jayson=require(_0xab25('0x9'));var client=jayson[_0xab25('0xa')][_0xab25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49b8c3,_0x366a1a,_0x1ee61a){return new BPromise(function(_0x1c9e89,_0x5ab53e){return client[_0xab25('0xc')](_0x49b8c3,_0x1ee61a)[_0xab25('0xd')](function(_0x15357f){logger[_0xab25('0xe')](_0xab25('0xf'),_0x366a1a,_0xab25('0x10'));logger['debug'](_0xab25('0x11'),_0x366a1a,_0xab25('0x10'),JSON[_0xab25('0x12')](_0x15357f));if(_0x15357f[_0xab25('0x13')]){if(_0x15357f[_0xab25('0x13')]['code']===0x1f4){logger[_0xab25('0x13')](_0xab25('0xf'),_0x366a1a,_0x15357f[_0xab25('0x13')]['message']);return _0x5ab53e(_0x15357f[_0xab25('0x13')][_0xab25('0x14')]);}logger[_0xab25('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x366a1a,_0x15357f[_0xab25('0x13')]['message']);return _0x1c9e89(_0x15357f[_0xab25('0x13')]['message']);}else{logger[_0xab25('0xe')](_0xab25('0xf'),_0x366a1a,_0xab25('0x10'));_0x1c9e89(_0x15357f['result'][_0xab25('0x14')]);}})['catch'](function(_0x5bff11){logger['error'](_0xab25('0xf'),_0x366a1a,_0x5bff11);_0x5ab53e(_0x5bff11);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e7db332..9ef9bfa 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 _0x729b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x19fbdc,_0x2e1d6a){var _0x176533=function(_0x9003da){while(--_0x9003da){_0x19fbdc['push'](_0x19fbdc['shift']());}};_0x176533(++_0x2e1d6a);}(_0x729b,0x127));var _0xb729=function(_0x1cb95e,_0x3893c5){_0x1cb95e=_0x1cb95e-0x0;var _0x816fa7=_0x729b[_0x1cb95e];return _0x816fa7;};'use strict';var multer=require(_0xb729('0x0'));var util=require(_0xb729('0x1'));var path=require(_0xb729('0x2'));var timeout=require('connect-timeout');var express=require(_0xb729('0x3'));var router=express[_0xb729('0x4')]();var fs_extra=require(_0xb729('0x5'));var auth=require(_0xb729('0x6'));var interaction=require(_0xb729('0x7'));var config=require(_0xb729('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xb729('0x9')]('/',auth[_0xb729('0xa')](),controller[_0xb729('0xb')]);router[_0xb729('0x9')](_0xb729('0xc'),auth[_0xb729('0xa')](),controller[_0xb729('0xd')]);router[_0xb729('0xe')]('/',auth[_0xb729('0xa')](),controller[_0xb729('0xf')]);router[_0xb729('0x10')]('/:id',auth[_0xb729('0xa')](),controller[_0xb729('0x11')]);router['delete'](_0xb729('0xc'),auth[_0xb729('0xa')](),controller[_0xb729('0x12')]);module[_0xb729('0x13')]=router; \ No newline at end of file +var _0x0857=['get','isAuthenticated','/:id','show','create','put','update','delete','destroy','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller'];(function(_0x15f22a,_0x447960){var _0x45360a=function(_0x469eb8){while(--_0x469eb8){_0x15f22a['push'](_0x15f22a['shift']());}};_0x45360a(++_0x447960);}(_0x0857,0x72));var _0x7085=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x0857[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7085('0x0'));var timeout=require('connect-timeout');var express=require(_0x7085('0x1'));var router=express['Router']();var fs_extra=require(_0x7085('0x2'));var auth=require(_0x7085('0x3'));var interaction=require(_0x7085('0x4'));var config=require('../../config/environment');var controller=require(_0x7085('0x5'));router[_0x7085('0x6')]('/',auth[_0x7085('0x7')](),controller['index']);router['get'](_0x7085('0x8'),auth['isAuthenticated'](),controller[_0x7085('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7085('0xa')]);router[_0x7085('0xb')](_0x7085('0x8'),auth[_0x7085('0x7')](),controller[_0x7085('0xc')]);router[_0x7085('0xd')](_0x7085('0x8'),auth['isAuthenticated'](),controller[_0x7085('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 45c70a4..677864a 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 _0x493b=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x493b,0xdd));var _0xb493=function(_0x1f449e,_0x93345c){_0x1f449e=_0x1f449e-0x0;var _0x14b7c9=_0x493b[_0x1f449e];return _0x14b7c9;};'use strict';var Sequelize=require(_0xb493('0x0'));module[_0xb493('0x1')]={'type':{'type':Sequelize[_0xb493('0x2')](_0xb493('0x3'),_0xb493('0x4'),_0xb493('0x5'),_0xb493('0x6'),_0xb493('0x7')),'defaultValue':_0xb493('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb493('0x8')]},'keyType':{'type':Sequelize[_0xb493('0x2')](_0xb493('0x3'),_0xb493('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb493('0x8')]},'idField':{'type':Sequelize[_0xb493('0x8')]},'nameField':{'type':Sequelize[_0xb493('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb493('0x8')]}}; \ No newline at end of file +var _0x5276=['STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue','picklist'];(function(_0x32ef4e,_0x1b96f9){var _0x457831=function(_0x1e8ef6){while(--_0x1e8ef6){_0x32ef4e['push'](_0x32ef4e['shift']());}};_0x457831(++_0x1b96f9);}(_0x5276,0x90));var _0x6527=function(_0x1a0d5c,_0x3a2c6a){_0x1a0d5c=_0x1a0d5c-0x0;var _0xc5649=_0x5276[_0x1a0d5c];return _0xc5649;};'use strict';var Sequelize=require(_0x6527('0x0'));module[_0x6527('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6527('0x2'),_0x6527('0x3'),'customVariable',_0x6527('0x4'),_0x6527('0x5')),'defaultValue':_0x6527('0x2')},'content':{'type':Sequelize[_0x6527('0x6')]},'key':{'type':Sequelize[_0x6527('0x6')]},'keyType':{'type':Sequelize[_0x6527('0x7')](_0x6527('0x2'),_0x6527('0x3'),_0x6527('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6527('0x6')]},'nameField':{'type':Sequelize[_0x6527('0x6')]},'customField':{'type':Sequelize[_0x6527('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 56f971c..17dc92a 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 _0x3d3d=['create','body','catch','eml-format','rimraf','request-promise','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','name','index','Dynamics365Field','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','rawAttributes','find'];(function(_0x2acd27,_0x22ae03){var _0x5d922c=function(_0x43a5a9){while(--_0x43a5a9){_0x2acd27['push'](_0x2acd27['shift']());}};_0x5d922c(++_0x22ae03);}(_0x3d3d,0x11f));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd3d3('0x0'));var rimraf=require(_0xd3d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd3d3('0x2'));var moment=require('moment');var BPromise=require(_0xd3d3('0x3'));var Mustache=require('mustache');var util=require(_0xd3d3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd3d3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3d3('0x6'));var _=require(_0xd3d3('0x7'));var squel=require(_0xd3d3('0x8'));var crypto=require(_0xd3d3('0x9'));var jsforce=require(_0xd3d3('0xa'));var deskjs=require(_0xd3d3('0xb'));var toCsv=require(_0xd3d3('0x5'));var querystring=require('querystring');var Papa=require(_0xd3d3('0xc'));var Redis=require(_0xd3d3('0xd'));var authService=require(_0xd3d3('0xe'));var qs=require(_0xd3d3('0xf'));var as=require(_0xd3d3('0x10'));var hardwareService=require(_0xd3d3('0x11'));var logger=require(_0xd3d3('0x12'))(_0xd3d3('0x13'));var utils=require('../../config/utils');var config=require(_0xd3d3('0x14'));var licenseUtil=require(_0xd3d3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce541,_0x415ddf){_0x415ddf=_0x415ddf||0xcc;return function(_0x2ee1e3){if(_0x2ee1e3){return _0x3ce541[_0xd3d3('0x16')](_0x415ddf);}return _0x3ce541[_0xd3d3('0x17')](_0x415ddf)[_0xd3d3('0x18')]();};}function respondWithResult(_0x51577c,_0x5b8c2c){_0x5b8c2c=_0x5b8c2c||0xc8;return function(_0xa098c2){if(_0xa098c2){return _0x51577c[_0xd3d3('0x17')](_0x5b8c2c)['json'](_0xa098c2);}};}function respondWithFilteredResult(_0x340d34,_0x327ea9){return function(_0x94956){if(_0x94956){var _0x5472b9=typeof _0x327ea9[_0xd3d3('0x19')]==='undefined'&&typeof _0x327ea9[_0xd3d3('0x1a')]===_0xd3d3('0x1b');var _0x1450f0=_0x94956[_0xd3d3('0x1c')];var _0xc8611f=_0x5472b9?0x0:_0x327ea9[_0xd3d3('0x19')];var _0x510d14=_0x5472b9?_0x94956[_0xd3d3('0x1c')]:_0x327ea9[_0xd3d3('0x19')]+_0x327ea9[_0xd3d3('0x1a')];var _0xb68d08;if(_0x510d14>=_0x1450f0){_0x510d14=_0x1450f0;_0xb68d08=0xc8;}else{_0xb68d08=0xce;}_0x340d34[_0xd3d3('0x17')](_0xb68d08);return _0x340d34[_0xd3d3('0x1d')](_0xd3d3('0x1e'),_0xc8611f+'-'+_0x510d14+'/'+_0x1450f0)[_0xd3d3('0x1f')](_0x94956);}return null;};}function patchUpdates(_0x4f1a49){return function(_0x407d24){try{jsonpatch[_0xd3d3('0x20')](_0x407d24,_0x4f1a49,!![]);}catch(_0x53b78e){return BPromise[_0xd3d3('0x21')](_0x53b78e);}return _0x407d24[_0xd3d3('0x22')]();};}function saveUpdates(_0x1e451a,_0xd3d1ca){return function(_0x4e8fd1){if(_0x4e8fd1){return _0x4e8fd1['update'](_0x1e451a)[_0xd3d3('0x23')](function(_0x111d29){return _0x111d29;});}return null;};}function removeEntity(_0x51ef4a,_0x5ba5de){return function(_0x48edfe){if(_0x48edfe){return _0x48edfe[_0xd3d3('0x24')]()['then'](function(){_0x51ef4a[_0xd3d3('0x17')](0xcc)[_0xd3d3('0x18')]();});}};}function handleEntityNotFound(_0x4f92f4,_0x1a6d4a){return function(_0x2593ed){if(!_0x2593ed){_0x4f92f4[_0xd3d3('0x16')](0x194);}return _0x2593ed;};}function handleError(_0x585d45,_0x215e60){_0x215e60=_0x215e60||0x1f4;return function(_0x4f3779){logger['error'](_0x4f3779['stack']);if(_0x4f3779[_0xd3d3('0x25')]){delete _0x4f3779[_0xd3d3('0x25')];}_0x585d45[_0xd3d3('0x17')](_0x215e60)['send'](_0x4f3779);};}exports[_0xd3d3('0x26')]=function(_0x4c930b,_0x44b1e1){var _0x2a70ba={},_0x35c71b={},_0x32bb8f={'count':0x0,'rows':[]};var _0x3bb529=_['map'](db[_0xd3d3('0x27')]['rawAttributes'],function(_0x54c83d){return{'name':_0x54c83d[_0xd3d3('0x28')],'type':_0x54c83d[_0xd3d3('0x29')][_0xd3d3('0x2a')]};});_0x35c71b[_0xd3d3('0x2b')]=_[_0xd3d3('0x2c')](_0x3bb529,_0xd3d3('0x25'));_0x35c71b[_0xd3d3('0x2d')]=_[_0xd3d3('0x2e')](_0x4c930b[_0xd3d3('0x2d')]);_0x35c71b[_0xd3d3('0x2f')]=_['intersection'](_0x35c71b[_0xd3d3('0x2b')],_0x35c71b['query']);_0x2a70ba[_0xd3d3('0x30')]=_[_0xd3d3('0x31')](_0x35c71b['model'],qs[_0xd3d3('0x32')](_0x4c930b[_0xd3d3('0x2d')]['fields']));_0x2a70ba[_0xd3d3('0x30')]=_0x2a70ba[_0xd3d3('0x30')][_0xd3d3('0x33')]?_0x2a70ba[_0xd3d3('0x30')]:_0x35c71b[_0xd3d3('0x2b')];if(!_0x4c930b[_0xd3d3('0x2d')][_0xd3d3('0x34')](_0xd3d3('0x35'))){_0x2a70ba[_0xd3d3('0x1a')]=qs[_0xd3d3('0x1a')](_0x4c930b[_0xd3d3('0x2d')][_0xd3d3('0x1a')]);_0x2a70ba['offset']=qs[_0xd3d3('0x19')](_0x4c930b['query'][_0xd3d3('0x19')]);}_0x2a70ba[_0xd3d3('0x36')]=qs[_0xd3d3('0x37')](_0x4c930b[_0xd3d3('0x2d')][_0xd3d3('0x37')]);_0x2a70ba[_0xd3d3('0x38')]=qs[_0xd3d3('0x2f')](_[_0xd3d3('0x39')](_0x4c930b[_0xd3d3('0x2d')],_0x35c71b[_0xd3d3('0x2f')]),_0x3bb529);if(_0x4c930b[_0xd3d3('0x2d')][_0xd3d3('0x3a')]){_0x2a70ba[_0xd3d3('0x38')]=_[_0xd3d3('0x3b')](_0x2a70ba[_0xd3d3('0x38')],{'$or':_['map'](_0x3bb529,function(_0x266b1b){if(_0x266b1b[_0xd3d3('0x29')]!=='VIRTUAL'){var _0x44da6a={};_0x44da6a[_0x266b1b['name']]={'$like':'%'+_0x4c930b[_0xd3d3('0x2d')][_0xd3d3('0x3a')]+'%'};return _0x44da6a;}})});}_0x2a70ba=_[_0xd3d3('0x3b')]({},_0x2a70ba,_0x4c930b[_0xd3d3('0x3c')]);var _0x5c1956={'where':_0x2a70ba[_0xd3d3('0x38')]};return db['Dynamics365Field'][_0xd3d3('0x1c')](_0x5c1956)[_0xd3d3('0x23')](function(_0x4a36a9){_0x32bb8f[_0xd3d3('0x1c')]=_0x4a36a9;if(_0x4c930b['query']['includeAll']){_0x2a70ba[_0xd3d3('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xd3d3('0x3e')](_0x2a70ba);})[_0xd3d3('0x23')](function(_0x5f4464){_0x32bb8f[_0xd3d3('0x3f')]=_0x5f4464;return _0x32bb8f;})[_0xd3d3('0x23')](respondWithFilteredResult(_0x44b1e1,_0x2a70ba))['catch'](handleError(_0x44b1e1,null));};exports[_0xd3d3('0x40')]=function(_0x15d6df,_0x1f55cd){var _0x15a042={'raw':!![],'where':{'id':_0x15d6df[_0xd3d3('0x41')]['id']}},_0x9db1c0={};_0x9db1c0['model']=_[_0xd3d3('0x2e')](db[_0xd3d3('0x27')][_0xd3d3('0x42')]);_0x9db1c0[_0xd3d3('0x2d')]=_[_0xd3d3('0x2e')](_0x15d6df[_0xd3d3('0x2d')]);_0x9db1c0[_0xd3d3('0x2f')]=_[_0xd3d3('0x31')](_0x9db1c0[_0xd3d3('0x2b')],_0x9db1c0[_0xd3d3('0x2d')]);_0x15a042[_0xd3d3('0x30')]=_['intersection'](_0x9db1c0['model'],qs[_0xd3d3('0x32')](_0x15d6df[_0xd3d3('0x2d')][_0xd3d3('0x32')]));_0x15a042[_0xd3d3('0x30')]=_0x15a042['attributes']['length']?_0x15a042[_0xd3d3('0x30')]:_0x9db1c0['model'];if(_0x15d6df[_0xd3d3('0x2d')]['includeAll']){_0x15a042[_0xd3d3('0x3d')]=[{'all':!![]}];}_0x15a042=_[_0xd3d3('0x3b')]({},_0x15a042,_0x15d6df[_0xd3d3('0x3c')]);return db[_0xd3d3('0x27')][_0xd3d3('0x43')](_0x15a042)[_0xd3d3('0x23')](handleEntityNotFound(_0x1f55cd,null))['then'](respondWithResult(_0x1f55cd,null))['catch'](handleError(_0x1f55cd,null));};exports[_0xd3d3('0x44')]=function(_0x4c3d23,_0x5cf015){return db['Dynamics365Field'][_0xd3d3('0x44')](_0x4c3d23[_0xd3d3('0x45')],{})[_0xd3d3('0x23')](respondWithResult(_0x5cf015,0xc9))['catch'](handleError(_0x5cf015,null));};exports['update']=function(_0x187284,_0x11b206){if(_0x187284[_0xd3d3('0x45')]['id']){delete _0x187284['body']['id'];}return db[_0xd3d3('0x27')][_0xd3d3('0x43')]({'where':{'id':_0x187284[_0xd3d3('0x41')]['id']}})[_0xd3d3('0x23')](handleEntityNotFound(_0x11b206,null))[_0xd3d3('0x23')](saveUpdates(_0x187284[_0xd3d3('0x45')],null))[_0xd3d3('0x23')](respondWithResult(_0x11b206,null))[_0xd3d3('0x46')](handleError(_0x11b206,null));};exports[_0xd3d3('0x24')]=function(_0x3314ad,_0x3ce3c2){return db['Dynamics365Field'][_0xd3d3('0x43')]({'where':{'id':_0x3314ad[_0xd3d3('0x41')]['id']}})[_0xd3d3('0x23')](handleEntityNotFound(_0x3ce3c2,null))[_0xd3d3('0x23')](removeEntity(_0x3ce3c2,null))['catch'](handleError(_0x3ce3c2,null));}; \ No newline at end of file +var _0x9082=['query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','filter','options','includeAll','rows','show','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map'];(function(_0x4d527f,_0x5419f7){var _0xd1cfe=function(_0x434481){while(--_0x434481){_0x4d527f['push'](_0x4d527f['shift']());}};_0xd1cfe(++_0x5419f7);}(_0x9082,0x1de));var _0x2908=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x9082[_0x2e3dfc];return _0x4b1245;};'use strict';var emlformat=require(_0x2908('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2908('0x1'));var jsonpatch=require(_0x2908('0x2'));var rp=require(_0x2908('0x3'));var moment=require(_0x2908('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2908('0x5'));var util=require('util');var path=require(_0x2908('0x6'));var sox=require(_0x2908('0x7'));var csv=require(_0x2908('0x8'));var ejs=require(_0x2908('0x9'));var fs=require('fs');var fs_extra=require(_0x2908('0xa'));var _=require(_0x2908('0xb'));var squel=require(_0x2908('0xc'));var crypto=require(_0x2908('0xd'));var jsforce=require(_0x2908('0xe'));var deskjs=require(_0x2908('0xf'));var toCsv=require(_0x2908('0x8'));var querystring=require(_0x2908('0x10'));var Papa=require(_0x2908('0x11'));var Redis=require(_0x2908('0x12'));var authService=require(_0x2908('0x13'));var qs=require(_0x2908('0x14'));var as=require(_0x2908('0x15'));var hardwareService=require(_0x2908('0x16'));var logger=require(_0x2908('0x17'))(_0x2908('0x18'));var utils=require(_0x2908('0x19'));var config=require(_0x2908('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2908('0x1b'))['db'];function respondWithStatusCode(_0x3ab72c,_0x2aba99){_0x2aba99=_0x2aba99||0xcc;return function(_0xbb4dfd){if(_0xbb4dfd){return _0x3ab72c[_0x2908('0x1c')](_0x2aba99);}return _0x3ab72c[_0x2908('0x1d')](_0x2aba99)[_0x2908('0x1e')]();};}function respondWithResult(_0x48c55a,_0x3257da){_0x3257da=_0x3257da||0xc8;return function(_0x331d53){if(_0x331d53){return _0x48c55a[_0x2908('0x1d')](_0x3257da)['json'](_0x331d53);}};}function respondWithFilteredResult(_0x298e6e,_0x48bdfb){return function(_0x5f4523){if(_0x5f4523){var _0x3368cf=typeof _0x48bdfb[_0x2908('0x1f')]===_0x2908('0x20')&&typeof _0x48bdfb[_0x2908('0x21')]===_0x2908('0x20');var _0x12537f=_0x5f4523['count'];var _0x400f81=_0x3368cf?0x0:_0x48bdfb[_0x2908('0x1f')];var _0x5d3115=_0x3368cf?_0x5f4523[_0x2908('0x22')]:_0x48bdfb['offset']+_0x48bdfb[_0x2908('0x21')];var _0x2970eb;if(_0x5d3115>=_0x12537f){_0x5d3115=_0x12537f;_0x2970eb=0xc8;}else{_0x2970eb=0xce;}_0x298e6e[_0x2908('0x1d')](_0x2970eb);return _0x298e6e[_0x2908('0x23')](_0x2908('0x24'),_0x400f81+'-'+_0x5d3115+'/'+_0x12537f)[_0x2908('0x25')](_0x5f4523);}return null;};}function patchUpdates(_0x5e11df){return function(_0x5182f3){try{jsonpatch[_0x2908('0x26')](_0x5182f3,_0x5e11df,!![]);}catch(_0x1f3e60){return BPromise[_0x2908('0x27')](_0x1f3e60);}return _0x5182f3['save']();};}function saveUpdates(_0x5f1cb3,_0x255a7c){return function(_0x423028){if(_0x423028){return _0x423028[_0x2908('0x28')](_0x5f1cb3)[_0x2908('0x29')](function(_0x21ffc4){return _0x21ffc4;});}return null;};}function removeEntity(_0x16fc12,_0x308456){return function(_0x5850ad){if(_0x5850ad){return _0x5850ad[_0x2908('0x2a')]()[_0x2908('0x29')](function(){_0x16fc12[_0x2908('0x1d')](0xcc)[_0x2908('0x1e')]();});}};}function handleEntityNotFound(_0x4656aa,_0x727883){return function(_0x300426){if(!_0x300426){_0x4656aa['sendStatus'](0x194);}return _0x300426;};}function handleError(_0x27fb96,_0x24bf41){_0x24bf41=_0x24bf41||0x1f4;return function(_0x53c92b){logger[_0x2908('0x2b')](_0x53c92b[_0x2908('0x2c')]);if(_0x53c92b[_0x2908('0x2d')]){delete _0x53c92b[_0x2908('0x2d')];}_0x27fb96['status'](_0x24bf41)['send'](_0x53c92b);};}exports[_0x2908('0x2e')]=function(_0x89e3a1,_0x362053){var _0x50b2b0={},_0x35f3bd={},_0x3c707d={'count':0x0,'rows':[]};var _0x52cf82=_['map'](db[_0x2908('0x2f')][_0x2908('0x30')],function(_0x519a4c){return{'name':_0x519a4c[_0x2908('0x31')],'type':_0x519a4c[_0x2908('0x32')][_0x2908('0x33')]};});_0x35f3bd[_0x2908('0x34')]=_[_0x2908('0x35')](_0x52cf82,_0x2908('0x2d'));_0x35f3bd[_0x2908('0x36')]=_[_0x2908('0x37')](_0x89e3a1['query']);_0x35f3bd['filters']=_[_0x2908('0x38')](_0x35f3bd[_0x2908('0x34')],_0x35f3bd[_0x2908('0x36')]);_0x50b2b0['attributes']=_['intersection'](_0x35f3bd[_0x2908('0x34')],qs[_0x2908('0x39')](_0x89e3a1[_0x2908('0x36')][_0x2908('0x39')]));_0x50b2b0[_0x2908('0x3a')]=_0x50b2b0[_0x2908('0x3a')][_0x2908('0x3b')]?_0x50b2b0['attributes']:_0x35f3bd[_0x2908('0x34')];if(!_0x89e3a1['query'][_0x2908('0x3c')]('nolimit')){_0x50b2b0[_0x2908('0x21')]=qs[_0x2908('0x21')](_0x89e3a1[_0x2908('0x36')]['limit']);_0x50b2b0[_0x2908('0x1f')]=qs['offset'](_0x89e3a1[_0x2908('0x36')][_0x2908('0x1f')]);}_0x50b2b0[_0x2908('0x3d')]=qs['sort'](_0x89e3a1[_0x2908('0x36')][_0x2908('0x3e')]);_0x50b2b0[_0x2908('0x3f')]=qs[_0x2908('0x40')](_['pick'](_0x89e3a1[_0x2908('0x36')],_0x35f3bd['filters']),_0x52cf82);if(_0x89e3a1[_0x2908('0x36')]['filter']){_0x50b2b0['where']=_[_0x2908('0x41')](_0x50b2b0[_0x2908('0x3f')],{'$or':_[_0x2908('0x35')](_0x52cf82,function(_0x52fc2f){if(_0x52fc2f['type']!=='VIRTUAL'){var _0x1b10e7={};_0x1b10e7[_0x52fc2f[_0x2908('0x2d')]]={'$like':'%'+_0x89e3a1['query'][_0x2908('0x42')]+'%'};return _0x1b10e7;}})});}_0x50b2b0=_['merge']({},_0x50b2b0,_0x89e3a1[_0x2908('0x43')]);var _0x1a57fe={'where':_0x50b2b0[_0x2908('0x3f')]};return db[_0x2908('0x2f')][_0x2908('0x22')](_0x1a57fe)[_0x2908('0x29')](function(_0x35d780){_0x3c707d[_0x2908('0x22')]=_0x35d780;if(_0x89e3a1[_0x2908('0x36')][_0x2908('0x44')]){_0x50b2b0['include']=[{'all':!![]}];}return db[_0x2908('0x2f')]['findAll'](_0x50b2b0);})[_0x2908('0x29')](function(_0x25dd03){_0x3c707d[_0x2908('0x45')]=_0x25dd03;return _0x3c707d;})['then'](respondWithFilteredResult(_0x362053,_0x50b2b0))['catch'](handleError(_0x362053,null));};exports[_0x2908('0x46')]=function(_0x2ca521,_0x446427){var _0x19c8c0={'raw':!![],'where':{'id':_0x2ca521['params']['id']}},_0x125cf3={};_0x125cf3[_0x2908('0x34')]=_[_0x2908('0x37')](db[_0x2908('0x2f')]['rawAttributes']);_0x125cf3['query']=_[_0x2908('0x37')](_0x2ca521['query']);_0x125cf3[_0x2908('0x40')]=_[_0x2908('0x38')](_0x125cf3['model'],_0x125cf3[_0x2908('0x36')]);_0x19c8c0[_0x2908('0x3a')]=_[_0x2908('0x38')](_0x125cf3[_0x2908('0x34')],qs[_0x2908('0x39')](_0x2ca521[_0x2908('0x36')][_0x2908('0x39')]));_0x19c8c0[_0x2908('0x3a')]=_0x19c8c0[_0x2908('0x3a')][_0x2908('0x3b')]?_0x19c8c0[_0x2908('0x3a')]:_0x125cf3['model'];if(_0x2ca521[_0x2908('0x36')][_0x2908('0x44')]){_0x19c8c0['include']=[{'all':!![]}];}_0x19c8c0=_['merge']({},_0x19c8c0,_0x2ca521['options']);return db[_0x2908('0x2f')]['find'](_0x19c8c0)[_0x2908('0x29')](handleEntityNotFound(_0x446427,null))[_0x2908('0x29')](respondWithResult(_0x446427,null))['catch'](handleError(_0x446427,null));};exports['create']=function(_0x1bb46d,_0x15c52c){return db[_0x2908('0x2f')][_0x2908('0x47')](_0x1bb46d[_0x2908('0x48')],{})[_0x2908('0x29')](respondWithResult(_0x15c52c,0xc9))[_0x2908('0x49')](handleError(_0x15c52c,null));};exports[_0x2908('0x28')]=function(_0x33a49e,_0x3fcbea){if(_0x33a49e[_0x2908('0x48')]['id']){delete _0x33a49e[_0x2908('0x48')]['id'];}return db[_0x2908('0x2f')]['find']({'where':{'id':_0x33a49e['params']['id']}})[_0x2908('0x29')](handleEntityNotFound(_0x3fcbea,null))[_0x2908('0x29')](saveUpdates(_0x33a49e[_0x2908('0x48')],null))[_0x2908('0x29')](respondWithResult(_0x3fcbea,null))[_0x2908('0x49')](handleError(_0x3fcbea,null));};exports[_0x2908('0x2a')]=function(_0x53cffa,_0x44810d){return db[_0x2908('0x2f')][_0x2908('0x4a')]({'where':{'id':_0x53cffa[_0x2908('0x4b')]['id']}})['then'](handleEntityNotFound(_0x44810d,null))['then'](removeEntity(_0x44810d,null))[_0x2908('0x49')](handleError(_0x44810d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a048662..2cde5ed 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 _0x6903=['request-promise','path','rimraf','../../config/environment','exports','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ac5e8,_0xc333d2){var _0x5eb1ff=function(_0x2c4802){while(--_0x2c4802){_0x5ac5e8['push'](_0x5ac5e8['shift']());}};_0x5eb1ff(++_0xc333d2);}(_0x6903,0x1aa));var _0x3690=function(_0xff7e15,_0xf0db6e){_0xff7e15=_0xff7e15-0x0;var _0x3989be=_0x6903[_0xff7e15];return _0x3989be;};'use strict';var _=require(_0x3690('0x0'));var util=require(_0x3690('0x1'));var logger=require(_0x3690('0x2'))(_0x3690('0x3'));var moment=require(_0x3690('0x4'));var BPromise=require(_0x3690('0x5'));var rp=require(_0x3690('0x6'));var fs=require('fs');var path=require(_0x3690('0x7'));var rimraf=require(_0x3690('0x8'));var config=require(_0x3690('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x3690('0xa')]=function(_0x2a6432,_0x8f01d1){return _0x2a6432['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x3690('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeee7=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','int_dynamics365_fields','idField','FieldId','lodash','util','api','moment'];(function(_0x260d75,_0x573809){var _0x41ef56=function(_0x185fd1){while(--_0x185fd1){_0x260d75['push'](_0x260d75['shift']());}};_0x41ef56(++_0x573809);}(_0xeee7,0x8b));var _0x7eee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xeee7[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7eee('0x0'));var util=require(_0x7eee('0x1'));var logger=require('../../config/logger')(_0x7eee('0x2'));var moment=require(_0x7eee('0x3'));var BPromise=require('bluebird');var rp=require(_0x7eee('0x4'));var fs=require('fs');var path=require(_0x7eee('0x5'));var rimraf=require(_0x7eee('0x6'));var config=require(_0x7eee('0x7'));var attributes=require(_0x7eee('0x8'));module['exports']=function(_0x36b68e,_0x3f0521){return _0x36b68e[_0x7eee('0x9')]('Dynamics365Field',attributes,{'tableName':_0x7eee('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x7eee('0xb'),_0x7eee('0xc')],'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 df147a8..c3a6a65 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 _0xee14=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x50d199,_0x31c272){var _0x3520f7=function(_0x593fca){while(--_0x593fca){_0x50d199['push'](_0x50d199['shift']());}};_0x3520f7(++_0x31c272);}(_0xee14,0x1d1));var _0x4ee1=function(_0x541b8b,_0x504017){_0x541b8b=_0x541b8b-0x0;var _0x64b818=_0xee14[_0x541b8b];return _0x64b818;};'use strict';var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ee1('0x4'));var db=require(_0x4ee1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var jayson=require(_0x4ee1('0x8'));var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x120b3f,_0x28b1da,_0x45755a){return new BPromise(function(_0x403bd1,_0x14fdfd){return client[_0x4ee1('0xa')](_0x120b3f,_0x45755a)[_0x4ee1('0xb')](function(_0x68967f){logger[_0x4ee1('0xc')](_0x4ee1('0xd'),_0x28b1da,'request\x20sent');logger[_0x4ee1('0xe')](_0x4ee1('0xf'),_0x28b1da,_0x4ee1('0x10'),JSON[_0x4ee1('0x11')](_0x68967f));if(_0x68967f[_0x4ee1('0x12')]){if(_0x68967f[_0x4ee1('0x12')]['code']===0x1f4){logger[_0x4ee1('0x12')](_0x4ee1('0xd'),_0x28b1da,_0x68967f[_0x4ee1('0x12')][_0x4ee1('0x13')]);return _0x14fdfd(_0x68967f['error'][_0x4ee1('0x13')]);}logger['error'](_0x4ee1('0xd'),_0x28b1da,_0x68967f[_0x4ee1('0x12')][_0x4ee1('0x13')]);return _0x403bd1(_0x68967f[_0x4ee1('0x12')][_0x4ee1('0x13')]);}else{logger['info'](_0x4ee1('0xd'),_0x28b1da,_0x4ee1('0x10'));_0x403bd1(_0x68967f[_0x4ee1('0x14')][_0x4ee1('0x13')]);}})[_0x4ee1('0x15')](function(_0xc5fe43){logger[_0x4ee1('0x12')](_0x4ee1('0xd'),_0x28b1da,_0xc5fe43);_0x14fdfd(_0xc5fe43);});});} \ No newline at end of file +var _0x917a=['stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x48fe54,_0x11c54b){var _0x3eed5b=function(_0x334a01){while(--_0x334a01){_0x48fe54['push'](_0x48fe54['shift']());}};_0x3eed5b(++_0x11c54b);}(_0x917a,0x1a7));var _0xa917=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x917a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xa917('0x0'));var util=require(_0xa917('0x1'));var moment=require(_0xa917('0x2'));var BPromise=require('bluebird');var rs=require(_0xa917('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa917('0x4'));var logger=require(_0xa917('0x5'))(_0xa917('0x6'));var config=require(_0xa917('0x7'));var jayson=require(_0xa917('0x8'));var client=jayson[_0xa917('0x9')][_0xa917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41fce8,_0xf1c63a,_0x451a06){return new BPromise(function(_0x38ad58,_0x3e4d86){return client[_0xa917('0xb')](_0x41fce8,_0x451a06)[_0xa917('0xc')](function(_0x24b28d){logger['info'](_0xa917('0xd'),_0xf1c63a,_0xa917('0xe'));logger[_0xa917('0xf')](_0xa917('0x10'),_0xf1c63a,_0xa917('0xe'),JSON[_0xa917('0x11')](_0x24b28d));if(_0x24b28d[_0xa917('0x12')]){if(_0x24b28d[_0xa917('0x12')]['code']===0x1f4){logger[_0xa917('0x12')](_0xa917('0xd'),_0xf1c63a,_0x24b28d[_0xa917('0x12')][_0xa917('0x13')]);return _0x3e4d86(_0x24b28d[_0xa917('0x12')]['message']);}logger[_0xa917('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0xf1c63a,_0x24b28d['error'][_0xa917('0x13')]);return _0x38ad58(_0x24b28d[_0xa917('0x12')][_0xa917('0x13')]);}else{logger['info'](_0xa917('0xd'),_0xf1c63a,_0xa917('0xe'));_0x38ad58(_0x24b28d[_0xa917('0x14')][_0xa917('0x13')]);}})[_0xa917('0x15')](function(_0x364d2b){logger[_0xa917('0x12')](_0xa917('0xd'),_0xf1c63a,_0x364d2b);_0x3e4d86(_0x364d2b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b3e688e..4424f58 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 _0x6a2a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','addConfiguration','update','destroy','exports','multer'];(function(_0x5911f3,_0x10d174){var _0x306f54=function(_0x3f1847){while(--_0x3f1847){_0x5911f3['push'](_0x5911f3['shift']());}};_0x306f54(++_0x10d174);}(_0x6a2a,0x1a8));var _0xa6a2=function(_0x58c053,_0x51c43f){_0x58c053=_0x58c053-0x0;var _0xe1079=_0x6a2a[_0x58c053];return _0xe1079;};'use strict';var multer=require(_0xa6a2('0x0'));var util=require(_0xa6a2('0x1'));var path=require(_0xa6a2('0x2'));var timeout=require(_0xa6a2('0x3'));var express=require(_0xa6a2('0x4'));var router=express[_0xa6a2('0x5')]();var fs_extra=require(_0xa6a2('0x6'));var auth=require(_0xa6a2('0x7'));var interaction=require(_0xa6a2('0x8'));var config=require(_0xa6a2('0x9'));var controller=require(_0xa6a2('0xa'));router[_0xa6a2('0xb')]('/',auth[_0xa6a2('0xc')](),controller[_0xa6a2('0xd')]);router[_0xa6a2('0xb')](_0xa6a2('0xe'),auth[_0xa6a2('0xc')](),controller[_0xa6a2('0xf')]);router[_0xa6a2('0xb')]('/:id/configurations',auth[_0xa6a2('0xc')](),controller[_0xa6a2('0x10')]);router[_0xa6a2('0xb')](_0xa6a2('0x11'),auth[_0xa6a2('0xc')](),controller['getFields']);router['post']('/',auth[_0xa6a2('0xc')](),controller[_0xa6a2('0x12')]);router[_0xa6a2('0x13')](_0xa6a2('0x14'),auth['isAuthenticated'](),controller[_0xa6a2('0x15')]);router['put'](_0xa6a2('0xe'),auth[_0xa6a2('0xc')](),controller[_0xa6a2('0x16')]);router['delete'](_0xa6a2('0xe'),auth[_0xa6a2('0xc')](),controller[_0xa6a2('0x17')]);module[_0xa6a2('0x18')]=router; \ No newline at end of file +var _0xdf7f=['post','addConfiguration','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations'];(function(_0x39e902,_0x29d303){var _0x42d902=function(_0xdf5cc6){while(--_0xdf5cc6){_0x39e902['push'](_0x39e902['shift']());}};_0x42d902(++_0x29d303);}(_0xdf7f,0xdc));var _0xfdf7=function(_0x1604c4,_0x1696d2){_0x1604c4=_0x1604c4-0x0;var _0xe3ae19=_0xdf7f[_0x1604c4];return _0xe3ae19;};'use strict';var multer=require('multer');var util=require(_0xfdf7('0x0'));var path=require(_0xfdf7('0x1'));var timeout=require(_0xfdf7('0x2'));var express=require(_0xfdf7('0x3'));var router=express[_0xfdf7('0x4')]();var fs_extra=require(_0xfdf7('0x5'));var auth=require(_0xfdf7('0x6'));var interaction=require(_0xfdf7('0x7'));var config=require(_0xfdf7('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0xfdf7('0x9')]('/',auth[_0xfdf7('0xa')](),controller['index']);router['get'](_0xfdf7('0xb'),auth[_0xfdf7('0xa')](),controller['show']);router['get'](_0xfdf7('0xc'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0xd')]);router[_0xfdf7('0x9')]('/:id/fields',auth[_0xfdf7('0xa')](),controller['getFields']);router[_0xfdf7('0xe')]('/',auth[_0xfdf7('0xa')](),controller['create']);router[_0xfdf7('0xe')](_0xfdf7('0xc'),auth[_0xfdf7('0xa')](),controller[_0xfdf7('0xf')]);router['put']('/:id',auth[_0xfdf7('0xa')](),controller['update']);router[_0xfdf7('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfdf7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 59b47ca..8118796 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa456=['STRING','username','sequelize','exports'];(function(_0x404524,_0x14d863){var _0x3b1d18=function(_0x370685){while(--_0x370685){_0x404524['push'](_0x404524['shift']());}};_0x3b1d18(++_0x14d863);}(_0xa456,0x142));var _0x6a45=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xa456[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a85=['STRING','remoteUri'];(function(_0x1ecbd4,_0x556696){var _0x4e73d8=function(_0x110821){while(--_0x110821){_0x1ecbd4['push'](_0x1ecbd4['shift']());}};_0x4e73d8(++_0x556696);}(_0x1a85,0x178));var _0x51a8=function(_0x53618a,_0x3ce1c8){_0x53618a=_0x53618a-0x0;var _0x588ddb=_0x1a85[_0x53618a];return _0x588ddb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index cd64e03..2b2ddaa 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 _0xe1aa=['getFields','remoteUri','apiKey','slice','substring','format','%s:X','toString','base64','requester','subject','agent','description','group','source','ticket_type','company','remove','includes','custom_dropdown','label','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','send','map','FreshdeskAccount','fieldName','type','key','name','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','fields','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe1aa,0xfc));var _0xae1a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe1aa[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xae1a('0x0'));var rimraf=require(_0xae1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae1a('0x2'));var moment=require(_0xae1a('0x3'));var BPromise=require(_0xae1a('0x4'));var Mustache=require(_0xae1a('0x5'));var util=require(_0xae1a('0x6'));var path=require('path');var sox=require(_0xae1a('0x7'));var csv=require('to-csv');var ejs=require(_0xae1a('0x8'));var fs=require('fs');var fs_extra=require(_0xae1a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xae1a('0xa'));var jsforce=require(_0xae1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xae1a('0xc'));var querystring=require(_0xae1a('0xd'));var Papa=require('papaparse');var Redis=require(_0xae1a('0xe'));var authService=require(_0xae1a('0xf'));var qs=require(_0xae1a('0x10'));var as=require(_0xae1a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae1a('0x12'))(_0xae1a('0x13'));var utils=require('../../config/utils');var config=require(_0xae1a('0x14'));var licenseUtil=require(_0xae1a('0x15'));var db=require(_0xae1a('0x16'))['db'];var integrations=require(_0xae1a('0x17'));function respondWithStatusCode(_0x2f55ae,_0x1f6419){_0x1f6419=_0x1f6419||0xcc;return function(_0x352749){if(_0x352749){return _0x2f55ae[_0xae1a('0x18')](_0x1f6419);}return _0x2f55ae[_0xae1a('0x19')](_0x1f6419)[_0xae1a('0x1a')]();};}function respondWithResult(_0x47ce8e,_0x53dc19){_0x53dc19=_0x53dc19||0xc8;return function(_0x580f1c){if(_0x580f1c){return _0x47ce8e['status'](_0x53dc19)[_0xae1a('0x1b')](_0x580f1c);}};}function respondWithFilteredResult(_0x21109c,_0x2eb725){return function(_0x261d1d){if(_0x261d1d){var _0x407778=typeof _0x2eb725['offset']===_0xae1a('0x1c')&&typeof _0x2eb725[_0xae1a('0x1d')]==='undefined';var _0x1e05df=_0x261d1d[_0xae1a('0x1e')];var _0x2e0951=_0x407778?0x0:_0x2eb725[_0xae1a('0x1f')];var _0x1931b9=_0x407778?_0x261d1d[_0xae1a('0x1e')]:_0x2eb725[_0xae1a('0x1f')]+_0x2eb725[_0xae1a('0x1d')];var _0x448961;if(_0x1931b9>=_0x1e05df){_0x1931b9=_0x1e05df;_0x448961=0xc8;}else{_0x448961=0xce;}_0x21109c[_0xae1a('0x19')](_0x448961);return _0x21109c['set'](_0xae1a('0x20'),_0x2e0951+'-'+_0x1931b9+'/'+_0x1e05df)[_0xae1a('0x1b')](_0x261d1d);}return null;};}function patchUpdates(_0x376b61){return function(_0xae6fa5){try{jsonpatch[_0xae1a('0x21')](_0xae6fa5,_0x376b61,!![]);}catch(_0x53fac4){return BPromise[_0xae1a('0x22')](_0x53fac4);}return _0xae6fa5[_0xae1a('0x23')]();};}function saveUpdates(_0x39c190,_0x584fb4){return function(_0x45d15d){if(_0x45d15d){return _0x45d15d[_0xae1a('0x24')](_0x39c190)[_0xae1a('0x25')](function(_0x1ec64c){return _0x1ec64c;});}return null;};}function removeEntity(_0xb3e00d,_0x29a121){return function(_0x5c5b60){if(_0x5c5b60){return _0x5c5b60[_0xae1a('0x26')]()['then'](function(){_0xb3e00d['status'](0xcc)[_0xae1a('0x1a')]();});}};}function handleEntityNotFound(_0x2f13dc,_0x3907c6){return function(_0x22ed5b){if(!_0x22ed5b){_0x2f13dc[_0xae1a('0x18')](0x194);}return _0x22ed5b;};}function handleError(_0x4ecb5b,_0x270e66){_0x270e66=_0x270e66||0x1f4;return function(_0x454142){logger[_0xae1a('0x27')](_0x454142['stack']);if(_0x454142['name']){delete _0x454142['name'];}_0x4ecb5b[_0xae1a('0x19')](_0x270e66)[_0xae1a('0x28')](_0x454142);};}exports['index']=function(_0x5b3d63,_0x1d84f8){var _0x40e32c={},_0x127d6d={},_0x57d2e={'count':0x0,'rows':[]};var _0x29fef2=_[_0xae1a('0x29')](db[_0xae1a('0x2a')]['rawAttributes'],function(_0x5821a7){return{'name':_0x5821a7[_0xae1a('0x2b')],'type':_0x5821a7[_0xae1a('0x2c')][_0xae1a('0x2d')]};});_0x127d6d['model']=_[_0xae1a('0x29')](_0x29fef2,_0xae1a('0x2e'));_0x127d6d[_0xae1a('0x2f')]=_['keys'](_0x5b3d63[_0xae1a('0x2f')]);_0x127d6d[_0xae1a('0x30')]=_['intersection'](_0x127d6d[_0xae1a('0x31')],_0x127d6d[_0xae1a('0x2f')]);_0x40e32c[_0xae1a('0x32')]=_[_0xae1a('0x33')](_0x127d6d['model'],qs['fields'](_0x5b3d63['query']['fields']));_0x40e32c[_0xae1a('0x32')]=_0x40e32c['attributes'][_0xae1a('0x34')]?_0x40e32c['attributes']:_0x127d6d['model'];if(!_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x35')](_0xae1a('0x36'))){_0x40e32c['limit']=qs[_0xae1a('0x1d')](_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x1d')]);_0x40e32c[_0xae1a('0x1f')]=qs['offset'](_0x5b3d63['query']['offset']);}_0x40e32c[_0xae1a('0x37')]=qs[_0xae1a('0x38')](_0x5b3d63['query'][_0xae1a('0x38')]);_0x40e32c[_0xae1a('0x39')]=qs[_0xae1a('0x30')](_[_0xae1a('0x3a')](_0x5b3d63['query'],_0x127d6d[_0xae1a('0x30')]),_0x29fef2);if(_0x5b3d63['query'][_0xae1a('0x3b')]){_0x40e32c[_0xae1a('0x39')]=_[_0xae1a('0x3c')](_0x40e32c[_0xae1a('0x39')],{'$or':_[_0xae1a('0x29')](_0x29fef2,function(_0x220423){if(_0x220423[_0xae1a('0x2c')]!=='VIRTUAL'){var _0x416213={};_0x416213[_0x220423[_0xae1a('0x2e')]]={'$like':'%'+_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x3b')]+'%'};return _0x416213;}})});}_0x40e32c=_[_0xae1a('0x3c')]({},_0x40e32c,_0x5b3d63[_0xae1a('0x3d')]);var _0x5c8655={'where':_0x40e32c['where']};return db['FreshdeskAccount'][_0xae1a('0x1e')](_0x5c8655)['then'](function(_0x3eab4b){_0x57d2e[_0xae1a('0x1e')]=_0x3eab4b;if(_0x5b3d63[_0xae1a('0x2f')][_0xae1a('0x3e')]){_0x40e32c[_0xae1a('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x40e32c);})[_0xae1a('0x25')](function(_0x47a307){_0x57d2e[_0xae1a('0x40')]=_0x47a307;return _0x57d2e;})[_0xae1a('0x25')](respondWithFilteredResult(_0x1d84f8,_0x40e32c))['catch'](handleError(_0x1d84f8,null));};exports[_0xae1a('0x41')]=function(_0x511aef,_0x5df42a){var _0x26e55b={'raw':![],'where':{'id':_0x511aef[_0xae1a('0x42')]['id']}},_0x4be3fb={};_0x4be3fb['model']=_[_0xae1a('0x43')](db[_0xae1a('0x2a')][_0xae1a('0x44')]);_0x4be3fb[_0xae1a('0x2f')]=_[_0xae1a('0x43')](_0x511aef['query']);_0x4be3fb['filters']=_['intersection'](_0x4be3fb['model'],_0x4be3fb['query']);_0x26e55b[_0xae1a('0x32')]=_[_0xae1a('0x33')](_0x4be3fb['model'],qs['fields'](_0x511aef['query'][_0xae1a('0x45')]));_0x26e55b[_0xae1a('0x32')]=_0x26e55b[_0xae1a('0x32')][_0xae1a('0x34')]?_0x26e55b[_0xae1a('0x32')]:_0x4be3fb[_0xae1a('0x31')];if(_0x511aef[_0xae1a('0x2f')][_0xae1a('0x3e')]){_0x26e55b[_0xae1a('0x3f')]=[{'all':!![]}];}_0x26e55b=_[_0xae1a('0x3c')]({},_0x26e55b,_0x511aef[_0xae1a('0x3d')]);return db['FreshdeskAccount'][_0xae1a('0x46')](_0x26e55b)['then'](handleEntityNotFound(_0x5df42a,null))[_0xae1a('0x25')](respondWithResult(_0x5df42a,null))[_0xae1a('0x47')](handleError(_0x5df42a,null));};exports[_0xae1a('0x48')]=function(_0x24017b,_0x1884b){return db[_0xae1a('0x2a')][_0xae1a('0x48')](_0x24017b[_0xae1a('0x49')],{})[_0xae1a('0x25')](respondWithResult(_0x1884b,0xc9))['catch'](handleError(_0x1884b,null));};exports['update']=function(_0x5aceaf,_0x338c05){if(_0x5aceaf[_0xae1a('0x49')]['id']){delete _0x5aceaf['body']['id'];}return db[_0xae1a('0x2a')][_0xae1a('0x46')]({'where':{'id':_0x5aceaf['params']['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x338c05,null))[_0xae1a('0x25')](saveUpdates(_0x5aceaf[_0xae1a('0x49')],null))['then'](respondWithResult(_0x338c05,null))[_0xae1a('0x47')](handleError(_0x338c05,null));};exports['destroy']=function(_0x48a0ed,_0x400fb4){return db[_0xae1a('0x2a')][_0xae1a('0x46')]({'where':{'id':_0x48a0ed[_0xae1a('0x42')]['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x400fb4,null))[_0xae1a('0x25')](removeEntity(_0x400fb4,null))['catch'](handleError(_0x400fb4,null));};exports[_0xae1a('0x4a')]=function(_0x11bcfa,_0x161348,_0x2a15e9){var _0x444d4a={};var _0x3d77ac={};var _0x67fe08;var _0x19131b;return db[_0xae1a('0x2a')][_0xae1a('0x4b')]({'where':{'id':_0x11bcfa[_0xae1a('0x42')]['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x161348,null))[_0xae1a('0x25')](function(_0x4d057a){if(_0x4d057a){_0x67fe08=_0x4d057a;_0x3d77ac[_0xae1a('0x31')]=_[_0xae1a('0x43')](db[_0xae1a('0x4c')]['rawAttributes']);_0x3d77ac[_0xae1a('0x2f')]=_[_0xae1a('0x43')](_0x11bcfa[_0xae1a('0x2f')]);_0x3d77ac[_0xae1a('0x30')]=_[_0xae1a('0x33')](_0x3d77ac[_0xae1a('0x31')],_0x3d77ac['query']);_0x444d4a[_0xae1a('0x32')]=_[_0xae1a('0x33')](_0x3d77ac['model'],qs[_0xae1a('0x45')](_0x11bcfa['query'][_0xae1a('0x45')]));_0x444d4a[_0xae1a('0x32')]=_0x444d4a[_0xae1a('0x32')][_0xae1a('0x34')]?_0x444d4a[_0xae1a('0x32')]:_0x3d77ac[_0xae1a('0x31')];_0x444d4a['order']=qs[_0xae1a('0x38')](_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x38')]);_0x444d4a['where']=qs[_0xae1a('0x30')](_[_0xae1a('0x3a')](_0x11bcfa[_0xae1a('0x2f')],_0x3d77ac[_0xae1a('0x30')]));if(_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x3b')]){_0x444d4a[_0xae1a('0x39')]=_[_0xae1a('0x3c')](_0x444d4a[_0xae1a('0x39')],{'$or':_[_0xae1a('0x29')](_0x444d4a['attributes'],function(_0x1873a5){var _0x10783d={};_0x10783d[_0x1873a5]={'$like':'%'+_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x3b')]+'%'};return _0x10783d;})});}_0x444d4a=_[_0xae1a('0x3c')]({},_0x444d4a,_0x11bcfa[_0xae1a('0x3d')]);return _0x67fe08[_0xae1a('0x4a')](_0x444d4a);}})[_0xae1a('0x25')](function(_0x1c4f02){if(_0x1c4f02){_0x19131b=_0x1c4f02[_0xae1a('0x34')];if(!_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x35')](_0xae1a('0x36'))){_0x444d4a[_0xae1a('0x1d')]=qs[_0xae1a('0x1d')](_0x11bcfa[_0xae1a('0x2f')][_0xae1a('0x1d')]);_0x444d4a[_0xae1a('0x1f')]=qs[_0xae1a('0x1f')](_0x11bcfa['query'][_0xae1a('0x1f')]);}return _0x67fe08[_0xae1a('0x4a')](_0x444d4a);}})[_0xae1a('0x25')](function(_0x55f8f5){if(_0x55f8f5){return _0x55f8f5?{'count':_0x19131b,'rows':_0x55f8f5}:null;}})[_0xae1a('0x25')](respondWithResult(_0x161348,null))['catch'](handleError(_0x161348,null));};exports[_0xae1a('0x4d')]=function(_0xfc9e2c,_0x1966ee,_0x42c39f){if(_0xfc9e2c[_0xae1a('0x49')]['id']){delete _0xfc9e2c[_0xae1a('0x49')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0xfc9e2c[_0xae1a('0x42')]['id']}})[_0xae1a('0x25')](handleEntityNotFound(_0x1966ee,null))[_0xae1a('0x25')](function(_0x1af6a4){if(_0x1af6a4){_0xfc9e2c['body'][_0xae1a('0x4e')]=_0x1af6a4['id'];_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x4f')]=integrations[_0xae1a('0x50')](_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x51')],_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x2c')]);_0xfc9e2c['body'][_0xae1a('0x52')]=integrations['getDescriptions'](_0xfc9e2c['body'][_0xae1a('0x51')],_0xfc9e2c[_0xae1a('0x49')][_0xae1a('0x2c')]);return db[_0xae1a('0x4c')]['create'](_0xfc9e2c['body'],{'include':[{'model':db[_0xae1a('0x53')],'as':_0xae1a('0x4f')},{'model':db[_0xae1a('0x53')],'as':_0xae1a('0x52')}]});}return null;})['then'](respondWithResult(_0x1966ee,null))[_0xae1a('0x47')](handleError(_0x1966ee,null));};exports[_0xae1a('0x54')]=function(_0x4b6d0c,_0x12aadf,_0x22198a){var _0x4352d5='';return db[_0xae1a('0x2a')][_0xae1a('0x4b')]({'where':{'id':_0x4b6d0c[_0xae1a('0x42')]['id']},'attributes':['id',_0xae1a('0x55'),_0xae1a('0x56')]})[_0xae1a('0x25')](handleEntityNotFound(_0x12aadf,null))[_0xae1a('0x25')](function(_0x52b438){if(_0x52b438){_0x4352d5=_0x52b438[_0xae1a('0x55')];var _0x4d45ff=_0x4352d5[_0xae1a('0x57')](-0x1);if(_0x4d45ff==='/'){_0x4352d5=_0x4352d5[_0xae1a('0x58')](0x0,_0x4352d5['lastIndexOf'](_0x4d45ff));}return rp({'method':'GET','uri':util[_0xae1a('0x59')]('%s/%s',_0x4352d5,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xae1a('0x59')]('Basic\x20%s',new Buffer(util['format'](_0xae1a('0x5a'),_0x52b438[_0xae1a('0x56')]))[_0xae1a('0x5b')](_0xae1a('0x5c')))},'json':!![]});}})[_0xae1a('0x25')](function(_0x42863f){if(_0x42863f){var _0x3c32e0=[_0xae1a('0x5d'),_0xae1a('0x5e'),_0xae1a('0x5f'),_0xae1a('0x60'),_0xae1a('0x19'),'priority',_0xae1a('0x61'),_0xae1a('0x62'),_0xae1a('0x63'),_0xae1a('0x61'),_0xae1a('0x64')];_[_0xae1a('0x65')](_0x42863f,function(_0x4113c9){return _0x3c32e0[_0xae1a('0x66')](_0x4113c9[_0xae1a('0x2e')])||!_0x4113c9['default']&&_0x4113c9[_0xae1a('0x2c')]!=='custom_text'&&_0x4113c9[_0xae1a('0x2c')]!==_0xae1a('0x67');});return{'count':_0x42863f[_0xae1a('0x34')],'rows':_[_0xae1a('0x29')](_0x42863f,function(_0x363eb5){return{'id':_0x363eb5['name'],'name':_0x363eb5[_0xae1a('0x68')],'custom':!_0x363eb5[_0xae1a('0x69')],'options':_0x363eb5[_0xae1a('0x6a')]?_[_0xae1a('0x29')](_0x363eb5[_0xae1a('0x6a')],function(_0x381786){return{'name':_[_0xae1a('0x6b')](_0x381786),'value':_0x381786};}):[]};})};}})['then'](respondWithResult(_0x12aadf,null))[_0xae1a('0x47')](function(_0x3f3b0b){var _0x30017a=_0x4b6d0c[_0xae1a('0x2f')][_0xae1a('0x6c')]?0x1f4:_0x3f3b0b['statusCode']||0x1f4;logger['error'](_0xae1a('0x6d'),_0xae1a('0x54'),_0x30017a,JSON[_0xae1a('0x6e')](_0x3f3b0b));delete _0x3f3b0b[_0xae1a('0x2e')];if(_0x30017a===0x191){_0x30017a=0x190;}_0x12aadf['status'](_0x30017a)[_0xae1a('0x28')](_0x4b6d0c['query'][_0xae1a('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x3f3b0b[_0xae1a('0x6f')]}:_0x3f3b0b);});}; \ No newline at end of file +var _0xe027=['getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','requester','subject','agent','description','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','save','update','destroy','then','error','stack','name','send','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshdeskField','Subjects'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xe027,0x106));var _0x7e02=function(_0x2de010,_0x2b8944){_0x2de010=_0x2de010-0x0;var _0x37c074=_0xe027[_0x2de010];return _0x37c074;};'use strict';var emlformat=require(_0x7e02('0x0'));var rimraf=require(_0x7e02('0x1'));var zipdir=require(_0x7e02('0x2'));var jsonpatch=require(_0x7e02('0x3'));var rp=require(_0x7e02('0x4'));var moment=require(_0x7e02('0x5'));var BPromise=require(_0x7e02('0x6'));var Mustache=require(_0x7e02('0x7'));var util=require(_0x7e02('0x8'));var path=require(_0x7e02('0x9'));var sox=require(_0x7e02('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e02('0xb'));var _=require('lodash');var squel=require(_0x7e02('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7e02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7e02('0xe'));var Papa=require(_0x7e02('0xf'));var Redis=require(_0x7e02('0x10'));var authService=require(_0x7e02('0x11'));var qs=require(_0x7e02('0x12'));var as=require(_0x7e02('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e02('0x14'))('api');var utils=require(_0x7e02('0x15'));var config=require(_0x7e02('0x16'));var licenseUtil=require(_0x7e02('0x17'));var db=require(_0x7e02('0x18'))['db'];var integrations=require(_0x7e02('0x19'));function respondWithStatusCode(_0x1120d3,_0x1805f7){_0x1805f7=_0x1805f7||0xcc;return function(_0x534a78){if(_0x534a78){return _0x1120d3[_0x7e02('0x1a')](_0x1805f7);}return _0x1120d3['status'](_0x1805f7)[_0x7e02('0x1b')]();};}function respondWithResult(_0x4424b0,_0x4263a4){_0x4263a4=_0x4263a4||0xc8;return function(_0x269c3b){if(_0x269c3b){return _0x4424b0[_0x7e02('0x1c')](_0x4263a4)[_0x7e02('0x1d')](_0x269c3b);}};}function respondWithFilteredResult(_0x550352,_0x5b69a3){return function(_0x589ecb){if(_0x589ecb){var _0x24a572=typeof _0x5b69a3['offset']===_0x7e02('0x1e')&&typeof _0x5b69a3[_0x7e02('0x1f')]===_0x7e02('0x1e');var _0x2c7136=_0x589ecb['count'];var _0x25254b=_0x24a572?0x0:_0x5b69a3[_0x7e02('0x20')];var _0x53d174=_0x24a572?_0x589ecb[_0x7e02('0x21')]:_0x5b69a3[_0x7e02('0x20')]+_0x5b69a3[_0x7e02('0x1f')];var _0x273dca;if(_0x53d174>=_0x2c7136){_0x53d174=_0x2c7136;_0x273dca=0xc8;}else{_0x273dca=0xce;}_0x550352[_0x7e02('0x1c')](_0x273dca);return _0x550352[_0x7e02('0x22')]('Content-Range',_0x25254b+'-'+_0x53d174+'/'+_0x2c7136)[_0x7e02('0x1d')](_0x589ecb);}return null;};}function patchUpdates(_0x1061bd){return function(_0x5e76e0){try{jsonpatch[_0x7e02('0x23')](_0x5e76e0,_0x1061bd,!![]);}catch(_0x1eef9c){return BPromise['reject'](_0x1eef9c);}return _0x5e76e0[_0x7e02('0x24')]();};}function saveUpdates(_0x104659,_0x4c00dd){return function(_0x3a03d2){if(_0x3a03d2){return _0x3a03d2[_0x7e02('0x25')](_0x104659)['then'](function(_0x5625e5){return _0x5625e5;});}return null;};}function removeEntity(_0x3e1b35,_0x6c0e8c){return function(_0x177553){if(_0x177553){return _0x177553[_0x7e02('0x26')]()[_0x7e02('0x27')](function(){_0x3e1b35[_0x7e02('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58bea0,_0xae20e9){return function(_0x1d4fbc){if(!_0x1d4fbc){_0x58bea0['sendStatus'](0x194);}return _0x1d4fbc;};}function handleError(_0x3dec3e,_0x56b928){_0x56b928=_0x56b928||0x1f4;return function(_0x216e7c){logger[_0x7e02('0x28')](_0x216e7c[_0x7e02('0x29')]);if(_0x216e7c['name']){delete _0x216e7c[_0x7e02('0x2a')];}_0x3dec3e[_0x7e02('0x1c')](_0x56b928)[_0x7e02('0x2b')](_0x216e7c);};}exports['index']=function(_0x53f966,_0x110c2e){var _0x238098={},_0x4d7f12={},_0x20e839={'count':0x0,'rows':[]};var _0x3c0841=_[_0x7e02('0x2c')](db[_0x7e02('0x2d')]['rawAttributes'],function(_0x305938){return{'name':_0x305938[_0x7e02('0x2e')],'type':_0x305938[_0x7e02('0x2f')][_0x7e02('0x30')]};});_0x4d7f12[_0x7e02('0x31')]=_[_0x7e02('0x2c')](_0x3c0841,_0x7e02('0x2a'));_0x4d7f12[_0x7e02('0x32')]=_[_0x7e02('0x33')](_0x53f966[_0x7e02('0x32')]);_0x4d7f12[_0x7e02('0x34')]=_[_0x7e02('0x35')](_0x4d7f12[_0x7e02('0x31')],_0x4d7f12[_0x7e02('0x32')]);_0x238098[_0x7e02('0x36')]=_['intersection'](_0x4d7f12[_0x7e02('0x31')],qs[_0x7e02('0x37')](_0x53f966[_0x7e02('0x32')][_0x7e02('0x37')]));_0x238098[_0x7e02('0x36')]=_0x238098[_0x7e02('0x36')][_0x7e02('0x38')]?_0x238098['attributes']:_0x4d7f12['model'];if(!_0x53f966['query']['hasOwnProperty'](_0x7e02('0x39'))){_0x238098[_0x7e02('0x1f')]=qs['limit'](_0x53f966[_0x7e02('0x32')][_0x7e02('0x1f')]);_0x238098['offset']=qs[_0x7e02('0x20')](_0x53f966[_0x7e02('0x32')][_0x7e02('0x20')]);}_0x238098[_0x7e02('0x3a')]=qs[_0x7e02('0x3b')](_0x53f966['query']['sort']);_0x238098[_0x7e02('0x3c')]=qs['filters'](_[_0x7e02('0x3d')](_0x53f966[_0x7e02('0x32')],_0x4d7f12[_0x7e02('0x34')]),_0x3c0841);if(_0x53f966[_0x7e02('0x32')]['filter']){_0x238098[_0x7e02('0x3c')]=_[_0x7e02('0x3e')](_0x238098[_0x7e02('0x3c')],{'$or':_[_0x7e02('0x2c')](_0x3c0841,function(_0x1f8d8f){if(_0x1f8d8f[_0x7e02('0x2f')]!=='VIRTUAL'){var _0x1118c9={};_0x1118c9[_0x1f8d8f[_0x7e02('0x2a')]]={'$like':'%'+_0x53f966[_0x7e02('0x32')][_0x7e02('0x3f')]+'%'};return _0x1118c9;}})});}_0x238098=_[_0x7e02('0x3e')]({},_0x238098,_0x53f966[_0x7e02('0x40')]);var _0x1a0252={'where':_0x238098[_0x7e02('0x3c')]};return db[_0x7e02('0x2d')][_0x7e02('0x21')](_0x1a0252)[_0x7e02('0x27')](function(_0x15bbcb){_0x20e839[_0x7e02('0x21')]=_0x15bbcb;if(_0x53f966[_0x7e02('0x32')][_0x7e02('0x41')]){_0x238098[_0x7e02('0x42')]=[{'all':!![]}];}return db[_0x7e02('0x2d')][_0x7e02('0x43')](_0x238098);})[_0x7e02('0x27')](function(_0x461ee0){_0x20e839[_0x7e02('0x44')]=_0x461ee0;return _0x20e839;})['then'](respondWithFilteredResult(_0x110c2e,_0x238098))[_0x7e02('0x45')](handleError(_0x110c2e,null));};exports[_0x7e02('0x46')]=function(_0x1c7423,_0x157de8){var _0x153848={'raw':![],'where':{'id':_0x1c7423['params']['id']}},_0x2e920a={};_0x2e920a[_0x7e02('0x31')]=_['keys'](db[_0x7e02('0x2d')][_0x7e02('0x47')]);_0x2e920a[_0x7e02('0x32')]=_[_0x7e02('0x33')](_0x1c7423[_0x7e02('0x32')]);_0x2e920a[_0x7e02('0x34')]=_['intersection'](_0x2e920a[_0x7e02('0x31')],_0x2e920a[_0x7e02('0x32')]);_0x153848[_0x7e02('0x36')]=_[_0x7e02('0x35')](_0x2e920a[_0x7e02('0x31')],qs[_0x7e02('0x37')](_0x1c7423['query'][_0x7e02('0x37')]));_0x153848[_0x7e02('0x36')]=_0x153848[_0x7e02('0x36')][_0x7e02('0x38')]?_0x153848[_0x7e02('0x36')]:_0x2e920a['model'];if(_0x1c7423[_0x7e02('0x32')][_0x7e02('0x41')]){_0x153848[_0x7e02('0x42')]=[{'all':!![]}];}_0x153848=_['merge']({},_0x153848,_0x1c7423[_0x7e02('0x40')]);return db[_0x7e02('0x2d')][_0x7e02('0x48')](_0x153848)['then'](handleEntityNotFound(_0x157de8,null))['then'](respondWithResult(_0x157de8,null))[_0x7e02('0x45')](handleError(_0x157de8,null));};exports[_0x7e02('0x49')]=function(_0x2dc56a,_0x2a5385){return db[_0x7e02('0x2d')]['create'](_0x2dc56a['body'],{})['then'](respondWithResult(_0x2a5385,0xc9))[_0x7e02('0x45')](handleError(_0x2a5385,null));};exports[_0x7e02('0x25')]=function(_0x452303,_0x31c750){if(_0x452303[_0x7e02('0x4a')]['id']){delete _0x452303['body']['id'];}return db[_0x7e02('0x2d')][_0x7e02('0x48')]({'where':{'id':_0x452303[_0x7e02('0x4b')]['id']}})[_0x7e02('0x27')](handleEntityNotFound(_0x31c750,null))[_0x7e02('0x27')](saveUpdates(_0x452303[_0x7e02('0x4a')],null))['then'](respondWithResult(_0x31c750,null))[_0x7e02('0x45')](handleError(_0x31c750,null));};exports[_0x7e02('0x26')]=function(_0x26f562,_0x58c8aa){return db['FreshdeskAccount'][_0x7e02('0x48')]({'where':{'id':_0x26f562[_0x7e02('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58c8aa,null))[_0x7e02('0x27')](removeEntity(_0x58c8aa,null))['catch'](handleError(_0x58c8aa,null));};exports['getConfigurations']=function(_0x491b60,_0x1be030,_0xba0117){var _0x27cc1c={};var _0x17add4={};var _0x3ea710;var _0x47e6d4;return db[_0x7e02('0x2d')][_0x7e02('0x4c')]({'where':{'id':_0x491b60[_0x7e02('0x4b')]['id']}})[_0x7e02('0x27')](handleEntityNotFound(_0x1be030,null))[_0x7e02('0x27')](function(_0x3722e1){if(_0x3722e1){_0x3ea710=_0x3722e1;_0x17add4['model']=_['keys'](db[_0x7e02('0x4d')]['rawAttributes']);_0x17add4[_0x7e02('0x32')]=_['keys'](_0x491b60[_0x7e02('0x32')]);_0x17add4[_0x7e02('0x34')]=_[_0x7e02('0x35')](_0x17add4[_0x7e02('0x31')],_0x17add4['query']);_0x27cc1c[_0x7e02('0x36')]=_[_0x7e02('0x35')](_0x17add4[_0x7e02('0x31')],qs[_0x7e02('0x37')](_0x491b60[_0x7e02('0x32')]['fields']));_0x27cc1c[_0x7e02('0x36')]=_0x27cc1c['attributes'][_0x7e02('0x38')]?_0x27cc1c[_0x7e02('0x36')]:_0x17add4['model'];_0x27cc1c[_0x7e02('0x3a')]=qs[_0x7e02('0x3b')](_0x491b60['query'][_0x7e02('0x3b')]);_0x27cc1c[_0x7e02('0x3c')]=qs[_0x7e02('0x34')](_[_0x7e02('0x3d')](_0x491b60[_0x7e02('0x32')],_0x17add4[_0x7e02('0x34')]));if(_0x491b60['query']['filter']){_0x27cc1c[_0x7e02('0x3c')]=_[_0x7e02('0x3e')](_0x27cc1c[_0x7e02('0x3c')],{'$or':_[_0x7e02('0x2c')](_0x27cc1c[_0x7e02('0x36')],function(_0x1a6d75){var _0x6766b5={};_0x6766b5[_0x1a6d75]={'$like':'%'+_0x491b60['query'][_0x7e02('0x3f')]+'%'};return _0x6766b5;})});}_0x27cc1c=_['merge']({},_0x27cc1c,_0x491b60[_0x7e02('0x40')]);return _0x3ea710[_0x7e02('0x4e')](_0x27cc1c);}})[_0x7e02('0x27')](function(_0x4a4767){if(_0x4a4767){_0x47e6d4=_0x4a4767[_0x7e02('0x38')];if(!_0x491b60[_0x7e02('0x32')]['hasOwnProperty']('nolimit')){_0x27cc1c[_0x7e02('0x1f')]=qs[_0x7e02('0x1f')](_0x491b60[_0x7e02('0x32')]['limit']);_0x27cc1c[_0x7e02('0x20')]=qs[_0x7e02('0x20')](_0x491b60[_0x7e02('0x32')][_0x7e02('0x20')]);}return _0x3ea710[_0x7e02('0x4e')](_0x27cc1c);}})['then'](function(_0xbac407){if(_0xbac407){return _0xbac407?{'count':_0x47e6d4,'rows':_0xbac407}:null;}})[_0x7e02('0x27')](respondWithResult(_0x1be030,null))['catch'](handleError(_0x1be030,null));};exports[_0x7e02('0x4f')]=function(_0x31b84f,_0x25d4d3,_0x3e9e90){if(_0x31b84f[_0x7e02('0x4a')]['id']){delete _0x31b84f[_0x7e02('0x4a')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x31b84f[_0x7e02('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25d4d3,null))[_0x7e02('0x27')](function(_0x473109){if(_0x473109){_0x31b84f[_0x7e02('0x4a')][_0x7e02('0x50')]=_0x473109['id'];_0x31b84f['body']['Subjects']=integrations[_0x7e02('0x51')](_0x31b84f[_0x7e02('0x4a')][_0x7e02('0x52')],_0x31b84f[_0x7e02('0x4a')]['type']);_0x31b84f[_0x7e02('0x4a')][_0x7e02('0x53')]=integrations['getDescriptions'](_0x31b84f[_0x7e02('0x4a')][_0x7e02('0x52')],_0x31b84f[_0x7e02('0x4a')]['type']);return db[_0x7e02('0x4d')][_0x7e02('0x49')](_0x31b84f[_0x7e02('0x4a')],{'include':[{'model':db[_0x7e02('0x54')],'as':_0x7e02('0x55')},{'model':db[_0x7e02('0x54')],'as':_0x7e02('0x53')}]});}return null;})[_0x7e02('0x27')](respondWithResult(_0x25d4d3,null))[_0x7e02('0x45')](handleError(_0x25d4d3,null));};exports[_0x7e02('0x56')]=function(_0x4aa4a5,_0x24a1ba,_0x20d075){var _0xca7787='';return db[_0x7e02('0x2d')][_0x7e02('0x4c')]({'where':{'id':_0x4aa4a5['params']['id']},'attributes':['id',_0x7e02('0x57'),_0x7e02('0x58')]})[_0x7e02('0x27')](handleEntityNotFound(_0x24a1ba,null))[_0x7e02('0x27')](function(_0x2db229){if(_0x2db229){_0xca7787=_0x2db229[_0x7e02('0x57')];var _0x47456d=_0xca7787[_0x7e02('0x59')](-0x1);if(_0x47456d==='/'){_0xca7787=_0xca7787[_0x7e02('0x5a')](0x0,_0xca7787[_0x7e02('0x5b')](_0x47456d));}return rp({'method':_0x7e02('0x5c'),'uri':util[_0x7e02('0x5d')](_0x7e02('0x5e'),_0xca7787,_0x7e02('0x5f')),'headers':{'Authorization':util[_0x7e02('0x5d')]('Basic\x20%s',new Buffer(util[_0x7e02('0x5d')]('%s:X',_0x2db229['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x7e02('0x27')](function(_0x5cb331){if(_0x5cb331){var _0x243cc4=[_0x7e02('0x60'),_0x7e02('0x61'),_0x7e02('0x62'),_0x7e02('0x63'),_0x7e02('0x1c'),'priority',_0x7e02('0x64'),_0x7e02('0x65'),'ticket_type','group',_0x7e02('0x66')];_[_0x7e02('0x67')](_0x5cb331,function(_0x2cc1f3){return _0x243cc4[_0x7e02('0x68')](_0x2cc1f3[_0x7e02('0x2a')])||!_0x2cc1f3[_0x7e02('0x69')]&&_0x2cc1f3[_0x7e02('0x2f')]!==_0x7e02('0x6a')&&_0x2cc1f3[_0x7e02('0x2f')]!==_0x7e02('0x6b');});return{'count':_0x5cb331[_0x7e02('0x38')],'rows':_[_0x7e02('0x2c')](_0x5cb331,function(_0x31d920){return{'id':_0x31d920[_0x7e02('0x2a')],'name':_0x31d920[_0x7e02('0x6c')],'custom':!_0x31d920[_0x7e02('0x69')],'options':_0x31d920[_0x7e02('0x6d')]?_['map'](_0x31d920[_0x7e02('0x6d')],function(_0xec3a00){return{'name':_[_0x7e02('0x6e')](_0xec3a00),'value':_0xec3a00};}):[]};})};}})[_0x7e02('0x27')](respondWithResult(_0x24a1ba,null))[_0x7e02('0x45')](function(_0x2ae716){var _0x1ed8cc=_0x4aa4a5[_0x7e02('0x32')][_0x7e02('0x6f')]?0x1f4:_0x2ae716['statusCode']||0x1f4;logger[_0x7e02('0x28')](_0x7e02('0x70'),'getFields',_0x1ed8cc,JSON[_0x7e02('0x71')](_0x2ae716));delete _0x2ae716[_0x7e02('0x2a')];if(_0x1ed8cc===0x191){_0x1ed8cc=0x190;}_0x24a1ba['status'](_0x1ed8cc)[_0x7e02('0x2b')](_0x4aa4a5[_0x7e02('0x32')][_0x7e02('0x6f')]?{'message':_0x7e02('0x72'),'statusCode':_0x2ae716[_0x7e02('0x73')]}:_0x2ae716);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 791e791..a206414 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 _0x7ccc=['../../components/integrations/configuration','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x193a38,_0x16524b){var _0x45d2ca=function(_0x3b509a){while(--_0x3b509a){_0x193a38['push'](_0x193a38['shift']());}};_0x45d2ca(++_0x16524b);}(_0x7ccc,0x10b));var _0xc7cc=function(_0x46bf45,_0x201aaf){_0x46bf45=_0x46bf45-0x0;var _0x10cdc3=_0x7ccc[_0x46bf45];return _0x10cdc3;};'use strict';var _=require(_0xc7cc('0x0'));var util=require(_0xc7cc('0x1'));var logger=require(_0xc7cc('0x2'))(_0xc7cc('0x3'));var moment=require('moment');var BPromise=require(_0xc7cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7cc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xc7cc('0x6'));module['exports']=function(_0x5d194c,_0x337ae2){return _0x5d194c['define']('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc49=['lodash','api','bluebird','path','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x48d6d9,_0x442b28){var _0x582073=function(_0x1fdf57){while(--_0x1fdf57){_0x48d6d9['push'](_0x48d6d9['shift']());}};_0x582073(++_0x442b28);}(_0xbc49,0x14d));var _0x9bc4=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0xbc49[_0x390733];return _0x33beb9;};'use strict';var _=require(_0x9bc4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9bc4('0x1'));var moment=require('moment');var BPromise=require(_0x9bc4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bc4('0x3'));var rimraf=require('rimraf');var config=require(_0x9bc4('0x4'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x9bc4('0x5'));module['exports']=function(_0x42585a,_0x1339b3){return _0x42585a[_0x9bc4('0x6')](_0x9bc4('0x7'),attributes,{'tableName':_0x9bc4('0x8'),'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 d391321..24bfdd1 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 _0x24e0=['request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FreshdeskAccount','findAll','options','where','limit','include','map','model','attributes','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x24e0,0xe8));var _0x024e=function(_0xf8b6f9,_0x5a91a2){_0xf8b6f9=_0xf8b6f9-0x0;var _0x27c9ab=_0x24e0[_0xf8b6f9];return _0x27c9ab;};'use strict';var _=require(_0x024e('0x0'));var util=require('util');var moment=require(_0x024e('0x1'));var BPromise=require(_0x024e('0x2'));var rs=require(_0x024e('0x3'));var fs=require('fs');var Redis=require(_0x024e('0x4'));var db=require(_0x024e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x024e('0x6'))(_0x024e('0x7'));var config=require('../../config/environment');var jayson=require(_0x024e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x271966,_0x5dde75,_0x223ec4){return new BPromise(function(_0x2383d4,_0x14d54a){return client[_0x024e('0x9')](_0x271966,_0x223ec4)[_0x024e('0xa')](function(_0x3cfb96){logger[_0x024e('0xb')](_0x024e('0xc'),_0x5dde75,_0x024e('0xd'));logger['debug'](_0x024e('0xe'),_0x5dde75,'request\x20sent',JSON[_0x024e('0xf')](_0x3cfb96));if(_0x3cfb96[_0x024e('0x10')]){if(_0x3cfb96[_0x024e('0x10')][_0x024e('0x11')]===0x1f4){logger[_0x024e('0x10')](_0x024e('0xc'),_0x5dde75,_0x3cfb96[_0x024e('0x10')][_0x024e('0x12')]);return _0x14d54a(_0x3cfb96['error'][_0x024e('0x12')]);}logger[_0x024e('0x10')](_0x024e('0xc'),_0x5dde75,_0x3cfb96[_0x024e('0x10')][_0x024e('0x12')]);return _0x2383d4(_0x3cfb96[_0x024e('0x10')][_0x024e('0x12')]);}else{logger['info'](_0x024e('0xc'),_0x5dde75,_0x024e('0xd'));_0x2383d4(_0x3cfb96[_0x024e('0x13')]['message']);}})['catch'](function(_0x2bcef6){logger['error'](_0x024e('0xc'),_0x5dde75,_0x2bcef6);_0x14d54a(_0x2bcef6);});});}exports['GetFreshdeskAccount']=function(_0x31bc77){var _0x2d6893=this;return new Promise(function(_0x3feaad,_0x45ffe3){return db[_0x024e('0x14')][_0x024e('0x15')]({'raw':_0x31bc77['options']?_0x31bc77[_0x024e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x31bc77['options']?_0x31bc77[_0x024e('0x16')][_0x024e('0x17')]||null:null,'attributes':_0x31bc77[_0x024e('0x16')]?_0x31bc77['options']['attributes']||null:null,'limit':_0x31bc77[_0x024e('0x16')]?_0x31bc77[_0x024e('0x16')][_0x024e('0x18')]||null:null,'include':_0x31bc77[_0x024e('0x16')]?_0x31bc77['options'][_0x024e('0x19')]?_['map'](_0x31bc77['options']['include'],function(_0x3e856b){return{'model':db[_0x3e856b['model']],'as':_0x3e856b['as'],'attributes':_0x3e856b['attributes'],'include':_0x3e856b[_0x024e('0x19')]?_[_0x024e('0x1a')](_0x3e856b[_0x024e('0x19')],function(_0x4c3a11){return{'model':db[_0x4c3a11[_0x024e('0x1b')]],'as':_0x4c3a11['as'],'attributes':_0x4c3a11[_0x024e('0x1c')],'include':_0x4c3a11['include']?_['map'](_0x4c3a11['include'],function(_0x11ec43){return{'model':db[_0x11ec43[_0x024e('0x1b')]],'as':_0x11ec43['as'],'attributes':_0x11ec43[_0x024e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x191bad){logger[_0x024e('0xb')](_0x024e('0x1d'),_0x31bc77);logger['debug'](_0x024e('0x1d'),_0x31bc77,JSON[_0x024e('0xf')](_0x191bad));_0x3feaad(_0x191bad);})[_0x024e('0x1e')](function(_0x395237){logger[_0x024e('0x10')](_0x024e('0x1d'),_0x395237[_0x024e('0x12')],_0x31bc77);_0x45ffe3(_0x2d6893[_0x024e('0x10')](0x1f4,_0x395237[_0x024e('0x12')]));});});};exports[_0x024e('0x1f')]=function(_0x3a74d2){var _0x3c3ba4=this;return new Promise(function(_0x1d6d19,_0x5539b2){return db['FreshdeskAccount'][_0x024e('0x20')]({'raw':_0x3a74d2[_0x024e('0x16')]?_0x3a74d2[_0x024e('0x16')][_0x024e('0x21')]===undefined?!![]:![]:!![],'where':_0x3a74d2[_0x024e('0x16')]?_0x3a74d2['options'][_0x024e('0x17')]||null:null,'attributes':_0x3a74d2[_0x024e('0x16')]?_0x3a74d2['options'][_0x024e('0x1c')]||null:null,'include':_0x3a74d2[_0x024e('0x16')]?_0x3a74d2[_0x024e('0x16')][_0x024e('0x19')]?_['map'](_0x3a74d2[_0x024e('0x16')]['include'],function(_0x4063df){return{'model':db[_0x4063df[_0x024e('0x1b')]],'as':_0x4063df['as'],'attributes':_0x4063df[_0x024e('0x1c')],'include':_0x4063df['include']?_[_0x024e('0x1a')](_0x4063df[_0x024e('0x19')],function(_0x54e858){return{'model':db[_0x54e858['model']],'as':_0x54e858['as'],'attributes':_0x54e858[_0x024e('0x1c')],'include':_0x54e858['include']?_['map'](_0x54e858['include'],function(_0x9fb8d4){return{'model':db[_0x9fb8d4['model']],'as':_0x9fb8d4['as'],'attributes':_0x9fb8d4[_0x024e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fbc47){logger[_0x024e('0xb')](_0x024e('0x1f'),_0x3a74d2);logger[_0x024e('0x22')](_0x024e('0x1f'),_0x3a74d2,JSON[_0x024e('0xf')](_0x4fbc47));_0x1d6d19(_0x4fbc47);})[_0x024e('0x1e')](function(_0x407b09){logger[_0x024e('0x10')](_0x024e('0x1f'),_0x407b09[_0x024e('0x12')],_0x3a74d2);_0x5539b2(_0x3c3ba4['error'](0x1f4,_0x407b09[_0x024e('0x12')]));});});}; \ No newline at end of file +var _0xa81a=['code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c6c61,_0x1e3ad3){var _0x3c7cba=function(_0x4fd10c){while(--_0x4fd10c){_0x2c6c61['push'](_0x2c6c61['shift']());}};_0x3c7cba(++_0x1e3ad3);}(_0xa81a,0xbf));var _0xaa81=function(_0x2589ee,_0x2381bc){_0x2589ee=_0x2589ee-0x0;var _0x162995=_0xa81a[_0x2589ee];return _0x162995;};'use strict';var _=require(_0xaa81('0x0'));var util=require(_0xaa81('0x1'));var moment=require('moment');var BPromise=require(_0xaa81('0x2'));var rs=require(_0xaa81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaa81('0x4'))(_0xaa81('0x5'));var config=require(_0xaa81('0x6'));var jayson=require(_0xaa81('0x7'));var client=jayson[_0xaa81('0x8')][_0xaa81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43b968,_0x4afb80,_0x4b18f5){return new BPromise(function(_0x3ce411,_0x5d261f){return client[_0xaa81('0xa')](_0x43b968,_0x4b18f5)[_0xaa81('0xb')](function(_0x1a8750){logger[_0xaa81('0xc')](_0xaa81('0xd'),_0x4afb80,_0xaa81('0xe'));logger[_0xaa81('0xf')](_0xaa81('0x10'),_0x4afb80,_0xaa81('0xe'),JSON[_0xaa81('0x11')](_0x1a8750));if(_0x1a8750[_0xaa81('0x12')]){if(_0x1a8750[_0xaa81('0x12')][_0xaa81('0x13')]===0x1f4){logger[_0xaa81('0x12')](_0xaa81('0xd'),_0x4afb80,_0x1a8750[_0xaa81('0x12')][_0xaa81('0x14')]);return _0x5d261f(_0x1a8750[_0xaa81('0x12')][_0xaa81('0x14')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4afb80,_0x1a8750[_0xaa81('0x12')][_0xaa81('0x14')]);return _0x3ce411(_0x1a8750['error'][_0xaa81('0x14')]);}else{logger[_0xaa81('0xc')](_0xaa81('0xd'),_0x4afb80,_0xaa81('0xe'));_0x3ce411(_0x1a8750[_0xaa81('0x15')][_0xaa81('0x14')]);}})[_0xaa81('0x16')](function(_0x2f6936){logger['error'](_0xaa81('0xd'),_0x4afb80,_0x2f6936);_0x5d261f(_0x2f6936);});});}exports[_0xaa81('0x17')]=function(_0xb50005){var _0x264c8a=this;return new Promise(function(_0x5cd2da,_0x3fb575){return db['FreshdeskAccount'][_0xaa81('0x18')]({'raw':_0xb50005[_0xaa81('0x19')]?_0xb50005[_0xaa81('0x19')][_0xaa81('0x1a')]===undefined?!![]:![]:!![],'where':_0xb50005['options']?_0xb50005['options'][_0xaa81('0x1b')]||null:null,'attributes':_0xb50005[_0xaa81('0x19')]?_0xb50005[_0xaa81('0x19')]['attributes']||null:null,'limit':_0xb50005[_0xaa81('0x19')]?_0xb50005[_0xaa81('0x19')][_0xaa81('0x1c')]||null:null,'include':_0xb50005[_0xaa81('0x19')]?_0xb50005[_0xaa81('0x19')][_0xaa81('0x1d')]?_[_0xaa81('0x1e')](_0xb50005[_0xaa81('0x19')][_0xaa81('0x1d')],function(_0x2ffc62){return{'model':db[_0x2ffc62[_0xaa81('0x1f')]],'as':_0x2ffc62['as'],'attributes':_0x2ffc62[_0xaa81('0x20')],'include':_0x2ffc62['include']?_[_0xaa81('0x1e')](_0x2ffc62[_0xaa81('0x1d')],function(_0x1e7b3b){return{'model':db[_0x1e7b3b[_0xaa81('0x1f')]],'as':_0x1e7b3b['as'],'attributes':_0x1e7b3b[_0xaa81('0x20')],'include':_0x1e7b3b[_0xaa81('0x1d')]?_['map'](_0x1e7b3b[_0xaa81('0x1d')],function(_0x45fc09){return{'model':db[_0x45fc09[_0xaa81('0x1f')]],'as':_0x45fc09['as'],'attributes':_0x45fc09[_0xaa81('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaa81('0xb')](function(_0x5d06ce){logger[_0xaa81('0xc')](_0xaa81('0x17'),_0xb50005);logger[_0xaa81('0xf')]('GetFreshdeskAccount',_0xb50005,JSON[_0xaa81('0x11')](_0x5d06ce));_0x5cd2da(_0x5d06ce);})[_0xaa81('0x16')](function(_0x1cd927){logger['error'](_0xaa81('0x17'),_0x1cd927[_0xaa81('0x14')],_0xb50005);_0x3fb575(_0x264c8a[_0xaa81('0x12')](0x1f4,_0x1cd927[_0xaa81('0x14')]));});});};exports[_0xaa81('0x21')]=function(_0x577956){var _0x58043f=this;return new Promise(function(_0x59370a,_0x288c42){return db['FreshdeskAccount'][_0xaa81('0x22')]({'raw':_0x577956[_0xaa81('0x19')]?_0x577956[_0xaa81('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x577956[_0xaa81('0x19')]?_0x577956[_0xaa81('0x19')][_0xaa81('0x1b')]||null:null,'attributes':_0x577956[_0xaa81('0x19')]?_0x577956[_0xaa81('0x19')]['attributes']||null:null,'include':_0x577956[_0xaa81('0x19')]?_0x577956[_0xaa81('0x19')][_0xaa81('0x1d')]?_[_0xaa81('0x1e')](_0x577956['options']['include'],function(_0x2bc8e9){return{'model':db[_0x2bc8e9[_0xaa81('0x1f')]],'as':_0x2bc8e9['as'],'attributes':_0x2bc8e9[_0xaa81('0x20')],'include':_0x2bc8e9[_0xaa81('0x1d')]?_[_0xaa81('0x1e')](_0x2bc8e9[_0xaa81('0x1d')],function(_0x151b91){return{'model':db[_0x151b91[_0xaa81('0x1f')]],'as':_0x151b91['as'],'attributes':_0x151b91[_0xaa81('0x20')],'include':_0x151b91[_0xaa81('0x1d')]?_['map'](_0x151b91[_0xaa81('0x1d')],function(_0x1f9e8e){return{'model':db[_0x1f9e8e['model']],'as':_0x1f9e8e['as'],'attributes':_0x1f9e8e[_0xaa81('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x183dcf){logger['info']('ShowFreshdeskAccount',_0x577956);logger[_0xaa81('0xf')](_0xaa81('0x21'),_0x577956,JSON[_0xaa81('0x11')](_0x183dcf));_0x59370a(_0x183dcf);})[_0xaa81('0x16')](function(_0x52361b){logger[_0xaa81('0x12')]('ShowFreshdeskAccount',_0x52361b[_0xaa81('0x14')],_0x577956);_0x288c42(_0x58043f['error'](0x1f4,_0x52361b['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 814ce05..5669b86 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 _0x43f1=['index','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated'];(function(_0x37d222,_0x12b977){var _0x365f15=function(_0xad0dc5){while(--_0xad0dc5){_0x37d222['push'](_0x37d222['shift']());}};_0x365f15(++_0x12b977);}(_0x43f1,0x1b9));var _0x143f=function(_0x1f6e37,_0x560390){_0x1f6e37=_0x1f6e37-0x0;var _0x3d17ad=_0x43f1[_0x1f6e37];return _0x3d17ad;};'use strict';var multer=require(_0x143f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x143f('0x1'));var express=require(_0x143f('0x2'));var router=express[_0x143f('0x3')]();var fs_extra=require(_0x143f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x143f('0x5'));var config=require(_0x143f('0x6'));var controller=require(_0x143f('0x7'));router['get']('/',auth[_0x143f('0x8')](),controller[_0x143f('0x9')]);router[_0x143f('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x143f('0xa')](_0x143f('0xb'),auth['isAuthenticated'](),controller[_0x143f('0xc')]);router[_0x143f('0xa')](_0x143f('0xd'),auth[_0x143f('0x8')](),controller[_0x143f('0xe')]);router[_0x143f('0xa')](_0x143f('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x143f('0x10'),auth[_0x143f('0x8')](),controller[_0x143f('0x11')]);router[_0x143f('0x12')]('/',auth[_0x143f('0x8')](),controller[_0x143f('0x13')]);router[_0x143f('0x12')](_0x143f('0x10'),auth[_0x143f('0x8')](),controller[_0x143f('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x143f('0x15')]);router[_0x143f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x143f('0x17')]);module[_0x143f('0x18')]=router; \ No newline at end of file +var _0xddff=['create','/:id/tags','setTags','put','/:id','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0x4f64a9,_0x500ff8){var _0x164d34=function(_0x182b2c){while(--_0x182b2c){_0x4f64a9['push'](_0x4f64a9['shift']());}};_0x164d34(++_0x500ff8);}(_0xddff,0x76));var _0xfddf=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0xddff[_0x38f737];return _0x7afda3;};'use strict';var multer=require('multer');var util=require(_0xfddf('0x0'));var path=require('path');var timeout=require(_0xfddf('0x1'));var express=require('express');var router=express[_0xfddf('0x2')]();var fs_extra=require(_0xfddf('0x3'));var auth=require(_0xfddf('0x4'));var interaction=require(_0xfddf('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xfddf('0x6')]('/',auth[_0xfddf('0x7')](),controller['index']);router['get']('/:id',auth[_0xfddf('0x7')](),controller[_0xfddf('0x8')]);router['get'](_0xfddf('0x9'),auth[_0xfddf('0x7')](),controller['getFields']);router['get'](_0xfddf('0xa'),auth[_0xfddf('0x7')](),controller['getSubjects']);router[_0xfddf('0x6')](_0xfddf('0xb'),auth[_0xfddf('0x7')](),controller[_0xfddf('0xc')]);router[_0xfddf('0x6')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xfddf('0xd')]('/',auth[_0xfddf('0x7')](),controller[_0xfddf('0xe')]);router['post'](_0xfddf('0xf'),auth['isAuthenticated'](),controller[_0xfddf('0x10')]);router[_0xfddf('0x11')](_0xfddf('0x12'),auth['isAuthenticated'](),controller[_0xfddf('0x13')]);router[_0xfddf('0x14')](_0xfddf('0x12'),auth[_0xfddf('0x7')](),controller['destroy']);module[_0xfddf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2efd924..62b8bc9 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 _0x5bbf=['sequelize','exports','STRING'];(function(_0x3d49e6,_0x17652b){var _0x44baed=function(_0x7315fe){while(--_0x7315fe){_0x3d49e6['push'](_0x3d49e6['shift']());}};_0x44baed(++_0x17652b);}(_0x5bbf,0x13e));var _0xf5bb=function(_0x200af4,_0x8416e8){_0x200af4=_0x200af4-0x0;var _0x3831b6=_0x5bbf[_0x200af4];return _0x3831b6;};'use strict';var Sequelize=require(_0xf5bb('0x0'));module[_0xf5bb('0x1')]={'name':{'type':Sequelize[_0xf5bb('0x2')]},'description':{'type':Sequelize[_0xf5bb('0x2')]}}; \ No newline at end of file +var _0x19cb=['sequelize','STRING'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x19cb,0x8c));var _0xb19c=function(_0x2e591c,_0x55c6bc){_0x2e591c=_0x2e591c-0x0;var _0x4a96b5=_0x19cb[_0x2e591c];return _0x4a96b5;};'use strict';var Sequelize=require(_0xb19c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb19c('0x1')]},'description':{'type':Sequelize[_0xb19c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b0584ac..457ad9a 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 _0x3b10=['limit','count','offset','set','apply','save','then','destroy','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','find','create','body','update','params','findOne','pick','getFields','getSubjects','FreshdeskField','length','getDescriptions','getTags','Tag','setTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x3978ac,_0x2909d9){var _0x4be265=function(_0xf51cf9){while(--_0xf51cf9){_0x3978ac['push'](_0x3978ac['shift']());}};_0x4be265(++_0x2909d9);}(_0x3b10,0x1c4));var _0x03b1=function(_0x555434,_0x95d8fb){_0x555434=_0x555434-0x0;var _0x21c04f=_0x3b10[_0x555434];return _0x21c04f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03b1('0x0'));var rp=require(_0x03b1('0x1'));var moment=require(_0x03b1('0x2'));var BPromise=require(_0x03b1('0x3'));var Mustache=require(_0x03b1('0x4'));var util=require(_0x03b1('0x5'));var path=require(_0x03b1('0x6'));var sox=require('sox');var csv=require(_0x03b1('0x7'));var ejs=require(_0x03b1('0x8'));var fs=require('fs');var fs_extra=require(_0x03b1('0x9'));var _=require(_0x03b1('0xa'));var squel=require(_0x03b1('0xb'));var crypto=require(_0x03b1('0xc'));var jsforce=require(_0x03b1('0xd'));var deskjs=require(_0x03b1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x03b1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03b1('0x10'));var as=require(_0x03b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03b1('0x12'))(_0x03b1('0x13'));var utils=require(_0x03b1('0x14'));var config=require(_0x03b1('0x15'));var licenseUtil=require(_0x03b1('0x16'));var db=require(_0x03b1('0x17'))['db'];function respondWithStatusCode(_0x130186,_0x1ceb1b){_0x1ceb1b=_0x1ceb1b||0xcc;return function(_0x424c23){if(_0x424c23){return _0x130186['sendStatus'](_0x1ceb1b);}return _0x130186[_0x03b1('0x18')](_0x1ceb1b)[_0x03b1('0x19')]();};}function respondWithResult(_0x44ceae,_0x60ef8e){_0x60ef8e=_0x60ef8e||0xc8;return function(_0x37251b){if(_0x37251b){return _0x44ceae[_0x03b1('0x18')](_0x60ef8e)[_0x03b1('0x1a')](_0x37251b);}};}function respondWithFilteredResult(_0x5d387a,_0xb95783){return function(_0x4eec9a){if(_0x4eec9a){var _0x5a5371=typeof _0xb95783['offset']===_0x03b1('0x1b')&&typeof _0xb95783[_0x03b1('0x1c')]===_0x03b1('0x1b');var _0x40bf7b=_0x4eec9a[_0x03b1('0x1d')];var _0x148492=_0x5a5371?0x0:_0xb95783[_0x03b1('0x1e')];var _0x1ec8a7=_0x5a5371?_0x4eec9a['count']:_0xb95783[_0x03b1('0x1e')]+_0xb95783['limit'];var _0x46c574;if(_0x1ec8a7>=_0x40bf7b){_0x1ec8a7=_0x40bf7b;_0x46c574=0xc8;}else{_0x46c574=0xce;}_0x5d387a[_0x03b1('0x18')](_0x46c574);return _0x5d387a[_0x03b1('0x1f')]('Content-Range',_0x148492+'-'+_0x1ec8a7+'/'+_0x40bf7b)[_0x03b1('0x1a')](_0x4eec9a);}return null;};}function patchUpdates(_0x3ca374){return function(_0x693a44){try{jsonpatch[_0x03b1('0x20')](_0x693a44,_0x3ca374,!![]);}catch(_0x11f381){return BPromise['reject'](_0x11f381);}return _0x693a44[_0x03b1('0x21')]();};}function saveUpdates(_0x57a052,_0x12d8f8){return function(_0x3beed4){if(_0x3beed4){return _0x3beed4['update'](_0x57a052)[_0x03b1('0x22')](function(_0x4d537f){return _0x4d537f;});}return null;};}function removeEntity(_0x4f7ee9,_0x121f67){return function(_0x58b6ba){if(_0x58b6ba){return _0x58b6ba[_0x03b1('0x23')]()[_0x03b1('0x22')](function(){_0x4f7ee9[_0x03b1('0x18')](0xcc)[_0x03b1('0x19')]();});}};}function handleEntityNotFound(_0x2ec388,_0x59b5de){return function(_0x110744){if(!_0x110744){_0x2ec388['sendStatus'](0x194);}return _0x110744;};}function handleError(_0x4eea03,_0x561fcb){_0x561fcb=_0x561fcb||0x1f4;return function(_0x410a9c){logger['error'](_0x410a9c[_0x03b1('0x24')]);if(_0x410a9c[_0x03b1('0x25')]){delete _0x410a9c[_0x03b1('0x25')];}_0x4eea03[_0x03b1('0x18')](_0x561fcb)['send'](_0x410a9c);};}exports[_0x03b1('0x26')]=function(_0x1083e5,_0x19bb77){var _0x427128={},_0x55756c={},_0x237e84={'count':0x0,'rows':[]};var _0xea7b27=_[_0x03b1('0x27')](db[_0x03b1('0x28')][_0x03b1('0x29')],function(_0x214143){return{'name':_0x214143[_0x03b1('0x2a')],'type':_0x214143[_0x03b1('0x2b')][_0x03b1('0x2c')]};});_0x55756c[_0x03b1('0x2d')]=_[_0x03b1('0x27')](_0xea7b27,_0x03b1('0x25'));_0x55756c[_0x03b1('0x2e')]=_[_0x03b1('0x2f')](_0x1083e5[_0x03b1('0x2e')]);_0x55756c['filters']=_[_0x03b1('0x30')](_0x55756c[_0x03b1('0x2d')],_0x55756c[_0x03b1('0x2e')]);_0x427128[_0x03b1('0x31')]=_[_0x03b1('0x30')](_0x55756c[_0x03b1('0x2d')],qs[_0x03b1('0x32')](_0x1083e5[_0x03b1('0x2e')][_0x03b1('0x32')]));_0x427128[_0x03b1('0x31')]=_0x427128['attributes']['length']?_0x427128['attributes']:_0x55756c[_0x03b1('0x2d')];if(!_0x1083e5['query'][_0x03b1('0x33')](_0x03b1('0x34'))){_0x427128[_0x03b1('0x1c')]=qs['limit'](_0x1083e5[_0x03b1('0x2e')][_0x03b1('0x1c')]);_0x427128[_0x03b1('0x1e')]=qs[_0x03b1('0x1e')](_0x1083e5[_0x03b1('0x2e')]['offset']);}_0x427128[_0x03b1('0x35')]=qs[_0x03b1('0x36')](_0x1083e5[_0x03b1('0x2e')][_0x03b1('0x36')]);_0x427128[_0x03b1('0x37')]=qs['filters'](_['pick'](_0x1083e5[_0x03b1('0x2e')],_0x55756c[_0x03b1('0x38')]),_0xea7b27);if(_0x1083e5[_0x03b1('0x2e')][_0x03b1('0x39')]){_0x427128['where']=_['merge'](_0x427128['where'],{'$or':_[_0x03b1('0x27')](_0xea7b27,function(_0x37fd85){if(_0x37fd85[_0x03b1('0x2b')]!==_0x03b1('0x3a')){var _0x9495f9={};_0x9495f9[_0x37fd85[_0x03b1('0x25')]]={'$like':'%'+_0x1083e5[_0x03b1('0x2e')][_0x03b1('0x39')]+'%'};return _0x9495f9;}})});}_0x427128=_[_0x03b1('0x3b')]({},_0x427128,_0x1083e5[_0x03b1('0x3c')]);var _0x6a8308={'where':_0x427128[_0x03b1('0x37')]};return db[_0x03b1('0x28')][_0x03b1('0x1d')](_0x6a8308)[_0x03b1('0x22')](function(_0x40ba0b){_0x237e84[_0x03b1('0x1d')]=_0x40ba0b;if(_0x1083e5[_0x03b1('0x2e')][_0x03b1('0x3d')]){_0x427128['include']=[{'all':!![]}];}return db[_0x03b1('0x28')]['findAll'](_0x427128);})[_0x03b1('0x22')](function(_0x4317cb){_0x237e84[_0x03b1('0x3e')]=_0x4317cb;return _0x237e84;})['then'](respondWithFilteredResult(_0x19bb77,_0x427128))[_0x03b1('0x3f')](handleError(_0x19bb77,null));};exports[_0x03b1('0x40')]=function(_0x20f078,_0x5c929f){var _0x541624={'raw':![],'where':{'id':_0x20f078['params']['id']}},_0xd1f9b8={};_0xd1f9b8[_0x03b1('0x2d')]=_[_0x03b1('0x2f')](db[_0x03b1('0x28')][_0x03b1('0x29')]);_0xd1f9b8['query']=_[_0x03b1('0x2f')](_0x20f078[_0x03b1('0x2e')]);_0xd1f9b8[_0x03b1('0x38')]=_[_0x03b1('0x30')](_0xd1f9b8[_0x03b1('0x2d')],_0xd1f9b8[_0x03b1('0x2e')]);_0x541624[_0x03b1('0x31')]=_[_0x03b1('0x30')](_0xd1f9b8[_0x03b1('0x2d')],qs[_0x03b1('0x32')](_0x20f078[_0x03b1('0x2e')][_0x03b1('0x32')]));_0x541624['attributes']=_0x541624[_0x03b1('0x31')]['length']?_0x541624[_0x03b1('0x31')]:_0xd1f9b8['model'];if(_0x20f078[_0x03b1('0x2e')][_0x03b1('0x3d')]){_0x541624['include']=[{'all':!![]}];}_0x541624=_[_0x03b1('0x3b')]({},_0x541624,_0x20f078[_0x03b1('0x3c')]);return db['FreshdeskConfiguration'][_0x03b1('0x41')](_0x541624)[_0x03b1('0x22')](handleEntityNotFound(_0x5c929f,null))[_0x03b1('0x22')](respondWithResult(_0x5c929f,null))[_0x03b1('0x3f')](handleError(_0x5c929f,null));};exports[_0x03b1('0x42')]=function(_0x57b4ee,_0x38e7ae){return db[_0x03b1('0x28')][_0x03b1('0x42')](_0x57b4ee[_0x03b1('0x43')],{})[_0x03b1('0x22')](respondWithResult(_0x38e7ae,0xc9))[_0x03b1('0x3f')](handleError(_0x38e7ae,null));};exports[_0x03b1('0x44')]=function(_0x26ddcf,_0x5b2b00){if(_0x26ddcf[_0x03b1('0x43')]['id']){delete _0x26ddcf['body']['id'];}return db['FreshdeskConfiguration'][_0x03b1('0x41')]({'where':{'id':_0x26ddcf[_0x03b1('0x45')]['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x5b2b00,null))[_0x03b1('0x22')](saveUpdates(_0x26ddcf[_0x03b1('0x43')],null))[_0x03b1('0x22')](respondWithResult(_0x5b2b00,null))[_0x03b1('0x3f')](handleError(_0x5b2b00,null));};exports[_0x03b1('0x23')]=function(_0x36d7f7,_0x38b1c4){return db[_0x03b1('0x28')][_0x03b1('0x41')]({'where':{'id':_0x36d7f7['params']['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x38b1c4,null))[_0x03b1('0x22')](removeEntity(_0x38b1c4,null))[_0x03b1('0x3f')](handleError(_0x38b1c4,null));};exports['getFields']=function(_0x534174,_0x2b8950,_0x5ef08d){var _0x32ca76={};var _0xd6e469={};var _0x200fe6;var _0x31b343;return db[_0x03b1('0x28')][_0x03b1('0x46')]({'where':{'id':_0x534174[_0x03b1('0x45')]['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x2b8950,null))[_0x03b1('0x22')](function(_0x501a09){if(_0x501a09){_0x200fe6=_0x501a09;_0xd6e469['model']=_['keys'](db['FreshdeskField'][_0x03b1('0x29')]);_0xd6e469[_0x03b1('0x2e')]=_['keys'](_0x534174[_0x03b1('0x2e')]);_0xd6e469[_0x03b1('0x38')]=_[_0x03b1('0x30')](_0xd6e469['model'],_0xd6e469[_0x03b1('0x2e')]);_0x32ca76['attributes']=_[_0x03b1('0x30')](_0xd6e469[_0x03b1('0x2d')],qs[_0x03b1('0x32')](_0x534174['query']['fields']));_0x32ca76[_0x03b1('0x31')]=_0x32ca76[_0x03b1('0x31')]['length']?_0x32ca76[_0x03b1('0x31')]:_0xd6e469['model'];_0x32ca76[_0x03b1('0x35')]=qs[_0x03b1('0x36')](_0x534174[_0x03b1('0x2e')][_0x03b1('0x36')]);_0x32ca76[_0x03b1('0x37')]=qs[_0x03b1('0x38')](_[_0x03b1('0x47')](_0x534174[_0x03b1('0x2e')],_0xd6e469['filters']));if(_0x534174[_0x03b1('0x2e')][_0x03b1('0x39')]){_0x32ca76['where']=_[_0x03b1('0x3b')](_0x32ca76[_0x03b1('0x37')],{'$or':_['map'](_0x32ca76[_0x03b1('0x31')],function(_0x5dd1a7){var _0x2fae30={};_0x2fae30[_0x5dd1a7]={'$like':'%'+_0x534174[_0x03b1('0x2e')][_0x03b1('0x39')]+'%'};return _0x2fae30;})});}_0x32ca76=_[_0x03b1('0x3b')]({},_0x32ca76,_0x534174[_0x03b1('0x3c')]);return _0x200fe6[_0x03b1('0x48')](_0x32ca76);}})['then'](function(_0x4f4fc2){if(_0x4f4fc2){_0x31b343=_0x4f4fc2['length'];if(!_0x534174['query'][_0x03b1('0x33')](_0x03b1('0x34'))){_0x32ca76[_0x03b1('0x1c')]=qs['limit'](_0x534174['query'][_0x03b1('0x1c')]);_0x32ca76[_0x03b1('0x1e')]=qs['offset'](_0x534174[_0x03b1('0x2e')]['offset']);}return _0x200fe6[_0x03b1('0x48')](_0x32ca76);}})['then'](function(_0x1f6b40){if(_0x1f6b40){return _0x1f6b40?{'count':_0x31b343,'rows':_0x1f6b40}:null;}})['then'](respondWithResult(_0x2b8950,null))[_0x03b1('0x3f')](handleError(_0x2b8950,null));};exports[_0x03b1('0x49')]=function(_0x2dfebb,_0x229d9b,_0x120db4){var _0x7c5dc4={};var _0x48f1d6={};var _0x5e248a;var _0x472a73;return db[_0x03b1('0x28')]['findOne']({'where':{'id':_0x2dfebb[_0x03b1('0x45')]['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x229d9b,null))[_0x03b1('0x22')](function(_0x3fee2c){if(_0x3fee2c){_0x5e248a=_0x3fee2c;_0x48f1d6[_0x03b1('0x2d')]=_['keys'](db[_0x03b1('0x4a')][_0x03b1('0x29')]);_0x48f1d6['query']=_[_0x03b1('0x2f')](_0x2dfebb[_0x03b1('0x2e')]);_0x48f1d6['filters']=_['intersection'](_0x48f1d6[_0x03b1('0x2d')],_0x48f1d6[_0x03b1('0x2e')]);_0x7c5dc4[_0x03b1('0x31')]=_[_0x03b1('0x30')](_0x48f1d6['model'],qs[_0x03b1('0x32')](_0x2dfebb[_0x03b1('0x2e')][_0x03b1('0x32')]));_0x7c5dc4['attributes']=_0x7c5dc4[_0x03b1('0x31')]['length']?_0x7c5dc4[_0x03b1('0x31')]:_0x48f1d6[_0x03b1('0x2d')];_0x7c5dc4[_0x03b1('0x35')]=qs[_0x03b1('0x36')](_0x2dfebb[_0x03b1('0x2e')][_0x03b1('0x36')]);_0x7c5dc4[_0x03b1('0x37')]=qs[_0x03b1('0x38')](_[_0x03b1('0x47')](_0x2dfebb['query'],_0x48f1d6[_0x03b1('0x38')]));if(_0x2dfebb[_0x03b1('0x2e')][_0x03b1('0x39')]){_0x7c5dc4['where']=_[_0x03b1('0x3b')](_0x7c5dc4[_0x03b1('0x37')],{'$or':_[_0x03b1('0x27')](_0x7c5dc4[_0x03b1('0x31')],function(_0x4005a2){var _0x362625={};_0x362625[_0x4005a2]={'$like':'%'+_0x2dfebb[_0x03b1('0x2e')][_0x03b1('0x39')]+'%'};return _0x362625;})});}_0x7c5dc4=_['merge']({},_0x7c5dc4,_0x2dfebb[_0x03b1('0x3c')]);return _0x5e248a[_0x03b1('0x49')](_0x7c5dc4);}})['then'](function(_0x3f5506){if(_0x3f5506){_0x472a73=_0x3f5506[_0x03b1('0x4b')];if(!_0x2dfebb[_0x03b1('0x2e')][_0x03b1('0x33')](_0x03b1('0x34'))){_0x7c5dc4[_0x03b1('0x1c')]=qs[_0x03b1('0x1c')](_0x2dfebb['query']['limit']);_0x7c5dc4['offset']=qs['offset'](_0x2dfebb[_0x03b1('0x2e')][_0x03b1('0x1e')]);}return _0x5e248a[_0x03b1('0x49')](_0x7c5dc4);}})[_0x03b1('0x22')](function(_0x5ae7ff){if(_0x5ae7ff){return _0x5ae7ff?{'count':_0x472a73,'rows':_0x5ae7ff}:null;}})[_0x03b1('0x22')](respondWithResult(_0x229d9b,null))[_0x03b1('0x3f')](handleError(_0x229d9b,null));};exports[_0x03b1('0x4c')]=function(_0x3eade3,_0x39f0dd,_0x5ca27d){var _0x405a11={};var _0xcda02a={};var _0x2271f3;var _0x180357;return db['FreshdeskConfiguration'][_0x03b1('0x46')]({'where':{'id':_0x3eade3['params']['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x39f0dd,null))[_0x03b1('0x22')](function(_0x104f8b){if(_0x104f8b){_0x2271f3=_0x104f8b;_0xcda02a[_0x03b1('0x2d')]=_[_0x03b1('0x2f')](db[_0x03b1('0x4a')][_0x03b1('0x29')]);_0xcda02a[_0x03b1('0x2e')]=_[_0x03b1('0x2f')](_0x3eade3[_0x03b1('0x2e')]);_0xcda02a[_0x03b1('0x38')]=_[_0x03b1('0x30')](_0xcda02a[_0x03b1('0x2d')],_0xcda02a[_0x03b1('0x2e')]);_0x405a11[_0x03b1('0x31')]=_[_0x03b1('0x30')](_0xcda02a[_0x03b1('0x2d')],qs['fields'](_0x3eade3[_0x03b1('0x2e')][_0x03b1('0x32')]));_0x405a11[_0x03b1('0x31')]=_0x405a11[_0x03b1('0x31')]['length']?_0x405a11['attributes']:_0xcda02a[_0x03b1('0x2d')];_0x405a11[_0x03b1('0x35')]=qs[_0x03b1('0x36')](_0x3eade3['query']['sort']);_0x405a11[_0x03b1('0x37')]=qs['filters'](_['pick'](_0x3eade3['query'],_0xcda02a[_0x03b1('0x38')]));if(_0x3eade3[_0x03b1('0x2e')]['filter']){_0x405a11[_0x03b1('0x37')]=_[_0x03b1('0x3b')](_0x405a11[_0x03b1('0x37')],{'$or':_[_0x03b1('0x27')](_0x405a11[_0x03b1('0x31')],function(_0x218979){var _0x29250d={};_0x29250d[_0x218979]={'$like':'%'+_0x3eade3['query'][_0x03b1('0x39')]+'%'};return _0x29250d;})});}_0x405a11=_[_0x03b1('0x3b')]({},_0x405a11,_0x3eade3[_0x03b1('0x3c')]);return _0x2271f3[_0x03b1('0x4c')](_0x405a11);}})[_0x03b1('0x22')](function(_0x4c617d){if(_0x4c617d){_0x180357=_0x4c617d[_0x03b1('0x4b')];if(!_0x3eade3[_0x03b1('0x2e')][_0x03b1('0x33')](_0x03b1('0x34'))){_0x405a11[_0x03b1('0x1c')]=qs['limit'](_0x3eade3[_0x03b1('0x2e')]['limit']);_0x405a11[_0x03b1('0x1e')]=qs[_0x03b1('0x1e')](_0x3eade3[_0x03b1('0x2e')][_0x03b1('0x1e')]);}return _0x2271f3[_0x03b1('0x4c')](_0x405a11);}})[_0x03b1('0x22')](function(_0x336090){if(_0x336090){return _0x336090?{'count':_0x180357,'rows':_0x336090}:null;}})[_0x03b1('0x22')](respondWithResult(_0x39f0dd,null))[_0x03b1('0x3f')](handleError(_0x39f0dd,null));};exports[_0x03b1('0x4d')]=function(_0x369d80,_0x40de07,_0x4397ef){var _0x4d2ab6={};var _0x8fefe1={};var _0x5acde7;var _0x5e1959;return db[_0x03b1('0x28')]['findOne']({'where':{'id':_0x369d80[_0x03b1('0x45')]['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x40de07,null))[_0x03b1('0x22')](function(_0x1bc050){if(_0x1bc050){_0x5acde7=_0x1bc050;_0x8fefe1[_0x03b1('0x2d')]=_['keys'](db[_0x03b1('0x4e')][_0x03b1('0x29')]);_0x8fefe1[_0x03b1('0x2e')]=_[_0x03b1('0x2f')](_0x369d80[_0x03b1('0x2e')]);_0x8fefe1['filters']=_[_0x03b1('0x30')](_0x8fefe1['model'],_0x8fefe1[_0x03b1('0x2e')]);_0x4d2ab6[_0x03b1('0x31')]=_[_0x03b1('0x30')](_0x8fefe1[_0x03b1('0x2d')],qs[_0x03b1('0x32')](_0x369d80['query'][_0x03b1('0x32')]));_0x4d2ab6[_0x03b1('0x31')]=_0x4d2ab6[_0x03b1('0x31')][_0x03b1('0x4b')]?_0x4d2ab6['attributes']:_0x8fefe1['model'];_0x4d2ab6['order']=qs[_0x03b1('0x36')](_0x369d80[_0x03b1('0x2e')]['sort']);_0x4d2ab6[_0x03b1('0x37')]=qs['filters'](_[_0x03b1('0x47')](_0x369d80[_0x03b1('0x2e')],_0x8fefe1[_0x03b1('0x38')]));if(_0x369d80[_0x03b1('0x2e')]['filter']){_0x4d2ab6['where']=_[_0x03b1('0x3b')](_0x4d2ab6['where'],{'$or':_['map'](_0x4d2ab6['attributes'],function(_0x895509){var _0x2df5a5={};_0x2df5a5[_0x895509]={'$like':'%'+_0x369d80[_0x03b1('0x2e')]['filter']+'%'};return _0x2df5a5;})});}_0x4d2ab6=_[_0x03b1('0x3b')]({},_0x4d2ab6,_0x369d80[_0x03b1('0x3c')]);return _0x5acde7['getTags'](_0x4d2ab6);}})[_0x03b1('0x22')](function(_0x15bcc3){if(_0x15bcc3){_0x5e1959=_0x15bcc3['length'];if(!_0x369d80[_0x03b1('0x2e')][_0x03b1('0x33')](_0x03b1('0x34'))){_0x4d2ab6['limit']=qs[_0x03b1('0x1c')](_0x369d80[_0x03b1('0x2e')][_0x03b1('0x1c')]);_0x4d2ab6[_0x03b1('0x1e')]=qs['offset'](_0x369d80[_0x03b1('0x2e')][_0x03b1('0x1e')]);}return _0x5acde7[_0x03b1('0x4d')](_0x4d2ab6);}})['then'](function(_0x5932a2){if(_0x5932a2){return _0x5932a2?{'count':_0x5e1959,'rows':_0x5932a2}:null;}})[_0x03b1('0x22')](respondWithResult(_0x40de07,null))[_0x03b1('0x3f')](handleError(_0x40de07,null));};exports[_0x03b1('0x4f')]=function(_0x93f8f6,_0x111251,_0x481ff1){if(_0x93f8f6[_0x03b1('0x43')]['id']){delete _0x93f8f6[_0x03b1('0x43')]['id'];}return db['FreshdeskConfiguration'][_0x03b1('0x46')]({'where':{'id':_0x93f8f6[_0x03b1('0x45')]['id']}})[_0x03b1('0x22')](handleEntityNotFound(_0x111251,null))[_0x03b1('0x22')](function(_0x22854a){if(_0x22854a){return _0x22854a[_0x03b1('0x4f')](_0x93f8f6['body']['ids']||[]);}return null;})[_0x03b1('0x22')](respondWithResult(_0x111251,null))['catch'](handleError(_0x111251,null));}; \ No newline at end of file +var _0x1b1f=['ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','error','stack','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags'];(function(_0x54591f,_0x2dce50){var _0x2a99a6=function(_0x391c15){while(--_0x391c15){_0x54591f['push'](_0x54591f['shift']());}};_0x2a99a6(++_0x2dce50);}(_0x1b1f,0x19b));var _0xf1b1=function(_0x126861,_0x2570de){_0x126861=_0x126861-0x0;var _0x5aa50f=_0x1b1f[_0x126861];return _0x5aa50f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1b1('0x0'));var zipdir=require(_0xf1b1('0x1'));var jsonpatch=require(_0xf1b1('0x2'));var rp=require(_0xf1b1('0x3'));var moment=require(_0xf1b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf1b1('0x5'));var util=require(_0xf1b1('0x6'));var path=require('path');var sox=require(_0xf1b1('0x7'));var csv=require(_0xf1b1('0x8'));var ejs=require(_0xf1b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1b1('0xa'));var squel=require(_0xf1b1('0xb'));var crypto=require(_0xf1b1('0xc'));var jsforce=require(_0xf1b1('0xd'));var deskjs=require(_0xf1b1('0xe'));var toCsv=require(_0xf1b1('0x8'));var querystring=require(_0xf1b1('0xf'));var Papa=require('papaparse');var Redis=require(_0xf1b1('0x10'));var authService=require(_0xf1b1('0x11'));var qs=require(_0xf1b1('0x12'));var as=require(_0xf1b1('0x13'));var hardwareService=require(_0xf1b1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf1b1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf1b1('0x16'))['db'];function respondWithStatusCode(_0x3758c3,_0x52045c){_0x52045c=_0x52045c||0xcc;return function(_0x455a3d){if(_0x455a3d){return _0x3758c3[_0xf1b1('0x17')](_0x52045c);}return _0x3758c3['status'](_0x52045c)['end']();};}function respondWithResult(_0x35b9a1,_0x25d103){_0x25d103=_0x25d103||0xc8;return function(_0x22dc9b){if(_0x22dc9b){return _0x35b9a1[_0xf1b1('0x18')](_0x25d103)[_0xf1b1('0x19')](_0x22dc9b);}};}function respondWithFilteredResult(_0x5ba54d,_0x37b11c){return function(_0x586e4d){if(_0x586e4d){var _0x452c0a=typeof _0x37b11c[_0xf1b1('0x1a')]===_0xf1b1('0x1b')&&typeof _0x37b11c[_0xf1b1('0x1c')]===_0xf1b1('0x1b');var _0xcabb13=_0x586e4d[_0xf1b1('0x1d')];var _0x17290c=_0x452c0a?0x0:_0x37b11c[_0xf1b1('0x1a')];var _0x5120c0=_0x452c0a?_0x586e4d['count']:_0x37b11c['offset']+_0x37b11c['limit'];var _0xf1a392;if(_0x5120c0>=_0xcabb13){_0x5120c0=_0xcabb13;_0xf1a392=0xc8;}else{_0xf1a392=0xce;}_0x5ba54d[_0xf1b1('0x18')](_0xf1a392);return _0x5ba54d[_0xf1b1('0x1e')]('Content-Range',_0x17290c+'-'+_0x5120c0+'/'+_0xcabb13)[_0xf1b1('0x19')](_0x586e4d);}return null;};}function patchUpdates(_0x2a3f1c){return function(_0x5ce1f3){try{jsonpatch[_0xf1b1('0x1f')](_0x5ce1f3,_0x2a3f1c,!![]);}catch(_0x111377){return BPromise[_0xf1b1('0x20')](_0x111377);}return _0x5ce1f3['save']();};}function saveUpdates(_0x30eb7f,_0x281fae){return function(_0x285caf){if(_0x285caf){return _0x285caf[_0xf1b1('0x21')](_0x30eb7f)['then'](function(_0x1e23f1){return _0x1e23f1;});}return null;};}function removeEntity(_0x2393df,_0x58a0e4){return function(_0x12dea5){if(_0x12dea5){return _0x12dea5[_0xf1b1('0x22')]()['then'](function(){_0x2393df[_0xf1b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa581f6,_0x5bed2a){return function(_0x12cb4b){if(!_0x12cb4b){_0xa581f6[_0xf1b1('0x17')](0x194);}return _0x12cb4b;};}function handleError(_0x1caa36,_0x5a7020){_0x5a7020=_0x5a7020||0x1f4;return function(_0x4abb0a){logger[_0xf1b1('0x23')](_0x4abb0a[_0xf1b1('0x24')]);if(_0x4abb0a['name']){delete _0x4abb0a['name'];}_0x1caa36[_0xf1b1('0x18')](_0x5a7020)['send'](_0x4abb0a);};}exports[_0xf1b1('0x25')]=function(_0x37fb16,_0x6e0b92){var _0x57d1ca={},_0x4efe64={},_0x5f33fe={'count':0x0,'rows':[]};var _0xa09093=_[_0xf1b1('0x26')](db[_0xf1b1('0x27')][_0xf1b1('0x28')],function(_0x300667){return{'name':_0x300667[_0xf1b1('0x29')],'type':_0x300667[_0xf1b1('0x2a')][_0xf1b1('0x2b')]};});_0x4efe64[_0xf1b1('0x2c')]=_[_0xf1b1('0x26')](_0xa09093,_0xf1b1('0x2d'));_0x4efe64['query']=_['keys'](_0x37fb16[_0xf1b1('0x2e')]);_0x4efe64['filters']=_['intersection'](_0x4efe64[_0xf1b1('0x2c')],_0x4efe64[_0xf1b1('0x2e')]);_0x57d1ca[_0xf1b1('0x2f')]=_[_0xf1b1('0x30')](_0x4efe64['model'],qs['fields'](_0x37fb16[_0xf1b1('0x2e')][_0xf1b1('0x31')]));_0x57d1ca[_0xf1b1('0x2f')]=_0x57d1ca[_0xf1b1('0x2f')]['length']?_0x57d1ca[_0xf1b1('0x2f')]:_0x4efe64['model'];if(!_0x37fb16['query'][_0xf1b1('0x32')]('nolimit')){_0x57d1ca[_0xf1b1('0x1c')]=qs['limit'](_0x37fb16[_0xf1b1('0x2e')][_0xf1b1('0x1c')]);_0x57d1ca['offset']=qs['offset'](_0x37fb16[_0xf1b1('0x2e')][_0xf1b1('0x1a')]);}_0x57d1ca[_0xf1b1('0x33')]=qs[_0xf1b1('0x34')](_0x37fb16['query'][_0xf1b1('0x34')]);_0x57d1ca[_0xf1b1('0x35')]=qs[_0xf1b1('0x36')](_['pick'](_0x37fb16['query'],_0x4efe64[_0xf1b1('0x36')]),_0xa09093);if(_0x37fb16[_0xf1b1('0x2e')][_0xf1b1('0x37')]){_0x57d1ca[_0xf1b1('0x35')]=_[_0xf1b1('0x38')](_0x57d1ca['where'],{'$or':_['map'](_0xa09093,function(_0x47b4ea){if(_0x47b4ea[_0xf1b1('0x2a')]!==_0xf1b1('0x39')){var _0x2c430e={};_0x2c430e[_0x47b4ea[_0xf1b1('0x2d')]]={'$like':'%'+_0x37fb16[_0xf1b1('0x2e')][_0xf1b1('0x37')]+'%'};return _0x2c430e;}})});}_0x57d1ca=_[_0xf1b1('0x38')]({},_0x57d1ca,_0x37fb16[_0xf1b1('0x3a')]);var _0x3d1967={'where':_0x57d1ca[_0xf1b1('0x35')]};return db[_0xf1b1('0x27')]['count'](_0x3d1967)[_0xf1b1('0x3b')](function(_0x264c89){_0x5f33fe[_0xf1b1('0x1d')]=_0x264c89;if(_0x37fb16[_0xf1b1('0x2e')][_0xf1b1('0x3c')]){_0x57d1ca[_0xf1b1('0x3d')]=[{'all':!![]}];}return db[_0xf1b1('0x27')][_0xf1b1('0x3e')](_0x57d1ca);})[_0xf1b1('0x3b')](function(_0xda3e92){_0x5f33fe[_0xf1b1('0x3f')]=_0xda3e92;return _0x5f33fe;})[_0xf1b1('0x3b')](respondWithFilteredResult(_0x6e0b92,_0x57d1ca))[_0xf1b1('0x40')](handleError(_0x6e0b92,null));};exports[_0xf1b1('0x41')]=function(_0x9265ad,_0x5705b6){var _0x2abf9c={'raw':![],'where':{'id':_0x9265ad[_0xf1b1('0x42')]['id']}},_0x19f3a={};_0x19f3a[_0xf1b1('0x2c')]=_[_0xf1b1('0x43')](db[_0xf1b1('0x27')][_0xf1b1('0x28')]);_0x19f3a['query']=_[_0xf1b1('0x43')](_0x9265ad[_0xf1b1('0x2e')]);_0x19f3a[_0xf1b1('0x36')]=_[_0xf1b1('0x30')](_0x19f3a[_0xf1b1('0x2c')],_0x19f3a[_0xf1b1('0x2e')]);_0x2abf9c[_0xf1b1('0x2f')]=_[_0xf1b1('0x30')](_0x19f3a['model'],qs[_0xf1b1('0x31')](_0x9265ad[_0xf1b1('0x2e')][_0xf1b1('0x31')]));_0x2abf9c[_0xf1b1('0x2f')]=_0x2abf9c[_0xf1b1('0x2f')][_0xf1b1('0x44')]?_0x2abf9c[_0xf1b1('0x2f')]:_0x19f3a[_0xf1b1('0x2c')];if(_0x9265ad['query'][_0xf1b1('0x3c')]){_0x2abf9c['include']=[{'all':!![]}];}_0x2abf9c=_[_0xf1b1('0x38')]({},_0x2abf9c,_0x9265ad[_0xf1b1('0x3a')]);return db['FreshdeskConfiguration']['find'](_0x2abf9c)[_0xf1b1('0x3b')](handleEntityNotFound(_0x5705b6,null))['then'](respondWithResult(_0x5705b6,null))[_0xf1b1('0x40')](handleError(_0x5705b6,null));};exports[_0xf1b1('0x45')]=function(_0x16e4a6,_0x185fb4){return db['FreshdeskConfiguration'][_0xf1b1('0x45')](_0x16e4a6[_0xf1b1('0x46')],{})[_0xf1b1('0x3b')](respondWithResult(_0x185fb4,0xc9))['catch'](handleError(_0x185fb4,null));};exports[_0xf1b1('0x21')]=function(_0x3699c7,_0x378bb5){if(_0x3699c7[_0xf1b1('0x46')]['id']){delete _0x3699c7[_0xf1b1('0x46')]['id'];}return db[_0xf1b1('0x27')][_0xf1b1('0x47')]({'where':{'id':_0x3699c7[_0xf1b1('0x42')]['id']}})[_0xf1b1('0x3b')](handleEntityNotFound(_0x378bb5,null))[_0xf1b1('0x3b')](saveUpdates(_0x3699c7[_0xf1b1('0x46')],null))[_0xf1b1('0x3b')](respondWithResult(_0x378bb5,null))[_0xf1b1('0x40')](handleError(_0x378bb5,null));};exports[_0xf1b1('0x22')]=function(_0x55e12a,_0x1bae55){return db[_0xf1b1('0x27')]['find']({'where':{'id':_0x55e12a['params']['id']}})['then'](handleEntityNotFound(_0x1bae55,null))['then'](removeEntity(_0x1bae55,null))[_0xf1b1('0x40')](handleError(_0x1bae55,null));};exports[_0xf1b1('0x48')]=function(_0x127eda,_0x557807,_0x33d50f){var _0x19a670={};var _0x51e4c3={};var _0x6ef481;var _0x13138a;return db['FreshdeskConfiguration'][_0xf1b1('0x49')]({'where':{'id':_0x127eda[_0xf1b1('0x42')]['id']}})['then'](handleEntityNotFound(_0x557807,null))[_0xf1b1('0x3b')](function(_0x2e275e){if(_0x2e275e){_0x6ef481=_0x2e275e;_0x51e4c3[_0xf1b1('0x2c')]=_[_0xf1b1('0x43')](db[_0xf1b1('0x4a')][_0xf1b1('0x28')]);_0x51e4c3[_0xf1b1('0x2e')]=_[_0xf1b1('0x43')](_0x127eda[_0xf1b1('0x2e')]);_0x51e4c3['filters']=_[_0xf1b1('0x30')](_0x51e4c3['model'],_0x51e4c3['query']);_0x19a670[_0xf1b1('0x2f')]=_[_0xf1b1('0x30')](_0x51e4c3[_0xf1b1('0x2c')],qs[_0xf1b1('0x31')](_0x127eda[_0xf1b1('0x2e')]['fields']));_0x19a670[_0xf1b1('0x2f')]=_0x19a670[_0xf1b1('0x2f')]['length']?_0x19a670[_0xf1b1('0x2f')]:_0x51e4c3[_0xf1b1('0x2c')];_0x19a670[_0xf1b1('0x33')]=qs[_0xf1b1('0x34')](_0x127eda[_0xf1b1('0x2e')][_0xf1b1('0x34')]);_0x19a670['where']=qs[_0xf1b1('0x36')](_[_0xf1b1('0x4b')](_0x127eda['query'],_0x51e4c3['filters']));if(_0x127eda[_0xf1b1('0x2e')]['filter']){_0x19a670[_0xf1b1('0x35')]=_[_0xf1b1('0x38')](_0x19a670[_0xf1b1('0x35')],{'$or':_[_0xf1b1('0x26')](_0x19a670[_0xf1b1('0x2f')],function(_0x6695cd){var _0x186167={};_0x186167[_0x6695cd]={'$like':'%'+_0x127eda['query'][_0xf1b1('0x37')]+'%'};return _0x186167;})});}_0x19a670=_['merge']({},_0x19a670,_0x127eda[_0xf1b1('0x3a')]);return _0x6ef481[_0xf1b1('0x48')](_0x19a670);}})[_0xf1b1('0x3b')](function(_0x155cb3){if(_0x155cb3){_0x13138a=_0x155cb3[_0xf1b1('0x44')];if(!_0x127eda[_0xf1b1('0x2e')]['hasOwnProperty'](_0xf1b1('0x4c'))){_0x19a670[_0xf1b1('0x1c')]=qs[_0xf1b1('0x1c')](_0x127eda[_0xf1b1('0x2e')][_0xf1b1('0x1c')]);_0x19a670[_0xf1b1('0x1a')]=qs[_0xf1b1('0x1a')](_0x127eda[_0xf1b1('0x2e')][_0xf1b1('0x1a')]);}return _0x6ef481[_0xf1b1('0x48')](_0x19a670);}})[_0xf1b1('0x3b')](function(_0x518065){if(_0x518065){return _0x518065?{'count':_0x13138a,'rows':_0x518065}:null;}})[_0xf1b1('0x3b')](respondWithResult(_0x557807,null))[_0xf1b1('0x40')](handleError(_0x557807,null));};exports[_0xf1b1('0x4d')]=function(_0x50940e,_0x3f59bd,_0x4d5d2a){var _0x8a6884={};var _0xf3e8d1={};var _0x96b4b8;var _0x4271a3;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x50940e[_0xf1b1('0x42')]['id']}})[_0xf1b1('0x3b')](handleEntityNotFound(_0x3f59bd,null))[_0xf1b1('0x3b')](function(_0x1aa872){if(_0x1aa872){_0x96b4b8=_0x1aa872;_0xf3e8d1[_0xf1b1('0x2c')]=_[_0xf1b1('0x43')](db[_0xf1b1('0x4a')][_0xf1b1('0x28')]);_0xf3e8d1[_0xf1b1('0x2e')]=_[_0xf1b1('0x43')](_0x50940e[_0xf1b1('0x2e')]);_0xf3e8d1[_0xf1b1('0x36')]=_[_0xf1b1('0x30')](_0xf3e8d1[_0xf1b1('0x2c')],_0xf3e8d1['query']);_0x8a6884['attributes']=_[_0xf1b1('0x30')](_0xf3e8d1[_0xf1b1('0x2c')],qs[_0xf1b1('0x31')](_0x50940e[_0xf1b1('0x2e')][_0xf1b1('0x31')]));_0x8a6884['attributes']=_0x8a6884[_0xf1b1('0x2f')][_0xf1b1('0x44')]?_0x8a6884[_0xf1b1('0x2f')]:_0xf3e8d1[_0xf1b1('0x2c')];_0x8a6884[_0xf1b1('0x33')]=qs[_0xf1b1('0x34')](_0x50940e[_0xf1b1('0x2e')][_0xf1b1('0x34')]);_0x8a6884[_0xf1b1('0x35')]=qs[_0xf1b1('0x36')](_[_0xf1b1('0x4b')](_0x50940e[_0xf1b1('0x2e')],_0xf3e8d1[_0xf1b1('0x36')]));if(_0x50940e[_0xf1b1('0x2e')][_0xf1b1('0x37')]){_0x8a6884['where']=_[_0xf1b1('0x38')](_0x8a6884[_0xf1b1('0x35')],{'$or':_[_0xf1b1('0x26')](_0x8a6884[_0xf1b1('0x2f')],function(_0xa08521){var _0x3c8279={};_0x3c8279[_0xa08521]={'$like':'%'+_0x50940e['query'][_0xf1b1('0x37')]+'%'};return _0x3c8279;})});}_0x8a6884=_['merge']({},_0x8a6884,_0x50940e[_0xf1b1('0x3a')]);return _0x96b4b8[_0xf1b1('0x4d')](_0x8a6884);}})['then'](function(_0x3912c8){if(_0x3912c8){_0x4271a3=_0x3912c8[_0xf1b1('0x44')];if(!_0x50940e[_0xf1b1('0x2e')][_0xf1b1('0x32')](_0xf1b1('0x4c'))){_0x8a6884[_0xf1b1('0x1c')]=qs[_0xf1b1('0x1c')](_0x50940e[_0xf1b1('0x2e')]['limit']);_0x8a6884['offset']=qs[_0xf1b1('0x1a')](_0x50940e[_0xf1b1('0x2e')]['offset']);}return _0x96b4b8[_0xf1b1('0x4d')](_0x8a6884);}})[_0xf1b1('0x3b')](function(_0x1cc456){if(_0x1cc456){return _0x1cc456?{'count':_0x4271a3,'rows':_0x1cc456}:null;}})[_0xf1b1('0x3b')](respondWithResult(_0x3f59bd,null))[_0xf1b1('0x40')](handleError(_0x3f59bd,null));};exports[_0xf1b1('0x4e')]=function(_0x9047a6,_0x2b9e2a,_0x3971db){var _0x49d959={};var _0xb8594={};var _0x3cd453;var _0x1c20a8;return db[_0xf1b1('0x27')]['findOne']({'where':{'id':_0x9047a6['params']['id']}})['then'](handleEntityNotFound(_0x2b9e2a,null))[_0xf1b1('0x3b')](function(_0x10fb06){if(_0x10fb06){_0x3cd453=_0x10fb06;_0xb8594[_0xf1b1('0x2c')]=_['keys'](db[_0xf1b1('0x4a')][_0xf1b1('0x28')]);_0xb8594[_0xf1b1('0x2e')]=_[_0xf1b1('0x43')](_0x9047a6[_0xf1b1('0x2e')]);_0xb8594[_0xf1b1('0x36')]=_['intersection'](_0xb8594['model'],_0xb8594[_0xf1b1('0x2e')]);_0x49d959[_0xf1b1('0x2f')]=_['intersection'](_0xb8594['model'],qs['fields'](_0x9047a6[_0xf1b1('0x2e')][_0xf1b1('0x31')]));_0x49d959[_0xf1b1('0x2f')]=_0x49d959['attributes']['length']?_0x49d959['attributes']:_0xb8594['model'];_0x49d959[_0xf1b1('0x33')]=qs['sort'](_0x9047a6[_0xf1b1('0x2e')][_0xf1b1('0x34')]);_0x49d959['where']=qs[_0xf1b1('0x36')](_[_0xf1b1('0x4b')](_0x9047a6[_0xf1b1('0x2e')],_0xb8594[_0xf1b1('0x36')]));if(_0x9047a6[_0xf1b1('0x2e')][_0xf1b1('0x37')]){_0x49d959[_0xf1b1('0x35')]=_['merge'](_0x49d959[_0xf1b1('0x35')],{'$or':_['map'](_0x49d959[_0xf1b1('0x2f')],function(_0x36528a){var _0x365651={};_0x365651[_0x36528a]={'$like':'%'+_0x9047a6[_0xf1b1('0x2e')][_0xf1b1('0x37')]+'%'};return _0x365651;})});}_0x49d959=_[_0xf1b1('0x38')]({},_0x49d959,_0x9047a6[_0xf1b1('0x3a')]);return _0x3cd453[_0xf1b1('0x4e')](_0x49d959);}})[_0xf1b1('0x3b')](function(_0x7e699b){if(_0x7e699b){_0x1c20a8=_0x7e699b[_0xf1b1('0x44')];if(!_0x9047a6[_0xf1b1('0x2e')]['hasOwnProperty'](_0xf1b1('0x4c'))){_0x49d959[_0xf1b1('0x1c')]=qs[_0xf1b1('0x1c')](_0x9047a6['query'][_0xf1b1('0x1c')]);_0x49d959[_0xf1b1('0x1a')]=qs['offset'](_0x9047a6['query'][_0xf1b1('0x1a')]);}return _0x3cd453['getDescriptions'](_0x49d959);}})[_0xf1b1('0x3b')](function(_0x211922){if(_0x211922){return _0x211922?{'count':_0x1c20a8,'rows':_0x211922}:null;}})[_0xf1b1('0x3b')](respondWithResult(_0x2b9e2a,null))['catch'](handleError(_0x2b9e2a,null));};exports[_0xf1b1('0x4f')]=function(_0x84f825,_0x9bac8f,_0x456db3){var _0x333e3c={};var _0x4e8636={};var _0x261400;var _0x1efd29;return db[_0xf1b1('0x27')][_0xf1b1('0x49')]({'where':{'id':_0x84f825['params']['id']}})[_0xf1b1('0x3b')](handleEntityNotFound(_0x9bac8f,null))[_0xf1b1('0x3b')](function(_0x428d1a){if(_0x428d1a){_0x261400=_0x428d1a;_0x4e8636['model']=_[_0xf1b1('0x43')](db['Tag']['rawAttributes']);_0x4e8636['query']=_[_0xf1b1('0x43')](_0x84f825[_0xf1b1('0x2e')]);_0x4e8636['filters']=_[_0xf1b1('0x30')](_0x4e8636[_0xf1b1('0x2c')],_0x4e8636['query']);_0x333e3c['attributes']=_[_0xf1b1('0x30')](_0x4e8636[_0xf1b1('0x2c')],qs[_0xf1b1('0x31')](_0x84f825[_0xf1b1('0x2e')][_0xf1b1('0x31')]));_0x333e3c[_0xf1b1('0x2f')]=_0x333e3c[_0xf1b1('0x2f')][_0xf1b1('0x44')]?_0x333e3c['attributes']:_0x4e8636[_0xf1b1('0x2c')];_0x333e3c[_0xf1b1('0x33')]=qs[_0xf1b1('0x34')](_0x84f825[_0xf1b1('0x2e')]['sort']);_0x333e3c[_0xf1b1('0x35')]=qs[_0xf1b1('0x36')](_[_0xf1b1('0x4b')](_0x84f825[_0xf1b1('0x2e')],_0x4e8636['filters']));if(_0x84f825[_0xf1b1('0x2e')][_0xf1b1('0x37')]){_0x333e3c['where']=_[_0xf1b1('0x38')](_0x333e3c[_0xf1b1('0x35')],{'$or':_['map'](_0x333e3c[_0xf1b1('0x2f')],function(_0x2a11ac){var _0x4ecd24={};_0x4ecd24[_0x2a11ac]={'$like':'%'+_0x84f825[_0xf1b1('0x2e')][_0xf1b1('0x37')]+'%'};return _0x4ecd24;})});}_0x333e3c=_[_0xf1b1('0x38')]({},_0x333e3c,_0x84f825[_0xf1b1('0x3a')]);return _0x261400[_0xf1b1('0x4f')](_0x333e3c);}})[_0xf1b1('0x3b')](function(_0x567092){if(_0x567092){_0x1efd29=_0x567092['length'];if(!_0x84f825[_0xf1b1('0x2e')][_0xf1b1('0x32')](_0xf1b1('0x4c'))){_0x333e3c[_0xf1b1('0x1c')]=qs[_0xf1b1('0x1c')](_0x84f825[_0xf1b1('0x2e')][_0xf1b1('0x1c')]);_0x333e3c[_0xf1b1('0x1a')]=qs[_0xf1b1('0x1a')](_0x84f825[_0xf1b1('0x2e')]['offset']);}return _0x261400[_0xf1b1('0x4f')](_0x333e3c);}})[_0xf1b1('0x3b')](function(_0x3ef083){if(_0x3ef083){return _0x3ef083?{'count':_0x1efd29,'rows':_0x3ef083}:null;}})[_0xf1b1('0x3b')](respondWithResult(_0x9bac8f,null))[_0xf1b1('0x40')](handleError(_0x9bac8f,null));};exports[_0xf1b1('0x50')]=function(_0x4068f6,_0x3f7903,_0x64fdd7){if(_0x4068f6[_0xf1b1('0x46')]['id']){delete _0x4068f6['body']['id'];}return db[_0xf1b1('0x27')]['findOne']({'where':{'id':_0x4068f6[_0xf1b1('0x42')]['id']}})[_0xf1b1('0x3b')](handleEntityNotFound(_0x3f7903,null))[_0xf1b1('0x3b')](function(_0x326ff3){if(_0x326ff3){return _0x326ff3['setTags'](_0x4068f6['body'][_0xf1b1('0x51')]||[]);}return null;})[_0xf1b1('0x3b')](respondWithResult(_0x3f7903,null))[_0xf1b1('0x40')](handleError(_0x3f7903,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5e31de8..a83a245 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 _0x3d42=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3d42,0x1ba));var _0x23d4=function(_0x8ffe41,_0x2d6b26){_0x8ffe41=_0x8ffe41-0x0;var _0x24b815=_0x3d42[_0x8ffe41];return _0x24b815;};'use strict';var _=require(_0x23d4('0x0'));var util=require('util');var logger=require(_0x23d4('0x1'))(_0x23d4('0x2'));var moment=require(_0x23d4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x23d4('0x4'));var rimraf=require(_0x23d4('0x5'));var config=require(_0x23d4('0x6'));var attributes=require(_0x23d4('0x7'));module['exports']=function(_0xf978,_0x3f24a7){return _0xf978[_0x23d4('0x8')](_0x23d4('0x9'),attributes,{'tableName':_0x23d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21a5=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x50ae92,_0x11e899){var _0x375128=function(_0xbdc369){while(--_0xbdc369){_0x50ae92['push'](_0x50ae92['shift']());}};_0x375128(++_0x11e899);}(_0x21a5,0x18a));var _0x521a=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x21a5[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0x521a('0x0'));var util=require(_0x521a('0x1'));var logger=require(_0x521a('0x2'))(_0x521a('0x3'));var moment=require(_0x521a('0x4'));var BPromise=require(_0x521a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x521a('0x6'));var config=require(_0x521a('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x521a('0x8')]=function(_0x428457,_0x4a2c18){return _0x428457[_0x521a('0x9')](_0x521a('0xa'),attributes,{'tableName':_0x521a('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 e1df6d4..123c992 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 _0xae72=['../../config/logger','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x29ab8e,_0x67c0c1){var _0xc602a3=function(_0x2782b5){while(--_0x2782b5){_0x29ab8e['push'](_0x29ab8e['shift']());}};_0xc602a3(++_0x67c0c1);}(_0xae72,0x1ae));var _0x2ae7=function(_0x423efe,_0x16497d){_0x423efe=_0x423efe-0x0;var _0x1466b8=_0xae72[_0x423efe];return _0x1466b8;};'use strict';var _=require(_0x2ae7('0x0'));var util=require(_0x2ae7('0x1'));var moment=require(_0x2ae7('0x2'));var BPromise=require(_0x2ae7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ae7('0x4'));var db=require(_0x2ae7('0x5'))['db'];var utils=require(_0x2ae7('0x6'));var logger=require(_0x2ae7('0x7'))('rpc');var config=require(_0x2ae7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2ae7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bf60f,_0x3458f9,_0x1e2091){return new BPromise(function(_0x576eac,_0x183d04){return client[_0x2ae7('0xa')](_0x4bf60f,_0x1e2091)[_0x2ae7('0xb')](function(_0x2b55db){logger[_0x2ae7('0xc')](_0x2ae7('0xd'),_0x3458f9,_0x2ae7('0xe'));logger[_0x2ae7('0xf')](_0x2ae7('0x10'),_0x3458f9,_0x2ae7('0xe'),JSON[_0x2ae7('0x11')](_0x2b55db));if(_0x2b55db[_0x2ae7('0x12')]){if(_0x2b55db['error'][_0x2ae7('0x13')]===0x1f4){logger[_0x2ae7('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3458f9,_0x2b55db[_0x2ae7('0x12')][_0x2ae7('0x14')]);return _0x183d04(_0x2b55db['error'][_0x2ae7('0x14')]);}logger[_0x2ae7('0x12')](_0x2ae7('0xd'),_0x3458f9,_0x2b55db[_0x2ae7('0x12')][_0x2ae7('0x14')]);return _0x576eac(_0x2b55db[_0x2ae7('0x12')][_0x2ae7('0x14')]);}else{logger[_0x2ae7('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3458f9,_0x2ae7('0xe'));_0x576eac(_0x2b55db[_0x2ae7('0x15')][_0x2ae7('0x14')]);}})[_0x2ae7('0x16')](function(_0x47abf5){logger[_0x2ae7('0x12')](_0x2ae7('0xd'),_0x3458f9,_0x47abf5);_0x183d04(_0x47abf5);});});} \ No newline at end of file +var _0x8200=['error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x3659ae,_0x5c67ae){var _0x56943e=function(_0x3548a1){while(--_0x3548a1){_0x3659ae['push'](_0x3659ae['shift']());}};_0x56943e(++_0x5c67ae);}(_0x8200,0x119));var _0x0820=function(_0x224dc8,_0x1ea689){_0x224dc8=_0x224dc8-0x0;var _0x5257db=_0x8200[_0x224dc8];return _0x5257db;};'use strict';var _=require(_0x0820('0x0'));var util=require(_0x0820('0x1'));var moment=require(_0x0820('0x2'));var BPromise=require('bluebird');var rs=require(_0x0820('0x3'));var fs=require('fs');var Redis=require(_0x0820('0x4'));var db=require(_0x0820('0x5'))['db'];var utils=require(_0x0820('0x6'));var logger=require('../../config/logger')(_0x0820('0x7'));var config=require(_0x0820('0x8'));var jayson=require(_0x0820('0x9'));var client=jayson[_0x0820('0xa')][_0x0820('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21814c,_0x2d2bb4,_0x1dc4d5){return new BPromise(function(_0x2a3de0,_0x2029d1){return client[_0x0820('0xc')](_0x21814c,_0x1dc4d5)[_0x0820('0xd')](function(_0x2b4358){logger[_0x0820('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2d2bb4,_0x0820('0xf'));logger[_0x0820('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2d2bb4,'request\x20sent',JSON[_0x0820('0x11')](_0x2b4358));if(_0x2b4358[_0x0820('0x12')]){if(_0x2b4358[_0x0820('0x12')][_0x0820('0x13')]===0x1f4){logger[_0x0820('0x12')](_0x0820('0x14'),_0x2d2bb4,_0x2b4358['error'][_0x0820('0x15')]);return _0x2029d1(_0x2b4358[_0x0820('0x12')][_0x0820('0x15')]);}logger['error'](_0x0820('0x14'),_0x2d2bb4,_0x2b4358[_0x0820('0x12')][_0x0820('0x15')]);return _0x2a3de0(_0x2b4358['error']['message']);}else{logger['info'](_0x0820('0x14'),_0x2d2bb4,_0x0820('0xf'));_0x2a3de0(_0x2b4358['result'][_0x0820('0x15')]);}})[_0x0820('0x16')](function(_0x341096){logger[_0x0820('0x12')](_0x0820('0x14'),_0x2d2bb4,_0x341096);_0x2029d1(_0x341096);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ccc3dac..614fdad 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 _0xc351=['../../config/environment','./intFreshdeskField.controller','isAuthenticated','get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20d93a,_0x422a10){var _0x4e5cec=function(_0x56089c){while(--_0x56089c){_0x20d93a['push'](_0x20d93a['shift']());}};_0x4e5cec(++_0x422a10);}(_0xc351,0xfc));var _0x1c35=function(_0x3b9081,_0x3fa328){_0x3b9081=_0x3b9081-0x0;var _0x83354a=_0xc351[_0x3b9081];return _0x83354a;};'use strict';var multer=require(_0x1c35('0x0'));var util=require(_0x1c35('0x1'));var path=require(_0x1c35('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c35('0x3'));var router=express[_0x1c35('0x4')]();var fs_extra=require(_0x1c35('0x5'));var auth=require(_0x1c35('0x6'));var interaction=require(_0x1c35('0x7'));var config=require(_0x1c35('0x8'));var controller=require(_0x1c35('0x9'));router['get']('/',auth[_0x1c35('0xa')](),controller['index']);router[_0x1c35('0xb')]('/:id',auth[_0x1c35('0xa')](),controller[_0x1c35('0xc')]);router[_0x1c35('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1c35('0xe')](_0x1c35('0xf'),auth['isAuthenticated'](),controller[_0x1c35('0x10')]);router[_0x1c35('0x11')](_0x1c35('0xf'),auth['isAuthenticated'](),controller[_0x1c35('0x12')]);module[_0x1c35('0x13')]=router; \ No newline at end of file +var _0x2245=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post'];(function(_0x5e58d3,_0x143d96){var _0x305563=function(_0x5098ee){while(--_0x5098ee){_0x5e58d3['push'](_0x5e58d3['shift']());}};_0x305563(++_0x143d96);}(_0x2245,0x1d4));var _0x5224=function(_0x48ef2d,_0x4a694d){_0x48ef2d=_0x48ef2d-0x0;var _0x296e82=_0x2245[_0x48ef2d];return _0x296e82;};'use strict';var multer=require(_0x5224('0x0'));var util=require(_0x5224('0x1'));var path=require(_0x5224('0x2'));var timeout=require(_0x5224('0x3'));var express=require(_0x5224('0x4'));var router=express[_0x5224('0x5')]();var fs_extra=require(_0x5224('0x6'));var auth=require(_0x5224('0x7'));var interaction=require(_0x5224('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x5224('0x9')](),controller[_0x5224('0xa')]);router[_0x5224('0xb')](_0x5224('0xc'),auth[_0x5224('0x9')](),controller[_0x5224('0xd')]);router[_0x5224('0xe')]('/',auth[_0x5224('0x9')](),controller[_0x5224('0xf')]);router[_0x5224('0x10')](_0x5224('0xc'),auth[_0x5224('0x9')](),controller[_0x5224('0x11')]);router[_0x5224('0x12')](_0x5224('0xc'),auth[_0x5224('0x9')](),controller[_0x5224('0x13')]);module[_0x5224('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 55cd33d..8c394aa 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 _0x6d9b=['keyValue','picklist','STRING','string','variable','BOOLEAN','exports','ENUM'];(function(_0x96ef24,_0x1f301b){var _0x45b252=function(_0x68cee){while(--_0x68cee){_0x96ef24['push'](_0x96ef24['shift']());}};_0x45b252(++_0x1f301b);}(_0x6d9b,0x9e));var _0xb6d9=function(_0x5e872b,_0x4712e9){_0x5e872b=_0x5e872b-0x0;var _0x2850be=_0x6d9b[_0x5e872b];return _0x2850be;};'use strict';var Sequelize=require('sequelize');module[_0xb6d9('0x0')]={'type':{'type':Sequelize[_0xb6d9('0x1')]('string','variable','customVariable',_0xb6d9('0x2'),_0xb6d9('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb6d9('0x4')]},'keyType':{'type':Sequelize[_0xb6d9('0x1')](_0xb6d9('0x5'),_0xb6d9('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xb6d9('0x4')]},'idField':{'type':Sequelize[_0xb6d9('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb6d9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6d9('0x4')]}}; \ No newline at end of file +var _0x8299=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize'];(function(_0x11edc9,_0x332572){var _0x4858a3=function(_0x1aae65){while(--_0x1aae65){_0x11edc9['push'](_0x11edc9['shift']());}};_0x4858a3(++_0x332572);}(_0x8299,0x7d));var _0x9829=function(_0x4115f0,_0x4d509c){_0x4115f0=_0x4115f0-0x0;var _0x3886dc=_0x8299[_0x4115f0];return _0x3886dc;};'use strict';var Sequelize=require(_0x9829('0x0'));module[_0x9829('0x1')]={'type':{'type':Sequelize[_0x9829('0x2')](_0x9829('0x3'),'variable',_0x9829('0x4'),_0x9829('0x5'),_0x9829('0x6')),'defaultValue':_0x9829('0x3')},'content':{'type':Sequelize[_0x9829('0x7')]},'key':{'type':Sequelize[_0x9829('0x7')]},'keyType':{'type':Sequelize[_0x9829('0x2')](_0x9829('0x3'),_0x9829('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x9829('0x7')]},'idField':{'type':Sequelize[_0x9829('0x7')]},'nameField':{'type':Sequelize[_0x9829('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9829('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a493ba6..0d2097f 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 _0x5eb1=['status','limit','count','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','keys','intersection','create','update','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5eb1,0x7c));var _0x15eb=function(_0x5d572c,_0x53581f){_0x5d572c=_0x5d572c-0x0;var _0x5797cf=_0x5eb1[_0x5d572c];return _0x5797cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15eb('0x0'));var zipdir=require(_0x15eb('0x1'));var jsonpatch=require(_0x15eb('0x2'));var rp=require(_0x15eb('0x3'));var moment=require(_0x15eb('0x4'));var BPromise=require(_0x15eb('0x5'));var Mustache=require('mustache');var util=require(_0x15eb('0x6'));var path=require(_0x15eb('0x7'));var sox=require(_0x15eb('0x8'));var csv=require(_0x15eb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15eb('0xa'));var _=require(_0x15eb('0xb'));var squel=require('squel');var crypto=require(_0x15eb('0xc'));var jsforce=require(_0x15eb('0xd'));var deskjs=require(_0x15eb('0xe'));var toCsv=require(_0x15eb('0x9'));var querystring=require(_0x15eb('0xf'));var Papa=require(_0x15eb('0x10'));var Redis=require(_0x15eb('0x11'));var authService=require(_0x15eb('0x12'));var qs=require(_0x15eb('0x13'));var as=require(_0x15eb('0x14'));var hardwareService=require(_0x15eb('0x15'));var logger=require(_0x15eb('0x16'))(_0x15eb('0x17'));var utils=require('../../config/utils');var config=require(_0x15eb('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498a0c,_0xda1ddf){_0xda1ddf=_0xda1ddf||0xcc;return function(_0x330436){if(_0x330436){return _0x498a0c[_0x15eb('0x19')](_0xda1ddf);}return _0x498a0c[_0x15eb('0x1a')](_0xda1ddf)['end']();};}function respondWithResult(_0x1d5326,_0x3b921c){_0x3b921c=_0x3b921c||0xc8;return function(_0x212f04){if(_0x212f04){return _0x1d5326[_0x15eb('0x1a')](_0x3b921c)['json'](_0x212f04);}};}function respondWithFilteredResult(_0x48aed7,_0x544e7c){return function(_0x500d58){if(_0x500d58){var _0x1188e0=typeof _0x544e7c['offset']==='undefined'&&typeof _0x544e7c[_0x15eb('0x1b')]==='undefined';var _0x2b898c=_0x500d58['count'];var _0x23a687=_0x1188e0?0x0:_0x544e7c['offset'];var _0x603d05=_0x1188e0?_0x500d58[_0x15eb('0x1c')]:_0x544e7c['offset']+_0x544e7c[_0x15eb('0x1b')];var _0x431ba8;if(_0x603d05>=_0x2b898c){_0x603d05=_0x2b898c;_0x431ba8=0xc8;}else{_0x431ba8=0xce;}_0x48aed7['status'](_0x431ba8);return _0x48aed7[_0x15eb('0x1d')](_0x15eb('0x1e'),_0x23a687+'-'+_0x603d05+'/'+_0x2b898c)[_0x15eb('0x1f')](_0x500d58);}return null;};}function patchUpdates(_0x149332){return function(_0xb66333){try{jsonpatch[_0x15eb('0x20')](_0xb66333,_0x149332,!![]);}catch(_0x56f51d){return BPromise[_0x15eb('0x21')](_0x56f51d);}return _0xb66333['save']();};}function saveUpdates(_0x2603fe,_0x49915b){return function(_0x195ae2){if(_0x195ae2){return _0x195ae2['update'](_0x2603fe)[_0x15eb('0x22')](function(_0x158674){return _0x158674;});}return null;};}function removeEntity(_0xa0cefc,_0x9b0a52){return function(_0x14d66e){if(_0x14d66e){return _0x14d66e[_0x15eb('0x23')]()[_0x15eb('0x22')](function(){_0xa0cefc[_0x15eb('0x1a')](0xcc)[_0x15eb('0x24')]();});}};}function handleEntityNotFound(_0x17c2ef,_0x526648){return function(_0x3a787d){if(!_0x3a787d){_0x17c2ef[_0x15eb('0x19')](0x194);}return _0x3a787d;};}function handleError(_0x394c25,_0x3f655b){_0x3f655b=_0x3f655b||0x1f4;return function(_0x1fcb1a){logger[_0x15eb('0x25')](_0x1fcb1a[_0x15eb('0x26')]);if(_0x1fcb1a['name']){delete _0x1fcb1a['name'];}_0x394c25[_0x15eb('0x1a')](_0x3f655b)[_0x15eb('0x27')](_0x1fcb1a);};}exports[_0x15eb('0x28')]=function(_0xa1ea61,_0x50f7be){var _0x222764={},_0x5f2df5={},_0x302bf7={'count':0x0,'rows':[]};var _0x47b056=_[_0x15eb('0x29')](db[_0x15eb('0x2a')][_0x15eb('0x2b')],function(_0x153d86){return{'name':_0x153d86[_0x15eb('0x2c')],'type':_0x153d86[_0x15eb('0x2d')]['key']};});_0x5f2df5[_0x15eb('0x2e')]=_[_0x15eb('0x29')](_0x47b056,_0x15eb('0x2f'));_0x5f2df5['query']=_['keys'](_0xa1ea61[_0x15eb('0x30')]);_0x5f2df5[_0x15eb('0x31')]=_['intersection'](_0x5f2df5['model'],_0x5f2df5['query']);_0x222764[_0x15eb('0x32')]=_['intersection'](_0x5f2df5[_0x15eb('0x2e')],qs[_0x15eb('0x33')](_0xa1ea61['query'][_0x15eb('0x33')]));_0x222764[_0x15eb('0x32')]=_0x222764[_0x15eb('0x32')][_0x15eb('0x34')]?_0x222764[_0x15eb('0x32')]:_0x5f2df5[_0x15eb('0x2e')];if(!_0xa1ea61['query'][_0x15eb('0x35')](_0x15eb('0x36'))){_0x222764[_0x15eb('0x1b')]=qs[_0x15eb('0x1b')](_0xa1ea61[_0x15eb('0x30')]['limit']);_0x222764[_0x15eb('0x37')]=qs[_0x15eb('0x37')](_0xa1ea61['query'][_0x15eb('0x37')]);}_0x222764[_0x15eb('0x38')]=qs['sort'](_0xa1ea61[_0x15eb('0x30')]['sort']);_0x222764[_0x15eb('0x39')]=qs['filters'](_[_0x15eb('0x3a')](_0xa1ea61['query'],_0x5f2df5[_0x15eb('0x31')]),_0x47b056);if(_0xa1ea61[_0x15eb('0x30')]['filter']){_0x222764['where']=_[_0x15eb('0x3b')](_0x222764[_0x15eb('0x39')],{'$or':_[_0x15eb('0x29')](_0x47b056,function(_0x530f1e){if(_0x530f1e[_0x15eb('0x2d')]!=='VIRTUAL'){var _0x2830={};_0x2830[_0x530f1e['name']]={'$like':'%'+_0xa1ea61[_0x15eb('0x30')][_0x15eb('0x3c')]+'%'};return _0x2830;}})});}_0x222764=_[_0x15eb('0x3b')]({},_0x222764,_0xa1ea61[_0x15eb('0x3d')]);var _0x724448={'where':_0x222764[_0x15eb('0x39')]};return db[_0x15eb('0x2a')][_0x15eb('0x1c')](_0x724448)[_0x15eb('0x22')](function(_0x32a5a6){_0x302bf7[_0x15eb('0x1c')]=_0x32a5a6;if(_0xa1ea61['query'][_0x15eb('0x3e')]){_0x222764[_0x15eb('0x3f')]=[{'all':!![]}];}return db[_0x15eb('0x2a')][_0x15eb('0x40')](_0x222764);})['then'](function(_0x1618e5){_0x302bf7[_0x15eb('0x41')]=_0x1618e5;return _0x302bf7;})[_0x15eb('0x22')](respondWithFilteredResult(_0x50f7be,_0x222764))[_0x15eb('0x42')](handleError(_0x50f7be,null));};exports[_0x15eb('0x43')]=function(_0x570599,_0x3ace6a){var _0x23aea0={'raw':!![],'where':{'id':_0x570599['params']['id']}},_0x5e1b5b={};_0x5e1b5b[_0x15eb('0x2e')]=_[_0x15eb('0x44')](db[_0x15eb('0x2a')]['rawAttributes']);_0x5e1b5b[_0x15eb('0x30')]=_[_0x15eb('0x44')](_0x570599['query']);_0x5e1b5b[_0x15eb('0x31')]=_[_0x15eb('0x45')](_0x5e1b5b[_0x15eb('0x2e')],_0x5e1b5b[_0x15eb('0x30')]);_0x23aea0[_0x15eb('0x32')]=_[_0x15eb('0x45')](_0x5e1b5b['model'],qs[_0x15eb('0x33')](_0x570599[_0x15eb('0x30')]['fields']));_0x23aea0[_0x15eb('0x32')]=_0x23aea0[_0x15eb('0x32')][_0x15eb('0x34')]?_0x23aea0[_0x15eb('0x32')]:_0x5e1b5b[_0x15eb('0x2e')];if(_0x570599[_0x15eb('0x30')]['includeAll']){_0x23aea0[_0x15eb('0x3f')]=[{'all':!![]}];}_0x23aea0=_['merge']({},_0x23aea0,_0x570599[_0x15eb('0x3d')]);return db['FreshdeskField']['find'](_0x23aea0)[_0x15eb('0x22')](handleEntityNotFound(_0x3ace6a,null))[_0x15eb('0x22')](respondWithResult(_0x3ace6a,null))[_0x15eb('0x42')](handleError(_0x3ace6a,null));};exports['create']=function(_0x556f9d,_0x121fc7){return db['FreshdeskField'][_0x15eb('0x46')](_0x556f9d['body'],{})[_0x15eb('0x22')](respondWithResult(_0x121fc7,0xc9))[_0x15eb('0x42')](handleError(_0x121fc7,null));};exports[_0x15eb('0x47')]=function(_0x50d0a,_0x5d5421){if(_0x50d0a[_0x15eb('0x48')]['id']){delete _0x50d0a[_0x15eb('0x48')]['id'];}return db['FreshdeskField'][_0x15eb('0x49')]({'where':{'id':_0x50d0a[_0x15eb('0x4a')]['id']}})[_0x15eb('0x22')](handleEntityNotFound(_0x5d5421,null))[_0x15eb('0x22')](saveUpdates(_0x50d0a[_0x15eb('0x48')],null))[_0x15eb('0x22')](respondWithResult(_0x5d5421,null))[_0x15eb('0x42')](handleError(_0x5d5421,null));};exports[_0x15eb('0x23')]=function(_0x33e324,_0x160c4a){return db[_0x15eb('0x2a')]['find']({'where':{'id':_0x33e324[_0x15eb('0x4a')]['id']}})[_0x15eb('0x22')](handleEntityNotFound(_0x160c4a,null))['then'](removeEntity(_0x160c4a,null))[_0x15eb('0x42')](handleError(_0x160c4a,null));}; \ No newline at end of file +var _0x1152=['stack','name','index','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','keys','include','merge','create','body','catch','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x1452c1,_0x427cea){var _0x3dc9ea=function(_0x28f13c){while(--_0x28f13c){_0x1452c1['push'](_0x1452c1['shift']());}};_0x3dc9ea(++_0x427cea);}(_0x1152,0x182));var _0x2115=function(_0x59a1a0,_0x45d4a8){_0x59a1a0=_0x59a1a0-0x0;var _0x442238=_0x1152[_0x59a1a0];return _0x442238;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require(_0x2115('0x1'));var zipdir=require(_0x2115('0x2'));var jsonpatch=require(_0x2115('0x3'));var rp=require(_0x2115('0x4'));var moment=require(_0x2115('0x5'));var BPromise=require(_0x2115('0x6'));var Mustache=require(_0x2115('0x7'));var util=require('util');var path=require(_0x2115('0x8'));var sox=require('sox');var csv=require(_0x2115('0x9'));var ejs=require(_0x2115('0xa'));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(_0x2115('0xb'));var toCsv=require(_0x2115('0x9'));var querystring=require(_0x2115('0xc'));var Papa=require('papaparse');var Redis=require(_0x2115('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2115('0xe'));var hardwareService=require(_0x2115('0xf'));var logger=require(_0x2115('0x10'))('api');var utils=require(_0x2115('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2115('0x12'));var db=require(_0x2115('0x13'))['db'];function respondWithStatusCode(_0x2bb885,_0x33d38b){_0x33d38b=_0x33d38b||0xcc;return function(_0x22475e){if(_0x22475e){return _0x2bb885['sendStatus'](_0x33d38b);}return _0x2bb885[_0x2115('0x14')](_0x33d38b)['end']();};}function respondWithResult(_0x3727a3,_0x38e406){_0x38e406=_0x38e406||0xc8;return function(_0x17028e){if(_0x17028e){return _0x3727a3[_0x2115('0x14')](_0x38e406)[_0x2115('0x15')](_0x17028e);}};}function respondWithFilteredResult(_0x113ce2,_0x350969){return function(_0x5e8f81){if(_0x5e8f81){var _0xdf3e24=typeof _0x350969[_0x2115('0x16')]===_0x2115('0x17')&&typeof _0x350969[_0x2115('0x18')]===_0x2115('0x17');var _0x1bdef9=_0x5e8f81[_0x2115('0x19')];var _0x77e2c6=_0xdf3e24?0x0:_0x350969['offset'];var _0x154f69=_0xdf3e24?_0x5e8f81[_0x2115('0x19')]:_0x350969[_0x2115('0x16')]+_0x350969['limit'];var _0x2dfb3c;if(_0x154f69>=_0x1bdef9){_0x154f69=_0x1bdef9;_0x2dfb3c=0xc8;}else{_0x2dfb3c=0xce;}_0x113ce2[_0x2115('0x14')](_0x2dfb3c);return _0x113ce2[_0x2115('0x1a')](_0x2115('0x1b'),_0x77e2c6+'-'+_0x154f69+'/'+_0x1bdef9)[_0x2115('0x15')](_0x5e8f81);}return null;};}function patchUpdates(_0xcc2d7b){return function(_0x21d079){try{jsonpatch[_0x2115('0x1c')](_0x21d079,_0xcc2d7b,!![]);}catch(_0x464af4){return BPromise[_0x2115('0x1d')](_0x464af4);}return _0x21d079[_0x2115('0x1e')]();};}function saveUpdates(_0x8b7304,_0x8e37c){return function(_0x13fde1){if(_0x13fde1){return _0x13fde1['update'](_0x8b7304)[_0x2115('0x1f')](function(_0x340c42){return _0x340c42;});}return null;};}function removeEntity(_0x40d19f,_0x4ac436){return function(_0x27c2f5){if(_0x27c2f5){return _0x27c2f5[_0x2115('0x20')]()['then'](function(){_0x40d19f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x201c94,_0x5e9d07){return function(_0x1a2ec3){if(!_0x1a2ec3){_0x201c94['sendStatus'](0x194);}return _0x1a2ec3;};}function handleError(_0x1283ec,_0x115800){_0x115800=_0x115800||0x1f4;return function(_0x1b7f47){logger[_0x2115('0x21')](_0x1b7f47[_0x2115('0x22')]);if(_0x1b7f47['name']){delete _0x1b7f47[_0x2115('0x23')];}_0x1283ec[_0x2115('0x14')](_0x115800)['send'](_0x1b7f47);};}exports[_0x2115('0x24')]=function(_0x33d81c,_0x26eff7){var _0x1262e7={},_0x59ca70={},_0x19c595={'count':0x0,'rows':[]};var _0x15229e=_[_0x2115('0x25')](db[_0x2115('0x26')][_0x2115('0x27')],function(_0x27969d){return{'name':_0x27969d['fieldName'],'type':_0x27969d['type'][_0x2115('0x28')]};});_0x59ca70[_0x2115('0x29')]=_[_0x2115('0x25')](_0x15229e,_0x2115('0x23'));_0x59ca70[_0x2115('0x2a')]=_['keys'](_0x33d81c[_0x2115('0x2a')]);_0x59ca70[_0x2115('0x2b')]=_[_0x2115('0x2c')](_0x59ca70['model'],_0x59ca70[_0x2115('0x2a')]);_0x1262e7['attributes']=_[_0x2115('0x2c')](_0x59ca70['model'],qs[_0x2115('0x2d')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x2d')]));_0x1262e7['attributes']=_0x1262e7['attributes'][_0x2115('0x2e')]?_0x1262e7[_0x2115('0x2f')]:_0x59ca70['model'];if(!_0x33d81c[_0x2115('0x2a')][_0x2115('0x30')](_0x2115('0x31'))){_0x1262e7[_0x2115('0x18')]=qs['limit'](_0x33d81c[_0x2115('0x2a')][_0x2115('0x18')]);_0x1262e7[_0x2115('0x16')]=qs[_0x2115('0x16')](_0x33d81c['query'][_0x2115('0x16')]);}_0x1262e7[_0x2115('0x32')]=qs[_0x2115('0x33')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x33')]);_0x1262e7[_0x2115('0x34')]=qs['filters'](_[_0x2115('0x35')](_0x33d81c[_0x2115('0x2a')],_0x59ca70[_0x2115('0x2b')]),_0x15229e);if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]){_0x1262e7[_0x2115('0x34')]=_['merge'](_0x1262e7[_0x2115('0x34')],{'$or':_['map'](_0x15229e,function(_0x59b531){if(_0x59b531[_0x2115('0x37')]!==_0x2115('0x38')){var _0x4572f3={};_0x4572f3[_0x59b531[_0x2115('0x23')]]={'$like':'%'+_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]+'%'};return _0x4572f3;}})});}_0x1262e7=_['merge']({},_0x1262e7,_0x33d81c[_0x2115('0x39')]);var _0x1c2508={'where':_0x1262e7[_0x2115('0x34')]};return db[_0x2115('0x26')][_0x2115('0x19')](_0x1c2508)[_0x2115('0x1f')](function(_0x1aa165){_0x19c595[_0x2115('0x19')]=_0x1aa165;if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x3a')]){_0x1262e7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2115('0x3b')](_0x1262e7);})['then'](function(_0xa652de){_0x19c595['rows']=_0xa652de;return _0x19c595;})['then'](respondWithFilteredResult(_0x26eff7,_0x1262e7))['catch'](handleError(_0x26eff7,null));};exports[_0x2115('0x3c')]=function(_0x40d5d6,_0x11b840){var _0x96847d={'raw':!![],'where':{'id':_0x40d5d6['params']['id']}},_0x16f022={};_0x16f022[_0x2115('0x29')]=_['keys'](db[_0x2115('0x26')][_0x2115('0x27')]);_0x16f022['query']=_[_0x2115('0x3d')](_0x40d5d6[_0x2115('0x2a')]);_0x16f022['filters']=_['intersection'](_0x16f022[_0x2115('0x29')],_0x16f022[_0x2115('0x2a')]);_0x96847d['attributes']=_['intersection'](_0x16f022[_0x2115('0x29')],qs[_0x2115('0x2d')](_0x40d5d6['query']['fields']));_0x96847d[_0x2115('0x2f')]=_0x96847d[_0x2115('0x2f')][_0x2115('0x2e')]?_0x96847d['attributes']:_0x16f022[_0x2115('0x29')];if(_0x40d5d6['query'][_0x2115('0x3a')]){_0x96847d[_0x2115('0x3e')]=[{'all':!![]}];}_0x96847d=_[_0x2115('0x3f')]({},_0x96847d,_0x40d5d6[_0x2115('0x39')]);return db[_0x2115('0x26')]['find'](_0x96847d)[_0x2115('0x1f')](handleEntityNotFound(_0x11b840,null))['then'](respondWithResult(_0x11b840,null))['catch'](handleError(_0x11b840,null));};exports[_0x2115('0x40')]=function(_0xa67937,_0x583575){return db[_0x2115('0x26')][_0x2115('0x40')](_0xa67937[_0x2115('0x41')],{})[_0x2115('0x1f')](respondWithResult(_0x583575,0xc9))[_0x2115('0x42')](handleError(_0x583575,null));};exports[_0x2115('0x43')]=function(_0x41d1a4,_0x347f16){if(_0x41d1a4[_0x2115('0x41')]['id']){delete _0x41d1a4['body']['id'];}return db[_0x2115('0x26')][_0x2115('0x44')]({'where':{'id':_0x41d1a4[_0x2115('0x45')]['id']}})['then'](handleEntityNotFound(_0x347f16,null))[_0x2115('0x1f')](saveUpdates(_0x41d1a4['body'],null))['then'](respondWithResult(_0x347f16,null))['catch'](handleError(_0x347f16,null));};exports[_0x2115('0x20')]=function(_0x24d601,_0x4820c7){return db['FreshdeskField'][_0x2115('0x44')]({'where':{'id':_0x24d601[_0x2115('0x45')]['id']}})[_0x2115('0x1f')](handleEntityNotFound(_0x4820c7,null))[_0x2115('0x1f')](removeEntity(_0x4820c7,null))[_0x2115('0x42')](handleError(_0x4820c7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 92777d6..efeb700 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 _0xdb4a=['path','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xdb4a,0x1ba));var _0xadb4=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xdb4a[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xadb4('0x0'));var util=require(_0xadb4('0x1'));var logger=require(_0xadb4('0x2'))(_0xadb4('0x3'));var moment=require(_0xadb4('0x4'));var BPromise=require('bluebird');var rp=require(_0xadb4('0x5'));var fs=require('fs');var path=require(_0xadb4('0x6'));var rimraf=require(_0xadb4('0x7'));var config=require('../../config/environment');var attributes=require(_0xadb4('0x8'));module[_0xadb4('0x9')]=function(_0x2c8e5f,_0xe931f5){return _0x2c8e5f['define'](_0xadb4('0xa'),attributes,{'tableName':_0xadb4('0xb'),'paranoid':![],'indexes':[{'name':_0xadb4('0xc'),'fields':[_0xadb4('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','../../config/logger','moment','bluebird','request-promise'];(function(_0x3df724,_0x139e06){var _0x59bc3c=function(_0x421f31){while(--_0x421f31){_0x3df724['push'](_0x3df724['shift']());}};_0x59bc3c(++_0x139e06);}(_0xadb8,0x1d0));var _0x8adb=function(_0x4f9522,_0x399e9f){_0x4f9522=_0x4f9522-0x0;var _0x5a89a7=_0xadb8[_0x4f9522];return _0x5a89a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[{'name':_0x8adb('0xb'),'fields':[_0x8adb('0xc'),'FieldId'],'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 18efeab..d373382 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 _0x8887=['client','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x35328b,_0x4d4f03){var _0x3bc41f=function(_0x2f9aaa){while(--_0x2f9aaa){_0x35328b['push'](_0x35328b['shift']());}};_0x3bc41f(++_0x4d4f03);}(_0x8887,0xe5));var _0x7888=function(_0x56ca8a,_0xdd4294){_0x56ca8a=_0x56ca8a-0x0;var _0x1f87f1=_0x8887[_0x56ca8a];return _0x1f87f1;};'use strict';var _=require(_0x7888('0x0'));var util=require(_0x7888('0x1'));var moment=require(_0x7888('0x2'));var BPromise=require(_0x7888('0x3'));var rs=require(_0x7888('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7888('0x5'))['db'];var utils=require(_0x7888('0x6'));var logger=require(_0x7888('0x7'))(_0x7888('0x8'));var config=require(_0x7888('0x9'));var jayson=require(_0x7888('0xa'));var client=jayson[_0x7888('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373f4c,_0x4ca289,_0x117136){return new BPromise(function(_0x3a4e65,_0x1d1f8e){return client[_0x7888('0xc')](_0x373f4c,_0x117136)[_0x7888('0xd')](function(_0x26d1e6){logger['info'](_0x7888('0xe'),_0x4ca289,_0x7888('0xf'));logger[_0x7888('0x10')](_0x7888('0x11'),_0x4ca289,_0x7888('0xf'),JSON[_0x7888('0x12')](_0x26d1e6));if(_0x26d1e6[_0x7888('0x13')]){if(_0x26d1e6[_0x7888('0x13')]['code']===0x1f4){logger[_0x7888('0x13')](_0x7888('0xe'),_0x4ca289,_0x26d1e6[_0x7888('0x13')][_0x7888('0x14')]);return _0x1d1f8e(_0x26d1e6[_0x7888('0x13')][_0x7888('0x14')]);}logger[_0x7888('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4ca289,_0x26d1e6[_0x7888('0x13')][_0x7888('0x14')]);return _0x3a4e65(_0x26d1e6[_0x7888('0x13')][_0x7888('0x14')]);}else{logger[_0x7888('0x15')](_0x7888('0xe'),_0x4ca289,_0x7888('0xf'));_0x3a4e65(_0x26d1e6[_0x7888('0x16')]['message']);}})[_0x7888('0x17')](function(_0x55bb79){logger[_0x7888('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4ca289,_0x55bb79);_0x1d1f8e(_0x55bb79);});});} \ No newline at end of file +var _0x33cf=['error','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x398841,_0xfa02fe){var _0x171adc=function(_0x21f426){while(--_0x21f426){_0x398841['push'](_0x398841['shift']());}};_0x171adc(++_0xfa02fe);}(_0x33cf,0x192));var _0xf33c=function(_0x2adc41,_0x4c1a29){_0x2adc41=_0x2adc41-0x0;var _0x55baee=_0x33cf[_0x2adc41];return _0x55baee;};'use strict';var _=require(_0xf33c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf33c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf33c('0x2'));var db=require(_0xf33c('0x3'))['db'];var utils=require(_0xf33c('0x4'));var logger=require(_0xf33c('0x5'))(_0xf33c('0x6'));var config=require(_0xf33c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf33c('0x8')][_0xf33c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40badf,_0x11725c,_0x2f7e14){return new BPromise(function(_0x3c21f4,_0x769e9b){return client['request'](_0x40badf,_0x2f7e14)[_0xf33c('0xa')](function(_0x2eeef5){logger[_0xf33c('0xb')](_0xf33c('0xc'),_0x11725c,_0xf33c('0xd'));logger[_0xf33c('0xe')](_0xf33c('0xf'),_0x11725c,_0xf33c('0xd'),JSON['stringify'](_0x2eeef5));if(_0x2eeef5[_0xf33c('0x10')]){if(_0x2eeef5[_0xf33c('0x10')]['code']===0x1f4){logger[_0xf33c('0x10')](_0xf33c('0xc'),_0x11725c,_0x2eeef5[_0xf33c('0x10')][_0xf33c('0x11')]);return _0x769e9b(_0x2eeef5['error']['message']);}logger[_0xf33c('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x11725c,_0x2eeef5[_0xf33c('0x10')][_0xf33c('0x11')]);return _0x3c21f4(_0x2eeef5[_0xf33c('0x10')]['message']);}else{logger[_0xf33c('0xb')](_0xf33c('0xc'),_0x11725c,_0xf33c('0xd'));_0x3c21f4(_0x2eeef5[_0xf33c('0x12')]['message']);}})['catch'](function(_0x5ab218){logger[_0xf33c('0x10')](_0xf33c('0xc'),_0x11725c,_0x5ab218);_0x769e9b(_0x5ab218);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ff0ee30..94bee5b 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 _0x750a=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','create','put','delete','destroy','exports'];(function(_0x355082,_0x2ef631){var _0x4517d6=function(_0x58455e){while(--_0x58455e){_0x355082['push'](_0x355082['shift']());}};_0x4517d6(++_0x2ef631);}(_0x750a,0x140));var _0xa750=function(_0x45887e,_0x50168e){_0x45887e=_0x45887e-0x0;var _0x4520b9=_0x750a[_0x45887e];return _0x4520b9;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/fields',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xf')]);router['post'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['addConfiguration']);router[_0xa750('0x10')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['update']);router[_0xa750('0x11')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);module[_0xa750('0x13')]=router; \ No newline at end of file +var _0x6f7a=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x10bb45,_0xa57a18){var _0x4f1846=function(_0x319b89){while(--_0x319b89){_0x10bb45['push'](_0x10bb45['shift']());}};_0x4f1846(++_0xa57a18);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1b2d73,_0x14e830){_0x1b2d73=_0x1b2d73-0x0;var _0x357756=_0x6f7a[_0x1b2d73];return _0x357756;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa6f7('0x10')]);router[_0xa6f7('0x11')]('/',auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['post'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);router[_0xa6f7('0x14')]('/:id',auth[_0xa6f7('0xb')](),controller['update']);router[_0xa6f7('0x15')](_0xa6f7('0xd'),auth[_0xa6f7('0xb')](),controller['destroy']);module[_0xa6f7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f406546..97202da 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 _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0xb10b[_0x3f70cd];return _0x3feb93;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x1c6695,_0x5d6374){var _0x12b9e1=function(_0x3b99d0){while(--_0x3b99d0){_0x1c6695['push'](_0x1c6695['shift']());}};_0x12b9e1(++_0x5d6374);}(_0x236c,0x155));var _0xc236=function(_0x476011,_0xdd4367){_0x476011=_0x476011-0x0;var _0x515e5d=_0x236c[_0x476011];return _0x515e5d;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('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 52bd13e..154d5ec 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 _0x8208=['intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshsalesConfiguration','length','options','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','stringify','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','query','keys','filters'];(function(_0xc526d9,_0x1a944c){var _0x101274=function(_0x348dca){while(--_0x348dca){_0xc526d9['push'](_0xc526d9['shift']());}};_0x101274(++_0x1a944c);}(_0x8208,0x103));var _0x8820=function(_0x240e8c,_0xfd8e64){_0x240e8c=_0x240e8c-0x0;var _0x21adc3=_0x8208[_0x240e8c];return _0x21adc3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8820('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8820('0x1'));var rp=require(_0x8820('0x2'));var moment=require('moment');var BPromise=require(_0x8820('0x3'));var Mustache=require('mustache');var util=require(_0x8820('0x4'));var path=require(_0x8820('0x5'));var sox=require('sox');var csv=require(_0x8820('0x6'));var ejs=require(_0x8820('0x7'));var fs=require('fs');var fs_extra=require(_0x8820('0x8'));var _=require(_0x8820('0x9'));var squel=require(_0x8820('0xa'));var crypto=require(_0x8820('0xb'));var jsforce=require(_0x8820('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8820('0xd'));var Redis=require(_0x8820('0xe'));var authService=require(_0x8820('0xf'));var qs=require(_0x8820('0x10'));var as=require(_0x8820('0x11'));var hardwareService=require(_0x8820('0x12'));var logger=require(_0x8820('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8820('0x14'));var licenseUtil=require(_0x8820('0x15'));var db=require(_0x8820('0x16'))['db'];var integrations=require(_0x8820('0x17'));function respondWithStatusCode(_0x3ab10b,_0x282ddf){_0x282ddf=_0x282ddf||0xcc;return function(_0x1d4b7e){if(_0x1d4b7e){return _0x3ab10b[_0x8820('0x18')](_0x282ddf);}return _0x3ab10b['status'](_0x282ddf)[_0x8820('0x19')]();};}function respondWithResult(_0x45deb8,_0x44f68b){_0x44f68b=_0x44f68b||0xc8;return function(_0x575d8d){if(_0x575d8d){return _0x45deb8[_0x8820('0x1a')](_0x44f68b)[_0x8820('0x1b')](_0x575d8d);}};}function respondWithFilteredResult(_0x47ed41,_0x35ab4d){return function(_0x1a0ec7){if(_0x1a0ec7){var _0x54a913=typeof _0x35ab4d[_0x8820('0x1c')]===_0x8820('0x1d')&&typeof _0x35ab4d['limit']===_0x8820('0x1d');var _0x30cad3=_0x1a0ec7['count'];var _0x16fe62=_0x54a913?0x0:_0x35ab4d['offset'];var _0x128b82=_0x54a913?_0x1a0ec7['count']:_0x35ab4d['offset']+_0x35ab4d[_0x8820('0x1e')];var _0x42f648;if(_0x128b82>=_0x30cad3){_0x128b82=_0x30cad3;_0x42f648=0xc8;}else{_0x42f648=0xce;}_0x47ed41[_0x8820('0x1a')](_0x42f648);return _0x47ed41[_0x8820('0x1f')](_0x8820('0x20'),_0x16fe62+'-'+_0x128b82+'/'+_0x30cad3)[_0x8820('0x1b')](_0x1a0ec7);}return null;};}function patchUpdates(_0xb1baca){return function(_0x4c4f8b){try{jsonpatch['apply'](_0x4c4f8b,_0xb1baca,!![]);}catch(_0x441daf){return BPromise[_0x8820('0x21')](_0x441daf);}return _0x4c4f8b[_0x8820('0x22')]();};}function saveUpdates(_0x27d715,_0x3ddfe0){return function(_0x6ea88a){if(_0x6ea88a){return _0x6ea88a[_0x8820('0x23')](_0x27d715)['then'](function(_0xa00655){return _0xa00655;});}return null;};}function removeEntity(_0x5bc14c,_0x8ba161){return function(_0x2a275e){if(_0x2a275e){return _0x2a275e[_0x8820('0x24')]()[_0x8820('0x25')](function(){_0x5bc14c[_0x8820('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53191f,_0x3fca6b){return function(_0x1140f3){if(!_0x1140f3){_0x53191f[_0x8820('0x18')](0x194);}return _0x1140f3;};}function handleError(_0x2f9d57,_0x603068){_0x603068=_0x603068||0x1f4;return function(_0x160076){logger[_0x8820('0x26')](_0x160076[_0x8820('0x27')]);if(_0x160076['name']){delete _0x160076[_0x8820('0x28')];}_0x2f9d57[_0x8820('0x1a')](_0x603068)[_0x8820('0x29')](_0x160076);};}exports[_0x8820('0x2a')]=function(_0x4a90d0,_0x101888){var _0x5917d3={},_0x5e4dff={},_0x543d81={'count':0x0,'rows':[]};var _0x669a9a=_[_0x8820('0x2b')](db[_0x8820('0x2c')][_0x8820('0x2d')],function(_0x170a3e){return{'name':_0x170a3e['fieldName'],'type':_0x170a3e[_0x8820('0x2e')]['key']};});_0x5e4dff['model']=_[_0x8820('0x2b')](_0x669a9a,_0x8820('0x28'));_0x5e4dff[_0x8820('0x2f')]=_[_0x8820('0x30')](_0x4a90d0[_0x8820('0x2f')]);_0x5e4dff[_0x8820('0x31')]=_[_0x8820('0x32')](_0x5e4dff[_0x8820('0x33')],_0x5e4dff['query']);_0x5917d3[_0x8820('0x34')]=_[_0x8820('0x32')](_0x5e4dff['model'],qs[_0x8820('0x35')](_0x4a90d0[_0x8820('0x2f')]['fields']));_0x5917d3[_0x8820('0x34')]=_0x5917d3['attributes']['length']?_0x5917d3['attributes']:_0x5e4dff[_0x8820('0x33')];if(!_0x4a90d0[_0x8820('0x2f')][_0x8820('0x36')](_0x8820('0x37'))){_0x5917d3[_0x8820('0x1e')]=qs[_0x8820('0x1e')](_0x4a90d0['query'][_0x8820('0x1e')]);_0x5917d3['offset']=qs[_0x8820('0x1c')](_0x4a90d0['query'][_0x8820('0x1c')]);}_0x5917d3[_0x8820('0x38')]=qs[_0x8820('0x39')](_0x4a90d0[_0x8820('0x2f')][_0x8820('0x39')]);_0x5917d3[_0x8820('0x3a')]=qs[_0x8820('0x31')](_[_0x8820('0x3b')](_0x4a90d0[_0x8820('0x2f')],_0x5e4dff['filters']),_0x669a9a);if(_0x4a90d0[_0x8820('0x2f')][_0x8820('0x3c')]){_0x5917d3[_0x8820('0x3a')]=_[_0x8820('0x3d')](_0x5917d3[_0x8820('0x3a')],{'$or':_[_0x8820('0x2b')](_0x669a9a,function(_0x122add){if(_0x122add[_0x8820('0x2e')]!==_0x8820('0x3e')){var _0x5525e4={};_0x5525e4[_0x122add[_0x8820('0x28')]]={'$like':'%'+_0x4a90d0['query'][_0x8820('0x3c')]+'%'};return _0x5525e4;}})});}_0x5917d3=_[_0x8820('0x3d')]({},_0x5917d3,_0x4a90d0['options']);var _0x188294={'where':_0x5917d3[_0x8820('0x3a')]};return db[_0x8820('0x2c')]['count'](_0x188294)[_0x8820('0x25')](function(_0x1eaf64){_0x543d81[_0x8820('0x3f')]=_0x1eaf64;if(_0x4a90d0[_0x8820('0x2f')][_0x8820('0x40')]){_0x5917d3[_0x8820('0x41')]=[{'all':!![]}];}return db[_0x8820('0x2c')][_0x8820('0x42')](_0x5917d3);})[_0x8820('0x25')](function(_0x36bb78){_0x543d81[_0x8820('0x43')]=_0x36bb78;return _0x543d81;})[_0x8820('0x25')](respondWithFilteredResult(_0x101888,_0x5917d3))[_0x8820('0x44')](handleError(_0x101888,null));};exports[_0x8820('0x45')]=function(_0x125d88,_0x281d62){var _0xaaabb0={'raw':![],'where':{'id':_0x125d88[_0x8820('0x46')]['id']}},_0x4c0e9a={};_0x4c0e9a[_0x8820('0x33')]=_['keys'](db[_0x8820('0x2c')][_0x8820('0x2d')]);_0x4c0e9a['query']=_[_0x8820('0x30')](_0x125d88[_0x8820('0x2f')]);_0x4c0e9a[_0x8820('0x31')]=_[_0x8820('0x32')](_0x4c0e9a[_0x8820('0x33')],_0x4c0e9a[_0x8820('0x2f')]);_0xaaabb0[_0x8820('0x34')]=_[_0x8820('0x32')](_0x4c0e9a[_0x8820('0x33')],qs[_0x8820('0x35')](_0x125d88['query'][_0x8820('0x35')]));_0xaaabb0[_0x8820('0x34')]=_0xaaabb0[_0x8820('0x34')]['length']?_0xaaabb0[_0x8820('0x34')]:_0x4c0e9a[_0x8820('0x33')];if(_0x125d88[_0x8820('0x2f')][_0x8820('0x40')]){_0xaaabb0[_0x8820('0x41')]=[{'all':!![]}];}_0xaaabb0=_[_0x8820('0x3d')]({},_0xaaabb0,_0x125d88['options']);return db[_0x8820('0x2c')][_0x8820('0x47')](_0xaaabb0)[_0x8820('0x25')](handleEntityNotFound(_0x281d62,null))[_0x8820('0x25')](respondWithResult(_0x281d62,null))[_0x8820('0x44')](handleError(_0x281d62,null));};exports[_0x8820('0x48')]=function(_0x54c960,_0x3ad5ed){return db[_0x8820('0x2c')][_0x8820('0x48')](_0x54c960[_0x8820('0x49')],{})[_0x8820('0x25')](respondWithResult(_0x3ad5ed,0xc9))[_0x8820('0x44')](handleError(_0x3ad5ed,null));};exports[_0x8820('0x23')]=function(_0x53927e,_0x1dbea6){if(_0x53927e[_0x8820('0x49')]['id']){delete _0x53927e[_0x8820('0x49')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x53927e[_0x8820('0x46')]['id']}})[_0x8820('0x25')](handleEntityNotFound(_0x1dbea6,null))[_0x8820('0x25')](saveUpdates(_0x53927e[_0x8820('0x49')],null))['then'](respondWithResult(_0x1dbea6,null))[_0x8820('0x44')](handleError(_0x1dbea6,null));};exports['destroy']=function(_0x2df0b8,_0x51b7b0){return db[_0x8820('0x2c')][_0x8820('0x47')]({'where':{'id':_0x2df0b8[_0x8820('0x46')]['id']}})[_0x8820('0x25')](handleEntityNotFound(_0x51b7b0,null))[_0x8820('0x25')](removeEntity(_0x51b7b0,null))[_0x8820('0x44')](handleError(_0x51b7b0,null));};exports['getConfigurations']=function(_0x3598af,_0x2bc720,_0x401c74){var _0x1ebe60={};var _0x432b4c={};var _0x23decc;var _0x3acc44;return db['FreshsalesAccount'][_0x8820('0x4a')]({'where':{'id':_0x3598af[_0x8820('0x46')]['id']}})[_0x8820('0x25')](handleEntityNotFound(_0x2bc720,null))['then'](function(_0x36219d){if(_0x36219d){_0x23decc=_0x36219d;_0x432b4c[_0x8820('0x33')]=_[_0x8820('0x30')](db[_0x8820('0x4b')][_0x8820('0x2d')]);_0x432b4c[_0x8820('0x2f')]=_[_0x8820('0x30')](_0x3598af['query']);_0x432b4c[_0x8820('0x31')]=_['intersection'](_0x432b4c[_0x8820('0x33')],_0x432b4c[_0x8820('0x2f')]);_0x1ebe60[_0x8820('0x34')]=_[_0x8820('0x32')](_0x432b4c[_0x8820('0x33')],qs[_0x8820('0x35')](_0x3598af['query'][_0x8820('0x35')]));_0x1ebe60['attributes']=_0x1ebe60[_0x8820('0x34')][_0x8820('0x4c')]?_0x1ebe60[_0x8820('0x34')]:_0x432b4c[_0x8820('0x33')];_0x1ebe60[_0x8820('0x38')]=qs[_0x8820('0x39')](_0x3598af[_0x8820('0x2f')]['sort']);_0x1ebe60[_0x8820('0x3a')]=qs['filters'](_[_0x8820('0x3b')](_0x3598af[_0x8820('0x2f')],_0x432b4c[_0x8820('0x31')]));if(_0x3598af['query'][_0x8820('0x3c')]){_0x1ebe60[_0x8820('0x3a')]=_[_0x8820('0x3d')](_0x1ebe60[_0x8820('0x3a')],{'$or':_['map'](_0x1ebe60[_0x8820('0x34')],function(_0x32a5e9){var _0x5d6c1a={};_0x5d6c1a[_0x32a5e9]={'$like':'%'+_0x3598af['query']['filter']+'%'};return _0x5d6c1a;})});}_0x1ebe60=_['merge']({},_0x1ebe60,_0x3598af[_0x8820('0x4d')]);return _0x23decc[_0x8820('0x4e')](_0x1ebe60);}})['then'](function(_0x314c43){if(_0x314c43){_0x3acc44=_0x314c43[_0x8820('0x4c')];if(!_0x3598af[_0x8820('0x2f')]['hasOwnProperty'](_0x8820('0x37'))){_0x1ebe60[_0x8820('0x1e')]=qs[_0x8820('0x1e')](_0x3598af[_0x8820('0x2f')][_0x8820('0x1e')]);_0x1ebe60[_0x8820('0x1c')]=qs[_0x8820('0x1c')](_0x3598af[_0x8820('0x2f')][_0x8820('0x1c')]);}return _0x23decc[_0x8820('0x4e')](_0x1ebe60);}})[_0x8820('0x25')](function(_0x37e57c){if(_0x37e57c){return _0x37e57c?{'count':_0x3acc44,'rows':_0x37e57c}:null;}})[_0x8820('0x25')](respondWithResult(_0x2bc720,null))[_0x8820('0x44')](handleError(_0x2bc720,null));};exports[_0x8820('0x4f')]=function(_0x5524dc,_0x40509f,_0x1d7e87){if(_0x5524dc[_0x8820('0x49')]['id']){delete _0x5524dc[_0x8820('0x49')]['id'];}return db[_0x8820('0x2c')][_0x8820('0x4a')]({'where':{'id':_0x5524dc[_0x8820('0x46')]['id']}})[_0x8820('0x25')](handleEntityNotFound(_0x40509f,null))[_0x8820('0x25')](function(_0x1bd443){if(_0x1bd443){_0x5524dc[_0x8820('0x49')]['AccountId']=_0x1bd443['id'];_0x5524dc['body']['Subjects']=integrations[_0x8820('0x50')](_0x5524dc[_0x8820('0x49')][_0x8820('0x51')],_0x5524dc[_0x8820('0x49')]['type']);_0x5524dc[_0x8820('0x49')][_0x8820('0x52')]=integrations[_0x8820('0x53')](_0x5524dc['body'][_0x8820('0x51')],_0x5524dc[_0x8820('0x49')]['type']);return db[_0x8820('0x4b')][_0x8820('0x48')](_0x5524dc[_0x8820('0x49')],{'include':[{'model':db[_0x8820('0x54')],'as':_0x8820('0x55')},{'model':db['FreshsalesField'],'as':_0x8820('0x52')}]});}return null;})[_0x8820('0x25')](respondWithResult(_0x40509f,null))[_0x8820('0x44')](handleError(_0x40509f,null));};exports['getFields']=function(_0x3978e4,_0x40fe96,_0x273afe){var _0x4c66ed='';var _0x8c710d='';return db['FreshsalesAccount'][_0x8820('0x4a')]({'where':{'id':_0x3978e4[_0x8820('0x46')]['id']},'attributes':['id',_0x8820('0x56'),'remoteUri',_0x8820('0x57')]})[_0x8820('0x25')](handleEntityNotFound(_0x40fe96,null))[_0x8820('0x25')](function(_0x1451a7){if(_0x1451a7){_0x8c710d=_0x1451a7[_0x8820('0x56')];_0x4c66ed=_0x1451a7[_0x8820('0x58')];var _0x14d434=_0x1451a7[_0x8820('0x58')][_0x8820('0x59')](-0x1);if(_0x14d434==='/'){_0x4c66ed=_0x4c66ed[_0x8820('0x5a')](0x0,_0x4c66ed[_0x8820('0x5b')](_0x14d434));}return rp({'method':_0x8820('0x5c'),'uri':util[_0x8820('0x5d')](_0x8820('0x5e'),_0x4c66ed,_0x8820('0x5f')),'headers':{'Authorization':_0x8820('0x60')+_0x1451a7[_0x8820('0x57')]},'json':!![]});}})['then'](function(_0x115292){if(_0x115292){var _0x2d2335=_0x115292[_0x8820('0x61')];var _0x3f2e8a=![];var _0xb94d87=null;for(_0xb94d87=0x0;_0xb94d87<_0x2d2335['length'];_0xb94d87++){if(_0x2d2335[_0xb94d87]['email']===_0x8c710d){_0x3f2e8a=!![];}}if(_0x3f2e8a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8820('0x62')});}}})['then'](respondWithResult(_0x40fe96,null))[_0x8820('0x44')](function(_0xccfc9e){var _0x3b3949=_0x3978e4[_0x8820('0x2f')][_0x8820('0x63')]?0x1f4:_0xccfc9e[_0x8820('0x64')]||0x1f4;logger[_0x8820('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x8820('0x65'),_0x3b3949,JSON[_0x8820('0x66')](_0xccfc9e));delete _0xccfc9e['name'];if(_0x3b3949===0x191){_0x3b3949=0x190;}_0x40fe96[_0x8820('0x1a')](_0x3b3949)[_0x8820('0x29')](_0x3978e4[_0x8820('0x2f')][_0x8820('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0xccfc9e[_0x8820('0x64')]}:_0xccfc9e);});}; \ No newline at end of file +var _0xcf42=['Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','FreshsalesConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','apiKey','username','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x167bcc,_0x49f8dd){var _0x3720c3=function(_0x3c7ed0){while(--_0x3c7ed0){_0x167bcc['push'](_0x167bcc['shift']());}};_0x3720c3(++_0x49f8dd);}(_0xcf42,0x1b2));var _0x2cf4=function(_0x1dbf9b,_0x197cae){_0x1dbf9b=_0x1dbf9b-0x0;var _0x112a84=_0xcf42[_0x1dbf9b];return _0x112a84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2cf4('0x0'));var zipdir=require(_0x2cf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cf4('0x2'));var moment=require(_0x2cf4('0x3'));var BPromise=require(_0x2cf4('0x4'));var Mustache=require(_0x2cf4('0x5'));var util=require(_0x2cf4('0x6'));var path=require('path');var sox=require(_0x2cf4('0x7'));var csv=require(_0x2cf4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cf4('0x9'));var _=require(_0x2cf4('0xa'));var squel=require(_0x2cf4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2cf4('0xc'));var toCsv=require(_0x2cf4('0x8'));var querystring=require(_0x2cf4('0xd'));var Papa=require(_0x2cf4('0xe'));var Redis=require(_0x2cf4('0xf'));var authService=require(_0x2cf4('0x10'));var qs=require(_0x2cf4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cf4('0x12'));var logger=require(_0x2cf4('0x13'))(_0x2cf4('0x14'));var utils=require(_0x2cf4('0x15'));var config=require(_0x2cf4('0x16'));var licenseUtil=require(_0x2cf4('0x17'));var db=require(_0x2cf4('0x18'))['db'];var integrations=require(_0x2cf4('0x19'));function respondWithStatusCode(_0xf72d3b,_0x845d48){_0x845d48=_0x845d48||0xcc;return function(_0x384748){if(_0x384748){return _0xf72d3b['sendStatus'](_0x845d48);}return _0xf72d3b[_0x2cf4('0x1a')](_0x845d48)[_0x2cf4('0x1b')]();};}function respondWithResult(_0x1663e6,_0x4ace7e){_0x4ace7e=_0x4ace7e||0xc8;return function(_0x1b9ed9){if(_0x1b9ed9){return _0x1663e6['status'](_0x4ace7e)[_0x2cf4('0x1c')](_0x1b9ed9);}};}function respondWithFilteredResult(_0x2c9d9c,_0x2183e3){return function(_0x4fb1a0){if(_0x4fb1a0){var _0xe31756=typeof _0x2183e3[_0x2cf4('0x1d')]===_0x2cf4('0x1e')&&typeof _0x2183e3[_0x2cf4('0x1f')]===_0x2cf4('0x1e');var _0x546713=_0x4fb1a0['count'];var _0x437a8d=_0xe31756?0x0:_0x2183e3[_0x2cf4('0x1d')];var _0x3d6b37=_0xe31756?_0x4fb1a0[_0x2cf4('0x20')]:_0x2183e3[_0x2cf4('0x1d')]+_0x2183e3[_0x2cf4('0x1f')];var _0x1b900e;if(_0x3d6b37>=_0x546713){_0x3d6b37=_0x546713;_0x1b900e=0xc8;}else{_0x1b900e=0xce;}_0x2c9d9c[_0x2cf4('0x1a')](_0x1b900e);return _0x2c9d9c[_0x2cf4('0x21')](_0x2cf4('0x22'),_0x437a8d+'-'+_0x3d6b37+'/'+_0x546713)[_0x2cf4('0x1c')](_0x4fb1a0);}return null;};}function patchUpdates(_0x25aee8){return function(_0x57f55b){try{jsonpatch[_0x2cf4('0x23')](_0x57f55b,_0x25aee8,!![]);}catch(_0x41d4a4){return BPromise[_0x2cf4('0x24')](_0x41d4a4);}return _0x57f55b[_0x2cf4('0x25')]();};}function saveUpdates(_0x109d61,_0x52f16d){return function(_0x3a6939){if(_0x3a6939){return _0x3a6939[_0x2cf4('0x26')](_0x109d61)[_0x2cf4('0x27')](function(_0x4b7ba8){return _0x4b7ba8;});}return null;};}function removeEntity(_0x29fae0,_0x6f1a2f){return function(_0x2cba08){if(_0x2cba08){return _0x2cba08[_0x2cf4('0x28')]()['then'](function(){_0x29fae0[_0x2cf4('0x1a')](0xcc)[_0x2cf4('0x1b')]();});}};}function handleEntityNotFound(_0x4e2878,_0x583bc1){return function(_0x45b110){if(!_0x45b110){_0x4e2878[_0x2cf4('0x29')](0x194);}return _0x45b110;};}function handleError(_0x187e8b,_0x25c473){_0x25c473=_0x25c473||0x1f4;return function(_0x4e488c){logger[_0x2cf4('0x2a')](_0x4e488c[_0x2cf4('0x2b')]);if(_0x4e488c['name']){delete _0x4e488c[_0x2cf4('0x2c')];}_0x187e8b[_0x2cf4('0x1a')](_0x25c473)[_0x2cf4('0x2d')](_0x4e488c);};}exports[_0x2cf4('0x2e')]=function(_0x5230f2,_0x1d6b3d){var _0x31c728={},_0x1e004e={},_0x58b5c3={'count':0x0,'rows':[]};var _0x279966=_[_0x2cf4('0x2f')](db[_0x2cf4('0x30')][_0x2cf4('0x31')],function(_0x3977aa){return{'name':_0x3977aa[_0x2cf4('0x32')],'type':_0x3977aa[_0x2cf4('0x33')][_0x2cf4('0x34')]};});_0x1e004e[_0x2cf4('0x35')]=_['map'](_0x279966,_0x2cf4('0x2c'));_0x1e004e[_0x2cf4('0x36')]=_[_0x2cf4('0x37')](_0x5230f2['query']);_0x1e004e[_0x2cf4('0x38')]=_['intersection'](_0x1e004e['model'],_0x1e004e[_0x2cf4('0x36')]);_0x31c728[_0x2cf4('0x39')]=_[_0x2cf4('0x3a')](_0x1e004e[_0x2cf4('0x35')],qs['fields'](_0x5230f2[_0x2cf4('0x36')][_0x2cf4('0x3b')]));_0x31c728[_0x2cf4('0x39')]=_0x31c728[_0x2cf4('0x39')][_0x2cf4('0x3c')]?_0x31c728[_0x2cf4('0x39')]:_0x1e004e[_0x2cf4('0x35')];if(!_0x5230f2[_0x2cf4('0x36')][_0x2cf4('0x3d')](_0x2cf4('0x3e'))){_0x31c728[_0x2cf4('0x1f')]=qs[_0x2cf4('0x1f')](_0x5230f2[_0x2cf4('0x36')][_0x2cf4('0x1f')]);_0x31c728[_0x2cf4('0x1d')]=qs[_0x2cf4('0x1d')](_0x5230f2[_0x2cf4('0x36')][_0x2cf4('0x1d')]);}_0x31c728[_0x2cf4('0x3f')]=qs[_0x2cf4('0x40')](_0x5230f2[_0x2cf4('0x36')]['sort']);_0x31c728[_0x2cf4('0x41')]=qs['filters'](_[_0x2cf4('0x42')](_0x5230f2[_0x2cf4('0x36')],_0x1e004e[_0x2cf4('0x38')]),_0x279966);if(_0x5230f2['query'][_0x2cf4('0x43')]){_0x31c728[_0x2cf4('0x41')]=_[_0x2cf4('0x44')](_0x31c728[_0x2cf4('0x41')],{'$or':_[_0x2cf4('0x2f')](_0x279966,function(_0x2f9581){if(_0x2f9581['type']!==_0x2cf4('0x45')){var _0x82c78={};_0x82c78[_0x2f9581[_0x2cf4('0x2c')]]={'$like':'%'+_0x5230f2[_0x2cf4('0x36')]['filter']+'%'};return _0x82c78;}})});}_0x31c728=_['merge']({},_0x31c728,_0x5230f2[_0x2cf4('0x46')]);var _0x65f773={'where':_0x31c728[_0x2cf4('0x41')]};return db['FreshsalesAccount'][_0x2cf4('0x20')](_0x65f773)['then'](function(_0x318ce1){_0x58b5c3['count']=_0x318ce1;if(_0x5230f2[_0x2cf4('0x36')][_0x2cf4('0x47')]){_0x31c728[_0x2cf4('0x48')]=[{'all':!![]}];}return db[_0x2cf4('0x30')][_0x2cf4('0x49')](_0x31c728);})[_0x2cf4('0x27')](function(_0x414f06){_0x58b5c3[_0x2cf4('0x4a')]=_0x414f06;return _0x58b5c3;})[_0x2cf4('0x27')](respondWithFilteredResult(_0x1d6b3d,_0x31c728))[_0x2cf4('0x4b')](handleError(_0x1d6b3d,null));};exports[_0x2cf4('0x4c')]=function(_0x3adca1,_0x446b1b){var _0x3ebf85={'raw':![],'where':{'id':_0x3adca1['params']['id']}},_0x425877={};_0x425877[_0x2cf4('0x35')]=_[_0x2cf4('0x37')](db[_0x2cf4('0x30')][_0x2cf4('0x31')]);_0x425877[_0x2cf4('0x36')]=_[_0x2cf4('0x37')](_0x3adca1[_0x2cf4('0x36')]);_0x425877[_0x2cf4('0x38')]=_[_0x2cf4('0x3a')](_0x425877['model'],_0x425877[_0x2cf4('0x36')]);_0x3ebf85[_0x2cf4('0x39')]=_['intersection'](_0x425877[_0x2cf4('0x35')],qs[_0x2cf4('0x3b')](_0x3adca1['query'][_0x2cf4('0x3b')]));_0x3ebf85[_0x2cf4('0x39')]=_0x3ebf85[_0x2cf4('0x39')][_0x2cf4('0x3c')]?_0x3ebf85[_0x2cf4('0x39')]:_0x425877['model'];if(_0x3adca1[_0x2cf4('0x36')][_0x2cf4('0x47')]){_0x3ebf85[_0x2cf4('0x48')]=[{'all':!![]}];}_0x3ebf85=_[_0x2cf4('0x44')]({},_0x3ebf85,_0x3adca1[_0x2cf4('0x46')]);return db[_0x2cf4('0x30')][_0x2cf4('0x4d')](_0x3ebf85)['then'](handleEntityNotFound(_0x446b1b,null))[_0x2cf4('0x27')](respondWithResult(_0x446b1b,null))[_0x2cf4('0x4b')](handleError(_0x446b1b,null));};exports['create']=function(_0x21710b,_0x1e3927){return db[_0x2cf4('0x30')][_0x2cf4('0x4e')](_0x21710b['body'],{})[_0x2cf4('0x27')](respondWithResult(_0x1e3927,0xc9))[_0x2cf4('0x4b')](handleError(_0x1e3927,null));};exports[_0x2cf4('0x26')]=function(_0x1ec772,_0x2bc2e0){if(_0x1ec772[_0x2cf4('0x4f')]['id']){delete _0x1ec772[_0x2cf4('0x4f')]['id'];}return db[_0x2cf4('0x30')][_0x2cf4('0x4d')]({'where':{'id':_0x1ec772[_0x2cf4('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bc2e0,null))[_0x2cf4('0x27')](saveUpdates(_0x1ec772['body'],null))[_0x2cf4('0x27')](respondWithResult(_0x2bc2e0,null))[_0x2cf4('0x4b')](handleError(_0x2bc2e0,null));};exports[_0x2cf4('0x28')]=function(_0x2a4f03,_0x45ccbd){return db[_0x2cf4('0x30')][_0x2cf4('0x4d')]({'where':{'id':_0x2a4f03[_0x2cf4('0x50')]['id']}})[_0x2cf4('0x27')](handleEntityNotFound(_0x45ccbd,null))[_0x2cf4('0x27')](removeEntity(_0x45ccbd,null))['catch'](handleError(_0x45ccbd,null));};exports[_0x2cf4('0x51')]=function(_0x1dbf19,_0x4561c4,_0xf919e4){var _0xd76874={};var _0x590070={};var _0x150471;var _0x59bc1f;return db[_0x2cf4('0x30')]['findOne']({'where':{'id':_0x1dbf19[_0x2cf4('0x50')]['id']}})[_0x2cf4('0x27')](handleEntityNotFound(_0x4561c4,null))[_0x2cf4('0x27')](function(_0x36a76f){if(_0x36a76f){_0x150471=_0x36a76f;_0x590070[_0x2cf4('0x35')]=_['keys'](db[_0x2cf4('0x52')][_0x2cf4('0x31')]);_0x590070['query']=_[_0x2cf4('0x37')](_0x1dbf19[_0x2cf4('0x36')]);_0x590070[_0x2cf4('0x38')]=_[_0x2cf4('0x3a')](_0x590070[_0x2cf4('0x35')],_0x590070[_0x2cf4('0x36')]);_0xd76874[_0x2cf4('0x39')]=_['intersection'](_0x590070[_0x2cf4('0x35')],qs['fields'](_0x1dbf19['query'][_0x2cf4('0x3b')]));_0xd76874['attributes']=_0xd76874['attributes']['length']?_0xd76874[_0x2cf4('0x39')]:_0x590070[_0x2cf4('0x35')];_0xd76874['order']=qs['sort'](_0x1dbf19[_0x2cf4('0x36')][_0x2cf4('0x40')]);_0xd76874[_0x2cf4('0x41')]=qs[_0x2cf4('0x38')](_[_0x2cf4('0x42')](_0x1dbf19[_0x2cf4('0x36')],_0x590070['filters']));if(_0x1dbf19[_0x2cf4('0x36')][_0x2cf4('0x43')]){_0xd76874['where']=_[_0x2cf4('0x44')](_0xd76874[_0x2cf4('0x41')],{'$or':_[_0x2cf4('0x2f')](_0xd76874['attributes'],function(_0x25d6ce){var _0x2edbb0={};_0x2edbb0[_0x25d6ce]={'$like':'%'+_0x1dbf19[_0x2cf4('0x36')][_0x2cf4('0x43')]+'%'};return _0x2edbb0;})});}_0xd76874=_[_0x2cf4('0x44')]({},_0xd76874,_0x1dbf19[_0x2cf4('0x46')]);return _0x150471['getConfigurations'](_0xd76874);}})[_0x2cf4('0x27')](function(_0x7c7c08){if(_0x7c7c08){_0x59bc1f=_0x7c7c08[_0x2cf4('0x3c')];if(!_0x1dbf19['query'][_0x2cf4('0x3d')](_0x2cf4('0x3e'))){_0xd76874[_0x2cf4('0x1f')]=qs['limit'](_0x1dbf19[_0x2cf4('0x36')][_0x2cf4('0x1f')]);_0xd76874[_0x2cf4('0x1d')]=qs[_0x2cf4('0x1d')](_0x1dbf19[_0x2cf4('0x36')][_0x2cf4('0x1d')]);}return _0x150471['getConfigurations'](_0xd76874);}})[_0x2cf4('0x27')](function(_0x243ce0){if(_0x243ce0){return _0x243ce0?{'count':_0x59bc1f,'rows':_0x243ce0}:null;}})[_0x2cf4('0x27')](respondWithResult(_0x4561c4,null))['catch'](handleError(_0x4561c4,null));};exports['addConfiguration']=function(_0x5b68ce,_0x247c72,_0x36e19b){if(_0x5b68ce[_0x2cf4('0x4f')]['id']){delete _0x5b68ce[_0x2cf4('0x4f')]['id'];}return db['FreshsalesAccount'][_0x2cf4('0x53')]({'where':{'id':_0x5b68ce[_0x2cf4('0x50')]['id']}})[_0x2cf4('0x27')](handleEntityNotFound(_0x247c72,null))['then'](function(_0x3a2679){if(_0x3a2679){_0x5b68ce[_0x2cf4('0x4f')][_0x2cf4('0x54')]=_0x3a2679['id'];_0x5b68ce[_0x2cf4('0x4f')][_0x2cf4('0x55')]=integrations[_0x2cf4('0x56')](_0x5b68ce['body'][_0x2cf4('0x57')],_0x5b68ce[_0x2cf4('0x4f')]['type']);_0x5b68ce[_0x2cf4('0x4f')][_0x2cf4('0x58')]=integrations[_0x2cf4('0x59')](_0x5b68ce[_0x2cf4('0x4f')]['channel'],_0x5b68ce['body'][_0x2cf4('0x33')]);return db[_0x2cf4('0x52')][_0x2cf4('0x4e')](_0x5b68ce[_0x2cf4('0x4f')],{'include':[{'model':db[_0x2cf4('0x5a')],'as':_0x2cf4('0x55')},{'model':db['FreshsalesField'],'as':_0x2cf4('0x58')}]});}return null;})[_0x2cf4('0x27')](respondWithResult(_0x247c72,null))[_0x2cf4('0x4b')](handleError(_0x247c72,null));};exports[_0x2cf4('0x5b')]=function(_0x3b563b,_0x366f94,_0x298099){var _0xb7d42='';var _0x55dfb3='';return db['FreshsalesAccount'][_0x2cf4('0x53')]({'where':{'id':_0x3b563b[_0x2cf4('0x50')]['id']},'attributes':['id','username','remoteUri',_0x2cf4('0x5c')]})[_0x2cf4('0x27')](handleEntityNotFound(_0x366f94,null))['then'](function(_0x112cfd){if(_0x112cfd){_0x55dfb3=_0x112cfd[_0x2cf4('0x5d')];_0xb7d42=_0x112cfd[_0x2cf4('0x5e')];var _0x4c66a8=_0x112cfd['remoteUri'][_0x2cf4('0x5f')](-0x1);if(_0x4c66a8==='/'){_0xb7d42=_0xb7d42[_0x2cf4('0x60')](0x0,_0xb7d42['lastIndexOf'](_0x4c66a8));}return rp({'method':_0x2cf4('0x61'),'uri':util[_0x2cf4('0x62')](_0x2cf4('0x63'),_0xb7d42,_0x2cf4('0x64')),'headers':{'Authorization':_0x2cf4('0x65')+_0x112cfd['apiKey']},'json':!![]});}})[_0x2cf4('0x27')](function(_0x1a1e64){if(_0x1a1e64){var _0x2e0a83=_0x1a1e64[_0x2cf4('0x66')];var _0x31660c=![];var _0x22ebc5=null;for(_0x22ebc5=0x0;_0x22ebc5<_0x2e0a83[_0x2cf4('0x3c')];_0x22ebc5++){if(_0x2e0a83[_0x22ebc5][_0x2cf4('0x67')]===_0x55dfb3){_0x31660c=!![];}}if(_0x31660c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x2cf4('0x27')](respondWithResult(_0x366f94,null))[_0x2cf4('0x4b')](function(_0x506134){var _0x29f301=_0x3b563b[_0x2cf4('0x36')][_0x2cf4('0x68')]?0x1f4:_0x506134['statusCode']||0x1f4;logger[_0x2cf4('0x2a')](_0x2cf4('0x69'),'getFields',_0x29f301,JSON['stringify'](_0x506134));delete _0x506134[_0x2cf4('0x2c')];if(_0x29f301===0x191){_0x29f301=0x190;}_0x366f94[_0x2cf4('0x1a')](_0x29f301)[_0x2cf4('0x2d')](_0x3b563b['query'][_0x2cf4('0x68')]?{'message':_0x2cf4('0x6a'),'statusCode':_0x506134[_0x2cf4('0x6b')]}:_0x506134);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 559d949..2f4e342 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 _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0x5fab,0x177));var _0xb5fa=function(_0x56abe6,_0x1dfa2b){_0x56abe6=_0x56abe6-0x0;var _0x39a04d=_0x5fab[_0x56abe6];return _0x39a04d;};'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'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_freshsales_accounts'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0xc2c7,0x134));var _0x7c2c=function(_0x22fc29,_0xb1162e){_0x22fc29=_0x22fc29-0x0;var _0x4920c5=_0xc2c7[_0x22fc29];return _0x4920c5;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x7c2c('0x8'));module[_0x7c2c('0x9')]=function(_0x23c038,_0x54f027){return _0x23c038['define']('FreshsalesAccount',attributes,{'tableName':_0x7c2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 8c3541e..6c057ca 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 _0x7046=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowFreshsalesAccount','FreshsalesAccount','find'];(function(_0x40c58c,_0x363dc2){var _0x55084f=function(_0x325a3e){while(--_0x325a3e){_0x40c58c['push'](_0x40c58c['shift']());}};_0x55084f(++_0x363dc2);}(_0x7046,0x144));var _0x6704=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7046[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});}exports[_0x6704('0x17')]=function(_0x31d732){var _0x135f4b=this;return new Promise(function(_0xe49450,_0x344ed9){return db['FreshsalesAccount'][_0x6704('0x18')]({'raw':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x31d732['options']?_0x31d732[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'limit':_0x31d732[_0x6704('0x19')]?_0x31d732['options']['limit']||null:null,'include':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x31d732[_0x6704('0x19')]['include'],function(_0xf2c459){return{'model':db[_0xf2c459[_0x6704('0x1f')]],'as':_0xf2c459['as'],'attributes':_0xf2c459[_0x6704('0x1c')],'include':_0xf2c459[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0xf2c459[_0x6704('0x1d')],function(_0x2acafd){return{'model':db[_0x2acafd[_0x6704('0x1f')]],'as':_0x2acafd['as'],'attributes':_0x2acafd[_0x6704('0x1c')],'include':_0x2acafd[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x2acafd[_0x6704('0x1d')],function(_0x118d93){return{'model':db[_0x118d93['model']],'as':_0x118d93['as'],'attributes':_0x118d93['attributes']};}):[]};}):[]};}):[]:[]})[_0x6704('0x20')](function(_0xf875dc){logger[_0x6704('0xc')](_0x6704('0x17'),_0x31d732);logger['debug'](_0x6704('0x17'),_0x31d732,JSON[_0x6704('0x11')](_0xf875dc));_0xe49450(_0xf875dc);})['catch'](function(_0x588814){logger[_0x6704('0x12')]('GetFreshsalesAccount',_0x588814[_0x6704('0x14')],_0x31d732);_0x344ed9(_0x135f4b['error'](0x1f4,_0x588814['message']));});});};exports[_0x6704('0x21')]=function(_0x115514){var _0x45a286=this;return new Promise(function(_0x4ffa53,_0x1c7132){return db[_0x6704('0x22')][_0x6704('0x23')]({'raw':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'include':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x115514[_0x6704('0x19')][_0x6704('0x1d')],function(_0x219494){return{'model':db[_0x219494[_0x6704('0x1f')]],'as':_0x219494['as'],'attributes':_0x219494[_0x6704('0x1c')],'include':_0x219494[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x219494[_0x6704('0x1d')],function(_0x30b914){return{'model':db[_0x30b914['model']],'as':_0x30b914['as'],'attributes':_0x30b914['attributes'],'include':_0x30b914['include']?_[_0x6704('0x1e')](_0x30b914[_0x6704('0x1d')],function(_0x18222f){return{'model':db[_0x18222f['model']],'as':_0x18222f['as'],'attributes':_0x18222f[_0x6704('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15da25){logger[_0x6704('0xc')](_0x6704('0x21'),_0x115514);logger[_0x6704('0xf')](_0x6704('0x21'),_0x115514,JSON[_0x6704('0x11')](_0x15da25));_0x4ffa53(_0x15da25);})[_0x6704('0x16')](function(_0x2fba31){logger['error']('ShowFreshsalesAccount',_0x2fba31[_0x6704('0x14')],_0x115514);_0x1c7132(_0x45a286[_0x6704('0x12')](0x1f4,_0x2fba31['message']));});});}; \ No newline at end of file +var _0xd117=['message','request\x20sent','catch','FreshsalesAccount','options','raw','where','attributes','limit','map','include','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','code','error'];(function(_0x1eaa4b,_0x81089b){var _0x2fafc4=function(_0x434c01){while(--_0x434c01){_0x1eaa4b['push'](_0x1eaa4b['shift']());}};_0x2fafc4(++_0x81089b);}(_0xd117,0x182));var _0x7d11=function(_0x35d2d6,_0x14e944){_0x35d2d6=_0x35d2d6-0x0;var _0x1637d5=_0xd117[_0x35d2d6];return _0x1637d5;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}exports['GetFreshsalesAccount']=function(_0x456cb9){var _0x49a34b=this;return new Promise(function(_0x4d1306,_0x5459df){return db[_0x7d11('0x18')]['findAll']({'raw':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1b')]||null:null,'attributes':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1c')]||null:null,'limit':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1d')]||null:null,'include':_0x456cb9['options']?_0x456cb9['options']['include']?_[_0x7d11('0x1e')](_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1f')],function(_0x1a7853){return{'model':db[_0x1a7853[_0x7d11('0x20')]],'as':_0x1a7853['as'],'attributes':_0x1a7853[_0x7d11('0x1c')],'include':_0x1a7853[_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0x1a7853['include'],function(_0x36c2b4){return{'model':db[_0x36c2b4['model']],'as':_0x36c2b4['as'],'attributes':_0x36c2b4['attributes'],'include':_0x36c2b4['include']?_[_0x7d11('0x1e')](_0x36c2b4['include'],function(_0x180e1e){return{'model':db[_0x180e1e[_0x7d11('0x20')]],'as':_0x180e1e['as'],'attributes':_0x180e1e[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46f76a){logger[_0x7d11('0xf')](_0x7d11('0x21'),_0x456cb9);logger['debug'](_0x7d11('0x21'),_0x456cb9,JSON[_0x7d11('0x12')](_0x46f76a));_0x4d1306(_0x46f76a);})[_0x7d11('0x17')](function(_0x38f1be){logger['error'](_0x7d11('0x21'),_0x38f1be['message'],_0x456cb9);_0x5459df(_0x49a34b[_0x7d11('0x14')](0x1f4,_0x38f1be['message']));});});};exports[_0x7d11('0x22')]=function(_0xba4e80){var _0x1e32f6=this;return new Promise(function(_0x4831ed,_0x5e721f){return db[_0x7d11('0x18')][_0x7d11('0x23')]({'raw':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0xba4e80[_0x7d11('0x19')]?_0xba4e80['options'][_0x7d11('0x1b')]||null:null,'attributes':_0xba4e80['options']?_0xba4e80['options'][_0x7d11('0x1c')]||null:null,'include':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0xba4e80[_0x7d11('0x19')]['include'],function(_0x11d9e2){return{'model':db[_0x11d9e2[_0x7d11('0x20')]],'as':_0x11d9e2['as'],'attributes':_0x11d9e2['attributes'],'include':_0x11d9e2['include']?_[_0x7d11('0x1e')](_0x11d9e2[_0x7d11('0x1f')],function(_0x5b7d3a){return{'model':db[_0x5b7d3a[_0x7d11('0x20')]],'as':_0x5b7d3a['as'],'attributes':_0x5b7d3a['attributes'],'include':_0x5b7d3a['include']?_[_0x7d11('0x1e')](_0x5b7d3a['include'],function(_0x4e53be){return{'model':db[_0x4e53be[_0x7d11('0x20')]],'as':_0x4e53be['as'],'attributes':_0x4e53be[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x24')](function(_0x2e426b){logger[_0x7d11('0xf')](_0x7d11('0x22'),_0xba4e80);logger[_0x7d11('0x11')](_0x7d11('0x22'),_0xba4e80,JSON[_0x7d11('0x12')](_0x2e426b));_0x4831ed(_0x2e426b);})[_0x7d11('0x17')](function(_0x1a9f18){logger[_0x7d11('0x14')]('ShowFreshsalesAccount',_0x1a9f18[_0x7d11('0x15')],_0xba4e80);_0x5e721f(_0x1e32f6['error'](0x1f4,_0x1a9f18[_0x7d11('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index bbf23ef..9dfebd9 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 _0xe5f9=['connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','update','delete','destroy','exports','multer','path'];(function(_0x5a7e55,_0x323590){var _0x426d13=function(_0x4b5209){while(--_0x4b5209){_0x5a7e55['push'](_0x5a7e55['shift']());}};_0x426d13(++_0x323590);}(_0xe5f9,0xae));var _0x9e5f=function(_0x3685bf,_0x122f45){_0x3685bf=_0x3685bf-0x0;var _0x52c375=_0xe5f9[_0x3685bf];return _0x52c375;};'use strict';var multer=require(_0x9e5f('0x0'));var util=require('util');var path=require(_0x9e5f('0x1'));var timeout=require(_0x9e5f('0x2'));var express=require(_0x9e5f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9e5f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e5f('0x5'));var controller=require(_0x9e5f('0x6'));router[_0x9e5f('0x7')]('/',auth[_0x9e5f('0x8')](),controller[_0x9e5f('0x9')]);router[_0x9e5f('0x7')](_0x9e5f('0xa'),auth[_0x9e5f('0x8')](),controller[_0x9e5f('0xb')]);router[_0x9e5f('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x9e5f('0xc')]);router[_0x9e5f('0x7')](_0x9e5f('0xd'),auth['isAuthenticated'](),controller[_0x9e5f('0xe')]);router[_0x9e5f('0x7')](_0x9e5f('0xf'),auth[_0x9e5f('0x8')](),controller['getFields']);router[_0x9e5f('0x10')]('/',auth[_0x9e5f('0x8')](),controller[_0x9e5f('0x11')]);router['put']('/:id',auth[_0x9e5f('0x8')](),controller[_0x9e5f('0x12')]);router[_0x9e5f('0x13')](_0x9e5f('0xa'),auth[_0x9e5f('0x8')](),controller[_0x9e5f('0x14')]);module[_0x9e5f('0x15')]=router; \ No newline at end of file +var _0xddbc=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x54216f,_0x479e90){var _0x34cbba=function(_0x3242b0){while(--_0x3242b0){_0x54216f['push'](_0x54216f['shift']());}};_0x34cbba(++_0x479e90);}(_0xddbc,0x134));var _0xcddb=function(_0x36dffc,_0x132845){_0x36dffc=_0x36dffc-0x0;var _0x396f84=_0xddbc[_0x36dffc];return _0x396f84;};'use strict';var multer=require(_0xcddb('0x0'));var util=require('util');var path=require(_0xcddb('0x1'));var timeout=require('connect-timeout');var express=require(_0xcddb('0x2'));var router=express['Router']();var fs_extra=require(_0xcddb('0x3'));var auth=require(_0xcddb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcddb('0x5'));var controller=require(_0xcddb('0x6'));router[_0xcddb('0x7')]('/',auth[_0xcddb('0x8')](),controller[_0xcddb('0x9')]);router[_0xcddb('0x7')]('/:id',auth[_0xcddb('0x8')](),controller[_0xcddb('0xa')]);router[_0xcddb('0x7')](_0xcddb('0xb'),auth[_0xcddb('0x8')](),controller[_0xcddb('0xc')]);router['get'](_0xcddb('0xd'),auth['isAuthenticated'](),controller[_0xcddb('0xe')]);router[_0xcddb('0x7')]('/:id/fields',auth[_0xcddb('0x8')](),controller[_0xcddb('0xf')]);router[_0xcddb('0x10')]('/',auth['isAuthenticated'](),controller[_0xcddb('0x11')]);router[_0xcddb('0x12')](_0xcddb('0x13'),auth[_0xcddb('0x8')](),controller[_0xcddb('0x14')]);router[_0xcddb('0x15')](_0xcddb('0x13'),auth['isAuthenticated'](),controller[_0xcddb('0x16')]);module[_0xcddb('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0532724..6be30da 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 _0x47ad=['STRING'];(function(_0x31e845,_0x29e1da){var _0x215db4=function(_0x15ccb7){while(--_0x15ccb7){_0x31e845['push'](_0x31e845['shift']());}};_0x215db4(++_0x29e1da);}(_0x47ad,0xa5));var _0xd47a=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x47ad[_0x5eb22e];return _0x27fed5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd47a('0x0')]}}; \ No newline at end of file +var _0x275e=['STRING','exports'];(function(_0xfcaa19,_0x37e75c){var _0x4dd4d0=function(_0x2ce659){while(--_0x2ce659){_0xfcaa19['push'](_0xfcaa19['shift']());}};_0x4dd4d0(++_0x37e75c);}(_0x275e,0x155));var _0xe275=function(_0x37e15d,_0x377d99){_0x37e15d=_0x37e15d-0x0;var _0xaafe92=_0x275e[_0x37e15d];return _0xaafe92;};'use strict';var Sequelize=require('sequelize');module[_0xe275('0x0')]={'name':{'type':Sequelize[_0xe275('0x1')]},'description':{'type':Sequelize[_0xe275('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index edb104b..e35c3a9 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 _0x9170=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','FreshsalesConfiguration','findAll','show','params','include','catch','create','body','find','findOne','order','getSubjects','getDescriptions','FreshsalesField','pick','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x40c0c1,_0x366131){var _0x3fcc49=function(_0x815acd){while(--_0x815acd){_0x40c0c1['push'](_0x40c0c1['shift']());}};_0x3fcc49(++_0x366131);}(_0x9170,0x18e));var _0x0917=function(_0x10711b,_0x439ba6){_0x10711b=_0x10711b-0x0;var _0x3955ff=_0x9170[_0x10711b];return _0x3955ff;};'use strict';var emlformat=require(_0x0917('0x0'));var rimraf=require(_0x0917('0x1'));var zipdir=require(_0x0917('0x2'));var jsonpatch=require(_0x0917('0x3'));var rp=require(_0x0917('0x4'));var moment=require(_0x0917('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0917('0x6'));var path=require(_0x0917('0x7'));var sox=require(_0x0917('0x8'));var csv=require(_0x0917('0x9'));var ejs=require(_0x0917('0xa'));var fs=require('fs');var fs_extra=require(_0x0917('0xb'));var _=require('lodash');var squel=require(_0x0917('0xc'));var crypto=require(_0x0917('0xd'));var jsforce=require(_0x0917('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0917('0xf'));var Papa=require(_0x0917('0x10'));var Redis=require(_0x0917('0x11'));var authService=require(_0x0917('0x12'));var qs=require(_0x0917('0x13'));var as=require(_0x0917('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0917('0x15'));var utils=require('../../config/utils');var config=require(_0x0917('0x16'));var licenseUtil=require(_0x0917('0x17'));var db=require(_0x0917('0x18'))['db'];function respondWithStatusCode(_0x357cb3,_0x5157cd){_0x5157cd=_0x5157cd||0xcc;return function(_0x3d2495){if(_0x3d2495){return _0x357cb3[_0x0917('0x19')](_0x5157cd);}return _0x357cb3['status'](_0x5157cd)[_0x0917('0x1a')]();};}function respondWithResult(_0x5b49c4,_0x5cf654){_0x5cf654=_0x5cf654||0xc8;return function(_0x4d1114){if(_0x4d1114){return _0x5b49c4[_0x0917('0x1b')](_0x5cf654)[_0x0917('0x1c')](_0x4d1114);}};}function respondWithFilteredResult(_0x3828eb,_0x410d10){return function(_0x1500b2){if(_0x1500b2){var _0x35fb70=typeof _0x410d10[_0x0917('0x1d')]===_0x0917('0x1e')&&typeof _0x410d10[_0x0917('0x1f')]===_0x0917('0x1e');var _0x411cf8=_0x1500b2['count'];var _0x4e9d0c=_0x35fb70?0x0:_0x410d10[_0x0917('0x1d')];var _0x3f6a50=_0x35fb70?_0x1500b2[_0x0917('0x20')]:_0x410d10['offset']+_0x410d10['limit'];var _0x2f2bcf;if(_0x3f6a50>=_0x411cf8){_0x3f6a50=_0x411cf8;_0x2f2bcf=0xc8;}else{_0x2f2bcf=0xce;}_0x3828eb[_0x0917('0x1b')](_0x2f2bcf);return _0x3828eb[_0x0917('0x21')]('Content-Range',_0x4e9d0c+'-'+_0x3f6a50+'/'+_0x411cf8)['json'](_0x1500b2);}return null;};}function patchUpdates(_0x3ee9de){return function(_0x37acff){try{jsonpatch[_0x0917('0x22')](_0x37acff,_0x3ee9de,!![]);}catch(_0x30ca09){return BPromise[_0x0917('0x23')](_0x30ca09);}return _0x37acff[_0x0917('0x24')]();};}function saveUpdates(_0x3385da,_0xbce66){return function(_0x895e96){if(_0x895e96){return _0x895e96[_0x0917('0x25')](_0x3385da)[_0x0917('0x26')](function(_0x418d2b){return _0x418d2b;});}return null;};}function removeEntity(_0x38a710,_0xb31ec9){return function(_0x4dc703){if(_0x4dc703){return _0x4dc703['destroy']()[_0x0917('0x26')](function(){_0x38a710[_0x0917('0x1b')](0xcc)[_0x0917('0x1a')]();});}};}function handleEntityNotFound(_0x1afaa4,_0xf2d7bc){return function(_0x50f47f){if(!_0x50f47f){_0x1afaa4[_0x0917('0x19')](0x194);}return _0x50f47f;};}function handleError(_0x2c78c2,_0x30de62){_0x30de62=_0x30de62||0x1f4;return function(_0x28b51d){logger[_0x0917('0x27')](_0x28b51d[_0x0917('0x28')]);if(_0x28b51d[_0x0917('0x29')]){delete _0x28b51d['name'];}_0x2c78c2[_0x0917('0x1b')](_0x30de62)[_0x0917('0x2a')](_0x28b51d);};}exports[_0x0917('0x2b')]=function(_0x8cdb9e,_0x3e6b0f){var _0x5ab07a={},_0x4516b7={},_0xcd13ca={'count':0x0,'rows':[]};var _0x1e46cd=_['map'](db['FreshsalesConfiguration'][_0x0917('0x2c')],function(_0x328908){return{'name':_0x328908[_0x0917('0x2d')],'type':_0x328908[_0x0917('0x2e')]['key']};});_0x4516b7[_0x0917('0x2f')]=_[_0x0917('0x30')](_0x1e46cd,_0x0917('0x29'));_0x4516b7[_0x0917('0x31')]=_[_0x0917('0x32')](_0x8cdb9e[_0x0917('0x31')]);_0x4516b7[_0x0917('0x33')]=_[_0x0917('0x34')](_0x4516b7[_0x0917('0x2f')],_0x4516b7[_0x0917('0x31')]);_0x5ab07a[_0x0917('0x35')]=_[_0x0917('0x34')](_0x4516b7['model'],qs[_0x0917('0x36')](_0x8cdb9e['query'][_0x0917('0x36')]));_0x5ab07a[_0x0917('0x35')]=_0x5ab07a[_0x0917('0x35')][_0x0917('0x37')]?_0x5ab07a[_0x0917('0x35')]:_0x4516b7['model'];if(!_0x8cdb9e[_0x0917('0x31')][_0x0917('0x38')](_0x0917('0x39'))){_0x5ab07a[_0x0917('0x1f')]=qs[_0x0917('0x1f')](_0x8cdb9e[_0x0917('0x31')][_0x0917('0x1f')]);_0x5ab07a['offset']=qs[_0x0917('0x1d')](_0x8cdb9e['query'][_0x0917('0x1d')]);}_0x5ab07a['order']=qs['sort'](_0x8cdb9e['query'][_0x0917('0x3a')]);_0x5ab07a[_0x0917('0x3b')]=qs['filters'](_['pick'](_0x8cdb9e[_0x0917('0x31')],_0x4516b7['filters']),_0x1e46cd);if(_0x8cdb9e['query'][_0x0917('0x3c')]){_0x5ab07a[_0x0917('0x3b')]=_[_0x0917('0x3d')](_0x5ab07a[_0x0917('0x3b')],{'$or':_['map'](_0x1e46cd,function(_0x52781d){if(_0x52781d[_0x0917('0x2e')]!==_0x0917('0x3e')){var _0x5048ab={};_0x5048ab[_0x52781d[_0x0917('0x29')]]={'$like':'%'+_0x8cdb9e['query'][_0x0917('0x3c')]+'%'};return _0x5048ab;}})});}_0x5ab07a=_['merge']({},_0x5ab07a,_0x8cdb9e[_0x0917('0x3f')]);var _0x43edb1={'where':_0x5ab07a['where']};return db['FreshsalesConfiguration'][_0x0917('0x20')](_0x43edb1)['then'](function(_0x57d3a6){_0xcd13ca[_0x0917('0x20')]=_0x57d3a6;if(_0x8cdb9e[_0x0917('0x31')][_0x0917('0x40')]){_0x5ab07a['include']=[{'all':!![]}];}return db[_0x0917('0x41')][_0x0917('0x42')](_0x5ab07a);})['then'](function(_0x3a4253){_0xcd13ca['rows']=_0x3a4253;return _0xcd13ca;})[_0x0917('0x26')](respondWithFilteredResult(_0x3e6b0f,_0x5ab07a))['catch'](handleError(_0x3e6b0f,null));};exports[_0x0917('0x43')]=function(_0x1c591c,_0xfcb6c1){var _0x160749={'raw':![],'where':{'id':_0x1c591c[_0x0917('0x44')]['id']}},_0x156a8e={};_0x156a8e[_0x0917('0x2f')]=_[_0x0917('0x32')](db['FreshsalesConfiguration'][_0x0917('0x2c')]);_0x156a8e[_0x0917('0x31')]=_['keys'](_0x1c591c[_0x0917('0x31')]);_0x156a8e[_0x0917('0x33')]=_['intersection'](_0x156a8e['model'],_0x156a8e[_0x0917('0x31')]);_0x160749[_0x0917('0x35')]=_[_0x0917('0x34')](_0x156a8e[_0x0917('0x2f')],qs[_0x0917('0x36')](_0x1c591c['query'][_0x0917('0x36')]));_0x160749['attributes']=_0x160749['attributes'][_0x0917('0x37')]?_0x160749['attributes']:_0x156a8e['model'];if(_0x1c591c[_0x0917('0x31')][_0x0917('0x40')]){_0x160749[_0x0917('0x45')]=[{'all':!![]}];}_0x160749=_['merge']({},_0x160749,_0x1c591c['options']);return db['FreshsalesConfiguration']['find'](_0x160749)[_0x0917('0x26')](handleEntityNotFound(_0xfcb6c1,null))[_0x0917('0x26')](respondWithResult(_0xfcb6c1,null))[_0x0917('0x46')](handleError(_0xfcb6c1,null));};exports['create']=function(_0x17301a,_0x526138){return db['FreshsalesConfiguration'][_0x0917('0x47')](_0x17301a[_0x0917('0x48')],{})[_0x0917('0x26')](respondWithResult(_0x526138,0xc9))[_0x0917('0x46')](handleError(_0x526138,null));};exports[_0x0917('0x25')]=function(_0x4df4bf,_0x340899){if(_0x4df4bf['body']['id']){delete _0x4df4bf[_0x0917('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x0917('0x49')]({'where':{'id':_0x4df4bf[_0x0917('0x44')]['id']}})['then'](handleEntityNotFound(_0x340899,null))[_0x0917('0x26')](saveUpdates(_0x4df4bf[_0x0917('0x48')],null))[_0x0917('0x26')](respondWithResult(_0x340899,null))[_0x0917('0x46')](handleError(_0x340899,null));};exports['destroy']=function(_0xf3455c,_0x5149d4){return db[_0x0917('0x41')]['find']({'where':{'id':_0xf3455c['params']['id']}})[_0x0917('0x26')](handleEntityNotFound(_0x5149d4,null))['then'](removeEntity(_0x5149d4,null))[_0x0917('0x46')](handleError(_0x5149d4,null));};exports['getSubjects']=function(_0x5d28dc,_0x5d3988,_0x2b193c){var _0xfeb054={};var _0x43de8a={};var _0x567751;var _0x21620d;return db[_0x0917('0x41')][_0x0917('0x4a')]({'where':{'id':_0x5d28dc[_0x0917('0x44')]['id']}})[_0x0917('0x26')](handleEntityNotFound(_0x5d3988,null))[_0x0917('0x26')](function(_0x133d24){if(_0x133d24){_0x567751=_0x133d24;_0x43de8a[_0x0917('0x2f')]=_[_0x0917('0x32')](db['FreshsalesField'][_0x0917('0x2c')]);_0x43de8a['query']=_['keys'](_0x5d28dc['query']);_0x43de8a['filters']=_[_0x0917('0x34')](_0x43de8a['model'],_0x43de8a[_0x0917('0x31')]);_0xfeb054[_0x0917('0x35')]=_[_0x0917('0x34')](_0x43de8a[_0x0917('0x2f')],qs[_0x0917('0x36')](_0x5d28dc[_0x0917('0x31')]['fields']));_0xfeb054[_0x0917('0x35')]=_0xfeb054[_0x0917('0x35')][_0x0917('0x37')]?_0xfeb054[_0x0917('0x35')]:_0x43de8a[_0x0917('0x2f')];_0xfeb054[_0x0917('0x4b')]=qs['sort'](_0x5d28dc[_0x0917('0x31')]['sort']);_0xfeb054[_0x0917('0x3b')]=qs['filters'](_['pick'](_0x5d28dc['query'],_0x43de8a[_0x0917('0x33')]));if(_0x5d28dc['query'][_0x0917('0x3c')]){_0xfeb054[_0x0917('0x3b')]=_['merge'](_0xfeb054[_0x0917('0x3b')],{'$or':_['map'](_0xfeb054[_0x0917('0x35')],function(_0x2e2a5d){var _0x303025={};_0x303025[_0x2e2a5d]={'$like':'%'+_0x5d28dc[_0x0917('0x31')]['filter']+'%'};return _0x303025;})});}_0xfeb054=_[_0x0917('0x3d')]({},_0xfeb054,_0x5d28dc[_0x0917('0x3f')]);return _0x567751[_0x0917('0x4c')](_0xfeb054);}})[_0x0917('0x26')](function(_0x1cadf6){if(_0x1cadf6){_0x21620d=_0x1cadf6['length'];if(!_0x5d28dc[_0x0917('0x31')][_0x0917('0x38')](_0x0917('0x39'))){_0xfeb054[_0x0917('0x1f')]=qs[_0x0917('0x1f')](_0x5d28dc['query'][_0x0917('0x1f')]);_0xfeb054['offset']=qs[_0x0917('0x1d')](_0x5d28dc[_0x0917('0x31')][_0x0917('0x1d')]);}return _0x567751[_0x0917('0x4c')](_0xfeb054);}})['then'](function(_0x4ba552){if(_0x4ba552){return _0x4ba552?{'count':_0x21620d,'rows':_0x4ba552}:null;}})[_0x0917('0x26')](respondWithResult(_0x5d3988,null))[_0x0917('0x46')](handleError(_0x5d3988,null));};exports[_0x0917('0x4d')]=function(_0x310d8f,_0x2522f7,_0x2c5158){var _0x42b2c5={};var _0x4a3bd9={};var _0xc74688;var _0x1ae711;return db[_0x0917('0x41')][_0x0917('0x4a')]({'where':{'id':_0x310d8f[_0x0917('0x44')]['id']}})[_0x0917('0x26')](handleEntityNotFound(_0x2522f7,null))[_0x0917('0x26')](function(_0x54eb97){if(_0x54eb97){_0xc74688=_0x54eb97;_0x4a3bd9['model']=_[_0x0917('0x32')](db[_0x0917('0x4e')][_0x0917('0x2c')]);_0x4a3bd9[_0x0917('0x31')]=_[_0x0917('0x32')](_0x310d8f[_0x0917('0x31')]);_0x4a3bd9[_0x0917('0x33')]=_['intersection'](_0x4a3bd9[_0x0917('0x2f')],_0x4a3bd9[_0x0917('0x31')]);_0x42b2c5['attributes']=_[_0x0917('0x34')](_0x4a3bd9[_0x0917('0x2f')],qs['fields'](_0x310d8f[_0x0917('0x31')][_0x0917('0x36')]));_0x42b2c5[_0x0917('0x35')]=_0x42b2c5[_0x0917('0x35')][_0x0917('0x37')]?_0x42b2c5['attributes']:_0x4a3bd9['model'];_0x42b2c5[_0x0917('0x4b')]=qs['sort'](_0x310d8f[_0x0917('0x31')][_0x0917('0x3a')]);_0x42b2c5[_0x0917('0x3b')]=qs[_0x0917('0x33')](_[_0x0917('0x4f')](_0x310d8f[_0x0917('0x31')],_0x4a3bd9['filters']));if(_0x310d8f[_0x0917('0x31')][_0x0917('0x3c')]){_0x42b2c5[_0x0917('0x3b')]=_[_0x0917('0x3d')](_0x42b2c5[_0x0917('0x3b')],{'$or':_[_0x0917('0x30')](_0x42b2c5['attributes'],function(_0xd33ec8){var _0x577f7b={};_0x577f7b[_0xd33ec8]={'$like':'%'+_0x310d8f[_0x0917('0x31')][_0x0917('0x3c')]+'%'};return _0x577f7b;})});}_0x42b2c5=_[_0x0917('0x3d')]({},_0x42b2c5,_0x310d8f[_0x0917('0x3f')]);return _0xc74688['getDescriptions'](_0x42b2c5);}})[_0x0917('0x26')](function(_0x303ac1){if(_0x303ac1){_0x1ae711=_0x303ac1[_0x0917('0x37')];if(!_0x310d8f[_0x0917('0x31')][_0x0917('0x38')]('nolimit')){_0x42b2c5[_0x0917('0x1f')]=qs[_0x0917('0x1f')](_0x310d8f[_0x0917('0x31')][_0x0917('0x1f')]);_0x42b2c5[_0x0917('0x1d')]=qs[_0x0917('0x1d')](_0x310d8f[_0x0917('0x31')]['offset']);}return _0xc74688[_0x0917('0x4d')](_0x42b2c5);}})['then'](function(_0x10ce6f){if(_0x10ce6f){return _0x10ce6f?{'count':_0x1ae711,'rows':_0x10ce6f}:null;}})['then'](respondWithResult(_0x2522f7,null))[_0x0917('0x46')](handleError(_0x2522f7,null));};exports[_0x0917('0x50')]=function(_0x368129,_0x3f2f52,_0x55e285){var _0x41255c={};var _0x3b7154={};var _0x36c497;var _0x2f3145;return db[_0x0917('0x41')][_0x0917('0x4a')]({'where':{'id':_0x368129[_0x0917('0x44')]['id']}})[_0x0917('0x26')](handleEntityNotFound(_0x3f2f52,null))[_0x0917('0x26')](function(_0x5e1caa){if(_0x5e1caa){_0x36c497=_0x5e1caa;_0x3b7154[_0x0917('0x2f')]=_[_0x0917('0x32')](db[_0x0917('0x4e')][_0x0917('0x2c')]);_0x3b7154[_0x0917('0x31')]=_[_0x0917('0x32')](_0x368129[_0x0917('0x31')]);_0x3b7154[_0x0917('0x33')]=_[_0x0917('0x34')](_0x3b7154[_0x0917('0x2f')],_0x3b7154['query']);_0x41255c[_0x0917('0x35')]=_[_0x0917('0x34')](_0x3b7154[_0x0917('0x2f')],qs[_0x0917('0x36')](_0x368129['query'][_0x0917('0x36')]));_0x41255c[_0x0917('0x35')]=_0x41255c[_0x0917('0x35')][_0x0917('0x37')]?_0x41255c[_0x0917('0x35')]:_0x3b7154['model'];_0x41255c[_0x0917('0x4b')]=qs[_0x0917('0x3a')](_0x368129[_0x0917('0x31')][_0x0917('0x3a')]);_0x41255c[_0x0917('0x3b')]=qs[_0x0917('0x33')](_[_0x0917('0x4f')](_0x368129[_0x0917('0x31')],_0x3b7154[_0x0917('0x33')]));if(_0x368129[_0x0917('0x31')][_0x0917('0x3c')]){_0x41255c['where']=_[_0x0917('0x3d')](_0x41255c['where'],{'$or':_[_0x0917('0x30')](_0x41255c[_0x0917('0x35')],function(_0x4b8460){var _0x15dbef={};_0x15dbef[_0x4b8460]={'$like':'%'+_0x368129[_0x0917('0x31')][_0x0917('0x3c')]+'%'};return _0x15dbef;})});}_0x41255c=_[_0x0917('0x3d')]({},_0x41255c,_0x368129[_0x0917('0x3f')]);return _0x36c497[_0x0917('0x50')](_0x41255c);}})[_0x0917('0x26')](function(_0x5adf8a){if(_0x5adf8a){_0x2f3145=_0x5adf8a[_0x0917('0x37')];if(!_0x368129[_0x0917('0x31')][_0x0917('0x38')]('nolimit')){_0x41255c[_0x0917('0x1f')]=qs['limit'](_0x368129[_0x0917('0x31')][_0x0917('0x1f')]);_0x41255c[_0x0917('0x1d')]=qs[_0x0917('0x1d')](_0x368129[_0x0917('0x31')][_0x0917('0x1d')]);}return _0x36c497[_0x0917('0x50')](_0x41255c);}})[_0x0917('0x26')](function(_0x44c0d5){if(_0x44c0d5){return _0x44c0d5?{'count':_0x2f3145,'rows':_0x44c0d5}:null;}})[_0x0917('0x26')](respondWithResult(_0x3f2f52,null))[_0x0917('0x46')](handleError(_0x3f2f52,null));}; \ No newline at end of file +var _0x6c70=['save','destroy','then','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','catch','params','include','find','create','body','update','getSubjects','findOne','FreshsalesField','keys','order','options','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6c70,0xd0));var _0x06c7=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x6c70[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require(_0x06c7('0x0'));var rimraf=require(_0x06c7('0x1'));var zipdir=require(_0x06c7('0x2'));var jsonpatch=require(_0x06c7('0x3'));var rp=require('request-promise');var moment=require(_0x06c7('0x4'));var BPromise=require(_0x06c7('0x5'));var Mustache=require(_0x06c7('0x6'));var util=require(_0x06c7('0x7'));var path=require(_0x06c7('0x8'));var sox=require(_0x06c7('0x9'));var csv=require(_0x06c7('0xa'));var ejs=require(_0x06c7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06c7('0xc'));var squel=require(_0x06c7('0xd'));var crypto=require(_0x06c7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x06c7('0xa'));var querystring=require(_0x06c7('0xf'));var Papa=require(_0x06c7('0x10'));var Redis=require(_0x06c7('0x11'));var authService=require(_0x06c7('0x12'));var qs=require(_0x06c7('0x13'));var as=require(_0x06c7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06c7('0x15'));var utils=require(_0x06c7('0x16'));var config=require(_0x06c7('0x17'));var licenseUtil=require(_0x06c7('0x18'));var db=require(_0x06c7('0x19'))['db'];function respondWithStatusCode(_0x400b5b,_0x4ceabd){_0x4ceabd=_0x4ceabd||0xcc;return function(_0x569eac){if(_0x569eac){return _0x400b5b[_0x06c7('0x1a')](_0x4ceabd);}return _0x400b5b[_0x06c7('0x1b')](_0x4ceabd)[_0x06c7('0x1c')]();};}function respondWithResult(_0x1d65ea,_0x49b7ac){_0x49b7ac=_0x49b7ac||0xc8;return function(_0x5a581a){if(_0x5a581a){return _0x1d65ea[_0x06c7('0x1b')](_0x49b7ac)[_0x06c7('0x1d')](_0x5a581a);}};}function respondWithFilteredResult(_0x8ba8fa,_0x3deaff){return function(_0xe6c439){if(_0xe6c439){var _0x3d448b=typeof _0x3deaff[_0x06c7('0x1e')]===_0x06c7('0x1f')&&typeof _0x3deaff[_0x06c7('0x20')]===_0x06c7('0x1f');var _0x1a1033=_0xe6c439['count'];var _0x3baccf=_0x3d448b?0x0:_0x3deaff[_0x06c7('0x1e')];var _0x196efe=_0x3d448b?_0xe6c439[_0x06c7('0x21')]:_0x3deaff[_0x06c7('0x1e')]+_0x3deaff[_0x06c7('0x20')];var _0x3625c6;if(_0x196efe>=_0x1a1033){_0x196efe=_0x1a1033;_0x3625c6=0xc8;}else{_0x3625c6=0xce;}_0x8ba8fa[_0x06c7('0x1b')](_0x3625c6);return _0x8ba8fa[_0x06c7('0x22')](_0x06c7('0x23'),_0x3baccf+'-'+_0x196efe+'/'+_0x1a1033)[_0x06c7('0x1d')](_0xe6c439);}return null;};}function patchUpdates(_0x59b7f1){return function(_0x513ced){try{jsonpatch[_0x06c7('0x24')](_0x513ced,_0x59b7f1,!![]);}catch(_0x2a36b4){return BPromise[_0x06c7('0x25')](_0x2a36b4);}return _0x513ced[_0x06c7('0x26')]();};}function saveUpdates(_0x5abae9,_0x7dc943){return function(_0x53f3ec){if(_0x53f3ec){return _0x53f3ec['update'](_0x5abae9)['then'](function(_0x4bc3b7){return _0x4bc3b7;});}return null;};}function removeEntity(_0x111b2d,_0x30b8e5){return function(_0x26ed22){if(_0x26ed22){return _0x26ed22[_0x06c7('0x27')]()[_0x06c7('0x28')](function(){_0x111b2d[_0x06c7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de185,_0x5d52bf){return function(_0x3fb2e4){if(!_0x3fb2e4){_0x5de185[_0x06c7('0x1a')](0x194);}return _0x3fb2e4;};}function handleError(_0x5aaee4,_0x29b134){_0x29b134=_0x29b134||0x1f4;return function(_0x5f3d14){logger['error'](_0x5f3d14[_0x06c7('0x29')]);if(_0x5f3d14[_0x06c7('0x2a')]){delete _0x5f3d14[_0x06c7('0x2a')];}_0x5aaee4[_0x06c7('0x1b')](_0x29b134)[_0x06c7('0x2b')](_0x5f3d14);};}exports[_0x06c7('0x2c')]=function(_0x139f11,_0x471d54){var _0x524f4e={},_0x1fb203={},_0x46e345={'count':0x0,'rows':[]};var _0x42d922=_[_0x06c7('0x2d')](db[_0x06c7('0x2e')][_0x06c7('0x2f')],function(_0x15486e){return{'name':_0x15486e[_0x06c7('0x30')],'type':_0x15486e[_0x06c7('0x31')][_0x06c7('0x32')]};});_0x1fb203[_0x06c7('0x33')]=_[_0x06c7('0x2d')](_0x42d922,_0x06c7('0x2a'));_0x1fb203[_0x06c7('0x34')]=_['keys'](_0x139f11[_0x06c7('0x34')]);_0x1fb203[_0x06c7('0x35')]=_[_0x06c7('0x36')](_0x1fb203['model'],_0x1fb203[_0x06c7('0x34')]);_0x524f4e['attributes']=_['intersection'](_0x1fb203[_0x06c7('0x33')],qs[_0x06c7('0x37')](_0x139f11[_0x06c7('0x34')]['fields']));_0x524f4e[_0x06c7('0x38')]=_0x524f4e['attributes'][_0x06c7('0x39')]?_0x524f4e['attributes']:_0x1fb203[_0x06c7('0x33')];if(!_0x139f11[_0x06c7('0x34')][_0x06c7('0x3a')](_0x06c7('0x3b'))){_0x524f4e['limit']=qs[_0x06c7('0x20')](_0x139f11[_0x06c7('0x34')][_0x06c7('0x20')]);_0x524f4e['offset']=qs['offset'](_0x139f11[_0x06c7('0x34')]['offset']);}_0x524f4e['order']=qs['sort'](_0x139f11[_0x06c7('0x34')][_0x06c7('0x3c')]);_0x524f4e[_0x06c7('0x3d')]=qs[_0x06c7('0x35')](_[_0x06c7('0x3e')](_0x139f11['query'],_0x1fb203['filters']),_0x42d922);if(_0x139f11[_0x06c7('0x34')][_0x06c7('0x3f')]){_0x524f4e[_0x06c7('0x3d')]=_[_0x06c7('0x40')](_0x524f4e[_0x06c7('0x3d')],{'$or':_[_0x06c7('0x2d')](_0x42d922,function(_0x496f23){if(_0x496f23['type']!=='VIRTUAL'){var _0x5954b6={};_0x5954b6[_0x496f23[_0x06c7('0x2a')]]={'$like':'%'+_0x139f11[_0x06c7('0x34')]['filter']+'%'};return _0x5954b6;}})});}_0x524f4e=_[_0x06c7('0x40')]({},_0x524f4e,_0x139f11['options']);var _0xfa0aff={'where':_0x524f4e[_0x06c7('0x3d')]};return db[_0x06c7('0x2e')][_0x06c7('0x21')](_0xfa0aff)[_0x06c7('0x28')](function(_0x5c0813){_0x46e345[_0x06c7('0x21')]=_0x5c0813;if(_0x139f11[_0x06c7('0x34')][_0x06c7('0x41')]){_0x524f4e['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x06c7('0x42')](_0x524f4e);})['then'](function(_0x381392){_0x46e345['rows']=_0x381392;return _0x46e345;})['then'](respondWithFilteredResult(_0x471d54,_0x524f4e))[_0x06c7('0x43')](handleError(_0x471d54,null));};exports['show']=function(_0x20f64a,_0x14f220){var _0x36ce0c={'raw':![],'where':{'id':_0x20f64a[_0x06c7('0x44')]['id']}},_0x1f6151={};_0x1f6151[_0x06c7('0x33')]=_['keys'](db['FreshsalesConfiguration'][_0x06c7('0x2f')]);_0x1f6151[_0x06c7('0x34')]=_['keys'](_0x20f64a[_0x06c7('0x34')]);_0x1f6151[_0x06c7('0x35')]=_[_0x06c7('0x36')](_0x1f6151['model'],_0x1f6151[_0x06c7('0x34')]);_0x36ce0c[_0x06c7('0x38')]=_[_0x06c7('0x36')](_0x1f6151[_0x06c7('0x33')],qs[_0x06c7('0x37')](_0x20f64a[_0x06c7('0x34')][_0x06c7('0x37')]));_0x36ce0c[_0x06c7('0x38')]=_0x36ce0c[_0x06c7('0x38')][_0x06c7('0x39')]?_0x36ce0c[_0x06c7('0x38')]:_0x1f6151[_0x06c7('0x33')];if(_0x20f64a[_0x06c7('0x34')][_0x06c7('0x41')]){_0x36ce0c[_0x06c7('0x45')]=[{'all':!![]}];}_0x36ce0c=_[_0x06c7('0x40')]({},_0x36ce0c,_0x20f64a['options']);return db['FreshsalesConfiguration'][_0x06c7('0x46')](_0x36ce0c)[_0x06c7('0x28')](handleEntityNotFound(_0x14f220,null))['then'](respondWithResult(_0x14f220,null))[_0x06c7('0x43')](handleError(_0x14f220,null));};exports[_0x06c7('0x47')]=function(_0x5b4529,_0x2f3b9e){return db[_0x06c7('0x2e')][_0x06c7('0x47')](_0x5b4529[_0x06c7('0x48')],{})[_0x06c7('0x28')](respondWithResult(_0x2f3b9e,0xc9))[_0x06c7('0x43')](handleError(_0x2f3b9e,null));};exports[_0x06c7('0x49')]=function(_0x5b7642,_0x3f2a84){if(_0x5b7642[_0x06c7('0x48')]['id']){delete _0x5b7642[_0x06c7('0x48')]['id'];}return db[_0x06c7('0x2e')][_0x06c7('0x46')]({'where':{'id':_0x5b7642[_0x06c7('0x44')]['id']}})[_0x06c7('0x28')](handleEntityNotFound(_0x3f2a84,null))[_0x06c7('0x28')](saveUpdates(_0x5b7642['body'],null))[_0x06c7('0x28')](respondWithResult(_0x3f2a84,null))['catch'](handleError(_0x3f2a84,null));};exports[_0x06c7('0x27')]=function(_0x26717a,_0x5c9c2b){return db['FreshsalesConfiguration'][_0x06c7('0x46')]({'where':{'id':_0x26717a[_0x06c7('0x44')]['id']}})[_0x06c7('0x28')](handleEntityNotFound(_0x5c9c2b,null))['then'](removeEntity(_0x5c9c2b,null))[_0x06c7('0x43')](handleError(_0x5c9c2b,null));};exports[_0x06c7('0x4a')]=function(_0x19752b,_0x273258,_0x7acb08){var _0x258f79={};var _0x25522e={};var _0x1893d8;var _0xc5ad2e;return db['FreshsalesConfiguration'][_0x06c7('0x4b')]({'where':{'id':_0x19752b[_0x06c7('0x44')]['id']}})[_0x06c7('0x28')](handleEntityNotFound(_0x273258,null))[_0x06c7('0x28')](function(_0x211c6d){if(_0x211c6d){_0x1893d8=_0x211c6d;_0x25522e[_0x06c7('0x33')]=_['keys'](db[_0x06c7('0x4c')][_0x06c7('0x2f')]);_0x25522e[_0x06c7('0x34')]=_[_0x06c7('0x4d')](_0x19752b[_0x06c7('0x34')]);_0x25522e['filters']=_[_0x06c7('0x36')](_0x25522e[_0x06c7('0x33')],_0x25522e[_0x06c7('0x34')]);_0x258f79['attributes']=_[_0x06c7('0x36')](_0x25522e['model'],qs['fields'](_0x19752b[_0x06c7('0x34')]['fields']));_0x258f79[_0x06c7('0x38')]=_0x258f79['attributes'][_0x06c7('0x39')]?_0x258f79['attributes']:_0x25522e[_0x06c7('0x33')];_0x258f79[_0x06c7('0x4e')]=qs['sort'](_0x19752b['query'][_0x06c7('0x3c')]);_0x258f79[_0x06c7('0x3d')]=qs[_0x06c7('0x35')](_[_0x06c7('0x3e')](_0x19752b[_0x06c7('0x34')],_0x25522e[_0x06c7('0x35')]));if(_0x19752b[_0x06c7('0x34')][_0x06c7('0x3f')]){_0x258f79[_0x06c7('0x3d')]=_[_0x06c7('0x40')](_0x258f79['where'],{'$or':_['map'](_0x258f79[_0x06c7('0x38')],function(_0x3fbfab){var _0xd5b925={};_0xd5b925[_0x3fbfab]={'$like':'%'+_0x19752b['query'][_0x06c7('0x3f')]+'%'};return _0xd5b925;})});}_0x258f79=_[_0x06c7('0x40')]({},_0x258f79,_0x19752b[_0x06c7('0x4f')]);return _0x1893d8['getSubjects'](_0x258f79);}})[_0x06c7('0x28')](function(_0x122e25){if(_0x122e25){_0xc5ad2e=_0x122e25[_0x06c7('0x39')];if(!_0x19752b[_0x06c7('0x34')][_0x06c7('0x3a')]('nolimit')){_0x258f79[_0x06c7('0x20')]=qs[_0x06c7('0x20')](_0x19752b[_0x06c7('0x34')]['limit']);_0x258f79[_0x06c7('0x1e')]=qs[_0x06c7('0x1e')](_0x19752b[_0x06c7('0x34')][_0x06c7('0x1e')]);}return _0x1893d8['getSubjects'](_0x258f79);}})[_0x06c7('0x28')](function(_0x38217e){if(_0x38217e){return _0x38217e?{'count':_0xc5ad2e,'rows':_0x38217e}:null;}})[_0x06c7('0x28')](respondWithResult(_0x273258,null))['catch'](handleError(_0x273258,null));};exports[_0x06c7('0x50')]=function(_0x40702a,_0x3d2a06,_0x574df4){var _0x8ea7c5={};var _0x5b2963={};var _0x50ac3d;var _0x20770b;return db[_0x06c7('0x2e')]['findOne']({'where':{'id':_0x40702a[_0x06c7('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d2a06,null))[_0x06c7('0x28')](function(_0x2957d7){if(_0x2957d7){_0x50ac3d=_0x2957d7;_0x5b2963[_0x06c7('0x33')]=_['keys'](db[_0x06c7('0x4c')][_0x06c7('0x2f')]);_0x5b2963[_0x06c7('0x34')]=_[_0x06c7('0x4d')](_0x40702a['query']);_0x5b2963[_0x06c7('0x35')]=_['intersection'](_0x5b2963[_0x06c7('0x33')],_0x5b2963[_0x06c7('0x34')]);_0x8ea7c5[_0x06c7('0x38')]=_['intersection'](_0x5b2963[_0x06c7('0x33')],qs[_0x06c7('0x37')](_0x40702a[_0x06c7('0x34')][_0x06c7('0x37')]));_0x8ea7c5['attributes']=_0x8ea7c5['attributes'][_0x06c7('0x39')]?_0x8ea7c5[_0x06c7('0x38')]:_0x5b2963[_0x06c7('0x33')];_0x8ea7c5['order']=qs['sort'](_0x40702a[_0x06c7('0x34')][_0x06c7('0x3c')]);_0x8ea7c5[_0x06c7('0x3d')]=qs[_0x06c7('0x35')](_[_0x06c7('0x3e')](_0x40702a[_0x06c7('0x34')],_0x5b2963['filters']));if(_0x40702a[_0x06c7('0x34')][_0x06c7('0x3f')]){_0x8ea7c5[_0x06c7('0x3d')]=_['merge'](_0x8ea7c5[_0x06c7('0x3d')],{'$or':_[_0x06c7('0x2d')](_0x8ea7c5[_0x06c7('0x38')],function(_0x1b9be7){var _0x249a1a={};_0x249a1a[_0x1b9be7]={'$like':'%'+_0x40702a['query'][_0x06c7('0x3f')]+'%'};return _0x249a1a;})});}_0x8ea7c5=_[_0x06c7('0x40')]({},_0x8ea7c5,_0x40702a[_0x06c7('0x4f')]);return _0x50ac3d['getDescriptions'](_0x8ea7c5);}})[_0x06c7('0x28')](function(_0x517e9a){if(_0x517e9a){_0x20770b=_0x517e9a[_0x06c7('0x39')];if(!_0x40702a[_0x06c7('0x34')][_0x06c7('0x3a')](_0x06c7('0x3b'))){_0x8ea7c5['limit']=qs['limit'](_0x40702a[_0x06c7('0x34')]['limit']);_0x8ea7c5[_0x06c7('0x1e')]=qs[_0x06c7('0x1e')](_0x40702a[_0x06c7('0x34')][_0x06c7('0x1e')]);}return _0x50ac3d[_0x06c7('0x50')](_0x8ea7c5);}})[_0x06c7('0x28')](function(_0x88f062){if(_0x88f062){return _0x88f062?{'count':_0x20770b,'rows':_0x88f062}:null;}})[_0x06c7('0x28')](respondWithResult(_0x3d2a06,null))['catch'](handleError(_0x3d2a06,null));};exports[_0x06c7('0x51')]=function(_0x7f3b95,_0x21d8ec,_0x453216){var _0x4293b7={};var _0x145d9b={};var _0x21e0a0;var _0x35ddef;return db[_0x06c7('0x2e')]['findOne']({'where':{'id':_0x7f3b95['params']['id']}})['then'](handleEntityNotFound(_0x21d8ec,null))[_0x06c7('0x28')](function(_0x4791a3){if(_0x4791a3){_0x21e0a0=_0x4791a3;_0x145d9b[_0x06c7('0x33')]=_[_0x06c7('0x4d')](db[_0x06c7('0x4c')][_0x06c7('0x2f')]);_0x145d9b[_0x06c7('0x34')]=_['keys'](_0x7f3b95['query']);_0x145d9b[_0x06c7('0x35')]=_[_0x06c7('0x36')](_0x145d9b[_0x06c7('0x33')],_0x145d9b['query']);_0x4293b7[_0x06c7('0x38')]=_['intersection'](_0x145d9b[_0x06c7('0x33')],qs['fields'](_0x7f3b95[_0x06c7('0x34')][_0x06c7('0x37')]));_0x4293b7[_0x06c7('0x38')]=_0x4293b7['attributes'][_0x06c7('0x39')]?_0x4293b7[_0x06c7('0x38')]:_0x145d9b['model'];_0x4293b7[_0x06c7('0x4e')]=qs[_0x06c7('0x3c')](_0x7f3b95['query'][_0x06c7('0x3c')]);_0x4293b7['where']=qs[_0x06c7('0x35')](_[_0x06c7('0x3e')](_0x7f3b95['query'],_0x145d9b['filters']));if(_0x7f3b95[_0x06c7('0x34')]['filter']){_0x4293b7[_0x06c7('0x3d')]=_[_0x06c7('0x40')](_0x4293b7[_0x06c7('0x3d')],{'$or':_[_0x06c7('0x2d')](_0x4293b7[_0x06c7('0x38')],function(_0x5d7034){var _0x128fbb={};_0x128fbb[_0x5d7034]={'$like':'%'+_0x7f3b95[_0x06c7('0x34')][_0x06c7('0x3f')]+'%'};return _0x128fbb;})});}_0x4293b7=_[_0x06c7('0x40')]({},_0x4293b7,_0x7f3b95['options']);return _0x21e0a0[_0x06c7('0x51')](_0x4293b7);}})['then'](function(_0x2a6e42){if(_0x2a6e42){_0x35ddef=_0x2a6e42[_0x06c7('0x39')];if(!_0x7f3b95[_0x06c7('0x34')]['hasOwnProperty'](_0x06c7('0x3b'))){_0x4293b7[_0x06c7('0x20')]=qs[_0x06c7('0x20')](_0x7f3b95[_0x06c7('0x34')][_0x06c7('0x20')]);_0x4293b7[_0x06c7('0x1e')]=qs[_0x06c7('0x1e')](_0x7f3b95[_0x06c7('0x34')][_0x06c7('0x1e')]);}return _0x21e0a0[_0x06c7('0x51')](_0x4293b7);}})[_0x06c7('0x28')](function(_0x3a442d){if(_0x3a442d){return _0x3a442d?{'count':_0x35ddef,'rows':_0x3a442d}:null;}})[_0x06c7('0x28')](respondWithResult(_0x21d8ec,null))[_0x06c7('0x43')](handleError(_0x21d8ec,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 16e4d0f..92c097c 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 _0x1373=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1373,0xa2));var _0x3137=function(_0x3cc940,_0x5a7527){_0x3cc940=_0x3cc940-0x0;var _0x4f4ee1=_0x1373[_0x3cc940];return _0x4f4ee1;};'use strict';var _=require(_0x3137('0x0'));var util=require(_0x3137('0x1'));var logger=require(_0x3137('0x2'))(_0x3137('0x3'));var moment=require(_0x3137('0x4'));var BPromise=require(_0x3137('0x5'));var rp=require(_0x3137('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3137('0x7'));var config=require(_0x3137('0x8'));var attributes=require(_0x3137('0x9'));module['exports']=function(_0x1c4663,_0x2833aa){return _0x1c4663[_0x3137('0xa')](_0x3137('0xb'),attributes,{'tableName':_0x3137('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x083b=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x378f87,_0x141e0e){var _0x73970=function(_0x455c10){while(--_0x455c10){_0x378f87['push'](_0x378f87['shift']());}};_0x73970(++_0x141e0e);}(_0x083b,0x8e));var _0xb083=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x083b[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xb083('0x0'));var util=require(_0xb083('0x1'));var logger=require(_0xb083('0x2'))(_0xb083('0x3'));var moment=require(_0xb083('0x4'));var BPromise=require(_0xb083('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb083('0x6'));var config=require(_0xb083('0x7'));var attributes=require(_0xb083('0x8'));module[_0xb083('0x9')]=function(_0x35b8fd,_0x289f36){return _0x35b8fd[_0xb083('0xa')](_0xb083('0xb'),attributes,{'tableName':_0xb083('0xc'),'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 100b2c9..49db201 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 _0x10a6=['request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x10a6,0x11b));var _0x610a=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x10a6[_0x34bc6c];return _0x168820;};'use strict';var _=require(_0x610a('0x0'));var util=require(_0x610a('0x1'));var moment=require(_0x610a('0x2'));var BPromise=require(_0x610a('0x3'));var rs=require(_0x610a('0x4'));var fs=require('fs');var Redis=require(_0x610a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x610a('0x6'));var logger=require(_0x610a('0x7'))(_0x610a('0x8'));var config=require(_0x610a('0x9'));var jayson=require(_0x610a('0xa'));var client=jayson['client'][_0x610a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x488f0c,_0x4fa0f7,_0x305902){return new BPromise(function(_0x4cb75c,_0x1c7335){return client[_0x610a('0xc')](_0x488f0c,_0x305902)[_0x610a('0xd')](function(_0x3674a3){logger[_0x610a('0xe')](_0x610a('0xf'),_0x4fa0f7,_0x610a('0x10'));logger['debug'](_0x610a('0x11'),_0x4fa0f7,_0x610a('0x10'),JSON[_0x610a('0x12')](_0x3674a3));if(_0x3674a3[_0x610a('0x13')]){if(_0x3674a3[_0x610a('0x13')][_0x610a('0x14')]===0x1f4){logger[_0x610a('0x13')](_0x610a('0xf'),_0x4fa0f7,_0x3674a3['error'][_0x610a('0x15')]);return _0x1c7335(_0x3674a3[_0x610a('0x13')][_0x610a('0x15')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4fa0f7,_0x3674a3['error'][_0x610a('0x15')]);return _0x4cb75c(_0x3674a3[_0x610a('0x13')][_0x610a('0x15')]);}else{logger[_0x610a('0xe')](_0x610a('0xf'),_0x4fa0f7,_0x610a('0x10'));_0x4cb75c(_0x3674a3[_0x610a('0x16')][_0x610a('0x15')]);}})['catch'](function(_0x18c983){logger[_0x610a('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4fa0f7,_0x18c983);_0x1c7335(_0x18c983);});});} \ No newline at end of file +var _0x33bf=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3b6f56,_0x4403e7){var _0x5e1556=function(_0x2ceb89){while(--_0x2ceb89){_0x3b6f56['push'](_0x3b6f56['shift']());}};_0x5e1556(++_0x4403e7);}(_0x33bf,0xf0));var _0xf33b=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x33bf[_0x442f02];return _0xab6ef1;};'use strict';var _=require('lodash');var util=require(_0xf33b('0x0'));var moment=require(_0xf33b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf33b('0x2'))['db'];var utils=require(_0xf33b('0x3'));var logger=require(_0xf33b('0x4'))(_0xf33b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf33b('0x6')][_0xf33b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50044c,_0x228daf,_0x437c00){return new BPromise(function(_0x27a140,_0xa4634e){return client[_0xf33b('0x8')](_0x50044c,_0x437c00)[_0xf33b('0x9')](function(_0x3571ae){logger['info'](_0xf33b('0xa'),_0x228daf,_0xf33b('0xb'));logger[_0xf33b('0xc')](_0xf33b('0xd'),_0x228daf,_0xf33b('0xb'),JSON[_0xf33b('0xe')](_0x3571ae));if(_0x3571ae[_0xf33b('0xf')]){if(_0x3571ae['error'][_0xf33b('0x10')]===0x1f4){logger[_0xf33b('0xf')](_0xf33b('0xa'),_0x228daf,_0x3571ae[_0xf33b('0xf')][_0xf33b('0x11')]);return _0xa4634e(_0x3571ae['error'][_0xf33b('0x11')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x228daf,_0x3571ae['error']['message']);return _0x27a140(_0x3571ae['error'][_0xf33b('0x11')]);}else{logger['info'](_0xf33b('0xa'),_0x228daf,_0xf33b('0xb'));_0x27a140(_0x3571ae[_0xf33b('0x12')][_0xf33b('0x11')]);}})[_0xf33b('0x13')](function(_0x325a2b){logger[_0xf33b('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x228daf,_0x325a2b);_0xa4634e(_0x325a2b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3c589b8..827ba22 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 _0xb32d=['../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x54950d,_0x48b6df){var _0x1a72df=function(_0xc98091){while(--_0xc98091){_0x54950d['push'](_0x54950d['shift']());}};_0x1a72df(++_0x48b6df);}(_0xb32d,0x1da));var _0xdb32=function(_0x5279cb,_0x1601be){_0x5279cb=_0x5279cb-0x0;var _0x55785a=_0xb32d[_0x5279cb];return _0x55785a;};'use strict';var multer=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var path=require(_0xdb32('0x2'));var timeout=require(_0xdb32('0x3'));var express=require(_0xdb32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb32('0x5'));var interaction=require(_0xdb32('0x6'));var config=require('../../config/environment');var controller=require(_0xdb32('0x7'));router[_0xdb32('0x8')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xa')]);router[_0xdb32('0x8')](_0xdb32('0xb'),auth['isAuthenticated'](),controller[_0xdb32('0xc')]);router[_0xdb32('0xd')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xe')]);router[_0xdb32('0xf')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x10')]);router[_0xdb32('0x11')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x12')]);module[_0xdb32('0x13')]=router; \ No newline at end of file +var _0xdace=['show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xdace,0xc5));var _0xedac=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xdace[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['post']('/',auth[_0xedac('0x9')](),controller[_0xedac('0xd')]);router[_0xedac('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);module[_0xedac('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 1911317..fc64b45 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 _0x2587=['picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','string','keyValue'];(function(_0x5c9be5,_0x2a9ab7){var _0x217dbe=function(_0x37b9a6){while(--_0x37b9a6){_0x5c9be5['push'](_0x5c9be5['shift']());}};_0x217dbe(++_0x2a9ab7);}(_0x2587,0x11c));var _0x7258=function(_0x4a4563,_0x2771c3){_0x4a4563=_0x4a4563-0x0;var _0x201be1=_0x2587[_0x4a4563];return _0x201be1;};'use strict';var Sequelize=require(_0x7258('0x0'));module[_0x7258('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7258('0x2'),'variable','customVariable',_0x7258('0x3'),_0x7258('0x4')),'defaultValue':_0x7258('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7258('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7258('0x6'),_0x7258('0x7'))},'keyContent':{'type':Sequelize[_0x7258('0x5')]},'idField':{'type':Sequelize[_0x7258('0x5')]},'nameField':{'type':Sequelize[_0x7258('0x5')]},'customField':{'type':Sequelize[_0x7258('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7258('0x5')]}}; \ No newline at end of file +var _0x7cdf=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x46884f,_0x2b5c5a){var _0x78c6c0=function(_0x43ba0a){while(--_0x43ba0a){_0x46884f['push'](_0x46884f['shift']());}};_0x78c6c0(++_0x2b5c5a);}(_0x7cdf,0x16a));var _0xf7cd=function(_0x3cf19c,_0x1e249f){_0x3cf19c=_0x3cf19c-0x0;var _0x5a9eb8=_0x7cdf[_0x3cf19c];return _0x5a9eb8;};'use strict';var Sequelize=require(_0xf7cd('0x0'));module[_0xf7cd('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf7cd('0x2'),_0xf7cd('0x3'),_0xf7cd('0x4'),_0xf7cd('0x5'),_0xf7cd('0x6')),'defaultValue':_0xf7cd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf7cd('0x7')]},'keyType':{'type':Sequelize[_0xf7cd('0x8')]('string',_0xf7cd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf7cd('0x7')]},'idField':{'type':Sequelize[_0xf7cd('0x7')]},'nameField':{'type':Sequelize[_0xf7cd('0x7')]},'customField':{'type':Sequelize[_0xf7cd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 32c46e2..77e06e0 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 _0xae33=['keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xae33,0x172));var _0x3ae3=function(_0x509a00,_0x499b54){_0x509a00=_0x509a00-0x0;var _0x816c21=_0xae33[_0x509a00];return _0x816c21;};'use strict';var emlformat=require(_0x3ae3('0x0'));var rimraf=require(_0x3ae3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3ae3('0x2'));var moment=require(_0x3ae3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ae3('0x4'));var util=require('util');var path=require(_0x3ae3('0x5'));var sox=require(_0x3ae3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ae3('0x7'));var _=require(_0x3ae3('0x8'));var squel=require(_0x3ae3('0x9'));var crypto=require(_0x3ae3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3ae3('0xb'));var toCsv=require(_0x3ae3('0xc'));var querystring=require('querystring');var Papa=require(_0x3ae3('0xd'));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(_0x3ae3('0xe'));var logger=require(_0x3ae3('0xf'))('api');var utils=require(_0x3ae3('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x3ae3('0x11'));var db=require(_0x3ae3('0x12'))['db'];function respondWithStatusCode(_0x3be576,_0xf1b7bf){_0xf1b7bf=_0xf1b7bf||0xcc;return function(_0x133e52){if(_0x133e52){return _0x3be576[_0x3ae3('0x13')](_0xf1b7bf);}return _0x3be576['status'](_0xf1b7bf)[_0x3ae3('0x14')]();};}function respondWithResult(_0x2b756d,_0x3f973f){_0x3f973f=_0x3f973f||0xc8;return function(_0x217631){if(_0x217631){return _0x2b756d[_0x3ae3('0x15')](_0x3f973f)['json'](_0x217631);}};}function respondWithFilteredResult(_0x40fb54,_0x37d7a4){return function(_0x551c41){if(_0x551c41){var _0x537729=typeof _0x37d7a4[_0x3ae3('0x16')]===_0x3ae3('0x17')&&typeof _0x37d7a4[_0x3ae3('0x18')]===_0x3ae3('0x17');var _0x518786=_0x551c41[_0x3ae3('0x19')];var _0x241228=_0x537729?0x0:_0x37d7a4[_0x3ae3('0x16')];var _0x2d130b=_0x537729?_0x551c41[_0x3ae3('0x19')]:_0x37d7a4[_0x3ae3('0x16')]+_0x37d7a4[_0x3ae3('0x18')];var _0x278cab;if(_0x2d130b>=_0x518786){_0x2d130b=_0x518786;_0x278cab=0xc8;}else{_0x278cab=0xce;}_0x40fb54[_0x3ae3('0x15')](_0x278cab);return _0x40fb54[_0x3ae3('0x1a')](_0x3ae3('0x1b'),_0x241228+'-'+_0x2d130b+'/'+_0x518786)[_0x3ae3('0x1c')](_0x551c41);}return null;};}function patchUpdates(_0x3e2c8b){return function(_0xebdc81){try{jsonpatch[_0x3ae3('0x1d')](_0xebdc81,_0x3e2c8b,!![]);}catch(_0x1032bb){return BPromise['reject'](_0x1032bb);}return _0xebdc81[_0x3ae3('0x1e')]();};}function saveUpdates(_0x187d87,_0x40af93){return function(_0x1613e4){if(_0x1613e4){return _0x1613e4[_0x3ae3('0x1f')](_0x187d87)[_0x3ae3('0x20')](function(_0xf0dc07){return _0xf0dc07;});}return null;};}function removeEntity(_0x2dc275,_0x4912c1){return function(_0x448a34){if(_0x448a34){return _0x448a34[_0x3ae3('0x21')]()[_0x3ae3('0x20')](function(){_0x2dc275[_0x3ae3('0x15')](0xcc)[_0x3ae3('0x14')]();});}};}function handleEntityNotFound(_0x239b7c,_0x344c73){return function(_0x2b9f19){if(!_0x2b9f19){_0x239b7c['sendStatus'](0x194);}return _0x2b9f19;};}function handleError(_0x285997,_0x2a2d98){_0x2a2d98=_0x2a2d98||0x1f4;return function(_0x12ed7a){logger[_0x3ae3('0x22')](_0x12ed7a['stack']);if(_0x12ed7a[_0x3ae3('0x23')]){delete _0x12ed7a[_0x3ae3('0x23')];}_0x285997[_0x3ae3('0x15')](_0x2a2d98)[_0x3ae3('0x24')](_0x12ed7a);};}exports['index']=function(_0x34f7b0,_0x35b9f7){var _0x2a9f4b={},_0x42fb48={},_0x182ad1={'count':0x0,'rows':[]};var _0x5310e3=_[_0x3ae3('0x25')](db[_0x3ae3('0x26')][_0x3ae3('0x27')],function(_0x189522){return{'name':_0x189522[_0x3ae3('0x28')],'type':_0x189522[_0x3ae3('0x29')][_0x3ae3('0x2a')]};});_0x42fb48[_0x3ae3('0x2b')]=_[_0x3ae3('0x25')](_0x5310e3,_0x3ae3('0x23'));_0x42fb48['query']=_[_0x3ae3('0x2c')](_0x34f7b0[_0x3ae3('0x2d')]);_0x42fb48['filters']=_[_0x3ae3('0x2e')](_0x42fb48[_0x3ae3('0x2b')],_0x42fb48[_0x3ae3('0x2d')]);_0x2a9f4b['attributes']=_['intersection'](_0x42fb48[_0x3ae3('0x2b')],qs[_0x3ae3('0x2f')](_0x34f7b0['query'][_0x3ae3('0x2f')]));_0x2a9f4b['attributes']=_0x2a9f4b[_0x3ae3('0x30')][_0x3ae3('0x31')]?_0x2a9f4b[_0x3ae3('0x30')]:_0x42fb48['model'];if(!_0x34f7b0[_0x3ae3('0x2d')]['hasOwnProperty'](_0x3ae3('0x32'))){_0x2a9f4b[_0x3ae3('0x18')]=qs[_0x3ae3('0x18')](_0x34f7b0[_0x3ae3('0x2d')][_0x3ae3('0x18')]);_0x2a9f4b[_0x3ae3('0x16')]=qs['offset'](_0x34f7b0[_0x3ae3('0x2d')]['offset']);}_0x2a9f4b[_0x3ae3('0x33')]=qs[_0x3ae3('0x34')](_0x34f7b0[_0x3ae3('0x2d')][_0x3ae3('0x34')]);_0x2a9f4b[_0x3ae3('0x35')]=qs[_0x3ae3('0x36')](_[_0x3ae3('0x37')](_0x34f7b0['query'],_0x42fb48['filters']),_0x5310e3);if(_0x34f7b0['query']['filter']){_0x2a9f4b[_0x3ae3('0x35')]=_[_0x3ae3('0x38')](_0x2a9f4b[_0x3ae3('0x35')],{'$or':_[_0x3ae3('0x25')](_0x5310e3,function(_0x494261){if(_0x494261[_0x3ae3('0x29')]!==_0x3ae3('0x39')){var _0x578273={};_0x578273[_0x494261[_0x3ae3('0x23')]]={'$like':'%'+_0x34f7b0['query']['filter']+'%'};return _0x578273;}})});}_0x2a9f4b=_['merge']({},_0x2a9f4b,_0x34f7b0[_0x3ae3('0x3a')]);var _0x20a5ed={'where':_0x2a9f4b[_0x3ae3('0x35')]};return db[_0x3ae3('0x26')][_0x3ae3('0x19')](_0x20a5ed)[_0x3ae3('0x20')](function(_0x3e67ce){_0x182ad1[_0x3ae3('0x19')]=_0x3e67ce;if(_0x34f7b0[_0x3ae3('0x2d')][_0x3ae3('0x3b')]){_0x2a9f4b[_0x3ae3('0x3c')]=[{'all':!![]}];}return db[_0x3ae3('0x26')][_0x3ae3('0x3d')](_0x2a9f4b);})[_0x3ae3('0x20')](function(_0x2837e8){_0x182ad1[_0x3ae3('0x3e')]=_0x2837e8;return _0x182ad1;})[_0x3ae3('0x20')](respondWithFilteredResult(_0x35b9f7,_0x2a9f4b))[_0x3ae3('0x3f')](handleError(_0x35b9f7,null));};exports[_0x3ae3('0x40')]=function(_0xd1477d,_0x2a080d){var _0x3e0dca={'raw':!![],'where':{'id':_0xd1477d[_0x3ae3('0x41')]['id']}},_0x2c490f={};_0x2c490f[_0x3ae3('0x2b')]=_[_0x3ae3('0x2c')](db[_0x3ae3('0x26')][_0x3ae3('0x27')]);_0x2c490f[_0x3ae3('0x2d')]=_['keys'](_0xd1477d[_0x3ae3('0x2d')]);_0x2c490f[_0x3ae3('0x36')]=_[_0x3ae3('0x2e')](_0x2c490f[_0x3ae3('0x2b')],_0x2c490f[_0x3ae3('0x2d')]);_0x3e0dca[_0x3ae3('0x30')]=_[_0x3ae3('0x2e')](_0x2c490f['model'],qs[_0x3ae3('0x2f')](_0xd1477d[_0x3ae3('0x2d')][_0x3ae3('0x2f')]));_0x3e0dca['attributes']=_0x3e0dca[_0x3ae3('0x30')][_0x3ae3('0x31')]?_0x3e0dca['attributes']:_0x2c490f['model'];if(_0xd1477d['query'][_0x3ae3('0x3b')]){_0x3e0dca[_0x3ae3('0x3c')]=[{'all':!![]}];}_0x3e0dca=_[_0x3ae3('0x38')]({},_0x3e0dca,_0xd1477d[_0x3ae3('0x3a')]);return db['FreshsalesField'][_0x3ae3('0x42')](_0x3e0dca)[_0x3ae3('0x20')](handleEntityNotFound(_0x2a080d,null))[_0x3ae3('0x20')](respondWithResult(_0x2a080d,null))[_0x3ae3('0x3f')](handleError(_0x2a080d,null));};exports[_0x3ae3('0x43')]=function(_0x2fadc8,_0x352fbe){return db[_0x3ae3('0x26')]['create'](_0x2fadc8['body'],{})[_0x3ae3('0x20')](respondWithResult(_0x352fbe,0xc9))[_0x3ae3('0x3f')](handleError(_0x352fbe,null));};exports[_0x3ae3('0x1f')]=function(_0x467a63,_0x2fe44f){if(_0x467a63['body']['id']){delete _0x467a63['body']['id'];}return db['FreshsalesField'][_0x3ae3('0x42')]({'where':{'id':_0x467a63[_0x3ae3('0x41')]['id']}})[_0x3ae3('0x20')](handleEntityNotFound(_0x2fe44f,null))[_0x3ae3('0x20')](saveUpdates(_0x467a63[_0x3ae3('0x44')],null))[_0x3ae3('0x20')](respondWithResult(_0x2fe44f,null))[_0x3ae3('0x3f')](handleError(_0x2fe44f,null));};exports['destroy']=function(_0x442663,_0x2375e8){return db[_0x3ae3('0x26')]['find']({'where':{'id':_0x442663[_0x3ae3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2375e8,null))[_0x3ae3('0x20')](removeEntity(_0x2375e8,null))[_0x3ae3('0x3f')](handleError(_0x2375e8,null));}; \ No newline at end of file +var _0x12fa=['merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../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','reject','save','then','destroy','error','stack','name','send','index','FreshsalesField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x12fa,0x1c3));var _0xa12f=function(_0x4f115d,_0x1927c3){_0x4f115d=_0x4f115d-0x0;var _0x121374=_0x12fa[_0x4f115d];return _0x121374;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa12f('0x0'));var zipdir=require(_0xa12f('0x1'));var jsonpatch=require(_0xa12f('0x2'));var rp=require(_0xa12f('0x3'));var moment=require('moment');var BPromise=require(_0xa12f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa12f('0x5'));var ejs=require(_0xa12f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa12f('0x7'));var squel=require(_0xa12f('0x8'));var crypto=require('crypto');var jsforce=require(_0xa12f('0x9'));var deskjs=require(_0xa12f('0xa'));var toCsv=require(_0xa12f('0x5'));var querystring=require(_0xa12f('0xb'));var Papa=require(_0xa12f('0xc'));var Redis=require(_0xa12f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa12f('0xe'));var as=require(_0xa12f('0xf'));var hardwareService=require(_0xa12f('0x10'));var logger=require('../../config/logger')(_0xa12f('0x11'));var utils=require(_0xa12f('0x12'));var config=require(_0xa12f('0x13'));var licenseUtil=require(_0xa12f('0x14'));var db=require(_0xa12f('0x15'))['db'];function respondWithStatusCode(_0x4972c8,_0x315c59){_0x315c59=_0x315c59||0xcc;return function(_0x37ebdf){if(_0x37ebdf){return _0x4972c8[_0xa12f('0x16')](_0x315c59);}return _0x4972c8[_0xa12f('0x17')](_0x315c59)[_0xa12f('0x18')]();};}function respondWithResult(_0x19d9ba,_0x3b160f){_0x3b160f=_0x3b160f||0xc8;return function(_0x514d09){if(_0x514d09){return _0x19d9ba[_0xa12f('0x17')](_0x3b160f)[_0xa12f('0x19')](_0x514d09);}};}function respondWithFilteredResult(_0x3fd8af,_0x204922){return function(_0x1a5f53){if(_0x1a5f53){var _0x76292b=typeof _0x204922[_0xa12f('0x1a')]===_0xa12f('0x1b')&&typeof _0x204922[_0xa12f('0x1c')]===_0xa12f('0x1b');var _0x54bab2=_0x1a5f53[_0xa12f('0x1d')];var _0x518a57=_0x76292b?0x0:_0x204922[_0xa12f('0x1a')];var _0x2e8f95=_0x76292b?_0x1a5f53[_0xa12f('0x1d')]:_0x204922[_0xa12f('0x1a')]+_0x204922[_0xa12f('0x1c')];var _0x4de7be;if(_0x2e8f95>=_0x54bab2){_0x2e8f95=_0x54bab2;_0x4de7be=0xc8;}else{_0x4de7be=0xce;}_0x3fd8af['status'](_0x4de7be);return _0x3fd8af[_0xa12f('0x1e')]('Content-Range',_0x518a57+'-'+_0x2e8f95+'/'+_0x54bab2)['json'](_0x1a5f53);}return null;};}function patchUpdates(_0x4258a3){return function(_0x198bc0){try{jsonpatch[_0xa12f('0x1f')](_0x198bc0,_0x4258a3,!![]);}catch(_0x112be8){return BPromise[_0xa12f('0x20')](_0x112be8);}return _0x198bc0[_0xa12f('0x21')]();};}function saveUpdates(_0x533360,_0x1739d4){return function(_0x38353d){if(_0x38353d){return _0x38353d['update'](_0x533360)[_0xa12f('0x22')](function(_0x3f92d7){return _0x3f92d7;});}return null;};}function removeEntity(_0x8c6547,_0x283b77){return function(_0x278788){if(_0x278788){return _0x278788[_0xa12f('0x23')]()['then'](function(){_0x8c6547['status'](0xcc)[_0xa12f('0x18')]();});}};}function handleEntityNotFound(_0x47eea6,_0x31d1de){return function(_0x1108f6){if(!_0x1108f6){_0x47eea6[_0xa12f('0x16')](0x194);}return _0x1108f6;};}function handleError(_0x4c8ab5,_0x4dd35f){_0x4dd35f=_0x4dd35f||0x1f4;return function(_0xc69d8f){logger[_0xa12f('0x24')](_0xc69d8f[_0xa12f('0x25')]);if(_0xc69d8f[_0xa12f('0x26')]){delete _0xc69d8f[_0xa12f('0x26')];}_0x4c8ab5[_0xa12f('0x17')](_0x4dd35f)[_0xa12f('0x27')](_0xc69d8f);};}exports[_0xa12f('0x28')]=function(_0x470c79,_0x538256){var _0x3ef5d3={},_0xa21602={},_0x202f9b={'count':0x0,'rows':[]};var _0x1f314a=_['map'](db[_0xa12f('0x29')][_0xa12f('0x2a')],function(_0x96288e){return{'name':_0x96288e['fieldName'],'type':_0x96288e[_0xa12f('0x2b')][_0xa12f('0x2c')]};});_0xa21602[_0xa12f('0x2d')]=_[_0xa12f('0x2e')](_0x1f314a,_0xa12f('0x26'));_0xa21602[_0xa12f('0x2f')]=_[_0xa12f('0x30')](_0x470c79[_0xa12f('0x2f')]);_0xa21602[_0xa12f('0x31')]=_[_0xa12f('0x32')](_0xa21602['model'],_0xa21602[_0xa12f('0x2f')]);_0x3ef5d3[_0xa12f('0x33')]=_[_0xa12f('0x32')](_0xa21602[_0xa12f('0x2d')],qs[_0xa12f('0x34')](_0x470c79[_0xa12f('0x2f')][_0xa12f('0x34')]));_0x3ef5d3[_0xa12f('0x33')]=_0x3ef5d3[_0xa12f('0x33')][_0xa12f('0x35')]?_0x3ef5d3['attributes']:_0xa21602[_0xa12f('0x2d')];if(!_0x470c79[_0xa12f('0x2f')][_0xa12f('0x36')](_0xa12f('0x37'))){_0x3ef5d3['limit']=qs['limit'](_0x470c79[_0xa12f('0x2f')]['limit']);_0x3ef5d3[_0xa12f('0x1a')]=qs[_0xa12f('0x1a')](_0x470c79['query'][_0xa12f('0x1a')]);}_0x3ef5d3['order']=qs[_0xa12f('0x38')](_0x470c79['query']['sort']);_0x3ef5d3[_0xa12f('0x39')]=qs[_0xa12f('0x31')](_[_0xa12f('0x3a')](_0x470c79[_0xa12f('0x2f')],_0xa21602[_0xa12f('0x31')]),_0x1f314a);if(_0x470c79[_0xa12f('0x2f')][_0xa12f('0x3b')]){_0x3ef5d3[_0xa12f('0x39')]=_[_0xa12f('0x3c')](_0x3ef5d3[_0xa12f('0x39')],{'$or':_[_0xa12f('0x2e')](_0x1f314a,function(_0x334421){if(_0x334421[_0xa12f('0x2b')]!==_0xa12f('0x3d')){var _0x45576b={};_0x45576b[_0x334421[_0xa12f('0x26')]]={'$like':'%'+_0x470c79['query'][_0xa12f('0x3b')]+'%'};return _0x45576b;}})});}_0x3ef5d3=_['merge']({},_0x3ef5d3,_0x470c79[_0xa12f('0x3e')]);var _0x3083e3={'where':_0x3ef5d3['where']};return db[_0xa12f('0x29')]['count'](_0x3083e3)[_0xa12f('0x22')](function(_0x325909){_0x202f9b['count']=_0x325909;if(_0x470c79['query'][_0xa12f('0x3f')]){_0x3ef5d3['include']=[{'all':!![]}];}return db[_0xa12f('0x29')][_0xa12f('0x40')](_0x3ef5d3);})['then'](function(_0x5c6f99){_0x202f9b[_0xa12f('0x41')]=_0x5c6f99;return _0x202f9b;})[_0xa12f('0x22')](respondWithFilteredResult(_0x538256,_0x3ef5d3))[_0xa12f('0x42')](handleError(_0x538256,null));};exports[_0xa12f('0x43')]=function(_0x57eaf5,_0x30cd6c){var _0x20a142={'raw':!![],'where':{'id':_0x57eaf5[_0xa12f('0x44')]['id']}},_0x564829={};_0x564829[_0xa12f('0x2d')]=_[_0xa12f('0x30')](db[_0xa12f('0x29')]['rawAttributes']);_0x564829[_0xa12f('0x2f')]=_[_0xa12f('0x30')](_0x57eaf5[_0xa12f('0x2f')]);_0x564829[_0xa12f('0x31')]=_[_0xa12f('0x32')](_0x564829[_0xa12f('0x2d')],_0x564829[_0xa12f('0x2f')]);_0x20a142['attributes']=_[_0xa12f('0x32')](_0x564829['model'],qs['fields'](_0x57eaf5[_0xa12f('0x2f')][_0xa12f('0x34')]));_0x20a142[_0xa12f('0x33')]=_0x20a142[_0xa12f('0x33')]['length']?_0x20a142[_0xa12f('0x33')]:_0x564829[_0xa12f('0x2d')];if(_0x57eaf5[_0xa12f('0x2f')][_0xa12f('0x3f')]){_0x20a142[_0xa12f('0x45')]=[{'all':!![]}];}_0x20a142=_[_0xa12f('0x3c')]({},_0x20a142,_0x57eaf5[_0xa12f('0x3e')]);return db[_0xa12f('0x29')][_0xa12f('0x46')](_0x20a142)[_0xa12f('0x22')](handleEntityNotFound(_0x30cd6c,null))[_0xa12f('0x22')](respondWithResult(_0x30cd6c,null))[_0xa12f('0x42')](handleError(_0x30cd6c,null));};exports['create']=function(_0x220833,_0x709576){return db[_0xa12f('0x29')]['create'](_0x220833[_0xa12f('0x47')],{})[_0xa12f('0x22')](respondWithResult(_0x709576,0xc9))[_0xa12f('0x42')](handleError(_0x709576,null));};exports[_0xa12f('0x48')]=function(_0x29214a,_0x41b102){if(_0x29214a[_0xa12f('0x47')]['id']){delete _0x29214a[_0xa12f('0x47')]['id'];}return db[_0xa12f('0x29')]['find']({'where':{'id':_0x29214a[_0xa12f('0x44')]['id']}})[_0xa12f('0x22')](handleEntityNotFound(_0x41b102,null))[_0xa12f('0x22')](saveUpdates(_0x29214a['body'],null))['then'](respondWithResult(_0x41b102,null))['catch'](handleError(_0x41b102,null));};exports[_0xa12f('0x23')]=function(_0x3e2276,_0x26d38d){return db[_0xa12f('0x29')][_0xa12f('0x46')]({'where':{'id':_0x3e2276['params']['id']}})['then'](handleEntityNotFound(_0x26d38d,null))[_0xa12f('0x22')](removeEntity(_0x26d38d,null))[_0xa12f('0x42')](handleError(_0x26d38d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e0caee5..a0075ca 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 _0x3d3d=['int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField'];(function(_0x34abce,_0x4247a6){var _0x5a8adc=function(_0x344840){while(--_0x344840){_0x34abce['push'](_0x34abce['shift']());}};_0x5a8adc(++_0x4247a6);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var logger=require(_0xd3d3('0x1'))('api');var moment=require(_0xd3d3('0x2'));var BPromise=require(_0xd3d3('0x3'));var rp=require(_0xd3d3('0x4'));var fs=require('fs');var path=require(_0xd3d3('0x5'));var rimraf=require(_0xd3d3('0x6'));var config=require(_0xd3d3('0x7'));var attributes=require(_0xd3d3('0x8'));module[_0xd3d3('0x9')]=function(_0x2d36ba,_0x1e9338){return _0x2d36ba['define'](_0xd3d3('0xa'),attributes,{'tableName':_0xd3d3('0xb'),'paranoid':![],'indexes':[{'name':_0xd3d3('0xc'),'fields':[_0xd3d3('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x958a=['moment','bluebird','request-promise','path','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x958a,0x128));var _0xa958=function(_0x44dd63,_0x2a4b6d){_0x44dd63=_0x44dd63-0x0;var _0x39ab5d=_0x958a[_0x44dd63];return _0x39ab5d;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[{'name':_0xa958('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index ff28dce..2f9274e 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x550296,_0x22e9d7){var _0x5a9993=function(_0x104c18){while(--_0x104c18){_0x550296['push'](_0x550296['shift']());}};_0x5a9993(++_0x22e9d7);}(_0x33af,0xec));var _0xf33a=function(_0x208cf0,_0x486665){_0x208cf0=_0x208cf0-0x0;var _0x372d0d=_0x33af[_0x208cf0];return _0x372d0d;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x40b906,_0x19f430){var _0x2f8fa5=function(_0x2ce338){while(--_0x2ce338){_0x40b906['push'](_0x40b906['shift']());}};_0x2f8fa5(++_0x19f430);}(_0x2542,0x169));var _0x2254=function(_0x23f8d2,_0x301fec){_0x23f8d2=_0x23f8d2-0x0;var _0x5d174b=_0x2542[_0x23f8d2];return _0x5d174b;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ff3f6e6..6156d06 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x9e07ff,_0x2b93a0){var _0x388d68=function(_0x369d72){while(--_0x369d72){_0x9e07ff['push'](_0x9e07ff['shift']());}};_0x388d68(++_0x2b93a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2e9d45,_0x1cada4){var _0x228667=function(_0x1f75c0){while(--_0x1f75c0){_0x2e9d45['push'](_0x2e9d45['shift']());}};_0x228667(++_0x1cada4);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 89db9a0..af251c2 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 _0xd142=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x4c39be,_0x71ca09){var _0x12c24c=function(_0x55bbc7){while(--_0x55bbc7){_0x4c39be['push'](_0x4c39be['shift']());}};_0x12c24c(++_0x71ca09);}(_0xd142,0x11a));var _0x2d14=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0xd142[_0x58f245];return _0x1f0cfb;};'use strict';var Sequelize=require(_0x2d14('0x0'));module[_0x2d14('0x1')]={'name':{'type':Sequelize[_0x2d14('0x2')]},'description':{'type':Sequelize[_0x2d14('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x2d14('0x2')]},'password':{'type':Sequelize[_0x2d14('0x2')]},'clientId':{'type':Sequelize[_0x2d14('0x2')]},'clientSecret':{'type':Sequelize[_0x2d14('0x2')]},'securityToken':{'type':Sequelize[_0x2d14('0x2')]},'serverUrl':{'type':Sequelize[_0x2d14('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2d14('0x3')](_0x2d14('0x4'),_0x2d14('0x5')),'defaultValue':_0x2d14('0x4')}}; \ No newline at end of file +var _0x69d4=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x54783e,_0xe85a52){var _0x4b03f4=function(_0x4095ba){while(--_0x4095ba){_0x54783e['push'](_0x54783e['shift']());}};_0x4b03f4(++_0xe85a52);}(_0x69d4,0x83));var _0x469d=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x69d4[_0x45d1fd];return _0xd0e542;};'use strict';var Sequelize=require(_0x469d('0x0'));module[_0x469d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x469d('0x2')]},'username':{'type':Sequelize[_0x469d('0x2')],'unique':_0x469d('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x469d('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x469d('0x2')]},'securityToken':{'type':Sequelize[_0x469d('0x2')]},'serverUrl':{'type':Sequelize[_0x469d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x469d('0x4')](_0x469d('0x5'),_0x469d('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index eaaf2e0..041844e 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 _0xf40b=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','error','stack','name','send','index','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','map','options','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','include','find','create','update','body','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','Task','clientId','password','remoteUri','lastIndexOf','Connection','clientSecret','login','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','picklistValues','label','True','true','false','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0xf40b,0x1ce));var _0xbf40=function(_0x45be52,_0x46d496){_0x45be52=_0x45be52-0x0;var _0x15294f=_0xf40b[_0x45be52];return _0x15294f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf40('0x0'));var zipdir=require(_0xbf40('0x1'));var jsonpatch=require(_0xbf40('0x2'));var rp=require('request-promise');var moment=require(_0xbf40('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf40('0x4'));var util=require(_0xbf40('0x5'));var path=require(_0xbf40('0x6'));var sox=require('sox');var csv=require(_0xbf40('0x7'));var ejs=require(_0xbf40('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf40('0x9'));var squel=require(_0xbf40('0xa'));var crypto=require(_0xbf40('0xb'));var jsforce=require(_0xbf40('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf40('0x7'));var querystring=require(_0xbf40('0xd'));var Papa=require(_0xbf40('0xe'));var Redis=require(_0xbf40('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbf40('0x10'));var as=require(_0xbf40('0x11'));var hardwareService=require(_0xbf40('0x12'));var logger=require(_0xbf40('0x13'))('api');var utils=require(_0xbf40('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbf40('0x15'));var db=require(_0xbf40('0x16'))['db'];var integrations=require(_0xbf40('0x17'));function respondWithStatusCode(_0x19d0cf,_0x5507c7){_0x5507c7=_0x5507c7||0xcc;return function(_0x4dc9b6){if(_0x4dc9b6){return _0x19d0cf[_0xbf40('0x18')](_0x5507c7);}return _0x19d0cf[_0xbf40('0x19')](_0x5507c7)[_0xbf40('0x1a')]();};}function respondWithResult(_0x369cdc,_0x519d08){_0x519d08=_0x519d08||0xc8;return function(_0x59aebb){if(_0x59aebb){return _0x369cdc['status'](_0x519d08)[_0xbf40('0x1b')](_0x59aebb);}};}function respondWithFilteredResult(_0x594793,_0x5bd128){return function(_0x45e909){if(_0x45e909){var _0x469c0f=typeof _0x5bd128[_0xbf40('0x1c')]===_0xbf40('0x1d')&&typeof _0x5bd128[_0xbf40('0x1e')]==='undefined';var _0x2d04f6=_0x45e909[_0xbf40('0x1f')];var _0x3b6efe=_0x469c0f?0x0:_0x5bd128[_0xbf40('0x1c')];var _0x20eb90=_0x469c0f?_0x45e909[_0xbf40('0x1f')]:_0x5bd128[_0xbf40('0x1c')]+_0x5bd128[_0xbf40('0x1e')];var _0x34accc;if(_0x20eb90>=_0x2d04f6){_0x20eb90=_0x2d04f6;_0x34accc=0xc8;}else{_0x34accc=0xce;}_0x594793[_0xbf40('0x19')](_0x34accc);return _0x594793['set'](_0xbf40('0x20'),_0x3b6efe+'-'+_0x20eb90+'/'+_0x2d04f6)[_0xbf40('0x1b')](_0x45e909);}return null;};}function patchUpdates(_0xd9ee29){return function(_0x1d760b){try{jsonpatch['apply'](_0x1d760b,_0xd9ee29,!![]);}catch(_0x529a8f){return BPromise['reject'](_0x529a8f);}return _0x1d760b[_0xbf40('0x21')]();};}function saveUpdates(_0xa3edad,_0x3c8626){return function(_0x259faf){if(_0x259faf){return _0x259faf['update'](_0xa3edad)[_0xbf40('0x22')](function(_0x804157){return _0x804157;});}return null;};}function removeEntity(_0x49240d,_0x4fdd61){return function(_0x3b45db){if(_0x3b45db){return _0x3b45db['destroy']()[_0xbf40('0x22')](function(){_0x49240d[_0xbf40('0x19')](0xcc)[_0xbf40('0x1a')]();});}};}function handleEntityNotFound(_0x2d09d5,_0x1c13ca){return function(_0x49839c){if(!_0x49839c){_0x2d09d5['sendStatus'](0x194);}return _0x49839c;};}function handleError(_0x236aab,_0x3ce1c4){_0x3ce1c4=_0x3ce1c4||0x1f4;return function(_0x5e0234){logger[_0xbf40('0x23')](_0x5e0234[_0xbf40('0x24')]);if(_0x5e0234[_0xbf40('0x25')]){delete _0x5e0234[_0xbf40('0x25')];}_0x236aab[_0xbf40('0x19')](_0x3ce1c4)[_0xbf40('0x26')](_0x5e0234);};}exports[_0xbf40('0x27')]=function(_0xd6bbc1,_0x41ac54){var _0x251cea={},_0x870664={},_0x53a950={'count':0x0,'rows':[]};var _0x353626=_['map'](db[_0xbf40('0x28')]['rawAttributes'],function(_0x176f41){return{'name':_0x176f41[_0xbf40('0x29')],'type':_0x176f41[_0xbf40('0x2a')][_0xbf40('0x2b')]};});_0x870664[_0xbf40('0x2c')]=_['map'](_0x353626,'name');_0x870664[_0xbf40('0x2d')]=_[_0xbf40('0x2e')](_0xd6bbc1['query']);_0x870664[_0xbf40('0x2f')]=_[_0xbf40('0x30')](_0x870664[_0xbf40('0x2c')],_0x870664[_0xbf40('0x2d')]);_0x251cea[_0xbf40('0x31')]=_[_0xbf40('0x30')](_0x870664[_0xbf40('0x2c')],qs['fields'](_0xd6bbc1[_0xbf40('0x2d')]['fields']));_0x251cea['attributes']=_0x251cea['attributes'][_0xbf40('0x32')]?_0x251cea[_0xbf40('0x31')]:_0x870664[_0xbf40('0x2c')];if(!_0xd6bbc1[_0xbf40('0x2d')][_0xbf40('0x33')]('nolimit')){_0x251cea[_0xbf40('0x1e')]=qs[_0xbf40('0x1e')](_0xd6bbc1[_0xbf40('0x2d')][_0xbf40('0x1e')]);_0x251cea['offset']=qs[_0xbf40('0x1c')](_0xd6bbc1[_0xbf40('0x2d')][_0xbf40('0x1c')]);}_0x251cea['order']=qs[_0xbf40('0x34')](_0xd6bbc1['query'][_0xbf40('0x34')]);_0x251cea['where']=qs['filters'](_[_0xbf40('0x35')](_0xd6bbc1[_0xbf40('0x2d')],_0x870664['filters']),_0x353626);if(_0xd6bbc1['query'][_0xbf40('0x36')]){_0x251cea[_0xbf40('0x37')]=_[_0xbf40('0x38')](_0x251cea['where'],{'$or':_[_0xbf40('0x39')](_0x353626,function(_0x2cd8e9){if(_0x2cd8e9[_0xbf40('0x2a')]!=='VIRTUAL'){var _0x5a401d={};_0x5a401d[_0x2cd8e9[_0xbf40('0x25')]]={'$like':'%'+_0xd6bbc1[_0xbf40('0x2d')][_0xbf40('0x36')]+'%'};return _0x5a401d;}})});}_0x251cea=_[_0xbf40('0x38')]({},_0x251cea,_0xd6bbc1[_0xbf40('0x3a')]);var _0x5e37e5={'where':_0x251cea[_0xbf40('0x37')]};return db[_0xbf40('0x28')]['count'](_0x5e37e5)[_0xbf40('0x22')](function(_0x32644b){_0x53a950['count']=_0x32644b;if(_0xd6bbc1[_0xbf40('0x2d')]['includeAll']){_0x251cea['include']=[{'all':!![]}];}return db[_0xbf40('0x28')][_0xbf40('0x3b')](_0x251cea);})[_0xbf40('0x22')](function(_0x32d57e){_0x53a950[_0xbf40('0x3c')]=_0x32d57e;return _0x53a950;})[_0xbf40('0x22')](respondWithFilteredResult(_0x41ac54,_0x251cea))[_0xbf40('0x3d')](handleError(_0x41ac54,null));};exports[_0xbf40('0x3e')]=function(_0x3aa6c3,_0x30e1b7){var _0x2430b2={'raw':![],'where':{'id':_0x3aa6c3[_0xbf40('0x3f')]['id']}},_0x16433f={};_0x16433f[_0xbf40('0x2c')]=_['keys'](db[_0xbf40('0x28')][_0xbf40('0x40')]);_0x16433f['query']=_['keys'](_0x3aa6c3[_0xbf40('0x2d')]);_0x16433f[_0xbf40('0x2f')]=_[_0xbf40('0x30')](_0x16433f[_0xbf40('0x2c')],_0x16433f['query']);_0x2430b2[_0xbf40('0x31')]=_['intersection'](_0x16433f[_0xbf40('0x2c')],qs[_0xbf40('0x41')](_0x3aa6c3['query'][_0xbf40('0x41')]));_0x2430b2[_0xbf40('0x31')]=_0x2430b2[_0xbf40('0x31')]['length']?_0x2430b2['attributes']:_0x16433f[_0xbf40('0x2c')];if(_0x3aa6c3[_0xbf40('0x2d')][_0xbf40('0x42')]){_0x2430b2[_0xbf40('0x43')]=[{'all':!![]}];}_0x2430b2=_['merge']({},_0x2430b2,_0x3aa6c3['options']);return db[_0xbf40('0x28')][_0xbf40('0x44')](_0x2430b2)[_0xbf40('0x22')](handleEntityNotFound(_0x30e1b7,null))[_0xbf40('0x22')](respondWithResult(_0x30e1b7,null))[_0xbf40('0x3d')](handleError(_0x30e1b7,null));};exports[_0xbf40('0x45')]=function(_0x1da3a7,_0x41e3e3){return db[_0xbf40('0x28')][_0xbf40('0x45')](_0x1da3a7['body'],{})['then'](respondWithResult(_0x41e3e3,0xc9))[_0xbf40('0x3d')](handleError(_0x41e3e3,null));};exports[_0xbf40('0x46')]=function(_0x2b1ebf,_0x2635d0){if(_0x2b1ebf[_0xbf40('0x47')]['id']){delete _0x2b1ebf[_0xbf40('0x47')]['id'];}return db['SalesforceAccount'][_0xbf40('0x44')]({'where':{'id':_0x2b1ebf[_0xbf40('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2635d0,null))[_0xbf40('0x22')](saveUpdates(_0x2b1ebf[_0xbf40('0x47')],null))['then'](respondWithResult(_0x2635d0,null))[_0xbf40('0x3d')](handleError(_0x2635d0,null));};exports[_0xbf40('0x48')]=function(_0x3d5c43,_0x351d22){return db[_0xbf40('0x28')][_0xbf40('0x44')]({'where':{'id':_0x3d5c43[_0xbf40('0x3f')]['id']}})['then'](handleEntityNotFound(_0x351d22,null))[_0xbf40('0x22')](removeEntity(_0x351d22,null))[_0xbf40('0x3d')](handleError(_0x351d22,null));};exports[_0xbf40('0x49')]=function(_0x5f49a6,_0x297a62,_0x1fc46f){var _0x45aa1d={};var _0xb353a7={};var _0x1d759e;var _0x1b5134;return db[_0xbf40('0x28')][_0xbf40('0x4a')]({'where':{'id':_0x5f49a6['params']['id']}})[_0xbf40('0x22')](handleEntityNotFound(_0x297a62,null))[_0xbf40('0x22')](function(_0x2c7639){if(_0x2c7639){_0x1d759e=_0x2c7639;_0xb353a7[_0xbf40('0x2c')]=_[_0xbf40('0x2e')](db[_0xbf40('0x4b')]['rawAttributes']);_0xb353a7[_0xbf40('0x2d')]=_[_0xbf40('0x2e')](_0x5f49a6[_0xbf40('0x2d')]);_0xb353a7[_0xbf40('0x2f')]=_['intersection'](_0xb353a7[_0xbf40('0x2c')],_0xb353a7[_0xbf40('0x2d')]);_0x45aa1d[_0xbf40('0x31')]=_[_0xbf40('0x30')](_0xb353a7[_0xbf40('0x2c')],qs['fields'](_0x5f49a6['query']['fields']));_0x45aa1d[_0xbf40('0x31')]=_0x45aa1d['attributes']['length']?_0x45aa1d[_0xbf40('0x31')]:_0xb353a7[_0xbf40('0x2c')];_0x45aa1d['order']=qs[_0xbf40('0x34')](_0x5f49a6[_0xbf40('0x2d')][_0xbf40('0x34')]);_0x45aa1d['where']=qs['filters'](_['pick'](_0x5f49a6[_0xbf40('0x2d')],_0xb353a7['filters']));if(_0x5f49a6[_0xbf40('0x2d')]['filter']){_0x45aa1d[_0xbf40('0x37')]=_[_0xbf40('0x38')](_0x45aa1d[_0xbf40('0x37')],{'$or':_[_0xbf40('0x39')](_0x45aa1d[_0xbf40('0x31')],function(_0x30c6b5){var _0x5d0404={};_0x5d0404[_0x30c6b5]={'$like':'%'+_0x5f49a6[_0xbf40('0x2d')][_0xbf40('0x36')]+'%'};return _0x5d0404;})});}_0x45aa1d=_[_0xbf40('0x38')]({},_0x45aa1d,_0x5f49a6['options']);return _0x1d759e[_0xbf40('0x49')](_0x45aa1d);}})[_0xbf40('0x22')](function(_0x3ed225){if(_0x3ed225){_0x1b5134=_0x3ed225['length'];if(!_0x5f49a6[_0xbf40('0x2d')][_0xbf40('0x33')]('nolimit')){_0x45aa1d[_0xbf40('0x1e')]=qs[_0xbf40('0x1e')](_0x5f49a6[_0xbf40('0x2d')][_0xbf40('0x1e')]);_0x45aa1d[_0xbf40('0x1c')]=qs[_0xbf40('0x1c')](_0x5f49a6[_0xbf40('0x2d')][_0xbf40('0x1c')]);}return _0x1d759e[_0xbf40('0x49')](_0x45aa1d);}})['then'](function(_0x1e7e98){if(_0x1e7e98){return _0x1e7e98?{'count':_0x1b5134,'rows':_0x1e7e98}:null;}})[_0xbf40('0x22')](respondWithResult(_0x297a62,null))['catch'](handleError(_0x297a62,null));};exports[_0xbf40('0x4c')]=function(_0x28659b,_0x214cd5,_0x5a71b3){if(_0x28659b[_0xbf40('0x47')]['id']){delete _0x28659b[_0xbf40('0x47')]['id'];}return db[_0xbf40('0x28')][_0xbf40('0x4a')]({'where':{'id':_0x28659b[_0xbf40('0x3f')]['id']}})[_0xbf40('0x22')](handleEntityNotFound(_0x214cd5,null))[_0xbf40('0x22')](function(_0x15d817){if(_0x15d817){_0x28659b[_0xbf40('0x47')]['AccountId']=_0x15d817['id'];_0x28659b['body'][_0xbf40('0x4d')]=integrations[_0xbf40('0x4e')](_0x28659b[_0xbf40('0x47')][_0xbf40('0x4f')],_0x28659b[_0xbf40('0x47')]['type']);_0x28659b['body'][_0xbf40('0x50')]=integrations[_0xbf40('0x51')](_0x28659b[_0xbf40('0x47')]['channel'],_0x28659b[_0xbf40('0x47')]['type']);return db[_0xbf40('0x4b')][_0xbf40('0x45')](_0x28659b[_0xbf40('0x47')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xbf40('0x22')](respondWithResult(_0x214cd5,null))[_0xbf40('0x3d')](handleError(_0x214cd5,null));};exports[_0xbf40('0x52')]=function(_0x3996db,_0x289b43,_0x23e3f1){var _0x58a81f;var _0x58f272='';var _0x4de47c=_0xbf40('0x53');return db[_0xbf40('0x28')]['findOne']({'where':{'id':_0x3996db[_0xbf40('0x3f')]['id']},'attributes':['id','remoteUri',_0xbf40('0x54'),'clientSecret','username',_0xbf40('0x55'),'securityToken']})[_0xbf40('0x22')](handleEntityNotFound(_0x289b43,null))[_0xbf40('0x22')](function(_0x1e7830){if(_0x1e7830){_0x58f272=_0x1e7830[_0xbf40('0x56')];var _0x974050=_0x58f272['slice'](-0x1);if(_0x974050==='/'){_0x58f272=_0x58f272['substring'](0x0,_0x58f272[_0xbf40('0x57')](_0x974050));}_0x58a81f=new jsforce[(_0xbf40('0x58'))]({'oauth2':{'loginUrl':_0x58f272,'clientId':_0x1e7830['clientId'],'clientSecret':_0x1e7830[_0xbf40('0x59')]}});return _0x58a81f[_0xbf40('0x5a')](_0x1e7830['username'],_0x1e7830['password'][_0xbf40('0x5b')](_0x1e7830[_0xbf40('0x5c')]));}})[_0xbf40('0x22')](function(_0x3e4278){if(_0x3e4278){if(!_[_0xbf40('0x5d')](_0x3996db[_0xbf40('0x2d')][_0xbf40('0x5e')])){_0x4de47c=_0x3996db['query'][_0xbf40('0x5e')];}return _0x58a81f[_0xbf40('0x5f')](_0x4de47c)[_0xbf40('0x60')]();}})[_0xbf40('0x22')](function(_0xcdc1bf){var _0x56087c=[_0xbf40('0x61'),'ActivityDate',_0xbf40('0x62'),'IsRecurrence',_0xbf40('0x63'),_0xbf40('0x64')];var _0x335396=[_0xbf40('0x65'),_0xbf40('0x66'),_0xbf40('0x67'),_0xbf40('0x68'),_0xbf40('0x69'),_0xbf40('0x6a'),_0xbf40('0x6b')];if(_0xcdc1bf){_[_0xbf40('0x6c')](_0xcdc1bf['fields'],function(_0x29d10b){return _0x56087c[_0xbf40('0x6d')](_0x29d10b[_0xbf40('0x25')])||!_0x335396[_0xbf40('0x6d')](_0x29d10b[_0xbf40('0x2a')]);});return{'count':_0xcdc1bf[_0xbf40('0x41')][_0xbf40('0x32')],'rows':_[_0xbf40('0x39')](_0xcdc1bf[_0xbf40('0x41')],function(_0x314110){return{'id':_0x314110[_0xbf40('0x25')],'name':_0x314110['label'],'custom':_0x314110['custom'],'options':_0x314110[_0xbf40('0x6e')][_0xbf40('0x32')]>0x0?_[_0xbf40('0x39')](_0x314110[_0xbf40('0x6e')],function(_0x33eec3){return{'name':_0x33eec3[_0xbf40('0x6f')],'value':_0x33eec3['value']};}):_0x314110[_0xbf40('0x2a')]==_0xbf40('0x68')?[{'name':_0xbf40('0x70'),'value':_0xbf40('0x71')},{'name':'False','value':_0xbf40('0x72')}]:[]};})};}})['then'](respondWithResult(_0x289b43,null))['catch'](function(_0x9383ee){var _0x52b27d=_0x3996db[_0xbf40('0x2d')][_0xbf40('0x73')]?0x1f4:_0x9383ee[_0xbf40('0x74')]||0x1f4;logger[_0xbf40('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xbf40('0x52'),_0x52b27d,JSON[_0xbf40('0x75')](_0x9383ee));delete _0x9383ee[_0xbf40('0x25')];if(_0x52b27d===0x191){_0x52b27d=0x190;}_0x289b43[_0xbf40('0x19')](_0x52b27d)[_0xbf40('0x26')](_0x3996db[_0xbf40('0x2d')][_0xbf40('0x73')]?{'message':_0xbf40('0x76'),'statusCode':_0x9383ee[_0xbf40('0x74')]}:_0x9383ee);});}; \ No newline at end of file +var _0xebff=['catch','show','params','find','create','body','findOne','SalesforceConfiguration','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','slice','substring','Connection','login','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Description','string','int','picklist','boolean','textarea','phone','includes','custom','picklistValues','label','value','True','true','False','false','statusCode','error','stringify','send','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xebff,0xbf));var _0xfebf=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xebff[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0xfebf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfebf('0x1'));var jsonpatch=require(_0xfebf('0x2'));var rp=require(_0xfebf('0x3'));var moment=require(_0xfebf('0x4'));var BPromise=require(_0xfebf('0x5'));var Mustache=require('mustache');var util=require(_0xfebf('0x6'));var path=require(_0xfebf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfebf('0x8'));var fs=require('fs');var fs_extra=require(_0xfebf('0x9'));var _=require(_0xfebf('0xa'));var squel=require('squel');var crypto=require(_0xfebf('0xb'));var jsforce=require(_0xfebf('0xc'));var deskjs=require(_0xfebf('0xd'));var toCsv=require(_0xfebf('0xe'));var querystring=require(_0xfebf('0xf'));var Papa=require(_0xfebf('0x10'));var Redis=require(_0xfebf('0x11'));var authService=require(_0xfebf('0x12'));var qs=require(_0xfebf('0x13'));var as=require(_0xfebf('0x14'));var hardwareService=require(_0xfebf('0x15'));var logger=require(_0xfebf('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xfebf('0x17'));var licenseUtil=require(_0xfebf('0x18'));var db=require(_0xfebf('0x19'))['db'];var integrations=require(_0xfebf('0x1a'));function respondWithStatusCode(_0x3fc754,_0x5127df){_0x5127df=_0x5127df||0xcc;return function(_0x33b245){if(_0x33b245){return _0x3fc754[_0xfebf('0x1b')](_0x5127df);}return _0x3fc754[_0xfebf('0x1c')](_0x5127df)[_0xfebf('0x1d')]();};}function respondWithResult(_0x481dea,_0xf2f77b){_0xf2f77b=_0xf2f77b||0xc8;return function(_0x45358d){if(_0x45358d){return _0x481dea['status'](_0xf2f77b)[_0xfebf('0x1e')](_0x45358d);}};}function respondWithFilteredResult(_0x1a4732,_0xc6b3a9){return function(_0x3c4b6a){if(_0x3c4b6a){var _0x499eb2=typeof _0xc6b3a9[_0xfebf('0x1f')]===_0xfebf('0x20')&&typeof _0xc6b3a9[_0xfebf('0x21')]===_0xfebf('0x20');var _0x387726=_0x3c4b6a[_0xfebf('0x22')];var _0x433ba8=_0x499eb2?0x0:_0xc6b3a9[_0xfebf('0x1f')];var _0x17e815=_0x499eb2?_0x3c4b6a[_0xfebf('0x22')]:_0xc6b3a9['offset']+_0xc6b3a9[_0xfebf('0x21')];var _0x441193;if(_0x17e815>=_0x387726){_0x17e815=_0x387726;_0x441193=0xc8;}else{_0x441193=0xce;}_0x1a4732[_0xfebf('0x1c')](_0x441193);return _0x1a4732[_0xfebf('0x23')](_0xfebf('0x24'),_0x433ba8+'-'+_0x17e815+'/'+_0x387726)[_0xfebf('0x1e')](_0x3c4b6a);}return null;};}function patchUpdates(_0xfff70b){return function(_0x12cb3c){try{jsonpatch[_0xfebf('0x25')](_0x12cb3c,_0xfff70b,!![]);}catch(_0xb344b7){return BPromise[_0xfebf('0x26')](_0xb344b7);}return _0x12cb3c[_0xfebf('0x27')]();};}function saveUpdates(_0x1d2c24,_0x29cbf0){return function(_0x254a0b){if(_0x254a0b){return _0x254a0b[_0xfebf('0x28')](_0x1d2c24)[_0xfebf('0x29')](function(_0x5f3f04){return _0x5f3f04;});}return null;};}function removeEntity(_0x30aa0e,_0x20687f){return function(_0x178bc){if(_0x178bc){return _0x178bc[_0xfebf('0x2a')]()[_0xfebf('0x29')](function(){_0x30aa0e[_0xfebf('0x1c')](0xcc)[_0xfebf('0x1d')]();});}};}function handleEntityNotFound(_0x50b5c9,_0x2b31ae){return function(_0x14ee12){if(!_0x14ee12){_0x50b5c9[_0xfebf('0x1b')](0x194);}return _0x14ee12;};}function handleError(_0x513333,_0x56772c){_0x56772c=_0x56772c||0x1f4;return function(_0x31543f){logger['error'](_0x31543f[_0xfebf('0x2b')]);if(_0x31543f[_0xfebf('0x2c')]){delete _0x31543f[_0xfebf('0x2c')];}_0x513333['status'](_0x56772c)['send'](_0x31543f);};}exports[_0xfebf('0x2d')]=function(_0x303fe6,_0x229ddb){var _0x2165cd={},_0x3df67a={},_0x102cc1={'count':0x0,'rows':[]};var _0x43c2d9=_[_0xfebf('0x2e')](db[_0xfebf('0x2f')][_0xfebf('0x30')],function(_0x5e6b41){return{'name':_0x5e6b41[_0xfebf('0x31')],'type':_0x5e6b41['type'][_0xfebf('0x32')]};});_0x3df67a[_0xfebf('0x33')]=_[_0xfebf('0x2e')](_0x43c2d9,_0xfebf('0x2c'));_0x3df67a[_0xfebf('0x34')]=_[_0xfebf('0x35')](_0x303fe6['query']);_0x3df67a[_0xfebf('0x36')]=_[_0xfebf('0x37')](_0x3df67a[_0xfebf('0x33')],_0x3df67a['query']);_0x2165cd[_0xfebf('0x38')]=_['intersection'](_0x3df67a[_0xfebf('0x33')],qs[_0xfebf('0x39')](_0x303fe6[_0xfebf('0x34')][_0xfebf('0x39')]));_0x2165cd[_0xfebf('0x38')]=_0x2165cd[_0xfebf('0x38')][_0xfebf('0x3a')]?_0x2165cd[_0xfebf('0x38')]:_0x3df67a[_0xfebf('0x33')];if(!_0x303fe6[_0xfebf('0x34')][_0xfebf('0x3b')]('nolimit')){_0x2165cd[_0xfebf('0x21')]=qs['limit'](_0x303fe6['query'][_0xfebf('0x21')]);_0x2165cd[_0xfebf('0x1f')]=qs[_0xfebf('0x1f')](_0x303fe6[_0xfebf('0x34')][_0xfebf('0x1f')]);}_0x2165cd['order']=qs[_0xfebf('0x3c')](_0x303fe6[_0xfebf('0x34')][_0xfebf('0x3c')]);_0x2165cd['where']=qs[_0xfebf('0x36')](_[_0xfebf('0x3d')](_0x303fe6[_0xfebf('0x34')],_0x3df67a[_0xfebf('0x36')]),_0x43c2d9);if(_0x303fe6['query'][_0xfebf('0x3e')]){_0x2165cd[_0xfebf('0x3f')]=_[_0xfebf('0x40')](_0x2165cd[_0xfebf('0x3f')],{'$or':_[_0xfebf('0x2e')](_0x43c2d9,function(_0xeed7e5){if(_0xeed7e5[_0xfebf('0x41')]!==_0xfebf('0x42')){var _0x548b49={};_0x548b49[_0xeed7e5['name']]={'$like':'%'+_0x303fe6[_0xfebf('0x34')]['filter']+'%'};return _0x548b49;}})});}_0x2165cd=_[_0xfebf('0x40')]({},_0x2165cd,_0x303fe6[_0xfebf('0x43')]);var _0x1cf9b7={'where':_0x2165cd[_0xfebf('0x3f')]};return db[_0xfebf('0x2f')][_0xfebf('0x22')](_0x1cf9b7)[_0xfebf('0x29')](function(_0x43d405){_0x102cc1['count']=_0x43d405;if(_0x303fe6[_0xfebf('0x34')][_0xfebf('0x44')]){_0x2165cd['include']=[{'all':!![]}];}return db[_0xfebf('0x2f')][_0xfebf('0x45')](_0x2165cd);})[_0xfebf('0x29')](function(_0x4670c9){_0x102cc1[_0xfebf('0x46')]=_0x4670c9;return _0x102cc1;})['then'](respondWithFilteredResult(_0x229ddb,_0x2165cd))[_0xfebf('0x47')](handleError(_0x229ddb,null));};exports[_0xfebf('0x48')]=function(_0x1c4cbd,_0x2b4537){var _0x3a578e={'raw':![],'where':{'id':_0x1c4cbd[_0xfebf('0x49')]['id']}},_0x4d10e1={};_0x4d10e1['model']=_['keys'](db[_0xfebf('0x2f')][_0xfebf('0x30')]);_0x4d10e1[_0xfebf('0x34')]=_[_0xfebf('0x35')](_0x1c4cbd['query']);_0x4d10e1[_0xfebf('0x36')]=_['intersection'](_0x4d10e1['model'],_0x4d10e1[_0xfebf('0x34')]);_0x3a578e[_0xfebf('0x38')]=_[_0xfebf('0x37')](_0x4d10e1[_0xfebf('0x33')],qs[_0xfebf('0x39')](_0x1c4cbd['query'][_0xfebf('0x39')]));_0x3a578e[_0xfebf('0x38')]=_0x3a578e[_0xfebf('0x38')][_0xfebf('0x3a')]?_0x3a578e[_0xfebf('0x38')]:_0x4d10e1['model'];if(_0x1c4cbd[_0xfebf('0x34')][_0xfebf('0x44')]){_0x3a578e['include']=[{'all':!![]}];}_0x3a578e=_[_0xfebf('0x40')]({},_0x3a578e,_0x1c4cbd[_0xfebf('0x43')]);return db[_0xfebf('0x2f')][_0xfebf('0x4a')](_0x3a578e)['then'](handleEntityNotFound(_0x2b4537,null))['then'](respondWithResult(_0x2b4537,null))[_0xfebf('0x47')](handleError(_0x2b4537,null));};exports[_0xfebf('0x4b')]=function(_0x1bd430,_0x3f88be){return db[_0xfebf('0x2f')][_0xfebf('0x4b')](_0x1bd430[_0xfebf('0x4c')],{})[_0xfebf('0x29')](respondWithResult(_0x3f88be,0xc9))[_0xfebf('0x47')](handleError(_0x3f88be,null));};exports[_0xfebf('0x28')]=function(_0x1b5500,_0x362752){if(_0x1b5500[_0xfebf('0x4c')]['id']){delete _0x1b5500[_0xfebf('0x4c')]['id'];}return db[_0xfebf('0x2f')][_0xfebf('0x4a')]({'where':{'id':_0x1b5500[_0xfebf('0x49')]['id']}})[_0xfebf('0x29')](handleEntityNotFound(_0x362752,null))[_0xfebf('0x29')](saveUpdates(_0x1b5500[_0xfebf('0x4c')],null))[_0xfebf('0x29')](respondWithResult(_0x362752,null))[_0xfebf('0x47')](handleError(_0x362752,null));};exports[_0xfebf('0x2a')]=function(_0x1c019d,_0x2676fc){return db[_0xfebf('0x2f')][_0xfebf('0x4a')]({'where':{'id':_0x1c019d[_0xfebf('0x49')]['id']}})[_0xfebf('0x29')](handleEntityNotFound(_0x2676fc,null))[_0xfebf('0x29')](removeEntity(_0x2676fc,null))[_0xfebf('0x47')](handleError(_0x2676fc,null));};exports['getConfigurations']=function(_0x19bc25,_0x7fb7f2,_0x331132){var _0x165bfe={};var _0x5c2a6a={};var _0x32df53;var _0x4f546d;return db['SalesforceAccount'][_0xfebf('0x4d')]({'where':{'id':_0x19bc25[_0xfebf('0x49')]['id']}})[_0xfebf('0x29')](handleEntityNotFound(_0x7fb7f2,null))[_0xfebf('0x29')](function(_0x185a41){if(_0x185a41){_0x32df53=_0x185a41;_0x5c2a6a[_0xfebf('0x33')]=_['keys'](db[_0xfebf('0x4e')][_0xfebf('0x30')]);_0x5c2a6a[_0xfebf('0x34')]=_[_0xfebf('0x35')](_0x19bc25['query']);_0x5c2a6a['filters']=_[_0xfebf('0x37')](_0x5c2a6a['model'],_0x5c2a6a['query']);_0x165bfe[_0xfebf('0x38')]=_[_0xfebf('0x37')](_0x5c2a6a[_0xfebf('0x33')],qs[_0xfebf('0x39')](_0x19bc25[_0xfebf('0x34')][_0xfebf('0x39')]));_0x165bfe[_0xfebf('0x38')]=_0x165bfe[_0xfebf('0x38')][_0xfebf('0x3a')]?_0x165bfe[_0xfebf('0x38')]:_0x5c2a6a[_0xfebf('0x33')];_0x165bfe[_0xfebf('0x4f')]=qs[_0xfebf('0x3c')](_0x19bc25[_0xfebf('0x34')][_0xfebf('0x3c')]);_0x165bfe['where']=qs['filters'](_[_0xfebf('0x3d')](_0x19bc25[_0xfebf('0x34')],_0x5c2a6a[_0xfebf('0x36')]));if(_0x19bc25['query']['filter']){_0x165bfe[_0xfebf('0x3f')]=_[_0xfebf('0x40')](_0x165bfe['where'],{'$or':_[_0xfebf('0x2e')](_0x165bfe[_0xfebf('0x38')],function(_0x2b65fb){var _0x6bd4a8={};_0x6bd4a8[_0x2b65fb]={'$like':'%'+_0x19bc25[_0xfebf('0x34')][_0xfebf('0x3e')]+'%'};return _0x6bd4a8;})});}_0x165bfe=_[_0xfebf('0x40')]({},_0x165bfe,_0x19bc25[_0xfebf('0x43')]);return _0x32df53[_0xfebf('0x50')](_0x165bfe);}})[_0xfebf('0x29')](function(_0x429bd1){if(_0x429bd1){_0x4f546d=_0x429bd1[_0xfebf('0x3a')];if(!_0x19bc25[_0xfebf('0x34')][_0xfebf('0x3b')](_0xfebf('0x51'))){_0x165bfe['limit']=qs[_0xfebf('0x21')](_0x19bc25['query'][_0xfebf('0x21')]);_0x165bfe[_0xfebf('0x1f')]=qs[_0xfebf('0x1f')](_0x19bc25[_0xfebf('0x34')][_0xfebf('0x1f')]);}return _0x32df53[_0xfebf('0x50')](_0x165bfe);}})[_0xfebf('0x29')](function(_0x2c5093){if(_0x2c5093){return _0x2c5093?{'count':_0x4f546d,'rows':_0x2c5093}:null;}})[_0xfebf('0x29')](respondWithResult(_0x7fb7f2,null))['catch'](handleError(_0x7fb7f2,null));};exports[_0xfebf('0x52')]=function(_0x9a132c,_0x120eba,_0x4bc112){if(_0x9a132c[_0xfebf('0x4c')]['id']){delete _0x9a132c[_0xfebf('0x4c')]['id'];}return db['SalesforceAccount'][_0xfebf('0x4d')]({'where':{'id':_0x9a132c[_0xfebf('0x49')]['id']}})['then'](handleEntityNotFound(_0x120eba,null))[_0xfebf('0x29')](function(_0x9d238b){if(_0x9d238b){_0x9a132c[_0xfebf('0x4c')][_0xfebf('0x53')]=_0x9d238b['id'];_0x9a132c[_0xfebf('0x4c')][_0xfebf('0x54')]=integrations[_0xfebf('0x55')](_0x9a132c[_0xfebf('0x4c')][_0xfebf('0x56')],_0x9a132c[_0xfebf('0x4c')]['type']);_0x9a132c[_0xfebf('0x4c')][_0xfebf('0x57')]=integrations[_0xfebf('0x58')](_0x9a132c['body']['channel'],_0x9a132c['body'][_0xfebf('0x41')]);return db['SalesforceConfiguration'][_0xfebf('0x4b')](_0x9a132c['body'],{'include':[{'model':db[_0xfebf('0x59')],'as':_0xfebf('0x54')},{'model':db[_0xfebf('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x120eba,null))[_0xfebf('0x47')](handleError(_0x120eba,null));};exports[_0xfebf('0x5a')]=function(_0x3bf68b,_0x4005a0,_0x14de42){var _0xa1871b;var _0x5f4f90='';var _0xa261c0=_0xfebf('0x5b');return db[_0xfebf('0x2f')][_0xfebf('0x4d')]({'where':{'id':_0x3bf68b[_0xfebf('0x49')]['id']},'attributes':['id',_0xfebf('0x5c'),_0xfebf('0x5d'),_0xfebf('0x5e'),'username',_0xfebf('0x5f'),'securityToken']})[_0xfebf('0x29')](handleEntityNotFound(_0x4005a0,null))[_0xfebf('0x29')](function(_0x16051a){if(_0x16051a){_0x5f4f90=_0x16051a[_0xfebf('0x5c')];var _0x4d13d4=_0x5f4f90[_0xfebf('0x60')](-0x1);if(_0x4d13d4==='/'){_0x5f4f90=_0x5f4f90[_0xfebf('0x61')](0x0,_0x5f4f90['lastIndexOf'](_0x4d13d4));}_0xa1871b=new jsforce[(_0xfebf('0x62'))]({'oauth2':{'loginUrl':_0x5f4f90,'clientId':_0x16051a['clientId'],'clientSecret':_0x16051a['clientSecret']}});return _0xa1871b[_0xfebf('0x63')](_0x16051a['username'],_0x16051a[_0xfebf('0x5f')][_0xfebf('0x64')](_0x16051a[_0xfebf('0x65')]));}})[_0xfebf('0x29')](function(_0x226df6){if(_0x226df6){if(!_[_0xfebf('0x66')](_0x3bf68b['query'][_0xfebf('0x67')])){_0xa261c0=_0x3bf68b[_0xfebf('0x34')][_0xfebf('0x67')];}return _0xa1871b[_0xfebf('0x68')](_0xa261c0)[_0xfebf('0x69')]();}})['then'](function(_0x424a78){var _0x1c2971=[_0xfebf('0x6a'),_0xfebf('0x6b'),'IsReminderSet',_0xfebf('0x6c'),'Subject',_0xfebf('0x6d')];var _0x138691=[_0xfebf('0x6e'),_0xfebf('0x6f'),_0xfebf('0x70'),_0xfebf('0x71'),'email',_0xfebf('0x72'),_0xfebf('0x73')];if(_0x424a78){_['remove'](_0x424a78[_0xfebf('0x39')],function(_0x68888){return _0x1c2971['includes'](_0x68888[_0xfebf('0x2c')])||!_0x138691[_0xfebf('0x74')](_0x68888[_0xfebf('0x41')]);});return{'count':_0x424a78[_0xfebf('0x39')]['length'],'rows':_[_0xfebf('0x2e')](_0x424a78[_0xfebf('0x39')],function(_0x5a4881){return{'id':_0x5a4881['name'],'name':_0x5a4881['label'],'custom':_0x5a4881[_0xfebf('0x75')],'options':_0x5a4881[_0xfebf('0x76')][_0xfebf('0x3a')]>0x0?_[_0xfebf('0x2e')](_0x5a4881[_0xfebf('0x76')],function(_0x1c9a8a){return{'name':_0x1c9a8a[_0xfebf('0x77')],'value':_0x1c9a8a[_0xfebf('0x78')]};}):_0x5a4881[_0xfebf('0x41')]=='boolean'?[{'name':_0xfebf('0x79'),'value':_0xfebf('0x7a')},{'name':_0xfebf('0x7b'),'value':_0xfebf('0x7c')}]:[]};})};}})['then'](respondWithResult(_0x4005a0,null))[_0xfebf('0x47')](function(_0x134b69){var _0x2aad58=_0x3bf68b[_0xfebf('0x34')]['test']?0x1f4:_0x134b69[_0xfebf('0x7d')]||0x1f4;logger[_0xfebf('0x7e')]('getFields,\x20%s,\x20%s,\x20%s',_0xfebf('0x5a'),_0x2aad58,JSON[_0xfebf('0x7f')](_0x134b69));delete _0x134b69[_0xfebf('0x2c')];if(_0x2aad58===0x191){_0x2aad58=0x190;}_0x4005a0[_0xfebf('0x1c')](_0x2aad58)[_0xfebf('0x80')](_0x3bf68b[_0xfebf('0x34')][_0xfebf('0x81')]?{'message':_0xfebf('0x82'),'statusCode':_0x134b69[_0xfebf('0x7d')]}:_0x134b69);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4c982dd..01d184a 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 _0xfb85=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x484ee5,_0x344666){var _0xc20ea0=function(_0x5b177a){while(--_0x5b177a){_0x484ee5['push'](_0x484ee5['shift']());}};_0xc20ea0(++_0x344666);}(_0xfb85,0x12e));var _0x5fb8=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xfb85[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x5fb8('0x0'));var util=require(_0x5fb8('0x1'));var logger=require(_0x5fb8('0x2'))(_0x5fb8('0x3'));var moment=require(_0x5fb8('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fb8('0x6'));var integrations=require(_0x5fb8('0x7'));module[_0x5fb8('0x8')]=function(_0x2bee8b,_0x5abea1){return _0x2bee8b[_0x5fb8('0x9')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf6=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3f877d,_0x375f8f){var _0x39557e=function(_0x42ec9d){while(--_0x42ec9d){_0x3f877d['push'](_0x3f877d['shift']());}};_0x39557e(++_0x375f8f);}(_0xaaf6,0x182));var _0x6aaf=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xaaf6[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require(_0x6aaf('0x0'));var util=require(_0x6aaf('0x1'));var logger=require(_0x6aaf('0x2'))(_0x6aaf('0x3'));var moment=require(_0x6aaf('0x4'));var BPromise=require('bluebird');var rp=require(_0x6aaf('0x5'));var fs=require('fs');var path=require(_0x6aaf('0x6'));var rimraf=require(_0x6aaf('0x7'));var config=require(_0x6aaf('0x8'));var attributes=require(_0x6aaf('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x6aaf('0xa')]=function(_0x56a41b,_0x59f26a){return _0x56a41b[_0x6aaf('0xb')](_0x6aaf('0xc'),attributes,{'tableName':_0x6aaf('0xd'),'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 ac1770f..47f69a5 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 _0x8671=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','include','map','model','attributes','then','debug','ShowSalesforceAccount','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x11a628,_0x12aa4a){var _0x4318fe=function(_0x5699d6){while(--_0x5699d6){_0x11a628['push'](_0x11a628['shift']());}};_0x4318fe(++_0x12aa4a);}(_0x8671,0x1ed));var _0x1867=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8671[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x1867('0x0'));var util=require('util');var moment=require(_0x1867('0x1'));var BPromise=require(_0x1867('0x2'));var rs=require(_0x1867('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1867('0x4'))['db'];var utils=require(_0x1867('0x5'));var logger=require(_0x1867('0x6'))(_0x1867('0x7'));var config=require('../../config/environment');var jayson=require(_0x1867('0x8'));var client=jayson['client'][_0x1867('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bd96d,_0x51a61b,_0x487c3f){return new BPromise(function(_0x4311f9,_0x448ac3){return client[_0x1867('0xa')](_0x3bd96d,_0x487c3f)['then'](function(_0x385ea2){logger[_0x1867('0xb')](_0x1867('0xc'),_0x51a61b,_0x1867('0xd'));logger['debug'](_0x1867('0xe'),_0x51a61b,_0x1867('0xd'),JSON[_0x1867('0xf')](_0x385ea2));if(_0x385ea2[_0x1867('0x10')]){if(_0x385ea2['error'][_0x1867('0x11')]===0x1f4){logger[_0x1867('0x10')](_0x1867('0xc'),_0x51a61b,_0x385ea2[_0x1867('0x10')][_0x1867('0x12')]);return _0x448ac3(_0x385ea2[_0x1867('0x10')][_0x1867('0x12')]);}logger[_0x1867('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x51a61b,_0x385ea2[_0x1867('0x10')][_0x1867('0x12')]);return _0x4311f9(_0x385ea2[_0x1867('0x10')]['message']);}else{logger[_0x1867('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x51a61b,_0x1867('0xd'));_0x4311f9(_0x385ea2[_0x1867('0x13')][_0x1867('0x12')]);}})[_0x1867('0x14')](function(_0x5da559){logger['error'](_0x1867('0xc'),_0x51a61b,_0x5da559);_0x448ac3(_0x5da559);});});}exports[_0x1867('0x15')]=function(_0x99a10){var _0x1e0ed5=this;return new Promise(function(_0x3f0cd0,_0x3df70b){return db[_0x1867('0x16')][_0x1867('0x17')]({'raw':_0x99a10['options']?_0x99a10['options']['raw']===undefined?!![]:![]:!![],'where':_0x99a10[_0x1867('0x18')]?_0x99a10[_0x1867('0x18')][_0x1867('0x19')]||null:null,'attributes':_0x99a10[_0x1867('0x18')]?_0x99a10[_0x1867('0x18')]['attributes']||null:null,'limit':_0x99a10[_0x1867('0x18')]?_0x99a10[_0x1867('0x18')][_0x1867('0x1a')]||null:null,'include':_0x99a10['options']?_0x99a10['options'][_0x1867('0x1b')]?_[_0x1867('0x1c')](_0x99a10[_0x1867('0x18')][_0x1867('0x1b')],function(_0x18138f){return{'model':db[_0x18138f[_0x1867('0x1d')]],'as':_0x18138f['as'],'attributes':_0x18138f[_0x1867('0x1e')],'include':_0x18138f['include']?_[_0x1867('0x1c')](_0x18138f[_0x1867('0x1b')],function(_0x324b1e){return{'model':db[_0x324b1e[_0x1867('0x1d')]],'as':_0x324b1e['as'],'attributes':_0x324b1e['attributes'],'include':_0x324b1e[_0x1867('0x1b')]?_[_0x1867('0x1c')](_0x324b1e[_0x1867('0x1b')],function(_0x26743c){return{'model':db[_0x26743c[_0x1867('0x1d')]],'as':_0x26743c['as'],'attributes':_0x26743c[_0x1867('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1867('0x1f')](function(_0x34fe96){logger['info'](_0x1867('0x15'),_0x99a10);logger[_0x1867('0x20')]('GetSalesforceAccount',_0x99a10,JSON[_0x1867('0xf')](_0x34fe96));_0x3f0cd0(_0x34fe96);})[_0x1867('0x14')](function(_0x20c188){logger[_0x1867('0x10')](_0x1867('0x15'),_0x20c188[_0x1867('0x12')],_0x99a10);_0x3df70b(_0x1e0ed5[_0x1867('0x10')](0x1f4,_0x20c188[_0x1867('0x12')]));});});};exports[_0x1867('0x21')]=function(_0x25a1b4){var _0x4ff044=this;return new Promise(function(_0x1cdd8d,_0x37c995){return db[_0x1867('0x16')][_0x1867('0x22')]({'raw':_0x25a1b4[_0x1867('0x18')]?_0x25a1b4[_0x1867('0x18')][_0x1867('0x23')]===undefined?!![]:![]:!![],'where':_0x25a1b4['options']?_0x25a1b4[_0x1867('0x18')][_0x1867('0x19')]||null:null,'attributes':_0x25a1b4['options']?_0x25a1b4['options'][_0x1867('0x1e')]||null:null,'include':_0x25a1b4[_0x1867('0x18')]?_0x25a1b4[_0x1867('0x18')][_0x1867('0x1b')]?_[_0x1867('0x1c')](_0x25a1b4[_0x1867('0x18')][_0x1867('0x1b')],function(_0x4d0d33){return{'model':db[_0x4d0d33[_0x1867('0x1d')]],'as':_0x4d0d33['as'],'attributes':_0x4d0d33[_0x1867('0x1e')],'include':_0x4d0d33[_0x1867('0x1b')]?_['map'](_0x4d0d33[_0x1867('0x1b')],function(_0x1ee98a){return{'model':db[_0x1ee98a[_0x1867('0x1d')]],'as':_0x1ee98a['as'],'attributes':_0x1ee98a['attributes'],'include':_0x1ee98a[_0x1867('0x1b')]?_[_0x1867('0x1c')](_0x1ee98a[_0x1867('0x1b')],function(_0x334358){return{'model':db[_0x334358[_0x1867('0x1d')]],'as':_0x334358['as'],'attributes':_0x334358[_0x1867('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1867('0x1f')](function(_0x47de62){logger['info'](_0x1867('0x21'),_0x25a1b4);logger[_0x1867('0x20')](_0x1867('0x21'),_0x25a1b4,JSON[_0x1867('0xf')](_0x47de62));_0x1cdd8d(_0x47de62);})['catch'](function(_0xdff708){logger[_0x1867('0x10')]('ShowSalesforceAccount',_0xdff708[_0x1867('0x12')],_0x25a1b4);_0x37c995(_0x4ff044[_0x1867('0x10')](0x1f4,_0xdff708[_0x1867('0x12')]));});});}; \ No newline at end of file +var _0xbdae=['attributes','SalesforceAccount','find','ShowSalesforceAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','options','raw','limit','include','map','model'];(function(_0x8e6b90,_0x56f1fc){var _0x5d42b5=function(_0x6f6de0){while(--_0x6f6de0){_0x8e6b90['push'](_0x8e6b90['shift']());}};_0x5d42b5(++_0x56f1fc);}(_0xbdae,0x114));var _0xebda=function(_0x12a657,_0x464430){_0x12a657=_0x12a657-0x0;var _0x499be4=_0xbdae[_0x12a657];return _0x499be4;};'use strict';var _=require(_0xebda('0x0'));var util=require(_0xebda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xebda('0x2'));var fs=require('fs');var Redis=require(_0xebda('0x3'));var db=require(_0xebda('0x4'))['db'];var utils=require(_0xebda('0x5'));var logger=require(_0xebda('0x6'))(_0xebda('0x7'));var config=require('../../config/environment');var jayson=require(_0xebda('0x8'));var client=jayson['client'][_0xebda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2896dc,_0xb20f12,_0x2850dc){return new BPromise(function(_0x90f32c,_0x23ceb9){return client[_0xebda('0xa')](_0x2896dc,_0x2850dc)[_0xebda('0xb')](function(_0x466787){logger[_0xebda('0xc')](_0xebda('0xd'),_0xb20f12,_0xebda('0xe'));logger[_0xebda('0xf')](_0xebda('0x10'),_0xb20f12,_0xebda('0xe'),JSON[_0xebda('0x11')](_0x466787));if(_0x466787['error']){if(_0x466787[_0xebda('0x12')][_0xebda('0x13')]===0x1f4){logger[_0xebda('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0xb20f12,_0x466787[_0xebda('0x12')][_0xebda('0x14')]);return _0x23ceb9(_0x466787[_0xebda('0x12')][_0xebda('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xb20f12,_0x466787['error']['message']);return _0x90f32c(_0x466787[_0xebda('0x12')][_0xebda('0x14')]);}else{logger[_0xebda('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0xb20f12,_0xebda('0xe'));_0x90f32c(_0x466787[_0xebda('0x15')][_0xebda('0x14')]);}})[_0xebda('0x16')](function(_0x213013){logger['error'](_0xebda('0xd'),_0xb20f12,_0x213013);_0x23ceb9(_0x213013);});});}exports[_0xebda('0x17')]=function(_0x251767){var _0x137349=this;return new Promise(function(_0x144091,_0xcdc896){return db['SalesforceAccount']['findAll']({'raw':_0x251767[_0xebda('0x18')]?_0x251767[_0xebda('0x18')][_0xebda('0x19')]===undefined?!![]:![]:!![],'where':_0x251767['options']?_0x251767[_0xebda('0x18')]['where']||null:null,'attributes':_0x251767[_0xebda('0x18')]?_0x251767[_0xebda('0x18')]['attributes']||null:null,'limit':_0x251767[_0xebda('0x18')]?_0x251767[_0xebda('0x18')][_0xebda('0x1a')]||null:null,'include':_0x251767['options']?_0x251767[_0xebda('0x18')][_0xebda('0x1b')]?_[_0xebda('0x1c')](_0x251767[_0xebda('0x18')][_0xebda('0x1b')],function(_0x118ece){return{'model':db[_0x118ece[_0xebda('0x1d')]],'as':_0x118ece['as'],'attributes':_0x118ece[_0xebda('0x1e')],'include':_0x118ece[_0xebda('0x1b')]?_['map'](_0x118ece[_0xebda('0x1b')],function(_0x21b585){return{'model':db[_0x21b585['model']],'as':_0x21b585['as'],'attributes':_0x21b585[_0xebda('0x1e')],'include':_0x21b585['include']?_[_0xebda('0x1c')](_0x21b585['include'],function(_0x4032cb){return{'model':db[_0x4032cb[_0xebda('0x1d')]],'as':_0x4032cb['as'],'attributes':_0x4032cb[_0xebda('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xebda('0xb')](function(_0x1bdd69){logger['info']('GetSalesforceAccount',_0x251767);logger[_0xebda('0xf')](_0xebda('0x17'),_0x251767,JSON[_0xebda('0x11')](_0x1bdd69));_0x144091(_0x1bdd69);})[_0xebda('0x16')](function(_0x55517d){logger[_0xebda('0x12')](_0xebda('0x17'),_0x55517d[_0xebda('0x14')],_0x251767);_0xcdc896(_0x137349['error'](0x1f4,_0x55517d[_0xebda('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x16be7d){var _0x40d843=this;return new Promise(function(_0x183dda,_0x3348aa){return db[_0xebda('0x1f')][_0xebda('0x20')]({'raw':_0x16be7d[_0xebda('0x18')]?_0x16be7d[_0xebda('0x18')][_0xebda('0x19')]===undefined?!![]:![]:!![],'where':_0x16be7d[_0xebda('0x18')]?_0x16be7d['options']['where']||null:null,'attributes':_0x16be7d[_0xebda('0x18')]?_0x16be7d['options']['attributes']||null:null,'include':_0x16be7d[_0xebda('0x18')]?_0x16be7d[_0xebda('0x18')]['include']?_[_0xebda('0x1c')](_0x16be7d[_0xebda('0x18')]['include'],function(_0x4c8f43){return{'model':db[_0x4c8f43[_0xebda('0x1d')]],'as':_0x4c8f43['as'],'attributes':_0x4c8f43[_0xebda('0x1e')],'include':_0x4c8f43[_0xebda('0x1b')]?_[_0xebda('0x1c')](_0x4c8f43[_0xebda('0x1b')],function(_0x58e04f){return{'model':db[_0x58e04f['model']],'as':_0x58e04f['as'],'attributes':_0x58e04f[_0xebda('0x1e')],'include':_0x58e04f[_0xebda('0x1b')]?_[_0xebda('0x1c')](_0x58e04f[_0xebda('0x1b')],function(_0x31d90f){return{'model':db[_0x31d90f[_0xebda('0x1d')]],'as':_0x31d90f['as'],'attributes':_0x31d90f[_0xebda('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xebda('0xb')](function(_0x10e3d3){logger[_0xebda('0xc')](_0xebda('0x21'),_0x16be7d);logger[_0xebda('0xf')](_0xebda('0x21'),_0x16be7d,JSON[_0xebda('0x11')](_0x10e3d3));_0x183dda(_0x10e3d3);})[_0xebda('0x16')](function(_0xb88c87){logger['error'](_0xebda('0x21'),_0xb88c87[_0xebda('0x14')],_0x16be7d);_0x3348aa(_0x40d843[_0xebda('0x12')](0x1f4,_0xb88c87['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5de2cee..49c6fd3 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x4c83fe,_0x18c36f){var _0x4a2224=function(_0x2957cd){while(--_0x2957cd){_0x4c83fe['push'](_0x4c83fe['shift']());}};_0x4a2224(++_0x18c36f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +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(_0x1d6019,_0xea35ce){var _0x12d3a3=function(_0x1cdf3d){while(--_0x1cdf3d){_0x1d6019['push'](_0x1d6019['shift']());}};_0x12d3a3(++_0xea35ce);}(_0x2ef3,0xba));var _0x32ef=function(_0x286e41,_0x3c7274){_0x286e41=_0x286e41-0x0;var _0x1f5717=_0x2ef3[_0x286e41];return _0x1f5717;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a939dde..93ce946 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 _0x9ebf=['nothing','sequelize','exports','STRING','Case','Task','contact','lead','account','contact_lead','ENUM'];(function(_0x12736b,_0x38b94f){var _0x1580a6=function(_0x29170d){while(--_0x29170d){_0x12736b['push'](_0x12736b['shift']());}};_0x1580a6(++_0x38b94f);}(_0x9ebf,0x9b));var _0xf9eb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9ebf[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xf9eb('0x0'));module[_0xf9eb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf9eb('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0xf9eb('0x3')),'defaultValue':_0xf9eb('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xf9eb('0x5'),_0xf9eb('0x6'),'account_contact_lead',_0xf9eb('0x7')),'defaultValue':_0xf9eb('0x8')},'moduleCreate':{'type':Sequelize[_0xf9eb('0x9')](_0xf9eb('0xa'),_0xf9eb('0x5'),'lead',_0xf9eb('0x7')),'defaultValue':_0xf9eb('0x6')},'leadId':{'type':Sequelize[_0xf9eb('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xf9eb('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xf9eb('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xf9eb('0x2')]}}; \ No newline at end of file +var _0xf1f9=['exports','STRING','ENUM','Case','Task','contact_lead','contact','lead','nothing','account','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x4ccec4,_0x4747fd){_0x4ccec4=_0x4ccec4-0x0;var _0x352fb8=_0xf1f9[_0x4ccec4];return _0x352fb8;};'use strict';var Sequelize=require(_0x9f1f('0x0'));module[_0x9f1f('0x1')]={'name':{'type':Sequelize[_0x9f1f('0x2')]},'description':{'type':Sequelize[_0x9f1f('0x2')]},'ticketType':{'type':Sequelize[_0x9f1f('0x3')]('Task',_0x9f1f('0x4')),'defaultValue':_0x9f1f('0x5')},'moduleSearch':{'type':Sequelize[_0x9f1f('0x3')](_0x9f1f('0x6'),_0x9f1f('0x7'),_0x9f1f('0x8'),'account_contact_lead','account'),'defaultValue':_0x9f1f('0x6')},'moduleCreate':{'type':Sequelize[_0x9f1f('0x3')](_0x9f1f('0x9'),_0x9f1f('0x7'),'lead',_0x9f1f('0xa')),'defaultValue':_0x9f1f('0x8')},'leadId':{'type':Sequelize[_0x9f1f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9f1f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x9f1f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x9f1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 857863c..35d9fc5 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 _0x0bb2=['update','then','error','stack','name','index','SalesforceConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','destroy','getFields','findOne','SalesforceField','order','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x0bb2,0x179));var _0x20bb=function(_0x142a3d,_0x3281ff){_0x142a3d=_0x142a3d-0x0;var _0x3cb586=_0x0bb2[_0x142a3d];return _0x3cb586;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20bb('0x0'));var zipdir=require(_0x20bb('0x1'));var jsonpatch=require(_0x20bb('0x2'));var rp=require(_0x20bb('0x3'));var moment=require(_0x20bb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20bb('0x5'));var util=require(_0x20bb('0x6'));var path=require(_0x20bb('0x7'));var sox=require(_0x20bb('0x8'));var csv=require(_0x20bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20bb('0xa'));var _=require(_0x20bb('0xb'));var squel=require(_0x20bb('0xc'));var crypto=require(_0x20bb('0xd'));var jsforce=require(_0x20bb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x20bb('0xf'));var Redis=require(_0x20bb('0x10'));var authService=require(_0x20bb('0x11'));var qs=require(_0x20bb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20bb('0x13'));var logger=require(_0x20bb('0x14'))(_0x20bb('0x15'));var utils=require(_0x20bb('0x16'));var config=require(_0x20bb('0x17'));var licenseUtil=require(_0x20bb('0x18'));var db=require(_0x20bb('0x19'))['db'];function respondWithStatusCode(_0x40c158,_0xa0c393){_0xa0c393=_0xa0c393||0xcc;return function(_0x53e94d){if(_0x53e94d){return _0x40c158[_0x20bb('0x1a')](_0xa0c393);}return _0x40c158[_0x20bb('0x1b')](_0xa0c393)[_0x20bb('0x1c')]();};}function respondWithResult(_0x1e7dbc,_0x343e5c){_0x343e5c=_0x343e5c||0xc8;return function(_0x211efc){if(_0x211efc){return _0x1e7dbc[_0x20bb('0x1b')](_0x343e5c)[_0x20bb('0x1d')](_0x211efc);}};}function respondWithFilteredResult(_0x5ada20,_0x519915){return function(_0x206f5c){if(_0x206f5c){var _0x1ae550=typeof _0x519915[_0x20bb('0x1e')]===_0x20bb('0x1f')&&typeof _0x519915[_0x20bb('0x20')]===_0x20bb('0x1f');var _0xe8110f=_0x206f5c[_0x20bb('0x21')];var _0xc96d8d=_0x1ae550?0x0:_0x519915[_0x20bb('0x1e')];var _0x1bd1f0=_0x1ae550?_0x206f5c[_0x20bb('0x21')]:_0x519915['offset']+_0x519915['limit'];var _0x294fbf;if(_0x1bd1f0>=_0xe8110f){_0x1bd1f0=_0xe8110f;_0x294fbf=0xc8;}else{_0x294fbf=0xce;}_0x5ada20[_0x20bb('0x1b')](_0x294fbf);return _0x5ada20['set'](_0x20bb('0x22'),_0xc96d8d+'-'+_0x1bd1f0+'/'+_0xe8110f)[_0x20bb('0x1d')](_0x206f5c);}return null;};}function patchUpdates(_0x3cd5d4){return function(_0x2cd480){try{jsonpatch[_0x20bb('0x23')](_0x2cd480,_0x3cd5d4,!![]);}catch(_0x4b01ff){return BPromise[_0x20bb('0x24')](_0x4b01ff);}return _0x2cd480[_0x20bb('0x25')]();};}function saveUpdates(_0x581a33,_0x49a46a){return function(_0xc2a351){if(_0xc2a351){return _0xc2a351[_0x20bb('0x26')](_0x581a33)[_0x20bb('0x27')](function(_0x55a5db){return _0x55a5db;});}return null;};}function removeEntity(_0x2fb9bc,_0xd232d1){return function(_0x405d65){if(_0x405d65){return _0x405d65['destroy']()[_0x20bb('0x27')](function(){_0x2fb9bc[_0x20bb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a466,_0x14b9d2){return function(_0x14ae59){if(!_0x14ae59){_0x23a466[_0x20bb('0x1a')](0x194);}return _0x14ae59;};}function handleError(_0x2bd9f0,_0x5ceefc){_0x5ceefc=_0x5ceefc||0x1f4;return function(_0x5c73c2){logger[_0x20bb('0x28')](_0x5c73c2[_0x20bb('0x29')]);if(_0x5c73c2['name']){delete _0x5c73c2[_0x20bb('0x2a')];}_0x2bd9f0['status'](_0x5ceefc)['send'](_0x5c73c2);};}exports[_0x20bb('0x2b')]=function(_0x30e1e9,_0x5a253f){var _0x341674={},_0x25f920={},_0x493d63={'count':0x0,'rows':[]};var _0x2192b1=_['map'](db[_0x20bb('0x2c')]['rawAttributes'],function(_0x67e2df){return{'name':_0x67e2df[_0x20bb('0x2d')],'type':_0x67e2df[_0x20bb('0x2e')][_0x20bb('0x2f')]};});_0x25f920[_0x20bb('0x30')]=_['map'](_0x2192b1,_0x20bb('0x2a'));_0x25f920['query']=_['keys'](_0x30e1e9[_0x20bb('0x31')]);_0x25f920[_0x20bb('0x32')]=_[_0x20bb('0x33')](_0x25f920[_0x20bb('0x30')],_0x25f920[_0x20bb('0x31')]);_0x341674['attributes']=_['intersection'](_0x25f920[_0x20bb('0x30')],qs['fields'](_0x30e1e9[_0x20bb('0x31')][_0x20bb('0x34')]));_0x341674[_0x20bb('0x35')]=_0x341674[_0x20bb('0x35')]['length']?_0x341674[_0x20bb('0x35')]:_0x25f920[_0x20bb('0x30')];if(!_0x30e1e9['query']['hasOwnProperty'](_0x20bb('0x36'))){_0x341674[_0x20bb('0x20')]=qs[_0x20bb('0x20')](_0x30e1e9[_0x20bb('0x31')][_0x20bb('0x20')]);_0x341674[_0x20bb('0x1e')]=qs[_0x20bb('0x1e')](_0x30e1e9[_0x20bb('0x31')][_0x20bb('0x1e')]);}_0x341674['order']=qs[_0x20bb('0x37')](_0x30e1e9[_0x20bb('0x31')][_0x20bb('0x37')]);_0x341674['where']=qs[_0x20bb('0x32')](_[_0x20bb('0x38')](_0x30e1e9[_0x20bb('0x31')],_0x25f920['filters']),_0x2192b1);if(_0x30e1e9[_0x20bb('0x31')][_0x20bb('0x39')]){_0x341674[_0x20bb('0x3a')]=_['merge'](_0x341674[_0x20bb('0x3a')],{'$or':_[_0x20bb('0x3b')](_0x2192b1,function(_0x1dc0ef){if(_0x1dc0ef[_0x20bb('0x2e')]!==_0x20bb('0x3c')){var _0x56cac2={};_0x56cac2[_0x1dc0ef[_0x20bb('0x2a')]]={'$like':'%'+_0x30e1e9['query'][_0x20bb('0x39')]+'%'};return _0x56cac2;}})});}_0x341674=_[_0x20bb('0x3d')]({},_0x341674,_0x30e1e9[_0x20bb('0x3e')]);var _0x4d9bba={'where':_0x341674[_0x20bb('0x3a')]};return db[_0x20bb('0x2c')][_0x20bb('0x21')](_0x4d9bba)[_0x20bb('0x27')](function(_0xf866d7){_0x493d63[_0x20bb('0x21')]=_0xf866d7;if(_0x30e1e9['query'][_0x20bb('0x3f')]){_0x341674[_0x20bb('0x40')]=[{'all':!![]}];}return db[_0x20bb('0x2c')]['findAll'](_0x341674);})[_0x20bb('0x27')](function(_0xafa8d7){_0x493d63[_0x20bb('0x41')]=_0xafa8d7;return _0x493d63;})[_0x20bb('0x27')](respondWithFilteredResult(_0x5a253f,_0x341674))[_0x20bb('0x42')](handleError(_0x5a253f,null));};exports[_0x20bb('0x43')]=function(_0x2686f7,_0x554285){var _0x2a03a8={'raw':![],'where':{'id':_0x2686f7[_0x20bb('0x44')]['id']}},_0x22459d={};_0x22459d[_0x20bb('0x30')]=_[_0x20bb('0x45')](db[_0x20bb('0x2c')][_0x20bb('0x46')]);_0x22459d[_0x20bb('0x31')]=_['keys'](_0x2686f7[_0x20bb('0x31')]);_0x22459d[_0x20bb('0x32')]=_['intersection'](_0x22459d[_0x20bb('0x30')],_0x22459d[_0x20bb('0x31')]);_0x2a03a8[_0x20bb('0x35')]=_[_0x20bb('0x33')](_0x22459d[_0x20bb('0x30')],qs[_0x20bb('0x34')](_0x2686f7[_0x20bb('0x31')][_0x20bb('0x34')]));_0x2a03a8['attributes']=_0x2a03a8[_0x20bb('0x35')][_0x20bb('0x47')]?_0x2a03a8['attributes']:_0x22459d[_0x20bb('0x30')];if(_0x2686f7[_0x20bb('0x31')]['includeAll']){_0x2a03a8[_0x20bb('0x40')]=[{'all':!![]}];}_0x2a03a8=_[_0x20bb('0x3d')]({},_0x2a03a8,_0x2686f7[_0x20bb('0x3e')]);return db[_0x20bb('0x2c')][_0x20bb('0x48')](_0x2a03a8)[_0x20bb('0x27')](handleEntityNotFound(_0x554285,null))[_0x20bb('0x27')](respondWithResult(_0x554285,null))[_0x20bb('0x42')](handleError(_0x554285,null));};exports['create']=function(_0x16c33d,_0x15c9af){return db[_0x20bb('0x2c')][_0x20bb('0x49')](_0x16c33d[_0x20bb('0x4a')],{})[_0x20bb('0x27')](respondWithResult(_0x15c9af,0xc9))['catch'](handleError(_0x15c9af,null));};exports['update']=function(_0x1c8d86,_0x461568){if(_0x1c8d86[_0x20bb('0x4a')]['id']){delete _0x1c8d86['body']['id'];}return db['SalesforceConfiguration'][_0x20bb('0x48')]({'where':{'id':_0x1c8d86[_0x20bb('0x44')]['id']}})[_0x20bb('0x27')](handleEntityNotFound(_0x461568,null))[_0x20bb('0x27')](saveUpdates(_0x1c8d86[_0x20bb('0x4a')],null))[_0x20bb('0x27')](respondWithResult(_0x461568,null))['catch'](handleError(_0x461568,null));};exports[_0x20bb('0x4b')]=function(_0x5c5031,_0xd645cf){return db[_0x20bb('0x2c')][_0x20bb('0x48')]({'where':{'id':_0x5c5031['params']['id']}})[_0x20bb('0x27')](handleEntityNotFound(_0xd645cf,null))[_0x20bb('0x27')](removeEntity(_0xd645cf,null))['catch'](handleError(_0xd645cf,null));};exports[_0x20bb('0x4c')]=function(_0x5e48e0,_0x19a080,_0xb9b408){var _0x3ba2cf={};var _0x37c0d4={};var _0x27bdb3;var _0x7228c7;return db[_0x20bb('0x2c')][_0x20bb('0x4d')]({'where':{'id':_0x5e48e0['params']['id']}})[_0x20bb('0x27')](handleEntityNotFound(_0x19a080,null))[_0x20bb('0x27')](function(_0x526e8b){if(_0x526e8b){_0x27bdb3=_0x526e8b;_0x37c0d4[_0x20bb('0x30')]=_[_0x20bb('0x45')](db[_0x20bb('0x4e')][_0x20bb('0x46')]);_0x37c0d4[_0x20bb('0x31')]=_[_0x20bb('0x45')](_0x5e48e0[_0x20bb('0x31')]);_0x37c0d4['filters']=_['intersection'](_0x37c0d4[_0x20bb('0x30')],_0x37c0d4[_0x20bb('0x31')]);_0x3ba2cf[_0x20bb('0x35')]=_[_0x20bb('0x33')](_0x37c0d4['model'],qs['fields'](_0x5e48e0['query'][_0x20bb('0x34')]));_0x3ba2cf[_0x20bb('0x35')]=_0x3ba2cf['attributes']['length']?_0x3ba2cf['attributes']:_0x37c0d4[_0x20bb('0x30')];_0x3ba2cf[_0x20bb('0x4f')]=qs[_0x20bb('0x37')](_0x5e48e0[_0x20bb('0x31')]['sort']);_0x3ba2cf['where']=qs[_0x20bb('0x32')](_[_0x20bb('0x38')](_0x5e48e0['query'],_0x37c0d4[_0x20bb('0x32')]));if(_0x5e48e0[_0x20bb('0x31')]['filter']){_0x3ba2cf[_0x20bb('0x3a')]=_[_0x20bb('0x3d')](_0x3ba2cf[_0x20bb('0x3a')],{'$or':_[_0x20bb('0x3b')](_0x3ba2cf['attributes'],function(_0x362307){var _0x40063b={};_0x40063b[_0x362307]={'$like':'%'+_0x5e48e0['query'][_0x20bb('0x39')]+'%'};return _0x40063b;})});}_0x3ba2cf=_['merge']({},_0x3ba2cf,_0x5e48e0[_0x20bb('0x3e')]);return _0x27bdb3[_0x20bb('0x4c')](_0x3ba2cf);}})[_0x20bb('0x27')](function(_0x234559){if(_0x234559){_0x7228c7=_0x234559['length'];if(!_0x5e48e0[_0x20bb('0x31')]['hasOwnProperty'](_0x20bb('0x36'))){_0x3ba2cf[_0x20bb('0x20')]=qs[_0x20bb('0x20')](_0x5e48e0['query']['limit']);_0x3ba2cf[_0x20bb('0x1e')]=qs[_0x20bb('0x1e')](_0x5e48e0[_0x20bb('0x31')][_0x20bb('0x1e')]);}return _0x27bdb3[_0x20bb('0x4c')](_0x3ba2cf);}})[_0x20bb('0x27')](function(_0x3cb028){if(_0x3cb028){return _0x3cb028?{'count':_0x7228c7,'rows':_0x3cb028}:null;}})[_0x20bb('0x27')](respondWithResult(_0x19a080,null))[_0x20bb('0x42')](handleError(_0x19a080,null));};exports[_0x20bb('0x50')]=function(_0x2f99bd,_0xad680d,_0x423fa2){var _0x538c96={};var _0x2cd6d3={};var _0xc11e05;var _0x21a922;return db[_0x20bb('0x2c')]['findOne']({'where':{'id':_0x2f99bd[_0x20bb('0x44')]['id']}})[_0x20bb('0x27')](handleEntityNotFound(_0xad680d,null))[_0x20bb('0x27')](function(_0x9a557b){if(_0x9a557b){_0xc11e05=_0x9a557b;_0x2cd6d3[_0x20bb('0x30')]=_[_0x20bb('0x45')](db[_0x20bb('0x4e')][_0x20bb('0x46')]);_0x2cd6d3[_0x20bb('0x31')]=_[_0x20bb('0x45')](_0x2f99bd[_0x20bb('0x31')]);_0x2cd6d3[_0x20bb('0x32')]=_[_0x20bb('0x33')](_0x2cd6d3[_0x20bb('0x30')],_0x2cd6d3[_0x20bb('0x31')]);_0x538c96[_0x20bb('0x35')]=_[_0x20bb('0x33')](_0x2cd6d3['model'],qs['fields'](_0x2f99bd[_0x20bb('0x31')][_0x20bb('0x34')]));_0x538c96[_0x20bb('0x35')]=_0x538c96[_0x20bb('0x35')][_0x20bb('0x47')]?_0x538c96[_0x20bb('0x35')]:_0x2cd6d3[_0x20bb('0x30')];_0x538c96[_0x20bb('0x4f')]=qs['sort'](_0x2f99bd[_0x20bb('0x31')][_0x20bb('0x37')]);_0x538c96['where']=qs[_0x20bb('0x32')](_['pick'](_0x2f99bd[_0x20bb('0x31')],_0x2cd6d3[_0x20bb('0x32')]));if(_0x2f99bd[_0x20bb('0x31')][_0x20bb('0x39')]){_0x538c96['where']=_['merge'](_0x538c96[_0x20bb('0x3a')],{'$or':_[_0x20bb('0x3b')](_0x538c96[_0x20bb('0x35')],function(_0x26ca5e){var _0x114ce5={};_0x114ce5[_0x26ca5e]={'$like':'%'+_0x2f99bd[_0x20bb('0x31')][_0x20bb('0x39')]+'%'};return _0x114ce5;})});}_0x538c96=_[_0x20bb('0x3d')]({},_0x538c96,_0x2f99bd[_0x20bb('0x3e')]);return _0xc11e05[_0x20bb('0x50')](_0x538c96);}})[_0x20bb('0x27')](function(_0x3412bc){if(_0x3412bc){_0x21a922=_0x3412bc[_0x20bb('0x47')];if(!_0x2f99bd[_0x20bb('0x31')][_0x20bb('0x51')](_0x20bb('0x36'))){_0x538c96['limit']=qs['limit'](_0x2f99bd[_0x20bb('0x31')]['limit']);_0x538c96[_0x20bb('0x1e')]=qs[_0x20bb('0x1e')](_0x2f99bd['query'][_0x20bb('0x1e')]);}return _0xc11e05['getSubjects'](_0x538c96);}})[_0x20bb('0x27')](function(_0x51f6b4){if(_0x51f6b4){return _0x51f6b4?{'count':_0x21a922,'rows':_0x51f6b4}:null;}})[_0x20bb('0x27')](respondWithResult(_0xad680d,null))[_0x20bb('0x42')](handleError(_0xad680d,null));};exports[_0x20bb('0x52')]=function(_0x104d85,_0x3882c4,_0x320852){var _0x44fde0={};var _0x1467ab={};var _0x5f216e;var _0x49ac61;return db[_0x20bb('0x2c')][_0x20bb('0x4d')]({'where':{'id':_0x104d85[_0x20bb('0x44')]['id']}})[_0x20bb('0x27')](handleEntityNotFound(_0x3882c4,null))[_0x20bb('0x27')](function(_0x3e4edf){if(_0x3e4edf){_0x5f216e=_0x3e4edf;_0x1467ab['model']=_[_0x20bb('0x45')](db[_0x20bb('0x4e')][_0x20bb('0x46')]);_0x1467ab[_0x20bb('0x31')]=_[_0x20bb('0x45')](_0x104d85[_0x20bb('0x31')]);_0x1467ab[_0x20bb('0x32')]=_[_0x20bb('0x33')](_0x1467ab[_0x20bb('0x30')],_0x1467ab['query']);_0x44fde0[_0x20bb('0x35')]=_['intersection'](_0x1467ab[_0x20bb('0x30')],qs['fields'](_0x104d85[_0x20bb('0x31')][_0x20bb('0x34')]));_0x44fde0[_0x20bb('0x35')]=_0x44fde0[_0x20bb('0x35')][_0x20bb('0x47')]?_0x44fde0[_0x20bb('0x35')]:_0x1467ab[_0x20bb('0x30')];_0x44fde0[_0x20bb('0x4f')]=qs[_0x20bb('0x37')](_0x104d85[_0x20bb('0x31')][_0x20bb('0x37')]);_0x44fde0['where']=qs[_0x20bb('0x32')](_['pick'](_0x104d85['query'],_0x1467ab[_0x20bb('0x32')]));if(_0x104d85[_0x20bb('0x31')][_0x20bb('0x39')]){_0x44fde0[_0x20bb('0x3a')]=_[_0x20bb('0x3d')](_0x44fde0[_0x20bb('0x3a')],{'$or':_[_0x20bb('0x3b')](_0x44fde0[_0x20bb('0x35')],function(_0x2b8fe8){var _0x88e585={};_0x88e585[_0x2b8fe8]={'$like':'%'+_0x104d85[_0x20bb('0x31')][_0x20bb('0x39')]+'%'};return _0x88e585;})});}_0x44fde0=_['merge']({},_0x44fde0,_0x104d85['options']);return _0x5f216e[_0x20bb('0x52')](_0x44fde0);}})['then'](function(_0x489084){if(_0x489084){_0x49ac61=_0x489084[_0x20bb('0x47')];if(!_0x104d85[_0x20bb('0x31')][_0x20bb('0x51')](_0x20bb('0x36'))){_0x44fde0['limit']=qs[_0x20bb('0x20')](_0x104d85['query'][_0x20bb('0x20')]);_0x44fde0[_0x20bb('0x1e')]=qs[_0x20bb('0x1e')](_0x104d85[_0x20bb('0x31')][_0x20bb('0x1e')]);}return _0x5f216e[_0x20bb('0x52')](_0x44fde0);}})[_0x20bb('0x27')](function(_0x2ffc9b){if(_0x2ffc9b){return _0x2ffc9b?{'count':_0x49ac61,'rows':_0x2ffc9b}:null;}})[_0x20bb('0x27')](respondWithResult(_0x3882c4,null))[_0x20bb('0x42')](handleError(_0x3882c4,null));}; \ No newline at end of file +var _0x1867=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','SalesforceField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment'];(function(_0x8519ea,_0x35dfa4){var _0x58a8aa=function(_0x47fda7){while(--_0x47fda7){_0x8519ea['push'](_0x8519ea['shift']());}};_0x58a8aa(++_0x35dfa4);}(_0x1867,0x134));var _0x7186=function(_0x431f30,_0x2c69ba){_0x431f30=_0x431f30-0x0;var _0x1b1e84=_0x1867[_0x431f30];return _0x1b1e84;};'use strict';var emlformat=require(_0x7186('0x0'));var rimraf=require(_0x7186('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7186('0x2'));var moment=require(_0x7186('0x3'));var BPromise=require(_0x7186('0x4'));var Mustache=require(_0x7186('0x5'));var util=require(_0x7186('0x6'));var path=require(_0x7186('0x7'));var sox=require(_0x7186('0x8'));var csv=require('to-csv');var ejs=require(_0x7186('0x9'));var fs=require('fs');var fs_extra=require(_0x7186('0xa'));var _=require(_0x7186('0xb'));var squel=require(_0x7186('0xc'));var crypto=require(_0x7186('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7186('0xe'));var toCsv=require(_0x7186('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7186('0x10'));var as=require(_0x7186('0x11'));var hardwareService=require(_0x7186('0x12'));var logger=require(_0x7186('0x13'))(_0x7186('0x14'));var utils=require('../../config/utils');var config=require(_0x7186('0x15'));var licenseUtil=require(_0x7186('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c284b,_0x19b3d0){_0x19b3d0=_0x19b3d0||0xcc;return function(_0x8c3590){if(_0x8c3590){return _0x4c284b[_0x7186('0x17')](_0x19b3d0);}return _0x4c284b[_0x7186('0x18')](_0x19b3d0)[_0x7186('0x19')]();};}function respondWithResult(_0x1e8c3e,_0x5925de){_0x5925de=_0x5925de||0xc8;return function(_0x40cb6f){if(_0x40cb6f){return _0x1e8c3e[_0x7186('0x18')](_0x5925de)['json'](_0x40cb6f);}};}function respondWithFilteredResult(_0x511705,_0x1a2857){return function(_0x3cdad1){if(_0x3cdad1){var _0x538096=typeof _0x1a2857[_0x7186('0x1a')]==='undefined'&&typeof _0x1a2857[_0x7186('0x1b')]===_0x7186('0x1c');var _0x59d6b3=_0x3cdad1['count'];var _0x5a0f05=_0x538096?0x0:_0x1a2857[_0x7186('0x1a')];var _0x243b23=_0x538096?_0x3cdad1[_0x7186('0x1d')]:_0x1a2857['offset']+_0x1a2857['limit'];var _0x2afbcb;if(_0x243b23>=_0x59d6b3){_0x243b23=_0x59d6b3;_0x2afbcb=0xc8;}else{_0x2afbcb=0xce;}_0x511705[_0x7186('0x18')](_0x2afbcb);return _0x511705[_0x7186('0x1e')]('Content-Range',_0x5a0f05+'-'+_0x243b23+'/'+_0x59d6b3)[_0x7186('0x1f')](_0x3cdad1);}return null;};}function patchUpdates(_0x5c524c){return function(_0x450e1c){try{jsonpatch['apply'](_0x450e1c,_0x5c524c,!![]);}catch(_0x325979){return BPromise[_0x7186('0x20')](_0x325979);}return _0x450e1c['save']();};}function saveUpdates(_0x1aec53,_0xcf00b5){return function(_0x35ffb2){if(_0x35ffb2){return _0x35ffb2[_0x7186('0x21')](_0x1aec53)[_0x7186('0x22')](function(_0x36e503){return _0x36e503;});}return null;};}function removeEntity(_0x1475c7,_0x4dc25d){return function(_0x2b64b4){if(_0x2b64b4){return _0x2b64b4[_0x7186('0x23')]()['then'](function(){_0x1475c7['status'](0xcc)[_0x7186('0x19')]();});}};}function handleEntityNotFound(_0x146dab,_0x54036c){return function(_0x25f6d1){if(!_0x25f6d1){_0x146dab[_0x7186('0x17')](0x194);}return _0x25f6d1;};}function handleError(_0x1cdc20,_0x32f1a5){_0x32f1a5=_0x32f1a5||0x1f4;return function(_0x5716d5){logger[_0x7186('0x24')](_0x5716d5[_0x7186('0x25')]);if(_0x5716d5[_0x7186('0x26')]){delete _0x5716d5['name'];}_0x1cdc20[_0x7186('0x18')](_0x32f1a5)['send'](_0x5716d5);};}exports[_0x7186('0x27')]=function(_0x568a56,_0x113964){var _0x1cb58a={},_0x5a7179={},_0x75e5d8={'count':0x0,'rows':[]};var _0x3629f6=_[_0x7186('0x28')](db[_0x7186('0x29')][_0x7186('0x2a')],function(_0x211db7){return{'name':_0x211db7[_0x7186('0x2b')],'type':_0x211db7[_0x7186('0x2c')][_0x7186('0x2d')]};});_0x5a7179[_0x7186('0x2e')]=_[_0x7186('0x28')](_0x3629f6,_0x7186('0x26'));_0x5a7179['query']=_[_0x7186('0x2f')](_0x568a56[_0x7186('0x30')]);_0x5a7179['filters']=_[_0x7186('0x31')](_0x5a7179[_0x7186('0x2e')],_0x5a7179[_0x7186('0x30')]);_0x1cb58a[_0x7186('0x32')]=_[_0x7186('0x31')](_0x5a7179[_0x7186('0x2e')],qs[_0x7186('0x33')](_0x568a56[_0x7186('0x30')]['fields']));_0x1cb58a['attributes']=_0x1cb58a[_0x7186('0x32')][_0x7186('0x34')]?_0x1cb58a['attributes']:_0x5a7179[_0x7186('0x2e')];if(!_0x568a56['query'][_0x7186('0x35')](_0x7186('0x36'))){_0x1cb58a[_0x7186('0x1b')]=qs['limit'](_0x568a56[_0x7186('0x30')][_0x7186('0x1b')]);_0x1cb58a[_0x7186('0x1a')]=qs[_0x7186('0x1a')](_0x568a56[_0x7186('0x30')][_0x7186('0x1a')]);}_0x1cb58a[_0x7186('0x37')]=qs['sort'](_0x568a56[_0x7186('0x30')][_0x7186('0x38')]);_0x1cb58a['where']=qs['filters'](_['pick'](_0x568a56[_0x7186('0x30')],_0x5a7179[_0x7186('0x39')]),_0x3629f6);if(_0x568a56[_0x7186('0x30')][_0x7186('0x3a')]){_0x1cb58a[_0x7186('0x3b')]=_[_0x7186('0x3c')](_0x1cb58a[_0x7186('0x3b')],{'$or':_[_0x7186('0x28')](_0x3629f6,function(_0x102142){if(_0x102142[_0x7186('0x2c')]!==_0x7186('0x3d')){var _0x3fa616={};_0x3fa616[_0x102142[_0x7186('0x26')]]={'$like':'%'+_0x568a56['query'][_0x7186('0x3a')]+'%'};return _0x3fa616;}})});}_0x1cb58a=_[_0x7186('0x3c')]({},_0x1cb58a,_0x568a56[_0x7186('0x3e')]);var _0x5b541c={'where':_0x1cb58a[_0x7186('0x3b')]};return db[_0x7186('0x29')]['count'](_0x5b541c)[_0x7186('0x22')](function(_0x5c4e93){_0x75e5d8[_0x7186('0x1d')]=_0x5c4e93;if(_0x568a56[_0x7186('0x30')][_0x7186('0x3f')]){_0x1cb58a[_0x7186('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7186('0x41')](_0x1cb58a);})[_0x7186('0x22')](function(_0x3c9697){_0x75e5d8[_0x7186('0x42')]=_0x3c9697;return _0x75e5d8;})[_0x7186('0x22')](respondWithFilteredResult(_0x113964,_0x1cb58a))[_0x7186('0x43')](handleError(_0x113964,null));};exports['show']=function(_0x5a8bda,_0x29c4c1){var _0x43247f={'raw':![],'where':{'id':_0x5a8bda[_0x7186('0x44')]['id']}},_0x5a4e54={};_0x5a4e54[_0x7186('0x2e')]=_['keys'](db[_0x7186('0x29')][_0x7186('0x2a')]);_0x5a4e54[_0x7186('0x30')]=_[_0x7186('0x2f')](_0x5a8bda[_0x7186('0x30')]);_0x5a4e54['filters']=_[_0x7186('0x31')](_0x5a4e54[_0x7186('0x2e')],_0x5a4e54['query']);_0x43247f[_0x7186('0x32')]=_[_0x7186('0x31')](_0x5a4e54[_0x7186('0x2e')],qs['fields'](_0x5a8bda[_0x7186('0x30')][_0x7186('0x33')]));_0x43247f[_0x7186('0x32')]=_0x43247f[_0x7186('0x32')][_0x7186('0x34')]?_0x43247f[_0x7186('0x32')]:_0x5a4e54[_0x7186('0x2e')];if(_0x5a8bda['query'][_0x7186('0x3f')]){_0x43247f[_0x7186('0x40')]=[{'all':!![]}];}_0x43247f=_[_0x7186('0x3c')]({},_0x43247f,_0x5a8bda[_0x7186('0x3e')]);return db['SalesforceConfiguration'][_0x7186('0x45')](_0x43247f)['then'](handleEntityNotFound(_0x29c4c1,null))[_0x7186('0x22')](respondWithResult(_0x29c4c1,null))[_0x7186('0x43')](handleError(_0x29c4c1,null));};exports[_0x7186('0x46')]=function(_0x3fc072,_0x3163af){return db[_0x7186('0x29')]['create'](_0x3fc072[_0x7186('0x47')],{})['then'](respondWithResult(_0x3163af,0xc9))[_0x7186('0x43')](handleError(_0x3163af,null));};exports[_0x7186('0x21')]=function(_0x300201,_0x5093f3){if(_0x300201[_0x7186('0x47')]['id']){delete _0x300201['body']['id'];}return db['SalesforceConfiguration'][_0x7186('0x45')]({'where':{'id':_0x300201[_0x7186('0x44')]['id']}})[_0x7186('0x22')](handleEntityNotFound(_0x5093f3,null))[_0x7186('0x22')](saveUpdates(_0x300201[_0x7186('0x47')],null))[_0x7186('0x22')](respondWithResult(_0x5093f3,null))[_0x7186('0x43')](handleError(_0x5093f3,null));};exports[_0x7186('0x23')]=function(_0x2c7e2c,_0x4298db){return db['SalesforceConfiguration'][_0x7186('0x45')]({'where':{'id':_0x2c7e2c['params']['id']}})['then'](handleEntityNotFound(_0x4298db,null))['then'](removeEntity(_0x4298db,null))[_0x7186('0x43')](handleError(_0x4298db,null));};exports['getFields']=function(_0x81be3,_0x5df5e6,_0x1ebf8f){var _0x38af32={};var _0x118d29={};var _0x37411b;var _0x48b97f;return db[_0x7186('0x29')][_0x7186('0x48')]({'where':{'id':_0x81be3['params']['id']}})[_0x7186('0x22')](handleEntityNotFound(_0x5df5e6,null))['then'](function(_0x1176a8){if(_0x1176a8){_0x37411b=_0x1176a8;_0x118d29['model']=_[_0x7186('0x2f')](db[_0x7186('0x49')][_0x7186('0x2a')]);_0x118d29[_0x7186('0x30')]=_[_0x7186('0x2f')](_0x81be3[_0x7186('0x30')]);_0x118d29['filters']=_[_0x7186('0x31')](_0x118d29[_0x7186('0x2e')],_0x118d29['query']);_0x38af32[_0x7186('0x32')]=_[_0x7186('0x31')](_0x118d29[_0x7186('0x2e')],qs[_0x7186('0x33')](_0x81be3[_0x7186('0x30')][_0x7186('0x33')]));_0x38af32[_0x7186('0x32')]=_0x38af32[_0x7186('0x32')]['length']?_0x38af32[_0x7186('0x32')]:_0x118d29['model'];_0x38af32[_0x7186('0x37')]=qs['sort'](_0x81be3[_0x7186('0x30')][_0x7186('0x38')]);_0x38af32[_0x7186('0x3b')]=qs[_0x7186('0x39')](_[_0x7186('0x4a')](_0x81be3[_0x7186('0x30')],_0x118d29[_0x7186('0x39')]));if(_0x81be3[_0x7186('0x30')]['filter']){_0x38af32[_0x7186('0x3b')]=_[_0x7186('0x3c')](_0x38af32[_0x7186('0x3b')],{'$or':_[_0x7186('0x28')](_0x38af32[_0x7186('0x32')],function(_0x4927b9){var _0x1cc667={};_0x1cc667[_0x4927b9]={'$like':'%'+_0x81be3[_0x7186('0x30')]['filter']+'%'};return _0x1cc667;})});}_0x38af32=_['merge']({},_0x38af32,_0x81be3[_0x7186('0x3e')]);return _0x37411b[_0x7186('0x4b')](_0x38af32);}})['then'](function(_0x474326){if(_0x474326){_0x48b97f=_0x474326[_0x7186('0x34')];if(!_0x81be3['query']['hasOwnProperty'](_0x7186('0x36'))){_0x38af32['limit']=qs['limit'](_0x81be3[_0x7186('0x30')][_0x7186('0x1b')]);_0x38af32[_0x7186('0x1a')]=qs['offset'](_0x81be3[_0x7186('0x30')][_0x7186('0x1a')]);}return _0x37411b[_0x7186('0x4b')](_0x38af32);}})[_0x7186('0x22')](function(_0x36f565){if(_0x36f565){return _0x36f565?{'count':_0x48b97f,'rows':_0x36f565}:null;}})[_0x7186('0x22')](respondWithResult(_0x5df5e6,null))['catch'](handleError(_0x5df5e6,null));};exports[_0x7186('0x4c')]=function(_0x49fe7c,_0x2845d2,_0x384d91){var _0x14488c={};var _0x1f2048={};var _0x2920f9;var _0x3fb8e9;return db[_0x7186('0x29')][_0x7186('0x48')]({'where':{'id':_0x49fe7c['params']['id']}})['then'](handleEntityNotFound(_0x2845d2,null))[_0x7186('0x22')](function(_0x21f985){if(_0x21f985){_0x2920f9=_0x21f985;_0x1f2048[_0x7186('0x2e')]=_['keys'](db[_0x7186('0x49')][_0x7186('0x2a')]);_0x1f2048[_0x7186('0x30')]=_[_0x7186('0x2f')](_0x49fe7c[_0x7186('0x30')]);_0x1f2048[_0x7186('0x39')]=_[_0x7186('0x31')](_0x1f2048['model'],_0x1f2048[_0x7186('0x30')]);_0x14488c[_0x7186('0x32')]=_[_0x7186('0x31')](_0x1f2048[_0x7186('0x2e')],qs[_0x7186('0x33')](_0x49fe7c[_0x7186('0x30')]['fields']));_0x14488c['attributes']=_0x14488c[_0x7186('0x32')][_0x7186('0x34')]?_0x14488c[_0x7186('0x32')]:_0x1f2048['model'];_0x14488c[_0x7186('0x37')]=qs[_0x7186('0x38')](_0x49fe7c['query'][_0x7186('0x38')]);_0x14488c[_0x7186('0x3b')]=qs[_0x7186('0x39')](_[_0x7186('0x4a')](_0x49fe7c['query'],_0x1f2048[_0x7186('0x39')]));if(_0x49fe7c[_0x7186('0x30')][_0x7186('0x3a')]){_0x14488c[_0x7186('0x3b')]=_[_0x7186('0x3c')](_0x14488c['where'],{'$or':_[_0x7186('0x28')](_0x14488c[_0x7186('0x32')],function(_0x18e762){var _0x4639a0={};_0x4639a0[_0x18e762]={'$like':'%'+_0x49fe7c[_0x7186('0x30')][_0x7186('0x3a')]+'%'};return _0x4639a0;})});}_0x14488c=_[_0x7186('0x3c')]({},_0x14488c,_0x49fe7c['options']);return _0x2920f9[_0x7186('0x4c')](_0x14488c);}})[_0x7186('0x22')](function(_0x5eb4da){if(_0x5eb4da){_0x3fb8e9=_0x5eb4da['length'];if(!_0x49fe7c['query'][_0x7186('0x35')]('nolimit')){_0x14488c[_0x7186('0x1b')]=qs[_0x7186('0x1b')](_0x49fe7c[_0x7186('0x30')]['limit']);_0x14488c[_0x7186('0x1a')]=qs[_0x7186('0x1a')](_0x49fe7c[_0x7186('0x30')][_0x7186('0x1a')]);}return _0x2920f9['getSubjects'](_0x14488c);}})[_0x7186('0x22')](function(_0x1a6d5d){if(_0x1a6d5d){return _0x1a6d5d?{'count':_0x3fb8e9,'rows':_0x1a6d5d}:null;}})[_0x7186('0x22')](respondWithResult(_0x2845d2,null))[_0x7186('0x43')](handleError(_0x2845d2,null));};exports[_0x7186('0x4d')]=function(_0x254451,_0x223606,_0x4d246e){var _0x2bdc66={};var _0x53a8e8={};var _0x1f4bb1;var _0x2f50de;return db[_0x7186('0x29')][_0x7186('0x48')]({'where':{'id':_0x254451[_0x7186('0x44')]['id']}})[_0x7186('0x22')](handleEntityNotFound(_0x223606,null))['then'](function(_0x42ec3b){if(_0x42ec3b){_0x1f4bb1=_0x42ec3b;_0x53a8e8['model']=_[_0x7186('0x2f')](db[_0x7186('0x49')]['rawAttributes']);_0x53a8e8[_0x7186('0x30')]=_[_0x7186('0x2f')](_0x254451[_0x7186('0x30')]);_0x53a8e8['filters']=_[_0x7186('0x31')](_0x53a8e8[_0x7186('0x2e')],_0x53a8e8['query']);_0x2bdc66[_0x7186('0x32')]=_[_0x7186('0x31')](_0x53a8e8[_0x7186('0x2e')],qs[_0x7186('0x33')](_0x254451[_0x7186('0x30')][_0x7186('0x33')]));_0x2bdc66[_0x7186('0x32')]=_0x2bdc66[_0x7186('0x32')][_0x7186('0x34')]?_0x2bdc66[_0x7186('0x32')]:_0x53a8e8[_0x7186('0x2e')];_0x2bdc66[_0x7186('0x37')]=qs[_0x7186('0x38')](_0x254451['query'][_0x7186('0x38')]);_0x2bdc66[_0x7186('0x3b')]=qs[_0x7186('0x39')](_[_0x7186('0x4a')](_0x254451[_0x7186('0x30')],_0x53a8e8[_0x7186('0x39')]));if(_0x254451['query'][_0x7186('0x3a')]){_0x2bdc66['where']=_[_0x7186('0x3c')](_0x2bdc66[_0x7186('0x3b')],{'$or':_[_0x7186('0x28')](_0x2bdc66[_0x7186('0x32')],function(_0x3945d5){var _0x1cb093={};_0x1cb093[_0x3945d5]={'$like':'%'+_0x254451[_0x7186('0x30')][_0x7186('0x3a')]+'%'};return _0x1cb093;})});}_0x2bdc66=_[_0x7186('0x3c')]({},_0x2bdc66,_0x254451['options']);return _0x1f4bb1[_0x7186('0x4d')](_0x2bdc66);}})['then'](function(_0x3631af){if(_0x3631af){_0x2f50de=_0x3631af[_0x7186('0x34')];if(!_0x254451[_0x7186('0x30')][_0x7186('0x35')](_0x7186('0x36'))){_0x2bdc66[_0x7186('0x1b')]=qs[_0x7186('0x1b')](_0x254451['query'][_0x7186('0x1b')]);_0x2bdc66[_0x7186('0x1a')]=qs['offset'](_0x254451[_0x7186('0x30')][_0x7186('0x1a')]);}return _0x1f4bb1['getDescriptions'](_0x2bdc66);}})[_0x7186('0x22')](function(_0x306eb5){if(_0x306eb5){return _0x306eb5?{'count':_0x2f50de,'rows':_0x306eb5}:null;}})['then'](respondWithResult(_0x223606,null))[_0x7186('0x43')](handleError(_0x223606,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 49925a3..92c9152 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 _0xd5d1=['exports','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x36f498,_0x42bbf4){var _0x3b1775=function(_0x504204){while(--_0x504204){_0x36f498['push'](_0x36f498['shift']());}};_0x3b1775(++_0x42bbf4);}(_0xd5d1,0xcf));var _0x1d5d=function(_0x1dcb6c,_0xe93bd2){_0x1dcb6c=_0x1dcb6c-0x0;var _0xf89381=_0xd5d1[_0x1dcb6c];return _0xf89381;};'use strict';var _=require('lodash');var util=require(_0x1d5d('0x0'));var logger=require(_0x1d5d('0x1'))(_0x1d5d('0x2'));var moment=require(_0x1d5d('0x3'));var BPromise=require(_0x1d5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d5d('0x5'));var rimraf=require(_0x1d5d('0x6'));var config=require(_0x1d5d('0x7'));var attributes=require(_0x1d5d('0x8'));module[_0x1d5d('0x9')]=function(_0x1ae954,_0x26034c){return _0x1ae954['define'](_0x1d5d('0xa'),attributes,{'tableName':_0x1d5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89eb=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment'];(function(_0x121f55,_0x4f48eb){var _0x2ea4ec=function(_0xd25d6b){while(--_0xd25d6b){_0x121f55['push'](_0x121f55['shift']());}};_0x2ea4ec(++_0x4f48eb);}(_0x89eb,0xf4));var _0xb89e=function(_0x60c9f3,_0x22301c){_0x60c9f3=_0x60c9f3-0x0;var _0x3b0abc=_0x89eb[_0x60c9f3];return _0x3b0abc;};'use strict';var _=require(_0xb89e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb89e('0x1'));var moment=require(_0xb89e('0x2'));var BPromise=require(_0xb89e('0x3'));var rp=require(_0xb89e('0x4'));var fs=require('fs');var path=require(_0xb89e('0x5'));var rimraf=require(_0xb89e('0x6'));var config=require(_0xb89e('0x7'));var attributes=require(_0xb89e('0x8'));module[_0xb89e('0x9')]=function(_0x2fc5d8,_0x2d886c){return _0x2fc5d8[_0xb89e('0xa')](_0xb89e('0xb'),attributes,{'tableName':_0xb89e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 22218bc..c9b77bd 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 _0x2d93=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d93,0xa0));var _0x32d9=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x2d93[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var util=require(_0x32d9('0x0'));var moment=require(_0x32d9('0x1'));var BPromise=require(_0x32d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32d9('0x3'));var db=require(_0x32d9('0x4'))['db'];var utils=require(_0x32d9('0x5'));var logger=require(_0x32d9('0x6'))(_0x32d9('0x7'));var config=require(_0x32d9('0x8'));var jayson=require(_0x32d9('0x9'));var client=jayson[_0x32d9('0xa')][_0x32d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x301d5a,_0x5b8b9a,_0x5d2208){return new BPromise(function(_0x5a3b1b,_0x7d7a1d){return client[_0x32d9('0xc')](_0x301d5a,_0x5d2208)['then'](function(_0x376d9a){logger[_0x32d9('0xd')](_0x32d9('0xe'),_0x5b8b9a,_0x32d9('0xf'));logger[_0x32d9('0x10')](_0x32d9('0x11'),_0x5b8b9a,_0x32d9('0xf'),JSON[_0x32d9('0x12')](_0x376d9a));if(_0x376d9a[_0x32d9('0x13')]){if(_0x376d9a['error'][_0x32d9('0x14')]===0x1f4){logger[_0x32d9('0x13')](_0x32d9('0xe'),_0x5b8b9a,_0x376d9a[_0x32d9('0x13')][_0x32d9('0x15')]);return _0x7d7a1d(_0x376d9a['error']['message']);}logger[_0x32d9('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5b8b9a,_0x376d9a['error'][_0x32d9('0x15')]);return _0x5a3b1b(_0x376d9a[_0x32d9('0x13')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5b8b9a,_0x32d9('0xf'));_0x5a3b1b(_0x376d9a['result'][_0x32d9('0x15')]);}})[_0x32d9('0x16')](function(_0x2fe559){logger[_0x32d9('0x13')](_0x32d9('0xe'),_0x5b8b9a,_0x2fe559);_0x7d7a1d(_0x2fe559);});});} \ No newline at end of file +var _0x7d46=['message','SalesforceConfiguration,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2e0bed,_0x24b28d){var _0x45e74e=function(_0x36166d){while(--_0x36166d){_0x2e0bed['push'](_0x2e0bed['shift']());}};_0x45e74e(++_0x24b28d);}(_0x7d46,0x192));var _0x67d4=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7d46[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x67d4('0x0'));var util=require(_0x67d4('0x1'));var moment=require(_0x67d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x67d4('0x3'));var fs=require('fs');var Redis=require(_0x67d4('0x4'));var db=require(_0x67d4('0x5'))['db'];var utils=require(_0x67d4('0x6'));var logger=require('../../config/logger')(_0x67d4('0x7'));var config=require(_0x67d4('0x8'));var jayson=require(_0x67d4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31c344,_0x4bc1cc,_0x1c5d3e){return new BPromise(function(_0x204f0c,_0x40c021){return client['request'](_0x31c344,_0x1c5d3e)[_0x67d4('0xa')](function(_0x4dc677){logger[_0x67d4('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4bc1cc,_0x67d4('0xc'));logger[_0x67d4('0xd')](_0x67d4('0xe'),_0x4bc1cc,_0x67d4('0xc'),JSON[_0x67d4('0xf')](_0x4dc677));if(_0x4dc677[_0x67d4('0x10')]){if(_0x4dc677['error'][_0x67d4('0x11')]===0x1f4){logger[_0x67d4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4bc1cc,_0x4dc677[_0x67d4('0x10')][_0x67d4('0x12')]);return _0x40c021(_0x4dc677[_0x67d4('0x10')][_0x67d4('0x12')]);}logger[_0x67d4('0x10')](_0x67d4('0x13'),_0x4bc1cc,_0x4dc677[_0x67d4('0x10')][_0x67d4('0x12')]);return _0x204f0c(_0x4dc677['error'][_0x67d4('0x12')]);}else{logger[_0x67d4('0xb')](_0x67d4('0x13'),_0x4bc1cc,_0x67d4('0xc'));_0x204f0c(_0x4dc677['result'][_0x67d4('0x12')]);}})['catch'](function(_0xbd4ee6){logger[_0x67d4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4bc1cc,_0xbd4ee6);_0x40c021(_0xbd4ee6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ce06152..4e959af 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 _0xd464=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','Router','fs-extra'];(function(_0x5a754e,_0x4b70d8){var _0x573a34=function(_0x597f54){while(--_0x597f54){_0x5a754e['push'](_0x5a754e['shift']());}};_0x573a34(++_0x4b70d8);}(_0xd464,0x14f));var _0x4d46=function(_0x47d9d7,_0x38a185){_0x47d9d7=_0x47d9d7-0x0;var _0x36c636=_0xd464[_0x47d9d7];return _0x36c636;};'use strict';var multer=require(_0x4d46('0x0'));var util=require(_0x4d46('0x1'));var path=require(_0x4d46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d46('0x3')]();var fs_extra=require(_0x4d46('0x4'));var auth=require(_0x4d46('0x5'));var interaction=require(_0x4d46('0x6'));var config=require(_0x4d46('0x7'));var controller=require(_0x4d46('0x8'));router[_0x4d46('0x9')]('/',auth[_0x4d46('0xa')](),controller[_0x4d46('0xb')]);router[_0x4d46('0x9')](_0x4d46('0xc'),auth[_0x4d46('0xa')](),controller[_0x4d46('0xd')]);router[_0x4d46('0xe')]('/',auth[_0x4d46('0xa')](),controller[_0x4d46('0xf')]);router[_0x4d46('0x10')]('/:id',auth[_0x4d46('0xa')](),controller[_0x4d46('0x11')]);router[_0x4d46('0x12')](_0x4d46('0xc'),auth[_0x4d46('0xa')](),controller['destroy']);module[_0x4d46('0x13')]=router; \ No newline at end of file +var _0x0aeb=['isAuthenticated','index','show','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x3ce089,_0x1a4890){var _0x35b89d=function(_0x57f388){while(--_0x57f388){_0x3ce089['push'](_0x3ce089['shift']());}};_0x35b89d(++_0x1a4890);}(_0x0aeb,0xd0));var _0xb0ae=function(_0x125c79,_0x4e110){_0x125c79=_0x125c79-0x0;var _0x545be0=_0x0aeb[_0x125c79];return _0x545be0;};'use strict';var multer=require(_0xb0ae('0x0'));var util=require(_0xb0ae('0x1'));var path=require(_0xb0ae('0x2'));var timeout=require(_0xb0ae('0x3'));var express=require(_0xb0ae('0x4'));var router=express[_0xb0ae('0x5')]();var fs_extra=require(_0xb0ae('0x6'));var auth=require(_0xb0ae('0x7'));var interaction=require(_0xb0ae('0x8'));var config=require(_0xb0ae('0x9'));var controller=require(_0xb0ae('0xa'));router[_0xb0ae('0xb')]('/',auth[_0xb0ae('0xc')](),controller[_0xb0ae('0xd')]);router[_0xb0ae('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb0ae('0xe')]);router['post']('/',auth[_0xb0ae('0xc')](),controller['create']);router[_0xb0ae('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb0ae('0x10')](_0xb0ae('0x11'),auth[_0xb0ae('0xc')](),controller[_0xb0ae('0x12')]);module[_0xb0ae('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 663890f..29ebde3 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 _0x61ba=['customVariable','picklist','string','STRING','variable','sequelize','exports'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x61ba,0x6e));var _0xa61b=function(_0x5533d1,_0x99a8d6){_0x5533d1=_0x5533d1-0x0;var _0x388001=_0x61ba[_0x5533d1];return _0x388001;};'use strict';var Sequelize=require(_0xa61b('0x0'));module[_0xa61b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xa61b('0x2'),'keyValue',_0xa61b('0x3')),'defaultValue':_0xa61b('0x4')},'content':{'type':Sequelize[_0xa61b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa61b('0x4'),_0xa61b('0x6'),_0xa61b('0x2'))},'keyContent':{'type':Sequelize[_0xa61b('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xa61b('0x5')]}}; \ No newline at end of file +var _0x946f=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x946f,0x1e8));var _0xf946=function(_0x4b670c,_0x3cd5f3){_0x4b670c=_0x4b670c-0x0;var _0x46cdc2=_0x946f[_0x4b670c];return _0x46cdc2;};'use strict';var Sequelize=require('sequelize');module[_0xf946('0x0')]={'type':{'type':Sequelize[_0xf946('0x1')](_0xf946('0x2'),_0xf946('0x3'),_0xf946('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf946('0x5')]},'keyType':{'type':Sequelize[_0xf946('0x1')](_0xf946('0x2'),_0xf946('0x3'),_0xf946('0x4'))},'keyContent':{'type':Sequelize[_0xf946('0x5')]},'idField':{'type':Sequelize[_0xf946('0x5')]},'variableName':{'type':Sequelize[_0xf946('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a51e585..3afbca0 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 _0x959d=['sendStatus','error','stack','name','send','index','map','SalesforceField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','destroy','then'];(function(_0x7a0cb8,_0xfdb29e){var _0x4dd048=function(_0x369224){while(--_0x369224){_0x7a0cb8['push'](_0x7a0cb8['shift']());}};_0x4dd048(++_0xfdb29e);}(_0x959d,0x6e));var _0xd959=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x959d[_0x4a6cf8];return _0x22205e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd959('0x0'));var zipdir=require(_0xd959('0x1'));var jsonpatch=require(_0xd959('0x2'));var rp=require('request-promise');var moment=require(_0xd959('0x3'));var BPromise=require(_0xd959('0x4'));var Mustache=require('mustache');var util=require(_0xd959('0x5'));var path=require('path');var sox=require(_0xd959('0x6'));var csv=require(_0xd959('0x7'));var ejs=require(_0xd959('0x8'));var fs=require('fs');var fs_extra=require(_0xd959('0x9'));var _=require(_0xd959('0xa'));var squel=require(_0xd959('0xb'));var crypto=require(_0xd959('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd959('0xd'));var toCsv=require(_0xd959('0x7'));var querystring=require(_0xd959('0xe'));var Papa=require(_0xd959('0xf'));var Redis=require(_0xd959('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd959('0x11'));var as=require(_0xd959('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd959('0x13'))(_0xd959('0x14'));var utils=require(_0xd959('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd959('0x16'))['db'];function respondWithStatusCode(_0x535a1a,_0x41b8b5){_0x41b8b5=_0x41b8b5||0xcc;return function(_0x32d1bd){if(_0x32d1bd){return _0x535a1a['sendStatus'](_0x41b8b5);}return _0x535a1a[_0xd959('0x17')](_0x41b8b5)[_0xd959('0x18')]();};}function respondWithResult(_0x518384,_0x409295){_0x409295=_0x409295||0xc8;return function(_0x34ce27){if(_0x34ce27){return _0x518384[_0xd959('0x17')](_0x409295)[_0xd959('0x19')](_0x34ce27);}};}function respondWithFilteredResult(_0x133056,_0x183287){return function(_0x5a3e88){if(_0x5a3e88){var _0x5342c4=typeof _0x183287['offset']===_0xd959('0x1a')&&typeof _0x183287[_0xd959('0x1b')]===_0xd959('0x1a');var _0x4a5d0c=_0x5a3e88[_0xd959('0x1c')];var _0x163c8a=_0x5342c4?0x0:_0x183287['offset'];var _0x4f99eb=_0x5342c4?_0x5a3e88['count']:_0x183287[_0xd959('0x1d')]+_0x183287['limit'];var _0x14a43e;if(_0x4f99eb>=_0x4a5d0c){_0x4f99eb=_0x4a5d0c;_0x14a43e=0xc8;}else{_0x14a43e=0xce;}_0x133056[_0xd959('0x17')](_0x14a43e);return _0x133056['set'](_0xd959('0x1e'),_0x163c8a+'-'+_0x4f99eb+'/'+_0x4a5d0c)[_0xd959('0x19')](_0x5a3e88);}return null;};}function patchUpdates(_0x27dd43){return function(_0x39a959){try{jsonpatch[_0xd959('0x1f')](_0x39a959,_0x27dd43,!![]);}catch(_0x315a53){return BPromise['reject'](_0x315a53);}return _0x39a959['save']();};}function saveUpdates(_0x268cf3,_0x58d1d7){return function(_0x26df9b){if(_0x26df9b){return _0x26df9b['update'](_0x268cf3)['then'](function(_0x38ce0a){return _0x38ce0a;});}return null;};}function removeEntity(_0x3fccdd,_0x2dbd9d){return function(_0x477e43){if(_0x477e43){return _0x477e43[_0xd959('0x20')]()[_0xd959('0x21')](function(){_0x3fccdd[_0xd959('0x17')](0xcc)[_0xd959('0x18')]();});}};}function handleEntityNotFound(_0x22487b,_0x4d3cea){return function(_0x427735){if(!_0x427735){_0x22487b[_0xd959('0x22')](0x194);}return _0x427735;};}function handleError(_0x2ab4b9,_0x511c2c){_0x511c2c=_0x511c2c||0x1f4;return function(_0x28a1fd){logger[_0xd959('0x23')](_0x28a1fd[_0xd959('0x24')]);if(_0x28a1fd[_0xd959('0x25')]){delete _0x28a1fd[_0xd959('0x25')];}_0x2ab4b9[_0xd959('0x17')](_0x511c2c)[_0xd959('0x26')](_0x28a1fd);};}exports[_0xd959('0x27')]=function(_0x42f5fc,_0xa42fcc){var _0x193c81={},_0x4c1c47={},_0x46cdda={'count':0x0,'rows':[]};var _0x437314=_[_0xd959('0x28')](db[_0xd959('0x29')]['rawAttributes'],function(_0x32b760){return{'name':_0x32b760[_0xd959('0x2a')],'type':_0x32b760[_0xd959('0x2b')][_0xd959('0x2c')]};});_0x4c1c47[_0xd959('0x2d')]=_[_0xd959('0x28')](_0x437314,_0xd959('0x25'));_0x4c1c47[_0xd959('0x2e')]=_[_0xd959('0x2f')](_0x42f5fc[_0xd959('0x2e')]);_0x4c1c47[_0xd959('0x30')]=_[_0xd959('0x31')](_0x4c1c47[_0xd959('0x2d')],_0x4c1c47['query']);_0x193c81[_0xd959('0x32')]=_['intersection'](_0x4c1c47[_0xd959('0x2d')],qs[_0xd959('0x33')](_0x42f5fc['query'][_0xd959('0x33')]));_0x193c81['attributes']=_0x193c81['attributes'][_0xd959('0x34')]?_0x193c81[_0xd959('0x32')]:_0x4c1c47[_0xd959('0x2d')];if(!_0x42f5fc[_0xd959('0x2e')]['hasOwnProperty'](_0xd959('0x35'))){_0x193c81[_0xd959('0x1b')]=qs[_0xd959('0x1b')](_0x42f5fc['query'][_0xd959('0x1b')]);_0x193c81[_0xd959('0x1d')]=qs[_0xd959('0x1d')](_0x42f5fc[_0xd959('0x2e')][_0xd959('0x1d')]);}_0x193c81[_0xd959('0x36')]=qs['sort'](_0x42f5fc[_0xd959('0x2e')]['sort']);_0x193c81['where']=qs[_0xd959('0x30')](_['pick'](_0x42f5fc[_0xd959('0x2e')],_0x4c1c47[_0xd959('0x30')]),_0x437314);if(_0x42f5fc[_0xd959('0x2e')]['filter']){_0x193c81[_0xd959('0x37')]=_[_0xd959('0x38')](_0x193c81[_0xd959('0x37')],{'$or':_[_0xd959('0x28')](_0x437314,function(_0x27d7dc){if(_0x27d7dc[_0xd959('0x2b')]!==_0xd959('0x39')){var _0x285d11={};_0x285d11[_0x27d7dc[_0xd959('0x25')]]={'$like':'%'+_0x42f5fc['query'][_0xd959('0x3a')]+'%'};return _0x285d11;}})});}_0x193c81=_[_0xd959('0x38')]({},_0x193c81,_0x42f5fc['options']);var _0x1c7dba={'where':_0x193c81[_0xd959('0x37')]};return db[_0xd959('0x29')]['count'](_0x1c7dba)[_0xd959('0x21')](function(_0xe08e){_0x46cdda[_0xd959('0x1c')]=_0xe08e;if(_0x42f5fc[_0xd959('0x2e')][_0xd959('0x3b')]){_0x193c81[_0xd959('0x3c')]=[{'all':!![]}];}return db[_0xd959('0x29')][_0xd959('0x3d')](_0x193c81);})[_0xd959('0x21')](function(_0x33c211){_0x46cdda[_0xd959('0x3e')]=_0x33c211;return _0x46cdda;})[_0xd959('0x21')](respondWithFilteredResult(_0xa42fcc,_0x193c81))[_0xd959('0x3f')](handleError(_0xa42fcc,null));};exports[_0xd959('0x40')]=function(_0x484414,_0x251c9e){var _0x44fa87={'raw':!![],'where':{'id':_0x484414[_0xd959('0x41')]['id']}},_0x33606f={};_0x33606f[_0xd959('0x2d')]=_[_0xd959('0x2f')](db[_0xd959('0x29')][_0xd959('0x42')]);_0x33606f['query']=_[_0xd959('0x2f')](_0x484414[_0xd959('0x2e')]);_0x33606f[_0xd959('0x30')]=_['intersection'](_0x33606f['model'],_0x33606f['query']);_0x44fa87[_0xd959('0x32')]=_[_0xd959('0x31')](_0x33606f[_0xd959('0x2d')],qs[_0xd959('0x33')](_0x484414[_0xd959('0x2e')][_0xd959('0x33')]));_0x44fa87[_0xd959('0x32')]=_0x44fa87[_0xd959('0x32')][_0xd959('0x34')]?_0x44fa87[_0xd959('0x32')]:_0x33606f['model'];if(_0x484414[_0xd959('0x2e')][_0xd959('0x3b')]){_0x44fa87[_0xd959('0x3c')]=[{'all':!![]}];}_0x44fa87=_[_0xd959('0x38')]({},_0x44fa87,_0x484414[_0xd959('0x43')]);return db[_0xd959('0x29')][_0xd959('0x44')](_0x44fa87)[_0xd959('0x21')](handleEntityNotFound(_0x251c9e,null))[_0xd959('0x21')](respondWithResult(_0x251c9e,null))[_0xd959('0x3f')](handleError(_0x251c9e,null));};exports[_0xd959('0x45')]=function(_0x34c278,_0x4946b0){return db[_0xd959('0x29')][_0xd959('0x45')](_0x34c278[_0xd959('0x46')],{})['then'](respondWithResult(_0x4946b0,0xc9))['catch'](handleError(_0x4946b0,null));};exports[_0xd959('0x47')]=function(_0x2e16ce,_0x4ff18a){if(_0x2e16ce[_0xd959('0x46')]['id']){delete _0x2e16ce['body']['id'];}return db[_0xd959('0x29')][_0xd959('0x44')]({'where':{'id':_0x2e16ce[_0xd959('0x41')]['id']}})[_0xd959('0x21')](handleEntityNotFound(_0x4ff18a,null))['then'](saveUpdates(_0x2e16ce[_0xd959('0x46')],null))[_0xd959('0x21')](respondWithResult(_0x4ff18a,null))['catch'](handleError(_0x4ff18a,null));};exports[_0xd959('0x20')]=function(_0x2bf954,_0x322efa){return db[_0xd959('0x29')][_0xd959('0x44')]({'where':{'id':_0x2bf954[_0xd959('0x41')]['id']}})[_0xd959('0x21')](handleEntityNotFound(_0x322efa,null))['then'](removeEntity(_0x322efa,null))[_0xd959('0x3f')](handleError(_0x322efa,null));}; \ No newline at end of file +var _0xe769=['includeAll','include','findAll','rows','show','keys','length','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe769,0xa2));var _0x9e76=function(_0x449e3e,_0x3e113e){_0x449e3e=_0x449e3e-0x0;var _0x6cc58a=_0xe769[_0x449e3e];return _0x6cc58a;};'use strict';var emlformat=require(_0x9e76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e76('0x1'));var jsonpatch=require(_0x9e76('0x2'));var rp=require(_0x9e76('0x3'));var moment=require(_0x9e76('0x4'));var BPromise=require(_0x9e76('0x5'));var Mustache=require(_0x9e76('0x6'));var util=require(_0x9e76('0x7'));var path=require(_0x9e76('0x8'));var sox=require(_0x9e76('0x9'));var csv=require(_0x9e76('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e76('0xb'));var _=require(_0x9e76('0xc'));var squel=require(_0x9e76('0xd'));var crypto=require('crypto');var jsforce=require(_0x9e76('0xe'));var deskjs=require(_0x9e76('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9e76('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9e76('0x11'));var hardwareService=require(_0x9e76('0x12'));var logger=require('../../config/logger')(_0x9e76('0x13'));var utils=require(_0x9e76('0x14'));var config=require(_0x9e76('0x15'));var licenseUtil=require(_0x9e76('0x16'));var db=require(_0x9e76('0x17'))['db'];function respondWithStatusCode(_0x6ab677,_0x1cdd39){_0x1cdd39=_0x1cdd39||0xcc;return function(_0x1ff6ab){if(_0x1ff6ab){return _0x6ab677[_0x9e76('0x18')](_0x1cdd39);}return _0x6ab677[_0x9e76('0x19')](_0x1cdd39)[_0x9e76('0x1a')]();};}function respondWithResult(_0x579059,_0x2c7557){_0x2c7557=_0x2c7557||0xc8;return function(_0x308a52){if(_0x308a52){return _0x579059[_0x9e76('0x19')](_0x2c7557)['json'](_0x308a52);}};}function respondWithFilteredResult(_0x2093a1,_0x14b1ac){return function(_0x1836b2){if(_0x1836b2){var _0x6459c4=typeof _0x14b1ac[_0x9e76('0x1b')]===_0x9e76('0x1c')&&typeof _0x14b1ac[_0x9e76('0x1d')]===_0x9e76('0x1c');var _0x25c1ad=_0x1836b2[_0x9e76('0x1e')];var _0x2e515c=_0x6459c4?0x0:_0x14b1ac[_0x9e76('0x1b')];var _0x1ef00a=_0x6459c4?_0x1836b2['count']:_0x14b1ac['offset']+_0x14b1ac['limit'];var _0x1e7b01;if(_0x1ef00a>=_0x25c1ad){_0x1ef00a=_0x25c1ad;_0x1e7b01=0xc8;}else{_0x1e7b01=0xce;}_0x2093a1['status'](_0x1e7b01);return _0x2093a1[_0x9e76('0x1f')](_0x9e76('0x20'),_0x2e515c+'-'+_0x1ef00a+'/'+_0x25c1ad)[_0x9e76('0x21')](_0x1836b2);}return null;};}function patchUpdates(_0x1b342b){return function(_0x238dde){try{jsonpatch[_0x9e76('0x22')](_0x238dde,_0x1b342b,!![]);}catch(_0x3ac5d8){return BPromise['reject'](_0x3ac5d8);}return _0x238dde[_0x9e76('0x23')]();};}function saveUpdates(_0x5c7791,_0x327f95){return function(_0x58dd53){if(_0x58dd53){return _0x58dd53[_0x9e76('0x24')](_0x5c7791)[_0x9e76('0x25')](function(_0x5d1412){return _0x5d1412;});}return null;};}function removeEntity(_0x5827b3,_0xf99cb8){return function(_0x42dbb9){if(_0x42dbb9){return _0x42dbb9[_0x9e76('0x26')]()[_0x9e76('0x25')](function(){_0x5827b3[_0x9e76('0x19')](0xcc)[_0x9e76('0x1a')]();});}};}function handleEntityNotFound(_0xafed6e,_0x407557){return function(_0x58f7d6){if(!_0x58f7d6){_0xafed6e['sendStatus'](0x194);}return _0x58f7d6;};}function handleError(_0x1c4ae4,_0x34d8fe){_0x34d8fe=_0x34d8fe||0x1f4;return function(_0x47a8b3){logger[_0x9e76('0x27')](_0x47a8b3[_0x9e76('0x28')]);if(_0x47a8b3['name']){delete _0x47a8b3[_0x9e76('0x29')];}_0x1c4ae4[_0x9e76('0x19')](_0x34d8fe)[_0x9e76('0x2a')](_0x47a8b3);};}exports[_0x9e76('0x2b')]=function(_0x30909d,_0x36b206){var _0x3a62a7={},_0x5627fb={},_0x575aee={'count':0x0,'rows':[]};var _0x1c7ccb=_[_0x9e76('0x2c')](db[_0x9e76('0x2d')][_0x9e76('0x2e')],function(_0x37bd79){return{'name':_0x37bd79['fieldName'],'type':_0x37bd79[_0x9e76('0x2f')]['key']};});_0x5627fb[_0x9e76('0x30')]=_['map'](_0x1c7ccb,_0x9e76('0x29'));_0x5627fb['query']=_['keys'](_0x30909d[_0x9e76('0x31')]);_0x5627fb['filters']=_[_0x9e76('0x32')](_0x5627fb['model'],_0x5627fb[_0x9e76('0x31')]);_0x3a62a7[_0x9e76('0x33')]=_[_0x9e76('0x32')](_0x5627fb[_0x9e76('0x30')],qs['fields'](_0x30909d[_0x9e76('0x31')][_0x9e76('0x34')]));_0x3a62a7['attributes']=_0x3a62a7[_0x9e76('0x33')]['length']?_0x3a62a7[_0x9e76('0x33')]:_0x5627fb[_0x9e76('0x30')];if(!_0x30909d[_0x9e76('0x31')][_0x9e76('0x35')](_0x9e76('0x36'))){_0x3a62a7['limit']=qs[_0x9e76('0x1d')](_0x30909d[_0x9e76('0x31')][_0x9e76('0x1d')]);_0x3a62a7[_0x9e76('0x1b')]=qs[_0x9e76('0x1b')](_0x30909d['query'][_0x9e76('0x1b')]);}_0x3a62a7[_0x9e76('0x37')]=qs[_0x9e76('0x38')](_0x30909d[_0x9e76('0x31')][_0x9e76('0x38')]);_0x3a62a7[_0x9e76('0x39')]=qs[_0x9e76('0x3a')](_[_0x9e76('0x3b')](_0x30909d[_0x9e76('0x31')],_0x5627fb[_0x9e76('0x3a')]),_0x1c7ccb);if(_0x30909d[_0x9e76('0x31')][_0x9e76('0x3c')]){_0x3a62a7[_0x9e76('0x39')]=_[_0x9e76('0x3d')](_0x3a62a7[_0x9e76('0x39')],{'$or':_[_0x9e76('0x2c')](_0x1c7ccb,function(_0x196534){if(_0x196534[_0x9e76('0x2f')]!=='VIRTUAL'){var _0x484906={};_0x484906[_0x196534[_0x9e76('0x29')]]={'$like':'%'+_0x30909d['query'][_0x9e76('0x3c')]+'%'};return _0x484906;}})});}_0x3a62a7=_[_0x9e76('0x3d')]({},_0x3a62a7,_0x30909d[_0x9e76('0x3e')]);var _0x2a05b5={'where':_0x3a62a7['where']};return db[_0x9e76('0x2d')][_0x9e76('0x1e')](_0x2a05b5)[_0x9e76('0x25')](function(_0x5e69d5){_0x575aee[_0x9e76('0x1e')]=_0x5e69d5;if(_0x30909d['query'][_0x9e76('0x3f')]){_0x3a62a7[_0x9e76('0x40')]=[{'all':!![]}];}return db[_0x9e76('0x2d')][_0x9e76('0x41')](_0x3a62a7);})[_0x9e76('0x25')](function(_0x4f1601){_0x575aee[_0x9e76('0x42')]=_0x4f1601;return _0x575aee;})[_0x9e76('0x25')](respondWithFilteredResult(_0x36b206,_0x3a62a7))['catch'](handleError(_0x36b206,null));};exports[_0x9e76('0x43')]=function(_0x396e30,_0x2be3a5){var _0x502c83={'raw':!![],'where':{'id':_0x396e30['params']['id']}},_0x5070d7={};_0x5070d7[_0x9e76('0x30')]=_[_0x9e76('0x44')](db[_0x9e76('0x2d')]['rawAttributes']);_0x5070d7[_0x9e76('0x31')]=_[_0x9e76('0x44')](_0x396e30['query']);_0x5070d7[_0x9e76('0x3a')]=_['intersection'](_0x5070d7['model'],_0x5070d7['query']);_0x502c83[_0x9e76('0x33')]=_[_0x9e76('0x32')](_0x5070d7[_0x9e76('0x30')],qs[_0x9e76('0x34')](_0x396e30[_0x9e76('0x31')]['fields']));_0x502c83[_0x9e76('0x33')]=_0x502c83['attributes'][_0x9e76('0x45')]?_0x502c83['attributes']:_0x5070d7[_0x9e76('0x30')];if(_0x396e30[_0x9e76('0x31')][_0x9e76('0x3f')]){_0x502c83[_0x9e76('0x40')]=[{'all':!![]}];}_0x502c83=_[_0x9e76('0x3d')]({},_0x502c83,_0x396e30[_0x9e76('0x3e')]);return db[_0x9e76('0x2d')]['find'](_0x502c83)[_0x9e76('0x25')](handleEntityNotFound(_0x2be3a5,null))['then'](respondWithResult(_0x2be3a5,null))['catch'](handleError(_0x2be3a5,null));};exports[_0x9e76('0x46')]=function(_0x43cbca,_0x5813bc){return db[_0x9e76('0x2d')][_0x9e76('0x46')](_0x43cbca[_0x9e76('0x47')],{})[_0x9e76('0x25')](respondWithResult(_0x5813bc,0xc9))[_0x9e76('0x48')](handleError(_0x5813bc,null));};exports['update']=function(_0x3c6b41,_0x2c626d){if(_0x3c6b41['body']['id']){delete _0x3c6b41['body']['id'];}return db[_0x9e76('0x2d')][_0x9e76('0x49')]({'where':{'id':_0x3c6b41[_0x9e76('0x4a')]['id']}})[_0x9e76('0x25')](handleEntityNotFound(_0x2c626d,null))[_0x9e76('0x25')](saveUpdates(_0x3c6b41[_0x9e76('0x47')],null))['then'](respondWithResult(_0x2c626d,null))[_0x9e76('0x48')](handleError(_0x2c626d,null));};exports['destroy']=function(_0x2f77e9,_0x395ae7){return db[_0x9e76('0x2d')]['find']({'where':{'id':_0x2f77e9[_0x9e76('0x4a')]['id']}})[_0x9e76('0x25')](handleEntityNotFound(_0x395ae7,null))[_0x9e76('0x25')](removeEntity(_0x395ae7,null))[_0x9e76('0x48')](handleError(_0x395ae7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 24e59d4..1dc820a 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 _0xe9a9=['FieldId','lodash','../../config/logger','api','moment','path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x1eceff,_0x4a654b){var _0x4357b9=function(_0x5b4a89){while(--_0x5b4a89){_0x1eceff['push'](_0x1eceff['shift']());}};_0x4357b9(++_0x4a654b);}(_0xe9a9,0x12c));var _0x9e9a=function(_0x465131,_0x275744){_0x465131=_0x465131-0x0;var _0x366d93=_0xe9a9[_0x465131];return _0x366d93;};'use strict';var _=require(_0x9e9a('0x0'));var util=require('util');var logger=require(_0x9e9a('0x1'))(_0x9e9a('0x2'));var moment=require(_0x9e9a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e9a('0x4'));var rimraf=require(_0x9e9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e9a('0x6'));module[_0x9e9a('0x7')]=function(_0x56fad5,_0x4b04a4){return _0x56fad5[_0x9e9a('0x8')]('SalesforceField',attributes,{'tableName':_0x9e9a('0x9'),'paranoid':![],'indexes':[{'name':_0x9e9a('0xa'),'fields':[_0x9e9a('0xb'),_0x9e9a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6218=['idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0xe0ef68,_0x2f2f72){var _0x52522c=function(_0x4da281){while(--_0x4da281){_0xe0ef68['push'](_0xe0ef68['shift']());}};_0x52522c(++_0x2f2f72);}(_0x6218,0x1a2));var _0x8621=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x6218[_0x34f701];return _0x3e2429;};'use strict';var _=require(_0x8621('0x0'));var util=require(_0x8621('0x1'));var logger=require('../../config/logger')(_0x8621('0x2'));var moment=require('moment');var BPromise=require(_0x8621('0x3'));var rp=require(_0x8621('0x4'));var fs=require('fs');var path=require(_0x8621('0x5'));var rimraf=require(_0x8621('0x6'));var config=require(_0x8621('0x7'));var attributes=require(_0x8621('0x8'));module[_0x8621('0x9')]=function(_0x39f217,_0x1e35e2){return _0x39f217[_0x8621('0xa')](_0x8621('0xb'),attributes,{'tableName':_0x8621('0xc'),'paranoid':![],'indexes':[{'name':_0x8621('0xd'),'fields':[_0x8621('0xe'),_0x8621('0xf')],'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 12596a7..3bad0be 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 _0xc771=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0xbaf231,_0x46d958){var _0x4c33bd=function(_0x5e7295){while(--_0x5e7295){_0xbaf231['push'](_0xbaf231['shift']());}};_0x4c33bd(++_0x46d958);}(_0xc771,0x74));var _0x1c77=function(_0x7f9fd7,_0x202093){_0x7f9fd7=_0x7f9fd7-0x0;var _0x4f6752=_0xc771[_0x7f9fd7];return _0x4f6752;};'use strict';var _=require(_0x1c77('0x0'));var util=require('util');var moment=require(_0x1c77('0x1'));var BPromise=require(_0x1c77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c77('0x3'));var db=require(_0x1c77('0x4'))['db'];var utils=require(_0x1c77('0x5'));var logger=require(_0x1c77('0x6'))(_0x1c77('0x7'));var config=require(_0x1c77('0x8'));var jayson=require(_0x1c77('0x9'));var client=jayson[_0x1c77('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce6ef,_0x53a0e0,_0x1830f6){return new BPromise(function(_0x4f9161,_0x597914){return client['request'](_0x2ce6ef,_0x1830f6)[_0x1c77('0xb')](function(_0x189b81){logger[_0x1c77('0xc')](_0x1c77('0xd'),_0x53a0e0,'request\x20sent');logger[_0x1c77('0xe')](_0x1c77('0xf'),_0x53a0e0,_0x1c77('0x10'),JSON[_0x1c77('0x11')](_0x189b81));if(_0x189b81[_0x1c77('0x12')]){if(_0x189b81[_0x1c77('0x12')][_0x1c77('0x13')]===0x1f4){logger[_0x1c77('0x12')]('SalesforceField,\x20%s,\x20%s',_0x53a0e0,_0x189b81[_0x1c77('0x12')]['message']);return _0x597914(_0x189b81[_0x1c77('0x12')]['message']);}logger['error'](_0x1c77('0xd'),_0x53a0e0,_0x189b81[_0x1c77('0x12')][_0x1c77('0x14')]);return _0x4f9161(_0x189b81[_0x1c77('0x12')][_0x1c77('0x14')]);}else{logger[_0x1c77('0xc')]('SalesforceField,\x20%s,\x20%s',_0x53a0e0,_0x1c77('0x10'));_0x4f9161(_0x189b81[_0x1c77('0x15')]['message']);}})[_0x1c77('0x16')](function(_0x6fa092){logger[_0x1c77('0x12')](_0x1c77('0xd'),_0x53a0e0,_0x6fa092);_0x597914(_0x6fa092);});});} \ No newline at end of file +var _0x9829=['jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','moment','bluebird','../../config/utils','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9829,0x113));var _0x9982=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x9829[_0xa9eaa0];return _0x30897a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9982('0x0'));var BPromise=require(_0x9982('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9982('0x2'));var logger=require(_0x9982('0x3'))('rpc');var config=require(_0x9982('0x4'));var jayson=require(_0x9982('0x5'));var client=jayson[_0x9982('0x6')][_0x9982('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x173b72,_0x5a925a,_0x557cd2){return new BPromise(function(_0x4cbf51,_0x431917){return client[_0x9982('0x8')](_0x173b72,_0x557cd2)[_0x9982('0x9')](function(_0x5dbb90){logger[_0x9982('0xa')]('SalesforceField,\x20%s,\x20%s',_0x5a925a,_0x9982('0xb'));logger[_0x9982('0xc')](_0x9982('0xd'),_0x5a925a,_0x9982('0xb'),JSON['stringify'](_0x5dbb90));if(_0x5dbb90[_0x9982('0xe')]){if(_0x5dbb90[_0x9982('0xe')][_0x9982('0xf')]===0x1f4){logger['error'](_0x9982('0x10'),_0x5a925a,_0x5dbb90[_0x9982('0xe')][_0x9982('0x11')]);return _0x431917(_0x5dbb90[_0x9982('0xe')]['message']);}logger['error'](_0x9982('0x10'),_0x5a925a,_0x5dbb90[_0x9982('0xe')]['message']);return _0x4cbf51(_0x5dbb90['error'][_0x9982('0x11')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5a925a,_0x9982('0xb'));_0x4cbf51(_0x5dbb90[_0x9982('0x12')][_0x9982('0x11')]);}})[_0x9982('0x13')](function(_0x15c358){logger[_0x9982('0xe')]('SalesforceField,\x20%s,\x20%s',_0x5a925a,_0x15c358);_0x431917(_0x15c358);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2a0dc4d..2c1771e 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 _0x6221=['post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x4fb01d,_0x1cdc64){var _0x27cc58=function(_0x4ece6e){while(--_0x4ece6e){_0x4fb01d['push'](_0x4fb01d['shift']());}};_0x27cc58(++_0x1cdc64);}(_0x6221,0xdf));var _0x1622=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x6221[_0xf9a6cf];return _0x59e2bc;};'use strict';var multer=require(_0x1622('0x0'));var util=require(_0x1622('0x1'));var path=require(_0x1622('0x2'));var timeout=require(_0x1622('0x3'));var express=require(_0x1622('0x4'));var router=express[_0x1622('0x5')]();var fs_extra=require(_0x1622('0x6'));var auth=require(_0x1622('0x7'));var interaction=require(_0x1622('0x8'));var config=require(_0x1622('0x9'));var controller=require(_0x1622('0xa'));router[_0x1622('0xb')]('/',auth['isAuthenticated'](),controller[_0x1622('0xc')]);router['get'](_0x1622('0xd'),auth[_0x1622('0xe')](),controller[_0x1622('0xf')]);router[_0x1622('0xb')](_0x1622('0x10'),auth[_0x1622('0xe')](),controller[_0x1622('0x11')]);router[_0x1622('0xb')](_0x1622('0x12'),auth[_0x1622('0xe')](),controller[_0x1622('0x13')]);router[_0x1622('0x14')]('/',auth[_0x1622('0xe')](),controller[_0x1622('0x15')]);router[_0x1622('0x14')](_0x1622('0x10'),auth[_0x1622('0xe')](),controller[_0x1622('0x16')]);router[_0x1622('0x17')](_0x1622('0xd'),auth[_0x1622('0xe')](),controller['update']);router[_0x1622('0x18')](_0x1622('0xd'),auth[_0x1622('0xe')](),controller[_0x1622('0x19')]);module[_0x1622('0x1a')]=router; \ No newline at end of file +var _0x3bb3=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0x282348,_0x40f99e){var _0x5c6da8=function(_0x3fe0c6){while(--_0x3fe0c6){_0x282348['push'](_0x282348['shift']());}};_0x5c6da8(++_0x40f99e);}(_0x3bb3,0x9e));var _0x33bb=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3bb3[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x33bb('0x0'));var util=require(_0x33bb('0x1'));var path=require(_0x33bb('0x2'));var timeout=require(_0x33bb('0x3'));var express=require(_0x33bb('0x4'));var router=express[_0x33bb('0x5')]();var fs_extra=require(_0x33bb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x33bb('0x7'));var config=require(_0x33bb('0x8'));var controller=require(_0x33bb('0x9'));router['get']('/',auth[_0x33bb('0xa')](),controller[_0x33bb('0xb')]);router[_0x33bb('0xc')](_0x33bb('0xd'),auth['isAuthenticated'](),controller[_0x33bb('0xe')]);router['get'](_0x33bb('0xf'),auth[_0x33bb('0xa')](),controller[_0x33bb('0x10')]);router[_0x33bb('0xc')](_0x33bb('0x11'),auth[_0x33bb('0xa')](),controller[_0x33bb('0x12')]);router[_0x33bb('0x13')]('/',auth[_0x33bb('0xa')](),controller[_0x33bb('0x14')]);router[_0x33bb('0x13')](_0x33bb('0xf'),auth[_0x33bb('0xa')](),controller[_0x33bb('0x15')]);router[_0x33bb('0x16')](_0x33bb('0xd'),auth[_0x33bb('0xa')](),controller[_0x33bb('0x17')]);router[_0x33bb('0x18')](_0x33bb('0xd'),auth[_0x33bb('0xa')](),controller['destroy']);module[_0x33bb('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 148ece5..7f9a62c 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 _0xd1eb=['STRING','username','remoteUri','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xd1eb,0x193));var _0xbd1e=function(_0x5887d3,_0xf84a4f){_0x5887d3=_0x5887d3-0x0;var _0x3a6a01=_0xd1eb[_0x5887d3];return _0x3a6a01;};'use strict';var Sequelize=require('sequelize');module[_0xbd1e('0x0')]={'name':{'type':Sequelize[_0xbd1e('0x1')]},'description':{'type':Sequelize[_0xbd1e('0x1')]},'username':{'type':Sequelize[_0xbd1e('0x1')],'unique':_0xbd1e('0x2')},'password':{'type':Sequelize[_0xbd1e('0x1')]},'email':{'type':Sequelize[_0xbd1e('0x1')]},'remoteUri':{'type':Sequelize[_0xbd1e('0x1')],'unique':_0xbd1e('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x82b1=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5f23db,_0x210662){var _0x2af45d=function(_0x16c0e4){while(--_0x16c0e4){_0x5f23db['push'](_0x5f23db['shift']());}};_0x2af45d(++_0x210662);}(_0x82b1,0x164));var _0x182b=function(_0x2e2b48,_0x4213ee){_0x2e2b48=_0x2e2b48-0x0;var _0x129cb5=_0x82b1[_0x2e2b48];return _0x129cb5;};'use strict';var Sequelize=require(_0x182b('0x0'));module[_0x182b('0x1')]={'name':{'type':Sequelize[_0x182b('0x2')]},'description':{'type':Sequelize[_0x182b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x182b('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x182b('0x2')]},'remoteUri':{'type':Sequelize[_0x182b('0x2')],'unique':_0x182b('0x4')},'serverUrl':{'type':Sequelize[_0x182b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ea319b5..00eeab4 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 _0x0311=['result','incident\x20table\x20objects','assign','remove','includes','label','push','all','log','internalType','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','forEach','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','fieldName','key','query','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','ServicenowAccount','includeAll','findAll','rows','catch','params','keys','rawAttributes','length','include','find','create','body','findOne','ServicenowConfiguration','options','getConfigurations','hasOwnProperty','Subjects','getSubjects','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','group_list','reopened_time','resolved_at','caller_id','approval_set','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','sys_id','urgency','problem_id','company','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET'];(function(_0x46c5be,_0x25b470){var _0x349ff9=function(_0x46cf34){while(--_0x46cf34){_0x46c5be['push'](_0x46c5be['shift']());}};_0x349ff9(++_0x25b470);}(_0x0311,0xc1));var _0x1031=function(_0x24dd9d,_0xbba012){_0x24dd9d=_0x24dd9d-0x0;var _0x14a4bf=_0x0311[_0x24dd9d];return _0x14a4bf;};'use strict';var emlformat=require(_0x1031('0x0'));var rimraf=require(_0x1031('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1031('0x2'));var rp=require(_0x1031('0x3'));var moment=require(_0x1031('0x4'));var BPromise=require(_0x1031('0x5'));var Mustache=require('mustache');var util=require(_0x1031('0x6'));var path=require('path');var sox=require(_0x1031('0x7'));var csv=require(_0x1031('0x8'));var ejs=require(_0x1031('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1031('0xa'));var squel=require('squel');var crypto=require(_0x1031('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1031('0xc'));var toCsv=require(_0x1031('0x8'));var querystring=require(_0x1031('0xd'));var Papa=require('papaparse');var Redis=require(_0x1031('0xe'));var authService=require(_0x1031('0xf'));var qs=require(_0x1031('0x10'));var as=require(_0x1031('0x11'));var hardwareService=require(_0x1031('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1031('0x13'));var config=require(_0x1031('0x14'));var licenseUtil=require(_0x1031('0x15'));var db=require(_0x1031('0x16'))['db'];var integrations=require(_0x1031('0x17'));function respondWithStatusCode(_0x402e80,_0x477df5){_0x477df5=_0x477df5||0xcc;return function(_0x545aa7){if(_0x545aa7){return _0x402e80['sendStatus'](_0x477df5);}return _0x402e80[_0x1031('0x18')](_0x477df5)[_0x1031('0x19')]();};}function respondWithResult(_0x5de3b5,_0x2dde9b){_0x2dde9b=_0x2dde9b||0xc8;return function(_0x566b26){if(_0x566b26){return _0x5de3b5[_0x1031('0x18')](_0x2dde9b)['json'](_0x566b26);}};}function respondWithFilteredResult(_0x407230,_0x8a904d){return function(_0x517d28){if(_0x517d28){var _0x182b53=typeof _0x8a904d['offset']===_0x1031('0x1a')&&typeof _0x8a904d[_0x1031('0x1b')]===_0x1031('0x1a');var _0x3e4a0e=_0x517d28[_0x1031('0x1c')];var _0x4ae934=_0x182b53?0x0:_0x8a904d[_0x1031('0x1d')];var _0x553dc5=_0x182b53?_0x517d28[_0x1031('0x1c')]:_0x8a904d[_0x1031('0x1d')]+_0x8a904d[_0x1031('0x1b')];var _0x2d140;if(_0x553dc5>=_0x3e4a0e){_0x553dc5=_0x3e4a0e;_0x2d140=0xc8;}else{_0x2d140=0xce;}_0x407230[_0x1031('0x18')](_0x2d140);return _0x407230['set']('Content-Range',_0x4ae934+'-'+_0x553dc5+'/'+_0x3e4a0e)[_0x1031('0x1e')](_0x517d28);}return null;};}function patchUpdates(_0x391dc7){return function(_0x3a8596){try{jsonpatch[_0x1031('0x1f')](_0x3a8596,_0x391dc7,!![]);}catch(_0x261d56){return BPromise[_0x1031('0x20')](_0x261d56);}return _0x3a8596[_0x1031('0x21')]();};}function saveUpdates(_0x43aa8c,_0x561663){return function(_0x2abe50){if(_0x2abe50){return _0x2abe50[_0x1031('0x22')](_0x43aa8c)[_0x1031('0x23')](function(_0x4ad934){return _0x4ad934;});}return null;};}function removeEntity(_0x3d8d48,_0x142166){return function(_0x34a326){if(_0x34a326){return _0x34a326[_0x1031('0x24')]()[_0x1031('0x23')](function(){_0x3d8d48[_0x1031('0x18')](0xcc)[_0x1031('0x19')]();});}};}function handleEntityNotFound(_0x7e10d9,_0x4331ce){return function(_0x4416a3){if(!_0x4416a3){_0x7e10d9[_0x1031('0x25')](0x194);}return _0x4416a3;};}function handleError(_0x34e47b,_0x4b90e1){_0x4b90e1=_0x4b90e1||0x1f4;return function(_0x38b1cd){logger[_0x1031('0x26')](_0x38b1cd[_0x1031('0x27')]);if(_0x38b1cd[_0x1031('0x28')]){delete _0x38b1cd[_0x1031('0x28')];}_0x34e47b[_0x1031('0x18')](_0x4b90e1)[_0x1031('0x29')](_0x38b1cd);};}exports['index']=function(_0x2d7b50,_0x4f867b){var _0x1c0e43={},_0xd19c40={},_0x31cc2a={'count':0x0,'rows':[]};var _0x4378cc=_[_0x1031('0x2a')](db['ServicenowAccount']['rawAttributes'],function(_0x1e9872){return{'name':_0x1e9872[_0x1031('0x2b')],'type':_0x1e9872['type'][_0x1031('0x2c')]};});_0xd19c40['model']=_['map'](_0x4378cc,_0x1031('0x28'));_0xd19c40[_0x1031('0x2d')]=_['keys'](_0x2d7b50[_0x1031('0x2d')]);_0xd19c40['filters']=_[_0x1031('0x2e')](_0xd19c40[_0x1031('0x2f')],_0xd19c40[_0x1031('0x2d')]);_0x1c0e43[_0x1031('0x30')]=_['intersection'](_0xd19c40[_0x1031('0x2f')],qs[_0x1031('0x31')](_0x2d7b50[_0x1031('0x2d')]['fields']));_0x1c0e43[_0x1031('0x30')]=_0x1c0e43['attributes']['length']?_0x1c0e43[_0x1031('0x30')]:_0xd19c40[_0x1031('0x2f')];if(!_0x2d7b50[_0x1031('0x2d')]['hasOwnProperty'](_0x1031('0x32'))){_0x1c0e43[_0x1031('0x1b')]=qs[_0x1031('0x1b')](_0x2d7b50[_0x1031('0x2d')][_0x1031('0x1b')]);_0x1c0e43['offset']=qs[_0x1031('0x1d')](_0x2d7b50[_0x1031('0x2d')][_0x1031('0x1d')]);}_0x1c0e43[_0x1031('0x33')]=qs[_0x1031('0x34')](_0x2d7b50[_0x1031('0x2d')][_0x1031('0x34')]);_0x1c0e43[_0x1031('0x35')]=qs[_0x1031('0x36')](_[_0x1031('0x37')](_0x2d7b50['query'],_0xd19c40[_0x1031('0x36')]),_0x4378cc);if(_0x2d7b50[_0x1031('0x2d')][_0x1031('0x38')]){_0x1c0e43['where']=_[_0x1031('0x39')](_0x1c0e43['where'],{'$or':_[_0x1031('0x2a')](_0x4378cc,function(_0x5ec8e2){if(_0x5ec8e2[_0x1031('0x3a')]!=='VIRTUAL'){var _0x5d5799={};_0x5d5799[_0x5ec8e2['name']]={'$like':'%'+_0x2d7b50[_0x1031('0x2d')][_0x1031('0x38')]+'%'};return _0x5d5799;}})});}_0x1c0e43=_[_0x1031('0x39')]({},_0x1c0e43,_0x2d7b50['options']);var _0x134072={'where':_0x1c0e43[_0x1031('0x35')]};return db[_0x1031('0x3b')]['count'](_0x134072)[_0x1031('0x23')](function(_0x566594){_0x31cc2a[_0x1031('0x1c')]=_0x566594;if(_0x2d7b50[_0x1031('0x2d')][_0x1031('0x3c')]){_0x1c0e43['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0x1031('0x3d')](_0x1c0e43);})['then'](function(_0x3c2db4){_0x31cc2a[_0x1031('0x3e')]=_0x3c2db4;return _0x31cc2a;})['then'](respondWithFilteredResult(_0x4f867b,_0x1c0e43))[_0x1031('0x3f')](handleError(_0x4f867b,null));};exports['show']=function(_0x1c04eb,_0x219f4e){var _0x28ae06={'raw':![],'where':{'id':_0x1c04eb[_0x1031('0x40')]['id']}},_0x1d23aa={};_0x1d23aa[_0x1031('0x2f')]=_[_0x1031('0x41')](db['ServicenowAccount'][_0x1031('0x42')]);_0x1d23aa['query']=_[_0x1031('0x41')](_0x1c04eb[_0x1031('0x2d')]);_0x1d23aa[_0x1031('0x36')]=_[_0x1031('0x2e')](_0x1d23aa[_0x1031('0x2f')],_0x1d23aa['query']);_0x28ae06[_0x1031('0x30')]=_[_0x1031('0x2e')](_0x1d23aa[_0x1031('0x2f')],qs[_0x1031('0x31')](_0x1c04eb[_0x1031('0x2d')]['fields']));_0x28ae06[_0x1031('0x30')]=_0x28ae06[_0x1031('0x30')][_0x1031('0x43')]?_0x28ae06[_0x1031('0x30')]:_0x1d23aa[_0x1031('0x2f')];if(_0x1c04eb[_0x1031('0x2d')]['includeAll']){_0x28ae06[_0x1031('0x44')]=[{'all':!![]}];}_0x28ae06=_['merge']({},_0x28ae06,_0x1c04eb['options']);return db[_0x1031('0x3b')][_0x1031('0x45')](_0x28ae06)[_0x1031('0x23')](handleEntityNotFound(_0x219f4e,null))[_0x1031('0x23')](respondWithResult(_0x219f4e,null))['catch'](handleError(_0x219f4e,null));};exports['create']=function(_0x3af253,_0x110632){return db[_0x1031('0x3b')][_0x1031('0x46')](_0x3af253[_0x1031('0x47')],{})[_0x1031('0x23')](respondWithResult(_0x110632,0xc9))['catch'](handleError(_0x110632,null));};exports[_0x1031('0x22')]=function(_0xb9b0cb,_0x1d69be){if(_0xb9b0cb[_0x1031('0x47')]['id']){delete _0xb9b0cb[_0x1031('0x47')]['id'];}return db['ServicenowAccount'][_0x1031('0x45')]({'where':{'id':_0xb9b0cb[_0x1031('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d69be,null))[_0x1031('0x23')](saveUpdates(_0xb9b0cb[_0x1031('0x47')],null))[_0x1031('0x23')](respondWithResult(_0x1d69be,null))[_0x1031('0x3f')](handleError(_0x1d69be,null));};exports[_0x1031('0x24')]=function(_0x1d27b4,_0x3d47f8){return db[_0x1031('0x3b')][_0x1031('0x45')]({'where':{'id':_0x1d27b4[_0x1031('0x40')]['id']}})[_0x1031('0x23')](handleEntityNotFound(_0x3d47f8,null))['then'](removeEntity(_0x3d47f8,null))[_0x1031('0x3f')](handleError(_0x3d47f8,null));};exports['getConfigurations']=function(_0x5aba39,_0x5859a,_0x176e44){var _0x62df27={};var _0xaf1828={};var _0x28de94;var _0x4fe751;return db[_0x1031('0x3b')][_0x1031('0x48')]({'where':{'id':_0x5aba39[_0x1031('0x40')]['id']}})[_0x1031('0x23')](handleEntityNotFound(_0x5859a,null))[_0x1031('0x23')](function(_0x43ed8d){if(_0x43ed8d){_0x28de94=_0x43ed8d;_0xaf1828[_0x1031('0x2f')]=_[_0x1031('0x41')](db[_0x1031('0x49')]['rawAttributes']);_0xaf1828['query']=_[_0x1031('0x41')](_0x5aba39[_0x1031('0x2d')]);_0xaf1828['filters']=_[_0x1031('0x2e')](_0xaf1828[_0x1031('0x2f')],_0xaf1828[_0x1031('0x2d')]);_0x62df27[_0x1031('0x30')]=_['intersection'](_0xaf1828['model'],qs[_0x1031('0x31')](_0x5aba39[_0x1031('0x2d')][_0x1031('0x31')]));_0x62df27[_0x1031('0x30')]=_0x62df27[_0x1031('0x30')][_0x1031('0x43')]?_0x62df27['attributes']:_0xaf1828['model'];_0x62df27[_0x1031('0x33')]=qs[_0x1031('0x34')](_0x5aba39[_0x1031('0x2d')][_0x1031('0x34')]);_0x62df27[_0x1031('0x35')]=qs['filters'](_[_0x1031('0x37')](_0x5aba39[_0x1031('0x2d')],_0xaf1828[_0x1031('0x36')]));if(_0x5aba39['query']['filter']){_0x62df27['where']=_[_0x1031('0x39')](_0x62df27[_0x1031('0x35')],{'$or':_['map'](_0x62df27[_0x1031('0x30')],function(_0x203e60){var _0x1ed6dd={};_0x1ed6dd[_0x203e60]={'$like':'%'+_0x5aba39[_0x1031('0x2d')][_0x1031('0x38')]+'%'};return _0x1ed6dd;})});}_0x62df27=_['merge']({},_0x62df27,_0x5aba39[_0x1031('0x4a')]);return _0x28de94[_0x1031('0x4b')](_0x62df27);}})[_0x1031('0x23')](function(_0x537717){if(_0x537717){_0x4fe751=_0x537717[_0x1031('0x43')];if(!_0x5aba39[_0x1031('0x2d')][_0x1031('0x4c')]('nolimit')){_0x62df27[_0x1031('0x1b')]=qs['limit'](_0x5aba39[_0x1031('0x2d')][_0x1031('0x1b')]);_0x62df27['offset']=qs[_0x1031('0x1d')](_0x5aba39['query'][_0x1031('0x1d')]);}return _0x28de94[_0x1031('0x4b')](_0x62df27);}})['then'](function(_0x438462){if(_0x438462){return _0x438462?{'count':_0x4fe751,'rows':_0x438462}:null;}})[_0x1031('0x23')](respondWithResult(_0x5859a,null))[_0x1031('0x3f')](handleError(_0x5859a,null));};exports['addConfiguration']=function(_0x4d6fb7,_0x4ccbe5,_0x3de0aa){if(_0x4d6fb7[_0x1031('0x47')]['id']){delete _0x4d6fb7[_0x1031('0x47')]['id'];}return db[_0x1031('0x3b')][_0x1031('0x48')]({'where':{'id':_0x4d6fb7[_0x1031('0x40')]['id']}})[_0x1031('0x23')](handleEntityNotFound(_0x4ccbe5,null))[_0x1031('0x23')](function(_0x3378bd){if(_0x3378bd){_0x4d6fb7[_0x1031('0x47')]['AccountId']=_0x3378bd['id'];_0x4d6fb7[_0x1031('0x47')][_0x1031('0x4d')]=integrations[_0x1031('0x4e')](_0x4d6fb7['body']['channel'],_0x4d6fb7[_0x1031('0x47')][_0x1031('0x3a')]);_0x4d6fb7[_0x1031('0x47')][_0x1031('0x4f')]=integrations[_0x1031('0x50')](_0x4d6fb7[_0x1031('0x47')]['channel'],_0x4d6fb7[_0x1031('0x47')][_0x1031('0x3a')]);return db[_0x1031('0x49')][_0x1031('0x46')](_0x4d6fb7[_0x1031('0x47')],{'include':[{'model':db['ServicenowField'],'as':_0x1031('0x4d')},{'model':db[_0x1031('0x51')],'as':_0x1031('0x4f')}]});}return null;})['then'](respondWithResult(_0x4ccbe5,null))[_0x1031('0x3f')](handleError(_0x4ccbe5,null));};exports['getFields']=function(_0x493a91,_0x4bcbdb,_0x646675){var _0x73118c=[_0x1031('0x52'),_0x1031('0x53'),'knowledge',_0x1031('0x54'),_0x1031('0x55'),_0x1031('0x56'),_0x1031('0x57'),_0x1031('0x58'),_0x1031('0x59')];var _0x474bcc=[_0x1031('0x5a'),_0x1031('0x52'),_0x1031('0x5b'),_0x1031('0x5c'),_0x1031('0x5d'),_0x1031('0x5e'),_0x1031('0x5f'),_0x1031('0x53'),'approval_history',_0x1031('0x60'),_0x1031('0x61'),_0x1031('0x62'),_0x1031('0x63'),'user_input',_0x1031('0x64'),_0x1031('0x65'),_0x1031('0x66'),_0x1031('0x67'),'knowledge','order',_0x1031('0x68'),_0x1031('0x69'),'cmdb_ci',_0x1031('0x6a'),_0x1031('0x6b'),'active',_0x1031('0x6c'),_0x1031('0x6d'),'priority',_0x1031('0x6e'),'rfc',_0x1031('0x6f'),_0x1031('0x70'),'opened_at','business_duration',_0x1031('0x71'),'work_end',_0x1031('0x72'),_0x1031('0x73'),_0x1031('0x74'),_0x1031('0x75'),'subcategory',_0x1031('0x76'),_0x1031('0x77'),_0x1031('0x55'),_0x1031('0x78'),_0x1031('0x79'),_0x1031('0x7a'),_0x1031('0x7b'),'business_stc',_0x1031('0x7c'),_0x1031('0x7d'),_0x1031('0x7e'),_0x1031('0x56'),_0x1031('0x7f'),_0x1031('0x80'),_0x1031('0x81'),_0x1031('0x82'),'parent_incident',_0x1031('0x83'),'contact_type','reopened_by',_0x1031('0x57'),_0x1031('0x84'),_0x1031('0x85'),_0x1031('0x86'),'reassignment_count',_0x1031('0x87'),_0x1031('0x88'),'severity','comments',_0x1031('0x89'),'approval',_0x1031('0x8a'),_0x1031('0x8b'),_0x1031('0x8c'),_0x1031('0x8d'),_0x1031('0x8e'),_0x1031('0x8f'),'upon_approval',_0x1031('0x90'),_0x1031('0x91'),_0x1031('0x59')];var _0x580c4e='';var _0x4a6033='';var _0x288a2c=[];var _0x598113='';var _0x39f0d7='';var _0x424a79=[];var _0x4aa4b4='';var _0xdc93be='';var _0x448bc1={};var _0x9c4fcb='';return db[_0x1031('0x3b')]['findOne']({'where':{'id':_0x493a91[_0x1031('0x40')]['id']},'attributes':['id',_0x1031('0x92'),_0x1031('0x93'),'email','remoteUri','serverUrl']})[_0x1031('0x23')](handleEntityNotFound(_0x4bcbdb,null))['then'](function(_0x7bc916){if(_0x7bc916){_0x9c4fcb=_0x7bc916['remoteUri'];var _0x42a06c=_0x9c4fcb['slice'](-0x1);if(_0x42a06c==='/'){_0x9c4fcb=_0x9c4fcb[_0x1031('0x94')](0x0,_0x9c4fcb['lastIndexOf'](_0x42a06c));}_0xdc93be=util[_0x1031('0x95')](_0x1031('0x96'),_0x9c4fcb);_0x4aa4b4=util[_0x1031('0x95')](_0x1031('0x97'),_0x9c4fcb);_0x448bc1={'user':_0x7bc916[_0x1031('0x92')],'pass':_0x7bc916[_0x1031('0x93')]};var _0x185e52={'method':_0x1031('0x98'),'uri':_0xdc93be+'incident?sysparm_display_value=all','auth':_0x448bc1,'json':!![]};return rp(_0x185e52);}})[_0x1031('0x23')](function(_0x166241){if(_0x166241[_0x1031('0x99')][_0x1031('0x43')]>0x0){_0x580c4e=_0x166241[_0x1031('0x99')];}console['log'](_0x1031('0x9a'),_0x580c4e);_0x424a79=[];_0x4a6033=Object[_0x1031('0x9b')]([],_0x580c4e);_[_0x1031('0x9c')](_0x4a6033,function(_0x40535d){return!_0x73118c[_0x1031('0x9d')](_0x40535d[_0x1031('0x28')]);});_0x4a6033['forEach'](function(_0x589639){var _0x581a3a=createFieldObject(_0x4aa4b4,_0x448bc1,_0x589639['internalType'],_0x589639[_0x1031('0x28')],_0x589639[_0x1031('0x9e')],![]);_0x424a79[_0x1031('0x9f')](_0x581a3a);});return Promise[_0x1031('0xa0')](_0x424a79);})[_0x1031('0x23')](function(_0x277703){_0x288a2c=_0x277703;_0x598113=Object[_0x1031('0x9b')]([],_0x580c4e);console[_0x1031('0xa1')]('TCL:\x20_object',_0x580c4e);_[_0x1031('0x9c')](_0x598113,function(_0x224c63){return _0x474bcc[_0x1031('0x9d')](_0x224c63[_0x1031('0x28')]);});console[_0x1031('0xa1')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x598113);_0x424a79=[];_0x598113['forEach'](function(_0x2a1a13){var _0x706163=createFieldObject(_0x4aa4b4,_0x448bc1,_0x2a1a13[_0x1031('0xa2')],_0x2a1a13[_0x1031('0x28')],_0x2a1a13[_0x1031('0x9e')],!![]);_0x424a79[_0x1031('0x9f')](_0x706163);});return Promise[_0x1031('0xa0')](_0x424a79);})[_0x1031('0x23')](function(_0x2e4657){_0x39f0d7=_0x2e4657;var _0x48385b=_0x288a2c[_0x1031('0xa3')](_0x39f0d7);return{'count':_0x48385b[_0x1031('0x43')],'rows':_0x48385b};})['then'](respondWithResult(_0x4bcbdb,null))['catch'](function(_0x5068b1){console[_0x1031('0xa1')]('ServiceNow\x20error:\x20'+_0x5068b1);var _0x4f3b91=_0x493a91['query'][_0x1031('0xa4')]?0x1f4:_0x5068b1[_0x1031('0xa5')]||0x1f4;logger[_0x1031('0x26')](_0x5068b1['stack']);delete _0x5068b1[_0x1031('0x28')];if(_0x4f3b91===0x191){_0x4f3b91=0x190;}_0x4bcbdb[_0x1031('0x18')](_0x4f3b91)[_0x1031('0x29')](_0x493a91[_0x1031('0x2d')]['test']?{'message':_0x1031('0xa6'),'statusCode':_0x5068b1[_0x1031('0xa5')]}:_0x5068b1);});};function createFieldObject(_0x2b8063,_0x353132,_0x51e955,_0x332fcc,_0x40e815,_0x4696f3){return new Promise(function(_0x39bbed,_0x289a50){var _0x54160f={'id':_0x332fcc,'name':_0x40e815,'custom':_0x4696f3};if(_0x51e955===_0x1031('0xa7')){_0x54160f[_0x1031('0x4a')]=[{'name':_0x1031('0xa8'),'value':_0x1031('0xa9')},{'name':_0x1031('0xaa'),'value':_0x1031('0xab')}];_0x39bbed(_0x54160f);}else{var _0x25cffa={'method':_0x1031('0x98'),'uri':_0x2b8063+'sys_choice?sysparm_query=name=incident^element='+_0x332fcc,'auth':_0x353132,'json':!![]};return rp(_0x25cffa)[_0x1031('0x23')](function(_0x49c88d){var _0x2af191=[];if(_0x49c88d[_0x1031('0x99')]['length']>0x0){_0x49c88d[_0x1031('0x99')][_0x1031('0xac')](function(_0x23f9f3){if(_0x23f9f3['inactive']===_0x1031('0xab')){var _0x473f84={'name':_0x23f9f3['label'],'value':_0x23f9f3['value']};_0x2af191['push'](_0x473f84);}});}_0x54160f[_0x1031('0x4a')]=_0x2af191;if(_0x54160f['options'][_0x1031('0x43')]>0x0){_0x39bbed(_0x54160f);}else{if(_0x4696f3==![]){_0x39bbed();}else{_0x39bbed(_0x54160f);}}});}});} \ No newline at end of file +var _0x4f9a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','then','stack','name','map','ServicenowAccount','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','includeAll','include','rows','catch','show','params','options','find','create','update','body','destroy','getConfigurations','findOne','rawAttributes','channel','Descriptions','ServicenowConfiguration','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','opened_at','business_duration','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','forEach','concat','ServiceNow\x20error:\x20','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x4f9a,0xa1));var _0xa4f9=function(_0x5d9179,_0x55a8b5){_0x5d9179=_0x5d9179-0x0;var _0x1d2141=_0x4f9a[_0x5d9179];return _0x1d2141;};'use strict';var emlformat=require(_0xa4f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4f9('0x1'));var jsonpatch=require(_0xa4f9('0x2'));var rp=require(_0xa4f9('0x3'));var moment=require('moment');var BPromise=require(_0xa4f9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa4f9('0x5'));var sox=require(_0xa4f9('0x6'));var csv=require(_0xa4f9('0x7'));var ejs=require(_0xa4f9('0x8'));var fs=require('fs');var fs_extra=require(_0xa4f9('0x9'));var _=require('lodash');var squel=require(_0xa4f9('0xa'));var crypto=require(_0xa4f9('0xb'));var jsforce=require(_0xa4f9('0xc'));var deskjs=require(_0xa4f9('0xd'));var toCsv=require(_0xa4f9('0x7'));var querystring=require(_0xa4f9('0xe'));var Papa=require('papaparse');var Redis=require(_0xa4f9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa4f9('0x10'));var as=require(_0xa4f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4f9('0x12'))(_0xa4f9('0x13'));var utils=require(_0xa4f9('0x14'));var config=require(_0xa4f9('0x15'));var licenseUtil=require(_0xa4f9('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa400df,_0x175e65){_0x175e65=_0x175e65||0xcc;return function(_0x32d95c){if(_0x32d95c){return _0xa400df[_0xa4f9('0x17')](_0x175e65);}return _0xa400df[_0xa4f9('0x18')](_0x175e65)[_0xa4f9('0x19')]();};}function respondWithResult(_0x582a34,_0x3e6d45){_0x3e6d45=_0x3e6d45||0xc8;return function(_0x386072){if(_0x386072){return _0x582a34[_0xa4f9('0x18')](_0x3e6d45)[_0xa4f9('0x1a')](_0x386072);}};}function respondWithFilteredResult(_0x117992,_0x503ac4){return function(_0x4bb5bd){if(_0x4bb5bd){var _0x38dba8=typeof _0x503ac4[_0xa4f9('0x1b')]===_0xa4f9('0x1c')&&typeof _0x503ac4['limit']===_0xa4f9('0x1c');var _0x35236e=_0x4bb5bd[_0xa4f9('0x1d')];var _0x8375e5=_0x38dba8?0x0:_0x503ac4[_0xa4f9('0x1b')];var _0x3a207c=_0x38dba8?_0x4bb5bd['count']:_0x503ac4[_0xa4f9('0x1b')]+_0x503ac4[_0xa4f9('0x1e')];var _0x3901f3;if(_0x3a207c>=_0x35236e){_0x3a207c=_0x35236e;_0x3901f3=0xc8;}else{_0x3901f3=0xce;}_0x117992[_0xa4f9('0x18')](_0x3901f3);return _0x117992[_0xa4f9('0x1f')]('Content-Range',_0x8375e5+'-'+_0x3a207c+'/'+_0x35236e)[_0xa4f9('0x1a')](_0x4bb5bd);}return null;};}function patchUpdates(_0x10812e){return function(_0x3e6b6a){try{jsonpatch[_0xa4f9('0x20')](_0x3e6b6a,_0x10812e,!![]);}catch(_0x45642d){return BPromise[_0xa4f9('0x21')](_0x45642d);}return _0x3e6b6a['save']();};}function saveUpdates(_0x499ab6,_0x373c1a){return function(_0x17be90){if(_0x17be90){return _0x17be90['update'](_0x499ab6)['then'](function(_0x4c7665){return _0x4c7665;});}return null;};}function removeEntity(_0x5f0ae4,_0x25df7d){return function(_0x15efb8){if(_0x15efb8){return _0x15efb8['destroy']()[_0xa4f9('0x22')](function(){_0x5f0ae4[_0xa4f9('0x18')](0xcc)[_0xa4f9('0x19')]();});}};}function handleEntityNotFound(_0x7bab03,_0x3f2022){return function(_0x1e8bcc){if(!_0x1e8bcc){_0x7bab03['sendStatus'](0x194);}return _0x1e8bcc;};}function handleError(_0x1ec57b,_0x15ea51){_0x15ea51=_0x15ea51||0x1f4;return function(_0x148a4f){logger['error'](_0x148a4f[_0xa4f9('0x23')]);if(_0x148a4f[_0xa4f9('0x24')]){delete _0x148a4f[_0xa4f9('0x24')];}_0x1ec57b[_0xa4f9('0x18')](_0x15ea51)['send'](_0x148a4f);};}exports['index']=function(_0x1e7434,_0x543702){var _0x423251={},_0x30187d={},_0x18b56f={'count':0x0,'rows':[]};var _0x443cfd=_[_0xa4f9('0x25')](db[_0xa4f9('0x26')]['rawAttributes'],function(_0x47ed00){return{'name':_0x47ed00['fieldName'],'type':_0x47ed00[_0xa4f9('0x27')][_0xa4f9('0x28')]};});_0x30187d['model']=_[_0xa4f9('0x25')](_0x443cfd,_0xa4f9('0x24'));_0x30187d[_0xa4f9('0x29')]=_[_0xa4f9('0x2a')](_0x1e7434[_0xa4f9('0x29')]);_0x30187d['filters']=_[_0xa4f9('0x2b')](_0x30187d[_0xa4f9('0x2c')],_0x30187d[_0xa4f9('0x29')]);_0x423251[_0xa4f9('0x2d')]=_[_0xa4f9('0x2b')](_0x30187d[_0xa4f9('0x2c')],qs[_0xa4f9('0x2e')](_0x1e7434[_0xa4f9('0x29')][_0xa4f9('0x2e')]));_0x423251[_0xa4f9('0x2d')]=_0x423251[_0xa4f9('0x2d')][_0xa4f9('0x2f')]?_0x423251[_0xa4f9('0x2d')]:_0x30187d['model'];if(!_0x1e7434[_0xa4f9('0x29')][_0xa4f9('0x30')](_0xa4f9('0x31'))){_0x423251['limit']=qs[_0xa4f9('0x1e')](_0x1e7434['query'][_0xa4f9('0x1e')]);_0x423251[_0xa4f9('0x1b')]=qs[_0xa4f9('0x1b')](_0x1e7434[_0xa4f9('0x29')][_0xa4f9('0x1b')]);}_0x423251[_0xa4f9('0x32')]=qs[_0xa4f9('0x33')](_0x1e7434[_0xa4f9('0x29')]['sort']);_0x423251['where']=qs[_0xa4f9('0x34')](_[_0xa4f9('0x35')](_0x1e7434['query'],_0x30187d[_0xa4f9('0x34')]),_0x443cfd);if(_0x1e7434[_0xa4f9('0x29')]['filter']){_0x423251[_0xa4f9('0x36')]=_[_0xa4f9('0x37')](_0x423251[_0xa4f9('0x36')],{'$or':_['map'](_0x443cfd,function(_0x58cc52){if(_0x58cc52[_0xa4f9('0x27')]!=='VIRTUAL'){var _0x1b4e69={};_0x1b4e69[_0x58cc52[_0xa4f9('0x24')]]={'$like':'%'+_0x1e7434[_0xa4f9('0x29')][_0xa4f9('0x38')]+'%'};return _0x1b4e69;}})});}_0x423251=_['merge']({},_0x423251,_0x1e7434['options']);var _0x371256={'where':_0x423251[_0xa4f9('0x36')]};return db[_0xa4f9('0x26')]['count'](_0x371256)[_0xa4f9('0x22')](function(_0x16ef9){_0x18b56f[_0xa4f9('0x1d')]=_0x16ef9;if(_0x1e7434['query'][_0xa4f9('0x39')]){_0x423251[_0xa4f9('0x3a')]=[{'all':!![]}];}return db[_0xa4f9('0x26')]['findAll'](_0x423251);})[_0xa4f9('0x22')](function(_0xd2321b){_0x18b56f[_0xa4f9('0x3b')]=_0xd2321b;return _0x18b56f;})[_0xa4f9('0x22')](respondWithFilteredResult(_0x543702,_0x423251))[_0xa4f9('0x3c')](handleError(_0x543702,null));};exports[_0xa4f9('0x3d')]=function(_0x59fbb7,_0x3fcc9c){var _0x1399d8={'raw':![],'where':{'id':_0x59fbb7[_0xa4f9('0x3e')]['id']}},_0xe9a83d={};_0xe9a83d['model']=_[_0xa4f9('0x2a')](db['ServicenowAccount']['rawAttributes']);_0xe9a83d[_0xa4f9('0x29')]=_[_0xa4f9('0x2a')](_0x59fbb7['query']);_0xe9a83d[_0xa4f9('0x34')]=_[_0xa4f9('0x2b')](_0xe9a83d[_0xa4f9('0x2c')],_0xe9a83d[_0xa4f9('0x29')]);_0x1399d8[_0xa4f9('0x2d')]=_[_0xa4f9('0x2b')](_0xe9a83d[_0xa4f9('0x2c')],qs[_0xa4f9('0x2e')](_0x59fbb7['query'][_0xa4f9('0x2e')]));_0x1399d8[_0xa4f9('0x2d')]=_0x1399d8[_0xa4f9('0x2d')]['length']?_0x1399d8[_0xa4f9('0x2d')]:_0xe9a83d[_0xa4f9('0x2c')];if(_0x59fbb7[_0xa4f9('0x29')][_0xa4f9('0x39')]){_0x1399d8[_0xa4f9('0x3a')]=[{'all':!![]}];}_0x1399d8=_[_0xa4f9('0x37')]({},_0x1399d8,_0x59fbb7[_0xa4f9('0x3f')]);return db[_0xa4f9('0x26')][_0xa4f9('0x40')](_0x1399d8)[_0xa4f9('0x22')](handleEntityNotFound(_0x3fcc9c,null))[_0xa4f9('0x22')](respondWithResult(_0x3fcc9c,null))[_0xa4f9('0x3c')](handleError(_0x3fcc9c,null));};exports[_0xa4f9('0x41')]=function(_0x4a2704,_0x5b38c2){return db[_0xa4f9('0x26')][_0xa4f9('0x41')](_0x4a2704['body'],{})[_0xa4f9('0x22')](respondWithResult(_0x5b38c2,0xc9))[_0xa4f9('0x3c')](handleError(_0x5b38c2,null));};exports[_0xa4f9('0x42')]=function(_0x2e18dd,_0x19f673){if(_0x2e18dd[_0xa4f9('0x43')]['id']){delete _0x2e18dd[_0xa4f9('0x43')]['id'];}return db[_0xa4f9('0x26')][_0xa4f9('0x40')]({'where':{'id':_0x2e18dd[_0xa4f9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19f673,null))[_0xa4f9('0x22')](saveUpdates(_0x2e18dd[_0xa4f9('0x43')],null))['then'](respondWithResult(_0x19f673,null))[_0xa4f9('0x3c')](handleError(_0x19f673,null));};exports[_0xa4f9('0x44')]=function(_0x3dcaff,_0x4ff463){return db[_0xa4f9('0x26')][_0xa4f9('0x40')]({'where':{'id':_0x3dcaff[_0xa4f9('0x3e')]['id']}})[_0xa4f9('0x22')](handleEntityNotFound(_0x4ff463,null))[_0xa4f9('0x22')](removeEntity(_0x4ff463,null))[_0xa4f9('0x3c')](handleError(_0x4ff463,null));};exports[_0xa4f9('0x45')]=function(_0x202760,_0x333134,_0x381979){var _0x5717ac={};var _0x342477={};var _0x40cfae;var _0x31acfd;return db[_0xa4f9('0x26')][_0xa4f9('0x46')]({'where':{'id':_0x202760[_0xa4f9('0x3e')]['id']}})[_0xa4f9('0x22')](handleEntityNotFound(_0x333134,null))[_0xa4f9('0x22')](function(_0x438d74){if(_0x438d74){_0x40cfae=_0x438d74;_0x342477[_0xa4f9('0x2c')]=_[_0xa4f9('0x2a')](db['ServicenowConfiguration'][_0xa4f9('0x47')]);_0x342477[_0xa4f9('0x29')]=_['keys'](_0x202760['query']);_0x342477[_0xa4f9('0x34')]=_[_0xa4f9('0x2b')](_0x342477['model'],_0x342477[_0xa4f9('0x29')]);_0x5717ac['attributes']=_['intersection'](_0x342477['model'],qs[_0xa4f9('0x2e')](_0x202760[_0xa4f9('0x29')][_0xa4f9('0x2e')]));_0x5717ac[_0xa4f9('0x2d')]=_0x5717ac[_0xa4f9('0x2d')][_0xa4f9('0x2f')]?_0x5717ac[_0xa4f9('0x2d')]:_0x342477['model'];_0x5717ac[_0xa4f9('0x32')]=qs[_0xa4f9('0x33')](_0x202760[_0xa4f9('0x29')]['sort']);_0x5717ac[_0xa4f9('0x36')]=qs[_0xa4f9('0x34')](_[_0xa4f9('0x35')](_0x202760['query'],_0x342477[_0xa4f9('0x34')]));if(_0x202760[_0xa4f9('0x29')][_0xa4f9('0x38')]){_0x5717ac[_0xa4f9('0x36')]=_[_0xa4f9('0x37')](_0x5717ac[_0xa4f9('0x36')],{'$or':_[_0xa4f9('0x25')](_0x5717ac['attributes'],function(_0xfaf916){var _0x12fcb1={};_0x12fcb1[_0xfaf916]={'$like':'%'+_0x202760[_0xa4f9('0x29')][_0xa4f9('0x38')]+'%'};return _0x12fcb1;})});}_0x5717ac=_['merge']({},_0x5717ac,_0x202760[_0xa4f9('0x3f')]);return _0x40cfae['getConfigurations'](_0x5717ac);}})[_0xa4f9('0x22')](function(_0x5a93b9){if(_0x5a93b9){_0x31acfd=_0x5a93b9[_0xa4f9('0x2f')];if(!_0x202760[_0xa4f9('0x29')][_0xa4f9('0x30')](_0xa4f9('0x31'))){_0x5717ac['limit']=qs[_0xa4f9('0x1e')](_0x202760[_0xa4f9('0x29')]['limit']);_0x5717ac[_0xa4f9('0x1b')]=qs[_0xa4f9('0x1b')](_0x202760['query']['offset']);}return _0x40cfae['getConfigurations'](_0x5717ac);}})[_0xa4f9('0x22')](function(_0x2668a1){if(_0x2668a1){return _0x2668a1?{'count':_0x31acfd,'rows':_0x2668a1}:null;}})[_0xa4f9('0x22')](respondWithResult(_0x333134,null))['catch'](handleError(_0x333134,null));};exports['addConfiguration']=function(_0x3e6dab,_0x4d3dcf,_0x48f346){if(_0x3e6dab['body']['id']){delete _0x3e6dab[_0xa4f9('0x43')]['id'];}return db[_0xa4f9('0x26')][_0xa4f9('0x46')]({'where':{'id':_0x3e6dab[_0xa4f9('0x3e')]['id']}})[_0xa4f9('0x22')](handleEntityNotFound(_0x4d3dcf,null))[_0xa4f9('0x22')](function(_0x382033){if(_0x382033){_0x3e6dab['body']['AccountId']=_0x382033['id'];_0x3e6dab[_0xa4f9('0x43')]['Subjects']=integrations['getSubjects'](_0x3e6dab[_0xa4f9('0x43')][_0xa4f9('0x48')],_0x3e6dab[_0xa4f9('0x43')][_0xa4f9('0x27')]);_0x3e6dab[_0xa4f9('0x43')][_0xa4f9('0x49')]=integrations['getDescriptions'](_0x3e6dab['body']['channel'],_0x3e6dab[_0xa4f9('0x43')][_0xa4f9('0x27')]);return db[_0xa4f9('0x4a')]['create'](_0x3e6dab[_0xa4f9('0x43')],{'include':[{'model':db[_0xa4f9('0x4b')],'as':_0xa4f9('0x4c')},{'model':db['ServicenowField'],'as':_0xa4f9('0x49')}]});}return null;})[_0xa4f9('0x22')](respondWithResult(_0x4d3dcf,null))[_0xa4f9('0x3c')](handleError(_0x4d3dcf,null));};exports[_0xa4f9('0x4d')]=function(_0xcc6127,_0x2bcc04,_0x565534){var _0x9e8435=[_0xa4f9('0x4e'),_0xa4f9('0x4f'),_0xa4f9('0x50'),_0xa4f9('0x51'),_0xa4f9('0x52'),_0xa4f9('0x53'),_0xa4f9('0x54'),_0xa4f9('0x55'),_0xa4f9('0x56')];var _0x4667f0=[_0xa4f9('0x57'),_0xa4f9('0x4e'),'caused_by',_0xa4f9('0x58'),_0xa4f9('0x59'),'sys_updated_on','child_incidents',_0xa4f9('0x4f'),_0xa4f9('0x5a'),_0xa4f9('0x5b'),_0xa4f9('0x5c'),_0xa4f9('0x5d'),_0xa4f9('0x5e'),_0xa4f9('0x5f'),_0xa4f9('0x60'),_0xa4f9('0x61'),_0xa4f9('0x62'),'sys_created_by','knowledge','order',_0xa4f9('0x63'),_0xa4f9('0x64'),_0xa4f9('0x65'),_0xa4f9('0x66'),_0xa4f9('0x67'),'active',_0xa4f9('0x68'),_0xa4f9('0x69'),'priority',_0xa4f9('0x6a'),'rfc',_0xa4f9('0x6b'),_0xa4f9('0x6c'),_0xa4f9('0x6d'),_0xa4f9('0x6e'),'group_list','work_end',_0xa4f9('0x6f'),_0xa4f9('0x70'),_0xa4f9('0x71'),_0xa4f9('0x72'),_0xa4f9('0x51'),'work_notes',_0xa4f9('0x73'),_0xa4f9('0x52'),_0xa4f9('0x74'),_0xa4f9('0x75'),_0xa4f9('0x76'),'assignment_group',_0xa4f9('0x77'),_0xa4f9('0x78'),_0xa4f9('0x79'),_0xa4f9('0x7a'),_0xa4f9('0x53'),_0xa4f9('0x7b'),'close_notes',_0xa4f9('0x7c'),_0xa4f9('0x7d'),_0xa4f9('0x7e'),_0xa4f9('0x7f'),_0xa4f9('0x80'),'reopened_by',_0xa4f9('0x54'),_0xa4f9('0x81'),_0xa4f9('0x82'),_0xa4f9('0x83'),_0xa4f9('0x84'),_0xa4f9('0x85'),'assigned_to',_0xa4f9('0x55'),_0xa4f9('0x86'),'sla_due',_0xa4f9('0x87'),_0xa4f9('0x88'),_0xa4f9('0x89'),_0xa4f9('0x8a'),_0xa4f9('0x8b'),_0xa4f9('0x8c'),_0xa4f9('0x8d'),_0xa4f9('0x8e'),'correlation_id',_0xa4f9('0x8f'),_0xa4f9('0x56')];var _0x2772af='';var _0xbfb20d='';var _0x26f0eb=[];var _0x2c049b='';var _0x2da8ae='';var _0x178d70=[];var _0x1ca78c='';var _0x5437c5='';var _0x43e764={};var _0x443d84='';return db[_0xa4f9('0x26')]['findOne']({'where':{'id':_0xcc6127[_0xa4f9('0x3e')]['id']},'attributes':['id','username',_0xa4f9('0x90'),_0xa4f9('0x91'),_0xa4f9('0x92'),_0xa4f9('0x93')]})[_0xa4f9('0x22')](handleEntityNotFound(_0x2bcc04,null))['then'](function(_0x4b5538){if(_0x4b5538){_0x443d84=_0x4b5538[_0xa4f9('0x92')];var _0x1b0af8=_0x443d84[_0xa4f9('0x94')](-0x1);if(_0x1b0af8==='/'){_0x443d84=_0x443d84[_0xa4f9('0x95')](0x0,_0x443d84['lastIndexOf'](_0x1b0af8));}_0x5437c5=util['format'](_0xa4f9('0x96'),_0x443d84);_0x1ca78c=util[_0xa4f9('0x97')](_0xa4f9('0x98'),_0x443d84);_0x43e764={'user':_0x4b5538[_0xa4f9('0x99')],'pass':_0x4b5538['password']};var _0x5e4220={'method':_0xa4f9('0x9a'),'uri':_0x5437c5+_0xa4f9('0x9b'),'auth':_0x43e764,'json':!![]};return rp(_0x5e4220);}})[_0xa4f9('0x22')](function(_0x20c5a3){if(_0x20c5a3[_0xa4f9('0x9c')][_0xa4f9('0x2f')]>0x0){_0x2772af=_0x20c5a3['result'];}console[_0xa4f9('0x9d')]('incident\x20table\x20objects',_0x2772af);_0x178d70=[];_0xbfb20d=Object[_0xa4f9('0x9e')]([],_0x2772af);_[_0xa4f9('0x9f')](_0xbfb20d,function(_0x1ab422){return!_0x9e8435[_0xa4f9('0xa0')](_0x1ab422['name']);});_0xbfb20d['forEach'](function(_0x2c519a){var _0x54495b=createFieldObject(_0x1ca78c,_0x43e764,_0x2c519a[_0xa4f9('0xa1')],_0x2c519a[_0xa4f9('0x24')],_0x2c519a[_0xa4f9('0xa2')],![]);_0x178d70[_0xa4f9('0xa3')](_0x54495b);});return Promise[_0xa4f9('0xa4')](_0x178d70);})[_0xa4f9('0x22')](function(_0x48719a){_0x26f0eb=_0x48719a;_0x2c049b=Object['assign']([],_0x2772af);console[_0xa4f9('0x9d')](_0xa4f9('0xa5'),_0x2772af);_['remove'](_0x2c049b,function(_0x3ce493){return _0x4667f0['includes'](_0x3ce493[_0xa4f9('0x24')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2c049b);_0x178d70=[];_0x2c049b[_0xa4f9('0xa6')](function(_0x3d2d63){var _0x2308a9=createFieldObject(_0x1ca78c,_0x43e764,_0x3d2d63['internalType'],_0x3d2d63[_0xa4f9('0x24')],_0x3d2d63['label'],!![]);_0x178d70[_0xa4f9('0xa3')](_0x2308a9);});return Promise['all'](_0x178d70);})['then'](function(_0x33268c){_0x2da8ae=_0x33268c;var _0xf366d2=_0x26f0eb[_0xa4f9('0xa7')](_0x2da8ae);return{'count':_0xf366d2['length'],'rows':_0xf366d2};})[_0xa4f9('0x22')](respondWithResult(_0x2bcc04,null))['catch'](function(_0x1b65f7){console[_0xa4f9('0x9d')](_0xa4f9('0xa8')+_0x1b65f7);var _0x3f5304=_0xcc6127[_0xa4f9('0x29')]['test']?0x1f4:_0x1b65f7[_0xa4f9('0xa9')]||0x1f4;logger[_0xa4f9('0xaa')](_0x1b65f7[_0xa4f9('0x23')]);delete _0x1b65f7[_0xa4f9('0x24')];if(_0x3f5304===0x191){_0x3f5304=0x190;}_0x2bcc04[_0xa4f9('0x18')](_0x3f5304)['send'](_0xcc6127[_0xa4f9('0x29')]['test']?{'message':_0xa4f9('0xab'),'statusCode':_0x1b65f7[_0xa4f9('0xa9')]}:_0x1b65f7);});};function createFieldObject(_0x385df2,_0x111ab1,_0x1c8023,_0x32f519,_0x2f4b95,_0x12faa9){return new Promise(function(_0x31f871,_0x53bb64){var _0x1c7287={'id':_0x32f519,'name':_0x2f4b95,'custom':_0x12faa9};if(_0x1c8023===_0xa4f9('0xac')){_0x1c7287[_0xa4f9('0x3f')]=[{'name':_0xa4f9('0xad'),'value':_0xa4f9('0xae')},{'name':_0xa4f9('0xaf'),'value':_0xa4f9('0xb0')}];_0x31f871(_0x1c7287);}else{var _0x43a8d7={'method':_0xa4f9('0x9a'),'uri':_0x385df2+_0xa4f9('0xb1')+_0x32f519,'auth':_0x111ab1,'json':!![]};return rp(_0x43a8d7)[_0xa4f9('0x22')](function(_0xb55d52){var _0x18679c=[];if(_0xb55d52[_0xa4f9('0x9c')][_0xa4f9('0x2f')]>0x0){_0xb55d52[_0xa4f9('0x9c')][_0xa4f9('0xa6')](function(_0x5584f5){if(_0x5584f5[_0xa4f9('0xb2')]===_0xa4f9('0xb0')){var _0x2846c1={'name':_0x5584f5[_0xa4f9('0xa2')],'value':_0x5584f5['value']};_0x18679c['push'](_0x2846c1);}});}_0x1c7287[_0xa4f9('0x3f')]=_0x18679c;if(_0x1c7287[_0xa4f9('0x3f')]['length']>0x0){_0x31f871(_0x1c7287);}else{if(_0x12faa9==![]){_0x31f871();}else{_0x31f871(_0x1c7287);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2563d93..93cc4a7 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 _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x2cff55,_0x240c53){var _0x58c277=function(_0x4366d7){while(--_0x4366d7){_0x2cff55['push'](_0x2cff55['shift']());}};_0x58c277(++_0x240c53);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2eb2[_0x1ac595];return _0x455fff;};'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('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x7f01e1,_0x567ac4){var _0x216194=function(_0x25f440){while(--_0x25f440){_0x7f01e1['push'](_0x7f01e1['shift']());}};_0x216194(++_0x567ac4);}(_0x31f0,0xb7));var _0x031f=function(_0x29c85e,_0x57c4db){_0x29c85e=_0x29c85e-0x0;var _0x47f161=_0x31f0[_0x29c85e];return _0x47f161;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'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 dc262dc..3742c0c 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 _0x559c=['result','catch','ServicenowAccount','findAll','options','raw','where','attributes','include','model','map','GetServicenowAccount','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x128053,_0x171af4){var _0xd62f78=function(_0x595a6a){while(--_0x595a6a){_0x128053['push'](_0x128053['shift']());}};_0xd62f78(++_0x171af4);}(_0x559c,0xe6));var _0xc559=function(_0x8e8f89,_0x4254f3){_0x8e8f89=_0x8e8f89-0x0;var _0x151938=_0x559c[_0x8e8f89];return _0x151938;};'use strict';var _=require(_0xc559('0x0'));var util=require(_0xc559('0x1'));var moment=require(_0xc559('0x2'));var BPromise=require(_0xc559('0x3'));var rs=require(_0xc559('0x4'));var fs=require('fs');var Redis=require(_0xc559('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc559('0x6'));var logger=require(_0xc559('0x7'))(_0xc559('0x8'));var config=require(_0xc559('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc559('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b845,_0x5dedcd,_0x46735b){return new BPromise(function(_0x13cdde,_0x545f63){return client[_0xc559('0xb')](_0x31b845,_0x46735b)[_0xc559('0xc')](function(_0x2a5dab){logger[_0xc559('0xd')](_0xc559('0xe'),_0x5dedcd,'request\x20sent');logger[_0xc559('0xf')](_0xc559('0x10'),_0x5dedcd,_0xc559('0x11'),JSON[_0xc559('0x12')](_0x2a5dab));if(_0x2a5dab['error']){if(_0x2a5dab[_0xc559('0x13')][_0xc559('0x14')]===0x1f4){logger[_0xc559('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5dedcd,_0x2a5dab[_0xc559('0x13')][_0xc559('0x15')]);return _0x545f63(_0x2a5dab[_0xc559('0x13')]['message']);}logger[_0xc559('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5dedcd,_0x2a5dab[_0xc559('0x13')][_0xc559('0x15')]);return _0x13cdde(_0x2a5dab[_0xc559('0x13')][_0xc559('0x15')]);}else{logger[_0xc559('0xd')](_0xc559('0xe'),_0x5dedcd,_0xc559('0x11'));_0x13cdde(_0x2a5dab[_0xc559('0x16')]['message']);}})[_0xc559('0x17')](function(_0x2a7adc){logger[_0xc559('0x13')](_0xc559('0xe'),_0x5dedcd,_0x2a7adc);_0x545f63(_0x2a7adc);});});}exports['GetServicenowAccount']=function(_0x561529){var _0x113370=this;return new Promise(function(_0x107283,_0x1c3d60){return db[_0xc559('0x18')][_0xc559('0x19')]({'raw':_0x561529[_0xc559('0x1a')]?_0x561529[_0xc559('0x1a')][_0xc559('0x1b')]===undefined?!![]:![]:!![],'where':_0x561529[_0xc559('0x1a')]?_0x561529['options'][_0xc559('0x1c')]||null:null,'attributes':_0x561529[_0xc559('0x1a')]?_0x561529[_0xc559('0x1a')][_0xc559('0x1d')]||null:null,'limit':_0x561529['options']?_0x561529['options']['limit']||null:null,'include':_0x561529[_0xc559('0x1a')]?_0x561529['options'][_0xc559('0x1e')]?_['map'](_0x561529['options']['include'],function(_0x4fc520){return{'model':db[_0x4fc520[_0xc559('0x1f')]],'as':_0x4fc520['as'],'attributes':_0x4fc520[_0xc559('0x1d')],'include':_0x4fc520[_0xc559('0x1e')]?_['map'](_0x4fc520[_0xc559('0x1e')],function(_0x3742cd){return{'model':db[_0x3742cd[_0xc559('0x1f')]],'as':_0x3742cd['as'],'attributes':_0x3742cd[_0xc559('0x1d')],'include':_0x3742cd[_0xc559('0x1e')]?_[_0xc559('0x20')](_0x3742cd[_0xc559('0x1e')],function(_0x337bfc){return{'model':db[_0x337bfc[_0xc559('0x1f')]],'as':_0x337bfc['as'],'attributes':_0x337bfc[_0xc559('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc559('0xc')](function(_0x2ad823){logger[_0xc559('0xd')](_0xc559('0x21'),_0x561529);logger['debug'](_0xc559('0x21'),_0x561529,JSON[_0xc559('0x12')](_0x2ad823));_0x107283(_0x2ad823);})[_0xc559('0x17')](function(_0x44ec6b){logger[_0xc559('0x13')](_0xc559('0x21'),_0x44ec6b[_0xc559('0x15')],_0x561529);_0x1c3d60(_0x113370[_0xc559('0x13')](0x1f4,_0x44ec6b[_0xc559('0x15')]));});});};exports[_0xc559('0x22')]=function(_0x31730d){var _0xb9a6fe=this;return new Promise(function(_0x16fb0b,_0x4471e2){return db[_0xc559('0x18')][_0xc559('0x23')]({'raw':_0x31730d[_0xc559('0x1a')]?_0x31730d[_0xc559('0x1a')][_0xc559('0x1b')]===undefined?!![]:![]:!![],'where':_0x31730d['options']?_0x31730d['options']['where']||null:null,'attributes':_0x31730d['options']?_0x31730d[_0xc559('0x1a')]['attributes']||null:null,'include':_0x31730d[_0xc559('0x1a')]?_0x31730d[_0xc559('0x1a')]['include']?_['map'](_0x31730d[_0xc559('0x1a')][_0xc559('0x1e')],function(_0x3d8e7d){return{'model':db[_0x3d8e7d[_0xc559('0x1f')]],'as':_0x3d8e7d['as'],'attributes':_0x3d8e7d['attributes'],'include':_0x3d8e7d[_0xc559('0x1e')]?_[_0xc559('0x20')](_0x3d8e7d[_0xc559('0x1e')],function(_0x32890a){return{'model':db[_0x32890a[_0xc559('0x1f')]],'as':_0x32890a['as'],'attributes':_0x32890a[_0xc559('0x1d')],'include':_0x32890a[_0xc559('0x1e')]?_[_0xc559('0x20')](_0x32890a['include'],function(_0x1b77ca){return{'model':db[_0x1b77ca[_0xc559('0x1f')]],'as':_0x1b77ca['as'],'attributes':_0x1b77ca['attributes']};}):[]};}):[]};}):[]:[]})[_0xc559('0xc')](function(_0x47b87a){logger[_0xc559('0xd')](_0xc559('0x22'),_0x31730d);logger['debug'](_0xc559('0x22'),_0x31730d,JSON[_0xc559('0x12')](_0x47b87a));_0x16fb0b(_0x47b87a);})[_0xc559('0x17')](function(_0x3f679d){logger[_0xc559('0x13')]('ShowServicenowAccount',_0x3f679d['message'],_0x31730d);_0x4471e2(_0xb9a6fe[_0xc559('0x13')](0x1f4,_0x3f679d[_0xc559('0x15')]));});});}; \ No newline at end of file +var _0x5fd9=['stringify','error','code','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','model','map','find','then','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug'];(function(_0x221466,_0x48420b){var _0x3c2231=function(_0x396193){while(--_0x396193){_0x221466['push'](_0x221466['shift']());}};_0x3c2231(++_0x48420b);}(_0x5fd9,0xbe));var _0x95fd=function(_0x360e5c,_0x1d60de){_0x360e5c=_0x360e5c-0x0;var _0x3629ea=_0x5fd9[_0x360e5c];return _0x3629ea;};'use strict';var _=require(_0x95fd('0x0'));var util=require(_0x95fd('0x1'));var moment=require(_0x95fd('0x2'));var BPromise=require(_0x95fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x95fd('0x5'))(_0x95fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x95fd('0x7'));var client=jayson[_0x95fd('0x8')][_0x95fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c6c1f,_0x1d2e04,_0x5e6c74){return new BPromise(function(_0x28a043,_0xa11f69){return client[_0x95fd('0xa')](_0x6c6c1f,_0x5e6c74)['then'](function(_0x1dd2f0){logger[_0x95fd('0xb')](_0x95fd('0xc'),_0x1d2e04,'request\x20sent');logger[_0x95fd('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1d2e04,'request\x20sent',JSON[_0x95fd('0xe')](_0x1dd2f0));if(_0x1dd2f0[_0x95fd('0xf')]){if(_0x1dd2f0[_0x95fd('0xf')][_0x95fd('0x10')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1d2e04,_0x1dd2f0[_0x95fd('0xf')][_0x95fd('0x11')]);return _0xa11f69(_0x1dd2f0['error'][_0x95fd('0x11')]);}logger['error'](_0x95fd('0xc'),_0x1d2e04,_0x1dd2f0[_0x95fd('0xf')][_0x95fd('0x11')]);return _0x28a043(_0x1dd2f0[_0x95fd('0xf')][_0x95fd('0x11')]);}else{logger[_0x95fd('0xb')](_0x95fd('0xc'),_0x1d2e04,_0x95fd('0x12'));_0x28a043(_0x1dd2f0[_0x95fd('0x13')][_0x95fd('0x11')]);}})[_0x95fd('0x14')](function(_0x57a765){logger[_0x95fd('0xf')](_0x95fd('0xc'),_0x1d2e04,_0x57a765);_0xa11f69(_0x57a765);});});}exports[_0x95fd('0x15')]=function(_0x31e5fd){var _0x60f1c3=this;return new Promise(function(_0x16d5f2,_0x349b82){return db[_0x95fd('0x16')]['findAll']({'raw':_0x31e5fd[_0x95fd('0x17')]?_0x31e5fd[_0x95fd('0x17')][_0x95fd('0x18')]===undefined?!![]:![]:!![],'where':_0x31e5fd[_0x95fd('0x17')]?_0x31e5fd[_0x95fd('0x17')][_0x95fd('0x19')]||null:null,'attributes':_0x31e5fd[_0x95fd('0x17')]?_0x31e5fd[_0x95fd('0x17')][_0x95fd('0x1a')]||null:null,'limit':_0x31e5fd[_0x95fd('0x17')]?_0x31e5fd[_0x95fd('0x17')][_0x95fd('0x1b')]||null:null,'include':_0x31e5fd[_0x95fd('0x17')]?_0x31e5fd[_0x95fd('0x17')][_0x95fd('0x1c')]?_['map'](_0x31e5fd['options'][_0x95fd('0x1c')],function(_0x481fbd){return{'model':db[_0x481fbd[_0x95fd('0x1d')]],'as':_0x481fbd['as'],'attributes':_0x481fbd[_0x95fd('0x1a')],'include':_0x481fbd[_0x95fd('0x1c')]?_[_0x95fd('0x1e')](_0x481fbd[_0x95fd('0x1c')],function(_0x46e016){return{'model':db[_0x46e016[_0x95fd('0x1d')]],'as':_0x46e016['as'],'attributes':_0x46e016[_0x95fd('0x1a')],'include':_0x46e016[_0x95fd('0x1c')]?_[_0x95fd('0x1e')](_0x46e016[_0x95fd('0x1c')],function(_0x8ff9c7){return{'model':db[_0x8ff9c7[_0x95fd('0x1d')]],'as':_0x8ff9c7['as'],'attributes':_0x8ff9c7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36bee8){logger['info'](_0x95fd('0x15'),_0x31e5fd);logger[_0x95fd('0xd')](_0x95fd('0x15'),_0x31e5fd,JSON['stringify'](_0x36bee8));_0x16d5f2(_0x36bee8);})['catch'](function(_0x55404d){logger[_0x95fd('0xf')](_0x95fd('0x15'),_0x55404d[_0x95fd('0x11')],_0x31e5fd);_0x349b82(_0x60f1c3[_0x95fd('0xf')](0x1f4,_0x55404d[_0x95fd('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x278c18){var _0x11d9d7=this;return new Promise(function(_0x35f116,_0x58ce07){return db[_0x95fd('0x16')][_0x95fd('0x1f')]({'raw':_0x278c18[_0x95fd('0x17')]?_0x278c18[_0x95fd('0x17')][_0x95fd('0x18')]===undefined?!![]:![]:!![],'where':_0x278c18[_0x95fd('0x17')]?_0x278c18['options']['where']||null:null,'attributes':_0x278c18['options']?_0x278c18[_0x95fd('0x17')]['attributes']||null:null,'include':_0x278c18[_0x95fd('0x17')]?_0x278c18[_0x95fd('0x17')][_0x95fd('0x1c')]?_[_0x95fd('0x1e')](_0x278c18[_0x95fd('0x17')][_0x95fd('0x1c')],function(_0xa281dd){return{'model':db[_0xa281dd[_0x95fd('0x1d')]],'as':_0xa281dd['as'],'attributes':_0xa281dd[_0x95fd('0x1a')],'include':_0xa281dd[_0x95fd('0x1c')]?_[_0x95fd('0x1e')](_0xa281dd[_0x95fd('0x1c')],function(_0x24af1c){return{'model':db[_0x24af1c['model']],'as':_0x24af1c['as'],'attributes':_0x24af1c[_0x95fd('0x1a')],'include':_0x24af1c[_0x95fd('0x1c')]?_[_0x95fd('0x1e')](_0x24af1c[_0x95fd('0x1c')],function(_0x5e8be7){return{'model':db[_0x5e8be7[_0x95fd('0x1d')]],'as':_0x5e8be7['as'],'attributes':_0x5e8be7['attributes']};}):[]};}):[]};}):[]:[]})[_0x95fd('0x20')](function(_0x527199){logger[_0x95fd('0xb')]('ShowServicenowAccount',_0x278c18);logger['debug'](_0x95fd('0x21'),_0x278c18,JSON[_0x95fd('0xe')](_0x527199));_0x35f116(_0x527199);})['catch'](function(_0x5bf602){logger['error'](_0x95fd('0x21'),_0x5bf602[_0x95fd('0x11')],_0x278c18);_0x58ce07(_0x11d9d7[_0x95fd('0xf')](0x1f4,_0x5bf602[_0x95fd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8f3d388..cdc5076 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 _0x1bdc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','/:id/fields','isAuthenticated','/:id/descriptions','post','update','destroy','exports','util','path','connect-timeout'];(function(_0x52e732,_0x3f3d95){var _0x574ddb=function(_0x15cbec){while(--_0x15cbec){_0x52e732['push'](_0x52e732['shift']());}};_0x574ddb(++_0x3f3d95);}(_0x1bdc,0x151));var _0xc1bd=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0x1bdc[_0x2040dd];return _0x27688f;};'use strict';var multer=require('multer');var util=require(_0xc1bd('0x0'));var path=require(_0xc1bd('0x1'));var timeout=require(_0xc1bd('0x2'));var express=require(_0xc1bd('0x3'));var router=express[_0xc1bd('0x4')]();var fs_extra=require(_0xc1bd('0x5'));var auth=require(_0xc1bd('0x6'));var interaction=require(_0xc1bd('0x7'));var config=require(_0xc1bd('0x8'));var controller=require(_0xc1bd('0x9'));router[_0xc1bd('0xa')]('/',auth['isAuthenticated'](),controller[_0xc1bd('0xb')]);router[_0xc1bd('0xa')](_0xc1bd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc1bd('0xa')](_0xc1bd('0xd'),auth[_0xc1bd('0xe')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc1bd('0xa')](_0xc1bd('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc1bd('0x10')]('/',auth[_0xc1bd('0xe')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc1bd('0x11')]);router['delete'](_0xc1bd('0xc'),auth[_0xc1bd('0xe')](),controller[_0xc1bd('0x12')]);module[_0xc1bd('0x13')]=router; \ No newline at end of file +var _0x8276=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x13f482,_0x46260f){var _0x25af1e=function(_0x576172){while(--_0x576172){_0x13f482['push'](_0x13f482['shift']());}};_0x25af1e(++_0x46260f);}(_0x8276,0x1b6));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6827('0x0'));var util=require('util');var path=require(_0x6827('0x1'));var timeout=require(_0x6827('0x2'));var express=require(_0x6827('0x3'));var router=express[_0x6827('0x4')]();var fs_extra=require(_0x6827('0x5'));var auth=require(_0x6827('0x6'));var interaction=require(_0x6827('0x7'));var config=require('../../config/environment');var controller=require(_0x6827('0x8'));router[_0x6827('0x9')]('/',auth['isAuthenticated'](),controller[_0x6827('0xa')]);router[_0x6827('0x9')](_0x6827('0xb'),auth[_0x6827('0xc')](),controller[_0x6827('0xd')]);router[_0x6827('0x9')](_0x6827('0xe'),auth[_0x6827('0xc')](),controller[_0x6827('0xf')]);router[_0x6827('0x9')]('/:id/subjects',auth[_0x6827('0xc')](),controller[_0x6827('0x10')]);router[_0x6827('0x9')](_0x6827('0x11'),auth[_0x6827('0xc')](),controller[_0x6827('0x12')]);router[_0x6827('0x13')]('/',auth[_0x6827('0xc')](),controller[_0x6827('0x14')]);router[_0x6827('0x15')](_0x6827('0xb'),auth[_0x6827('0xc')](),controller[_0x6827('0x16')]);router[_0x6827('0x17')](_0x6827('0xb'),auth[_0x6827('0xc')](),controller[_0x6827('0x18')]);module[_0x6827('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c803747..ce40e22 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 _0x008f=['exports','STRING','sequelize'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x008f,0xbf));var _0xf008=function(_0xa261f5,_0x37ed4e){_0xa261f5=_0xa261f5-0x0;var _0x4a889b=_0x008f[_0xa261f5];return _0x4a889b;};'use strict';var Sequelize=require(_0xf008('0x0'));module[_0xf008('0x1')]={'name':{'type':Sequelize[_0xf008('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbfbe=['STRING','sequelize'];(function(_0x26c4c0,_0xf70303){var _0x4785a1=function(_0x35fc31){while(--_0x35fc31){_0x26c4c0['push'](_0x26c4c0['shift']());}};_0x4785a1(++_0xf70303);}(_0xbfbe,0x127));var _0xebfb=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0xbfbe[_0xc14df7];return _0x34a445;};'use strict';var Sequelize=require(_0xebfb('0x0'));module['exports']={'name':{'type':Sequelize[_0xebfb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b56ad05..85addb4 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 _0x39e7=['include','find','catch','create','body','update','params','getFields','ServicenowField','getSubjects','findOne','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','length'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x39e7,0x161));var _0x739e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39e7[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x739e('0x0'));var zipdir=require(_0x739e('0x1'));var jsonpatch=require(_0x739e('0x2'));var rp=require(_0x739e('0x3'));var moment=require(_0x739e('0x4'));var BPromise=require(_0x739e('0x5'));var Mustache=require(_0x739e('0x6'));var util=require(_0x739e('0x7'));var path=require(_0x739e('0x8'));var sox=require(_0x739e('0x9'));var csv=require(_0x739e('0xa'));var ejs=require(_0x739e('0xb'));var fs=require('fs');var fs_extra=require(_0x739e('0xc'));var _=require(_0x739e('0xd'));var squel=require(_0x739e('0xe'));var crypto=require('crypto');var jsforce=require(_0x739e('0xf'));var deskjs=require(_0x739e('0x10'));var toCsv=require(_0x739e('0xa'));var querystring=require(_0x739e('0x11'));var Papa=require(_0x739e('0x12'));var Redis=require(_0x739e('0x13'));var authService=require(_0x739e('0x14'));var qs=require(_0x739e('0x15'));var as=require(_0x739e('0x16'));var hardwareService=require(_0x739e('0x17'));var logger=require(_0x739e('0x18'))(_0x739e('0x19'));var utils=require(_0x739e('0x1a'));var config=require(_0x739e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x739e('0x1c'))['db'];function respondWithStatusCode(_0x19f30f,_0x1b6a38){_0x1b6a38=_0x1b6a38||0xcc;return function(_0x2704ae){if(_0x2704ae){return _0x19f30f[_0x739e('0x1d')](_0x1b6a38);}return _0x19f30f['status'](_0x1b6a38)['end']();};}function respondWithResult(_0x33f399,_0x247771){_0x247771=_0x247771||0xc8;return function(_0x45314b){if(_0x45314b){return _0x33f399[_0x739e('0x1e')](_0x247771)[_0x739e('0x1f')](_0x45314b);}};}function respondWithFilteredResult(_0x115de8,_0x5ebeb7){return function(_0x560c7e){if(_0x560c7e){var _0x1a76a9=typeof _0x5ebeb7[_0x739e('0x20')]==='undefined'&&typeof _0x5ebeb7[_0x739e('0x21')]===_0x739e('0x22');var _0x1347c3=_0x560c7e['count'];var _0x3c6ab3=_0x1a76a9?0x0:_0x5ebeb7[_0x739e('0x20')];var _0x5739a8=_0x1a76a9?_0x560c7e[_0x739e('0x23')]:_0x5ebeb7[_0x739e('0x20')]+_0x5ebeb7[_0x739e('0x21')];var _0x5bfc1a;if(_0x5739a8>=_0x1347c3){_0x5739a8=_0x1347c3;_0x5bfc1a=0xc8;}else{_0x5bfc1a=0xce;}_0x115de8[_0x739e('0x1e')](_0x5bfc1a);return _0x115de8['set'](_0x739e('0x24'),_0x3c6ab3+'-'+_0x5739a8+'/'+_0x1347c3)[_0x739e('0x1f')](_0x560c7e);}return null;};}function patchUpdates(_0x2c583a){return function(_0x2c108e){try{jsonpatch[_0x739e('0x25')](_0x2c108e,_0x2c583a,!![]);}catch(_0x172b9e){return BPromise[_0x739e('0x26')](_0x172b9e);}return _0x2c108e['save']();};}function saveUpdates(_0xe2dd2c,_0x4c72df){return function(_0x3ec24d){if(_0x3ec24d){return _0x3ec24d['update'](_0xe2dd2c)[_0x739e('0x27')](function(_0x3e0f68){return _0x3e0f68;});}return null;};}function removeEntity(_0x2d3cbb,_0x40ee50){return function(_0x16180a){if(_0x16180a){return _0x16180a[_0x739e('0x28')]()[_0x739e('0x27')](function(){_0x2d3cbb[_0x739e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576d8f,_0x2c199e){return function(_0x211164){if(!_0x211164){_0x576d8f['sendStatus'](0x194);}return _0x211164;};}function handleError(_0x4d02ae,_0x450519){_0x450519=_0x450519||0x1f4;return function(_0x5180e1){logger[_0x739e('0x29')](_0x5180e1[_0x739e('0x2a')]);if(_0x5180e1['name']){delete _0x5180e1[_0x739e('0x2b')];}_0x4d02ae[_0x739e('0x1e')](_0x450519)[_0x739e('0x2c')](_0x5180e1);};}exports[_0x739e('0x2d')]=function(_0xedb3ee,_0x35c078){var _0x37c9ab={},_0x1036c6={},_0x1c58b0={'count':0x0,'rows':[]};var _0x34c0e1=_[_0x739e('0x2e')](db[_0x739e('0x2f')][_0x739e('0x30')],function(_0x5ecd36){return{'name':_0x5ecd36[_0x739e('0x31')],'type':_0x5ecd36[_0x739e('0x32')][_0x739e('0x33')]};});_0x1036c6[_0x739e('0x34')]=_[_0x739e('0x2e')](_0x34c0e1,_0x739e('0x2b'));_0x1036c6[_0x739e('0x35')]=_[_0x739e('0x36')](_0xedb3ee[_0x739e('0x35')]);_0x1036c6['filters']=_[_0x739e('0x37')](_0x1036c6[_0x739e('0x34')],_0x1036c6[_0x739e('0x35')]);_0x37c9ab[_0x739e('0x38')]=_[_0x739e('0x37')](_0x1036c6[_0x739e('0x34')],qs[_0x739e('0x39')](_0xedb3ee[_0x739e('0x35')][_0x739e('0x39')]));_0x37c9ab['attributes']=_0x37c9ab['attributes']['length']?_0x37c9ab[_0x739e('0x38')]:_0x1036c6[_0x739e('0x34')];if(!_0xedb3ee[_0x739e('0x35')][_0x739e('0x3a')]('nolimit')){_0x37c9ab[_0x739e('0x21')]=qs[_0x739e('0x21')](_0xedb3ee[_0x739e('0x35')][_0x739e('0x21')]);_0x37c9ab[_0x739e('0x20')]=qs['offset'](_0xedb3ee[_0x739e('0x35')][_0x739e('0x20')]);}_0x37c9ab[_0x739e('0x3b')]=qs[_0x739e('0x3c')](_0xedb3ee[_0x739e('0x35')][_0x739e('0x3c')]);_0x37c9ab[_0x739e('0x3d')]=qs[_0x739e('0x3e')](_[_0x739e('0x3f')](_0xedb3ee[_0x739e('0x35')],_0x1036c6[_0x739e('0x3e')]),_0x34c0e1);if(_0xedb3ee[_0x739e('0x35')][_0x739e('0x40')]){_0x37c9ab[_0x739e('0x3d')]=_[_0x739e('0x41')](_0x37c9ab['where'],{'$or':_[_0x739e('0x2e')](_0x34c0e1,function(_0x1a72f0){if(_0x1a72f0[_0x739e('0x32')]!=='VIRTUAL'){var _0x6e3336={};_0x6e3336[_0x1a72f0[_0x739e('0x2b')]]={'$like':'%'+_0xedb3ee[_0x739e('0x35')][_0x739e('0x40')]+'%'};return _0x6e3336;}})});}_0x37c9ab=_['merge']({},_0x37c9ab,_0xedb3ee[_0x739e('0x42')]);var _0x57bf07={'where':_0x37c9ab[_0x739e('0x3d')]};return db['ServicenowConfiguration'][_0x739e('0x23')](_0x57bf07)[_0x739e('0x27')](function(_0xcaa47f){_0x1c58b0[_0x739e('0x23')]=_0xcaa47f;if(_0xedb3ee[_0x739e('0x35')][_0x739e('0x43')]){_0x37c9ab['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x739e('0x44')](_0x37c9ab);})['then'](function(_0xb6d038){_0x1c58b0[_0x739e('0x45')]=_0xb6d038;return _0x1c58b0;})[_0x739e('0x27')](respondWithFilteredResult(_0x35c078,_0x37c9ab))['catch'](handleError(_0x35c078,null));};exports[_0x739e('0x46')]=function(_0x480933,_0x3418ee){var _0x4fb706={'raw':![],'where':{'id':_0x480933['params']['id']}},_0x55cca8={};_0x55cca8[_0x739e('0x34')]=_[_0x739e('0x36')](db[_0x739e('0x2f')][_0x739e('0x30')]);_0x55cca8[_0x739e('0x35')]=_['keys'](_0x480933['query']);_0x55cca8['filters']=_[_0x739e('0x37')](_0x55cca8['model'],_0x55cca8[_0x739e('0x35')]);_0x4fb706[_0x739e('0x38')]=_['intersection'](_0x55cca8[_0x739e('0x34')],qs[_0x739e('0x39')](_0x480933[_0x739e('0x35')]['fields']));_0x4fb706[_0x739e('0x38')]=_0x4fb706[_0x739e('0x38')][_0x739e('0x47')]?_0x4fb706[_0x739e('0x38')]:_0x55cca8['model'];if(_0x480933[_0x739e('0x35')][_0x739e('0x43')]){_0x4fb706[_0x739e('0x48')]=[{'all':!![]}];}_0x4fb706=_[_0x739e('0x41')]({},_0x4fb706,_0x480933['options']);return db[_0x739e('0x2f')][_0x739e('0x49')](_0x4fb706)['then'](handleEntityNotFound(_0x3418ee,null))[_0x739e('0x27')](respondWithResult(_0x3418ee,null))[_0x739e('0x4a')](handleError(_0x3418ee,null));};exports['create']=function(_0x26a8ce,_0x286859){return db['ServicenowConfiguration'][_0x739e('0x4b')](_0x26a8ce[_0x739e('0x4c')],{})[_0x739e('0x27')](respondWithResult(_0x286859,0xc9))[_0x739e('0x4a')](handleError(_0x286859,null));};exports[_0x739e('0x4d')]=function(_0x3104c6,_0x5dc72e){if(_0x3104c6[_0x739e('0x4c')]['id']){delete _0x3104c6['body']['id'];}return db['ServicenowConfiguration'][_0x739e('0x49')]({'where':{'id':_0x3104c6[_0x739e('0x4e')]['id']}})[_0x739e('0x27')](handleEntityNotFound(_0x5dc72e,null))[_0x739e('0x27')](saveUpdates(_0x3104c6[_0x739e('0x4c')],null))[_0x739e('0x27')](respondWithResult(_0x5dc72e,null))[_0x739e('0x4a')](handleError(_0x5dc72e,null));};exports[_0x739e('0x28')]=function(_0x1cc104,_0x4beb1f){return db[_0x739e('0x2f')]['find']({'where':{'id':_0x1cc104[_0x739e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4beb1f,null))[_0x739e('0x27')](removeEntity(_0x4beb1f,null))[_0x739e('0x4a')](handleError(_0x4beb1f,null));};exports[_0x739e('0x4f')]=function(_0x435aa7,_0x86fb98,_0x594608){var _0x20e651={};var _0x42bb17={};var _0x1186cc;var _0x385953;return db[_0x739e('0x2f')]['findOne']({'where':{'id':_0x435aa7[_0x739e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x86fb98,null))[_0x739e('0x27')](function(_0xcf36b){if(_0xcf36b){_0x1186cc=_0xcf36b;_0x42bb17[_0x739e('0x34')]=_[_0x739e('0x36')](db[_0x739e('0x50')][_0x739e('0x30')]);_0x42bb17['query']=_['keys'](_0x435aa7[_0x739e('0x35')]);_0x42bb17['filters']=_['intersection'](_0x42bb17['model'],_0x42bb17[_0x739e('0x35')]);_0x20e651[_0x739e('0x38')]=_[_0x739e('0x37')](_0x42bb17[_0x739e('0x34')],qs[_0x739e('0x39')](_0x435aa7[_0x739e('0x35')][_0x739e('0x39')]));_0x20e651[_0x739e('0x38')]=_0x20e651[_0x739e('0x38')][_0x739e('0x47')]?_0x20e651[_0x739e('0x38')]:_0x42bb17[_0x739e('0x34')];_0x20e651[_0x739e('0x3b')]=qs['sort'](_0x435aa7[_0x739e('0x35')][_0x739e('0x3c')]);_0x20e651[_0x739e('0x3d')]=qs[_0x739e('0x3e')](_[_0x739e('0x3f')](_0x435aa7['query'],_0x42bb17[_0x739e('0x3e')]));if(_0x435aa7['query'][_0x739e('0x40')]){_0x20e651[_0x739e('0x3d')]=_['merge'](_0x20e651[_0x739e('0x3d')],{'$or':_[_0x739e('0x2e')](_0x20e651['attributes'],function(_0x237125){var _0x44dc54={};_0x44dc54[_0x237125]={'$like':'%'+_0x435aa7[_0x739e('0x35')]['filter']+'%'};return _0x44dc54;})});}_0x20e651=_[_0x739e('0x41')]({},_0x20e651,_0x435aa7[_0x739e('0x42')]);return _0x1186cc['getFields'](_0x20e651);}})[_0x739e('0x27')](function(_0x156845){if(_0x156845){_0x385953=_0x156845[_0x739e('0x47')];if(!_0x435aa7[_0x739e('0x35')][_0x739e('0x3a')]('nolimit')){_0x20e651['limit']=qs[_0x739e('0x21')](_0x435aa7[_0x739e('0x35')][_0x739e('0x21')]);_0x20e651[_0x739e('0x20')]=qs['offset'](_0x435aa7[_0x739e('0x35')][_0x739e('0x20')]);}return _0x1186cc[_0x739e('0x4f')](_0x20e651);}})['then'](function(_0x5de30c){if(_0x5de30c){return _0x5de30c?{'count':_0x385953,'rows':_0x5de30c}:null;}})[_0x739e('0x27')](respondWithResult(_0x86fb98,null))[_0x739e('0x4a')](handleError(_0x86fb98,null));};exports[_0x739e('0x51')]=function(_0x6c36e9,_0x5b686a,_0x4fcdb0){var _0x431fc2={};var _0x2f99e7={};var _0x1ba366;var _0x37bd31;return db[_0x739e('0x2f')][_0x739e('0x52')]({'where':{'id':_0x6c36e9[_0x739e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b686a,null))[_0x739e('0x27')](function(_0x28ad9f){if(_0x28ad9f){_0x1ba366=_0x28ad9f;_0x2f99e7[_0x739e('0x34')]=_[_0x739e('0x36')](db[_0x739e('0x50')][_0x739e('0x30')]);_0x2f99e7['query']=_['keys'](_0x6c36e9['query']);_0x2f99e7['filters']=_[_0x739e('0x37')](_0x2f99e7[_0x739e('0x34')],_0x2f99e7[_0x739e('0x35')]);_0x431fc2[_0x739e('0x38')]=_[_0x739e('0x37')](_0x2f99e7[_0x739e('0x34')],qs[_0x739e('0x39')](_0x6c36e9[_0x739e('0x35')]['fields']));_0x431fc2[_0x739e('0x38')]=_0x431fc2[_0x739e('0x38')][_0x739e('0x47')]?_0x431fc2[_0x739e('0x38')]:_0x2f99e7['model'];_0x431fc2[_0x739e('0x3b')]=qs[_0x739e('0x3c')](_0x6c36e9['query'][_0x739e('0x3c')]);_0x431fc2['where']=qs[_0x739e('0x3e')](_['pick'](_0x6c36e9['query'],_0x2f99e7['filters']));if(_0x6c36e9[_0x739e('0x35')][_0x739e('0x40')]){_0x431fc2[_0x739e('0x3d')]=_[_0x739e('0x41')](_0x431fc2[_0x739e('0x3d')],{'$or':_[_0x739e('0x2e')](_0x431fc2['attributes'],function(_0x327b3e){var _0x4f141a={};_0x4f141a[_0x327b3e]={'$like':'%'+_0x6c36e9[_0x739e('0x35')][_0x739e('0x40')]+'%'};return _0x4f141a;})});}_0x431fc2=_['merge']({},_0x431fc2,_0x6c36e9[_0x739e('0x42')]);return _0x1ba366[_0x739e('0x51')](_0x431fc2);}})[_0x739e('0x27')](function(_0x6b858e){if(_0x6b858e){_0x37bd31=_0x6b858e[_0x739e('0x47')];if(!_0x6c36e9['query'][_0x739e('0x3a')](_0x739e('0x53'))){_0x431fc2[_0x739e('0x21')]=qs[_0x739e('0x21')](_0x6c36e9[_0x739e('0x35')][_0x739e('0x21')]);_0x431fc2[_0x739e('0x20')]=qs[_0x739e('0x20')](_0x6c36e9[_0x739e('0x35')][_0x739e('0x20')]);}return _0x1ba366[_0x739e('0x51')](_0x431fc2);}})[_0x739e('0x27')](function(_0x22e5cc){if(_0x22e5cc){return _0x22e5cc?{'count':_0x37bd31,'rows':_0x22e5cc}:null;}})[_0x739e('0x27')](respondWithResult(_0x5b686a,null))[_0x739e('0x4a')](handleError(_0x5b686a,null));};exports[_0x739e('0x54')]=function(_0x4f3d5a,_0xe70bf9,_0x45c199){var _0x5aeac2={};var _0x16d976={};var _0x7a22bb;var _0x5ac280;return db['ServicenowConfiguration'][_0x739e('0x52')]({'where':{'id':_0x4f3d5a[_0x739e('0x4e')]['id']}})[_0x739e('0x27')](handleEntityNotFound(_0xe70bf9,null))[_0x739e('0x27')](function(_0xd5c21){if(_0xd5c21){_0x7a22bb=_0xd5c21;_0x16d976[_0x739e('0x34')]=_[_0x739e('0x36')](db['ServicenowField'][_0x739e('0x30')]);_0x16d976['query']=_[_0x739e('0x36')](_0x4f3d5a[_0x739e('0x35')]);_0x16d976[_0x739e('0x3e')]=_[_0x739e('0x37')](_0x16d976[_0x739e('0x34')],_0x16d976[_0x739e('0x35')]);_0x5aeac2['attributes']=_[_0x739e('0x37')](_0x16d976[_0x739e('0x34')],qs[_0x739e('0x39')](_0x4f3d5a['query'][_0x739e('0x39')]));_0x5aeac2[_0x739e('0x38')]=_0x5aeac2['attributes'][_0x739e('0x47')]?_0x5aeac2['attributes']:_0x16d976[_0x739e('0x34')];_0x5aeac2['order']=qs[_0x739e('0x3c')](_0x4f3d5a['query'][_0x739e('0x3c')]);_0x5aeac2['where']=qs[_0x739e('0x3e')](_['pick'](_0x4f3d5a[_0x739e('0x35')],_0x16d976[_0x739e('0x3e')]));if(_0x4f3d5a[_0x739e('0x35')][_0x739e('0x40')]){_0x5aeac2[_0x739e('0x3d')]=_['merge'](_0x5aeac2['where'],{'$or':_[_0x739e('0x2e')](_0x5aeac2['attributes'],function(_0x168cee){var _0x385719={};_0x385719[_0x168cee]={'$like':'%'+_0x4f3d5a['query']['filter']+'%'};return _0x385719;})});}_0x5aeac2=_[_0x739e('0x41')]({},_0x5aeac2,_0x4f3d5a[_0x739e('0x42')]);return _0x7a22bb[_0x739e('0x54')](_0x5aeac2);}})['then'](function(_0x1e9027){if(_0x1e9027){_0x5ac280=_0x1e9027[_0x739e('0x47')];if(!_0x4f3d5a[_0x739e('0x35')][_0x739e('0x3a')](_0x739e('0x53'))){_0x5aeac2['limit']=qs[_0x739e('0x21')](_0x4f3d5a[_0x739e('0x35')][_0x739e('0x21')]);_0x5aeac2[_0x739e('0x20')]=qs[_0x739e('0x20')](_0x4f3d5a[_0x739e('0x35')]['offset']);}return _0x7a22bb[_0x739e('0x54')](_0x5aeac2);}})[_0x739e('0x27')](function(_0x52123e){if(_0x52123e){return _0x52123e?{'count':_0x5ac280,'rows':_0x52123e}:null;}})[_0x739e('0x27')](respondWithResult(_0xe70bf9,null))[_0x739e('0x4a')](handleError(_0xe70bf9,null));}; \ No newline at end of file +var _0x80d2=['includeAll','find','catch','create','body','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','sendStatus','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','params','length'];(function(_0x16e690,_0x5d4683){var _0x3beb56=function(_0x547cf5){while(--_0x547cf5){_0x16e690['push'](_0x16e690['shift']());}};_0x3beb56(++_0x5d4683);}(_0x80d2,0x18c));var _0x280d=function(_0x4c0cdf,_0x5a95d4){_0x4c0cdf=_0x4c0cdf-0x0;var _0x1d13a9=_0x80d2[_0x4c0cdf];return _0x1d13a9;};'use strict';var emlformat=require(_0x280d('0x0'));var rimraf=require(_0x280d('0x1'));var zipdir=require(_0x280d('0x2'));var jsonpatch=require(_0x280d('0x3'));var rp=require(_0x280d('0x4'));var moment=require(_0x280d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x280d('0x6'));var util=require('util');var path=require(_0x280d('0x7'));var sox=require(_0x280d('0x8'));var csv=require(_0x280d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x280d('0xa'));var _=require(_0x280d('0xb'));var squel=require(_0x280d('0xc'));var crypto=require(_0x280d('0xd'));var jsforce=require(_0x280d('0xe'));var deskjs=require(_0x280d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x280d('0x10'));var authService=require(_0x280d('0x11'));var qs=require(_0x280d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x280d('0x13'));var logger=require(_0x280d('0x14'))(_0x280d('0x15'));var utils=require('../../config/utils');var config=require(_0x280d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x280d('0x17'))['db'];function respondWithStatusCode(_0x54dc69,_0x194efc){_0x194efc=_0x194efc||0xcc;return function(_0xd18ddb){if(_0xd18ddb){return _0x54dc69['sendStatus'](_0x194efc);}return _0x54dc69[_0x280d('0x18')](_0x194efc)[_0x280d('0x19')]();};}function respondWithResult(_0x251b54,_0x18743e){_0x18743e=_0x18743e||0xc8;return function(_0x22c5c8){if(_0x22c5c8){return _0x251b54['status'](_0x18743e)[_0x280d('0x1a')](_0x22c5c8);}};}function respondWithFilteredResult(_0x3cc35d,_0x1adf7e){return function(_0x5201bf){if(_0x5201bf){var _0x3806b6=typeof _0x1adf7e[_0x280d('0x1b')]===_0x280d('0x1c')&&typeof _0x1adf7e[_0x280d('0x1d')]===_0x280d('0x1c');var _0x108557=_0x5201bf[_0x280d('0x1e')];var _0x81f694=_0x3806b6?0x0:_0x1adf7e[_0x280d('0x1b')];var _0x315c7b=_0x3806b6?_0x5201bf['count']:_0x1adf7e[_0x280d('0x1b')]+_0x1adf7e[_0x280d('0x1d')];var _0xf74268;if(_0x315c7b>=_0x108557){_0x315c7b=_0x108557;_0xf74268=0xc8;}else{_0xf74268=0xce;}_0x3cc35d[_0x280d('0x18')](_0xf74268);return _0x3cc35d[_0x280d('0x1f')]('Content-Range',_0x81f694+'-'+_0x315c7b+'/'+_0x108557)[_0x280d('0x1a')](_0x5201bf);}return null;};}function patchUpdates(_0x2e4b9b){return function(_0x1c1f31){try{jsonpatch['apply'](_0x1c1f31,_0x2e4b9b,!![]);}catch(_0x357dda){return BPromise['reject'](_0x357dda);}return _0x1c1f31[_0x280d('0x20')]();};}function saveUpdates(_0x3634a4,_0x3cddd4){return function(_0x32e0c4){if(_0x32e0c4){return _0x32e0c4[_0x280d('0x21')](_0x3634a4)['then'](function(_0x6656fc){return _0x6656fc;});}return null;};}function removeEntity(_0x458ea9,_0x47a995){return function(_0x580a72){if(_0x580a72){return _0x580a72['destroy']()[_0x280d('0x22')](function(){_0x458ea9[_0x280d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350734,_0x55a0fd){return function(_0x534556){if(!_0x534556){_0x350734[_0x280d('0x23')](0x194);}return _0x534556;};}function handleError(_0x3a3bea,_0x4372ae){_0x4372ae=_0x4372ae||0x1f4;return function(_0x5497d8){logger[_0x280d('0x24')](_0x5497d8['stack']);if(_0x5497d8[_0x280d('0x25')]){delete _0x5497d8[_0x280d('0x25')];}_0x3a3bea[_0x280d('0x18')](_0x4372ae)[_0x280d('0x26')](_0x5497d8);};}exports[_0x280d('0x27')]=function(_0x2a4fda,_0x1e992d){var _0x4abd45={},_0xc6d75f={},_0x44e73f={'count':0x0,'rows':[]};var _0x59975e=_[_0x280d('0x28')](db[_0x280d('0x29')][_0x280d('0x2a')],function(_0x29f9a0){return{'name':_0x29f9a0[_0x280d('0x2b')],'type':_0x29f9a0[_0x280d('0x2c')][_0x280d('0x2d')]};});_0xc6d75f[_0x280d('0x2e')]=_['map'](_0x59975e,_0x280d('0x25'));_0xc6d75f[_0x280d('0x2f')]=_[_0x280d('0x30')](_0x2a4fda['query']);_0xc6d75f['filters']=_[_0x280d('0x31')](_0xc6d75f['model'],_0xc6d75f[_0x280d('0x2f')]);_0x4abd45['attributes']=_[_0x280d('0x31')](_0xc6d75f[_0x280d('0x2e')],qs['fields'](_0x2a4fda[_0x280d('0x2f')][_0x280d('0x32')]));_0x4abd45['attributes']=_0x4abd45[_0x280d('0x33')]['length']?_0x4abd45['attributes']:_0xc6d75f['model'];if(!_0x2a4fda['query'][_0x280d('0x34')](_0x280d('0x35'))){_0x4abd45[_0x280d('0x1d')]=qs['limit'](_0x2a4fda[_0x280d('0x2f')]['limit']);_0x4abd45[_0x280d('0x1b')]=qs[_0x280d('0x1b')](_0x2a4fda['query']['offset']);}_0x4abd45[_0x280d('0x36')]=qs[_0x280d('0x37')](_0x2a4fda[_0x280d('0x2f')][_0x280d('0x37')]);_0x4abd45['where']=qs[_0x280d('0x38')](_[_0x280d('0x39')](_0x2a4fda[_0x280d('0x2f')],_0xc6d75f[_0x280d('0x38')]),_0x59975e);if(_0x2a4fda[_0x280d('0x2f')][_0x280d('0x3a')]){_0x4abd45[_0x280d('0x3b')]=_[_0x280d('0x3c')](_0x4abd45['where'],{'$or':_[_0x280d('0x28')](_0x59975e,function(_0xf9bc84){if(_0xf9bc84[_0x280d('0x2c')]!==_0x280d('0x3d')){var _0x423c96={};_0x423c96[_0xf9bc84['name']]={'$like':'%'+_0x2a4fda['query']['filter']+'%'};return _0x423c96;}})});}_0x4abd45=_[_0x280d('0x3c')]({},_0x4abd45,_0x2a4fda[_0x280d('0x3e')]);var _0x215e2b={'where':_0x4abd45['where']};return db[_0x280d('0x29')]['count'](_0x215e2b)['then'](function(_0x5e5505){_0x44e73f['count']=_0x5e5505;if(_0x2a4fda[_0x280d('0x2f')]['includeAll']){_0x4abd45[_0x280d('0x3f')]=[{'all':!![]}];}return db[_0x280d('0x29')]['findAll'](_0x4abd45);})[_0x280d('0x22')](function(_0x358839){_0x44e73f['rows']=_0x358839;return _0x44e73f;})[_0x280d('0x22')](respondWithFilteredResult(_0x1e992d,_0x4abd45))['catch'](handleError(_0x1e992d,null));};exports['show']=function(_0x597cda,_0x4c50e1){var _0x5429dc={'raw':![],'where':{'id':_0x597cda[_0x280d('0x40')]['id']}},_0x115166={};_0x115166[_0x280d('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x280d('0x2a')]);_0x115166[_0x280d('0x2f')]=_[_0x280d('0x30')](_0x597cda[_0x280d('0x2f')]);_0x115166[_0x280d('0x38')]=_[_0x280d('0x31')](_0x115166['model'],_0x115166[_0x280d('0x2f')]);_0x5429dc[_0x280d('0x33')]=_[_0x280d('0x31')](_0x115166['model'],qs['fields'](_0x597cda[_0x280d('0x2f')]['fields']));_0x5429dc[_0x280d('0x33')]=_0x5429dc[_0x280d('0x33')][_0x280d('0x41')]?_0x5429dc[_0x280d('0x33')]:_0x115166['model'];if(_0x597cda['query'][_0x280d('0x42')]){_0x5429dc[_0x280d('0x3f')]=[{'all':!![]}];}_0x5429dc=_[_0x280d('0x3c')]({},_0x5429dc,_0x597cda[_0x280d('0x3e')]);return db[_0x280d('0x29')][_0x280d('0x43')](_0x5429dc)[_0x280d('0x22')](handleEntityNotFound(_0x4c50e1,null))[_0x280d('0x22')](respondWithResult(_0x4c50e1,null))[_0x280d('0x44')](handleError(_0x4c50e1,null));};exports['create']=function(_0x5aa725,_0x3e59d7){return db[_0x280d('0x29')][_0x280d('0x45')](_0x5aa725[_0x280d('0x46')],{})['then'](respondWithResult(_0x3e59d7,0xc9))[_0x280d('0x44')](handleError(_0x3e59d7,null));};exports['update']=function(_0x52a55f,_0x1a0d3c){if(_0x52a55f['body']['id']){delete _0x52a55f[_0x280d('0x46')]['id'];}return db[_0x280d('0x29')][_0x280d('0x43')]({'where':{'id':_0x52a55f[_0x280d('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a0d3c,null))[_0x280d('0x22')](saveUpdates(_0x52a55f['body'],null))[_0x280d('0x22')](respondWithResult(_0x1a0d3c,null))[_0x280d('0x44')](handleError(_0x1a0d3c,null));};exports[_0x280d('0x47')]=function(_0x38fe41,_0xf49bc6){return db[_0x280d('0x29')][_0x280d('0x43')]({'where':{'id':_0x38fe41[_0x280d('0x40')]['id']}})[_0x280d('0x22')](handleEntityNotFound(_0xf49bc6,null))[_0x280d('0x22')](removeEntity(_0xf49bc6,null))[_0x280d('0x44')](handleError(_0xf49bc6,null));};exports[_0x280d('0x48')]=function(_0x40a875,_0x4d5a32,_0x46c10d){var _0x1f275f={};var _0xaa0c3d={};var _0x1fd7b1;var _0x29998f;return db['ServicenowConfiguration'][_0x280d('0x49')]({'where':{'id':_0x40a875[_0x280d('0x40')]['id']}})[_0x280d('0x22')](handleEntityNotFound(_0x4d5a32,null))[_0x280d('0x22')](function(_0x1592df){if(_0x1592df){_0x1fd7b1=_0x1592df;_0xaa0c3d[_0x280d('0x2e')]=_['keys'](db[_0x280d('0x4a')]['rawAttributes']);_0xaa0c3d[_0x280d('0x2f')]=_['keys'](_0x40a875[_0x280d('0x2f')]);_0xaa0c3d[_0x280d('0x38')]=_[_0x280d('0x31')](_0xaa0c3d['model'],_0xaa0c3d[_0x280d('0x2f')]);_0x1f275f[_0x280d('0x33')]=_[_0x280d('0x31')](_0xaa0c3d[_0x280d('0x2e')],qs[_0x280d('0x32')](_0x40a875['query']['fields']));_0x1f275f['attributes']=_0x1f275f[_0x280d('0x33')]['length']?_0x1f275f[_0x280d('0x33')]:_0xaa0c3d[_0x280d('0x2e')];_0x1f275f[_0x280d('0x36')]=qs[_0x280d('0x37')](_0x40a875[_0x280d('0x2f')][_0x280d('0x37')]);_0x1f275f['where']=qs[_0x280d('0x38')](_[_0x280d('0x39')](_0x40a875[_0x280d('0x2f')],_0xaa0c3d[_0x280d('0x38')]));if(_0x40a875[_0x280d('0x2f')][_0x280d('0x3a')]){_0x1f275f[_0x280d('0x3b')]=_['merge'](_0x1f275f[_0x280d('0x3b')],{'$or':_[_0x280d('0x28')](_0x1f275f[_0x280d('0x33')],function(_0xfbb8c){var _0x553d16={};_0x553d16[_0xfbb8c]={'$like':'%'+_0x40a875[_0x280d('0x2f')]['filter']+'%'};return _0x553d16;})});}_0x1f275f=_[_0x280d('0x3c')]({},_0x1f275f,_0x40a875['options']);return _0x1fd7b1[_0x280d('0x48')](_0x1f275f);}})[_0x280d('0x22')](function(_0x19dd1c){if(_0x19dd1c){_0x29998f=_0x19dd1c[_0x280d('0x41')];if(!_0x40a875[_0x280d('0x2f')][_0x280d('0x34')](_0x280d('0x35'))){_0x1f275f[_0x280d('0x1d')]=qs[_0x280d('0x1d')](_0x40a875[_0x280d('0x2f')][_0x280d('0x1d')]);_0x1f275f[_0x280d('0x1b')]=qs[_0x280d('0x1b')](_0x40a875[_0x280d('0x2f')][_0x280d('0x1b')]);}return _0x1fd7b1['getFields'](_0x1f275f);}})[_0x280d('0x22')](function(_0x4c7e8a){if(_0x4c7e8a){return _0x4c7e8a?{'count':_0x29998f,'rows':_0x4c7e8a}:null;}})[_0x280d('0x22')](respondWithResult(_0x4d5a32,null))[_0x280d('0x44')](handleError(_0x4d5a32,null));};exports[_0x280d('0x4b')]=function(_0x36bd98,_0x4760da,_0x2bdc98){var _0x41faf6={};var _0x34d775={};var _0x45583c;var _0x307c2c;return db[_0x280d('0x29')][_0x280d('0x49')]({'where':{'id':_0x36bd98['params']['id']}})[_0x280d('0x22')](handleEntityNotFound(_0x4760da,null))[_0x280d('0x22')](function(_0x4d9aec){if(_0x4d9aec){_0x45583c=_0x4d9aec;_0x34d775[_0x280d('0x2e')]=_[_0x280d('0x30')](db['ServicenowField'][_0x280d('0x2a')]);_0x34d775[_0x280d('0x2f')]=_['keys'](_0x36bd98['query']);_0x34d775[_0x280d('0x38')]=_[_0x280d('0x31')](_0x34d775['model'],_0x34d775[_0x280d('0x2f')]);_0x41faf6[_0x280d('0x33')]=_['intersection'](_0x34d775[_0x280d('0x2e')],qs[_0x280d('0x32')](_0x36bd98[_0x280d('0x2f')][_0x280d('0x32')]));_0x41faf6[_0x280d('0x33')]=_0x41faf6[_0x280d('0x33')][_0x280d('0x41')]?_0x41faf6[_0x280d('0x33')]:_0x34d775[_0x280d('0x2e')];_0x41faf6[_0x280d('0x36')]=qs['sort'](_0x36bd98[_0x280d('0x2f')][_0x280d('0x37')]);_0x41faf6[_0x280d('0x3b')]=qs[_0x280d('0x38')](_['pick'](_0x36bd98['query'],_0x34d775['filters']));if(_0x36bd98['query']['filter']){_0x41faf6[_0x280d('0x3b')]=_[_0x280d('0x3c')](_0x41faf6[_0x280d('0x3b')],{'$or':_[_0x280d('0x28')](_0x41faf6[_0x280d('0x33')],function(_0x66a0de){var _0x68a69c={};_0x68a69c[_0x66a0de]={'$like':'%'+_0x36bd98[_0x280d('0x2f')][_0x280d('0x3a')]+'%'};return _0x68a69c;})});}_0x41faf6=_[_0x280d('0x3c')]({},_0x41faf6,_0x36bd98[_0x280d('0x3e')]);return _0x45583c['getSubjects'](_0x41faf6);}})[_0x280d('0x22')](function(_0x30f642){if(_0x30f642){_0x307c2c=_0x30f642[_0x280d('0x41')];if(!_0x36bd98[_0x280d('0x2f')][_0x280d('0x34')]('nolimit')){_0x41faf6[_0x280d('0x1d')]=qs[_0x280d('0x1d')](_0x36bd98[_0x280d('0x2f')][_0x280d('0x1d')]);_0x41faf6[_0x280d('0x1b')]=qs[_0x280d('0x1b')](_0x36bd98[_0x280d('0x2f')][_0x280d('0x1b')]);}return _0x45583c[_0x280d('0x4b')](_0x41faf6);}})[_0x280d('0x22')](function(_0x4a5732){if(_0x4a5732){return _0x4a5732?{'count':_0x307c2c,'rows':_0x4a5732}:null;}})['then'](respondWithResult(_0x4760da,null))['catch'](handleError(_0x4760da,null));};exports['getDescriptions']=function(_0x4c6a63,_0x253397,_0x3f81a6){var _0x11cf14={};var _0x697ae5={};var _0x2e6c48;var _0x3db8ab;return db[_0x280d('0x29')][_0x280d('0x49')]({'where':{'id':_0x4c6a63[_0x280d('0x40')]['id']}})[_0x280d('0x22')](handleEntityNotFound(_0x253397,null))['then'](function(_0x17e188){if(_0x17e188){_0x2e6c48=_0x17e188;_0x697ae5[_0x280d('0x2e')]=_[_0x280d('0x30')](db[_0x280d('0x4a')]['rawAttributes']);_0x697ae5[_0x280d('0x2f')]=_[_0x280d('0x30')](_0x4c6a63[_0x280d('0x2f')]);_0x697ae5['filters']=_[_0x280d('0x31')](_0x697ae5[_0x280d('0x2e')],_0x697ae5[_0x280d('0x2f')]);_0x11cf14[_0x280d('0x33')]=_[_0x280d('0x31')](_0x697ae5[_0x280d('0x2e')],qs[_0x280d('0x32')](_0x4c6a63[_0x280d('0x2f')][_0x280d('0x32')]));_0x11cf14[_0x280d('0x33')]=_0x11cf14[_0x280d('0x33')][_0x280d('0x41')]?_0x11cf14['attributes']:_0x697ae5[_0x280d('0x2e')];_0x11cf14[_0x280d('0x36')]=qs['sort'](_0x4c6a63['query'][_0x280d('0x37')]);_0x11cf14[_0x280d('0x3b')]=qs[_0x280d('0x38')](_['pick'](_0x4c6a63[_0x280d('0x2f')],_0x697ae5['filters']));if(_0x4c6a63['query'][_0x280d('0x3a')]){_0x11cf14[_0x280d('0x3b')]=_[_0x280d('0x3c')](_0x11cf14['where'],{'$or':_['map'](_0x11cf14[_0x280d('0x33')],function(_0x3c37a2){var _0x4c265f={};_0x4c265f[_0x3c37a2]={'$like':'%'+_0x4c6a63[_0x280d('0x2f')][_0x280d('0x3a')]+'%'};return _0x4c265f;})});}_0x11cf14=_['merge']({},_0x11cf14,_0x4c6a63[_0x280d('0x3e')]);return _0x2e6c48[_0x280d('0x4c')](_0x11cf14);}})[_0x280d('0x22')](function(_0x1635ee){if(_0x1635ee){_0x3db8ab=_0x1635ee['length'];if(!_0x4c6a63['query'][_0x280d('0x34')](_0x280d('0x35'))){_0x11cf14[_0x280d('0x1d')]=qs['limit'](_0x4c6a63[_0x280d('0x2f')][_0x280d('0x1d')]);_0x11cf14[_0x280d('0x1b')]=qs['offset'](_0x4c6a63[_0x280d('0x2f')][_0x280d('0x1b')]);}return _0x2e6c48['getDescriptions'](_0x11cf14);}})[_0x280d('0x22')](function(_0x302c70){if(_0x302c70){return _0x302c70?{'count':_0x3db8ab,'rows':_0x302c70}:null;}})[_0x280d('0x22')](respondWithResult(_0x253397,null))[_0x280d('0x44')](handleError(_0x253397,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 05b9692..738d20c 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 _0x6017=['../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x5a087c,_0x2e8775){var _0x395219=function(_0x4290aa){while(--_0x4290aa){_0x5a087c['push'](_0x5a087c['shift']());}};_0x395219(++_0x2e8775);}(_0x6017,0xae));var _0x7601=function(_0x1a032a,_0x520991){_0x1a032a=_0x1a032a-0x0;var _0x2fe6fe=_0x6017[_0x1a032a];return _0x2fe6fe;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var logger=require(_0x7601('0x2'))('api');var moment=require(_0x7601('0x3'));var BPromise=require(_0x7601('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7601('0x5'));var rimraf=require('rimraf');var config=require(_0x7601('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x425bf9,_0xc62b2c){return _0x425bf9[_0x7601('0x7')](_0x7601('0x8'),attributes,{'tableName':_0x7601('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba37=['ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x1297bd,_0x5eb08f){var _0x3df57f=function(_0x69c8bc){while(--_0x69c8bc){_0x1297bd['push'](_0x1297bd['shift']());}};_0x3df57f(++_0x5eb08f);}(_0xba37,0xb6));var _0x7ba3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xba37[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x7ba3('0x0'));var util=require('util');var logger=require(_0x7ba3('0x1'))('api');var moment=require(_0x7ba3('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ba3('0x3'));var fs=require('fs');var path=require(_0x7ba3('0x4'));var rimraf=require(_0x7ba3('0x5'));var config=require(_0x7ba3('0x6'));var attributes=require(_0x7ba3('0x7'));module['exports']=function(_0x401c33,_0x47b38c){return _0x401c33['define'](_0x7ba3('0x8'),attributes,{'tableName':_0x7ba3('0x9'),'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 aab2662..c6b5a8e 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 _0xd399=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5744d4,_0x594d62){var _0x3d6119=function(_0x373b4f){while(--_0x373b4f){_0x5744d4['push'](_0x5744d4['shift']());}};_0x3d6119(++_0x594d62);}(_0xd399,0x181));var _0x9d39=function(_0x18ad81,_0x514a84){_0x18ad81=_0x18ad81-0x0;var _0x5f029e=_0xd399[_0x18ad81];return _0x5f029e;};'use strict';var _=require(_0x9d39('0x0'));var util=require(_0x9d39('0x1'));var moment=require(_0x9d39('0x2'));var BPromise=require(_0x9d39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d39('0x4'));var db=require(_0x9d39('0x5'))['db'];var utils=require(_0x9d39('0x6'));var logger=require(_0x9d39('0x7'))(_0x9d39('0x8'));var config=require('../../config/environment');var jayson=require(_0x9d39('0x9'));var client=jayson[_0x9d39('0xa')][_0x9d39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f1453,_0x2dba23,_0xe8dd2c){return new BPromise(function(_0x42b0ab,_0x2d2950){return client[_0x9d39('0xc')](_0x5f1453,_0xe8dd2c)[_0x9d39('0xd')](function(_0x101993){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x2dba23,_0x9d39('0xe'));logger[_0x9d39('0xf')](_0x9d39('0x10'),_0x2dba23,_0x9d39('0xe'),JSON[_0x9d39('0x11')](_0x101993));if(_0x101993[_0x9d39('0x12')]){if(_0x101993[_0x9d39('0x12')]['code']===0x1f4){logger['error'](_0x9d39('0x13'),_0x2dba23,_0x101993[_0x9d39('0x12')][_0x9d39('0x14')]);return _0x2d2950(_0x101993[_0x9d39('0x12')][_0x9d39('0x14')]);}logger[_0x9d39('0x12')](_0x9d39('0x13'),_0x2dba23,_0x101993[_0x9d39('0x12')]['message']);return _0x42b0ab(_0x101993[_0x9d39('0x12')][_0x9d39('0x14')]);}else{logger[_0x9d39('0x15')](_0x9d39('0x13'),_0x2dba23,_0x9d39('0xe'));_0x42b0ab(_0x101993['result'][_0x9d39('0x14')]);}})[_0x9d39('0x16')](function(_0x46e9ae){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2dba23,_0x46e9ae);_0x2d2950(_0x46e9ae);});});} \ No newline at end of file +var _0xceb6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x186cfb,_0xbb48dc){var _0x277df2=function(_0x348a70){while(--_0x348a70){_0x186cfb['push'](_0x186cfb['shift']());}};_0x277df2(++_0xbb48dc);}(_0xceb6,0x162));var _0x6ceb=function(_0x204266,_0x391561){_0x204266=_0x204266-0x0;var _0x25e6d0=_0xceb6[_0x204266];return _0x25e6d0;};'use strict';var _=require(_0x6ceb('0x0'));var util=require(_0x6ceb('0x1'));var moment=require(_0x6ceb('0x2'));var BPromise=require(_0x6ceb('0x3'));var rs=require(_0x6ceb('0x4'));var fs=require('fs');var Redis=require(_0x6ceb('0x5'));var db=require(_0x6ceb('0x6'))['db'];var utils=require(_0x6ceb('0x7'));var logger=require(_0x6ceb('0x8'))('rpc');var config=require(_0x6ceb('0x9'));var jayson=require(_0x6ceb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55a03b,_0x2b99fd,_0x3e6cc5){return new BPromise(function(_0xf913ea,_0x8cbddb){return client['request'](_0x55a03b,_0x3e6cc5)[_0x6ceb('0xb')](function(_0x3a1e9d){logger['info'](_0x6ceb('0xc'),_0x2b99fd,'request\x20sent');logger['debug'](_0x6ceb('0xd'),_0x2b99fd,_0x6ceb('0xe'),JSON[_0x6ceb('0xf')](_0x3a1e9d));if(_0x3a1e9d[_0x6ceb('0x10')]){if(_0x3a1e9d['error'][_0x6ceb('0x11')]===0x1f4){logger['error'](_0x6ceb('0xc'),_0x2b99fd,_0x3a1e9d[_0x6ceb('0x10')][_0x6ceb('0x12')]);return _0x8cbddb(_0x3a1e9d[_0x6ceb('0x10')]['message']);}logger[_0x6ceb('0x10')](_0x6ceb('0xc'),_0x2b99fd,_0x3a1e9d[_0x6ceb('0x10')][_0x6ceb('0x12')]);return _0xf913ea(_0x3a1e9d['error'][_0x6ceb('0x12')]);}else{logger['info'](_0x6ceb('0xc'),_0x2b99fd,_0x6ceb('0xe'));_0xf913ea(_0x3a1e9d[_0x6ceb('0x13')][_0x6ceb('0x12')]);}})['catch'](function(_0x531854){logger['error'](_0x6ceb('0xc'),_0x2b99fd,_0x531854);_0x8cbddb(_0x531854);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 569a6a8..d520a14 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 _0x938c=['isAuthenticated','show','post','create','put','update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x938c,0x1d2));var _0xc938=function(_0x36880a,_0x3cbbb2){_0x36880a=_0x36880a-0x0;var _0x23f706=_0x938c[_0x36880a];return _0x23f706;};'use strict';var multer=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var path=require('path');var timeout=require(_0xc938('0x2'));var express=require(_0xc938('0x3'));var router=express['Router']();var fs_extra=require(_0xc938('0x4'));var auth=require(_0xc938('0x5'));var interaction=require(_0xc938('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xc938('0x7')]('/',auth['isAuthenticated'](),controller[_0xc938('0x8')]);router[_0xc938('0x7')](_0xc938('0x9'),auth[_0xc938('0xa')](),controller[_0xc938('0xb')]);router[_0xc938('0xc')]('/',auth[_0xc938('0xa')](),controller[_0xc938('0xd')]);router[_0xc938('0xe')](_0xc938('0x9'),auth[_0xc938('0xa')](),controller[_0xc938('0xf')]);router['delete'](_0xc938('0x9'),auth[_0xc938('0xa')](),controller[_0xc938('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeee9=['post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id'];(function(_0x4c162d,_0x5edc23){var _0x5e1c84=function(_0x28f97e){while(--_0x28f97e){_0x4c162d['push'](_0x4c162d['shift']());}};_0x5e1c84(++_0x5edc23);}(_0xeee9,0x1bf));var _0x9eee=function(_0x162ea8,_0x19a56b){_0x162ea8=_0x162ea8-0x0;var _0x2a9778=_0xeee9[_0x162ea8];return _0x2a9778;};'use strict';var multer=require('multer');var util=require(_0x9eee('0x0'));var path=require(_0x9eee('0x1'));var timeout=require(_0x9eee('0x2'));var express=require(_0x9eee('0x3'));var router=express[_0x9eee('0x4')]();var fs_extra=require(_0x9eee('0x5'));var auth=require(_0x9eee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9eee('0x7'));var controller=require(_0x9eee('0x8'));router[_0x9eee('0x9')]('/',auth[_0x9eee('0xa')](),controller['index']);router['get'](_0x9eee('0xb'),auth[_0x9eee('0xa')](),controller['show']);router[_0x9eee('0xc')]('/',auth[_0x9eee('0xa')](),controller['create']);router[_0x9eee('0xd')]('/:id',auth[_0x9eee('0xa')](),controller[_0x9eee('0xe')]);router['delete'](_0x9eee('0xb'),auth[_0x9eee('0xa')](),controller[_0x9eee('0xf')]);module[_0x9eee('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7f94b9d..a17203f 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 _0xa702=['keyValue','STRING','BOOLEAN','ENUM','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa702,0x1e6));var _0x2a70=function(_0x1877b0,_0x216f91){_0x1877b0=_0x1877b0-0x0;var _0x4d0c33=_0xa702[_0x1877b0];return _0x4d0c33;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2a70('0x0')](_0x2a70('0x1'),_0x2a70('0x2'),_0x2a70('0x3'),_0x2a70('0x4'),'picklist'),'defaultValue':_0x2a70('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2a70('0x5')]},'keyType':{'type':Sequelize[_0x2a70('0x0')](_0x2a70('0x1'),_0x2a70('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x2a70('0x5')]},'idField':{'type':Sequelize[_0x2a70('0x5')]},'nameField':{'type':Sequelize[_0x2a70('0x5')]},'customField':{'type':Sequelize[_0x2a70('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a70('0x5')]}}; \ No newline at end of file +var _0xb08d=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x18f029,_0x46725d){var _0x2307dc=function(_0x665dd0){while(--_0x665dd0){_0x18f029['push'](_0x18f029['shift']());}};_0x2307dc(++_0x46725d);}(_0xb08d,0xbf));var _0xdb08=function(_0x4b1e52,_0x5de551){_0x4b1e52=_0x4b1e52-0x0;var _0x277bdc=_0xb08d[_0x4b1e52];return _0x277bdc;};'use strict';var Sequelize=require(_0xdb08('0x0'));module[_0xdb08('0x1')]={'type':{'type':Sequelize[_0xdb08('0x2')](_0xdb08('0x3'),_0xdb08('0x4'),_0xdb08('0x5'),_0xdb08('0x6'),_0xdb08('0x7')),'defaultValue':_0xdb08('0x3')},'content':{'type':Sequelize[_0xdb08('0x8')]},'key':{'type':Sequelize[_0xdb08('0x8')]},'keyType':{'type':Sequelize[_0xdb08('0x2')]('string','variable',_0xdb08('0x5'))},'keyContent':{'type':Sequelize[_0xdb08('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdb08('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb08('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9a6e62b..302b1e5 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 _0x5f85=['body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x5f85,0xf2));var _0x55f8=function(_0x10ad68,_0x37db5c){_0x10ad68=_0x10ad68-0x0;var _0x546b0f=_0x5f85[_0x10ad68];return _0x546b0f;};'use strict';var emlformat=require(_0x55f8('0x0'));var rimraf=require(_0x55f8('0x1'));var zipdir=require(_0x55f8('0x2'));var jsonpatch=require(_0x55f8('0x3'));var rp=require(_0x55f8('0x4'));var moment=require(_0x55f8('0x5'));var BPromise=require(_0x55f8('0x6'));var Mustache=require(_0x55f8('0x7'));var util=require(_0x55f8('0x8'));var path=require(_0x55f8('0x9'));var sox=require(_0x55f8('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x55f8('0xb'));var _=require(_0x55f8('0xc'));var squel=require(_0x55f8('0xd'));var crypto=require('crypto');var jsforce=require(_0x55f8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x55f8('0xf'));var querystring=require('querystring');var Papa=require(_0x55f8('0x10'));var Redis=require(_0x55f8('0x11'));var authService=require(_0x55f8('0x12'));var qs=require(_0x55f8('0x13'));var as=require(_0x55f8('0x14'));var hardwareService=require(_0x55f8('0x15'));var logger=require(_0x55f8('0x16'))('api');var utils=require(_0x55f8('0x17'));var config=require(_0x55f8('0x18'));var licenseUtil=require(_0x55f8('0x19'));var db=require(_0x55f8('0x1a'))['db'];function respondWithStatusCode(_0x3e6fbc,_0x18b670){_0x18b670=_0x18b670||0xcc;return function(_0x543a43){if(_0x543a43){return _0x3e6fbc[_0x55f8('0x1b')](_0x18b670);}return _0x3e6fbc['status'](_0x18b670)[_0x55f8('0x1c')]();};}function respondWithResult(_0x46774c,_0x9147db){_0x9147db=_0x9147db||0xc8;return function(_0x19bf27){if(_0x19bf27){return _0x46774c[_0x55f8('0x1d')](_0x9147db)[_0x55f8('0x1e')](_0x19bf27);}};}function respondWithFilteredResult(_0x17ab31,_0x36c100){return function(_0x392cfa){if(_0x392cfa){var _0x2a43ba=typeof _0x36c100['offset']==='undefined'&&typeof _0x36c100[_0x55f8('0x1f')]===_0x55f8('0x20');var _0x14de1a=_0x392cfa['count'];var _0x2eef65=_0x2a43ba?0x0:_0x36c100[_0x55f8('0x21')];var _0x1f4f9c=_0x2a43ba?_0x392cfa[_0x55f8('0x22')]:_0x36c100[_0x55f8('0x21')]+_0x36c100[_0x55f8('0x1f')];var _0x3870ef;if(_0x1f4f9c>=_0x14de1a){_0x1f4f9c=_0x14de1a;_0x3870ef=0xc8;}else{_0x3870ef=0xce;}_0x17ab31['status'](_0x3870ef);return _0x17ab31[_0x55f8('0x23')](_0x55f8('0x24'),_0x2eef65+'-'+_0x1f4f9c+'/'+_0x14de1a)[_0x55f8('0x1e')](_0x392cfa);}return null;};}function patchUpdates(_0xea1d74){return function(_0x484531){try{jsonpatch[_0x55f8('0x25')](_0x484531,_0xea1d74,!![]);}catch(_0x2a55ac){return BPromise[_0x55f8('0x26')](_0x2a55ac);}return _0x484531[_0x55f8('0x27')]();};}function saveUpdates(_0x48899d,_0x3f3027){return function(_0x15eaa9){if(_0x15eaa9){return _0x15eaa9[_0x55f8('0x28')](_0x48899d)[_0x55f8('0x29')](function(_0x2e8059){return _0x2e8059;});}return null;};}function removeEntity(_0x27b906,_0x344ea2){return function(_0x52593b){if(_0x52593b){return _0x52593b[_0x55f8('0x2a')]()['then'](function(){_0x27b906[_0x55f8('0x1d')](0xcc)[_0x55f8('0x1c')]();});}};}function handleEntityNotFound(_0x45e32f,_0x50873d){return function(_0x5eaa8a){if(!_0x5eaa8a){_0x45e32f['sendStatus'](0x194);}return _0x5eaa8a;};}function handleError(_0x35e52a,_0x553a6c){_0x553a6c=_0x553a6c||0x1f4;return function(_0x871450){logger[_0x55f8('0x2b')](_0x871450[_0x55f8('0x2c')]);if(_0x871450[_0x55f8('0x2d')]){delete _0x871450[_0x55f8('0x2d')];}_0x35e52a[_0x55f8('0x1d')](_0x553a6c)['send'](_0x871450);};}exports[_0x55f8('0x2e')]=function(_0x1933f0,_0x44fb7a){var _0x251e2a={},_0xfaf723={},_0x13ae71={'count':0x0,'rows':[]};var _0x43f12a=_[_0x55f8('0x2f')](db[_0x55f8('0x30')][_0x55f8('0x31')],function(_0x58ffb7){return{'name':_0x58ffb7[_0x55f8('0x32')],'type':_0x58ffb7['type'][_0x55f8('0x33')]};});_0xfaf723[_0x55f8('0x34')]=_['map'](_0x43f12a,_0x55f8('0x2d'));_0xfaf723[_0x55f8('0x35')]=_[_0x55f8('0x36')](_0x1933f0[_0x55f8('0x35')]);_0xfaf723[_0x55f8('0x37')]=_['intersection'](_0xfaf723[_0x55f8('0x34')],_0xfaf723[_0x55f8('0x35')]);_0x251e2a[_0x55f8('0x38')]=_[_0x55f8('0x39')](_0xfaf723[_0x55f8('0x34')],qs[_0x55f8('0x3a')](_0x1933f0[_0x55f8('0x35')][_0x55f8('0x3a')]));_0x251e2a[_0x55f8('0x38')]=_0x251e2a[_0x55f8('0x38')][_0x55f8('0x3b')]?_0x251e2a[_0x55f8('0x38')]:_0xfaf723['model'];if(!_0x1933f0[_0x55f8('0x35')][_0x55f8('0x3c')](_0x55f8('0x3d'))){_0x251e2a[_0x55f8('0x1f')]=qs[_0x55f8('0x1f')](_0x1933f0[_0x55f8('0x35')]['limit']);_0x251e2a[_0x55f8('0x21')]=qs[_0x55f8('0x21')](_0x1933f0[_0x55f8('0x35')][_0x55f8('0x21')]);}_0x251e2a[_0x55f8('0x3e')]=qs['sort'](_0x1933f0[_0x55f8('0x35')][_0x55f8('0x3f')]);_0x251e2a[_0x55f8('0x40')]=qs[_0x55f8('0x37')](_[_0x55f8('0x41')](_0x1933f0[_0x55f8('0x35')],_0xfaf723[_0x55f8('0x37')]),_0x43f12a);if(_0x1933f0[_0x55f8('0x35')][_0x55f8('0x42')]){_0x251e2a['where']=_[_0x55f8('0x43')](_0x251e2a['where'],{'$or':_[_0x55f8('0x2f')](_0x43f12a,function(_0x276ed3){if(_0x276ed3[_0x55f8('0x44')]!==_0x55f8('0x45')){var _0x29e3d2={};_0x29e3d2[_0x276ed3[_0x55f8('0x2d')]]={'$like':'%'+_0x1933f0[_0x55f8('0x35')]['filter']+'%'};return _0x29e3d2;}})});}_0x251e2a=_[_0x55f8('0x43')]({},_0x251e2a,_0x1933f0[_0x55f8('0x46')]);var _0x5df9ca={'where':_0x251e2a[_0x55f8('0x40')]};return db[_0x55f8('0x30')][_0x55f8('0x22')](_0x5df9ca)[_0x55f8('0x29')](function(_0x32680a){_0x13ae71[_0x55f8('0x22')]=_0x32680a;if(_0x1933f0[_0x55f8('0x35')][_0x55f8('0x47')]){_0x251e2a[_0x55f8('0x48')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x251e2a);})[_0x55f8('0x29')](function(_0x1a7e23){_0x13ae71[_0x55f8('0x49')]=_0x1a7e23;return _0x13ae71;})[_0x55f8('0x29')](respondWithFilteredResult(_0x44fb7a,_0x251e2a))['catch'](handleError(_0x44fb7a,null));};exports[_0x55f8('0x4a')]=function(_0x68a77b,_0x31d968){var _0x11e94e={'raw':!![],'where':{'id':_0x68a77b[_0x55f8('0x4b')]['id']}},_0x5becf4={};_0x5becf4[_0x55f8('0x34')]=_[_0x55f8('0x36')](db[_0x55f8('0x30')][_0x55f8('0x31')]);_0x5becf4[_0x55f8('0x35')]=_[_0x55f8('0x36')](_0x68a77b['query']);_0x5becf4[_0x55f8('0x37')]=_[_0x55f8('0x39')](_0x5becf4[_0x55f8('0x34')],_0x5becf4[_0x55f8('0x35')]);_0x11e94e[_0x55f8('0x38')]=_[_0x55f8('0x39')](_0x5becf4[_0x55f8('0x34')],qs[_0x55f8('0x3a')](_0x68a77b[_0x55f8('0x35')][_0x55f8('0x3a')]));_0x11e94e['attributes']=_0x11e94e['attributes'][_0x55f8('0x3b')]?_0x11e94e['attributes']:_0x5becf4[_0x55f8('0x34')];if(_0x68a77b[_0x55f8('0x35')][_0x55f8('0x47')]){_0x11e94e[_0x55f8('0x48')]=[{'all':!![]}];}_0x11e94e=_['merge']({},_0x11e94e,_0x68a77b[_0x55f8('0x46')]);return db['ServicenowField'][_0x55f8('0x4c')](_0x11e94e)[_0x55f8('0x29')](handleEntityNotFound(_0x31d968,null))[_0x55f8('0x29')](respondWithResult(_0x31d968,null))['catch'](handleError(_0x31d968,null));};exports[_0x55f8('0x4d')]=function(_0x453c6d,_0x55b3d9){return db[_0x55f8('0x30')]['create'](_0x453c6d[_0x55f8('0x4e')],{})[_0x55f8('0x29')](respondWithResult(_0x55b3d9,0xc9))[_0x55f8('0x4f')](handleError(_0x55b3d9,null));};exports[_0x55f8('0x28')]=function(_0x40c29b,_0x354678){if(_0x40c29b[_0x55f8('0x4e')]['id']){delete _0x40c29b[_0x55f8('0x4e')]['id'];}return db[_0x55f8('0x30')]['find']({'where':{'id':_0x40c29b['params']['id']}})[_0x55f8('0x29')](handleEntityNotFound(_0x354678,null))[_0x55f8('0x29')](saveUpdates(_0x40c29b[_0x55f8('0x4e')],null))[_0x55f8('0x29')](respondWithResult(_0x354678,null))[_0x55f8('0x4f')](handleError(_0x354678,null));};exports[_0x55f8('0x2a')]=function(_0x2de7b4,_0x5e1339){return db[_0x55f8('0x30')][_0x55f8('0x4c')]({'where':{'id':_0x2de7b4[_0x55f8('0x4b')]['id']}})[_0x55f8('0x29')](handleEntityNotFound(_0x5e1339,null))[_0x55f8('0x29')](removeEntity(_0x5e1339,null))[_0x55f8('0x4f')](handleError(_0x5e1339,null));}; \ No newline at end of file +var _0xe0ab=['stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','count','includeAll','include','findAll','catch','show','merge','options','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus'];(function(_0x1655ae,_0x5efd30){var _0x471df7=function(_0x398344){while(--_0x398344){_0x1655ae['push'](_0x1655ae['shift']());}};_0x471df7(++_0x5efd30);}(_0xe0ab,0x156));var _0xbe0a=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe0ab[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe0a('0x0'));var zipdir=require(_0xbe0a('0x1'));var jsonpatch=require(_0xbe0a('0x2'));var rp=require(_0xbe0a('0x3'));var moment=require(_0xbe0a('0x4'));var BPromise=require(_0xbe0a('0x5'));var Mustache=require(_0xbe0a('0x6'));var util=require(_0xbe0a('0x7'));var path=require(_0xbe0a('0x8'));var sox=require(_0xbe0a('0x9'));var csv=require(_0xbe0a('0xa'));var ejs=require(_0xbe0a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe0a('0xc'));var squel=require(_0xbe0a('0xd'));var crypto=require('crypto');var jsforce=require(_0xbe0a('0xe'));var deskjs=require(_0xbe0a('0xf'));var toCsv=require(_0xbe0a('0xa'));var querystring=require('querystring');var Papa=require(_0xbe0a('0x10'));var Redis=require('ioredis');var authService=require(_0xbe0a('0x11'));var qs=require(_0xbe0a('0x12'));var as=require(_0xbe0a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe0a('0x14'))(_0xbe0a('0x15'));var utils=require(_0xbe0a('0x16'));var config=require(_0xbe0a('0x17'));var licenseUtil=require(_0xbe0a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235caa,_0x526b14){_0x526b14=_0x526b14||0xcc;return function(_0x54f4aa){if(_0x54f4aa){return _0x235caa['sendStatus'](_0x526b14);}return _0x235caa[_0xbe0a('0x19')](_0x526b14)[_0xbe0a('0x1a')]();};}function respondWithResult(_0x3c53f2,_0x49e47a){_0x49e47a=_0x49e47a||0xc8;return function(_0xc7a199){if(_0xc7a199){return _0x3c53f2['status'](_0x49e47a)[_0xbe0a('0x1b')](_0xc7a199);}};}function respondWithFilteredResult(_0x41505a,_0x56c6a2){return function(_0x524307){if(_0x524307){var _0x45f4b8=typeof _0x56c6a2['offset']===_0xbe0a('0x1c')&&typeof _0x56c6a2['limit']===_0xbe0a('0x1c');var _0x1480f7=_0x524307['count'];var _0x4720dc=_0x45f4b8?0x0:_0x56c6a2[_0xbe0a('0x1d')];var _0x963fb2=_0x45f4b8?_0x524307['count']:_0x56c6a2['offset']+_0x56c6a2[_0xbe0a('0x1e')];var _0x3cb3e6;if(_0x963fb2>=_0x1480f7){_0x963fb2=_0x1480f7;_0x3cb3e6=0xc8;}else{_0x3cb3e6=0xce;}_0x41505a[_0xbe0a('0x19')](_0x3cb3e6);return _0x41505a[_0xbe0a('0x1f')](_0xbe0a('0x20'),_0x4720dc+'-'+_0x963fb2+'/'+_0x1480f7)[_0xbe0a('0x1b')](_0x524307);}return null;};}function patchUpdates(_0x20ccab){return function(_0x39b779){try{jsonpatch[_0xbe0a('0x21')](_0x39b779,_0x20ccab,!![]);}catch(_0x106c28){return BPromise[_0xbe0a('0x22')](_0x106c28);}return _0x39b779[_0xbe0a('0x23')]();};}function saveUpdates(_0x450e9e,_0xbb15f){return function(_0x498844){if(_0x498844){return _0x498844['update'](_0x450e9e)[_0xbe0a('0x24')](function(_0x1ad1d5){return _0x1ad1d5;});}return null;};}function removeEntity(_0xe5d67d,_0x5493f3){return function(_0x1d27e3){if(_0x1d27e3){return _0x1d27e3['destroy']()[_0xbe0a('0x24')](function(){_0xe5d67d[_0xbe0a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b95d5,_0x1c12a8){return function(_0x3e87ea){if(!_0x3e87ea){_0x5b95d5[_0xbe0a('0x25')](0x194);}return _0x3e87ea;};}function handleError(_0x8cfb0f,_0x33dabc){_0x33dabc=_0x33dabc||0x1f4;return function(_0xcf69a4){logger['error'](_0xcf69a4[_0xbe0a('0x26')]);if(_0xcf69a4['name']){delete _0xcf69a4[_0xbe0a('0x27')];}_0x8cfb0f[_0xbe0a('0x19')](_0x33dabc)[_0xbe0a('0x28')](_0xcf69a4);};}exports[_0xbe0a('0x29')]=function(_0x4c7162,_0x3c1004){var _0x1de0f2={},_0x52fc13={},_0x3a1c0f={'count':0x0,'rows':[]};var _0x2dbf45=_[_0xbe0a('0x2a')](db[_0xbe0a('0x2b')][_0xbe0a('0x2c')],function(_0x12836e){return{'name':_0x12836e[_0xbe0a('0x2d')],'type':_0x12836e[_0xbe0a('0x2e')][_0xbe0a('0x2f')]};});_0x52fc13[_0xbe0a('0x30')]=_[_0xbe0a('0x2a')](_0x2dbf45,'name');_0x52fc13['query']=_[_0xbe0a('0x31')](_0x4c7162[_0xbe0a('0x32')]);_0x52fc13['filters']=_[_0xbe0a('0x33')](_0x52fc13['model'],_0x52fc13[_0xbe0a('0x32')]);_0x1de0f2[_0xbe0a('0x34')]=_[_0xbe0a('0x33')](_0x52fc13[_0xbe0a('0x30')],qs[_0xbe0a('0x35')](_0x4c7162[_0xbe0a('0x32')][_0xbe0a('0x35')]));_0x1de0f2['attributes']=_0x1de0f2['attributes'][_0xbe0a('0x36')]?_0x1de0f2['attributes']:_0x52fc13[_0xbe0a('0x30')];if(!_0x4c7162['query'][_0xbe0a('0x37')](_0xbe0a('0x38'))){_0x1de0f2[_0xbe0a('0x1e')]=qs[_0xbe0a('0x1e')](_0x4c7162['query']['limit']);_0x1de0f2[_0xbe0a('0x1d')]=qs[_0xbe0a('0x1d')](_0x4c7162['query'][_0xbe0a('0x1d')]);}_0x1de0f2[_0xbe0a('0x39')]=qs[_0xbe0a('0x3a')](_0x4c7162['query'][_0xbe0a('0x3a')]);_0x1de0f2[_0xbe0a('0x3b')]=qs['filters'](_[_0xbe0a('0x3c')](_0x4c7162[_0xbe0a('0x32')],_0x52fc13[_0xbe0a('0x3d')]),_0x2dbf45);if(_0x4c7162['query']['filter']){_0x1de0f2[_0xbe0a('0x3b')]=_['merge'](_0x1de0f2[_0xbe0a('0x3b')],{'$or':_['map'](_0x2dbf45,function(_0x3bbcdf){if(_0x3bbcdf['type']!==_0xbe0a('0x3e')){var _0xd6d223={};_0xd6d223[_0x3bbcdf[_0xbe0a('0x27')]]={'$like':'%'+_0x4c7162['query']['filter']+'%'};return _0xd6d223;}})});}_0x1de0f2=_['merge']({},_0x1de0f2,_0x4c7162['options']);var _0x3a0df2={'where':_0x1de0f2[_0xbe0a('0x3b')]};return db[_0xbe0a('0x2b')][_0xbe0a('0x3f')](_0x3a0df2)['then'](function(_0x3e139e){_0x3a1c0f[_0xbe0a('0x3f')]=_0x3e139e;if(_0x4c7162[_0xbe0a('0x32')][_0xbe0a('0x40')]){_0x1de0f2[_0xbe0a('0x41')]=[{'all':!![]}];}return db[_0xbe0a('0x2b')][_0xbe0a('0x42')](_0x1de0f2);})[_0xbe0a('0x24')](function(_0x22cd3b){_0x3a1c0f['rows']=_0x22cd3b;return _0x3a1c0f;})[_0xbe0a('0x24')](respondWithFilteredResult(_0x3c1004,_0x1de0f2))[_0xbe0a('0x43')](handleError(_0x3c1004,null));};exports[_0xbe0a('0x44')]=function(_0x3c84d2,_0x5b9fae){var _0x258a58={'raw':!![],'where':{'id':_0x3c84d2['params']['id']}},_0x465204={};_0x465204[_0xbe0a('0x30')]=_[_0xbe0a('0x31')](db[_0xbe0a('0x2b')][_0xbe0a('0x2c')]);_0x465204[_0xbe0a('0x32')]=_['keys'](_0x3c84d2[_0xbe0a('0x32')]);_0x465204[_0xbe0a('0x3d')]=_[_0xbe0a('0x33')](_0x465204[_0xbe0a('0x30')],_0x465204['query']);_0x258a58['attributes']=_[_0xbe0a('0x33')](_0x465204[_0xbe0a('0x30')],qs[_0xbe0a('0x35')](_0x3c84d2['query'][_0xbe0a('0x35')]));_0x258a58[_0xbe0a('0x34')]=_0x258a58['attributes']['length']?_0x258a58[_0xbe0a('0x34')]:_0x465204[_0xbe0a('0x30')];if(_0x3c84d2[_0xbe0a('0x32')]['includeAll']){_0x258a58['include']=[{'all':!![]}];}_0x258a58=_[_0xbe0a('0x45')]({},_0x258a58,_0x3c84d2[_0xbe0a('0x46')]);return db[_0xbe0a('0x2b')][_0xbe0a('0x47')](_0x258a58)[_0xbe0a('0x24')](handleEntityNotFound(_0x5b9fae,null))['then'](respondWithResult(_0x5b9fae,null))[_0xbe0a('0x43')](handleError(_0x5b9fae,null));};exports['create']=function(_0x22fa6d,_0x57909e){return db[_0xbe0a('0x2b')][_0xbe0a('0x48')](_0x22fa6d[_0xbe0a('0x49')],{})[_0xbe0a('0x24')](respondWithResult(_0x57909e,0xc9))[_0xbe0a('0x43')](handleError(_0x57909e,null));};exports['update']=function(_0xe4d5b0,_0x1553e0){if(_0xe4d5b0[_0xbe0a('0x49')]['id']){delete _0xe4d5b0[_0xbe0a('0x49')]['id'];}return db['ServicenowField'][_0xbe0a('0x47')]({'where':{'id':_0xe4d5b0[_0xbe0a('0x4a')]['id']}})[_0xbe0a('0x24')](handleEntityNotFound(_0x1553e0,null))[_0xbe0a('0x24')](saveUpdates(_0xe4d5b0[_0xbe0a('0x49')],null))[_0xbe0a('0x24')](respondWithResult(_0x1553e0,null))[_0xbe0a('0x43')](handleError(_0x1553e0,null));};exports[_0xbe0a('0x4b')]=function(_0x1638a4,_0x136934){return db[_0xbe0a('0x2b')]['find']({'where':{'id':_0x1638a4[_0xbe0a('0x4a')]['id']}})[_0xbe0a('0x24')](handleEntityNotFound(_0x136934,null))['then'](removeEntity(_0x136934,null))[_0xbe0a('0x43')](handleError(_0x136934,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f6bb9c7..b7f54d2 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 _0xf393=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x26e312,_0x4c0fed){var _0x3d73ce=function(_0x41e646){while(--_0x41e646){_0x26e312['push'](_0x26e312['shift']());}};_0x3d73ce(++_0x4c0fed);}(_0xf393,0xec));var _0x3f39=function(_0x1d686f,_0x17c485){_0x1d686f=_0x1d686f-0x0;var _0x5a1372=_0xf393[_0x1d686f];return _0x5a1372;};'use strict';var _=require(_0x3f39('0x0'));var util=require(_0x3f39('0x1'));var logger=require(_0x3f39('0x2'))('api');var moment=require(_0x3f39('0x3'));var BPromise=require(_0x3f39('0x4'));var rp=require(_0x3f39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f39('0x6'));var config=require(_0x3f39('0x7'));var attributes=require(_0x3f39('0x8'));module[_0x3f39('0x9')]=function(_0x316c6d,_0x593563){return _0x316c6d['define']('ServicenowField',attributes,{'tableName':_0x3f39('0xa'),'paranoid':![],'indexes':[{'name':_0x3f39('0xb'),'fields':[_0x3f39('0xc'),_0x3f39('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x282a=['rimraf','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5607c2,_0x5443ee){var _0x445d85=function(_0x19c0dc){while(--_0x19c0dc){_0x5607c2['push'](_0x5607c2['shift']());}};_0x445d85(++_0x5443ee);}(_0x282a,0xa2));var _0xa282=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x282a[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0xa282('0x0'));var logger=require(_0xa282('0x1'))(_0xa282('0x2'));var moment=require(_0xa282('0x3'));var BPromise=require(_0xa282('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa282('0x5'));var rimraf=require(_0xa282('0x6'));var config=require('../../config/environment');var attributes=require(_0xa282('0x7'));module['exports']=function(_0x2076ee,_0x54caed){return _0x2076ee[_0xa282('0x8')](_0xa282('0x9'),attributes,{'tableName':_0xa282('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xa282('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 6870661..df93f85 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xda3f,0xec));var _0xfda3=function(_0x3a242c,_0x1f0fc9){_0x3a242c=_0x3a242c-0x0;var _0x6e0fb9=_0xda3f[_0x3a242c];return _0x6e0fb9;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +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(_0x36606f,_0x233515){var _0x8d406e=function(_0x5723c7){while(--_0x5723c7){_0x36606f['push'](_0x36606f['shift']());}};_0x8d406e(++_0x233515);}(_0x70e0,0x17b));var _0x070e=function(_0x3559c4,_0x414c2){_0x3559c4=_0x3559c4-0x0;var _0x42f06e=_0x70e0[_0x3559c4];return _0x42f06e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 79a36fc..f3dd7b1 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(_0x5ba433,_0x14d2b1){var _0xa3048b=function(_0x234102){while(--_0x234102){_0x5ba433['push'](_0x5ba433['shift']());}};_0xa3048b(++_0x14d2b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4aba0b,_0x3eba9b){var _0x5e38a9=function(_0x3874c8){while(--_0x3874c8){_0x4aba0b['push'](_0x4aba0b['shift']());}};_0x5e38a9(++_0x3eba9b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1a2f826..d839408 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(_0x49cc91,_0x2bab78){var _0xa4170e=function(_0x48832f){while(--_0x48832f){_0x49cc91['push'](_0x49cc91['shift']());}};_0xa4170e(++_0x2bab78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x17f166,_0x1c3213){var _0x2a2fc5=function(_0x55c9df){while(--_0x55c9df){_0x17f166['push'](_0x17f166['shift']());}};_0x2a2fc5(++_0x1c3213);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 1821333..38ad871 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 _0x0830=['Content-Range','json','apply','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','find','create','catch','body','params','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','POST','format','%s%s','/service/v4_1/rest.php','get_module_fields','Calls','values','remove','includes','endsWith','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0830,0xd0));var _0x0083=function(_0x25948f,_0x4ac7e4){_0x25948f=_0x25948f-0x0;var _0x2b1976=_0x0830[_0x25948f];return _0x2b1976;};'use strict';var emlformat=require(_0x0083('0x0'));var rimraf=require(_0x0083('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0083('0x2'));var rp=require('request-promise');var moment=require(_0x0083('0x3'));var BPromise=require(_0x0083('0x4'));var Mustache=require(_0x0083('0x5'));var util=require('util');var path=require(_0x0083('0x6'));var sox=require('sox');var csv=require(_0x0083('0x7'));var ejs=require(_0x0083('0x8'));var fs=require('fs');var fs_extra=require(_0x0083('0x9'));var _=require(_0x0083('0xa'));var squel=require('squel');var crypto=require(_0x0083('0xb'));var jsforce=require(_0x0083('0xc'));var deskjs=require(_0x0083('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0083('0xe'));var Papa=require(_0x0083('0xf'));var Redis=require(_0x0083('0x10'));var authService=require(_0x0083('0x11'));var qs=require(_0x0083('0x12'));var as=require(_0x0083('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0083('0x14'))(_0x0083('0x15'));var utils=require(_0x0083('0x16'));var config=require(_0x0083('0x17'));var licenseUtil=require(_0x0083('0x18'));var db=require(_0x0083('0x19'))['db'];var integrations=require(_0x0083('0x1a'));function respondWithStatusCode(_0x574558,_0x5d56ed){_0x5d56ed=_0x5d56ed||0xcc;return function(_0x4665bf){if(_0x4665bf){return _0x574558[_0x0083('0x1b')](_0x5d56ed);}return _0x574558[_0x0083('0x1c')](_0x5d56ed)['end']();};}function respondWithResult(_0x4b8183,_0x2b7f05){_0x2b7f05=_0x2b7f05||0xc8;return function(_0x486c2b){if(_0x486c2b){return _0x4b8183[_0x0083('0x1c')](_0x2b7f05)['json'](_0x486c2b);}};}function respondWithFilteredResult(_0x3a55e2,_0x386978){return function(_0x4d62bc){if(_0x4d62bc){var _0x4854a4=typeof _0x386978['offset']===_0x0083('0x1d')&&typeof _0x386978[_0x0083('0x1e')]==='undefined';var _0x512cb4=_0x4d62bc['count'];var _0x865652=_0x4854a4?0x0:_0x386978[_0x0083('0x1f')];var _0x3acfe0=_0x4854a4?_0x4d62bc[_0x0083('0x20')]:_0x386978[_0x0083('0x1f')]+_0x386978['limit'];var _0x5446a9;if(_0x3acfe0>=_0x512cb4){_0x3acfe0=_0x512cb4;_0x5446a9=0xc8;}else{_0x5446a9=0xce;}_0x3a55e2[_0x0083('0x1c')](_0x5446a9);return _0x3a55e2[_0x0083('0x21')](_0x0083('0x22'),_0x865652+'-'+_0x3acfe0+'/'+_0x512cb4)[_0x0083('0x23')](_0x4d62bc);}return null;};}function patchUpdates(_0x58f2fe){return function(_0x24bc79){try{jsonpatch[_0x0083('0x24')](_0x24bc79,_0x58f2fe,!![]);}catch(_0x9d6824){return BPromise['reject'](_0x9d6824);}return _0x24bc79['save']();};}function saveUpdates(_0x2ed3b3,_0xe11d81){return function(_0x135eb7){if(_0x135eb7){return _0x135eb7[_0x0083('0x25')](_0x2ed3b3)[_0x0083('0x26')](function(_0x534394){return _0x534394;});}return null;};}function removeEntity(_0x86366b,_0x1511c8){return function(_0x4d2b65){if(_0x4d2b65){return _0x4d2b65[_0x0083('0x27')]()[_0x0083('0x26')](function(){_0x86366b[_0x0083('0x1c')](0xcc)[_0x0083('0x28')]();});}};}function handleEntityNotFound(_0x2f5036,_0x44dd21){return function(_0x53ff42){if(!_0x53ff42){_0x2f5036[_0x0083('0x1b')](0x194);}return _0x53ff42;};}function handleError(_0x2aa633,_0x5a41ca){_0x5a41ca=_0x5a41ca||0x1f4;return function(_0x41ad76){logger[_0x0083('0x29')](_0x41ad76[_0x0083('0x2a')]);if(_0x41ad76['name']){delete _0x41ad76[_0x0083('0x2b')];}_0x2aa633[_0x0083('0x1c')](_0x5a41ca)[_0x0083('0x2c')](_0x41ad76);};}exports[_0x0083('0x2d')]=function(_0x3810eb,_0x5b42ca){var _0x5b5bf5={},_0x2684b1={},_0x5a50b3={'count':0x0,'rows':[]};var _0x1e6e5c=_[_0x0083('0x2e')](db[_0x0083('0x2f')][_0x0083('0x30')],function(_0x51977a){return{'name':_0x51977a[_0x0083('0x31')],'type':_0x51977a[_0x0083('0x32')][_0x0083('0x33')]};});_0x2684b1['model']=_[_0x0083('0x2e')](_0x1e6e5c,_0x0083('0x2b'));_0x2684b1[_0x0083('0x34')]=_[_0x0083('0x35')](_0x3810eb[_0x0083('0x34')]);_0x2684b1[_0x0083('0x36')]=_[_0x0083('0x37')](_0x2684b1['model'],_0x2684b1[_0x0083('0x34')]);_0x5b5bf5[_0x0083('0x38')]=_[_0x0083('0x37')](_0x2684b1[_0x0083('0x39')],qs[_0x0083('0x3a')](_0x3810eb['query'][_0x0083('0x3a')]));_0x5b5bf5[_0x0083('0x38')]=_0x5b5bf5[_0x0083('0x38')][_0x0083('0x3b')]?_0x5b5bf5[_0x0083('0x38')]:_0x2684b1[_0x0083('0x39')];if(!_0x3810eb[_0x0083('0x34')][_0x0083('0x3c')](_0x0083('0x3d'))){_0x5b5bf5[_0x0083('0x1e')]=qs[_0x0083('0x1e')](_0x3810eb[_0x0083('0x34')][_0x0083('0x1e')]);_0x5b5bf5[_0x0083('0x1f')]=qs[_0x0083('0x1f')](_0x3810eb[_0x0083('0x34')][_0x0083('0x1f')]);}_0x5b5bf5[_0x0083('0x3e')]=qs[_0x0083('0x3f')](_0x3810eb[_0x0083('0x34')][_0x0083('0x3f')]);_0x5b5bf5['where']=qs[_0x0083('0x36')](_[_0x0083('0x40')](_0x3810eb[_0x0083('0x34')],_0x2684b1[_0x0083('0x36')]),_0x1e6e5c);if(_0x3810eb[_0x0083('0x34')][_0x0083('0x41')]){_0x5b5bf5[_0x0083('0x42')]=_[_0x0083('0x43')](_0x5b5bf5[_0x0083('0x42')],{'$or':_[_0x0083('0x2e')](_0x1e6e5c,function(_0x397ea2){if(_0x397ea2[_0x0083('0x32')]!==_0x0083('0x44')){var _0x57ef6d={};_0x57ef6d[_0x397ea2['name']]={'$like':'%'+_0x3810eb[_0x0083('0x34')][_0x0083('0x41')]+'%'};return _0x57ef6d;}})});}_0x5b5bf5=_['merge']({},_0x5b5bf5,_0x3810eb[_0x0083('0x45')]);var _0x902688={'where':_0x5b5bf5[_0x0083('0x42')]};return db[_0x0083('0x2f')]['count'](_0x902688)[_0x0083('0x26')](function(_0x13bc03){_0x5a50b3['count']=_0x13bc03;if(_0x3810eb['query']['includeAll']){_0x5b5bf5[_0x0083('0x46')]=[{'all':!![]}];}return db[_0x0083('0x2f')][_0x0083('0x47')](_0x5b5bf5);})[_0x0083('0x26')](function(_0x287669){_0x5a50b3[_0x0083('0x48')]=_0x287669;return _0x5a50b3;})['then'](respondWithFilteredResult(_0x5b42ca,_0x5b5bf5))['catch'](handleError(_0x5b42ca,null));};exports[_0x0083('0x49')]=function(_0x3fc234,_0x3dba26){var _0x5ab5f4={'raw':![],'where':{'id':_0x3fc234['params']['id']}},_0x5a8952={};_0x5a8952[_0x0083('0x39')]=_[_0x0083('0x35')](db[_0x0083('0x2f')]['rawAttributes']);_0x5a8952[_0x0083('0x34')]=_['keys'](_0x3fc234[_0x0083('0x34')]);_0x5a8952['filters']=_[_0x0083('0x37')](_0x5a8952[_0x0083('0x39')],_0x5a8952[_0x0083('0x34')]);_0x5ab5f4[_0x0083('0x38')]=_[_0x0083('0x37')](_0x5a8952['model'],qs[_0x0083('0x3a')](_0x3fc234[_0x0083('0x34')]['fields']));_0x5ab5f4[_0x0083('0x38')]=_0x5ab5f4[_0x0083('0x38')]['length']?_0x5ab5f4['attributes']:_0x5a8952[_0x0083('0x39')];if(_0x3fc234[_0x0083('0x34')]['includeAll']){_0x5ab5f4[_0x0083('0x46')]=[{'all':!![]}];}_0x5ab5f4=_[_0x0083('0x43')]({},_0x5ab5f4,_0x3fc234['options']);return db[_0x0083('0x2f')][_0x0083('0x4a')](_0x5ab5f4)[_0x0083('0x26')](handleEntityNotFound(_0x3dba26,null))['then'](respondWithResult(_0x3dba26,null))['catch'](handleError(_0x3dba26,null));};exports[_0x0083('0x4b')]=function(_0xf3c0f9,_0x370589){return db[_0x0083('0x2f')][_0x0083('0x4b')](_0xf3c0f9['body'],{})['then'](respondWithResult(_0x370589,0xc9))[_0x0083('0x4c')](handleError(_0x370589,null));};exports[_0x0083('0x25')]=function(_0x350f88,_0x4def8a){if(_0x350f88[_0x0083('0x4d')]['id']){delete _0x350f88[_0x0083('0x4d')]['id'];}return db[_0x0083('0x2f')][_0x0083('0x4a')]({'where':{'id':_0x350f88[_0x0083('0x4e')]['id']}})[_0x0083('0x26')](handleEntityNotFound(_0x4def8a,null))[_0x0083('0x26')](saveUpdates(_0x350f88[_0x0083('0x4d')],null))['then'](respondWithResult(_0x4def8a,null))[_0x0083('0x4c')](handleError(_0x4def8a,null));};exports[_0x0083('0x27')]=function(_0x37320c,_0x12b56b){return db[_0x0083('0x2f')][_0x0083('0x4a')]({'where':{'id':_0x37320c[_0x0083('0x4e')]['id']}})['then'](handleEntityNotFound(_0x12b56b,null))['then'](removeEntity(_0x12b56b,null))[_0x0083('0x4c')](handleError(_0x12b56b,null));};exports['getConfigurations']=function(_0x267701,_0x1d6a15,_0x5db55c){var _0x1a66de={};var _0x3a2ea3={};var _0x275b98;var _0x322516;return db['SugarcrmAccount'][_0x0083('0x4f')]({'where':{'id':_0x267701['params']['id']}})[_0x0083('0x26')](handleEntityNotFound(_0x1d6a15,null))['then'](function(_0x976b2c){if(_0x976b2c){_0x275b98=_0x976b2c;_0x3a2ea3[_0x0083('0x39')]=_[_0x0083('0x35')](db[_0x0083('0x50')][_0x0083('0x30')]);_0x3a2ea3[_0x0083('0x34')]=_[_0x0083('0x35')](_0x267701[_0x0083('0x34')]);_0x3a2ea3['filters']=_['intersection'](_0x3a2ea3['model'],_0x3a2ea3[_0x0083('0x34')]);_0x1a66de[_0x0083('0x38')]=_['intersection'](_0x3a2ea3[_0x0083('0x39')],qs['fields'](_0x267701[_0x0083('0x34')][_0x0083('0x3a')]));_0x1a66de[_0x0083('0x38')]=_0x1a66de[_0x0083('0x38')][_0x0083('0x3b')]?_0x1a66de[_0x0083('0x38')]:_0x3a2ea3[_0x0083('0x39')];_0x1a66de[_0x0083('0x3e')]=qs[_0x0083('0x3f')](_0x267701[_0x0083('0x34')][_0x0083('0x3f')]);_0x1a66de[_0x0083('0x42')]=qs[_0x0083('0x36')](_[_0x0083('0x40')](_0x267701[_0x0083('0x34')],_0x3a2ea3['filters']));if(_0x267701[_0x0083('0x34')][_0x0083('0x41')]){_0x1a66de[_0x0083('0x42')]=_[_0x0083('0x43')](_0x1a66de['where'],{'$or':_[_0x0083('0x2e')](_0x1a66de[_0x0083('0x38')],function(_0x182ba2){var _0x21b3a3={};_0x21b3a3[_0x182ba2]={'$like':'%'+_0x267701['query'][_0x0083('0x41')]+'%'};return _0x21b3a3;})});}_0x1a66de=_[_0x0083('0x43')]({},_0x1a66de,_0x267701[_0x0083('0x45')]);return _0x275b98[_0x0083('0x51')](_0x1a66de);}})[_0x0083('0x26')](function(_0x5b1f8e){if(_0x5b1f8e){_0x322516=_0x5b1f8e[_0x0083('0x3b')];if(!_0x267701[_0x0083('0x34')][_0x0083('0x3c')]('nolimit')){_0x1a66de['limit']=qs[_0x0083('0x1e')](_0x267701[_0x0083('0x34')][_0x0083('0x1e')]);_0x1a66de[_0x0083('0x1f')]=qs[_0x0083('0x1f')](_0x267701[_0x0083('0x34')][_0x0083('0x1f')]);}return _0x275b98[_0x0083('0x51')](_0x1a66de);}})[_0x0083('0x26')](function(_0x69949){if(_0x69949){return _0x69949?{'count':_0x322516,'rows':_0x69949}:null;}})[_0x0083('0x26')](respondWithResult(_0x1d6a15,null))[_0x0083('0x4c')](handleError(_0x1d6a15,null));};exports[_0x0083('0x52')]=function(_0xfdf4ed,_0x5e8855,_0x16e4ab){if(_0xfdf4ed['body']['id']){delete _0xfdf4ed[_0x0083('0x4d')]['id'];}return db[_0x0083('0x2f')]['findOne']({'where':{'id':_0xfdf4ed['params']['id']}})[_0x0083('0x26')](handleEntityNotFound(_0x5e8855,null))['then'](function(_0x1aff7c){if(_0x1aff7c){_0xfdf4ed[_0x0083('0x4d')][_0x0083('0x53')]=_0x1aff7c['id'];_0xfdf4ed['body'][_0x0083('0x54')]=integrations[_0x0083('0x55')](_0xfdf4ed['body'][_0x0083('0x56')],_0xfdf4ed['body'][_0x0083('0x32')]);_0xfdf4ed[_0x0083('0x4d')][_0x0083('0x57')]=integrations['getDescriptions'](_0xfdf4ed['body'][_0x0083('0x56')],_0xfdf4ed[_0x0083('0x4d')][_0x0083('0x32')]);return db[_0x0083('0x50')][_0x0083('0x4b')](_0xfdf4ed[_0x0083('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':_0x0083('0x54')},{'model':db['SugarcrmField'],'as':_0x0083('0x57')}]});}return null;})['then'](respondWithResult(_0x5e8855,null))[_0x0083('0x4c')](handleError(_0x5e8855,null));};exports[_0x0083('0x58')]=function(_0x5979ff,_0x446825,_0x263a04){var _0x48b2b9='';var _0x42c34f=['id','name',_0x0083('0x59'),_0x0083('0x5a'),_0x0083('0x5b'),'date_start',_0x0083('0x5c'),_0x0083('0x5d'),_0x0083('0x5e'),_0x0083('0x5f'),_0x0083('0x60'),_0x0083('0x61')];return db[_0x0083('0x2f')][_0x0083('0x4f')]({'where':{'id':_0x5979ff[_0x0083('0x4e')]['id']},'attributes':['id','username','password',_0x0083('0x62')]})['then'](handleEntityNotFound(_0x446825,null))['then'](function(_0x404508){if(_0x404508){_0x48b2b9=_0x404508['remoteUri'];var _0x9f19ac=_0x48b2b9[_0x0083('0x63')](-0x1);if(_0x9f19ac==='/'){_0x48b2b9=_0x48b2b9['substring'](0x0,_0x48b2b9['lastIndexOf'](_0x9f19ac));}return rp({'method':'POST','uri':util['format']('%s%s',_0x48b2b9,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0083('0x64'),'input_type':'JSON','response_type':_0x0083('0x65'),'rest_data':JSON[_0x0083('0x66')]({'user_auth':{'user_name':_0x404508['username'],'password':_0x404508[_0x0083('0x67')],'encryption':_0x0083('0x68')},'application':_0x0083('0x69')})}});}})['then'](function(_0xe26532){if(_0xe26532&&_0xe26532[_0x0083('0x2b')]!=='Invalid\x20Login'&&_0xe26532[_0x0083('0x2b')]!==_0x0083('0x6a')){return rp({'method':_0x0083('0x6b'),'uri':util[_0x0083('0x6c')](_0x0083('0x6d'),_0x48b2b9,_0x0083('0x6e')),'json':!![],'form':{'method':_0x0083('0x6f'),'input_type':_0x0083('0x65'),'response_type':_0x0083('0x65'),'rest_data':JSON[_0x0083('0x66')]({'session':_0xe26532['id'],'module_name':_0x0083('0x70')})}})['then'](function(_0x3e9a80){if(_0x3e9a80){var _0x23d757=_[_0x0083('0x71')](_0x3e9a80['module_fields']);_[_0x0083('0x72')](_0x23d757,function(_0x2c3c80){return _0x42c34f[_0x0083('0x73')](_0x2c3c80[_0x0083('0x2b')]);});return{'count':_0x23d757['length'],'rows':_['map'](_0x23d757,function(_0x1e9fa4){return{'id':_0x1e9fa4[_0x0083('0x2b')],'name':_0x1e9fa4['label'],'custom':_[_0x0083('0x74')](_0x1e9fa4[_0x0083('0x2b')],'_c')?!![]:![],'options':_0x1e9fa4[_0x0083('0x45')]?_[_0x0083('0x2e')](_[_0x0083('0x71')](_0x1e9fa4[_0x0083('0x45')]),function(_0x1b3acd){return{'name':_0x1b3acd[_0x0083('0x75')],'value':_0x1b3acd[_0x0083('0x2b')]};}):[]};})};}})['then'](respondWithResult(_0x446825,null))[_0x0083('0x4c')](function(_0x5c8037){var _0x2ebae4=_0x5979ff[_0x0083('0x34')][_0x0083('0x76')]?0x1f4:_0x5c8037[_0x0083('0x77')]||0x1f4;logger[_0x0083('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2ebae4,JSON['stringify'](_0x5c8037));delete _0x5c8037[_0x0083('0x2b')];if(_0x2ebae4===0x191){_0x2ebae4=0x190;}_0x446825['status'](_0x2ebae4)[_0x0083('0x2c')](_0x5979ff[_0x0083('0x34')]['test']?{'message':_0x0083('0x78'),'statusCode':_0x5c8037['statusCode']}:_0x5c8037);});}else{var _0x10f51a=0x1f4;_0x446825['status'](_0x10f51a)[_0x0083('0x2c')]({'message':_0x0083('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2e75=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode'];(function(_0x47b928,_0x13ac85){var _0x52dec1=function(_0x36675a){while(--_0x36675a){_0x47b928['push'](_0x47b928['shift']());}};_0x52dec1(++_0x13ac85);}(_0x2e75,0x1f4));var _0x52e7=function(_0x20764c,_0x34c524){_0x20764c=_0x20764c-0x0;var _0x4faf76=_0x2e75[_0x20764c];return _0x4faf76;};'use strict';var emlformat=require(_0x52e7('0x0'));var rimraf=require(_0x52e7('0x1'));var zipdir=require(_0x52e7('0x2'));var jsonpatch=require(_0x52e7('0x3'));var rp=require(_0x52e7('0x4'));var moment=require(_0x52e7('0x5'));var BPromise=require(_0x52e7('0x6'));var Mustache=require(_0x52e7('0x7'));var util=require(_0x52e7('0x8'));var path=require(_0x52e7('0x9'));var sox=require(_0x52e7('0xa'));var csv=require('to-csv');var ejs=require(_0x52e7('0xb'));var fs=require('fs');var fs_extra=require(_0x52e7('0xc'));var _=require(_0x52e7('0xd'));var squel=require(_0x52e7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x52e7('0xf'));var toCsv=require(_0x52e7('0x10'));var querystring=require('querystring');var Papa=require(_0x52e7('0x11'));var Redis=require(_0x52e7('0x12'));var authService=require(_0x52e7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52e7('0x14'));var logger=require('../../config/logger')(_0x52e7('0x15'));var utils=require(_0x52e7('0x16'));var config=require(_0x52e7('0x17'));var licenseUtil=require(_0x52e7('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x52e7('0x19'));function respondWithStatusCode(_0x19b4aa,_0x563214){_0x563214=_0x563214||0xcc;return function(_0x1fea8e){if(_0x1fea8e){return _0x19b4aa['sendStatus'](_0x563214);}return _0x19b4aa[_0x52e7('0x1a')](_0x563214)[_0x52e7('0x1b')]();};}function respondWithResult(_0x52bcc2,_0x3c13ae){_0x3c13ae=_0x3c13ae||0xc8;return function(_0x30ad05){if(_0x30ad05){return _0x52bcc2['status'](_0x3c13ae)['json'](_0x30ad05);}};}function respondWithFilteredResult(_0x3904d8,_0x5ed77f){return function(_0x1c6736){if(_0x1c6736){var _0x3cca62=typeof _0x5ed77f[_0x52e7('0x1c')]===_0x52e7('0x1d')&&typeof _0x5ed77f['limit']==='undefined';var _0x56d2ee=_0x1c6736[_0x52e7('0x1e')];var _0x99b0e7=_0x3cca62?0x0:_0x5ed77f[_0x52e7('0x1c')];var _0x300dfd=_0x3cca62?_0x1c6736[_0x52e7('0x1e')]:_0x5ed77f['offset']+_0x5ed77f['limit'];var _0x4d636b;if(_0x300dfd>=_0x56d2ee){_0x300dfd=_0x56d2ee;_0x4d636b=0xc8;}else{_0x4d636b=0xce;}_0x3904d8[_0x52e7('0x1a')](_0x4d636b);return _0x3904d8[_0x52e7('0x1f')](_0x52e7('0x20'),_0x99b0e7+'-'+_0x300dfd+'/'+_0x56d2ee)[_0x52e7('0x21')](_0x1c6736);}return null;};}function patchUpdates(_0x16dc07){return function(_0x1bebe3){try{jsonpatch[_0x52e7('0x22')](_0x1bebe3,_0x16dc07,!![]);}catch(_0x38a367){return BPromise[_0x52e7('0x23')](_0x38a367);}return _0x1bebe3[_0x52e7('0x24')]();};}function saveUpdates(_0x5b8712,_0x51b5b5){return function(_0x226829){if(_0x226829){return _0x226829[_0x52e7('0x25')](_0x5b8712)['then'](function(_0x325c9b){return _0x325c9b;});}return null;};}function removeEntity(_0x569ae2,_0x452db1){return function(_0x2b5125){if(_0x2b5125){return _0x2b5125[_0x52e7('0x26')]()[_0x52e7('0x27')](function(){_0x569ae2[_0x52e7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccc92,_0xf7a38e){return function(_0x46b042){if(!_0x46b042){_0x2ccc92[_0x52e7('0x28')](0x194);}return _0x46b042;};}function handleError(_0x5ac9c,_0x8379f1){_0x8379f1=_0x8379f1||0x1f4;return function(_0x49fbed){logger[_0x52e7('0x29')](_0x49fbed[_0x52e7('0x2a')]);if(_0x49fbed[_0x52e7('0x2b')]){delete _0x49fbed[_0x52e7('0x2b')];}_0x5ac9c['status'](_0x8379f1)[_0x52e7('0x2c')](_0x49fbed);};}exports[_0x52e7('0x2d')]=function(_0xb636ce,_0x16f84d){var _0x32901b={},_0x53e884={},_0x286421={'count':0x0,'rows':[]};var _0x1c605c=_['map'](db[_0x52e7('0x2e')][_0x52e7('0x2f')],function(_0x2381bf){return{'name':_0x2381bf[_0x52e7('0x30')],'type':_0x2381bf[_0x52e7('0x31')][_0x52e7('0x32')]};});_0x53e884[_0x52e7('0x33')]=_['map'](_0x1c605c,'name');_0x53e884[_0x52e7('0x34')]=_[_0x52e7('0x35')](_0xb636ce[_0x52e7('0x34')]);_0x53e884[_0x52e7('0x36')]=_[_0x52e7('0x37')](_0x53e884[_0x52e7('0x33')],_0x53e884[_0x52e7('0x34')]);_0x32901b['attributes']=_[_0x52e7('0x37')](_0x53e884[_0x52e7('0x33')],qs[_0x52e7('0x38')](_0xb636ce['query'][_0x52e7('0x38')]));_0x32901b[_0x52e7('0x39')]=_0x32901b[_0x52e7('0x39')][_0x52e7('0x3a')]?_0x32901b['attributes']:_0x53e884[_0x52e7('0x33')];if(!_0xb636ce[_0x52e7('0x34')][_0x52e7('0x3b')](_0x52e7('0x3c'))){_0x32901b[_0x52e7('0x3d')]=qs[_0x52e7('0x3d')](_0xb636ce['query'][_0x52e7('0x3d')]);_0x32901b['offset']=qs['offset'](_0xb636ce[_0x52e7('0x34')][_0x52e7('0x1c')]);}_0x32901b[_0x52e7('0x3e')]=qs[_0x52e7('0x3f')](_0xb636ce[_0x52e7('0x34')]['sort']);_0x32901b[_0x52e7('0x40')]=qs[_0x52e7('0x36')](_[_0x52e7('0x41')](_0xb636ce[_0x52e7('0x34')],_0x53e884[_0x52e7('0x36')]),_0x1c605c);if(_0xb636ce[_0x52e7('0x34')][_0x52e7('0x42')]){_0x32901b['where']=_[_0x52e7('0x43')](_0x32901b[_0x52e7('0x40')],{'$or':_[_0x52e7('0x44')](_0x1c605c,function(_0x48aaac){if(_0x48aaac[_0x52e7('0x31')]!==_0x52e7('0x45')){var _0x51435d={};_0x51435d[_0x48aaac[_0x52e7('0x2b')]]={'$like':'%'+_0xb636ce['query'][_0x52e7('0x42')]+'%'};return _0x51435d;}})});}_0x32901b=_[_0x52e7('0x43')]({},_0x32901b,_0xb636ce[_0x52e7('0x46')]);var _0x8b2bef={'where':_0x32901b['where']};return db[_0x52e7('0x2e')][_0x52e7('0x1e')](_0x8b2bef)[_0x52e7('0x27')](function(_0x2a51d9){_0x286421[_0x52e7('0x1e')]=_0x2a51d9;if(_0xb636ce[_0x52e7('0x34')][_0x52e7('0x47')]){_0x32901b[_0x52e7('0x48')]=[{'all':!![]}];}return db[_0x52e7('0x2e')][_0x52e7('0x49')](_0x32901b);})[_0x52e7('0x27')](function(_0x1c44b4){_0x286421['rows']=_0x1c44b4;return _0x286421;})[_0x52e7('0x27')](respondWithFilteredResult(_0x16f84d,_0x32901b))[_0x52e7('0x4a')](handleError(_0x16f84d,null));};exports['show']=function(_0x13c3b6,_0x53fdb8){var _0x567656={'raw':![],'where':{'id':_0x13c3b6['params']['id']}},_0x538fcd={};_0x538fcd[_0x52e7('0x33')]=_[_0x52e7('0x35')](db[_0x52e7('0x2e')][_0x52e7('0x2f')]);_0x538fcd[_0x52e7('0x34')]=_['keys'](_0x13c3b6[_0x52e7('0x34')]);_0x538fcd[_0x52e7('0x36')]=_['intersection'](_0x538fcd[_0x52e7('0x33')],_0x538fcd[_0x52e7('0x34')]);_0x567656[_0x52e7('0x39')]=_[_0x52e7('0x37')](_0x538fcd[_0x52e7('0x33')],qs[_0x52e7('0x38')](_0x13c3b6[_0x52e7('0x34')][_0x52e7('0x38')]));_0x567656[_0x52e7('0x39')]=_0x567656[_0x52e7('0x39')]['length']?_0x567656[_0x52e7('0x39')]:_0x538fcd[_0x52e7('0x33')];if(_0x13c3b6['query']['includeAll']){_0x567656[_0x52e7('0x48')]=[{'all':!![]}];}_0x567656=_[_0x52e7('0x43')]({},_0x567656,_0x13c3b6[_0x52e7('0x46')]);return db[_0x52e7('0x2e')][_0x52e7('0x4b')](_0x567656)[_0x52e7('0x27')](handleEntityNotFound(_0x53fdb8,null))[_0x52e7('0x27')](respondWithResult(_0x53fdb8,null))[_0x52e7('0x4a')](handleError(_0x53fdb8,null));};exports['create']=function(_0x1e2887,_0x43b558){return db['SugarcrmAccount'][_0x52e7('0x4c')](_0x1e2887[_0x52e7('0x4d')],{})[_0x52e7('0x27')](respondWithResult(_0x43b558,0xc9))[_0x52e7('0x4a')](handleError(_0x43b558,null));};exports['update']=function(_0x4a4232,_0x1c7fb4){if(_0x4a4232['body']['id']){delete _0x4a4232[_0x52e7('0x4d')]['id'];}return db['SugarcrmAccount'][_0x52e7('0x4b')]({'where':{'id':_0x4a4232[_0x52e7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1c7fb4,null))[_0x52e7('0x27')](saveUpdates(_0x4a4232[_0x52e7('0x4d')],null))[_0x52e7('0x27')](respondWithResult(_0x1c7fb4,null))['catch'](handleError(_0x1c7fb4,null));};exports[_0x52e7('0x26')]=function(_0x43355e,_0x322f7d){return db[_0x52e7('0x2e')][_0x52e7('0x4b')]({'where':{'id':_0x43355e[_0x52e7('0x4e')]['id']}})[_0x52e7('0x27')](handleEntityNotFound(_0x322f7d,null))[_0x52e7('0x27')](removeEntity(_0x322f7d,null))[_0x52e7('0x4a')](handleError(_0x322f7d,null));};exports[_0x52e7('0x4f')]=function(_0x1987af,_0x1507ea,_0x19018f){var _0x215e2f={};var _0x257205={};var _0x1b0c39;var _0x166825;return db['SugarcrmAccount'][_0x52e7('0x50')]({'where':{'id':_0x1987af[_0x52e7('0x4e')]['id']}})[_0x52e7('0x27')](handleEntityNotFound(_0x1507ea,null))['then'](function(_0x5ef0f){if(_0x5ef0f){_0x1b0c39=_0x5ef0f;_0x257205[_0x52e7('0x33')]=_[_0x52e7('0x35')](db[_0x52e7('0x51')][_0x52e7('0x2f')]);_0x257205[_0x52e7('0x34')]=_['keys'](_0x1987af[_0x52e7('0x34')]);_0x257205[_0x52e7('0x36')]=_[_0x52e7('0x37')](_0x257205['model'],_0x257205[_0x52e7('0x34')]);_0x215e2f[_0x52e7('0x39')]=_[_0x52e7('0x37')](_0x257205[_0x52e7('0x33')],qs[_0x52e7('0x38')](_0x1987af[_0x52e7('0x34')]['fields']));_0x215e2f[_0x52e7('0x39')]=_0x215e2f[_0x52e7('0x39')]['length']?_0x215e2f[_0x52e7('0x39')]:_0x257205[_0x52e7('0x33')];_0x215e2f[_0x52e7('0x3e')]=qs[_0x52e7('0x3f')](_0x1987af[_0x52e7('0x34')][_0x52e7('0x3f')]);_0x215e2f[_0x52e7('0x40')]=qs[_0x52e7('0x36')](_[_0x52e7('0x41')](_0x1987af['query'],_0x257205[_0x52e7('0x36')]));if(_0x1987af[_0x52e7('0x34')][_0x52e7('0x42')]){_0x215e2f[_0x52e7('0x40')]=_[_0x52e7('0x43')](_0x215e2f['where'],{'$or':_[_0x52e7('0x44')](_0x215e2f[_0x52e7('0x39')],function(_0x54fc38){var _0x1ce214={};_0x1ce214[_0x54fc38]={'$like':'%'+_0x1987af[_0x52e7('0x34')][_0x52e7('0x42')]+'%'};return _0x1ce214;})});}_0x215e2f=_['merge']({},_0x215e2f,_0x1987af[_0x52e7('0x46')]);return _0x1b0c39[_0x52e7('0x4f')](_0x215e2f);}})['then'](function(_0x50b8f5){if(_0x50b8f5){_0x166825=_0x50b8f5[_0x52e7('0x3a')];if(!_0x1987af[_0x52e7('0x34')]['hasOwnProperty'](_0x52e7('0x3c'))){_0x215e2f['limit']=qs[_0x52e7('0x3d')](_0x1987af[_0x52e7('0x34')][_0x52e7('0x3d')]);_0x215e2f[_0x52e7('0x1c')]=qs[_0x52e7('0x1c')](_0x1987af['query'][_0x52e7('0x1c')]);}return _0x1b0c39[_0x52e7('0x4f')](_0x215e2f);}})[_0x52e7('0x27')](function(_0x5576b8){if(_0x5576b8){return _0x5576b8?{'count':_0x166825,'rows':_0x5576b8}:null;}})[_0x52e7('0x27')](respondWithResult(_0x1507ea,null))[_0x52e7('0x4a')](handleError(_0x1507ea,null));};exports['addConfiguration']=function(_0x52d53e,_0x3aa5dd,_0x3898bf){if(_0x52d53e[_0x52e7('0x4d')]['id']){delete _0x52d53e[_0x52e7('0x4d')]['id'];}return db['SugarcrmAccount'][_0x52e7('0x50')]({'where':{'id':_0x52d53e[_0x52e7('0x4e')]['id']}})[_0x52e7('0x27')](handleEntityNotFound(_0x3aa5dd,null))[_0x52e7('0x27')](function(_0x560e7c){if(_0x560e7c){_0x52d53e[_0x52e7('0x4d')][_0x52e7('0x52')]=_0x560e7c['id'];_0x52d53e[_0x52e7('0x4d')]['Subjects']=integrations[_0x52e7('0x53')](_0x52d53e[_0x52e7('0x4d')][_0x52e7('0x54')],_0x52d53e[_0x52e7('0x4d')]['type']);_0x52d53e['body'][_0x52e7('0x55')]=integrations[_0x52e7('0x56')](_0x52d53e[_0x52e7('0x4d')][_0x52e7('0x54')],_0x52d53e[_0x52e7('0x4d')][_0x52e7('0x31')]);return db[_0x52e7('0x51')][_0x52e7('0x4c')](_0x52d53e['body'],{'include':[{'model':db[_0x52e7('0x57')],'as':'Subjects'},{'model':db[_0x52e7('0x57')],'as':_0x52e7('0x55')}]});}return null;})['then'](respondWithResult(_0x3aa5dd,null))[_0x52e7('0x4a')](handleError(_0x3aa5dd,null));};exports[_0x52e7('0x58')]=function(_0x3f04cb,_0x5ee2ba,_0x37ff6c){var _0x18b3fe='';var _0x3a5a63=['id','name',_0x52e7('0x59'),_0x52e7('0x5a'),_0x52e7('0x5b'),_0x52e7('0x5c'),_0x52e7('0x5d'),_0x52e7('0x5e'),_0x52e7('0x5f'),'parent_type',_0x52e7('0x60'),_0x52e7('0x61')];return db[_0x52e7('0x2e')]['findOne']({'where':{'id':_0x3f04cb['params']['id']},'attributes':['id','username',_0x52e7('0x62'),_0x52e7('0x63')]})['then'](handleEntityNotFound(_0x5ee2ba,null))[_0x52e7('0x27')](function(_0x59f2f6){if(_0x59f2f6){_0x18b3fe=_0x59f2f6[_0x52e7('0x63')];var _0x21bea4=_0x18b3fe[_0x52e7('0x64')](-0x1);if(_0x21bea4==='/'){_0x18b3fe=_0x18b3fe[_0x52e7('0x65')](0x0,_0x18b3fe[_0x52e7('0x66')](_0x21bea4));}return rp({'method':_0x52e7('0x67'),'uri':util['format'](_0x52e7('0x68'),_0x18b3fe,_0x52e7('0x69')),'json':!![],'form':{'method':_0x52e7('0x6a'),'input_type':'JSON','response_type':_0x52e7('0x6b'),'rest_data':JSON[_0x52e7('0x6c')]({'user_auth':{'user_name':_0x59f2f6[_0x52e7('0x6d')],'password':_0x59f2f6[_0x52e7('0x62')],'encryption':'PLAIN'},'application':_0x52e7('0x6e')})}});}})[_0x52e7('0x27')](function(_0x3773de){if(_0x3773de&&_0x3773de['name']!==_0x52e7('0x6f')&&_0x3773de['name']!=='Password\x20Expired'){return rp({'method':_0x52e7('0x67'),'uri':util[_0x52e7('0x70')](_0x52e7('0x68'),_0x18b3fe,_0x52e7('0x69')),'json':!![],'form':{'method':_0x52e7('0x71'),'input_type':_0x52e7('0x6b'),'response_type':'JSON','rest_data':JSON[_0x52e7('0x6c')]({'session':_0x3773de['id'],'module_name':_0x52e7('0x72')})}})[_0x52e7('0x27')](function(_0xfe1b08){if(_0xfe1b08){var _0x3bb6d5=_[_0x52e7('0x73')](_0xfe1b08[_0x52e7('0x74')]);_[_0x52e7('0x75')](_0x3bb6d5,function(_0x3dd6f9){return _0x3a5a63['includes'](_0x3dd6f9['name']);});return{'count':_0x3bb6d5['length'],'rows':_[_0x52e7('0x44')](_0x3bb6d5,function(_0x282148){return{'id':_0x282148[_0x52e7('0x2b')],'name':_0x282148[_0x52e7('0x76')],'custom':_[_0x52e7('0x77')](_0x282148[_0x52e7('0x2b')],'_c')?!![]:![],'options':_0x282148[_0x52e7('0x46')]?_['map'](_[_0x52e7('0x73')](_0x282148[_0x52e7('0x46')]),function(_0x2c61a6){return{'name':_0x2c61a6[_0x52e7('0x78')],'value':_0x2c61a6[_0x52e7('0x2b')]};}):[]};})};}})[_0x52e7('0x27')](respondWithResult(_0x5ee2ba,null))['catch'](function(_0x2e8f6e){var _0x2fc1e8=_0x3f04cb[_0x52e7('0x34')]['test']?0x1f4:_0x2e8f6e['statusCode']||0x1f4;logger[_0x52e7('0x29')](_0x52e7('0x79'),_0x52e7('0x58'),_0x2fc1e8,JSON['stringify'](_0x2e8f6e));delete _0x2e8f6e[_0x52e7('0x2b')];if(_0x2fc1e8===0x191){_0x2fc1e8=0x190;}_0x5ee2ba['status'](_0x2fc1e8)[_0x52e7('0x2c')](_0x3f04cb[_0x52e7('0x34')][_0x52e7('0x7a')]?{'message':_0x52e7('0x7b'),'statusCode':_0x2e8f6e[_0x52e7('0x7c')]}:_0x2e8f6e);});}else{var _0x14e8d9=0x1f4;_0x5ee2ba['status'](_0x14e8d9)[_0x52e7('0x2c')]({'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 0d9a983..f0e2f99 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 _0x2551=['api','request-promise','rimraf','exports','define','SugarcrmAccount','lodash','util'];(function(_0x37d4ac,_0x4e47d6){var _0x5e727a=function(_0x5adbff){while(--_0x5adbff){_0x37d4ac['push'](_0x37d4ac['shift']());}};_0x5e727a(++_0x4e47d6);}(_0x2551,0x1c6));var _0x1255=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x2551[_0x12d951];return _0x44de17;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var logger=require('../../config/logger')(_0x1255('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1255('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1255('0x4'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1255('0x5')]=function(_0x6af3f7,_0x4f8d3b){return _0x6af3f7[_0x1255('0x6')](_0x1255('0x7'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee0=['moment','bluebird','request-promise','path','rimraf','exports','define','int_sugarcrm_accounts','util','../../config/logger','api'];(function(_0x547131,_0x5bc899){var _0x5d7c7f=function(_0xb376b5){while(--_0xb376b5){_0x547131['push'](_0x547131['shift']());}};_0x5d7c7f(++_0x5bc899);}(_0xbee0,0x147));var _0x0bee=function(_0x36532b,_0x2a22fe){_0x36532b=_0x36532b-0x0;var _0x45aa08=_0xbee0[_0x36532b];return _0x45aa08;};'use strict';var _=require('lodash');var util=require(_0x0bee('0x0'));var logger=require(_0x0bee('0x1'))(_0x0bee('0x2'));var moment=require(_0x0bee('0x3'));var BPromise=require(_0x0bee('0x4'));var rp=require(_0x0bee('0x5'));var fs=require('fs');var path=require(_0x0bee('0x6'));var rimraf=require(_0x0bee('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0bee('0x8')]=function(_0xa3a091,_0x3e499b){return _0xa3a091[_0x0bee('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x0bee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index bc5dc8e..3a5ff5b 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 _0x44af=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','include','map','model','debug','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x31babe,_0x5f4b5f){var _0x308bb4=function(_0x496714){while(--_0x496714){_0x31babe['push'](_0x31babe['shift']());}};_0x308bb4(++_0x5f4b5f);}(_0x44af,0xc5));var _0xf44a=function(_0x4147e6,_0x57174e){_0x4147e6=_0x4147e6-0x0;var _0x3305ba=_0x44af[_0x4147e6];return _0x3305ba;};'use strict';var _=require(_0xf44a('0x0'));var util=require(_0xf44a('0x1'));var moment=require(_0xf44a('0x2'));var BPromise=require(_0xf44a('0x3'));var rs=require(_0xf44a('0x4'));var fs=require('fs');var Redis=require(_0xf44a('0x5'));var db=require(_0xf44a('0x6'))['db'];var utils=require(_0xf44a('0x7'));var logger=require('../../config/logger')(_0xf44a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf44a('0x9'));var client=jayson[_0xf44a('0xa')][_0xf44a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cd7c1,_0x2564cd,_0x488169){return new BPromise(function(_0x5e40ef,_0x361a2c){return client[_0xf44a('0xc')](_0x3cd7c1,_0x488169)[_0xf44a('0xd')](function(_0x14e6bf){logger[_0xf44a('0xe')](_0xf44a('0xf'),_0x2564cd,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2564cd,_0xf44a('0x10'),JSON[_0xf44a('0x11')](_0x14e6bf));if(_0x14e6bf[_0xf44a('0x12')]){if(_0x14e6bf[_0xf44a('0x12')][_0xf44a('0x13')]===0x1f4){logger[_0xf44a('0x12')](_0xf44a('0xf'),_0x2564cd,_0x14e6bf[_0xf44a('0x12')][_0xf44a('0x14')]);return _0x361a2c(_0x14e6bf['error'][_0xf44a('0x14')]);}logger[_0xf44a('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2564cd,_0x14e6bf[_0xf44a('0x12')][_0xf44a('0x14')]);return _0x5e40ef(_0x14e6bf[_0xf44a('0x12')][_0xf44a('0x14')]);}else{logger['info'](_0xf44a('0xf'),_0x2564cd,_0xf44a('0x10'));_0x5e40ef(_0x14e6bf[_0xf44a('0x15')][_0xf44a('0x14')]);}})[_0xf44a('0x16')](function(_0x163adc){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2564cd,_0x163adc);_0x361a2c(_0x163adc);});});}exports[_0xf44a('0x17')]=function(_0x1b2adc){var _0x14c5fe=this;return new Promise(function(_0x4403cb,_0xc1c0b8){return db[_0xf44a('0x18')]['findAll']({'raw':_0x1b2adc['options']?_0x1b2adc[_0xf44a('0x19')][_0xf44a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b2adc[_0xf44a('0x19')]?_0x1b2adc['options']['where']||null:null,'attributes':_0x1b2adc[_0xf44a('0x19')]?_0x1b2adc[_0xf44a('0x19')][_0xf44a('0x1b')]||null:null,'limit':_0x1b2adc[_0xf44a('0x19')]?_0x1b2adc[_0xf44a('0x19')]['limit']||null:null,'include':_0x1b2adc[_0xf44a('0x19')]?_0x1b2adc[_0xf44a('0x19')][_0xf44a('0x1c')]?_[_0xf44a('0x1d')](_0x1b2adc[_0xf44a('0x19')][_0xf44a('0x1c')],function(_0x2ee005){return{'model':db[_0x2ee005[_0xf44a('0x1e')]],'as':_0x2ee005['as'],'attributes':_0x2ee005[_0xf44a('0x1b')],'include':_0x2ee005[_0xf44a('0x1c')]?_[_0xf44a('0x1d')](_0x2ee005[_0xf44a('0x1c')],function(_0x1a686a){return{'model':db[_0x1a686a[_0xf44a('0x1e')]],'as':_0x1a686a['as'],'attributes':_0x1a686a[_0xf44a('0x1b')],'include':_0x1a686a[_0xf44a('0x1c')]?_[_0xf44a('0x1d')](_0x1a686a[_0xf44a('0x1c')],function(_0x1f2204){return{'model':db[_0x1f2204['model']],'as':_0x1f2204['as'],'attributes':_0x1f2204[_0xf44a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18c045){logger[_0xf44a('0xe')](_0xf44a('0x17'),_0x1b2adc);logger[_0xf44a('0x1f')](_0xf44a('0x17'),_0x1b2adc,JSON[_0xf44a('0x11')](_0x18c045));_0x4403cb(_0x18c045);})[_0xf44a('0x16')](function(_0x2a9d0f){logger[_0xf44a('0x12')](_0xf44a('0x17'),_0x2a9d0f[_0xf44a('0x14')],_0x1b2adc);_0xc1c0b8(_0x14c5fe[_0xf44a('0x12')](0x1f4,_0x2a9d0f[_0xf44a('0x14')]));});});};exports[_0xf44a('0x20')]=function(_0x3a2f4e){var _0x550d68=this;return new Promise(function(_0x3ada32,_0x3e5738){return db[_0xf44a('0x18')][_0xf44a('0x21')]({'raw':_0x3a2f4e[_0xf44a('0x19')]?_0x3a2f4e[_0xf44a('0x19')][_0xf44a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a2f4e[_0xf44a('0x19')]?_0x3a2f4e['options']['where']||null:null,'attributes':_0x3a2f4e[_0xf44a('0x19')]?_0x3a2f4e[_0xf44a('0x19')][_0xf44a('0x1b')]||null:null,'include':_0x3a2f4e[_0xf44a('0x19')]?_0x3a2f4e['options'][_0xf44a('0x1c')]?_[_0xf44a('0x1d')](_0x3a2f4e[_0xf44a('0x19')][_0xf44a('0x1c')],function(_0x31cff0){return{'model':db[_0x31cff0[_0xf44a('0x1e')]],'as':_0x31cff0['as'],'attributes':_0x31cff0[_0xf44a('0x1b')],'include':_0x31cff0[_0xf44a('0x1c')]?_[_0xf44a('0x1d')](_0x31cff0[_0xf44a('0x1c')],function(_0x51d469){return{'model':db[_0x51d469[_0xf44a('0x1e')]],'as':_0x51d469['as'],'attributes':_0x51d469[_0xf44a('0x1b')],'include':_0x51d469[_0xf44a('0x1c')]?_['map'](_0x51d469[_0xf44a('0x1c')],function(_0xfe9bb6){return{'model':db[_0xfe9bb6[_0xf44a('0x1e')]],'as':_0xfe9bb6['as'],'attributes':_0xfe9bb6[_0xf44a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf44a('0xd')](function(_0x5f4928){logger[_0xf44a('0xe')](_0xf44a('0x20'),_0x3a2f4e);logger[_0xf44a('0x1f')]('ShowSugarcrmAccount',_0x3a2f4e,JSON['stringify'](_0x5f4928));_0x3ada32(_0x5f4928);})[_0xf44a('0x16')](function(_0x31259d){logger[_0xf44a('0x12')](_0xf44a('0x20'),_0x31259d['message'],_0x3a2f4e);_0x3e5738(_0x550d68[_0xf44a('0x12')](0x1f4,_0x31259d[_0xf44a('0x14')]));});});}; \ No newline at end of file +var _0xc15c=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xc15c,0x65));var _0xcc15=function(_0x3b7907,_0xbd703d){_0x3b7907=_0x3b7907-0x0;var _0x5ca490=_0xc15c[_0x3b7907];return _0x5ca490;};'use strict';var _=require(_0xcc15('0x0'));var util=require(_0xcc15('0x1'));var moment=require('moment');var BPromise=require(_0xcc15('0x2'));var rs=require(_0xcc15('0x3'));var fs=require('fs');var Redis=require(_0xcc15('0x4'));var db=require(_0xcc15('0x5'))['db'];var utils=require(_0xcc15('0x6'));var logger=require(_0xcc15('0x7'))(_0xcc15('0x8'));var config=require(_0xcc15('0x9'));var jayson=require(_0xcc15('0xa'));var client=jayson[_0xcc15('0xb')][_0xcc15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e6f7d,_0x3b8203,_0x499c91){return new BPromise(function(_0x4afa00,_0x31fa50){return client['request'](_0x5e6f7d,_0x499c91)[_0xcc15('0xd')](function(_0x5d77e9){logger[_0xcc15('0xe')](_0xcc15('0xf'),_0x3b8203,_0xcc15('0x10'));logger[_0xcc15('0x11')](_0xcc15('0x12'),_0x3b8203,_0xcc15('0x10'),JSON['stringify'](_0x5d77e9));if(_0x5d77e9[_0xcc15('0x13')]){if(_0x5d77e9[_0xcc15('0x13')][_0xcc15('0x14')]===0x1f4){logger[_0xcc15('0x13')](_0xcc15('0xf'),_0x3b8203,_0x5d77e9[_0xcc15('0x13')][_0xcc15('0x15')]);return _0x31fa50(_0x5d77e9[_0xcc15('0x13')]['message']);}logger[_0xcc15('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x3b8203,_0x5d77e9[_0xcc15('0x13')][_0xcc15('0x15')]);return _0x4afa00(_0x5d77e9[_0xcc15('0x13')]['message']);}else{logger[_0xcc15('0xe')](_0xcc15('0xf'),_0x3b8203,_0xcc15('0x10'));_0x4afa00(_0x5d77e9[_0xcc15('0x16')][_0xcc15('0x15')]);}})[_0xcc15('0x17')](function(_0x44e38b){logger[_0xcc15('0x13')](_0xcc15('0xf'),_0x3b8203,_0x44e38b);_0x31fa50(_0x44e38b);});});}exports[_0xcc15('0x18')]=function(_0x39ee9e){var _0x5ee598=this;return new Promise(function(_0x1a3a0f,_0x306ad8){return db[_0xcc15('0x19')][_0xcc15('0x1a')]({'raw':_0x39ee9e[_0xcc15('0x1b')]?_0x39ee9e['options'][_0xcc15('0x1c')]===undefined?!![]:![]:!![],'where':_0x39ee9e[_0xcc15('0x1b')]?_0x39ee9e[_0xcc15('0x1b')][_0xcc15('0x1d')]||null:null,'attributes':_0x39ee9e[_0xcc15('0x1b')]?_0x39ee9e['options'][_0xcc15('0x1e')]||null:null,'limit':_0x39ee9e[_0xcc15('0x1b')]?_0x39ee9e[_0xcc15('0x1b')][_0xcc15('0x1f')]||null:null,'include':_0x39ee9e[_0xcc15('0x1b')]?_0x39ee9e[_0xcc15('0x1b')][_0xcc15('0x20')]?_[_0xcc15('0x21')](_0x39ee9e['options'][_0xcc15('0x20')],function(_0x31a0a0){return{'model':db[_0x31a0a0[_0xcc15('0x22')]],'as':_0x31a0a0['as'],'attributes':_0x31a0a0['attributes'],'include':_0x31a0a0[_0xcc15('0x20')]?_['map'](_0x31a0a0[_0xcc15('0x20')],function(_0x2e3729){return{'model':db[_0x2e3729[_0xcc15('0x22')]],'as':_0x2e3729['as'],'attributes':_0x2e3729[_0xcc15('0x1e')],'include':_0x2e3729[_0xcc15('0x20')]?_['map'](_0x2e3729[_0xcc15('0x20')],function(_0x1882d8){return{'model':db[_0x1882d8['model']],'as':_0x1882d8['as'],'attributes':_0x1882d8['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc15('0xd')](function(_0x6c65a6){logger[_0xcc15('0xe')]('GetSugarcrmAccount',_0x39ee9e);logger[_0xcc15('0x11')]('GetSugarcrmAccount',_0x39ee9e,JSON['stringify'](_0x6c65a6));_0x1a3a0f(_0x6c65a6);})[_0xcc15('0x17')](function(_0x1fe7d2){logger['error'](_0xcc15('0x18'),_0x1fe7d2[_0xcc15('0x15')],_0x39ee9e);_0x306ad8(_0x5ee598['error'](0x1f4,_0x1fe7d2[_0xcc15('0x15')]));});});};exports[_0xcc15('0x23')]=function(_0x4ac908){var _0x2d31cd=this;return new Promise(function(_0x5d0d13,_0x2e13ce){return db['SugarcrmAccount'][_0xcc15('0x24')]({'raw':_0x4ac908[_0xcc15('0x1b')]?_0x4ac908['options'][_0xcc15('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ac908[_0xcc15('0x1b')]?_0x4ac908[_0xcc15('0x1b')][_0xcc15('0x1d')]||null:null,'attributes':_0x4ac908['options']?_0x4ac908[_0xcc15('0x1b')]['attributes']||null:null,'include':_0x4ac908['options']?_0x4ac908['options'][_0xcc15('0x20')]?_[_0xcc15('0x21')](_0x4ac908[_0xcc15('0x1b')][_0xcc15('0x20')],function(_0x1f24f4){return{'model':db[_0x1f24f4[_0xcc15('0x22')]],'as':_0x1f24f4['as'],'attributes':_0x1f24f4[_0xcc15('0x1e')],'include':_0x1f24f4['include']?_[_0xcc15('0x21')](_0x1f24f4[_0xcc15('0x20')],function(_0x223c81){return{'model':db[_0x223c81[_0xcc15('0x22')]],'as':_0x223c81['as'],'attributes':_0x223c81[_0xcc15('0x1e')],'include':_0x223c81[_0xcc15('0x20')]?_[_0xcc15('0x21')](_0x223c81['include'],function(_0x442b00){return{'model':db[_0x442b00[_0xcc15('0x22')]],'as':_0x442b00['as'],'attributes':_0x442b00[_0xcc15('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc15('0xd')](function(_0x241d9d){logger[_0xcc15('0xe')]('ShowSugarcrmAccount',_0x4ac908);logger[_0xcc15('0x11')]('ShowSugarcrmAccount',_0x4ac908,JSON[_0xcc15('0x25')](_0x241d9d));_0x5d0d13(_0x241d9d);})[_0xcc15('0x17')](function(_0x7a65b6){logger[_0xcc15('0x13')](_0xcc15('0x23'),_0x7a65b6[_0xcc15('0x15')],_0x4ac908);_0x2e13ce(_0x2d31cd[_0xcc15('0x13')](0x1f4,_0x7a65b6[_0xcc15('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e7adccc..74d2246 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 _0xef82=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2393cc,_0x118a07){var _0x29c435=function(_0x5a26b6){while(--_0x5a26b6){_0x2393cc['push'](_0x2393cc['shift']());}};_0x29c435(++_0x118a07);}(_0xef82,0x171));var _0x2ef8=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xef82[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x2ef8('0x0'));var util=require(_0x2ef8('0x1'));var path=require('path');var timeout=require(_0x2ef8('0x2'));var express=require(_0x2ef8('0x3'));var router=express[_0x2ef8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2ef8('0x5'));var interaction=require(_0x2ef8('0x6'));var config=require(_0x2ef8('0x7'));var controller=require(_0x2ef8('0x8'));router['get']('/',auth[_0x2ef8('0x9')](),controller[_0x2ef8('0xa')]);router['get']('/:id',auth[_0x2ef8('0x9')](),controller[_0x2ef8('0xb')]);router[_0x2ef8('0xc')](_0x2ef8('0xd'),auth[_0x2ef8('0x9')](),controller[_0x2ef8('0xe')]);router['get']('/:id/subjects',auth[_0x2ef8('0x9')](),controller[_0x2ef8('0xf')]);router[_0x2ef8('0xc')](_0x2ef8('0x10'),auth[_0x2ef8('0x9')](),controller[_0x2ef8('0x11')]);router['post']('/',auth[_0x2ef8('0x9')](),controller[_0x2ef8('0x12')]);router[_0x2ef8('0x13')](_0x2ef8('0x14'),auth[_0x2ef8('0x9')](),controller[_0x2ef8('0x15')]);router[_0x2ef8('0x16')](_0x2ef8('0x14'),auth[_0x2ef8('0x9')](),controller[_0x2ef8('0x17')]);module[_0x2ef8('0x18')]=router; \ No newline at end of file +var _0xbc60=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','post','put','delete'];(function(_0x2418ce,_0x4349c3){var _0x2dd9a3=function(_0x1d3429){while(--_0x1d3429){_0x2418ce['push'](_0x2418ce['shift']());}};_0x2dd9a3(++_0x4349c3);}(_0xbc60,0x8c));var _0x0bc6=function(_0x5cdfd9,_0x1107e3){_0x5cdfd9=_0x5cdfd9-0x0;var _0x386492=_0xbc60[_0x5cdfd9];return _0x386492;};'use strict';var multer=require(_0x0bc6('0x0'));var util=require(_0x0bc6('0x1'));var path=require(_0x0bc6('0x2'));var timeout=require(_0x0bc6('0x3'));var express=require(_0x0bc6('0x4'));var router=express[_0x0bc6('0x5')]();var fs_extra=require(_0x0bc6('0x6'));var auth=require(_0x0bc6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0bc6('0x8'));var controller=require(_0x0bc6('0x9'));router[_0x0bc6('0xa')]('/',auth[_0x0bc6('0xb')](),controller[_0x0bc6('0xc')]);router[_0x0bc6('0xa')](_0x0bc6('0xd'),auth[_0x0bc6('0xb')](),controller[_0x0bc6('0xe')]);router[_0x0bc6('0xa')]('/:id/fields',auth[_0x0bc6('0xb')](),controller['getFields']);router[_0x0bc6('0xa')](_0x0bc6('0xf'),auth[_0x0bc6('0xb')](),controller['getSubjects']);router[_0x0bc6('0xa')](_0x0bc6('0x10'),auth[_0x0bc6('0xb')](),controller[_0x0bc6('0x11')]);router[_0x0bc6('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0bc6('0x13')](_0x0bc6('0xd'),auth[_0x0bc6('0xb')](),controller['update']);router[_0x0bc6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0bc6('0x15')]);module[_0x0bc6('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 cd715c1..3090f6b 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 _0xc58c=['exports','sequelize'];(function(_0x546bff,_0x3640e6){var _0x490359=function(_0x3e955b){while(--_0x3e955b){_0x546bff['push'](_0x546bff['shift']());}};_0x490359(++_0x3640e6);}(_0xc58c,0x95));var _0xcc58=function(_0x179ac7,_0x4f7aa5){_0x179ac7=_0x179ac7-0x0;var _0x310425=_0xc58c[_0x179ac7];return _0x310425;};'use strict';var Sequelize=require(_0xcc58('0x0'));module[_0xcc58('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb133=['exports','STRING'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xb133,0x8e));var _0x3b13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb133[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x3b13('0x0')]={'name':{'type':Sequelize[_0x3b13('0x1')]},'description':{'type':Sequelize[_0x3b13('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 41f1f28..4ff0398 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 _0x48dd=['nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','findAll','rows','catch','params','include','create','body','find','getFields','findOne','SugarcrmField','rawAttributes','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','SugarcrmConfiguration','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x48dd,0x154));var _0xd48d=function(_0xea4e13,_0x5021ca){_0xea4e13=_0xea4e13-0x0;var _0x466cae=_0x48dd[_0xea4e13];return _0x466cae;};'use strict';var emlformat=require(_0xd48d('0x0'));var rimraf=require(_0xd48d('0x1'));var zipdir=require(_0xd48d('0x2'));var jsonpatch=require(_0xd48d('0x3'));var rp=require('request-promise');var moment=require(_0xd48d('0x4'));var BPromise=require(_0xd48d('0x5'));var Mustache=require(_0xd48d('0x6'));var util=require(_0xd48d('0x7'));var path=require(_0xd48d('0x8'));var sox=require(_0xd48d('0x9'));var csv=require(_0xd48d('0xa'));var ejs=require(_0xd48d('0xb'));var fs=require('fs');var fs_extra=require(_0xd48d('0xc'));var _=require(_0xd48d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd48d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd48d('0xa'));var querystring=require(_0xd48d('0xf'));var Papa=require('papaparse');var Redis=require(_0xd48d('0x10'));var authService=require(_0xd48d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd48d('0x12'));var logger=require(_0xd48d('0x13'))('api');var utils=require(_0xd48d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd48d('0x15'));var db=require(_0xd48d('0x16'))['db'];function respondWithStatusCode(_0x1d0b05,_0x5d4cb4){_0x5d4cb4=_0x5d4cb4||0xcc;return function(_0x555b8f){if(_0x555b8f){return _0x1d0b05['sendStatus'](_0x5d4cb4);}return _0x1d0b05[_0xd48d('0x17')](_0x5d4cb4)[_0xd48d('0x18')]();};}function respondWithResult(_0x40c49f,_0x1c3f2c){_0x1c3f2c=_0x1c3f2c||0xc8;return function(_0x16c801){if(_0x16c801){return _0x40c49f['status'](_0x1c3f2c)['json'](_0x16c801);}};}function respondWithFilteredResult(_0x58df1d,_0x5f3390){return function(_0x107bb8){if(_0x107bb8){var _0x2c022d=typeof _0x5f3390[_0xd48d('0x19')]===_0xd48d('0x1a')&&typeof _0x5f3390[_0xd48d('0x1b')]==='undefined';var _0x24e864=_0x107bb8[_0xd48d('0x1c')];var _0x368b6f=_0x2c022d?0x0:_0x5f3390[_0xd48d('0x19')];var _0x2c3d64=_0x2c022d?_0x107bb8['count']:_0x5f3390['offset']+_0x5f3390['limit'];var _0x46b502;if(_0x2c3d64>=_0x24e864){_0x2c3d64=_0x24e864;_0x46b502=0xc8;}else{_0x46b502=0xce;}_0x58df1d[_0xd48d('0x17')](_0x46b502);return _0x58df1d[_0xd48d('0x1d')](_0xd48d('0x1e'),_0x368b6f+'-'+_0x2c3d64+'/'+_0x24e864)[_0xd48d('0x1f')](_0x107bb8);}return null;};}function patchUpdates(_0x129817){return function(_0x34e13f){try{jsonpatch[_0xd48d('0x20')](_0x34e13f,_0x129817,!![]);}catch(_0x1c3af4){return BPromise[_0xd48d('0x21')](_0x1c3af4);}return _0x34e13f[_0xd48d('0x22')]();};}function saveUpdates(_0xb490f1,_0x19b8f7){return function(_0x55a4c4){if(_0x55a4c4){return _0x55a4c4[_0xd48d('0x23')](_0xb490f1)['then'](function(_0x1c8da2){return _0x1c8da2;});}return null;};}function removeEntity(_0x47ada1,_0x1c18a5){return function(_0x559ca2){if(_0x559ca2){return _0x559ca2[_0xd48d('0x24')]()[_0xd48d('0x25')](function(){_0x47ada1[_0xd48d('0x17')](0xcc)[_0xd48d('0x18')]();});}};}function handleEntityNotFound(_0x39c6f8,_0x2bc9ff){return function(_0x3d2c99){if(!_0x3d2c99){_0x39c6f8[_0xd48d('0x26')](0x194);}return _0x3d2c99;};}function handleError(_0x2cea0a,_0x349341){_0x349341=_0x349341||0x1f4;return function(_0x1ea47b){logger[_0xd48d('0x27')](_0x1ea47b[_0xd48d('0x28')]);if(_0x1ea47b[_0xd48d('0x29')]){delete _0x1ea47b[_0xd48d('0x29')];}_0x2cea0a[_0xd48d('0x17')](_0x349341)['send'](_0x1ea47b);};}exports[_0xd48d('0x2a')]=function(_0x115a34,_0x3602d6){var _0xf0f17={},_0x28b818={},_0xc744cc={'count':0x0,'rows':[]};var _0x6e5dcd=_['map'](db[_0xd48d('0x2b')]['rawAttributes'],function(_0x393c4b){return{'name':_0x393c4b[_0xd48d('0x2c')],'type':_0x393c4b['type']['key']};});_0x28b818[_0xd48d('0x2d')]=_[_0xd48d('0x2e')](_0x6e5dcd,_0xd48d('0x29'));_0x28b818[_0xd48d('0x2f')]=_[_0xd48d('0x30')](_0x115a34[_0xd48d('0x2f')]);_0x28b818[_0xd48d('0x31')]=_[_0xd48d('0x32')](_0x28b818['model'],_0x28b818[_0xd48d('0x2f')]);_0xf0f17[_0xd48d('0x33')]=_['intersection'](_0x28b818[_0xd48d('0x2d')],qs['fields'](_0x115a34[_0xd48d('0x2f')][_0xd48d('0x34')]));_0xf0f17[_0xd48d('0x33')]=_0xf0f17[_0xd48d('0x33')][_0xd48d('0x35')]?_0xf0f17[_0xd48d('0x33')]:_0x28b818[_0xd48d('0x2d')];if(!_0x115a34['query'][_0xd48d('0x36')](_0xd48d('0x37'))){_0xf0f17['limit']=qs['limit'](_0x115a34[_0xd48d('0x2f')][_0xd48d('0x1b')]);_0xf0f17[_0xd48d('0x19')]=qs[_0xd48d('0x19')](_0x115a34[_0xd48d('0x2f')][_0xd48d('0x19')]);}_0xf0f17[_0xd48d('0x38')]=qs['sort'](_0x115a34['query'][_0xd48d('0x39')]);_0xf0f17['where']=qs['filters'](_[_0xd48d('0x3a')](_0x115a34[_0xd48d('0x2f')],_0x28b818['filters']),_0x6e5dcd);if(_0x115a34[_0xd48d('0x2f')][_0xd48d('0x3b')]){_0xf0f17['where']=_[_0xd48d('0x3c')](_0xf0f17[_0xd48d('0x3d')],{'$or':_[_0xd48d('0x2e')](_0x6e5dcd,function(_0x520c7e){if(_0x520c7e[_0xd48d('0x3e')]!==_0xd48d('0x3f')){var _0x3449dc={};_0x3449dc[_0x520c7e[_0xd48d('0x29')]]={'$like':'%'+_0x115a34[_0xd48d('0x2f')]['filter']+'%'};return _0x3449dc;}})});}_0xf0f17=_[_0xd48d('0x3c')]({},_0xf0f17,_0x115a34['options']);var _0x4bc89d={'where':_0xf0f17[_0xd48d('0x3d')]};return db[_0xd48d('0x2b')][_0xd48d('0x1c')](_0x4bc89d)['then'](function(_0x1f7ab9){_0xc744cc[_0xd48d('0x1c')]=_0x1f7ab9;if(_0x115a34[_0xd48d('0x2f')]['includeAll']){_0xf0f17['include']=[{'all':!![]}];}return db[_0xd48d('0x2b')][_0xd48d('0x40')](_0xf0f17);})[_0xd48d('0x25')](function(_0x2d126c){_0xc744cc[_0xd48d('0x41')]=_0x2d126c;return _0xc744cc;})[_0xd48d('0x25')](respondWithFilteredResult(_0x3602d6,_0xf0f17))[_0xd48d('0x42')](handleError(_0x3602d6,null));};exports['show']=function(_0x4cb781,_0x437850){var _0x3e55d2={'raw':![],'where':{'id':_0x4cb781[_0xd48d('0x43')]['id']}},_0x1bfb2e={};_0x1bfb2e[_0xd48d('0x2d')]=_[_0xd48d('0x30')](db[_0xd48d('0x2b')]['rawAttributes']);_0x1bfb2e[_0xd48d('0x2f')]=_['keys'](_0x4cb781['query']);_0x1bfb2e[_0xd48d('0x31')]=_[_0xd48d('0x32')](_0x1bfb2e[_0xd48d('0x2d')],_0x1bfb2e['query']);_0x3e55d2[_0xd48d('0x33')]=_[_0xd48d('0x32')](_0x1bfb2e[_0xd48d('0x2d')],qs[_0xd48d('0x34')](_0x4cb781[_0xd48d('0x2f')][_0xd48d('0x34')]));_0x3e55d2[_0xd48d('0x33')]=_0x3e55d2[_0xd48d('0x33')][_0xd48d('0x35')]?_0x3e55d2[_0xd48d('0x33')]:_0x1bfb2e[_0xd48d('0x2d')];if(_0x4cb781[_0xd48d('0x2f')]['includeAll']){_0x3e55d2[_0xd48d('0x44')]=[{'all':!![]}];}_0x3e55d2=_[_0xd48d('0x3c')]({},_0x3e55d2,_0x4cb781['options']);return db[_0xd48d('0x2b')]['find'](_0x3e55d2)['then'](handleEntityNotFound(_0x437850,null))[_0xd48d('0x25')](respondWithResult(_0x437850,null))[_0xd48d('0x42')](handleError(_0x437850,null));};exports[_0xd48d('0x45')]=function(_0x486c95,_0x442aaf){return db['SugarcrmConfiguration'][_0xd48d('0x45')](_0x486c95['body'],{})[_0xd48d('0x25')](respondWithResult(_0x442aaf,0xc9))[_0xd48d('0x42')](handleError(_0x442aaf,null));};exports[_0xd48d('0x23')]=function(_0x14cd34,_0x11d1d3){if(_0x14cd34['body']['id']){delete _0x14cd34[_0xd48d('0x46')]['id'];}return db[_0xd48d('0x2b')][_0xd48d('0x47')]({'where':{'id':_0x14cd34[_0xd48d('0x43')]['id']}})[_0xd48d('0x25')](handleEntityNotFound(_0x11d1d3,null))[_0xd48d('0x25')](saveUpdates(_0x14cd34[_0xd48d('0x46')],null))[_0xd48d('0x25')](respondWithResult(_0x11d1d3,null))[_0xd48d('0x42')](handleError(_0x11d1d3,null));};exports[_0xd48d('0x24')]=function(_0x3aa6ac,_0x151320){return db[_0xd48d('0x2b')][_0xd48d('0x47')]({'where':{'id':_0x3aa6ac[_0xd48d('0x43')]['id']}})['then'](handleEntityNotFound(_0x151320,null))[_0xd48d('0x25')](removeEntity(_0x151320,null))[_0xd48d('0x42')](handleError(_0x151320,null));};exports[_0xd48d('0x48')]=function(_0x227e4c,_0x2e1072,_0x24b3f3){var _0x46f89f={};var _0x2ef522={};var _0x11d073;var _0x3b26ee;return db[_0xd48d('0x2b')][_0xd48d('0x49')]({'where':{'id':_0x227e4c[_0xd48d('0x43')]['id']}})[_0xd48d('0x25')](handleEntityNotFound(_0x2e1072,null))['then'](function(_0x47422d){if(_0x47422d){_0x11d073=_0x47422d;_0x2ef522[_0xd48d('0x2d')]=_[_0xd48d('0x30')](db[_0xd48d('0x4a')][_0xd48d('0x4b')]);_0x2ef522[_0xd48d('0x2f')]=_[_0xd48d('0x30')](_0x227e4c[_0xd48d('0x2f')]);_0x2ef522[_0xd48d('0x31')]=_['intersection'](_0x2ef522[_0xd48d('0x2d')],_0x2ef522[_0xd48d('0x2f')]);_0x46f89f[_0xd48d('0x33')]=_['intersection'](_0x2ef522[_0xd48d('0x2d')],qs[_0xd48d('0x34')](_0x227e4c['query']['fields']));_0x46f89f[_0xd48d('0x33')]=_0x46f89f[_0xd48d('0x33')][_0xd48d('0x35')]?_0x46f89f[_0xd48d('0x33')]:_0x2ef522[_0xd48d('0x2d')];_0x46f89f[_0xd48d('0x38')]=qs[_0xd48d('0x39')](_0x227e4c[_0xd48d('0x2f')][_0xd48d('0x39')]);_0x46f89f['where']=qs[_0xd48d('0x31')](_[_0xd48d('0x3a')](_0x227e4c[_0xd48d('0x2f')],_0x2ef522[_0xd48d('0x31')]));if(_0x227e4c[_0xd48d('0x2f')]['filter']){_0x46f89f[_0xd48d('0x3d')]=_[_0xd48d('0x3c')](_0x46f89f[_0xd48d('0x3d')],{'$or':_[_0xd48d('0x2e')](_0x46f89f[_0xd48d('0x33')],function(_0x226f62){var _0x533c21={};_0x533c21[_0x226f62]={'$like':'%'+_0x227e4c[_0xd48d('0x2f')][_0xd48d('0x3b')]+'%'};return _0x533c21;})});}_0x46f89f=_['merge']({},_0x46f89f,_0x227e4c[_0xd48d('0x4c')]);return _0x11d073['getFields'](_0x46f89f);}})['then'](function(_0x13d0db){if(_0x13d0db){_0x3b26ee=_0x13d0db[_0xd48d('0x35')];if(!_0x227e4c[_0xd48d('0x2f')][_0xd48d('0x36')](_0xd48d('0x37'))){_0x46f89f[_0xd48d('0x1b')]=qs[_0xd48d('0x1b')](_0x227e4c[_0xd48d('0x2f')]['limit']);_0x46f89f['offset']=qs['offset'](_0x227e4c[_0xd48d('0x2f')]['offset']);}return _0x11d073[_0xd48d('0x48')](_0x46f89f);}})[_0xd48d('0x25')](function(_0x59cc84){if(_0x59cc84){return _0x59cc84?{'count':_0x3b26ee,'rows':_0x59cc84}:null;}})['then'](respondWithResult(_0x2e1072,null))[_0xd48d('0x42')](handleError(_0x2e1072,null));};exports[_0xd48d('0x4d')]=function(_0x1a17f7,_0xc0f157,_0x4f1a09){var _0x39ce0a={};var _0x313ae0={};var _0x5a0efe;var _0xa41b3c;return db['SugarcrmConfiguration'][_0xd48d('0x49')]({'where':{'id':_0x1a17f7['params']['id']}})['then'](handleEntityNotFound(_0xc0f157,null))[_0xd48d('0x25')](function(_0x49654a){if(_0x49654a){_0x5a0efe=_0x49654a;_0x313ae0[_0xd48d('0x2d')]=_[_0xd48d('0x30')](db[_0xd48d('0x4a')][_0xd48d('0x4b')]);_0x313ae0['query']=_[_0xd48d('0x30')](_0x1a17f7[_0xd48d('0x2f')]);_0x313ae0[_0xd48d('0x31')]=_['intersection'](_0x313ae0[_0xd48d('0x2d')],_0x313ae0['query']);_0x39ce0a['attributes']=_[_0xd48d('0x32')](_0x313ae0[_0xd48d('0x2d')],qs[_0xd48d('0x34')](_0x1a17f7['query'][_0xd48d('0x34')]));_0x39ce0a[_0xd48d('0x33')]=_0x39ce0a[_0xd48d('0x33')][_0xd48d('0x35')]?_0x39ce0a[_0xd48d('0x33')]:_0x313ae0[_0xd48d('0x2d')];_0x39ce0a['order']=qs[_0xd48d('0x39')](_0x1a17f7[_0xd48d('0x2f')][_0xd48d('0x39')]);_0x39ce0a[_0xd48d('0x3d')]=qs[_0xd48d('0x31')](_[_0xd48d('0x3a')](_0x1a17f7['query'],_0x313ae0['filters']));if(_0x1a17f7[_0xd48d('0x2f')][_0xd48d('0x3b')]){_0x39ce0a['where']=_[_0xd48d('0x3c')](_0x39ce0a[_0xd48d('0x3d')],{'$or':_[_0xd48d('0x2e')](_0x39ce0a[_0xd48d('0x33')],function(_0x5bd6e1){var _0x368b4d={};_0x368b4d[_0x5bd6e1]={'$like':'%'+_0x1a17f7[_0xd48d('0x2f')]['filter']+'%'};return _0x368b4d;})});}_0x39ce0a=_[_0xd48d('0x3c')]({},_0x39ce0a,_0x1a17f7[_0xd48d('0x4c')]);return _0x5a0efe['getSubjects'](_0x39ce0a);}})[_0xd48d('0x25')](function(_0x2c7096){if(_0x2c7096){_0xa41b3c=_0x2c7096['length'];if(!_0x1a17f7[_0xd48d('0x2f')]['hasOwnProperty'](_0xd48d('0x37'))){_0x39ce0a[_0xd48d('0x1b')]=qs['limit'](_0x1a17f7[_0xd48d('0x2f')]['limit']);_0x39ce0a[_0xd48d('0x19')]=qs[_0xd48d('0x19')](_0x1a17f7['query']['offset']);}return _0x5a0efe[_0xd48d('0x4d')](_0x39ce0a);}})[_0xd48d('0x25')](function(_0x2e223d){if(_0x2e223d){return _0x2e223d?{'count':_0xa41b3c,'rows':_0x2e223d}:null;}})[_0xd48d('0x25')](respondWithResult(_0xc0f157,null))[_0xd48d('0x42')](handleError(_0xc0f157,null));};exports[_0xd48d('0x4e')]=function(_0x155cea,_0x412877,_0x26952f){var _0x1cdc81={};var _0x1cf44a={};var _0x4350a9;var _0x30e133;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x155cea[_0xd48d('0x43')]['id']}})[_0xd48d('0x25')](handleEntityNotFound(_0x412877,null))['then'](function(_0x2516c7){if(_0x2516c7){_0x4350a9=_0x2516c7;_0x1cf44a['model']=_[_0xd48d('0x30')](db[_0xd48d('0x4a')][_0xd48d('0x4b')]);_0x1cf44a[_0xd48d('0x2f')]=_[_0xd48d('0x30')](_0x155cea[_0xd48d('0x2f')]);_0x1cf44a[_0xd48d('0x31')]=_[_0xd48d('0x32')](_0x1cf44a[_0xd48d('0x2d')],_0x1cf44a['query']);_0x1cdc81[_0xd48d('0x33')]=_[_0xd48d('0x32')](_0x1cf44a[_0xd48d('0x2d')],qs[_0xd48d('0x34')](_0x155cea[_0xd48d('0x2f')][_0xd48d('0x34')]));_0x1cdc81['attributes']=_0x1cdc81[_0xd48d('0x33')][_0xd48d('0x35')]?_0x1cdc81['attributes']:_0x1cf44a[_0xd48d('0x2d')];_0x1cdc81[_0xd48d('0x38')]=qs[_0xd48d('0x39')](_0x155cea['query'][_0xd48d('0x39')]);_0x1cdc81[_0xd48d('0x3d')]=qs['filters'](_[_0xd48d('0x3a')](_0x155cea[_0xd48d('0x2f')],_0x1cf44a[_0xd48d('0x31')]));if(_0x155cea[_0xd48d('0x2f')][_0xd48d('0x3b')]){_0x1cdc81['where']=_[_0xd48d('0x3c')](_0x1cdc81[_0xd48d('0x3d')],{'$or':_['map'](_0x1cdc81['attributes'],function(_0xe885d6){var _0x58634f={};_0x58634f[_0xe885d6]={'$like':'%'+_0x155cea[_0xd48d('0x2f')][_0xd48d('0x3b')]+'%'};return _0x58634f;})});}_0x1cdc81=_[_0xd48d('0x3c')]({},_0x1cdc81,_0x155cea[_0xd48d('0x4c')]);return _0x4350a9[_0xd48d('0x4e')](_0x1cdc81);}})[_0xd48d('0x25')](function(_0x466181){if(_0x466181){_0x30e133=_0x466181[_0xd48d('0x35')];if(!_0x155cea['query'][_0xd48d('0x36')](_0xd48d('0x37'))){_0x1cdc81[_0xd48d('0x1b')]=qs[_0xd48d('0x1b')](_0x155cea['query']['limit']);_0x1cdc81[_0xd48d('0x19')]=qs[_0xd48d('0x19')](_0x155cea[_0xd48d('0x2f')][_0xd48d('0x19')]);}return _0x4350a9[_0xd48d('0x4e')](_0x1cdc81);}})[_0xd48d('0x25')](function(_0x2de35e){if(_0x2de35e){return _0x2de35e?{'count':_0x30e133,'rows':_0x2de35e}:null;}})[_0xd48d('0x25')](respondWithResult(_0x412877,null))[_0xd48d('0x42')](handleError(_0x412877,null));}; \ No newline at end of file +var _0xd8b8=['model','hasOwnProperty','nolimit','order','sort','where','filters','filter','includeAll','include','catch','show','params','keys','merge','options','find','create','body','findOne','SugarcrmField','pick','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','query','intersection','fields','attributes','length'];(function(_0xebb343,_0x83c689){var _0x5f34bb=function(_0x593c86){while(--_0x593c86){_0xebb343['push'](_0xebb343['shift']());}};_0x5f34bb(++_0x83c689);}(_0xd8b8,0x69));var _0x8d8b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd8b8[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d8b('0x0'));var zipdir=require(_0x8d8b('0x1'));var jsonpatch=require(_0x8d8b('0x2'));var rp=require(_0x8d8b('0x3'));var moment=require(_0x8d8b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d8b('0x5'));var util=require('util');var path=require(_0x8d8b('0x6'));var sox=require(_0x8d8b('0x7'));var csv=require(_0x8d8b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d8b('0x9'));var squel=require(_0x8d8b('0xa'));var crypto=require(_0x8d8b('0xb'));var jsforce=require(_0x8d8b('0xc'));var deskjs=require(_0x8d8b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d8b('0xe'));var Papa=require(_0x8d8b('0xf'));var Redis=require(_0x8d8b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8d8b('0x11'));var hardwareService=require(_0x8d8b('0x12'));var logger=require(_0x8d8b('0x13'))(_0x8d8b('0x14'));var utils=require(_0x8d8b('0x15'));var config=require(_0x8d8b('0x16'));var licenseUtil=require(_0x8d8b('0x17'));var db=require(_0x8d8b('0x18'))['db'];function respondWithStatusCode(_0x57f1a6,_0x13524e){_0x13524e=_0x13524e||0xcc;return function(_0x2cbba9){if(_0x2cbba9){return _0x57f1a6[_0x8d8b('0x19')](_0x13524e);}return _0x57f1a6['status'](_0x13524e)[_0x8d8b('0x1a')]();};}function respondWithResult(_0x242aa6,_0x5319ed){_0x5319ed=_0x5319ed||0xc8;return function(_0x56bcc0){if(_0x56bcc0){return _0x242aa6[_0x8d8b('0x1b')](_0x5319ed)[_0x8d8b('0x1c')](_0x56bcc0);}};}function respondWithFilteredResult(_0x574cf3,_0x4d443d){return function(_0x50003){if(_0x50003){var _0x1f1f51=typeof _0x4d443d[_0x8d8b('0x1d')]===_0x8d8b('0x1e')&&typeof _0x4d443d[_0x8d8b('0x1f')]===_0x8d8b('0x1e');var _0x358f3c=_0x50003[_0x8d8b('0x20')];var _0x5a402c=_0x1f1f51?0x0:_0x4d443d[_0x8d8b('0x1d')];var _0x252aca=_0x1f1f51?_0x50003[_0x8d8b('0x20')]:_0x4d443d['offset']+_0x4d443d[_0x8d8b('0x1f')];var _0x591a3c;if(_0x252aca>=_0x358f3c){_0x252aca=_0x358f3c;_0x591a3c=0xc8;}else{_0x591a3c=0xce;}_0x574cf3[_0x8d8b('0x1b')](_0x591a3c);return _0x574cf3[_0x8d8b('0x21')](_0x8d8b('0x22'),_0x5a402c+'-'+_0x252aca+'/'+_0x358f3c)[_0x8d8b('0x1c')](_0x50003);}return null;};}function patchUpdates(_0x5ae596){return function(_0xbc9122){try{jsonpatch[_0x8d8b('0x23')](_0xbc9122,_0x5ae596,!![]);}catch(_0x160048){return BPromise[_0x8d8b('0x24')](_0x160048);}return _0xbc9122[_0x8d8b('0x25')]();};}function saveUpdates(_0x5f0cd4,_0x3da7ca){return function(_0x3fd394){if(_0x3fd394){return _0x3fd394[_0x8d8b('0x26')](_0x5f0cd4)[_0x8d8b('0x27')](function(_0x4b9400){return _0x4b9400;});}return null;};}function removeEntity(_0x81c318,_0x24ea2b){return function(_0x22576b){if(_0x22576b){return _0x22576b[_0x8d8b('0x28')]()[_0x8d8b('0x27')](function(){_0x81c318[_0x8d8b('0x1b')](0xcc)[_0x8d8b('0x1a')]();});}};}function handleEntityNotFound(_0x29a889,_0x116783){return function(_0x486ecd){if(!_0x486ecd){_0x29a889[_0x8d8b('0x19')](0x194);}return _0x486ecd;};}function handleError(_0x365421,_0x1d8142){_0x1d8142=_0x1d8142||0x1f4;return function(_0x38ae54){logger['error'](_0x38ae54[_0x8d8b('0x29')]);if(_0x38ae54['name']){delete _0x38ae54[_0x8d8b('0x2a')];}_0x365421['status'](_0x1d8142)[_0x8d8b('0x2b')](_0x38ae54);};}exports[_0x8d8b('0x2c')]=function(_0x104260,_0x3d34f1){var _0x15afd5={},_0x1811f3={},_0x270fdc={'count':0x0,'rows':[]};var _0x2979f9=_[_0x8d8b('0x2d')](db[_0x8d8b('0x2e')][_0x8d8b('0x2f')],function(_0x1b733a){return{'name':_0x1b733a[_0x8d8b('0x30')],'type':_0x1b733a[_0x8d8b('0x31')]['key']};});_0x1811f3['model']=_[_0x8d8b('0x2d')](_0x2979f9,_0x8d8b('0x2a'));_0x1811f3[_0x8d8b('0x32')]=_['keys'](_0x104260[_0x8d8b('0x32')]);_0x1811f3['filters']=_[_0x8d8b('0x33')](_0x1811f3['model'],_0x1811f3[_0x8d8b('0x32')]);_0x15afd5['attributes']=_['intersection'](_0x1811f3['model'],qs[_0x8d8b('0x34')](_0x104260[_0x8d8b('0x32')][_0x8d8b('0x34')]));_0x15afd5[_0x8d8b('0x35')]=_0x15afd5[_0x8d8b('0x35')][_0x8d8b('0x36')]?_0x15afd5[_0x8d8b('0x35')]:_0x1811f3[_0x8d8b('0x37')];if(!_0x104260[_0x8d8b('0x32')][_0x8d8b('0x38')](_0x8d8b('0x39'))){_0x15afd5[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x104260[_0x8d8b('0x32')]['limit']);_0x15afd5[_0x8d8b('0x1d')]=qs[_0x8d8b('0x1d')](_0x104260[_0x8d8b('0x32')][_0x8d8b('0x1d')]);}_0x15afd5[_0x8d8b('0x3a')]=qs[_0x8d8b('0x3b')](_0x104260[_0x8d8b('0x32')]['sort']);_0x15afd5[_0x8d8b('0x3c')]=qs[_0x8d8b('0x3d')](_['pick'](_0x104260[_0x8d8b('0x32')],_0x1811f3['filters']),_0x2979f9);if(_0x104260[_0x8d8b('0x32')][_0x8d8b('0x3e')]){_0x15afd5[_0x8d8b('0x3c')]=_['merge'](_0x15afd5[_0x8d8b('0x3c')],{'$or':_[_0x8d8b('0x2d')](_0x2979f9,function(_0x1317ab){if(_0x1317ab[_0x8d8b('0x31')]!=='VIRTUAL'){var _0x22aae1={};_0x22aae1[_0x1317ab[_0x8d8b('0x2a')]]={'$like':'%'+_0x104260[_0x8d8b('0x32')][_0x8d8b('0x3e')]+'%'};return _0x22aae1;}})});}_0x15afd5=_['merge']({},_0x15afd5,_0x104260['options']);var _0x1c14e1={'where':_0x15afd5[_0x8d8b('0x3c')]};return db[_0x8d8b('0x2e')]['count'](_0x1c14e1)[_0x8d8b('0x27')](function(_0x559ef5){_0x270fdc['count']=_0x559ef5;if(_0x104260['query'][_0x8d8b('0x3f')]){_0x15afd5[_0x8d8b('0x40')]=[{'all':!![]}];}return db[_0x8d8b('0x2e')]['findAll'](_0x15afd5);})['then'](function(_0x321643){_0x270fdc['rows']=_0x321643;return _0x270fdc;})[_0x8d8b('0x27')](respondWithFilteredResult(_0x3d34f1,_0x15afd5))[_0x8d8b('0x41')](handleError(_0x3d34f1,null));};exports[_0x8d8b('0x42')]=function(_0x30261f,_0x3fb235){var _0x434c8a={'raw':![],'where':{'id':_0x30261f[_0x8d8b('0x43')]['id']}},_0x51213e={};_0x51213e[_0x8d8b('0x37')]=_[_0x8d8b('0x44')](db[_0x8d8b('0x2e')]['rawAttributes']);_0x51213e['query']=_['keys'](_0x30261f['query']);_0x51213e[_0x8d8b('0x3d')]=_[_0x8d8b('0x33')](_0x51213e[_0x8d8b('0x37')],_0x51213e[_0x8d8b('0x32')]);_0x434c8a[_0x8d8b('0x35')]=_['intersection'](_0x51213e[_0x8d8b('0x37')],qs[_0x8d8b('0x34')](_0x30261f[_0x8d8b('0x32')][_0x8d8b('0x34')]));_0x434c8a[_0x8d8b('0x35')]=_0x434c8a['attributes']['length']?_0x434c8a['attributes']:_0x51213e[_0x8d8b('0x37')];if(_0x30261f[_0x8d8b('0x32')][_0x8d8b('0x3f')]){_0x434c8a['include']=[{'all':!![]}];}_0x434c8a=_[_0x8d8b('0x45')]({},_0x434c8a,_0x30261f[_0x8d8b('0x46')]);return db['SugarcrmConfiguration'][_0x8d8b('0x47')](_0x434c8a)[_0x8d8b('0x27')](handleEntityNotFound(_0x3fb235,null))['then'](respondWithResult(_0x3fb235,null))[_0x8d8b('0x41')](handleError(_0x3fb235,null));};exports[_0x8d8b('0x48')]=function(_0x52b66b,_0x2660b9){return db[_0x8d8b('0x2e')][_0x8d8b('0x48')](_0x52b66b[_0x8d8b('0x49')],{})[_0x8d8b('0x27')](respondWithResult(_0x2660b9,0xc9))[_0x8d8b('0x41')](handleError(_0x2660b9,null));};exports['update']=function(_0x5d14a2,_0x562b81){if(_0x5d14a2['body']['id']){delete _0x5d14a2[_0x8d8b('0x49')]['id'];}return db[_0x8d8b('0x2e')]['find']({'where':{'id':_0x5d14a2['params']['id']}})[_0x8d8b('0x27')](handleEntityNotFound(_0x562b81,null))[_0x8d8b('0x27')](saveUpdates(_0x5d14a2[_0x8d8b('0x49')],null))['then'](respondWithResult(_0x562b81,null))[_0x8d8b('0x41')](handleError(_0x562b81,null));};exports['destroy']=function(_0x5141fd,_0x374ebb){return db[_0x8d8b('0x2e')]['find']({'where':{'id':_0x5141fd['params']['id']}})[_0x8d8b('0x27')](handleEntityNotFound(_0x374ebb,null))[_0x8d8b('0x27')](removeEntity(_0x374ebb,null))[_0x8d8b('0x41')](handleError(_0x374ebb,null));};exports['getFields']=function(_0x357ea4,_0x53a77b,_0x3e0638){var _0x122629={};var _0x2c7707={};var _0x1d61d2;var _0x3fdd84;return db[_0x8d8b('0x2e')][_0x8d8b('0x4a')]({'where':{'id':_0x357ea4[_0x8d8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x53a77b,null))[_0x8d8b('0x27')](function(_0x2cdbf2){if(_0x2cdbf2){_0x1d61d2=_0x2cdbf2;_0x2c7707['model']=_[_0x8d8b('0x44')](db[_0x8d8b('0x4b')]['rawAttributes']);_0x2c7707[_0x8d8b('0x32')]=_['keys'](_0x357ea4[_0x8d8b('0x32')]);_0x2c7707[_0x8d8b('0x3d')]=_['intersection'](_0x2c7707['model'],_0x2c7707[_0x8d8b('0x32')]);_0x122629[_0x8d8b('0x35')]=_[_0x8d8b('0x33')](_0x2c7707[_0x8d8b('0x37')],qs[_0x8d8b('0x34')](_0x357ea4[_0x8d8b('0x32')][_0x8d8b('0x34')]));_0x122629[_0x8d8b('0x35')]=_0x122629[_0x8d8b('0x35')][_0x8d8b('0x36')]?_0x122629[_0x8d8b('0x35')]:_0x2c7707['model'];_0x122629[_0x8d8b('0x3a')]=qs[_0x8d8b('0x3b')](_0x357ea4[_0x8d8b('0x32')][_0x8d8b('0x3b')]);_0x122629[_0x8d8b('0x3c')]=qs[_0x8d8b('0x3d')](_[_0x8d8b('0x4c')](_0x357ea4[_0x8d8b('0x32')],_0x2c7707[_0x8d8b('0x3d')]));if(_0x357ea4['query']['filter']){_0x122629[_0x8d8b('0x3c')]=_[_0x8d8b('0x45')](_0x122629[_0x8d8b('0x3c')],{'$or':_[_0x8d8b('0x2d')](_0x122629[_0x8d8b('0x35')],function(_0x4615b0){var _0x3bbaf1={};_0x3bbaf1[_0x4615b0]={'$like':'%'+_0x357ea4[_0x8d8b('0x32')]['filter']+'%'};return _0x3bbaf1;})});}_0x122629=_[_0x8d8b('0x45')]({},_0x122629,_0x357ea4[_0x8d8b('0x46')]);return _0x1d61d2[_0x8d8b('0x4d')](_0x122629);}})[_0x8d8b('0x27')](function(_0x56d2ba){if(_0x56d2ba){_0x3fdd84=_0x56d2ba[_0x8d8b('0x36')];if(!_0x357ea4['query'][_0x8d8b('0x38')](_0x8d8b('0x39'))){_0x122629[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x357ea4[_0x8d8b('0x32')][_0x8d8b('0x1f')]);_0x122629[_0x8d8b('0x1d')]=qs['offset'](_0x357ea4[_0x8d8b('0x32')][_0x8d8b('0x1d')]);}return _0x1d61d2[_0x8d8b('0x4d')](_0x122629);}})[_0x8d8b('0x27')](function(_0x4efee6){if(_0x4efee6){return _0x4efee6?{'count':_0x3fdd84,'rows':_0x4efee6}:null;}})['then'](respondWithResult(_0x53a77b,null))[_0x8d8b('0x41')](handleError(_0x53a77b,null));};exports[_0x8d8b('0x4e')]=function(_0x7d319,_0x535796,_0x59a7f2){var _0xe1243e={};var _0x1900a2={};var _0x59615b;var _0x5a3fff;return db[_0x8d8b('0x2e')][_0x8d8b('0x4a')]({'where':{'id':_0x7d319['params']['id']}})['then'](handleEntityNotFound(_0x535796,null))['then'](function(_0x4e209a){if(_0x4e209a){_0x59615b=_0x4e209a;_0x1900a2[_0x8d8b('0x37')]=_[_0x8d8b('0x44')](db[_0x8d8b('0x4b')][_0x8d8b('0x2f')]);_0x1900a2[_0x8d8b('0x32')]=_['keys'](_0x7d319[_0x8d8b('0x32')]);_0x1900a2[_0x8d8b('0x3d')]=_['intersection'](_0x1900a2['model'],_0x1900a2[_0x8d8b('0x32')]);_0xe1243e[_0x8d8b('0x35')]=_[_0x8d8b('0x33')](_0x1900a2[_0x8d8b('0x37')],qs[_0x8d8b('0x34')](_0x7d319[_0x8d8b('0x32')][_0x8d8b('0x34')]));_0xe1243e[_0x8d8b('0x35')]=_0xe1243e['attributes'][_0x8d8b('0x36')]?_0xe1243e[_0x8d8b('0x35')]:_0x1900a2['model'];_0xe1243e[_0x8d8b('0x3a')]=qs['sort'](_0x7d319[_0x8d8b('0x32')][_0x8d8b('0x3b')]);_0xe1243e[_0x8d8b('0x3c')]=qs[_0x8d8b('0x3d')](_[_0x8d8b('0x4c')](_0x7d319[_0x8d8b('0x32')],_0x1900a2[_0x8d8b('0x3d')]));if(_0x7d319[_0x8d8b('0x32')][_0x8d8b('0x3e')]){_0xe1243e[_0x8d8b('0x3c')]=_[_0x8d8b('0x45')](_0xe1243e['where'],{'$or':_[_0x8d8b('0x2d')](_0xe1243e['attributes'],function(_0x6b709){var _0xf04e5e={};_0xf04e5e[_0x6b709]={'$like':'%'+_0x7d319[_0x8d8b('0x32')]['filter']+'%'};return _0xf04e5e;})});}_0xe1243e=_[_0x8d8b('0x45')]({},_0xe1243e,_0x7d319[_0x8d8b('0x46')]);return _0x59615b[_0x8d8b('0x4e')](_0xe1243e);}})['then'](function(_0x337154){if(_0x337154){_0x5a3fff=_0x337154[_0x8d8b('0x36')];if(!_0x7d319[_0x8d8b('0x32')][_0x8d8b('0x38')](_0x8d8b('0x39'))){_0xe1243e[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x7d319[_0x8d8b('0x32')][_0x8d8b('0x1f')]);_0xe1243e['offset']=qs[_0x8d8b('0x1d')](_0x7d319['query']['offset']);}return _0x59615b[_0x8d8b('0x4e')](_0xe1243e);}})[_0x8d8b('0x27')](function(_0x2be270){if(_0x2be270){return _0x2be270?{'count':_0x5a3fff,'rows':_0x2be270}:null;}})[_0x8d8b('0x27')](respondWithResult(_0x535796,null))[_0x8d8b('0x41')](handleError(_0x535796,null));};exports[_0x8d8b('0x4f')]=function(_0x1ae92e,_0x2e7275,_0x50ee2e){var _0x34c38b={};var _0x4ba1f2={};var _0x273c62;var _0x52b5f2;return db[_0x8d8b('0x2e')][_0x8d8b('0x4a')]({'where':{'id':_0x1ae92e[_0x8d8b('0x43')]['id']}})[_0x8d8b('0x27')](handleEntityNotFound(_0x2e7275,null))['then'](function(_0x3a485b){if(_0x3a485b){_0x273c62=_0x3a485b;_0x4ba1f2[_0x8d8b('0x37')]=_['keys'](db[_0x8d8b('0x4b')]['rawAttributes']);_0x4ba1f2[_0x8d8b('0x32')]=_['keys'](_0x1ae92e[_0x8d8b('0x32')]);_0x4ba1f2[_0x8d8b('0x3d')]=_[_0x8d8b('0x33')](_0x4ba1f2[_0x8d8b('0x37')],_0x4ba1f2[_0x8d8b('0x32')]);_0x34c38b[_0x8d8b('0x35')]=_[_0x8d8b('0x33')](_0x4ba1f2[_0x8d8b('0x37')],qs['fields'](_0x1ae92e[_0x8d8b('0x32')][_0x8d8b('0x34')]));_0x34c38b[_0x8d8b('0x35')]=_0x34c38b[_0x8d8b('0x35')][_0x8d8b('0x36')]?_0x34c38b[_0x8d8b('0x35')]:_0x4ba1f2[_0x8d8b('0x37')];_0x34c38b['order']=qs[_0x8d8b('0x3b')](_0x1ae92e[_0x8d8b('0x32')][_0x8d8b('0x3b')]);_0x34c38b[_0x8d8b('0x3c')]=qs[_0x8d8b('0x3d')](_[_0x8d8b('0x4c')](_0x1ae92e[_0x8d8b('0x32')],_0x4ba1f2[_0x8d8b('0x3d')]));if(_0x1ae92e['query'][_0x8d8b('0x3e')]){_0x34c38b['where']=_[_0x8d8b('0x45')](_0x34c38b[_0x8d8b('0x3c')],{'$or':_[_0x8d8b('0x2d')](_0x34c38b[_0x8d8b('0x35')],function(_0x3776f5){var _0x3e25fc={};_0x3e25fc[_0x3776f5]={'$like':'%'+_0x1ae92e[_0x8d8b('0x32')][_0x8d8b('0x3e')]+'%'};return _0x3e25fc;})});}_0x34c38b=_[_0x8d8b('0x45')]({},_0x34c38b,_0x1ae92e[_0x8d8b('0x46')]);return _0x273c62[_0x8d8b('0x4f')](_0x34c38b);}})['then'](function(_0x492ec1){if(_0x492ec1){_0x52b5f2=_0x492ec1['length'];if(!_0x1ae92e['query'][_0x8d8b('0x38')](_0x8d8b('0x39'))){_0x34c38b[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x1ae92e[_0x8d8b('0x32')][_0x8d8b('0x1f')]);_0x34c38b[_0x8d8b('0x1d')]=qs[_0x8d8b('0x1d')](_0x1ae92e['query'][_0x8d8b('0x1d')]);}return _0x273c62['getDescriptions'](_0x34c38b);}})[_0x8d8b('0x27')](function(_0x40e539){if(_0x40e539){return _0x40e539?{'count':_0x52b5f2,'rows':_0x40e539}:null;}})[_0x8d8b('0x27')](respondWithResult(_0x2e7275,null))['catch'](handleError(_0x2e7275,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b4b5f4e..3d4a293 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 _0x8706=['moment','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger'];(function(_0x165a91,_0x13fb90){var _0x22ab34=function(_0x3ac9ee){while(--_0x3ac9ee){_0x165a91['push'](_0x165a91['shift']());}};_0x22ab34(++_0x13fb90);}(_0x8706,0x15c));var _0x6870=function(_0x1d0d2b,_0x41539b){_0x1d0d2b=_0x1d0d2b-0x0;var _0x32f442=_0x8706[_0x1d0d2b];return _0x32f442;};'use strict';var _=require(_0x6870('0x0'));var util=require('util');var logger=require(_0x6870('0x1'))('api');var moment=require(_0x6870('0x2'));var BPromise=require('bluebird');var rp=require(_0x6870('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6870('0x4'));var config=require(_0x6870('0x5'));var attributes=require(_0x6870('0x6'));module[_0x6870('0x7')]=function(_0x166697,_0x503996){return _0x166697['define'](_0x6870('0x8'),attributes,{'tableName':_0x6870('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf110=['api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf110,0x1b7));var _0x0f11=function(_0x324fe8,_0x1ccb46){_0x324fe8=_0x324fe8-0x0;var _0x4a1cd9=_0xf110[_0x324fe8];return _0x4a1cd9;};'use strict';var _=require('lodash');var util=require(_0x0f11('0x0'));var logger=require(_0x0f11('0x1'))(_0x0f11('0x2'));var moment=require(_0x0f11('0x3'));var BPromise=require(_0x0f11('0x4'));var rp=require(_0x0f11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f11('0x6'));module[_0x0f11('0x7')]=function(_0xae2daa,_0x381f1a){return _0xae2daa['define']('SugarcrmConfiguration',attributes,{'tableName':_0x0f11('0x8'),'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 287d1dc..dbd29ac 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 _0xd92f=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4fa1b0,_0x3cafac){var _0x3c2e33=function(_0xee1347){while(--_0xee1347){_0x4fa1b0['push'](_0x4fa1b0['shift']());}};_0x3c2e33(++_0x3cafac);}(_0xd92f,0x9a));var _0xfd92=function(_0x2a5fa2,_0xbea136){_0x2a5fa2=_0x2a5fa2-0x0;var _0x26a13b=_0xd92f[_0x2a5fa2];return _0x26a13b;};'use strict';var _=require(_0xfd92('0x0'));var util=require(_0xfd92('0x1'));var moment=require('moment');var BPromise=require(_0xfd92('0x2'));var rs=require(_0xfd92('0x3'));var fs=require('fs');var Redis=require(_0xfd92('0x4'));var db=require(_0xfd92('0x5'))['db'];var utils=require(_0xfd92('0x6'));var logger=require(_0xfd92('0x7'))(_0xfd92('0x8'));var config=require(_0xfd92('0x9'));var jayson=require(_0xfd92('0xa'));var client=jayson[_0xfd92('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x87e063,_0x5cb169,_0xf4b367){return new BPromise(function(_0x5df451,_0xcd057f){return client[_0xfd92('0xc')](_0x87e063,_0xf4b367)[_0xfd92('0xd')](function(_0x266269){logger[_0xfd92('0xe')](_0xfd92('0xf'),_0x5cb169,_0xfd92('0x10'));logger['debug'](_0xfd92('0x11'),_0x5cb169,_0xfd92('0x10'),JSON[_0xfd92('0x12')](_0x266269));if(_0x266269[_0xfd92('0x13')]){if(_0x266269[_0xfd92('0x13')][_0xfd92('0x14')]===0x1f4){logger[_0xfd92('0x13')](_0xfd92('0xf'),_0x5cb169,_0x266269[_0xfd92('0x13')][_0xfd92('0x15')]);return _0xcd057f(_0x266269[_0xfd92('0x13')][_0xfd92('0x15')]);}logger['error'](_0xfd92('0xf'),_0x5cb169,_0x266269[_0xfd92('0x13')][_0xfd92('0x15')]);return _0x5df451(_0x266269[_0xfd92('0x13')][_0xfd92('0x15')]);}else{logger[_0xfd92('0xe')](_0xfd92('0xf'),_0x5cb169,_0xfd92('0x10'));_0x5df451(_0x266269[_0xfd92('0x16')]['message']);}})[_0xfd92('0x17')](function(_0x429d8e){logger[_0xfd92('0x13')](_0xfd92('0xf'),_0x5cb169,_0x429d8e);_0xcd057f(_0x429d8e);});});} \ No newline at end of file +var _0x8547=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','code','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x8547,0x1c0));var _0x7854=function(_0x58d7d6,_0x42b396){_0x58d7d6=_0x58d7d6-0x0;var _0x5546ed=_0x8547[_0x58d7d6];return _0x5546ed;};'use strict';var _=require(_0x7854('0x0'));var util=require('util');var moment=require(_0x7854('0x1'));var BPromise=require(_0x7854('0x2'));var rs=require(_0x7854('0x3'));var fs=require('fs');var Redis=require(_0x7854('0x4'));var db=require(_0x7854('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7854('0x6'))(_0x7854('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7854('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13046e,_0x2a6fff,_0x2b8dfe){return new BPromise(function(_0x28603e,_0x24bd7c){return client[_0x7854('0x9')](_0x13046e,_0x2b8dfe)[_0x7854('0xa')](function(_0x4ef88b){logger[_0x7854('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a6fff,_0x7854('0xc'));logger[_0x7854('0xd')](_0x7854('0xe'),_0x2a6fff,_0x7854('0xc'),JSON['stringify'](_0x4ef88b));if(_0x4ef88b['error']){if(_0x4ef88b['error'][_0x7854('0xf')]===0x1f4){logger[_0x7854('0x10')](_0x7854('0x11'),_0x2a6fff,_0x4ef88b[_0x7854('0x10')][_0x7854('0x12')]);return _0x24bd7c(_0x4ef88b[_0x7854('0x10')][_0x7854('0x12')]);}logger[_0x7854('0x10')](_0x7854('0x11'),_0x2a6fff,_0x4ef88b[_0x7854('0x10')][_0x7854('0x12')]);return _0x28603e(_0x4ef88b[_0x7854('0x10')][_0x7854('0x12')]);}else{logger[_0x7854('0xb')](_0x7854('0x11'),_0x2a6fff,'request\x20sent');_0x28603e(_0x4ef88b[_0x7854('0x13')][_0x7854('0x12')]);}})[_0x7854('0x14')](function(_0x5c4597){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a6fff,_0x5c4597);_0x24bd7c(_0x5c4597);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4a02238..a8fde6d 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 _0x23a0=['destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','get','/:id','isAuthenticated','post','create','put','delete'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x23a0,0x157));var _0x023a=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x23a0[_0x1b5aea];return _0x51cae9;};'use strict';var multer=require(_0x023a('0x0'));var util=require(_0x023a('0x1'));var path=require(_0x023a('0x2'));var timeout=require(_0x023a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x023a('0x4'));var auth=require(_0x023a('0x5'));var interaction=require(_0x023a('0x6'));var config=require(_0x023a('0x7'));var controller=require(_0x023a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x023a('0x9')]);router[_0x023a('0xa')](_0x023a('0xb'),auth[_0x023a('0xc')](),controller['show']);router[_0x023a('0xd')]('/',auth[_0x023a('0xc')](),controller[_0x023a('0xe')]);router[_0x023a('0xf')](_0x023a('0xb'),auth[_0x023a('0xc')](),controller['update']);router[_0x023a('0x10')](_0x023a('0xb'),auth['isAuthenticated'](),controller[_0x023a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcb3c=['post','create','put','isAuthenticated','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','show'];(function(_0x13c453,_0x450b72){var _0x586126=function(_0x455f9a){while(--_0x455f9a){_0x13c453['push'](_0x13c453['shift']());}};_0x586126(++_0x450b72);}(_0xcb3c,0x114));var _0xccb3=function(_0x54f322,_0x24a660){_0x54f322=_0x54f322-0x0;var _0xb0a1d5=_0xcb3c[_0x54f322];return _0xb0a1d5;};'use strict';var multer=require(_0xccb3('0x0'));var util=require(_0xccb3('0x1'));var path=require(_0xccb3('0x2'));var timeout=require(_0xccb3('0x3'));var express=require(_0xccb3('0x4'));var router=express['Router']();var fs_extra=require(_0xccb3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xccb3('0x6'));var config=require(_0xccb3('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xccb3('0x8')]('/',auth['isAuthenticated'](),controller[_0xccb3('0x9')]);router[_0xccb3('0x8')](_0xccb3('0xa'),auth['isAuthenticated'](),controller[_0xccb3('0xb')]);router[_0xccb3('0xc')]('/',auth['isAuthenticated'](),controller[_0xccb3('0xd')]);router[_0xccb3('0xe')](_0xccb3('0xa'),auth[_0xccb3('0xf')](),controller[_0xccb3('0x10')]);router[_0xccb3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8c361e1..39dd824 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 _0x7d75=['variable','BOOLEAN','sequelize','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3a4aeb,_0x12840c){var _0x5c0c01=function(_0x249ff1){while(--_0x249ff1){_0x3a4aeb['push'](_0x3a4aeb['shift']());}};_0x5c0c01(++_0x12840c);}(_0x7d75,0x1bb));var _0x57d7=function(_0x5d4aa4,_0x2eda02){_0x5d4aa4=_0x5d4aa4-0x0;var _0x2ad047=_0x7d75[_0x5d4aa4];return _0x2ad047;};'use strict';var Sequelize=require(_0x57d7('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x57d7('0x1'),'variable',_0x57d7('0x2'),_0x57d7('0x3'),_0x57d7('0x4')),'defaultValue':_0x57d7('0x1')},'content':{'type':Sequelize[_0x57d7('0x5')]},'key':{'type':Sequelize[_0x57d7('0x5')]},'keyType':{'type':Sequelize[_0x57d7('0x6')]('string',_0x57d7('0x7'),_0x57d7('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x57d7('0x5')]},'customField':{'type':Sequelize[_0x57d7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x57d7('0x5')]}}; \ No newline at end of file +var _0x0782=['string','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x2efdb8,_0xf20b4a){var _0x4ab05c=function(_0x1217db){while(--_0x1217db){_0x2efdb8['push'](_0x2efdb8['shift']());}};_0x4ab05c(++_0xf20b4a);}(_0x0782,0x1be));var _0x2078=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x0782[_0x25248b];return _0x509939;};'use strict';var Sequelize=require(_0x2078('0x0'));module['exports']={'type':{'type':Sequelize[_0x2078('0x1')](_0x2078('0x2'),'variable','customVariable',_0x2078('0x3'),_0x2078('0x4')),'defaultValue':_0x2078('0x2')},'content':{'type':Sequelize[_0x2078('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2078('0x2'),_0x2078('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x2078('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2078('0x5')]},'customField':{'type':Sequelize[_0x2078('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2078('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 483d69c..2864b80 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 _0x3e44=['pick','filter','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','end','sendStatus','error','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where'];(function(_0x535b22,_0x18fa76){var _0x4531a5=function(_0x400123){while(--_0x400123){_0x535b22['push'](_0x535b22['shift']());}};_0x4531a5(++_0x18fa76);}(_0x3e44,0x172));var _0x43e4=function(_0x114808,_0x10b2a7){_0x114808=_0x114808-0x0;var _0xd80838=_0x3e44[_0x114808];return _0xd80838;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43e4('0x0'));var zipdir=require(_0x43e4('0x1'));var jsonpatch=require(_0x43e4('0x2'));var rp=require('request-promise');var moment=require(_0x43e4('0x3'));var BPromise=require(_0x43e4('0x4'));var Mustache=require('mustache');var util=require(_0x43e4('0x5'));var path=require(_0x43e4('0x6'));var sox=require('sox');var csv=require(_0x43e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43e4('0x8'));var _=require(_0x43e4('0x9'));var squel=require(_0x43e4('0xa'));var crypto=require(_0x43e4('0xb'));var jsforce=require(_0x43e4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x43e4('0x7'));var querystring=require('querystring');var Papa=require(_0x43e4('0xd'));var Redis=require(_0x43e4('0xe'));var authService=require(_0x43e4('0xf'));var qs=require(_0x43e4('0x10'));var as=require(_0x43e4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e4('0x12'))(_0x43e4('0x13'));var utils=require(_0x43e4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x43e4('0x15'));var db=require(_0x43e4('0x16'))['db'];function respondWithStatusCode(_0x5f104f,_0x19273c){_0x19273c=_0x19273c||0xcc;return function(_0x1a5049){if(_0x1a5049){return _0x5f104f['sendStatus'](_0x19273c);}return _0x5f104f[_0x43e4('0x17')](_0x19273c)['end']();};}function respondWithResult(_0x188b7f,_0x10858e){_0x10858e=_0x10858e||0xc8;return function(_0x2abe86){if(_0x2abe86){return _0x188b7f['status'](_0x10858e)[_0x43e4('0x18')](_0x2abe86);}};}function respondWithFilteredResult(_0x24f8c3,_0x5b3063){return function(_0x18451c){if(_0x18451c){var _0x14c071=typeof _0x5b3063[_0x43e4('0x19')]===_0x43e4('0x1a')&&typeof _0x5b3063['limit']===_0x43e4('0x1a');var _0xfb0366=_0x18451c[_0x43e4('0x1b')];var _0x4f2cfe=_0x14c071?0x0:_0x5b3063['offset'];var _0xd35567=_0x14c071?_0x18451c[_0x43e4('0x1b')]:_0x5b3063[_0x43e4('0x19')]+_0x5b3063[_0x43e4('0x1c')];var _0x55ec2b;if(_0xd35567>=_0xfb0366){_0xd35567=_0xfb0366;_0x55ec2b=0xc8;}else{_0x55ec2b=0xce;}_0x24f8c3[_0x43e4('0x17')](_0x55ec2b);return _0x24f8c3[_0x43e4('0x1d')](_0x43e4('0x1e'),_0x4f2cfe+'-'+_0xd35567+'/'+_0xfb0366)['json'](_0x18451c);}return null;};}function patchUpdates(_0x4c85b2){return function(_0x4c16a1){try{jsonpatch[_0x43e4('0x1f')](_0x4c16a1,_0x4c85b2,!![]);}catch(_0x56de46){return BPromise[_0x43e4('0x20')](_0x56de46);}return _0x4c16a1['save']();};}function saveUpdates(_0xd515b8,_0x57775e){return function(_0x9db1e4){if(_0x9db1e4){return _0x9db1e4['update'](_0xd515b8)[_0x43e4('0x21')](function(_0x18e6dc){return _0x18e6dc;});}return null;};}function removeEntity(_0x150b55,_0x219107){return function(_0x23bbcc){if(_0x23bbcc){return _0x23bbcc['destroy']()[_0x43e4('0x21')](function(){_0x150b55[_0x43e4('0x17')](0xcc)[_0x43e4('0x22')]();});}};}function handleEntityNotFound(_0x305af5,_0x32ccab){return function(_0x218576){if(!_0x218576){_0x305af5[_0x43e4('0x23')](0x194);}return _0x218576;};}function handleError(_0x1ac428,_0x2c52eb){_0x2c52eb=_0x2c52eb||0x1f4;return function(_0xe6355b){logger[_0x43e4('0x24')](_0xe6355b['stack']);if(_0xe6355b['name']){delete _0xe6355b[_0x43e4('0x25')];}_0x1ac428[_0x43e4('0x17')](_0x2c52eb)[_0x43e4('0x26')](_0xe6355b);};}exports[_0x43e4('0x27')]=function(_0x23cdcc,_0x20f0e1){var _0x52567d={},_0x5b465b={},_0x18be0c={'count':0x0,'rows':[]};var _0x5240f9=_[_0x43e4('0x28')](db[_0x43e4('0x29')][_0x43e4('0x2a')],function(_0x2d2513){return{'name':_0x2d2513['fieldName'],'type':_0x2d2513[_0x43e4('0x2b')][_0x43e4('0x2c')]};});_0x5b465b[_0x43e4('0x2d')]=_[_0x43e4('0x28')](_0x5240f9,_0x43e4('0x25'));_0x5b465b[_0x43e4('0x2e')]=_[_0x43e4('0x2f')](_0x23cdcc[_0x43e4('0x2e')]);_0x5b465b[_0x43e4('0x30')]=_[_0x43e4('0x31')](_0x5b465b['model'],_0x5b465b['query']);_0x52567d[_0x43e4('0x32')]=_['intersection'](_0x5b465b[_0x43e4('0x2d')],qs['fields'](_0x23cdcc[_0x43e4('0x2e')]['fields']));_0x52567d[_0x43e4('0x32')]=_0x52567d[_0x43e4('0x32')][_0x43e4('0x33')]?_0x52567d['attributes']:_0x5b465b['model'];if(!_0x23cdcc[_0x43e4('0x2e')]['hasOwnProperty'](_0x43e4('0x34'))){_0x52567d['limit']=qs[_0x43e4('0x1c')](_0x23cdcc[_0x43e4('0x2e')][_0x43e4('0x1c')]);_0x52567d['offset']=qs[_0x43e4('0x19')](_0x23cdcc['query'][_0x43e4('0x19')]);}_0x52567d[_0x43e4('0x35')]=qs['sort'](_0x23cdcc[_0x43e4('0x2e')][_0x43e4('0x36')]);_0x52567d[_0x43e4('0x37')]=qs['filters'](_[_0x43e4('0x38')](_0x23cdcc[_0x43e4('0x2e')],_0x5b465b[_0x43e4('0x30')]),_0x5240f9);if(_0x23cdcc[_0x43e4('0x2e')][_0x43e4('0x39')]){_0x52567d[_0x43e4('0x37')]=_[_0x43e4('0x3a')](_0x52567d['where'],{'$or':_[_0x43e4('0x28')](_0x5240f9,function(_0x508177){if(_0x508177[_0x43e4('0x2b')]!=='VIRTUAL'){var _0x5bb5a5={};_0x5bb5a5[_0x508177[_0x43e4('0x25')]]={'$like':'%'+_0x23cdcc[_0x43e4('0x2e')][_0x43e4('0x39')]+'%'};return _0x5bb5a5;}})});}_0x52567d=_[_0x43e4('0x3a')]({},_0x52567d,_0x23cdcc[_0x43e4('0x3b')]);var _0x3a1495={'where':_0x52567d['where']};return db[_0x43e4('0x29')][_0x43e4('0x1b')](_0x3a1495)[_0x43e4('0x21')](function(_0x2c5ff9){_0x18be0c[_0x43e4('0x1b')]=_0x2c5ff9;if(_0x23cdcc[_0x43e4('0x2e')][_0x43e4('0x3c')]){_0x52567d[_0x43e4('0x3d')]=[{'all':!![]}];}return db[_0x43e4('0x29')]['findAll'](_0x52567d);})[_0x43e4('0x21')](function(_0x2f814e){_0x18be0c[_0x43e4('0x3e')]=_0x2f814e;return _0x18be0c;})[_0x43e4('0x21')](respondWithFilteredResult(_0x20f0e1,_0x52567d))[_0x43e4('0x3f')](handleError(_0x20f0e1,null));};exports[_0x43e4('0x40')]=function(_0x435d29,_0x5db584){var _0x51feea={'raw':!![],'where':{'id':_0x435d29[_0x43e4('0x41')]['id']}},_0xb6dd27={};_0xb6dd27['model']=_[_0x43e4('0x2f')](db['SugarcrmField'][_0x43e4('0x2a')]);_0xb6dd27[_0x43e4('0x2e')]=_['keys'](_0x435d29[_0x43e4('0x2e')]);_0xb6dd27[_0x43e4('0x30')]=_[_0x43e4('0x31')](_0xb6dd27['model'],_0xb6dd27['query']);_0x51feea[_0x43e4('0x32')]=_[_0x43e4('0x31')](_0xb6dd27[_0x43e4('0x2d')],qs['fields'](_0x435d29[_0x43e4('0x2e')][_0x43e4('0x42')]));_0x51feea[_0x43e4('0x32')]=_0x51feea[_0x43e4('0x32')][_0x43e4('0x33')]?_0x51feea[_0x43e4('0x32')]:_0xb6dd27[_0x43e4('0x2d')];if(_0x435d29[_0x43e4('0x2e')]['includeAll']){_0x51feea['include']=[{'all':!![]}];}_0x51feea=_[_0x43e4('0x3a')]({},_0x51feea,_0x435d29['options']);return db['SugarcrmField'][_0x43e4('0x43')](_0x51feea)['then'](handleEntityNotFound(_0x5db584,null))[_0x43e4('0x21')](respondWithResult(_0x5db584,null))[_0x43e4('0x3f')](handleError(_0x5db584,null));};exports['create']=function(_0x5df496,_0x3fd779){return db['SugarcrmField'][_0x43e4('0x44')](_0x5df496[_0x43e4('0x45')],{})['then'](respondWithResult(_0x3fd779,0xc9))[_0x43e4('0x3f')](handleError(_0x3fd779,null));};exports[_0x43e4('0x46')]=function(_0x2110ee,_0x4b373f){if(_0x2110ee[_0x43e4('0x45')]['id']){delete _0x2110ee[_0x43e4('0x45')]['id'];}return db[_0x43e4('0x29')][_0x43e4('0x43')]({'where':{'id':_0x2110ee['params']['id']}})['then'](handleEntityNotFound(_0x4b373f,null))[_0x43e4('0x21')](saveUpdates(_0x2110ee['body'],null))[_0x43e4('0x21')](respondWithResult(_0x4b373f,null))[_0x43e4('0x3f')](handleError(_0x4b373f,null));};exports['destroy']=function(_0x939cf,_0x378620){return db['SugarcrmField'][_0x43e4('0x43')]({'where':{'id':_0x939cf[_0x43e4('0x41')]['id']}})[_0x43e4('0x21')](handleEntityNotFound(_0x378620,null))['then'](removeEntity(_0x378620,null))['catch'](handleError(_0x378620,null));}; \ No newline at end of file +var _0x7cd6=['send','map','SugarcrmField','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','stack','name'];(function(_0x4a8f17,_0x16e1d4){var _0x5b6c22=function(_0xc34e3d){while(--_0xc34e3d){_0x4a8f17['push'](_0x4a8f17['shift']());}};_0x5b6c22(++_0x16e1d4);}(_0x7cd6,0x132));var _0x67cd=function(_0x48f6c9,_0x265de7){_0x48f6c9=_0x48f6c9-0x0;var _0x2c23b1=_0x7cd6[_0x48f6c9];return _0x2c23b1;};'use strict';var emlformat=require(_0x67cd('0x0'));var rimraf=require(_0x67cd('0x1'));var zipdir=require(_0x67cd('0x2'));var jsonpatch=require(_0x67cd('0x3'));var rp=require('request-promise');var moment=require(_0x67cd('0x4'));var BPromise=require(_0x67cd('0x5'));var Mustache=require(_0x67cd('0x6'));var util=require(_0x67cd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x67cd('0x8'));var ejs=require(_0x67cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67cd('0xa'));var crypto=require(_0x67cd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67cd('0x8'));var querystring=require(_0x67cd('0xc'));var Papa=require(_0x67cd('0xd'));var Redis=require(_0x67cd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x67cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67cd('0x10'));var logger=require(_0x67cd('0x11'))(_0x67cd('0x12'));var utils=require(_0x67cd('0x13'));var config=require(_0x67cd('0x14'));var licenseUtil=require(_0x67cd('0x15'));var db=require(_0x67cd('0x16'))['db'];function respondWithStatusCode(_0x292362,_0x491b33){_0x491b33=_0x491b33||0xcc;return function(_0x251cb1){if(_0x251cb1){return _0x292362[_0x67cd('0x17')](_0x491b33);}return _0x292362['status'](_0x491b33)[_0x67cd('0x18')]();};}function respondWithResult(_0x336075,_0xe75c9){_0xe75c9=_0xe75c9||0xc8;return function(_0xae4e2){if(_0xae4e2){return _0x336075[_0x67cd('0x19')](_0xe75c9)[_0x67cd('0x1a')](_0xae4e2);}};}function respondWithFilteredResult(_0x2292bb,_0x1ba53c){return function(_0x174cdc){if(_0x174cdc){var _0x4d65e4=typeof _0x1ba53c[_0x67cd('0x1b')]===_0x67cd('0x1c')&&typeof _0x1ba53c['limit']===_0x67cd('0x1c');var _0x3037f7=_0x174cdc[_0x67cd('0x1d')];var _0x4141bb=_0x4d65e4?0x0:_0x1ba53c[_0x67cd('0x1b')];var _0xc91f80=_0x4d65e4?_0x174cdc[_0x67cd('0x1d')]:_0x1ba53c[_0x67cd('0x1b')]+_0x1ba53c[_0x67cd('0x1e')];var _0x1984d7;if(_0xc91f80>=_0x3037f7){_0xc91f80=_0x3037f7;_0x1984d7=0xc8;}else{_0x1984d7=0xce;}_0x2292bb[_0x67cd('0x19')](_0x1984d7);return _0x2292bb[_0x67cd('0x1f')]('Content-Range',_0x4141bb+'-'+_0xc91f80+'/'+_0x3037f7)[_0x67cd('0x1a')](_0x174cdc);}return null;};}function patchUpdates(_0x51b73a){return function(_0x2b162b){try{jsonpatch[_0x67cd('0x20')](_0x2b162b,_0x51b73a,!![]);}catch(_0x525cc5){return BPromise[_0x67cd('0x21')](_0x525cc5);}return _0x2b162b['save']();};}function saveUpdates(_0x984275,_0x4974b8){return function(_0x2010a6){if(_0x2010a6){return _0x2010a6[_0x67cd('0x22')](_0x984275)['then'](function(_0x5de6e1){return _0x5de6e1;});}return null;};}function removeEntity(_0x387050,_0xaec97c){return function(_0x5c03fe){if(_0x5c03fe){return _0x5c03fe[_0x67cd('0x23')]()[_0x67cd('0x24')](function(){_0x387050[_0x67cd('0x19')](0xcc)[_0x67cd('0x18')]();});}};}function handleEntityNotFound(_0x53e8a8,_0x3ea2ab){return function(_0x46296d){if(!_0x46296d){_0x53e8a8[_0x67cd('0x17')](0x194);}return _0x46296d;};}function handleError(_0xa4f902,_0x598fef){_0x598fef=_0x598fef||0x1f4;return function(_0x22a4c4){logger['error'](_0x22a4c4[_0x67cd('0x25')]);if(_0x22a4c4[_0x67cd('0x26')]){delete _0x22a4c4[_0x67cd('0x26')];}_0xa4f902['status'](_0x598fef)[_0x67cd('0x27')](_0x22a4c4);};}exports['index']=function(_0x225b0f,_0x49ffd1){var _0x2ee090={},_0xbd049e={},_0x273926={'count':0x0,'rows':[]};var _0x1c5f47=_[_0x67cd('0x28')](db[_0x67cd('0x29')]['rawAttributes'],function(_0x10a9d7){return{'name':_0x10a9d7['fieldName'],'type':_0x10a9d7[_0x67cd('0x2a')]['key']};});_0xbd049e['model']=_['map'](_0x1c5f47,_0x67cd('0x26'));_0xbd049e['query']=_['keys'](_0x225b0f[_0x67cd('0x2b')]);_0xbd049e[_0x67cd('0x2c')]=_[_0x67cd('0x2d')](_0xbd049e[_0x67cd('0x2e')],_0xbd049e['query']);_0x2ee090[_0x67cd('0x2f')]=_[_0x67cd('0x2d')](_0xbd049e[_0x67cd('0x2e')],qs[_0x67cd('0x30')](_0x225b0f[_0x67cd('0x2b')]['fields']));_0x2ee090['attributes']=_0x2ee090['attributes'][_0x67cd('0x31')]?_0x2ee090[_0x67cd('0x2f')]:_0xbd049e[_0x67cd('0x2e')];if(!_0x225b0f[_0x67cd('0x2b')]['hasOwnProperty'](_0x67cd('0x32'))){_0x2ee090['limit']=qs[_0x67cd('0x1e')](_0x225b0f[_0x67cd('0x2b')]['limit']);_0x2ee090['offset']=qs[_0x67cd('0x1b')](_0x225b0f['query'][_0x67cd('0x1b')]);}_0x2ee090[_0x67cd('0x33')]=qs[_0x67cd('0x34')](_0x225b0f[_0x67cd('0x2b')]['sort']);_0x2ee090[_0x67cd('0x35')]=qs[_0x67cd('0x2c')](_[_0x67cd('0x36')](_0x225b0f[_0x67cd('0x2b')],_0xbd049e['filters']),_0x1c5f47);if(_0x225b0f[_0x67cd('0x2b')][_0x67cd('0x37')]){_0x2ee090[_0x67cd('0x35')]=_[_0x67cd('0x38')](_0x2ee090[_0x67cd('0x35')],{'$or':_[_0x67cd('0x28')](_0x1c5f47,function(_0x4024e0){if(_0x4024e0['type']!=='VIRTUAL'){var _0xee55fe={};_0xee55fe[_0x4024e0[_0x67cd('0x26')]]={'$like':'%'+_0x225b0f[_0x67cd('0x2b')]['filter']+'%'};return _0xee55fe;}})});}_0x2ee090=_[_0x67cd('0x38')]({},_0x2ee090,_0x225b0f[_0x67cd('0x39')]);var _0xceb49d={'where':_0x2ee090[_0x67cd('0x35')]};return db[_0x67cd('0x29')][_0x67cd('0x1d')](_0xceb49d)[_0x67cd('0x24')](function(_0x50df73){_0x273926[_0x67cd('0x1d')]=_0x50df73;if(_0x225b0f['query'][_0x67cd('0x3a')]){_0x2ee090[_0x67cd('0x3b')]=[{'all':!![]}];}return db[_0x67cd('0x29')][_0x67cd('0x3c')](_0x2ee090);})['then'](function(_0x2d85c8){_0x273926['rows']=_0x2d85c8;return _0x273926;})[_0x67cd('0x24')](respondWithFilteredResult(_0x49ffd1,_0x2ee090))[_0x67cd('0x3d')](handleError(_0x49ffd1,null));};exports[_0x67cd('0x3e')]=function(_0x54e323,_0x33d7db){var _0x2ecb9d={'raw':!![],'where':{'id':_0x54e323[_0x67cd('0x3f')]['id']}},_0x258c23={};_0x258c23[_0x67cd('0x2e')]=_['keys'](db[_0x67cd('0x29')][_0x67cd('0x40')]);_0x258c23[_0x67cd('0x2b')]=_[_0x67cd('0x41')](_0x54e323['query']);_0x258c23[_0x67cd('0x2c')]=_[_0x67cd('0x2d')](_0x258c23[_0x67cd('0x2e')],_0x258c23[_0x67cd('0x2b')]);_0x2ecb9d[_0x67cd('0x2f')]=_['intersection'](_0x258c23['model'],qs[_0x67cd('0x30')](_0x54e323[_0x67cd('0x2b')][_0x67cd('0x30')]));_0x2ecb9d[_0x67cd('0x2f')]=_0x2ecb9d['attributes'][_0x67cd('0x31')]?_0x2ecb9d[_0x67cd('0x2f')]:_0x258c23[_0x67cd('0x2e')];if(_0x54e323[_0x67cd('0x2b')]['includeAll']){_0x2ecb9d[_0x67cd('0x3b')]=[{'all':!![]}];}_0x2ecb9d=_['merge']({},_0x2ecb9d,_0x54e323[_0x67cd('0x39')]);return db[_0x67cd('0x29')][_0x67cd('0x42')](_0x2ecb9d)['then'](handleEntityNotFound(_0x33d7db,null))[_0x67cd('0x24')](respondWithResult(_0x33d7db,null))['catch'](handleError(_0x33d7db,null));};exports[_0x67cd('0x43')]=function(_0x3554fa,_0x55a896){return db[_0x67cd('0x29')][_0x67cd('0x43')](_0x3554fa[_0x67cd('0x44')],{})[_0x67cd('0x24')](respondWithResult(_0x55a896,0xc9))[_0x67cd('0x3d')](handleError(_0x55a896,null));};exports['update']=function(_0x137c1e,_0x44e009){if(_0x137c1e['body']['id']){delete _0x137c1e['body']['id'];}return db[_0x67cd('0x29')][_0x67cd('0x42')]({'where':{'id':_0x137c1e[_0x67cd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x44e009,null))[_0x67cd('0x24')](saveUpdates(_0x137c1e[_0x67cd('0x44')],null))[_0x67cd('0x24')](respondWithResult(_0x44e009,null))[_0x67cd('0x3d')](handleError(_0x44e009,null));};exports[_0x67cd('0x23')]=function(_0x1033f0,_0x37739b){return db[_0x67cd('0x29')][_0x67cd('0x42')]({'where':{'id':_0x1033f0['params']['id']}})[_0x67cd('0x24')](handleEntityNotFound(_0x37739b,null))[_0x67cd('0x24')](removeEntity(_0x37739b,null))[_0x67cd('0x3d')](handleError(_0x37739b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c11c0f1..d075d94 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 _0x8c71=['path','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise'];(function(_0x3898d1,_0xc121f8){var _0x25613b=function(_0x55fe24){while(--_0x55fe24){_0x3898d1['push'](_0x3898d1['shift']());}};_0x25613b(++_0xc121f8);}(_0x8c71,0x159));var _0x18c7=function(_0x3a0512,_0x2f78ea){_0x3a0512=_0x3a0512-0x0;var _0x1a8fd7=_0x8c71[_0x3a0512];return _0x1a8fd7;};'use strict';var _=require(_0x18c7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x18c7('0x1'));var moment=require(_0x18c7('0x2'));var BPromise=require(_0x18c7('0x3'));var rp=require(_0x18c7('0x4'));var fs=require('fs');var path=require(_0x18c7('0x5'));var rimraf=require('rimraf');var config=require(_0x18c7('0x6'));var attributes=require(_0x18c7('0x7'));module[_0x18c7('0x8')]=function(_0x205413,_0x1b58ad){return _0x205413['define'](_0x18c7('0x9'),attributes,{'tableName':_0x18c7('0xa'),'paranoid':![],'indexes':[{'name':_0x18c7('0xb'),'fields':[_0x18c7('0xc'),_0x18c7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4de3=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x339192,_0x2228ac){var _0x2c3ce5=function(_0x2771e1){while(--_0x2771e1){_0x339192['push'](_0x339192['shift']());}};_0x2c3ce5(++_0x2228ac);}(_0x4de3,0x114));var _0x34de=function(_0x140975,_0x187ffc){_0x140975=_0x140975-0x0;var _0x3e4f96=_0x4de3[_0x140975];return _0x3e4f96;};'use strict';var _=require(_0x34de('0x0'));var util=require(_0x34de('0x1'));var logger=require(_0x34de('0x2'))(_0x34de('0x3'));var moment=require(_0x34de('0x4'));var BPromise=require(_0x34de('0x5'));var rp=require(_0x34de('0x6'));var fs=require('fs');var path=require(_0x34de('0x7'));var rimraf=require(_0x34de('0x8'));var config=require('../../config/environment');var attributes=require(_0x34de('0x9'));module['exports']=function(_0x3b5161,_0x437c8d){return _0x3b5161[_0x34de('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x34de('0xb'),'fields':[_0x34de('0xc'),_0x34de('0xd')],'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 43589df..e6cbef5 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 _0x0cb4=['../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0cb4,0x120));var _0x40cb=function(_0x183ad6,_0x5f06ab){_0x183ad6=_0x183ad6-0x0;var _0x8d60cb=_0x0cb4[_0x183ad6];return _0x8d60cb;};'use strict';var _=require(_0x40cb('0x0'));var util=require(_0x40cb('0x1'));var moment=require(_0x40cb('0x2'));var BPromise=require('bluebird');var rs=require(_0x40cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x40cb('0x5'))('rpc');var config=require(_0x40cb('0x6'));var jayson=require(_0x40cb('0x7'));var client=jayson['client'][_0x40cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12f09e,_0x3d6578,_0x1e4d6f){return new BPromise(function(_0x397927,_0x2b0c90){return client[_0x40cb('0x9')](_0x12f09e,_0x1e4d6f)[_0x40cb('0xa')](function(_0x5ca03e){logger[_0x40cb('0xb')](_0x40cb('0xc'),_0x3d6578,'request\x20sent');logger[_0x40cb('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3d6578,_0x40cb('0xe'),JSON[_0x40cb('0xf')](_0x5ca03e));if(_0x5ca03e[_0x40cb('0x10')]){if(_0x5ca03e['error'][_0x40cb('0x11')]===0x1f4){logger[_0x40cb('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x3d6578,_0x5ca03e[_0x40cb('0x10')][_0x40cb('0x12')]);return _0x2b0c90(_0x5ca03e[_0x40cb('0x10')][_0x40cb('0x12')]);}logger[_0x40cb('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x3d6578,_0x5ca03e['error'][_0x40cb('0x12')]);return _0x397927(_0x5ca03e[_0x40cb('0x10')][_0x40cb('0x12')]);}else{logger['info'](_0x40cb('0xc'),_0x3d6578,'request\x20sent');_0x397927(_0x5ca03e[_0x40cb('0x13')][_0x40cb('0x12')]);}})[_0x40cb('0x14')](function(_0x1103b9){logger[_0x40cb('0x10')](_0x40cb('0xc'),_0x3d6578,_0x1103b9);_0x2b0c90(_0x1103b9);});});} \ No newline at end of file +var _0x76dd=['http','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1b0727,_0x4a0d61){var _0x177909=function(_0x8fcd77){while(--_0x8fcd77){_0x1b0727['push'](_0x1b0727['shift']());}};_0x177909(++_0x4a0d61);}(_0x76dd,0x182));var _0xd76d=function(_0x472c9a,_0x17b55d){_0x472c9a=_0x472c9a-0x0;var _0x54dede=_0x76dd[_0x472c9a];return _0x54dede;};'use strict';var _=require(_0xd76d('0x0'));var util=require(_0xd76d('0x1'));var moment=require(_0xd76d('0x2'));var BPromise=require(_0xd76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd76d('0x4'));var db=require(_0xd76d('0x5'))['db'];var utils=require(_0xd76d('0x6'));var logger=require(_0xd76d('0x7'))(_0xd76d('0x8'));var config=require('../../config/environment');var jayson=require(_0xd76d('0x9'));var client=jayson['client'][_0xd76d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x727a48,_0x5e28ef,_0x135892){return new BPromise(function(_0x402e70,_0xa376e6){return client[_0xd76d('0xb')](_0x727a48,_0x135892)[_0xd76d('0xc')](function(_0x334728){logger[_0xd76d('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x5e28ef,_0xd76d('0xe'));logger['debug'](_0xd76d('0xf'),_0x5e28ef,_0xd76d('0xe'),JSON[_0xd76d('0x10')](_0x334728));if(_0x334728[_0xd76d('0x11')]){if(_0x334728['error']['code']===0x1f4){logger[_0xd76d('0x11')](_0xd76d('0x12'),_0x5e28ef,_0x334728[_0xd76d('0x11')][_0xd76d('0x13')]);return _0xa376e6(_0x334728['error']['message']);}logger[_0xd76d('0x11')](_0xd76d('0x12'),_0x5e28ef,_0x334728[_0xd76d('0x11')][_0xd76d('0x13')]);return _0x402e70(_0x334728[_0xd76d('0x11')]['message']);}else{logger[_0xd76d('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x5e28ef,'request\x20sent');_0x402e70(_0x334728[_0xd76d('0x14')][_0xd76d('0x13')]);}})[_0xd76d('0x15')](function(_0x4da999){logger[_0xd76d('0x11')](_0xd76d('0x12'),_0x5e28ef,_0x4da999);_0xa376e6(_0x4da999);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8fd9e2f..22a4493 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 _0x8cfd=['/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x1cef07,_0x1eb5f2){var _0x2f0a89=function(_0xdab0fe){while(--_0xdab0fe){_0x1cef07['push'](_0x1cef07['shift']());}};_0x2f0a89(++_0x1eb5f2);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0x8cfd[_0x3d34f0];return _0x135ecd;};'use strict';var multer=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var path=require(_0xd8cf('0x2'));var timeout=require(_0xd8cf('0x3'));var express=require(_0xd8cf('0x4'));var router=express[_0xd8cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd8cf('0x6'));var interaction=require(_0xd8cf('0x7'));var config=require(_0xd8cf('0x8'));var controller=require(_0xd8cf('0x9'));router[_0xd8cf('0xa')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xc')]);router['get']('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xd')]);router[_0xd8cf('0xa')](_0xd8cf('0xe'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xf')]);router['get'](_0xd8cf('0x10'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x11')]);router[_0xd8cf('0x12')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x13')]);router[_0xd8cf('0x12')](_0xd8cf('0xe'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x14')]);router[_0xd8cf('0x15')](_0xd8cf('0x16'),auth['isAuthenticated'](),controller[_0xd8cf('0x17')]);router['delete'](_0xd8cf('0x16'),auth[_0xd8cf('0xb')](),controller['destroy']);module[_0xd8cf('0x18')]=router; \ No newline at end of file +var _0x18a5=['addConfiguration','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x1d4cc2,_0x5240e2){var _0x3d8f67=function(_0x43a999){while(--_0x43a999){_0x1d4cc2['push'](_0x1d4cc2['shift']());}};_0x3d8f67(++_0x5240e2);}(_0x18a5,0x164));var _0x518a=function(_0x492acd,_0x11fe34){_0x492acd=_0x492acd-0x0;var _0x22813e=_0x18a5[_0x492acd];return _0x22813e;};'use strict';var multer=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x518a('0x2'));var router=express['Router']();var fs_extra=require(_0x518a('0x3'));var auth=require(_0x518a('0x4'));var interaction=require(_0x518a('0x5'));var config=require(_0x518a('0x6'));var controller=require(_0x518a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x518a('0x8')](_0x518a('0x9'),auth[_0x518a('0xa')](),controller[_0x518a('0xb')]);router[_0x518a('0x8')](_0x518a('0xc'),auth[_0x518a('0xa')](),controller[_0x518a('0xd')]);router[_0x518a('0x8')](_0x518a('0xe'),auth[_0x518a('0xa')](),controller[_0x518a('0xf')]);router[_0x518a('0x10')]('/',auth[_0x518a('0xa')](),controller[_0x518a('0x11')]);router['post'](_0x518a('0xc'),auth['isAuthenticated'](),controller[_0x518a('0x12')]);router['put'](_0x518a('0x9'),auth[_0x518a('0xa')](),controller[_0x518a('0x13')]);router[_0x518a('0x14')](_0x518a('0x9'),auth[_0x518a('0xa')](),controller[_0x518a('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 b8bf7c2..b83f916 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 _0x9298=['sequelize','exports','STRING','HelpDesk'];(function(_0x19b1fe,_0x4e4756){var _0x2dbed8=function(_0x31829a){while(--_0x31829a){_0x19b1fe['push'](_0x19b1fe['shift']());}};_0x2dbed8(++_0x4e4756);}(_0x9298,0x1dc));var _0x8929=function(_0x585570,_0x14cf02){_0x585570=_0x585570-0x0;var _0x4eed81=_0x9298[_0x585570];return _0x4eed81;};'use strict';var Sequelize=require(_0x8929('0x0'));module[_0x8929('0x1')]={'name':{'type':Sequelize[_0x8929('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8929('0x2')]},'username':{'type':Sequelize[_0x8929('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8929('0x2')],'allowNull':![],'defaultValue':_0x8929('0x3')},'remoteUri':{'type':Sequelize[_0x8929('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8929('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8929('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x60e8=['sequelize','exports','STRING'];(function(_0x2e3744,_0x1e9fb3){var _0x13089e=function(_0x41a57f){while(--_0x41a57f){_0x2e3744['push'](_0x2e3744['shift']());}};_0x13089e(++_0x1e9fb3);}(_0x60e8,0x144));var _0x860e=function(_0x386a39,_0x26026e){_0x386a39=_0x386a39-0x0;var _0x414d7d=_0x60e8[_0x386a39];return _0x414d7d;};'use strict';var Sequelize=require(_0x860e('0x0'));module[_0x860e('0x1')]={'name':{'type':Sequelize[_0x860e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x860e('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x860e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 8be2faf..05376d8 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 _0xb2fe=['vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','index','VtigerAccount','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','order','AccountId','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','Subjects','md5','getFields','name','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','includes','false','label','cf_','picklistValues'];(function(_0x1fdda6,_0x55658e){var _0x238487=function(_0x540e0e){while(--_0x540e0e){_0x1fdda6['push'](_0x1fdda6['shift']());}};_0x238487(++_0x55658e);}(_0xb2fe,0x16e));var _0xeb2f=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xb2fe[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xeb2f('0x0'));var rimraf=require(_0xeb2f('0x1'));var zipdir=require(_0xeb2f('0x2'));var jsonpatch=require(_0xeb2f('0x3'));var rp=require(_0xeb2f('0x4'));var moment=require(_0xeb2f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb2f('0x6'));var util=require('util');var path=require(_0xeb2f('0x7'));var sox=require('sox');var csv=require(_0xeb2f('0x8'));var ejs=require(_0xeb2f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb2f('0xa'));var squel=require(_0xeb2f('0xb'));var crypto=require('crypto');var jsforce=require(_0xeb2f('0xc'));var deskjs=require(_0xeb2f('0xd'));var toCsv=require(_0xeb2f('0x8'));var querystring=require(_0xeb2f('0xe'));var Papa=require(_0xeb2f('0xf'));var Redis=require(_0xeb2f('0x10'));var authService=require(_0xeb2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb2f('0x12'));var hardwareService=require(_0xeb2f('0x13'));var logger=require('../../config/logger')(_0xeb2f('0x14'));var utils=require(_0xeb2f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb2f('0x16'));var db=require(_0xeb2f('0x17'))['db'];var integrations=require(_0xeb2f('0x18'));function respondWithStatusCode(_0x152baa,_0x3f02c1){_0x3f02c1=_0x3f02c1||0xcc;return function(_0xbda1d){if(_0xbda1d){return _0x152baa[_0xeb2f('0x19')](_0x3f02c1);}return _0x152baa[_0xeb2f('0x1a')](_0x3f02c1)[_0xeb2f('0x1b')]();};}function respondWithResult(_0xbfc304,_0x27e6dc){_0x27e6dc=_0x27e6dc||0xc8;return function(_0x3c85ac){if(_0x3c85ac){return _0xbfc304[_0xeb2f('0x1a')](_0x27e6dc)['json'](_0x3c85ac);}};}function respondWithFilteredResult(_0x410669,_0x4cd37a){return function(_0x257d2a){if(_0x257d2a){var _0x213e64=typeof _0x4cd37a[_0xeb2f('0x1c')]===_0xeb2f('0x1d')&&typeof _0x4cd37a['limit']===_0xeb2f('0x1d');var _0x4a9318=_0x257d2a[_0xeb2f('0x1e')];var _0x5cdf4d=_0x213e64?0x0:_0x4cd37a[_0xeb2f('0x1c')];var _0x23c682=_0x213e64?_0x257d2a[_0xeb2f('0x1e')]:_0x4cd37a['offset']+_0x4cd37a[_0xeb2f('0x1f')];var _0x413402;if(_0x23c682>=_0x4a9318){_0x23c682=_0x4a9318;_0x413402=0xc8;}else{_0x413402=0xce;}_0x410669[_0xeb2f('0x1a')](_0x413402);return _0x410669[_0xeb2f('0x20')](_0xeb2f('0x21'),_0x5cdf4d+'-'+_0x23c682+'/'+_0x4a9318)[_0xeb2f('0x22')](_0x257d2a);}return null;};}function patchUpdates(_0x94e0c9){return function(_0x1e043f){try{jsonpatch[_0xeb2f('0x23')](_0x1e043f,_0x94e0c9,!![]);}catch(_0x447af1){return BPromise[_0xeb2f('0x24')](_0x447af1);}return _0x1e043f[_0xeb2f('0x25')]();};}function saveUpdates(_0x54a146,_0x1d2191){return function(_0x198142){if(_0x198142){return _0x198142['update'](_0x54a146)['then'](function(_0x227d02){return _0x227d02;});}return null;};}function removeEntity(_0x1140d3,_0x12d722){return function(_0x2a6bbe){if(_0x2a6bbe){return _0x2a6bbe[_0xeb2f('0x26')]()[_0xeb2f('0x27')](function(){_0x1140d3[_0xeb2f('0x1a')](0xcc)[_0xeb2f('0x1b')]();});}};}function handleEntityNotFound(_0x53f9ff,_0x3a5b0c){return function(_0x225cec){if(!_0x225cec){_0x53f9ff[_0xeb2f('0x19')](0x194);}return _0x225cec;};}function handleError(_0xdea0a8,_0x10a7c2){_0x10a7c2=_0x10a7c2||0x1f4;return function(_0x30264c){logger[_0xeb2f('0x28')](_0x30264c['stack']);if(_0x30264c['name']){delete _0x30264c['name'];}_0xdea0a8['status'](_0x10a7c2)['send'](_0x30264c);};}exports[_0xeb2f('0x29')]=function(_0x43b621,_0x3bd595){var _0x425fd2={},_0x41c4ac={},_0x42dc37={'count':0x0,'rows':[]};var _0x4f3039=_['map'](db[_0xeb2f('0x2a')]['rawAttributes'],function(_0x3a2d1d){return{'name':_0x3a2d1d[_0xeb2f('0x2b')],'type':_0x3a2d1d['type'][_0xeb2f('0x2c')]};});_0x41c4ac[_0xeb2f('0x2d')]=_[_0xeb2f('0x2e')](_0x4f3039,'name');_0x41c4ac[_0xeb2f('0x2f')]=_[_0xeb2f('0x30')](_0x43b621[_0xeb2f('0x2f')]);_0x41c4ac[_0xeb2f('0x31')]=_['intersection'](_0x41c4ac[_0xeb2f('0x2d')],_0x41c4ac[_0xeb2f('0x2f')]);_0x425fd2[_0xeb2f('0x32')]=_[_0xeb2f('0x33')](_0x41c4ac[_0xeb2f('0x2d')],qs[_0xeb2f('0x34')](_0x43b621[_0xeb2f('0x2f')][_0xeb2f('0x34')]));_0x425fd2[_0xeb2f('0x32')]=_0x425fd2['attributes'][_0xeb2f('0x35')]?_0x425fd2[_0xeb2f('0x32')]:_0x41c4ac[_0xeb2f('0x2d')];if(!_0x43b621[_0xeb2f('0x2f')][_0xeb2f('0x36')](_0xeb2f('0x37'))){_0x425fd2[_0xeb2f('0x1f')]=qs['limit'](_0x43b621[_0xeb2f('0x2f')][_0xeb2f('0x1f')]);_0x425fd2[_0xeb2f('0x1c')]=qs[_0xeb2f('0x1c')](_0x43b621[_0xeb2f('0x2f')][_0xeb2f('0x1c')]);}_0x425fd2['order']=qs[_0xeb2f('0x38')](_0x43b621[_0xeb2f('0x2f')][_0xeb2f('0x38')]);_0x425fd2[_0xeb2f('0x39')]=qs[_0xeb2f('0x31')](_[_0xeb2f('0x3a')](_0x43b621[_0xeb2f('0x2f')],_0x41c4ac['filters']),_0x4f3039);if(_0x43b621[_0xeb2f('0x2f')]['filter']){_0x425fd2[_0xeb2f('0x39')]=_[_0xeb2f('0x3b')](_0x425fd2[_0xeb2f('0x39')],{'$or':_['map'](_0x4f3039,function(_0x5ec638){if(_0x5ec638[_0xeb2f('0x3c')]!==_0xeb2f('0x3d')){var _0xdf9b8e={};_0xdf9b8e[_0x5ec638['name']]={'$like':'%'+_0x43b621['query'][_0xeb2f('0x3e')]+'%'};return _0xdf9b8e;}})});}_0x425fd2=_['merge']({},_0x425fd2,_0x43b621['options']);var _0x43dedb={'where':_0x425fd2['where']};return db[_0xeb2f('0x2a')][_0xeb2f('0x1e')](_0x43dedb)['then'](function(_0xc59a7b){_0x42dc37['count']=_0xc59a7b;if(_0x43b621['query'][_0xeb2f('0x3f')]){_0x425fd2[_0xeb2f('0x40')]=[{'all':!![]}];}return db[_0xeb2f('0x2a')][_0xeb2f('0x41')](_0x425fd2);})[_0xeb2f('0x27')](function(_0x319843){_0x42dc37[_0xeb2f('0x42')]=_0x319843;return _0x42dc37;})['then'](respondWithFilteredResult(_0x3bd595,_0x425fd2))[_0xeb2f('0x43')](handleError(_0x3bd595,null));};exports['show']=function(_0x471015,_0x521355){var _0x13c6cc={'raw':![],'where':{'id':_0x471015[_0xeb2f('0x44')]['id']}},_0x3f1d34={};_0x3f1d34[_0xeb2f('0x2d')]=_[_0xeb2f('0x30')](db[_0xeb2f('0x2a')][_0xeb2f('0x45')]);_0x3f1d34['query']=_[_0xeb2f('0x30')](_0x471015[_0xeb2f('0x2f')]);_0x3f1d34[_0xeb2f('0x31')]=_['intersection'](_0x3f1d34['model'],_0x3f1d34[_0xeb2f('0x2f')]);_0x13c6cc[_0xeb2f('0x32')]=_[_0xeb2f('0x33')](_0x3f1d34[_0xeb2f('0x2d')],qs[_0xeb2f('0x34')](_0x471015[_0xeb2f('0x2f')][_0xeb2f('0x34')]));_0x13c6cc[_0xeb2f('0x32')]=_0x13c6cc[_0xeb2f('0x32')][_0xeb2f('0x35')]?_0x13c6cc['attributes']:_0x3f1d34[_0xeb2f('0x2d')];if(_0x471015[_0xeb2f('0x2f')]['includeAll']){_0x13c6cc['include']=[{'all':!![]}];}_0x13c6cc=_[_0xeb2f('0x3b')]({},_0x13c6cc,_0x471015['options']);return db[_0xeb2f('0x2a')][_0xeb2f('0x46')](_0x13c6cc)[_0xeb2f('0x27')](handleEntityNotFound(_0x521355,null))[_0xeb2f('0x27')](respondWithResult(_0x521355,null))[_0xeb2f('0x43')](handleError(_0x521355,null));};exports[_0xeb2f('0x47')]=function(_0x1c9003,_0x2be334){return db['VtigerAccount'][_0xeb2f('0x47')](_0x1c9003[_0xeb2f('0x48')],{})['then'](respondWithResult(_0x2be334,0xc9))['catch'](handleError(_0x2be334,null));};exports['update']=function(_0x3d2ad8,_0x4481e1){if(_0x3d2ad8[_0xeb2f('0x48')]['id']){delete _0x3d2ad8[_0xeb2f('0x48')]['id'];}return db[_0xeb2f('0x2a')][_0xeb2f('0x46')]({'where':{'id':_0x3d2ad8['params']['id']}})['then'](handleEntityNotFound(_0x4481e1,null))[_0xeb2f('0x27')](saveUpdates(_0x3d2ad8[_0xeb2f('0x48')],null))[_0xeb2f('0x27')](respondWithResult(_0x4481e1,null))[_0xeb2f('0x43')](handleError(_0x4481e1,null));};exports['destroy']=function(_0x50fbf4,_0x798211){return db[_0xeb2f('0x2a')][_0xeb2f('0x46')]({'where':{'id':_0x50fbf4[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x27')](handleEntityNotFound(_0x798211,null))['then'](removeEntity(_0x798211,null))[_0xeb2f('0x43')](handleError(_0x798211,null));};exports[_0xeb2f('0x49')]=function(_0x4b28ba,_0x246f25,_0x45b622){var _0xd72475={};var _0x249e94={};var _0x3ecece;var _0x39aefd;return db['VtigerAccount'][_0xeb2f('0x4a')]({'where':{'id':_0x4b28ba[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x27')](handleEntityNotFound(_0x246f25,null))[_0xeb2f('0x27')](function(_0x36f2c2){if(_0x36f2c2){_0x3ecece=_0x36f2c2;_0x249e94[_0xeb2f('0x2d')]=_[_0xeb2f('0x30')](db['VtigerConfiguration'][_0xeb2f('0x45')]);_0x249e94['query']=_[_0xeb2f('0x30')](_0x4b28ba[_0xeb2f('0x2f')]);_0x249e94[_0xeb2f('0x31')]=_['intersection'](_0x249e94['model'],_0x249e94['query']);_0xd72475[_0xeb2f('0x32')]=_[_0xeb2f('0x33')](_0x249e94[_0xeb2f('0x2d')],qs[_0xeb2f('0x34')](_0x4b28ba[_0xeb2f('0x2f')][_0xeb2f('0x34')]));_0xd72475['attributes']=_0xd72475[_0xeb2f('0x32')][_0xeb2f('0x35')]?_0xd72475['attributes']:_0x249e94['model'];_0xd72475[_0xeb2f('0x4b')]=qs[_0xeb2f('0x38')](_0x4b28ba[_0xeb2f('0x2f')]['sort']);_0xd72475[_0xeb2f('0x39')]=qs[_0xeb2f('0x31')](_['pick'](_0x4b28ba[_0xeb2f('0x2f')],_0x249e94[_0xeb2f('0x31')]));if(_0x4b28ba[_0xeb2f('0x2f')]['filter']){_0xd72475['where']=_[_0xeb2f('0x3b')](_0xd72475[_0xeb2f('0x39')],{'$or':_['map'](_0xd72475[_0xeb2f('0x32')],function(_0x30d817){var _0x1843c4={};_0x1843c4[_0x30d817]={'$like':'%'+_0x4b28ba['query']['filter']+'%'};return _0x1843c4;})});}_0xd72475=_[_0xeb2f('0x3b')]({},_0xd72475,_0x4b28ba['options']);return _0x3ecece[_0xeb2f('0x49')](_0xd72475);}})[_0xeb2f('0x27')](function(_0x24c4ed){if(_0x24c4ed){_0x39aefd=_0x24c4ed[_0xeb2f('0x35')];if(!_0x4b28ba['query'][_0xeb2f('0x36')]('nolimit')){_0xd72475[_0xeb2f('0x1f')]=qs[_0xeb2f('0x1f')](_0x4b28ba[_0xeb2f('0x2f')][_0xeb2f('0x1f')]);_0xd72475['offset']=qs[_0xeb2f('0x1c')](_0x4b28ba[_0xeb2f('0x2f')][_0xeb2f('0x1c')]);}return _0x3ecece[_0xeb2f('0x49')](_0xd72475);}})[_0xeb2f('0x27')](function(_0x1f529c){if(_0x1f529c){return _0x1f529c?{'count':_0x39aefd,'rows':_0x1f529c}:null;}})['then'](respondWithResult(_0x246f25,null))[_0xeb2f('0x43')](handleError(_0x246f25,null));};exports['addConfiguration']=function(_0x4c4f02,_0x1f87e3,_0xca6eee){if(_0x4c4f02['body']['id']){delete _0x4c4f02[_0xeb2f('0x48')]['id'];}return db[_0xeb2f('0x2a')][_0xeb2f('0x4a')]({'where':{'id':_0x4c4f02[_0xeb2f('0x44')]['id']}})[_0xeb2f('0x27')](handleEntityNotFound(_0x1f87e3,null))[_0xeb2f('0x27')](function(_0x1351fc){if(_0x1351fc){_0x4c4f02[_0xeb2f('0x48')][_0xeb2f('0x4c')]=_0x1351fc['id'];_0x4c4f02[_0xeb2f('0x48')]['Subjects']=integrations[_0xeb2f('0x4d')](_0x4c4f02[_0xeb2f('0x48')]['channel'],_0x4c4f02[_0xeb2f('0x48')]['type']);_0x4c4f02[_0xeb2f('0x48')][_0xeb2f('0x4e')]=integrations[_0xeb2f('0x4f')](_0x4c4f02['body'][_0xeb2f('0x50')],_0x4c4f02['body'][_0xeb2f('0x3c')]);return db[_0xeb2f('0x51')]['create'](_0x4c4f02[_0xeb2f('0x48')],{'include':[{'model':db[_0xeb2f('0x52')],'as':_0xeb2f('0x53')},{'model':db[_0xeb2f('0x52')],'as':'Descriptions'}]});}return null;})[_0xeb2f('0x27')](respondWithResult(_0x1f87e3,null))[_0xeb2f('0x43')](handleError(_0x1f87e3,null));};var md5=require(_0xeb2f('0x54'));exports[_0xeb2f('0x55')]=function(_0x4e31b4,_0x1ee906,_0xfd9e32){var _0x336488=null;var _0x457ca8=null;var _0xc1d863=null;var _0x508982=null;var _0xfcde2='';return db[_0xeb2f('0x2a')]['findOne']({'where':{'id':_0x4e31b4[_0xeb2f('0x44')]['id']},'attributes':['id',_0xeb2f('0x56'),_0xeb2f('0x57'),_0xeb2f('0x58'),_0xeb2f('0x59'),_0xeb2f('0x5a'),_0xeb2f('0x5b'),_0xeb2f('0x5c')]})[_0xeb2f('0x27')](handleEntityNotFound(_0x1ee906,null))[_0xeb2f('0x27')](function(_0x520168){if(_0x520168){_0x336488=_0x520168['username'];_0x457ca8=_0x520168['accessKey'];_0xc1d863=_0x520168[_0xeb2f('0x59')];_0xfcde2=_0x520168[_0xeb2f('0x5a')];var _0x2a7c2d=_0xfcde2['slice'](-0x1);if(_0x2a7c2d==='/'){_0xfcde2=_0xfcde2[_0xeb2f('0x5d')](0x0,_0xfcde2[_0xeb2f('0x5e')](_0x2a7c2d));}_0x508982=util[_0xeb2f('0x5f')]('%s/webservice.php',_0xfcde2);var _0xb8f64b={'method':_0xeb2f('0x60'),'uri':_0x508982,'qs':{'operation':_0xeb2f('0x61'),'username':_0x520168[_0xeb2f('0x57')]},'json':!![]};return rp(_0xb8f64b);}})['then'](function(_0x425040){if(_0x425040['success']){var _0x469854={'method':_0xeb2f('0x62'),'uri':_0x508982,'form':{'operation':_0xeb2f('0x63'),'username':_0x336488,'accessKey':md5(_0x425040[_0xeb2f('0x64')][_0xeb2f('0x65')]+_0x457ca8)},'json':!![]};return rp(_0x469854);}})['then'](function(_0x34ba7a){if(_0x34ba7a[_0xeb2f('0x66')]){var _0x1a7cc6={'method':_0xeb2f('0x60'),'uri':_0x508982,'qs':{'operation':_0xeb2f('0x67'),'username':_0x336488,'sessionName':_0x34ba7a['result'][_0xeb2f('0x68')],'elementType':_0xc1d863},'json':!![]};return rp(_0x1a7cc6);}})[_0xeb2f('0x27')](function(_0x384c98){if(_0x384c98[_0xeb2f('0x66')]){var _0x172828=[_0xeb2f('0x69'),_0xeb2f('0x6a'),_0xeb2f('0x6b')];_[_0xeb2f('0x6c')](_0x384c98[_0xeb2f('0x64')][_0xeb2f('0x34')],function(_0x172d22){return _0x172828[_0xeb2f('0x6d')](_0x172d22[_0xeb2f('0x3c')][_0xeb2f('0x56')]);});_['remove'](_0x384c98['result'][_0xeb2f('0x34')],function(_0x2c4498){return _0x2c4498['editable']===_0xeb2f('0x6e');});return{'count':_0x384c98[_0xeb2f('0x64')][_0xeb2f('0x34')][_0xeb2f('0x35')],'rows':_[_0xeb2f('0x2e')](_0x384c98[_0xeb2f('0x64')]['fields'],function(_0x2ae858){return{'id':_0x2ae858[_0xeb2f('0x56')],'name':_0x2ae858[_0xeb2f('0x6f')],'custom':_['startsWith'](_0x2ae858['name'],_0xeb2f('0x70'))?!![]:![],'options':_0x2ae858[_0xeb2f('0x3c')]['name']==='picklist'&&_0x2ae858[_0xeb2f('0x3c')][_0xeb2f('0x71')][_0xeb2f('0x35')]>0x0?_['map'](_0x2ae858[_0xeb2f('0x3c')][_0xeb2f('0x71')],function(_0x68684f){return{'name':_0x68684f[_0xeb2f('0x6f')],'value':_0x68684f['value']};}):[]};})};}})[_0xeb2f('0x27')](respondWithResult(_0x1ee906,null))[_0xeb2f('0x43')](function(_0x43074e){console['log'](_0xeb2f('0x72')+_0x43074e);var _0x11359b=_0x4e31b4[_0xeb2f('0x2f')][_0xeb2f('0x73')]?0x1f4:_0x43074e['statusCode']||0x1f4;logger[_0xeb2f('0x28')](_0xeb2f('0x74'),_0xeb2f('0x55'),_0x11359b,JSON[_0xeb2f('0x75')](_0x43074e));delete _0x43074e[_0xeb2f('0x56')];if(_0x11359b===0x191){_0x11359b=0x190;}_0x1ee906[_0xeb2f('0x1a')](_0x11359b)['send'](_0x4e31b4['query'][_0xeb2f('0x73')]?{'message':_0xeb2f('0x76'),'statusCode':_0x43074e[_0xeb2f('0x77')]}:_0x43074e);});}; \ No newline at end of file +var _0x5587=['bluebird','mustache','util','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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','error','name','index','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','params','include','options','create','body','destroy','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','autogenerated','reference','owner','includes','remove','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5587,0x1e5));var _0x7558=function(_0x27af9f,_0x301905){_0x27af9f=_0x27af9f-0x0;var _0x7b50c8=_0x5587[_0x27af9f];return _0x7b50c8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7558('0x0'));var jsonpatch=require(_0x7558('0x1'));var rp=require(_0x7558('0x2'));var moment=require('moment');var BPromise=require(_0x7558('0x3'));var Mustache=require(_0x7558('0x4'));var util=require(_0x7558('0x5'));var path=require(_0x7558('0x6'));var sox=require(_0x7558('0x7'));var csv=require(_0x7558('0x8'));var ejs=require(_0x7558('0x9'));var fs=require('fs');var fs_extra=require(_0x7558('0xa'));var _=require(_0x7558('0xb'));var squel=require(_0x7558('0xc'));var crypto=require(_0x7558('0xd'));var jsforce=require(_0x7558('0xe'));var deskjs=require(_0x7558('0xf'));var toCsv=require(_0x7558('0x8'));var querystring=require(_0x7558('0x10'));var Papa=require(_0x7558('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7558('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7558('0x13'));var logger=require(_0x7558('0x14'))(_0x7558('0x15'));var utils=require(_0x7558('0x16'));var config=require(_0x7558('0x17'));var licenseUtil=require(_0x7558('0x18'));var db=require(_0x7558('0x19'))['db'];var integrations=require(_0x7558('0x1a'));function respondWithStatusCode(_0x3d9d67,_0x48db3d){_0x48db3d=_0x48db3d||0xcc;return function(_0x265360){if(_0x265360){return _0x3d9d67[_0x7558('0x1b')](_0x48db3d);}return _0x3d9d67[_0x7558('0x1c')](_0x48db3d)[_0x7558('0x1d')]();};}function respondWithResult(_0xa0cfa5,_0x17bfe4){_0x17bfe4=_0x17bfe4||0xc8;return function(_0xf891c3){if(_0xf891c3){return _0xa0cfa5[_0x7558('0x1c')](_0x17bfe4)['json'](_0xf891c3);}};}function respondWithFilteredResult(_0xc9b507,_0x1fe7e0){return function(_0x322b49){if(_0x322b49){var _0x45b416=typeof _0x1fe7e0[_0x7558('0x1e')]===_0x7558('0x1f')&&typeof _0x1fe7e0['limit']===_0x7558('0x1f');var _0x3c2485=_0x322b49[_0x7558('0x20')];var _0xa1d795=_0x45b416?0x0:_0x1fe7e0[_0x7558('0x1e')];var _0xaf444e=_0x45b416?_0x322b49[_0x7558('0x20')]:_0x1fe7e0[_0x7558('0x1e')]+_0x1fe7e0[_0x7558('0x21')];var _0x1243f1;if(_0xaf444e>=_0x3c2485){_0xaf444e=_0x3c2485;_0x1243f1=0xc8;}else{_0x1243f1=0xce;}_0xc9b507[_0x7558('0x1c')](_0x1243f1);return _0xc9b507[_0x7558('0x22')](_0x7558('0x23'),_0xa1d795+'-'+_0xaf444e+'/'+_0x3c2485)[_0x7558('0x24')](_0x322b49);}return null;};}function patchUpdates(_0x3a31ae){return function(_0x138aea){try{jsonpatch['apply'](_0x138aea,_0x3a31ae,!![]);}catch(_0x32cabc){return BPromise[_0x7558('0x25')](_0x32cabc);}return _0x138aea[_0x7558('0x26')]();};}function saveUpdates(_0x2dde88,_0x27d68a){return function(_0x1db509){if(_0x1db509){return _0x1db509['update'](_0x2dde88)[_0x7558('0x27')](function(_0x961945){return _0x961945;});}return null;};}function removeEntity(_0x3f4a5b,_0xbb2219){return function(_0x204bc0){if(_0x204bc0){return _0x204bc0['destroy']()[_0x7558('0x27')](function(){_0x3f4a5b[_0x7558('0x1c')](0xcc)[_0x7558('0x1d')]();});}};}function handleEntityNotFound(_0x18c172,_0x2f0d92){return function(_0x5f2a01){if(!_0x5f2a01){_0x18c172[_0x7558('0x1b')](0x194);}return _0x5f2a01;};}function handleError(_0x5bcb4b,_0x1cbd8c){_0x1cbd8c=_0x1cbd8c||0x1f4;return function(_0xb72a74){logger[_0x7558('0x28')](_0xb72a74['stack']);if(_0xb72a74[_0x7558('0x29')]){delete _0xb72a74[_0x7558('0x29')];}_0x5bcb4b[_0x7558('0x1c')](_0x1cbd8c)['send'](_0xb72a74);};}exports[_0x7558('0x2a')]=function(_0x17b265,_0x555829){var _0x88c326={},_0x5e5193={},_0x4b1e16={'count':0x0,'rows':[]};var _0x34272c=_[_0x7558('0x2b')](db[_0x7558('0x2c')][_0x7558('0x2d')],function(_0x470c54){return{'name':_0x470c54[_0x7558('0x2e')],'type':_0x470c54[_0x7558('0x2f')]['key']};});_0x5e5193[_0x7558('0x30')]=_[_0x7558('0x2b')](_0x34272c,_0x7558('0x29'));_0x5e5193['query']=_[_0x7558('0x31')](_0x17b265[_0x7558('0x32')]);_0x5e5193[_0x7558('0x33')]=_[_0x7558('0x34')](_0x5e5193[_0x7558('0x30')],_0x5e5193[_0x7558('0x32')]);_0x88c326[_0x7558('0x35')]=_[_0x7558('0x34')](_0x5e5193[_0x7558('0x30')],qs[_0x7558('0x36')](_0x17b265[_0x7558('0x32')][_0x7558('0x36')]));_0x88c326[_0x7558('0x35')]=_0x88c326[_0x7558('0x35')][_0x7558('0x37')]?_0x88c326[_0x7558('0x35')]:_0x5e5193[_0x7558('0x30')];if(!_0x17b265[_0x7558('0x32')][_0x7558('0x38')](_0x7558('0x39'))){_0x88c326['limit']=qs[_0x7558('0x21')](_0x17b265[_0x7558('0x32')][_0x7558('0x21')]);_0x88c326['offset']=qs['offset'](_0x17b265[_0x7558('0x32')][_0x7558('0x1e')]);}_0x88c326[_0x7558('0x3a')]=qs[_0x7558('0x3b')](_0x17b265['query'][_0x7558('0x3b')]);_0x88c326[_0x7558('0x3c')]=qs[_0x7558('0x33')](_[_0x7558('0x3d')](_0x17b265['query'],_0x5e5193[_0x7558('0x33')]),_0x34272c);if(_0x17b265[_0x7558('0x32')][_0x7558('0x3e')]){_0x88c326[_0x7558('0x3c')]=_[_0x7558('0x3f')](_0x88c326[_0x7558('0x3c')],{'$or':_[_0x7558('0x2b')](_0x34272c,function(_0x310e89){if(_0x310e89[_0x7558('0x2f')]!=='VIRTUAL'){var _0x437830={};_0x437830[_0x310e89[_0x7558('0x29')]]={'$like':'%'+_0x17b265[_0x7558('0x32')][_0x7558('0x3e')]+'%'};return _0x437830;}})});}_0x88c326=_['merge']({},_0x88c326,_0x17b265['options']);var _0x5066d6={'where':_0x88c326[_0x7558('0x3c')]};return db[_0x7558('0x2c')][_0x7558('0x20')](_0x5066d6)['then'](function(_0xa13f00){_0x4b1e16[_0x7558('0x20')]=_0xa13f00;if(_0x17b265[_0x7558('0x32')][_0x7558('0x40')]){_0x88c326['include']=[{'all':!![]}];}return db[_0x7558('0x2c')][_0x7558('0x41')](_0x88c326);})[_0x7558('0x27')](function(_0x2a1ad5){_0x4b1e16[_0x7558('0x42')]=_0x2a1ad5;return _0x4b1e16;})[_0x7558('0x27')](respondWithFilteredResult(_0x555829,_0x88c326))[_0x7558('0x43')](handleError(_0x555829,null));};exports['show']=function(_0x50a965,_0x2c6c07){var _0x1a8653={'raw':![],'where':{'id':_0x50a965[_0x7558('0x44')]['id']}},_0x340c46={};_0x340c46[_0x7558('0x30')]=_[_0x7558('0x31')](db['VtigerAccount'][_0x7558('0x2d')]);_0x340c46[_0x7558('0x32')]=_['keys'](_0x50a965[_0x7558('0x32')]);_0x340c46['filters']=_[_0x7558('0x34')](_0x340c46[_0x7558('0x30')],_0x340c46[_0x7558('0x32')]);_0x1a8653[_0x7558('0x35')]=_[_0x7558('0x34')](_0x340c46[_0x7558('0x30')],qs[_0x7558('0x36')](_0x50a965[_0x7558('0x32')]['fields']));_0x1a8653[_0x7558('0x35')]=_0x1a8653[_0x7558('0x35')][_0x7558('0x37')]?_0x1a8653['attributes']:_0x340c46[_0x7558('0x30')];if(_0x50a965[_0x7558('0x32')]['includeAll']){_0x1a8653[_0x7558('0x45')]=[{'all':!![]}];}_0x1a8653=_[_0x7558('0x3f')]({},_0x1a8653,_0x50a965[_0x7558('0x46')]);return db[_0x7558('0x2c')]['find'](_0x1a8653)['then'](handleEntityNotFound(_0x2c6c07,null))[_0x7558('0x27')](respondWithResult(_0x2c6c07,null))[_0x7558('0x43')](handleError(_0x2c6c07,null));};exports['create']=function(_0x5e4f93,_0x28fb13){return db[_0x7558('0x2c')][_0x7558('0x47')](_0x5e4f93[_0x7558('0x48')],{})[_0x7558('0x27')](respondWithResult(_0x28fb13,0xc9))[_0x7558('0x43')](handleError(_0x28fb13,null));};exports['update']=function(_0x55b988,_0x4fe455){if(_0x55b988[_0x7558('0x48')]['id']){delete _0x55b988['body']['id'];}return db[_0x7558('0x2c')]['find']({'where':{'id':_0x55b988[_0x7558('0x44')]['id']}})[_0x7558('0x27')](handleEntityNotFound(_0x4fe455,null))[_0x7558('0x27')](saveUpdates(_0x55b988[_0x7558('0x48')],null))[_0x7558('0x27')](respondWithResult(_0x4fe455,null))[_0x7558('0x43')](handleError(_0x4fe455,null));};exports[_0x7558('0x49')]=function(_0x3ff3b6,_0x5250b1){return db['VtigerAccount'][_0x7558('0x4a')]({'where':{'id':_0x3ff3b6[_0x7558('0x44')]['id']}})[_0x7558('0x27')](handleEntityNotFound(_0x5250b1,null))['then'](removeEntity(_0x5250b1,null))[_0x7558('0x43')](handleError(_0x5250b1,null));};exports[_0x7558('0x4b')]=function(_0x5d40b3,_0x46742c,_0x333f4e){var _0x498127={};var _0x36649c={};var _0x29903a;var _0x911e5c;return db[_0x7558('0x2c')][_0x7558('0x4c')]({'where':{'id':_0x5d40b3[_0x7558('0x44')]['id']}})[_0x7558('0x27')](handleEntityNotFound(_0x46742c,null))['then'](function(_0x388d68){if(_0x388d68){_0x29903a=_0x388d68;_0x36649c[_0x7558('0x30')]=_[_0x7558('0x31')](db[_0x7558('0x4d')][_0x7558('0x2d')]);_0x36649c[_0x7558('0x32')]=_[_0x7558('0x31')](_0x5d40b3[_0x7558('0x32')]);_0x36649c[_0x7558('0x33')]=_[_0x7558('0x34')](_0x36649c[_0x7558('0x30')],_0x36649c[_0x7558('0x32')]);_0x498127[_0x7558('0x35')]=_['intersection'](_0x36649c['model'],qs['fields'](_0x5d40b3[_0x7558('0x32')][_0x7558('0x36')]));_0x498127[_0x7558('0x35')]=_0x498127[_0x7558('0x35')][_0x7558('0x37')]?_0x498127['attributes']:_0x36649c[_0x7558('0x30')];_0x498127[_0x7558('0x3a')]=qs['sort'](_0x5d40b3[_0x7558('0x32')]['sort']);_0x498127['where']=qs[_0x7558('0x33')](_[_0x7558('0x3d')](_0x5d40b3[_0x7558('0x32')],_0x36649c['filters']));if(_0x5d40b3[_0x7558('0x32')][_0x7558('0x3e')]){_0x498127[_0x7558('0x3c')]=_[_0x7558('0x3f')](_0x498127['where'],{'$or':_[_0x7558('0x2b')](_0x498127[_0x7558('0x35')],function(_0x1058a0){var _0x8e4e0b={};_0x8e4e0b[_0x1058a0]={'$like':'%'+_0x5d40b3['query'][_0x7558('0x3e')]+'%'};return _0x8e4e0b;})});}_0x498127=_['merge']({},_0x498127,_0x5d40b3[_0x7558('0x46')]);return _0x29903a['getConfigurations'](_0x498127);}})[_0x7558('0x27')](function(_0x51cc51){if(_0x51cc51){_0x911e5c=_0x51cc51[_0x7558('0x37')];if(!_0x5d40b3[_0x7558('0x32')][_0x7558('0x38')](_0x7558('0x39'))){_0x498127['limit']=qs[_0x7558('0x21')](_0x5d40b3[_0x7558('0x32')][_0x7558('0x21')]);_0x498127[_0x7558('0x1e')]=qs[_0x7558('0x1e')](_0x5d40b3['query']['offset']);}return _0x29903a[_0x7558('0x4b')](_0x498127);}})['then'](function(_0x159cd6){if(_0x159cd6){return _0x159cd6?{'count':_0x911e5c,'rows':_0x159cd6}:null;}})[_0x7558('0x27')](respondWithResult(_0x46742c,null))[_0x7558('0x43')](handleError(_0x46742c,null));};exports[_0x7558('0x4e')]=function(_0x471e35,_0x15c4a9,_0x8bfa82){if(_0x471e35[_0x7558('0x48')]['id']){delete _0x471e35[_0x7558('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x471e35[_0x7558('0x44')]['id']}})['then'](handleEntityNotFound(_0x15c4a9,null))[_0x7558('0x27')](function(_0x2c774a){if(_0x2c774a){_0x471e35[_0x7558('0x48')][_0x7558('0x4f')]=_0x2c774a['id'];_0x471e35[_0x7558('0x48')][_0x7558('0x50')]=integrations[_0x7558('0x51')](_0x471e35[_0x7558('0x48')][_0x7558('0x52')],_0x471e35[_0x7558('0x48')][_0x7558('0x2f')]);_0x471e35[_0x7558('0x48')][_0x7558('0x53')]=integrations['getDescriptions'](_0x471e35[_0x7558('0x48')]['channel'],_0x471e35['body']['type']);return db[_0x7558('0x4d')][_0x7558('0x47')](_0x471e35[_0x7558('0x48')],{'include':[{'model':db[_0x7558('0x54')],'as':'Subjects'},{'model':db[_0x7558('0x54')],'as':_0x7558('0x53')}]});}return null;})['then'](respondWithResult(_0x15c4a9,null))['catch'](handleError(_0x15c4a9,null));};var md5=require('md5');exports[_0x7558('0x55')]=function(_0x5efdaf,_0x4558c7,_0x1260ff){var _0x4488aa=null;var _0x218ae5=null;var _0x52b41e=null;var _0xe8551e=null;var _0x211419='';return db['VtigerAccount'][_0x7558('0x4c')]({'where':{'id':_0x5efdaf['params']['id']},'attributes':['id',_0x7558('0x29'),_0x7558('0x56'),'description',_0x7558('0x57'),_0x7558('0x58'),_0x7558('0x59'),_0x7558('0x5a')]})[_0x7558('0x27')](handleEntityNotFound(_0x4558c7,null))[_0x7558('0x27')](function(_0x20e3c5){if(_0x20e3c5){_0x4488aa=_0x20e3c5[_0x7558('0x56')];_0x218ae5=_0x20e3c5[_0x7558('0x5a')];_0x52b41e=_0x20e3c5[_0x7558('0x57')];_0x211419=_0x20e3c5[_0x7558('0x58')];var _0x126c77=_0x211419['slice'](-0x1);if(_0x126c77==='/'){_0x211419=_0x211419['substring'](0x0,_0x211419[_0x7558('0x5b')](_0x126c77));}_0xe8551e=util['format'](_0x7558('0x5c'),_0x211419);var _0x1585f4={'method':_0x7558('0x5d'),'uri':_0xe8551e,'qs':{'operation':_0x7558('0x5e'),'username':_0x20e3c5[_0x7558('0x56')]},'json':!![]};return rp(_0x1585f4);}})[_0x7558('0x27')](function(_0x1f0666){if(_0x1f0666[_0x7558('0x5f')]){var _0x1fab0a={'method':_0x7558('0x60'),'uri':_0xe8551e,'form':{'operation':_0x7558('0x61'),'username':_0x4488aa,'accessKey':md5(_0x1f0666[_0x7558('0x62')][_0x7558('0x63')]+_0x218ae5)},'json':!![]};return rp(_0x1fab0a);}})[_0x7558('0x27')](function(_0x313f1c){if(_0x313f1c[_0x7558('0x5f')]){var _0x54d1d9={'method':_0x7558('0x5d'),'uri':_0xe8551e,'qs':{'operation':_0x7558('0x64'),'username':_0x4488aa,'sessionName':_0x313f1c[_0x7558('0x62')]['sessionName'],'elementType':_0x52b41e},'json':!![]};return rp(_0x54d1d9);}})[_0x7558('0x27')](function(_0x180b23){if(_0x180b23[_0x7558('0x5f')]){var _0x5a700a=[_0x7558('0x65'),_0x7558('0x66'),_0x7558('0x67')];_['remove'](_0x180b23[_0x7558('0x62')]['fields'],function(_0x2a7d4d){return _0x5a700a[_0x7558('0x68')](_0x2a7d4d['type']['name']);});_[_0x7558('0x69')](_0x180b23['result'][_0x7558('0x36')],function(_0x2bb172){return _0x2bb172[_0x7558('0x6a')]===_0x7558('0x6b');});return{'count':_0x180b23[_0x7558('0x62')]['fields'][_0x7558('0x37')],'rows':_[_0x7558('0x2b')](_0x180b23['result'][_0x7558('0x36')],function(_0xc5ae3f){return{'id':_0xc5ae3f[_0x7558('0x29')],'name':_0xc5ae3f['label'],'custom':_[_0x7558('0x6c')](_0xc5ae3f[_0x7558('0x29')],_0x7558('0x6d'))?!![]:![],'options':_0xc5ae3f['type']['name']===_0x7558('0x6e')&&_0xc5ae3f[_0x7558('0x2f')][_0x7558('0x6f')][_0x7558('0x37')]>0x0?_[_0x7558('0x2b')](_0xc5ae3f[_0x7558('0x2f')][_0x7558('0x6f')],function(_0xef0023){return{'name':_0xef0023[_0x7558('0x70')],'value':_0xef0023[_0x7558('0x71')]};}):[]};})};}})[_0x7558('0x27')](respondWithResult(_0x4558c7,null))[_0x7558('0x43')](function(_0x48bc46){console[_0x7558('0x72')](_0x7558('0x73')+_0x48bc46);var _0x55cfaf=_0x5efdaf['query'][_0x7558('0x74')]?0x1f4:_0x48bc46[_0x7558('0x75')]||0x1f4;logger[_0x7558('0x28')](_0x7558('0x76'),_0x7558('0x55'),_0x55cfaf,JSON[_0x7558('0x77')](_0x48bc46));delete _0x48bc46[_0x7558('0x29')];if(_0x55cfaf===0x191){_0x55cfaf=0x190;}_0x4558c7[_0x7558('0x1c')](_0x55cfaf)[_0x7558('0x78')](_0x5efdaf[_0x7558('0x32')][_0x7558('0x74')]?{'message':_0x7558('0x79'),'statusCode':_0x48bc46['statusCode']}:_0x48bc46);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 801f497..d615667 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 _0x4578=['../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','exports','define','lodash'];(function(_0x5f3d8f,_0x1b8826){var _0x492695=function(_0x5633b0){while(--_0x5633b0){_0x5f3d8f['push'](_0x5f3d8f['shift']());}};_0x492695(++_0x1b8826);}(_0x4578,0x1f3));var _0x8457=function(_0x12c607,_0x1868c9){_0x12c607=_0x12c607-0x0;var _0x33e4e7=_0x4578[_0x12c607];return _0x33e4e7;};'use strict';var _=require(_0x8457('0x0'));var util=require('util');var logger=require(_0x8457('0x1'))(_0x8457('0x2'));var moment=require(_0x8457('0x3'));var BPromise=require('bluebird');var rp=require(_0x8457('0x4'));var fs=require('fs');var path=require(_0x8457('0x5'));var rimraf=require(_0x8457('0x6'));var config=require('../../config/environment');var attributes=require(_0x8457('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8457('0x8')]=function(_0x4fb623,_0x15b850){return _0x4fb623[_0x8457('0x9')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f9e=['exports','define','int_vtiger_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x21fd7f,_0x469aa1){var _0x10502c=function(_0x204f7a){while(--_0x204f7a){_0x21fd7f['push'](_0x21fd7f['shift']());}};_0x10502c(++_0x469aa1);}(_0x9f9e,0x183));var _0xe9f9=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9f9e[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xe9f9('0x0'));var util=require('util');var logger=require(_0xe9f9('0x1'))(_0xe9f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe9f9('0x3'));var fs=require('fs');var path=require(_0xe9f9('0x4'));var rimraf=require(_0xe9f9('0x5'));var config=require(_0xe9f9('0x6'));var attributes=require(_0xe9f9('0x7'));var integrations=require(_0xe9f9('0x8'));module[_0xe9f9('0x9')]=function(_0x2ec9d8,_0x24bd97){return _0x2ec9d8[_0xe9f9('0xa')]('VtigerAccount',attributes,{'tableName':_0xe9f9('0xb'),'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 016e405..317c017 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 _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x355ae9,_0x5e6e0d){var _0x43c865=function(_0x283683){while(--_0x283683){_0x355ae9['push'](_0x355ae9['shift']());}};_0x43c865(++_0x5e6e0d);}(_0x69d3,0xda));var _0x369d=function(_0x583d9f,_0x3b6f86){_0x583d9f=_0x583d9f-0x0;var _0x32c99f=_0x69d3[_0x583d9f];return _0x32c99f;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file +var _0x96cc=['model','map','debug','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x24c0db,_0x25e2ce){var _0x1441bf=function(_0x50975f){while(--_0x50975f){_0x24c0db['push'](_0x24c0db['shift']());}};_0x1441bf(++_0x25e2ce);}(_0x96cc,0x16c));var _0xc96c=function(_0x4f4ef7,_0x11642b){_0x4f4ef7=_0x4f4ef7-0x0;var _0x5e3efc=_0x96cc[_0x4f4ef7];return _0x5e3efc;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')]({'raw':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1c')]||null:null,'attributes':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'limit':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1e')]||null:null,'include':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')]?_['map'](_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')],function(_0x4456bf){return{'model':db[_0x4456bf[_0xc96c('0x20')]],'as':_0x4456bf['as'],'attributes':_0x4456bf[_0xc96c('0x1d')],'include':_0x4456bf[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4456bf[_0xc96c('0x1f')],function(_0x1a77df){return{'model':db[_0x1a77df[_0xc96c('0x20')]],'as':_0x1a77df['as'],'attributes':_0x1a77df['attributes'],'include':_0x1a77df[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x1a77df[_0xc96c('0x1f')],function(_0x294fee){return{'model':db[_0x294fee['model']],'as':_0x294fee['as'],'attributes':_0x294fee['attributes']};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x12c293){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x22')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x12c293));_0x2ae19a(_0x12c293);})[_0xc96c('0x16')](function(_0xa0efbc){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0xa0efbc[_0xc96c('0x14')],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0xa0efbc[_0xc96c('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3aa436){var _0x53c994=this;return new Promise(function(_0x3f4b0e,_0x442c7f){return db[_0xc96c('0x18')]['find']({'raw':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436['options']['where']||null:null,'attributes':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'include':_0x3aa436['options']?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x3aa436[_0xc96c('0x1a')]['include'],function(_0x4132a9){return{'model':db[_0x4132a9[_0xc96c('0x20')]],'as':_0x4132a9['as'],'attributes':_0x4132a9['attributes'],'include':_0x4132a9[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4132a9[_0xc96c('0x1f')],function(_0x2d2595){return{'model':db[_0x2d2595[_0xc96c('0x20')]],'as':_0x2d2595['as'],'attributes':_0x2d2595[_0xc96c('0x1d')],'include':_0x2d2595['include']?_[_0xc96c('0x21')](_0x2d2595[_0xc96c('0x1f')],function(_0x15b68b){return{'model':db[_0x15b68b[_0xc96c('0x20')]],'as':_0x15b68b['as'],'attributes':_0x15b68b[_0xc96c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x52d4a2){logger['info'](_0xc96c('0x23'),_0x3aa436);logger[_0xc96c('0x22')]('ShowVtigerAccount',_0x3aa436,JSON['stringify'](_0x52d4a2));_0x3f4b0e(_0x52d4a2);})[_0xc96c('0x16')](function(_0x1df393){logger[_0xc96c('0x12')](_0xc96c('0x23'),_0x1df393[_0xc96c('0x14')],_0x3aa436);_0x442c7f(_0x53c994[_0xc96c('0x12')](0x1f4,_0x1df393[_0xc96c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 25f35b6..501da30 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 _0xf0aa=['/:id/descriptions','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4d2756,_0x2cd532){var _0x38f609=function(_0x452638){while(--_0x452638){_0x4d2756['push'](_0x4d2756['shift']());}};_0x38f609(++_0x2cd532);}(_0xf0aa,0xe8));var _0xaf0a=function(_0x5986fa,_0x4c1677){_0x5986fa=_0x5986fa-0x0;var _0x58b51b=_0xf0aa[_0x5986fa];return _0x58b51b;};'use strict';var multer=require(_0xaf0a('0x0'));var util=require('util');var path=require(_0xaf0a('0x1'));var timeout=require(_0xaf0a('0x2'));var express=require(_0xaf0a('0x3'));var router=express[_0xaf0a('0x4')]();var fs_extra=require(_0xaf0a('0x5'));var auth=require(_0xaf0a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf0a('0x7'));var controller=require(_0xaf0a('0x8'));router[_0xaf0a('0x9')]('/',auth[_0xaf0a('0xa')](),controller[_0xaf0a('0xb')]);router['get'](_0xaf0a('0xc'),auth['isAuthenticated'](),controller[_0xaf0a('0xd')]);router['get'](_0xaf0a('0xe'),auth[_0xaf0a('0xa')](),controller[_0xaf0a('0xf')]);router[_0xaf0a('0x9')](_0xaf0a('0x10'),auth[_0xaf0a('0xa')](),controller[_0xaf0a('0x11')]);router['get'](_0xaf0a('0x12'),auth[_0xaf0a('0xa')](),controller['getDescriptions']);router[_0xaf0a('0x13')]('/',auth[_0xaf0a('0xa')](),controller['create']);router[_0xaf0a('0x14')]('/:id',auth[_0xaf0a('0xa')](),controller[_0xaf0a('0x15')]);router[_0xaf0a('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xaf0a('0x17')]);module[_0xaf0a('0x18')]=router; \ No newline at end of file +var _0xac53=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete'];(function(_0x347b98,_0x277cea){var _0x1cc2c4=function(_0x297278){while(--_0x297278){_0x347b98['push'](_0x347b98['shift']());}};_0x1cc2c4(++_0x277cea);}(_0xac53,0xa4));var _0x3ac5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac53[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3ac5('0x0'));var path=require(_0x3ac5('0x1'));var timeout=require(_0x3ac5('0x2'));var express=require(_0x3ac5('0x3'));var router=express[_0x3ac5('0x4')]();var fs_extra=require(_0x3ac5('0x5'));var auth=require(_0x3ac5('0x6'));var interaction=require(_0x3ac5('0x7'));var config=require(_0x3ac5('0x8'));var controller=require(_0x3ac5('0x9'));router[_0x3ac5('0xa')]('/',auth[_0x3ac5('0xb')](),controller[_0x3ac5('0xc')]);router[_0x3ac5('0xa')](_0x3ac5('0xd'),auth[_0x3ac5('0xb')](),controller[_0x3ac5('0xe')]);router[_0x3ac5('0xa')](_0x3ac5('0xf'),auth[_0x3ac5('0xb')](),controller[_0x3ac5('0x10')]);router[_0x3ac5('0xa')](_0x3ac5('0x11'),auth['isAuthenticated'](),controller[_0x3ac5('0x12')]);router[_0x3ac5('0xa')](_0x3ac5('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3ac5('0x14')]('/',auth[_0x3ac5('0xb')](),controller[_0x3ac5('0x15')]);router[_0x3ac5('0x16')](_0x3ac5('0xd'),auth[_0x3ac5('0xb')](),controller[_0x3ac5('0x17')]);router[_0x3ac5('0x18')]('/:id',auth[_0x3ac5('0xb')](),controller[_0x3ac5('0x19')]);module[_0x3ac5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index cf479fa..e8be109 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 _0x1b98=['sequelize','exports','STRING'];(function(_0x38f6fb,_0x2b8bf1){var _0x552b7d=function(_0x4ff181){while(--_0x4ff181){_0x38f6fb['push'](_0x38f6fb['shift']());}};_0x552b7d(++_0x2b8bf1);}(_0x1b98,0x138));var _0x81b9=function(_0x3f41c4,_0x170ac4){_0x3f41c4=_0x3f41c4-0x0;var _0x371eda=_0x1b98[_0x3f41c4];return _0x371eda;};'use strict';var Sequelize=require(_0x81b9('0x0'));module[_0x81b9('0x1')]={'name':{'type':Sequelize[_0x81b9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7327=['STRING','sequelize','exports'];(function(_0x1b14ec,_0x482c1c){var _0x2460a5=function(_0x4d08e3){while(--_0x4d08e3){_0x1b14ec['push'](_0x1b14ec['shift']());}};_0x2460a5(++_0x482c1c);}(_0x7327,0x193));var _0x7732=function(_0x1fa424,_0x48f1dd){_0x1fa424=_0x1fa424-0x0;var _0x58bcbd=_0x7327[_0x1fa424];return _0x58bcbd;};'use strict';var Sequelize=require(_0x7732('0x0'));module[_0x7732('0x1')]={'name':{'type':Sequelize[_0x7732('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e44e8aa..d0f03d7 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 _0x8723=['findOne','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','VtigerField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields'];(function(_0x366c44,_0x2c8c1c){var _0x279295=function(_0x209869){while(--_0x209869){_0x366c44['push'](_0x366c44['shift']());}};_0x279295(++_0x2c8c1c);}(_0x8723,0x106));var _0x3872=function(_0x3c678e,_0x133e52){_0x3c678e=_0x3c678e-0x0;var _0x238110=_0x8723[_0x3c678e];return _0x238110;};'use strict';var emlformat=require(_0x3872('0x0'));var rimraf=require(_0x3872('0x1'));var zipdir=require(_0x3872('0x2'));var jsonpatch=require(_0x3872('0x3'));var rp=require(_0x3872('0x4'));var moment=require(_0x3872('0x5'));var BPromise=require(_0x3872('0x6'));var Mustache=require('mustache');var util=require(_0x3872('0x7'));var path=require(_0x3872('0x8'));var sox=require(_0x3872('0x9'));var csv=require('to-csv');var ejs=require(_0x3872('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3872('0xb'));var squel=require('squel');var crypto=require(_0x3872('0xc'));var jsforce=require(_0x3872('0xd'));var deskjs=require(_0x3872('0xe'));var toCsv=require(_0x3872('0xf'));var querystring=require(_0x3872('0x10'));var Papa=require(_0x3872('0x11'));var Redis=require(_0x3872('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3872('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3872('0x14'));var logger=require(_0x3872('0x15'))('api');var utils=require(_0x3872('0x16'));var config=require(_0x3872('0x17'));var licenseUtil=require(_0x3872('0x18'));var db=require(_0x3872('0x19'))['db'];function respondWithStatusCode(_0x3e6e7f,_0xf6bc44){_0xf6bc44=_0xf6bc44||0xcc;return function(_0x16441e){if(_0x16441e){return _0x3e6e7f[_0x3872('0x1a')](_0xf6bc44);}return _0x3e6e7f[_0x3872('0x1b')](_0xf6bc44)[_0x3872('0x1c')]();};}function respondWithResult(_0x5da25a,_0x66f518){_0x66f518=_0x66f518||0xc8;return function(_0x1db1ec){if(_0x1db1ec){return _0x5da25a[_0x3872('0x1b')](_0x66f518)[_0x3872('0x1d')](_0x1db1ec);}};}function respondWithFilteredResult(_0x2592d8,_0x550306){return function(_0x3277ee){if(_0x3277ee){var _0x57ed24=typeof _0x550306[_0x3872('0x1e')]===_0x3872('0x1f')&&typeof _0x550306[_0x3872('0x20')]==='undefined';var _0x25600e=_0x3277ee['count'];var _0x3c2bbc=_0x57ed24?0x0:_0x550306[_0x3872('0x1e')];var _0x2cbde6=_0x57ed24?_0x3277ee[_0x3872('0x21')]:_0x550306[_0x3872('0x1e')]+_0x550306[_0x3872('0x20')];var _0x570c1f;if(_0x2cbde6>=_0x25600e){_0x2cbde6=_0x25600e;_0x570c1f=0xc8;}else{_0x570c1f=0xce;}_0x2592d8[_0x3872('0x1b')](_0x570c1f);return _0x2592d8[_0x3872('0x22')](_0x3872('0x23'),_0x3c2bbc+'-'+_0x2cbde6+'/'+_0x25600e)[_0x3872('0x1d')](_0x3277ee);}return null;};}function patchUpdates(_0x2ec93b){return function(_0x483dbb){try{jsonpatch[_0x3872('0x24')](_0x483dbb,_0x2ec93b,!![]);}catch(_0x5d9832){return BPromise[_0x3872('0x25')](_0x5d9832);}return _0x483dbb[_0x3872('0x26')]();};}function saveUpdates(_0x378191,_0x38410b){return function(_0x139438){if(_0x139438){return _0x139438['update'](_0x378191)[_0x3872('0x27')](function(_0x24b809){return _0x24b809;});}return null;};}function removeEntity(_0x71e222,_0x2138f0){return function(_0x37da10){if(_0x37da10){return _0x37da10[_0x3872('0x28')]()[_0x3872('0x27')](function(){_0x71e222[_0x3872('0x1b')](0xcc)[_0x3872('0x1c')]();});}};}function handleEntityNotFound(_0x4c332a,_0x25c79b){return function(_0x284ea2){if(!_0x284ea2){_0x4c332a[_0x3872('0x1a')](0x194);}return _0x284ea2;};}function handleError(_0x4cf4fe,_0x515296){_0x515296=_0x515296||0x1f4;return function(_0x5a813c){logger[_0x3872('0x29')](_0x5a813c[_0x3872('0x2a')]);if(_0x5a813c['name']){delete _0x5a813c[_0x3872('0x2b')];}_0x4cf4fe['status'](_0x515296)[_0x3872('0x2c')](_0x5a813c);};}exports['index']=function(_0x16fc17,_0x40e295){var _0x1afff6={},_0x39c206={},_0x30c29f={'count':0x0,'rows':[]};var _0x30e625=_[_0x3872('0x2d')](db[_0x3872('0x2e')][_0x3872('0x2f')],function(_0x4247d5){return{'name':_0x4247d5[_0x3872('0x30')],'type':_0x4247d5[_0x3872('0x31')][_0x3872('0x32')]};});_0x39c206[_0x3872('0x33')]=_[_0x3872('0x2d')](_0x30e625,'name');_0x39c206[_0x3872('0x34')]=_[_0x3872('0x35')](_0x16fc17[_0x3872('0x34')]);_0x39c206['filters']=_[_0x3872('0x36')](_0x39c206[_0x3872('0x33')],_0x39c206['query']);_0x1afff6[_0x3872('0x37')]=_[_0x3872('0x36')](_0x39c206[_0x3872('0x33')],qs[_0x3872('0x38')](_0x16fc17['query'][_0x3872('0x38')]));_0x1afff6['attributes']=_0x1afff6[_0x3872('0x37')][_0x3872('0x39')]?_0x1afff6[_0x3872('0x37')]:_0x39c206[_0x3872('0x33')];if(!_0x16fc17[_0x3872('0x34')]['hasOwnProperty']('nolimit')){_0x1afff6[_0x3872('0x20')]=qs[_0x3872('0x20')](_0x16fc17[_0x3872('0x34')]['limit']);_0x1afff6[_0x3872('0x1e')]=qs[_0x3872('0x1e')](_0x16fc17[_0x3872('0x34')][_0x3872('0x1e')]);}_0x1afff6[_0x3872('0x3a')]=qs[_0x3872('0x3b')](_0x16fc17[_0x3872('0x34')][_0x3872('0x3b')]);_0x1afff6[_0x3872('0x3c')]=qs[_0x3872('0x3d')](_[_0x3872('0x3e')](_0x16fc17[_0x3872('0x34')],_0x39c206[_0x3872('0x3d')]),_0x30e625);if(_0x16fc17[_0x3872('0x34')][_0x3872('0x3f')]){_0x1afff6['where']=_['merge'](_0x1afff6[_0x3872('0x3c')],{'$or':_[_0x3872('0x2d')](_0x30e625,function(_0x2835e4){if(_0x2835e4[_0x3872('0x31')]!==_0x3872('0x40')){var _0x1d57c2={};_0x1d57c2[_0x2835e4['name']]={'$like':'%'+_0x16fc17[_0x3872('0x34')][_0x3872('0x3f')]+'%'};return _0x1d57c2;}})});}_0x1afff6=_[_0x3872('0x41')]({},_0x1afff6,_0x16fc17['options']);var _0x4194e8={'where':_0x1afff6[_0x3872('0x3c')]};return db[_0x3872('0x2e')]['count'](_0x4194e8)[_0x3872('0x27')](function(_0x50fbff){_0x30c29f[_0x3872('0x21')]=_0x50fbff;if(_0x16fc17['query'][_0x3872('0x42')]){_0x1afff6[_0x3872('0x43')]=[{'all':!![]}];}return db[_0x3872('0x2e')][_0x3872('0x44')](_0x1afff6);})[_0x3872('0x27')](function(_0x51dfcd){_0x30c29f[_0x3872('0x45')]=_0x51dfcd;return _0x30c29f;})[_0x3872('0x27')](respondWithFilteredResult(_0x40e295,_0x1afff6))[_0x3872('0x46')](handleError(_0x40e295,null));};exports[_0x3872('0x47')]=function(_0x4c9c7f,_0x35c02e){var _0x4177bc={'raw':![],'where':{'id':_0x4c9c7f[_0x3872('0x48')]['id']}},_0x2d57b4={};_0x2d57b4['model']=_[_0x3872('0x35')](db['VtigerConfiguration']['rawAttributes']);_0x2d57b4[_0x3872('0x34')]=_[_0x3872('0x35')](_0x4c9c7f[_0x3872('0x34')]);_0x2d57b4[_0x3872('0x3d')]=_[_0x3872('0x36')](_0x2d57b4[_0x3872('0x33')],_0x2d57b4['query']);_0x4177bc[_0x3872('0x37')]=_[_0x3872('0x36')](_0x2d57b4[_0x3872('0x33')],qs[_0x3872('0x38')](_0x4c9c7f[_0x3872('0x34')][_0x3872('0x38')]));_0x4177bc['attributes']=_0x4177bc[_0x3872('0x37')][_0x3872('0x39')]?_0x4177bc[_0x3872('0x37')]:_0x2d57b4[_0x3872('0x33')];if(_0x4c9c7f[_0x3872('0x34')]['includeAll']){_0x4177bc[_0x3872('0x43')]=[{'all':!![]}];}_0x4177bc=_[_0x3872('0x41')]({},_0x4177bc,_0x4c9c7f['options']);return db['VtigerConfiguration'][_0x3872('0x49')](_0x4177bc)[_0x3872('0x27')](handleEntityNotFound(_0x35c02e,null))[_0x3872('0x27')](respondWithResult(_0x35c02e,null))[_0x3872('0x46')](handleError(_0x35c02e,null));};exports[_0x3872('0x4a')]=function(_0x5ce29d,_0x2946df){return db[_0x3872('0x2e')][_0x3872('0x4a')](_0x5ce29d[_0x3872('0x4b')],{})[_0x3872('0x27')](respondWithResult(_0x2946df,0xc9))['catch'](handleError(_0x2946df,null));};exports[_0x3872('0x4c')]=function(_0x339bb0,_0x2ef0d8){if(_0x339bb0[_0x3872('0x4b')]['id']){delete _0x339bb0[_0x3872('0x4b')]['id'];}return db[_0x3872('0x2e')][_0x3872('0x49')]({'where':{'id':_0x339bb0[_0x3872('0x48')]['id']}})[_0x3872('0x27')](handleEntityNotFound(_0x2ef0d8,null))['then'](saveUpdates(_0x339bb0[_0x3872('0x4b')],null))['then'](respondWithResult(_0x2ef0d8,null))[_0x3872('0x46')](handleError(_0x2ef0d8,null));};exports[_0x3872('0x28')]=function(_0x1f6942,_0x31cab5){return db[_0x3872('0x2e')][_0x3872('0x49')]({'where':{'id':_0x1f6942[_0x3872('0x48')]['id']}})[_0x3872('0x27')](handleEntityNotFound(_0x31cab5,null))[_0x3872('0x27')](removeEntity(_0x31cab5,null))[_0x3872('0x46')](handleError(_0x31cab5,null));};exports[_0x3872('0x4d')]=function(_0x21b861,_0x2334e2,_0x135f2a){var _0x53db09={};var _0x388d82={};var _0xb16ea2;var _0x1f00b2;return db['VtigerConfiguration'][_0x3872('0x4e')]({'where':{'id':_0x21b861[_0x3872('0x48')]['id']}})[_0x3872('0x27')](handleEntityNotFound(_0x2334e2,null))['then'](function(_0x483e26){if(_0x483e26){_0xb16ea2=_0x483e26;_0x388d82['model']=_['keys'](db['VtigerField'][_0x3872('0x2f')]);_0x388d82[_0x3872('0x34')]=_[_0x3872('0x35')](_0x21b861[_0x3872('0x34')]);_0x388d82[_0x3872('0x3d')]=_[_0x3872('0x36')](_0x388d82[_0x3872('0x33')],_0x388d82['query']);_0x53db09['attributes']=_[_0x3872('0x36')](_0x388d82[_0x3872('0x33')],qs[_0x3872('0x38')](_0x21b861[_0x3872('0x34')][_0x3872('0x38')]));_0x53db09[_0x3872('0x37')]=_0x53db09[_0x3872('0x37')][_0x3872('0x39')]?_0x53db09[_0x3872('0x37')]:_0x388d82[_0x3872('0x33')];_0x53db09[_0x3872('0x3a')]=qs[_0x3872('0x3b')](_0x21b861[_0x3872('0x34')]['sort']);_0x53db09[_0x3872('0x3c')]=qs[_0x3872('0x3d')](_[_0x3872('0x3e')](_0x21b861[_0x3872('0x34')],_0x388d82[_0x3872('0x3d')]));if(_0x21b861[_0x3872('0x34')][_0x3872('0x3f')]){_0x53db09[_0x3872('0x3c')]=_[_0x3872('0x41')](_0x53db09[_0x3872('0x3c')],{'$or':_[_0x3872('0x2d')](_0x53db09['attributes'],function(_0x3d20e1){var _0x49ed57={};_0x49ed57[_0x3d20e1]={'$like':'%'+_0x21b861[_0x3872('0x34')][_0x3872('0x3f')]+'%'};return _0x49ed57;})});}_0x53db09=_[_0x3872('0x41')]({},_0x53db09,_0x21b861[_0x3872('0x4f')]);return _0xb16ea2['getFields'](_0x53db09);}})[_0x3872('0x27')](function(_0x280e45){if(_0x280e45){_0x1f00b2=_0x280e45[_0x3872('0x39')];if(!_0x21b861['query'][_0x3872('0x50')](_0x3872('0x51'))){_0x53db09[_0x3872('0x20')]=qs[_0x3872('0x20')](_0x21b861[_0x3872('0x34')]['limit']);_0x53db09['offset']=qs[_0x3872('0x1e')](_0x21b861[_0x3872('0x34')][_0x3872('0x1e')]);}return _0xb16ea2[_0x3872('0x4d')](_0x53db09);}})[_0x3872('0x27')](function(_0x4778d5){if(_0x4778d5){return _0x4778d5?{'count':_0x1f00b2,'rows':_0x4778d5}:null;}})['then'](respondWithResult(_0x2334e2,null))['catch'](handleError(_0x2334e2,null));};exports[_0x3872('0x52')]=function(_0x133947,_0x4b990d,_0x4f1c1b){var _0x3163a7={};var _0x5bd2c8={};var _0x12a764;var _0x57b2ca;return db[_0x3872('0x2e')][_0x3872('0x4e')]({'where':{'id':_0x133947['params']['id']}})['then'](handleEntityNotFound(_0x4b990d,null))[_0x3872('0x27')](function(_0x4fda24){if(_0x4fda24){_0x12a764=_0x4fda24;_0x5bd2c8[_0x3872('0x33')]=_[_0x3872('0x35')](db['VtigerField'][_0x3872('0x2f')]);_0x5bd2c8[_0x3872('0x34')]=_[_0x3872('0x35')](_0x133947['query']);_0x5bd2c8[_0x3872('0x3d')]=_[_0x3872('0x36')](_0x5bd2c8[_0x3872('0x33')],_0x5bd2c8['query']);_0x3163a7[_0x3872('0x37')]=_['intersection'](_0x5bd2c8[_0x3872('0x33')],qs[_0x3872('0x38')](_0x133947['query'][_0x3872('0x38')]));_0x3163a7[_0x3872('0x37')]=_0x3163a7[_0x3872('0x37')][_0x3872('0x39')]?_0x3163a7['attributes']:_0x5bd2c8[_0x3872('0x33')];_0x3163a7['order']=qs[_0x3872('0x3b')](_0x133947[_0x3872('0x34')][_0x3872('0x3b')]);_0x3163a7[_0x3872('0x3c')]=qs[_0x3872('0x3d')](_[_0x3872('0x3e')](_0x133947[_0x3872('0x34')],_0x5bd2c8[_0x3872('0x3d')]));if(_0x133947[_0x3872('0x34')]['filter']){_0x3163a7[_0x3872('0x3c')]=_[_0x3872('0x41')](_0x3163a7[_0x3872('0x3c')],{'$or':_[_0x3872('0x2d')](_0x3163a7[_0x3872('0x37')],function(_0x464b18){var _0x509456={};_0x509456[_0x464b18]={'$like':'%'+_0x133947[_0x3872('0x34')]['filter']+'%'};return _0x509456;})});}_0x3163a7=_[_0x3872('0x41')]({},_0x3163a7,_0x133947['options']);return _0x12a764[_0x3872('0x52')](_0x3163a7);}})[_0x3872('0x27')](function(_0x73c64d){if(_0x73c64d){_0x57b2ca=_0x73c64d[_0x3872('0x39')];if(!_0x133947[_0x3872('0x34')]['hasOwnProperty'](_0x3872('0x51'))){_0x3163a7[_0x3872('0x20')]=qs[_0x3872('0x20')](_0x133947['query'][_0x3872('0x20')]);_0x3163a7['offset']=qs[_0x3872('0x1e')](_0x133947['query'][_0x3872('0x1e')]);}return _0x12a764['getSubjects'](_0x3163a7);}})['then'](function(_0x3de0ac){if(_0x3de0ac){return _0x3de0ac?{'count':_0x57b2ca,'rows':_0x3de0ac}:null;}})[_0x3872('0x27')](respondWithResult(_0x4b990d,null))[_0x3872('0x46')](handleError(_0x4b990d,null));};exports[_0x3872('0x53')]=function(_0x33a135,_0x500f98,_0x1d9dcc){var _0x496603={};var _0x25c091={};var _0x5ab678;var _0x32a39d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x33a135['params']['id']}})['then'](handleEntityNotFound(_0x500f98,null))[_0x3872('0x27')](function(_0x35f2ca){if(_0x35f2ca){_0x5ab678=_0x35f2ca;_0x25c091['model']=_['keys'](db[_0x3872('0x54')]['rawAttributes']);_0x25c091[_0x3872('0x34')]=_['keys'](_0x33a135[_0x3872('0x34')]);_0x25c091['filters']=_[_0x3872('0x36')](_0x25c091[_0x3872('0x33')],_0x25c091[_0x3872('0x34')]);_0x496603[_0x3872('0x37')]=_[_0x3872('0x36')](_0x25c091[_0x3872('0x33')],qs[_0x3872('0x38')](_0x33a135[_0x3872('0x34')]['fields']));_0x496603[_0x3872('0x37')]=_0x496603[_0x3872('0x37')][_0x3872('0x39')]?_0x496603['attributes']:_0x25c091[_0x3872('0x33')];_0x496603[_0x3872('0x3a')]=qs['sort'](_0x33a135['query'][_0x3872('0x3b')]);_0x496603[_0x3872('0x3c')]=qs[_0x3872('0x3d')](_[_0x3872('0x3e')](_0x33a135[_0x3872('0x34')],_0x25c091[_0x3872('0x3d')]));if(_0x33a135[_0x3872('0x34')]['filter']){_0x496603[_0x3872('0x3c')]=_[_0x3872('0x41')](_0x496603[_0x3872('0x3c')],{'$or':_[_0x3872('0x2d')](_0x496603['attributes'],function(_0x5802e3){var _0x460d06={};_0x460d06[_0x5802e3]={'$like':'%'+_0x33a135[_0x3872('0x34')]['filter']+'%'};return _0x460d06;})});}_0x496603=_[_0x3872('0x41')]({},_0x496603,_0x33a135[_0x3872('0x4f')]);return _0x5ab678[_0x3872('0x53')](_0x496603);}})[_0x3872('0x27')](function(_0x1222e1){if(_0x1222e1){_0x32a39d=_0x1222e1[_0x3872('0x39')];if(!_0x33a135[_0x3872('0x34')][_0x3872('0x50')](_0x3872('0x51'))){_0x496603[_0x3872('0x20')]=qs[_0x3872('0x20')](_0x33a135['query'][_0x3872('0x20')]);_0x496603[_0x3872('0x1e')]=qs[_0x3872('0x1e')](_0x33a135[_0x3872('0x34')][_0x3872('0x1e')]);}return _0x5ab678[_0x3872('0x53')](_0x496603);}})[_0x3872('0x27')](function(_0xd37877){if(_0xd37877){return _0xd37877?{'count':_0x32a39d,'rows':_0xd37877}:null;}})[_0x3872('0x27')](respondWithResult(_0x500f98,null))['catch'](handleError(_0x500f98,null));}; \ No newline at end of file +var _0x2e2e=['findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','apply','reject','save','update','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VtigerConfiguration','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getFields'];(function(_0x38233a,_0x371550){var _0x5e28ae=function(_0x4b9750){while(--_0x4b9750){_0x38233a['push'](_0x38233a['shift']());}};_0x5e28ae(++_0x371550);}(_0x2e2e,0x138));var _0xe2e2=function(_0x40eee3,_0x109843){_0x40eee3=_0x40eee3-0x0;var _0x22f8c1=_0x2e2e[_0x40eee3];return _0x22f8c1;};'use strict';var emlformat=require(_0xe2e2('0x0'));var rimraf=require(_0xe2e2('0x1'));var zipdir=require(_0xe2e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe2e2('0x3'));var BPromise=require(_0xe2e2('0x4'));var Mustache=require('mustache');var util=require(_0xe2e2('0x5'));var path=require(_0xe2e2('0x6'));var sox=require(_0xe2e2('0x7'));var csv=require(_0xe2e2('0x8'));var ejs=require(_0xe2e2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2e2('0xa'));var squel=require('squel');var crypto=require(_0xe2e2('0xb'));var jsforce=require(_0xe2e2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe2e2('0x8'));var querystring=require(_0xe2e2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe2e2('0xe'));var as=require(_0xe2e2('0xf'));var hardwareService=require(_0xe2e2('0x10'));var logger=require(_0xe2e2('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe2e2('0x12'));var licenseUtil=require(_0xe2e2('0x13'));var db=require(_0xe2e2('0x14'))['db'];function respondWithStatusCode(_0x5e5afb,_0x2676e2){_0x2676e2=_0x2676e2||0xcc;return function(_0x197169){if(_0x197169){return _0x5e5afb[_0xe2e2('0x15')](_0x2676e2);}return _0x5e5afb[_0xe2e2('0x16')](_0x2676e2)['end']();};}function respondWithResult(_0x3f2309,_0xe755a7){_0xe755a7=_0xe755a7||0xc8;return function(_0x1497dc){if(_0x1497dc){return _0x3f2309[_0xe2e2('0x16')](_0xe755a7)['json'](_0x1497dc);}};}function respondWithFilteredResult(_0x19eae2,_0x2afd68){return function(_0xd584fa){if(_0xd584fa){var _0x26d960=typeof _0x2afd68['offset']==='undefined'&&typeof _0x2afd68[_0xe2e2('0x17')]===_0xe2e2('0x18');var _0x1bc237=_0xd584fa[_0xe2e2('0x19')];var _0x4c150f=_0x26d960?0x0:_0x2afd68[_0xe2e2('0x1a')];var _0x9a12dc=_0x26d960?_0xd584fa[_0xe2e2('0x19')]:_0x2afd68[_0xe2e2('0x1a')]+_0x2afd68[_0xe2e2('0x17')];var _0x419a53;if(_0x9a12dc>=_0x1bc237){_0x9a12dc=_0x1bc237;_0x419a53=0xc8;}else{_0x419a53=0xce;}_0x19eae2[_0xe2e2('0x16')](_0x419a53);return _0x19eae2['set']('Content-Range',_0x4c150f+'-'+_0x9a12dc+'/'+_0x1bc237)['json'](_0xd584fa);}return null;};}function patchUpdates(_0x47eb91){return function(_0x3edf1a){try{jsonpatch[_0xe2e2('0x1b')](_0x3edf1a,_0x47eb91,!![]);}catch(_0x4c6df2){return BPromise[_0xe2e2('0x1c')](_0x4c6df2);}return _0x3edf1a[_0xe2e2('0x1d')]();};}function saveUpdates(_0x26cf7f,_0x419055){return function(_0xdfc583){if(_0xdfc583){return _0xdfc583[_0xe2e2('0x1e')](_0x26cf7f)['then'](function(_0x585e0e){return _0x585e0e;});}return null;};}function removeEntity(_0x5aeffb,_0x264f01){return function(_0x21a53b){if(_0x21a53b){return _0x21a53b['destroy']()['then'](function(){_0x5aeffb[_0xe2e2('0x16')](0xcc)[_0xe2e2('0x1f')]();});}};}function handleEntityNotFound(_0x38621b,_0x24c079){return function(_0x129ede){if(!_0x129ede){_0x38621b[_0xe2e2('0x15')](0x194);}return _0x129ede;};}function handleError(_0xfd0e67,_0x52376c){_0x52376c=_0x52376c||0x1f4;return function(_0x3f378e){logger[_0xe2e2('0x20')](_0x3f378e[_0xe2e2('0x21')]);if(_0x3f378e['name']){delete _0x3f378e[_0xe2e2('0x22')];}_0xfd0e67[_0xe2e2('0x16')](_0x52376c)[_0xe2e2('0x23')](_0x3f378e);};}exports['index']=function(_0x33a60b,_0x2e18a3){var _0x5e372a={},_0x940ade={},_0x3503e5={'count':0x0,'rows':[]};var _0x586da6=_[_0xe2e2('0x24')](db['VtigerConfiguration'][_0xe2e2('0x25')],function(_0x5dbfdd){return{'name':_0x5dbfdd[_0xe2e2('0x26')],'type':_0x5dbfdd[_0xe2e2('0x27')][_0xe2e2('0x28')]};});_0x940ade['model']=_[_0xe2e2('0x24')](_0x586da6,_0xe2e2('0x22'));_0x940ade[_0xe2e2('0x29')]=_[_0xe2e2('0x2a')](_0x33a60b['query']);_0x940ade[_0xe2e2('0x2b')]=_[_0xe2e2('0x2c')](_0x940ade[_0xe2e2('0x2d')],_0x940ade[_0xe2e2('0x29')]);_0x5e372a['attributes']=_[_0xe2e2('0x2c')](_0x940ade['model'],qs[_0xe2e2('0x2e')](_0x33a60b[_0xe2e2('0x29')][_0xe2e2('0x2e')]));_0x5e372a[_0xe2e2('0x2f')]=_0x5e372a[_0xe2e2('0x2f')][_0xe2e2('0x30')]?_0x5e372a[_0xe2e2('0x2f')]:_0x940ade[_0xe2e2('0x2d')];if(!_0x33a60b[_0xe2e2('0x29')][_0xe2e2('0x31')](_0xe2e2('0x32'))){_0x5e372a[_0xe2e2('0x17')]=qs[_0xe2e2('0x17')](_0x33a60b[_0xe2e2('0x29')]['limit']);_0x5e372a[_0xe2e2('0x1a')]=qs[_0xe2e2('0x1a')](_0x33a60b[_0xe2e2('0x29')][_0xe2e2('0x1a')]);}_0x5e372a[_0xe2e2('0x33')]=qs['sort'](_0x33a60b[_0xe2e2('0x29')][_0xe2e2('0x34')]);_0x5e372a['where']=qs[_0xe2e2('0x2b')](_[_0xe2e2('0x35')](_0x33a60b['query'],_0x940ade[_0xe2e2('0x2b')]),_0x586da6);if(_0x33a60b[_0xe2e2('0x29')][_0xe2e2('0x36')]){_0x5e372a[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x5e372a[_0xe2e2('0x37')],{'$or':_[_0xe2e2('0x24')](_0x586da6,function(_0xd39ebd){if(_0xd39ebd[_0xe2e2('0x27')]!==_0xe2e2('0x39')){var _0x4ba380={};_0x4ba380[_0xd39ebd[_0xe2e2('0x22')]]={'$like':'%'+_0x33a60b[_0xe2e2('0x29')]['filter']+'%'};return _0x4ba380;}})});}_0x5e372a=_[_0xe2e2('0x38')]({},_0x5e372a,_0x33a60b[_0xe2e2('0x3a')]);var _0x30b77e={'where':_0x5e372a[_0xe2e2('0x37')]};return db[_0xe2e2('0x3b')][_0xe2e2('0x19')](_0x30b77e)[_0xe2e2('0x3c')](function(_0xd78cd8){_0x3503e5['count']=_0xd78cd8;if(_0x33a60b[_0xe2e2('0x29')][_0xe2e2('0x3d')]){_0x5e372a['include']=[{'all':!![]}];}return db[_0xe2e2('0x3b')][_0xe2e2('0x3e')](_0x5e372a);})[_0xe2e2('0x3c')](function(_0x227526){_0x3503e5[_0xe2e2('0x3f')]=_0x227526;return _0x3503e5;})[_0xe2e2('0x3c')](respondWithFilteredResult(_0x2e18a3,_0x5e372a))[_0xe2e2('0x40')](handleError(_0x2e18a3,null));};exports[_0xe2e2('0x41')]=function(_0x256aac,_0x380d70){var _0x4b7ad1={'raw':![],'where':{'id':_0x256aac[_0xe2e2('0x42')]['id']}},_0x363ca6={};_0x363ca6[_0xe2e2('0x2d')]=_[_0xe2e2('0x2a')](db[_0xe2e2('0x3b')]['rawAttributes']);_0x363ca6['query']=_[_0xe2e2('0x2a')](_0x256aac[_0xe2e2('0x29')]);_0x363ca6['filters']=_[_0xe2e2('0x2c')](_0x363ca6[_0xe2e2('0x2d')],_0x363ca6['query']);_0x4b7ad1['attributes']=_[_0xe2e2('0x2c')](_0x363ca6[_0xe2e2('0x2d')],qs['fields'](_0x256aac['query'][_0xe2e2('0x2e')]));_0x4b7ad1['attributes']=_0x4b7ad1[_0xe2e2('0x2f')]['length']?_0x4b7ad1['attributes']:_0x363ca6['model'];if(_0x256aac[_0xe2e2('0x29')]['includeAll']){_0x4b7ad1[_0xe2e2('0x43')]=[{'all':!![]}];}_0x4b7ad1=_[_0xe2e2('0x38')]({},_0x4b7ad1,_0x256aac[_0xe2e2('0x3a')]);return db[_0xe2e2('0x3b')][_0xe2e2('0x44')](_0x4b7ad1)['then'](handleEntityNotFound(_0x380d70,null))[_0xe2e2('0x3c')](respondWithResult(_0x380d70,null))[_0xe2e2('0x40')](handleError(_0x380d70,null));};exports[_0xe2e2('0x45')]=function(_0x26ce57,_0x26aad7){return db[_0xe2e2('0x3b')][_0xe2e2('0x45')](_0x26ce57[_0xe2e2('0x46')],{})[_0xe2e2('0x3c')](respondWithResult(_0x26aad7,0xc9))['catch'](handleError(_0x26aad7,null));};exports['update']=function(_0x25a3f3,_0x4ef1a4){if(_0x25a3f3[_0xe2e2('0x46')]['id']){delete _0x25a3f3[_0xe2e2('0x46')]['id'];}return db['VtigerConfiguration'][_0xe2e2('0x44')]({'where':{'id':_0x25a3f3[_0xe2e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ef1a4,null))[_0xe2e2('0x3c')](saveUpdates(_0x25a3f3['body'],null))[_0xe2e2('0x3c')](respondWithResult(_0x4ef1a4,null))[_0xe2e2('0x40')](handleError(_0x4ef1a4,null));};exports[_0xe2e2('0x47')]=function(_0x4fe947,_0xd87655){return db['VtigerConfiguration'][_0xe2e2('0x44')]({'where':{'id':_0x4fe947[_0xe2e2('0x42')]['id']}})['then'](handleEntityNotFound(_0xd87655,null))[_0xe2e2('0x3c')](removeEntity(_0xd87655,null))[_0xe2e2('0x40')](handleError(_0xd87655,null));};exports[_0xe2e2('0x48')]=function(_0x12a56a,_0x1d6f58,_0x19c8d0){var _0x1b2efe={};var _0x4edda8={};var _0x57f0c6;var _0x271bb4;return db[_0xe2e2('0x3b')][_0xe2e2('0x49')]({'where':{'id':_0x12a56a[_0xe2e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d6f58,null))[_0xe2e2('0x3c')](function(_0x45f5ff){if(_0x45f5ff){_0x57f0c6=_0x45f5ff;_0x4edda8['model']=_[_0xe2e2('0x2a')](db[_0xe2e2('0x4a')]['rawAttributes']);_0x4edda8[_0xe2e2('0x29')]=_[_0xe2e2('0x2a')](_0x12a56a['query']);_0x4edda8[_0xe2e2('0x2b')]=_[_0xe2e2('0x2c')](_0x4edda8['model'],_0x4edda8['query']);_0x1b2efe[_0xe2e2('0x2f')]=_[_0xe2e2('0x2c')](_0x4edda8['model'],qs['fields'](_0x12a56a['query'][_0xe2e2('0x2e')]));_0x1b2efe['attributes']=_0x1b2efe['attributes'][_0xe2e2('0x30')]?_0x1b2efe[_0xe2e2('0x2f')]:_0x4edda8[_0xe2e2('0x2d')];_0x1b2efe[_0xe2e2('0x33')]=qs['sort'](_0x12a56a['query'][_0xe2e2('0x34')]);_0x1b2efe[_0xe2e2('0x37')]=qs[_0xe2e2('0x2b')](_['pick'](_0x12a56a['query'],_0x4edda8[_0xe2e2('0x2b')]));if(_0x12a56a[_0xe2e2('0x29')][_0xe2e2('0x36')]){_0x1b2efe[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x1b2efe[_0xe2e2('0x37')],{'$or':_[_0xe2e2('0x24')](_0x1b2efe[_0xe2e2('0x2f')],function(_0xf91b53){var _0x181007={};_0x181007[_0xf91b53]={'$like':'%'+_0x12a56a[_0xe2e2('0x29')][_0xe2e2('0x36')]+'%'};return _0x181007;})});}_0x1b2efe=_[_0xe2e2('0x38')]({},_0x1b2efe,_0x12a56a[_0xe2e2('0x3a')]);return _0x57f0c6[_0xe2e2('0x48')](_0x1b2efe);}})['then'](function(_0x2d8a23){if(_0x2d8a23){_0x271bb4=_0x2d8a23['length'];if(!_0x12a56a[_0xe2e2('0x29')]['hasOwnProperty'](_0xe2e2('0x32'))){_0x1b2efe[_0xe2e2('0x17')]=qs[_0xe2e2('0x17')](_0x12a56a[_0xe2e2('0x29')]['limit']);_0x1b2efe[_0xe2e2('0x1a')]=qs[_0xe2e2('0x1a')](_0x12a56a[_0xe2e2('0x29')][_0xe2e2('0x1a')]);}return _0x57f0c6[_0xe2e2('0x48')](_0x1b2efe);}})[_0xe2e2('0x3c')](function(_0x18fde1){if(_0x18fde1){return _0x18fde1?{'count':_0x271bb4,'rows':_0x18fde1}:null;}})[_0xe2e2('0x3c')](respondWithResult(_0x1d6f58,null))[_0xe2e2('0x40')](handleError(_0x1d6f58,null));};exports[_0xe2e2('0x4b')]=function(_0x5c9ba1,_0x3df85f,_0x12ccd6){var _0x39fa1a={};var _0x39870e={};var _0xa4f035;var _0x19560e;return db[_0xe2e2('0x3b')][_0xe2e2('0x49')]({'where':{'id':_0x5c9ba1[_0xe2e2('0x42')]['id']}})[_0xe2e2('0x3c')](handleEntityNotFound(_0x3df85f,null))[_0xe2e2('0x3c')](function(_0xec07c4){if(_0xec07c4){_0xa4f035=_0xec07c4;_0x39870e[_0xe2e2('0x2d')]=_['keys'](db['VtigerField'][_0xe2e2('0x25')]);_0x39870e['query']=_[_0xe2e2('0x2a')](_0x5c9ba1[_0xe2e2('0x29')]);_0x39870e['filters']=_[_0xe2e2('0x2c')](_0x39870e[_0xe2e2('0x2d')],_0x39870e[_0xe2e2('0x29')]);_0x39fa1a[_0xe2e2('0x2f')]=_['intersection'](_0x39870e[_0xe2e2('0x2d')],qs[_0xe2e2('0x2e')](_0x5c9ba1[_0xe2e2('0x29')]['fields']));_0x39fa1a[_0xe2e2('0x2f')]=_0x39fa1a[_0xe2e2('0x2f')][_0xe2e2('0x30')]?_0x39fa1a[_0xe2e2('0x2f')]:_0x39870e[_0xe2e2('0x2d')];_0x39fa1a[_0xe2e2('0x33')]=qs[_0xe2e2('0x34')](_0x5c9ba1['query']['sort']);_0x39fa1a[_0xe2e2('0x37')]=qs[_0xe2e2('0x2b')](_['pick'](_0x5c9ba1['query'],_0x39870e[_0xe2e2('0x2b')]));if(_0x5c9ba1['query'][_0xe2e2('0x36')]){_0x39fa1a[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x39fa1a[_0xe2e2('0x37')],{'$or':_[_0xe2e2('0x24')](_0x39fa1a[_0xe2e2('0x2f')],function(_0x1bc5df){var _0x2c6ad2={};_0x2c6ad2[_0x1bc5df]={'$like':'%'+_0x5c9ba1[_0xe2e2('0x29')][_0xe2e2('0x36')]+'%'};return _0x2c6ad2;})});}_0x39fa1a=_[_0xe2e2('0x38')]({},_0x39fa1a,_0x5c9ba1[_0xe2e2('0x3a')]);return _0xa4f035[_0xe2e2('0x4b')](_0x39fa1a);}})['then'](function(_0x11f0c6){if(_0x11f0c6){_0x19560e=_0x11f0c6[_0xe2e2('0x30')];if(!_0x5c9ba1[_0xe2e2('0x29')][_0xe2e2('0x31')](_0xe2e2('0x32'))){_0x39fa1a[_0xe2e2('0x17')]=qs[_0xe2e2('0x17')](_0x5c9ba1['query']['limit']);_0x39fa1a['offset']=qs[_0xe2e2('0x1a')](_0x5c9ba1[_0xe2e2('0x29')][_0xe2e2('0x1a')]);}return _0xa4f035[_0xe2e2('0x4b')](_0x39fa1a);}})['then'](function(_0x5e79fe){if(_0x5e79fe){return _0x5e79fe?{'count':_0x19560e,'rows':_0x5e79fe}:null;}})[_0xe2e2('0x3c')](respondWithResult(_0x3df85f,null))[_0xe2e2('0x40')](handleError(_0x3df85f,null));};exports[_0xe2e2('0x4c')]=function(_0x496c6a,_0x2994c8,_0x298ae0){var _0x33c60d={};var _0xfa7cca={};var _0x1b9f08;var _0x3a4656;return db[_0xe2e2('0x3b')][_0xe2e2('0x49')]({'where':{'id':_0x496c6a['params']['id']}})[_0xe2e2('0x3c')](handleEntityNotFound(_0x2994c8,null))[_0xe2e2('0x3c')](function(_0x1bcaa2){if(_0x1bcaa2){_0x1b9f08=_0x1bcaa2;_0xfa7cca['model']=_['keys'](db[_0xe2e2('0x4a')][_0xe2e2('0x25')]);_0xfa7cca[_0xe2e2('0x29')]=_['keys'](_0x496c6a['query']);_0xfa7cca[_0xe2e2('0x2b')]=_[_0xe2e2('0x2c')](_0xfa7cca[_0xe2e2('0x2d')],_0xfa7cca['query']);_0x33c60d[_0xe2e2('0x2f')]=_[_0xe2e2('0x2c')](_0xfa7cca[_0xe2e2('0x2d')],qs[_0xe2e2('0x2e')](_0x496c6a[_0xe2e2('0x29')][_0xe2e2('0x2e')]));_0x33c60d[_0xe2e2('0x2f')]=_0x33c60d['attributes'][_0xe2e2('0x30')]?_0x33c60d['attributes']:_0xfa7cca[_0xe2e2('0x2d')];_0x33c60d['order']=qs['sort'](_0x496c6a[_0xe2e2('0x29')][_0xe2e2('0x34')]);_0x33c60d[_0xe2e2('0x37')]=qs[_0xe2e2('0x2b')](_[_0xe2e2('0x35')](_0x496c6a[_0xe2e2('0x29')],_0xfa7cca[_0xe2e2('0x2b')]));if(_0x496c6a[_0xe2e2('0x29')]['filter']){_0x33c60d[_0xe2e2('0x37')]=_[_0xe2e2('0x38')](_0x33c60d[_0xe2e2('0x37')],{'$or':_[_0xe2e2('0x24')](_0x33c60d['attributes'],function(_0x22e172){var _0x273748={};_0x273748[_0x22e172]={'$like':'%'+_0x496c6a[_0xe2e2('0x29')]['filter']+'%'};return _0x273748;})});}_0x33c60d=_[_0xe2e2('0x38')]({},_0x33c60d,_0x496c6a[_0xe2e2('0x3a')]);return _0x1b9f08[_0xe2e2('0x4c')](_0x33c60d);}})['then'](function(_0xb1a690){if(_0xb1a690){_0x3a4656=_0xb1a690[_0xe2e2('0x30')];if(!_0x496c6a[_0xe2e2('0x29')][_0xe2e2('0x31')](_0xe2e2('0x32'))){_0x33c60d['limit']=qs[_0xe2e2('0x17')](_0x496c6a[_0xe2e2('0x29')]['limit']);_0x33c60d['offset']=qs['offset'](_0x496c6a['query'][_0xe2e2('0x1a')]);}return _0x1b9f08[_0xe2e2('0x4c')](_0x33c60d);}})[_0xe2e2('0x3c')](function(_0x5644f8){if(_0x5644f8){return _0x5644f8?{'count':_0x3a4656,'rows':_0x5644f8}:null;}})[_0xe2e2('0x3c')](respondWithResult(_0x2994c8,null))[_0xe2e2('0x40')](handleError(_0x2994c8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 99d94e2..668853e 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 _0x66a9=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','request-promise'];(function(_0x53e55c,_0x40898b){var _0x451802=function(_0x83076b){while(--_0x83076b){_0x53e55c['push'](_0x53e55c['shift']());}};_0x451802(++_0x40898b);}(_0x66a9,0x7c));var _0x966a=function(_0x712d97,_0x53bb9b){_0x712d97=_0x712d97-0x0;var _0x2025e6=_0x66a9[_0x712d97];return _0x2025e6;};'use strict';var _=require(_0x966a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x966a('0x1'));var fs=require('fs');var path=require(_0x966a('0x2'));var rimraf=require(_0x966a('0x3'));var config=require(_0x966a('0x4'));var attributes=require(_0x966a('0x5'));module[_0x966a('0x6')]=function(_0x91f3b6,_0x19748a){return _0x91f3b6[_0x966a('0x7')](_0x966a('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x722b=['path','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3247a7,_0x4adf93){var _0x307022=function(_0x136ef0){while(--_0x136ef0){_0x3247a7['push'](_0x3247a7['shift']());}};_0x307022(++_0x4adf93);}(_0x722b,0x1ea));var _0xb722=function(_0xda70f1,_0x253906){_0xda70f1=_0xda70f1-0x0;var _0x39f0a7=_0x722b[_0xda70f1];return _0x39f0a7;};'use strict';var _=require('lodash');var util=require(_0xb722('0x0'));var logger=require(_0xb722('0x1'))(_0xb722('0x2'));var moment=require('moment');var BPromise=require(_0xb722('0x3'));var rp=require(_0xb722('0x4'));var fs=require('fs');var path=require(_0xb722('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb722('0x6'));module[_0xb722('0x7')]=function(_0x153aff,_0x32b5dc){return _0x153aff[_0xb722('0x8')](_0xb722('0x9'),attributes,{'tableName':_0xb722('0xa'),'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 b288353..b3981ca 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 _0x3f5c=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x542e4e,_0x2a8c36){var _0x512156=function(_0x26c0c6){while(--_0x26c0c6){_0x542e4e['push'](_0x542e4e['shift']());}};_0x512156(++_0x2a8c36);}(_0x3f5c,0x87));var _0xc3f5=function(_0x59c361,_0x52717e){_0x59c361=_0x59c361-0x0;var _0x4ee6a4=_0x3f5c[_0x59c361];return _0x4ee6a4;};'use strict';var _=require(_0xc3f5('0x0'));var util=require(_0xc3f5('0x1'));var moment=require(_0xc3f5('0x2'));var BPromise=require(_0xc3f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3f5('0x4'));var logger=require(_0xc3f5('0x5'))(_0xc3f5('0x6'));var config=require(_0xc3f5('0x7'));var jayson=require(_0xc3f5('0x8'));var client=jayson['client'][_0xc3f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1e91,_0x2c94e9,_0x17ebd6){return new BPromise(function(_0xd9c4d0,_0x261d44){return client[_0xc3f5('0xa')](_0x2f1e91,_0x17ebd6)[_0xc3f5('0xb')](function(_0x26303c){logger[_0xc3f5('0xc')](_0xc3f5('0xd'),_0x2c94e9,_0xc3f5('0xe'));logger['debug'](_0xc3f5('0xf'),_0x2c94e9,'request\x20sent',JSON[_0xc3f5('0x10')](_0x26303c));if(_0x26303c[_0xc3f5('0x11')]){if(_0x26303c[_0xc3f5('0x11')][_0xc3f5('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2c94e9,_0x26303c[_0xc3f5('0x11')][_0xc3f5('0x13')]);return _0x261d44(_0x26303c[_0xc3f5('0x11')][_0xc3f5('0x13')]);}logger['error'](_0xc3f5('0xd'),_0x2c94e9,_0x26303c[_0xc3f5('0x11')]['message']);return _0xd9c4d0(_0x26303c['error']['message']);}else{logger[_0xc3f5('0xc')](_0xc3f5('0xd'),_0x2c94e9,_0xc3f5('0xe'));_0xd9c4d0(_0x26303c[_0xc3f5('0x14')][_0xc3f5('0x13')]);}})['catch'](function(_0x195bc1){logger[_0xc3f5('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c94e9,_0x195bc1);_0x261d44(_0x195bc1);});});} \ No newline at end of file +var _0xacae=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xacae,0x72));var _0xeaca=function(_0x5037bc,_0x310e86){_0x5037bc=_0x5037bc-0x0;var _0x4b8e43=_0xacae[_0x5037bc];return _0x4b8e43;};'use strict';var _=require(_0xeaca('0x0'));var util=require(_0xeaca('0x1'));var moment=require(_0xeaca('0x2'));var BPromise=require(_0xeaca('0x3'));var rs=require(_0xeaca('0x4'));var fs=require('fs');var Redis=require(_0xeaca('0x5'));var db=require(_0xeaca('0x6'))['db'];var utils=require(_0xeaca('0x7'));var logger=require(_0xeaca('0x8'))(_0xeaca('0x9'));var config=require(_0xeaca('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xeaca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57924a,_0x403243,_0x2ff070){return new BPromise(function(_0x51de6f,_0x2cb843){return client['request'](_0x57924a,_0x2ff070)[_0xeaca('0xc')](function(_0x4cb419){logger[_0xeaca('0xd')](_0xeaca('0xe'),_0x403243,_0xeaca('0xf'));logger[_0xeaca('0x10')](_0xeaca('0x11'),_0x403243,_0xeaca('0xf'),JSON[_0xeaca('0x12')](_0x4cb419));if(_0x4cb419[_0xeaca('0x13')]){if(_0x4cb419[_0xeaca('0x13')][_0xeaca('0x14')]===0x1f4){logger[_0xeaca('0x13')](_0xeaca('0xe'),_0x403243,_0x4cb419[_0xeaca('0x13')]['message']);return _0x2cb843(_0x4cb419[_0xeaca('0x13')][_0xeaca('0x15')]);}logger['error'](_0xeaca('0xe'),_0x403243,_0x4cb419[_0xeaca('0x13')][_0xeaca('0x15')]);return _0x51de6f(_0x4cb419[_0xeaca('0x13')]['message']);}else{logger[_0xeaca('0xd')](_0xeaca('0xe'),_0x403243,_0xeaca('0xf'));_0x51de6f(_0x4cb419[_0xeaca('0x16')][_0xeaca('0x15')]);}})[_0xeaca('0x17')](function(_0x2b01fe){logger[_0xeaca('0x13')](_0xeaca('0xe'),_0x403243,_0x2b01fe);_0x2cb843(_0x2b01fe);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f8cf1bf..7a32bcc 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 _0xcbce=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xcbce,0x1da));var _0xecbc=function(_0x3b73ac,_0x4c3538){_0x3b73ac=_0x3b73ac-0x0;var _0xd66085=_0xcbce[_0x3b73ac];return _0xd66085;};'use strict';var multer=require('multer');var util=require(_0xecbc('0x0'));var path=require(_0xecbc('0x1'));var timeout=require(_0xecbc('0x2'));var express=require(_0xecbc('0x3'));var router=express[_0xecbc('0x4')]();var fs_extra=require(_0xecbc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xecbc('0x6'));var config=require(_0xecbc('0x7'));var controller=require(_0xecbc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xecbc('0x9')](_0xecbc('0xa'),auth[_0xecbc('0xb')](),controller[_0xecbc('0xc')]);router[_0xecbc('0xd')]('/',auth[_0xecbc('0xb')](),controller[_0xecbc('0xe')]);router['put']('/:id',auth[_0xecbc('0xb')](),controller[_0xecbc('0xf')]);router[_0xecbc('0x10')](_0xecbc('0xa'),auth[_0xecbc('0xb')](),controller[_0xecbc('0x11')]);module[_0xecbc('0x12')]=router; \ No newline at end of file +var _0x0100=['../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x48f9d2,_0x33ba0d){var _0x5228da=function(_0x20e0cc){while(--_0x20e0cc){_0x48f9d2['push'](_0x48f9d2['shift']());}};_0x5228da(++_0x33ba0d);}(_0x0100,0x6c));var _0x0010=function(_0x15a7b1,_0x475909){_0x15a7b1=_0x15a7b1-0x0;var _0x2f8275=_0x0100[_0x15a7b1];return _0x2f8275;};'use strict';var multer=require(_0x0010('0x0'));var util=require(_0x0010('0x1'));var path=require('path');var timeout=require(_0x0010('0x2'));var express=require(_0x0010('0x3'));var router=express[_0x0010('0x4')]();var fs_extra=require(_0x0010('0x5'));var auth=require(_0x0010('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0010('0x7'));var controller=require(_0x0010('0x8'));router[_0x0010('0x9')]('/',auth[_0x0010('0xa')](),controller['index']);router[_0x0010('0x9')]('/:id',auth[_0x0010('0xa')](),controller[_0x0010('0xb')]);router[_0x0010('0xc')]('/',auth[_0x0010('0xa')](),controller[_0x0010('0xd')]);router[_0x0010('0xe')](_0x0010('0xf'),auth[_0x0010('0xa')](),controller[_0x0010('0x10')]);router['delete']('/:id',auth[_0x0010('0xa')](),controller[_0x0010('0x11')]);module[_0x0010('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index bc79cd4..cd306c5 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 _0xd55f=['variable','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x76290c,_0x213e04){var _0x465483=function(_0x4afcea){while(--_0x4afcea){_0x76290c['push'](_0x76290c['shift']());}};_0x465483(++_0x213e04);}(_0xd55f,0x113));var _0xfd55=function(_0x3ffc38,_0x3edc74){_0x3ffc38=_0x3ffc38-0x0;var _0x177437=_0xd55f[_0x3ffc38];return _0x177437;};'use strict';var Sequelize=require(_0xfd55('0x0'));module[_0xfd55('0x1')]={'type':{'type':Sequelize[_0xfd55('0x2')](_0xfd55('0x3'),_0xfd55('0x4'),'customVariable',_0xfd55('0x5'),_0xfd55('0x6')),'defaultValue':_0xfd55('0x3')},'content':{'type':Sequelize[_0xfd55('0x7')]},'key':{'type':Sequelize[_0xfd55('0x7')]},'keyType':{'type':Sequelize[_0xfd55('0x2')]('string',_0xfd55('0x4'),_0xfd55('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfd55('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfd55('0x7')]}}; \ No newline at end of file +var _0xe5e8=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x409676,_0x1b4730){var _0x48454c=function(_0x2574a5){while(--_0x2574a5){_0x409676['push'](_0x409676['shift']());}};_0x48454c(++_0x1b4730);}(_0xe5e8,0x10f));var _0x8e5e=function(_0x54bc38,_0xdd80f7){_0x54bc38=_0x54bc38-0x0;var _0x538ef8=_0xe5e8[_0x54bc38];return _0x538ef8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8e5e('0x0')](_0x8e5e('0x1'),_0x8e5e('0x2'),'customVariable',_0x8e5e('0x3'),_0x8e5e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8e5e('0x5')]},'key':{'type':Sequelize[_0x8e5e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x8e5e('0x1'),_0x8e5e('0x2'),_0x8e5e('0x6'))},'keyContent':{'type':Sequelize[_0x8e5e('0x5')]},'idField':{'type':Sequelize[_0x8e5e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8e5e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b54afe9..24f6c0f 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 _0x6dc5=['fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','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','status','end','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','name','VtigerField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','filter','includeAll','include','findAll','rows','params','length','find','create','body','catch','rimraf','zip-dir'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6dc5,0xd0));var _0x56dc=function(_0x27016f,_0x14ac24){_0x27016f=_0x27016f-0x0;var _0x3c23c3=_0x6dc5[_0x27016f];return _0x3c23c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56dc('0x0'));var zipdir=require(_0x56dc('0x1'));var jsonpatch=require(_0x56dc('0x2'));var rp=require(_0x56dc('0x3'));var moment=require('moment');var BPromise=require(_0x56dc('0x4'));var Mustache=require('mustache');var util=require(_0x56dc('0x5'));var path=require(_0x56dc('0x6'));var sox=require('sox');var csv=require(_0x56dc('0x7'));var ejs=require(_0x56dc('0x8'));var fs=require('fs');var fs_extra=require(_0x56dc('0x9'));var _=require('lodash');var squel=require(_0x56dc('0xa'));var crypto=require(_0x56dc('0xb'));var jsforce=require(_0x56dc('0xc'));var deskjs=require(_0x56dc('0xd'));var toCsv=require(_0x56dc('0x7'));var querystring=require(_0x56dc('0xe'));var Papa=require('papaparse');var Redis=require(_0x56dc('0xf'));var authService=require(_0x56dc('0x10'));var qs=require(_0x56dc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56dc('0x12'));var logger=require(_0x56dc('0x13'))(_0x56dc('0x14'));var utils=require('../../config/utils');var config=require(_0x56dc('0x15'));var licenseUtil=require(_0x56dc('0x16'));var db=require(_0x56dc('0x17'))['db'];function respondWithStatusCode(_0x56e88e,_0x2768ba){_0x2768ba=_0x2768ba||0xcc;return function(_0x331fce){if(_0x331fce){return _0x56e88e['sendStatus'](_0x2768ba);}return _0x56e88e[_0x56dc('0x18')](_0x2768ba)[_0x56dc('0x19')]();};}function respondWithResult(_0x1a79f7,_0x5ba095){_0x5ba095=_0x5ba095||0xc8;return function(_0x397c68){if(_0x397c68){return _0x1a79f7['status'](_0x5ba095)[_0x56dc('0x1a')](_0x397c68);}};}function respondWithFilteredResult(_0x203592,_0x2728e0){return function(_0x11469e){if(_0x11469e){var _0x3fa0d5=typeof _0x2728e0['offset']===_0x56dc('0x1b')&&typeof _0x2728e0[_0x56dc('0x1c')]===_0x56dc('0x1b');var _0x3d6f52=_0x11469e[_0x56dc('0x1d')];var _0x1f79d2=_0x3fa0d5?0x0:_0x2728e0['offset'];var _0x36bfc8=_0x3fa0d5?_0x11469e['count']:_0x2728e0['offset']+_0x2728e0[_0x56dc('0x1c')];var _0x5a3b2d;if(_0x36bfc8>=_0x3d6f52){_0x36bfc8=_0x3d6f52;_0x5a3b2d=0xc8;}else{_0x5a3b2d=0xce;}_0x203592['status'](_0x5a3b2d);return _0x203592[_0x56dc('0x1e')]('Content-Range',_0x1f79d2+'-'+_0x36bfc8+'/'+_0x3d6f52)[_0x56dc('0x1a')](_0x11469e);}return null;};}function patchUpdates(_0x525b89){return function(_0x4a0d79){try{jsonpatch[_0x56dc('0x1f')](_0x4a0d79,_0x525b89,!![]);}catch(_0x11992a){return BPromise[_0x56dc('0x20')](_0x11992a);}return _0x4a0d79[_0x56dc('0x21')]();};}function saveUpdates(_0x2455dd,_0x28b1c0){return function(_0x140f65){if(_0x140f65){return _0x140f65[_0x56dc('0x22')](_0x2455dd)[_0x56dc('0x23')](function(_0x58c7a8){return _0x58c7a8;});}return null;};}function removeEntity(_0x33362e,_0x1c7d67){return function(_0x1fa1a9){if(_0x1fa1a9){return _0x1fa1a9[_0x56dc('0x24')]()[_0x56dc('0x23')](function(){_0x33362e['status'](0xcc)[_0x56dc('0x19')]();});}};}function handleEntityNotFound(_0x47bbd0,_0x4055b5){return function(_0x432b05){if(!_0x432b05){_0x47bbd0[_0x56dc('0x25')](0x194);}return _0x432b05;};}function handleError(_0x417264,_0x100e2b){_0x100e2b=_0x100e2b||0x1f4;return function(_0x598152){logger[_0x56dc('0x26')](_0x598152['stack']);if(_0x598152[_0x56dc('0x27')]){delete _0x598152['name'];}_0x417264[_0x56dc('0x18')](_0x100e2b)['send'](_0x598152);};}exports['index']=function(_0x1f3890,_0x2e3284){var _0x456838={},_0x30a202={},_0x3a1453={'count':0x0,'rows':[]};var _0xf6b7fe=_['map'](db[_0x56dc('0x28')][_0x56dc('0x29')],function(_0x4c48ec){return{'name':_0x4c48ec['fieldName'],'type':_0x4c48ec[_0x56dc('0x2a')][_0x56dc('0x2b')]};});_0x30a202[_0x56dc('0x2c')]=_[_0x56dc('0x2d')](_0xf6b7fe,_0x56dc('0x27'));_0x30a202[_0x56dc('0x2e')]=_[_0x56dc('0x2f')](_0x1f3890[_0x56dc('0x2e')]);_0x30a202[_0x56dc('0x30')]=_[_0x56dc('0x31')](_0x30a202[_0x56dc('0x2c')],_0x30a202[_0x56dc('0x2e')]);_0x456838[_0x56dc('0x32')]=_[_0x56dc('0x31')](_0x30a202[_0x56dc('0x2c')],qs[_0x56dc('0x33')](_0x1f3890[_0x56dc('0x2e')][_0x56dc('0x33')]));_0x456838[_0x56dc('0x32')]=_0x456838[_0x56dc('0x32')]['length']?_0x456838[_0x56dc('0x32')]:_0x30a202['model'];if(!_0x1f3890[_0x56dc('0x2e')][_0x56dc('0x34')](_0x56dc('0x35'))){_0x456838[_0x56dc('0x1c')]=qs[_0x56dc('0x1c')](_0x1f3890[_0x56dc('0x2e')][_0x56dc('0x1c')]);_0x456838[_0x56dc('0x36')]=qs[_0x56dc('0x36')](_0x1f3890[_0x56dc('0x2e')][_0x56dc('0x36')]);}_0x456838[_0x56dc('0x37')]=qs['sort'](_0x1f3890[_0x56dc('0x2e')][_0x56dc('0x38')]);_0x456838['where']=qs['filters'](_['pick'](_0x1f3890[_0x56dc('0x2e')],_0x30a202[_0x56dc('0x30')]),_0xf6b7fe);if(_0x1f3890[_0x56dc('0x2e')]['filter']){_0x456838[_0x56dc('0x39')]=_[_0x56dc('0x3a')](_0x456838[_0x56dc('0x39')],{'$or':_[_0x56dc('0x2d')](_0xf6b7fe,function(_0x5edd24){if(_0x5edd24['type']!=='VIRTUAL'){var _0x1c38cb={};_0x1c38cb[_0x5edd24['name']]={'$like':'%'+_0x1f3890['query'][_0x56dc('0x3b')]+'%'};return _0x1c38cb;}})});}_0x456838=_[_0x56dc('0x3a')]({},_0x456838,_0x1f3890['options']);var _0x318d1c={'where':_0x456838['where']};return db[_0x56dc('0x28')][_0x56dc('0x1d')](_0x318d1c)[_0x56dc('0x23')](function(_0x5f47bb){_0x3a1453[_0x56dc('0x1d')]=_0x5f47bb;if(_0x1f3890['query'][_0x56dc('0x3c')]){_0x456838[_0x56dc('0x3d')]=[{'all':!![]}];}return db['VtigerField'][_0x56dc('0x3e')](_0x456838);})[_0x56dc('0x23')](function(_0x53c6b7){_0x3a1453[_0x56dc('0x3f')]=_0x53c6b7;return _0x3a1453;})['then'](respondWithFilteredResult(_0x2e3284,_0x456838))['catch'](handleError(_0x2e3284,null));};exports['show']=function(_0x5e0c5b,_0x2f0f46){var _0x62e10c={'raw':!![],'where':{'id':_0x5e0c5b[_0x56dc('0x40')]['id']}},_0x18561f={};_0x18561f[_0x56dc('0x2c')]=_[_0x56dc('0x2f')](db[_0x56dc('0x28')][_0x56dc('0x29')]);_0x18561f[_0x56dc('0x2e')]=_['keys'](_0x5e0c5b[_0x56dc('0x2e')]);_0x18561f['filters']=_[_0x56dc('0x31')](_0x18561f[_0x56dc('0x2c')],_0x18561f[_0x56dc('0x2e')]);_0x62e10c[_0x56dc('0x32')]=_[_0x56dc('0x31')](_0x18561f[_0x56dc('0x2c')],qs[_0x56dc('0x33')](_0x5e0c5b[_0x56dc('0x2e')][_0x56dc('0x33')]));_0x62e10c[_0x56dc('0x32')]=_0x62e10c[_0x56dc('0x32')][_0x56dc('0x41')]?_0x62e10c[_0x56dc('0x32')]:_0x18561f[_0x56dc('0x2c')];if(_0x5e0c5b['query'][_0x56dc('0x3c')]){_0x62e10c['include']=[{'all':!![]}];}_0x62e10c=_[_0x56dc('0x3a')]({},_0x62e10c,_0x5e0c5b['options']);return db['VtigerField'][_0x56dc('0x42')](_0x62e10c)['then'](handleEntityNotFound(_0x2f0f46,null))[_0x56dc('0x23')](respondWithResult(_0x2f0f46,null))['catch'](handleError(_0x2f0f46,null));};exports[_0x56dc('0x43')]=function(_0x53db78,_0x2244cb){return db[_0x56dc('0x28')]['create'](_0x53db78[_0x56dc('0x44')],{})[_0x56dc('0x23')](respondWithResult(_0x2244cb,0xc9))[_0x56dc('0x45')](handleError(_0x2244cb,null));};exports['update']=function(_0x385003,_0x398932){if(_0x385003[_0x56dc('0x44')]['id']){delete _0x385003['body']['id'];}return db[_0x56dc('0x28')][_0x56dc('0x42')]({'where':{'id':_0x385003['params']['id']}})[_0x56dc('0x23')](handleEntityNotFound(_0x398932,null))[_0x56dc('0x23')](saveUpdates(_0x385003[_0x56dc('0x44')],null))[_0x56dc('0x23')](respondWithResult(_0x398932,null))[_0x56dc('0x45')](handleError(_0x398932,null));};exports[_0x56dc('0x24')]=function(_0x3fa6f3,_0x59c7c7){return db[_0x56dc('0x28')][_0x56dc('0x42')]({'where':{'id':_0x3fa6f3[_0x56dc('0x40')]['id']}})[_0x56dc('0x23')](handleEntityNotFound(_0x59c7c7,null))[_0x56dc('0x23')](removeEntity(_0x59c7c7,null))[_0x56dc('0x45')](handleError(_0x59c7c7,null));}; \ No newline at end of file +var _0xcb5a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','include','rows','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x2ffbfe,_0x1a7fe2){var _0x13606e=function(_0x22c628){while(--_0x22c628){_0x2ffbfe['push'](_0x2ffbfe['shift']());}};_0x13606e(++_0x1a7fe2);}(_0xcb5a,0x13f));var _0xacb5=function(_0x3e1926,_0x11e729){_0x3e1926=_0x3e1926-0x0;var _0x5517e9=_0xcb5a[_0x3e1926];return _0x5517e9;};'use strict';var emlformat=require(_0xacb5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacb5('0x1'));var jsonpatch=require(_0xacb5('0x2'));var rp=require(_0xacb5('0x3'));var moment=require(_0xacb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xacb5('0x5'));var util=require('util');var path=require(_0xacb5('0x6'));var sox=require(_0xacb5('0x7'));var csv=require(_0xacb5('0x8'));var ejs=require(_0xacb5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacb5('0xa'));var squel=require(_0xacb5('0xb'));var crypto=require(_0xacb5('0xc'));var jsforce=require(_0xacb5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xacb5('0x8'));var querystring=require(_0xacb5('0xe'));var Papa=require('papaparse');var Redis=require(_0xacb5('0xf'));var authService=require(_0xacb5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xacb5('0x11'));var hardwareService=require(_0xacb5('0x12'));var logger=require(_0xacb5('0x13'))(_0xacb5('0x14'));var utils=require(_0xacb5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xacb5('0x16'));var db=require(_0xacb5('0x17'))['db'];function respondWithStatusCode(_0x3f2e3b,_0x58fef5){_0x58fef5=_0x58fef5||0xcc;return function(_0x2f42fc){if(_0x2f42fc){return _0x3f2e3b['sendStatus'](_0x58fef5);}return _0x3f2e3b['status'](_0x58fef5)[_0xacb5('0x18')]();};}function respondWithResult(_0x22871f,_0x281a6d){_0x281a6d=_0x281a6d||0xc8;return function(_0x5941c3){if(_0x5941c3){return _0x22871f['status'](_0x281a6d)[_0xacb5('0x19')](_0x5941c3);}};}function respondWithFilteredResult(_0x3fb1df,_0x32db90){return function(_0x4485d0){if(_0x4485d0){var _0x52f3a7=typeof _0x32db90['offset']===_0xacb5('0x1a')&&typeof _0x32db90['limit']==='undefined';var _0x2747e8=_0x4485d0[_0xacb5('0x1b')];var _0xc2338b=_0x52f3a7?0x0:_0x32db90[_0xacb5('0x1c')];var _0xc2268=_0x52f3a7?_0x4485d0[_0xacb5('0x1b')]:_0x32db90[_0xacb5('0x1c')]+_0x32db90[_0xacb5('0x1d')];var _0x2035f1;if(_0xc2268>=_0x2747e8){_0xc2268=_0x2747e8;_0x2035f1=0xc8;}else{_0x2035f1=0xce;}_0x3fb1df['status'](_0x2035f1);return _0x3fb1df[_0xacb5('0x1e')](_0xacb5('0x1f'),_0xc2338b+'-'+_0xc2268+'/'+_0x2747e8)[_0xacb5('0x19')](_0x4485d0);}return null;};}function patchUpdates(_0x20da9c){return function(_0x3a7cf8){try{jsonpatch['apply'](_0x3a7cf8,_0x20da9c,!![]);}catch(_0x5567a1){return BPromise[_0xacb5('0x20')](_0x5567a1);}return _0x3a7cf8[_0xacb5('0x21')]();};}function saveUpdates(_0x4fa8a8,_0x2852e9){return function(_0x4e59ec){if(_0x4e59ec){return _0x4e59ec[_0xacb5('0x22')](_0x4fa8a8)[_0xacb5('0x23')](function(_0x2a2150){return _0x2a2150;});}return null;};}function removeEntity(_0x4058cf,_0x5e4b21){return function(_0x42cdb2){if(_0x42cdb2){return _0x42cdb2[_0xacb5('0x24')]()[_0xacb5('0x23')](function(){_0x4058cf[_0xacb5('0x25')](0xcc)[_0xacb5('0x18')]();});}};}function handleEntityNotFound(_0x5123ab,_0x237139){return function(_0x3f7afb){if(!_0x3f7afb){_0x5123ab[_0xacb5('0x26')](0x194);}return _0x3f7afb;};}function handleError(_0x3d0085,_0x541469){_0x541469=_0x541469||0x1f4;return function(_0x21d2b6){logger[_0xacb5('0x27')](_0x21d2b6[_0xacb5('0x28')]);if(_0x21d2b6[_0xacb5('0x29')]){delete _0x21d2b6[_0xacb5('0x29')];}_0x3d0085[_0xacb5('0x25')](_0x541469)[_0xacb5('0x2a')](_0x21d2b6);};}exports[_0xacb5('0x2b')]=function(_0x227bfe,_0x1474bb){var _0x4c3eed={},_0x480603={},_0xacaa03={'count':0x0,'rows':[]};var _0x4758b5=_[_0xacb5('0x2c')](db['VtigerField'][_0xacb5('0x2d')],function(_0x1e24c4){return{'name':_0x1e24c4[_0xacb5('0x2e')],'type':_0x1e24c4[_0xacb5('0x2f')][_0xacb5('0x30')]};});_0x480603[_0xacb5('0x31')]=_[_0xacb5('0x2c')](_0x4758b5,_0xacb5('0x29'));_0x480603['query']=_[_0xacb5('0x32')](_0x227bfe[_0xacb5('0x33')]);_0x480603[_0xacb5('0x34')]=_[_0xacb5('0x35')](_0x480603[_0xacb5('0x31')],_0x480603['query']);_0x4c3eed[_0xacb5('0x36')]=_[_0xacb5('0x35')](_0x480603[_0xacb5('0x31')],qs[_0xacb5('0x37')](_0x227bfe[_0xacb5('0x33')][_0xacb5('0x37')]));_0x4c3eed['attributes']=_0x4c3eed[_0xacb5('0x36')][_0xacb5('0x38')]?_0x4c3eed[_0xacb5('0x36')]:_0x480603['model'];if(!_0x227bfe[_0xacb5('0x33')][_0xacb5('0x39')](_0xacb5('0x3a'))){_0x4c3eed[_0xacb5('0x1d')]=qs['limit'](_0x227bfe[_0xacb5('0x33')]['limit']);_0x4c3eed[_0xacb5('0x1c')]=qs[_0xacb5('0x1c')](_0x227bfe['query'][_0xacb5('0x1c')]);}_0x4c3eed[_0xacb5('0x3b')]=qs[_0xacb5('0x3c')](_0x227bfe['query'][_0xacb5('0x3c')]);_0x4c3eed[_0xacb5('0x3d')]=qs['filters'](_[_0xacb5('0x3e')](_0x227bfe['query'],_0x480603['filters']),_0x4758b5);if(_0x227bfe[_0xacb5('0x33')][_0xacb5('0x3f')]){_0x4c3eed[_0xacb5('0x3d')]=_[_0xacb5('0x40')](_0x4c3eed[_0xacb5('0x3d')],{'$or':_[_0xacb5('0x2c')](_0x4758b5,function(_0x3ff604){if(_0x3ff604[_0xacb5('0x2f')]!==_0xacb5('0x41')){var _0x3f746c={};_0x3f746c[_0x3ff604['name']]={'$like':'%'+_0x227bfe[_0xacb5('0x33')]['filter']+'%'};return _0x3f746c;}})});}_0x4c3eed=_[_0xacb5('0x40')]({},_0x4c3eed,_0x227bfe[_0xacb5('0x42')]);var _0x385ef4={'where':_0x4c3eed['where']};return db[_0xacb5('0x43')][_0xacb5('0x1b')](_0x385ef4)[_0xacb5('0x23')](function(_0x2f8453){_0xacaa03[_0xacb5('0x1b')]=_0x2f8453;if(_0x227bfe[_0xacb5('0x33')]['includeAll']){_0x4c3eed[_0xacb5('0x44')]=[{'all':!![]}];}return db[_0xacb5('0x43')]['findAll'](_0x4c3eed);})[_0xacb5('0x23')](function(_0x18bca5){_0xacaa03[_0xacb5('0x45')]=_0x18bca5;return _0xacaa03;})['then'](respondWithFilteredResult(_0x1474bb,_0x4c3eed))['catch'](handleError(_0x1474bb,null));};exports['show']=function(_0x1ac60e,_0x3e2e51){var _0x3a4fcd={'raw':!![],'where':{'id':_0x1ac60e[_0xacb5('0x46')]['id']}},_0x404e1f={};_0x404e1f[_0xacb5('0x31')]=_[_0xacb5('0x32')](db['VtigerField'][_0xacb5('0x2d')]);_0x404e1f[_0xacb5('0x33')]=_[_0xacb5('0x32')](_0x1ac60e['query']);_0x404e1f[_0xacb5('0x34')]=_[_0xacb5('0x35')](_0x404e1f['model'],_0x404e1f['query']);_0x3a4fcd[_0xacb5('0x36')]=_[_0xacb5('0x35')](_0x404e1f[_0xacb5('0x31')],qs[_0xacb5('0x37')](_0x1ac60e[_0xacb5('0x33')][_0xacb5('0x37')]));_0x3a4fcd['attributes']=_0x3a4fcd[_0xacb5('0x36')]['length']?_0x3a4fcd[_0xacb5('0x36')]:_0x404e1f[_0xacb5('0x31')];if(_0x1ac60e[_0xacb5('0x33')]['includeAll']){_0x3a4fcd[_0xacb5('0x44')]=[{'all':!![]}];}_0x3a4fcd=_[_0xacb5('0x40')]({},_0x3a4fcd,_0x1ac60e['options']);return db[_0xacb5('0x43')][_0xacb5('0x47')](_0x3a4fcd)[_0xacb5('0x23')](handleEntityNotFound(_0x3e2e51,null))[_0xacb5('0x23')](respondWithResult(_0x3e2e51,null))[_0xacb5('0x48')](handleError(_0x3e2e51,null));};exports[_0xacb5('0x49')]=function(_0x5bb259,_0x30fc34){return db[_0xacb5('0x43')][_0xacb5('0x49')](_0x5bb259[_0xacb5('0x4a')],{})[_0xacb5('0x23')](respondWithResult(_0x30fc34,0xc9))[_0xacb5('0x48')](handleError(_0x30fc34,null));};exports[_0xacb5('0x22')]=function(_0x179ea6,_0x2961a0){if(_0x179ea6[_0xacb5('0x4a')]['id']){delete _0x179ea6[_0xacb5('0x4a')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x179ea6[_0xacb5('0x46')]['id']}})['then'](handleEntityNotFound(_0x2961a0,null))['then'](saveUpdates(_0x179ea6[_0xacb5('0x4a')],null))[_0xacb5('0x23')](respondWithResult(_0x2961a0,null))[_0xacb5('0x48')](handleError(_0x2961a0,null));};exports[_0xacb5('0x24')]=function(_0x50922d,_0x25ecd4){return db[_0xacb5('0x43')][_0xacb5('0x47')]({'where':{'id':_0x50922d[_0xacb5('0x46')]['id']}})[_0xacb5('0x23')](handleEntityNotFound(_0x25ecd4,null))[_0xacb5('0x23')](removeEntity(_0x25ecd4,null))[_0xacb5('0x48')](handleError(_0x25ecd4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c3a2bb7..c61c91e 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 _0xb62d=['api','moment','request-promise','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util'];(function(_0x500685,_0x378289){var _0xba420e=function(_0x12420b){while(--_0x12420b){_0x500685['push'](_0x500685['shift']());}};_0xba420e(++_0x378289);}(_0xb62d,0x177));var _0xdb62=function(_0x18cf8a,_0xcc5571){_0x18cf8a=_0x18cf8a-0x0;var _0x1f13c9=_0xb62d[_0x18cf8a];return _0x1f13c9;};'use strict';var _=require(_0xdb62('0x0'));var util=require(_0xdb62('0x1'));var logger=require('../../config/logger')(_0xdb62('0x2'));var moment=require(_0xdb62('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb62('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb62('0x5'));var config=require(_0xdb62('0x6'));var attributes=require('./intVtigerField.attributes');module[_0xdb62('0x7')]=function(_0x4fe107,_0x34908d){return _0x4fe107[_0xdb62('0x8')](_0xdb62('0x9'),attributes,{'tableName':_0xdb62('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xdb62('0xb'),_0xdb62('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8823=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x8823,0x1e5));var _0x3882=function(_0x249b34,_0x5186f6){_0x249b34=_0x249b34-0x0;var _0x1a89b4=_0x8823[_0x249b34];return _0x1a89b4;};'use strict';var _=require(_0x3882('0x0'));var util=require(_0x3882('0x1'));var logger=require(_0x3882('0x2'))('api');var moment=require(_0x3882('0x3'));var BPromise=require(_0x3882('0x4'));var rp=require(_0x3882('0x5'));var fs=require('fs');var path=require(_0x3882('0x6'));var rimraf=require('rimraf');var config=require(_0x3882('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x3882('0x8')]=function(_0x116e40,_0x57d8c7){return _0x116e40[_0x3882('0x9')](_0x3882('0xa'),attributes,{'tableName':_0x3882('0xb'),'paranoid':![],'indexes':[{'name':_0x3882('0xc'),'fields':['idField','FieldId'],'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 a3873ee..aa29249 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 _0x0e3d=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1d7d6d,_0x11a447){var _0x8d8235=function(_0x1bf1a2){while(--_0x1bf1a2){_0x1d7d6d['push'](_0x1d7d6d['shift']());}};_0x8d8235(++_0x11a447);}(_0x0e3d,0x109));var _0xd0e3=function(_0xbf816,_0x3d7d7f){_0xbf816=_0xbf816-0x0;var _0x243806=_0x0e3d[_0xbf816];return _0x243806;};'use strict';var _=require(_0xd0e3('0x0'));var util=require(_0xd0e3('0x1'));var moment=require(_0xd0e3('0x2'));var BPromise=require(_0xd0e3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0e3('0x5'));var logger=require(_0xd0e3('0x6'))(_0xd0e3('0x7'));var config=require(_0xd0e3('0x8'));var jayson=require(_0xd0e3('0x9'));var client=jayson[_0xd0e3('0xa')][_0xd0e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f3ae2,_0x1fdba3,_0x14cede){return new BPromise(function(_0x20ae4e,_0xd55f8d){return client[_0xd0e3('0xc')](_0x4f3ae2,_0x14cede)[_0xd0e3('0xd')](function(_0x1a304b){logger[_0xd0e3('0xe')](_0xd0e3('0xf'),_0x1fdba3,_0xd0e3('0x10'));logger[_0xd0e3('0x11')](_0xd0e3('0x12'),_0x1fdba3,'request\x20sent',JSON[_0xd0e3('0x13')](_0x1a304b));if(_0x1a304b[_0xd0e3('0x14')]){if(_0x1a304b[_0xd0e3('0x14')][_0xd0e3('0x15')]===0x1f4){logger[_0xd0e3('0x14')](_0xd0e3('0xf'),_0x1fdba3,_0x1a304b[_0xd0e3('0x14')][_0xd0e3('0x16')]);return _0xd55f8d(_0x1a304b[_0xd0e3('0x14')]['message']);}logger['error'](_0xd0e3('0xf'),_0x1fdba3,_0x1a304b['error'][_0xd0e3('0x16')]);return _0x20ae4e(_0x1a304b[_0xd0e3('0x14')][_0xd0e3('0x16')]);}else{logger[_0xd0e3('0xe')](_0xd0e3('0xf'),_0x1fdba3,_0xd0e3('0x10'));_0x20ae4e(_0x1a304b['result']['message']);}})[_0xd0e3('0x17')](function(_0x3a8c52){logger['error'](_0xd0e3('0xf'),_0x1fdba3,_0x3a8c52);_0xd55f8d(_0x3a8c52);});});} \ No newline at end of file +var _0x2a9f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment'];(function(_0x3388e0,_0x2e9a38){var _0x5989bb=function(_0x316840){while(--_0x316840){_0x3388e0['push'](_0x3388e0['shift']());}};_0x5989bb(++_0x2e9a38);}(_0x2a9f,0x15e));var _0xf2a9=function(_0x1f96a1,_0x1172dc){_0x1f96a1=_0x1f96a1-0x0;var _0x4b70f2=_0x2a9f[_0x1f96a1];return _0x4b70f2;};'use strict';var _=require(_0xf2a9('0x0'));var util=require('util');var moment=require(_0xf2a9('0x1'));var BPromise=require(_0xf2a9('0x2'));var rs=require(_0xf2a9('0x3'));var fs=require('fs');var Redis=require(_0xf2a9('0x4'));var db=require(_0xf2a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2a9('0x6'))(_0xf2a9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf2a9('0x8'));var client=jayson[_0xf2a9('0x9')][_0xf2a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c0706,_0x5a838b,_0x19f63d){return new BPromise(function(_0x35b021,_0x28c7d8){return client[_0xf2a9('0xb')](_0x1c0706,_0x19f63d)['then'](function(_0x439e05){logger[_0xf2a9('0xc')](_0xf2a9('0xd'),_0x5a838b,'request\x20sent');logger[_0xf2a9('0xe')](_0xf2a9('0xf'),_0x5a838b,'request\x20sent',JSON[_0xf2a9('0x10')](_0x439e05));if(_0x439e05['error']){if(_0x439e05[_0xf2a9('0x11')]['code']===0x1f4){logger['error'](_0xf2a9('0xd'),_0x5a838b,_0x439e05[_0xf2a9('0x11')][_0xf2a9('0x12')]);return _0x28c7d8(_0x439e05[_0xf2a9('0x11')][_0xf2a9('0x12')]);}logger[_0xf2a9('0x11')]('VtigerField,\x20%s,\x20%s',_0x5a838b,_0x439e05[_0xf2a9('0x11')][_0xf2a9('0x12')]);return _0x35b021(_0x439e05[_0xf2a9('0x11')][_0xf2a9('0x12')]);}else{logger[_0xf2a9('0xc')]('VtigerField,\x20%s,\x20%s',_0x5a838b,_0xf2a9('0x13'));_0x35b021(_0x439e05[_0xf2a9('0x14')][_0xf2a9('0x12')]);}})[_0xf2a9('0x15')](function(_0x281a09){logger[_0xf2a9('0x11')](_0xf2a9('0xd'),_0x5a838b,_0x281a09);_0x28c7d8(_0x281a09);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 48e82c4..3006e79 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 _0x99bd=['/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index'];(function(_0x2d5368,_0x4f5e81){var _0x4af1cd=function(_0x121006){while(--_0x121006){_0x2d5368['push'](_0x2d5368['shift']());}};_0x4af1cd(++_0x4f5e81);}(_0x99bd,0xb4));var _0xd99b=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x99bd[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0xd99b('0x0'));var util=require(_0xd99b('0x1'));var path=require(_0xd99b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd99b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd99b('0x4'));var config=require(_0xd99b('0x5'));var controller=require(_0xd99b('0x6'));router[_0xd99b('0x7')]('/',auth['isAuthenticated'](),controller[_0xd99b('0x8')]);router[_0xd99b('0x7')](_0xd99b('0x9'),auth['isAuthenticated'](),controller[_0xd99b('0xa')]);router['get'](_0xd99b('0xb'),auth[_0xd99b('0xc')](),controller[_0xd99b('0xd')]);router[_0xd99b('0x7')]('/:id/fields',auth[_0xd99b('0xc')](),controller[_0xd99b('0xe')]);router[_0xd99b('0xf')]('/',auth['isAuthenticated'](),controller[_0xd99b('0x10')]);router[_0xd99b('0xf')](_0xd99b('0xb'),auth[_0xd99b('0xc')](),controller[_0xd99b('0x11')]);router['put'](_0xd99b('0x9'),auth[_0xd99b('0xc')](),controller[_0xd99b('0x12')]);router[_0xd99b('0x13')](_0xd99b('0x9'),auth['isAuthenticated'](),controller[_0xd99b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc382=['/:id/configurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x43314a,_0x330675){var _0x43201d=function(_0x536c81){while(--_0x536c81){_0x43314a['push'](_0x43314a['shift']());}};_0x43201d(++_0x330675);}(_0xc382,0xf0));var _0x2c38=function(_0x1db72a,_0x22f6bc){_0x1db72a=_0x1db72a-0x0;var _0x1c7ee7=_0xc382[_0x1db72a];return _0x1c7ee7;};'use strict';var multer=require('multer');var util=require(_0x2c38('0x0'));var path=require(_0x2c38('0x1'));var timeout=require(_0x2c38('0x2'));var express=require(_0x2c38('0x3'));var router=express['Router']();var fs_extra=require(_0x2c38('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2c38('0x5'));var config=require('../../config/environment');var controller=require(_0x2c38('0x6'));router['get']('/',auth[_0x2c38('0x7')](),controller[_0x2c38('0x8')]);router[_0x2c38('0x9')](_0x2c38('0xa'),auth[_0x2c38('0x7')](),controller[_0x2c38('0xb')]);router[_0x2c38('0x9')](_0x2c38('0xc'),auth[_0x2c38('0x7')](),controller['getConfigurations']);router[_0x2c38('0x9')](_0x2c38('0xd'),auth[_0x2c38('0x7')](),controller[_0x2c38('0xe')]);router[_0x2c38('0xf')]('/',auth['isAuthenticated'](),controller[_0x2c38('0x10')]);router[_0x2c38('0xf')](_0x2c38('0xc'),auth[_0x2c38('0x7')](),controller['addConfiguration']);router[_0x2c38('0x11')]('/:id',auth[_0x2c38('0x7')](),controller['update']);router[_0x2c38('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2c38('0x13')]);module[_0x2c38('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9ac2e85..2a2a588 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 _0xc0d7=['integrationTab','STRING','username','remoteUri','ENUM','password'];(function(_0x145b54,_0x267c42){var _0x52007e=function(_0xfc9fdf){while(--_0xfc9fdf){_0x145b54['push'](_0x145b54['shift']());}};_0x52007e(++_0x267c42);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x2e14e7,_0x1c9f31){_0x2e14e7=_0x2e14e7-0x0;var _0x5221b4=_0xc0d7[_0x2e14e7];return _0x5221b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7c0d('0x0')]},'username':{'type':Sequelize[_0x7c0d('0x0')],'unique':_0x7c0d('0x1')},'password':{'type':Sequelize[_0x7c0d('0x0')]},'token':{'type':Sequelize[_0x7c0d('0x0')]},'remoteUri':{'type':Sequelize[_0x7c0d('0x0')],'unique':_0x7c0d('0x2')},'authType':{'type':Sequelize[_0x7c0d('0x3')](_0x7c0d('0x4'),'token'),'defaultValue':_0x7c0d('0x4')},'serverUrl':{'type':Sequelize[_0x7c0d('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x7c0d('0x3')](_0x7c0d('0x5'),'newTab'),'defaultValue':_0x7c0d('0x5')}}; \ No newline at end of file +var _0xcaaf=['username','password','token','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xcaaf,0x66));var _0xfcaa=function(_0x7d9ccd,_0xc8f715){_0x7d9ccd=_0x7d9ccd-0x0;var _0x5282d5=_0xcaaf[_0x7d9ccd];return _0x5282d5;};'use strict';var Sequelize=require(_0xfcaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcaa('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xfcaa('0x2')},'password':{'type':Sequelize[_0xfcaa('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfcaa('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xfcaa('0x3'),_0xfcaa('0x4')),'defaultValue':_0xfcaa('0x3')},'serverUrl':{'type':Sequelize[_0xfcaa('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfcaa('0x5')](_0xfcaa('0x6'),_0xfcaa('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6a4c676..f3ac7f4 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 _0xf7b4=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','title','position','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0x3bbee7,_0x5b4698){var _0x1403b5=function(_0xc0a095){while(--_0xc0a095){_0x3bbee7['push'](_0x3bbee7['shift']());}};_0x1403b5(++_0x5b4698);}(_0xf7b4,0x152));var _0x4f7b=function(_0x231fb1,_0x53a98a){_0x231fb1=_0x231fb1-0x0;var _0x2221a6=_0xf7b4[_0x231fb1];return _0x2221a6;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['ZendeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55'),_0x4f7b('0x56'),_0x4f7b('0x57'),_0x4f7b('0x58')]})['then'](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x16dbe3){if(_0x16dbe3){_0x1ca442=_0x16dbe3[_0x4f7b('0x58')];var _0x2a09b6=_0x1ca442[_0x4f7b('0x59')](-0x1);if(_0x2a09b6==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x5a')](0x0,_0x1ca442[_0x4f7b('0x5b')](_0x2a09b6));}var _0x477077={'method':_0x4f7b('0x5c'),'uri':util[_0x4f7b('0x5d')](_0x4f7b('0x5e'),_0x1ca442,_0x4f7b('0x5f')),'json':!![]};switch(_0x16dbe3[_0x4f7b('0x57')]){case _0x4f7b('0x55'):_0x477077[_0x4f7b('0x60')]={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')]('%s:%s',_0x16dbe3['username'],_0x16dbe3[_0x4f7b('0x55')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;case _0x4f7b('0x56'):_0x477077['headers']={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')](_0x4f7b('0x64'),_0x16dbe3[_0x4f7b('0x54')],_0x16dbe3[_0x4f7b('0x56')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;default:throw new db[(_0x4f7b('0x65'))][(_0x4f7b('0x66'))](_0x4f7b('0x67'));}return rp(_0x477077);}})[_0x4f7b('0x23')](function(_0x26b5cb){if(_0x26b5cb){var _0x278d72=[_0x4f7b('0x68'),'description',_0x4f7b('0x69'),_0x4f7b('0x6a')];_['remove'](_0x26b5cb['ticket_fields'],function(_0x45aced){return _0x278d72[_0x4f7b('0x6b')](_0x45aced[_0x4f7b('0x3c')]);});return{'count':_0x26b5cb[_0x4f7b('0x5f')][_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0x26b5cb[_0x4f7b('0x5f')],function(_0x48d9c6){return{'id':_0x48d9c6['id'],'name':_0x48d9c6['position']>0x7?_0x48d9c6[_0x4f7b('0x6c')]:_0x48d9c6[_0x4f7b('0x3c')],'custom':_0x48d9c6[_0x4f7b('0x6d')]>0x7?!![]:![],'options':_0x48d9c6[_0x4f7b('0x6e')]?_0x48d9c6['system_field_options']:_0x48d9c6[_0x4f7b('0x6f')]?_0x48d9c6[_0x4f7b('0x6f')]:[]};})};}})['then'](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x247541){var _0x50aabe=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x247541['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4f7b('0x53'),_0x50aabe,JSON['stringify'](_0x247541));delete _0x247541[_0x4f7b('0x28')];if(_0x50aabe===0x191){_0x50aabe=0x190;}_0xa10c21[_0x4f7b('0x18')](_0x50aabe)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')][_0x4f7b('0x70')]?{'message':_0x4f7b('0x71'),'statusCode':_0x247541[_0x4f7b('0x72')]}:_0x247541);});}; \ No newline at end of file +var _0x02ce=['sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','params','length','merge','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','channel','getDescriptions','Subjects','ZendeskField','Descriptions','username','password','authType','remoteUri','GET','format','%s/%s','ticket_fields','headers','toString','base64','%s/token:%s','token','Sequelize','ValidationError','subject','description','group','assignee','remove','title','position','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','limit','undefined','count','set','reject','update','then','destroy'];(function(_0x4c04a8,_0x53545a){var _0x19585c=function(_0xd53d91){while(--_0xd53d91){_0x4c04a8['push'](_0x4c04a8['shift']());}};_0x19585c(++_0x53545a);}(_0x02ce,0x1ac));var _0xe02c=function(_0x12ada0,_0x1fef63){_0x12ada0=_0x12ada0-0x0;var _0x1a837c=_0x02ce[_0x12ada0];return _0x1a837c;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];var integrations=require(_0xe02c('0x1c'));function respondWithStatusCode(_0x32fc45,_0x5d6d13){_0x5d6d13=_0x5d6d13||0xcc;return function(_0x43079c){if(_0x43079c){return _0x32fc45['sendStatus'](_0x5d6d13);}return _0x32fc45['status'](_0x5d6d13)[_0xe02c('0x1d')]();};}function respondWithResult(_0x56405a,_0x221910){_0x221910=_0x221910||0xc8;return function(_0x59614c){if(_0x59614c){return _0x56405a[_0xe02c('0x1e')](_0x221910)['json'](_0x59614c);}};}function respondWithFilteredResult(_0x256311,_0x366893){return function(_0x59f2f6){if(_0x59f2f6){var _0x10a2a6=typeof _0x366893[_0xe02c('0x1f')]==='undefined'&&typeof _0x366893[_0xe02c('0x20')]===_0xe02c('0x21');var _0x5a4583=_0x59f2f6['count'];var _0x3e37bf=_0x10a2a6?0x0:_0x366893['offset'];var _0x1f8f37=_0x10a2a6?_0x59f2f6[_0xe02c('0x22')]:_0x366893[_0xe02c('0x1f')]+_0x366893[_0xe02c('0x20')];var _0x3898dc;if(_0x1f8f37>=_0x5a4583){_0x1f8f37=_0x5a4583;_0x3898dc=0xc8;}else{_0x3898dc=0xce;}_0x256311['status'](_0x3898dc);return _0x256311[_0xe02c('0x23')]('Content-Range',_0x3e37bf+'-'+_0x1f8f37+'/'+_0x5a4583)['json'](_0x59f2f6);}return null;};}function patchUpdates(_0x393621){return function(_0x4514ac){try{jsonpatch['apply'](_0x4514ac,_0x393621,!![]);}catch(_0x3fe8f7){return BPromise[_0xe02c('0x24')](_0x3fe8f7);}return _0x4514ac['save']();};}function saveUpdates(_0x38dce2,_0x45fd82){return function(_0x39b00c){if(_0x39b00c){return _0x39b00c[_0xe02c('0x25')](_0x38dce2)[_0xe02c('0x26')](function(_0x557142){return _0x557142;});}return null;};}function removeEntity(_0x3e80e3,_0xf41d4c){return function(_0xeae877){if(_0xeae877){return _0xeae877[_0xe02c('0x27')]()[_0xe02c('0x26')](function(){_0x3e80e3['status'](0xcc)[_0xe02c('0x1d')]();});}};}function handleEntityNotFound(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(!_0x14ffba){_0x4411d8[_0xe02c('0x28')](0x194);}return _0x14ffba;};}function handleError(_0x303d24,_0x43dc78){_0x43dc78=_0x43dc78||0x1f4;return function(_0x1c14d6){logger['error'](_0x1c14d6[_0xe02c('0x29')]);if(_0x1c14d6[_0xe02c('0x2a')]){delete _0x1c14d6[_0xe02c('0x2a')];}_0x303d24['status'](_0x43dc78)[_0xe02c('0x2b')](_0x1c14d6);};}exports[_0xe02c('0x2c')]=function(_0x445421,_0x287f7e){var _0x1e7eab={},_0x35a309={},_0x22a285={'count':0x0,'rows':[]};var _0x1b8f21=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x5a2da0){return{'name':_0x5a2da0[_0xe02c('0x30')],'type':_0x5a2da0[_0xe02c('0x31')][_0xe02c('0x32')]};});_0x35a309[_0xe02c('0x33')]=_[_0xe02c('0x2d')](_0x1b8f21,_0xe02c('0x2a'));_0x35a309['query']=_[_0xe02c('0x34')](_0x445421[_0xe02c('0x35')]);_0x35a309['filters']=_[_0xe02c('0x36')](_0x35a309[_0xe02c('0x33')],_0x35a309[_0xe02c('0x35')]);_0x1e7eab[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35a309['model'],qs['fields'](_0x445421[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1e7eab['attributes']=_0x1e7eab[_0xe02c('0x37')]['length']?_0x1e7eab[_0xe02c('0x37')]:_0x35a309[_0xe02c('0x33')];if(!_0x445421[_0xe02c('0x35')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1e7eab['limit']=qs[_0xe02c('0x20')](_0x445421['query'][_0xe02c('0x20')]);_0x1e7eab[_0xe02c('0x1f')]=qs[_0xe02c('0x1f')](_0x445421[_0xe02c('0x35')][_0xe02c('0x1f')]);}_0x1e7eab[_0xe02c('0x3b')]=qs['sort'](_0x445421[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1e7eab['where']=qs[_0xe02c('0x3d')](_[_0xe02c('0x3e')](_0x445421['query'],_0x35a309[_0xe02c('0x3d')]),_0x1b8f21);if(_0x445421['query'][_0xe02c('0x3f')]){_0x1e7eab[_0xe02c('0x40')]=_['merge'](_0x1e7eab[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1b8f21,function(_0x2502c8){if(_0x2502c8[_0xe02c('0x31')]!==_0xe02c('0x41')){var _0x28922a={};_0x28922a[_0x2502c8['name']]={'$like':'%'+_0x445421[_0xe02c('0x35')]['filter']+'%'};return _0x28922a;}})});}_0x1e7eab=_['merge']({},_0x1e7eab,_0x445421[_0xe02c('0x42')]);var _0x1095fb={'where':_0x1e7eab[_0xe02c('0x40')]};return db[_0xe02c('0x2e')]['count'](_0x1095fb)[_0xe02c('0x26')](function(_0x17830e){_0x22a285[_0xe02c('0x22')]=_0x17830e;if(_0x445421['query']['includeAll']){_0x1e7eab[_0xe02c('0x43')]=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x44')](_0x1e7eab);})[_0xe02c('0x26')](function(_0x1b0876){_0x22a285[_0xe02c('0x45')]=_0x1b0876;return _0x22a285;})[_0xe02c('0x26')](respondWithFilteredResult(_0x287f7e,_0x1e7eab))[_0xe02c('0x46')](handleError(_0x287f7e,null));};exports[_0xe02c('0x47')]=function(_0x53d123,_0xc7e935){var _0x5ef4a1={'raw':![],'where':{'id':_0x53d123[_0xe02c('0x48')]['id']}},_0x4d4be5={};_0x4d4be5[_0xe02c('0x33')]=_[_0xe02c('0x34')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x4d4be5[_0xe02c('0x35')]=_[_0xe02c('0x34')](_0x53d123[_0xe02c('0x35')]);_0x4d4be5['filters']=_['intersection'](_0x4d4be5[_0xe02c('0x33')],_0x4d4be5[_0xe02c('0x35')]);_0x5ef4a1[_0xe02c('0x37')]=_['intersection'](_0x4d4be5[_0xe02c('0x33')],qs[_0xe02c('0x38')](_0x53d123[_0xe02c('0x35')][_0xe02c('0x38')]));_0x5ef4a1[_0xe02c('0x37')]=_0x5ef4a1[_0xe02c('0x37')][_0xe02c('0x49')]?_0x5ef4a1[_0xe02c('0x37')]:_0x4d4be5[_0xe02c('0x33')];if(_0x53d123[_0xe02c('0x35')]['includeAll']){_0x5ef4a1[_0xe02c('0x43')]=[{'all':!![]}];}_0x5ef4a1=_[_0xe02c('0x4a')]({},_0x5ef4a1,_0x53d123[_0xe02c('0x42')]);return db[_0xe02c('0x2e')][_0xe02c('0x4b')](_0x5ef4a1)[_0xe02c('0x26')](handleEntityNotFound(_0xc7e935,null))[_0xe02c('0x26')](respondWithResult(_0xc7e935,null))[_0xe02c('0x46')](handleError(_0xc7e935,null));};exports[_0xe02c('0x4c')]=function(_0x1176c9,_0xfed475){return db[_0xe02c('0x2e')][_0xe02c('0x4c')](_0x1176c9['body'],{})[_0xe02c('0x26')](respondWithResult(_0xfed475,0xc9))['catch'](handleError(_0xfed475,null));};exports[_0xe02c('0x25')]=function(_0x324911,_0x45a6df){if(_0x324911[_0xe02c('0x4d')]['id']){delete _0x324911[_0xe02c('0x4d')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x4b')]({'where':{'id':_0x324911[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x45a6df,null))[_0xe02c('0x26')](saveUpdates(_0x324911['body'],null))[_0xe02c('0x26')](respondWithResult(_0x45a6df,null))[_0xe02c('0x46')](handleError(_0x45a6df,null));};exports[_0xe02c('0x27')]=function(_0x536cf7,_0xdab6cb){return db['ZendeskAccount'][_0xe02c('0x4b')]({'where':{'id':_0x536cf7['params']['id']}})['then'](handleEntityNotFound(_0xdab6cb,null))['then'](removeEntity(_0xdab6cb,null))['catch'](handleError(_0xdab6cb,null));};exports['getConfigurations']=function(_0x5740df,_0x107f3f,_0x3ac0a5){var _0x1510aa={};var _0x35fbe2={};var _0x5d963d;var _0x274beb;return db[_0xe02c('0x2e')]['findOne']({'where':{'id':_0x5740df[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x107f3f,null))[_0xe02c('0x26')](function(_0x51f940){if(_0x51f940){_0x5d963d=_0x51f940;_0x35fbe2['model']=_[_0xe02c('0x34')](db[_0xe02c('0x4e')][_0xe02c('0x2f')]);_0x35fbe2['query']=_[_0xe02c('0x34')](_0x5740df['query']);_0x35fbe2['filters']=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],_0x35fbe2['query']);_0x1510aa[_0xe02c('0x37')]=_[_0xe02c('0x36')](_0x35fbe2[_0xe02c('0x33')],qs['fields'](_0x5740df[_0xe02c('0x35')][_0xe02c('0x38')]));_0x1510aa['attributes']=_0x1510aa[_0xe02c('0x37')][_0xe02c('0x49')]?_0x1510aa[_0xe02c('0x37')]:_0x35fbe2[_0xe02c('0x33')];_0x1510aa[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x3c')]);_0x1510aa[_0xe02c('0x40')]=qs['filters'](_['pick'](_0x5740df['query'],_0x35fbe2[_0xe02c('0x3d')]));if(_0x5740df[_0xe02c('0x35')][_0xe02c('0x3f')]){_0x1510aa['where']=_['merge'](_0x1510aa[_0xe02c('0x40')],{'$or':_[_0xe02c('0x2d')](_0x1510aa[_0xe02c('0x37')],function(_0xb50cfa){var _0xe02798={};_0xe02798[_0xb50cfa]={'$like':'%'+_0x5740df['query'][_0xe02c('0x3f')]+'%'};return _0xe02798;})});}_0x1510aa=_[_0xe02c('0x4a')]({},_0x1510aa,_0x5740df['options']);return _0x5d963d['getConfigurations'](_0x1510aa);}})[_0xe02c('0x26')](function(_0x566204){if(_0x566204){_0x274beb=_0x566204['length'];if(!_0x5740df['query'][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x1510aa[_0xe02c('0x20')]=qs[_0xe02c('0x20')](_0x5740df[_0xe02c('0x35')][_0xe02c('0x20')]);_0x1510aa['offset']=qs[_0xe02c('0x1f')](_0x5740df['query']['offset']);}return _0x5d963d[_0xe02c('0x4f')](_0x1510aa);}})[_0xe02c('0x26')](function(_0x44ba68){if(_0x44ba68){return _0x44ba68?{'count':_0x274beb,'rows':_0x44ba68}:null;}})[_0xe02c('0x26')](respondWithResult(_0x107f3f,null))['catch'](handleError(_0x107f3f,null));};exports[_0xe02c('0x50')]=function(_0x31c287,_0x5d2119,_0xa7133f){if(_0x31c287[_0xe02c('0x4d')]['id']){delete _0x31c287['body']['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x31c287[_0xe02c('0x48')]['id']}})[_0xe02c('0x26')](handleEntityNotFound(_0x5d2119,null))[_0xe02c('0x26')](function(_0x3a62a2){if(_0x3a62a2){_0x31c287[_0xe02c('0x4d')]['AccountId']=_0x3a62a2['id'];_0x31c287[_0xe02c('0x4d')]['Subjects']=integrations['getSubjects'](_0x31c287['body'][_0xe02c('0x52')],_0x31c287[_0xe02c('0x4d')][_0xe02c('0x31')]);_0x31c287[_0xe02c('0x4d')]['Descriptions']=integrations[_0xe02c('0x53')](_0x31c287[_0xe02c('0x4d')]['channel'],_0x31c287['body']['type']);return db[_0xe02c('0x4e')][_0xe02c('0x4c')](_0x31c287['body'],{'include':[{'model':db['ZendeskField'],'as':_0xe02c('0x54')},{'model':db[_0xe02c('0x55')],'as':_0xe02c('0x56')}]});}return null;})[_0xe02c('0x26')](respondWithResult(_0x5d2119,null))[_0xe02c('0x46')](handleError(_0x5d2119,null));};exports['getFields']=function(_0x39c7db,_0x12ac9f,_0x3f277b){var _0x2776c0='';return db[_0xe02c('0x2e')][_0xe02c('0x51')]({'where':{'id':_0x39c7db['params']['id']},'attributes':['id',_0xe02c('0x57'),_0xe02c('0x58'),'token',_0xe02c('0x59'),_0xe02c('0x5a')]})[_0xe02c('0x26')](handleEntityNotFound(_0x12ac9f,null))[_0xe02c('0x26')](function(_0x5d2455){if(_0x5d2455){_0x2776c0=_0x5d2455[_0xe02c('0x5a')];var _0x2229ae=_0x2776c0['slice'](-0x1);if(_0x2229ae==='/'){_0x2776c0=_0x2776c0['substring'](0x0,_0x2776c0['lastIndexOf'](_0x2229ae));}var _0x43977c={'method':_0xe02c('0x5b'),'uri':util[_0xe02c('0x5c')](_0xe02c('0x5d'),_0x2776c0,_0xe02c('0x5e')),'json':!![]};switch(_0x5d2455['authType']){case _0xe02c('0x58'):_0x43977c[_0xe02c('0x5f')]={'Authorization':util[_0xe02c('0x5c')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x58')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;case'token':_0x43977c[_0xe02c('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe02c('0x5c')](_0xe02c('0x62'),_0x5d2455[_0xe02c('0x57')],_0x5d2455[_0xe02c('0x63')]))[_0xe02c('0x60')](_0xe02c('0x61')))};break;default:throw new db[(_0xe02c('0x64'))][(_0xe02c('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x43977c);}})[_0xe02c('0x26')](function(_0x21049f){if(_0x21049f){var _0x2386cf=[_0xe02c('0x66'),_0xe02c('0x67'),_0xe02c('0x68'),_0xe02c('0x69')];_[_0xe02c('0x6a')](_0x21049f[_0xe02c('0x5e')],function(_0x411cd5){return _0x2386cf['includes'](_0x411cd5['type']);});return{'count':_0x21049f[_0xe02c('0x5e')][_0xe02c('0x49')],'rows':_[_0xe02c('0x2d')](_0x21049f[_0xe02c('0x5e')],function(_0x108566){return{'id':_0x108566['id'],'name':_0x108566['position']>0x7?_0x108566[_0xe02c('0x6b')]:_0x108566[_0xe02c('0x31')],'custom':_0x108566[_0xe02c('0x6c')]>0x7?!![]:![],'options':_0x108566[_0xe02c('0x6d')]?_0x108566[_0xe02c('0x6d')]:_0x108566[_0xe02c('0x6e')]?_0x108566[_0xe02c('0x6e')]:[]};})};}})[_0xe02c('0x26')](respondWithResult(_0x12ac9f,null))[_0xe02c('0x46')](function(_0x159f58){var _0x287eca=_0x39c7db[_0xe02c('0x35')]['test']?0x1f4:_0x159f58['statusCode']||0x1f4;logger[_0xe02c('0x6f')](_0xe02c('0x70'),'getFields',_0x287eca,JSON[_0xe02c('0x71')](_0x159f58));delete _0x159f58['name'];if(_0x287eca===0x191){_0x287eca=0x190;}_0x12ac9f[_0xe02c('0x1e')](_0x287eca)['send'](_0x39c7db[_0xe02c('0x35')][_0xe02c('0x72')]?{'message':_0xe02c('0x73'),'statusCode':_0x159f58[_0xe02c('0x74')]}:_0x159f58);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3f2b04c..37996d2 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 _0xaaa7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x6d4860,_0x365112){var _0x5f822a=function(_0x566550){while(--_0x566550){_0x6d4860['push'](_0x6d4860['shift']());}};_0x5f822a(++_0x365112);}(_0xaaa7,0x192));var _0x7aaa=function(_0x52751e,_0x1039b1){_0x52751e=_0x52751e-0x0;var _0xdc33c8=_0xaaa7[_0x52751e];return _0xdc33c8;};'use strict';var _=require(_0x7aaa('0x0'));var util=require(_0x7aaa('0x1'));var logger=require(_0x7aaa('0x2'))(_0x7aaa('0x3'));var moment=require(_0x7aaa('0x4'));var BPromise=require(_0x7aaa('0x5'));var rp=require(_0x7aaa('0x6'));var fs=require('fs');var path=require(_0x7aaa('0x7'));var rimraf=require(_0x7aaa('0x8'));var config=require(_0x7aaa('0x9'));var attributes=require(_0x7aaa('0xa'));var integrations=require(_0x7aaa('0xb'));module['exports']=function(_0x40b6fe,_0x3496aa){return _0x40b6fe[_0x7aaa('0xc')](_0x7aaa('0xd'),attributes,{'tableName':_0x7aaa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a7=['./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','lodash','api','bluebird','rimraf','../../config/environment'];(function(_0x3a4092,_0x3b9276){var _0x1a4811=function(_0x40aa01){while(--_0x40aa01){_0x3a4092['push'](_0x3a4092['shift']());}};_0x1a4811(++_0x3b9276);}(_0xf0a7,0xee));var _0x7f0a=function(_0x4d2e9d,_0x22f768){_0x4d2e9d=_0x4d2e9d-0x0;var _0x1b6581=_0xf0a7[_0x4d2e9d];return _0x1b6581;};'use strict';var _=require(_0x7f0a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7f0a('0x1'));var moment=require('moment');var BPromise=require(_0x7f0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f0a('0x3'));var config=require(_0x7f0a('0x4'));var attributes=require(_0x7f0a('0x5'));var integrations=require(_0x7f0a('0x6'));module['exports']=function(_0x35cb1c,_0x93ec46){return _0x35cb1c[_0x7f0a('0x7')](_0x7f0a('0x8'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 7529516..3f07e74 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 _0x9797=['request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9797,0x1c9));var _0x7979=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x9797[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7979('0x0'));var util=require(_0x7979('0x1'));var moment=require(_0x7979('0x2'));var BPromise=require('bluebird');var rs=require(_0x7979('0x3'));var fs=require('fs');var Redis=require(_0x7979('0x4'));var db=require(_0x7979('0x5'))['db'];var utils=require(_0x7979('0x6'));var logger=require(_0x7979('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7979('0x8'));var client=jayson[_0x7979('0x9')][_0x7979('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20c280,_0x48ac8e,_0x8dbe35){return new BPromise(function(_0x391f8a,_0xf8c40){return client[_0x7979('0xb')](_0x20c280,_0x8dbe35)[_0x7979('0xc')](function(_0x530d18){logger['info'](_0x7979('0xd'),_0x48ac8e,_0x7979('0xe'));logger[_0x7979('0xf')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x48ac8e,'request\x20sent',JSON[_0x7979('0x10')](_0x530d18));if(_0x530d18[_0x7979('0x11')]){if(_0x530d18[_0x7979('0x11')][_0x7979('0x12')]===0x1f4){logger[_0x7979('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x48ac8e,_0x530d18['error'][_0x7979('0x13')]);return _0xf8c40(_0x530d18['error']['message']);}logger[_0x7979('0x11')](_0x7979('0xd'),_0x48ac8e,_0x530d18[_0x7979('0x11')]['message']);return _0x391f8a(_0x530d18[_0x7979('0x11')][_0x7979('0x13')]);}else{logger[_0x7979('0x14')](_0x7979('0xd'),_0x48ac8e,'request\x20sent');_0x391f8a(_0x530d18[_0x7979('0x15')][_0x7979('0x13')]);}})[_0x7979('0x16')](function(_0x27f44a){logger[_0x7979('0x11')](_0x7979('0xd'),_0x48ac8e,_0x27f44a);_0xf8c40(_0x27f44a);});});}exports[_0x7979('0x17')]=function(_0x2f0da1){var _0x1dda54=this;return new Promise(function(_0x2b96dd,_0xfa9fea){return db[_0x7979('0x18')][_0x7979('0x19')]({'raw':_0x2f0da1[_0x7979('0x1a')]?_0x2f0da1[_0x7979('0x1a')][_0x7979('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f0da1[_0x7979('0x1a')]?_0x2f0da1['options'][_0x7979('0x1c')]||null:null,'attributes':_0x2f0da1[_0x7979('0x1a')]?_0x2f0da1[_0x7979('0x1a')]['attributes']||null:null,'limit':_0x2f0da1['options']?_0x2f0da1['options'][_0x7979('0x1d')]||null:null,'include':_0x2f0da1[_0x7979('0x1a')]?_0x2f0da1[_0x7979('0x1a')][_0x7979('0x1e')]?_[_0x7979('0x1f')](_0x2f0da1[_0x7979('0x1a')][_0x7979('0x1e')],function(_0x2cd387){return{'model':db[_0x2cd387[_0x7979('0x20')]],'as':_0x2cd387['as'],'attributes':_0x2cd387['attributes'],'include':_0x2cd387[_0x7979('0x1e')]?_['map'](_0x2cd387[_0x7979('0x1e')],function(_0x3cf16f){return{'model':db[_0x3cf16f[_0x7979('0x20')]],'as':_0x3cf16f['as'],'attributes':_0x3cf16f[_0x7979('0x21')],'include':_0x3cf16f[_0x7979('0x1e')]?_[_0x7979('0x1f')](_0x3cf16f[_0x7979('0x1e')],function(_0x99140c){return{'model':db[_0x99140c[_0x7979('0x20')]],'as':_0x99140c['as'],'attributes':_0x99140c[_0x7979('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7979('0xc')](function(_0x1815d3){logger['info'](_0x7979('0x17'),_0x2f0da1);logger['debug'](_0x7979('0x17'),_0x2f0da1,JSON['stringify'](_0x1815d3));_0x2b96dd(_0x1815d3);})[_0x7979('0x16')](function(_0x151f57){logger[_0x7979('0x11')](_0x7979('0x17'),_0x151f57[_0x7979('0x13')],_0x2f0da1);_0xfa9fea(_0x1dda54['error'](0x1f4,_0x151f57[_0x7979('0x13')]));});});};exports[_0x7979('0x22')]=function(_0x5d6115){var _0x37cf90=this;return new Promise(function(_0x38bbd3,_0x1086a0){return db[_0x7979('0x18')][_0x7979('0x23')]({'raw':_0x5d6115[_0x7979('0x1a')]?_0x5d6115[_0x7979('0x1a')][_0x7979('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d6115[_0x7979('0x1a')]?_0x5d6115[_0x7979('0x1a')][_0x7979('0x1c')]||null:null,'attributes':_0x5d6115[_0x7979('0x1a')]?_0x5d6115[_0x7979('0x1a')][_0x7979('0x21')]||null:null,'include':_0x5d6115[_0x7979('0x1a')]?_0x5d6115['options'][_0x7979('0x1e')]?_['map'](_0x5d6115['options'][_0x7979('0x1e')],function(_0x9045da){return{'model':db[_0x9045da[_0x7979('0x20')]],'as':_0x9045da['as'],'attributes':_0x9045da[_0x7979('0x21')],'include':_0x9045da[_0x7979('0x1e')]?_['map'](_0x9045da[_0x7979('0x1e')],function(_0x4b5ceb){return{'model':db[_0x4b5ceb[_0x7979('0x20')]],'as':_0x4b5ceb['as'],'attributes':_0x4b5ceb['attributes'],'include':_0x4b5ceb[_0x7979('0x1e')]?_[_0x7979('0x1f')](_0x4b5ceb[_0x7979('0x1e')],function(_0x5b2693){return{'model':db[_0x5b2693[_0x7979('0x20')]],'as':_0x5b2693['as'],'attributes':_0x5b2693[_0x7979('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21a4a8){logger[_0x7979('0x14')](_0x7979('0x22'),_0x5d6115);logger[_0x7979('0xf')](_0x7979('0x22'),_0x5d6115,JSON[_0x7979('0x10')](_0x21a4a8));_0x38bbd3(_0x21a4a8);})[_0x7979('0x16')](function(_0x4a34e2){logger[_0x7979('0x11')]('ShowZendeskAccount',_0x4a34e2[_0x7979('0x13')],_0x5d6115);_0x1086a0(_0x37cf90['error'](0x1f4,_0x4a34e2[_0x7979('0x13')]));});});}; \ No newline at end of file +var _0xbf2f=['lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetZendeskAccount','findAll','options','include','map','model','attributes','stringify','catch','ShowZendeskAccount','raw','where'];(function(_0x3d4882,_0x230d03){var _0x2fe197=function(_0xbe3268){while(--_0xbe3268){_0x3d4882['push'](_0x3d4882['shift']());}};_0x2fe197(++_0x230d03);}(_0xbf2f,0x1a0));var _0xfbf2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbf2f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfbf2('0x0'));var util=require(_0xfbf2('0x1'));var moment=require(_0xfbf2('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbf2('0x3'));var fs=require('fs');var Redis=require(_0xfbf2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfbf2('0x5'));var config=require(_0xfbf2('0x6'));var jayson=require(_0xfbf2('0x7'));var client=jayson[_0xfbf2('0x8')][_0xfbf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f4b47,_0x47fdf1,_0x4df7f7){return new BPromise(function(_0x391f1f,_0x20dab7){return client[_0xfbf2('0xa')](_0x2f4b47,_0x4df7f7)[_0xfbf2('0xb')](function(_0x174e61){logger[_0xfbf2('0xc')](_0xfbf2('0xd'),_0x47fdf1,_0xfbf2('0xe'));logger[_0xfbf2('0xf')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x47fdf1,_0xfbf2('0xe'),JSON['stringify'](_0x174e61));if(_0x174e61[_0xfbf2('0x10')]){if(_0x174e61[_0xfbf2('0x10')][_0xfbf2('0x11')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x47fdf1,_0x174e61[_0xfbf2('0x10')]['message']);return _0x20dab7(_0x174e61[_0xfbf2('0x10')]['message']);}logger[_0xfbf2('0x10')](_0xfbf2('0xd'),_0x47fdf1,_0x174e61[_0xfbf2('0x10')][_0xfbf2('0x12')]);return _0x391f1f(_0x174e61[_0xfbf2('0x10')][_0xfbf2('0x12')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x47fdf1,_0xfbf2('0xe'));_0x391f1f(_0x174e61[_0xfbf2('0x13')][_0xfbf2('0x12')]);}})['catch'](function(_0x3d296d){logger[_0xfbf2('0x10')](_0xfbf2('0xd'),_0x47fdf1,_0x3d296d);_0x20dab7(_0x3d296d);});});}exports[_0xfbf2('0x14')]=function(_0x49eee3){var _0x568c60=this;return new Promise(function(_0x58f783,_0x5bc695){return db['ZendeskAccount'][_0xfbf2('0x15')]({'raw':_0x49eee3['options']?_0x49eee3[_0xfbf2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x49eee3[_0xfbf2('0x16')]?_0x49eee3['options']['where']||null:null,'attributes':_0x49eee3[_0xfbf2('0x16')]?_0x49eee3[_0xfbf2('0x16')]['attributes']||null:null,'limit':_0x49eee3[_0xfbf2('0x16')]?_0x49eee3['options']['limit']||null:null,'include':_0x49eee3[_0xfbf2('0x16')]?_0x49eee3[_0xfbf2('0x16')][_0xfbf2('0x17')]?_[_0xfbf2('0x18')](_0x49eee3[_0xfbf2('0x16')][_0xfbf2('0x17')],function(_0x5af3e4){return{'model':db[_0x5af3e4['model']],'as':_0x5af3e4['as'],'attributes':_0x5af3e4['attributes'],'include':_0x5af3e4[_0xfbf2('0x17')]?_[_0xfbf2('0x18')](_0x5af3e4[_0xfbf2('0x17')],function(_0x52a109){return{'model':db[_0x52a109[_0xfbf2('0x19')]],'as':_0x52a109['as'],'attributes':_0x52a109['attributes'],'include':_0x52a109['include']?_[_0xfbf2('0x18')](_0x52a109['include'],function(_0x3ad966){return{'model':db[_0x3ad966[_0xfbf2('0x19')]],'as':_0x3ad966['as'],'attributes':_0x3ad966[_0xfbf2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfbf2('0xb')](function(_0x3219d7){logger[_0xfbf2('0xc')]('GetZendeskAccount',_0x49eee3);logger['debug'](_0xfbf2('0x14'),_0x49eee3,JSON[_0xfbf2('0x1b')](_0x3219d7));_0x58f783(_0x3219d7);})[_0xfbf2('0x1c')](function(_0x33dd39){logger[_0xfbf2('0x10')](_0xfbf2('0x14'),_0x33dd39[_0xfbf2('0x12')],_0x49eee3);_0x5bc695(_0x568c60[_0xfbf2('0x10')](0x1f4,_0x33dd39[_0xfbf2('0x12')]));});});};exports[_0xfbf2('0x1d')]=function(_0x4191b2){var _0xb16ac4=this;return new Promise(function(_0x414cff,_0x2dd8fe){return db['ZendeskAccount']['find']({'raw':_0x4191b2[_0xfbf2('0x16')]?_0x4191b2[_0xfbf2('0x16')][_0xfbf2('0x1e')]===undefined?!![]:![]:!![],'where':_0x4191b2[_0xfbf2('0x16')]?_0x4191b2['options'][_0xfbf2('0x1f')]||null:null,'attributes':_0x4191b2[_0xfbf2('0x16')]?_0x4191b2[_0xfbf2('0x16')]['attributes']||null:null,'include':_0x4191b2[_0xfbf2('0x16')]?_0x4191b2[_0xfbf2('0x16')][_0xfbf2('0x17')]?_[_0xfbf2('0x18')](_0x4191b2[_0xfbf2('0x16')]['include'],function(_0x449d76){return{'model':db[_0x449d76[_0xfbf2('0x19')]],'as':_0x449d76['as'],'attributes':_0x449d76[_0xfbf2('0x1a')],'include':_0x449d76[_0xfbf2('0x17')]?_['map'](_0x449d76['include'],function(_0x3d92dc){return{'model':db[_0x3d92dc[_0xfbf2('0x19')]],'as':_0x3d92dc['as'],'attributes':_0x3d92dc[_0xfbf2('0x1a')],'include':_0x3d92dc[_0xfbf2('0x17')]?_['map'](_0x3d92dc[_0xfbf2('0x17')],function(_0x3c0d80){return{'model':db[_0x3c0d80[_0xfbf2('0x19')]],'as':_0x3c0d80['as'],'attributes':_0x3c0d80[_0xfbf2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfbf2('0xb')](function(_0x52befd){logger[_0xfbf2('0xc')](_0xfbf2('0x1d'),_0x4191b2);logger[_0xfbf2('0xf')](_0xfbf2('0x1d'),_0x4191b2,JSON['stringify'](_0x52befd));_0x414cff(_0x52befd);})[_0xfbf2('0x1c')](function(_0x5700d4){logger[_0xfbf2('0x10')](_0xfbf2('0x1d'),_0x5700d4[_0xfbf2('0x12')],_0x4191b2);_0x2dd8fe(_0xb16ac4[_0xfbf2('0x10')](0x1f4,_0x5700d4[_0xfbf2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 990bc2d..f77092b 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 _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file +var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x3396cd,_0x4047f0){var _0x2d6b4a=function(_0x389663){while(--_0x389663){_0x3396cd['push'](_0x3396cd['shift']());}};_0x2d6b4a(++_0x4047f0);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x13a4f3,_0x2c4fbe){_0x13a4f3=_0x13a4f3-0x0;var _0x4b5a73=_0x9ffd[_0x13a4f3];return _0x4b5a73;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d5364ad..ca131db 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 _0xcbe4=['sequelize','exports','STRING'];(function(_0x402924,_0x5baab5){var _0x71172d=function(_0x271e6b){while(--_0x271e6b){_0x402924['push'](_0x402924['shift']());}};_0x71172d(++_0x5baab5);}(_0xcbe4,0x108));var _0x4cbe=function(_0x432a7b,_0x15b9ea){_0x432a7b=_0x432a7b-0x0;var _0x13c683=_0xcbe4[_0x432a7b];return _0x13c683;};'use strict';var Sequelize=require(_0x4cbe('0x0'));module[_0x4cbe('0x1')]={'name':{'type':Sequelize[_0x4cbe('0x2')]},'description':{'type':Sequelize[_0x4cbe('0x2')]}}; \ No newline at end of file +var _0x75c2=['STRING','exports'];(function(_0x514164,_0x2eea78){var _0x2ca473=function(_0x30cc07){while(--_0x30cc07){_0x514164['push'](_0x514164['shift']());}};_0x2ca473(++_0x2eea78);}(_0x75c2,0x1e3));var _0x275c=function(_0x4bfd95,_0x1c3b3b){_0x4bfd95=_0x4bfd95-0x0;var _0x1484cd=_0x75c2[_0x4bfd95];return _0x1484cd;};'use strict';var Sequelize=require('sequelize');module[_0x275c('0x0')]={'name':{'type':Sequelize[_0x275c('0x1')]},'description':{'type':Sequelize[_0x275c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2da9476..92d12a5 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 _0xb983=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','destroy','end','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','count','includeAll','include','findAll','then','rows','show','params','options','catch','create','body','find','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/auth/service'];(function(_0x5602af,_0x2f83be){var _0x3cf1a2=function(_0x5110ce){while(--_0x5110ce){_0x5602af['push'](_0x5602af['shift']());}};_0x3cf1a2(++_0x2f83be);}(_0xb983,0xda));var _0x3b98=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xb983[_0x506d2f];return _0x101255;};'use strict';var emlformat=require(_0x3b98('0x0'));var rimraf=require(_0x3b98('0x1'));var zipdir=require(_0x3b98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3b98('0x3'));var path=require(_0x3b98('0x4'));var sox=require(_0x3b98('0x5'));var csv=require(_0x3b98('0x6'));var ejs=require(_0x3b98('0x7'));var fs=require('fs');var fs_extra=require(_0x3b98('0x8'));var _=require(_0x3b98('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b98('0xa'));var deskjs=require(_0x3b98('0xb'));var toCsv=require(_0x3b98('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b98('0xc'));var qs=require(_0x3b98('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b98('0xe'));var logger=require(_0x3b98('0xf'))(_0x3b98('0x10'));var utils=require('../../config/utils');var config=require(_0x3b98('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x404e8d,_0x48a67e){_0x48a67e=_0x48a67e||0xcc;return function(_0x141254){if(_0x141254){return _0x404e8d[_0x3b98('0x12')](_0x48a67e);}return _0x404e8d[_0x3b98('0x13')](_0x48a67e)['end']();};}function respondWithResult(_0xa405ac,_0x16bf75){_0x16bf75=_0x16bf75||0xc8;return function(_0x33d8cd){if(_0x33d8cd){return _0xa405ac[_0x3b98('0x13')](_0x16bf75)[_0x3b98('0x14')](_0x33d8cd);}};}function respondWithFilteredResult(_0x1c804f,_0x37b7b3){return function(_0x3d6bdc){if(_0x3d6bdc){var _0x3d84ef=typeof _0x37b7b3[_0x3b98('0x15')]===_0x3b98('0x16')&&typeof _0x37b7b3[_0x3b98('0x17')]===_0x3b98('0x16');var _0x137977=_0x3d6bdc['count'];var _0x5bf530=_0x3d84ef?0x0:_0x37b7b3[_0x3b98('0x15')];var _0x1818b1=_0x3d84ef?_0x3d6bdc['count']:_0x37b7b3[_0x3b98('0x15')]+_0x37b7b3[_0x3b98('0x17')];var _0x409912;if(_0x1818b1>=_0x137977){_0x1818b1=_0x137977;_0x409912=0xc8;}else{_0x409912=0xce;}_0x1c804f[_0x3b98('0x13')](_0x409912);return _0x1c804f[_0x3b98('0x18')](_0x3b98('0x19'),_0x5bf530+'-'+_0x1818b1+'/'+_0x137977)[_0x3b98('0x14')](_0x3d6bdc);}return null;};}function patchUpdates(_0x19e9bd){return function(_0x1a56d6){try{jsonpatch[_0x3b98('0x1a')](_0x1a56d6,_0x19e9bd,!![]);}catch(_0x1357de){return BPromise['reject'](_0x1357de);}return _0x1a56d6[_0x3b98('0x1b')]();};}function saveUpdates(_0x10a23d,_0x52c032){return function(_0x557920){if(_0x557920){return _0x557920['update'](_0x10a23d)['then'](function(_0x160555){return _0x160555;});}return null;};}function removeEntity(_0x7de631,_0x479b6a){return function(_0x34cf5c){if(_0x34cf5c){return _0x34cf5c[_0x3b98('0x1c')]()['then'](function(){_0x7de631['status'](0xcc)[_0x3b98('0x1d')]();});}};}function handleEntityNotFound(_0x239efd,_0x38fdf1){return function(_0x595b00){if(!_0x595b00){_0x239efd[_0x3b98('0x12')](0x194);}return _0x595b00;};}function handleError(_0x13cb81,_0x178b59){_0x178b59=_0x178b59||0x1f4;return function(_0x4d3b3f){logger[_0x3b98('0x1e')](_0x4d3b3f[_0x3b98('0x1f')]);if(_0x4d3b3f[_0x3b98('0x20')]){delete _0x4d3b3f[_0x3b98('0x20')];}_0x13cb81[_0x3b98('0x13')](_0x178b59)[_0x3b98('0x21')](_0x4d3b3f);};}exports[_0x3b98('0x22')]=function(_0x4dcdd6,_0x45391a){var _0x55b513={},_0x9cc0c={},_0x40daf7={'count':0x0,'rows':[]};var _0x588cf4=_['map'](db[_0x3b98('0x23')][_0x3b98('0x24')],function(_0x29589d){return{'name':_0x29589d[_0x3b98('0x25')],'type':_0x29589d['type'][_0x3b98('0x26')]};});_0x9cc0c[_0x3b98('0x27')]=_[_0x3b98('0x28')](_0x588cf4,_0x3b98('0x20'));_0x9cc0c[_0x3b98('0x29')]=_[_0x3b98('0x2a')](_0x4dcdd6[_0x3b98('0x29')]);_0x9cc0c[_0x3b98('0x2b')]=_[_0x3b98('0x2c')](_0x9cc0c['model'],_0x9cc0c['query']);_0x55b513[_0x3b98('0x2d')]=_['intersection'](_0x9cc0c['model'],qs[_0x3b98('0x2e')](_0x4dcdd6['query']['fields']));_0x55b513[_0x3b98('0x2d')]=_0x55b513[_0x3b98('0x2d')][_0x3b98('0x2f')]?_0x55b513[_0x3b98('0x2d')]:_0x9cc0c[_0x3b98('0x27')];if(!_0x4dcdd6[_0x3b98('0x29')][_0x3b98('0x30')](_0x3b98('0x31'))){_0x55b513[_0x3b98('0x17')]=qs[_0x3b98('0x17')](_0x4dcdd6['query']['limit']);_0x55b513['offset']=qs[_0x3b98('0x15')](_0x4dcdd6['query'][_0x3b98('0x15')]);}_0x55b513[_0x3b98('0x32')]=qs[_0x3b98('0x33')](_0x4dcdd6['query'][_0x3b98('0x33')]);_0x55b513['where']=qs[_0x3b98('0x2b')](_['pick'](_0x4dcdd6[_0x3b98('0x29')],_0x9cc0c[_0x3b98('0x2b')]),_0x588cf4);if(_0x4dcdd6['query'][_0x3b98('0x34')]){_0x55b513['where']=_[_0x3b98('0x35')](_0x55b513[_0x3b98('0x36')],{'$or':_[_0x3b98('0x28')](_0x588cf4,function(_0x31899a){if(_0x31899a['type']!=='VIRTUAL'){var _0x3f6988={};_0x3f6988[_0x31899a[_0x3b98('0x20')]]={'$like':'%'+_0x4dcdd6[_0x3b98('0x29')][_0x3b98('0x34')]+'%'};return _0x3f6988;}})});}_0x55b513=_[_0x3b98('0x35')]({},_0x55b513,_0x4dcdd6['options']);var _0x1089cc={'where':_0x55b513[_0x3b98('0x36')]};return db[_0x3b98('0x23')][_0x3b98('0x37')](_0x1089cc)['then'](function(_0x390265){_0x40daf7[_0x3b98('0x37')]=_0x390265;if(_0x4dcdd6[_0x3b98('0x29')][_0x3b98('0x38')]){_0x55b513[_0x3b98('0x39')]=[{'all':!![]}];}return db[_0x3b98('0x23')][_0x3b98('0x3a')](_0x55b513);})[_0x3b98('0x3b')](function(_0x2b18c9){_0x40daf7[_0x3b98('0x3c')]=_0x2b18c9;return _0x40daf7;})[_0x3b98('0x3b')](respondWithFilteredResult(_0x45391a,_0x55b513))['catch'](handleError(_0x45391a,null));};exports[_0x3b98('0x3d')]=function(_0x1ad693,_0x3d2e59){var _0x282615={'raw':![],'where':{'id':_0x1ad693[_0x3b98('0x3e')]['id']}},_0x112946={};_0x112946[_0x3b98('0x27')]=_[_0x3b98('0x2a')](db[_0x3b98('0x23')][_0x3b98('0x24')]);_0x112946[_0x3b98('0x29')]=_[_0x3b98('0x2a')](_0x1ad693[_0x3b98('0x29')]);_0x112946[_0x3b98('0x2b')]=_[_0x3b98('0x2c')](_0x112946[_0x3b98('0x27')],_0x112946[_0x3b98('0x29')]);_0x282615[_0x3b98('0x2d')]=_[_0x3b98('0x2c')](_0x112946['model'],qs[_0x3b98('0x2e')](_0x1ad693[_0x3b98('0x29')][_0x3b98('0x2e')]));_0x282615[_0x3b98('0x2d')]=_0x282615[_0x3b98('0x2d')][_0x3b98('0x2f')]?_0x282615[_0x3b98('0x2d')]:_0x112946[_0x3b98('0x27')];if(_0x1ad693[_0x3b98('0x29')][_0x3b98('0x38')]){_0x282615[_0x3b98('0x39')]=[{'all':!![]}];}_0x282615=_[_0x3b98('0x35')]({},_0x282615,_0x1ad693[_0x3b98('0x3f')]);return db['ZendeskConfiguration']['find'](_0x282615)[_0x3b98('0x3b')](handleEntityNotFound(_0x3d2e59,null))[_0x3b98('0x3b')](respondWithResult(_0x3d2e59,null))[_0x3b98('0x40')](handleError(_0x3d2e59,null));};exports[_0x3b98('0x41')]=function(_0x41fe4a,_0x39771b){return db['ZendeskConfiguration'][_0x3b98('0x41')](_0x41fe4a[_0x3b98('0x42')],{})['then'](respondWithResult(_0x39771b,0xc9))[_0x3b98('0x40')](handleError(_0x39771b,null));};exports['update']=function(_0x3271b9,_0x3d6eae){if(_0x3271b9[_0x3b98('0x42')]['id']){delete _0x3271b9[_0x3b98('0x42')]['id'];}return db['ZendeskConfiguration'][_0x3b98('0x43')]({'where':{'id':_0x3271b9[_0x3b98('0x3e')]['id']}})[_0x3b98('0x3b')](handleEntityNotFound(_0x3d6eae,null))[_0x3b98('0x3b')](saveUpdates(_0x3271b9[_0x3b98('0x42')],null))['then'](respondWithResult(_0x3d6eae,null))[_0x3b98('0x40')](handleError(_0x3d6eae,null));};exports[_0x3b98('0x1c')]=function(_0x483e38,_0x240afa){return db['ZendeskConfiguration'][_0x3b98('0x43')]({'where':{'id':_0x483e38[_0x3b98('0x3e')]['id']}})[_0x3b98('0x3b')](handleEntityNotFound(_0x240afa,null))[_0x3b98('0x3b')](removeEntity(_0x240afa,null))['catch'](handleError(_0x240afa,null));};exports[_0x3b98('0x44')]=function(_0x120300,_0x840a36,_0x4aeb45){var _0x578b53={};var _0x45a5bf={};var _0x54592c;var _0x3d43f0;return db[_0x3b98('0x23')][_0x3b98('0x45')]({'where':{'id':_0x120300[_0x3b98('0x3e')]['id']}})['then'](handleEntityNotFound(_0x840a36,null))['then'](function(_0x49291e){if(_0x49291e){_0x54592c=_0x49291e;_0x45a5bf['model']=_['keys'](db[_0x3b98('0x46')][_0x3b98('0x24')]);_0x45a5bf['query']=_[_0x3b98('0x2a')](_0x120300[_0x3b98('0x29')]);_0x45a5bf[_0x3b98('0x2b')]=_['intersection'](_0x45a5bf[_0x3b98('0x27')],_0x45a5bf['query']);_0x578b53['attributes']=_[_0x3b98('0x2c')](_0x45a5bf['model'],qs[_0x3b98('0x2e')](_0x120300[_0x3b98('0x29')]['fields']));_0x578b53['attributes']=_0x578b53[_0x3b98('0x2d')]['length']?_0x578b53[_0x3b98('0x2d')]:_0x45a5bf[_0x3b98('0x27')];_0x578b53[_0x3b98('0x32')]=qs[_0x3b98('0x33')](_0x120300['query'][_0x3b98('0x33')]);_0x578b53[_0x3b98('0x36')]=qs[_0x3b98('0x2b')](_[_0x3b98('0x47')](_0x120300[_0x3b98('0x29')],_0x45a5bf['filters']));if(_0x120300['query']['filter']){_0x578b53[_0x3b98('0x36')]=_[_0x3b98('0x35')](_0x578b53[_0x3b98('0x36')],{'$or':_[_0x3b98('0x28')](_0x578b53[_0x3b98('0x2d')],function(_0x55cbcf){var _0x4ea06a={};_0x4ea06a[_0x55cbcf]={'$like':'%'+_0x120300[_0x3b98('0x29')]['filter']+'%'};return _0x4ea06a;})});}_0x578b53=_[_0x3b98('0x35')]({},_0x578b53,_0x120300[_0x3b98('0x3f')]);return _0x54592c[_0x3b98('0x44')](_0x578b53);}})[_0x3b98('0x3b')](function(_0x14f2c4){if(_0x14f2c4){_0x3d43f0=_0x14f2c4[_0x3b98('0x2f')];if(!_0x120300[_0x3b98('0x29')][_0x3b98('0x30')]('nolimit')){_0x578b53[_0x3b98('0x17')]=qs['limit'](_0x120300[_0x3b98('0x29')]['limit']);_0x578b53[_0x3b98('0x15')]=qs[_0x3b98('0x15')](_0x120300[_0x3b98('0x29')][_0x3b98('0x15')]);}return _0x54592c[_0x3b98('0x44')](_0x578b53);}})[_0x3b98('0x3b')](function(_0x14b04f){if(_0x14b04f){return _0x14b04f?{'count':_0x3d43f0,'rows':_0x14b04f}:null;}})[_0x3b98('0x3b')](respondWithResult(_0x840a36,null))[_0x3b98('0x40')](handleError(_0x840a36,null));};exports[_0x3b98('0x48')]=function(_0x3f7611,_0x4ed924,_0x453f0b){var _0x459e97={};var _0xfc26b7={};var _0x3edc16;var _0x28d0fe;return db[_0x3b98('0x23')][_0x3b98('0x45')]({'where':{'id':_0x3f7611[_0x3b98('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ed924,null))[_0x3b98('0x3b')](function(_0x444a57){if(_0x444a57){_0x3edc16=_0x444a57;_0xfc26b7[_0x3b98('0x27')]=_[_0x3b98('0x2a')](db[_0x3b98('0x46')][_0x3b98('0x24')]);_0xfc26b7[_0x3b98('0x29')]=_['keys'](_0x3f7611[_0x3b98('0x29')]);_0xfc26b7[_0x3b98('0x2b')]=_[_0x3b98('0x2c')](_0xfc26b7['model'],_0xfc26b7[_0x3b98('0x29')]);_0x459e97[_0x3b98('0x2d')]=_[_0x3b98('0x2c')](_0xfc26b7[_0x3b98('0x27')],qs[_0x3b98('0x2e')](_0x3f7611[_0x3b98('0x29')][_0x3b98('0x2e')]));_0x459e97['attributes']=_0x459e97[_0x3b98('0x2d')][_0x3b98('0x2f')]?_0x459e97[_0x3b98('0x2d')]:_0xfc26b7[_0x3b98('0x27')];_0x459e97[_0x3b98('0x32')]=qs[_0x3b98('0x33')](_0x3f7611[_0x3b98('0x29')][_0x3b98('0x33')]);_0x459e97['where']=qs['filters'](_[_0x3b98('0x47')](_0x3f7611[_0x3b98('0x29')],_0xfc26b7['filters']));if(_0x3f7611[_0x3b98('0x29')][_0x3b98('0x34')]){_0x459e97['where']=_[_0x3b98('0x35')](_0x459e97['where'],{'$or':_[_0x3b98('0x28')](_0x459e97['attributes'],function(_0x344fa3){var _0x39100d={};_0x39100d[_0x344fa3]={'$like':'%'+_0x3f7611[_0x3b98('0x29')][_0x3b98('0x34')]+'%'};return _0x39100d;})});}_0x459e97=_[_0x3b98('0x35')]({},_0x459e97,_0x3f7611['options']);return _0x3edc16[_0x3b98('0x48')](_0x459e97);}})[_0x3b98('0x3b')](function(_0x2c316f){if(_0x2c316f){_0x28d0fe=_0x2c316f[_0x3b98('0x2f')];if(!_0x3f7611[_0x3b98('0x29')][_0x3b98('0x30')]('nolimit')){_0x459e97['limit']=qs[_0x3b98('0x17')](_0x3f7611[_0x3b98('0x29')][_0x3b98('0x17')]);_0x459e97['offset']=qs[_0x3b98('0x15')](_0x3f7611[_0x3b98('0x29')][_0x3b98('0x15')]);}return _0x3edc16[_0x3b98('0x48')](_0x459e97);}})[_0x3b98('0x3b')](function(_0x2ca455){if(_0x2ca455){return _0x2ca455?{'count':_0x28d0fe,'rows':_0x2ca455}:null;}})[_0x3b98('0x3b')](respondWithResult(_0x4ed924,null))[_0x3b98('0x40')](handleError(_0x4ed924,null));};exports[_0x3b98('0x49')]=function(_0x5b81f3,_0x4e19df,_0x52b084){var _0x2cb708={};var _0x4e8709={};var _0x10e362;var _0x366b5e;return db[_0x3b98('0x23')][_0x3b98('0x45')]({'where':{'id':_0x5b81f3[_0x3b98('0x3e')]['id']}})[_0x3b98('0x3b')](handleEntityNotFound(_0x4e19df,null))[_0x3b98('0x3b')](function(_0x54b2e3){if(_0x54b2e3){_0x10e362=_0x54b2e3;_0x4e8709[_0x3b98('0x27')]=_[_0x3b98('0x2a')](db[_0x3b98('0x46')]['rawAttributes']);_0x4e8709[_0x3b98('0x29')]=_['keys'](_0x5b81f3[_0x3b98('0x29')]);_0x4e8709['filters']=_[_0x3b98('0x2c')](_0x4e8709[_0x3b98('0x27')],_0x4e8709[_0x3b98('0x29')]);_0x2cb708['attributes']=_[_0x3b98('0x2c')](_0x4e8709['model'],qs[_0x3b98('0x2e')](_0x5b81f3[_0x3b98('0x29')]['fields']));_0x2cb708[_0x3b98('0x2d')]=_0x2cb708[_0x3b98('0x2d')][_0x3b98('0x2f')]?_0x2cb708[_0x3b98('0x2d')]:_0x4e8709[_0x3b98('0x27')];_0x2cb708[_0x3b98('0x32')]=qs[_0x3b98('0x33')](_0x5b81f3[_0x3b98('0x29')]['sort']);_0x2cb708['where']=qs[_0x3b98('0x2b')](_[_0x3b98('0x47')](_0x5b81f3[_0x3b98('0x29')],_0x4e8709[_0x3b98('0x2b')]));if(_0x5b81f3[_0x3b98('0x29')]['filter']){_0x2cb708[_0x3b98('0x36')]=_[_0x3b98('0x35')](_0x2cb708[_0x3b98('0x36')],{'$or':_['map'](_0x2cb708[_0x3b98('0x2d')],function(_0x2082db){var _0x2cc8a4={};_0x2cc8a4[_0x2082db]={'$like':'%'+_0x5b81f3['query'][_0x3b98('0x34')]+'%'};return _0x2cc8a4;})});}_0x2cb708=_['merge']({},_0x2cb708,_0x5b81f3[_0x3b98('0x3f')]);return _0x10e362[_0x3b98('0x49')](_0x2cb708);}})['then'](function(_0x1e45da){if(_0x1e45da){_0x366b5e=_0x1e45da[_0x3b98('0x2f')];if(!_0x5b81f3[_0x3b98('0x29')][_0x3b98('0x30')](_0x3b98('0x31'))){_0x2cb708['limit']=qs[_0x3b98('0x17')](_0x5b81f3[_0x3b98('0x29')][_0x3b98('0x17')]);_0x2cb708[_0x3b98('0x15')]=qs[_0x3b98('0x15')](_0x5b81f3[_0x3b98('0x29')][_0x3b98('0x15')]);}return _0x10e362[_0x3b98('0x49')](_0x2cb708);}})[_0x3b98('0x3b')](function(_0x1bce0e){if(_0x1bce0e){return _0x1bce0e?{'count':_0x366b5e,'rows':_0x1bce0e}:null;}})[_0x3b98('0x3b')](respondWithResult(_0x4e19df,null))[_0x3b98('0x40')](handleError(_0x4e19df,null));};exports['getTags']=function(_0x528e9e,_0x30f965,_0x23358d){var _0x5742e7={};var _0xb6568e={};var _0x477452;var _0x36f130;return db['ZendeskConfiguration'][_0x3b98('0x45')]({'where':{'id':_0x528e9e[_0x3b98('0x3e')]['id']}})[_0x3b98('0x3b')](handleEntityNotFound(_0x30f965,null))['then'](function(_0x21b06c){if(_0x21b06c){_0x477452=_0x21b06c;_0xb6568e[_0x3b98('0x27')]=_['keys'](db[_0x3b98('0x4a')]['rawAttributes']);_0xb6568e[_0x3b98('0x29')]=_['keys'](_0x528e9e['query']);_0xb6568e[_0x3b98('0x2b')]=_[_0x3b98('0x2c')](_0xb6568e['model'],_0xb6568e[_0x3b98('0x29')]);_0x5742e7[_0x3b98('0x2d')]=_['intersection'](_0xb6568e[_0x3b98('0x27')],qs[_0x3b98('0x2e')](_0x528e9e[_0x3b98('0x29')][_0x3b98('0x2e')]));_0x5742e7['attributes']=_0x5742e7[_0x3b98('0x2d')][_0x3b98('0x2f')]?_0x5742e7[_0x3b98('0x2d')]:_0xb6568e['model'];_0x5742e7[_0x3b98('0x32')]=qs[_0x3b98('0x33')](_0x528e9e[_0x3b98('0x29')][_0x3b98('0x33')]);_0x5742e7[_0x3b98('0x36')]=qs[_0x3b98('0x2b')](_[_0x3b98('0x47')](_0x528e9e[_0x3b98('0x29')],_0xb6568e[_0x3b98('0x2b')]));if(_0x528e9e[_0x3b98('0x29')][_0x3b98('0x34')]){_0x5742e7[_0x3b98('0x36')]=_[_0x3b98('0x35')](_0x5742e7[_0x3b98('0x36')],{'$or':_[_0x3b98('0x28')](_0x5742e7[_0x3b98('0x2d')],function(_0x36faf8){var _0x142e82={};_0x142e82[_0x36faf8]={'$like':'%'+_0x528e9e[_0x3b98('0x29')][_0x3b98('0x34')]+'%'};return _0x142e82;})});}_0x5742e7=_[_0x3b98('0x35')]({},_0x5742e7,_0x528e9e[_0x3b98('0x3f')]);return _0x477452['getTags'](_0x5742e7);}})[_0x3b98('0x3b')](function(_0x4b42b3){if(_0x4b42b3){_0x36f130=_0x4b42b3['length'];if(!_0x528e9e[_0x3b98('0x29')][_0x3b98('0x30')]('nolimit')){_0x5742e7['limit']=qs['limit'](_0x528e9e[_0x3b98('0x29')][_0x3b98('0x17')]);_0x5742e7[_0x3b98('0x15')]=qs['offset'](_0x528e9e[_0x3b98('0x29')][_0x3b98('0x15')]);}return _0x477452[_0x3b98('0x4b')](_0x5742e7);}})[_0x3b98('0x3b')](function(_0x2fe2e6){if(_0x2fe2e6){return _0x2fe2e6?{'count':_0x36f130,'rows':_0x2fe2e6}:null;}})[_0x3b98('0x3b')](respondWithResult(_0x30f965,null))[_0x3b98('0x40')](handleError(_0x30f965,null));};exports['setTags']=function(_0x533232,_0x28abd1,_0x307da3){if(_0x533232[_0x3b98('0x42')]['id']){delete _0x533232[_0x3b98('0x42')]['id'];}return db[_0x3b98('0x23')][_0x3b98('0x45')]({'where':{'id':_0x533232[_0x3b98('0x3e')]['id']}})[_0x3b98('0x3b')](handleEntityNotFound(_0x28abd1,null))[_0x3b98('0x3b')](function(_0x4fb8fd){if(_0x4fb8fd){return _0x4fb8fd[_0x3b98('0x4c')](_0x533232['body']['ids']||[]);}return null;})[_0x3b98('0x3b')](respondWithResult(_0x28abd1,null))[_0x3b98('0x40')](handleError(_0x28abd1,null));}; \ No newline at end of file +var _0x27ea=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','create','body','find','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x594171,_0x188993){var _0x290f85=function(_0x36647f){while(--_0x36647f){_0x594171['push'](_0x594171['shift']());}};_0x290f85(++_0x188993);}(_0x27ea,0x1f0));var _0xa27e=function(_0x52cfc0,_0x2d3104){_0x52cfc0=_0x52cfc0-0x0;var _0x1d18dd=_0x27ea[_0x52cfc0];return _0x1d18dd;};'use strict';var emlformat=require(_0xa27e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa27e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa27e('0x2'));var moment=require(_0xa27e('0x3'));var BPromise=require(_0xa27e('0x4'));var Mustache=require(_0xa27e('0x5'));var util=require(_0xa27e('0x6'));var path=require('path');var sox=require(_0xa27e('0x7'));var csv=require(_0xa27e('0x8'));var ejs=require(_0xa27e('0x9'));var fs=require('fs');var fs_extra=require(_0xa27e('0xa'));var _=require('lodash');var squel=require(_0xa27e('0xb'));var crypto=require(_0xa27e('0xc'));var jsforce=require(_0xa27e('0xd'));var deskjs=require(_0xa27e('0xe'));var toCsv=require(_0xa27e('0x8'));var querystring=require(_0xa27e('0xf'));var Papa=require('papaparse');var Redis=require(_0xa27e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa27e('0x11'));var as=require(_0xa27e('0x12'));var hardwareService=require(_0xa27e('0x13'));var logger=require(_0xa27e('0x14'))('api');var utils=require(_0xa27e('0x15'));var config=require(_0xa27e('0x16'));var licenseUtil=require(_0xa27e('0x17'));var db=require(_0xa27e('0x18'))['db'];function respondWithStatusCode(_0x3ea754,_0xcea36c){_0xcea36c=_0xcea36c||0xcc;return function(_0x44d263){if(_0x44d263){return _0x3ea754[_0xa27e('0x19')](_0xcea36c);}return _0x3ea754[_0xa27e('0x1a')](_0xcea36c)[_0xa27e('0x1b')]();};}function respondWithResult(_0xb0f3cb,_0x186ab3){_0x186ab3=_0x186ab3||0xc8;return function(_0xbad1f9){if(_0xbad1f9){return _0xb0f3cb[_0xa27e('0x1a')](_0x186ab3)[_0xa27e('0x1c')](_0xbad1f9);}};}function respondWithFilteredResult(_0x150a2f,_0x31f636){return function(_0x42f91f){if(_0x42f91f){var _0x12a5fb=typeof _0x31f636[_0xa27e('0x1d')]==='undefined'&&typeof _0x31f636[_0xa27e('0x1e')]===_0xa27e('0x1f');var _0x40d0a2=_0x42f91f[_0xa27e('0x20')];var _0x2311cf=_0x12a5fb?0x0:_0x31f636[_0xa27e('0x1d')];var _0x18a339=_0x12a5fb?_0x42f91f[_0xa27e('0x20')]:_0x31f636[_0xa27e('0x1d')]+_0x31f636[_0xa27e('0x1e')];var _0x3803ab;if(_0x18a339>=_0x40d0a2){_0x18a339=_0x40d0a2;_0x3803ab=0xc8;}else{_0x3803ab=0xce;}_0x150a2f[_0xa27e('0x1a')](_0x3803ab);return _0x150a2f[_0xa27e('0x21')](_0xa27e('0x22'),_0x2311cf+'-'+_0x18a339+'/'+_0x40d0a2)[_0xa27e('0x1c')](_0x42f91f);}return null;};}function patchUpdates(_0x2c6974){return function(_0x113f73){try{jsonpatch[_0xa27e('0x23')](_0x113f73,_0x2c6974,!![]);}catch(_0x17e6cd){return BPromise[_0xa27e('0x24')](_0x17e6cd);}return _0x113f73[_0xa27e('0x25')]();};}function saveUpdates(_0x47ddcb,_0x4df804){return function(_0x21cc41){if(_0x21cc41){return _0x21cc41[_0xa27e('0x26')](_0x47ddcb)['then'](function(_0x567d47){return _0x567d47;});}return null;};}function removeEntity(_0x1876dc,_0x287c44){return function(_0x5d0686){if(_0x5d0686){return _0x5d0686[_0xa27e('0x27')]()[_0xa27e('0x28')](function(){_0x1876dc[_0xa27e('0x1a')](0xcc)[_0xa27e('0x1b')]();});}};}function handleEntityNotFound(_0x5d9846,_0x174cb1){return function(_0x5db6a3){if(!_0x5db6a3){_0x5d9846[_0xa27e('0x19')](0x194);}return _0x5db6a3;};}function handleError(_0x409b28,_0x3f7cc8){_0x3f7cc8=_0x3f7cc8||0x1f4;return function(_0x232e71){logger['error'](_0x232e71[_0xa27e('0x29')]);if(_0x232e71[_0xa27e('0x2a')]){delete _0x232e71['name'];}_0x409b28[_0xa27e('0x1a')](_0x3f7cc8)[_0xa27e('0x2b')](_0x232e71);};}exports[_0xa27e('0x2c')]=function(_0x49142e,_0xc0fddb){var _0x2a7e13={},_0x578ef9={},_0x340921={'count':0x0,'rows':[]};var _0x571820=_['map'](db[_0xa27e('0x2d')][_0xa27e('0x2e')],function(_0x13d5f1){return{'name':_0x13d5f1[_0xa27e('0x2f')],'type':_0x13d5f1[_0xa27e('0x30')][_0xa27e('0x31')]};});_0x578ef9[_0xa27e('0x32')]=_['map'](_0x571820,_0xa27e('0x2a'));_0x578ef9[_0xa27e('0x33')]=_[_0xa27e('0x34')](_0x49142e[_0xa27e('0x33')]);_0x578ef9['filters']=_[_0xa27e('0x35')](_0x578ef9[_0xa27e('0x32')],_0x578ef9[_0xa27e('0x33')]);_0x2a7e13[_0xa27e('0x36')]=_[_0xa27e('0x35')](_0x578ef9[_0xa27e('0x32')],qs[_0xa27e('0x37')](_0x49142e['query'][_0xa27e('0x37')]));_0x2a7e13[_0xa27e('0x36')]=_0x2a7e13[_0xa27e('0x36')][_0xa27e('0x38')]?_0x2a7e13['attributes']:_0x578ef9[_0xa27e('0x32')];if(!_0x49142e['query'][_0xa27e('0x39')](_0xa27e('0x3a'))){_0x2a7e13[_0xa27e('0x1e')]=qs[_0xa27e('0x1e')](_0x49142e[_0xa27e('0x33')][_0xa27e('0x1e')]);_0x2a7e13[_0xa27e('0x1d')]=qs['offset'](_0x49142e[_0xa27e('0x33')][_0xa27e('0x1d')]);}_0x2a7e13[_0xa27e('0x3b')]=qs[_0xa27e('0x3c')](_0x49142e[_0xa27e('0x33')][_0xa27e('0x3c')]);_0x2a7e13[_0xa27e('0x3d')]=qs[_0xa27e('0x3e')](_[_0xa27e('0x3f')](_0x49142e[_0xa27e('0x33')],_0x578ef9[_0xa27e('0x3e')]),_0x571820);if(_0x49142e[_0xa27e('0x33')]['filter']){_0x2a7e13[_0xa27e('0x3d')]=_['merge'](_0x2a7e13[_0xa27e('0x3d')],{'$or':_[_0xa27e('0x40')](_0x571820,function(_0x49997e){if(_0x49997e[_0xa27e('0x30')]!==_0xa27e('0x41')){var _0x10a1e0={};_0x10a1e0[_0x49997e['name']]={'$like':'%'+_0x49142e[_0xa27e('0x33')][_0xa27e('0x42')]+'%'};return _0x10a1e0;}})});}_0x2a7e13=_[_0xa27e('0x43')]({},_0x2a7e13,_0x49142e[_0xa27e('0x44')]);var _0x30c004={'where':_0x2a7e13[_0xa27e('0x3d')]};return db['ZendeskConfiguration'][_0xa27e('0x20')](_0x30c004)['then'](function(_0x60be7c){_0x340921[_0xa27e('0x20')]=_0x60be7c;if(_0x49142e[_0xa27e('0x33')][_0xa27e('0x45')]){_0x2a7e13[_0xa27e('0x46')]=[{'all':!![]}];}return db[_0xa27e('0x2d')][_0xa27e('0x47')](_0x2a7e13);})['then'](function(_0x1b5d77){_0x340921['rows']=_0x1b5d77;return _0x340921;})['then'](respondWithFilteredResult(_0xc0fddb,_0x2a7e13))[_0xa27e('0x48')](handleError(_0xc0fddb,null));};exports['show']=function(_0x14644a,_0x14f27a){var _0xa60c57={'raw':![],'where':{'id':_0x14644a['params']['id']}},_0x297b70={};_0x297b70[_0xa27e('0x32')]=_[_0xa27e('0x34')](db['ZendeskConfiguration'][_0xa27e('0x2e')]);_0x297b70[_0xa27e('0x33')]=_[_0xa27e('0x34')](_0x14644a[_0xa27e('0x33')]);_0x297b70[_0xa27e('0x3e')]=_[_0xa27e('0x35')](_0x297b70[_0xa27e('0x32')],_0x297b70[_0xa27e('0x33')]);_0xa60c57['attributes']=_['intersection'](_0x297b70[_0xa27e('0x32')],qs[_0xa27e('0x37')](_0x14644a[_0xa27e('0x33')][_0xa27e('0x37')]));_0xa60c57[_0xa27e('0x36')]=_0xa60c57[_0xa27e('0x36')][_0xa27e('0x38')]?_0xa60c57[_0xa27e('0x36')]:_0x297b70[_0xa27e('0x32')];if(_0x14644a['query'][_0xa27e('0x45')]){_0xa60c57[_0xa27e('0x46')]=[{'all':!![]}];}_0xa60c57=_[_0xa27e('0x43')]({},_0xa60c57,_0x14644a[_0xa27e('0x44')]);return db[_0xa27e('0x2d')]['find'](_0xa60c57)[_0xa27e('0x28')](handleEntityNotFound(_0x14f27a,null))[_0xa27e('0x28')](respondWithResult(_0x14f27a,null))[_0xa27e('0x48')](handleError(_0x14f27a,null));};exports[_0xa27e('0x49')]=function(_0x3533f2,_0x3aa407){return db['ZendeskConfiguration'][_0xa27e('0x49')](_0x3533f2[_0xa27e('0x4a')],{})[_0xa27e('0x28')](respondWithResult(_0x3aa407,0xc9))[_0xa27e('0x48')](handleError(_0x3aa407,null));};exports[_0xa27e('0x26')]=function(_0x2f1f89,_0x2a200f){if(_0x2f1f89[_0xa27e('0x4a')]['id']){delete _0x2f1f89[_0xa27e('0x4a')]['id'];}return db[_0xa27e('0x2d')][_0xa27e('0x4b')]({'where':{'id':_0x2f1f89[_0xa27e('0x4c')]['id']}})[_0xa27e('0x28')](handleEntityNotFound(_0x2a200f,null))[_0xa27e('0x28')](saveUpdates(_0x2f1f89['body'],null))['then'](respondWithResult(_0x2a200f,null))[_0xa27e('0x48')](handleError(_0x2a200f,null));};exports[_0xa27e('0x27')]=function(_0x38c43d,_0x21934a){return db[_0xa27e('0x2d')][_0xa27e('0x4b')]({'where':{'id':_0x38c43d[_0xa27e('0x4c')]['id']}})[_0xa27e('0x28')](handleEntityNotFound(_0x21934a,null))[_0xa27e('0x28')](removeEntity(_0x21934a,null))['catch'](handleError(_0x21934a,null));};exports[_0xa27e('0x4d')]=function(_0x4b9db4,_0x20df93,_0x3e47ee){var _0x12e044={};var _0x1bc9a6={};var _0x80829c;var _0x347901;return db['ZendeskConfiguration'][_0xa27e('0x4e')]({'where':{'id':_0x4b9db4[_0xa27e('0x4c')]['id']}})[_0xa27e('0x28')](handleEntityNotFound(_0x20df93,null))[_0xa27e('0x28')](function(_0x19a2d2){if(_0x19a2d2){_0x80829c=_0x19a2d2;_0x1bc9a6[_0xa27e('0x32')]=_[_0xa27e('0x34')](db[_0xa27e('0x4f')]['rawAttributes']);_0x1bc9a6[_0xa27e('0x33')]=_[_0xa27e('0x34')](_0x4b9db4[_0xa27e('0x33')]);_0x1bc9a6['filters']=_[_0xa27e('0x35')](_0x1bc9a6['model'],_0x1bc9a6['query']);_0x12e044[_0xa27e('0x36')]=_[_0xa27e('0x35')](_0x1bc9a6['model'],qs['fields'](_0x4b9db4[_0xa27e('0x33')][_0xa27e('0x37')]));_0x12e044['attributes']=_0x12e044[_0xa27e('0x36')][_0xa27e('0x38')]?_0x12e044[_0xa27e('0x36')]:_0x1bc9a6['model'];_0x12e044[_0xa27e('0x3b')]=qs['sort'](_0x4b9db4[_0xa27e('0x33')][_0xa27e('0x3c')]);_0x12e044[_0xa27e('0x3d')]=qs[_0xa27e('0x3e')](_[_0xa27e('0x3f')](_0x4b9db4[_0xa27e('0x33')],_0x1bc9a6[_0xa27e('0x3e')]));if(_0x4b9db4[_0xa27e('0x33')][_0xa27e('0x42')]){_0x12e044['where']=_[_0xa27e('0x43')](_0x12e044[_0xa27e('0x3d')],{'$or':_[_0xa27e('0x40')](_0x12e044[_0xa27e('0x36')],function(_0x3aa233){var _0x3fd7dc={};_0x3fd7dc[_0x3aa233]={'$like':'%'+_0x4b9db4['query']['filter']+'%'};return _0x3fd7dc;})});}_0x12e044=_['merge']({},_0x12e044,_0x4b9db4[_0xa27e('0x44')]);return _0x80829c[_0xa27e('0x4d')](_0x12e044);}})[_0xa27e('0x28')](function(_0x32bbb3){if(_0x32bbb3){_0x347901=_0x32bbb3[_0xa27e('0x38')];if(!_0x4b9db4[_0xa27e('0x33')]['hasOwnProperty'](_0xa27e('0x3a'))){_0x12e044[_0xa27e('0x1e')]=qs[_0xa27e('0x1e')](_0x4b9db4['query']['limit']);_0x12e044[_0xa27e('0x1d')]=qs[_0xa27e('0x1d')](_0x4b9db4[_0xa27e('0x33')][_0xa27e('0x1d')]);}return _0x80829c[_0xa27e('0x4d')](_0x12e044);}})[_0xa27e('0x28')](function(_0x1645db){if(_0x1645db){return _0x1645db?{'count':_0x347901,'rows':_0x1645db}:null;}})[_0xa27e('0x28')](respondWithResult(_0x20df93,null))[_0xa27e('0x48')](handleError(_0x20df93,null));};exports['getSubjects']=function(_0x2cbb32,_0x46c527,_0x5344aa){var _0x40200a={};var _0x795b07={};var _0x19058b;var _0x261517;return db[_0xa27e('0x2d')]['findOne']({'where':{'id':_0x2cbb32[_0xa27e('0x4c')]['id']}})[_0xa27e('0x28')](handleEntityNotFound(_0x46c527,null))[_0xa27e('0x28')](function(_0x19c5c1){if(_0x19c5c1){_0x19058b=_0x19c5c1;_0x795b07[_0xa27e('0x32')]=_[_0xa27e('0x34')](db[_0xa27e('0x4f')][_0xa27e('0x2e')]);_0x795b07[_0xa27e('0x33')]=_['keys'](_0x2cbb32['query']);_0x795b07['filters']=_[_0xa27e('0x35')](_0x795b07[_0xa27e('0x32')],_0x795b07[_0xa27e('0x33')]);_0x40200a[_0xa27e('0x36')]=_[_0xa27e('0x35')](_0x795b07[_0xa27e('0x32')],qs[_0xa27e('0x37')](_0x2cbb32[_0xa27e('0x33')][_0xa27e('0x37')]));_0x40200a['attributes']=_0x40200a[_0xa27e('0x36')]['length']?_0x40200a[_0xa27e('0x36')]:_0x795b07[_0xa27e('0x32')];_0x40200a[_0xa27e('0x3b')]=qs[_0xa27e('0x3c')](_0x2cbb32[_0xa27e('0x33')][_0xa27e('0x3c')]);_0x40200a[_0xa27e('0x3d')]=qs[_0xa27e('0x3e')](_[_0xa27e('0x3f')](_0x2cbb32['query'],_0x795b07[_0xa27e('0x3e')]));if(_0x2cbb32['query'][_0xa27e('0x42')]){_0x40200a[_0xa27e('0x3d')]=_[_0xa27e('0x43')](_0x40200a[_0xa27e('0x3d')],{'$or':_[_0xa27e('0x40')](_0x40200a[_0xa27e('0x36')],function(_0x186def){var _0x48a7af={};_0x48a7af[_0x186def]={'$like':'%'+_0x2cbb32[_0xa27e('0x33')][_0xa27e('0x42')]+'%'};return _0x48a7af;})});}_0x40200a=_[_0xa27e('0x43')]({},_0x40200a,_0x2cbb32[_0xa27e('0x44')]);return _0x19058b[_0xa27e('0x50')](_0x40200a);}})[_0xa27e('0x28')](function(_0x583d45){if(_0x583d45){_0x261517=_0x583d45[_0xa27e('0x38')];if(!_0x2cbb32[_0xa27e('0x33')]['hasOwnProperty'](_0xa27e('0x3a'))){_0x40200a['limit']=qs[_0xa27e('0x1e')](_0x2cbb32['query']['limit']);_0x40200a[_0xa27e('0x1d')]=qs[_0xa27e('0x1d')](_0x2cbb32[_0xa27e('0x33')]['offset']);}return _0x19058b['getSubjects'](_0x40200a);}})[_0xa27e('0x28')](function(_0x5578ad){if(_0x5578ad){return _0x5578ad?{'count':_0x261517,'rows':_0x5578ad}:null;}})['then'](respondWithResult(_0x46c527,null))[_0xa27e('0x48')](handleError(_0x46c527,null));};exports[_0xa27e('0x51')]=function(_0x444f71,_0x1b085b,_0x363624){var _0x1a7a43={};var _0x39f09a={};var _0x32be42;var _0x16b472;return db['ZendeskConfiguration'][_0xa27e('0x4e')]({'where':{'id':_0x444f71[_0xa27e('0x4c')]['id']}})[_0xa27e('0x28')](handleEntityNotFound(_0x1b085b,null))[_0xa27e('0x28')](function(_0x441054){if(_0x441054){_0x32be42=_0x441054;_0x39f09a['model']=_[_0xa27e('0x34')](db[_0xa27e('0x4f')][_0xa27e('0x2e')]);_0x39f09a[_0xa27e('0x33')]=_['keys'](_0x444f71[_0xa27e('0x33')]);_0x39f09a[_0xa27e('0x3e')]=_[_0xa27e('0x35')](_0x39f09a[_0xa27e('0x32')],_0x39f09a[_0xa27e('0x33')]);_0x1a7a43[_0xa27e('0x36')]=_['intersection'](_0x39f09a[_0xa27e('0x32')],qs[_0xa27e('0x37')](_0x444f71[_0xa27e('0x33')][_0xa27e('0x37')]));_0x1a7a43[_0xa27e('0x36')]=_0x1a7a43[_0xa27e('0x36')]['length']?_0x1a7a43['attributes']:_0x39f09a[_0xa27e('0x32')];_0x1a7a43[_0xa27e('0x3b')]=qs[_0xa27e('0x3c')](_0x444f71['query'][_0xa27e('0x3c')]);_0x1a7a43[_0xa27e('0x3d')]=qs[_0xa27e('0x3e')](_[_0xa27e('0x3f')](_0x444f71[_0xa27e('0x33')],_0x39f09a[_0xa27e('0x3e')]));if(_0x444f71[_0xa27e('0x33')][_0xa27e('0x42')]){_0x1a7a43[_0xa27e('0x3d')]=_['merge'](_0x1a7a43['where'],{'$or':_[_0xa27e('0x40')](_0x1a7a43[_0xa27e('0x36')],function(_0x3adcd5){var _0x1a2478={};_0x1a2478[_0x3adcd5]={'$like':'%'+_0x444f71[_0xa27e('0x33')]['filter']+'%'};return _0x1a2478;})});}_0x1a7a43=_[_0xa27e('0x43')]({},_0x1a7a43,_0x444f71[_0xa27e('0x44')]);return _0x32be42[_0xa27e('0x51')](_0x1a7a43);}})[_0xa27e('0x28')](function(_0x506caf){if(_0x506caf){_0x16b472=_0x506caf[_0xa27e('0x38')];if(!_0x444f71['query'][_0xa27e('0x39')](_0xa27e('0x3a'))){_0x1a7a43[_0xa27e('0x1e')]=qs['limit'](_0x444f71[_0xa27e('0x33')][_0xa27e('0x1e')]);_0x1a7a43[_0xa27e('0x1d')]=qs[_0xa27e('0x1d')](_0x444f71[_0xa27e('0x33')][_0xa27e('0x1d')]);}return _0x32be42[_0xa27e('0x51')](_0x1a7a43);}})[_0xa27e('0x28')](function(_0x2f048){if(_0x2f048){return _0x2f048?{'count':_0x16b472,'rows':_0x2f048}:null;}})['then'](respondWithResult(_0x1b085b,null))[_0xa27e('0x48')](handleError(_0x1b085b,null));};exports[_0xa27e('0x52')]=function(_0x3f20d6,_0x3f71bb,_0x1f8d37){var _0x3f6879={};var _0x1de5de={};var _0x2194bd;var _0x56065d;return db[_0xa27e('0x2d')][_0xa27e('0x4e')]({'where':{'id':_0x3f20d6[_0xa27e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f71bb,null))[_0xa27e('0x28')](function(_0x3659d1){if(_0x3659d1){_0x2194bd=_0x3659d1;_0x1de5de['model']=_[_0xa27e('0x34')](db[_0xa27e('0x53')][_0xa27e('0x2e')]);_0x1de5de[_0xa27e('0x33')]=_[_0xa27e('0x34')](_0x3f20d6[_0xa27e('0x33')]);_0x1de5de[_0xa27e('0x3e')]=_[_0xa27e('0x35')](_0x1de5de[_0xa27e('0x32')],_0x1de5de['query']);_0x3f6879[_0xa27e('0x36')]=_[_0xa27e('0x35')](_0x1de5de['model'],qs['fields'](_0x3f20d6['query'][_0xa27e('0x37')]));_0x3f6879[_0xa27e('0x36')]=_0x3f6879[_0xa27e('0x36')]['length']?_0x3f6879['attributes']:_0x1de5de[_0xa27e('0x32')];_0x3f6879[_0xa27e('0x3b')]=qs[_0xa27e('0x3c')](_0x3f20d6['query']['sort']);_0x3f6879['where']=qs[_0xa27e('0x3e')](_[_0xa27e('0x3f')](_0x3f20d6[_0xa27e('0x33')],_0x1de5de['filters']));if(_0x3f20d6[_0xa27e('0x33')][_0xa27e('0x42')]){_0x3f6879[_0xa27e('0x3d')]=_[_0xa27e('0x43')](_0x3f6879[_0xa27e('0x3d')],{'$or':_[_0xa27e('0x40')](_0x3f6879[_0xa27e('0x36')],function(_0x186970){var _0x235580={};_0x235580[_0x186970]={'$like':'%'+_0x3f20d6[_0xa27e('0x33')]['filter']+'%'};return _0x235580;})});}_0x3f6879=_[_0xa27e('0x43')]({},_0x3f6879,_0x3f20d6['options']);return _0x2194bd[_0xa27e('0x52')](_0x3f6879);}})['then'](function(_0x45f2ae){if(_0x45f2ae){_0x56065d=_0x45f2ae[_0xa27e('0x38')];if(!_0x3f20d6[_0xa27e('0x33')]['hasOwnProperty']('nolimit')){_0x3f6879[_0xa27e('0x1e')]=qs[_0xa27e('0x1e')](_0x3f20d6[_0xa27e('0x33')][_0xa27e('0x1e')]);_0x3f6879[_0xa27e('0x1d')]=qs['offset'](_0x3f20d6['query'][_0xa27e('0x1d')]);}return _0x2194bd[_0xa27e('0x52')](_0x3f6879);}})[_0xa27e('0x28')](function(_0x23e505){if(_0x23e505){return _0x23e505?{'count':_0x56065d,'rows':_0x23e505}:null;}})[_0xa27e('0x28')](respondWithResult(_0x3f71bb,null))[_0xa27e('0x48')](handleError(_0x3f71bb,null));};exports[_0xa27e('0x54')]=function(_0x462a70,_0x38434a,_0x4e78dd){if(_0x462a70[_0xa27e('0x4a')]['id']){delete _0x462a70[_0xa27e('0x4a')]['id'];}return db[_0xa27e('0x2d')][_0xa27e('0x4e')]({'where':{'id':_0x462a70['params']['id']}})[_0xa27e('0x28')](handleEntityNotFound(_0x38434a,null))[_0xa27e('0x28')](function(_0x56a144){if(_0x56a144){return _0x56a144['setTags'](_0x462a70[_0xa27e('0x4a')][_0xa27e('0x55')]||[]);}return null;})[_0xa27e('0x28')](respondWithResult(_0x38434a,null))[_0xa27e('0x48')](handleError(_0x38434a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 027ad98..8a8b603 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x1f8e39,_0x53b1b7){var _0x43e502=function(_0x66df86){while(--_0x66df86){_0x1f8e39['push'](_0x1f8e39['shift']());}};_0x43e502(++_0x53b1b7);}(_0x3266,0x6a));var _0x6326=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x3266[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab40=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0xab40,0xcd));var _0x0ab4=function(_0x29bfda,_0xb02a33){_0x29bfda=_0x29bfda-0x0;var _0x1eece4=_0xab40[_0x29bfda];return _0x1eece4;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 0492a47..713377d 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 _0xae8b=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird'];(function(_0xe95eff,_0x434b0f){var _0x1cff64=function(_0x1dea27){while(--_0x1dea27){_0xe95eff['push'](_0xe95eff['shift']());}};_0x1cff64(++_0x434b0f);}(_0xae8b,0xe5));var _0xbae8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xae8b[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xbae8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbae8('0x1'));var rs=require(_0xbae8('0x2'));var fs=require('fs');var Redis=require(_0xbae8('0x3'));var db=require(_0xbae8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbae8('0x5'))(_0xbae8('0x6'));var config=require(_0xbae8('0x7'));var jayson=require(_0xbae8('0x8'));var client=jayson[_0xbae8('0x9')][_0xbae8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57e522,_0x5b3f67,_0x13cc3e){return new BPromise(function(_0x49ead9,_0x31f576){return client[_0xbae8('0xb')](_0x57e522,_0x13cc3e)['then'](function(_0x2bcf43){logger[_0xbae8('0xc')](_0xbae8('0xd'),_0x5b3f67,_0xbae8('0xe'));logger[_0xbae8('0xf')](_0xbae8('0x10'),_0x5b3f67,_0xbae8('0xe'),JSON[_0xbae8('0x11')](_0x2bcf43));if(_0x2bcf43['error']){if(_0x2bcf43[_0xbae8('0x12')][_0xbae8('0x13')]===0x1f4){logger[_0xbae8('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b3f67,_0x2bcf43[_0xbae8('0x12')][_0xbae8('0x14')]);return _0x31f576(_0x2bcf43[_0xbae8('0x12')]['message']);}logger[_0xbae8('0x12')](_0xbae8('0xd'),_0x5b3f67,_0x2bcf43[_0xbae8('0x12')]['message']);return _0x49ead9(_0x2bcf43['error']['message']);}else{logger['info'](_0xbae8('0xd'),_0x5b3f67,_0xbae8('0xe'));_0x49ead9(_0x2bcf43['result']['message']);}})['catch'](function(_0x1aa0b2){logger[_0xbae8('0x12')](_0xbae8('0xd'),_0x5b3f67,_0x1aa0b2);_0x31f576(_0x1aa0b2);});});} \ No newline at end of file +var _0xaece=['ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x2867a6,_0x10d905){var _0x4afc2b=function(_0x457840){while(--_0x457840){_0x2867a6['push'](_0x2867a6['shift']());}};_0x4afc2b(++_0x10d905);}(_0xaece,0xb4));var _0xeaec=function(_0x20538d,_0x2e3572){_0x20538d=_0x20538d-0x0;var _0x499571=_0xaece[_0x20538d];return _0x499571;};'use strict';var _=require(_0xeaec('0x0'));var util=require(_0xeaec('0x1'));var moment=require(_0xeaec('0x2'));var BPromise=require(_0xeaec('0x3'));var rs=require(_0xeaec('0x4'));var fs=require('fs');var Redis=require(_0xeaec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeaec('0x6'));var logger=require(_0xeaec('0x7'))(_0xeaec('0x8'));var config=require('../../config/environment');var jayson=require(_0xeaec('0x9'));var client=jayson['client'][_0xeaec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xabe97b,_0x1cf92a,_0x21c582){return new BPromise(function(_0x4acf66,_0x2a58f7){return client[_0xeaec('0xb')](_0xabe97b,_0x21c582)[_0xeaec('0xc')](function(_0x23543a){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1cf92a,'request\x20sent');logger[_0xeaec('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1cf92a,_0xeaec('0xe'),JSON[_0xeaec('0xf')](_0x23543a));if(_0x23543a['error']){if(_0x23543a[_0xeaec('0x10')][_0xeaec('0x11')]===0x1f4){logger[_0xeaec('0x10')](_0xeaec('0x12'),_0x1cf92a,_0x23543a[_0xeaec('0x10')]['message']);return _0x2a58f7(_0x23543a[_0xeaec('0x10')][_0xeaec('0x13')]);}logger[_0xeaec('0x10')](_0xeaec('0x12'),_0x1cf92a,_0x23543a['error'][_0xeaec('0x13')]);return _0x4acf66(_0x23543a[_0xeaec('0x10')][_0xeaec('0x13')]);}else{logger['info'](_0xeaec('0x12'),_0x1cf92a,'request\x20sent');_0x4acf66(_0x23543a[_0xeaec('0x14')][_0xeaec('0x13')]);}})[_0xeaec('0x15')](function(_0x227384){logger[_0xeaec('0x10')](_0xeaec('0x12'),_0x1cf92a,_0x227384);_0x2a58f7(_0x227384);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 9683f6a..eef4bf8 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 _0xe9e1=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x1229d3,_0x1534b1){var _0x292e05=function(_0x543a12){while(--_0x543a12){_0x1229d3['push'](_0x1229d3['shift']());}};_0x292e05(++_0x1534b1);}(_0xe9e1,0xa3));var _0x1e9e=function(_0x44741f,_0x4cd02a){_0x44741f=_0x44741f-0x0;var _0x4a976e=_0xe9e1[_0x44741f];return _0x4a976e;};'use strict';var multer=require(_0x1e9e('0x0'));var util=require(_0x1e9e('0x1'));var path=require(_0x1e9e('0x2'));var timeout=require(_0x1e9e('0x3'));var express=require(_0x1e9e('0x4'));var router=express[_0x1e9e('0x5')]();var fs_extra=require(_0x1e9e('0x6'));var auth=require(_0x1e9e('0x7'));var interaction=require(_0x1e9e('0x8'));var config=require(_0x1e9e('0x9'));var controller=require(_0x1e9e('0xa'));router[_0x1e9e('0xb')]('/',auth[_0x1e9e('0xc')](),controller['index']);router[_0x1e9e('0xb')](_0x1e9e('0xd'),auth[_0x1e9e('0xc')](),controller[_0x1e9e('0xe')]);router[_0x1e9e('0xf')]('/',auth[_0x1e9e('0xc')](),controller['create']);router[_0x1e9e('0x10')]('/:id',auth[_0x1e9e('0xc')](),controller[_0x1e9e('0x11')]);router[_0x1e9e('0x12')]('/:id',auth[_0x1e9e('0xc')](),controller['destroy']);module[_0x1e9e('0x13')]=router; \ No newline at end of file +var _0xc3ac=['get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x3eb028,_0x2fb620){var _0x3557b8=function(_0xf899ca){while(--_0xf899ca){_0x3eb028['push'](_0x3eb028['shift']());}};_0x3557b8(++_0x2fb620);}(_0xc3ac,0x76));var _0xcc3a=function(_0x5c96dd,_0x3017af){_0x5c96dd=_0x5c96dd-0x0;var _0x20416f=_0xc3ac[_0x5c96dd];return _0x20416f;};'use strict';var multer=require(_0xcc3a('0x0'));var util=require('util');var path=require(_0xcc3a('0x1'));var timeout=require('connect-timeout');var express=require(_0xcc3a('0x2'));var router=express[_0xcc3a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcc3a('0x4'));var interaction=require(_0xcc3a('0x5'));var config=require(_0xcc3a('0x6'));var controller=require(_0xcc3a('0x7'));router[_0xcc3a('0x8')]('/',auth[_0xcc3a('0x9')](),controller[_0xcc3a('0xa')]);router[_0xcc3a('0x8')]('/:id',auth[_0xcc3a('0x9')](),controller[_0xcc3a('0xb')]);router[_0xcc3a('0xc')]('/',auth['isAuthenticated'](),controller[_0xcc3a('0xd')]);router['put'](_0xcc3a('0xe'),auth['isAuthenticated'](),controller[_0xcc3a('0xf')]);router[_0xcc3a('0x10')](_0xcc3a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc3a('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 8fd1a8a..f87c492 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 _0x11ae=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x5a0fc8,_0x21be76){var _0x4afc31=function(_0x3a5404){while(--_0x3a5404){_0x5a0fc8['push'](_0x5a0fc8['shift']());}};_0x4afc31(++_0x21be76);}(_0x11ae,0xa9));var _0xe11a=function(_0x5acfbf,_0x2169c6){_0x5acfbf=_0x5acfbf-0x0;var _0x1dbcb5=_0x11ae[_0x5acfbf];return _0x1dbcb5;};'use strict';var Sequelize=require(_0xe11a('0x0'));module[_0xe11a('0x1')]={'type':{'type':Sequelize[_0xe11a('0x2')](_0xe11a('0x3'),'variable',_0xe11a('0x4'),_0xe11a('0x5'),_0xe11a('0x6')),'defaultValue':_0xe11a('0x3')},'content':{'type':Sequelize[_0xe11a('0x7')]},'key':{'type':Sequelize[_0xe11a('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe11a('0x8'),_0xe11a('0x4'))},'keyContent':{'type':Sequelize[_0xe11a('0x7')]},'idField':{'type':Sequelize[_0xe11a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe11a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe11a('0x7')]}}; \ No newline at end of file +var _0x7865=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x140465,_0x27352e){var _0x1f1182=function(_0x43df93){while(--_0x43df93){_0x140465['push'](_0x140465['shift']());}};_0x1f1182(++_0x27352e);}(_0x7865,0xe7));var _0x5786=function(_0x515552,_0x122a45){_0x515552=_0x515552-0x0;var _0x4a7d9d=_0x7865[_0x515552];return _0x4a7d9d;};'use strict';var Sequelize=require(_0x5786('0x0'));module[_0x5786('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5786('0x2'),_0x5786('0x3'),_0x5786('0x4'),_0x5786('0x5'),_0x5786('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5786('0x7')]},'key':{'type':Sequelize[_0x5786('0x7')]},'keyType':{'type':Sequelize[_0x5786('0x8')](_0x5786('0x2'),'variable',_0x5786('0x4'))},'keyContent':{'type':Sequelize[_0x5786('0x7')]},'idField':{'type':Sequelize[_0x5786('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5786('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 111d321..c88f678 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 _0x5eca=['then','destroy','end','error','stack','name','ZendeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','find','catch','create','body','eml-format','fast-json-patch','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','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update'];(function(_0xd1ecc6,_0x98257e){var _0xbf2244=function(_0x11098b){while(--_0x11098b){_0xd1ecc6['push'](_0xd1ecc6['shift']());}};_0xbf2244(++_0x98257e);}(_0x5eca,0x157));var _0xa5ec=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5eca[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xa5ec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa5ec('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa5ec('0x2'));var Mustache=require('mustache');var util=require(_0xa5ec('0x3'));var path=require(_0xa5ec('0x4'));var sox=require(_0xa5ec('0x5'));var csv=require('to-csv');var ejs=require(_0xa5ec('0x6'));var fs=require('fs');var fs_extra=require(_0xa5ec('0x7'));var _=require(_0xa5ec('0x8'));var squel=require(_0xa5ec('0x9'));var crypto=require(_0xa5ec('0xa'));var jsforce=require(_0xa5ec('0xb'));var deskjs=require(_0xa5ec('0xc'));var toCsv=require(_0xa5ec('0xd'));var querystring=require(_0xa5ec('0xe'));var Papa=require(_0xa5ec('0xf'));var Redis=require('ioredis');var authService=require(_0xa5ec('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa5ec('0x11'));var hardwareService=require(_0xa5ec('0x12'));var logger=require(_0xa5ec('0x13'))(_0xa5ec('0x14'));var utils=require(_0xa5ec('0x15'));var config=require(_0xa5ec('0x16'));var licenseUtil=require(_0xa5ec('0x17'));var db=require(_0xa5ec('0x18'))['db'];function respondWithStatusCode(_0x4c7de5,_0x327b49){_0x327b49=_0x327b49||0xcc;return function(_0xb8c6ec){if(_0xb8c6ec){return _0x4c7de5[_0xa5ec('0x19')](_0x327b49);}return _0x4c7de5[_0xa5ec('0x1a')](_0x327b49)['end']();};}function respondWithResult(_0x3e8f84,_0x3f70fb){_0x3f70fb=_0x3f70fb||0xc8;return function(_0x42d79d){if(_0x42d79d){return _0x3e8f84[_0xa5ec('0x1a')](_0x3f70fb)['json'](_0x42d79d);}};}function respondWithFilteredResult(_0x5e33b4,_0x2522ce){return function(_0x30c151){if(_0x30c151){var _0x2e9ef5=typeof _0x2522ce[_0xa5ec('0x1b')]===_0xa5ec('0x1c')&&typeof _0x2522ce[_0xa5ec('0x1d')]==='undefined';var _0x5aa112=_0x30c151['count'];var _0x34b84e=_0x2e9ef5?0x0:_0x2522ce[_0xa5ec('0x1b')];var _0x3f8dae=_0x2e9ef5?_0x30c151[_0xa5ec('0x1e')]:_0x2522ce[_0xa5ec('0x1b')]+_0x2522ce['limit'];var _0x4bc462;if(_0x3f8dae>=_0x5aa112){_0x3f8dae=_0x5aa112;_0x4bc462=0xc8;}else{_0x4bc462=0xce;}_0x5e33b4[_0xa5ec('0x1a')](_0x4bc462);return _0x5e33b4[_0xa5ec('0x1f')](_0xa5ec('0x20'),_0x34b84e+'-'+_0x3f8dae+'/'+_0x5aa112)[_0xa5ec('0x21')](_0x30c151);}return null;};}function patchUpdates(_0x1fac2f){return function(_0xb959e4){try{jsonpatch['apply'](_0xb959e4,_0x1fac2f,!![]);}catch(_0x49ab7a){return BPromise[_0xa5ec('0x22')](_0x49ab7a);}return _0xb959e4[_0xa5ec('0x23')]();};}function saveUpdates(_0x532208,_0x2c05cd){return function(_0x3a5a0c){if(_0x3a5a0c){return _0x3a5a0c[_0xa5ec('0x24')](_0x532208)[_0xa5ec('0x25')](function(_0x27b24c){return _0x27b24c;});}return null;};}function removeEntity(_0x372d64,_0x5187c5){return function(_0x9743af){if(_0x9743af){return _0x9743af[_0xa5ec('0x26')]()[_0xa5ec('0x25')](function(){_0x372d64[_0xa5ec('0x1a')](0xcc)[_0xa5ec('0x27')]();});}};}function handleEntityNotFound(_0x4f6e47,_0xef11c5){return function(_0x4f7feb){if(!_0x4f7feb){_0x4f6e47[_0xa5ec('0x19')](0x194);}return _0x4f7feb;};}function handleError(_0x4f0e39,_0x9480cc){_0x9480cc=_0x9480cc||0x1f4;return function(_0x5e3809){logger[_0xa5ec('0x28')](_0x5e3809[_0xa5ec('0x29')]);if(_0x5e3809[_0xa5ec('0x2a')]){delete _0x5e3809[_0xa5ec('0x2a')];}_0x4f0e39[_0xa5ec('0x1a')](_0x9480cc)['send'](_0x5e3809);};}exports['index']=function(_0x547dcd,_0x4f4ceb){var _0x1fa1a0={},_0x29ad5a={},_0xd45eb1={'count':0x0,'rows':[]};var _0x33cdd0=_['map'](db[_0xa5ec('0x2b')][_0xa5ec('0x2c')],function(_0x560bb9){return{'name':_0x560bb9[_0xa5ec('0x2d')],'type':_0x560bb9[_0xa5ec('0x2e')][_0xa5ec('0x2f')]};});_0x29ad5a['model']=_[_0xa5ec('0x30')](_0x33cdd0,_0xa5ec('0x2a'));_0x29ad5a[_0xa5ec('0x31')]=_[_0xa5ec('0x32')](_0x547dcd[_0xa5ec('0x31')]);_0x29ad5a[_0xa5ec('0x33')]=_['intersection'](_0x29ad5a[_0xa5ec('0x34')],_0x29ad5a['query']);_0x1fa1a0[_0xa5ec('0x35')]=_[_0xa5ec('0x36')](_0x29ad5a['model'],qs[_0xa5ec('0x37')](_0x547dcd['query'][_0xa5ec('0x37')]));_0x1fa1a0[_0xa5ec('0x35')]=_0x1fa1a0[_0xa5ec('0x35')][_0xa5ec('0x38')]?_0x1fa1a0[_0xa5ec('0x35')]:_0x29ad5a[_0xa5ec('0x34')];if(!_0x547dcd['query'][_0xa5ec('0x39')](_0xa5ec('0x3a'))){_0x1fa1a0[_0xa5ec('0x1d')]=qs['limit'](_0x547dcd[_0xa5ec('0x31')][_0xa5ec('0x1d')]);_0x1fa1a0[_0xa5ec('0x1b')]=qs[_0xa5ec('0x1b')](_0x547dcd[_0xa5ec('0x31')][_0xa5ec('0x1b')]);}_0x1fa1a0[_0xa5ec('0x3b')]=qs[_0xa5ec('0x3c')](_0x547dcd[_0xa5ec('0x31')][_0xa5ec('0x3c')]);_0x1fa1a0[_0xa5ec('0x3d')]=qs['filters'](_[_0xa5ec('0x3e')](_0x547dcd['query'],_0x29ad5a[_0xa5ec('0x33')]),_0x33cdd0);if(_0x547dcd[_0xa5ec('0x31')][_0xa5ec('0x3f')]){_0x1fa1a0[_0xa5ec('0x3d')]=_['merge'](_0x1fa1a0['where'],{'$or':_['map'](_0x33cdd0,function(_0x12aea9){if(_0x12aea9[_0xa5ec('0x2e')]!==_0xa5ec('0x40')){var _0x206137={};_0x206137[_0x12aea9[_0xa5ec('0x2a')]]={'$like':'%'+_0x547dcd[_0xa5ec('0x31')]['filter']+'%'};return _0x206137;}})});}_0x1fa1a0=_['merge']({},_0x1fa1a0,_0x547dcd[_0xa5ec('0x41')]);var _0x129ad5={'where':_0x1fa1a0[_0xa5ec('0x3d')]};return db[_0xa5ec('0x2b')]['count'](_0x129ad5)[_0xa5ec('0x25')](function(_0x1535d7){_0xd45eb1['count']=_0x1535d7;if(_0x547dcd['query'][_0xa5ec('0x42')]){_0x1fa1a0[_0xa5ec('0x43')]=[{'all':!![]}];}return db[_0xa5ec('0x2b')][_0xa5ec('0x44')](_0x1fa1a0);})[_0xa5ec('0x25')](function(_0x270111){_0xd45eb1[_0xa5ec('0x45')]=_0x270111;return _0xd45eb1;})[_0xa5ec('0x25')](respondWithFilteredResult(_0x4f4ceb,_0x1fa1a0))['catch'](handleError(_0x4f4ceb,null));};exports['show']=function(_0x4bbf74,_0x1001cf){var _0x102932={'raw':!![],'where':{'id':_0x4bbf74[_0xa5ec('0x46')]['id']}},_0x4a722d={};_0x4a722d[_0xa5ec('0x34')]=_[_0xa5ec('0x32')](db[_0xa5ec('0x2b')][_0xa5ec('0x2c')]);_0x4a722d[_0xa5ec('0x31')]=_[_0xa5ec('0x32')](_0x4bbf74[_0xa5ec('0x31')]);_0x4a722d[_0xa5ec('0x33')]=_[_0xa5ec('0x36')](_0x4a722d[_0xa5ec('0x34')],_0x4a722d[_0xa5ec('0x31')]);_0x102932[_0xa5ec('0x35')]=_[_0xa5ec('0x36')](_0x4a722d[_0xa5ec('0x34')],qs[_0xa5ec('0x37')](_0x4bbf74[_0xa5ec('0x31')][_0xa5ec('0x37')]));_0x102932['attributes']=_0x102932[_0xa5ec('0x35')][_0xa5ec('0x38')]?_0x102932[_0xa5ec('0x35')]:_0x4a722d[_0xa5ec('0x34')];if(_0x4bbf74[_0xa5ec('0x31')][_0xa5ec('0x42')]){_0x102932[_0xa5ec('0x43')]=[{'all':!![]}];}_0x102932=_[_0xa5ec('0x47')]({},_0x102932,_0x4bbf74['options']);return db['ZendeskField'][_0xa5ec('0x48')](_0x102932)[_0xa5ec('0x25')](handleEntityNotFound(_0x1001cf,null))[_0xa5ec('0x25')](respondWithResult(_0x1001cf,null))[_0xa5ec('0x49')](handleError(_0x1001cf,null));};exports[_0xa5ec('0x4a')]=function(_0x4a1ce1,_0x3090e4){return db[_0xa5ec('0x2b')][_0xa5ec('0x4a')](_0x4a1ce1[_0xa5ec('0x4b')],{})[_0xa5ec('0x25')](respondWithResult(_0x3090e4,0xc9))[_0xa5ec('0x49')](handleError(_0x3090e4,null));};exports['update']=function(_0x4a8eed,_0x220f1b){if(_0x4a8eed[_0xa5ec('0x4b')]['id']){delete _0x4a8eed[_0xa5ec('0x4b')]['id'];}return db[_0xa5ec('0x2b')][_0xa5ec('0x48')]({'where':{'id':_0x4a8eed[_0xa5ec('0x46')]['id']}})[_0xa5ec('0x25')](handleEntityNotFound(_0x220f1b,null))[_0xa5ec('0x25')](saveUpdates(_0x4a8eed[_0xa5ec('0x4b')],null))['then'](respondWithResult(_0x220f1b,null))['catch'](handleError(_0x220f1b,null));};exports[_0xa5ec('0x26')]=function(_0x400c87,_0x3b46cc){return db[_0xa5ec('0x2b')][_0xa5ec('0x48')]({'where':{'id':_0x400c87['params']['id']}})['then'](handleEntityNotFound(_0x3b46cc,null))[_0xa5ec('0x25')](removeEntity(_0x3b46cc,null))['catch'](handleError(_0x3b46cc,null));}; \ No newline at end of file +var _0x0ae5=['ejs','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','params','intersection','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox'];(function(_0x40fb65,_0x5814c2){var _0x5bd7ba=function(_0x39ba35){while(--_0x39ba35){_0x40fb65['push'](_0x40fb65['shift']());}};_0x5bd7ba(++_0x5814c2);}(_0x0ae5,0x1a8));var _0x50ae=function(_0x4d94bd,_0x2a2550){_0x4d94bd=_0x4d94bd-0x0;var _0x482def=_0x0ae5[_0x4d94bd];return _0x482def;};'use strict';var emlformat=require(_0x50ae('0x0'));var rimraf=require(_0x50ae('0x1'));var zipdir=require(_0x50ae('0x2'));var jsonpatch=require(_0x50ae('0x3'));var rp=require('request-promise');var moment=require(_0x50ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x50ae('0x5'));var util=require(_0x50ae('0x6'));var path=require('path');var sox=require(_0x50ae('0x7'));var csv=require('to-csv');var ejs=require(_0x50ae('0x8'));var fs=require('fs');var fs_extra=require(_0x50ae('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x50ae('0xa'));var jsforce=require(_0x50ae('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x50ae('0xc'));var querystring=require(_0x50ae('0xd'));var Papa=require('papaparse');var Redis=require(_0x50ae('0xe'));var authService=require(_0x50ae('0xf'));var qs=require(_0x50ae('0x10'));var as=require(_0x50ae('0x11'));var hardwareService=require(_0x50ae('0x12'));var logger=require(_0x50ae('0x13'))('api');var utils=require(_0x50ae('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x50ae('0x15'));var db=require(_0x50ae('0x16'))['db'];function respondWithStatusCode(_0x4a6d58,_0x1384bd){_0x1384bd=_0x1384bd||0xcc;return function(_0x2f3c0d){if(_0x2f3c0d){return _0x4a6d58[_0x50ae('0x17')](_0x1384bd);}return _0x4a6d58[_0x50ae('0x18')](_0x1384bd)[_0x50ae('0x19')]();};}function respondWithResult(_0x1b03a7,_0xe70138){_0xe70138=_0xe70138||0xc8;return function(_0x599f1c){if(_0x599f1c){return _0x1b03a7[_0x50ae('0x18')](_0xe70138)['json'](_0x599f1c);}};}function respondWithFilteredResult(_0x29132a,_0x5a428d){return function(_0x2a8de8){if(_0x2a8de8){var _0x3ef9c9=typeof _0x5a428d['offset']===_0x50ae('0x1a')&&typeof _0x5a428d[_0x50ae('0x1b')]===_0x50ae('0x1a');var _0x2cf706=_0x2a8de8['count'];var _0x3966fd=_0x3ef9c9?0x0:_0x5a428d[_0x50ae('0x1c')];var _0x353f66=_0x3ef9c9?_0x2a8de8['count']:_0x5a428d[_0x50ae('0x1c')]+_0x5a428d[_0x50ae('0x1b')];var _0x15139a;if(_0x353f66>=_0x2cf706){_0x353f66=_0x2cf706;_0x15139a=0xc8;}else{_0x15139a=0xce;}_0x29132a[_0x50ae('0x18')](_0x15139a);return _0x29132a[_0x50ae('0x1d')](_0x50ae('0x1e'),_0x3966fd+'-'+_0x353f66+'/'+_0x2cf706)['json'](_0x2a8de8);}return null;};}function patchUpdates(_0x2c0dae){return function(_0xa22f83){try{jsonpatch[_0x50ae('0x1f')](_0xa22f83,_0x2c0dae,!![]);}catch(_0x4d2a52){return BPromise[_0x50ae('0x20')](_0x4d2a52);}return _0xa22f83[_0x50ae('0x21')]();};}function saveUpdates(_0xb479aa,_0x337325){return function(_0x27b07e){if(_0x27b07e){return _0x27b07e[_0x50ae('0x22')](_0xb479aa)[_0x50ae('0x23')](function(_0x7590a3){return _0x7590a3;});}return null;};}function removeEntity(_0x36a55a,_0x46a1b6){return function(_0x48f711){if(_0x48f711){return _0x48f711[_0x50ae('0x24')]()['then'](function(){_0x36a55a[_0x50ae('0x18')](0xcc)[_0x50ae('0x19')]();});}};}function handleEntityNotFound(_0x219df0,_0x47defa){return function(_0x6e0bfe){if(!_0x6e0bfe){_0x219df0[_0x50ae('0x17')](0x194);}return _0x6e0bfe;};}function handleError(_0x4f7d09,_0x4f710b){_0x4f710b=_0x4f710b||0x1f4;return function(_0x249543){logger[_0x50ae('0x25')](_0x249543[_0x50ae('0x26')]);if(_0x249543[_0x50ae('0x27')]){delete _0x249543['name'];}_0x4f7d09['status'](_0x4f710b)[_0x50ae('0x28')](_0x249543);};}exports['index']=function(_0x3626a6,_0x4dcf3e){var _0x256219={},_0x353cab={},_0x1d294c={'count':0x0,'rows':[]};var _0x53d5c5=_[_0x50ae('0x29')](db[_0x50ae('0x2a')][_0x50ae('0x2b')],function(_0x133a14){return{'name':_0x133a14[_0x50ae('0x2c')],'type':_0x133a14[_0x50ae('0x2d')]['key']};});_0x353cab['model']=_['map'](_0x53d5c5,_0x50ae('0x27'));_0x353cab[_0x50ae('0x2e')]=_['keys'](_0x3626a6[_0x50ae('0x2e')]);_0x353cab['filters']=_['intersection'](_0x353cab[_0x50ae('0x2f')],_0x353cab[_0x50ae('0x2e')]);_0x256219[_0x50ae('0x30')]=_['intersection'](_0x353cab[_0x50ae('0x2f')],qs['fields'](_0x3626a6[_0x50ae('0x2e')][_0x50ae('0x31')]));_0x256219['attributes']=_0x256219['attributes']['length']?_0x256219[_0x50ae('0x30')]:_0x353cab[_0x50ae('0x2f')];if(!_0x3626a6[_0x50ae('0x2e')][_0x50ae('0x32')](_0x50ae('0x33'))){_0x256219['limit']=qs[_0x50ae('0x1b')](_0x3626a6['query']['limit']);_0x256219[_0x50ae('0x1c')]=qs['offset'](_0x3626a6[_0x50ae('0x2e')][_0x50ae('0x1c')]);}_0x256219[_0x50ae('0x34')]=qs[_0x50ae('0x35')](_0x3626a6['query'][_0x50ae('0x35')]);_0x256219[_0x50ae('0x36')]=qs[_0x50ae('0x37')](_[_0x50ae('0x38')](_0x3626a6['query'],_0x353cab[_0x50ae('0x37')]),_0x53d5c5);if(_0x3626a6['query'][_0x50ae('0x39')]){_0x256219[_0x50ae('0x36')]=_['merge'](_0x256219[_0x50ae('0x36')],{'$or':_[_0x50ae('0x29')](_0x53d5c5,function(_0x33d65b){if(_0x33d65b[_0x50ae('0x2d')]!==_0x50ae('0x3a')){var _0x4851a2={};_0x4851a2[_0x33d65b[_0x50ae('0x27')]]={'$like':'%'+_0x3626a6[_0x50ae('0x2e')][_0x50ae('0x39')]+'%'};return _0x4851a2;}})});}_0x256219=_[_0x50ae('0x3b')]({},_0x256219,_0x3626a6[_0x50ae('0x3c')]);var _0x81e4e={'where':_0x256219[_0x50ae('0x36')]};return db[_0x50ae('0x2a')][_0x50ae('0x3d')](_0x81e4e)[_0x50ae('0x23')](function(_0x3966d4){_0x1d294c['count']=_0x3966d4;if(_0x3626a6['query'][_0x50ae('0x3e')]){_0x256219[_0x50ae('0x3f')]=[{'all':!![]}];}return db[_0x50ae('0x2a')]['findAll'](_0x256219);})['then'](function(_0x33e8c1){_0x1d294c[_0x50ae('0x40')]=_0x33e8c1;return _0x1d294c;})[_0x50ae('0x23')](respondWithFilteredResult(_0x4dcf3e,_0x256219))[_0x50ae('0x41')](handleError(_0x4dcf3e,null));};exports['show']=function(_0x240422,_0x2818cd){var _0x326515={'raw':!![],'where':{'id':_0x240422[_0x50ae('0x42')]['id']}},_0x988cd2={};_0x988cd2[_0x50ae('0x2f')]=_['keys'](db[_0x50ae('0x2a')][_0x50ae('0x2b')]);_0x988cd2[_0x50ae('0x2e')]=_['keys'](_0x240422['query']);_0x988cd2[_0x50ae('0x37')]=_[_0x50ae('0x43')](_0x988cd2[_0x50ae('0x2f')],_0x988cd2['query']);_0x326515[_0x50ae('0x30')]=_['intersection'](_0x988cd2[_0x50ae('0x2f')],qs[_0x50ae('0x31')](_0x240422[_0x50ae('0x2e')]['fields']));_0x326515['attributes']=_0x326515['attributes'][_0x50ae('0x44')]?_0x326515['attributes']:_0x988cd2[_0x50ae('0x2f')];if(_0x240422[_0x50ae('0x2e')][_0x50ae('0x3e')]){_0x326515[_0x50ae('0x3f')]=[{'all':!![]}];}_0x326515=_['merge']({},_0x326515,_0x240422[_0x50ae('0x3c')]);return db[_0x50ae('0x2a')]['find'](_0x326515)['then'](handleEntityNotFound(_0x2818cd,null))[_0x50ae('0x23')](respondWithResult(_0x2818cd,null))[_0x50ae('0x41')](handleError(_0x2818cd,null));};exports[_0x50ae('0x45')]=function(_0x5934dc,_0x4df829){return db[_0x50ae('0x2a')][_0x50ae('0x45')](_0x5934dc[_0x50ae('0x46')],{})[_0x50ae('0x23')](respondWithResult(_0x4df829,0xc9))['catch'](handleError(_0x4df829,null));};exports[_0x50ae('0x22')]=function(_0x18da39,_0x3ed0be){if(_0x18da39[_0x50ae('0x46')]['id']){delete _0x18da39[_0x50ae('0x46')]['id'];}return db['ZendeskField'][_0x50ae('0x47')]({'where':{'id':_0x18da39[_0x50ae('0x42')]['id']}})[_0x50ae('0x23')](handleEntityNotFound(_0x3ed0be,null))[_0x50ae('0x23')](saveUpdates(_0x18da39[_0x50ae('0x46')],null))[_0x50ae('0x23')](respondWithResult(_0x3ed0be,null))[_0x50ae('0x41')](handleError(_0x3ed0be,null));};exports['destroy']=function(_0x48ee93,_0x2487d4){return db['ZendeskField'][_0x50ae('0x47')]({'where':{'id':_0x48ee93['params']['id']}})[_0x50ae('0x23')](handleEntityNotFound(_0x2487d4,null))[_0x50ae('0x23')](removeEntity(_0x2487d4,null))['catch'](handleError(_0x2487d4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 33e18f6..fc2fa62 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 _0x9a77=['api','moment','bluebird','request-promise','path','../../config/environment','define','zendesk_unique_index','lodash','util','../../config/logger'];(function(_0x4da7d4,_0x57024b){var _0x5cb5bd=function(_0x6d4d66){while(--_0x6d4d66){_0x4da7d4['push'](_0x4da7d4['shift']());}};_0x5cb5bd(++_0x57024b);}(_0x9a77,0x152));var _0x79a7=function(_0x45888c,_0x3feb61){_0x45888c=_0x45888c-0x0;var _0x2a2778=_0x9a77[_0x45888c];return _0x2a2778;};'use strict';var _=require(_0x79a7('0x0'));var util=require(_0x79a7('0x1'));var logger=require(_0x79a7('0x2'))(_0x79a7('0x3'));var moment=require(_0x79a7('0x4'));var BPromise=require(_0x79a7('0x5'));var rp=require(_0x79a7('0x6'));var fs=require('fs');var path=require(_0x79a7('0x7'));var rimraf=require('rimraf');var config=require(_0x79a7('0x8'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x5a1cba,_0x2d6e5c){return _0x5a1cba[_0x79a7('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x79a7('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x832a=['moment','bluebird','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4ade33,_0x103537){var _0x162cc1=function(_0x1c52ab){while(--_0x1c52ab){_0x4ade33['push'](_0x4ade33['shift']());}};_0x162cc1(++_0x103537);}(_0x832a,0x173));var _0xa832=function(_0x1f625b,_0x276b0e){_0x1f625b=_0x1f625b-0x0;var _0x748222=_0x832a[_0x1f625b];return _0x748222;};'use strict';var _=require(_0xa832('0x0'));var util=require(_0xa832('0x1'));var logger=require(_0xa832('0x2'))(_0xa832('0x3'));var moment=require(_0xa832('0x4'));var BPromise=require(_0xa832('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa832('0x6'));var rimraf=require(_0xa832('0x7'));var config=require('../../config/environment');var attributes=require(_0xa832('0x8'));module[_0xa832('0x9')]=function(_0x526321,_0x349372){return _0x526321[_0xa832('0xa')](_0xa832('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xa832('0xc'),'fields':[_0xa832('0xd'),_0xa832('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 ab072d0..9781812 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 _0x9fb3=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x324ddd,_0x1ca6c2){var _0x36a9c1=function(_0x3e53ae){while(--_0x3e53ae){_0x324ddd['push'](_0x324ddd['shift']());}};_0x36a9c1(++_0x1ca6c2);}(_0x9fb3,0x19c));var _0x39fb=function(_0x4ec9a1,_0x50b0f2){_0x4ec9a1=_0x4ec9a1-0x0;var _0x102d6f=_0x9fb3[_0x4ec9a1];return _0x102d6f;};'use strict';var _=require(_0x39fb('0x0'));var util=require(_0x39fb('0x1'));var moment=require(_0x39fb('0x2'));var BPromise=require(_0x39fb('0x3'));var rs=require(_0x39fb('0x4'));var fs=require('fs');var Redis=require(_0x39fb('0x5'));var db=require(_0x39fb('0x6'))['db'];var utils=require(_0x39fb('0x7'));var logger=require(_0x39fb('0x8'))(_0x39fb('0x9'));var config=require('../../config/environment');var jayson=require(_0x39fb('0xa'));var client=jayson['client'][_0x39fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd0f1,_0x5b8779,_0x4b13de){return new BPromise(function(_0x730bfe,_0x584877){return client[_0x39fb('0xc')](_0xbd0f1,_0x4b13de)[_0x39fb('0xd')](function(_0x49d2fb){logger['info'](_0x39fb('0xe'),_0x5b8779,_0x39fb('0xf'));logger[_0x39fb('0x10')](_0x39fb('0x11'),_0x5b8779,_0x39fb('0xf'),JSON[_0x39fb('0x12')](_0x49d2fb));if(_0x49d2fb[_0x39fb('0x13')]){if(_0x49d2fb[_0x39fb('0x13')]['code']===0x1f4){logger[_0x39fb('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5b8779,_0x49d2fb['error'][_0x39fb('0x14')]);return _0x584877(_0x49d2fb[_0x39fb('0x13')]['message']);}logger[_0x39fb('0x13')](_0x39fb('0xe'),_0x5b8779,_0x49d2fb[_0x39fb('0x13')][_0x39fb('0x14')]);return _0x730bfe(_0x49d2fb[_0x39fb('0x13')][_0x39fb('0x14')]);}else{logger[_0x39fb('0x15')](_0x39fb('0xe'),_0x5b8779,_0x39fb('0xf'));_0x730bfe(_0x49d2fb[_0x39fb('0x16')][_0x39fb('0x14')]);}})[_0x39fb('0x17')](function(_0x413345){logger['error'](_0x39fb('0xe'),_0x5b8779,_0x413345);_0x584877(_0x413345);});});} \ No newline at end of file +var _0xb298=['rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xb298,0x1f1));var _0x8b29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb298[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b29('0x0'));var util=require(_0x8b29('0x1'));var moment=require(_0x8b29('0x2'));var BPromise=require(_0x8b29('0x3'));var rs=require(_0x8b29('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b29('0x5'))['db'];var utils=require(_0x8b29('0x6'));var logger=require('../../config/logger')(_0x8b29('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b29('0x8'));var client=jayson[_0x8b29('0x9')][_0x8b29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3533,_0x5ee972,_0x11b8ba){return new BPromise(function(_0x56476d,_0x3f08a9){return client[_0x8b29('0xb')](_0x3a3533,_0x11b8ba)[_0x8b29('0xc')](function(_0x1ba898){logger[_0x8b29('0xd')](_0x8b29('0xe'),_0x5ee972,'request\x20sent');logger[_0x8b29('0xf')](_0x8b29('0x10'),_0x5ee972,_0x8b29('0x11'),JSON[_0x8b29('0x12')](_0x1ba898));if(_0x1ba898[_0x8b29('0x13')]){if(_0x1ba898[_0x8b29('0x13')][_0x8b29('0x14')]===0x1f4){logger[_0x8b29('0x13')](_0x8b29('0xe'),_0x5ee972,_0x1ba898['error'][_0x8b29('0x15')]);return _0x3f08a9(_0x1ba898['error'][_0x8b29('0x15')]);}logger[_0x8b29('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5ee972,_0x1ba898[_0x8b29('0x13')][_0x8b29('0x15')]);return _0x56476d(_0x1ba898['error'][_0x8b29('0x15')]);}else{logger['info'](_0x8b29('0xe'),_0x5ee972,_0x8b29('0x11'));_0x56476d(_0x1ba898[_0x8b29('0x16')][_0x8b29('0x15')]);}})[_0x8b29('0x17')](function(_0xb814ed){logger[_0x8b29('0x13')](_0x8b29('0xe'),_0x5ee972,_0xb814ed);_0x3f08a9(_0xb814ed);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 20879e4..d79eb51 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 _0x7df9=['index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x43ecd0,_0x3bc7f2){var _0x4f446f=function(_0x38ecb6){while(--_0x38ecb6){_0x43ecd0['push'](_0x43ecd0['shift']());}};_0x4f446f(++_0x3bc7f2);}(_0x7df9,0x14f));var _0x97df=function(_0x50a02f,_0x1e8dcf){_0x50a02f=_0x50a02f-0x0;var _0x5159ff=_0x7df9[_0x50a02f];return _0x5159ff;};'use strict';var multer=require(_0x97df('0x0'));var util=require(_0x97df('0x1'));var path=require(_0x97df('0x2'));var timeout=require(_0x97df('0x3'));var express=require(_0x97df('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x97df('0x5'));var interaction=require(_0x97df('0x6'));var config=require(_0x97df('0x7'));var controller=require(_0x97df('0x8'));router[_0x97df('0x9')]('/',auth['isAuthenticated'](),controller[_0x97df('0xa')]);router[_0x97df('0x9')](_0x97df('0xb'),auth[_0x97df('0xc')](),controller[_0x97df('0xd')]);router['get'](_0x97df('0xe'),auth['isAuthenticated'](),controller[_0x97df('0xf')]);router[_0x97df('0x9')]('/:id/fields',auth[_0x97df('0xc')](),controller['getFields']);router[_0x97df('0x10')]('/',auth[_0x97df('0xc')](),controller[_0x97df('0x11')]);router['post'](_0x97df('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x97df('0x12')]('/:id',auth[_0x97df('0xc')](),controller[_0x97df('0x13')]);router[_0x97df('0x14')](_0x97df('0xb'),auth[_0x97df('0xc')](),controller[_0x97df('0x15')]);module[_0x97df('0x16')]=router; \ No newline at end of file +var _0xccce=['./intZohoAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xf172b,_0x4a9570){var _0x46615d=function(_0x7ee165){while(--_0x7ee165){_0xf172b['push'](_0xf172b['shift']());}};_0x46615d(++_0x4a9570);}(_0xccce,0x19f));var _0xeccc=function(_0x22bf04,_0x119eea){_0x22bf04=_0x22bf04-0x0;var _0x1e9c8a=_0xccce[_0x22bf04];return _0x1e9c8a;};'use strict';var multer=require('multer');var util=require(_0xeccc('0x0'));var path=require('path');var timeout=require(_0xeccc('0x1'));var express=require(_0xeccc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeccc('0x3'));var interaction=require(_0xeccc('0x4'));var config=require('../../config/environment');var controller=require(_0xeccc('0x5'));router[_0xeccc('0x6')]('/',auth[_0xeccc('0x7')](),controller[_0xeccc('0x8')]);router[_0xeccc('0x6')](_0xeccc('0x9'),auth[_0xeccc('0x7')](),controller['show']);router[_0xeccc('0x6')]('/:id/configurations',auth[_0xeccc('0x7')](),controller[_0xeccc('0xa')]);router[_0xeccc('0x6')]('/:id/fields',auth[_0xeccc('0x7')](),controller[_0xeccc('0xb')]);router[_0xeccc('0xc')]('/',auth['isAuthenticated'](),controller[_0xeccc('0xd')]);router[_0xeccc('0xc')](_0xeccc('0xe'),auth[_0xeccc('0x7')](),controller[_0xeccc('0xf')]);router[_0xeccc('0x10')]('/:id',auth[_0xeccc('0x7')](),controller['update']);router[_0xeccc('0x11')]('/:id',auth[_0xeccc('0x7')](),controller[_0xeccc('0x12')]);module[_0xeccc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index cc7a1b9..05f6597 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 _0xa9e0=['sequelize','exports','STRING'];(function(_0xb8135c,_0x46c002){var _0x4e54e5=function(_0x5689bd){while(--_0x5689bd){_0xb8135c['push'](_0xb8135c['shift']());}};_0x4e54e5(++_0x46c002);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0xd2ea=['sequelize','exports','STRING'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x39a803,_0x53bc7f){_0x39a803=_0x39a803-0x0;var _0x48e4ec=_0xd2ea[_0x39a803];return _0x48e4ec;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 0cf8551..bc90d5e 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 _0xd011=['refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','serverUrl','code','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken'];(function(_0x4cf55d,_0x323f8f){var _0x48b6ea=function(_0x33c9e1){while(--_0x33c9e1){_0x4cf55d['push'](_0x4cf55d['shift']());}};_0x48b6ea(++_0x323f8f);}(_0xd011,0x19c));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1d01('0x0'));var rimraf=require(_0x1d01('0x1'));var zipdir=require(_0x1d01('0x2'));var jsonpatch=require(_0x1d01('0x3'));var rp=require('request-promise');var moment=require(_0x1d01('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d01('0x5'));var util=require('util');var path=require(_0x1d01('0x6'));var sox=require(_0x1d01('0x7'));var csv=require(_0x1d01('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d01('0x9'));var squel=require(_0x1d01('0xa'));var crypto=require(_0x1d01('0xb'));var jsforce=require(_0x1d01('0xc'));var deskjs=require(_0x1d01('0xd'));var toCsv=require(_0x1d01('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d01('0xe'));var as=require(_0x1d01('0xf'));var hardwareService=require(_0x1d01('0x10'));var logger=require(_0x1d01('0x11'))(_0x1d01('0x12'));var utils=require('../../config/utils');var config=require(_0x1d01('0x13'));var licenseUtil=require(_0x1d01('0x14'));var db=require(_0x1d01('0x15'))['db'];var integrations=require(_0x1d01('0x16'));function respondWithStatusCode(_0x2bdbd0,_0x2b142c){_0x2b142c=_0x2b142c||0xcc;return function(_0x7fa89){if(_0x7fa89){return _0x2bdbd0[_0x1d01('0x17')](_0x2b142c);}return _0x2bdbd0[_0x1d01('0x18')](_0x2b142c)[_0x1d01('0x19')]();};}function respondWithResult(_0x5d6532,_0x46d631){_0x46d631=_0x46d631||0xc8;return function(_0x5c383c){if(_0x5c383c){return _0x5d6532[_0x1d01('0x18')](_0x46d631)['json'](_0x5c383c);}};}function respondWithFilteredResult(_0x4c3097,_0x275a71){return function(_0x1fef05){if(_0x1fef05){var _0x3f4a3a=typeof _0x275a71[_0x1d01('0x1a')]===_0x1d01('0x1b')&&typeof _0x275a71[_0x1d01('0x1c')]===_0x1d01('0x1b');var _0x189303=_0x1fef05[_0x1d01('0x1d')];var _0x5eb405=_0x3f4a3a?0x0:_0x275a71[_0x1d01('0x1a')];var _0x8c6ba0=_0x3f4a3a?_0x1fef05[_0x1d01('0x1d')]:_0x275a71[_0x1d01('0x1a')]+_0x275a71[_0x1d01('0x1c')];var _0x32dfd1;if(_0x8c6ba0>=_0x189303){_0x8c6ba0=_0x189303;_0x32dfd1=0xc8;}else{_0x32dfd1=0xce;}_0x4c3097['status'](_0x32dfd1);return _0x4c3097[_0x1d01('0x1e')](_0x1d01('0x1f'),_0x5eb405+'-'+_0x8c6ba0+'/'+_0x189303)['json'](_0x1fef05);}return null;};}function patchUpdates(_0x2530d8){return function(_0x320bee){try{jsonpatch[_0x1d01('0x20')](_0x320bee,_0x2530d8,!![]);}catch(_0x1eb732){return BPromise[_0x1d01('0x21')](_0x1eb732);}return _0x320bee['save']();};}function saveUpdates(_0x3292c7,_0x376493){return function(_0x187aa8){if(_0x187aa8){return _0x187aa8[_0x1d01('0x22')](_0x3292c7)[_0x1d01('0x23')](function(_0x1c9669){return _0x1c9669;});}return null;};}function removeEntity(_0x131651,_0x34f156){return function(_0x21f7a5){if(_0x21f7a5){return _0x21f7a5['destroy']()[_0x1d01('0x23')](function(){_0x131651[_0x1d01('0x18')](0xcc)[_0x1d01('0x19')]();});}};}function handleEntityNotFound(_0x30c50f,_0x1cdc77){return function(_0xd32f9){if(!_0xd32f9){_0x30c50f[_0x1d01('0x17')](0x194);}return _0xd32f9;};}function handleError(_0x238b5b,_0x37373a){_0x37373a=_0x37373a||0x1f4;return function(_0xa0d733){logger[_0x1d01('0x24')](_0xa0d733['stack']);if(_0xa0d733[_0x1d01('0x25')]){delete _0xa0d733[_0x1d01('0x25')];}_0x238b5b[_0x1d01('0x18')](_0x37373a)[_0x1d01('0x26')](_0xa0d733);};}exports[_0x1d01('0x27')]=function(_0xeff54f,_0x4429d2){var _0x2ee655={},_0x298aba={},_0x860a77={'count':0x0,'rows':[]};var _0x1b24be=_[_0x1d01('0x28')](db[_0x1d01('0x29')][_0x1d01('0x2a')],function(_0x310590){return{'name':_0x310590[_0x1d01('0x2b')],'type':_0x310590[_0x1d01('0x2c')]['key']};});_0x298aba[_0x1d01('0x2d')]=_['map'](_0x1b24be,'name');_0x298aba[_0x1d01('0x2e')]=_[_0x1d01('0x2f')](_0xeff54f[_0x1d01('0x2e')]);_0x298aba[_0x1d01('0x30')]=_['intersection'](_0x298aba[_0x1d01('0x2d')],_0x298aba[_0x1d01('0x2e')]);_0x2ee655[_0x1d01('0x31')]=_['intersection'](_0x298aba[_0x1d01('0x2d')],qs['fields'](_0xeff54f[_0x1d01('0x2e')][_0x1d01('0x32')]));_0x2ee655[_0x1d01('0x31')]=_0x2ee655['attributes'][_0x1d01('0x33')]?_0x2ee655[_0x1d01('0x31')]:_0x298aba[_0x1d01('0x2d')];if(!_0xeff54f[_0x1d01('0x2e')][_0x1d01('0x34')](_0x1d01('0x35'))){_0x2ee655['limit']=qs[_0x1d01('0x1c')](_0xeff54f['query'][_0x1d01('0x1c')]);_0x2ee655[_0x1d01('0x1a')]=qs[_0x1d01('0x1a')](_0xeff54f['query'][_0x1d01('0x1a')]);}_0x2ee655[_0x1d01('0x36')]=qs[_0x1d01('0x37')](_0xeff54f[_0x1d01('0x2e')][_0x1d01('0x37')]);_0x2ee655[_0x1d01('0x38')]=qs[_0x1d01('0x30')](_[_0x1d01('0x39')](_0xeff54f[_0x1d01('0x2e')],_0x298aba[_0x1d01('0x30')]),_0x1b24be);if(_0xeff54f[_0x1d01('0x2e')][_0x1d01('0x3a')]){_0x2ee655[_0x1d01('0x38')]=_[_0x1d01('0x3b')](_0x2ee655[_0x1d01('0x38')],{'$or':_[_0x1d01('0x28')](_0x1b24be,function(_0x12b966){if(_0x12b966['type']!==_0x1d01('0x3c')){var _0x5313a9={};_0x5313a9[_0x12b966[_0x1d01('0x25')]]={'$like':'%'+_0xeff54f['query'][_0x1d01('0x3a')]+'%'};return _0x5313a9;}})});}_0x2ee655=_['merge']({},_0x2ee655,_0xeff54f[_0x1d01('0x3d')]);var _0x51bb30={'where':_0x2ee655['where']};return db['ZohoAccount'][_0x1d01('0x1d')](_0x51bb30)[_0x1d01('0x23')](function(_0x538239){_0x860a77[_0x1d01('0x1d')]=_0x538239;if(_0xeff54f[_0x1d01('0x2e')][_0x1d01('0x3e')]){_0x2ee655[_0x1d01('0x3f')]=[{'all':!![]}];}return db[_0x1d01('0x29')][_0x1d01('0x40')](_0x2ee655);})['then'](function(_0x591fe0){_0x860a77['rows']=_0x591fe0;return _0x860a77;})[_0x1d01('0x23')](respondWithFilteredResult(_0x4429d2,_0x2ee655))[_0x1d01('0x41')](handleError(_0x4429d2,null));};exports[_0x1d01('0x42')]=function(_0xccdbb,_0x258825){var _0x24e14b={'raw':![],'where':{'id':_0xccdbb[_0x1d01('0x43')]['id']}},_0x12c981={};_0x12c981[_0x1d01('0x2d')]=_[_0x1d01('0x2f')](db[_0x1d01('0x29')][_0x1d01('0x2a')]);_0x12c981[_0x1d01('0x2e')]=_['keys'](_0xccdbb[_0x1d01('0x2e')]);_0x12c981['filters']=_[_0x1d01('0x44')](_0x12c981[_0x1d01('0x2d')],_0x12c981['query']);_0x24e14b[_0x1d01('0x31')]=_[_0x1d01('0x44')](_0x12c981['model'],qs[_0x1d01('0x32')](_0xccdbb[_0x1d01('0x2e')][_0x1d01('0x32')]));_0x24e14b[_0x1d01('0x31')]=_0x24e14b['attributes'][_0x1d01('0x33')]?_0x24e14b[_0x1d01('0x31')]:_0x12c981[_0x1d01('0x2d')];if(_0xccdbb['query']['includeAll']){_0x24e14b[_0x1d01('0x3f')]=[{'all':!![]}];}_0x24e14b=_[_0x1d01('0x3b')]({},_0x24e14b,_0xccdbb[_0x1d01('0x3d')]);return db[_0x1d01('0x29')][_0x1d01('0x45')](_0x24e14b)[_0x1d01('0x23')](handleEntityNotFound(_0x258825,null))[_0x1d01('0x23')](respondWithResult(_0x258825,null))['catch'](handleError(_0x258825,null));};exports[_0x1d01('0x46')]=function(_0x4740e8,_0x133f8b){return db[_0x1d01('0x29')][_0x1d01('0x46')](_0x4740e8[_0x1d01('0x47')],{})['then'](respondWithResult(_0x133f8b,0xc9))[_0x1d01('0x41')](handleError(_0x133f8b,null));};exports['update']=function(_0x406b32,_0x403272){if(_0x406b32['body']['id']){delete _0x406b32['body']['id'];}return db[_0x1d01('0x29')][_0x1d01('0x45')]({'where':{'id':_0x406b32[_0x1d01('0x43')]['id']}})[_0x1d01('0x23')](handleEntityNotFound(_0x403272,null))[_0x1d01('0x23')](saveUpdates(_0x406b32['body'],null))[_0x1d01('0x23')](respondWithResult(_0x403272,null))[_0x1d01('0x41')](handleError(_0x403272,null));};exports[_0x1d01('0x48')]=function(_0x445b16,_0x13c4f5){return db[_0x1d01('0x29')]['find']({'where':{'id':_0x445b16[_0x1d01('0x43')]['id']}})['then'](handleEntityNotFound(_0x13c4f5,null))['then'](removeEntity(_0x13c4f5,null))[_0x1d01('0x41')](handleError(_0x13c4f5,null));};exports[_0x1d01('0x49')]=function(_0x34cd84,_0x1e10f5,_0x3b6b01){var _0x151b8b={};var _0x1056e6={};var _0x4777f8;var _0x4de74f;return db[_0x1d01('0x29')][_0x1d01('0x4a')]({'where':{'id':_0x34cd84[_0x1d01('0x43')]['id']}})[_0x1d01('0x23')](handleEntityNotFound(_0x1e10f5,null))[_0x1d01('0x23')](function(_0x57c6fd){if(_0x57c6fd){_0x4777f8=_0x57c6fd;_0x1056e6['model']=_[_0x1d01('0x2f')](db[_0x1d01('0x4b')]['rawAttributes']);_0x1056e6[_0x1d01('0x2e')]=_[_0x1d01('0x2f')](_0x34cd84[_0x1d01('0x2e')]);_0x1056e6[_0x1d01('0x30')]=_[_0x1d01('0x44')](_0x1056e6[_0x1d01('0x2d')],_0x1056e6[_0x1d01('0x2e')]);_0x151b8b[_0x1d01('0x31')]=_['intersection'](_0x1056e6[_0x1d01('0x2d')],qs[_0x1d01('0x32')](_0x34cd84[_0x1d01('0x2e')][_0x1d01('0x32')]));_0x151b8b[_0x1d01('0x31')]=_0x151b8b['attributes'][_0x1d01('0x33')]?_0x151b8b[_0x1d01('0x31')]:_0x1056e6['model'];_0x151b8b[_0x1d01('0x36')]=qs[_0x1d01('0x37')](_0x34cd84[_0x1d01('0x2e')][_0x1d01('0x37')]);_0x151b8b[_0x1d01('0x38')]=qs[_0x1d01('0x30')](_[_0x1d01('0x39')](_0x34cd84[_0x1d01('0x2e')],_0x1056e6[_0x1d01('0x30')]));if(_0x34cd84['query'][_0x1d01('0x3a')]){_0x151b8b[_0x1d01('0x38')]=_[_0x1d01('0x3b')](_0x151b8b[_0x1d01('0x38')],{'$or':_[_0x1d01('0x28')](_0x151b8b[_0x1d01('0x31')],function(_0x9f7de4){var _0x584e6f={};_0x584e6f[_0x9f7de4]={'$like':'%'+_0x34cd84[_0x1d01('0x2e')][_0x1d01('0x3a')]+'%'};return _0x584e6f;})});}_0x151b8b=_[_0x1d01('0x3b')]({},_0x151b8b,_0x34cd84['options']);return _0x4777f8[_0x1d01('0x49')](_0x151b8b);}})['then'](function(_0x2e8e60){if(_0x2e8e60){_0x4de74f=_0x2e8e60[_0x1d01('0x33')];if(!_0x34cd84[_0x1d01('0x2e')][_0x1d01('0x34')](_0x1d01('0x35'))){_0x151b8b[_0x1d01('0x1c')]=qs[_0x1d01('0x1c')](_0x34cd84[_0x1d01('0x2e')][_0x1d01('0x1c')]);_0x151b8b[_0x1d01('0x1a')]=qs[_0x1d01('0x1a')](_0x34cd84['query'][_0x1d01('0x1a')]);}return _0x4777f8[_0x1d01('0x49')](_0x151b8b);}})[_0x1d01('0x23')](function(_0x34d279){if(_0x34d279){return _0x34d279?{'count':_0x4de74f,'rows':_0x34d279}:null;}})['then'](respondWithResult(_0x1e10f5,null))['catch'](handleError(_0x1e10f5,null));};exports['addConfiguration']=function(_0xc8bec5,_0xcffe36,_0x22c9d7){if(_0xc8bec5[_0x1d01('0x47')]['id']){delete _0xc8bec5[_0x1d01('0x47')]['id'];}return db[_0x1d01('0x29')][_0x1d01('0x4a')]({'where':{'id':_0xc8bec5[_0x1d01('0x43')]['id']}})[_0x1d01('0x23')](handleEntityNotFound(_0xcffe36,null))['then'](function(_0xe0b013){if(_0xe0b013){_0xc8bec5[_0x1d01('0x47')][_0x1d01('0x4c')]=_0xe0b013['id'];_0xc8bec5['body'][_0x1d01('0x4d')]=integrations[_0x1d01('0x4e')](_0xc8bec5[_0x1d01('0x47')][_0x1d01('0x4f')],_0xc8bec5['body'][_0x1d01('0x2c')]);_0xc8bec5['body']['Descriptions']=integrations['getDescriptions'](_0xc8bec5[_0x1d01('0x47')][_0x1d01('0x4f')],_0xc8bec5[_0x1d01('0x47')][_0x1d01('0x2c')]);return db[_0x1d01('0x4b')][_0x1d01('0x46')](_0xc8bec5[_0x1d01('0x47')],{'include':[{'model':db['ZohoField'],'as':_0x1d01('0x4d')},{'model':db[_0x1d01('0x50')],'as':_0x1d01('0x51')}]});}return null;})['then'](respondWithResult(_0xcffe36,null))[_0x1d01('0x41')](handleError(_0xcffe36,null));};function getAccessToken(_0x50d350){return new Promise(function(_0x2fa890,_0x5c39cc){var _0x29a624;switch(_0x50d350[_0x1d01('0x52')]){case'US':_0x29a624='https://accounts.zoho.com';break;case'AU':_0x29a624=_0x1d01('0x53');break;case'EU':_0x29a624='https://accounts.zoho.eu';break;case'IN':_0x29a624='https://accounts.zoho.in';break;case'CN':_0x29a624=_0x1d01('0x54');break;default:_0x29a624=_0x1d01('0x55');break;}var _0x2e8098={'method':_0x1d01('0x56'),'uri':_0x29a624+'/oauth/v2/token','qs':{'refresh_token':_0x50d350[_0x1d01('0x57')],'client_id':_0x50d350['clientId'],'client_secret':_0x50d350['clientSecret'],'grant_type':_0x1d01('0x58')},'json':!![]};return rp(_0x2e8098)['then'](function(_0x47c631){if(_0x47c631['access_token']){_0x2fa890(_0x47c631[_0x1d01('0x59')]);}else{_0x5c39cc(_0x1d01('0x5a'));}})[_0x1d01('0x41')](function(_0x985eb){_0x5c39cc(_0x985eb);});});}exports[_0x1d01('0x5b')]=function(_0xf1ec14,_0x483175,_0x43edbb){var _0x1ebf21,_0x57dee9,_0x37eee0,_0x58d47f,_0x3a7f31;return db['ZohoAccount'][_0x1d01('0x4a')]({'where':{'id':_0xf1ec14[_0x1d01('0x43')]['id']},'attributes':['id',_0x1d01('0x5c'),'zone',_0x1d01('0x5d'),_0x1d01('0x5e'),_0x1d01('0x5f'),_0x1d01('0x60'),_0x1d01('0x57')]})[_0x1d01('0x23')](handleEntityNotFound(_0x483175,null))[_0x1d01('0x23')](function(_0x21b8b4){_0x3a7f31=_0x21b8b4;_0x1ebf21=_0x3a7f31['host'];_0x57dee9=_0x1ebf21==='zoho.eu'?'eu':_0x1d01('0x61');_0x37eee0=_0x3a7f31[_0x1d01('0x5f')];var _0x8af991=_0x37eee0['slice'](-0x1);if(_0x8af991==='/'||_0x8af991==='\x5c'||_0x8af991===':'){_0x37eee0=_0x37eee0[_0x1d01('0x62')](0x0,_0x37eee0[_0x1d01('0x63')](_0x8af991));}if(!_0x3a7f31[_0x1d01('0x57')]){throw new Error(_0x1d01('0x64'));}return getAccessToken(_0x3a7f31);})[_0x1d01('0x23')](function(_0x5a3a0a){if(_0x5a3a0a){return rp({'method':_0x1d01('0x65'),'uri':util['format'](_0x1d01('0x66'),_0x57dee9),'qs':{'module':_0x1d01('0x67')},'headers':{'Authorization':_0x1d01('0x68')+_0x5a3a0a},'json':!![]});}})[_0x1d01('0x23')](function(_0x57d738){if(_0x57d738){if(_0x57d738[_0x1d01('0x69')]&&_0x57d738[_0x1d01('0x69')]['error']){throw new Error(_0x57d738[_0x1d01('0x69')][_0x1d01('0x24')][_0x1d01('0x6a')]);}var _0x306b97=[];var _0x2a7d13=[];var _0xad71e8=['Owner',_0x1d01('0x6b'),_0x1d01('0x6c'),_0x1d01('0x6d'),_0x1d01('0x6e'),_0x1d01('0x6f'),_0x1d01('0x70'),_0x1d01('0x71')];_0x2a7d13=_[_0x1d01('0x72')](_0x57d738[_0x1d01('0x32')],function(_0xd3c1f7){return _0xad71e8['includes'](_0xd3c1f7[_0x1d01('0x73')]);});for(var _0x508a16=0x0;_0x508a16<_0x2a7d13[_0x1d01('0x33')];_0x508a16++){if(_0x2a7d13[_0x508a16][_0x1d01('0x74')]===![]){_0x306b97['push']({'id':_0x2a7d13[_0x508a16]['id'],'name':_0x2a7d13[_0x508a16]['display_label'],'custom':_0x2a7d13[_0x508a16][_0x1d01('0x75')],'options':_0x2a7d13[_0x508a16][_0x1d01('0x76')]===_0x1d01('0x77')&&_0x2a7d13[_0x508a16][_0x1d01('0x78')]['length']>-0x1?_['map'](_0x2a7d13[_0x508a16][_0x1d01('0x78')],function(_0x46b596){return{'name':_0x46b596,'value':_0x46b596};}):[]});}}return{'count':_0x306b97[_0x1d01('0x33')],'rows':_0x306b97};}else{return{'count':0x0,'rows':[]};}})[_0x1d01('0x23')](respondWithResult(_0x483175,null))[_0x1d01('0x41')](function(_0x272b9a){var _0x59dacd=_0xf1ec14[_0x1d01('0x2e')]['test']?0x1f4:_0x272b9a[_0x1d01('0x79')]||0x1f4;logger[_0x1d01('0x24')](_0x1d01('0x7a'),_0x1d01('0x5b'),_0x59dacd,JSON[_0x1d01('0x7b')](_0x272b9a));delete _0x272b9a[_0x1d01('0x25')];if(_0x59dacd===0x191){_0x59dacd=0x190;}_0x483175[_0x1d01('0x18')](_0x59dacd)[_0x1d01('0x26')](_0xf1ec14[_0x1d01('0x2e')][_0x1d01('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x272b9a[_0x1d01('0x79')]}:_0x272b9a);});}; \ No newline at end of file +var _0xd501=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','getConfigurations','ZohoConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','clientSecret','code','refreshToken','serverUrl','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd501,0x16b));var _0x1d50=function(_0x597faf,_0x55627f){_0x597faf=_0x597faf-0x0;var _0x2dcf4e=_0xd501[_0x597faf];return _0x2dcf4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d50('0x0'));var zipdir=require(_0x1d50('0x1'));var jsonpatch=require(_0x1d50('0x2'));var rp=require(_0x1d50('0x3'));var moment=require(_0x1d50('0x4'));var BPromise=require(_0x1d50('0x5'));var Mustache=require(_0x1d50('0x6'));var util=require(_0x1d50('0x7'));var path=require(_0x1d50('0x8'));var sox=require(_0x1d50('0x9'));var csv=require(_0x1d50('0xa'));var ejs=require(_0x1d50('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d50('0xc'));var squel=require(_0x1d50('0xd'));var crypto=require('crypto');var jsforce=require(_0x1d50('0xe'));var deskjs=require(_0x1d50('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1d50('0x10'));var Papa=require(_0x1d50('0x11'));var Redis=require(_0x1d50('0x12'));var authService=require(_0x1d50('0x13'));var qs=require(_0x1d50('0x14'));var as=require(_0x1d50('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1d50('0x16'));var utils=require(_0x1d50('0x17'));var config=require(_0x1d50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d50('0x19'))['db'];var integrations=require(_0x1d50('0x1a'));function respondWithStatusCode(_0x3f67c4,_0x9c741e){_0x9c741e=_0x9c741e||0xcc;return function(_0x5acbfe){if(_0x5acbfe){return _0x3f67c4[_0x1d50('0x1b')](_0x9c741e);}return _0x3f67c4[_0x1d50('0x1c')](_0x9c741e)[_0x1d50('0x1d')]();};}function respondWithResult(_0x26dedf,_0x306ce3){_0x306ce3=_0x306ce3||0xc8;return function(_0x3bc4b1){if(_0x3bc4b1){return _0x26dedf[_0x1d50('0x1c')](_0x306ce3)[_0x1d50('0x1e')](_0x3bc4b1);}};}function respondWithFilteredResult(_0xcc16fd,_0x1f0a6c){return function(_0x354b9f){if(_0x354b9f){var _0x296736=typeof _0x1f0a6c[_0x1d50('0x1f')]===_0x1d50('0x20')&&typeof _0x1f0a6c[_0x1d50('0x21')]===_0x1d50('0x20');var _0x1b50eb=_0x354b9f['count'];var _0x3a0c18=_0x296736?0x0:_0x1f0a6c['offset'];var _0x3ef8ec=_0x296736?_0x354b9f[_0x1d50('0x22')]:_0x1f0a6c[_0x1d50('0x1f')]+_0x1f0a6c[_0x1d50('0x21')];var _0x723bca;if(_0x3ef8ec>=_0x1b50eb){_0x3ef8ec=_0x1b50eb;_0x723bca=0xc8;}else{_0x723bca=0xce;}_0xcc16fd[_0x1d50('0x1c')](_0x723bca);return _0xcc16fd[_0x1d50('0x23')](_0x1d50('0x24'),_0x3a0c18+'-'+_0x3ef8ec+'/'+_0x1b50eb)['json'](_0x354b9f);}return null;};}function patchUpdates(_0x2dd182){return function(_0x5e64a1){try{jsonpatch['apply'](_0x5e64a1,_0x2dd182,!![]);}catch(_0x6a9848){return BPromise[_0x1d50('0x25')](_0x6a9848);}return _0x5e64a1[_0x1d50('0x26')]();};}function saveUpdates(_0x5f5c16,_0x5391eb){return function(_0x18c870){if(_0x18c870){return _0x18c870[_0x1d50('0x27')](_0x5f5c16)[_0x1d50('0x28')](function(_0x1a38e7){return _0x1a38e7;});}return null;};}function removeEntity(_0xe9c0b8,_0x30eb75){return function(_0x1f0a25){if(_0x1f0a25){return _0x1f0a25['destroy']()[_0x1d50('0x28')](function(){_0xe9c0b8[_0x1d50('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b8e9d,_0x4db118){return function(_0x3f78bd){if(!_0x3f78bd){_0x3b8e9d[_0x1d50('0x1b')](0x194);}return _0x3f78bd;};}function handleError(_0x566884,_0xf510f2){_0xf510f2=_0xf510f2||0x1f4;return function(_0x346f1f){logger[_0x1d50('0x29')](_0x346f1f['stack']);if(_0x346f1f['name']){delete _0x346f1f[_0x1d50('0x2a')];}_0x566884[_0x1d50('0x1c')](_0xf510f2)[_0x1d50('0x2b')](_0x346f1f);};}exports['index']=function(_0x1d37ce,_0x18657d){var _0x29db65={},_0x45945f={},_0x21605f={'count':0x0,'rows':[]};var _0x407511=_[_0x1d50('0x2c')](db[_0x1d50('0x2d')][_0x1d50('0x2e')],function(_0x315d6d){return{'name':_0x315d6d[_0x1d50('0x2f')],'type':_0x315d6d[_0x1d50('0x30')][_0x1d50('0x31')]};});_0x45945f[_0x1d50('0x32')]=_[_0x1d50('0x2c')](_0x407511,'name');_0x45945f[_0x1d50('0x33')]=_[_0x1d50('0x34')](_0x1d37ce[_0x1d50('0x33')]);_0x45945f[_0x1d50('0x35')]=_[_0x1d50('0x36')](_0x45945f[_0x1d50('0x32')],_0x45945f['query']);_0x29db65['attributes']=_['intersection'](_0x45945f['model'],qs[_0x1d50('0x37')](_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x37')]));_0x29db65[_0x1d50('0x38')]=_0x29db65[_0x1d50('0x38')][_0x1d50('0x39')]?_0x29db65[_0x1d50('0x38')]:_0x45945f[_0x1d50('0x32')];if(!_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x3a')](_0x1d50('0x3b'))){_0x29db65['limit']=qs[_0x1d50('0x21')](_0x1d37ce[_0x1d50('0x33')]['limit']);_0x29db65[_0x1d50('0x1f')]=qs[_0x1d50('0x1f')](_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x1f')]);}_0x29db65[_0x1d50('0x3c')]=qs[_0x1d50('0x3d')](_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x3d')]);_0x29db65[_0x1d50('0x3e')]=qs[_0x1d50('0x35')](_[_0x1d50('0x3f')](_0x1d37ce[_0x1d50('0x33')],_0x45945f['filters']),_0x407511);if(_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x40')]){_0x29db65[_0x1d50('0x3e')]=_['merge'](_0x29db65['where'],{'$or':_[_0x1d50('0x2c')](_0x407511,function(_0x56d910){if(_0x56d910[_0x1d50('0x30')]!=='VIRTUAL'){var _0x41f554={};_0x41f554[_0x56d910[_0x1d50('0x2a')]]={'$like':'%'+_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x40')]+'%'};return _0x41f554;}})});}_0x29db65=_[_0x1d50('0x41')]({},_0x29db65,_0x1d37ce[_0x1d50('0x42')]);var _0x47a0f1={'where':_0x29db65[_0x1d50('0x3e')]};return db[_0x1d50('0x2d')][_0x1d50('0x22')](_0x47a0f1)['then'](function(_0x438a25){_0x21605f[_0x1d50('0x22')]=_0x438a25;if(_0x1d37ce[_0x1d50('0x33')][_0x1d50('0x43')]){_0x29db65[_0x1d50('0x44')]=[{'all':!![]}];}return db[_0x1d50('0x2d')][_0x1d50('0x45')](_0x29db65);})[_0x1d50('0x28')](function(_0xc6ff2a){_0x21605f[_0x1d50('0x46')]=_0xc6ff2a;return _0x21605f;})[_0x1d50('0x28')](respondWithFilteredResult(_0x18657d,_0x29db65))[_0x1d50('0x47')](handleError(_0x18657d,null));};exports['show']=function(_0x2a8dfa,_0x3b4977){var _0x189daf={'raw':![],'where':{'id':_0x2a8dfa['params']['id']}},_0x59a307={};_0x59a307[_0x1d50('0x32')]=_['keys'](db[_0x1d50('0x2d')][_0x1d50('0x2e')]);_0x59a307[_0x1d50('0x33')]=_[_0x1d50('0x34')](_0x2a8dfa[_0x1d50('0x33')]);_0x59a307[_0x1d50('0x35')]=_[_0x1d50('0x36')](_0x59a307[_0x1d50('0x32')],_0x59a307[_0x1d50('0x33')]);_0x189daf[_0x1d50('0x38')]=_[_0x1d50('0x36')](_0x59a307[_0x1d50('0x32')],qs[_0x1d50('0x37')](_0x2a8dfa['query']['fields']));_0x189daf[_0x1d50('0x38')]=_0x189daf[_0x1d50('0x38')][_0x1d50('0x39')]?_0x189daf[_0x1d50('0x38')]:_0x59a307[_0x1d50('0x32')];if(_0x2a8dfa[_0x1d50('0x33')][_0x1d50('0x43')]){_0x189daf[_0x1d50('0x44')]=[{'all':!![]}];}_0x189daf=_['merge']({},_0x189daf,_0x2a8dfa['options']);return db[_0x1d50('0x2d')][_0x1d50('0x48')](_0x189daf)[_0x1d50('0x28')](handleEntityNotFound(_0x3b4977,null))['then'](respondWithResult(_0x3b4977,null))[_0x1d50('0x47')](handleError(_0x3b4977,null));};exports[_0x1d50('0x49')]=function(_0x553da8,_0x29b549){return db[_0x1d50('0x2d')][_0x1d50('0x49')](_0x553da8['body'],{})['then'](respondWithResult(_0x29b549,0xc9))[_0x1d50('0x47')](handleError(_0x29b549,null));};exports[_0x1d50('0x27')]=function(_0x5022e2,_0x48883f){if(_0x5022e2[_0x1d50('0x4a')]['id']){delete _0x5022e2['body']['id'];}return db['ZohoAccount'][_0x1d50('0x48')]({'where':{'id':_0x5022e2[_0x1d50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48883f,null))[_0x1d50('0x28')](saveUpdates(_0x5022e2[_0x1d50('0x4a')],null))[_0x1d50('0x28')](respondWithResult(_0x48883f,null))[_0x1d50('0x47')](handleError(_0x48883f,null));};exports[_0x1d50('0x4c')]=function(_0x5ea16a,_0x316a33){return db[_0x1d50('0x2d')][_0x1d50('0x48')]({'where':{'id':_0x5ea16a[_0x1d50('0x4b')]['id']}})[_0x1d50('0x28')](handleEntityNotFound(_0x316a33,null))[_0x1d50('0x28')](removeEntity(_0x316a33,null))[_0x1d50('0x47')](handleError(_0x316a33,null));};exports[_0x1d50('0x4d')]=function(_0x5cd31e,_0x39ba6c,_0x2caca5){var _0x4be1ae={};var _0x550799={};var _0x5d6495;var _0x3a0231;return db['ZohoAccount']['findOne']({'where':{'id':_0x5cd31e[_0x1d50('0x4b')]['id']}})[_0x1d50('0x28')](handleEntityNotFound(_0x39ba6c,null))['then'](function(_0x235368){if(_0x235368){_0x5d6495=_0x235368;_0x550799['model']=_[_0x1d50('0x34')](db[_0x1d50('0x4e')][_0x1d50('0x2e')]);_0x550799[_0x1d50('0x33')]=_[_0x1d50('0x34')](_0x5cd31e['query']);_0x550799[_0x1d50('0x35')]=_[_0x1d50('0x36')](_0x550799[_0x1d50('0x32')],_0x550799['query']);_0x4be1ae[_0x1d50('0x38')]=_[_0x1d50('0x36')](_0x550799[_0x1d50('0x32')],qs[_0x1d50('0x37')](_0x5cd31e[_0x1d50('0x33')][_0x1d50('0x37')]));_0x4be1ae['attributes']=_0x4be1ae['attributes'][_0x1d50('0x39')]?_0x4be1ae[_0x1d50('0x38')]:_0x550799[_0x1d50('0x32')];_0x4be1ae[_0x1d50('0x3c')]=qs[_0x1d50('0x3d')](_0x5cd31e[_0x1d50('0x33')][_0x1d50('0x3d')]);_0x4be1ae[_0x1d50('0x3e')]=qs[_0x1d50('0x35')](_[_0x1d50('0x3f')](_0x5cd31e[_0x1d50('0x33')],_0x550799[_0x1d50('0x35')]));if(_0x5cd31e[_0x1d50('0x33')][_0x1d50('0x40')]){_0x4be1ae[_0x1d50('0x3e')]=_['merge'](_0x4be1ae[_0x1d50('0x3e')],{'$or':_[_0x1d50('0x2c')](_0x4be1ae[_0x1d50('0x38')],function(_0x3a50fb){var _0x32a95f={};_0x32a95f[_0x3a50fb]={'$like':'%'+_0x5cd31e[_0x1d50('0x33')][_0x1d50('0x40')]+'%'};return _0x32a95f;})});}_0x4be1ae=_['merge']({},_0x4be1ae,_0x5cd31e['options']);return _0x5d6495['getConfigurations'](_0x4be1ae);}})[_0x1d50('0x28')](function(_0x5c2805){if(_0x5c2805){_0x3a0231=_0x5c2805[_0x1d50('0x39')];if(!_0x5cd31e[_0x1d50('0x33')][_0x1d50('0x3a')]('nolimit')){_0x4be1ae['limit']=qs[_0x1d50('0x21')](_0x5cd31e[_0x1d50('0x33')][_0x1d50('0x21')]);_0x4be1ae[_0x1d50('0x1f')]=qs['offset'](_0x5cd31e[_0x1d50('0x33')]['offset']);}return _0x5d6495[_0x1d50('0x4d')](_0x4be1ae);}})['then'](function(_0x25ef01){if(_0x25ef01){return _0x25ef01?{'count':_0x3a0231,'rows':_0x25ef01}:null;}})[_0x1d50('0x28')](respondWithResult(_0x39ba6c,null))['catch'](handleError(_0x39ba6c,null));};exports['addConfiguration']=function(_0x14155c,_0x1f2ea8,_0xd9c333){if(_0x14155c[_0x1d50('0x4a')]['id']){delete _0x14155c['body']['id'];}return db[_0x1d50('0x2d')][_0x1d50('0x4f')]({'where':{'id':_0x14155c[_0x1d50('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f2ea8,null))['then'](function(_0x592c35){if(_0x592c35){_0x14155c['body']['AccountId']=_0x592c35['id'];_0x14155c['body'][_0x1d50('0x50')]=integrations[_0x1d50('0x51')](_0x14155c[_0x1d50('0x4a')]['channel'],_0x14155c[_0x1d50('0x4a')]['type']);_0x14155c[_0x1d50('0x4a')][_0x1d50('0x52')]=integrations[_0x1d50('0x53')](_0x14155c[_0x1d50('0x4a')][_0x1d50('0x54')],_0x14155c[_0x1d50('0x4a')][_0x1d50('0x30')]);return db[_0x1d50('0x4e')][_0x1d50('0x49')](_0x14155c[_0x1d50('0x4a')],{'include':[{'model':db['ZohoField'],'as':_0x1d50('0x50')},{'model':db[_0x1d50('0x55')],'as':_0x1d50('0x52')}]});}return null;})[_0x1d50('0x28')](respondWithResult(_0x1f2ea8,null))[_0x1d50('0x47')](handleError(_0x1f2ea8,null));};function getAccessToken(_0x5daa8e){return new Promise(function(_0x811654,_0x4f834c){var _0x4e7ac9;switch(_0x5daa8e[_0x1d50('0x56')]){case'US':_0x4e7ac9=_0x1d50('0x57');break;case'AU':_0x4e7ac9=_0x1d50('0x58');break;case'EU':_0x4e7ac9=_0x1d50('0x59');break;case'IN':_0x4e7ac9=_0x1d50('0x5a');break;case'CN':_0x4e7ac9='https://accounts.zoho.com.cn';break;default:_0x4e7ac9=_0x1d50('0x59');break;}var _0x1cb05d={'method':_0x1d50('0x5b'),'uri':_0x4e7ac9+_0x1d50('0x5c'),'qs':{'refresh_token':_0x5daa8e['refreshToken'],'client_id':_0x5daa8e['clientId'],'client_secret':_0x5daa8e['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1cb05d)[_0x1d50('0x28')](function(_0x2392e2){if(_0x2392e2[_0x1d50('0x5d')]){_0x811654(_0x2392e2[_0x1d50('0x5d')]);}else{_0x4f834c(_0x1d50('0x5e'));}})['catch'](function(_0x7aff8a){_0x4f834c(_0x7aff8a);});});}exports['getFields']=function(_0x213271,_0x557713,_0x3071e4){var _0x1fe247,_0x33d742,_0x4e0c1c,_0xd6a8f2,_0x29610b;return db[_0x1d50('0x2d')][_0x1d50('0x4f')]({'where':{'id':_0x213271[_0x1d50('0x4b')]['id']},'attributes':['id',_0x1d50('0x5f'),'zone',_0x1d50('0x60'),_0x1d50('0x61'),'serverUrl',_0x1d50('0x62'),_0x1d50('0x63')]})[_0x1d50('0x28')](handleEntityNotFound(_0x557713,null))[_0x1d50('0x28')](function(_0x5b4aee){_0x29610b=_0x5b4aee;_0x1fe247=_0x29610b[_0x1d50('0x5f')];_0x33d742=_0x1fe247==='zoho.eu'?'eu':'com';_0x4e0c1c=_0x29610b[_0x1d50('0x64')];var _0xf0f2e=_0x4e0c1c[_0x1d50('0x65')](-0x1);if(_0xf0f2e==='/'||_0xf0f2e==='\x5c'||_0xf0f2e===':'){_0x4e0c1c=_0x4e0c1c['substring'](0x0,_0x4e0c1c['lastIndexOf'](_0xf0f2e));}if(!_0x29610b[_0x1d50('0x63')]){throw new Error(_0x1d50('0x66'));}return getAccessToken(_0x29610b);})[_0x1d50('0x28')](function(_0x432880){if(_0x432880){return rp({'method':'GET','uri':util['format'](_0x1d50('0x67'),_0x33d742),'qs':{'module':_0x1d50('0x68')},'headers':{'Authorization':_0x1d50('0x69')+_0x432880},'json':!![]});}})[_0x1d50('0x28')](function(_0x444234){if(_0x444234){if(_0x444234[_0x1d50('0x6a')]&&_0x444234['response'][_0x1d50('0x29')]){throw new Error(_0x444234[_0x1d50('0x6a')][_0x1d50('0x29')]['message']);}var _0x3e6a40=[];var _0x2d5e29=[];var _0x417044=[_0x1d50('0x6b'),_0x1d50('0x6c'),'Description',_0x1d50('0x6d'),_0x1d50('0x6e'),_0x1d50('0x6f'),'Call_Start_Time',_0x1d50('0x70')];_0x2d5e29=_[_0x1d50('0x71')](_0x444234[_0x1d50('0x37')],function(_0x3dc957){return _0x417044[_0x1d50('0x72')](_0x3dc957[_0x1d50('0x73')]);});for(var _0x2a6d54=0x0;_0x2a6d54<_0x2d5e29[_0x1d50('0x39')];_0x2a6d54++){if(_0x2d5e29[_0x2a6d54]['system_mandatory']===![]){_0x3e6a40[_0x1d50('0x74')]({'id':_0x2d5e29[_0x2a6d54]['id'],'name':_0x2d5e29[_0x2a6d54][_0x1d50('0x75')],'custom':_0x2d5e29[_0x2a6d54][_0x1d50('0x76')],'options':_0x2d5e29[_0x2a6d54][_0x1d50('0x77')]===_0x1d50('0x78')&&_0x2d5e29[_0x2a6d54]['pick_list_values'][_0x1d50('0x39')]>-0x1?_[_0x1d50('0x2c')](_0x2d5e29[_0x2a6d54][_0x1d50('0x79')],function(_0x2132b8){return{'name':_0x2132b8,'value':_0x2132b8};}):[]});}}return{'count':_0x3e6a40[_0x1d50('0x39')],'rows':_0x3e6a40};}else{return{'count':0x0,'rows':[]};}})[_0x1d50('0x28')](respondWithResult(_0x557713,null))[_0x1d50('0x47')](function(_0x4be814){var _0x4806e8=_0x213271['query']['test']?0x1f4:_0x4be814[_0x1d50('0x7a')]||0x1f4;logger[_0x1d50('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x1d50('0x7b'),_0x4806e8,JSON[_0x1d50('0x7c')](_0x4be814));delete _0x4be814['name'];if(_0x4806e8===0x191){_0x4806e8=0x190;}_0x557713[_0x1d50('0x1c')](_0x4806e8)[_0x1d50('0x2b')](_0x213271[_0x1d50('0x33')][_0x1d50('0x7d')]?{'message':_0x1d50('0x7e'),'statusCode':_0x4be814[_0x1d50('0x7a')]}:_0x4be814);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7396aa4..e7092f0 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 _0xd6e1=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.eu','POST','/oauth/v2/token','then','parse','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','application/x-www-form-urlencoded','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x1b6e2c,_0x15b640){var _0x4dbdaf=function(_0x29fcc9){while(--_0x29fcc9){_0x1b6e2c['push'](_0x1b6e2c['shift']());}};_0x4dbdaf(++_0x15b640);}(_0xd6e1,0x1cc));var _0x1d6e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd6e1[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x1d6e('0x0'));var logger=require(_0x1d6e('0x1'))(_0x1d6e('0x2'));var moment=require(_0x1d6e('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d6e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d6e('0x5'));var config=require(_0x1d6e('0x6'));var attributes=require(_0x1d6e('0x7'));var integrations=require(_0x1d6e('0x8'));module['exports']=function(_0x3aaacc,_0xd40fb9){return _0x3aaacc[_0x1d6e('0x9')]('ZohoAccount',attributes,{'tableName':_0x1d6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b5499,_0x5e8f43,_0x480135){if(_0x4b5499[_0x1d6e('0xb')](_0x1d6e('0xc'))||_0x4b5499[_0x1d6e('0xb')](_0x1d6e('0xd'))||_0x4b5499['changed'](_0x1d6e('0xe'))||_0x4b5499[_0x1d6e('0xb')](_0x1d6e('0xf'))||_0x4b5499[_0x1d6e('0xb')](_0x1d6e('0x10'))||_0x4b5499[_0x1d6e('0xb')](_0x1d6e('0x11'))){var _0x2ef01a,_0x520fb2;_0x2ef01a=_0x4b5499['serverUrl'];var _0x9cacfe=_0x2ef01a[_0x1d6e('0x12')](-0x1);if(_0x9cacfe==='/'||_0x9cacfe==='\x5c'||_0x9cacfe===':'){_0x2ef01a=_0x2ef01a[_0x1d6e('0x13')](0x0,_0x2ef01a[_0x1d6e('0x14')](_0x9cacfe));}switch(_0x4b5499[_0x1d6e('0xc')]){case'US':_0x520fb2=_0x1d6e('0x15');break;case'AU':_0x520fb2=_0x1d6e('0x16');break;case'IN':_0x520fb2=_0x1d6e('0x17');break;case'CN':_0x520fb2=_0x1d6e('0x18');break;default:_0x520fb2='https://accounts.zoho.eu';break;}var _0x24d120={'method':'POST','uri':_0x520fb2+'/oauth/v2/token','form':{'grant_type':_0x1d6e('0x19'),'client_id':_0x4b5499[_0x1d6e('0xe')],'client_secret':_0x4b5499[_0x1d6e('0xf')],'redirect_uri':_0x4b5499[_0x1d6e('0xd')],'code':_0x4b5499[_0x1d6e('0x10')]},'headers':{'Content-Type':_0x1d6e('0x1a')}};return rp(_0x24d120)['then'](function(_0x41c8f3){var _0x3043e7=JSON['parse'](_0x41c8f3);if(_0x3043e7[_0x1d6e('0x1b')]){_0x4b5499[_0x1d6e('0x1c')]=_0x3043e7[_0x1d6e('0x1b')];logger['info'](util[_0x1d6e('0x1d')](_0x1d6e('0x1e'),_0x4b5499[_0x1d6e('0x1f')],_0x4b5499['id']));}else{logger[_0x1d6e('0x20')](util[_0x1d6e('0x1d')](_0x1d6e('0x21'),_0x4b5499[_0x1d6e('0x1f')],_0x4b5499['id']),util[_0x1d6e('0x22')](_0x3043e7,{'showHidden':![],'depth':null}));}return _0x480135(null,_0x5e8f43);})[_0x1d6e('0x23')](function(_0x10b1c6){logger[_0x1d6e('0x20')](util['format'](_0x1d6e('0x21'),_0x4b5499[_0x1d6e('0x1f')],_0x4b5499['id']),util[_0x1d6e('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x480135(_0x10b1c6);});}else{return _0x480135(null,_0x5e8f43);}},'beforeUpdate':function(_0x345d7d,_0x29df37,_0x821540){if(_0x345d7d[_0x1d6e('0xb')](_0x1d6e('0xc'))||_0x345d7d[_0x1d6e('0xb')](_0x1d6e('0xd'))||_0x345d7d[_0x1d6e('0xb')](_0x1d6e('0xe'))||_0x345d7d['changed'](_0x1d6e('0xf'))||_0x345d7d[_0x1d6e('0xb')](_0x1d6e('0x10'))||_0x345d7d[_0x1d6e('0xb')](_0x1d6e('0x11'))){var _0x1afe00,_0x1dd436;_0x1afe00=_0x345d7d[_0x1d6e('0xd')];var _0x21a639=_0x1afe00[_0x1d6e('0x12')](-0x1);if(_0x21a639==='/'||_0x21a639==='\x5c'||_0x21a639===':'){_0x1afe00=_0x1afe00[_0x1d6e('0x13')](0x0,_0x1afe00[_0x1d6e('0x14')](_0x21a639));}switch(_0x345d7d['zone']){case'US':_0x1dd436='https://accounts.zoho.com';break;case'AU':_0x1dd436=_0x1d6e('0x16');break;case'IN':_0x1dd436=_0x1d6e('0x17');break;case'CN':_0x1dd436=_0x1d6e('0x18');break;default:_0x1dd436=_0x1d6e('0x24');break;}var _0x26d317={'method':_0x1d6e('0x25'),'uri':_0x1dd436+_0x1d6e('0x26'),'form':{'grant_type':_0x1d6e('0x19'),'client_id':_0x345d7d[_0x1d6e('0xe')],'client_secret':_0x345d7d[_0x1d6e('0xf')],'redirect_uri':_0x345d7d[_0x1d6e('0xd')],'code':_0x345d7d['code']},'headers':{'Content-Type':_0x1d6e('0x1a')}};return rp(_0x26d317)[_0x1d6e('0x27')](function(_0x514b5c){var _0x55447a=JSON[_0x1d6e('0x28')](_0x514b5c);if(_0x55447a[_0x1d6e('0x1b')]){_0x345d7d[_0x1d6e('0x1c')]=_0x55447a[_0x1d6e('0x1b')];logger['info'](util[_0x1d6e('0x1d')](_0x1d6e('0x1e'),_0x345d7d[_0x1d6e('0x1f')],_0x345d7d['id']));}else{logger[_0x1d6e('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x345d7d[_0x1d6e('0x1f')],_0x345d7d['id']),util[_0x1d6e('0x22')](_0x55447a,{'showHidden':![],'depth':null}));}return _0x821540(null,_0x29df37);})[_0x1d6e('0x23')](function(_0x1daa66){logger[_0x1d6e('0x20')](util[_0x1d6e('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x345d7d[_0x1d6e('0x1f')],_0x345d7d['id']),util[_0x1d6e('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x821540(_0x1daa66);});}else{return _0x821540(null,_0x29df37);}}}});}; \ No newline at end of file +var _0x2c2c=['refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','slice','lastIndexOf','POST'];(function(_0x2cae28,_0x5c213b){var _0x28a7d6=function(_0x471946){while(--_0x471946){_0x2cae28['push'](_0x2cae28['shift']());}};_0x28a7d6(++_0x5c213b);}(_0x2c2c,0x1ba));var _0xc2c2=function(_0x1bd868,_0x57111e){_0x1bd868=_0x1bd868-0x0;var _0x27b2b4=_0x2c2c[_0x1bd868];return _0x27b2b4;};'use strict';var _=require(_0xc2c2('0x0'));var util=require(_0xc2c2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc2c2('0x2'));var rp=require(_0xc2c2('0x3'));var fs=require('fs');var path=require(_0xc2c2('0x4'));var rimraf=require(_0xc2c2('0x5'));var config=require('../../config/environment');var attributes=require(_0xc2c2('0x6'));var integrations=require(_0xc2c2('0x7'));module['exports']=function(_0x64cda0,_0x3ce63c){return _0x64cda0[_0xc2c2('0x8')]('ZohoAccount',attributes,{'tableName':_0xc2c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x14fe5d,_0x47ec2f,_0x3d5875){if(_0x14fe5d[_0xc2c2('0xa')](_0xc2c2('0xb'))||_0x14fe5d['changed'](_0xc2c2('0xc'))||_0x14fe5d['changed'](_0xc2c2('0xd'))||_0x14fe5d['changed'](_0xc2c2('0xe'))||_0x14fe5d[_0xc2c2('0xa')](_0xc2c2('0xf'))||_0x14fe5d['changed']('host')){var _0xab46b3,_0x212390;_0xab46b3=_0x14fe5d['serverUrl'];var _0x142957=_0xab46b3['slice'](-0x1);if(_0x142957==='/'||_0x142957==='\x5c'||_0x142957===':'){_0xab46b3=_0xab46b3[_0xc2c2('0x10')](0x0,_0xab46b3['lastIndexOf'](_0x142957));}switch(_0x14fe5d[_0xc2c2('0xb')]){case'US':_0x212390=_0xc2c2('0x11');break;case'AU':_0x212390=_0xc2c2('0x12');break;case'IN':_0x212390=_0xc2c2('0x13');break;case'CN':_0x212390=_0xc2c2('0x14');break;default:_0x212390=_0xc2c2('0x15');break;}var _0x9c411a={'method':'POST','uri':_0x212390+_0xc2c2('0x16'),'form':{'grant_type':_0xc2c2('0x17'),'client_id':_0x14fe5d[_0xc2c2('0xd')],'client_secret':_0x14fe5d[_0xc2c2('0xe')],'redirect_uri':_0x14fe5d[_0xc2c2('0xc')],'code':_0x14fe5d[_0xc2c2('0xf')]},'headers':{'Content-Type':_0xc2c2('0x18')}};return rp(_0x9c411a)[_0xc2c2('0x19')](function(_0x2b4073){var _0x194246=JSON[_0xc2c2('0x1a')](_0x2b4073);if(_0x194246['refresh_token']){_0x14fe5d['refreshToken']=_0x194246[_0xc2c2('0x1b')];logger[_0xc2c2('0x1c')](util[_0xc2c2('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14fe5d[_0xc2c2('0x1e')],_0x14fe5d['id']));}else{logger[_0xc2c2('0x1f')](util['format'](_0xc2c2('0x20'),_0x14fe5d[_0xc2c2('0x1e')],_0x14fe5d['id']),util['inspect'](_0x194246,{'showHidden':![],'depth':null}));}return _0x3d5875(null,_0x47ec2f);})['catch'](function(_0x1adfbd){logger[_0xc2c2('0x1f')](util[_0xc2c2('0x1d')](_0xc2c2('0x20'),_0x14fe5d['name'],_0x14fe5d['id']),util[_0xc2c2('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3d5875(_0x1adfbd);});}else{return _0x3d5875(null,_0x47ec2f);}},'beforeUpdate':function(_0x5c61a1,_0x2fa41b,_0x473581){if(_0x5c61a1[_0xc2c2('0xa')](_0xc2c2('0xb'))||_0x5c61a1[_0xc2c2('0xa')](_0xc2c2('0xc'))||_0x5c61a1[_0xc2c2('0xa')]('clientId')||_0x5c61a1[_0xc2c2('0xa')](_0xc2c2('0xe'))||_0x5c61a1[_0xc2c2('0xa')](_0xc2c2('0xf'))||_0x5c61a1['changed'](_0xc2c2('0x22'))){var _0xde59dd,_0xa7695;_0xde59dd=_0x5c61a1[_0xc2c2('0xc')];var _0x1bcbbf=_0xde59dd[_0xc2c2('0x23')](-0x1);if(_0x1bcbbf==='/'||_0x1bcbbf==='\x5c'||_0x1bcbbf===':'){_0xde59dd=_0xde59dd['substring'](0x0,_0xde59dd[_0xc2c2('0x24')](_0x1bcbbf));}switch(_0x5c61a1[_0xc2c2('0xb')]){case'US':_0xa7695=_0xc2c2('0x11');break;case'AU':_0xa7695=_0xc2c2('0x12');break;case'IN':_0xa7695=_0xc2c2('0x13');break;case'CN':_0xa7695=_0xc2c2('0x14');break;default:_0xa7695='https://accounts.zoho.eu';break;}var _0x2d7069={'method':_0xc2c2('0x25'),'uri':_0xa7695+'/oauth/v2/token','form':{'grant_type':_0xc2c2('0x17'),'client_id':_0x5c61a1['clientId'],'client_secret':_0x5c61a1[_0xc2c2('0xe')],'redirect_uri':_0x5c61a1[_0xc2c2('0xc')],'code':_0x5c61a1[_0xc2c2('0xf')]},'headers':{'Content-Type':_0xc2c2('0x18')}};return rp(_0x2d7069)['then'](function(_0x357143){var _0x14f801=JSON[_0xc2c2('0x1a')](_0x357143);if(_0x14f801[_0xc2c2('0x1b')]){_0x5c61a1[_0xc2c2('0x26')]=_0x14f801[_0xc2c2('0x1b')];logger[_0xc2c2('0x1c')](util[_0xc2c2('0x1d')](_0xc2c2('0x27'),_0x5c61a1[_0xc2c2('0x1e')],_0x5c61a1['id']));}else{logger['error'](util[_0xc2c2('0x1d')](_0xc2c2('0x20'),_0x5c61a1[_0xc2c2('0x1e')],_0x5c61a1['id']),util[_0xc2c2('0x21')](_0x14f801,{'showHidden':![],'depth':null}));}return _0x473581(null,_0x2fa41b);})['catch'](function(_0x32b5f4){logger[_0xc2c2('0x1f')](util['format'](_0xc2c2('0x20'),_0x5c61a1[_0xc2c2('0x1e')],_0x5c61a1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x473581(_0x32b5f4);});}else{return _0x473581(null,_0x2fa41b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 93d4dc6..9e04455 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 _0x2f68=['GetZohoAccount','ZohoAccount','options','raw','where','attributes','include','model','map','find','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZohoAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x32be00,_0x53fd74){var _0x511cf9=function(_0x172a3c){while(--_0x172a3c){_0x32be00['push'](_0x32be00['shift']());}};_0x511cf9(++_0x53fd74);}(_0x2f68,0x12b));var _0x82f6=function(_0x448d00,_0x221988){_0x448d00=_0x448d00-0x0;var _0x16e18e=_0x2f68[_0x448d00];return _0x16e18e;};'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(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require(_0x82f6('0x8'));var jayson=require(_0x82f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ad1f,_0x4fa10f,_0x282bc8){return new BPromise(function(_0x3fd6ef,_0x159ea8){return client['request'](_0x9ad1f,_0x282bc8)[_0x82f6('0xa')](function(_0x415226){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,'request\x20sent');logger[_0x82f6('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4fa10f,'request\x20sent',JSON[_0x82f6('0xe')](_0x415226));if(_0x415226['error']){if(_0x415226[_0x82f6('0xf')][_0x82f6('0x10')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x4fa10f,_0x415226['error'][_0x82f6('0x11')]);return _0x159ea8(_0x415226['error']['message']);}logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);return _0x3fd6ef(_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,_0x82f6('0x12'));_0x3fd6ef(_0x415226[_0x82f6('0x13')][_0x82f6('0x11')]);}})[_0x82f6('0x14')](function(_0x412d1f){logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x412d1f);_0x159ea8(_0x412d1f);});});}exports[_0x82f6('0x15')]=function(_0x59333a){var _0x2a16e2=this;return new Promise(function(_0x39dea8,_0x32b458){return db[_0x82f6('0x16')]['findAll']({'raw':_0x59333a[_0x82f6('0x17')]?_0x59333a[_0x82f6('0x17')][_0x82f6('0x18')]===undefined?!![]:![]:!![],'where':_0x59333a[_0x82f6('0x17')]?_0x59333a['options'][_0x82f6('0x19')]||null:null,'attributes':_0x59333a[_0x82f6('0x17')]?_0x59333a['options'][_0x82f6('0x1a')]||null:null,'limit':_0x59333a[_0x82f6('0x17')]?_0x59333a[_0x82f6('0x17')]['limit']||null:null,'include':_0x59333a[_0x82f6('0x17')]?_0x59333a['options'][_0x82f6('0x1b')]?_['map'](_0x59333a[_0x82f6('0x17')][_0x82f6('0x1b')],function(_0xe45c){return{'model':db[_0xe45c[_0x82f6('0x1c')]],'as':_0xe45c['as'],'attributes':_0xe45c[_0x82f6('0x1a')],'include':_0xe45c['include']?_[_0x82f6('0x1d')](_0xe45c[_0x82f6('0x1b')],function(_0x574713){return{'model':db[_0x574713[_0x82f6('0x1c')]],'as':_0x574713['as'],'attributes':_0x574713['attributes'],'include':_0x574713[_0x82f6('0x1b')]?_[_0x82f6('0x1d')](_0x574713[_0x82f6('0x1b')],function(_0x4b734e){return{'model':db[_0x4b734e[_0x82f6('0x1c')]],'as':_0x4b734e['as'],'attributes':_0x4b734e[_0x82f6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3350f2){logger[_0x82f6('0xb')](_0x82f6('0x15'),_0x59333a);logger[_0x82f6('0xd')](_0x82f6('0x15'),_0x59333a,JSON['stringify'](_0x3350f2));_0x39dea8(_0x3350f2);})[_0x82f6('0x14')](function(_0x230998){logger[_0x82f6('0xf')](_0x82f6('0x15'),_0x230998[_0x82f6('0x11')],_0x59333a);_0x32b458(_0x2a16e2['error'](0x1f4,_0x230998[_0x82f6('0x11')]));});});};exports['ShowZohoAccount']=function(_0x3cb2de){var _0x4a61ec=this;return new Promise(function(_0x1fbfe1,_0x4a6d69){return db[_0x82f6('0x16')][_0x82f6('0x1e')]({'raw':_0x3cb2de[_0x82f6('0x17')]?_0x3cb2de[_0x82f6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cb2de[_0x82f6('0x17')]?_0x3cb2de['options'][_0x82f6('0x19')]||null:null,'attributes':_0x3cb2de[_0x82f6('0x17')]?_0x3cb2de['options'][_0x82f6('0x1a')]||null:null,'include':_0x3cb2de['options']?_0x3cb2de[_0x82f6('0x17')][_0x82f6('0x1b')]?_[_0x82f6('0x1d')](_0x3cb2de[_0x82f6('0x17')][_0x82f6('0x1b')],function(_0x4b6c17){return{'model':db[_0x4b6c17['model']],'as':_0x4b6c17['as'],'attributes':_0x4b6c17[_0x82f6('0x1a')],'include':_0x4b6c17[_0x82f6('0x1b')]?_[_0x82f6('0x1d')](_0x4b6c17[_0x82f6('0x1b')],function(_0x337d81){return{'model':db[_0x337d81[_0x82f6('0x1c')]],'as':_0x337d81['as'],'attributes':_0x337d81[_0x82f6('0x1a')],'include':_0x337d81[_0x82f6('0x1b')]?_['map'](_0x337d81[_0x82f6('0x1b')],function(_0x468c5f){return{'model':db[_0x468c5f[_0x82f6('0x1c')]],'as':_0x468c5f['as'],'attributes':_0x468c5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x34fcc3){logger[_0x82f6('0xb')](_0x82f6('0x1f'),_0x3cb2de);logger[_0x82f6('0xd')](_0x82f6('0x1f'),_0x3cb2de,JSON[_0x82f6('0xe')](_0x34fcc3));_0x1fbfe1(_0x34fcc3);})[_0x82f6('0x14')](function(_0xb35b74){logger['error'](_0x82f6('0x1f'),_0xb35b74[_0x82f6('0x11')],_0x3cb2de);_0x4a6d69(_0x4a61ec[_0x82f6('0xf')](0x1f4,_0xb35b74[_0x82f6('0x11')]));});});}; \ No newline at end of file +var _0x5b47=['lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','find'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0x5b47,0x120));var _0x75b4=function(_0x567b03,_0x550e7e){_0x567b03=_0x567b03-0x0;var _0x58ed59=_0x5b47[_0x567b03];return _0x58ed59;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75b4('0x2'));var logger=require(_0x75b4('0x3'))(_0x75b4('0x4'));var config=require(_0x75b4('0x5'));var jayson=require(_0x75b4('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53dcb0,_0x1f1e33,_0x5285bb){return new BPromise(function(_0x16138d,_0x39ff0b){return client[_0x75b4('0x7')](_0x53dcb0,_0x5285bb)[_0x75b4('0x8')](function(_0x127e77){logger[_0x75b4('0x9')](_0x75b4('0xa'),_0x1f1e33,_0x75b4('0xb'));logger[_0x75b4('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1f1e33,_0x75b4('0xb'),JSON['stringify'](_0x127e77));if(_0x127e77[_0x75b4('0xd')]){if(_0x127e77[_0x75b4('0xd')][_0x75b4('0xe')]===0x1f4){logger[_0x75b4('0xd')](_0x75b4('0xa'),_0x1f1e33,_0x127e77[_0x75b4('0xd')][_0x75b4('0xf')]);return _0x39ff0b(_0x127e77[_0x75b4('0xd')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1f1e33,_0x127e77[_0x75b4('0xd')][_0x75b4('0xf')]);return _0x16138d(_0x127e77['error'][_0x75b4('0xf')]);}else{logger[_0x75b4('0x9')](_0x75b4('0xa'),_0x1f1e33,'request\x20sent');_0x16138d(_0x127e77[_0x75b4('0x10')][_0x75b4('0xf')]);}})[_0x75b4('0x11')](function(_0xc7ce4f){logger['error'](_0x75b4('0xa'),_0x1f1e33,_0xc7ce4f);_0x39ff0b(_0xc7ce4f);});});}exports[_0x75b4('0x12')]=function(_0x254063){var _0x7e396d=this;return new Promise(function(_0x33d522,_0x3a1eec){return db[_0x75b4('0x13')][_0x75b4('0x14')]({'raw':_0x254063[_0x75b4('0x15')]?_0x254063[_0x75b4('0x15')][_0x75b4('0x16')]===undefined?!![]:![]:!![],'where':_0x254063[_0x75b4('0x15')]?_0x254063[_0x75b4('0x15')][_0x75b4('0x17')]||null:null,'attributes':_0x254063[_0x75b4('0x15')]?_0x254063[_0x75b4('0x15')][_0x75b4('0x18')]||null:null,'limit':_0x254063[_0x75b4('0x15')]?_0x254063[_0x75b4('0x15')][_0x75b4('0x19')]||null:null,'include':_0x254063[_0x75b4('0x15')]?_0x254063[_0x75b4('0x15')][_0x75b4('0x1a')]?_[_0x75b4('0x1b')](_0x254063['options'][_0x75b4('0x1a')],function(_0x59bab1){return{'model':db[_0x59bab1[_0x75b4('0x1c')]],'as':_0x59bab1['as'],'attributes':_0x59bab1[_0x75b4('0x18')],'include':_0x59bab1[_0x75b4('0x1a')]?_[_0x75b4('0x1b')](_0x59bab1['include'],function(_0x5e0b93){return{'model':db[_0x5e0b93[_0x75b4('0x1c')]],'as':_0x5e0b93['as'],'attributes':_0x5e0b93[_0x75b4('0x18')],'include':_0x5e0b93['include']?_[_0x75b4('0x1b')](_0x5e0b93[_0x75b4('0x1a')],function(_0x5943ec){return{'model':db[_0x5943ec['model']],'as':_0x5943ec['as'],'attributes':_0x5943ec[_0x75b4('0x18')]};}):[]};}):[]};}):[]:[]})[_0x75b4('0x8')](function(_0x5c57c8){logger[_0x75b4('0x9')](_0x75b4('0x12'),_0x254063);logger[_0x75b4('0xc')](_0x75b4('0x12'),_0x254063,JSON[_0x75b4('0x1d')](_0x5c57c8));_0x33d522(_0x5c57c8);})[_0x75b4('0x11')](function(_0x5468eb){logger['error'](_0x75b4('0x12'),_0x5468eb[_0x75b4('0xf')],_0x254063);_0x3a1eec(_0x7e396d[_0x75b4('0xd')](0x1f4,_0x5468eb[_0x75b4('0xf')]));});});};exports[_0x75b4('0x1e')]=function(_0x228d17){var _0x398269=this;return new Promise(function(_0x4bdbac,_0x2912c4){return db[_0x75b4('0x13')][_0x75b4('0x1f')]({'raw':_0x228d17[_0x75b4('0x15')]?_0x228d17[_0x75b4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x228d17[_0x75b4('0x15')]?_0x228d17['options'][_0x75b4('0x17')]||null:null,'attributes':_0x228d17[_0x75b4('0x15')]?_0x228d17[_0x75b4('0x15')][_0x75b4('0x18')]||null:null,'include':_0x228d17[_0x75b4('0x15')]?_0x228d17[_0x75b4('0x15')]['include']?_[_0x75b4('0x1b')](_0x228d17['options']['include'],function(_0x5e496d){return{'model':db[_0x5e496d[_0x75b4('0x1c')]],'as':_0x5e496d['as'],'attributes':_0x5e496d[_0x75b4('0x18')],'include':_0x5e496d['include']?_['map'](_0x5e496d['include'],function(_0x532724){return{'model':db[_0x532724[_0x75b4('0x1c')]],'as':_0x532724['as'],'attributes':_0x532724[_0x75b4('0x18')],'include':_0x532724['include']?_[_0x75b4('0x1b')](_0x532724[_0x75b4('0x1a')],function(_0x3b0328){return{'model':db[_0x3b0328[_0x75b4('0x1c')]],'as':_0x3b0328['as'],'attributes':_0x3b0328[_0x75b4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdbecfc){logger[_0x75b4('0x9')](_0x75b4('0x1e'),_0x228d17);logger[_0x75b4('0xc')](_0x75b4('0x1e'),_0x228d17,JSON[_0x75b4('0x1d')](_0xdbecfc));_0x4bdbac(_0xdbecfc);})[_0x75b4('0x11')](function(_0x45afd3){logger[_0x75b4('0xd')]('ShowZohoAccount',_0x45afd3[_0x75b4('0xf')],_0x228d17);_0x2912c4(_0x398269[_0x75b4('0xd')](0x1f4,_0x45afd3[_0x75b4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 753f9b5..7c867d5 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 _0x9f7a=['get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f7a,0x15e));var _0xa9f7=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9f7a[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0xa9f7('0x0'));var util=require('util');var path=require(_0xa9f7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9f7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa9f7('0x3'));var interaction=require(_0xa9f7('0x4'));var config=require(_0xa9f7('0x5'));var controller=require(_0xa9f7('0x6'));router[_0xa9f7('0x7')]('/',auth[_0xa9f7('0x8')](),controller[_0xa9f7('0x9')]);router['get'](_0xa9f7('0xa'),auth['isAuthenticated'](),controller[_0xa9f7('0xb')]);router['get']('/:id/fields',auth[_0xa9f7('0x8')](),controller[_0xa9f7('0xc')]);router[_0xa9f7('0x7')](_0xa9f7('0xd'),auth[_0xa9f7('0x8')](),controller[_0xa9f7('0xe')]);router[_0xa9f7('0x7')](_0xa9f7('0xf'),auth['isAuthenticated'](),controller[_0xa9f7('0x10')]);router[_0xa9f7('0x11')]('/',auth[_0xa9f7('0x8')](),controller['create']);router[_0xa9f7('0x12')](_0xa9f7('0xa'),auth['isAuthenticated'](),controller[_0xa9f7('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa9f7('0x14')]);module['exports']=router; \ No newline at end of file +var _0xce69=['get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xce69,0x6a));var _0x9ce6=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xce69[_0x25a42a];return _0x1129b1;};'use strict';var multer=require('multer');var util=require(_0x9ce6('0x0'));var path=require('path');var timeout=require(_0x9ce6('0x1'));var express=require('express');var router=express[_0x9ce6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9ce6('0x3'));var interaction=require(_0x9ce6('0x4'));var config=require('../../config/environment');var controller=require(_0x9ce6('0x5'));router['get']('/',auth[_0x9ce6('0x6')](),controller[_0x9ce6('0x7')]);router[_0x9ce6('0x8')](_0x9ce6('0x9'),auth[_0x9ce6('0x6')](),controller[_0x9ce6('0xa')]);router[_0x9ce6('0x8')](_0x9ce6('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x9ce6('0xc'),auth[_0x9ce6('0x6')](),controller[_0x9ce6('0xd')]);router[_0x9ce6('0x8')](_0x9ce6('0xe'),auth[_0x9ce6('0x6')](),controller[_0x9ce6('0xf')]);router['post']('/',auth[_0x9ce6('0x6')](),controller['create']);router[_0x9ce6('0x10')](_0x9ce6('0x9'),auth[_0x9ce6('0x6')](),controller['update']);router[_0x9ce6('0x11')](_0x9ce6('0x9'),auth['isAuthenticated'](),controller[_0x9ce6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 76929ec..0543231 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 _0x6a5c=['contact','exports','lead','nothing','ENUM','contact_lead'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6a5c,0x9d));var _0xc6a5=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x6a5c[_0x5ac84c];return _0x3c53d2;};'use strict';var Sequelize=require('sequelize');module[_0xc6a5('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xc6a5('0x1'),'contact',_0xc6a5('0x2')),'defaultValue':_0xc6a5('0x1')},'moduleSearch':{'type':Sequelize[_0xc6a5('0x3')](_0xc6a5('0x4'),_0xc6a5('0x5'),_0xc6a5('0x1')),'defaultValue':_0xc6a5('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x943a=['sequelize','ENUM','lead','contact','contact_lead','STRING'];(function(_0x4d8580,_0x1d70e1){var _0x2df733=function(_0x59042d){while(--_0x59042d){_0x4d8580['push'](_0x4d8580['shift']());}};_0x2df733(++_0x1d70e1);}(_0x943a,0xfc));var _0xa943=function(_0x322d31,_0x45db0f){_0x322d31=_0x322d31-0x0;var _0x3574ea=_0x943a[_0x322d31];return _0x3574ea;};'use strict';var Sequelize=require(_0xa943('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xa943('0x1')](_0xa943('0x2'),_0xa943('0x3'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa943('0x1')](_0xa943('0x4'),'contact',_0xa943('0x2')),'defaultValue':_0xa943('0x4')},'description':{'type':Sequelize[_0xa943('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bbc38ab..41cf0c9 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 _0xd080=['create','body','params','getFields','ZohoField','length','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','save','update','destroy','then','error','name','send','ZohoConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','keys','include','find'];(function(_0x5b2aa2,_0x3d4ead){var _0x35b514=function(_0x1056d9){while(--_0x1056d9){_0x5b2aa2['push'](_0x5b2aa2['shift']());}};_0x35b514(++_0x3d4ead);}(_0xd080,0x1d8));var _0x0d08=function(_0x373369,_0x2e3e92){_0x373369=_0x373369-0x0;var _0x6dbf25=_0xd080[_0x373369];return _0x6dbf25;};'use strict';var emlformat=require(_0x0d08('0x0'));var rimraf=require(_0x0d08('0x1'));var zipdir=require(_0x0d08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d08('0x3'));var moment=require(_0x0d08('0x4'));var BPromise=require(_0x0d08('0x5'));var Mustache=require(_0x0d08('0x6'));var util=require(_0x0d08('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d08('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0d08('0x9'));var crypto=require(_0x0d08('0xa'));var jsforce=require(_0x0d08('0xb'));var deskjs=require(_0x0d08('0xc'));var toCsv=require(_0x0d08('0xd'));var querystring=require(_0x0d08('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d08('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0d08('0x10'));var as=require(_0x0d08('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d08('0x12'))(_0x0d08('0x13'));var utils=require(_0x0d08('0x14'));var config=require(_0x0d08('0x15'));var licenseUtil=require(_0x0d08('0x16'));var db=require(_0x0d08('0x17'))['db'];function respondWithStatusCode(_0x1f67ff,_0x33ff03){_0x33ff03=_0x33ff03||0xcc;return function(_0x1453f6){if(_0x1453f6){return _0x1f67ff['sendStatus'](_0x33ff03);}return _0x1f67ff[_0x0d08('0x18')](_0x33ff03)[_0x0d08('0x19')]();};}function respondWithResult(_0x4430a8,_0x1949ed){_0x1949ed=_0x1949ed||0xc8;return function(_0x3b8c34){if(_0x3b8c34){return _0x4430a8[_0x0d08('0x18')](_0x1949ed)['json'](_0x3b8c34);}};}function respondWithFilteredResult(_0x12ff7f,_0x1f0e10){return function(_0x175dbd){if(_0x175dbd){var _0x2f6626=typeof _0x1f0e10['offset']===_0x0d08('0x1a')&&typeof _0x1f0e10[_0x0d08('0x1b')]===_0x0d08('0x1a');var _0x3434b2=_0x175dbd[_0x0d08('0x1c')];var _0x473944=_0x2f6626?0x0:_0x1f0e10[_0x0d08('0x1d')];var _0x27c06f=_0x2f6626?_0x175dbd[_0x0d08('0x1c')]:_0x1f0e10[_0x0d08('0x1d')]+_0x1f0e10[_0x0d08('0x1b')];var _0x1f5fea;if(_0x27c06f>=_0x3434b2){_0x27c06f=_0x3434b2;_0x1f5fea=0xc8;}else{_0x1f5fea=0xce;}_0x12ff7f[_0x0d08('0x18')](_0x1f5fea);return _0x12ff7f[_0x0d08('0x1e')]('Content-Range',_0x473944+'-'+_0x27c06f+'/'+_0x3434b2)[_0x0d08('0x1f')](_0x175dbd);}return null;};}function patchUpdates(_0x409f8a){return function(_0x3d3846){try{jsonpatch[_0x0d08('0x20')](_0x3d3846,_0x409f8a,!![]);}catch(_0x261dc7){return BPromise['reject'](_0x261dc7);}return _0x3d3846[_0x0d08('0x21')]();};}function saveUpdates(_0x4aed61,_0x224b93){return function(_0x577b87){if(_0x577b87){return _0x577b87[_0x0d08('0x22')](_0x4aed61)['then'](function(_0xc0842d){return _0xc0842d;});}return null;};}function removeEntity(_0x3f30b8,_0x1c916c){return function(_0x350874){if(_0x350874){return _0x350874[_0x0d08('0x23')]()[_0x0d08('0x24')](function(){_0x3f30b8[_0x0d08('0x18')](0xcc)[_0x0d08('0x19')]();});}};}function handleEntityNotFound(_0x396837,_0x3586ba){return function(_0xdcef98){if(!_0xdcef98){_0x396837['sendStatus'](0x194);}return _0xdcef98;};}function handleError(_0x21a88b,_0x3ddf18){_0x3ddf18=_0x3ddf18||0x1f4;return function(_0x2822fe){logger[_0x0d08('0x25')](_0x2822fe['stack']);if(_0x2822fe[_0x0d08('0x26')]){delete _0x2822fe[_0x0d08('0x26')];}_0x21a88b[_0x0d08('0x18')](_0x3ddf18)[_0x0d08('0x27')](_0x2822fe);};}exports['index']=function(_0x1c565b,_0xe0ca76){var _0x37bb15={},_0x163a0b={},_0x1d3744={'count':0x0,'rows':[]};var _0xc6a516=_['map'](db[_0x0d08('0x28')][_0x0d08('0x29')],function(_0x5b8a3c){return{'name':_0x5b8a3c[_0x0d08('0x2a')],'type':_0x5b8a3c[_0x0d08('0x2b')]['key']};});_0x163a0b[_0x0d08('0x2c')]=_[_0x0d08('0x2d')](_0xc6a516,_0x0d08('0x26'));_0x163a0b[_0x0d08('0x2e')]=_['keys'](_0x1c565b['query']);_0x163a0b[_0x0d08('0x2f')]=_[_0x0d08('0x30')](_0x163a0b[_0x0d08('0x2c')],_0x163a0b[_0x0d08('0x2e')]);_0x37bb15[_0x0d08('0x31')]=_[_0x0d08('0x30')](_0x163a0b[_0x0d08('0x2c')],qs['fields'](_0x1c565b[_0x0d08('0x2e')][_0x0d08('0x32')]));_0x37bb15['attributes']=_0x37bb15[_0x0d08('0x31')]['length']?_0x37bb15[_0x0d08('0x31')]:_0x163a0b[_0x0d08('0x2c')];if(!_0x1c565b[_0x0d08('0x2e')][_0x0d08('0x33')]('nolimit')){_0x37bb15[_0x0d08('0x1b')]=qs[_0x0d08('0x1b')](_0x1c565b['query'][_0x0d08('0x1b')]);_0x37bb15['offset']=qs[_0x0d08('0x1d')](_0x1c565b['query'][_0x0d08('0x1d')]);}_0x37bb15[_0x0d08('0x34')]=qs[_0x0d08('0x35')](_0x1c565b[_0x0d08('0x2e')][_0x0d08('0x35')]);_0x37bb15[_0x0d08('0x36')]=qs[_0x0d08('0x2f')](_[_0x0d08('0x37')](_0x1c565b[_0x0d08('0x2e')],_0x163a0b[_0x0d08('0x2f')]),_0xc6a516);if(_0x1c565b['query'][_0x0d08('0x38')]){_0x37bb15[_0x0d08('0x36')]=_['merge'](_0x37bb15[_0x0d08('0x36')],{'$or':_[_0x0d08('0x2d')](_0xc6a516,function(_0x9cdb73){if(_0x9cdb73[_0x0d08('0x2b')]!==_0x0d08('0x39')){var _0x2203c2={};_0x2203c2[_0x9cdb73[_0x0d08('0x26')]]={'$like':'%'+_0x1c565b['query']['filter']+'%'};return _0x2203c2;}})});}_0x37bb15=_[_0x0d08('0x3a')]({},_0x37bb15,_0x1c565b[_0x0d08('0x3b')]);var _0x5a9992={'where':_0x37bb15['where']};return db[_0x0d08('0x28')][_0x0d08('0x1c')](_0x5a9992)[_0x0d08('0x24')](function(_0x1deb1f){_0x1d3744[_0x0d08('0x1c')]=_0x1deb1f;if(_0x1c565b[_0x0d08('0x2e')][_0x0d08('0x3c')]){_0x37bb15['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x0d08('0x3d')](_0x37bb15);})['then'](function(_0x2d40ab){_0x1d3744['rows']=_0x2d40ab;return _0x1d3744;})[_0x0d08('0x24')](respondWithFilteredResult(_0xe0ca76,_0x37bb15))[_0x0d08('0x3e')](handleError(_0xe0ca76,null));};exports[_0x0d08('0x3f')]=function(_0x124338,_0x116515){var _0x8fcbc0={'raw':![],'where':{'id':_0x124338['params']['id']}},_0x5e88f2={};_0x5e88f2[_0x0d08('0x2c')]=_[_0x0d08('0x40')](db[_0x0d08('0x28')]['rawAttributes']);_0x5e88f2['query']=_[_0x0d08('0x40')](_0x124338[_0x0d08('0x2e')]);_0x5e88f2[_0x0d08('0x2f')]=_['intersection'](_0x5e88f2[_0x0d08('0x2c')],_0x5e88f2[_0x0d08('0x2e')]);_0x8fcbc0[_0x0d08('0x31')]=_[_0x0d08('0x30')](_0x5e88f2[_0x0d08('0x2c')],qs[_0x0d08('0x32')](_0x124338[_0x0d08('0x2e')][_0x0d08('0x32')]));_0x8fcbc0[_0x0d08('0x31')]=_0x8fcbc0[_0x0d08('0x31')]['length']?_0x8fcbc0[_0x0d08('0x31')]:_0x5e88f2[_0x0d08('0x2c')];if(_0x124338[_0x0d08('0x2e')]['includeAll']){_0x8fcbc0[_0x0d08('0x41')]=[{'all':!![]}];}_0x8fcbc0=_[_0x0d08('0x3a')]({},_0x8fcbc0,_0x124338['options']);return db[_0x0d08('0x28')][_0x0d08('0x42')](_0x8fcbc0)['then'](handleEntityNotFound(_0x116515,null))[_0x0d08('0x24')](respondWithResult(_0x116515,null))[_0x0d08('0x3e')](handleError(_0x116515,null));};exports[_0x0d08('0x43')]=function(_0x43835c,_0x3e7e22){return db[_0x0d08('0x28')][_0x0d08('0x43')](_0x43835c[_0x0d08('0x44')],{})[_0x0d08('0x24')](respondWithResult(_0x3e7e22,0xc9))[_0x0d08('0x3e')](handleError(_0x3e7e22,null));};exports[_0x0d08('0x22')]=function(_0x4c74a3,_0x159cc0){if(_0x4c74a3[_0x0d08('0x44')]['id']){delete _0x4c74a3[_0x0d08('0x44')]['id'];}return db[_0x0d08('0x28')][_0x0d08('0x42')]({'where':{'id':_0x4c74a3['params']['id']}})[_0x0d08('0x24')](handleEntityNotFound(_0x159cc0,null))[_0x0d08('0x24')](saveUpdates(_0x4c74a3[_0x0d08('0x44')],null))['then'](respondWithResult(_0x159cc0,null))[_0x0d08('0x3e')](handleError(_0x159cc0,null));};exports[_0x0d08('0x23')]=function(_0x4d8a41,_0xb22fb0){return db['ZohoConfiguration']['find']({'where':{'id':_0x4d8a41[_0x0d08('0x45')]['id']}})[_0x0d08('0x24')](handleEntityNotFound(_0xb22fb0,null))['then'](removeEntity(_0xb22fb0,null))[_0x0d08('0x3e')](handleError(_0xb22fb0,null));};exports[_0x0d08('0x46')]=function(_0x3acbbc,_0x2a0972,_0xf84ef3){var _0x568122={};var _0x2f5971={};var _0x51eba0;var _0x30a6dc;return db[_0x0d08('0x28')]['findOne']({'where':{'id':_0x3acbbc['params']['id']}})[_0x0d08('0x24')](handleEntityNotFound(_0x2a0972,null))[_0x0d08('0x24')](function(_0x289062){if(_0x289062){_0x51eba0=_0x289062;_0x2f5971[_0x0d08('0x2c')]=_['keys'](db[_0x0d08('0x47')]['rawAttributes']);_0x2f5971['query']=_[_0x0d08('0x40')](_0x3acbbc[_0x0d08('0x2e')]);_0x2f5971['filters']=_['intersection'](_0x2f5971['model'],_0x2f5971[_0x0d08('0x2e')]);_0x568122[_0x0d08('0x31')]=_[_0x0d08('0x30')](_0x2f5971[_0x0d08('0x2c')],qs[_0x0d08('0x32')](_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x32')]));_0x568122['attributes']=_0x568122[_0x0d08('0x31')][_0x0d08('0x48')]?_0x568122[_0x0d08('0x31')]:_0x2f5971['model'];_0x568122[_0x0d08('0x34')]=qs[_0x0d08('0x35')](_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x35')]);_0x568122[_0x0d08('0x36')]=qs['filters'](_['pick'](_0x3acbbc['query'],_0x2f5971['filters']));if(_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x38')]){_0x568122[_0x0d08('0x36')]=_['merge'](_0x568122['where'],{'$or':_[_0x0d08('0x2d')](_0x568122[_0x0d08('0x31')],function(_0x1a39c0){var _0x204187={};_0x204187[_0x1a39c0]={'$like':'%'+_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x38')]+'%'};return _0x204187;})});}_0x568122=_[_0x0d08('0x3a')]({},_0x568122,_0x3acbbc[_0x0d08('0x3b')]);return _0x51eba0[_0x0d08('0x46')](_0x568122);}})[_0x0d08('0x24')](function(_0x44620c){if(_0x44620c){_0x30a6dc=_0x44620c[_0x0d08('0x48')];if(!_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x33')](_0x0d08('0x49'))){_0x568122[_0x0d08('0x1b')]=qs[_0x0d08('0x1b')](_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x1b')]);_0x568122['offset']=qs['offset'](_0x3acbbc[_0x0d08('0x2e')][_0x0d08('0x1d')]);}return _0x51eba0[_0x0d08('0x46')](_0x568122);}})[_0x0d08('0x24')](function(_0x2e771a){if(_0x2e771a){return _0x2e771a?{'count':_0x30a6dc,'rows':_0x2e771a}:null;}})[_0x0d08('0x24')](respondWithResult(_0x2a0972,null))['catch'](handleError(_0x2a0972,null));};exports[_0x0d08('0x4a')]=function(_0x88b64d,_0xf9f56a,_0x1882f3){var _0x3ac639={};var _0x2f6d2b={};var _0x1508a5;var _0x29ad52;return db[_0x0d08('0x28')][_0x0d08('0x4b')]({'where':{'id':_0x88b64d[_0x0d08('0x45')]['id']}})[_0x0d08('0x24')](handleEntityNotFound(_0xf9f56a,null))[_0x0d08('0x24')](function(_0x1d6663){if(_0x1d6663){_0x1508a5=_0x1d6663;_0x2f6d2b[_0x0d08('0x2c')]=_[_0x0d08('0x40')](db[_0x0d08('0x47')][_0x0d08('0x29')]);_0x2f6d2b[_0x0d08('0x2e')]=_['keys'](_0x88b64d['query']);_0x2f6d2b[_0x0d08('0x2f')]=_[_0x0d08('0x30')](_0x2f6d2b['model'],_0x2f6d2b['query']);_0x3ac639[_0x0d08('0x31')]=_[_0x0d08('0x30')](_0x2f6d2b[_0x0d08('0x2c')],qs[_0x0d08('0x32')](_0x88b64d[_0x0d08('0x2e')][_0x0d08('0x32')]));_0x3ac639[_0x0d08('0x31')]=_0x3ac639[_0x0d08('0x31')][_0x0d08('0x48')]?_0x3ac639[_0x0d08('0x31')]:_0x2f6d2b[_0x0d08('0x2c')];_0x3ac639['order']=qs[_0x0d08('0x35')](_0x88b64d[_0x0d08('0x2e')][_0x0d08('0x35')]);_0x3ac639['where']=qs['filters'](_[_0x0d08('0x37')](_0x88b64d['query'],_0x2f6d2b[_0x0d08('0x2f')]));if(_0x88b64d[_0x0d08('0x2e')][_0x0d08('0x38')]){_0x3ac639[_0x0d08('0x36')]=_['merge'](_0x3ac639['where'],{'$or':_[_0x0d08('0x2d')](_0x3ac639[_0x0d08('0x31')],function(_0x51c393){var _0x2aaa85={};_0x2aaa85[_0x51c393]={'$like':'%'+_0x88b64d[_0x0d08('0x2e')]['filter']+'%'};return _0x2aaa85;})});}_0x3ac639=_[_0x0d08('0x3a')]({},_0x3ac639,_0x88b64d[_0x0d08('0x3b')]);return _0x1508a5['getSubjects'](_0x3ac639);}})[_0x0d08('0x24')](function(_0x598c7f){if(_0x598c7f){_0x29ad52=_0x598c7f[_0x0d08('0x48')];if(!_0x88b64d[_0x0d08('0x2e')]['hasOwnProperty']('nolimit')){_0x3ac639[_0x0d08('0x1b')]=qs[_0x0d08('0x1b')](_0x88b64d[_0x0d08('0x2e')][_0x0d08('0x1b')]);_0x3ac639[_0x0d08('0x1d')]=qs[_0x0d08('0x1d')](_0x88b64d['query'][_0x0d08('0x1d')]);}return _0x1508a5['getSubjects'](_0x3ac639);}})[_0x0d08('0x24')](function(_0x30c5ec){if(_0x30c5ec){return _0x30c5ec?{'count':_0x29ad52,'rows':_0x30c5ec}:null;}})[_0x0d08('0x24')](respondWithResult(_0xf9f56a,null))['catch'](handleError(_0xf9f56a,null));};exports[_0x0d08('0x4c')]=function(_0x386060,_0x13b09b,_0x1e534d){var _0x22ae1e={};var _0x469c03={};var _0x473d2e;var _0xf38a00;return db[_0x0d08('0x28')][_0x0d08('0x4b')]({'where':{'id':_0x386060[_0x0d08('0x45')]['id']}})[_0x0d08('0x24')](handleEntityNotFound(_0x13b09b,null))[_0x0d08('0x24')](function(_0x4fcf22){if(_0x4fcf22){_0x473d2e=_0x4fcf22;_0x469c03[_0x0d08('0x2c')]=_[_0x0d08('0x40')](db['ZohoField'][_0x0d08('0x29')]);_0x469c03[_0x0d08('0x2e')]=_[_0x0d08('0x40')](_0x386060['query']);_0x469c03[_0x0d08('0x2f')]=_[_0x0d08('0x30')](_0x469c03[_0x0d08('0x2c')],_0x469c03[_0x0d08('0x2e')]);_0x22ae1e[_0x0d08('0x31')]=_[_0x0d08('0x30')](_0x469c03[_0x0d08('0x2c')],qs[_0x0d08('0x32')](_0x386060[_0x0d08('0x2e')]['fields']));_0x22ae1e['attributes']=_0x22ae1e[_0x0d08('0x31')][_0x0d08('0x48')]?_0x22ae1e[_0x0d08('0x31')]:_0x469c03['model'];_0x22ae1e[_0x0d08('0x34')]=qs[_0x0d08('0x35')](_0x386060['query']['sort']);_0x22ae1e['where']=qs['filters'](_[_0x0d08('0x37')](_0x386060[_0x0d08('0x2e')],_0x469c03['filters']));if(_0x386060[_0x0d08('0x2e')]['filter']){_0x22ae1e[_0x0d08('0x36')]=_[_0x0d08('0x3a')](_0x22ae1e[_0x0d08('0x36')],{'$or':_[_0x0d08('0x2d')](_0x22ae1e['attributes'],function(_0x25135c){var _0x5af087={};_0x5af087[_0x25135c]={'$like':'%'+_0x386060[_0x0d08('0x2e')][_0x0d08('0x38')]+'%'};return _0x5af087;})});}_0x22ae1e=_['merge']({},_0x22ae1e,_0x386060[_0x0d08('0x3b')]);return _0x473d2e[_0x0d08('0x4c')](_0x22ae1e);}})[_0x0d08('0x24')](function(_0x1e15ac){if(_0x1e15ac){_0xf38a00=_0x1e15ac[_0x0d08('0x48')];if(!_0x386060[_0x0d08('0x2e')][_0x0d08('0x33')](_0x0d08('0x49'))){_0x22ae1e[_0x0d08('0x1b')]=qs['limit'](_0x386060[_0x0d08('0x2e')][_0x0d08('0x1b')]);_0x22ae1e['offset']=qs[_0x0d08('0x1d')](_0x386060['query'][_0x0d08('0x1d')]);}return _0x473d2e[_0x0d08('0x4c')](_0x22ae1e);}})[_0x0d08('0x24')](function(_0x2518bf){if(_0x2518bf){return _0x2518bf?{'count':_0xf38a00,'rows':_0x2518bf}:null;}})[_0x0d08('0x24')](respondWithResult(_0x13b09b,null))[_0x0d08('0x3e')](handleError(_0x13b09b,null));}; \ No newline at end of file +var _0xc6ed=['error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','keys','length','include','body','find','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','sendStatus'];(function(_0x13f64a,_0x37b2c0){var _0x51d060=function(_0x59d501){while(--_0x59d501){_0x13f64a['push'](_0x13f64a['shift']());}};_0x51d060(++_0x37b2c0);}(_0xc6ed,0x1be));var _0xdc6e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc6ed[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xdc6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc6e('0x1'));var jsonpatch=require(_0xdc6e('0x2'));var rp=require(_0xdc6e('0x3'));var moment=require(_0xdc6e('0x4'));var BPromise=require(_0xdc6e('0x5'));var Mustache=require(_0xdc6e('0x6'));var util=require(_0xdc6e('0x7'));var path=require(_0xdc6e('0x8'));var sox=require(_0xdc6e('0x9'));var csv=require(_0xdc6e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc6e('0xb'));var _=require(_0xdc6e('0xc'));var squel=require('squel');var crypto=require(_0xdc6e('0xd'));var jsforce=require(_0xdc6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc6e('0xf'));var Papa=require(_0xdc6e('0x10'));var Redis=require('ioredis');var authService=require(_0xdc6e('0x11'));var qs=require(_0xdc6e('0x12'));var as=require(_0xdc6e('0x13'));var hardwareService=require(_0xdc6e('0x14'));var logger=require(_0xdc6e('0x15'))(_0xdc6e('0x16'));var utils=require('../../config/utils');var config=require(_0xdc6e('0x17'));var licenseUtil=require(_0xdc6e('0x18'));var db=require(_0xdc6e('0x19'))['db'];function respondWithStatusCode(_0x5c2379,_0x428b78){_0x428b78=_0x428b78||0xcc;return function(_0x9122d7){if(_0x9122d7){return _0x5c2379['sendStatus'](_0x428b78);}return _0x5c2379['status'](_0x428b78)[_0xdc6e('0x1a')]();};}function respondWithResult(_0x47404,_0x4f95a9){_0x4f95a9=_0x4f95a9||0xc8;return function(_0x9fec09){if(_0x9fec09){return _0x47404[_0xdc6e('0x1b')](_0x4f95a9)[_0xdc6e('0x1c')](_0x9fec09);}};}function respondWithFilteredResult(_0x1e2fc1,_0xcd661b){return function(_0x4fab91){if(_0x4fab91){var _0x4c0ae9=typeof _0xcd661b[_0xdc6e('0x1d')]==='undefined'&&typeof _0xcd661b[_0xdc6e('0x1e')]===_0xdc6e('0x1f');var _0x5c6028=_0x4fab91[_0xdc6e('0x20')];var _0x36fc80=_0x4c0ae9?0x0:_0xcd661b['offset'];var _0x355dff=_0x4c0ae9?_0x4fab91[_0xdc6e('0x20')]:_0xcd661b[_0xdc6e('0x1d')]+_0xcd661b['limit'];var _0x1a2ea8;if(_0x355dff>=_0x5c6028){_0x355dff=_0x5c6028;_0x1a2ea8=0xc8;}else{_0x1a2ea8=0xce;}_0x1e2fc1[_0xdc6e('0x1b')](_0x1a2ea8);return _0x1e2fc1['set'](_0xdc6e('0x21'),_0x36fc80+'-'+_0x355dff+'/'+_0x5c6028)[_0xdc6e('0x1c')](_0x4fab91);}return null;};}function patchUpdates(_0x4dea62){return function(_0x4a148c){try{jsonpatch[_0xdc6e('0x22')](_0x4a148c,_0x4dea62,!![]);}catch(_0x451e82){return BPromise['reject'](_0x451e82);}return _0x4a148c[_0xdc6e('0x23')]();};}function saveUpdates(_0x46c443,_0x3b8401){return function(_0x53b395){if(_0x53b395){return _0x53b395[_0xdc6e('0x24')](_0x46c443)['then'](function(_0x3a5b92){return _0x3a5b92;});}return null;};}function removeEntity(_0x327002,_0x39cf41){return function(_0x59ab33){if(_0x59ab33){return _0x59ab33[_0xdc6e('0x25')]()[_0xdc6e('0x26')](function(){_0x327002['status'](0xcc)[_0xdc6e('0x1a')]();});}};}function handleEntityNotFound(_0x3662c6,_0x16677f){return function(_0x2c2249){if(!_0x2c2249){_0x3662c6[_0xdc6e('0x27')](0x194);}return _0x2c2249;};}function handleError(_0x23eb2f,_0x5d5898){_0x5d5898=_0x5d5898||0x1f4;return function(_0x2edd11){logger[_0xdc6e('0x28')](_0x2edd11[_0xdc6e('0x29')]);if(_0x2edd11[_0xdc6e('0x2a')]){delete _0x2edd11['name'];}_0x23eb2f[_0xdc6e('0x1b')](_0x5d5898)[_0xdc6e('0x2b')](_0x2edd11);};}exports[_0xdc6e('0x2c')]=function(_0x223367,_0x7da70c){var _0x56a082={},_0x2b39aa={},_0x26d39a={'count':0x0,'rows':[]};var _0x2a1e58=_['map'](db[_0xdc6e('0x2d')][_0xdc6e('0x2e')],function(_0x519733){return{'name':_0x519733[_0xdc6e('0x2f')],'type':_0x519733[_0xdc6e('0x30')]['key']};});_0x2b39aa[_0xdc6e('0x31')]=_[_0xdc6e('0x32')](_0x2a1e58,_0xdc6e('0x2a'));_0x2b39aa['query']=_['keys'](_0x223367[_0xdc6e('0x33')]);_0x2b39aa[_0xdc6e('0x34')]=_[_0xdc6e('0x35')](_0x2b39aa[_0xdc6e('0x31')],_0x2b39aa[_0xdc6e('0x33')]);_0x56a082[_0xdc6e('0x36')]=_[_0xdc6e('0x35')](_0x2b39aa[_0xdc6e('0x31')],qs[_0xdc6e('0x37')](_0x223367['query']['fields']));_0x56a082[_0xdc6e('0x36')]=_0x56a082[_0xdc6e('0x36')]['length']?_0x56a082[_0xdc6e('0x36')]:_0x2b39aa[_0xdc6e('0x31')];if(!_0x223367[_0xdc6e('0x33')]['hasOwnProperty'](_0xdc6e('0x38'))){_0x56a082[_0xdc6e('0x1e')]=qs[_0xdc6e('0x1e')](_0x223367['query']['limit']);_0x56a082[_0xdc6e('0x1d')]=qs[_0xdc6e('0x1d')](_0x223367[_0xdc6e('0x33')][_0xdc6e('0x1d')]);}_0x56a082[_0xdc6e('0x39')]=qs[_0xdc6e('0x3a')](_0x223367[_0xdc6e('0x33')]['sort']);_0x56a082[_0xdc6e('0x3b')]=qs[_0xdc6e('0x34')](_[_0xdc6e('0x3c')](_0x223367[_0xdc6e('0x33')],_0x2b39aa[_0xdc6e('0x34')]),_0x2a1e58);if(_0x223367['query']['filter']){_0x56a082[_0xdc6e('0x3b')]=_[_0xdc6e('0x3d')](_0x56a082[_0xdc6e('0x3b')],{'$or':_[_0xdc6e('0x32')](_0x2a1e58,function(_0x1b8bf6){if(_0x1b8bf6[_0xdc6e('0x30')]!==_0xdc6e('0x3e')){var _0x1ec37e={};_0x1ec37e[_0x1b8bf6[_0xdc6e('0x2a')]]={'$like':'%'+_0x223367['query'][_0xdc6e('0x3f')]+'%'};return _0x1ec37e;}})});}_0x56a082=_[_0xdc6e('0x3d')]({},_0x56a082,_0x223367[_0xdc6e('0x40')]);var _0x4c4aef={'where':_0x56a082[_0xdc6e('0x3b')]};return db['ZohoConfiguration']['count'](_0x4c4aef)[_0xdc6e('0x26')](function(_0xb28c3){_0x26d39a[_0xdc6e('0x20')]=_0xb28c3;if(_0x223367['query'][_0xdc6e('0x41')]){_0x56a082['include']=[{'all':!![]}];}return db[_0xdc6e('0x2d')]['findAll'](_0x56a082);})[_0xdc6e('0x26')](function(_0x3555c0){_0x26d39a[_0xdc6e('0x42')]=_0x3555c0;return _0x26d39a;})[_0xdc6e('0x26')](respondWithFilteredResult(_0x7da70c,_0x56a082))[_0xdc6e('0x43')](handleError(_0x7da70c,null));};exports[_0xdc6e('0x44')]=function(_0x326ffd,_0x1c7987){var _0x7f57c1={'raw':![],'where':{'id':_0x326ffd['params']['id']}},_0x47b540={};_0x47b540[_0xdc6e('0x31')]=_['keys'](db['ZohoConfiguration'][_0xdc6e('0x2e')]);_0x47b540[_0xdc6e('0x33')]=_[_0xdc6e('0x45')](_0x326ffd[_0xdc6e('0x33')]);_0x47b540['filters']=_[_0xdc6e('0x35')](_0x47b540['model'],_0x47b540[_0xdc6e('0x33')]);_0x7f57c1[_0xdc6e('0x36')]=_[_0xdc6e('0x35')](_0x47b540['model'],qs[_0xdc6e('0x37')](_0x326ffd['query'][_0xdc6e('0x37')]));_0x7f57c1['attributes']=_0x7f57c1[_0xdc6e('0x36')][_0xdc6e('0x46')]?_0x7f57c1[_0xdc6e('0x36')]:_0x47b540[_0xdc6e('0x31')];if(_0x326ffd[_0xdc6e('0x33')][_0xdc6e('0x41')]){_0x7f57c1[_0xdc6e('0x47')]=[{'all':!![]}];}_0x7f57c1=_[_0xdc6e('0x3d')]({},_0x7f57c1,_0x326ffd['options']);return db[_0xdc6e('0x2d')]['find'](_0x7f57c1)['then'](handleEntityNotFound(_0x1c7987,null))[_0xdc6e('0x26')](respondWithResult(_0x1c7987,null))[_0xdc6e('0x43')](handleError(_0x1c7987,null));};exports['create']=function(_0x320145,_0x3312e3){return db[_0xdc6e('0x2d')]['create'](_0x320145[_0xdc6e('0x48')],{})[_0xdc6e('0x26')](respondWithResult(_0x3312e3,0xc9))[_0xdc6e('0x43')](handleError(_0x3312e3,null));};exports['update']=function(_0x249208,_0x38b6d0){if(_0x249208[_0xdc6e('0x48')]['id']){delete _0x249208[_0xdc6e('0x48')]['id'];}return db['ZohoConfiguration'][_0xdc6e('0x49')]({'where':{'id':_0x249208[_0xdc6e('0x4a')]['id']}})[_0xdc6e('0x26')](handleEntityNotFound(_0x38b6d0,null))['then'](saveUpdates(_0x249208[_0xdc6e('0x48')],null))[_0xdc6e('0x26')](respondWithResult(_0x38b6d0,null))[_0xdc6e('0x43')](handleError(_0x38b6d0,null));};exports[_0xdc6e('0x25')]=function(_0x17c878,_0x20ab01){return db['ZohoConfiguration']['find']({'where':{'id':_0x17c878[_0xdc6e('0x4a')]['id']}})[_0xdc6e('0x26')](handleEntityNotFound(_0x20ab01,null))[_0xdc6e('0x26')](removeEntity(_0x20ab01,null))['catch'](handleError(_0x20ab01,null));};exports[_0xdc6e('0x4b')]=function(_0x4621d1,_0x443a44,_0x38a421){var _0x41320c={};var _0xa6ad18={};var _0xbebf44;var _0x2ced7a;return db[_0xdc6e('0x2d')][_0xdc6e('0x4c')]({'where':{'id':_0x4621d1[_0xdc6e('0x4a')]['id']}})[_0xdc6e('0x26')](handleEntityNotFound(_0x443a44,null))[_0xdc6e('0x26')](function(_0x25cec0){if(_0x25cec0){_0xbebf44=_0x25cec0;_0xa6ad18[_0xdc6e('0x31')]=_[_0xdc6e('0x45')](db[_0xdc6e('0x4d')][_0xdc6e('0x2e')]);_0xa6ad18[_0xdc6e('0x33')]=_['keys'](_0x4621d1[_0xdc6e('0x33')]);_0xa6ad18[_0xdc6e('0x34')]=_['intersection'](_0xa6ad18[_0xdc6e('0x31')],_0xa6ad18[_0xdc6e('0x33')]);_0x41320c[_0xdc6e('0x36')]=_[_0xdc6e('0x35')](_0xa6ad18[_0xdc6e('0x31')],qs[_0xdc6e('0x37')](_0x4621d1[_0xdc6e('0x33')]['fields']));_0x41320c[_0xdc6e('0x36')]=_0x41320c[_0xdc6e('0x36')]['length']?_0x41320c['attributes']:_0xa6ad18['model'];_0x41320c['order']=qs[_0xdc6e('0x3a')](_0x4621d1['query'][_0xdc6e('0x3a')]);_0x41320c[_0xdc6e('0x3b')]=qs[_0xdc6e('0x34')](_[_0xdc6e('0x3c')](_0x4621d1['query'],_0xa6ad18[_0xdc6e('0x34')]));if(_0x4621d1[_0xdc6e('0x33')][_0xdc6e('0x3f')]){_0x41320c[_0xdc6e('0x3b')]=_[_0xdc6e('0x3d')](_0x41320c['where'],{'$or':_[_0xdc6e('0x32')](_0x41320c['attributes'],function(_0x4f743b){var _0x180c2f={};_0x180c2f[_0x4f743b]={'$like':'%'+_0x4621d1[_0xdc6e('0x33')][_0xdc6e('0x3f')]+'%'};return _0x180c2f;})});}_0x41320c=_[_0xdc6e('0x3d')]({},_0x41320c,_0x4621d1[_0xdc6e('0x40')]);return _0xbebf44['getFields'](_0x41320c);}})[_0xdc6e('0x26')](function(_0x137349){if(_0x137349){_0x2ced7a=_0x137349[_0xdc6e('0x46')];if(!_0x4621d1['query'][_0xdc6e('0x4e')](_0xdc6e('0x38'))){_0x41320c[_0xdc6e('0x1e')]=qs[_0xdc6e('0x1e')](_0x4621d1[_0xdc6e('0x33')]['limit']);_0x41320c['offset']=qs[_0xdc6e('0x1d')](_0x4621d1[_0xdc6e('0x33')]['offset']);}return _0xbebf44[_0xdc6e('0x4b')](_0x41320c);}})[_0xdc6e('0x26')](function(_0x2cd5b9){if(_0x2cd5b9){return _0x2cd5b9?{'count':_0x2ced7a,'rows':_0x2cd5b9}:null;}})['then'](respondWithResult(_0x443a44,null))[_0xdc6e('0x43')](handleError(_0x443a44,null));};exports[_0xdc6e('0x4f')]=function(_0x4f54c3,_0x1005c1,_0x46b959){var _0x29cdbb={};var _0x308c6e={};var _0x32b420;var _0x118e18;return db[_0xdc6e('0x2d')]['findOne']({'where':{'id':_0x4f54c3[_0xdc6e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1005c1,null))[_0xdc6e('0x26')](function(_0x194262){if(_0x194262){_0x32b420=_0x194262;_0x308c6e['model']=_[_0xdc6e('0x45')](db[_0xdc6e('0x4d')][_0xdc6e('0x2e')]);_0x308c6e['query']=_['keys'](_0x4f54c3[_0xdc6e('0x33')]);_0x308c6e[_0xdc6e('0x34')]=_[_0xdc6e('0x35')](_0x308c6e['model'],_0x308c6e[_0xdc6e('0x33')]);_0x29cdbb[_0xdc6e('0x36')]=_[_0xdc6e('0x35')](_0x308c6e['model'],qs[_0xdc6e('0x37')](_0x4f54c3[_0xdc6e('0x33')]['fields']));_0x29cdbb[_0xdc6e('0x36')]=_0x29cdbb['attributes'][_0xdc6e('0x46')]?_0x29cdbb['attributes']:_0x308c6e[_0xdc6e('0x31')];_0x29cdbb['order']=qs[_0xdc6e('0x3a')](_0x4f54c3[_0xdc6e('0x33')][_0xdc6e('0x3a')]);_0x29cdbb[_0xdc6e('0x3b')]=qs[_0xdc6e('0x34')](_[_0xdc6e('0x3c')](_0x4f54c3['query'],_0x308c6e[_0xdc6e('0x34')]));if(_0x4f54c3['query'][_0xdc6e('0x3f')]){_0x29cdbb[_0xdc6e('0x3b')]=_[_0xdc6e('0x3d')](_0x29cdbb[_0xdc6e('0x3b')],{'$or':_[_0xdc6e('0x32')](_0x29cdbb[_0xdc6e('0x36')],function(_0x2c8da3){var _0xc0ae6={};_0xc0ae6[_0x2c8da3]={'$like':'%'+_0x4f54c3[_0xdc6e('0x33')][_0xdc6e('0x3f')]+'%'};return _0xc0ae6;})});}_0x29cdbb=_[_0xdc6e('0x3d')]({},_0x29cdbb,_0x4f54c3['options']);return _0x32b420[_0xdc6e('0x4f')](_0x29cdbb);}})[_0xdc6e('0x26')](function(_0x1902a5){if(_0x1902a5){_0x118e18=_0x1902a5[_0xdc6e('0x46')];if(!_0x4f54c3[_0xdc6e('0x33')][_0xdc6e('0x4e')](_0xdc6e('0x38'))){_0x29cdbb[_0xdc6e('0x1e')]=qs[_0xdc6e('0x1e')](_0x4f54c3['query'][_0xdc6e('0x1e')]);_0x29cdbb[_0xdc6e('0x1d')]=qs[_0xdc6e('0x1d')](_0x4f54c3[_0xdc6e('0x33')][_0xdc6e('0x1d')]);}return _0x32b420[_0xdc6e('0x4f')](_0x29cdbb);}})[_0xdc6e('0x26')](function(_0x4b16da){if(_0x4b16da){return _0x4b16da?{'count':_0x118e18,'rows':_0x4b16da}:null;}})['then'](respondWithResult(_0x1005c1,null))[_0xdc6e('0x43')](handleError(_0x1005c1,null));};exports[_0xdc6e('0x50')]=function(_0x1a7c61,_0x5bf012,_0xe21b11){var _0x2bffd6={};var _0x54094c={};var _0x1da35e;var _0x31f8bc;return db[_0xdc6e('0x2d')][_0xdc6e('0x4c')]({'where':{'id':_0x1a7c61[_0xdc6e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bf012,null))['then'](function(_0x91e2bd){if(_0x91e2bd){_0x1da35e=_0x91e2bd;_0x54094c[_0xdc6e('0x31')]=_[_0xdc6e('0x45')](db[_0xdc6e('0x4d')]['rawAttributes']);_0x54094c[_0xdc6e('0x33')]=_[_0xdc6e('0x45')](_0x1a7c61[_0xdc6e('0x33')]);_0x54094c[_0xdc6e('0x34')]=_['intersection'](_0x54094c[_0xdc6e('0x31')],_0x54094c[_0xdc6e('0x33')]);_0x2bffd6[_0xdc6e('0x36')]=_[_0xdc6e('0x35')](_0x54094c[_0xdc6e('0x31')],qs['fields'](_0x1a7c61[_0xdc6e('0x33')][_0xdc6e('0x37')]));_0x2bffd6[_0xdc6e('0x36')]=_0x2bffd6[_0xdc6e('0x36')]['length']?_0x2bffd6[_0xdc6e('0x36')]:_0x54094c['model'];_0x2bffd6[_0xdc6e('0x39')]=qs[_0xdc6e('0x3a')](_0x1a7c61[_0xdc6e('0x33')][_0xdc6e('0x3a')]);_0x2bffd6[_0xdc6e('0x3b')]=qs['filters'](_[_0xdc6e('0x3c')](_0x1a7c61[_0xdc6e('0x33')],_0x54094c[_0xdc6e('0x34')]));if(_0x1a7c61['query'][_0xdc6e('0x3f')]){_0x2bffd6[_0xdc6e('0x3b')]=_[_0xdc6e('0x3d')](_0x2bffd6[_0xdc6e('0x3b')],{'$or':_[_0xdc6e('0x32')](_0x2bffd6[_0xdc6e('0x36')],function(_0x1b92e5){var _0x582428={};_0x582428[_0x1b92e5]={'$like':'%'+_0x1a7c61[_0xdc6e('0x33')]['filter']+'%'};return _0x582428;})});}_0x2bffd6=_[_0xdc6e('0x3d')]({},_0x2bffd6,_0x1a7c61[_0xdc6e('0x40')]);return _0x1da35e[_0xdc6e('0x50')](_0x2bffd6);}})[_0xdc6e('0x26')](function(_0x194b6d){if(_0x194b6d){_0x31f8bc=_0x194b6d[_0xdc6e('0x46')];if(!_0x1a7c61['query'][_0xdc6e('0x4e')](_0xdc6e('0x38'))){_0x2bffd6[_0xdc6e('0x1e')]=qs[_0xdc6e('0x1e')](_0x1a7c61[_0xdc6e('0x33')]['limit']);_0x2bffd6[_0xdc6e('0x1d')]=qs[_0xdc6e('0x1d')](_0x1a7c61[_0xdc6e('0x33')][_0xdc6e('0x1d')]);}return _0x1da35e[_0xdc6e('0x50')](_0x2bffd6);}})[_0xdc6e('0x26')](function(_0x432284){if(_0x432284){return _0x432284?{'count':_0x31f8bc,'rows':_0x432284}:null;}})[_0xdc6e('0x26')](respondWithResult(_0x5bf012,null))['catch'](handleError(_0x5bf012,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ab834a6..e63fb0f 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 _0xf4c6=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','define'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf4c6,0x116));var _0x6f4c=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0xf4c6[_0x50cd41];return _0x399475;};'use strict';var _=require(_0x6f4c('0x0'));var util=require(_0x6f4c('0x1'));var logger=require(_0x6f4c('0x2'))(_0x6f4c('0x3'));var moment=require(_0x6f4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x6f4c('0x5'));var fs=require('fs');var path=require(_0x6f4c('0x6'));var rimraf=require('rimraf');var config=require(_0x6f4c('0x7'));var attributes=require(_0x6f4c('0x8'));module['exports']=function(_0x524a22,_0x39b3e3){return _0x524a22[_0x6f4c('0x9')](_0x6f4c('0xa'),attributes,{'tableName':_0x6f4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf916=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf916,0xaa));var _0x6f91=function(_0x500747,_0x988dbb){_0x500747=_0x500747-0x0;var _0x351205=_0xf916[_0x500747];return _0x351205;};'use strict';var _=require(_0x6f91('0x0'));var util=require(_0x6f91('0x1'));var logger=require(_0x6f91('0x2'))(_0x6f91('0x3'));var moment=require(_0x6f91('0x4'));var BPromise=require(_0x6f91('0x5'));var rp=require(_0x6f91('0x6'));var fs=require('fs');var path=require(_0x6f91('0x7'));var rimraf=require(_0x6f91('0x8'));var config=require('../../config/environment');var attributes=require(_0x6f91('0x9'));module[_0x6f91('0xa')]=function(_0x898c34,_0x1714f1){return _0x898c34[_0x6f91('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x6f91('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 c6a9380..367a408 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 _0xfcee=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ZohoConfiguration,\x20%s,\x20%s','result','lodash'];(function(_0x8fb9f7,_0x217333){var _0x4e7c63=function(_0x5c2c7d){while(--_0x5c2c7d){_0x8fb9f7['push'](_0x8fb9f7['shift']());}};_0x4e7c63(++_0x217333);}(_0xfcee,0x8f));var _0xefce=function(_0x30fce7,_0x57a632){_0x30fce7=_0x30fce7-0x0;var _0x24d585=_0xfcee[_0x30fce7];return _0x24d585;};'use strict';var _=require(_0xefce('0x0'));var util=require(_0xefce('0x1'));var moment=require(_0xefce('0x2'));var BPromise=require(_0xefce('0x3'));var rs=require(_0xefce('0x4'));var fs=require('fs');var Redis=require(_0xefce('0x5'));var db=require(_0xefce('0x6'))['db'];var utils=require(_0xefce('0x7'));var logger=require(_0xefce('0x8'))(_0xefce('0x9'));var config=require(_0xefce('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xefce('0xb')][_0xefce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a245d,_0x3e73aa,_0x4d2816){return new BPromise(function(_0x439cc9,_0x46bab7){return client[_0xefce('0xd')](_0x1a245d,_0x4d2816)[_0xefce('0xe')](function(_0x217802){logger[_0xefce('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x3e73aa,'request\x20sent');logger[_0xefce('0x10')](_0xefce('0x11'),_0x3e73aa,_0xefce('0x12'),JSON[_0xefce('0x13')](_0x217802));if(_0x217802[_0xefce('0x14')]){if(_0x217802['error']['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3e73aa,_0x217802[_0xefce('0x14')]['message']);return _0x46bab7(_0x217802[_0xefce('0x14')][_0xefce('0x15')]);}logger[_0xefce('0x14')](_0xefce('0x16'),_0x3e73aa,_0x217802[_0xefce('0x14')][_0xefce('0x15')]);return _0x439cc9(_0x217802[_0xefce('0x14')][_0xefce('0x15')]);}else{logger['info'](_0xefce('0x16'),_0x3e73aa,_0xefce('0x12'));_0x439cc9(_0x217802[_0xefce('0x17')][_0xefce('0x15')]);}})['catch'](function(_0x5f213a){logger['error'](_0xefce('0x16'),_0x3e73aa,_0x5f213a);_0x46bab7(_0x5f213a);});});} \ No newline at end of file +var _0x00b9=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x41685a,_0x49cb32){var _0x68ea4a=function(_0xa1d393){while(--_0xa1d393){_0x41685a['push'](_0x41685a['shift']());}};_0x68ea4a(++_0x49cb32);}(_0x00b9,0x7f));var _0x900b=function(_0xd7a437,_0x3e5a39){_0xd7a437=_0xd7a437-0x0;var _0x1a7763=_0x00b9[_0xd7a437];return _0x1a7763;};'use strict';var _=require(_0x900b('0x0'));var util=require('util');var moment=require(_0x900b('0x1'));var BPromise=require(_0x900b('0x2'));var rs=require(_0x900b('0x3'));var fs=require('fs');var Redis=require(_0x900b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x900b('0x5'));var logger=require(_0x900b('0x6'))('rpc');var config=require(_0x900b('0x7'));var jayson=require(_0x900b('0x8'));var client=jayson[_0x900b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5037c0,_0x120e54,_0x33278c){return new BPromise(function(_0x2b4f18,_0xce3e5){return client[_0x900b('0xa')](_0x5037c0,_0x33278c)[_0x900b('0xb')](function(_0x5f3455){logger[_0x900b('0xc')](_0x900b('0xd'),_0x120e54,_0x900b('0xe'));logger[_0x900b('0xf')](_0x900b('0x10'),_0x120e54,_0x900b('0xe'),JSON[_0x900b('0x11')](_0x5f3455));if(_0x5f3455['error']){if(_0x5f3455[_0x900b('0x12')][_0x900b('0x13')]===0x1f4){logger[_0x900b('0x12')](_0x900b('0xd'),_0x120e54,_0x5f3455[_0x900b('0x12')][_0x900b('0x14')]);return _0xce3e5(_0x5f3455[_0x900b('0x12')][_0x900b('0x14')]);}logger['error'](_0x900b('0xd'),_0x120e54,_0x5f3455[_0x900b('0x12')][_0x900b('0x14')]);return _0x2b4f18(_0x5f3455[_0x900b('0x12')][_0x900b('0x14')]);}else{logger['info'](_0x900b('0xd'),_0x120e54,_0x900b('0xe'));_0x2b4f18(_0x5f3455[_0x900b('0x15')][_0x900b('0x14')]);}})[_0x900b('0x16')](function(_0x2529a2){logger[_0x900b('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x120e54,_0x2529a2);_0xce3e5(_0x2529a2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9e5f330..4d64af4 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 _0x0a9e=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x0a9e,0x180));var _0xe0a9=function(_0x18d086,_0x3dc86d){_0x18d086=_0x18d086-0x0;var _0x31b758=_0x0a9e[_0x18d086];return _0x31b758;};'use strict';var multer=require(_0xe0a9('0x0'));var util=require(_0xe0a9('0x1'));var path=require(_0xe0a9('0x2'));var timeout=require(_0xe0a9('0x3'));var express=require(_0xe0a9('0x4'));var router=express[_0xe0a9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe0a9('0x6'));var interaction=require(_0xe0a9('0x7'));var config=require(_0xe0a9('0x8'));var controller=require('./intZohoField.controller');router[_0xe0a9('0x9')]('/',auth[_0xe0a9('0xa')](),controller[_0xe0a9('0xb')]);router[_0xe0a9('0x9')](_0xe0a9('0xc'),auth['isAuthenticated'](),controller[_0xe0a9('0xd')]);router[_0xe0a9('0xe')]('/',auth[_0xe0a9('0xa')](),controller[_0xe0a9('0xf')]);router[_0xe0a9('0x10')](_0xe0a9('0xc'),auth[_0xe0a9('0xa')](),controller['update']);router[_0xe0a9('0x11')](_0xe0a9('0xc'),auth[_0xe0a9('0xa')](),controller[_0xe0a9('0x12')]);module[_0xe0a9('0x13')]=router; \ No newline at end of file +var _0x9af6=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','util','express','Router','../../components/auth/service'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x9af6,0x106));var _0x69af=function(_0x2f5de9,_0x2485be){_0x2f5de9=_0x2f5de9-0x0;var _0x890a7f=_0x9af6[_0x2f5de9];return _0x890a7f;};'use strict';var multer=require('multer');var util=require(_0x69af('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x69af('0x1'));var router=express[_0x69af('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x69af('0x3'));var interaction=require(_0x69af('0x4'));var config=require(_0x69af('0x5'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x69af('0x6')](),controller['index']);router[_0x69af('0x7')](_0x69af('0x8'),auth['isAuthenticated'](),controller[_0x69af('0x9')]);router[_0x69af('0xa')]('/',auth[_0x69af('0x6')](),controller[_0x69af('0xb')]);router[_0x69af('0xc')](_0x69af('0x8'),auth['isAuthenticated'](),controller[_0x69af('0xd')]);router['delete'](_0x69af('0x8'),auth[_0x69af('0x6')](),controller['destroy']);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 1e03b12..1cbaa7c 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 _0x2f56=['STRING','BOOLEAN','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x1dddcb,_0x40b85d){var _0x313a08=function(_0x34fcfb){while(--_0x34fcfb){_0x1dddcb['push'](_0x1dddcb['shift']());}};_0x313a08(++_0x40b85d);}(_0x2f56,0x1b2));var _0x62f5=function(_0x579cb8,_0x33e532){_0x579cb8=_0x579cb8-0x0;var _0x526878=_0x2f56[_0x579cb8];return _0x526878;};'use strict';var Sequelize=require('sequelize');module[_0x62f5('0x0')]={'type':{'type':Sequelize[_0x62f5('0x1')]('string',_0x62f5('0x2'),_0x62f5('0x3'),_0x62f5('0x4'),'picklist'),'defaultValue':_0x62f5('0x5')},'content':{'type':Sequelize[_0x62f5('0x6')]},'key':{'type':Sequelize[_0x62f5('0x6')]},'keyType':{'type':Sequelize[_0x62f5('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x62f5('0x6')]},'idField':{'type':Sequelize[_0x62f5('0x6')]},'nameField':{'type':Sequelize[_0x62f5('0x6')]},'customField':{'type':Sequelize[_0x62f5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x62f5('0x6')]}}; \ No newline at end of file +var _0xf26f=['customVariable','keyValue','STRING','ENUM','exports','string'];(function(_0x399bfc,_0x36d4b0){var _0x36846d=function(_0x1465bc){while(--_0x1465bc){_0x399bfc['push'](_0x399bfc['shift']());}};_0x36846d(++_0x36d4b0);}(_0xf26f,0x190));var _0xff26=function(_0x60cfcf,_0x2d5bdd){_0x60cfcf=_0x60cfcf-0x0;var _0x5bdda7=_0xf26f[_0x60cfcf];return _0x5bdda7;};'use strict';var Sequelize=require('sequelize');module[_0xff26('0x0')]={'type':{'type':Sequelize['ENUM'](_0xff26('0x1'),'variable',_0xff26('0x2'),_0xff26('0x3'),'picklist'),'defaultValue':_0xff26('0x1')},'content':{'type':Sequelize[_0xff26('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xff26('0x5')](_0xff26('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xff26('0x4')]},'idField':{'type':Sequelize[_0xff26('0x4')]},'nameField':{'type':Sequelize[_0xff26('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xff26('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index be6b635..bd57fc1 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 _0x1720=['show','params','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x1720,0x1b6));var _0x0172=function(_0x1892e7,_0x5576ae){_0x1892e7=_0x1892e7-0x0;var _0x4b5481=_0x1720[_0x1892e7];return _0x4b5481;};'use strict';var emlformat=require(_0x0172('0x0'));var rimraf=require(_0x0172('0x1'));var zipdir=require(_0x0172('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0172('0x3'));var moment=require(_0x0172('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0172('0x5'));var util=require(_0x0172('0x6'));var path=require(_0x0172('0x7'));var sox=require(_0x0172('0x8'));var csv=require('to-csv');var ejs=require(_0x0172('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0172('0xa'));var squel=require(_0x0172('0xb'));var crypto=require(_0x0172('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0172('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0172('0xe'));var Redis=require(_0x0172('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0172('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0172('0x11'))(_0x0172('0x12'));var utils=require(_0x0172('0x13'));var config=require(_0x0172('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0172('0x15'))['db'];function respondWithStatusCode(_0x47d894,_0xcba5f2){_0xcba5f2=_0xcba5f2||0xcc;return function(_0x32d5e9){if(_0x32d5e9){return _0x47d894['sendStatus'](_0xcba5f2);}return _0x47d894['status'](_0xcba5f2)[_0x0172('0x16')]();};}function respondWithResult(_0x1ecd6c,_0x4f3885){_0x4f3885=_0x4f3885||0xc8;return function(_0x5bfcb9){if(_0x5bfcb9){return _0x1ecd6c[_0x0172('0x17')](_0x4f3885)[_0x0172('0x18')](_0x5bfcb9);}};}function respondWithFilteredResult(_0xc55673,_0x2bd4cd){return function(_0x36b4a7){if(_0x36b4a7){var _0x3a7720=typeof _0x2bd4cd[_0x0172('0x19')]===_0x0172('0x1a')&&typeof _0x2bd4cd['limit']===_0x0172('0x1a');var _0x351d17=_0x36b4a7['count'];var _0x122c75=_0x3a7720?0x0:_0x2bd4cd[_0x0172('0x19')];var _0x16c151=_0x3a7720?_0x36b4a7['count']:_0x2bd4cd[_0x0172('0x19')]+_0x2bd4cd[_0x0172('0x1b')];var _0x19fb82;if(_0x16c151>=_0x351d17){_0x16c151=_0x351d17;_0x19fb82=0xc8;}else{_0x19fb82=0xce;}_0xc55673[_0x0172('0x17')](_0x19fb82);return _0xc55673['set']('Content-Range',_0x122c75+'-'+_0x16c151+'/'+_0x351d17)[_0x0172('0x18')](_0x36b4a7);}return null;};}function patchUpdates(_0x4ed00c){return function(_0x26b90f){try{jsonpatch[_0x0172('0x1c')](_0x26b90f,_0x4ed00c,!![]);}catch(_0x381726){return BPromise[_0x0172('0x1d')](_0x381726);}return _0x26b90f[_0x0172('0x1e')]();};}function saveUpdates(_0x50fb08,_0x341378){return function(_0x4a199f){if(_0x4a199f){return _0x4a199f[_0x0172('0x1f')](_0x50fb08)['then'](function(_0x3ee892){return _0x3ee892;});}return null;};}function removeEntity(_0x5dfb00,_0x4072ea){return function(_0x5c61b8){if(_0x5c61b8){return _0x5c61b8[_0x0172('0x20')]()[_0x0172('0x21')](function(){_0x5dfb00['status'](0xcc)[_0x0172('0x16')]();});}};}function handleEntityNotFound(_0x5cfcb2,_0x1dacb2){return function(_0x3b1a2e){if(!_0x3b1a2e){_0x5cfcb2['sendStatus'](0x194);}return _0x3b1a2e;};}function handleError(_0x1ed69e,_0x21c377){_0x21c377=_0x21c377||0x1f4;return function(_0x443a5f){logger[_0x0172('0x22')](_0x443a5f[_0x0172('0x23')]);if(_0x443a5f[_0x0172('0x24')]){delete _0x443a5f[_0x0172('0x24')];}_0x1ed69e[_0x0172('0x17')](_0x21c377)['send'](_0x443a5f);};}exports[_0x0172('0x25')]=function(_0x12e1ae,_0x174b4f){var _0x34e559={},_0x3482ab={},_0x242ab6={'count':0x0,'rows':[]};var _0x8f1e9c=_[_0x0172('0x26')](db[_0x0172('0x27')][_0x0172('0x28')],function(_0x39a5e2){return{'name':_0x39a5e2[_0x0172('0x29')],'type':_0x39a5e2[_0x0172('0x2a')][_0x0172('0x2b')]};});_0x3482ab[_0x0172('0x2c')]=_['map'](_0x8f1e9c,_0x0172('0x24'));_0x3482ab[_0x0172('0x2d')]=_[_0x0172('0x2e')](_0x12e1ae[_0x0172('0x2d')]);_0x3482ab['filters']=_[_0x0172('0x2f')](_0x3482ab[_0x0172('0x2c')],_0x3482ab[_0x0172('0x2d')]);_0x34e559[_0x0172('0x30')]=_['intersection'](_0x3482ab[_0x0172('0x2c')],qs[_0x0172('0x31')](_0x12e1ae[_0x0172('0x2d')][_0x0172('0x31')]));_0x34e559[_0x0172('0x30')]=_0x34e559[_0x0172('0x30')][_0x0172('0x32')]?_0x34e559[_0x0172('0x30')]:_0x3482ab[_0x0172('0x2c')];if(!_0x12e1ae[_0x0172('0x2d')][_0x0172('0x33')](_0x0172('0x34'))){_0x34e559[_0x0172('0x1b')]=qs[_0x0172('0x1b')](_0x12e1ae['query'][_0x0172('0x1b')]);_0x34e559[_0x0172('0x19')]=qs[_0x0172('0x19')](_0x12e1ae[_0x0172('0x2d')]['offset']);}_0x34e559[_0x0172('0x35')]=qs[_0x0172('0x36')](_0x12e1ae[_0x0172('0x2d')][_0x0172('0x36')]);_0x34e559[_0x0172('0x37')]=qs[_0x0172('0x38')](_[_0x0172('0x39')](_0x12e1ae[_0x0172('0x2d')],_0x3482ab[_0x0172('0x38')]),_0x8f1e9c);if(_0x12e1ae[_0x0172('0x2d')][_0x0172('0x3a')]){_0x34e559[_0x0172('0x37')]=_[_0x0172('0x3b')](_0x34e559['where'],{'$or':_['map'](_0x8f1e9c,function(_0x5326d4){if(_0x5326d4['type']!==_0x0172('0x3c')){var _0x413508={};_0x413508[_0x5326d4[_0x0172('0x24')]]={'$like':'%'+_0x12e1ae['query'][_0x0172('0x3a')]+'%'};return _0x413508;}})});}_0x34e559=_[_0x0172('0x3b')]({},_0x34e559,_0x12e1ae[_0x0172('0x3d')]);var _0x3f15e6={'where':_0x34e559[_0x0172('0x37')]};return db['ZohoField'][_0x0172('0x3e')](_0x3f15e6)[_0x0172('0x21')](function(_0x3540ea){_0x242ab6[_0x0172('0x3e')]=_0x3540ea;if(_0x12e1ae[_0x0172('0x2d')][_0x0172('0x3f')]){_0x34e559['include']=[{'all':!![]}];}return db[_0x0172('0x27')]['findAll'](_0x34e559);})['then'](function(_0x3775d5){_0x242ab6[_0x0172('0x40')]=_0x3775d5;return _0x242ab6;})['then'](respondWithFilteredResult(_0x174b4f,_0x34e559))[_0x0172('0x41')](handleError(_0x174b4f,null));};exports[_0x0172('0x42')]=function(_0x4523dd,_0x16e9b0){var _0x3d4c4c={'raw':!![],'where':{'id':_0x4523dd[_0x0172('0x43')]['id']}},_0x4ae060={};_0x4ae060[_0x0172('0x2c')]=_[_0x0172('0x2e')](db[_0x0172('0x27')][_0x0172('0x28')]);_0x4ae060[_0x0172('0x2d')]=_['keys'](_0x4523dd[_0x0172('0x2d')]);_0x4ae060[_0x0172('0x38')]=_[_0x0172('0x2f')](_0x4ae060[_0x0172('0x2c')],_0x4ae060[_0x0172('0x2d')]);_0x3d4c4c[_0x0172('0x30')]=_[_0x0172('0x2f')](_0x4ae060[_0x0172('0x2c')],qs[_0x0172('0x31')](_0x4523dd[_0x0172('0x2d')][_0x0172('0x31')]));_0x3d4c4c[_0x0172('0x30')]=_0x3d4c4c[_0x0172('0x30')][_0x0172('0x32')]?_0x3d4c4c[_0x0172('0x30')]:_0x4ae060[_0x0172('0x2c')];if(_0x4523dd[_0x0172('0x2d')][_0x0172('0x3f')]){_0x3d4c4c[_0x0172('0x44')]=[{'all':!![]}];}_0x3d4c4c=_[_0x0172('0x3b')]({},_0x3d4c4c,_0x4523dd['options']);return db[_0x0172('0x27')]['find'](_0x3d4c4c)[_0x0172('0x21')](handleEntityNotFound(_0x16e9b0,null))[_0x0172('0x21')](respondWithResult(_0x16e9b0,null))[_0x0172('0x41')](handleError(_0x16e9b0,null));};exports['create']=function(_0x270e47,_0x57b556){return db['ZohoField'][_0x0172('0x45')](_0x270e47[_0x0172('0x46')],{})[_0x0172('0x21')](respondWithResult(_0x57b556,0xc9))[_0x0172('0x41')](handleError(_0x57b556,null));};exports[_0x0172('0x1f')]=function(_0x455740,_0x64c93){if(_0x455740[_0x0172('0x46')]['id']){delete _0x455740['body']['id'];}return db[_0x0172('0x27')][_0x0172('0x47')]({'where':{'id':_0x455740[_0x0172('0x43')]['id']}})['then'](handleEntityNotFound(_0x64c93,null))['then'](saveUpdates(_0x455740[_0x0172('0x46')],null))[_0x0172('0x21')](respondWithResult(_0x64c93,null))[_0x0172('0x41')](handleError(_0x64c93,null));};exports[_0x0172('0x20')]=function(_0x20eac3,_0x475263){return db[_0x0172('0x27')][_0x0172('0x47')]({'where':{'id':_0x20eac3[_0x0172('0x43')]['id']}})[_0x0172('0x21')](handleEntityNotFound(_0x475263,null))[_0x0172('0x21')](removeEntity(_0x475263,null))[_0x0172('0x41')](handleError(_0x475263,null));}; \ No newline at end of file +var _0x1d0f=['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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','ZohoField','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','create','body','update','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x19159d,_0x3d05c8){var _0x35884a=function(_0xe419f8){while(--_0xe419f8){_0x19159d['push'](_0x19159d['shift']());}};_0x35884a(++_0x3d05c8);}(_0x1d0f,0xde));var _0xf1d0=function(_0x97bae,_0x5a73fc){_0x97bae=_0x97bae-0x0;var _0x34ca7=_0x1d0f[_0x97bae];return _0x34ca7;};'use strict';var emlformat=require(_0xf1d0('0x0'));var rimraf=require(_0xf1d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1d0('0x2'));var rp=require(_0xf1d0('0x3'));var moment=require(_0xf1d0('0x4'));var BPromise=require(_0xf1d0('0x5'));var Mustache=require('mustache');var util=require(_0xf1d0('0x6'));var path=require(_0xf1d0('0x7'));var sox=require(_0xf1d0('0x8'));var csv=require('to-csv');var ejs=require(_0xf1d0('0x9'));var fs=require('fs');var fs_extra=require(_0xf1d0('0xa'));var _=require(_0xf1d0('0xb'));var squel=require(_0xf1d0('0xc'));var crypto=require(_0xf1d0('0xd'));var jsforce=require(_0xf1d0('0xe'));var deskjs=require(_0xf1d0('0xf'));var toCsv=require(_0xf1d0('0x10'));var querystring=require(_0xf1d0('0x11'));var Papa=require(_0xf1d0('0x12'));var Redis=require(_0xf1d0('0x13'));var authService=require(_0xf1d0('0x14'));var qs=require(_0xf1d0('0x15'));var as=require(_0xf1d0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1d0('0x17'))(_0xf1d0('0x18'));var utils=require(_0xf1d0('0x19'));var config=require(_0xf1d0('0x1a'));var licenseUtil=require(_0xf1d0('0x1b'));var db=require(_0xf1d0('0x1c'))['db'];function respondWithStatusCode(_0x52895d,_0x3b83d1){_0x3b83d1=_0x3b83d1||0xcc;return function(_0x56a52d){if(_0x56a52d){return _0x52895d['sendStatus'](_0x3b83d1);}return _0x52895d[_0xf1d0('0x1d')](_0x3b83d1)[_0xf1d0('0x1e')]();};}function respondWithResult(_0x11bff8,_0x2af5a7){_0x2af5a7=_0x2af5a7||0xc8;return function(_0x175e31){if(_0x175e31){return _0x11bff8[_0xf1d0('0x1d')](_0x2af5a7)[_0xf1d0('0x1f')](_0x175e31);}};}function respondWithFilteredResult(_0x9b44b5,_0x457a31){return function(_0x11b57b){if(_0x11b57b){var _0x2dc10d=typeof _0x457a31[_0xf1d0('0x20')]==='undefined'&&typeof _0x457a31[_0xf1d0('0x21')]===_0xf1d0('0x22');var _0x3ab0bf=_0x11b57b['count'];var _0x442641=_0x2dc10d?0x0:_0x457a31[_0xf1d0('0x20')];var _0x4f66f7=_0x2dc10d?_0x11b57b[_0xf1d0('0x23')]:_0x457a31[_0xf1d0('0x20')]+_0x457a31[_0xf1d0('0x21')];var _0x331f32;if(_0x4f66f7>=_0x3ab0bf){_0x4f66f7=_0x3ab0bf;_0x331f32=0xc8;}else{_0x331f32=0xce;}_0x9b44b5['status'](_0x331f32);return _0x9b44b5[_0xf1d0('0x24')](_0xf1d0('0x25'),_0x442641+'-'+_0x4f66f7+'/'+_0x3ab0bf)[_0xf1d0('0x1f')](_0x11b57b);}return null;};}function patchUpdates(_0x3f6dd5){return function(_0x46276c){try{jsonpatch['apply'](_0x46276c,_0x3f6dd5,!![]);}catch(_0x3021f4){return BPromise[_0xf1d0('0x26')](_0x3021f4);}return _0x46276c[_0xf1d0('0x27')]();};}function saveUpdates(_0x130d7c,_0x4c0656){return function(_0x176f79){if(_0x176f79){return _0x176f79['update'](_0x130d7c)[_0xf1d0('0x28')](function(_0x287291){return _0x287291;});}return null;};}function removeEntity(_0x2c4ca9,_0xdcfa36){return function(_0x134ba6){if(_0x134ba6){return _0x134ba6[_0xf1d0('0x29')]()['then'](function(){_0x2c4ca9['status'](0xcc)[_0xf1d0('0x1e')]();});}};}function handleEntityNotFound(_0x3b622c,_0x942f4f){return function(_0x4a300a){if(!_0x4a300a){_0x3b622c['sendStatus'](0x194);}return _0x4a300a;};}function handleError(_0xc7133b,_0x363ad9){_0x363ad9=_0x363ad9||0x1f4;return function(_0x52cf09){logger[_0xf1d0('0x2a')](_0x52cf09[_0xf1d0('0x2b')]);if(_0x52cf09[_0xf1d0('0x2c')]){delete _0x52cf09[_0xf1d0('0x2c')];}_0xc7133b['status'](_0x363ad9)[_0xf1d0('0x2d')](_0x52cf09);};}exports['index']=function(_0x20859b,_0x5ba7c2){var _0xa39930={},_0x2ef0c3={},_0xd0ee6f={'count':0x0,'rows':[]};var _0x2329cc=_['map'](db[_0xf1d0('0x2e')][_0xf1d0('0x2f')],function(_0x25ecb1){return{'name':_0x25ecb1['fieldName'],'type':_0x25ecb1[_0xf1d0('0x30')][_0xf1d0('0x31')]};});_0x2ef0c3[_0xf1d0('0x32')]=_[_0xf1d0('0x33')](_0x2329cc,_0xf1d0('0x2c'));_0x2ef0c3[_0xf1d0('0x34')]=_['keys'](_0x20859b[_0xf1d0('0x34')]);_0x2ef0c3[_0xf1d0('0x35')]=_[_0xf1d0('0x36')](_0x2ef0c3[_0xf1d0('0x32')],_0x2ef0c3['query']);_0xa39930[_0xf1d0('0x37')]=_[_0xf1d0('0x36')](_0x2ef0c3[_0xf1d0('0x32')],qs[_0xf1d0('0x38')](_0x20859b[_0xf1d0('0x34')][_0xf1d0('0x38')]));_0xa39930['attributes']=_0xa39930[_0xf1d0('0x37')]['length']?_0xa39930[_0xf1d0('0x37')]:_0x2ef0c3[_0xf1d0('0x32')];if(!_0x20859b[_0xf1d0('0x34')][_0xf1d0('0x39')](_0xf1d0('0x3a'))){_0xa39930[_0xf1d0('0x21')]=qs[_0xf1d0('0x21')](_0x20859b[_0xf1d0('0x34')]['limit']);_0xa39930[_0xf1d0('0x20')]=qs['offset'](_0x20859b['query']['offset']);}_0xa39930['order']=qs[_0xf1d0('0x3b')](_0x20859b[_0xf1d0('0x34')][_0xf1d0('0x3b')]);_0xa39930['where']=qs['filters'](_['pick'](_0x20859b[_0xf1d0('0x34')],_0x2ef0c3['filters']),_0x2329cc);if(_0x20859b[_0xf1d0('0x34')][_0xf1d0('0x3c')]){_0xa39930[_0xf1d0('0x3d')]=_[_0xf1d0('0x3e')](_0xa39930[_0xf1d0('0x3d')],{'$or':_['map'](_0x2329cc,function(_0x59987c){if(_0x59987c[_0xf1d0('0x30')]!==_0xf1d0('0x3f')){var _0x578f83={};_0x578f83[_0x59987c[_0xf1d0('0x2c')]]={'$like':'%'+_0x20859b[_0xf1d0('0x34')][_0xf1d0('0x3c')]+'%'};return _0x578f83;}})});}_0xa39930=_['merge']({},_0xa39930,_0x20859b[_0xf1d0('0x40')]);var _0x5119d8={'where':_0xa39930[_0xf1d0('0x3d')]};return db[_0xf1d0('0x2e')][_0xf1d0('0x23')](_0x5119d8)[_0xf1d0('0x28')](function(_0x4aae1a){_0xd0ee6f['count']=_0x4aae1a;if(_0x20859b[_0xf1d0('0x34')][_0xf1d0('0x41')]){_0xa39930[_0xf1d0('0x42')]=[{'all':!![]}];}return db[_0xf1d0('0x2e')][_0xf1d0('0x43')](_0xa39930);})['then'](function(_0x4d665e){_0xd0ee6f['rows']=_0x4d665e;return _0xd0ee6f;})['then'](respondWithFilteredResult(_0x5ba7c2,_0xa39930))[_0xf1d0('0x44')](handleError(_0x5ba7c2,null));};exports[_0xf1d0('0x45')]=function(_0x461b73,_0x4cabc3){var _0x17bff4={'raw':!![],'where':{'id':_0x461b73['params']['id']}},_0x5ddb81={};_0x5ddb81[_0xf1d0('0x32')]=_['keys'](db[_0xf1d0('0x2e')]['rawAttributes']);_0x5ddb81[_0xf1d0('0x34')]=_['keys'](_0x461b73['query']);_0x5ddb81[_0xf1d0('0x35')]=_['intersection'](_0x5ddb81[_0xf1d0('0x32')],_0x5ddb81[_0xf1d0('0x34')]);_0x17bff4[_0xf1d0('0x37')]=_[_0xf1d0('0x36')](_0x5ddb81[_0xf1d0('0x32')],qs['fields'](_0x461b73[_0xf1d0('0x34')]['fields']));_0x17bff4[_0xf1d0('0x37')]=_0x17bff4[_0xf1d0('0x37')][_0xf1d0('0x46')]?_0x17bff4[_0xf1d0('0x37')]:_0x5ddb81['model'];if(_0x461b73[_0xf1d0('0x34')]['includeAll']){_0x17bff4[_0xf1d0('0x42')]=[{'all':!![]}];}_0x17bff4=_[_0xf1d0('0x3e')]({},_0x17bff4,_0x461b73[_0xf1d0('0x40')]);return db['ZohoField']['find'](_0x17bff4)[_0xf1d0('0x28')](handleEntityNotFound(_0x4cabc3,null))[_0xf1d0('0x28')](respondWithResult(_0x4cabc3,null))[_0xf1d0('0x44')](handleError(_0x4cabc3,null));};exports['create']=function(_0x3fb947,_0x5e17a7){return db[_0xf1d0('0x2e')][_0xf1d0('0x47')](_0x3fb947[_0xf1d0('0x48')],{})[_0xf1d0('0x28')](respondWithResult(_0x5e17a7,0xc9))[_0xf1d0('0x44')](handleError(_0x5e17a7,null));};exports[_0xf1d0('0x49')]=function(_0x3adfc5,_0x5d0e66){if(_0x3adfc5['body']['id']){delete _0x3adfc5[_0xf1d0('0x48')]['id'];}return db['ZohoField'][_0xf1d0('0x4a')]({'where':{'id':_0x3adfc5['params']['id']}})['then'](handleEntityNotFound(_0x5d0e66,null))[_0xf1d0('0x28')](saveUpdates(_0x3adfc5[_0xf1d0('0x48')],null))[_0xf1d0('0x28')](respondWithResult(_0x5d0e66,null))['catch'](handleError(_0x5d0e66,null));};exports[_0xf1d0('0x29')]=function(_0x5bd2d2,_0x31d2da){return db[_0xf1d0('0x2e')][_0xf1d0('0x4a')]({'where':{'id':_0x5bd2d2[_0xf1d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31d2da,null))['then'](removeEntity(_0x31d2da,null))[_0xf1d0('0x44')](handleError(_0x31d2da,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 688a331..328c171 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 _0x0a6b=['int_zoho_fields','zoho_unique_index','lodash','moment','request-promise','path','rimraf','./intZohoField.attributes','ZohoField'];(function(_0x35aa7a,_0x103924){var _0x5ebb7f=function(_0x540f63){while(--_0x540f63){_0x35aa7a['push'](_0x35aa7a['shift']());}};_0x5ebb7f(++_0x103924);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x547fe3,_0x5bbc1a){_0x547fe3=_0x547fe3-0x0;var _0x5391b7=_0x0a6b[_0x547fe3];return _0x5391b7;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'paranoid':![],'indexes':[{'name':_0xb0a6('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f0e=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x2dd675,_0x4470a4){var _0xcf78eb=function(_0x2be5af){while(--_0x2be5af){_0x2dd675['push'](_0x2dd675['shift']());}};_0xcf78eb(++_0x4470a4);}(_0x9f0e,0x116));var _0xe9f0=function(_0x577c82,_0x7681c7){_0x577c82=_0x577c82-0x0;var _0x5c8711=_0x9f0e[_0x577c82];return _0x5c8711;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xe9f0('0xd'),_0xe9f0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 44e156a..6e4b7f0 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 _0xf758=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','catch'];(function(_0x431344,_0x1c99df){var _0x2a7463=function(_0x42c172){while(--_0x42c172){_0x431344['push'](_0x431344['shift']());}};_0x2a7463(++_0x1c99df);}(_0xf758,0x1b9));var _0x8f75=function(_0x151b2a,_0x2b88b8){_0x151b2a=_0x151b2a-0x0;var _0x5c2c04=_0xf758[_0x151b2a];return _0x5c2c04;};'use strict';var _=require(_0x8f75('0x0'));var util=require('util');var moment=require(_0x8f75('0x1'));var BPromise=require(_0x8f75('0x2'));var rs=require(_0x8f75('0x3'));var fs=require('fs');var Redis=require(_0x8f75('0x4'));var db=require(_0x8f75('0x5'))['db'];var utils=require(_0x8f75('0x6'));var logger=require(_0x8f75('0x7'))(_0x8f75('0x8'));var config=require(_0x8f75('0x9'));var jayson=require(_0x8f75('0xa'));var client=jayson[_0x8f75('0xb')][_0x8f75('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53684c,_0x5521ae,_0x4d5bf6){return new BPromise(function(_0x3d9cfe,_0x2f126a){return client['request'](_0x53684c,_0x4d5bf6)['then'](function(_0x284fd4){logger[_0x8f75('0xd')]('ZohoField,\x20%s,\x20%s',_0x5521ae,_0x8f75('0xe'));logger['debug'](_0x8f75('0xf'),_0x5521ae,'request\x20sent',JSON[_0x8f75('0x10')](_0x284fd4));if(_0x284fd4[_0x8f75('0x11')]){if(_0x284fd4[_0x8f75('0x11')]['code']===0x1f4){logger['error'](_0x8f75('0x12'),_0x5521ae,_0x284fd4[_0x8f75('0x11')][_0x8f75('0x13')]);return _0x2f126a(_0x284fd4['error'][_0x8f75('0x13')]);}logger[_0x8f75('0x11')](_0x8f75('0x12'),_0x5521ae,_0x284fd4[_0x8f75('0x11')]['message']);return _0x3d9cfe(_0x284fd4[_0x8f75('0x11')]['message']);}else{logger[_0x8f75('0xd')]('ZohoField,\x20%s,\x20%s',_0x5521ae,'request\x20sent');_0x3d9cfe(_0x284fd4['result'][_0x8f75('0x13')]);}})[_0x8f75('0x14')](function(_0x57ac48){logger['error']('ZohoField,\x20%s,\x20%s',_0x5521ae,_0x57ac48);_0x2f126a(_0x57ac48);});});} \ No newline at end of file +var _0x2e9b=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3db093,_0x485dce){var _0x2f2577=function(_0x4c3195){while(--_0x4c3195){_0x3db093['push'](_0x3db093['shift']());}};_0x2f2577(++_0x485dce);}(_0x2e9b,0x9c));var _0xb2e9=function(_0x42e131,_0x3564ae){_0x42e131=_0x42e131-0x0;var _0x42beda=_0x2e9b[_0x42e131];return _0x42beda;};'use strict';var _=require(_0xb2e9('0x0'));var util=require(_0xb2e9('0x1'));var moment=require('moment');var BPromise=require(_0xb2e9('0x2'));var rs=require(_0xb2e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2e9('0x4'))['db'];var utils=require(_0xb2e9('0x5'));var logger=require(_0xb2e9('0x6'))(_0xb2e9('0x7'));var config=require(_0xb2e9('0x8'));var jayson=require(_0xb2e9('0x9'));var client=jayson['client'][_0xb2e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58d923,_0x444e3b,_0xa7e993){return new BPromise(function(_0x5ab945,_0x3bbce0){return client[_0xb2e9('0xb')](_0x58d923,_0xa7e993)[_0xb2e9('0xc')](function(_0x175df6){logger[_0xb2e9('0xd')](_0xb2e9('0xe'),_0x444e3b,_0xb2e9('0xf'));logger[_0xb2e9('0x10')](_0xb2e9('0x11'),_0x444e3b,_0xb2e9('0xf'),JSON['stringify'](_0x175df6));if(_0x175df6['error']){if(_0x175df6[_0xb2e9('0x12')]['code']===0x1f4){logger[_0xb2e9('0x12')](_0xb2e9('0xe'),_0x444e3b,_0x175df6['error'][_0xb2e9('0x13')]);return _0x3bbce0(_0x175df6['error']['message']);}logger[_0xb2e9('0x12')](_0xb2e9('0xe'),_0x444e3b,_0x175df6[_0xb2e9('0x12')][_0xb2e9('0x13')]);return _0x5ab945(_0x175df6[_0xb2e9('0x12')][_0xb2e9('0x13')]);}else{logger[_0xb2e9('0xd')](_0xb2e9('0xe'),_0x444e3b,_0xb2e9('0xf'));_0x5ab945(_0x175df6[_0xb2e9('0x14')][_0xb2e9('0x13')]);}})['catch'](function(_0x2973be){logger[_0xb2e9('0x12')](_0xb2e9('0xe'),_0x444e3b,_0x2973be);_0x3bbce0(_0x2973be);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 084b173..628155f 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x20f022,_0x1717ea){var _0x2b837a=function(_0x45511f){while(--_0x45511f){_0x20f022['push'](_0x20f022['shift']());}};_0x2b837a(++_0x1717ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x468ea1,_0x3e1360){var _0x1801da=function(_0x9c0bae){while(--_0x9c0bae){_0x468ea1['push'](_0x468ea1['shift']());}};_0x1801da(++_0x3e1360);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ca22be9..7378b97 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 _0x0e4a=['exports','unique_name_and_version','STRING','INTEGER','BOOLEAN','state','sequelize'];(function(_0x1fbac1,_0x4400fd){var _0x6c700=function(_0x1cdb13){while(--_0x1cdb13){_0x1fbac1['push'](_0x1fbac1['shift']());}};_0x6c700(++_0x4400fd);}(_0x0e4a,0xd8));var _0xa0e4=function(_0x5ac43d,_0x104351){_0x5ac43d=_0x5ac43d-0x0;var _0x28acc4=_0x0e4a[_0x5ac43d];return _0x28acc4;};'use strict';var Sequelize=require(_0xa0e4('0x0'));module[_0xa0e4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa0e4('0x2')},'main':{'type':Sequelize[_0xa0e4('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xa0e4('0x3')]},'path':{'type':Sequelize[_0xa0e4('0x3')]},'type':{'type':Sequelize[_0xa0e4('0x3')]},'size':{'type':Sequelize[_0xa0e4('0x4')]},'active':{'type':Sequelize[_0xa0e4('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xa0e4('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xa0e4('0x6')},'description':{'type':Sequelize[_0xa0e4('0x3')]},'title':{'type':Sequelize[_0xa0e4('0x3')]},'remoteUri':{'type':Sequelize[_0xa0e4('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x3571=['STRING','unique_name_and_version','state'];(function(_0x56a60a,_0xf4c330){var _0x5c4057=function(_0x5ed7f8){while(--_0x5ed7f8){_0x56a60a['push'](_0x56a60a['shift']());}};_0x5c4057(++_0xf4c330);}(_0x3571,0xde));var _0x1357=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x3571[_0x4f34d8];return _0xc97536;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1357('0x0')],'allowNull':![],'unique':_0x1357('0x1')},'version':{'type':Sequelize[_0x1357('0x0')],'allowNull':![],'unique':_0x1357('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x1357('0x0')]},'path':{'type':Sequelize[_0x1357('0x0')]},'type':{'type':Sequelize[_0x1357('0x0')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1357('0x0')]},'logo':{'type':Sequelize[_0x1357('0x0')]},'state':{'type':Sequelize['STRING'],'unique':_0x1357('0x2')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x1357('0x0')]},'remoteUri':{'type':Sequelize[_0x1357('0x0')]},'link':{'type':Sequelize[_0x1357('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index f830929..d77f766 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 _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x66fa,0x117));var _0xa66f=function(_0x5675e6,_0xb3c823){_0x5675e6=_0x5675e6-0x0;var _0x5f5562=_0x66fa[_0x5675e6];return _0x5f5562;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x34355f,_0x16f4d0){var _0xb313a1=function(_0x4c8fc6){while(--_0x4c8fc6){_0x34355f['push'](_0x34355f['shift']());}};_0xb313a1(++_0x16f4d0);}(_0xafc4,0x69));var _0x4afc=function(_0xa7671,_0x17148b){_0xa7671=_0xa7671-0x0;var _0x29dc49=_0xafc4[_0xa7671];return _0x29dc49;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 276758a..487c6e7 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 _0xd79c=['request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','../../config/logger','api'];(function(_0x8b79b0,_0x39761d){var _0x123b90=function(_0x13814b){while(--_0x13814b){_0x8b79b0['push'](_0x8b79b0['shift']());}};_0x123b90(++_0x39761d);}(_0xd79c,0x11b));var _0xcd79=function(_0x2e61ef,_0x5c8b41){_0x2e61ef=_0x2e61ef-0x0;var _0x570cc3=_0xd79c[_0x2e61ef];return _0x570cc3;};'use strict';var _=require(_0xcd79('0x0'));var util=require('util');var logger=require(_0xcd79('0x1'))(_0xcd79('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcd79('0x3'));var fs=require('fs');var path=require(_0xcd79('0x4'));var rimraf=require('rimraf');var config=require(_0xcd79('0x5'));var attributes=require(_0xcd79('0x6'));module[_0xcd79('0x7')]=function(_0x51bcb4,_0x4a0937){return _0x51bcb4[_0xcd79('0x8')](_0xcd79('0x9'),attributes,{'tableName':_0xcd79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8e1=['moment','request-promise','path','../../config/environment','define','Integration','integrations','lodash','util','../../config/logger','api'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0xe8e1,0x1d5));var _0x1e8e=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xe8e1[_0x4314d7];return _0x5c599b;};'use strict';var _=require(_0x1e8e('0x0'));var util=require(_0x1e8e('0x1'));var logger=require(_0x1e8e('0x2'))(_0x1e8e('0x3'));var moment=require(_0x1e8e('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e8e('0x5'));var fs=require('fs');var path=require(_0x1e8e('0x6'));var rimraf=require('rimraf');var config=require(_0x1e8e('0x7'));var attributes=require('./integration.attributes');module['exports']=function(_0x2917b2,_0x47171f){return _0x2917b2[_0x1e8e('0x8')](_0x1e8e('0x9'),attributes,{'tableName':_0x1e8e('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 2881308..29cc708 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3e0e08,_0x4e07a0){var _0x299988=function(_0x50edb5){while(--_0x50edb5){_0x3e0e08['push'](_0x3e0e08['shift']());}};_0x299988(++_0x4e07a0);}(_0x896e,0x1e9));var _0xe896=function(_0x46a4aa,_0x502b25){_0x46a4aa=_0x46a4aa-0x0;var _0x5b7236=_0x896e[_0x46a4aa];return _0x5b7236;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x1967,0x173));var _0x7196=function(_0x19b57c,_0x67483c){_0x19b57c=_0x19b57c-0x0;var _0x2f2160=_0x1967[_0x19b57c];return _0x2f2160;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8d090f2..e43e56e 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 _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x211fb9,_0x2c74dd){var _0x4f2bb6=function(_0x34f230){while(--_0x34f230){_0x211fb9['push'](_0x211fb9['shift']());}};_0x4f2bb6(++_0x2c74dd);}(_0xba34,0x119));var _0x4ba3=function(_0x39ed69,_0x4e96d0){_0x39ed69=_0x39ed69-0x0;var _0x4fd1f7=_0xba34[_0x39ed69];return _0x4fd1f7;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x21bcf6,_0x5cb147){var _0x340db1=function(_0x21028a){while(--_0x21028a){_0x21bcf6['push'](_0x21bcf6['shift']());}};_0x340db1(++_0x5cb147);}(_0x7a54,0x106));var _0x47a5=function(_0x8b335b,_0x5e16b8){_0x8b335b=_0x8b335b-0x0;var _0xfeff3f=_0x7a54[_0x8b335b];return _0xfeff3f;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 663849c..dabd750 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 _0x9a1d=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER'];(function(_0x9477f5,_0x460b58){var _0x5e2f9e=function(_0x5bd7c7){while(--_0x5bd7c7){_0x9477f5['push'](_0x9477f5['shift']());}};_0x5e2f9e(++_0x460b58);}(_0x9a1d,0x89));var _0xd9a1=function(_0x223df9,_0x531109){_0x223df9=_0x223df9-0x0;var _0x20264e=_0x9a1d[_0x223df9];return _0x20264e;};'use strict';var Sequelize=require(_0xd9a1('0x0'));module['exports']={'integration':{'type':Sequelize[_0xd9a1('0x1')]},'eventChannel':{'type':Sequelize[_0xd9a1('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xd9a1('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd9a1('0x1')]},'calleridnum':{'type':Sequelize[_0xd9a1('0x1')]},'calleridname':{'type':Sequelize[_0xd9a1('0x1')]},'queue':{'type':Sequelize[_0xd9a1('0x1')]},'interface':{'type':Sequelize[_0xd9a1('0x1')]},'membername':{'type':Sequelize[_0xd9a1('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd9a1('0x3')]},'holdtime':{'type':Sequelize[_0xd9a1('0x2')]},'agentcomplete':{'type':Sequelize[_0xd9a1('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd9a1('0x3')]},'talktime':{'type':Sequelize[_0xd9a1('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9a1('0x2')]},'reason':{'type':Sequelize[_0xd9a1('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xd9a1('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd9a1('0x3')]},'agentdump':{'type':Sequelize[_0xd9a1('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd9a1('0x1')]},'channel':{'type':Sequelize[_0xd9a1('0x1')]},'channelstate':{'type':Sequelize[_0xd9a1('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd9a1('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd9a1('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd9a1('0x1')]},'context':{'type':Sequelize[_0xd9a1('0x1')]},'exten':{'type':Sequelize[_0xd9a1('0x1')]},'priority':{'type':Sequelize[_0xd9a1('0x1')]},'destchannel':{'type':Sequelize[_0xd9a1('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd9a1('0x1')]},'destcalleridname':{'type':Sequelize[_0xd9a1('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd9a1('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd9a1('0x1')]},'destcontext':{'type':Sequelize[_0xd9a1('0x1')]},'destexten':{'type':Sequelize[_0xd9a1('0x1')]},'destpriority':{'type':Sequelize[_0xd9a1('0x1')]},'destuniqueid':{'type':Sequelize[_0xd9a1('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xd9a1('0x1')]},'subject':{'type':Sequelize[_0xd9a1('0x1')]},'from':{'type':Sequelize[_0xd9a1('0x1')]},'to':{'type':Sequelize[_0xd9a1('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xd9a1('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xd9a1('0x5')]},'status':{'type':Sequelize[_0xd9a1('0x6')](_0xd9a1('0x7'),_0xd9a1('0x8'),_0xd9a1('0x9'),'FAILED')},'url':{'type':Sequelize[_0xd9a1('0x1')]},'app':{'type':Sequelize[_0xd9a1('0x1')]},'appdata':{'type':Sequelize[_0xd9a1('0x1')]},'projectId':{'type':Sequelize[_0xd9a1('0x2')]}}; \ No newline at end of file +var _0xe2a1=['TEXT','ENUM','SENT','SENDING','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x5f1652,_0x5afea9){var _0x149d05=function(_0x418064){while(--_0x418064){_0x5f1652['push'](_0x5f1652['shift']());}};_0x149d05(++_0x5afea9);}(_0xe2a1,0x159));var _0x1e2a=function(_0x551bf0,_0x32b429){_0x551bf0=_0x551bf0-0x0;var _0x5dc153=_0xe2a1[_0x551bf0];return _0x5dc153;};'use strict';var Sequelize=require('sequelize');module[_0x1e2a('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1e2a('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1e2a('0x1')]},'integrationId':{'type':Sequelize[_0x1e2a('0x2')]},'contacts':{'type':Sequelize[_0x1e2a('0x1')]},'uniqueid':{'type':Sequelize[_0x1e2a('0x1')]},'calleridnum':{'type':Sequelize[_0x1e2a('0x1')]},'calleridname':{'type':Sequelize[_0x1e2a('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1e2a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x1e2a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1e2a('0x3')]},'holdtime':{'type':Sequelize[_0x1e2a('0x2')]},'agentcomplete':{'type':Sequelize[_0x1e2a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1e2a('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x1e2a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x1e2a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x1e2a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1e2a('0x3')]},'agentdump':{'type':Sequelize[_0x1e2a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1e2a('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1e2a('0x2')]},'channelstatedesc':{'type':Sequelize[_0x1e2a('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1e2a('0x1')]},'accountcode':{'type':Sequelize[_0x1e2a('0x1')]},'context':{'type':Sequelize[_0x1e2a('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1e2a('0x1')]},'destchannel':{'type':Sequelize[_0x1e2a('0x1')]},'destchannelstate':{'type':Sequelize[_0x1e2a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1e2a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1e2a('0x1')]},'destcalleridname':{'type':Sequelize[_0x1e2a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x1e2a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1e2a('0x1')]},'destaccountcode':{'type':Sequelize[_0x1e2a('0x1')]},'destcontext':{'type':Sequelize[_0x1e2a('0x1')]},'destexten':{'type':Sequelize[_0x1e2a('0x1')]},'destpriority':{'type':Sequelize[_0x1e2a('0x1')]},'destuniqueid':{'type':Sequelize[_0x1e2a('0x1')]},'messageId':{'type':Sequelize[_0x1e2a('0x1')]},'inReplyTo':{'type':Sequelize[_0x1e2a('0x1')]},'subject':{'type':Sequelize[_0x1e2a('0x1')]},'from':{'type':Sequelize[_0x1e2a('0x1')]},'to':{'type':Sequelize[_0x1e2a('0x1')]},'cc':{'type':Sequelize[_0x1e2a('0x1')]},'attachment':{'type':Sequelize[_0x1e2a('0x5')]},'html':{'type':Sequelize[_0x1e2a('0x5')]},'text':{'type':Sequelize[_0x1e2a('0x5')]},'status':{'type':Sequelize[_0x1e2a('0x6')](_0x1e2a('0x7'),_0x1e2a('0x8'),'RECEIVED',_0x1e2a('0x9'))},'url':{'type':Sequelize[_0x1e2a('0x1')]},'app':{'type':Sequelize[_0x1e2a('0x1')]},'appdata':{'type':Sequelize[_0x1e2a('0x1')]},'projectId':{'type':Sequelize[_0x1e2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 00bef32..6d0dda1 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 _0x60d8=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','end','stack','name','index','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x60d8,0xd0));var _0x860d=function(_0x5deae9,_0x5ad727){_0x5deae9=_0x5deae9-0x0;var _0x7f44cb=_0x60d8[_0x5deae9];return _0x7f44cb;};'use strict';var emlformat=require(_0x860d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x860d('0x1'));var moment=require(_0x860d('0x2'));var BPromise=require(_0x860d('0x3'));var Mustache=require(_0x860d('0x4'));var util=require(_0x860d('0x5'));var path=require(_0x860d('0x6'));var sox=require(_0x860d('0x7'));var csv=require('to-csv');var ejs=require(_0x860d('0x8'));var fs=require('fs');var fs_extra=require(_0x860d('0x9'));var _=require(_0x860d('0xa'));var squel=require(_0x860d('0xb'));var crypto=require(_0x860d('0xc'));var jsforce=require(_0x860d('0xd'));var deskjs=require(_0x860d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x860d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x860d('0x10'));var qs=require(_0x860d('0x11'));var as=require(_0x860d('0x12'));var hardwareService=require(_0x860d('0x13'));var logger=require(_0x860d('0x14'))(_0x860d('0x15'));var utils=require(_0x860d('0x16'));var config=require(_0x860d('0x17'));var licenseUtil=require(_0x860d('0x18'));var db=require(_0x860d('0x19'))['db'];function respondWithStatusCode(_0x7652ba,_0x2980ce){_0x2980ce=_0x2980ce||0xcc;return function(_0xacc49f){if(_0xacc49f){return _0x7652ba[_0x860d('0x1a')](_0x2980ce);}return _0x7652ba[_0x860d('0x1b')](_0x2980ce)['end']();};}function respondWithResult(_0xccd37,_0x7c61e1){_0x7c61e1=_0x7c61e1||0xc8;return function(_0x10ceca){if(_0x10ceca){return _0xccd37[_0x860d('0x1b')](_0x7c61e1)[_0x860d('0x1c')](_0x10ceca);}};}function respondWithFilteredResult(_0xfe94fc,_0x43d516){return function(_0x59fbd1){if(_0x59fbd1){var _0x522236=typeof _0x43d516[_0x860d('0x1d')]===_0x860d('0x1e')&&typeof _0x43d516['limit']===_0x860d('0x1e');var _0x480a06=_0x59fbd1[_0x860d('0x1f')];var _0x2cf24f=_0x522236?0x0:_0x43d516[_0x860d('0x1d')];var _0x121d11=_0x522236?_0x59fbd1[_0x860d('0x1f')]:_0x43d516[_0x860d('0x1d')]+_0x43d516[_0x860d('0x20')];var _0x4ee5b5;if(_0x121d11>=_0x480a06){_0x121d11=_0x480a06;_0x4ee5b5=0xc8;}else{_0x4ee5b5=0xce;}_0xfe94fc['status'](_0x4ee5b5);return _0xfe94fc[_0x860d('0x21')](_0x860d('0x22'),_0x2cf24f+'-'+_0x121d11+'/'+_0x480a06)['json'](_0x59fbd1);}return null;};}function patchUpdates(_0x330a11){return function(_0x54805b){try{jsonpatch['apply'](_0x54805b,_0x330a11,!![]);}catch(_0x18d733){return BPromise['reject'](_0x18d733);}return _0x54805b['save']();};}function saveUpdates(_0x399042,_0x24ad79){return function(_0x31e1c8){if(_0x31e1c8){return _0x31e1c8[_0x860d('0x23')](_0x399042)['then'](function(_0x276981){return _0x276981;});}return null;};}function removeEntity(_0x3b3b2a,_0xd641c0){return function(_0x40eda7){if(_0x40eda7){return _0x40eda7[_0x860d('0x24')]()[_0x860d('0x25')](function(){_0x3b3b2a['status'](0xcc)[_0x860d('0x26')]();});}};}function handleEntityNotFound(_0x4bcb51,_0x4755f3){return function(_0x4a4343){if(!_0x4a4343){_0x4bcb51[_0x860d('0x1a')](0x194);}return _0x4a4343;};}function handleError(_0x3df219,_0x167b54){_0x167b54=_0x167b54||0x1f4;return function(_0x4963ca){logger['error'](_0x4963ca[_0x860d('0x27')]);if(_0x4963ca[_0x860d('0x28')]){delete _0x4963ca[_0x860d('0x28')];}_0x3df219[_0x860d('0x1b')](_0x167b54)['send'](_0x4963ca);};}exports[_0x860d('0x29')]=function(_0x44fdc4,_0x1b87bf){var _0x3d4589={},_0x5585d9={},_0xe4c044={'count':0x0,'rows':[]};var _0xcd5fdc=_[_0x860d('0x2a')](db[_0x860d('0x2b')]['rawAttributes'],function(_0x19a058){return{'name':_0x19a058[_0x860d('0x2c')],'type':_0x19a058[_0x860d('0x2d')][_0x860d('0x2e')]};});_0x5585d9[_0x860d('0x2f')]=_[_0x860d('0x2a')](_0xcd5fdc,_0x860d('0x28'));_0x5585d9[_0x860d('0x30')]=_[_0x860d('0x31')](_0x44fdc4[_0x860d('0x30')]);_0x5585d9[_0x860d('0x32')]=_[_0x860d('0x33')](_0x5585d9['model'],_0x5585d9[_0x860d('0x30')]);_0x3d4589[_0x860d('0x34')]=_[_0x860d('0x33')](_0x5585d9[_0x860d('0x2f')],qs[_0x860d('0x35')](_0x44fdc4[_0x860d('0x30')]['fields']));_0x3d4589[_0x860d('0x34')]=_0x3d4589[_0x860d('0x34')][_0x860d('0x36')]?_0x3d4589[_0x860d('0x34')]:_0x5585d9['model'];if(!_0x44fdc4['query'][_0x860d('0x37')](_0x860d('0x38'))){_0x3d4589['limit']=qs[_0x860d('0x20')](_0x44fdc4['query'][_0x860d('0x20')]);_0x3d4589['offset']=qs[_0x860d('0x1d')](_0x44fdc4['query'][_0x860d('0x1d')]);}_0x3d4589[_0x860d('0x39')]=qs['sort'](_0x44fdc4[_0x860d('0x30')][_0x860d('0x3a')]);_0x3d4589[_0x860d('0x3b')]=qs[_0x860d('0x32')](_[_0x860d('0x3c')](_0x44fdc4['query'],_0x5585d9['filters']),_0xcd5fdc);if(_0x44fdc4[_0x860d('0x30')][_0x860d('0x3d')]){_0x3d4589[_0x860d('0x3b')]=_[_0x860d('0x3e')](_0x3d4589[_0x860d('0x3b')],{'$or':_['map'](_0xcd5fdc,function(_0x2d6889){if(_0x2d6889[_0x860d('0x2d')]!=='VIRTUAL'){var _0x218d95={};_0x218d95[_0x2d6889['name']]={'$like':'%'+_0x44fdc4[_0x860d('0x30')][_0x860d('0x3d')]+'%'};return _0x218d95;}})});}_0x3d4589=_[_0x860d('0x3e')]({},_0x3d4589,_0x44fdc4[_0x860d('0x3f')]);var _0x1a7a58={'where':_0x3d4589['where']};return db[_0x860d('0x2b')][_0x860d('0x1f')](_0x1a7a58)[_0x860d('0x25')](function(_0x40c5d6){_0xe4c044[_0x860d('0x1f')]=_0x40c5d6;if(_0x44fdc4[_0x860d('0x30')]['includeAll']){_0x3d4589[_0x860d('0x40')]=[{'all':!![]}];}return db[_0x860d('0x2b')][_0x860d('0x41')](_0x3d4589);})['then'](function(_0x16dd98){_0xe4c044[_0x860d('0x42')]=_0x16dd98;return _0xe4c044;})['then'](respondWithFilteredResult(_0x1b87bf,_0x3d4589))[_0x860d('0x43')](handleError(_0x1b87bf,null));};exports[_0x860d('0x44')]=function(_0x4fc058,_0x28b3d5){var _0x31cf7f={'raw':![],'where':{'id':_0x4fc058[_0x860d('0x45')]['id']}},_0x4a9f4f={};_0x4a9f4f[_0x860d('0x2f')]=_['keys'](db[_0x860d('0x2b')][_0x860d('0x46')]);_0x4a9f4f[_0x860d('0x30')]=_[_0x860d('0x31')](_0x4fc058[_0x860d('0x30')]);_0x4a9f4f['filters']=_[_0x860d('0x33')](_0x4a9f4f[_0x860d('0x2f')],_0x4a9f4f[_0x860d('0x30')]);_0x31cf7f[_0x860d('0x34')]=_['intersection'](_0x4a9f4f[_0x860d('0x2f')],qs[_0x860d('0x35')](_0x4fc058[_0x860d('0x30')][_0x860d('0x35')]));_0x31cf7f[_0x860d('0x34')]=_0x31cf7f['attributes'][_0x860d('0x36')]?_0x31cf7f[_0x860d('0x34')]:_0x4a9f4f[_0x860d('0x2f')];if(_0x4fc058[_0x860d('0x30')][_0x860d('0x47')]){_0x31cf7f[_0x860d('0x40')]=[{'all':!![]}];}_0x31cf7f=_['merge']({},_0x31cf7f,_0x4fc058['options']);return db[_0x860d('0x2b')]['find'](_0x31cf7f)[_0x860d('0x25')](handleEntityNotFound(_0x28b3d5,null))[_0x860d('0x25')](respondWithResult(_0x28b3d5,null))[_0x860d('0x43')](handleError(_0x28b3d5,null));};exports['create']=function(_0x69bf0a,_0x489ff4){return db[_0x860d('0x2b')][_0x860d('0x48')](_0x69bf0a[_0x860d('0x49')],{})[_0x860d('0x25')](respondWithResult(_0x489ff4,0xc9))['catch'](handleError(_0x489ff4,null));};exports[_0x860d('0x23')]=function(_0x491a64,_0x2e6ed5){if(_0x491a64['body']['id']){delete _0x491a64[_0x860d('0x49')]['id'];}return db[_0x860d('0x2b')][_0x860d('0x4a')]({'where':{'id':_0x491a64[_0x860d('0x45')]['id']}})[_0x860d('0x25')](handleEntityNotFound(_0x2e6ed5,null))[_0x860d('0x25')](saveUpdates(_0x491a64['body'],null))['then'](respondWithResult(_0x2e6ed5,null))[_0x860d('0x43')](handleError(_0x2e6ed5,null));};exports[_0x860d('0x24')]=function(_0x5da3ec,_0x588074){return db[_0x860d('0x2b')][_0x860d('0x4a')]({'where':{'id':_0x5da3ec[_0x860d('0x45')]['id']}})[_0x860d('0x25')](handleEntityNotFound(_0x588074,null))['then'](removeEntity(_0x588074,null))[_0x860d('0x43')](handleError(_0x588074,null));};exports[_0x860d('0x4b')]=function(_0x42cabd,_0xcf7e05){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0xcf7e05,null))[_0x860d('0x43')](handleError(_0xcf7e05,null));}; \ No newline at end of file +var _0x8d16=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','json','reject','update','then','destroy','error','name','send','index','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x55ff21,_0x1540f0){var _0x4baf37=function(_0x51128b){while(--_0x51128b){_0x55ff21['push'](_0x55ff21['shift']());}};_0x4baf37(++_0x1540f0);}(_0x8d16,0x159));var _0x68d1=function(_0x3703fe,_0x10ad36){_0x3703fe=_0x3703fe-0x0;var _0x23c2b0=_0x8d16[_0x3703fe];return _0x23c2b0;};'use strict';var emlformat=require(_0x68d1('0x0'));var rimraf=require(_0x68d1('0x1'));var zipdir=require(_0x68d1('0x2'));var jsonpatch=require(_0x68d1('0x3'));var rp=require(_0x68d1('0x4'));var moment=require(_0x68d1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x68d1('0x6'));var util=require(_0x68d1('0x7'));var path=require(_0x68d1('0x8'));var sox=require(_0x68d1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68d1('0xa'));var squel=require(_0x68d1('0xb'));var crypto=require(_0x68d1('0xc'));var jsforce=require(_0x68d1('0xd'));var deskjs=require(_0x68d1('0xe'));var toCsv=require(_0x68d1('0xf'));var querystring=require(_0x68d1('0x10'));var Papa=require(_0x68d1('0x11'));var Redis=require(_0x68d1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x68d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68d1('0x14'))(_0x68d1('0x15'));var utils=require(_0x68d1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x68d1('0x17'));var db=require(_0x68d1('0x18'))['db'];function respondWithStatusCode(_0xd6e7,_0x3786a7){_0x3786a7=_0x3786a7||0xcc;return function(_0x5c9cd1){if(_0x5c9cd1){return _0xd6e7['sendStatus'](_0x3786a7);}return _0xd6e7[_0x68d1('0x19')](_0x3786a7)['end']();};}function respondWithResult(_0x2dcbd0,_0x41447d){_0x41447d=_0x41447d||0xc8;return function(_0x52b413){if(_0x52b413){return _0x2dcbd0[_0x68d1('0x19')](_0x41447d)['json'](_0x52b413);}};}function respondWithFilteredResult(_0x3213d1,_0x46c1f1){return function(_0x42904d){if(_0x42904d){var _0x314225=typeof _0x46c1f1[_0x68d1('0x1a')]===_0x68d1('0x1b')&&typeof _0x46c1f1['limit']===_0x68d1('0x1b');var _0x3fce13=_0x42904d['count'];var _0x14902c=_0x314225?0x0:_0x46c1f1[_0x68d1('0x1a')];var _0xbd8908=_0x314225?_0x42904d[_0x68d1('0x1c')]:_0x46c1f1['offset']+_0x46c1f1[_0x68d1('0x1d')];var _0x854fcf;if(_0xbd8908>=_0x3fce13){_0xbd8908=_0x3fce13;_0x854fcf=0xc8;}else{_0x854fcf=0xce;}_0x3213d1[_0x68d1('0x19')](_0x854fcf);return _0x3213d1['set']('Content-Range',_0x14902c+'-'+_0xbd8908+'/'+_0x3fce13)[_0x68d1('0x1e')](_0x42904d);}return null;};}function patchUpdates(_0x5e0c66){return function(_0x2af4c2){try{jsonpatch['apply'](_0x2af4c2,_0x5e0c66,!![]);}catch(_0x108b07){return BPromise[_0x68d1('0x1f')](_0x108b07);}return _0x2af4c2['save']();};}function saveUpdates(_0x556141,_0x593088){return function(_0x5c968e){if(_0x5c968e){return _0x5c968e[_0x68d1('0x20')](_0x556141)[_0x68d1('0x21')](function(_0x5b2b9e){return _0x5b2b9e;});}return null;};}function removeEntity(_0x583889,_0x2478e3){return function(_0x4667b4){if(_0x4667b4){return _0x4667b4[_0x68d1('0x22')]()['then'](function(){_0x583889[_0x68d1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x315324,_0x2ddf23){return function(_0x5bd1bd){if(!_0x5bd1bd){_0x315324['sendStatus'](0x194);}return _0x5bd1bd;};}function handleError(_0x36e9bd,_0x1ab5ab){_0x1ab5ab=_0x1ab5ab||0x1f4;return function(_0x1de6ab){logger[_0x68d1('0x23')](_0x1de6ab['stack']);if(_0x1de6ab[_0x68d1('0x24')]){delete _0x1de6ab[_0x68d1('0x24')];}_0x36e9bd[_0x68d1('0x19')](_0x1ab5ab)[_0x68d1('0x25')](_0x1de6ab);};}exports[_0x68d1('0x26')]=function(_0x41b57d,_0xa80b6b){var _0x2e63ab={},_0x2f2b5f={},_0x47018b={'count':0x0,'rows':[]};var _0x529aaf=_[_0x68d1('0x27')](db[_0x68d1('0x28')]['rawAttributes'],function(_0x36d8ed){return{'name':_0x36d8ed[_0x68d1('0x29')],'type':_0x36d8ed[_0x68d1('0x2a')][_0x68d1('0x2b')]};});_0x2f2b5f[_0x68d1('0x2c')]=_[_0x68d1('0x27')](_0x529aaf,_0x68d1('0x24'));_0x2f2b5f[_0x68d1('0x2d')]=_[_0x68d1('0x2e')](_0x41b57d[_0x68d1('0x2d')]);_0x2f2b5f[_0x68d1('0x2f')]=_[_0x68d1('0x30')](_0x2f2b5f['model'],_0x2f2b5f['query']);_0x2e63ab['attributes']=_[_0x68d1('0x30')](_0x2f2b5f[_0x68d1('0x2c')],qs['fields'](_0x41b57d[_0x68d1('0x2d')][_0x68d1('0x31')]));_0x2e63ab[_0x68d1('0x32')]=_0x2e63ab[_0x68d1('0x32')][_0x68d1('0x33')]?_0x2e63ab[_0x68d1('0x32')]:_0x2f2b5f[_0x68d1('0x2c')];if(!_0x41b57d[_0x68d1('0x2d')][_0x68d1('0x34')](_0x68d1('0x35'))){_0x2e63ab[_0x68d1('0x1d')]=qs[_0x68d1('0x1d')](_0x41b57d[_0x68d1('0x2d')][_0x68d1('0x1d')]);_0x2e63ab[_0x68d1('0x1a')]=qs[_0x68d1('0x1a')](_0x41b57d[_0x68d1('0x2d')][_0x68d1('0x1a')]);}_0x2e63ab['order']=qs[_0x68d1('0x36')](_0x41b57d[_0x68d1('0x2d')]['sort']);_0x2e63ab[_0x68d1('0x37')]=qs[_0x68d1('0x2f')](_[_0x68d1('0x38')](_0x41b57d[_0x68d1('0x2d')],_0x2f2b5f[_0x68d1('0x2f')]),_0x529aaf);if(_0x41b57d[_0x68d1('0x2d')][_0x68d1('0x39')]){_0x2e63ab[_0x68d1('0x37')]=_[_0x68d1('0x3a')](_0x2e63ab[_0x68d1('0x37')],{'$or':_[_0x68d1('0x27')](_0x529aaf,function(_0x33befe){if(_0x33befe[_0x68d1('0x2a')]!==_0x68d1('0x3b')){var _0x52c9ef={};_0x52c9ef[_0x33befe[_0x68d1('0x24')]]={'$like':'%'+_0x41b57d[_0x68d1('0x2d')][_0x68d1('0x39')]+'%'};return _0x52c9ef;}})});}_0x2e63ab=_[_0x68d1('0x3a')]({},_0x2e63ab,_0x41b57d[_0x68d1('0x3c')]);var _0x319e5a={'where':_0x2e63ab[_0x68d1('0x37')]};return db[_0x68d1('0x28')][_0x68d1('0x1c')](_0x319e5a)[_0x68d1('0x21')](function(_0x1ce836){_0x47018b[_0x68d1('0x1c')]=_0x1ce836;if(_0x41b57d['query'][_0x68d1('0x3d')]){_0x2e63ab[_0x68d1('0x3e')]=[{'all':!![]}];}return db[_0x68d1('0x28')][_0x68d1('0x3f')](_0x2e63ab);})['then'](function(_0x49a33e){_0x47018b[_0x68d1('0x40')]=_0x49a33e;return _0x47018b;})['then'](respondWithFilteredResult(_0xa80b6b,_0x2e63ab))[_0x68d1('0x41')](handleError(_0xa80b6b,null));};exports[_0x68d1('0x42')]=function(_0x342711,_0x2c7c0b){var _0x2f449f={'raw':![],'where':{'id':_0x342711[_0x68d1('0x43')]['id']}},_0x3928d0={};_0x3928d0['model']=_[_0x68d1('0x2e')](db[_0x68d1('0x28')][_0x68d1('0x44')]);_0x3928d0[_0x68d1('0x2d')]=_[_0x68d1('0x2e')](_0x342711['query']);_0x3928d0['filters']=_[_0x68d1('0x30')](_0x3928d0[_0x68d1('0x2c')],_0x3928d0[_0x68d1('0x2d')]);_0x2f449f['attributes']=_['intersection'](_0x3928d0[_0x68d1('0x2c')],qs[_0x68d1('0x31')](_0x342711[_0x68d1('0x2d')][_0x68d1('0x31')]));_0x2f449f[_0x68d1('0x32')]=_0x2f449f[_0x68d1('0x32')][_0x68d1('0x33')]?_0x2f449f['attributes']:_0x3928d0['model'];if(_0x342711['query'][_0x68d1('0x3d')]){_0x2f449f[_0x68d1('0x3e')]=[{'all':!![]}];}_0x2f449f=_[_0x68d1('0x3a')]({},_0x2f449f,_0x342711['options']);return db['IntegrationReport'][_0x68d1('0x45')](_0x2f449f)[_0x68d1('0x21')](handleEntityNotFound(_0x2c7c0b,null))[_0x68d1('0x21')](respondWithResult(_0x2c7c0b,null))['catch'](handleError(_0x2c7c0b,null));};exports[_0x68d1('0x46')]=function(_0x3b0514,_0x138e23){return db[_0x68d1('0x28')]['create'](_0x3b0514[_0x68d1('0x47')],{})[_0x68d1('0x21')](respondWithResult(_0x138e23,0xc9))[_0x68d1('0x41')](handleError(_0x138e23,null));};exports[_0x68d1('0x20')]=function(_0x497f70,_0xc8c084){if(_0x497f70[_0x68d1('0x47')]['id']){delete _0x497f70[_0x68d1('0x47')]['id'];}return db[_0x68d1('0x28')]['find']({'where':{'id':_0x497f70[_0x68d1('0x43')]['id']}})[_0x68d1('0x21')](handleEntityNotFound(_0xc8c084,null))[_0x68d1('0x21')](saveUpdates(_0x497f70[_0x68d1('0x47')],null))[_0x68d1('0x21')](respondWithResult(_0xc8c084,null))[_0x68d1('0x41')](handleError(_0xc8c084,null));};exports[_0x68d1('0x22')]=function(_0x1d1612,_0x2b565f){return db[_0x68d1('0x28')][_0x68d1('0x45')]({'where':{'id':_0x1d1612[_0x68d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b565f,null))[_0x68d1('0x21')](removeEntity(_0x2b565f,null))['catch'](handleError(_0x2b565f,null));};exports[_0x68d1('0x48')]=function(_0x1bf011,_0x278551){return db[_0x68d1('0x28')][_0x68d1('0x48')]()[_0x68d1('0x21')](respondWithResult(_0x278551,null))[_0x68d1('0x41')](handleError(_0x278551,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1c9d983..62d84d7 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 _0x6af7=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xace332,_0x18b891){var _0x2386ef=function(_0x44ceb9){while(--_0x44ceb9){_0xace332['push'](_0xace332['shift']());}};_0x2386ef(++_0x18b891);}(_0x6af7,0x1e3));var _0x76af=function(_0x37f55f,_0xe6a60c){_0x37f55f=_0x37f55f-0x0;var _0x40af9e=_0x6af7[_0x37f55f];return _0x40af9e;};'use strict';var _=require(_0x76af('0x0'));var util=require(_0x76af('0x1'));var logger=require(_0x76af('0x2'))('api');var moment=require(_0x76af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x76af('0x4'));var rimraf=require(_0x76af('0x5'));var config=require(_0x76af('0x6'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x467d77,_0x33e4be){return _0x467d77[_0x76af('0x7')](_0x76af('0x8'),attributes,{'tableName':_0x76af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x092a=['api','bluebird','request-promise','path','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x092a,0x76));var _0xa092=function(_0x36ee10,_0x3e4e4b){_0x36ee10=_0x36ee10-0x0;var _0x1ae7e8=_0x092a[_0x36ee10];return _0x1ae7e8;};'use strict';var _=require(_0xa092('0x0'));var util=require(_0xa092('0x1'));var logger=require(_0xa092('0x2'))(_0xa092('0x3'));var moment=require('moment');var BPromise=require(_0xa092('0x4'));var rp=require(_0xa092('0x5'));var fs=require('fs');var path=require(_0xa092('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xa092('0x7')]=function(_0x1b6dd1,_0x415d36){return _0x1b6dd1[_0xa092('0x8')](_0xa092('0x9'),attributes,{'tableName':_0xa092('0xa'),'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 e4cfd90..87d01fd 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 _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b66e7,_0x408125){var _0x1358e5=function(_0x4ca391){while(--_0x4ca391){_0x2b66e7['push'](_0x2b66e7['shift']());}};_0x1358e5(++_0x408125);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x53f378,_0x38d954){_0x53f378=_0x53f378-0x0;var _0x3de609=_0xc6ac[_0x53f378];return _0x3de609;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x21347c,_0x3df053){var _0x5cb905=function(_0x32c532){while(--_0x32c532){_0x21347c['push'](_0x21347c['shift']());}};_0x5cb905(++_0x3df053);}(_0xba34,0x119));var _0x4ba3=function(_0x9752eb,_0x184b43){_0x9752eb=_0x9752eb-0x0;var _0x6dd1c1=_0xba34[_0x9752eb];return _0x6dd1c1;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 93e62e9..b18ae89 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 _0xe9ce=['show','isAuthenticated','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./interval.controller','get','index','/:id'];(function(_0x321e7b,_0x56400b){var _0x3a3a80=function(_0x23032c){while(--_0x23032c){_0x321e7b['push'](_0x321e7b['shift']());}};_0x3a3a80(++_0x56400b);}(_0xe9ce,0x1ae));var _0xee9c=function(_0x3ef526,_0x2cb29d){_0x3ef526=_0x3ef526-0x0;var _0x257f66=_0xe9ce[_0x3ef526];return _0x257f66;};'use strict';var multer=require(_0xee9c('0x0'));var util=require(_0xee9c('0x1'));var path=require(_0xee9c('0x2'));var timeout=require(_0xee9c('0x3'));var express=require(_0xee9c('0x4'));var router=express['Router']();var fs_extra=require(_0xee9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee9c('0x6'));var config=require('../../config/environment');var controller=require(_0xee9c('0x7'));router[_0xee9c('0x8')]('/',auth['isAuthenticated'](),controller[_0xee9c('0x9')]);router[_0xee9c('0x8')](_0xee9c('0xa'),auth['isAuthenticated'](),controller[_0xee9c('0xb')]);router[_0xee9c('0x8')]('/:id/sub_intervals',auth[_0xee9c('0xc')](),controller['getIntervals']);router[_0xee9c('0xd')]('/',auth[_0xee9c('0xc')](),controller[_0xee9c('0xe')]);router['post']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xee9c('0xf')]);router[_0xee9c('0xd')](_0xee9c('0x10'),auth[_0xee9c('0xc')](),controller[_0xee9c('0x11')]);router['put'](_0xee9c('0xa'),auth[_0xee9c('0xc')](),controller['update']);router[_0xee9c('0x12')](_0xee9c('0xa'),auth[_0xee9c('0xc')](),controller[_0xee9c('0x13')]);module[_0xee9c('0x14')]=router; \ No newline at end of file +var _0xc0a4=['isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xc0a4,0x147));var _0x4c0a=function(_0x3faf88,_0x426080){_0x3faf88=_0x3faf88-0x0;var _0x5e61cc=_0xc0a4[_0x3faf88];return _0x5e61cc;};'use strict';var multer=require('multer');var util=require(_0x4c0a('0x0'));var path=require(_0x4c0a('0x1'));var timeout=require(_0x4c0a('0x2'));var express=require('express');var router=express[_0x4c0a('0x3')]();var fs_extra=require(_0x4c0a('0x4'));var auth=require(_0x4c0a('0x5'));var interaction=require(_0x4c0a('0x6'));var config=require(_0x4c0a('0x7'));var controller=require('./interval.controller');router[_0x4c0a('0x8')]('/',auth[_0x4c0a('0x9')](),controller[_0x4c0a('0xa')]);router[_0x4c0a('0x8')](_0x4c0a('0xb'),auth[_0x4c0a('0x9')](),controller[_0x4c0a('0xc')]);router[_0x4c0a('0x8')](_0x4c0a('0xd'),auth['isAuthenticated'](),controller[_0x4c0a('0xe')]);router[_0x4c0a('0xf')]('/',auth[_0x4c0a('0x9')](),controller[_0x4c0a('0x10')]);router[_0x4c0a('0xf')](_0x4c0a('0xd'),auth[_0x4c0a('0x9')](),controller[_0x4c0a('0x11')]);router[_0x4c0a('0xf')](_0x4c0a('0x12'),auth[_0x4c0a('0x9')](),controller[_0x4c0a('0x13')]);router['put'](_0x4c0a('0xb'),auth[_0x4c0a('0x9')](),controller[_0x4c0a('0x14')]);router[_0x4c0a('0x15')]('/:id',auth[_0x4c0a('0x9')](),controller[_0x4c0a('0x16')]);module[_0x4c0a('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f8130d5..285dc32 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 _0x07e6=['STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x07e6,0xdb));var _0x607e=function(_0x594173,_0x216725){_0x594173=_0x594173-0x0;var _0x4ea37c=_0x07e6[_0x594173];return _0x4ea37c;};'use strict';var Sequelize=require(_0x607e('0x0'));module['exports']={'name':{'type':Sequelize[_0x607e('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x607e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x0eb8=['STRING','exports'];(function(_0x20a8ba,_0x5db136){var _0x4444ca=function(_0x3c8f37){while(--_0x3c8f37){_0x20a8ba['push'](_0x20a8ba['shift']());}};_0x4444ca(++_0x5db136);}(_0x0eb8,0xa9));var _0x80eb=function(_0x323bbf,_0x2a12f2){_0x323bbf=_0x323bbf-0x0;var _0x3dc49c=_0x0eb8[_0x323bbf];return _0x3dc49c;};'use strict';var Sequelize=require('sequelize');module[_0x80eb('0x0')]={'name':{'type':Sequelize[_0x80eb('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x80eb('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5b4d80e..6380f42 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 _0xe022=['then','destroy','get','Intervals','error','stack','name','index','map','Interval','fieldName','type','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','body','params','getIntervals','findOne','hasOwnProperty','addIntervals','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','moment','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe022,0x88));var _0x2e02=function(_0x55dc17,_0x117934){_0x55dc17=_0x55dc17-0x0;var _0x4baa76=_0xe022[_0x55dc17];return _0x4baa76;};'use strict';var emlformat=require(_0x2e02('0x0'));var rimraf=require(_0x2e02('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e02('0x2'));var rp=require('request-promise');var moment=require(_0x2e02('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2e02('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2e02('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e02('0x6'));var _=require(_0x2e02('0x7'));var squel=require(_0x2e02('0x8'));var crypto=require(_0x2e02('0x9'));var jsforce=require(_0x2e02('0xa'));var deskjs=require(_0x2e02('0xb'));var toCsv=require(_0x2e02('0xc'));var querystring=require(_0x2e02('0xd'));var Papa=require(_0x2e02('0xe'));var Redis=require(_0x2e02('0xf'));var authService=require(_0x2e02('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2e02('0x11'));var hardwareService=require(_0x2e02('0x12'));var logger=require('../../config/logger')(_0x2e02('0x13'));var utils=require('../../config/utils');var config=require(_0x2e02('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e02('0x15'))['db'];var extensions=require(_0x2e02('0x16'));function respondWithStatusCode(_0x5ae418,_0x29574c){_0x29574c=_0x29574c||0xcc;return function(_0x472afa){if(_0x472afa){return _0x5ae418[_0x2e02('0x17')](_0x29574c);}return _0x5ae418[_0x2e02('0x18')](_0x29574c)[_0x2e02('0x19')]();};}function respondWithResult(_0x3961e9,_0x2d4d5e){_0x2d4d5e=_0x2d4d5e||0xc8;return function(_0x217b44){if(_0x217b44){return _0x3961e9[_0x2e02('0x18')](_0x2d4d5e)[_0x2e02('0x1a')](_0x217b44);}};}function respondWithFilteredResult(_0x54acae,_0x190ca2){return function(_0x2d8176){if(_0x2d8176){var _0x3457bd=typeof _0x190ca2[_0x2e02('0x1b')]===_0x2e02('0x1c')&&typeof _0x190ca2[_0x2e02('0x1d')]===_0x2e02('0x1c');var _0xf4f991=_0x2d8176[_0x2e02('0x1e')];var _0x5fb8e6=_0x3457bd?0x0:_0x190ca2[_0x2e02('0x1b')];var _0x42047b=_0x3457bd?_0x2d8176[_0x2e02('0x1e')]:_0x190ca2[_0x2e02('0x1b')]+_0x190ca2['limit'];var _0x3794c3;if(_0x42047b>=_0xf4f991){_0x42047b=_0xf4f991;_0x3794c3=0xc8;}else{_0x3794c3=0xce;}_0x54acae[_0x2e02('0x18')](_0x3794c3);return _0x54acae[_0x2e02('0x1f')](_0x2e02('0x20'),_0x5fb8e6+'-'+_0x42047b+'/'+_0xf4f991)[_0x2e02('0x1a')](_0x2d8176);}return null;};}function patchUpdates(_0x2d0d53){return function(_0x516f4d){try{jsonpatch[_0x2e02('0x21')](_0x516f4d,_0x2d0d53,!![]);}catch(_0x435138){return BPromise['reject'](_0x435138);}return _0x516f4d[_0x2e02('0x22')]();};}function saveUpdates(_0x337e75,_0x5bfce1){return function(_0x400de0){if(_0x400de0){return _0x400de0[_0x2e02('0x23')](_0x337e75)[_0x2e02('0x24')](function(_0x27583c){return _0x27583c;});}return null;};}function removeEntity(_0x1b6d0b,_0x7fe9e){return function(_0x1720fb){if(_0x1720fb){return _0x1720fb[_0x2e02('0x25')]()[_0x2e02('0x24')](function(){var _0x540f59=_0x1720fb[_0x2e02('0x26')]({'plain':!![]});var _0x509206=_0x2e02('0x27');return db['UserProfileResource'][_0x2e02('0x25')]({'where':{'type':_0x509206,'resourceId':_0x540f59['id']}})[_0x2e02('0x24')](function(){return _0x1720fb;});})['then'](function(){_0x1b6d0b[_0x2e02('0x18')](0xcc)[_0x2e02('0x19')]();});}};}function handleEntityNotFound(_0x420430,_0x43ba3d){return function(_0x10e3b3){if(!_0x10e3b3){_0x420430[_0x2e02('0x17')](0x194);}return _0x10e3b3;};}function handleError(_0x4e1507,_0x3fd2e0){_0x3fd2e0=_0x3fd2e0||0x1f4;return function(_0x443106){logger[_0x2e02('0x28')](_0x443106[_0x2e02('0x29')]);if(_0x443106[_0x2e02('0x2a')]){delete _0x443106[_0x2e02('0x2a')];}_0x4e1507[_0x2e02('0x18')](_0x3fd2e0)['send'](_0x443106);};}exports[_0x2e02('0x2b')]=function(_0x511b6e,_0x429ce6){var _0x5dbd8d={},_0x485fd9={},_0x389899={'count':0x0,'rows':[]};var _0x11f00f=_[_0x2e02('0x2c')](db[_0x2e02('0x2d')]['rawAttributes'],function(_0x449cb3){return{'name':_0x449cb3[_0x2e02('0x2e')],'type':_0x449cb3[_0x2e02('0x2f')]['key']};});_0x485fd9['model']=_[_0x2e02('0x2c')](_0x11f00f,_0x2e02('0x2a'));_0x485fd9[_0x2e02('0x30')]=_['keys'](_0x511b6e['query']);_0x485fd9['filters']=_['intersection'](_0x485fd9['model'],_0x485fd9[_0x2e02('0x30')]);_0x5dbd8d['attributes']=_[_0x2e02('0x31')](_0x485fd9[_0x2e02('0x32')],qs[_0x2e02('0x33')](_0x511b6e[_0x2e02('0x30')][_0x2e02('0x33')]));_0x5dbd8d[_0x2e02('0x34')]=_0x5dbd8d['attributes'][_0x2e02('0x35')]?_0x5dbd8d[_0x2e02('0x34')]:_0x485fd9['model'];if(!_0x511b6e[_0x2e02('0x30')]['hasOwnProperty'](_0x2e02('0x36'))){_0x5dbd8d[_0x2e02('0x1d')]=qs[_0x2e02('0x1d')](_0x511b6e[_0x2e02('0x30')][_0x2e02('0x1d')]);_0x5dbd8d[_0x2e02('0x1b')]=qs['offset'](_0x511b6e['query'][_0x2e02('0x1b')]);}_0x5dbd8d[_0x2e02('0x37')]=qs[_0x2e02('0x38')](_0x511b6e[_0x2e02('0x30')][_0x2e02('0x38')]);_0x5dbd8d[_0x2e02('0x39')]=qs['filters'](_[_0x2e02('0x3a')](_0x511b6e[_0x2e02('0x30')],_0x485fd9[_0x2e02('0x3b')]),_0x11f00f);if(_0x511b6e['query'][_0x2e02('0x3c')]){_0x5dbd8d['where']=_[_0x2e02('0x3d')](_0x5dbd8d[_0x2e02('0x39')],{'$or':_[_0x2e02('0x2c')](_0x11f00f,function(_0x19be45){if(_0x19be45['type']!=='VIRTUAL'){var _0x17e982={};_0x17e982[_0x19be45[_0x2e02('0x2a')]]={'$like':'%'+_0x511b6e[_0x2e02('0x30')][_0x2e02('0x3c')]+'%'};return _0x17e982;}})});}_0x5dbd8d=_[_0x2e02('0x3d')]({},_0x5dbd8d,_0x511b6e[_0x2e02('0x3e')]);var _0x3b62f1={'where':_0x5dbd8d[_0x2e02('0x39')]};return db[_0x2e02('0x2d')][_0x2e02('0x1e')](_0x3b62f1)[_0x2e02('0x24')](function(_0x36ab9b){_0x389899[_0x2e02('0x1e')]=_0x36ab9b;if(_0x511b6e['query']['includeAll']){_0x5dbd8d[_0x2e02('0x3f')]=[{'all':!![]}];}return db[_0x2e02('0x2d')][_0x2e02('0x40')](_0x5dbd8d);})['then'](function(_0x3e3abc){_0x389899[_0x2e02('0x41')]=_0x3e3abc;return _0x389899;})[_0x2e02('0x24')](respondWithFilteredResult(_0x429ce6,_0x5dbd8d))[_0x2e02('0x42')](handleError(_0x429ce6,null));};exports[_0x2e02('0x43')]=function(_0x2a74d3,_0x579c88){var _0x497af4={'raw':!![],'where':{'id':_0x2a74d3['params']['id']}},_0x4e22bf={};_0x4e22bf[_0x2e02('0x32')]=_[_0x2e02('0x44')](db[_0x2e02('0x2d')][_0x2e02('0x45')]);_0x4e22bf[_0x2e02('0x30')]=_[_0x2e02('0x44')](_0x2a74d3['query']);_0x4e22bf[_0x2e02('0x3b')]=_[_0x2e02('0x31')](_0x4e22bf[_0x2e02('0x32')],_0x4e22bf[_0x2e02('0x30')]);_0x497af4['attributes']=_[_0x2e02('0x31')](_0x4e22bf[_0x2e02('0x32')],qs[_0x2e02('0x33')](_0x2a74d3[_0x2e02('0x30')][_0x2e02('0x33')]));_0x497af4[_0x2e02('0x34')]=_0x497af4[_0x2e02('0x34')]['length']?_0x497af4[_0x2e02('0x34')]:_0x4e22bf['model'];if(_0x2a74d3['query'][_0x2e02('0x46')]){_0x497af4[_0x2e02('0x3f')]=[{'all':!![]}];}_0x497af4=_[_0x2e02('0x3d')]({},_0x497af4,_0x2a74d3['options']);return db[_0x2e02('0x2d')][_0x2e02('0x47')](_0x497af4)['then'](handleEntityNotFound(_0x579c88,null))[_0x2e02('0x24')](respondWithResult(_0x579c88,null))['catch'](handleError(_0x579c88,null));};exports[_0x2e02('0x48')]=function(_0x4d6607,_0x7317b2){return db[_0x2e02('0x2d')][_0x2e02('0x48')](_0x4d6607['body'],{})[_0x2e02('0x24')](function(_0xecc380){var _0x15b408=_0x4d6607[_0x2e02('0x49')][_0x2e02('0x26')]({'plain':!![]});if(!_0x15b408)throw new Error(_0x2e02('0x4a'));if(_0x15b408['role']===_0x2e02('0x49')){var _0x1d171c=_0xecc380[_0x2e02('0x26')]({'plain':!![]});var _0x31138e=_0x2e02('0x27');return db[_0x2e02('0x4b')][_0x2e02('0x47')]({'where':{'name':_0x31138e,'userProfileId':_0x15b408[_0x2e02('0x4c')]},'raw':!![]})[_0x2e02('0x24')](function(_0x541a45){if(_0x541a45&&_0x541a45['autoAssociation']===0x0){return db[_0x2e02('0x4d')][_0x2e02('0x48')]({'name':_0x1d171c[_0x2e02('0x2a')],'resourceId':_0x1d171c['id'],'type':_0x541a45[_0x2e02('0x2a')],'sectionId':_0x541a45['id']},{})['then'](function(){return _0xecc380;});}else{return _0xecc380;}})[_0x2e02('0x42')](function(_0x4633f6){logger[_0x2e02('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4633f6);throw _0x4633f6;});}return _0xecc380;})[_0x2e02('0x24')](respondWithResult(_0x7317b2,0xc9))[_0x2e02('0x42')](handleError(_0x7317b2,null));};exports[_0x2e02('0x23')]=function(_0x5f589e,_0x425d21){if(_0x5f589e[_0x2e02('0x4e')]['id']){delete _0x5f589e['body']['id'];}return db[_0x2e02('0x2d')][_0x2e02('0x47')]({'where':{'id':_0x5f589e[_0x2e02('0x4f')]['id']}})[_0x2e02('0x24')](handleEntityNotFound(_0x425d21,null))['then'](saveUpdates(_0x5f589e[_0x2e02('0x4e')],null))[_0x2e02('0x24')](respondWithResult(_0x425d21,null))[_0x2e02('0x42')](handleError(_0x425d21,null));};exports[_0x2e02('0x25')]=function(_0x2313b1,_0x50351b){return db[_0x2e02('0x2d')][_0x2e02('0x47')]({'where':{'id':_0x2313b1[_0x2e02('0x4f')]['id']}})[_0x2e02('0x24')](handleEntityNotFound(_0x50351b,null))[_0x2e02('0x24')](removeEntity(_0x50351b,null))[_0x2e02('0x42')](handleError(_0x50351b,null));};exports['addInterval']=function(_0xc2eac0,_0x144872,_0x3b04e6){if(_0xc2eac0[_0x2e02('0x4e')]['id']){delete _0xc2eac0['body']['id'];}return db[_0x2e02('0x2d')]['find']({'where':{'id':_0xc2eac0[_0x2e02('0x4f')]['id']}})[_0x2e02('0x24')](handleEntityNotFound(_0x144872,null))[_0x2e02('0x24')](function(_0x51c807){if(_0x51c807){_0xc2eac0[_0x2e02('0x4e')]['IntervalId']=_0x51c807['id'];return db['Interval'][_0x2e02('0x48')](_0xc2eac0[_0x2e02('0x4e')]);}})[_0x2e02('0x24')](respondWithResult(_0x144872,null))[_0x2e02('0x42')](handleError(_0x144872,null));};exports[_0x2e02('0x50')]=function(_0x4a14dc,_0x58eb2c,_0xd2a9b1){var _0x2bf495={};var _0x35e139={};var _0x4de6f1;var _0x4cce5c;return db[_0x2e02('0x2d')][_0x2e02('0x51')]({'where':{'id':_0x4a14dc[_0x2e02('0x4f')]['id']}})[_0x2e02('0x24')](handleEntityNotFound(_0x58eb2c,null))[_0x2e02('0x24')](function(_0x5c926f){if(_0x5c926f){_0x4de6f1=_0x5c926f;_0x35e139[_0x2e02('0x32')]=_[_0x2e02('0x44')](db[_0x2e02('0x2d')][_0x2e02('0x45')]);_0x35e139[_0x2e02('0x30')]=_[_0x2e02('0x44')](_0x4a14dc[_0x2e02('0x30')]);_0x35e139[_0x2e02('0x3b')]=_['intersection'](_0x35e139[_0x2e02('0x32')],_0x35e139[_0x2e02('0x30')]);_0x2bf495[_0x2e02('0x34')]=_[_0x2e02('0x31')](_0x35e139[_0x2e02('0x32')],qs[_0x2e02('0x33')](_0x4a14dc['query'][_0x2e02('0x33')]));_0x2bf495[_0x2e02('0x34')]=_0x2bf495['attributes']['length']?_0x2bf495['attributes']:_0x35e139[_0x2e02('0x32')];_0x2bf495[_0x2e02('0x37')]=qs[_0x2e02('0x38')](_0x4a14dc[_0x2e02('0x30')][_0x2e02('0x38')]);_0x2bf495[_0x2e02('0x39')]=qs[_0x2e02('0x3b')](_[_0x2e02('0x3a')](_0x4a14dc[_0x2e02('0x30')],_0x35e139[_0x2e02('0x3b')]));if(_0x4a14dc[_0x2e02('0x30')][_0x2e02('0x3c')]){_0x2bf495[_0x2e02('0x39')]=_['merge'](_0x2bf495[_0x2e02('0x39')],{'$or':_['map'](_0x2bf495[_0x2e02('0x34')],function(_0x2150db){var _0x203d51={};_0x203d51[_0x2150db]={'$like':'%'+_0x4a14dc['query']['filter']+'%'};return _0x203d51;})});}_0x2bf495=_[_0x2e02('0x3d')]({},_0x2bf495,_0x4a14dc[_0x2e02('0x3e')]);return _0x4de6f1[_0x2e02('0x50')](_0x2bf495);}})[_0x2e02('0x24')](function(_0x666b31){if(_0x666b31){_0x4cce5c=_0x666b31[_0x2e02('0x35')];if(!_0x4a14dc['query'][_0x2e02('0x52')](_0x2e02('0x36'))){_0x2bf495[_0x2e02('0x1d')]=qs['limit'](_0x4a14dc[_0x2e02('0x30')][_0x2e02('0x1d')]);_0x2bf495[_0x2e02('0x1b')]=qs[_0x2e02('0x1b')](_0x4a14dc['query'][_0x2e02('0x1b')]);}return _0x4de6f1['getIntervals'](_0x2bf495);}})['then'](function(_0x491028){if(_0x491028){return _0x491028?{'count':_0x4cce5c,'rows':_0x491028}:null;}})[_0x2e02('0x24')](respondWithResult(_0x58eb2c,null))[_0x2e02('0x42')](handleError(_0x58eb2c,null));};exports[_0x2e02('0x53')]=function(_0x2fbd04,_0x1c57bd,_0x295a76){return db['Interval'][_0x2e02('0x51')]({'where':{'id':_0x2fbd04['params']['id']}})[_0x2e02('0x24')](handleEntityNotFound(_0x1c57bd,null))[_0x2e02('0x24')](function(_0x572134){if(_0x572134){return db['sequelize'][_0x2e02('0x54')](function(_0x38bc0a){return db[_0x2e02('0x2d')][_0x2e02('0x25')]({'where':{'IntervalId':_0x2fbd04[_0x2e02('0x4f')]['id']},'transaction':_0x38bc0a})[_0x2e02('0x24')](function(_0x4c947e){var _0x2c23ed=_[_0x2e02('0x2c')](_0x2fbd04[_0x2e02('0x4e')],function(_0x5edf6d){delete _0x5edf6d['id'];_0x5edf6d['IntervalId']=_0x2fbd04[_0x2e02('0x4f')]['id'];return _0x5edf6d;});return db[_0x2e02('0x2d')][_0x2e02('0x55')](_0x2c23ed,{'transaction':_0x38bc0a});});})[_0x2e02('0x24')](function(){return db['Interval'][_0x2e02('0x40')]({'where':{'IntervalId':_0x2fbd04['params']['id']}});});}})[_0x2e02('0x24')](respondWithResult(_0x1c57bd,null))['catch'](handleError(_0x1c57bd,null));}; \ No newline at end of file +var _0x73b9=['save','update','then','Intervals','UserProfileResource','name','index','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','getIntervals','findOne','options','length','addIntervals','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x73b9,0x8f));var _0x973b=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0x73b9[_0x216428];return _0x313dd4;};'use strict';var emlformat=require(_0x973b('0x0'));var rimraf=require(_0x973b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x973b('0x2'));var rp=require(_0x973b('0x3'));var moment=require(_0x973b('0x4'));var BPromise=require(_0x973b('0x5'));var Mustache=require(_0x973b('0x6'));var util=require(_0x973b('0x7'));var path=require(_0x973b('0x8'));var sox=require(_0x973b('0x9'));var csv=require(_0x973b('0xa'));var ejs=require(_0x973b('0xb'));var fs=require('fs');var fs_extra=require(_0x973b('0xc'));var _=require(_0x973b('0xd'));var squel=require('squel');var crypto=require(_0x973b('0xe'));var jsforce=require(_0x973b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x973b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x973b('0x10'));var authService=require(_0x973b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x973b('0x12'));var logger=require(_0x973b('0x13'))(_0x973b('0x14'));var utils=require(_0x973b('0x15'));var config=require(_0x973b('0x16'));var licenseUtil=require(_0x973b('0x17'));var db=require(_0x973b('0x18'))['db'];var extensions=require(_0x973b('0x19'));function respondWithStatusCode(_0x10a02f,_0xca8ad8){_0xca8ad8=_0xca8ad8||0xcc;return function(_0xf67ea9){if(_0xf67ea9){return _0x10a02f[_0x973b('0x1a')](_0xca8ad8);}return _0x10a02f[_0x973b('0x1b')](_0xca8ad8)[_0x973b('0x1c')]();};}function respondWithResult(_0x1bd896,_0x47d82c){_0x47d82c=_0x47d82c||0xc8;return function(_0x2969da){if(_0x2969da){return _0x1bd896[_0x973b('0x1b')](_0x47d82c)[_0x973b('0x1d')](_0x2969da);}};}function respondWithFilteredResult(_0x432798,_0x370507){return function(_0x488c79){if(_0x488c79){var _0x3f4c2e=typeof _0x370507[_0x973b('0x1e')]==='undefined'&&typeof _0x370507[_0x973b('0x1f')]===_0x973b('0x20');var _0x1f43d2=_0x488c79['count'];var _0x2336a5=_0x3f4c2e?0x0:_0x370507[_0x973b('0x1e')];var _0x50ffc4=_0x3f4c2e?_0x488c79[_0x973b('0x21')]:_0x370507[_0x973b('0x1e')]+_0x370507[_0x973b('0x1f')];var _0x26cd15;if(_0x50ffc4>=_0x1f43d2){_0x50ffc4=_0x1f43d2;_0x26cd15=0xc8;}else{_0x26cd15=0xce;}_0x432798['status'](_0x26cd15);return _0x432798[_0x973b('0x22')](_0x973b('0x23'),_0x2336a5+'-'+_0x50ffc4+'/'+_0x1f43d2)['json'](_0x488c79);}return null;};}function patchUpdates(_0x233e75){return function(_0x53e181){try{jsonpatch['apply'](_0x53e181,_0x233e75,!![]);}catch(_0x29a510){return BPromise[_0x973b('0x24')](_0x29a510);}return _0x53e181[_0x973b('0x25')]();};}function saveUpdates(_0x365843,_0x872c8d){return function(_0x56695c){if(_0x56695c){return _0x56695c[_0x973b('0x26')](_0x365843)[_0x973b('0x27')](function(_0x48dd8e){return _0x48dd8e;});}return null;};}function removeEntity(_0x206a42,_0x42e89f){return function(_0x5bef1b){if(_0x5bef1b){return _0x5bef1b['destroy']()['then'](function(){var _0x3f3b60=_0x5bef1b['get']({'plain':!![]});var _0x45f179=_0x973b('0x28');return db[_0x973b('0x29')]['destroy']({'where':{'type':_0x45f179,'resourceId':_0x3f3b60['id']}})['then'](function(){return _0x5bef1b;});})[_0x973b('0x27')](function(){_0x206a42[_0x973b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5886ff,_0x25493f){return function(_0x39d82a){if(!_0x39d82a){_0x5886ff[_0x973b('0x1a')](0x194);}return _0x39d82a;};}function handleError(_0x2fe4eb,_0x2d1cce){_0x2d1cce=_0x2d1cce||0x1f4;return function(_0x88fc18){logger['error'](_0x88fc18['stack']);if(_0x88fc18[_0x973b('0x2a')]){delete _0x88fc18[_0x973b('0x2a')];}_0x2fe4eb[_0x973b('0x1b')](_0x2d1cce)['send'](_0x88fc18);};}exports[_0x973b('0x2b')]=function(_0x56ed6e,_0x321e65){var _0x39263b={},_0x375a8d={},_0x29a104={'count':0x0,'rows':[]};var _0x648d15=_['map'](db[_0x973b('0x2c')][_0x973b('0x2d')],function(_0x30c6cb){return{'name':_0x30c6cb['fieldName'],'type':_0x30c6cb[_0x973b('0x2e')][_0x973b('0x2f')]};});_0x375a8d[_0x973b('0x30')]=_['map'](_0x648d15,_0x973b('0x2a'));_0x375a8d[_0x973b('0x31')]=_[_0x973b('0x32')](_0x56ed6e[_0x973b('0x31')]);_0x375a8d[_0x973b('0x33')]=_[_0x973b('0x34')](_0x375a8d[_0x973b('0x30')],_0x375a8d[_0x973b('0x31')]);_0x39263b['attributes']=_['intersection'](_0x375a8d[_0x973b('0x30')],qs['fields'](_0x56ed6e['query'][_0x973b('0x35')]));_0x39263b['attributes']=_0x39263b[_0x973b('0x36')]['length']?_0x39263b[_0x973b('0x36')]:_0x375a8d[_0x973b('0x30')];if(!_0x56ed6e[_0x973b('0x31')][_0x973b('0x37')](_0x973b('0x38'))){_0x39263b[_0x973b('0x1f')]=qs[_0x973b('0x1f')](_0x56ed6e[_0x973b('0x31')][_0x973b('0x1f')]);_0x39263b[_0x973b('0x1e')]=qs['offset'](_0x56ed6e[_0x973b('0x31')][_0x973b('0x1e')]);}_0x39263b[_0x973b('0x39')]=qs['sort'](_0x56ed6e[_0x973b('0x31')][_0x973b('0x3a')]);_0x39263b[_0x973b('0x3b')]=qs[_0x973b('0x33')](_[_0x973b('0x3c')](_0x56ed6e[_0x973b('0x31')],_0x375a8d['filters']),_0x648d15);if(_0x56ed6e['query'][_0x973b('0x3d')]){_0x39263b[_0x973b('0x3b')]=_[_0x973b('0x3e')](_0x39263b[_0x973b('0x3b')],{'$or':_[_0x973b('0x3f')](_0x648d15,function(_0x10659d){if(_0x10659d[_0x973b('0x2e')]!==_0x973b('0x40')){var _0x23539f={};_0x23539f[_0x10659d['name']]={'$like':'%'+_0x56ed6e['query']['filter']+'%'};return _0x23539f;}})});}_0x39263b=_[_0x973b('0x3e')]({},_0x39263b,_0x56ed6e['options']);var _0x1cd984={'where':_0x39263b['where']};return db['Interval']['count'](_0x1cd984)[_0x973b('0x27')](function(_0x89e020){_0x29a104[_0x973b('0x21')]=_0x89e020;if(_0x56ed6e['query']['includeAll']){_0x39263b[_0x973b('0x41')]=[{'all':!![]}];}return db[_0x973b('0x2c')][_0x973b('0x42')](_0x39263b);})[_0x973b('0x27')](function(_0x38aa92){_0x29a104['rows']=_0x38aa92;return _0x29a104;})[_0x973b('0x27')](respondWithFilteredResult(_0x321e65,_0x39263b))['catch'](handleError(_0x321e65,null));};exports['show']=function(_0x5bfe96,_0x4d30be){var _0x490343={'raw':!![],'where':{'id':_0x5bfe96[_0x973b('0x43')]['id']}},_0x3cdca9={};_0x3cdca9[_0x973b('0x30')]=_['keys'](db[_0x973b('0x2c')][_0x973b('0x2d')]);_0x3cdca9[_0x973b('0x31')]=_[_0x973b('0x32')](_0x5bfe96[_0x973b('0x31')]);_0x3cdca9[_0x973b('0x33')]=_[_0x973b('0x34')](_0x3cdca9[_0x973b('0x30')],_0x3cdca9[_0x973b('0x31')]);_0x490343['attributes']=_['intersection'](_0x3cdca9[_0x973b('0x30')],qs['fields'](_0x5bfe96[_0x973b('0x31')][_0x973b('0x35')]));_0x490343[_0x973b('0x36')]=_0x490343[_0x973b('0x36')]['length']?_0x490343[_0x973b('0x36')]:_0x3cdca9[_0x973b('0x30')];if(_0x5bfe96[_0x973b('0x31')]['includeAll']){_0x490343[_0x973b('0x41')]=[{'all':!![]}];}_0x490343=_[_0x973b('0x3e')]({},_0x490343,_0x5bfe96['options']);return db['Interval'][_0x973b('0x44')](_0x490343)[_0x973b('0x27')](handleEntityNotFound(_0x4d30be,null))[_0x973b('0x27')](respondWithResult(_0x4d30be,null))[_0x973b('0x45')](handleError(_0x4d30be,null));};exports[_0x973b('0x46')]=function(_0x313aaa,_0x2c94c6){return db['Interval'][_0x973b('0x46')](_0x313aaa[_0x973b('0x47')],{})[_0x973b('0x27')](function(_0x41613c){var _0x5d6d3d=_0x313aaa[_0x973b('0x48')][_0x973b('0x49')]({'plain':!![]});if(!_0x5d6d3d)throw new Error(_0x973b('0x4a'));if(_0x5d6d3d[_0x973b('0x4b')]===_0x973b('0x48')){var _0x42d710=_0x41613c['get']({'plain':!![]});var _0x25630c=_0x973b('0x28');return db[_0x973b('0x4c')]['find']({'where':{'name':_0x25630c,'userProfileId':_0x5d6d3d[_0x973b('0x4d')]},'raw':!![]})[_0x973b('0x27')](function(_0x395a1e){if(_0x395a1e&&_0x395a1e[_0x973b('0x4e')]===0x0){return db['UserProfileResource'][_0x973b('0x46')]({'name':_0x42d710[_0x973b('0x2a')],'resourceId':_0x42d710['id'],'type':_0x395a1e[_0x973b('0x2a')],'sectionId':_0x395a1e['id']},{})[_0x973b('0x27')](function(){return _0x41613c;});}else{return _0x41613c;}})[_0x973b('0x45')](function(_0x39e954){logger[_0x973b('0x4f')](_0x973b('0x50'),_0x39e954);throw _0x39e954;});}return _0x41613c;})[_0x973b('0x27')](respondWithResult(_0x2c94c6,0xc9))[_0x973b('0x45')](handleError(_0x2c94c6,null));};exports[_0x973b('0x26')]=function(_0x5f706f,_0x43720c){if(_0x5f706f[_0x973b('0x47')]['id']){delete _0x5f706f[_0x973b('0x47')]['id'];}return db[_0x973b('0x2c')]['find']({'where':{'id':_0x5f706f[_0x973b('0x43')]['id']}})[_0x973b('0x27')](handleEntityNotFound(_0x43720c,null))[_0x973b('0x27')](saveUpdates(_0x5f706f[_0x973b('0x47')],null))['then'](respondWithResult(_0x43720c,null))[_0x973b('0x45')](handleError(_0x43720c,null));};exports[_0x973b('0x51')]=function(_0x27ba09,_0x59337e){return db['Interval'][_0x973b('0x44')]({'where':{'id':_0x27ba09['params']['id']}})['then'](handleEntityNotFound(_0x59337e,null))['then'](removeEntity(_0x59337e,null))[_0x973b('0x45')](handleError(_0x59337e,null));};exports[_0x973b('0x52')]=function(_0x41005f,_0x5a64d1,_0x2154af){if(_0x41005f['body']['id']){delete _0x41005f[_0x973b('0x47')]['id'];}return db[_0x973b('0x2c')][_0x973b('0x44')]({'where':{'id':_0x41005f[_0x973b('0x43')]['id']}})[_0x973b('0x27')](handleEntityNotFound(_0x5a64d1,null))['then'](function(_0x4cf648){if(_0x4cf648){_0x41005f[_0x973b('0x47')]['IntervalId']=_0x4cf648['id'];return db['Interval'][_0x973b('0x46')](_0x41005f['body']);}})[_0x973b('0x27')](respondWithResult(_0x5a64d1,null))['catch'](handleError(_0x5a64d1,null));};exports[_0x973b('0x53')]=function(_0x3de9e5,_0x247c3d,_0x2fbab8){var _0x47ceda={};var _0x33a195={};var _0xad66be;var _0x378f79;return db[_0x973b('0x2c')][_0x973b('0x54')]({'where':{'id':_0x3de9e5[_0x973b('0x43')]['id']}})[_0x973b('0x27')](handleEntityNotFound(_0x247c3d,null))[_0x973b('0x27')](function(_0x337a66){if(_0x337a66){_0xad66be=_0x337a66;_0x33a195[_0x973b('0x30')]=_[_0x973b('0x32')](db['Interval']['rawAttributes']);_0x33a195[_0x973b('0x31')]=_[_0x973b('0x32')](_0x3de9e5[_0x973b('0x31')]);_0x33a195[_0x973b('0x33')]=_[_0x973b('0x34')](_0x33a195['model'],_0x33a195['query']);_0x47ceda['attributes']=_['intersection'](_0x33a195[_0x973b('0x30')],qs[_0x973b('0x35')](_0x3de9e5[_0x973b('0x31')]['fields']));_0x47ceda[_0x973b('0x36')]=_0x47ceda['attributes']['length']?_0x47ceda[_0x973b('0x36')]:_0x33a195[_0x973b('0x30')];_0x47ceda[_0x973b('0x39')]=qs[_0x973b('0x3a')](_0x3de9e5[_0x973b('0x31')][_0x973b('0x3a')]);_0x47ceda['where']=qs[_0x973b('0x33')](_[_0x973b('0x3c')](_0x3de9e5[_0x973b('0x31')],_0x33a195[_0x973b('0x33')]));if(_0x3de9e5['query'][_0x973b('0x3d')]){_0x47ceda[_0x973b('0x3b')]=_[_0x973b('0x3e')](_0x47ceda[_0x973b('0x3b')],{'$or':_[_0x973b('0x3f')](_0x47ceda[_0x973b('0x36')],function(_0x38d59b){var _0x442eb5={};_0x442eb5[_0x38d59b]={'$like':'%'+_0x3de9e5[_0x973b('0x31')]['filter']+'%'};return _0x442eb5;})});}_0x47ceda=_[_0x973b('0x3e')]({},_0x47ceda,_0x3de9e5[_0x973b('0x55')]);return _0xad66be[_0x973b('0x53')](_0x47ceda);}})[_0x973b('0x27')](function(_0x2a90ca){if(_0x2a90ca){_0x378f79=_0x2a90ca[_0x973b('0x56')];if(!_0x3de9e5[_0x973b('0x31')][_0x973b('0x37')](_0x973b('0x38'))){_0x47ceda[_0x973b('0x1f')]=qs[_0x973b('0x1f')](_0x3de9e5[_0x973b('0x31')][_0x973b('0x1f')]);_0x47ceda[_0x973b('0x1e')]=qs[_0x973b('0x1e')](_0x3de9e5[_0x973b('0x31')][_0x973b('0x1e')]);}return _0xad66be[_0x973b('0x53')](_0x47ceda);}})[_0x973b('0x27')](function(_0x91de88){if(_0x91de88){return _0x91de88?{'count':_0x378f79,'rows':_0x91de88}:null;}})[_0x973b('0x27')](respondWithResult(_0x247c3d,null))['catch'](handleError(_0x247c3d,null));};exports[_0x973b('0x57')]=function(_0x416bd1,_0xd373b9,_0x415bdc){return db['Interval'][_0x973b('0x54')]({'where':{'id':_0x416bd1[_0x973b('0x43')]['id']}})[_0x973b('0x27')](handleEntityNotFound(_0xd373b9,null))[_0x973b('0x27')](function(_0xab0ac9){if(_0xab0ac9){return db['sequelize']['transaction'](function(_0x30911c){return db[_0x973b('0x2c')][_0x973b('0x51')]({'where':{'IntervalId':_0x416bd1[_0x973b('0x43')]['id']},'transaction':_0x30911c})[_0x973b('0x27')](function(_0x3a37fd){var _0xf93d13=_[_0x973b('0x3f')](_0x416bd1[_0x973b('0x47')],function(_0xe9c142){delete _0xe9c142['id'];_0xe9c142[_0x973b('0x58')]=_0x416bd1[_0x973b('0x43')]['id'];return _0xe9c142;});return db[_0x973b('0x2c')][_0x973b('0x59')](_0xf93d13,{'transaction':_0x30911c});});})['then'](function(){return db['Interval'][_0x973b('0x42')]({'where':{'IntervalId':_0x416bd1[_0x973b('0x43')]['id']}});});}})['then'](respondWithResult(_0xd373b9,null))['catch'](handleError(_0xd373b9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b12506a..989ba1b 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 _0x3479=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','util','../../config/logger','api','moment','path','rimraf'];(function(_0x12190b,_0x585a3b){var _0x2656b8=function(_0x21dea1){while(--_0x21dea1){_0x12190b['push'](_0x12190b['shift']());}};_0x2656b8(++_0x585a3b);}(_0x3479,0x18d));var _0x9347=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0x3479[_0x53b6ae];return _0x34f4b2;};'use strict';var _=require('lodash');var util=require(_0x9347('0x0'));var logger=require(_0x9347('0x1'))(_0x9347('0x2'));var moment=require(_0x9347('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9347('0x4'));var rimraf=require(_0x9347('0x5'));var config=require(_0x9347('0x6'));var attributes=require(_0x9347('0x7'));var extensions=require(_0x9347('0x8'));module[_0x9347('0x9')]=function(_0x17ac7b,_0x11bedb){return _0x17ac7b[_0x9347('0xa')](_0x9347('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37234e,_0x288301){extensions[_0x9347('0xc')](_0x17ac7b,_0x37234e);},'afterBulkCreate':function(_0x1885de,_0x1c5c5d,_0x3c6b93){_0x3c6b93();extensions['rewrite'](_0x17ac7b,_0x1885de[0x0]);},'afterUpdate':function(_0x56a20f,_0x443f71){extensions[_0x9347('0xc')](_0x17ac7b,_0x56a20f);},'afterDestroy':function(_0x5f26d2,_0x59924b){extensions[_0x9347('0xc')](_0x17ac7b,_0x5f26d2);}}});}; \ No newline at end of file +var _0x3d74=['define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../components/extensions/rewrite','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3d74,0x149));var _0x43d7=function(_0x56b7fa,_0x1c9a76){_0x56b7fa=_0x56b7fa-0x0;var _0x29bc82=_0x3d74[_0x56b7fa];return _0x29bc82;};'use strict';var _=require(_0x43d7('0x0'));var util=require(_0x43d7('0x1'));var logger=require(_0x43d7('0x2'))(_0x43d7('0x3'));var moment=require(_0x43d7('0x4'));var BPromise=require('bluebird');var rp=require(_0x43d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43d7('0x6'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x43d7('0x7'));module[_0x43d7('0x8')]=function(_0x23204a,_0x2dd33c){return _0x23204a[_0x43d7('0x9')](_0x43d7('0xa'),attributes,{'tableName':_0x43d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x23e06a,_0x27a691){extensions[_0x43d7('0xc')](_0x23204a,_0x23e06a);},'afterBulkCreate':function(_0x5048ec,_0xcf3f4d,_0x11f557){_0x11f557();extensions[_0x43d7('0xc')](_0x23204a,_0x5048ec[0x0]);},'afterUpdate':function(_0x5dfbd1,_0x4288ec){extensions[_0x43d7('0xc')](_0x23204a,_0x5dfbd1);},'afterDestroy':function(_0x583310,_0x20e0eb){extensions[_0x43d7('0xc')](_0x23204a,_0x583310);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 263cc78..b5ea7ee 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(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 7d56774..203d11b 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x39cdec,_0x2b35f3){var _0x1245a6=function(_0x44ccb6){while(--_0x44ccb6){_0x39cdec['push'](_0x39cdec['shift']());}};_0x1245a6(++_0x2b35f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x402015,_0x178bb7){_0x402015=_0x402015-0x0;var _0x16a7b7=_0x5f2f[_0x402015];return _0x16a7b7;};'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 +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 102e979..96aecc0 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 _0x9b06=['support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','fields','customfield_11500','email','oldToken','newToken','customfield_11504','reason','/rest/api/2/issue','POST','Basic\x20','stringify','request','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x9b06,0xf8));var _0x69b0=function(_0x56a1d0,_0x16a437){_0x56a1d0=_0x56a1d0-0x0;var _0x5952c4=_0x9b06[_0x56a1d0];return _0x5952c4;};'use strict';var BPromise=require(_0x69b0('0x0'));var https=require(_0x69b0('0x1'));var logger=require(_0x69b0('0x2'))(_0x69b0('0x3'));var USERNAME=_0x69b0('0x4');var PASSWORD=_0x69b0('0x5');function openIssue(_0x52e908,_0x4b511d){var _0x535e65={'fields':{'project':{'key':_0x52e908[_0x69b0('0x6')]||_0x69b0('0x7')},'summary':(_0x52e908[_0x69b0('0x8')]||_0x69b0('0x9'))+_0x69b0('0xa')+_0x52e908['ip'],'description':_0x52e908[_0x69b0('0xb')]||JSON['stringify'](_0x52e908),'issuetype':{'name':_0x52e908[_0x69b0('0xc')]||'Bug'}}};_0x535e65[_0x69b0('0xd')][_0x69b0('0xe')]=_0x52e908[_0x69b0('0xf')];_0x535e65[_0x69b0('0xd')]['customfield_11501']=_0x52e908[_0x69b0('0x10')];_0x535e65[_0x69b0('0xd')]['customfield_11502']=_0x52e908[_0x69b0('0x11')];_0x535e65[_0x69b0('0xd')]['customfield_11503']=_0x52e908['name'];_0x535e65[_0x69b0('0xd')][_0x69b0('0x12')]=_0x52e908[_0x69b0('0x13')];_0x535e65[_0x69b0('0xd')]['customfield_10102']=_0x52e908['ip'];var _0x1a8eb2={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x69b0('0x14'),'method':_0x69b0('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x69b0('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x3e2014=JSON[_0x69b0('0x17')](_0x535e65);var _0x460157=https[_0x69b0('0x18')](_0x1a8eb2,function(_0x14f453){_0x14f453['setEncoding'](_0x69b0('0x19'));var _0x23261b='';_0x14f453['on'](_0x69b0('0x1a'),function(_0x2b810c){_0x23261b+=_0x2b810c;});_0x14f453['on'](_0x69b0('0x1b'),function(){if(_0x4b511d){return _0x4b511d[_0x69b0('0x1c')](_0x14f453[_0x69b0('0x1d')])[_0x69b0('0x1e')](JSON[_0x69b0('0x1f')](_0x23261b));}});});_0x460157['on'](_0x69b0('0x20'),function(_0x29ef76){if(_0x4b511d){return _0x4b511d[_0x69b0('0x1c')](0x1f4)['json']({'errors':[{'message':_0x69b0('0x21'),'type':_0x69b0('0x22')}]});}});_0x460157[_0x69b0('0x23')](_0x3e2014);_0x460157[_0x69b0('0x1b')]();}exports['openIssue']=openIssue;exports[_0x69b0('0x24')]=function(_0x40598e,_0xcc9231){_0x40598e['body']['ip']=_0x40598e[_0x69b0('0x25')][_0x69b0('0x26')]||_0x40598e[_0x69b0('0x27')]['remoteAddress']||_0x40598e[_0x69b0('0x28')][_0x69b0('0x29')]||_0x40598e['connection'][_0x69b0('0x28')][_0x69b0('0x29')];return openIssue(_0x40598e['body'],_0xcc9231);}; \ No newline at end of file +var _0x4c77=['/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com'];(function(_0x452f13,_0x5bb1a5){var _0x2d2ce7=function(_0x3dd354){while(--_0x3dd354){_0x452f13['push'](_0x452f13['shift']());}};_0x2d2ce7(++_0x5bb1a5);}(_0x4c77,0x12a));var _0x74c7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4c77[_0x178e48];return _0x440d7e;};'use strict';var BPromise=require(_0x74c7('0x0'));var https=require(_0x74c7('0x1'));var logger=require(_0x74c7('0x2'))(_0x74c7('0x3'));var USERNAME=_0x74c7('0x4');var PASSWORD=_0x74c7('0x5');function openIssue(_0x35da85,_0x3b4ad0){var _0x133c97={'fields':{'project':{'key':_0x35da85[_0x74c7('0x6')]||_0x74c7('0x7')},'summary':(_0x35da85[_0x74c7('0x8')]||'Report')+'\x20from\x20'+_0x35da85['ip'],'description':_0x35da85['description']||JSON[_0x74c7('0x9')](_0x35da85),'issuetype':{'name':_0x35da85[_0x74c7('0xa')]||_0x74c7('0xb')}}};_0x133c97[_0x74c7('0xc')]['customfield_11500']=_0x35da85[_0x74c7('0xd')];_0x133c97[_0x74c7('0xc')][_0x74c7('0xe')]=_0x35da85[_0x74c7('0xf')];_0x133c97[_0x74c7('0xc')][_0x74c7('0x10')]=_0x35da85[_0x74c7('0x11')];_0x133c97['fields'][_0x74c7('0x12')]=_0x35da85[_0x74c7('0x13')];_0x133c97[_0x74c7('0xc')][_0x74c7('0x14')]=_0x35da85[_0x74c7('0x15')];_0x133c97[_0x74c7('0xc')][_0x74c7('0x16')]=_0x35da85['ip'];var _0x5df665={'host':_0x74c7('0x17'),'port':0x1bb,'path':_0x74c7('0x18'),'method':_0x74c7('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x74c7('0x1a'),'Authorization':_0x74c7('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x74c7('0x1c')]('base64')}};var _0x2a395a=JSON['stringify'](_0x133c97);var _0x635bf6=https[_0x74c7('0x1d')](_0x5df665,function(_0x5cf2dc){_0x5cf2dc[_0x74c7('0x1e')]('utf8');var _0x29d361='';_0x5cf2dc['on']('data',function(_0x247d50){_0x29d361+=_0x247d50;});_0x5cf2dc['on'](_0x74c7('0x1f'),function(){if(_0x3b4ad0){return _0x3b4ad0[_0x74c7('0x20')](_0x5cf2dc['statusCode'])[_0x74c7('0x21')](JSON[_0x74c7('0x22')](_0x29d361));}});});_0x635bf6['on'](_0x74c7('0x23'),function(_0x306359){if(_0x3b4ad0){return _0x3b4ad0[_0x74c7('0x20')](0x1f4)[_0x74c7('0x21')]({'errors':[{'message':_0x74c7('0x24'),'type':_0x74c7('0x25')}]});}});_0x635bf6[_0x74c7('0x26')](_0x2a395a);_0x635bf6[_0x74c7('0x1f')]();}exports[_0x74c7('0x27')]=openIssue;exports['send']=function(_0x232efb,_0x3ab21f){_0x232efb['body']['ip']=_0x232efb[_0x74c7('0x28')][_0x74c7('0x29')]||_0x232efb[_0x74c7('0x2a')][_0x74c7('0x2b')]||_0x232efb[_0x74c7('0x2c')]['remoteAddress']||_0x232efb[_0x74c7('0x2a')][_0x74c7('0x2c')][_0x74c7('0x2b')];return openIssue(_0x232efb[_0x74c7('0x2d')],_0x3ab21f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a505998..b8e403a 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 _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xda55,0x6d));var _0x5da5=function(_0x4d6675,_0x23beaa){_0x4d6675=_0x4d6675-0x0;var _0x2bd5bc=_0xda55[_0x4d6675];return _0x2bd5bc;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32dbdb,_0x426ed9){var _0x1c7dd1=function(_0x3bde8e){while(--_0x3bde8e){_0x32dbdb['push'](_0x32dbdb['shift']());}};_0x1c7dd1(++_0x426ed9);}(_0x22fb,0x192));var _0xb22f=function(_0x5cc469,_0x5630e8){_0x5cc469=_0x5cc469-0x0;var _0x4c3aa5=_0x22fb[_0x5cc469];return _0x4c3aa5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1b0edaa..66e6a03 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x4c025f,_0x1d5fa2){_0x4c025f=_0x4c025f-0x0;var _0x48a64e=_0x7a54[_0x4c025f];return _0x48a64e;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0xf48e7d,_0x2b7132){_0xf48e7d=_0xf48e7d-0x0;var _0x4b210f=_0x7a54[_0xf48e7d];return _0x4b210f;};'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 45e6bad..effd532 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 _0xfc65=['type','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x437724,_0x1dd4d7){var _0x155c04=function(_0x36c223){while(--_0x36c223){_0x437724['push'](_0x437724['shift']());}};_0x155c04(++_0x1dd4d7);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x431ae4,_0x3d81e7){_0x431ae4=_0x431ae4-0x0;var _0x1d71bb=_0xfc65[_0x431ae4];return _0x1d71bb;};'use strict';var emlformat=require(_0x5fc6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5fc6('0x1'));var rp=require(_0x5fc6('0x2'));var moment=require(_0x5fc6('0x3'));var BPromise=require(_0x5fc6('0x4'));var Mustache=require(_0x5fc6('0x5'));var util=require(_0x5fc6('0x6'));var path=require(_0x5fc6('0x7'));var sox=require(_0x5fc6('0x8'));var csv=require(_0x5fc6('0x9'));var ejs=require(_0x5fc6('0xa'));var fs=require('fs');var fs_extra=require(_0x5fc6('0xb'));var _=require(_0x5fc6('0xc'));var squel=require(_0x5fc6('0xd'));var crypto=require('crypto');var jsforce=require(_0x5fc6('0xe'));var deskjs=require(_0x5fc6('0xf'));var toCsv=require(_0x5fc6('0x9'));var querystring=require(_0x5fc6('0x10'));var Papa=require(_0x5fc6('0x11'));var Redis=require(_0x5fc6('0x12'));var authService=require(_0x5fc6('0x13'));var qs=require(_0x5fc6('0x14'));var as=require(_0x5fc6('0x15'));var hardwareService=require(_0x5fc6('0x16'));var logger=require('../../config/logger')(_0x5fc6('0x17'));var utils=require('../../config/utils');var config=require(_0x5fc6('0x18'));var licenseUtil=require(_0x5fc6('0x19'));var db=require(_0x5fc6('0x1a'))['db'];function respondWithStatusCode(_0x1dd2d6,_0x5084b1){_0x5084b1=_0x5084b1||0xcc;return function(_0x183dc8){if(_0x183dc8){return _0x1dd2d6[_0x5fc6('0x1b')](_0x5084b1);}return _0x1dd2d6[_0x5fc6('0x1c')](_0x5084b1)[_0x5fc6('0x1d')]();};}function respondWithResult(_0x436a0c,_0x26d865){_0x26d865=_0x26d865||0xc8;return function(_0x23424e){if(_0x23424e){return _0x436a0c[_0x5fc6('0x1c')](_0x26d865)[_0x5fc6('0x1e')](_0x23424e);}};}function respondWithFilteredResult(_0xcf2718,_0x54f153){return function(_0x4ec722){if(_0x4ec722){var _0x3b35b2=typeof _0x54f153[_0x5fc6('0x1f')]==='undefined'&&typeof _0x54f153[_0x5fc6('0x20')]===_0x5fc6('0x21');var _0x191cf3=_0x4ec722[_0x5fc6('0x22')];var _0x241bfb=_0x3b35b2?0x0:_0x54f153[_0x5fc6('0x1f')];var _0x569bbc=_0x3b35b2?_0x4ec722[_0x5fc6('0x22')]:_0x54f153[_0x5fc6('0x1f')]+_0x54f153[_0x5fc6('0x20')];var _0xad2ccb;if(_0x569bbc>=_0x191cf3){_0x569bbc=_0x191cf3;_0xad2ccb=0xc8;}else{_0xad2ccb=0xce;}_0xcf2718['status'](_0xad2ccb);return _0xcf2718[_0x5fc6('0x23')](_0x5fc6('0x24'),_0x241bfb+'-'+_0x569bbc+'/'+_0x191cf3)[_0x5fc6('0x1e')](_0x4ec722);}return null;};}function patchUpdates(_0x23c41e){return function(_0x793fbb){try{jsonpatch[_0x5fc6('0x25')](_0x793fbb,_0x23c41e,!![]);}catch(_0x3d415f){return BPromise[_0x5fc6('0x26')](_0x3d415f);}return _0x793fbb[_0x5fc6('0x27')]();};}function saveUpdates(_0x2f4179,_0x5ed932){return function(_0x1a3c0d){if(_0x1a3c0d){return _0x1a3c0d[_0x5fc6('0x28')](_0x2f4179)[_0x5fc6('0x29')](function(_0x2342f4){return _0x2342f4;});}return null;};}function removeEntity(_0x34a639,_0x1480a3){return function(_0xb7946){if(_0xb7946){return _0xb7946[_0x5fc6('0x2a')]()['then'](function(){_0x34a639[_0x5fc6('0x1c')](0xcc)[_0x5fc6('0x1d')]();});}};}function handleEntityNotFound(_0x1db1f0,_0x3f384a){return function(_0x391392){if(!_0x391392){_0x1db1f0[_0x5fc6('0x1b')](0x194);}return _0x391392;};}function handleError(_0x511177,_0x42e5c8){_0x42e5c8=_0x42e5c8||0x1f4;return function(_0xd31fa1){logger['error'](_0xd31fa1[_0x5fc6('0x2b')]);if(_0xd31fa1[_0x5fc6('0x2c')]){delete _0xd31fa1[_0x5fc6('0x2c')];}_0x511177[_0x5fc6('0x1c')](_0x42e5c8)[_0x5fc6('0x2d')](_0xd31fa1);};}exports['index']=function(_0x17f2b2,_0x2134ca){var _0x21066b={},_0x3aadbb={},_0x3b8b36={'count':0x0,'rows':[]};var _0x19fceb=_[_0x5fc6('0x2e')](db[_0x5fc6('0x2f')][_0x5fc6('0x30')],function(_0x57502b){return{'name':_0x57502b[_0x5fc6('0x31')],'type':_0x57502b['type'][_0x5fc6('0x32')]};});_0x3aadbb[_0x5fc6('0x33')]=_[_0x5fc6('0x2e')](_0x19fceb,_0x5fc6('0x2c'));_0x3aadbb[_0x5fc6('0x34')]=_['keys'](_0x17f2b2[_0x5fc6('0x34')]);_0x3aadbb[_0x5fc6('0x35')]=_[_0x5fc6('0x36')](_0x3aadbb[_0x5fc6('0x33')],_0x3aadbb[_0x5fc6('0x34')]);_0x21066b[_0x5fc6('0x37')]=_[_0x5fc6('0x36')](_0x3aadbb[_0x5fc6('0x33')],qs['fields'](_0x17f2b2[_0x5fc6('0x34')][_0x5fc6('0x38')]));_0x21066b['attributes']=_0x21066b['attributes'][_0x5fc6('0x39')]?_0x21066b[_0x5fc6('0x37')]:_0x3aadbb['model'];if(!_0x17f2b2[_0x5fc6('0x34')][_0x5fc6('0x3a')](_0x5fc6('0x3b'))){_0x21066b[_0x5fc6('0x20')]=qs['limit'](_0x17f2b2['query'][_0x5fc6('0x20')]);_0x21066b[_0x5fc6('0x1f')]=qs['offset'](_0x17f2b2['query'][_0x5fc6('0x1f')]);}_0x21066b[_0x5fc6('0x3c')]=qs['sort'](_0x17f2b2[_0x5fc6('0x34')]['sort']);_0x21066b[_0x5fc6('0x3d')]=qs[_0x5fc6('0x35')](_[_0x5fc6('0x3e')](_0x17f2b2[_0x5fc6('0x34')],_0x3aadbb['filters']),_0x19fceb);if(_0x17f2b2[_0x5fc6('0x34')][_0x5fc6('0x3f')]){_0x21066b[_0x5fc6('0x3d')]=_[_0x5fc6('0x40')](_0x21066b[_0x5fc6('0x3d')],{'$or':_[_0x5fc6('0x2e')](_0x19fceb,function(_0x58e67c){if(_0x58e67c[_0x5fc6('0x41')]!=='VIRTUAL'){var _0x2a8b91={};_0x2a8b91[_0x58e67c[_0x5fc6('0x2c')]]={'$like':'%'+_0x17f2b2['query'][_0x5fc6('0x3f')]+'%'};return _0x2a8b91;}})});}_0x21066b=_[_0x5fc6('0x40')]({},_0x21066b,_0x17f2b2['options']);var _0x4bc3c6={'where':_0x21066b[_0x5fc6('0x3d')]};return db[_0x5fc6('0x2f')][_0x5fc6('0x22')](_0x4bc3c6)[_0x5fc6('0x29')](function(_0x370bc4){_0x3b8b36[_0x5fc6('0x22')]=_0x370bc4;if(_0x17f2b2[_0x5fc6('0x34')][_0x5fc6('0x42')]){_0x21066b[_0x5fc6('0x43')]=[{'all':!![]}];}return db[_0x5fc6('0x2f')][_0x5fc6('0x44')](_0x21066b);})['then'](function(_0xa5a2a8){_0x3b8b36[_0x5fc6('0x45')]=_0xa5a2a8;return _0x3b8b36;})[_0x5fc6('0x29')](respondWithFilteredResult(_0x2134ca,_0x21066b))[_0x5fc6('0x46')](handleError(_0x2134ca,null));};exports[_0x5fc6('0x47')]=function(_0x4a0565,_0x56dd97){var _0x485d8e={'raw':!![],'where':{'id':_0x4a0565[_0x5fc6('0x48')]['id']}},_0x3330f2={};_0x3330f2[_0x5fc6('0x33')]=_[_0x5fc6('0x49')](db['JscriptyAnswerReport'][_0x5fc6('0x30')]);_0x3330f2[_0x5fc6('0x34')]=_[_0x5fc6('0x49')](_0x4a0565[_0x5fc6('0x34')]);_0x3330f2[_0x5fc6('0x35')]=_[_0x5fc6('0x36')](_0x3330f2['model'],_0x3330f2[_0x5fc6('0x34')]);_0x485d8e['attributes']=_['intersection'](_0x3330f2['model'],qs[_0x5fc6('0x38')](_0x4a0565['query'][_0x5fc6('0x38')]));_0x485d8e[_0x5fc6('0x37')]=_0x485d8e[_0x5fc6('0x37')]['length']?_0x485d8e[_0x5fc6('0x37')]:_0x3330f2['model'];if(_0x4a0565[_0x5fc6('0x34')][_0x5fc6('0x42')]){_0x485d8e['include']=[{'all':!![]}];}_0x485d8e=_[_0x5fc6('0x40')]({},_0x485d8e,_0x4a0565['options']);return db[_0x5fc6('0x2f')][_0x5fc6('0x4a')](_0x485d8e)[_0x5fc6('0x29')](handleEntityNotFound(_0x56dd97,null))[_0x5fc6('0x29')](respondWithResult(_0x56dd97,null))['catch'](handleError(_0x56dd97,null));};exports[_0x5fc6('0x4b')]=function(_0xa058b8,_0x23a6a3){return db[_0x5fc6('0x2f')]['create'](_0xa058b8[_0x5fc6('0x4c')],{})[_0x5fc6('0x29')](respondWithResult(_0x23a6a3,0xc9))[_0x5fc6('0x46')](handleError(_0x23a6a3,null));};exports[_0x5fc6('0x28')]=function(_0x295f57,_0x298151){if(_0x295f57[_0x5fc6('0x4c')]['id']){delete _0x295f57['body']['id'];}return db[_0x5fc6('0x2f')][_0x5fc6('0x4a')]({'where':{'id':_0x295f57[_0x5fc6('0x48')]['id']}})['then'](handleEntityNotFound(_0x298151,null))[_0x5fc6('0x29')](saveUpdates(_0x295f57[_0x5fc6('0x4c')],null))[_0x5fc6('0x29')](respondWithResult(_0x298151,null))[_0x5fc6('0x46')](handleError(_0x298151,null));};exports[_0x5fc6('0x2a')]=function(_0x1ba6b6,_0x4402cd){return db[_0x5fc6('0x2f')][_0x5fc6('0x4a')]({'where':{'id':_0x1ba6b6['params']['id']}})[_0x5fc6('0x29')](handleEntityNotFound(_0x4402cd,null))[_0x5fc6('0x29')](removeEntity(_0x4402cd,null))[_0x5fc6('0x46')](handleError(_0x4402cd,null));};exports[_0x5fc6('0x4d')]=function(_0x10012e,_0x57d49d){return db[_0x5fc6('0x2f')][_0x5fc6('0x4d')]()['then'](respondWithResult(_0x57d49d,null))[_0x5fc6('0x46')](handleError(_0x57d49d,null));}; \ No newline at end of file +var _0x44ff=['show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0x139a8d,_0x2057b9){var _0x2dc764=function(_0x27c279){while(--_0x27c279){_0x139a8d['push'](_0x139a8d['shift']());}};_0x2dc764(++_0x2057b9);}(_0x44ff,0x1c3));var _0xf44f=function(_0x480e83,_0x4ba6e9){_0x480e83=_0x480e83-0x0;var _0x253d1f=_0x44ff[_0x480e83];return _0x253d1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf44f('0x0'));var zipdir=require(_0xf44f('0x1'));var jsonpatch=require(_0xf44f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf44f('0x3'));var path=require(_0xf44f('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf44f('0x5'));var fs=require('fs');var fs_extra=require(_0xf44f('0x6'));var _=require(_0xf44f('0x7'));var squel=require('squel');var crypto=require(_0xf44f('0x8'));var jsforce=require(_0xf44f('0x9'));var deskjs=require(_0xf44f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf44f('0xb'));var Papa=require(_0xf44f('0xc'));var Redis=require(_0xf44f('0xd'));var authService=require(_0xf44f('0xe'));var qs=require(_0xf44f('0xf'));var as=require(_0xf44f('0x10'));var hardwareService=require(_0xf44f('0x11'));var logger=require(_0xf44f('0x12'))(_0xf44f('0x13'));var utils=require(_0xf44f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf44f('0x15'));var db=require(_0xf44f('0x16'))['db'];function respondWithStatusCode(_0x23b73a,_0x34d3da){_0x34d3da=_0x34d3da||0xcc;return function(_0x10176f){if(_0x10176f){return _0x23b73a[_0xf44f('0x17')](_0x34d3da);}return _0x23b73a[_0xf44f('0x18')](_0x34d3da)['end']();};}function respondWithResult(_0x5d2b86,_0x17e828){_0x17e828=_0x17e828||0xc8;return function(_0x5f20aa){if(_0x5f20aa){return _0x5d2b86['status'](_0x17e828)['json'](_0x5f20aa);}};}function respondWithFilteredResult(_0x3aa2b8,_0x1d2d77){return function(_0x409907){if(_0x409907){var _0x1a5ce4=typeof _0x1d2d77['offset']===_0xf44f('0x19')&&typeof _0x1d2d77['limit']===_0xf44f('0x19');var _0x40e414=_0x409907[_0xf44f('0x1a')];var _0x15e5b6=_0x1a5ce4?0x0:_0x1d2d77['offset'];var _0x4f0338=_0x1a5ce4?_0x409907['count']:_0x1d2d77['offset']+_0x1d2d77[_0xf44f('0x1b')];var _0x4f0292;if(_0x4f0338>=_0x40e414){_0x4f0338=_0x40e414;_0x4f0292=0xc8;}else{_0x4f0292=0xce;}_0x3aa2b8['status'](_0x4f0292);return _0x3aa2b8[_0xf44f('0x1c')](_0xf44f('0x1d'),_0x15e5b6+'-'+_0x4f0338+'/'+_0x40e414)[_0xf44f('0x1e')](_0x409907);}return null;};}function patchUpdates(_0x515ea6){return function(_0x1c317e){try{jsonpatch[_0xf44f('0x1f')](_0x1c317e,_0x515ea6,!![]);}catch(_0x5eb768){return BPromise[_0xf44f('0x20')](_0x5eb768);}return _0x1c317e['save']();};}function saveUpdates(_0x1cc24e,_0x166acd){return function(_0x3e0b9c){if(_0x3e0b9c){return _0x3e0b9c['update'](_0x1cc24e)[_0xf44f('0x21')](function(_0x1b9dc9){return _0x1b9dc9;});}return null;};}function removeEntity(_0x329ed3,_0x58d4af){return function(_0x1ba9c0){if(_0x1ba9c0){return _0x1ba9c0[_0xf44f('0x22')]()[_0xf44f('0x21')](function(){_0x329ed3[_0xf44f('0x18')](0xcc)[_0xf44f('0x23')]();});}};}function handleEntityNotFound(_0x5313f5,_0x3c04fe){return function(_0x2a17e0){if(!_0x2a17e0){_0x5313f5[_0xf44f('0x17')](0x194);}return _0x2a17e0;};}function handleError(_0x2fe533,_0x5b9c45){_0x5b9c45=_0x5b9c45||0x1f4;return function(_0x1af2a2){logger[_0xf44f('0x24')](_0x1af2a2[_0xf44f('0x25')]);if(_0x1af2a2[_0xf44f('0x26')]){delete _0x1af2a2[_0xf44f('0x26')];}_0x2fe533[_0xf44f('0x18')](_0x5b9c45)['send'](_0x1af2a2);};}exports[_0xf44f('0x27')]=function(_0x5255eb,_0x2f5075){var _0x14e6cf={},_0x5a5a83={},_0x544f32={'count':0x0,'rows':[]};var _0x11d199=_[_0xf44f('0x28')](db[_0xf44f('0x29')][_0xf44f('0x2a')],function(_0x549fdd){return{'name':_0x549fdd[_0xf44f('0x2b')],'type':_0x549fdd[_0xf44f('0x2c')]['key']};});_0x5a5a83[_0xf44f('0x2d')]=_[_0xf44f('0x28')](_0x11d199,_0xf44f('0x26'));_0x5a5a83[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x5255eb[_0xf44f('0x2e')]);_0x5a5a83[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],_0x5a5a83[_0xf44f('0x2e')]);_0x14e6cf['attributes']=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],qs['fields'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x32')]));_0x14e6cf[_0xf44f('0x33')]=_0x14e6cf[_0xf44f('0x33')][_0xf44f('0x34')]?_0x14e6cf['attributes']:_0x5a5a83[_0xf44f('0x2d')];if(!_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x35')](_0xf44f('0x36'))){_0x14e6cf[_0xf44f('0x1b')]=qs[_0xf44f('0x1b')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x1b')]);_0x14e6cf[_0xf44f('0x37')]=qs['offset'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x37')]);}_0x14e6cf[_0xf44f('0x38')]=qs[_0xf44f('0x39')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x39')]);_0x14e6cf[_0xf44f('0x3a')]=qs[_0xf44f('0x30')](_[_0xf44f('0x3b')](_0x5255eb[_0xf44f('0x2e')],_0x5a5a83[_0xf44f('0x30')]),_0x11d199);if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x3c')]){_0x14e6cf[_0xf44f('0x3a')]=_[_0xf44f('0x3d')](_0x14e6cf[_0xf44f('0x3a')],{'$or':_[_0xf44f('0x28')](_0x11d199,function(_0x37f274){if(_0x37f274[_0xf44f('0x2c')]!==_0xf44f('0x3e')){var _0x460308={};_0x460308[_0x37f274[_0xf44f('0x26')]]={'$like':'%'+_0x5255eb[_0xf44f('0x2e')]['filter']+'%'};return _0x460308;}})});}_0x14e6cf=_[_0xf44f('0x3d')]({},_0x14e6cf,_0x5255eb[_0xf44f('0x3f')]);var _0x1df436={'where':_0x14e6cf[_0xf44f('0x3a')]};return db['JscriptyAnswerReport'][_0xf44f('0x1a')](_0x1df436)['then'](function(_0x54fd2f){_0x544f32[_0xf44f('0x1a')]=_0x54fd2f;if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x40')]){_0x14e6cf[_0xf44f('0x41')]=[{'all':!![]}];}return db[_0xf44f('0x29')]['findAll'](_0x14e6cf);})[_0xf44f('0x21')](function(_0x32e8e0){_0x544f32['rows']=_0x32e8e0;return _0x544f32;})[_0xf44f('0x21')](respondWithFilteredResult(_0x2f5075,_0x14e6cf))[_0xf44f('0x42')](handleError(_0x2f5075,null));};exports[_0xf44f('0x43')]=function(_0x524d57,_0x11c508){var _0x502a21={'raw':!![],'where':{'id':_0x524d57[_0xf44f('0x44')]['id']}},_0x28717a={};_0x28717a['model']=_[_0xf44f('0x2f')](db[_0xf44f('0x29')][_0xf44f('0x2a')]);_0x28717a[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x524d57[_0xf44f('0x2e')]);_0x28717a[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x28717a['model'],_0x28717a[_0xf44f('0x2e')]);_0x502a21[_0xf44f('0x33')]=_[_0xf44f('0x31')](_0x28717a[_0xf44f('0x2d')],qs[_0xf44f('0x32')](_0x524d57[_0xf44f('0x2e')]['fields']));_0x502a21[_0xf44f('0x33')]=_0x502a21[_0xf44f('0x33')][_0xf44f('0x34')]?_0x502a21['attributes']:_0x28717a[_0xf44f('0x2d')];if(_0x524d57['query'][_0xf44f('0x40')]){_0x502a21[_0xf44f('0x41')]=[{'all':!![]}];}_0x502a21=_[_0xf44f('0x3d')]({},_0x502a21,_0x524d57['options']);return db[_0xf44f('0x29')][_0xf44f('0x45')](_0x502a21)[_0xf44f('0x21')](handleEntityNotFound(_0x11c508,null))['then'](respondWithResult(_0x11c508,null))['catch'](handleError(_0x11c508,null));};exports[_0xf44f('0x46')]=function(_0x2cb20c,_0x193dbd){return db[_0xf44f('0x29')][_0xf44f('0x46')](_0x2cb20c[_0xf44f('0x47')],{})[_0xf44f('0x21')](respondWithResult(_0x193dbd,0xc9))['catch'](handleError(_0x193dbd,null));};exports[_0xf44f('0x48')]=function(_0x30e382,_0x5a80fc){if(_0x30e382['body']['id']){delete _0x30e382['body']['id'];}return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x30e382[_0xf44f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a80fc,null))['then'](saveUpdates(_0x30e382[_0xf44f('0x47')],null))[_0xf44f('0x21')](respondWithResult(_0x5a80fc,null))[_0xf44f('0x42')](handleError(_0x5a80fc,null));};exports[_0xf44f('0x22')]=function(_0x1ecff0,_0x55a038){return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x1ecff0['params']['id']}})[_0xf44f('0x21')](handleEntityNotFound(_0x55a038,null))['then'](removeEntity(_0x55a038,null))[_0xf44f('0x42')](handleError(_0x55a038,null));};exports[_0xf44f('0x49')]=function(_0x300fe0,_0x26ea85){return db[_0xf44f('0x29')][_0xf44f('0x49')]()[_0xf44f('0x21')](respondWithResult(_0x26ea85,null))['catch'](handleError(_0x26ea85,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4f2680b..c297c53 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 _0x811a=['exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x412802,_0x22eb15){var _0x30e3c3=function(_0xc5272c){while(--_0xc5272c){_0x412802['push'](_0x412802['shift']());}};_0x30e3c3(++_0x22eb15);}(_0x811a,0xa0));var _0xa811=function(_0x41e62b,_0x187a53){_0x41e62b=_0x41e62b-0x0;var _0x304907=_0x811a[_0x41e62b];return _0x304907;};'use strict';var _=require(_0xa811('0x0'));var util=require(_0xa811('0x1'));var logger=require(_0xa811('0x2'))('api');var moment=require(_0xa811('0x3'));var BPromise=require(_0xa811('0x4'));var rp=require(_0xa811('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa811('0x6'));var config=require(_0xa811('0x7'));var attributes=require(_0xa811('0x8'));module[_0xa811('0x9')]=function(_0x4a39e8,_0x4f2b78){return _0x4a39e8[_0xa811('0xa')](_0xa811('0xb'),attributes,{'tableName':_0xa811('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa880=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util'];(function(_0x35e695,_0x35c7a8){var _0x1a4be2=function(_0x4b802d){while(--_0x4b802d){_0x35e695['push'](_0x35e695['shift']());}};_0x1a4be2(++_0x35c7a8);}(_0xa880,0xb4));var _0x0a88=function(_0x1ef71d,_0x453e87){_0x1ef71d=_0x1ef71d-0x0;var _0x5bd739=_0xa880[_0x1ef71d];return _0x5bd739;};'use strict';var _=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var logger=require(_0x0a88('0x2'))(_0x0a88('0x3'));var moment=require('moment');var BPromise=require(_0x0a88('0x4'));var rp=require(_0x0a88('0x5'));var fs=require('fs');var path=require(_0x0a88('0x6'));var rimraf=require(_0x0a88('0x7'));var config=require(_0x0a88('0x8'));var attributes=require(_0x0a88('0x9'));module[_0x0a88('0xa')]=function(_0x1247e4,_0x1c904f){return _0x1247e4[_0x0a88('0xb')](_0x0a88('0xc'),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 974ff2e..fcb68ab 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 _0xe34b=['jayson/promise','http','request','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','JscriptyAnswerReport,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x485cd4,_0x506e1b){var _0x528199=function(_0x8472b3){while(--_0x8472b3){_0x485cd4['push'](_0x485cd4['shift']());}};_0x528199(++_0x506e1b);}(_0xe34b,0x199));var _0xbe34=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0xe34b[_0x54f7c0];return _0x245d03;};'use strict';var _=require('lodash');var util=require(_0xbe34('0x0'));var moment=require(_0xbe34('0x1'));var BPromise=require(_0xbe34('0x2'));var rs=require(_0xbe34('0x3'));var fs=require('fs');var Redis=require(_0xbe34('0x4'));var db=require(_0xbe34('0x5'))['db'];var utils=require(_0xbe34('0x6'));var logger=require('../../config/logger')(_0xbe34('0x7'));var config=require(_0xbe34('0x8'));var jayson=require(_0xbe34('0x9'));var client=jayson['client'][_0xbe34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc0cc8c,_0x563bc9,_0xa1306f){return new BPromise(function(_0x28fb26,_0x1d1341){return client[_0xbe34('0xb')](_0xc0cc8c,_0xa1306f)['then'](function(_0x5e8a07){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x563bc9,'request\x20sent');logger[_0xbe34('0xc')](_0xbe34('0xd'),_0x563bc9,_0xbe34('0xe'),JSON[_0xbe34('0xf')](_0x5e8a07));if(_0x5e8a07['error']){if(_0x5e8a07[_0xbe34('0x10')][_0xbe34('0x11')]===0x1f4){logger[_0xbe34('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x563bc9,_0x5e8a07[_0xbe34('0x10')][_0xbe34('0x12')]);return _0x1d1341(_0x5e8a07[_0xbe34('0x10')][_0xbe34('0x12')]);}logger[_0xbe34('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x563bc9,_0x5e8a07[_0xbe34('0x10')]['message']);return _0x28fb26(_0x5e8a07[_0xbe34('0x10')][_0xbe34('0x12')]);}else{logger[_0xbe34('0x13')](_0xbe34('0x14'),_0x563bc9,'request\x20sent');_0x28fb26(_0x5e8a07['result']['message']);}})[_0xbe34('0x15')](function(_0x1a8251){logger[_0xbe34('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x563bc9,_0x1a8251);_0x1d1341(_0x1a8251);});});} \ No newline at end of file +var _0xa0f8=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x139a4f,_0x5c6d66){var _0x46ed1c=function(_0x1190e4){while(--_0x1190e4){_0x139a4f['push'](_0x139a4f['shift']());}};_0x46ed1c(++_0x5c6d66);}(_0xa0f8,0x65));var _0x8a0f=function(_0x475923,_0x25d9ec){_0x475923=_0x475923-0x0;var _0x374030=_0xa0f8[_0x475923];return _0x374030;};'use strict';var _=require('lodash');var util=require(_0x8a0f('0x0'));var moment=require(_0x8a0f('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a0f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a0f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a0f('0x4'))(_0x8a0f('0x5'));var config=require(_0x8a0f('0x6'));var jayson=require(_0x8a0f('0x7'));var client=jayson[_0x8a0f('0x8')][_0x8a0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x697d1b,_0x360893,_0x60374b){return new BPromise(function(_0x996130,_0x4cfd33){return client[_0x8a0f('0xa')](_0x697d1b,_0x60374b)[_0x8a0f('0xb')](function(_0x2aafaf){logger['info'](_0x8a0f('0xc'),_0x360893,_0x8a0f('0xd'));logger[_0x8a0f('0xe')](_0x8a0f('0xf'),_0x360893,_0x8a0f('0xd'),JSON[_0x8a0f('0x10')](_0x2aafaf));if(_0x2aafaf[_0x8a0f('0x11')]){if(_0x2aafaf['error'][_0x8a0f('0x12')]===0x1f4){logger[_0x8a0f('0x11')](_0x8a0f('0xc'),_0x360893,_0x2aafaf['error']['message']);return _0x4cfd33(_0x2aafaf['error'][_0x8a0f('0x13')]);}logger[_0x8a0f('0x11')](_0x8a0f('0xc'),_0x360893,_0x2aafaf['error'][_0x8a0f('0x13')]);return _0x996130(_0x2aafaf['error']['message']);}else{logger[_0x8a0f('0x14')](_0x8a0f('0xc'),_0x360893,'request\x20sent');_0x996130(_0x2aafaf[_0x8a0f('0x15')][_0x8a0f('0x13')]);}})[_0x8a0f('0x16')](function(_0x51b3ae){logger[_0x8a0f('0x11')](_0x8a0f('0xc'),_0x360893,_0x51b3ae);_0x4cfd33(_0x51b3ae);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 22ce59d..7a7b829 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 _0x09ec=['getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions'];(function(_0x5abf7a,_0x4d16bb){var _0x17350f=function(_0x142f20){while(--_0x142f20){_0x5abf7a['push'](_0x5abf7a['shift']());}};_0x17350f(++_0x4d16bb);}(_0x09ec,0x19f));var _0xc09e=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x09ec[_0x4bb581];return _0x316bf5;};'use strict';var multer=require(_0xc09e('0x0'));var util=require(_0xc09e('0x1'));var path=require(_0xc09e('0x2'));var timeout=require(_0xc09e('0x3'));var express=require('express');var router=express[_0xc09e('0x4')]();var fs_extra=require(_0xc09e('0x5'));var auth=require(_0xc09e('0x6'));var interaction=require(_0xc09e('0x7'));var config=require(_0xc09e('0x8'));var controller=require(_0xc09e('0x9'));router[_0xc09e('0xa')]('/',auth['isAuthenticated'](),controller[_0xc09e('0xb')]);router[_0xc09e('0xa')](_0xc09e('0xc'),auth[_0xc09e('0xd')](),controller[_0xc09e('0xe')]);router[_0xc09e('0xa')](_0xc09e('0xf'),auth[_0xc09e('0xd')](),controller[_0xc09e('0x10')]);router[_0xc09e('0xa')]('/:id/answers',auth[_0xc09e('0xd')](),controller[_0xc09e('0x11')]);router[_0xc09e('0xa')](_0xc09e('0x12'),auth[_0xc09e('0xd')](),timeout(_0xc09e('0x13')),controller[_0xc09e('0x14')]);router[_0xc09e('0x15')]('/',auth[_0xc09e('0xd')](),controller[_0xc09e('0x16')]);router[_0xc09e('0x15')](_0xc09e('0x17'),auth[_0xc09e('0xd')](),controller[_0xc09e('0x18')]);router[_0xc09e('0x19')](_0xc09e('0xc'),auth[_0xc09e('0xd')](),controller['update']);router[_0xc09e('0x1a')](_0xc09e('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5205=['/:id/clone','clone','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create'];(function(_0x30f53a,_0x55acf8){var _0x24fd11=function(_0x4e2626){while(--_0x4e2626){_0x30f53a['push'](_0x30f53a['shift']());}};_0x24fd11(++_0x55acf8);}(_0x5205,0x17c));var _0x5520=function(_0xc883fc,_0x5f57b5){_0xc883fc=_0xc883fc-0x0;var _0xc26f95=_0x5205[_0xc883fc];return _0xc26f95;};'use strict';var multer=require(_0x5520('0x0'));var util=require(_0x5520('0x1'));var path=require(_0x5520('0x2'));var timeout=require(_0x5520('0x3'));var express=require(_0x5520('0x4'));var router=express['Router']();var fs_extra=require(_0x5520('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5520('0x6'));var config=require('../../config/environment');var controller=require(_0x5520('0x7'));router[_0x5520('0x8')]('/',auth[_0x5520('0x9')](),controller['index']);router['get'](_0x5520('0xa'),auth['isAuthenticated'](),controller[_0x5520('0xb')]);router[_0x5520('0x8')](_0x5520('0xc'),auth['isAuthenticated'](),controller[_0x5520('0xd')]);router[_0x5520('0x8')](_0x5520('0xe'),auth[_0x5520('0x9')](),controller[_0x5520('0xf')]);router[_0x5520('0x8')](_0x5520('0x10'),auth[_0x5520('0x9')](),timeout('30s'),controller[_0x5520('0x11')]);router[_0x5520('0x12')]('/',auth['isAuthenticated'](),controller[_0x5520('0x13')]);router['post'](_0x5520('0x14'),auth[_0x5520('0x9')](),controller[_0x5520('0x15')]);router['put'](_0x5520('0xa'),auth[_0x5520('0x9')](),controller[_0x5520('0x16')]);router[_0x5520('0x17')]('/:id',auth[_0x5520('0x9')](),controller[_0x5520('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 880b3d5..9b306f6 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 _0xed39=['sequelize','lodash','util','exports','STRING','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x7cfcf5,_0x7ed10d){var _0x81ebf9=function(_0x2129e6){while(--_0x2129e6){_0x7cfcf5['push'](_0x7cfcf5['shift']());}};_0x81ebf9(++_0x7ed10d);}(_0xed39,0xd0));var _0x9ed3=function(_0x4e76ed,_0x3b6db3){_0x4e76ed=_0x4e76ed-0x0;var _0x26efc7=_0xed39[_0x4e76ed];return _0x26efc7;};'use strict';var Sequelize=require(_0x9ed3('0x0'));var _=require(_0x9ed3('0x1'));var util=require(_0x9ed3('0x2'));module[_0x9ed3('0x3')]={'name':{'type':Sequelize[_0x9ed3('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x9ed3('0x4')]},'formData':{'type':Sequelize[_0x9ed3('0x5')](_0x9ed3('0x6')),'set':function(_0xfd1a76){if(_['isObjectLike'](_0xfd1a76)){this[_0x9ed3('0x7')](_0x9ed3('0x8'),JSON[_0x9ed3('0x9')](_0xfd1a76));}else if(_[_0x9ed3('0xa')](_0xfd1a76)){this['setDataValue'](_0x9ed3('0x8'),_0xfd1a76);}else{this[_0x9ed3('0x7')](_0x9ed3('0x8'),util[_0x9ed3('0xb')](_0x9ed3('0xc'),this[_0x9ed3('0xd')]('name')||'',this['getDataValue'](_0x9ed3('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9ed3('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9ed3('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xd536=['name','TEXT','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0xd536,0x13e));var _0x6d53=function(_0x2ac448,_0x43ba65){_0x2ac448=_0x2ac448-0x0;var _0x520996=_0xd536[_0x2ac448];return _0x520996;};'use strict';var Sequelize=require(_0x6d53('0x0'));var _=require(_0x6d53('0x1'));var util=require(_0x6d53('0x2'));module[_0x6d53('0x3')]={'name':{'type':Sequelize[_0x6d53('0x4')],'unique':_0x6d53('0x5')},'description':{'type':Sequelize[_0x6d53('0x4')]},'formData':{'type':Sequelize[_0x6d53('0x6')]('long'),'set':function(_0x446509){if(_[_0x6d53('0x7')](_0x446509)){this[_0x6d53('0x8')]('formData',JSON[_0x6d53('0x9')](_0x446509));}else if(_[_0x6d53('0xa')](_0x446509)){this['setDataValue']('formData',_0x446509);}else{this[_0x6d53('0x8')](_0x6d53('0xb'),util[_0x6d53('0xc')](_0x6d53('0xd'),this['getDataValue'](_0x6d53('0x5'))||'',this[_0x6d53('0xe')](_0x6d53('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6d53('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6d53('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1287747..e3882a0 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 _0x6e1c=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileResource','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','answer','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','Projects','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length'];(function(_0x16a3b8,_0x5c9fef){var _0xf5b3f5=function(_0x4910ce){while(--_0x4910ce){_0x16a3b8['push'](_0x16a3b8['shift']());}};_0xf5b3f5(++_0x5c9fef);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e1('0x1'));var rp=require(_0xc6e1('0x2'));var moment=require(_0xc6e1('0x3'));var BPromise=require(_0xc6e1('0x4'));var Mustache=require(_0xc6e1('0x5'));var util=require(_0xc6e1('0x6'));var path=require(_0xc6e1('0x7'));var sox=require(_0xc6e1('0x8'));var csv=require(_0xc6e1('0x9'));var ejs=require(_0xc6e1('0xa'));var fs=require('fs');var fs_extra=require(_0xc6e1('0xb'));var _=require('lodash');var squel=require(_0xc6e1('0xc'));var crypto=require(_0xc6e1('0xd'));var jsforce=require(_0xc6e1('0xe'));var deskjs=require(_0xc6e1('0xf'));var toCsv=require(_0xc6e1('0x9'));var querystring=require('querystring');var Papa=require(_0xc6e1('0x10'));var Redis=require(_0xc6e1('0x11'));var authService=require(_0xc6e1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6e1('0x13'));var logger=require(_0xc6e1('0x14'))('api');var utils=require(_0xc6e1('0x15'));var config=require(_0xc6e1('0x16'));var licenseUtil=require(_0xc6e1('0x17'));var db=require(_0xc6e1('0x18'))['db'];function respondWithStatusCode(_0x22b511,_0x3526e7){_0x3526e7=_0x3526e7||0xcc;return function(_0x543048){if(_0x543048){return _0x22b511[_0xc6e1('0x19')](_0x3526e7);}return _0x22b511[_0xc6e1('0x1a')](_0x3526e7)[_0xc6e1('0x1b')]();};}function respondWithResult(_0x2d554f,_0x3573dd){_0x3573dd=_0x3573dd||0xc8;return function(_0x5a7e25){if(_0x5a7e25){return _0x2d554f['status'](_0x3573dd)[_0xc6e1('0x1c')](_0x5a7e25);}};}function respondWithFilteredResult(_0x30428e,_0x5da248){return function(_0x6a58af){if(_0x6a58af){var _0x580fae=typeof _0x5da248[_0xc6e1('0x1d')]==='undefined'&&typeof _0x5da248[_0xc6e1('0x1e')]===_0xc6e1('0x1f');var _0x18dad6=_0x6a58af[_0xc6e1('0x20')];var _0x527c70=_0x580fae?0x0:_0x5da248[_0xc6e1('0x1d')];var _0x2b8b22=_0x580fae?_0x6a58af[_0xc6e1('0x20')]:_0x5da248[_0xc6e1('0x1d')]+_0x5da248[_0xc6e1('0x1e')];var _0x40c19c;if(_0x2b8b22>=_0x18dad6){_0x2b8b22=_0x18dad6;_0x40c19c=0xc8;}else{_0x40c19c=0xce;}_0x30428e[_0xc6e1('0x1a')](_0x40c19c);return _0x30428e[_0xc6e1('0x21')](_0xc6e1('0x22'),_0x527c70+'-'+_0x2b8b22+'/'+_0x18dad6)[_0xc6e1('0x1c')](_0x6a58af);}return null;};}function patchUpdates(_0x23369a){return function(_0x816a){try{jsonpatch[_0xc6e1('0x23')](_0x816a,_0x23369a,!![]);}catch(_0x107ab7){return BPromise['reject'](_0x107ab7);}return _0x816a[_0xc6e1('0x24')]();};}function saveUpdates(_0x255ae1,_0x1ed09e){return function(_0x36c460){if(_0x36c460){return _0x36c460[_0xc6e1('0x25')](_0x255ae1)[_0xc6e1('0x26')](function(_0x571aa7){return _0x571aa7;});}return null;};}function removeEntity(_0x484d0c,_0x40b059){return function(_0x5597d3){if(_0x5597d3){return _0x5597d3[_0xc6e1('0x27')]()[_0xc6e1('0x26')](function(){var _0x5421d1=_0x5597d3['get']({'plain':!![]});var _0x2e284e=_0xc6e1('0x28');return db['UserProfileResource'][_0xc6e1('0x27')]({'where':{'type':_0x2e284e,'resourceId':_0x5421d1['id']}})[_0xc6e1('0x26')](function(){return _0x5597d3;});})[_0xc6e1('0x26')](function(){_0x484d0c[_0xc6e1('0x1a')](0xcc)[_0xc6e1('0x1b')]();});}};}function handleEntityNotFound(_0x240801,_0x26cec4){return function(_0x71fa6d){if(!_0x71fa6d){_0x240801[_0xc6e1('0x19')](0x194);}return _0x71fa6d;};}function handleError(_0x511191,_0x1fcc3a){_0x1fcc3a=_0x1fcc3a||0x1f4;return function(_0x600377){logger[_0xc6e1('0x29')](_0x600377['stack']);if(_0x600377[_0xc6e1('0x2a')]){delete _0x600377[_0xc6e1('0x2a')];}_0x511191[_0xc6e1('0x1a')](_0x1fcc3a)[_0xc6e1('0x2b')](_0x600377);};}exports[_0xc6e1('0x2c')]=function(_0x4ba865,_0x17c8f0){var _0x1585d4={},_0x5a7c24={},_0x2cdb1e={'count':0x0,'rows':[]};var _0x3d6d3d=_[_0xc6e1('0x2d')](db[_0xc6e1('0x2e')][_0xc6e1('0x2f')],function(_0x60446a){return{'name':_0x60446a[_0xc6e1('0x30')],'type':_0x60446a[_0xc6e1('0x31')]['key']};});_0x5a7c24[_0xc6e1('0x32')]=_[_0xc6e1('0x2d')](_0x3d6d3d,_0xc6e1('0x2a'));_0x5a7c24[_0xc6e1('0x33')]=_[_0xc6e1('0x34')](_0x4ba865[_0xc6e1('0x33')]);_0x5a7c24['filters']=_['intersection'](_0x5a7c24[_0xc6e1('0x32')],_0x5a7c24[_0xc6e1('0x33')]);_0x1585d4[_0xc6e1('0x35')]=_['intersection'](_0x5a7c24[_0xc6e1('0x32')],qs[_0xc6e1('0x36')](_0x4ba865['query'][_0xc6e1('0x36')]));_0x1585d4[_0xc6e1('0x35')]=_0x1585d4[_0xc6e1('0x35')][_0xc6e1('0x37')]?_0x1585d4['attributes']:_0x5a7c24[_0xc6e1('0x32')];if(!_0x4ba865['query'][_0xc6e1('0x38')](_0xc6e1('0x39'))){_0x1585d4[_0xc6e1('0x1e')]=qs[_0xc6e1('0x1e')](_0x4ba865[_0xc6e1('0x33')]['limit']);_0x1585d4['offset']=qs[_0xc6e1('0x1d')](_0x4ba865[_0xc6e1('0x33')][_0xc6e1('0x1d')]);}_0x1585d4['order']=qs[_0xc6e1('0x3a')](_0x4ba865['query'][_0xc6e1('0x3a')]);_0x1585d4[_0xc6e1('0x3b')]=qs[_0xc6e1('0x3c')](_[_0xc6e1('0x3d')](_0x4ba865[_0xc6e1('0x33')],_0x5a7c24[_0xc6e1('0x3c')]),_0x3d6d3d);if(_0x4ba865[_0xc6e1('0x33')][_0xc6e1('0x3e')]){_0x1585d4['where']=_[_0xc6e1('0x3f')](_0x1585d4[_0xc6e1('0x3b')],{'$or':_[_0xc6e1('0x2d')](_0x3d6d3d,function(_0x5f14c3){if(_0x5f14c3['type']!==_0xc6e1('0x40')){var _0x3fc735={};_0x3fc735[_0x5f14c3[_0xc6e1('0x2a')]]={'$like':'%'+_0x4ba865['query'][_0xc6e1('0x3e')]+'%'};return _0x3fc735;}})});}_0x1585d4=_[_0xc6e1('0x3f')]({},_0x1585d4,_0x4ba865[_0xc6e1('0x41')]);var _0x54e913={'where':_0x1585d4[_0xc6e1('0x3b')]};return db[_0xc6e1('0x2e')][_0xc6e1('0x20')](_0x54e913)[_0xc6e1('0x26')](function(_0x33e085){_0x2cdb1e[_0xc6e1('0x20')]=_0x33e085;if(_0x4ba865[_0xc6e1('0x33')][_0xc6e1('0x42')]){_0x1585d4[_0xc6e1('0x43')]=[{'all':!![]}];}return db[_0xc6e1('0x2e')][_0xc6e1('0x44')](_0x1585d4);})[_0xc6e1('0x26')](function(_0xce5a71){_0x2cdb1e[_0xc6e1('0x45')]=_0xce5a71;return _0x2cdb1e;})[_0xc6e1('0x26')](respondWithFilteredResult(_0x17c8f0,_0x1585d4))['catch'](handleError(_0x17c8f0,null));};exports[_0xc6e1('0x46')]=function(_0x18c7b0,_0x599a66){var _0x1fee7c={'raw':![],'where':{'id':_0x18c7b0[_0xc6e1('0x47')]['id']}},_0xa47300={};_0xa47300[_0xc6e1('0x32')]=_[_0xc6e1('0x34')](db['JscriptyProject'][_0xc6e1('0x2f')]);_0xa47300[_0xc6e1('0x33')]=_['keys'](_0x18c7b0[_0xc6e1('0x33')]);_0xa47300[_0xc6e1('0x3c')]=_[_0xc6e1('0x48')](_0xa47300[_0xc6e1('0x32')],_0xa47300['query']);_0x1fee7c[_0xc6e1('0x35')]=_[_0xc6e1('0x48')](_0xa47300[_0xc6e1('0x32')],qs[_0xc6e1('0x36')](_0x18c7b0[_0xc6e1('0x33')]['fields']));_0x1fee7c[_0xc6e1('0x35')]=_0x1fee7c['attributes'][_0xc6e1('0x37')]?_0x1fee7c[_0xc6e1('0x35')]:_0xa47300[_0xc6e1('0x32')];if(_0x18c7b0[_0xc6e1('0x33')][_0xc6e1('0x42')]){_0x1fee7c[_0xc6e1('0x43')]=[{'all':!![]}];}_0x1fee7c=_['merge']({},_0x1fee7c,_0x18c7b0[_0xc6e1('0x41')]);return db[_0xc6e1('0x2e')][_0xc6e1('0x49')](_0x1fee7c)[_0xc6e1('0x26')](handleEntityNotFound(_0x599a66,null))[_0xc6e1('0x26')](respondWithResult(_0x599a66,null))['catch'](handleError(_0x599a66,null));};exports[_0xc6e1('0x4a')]=function(_0x2cd2f9,_0x4bd706){return db['JscriptyProject'][_0xc6e1('0x4a')](_0x2cd2f9[_0xc6e1('0x4b')],{})['then'](function(_0x580dac){var _0x7768ec=_0x2cd2f9[_0xc6e1('0x4c')][_0xc6e1('0x4d')]({'plain':!![]});if(!_0x7768ec)throw new Error(_0xc6e1('0x4e'));if(_0x7768ec[_0xc6e1('0x4f')]==='user'){var _0x130bc2=_0x580dac[_0xc6e1('0x4d')]({'plain':!![]});var _0xee6bfc=_0xc6e1('0x28');return db[_0xc6e1('0x50')][_0xc6e1('0x49')]({'where':{'name':_0xee6bfc,'userProfileId':_0x7768ec[_0xc6e1('0x51')]},'raw':!![]})['then'](function(_0x3c9589){if(_0x3c9589&&_0x3c9589[_0xc6e1('0x52')]===0x0){return db['UserProfileResource'][_0xc6e1('0x4a')]({'name':_0x130bc2[_0xc6e1('0x2a')],'resourceId':_0x130bc2['id'],'type':_0x3c9589[_0xc6e1('0x2a')],'sectionId':_0x3c9589['id']},{})[_0xc6e1('0x26')](function(){return _0x580dac;});}else{return _0x580dac;}})[_0xc6e1('0x53')](function(_0x56d1af){logger['error'](_0xc6e1('0x54'),_0x56d1af);throw _0x56d1af;});}return _0x580dac;})[_0xc6e1('0x26')](respondWithResult(_0x4bd706,0xc9))[_0xc6e1('0x53')](handleError(_0x4bd706,null));};exports[_0xc6e1('0x55')]=function(_0x2d9523,_0x1d54ea){var _0x25fa2d={'where':{'id':_0x2d9523[_0xc6e1('0x47')]['id']}},_0xf9630e={};_0xf9630e[_0xc6e1('0x32')]=_[_0xc6e1('0x34')](db[_0xc6e1('0x2e')][_0xc6e1('0x2f')]);_0x25fa2d[_0xc6e1('0x35')]=_[_0xc6e1('0x48')](_0xf9630e[_0xc6e1('0x32')],qs[_0xc6e1('0x36')](_0x2d9523[_0xc6e1('0x33')][_0xc6e1('0x36')]));_0x25fa2d[_0xc6e1('0x35')]=_0x25fa2d[_0xc6e1('0x35')][_0xc6e1('0x37')]?_0x25fa2d[_0xc6e1('0x35')]:_0xf9630e['model'];if(_0x2d9523[_0xc6e1('0x33')][_0xc6e1('0x42')]){_0x25fa2d[_0xc6e1('0x43')]=[{'all':!![]}];}_0x25fa2d=_['merge']({},_0x25fa2d,_0x2d9523[_0xc6e1('0x41')]);return db[_0xc6e1('0x2e')][_0xc6e1('0x49')](_0x25fa2d)[_0xc6e1('0x26')](handleEntityNotFound(_0x1d54ea,null))[_0xc6e1('0x26')](function(_0x18da8b){if(_0x18da8b){var _0x3ea8af=_0x18da8b['get']({'plain':!![]});_0x3ea8af=qs[_0xc6e1('0x56')](_0x3ea8af,['id',_0xc6e1('0x57'),_0xc6e1('0x58')]);_0x2d9523[_0xc6e1('0x4b')]=_[_0xc6e1('0x56')](_0x2d9523[_0xc6e1('0x4b')],['id','createdAt',_0xc6e1('0x58')]);return db[_0xc6e1('0x2e')]['create'](_[_0xc6e1('0x3f')](_0x3ea8af,_0x2d9523[_0xc6e1('0x4b')]),{'include':_0x2d9523[_0xc6e1('0x33')][_0xc6e1('0x42')]?[{'all':!![]}]:undefined})[_0xc6e1('0x26')](function(_0x7680c7){var _0x1b6978=_0x2d9523[_0xc6e1('0x4c')][_0xc6e1('0x4d')]({'plain':!![]});if(!_0x1b6978)throw new Error(_0xc6e1('0x4e'));if(_0x1b6978['role']===_0xc6e1('0x4c')){var _0x4051ee=_0x7680c7[_0xc6e1('0x4d')]({'plain':!![]});var _0x427249=_0xc6e1('0x28');return db['UserProfileSection'][_0xc6e1('0x49')]({'where':{'name':_0x427249,'userProfileId':_0x1b6978['userProfileId']},'raw':!![]})[_0xc6e1('0x26')](function(_0x2e8c53){if(_0x2e8c53&&_0x2e8c53[_0xc6e1('0x52')]===0x0){return db[_0xc6e1('0x59')][_0xc6e1('0x4a')]({'name':_0x4051ee[_0xc6e1('0x2a')],'resourceId':_0x4051ee['id'],'type':_0x2e8c53[_0xc6e1('0x2a')],'sectionId':_0x2e8c53['id']},{})[_0xc6e1('0x26')](function(){return _0x7680c7;});}else{return _0x7680c7;}})[_0xc6e1('0x53')](function(_0x54161e){logger[_0xc6e1('0x29')](_0xc6e1('0x54'),_0x54161e);throw _0x54161e;});}return _0x7680c7;});}})['then'](respondWithResult(_0x1d54ea,0xc9))[_0xc6e1('0x53')](handleError(_0x1d54ea,null));};exports[_0xc6e1('0x25')]=function(_0x5f629d,_0x723331){if(_0x5f629d[_0xc6e1('0x4b')]['id']){delete _0x5f629d[_0xc6e1('0x4b')]['id'];}return db[_0xc6e1('0x2e')][_0xc6e1('0x49')]({'where':{'id':_0x5f629d[_0xc6e1('0x47')]['id']}})[_0xc6e1('0x26')](handleEntityNotFound(_0x723331,null))[_0xc6e1('0x26')](saveUpdates(_0x5f629d['body'],null))['then'](respondWithResult(_0x723331,null))['catch'](handleError(_0x723331,null));};exports['destroy']=function(_0xe21940,_0x57c26d){return db['JscriptyProject'][_0xc6e1('0x49')]({'where':{'id':_0xe21940[_0xc6e1('0x47')]['id']}})[_0xc6e1('0x26')](handleEntityNotFound(_0x57c26d,null))['then'](removeEntity(_0x57c26d,null))[_0xc6e1('0x53')](handleError(_0x57c26d,null));};exports['getSessions']=function(_0x65150,_0x1cc75f,_0x499082){var _0x5a4a03={'raw':!![],'where':{}};var _0xf9553e={};var _0x9fd70a={'count':0x0,'rows':[]};return db[_0xc6e1('0x2e')][_0xc6e1('0x5a')]({'where':{'id':_0x65150['params']['id']}})[_0xc6e1('0x26')](handleEntityNotFound(_0x1cc75f,null))['then'](function(_0x52c576){if(_0x52c576){_0xf9553e[_0xc6e1('0x32')]=_['keys'](db[_0xc6e1('0x5b')][_0xc6e1('0x2f')]);_0xf9553e[_0xc6e1('0x33')]=_[_0xc6e1('0x34')](_0x65150[_0xc6e1('0x33')]);_0xf9553e['filters']=_[_0xc6e1('0x48')](_0xf9553e[_0xc6e1('0x32')],_0xf9553e['query']);_0x5a4a03[_0xc6e1('0x35')]=_[_0xc6e1('0x48')](_0xf9553e[_0xc6e1('0x32')],qs[_0xc6e1('0x36')](_0x65150[_0xc6e1('0x33')][_0xc6e1('0x36')]));_0x5a4a03[_0xc6e1('0x35')]=_0x5a4a03[_0xc6e1('0x35')][_0xc6e1('0x37')]?_0x5a4a03[_0xc6e1('0x35')]:_0xf9553e[_0xc6e1('0x32')];if(!_0x65150[_0xc6e1('0x33')][_0xc6e1('0x38')](_0xc6e1('0x39'))){_0x5a4a03['limit']=qs[_0xc6e1('0x1e')](_0x65150[_0xc6e1('0x33')][_0xc6e1('0x1e')]);_0x5a4a03[_0xc6e1('0x1d')]=qs[_0xc6e1('0x1d')](_0x65150[_0xc6e1('0x33')][_0xc6e1('0x1d')]);}_0x5a4a03[_0xc6e1('0x5c')]=qs[_0xc6e1('0x3a')](_0x65150[_0xc6e1('0x33')][_0xc6e1('0x3a')]);_0x5a4a03['where']=qs[_0xc6e1('0x3c')](_[_0xc6e1('0x3d')](_0x65150[_0xc6e1('0x33')],_0xf9553e[_0xc6e1('0x3c')]));_0x5a4a03[_0xc6e1('0x3b')][_0xc6e1('0x5d')]=_0x52c576['id'];if(_0x65150[_0xc6e1('0x33')]['filter']){_0x5a4a03['where']=_['merge'](_0x5a4a03[_0xc6e1('0x3b')],{'$or':_['map'](_0x5a4a03[_0xc6e1('0x35')],function(_0x187002){var _0x7c6d22={};_0x7c6d22[_0x187002]={'$like':'%'+_0x65150['query']['filter']+'%'};return _0x7c6d22;})});}_0x5a4a03=_[_0xc6e1('0x3f')]({},_0x5a4a03,_0x65150[_0xc6e1('0x41')]);return db[_0xc6e1('0x5b')][_0xc6e1('0x20')]({'where':_0x5a4a03[_0xc6e1('0x3b')]})[_0xc6e1('0x26')](function(_0x367ec0){_0x9fd70a['count']=_0x367ec0;if(_0x65150[_0xc6e1('0x33')]['includeAll']){_0x5a4a03['include']=[{'all':!![]}];}return db[_0xc6e1('0x5b')][_0xc6e1('0x44')](_0x5a4a03);})[_0xc6e1('0x26')](function(_0x29d96b){_0x9fd70a[_0xc6e1('0x45')]=_0x29d96b;return _0x9fd70a;});}})[_0xc6e1('0x26')](respondWithFilteredResult(_0x1cc75f,_0x5a4a03))[_0xc6e1('0x53')](handleError(_0x1cc75f,null));};exports[_0xc6e1('0x5e')]=function(_0x33ddac,_0x1669a7,_0x535ff6){var _0x587256={'raw':!![],'where':{}};var _0xad0224={};var _0x631d91={'count':0x0,'rows':[]};return db[_0xc6e1('0x2e')][_0xc6e1('0x5a')]({'where':{'id':_0x33ddac[_0xc6e1('0x47')]['id']}})[_0xc6e1('0x26')](handleEntityNotFound(_0x1669a7,null))[_0xc6e1('0x26')](function(_0x36b3fa){if(_0x36b3fa){_0xad0224[_0xc6e1('0x32')]=_[_0xc6e1('0x34')](db[_0xc6e1('0x5f')][_0xc6e1('0x2f')]);_0xad0224[_0xc6e1('0x33')]=_[_0xc6e1('0x34')](_0x33ddac[_0xc6e1('0x33')]);_0xad0224[_0xc6e1('0x3c')]=_[_0xc6e1('0x48')](_0xad0224[_0xc6e1('0x32')],_0xad0224[_0xc6e1('0x33')]);_0x587256['attributes']=_[_0xc6e1('0x48')](_0xad0224[_0xc6e1('0x32')],qs[_0xc6e1('0x36')](_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x36')]));_0x587256[_0xc6e1('0x35')]=_0x587256[_0xc6e1('0x35')][_0xc6e1('0x37')]?_0x587256[_0xc6e1('0x35')]:_0xad0224['model'];if(!_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x38')](_0xc6e1('0x39'))){_0x587256[_0xc6e1('0x1e')]=qs[_0xc6e1('0x1e')](_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x1e')]);_0x587256['offset']=qs[_0xc6e1('0x1d')](_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x1d')]);}_0x587256[_0xc6e1('0x5c')]=qs[_0xc6e1('0x3a')](_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x3a')]);_0x587256[_0xc6e1('0x3b')]=qs[_0xc6e1('0x3c')](_[_0xc6e1('0x3d')](_0x33ddac['query'],_0xad0224[_0xc6e1('0x3c')]));_0x587256[_0xc6e1('0x3b')]['ProjectId']=_0x36b3fa['id'];if(_0x33ddac['query']['filter']){_0x587256['where']=_[_0xc6e1('0x3f')](_0x587256[_0xc6e1('0x3b')],{'$or':_['map'](_0x587256['attributes'],function(_0x53ba76){var _0x3f4c46={};_0x3f4c46[_0x53ba76]={'$like':'%'+_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x3e')]+'%'};return _0x3f4c46;})});}_0x587256=_[_0xc6e1('0x3f')]({},_0x587256,_0x33ddac[_0xc6e1('0x41')]);return db[_0xc6e1('0x5f')][_0xc6e1('0x20')]({'where':_0x587256[_0xc6e1('0x3b')]})[_0xc6e1('0x26')](function(_0x37c7b3){_0x631d91[_0xc6e1('0x20')]=_0x37c7b3;if(_0x33ddac[_0xc6e1('0x33')][_0xc6e1('0x42')]){_0x587256[_0xc6e1('0x43')]=[{'all':!![]}];}return db[_0xc6e1('0x5f')][_0xc6e1('0x44')](_0x587256);})[_0xc6e1('0x26')](function(_0x3170a4){_0x631d91[_0xc6e1('0x45')]=_0x3170a4;return _0x631d91;});}})[_0xc6e1('0x26')](respondWithFilteredResult(_0x1669a7,_0x587256))['catch'](handleError(_0x1669a7,null));};function char(_0x2a3cb6){return _0xc6e1('0x60')===typeof _0x2a3cb6?String[_0xc6e1('0x61')][_0xc6e1('0x23')](null,arguments):_0x2a3cb6;}function needsEncapsulation(_0x191c97){return!!_0x191c97&&(_0x191c97[_0xc6e1('0x62')]()[_0xc6e1('0x63')](char(0xd))>=0x0||_0x191c97[_0xc6e1('0x62')]()[_0xc6e1('0x63')](char(0xa))>=0x0||_0x191c97['toString']()['indexOf'](char(0x2c))>=0x0||_0x191c97[_0xc6e1('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0xae0965){var _0x46589c=char(0x22),_0x5ee8ee='\x5c'+char(0x22),_0x42dbc1=_0xae0965[_0xc6e1('0x62')]()['replace'](new RegExp(_0x46589c,'g'),_0x5ee8ee);return _0x46589c+_0x42dbc1+_0x46589c;}exports[_0xc6e1('0x64')]=function(_0x26a4a7,_0x4e668e,_0x2b1701){var _0x447177,_0x37ee09;var _0xdf54af={'where':{'ProjectId':_0x26a4a7[_0xc6e1('0x47')]['id']}};if(_0x26a4a7[_0xc6e1('0x33')]['startTime']){_0xdf54af[_0xc6e1('0x3b')][_0xc6e1('0x65')]=JSON[_0xc6e1('0x66')](_0x26a4a7[_0xc6e1('0x33')][_0xc6e1('0x67')]);}return db[_0xc6e1('0x5b')][_0xc6e1('0x44')](_0xdf54af)['then'](handleEntityNotFound(_0x4e668e,null))['then'](function(_0x100d94){if(_0x100d94){_0x447177=_0x100d94;return db[_0xc6e1('0x68')][_0xc6e1('0x44')]({'where':{'SessionId':{'$in':_[_0xc6e1('0x2d')](_0x447177,'id')},'ProjectId':_0x26a4a7[_0xc6e1('0x47')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x4e668e,null))['then'](function(_0x3bff1a){if(_0x3bff1a){_0x37ee09=_0x3bff1a;var _0x1790f0={};for(var _0x5bbbba=0x0,_0x525d80=_0x37ee09[_0xc6e1('0x37')];_0x5bbbba<_0x525d80;_0x5bbbba++){if(!_0x1790f0[_0xc6e1('0x38')](_0x37ee09[_0x5bbbba][_0xc6e1('0x69')])){_0x1790f0[_0x37ee09[_0x5bbbba][_0xc6e1('0x69')]]=needsEncapsulation(_0x37ee09[_0x5bbbba][_0xc6e1('0x6a')])?encapsulate(_0x37ee09[_0x5bbbba][_0xc6e1('0x6a')]):_0x37ee09[_0x5bbbba][_0xc6e1('0x6a')];}}var _0xf1861a=[],_0x3bc76e={};for(var _0x42a402=0x0,_0x1a6189=_0x447177[_0xc6e1('0x37')];_0x42a402<_0x1a6189;_0x42a402++){_0x3bc76e={'ProjectId':_0x26a4a7[_0xc6e1('0x47')]['id'],'SessionId':_0x447177[_0x42a402]['id'],'StartTime':moment(_0x447177[_0x42a402][_0xc6e1('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x59a48b=0x0,_0x5798f2=_0x37ee09[_0xc6e1('0x37')];_0x59a48b<_0x5798f2;_0x59a48b++){if(_0x37ee09[_0x59a48b]['SessionId']==_0x447177[_0x42a402]['id']&&_0x1790f0[_0xc6e1('0x38')](_0x37ee09[_0x59a48b][_0xc6e1('0x69')])){_0x3bc76e[_0x1790f0[_0x37ee09[_0x59a48b][_0xc6e1('0x69')]]]=_0x37ee09[_0x59a48b][_0xc6e1('0x6b')];}}for(var _0x298443 in _0x1790f0){if(!_0x3bc76e[_0xc6e1('0x38')](_0x1790f0[_0x298443])){_0x3bc76e[_0x1790f0[_0x298443]]=null;}}_0xf1861a['push'](_0x3bc76e);}return _0xf1861a;}})['then'](function(_0x23f58c){if(!_[_0xc6e1('0x6c')](_0x23f58c)){var _0xfe7509=toCsv(_0x23f58c);var _0x3db72d=Date[_0xc6e1('0x6d')]();fs[_0xc6e1('0x6e')](util[_0xc6e1('0x6f')](_0xc6e1('0x70'),_0x26a4a7['params']['id'],_0x3db72d),_0xfe7509);_0x4e668e[_0xc6e1('0x71')](_0xc6e1('0x72'),'attachment;\x20filename='+util[_0xc6e1('0x6f')](_0xc6e1('0x73'),_0x26a4a7['params']['id'],_0x3db72d));_0x4e668e[_0xc6e1('0x71')](_0xc6e1('0x74'),_0xc6e1('0x75'));return _0x4e668e[_0xc6e1('0x76')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x26a4a7['params']['id'],_0x3db72d));}else{return _0x4e668e[_0xc6e1('0x19')](0xcc);}})[_0xc6e1('0x53')](handleError(_0x4e668e,null));}; \ No newline at end of file +var _0x3cae=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','pick','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','JscriptyProject','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','find','create','user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x5aae6e,_0x1900f0){var _0x5b6f9c=function(_0x16a552){while(--_0x16a552){_0x5aae6e['push'](_0x5aae6e['shift']());}};_0x5b6f9c(++_0x1900f0);}(_0x3cae,0x117));var _0xe3ca=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x3cae[_0x3f5dca];return _0x5b833a;};'use strict';var emlformat=require(_0xe3ca('0x0'));var rimraf=require(_0xe3ca('0x1'));var zipdir=require(_0xe3ca('0x2'));var jsonpatch=require(_0xe3ca('0x3'));var rp=require(_0xe3ca('0x4'));var moment=require(_0xe3ca('0x5'));var BPromise=require(_0xe3ca('0x6'));var Mustache=require('mustache');var util=require(_0xe3ca('0x7'));var path=require(_0xe3ca('0x8'));var sox=require('sox');var csv=require(_0xe3ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3ca('0xa'));var _=require(_0xe3ca('0xb'));var squel=require(_0xe3ca('0xc'));var crypto=require('crypto');var jsforce=require(_0xe3ca('0xd'));var deskjs=require(_0xe3ca('0xe'));var toCsv=require(_0xe3ca('0x9'));var querystring=require(_0xe3ca('0xf'));var Papa=require(_0xe3ca('0x10'));var Redis=require(_0xe3ca('0x11'));var authService=require(_0xe3ca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe3ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3ca('0x14'))(_0xe3ca('0x15'));var utils=require(_0xe3ca('0x16'));var config=require(_0xe3ca('0x17'));var licenseUtil=require(_0xe3ca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57fa3c,_0x3ff241){_0x3ff241=_0x3ff241||0xcc;return function(_0x5f1c02){if(_0x5f1c02){return _0x57fa3c[_0xe3ca('0x19')](_0x3ff241);}return _0x57fa3c[_0xe3ca('0x1a')](_0x3ff241)['end']();};}function respondWithResult(_0x3d62e2,_0x3a9455){_0x3a9455=_0x3a9455||0xc8;return function(_0x210c69){if(_0x210c69){return _0x3d62e2[_0xe3ca('0x1a')](_0x3a9455)[_0xe3ca('0x1b')](_0x210c69);}};}function respondWithFilteredResult(_0x292251,_0x884795){return function(_0x337b6c){if(_0x337b6c){var _0x5f2e2d=typeof _0x884795['offset']===_0xe3ca('0x1c')&&typeof _0x884795[_0xe3ca('0x1d')]===_0xe3ca('0x1c');var _0x3dae55=_0x337b6c[_0xe3ca('0x1e')];var _0x2d73d9=_0x5f2e2d?0x0:_0x884795['offset'];var _0x2eafde=_0x5f2e2d?_0x337b6c[_0xe3ca('0x1e')]:_0x884795[_0xe3ca('0x1f')]+_0x884795['limit'];var _0x4b7b9f;if(_0x2eafde>=_0x3dae55){_0x2eafde=_0x3dae55;_0x4b7b9f=0xc8;}else{_0x4b7b9f=0xce;}_0x292251['status'](_0x4b7b9f);return _0x292251[_0xe3ca('0x20')]('Content-Range',_0x2d73d9+'-'+_0x2eafde+'/'+_0x3dae55)['json'](_0x337b6c);}return null;};}function patchUpdates(_0x3b7591){return function(_0x1822e4){try{jsonpatch[_0xe3ca('0x21')](_0x1822e4,_0x3b7591,!![]);}catch(_0x149291){return BPromise[_0xe3ca('0x22')](_0x149291);}return _0x1822e4['save']();};}function saveUpdates(_0x3b1a75,_0x3ab26e){return function(_0x5bc481){if(_0x5bc481){return _0x5bc481[_0xe3ca('0x23')](_0x3b1a75)[_0xe3ca('0x24')](function(_0x33dc04){return _0x33dc04;});}return null;};}function removeEntity(_0xd681a7,_0xaf5191){return function(_0x392bdb){if(_0x392bdb){return _0x392bdb[_0xe3ca('0x25')]()[_0xe3ca('0x24')](function(){var _0x477ec7=_0x392bdb[_0xe3ca('0x26')]({'plain':!![]});var _0xa5b18f='Projects';return db[_0xe3ca('0x27')]['destroy']({'where':{'type':_0xa5b18f,'resourceId':_0x477ec7['id']}})[_0xe3ca('0x24')](function(){return _0x392bdb;});})[_0xe3ca('0x24')](function(){_0xd681a7[_0xe3ca('0x1a')](0xcc)[_0xe3ca('0x28')]();});}};}function handleEntityNotFound(_0x576491,_0x4c01c8){return function(_0x2e1636){if(!_0x2e1636){_0x576491[_0xe3ca('0x19')](0x194);}return _0x2e1636;};}function handleError(_0x4569e3,_0x4ef90f){_0x4ef90f=_0x4ef90f||0x1f4;return function(_0x1dbd98){logger[_0xe3ca('0x29')](_0x1dbd98[_0xe3ca('0x2a')]);if(_0x1dbd98[_0xe3ca('0x2b')]){delete _0x1dbd98['name'];}_0x4569e3['status'](_0x4ef90f)[_0xe3ca('0x2c')](_0x1dbd98);};}exports['index']=function(_0x24d40a,_0x5cf384){var _0x5576b4={},_0xd5e714={},_0x1517ac={'count':0x0,'rows':[]};var _0xcb58e9=_[_0xe3ca('0x2d')](db[_0xe3ca('0x2e')]['rawAttributes'],function(_0x11dd1d){return{'name':_0x11dd1d['fieldName'],'type':_0x11dd1d['type'][_0xe3ca('0x2f')]};});_0xd5e714[_0xe3ca('0x30')]=_[_0xe3ca('0x2d')](_0xcb58e9,_0xe3ca('0x2b'));_0xd5e714[_0xe3ca('0x31')]=_[_0xe3ca('0x32')](_0x24d40a[_0xe3ca('0x31')]);_0xd5e714[_0xe3ca('0x33')]=_[_0xe3ca('0x34')](_0xd5e714[_0xe3ca('0x30')],_0xd5e714[_0xe3ca('0x31')]);_0x5576b4[_0xe3ca('0x35')]=_['intersection'](_0xd5e714[_0xe3ca('0x30')],qs[_0xe3ca('0x36')](_0x24d40a[_0xe3ca('0x31')][_0xe3ca('0x36')]));_0x5576b4[_0xe3ca('0x35')]=_0x5576b4[_0xe3ca('0x35')]['length']?_0x5576b4[_0xe3ca('0x35')]:_0xd5e714[_0xe3ca('0x30')];if(!_0x24d40a[_0xe3ca('0x31')][_0xe3ca('0x37')](_0xe3ca('0x38'))){_0x5576b4[_0xe3ca('0x1d')]=qs[_0xe3ca('0x1d')](_0x24d40a[_0xe3ca('0x31')][_0xe3ca('0x1d')]);_0x5576b4['offset']=qs[_0xe3ca('0x1f')](_0x24d40a[_0xe3ca('0x31')]['offset']);}_0x5576b4[_0xe3ca('0x39')]=qs[_0xe3ca('0x3a')](_0x24d40a[_0xe3ca('0x31')]['sort']);_0x5576b4[_0xe3ca('0x3b')]=qs[_0xe3ca('0x33')](_['pick'](_0x24d40a[_0xe3ca('0x31')],_0xd5e714['filters']),_0xcb58e9);if(_0x24d40a['query'][_0xe3ca('0x3c')]){_0x5576b4[_0xe3ca('0x3b')]=_['merge'](_0x5576b4[_0xe3ca('0x3b')],{'$or':_[_0xe3ca('0x2d')](_0xcb58e9,function(_0xa1b3fa){if(_0xa1b3fa[_0xe3ca('0x3d')]!==_0xe3ca('0x3e')){var _0x2f1dcb={};_0x2f1dcb[_0xa1b3fa[_0xe3ca('0x2b')]]={'$like':'%'+_0x24d40a[_0xe3ca('0x31')][_0xe3ca('0x3c')]+'%'};return _0x2f1dcb;}})});}_0x5576b4=_['merge']({},_0x5576b4,_0x24d40a[_0xe3ca('0x3f')]);var _0x13781d={'where':_0x5576b4[_0xe3ca('0x3b')]};return db[_0xe3ca('0x2e')][_0xe3ca('0x1e')](_0x13781d)[_0xe3ca('0x24')](function(_0x2a0290){_0x1517ac[_0xe3ca('0x1e')]=_0x2a0290;if(_0x24d40a[_0xe3ca('0x31')][_0xe3ca('0x40')]){_0x5576b4[_0xe3ca('0x41')]=[{'all':!![]}];}return db[_0xe3ca('0x2e')][_0xe3ca('0x42')](_0x5576b4);})['then'](function(_0x275010){_0x1517ac[_0xe3ca('0x43')]=_0x275010;return _0x1517ac;})['then'](respondWithFilteredResult(_0x5cf384,_0x5576b4))[_0xe3ca('0x44')](handleError(_0x5cf384,null));};exports[_0xe3ca('0x45')]=function(_0x8f004d,_0x4df55d){var _0x294797={'raw':![],'where':{'id':_0x8f004d[_0xe3ca('0x46')]['id']}},_0x1c4706={};_0x1c4706[_0xe3ca('0x30')]=_[_0xe3ca('0x32')](db[_0xe3ca('0x2e')][_0xe3ca('0x47')]);_0x1c4706['query']=_[_0xe3ca('0x32')](_0x8f004d[_0xe3ca('0x31')]);_0x1c4706['filters']=_['intersection'](_0x1c4706[_0xe3ca('0x30')],_0x1c4706[_0xe3ca('0x31')]);_0x294797['attributes']=_[_0xe3ca('0x34')](_0x1c4706[_0xe3ca('0x30')],qs['fields'](_0x8f004d['query'][_0xe3ca('0x36')]));_0x294797[_0xe3ca('0x35')]=_0x294797[_0xe3ca('0x35')][_0xe3ca('0x48')]?_0x294797[_0xe3ca('0x35')]:_0x1c4706['model'];if(_0x8f004d[_0xe3ca('0x31')][_0xe3ca('0x40')]){_0x294797[_0xe3ca('0x41')]=[{'all':!![]}];}_0x294797=_[_0xe3ca('0x49')]({},_0x294797,_0x8f004d[_0xe3ca('0x3f')]);return db[_0xe3ca('0x2e')][_0xe3ca('0x4a')](_0x294797)[_0xe3ca('0x24')](handleEntityNotFound(_0x4df55d,null))[_0xe3ca('0x24')](respondWithResult(_0x4df55d,null))['catch'](handleError(_0x4df55d,null));};exports['create']=function(_0x539d5f,_0x542dfb){return db[_0xe3ca('0x2e')][_0xe3ca('0x4b')](_0x539d5f['body'],{})['then'](function(_0x1513fa){var _0x85e897=_0x539d5f[_0xe3ca('0x4c')]['get']({'plain':!![]});if(!_0x85e897)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x85e897[_0xe3ca('0x4d')]==='user'){var _0x42d9f7=_0x1513fa[_0xe3ca('0x26')]({'plain':!![]});var _0x318219=_0xe3ca('0x4e');return db[_0xe3ca('0x4f')][_0xe3ca('0x4a')]({'where':{'name':_0x318219,'userProfileId':_0x85e897[_0xe3ca('0x50')]},'raw':!![]})[_0xe3ca('0x24')](function(_0x3c488f){if(_0x3c488f&&_0x3c488f[_0xe3ca('0x51')]===0x0){return db[_0xe3ca('0x27')]['create']({'name':_0x42d9f7[_0xe3ca('0x2b')],'resourceId':_0x42d9f7['id'],'type':_0x3c488f[_0xe3ca('0x2b')],'sectionId':_0x3c488f['id']},{})['then'](function(){return _0x1513fa;});}else{return _0x1513fa;}})[_0xe3ca('0x44')](function(_0xd2c644){logger[_0xe3ca('0x29')](_0xe3ca('0x52'),_0xd2c644);throw _0xd2c644;});}return _0x1513fa;})['then'](respondWithResult(_0x542dfb,0xc9))['catch'](handleError(_0x542dfb,null));};exports[_0xe3ca('0x53')]=function(_0x2766f3,_0x45109f){var _0x4aaf8e={'where':{'id':_0x2766f3[_0xe3ca('0x46')]['id']}},_0xcd4de3={};_0xcd4de3[_0xe3ca('0x30')]=_['keys'](db[_0xe3ca('0x2e')][_0xe3ca('0x47')]);_0x4aaf8e[_0xe3ca('0x35')]=_[_0xe3ca('0x34')](_0xcd4de3[_0xe3ca('0x30')],qs[_0xe3ca('0x36')](_0x2766f3[_0xe3ca('0x31')][_0xe3ca('0x36')]));_0x4aaf8e[_0xe3ca('0x35')]=_0x4aaf8e['attributes'][_0xe3ca('0x48')]?_0x4aaf8e[_0xe3ca('0x35')]:_0xcd4de3[_0xe3ca('0x30')];if(_0x2766f3[_0xe3ca('0x31')][_0xe3ca('0x40')]){_0x4aaf8e[_0xe3ca('0x41')]=[{'all':!![]}];}_0x4aaf8e=_[_0xe3ca('0x49')]({},_0x4aaf8e,_0x2766f3['options']);return db[_0xe3ca('0x2e')][_0xe3ca('0x4a')](_0x4aaf8e)['then'](handleEntityNotFound(_0x45109f,null))[_0xe3ca('0x24')](function(_0x31b46a){if(_0x31b46a){var _0x57d375=_0x31b46a['get']({'plain':!![]});_0x57d375=qs[_0xe3ca('0x54')](_0x57d375,['id',_0xe3ca('0x55'),_0xe3ca('0x56')]);_0x2766f3['body']=_['omit'](_0x2766f3[_0xe3ca('0x57')],['id','createdAt',_0xe3ca('0x56')]);return db[_0xe3ca('0x2e')][_0xe3ca('0x4b')](_[_0xe3ca('0x49')](_0x57d375,_0x2766f3[_0xe3ca('0x57')]),{'include':_0x2766f3[_0xe3ca('0x31')][_0xe3ca('0x40')]?[{'all':!![]}]:undefined})[_0xe3ca('0x24')](function(_0x1c2856){var _0x706d5a=_0x2766f3['user'][_0xe3ca('0x26')]({'plain':!![]});if(!_0x706d5a)throw new Error(_0xe3ca('0x58'));if(_0x706d5a[_0xe3ca('0x4d')]===_0xe3ca('0x4c')){var _0x15929e=_0x1c2856['get']({'plain':!![]});var _0x1607c7=_0xe3ca('0x4e');return db[_0xe3ca('0x4f')][_0xe3ca('0x4a')]({'where':{'name':_0x1607c7,'userProfileId':_0x706d5a[_0xe3ca('0x50')]},'raw':!![]})[_0xe3ca('0x24')](function(_0x164ab1){if(_0x164ab1&&_0x164ab1[_0xe3ca('0x51')]===0x0){return db[_0xe3ca('0x27')][_0xe3ca('0x4b')]({'name':_0x15929e[_0xe3ca('0x2b')],'resourceId':_0x15929e['id'],'type':_0x164ab1['name'],'sectionId':_0x164ab1['id']},{})['then'](function(){return _0x1c2856;});}else{return _0x1c2856;}})[_0xe3ca('0x44')](function(_0x4c3def){logger[_0xe3ca('0x29')](_0xe3ca('0x52'),_0x4c3def);throw _0x4c3def;});}return _0x1c2856;});}})[_0xe3ca('0x24')](respondWithResult(_0x45109f,0xc9))[_0xe3ca('0x44')](handleError(_0x45109f,null));};exports['update']=function(_0x30acba,_0x20f68a){if(_0x30acba['body']['id']){delete _0x30acba['body']['id'];}return db[_0xe3ca('0x2e')][_0xe3ca('0x4a')]({'where':{'id':_0x30acba[_0xe3ca('0x46')]['id']}})[_0xe3ca('0x24')](handleEntityNotFound(_0x20f68a,null))[_0xe3ca('0x24')](saveUpdates(_0x30acba[_0xe3ca('0x57')],null))[_0xe3ca('0x24')](respondWithResult(_0x20f68a,null))['catch'](handleError(_0x20f68a,null));};exports[_0xe3ca('0x25')]=function(_0x38b797,_0x451505){return db[_0xe3ca('0x2e')]['find']({'where':{'id':_0x38b797['params']['id']}})[_0xe3ca('0x24')](handleEntityNotFound(_0x451505,null))[_0xe3ca('0x24')](removeEntity(_0x451505,null))[_0xe3ca('0x44')](handleError(_0x451505,null));};exports[_0xe3ca('0x59')]=function(_0x172e34,_0x5d107f,_0x673cf0){var _0x17e2a={'raw':!![],'where':{}};var _0x1af0a={};var _0x4044f0={'count':0x0,'rows':[]};return db[_0xe3ca('0x2e')][_0xe3ca('0x5a')]({'where':{'id':_0x172e34[_0xe3ca('0x46')]['id']}})[_0xe3ca('0x24')](handleEntityNotFound(_0x5d107f,null))['then'](function(_0x1d2cd2){if(_0x1d2cd2){_0x1af0a[_0xe3ca('0x30')]=_[_0xe3ca('0x32')](db[_0xe3ca('0x5b')][_0xe3ca('0x47')]);_0x1af0a[_0xe3ca('0x31')]=_['keys'](_0x172e34[_0xe3ca('0x31')]);_0x1af0a[_0xe3ca('0x33')]=_[_0xe3ca('0x34')](_0x1af0a['model'],_0x1af0a[_0xe3ca('0x31')]);_0x17e2a[_0xe3ca('0x35')]=_['intersection'](_0x1af0a[_0xe3ca('0x30')],qs[_0xe3ca('0x36')](_0x172e34[_0xe3ca('0x31')][_0xe3ca('0x36')]));_0x17e2a[_0xe3ca('0x35')]=_0x17e2a['attributes'][_0xe3ca('0x48')]?_0x17e2a[_0xe3ca('0x35')]:_0x1af0a['model'];if(!_0x172e34[_0xe3ca('0x31')][_0xe3ca('0x37')]('nolimit')){_0x17e2a[_0xe3ca('0x1d')]=qs[_0xe3ca('0x1d')](_0x172e34['query'][_0xe3ca('0x1d')]);_0x17e2a[_0xe3ca('0x1f')]=qs[_0xe3ca('0x1f')](_0x172e34[_0xe3ca('0x31')][_0xe3ca('0x1f')]);}_0x17e2a[_0xe3ca('0x39')]=qs[_0xe3ca('0x3a')](_0x172e34['query']['sort']);_0x17e2a[_0xe3ca('0x3b')]=qs[_0xe3ca('0x33')](_[_0xe3ca('0x5c')](_0x172e34[_0xe3ca('0x31')],_0x1af0a['filters']));_0x17e2a[_0xe3ca('0x3b')]['ProjectId']=_0x1d2cd2['id'];if(_0x172e34[_0xe3ca('0x31')][_0xe3ca('0x3c')]){_0x17e2a[_0xe3ca('0x3b')]=_[_0xe3ca('0x49')](_0x17e2a[_0xe3ca('0x3b')],{'$or':_[_0xe3ca('0x2d')](_0x17e2a[_0xe3ca('0x35')],function(_0x4894fe){var _0x426f6b={};_0x426f6b[_0x4894fe]={'$like':'%'+_0x172e34['query']['filter']+'%'};return _0x426f6b;})});}_0x17e2a=_['merge']({},_0x17e2a,_0x172e34[_0xe3ca('0x3f')]);return db['JscriptySessionReport'][_0xe3ca('0x1e')]({'where':_0x17e2a['where']})[_0xe3ca('0x24')](function(_0x54001e){_0x4044f0[_0xe3ca('0x1e')]=_0x54001e;if(_0x172e34[_0xe3ca('0x31')][_0xe3ca('0x40')]){_0x17e2a[_0xe3ca('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x17e2a);})[_0xe3ca('0x24')](function(_0x17499b){_0x4044f0[_0xe3ca('0x43')]=_0x17499b;return _0x4044f0;});}})[_0xe3ca('0x24')](respondWithFilteredResult(_0x5d107f,_0x17e2a))[_0xe3ca('0x44')](handleError(_0x5d107f,null));};exports[_0xe3ca('0x5d')]=function(_0x2a5c81,_0x435e60,_0x3a22dd){var _0x1c6959={'raw':!![],'where':{}};var _0x4d1906={};var _0x999f20={'count':0x0,'rows':[]};return db[_0xe3ca('0x2e')][_0xe3ca('0x5a')]({'where':{'id':_0x2a5c81[_0xe3ca('0x46')]['id']}})[_0xe3ca('0x24')](handleEntityNotFound(_0x435e60,null))['then'](function(_0x22685d){if(_0x22685d){_0x4d1906[_0xe3ca('0x30')]=_[_0xe3ca('0x32')](db[_0xe3ca('0x5e')][_0xe3ca('0x47')]);_0x4d1906['query']=_['keys'](_0x2a5c81[_0xe3ca('0x31')]);_0x4d1906[_0xe3ca('0x33')]=_[_0xe3ca('0x34')](_0x4d1906[_0xe3ca('0x30')],_0x4d1906[_0xe3ca('0x31')]);_0x1c6959['attributes']=_[_0xe3ca('0x34')](_0x4d1906[_0xe3ca('0x30')],qs[_0xe3ca('0x36')](_0x2a5c81[_0xe3ca('0x31')]['fields']));_0x1c6959[_0xe3ca('0x35')]=_0x1c6959[_0xe3ca('0x35')]['length']?_0x1c6959[_0xe3ca('0x35')]:_0x4d1906[_0xe3ca('0x30')];if(!_0x2a5c81[_0xe3ca('0x31')][_0xe3ca('0x37')]('nolimit')){_0x1c6959[_0xe3ca('0x1d')]=qs['limit'](_0x2a5c81['query']['limit']);_0x1c6959['offset']=qs['offset'](_0x2a5c81['query'][_0xe3ca('0x1f')]);}_0x1c6959['order']=qs[_0xe3ca('0x3a')](_0x2a5c81[_0xe3ca('0x31')][_0xe3ca('0x3a')]);_0x1c6959[_0xe3ca('0x3b')]=qs[_0xe3ca('0x33')](_[_0xe3ca('0x5c')](_0x2a5c81[_0xe3ca('0x31')],_0x4d1906[_0xe3ca('0x33')]));_0x1c6959[_0xe3ca('0x3b')]['ProjectId']=_0x22685d['id'];if(_0x2a5c81['query'][_0xe3ca('0x3c')]){_0x1c6959[_0xe3ca('0x3b')]=_[_0xe3ca('0x49')](_0x1c6959[_0xe3ca('0x3b')],{'$or':_[_0xe3ca('0x2d')](_0x1c6959[_0xe3ca('0x35')],function(_0x415040){var _0x154cab={};_0x154cab[_0x415040]={'$like':'%'+_0x2a5c81[_0xe3ca('0x31')][_0xe3ca('0x3c')]+'%'};return _0x154cab;})});}_0x1c6959=_['merge']({},_0x1c6959,_0x2a5c81['options']);return db[_0xe3ca('0x5e')][_0xe3ca('0x1e')]({'where':_0x1c6959[_0xe3ca('0x3b')]})[_0xe3ca('0x24')](function(_0x19c3f9){_0x999f20[_0xe3ca('0x1e')]=_0x19c3f9;if(_0x2a5c81[_0xe3ca('0x31')]['includeAll']){_0x1c6959[_0xe3ca('0x41')]=[{'all':!![]}];}return db[_0xe3ca('0x5e')]['findAll'](_0x1c6959);})[_0xe3ca('0x24')](function(_0x46f019){_0x999f20[_0xe3ca('0x43')]=_0x46f019;return _0x999f20;});}})[_0xe3ca('0x24')](respondWithFilteredResult(_0x435e60,_0x1c6959))[_0xe3ca('0x44')](handleError(_0x435e60,null));};function char(_0x55c0f6){return _0xe3ca('0x5f')===typeof _0x55c0f6?String[_0xe3ca('0x60')]['apply'](null,arguments):_0x55c0f6;}function needsEncapsulation(_0x286818){return!!_0x286818&&(_0x286818[_0xe3ca('0x61')]()[_0xe3ca('0x62')](char(0xd))>=0x0||_0x286818['toString']()[_0xe3ca('0x62')](char(0xa))>=0x0||_0x286818[_0xe3ca('0x61')]()[_0xe3ca('0x62')](char(0x2c))>=0x0||_0x286818[_0xe3ca('0x61')]()[_0xe3ca('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4cbae5){var _0x57fb60=char(0x22),_0x28390a='\x5c'+char(0x22),_0x46aba0=_0x4cbae5[_0xe3ca('0x61')]()[_0xe3ca('0x63')](new RegExp(_0x57fb60,'g'),_0x28390a);return _0x57fb60+_0x46aba0+_0x57fb60;}exports[_0xe3ca('0x64')]=function(_0x3ea7a4,_0x2c18a7,_0x5d10ec){var _0x493929,_0x5ba7a9;var _0x42bdba={'where':{'ProjectId':_0x3ea7a4[_0xe3ca('0x46')]['id']}};if(_0x3ea7a4['query'][_0xe3ca('0x65')]){_0x42bdba[_0xe3ca('0x3b')][_0xe3ca('0x66')]=JSON[_0xe3ca('0x67')](_0x3ea7a4[_0xe3ca('0x31')]['startTime']);}return db[_0xe3ca('0x5b')]['findAll'](_0x42bdba)[_0xe3ca('0x24')](handleEntityNotFound(_0x2c18a7,null))[_0xe3ca('0x24')](function(_0x1c8d36){if(_0x1c8d36){_0x493929=_0x1c8d36;return db[_0xe3ca('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0xe3ca('0x2d')](_0x493929,'id')},'ProjectId':_0x3ea7a4[_0xe3ca('0x46')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x2c18a7,null))['then'](function(_0x5c8468){if(_0x5c8468){_0x5ba7a9=_0x5c8468;var _0x2fcc75={};for(var _0x7f427f=0x0,_0x451ce3=_0x5ba7a9[_0xe3ca('0x48')];_0x7f427f<_0x451ce3;_0x7f427f++){if(!_0x2fcc75[_0xe3ca('0x37')](_0x5ba7a9[_0x7f427f][_0xe3ca('0x69')])){_0x2fcc75[_0x5ba7a9[_0x7f427f][_0xe3ca('0x69')]]=needsEncapsulation(_0x5ba7a9[_0x7f427f]['question'])?encapsulate(_0x5ba7a9[_0x7f427f][_0xe3ca('0x6a')]):_0x5ba7a9[_0x7f427f][_0xe3ca('0x6a')];}}var _0x2e1cd3=[],_0x7e75f9={};for(var _0xa4aa44=0x0,_0x3f7754=_0x493929[_0xe3ca('0x48')];_0xa4aa44<_0x3f7754;_0xa4aa44++){_0x7e75f9={'ProjectId':_0x3ea7a4[_0xe3ca('0x46')]['id'],'SessionId':_0x493929[_0xa4aa44]['id'],'StartTime':moment(_0x493929[_0xa4aa44][_0xe3ca('0x66')])[_0xe3ca('0x6b')](_0xe3ca('0x6c'))};for(var _0x405ce1=0x0,_0xa18275=_0x5ba7a9[_0xe3ca('0x48')];_0x405ce1<_0xa18275;_0x405ce1++){if(_0x5ba7a9[_0x405ce1]['SessionId']==_0x493929[_0xa4aa44]['id']&&_0x2fcc75[_0xe3ca('0x37')](_0x5ba7a9[_0x405ce1][_0xe3ca('0x69')])){_0x7e75f9[_0x2fcc75[_0x5ba7a9[_0x405ce1]['questionId']]]=_0x5ba7a9[_0x405ce1][_0xe3ca('0x6d')];}}for(var _0x92f8e9 in _0x2fcc75){if(!_0x7e75f9['hasOwnProperty'](_0x2fcc75[_0x92f8e9])){_0x7e75f9[_0x2fcc75[_0x92f8e9]]=null;}}_0x2e1cd3[_0xe3ca('0x6e')](_0x7e75f9);}return _0x2e1cd3;}})[_0xe3ca('0x24')](function(_0x4dcca5){if(!_[_0xe3ca('0x6f')](_0x4dcca5)){var _0x593e2a=toCsv(_0x4dcca5);var _0x5830df=Date[_0xe3ca('0x70')]();fs[_0xe3ca('0x71')](util[_0xe3ca('0x6b')](_0xe3ca('0x72'),_0x3ea7a4['params']['id'],_0x5830df),_0x593e2a);_0x2c18a7['setHeader'](_0xe3ca('0x73'),'attachment;\x20filename='+util[_0xe3ca('0x6b')](_0xe3ca('0x74'),_0x3ea7a4[_0xe3ca('0x46')]['id'],_0x5830df));_0x2c18a7[_0xe3ca('0x75')](_0xe3ca('0x76'),_0xe3ca('0x77'));return _0x2c18a7[_0xe3ca('0x78')](util[_0xe3ca('0x6b')](_0xe3ca('0x72'),_0x3ea7a4[_0xe3ca('0x46')]['id'],_0x5830df));}else{return _0x2c18a7[_0xe3ca('0x19')](0xcc);}})[_0xe3ca('0x44')](handleError(_0x2c18a7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 444b093..4dab0ac 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 _0xbe3b=['./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','util','../../config/logger','moment','path'];(function(_0x561695,_0x157a4e){var _0x2db5ce=function(_0x56ae89){while(--_0x56ae89){_0x561695['push'](_0x561695['shift']());}};_0x2db5ce(++_0x157a4e);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x405faf,_0x38d0f0){_0x405faf=_0x405faf-0x0;var _0x2308e5=_0xbe3b[_0x405faf];return _0x2308e5;};'use strict';var _=require('lodash');var util=require(_0xbbe3('0x0'));var logger=require(_0xbbe3('0x1'))('api');var moment=require(_0xbbe3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbe3('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbe3('0x4'));module[_0xbbe3('0x5')]=function(_0x257eb0,_0x331557){return _0x257eb0['define'](_0xbbe3('0x6'),attributes,{'tableName':_0xbbe3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f72=['../../config/environment','exports','JscriptyProject','jscripty_projects','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6f72,0xae));var _0x26f7=function(_0x6fa74c,_0x1ebc8b){_0x6fa74c=_0x6fa74c-0x0;var _0x22d795=_0x6f72[_0x6fa74c];return _0x22d795;};'use strict';var _=require('lodash');var util=require(_0x26f7('0x0'));var logger=require(_0x26f7('0x1'))(_0x26f7('0x2'));var moment=require('moment');var BPromise=require(_0x26f7('0x3'));var rp=require(_0x26f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26f7('0x5'));var config=require(_0x26f7('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x26f7('0x7')]=function(_0x50719f,_0x29465a){return _0x50719f['define'](_0x26f7('0x8'),attributes,{'tableName':_0x26f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 4cda843..ad98142 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 _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x58bd4a,_0x1af625){var _0x8e1e85=function(_0x44e694){while(--_0x44e694){_0x58bd4a['push'](_0x58bd4a['shift']());}};_0x8e1e85(++_0x1af625);}(_0xb7e7,0x121));var _0x7b7e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xb7e7[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x259754,_0x5048b9){var _0x255852=function(_0x2147af){while(--_0x2147af){_0x259754['push'](_0x259754['shift']());}};_0x255852(++_0x5048b9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xcb91[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index c93de38..2b6f8b4 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 _0x12e3=['destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12e3,0x86));var _0x312e=function(_0x5cbbc7,_0x4c05ff){_0x5cbbc7=_0x5cbbc7-0x0;var _0x5e2b83=_0x12e3[_0x5cbbc7];return _0x5e2b83;};'use strict';var multer=require(_0x312e('0x0'));var util=require('util');var path=require(_0x312e('0x1'));var timeout=require('connect-timeout');var express=require(_0x312e('0x2'));var router=express[_0x312e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x312e('0x4'));var interaction=require(_0x312e('0x5'));var config=require(_0x312e('0x6'));var controller=require(_0x312e('0x7'));router['get']('/',auth[_0x312e('0x8')](),controller[_0x312e('0x9')]);router[_0x312e('0xa')](_0x312e('0xb'),auth[_0x312e('0x8')](),controller[_0x312e('0xc')]);router[_0x312e('0xa')]('/:id',auth[_0x312e('0x8')](),controller[_0x312e('0xd')]);router[_0x312e('0xe')]('/',auth[_0x312e('0x8')](),controller[_0x312e('0xf')]);router[_0x312e('0x10')](_0x312e('0x11'),auth['isAuthenticated'](),controller[_0x312e('0x12')]);router[_0x312e('0x13')](_0x312e('0x11'),auth[_0x312e('0x8')](),controller[_0x312e('0x14')]);module[_0x312e('0x15')]=router; \ No newline at end of file +var _0x9c5d=['isAuthenticated','/describe','describe','/:id','post','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0xdcc253,_0x3a7395){var _0x4eda84=function(_0x309206){while(--_0x309206){_0xdcc253['push'](_0xdcc253['shift']());}};_0x4eda84(++_0x3a7395);}(_0x9c5d,0x14b));var _0xd9c5=function(_0x34ed02,_0x3eddbb){_0x34ed02=_0x34ed02-0x0;var _0xa80fcd=_0x9c5d[_0x34ed02];return _0xa80fcd;};'use strict';var multer=require(_0xd9c5('0x0'));var util=require(_0xd9c5('0x1'));var path=require(_0xd9c5('0x2'));var timeout=require(_0xd9c5('0x3'));var express=require('express');var router=express[_0xd9c5('0x4')]();var fs_extra=require(_0xd9c5('0x5'));var auth=require(_0xd9c5('0x6'));var interaction=require(_0xd9c5('0x7'));var config=require(_0xd9c5('0x8'));var controller=require(_0xd9c5('0x9'));router[_0xd9c5('0xa')]('/',auth[_0xd9c5('0xb')](),controller['index']);router[_0xd9c5('0xa')](_0xd9c5('0xc'),auth[_0xd9c5('0xb')](),controller[_0xd9c5('0xd')]);router[_0xd9c5('0xa')](_0xd9c5('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xd9c5('0xf')]('/',auth[_0xd9c5('0xb')](),controller[_0xd9c5('0x10')]);router['put'](_0xd9c5('0xe'),auth[_0xd9c5('0xb')](),controller['update']);router[_0xd9c5('0x11')](_0xd9c5('0xe'),auth[_0xd9c5('0xb')](),controller['destroy']);module[_0xd9c5('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 c687785..a1a1072 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x11f079,_0x17cdda){_0x11f079=_0x11f079-0x0;var _0x23262c=_0x7a54[_0x11f079];return _0x23262c;};'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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x54ff2b,_0x151cb2){_0x54ff2b=_0x54ff2b-0x0;var _0x37693e=_0x7a54[_0x54ff2b];return _0x37693e;};'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 b1c0442..f603a3d 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 _0x504b=['offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x43ab53,_0x4715e6){var _0x2bf9b1=function(_0x4f414b){while(--_0x4f414b){_0x43ab53['push'](_0x43ab53['shift']());}};_0x2bf9b1(++_0x4715e6);}(_0x504b,0x117));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb504('0x0'));var rimraf=require(_0xb504('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb504('0x2'));var rp=require(_0xb504('0x3'));var moment=require(_0xb504('0x4'));var BPromise=require(_0xb504('0x5'));var Mustache=require('mustache');var util=require(_0xb504('0x6'));var path=require(_0xb504('0x7'));var sox=require(_0xb504('0x8'));var csv=require(_0xb504('0x9'));var ejs=require(_0xb504('0xa'));var fs=require('fs');var fs_extra=require(_0xb504('0xb'));var _=require('lodash');var squel=require(_0xb504('0xc'));var crypto=require(_0xb504('0xd'));var jsforce=require(_0xb504('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb504('0x9'));var querystring=require(_0xb504('0xf'));var Papa=require(_0xb504('0x10'));var Redis=require(_0xb504('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb504('0x12'));var as=require(_0xb504('0x13'));var hardwareService=require(_0xb504('0x14'));var logger=require(_0xb504('0x15'))(_0xb504('0x16'));var utils=require('../../config/utils');var config=require(_0xb504('0x17'));var licenseUtil=require(_0xb504('0x18'));var db=require(_0xb504('0x19'))['db'];function respondWithStatusCode(_0xcba048,_0x4514ab){_0x4514ab=_0x4514ab||0xcc;return function(_0x1b785d){if(_0x1b785d){return _0xcba048['sendStatus'](_0x4514ab);}return _0xcba048[_0xb504('0x1a')](_0x4514ab)[_0xb504('0x1b')]();};}function respondWithResult(_0x473152,_0x110da8){_0x110da8=_0x110da8||0xc8;return function(_0x35638c){if(_0x35638c){return _0x473152[_0xb504('0x1a')](_0x110da8)[_0xb504('0x1c')](_0x35638c);}};}function respondWithFilteredResult(_0x4072c2,_0x2bded8){return function(_0x37e2f7){if(_0x37e2f7){var _0x4aa20a=typeof _0x2bded8[_0xb504('0x1d')]===_0xb504('0x1e')&&typeof _0x2bded8[_0xb504('0x1f')]===_0xb504('0x1e');var _0x32e50f=_0x37e2f7[_0xb504('0x20')];var _0x528a3f=_0x4aa20a?0x0:_0x2bded8[_0xb504('0x1d')];var _0x407d03=_0x4aa20a?_0x37e2f7[_0xb504('0x20')]:_0x2bded8['offset']+_0x2bded8[_0xb504('0x1f')];var _0x214b3d;if(_0x407d03>=_0x32e50f){_0x407d03=_0x32e50f;_0x214b3d=0xc8;}else{_0x214b3d=0xce;}_0x4072c2['status'](_0x214b3d);return _0x4072c2['set']('Content-Range',_0x528a3f+'-'+_0x407d03+'/'+_0x32e50f)['json'](_0x37e2f7);}return null;};}function patchUpdates(_0x2e0a06){return function(_0x244582){try{jsonpatch[_0xb504('0x21')](_0x244582,_0x2e0a06,!![]);}catch(_0x2fc6b4){return BPromise[_0xb504('0x22')](_0x2fc6b4);}return _0x244582[_0xb504('0x23')]();};}function saveUpdates(_0x21593e,_0x4dc27f){return function(_0x17fb7f){if(_0x17fb7f){return _0x17fb7f[_0xb504('0x24')](_0x21593e)[_0xb504('0x25')](function(_0x1625d9){return _0x1625d9;});}return null;};}function removeEntity(_0x1f063f,_0x34f1a5){return function(_0x147966){if(_0x147966){return _0x147966[_0xb504('0x26')]()[_0xb504('0x25')](function(){_0x1f063f['status'](0xcc)[_0xb504('0x1b')]();});}};}function handleEntityNotFound(_0x243736,_0x566318){return function(_0x36f5fc){if(!_0x36f5fc){_0x243736[_0xb504('0x27')](0x194);}return _0x36f5fc;};}function handleError(_0x553c52,_0x3dbcfc){_0x3dbcfc=_0x3dbcfc||0x1f4;return function(_0xb4a71e){logger[_0xb504('0x28')](_0xb4a71e[_0xb504('0x29')]);if(_0xb4a71e[_0xb504('0x2a')]){delete _0xb4a71e[_0xb504('0x2a')];}_0x553c52['status'](_0x3dbcfc)[_0xb504('0x2b')](_0xb4a71e);};}exports[_0xb504('0x2c')]=function(_0x32a7e1,_0x585f7b){var _0x1b0848={},_0xd13592={},_0x472351={'count':0x0,'rows':[]};var _0x15144e=_[_0xb504('0x2d')](db[_0xb504('0x2e')]['rawAttributes'],function(_0x42c4c1){return{'name':_0x42c4c1[_0xb504('0x2f')],'type':_0x42c4c1['type'][_0xb504('0x30')]};});_0xd13592[_0xb504('0x31')]=_[_0xb504('0x2d')](_0x15144e,_0xb504('0x2a'));_0xd13592['query']=_['keys'](_0x32a7e1[_0xb504('0x32')]);_0xd13592[_0xb504('0x33')]=_[_0xb504('0x34')](_0xd13592[_0xb504('0x31')],_0xd13592[_0xb504('0x32')]);_0x1b0848[_0xb504('0x35')]=_[_0xb504('0x34')](_0xd13592[_0xb504('0x31')],qs[_0xb504('0x36')](_0x32a7e1[_0xb504('0x32')]['fields']));_0x1b0848[_0xb504('0x35')]=_0x1b0848[_0xb504('0x35')][_0xb504('0x37')]?_0x1b0848[_0xb504('0x35')]:_0xd13592['model'];if(!_0x32a7e1[_0xb504('0x32')]['hasOwnProperty'](_0xb504('0x38'))){_0x1b0848['limit']=qs[_0xb504('0x1f')](_0x32a7e1[_0xb504('0x32')][_0xb504('0x1f')]);_0x1b0848[_0xb504('0x1d')]=qs[_0xb504('0x1d')](_0x32a7e1['query'][_0xb504('0x1d')]);}_0x1b0848['order']=qs[_0xb504('0x39')](_0x32a7e1[_0xb504('0x32')][_0xb504('0x39')]);_0x1b0848[_0xb504('0x3a')]=qs[_0xb504('0x33')](_[_0xb504('0x3b')](_0x32a7e1['query'],_0xd13592[_0xb504('0x33')]),_0x15144e);if(_0x32a7e1[_0xb504('0x32')][_0xb504('0x3c')]){_0x1b0848['where']=_[_0xb504('0x3d')](_0x1b0848[_0xb504('0x3a')],{'$or':_['map'](_0x15144e,function(_0x955775){if(_0x955775[_0xb504('0x3e')]!==_0xb504('0x3f')){var _0x528d01={};_0x528d01[_0x955775[_0xb504('0x2a')]]={'$like':'%'+_0x32a7e1[_0xb504('0x32')]['filter']+'%'};return _0x528d01;}})});}_0x1b0848=_['merge']({},_0x1b0848,_0x32a7e1['options']);var _0x2a825c={'where':_0x1b0848[_0xb504('0x3a')]};return db[_0xb504('0x2e')]['count'](_0x2a825c)['then'](function(_0x1b9ea4){_0x472351['count']=_0x1b9ea4;if(_0x32a7e1[_0xb504('0x32')][_0xb504('0x40')]){_0x1b0848[_0xb504('0x41')]=[{'all':!![]}];}return db[_0xb504('0x2e')][_0xb504('0x42')](_0x1b0848);})['then'](function(_0x54a3c3){_0x472351[_0xb504('0x43')]=_0x54a3c3;return _0x472351;})['then'](respondWithFilteredResult(_0x585f7b,_0x1b0848))['catch'](handleError(_0x585f7b,null));};exports['show']=function(_0x15ffe7,_0x1240db){var _0x468c3d={'raw':!![],'where':{'id':_0x15ffe7[_0xb504('0x44')]['id']}},_0x274bf9={};_0x274bf9['model']=_[_0xb504('0x45')](db['JscriptyQuestionReport'][_0xb504('0x46')]);_0x274bf9[_0xb504('0x32')]=_['keys'](_0x15ffe7[_0xb504('0x32')]);_0x274bf9['filters']=_['intersection'](_0x274bf9['model'],_0x274bf9[_0xb504('0x32')]);_0x468c3d['attributes']=_[_0xb504('0x34')](_0x274bf9[_0xb504('0x31')],qs[_0xb504('0x36')](_0x15ffe7[_0xb504('0x32')][_0xb504('0x36')]));_0x468c3d[_0xb504('0x35')]=_0x468c3d['attributes'][_0xb504('0x37')]?_0x468c3d[_0xb504('0x35')]:_0x274bf9[_0xb504('0x31')];if(_0x15ffe7[_0xb504('0x32')]['includeAll']){_0x468c3d[_0xb504('0x41')]=[{'all':!![]}];}_0x468c3d=_['merge']({},_0x468c3d,_0x15ffe7[_0xb504('0x47')]);return db[_0xb504('0x2e')][_0xb504('0x48')](_0x468c3d)[_0xb504('0x25')](handleEntityNotFound(_0x1240db,null))[_0xb504('0x25')](respondWithResult(_0x1240db,null))[_0xb504('0x49')](handleError(_0x1240db,null));};exports[_0xb504('0x4a')]=function(_0x53cc56,_0x101077){return db[_0xb504('0x2e')][_0xb504('0x4a')](_0x53cc56[_0xb504('0x4b')],{})[_0xb504('0x25')](respondWithResult(_0x101077,0xc9))[_0xb504('0x49')](handleError(_0x101077,null));};exports[_0xb504('0x24')]=function(_0x169d94,_0x421ce4){if(_0x169d94['body']['id']){delete _0x169d94[_0xb504('0x4b')]['id'];}return db[_0xb504('0x2e')][_0xb504('0x48')]({'where':{'id':_0x169d94['params']['id']}})[_0xb504('0x25')](handleEntityNotFound(_0x421ce4,null))[_0xb504('0x25')](saveUpdates(_0x169d94[_0xb504('0x4b')],null))['then'](respondWithResult(_0x421ce4,null))['catch'](handleError(_0x421ce4,null));};exports[_0xb504('0x26')]=function(_0x27996a,_0x475acd){return db['JscriptyQuestionReport'][_0xb504('0x48')]({'where':{'id':_0x27996a[_0xb504('0x44')]['id']}})[_0xb504('0x25')](handleEntityNotFound(_0x475acd,null))[_0xb504('0x25')](removeEntity(_0x475acd,null))[_0xb504('0x49')](handleError(_0x475acd,null));};exports['describe']=function(_0x4b250a,_0x57c8b4){return db[_0xb504('0x2e')][_0xb504('0x4c')]()[_0xb504('0x25')](respondWithResult(_0x57c8b4,null))[_0xb504('0x49')](handleError(_0x57c8b4,null));}; \ No newline at end of file +var _0xc866=['type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','rimraf','fast-json-patch','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName'];(function(_0x335020,_0x38bce9){var _0x3e91d6=function(_0x16b60e){while(--_0x16b60e){_0x335020['push'](_0x335020['shift']());}};_0x3e91d6(++_0x38bce9);}(_0xc866,0x1e0));var _0x6c86=function(_0xbc207,_0x57e43f){_0xbc207=_0xbc207-0x0;var _0x560154=_0xc866[_0xbc207];return _0x560154;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c86('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c86('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c86('0x2'));var Mustache=require('mustache');var util=require(_0x6c86('0x3'));var path=require(_0x6c86('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c86('0x5'));var fs=require('fs');var fs_extra=require(_0x6c86('0x6'));var _=require('lodash');var squel=require(_0x6c86('0x7'));var crypto=require(_0x6c86('0x8'));var jsforce=require(_0x6c86('0x9'));var deskjs=require(_0x6c86('0xa'));var toCsv=require(_0x6c86('0xb'));var querystring=require(_0x6c86('0xc'));var Papa=require(_0x6c86('0xd'));var Redis=require(_0x6c86('0xe'));var authService=require(_0x6c86('0xf'));var qs=require(_0x6c86('0x10'));var as=require(_0x6c86('0x11'));var hardwareService=require(_0x6c86('0x12'));var logger=require(_0x6c86('0x13'))(_0x6c86('0x14'));var utils=require('../../config/utils');var config=require(_0x6c86('0x15'));var licenseUtil=require(_0x6c86('0x16'));var db=require(_0x6c86('0x17'))['db'];function respondWithStatusCode(_0x26a915,_0x438ee4){_0x438ee4=_0x438ee4||0xcc;return function(_0x639be4){if(_0x639be4){return _0x26a915['sendStatus'](_0x438ee4);}return _0x26a915[_0x6c86('0x18')](_0x438ee4)[_0x6c86('0x19')]();};}function respondWithResult(_0x1abfaf,_0x2e787d){_0x2e787d=_0x2e787d||0xc8;return function(_0x5e6abf){if(_0x5e6abf){return _0x1abfaf[_0x6c86('0x18')](_0x2e787d)[_0x6c86('0x1a')](_0x5e6abf);}};}function respondWithFilteredResult(_0x5cdf02,_0x301465){return function(_0x2bb354){if(_0x2bb354){var _0x9d3c84=typeof _0x301465[_0x6c86('0x1b')]===_0x6c86('0x1c')&&typeof _0x301465[_0x6c86('0x1d')]==='undefined';var _0x49f839=_0x2bb354[_0x6c86('0x1e')];var _0x282aa7=_0x9d3c84?0x0:_0x301465[_0x6c86('0x1b')];var _0x45352f=_0x9d3c84?_0x2bb354['count']:_0x301465[_0x6c86('0x1b')]+_0x301465['limit'];var _0x3b6351;if(_0x45352f>=_0x49f839){_0x45352f=_0x49f839;_0x3b6351=0xc8;}else{_0x3b6351=0xce;}_0x5cdf02['status'](_0x3b6351);return _0x5cdf02['set']('Content-Range',_0x282aa7+'-'+_0x45352f+'/'+_0x49f839)[_0x6c86('0x1a')](_0x2bb354);}return null;};}function patchUpdates(_0x44ad10){return function(_0x315e58){try{jsonpatch[_0x6c86('0x1f')](_0x315e58,_0x44ad10,!![]);}catch(_0x317b55){return BPromise[_0x6c86('0x20')](_0x317b55);}return _0x315e58[_0x6c86('0x21')]();};}function saveUpdates(_0x556d5c,_0x444b61){return function(_0x18ba86){if(_0x18ba86){return _0x18ba86[_0x6c86('0x22')](_0x556d5c)[_0x6c86('0x23')](function(_0x256fac){return _0x256fac;});}return null;};}function removeEntity(_0x49ba49,_0x461052){return function(_0x2ece33){if(_0x2ece33){return _0x2ece33[_0x6c86('0x24')]()['then'](function(){_0x49ba49[_0x6c86('0x18')](0xcc)[_0x6c86('0x19')]();});}};}function handleEntityNotFound(_0x240dee,_0x5910b1){return function(_0x541d53){if(!_0x541d53){_0x240dee['sendStatus'](0x194);}return _0x541d53;};}function handleError(_0x3246ab,_0xace8d1){_0xace8d1=_0xace8d1||0x1f4;return function(_0x1282f5){logger[_0x6c86('0x25')](_0x1282f5[_0x6c86('0x26')]);if(_0x1282f5['name']){delete _0x1282f5[_0x6c86('0x27')];}_0x3246ab['status'](_0xace8d1)[_0x6c86('0x28')](_0x1282f5);};}exports[_0x6c86('0x29')]=function(_0x185092,_0xf40807){var _0xbcff0b={},_0x3c8869={},_0x367dc1={'count':0x0,'rows':[]};var _0x672efd=_[_0x6c86('0x2a')](db[_0x6c86('0x2b')]['rawAttributes'],function(_0x3598a7){return{'name':_0x3598a7[_0x6c86('0x2c')],'type':_0x3598a7[_0x6c86('0x2d')][_0x6c86('0x2e')]};});_0x3c8869[_0x6c86('0x2f')]=_[_0x6c86('0x2a')](_0x672efd,_0x6c86('0x27'));_0x3c8869[_0x6c86('0x30')]=_[_0x6c86('0x31')](_0x185092[_0x6c86('0x30')]);_0x3c8869['filters']=_[_0x6c86('0x32')](_0x3c8869[_0x6c86('0x2f')],_0x3c8869[_0x6c86('0x30')]);_0xbcff0b[_0x6c86('0x33')]=_['intersection'](_0x3c8869[_0x6c86('0x2f')],qs[_0x6c86('0x34')](_0x185092['query'][_0x6c86('0x34')]));_0xbcff0b[_0x6c86('0x33')]=_0xbcff0b['attributes']['length']?_0xbcff0b[_0x6c86('0x33')]:_0x3c8869['model'];if(!_0x185092['query'][_0x6c86('0x35')](_0x6c86('0x36'))){_0xbcff0b[_0x6c86('0x1d')]=qs[_0x6c86('0x1d')](_0x185092[_0x6c86('0x30')]['limit']);_0xbcff0b[_0x6c86('0x1b')]=qs[_0x6c86('0x1b')](_0x185092['query'][_0x6c86('0x1b')]);}_0xbcff0b[_0x6c86('0x37')]=qs[_0x6c86('0x38')](_0x185092[_0x6c86('0x30')][_0x6c86('0x38')]);_0xbcff0b[_0x6c86('0x39')]=qs[_0x6c86('0x3a')](_[_0x6c86('0x3b')](_0x185092['query'],_0x3c8869[_0x6c86('0x3a')]),_0x672efd);if(_0x185092['query'][_0x6c86('0x3c')]){_0xbcff0b['where']=_[_0x6c86('0x3d')](_0xbcff0b[_0x6c86('0x39')],{'$or':_[_0x6c86('0x2a')](_0x672efd,function(_0x40cb86){if(_0x40cb86[_0x6c86('0x2d')]!=='VIRTUAL'){var _0x286eb3={};_0x286eb3[_0x40cb86[_0x6c86('0x27')]]={'$like':'%'+_0x185092[_0x6c86('0x30')][_0x6c86('0x3c')]+'%'};return _0x286eb3;}})});}_0xbcff0b=_[_0x6c86('0x3d')]({},_0xbcff0b,_0x185092[_0x6c86('0x3e')]);var _0x396f08={'where':_0xbcff0b[_0x6c86('0x39')]};return db[_0x6c86('0x2b')][_0x6c86('0x1e')](_0x396f08)[_0x6c86('0x23')](function(_0x2a6d2c){_0x367dc1[_0x6c86('0x1e')]=_0x2a6d2c;if(_0x185092['query']['includeAll']){_0xbcff0b[_0x6c86('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6c86('0x40')](_0xbcff0b);})[_0x6c86('0x23')](function(_0x5bdf60){_0x367dc1[_0x6c86('0x41')]=_0x5bdf60;return _0x367dc1;})['then'](respondWithFilteredResult(_0xf40807,_0xbcff0b))[_0x6c86('0x42')](handleError(_0xf40807,null));};exports[_0x6c86('0x43')]=function(_0x2863bf,_0x471eb2){var _0x2d1a19={'raw':!![],'where':{'id':_0x2863bf[_0x6c86('0x44')]['id']}},_0x21ee32={};_0x21ee32[_0x6c86('0x2f')]=_['keys'](db[_0x6c86('0x2b')][_0x6c86('0x45')]);_0x21ee32[_0x6c86('0x30')]=_[_0x6c86('0x31')](_0x2863bf['query']);_0x21ee32[_0x6c86('0x3a')]=_['intersection'](_0x21ee32[_0x6c86('0x2f')],_0x21ee32[_0x6c86('0x30')]);_0x2d1a19[_0x6c86('0x33')]=_['intersection'](_0x21ee32[_0x6c86('0x2f')],qs[_0x6c86('0x34')](_0x2863bf[_0x6c86('0x30')][_0x6c86('0x34')]));_0x2d1a19[_0x6c86('0x33')]=_0x2d1a19[_0x6c86('0x33')][_0x6c86('0x46')]?_0x2d1a19[_0x6c86('0x33')]:_0x21ee32['model'];if(_0x2863bf['query']['includeAll']){_0x2d1a19['include']=[{'all':!![]}];}_0x2d1a19=_[_0x6c86('0x3d')]({},_0x2d1a19,_0x2863bf['options']);return db[_0x6c86('0x2b')][_0x6c86('0x47')](_0x2d1a19)['then'](handleEntityNotFound(_0x471eb2,null))[_0x6c86('0x23')](respondWithResult(_0x471eb2,null))['catch'](handleError(_0x471eb2,null));};exports[_0x6c86('0x48')]=function(_0x323b9b,_0x32a29a){return db[_0x6c86('0x2b')][_0x6c86('0x48')](_0x323b9b[_0x6c86('0x49')],{})[_0x6c86('0x23')](respondWithResult(_0x32a29a,0xc9))[_0x6c86('0x42')](handleError(_0x32a29a,null));};exports[_0x6c86('0x22')]=function(_0x22a30b,_0x22d862){if(_0x22a30b[_0x6c86('0x49')]['id']){delete _0x22a30b[_0x6c86('0x49')]['id'];}return db[_0x6c86('0x2b')][_0x6c86('0x47')]({'where':{'id':_0x22a30b[_0x6c86('0x44')]['id']}})[_0x6c86('0x23')](handleEntityNotFound(_0x22d862,null))[_0x6c86('0x23')](saveUpdates(_0x22a30b[_0x6c86('0x49')],null))[_0x6c86('0x23')](respondWithResult(_0x22d862,null))[_0x6c86('0x42')](handleError(_0x22d862,null));};exports['destroy']=function(_0x59990a,_0x41acc2){return db[_0x6c86('0x2b')][_0x6c86('0x47')]({'where':{'id':_0x59990a['params']['id']}})[_0x6c86('0x23')](handleEntityNotFound(_0x41acc2,null))['then'](removeEntity(_0x41acc2,null))[_0x6c86('0x42')](handleError(_0x41acc2,null));};exports[_0x6c86('0x4a')]=function(_0x210182,_0x2122da){return db[_0x6c86('0x2b')]['describe']()[_0x6c86('0x23')](respondWithResult(_0x2122da,null))[_0x6c86('0x42')](handleError(_0x2122da,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4b4fe4f..9df00b4 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 _0x2f54=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x750e29,_0x3c464b){var _0x3a2e2c=function(_0x10e515){while(--_0x10e515){_0x750e29['push'](_0x750e29['shift']());}};_0x3a2e2c(++_0x3c464b);}(_0x2f54,0xfa));var _0x42f5=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x2f54[_0x151334];return _0x3d03da;};'use strict';var _=require(_0x42f5('0x0'));var util=require(_0x42f5('0x1'));var logger=require('../../config/logger')(_0x42f5('0x2'));var moment=require(_0x42f5('0x3'));var BPromise=require(_0x42f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42f5('0x5'));var rimraf=require(_0x42f5('0x6'));var config=require(_0x42f5('0x7'));var attributes=require(_0x42f5('0x8'));module[_0x42f5('0x9')]=function(_0x88809d,_0x1903de){return _0x88809d[_0x42f5('0xa')](_0x42f5('0xb'),attributes,{'tableName':_0x42f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff02=['exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x241bb6,_0x5aa4a7){var _0x569d02=function(_0xd75cbe){while(--_0xd75cbe){_0x241bb6['push'](_0x241bb6['shift']());}};_0x569d02(++_0x5aa4a7);}(_0xff02,0x1e4));var _0x2ff0=function(_0x3ffd4b,_0x140acc){_0x3ffd4b=_0x3ffd4b-0x0;var _0x1fa340=_0xff02[_0x3ffd4b];return _0x1fa340;};'use strict';var _=require(_0x2ff0('0x0'));var util=require(_0x2ff0('0x1'));var logger=require('../../config/logger')(_0x2ff0('0x2'));var moment=require(_0x2ff0('0x3'));var BPromise=require(_0x2ff0('0x4'));var rp=require(_0x2ff0('0x5'));var fs=require('fs');var path=require(_0x2ff0('0x6'));var rimraf=require(_0x2ff0('0x7'));var config=require(_0x2ff0('0x8'));var attributes=require(_0x2ff0('0x9'));module[_0x2ff0('0xa')]=function(_0x34168b,_0x49c7c8){return _0x34168b['define'](_0x2ff0('0xb'),attributes,{'tableName':_0x2ff0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 6536d8a..d0fa0f3 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 _0xa7d7=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x16cc9d,_0x13e85f){var _0x41c6e8=function(_0x23fe2f){while(--_0x23fe2f){_0x16cc9d['push'](_0x16cc9d['shift']());}};_0x41c6e8(++_0x13e85f);}(_0xa7d7,0x1e8));var _0x7a7d=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xa7d7[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require(_0x7a7d('0x4'));var fs=require('fs');var Redis=require(_0x7a7d('0x5'));var db=require(_0x7a7d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a7d('0x7'))('rpc');var config=require(_0x7a7d('0x8'));var jayson=require(_0x7a7d('0x9'));var client=jayson[_0x7a7d('0xa')][_0x7a7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d95e,_0x5b1d1d,_0x22ed26){return new BPromise(function(_0x3dcf68,_0x11a993){return client[_0x7a7d('0xc')](_0x29d95e,_0x22ed26)[_0x7a7d('0xd')](function(_0x39e61c){logger[_0x7a7d('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5b1d1d,'request\x20sent');logger[_0x7a7d('0xf')](_0x7a7d('0x10'),_0x5b1d1d,_0x7a7d('0x11'),JSON[_0x7a7d('0x12')](_0x39e61c));if(_0x39e61c[_0x7a7d('0x13')]){if(_0x39e61c[_0x7a7d('0x13')][_0x7a7d('0x14')]===0x1f4){logger[_0x7a7d('0x13')](_0x7a7d('0x15'),_0x5b1d1d,_0x39e61c[_0x7a7d('0x13')][_0x7a7d('0x16')]);return _0x11a993(_0x39e61c[_0x7a7d('0x13')][_0x7a7d('0x16')]);}logger[_0x7a7d('0x13')](_0x7a7d('0x15'),_0x5b1d1d,_0x39e61c['error']['message']);return _0x3dcf68(_0x39e61c[_0x7a7d('0x13')]['message']);}else{logger[_0x7a7d('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5b1d1d,_0x7a7d('0x11'));_0x3dcf68(_0x39e61c[_0x7a7d('0x17')]['message']);}})['catch'](function(_0x19c1a1){logger['error'](_0x7a7d('0x15'),_0x5b1d1d,_0x19c1a1);_0x11a993(_0x19c1a1);});});} \ No newline at end of file +var _0xda75=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0xbc8a7f,_0x190fed){var _0x177194=function(_0x103095){while(--_0x103095){_0xbc8a7f['push'](_0xbc8a7f['shift']());}};_0x177194(++_0x190fed);}(_0xda75,0x7a));var _0x5da7=function(_0x443114,_0x374e8c){_0x443114=_0x443114-0x0;var _0x404ed4=_0xda75[_0x443114];return _0x404ed4;};'use strict';var _=require(_0x5da7('0x0'));var util=require(_0x5da7('0x1'));var moment=require(_0x5da7('0x2'));var BPromise=require(_0x5da7('0x3'));var rs=require(_0x5da7('0x4'));var fs=require('fs');var Redis=require(_0x5da7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5da7('0x6'));var logger=require(_0x5da7('0x7'))(_0x5da7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5da7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4315,_0x4ca0d0,_0x15fce5){return new BPromise(function(_0x9a523d,_0x1d1b66){return client[_0x5da7('0xa')](_0x3f4315,_0x15fce5)[_0x5da7('0xb')](function(_0x4a16f4){logger[_0x5da7('0xc')](_0x5da7('0xd'),_0x4ca0d0,'request\x20sent');logger[_0x5da7('0xe')](_0x5da7('0xf'),_0x4ca0d0,_0x5da7('0x10'),JSON[_0x5da7('0x11')](_0x4a16f4));if(_0x4a16f4[_0x5da7('0x12')]){if(_0x4a16f4['error'][_0x5da7('0x13')]===0x1f4){logger[_0x5da7('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ca0d0,_0x4a16f4['error'][_0x5da7('0x14')]);return _0x1d1b66(_0x4a16f4[_0x5da7('0x12')]['message']);}logger[_0x5da7('0x12')](_0x5da7('0xd'),_0x4ca0d0,_0x4a16f4[_0x5da7('0x12')][_0x5da7('0x14')]);return _0x9a523d(_0x4a16f4[_0x5da7('0x12')][_0x5da7('0x14')]);}else{logger['info'](_0x5da7('0xd'),_0x4ca0d0,_0x5da7('0x10'));_0x9a523d(_0x4a16f4['result'][_0x5da7('0x14')]);}})[_0x5da7('0x15')](function(_0x332b0f){logger[_0x5da7('0x12')](_0x5da7('0xd'),_0x4ca0d0,_0x332b0f);_0x1d1b66(_0x332b0f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f81e425..be9203d 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 _0x62e4=['isAuthenticated','get','/describe','describe','/:id','show','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62e4,0xea));var _0x462e=function(_0x3fe0b5,_0x1e96f7){_0x3fe0b5=_0x3fe0b5-0x0;var _0xa0fc52=_0x62e4[_0x3fe0b5];return _0xa0fc52;};'use strict';var multer=require(_0x462e('0x0'));var util=require(_0x462e('0x1'));var path=require(_0x462e('0x2'));var timeout=require(_0x462e('0x3'));var express=require('express');var router=express[_0x462e('0x4')]();var fs_extra=require(_0x462e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x462e('0x6'));var config=require('../../config/environment');var controller=require(_0x462e('0x7'));router['get']('/',auth[_0x462e('0x8')](),controller['index']);router[_0x462e('0x9')](_0x462e('0xa'),auth[_0x462e('0x8')](),controller[_0x462e('0xb')]);router[_0x462e('0x9')](_0x462e('0xc'),auth['isAuthenticated'](),controller[_0x462e('0xd')]);router[_0x462e('0x9')]('/:id/questions',auth[_0x462e('0x8')](),controller[_0x462e('0xe')]);router[_0x462e('0xf')]('/',auth[_0x462e('0x8')](),controller[_0x462e('0x10')]);router[_0x462e('0x11')](_0x462e('0xc'),auth['isAuthenticated'](),controller[_0x462e('0x12')]);router[_0x462e('0x13')](_0x462e('0xc'),auth[_0x462e('0x8')](),controller[_0x462e('0x14')]);module[_0x462e('0x15')]=router; \ No newline at end of file +var _0xbea6=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','show','/:id/questions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x254bc4,_0x95004f){var _0x2f89d6=function(_0x33100a){while(--_0x33100a){_0x254bc4['push'](_0x254bc4['shift']());}};_0x2f89d6(++_0x95004f);}(_0xbea6,0x15a));var _0x6bea=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xbea6[_0x4e7d25];return _0x526fe6;};'use strict';var multer=require(_0x6bea('0x0'));var util=require(_0x6bea('0x1'));var path=require(_0x6bea('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bea('0x3'));var router=express['Router']();var fs_extra=require(_0x6bea('0x4'));var auth=require(_0x6bea('0x5'));var interaction=require(_0x6bea('0x6'));var config=require(_0x6bea('0x7'));var controller=require(_0x6bea('0x8'));router[_0x6bea('0x9')]('/',auth[_0x6bea('0xa')](),controller[_0x6bea('0xb')]);router[_0x6bea('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6bea('0x9')]('/:id',auth[_0x6bea('0xa')](),controller[_0x6bea('0xc')]);router[_0x6bea('0x9')](_0x6bea('0xd'),auth[_0x6bea('0xa')](),controller['getQuestions']);router[_0x6bea('0xe')]('/',auth[_0x6bea('0xa')](),controller[_0x6bea('0xf')]);router[_0x6bea('0x10')](_0x6bea('0x11'),auth[_0x6bea('0xa')](),controller[_0x6bea('0x12')]);router[_0x6bea('0x13')](_0x6bea('0x11'),auth[_0x6bea('0xa')](),controller[_0x6bea('0x14')]);module[_0x6bea('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9fbeb78..43835e6 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 _0x4500=['setDataValue','endtime','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0x281117,_0x1021a6){var _0x1f2541=function(_0x298079){while(--_0x298079){_0x281117['push'](_0x281117['shift']());}};_0x1f2541(++_0x1021a6);}(_0x4500,0x154));var _0x0450=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0x4500[_0x210b93];return _0x2b020f;};'use strict';var moment=require('moment');var Sequelize=require(_0x0450('0x0'));module[_0x0450('0x1')]={'starttime':{'type':Sequelize[_0x0450('0x2')],'set':function(_0x2891ca){this[_0x0450('0x3')]('starttime',_0x2891ca);this[_0x0450('0x3')](_0x0450('0x4'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x0450('0x2')]},'membername':{'type':Sequelize[_0x0450('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0450('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0450('0x5')]},'calleridnum':{'type':Sequelize[_0x0450('0x5')]},'completed':{'type':Sequelize[_0x0450('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x1691=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize'];(function(_0x5f5997,_0x2c623a){var _0x1ee207=function(_0x2ed535){while(--_0x2ed535){_0x5f5997['push'](_0x5f5997['shift']());}};_0x1ee207(++_0x2c623a);}(_0x1691,0x1ed));var _0x1169=function(_0x86eb44,_0x1960f3){_0x86eb44=_0x86eb44-0x0;var _0x1f070b=_0x1691[_0x86eb44];return _0x1f070b;};'use strict';var moment=require(_0x1169('0x0'));var Sequelize=require(_0x1169('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1169('0x2')],'set':function(_0x1419c0){this[_0x1169('0x3')](_0x1169('0x4'),_0x1419c0);this[_0x1169('0x3')](_0x1169('0x5'),moment()[_0x1169('0x6')](_0x1169('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x1169('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1169('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1169('0x8')]},'calleridnum':{'type':Sequelize[_0x1169('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index be08701..089cb03 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 _0x9ef2=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','findAll','show','params','merge','find','create','body','catch','describe','findOne','JscriptyQuestionReport','pick','SessionId','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3d7581,_0x2f9801){var _0x4a8fb3=function(_0x1f9752){while(--_0x1f9752){_0x3d7581['push'](_0x3d7581['shift']());}};_0x4a8fb3(++_0x2f9801);}(_0x9ef2,0x183));var _0x29ef=function(_0x4536d2,_0x2e78e6){_0x4536d2=_0x4536d2-0x0;var _0x5ee002=_0x9ef2[_0x4536d2];return _0x5ee002;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29ef('0x0'));var zipdir=require(_0x29ef('0x1'));var jsonpatch=require(_0x29ef('0x2'));var rp=require(_0x29ef('0x3'));var moment=require(_0x29ef('0x4'));var BPromise=require(_0x29ef('0x5'));var Mustache=require(_0x29ef('0x6'));var util=require('util');var path=require(_0x29ef('0x7'));var sox=require(_0x29ef('0x8'));var csv=require(_0x29ef('0x9'));var ejs=require(_0x29ef('0xa'));var fs=require('fs');var fs_extra=require(_0x29ef('0xb'));var _=require(_0x29ef('0xc'));var squel=require(_0x29ef('0xd'));var crypto=require(_0x29ef('0xe'));var jsforce=require(_0x29ef('0xf'));var deskjs=require(_0x29ef('0x10'));var toCsv=require(_0x29ef('0x9'));var querystring=require(_0x29ef('0x11'));var Papa=require(_0x29ef('0x12'));var Redis=require(_0x29ef('0x13'));var authService=require(_0x29ef('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x29ef('0x15'));var hardwareService=require(_0x29ef('0x16'));var logger=require(_0x29ef('0x17'))(_0x29ef('0x18'));var utils=require(_0x29ef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x29ef('0x1a'));var db=require(_0x29ef('0x1b'))['db'];function respondWithStatusCode(_0x470a7e,_0x280437){_0x280437=_0x280437||0xcc;return function(_0x49c024){if(_0x49c024){return _0x470a7e[_0x29ef('0x1c')](_0x280437);}return _0x470a7e[_0x29ef('0x1d')](_0x280437)[_0x29ef('0x1e')]();};}function respondWithResult(_0x3c1faa,_0x1f4bf3){_0x1f4bf3=_0x1f4bf3||0xc8;return function(_0x59e64f){if(_0x59e64f){return _0x3c1faa[_0x29ef('0x1d')](_0x1f4bf3)[_0x29ef('0x1f')](_0x59e64f);}};}function respondWithFilteredResult(_0x215c85,_0x583f35){return function(_0x3464c8){if(_0x3464c8){var _0x5056ab=typeof _0x583f35[_0x29ef('0x20')]===_0x29ef('0x21')&&typeof _0x583f35[_0x29ef('0x22')]===_0x29ef('0x21');var _0x2fe9ac=_0x3464c8[_0x29ef('0x23')];var _0x2250f1=_0x5056ab?0x0:_0x583f35[_0x29ef('0x20')];var _0x570aa8=_0x5056ab?_0x3464c8['count']:_0x583f35[_0x29ef('0x20')]+_0x583f35[_0x29ef('0x22')];var _0x12cedc;if(_0x570aa8>=_0x2fe9ac){_0x570aa8=_0x2fe9ac;_0x12cedc=0xc8;}else{_0x12cedc=0xce;}_0x215c85[_0x29ef('0x1d')](_0x12cedc);return _0x215c85[_0x29ef('0x24')](_0x29ef('0x25'),_0x2250f1+'-'+_0x570aa8+'/'+_0x2fe9ac)[_0x29ef('0x1f')](_0x3464c8);}return null;};}function patchUpdates(_0x2fa531){return function(_0x50c7de){try{jsonpatch[_0x29ef('0x26')](_0x50c7de,_0x2fa531,!![]);}catch(_0xc65c1a){return BPromise['reject'](_0xc65c1a);}return _0x50c7de[_0x29ef('0x27')]();};}function saveUpdates(_0x4b8b71,_0x2b2ad8){return function(_0x2777c5){if(_0x2777c5){return _0x2777c5[_0x29ef('0x28')](_0x4b8b71)[_0x29ef('0x29')](function(_0x21d9a0){return _0x21d9a0;});}return null;};}function removeEntity(_0x5f5824,_0x2ae053){return function(_0x348a7e){if(_0x348a7e){return _0x348a7e['destroy']()[_0x29ef('0x29')](function(){_0x5f5824['status'](0xcc)[_0x29ef('0x1e')]();});}};}function handleEntityNotFound(_0x55264e,_0x14b21b){return function(_0x190ece){if(!_0x190ece){_0x55264e[_0x29ef('0x1c')](0x194);}return _0x190ece;};}function handleError(_0x4030f7,_0x4bcdd0){_0x4bcdd0=_0x4bcdd0||0x1f4;return function(_0x8e6d07){logger[_0x29ef('0x2a')](_0x8e6d07[_0x29ef('0x2b')]);if(_0x8e6d07[_0x29ef('0x2c')]){delete _0x8e6d07['name'];}_0x4030f7[_0x29ef('0x1d')](_0x4bcdd0)['send'](_0x8e6d07);};}exports['index']=function(_0x4a64a3,_0x186ca9){var _0x6f54ed={},_0x290741={},_0xf00cc2={'count':0x0,'rows':[]};var _0x2ce117=_[_0x29ef('0x2d')](db[_0x29ef('0x2e')][_0x29ef('0x2f')],function(_0x395ef9){return{'name':_0x395ef9[_0x29ef('0x30')],'type':_0x395ef9[_0x29ef('0x31')][_0x29ef('0x32')]};});_0x290741[_0x29ef('0x33')]=_[_0x29ef('0x2d')](_0x2ce117,_0x29ef('0x2c'));_0x290741[_0x29ef('0x34')]=_[_0x29ef('0x35')](_0x4a64a3['query']);_0x290741['filters']=_[_0x29ef('0x36')](_0x290741['model'],_0x290741[_0x29ef('0x34')]);_0x6f54ed[_0x29ef('0x37')]=_[_0x29ef('0x36')](_0x290741[_0x29ef('0x33')],qs[_0x29ef('0x38')](_0x4a64a3['query'][_0x29ef('0x38')]));_0x6f54ed[_0x29ef('0x37')]=_0x6f54ed[_0x29ef('0x37')][_0x29ef('0x39')]?_0x6f54ed[_0x29ef('0x37')]:_0x290741[_0x29ef('0x33')];if(!_0x4a64a3[_0x29ef('0x34')][_0x29ef('0x3a')](_0x29ef('0x3b'))){_0x6f54ed[_0x29ef('0x22')]=qs[_0x29ef('0x22')](_0x4a64a3['query']['limit']);_0x6f54ed[_0x29ef('0x20')]=qs['offset'](_0x4a64a3['query'][_0x29ef('0x20')]);}_0x6f54ed[_0x29ef('0x3c')]=qs[_0x29ef('0x3d')](_0x4a64a3[_0x29ef('0x34')]['sort']);_0x6f54ed[_0x29ef('0x3e')]=qs['filters'](_['pick'](_0x4a64a3[_0x29ef('0x34')],_0x290741[_0x29ef('0x3f')]),_0x2ce117);if(_0x4a64a3['query'][_0x29ef('0x40')]){_0x6f54ed['where']=_['merge'](_0x6f54ed[_0x29ef('0x3e')],{'$or':_[_0x29ef('0x2d')](_0x2ce117,function(_0x208004){if(_0x208004[_0x29ef('0x31')]!=='VIRTUAL'){var _0x34f559={};_0x34f559[_0x208004[_0x29ef('0x2c')]]={'$like':'%'+_0x4a64a3[_0x29ef('0x34')]['filter']+'%'};return _0x34f559;}})});}_0x6f54ed=_['merge']({},_0x6f54ed,_0x4a64a3[_0x29ef('0x41')]);var _0x2363de={'where':_0x6f54ed[_0x29ef('0x3e')]};return db[_0x29ef('0x2e')][_0x29ef('0x23')](_0x2363de)[_0x29ef('0x29')](function(_0x2df52d){_0xf00cc2['count']=_0x2df52d;if(_0x4a64a3[_0x29ef('0x34')][_0x29ef('0x42')]){_0x6f54ed[_0x29ef('0x43')]=[{'all':!![]}];}return db[_0x29ef('0x2e')][_0x29ef('0x44')](_0x6f54ed);})['then'](function(_0x5a932f){_0xf00cc2['rows']=_0x5a932f;return _0xf00cc2;})['then'](respondWithFilteredResult(_0x186ca9,_0x6f54ed))['catch'](handleError(_0x186ca9,null));};exports[_0x29ef('0x45')]=function(_0x42a9d8,_0x3da0de){var _0x379aea={'raw':!![],'where':{'id':_0x42a9d8[_0x29ef('0x46')]['id']}},_0x22c7c3={};_0x22c7c3[_0x29ef('0x33')]=_[_0x29ef('0x35')](db[_0x29ef('0x2e')]['rawAttributes']);_0x22c7c3['query']=_[_0x29ef('0x35')](_0x42a9d8[_0x29ef('0x34')]);_0x22c7c3[_0x29ef('0x3f')]=_[_0x29ef('0x36')](_0x22c7c3['model'],_0x22c7c3[_0x29ef('0x34')]);_0x379aea[_0x29ef('0x37')]=_[_0x29ef('0x36')](_0x22c7c3[_0x29ef('0x33')],qs[_0x29ef('0x38')](_0x42a9d8['query'][_0x29ef('0x38')]));_0x379aea[_0x29ef('0x37')]=_0x379aea[_0x29ef('0x37')][_0x29ef('0x39')]?_0x379aea[_0x29ef('0x37')]:_0x22c7c3[_0x29ef('0x33')];if(_0x42a9d8['query']['includeAll']){_0x379aea['include']=[{'all':!![]}];}_0x379aea=_[_0x29ef('0x47')]({},_0x379aea,_0x42a9d8['options']);return db[_0x29ef('0x2e')][_0x29ef('0x48')](_0x379aea)[_0x29ef('0x29')](handleEntityNotFound(_0x3da0de,null))[_0x29ef('0x29')](respondWithResult(_0x3da0de,null))['catch'](handleError(_0x3da0de,null));};exports[_0x29ef('0x49')]=function(_0x50a14b,_0x2ec99a){return db[_0x29ef('0x2e')]['create'](_0x50a14b[_0x29ef('0x4a')],{})['then'](respondWithResult(_0x2ec99a,0xc9))[_0x29ef('0x4b')](handleError(_0x2ec99a,null));};exports[_0x29ef('0x28')]=function(_0x5ab917,_0x3afb7d){if(_0x5ab917[_0x29ef('0x4a')]['id']){delete _0x5ab917[_0x29ef('0x4a')]['id'];}return db[_0x29ef('0x2e')][_0x29ef('0x48')]({'where':{'id':_0x5ab917['params']['id']}})[_0x29ef('0x29')](handleEntityNotFound(_0x3afb7d,null))[_0x29ef('0x29')](saveUpdates(_0x5ab917[_0x29ef('0x4a')],null))[_0x29ef('0x29')](respondWithResult(_0x3afb7d,null))['catch'](handleError(_0x3afb7d,null));};exports['destroy']=function(_0x4a6d8d,_0x172c3d){return db[_0x29ef('0x2e')][_0x29ef('0x48')]({'where':{'id':_0x4a6d8d[_0x29ef('0x46')]['id']}})[_0x29ef('0x29')](handleEntityNotFound(_0x172c3d,null))[_0x29ef('0x29')](removeEntity(_0x172c3d,null))['catch'](handleError(_0x172c3d,null));};exports[_0x29ef('0x4c')]=function(_0xdafe5,_0x59ba10){return db[_0x29ef('0x2e')][_0x29ef('0x4c')]()[_0x29ef('0x29')](respondWithResult(_0x59ba10,null))[_0x29ef('0x4b')](handleError(_0x59ba10,null));};exports['getQuestions']=function(_0x3bbd3d,_0x491f81,_0x462fd8){var _0x2f9f26={'raw':!![],'where':{}};var _0x309b60={};var _0x50d838={'count':0x0,'rows':[]};return db[_0x29ef('0x2e')][_0x29ef('0x4d')]({'where':{'id':_0x3bbd3d[_0x29ef('0x46')]['id']}})[_0x29ef('0x29')](handleEntityNotFound(_0x491f81,null))[_0x29ef('0x29')](function(_0x5d92d7){if(_0x5d92d7){_0x309b60[_0x29ef('0x33')]=_[_0x29ef('0x35')](db[_0x29ef('0x4e')][_0x29ef('0x2f')]);_0x309b60[_0x29ef('0x34')]=_[_0x29ef('0x35')](_0x3bbd3d[_0x29ef('0x34')]);_0x309b60[_0x29ef('0x3f')]=_[_0x29ef('0x36')](_0x309b60['model'],_0x309b60[_0x29ef('0x34')]);_0x2f9f26[_0x29ef('0x37')]=_[_0x29ef('0x36')](_0x309b60[_0x29ef('0x33')],qs[_0x29ef('0x38')](_0x3bbd3d[_0x29ef('0x34')][_0x29ef('0x38')]));_0x2f9f26['attributes']=_0x2f9f26[_0x29ef('0x37')][_0x29ef('0x39')]?_0x2f9f26[_0x29ef('0x37')]:_0x309b60[_0x29ef('0x33')];if(!_0x3bbd3d[_0x29ef('0x34')][_0x29ef('0x3a')](_0x29ef('0x3b'))){_0x2f9f26[_0x29ef('0x22')]=qs[_0x29ef('0x22')](_0x3bbd3d[_0x29ef('0x34')][_0x29ef('0x22')]);_0x2f9f26['offset']=qs[_0x29ef('0x20')](_0x3bbd3d['query']['offset']);}_0x2f9f26['order']=qs[_0x29ef('0x3d')](_0x3bbd3d[_0x29ef('0x34')][_0x29ef('0x3d')]);_0x2f9f26[_0x29ef('0x3e')]=qs['filters'](_[_0x29ef('0x4f')](_0x3bbd3d[_0x29ef('0x34')],_0x309b60[_0x29ef('0x3f')]));_0x2f9f26[_0x29ef('0x3e')][_0x29ef('0x50')]=_0x5d92d7['id'];if(_0x3bbd3d['query']['filter']){_0x2f9f26[_0x29ef('0x3e')]=_[_0x29ef('0x47')](_0x2f9f26['where'],{'$or':_[_0x29ef('0x2d')](_0x2f9f26[_0x29ef('0x37')],function(_0x15aca3){var _0x3a2947={};_0x3a2947[_0x15aca3]={'$like':'%'+_0x3bbd3d[_0x29ef('0x34')]['filter']+'%'};return _0x3a2947;})});}_0x2f9f26=_['merge']({},_0x2f9f26,_0x3bbd3d[_0x29ef('0x41')]);return db[_0x29ef('0x4e')]['count']({'where':_0x2f9f26[_0x29ef('0x3e')]})[_0x29ef('0x29')](function(_0x4523b0){_0x50d838[_0x29ef('0x23')]=_0x4523b0;if(_0x3bbd3d[_0x29ef('0x34')]['includeAll']){_0x2f9f26[_0x29ef('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x29ef('0x44')](_0x2f9f26);})[_0x29ef('0x29')](function(_0x9115e9){_0x50d838[_0x29ef('0x51')]=_0x9115e9;return _0x50d838;});}})['then'](respondWithFilteredResult(_0x491f81,_0x2f9f26))[_0x29ef('0x4b')](handleError(_0x491f81,null));}; \ No newline at end of file +var _0x38eb=['catch','show','rawAttributes','include','create','body','params','find','describe','findOne','JscriptyQuestionReport','options','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','send','index','JscriptySessionReport','fieldName','type','key','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','includeAll','findAll','rows'];(function(_0xaa1985,_0x2d9872){var _0x172439=function(_0x27d9be){while(--_0x27d9be){_0xaa1985['push'](_0xaa1985['shift']());}};_0x172439(++_0x2d9872);}(_0x38eb,0x1d4));var _0xb38e=function(_0x80d294,_0x1c3681){_0x80d294=_0x80d294-0x0;var _0x131473=_0x38eb[_0x80d294];return _0x131473;};'use strict';var emlformat=require(_0xb38e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb38e('0x1'));var jsonpatch=require(_0xb38e('0x2'));var rp=require(_0xb38e('0x3'));var moment=require('moment');var BPromise=require(_0xb38e('0x4'));var Mustache=require('mustache');var util=require(_0xb38e('0x5'));var path=require(_0xb38e('0x6'));var sox=require(_0xb38e('0x7'));var csv=require(_0xb38e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb38e('0x9'));var _=require(_0xb38e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb38e('0xb'));var deskjs=require(_0xb38e('0xc'));var toCsv=require(_0xb38e('0x8'));var querystring=require(_0xb38e('0xd'));var Papa=require('papaparse');var Redis=require(_0xb38e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb38e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb38e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb38e('0x11'));var config=require(_0xb38e('0x12'));var licenseUtil=require(_0xb38e('0x13'));var db=require(_0xb38e('0x14'))['db'];function respondWithStatusCode(_0xf2bdd8,_0x7523b1){_0x7523b1=_0x7523b1||0xcc;return function(_0x219bdc){if(_0x219bdc){return _0xf2bdd8['sendStatus'](_0x7523b1);}return _0xf2bdd8[_0xb38e('0x15')](_0x7523b1)[_0xb38e('0x16')]();};}function respondWithResult(_0x3dcf39,_0x2c06a4){_0x2c06a4=_0x2c06a4||0xc8;return function(_0x49a1d3){if(_0x49a1d3){return _0x3dcf39[_0xb38e('0x15')](_0x2c06a4)[_0xb38e('0x17')](_0x49a1d3);}};}function respondWithFilteredResult(_0x22cfa9,_0x547391){return function(_0x2f7e85){if(_0x2f7e85){var _0x5e8d40=typeof _0x547391[_0xb38e('0x18')]===_0xb38e('0x19')&&typeof _0x547391[_0xb38e('0x1a')]===_0xb38e('0x19');var _0x9f8934=_0x2f7e85['count'];var _0x4e1505=_0x5e8d40?0x0:_0x547391[_0xb38e('0x18')];var _0xef398d=_0x5e8d40?_0x2f7e85[_0xb38e('0x1b')]:_0x547391[_0xb38e('0x18')]+_0x547391[_0xb38e('0x1a')];var _0x24d6dd;if(_0xef398d>=_0x9f8934){_0xef398d=_0x9f8934;_0x24d6dd=0xc8;}else{_0x24d6dd=0xce;}_0x22cfa9[_0xb38e('0x15')](_0x24d6dd);return _0x22cfa9[_0xb38e('0x1c')](_0xb38e('0x1d'),_0x4e1505+'-'+_0xef398d+'/'+_0x9f8934)[_0xb38e('0x17')](_0x2f7e85);}return null;};}function patchUpdates(_0x496808){return function(_0x55b5b3){try{jsonpatch['apply'](_0x55b5b3,_0x496808,!![]);}catch(_0x4c7a1a){return BPromise['reject'](_0x4c7a1a);}return _0x55b5b3['save']();};}function saveUpdates(_0x1e7ed4,_0x1bd152){return function(_0x12e45b){if(_0x12e45b){return _0x12e45b[_0xb38e('0x1e')](_0x1e7ed4)[_0xb38e('0x1f')](function(_0x27b19d){return _0x27b19d;});}return null;};}function removeEntity(_0x82ad74,_0x166d71){return function(_0x26d711){if(_0x26d711){return _0x26d711[_0xb38e('0x20')]()['then'](function(){_0x82ad74['status'](0xcc)[_0xb38e('0x16')]();});}};}function handleEntityNotFound(_0x13ea71,_0x34ed69){return function(_0x50e50a){if(!_0x50e50a){_0x13ea71[_0xb38e('0x21')](0x194);}return _0x50e50a;};}function handleError(_0x225344,_0x4d9c20){_0x4d9c20=_0x4d9c20||0x1f4;return function(_0xddb4ef){logger[_0xb38e('0x22')](_0xddb4ef[_0xb38e('0x23')]);if(_0xddb4ef['name']){delete _0xddb4ef['name'];}_0x225344[_0xb38e('0x15')](_0x4d9c20)[_0xb38e('0x24')](_0xddb4ef);};}exports[_0xb38e('0x25')]=function(_0xf7c785,_0x4d3847){var _0x16d5da={},_0x5f1d54={},_0x237270={'count':0x0,'rows':[]};var _0x1903d9=_['map'](db[_0xb38e('0x26')]['rawAttributes'],function(_0x166dc1){return{'name':_0x166dc1[_0xb38e('0x27')],'type':_0x166dc1[_0xb38e('0x28')][_0xb38e('0x29')]};});_0x5f1d54['model']=_['map'](_0x1903d9,_0xb38e('0x2a'));_0x5f1d54['query']=_[_0xb38e('0x2b')](_0xf7c785[_0xb38e('0x2c')]);_0x5f1d54['filters']=_[_0xb38e('0x2d')](_0x5f1d54[_0xb38e('0x2e')],_0x5f1d54[_0xb38e('0x2c')]);_0x16d5da[_0xb38e('0x2f')]=_[_0xb38e('0x2d')](_0x5f1d54['model'],qs[_0xb38e('0x30')](_0xf7c785[_0xb38e('0x2c')]['fields']));_0x16d5da['attributes']=_0x16d5da[_0xb38e('0x2f')][_0xb38e('0x31')]?_0x16d5da['attributes']:_0x5f1d54[_0xb38e('0x2e')];if(!_0xf7c785[_0xb38e('0x2c')][_0xb38e('0x32')](_0xb38e('0x33'))){_0x16d5da['limit']=qs['limit'](_0xf7c785[_0xb38e('0x2c')][_0xb38e('0x1a')]);_0x16d5da[_0xb38e('0x18')]=qs['offset'](_0xf7c785[_0xb38e('0x2c')][_0xb38e('0x18')]);}_0x16d5da[_0xb38e('0x34')]=qs[_0xb38e('0x35')](_0xf7c785[_0xb38e('0x2c')][_0xb38e('0x35')]);_0x16d5da[_0xb38e('0x36')]=qs[_0xb38e('0x37')](_[_0xb38e('0x38')](_0xf7c785[_0xb38e('0x2c')],_0x5f1d54[_0xb38e('0x37')]),_0x1903d9);if(_0xf7c785[_0xb38e('0x2c')][_0xb38e('0x39')]){_0x16d5da[_0xb38e('0x36')]=_['merge'](_0x16d5da[_0xb38e('0x36')],{'$or':_[_0xb38e('0x3a')](_0x1903d9,function(_0x3c8b69){if(_0x3c8b69[_0xb38e('0x28')]!==_0xb38e('0x3b')){var _0x4dba2a={};_0x4dba2a[_0x3c8b69[_0xb38e('0x2a')]]={'$like':'%'+_0xf7c785[_0xb38e('0x2c')]['filter']+'%'};return _0x4dba2a;}})});}_0x16d5da=_[_0xb38e('0x3c')]({},_0x16d5da,_0xf7c785['options']);var _0x12be08={'where':_0x16d5da[_0xb38e('0x36')]};return db['JscriptySessionReport'][_0xb38e('0x1b')](_0x12be08)[_0xb38e('0x1f')](function(_0x2b07a7){_0x237270[_0xb38e('0x1b')]=_0x2b07a7;if(_0xf7c785[_0xb38e('0x2c')][_0xb38e('0x3d')]){_0x16d5da['include']=[{'all':!![]}];}return db[_0xb38e('0x26')][_0xb38e('0x3e')](_0x16d5da);})['then'](function(_0x2f2679){_0x237270[_0xb38e('0x3f')]=_0x2f2679;return _0x237270;})[_0xb38e('0x1f')](respondWithFilteredResult(_0x4d3847,_0x16d5da))[_0xb38e('0x40')](handleError(_0x4d3847,null));};exports[_0xb38e('0x41')]=function(_0x699cc,_0xb8e7e8){var _0x4580a2={'raw':!![],'where':{'id':_0x699cc['params']['id']}},_0x2e7963={};_0x2e7963[_0xb38e('0x2e')]=_[_0xb38e('0x2b')](db[_0xb38e('0x26')][_0xb38e('0x42')]);_0x2e7963[_0xb38e('0x2c')]=_[_0xb38e('0x2b')](_0x699cc[_0xb38e('0x2c')]);_0x2e7963['filters']=_[_0xb38e('0x2d')](_0x2e7963[_0xb38e('0x2e')],_0x2e7963[_0xb38e('0x2c')]);_0x4580a2['attributes']=_['intersection'](_0x2e7963[_0xb38e('0x2e')],qs[_0xb38e('0x30')](_0x699cc['query'][_0xb38e('0x30')]));_0x4580a2[_0xb38e('0x2f')]=_0x4580a2[_0xb38e('0x2f')][_0xb38e('0x31')]?_0x4580a2[_0xb38e('0x2f')]:_0x2e7963['model'];if(_0x699cc[_0xb38e('0x2c')][_0xb38e('0x3d')]){_0x4580a2[_0xb38e('0x43')]=[{'all':!![]}];}_0x4580a2=_['merge']({},_0x4580a2,_0x699cc['options']);return db[_0xb38e('0x26')]['find'](_0x4580a2)['then'](handleEntityNotFound(_0xb8e7e8,null))[_0xb38e('0x1f')](respondWithResult(_0xb8e7e8,null))['catch'](handleError(_0xb8e7e8,null));};exports[_0xb38e('0x44')]=function(_0xa1392d,_0x273cef){return db[_0xb38e('0x26')][_0xb38e('0x44')](_0xa1392d[_0xb38e('0x45')],{})[_0xb38e('0x1f')](respondWithResult(_0x273cef,0xc9))[_0xb38e('0x40')](handleError(_0x273cef,null));};exports[_0xb38e('0x1e')]=function(_0x1e5cce,_0x25c681){if(_0x1e5cce[_0xb38e('0x45')]['id']){delete _0x1e5cce['body']['id'];}return db[_0xb38e('0x26')]['find']({'where':{'id':_0x1e5cce[_0xb38e('0x46')]['id']}})[_0xb38e('0x1f')](handleEntityNotFound(_0x25c681,null))[_0xb38e('0x1f')](saveUpdates(_0x1e5cce['body'],null))['then'](respondWithResult(_0x25c681,null))[_0xb38e('0x40')](handleError(_0x25c681,null));};exports[_0xb38e('0x20')]=function(_0x108229,_0x55b1ce){return db[_0xb38e('0x26')][_0xb38e('0x47')]({'where':{'id':_0x108229[_0xb38e('0x46')]['id']}})[_0xb38e('0x1f')](handleEntityNotFound(_0x55b1ce,null))[_0xb38e('0x1f')](removeEntity(_0x55b1ce,null))['catch'](handleError(_0x55b1ce,null));};exports[_0xb38e('0x48')]=function(_0x33046d,_0xaa9d3a){return db['JscriptySessionReport'][_0xb38e('0x48')]()[_0xb38e('0x1f')](respondWithResult(_0xaa9d3a,null))['catch'](handleError(_0xaa9d3a,null));};exports['getQuestions']=function(_0x27bb87,_0x186b78,_0x527ca8){var _0x45d459={'raw':!![],'where':{}};var _0x2902a2={};var _0x26482e={'count':0x0,'rows':[]};return db[_0xb38e('0x26')][_0xb38e('0x49')]({'where':{'id':_0x27bb87[_0xb38e('0x46')]['id']}})[_0xb38e('0x1f')](handleEntityNotFound(_0x186b78,null))[_0xb38e('0x1f')](function(_0x17fa5e){if(_0x17fa5e){_0x2902a2[_0xb38e('0x2e')]=_[_0xb38e('0x2b')](db[_0xb38e('0x4a')][_0xb38e('0x42')]);_0x2902a2['query']=_[_0xb38e('0x2b')](_0x27bb87[_0xb38e('0x2c')]);_0x2902a2[_0xb38e('0x37')]=_[_0xb38e('0x2d')](_0x2902a2[_0xb38e('0x2e')],_0x2902a2[_0xb38e('0x2c')]);_0x45d459[_0xb38e('0x2f')]=_[_0xb38e('0x2d')](_0x2902a2[_0xb38e('0x2e')],qs['fields'](_0x27bb87['query'][_0xb38e('0x30')]));_0x45d459[_0xb38e('0x2f')]=_0x45d459[_0xb38e('0x2f')][_0xb38e('0x31')]?_0x45d459[_0xb38e('0x2f')]:_0x2902a2[_0xb38e('0x2e')];if(!_0x27bb87[_0xb38e('0x2c')]['hasOwnProperty'](_0xb38e('0x33'))){_0x45d459[_0xb38e('0x1a')]=qs[_0xb38e('0x1a')](_0x27bb87[_0xb38e('0x2c')][_0xb38e('0x1a')]);_0x45d459[_0xb38e('0x18')]=qs[_0xb38e('0x18')](_0x27bb87[_0xb38e('0x2c')]['offset']);}_0x45d459['order']=qs[_0xb38e('0x35')](_0x27bb87[_0xb38e('0x2c')][_0xb38e('0x35')]);_0x45d459['where']=qs[_0xb38e('0x37')](_['pick'](_0x27bb87[_0xb38e('0x2c')],_0x2902a2[_0xb38e('0x37')]));_0x45d459[_0xb38e('0x36')]['SessionId']=_0x17fa5e['id'];if(_0x27bb87[_0xb38e('0x2c')]['filter']){_0x45d459[_0xb38e('0x36')]=_[_0xb38e('0x3c')](_0x45d459['where'],{'$or':_[_0xb38e('0x3a')](_0x45d459[_0xb38e('0x2f')],function(_0x1756ce){var _0x487374={};_0x487374[_0x1756ce]={'$like':'%'+_0x27bb87['query']['filter']+'%'};return _0x487374;})});}_0x45d459=_[_0xb38e('0x3c')]({},_0x45d459,_0x27bb87[_0xb38e('0x4b')]);return db[_0xb38e('0x4a')][_0xb38e('0x1b')]({'where':_0x45d459['where']})['then'](function(_0x52f8b8){_0x26482e['count']=_0x52f8b8;if(_0x27bb87['query'][_0xb38e('0x3d')]){_0x45d459[_0xb38e('0x43')]=[{'all':!![]}];}return db[_0xb38e('0x4a')]['findAll'](_0x45d459);})[_0xb38e('0x1f')](function(_0x14e884){_0x26482e['rows']=_0x14e884;return _0x26482e;});}})[_0xb38e('0x1f')](respondWithFilteredResult(_0x186b78,_0x45d459))[_0xb38e('0x40')](handleError(_0x186b78,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2e838d0..583e953 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 _0x2bd8=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x536755,_0x3bfa50){var _0x2b9dde=function(_0xe1efcc){while(--_0xe1efcc){_0x536755['push'](_0x536755['shift']());}};_0x2b9dde(++_0x3bfa50);}(_0x2bd8,0x130));var _0x82bd=function(_0x4dd981,_0x18a6d9){_0x4dd981=_0x4dd981-0x0;var _0x1b6561=_0x2bd8[_0x4dd981];return _0x1b6561;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd101=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd101,0xc1));var _0x1d10=function(_0x462e5b,_0x3a400d){_0x462e5b=_0x462e5b-0x0;var _0xfbf496=_0xd101[_0x462e5b];return _0xfbf496;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('0xc'),'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 3472537..0a8552a 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 _0xb145=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x1186b7,_0x3d2eb7){var _0x4b7232=function(_0x40f2dc){while(--_0x40f2dc){_0x1186b7['push'](_0x1186b7['shift']());}};_0x4b7232(++_0x3d2eb7);}(_0xb145,0xa3));var _0x5b14=function(_0x3f58d4,_0x1c297f){_0x3f58d4=_0x3f58d4-0x0;var _0x19396b=_0xb145[_0x3f58d4];return _0x19396b;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});} \ No newline at end of file +var _0x4991=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x4991,0xf7));var _0x1499=function(_0x297fbe,_0x429614){_0x297fbe=_0x297fbe-0x0;var _0x29c182=_0x4991[_0x297fbe];return _0x29c182;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3141e91..10252a6 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 _0x6ffc=['../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0x6ffc,0x10a));var _0xc6ff=function(_0x110a71,_0x208bc5){_0x110a71=_0x110a71-0x0;var _0x45def1=_0x6ffc[_0x110a71];return _0x45def1;};'use strict';var multer=require(_0xc6ff('0x0'));var util=require('util');var path=require(_0xc6ff('0x1'));var timeout=require(_0xc6ff('0x2'));var express=require(_0xc6ff('0x3'));var router=express['Router']();var fs_extra=require(_0xc6ff('0x4'));var auth=require(_0xc6ff('0x5'));var interaction=require(_0xc6ff('0x6'));var config=require(_0xc6ff('0x7'));var controller=require(_0xc6ff('0x8'));router[_0xc6ff('0x9')]('/',controller[_0xc6ff('0xa')]);router[_0xc6ff('0xb')](_0xc6ff('0xc'),auth[_0xc6ff('0xd')](),controller['update']);router['get'](_0xc6ff('0xe'),auth[_0xc6ff('0xd')](),controller[_0xc6ff('0xf')]);module[_0xc6ff('0x10')]=router; \ No newline at end of file +var _0x73a4=['/:id','isAuthenticated','/download_log_file','downloadLogFile','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put'];(function(_0x1f4343,_0x70d930){var _0x3a000a=function(_0x5a7cde){while(--_0x5a7cde){_0x1f4343['push'](_0x1f4343['shift']());}};_0x3a000a(++_0x70d930);}(_0x73a4,0xe1));var _0x473a=function(_0x58c74f,_0x3fa88f){_0x58c74f=_0x58c74f-0x0;var _0xcb916a=_0x73a4[_0x58c74f];return _0xcb916a;};'use strict';var multer=require(_0x473a('0x0'));var util=require('util');var path=require(_0x473a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x473a('0x2'));var auth=require(_0x473a('0x3'));var interaction=require(_0x473a('0x4'));var config=require(_0x473a('0x5'));var controller=require('./license.controller');router[_0x473a('0x6')]('/',controller[_0x473a('0x7')]);router[_0x473a('0x8')](_0x473a('0x9'),auth[_0x473a('0xa')](),controller['update']);router[_0x473a('0x6')](_0x473a('0xb'),auth[_0x473a('0xa')](),controller[_0x473a('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 bc03c90..d822e2a 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 _0xacdf=['INTEGER','sequelize','STRING'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xacdf,0x1a8));var _0xfacd=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xacdf[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xfacd('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xfacd('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xfacd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e39=['TEXT','STRING','INTEGER','exports'];(function(_0x55e4e1,_0x352a79){var _0x1644e8=function(_0x4a2446){while(--_0x4a2446){_0x55e4e1['push'](_0x55e4e1['shift']());}};_0x1644e8(++_0x352a79);}(_0x0e39,0x97));var _0x90e3=function(_0x4af8cf,_0x51a87c){_0x4af8cf=_0x4af8cf-0x0;var _0x1cb78d=_0x0e39[_0x4af8cf];return _0x1cb78d;};'use strict';var Sequelize=require('sequelize');module[_0x90e3('0x0')]={'license':{'type':Sequelize[_0x90e3('0x1')]},'data1':{'type':Sequelize[_0x90e3('0x2')]},'data2':{'type':Sequelize[_0x90e3('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x90e3('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f8e6185..ae0a79a 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 _0x910b=['merge','getLicense','catch','body','License','params','get','checkLicense','demo','join','xcally','setHeader','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','save','update','then','destroy','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x1e59ff,_0x39c664){var _0x33fe64=function(_0x2f7bf0){while(--_0x2f7bf0){_0x1e59ff['push'](_0x1e59ff['shift']());}};_0x33fe64(++_0x39c664);}(_0x910b,0x1a7));var _0xb910=function(_0x44ff6b,_0x13d8e9){_0x44ff6b=_0x44ff6b-0x0;var _0x402226=_0x910b[_0x44ff6b];return _0x402226;};'use strict';var emlformat=require(_0xb910('0x0'));var rimraf=require(_0xb910('0x1'));var zipdir=require(_0xb910('0x2'));var jsonpatch=require(_0xb910('0x3'));var rp=require(_0xb910('0x4'));var moment=require(_0xb910('0x5'));var BPromise=require(_0xb910('0x6'));var Mustache=require('mustache');var util=require(_0xb910('0x7'));var path=require(_0xb910('0x8'));var sox=require('sox');var csv=require(_0xb910('0x9'));var ejs=require(_0xb910('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb910('0xb'));var jsforce=require(_0xb910('0xc'));var deskjs=require(_0xb910('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb910('0xe'));var Papa=require(_0xb910('0xf'));var Redis=require(_0xb910('0x10'));var authService=require(_0xb910('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb910('0x12'));var logger=require(_0xb910('0x13'))(_0xb910('0x14'));var utils=require(_0xb910('0x15'));var config=require(_0xb910('0x16'));var licenseUtil=require(_0xb910('0x17'));var db=require(_0xb910('0x18'))['db'];function respondWithStatusCode(_0x100b59,_0x130a3a){_0x130a3a=_0x130a3a||0xcc;return function(_0x2b7905){if(_0x2b7905){return _0x100b59[_0xb910('0x19')](_0x130a3a);}return _0x100b59[_0xb910('0x1a')](_0x130a3a)[_0xb910('0x1b')]();};}function respondWithResult(_0xdea2b6,_0xd18005){_0xd18005=_0xd18005||0xc8;return function(_0x3491d4){if(_0x3491d4){return _0xdea2b6[_0xb910('0x1a')](_0xd18005)[_0xb910('0x1c')](_0x3491d4);}};}function respondWithFilteredResult(_0x5b5dcf,_0x113c38){return function(_0x3d8993){if(_0x3d8993){var _0x1022c2=typeof _0x113c38['offset']==='undefined'&&typeof _0x113c38[_0xb910('0x1d')]===_0xb910('0x1e');var _0x3176ea=_0x3d8993['count'];var _0x4f6b5c=_0x1022c2?0x0:_0x113c38[_0xb910('0x1f')];var _0x159dcb=_0x1022c2?_0x3d8993[_0xb910('0x20')]:_0x113c38[_0xb910('0x1f')]+_0x113c38[_0xb910('0x1d')];var _0x257151;if(_0x159dcb>=_0x3176ea){_0x159dcb=_0x3176ea;_0x257151=0xc8;}else{_0x257151=0xce;}_0x5b5dcf[_0xb910('0x1a')](_0x257151);return _0x5b5dcf[_0xb910('0x21')]('Content-Range',_0x4f6b5c+'-'+_0x159dcb+'/'+_0x3176ea)[_0xb910('0x1c')](_0x3d8993);}return null;};}function patchUpdates(_0x22b515){return function(_0xb0d67b){try{jsonpatch[_0xb910('0x22')](_0xb0d67b,_0x22b515,!![]);}catch(_0x404ae8){return BPromise['reject'](_0x404ae8);}return _0xb0d67b[_0xb910('0x23')]();};}function saveUpdates(_0x58ff30,_0x2b5bba){return function(_0x10afe8){if(_0x10afe8){return _0x10afe8[_0xb910('0x24')](_0x58ff30)[_0xb910('0x25')](function(_0x21a123){return _0x21a123;});}return null;};}function removeEntity(_0x55e4d8,_0x26c1ff){return function(_0x147c51){if(_0x147c51){return _0x147c51[_0xb910('0x26')]()['then'](function(){_0x55e4d8[_0xb910('0x1a')](0xcc)[_0xb910('0x1b')]();});}};}function handleEntityNotFound(_0x1d76e4,_0x3ed06e){return function(_0x2a8a14){if(!_0x2a8a14){_0x1d76e4[_0xb910('0x19')](0x194);}return _0x2a8a14;};}function handleError(_0x5581b1,_0x407e4f){_0x407e4f=_0x407e4f||0x1f4;return function(_0x2d233d){logger[_0xb910('0x27')](_0x2d233d[_0xb910('0x28')]);if(_0x2d233d[_0xb910('0x29')]){delete _0x2d233d['name'];}_0x5581b1[_0xb910('0x1a')](_0x407e4f)[_0xb910('0x2a')](_0x2d233d);};}var utilLicense=require(_0xb910('0x17'));exports[_0xb910('0x2b')]=function(_0x2cf243,_0x4583bc){var _0x34fb00={'raw':!![],'where':{'id':0x1}},_0xa91978={};_0xa91978[_0xb910('0x2c')]=_[_0xb910('0x2d')](db['License'][_0xb910('0x2e')]);_0xa91978[_0xb910('0x2f')]=_[_0xb910('0x2d')](_0x2cf243[_0xb910('0x2f')]);_0xa91978[_0xb910('0x30')]=_[_0xb910('0x31')](_0xa91978[_0xb910('0x2c')],_0xa91978[_0xb910('0x2f')]);_0x34fb00[_0xb910('0x32')]=_['intersection'](_0xa91978[_0xb910('0x2c')],qs[_0xb910('0x33')](_0x2cf243[_0xb910('0x2f')][_0xb910('0x33')]));_0x34fb00[_0xb910('0x32')]=_0x34fb00[_0xb910('0x32')][_0xb910('0x34')]?_0x34fb00[_0xb910('0x32')]:_0xa91978[_0xb910('0x2c')];_0x34fb00=_[_0xb910('0x35')]({},_0x34fb00,_0x2cf243['options']);return utilLicense[_0xb910('0x36')](_0x34fb00)[_0xb910('0x25')](respondWithResult(_0x4583bc,null))[_0xb910('0x37')](handleError(_0x4583bc,null));};exports[_0xb910('0x24')]=function(_0xaea497,_0x3d8d4b){if(_0xaea497[_0xb910('0x38')]['id']){delete _0xaea497[_0xb910('0x38')]['id'];}return db[_0xb910('0x39')]['find']({'where':{'id':_0xaea497[_0xb910('0x3a')]['id']}})[_0xb910('0x25')](handleEntityNotFound(_0x3d8d4b,null))[_0xb910('0x25')](function(_0x23655f){var _0xbf3d60=_0x23655f[_0xb910('0x3b')]({'plain':!![]});return utilLicense[_0xb910('0x3c')](_0xbf3d60,_0xaea497[_0xb910('0x38')]['key']);})[_0xb910('0x25')](function(_0x146739){if(!_0x146739[_0xb910('0x3d')]){return saveUpdates(_0xaea497[_0xb910('0x38')],null);}return _0x146739;})[_0xb910('0x25')](respondWithResult(_0x3d8d4b,null))[_0xb910('0x37')](handleError(_0x3d8d4b,null));};exports['downloadLogFile']=function(_0x2d4c65,_0x407d88){var _0x514545='license-info.log';var _0x43dc4c=path[_0xb910('0x3e')]('/var','log',_0xb910('0x3f'),_0x514545);_0x407d88[_0xb910('0x40')]('Content-disposition','attachment;\x20filename='+_0x514545);_0x407d88['set'](_0xb910('0x41'),_0xb910('0x42'));_0x407d88[_0xb910('0x43')](_0x43dc4c);}; \ No newline at end of file +var _0x06b6=['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','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','set','Content-Type','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x578f09,_0x4fdd10){var _0x4e9417=function(_0x22fd0d){while(--_0x22fd0d){_0x578f09['push'](_0x578f09['shift']());}};_0x4e9417(++_0x4fdd10);}(_0x06b6,0xce));var _0x606b=function(_0x4b036b,_0x4c5bea){_0x4b036b=_0x4b036b-0x0;var _0x2503f0=_0x06b6[_0x4b036b];return _0x2503f0;};'use strict';var emlformat=require(_0x606b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x606b('0x1'));var rp=require(_0x606b('0x2'));var moment=require(_0x606b('0x3'));var BPromise=require(_0x606b('0x4'));var Mustache=require(_0x606b('0x5'));var util=require(_0x606b('0x6'));var path=require('path');var sox=require(_0x606b('0x7'));var csv=require('to-csv');var ejs=require(_0x606b('0x8'));var fs=require('fs');var fs_extra=require(_0x606b('0x9'));var _=require(_0x606b('0xa'));var squel=require(_0x606b('0xb'));var crypto=require(_0x606b('0xc'));var jsforce=require(_0x606b('0xd'));var deskjs=require(_0x606b('0xe'));var toCsv=require(_0x606b('0xf'));var querystring=require(_0x606b('0x10'));var Papa=require(_0x606b('0x11'));var Redis=require('ioredis');var authService=require(_0x606b('0x12'));var qs=require(_0x606b('0x13'));var as=require(_0x606b('0x14'));var hardwareService=require(_0x606b('0x15'));var logger=require('../../config/logger')(_0x606b('0x16'));var utils=require(_0x606b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x606b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40a077,_0x553b38){_0x553b38=_0x553b38||0xcc;return function(_0x2f3e97){if(_0x2f3e97){return _0x40a077['sendStatus'](_0x553b38);}return _0x40a077[_0x606b('0x19')](_0x553b38)['end']();};}function respondWithResult(_0x87905a,_0x4fd836){_0x4fd836=_0x4fd836||0xc8;return function(_0x5966d1){if(_0x5966d1){return _0x87905a[_0x606b('0x19')](_0x4fd836)[_0x606b('0x1a')](_0x5966d1);}};}function respondWithFilteredResult(_0x5ef858,_0x3702a6){return function(_0x1a5e55){if(_0x1a5e55){var _0x19f9de=typeof _0x3702a6[_0x606b('0x1b')]===_0x606b('0x1c')&&typeof _0x3702a6[_0x606b('0x1d')]===_0x606b('0x1c');var _0x276eea=_0x1a5e55[_0x606b('0x1e')];var _0x3d310f=_0x19f9de?0x0:_0x3702a6[_0x606b('0x1b')];var _0x1429f8=_0x19f9de?_0x1a5e55[_0x606b('0x1e')]:_0x3702a6['offset']+_0x3702a6['limit'];var _0x43fdf6;if(_0x1429f8>=_0x276eea){_0x1429f8=_0x276eea;_0x43fdf6=0xc8;}else{_0x43fdf6=0xce;}_0x5ef858[_0x606b('0x19')](_0x43fdf6);return _0x5ef858['set']('Content-Range',_0x3d310f+'-'+_0x1429f8+'/'+_0x276eea)[_0x606b('0x1a')](_0x1a5e55);}return null;};}function patchUpdates(_0x35b59c){return function(_0x435afe){try{jsonpatch[_0x606b('0x1f')](_0x435afe,_0x35b59c,!![]);}catch(_0xdd2ea7){return BPromise[_0x606b('0x20')](_0xdd2ea7);}return _0x435afe[_0x606b('0x21')]();};}function saveUpdates(_0x57ff1a,_0x35a965){return function(_0x2adf2c){if(_0x2adf2c){return _0x2adf2c[_0x606b('0x22')](_0x57ff1a)[_0x606b('0x23')](function(_0x426507){return _0x426507;});}return null;};}function removeEntity(_0x296b03,_0x568098){return function(_0x5e9ca7){if(_0x5e9ca7){return _0x5e9ca7[_0x606b('0x24')]()[_0x606b('0x23')](function(){_0x296b03['status'](0xcc)[_0x606b('0x25')]();});}};}function handleEntityNotFound(_0x1e8047,_0x3e1b5c){return function(_0x1bbcef){if(!_0x1bbcef){_0x1e8047['sendStatus'](0x194);}return _0x1bbcef;};}function handleError(_0x524b5e,_0x1e9eac){_0x1e9eac=_0x1e9eac||0x1f4;return function(_0x3ecce2){logger[_0x606b('0x26')](_0x3ecce2[_0x606b('0x27')]);if(_0x3ecce2[_0x606b('0x28')]){delete _0x3ecce2[_0x606b('0x28')];}_0x524b5e[_0x606b('0x19')](_0x1e9eac)[_0x606b('0x29')](_0x3ecce2);};}var utilLicense=require(_0x606b('0x18'));exports[_0x606b('0x2a')]=function(_0x10db1f,_0x9822e7){var _0x1e21a9={'raw':!![],'where':{'id':0x1}},_0x4b5bb0={};_0x4b5bb0[_0x606b('0x2b')]=_[_0x606b('0x2c')](db[_0x606b('0x2d')][_0x606b('0x2e')]);_0x4b5bb0[_0x606b('0x2f')]=_[_0x606b('0x2c')](_0x10db1f[_0x606b('0x2f')]);_0x4b5bb0[_0x606b('0x30')]=_[_0x606b('0x31')](_0x4b5bb0[_0x606b('0x2b')],_0x4b5bb0[_0x606b('0x2f')]);_0x1e21a9[_0x606b('0x32')]=_['intersection'](_0x4b5bb0[_0x606b('0x2b')],qs[_0x606b('0x33')](_0x10db1f['query']['fields']));_0x1e21a9[_0x606b('0x32')]=_0x1e21a9[_0x606b('0x32')][_0x606b('0x34')]?_0x1e21a9[_0x606b('0x32')]:_0x4b5bb0['model'];_0x1e21a9=_[_0x606b('0x35')]({},_0x1e21a9,_0x10db1f[_0x606b('0x36')]);return utilLicense[_0x606b('0x37')](_0x1e21a9)['then'](respondWithResult(_0x9822e7,null))[_0x606b('0x38')](handleError(_0x9822e7,null));};exports['update']=function(_0x27b82f,_0x4a29aa){if(_0x27b82f['body']['id']){delete _0x27b82f[_0x606b('0x39')]['id'];}return db[_0x606b('0x2d')]['find']({'where':{'id':_0x27b82f['params']['id']}})[_0x606b('0x23')](handleEntityNotFound(_0x4a29aa,null))[_0x606b('0x23')](function(_0x32a0c1){var _0x417182=_0x32a0c1[_0x606b('0x3a')]({'plain':!![]});return utilLicense[_0x606b('0x3b')](_0x417182,_0x27b82f[_0x606b('0x39')][_0x606b('0x3c')]);})[_0x606b('0x23')](function(_0x3a0076){if(!_0x3a0076['demo']){return saveUpdates(_0x27b82f[_0x606b('0x39')],null);}return _0x3a0076;})['then'](respondWithResult(_0x4a29aa,null))[_0x606b('0x38')](handleError(_0x4a29aa,null));};exports[_0x606b('0x3d')]=function(_0x9a9529,_0x103e71){var _0x576423=_0x606b('0x3e');var _0x3ccad0=path[_0x606b('0x3f')](_0x606b('0x40'),'log',_0x606b('0x41'),_0x576423);_0x103e71[_0x606b('0x42')](_0x606b('0x43'),'attachment;\x20filename='+_0x576423);_0x103e71[_0x606b('0x44')](_0x606b('0x45'),'text/plain');_0x103e71[_0x606b('0x46')](_0x3ccad0);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 735e034..07660e7 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 _0xc824=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','License','license'];(function(_0x432949,_0x43994e){var _0x5a5005=function(_0x3800ba){while(--_0x3800ba){_0x432949['push'](_0x432949['shift']());}};_0x5a5005(++_0x43994e);}(_0xc824,0x1b0));var _0x4c82=function(_0x9f34c2,_0x36ccec){_0x9f34c2=_0x9f34c2-0x0;var _0x331483=_0xc824[_0x9f34c2];return _0x331483;};'use strict';var _=require(_0x4c82('0x0'));var util=require(_0x4c82('0x1'));var logger=require(_0x4c82('0x2'))(_0x4c82('0x3'));var moment=require(_0x4c82('0x4'));var BPromise=require(_0x4c82('0x5'));var rp=require(_0x4c82('0x6'));var fs=require('fs');var path=require(_0x4c82('0x7'));var rimraf=require('rimraf');var config=require(_0x4c82('0x8'));var attributes=require(_0x4c82('0x9'));module['exports']=function(_0x21675d,_0x1e7617){return _0x21675d['define'](_0x4c82('0xa'),attributes,{'tableName':_0x4c82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe57b=['./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xe57b,0xdd));var _0xbe57=function(_0x1273fb,_0x2beed5){_0x1273fb=_0x1273fb-0x0;var _0x52cd74=_0xe57b[_0x1273fb];return _0x52cd74;};'use strict';var _=require(_0xbe57('0x0'));var util=require(_0xbe57('0x1'));var logger=require(_0xbe57('0x2'))(_0xbe57('0x3'));var moment=require(_0xbe57('0x4'));var BPromise=require('bluebird');var rp=require(_0xbe57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe57('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe57('0x7'));module[_0xbe57('0x8')]=function(_0x44b123,_0x5d0a20){return _0x44b123[_0xbe57('0x9')](_0xbe57('0xa'),attributes,{'tableName':_0xbe57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 78e3f12..4b60054 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 _0x27db=['request','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x27db,0x114));var _0xb27d=function(_0x4da5c1,_0x1f027f){_0x4da5c1=_0x4da5c1-0x0;var _0x4d2f32=_0x27db[_0x4da5c1];return _0x4d2f32;};'use strict';var _=require(_0xb27d('0x0'));var util=require(_0xb27d('0x1'));var moment=require(_0xb27d('0x2'));var BPromise=require('bluebird');var rs=require(_0xb27d('0x3'));var fs=require('fs');var Redis=require(_0xb27d('0x4'));var db=require(_0xb27d('0x5'))['db'];var utils=require(_0xb27d('0x6'));var logger=require('../../config/logger')(_0xb27d('0x7'));var config=require(_0xb27d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb27d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde39d2,_0xb99efe,_0x24a7a2){return new BPromise(function(_0xc1a37c,_0x16ca6d){return client[_0xb27d('0xa')](_0xde39d2,_0x24a7a2)['then'](function(_0x4625b7){logger[_0xb27d('0xb')](_0xb27d('0xc'),_0xb99efe,'request\x20sent');logger[_0xb27d('0xd')](_0xb27d('0xe'),_0xb99efe,_0xb27d('0xf'),JSON[_0xb27d('0x10')](_0x4625b7));if(_0x4625b7['error']){if(_0x4625b7['error'][_0xb27d('0x11')]===0x1f4){logger['error'](_0xb27d('0xc'),_0xb99efe,_0x4625b7['error']['message']);return _0x16ca6d(_0x4625b7['error'][_0xb27d('0x12')]);}logger['error'](_0xb27d('0xc'),_0xb99efe,_0x4625b7[_0xb27d('0x13')][_0xb27d('0x12')]);return _0xc1a37c(_0x4625b7[_0xb27d('0x13')][_0xb27d('0x12')]);}else{logger[_0xb27d('0xb')](_0xb27d('0xc'),_0xb99efe,'request\x20sent');_0xc1a37c(_0x4625b7[_0xb27d('0x14')]['message']);}})[_0xb27d('0x15')](function(_0x26aefa){logger[_0xb27d('0x13')]('License,\x20%s,\x20%s',_0xb99efe,_0x26aefa);_0x16ca6d(_0x26aefa);});});} \ No newline at end of file +var _0xa7f2=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1072e5,_0x189773){var _0x3465bd=function(_0x3f4048){while(--_0x3f4048){_0x1072e5['push'](_0x1072e5['shift']());}};_0x3465bd(++_0x189773);}(_0xa7f2,0xa8));var _0x2a7f=function(_0xaf52f9,_0x3608bc){_0xaf52f9=_0xaf52f9-0x0;var _0xd9e03e=_0xa7f2[_0xaf52f9];return _0xd9e03e;};'use strict';var _=require('lodash');var util=require(_0x2a7f('0x0'));var moment=require(_0x2a7f('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a7f('0x2'));var fs=require('fs');var Redis=require(_0x2a7f('0x3'));var db=require(_0x2a7f('0x4'))['db'];var utils=require(_0x2a7f('0x5'));var logger=require('../../config/logger')(_0x2a7f('0x6'));var config=require(_0x2a7f('0x7'));var jayson=require(_0x2a7f('0x8'));var client=jayson[_0x2a7f('0x9')][_0x2a7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30ccf0,_0x4bcfba,_0x16e67c){return new BPromise(function(_0xf9f34a,_0x27b007){return client[_0x2a7f('0xb')](_0x30ccf0,_0x16e67c)['then'](function(_0x537bfe){logger[_0x2a7f('0xc')](_0x2a7f('0xd'),_0x4bcfba,_0x2a7f('0xe'));logger[_0x2a7f('0xf')](_0x2a7f('0x10'),_0x4bcfba,_0x2a7f('0xe'),JSON[_0x2a7f('0x11')](_0x537bfe));if(_0x537bfe[_0x2a7f('0x12')]){if(_0x537bfe[_0x2a7f('0x12')]['code']===0x1f4){logger[_0x2a7f('0x12')](_0x2a7f('0xd'),_0x4bcfba,_0x537bfe[_0x2a7f('0x12')][_0x2a7f('0x13')]);return _0x27b007(_0x537bfe[_0x2a7f('0x12')][_0x2a7f('0x13')]);}logger[_0x2a7f('0x12')]('License,\x20%s,\x20%s',_0x4bcfba,_0x537bfe['error'][_0x2a7f('0x13')]);return _0xf9f34a(_0x537bfe[_0x2a7f('0x12')][_0x2a7f('0x13')]);}else{logger[_0x2a7f('0xc')](_0x2a7f('0xd'),_0x4bcfba,'request\x20sent');_0xf9f34a(_0x537bfe['result']['message']);}})['catch'](function(_0x1be303){logger[_0x2a7f('0x12')](_0x2a7f('0xd'),_0x4bcfba,_0x1be303);_0x27b007(_0x1be303);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 962e23e..040f1a1 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 _0xf849=['/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','./mailAccount.controller','index','isAuthenticated','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp'];(function(_0x590705,_0x2ee44f){var _0x38160e=function(_0x529384){while(--_0x529384){_0x590705['push'](_0x590705['shift']());}};_0x38160e(++_0x2ee44f);}(_0xf849,0x193));var _0x9f84=function(_0x34b48c,_0xe97afa){_0x34b48c=_0x34b48c-0x0;var _0x3b9957=_0xf849[_0x34b48c];return _0x3b9957;};'use strict';var multer=require(_0x9f84('0x0'));var util=require(_0x9f84('0x1'));var path=require(_0x9f84('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f84('0x3'));var router=express[_0x9f84('0x4')]();var fs_extra=require(_0x9f84('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f84('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f84('0x7')]);router['get']('/describe',auth[_0x9f84('0x8')](),controller['describe']);router[_0x9f84('0x9')](_0x9f84('0xa'),auth[_0x9f84('0x8')](),controller[_0x9f84('0xb')]);router[_0x9f84('0x9')](_0x9f84('0xc'),auth[_0x9f84('0x8')](),controller[_0x9f84('0xd')]);router[_0x9f84('0x9')](_0x9f84('0xe'),auth[_0x9f84('0x8')](),controller[_0x9f84('0xf')]);router[_0x9f84('0x9')](_0x9f84('0x10'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x11')]);router['get'](_0x9f84('0x12'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x13')]);router[_0x9f84('0x9')](_0x9f84('0x14'),auth['isAuthenticated'](),controller[_0x9f84('0x15')]);router[_0x9f84('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9f84('0x16')]);router[_0x9f84('0x9')](_0x9f84('0x17'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x18')]);router['get'](_0x9f84('0x19'),auth[_0x9f84('0x8')](),controller['verifySmtp']);router[_0x9f84('0x9')](_0x9f84('0x1a'),auth['isAuthenticated'](),controller[_0x9f84('0x1b')]);router['post']('/:id/dispositions',auth[_0x9f84('0x8')](),controller[_0x9f84('0x1c')]);router[_0x9f84('0x1d')](_0x9f84('0xe'),auth[_0x9f84('0x8')](),controller['addAnswer']);router[_0x9f84('0x1d')]('/',auth['isAuthenticated'](),controller[_0x9f84('0x1e')]);router[_0x9f84('0x1d')](_0x9f84('0x10'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x1f')]);router['post'](_0x9f84('0x12'),auth['isAuthenticated'](),controller[_0x9f84('0x20')]);router[_0x9f84('0x1d')](_0x9f84('0x14'),auth['isAuthenticated'](),controller[_0x9f84('0x21')]);router['post'](_0x9f84('0x22'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x23')]);router[_0x9f84('0x1d')](_0x9f84('0x24'),auth['isAuthenticated'](),controller['send']);router['post'](_0x9f84('0x1a'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x25')]);router[_0x9f84('0x26')](_0x9f84('0xa'),auth['isAuthenticated'](),controller[_0x9f84('0x27')]);router[_0x9f84('0x28')](_0x9f84('0xc'),auth[_0x9f84('0x8')](),controller['removeDispositions']);router['delete'](_0x9f84('0xe'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x29')]);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x9f84('0x2a')]);router['delete'](_0x9f84('0x12'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x2b')]);router[_0x9f84('0x28')](_0x9f84('0xa'),auth[_0x9f84('0x8')](),controller[_0x9f84('0x2c')]);router['delete']('/:id/users',auth[_0x9f84('0x8')](),controller[_0x9f84('0x2d')]);module[_0x9f84('0x2e')]=router; \ No newline at end of file +var _0xebea=['update','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','verifySmtp','/:id/users','post','addAnswer','create','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xebea,0x1b8));var _0xaebe=function(_0x102e4a,_0x17e601){_0x102e4a=_0x102e4a-0x0;var _0xc17d2b=_0xebea[_0x102e4a];return _0xc17d2b;};'use strict';var multer=require(_0xaebe('0x0'));var util=require(_0xaebe('0x1'));var path=require(_0xaebe('0x2'));var timeout=require(_0xaebe('0x3'));var express=require(_0xaebe('0x4'));var router=express[_0xaebe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaebe('0x6'));var interaction=require(_0xaebe('0x7'));var config=require('../../config/environment');var controller=require(_0xaebe('0x8'));router[_0xaebe('0x9')]('/',auth[_0xaebe('0xa')](),controller[_0xaebe('0xb')]);router[_0xaebe('0x9')](_0xaebe('0xc'),auth['isAuthenticated'](),controller[_0xaebe('0xd')]);router['get'](_0xaebe('0xe'),auth[_0xaebe('0xa')](),controller[_0xaebe('0xf')]);router[_0xaebe('0x9')](_0xaebe('0x10'),auth['isAuthenticated'](),controller[_0xaebe('0x11')]);router[_0xaebe('0x9')](_0xaebe('0x12'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x13')]);router[_0xaebe('0x9')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xaebe('0x14')]);router['get'](_0xaebe('0x15'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x16')]);router[_0xaebe('0x9')](_0xaebe('0x17'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x18')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xaebe('0x19')]);router[_0xaebe('0x9')](_0xaebe('0x1a'),auth[_0xaebe('0xa')](),controller['getMessages']);router[_0xaebe('0x9')]('/:id/verify',auth[_0xaebe('0xa')](),controller[_0xaebe('0x1b')]);router[_0xaebe('0x9')](_0xaebe('0x1c'),auth[_0xaebe('0xa')](),controller['getAgents']);router[_0xaebe('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xaebe('0x1d')](_0xaebe('0x12'),auth['isAuthenticated'](),controller[_0xaebe('0x1e')]);router['post']('/',auth[_0xaebe('0xa')](),controller[_0xaebe('0x1f')]);router[_0xaebe('0x1d')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0xaebe('0x1d')]('/:id/out_servers',auth[_0xaebe('0xa')](),controller[_0xaebe('0x20')]);router['post'](_0xaebe('0x17'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x21')]);router[_0xaebe('0x1d')](_0xaebe('0x22'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x23')]);router['post'](_0xaebe('0x24'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x25')]);router[_0xaebe('0x1d')](_0xaebe('0x1c'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x26')]);router[_0xaebe('0x27')](_0xaebe('0xe'),auth['isAuthenticated'](),controller[_0xaebe('0x28')]);router[_0xaebe('0x29')](_0xaebe('0x10'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x2a')]);router[_0xaebe('0x29')](_0xaebe('0x12'),auth['isAuthenticated'](),controller[_0xaebe('0x2b')]);router['delete'](_0xaebe('0x2c'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x2d')]);router[_0xaebe('0x29')](_0xaebe('0x15'),auth[_0xaebe('0xa')](),controller['removeSmtp']);router[_0xaebe('0x29')](_0xaebe('0xe'),auth[_0xaebe('0xa')](),controller[_0xaebe('0x2e')]);router[_0xaebe('0x29')]('/:id/users',auth['isAuthenticated'](),controller[_0xaebe('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index c63a142..bc69f10 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 _0x98d7=['provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue'];(function(_0x289a21,_0x261401){var _0x3d349d=function(_0x1481d){while(--_0x1481d){_0x289a21['push'](_0x289a21['shift']());}};_0x3d349d(++_0x261401);}(_0x98d7,0x122));var _0x798d=function(_0x301203,_0x177a99){_0x301203=_0x301203-0x0;var _0x2ff1bd=_0x98d7[_0x301203];return _0x2ff1bd;};'use strict';var Sequelize=require(_0x798d('0x0'));module['exports']={'description':{'type':Sequelize[_0x798d('0x1')]},'name':{'type':Sequelize[_0x798d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x798d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x798d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x798d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x798d('0x3')]},'markAsUnread':{'type':Sequelize[_0x798d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x798d('0x1')],'allowNull':![],'defaultValue':_0x798d('0x4')},'fontSize':{'type':Sequelize[_0x798d('0x5')](0x2)[_0x798d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x798d('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x798d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x798d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x798d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x798d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x798d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x798d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x798d('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x798d('0x7'),'set':function(_0x57d0c4){if(!_0x57d0c4)this[_0x798d('0x8')](_0x798d('0x9'),null);this[_0x798d('0x8')](_0x798d('0xa'),_0x57d0c4);}},'provider':{'type':Sequelize[_0x798d('0xb')]('gmail',_0x798d('0xc'),_0x798d('0xd'),_0x798d('0xe')),'defaultValue':null,'get':function(){if(!this[_0x798d('0xf')](_0x798d('0x10')))return _0x798d('0x11');return this[_0x798d('0xf')]('provider');},'set':function(_0xe49351){if(_0xe49351==='custom')_0xe49351=null;return this['setDataValue'](_0x798d('0x10'),_0xe49351);}}}; \ No newline at end of file +var _0x6d07=['getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x6d07,0x1a7));var _0x76d0=function(_0xfdd6b6,_0x19497a){_0xfdd6b6=_0xfdd6b6-0x0;var _0x464439=_0x6d07[_0xfdd6b6];return _0x464439;};'use strict';var Sequelize=require(_0x76d0('0x0'));module[_0x76d0('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x76d0('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x76d0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x76d0('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x76d0('0x2')],'allowNull':![],'defaultValue':_0x76d0('0x4')},'fontSize':{'type':Sequelize[_0x76d0('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x76d0('0x6');}},'notificationSound':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x76d0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x76d0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x76d0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x76d0('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x76d0('0x3')],'defaultValue':![],'comment':_0x76d0('0x8'),'set':function(_0x5d4825){if(!_0x5d4825)this['setDataValue'](_0x76d0('0x9'),null);this[_0x76d0('0xa')](_0x76d0('0xb'),_0x5d4825);}},'provider':{'type':Sequelize[_0x76d0('0xc')](_0x76d0('0xd'),_0x76d0('0xe'),_0x76d0('0xf'),_0x76d0('0x10')),'defaultValue':null,'get':function(){if(!this[_0x76d0('0x11')](_0x76d0('0x12')))return _0x76d0('0x13');return this[_0x76d0('0x11')](_0x76d0('0x12'));},'set':function(_0x496ee5){if(_0x496ee5==='custom')_0x496ee5=null;return this[_0x76d0('0xa')](_0x76d0('0x12'),_0x496ee5);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c5cf923..f459296 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 _0x4965=['User','fullname','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','stack','name','send','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','username','pass','password','modernAuthentication','CloudProviderId','host','port','service','user','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','body','provider','secure','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','sort','findAll','removeDispositions','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','ids','custom','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','getImap','addImap','getSmtp','addSmtp','addInteraction','MailInteraction','Contact'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x4965,0x1ae));var _0x5496=function(_0xc3083f,_0x5ac664){_0xc3083f=_0xc3083f-0x0;var _0x8e45bb=_0x4965[_0xc3083f];return _0x8e45bb;};'use strict';var moment=require(_0x5496('0x0'));var BPromise=require(_0x5496('0x1'));var util=require(_0x5496('0x2'));var path=require(_0x5496('0x3'));var _=require(_0x5496('0x4'));var juice=require(_0x5496('0x5'));var Redis=require(_0x5496('0x6'));var qs=require(_0x5496('0x7'));var logger=require('../../config/logger')(_0x5496('0x8'));var config=require('../../config/environment');var db=require(_0x5496('0x9'))['db'];config['redis']=_[_0x5496('0xa')](config['redis'],{'host':_0x5496('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x4b543c,_0x3e68,_0x1c8b8a,_0x4f5961){return new BPromise(function(_0xe0a5d8,_0x27ddc2){var _0x2078c3=_0x4f5961||client;return _0x2078c3['request'](_0x4b543c,_0x1c8b8a)[_0x5496('0xc')](function(_0x629cdc){logger[_0x5496('0xd')](_0x5496('0xe'),_0x3e68,'request\x20sent');logger[_0x5496('0xf')](_0x5496('0x10'),_0x3e68,'request\x20sent',JSON[_0x5496('0x11')](_0x629cdc));if(_0x629cdc[_0x5496('0x12')]){if(_0x629cdc[_0x5496('0x12')][_0x5496('0x13')]===0x1f4){logger[_0x5496('0x12')](_0x5496('0xe'),_0x3e68,_0x629cdc[_0x5496('0x12')][_0x5496('0x14')]);return _0x27ddc2(_0x629cdc[_0x5496('0x12')][_0x5496('0x14')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3e68,_0x629cdc[_0x5496('0x12')][_0x5496('0x14')]);return _0xe0a5d8(_0x629cdc['error'][_0x5496('0x14')]);}else{logger['info'](_0x5496('0xe'),_0x3e68,_0x5496('0x15'));_0xe0a5d8(_0x629cdc[_0x5496('0x16')][_0x5496('0x14')]);}})[_0x5496('0x17')](function(_0x2ff25f){logger[_0x5496('0x12')]('MailAccount,\x20%s,\x20%s',_0x3e68,_0x2ff25f);_0x27ddc2(_0x2ff25f);});});}function respondWithStatusCode(_0x22f830,_0x468e50){_0x468e50=_0x468e50||0xcc;return function(_0x40d364){if(_0x40d364){return _0x22f830[_0x5496('0x18')](_0x468e50);}return _0x22f830[_0x5496('0x19')](_0x468e50)['end']();};}function respondWithResult(_0x338b69,_0x3bce25){_0x3bce25=_0x3bce25||0xc8;return function(_0x2d541b){if(_0x2d541b){return _0x338b69[_0x5496('0x19')](_0x3bce25)[_0x5496('0x1a')](_0x2d541b);}};}function respondWithFilteredResult(_0x4050f5,_0x42f043){return function(_0x3cb558){if(_0x3cb558){var _0x1cdfc9=typeof _0x42f043[_0x5496('0x1b')]===_0x5496('0x1c')&&typeof _0x42f043['limit']===_0x5496('0x1c');var _0x4bb114=_0x3cb558['count'];var _0x5e338f=_0x1cdfc9?0x0:_0x42f043[_0x5496('0x1b')];var _0x3ed773=_0x1cdfc9?_0x3cb558[_0x5496('0x1d')]:_0x42f043[_0x5496('0x1b')]+_0x42f043[_0x5496('0x1e')];var _0x475ea9;if(_0x3ed773>=_0x4bb114){_0x3ed773=_0x4bb114;_0x475ea9=0xc8;}else{_0x475ea9=0xce;}_0x4050f5[_0x5496('0x19')](_0x475ea9);return _0x4050f5[_0x5496('0x1f')](_0x5496('0x20'),_0x5e338f+'-'+_0x3ed773+'/'+_0x4bb114)[_0x5496('0x1a')](_0x3cb558);}return null;};}function saveUpdates(_0x56cc87){return function(_0x44d31a){if(_0x44d31a){return _0x44d31a[_0x5496('0x21')](_0x56cc87)[_0x5496('0xc')](function(_0x62eb95){return _0x62eb95;});}return null;};}function removeEntity(_0x45f091){return function(_0x108895){if(_0x108895){return _0x108895[_0x5496('0x22')]()[_0x5496('0xc')](function(){var _0x14940b=_0x108895['get']({'plain':!![]});var _0xb0385='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0xb0385,'resourceId':_0x14940b['id']}})[_0x5496('0xc')](function(){return _0x108895;});})[_0x5496('0xc')](function(){_0x45f091['status'](0xcc)[_0x5496('0x23')]();});}};}function handleEntityNotFound(_0x344c8c){return function(_0x32c775){if(!_0x32c775){_0x344c8c[_0x5496('0x18')](0x194);}return _0x32c775;};}function handleError(_0x151d39,_0x52bbc9){_0x52bbc9=_0x52bbc9||0x1f4;return function(_0x5bce8c){logger[_0x5496('0x12')](_0x5bce8c[_0x5496('0x24')]);if(_0x5bce8c[_0x5496('0x25')]){delete _0x5bce8c[_0x5496('0x25')];}_0x151d39[_0x5496('0x19')](_0x52bbc9)[_0x5496('0x26')](_0x5bce8c);};}function getImapHost(_0x221de6){switch(_0x221de6){case'gmail':return'imap.gmail.com';case _0x5496('0x27'):return _0x5496('0x28');case _0x5496('0x29'):return _0x5496('0x2a');case _0x5496('0x2b'):return _0x5496('0x2c');}throw new Error('Unknown\x20email\x20service\x20provider',_0x221de6);}function getSmtpHost(_0x4671bf){switch(_0x4671bf){case _0x5496('0x2d'):return'smtp.gmail.com';case _0x5496('0x27'):return _0x5496('0x2e');case _0x5496('0x29'):return _0x5496('0x2f');case'outlook365':return _0x5496('0x30');}throw new Error(_0x5496('0x31'),_0x4671bf);}function getAuthenticationOptions(_0x3f9fd0,_0x59be2b){var _0x287b83={};var _0x23c7d3={};if(_0x3f9fd0){_0x287b83['user']=_0x23c7d3['user']=_0x59be2b[_0x5496('0x32')];_0x287b83['password']=_0x23c7d3[_0x5496('0x33')]=_0x59be2b[_0x5496('0x34')];if(_0x59be2b[_0x5496('0x35')]){_0x287b83[_0x5496('0x35')]=_0x23c7d3[_0x5496('0x35')]=!![];_0x287b83[_0x5496('0x36')]=_0x23c7d3[_0x5496('0x36')]=_0x59be2b[_0x5496('0x36')];_0x287b83['password']=_0x23c7d3[_0x5496('0x33')]=null;}else{_0x287b83[_0x5496('0x36')]=_0x23c7d3[_0x5496('0x36')]=null;}_0x287b83[_0x5496('0x37')]=getImapHost(_0x3f9fd0);_0x287b83[_0x5496('0x38')]=0x3e1;_0x23c7d3[_0x5496('0x37')]=getSmtpHost(_0x3f9fd0);_0x23c7d3[_0x5496('0x38')]=0x24b;_0x23c7d3['secure']=![];_0x287b83[_0x5496('0x39')]=_0x23c7d3[_0x5496('0x39')]=null;}else{if(_0x59be2b['authentication']){_0x287b83['user']=_0x23c7d3[_0x5496('0x3a')]=_0x59be2b[_0x5496('0x32')];_0x287b83[_0x5496('0x34')]=_0x23c7d3['pass']=_0x59be2b[_0x5496('0x34')];}else{_0x287b83[_0x5496('0x3b')]=_0x23c7d3[_0x5496('0x3b')]=![];_0x287b83[_0x5496('0x3a')]=_0x23c7d3[_0x5496('0x3a')]=null;_0x287b83[_0x5496('0x34')]=_0x23c7d3['pass']=null;}_0x287b83[_0x5496('0x37')]=_0x59be2b[_0x5496('0x3c')][_0x5496('0x37')];_0x287b83[_0x5496('0x38')]=_0x59be2b[_0x5496('0x3c')][_0x5496('0x38')];_0x23c7d3['host']=_0x59be2b[_0x5496('0x3d')][_0x5496('0x37')];_0x23c7d3[_0x5496('0x38')]=_0x59be2b[_0x5496('0x3d')]['port'];}return{'Imap':_0x287b83,'Smtp':_0x23c7d3};}exports[_0x5496('0x3e')]=function(_0x389d1d,_0x5d6b6c){var _0x20339f={'include':[{'model':db[_0x5496('0x3f')],'as':_0x5496('0x3c')},{'model':db[_0x5496('0x40')],'as':_0x5496('0x3d')},{'model':db[_0x5496('0x41')],'as':'mandatoryDispositionPause'}]},_0x49becc={},_0x188820={'count':0x0,'rows':[]};var _0x5da9e0=_[_0x5496('0x42')](db[_0x5496('0x43')][_0x5496('0x44')],function(_0x38e89c){return{'name':_0x38e89c['fieldName'],'type':_0x38e89c[_0x5496('0x45')]['key']};});_0x49becc[_0x5496('0x46')]=_[_0x5496('0x42')](_0x5da9e0,_0x5496('0x25'));_0x49becc[_0x5496('0x47')]=_[_0x5496('0x48')](_0x389d1d[_0x5496('0x47')]);_0x49becc[_0x5496('0x49')]=_[_0x5496('0x4a')](_0x49becc[_0x5496('0x46')],_0x49becc[_0x5496('0x47')]);_0x20339f[_0x5496('0x4b')]=_[_0x5496('0x4a')](_0x49becc[_0x5496('0x46')],qs[_0x5496('0x4c')](_0x389d1d[_0x5496('0x47')]['fields']));_0x20339f[_0x5496('0x4b')]=_0x20339f['attributes'][_0x5496('0x4d')]?_0x20339f[_0x5496('0x4b')]:_0x49becc['model'];if(!_0x389d1d[_0x5496('0x47')][_0x5496('0x4e')](_0x5496('0x4f'))){_0x20339f[_0x5496('0x1e')]=qs['limit'](_0x389d1d['query'][_0x5496('0x1e')]);_0x20339f[_0x5496('0x1b')]=qs[_0x5496('0x1b')](_0x389d1d['query']['offset']);}_0x20339f[_0x5496('0x50')]=qs['sort'](_0x389d1d[_0x5496('0x47')]['sort']);_0x20339f[_0x5496('0x51')]=qs['filters'](_[_0x5496('0x52')](_0x389d1d[_0x5496('0x47')],_0x49becc[_0x5496('0x49')]),_0x5da9e0);if(_0x389d1d['query'][_0x5496('0x53')]){_0x20339f[_0x5496('0x51')]=_[_0x5496('0x54')](_0x20339f[_0x5496('0x51')],{'$or':_[_0x5496('0x42')](_0x5da9e0,function(_0x425405){if(_0x425405[_0x5496('0x45')]!==_0x5496('0x55')){var _0x14010d={};_0x14010d[_0x425405[_0x5496('0x25')]]={'$like':'%'+_0x389d1d['query'][_0x5496('0x53')]+'%'};return _0x14010d;}})});}_0x20339f=_[_0x5496('0x54')]({},_0x20339f,_0x389d1d[_0x5496('0x56')]);var _0x9dcb37={'where':_0x20339f[_0x5496('0x51')]};return db[_0x5496('0x43')][_0x5496('0x1d')](_0x9dcb37)['then'](function(_0x1ebe50){_0x188820['count']=_0x1ebe50;if(_0x389d1d['query'][_0x5496('0x57')]){_0x20339f[_0x5496('0x58')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x20339f);})[_0x5496('0xc')](function(_0x16ef7e){_0x188820[_0x5496('0x59')]=_0x16ef7e;return _0x188820;})[_0x5496('0xc')](respondWithFilteredResult(_0x5d6b6c,_0x20339f))[_0x5496('0x17')](handleError(_0x5d6b6c,null));};exports['show']=function(_0x437997,_0x38b83c){var _0x1cbf50={'raw':![],'where':{'id':_0x437997[_0x5496('0x5a')]['id']},'include':[{'model':db[_0x5496('0x3f')],'as':_0x5496('0x3c')},{'model':db[_0x5496('0x40')],'as':_0x5496('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x63e7b3={};_0x63e7b3['model']=_[_0x5496('0x48')](db['MailAccount'][_0x5496('0x44')]);_0x63e7b3[_0x5496('0x47')]=_[_0x5496('0x48')](_0x437997[_0x5496('0x47')]);_0x63e7b3[_0x5496('0x49')]=_[_0x5496('0x4a')](_0x63e7b3['model'],_0x63e7b3[_0x5496('0x47')]);_0x1cbf50[_0x5496('0x4b')]=_[_0x5496('0x4a')](_0x63e7b3['model'],qs[_0x5496('0x4c')](_0x437997[_0x5496('0x47')][_0x5496('0x4c')]));_0x1cbf50[_0x5496('0x4b')]=_0x1cbf50[_0x5496('0x4b')][_0x5496('0x4d')]?_0x1cbf50[_0x5496('0x4b')]:_0x63e7b3[_0x5496('0x46')];if(_0x437997['query'][_0x5496('0x57')]){_0x1cbf50[_0x5496('0x58')]=[{'all':!![]}];}_0x1cbf50=_[_0x5496('0x54')]({},_0x1cbf50,_0x437997[_0x5496('0x56')]);return db[_0x5496('0x43')][_0x5496('0x5b')](_0x1cbf50)[_0x5496('0xc')](handleEntityNotFound(_0x38b83c,null))[_0x5496('0xc')](respondWithResult(_0x38b83c,null))['catch'](handleError(_0x38b83c,null));};exports['update']=function(_0x475bef,_0x4de0ef){if(_0x475bef[_0x5496('0x5c')]['id']){delete _0x475bef[_0x5496('0x5c')]['id'];}var _0xbe5cfa=_0x475bef[_0x5496('0x5c')][_0x5496('0x5d')]==='custom'?null:_0x475bef[_0x5496('0x5c')][_0x5496('0x5d')];var _0x23afef=_0x475bef[_0x5496('0x5c')][_0x5496('0x3c')]||{};var _0x3760ef=_0x475bef[_0x5496('0x5c')][_0x5496('0x3d')]||{};if(_0xbe5cfa){_0x23afef[_0x5496('0x37')]=getImapHost(_0xbe5cfa);_0x23afef[_0x5496('0x38')]=0x3e1;_0x3760ef[_0x5496('0x37')]=getSmtpHost(_0xbe5cfa);_0x3760ef[_0x5496('0x38')]=0x24b;_0x3760ef[_0x5496('0x5e')]=![];}if(_0x3760ef[_0x5496('0x35')]){_0x3760ef[_0x5496('0x5e')]=![];}else{_0x3760ef[_0x5496('0x36')]=null;}if(!_0x23afef[_0x5496('0x35')])_0x23afef[_0x5496('0x36')]=null;_0x475bef[_0x5496('0x5c')][_0x5496('0x3c')]=_0x23afef;_0x475bef[_0x5496('0x5c')][_0x5496('0x3d')]=_0x3760ef;return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x475bef['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x5496('0x3c')},{'model':db[_0x5496('0x40')],'as':_0x5496('0x3d')},{'model':db['Pause'],'as':_0x5496('0x5f')}]})[_0x5496('0xc')](handleEntityNotFound(_0x4de0ef,null))[_0x5496('0xc')](function(_0x7a4d10){if(!_0x7a4d10)throw new Error(_0x5496('0x60'));if(_0x7a4d10[_0x5496('0x39')])delete _0x475bef[_0x5496('0x5c')][_0x5496('0x3c')];return _0x7a4d10;})[_0x5496('0xc')](saveUpdates(_0x475bef[_0x5496('0x5c')],null))[_0x5496('0xc')](function(_0x5bb263){if(!_0x475bef[_0x5496('0x5c')]['Imap'])return _0x5bb263;return db['MailServerIn'][_0x5496('0x21')](_0x475bef[_0x5496('0x5c')]['Imap'],{'where':{'MailAccountId':_0x5bb263['id']}})[_0x5496('0xc')](function(){return _0x5bb263;});})['then'](function(_0x2964a1){if(!_0x475bef[_0x5496('0x5c')]['Smtp'])return _0x2964a1;return db[_0x5496('0x40')]['update'](_0x475bef[_0x5496('0x5c')]['Smtp'],{'where':{'MailAccountId':_0x2964a1['id']}})[_0x5496('0xc')](function(){return _0x2964a1;});})[_0x5496('0xc')](respondWithResult(_0x4de0ef,null))[_0x5496('0x17')](handleError(_0x4de0ef,null));};exports[_0x5496('0x61')]=function(_0x935190,_0x484bb6){return db[_0x5496('0x43')][_0x5496('0x61')]()[_0x5496('0xc')](respondWithResult(_0x484bb6,null))['catch'](handleError(_0x484bb6,null));};exports[_0x5496('0x62')]=function(_0x4b4027,_0x4ca6a6){if(_0x4b4027[_0x5496('0x5c')]['id']){delete _0x4b4027['body']['id'];}return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x4b4027[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x4ca6a6,null))[_0x5496('0xc')](function(_0x290fdf){if(_0x290fdf){_0x4b4027[_0x5496('0x5c')][_0x5496('0x63')]=_0x290fdf['id'];return db[_0x5496('0x64')]['create'](_0x4b4027[_0x5496('0x5c')]);}})[_0x5496('0xc')](respondWithResult(_0x4ca6a6,null))[_0x5496('0x17')](handleError(_0x4ca6a6,null));};exports[_0x5496('0x65')]=function(_0x49c5d2,_0xdbc6ec){var _0x2a6397={'raw':![],'where':{}};var _0x49dbdf={};var _0x47ad53={'count':0x0,'rows':[]};return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x49c5d2[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0xdbc6ec,null))[_0x5496('0xc')](function(_0x319084){if(_0x319084){_0x49dbdf[_0x5496('0x46')]=_[_0x5496('0x48')](db[_0x5496('0x64')][_0x5496('0x44')]);_0x49dbdf[_0x5496('0x47')]=_[_0x5496('0x48')](_0x49c5d2[_0x5496('0x47')]);_0x49dbdf['filters']=_[_0x5496('0x4a')](_0x49dbdf[_0x5496('0x46')],_0x49dbdf['query']);_0x2a6397[_0x5496('0x4b')]=_[_0x5496('0x4a')](_0x49dbdf[_0x5496('0x46')],qs[_0x5496('0x4c')](_0x49c5d2['query'][_0x5496('0x4c')]));_0x2a6397[_0x5496('0x4b')]=_0x2a6397[_0x5496('0x4b')][_0x5496('0x4d')]?_0x2a6397[_0x5496('0x4b')]:_0x49dbdf[_0x5496('0x46')];if(!_0x49c5d2[_0x5496('0x47')]['hasOwnProperty']('nolimit')){_0x2a6397[_0x5496('0x1e')]=qs[_0x5496('0x1e')](_0x49c5d2['query']['limit']);_0x2a6397[_0x5496('0x1b')]=qs['offset'](_0x49c5d2[_0x5496('0x47')][_0x5496('0x1b')]);}_0x2a6397[_0x5496('0x50')]=qs[_0x5496('0x67')](_0x49c5d2['query']['sort']);_0x2a6397[_0x5496('0x51')]=qs[_0x5496('0x49')](_['pick'](_0x49c5d2[_0x5496('0x47')],_0x49dbdf['filters']));_0x2a6397[_0x5496('0x51')]['MailAccountId']=_0x319084['id'];if(_0x49c5d2['query'][_0x5496('0x53')]){_0x2a6397[_0x5496('0x51')]=_['merge'](_0x2a6397[_0x5496('0x51')],{'$or':_[_0x5496('0x42')](_0x2a6397['attributes'],function(_0x29f220){var _0x4219b6={};_0x4219b6[_0x29f220]={'$like':'%'+_0x49c5d2[_0x5496('0x47')][_0x5496('0x53')]+'%'};return _0x4219b6;})});}_0x2a6397=_[_0x5496('0x54')]({},_0x2a6397,_0x49c5d2[_0x5496('0x56')]);return db[_0x5496('0x64')][_0x5496('0x1d')]({'where':_0x2a6397[_0x5496('0x51')]})['then'](function(_0x3216d4){_0x47ad53[_0x5496('0x1d')]=_0x3216d4;if(_0x49c5d2[_0x5496('0x47')]['includeAll']){_0x2a6397[_0x5496('0x58')]=[{'all':!![]}];}return db[_0x5496('0x64')][_0x5496('0x68')](_0x2a6397);})['then'](function(_0xbaa197){_0x47ad53[_0x5496('0x59')]=_0xbaa197;return _0x47ad53;});}})[_0x5496('0xc')](respondWithFilteredResult(_0xdbc6ec,_0x2a6397))[_0x5496('0x17')](handleError(_0xdbc6ec,null));};exports[_0x5496('0x69')]=function(_0x14b749,_0x29d78c){return db[_0x5496('0x43')]['find']({'where':{'id':_0x14b749[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x29d78c,null))['then'](function(_0x43472a){if(_0x43472a){return _0x43472a[_0x5496('0x69')](_0x14b749[_0x5496('0x47')]['ids']);}})[_0x5496('0xc')](respondWithStatusCode(_0x29d78c,null))[_0x5496('0x17')](handleError(_0x29d78c,null));};exports[_0x5496('0x6a')]=function(_0x29ed14,_0x43cf66){if(_0x29ed14[_0x5496('0x5c')]['id']){delete _0x29ed14[_0x5496('0x5c')]['id'];}return db[_0x5496('0x43')]['find']({'where':{'id':_0x29ed14[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x43cf66,null))[_0x5496('0xc')](function(_0x1320a1){if(_0x1320a1){_0x29ed14[_0x5496('0x5c')][_0x5496('0x63')]=_0x1320a1['id'];return db[_0x5496('0x6b')][_0x5496('0x6c')](_0x29ed14[_0x5496('0x5c')]);}})[_0x5496('0xc')](respondWithResult(_0x43cf66,null))[_0x5496('0x17')](handleError(_0x43cf66,null));};exports[_0x5496('0x6d')]=function(_0x38b7f0,_0x56ec24){var _0xc6af46={'raw':![],'where':{}};var _0x5bddcf={};var _0x5bc752={'count':0x0,'rows':[]};return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x38b7f0[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x56ec24,null))['then'](function(_0x25692c){if(_0x25692c){_0x5bddcf[_0x5496('0x46')]=_[_0x5496('0x48')](db[_0x5496('0x6b')][_0x5496('0x44')]);_0x5bddcf[_0x5496('0x47')]=_['keys'](_0x38b7f0[_0x5496('0x47')]);_0x5bddcf[_0x5496('0x49')]=_['intersection'](_0x5bddcf[_0x5496('0x46')],_0x5bddcf['query']);_0xc6af46[_0x5496('0x4b')]=_[_0x5496('0x4a')](_0x5bddcf['model'],qs[_0x5496('0x4c')](_0x38b7f0[_0x5496('0x47')]['fields']));_0xc6af46[_0x5496('0x4b')]=_0xc6af46[_0x5496('0x4b')][_0x5496('0x4d')]?_0xc6af46[_0x5496('0x4b')]:_0x5bddcf[_0x5496('0x46')];if(!_0x38b7f0['query'][_0x5496('0x4e')]('nolimit')){_0xc6af46[_0x5496('0x1e')]=qs['limit'](_0x38b7f0[_0x5496('0x47')]['limit']);_0xc6af46['offset']=qs[_0x5496('0x1b')](_0x38b7f0[_0x5496('0x47')]['offset']);}_0xc6af46[_0x5496('0x50')]=qs[_0x5496('0x67')](_0x38b7f0[_0x5496('0x47')]['sort']);_0xc6af46[_0x5496('0x51')]=qs[_0x5496('0x49')](_[_0x5496('0x52')](_0x38b7f0[_0x5496('0x47')],_0x5bddcf[_0x5496('0x49')]));_0xc6af46['where'][_0x5496('0x63')]=_0x25692c['id'];if(_0x38b7f0[_0x5496('0x47')]['filter']){_0xc6af46['where']=_[_0x5496('0x54')](_0xc6af46[_0x5496('0x51')],{'$or':_[_0x5496('0x42')](_0xc6af46[_0x5496('0x4b')],function(_0xd265fd){var _0x185833={};_0x185833[_0xd265fd]={'$like':'%'+_0x38b7f0[_0x5496('0x47')][_0x5496('0x53')]+'%'};return _0x185833;})});}_0xc6af46=_[_0x5496('0x54')]({},_0xc6af46,_0x38b7f0[_0x5496('0x56')]);return db[_0x5496('0x6b')][_0x5496('0x1d')]({'where':_0xc6af46[_0x5496('0x51')]})[_0x5496('0xc')](function(_0x5b21c2){_0x5bc752[_0x5496('0x1d')]=_0x5b21c2;if(_0x38b7f0[_0x5496('0x47')][_0x5496('0x57')]){_0xc6af46['include']=[{'all':!![]}];}return db[_0x5496('0x6b')]['findAll'](_0xc6af46);})[_0x5496('0xc')](function(_0x39026f){_0x5bc752[_0x5496('0x59')]=_0x39026f;return _0x5bc752;});}})[_0x5496('0xc')](respondWithFilteredResult(_0x56ec24,_0xc6af46))[_0x5496('0x17')](handleError(_0x56ec24,null));};exports[_0x5496('0x6e')]=function(_0x9d2c3b,_0x69efe7){return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x9d2c3b['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x69efe7,null))[_0x5496('0xc')](function(_0x4597fe){if(_0x4597fe){return _0x4597fe[_0x5496('0x6e')](_0x9d2c3b[_0x5496('0x47')][_0x5496('0x6f')]);}})['then'](respondWithStatusCode(_0x69efe7,null))[_0x5496('0x17')](handleError(_0x69efe7,null));};exports[_0x5496('0x6c')]=function(_0x338578,_0x2bbff5){var _0x5e539c={'name':_0x338578[_0x5496('0x5c')]['name'],'key':_0x338578[_0x5496('0x5c')]['key'],'provider':_0x338578[_0x5496('0x5c')][_0x5496('0x5d')]===_0x5496('0x70')?null:_0x338578[_0x5496('0x5c')][_0x5496('0x5d')],'email':_0x338578[_0x5496('0x5c')][_0x5496('0x71')],'ListId':_0x338578['body'][_0x5496('0x72')],'active':!_[_0x5496('0x73')](_0x338578[_0x5496('0x5c')]['active'])?_0x338578[_0x5496('0x5c')][_0x5496('0x74')]:!![],'description':_0x338578['body'][_0x5496('0x75')]||null};var _0x626dac=getAuthenticationOptions(_0x5e539c[_0x5496('0x5d')],_0x338578['body']);_0x5e539c[_0x5496('0x3c')]=_0x626dac[_0x5496('0x3c')];_0x5e539c[_0x5496('0x3d')]=_0x626dac[_0x5496('0x3d')];return db[_0x5496('0x43')][_0x5496('0x6c')](_0x5e539c,{'include':[{'model':db['MailServerOut'],'as':_0x5496('0x3d')},{'model':db[_0x5496('0x3f')],'as':_0x5496('0x3c')}]})[_0x5496('0xc')](function(_0x40d2f3){var _0x49383d=_0x338578[_0x5496('0x3a')][_0x5496('0x76')]({'plain':!![]});if(!_0x49383d)throw new Error(_0x5496('0x77'));if(_0x49383d[_0x5496('0x78')]===_0x5496('0x3a')){var _0x3f36aa=_0x40d2f3[_0x5496('0x76')]({'plain':!![]});return db[_0x5496('0x79')][_0x5496('0x5b')]({'where':{'name':'MailAccounts','userProfileId':_0x49383d['userProfileId']},'raw':!![]})[_0x5496('0xc')](function(_0x3056fe){if(_0x3056fe&&_0x3056fe[_0x5496('0x7a')]===0x0){return db[_0x5496('0x7b')][_0x5496('0x6c')]({'name':_0x3f36aa[_0x5496('0x25')],'resourceId':_0x3f36aa['id'],'type':_0x3056fe['name'],'sectionId':_0x3056fe['id']},{})[_0x5496('0xc')](function(){return _0x40d2f3;});}else{return _0x40d2f3;}})[_0x5496('0x17')](function(_0x56d253){logger[_0x5496('0x12')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56d253);throw _0x56d253;});}return _0x40d2f3;})[_0x5496('0xc')](respondWithResult(_0x2bbff5,0xc9))[_0x5496('0x17')](handleError(_0x2bbff5,null));};exports[_0x5496('0x7c')]=function(_0x42a165,_0x3be5eb){return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x42a165['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x3be5eb,null))[_0x5496('0xc')](function(_0x1a350f){if(_0x1a350f){return _0x1a350f[_0x5496('0x7c')]();}return null;})[_0x5496('0xc')](respondWithResult(_0x3be5eb,null))['catch'](handleError(_0x3be5eb,null));};exports[_0x5496('0x7d')]=function(_0x2b1f4a,_0x38e42f){if(_0x2b1f4a[_0x5496('0x5c')]['id']){delete _0x2b1f4a[_0x5496('0x5c')]['id'];}return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x2b1f4a[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x38e42f,null))[_0x5496('0xc')](function(_0x18ef38){if(_0x18ef38){_0x2b1f4a[_0x5496('0x5c')][_0x5496('0x63')]=_0x18ef38['id'];return db[_0x5496('0x3f')][_0x5496('0x6c')](_0x2b1f4a[_0x5496('0x5c')]);}})[_0x5496('0xc')](respondWithResult(_0x38e42f,null))[_0x5496('0x17')](handleError(_0x38e42f,null));};exports['removeImap']=function(_0x2b0221,_0x1ae390){return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x2b0221[_0x5496('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ae390,null))['then'](function(_0x191d42){if(_0x191d42){return _0x191d42['setImap'](null);}return null;})[_0x5496('0xc')](respondWithStatusCode(_0x1ae390,null))[_0x5496('0x17')](handleError(_0x1ae390,null));};exports[_0x5496('0x7e')]=function(_0x3d8a45,_0x352239){return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x3d8a45['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x352239,null))[_0x5496('0xc')](function(_0x4976b1){if(_0x4976b1){return _0x4976b1['getSmtp']();}return null;})[_0x5496('0xc')](respondWithResult(_0x352239,null))[_0x5496('0x17')](handleError(_0x352239,null));};exports[_0x5496('0x7f')]=function(_0x3c6d8f,_0x5131cb){if(_0x3c6d8f[_0x5496('0x5c')]['id']){delete _0x3c6d8f[_0x5496('0x5c')]['id'];}return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x3c6d8f['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x5131cb,null))[_0x5496('0xc')](function(_0x55ee0c){if(_0x55ee0c){_0x3c6d8f[_0x5496('0x5c')][_0x5496('0x63')]=_0x55ee0c['id'];return db['MailServerOut']['create'](_0x3c6d8f[_0x5496('0x5c')]);}})['then'](respondWithResult(_0x5131cb,null))[_0x5496('0x17')](handleError(_0x5131cb,null));};exports['removeSmtp']=function(_0xa456a9,_0x28177b){return db[_0x5496('0x43')]['findOne']({'where':{'id':_0xa456a9['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x28177b,null))[_0x5496('0xc')](function(_0x65cd9d){if(_0x65cd9d){return _0x65cd9d['setSmtp'](null);}return null;})[_0x5496('0xc')](respondWithStatusCode(_0x28177b,null))['catch'](handleError(_0x28177b,null));};exports[_0x5496('0x80')]=function(_0x489e1f,_0x559f5f){return db[_0x5496('0x81')][_0x5496('0x5b')]({'where':{'id':_0x489e1f[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x559f5f,null))[_0x5496('0xc')](function(_0x5eac41){if(_0x5eac41){return _0x5eac41['addInteraction'](_0x489e1f['body'][_0x5496('0x6f')],_['omit'](_0x489e1f[_0x5496('0x5c')],[_0x5496('0x6f'),'id'])||{});}})[_0x5496('0xc')](respondWithResult(_0x559f5f,null))['catch'](handleError(_0x559f5f,null));};exports['getInteractions']=function(_0x5d3262,_0x222bba){var _0x20aef2={'raw':![],'where':{}};var _0x16263e={};var _0x190b59={'count':0x0,'rows':[]};return db[_0x5496('0x43')]['findOne']({'where':{'id':_0x5d3262[_0x5496('0x5a')]['id']}})['then'](handleEntityNotFound(_0x222bba,null))['then'](function(_0x124e6d){if(_0x124e6d){_0x16263e['model']=_[_0x5496('0x48')](db['MailInteraction'][_0x5496('0x44')]);_0x16263e['query']=_[_0x5496('0x48')](_0x5d3262['query']);_0x16263e[_0x5496('0x49')]=_['intersection'](_0x16263e['model'],_0x16263e[_0x5496('0x47')]);_0x20aef2[_0x5496('0x4b')]=_[_0x5496('0x4a')](_0x16263e['model'],qs[_0x5496('0x4c')](_0x5d3262[_0x5496('0x47')][_0x5496('0x4c')]));_0x20aef2[_0x5496('0x4b')]=_0x20aef2[_0x5496('0x4b')][_0x5496('0x4d')]?_0x20aef2[_0x5496('0x4b')]:_0x16263e['model'];if(!_0x5d3262['query']['hasOwnProperty'](_0x5496('0x4f'))){_0x20aef2[_0x5496('0x1e')]=qs[_0x5496('0x1e')](_0x5d3262[_0x5496('0x47')]['limit']);_0x20aef2[_0x5496('0x1b')]=qs[_0x5496('0x1b')](_0x5d3262['query'][_0x5496('0x1b')]);}_0x20aef2[_0x5496('0x50')]=qs[_0x5496('0x67')](_0x5d3262['query'][_0x5496('0x67')]);_0x20aef2[_0x5496('0x51')]=qs[_0x5496('0x49')](_[_0x5496('0x52')](_0x5d3262[_0x5496('0x47')],_0x16263e['filters']));_0x20aef2[_0x5496('0x51')][_0x5496('0x63')]=_0x124e6d['id'];if(_0x5d3262[_0x5496('0x47')][_0x5496('0x53')]){_0x20aef2['where']=_['merge'](_0x20aef2[_0x5496('0x51')],{'$or':_[_0x5496('0x42')](_0x20aef2[_0x5496('0x4b')],function(_0x5445cd){var _0x1fa728={};_0x1fa728[_0x5445cd]={'$like':'%'+_0x5d3262[_0x5496('0x47')]['filter']+'%'};return _0x1fa728;})});}_0x20aef2=_[_0x5496('0x54')]({},_0x20aef2,_0x5d3262[_0x5496('0x56')]);return db[_0x5496('0x81')][_0x5496('0x1d')]({'where':_0x20aef2['where']})[_0x5496('0xc')](function(_0x92d3d){_0x190b59[_0x5496('0x1d')]=_0x92d3d;if(_0x5d3262[_0x5496('0x47')][_0x5496('0x57')]){_0x20aef2[_0x5496('0x58')]=[{'model':db['CmContact'],'as':_0x5496('0x82'),'required':![]},{'model':db[_0x5496('0x83')],'as':'Owner','attributes':[_0x5496('0x25'),_0x5496('0x84'),'internal'],'required':![]},{'model':db[_0x5496('0x85')],'as':_0x5496('0x86'),'attributes':['id',_0x5496('0x25'),_0x5496('0x87')],'where':_0x5d3262[_0x5496('0x47')][_0x5496('0x88')]?{'id':_0x5d3262[_0x5496('0x47')][_0x5496('0x88')]}:undefined,'required':_0x5d3262['query'][_0x5496('0x88')]?!![]:![]}];}return db['MailInteraction'][_0x5496('0x68')](_0x20aef2);})['then'](function(_0x37d701){_0x190b59[_0x5496('0x59')]=_0x37d701;return _0x190b59;});}})[_0x5496('0xc')](respondWithFilteredResult(_0x222bba,_0x20aef2))[_0x5496('0x17')](handleError(_0x222bba,null));};exports[_0x5496('0x89')]=function addApplications(_0x32d67d,_0x5b9066){var _0x3794dd=_0x32d67d[_0x5496('0x5a')]['id'];var _0x26511c=_0x32d67d[_0x5496('0x5c')];var _0x5834d2=0xc8;var _0x46fc9f=null;return db['sequelize'][_0x5496('0x8a')]({'isolationLevel':db['sequelize'][_0x5496('0x8b')][_0x5496('0x8c')][_0x5496('0x8d')]},function(_0x2a52fd){return db[_0x5496('0x43')]['findOne']({'where':{'id':_0x3794dd},'transaction':_0x2a52fd})['then'](function(_0x317659){if(_0x317659){return db[_0x5496('0x8e')][_0x5496('0x22')]({'where':{'MailAccountId':_0x3794dd},'transaction':_0x2a52fd})[_0x5496('0xc')](function(){var _0xe2d6e8=_['map'](_0x26511c,function(_0x38cd6d){_0x38cd6d[_0x5496('0x63')]=_0x3794dd;return _0x38cd6d;});return db[_0x5496('0x8e')][_0x5496('0x8f')](_0xe2d6e8,{'transaction':_0x2a52fd});});}else{_0x5834d2=0x194;_0x46fc9f=[];}});})['then'](function(){if(_0x5834d2!==0x194){return db[_0x5496('0x8e')]['findAndCountAll']({'where':{'MailAccountId':_0x3794dd},'order':_0x5496('0x90')})[_0x5496('0xc')](function(_0x11b793){_0x46fc9f=_0x11b793;});}})[_0x5496('0x17')](function(_0xaf31b2){_0x5834d2=0x1f4;logger['error'](_0xaf31b2[_0x5496('0x24')]);if(_0xaf31b2['name']){delete _0xaf31b2[_0x5496('0x25')];}_0x46fc9f=_0xaf31b2;})[_0x5496('0x91')](function(){if(_0x46fc9f===null){_0x5b9066['sendStatus'](_0x5834d2);}else{if(_0x5834d2===0x1f4){_0x5b9066[_0x5496('0x19')](_0x5834d2)['send'](_0x46fc9f);}else{_0x5b9066['status'](_0x5834d2)[_0x5496('0x1a')](_0x46fc9f);}}});};exports[_0x5496('0x92')]=function(_0x57e535,_0x385d50){var _0x9fec2e={};var _0x2ac909={};var _0x2325bd;var _0x68c23b;return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x57e535[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x385d50,null))[_0x5496('0xc')](function(_0x3178cd){if(_0x3178cd){_0x2325bd=_0x3178cd;_0x2ac909[_0x5496('0x46')]=_[_0x5496('0x48')](db[_0x5496('0x8e')][_0x5496('0x44')]);_0x2ac909[_0x5496('0x47')]=_[_0x5496('0x48')](_0x57e535[_0x5496('0x47')]);_0x2ac909[_0x5496('0x49')]=_[_0x5496('0x4a')](_0x2ac909[_0x5496('0x46')],_0x2ac909[_0x5496('0x47')]);_0x9fec2e[_0x5496('0x4b')]=_[_0x5496('0x4a')](_0x2ac909[_0x5496('0x46')],qs[_0x5496('0x4c')](_0x57e535[_0x5496('0x47')][_0x5496('0x4c')]));_0x9fec2e[_0x5496('0x4b')]=_0x9fec2e[_0x5496('0x4b')]['length']?_0x9fec2e[_0x5496('0x4b')]:_0x2ac909[_0x5496('0x46')];_0x9fec2e[_0x5496('0x50')]=qs[_0x5496('0x67')](_0x57e535['query'][_0x5496('0x67')]);_0x9fec2e['where']=qs[_0x5496('0x49')](_[_0x5496('0x52')](_0x57e535[_0x5496('0x47')],_0x2ac909[_0x5496('0x49')]));if(_0x57e535[_0x5496('0x47')][_0x5496('0x53')]){_0x9fec2e[_0x5496('0x51')]=_[_0x5496('0x54')](_0x9fec2e[_0x5496('0x51')],{'$or':_[_0x5496('0x42')](_0x9fec2e[_0x5496('0x4b')],function(_0x167266){var _0x51d079={};_0x51d079[_0x167266]={'$like':'%'+_0x57e535['query'][_0x5496('0x53')]+'%'};return _0x51d079;})});}_0x9fec2e=_[_0x5496('0x54')]({},_0x9fec2e,_0x57e535[_0x5496('0x56')]);return _0x2325bd[_0x5496('0x92')](_0x9fec2e);}})[_0x5496('0xc')](function(_0x1502d5){if(_0x1502d5){_0x68c23b=_0x1502d5[_0x5496('0x4d')];if(!_0x57e535[_0x5496('0x47')][_0x5496('0x4e')](_0x5496('0x4f'))){_0x9fec2e['limit']=qs['limit'](_0x57e535[_0x5496('0x47')][_0x5496('0x1e')]);_0x9fec2e[_0x5496('0x1b')]=qs['offset'](_0x57e535['query'][_0x5496('0x1b')]);}return _0x2325bd[_0x5496('0x92')](_0x9fec2e);}})[_0x5496('0xc')](function(_0x1b168b){if(_0x1b168b){return _0x1b168b?{'count':_0x68c23b,'rows':_0x1b168b}:null;}})[_0x5496('0xc')](respondWithResult(_0x385d50,null))[_0x5496('0x17')](handleError(_0x385d50,null));};exports[_0x5496('0x93')]=function(_0x152360,_0x2a3254){var _0x3ec9bf={'raw':!![],'where':{}};var _0x59cff1={};var _0x26c093={'count':0x0,'rows':[]};return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x152360[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x2a3254,null))[_0x5496('0xc')](function(_0x33c56f){if(_0x33c56f){_0x59cff1[_0x5496('0x46')]=_[_0x5496('0x48')](db[_0x5496('0x94')][_0x5496('0x44')]);_0x59cff1['query']=_[_0x5496('0x48')](_0x152360[_0x5496('0x47')]);_0x59cff1[_0x5496('0x49')]=_['intersection'](_0x59cff1[_0x5496('0x46')],_0x59cff1[_0x5496('0x47')]);_0x3ec9bf[_0x5496('0x4b')]=_['intersection'](_0x59cff1['model'],qs[_0x5496('0x4c')](_0x152360[_0x5496('0x47')][_0x5496('0x4c')]));_0x3ec9bf['attributes']=_0x3ec9bf[_0x5496('0x4b')][_0x5496('0x4d')]?_0x3ec9bf['attributes']:_0x59cff1[_0x5496('0x46')];if(!_0x152360[_0x5496('0x47')][_0x5496('0x4e')](_0x5496('0x4f'))){_0x3ec9bf['limit']=qs[_0x5496('0x1e')](_0x152360[_0x5496('0x47')][_0x5496('0x1e')]);_0x3ec9bf[_0x5496('0x1b')]=qs[_0x5496('0x1b')](_0x152360[_0x5496('0x47')][_0x5496('0x1b')]);}_0x3ec9bf['order']=qs[_0x5496('0x67')](_0x152360[_0x5496('0x47')]['sort']);_0x3ec9bf[_0x5496('0x51')]=qs[_0x5496('0x49')](_[_0x5496('0x52')](_0x152360['query'],_0x59cff1[_0x5496('0x49')]));_0x3ec9bf[_0x5496('0x51')][_0x5496('0x63')]=_0x33c56f['id'];if(_0x152360[_0x5496('0x47')][_0x5496('0x53')]){_0x3ec9bf[_0x5496('0x51')]=_[_0x5496('0x54')](_0x3ec9bf['where'],{'$or':_[_0x5496('0x42')](_0x3ec9bf[_0x5496('0x4b')],function(_0x56eab5){var _0x3b9282={};_0x3b9282[_0x56eab5]={'$like':'%'+_0x152360[_0x5496('0x47')][_0x5496('0x53')]+'%'};return _0x3b9282;})});}if(_0x152360[_0x5496('0x47')]['$gte']){var _0x4f3db2=_0x152360[_0x5496('0x47')]['$gte'][_0x5496('0x95')](',');var _0x8ab92b={};_0x8ab92b[_0x4f3db2[0x0]]={'$gte':moment(_0x4f3db2[0x1])[_0x5496('0x96')](_0x5496('0x97'))};_0x3ec9bf[_0x5496('0x51')]=_[_0x5496('0x54')](_0x3ec9bf[_0x5496('0x51')],_0x8ab92b);}_0x3ec9bf=_[_0x5496('0x54')]({},_0x3ec9bf,_0x152360['options']);return db[_0x5496('0x94')][_0x5496('0x1d')]({'where':_0x3ec9bf['where']})['then'](function(_0x55d459){_0x26c093[_0x5496('0x1d')]=_0x55d459;if(_0x152360[_0x5496('0x47')][_0x5496('0x57')]){_0x3ec9bf['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3ec9bf);})[_0x5496('0xc')](function(_0x576398){if(_0x152360[_0x5496('0x47')]['inlineCss']===_0x5496('0x98')){for(var _0x40ba03=0x0;_0x40ba03<_0x576398[_0x5496('0x4d')];_0x40ba03++){_0x576398[_0x40ba03][_0x5496('0x5c')]=juice(_0x576398[_0x40ba03][_0x5496('0x5c')]);}}_0x26c093[_0x5496('0x59')]=_0x576398;return _0x26c093;});}})[_0x5496('0xc')](respondWithFilteredResult(_0x2a3254,_0x3ec9bf))[_0x5496('0x17')](handleError(_0x2a3254,null));};exports[_0x5496('0x26')]=function(_0x1427c6,_0x398f36){var _0x223cd8,_0x192a9d={},_0x82ac03;if(_0x1427c6['body']['to']){_0x82ac03=_0x1427c6[_0x5496('0x5c')]['to'][_0x5496('0x95')](',')[0x0];}return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x1427c6[_0x5496('0x5a')]['id']},'include':[{'model':db[_0x5496('0x99')],'as':_0x5496('0x9a'),'include':[{'model':db['CmContact'],'as':_0x5496('0x9b'),'where':{'email':_0x82ac03},'limit':0x1,'order':[[_0x5496('0x9c'),_0x5496('0x9d')]]}]},{'model':db[_0x5496('0x40')],'as':_0x5496('0x3d'),'raw':!![],'include':[{'model':db[_0x5496('0x9e')],'as':_0x5496('0x9e'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x398f36,null))['then'](function(_0x3e5d7f){if(!_0x3e5d7f)return;_0x223cd8=_0x3e5d7f;if(!_0x3e5d7f[_0x5496('0x3d')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x5496('0x73')](_0x1427c6[_0x5496('0x5c')][_0x5496('0x9f')])){_0x1427c6['body'][_0x5496('0x9f')]=util[_0x5496('0x96')](_0x5496('0xa0'),_0x3e5d7f[_0x5496('0x25')],_0x3e5d7f['email']||_0x3e5d7f['Smtp']['user']);}if(_0x1427c6[_0x5496('0x5c')][_0x5496('0xa1')]&&_0x1427c6[_0x5496('0x5c')][_0x5496('0xa1')][_0x5496('0x4d')]){for(var _0x295888=0x0;_0x295888<_0x1427c6['body'][_0x5496('0xa1')]['length'];_0x295888+=0x1){_0x1427c6['body'][_0x5496('0xa1')][_0x295888]={'filename':_0x1427c6['body'][_0x5496('0xa1')][_0x295888][_0x5496('0x25')],'path':path[_0x5496('0xa2')](config[_0x5496('0xa3')],_0x5496('0xa4'),_0x1427c6[_0x5496('0x5c')][_0x5496('0xa1')][_0x295888][_0x5496('0xa5')])};}}var _0x18867b=_0x3e5d7f[_0x5496('0xa6')]();return respondWithRpcPromise(_0x5496('0xa7'),_0x5496('0xa8'),{'account':_0x18867b,'message':_0x1427c6[_0x5496('0x5c')]});})[_0x5496('0xc')](function(_0x287b21){if(!_0x287b21)return;_0x192a9d=_0x287b21;if(!_0x223cd8['List'])throw new Error(_0x5496('0xa9'));if(_0x223cd8[_0x5496('0x9a')][_0x5496('0x9b')]['length'])return _0x223cd8[_0x5496('0x9a')][_0x5496('0x9b')][0x0];return db['CmContact'][_0x5496('0x6c')](_['defaults'](_0x1427c6[_0x5496('0x5c')],{'firstName':_0x1427c6[_0x5496('0x5c')]['to'],'email':_0x1427c6[_0x5496('0x5c')]['to'],'phone':_0x1427c6[_0x5496('0x5c')]['to'],'ListId':_0x223cd8['ListId']}));})[_0x5496('0xc')](function(_0x2da4ef){if(!_0x2da4ef)return;var _0x25e5fb={'UserId':_0x1427c6[_0x5496('0x3a')]['id'],'ContactId':_0x2da4ef['id'],'MailAccountId':_0x223cd8['id'],'inReplyTo':_0x192a9d[_0x5496('0xaa')],'to':_0x1427c6['body'][_0x5496('0x9f')],'cc':_0x1427c6[_0x5496('0x5c')]['cc'],'subject':_0x1427c6[_0x5496('0x5c')][_0x5496('0xab')],'attach':_0x1427c6[_0x5496('0x5c')][_0x5496('0xac')],'firstMsgDirection':_0x5496('0xad'),'lastMsgAt':moment()[_0x5496('0x96')](_0x5496('0x97')),'lastMsgDirection':_0x5496('0xad'),'Messages':[_[_0x5496('0x54')](_0x1427c6[_0x5496('0x5c')],{'messageId':_0x192a9d[_0x5496('0xaa')],'sentAt':moment()[_0x5496('0x96')](_0x5496('0x97')),'read':!![],'MailAccountId':_0x223cd8['id'],'UserId':_0x1427c6['user']['id'],'ContactId':_0x2da4ef['id']})]};if(_0x1427c6[_0x5496('0x5c')][_0x5496('0xae')]){_0x25e5fb=_[_0x5496('0x54')](_0x25e5fb,_0x1427c6['body']['Interaction']);}return db['MailInteraction'][_0x5496('0x6c')](_0x25e5fb,{'include':[{'model':db[_0x5496('0x94')],'as':_0x5496('0xaf')}]});})[_0x5496('0xc')](respondWithResult(_0x398f36,null))[_0x5496('0x17')](handleError(_0x398f36,null));};exports[_0x5496('0xb0')]=function(_0x59bd08,_0x5db201){return db[_0x5496('0x43')]['find']({'where':{'id':_0x59bd08[_0x5496('0x5a')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x5496('0x3d'),'raw':!![],'include':[{'model':db[_0x5496('0x9e')],'as':'CloudProvider','raw':!![]}]}]})[_0x5496('0xc')](handleEntityNotFound(_0x5db201,null))[_0x5496('0xc')](function(_0x461116){if(!_0x461116[_0x5496('0x3d')])return;var _0xf9d3cd=_0x461116[_0x5496('0xa6')]();return respondWithRpcPromise(_0x5496('0xb1'),_0x5496('0xb0'),{'account':_0xf9d3cd});})[_0x5496('0xc')](respondWithResult(_0x5db201,null))[_0x5496('0x17')](handleError(_0x5db201,null));};exports[_0x5496('0x22')]=function(_0x310efd,_0x8daffc){return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x310efd[_0x5496('0x5a')]['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x8daffc,null))['then'](function(_0xd737cc){if(_0xd737cc&&_0xd737cc[_0x5496('0x39')]){throw new db['Sequelize'][(_0x5496('0xb2'))](_0x5496('0xb3'));}return _0xd737cc;})[_0x5496('0xc')](removeEntity(_0x8daffc,null))[_0x5496('0x17')](handleError(_0x8daffc,null));};exports[_0x5496('0xb4')]=function(_0x45cf59,_0x58644c){return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x45cf59['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x58644c,null))[_0x5496('0xc')](function(_0x192c9b){if(_0x192c9b){return _0x192c9b[_0x5496('0xb4')](_0x45cf59[_0x5496('0x5c')][_0x5496('0x6f')],_[_0x5496('0xb5')](_0x45cf59[_0x5496('0x5c')],[_0x5496('0x6f'),'id'])||{})[_0x5496('0xb6')](function(_0x55c9b3){for(var _0x3320b6=0x0;_0x3320b6<_0x45cf59[_0x5496('0x5c')][_0x5496('0x6f')][_0x5496('0x4d')];_0x3320b6+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x45cf59[_0x5496('0x5c')][_0x5496('0x6f')][_0x3320b6]),'MailAccountId':Number(_0x45cf59[_0x5496('0x5a')]['id'])});}return _0x55c9b3;});}})['then'](respondWithResult(_0x58644c,null))[_0x5496('0x17')](handleError(_0x58644c,null));};exports[_0x5496('0xb7')]=function(_0x24c828,_0x33b8cd){return db[_0x5496('0x43')][_0x5496('0x5b')]({'where':{'id':_0x24c828['params']['id']}})[_0x5496('0xc')](handleEntityNotFound(_0x33b8cd,null))[_0x5496('0xc')](function(_0x407094){if(_0x407094){return _0x407094['removeAgents'](_0x24c828[_0x5496('0x47')][_0x5496('0x6f')])[_0x5496('0xc')](function(){if(_['isArray'](_0x24c828[_0x5496('0x47')]['ids'])){for(var _0x45d380=0x0;_0x45d380<_0x24c828[_0x5496('0x47')][_0x5496('0x6f')][_0x5496('0x4d')];_0x45d380+=0x1){socket[_0x5496('0xb8')](_0x5496('0xb9'),{'UserId':Number(_0x24c828[_0x5496('0x47')][_0x5496('0x6f')][_0x45d380]),'MailAccountId':Number(_0x24c828[_0x5496('0x5a')]['id'])});}}else{socket[_0x5496('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x24c828[_0x5496('0x47')]['ids']),'MailAccountId':Number(_0x24c828[_0x5496('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x33b8cd,null))[_0x5496('0x17')](handleError(_0x33b8cd,null));};exports[_0x5496('0xba')]=function(_0x30193e,_0x537364){var _0x5ba50f={};var _0xea4092={};var _0x5e2105;var _0x10a84b;return db[_0x5496('0x43')][_0x5496('0x66')]({'where':{'id':_0x30193e[_0x5496('0x5a')]['id']}})['then'](handleEntityNotFound(_0x537364,null))[_0x5496('0xc')](function(_0x4a2b38){if(_0x4a2b38){_0x5e2105=_0x4a2b38;_0xea4092['model']=_['keys'](db[_0x5496('0x83')][_0x5496('0x44')]);_0xea4092['query']=_[_0x5496('0x48')](_0x30193e['query']);_0xea4092[_0x5496('0x49')]=_[_0x5496('0x4a')](_0xea4092['model'],_0xea4092[_0x5496('0x47')]);_0x5ba50f[_0x5496('0x4b')]=_['intersection'](_0xea4092['model'],qs[_0x5496('0x4c')](_0x30193e['query'][_0x5496('0x4c')]));_0x5ba50f[_0x5496('0x4b')]=_0x5ba50f[_0x5496('0x4b')][_0x5496('0x4d')]?_0x5ba50f['attributes']:_0xea4092[_0x5496('0x46')];_0x5ba50f[_0x5496('0x50')]=qs[_0x5496('0x67')](_0x30193e[_0x5496('0x47')][_0x5496('0x67')]);_0x5ba50f[_0x5496('0x51')]=qs[_0x5496('0x49')](_[_0x5496('0x52')](_0x30193e['query'],_0xea4092['filters']));if(_0x30193e[_0x5496('0x47')][_0x5496('0x53')]){_0x5ba50f[_0x5496('0x51')]=_['merge'](_0x5ba50f[_0x5496('0x51')],{'$or':_[_0x5496('0x42')](_0x5ba50f[_0x5496('0x4b')],function(_0x5a7c95){var _0x524d02={};_0x524d02[_0x5a7c95]={'$like':'%'+_0x30193e['query'][_0x5496('0x53')]+'%'};return _0x524d02;})});}_0x5ba50f=_[_0x5496('0x54')]({},_0x5ba50f,_0x30193e[_0x5496('0x56')]);return _0x5e2105[_0x5496('0xba')](_0x5ba50f);}})[_0x5496('0xc')](function(_0x4f3f19){if(_0x4f3f19){_0x10a84b=_0x4f3f19[_0x5496('0x4d')];if(!_0x30193e[_0x5496('0x47')]['hasOwnProperty']('nolimit')){_0x5ba50f[_0x5496('0x1e')]=qs[_0x5496('0x1e')](_0x30193e[_0x5496('0x47')]['limit']);_0x5ba50f[_0x5496('0x1b')]=qs['offset'](_0x30193e['query']['offset']);}return _0x5e2105['getAgents'](_0x5ba50f);}})['then'](function(_0x2db129){if(_0x2db129){return _0x2db129?{'count':_0x10a84b,'rows':_0x2db129}:null;}})[_0x5496('0xc')](respondWithResult(_0x537364,null))[_0x5496('0x17')](handleError(_0x537364,null));}; \ No newline at end of file +var _0x394d=['merge','VIRTUAL','options','MailAccount','includeAll','include','rows','params','mandatoryDispositionPause','find','body','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','order','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','getInteractions','CmContact','User','fullname','Tag','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','finally','sendStatus','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','sendMail','List','List\x20not\x20found','attach','format','out','messageId','VerifySmtp','verifySmtp','Sequelize','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','info','result','catch','status','json','offset','undefined','count','Content-Range','update','then','destroy','get','end','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter'];(function(_0x408935,_0xa9f47a){var _0x5e56a7=function(_0x1f1c4b){while(--_0x1f1c4b){_0x408935['push'](_0x408935['shift']());}};_0x5e56a7(++_0xa9f47a);}(_0x394d,0x12c));var _0xd394=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x394d[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require('moment');var BPromise=require(_0xd394('0x0'));var util=require(_0xd394('0x1'));var path=require(_0xd394('0x2'));var _=require('lodash');var juice=require(_0xd394('0x3'));var Redis=require(_0xd394('0x4'));var qs=require(_0xd394('0x5'));var logger=require(_0xd394('0x6'))(_0xd394('0x7'));var config=require(_0xd394('0x8'));var db=require(_0xd394('0x9'))['db'];config[_0xd394('0xa')]=_[_0xd394('0xb')](config[_0xd394('0xa')],{'host':_0xd394('0xc'),'port':0x18eb});var socket=require(_0xd394('0xd'))(new Redis(config[_0xd394('0xa')]));require(_0xd394('0xe'))[_0xd394('0xf')](socket);var jayson=require(_0xd394('0x10'));var client=jayson[_0xd394('0x11')][_0xd394('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x1f98d3,_0x13171f,_0x3bbe28,_0x2729a5){return new BPromise(function(_0x57d71b,_0x427160){var _0x45f4d3=_0x2729a5||client;return _0x45f4d3['request'](_0x1f98d3,_0x3bbe28)['then'](function(_0x12e953){logger['info']('MailAccount,\x20%s,\x20%s',_0x13171f,'request\x20sent');logger['debug'](_0xd394('0x13'),_0x13171f,_0xd394('0x14'),JSON[_0xd394('0x15')](_0x12e953));if(_0x12e953[_0xd394('0x16')]){if(_0x12e953[_0xd394('0x16')][_0xd394('0x17')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x13171f,_0x12e953[_0xd394('0x16')][_0xd394('0x18')]);return _0x427160(_0x12e953[_0xd394('0x16')]['message']);}logger['error'](_0xd394('0x19'),_0x13171f,_0x12e953[_0xd394('0x16')][_0xd394('0x18')]);return _0x57d71b(_0x12e953[_0xd394('0x16')][_0xd394('0x18')]);}else{logger[_0xd394('0x1a')]('MailAccount,\x20%s,\x20%s',_0x13171f,_0xd394('0x14'));_0x57d71b(_0x12e953[_0xd394('0x1b')]['message']);}})[_0xd394('0x1c')](function(_0x38289d){logger[_0xd394('0x16')]('MailAccount,\x20%s,\x20%s',_0x13171f,_0x38289d);_0x427160(_0x38289d);});});}function respondWithStatusCode(_0x32fca6,_0x465047){_0x465047=_0x465047||0xcc;return function(_0x4aee91){if(_0x4aee91){return _0x32fca6['sendStatus'](_0x465047);}return _0x32fca6[_0xd394('0x1d')](_0x465047)['end']();};}function respondWithResult(_0x503ac6,_0x580f2b){_0x580f2b=_0x580f2b||0xc8;return function(_0x3998d4){if(_0x3998d4){return _0x503ac6['status'](_0x580f2b)[_0xd394('0x1e')](_0x3998d4);}};}function respondWithFilteredResult(_0x401ecc,_0x1712ea){return function(_0x451e2e){if(_0x451e2e){var _0x38bb31=typeof _0x1712ea[_0xd394('0x1f')]===_0xd394('0x20')&&typeof _0x1712ea['limit']===_0xd394('0x20');var _0x14a7d9=_0x451e2e[_0xd394('0x21')];var _0x1502fc=_0x38bb31?0x0:_0x1712ea[_0xd394('0x1f')];var _0x42b4cb=_0x38bb31?_0x451e2e[_0xd394('0x21')]:_0x1712ea[_0xd394('0x1f')]+_0x1712ea['limit'];var _0xd10b53;if(_0x42b4cb>=_0x14a7d9){_0x42b4cb=_0x14a7d9;_0xd10b53=0xc8;}else{_0xd10b53=0xce;}_0x401ecc[_0xd394('0x1d')](_0xd10b53);return _0x401ecc['set'](_0xd394('0x22'),_0x1502fc+'-'+_0x42b4cb+'/'+_0x14a7d9)['json'](_0x451e2e);}return null;};}function saveUpdates(_0x33f8da){return function(_0x2192d4){if(_0x2192d4){return _0x2192d4[_0xd394('0x23')](_0x33f8da)[_0xd394('0x24')](function(_0x57adf6){return _0x57adf6;});}return null;};}function removeEntity(_0x298bf5){return function(_0x398c79){if(_0x398c79){return _0x398c79[_0xd394('0x25')]()[_0xd394('0x24')](function(){var _0x39a7f1=_0x398c79[_0xd394('0x26')]({'plain':!![]});var _0x41d97c='MailAccounts';return db['UserProfileResource'][_0xd394('0x25')]({'where':{'type':_0x41d97c,'resourceId':_0x39a7f1['id']}})[_0xd394('0x24')](function(){return _0x398c79;});})[_0xd394('0x24')](function(){_0x298bf5['status'](0xcc)[_0xd394('0x27')]();});}};}function handleEntityNotFound(_0x9c5d01){return function(_0x194ab1){if(!_0x194ab1){_0x9c5d01['sendStatus'](0x194);}return _0x194ab1;};}function handleError(_0x220b0a,_0x27cf88){_0x27cf88=_0x27cf88||0x1f4;return function(_0x5e6bd5){logger[_0xd394('0x16')](_0x5e6bd5['stack']);if(_0x5e6bd5[_0xd394('0x28')]){delete _0x5e6bd5[_0xd394('0x28')];}_0x220b0a['status'](_0x27cf88)[_0xd394('0x29')](_0x5e6bd5);};}function getImapHost(_0x2f273d){switch(_0x2f273d){case _0xd394('0x2a'):return _0xd394('0x2b');case _0xd394('0x2c'):return'imap.mail.yahoo.com';case _0xd394('0x2d'):return _0xd394('0x2e');case _0xd394('0x2f'):return'outlook.office365.com';}throw new Error(_0xd394('0x30'),_0x2f273d);}function getSmtpHost(_0x3cfe55){switch(_0x3cfe55){case _0xd394('0x2a'):return _0xd394('0x31');case _0xd394('0x2c'):return _0xd394('0x32');case _0xd394('0x2d'):return _0xd394('0x33');case _0xd394('0x2f'):return _0xd394('0x34');}throw new Error(_0xd394('0x30'),_0x3cfe55);}function getAuthenticationOptions(_0x483b29,_0x3bf52f){var _0x5c5c15={};var _0x4f4cb2={};if(_0x483b29){_0x5c5c15[_0xd394('0x35')]=_0x4f4cb2[_0xd394('0x35')]=_0x3bf52f[_0xd394('0x36')];_0x5c5c15['password']=_0x4f4cb2[_0xd394('0x37')]=_0x3bf52f[_0xd394('0x38')];if(_0x3bf52f[_0xd394('0x39')]){_0x5c5c15[_0xd394('0x39')]=_0x4f4cb2[_0xd394('0x39')]=!![];_0x5c5c15[_0xd394('0x3a')]=_0x4f4cb2[_0xd394('0x3a')]=_0x3bf52f[_0xd394('0x3a')];_0x5c5c15[_0xd394('0x38')]=_0x4f4cb2['pass']=null;}else{_0x5c5c15[_0xd394('0x3a')]=_0x4f4cb2[_0xd394('0x3a')]=null;}_0x5c5c15['host']=getImapHost(_0x483b29);_0x5c5c15[_0xd394('0x3b')]=0x3e1;_0x4f4cb2[_0xd394('0x3c')]=getSmtpHost(_0x483b29);_0x4f4cb2[_0xd394('0x3b')]=0x24b;_0x4f4cb2['secure']=![];_0x5c5c15[_0xd394('0x3d')]=_0x4f4cb2['service']=null;}else{if(_0x3bf52f[_0xd394('0x3e')]){_0x5c5c15[_0xd394('0x35')]=_0x4f4cb2['user']=_0x3bf52f[_0xd394('0x36')];_0x5c5c15['password']=_0x4f4cb2[_0xd394('0x37')]=_0x3bf52f[_0xd394('0x38')];}else{_0x5c5c15[_0xd394('0x3e')]=_0x4f4cb2[_0xd394('0x3e')]=![];_0x5c5c15[_0xd394('0x35')]=_0x4f4cb2[_0xd394('0x35')]=null;_0x5c5c15[_0xd394('0x38')]=_0x4f4cb2[_0xd394('0x37')]=null;}_0x5c5c15[_0xd394('0x3c')]=_0x3bf52f[_0xd394('0x3f')][_0xd394('0x3c')];_0x5c5c15[_0xd394('0x3b')]=_0x3bf52f[_0xd394('0x3f')][_0xd394('0x3b')];_0x4f4cb2[_0xd394('0x3c')]=_0x3bf52f[_0xd394('0x40')]['host'];_0x4f4cb2[_0xd394('0x3b')]=_0x3bf52f[_0xd394('0x40')][_0xd394('0x3b')];}return{'Imap':_0x5c5c15,'Smtp':_0x4f4cb2};}exports[_0xd394('0x41')]=function(_0x2618dc,_0x50dd81){var _0x463322={'include':[{'model':db[_0xd394('0x42')],'as':'Imap'},{'model':db[_0xd394('0x43')],'as':_0xd394('0x40')},{'model':db[_0xd394('0x44')],'as':'mandatoryDispositionPause'}]},_0x413291={},_0x2bc7e4={'count':0x0,'rows':[]};var _0x2ebfc3=_['map'](db['MailAccount'][_0xd394('0x45')],function(_0x31e5da){return{'name':_0x31e5da[_0xd394('0x46')],'type':_0x31e5da[_0xd394('0x47')][_0xd394('0x48')]};});_0x413291[_0xd394('0x49')]=_[_0xd394('0x4a')](_0x2ebfc3,_0xd394('0x28'));_0x413291[_0xd394('0x4b')]=_[_0xd394('0x4c')](_0x2618dc['query']);_0x413291[_0xd394('0x4d')]=_[_0xd394('0x4e')](_0x413291['model'],_0x413291[_0xd394('0x4b')]);_0x463322['attributes']=_['intersection'](_0x413291[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x2618dc[_0xd394('0x4b')][_0xd394('0x4f')]));_0x463322[_0xd394('0x50')]=_0x463322[_0xd394('0x50')][_0xd394('0x51')]?_0x463322[_0xd394('0x50')]:_0x413291[_0xd394('0x49')];if(!_0x2618dc[_0xd394('0x4b')][_0xd394('0x52')](_0xd394('0x53'))){_0x463322[_0xd394('0x54')]=qs[_0xd394('0x54')](_0x2618dc[_0xd394('0x4b')][_0xd394('0x54')]);_0x463322['offset']=qs[_0xd394('0x1f')](_0x2618dc[_0xd394('0x4b')][_0xd394('0x1f')]);}_0x463322['order']=qs[_0xd394('0x55')](_0x2618dc['query'][_0xd394('0x55')]);_0x463322[_0xd394('0x56')]=qs['filters'](_['pick'](_0x2618dc[_0xd394('0x4b')],_0x413291[_0xd394('0x4d')]),_0x2ebfc3);if(_0x2618dc[_0xd394('0x4b')][_0xd394('0x57')]){_0x463322['where']=_[_0xd394('0x58')](_0x463322[_0xd394('0x56')],{'$or':_['map'](_0x2ebfc3,function(_0x246ef0){if(_0x246ef0[_0xd394('0x47')]!==_0xd394('0x59')){var _0x5dcadd={};_0x5dcadd[_0x246ef0['name']]={'$like':'%'+_0x2618dc[_0xd394('0x4b')]['filter']+'%'};return _0x5dcadd;}})});}_0x463322=_[_0xd394('0x58')]({},_0x463322,_0x2618dc[_0xd394('0x5a')]);var _0x14f489={'where':_0x463322['where']};return db[_0xd394('0x5b')][_0xd394('0x21')](_0x14f489)[_0xd394('0x24')](function(_0x54e19d){_0x2bc7e4['count']=_0x54e19d;if(_0x2618dc[_0xd394('0x4b')][_0xd394('0x5c')]){_0x463322[_0xd394('0x5d')]=[{'all':!![]}];}return db[_0xd394('0x5b')]['findAll'](_0x463322);})[_0xd394('0x24')](function(_0x466ebb){_0x2bc7e4[_0xd394('0x5e')]=_0x466ebb;return _0x2bc7e4;})[_0xd394('0x24')](respondWithFilteredResult(_0x50dd81,_0x463322))[_0xd394('0x1c')](handleError(_0x50dd81,null));};exports['show']=function(_0x44648d,_0x3ae16a){var _0x1e66d6={'raw':![],'where':{'id':_0x44648d[_0xd394('0x5f')]['id']},'include':[{'model':db[_0xd394('0x42')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xd394('0x40')},{'model':db[_0xd394('0x44')],'as':_0xd394('0x60')}]},_0x10116e={};_0x10116e[_0xd394('0x49')]=_[_0xd394('0x4c')](db['MailAccount'][_0xd394('0x45')]);_0x10116e[_0xd394('0x4b')]=_[_0xd394('0x4c')](_0x44648d[_0xd394('0x4b')]);_0x10116e['filters']=_[_0xd394('0x4e')](_0x10116e[_0xd394('0x49')],_0x10116e['query']);_0x1e66d6[_0xd394('0x50')]=_['intersection'](_0x10116e[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x44648d[_0xd394('0x4b')][_0xd394('0x4f')]));_0x1e66d6['attributes']=_0x1e66d6[_0xd394('0x50')][_0xd394('0x51')]?_0x1e66d6['attributes']:_0x10116e[_0xd394('0x49')];if(_0x44648d[_0xd394('0x4b')][_0xd394('0x5c')]){_0x1e66d6[_0xd394('0x5d')]=[{'all':!![]}];}_0x1e66d6=_[_0xd394('0x58')]({},_0x1e66d6,_0x44648d['options']);return db[_0xd394('0x5b')][_0xd394('0x61')](_0x1e66d6)['then'](handleEntityNotFound(_0x3ae16a,null))[_0xd394('0x24')](respondWithResult(_0x3ae16a,null))[_0xd394('0x1c')](handleError(_0x3ae16a,null));};exports[_0xd394('0x23')]=function(_0x54b885,_0x1deca0){if(_0x54b885['body']['id']){delete _0x54b885['body']['id'];}var _0x487a5b=_0x54b885[_0xd394('0x62')][_0xd394('0x63')]==='custom'?null:_0x54b885[_0xd394('0x62')][_0xd394('0x63')];var _0x5e054c=_0x54b885['body'][_0xd394('0x3f')]||{};var _0x1a1ac4=_0x54b885[_0xd394('0x62')]['Smtp']||{};if(_0x487a5b){_0x5e054c[_0xd394('0x3c')]=getImapHost(_0x487a5b);_0x5e054c['port']=0x3e1;_0x1a1ac4['host']=getSmtpHost(_0x487a5b);_0x1a1ac4['port']=0x24b;_0x1a1ac4[_0xd394('0x64')]=![];}if(_0x1a1ac4[_0xd394('0x39')]){_0x1a1ac4[_0xd394('0x64')]=![];}else{_0x1a1ac4['CloudProviderId']=null;}if(!_0x5e054c[_0xd394('0x39')])_0x5e054c['CloudProviderId']=null;_0x54b885['body'][_0xd394('0x3f')]=_0x5e054c;_0x54b885[_0xd394('0x62')][_0xd394('0x40')]=_0x1a1ac4;return db[_0xd394('0x5b')][_0xd394('0x61')]({'where':{'id':_0x54b885[_0xd394('0x5f')]['id']},'include':[{'model':db[_0xd394('0x42')],'as':_0xd394('0x3f')},{'model':db['MailServerOut'],'as':_0xd394('0x40')},{'model':db[_0xd394('0x44')],'as':_0xd394('0x60')}]})[_0xd394('0x24')](handleEntityNotFound(_0x1deca0,null))[_0xd394('0x24')](function(_0x599fb1){if(!_0x599fb1)throw new Error(_0xd394('0x65'));if(_0x599fb1[_0xd394('0x3d')])delete _0x54b885[_0xd394('0x62')][_0xd394('0x3f')];return _0x599fb1;})[_0xd394('0x24')](saveUpdates(_0x54b885[_0xd394('0x62')],null))[_0xd394('0x24')](function(_0x374541){if(!_0x54b885['body']['Imap'])return _0x374541;return db[_0xd394('0x42')][_0xd394('0x23')](_0x54b885['body']['Imap'],{'where':{'MailAccountId':_0x374541['id']}})['then'](function(){return _0x374541;});})['then'](function(_0x597907){if(!_0x54b885['body'][_0xd394('0x40')])return _0x597907;return db[_0xd394('0x43')][_0xd394('0x23')](_0x54b885[_0xd394('0x62')][_0xd394('0x40')],{'where':{'MailAccountId':_0x597907['id']}})[_0xd394('0x24')](function(){return _0x597907;});})[_0xd394('0x24')](respondWithResult(_0x1deca0,null))['catch'](handleError(_0x1deca0,null));};exports['describe']=function(_0x653185,_0x1fa852){return db[_0xd394('0x5b')][_0xd394('0x66')]()[_0xd394('0x24')](respondWithResult(_0x1fa852,null))['catch'](handleError(_0x1fa852,null));};exports[_0xd394('0x67')]=function(_0x31126b,_0x11e060){if(_0x31126b[_0xd394('0x62')]['id']){delete _0x31126b[_0xd394('0x62')]['id'];}return db[_0xd394('0x5b')][_0xd394('0x61')]({'where':{'id':_0x31126b[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x11e060,null))['then'](function(_0x4d8f80){if(_0x4d8f80){_0x31126b[_0xd394('0x62')][_0xd394('0x68')]=_0x4d8f80['id'];return db[_0xd394('0x69')][_0xd394('0x6a')](_0x31126b[_0xd394('0x62')]);}})[_0xd394('0x24')](respondWithResult(_0x11e060,null))[_0xd394('0x1c')](handleError(_0x11e060,null));};exports[_0xd394('0x6b')]=function(_0x27bf30,_0xeb6074){var _0x47760a={'raw':![],'where':{}};var _0x1bb0d3={};var _0x2c0c89={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x27bf30[_0xd394('0x5f')]['id']}})['then'](handleEntityNotFound(_0xeb6074,null))[_0xd394('0x24')](function(_0x4d82c7){if(_0x4d82c7){_0x1bb0d3[_0xd394('0x49')]=_['keys'](db[_0xd394('0x69')]['rawAttributes']);_0x1bb0d3[_0xd394('0x4b')]=_[_0xd394('0x4c')](_0x27bf30[_0xd394('0x4b')]);_0x1bb0d3[_0xd394('0x4d')]=_['intersection'](_0x1bb0d3[_0xd394('0x49')],_0x1bb0d3[_0xd394('0x4b')]);_0x47760a['attributes']=_['intersection'](_0x1bb0d3[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x27bf30[_0xd394('0x4b')][_0xd394('0x4f')]));_0x47760a['attributes']=_0x47760a[_0xd394('0x50')][_0xd394('0x51')]?_0x47760a[_0xd394('0x50')]:_0x1bb0d3['model'];if(!_0x27bf30[_0xd394('0x4b')][_0xd394('0x52')](_0xd394('0x53'))){_0x47760a[_0xd394('0x54')]=qs[_0xd394('0x54')](_0x27bf30[_0xd394('0x4b')][_0xd394('0x54')]);_0x47760a[_0xd394('0x1f')]=qs['offset'](_0x27bf30['query'][_0xd394('0x1f')]);}_0x47760a[_0xd394('0x6c')]=qs['sort'](_0x27bf30[_0xd394('0x4b')]['sort']);_0x47760a[_0xd394('0x56')]=qs['filters'](_[_0xd394('0x6d')](_0x27bf30['query'],_0x1bb0d3[_0xd394('0x4d')]));_0x47760a[_0xd394('0x56')][_0xd394('0x68')]=_0x4d82c7['id'];if(_0x27bf30[_0xd394('0x4b')]['filter']){_0x47760a[_0xd394('0x56')]=_[_0xd394('0x58')](_0x47760a[_0xd394('0x56')],{'$or':_[_0xd394('0x4a')](_0x47760a[_0xd394('0x50')],function(_0x5828db){var _0xf5d12={};_0xf5d12[_0x5828db]={'$like':'%'+_0x27bf30[_0xd394('0x4b')][_0xd394('0x57')]+'%'};return _0xf5d12;})});}_0x47760a=_[_0xd394('0x58')]({},_0x47760a,_0x27bf30[_0xd394('0x5a')]);return db[_0xd394('0x69')][_0xd394('0x21')]({'where':_0x47760a[_0xd394('0x56')]})['then'](function(_0x5a1a36){_0x2c0c89[_0xd394('0x21')]=_0x5a1a36;if(_0x27bf30[_0xd394('0x4b')][_0xd394('0x5c')]){_0x47760a[_0xd394('0x5d')]=[{'all':!![]}];}return db[_0xd394('0x69')][_0xd394('0x6e')](_0x47760a);})['then'](function(_0x239cc4){_0x2c0c89['rows']=_0x239cc4;return _0x2c0c89;});}})['then'](respondWithFilteredResult(_0xeb6074,_0x47760a))['catch'](handleError(_0xeb6074,null));};exports[_0xd394('0x6f')]=function(_0x2354ee,_0x1a9ad8){return db['MailAccount'][_0xd394('0x61')]({'where':{'id':_0x2354ee[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x1a9ad8,null))[_0xd394('0x24')](function(_0xb4d5c9){if(_0xb4d5c9){return _0xb4d5c9['removeDispositions'](_0x2354ee[_0xd394('0x4b')][_0xd394('0x70')]);}})[_0xd394('0x24')](respondWithStatusCode(_0x1a9ad8,null))[_0xd394('0x1c')](handleError(_0x1a9ad8,null));};exports['addAnswer']=function(_0x242157,_0x495cec){if(_0x242157[_0xd394('0x62')]['id']){delete _0x242157[_0xd394('0x62')]['id'];}return db['MailAccount'][_0xd394('0x61')]({'where':{'id':_0x242157['params']['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x495cec,null))[_0xd394('0x24')](function(_0x30523d){if(_0x30523d){_0x242157['body'][_0xd394('0x68')]=_0x30523d['id'];return db[_0xd394('0x71')][_0xd394('0x6a')](_0x242157[_0xd394('0x62')]);}})[_0xd394('0x24')](respondWithResult(_0x495cec,null))[_0xd394('0x1c')](handleError(_0x495cec,null));};exports[_0xd394('0x72')]=function(_0x454054,_0x28a57b){var _0x7683cb={'raw':![],'where':{}};var _0x468720={};var _0x21fda5={'count':0x0,'rows':[]};return db[_0xd394('0x5b')][_0xd394('0x73')]({'where':{'id':_0x454054['params']['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x28a57b,null))[_0xd394('0x24')](function(_0xa187e){if(_0xa187e){_0x468720[_0xd394('0x49')]=_[_0xd394('0x4c')](db[_0xd394('0x71')]['rawAttributes']);_0x468720['query']=_[_0xd394('0x4c')](_0x454054[_0xd394('0x4b')]);_0x468720['filters']=_['intersection'](_0x468720[_0xd394('0x49')],_0x468720['query']);_0x7683cb[_0xd394('0x50')]=_[_0xd394('0x4e')](_0x468720[_0xd394('0x49')],qs['fields'](_0x454054[_0xd394('0x4b')][_0xd394('0x4f')]));_0x7683cb[_0xd394('0x50')]=_0x7683cb[_0xd394('0x50')][_0xd394('0x51')]?_0x7683cb[_0xd394('0x50')]:_0x468720[_0xd394('0x49')];if(!_0x454054['query'][_0xd394('0x52')]('nolimit')){_0x7683cb[_0xd394('0x54')]=qs[_0xd394('0x54')](_0x454054[_0xd394('0x4b')][_0xd394('0x54')]);_0x7683cb[_0xd394('0x1f')]=qs[_0xd394('0x1f')](_0x454054[_0xd394('0x4b')][_0xd394('0x1f')]);}_0x7683cb[_0xd394('0x6c')]=qs[_0xd394('0x55')](_0x454054[_0xd394('0x4b')][_0xd394('0x55')]);_0x7683cb[_0xd394('0x56')]=qs['filters'](_[_0xd394('0x6d')](_0x454054['query'],_0x468720[_0xd394('0x4d')]));_0x7683cb[_0xd394('0x56')]['MailAccountId']=_0xa187e['id'];if(_0x454054['query'][_0xd394('0x57')]){_0x7683cb[_0xd394('0x56')]=_[_0xd394('0x58')](_0x7683cb[_0xd394('0x56')],{'$or':_[_0xd394('0x4a')](_0x7683cb[_0xd394('0x50')],function(_0x300928){var _0x45c93c={};_0x45c93c[_0x300928]={'$like':'%'+_0x454054['query'][_0xd394('0x57')]+'%'};return _0x45c93c;})});}_0x7683cb=_[_0xd394('0x58')]({},_0x7683cb,_0x454054[_0xd394('0x5a')]);return db[_0xd394('0x71')][_0xd394('0x21')]({'where':_0x7683cb[_0xd394('0x56')]})[_0xd394('0x24')](function(_0x148003){_0x21fda5[_0xd394('0x21')]=_0x148003;if(_0x454054[_0xd394('0x4b')][_0xd394('0x5c')]){_0x7683cb[_0xd394('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd394('0x6e')](_0x7683cb);})[_0xd394('0x24')](function(_0x3ac7d7){_0x21fda5['rows']=_0x3ac7d7;return _0x21fda5;});}})[_0xd394('0x24')](respondWithFilteredResult(_0x28a57b,_0x7683cb))['catch'](handleError(_0x28a57b,null));};exports[_0xd394('0x74')]=function(_0x3703c2,_0xbcb4eb){return db[_0xd394('0x5b')]['find']({'where':{'id':_0x3703c2[_0xd394('0x5f')]['id']}})['then'](handleEntityNotFound(_0xbcb4eb,null))[_0xd394('0x24')](function(_0x3fa1f0){if(_0x3fa1f0){return _0x3fa1f0[_0xd394('0x74')](_0x3703c2[_0xd394('0x4b')]['ids']);}})[_0xd394('0x24')](respondWithStatusCode(_0xbcb4eb,null))[_0xd394('0x1c')](handleError(_0xbcb4eb,null));};exports[_0xd394('0x6a')]=function(_0x32043d,_0x1df5d4){var _0x5f5553={'name':_0x32043d[_0xd394('0x62')][_0xd394('0x28')],'key':_0x32043d[_0xd394('0x62')][_0xd394('0x48')],'provider':_0x32043d[_0xd394('0x62')][_0xd394('0x63')]===_0xd394('0x75')?null:_0x32043d[_0xd394('0x62')]['provider'],'email':_0x32043d[_0xd394('0x62')][_0xd394('0x76')],'ListId':_0x32043d['body'][_0xd394('0x77')],'active':!_[_0xd394('0x78')](_0x32043d[_0xd394('0x62')]['active'])?_0x32043d[_0xd394('0x62')][_0xd394('0x79')]:!![],'description':_0x32043d['body'][_0xd394('0x7a')]||null};var _0x46a6f6=getAuthenticationOptions(_0x5f5553[_0xd394('0x63')],_0x32043d['body']);_0x5f5553[_0xd394('0x3f')]=_0x46a6f6[_0xd394('0x3f')];_0x5f5553[_0xd394('0x40')]=_0x46a6f6[_0xd394('0x40')];return db[_0xd394('0x5b')][_0xd394('0x6a')](_0x5f5553,{'include':[{'model':db[_0xd394('0x43')],'as':_0xd394('0x40')},{'model':db[_0xd394('0x42')],'as':'Imap'}]})[_0xd394('0x24')](function(_0x49f8a3){var _0x5e613b=_0x32043d['user'][_0xd394('0x26')]({'plain':!![]});if(!_0x5e613b)throw new Error(_0xd394('0x7b'));if(_0x5e613b['role']===_0xd394('0x35')){var _0x4c0550=_0x49f8a3[_0xd394('0x26')]({'plain':!![]});return db[_0xd394('0x7c')][_0xd394('0x61')]({'where':{'name':_0xd394('0x7d'),'userProfileId':_0x5e613b[_0xd394('0x7e')]},'raw':!![]})[_0xd394('0x24')](function(_0x1ce964){if(_0x1ce964&&_0x1ce964[_0xd394('0x7f')]===0x0){return db[_0xd394('0x80')][_0xd394('0x6a')]({'name':_0x4c0550[_0xd394('0x28')],'resourceId':_0x4c0550['id'],'type':_0x1ce964[_0xd394('0x28')],'sectionId':_0x1ce964['id']},{})[_0xd394('0x24')](function(){return _0x49f8a3;});}else{return _0x49f8a3;}})['catch'](function(_0x1badb6){logger[_0xd394('0x16')](_0xd394('0x81'),_0x1badb6);throw _0x1badb6;});}return _0x49f8a3;})[_0xd394('0x24')](respondWithResult(_0x1df5d4,0xc9))[_0xd394('0x1c')](handleError(_0x1df5d4,null));};exports[_0xd394('0x82')]=function(_0x4336a3,_0x20b931){return db[_0xd394('0x5b')][_0xd394('0x73')]({'where':{'id':_0x4336a3[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x20b931,null))['then'](function(_0x47c686){if(_0x47c686){return _0x47c686[_0xd394('0x82')]();}return null;})['then'](respondWithResult(_0x20b931,null))['catch'](handleError(_0x20b931,null));};exports[_0xd394('0x83')]=function(_0x21277b,_0x4ed26c){if(_0x21277b[_0xd394('0x62')]['id']){delete _0x21277b['body']['id'];}return db[_0xd394('0x5b')][_0xd394('0x61')]({'where':{'id':_0x21277b['params']['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x4ed26c,null))[_0xd394('0x24')](function(_0x477852){if(_0x477852){_0x21277b[_0xd394('0x62')][_0xd394('0x68')]=_0x477852['id'];return db[_0xd394('0x42')][_0xd394('0x6a')](_0x21277b[_0xd394('0x62')]);}})[_0xd394('0x24')](respondWithResult(_0x4ed26c,null))['catch'](handleError(_0x4ed26c,null));};exports[_0xd394('0x84')]=function(_0x2385b0,_0x4763bd){return db['MailAccount'][_0xd394('0x73')]({'where':{'id':_0x2385b0[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x4763bd,null))[_0xd394('0x24')](function(_0x4c1854){if(_0x4c1854){return _0x4c1854['setImap'](null);}return null;})[_0xd394('0x24')](respondWithStatusCode(_0x4763bd,null))[_0xd394('0x1c')](handleError(_0x4763bd,null));};exports[_0xd394('0x85')]=function(_0x32be1a,_0x13525f){return db['MailAccount'][_0xd394('0x73')]({'where':{'id':_0x32be1a[_0xd394('0x5f')]['id']}})['then'](handleEntityNotFound(_0x13525f,null))['then'](function(_0x11c8f9){if(_0x11c8f9){return _0x11c8f9[_0xd394('0x85')]();}return null;})[_0xd394('0x24')](respondWithResult(_0x13525f,null))['catch'](handleError(_0x13525f,null));};exports[_0xd394('0x86')]=function(_0x6d6c0e,_0x5391c2){if(_0x6d6c0e[_0xd394('0x62')]['id']){delete _0x6d6c0e['body']['id'];}return db[_0xd394('0x5b')]['find']({'where':{'id':_0x6d6c0e[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x5391c2,null))['then'](function(_0xd64553){if(_0xd64553){_0x6d6c0e[_0xd394('0x62')][_0xd394('0x68')]=_0xd64553['id'];return db[_0xd394('0x43')][_0xd394('0x6a')](_0x6d6c0e[_0xd394('0x62')]);}})[_0xd394('0x24')](respondWithResult(_0x5391c2,null))[_0xd394('0x1c')](handleError(_0x5391c2,null));};exports[_0xd394('0x87')]=function(_0x1a62d7,_0x1be81a){return db[_0xd394('0x5b')][_0xd394('0x73')]({'where':{'id':_0x1a62d7[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x1be81a,null))[_0xd394('0x24')](function(_0x354b7e){if(_0x354b7e){return _0x354b7e[_0xd394('0x88')](null);}return null;})[_0xd394('0x24')](respondWithStatusCode(_0x1be81a,null))[_0xd394('0x1c')](handleError(_0x1be81a,null));};exports['addInteraction']=function(_0x4c9e2c,_0x1d1f13){return db[_0xd394('0x89')][_0xd394('0x61')]({'where':{'id':_0x4c9e2c[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x1d1f13,null))[_0xd394('0x24')](function(_0x1951cd){if(_0x1951cd){return _0x1951cd['addInteraction'](_0x4c9e2c['body']['ids'],_['omit'](_0x4c9e2c[_0xd394('0x62')],[_0xd394('0x70'),'id'])||{});}})[_0xd394('0x24')](respondWithResult(_0x1d1f13,null))['catch'](handleError(_0x1d1f13,null));};exports[_0xd394('0x8a')]=function(_0x67ad22,_0x93cd5e){var _0x56b614={'raw':![],'where':{}};var _0x2b420f={};var _0x2351d={'count':0x0,'rows':[]};return db['MailAccount'][_0xd394('0x73')]({'where':{'id':_0x67ad22[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x93cd5e,null))['then'](function(_0xf125c2){if(_0xf125c2){_0x2b420f[_0xd394('0x49')]=_[_0xd394('0x4c')](db[_0xd394('0x89')][_0xd394('0x45')]);_0x2b420f[_0xd394('0x4b')]=_[_0xd394('0x4c')](_0x67ad22[_0xd394('0x4b')]);_0x2b420f[_0xd394('0x4d')]=_[_0xd394('0x4e')](_0x2b420f[_0xd394('0x49')],_0x2b420f['query']);_0x56b614[_0xd394('0x50')]=_[_0xd394('0x4e')](_0x2b420f[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x67ad22[_0xd394('0x4b')][_0xd394('0x4f')]));_0x56b614[_0xd394('0x50')]=_0x56b614['attributes'][_0xd394('0x51')]?_0x56b614[_0xd394('0x50')]:_0x2b420f['model'];if(!_0x67ad22[_0xd394('0x4b')][_0xd394('0x52')](_0xd394('0x53'))){_0x56b614[_0xd394('0x54')]=qs[_0xd394('0x54')](_0x67ad22[_0xd394('0x4b')][_0xd394('0x54')]);_0x56b614['offset']=qs['offset'](_0x67ad22['query'][_0xd394('0x1f')]);}_0x56b614[_0xd394('0x6c')]=qs[_0xd394('0x55')](_0x67ad22[_0xd394('0x4b')][_0xd394('0x55')]);_0x56b614[_0xd394('0x56')]=qs[_0xd394('0x4d')](_[_0xd394('0x6d')](_0x67ad22[_0xd394('0x4b')],_0x2b420f[_0xd394('0x4d')]));_0x56b614['where'][_0xd394('0x68')]=_0xf125c2['id'];if(_0x67ad22[_0xd394('0x4b')][_0xd394('0x57')]){_0x56b614['where']=_['merge'](_0x56b614['where'],{'$or':_['map'](_0x56b614[_0xd394('0x50')],function(_0x143010){var _0xa2b224={};_0xa2b224[_0x143010]={'$like':'%'+_0x67ad22[_0xd394('0x4b')][_0xd394('0x57')]+'%'};return _0xa2b224;})});}_0x56b614=_[_0xd394('0x58')]({},_0x56b614,_0x67ad22[_0xd394('0x5a')]);return db[_0xd394('0x89')][_0xd394('0x21')]({'where':_0x56b614[_0xd394('0x56')]})[_0xd394('0x24')](function(_0x4b6d13){_0x2351d[_0xd394('0x21')]=_0x4b6d13;if(_0x67ad22[_0xd394('0x4b')]['includeAll']){_0x56b614['include']=[{'model':db[_0xd394('0x8b')],'as':'Contact','required':![]},{'model':db[_0xd394('0x8c')],'as':'Owner','attributes':['name',_0xd394('0x8d'),'internal'],'required':![]},{'model':db[_0xd394('0x8e')],'as':'Tags','attributes':['id',_0xd394('0x28'),_0xd394('0x8f')],'where':_0x67ad22[_0xd394('0x4b')][_0xd394('0x90')]?{'id':_0x67ad22['query'][_0xd394('0x90')]}:undefined,'required':_0x67ad22[_0xd394('0x4b')][_0xd394('0x90')]?!![]:![]}];}return db[_0xd394('0x89')]['findAll'](_0x56b614);})[_0xd394('0x24')](function(_0x5e4ce9){_0x2351d[_0xd394('0x5e')]=_0x5e4ce9;return _0x2351d;});}})[_0xd394('0x24')](respondWithFilteredResult(_0x93cd5e,_0x56b614))[_0xd394('0x1c')](handleError(_0x93cd5e,null));};exports['addApplications']=function addApplications(_0x34fc00,_0x42ad01){var _0x5ae251=_0x34fc00[_0xd394('0x5f')]['id'];var _0x35124d=_0x34fc00[_0xd394('0x62')];var _0x3d02a1=0xc8;var _0x342533=null;return db['sequelize'][_0xd394('0x91')]({'isolationLevel':db[_0xd394('0x92')][_0xd394('0x93')][_0xd394('0x94')]['READ_COMMITTED']},function(_0x217eaa){return db['MailAccount'][_0xd394('0x73')]({'where':{'id':_0x5ae251},'transaction':_0x217eaa})['then'](function(_0x15b309){if(_0x15b309){return db[_0xd394('0x95')][_0xd394('0x25')]({'where':{'MailAccountId':_0x5ae251},'transaction':_0x217eaa})[_0xd394('0x24')](function(){var _0x21cbe1=_[_0xd394('0x4a')](_0x35124d,function(_0x41e3bd){_0x41e3bd[_0xd394('0x68')]=_0x5ae251;return _0x41e3bd;});return db[_0xd394('0x95')]['bulkCreate'](_0x21cbe1,{'transaction':_0x217eaa});});}else{_0x3d02a1=0x194;_0x342533=[];}});})['then'](function(){if(_0x3d02a1!==0x194){return db[_0xd394('0x95')][_0xd394('0x96')]({'where':{'MailAccountId':_0x5ae251},'order':_0xd394('0x97')})['then'](function(_0x442c1c){_0x342533=_0x442c1c;});}})[_0xd394('0x1c')](function(_0x4590b9){_0x3d02a1=0x1f4;logger[_0xd394('0x16')](_0x4590b9['stack']);if(_0x4590b9[_0xd394('0x28')]){delete _0x4590b9['name'];}_0x342533=_0x4590b9;})[_0xd394('0x98')](function(){if(_0x342533===null){_0x42ad01[_0xd394('0x99')](_0x3d02a1);}else{if(_0x3d02a1===0x1f4){_0x42ad01[_0xd394('0x1d')](_0x3d02a1)[_0xd394('0x29')](_0x342533);}else{_0x42ad01[_0xd394('0x1d')](_0x3d02a1)[_0xd394('0x1e')](_0x342533);}}});};exports[_0xd394('0x9a')]=function(_0x36ad61,_0x43701e){var _0x3457e3={};var _0x226c78={};var _0xfeae55;var _0x545c34;return db[_0xd394('0x5b')]['findOne']({'where':{'id':_0x36ad61[_0xd394('0x5f')]['id']}})['then'](handleEntityNotFound(_0x43701e,null))[_0xd394('0x24')](function(_0x3d5fb4){if(_0x3d5fb4){_0xfeae55=_0x3d5fb4;_0x226c78[_0xd394('0x49')]=_[_0xd394('0x4c')](db[_0xd394('0x95')]['rawAttributes']);_0x226c78['query']=_[_0xd394('0x4c')](_0x36ad61['query']);_0x226c78['filters']=_[_0xd394('0x4e')](_0x226c78['model'],_0x226c78[_0xd394('0x4b')]);_0x3457e3['attributes']=_[_0xd394('0x4e')](_0x226c78[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x36ad61[_0xd394('0x4b')][_0xd394('0x4f')]));_0x3457e3['attributes']=_0x3457e3['attributes'][_0xd394('0x51')]?_0x3457e3[_0xd394('0x50')]:_0x226c78[_0xd394('0x49')];_0x3457e3[_0xd394('0x6c')]=qs[_0xd394('0x55')](_0x36ad61[_0xd394('0x4b')]['sort']);_0x3457e3[_0xd394('0x56')]=qs[_0xd394('0x4d')](_[_0xd394('0x6d')](_0x36ad61[_0xd394('0x4b')],_0x226c78[_0xd394('0x4d')]));if(_0x36ad61['query']['filter']){_0x3457e3[_0xd394('0x56')]=_[_0xd394('0x58')](_0x3457e3[_0xd394('0x56')],{'$or':_[_0xd394('0x4a')](_0x3457e3['attributes'],function(_0x37db29){var _0x3e2992={};_0x3e2992[_0x37db29]={'$like':'%'+_0x36ad61['query'][_0xd394('0x57')]+'%'};return _0x3e2992;})});}_0x3457e3=_['merge']({},_0x3457e3,_0x36ad61['options']);return _0xfeae55[_0xd394('0x9a')](_0x3457e3);}})[_0xd394('0x24')](function(_0x38376d){if(_0x38376d){_0x545c34=_0x38376d['length'];if(!_0x36ad61[_0xd394('0x4b')][_0xd394('0x52')]('nolimit')){_0x3457e3[_0xd394('0x54')]=qs[_0xd394('0x54')](_0x36ad61[_0xd394('0x4b')]['limit']);_0x3457e3[_0xd394('0x1f')]=qs[_0xd394('0x1f')](_0x36ad61[_0xd394('0x4b')][_0xd394('0x1f')]);}return _0xfeae55[_0xd394('0x9a')](_0x3457e3);}})[_0xd394('0x24')](function(_0x208ca0){if(_0x208ca0){return _0x208ca0?{'count':_0x545c34,'rows':_0x208ca0}:null;}})[_0xd394('0x24')](respondWithResult(_0x43701e,null))[_0xd394('0x1c')](handleError(_0x43701e,null));};exports[_0xd394('0x9b')]=function(_0x445cc1,_0x3bbbf6){var _0x534cc3={'raw':!![],'where':{}};var _0x1f1fc9={};var _0xa70eeb={'count':0x0,'rows':[]};return db[_0xd394('0x5b')][_0xd394('0x73')]({'where':{'id':_0x445cc1['params']['id']}})['then'](handleEntityNotFound(_0x3bbbf6,null))[_0xd394('0x24')](function(_0x32008e){if(_0x32008e){_0x1f1fc9[_0xd394('0x49')]=_[_0xd394('0x4c')](db['MailMessage'][_0xd394('0x45')]);_0x1f1fc9['query']=_['keys'](_0x445cc1[_0xd394('0x4b')]);_0x1f1fc9['filters']=_[_0xd394('0x4e')](_0x1f1fc9[_0xd394('0x49')],_0x1f1fc9[_0xd394('0x4b')]);_0x534cc3[_0xd394('0x50')]=_['intersection'](_0x1f1fc9[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x445cc1['query'][_0xd394('0x4f')]));_0x534cc3[_0xd394('0x50')]=_0x534cc3[_0xd394('0x50')][_0xd394('0x51')]?_0x534cc3[_0xd394('0x50')]:_0x1f1fc9[_0xd394('0x49')];if(!_0x445cc1[_0xd394('0x4b')][_0xd394('0x52')](_0xd394('0x53'))){_0x534cc3[_0xd394('0x54')]=qs[_0xd394('0x54')](_0x445cc1[_0xd394('0x4b')]['limit']);_0x534cc3[_0xd394('0x1f')]=qs[_0xd394('0x1f')](_0x445cc1[_0xd394('0x4b')]['offset']);}_0x534cc3[_0xd394('0x6c')]=qs[_0xd394('0x55')](_0x445cc1[_0xd394('0x4b')][_0xd394('0x55')]);_0x534cc3[_0xd394('0x56')]=qs[_0xd394('0x4d')](_['pick'](_0x445cc1[_0xd394('0x4b')],_0x1f1fc9[_0xd394('0x4d')]));_0x534cc3[_0xd394('0x56')]['MailAccountId']=_0x32008e['id'];if(_0x445cc1[_0xd394('0x4b')][_0xd394('0x57')]){_0x534cc3[_0xd394('0x56')]=_['merge'](_0x534cc3['where'],{'$or':_[_0xd394('0x4a')](_0x534cc3['attributes'],function(_0x51d742){var _0x565758={};_0x565758[_0x51d742]={'$like':'%'+_0x445cc1['query'][_0xd394('0x57')]+'%'};return _0x565758;})});}if(_0x445cc1[_0xd394('0x4b')][_0xd394('0x9c')]){var _0xe1b869=_0x445cc1[_0xd394('0x4b')][_0xd394('0x9c')][_0xd394('0x9d')](',');var _0x5ec6a0={};_0x5ec6a0[_0xe1b869[0x0]]={'$gte':moment(_0xe1b869[0x1])['format'](_0xd394('0x9e'))};_0x534cc3['where']=_[_0xd394('0x58')](_0x534cc3['where'],_0x5ec6a0);}_0x534cc3=_[_0xd394('0x58')]({},_0x534cc3,_0x445cc1['options']);return db[_0xd394('0x9f')][_0xd394('0x21')]({'where':_0x534cc3[_0xd394('0x56')]})['then'](function(_0x18f409){_0xa70eeb[_0xd394('0x21')]=_0x18f409;if(_0x445cc1[_0xd394('0x4b')][_0xd394('0x5c')]){_0x534cc3[_0xd394('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0xd394('0x6e')](_0x534cc3);})['then'](function(_0x293b98){if(_0x445cc1[_0xd394('0x4b')][_0xd394('0xa0')]===_0xd394('0xa1')){for(var _0x58a0f0=0x0;_0x58a0f0<_0x293b98[_0xd394('0x51')];_0x58a0f0++){_0x293b98[_0x58a0f0][_0xd394('0x62')]=juice(_0x293b98[_0x58a0f0]['body']);}}_0xa70eeb[_0xd394('0x5e')]=_0x293b98;return _0xa70eeb;});}})[_0xd394('0x24')](respondWithFilteredResult(_0x3bbbf6,_0x534cc3))[_0xd394('0x1c')](handleError(_0x3bbbf6,null));};exports[_0xd394('0x29')]=function(_0x16b587,_0xb185bc){var _0x193ed8,_0x38bafd={},_0x57e813;if(_0x16b587['body']['to']){_0x57e813=_0x16b587[_0xd394('0x62')]['to'][_0xd394('0x9d')](',')[0x0];}return db[_0xd394('0x5b')][_0xd394('0x61')]({'where':{'id':_0x16b587[_0xd394('0x5f')]['id']},'include':[{'model':db[_0xd394('0xa2')],'as':'List','include':[{'model':db[_0xd394('0x8b')],'as':_0xd394('0xa3'),'where':{'email':_0x57e813},'limit':0x1,'order':[['updatedAt',_0xd394('0xa4')]]}]},{'model':db[_0xd394('0x43')],'as':_0xd394('0x40'),'raw':!![],'include':[{'model':db[_0xd394('0xa5')],'as':_0xd394('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xb185bc,null))[_0xd394('0x24')](function(_0x58e7e7){if(!_0x58e7e7)return;_0x193ed8=_0x58e7e7;if(!_0x58e7e7[_0xd394('0x40')])throw new Error(_0xd394('0xa6'));if(_[_0xd394('0x78')](_0x16b587[_0xd394('0x62')][_0xd394('0xa7')])){_0x16b587[_0xd394('0x62')][_0xd394('0xa7')]=util['format'](_0xd394('0xa8'),_0x58e7e7[_0xd394('0x28')],_0x58e7e7[_0xd394('0x76')]||_0x58e7e7[_0xd394('0x40')]['user']);}if(_0x16b587['body'][_0xd394('0xa9')]&&_0x16b587[_0xd394('0x62')][_0xd394('0xa9')][_0xd394('0x51')]){for(var _0x24cc32=0x0;_0x24cc32<_0x16b587['body'][_0xd394('0xa9')][_0xd394('0x51')];_0x24cc32+=0x1){_0x16b587['body']['attachments'][_0x24cc32]={'filename':_0x16b587[_0xd394('0x62')]['attachments'][_0x24cc32][_0xd394('0x28')],'path':path['join'](config[_0xd394('0xaa')],_0xd394('0xab'),_0x16b587[_0xd394('0x62')][_0xd394('0xa9')][_0x24cc32][_0xd394('0xac')])};}}var _0x2973b7=_0x58e7e7[_0xd394('0xad')]();return respondWithRpcPromise('SendMail',_0xd394('0xae'),{'account':_0x2973b7,'message':_0x16b587[_0xd394('0x62')]});})[_0xd394('0x24')](function(_0x5b1036){if(!_0x5b1036)return;_0x38bafd=_0x5b1036;if(!_0x193ed8[_0xd394('0xaf')])throw new Error(_0xd394('0xb0'));if(_0x193ed8[_0xd394('0xaf')][_0xd394('0xa3')][_0xd394('0x51')])return _0x193ed8[_0xd394('0xaf')][_0xd394('0xa3')][0x0];return db[_0xd394('0x8b')]['create'](_[_0xd394('0xb')](_0x16b587[_0xd394('0x62')],{'firstName':_0x16b587[_0xd394('0x62')]['to'],'email':_0x16b587['body']['to'],'phone':_0x16b587[_0xd394('0x62')]['to'],'ListId':_0x193ed8[_0xd394('0x77')]}));})[_0xd394('0x24')](function(_0x3fe4fa){if(!_0x3fe4fa)return;var _0x2e9c7c={'UserId':_0x16b587[_0xd394('0x35')]['id'],'ContactId':_0x3fe4fa['id'],'MailAccountId':_0x193ed8['id'],'inReplyTo':_0x38bafd['messageId'],'to':_0x16b587[_0xd394('0x62')][_0xd394('0xa7')],'cc':_0x16b587[_0xd394('0x62')]['cc'],'subject':_0x16b587[_0xd394('0x62')]['subject'],'attach':_0x16b587['body'][_0xd394('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xd394('0xb2')](_0xd394('0x9e')),'lastMsgDirection':_0xd394('0xb3'),'Messages':[_[_0xd394('0x58')](_0x16b587[_0xd394('0x62')],{'messageId':_0x38bafd[_0xd394('0xb4')],'sentAt':moment()[_0xd394('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x193ed8['id'],'UserId':_0x16b587['user']['id'],'ContactId':_0x3fe4fa['id']})]};if(_0x16b587[_0xd394('0x62')]['Interaction']){_0x2e9c7c=_['merge'](_0x2e9c7c,_0x16b587[_0xd394('0x62')]['Interaction']);}return db[_0xd394('0x89')][_0xd394('0x6a')](_0x2e9c7c,{'include':[{'model':db[_0xd394('0x9f')],'as':'Messages'}]});})['then'](respondWithResult(_0xb185bc,null))[_0xd394('0x1c')](handleError(_0xb185bc,null));};exports['verifySmtp']=function(_0x5281f5,_0x2dfcd6){return db[_0xd394('0x5b')]['find']({'where':{'id':_0x5281f5[_0xd394('0x5f')]['id']},'include':[{'model':db[_0xd394('0x43')],'as':_0xd394('0x40'),'raw':!![],'include':[{'model':db[_0xd394('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0xd394('0x24')](handleEntityNotFound(_0x2dfcd6,null))[_0xd394('0x24')](function(_0x258cac){if(!_0x258cac[_0xd394('0x40')])return;var _0x5709dc=_0x258cac[_0xd394('0xad')]();return respondWithRpcPromise(_0xd394('0xb5'),_0xd394('0xb6'),{'account':_0x5709dc});})[_0xd394('0x24')](respondWithResult(_0x2dfcd6,null))['catch'](handleError(_0x2dfcd6,null));};exports[_0xd394('0x25')]=function(_0x30a41b,_0x33d632){return db[_0xd394('0x5b')]['find']({'where':{'id':_0x30a41b[_0xd394('0x5f')]['id']}})['then'](handleEntityNotFound(_0x33d632,null))['then'](function(_0x27d6fc){if(_0x27d6fc&&_0x27d6fc[_0xd394('0x3d')]){throw new db[(_0xd394('0xb7'))][(_0xd394('0xb8'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x27d6fc;})[_0xd394('0x24')](removeEntity(_0x33d632,null))['catch'](handleError(_0x33d632,null));};exports[_0xd394('0xb9')]=function(_0x28de5d,_0x34132a){return db[_0xd394('0x5b')][_0xd394('0x61')]({'where':{'id':_0x28de5d[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x34132a,null))[_0xd394('0x24')](function(_0x32df51){if(_0x32df51){return _0x32df51[_0xd394('0xb9')](_0x28de5d['body'][_0xd394('0x70')],_[_0xd394('0xba')](_0x28de5d[_0xd394('0x62')],[_0xd394('0x70'),'id'])||{})[_0xd394('0xbb')](function(_0x3b7674){for(var _0x1c2085=0x0;_0x1c2085<_0x28de5d['body'][_0xd394('0x70')][_0xd394('0x51')];_0x1c2085+=0x1){socket[_0xd394('0xbc')](_0xd394('0xbd'),{'UserId':Number(_0x28de5d[_0xd394('0x62')][_0xd394('0x70')][_0x1c2085]),'MailAccountId':Number(_0x28de5d[_0xd394('0x5f')]['id'])});}return _0x3b7674;});}})[_0xd394('0x24')](respondWithResult(_0x34132a,null))['catch'](handleError(_0x34132a,null));};exports['removeAgents']=function(_0x1a0533,_0xb0611e){return db['MailAccount'][_0xd394('0x61')]({'where':{'id':_0x1a0533[_0xd394('0x5f')]['id']}})['then'](handleEntityNotFound(_0xb0611e,null))[_0xd394('0x24')](function(_0x52c623){if(_0x52c623){return _0x52c623[_0xd394('0xbe')](_0x1a0533[_0xd394('0x4b')]['ids'])[_0xd394('0x24')](function(){if(_[_0xd394('0xbf')](_0x1a0533['query'][_0xd394('0x70')])){for(var _0x521a6d=0x0;_0x521a6d<_0x1a0533[_0xd394('0x4b')][_0xd394('0x70')][_0xd394('0x51')];_0x521a6d+=0x1){socket['emit'](_0xd394('0xc0'),{'UserId':Number(_0x1a0533[_0xd394('0x4b')][_0xd394('0x70')][_0x521a6d]),'MailAccountId':Number(_0x1a0533[_0xd394('0x5f')]['id'])});}}else{socket[_0xd394('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x1a0533['query'][_0xd394('0x70')]),'MailAccountId':Number(_0x1a0533[_0xd394('0x5f')]['id'])});}});}})[_0xd394('0x24')](respondWithStatusCode(_0xb0611e,null))[_0xd394('0x1c')](handleError(_0xb0611e,null));};exports[_0xd394('0xc1')]=function(_0x3f9275,_0x1df521){var _0xdd54b1={};var _0x2a066b={};var _0x4c3fd5;var _0x5a5f25;return db[_0xd394('0x5b')]['findOne']({'where':{'id':_0x3f9275[_0xd394('0x5f')]['id']}})[_0xd394('0x24')](handleEntityNotFound(_0x1df521,null))[_0xd394('0x24')](function(_0x3466ce){if(_0x3466ce){_0x4c3fd5=_0x3466ce;_0x2a066b[_0xd394('0x49')]=_[_0xd394('0x4c')](db[_0xd394('0x8c')][_0xd394('0x45')]);_0x2a066b[_0xd394('0x4b')]=_[_0xd394('0x4c')](_0x3f9275['query']);_0x2a066b[_0xd394('0x4d')]=_['intersection'](_0x2a066b[_0xd394('0x49')],_0x2a066b['query']);_0xdd54b1[_0xd394('0x50')]=_[_0xd394('0x4e')](_0x2a066b[_0xd394('0x49')],qs[_0xd394('0x4f')](_0x3f9275[_0xd394('0x4b')][_0xd394('0x4f')]));_0xdd54b1[_0xd394('0x50')]=_0xdd54b1['attributes'][_0xd394('0x51')]?_0xdd54b1['attributes']:_0x2a066b[_0xd394('0x49')];_0xdd54b1[_0xd394('0x6c')]=qs[_0xd394('0x55')](_0x3f9275[_0xd394('0x4b')]['sort']);_0xdd54b1[_0xd394('0x56')]=qs[_0xd394('0x4d')](_[_0xd394('0x6d')](_0x3f9275[_0xd394('0x4b')],_0x2a066b[_0xd394('0x4d')]));if(_0x3f9275['query'][_0xd394('0x57')]){_0xdd54b1[_0xd394('0x56')]=_[_0xd394('0x58')](_0xdd54b1[_0xd394('0x56')],{'$or':_[_0xd394('0x4a')](_0xdd54b1[_0xd394('0x50')],function(_0x489e87){var _0x3c30e7={};_0x3c30e7[_0x489e87]={'$like':'%'+_0x3f9275[_0xd394('0x4b')]['filter']+'%'};return _0x3c30e7;})});}_0xdd54b1=_[_0xd394('0x58')]({},_0xdd54b1,_0x3f9275['options']);return _0x4c3fd5[_0xd394('0xc1')](_0xdd54b1);}})[_0xd394('0x24')](function(_0x314a85){if(_0x314a85){_0x5a5f25=_0x314a85[_0xd394('0x51')];if(!_0x3f9275[_0xd394('0x4b')][_0xd394('0x52')](_0xd394('0x53'))){_0xdd54b1['limit']=qs[_0xd394('0x54')](_0x3f9275[_0xd394('0x4b')][_0xd394('0x54')]);_0xdd54b1[_0xd394('0x1f')]=qs[_0xd394('0x1f')](_0x3f9275['query'][_0xd394('0x1f')]);}return _0x4c3fd5[_0xd394('0xc1')](_0xdd54b1);}})[_0xd394('0x24')](function(_0x41e122){if(_0x41e122){return _0x41e122?{'count':_0x5a5f25,'rows':_0x41e122}:null;}})[_0xd394('0x24')](respondWithResult(_0x1df521,null))[_0xd394('0x1c')](handleError(_0x1df521,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7cc140a..ecda099 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 _0x5e8d=['hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x53acf8,_0x5e23b6){var _0x5d0cea=function(_0x46c2e3){while(--_0x46c2e3){_0x53acf8['push'](_0x53acf8['shift']());}};_0x5d0cea(++_0x5e23b6);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x4a6267,_0x32ce8b){_0x4a6267=_0x4a6267-0x0;var _0x86583=_0x5e8d[_0x4a6267];return _0x86583;};'use strict';var EventEmitter=require(_0xd5e8('0x0'));var MailAccount=require(_0xd5e8('0x1'))['db'][_0xd5e8('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd5e8('0x3')](0x0);var events={'afterCreate':_0xd5e8('0x4'),'afterUpdate':_0xd5e8('0x5'),'afterDestroy':_0xd5e8('0x6')};function emitEvent(_0x48375a){return function(_0x2c2191,_0xa3ad8a,_0x4c1dda){MailAccountEvents[_0xd5e8('0x7')](_0x48375a+':'+_0x2c2191['id'],_0x2c2191);MailAccountEvents[_0xd5e8('0x7')](_0x48375a,_0x2c2191);_0x4c1dda(null);};}for(var e in events){if(events[_0xd5e8('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xd5e8('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xfdcd=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4534cb,_0xfc95c4){var _0x54a817=function(_0x4bfde5){while(--_0x4bfde5){_0x4534cb['push'](_0x4534cb['shift']());}};_0x54a817(++_0xfc95c4);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xdfdc('0x0'))['db'][_0xdfdc('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xdfdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfdc('0x3'),'afterDestroy':_0xdfdc('0x4')};function emitEvent(_0x274740){return function(_0x789311,_0x453c75,_0x349d57){MailAccountEvents[_0xdfdc('0x5')](_0x274740+':'+_0x789311['id'],_0x789311);MailAccountEvents[_0xdfdc('0x5')](_0x274740,_0x789311);_0x349d57(null);};}for(var e in events){if(events[_0xdfdc('0x6')](e)){var event=events[e];MailAccount[_0xdfdc('0x7')](e,emitEvent(event));}}module[_0xdfdc('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 475d7e6..66a6564 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 _0xf0ff=['./mailAccount.attributes','exports','MailAccount','mail_accounts','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','data5','pass'];(function(_0x4ff57b,_0xffbd63){var _0x2336e4=function(_0x5f2ace){while(--_0x5f2ace){_0x4ff57b['push'](_0x4ff57b['shift']());}};_0x2336e4(++_0xffbd63);}(_0xf0ff,0x10a));var _0xff0f=function(_0x5eb1e4,_0x599ba1){_0x5eb1e4=_0x5eb1e4-0x0;var _0x5e3fc0=_0xf0ff[_0x5eb1e4];return _0x5e3fc0;};'use strict';var attributes=require(_0xff0f('0x0'));module[_0xff0f('0x1')]=function(_0x2cbd05){return _0x2cbd05['define'](_0xff0f('0x2'),attributes,{'tableName':_0xff0f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x29becd=this;var _0x40af43={'id':_0x29becd['id'],'tls':{'rejectUnauthorized':![]}};if(_0x29becd['provider']!==_0xff0f('0x4')){_0x40af43[_0xff0f('0x5')]=_0x29becd[_0xff0f('0x6')];}else{_0x40af43[_0xff0f('0x7')]=_0x29becd[_0xff0f('0x8')][_0xff0f('0x7')];_0x40af43[_0xff0f('0x9')]=_0x29becd[_0xff0f('0x8')][_0xff0f('0x9')];_0x40af43[_0xff0f('0xa')]=_0x29becd[_0xff0f('0x8')][_0xff0f('0xa')];}if(_0x29becd[_0xff0f('0x8')][_0xff0f('0xb')]){if(_0x29becd[_0xff0f('0x8')][_0xff0f('0xc')]){if(!_0x29becd[_0xff0f('0x8')][_0xff0f('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x40af43[_0xff0f('0xe')]={'type':_0xff0f('0xf'),'user':_0x29becd[_0xff0f('0x8')][_0xff0f('0x10')],'accessToken':_0x29becd[_0xff0f('0x8')][_0xff0f('0xd')][_0xff0f('0x11')]};}else{_0x40af43[_0xff0f('0xe')]={'user':_0x29becd[_0xff0f('0x8')][_0xff0f('0x10')],'pass':_0x29becd[_0xff0f('0x8')][_0xff0f('0x12')]};}}return _0x40af43;}}});}; \ No newline at end of file +var _0x2370=['mail_accounts','provider','custom','Smtp','host','port','secure','modernAuthentication','CloudProvider','auth','OAuth2','user','data5','exports','define','MailAccount'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x2370,0x1ed));var _0x0237=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x2370[_0x265003];return _0x33c743;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x0237('0x0')]=function(_0xe30756){return _0xe30756[_0x0237('0x1')](_0x0237('0x2'),attributes,{'tableName':_0x0237('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x27646e=this;var _0x3a0e35={'id':_0x27646e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x27646e[_0x0237('0x4')]!==_0x0237('0x5')){_0x3a0e35['service']=_0x27646e['provider'];}else{_0x3a0e35['host']=_0x27646e[_0x0237('0x6')][_0x0237('0x7')];_0x3a0e35[_0x0237('0x8')]=_0x27646e['Smtp'][_0x0237('0x8')];_0x3a0e35[_0x0237('0x9')]=_0x27646e[_0x0237('0x6')]['secure'];}if(_0x27646e['Smtp']['authentication']){if(_0x27646e[_0x0237('0x6')][_0x0237('0xa')]){if(!_0x27646e[_0x0237('0x6')][_0x0237('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3a0e35[_0x0237('0xc')]={'type':_0x0237('0xd'),'user':_0x27646e[_0x0237('0x6')][_0x0237('0xe')],'accessToken':_0x27646e[_0x0237('0x6')]['CloudProvider'][_0x0237('0xf')]};}else{_0x3a0e35['auth']={'user':_0x27646e['Smtp'][_0x0237('0xe')],'pass':_0x27646e[_0x0237('0x6')]['pass']};}}return _0x3a0e35;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ce930c6..34d495d 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 _0x1261=['Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','UserId','unshift','agent','*,*,*,*','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailAccount.socket','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','MailAccount','options','where','attributes','limit','map','include','model','ShowMailAccount','find','setDataValue','getSmtpOptions','catch','difference','keys','CmContact','rawAttributes','createdAt','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','updatedAt','MailApplication','Applications','Smtp','CloudProvider','get','omit','smtpOptions','applications','priority','asc','autoclose','push','close','length','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','format','MailInteraction','Messages','inReplyTo'];(function(_0x14c7b3,_0x4677b7){var _0x1518ef=function(_0x3bc379){while(--_0x3bc379){_0x14c7b3['push'](_0x14c7b3['shift']());}};_0x1518ef(++_0x4677b7);}(_0x1261,0x144));var _0x1126=function(_0x45ece3,_0x13a1cc){_0x45ece3=_0x45ece3-0x0;var _0x3e5c1a=_0x1261[_0x45ece3];return _0x3e5c1a;};'use strict';var _=require('lodash');var moment=require(_0x1126('0x0'));var BPromise=require(_0x1126('0x1'));var rs=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var db=require(_0x1126('0x4'))['db'];var logger=require(_0x1126('0x5'))(_0x1126('0x6'));var config=require(_0x1126('0x7'));var jayson=require(_0x1126('0x8'));var client=jayson[_0x1126('0x9')]['http']({'port':0x232c});config['redis']=_[_0x1126('0xa')](config[_0x1126('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1126('0xc'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xd'))[_0x1126('0xe')](socket);function respondWithRpcPromise(_0x2d9033,_0x59cfa1,_0x3f09ac){return new BPromise(function(_0x18dbe6,_0x167ef1){return client['request'](_0x2d9033,_0x3f09ac)[_0x1126('0xf')](function(_0x5d581b){logger['info'](_0x1126('0x10'),_0x59cfa1,'request\x20sent');logger[_0x1126('0x11')](_0x1126('0x12'),_0x59cfa1,_0x1126('0x13'),JSON[_0x1126('0x14')](_0x5d581b));if(_0x5d581b[_0x1126('0x15')]){if(_0x5d581b[_0x1126('0x15')][_0x1126('0x16')]===0x1f4){logger[_0x1126('0x15')](_0x1126('0x10'),_0x59cfa1,_0x5d581b['error']['message']);return _0x167ef1(_0x5d581b[_0x1126('0x15')][_0x1126('0x17')]);}logger[_0x1126('0x15')]('MailAccount,\x20%s,\x20%s',_0x59cfa1,_0x5d581b[_0x1126('0x15')]['message']);return _0x18dbe6(_0x5d581b[_0x1126('0x15')][_0x1126('0x17')]);}else{logger[_0x1126('0x18')]('MailAccount,\x20%s,\x20%s',_0x59cfa1,_0x1126('0x13'));_0x18dbe6(_0x5d581b[_0x1126('0x19')]['message']);}})['catch'](function(_0x22ae0b){logger[_0x1126('0x15')]('MailAccount,\x20%s,\x20%s',_0x59cfa1,_0x22ae0b);_0x167ef1(_0x22ae0b);});});}exports['GetMailAccount']=function(_0x4564c0){var _0x58b109=this;return new Promise(function(_0x22ed37,_0x1d6d19){return db[_0x1126('0x1a')]['findAll']({'raw':_0x4564c0[_0x1126('0x1b')]?_0x4564c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4564c0[_0x1126('0x1b')]?_0x4564c0[_0x1126('0x1b')][_0x1126('0x1c')]||null:null,'attributes':_0x4564c0[_0x1126('0x1b')]?_0x4564c0['options'][_0x1126('0x1d')]||null:null,'limit':_0x4564c0[_0x1126('0x1b')]?_0x4564c0['options'][_0x1126('0x1e')]||null:null,'include':_0x4564c0['options']?_0x4564c0['options']['include']?_[_0x1126('0x1f')](_0x4564c0[_0x1126('0x1b')][_0x1126('0x20')],function(_0x34bcf1){return{'model':db[_0x34bcf1[_0x1126('0x21')]],'as':_0x34bcf1['as'],'attributes':_0x34bcf1[_0x1126('0x1d')],'include':_0x34bcf1[_0x1126('0x20')]?_[_0x1126('0x1f')](_0x34bcf1['include'],function(_0x35eec3){return{'model':db[_0x35eec3[_0x1126('0x21')]],'as':_0x35eec3['as'],'attributes':_0x35eec3[_0x1126('0x1d')],'include':_0x35eec3['include']?_['map'](_0x35eec3[_0x1126('0x20')],function(_0x39bf0e){return{'model':db[_0x39bf0e['model']],'as':_0x39bf0e['as'],'attributes':_0x39bf0e[_0x1126('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1126('0xf')](function(_0x4a334a){logger[_0x1126('0x18')]('GetMailAccount',_0x4564c0);logger[_0x1126('0x11')]('GetMailAccount',_0x4564c0,JSON[_0x1126('0x14')](_0x4a334a));_0x22ed37(_0x4a334a);})['catch'](function(_0x378f4d){logger['error']('GetMailAccount',_0x378f4d['message'],_0x4564c0);_0x1d6d19(_0x58b109[_0x1126('0x15')](0x1f4,_0x378f4d[_0x1126('0x17')]));});});};exports[_0x1126('0x22')]=function(_0x5b8bea){var _0x2a3055=this;return new Promise(function(_0x226afb,_0x56f7f8){return db[_0x1126('0x1a')][_0x1126('0x23')]({'raw':_0x5b8bea[_0x1126('0x1b')]?_0x5b8bea[_0x1126('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5b8bea['options']?_0x5b8bea[_0x1126('0x1b')][_0x1126('0x1c')]||null:null,'attributes':_0x5b8bea[_0x1126('0x1b')]?_0x5b8bea[_0x1126('0x1b')]['attributes']||null:null,'include':_0x5b8bea[_0x1126('0x1b')]?_0x5b8bea[_0x1126('0x1b')][_0x1126('0x20')]?_[_0x1126('0x1f')](_0x5b8bea[_0x1126('0x1b')]['include'],function(_0x2a0dfe){return{'model':db[_0x2a0dfe[_0x1126('0x21')]],'as':_0x2a0dfe['as'],'attributes':_0x2a0dfe[_0x1126('0x1d')],'include':_0x2a0dfe[_0x1126('0x20')]?_['map'](_0x2a0dfe['include'],function(_0x22827a){return{'model':db[_0x22827a[_0x1126('0x21')]],'as':_0x22827a['as'],'attributes':_0x22827a['attributes'],'include':_0x22827a[_0x1126('0x20')]?_[_0x1126('0x1f')](_0x22827a[_0x1126('0x20')],function(_0x5c08b9){return{'model':db[_0x5c08b9['model']],'as':_0x5c08b9['as'],'attributes':_0x5c08b9[_0x1126('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1126('0xf')](function(_0x3aa08f){if(_0x5b8bea[_0x1126('0x1b')]['smtp']===!![])_0x3aa08f[_0x1126('0x24')]('smtpOptions',_0x3aa08f[_0x1126('0x25')]());logger[_0x1126('0x18')](_0x1126('0x22'),_0x5b8bea);logger[_0x1126('0x11')](_0x1126('0x22'),_0x5b8bea,JSON['stringify'](_0x3aa08f));_0x226afb(_0x3aa08f);})[_0x1126('0x26')](function(_0x3ea9de){logger[_0x1126('0x15')](_0x1126('0x22'),_0x3ea9de[_0x1126('0x17')],_0x5b8bea);_0x56f7f8(_0x2a3055[_0x1126('0x15')](0x1f4,_0x3ea9de[_0x1126('0x17')]));});});};exports['NotifyMailAccount']=function(_0x1c8d8a){var _0x154c28=this;return new Promise(function(_0x227a6b,_0xf3a0bd){var _0xcf0483={'body':_0x1c8d8a['body'],'channel':'mail'};var _0x1c4f06=_[_0x1126('0x27')](_[_0x1126('0x28')](db[_0x1126('0x29')][_0x1126('0x2a')]),[_0x1126('0x2b'),'updatedAt','CompanyId','ListId']);var _0xb8054e=![];if(_0x1c8d8a['body']['id']){delete _0x1c8d8a[_0x1126('0x2c')]['id'];}if(_[_0x1126('0x2d')](_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2e')])){return _0xf3a0bd(_0x154c28['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x1126('0x2d')](_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2c')])||_0x1c8d8a['body'][_0x1126('0x2c')]===''){return _0xf3a0bd(_0x154c28['error'](0x1f4,_0x1126('0x2f')));}if(_['isNil'](_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x30')])){return _0xf3a0bd(_0x154c28[_0x1126('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c4f06));}if(!_[_0x1126('0x31')](_0x1c4f06,_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x30')])){return _0xf3a0bd(_0x154c28['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c4f06));}var _0x4dd7f5={};_0x4dd7f5[_0x1c8d8a[_0x1126('0x2c')]['mapKey']]=_0x1c8d8a[_0x1126('0x2c')]['from'];return db[_0x1126('0x1a')][_0x1126('0x23')]({'where':{'id':_0x1c8d8a[_0x1126('0x32')]['id']},'include':[{'model':db[_0x1126('0x33')],'as':_0x1126('0x34'),'include':[{'model':db['CmContact'],'as':_0x1126('0x35'),'where':_0x4dd7f5,'limit':0x1,'order':[[_0x1126('0x36'),'DESC']]}]},{'model':db[_0x1126('0x37')],'as':_0x1126('0x38')},{'model':db['MailServerOut'],'as':_0x1126('0x39'),'include':[{'model':db[_0x1126('0x3a')],'as':'CloudProvider'}]}]})[_0x1126('0xf')](function(_0xbdde58){if(_0xbdde58&&_0xbdde58[_0x1126('0x34')]){var _0x59656d=_0xbdde58[_0x1126('0x3b')]({'plain':!![]});_0xcf0483[_0x1126('0x32')]=_[_0x1126('0x3c')](_0x59656d,[_0x1126('0x38'),_0x1126('0x34')]);_0xcf0483[_0x1126('0x32')][_0x1126('0x3d')]=_0xbdde58[_0x1126('0x25')]();_0xcf0483['applications']=_0x59656d[_0x1126('0x38')];_0xcf0483['list']=_0x59656d[_0x1126('0x34')];_0xcf0483[_0x1126('0x3e')]=_['orderBy'](_0xcf0483['applications'],[_0x1126('0x3f')],[_0x1126('0x40')]);if(_0xcf0483[_0x1126('0x32')]&&_0xcf0483['account'][_0x1126('0x41')]){_0xcf0483[_0x1126('0x3e')][_0x1126('0x42')]({'id':0x0,'priority':_0xcf0483[_0x1126('0x3e')]['length']+0x1,'app':_0x1126('0x43'),'appdata':_0x1126('0x41'),'interval':'*,*,*,*'});}if(_0xcf0483['account']['Applications']){delete _0xcf0483['account'][_0x1126('0x38')];}if(_0xcf0483[_0x1126('0x32')]['List']){delete _0xcf0483[_0x1126('0x32')][_0x1126('0x34')];}if(_0x59656d[_0x1126('0x34')][_0x1126('0x35')][_0x1126('0x44')]){return _0x59656d['List'][_0x1126('0x35')][0x0];}var _0x267592=_['defaults'](_0x1c8d8a[_0x1126('0x2c')],{'firstName':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2e')],'ListId':_0x59656d[_0x1126('0x45')]});_0x267592[_0x1c8d8a[_0x1126('0x2c')]['mapKey']]=_0x1c8d8a[_0x1126('0x2c')]['from'];return db[_0x1126('0x29')][_0x1126('0x46')](_0x267592);}else{throw new Error(_0x1126('0x47'));}})['then'](function(_0x427add){_0xcf0483[_0x1126('0x48')]=_0x427add;if(_0x427add){if(!_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x49')]){_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x49')]=rs[_0x1126('0x4a')]()+'\x20'+_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x2e')];}var _0x26949c={'ContactId':_0x427add['id'],'MailAccountId':_0x1c8d8a[_0x1126('0x32')]['id'],'inReplyTo':_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x49')],'to':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x2e')],'cc':_0x1c8d8a[_0x1126('0x2c')]['message']['cc'],'subject':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['subject'],'attach':_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x4b')],'lastMsgAt':moment()[_0x1126('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x1126('0x4d')][_0x1126('0x23')]({'where':{'closed':![],'MailAccountId':_0x1c8d8a[_0x1126('0x32')]['id']},'include':[{'model':db['MailMessage'],'as':_0x1126('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x4f')]}}]})[_0x1126('0xf')](function(_0x1230e9){if(_0x1230e9){return[_0x1230e9,![]];}return db[_0x1126('0x4d')][_0x1126('0x46')](_0x26949c)[_0x1126('0xf')](function(_0x5036d4){return[_0x5036d4,!![]];});});}else{throw new Error(_0x1126('0x50'));}})[_0x1126('0x51')](function(_0x116867,_0xc39c36){if(_0x116867){_0xb8054e=_0xc39c36;if(!_0xc39c36){return _0x116867[_0x1126('0x52')]({'inReplyTo':_0x1c8d8a[_0x1126('0x2c')]['message']['messageId'],'to':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['from'],'cc':_0x1c8d8a['body']['message']['cc'],'subject':_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x53')],'attach':_0x116867[_0x1126('0x4b')]?_0x116867['attach']:_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x4b')],'substatus':null,'substatusAt':moment()[_0x1126('0x4c')](_0x1126('0x54')),'lastMsgAt':moment()[_0x1126('0x4c')](_0x1126('0x54')),'lastMsgDirection':'in'});}else{return _0x116867;}}})['then'](function(_0x339aa6){_0xcf0483[_0x1126('0x55')]=_0x339aa6[_0x1126('0x3b')]({'plain':!![]});_0xcf0483[_0x1126('0x55')][_0x1126('0x56')]=_0xb8054e;return db['MailMessage']['create']({'body':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x2c')],'MailAccountId':_0x1c8d8a['account']['id'],'MailInteractionId':_0x339aa6['id'],'direction':'in','ContactId':_0xcf0483[_0x1126('0x48')]['id'],'messageId':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x49')],'from':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x2e')],'to':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['to'],'cc':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['cc'],'subject':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')]['subject'],'attach':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x4b')],'Attachments':_0x1c8d8a['body']['message'][_0x1126('0x57')],'originTo':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x58')],'originCc':_0x1c8d8a['body']['message']['originCc'],'bcc':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x59')],'ChatWebsiteId':_0x1c8d8a[_0x1126('0x2c')]['message'][_0x1126('0x5a')]||null,'originChannel':_0x1c8d8a['body'][_0x1126('0x17')][_0x1126('0x5b')]||_0x1126('0x5c'),'ChatOfflineMessageId':_0x1c8d8a[_0x1126('0x2c')][_0x1126('0x17')][_0x1126('0x5d')]||null},{'include':[{'model':db[_0x1126('0x5e')],'as':'Attachments'}]});})[_0x1126('0xf')](function(_0x57ece2){_0xcf0483[_0x1126('0x17')]=_0x57ece2;if(_0xcf0483[_0x1126('0x55')]['UserId']){return db[_0x1126('0x5f')][_0x1126('0x23')]({'attributes':['id','name'],'where':{'id':_0xcf0483[_0x1126('0x55')][_0x1126('0x60')]}})['then'](function(_0x561647){if(_0x561647){_0xcf0483[_0x1126('0x3e')][_0x1126('0x61')]({'id':0x0,'priority':0x0,'app':_0x1126('0x62'),'appdata':_0x561647['name']+','+(_0xcf0483['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1126('0x63')});}return respondWithRpcPromise('Start','startRouting',_0xcf0483);});}return respondWithRpcPromise(_0x1126('0x64'),'startRouting',_0xcf0483);})[_0x1126('0xf')](function(_0x288a0c){_0x227a6b(_0x288a0c);})['catch'](function(_0x133075){_0xf3a0bd(_0x154c28[_0x1126('0x15')](0x1f4,_0x133075[_0x1126('0x17')]));});});}; \ No newline at end of file +var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x177a54,_0x53fb99){var _0x5b4917=function(_0x269b63){while(--_0x269b63){_0x177a54['push'](_0x177a54['shift']());}};_0x5b4917(++_0x53fb99);}(_0x2ef3,0xba));var _0x32ef=function(_0x15f435,_0x3de60b){_0x15f435=_0x15f435-0x0;var _0x5df160=_0x2ef3[_0x15f435];return _0x5df160;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 89212c3..5d1c44a 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 _0x853a=['./mailAccount.events','save','remove','emit','removeListener','register','length','mailAccount:'];(function(_0x25a3b2,_0x5788c9){var _0x1d8857=function(_0x50459f){while(--_0x50459f){_0x25a3b2['push'](_0x25a3b2['shift']());}};_0x1d8857(++_0x5788c9);}(_0x853a,0x1d8));var _0xa853=function(_0x5253c3,_0x3e4a0a){_0x5253c3=_0x5253c3-0x0;var _0x3c3917=_0x853a[_0x5253c3];return _0x3c3917;};'use strict';var MailAccountEvents=require(_0xa853('0x0'));var events=[_0xa853('0x1'),_0xa853('0x2'),'update'];function createListener(_0x366235,_0x3f62c6){return function(_0x1bdd55){_0x3f62c6[_0xa853('0x3')](_0x366235,_0x1bdd55);};}function removeListener(_0x22108f,_0x429bf4){return function(){MailAccountEvents[_0xa853('0x4')](_0x22108f,_0x429bf4);};}exports[_0xa853('0x5')]=function(_0x1e4377){for(var _0x2b8e0a=0x0,_0x46bc20=events[_0xa853('0x6')];_0x2b8e0a<_0x46bc20;_0x2b8e0a++){var _0x1d2415=events[_0x2b8e0a];var _0x45e4d6=createListener(_0xa853('0x7')+_0x1d2415,_0x1e4377);MailAccountEvents['on'](_0x1d2415,_0x45e4d6);}}; \ No newline at end of file +var _0x38bd=['remove','update','emit','mailAccount:','save'];(function(_0x3a4f17,_0x33e286){var _0x57f497=function(_0x3570ed){while(--_0x3570ed){_0x3a4f17['push'](_0x3a4f17['shift']());}};_0x57f497(++_0x33e286);}(_0x38bd,0x6d));var _0xd38b=function(_0x5512bb,_0x332d70){_0x5512bb=_0x5512bb-0x0;var _0x4b501e=_0x38bd[_0x5512bb];return _0x4b501e;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xd38b('0x0'),_0xd38b('0x1'),_0xd38b('0x2')];function createListener(_0x458472,_0x5060fc){return function(_0x4e8658){_0x5060fc[_0xd38b('0x3')](_0x458472,_0x4e8658);};}function removeListener(_0x52ec65,_0x305c66){return function(){MailAccountEvents['removeListener'](_0x52ec65,_0x305c66);};}exports['register']=function(_0x1bd832){for(var _0x2035fc=0x0,_0x20bf0c=events['length'];_0x2035fc<_0x20bf0c;_0x2035fc++){var _0x38f1e3=events[_0x2035fc];var _0x2f5efb=createListener(_0xd38b('0x4')+_0x38f1e3,_0x1bd832);MailAccountEvents['on'](_0x38f1e3,_0x2f5efb);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e863f7e..7d4efb1 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 _0x3ee9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x3ee9,0xd7));var _0x93ee=function(_0x27889f,_0x4809b9){_0x27889f=_0x27889f-0x0;var _0x201713=_0x3ee9[_0x27889f];return _0x201713;};'use strict';var multer=require(_0x93ee('0x0'));var util=require(_0x93ee('0x1'));var path=require(_0x93ee('0x2'));var timeout=require(_0x93ee('0x3'));var express=require(_0x93ee('0x4'));var router=express[_0x93ee('0x5')]();var fs_extra=require(_0x93ee('0x6'));var auth=require(_0x93ee('0x7'));var interaction=require(_0x93ee('0x8'));var config=require(_0x93ee('0x9'));var controller=require(_0x93ee('0xa'));router[_0x93ee('0xb')](_0x93ee('0xc'),auth[_0x93ee('0xd')](),controller[_0x93ee('0xe')]);router['put'](_0x93ee('0xc'),auth['isAuthenticated'](),controller[_0x93ee('0xf')]);router[_0x93ee('0x10')](_0x93ee('0xc'),auth[_0x93ee('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd097=['isAuthenticated','show','put','/:id','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x27bd71,_0x470de3){var _0x1e7729=function(_0x3232aa){while(--_0x3232aa){_0x27bd71['push'](_0x27bd71['shift']());}};_0x1e7729(++_0x470de3);}(_0xd097,0x102));var _0x7d09=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xd097[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0x7d09('0x0'));var util=require(_0x7d09('0x1'));var path=require(_0x7d09('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d09('0x3')]();var fs_extra=require(_0x7d09('0x4'));var auth=require(_0x7d09('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d09('0x6'));var controller=require('./mailApplication.controller');router[_0x7d09('0x7')]('/:id',auth[_0x7d09('0x8')](),controller[_0x7d09('0x9')]);router[_0x7d09('0xa')](_0x7d09('0xb'),auth[_0x7d09('0x8')](),controller[_0x7d09('0xc')]);router['delete'](_0x7d09('0xb'),auth['isAuthenticated'](),controller[_0x7d09('0xd')]);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 ac44397..81dcf39 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 _0xa1be=['noop','TEXT','STRING','exports','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa1be,0x102));var _0xea1b=function(_0x8fd021,_0x4f18d4){_0x8fd021=_0x8fd021-0x0;var _0xa38f89=_0xa1be[_0x8fd021];return _0xa38f89;};'use strict';var Sequelize=require('sequelize');module[_0xea1b('0x0')]={'priority':{'type':Sequelize[_0xea1b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea1b('0x2')},'appdata':{'type':Sequelize[_0xea1b('0x3')]()},'description':{'type':Sequelize[_0xea1b('0x4')]},'interval':{'type':Sequelize[_0xea1b('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x400e=['exports','STRING','noop','sequelize'];(function(_0xb6dfe3,_0x464031){var _0x424f60=function(_0xb27de5){while(--_0xb27de5){_0xb6dfe3['push'](_0xb6dfe3['shift']());}};_0x424f60(++_0x464031);}(_0x400e,0x8b));var _0xe400=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x400e[_0x2ed8f3];return _0x525a55;};'use strict';var Sequelize=require(_0xe400('0x0'));module[_0xe400('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe400('0x2')],'allowNull':![],'defaultValue':_0xe400('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe400('0x2')]},'interval':{'type':Sequelize[_0xe400('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 08f6f32..7301e7c 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x4a8cc8,_0x110ad1){var _0x5d9b00=function(_0x34234e){while(--_0x34234e){_0x4a8cc8['push'](_0x4a8cc8['shift']());}};_0x5d9b00(++_0x110ad1);}(_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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x1e5b8b,_0x4937be){var _0x59393f=function(_0x14dc81){while(--_0x14dc81){_0x1e5b8b['push'](_0x1e5b8b['shift']());}};_0x59393f(++_0x4937be);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ddb38a3..eb743e8 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 _0xf3a6=['moment','bluebird','request-promise','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','api'];(function(_0x410d68,_0x8cc734){var _0x14cf46=function(_0x4987fb){while(--_0x4987fb){_0x410d68['push'](_0x410d68['shift']());}};_0x14cf46(++_0x8cc734);}(_0xf3a6,0x1a1));var _0x6f3a=function(_0x1c4b46,_0x26ba44){_0x1c4b46=_0x1c4b46-0x0;var _0x32f50c=_0xf3a6[_0x1c4b46];return _0x32f50c;};'use strict';var _=require(_0x6f3a('0x0'));var util=require(_0x6f3a('0x1'));var logger=require('../../config/logger')(_0x6f3a('0x2'));var moment=require(_0x6f3a('0x3'));var BPromise=require(_0x6f3a('0x4'));var rp=require(_0x6f3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f3a('0x6'));module[_0x6f3a('0x7')]=function(_0x2b351e,_0x28994a){return _0x2b351e[_0x6f3a('0x8')](_0x6f3a('0x9'),attributes,{'tableName':_0x6f3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f3a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd36d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','define','MailApplication'];(function(_0xfb8b51,_0x1610ec){var _0x28f587=function(_0x414213){while(--_0x414213){_0xfb8b51['push'](_0xfb8b51['shift']());}};_0x28f587(++_0x1610ec);}(_0xd36d,0x152));var _0xdd36=function(_0x23c26e,_0x5b4aef){_0x23c26e=_0x23c26e-0x0;var _0x1155c8=_0xd36d[_0x23c26e];return _0x1155c8;};'use strict';var _=require(_0xdd36('0x0'));var util=require(_0xdd36('0x1'));var logger=require('../../config/logger')(_0xdd36('0x2'));var moment=require('moment');var BPromise=require(_0xdd36('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd36('0x4'));var rimraf=require(_0xdd36('0x5'));var config=require(_0xdd36('0x6'));var attributes=require('./mailApplication.attributes');module[_0xdd36('0x7')]=function(_0x268fe1,_0x2f1fbc){return _0x268fe1[_0xdd36('0x8')](_0xdd36('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd36('0xa'),'collate':_0xdd36('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 43b0499..e388a26 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 _0xe407=['update','body','raw','options','then','util','moment','../../mysqldb','../../config/environment','client','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateMailApplication','MailApplication'];(function(_0x8411c7,_0xb4d35d){var _0x46e6fe=function(_0x3facf8){while(--_0x3facf8){_0x8411c7['push'](_0x8411c7['shift']());}};_0x46e6fe(++_0xb4d35d);}(_0xe407,0x194));var _0x7e40=function(_0x1d823c,_0x18f39b){_0x1d823c=_0x1d823c-0x0;var _0x4b89fe=_0xe407[_0x1d823c];return _0x4b89fe;};'use strict';var _=require('lodash');var util=require(_0x7e40('0x0'));var moment=require(_0x7e40('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e40('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7e40('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x7e40('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28d95d,_0x288e2d,_0x5d53ca){return new BPromise(function(_0x367bb4,_0x180ac6){return client['request'](_0x28d95d,_0x5d53ca)['then'](function(_0x28176e){logger['info'](_0x7e40('0x5'),_0x288e2d,_0x7e40('0x6'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x288e2d,_0x7e40('0x6'),JSON[_0x7e40('0x7')](_0x28176e));if(_0x28176e['error']){if(_0x28176e['error'][_0x7e40('0x8')]===0x1f4){logger[_0x7e40('0x9')](_0x7e40('0x5'),_0x288e2d,_0x28176e[_0x7e40('0x9')][_0x7e40('0xa')]);return _0x180ac6(_0x28176e[_0x7e40('0x9')][_0x7e40('0xa')]);}logger[_0x7e40('0x9')](_0x7e40('0x5'),_0x288e2d,_0x28176e['error']['message']);return _0x367bb4(_0x28176e[_0x7e40('0x9')][_0x7e40('0xa')]);}else{logger[_0x7e40('0xb')](_0x7e40('0x5'),_0x288e2d,_0x7e40('0x6'));_0x367bb4(_0x28176e[_0x7e40('0xc')]['message']);}})[_0x7e40('0xd')](function(_0x1064d4){logger[_0x7e40('0x9')](_0x7e40('0x5'),_0x288e2d,_0x1064d4);_0x180ac6(_0x1064d4);});});}exports[_0x7e40('0xe')]=function(_0x7dd7e2){var _0xa62f0a=this;return new Promise(function(_0xb62bf3,_0x2ed01a){return db[_0x7e40('0xf')][_0x7e40('0x10')](_0x7dd7e2[_0x7e40('0x11')],{'raw':_0x7dd7e2['options']?_0x7dd7e2['options'][_0x7e40('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7dd7e2[_0x7e40('0x13')]?_0x7dd7e2[_0x7e40('0x13')]['where']||null:null,'attributes':_0x7dd7e2[_0x7e40('0x13')]?_0x7dd7e2[_0x7e40('0x13')]['attributes']||null:null,'limit':_0x7dd7e2[_0x7e40('0x13')]?_0x7dd7e2[_0x7e40('0x13')]['limit']||null:null})[_0x7e40('0x14')](function(_0x4d78f5){logger['info'](_0x7e40('0xe'),_0x7dd7e2);logger['debug'](_0x7e40('0xe'),_0x7dd7e2,JSON[_0x7e40('0x7')](_0x4d78f5));_0xb62bf3(_0x4d78f5);})[_0x7e40('0xd')](function(_0x49873c){logger['error'](_0x7e40('0xe'),_0x49873c['message'],_0x7dd7e2);_0x2ed01a(_0xa62f0a['error'](0x1f4,_0x49873c[_0x7e40('0xa')]));});});}; \ No newline at end of file +var _0xc92f=['where','attributes','limit','UpdateMailApplication','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailApplication','update','body','options','raw'];(function(_0x1ea62e,_0x39a94b){var _0x50e259=function(_0x319c78){while(--_0x319c78){_0x1ea62e['push'](_0x1ea62e['shift']());}};_0x50e259(++_0x39a94b);}(_0xc92f,0x1e1));var _0xfc92=function(_0x47bb5b,_0x30d4e8){_0x47bb5b=_0x47bb5b-0x0;var _0x21c388=_0xc92f[_0x47bb5b];return _0x21c388;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc92('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc92('0x1'));var db=require(_0xfc92('0x2'))['db'];var utils=require(_0xfc92('0x3'));var logger=require(_0xfc92('0x4'))(_0xfc92('0x5'));var config=require('../../config/environment');var jayson=require(_0xfc92('0x6'));var client=jayson[_0xfc92('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28d263,_0x21465f,_0x2847f8){return new BPromise(function(_0x48cb73,_0x2e11d3){return client[_0xfc92('0x8')](_0x28d263,_0x2847f8)[_0xfc92('0x9')](function(_0x431d6e){logger['info'](_0xfc92('0xa'),_0x21465f,_0xfc92('0xb'));logger['debug'](_0xfc92('0xc'),_0x21465f,'request\x20sent',JSON[_0xfc92('0xd')](_0x431d6e));if(_0x431d6e['error']){if(_0x431d6e[_0xfc92('0xe')][_0xfc92('0xf')]===0x1f4){logger[_0xfc92('0xe')]('MailApplication,\x20%s,\x20%s',_0x21465f,_0x431d6e[_0xfc92('0xe')][_0xfc92('0x10')]);return _0x2e11d3(_0x431d6e[_0xfc92('0xe')][_0xfc92('0x10')]);}logger[_0xfc92('0xe')](_0xfc92('0xa'),_0x21465f,_0x431d6e[_0xfc92('0xe')][_0xfc92('0x10')]);return _0x48cb73(_0x431d6e[_0xfc92('0xe')][_0xfc92('0x10')]);}else{logger[_0xfc92('0x11')](_0xfc92('0xa'),_0x21465f,_0xfc92('0xb'));_0x48cb73(_0x431d6e['result'][_0xfc92('0x10')]);}})['catch'](function(_0x43d1cd){logger[_0xfc92('0xe')](_0xfc92('0xa'),_0x21465f,_0x43d1cd);_0x2e11d3(_0x43d1cd);});});}exports['UpdateMailApplication']=function(_0x4aa558){var _0x5d0b02=this;return new Promise(function(_0x45e31c,_0x45f825){return db[_0xfc92('0x12')][_0xfc92('0x13')](_0x4aa558[_0xfc92('0x14')],{'raw':_0x4aa558['options']?_0x4aa558[_0xfc92('0x15')][_0xfc92('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aa558['options']?_0x4aa558[_0xfc92('0x15')][_0xfc92('0x17')]||null:null,'attributes':_0x4aa558['options']?_0x4aa558[_0xfc92('0x15')][_0xfc92('0x18')]||null:null,'limit':_0x4aa558[_0xfc92('0x15')]?_0x4aa558['options'][_0xfc92('0x19')]||null:null})[_0xfc92('0x9')](function(_0x5bf775){logger[_0xfc92('0x11')](_0xfc92('0x1a'),_0x4aa558);logger['debug'](_0xfc92('0x1a'),_0x4aa558,JSON[_0xfc92('0xd')](_0x5bf775));_0x45e31c(_0x5bf775);})[_0xfc92('0x1b')](function(_0x1c6f7f){logger[_0xfc92('0xe')](_0xfc92('0x1a'),_0x1c6f7f['message'],_0x4aa558);_0x45f825(_0x5d0b02[_0xfc92('0xe')](0x1f4,_0x1c6f7f[_0xfc92('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0eab9af..397c90d 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 _0xcd82=['post','addMessage','/:id/tags','mail','addTags','put','tracked','update','delete','mailinteraction:destroy','destroy','removeTags','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download'];(function(_0x3c0f35,_0x44051a){var _0x1de893=function(_0x503933){while(--_0x503933){_0x3c0f35['push'](_0x3c0f35['shift']());}};_0x1de893(++_0x44051a);}(_0xcd82,0x6c));var _0x2cd8=function(_0x3d1c2f,_0x2efbe4){_0x3d1c2f=_0x3d1c2f-0x0;var _0x44e19e=_0xcd82[_0x3d1c2f];return _0x44e19e;};'use strict';var express=require('express');var router=express[_0x2cd8('0x0')]();var auth=require(_0x2cd8('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x2cd8('0x2'));router[_0x2cd8('0x3')]('/',auth[_0x2cd8('0x4')](),controller[_0x2cd8('0x5')]);router[_0x2cd8('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x2cd8('0x6')]);router['get'](_0x2cd8('0x7'),auth[_0x2cd8('0x4')](),controller[_0x2cd8('0x8')]);router[_0x2cd8('0x3')]('/:id/messages',auth[_0x2cd8('0x4')](),controller[_0x2cd8('0x9')]);router['get'](_0x2cd8('0xa'),auth[_0x2cd8('0x4')](),controller[_0x2cd8('0xb')]);router[_0x2cd8('0xc')]('/',auth[_0x2cd8('0x4')](),controller['create']);router[_0x2cd8('0xc')]('/:id/messages',auth[_0x2cd8('0x4')](),controller[_0x2cd8('0xd')]);router[_0x2cd8('0xc')](_0x2cd8('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x2cd8('0xf'),'mailinteraction:addtags'),controller[_0x2cd8('0x10')]);router[_0x2cd8('0x11')](_0x2cd8('0x7'),auth['isAuthenticated'](),interaction[_0x2cd8('0x12')](_0x2cd8('0xf'),'mailinteraction:update'),controller[_0x2cd8('0x13')]);router[_0x2cd8('0x14')](_0x2cd8('0x7'),auth[_0x2cd8('0x4')](),interaction[_0x2cd8('0x12')]('mail',_0x2cd8('0x15')),controller[_0x2cd8('0x16')]);router['delete'](_0x2cd8('0xe'),auth[_0x2cd8('0x4')](),controller[_0x2cd8('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6d98=['./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x6d98,0xf8));var _0x86d9=function(_0x3d8aaf,_0x579dd9){_0x3d8aaf=_0x3d8aaf-0x0;var _0x4eeddb=_0x6d98[_0x3d8aaf];return _0x4eeddb;};'use strict';var express=require(_0x86d9('0x0'));var router=express[_0x86d9('0x1')]();var auth=require(_0x86d9('0x2'));var interaction=require(_0x86d9('0x3'));var controller=require(_0x86d9('0x4'));router[_0x86d9('0x5')]('/',auth['isAuthenticated'](),controller[_0x86d9('0x6')]);router[_0x86d9('0x5')]('/describe',auth[_0x86d9('0x7')](),controller[_0x86d9('0x8')]);router[_0x86d9('0x5')](_0x86d9('0x9'),auth[_0x86d9('0x7')](),controller[_0x86d9('0xa')]);router['get'](_0x86d9('0xb'),auth[_0x86d9('0x7')](),controller[_0x86d9('0xc')]);router[_0x86d9('0x5')](_0x86d9('0xd'),auth['isAuthenticated'](),controller[_0x86d9('0xe')]);router[_0x86d9('0xf')]('/',auth[_0x86d9('0x7')](),controller['create']);router[_0x86d9('0xf')](_0x86d9('0xb'),auth[_0x86d9('0x7')](),controller[_0x86d9('0x10')]);router[_0x86d9('0xf')](_0x86d9('0x11'),auth[_0x86d9('0x7')](),interaction['tracked'](_0x86d9('0x12'),_0x86d9('0x13')),controller['addTags']);router[_0x86d9('0x14')](_0x86d9('0x9'),auth['isAuthenticated'](),interaction[_0x86d9('0x15')](_0x86d9('0x12'),_0x86d9('0x16')),controller[_0x86d9('0x17')]);router[_0x86d9('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x86d9('0x15')](_0x86d9('0x12'),'mailinteraction:destroy'),controller[_0x86d9('0x19')]);router[_0x86d9('0x18')](_0x86d9('0x11'),auth[_0x86d9('0x7')](),controller[_0x86d9('0x1a')]);module[_0x86d9('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 e2f7121..849a325 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 _0x8874=['exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize'];(function(_0x3d84b1,_0xae955f){var _0x1c0469=function(_0x2bc11f){while(--_0x2bc11f){_0x3d84b1['push'](_0x3d84b1['shift']());}};_0x1c0469(++_0xae955f);}(_0x8874,0x98));var _0x4887=function(_0x1915ea,_0x1ae6a6){_0x1915ea=_0x1915ea-0x0;var _0x1385dc=_0x8874[_0x1915ea];return _0x1385dc;};'use strict';var Sequelize=require(_0x4887('0x0'));var iconv=require('iconv');module[_0x4887('0x1')]={'closed':{'type':Sequelize[_0x4887('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4887('0x3')]},'secondDisposition':{'type':Sequelize[_0x4887('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4887('0x3')]},'note':{'type':Sequelize[_0x4887('0x3')]},'inReplyTo':{'type':Sequelize[_0x4887('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4887('0x3')]},'cc':{'type':Sequelize[_0x4887('0x4')](_0x4887('0x5'))},'subject':{'type':Sequelize[_0x4887('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4887('0x6')]},'substatus':{'type':Sequelize[_0x4887('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x4887('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x4887('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4887('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4887('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4887('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xdbe4=['TEXT','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','long'];(function(_0xbbbbe6,_0x4e1be5){var _0x40fc0e=function(_0x9ddb00){while(--_0x9ddb00){_0xbbbbe6['push'](_0xbbbbe6['shift']());}};_0x40fc0e(++_0x4e1be5);}(_0xdbe4,0xc1));var _0x4dbe=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdbe4[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x4dbe('0x0'));var iconv=require(_0x4dbe('0x1'));module[_0x4dbe('0x2')]={'closed':{'type':Sequelize[_0x4dbe('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4dbe('0x4')]},'disposition':{'type':Sequelize[_0x4dbe('0x5')]},'secondDisposition':{'type':Sequelize[_0x4dbe('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4dbe('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4dbe('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x4dbe('0x6'))},'subject':{'type':Sequelize[_0x4dbe('0x7')]()},'attach':{'type':Sequelize[_0x4dbe('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x4dbe('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x4dbe('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4dbe('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4dbe('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4dbe('0x8')]('in',_0x4dbe('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4dbe('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index db906f7..dbeea71 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 _0x9fd8=['parseSearch','sqlOperator','conditions','find','unreadMessages','`\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','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','buildExpression','keys','some','isEmpty','forEach','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.attach','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','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','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','include','options','create','body','params','describe','addMessage','ids','omit','rawAttributes','hasOwnProperty','format','includeAll','findAll','inlineCss','setTags','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','Attachment','Attachments','Messages','bcc','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','download','unlinkSync','sendStatus','rimraf','zip-dir','moment','path','squel','juice','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','Users','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','talking','unmanaged','total','closed','UserId','waiting','answered','index','MailInteraction','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','field','color','from','select','u.id','ui.MailInteractionId','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','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search'];(function(_0x118e84,_0x2cd37f){var _0x109798=function(_0xfcf0b6){while(--_0xfcf0b6){_0x118e84['push'](_0x118e84['shift']());}};_0x109798(++_0x2cd37f);}(_0x9fd8,0x18b));var _0x89fd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9fd8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89fd('0x0'));var zipdir=require(_0x89fd('0x1'));var moment=require(_0x89fd('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x89fd('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89fd('0x4'));var juice=require(_0x89fd('0x5'));var Redis=require(_0x89fd('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0x89fd('0x7'));var logger=require('../../config/logger')('api');var config=require(_0x89fd('0x8'));var db=require(_0x89fd('0x9'))['db'];var htmlEntities=require(_0x89fd('0xa'));config['redis']=_[_0x89fd('0xb')](config[_0x89fd('0xc')],{'host':_0x89fd('0xd'),'port':0x18eb});var socket=require(_0x89fd('0xe'))(new Redis(config[_0x89fd('0xc')]));require(_0x89fd('0xf'))['register'](socket);function respondWithStatusCode(_0x19b66f,_0x4b4902){_0x4b4902=_0x4b4902||0xcc;return function(_0x4a4d3b){if(_0x4a4d3b){return _0x19b66f['sendStatus'](_0x4b4902);}return _0x19b66f[_0x89fd('0x10')](_0x4b4902)[_0x89fd('0x11')]();};}function respondWithResult(_0x343e15,_0x44c882){_0x44c882=_0x44c882||0xc8;return function(_0x5f5828){if(_0x5f5828){return _0x343e15[_0x89fd('0x10')](_0x44c882)['json'](_0x5f5828);}};}function respondWithFilteredResult(_0x1663b8,_0x95b8ae){return function(_0x5e0901){if(_0x5e0901){var _0x4ed178=typeof _0x95b8ae[_0x89fd('0x12')]===_0x89fd('0x13')&&typeof _0x95b8ae[_0x89fd('0x14')]===_0x89fd('0x13');var _0x3d27e4=_0x5e0901['count'];var _0x34a00e=_0x4ed178?0x0:_0x95b8ae['offset'];var _0xe66b7c=_0x4ed178?_0x5e0901[_0x89fd('0x15')]:_0x95b8ae['offset']+_0x95b8ae[_0x89fd('0x14')];var _0x508b53;if(_0xe66b7c>=_0x3d27e4){_0xe66b7c=_0x3d27e4;_0x508b53=0xc8;}else{_0x508b53=0xce;}_0x1663b8[_0x89fd('0x10')](_0x508b53);return _0x1663b8[_0x89fd('0x16')](_0x89fd('0x17'),_0x34a00e+'-'+_0xe66b7c+'/'+_0x3d27e4)[_0x89fd('0x18')](_0x5e0901);}return null;};}function saveUpdates(_0x4897ee){return function(_0x5d64b3){if(_0x5d64b3){return _0x5d64b3[_0x89fd('0x19')](_0x4897ee)[_0x89fd('0x1a')](function(_0x3b3bf9){return _0x3b3bf9;});}return null;};}function removeEntity(_0x30ba7d){return function(_0x5afdd6){if(_0x5afdd6){return _0x5afdd6[_0x89fd('0x1b')]()[_0x89fd('0x1a')](function(){_0x30ba7d[_0x89fd('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x204e95){return function(_0x4db4b9){if(!_0x4db4b9){_0x204e95['sendStatus'](0x194);}return _0x4db4b9;};}function handleError(_0xe1906e,_0x21857c){_0x21857c=_0x21857c||0x1f4;return function(_0x340d11){logger[_0x89fd('0x1c')](_0x340d11[_0x89fd('0x1d')]);if(_0x340d11['name']){delete _0x340d11['name'];}_0xe1906e['status'](_0x21857c)['send'](_0x340d11);};}function getInteractionUsers(_0x59fe87,_0x131b26){return new BPromise(function(_0x224f85,_0x49e77b){try{if(_0x131b26[_0x59fe87['id']]){_0x59fe87[_0x89fd('0x1e')]=_[_0x89fd('0x1f')](_0x131b26[_0x59fe87['id']],function(_0x1c0d96){return{'id':_0x1c0d96['id'],'fullname':_0x1c0d96[_0x89fd('0x20')]};});}}catch(_0xdb39c7){_0x49e77b(_0xdb39c7);}_0x224f85(_0x59fe87);});}function getInteractionTags(_0x1d4dae,_0x194cef){return new BPromise(function(_0x37bed9,_0x2bce45){try{if(_0x1d4dae[_0x89fd('0x21')]){_0x1d4dae[_0x89fd('0x22')]=[];_0x1d4dae['TagIds'][_0x89fd('0x23')](',')['forEach'](function(_0x4d384b){_0x1d4dae[_0x89fd('0x22')][_0x89fd('0x24')](_0x194cef[_0x4d384b]);});}delete _0x1d4dae['TagIds'];}catch(_0xe1aa8e){_0x2bce45(_0xe1aa8e);}_0x37bed9(_0x1d4dae);});}function getLastMessageText(_0x24a8ac){return new BPromise(function(_0x37081b,_0x58690e){return db[_0x89fd('0x25')][_0x89fd('0x26')]({'where':{'$and':[{'MailInteractionId':_0x24a8ac['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x89fd('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x89fd('0x28')],'order':_0x89fd('0x29'),'raw':!![]})['then'](function(_0x1e0dd7){if(_0x1e0dd7&&_0x1e0dd7[_0x89fd('0x28')]){_0x24a8ac[_0x89fd('0x2a')]=_[_0x89fd('0x2b')](_0x1e0dd7['plainBody']);}_0x37081b(_0x24a8ac);})[_0x89fd('0x2c')](function(_0x50eaca){_0x58690e(_0x50eaca);});});}function updateMailInteraction(_0x212574,_0x5e85fd,_0x9a8767,_0x44e81c){return new BPromise(function(_0x19d262,_0x494263){return getInteractionUsers(_0x212574,_0x9a8767)[_0x89fd('0x1a')](function(_0x25d02e){return getInteractionTags(_0x25d02e,_0x5e85fd);})['then'](function(_0x376689){return getStateInteraction(_0x376689);})[_0x89fd('0x1a')](function(_0x2cde3e){if(_0x44e81c){_0x19d262(getLastMessageText(_0x2cde3e));}else{_0x19d262(_0x2cde3e);}})[_0x89fd('0x2c')](function(_0x1ca1b0){_0x494263(_0x1ca1b0);});});}function getStateInteraction(_0x57dedb){return new BPromise(function(_0x3e10fe){_0x57dedb['waiting']=0x0;_0x57dedb[_0x89fd('0x2d')]=0x0;_0x57dedb['answered']=0x0;_0x57dedb[_0x89fd('0x2e')]=0x0;_0x57dedb[_0x89fd('0x2f')]=0x0;if(!_0x57dedb[_0x89fd('0x30')]&&!_0x57dedb[_0x89fd('0x31')]){_0x57dedb[_0x89fd('0x32')]+=0x1;}if(!_0x57dedb[_0x89fd('0x30')]&&_0x57dedb[_0x89fd('0x31')]){_0x57dedb['talking']+=0x1;if(_0x57dedb['waiting']){_0x57dedb[_0x89fd('0x32')]-=0x1;}}if(_0x57dedb[_0x89fd('0x30')]&&_0x57dedb['UserId']){_0x57dedb[_0x89fd('0x33')]+=0x1;if(_0x57dedb[_0x89fd('0x2d')]){_0x57dedb['talking']-=0x1;}}if(_0x57dedb['closed']&&!_0x57dedb[_0x89fd('0x31')]){_0x57dedb['unmanaged']+=0x1;if(_0x57dedb[_0x89fd('0x32')]){_0x57dedb[_0x89fd('0x32')]-=0x1;}}_0x57dedb[_0x89fd('0x2f')]+=0x1;_0x3e10fe(_0x57dedb);});}exports[_0x89fd('0x34')]=function(_0x5781a6,_0x284535){var _0x19b2ad={},_0x506945={},_0x357eab={'count':0x0,'rows':[]};var _0x34ef10=_[_0x89fd('0x1f')](db[_0x89fd('0x35')]['rawAttributes'],function(_0x4ce6c7){return{'name':_0x4ce6c7[_0x89fd('0x36')],'type':_0x4ce6c7['type'][_0x89fd('0x37')]};});_0x506945[_0x89fd('0x38')]=_[_0x89fd('0x1f')](_0x34ef10,_0x89fd('0x39'));_0x506945[_0x89fd('0x3a')]=_['keys'](_0x5781a6[_0x89fd('0x3a')]);_0x506945[_0x89fd('0x3b')]=_[_0x89fd('0x3c')](_0x506945[_0x89fd('0x38')],_0x506945[_0x89fd('0x3a')]);_0x19b2ad[_0x89fd('0x3d')]=_[_0x89fd('0x3c')](_0x506945[_0x89fd('0x38')],qs[_0x89fd('0x3e')](_0x5781a6['query'][_0x89fd('0x3e')]));_0x19b2ad['attributes']=_0x19b2ad[_0x89fd('0x3d')][_0x89fd('0x3f')]?_0x19b2ad['attributes']:_0x506945[_0x89fd('0x38')];if(!_0x5781a6[_0x89fd('0x3a')]['hasOwnProperty'](_0x89fd('0x40'))){_0x19b2ad[_0x89fd('0x14')]=qs['limit'](_0x5781a6['query'][_0x89fd('0x14')]);_0x19b2ad[_0x89fd('0x12')]=qs['offset'](_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x12')]);}_0x19b2ad[_0x89fd('0x41')]=qs[_0x89fd('0x42')](_0x5781a6['query'][_0x89fd('0x42')]);_0x19b2ad[_0x89fd('0x43')]=qs[_0x89fd('0x3b')](_[_0x89fd('0x44')](_0x5781a6[_0x89fd('0x3a')],_0x506945[_0x89fd('0x3b')]),_0x34ef10);var _0x2c9b03=[];var _0x3bc8cc=squel['select']()[_0x89fd('0x45')]('id')[_0x89fd('0x45')](_0x89fd('0x39'))['field'](_0x89fd('0x46'))[_0x89fd('0x47')]('tools_tags');var _0x371c02=squel[_0x89fd('0x48')]()[_0x89fd('0x45')](_0x89fd('0x49'))[_0x89fd('0x45')]('u.fullname')[_0x89fd('0x45')](_0x89fd('0x4a'))['from'](_0x89fd('0x4b'),'ui')[_0x89fd('0x4c')](_0x89fd('0x4d'),'u',_0x89fd('0x4e'));var _0x52af18=squel[_0x89fd('0x48')]()['from'](_0x89fd('0x4f'),'i')[_0x89fd('0x4c')](_0x89fd('0x50'),'c',_0x89fd('0x51'))['left_join'](_0x89fd('0x4d'),'o',_0x89fd('0x52'))[_0x89fd('0x4c')](_0x89fd('0x53'),'a',_0x89fd('0x54'))[_0x89fd('0x4c')](_0x89fd('0x55'),'me','me.MailInteractionId\x20=\x20i.id')[_0x89fd('0x4c')](_0x89fd('0x56'),'it','it.MailInteractionId\x20=\x20i.id')[_0x89fd('0x4c')](_0x89fd('0x57'),'t',_0x89fd('0x58'));var _0x1eede9=squel[_0x89fd('0x59')]();var _0x320f8a=[];var _0x20d24d=squel['expr']();var _0x47a2ce;if(_0x5781a6['query'][_0x89fd('0x5a')]){_0x47a2ce=as[_0x89fd('0x5b')](_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x5a')]);var _0x19471e=_0x47a2ce[_0x89fd('0x5c')];for(var _0x314197=0x0;_0x314197<_0x47a2ce['conditions'][_0x89fd('0x3f')];_0x314197++){var _0x12f222=_0x47a2ce[_0x89fd('0x5d')][_0x314197];var _0x55931e='i';var _0xa1d97c=_[_0x89fd('0x5e')](_0x34ef10,[_0x89fd('0x39'),_0x12f222['field']]);if(!_0xa1d97c){switch(_0x12f222[_0x89fd('0x45')]){case _0x89fd('0x5f'):if(_0x12f222['value']==0x1){_0x52af18['having']('`'+_0x12f222['field']+_0x89fd('0x60'));}else{_0x52af18[_0x89fd('0x61')]('`'+_0x12f222[_0x89fd('0x45')]+_0x89fd('0x62'));}break;case _0x89fd('0x63'):if(_0x12f222[_0x89fd('0x64')]===_0x89fd('0x65')){if(_0x12f222['value'][_0x89fd('0x23')]('\x20')['length']>0x1){_0x1eede9[_0x19471e](_0x89fd('0x66'),qs[_0x89fd('0x67')](_0x12f222[_0x89fd('0x68')]),null);}else{var _0x397697='%'+_0x12f222[_0x89fd('0x68')]+'%';_0x1eede9[_0x19471e](_0x89fd('0x69'),_0x397697,_0x397697,_0x397697);}}else{_0xa1d97c=_['find'](_0x34ef10,['name',_0x89fd('0x6a')]);_0x12f222['field']=_0x89fd('0x6a');_0x55d374=as['buildExpression'](_0x55931e,_0xa1d97c[_0x89fd('0x6b')],_0x12f222);_0x1eede9[_0x19471e](_0x55d374[_0x89fd('0x6c')],_0x55d374[_0x89fd('0x68')]['start'],_0x55d374[_0x89fd('0x68')][_0x89fd('0x11')]);}break;case _0x89fd('0x6d'):var _0x2248bd=_0x12f222['value'][_0x89fd('0x23')](',')[_0x89fd('0x1f')](function(_0x1a1a18){return Number(_0x1a1a18);});_0x2248bd['forEach'](function(_0x34818e){_0x20d24d['or'](_0x89fd('0x6e'),'%,'+_0x34818e+',%');});_0x320f8a=_[_0x89fd('0x6f')](_0x320f8a,_0x2248bd);break;case _0x89fd('0x70'):if(_0x12f222['operator']==='$substring'){_0x1eede9[_0x19471e](_0x89fd('0x71'),'%'+_0x12f222[_0x89fd('0x68')]+'%',null);}else{_0xa1d97c=_[_0x89fd('0x5e')](_0x34ef10,[_0x89fd('0x39'),_0x89fd('0x31')]);_0x12f222[_0x89fd('0x45')]='UserId';_0x55d374=as['buildExpression'](_0x55931e,_0xa1d97c['type'],_0x12f222);_0x1eede9[_0x19471e](_0x55d374[_0x89fd('0x6c')],_0x55d374['value'][_0x89fd('0x72')],_0x55d374[_0x89fd('0x68')][_0x89fd('0x11')]);}break;case _0x89fd('0x28'):_0x55d374=as[_0x89fd('0x73')]('me',null,_0x12f222);_0x1eede9[_0x19471e](_0x55d374[_0x89fd('0x6c')],_0x55d374[_0x89fd('0x68')]['start'],_0x55d374[_0x89fd('0x68')][_0x89fd('0x11')]);break;}}else{var _0x55d374=as[_0x89fd('0x73')](_0x55931e,_0xa1d97c['type'],_0x12f222);_0x1eede9[_0x19471e](_0x55d374['text'],_0x55d374[_0x89fd('0x68')][_0x89fd('0x72')],_0x55d374[_0x89fd('0x68')][_0x89fd('0x11')]);}}}else{var _0x434286=_(_0x5781a6[_0x89fd('0x3a')])[_0x89fd('0x74')]()[_0x89fd('0x1f')](function(_0x1951b3){return _[_0x89fd('0x75')](_0x34ef10,['name',_0x1951b3])?_0x1951b3:undefined;})['compact']()[_0x89fd('0x68')]();if(!_[_0x89fd('0x76')](_0x434286)){_0x434286[_0x89fd('0x77')](function(_0x402d56){if(_0x402d56===_0x89fd('0x78')){_0x52af18['where'](_0x89fd('0x79'),[][_0x89fd('0x7a')](_0x5781a6[_0x89fd('0x3a')][_0x402d56]));}else if(_0x402d56===_0x89fd('0x7b')){var _0x313571=JSON['parse'](_0x5781a6['query'][_0x402d56])[_0x89fd('0x7c')];var _0x2e0b7f=JSON[_0x89fd('0x7d')](_0x5781a6[_0x89fd('0x3a')][_0x402d56])['$lte'];_0x52af18[_0x89fd('0x43')](_0x89fd('0x7e'),_0x313571,_0x2e0b7f);}else{if(_0x5781a6[_0x89fd('0x3a')][_0x402d56]==='null'){_0x52af18[_0x89fd('0x43')]('i.'+_0x402d56+_0x89fd('0x7f'));}else{_0x52af18[_0x89fd('0x43')]('i.'+_0x402d56+_0x89fd('0x80'),_0x5781a6['query'][_0x402d56]);}}});}if(_0x5781a6[_0x89fd('0x3a')]['read']){if(_0x5781a6['query'][_0x89fd('0x81')]==0x1){_0x52af18[_0x89fd('0x61')](_0x89fd('0x82'));}else{_0x52af18[_0x89fd('0x61')](_0x89fd('0x83'));}}if(_0x5781a6['query']['tag']){_0x320f8a=_[_0x89fd('0x84')](_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x85')])?_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x85')]:new Array(_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x85')]);_0x320f8a[_0x89fd('0x77')](function(_0xb755f7){_0x20d24d['or'](_0x89fd('0x6e'),'%,'+_0xb755f7+',%');});}if(_0x5781a6['query'][_0x89fd('0x86')]){var _0xd1058a=_0x5781a6['query'][_0x89fd('0x86')][_0x89fd('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x89fd('0x88')](_0xd1058a)){_0x1eede9['or'](_0x89fd('0x89'),_0xd1058a+'%');}else if(qs['isEmail'](_0xd1058a)){_0x1eede9['or'](_0x89fd('0x8a'),_0xd1058a+'%');}else{_0x1eede9['or'](_0x89fd('0x8b'),qs['getFullTextValue'](_0xd1058a))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xd1058a));}}}_0x52af18[_0x89fd('0x43')](_0x1eede9);_0x52af18[_0x89fd('0x8c')](_0x89fd('0x8d'));var _0x1f0526={'type':db[_0x89fd('0x8e')][_0x89fd('0x8f')][_0x89fd('0x90')],'raw':!![]};var _0x4cd43c=_0x52af18[_0x89fd('0x91')]();_0x4cd43c[_0x89fd('0x45')](_0x89fd('0x8d'));_0x4cd43c['field'](_0x89fd('0x92'),'unreadMessages');if(_0x19b2ad[_0x89fd('0x41')]){_0x19b2ad['order'][_0x89fd('0x77')](function(_0x38988f){var _0x308e36=_0x38988f[0x0]===_0x89fd('0x93')?_0x38988f[0x0]:'i.'+_0x38988f[0x0];_0x52af18[_0x89fd('0x41')](_0x308e36,_0x38988f[0x1]===_0x89fd('0x94')?![]:!![]);});}if(!_[_0x89fd('0x76')](_0x320f8a)){_0x52af18[_0x89fd('0x61')](_0x20d24d);_0x4cd43c[_0x89fd('0x43')](_0x89fd('0x95'),_0x320f8a);}BPromise[_0x89fd('0x96')]()[_0x89fd('0x1a')](function(){if(!_0x47a2ce){if(_0x5781a6['query']['MailAccountId'])return;_0x4cd43c['where'](_0x89fd('0x97'));_0x52af18[_0x89fd('0x43')](_0x89fd('0x97'));return;}if(_0x5781a6['user'][_0x89fd('0x98')]!==_0x89fd('0x99'))return;return _0x5781a6[_0x89fd('0x9a')][_0x89fd('0x9b')]({'attributes':['id'],'raw':!![]})[_0x89fd('0x1a')](function(_0x18c672){if(_[_0x89fd('0x76')](_0x18c672)){_0x4cd43c[_0x89fd('0x43')]('i.MailAccountId\x20IS\x20NULL');_0x52af18[_0x89fd('0x43')](_0x89fd('0x9c'));}else{_0x4cd43c[_0x89fd('0x43')](_0x89fd('0x79'),_['map'](_0x18c672,'id'));_0x52af18[_0x89fd('0x43')](_0x89fd('0x79'),_[_0x89fd('0x1f')](_0x18c672,'id'));}});})[_0x89fd('0x1a')](function(){if(_0x5781a6['user']['role']===_0x89fd('0x99')&&!_0x47a2ce&&!_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x78')])return[];return db['sequelize'][_0x89fd('0x3a')](_0x4cd43c[_0x89fd('0x9d')](),_0x1f0526);})['then'](function(_0x125252){_0x357eab[_0x89fd('0x15')]=_0x125252[_0x89fd('0x3f')];if(_0x357eab[_0x89fd('0x15')]===0x0)return[];return db[_0x89fd('0x9e')]['query'](_0x3bc8cc['toString'](),_0x1f0526)[_0x89fd('0x1a')](function(_0x814720){_0x2c9b03=_[_0x89fd('0x9f')](_0x814720,'id');_0x1f0526=_[_0x89fd('0xa0')](_0x1f0526,{'model':db[_0x89fd('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5781a6[_0x89fd('0x3a')][_0x89fd('0x3e')]){_0x19b2ad[_0x89fd('0x3d')][_0x89fd('0x77')](function(_0x7cbcfa){_0x52af18['field']('i.'+_0x7cbcfa);});}else{_0x52af18['field'](_0x89fd('0x92'),_0x89fd('0x5f'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xa1'),_0x89fd('0xa2'));_0x52af18['field'](_0x89fd('0xa3'),_0x89fd('0xa4'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xa5'),_0x89fd('0xa6'));_0x52af18['field'](_0x89fd('0xa7'),'contactName');_0x52af18['field']('i.id');_0x52af18[_0x89fd('0x45')](_0x89fd('0xa8'));_0x52af18[_0x89fd('0x45')]('i.updatedAt');_0x52af18[_0x89fd('0x45')]('i.closed');_0x52af18['field']('i.closedAt');_0x52af18[_0x89fd('0x45')](_0x89fd('0xa9'));_0x52af18[_0x89fd('0x45')]('i.lastMsgAt');_0x52af18[_0x89fd('0x45')](_0x89fd('0xaa'));_0x52af18[_0x89fd('0x45')]('i.subject');_0x52af18['field'](_0x89fd('0xab'));_0x52af18[_0x89fd('0x45')]('i.secondDisposition');_0x52af18['field'](_0x89fd('0xac'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xad'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xae'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xaf'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xb0'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xb1'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xb2'),_0x89fd('0xb3'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xb4'),_0x89fd('0xb5'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xb6'),'Contact.email');_0x52af18[_0x89fd('0x45')](_0x89fd('0xb7'),'Contact.phone');_0x52af18[_0x89fd('0x45')](_0x89fd('0xb8'),_0x89fd('0xb9'));_0x52af18['field'](_0x89fd('0xba'),_0x89fd('0xbb'));_0x52af18['field'](_0x89fd('0xbc'),_0x89fd('0xbd'));_0x52af18[_0x89fd('0x45')](_0x89fd('0xbe'),_0x89fd('0xbf'));_0x52af18['field'](_0x89fd('0xc0'),_0x89fd('0x21'));}if(_0x19b2ad[_0x89fd('0x14')])_0x52af18[_0x89fd('0x14')](_0x19b2ad[_0x89fd('0x14')]);if(_0x19b2ad[_0x89fd('0x12')])_0x52af18['offset'](_0x19b2ad[_0x89fd('0x12')]);return db[_0x89fd('0x9e')][_0x89fd('0x3a')](_0x52af18['toString'](),_0x1f0526);})[_0x89fd('0x1a')](function(_0x253e3b){if(_0x253e3b['length']>0x0)_0x371c02[_0x89fd('0x43')](_0x89fd('0xc1'),_[_0x89fd('0x1f')](_0x253e3b,'id'));return db[_0x89fd('0x9e')][_0x89fd('0x3a')](_0x371c02[_0x89fd('0x9d')](),_0x1f0526)[_0x89fd('0x1a')](function(_0x2f4f8f){var _0x421232=_[_0x89fd('0xc2')](_0x2f4f8f,_0x89fd('0xc3'));var _0xcb8007=[];return db['Setting'][_0x89fd('0x26')]({'attributes':[_0x89fd('0xc4')],'raw':!![]})[_0x89fd('0x1a')](function(_0x54260a){var _0x2136f7=_0x54260a[_0x89fd('0xc4')];_0x253e3b[_0x89fd('0x77')](function(_0x4b7e6e){_0xcb8007[_0x89fd('0x24')](updateMailInteraction(_0x4b7e6e,_0x2c9b03,_0x421232,_0x2136f7));});return BPromise[_0x89fd('0xc5')](_0xcb8007);});});});})[_0x89fd('0x1a')](function(_0x5dfa8f){_0x357eab[_0x89fd('0xc6')]=_0x5dfa8f;return _0x357eab;})['then'](respondWithFilteredResult(_0x284535,_0x19b2ad))[_0x89fd('0x2c')](handleError(_0x284535,null));};exports['show']=function(_0x4fd0c5,_0x99b862){var _0x5d4515={'raw':![],'where':{'id':_0x4fd0c5['params']['id']}},_0x292438={};_0x292438['model']=_[_0x89fd('0x74')](db['MailInteraction']['rawAttributes']);_0x292438[_0x89fd('0x3a')]=_[_0x89fd('0x74')](_0x4fd0c5[_0x89fd('0x3a')]);_0x292438[_0x89fd('0x3b')]=_[_0x89fd('0x3c')](_0x292438['model'],_0x292438[_0x89fd('0x3a')]);_0x5d4515[_0x89fd('0x3d')]=_['intersection'](_0x292438[_0x89fd('0x38')],qs[_0x89fd('0x3e')](_0x4fd0c5[_0x89fd('0x3a')]['fields']));_0x5d4515['attributes']=_0x5d4515[_0x89fd('0x3d')]['length']?_0x5d4515['attributes']:_0x292438[_0x89fd('0x38')];if(_0x4fd0c5[_0x89fd('0x3a')]['includeAll']){_0x5d4515[_0x89fd('0xc7')]=[{'all':!![]}];}_0x5d4515=_[_0x89fd('0xa0')]({},_0x5d4515,_0x4fd0c5[_0x89fd('0xc8')]);return db[_0x89fd('0x35')][_0x89fd('0x5e')](_0x5d4515)[_0x89fd('0x1a')](handleEntityNotFound(_0x99b862,null))[_0x89fd('0x1a')](respondWithResult(_0x99b862,null))[_0x89fd('0x2c')](handleError(_0x99b862,null));};exports[_0x89fd('0xc9')]=function(_0x4ffd0a,_0x102a39){return db[_0x89fd('0x35')][_0x89fd('0xc9')](_0x4ffd0a[_0x89fd('0xca')],{})['then'](respondWithResult(_0x102a39,0xc9))[_0x89fd('0x2c')](handleError(_0x102a39,null));};exports[_0x89fd('0x19')]=function(_0x46f232,_0x2908a3){if(_0x46f232[_0x89fd('0xca')]['id']){delete _0x46f232['body']['id'];}return db[_0x89fd('0x35')]['find']({'where':{'id':_0x46f232[_0x89fd('0xcb')]['id']}})['then'](handleEntityNotFound(_0x2908a3,null))['then'](saveUpdates(_0x46f232[_0x89fd('0xca')],null))['then'](respondWithResult(_0x2908a3,null))[_0x89fd('0x2c')](handleError(_0x2908a3,null));};exports[_0x89fd('0x1b')]=function(_0x44994f,_0xfbe447){return db[_0x89fd('0x35')][_0x89fd('0x5e')]({'where':{'id':_0x44994f['params']['id']}})[_0x89fd('0x1a')](handleEntityNotFound(_0xfbe447,null))[_0x89fd('0x1a')](removeEntity(_0xfbe447,null))[_0x89fd('0x2c')](handleError(_0xfbe447,null));};exports['describe']=function(_0x53c557,_0x216dd5){return db[_0x89fd('0x35')][_0x89fd('0xcc')]()[_0x89fd('0x1a')](respondWithResult(_0x216dd5,null))[_0x89fd('0x2c')](handleError(_0x216dd5,null));};exports['addMessage']=function(_0x46bba5,_0x4d4845){return db['MailMessage'][_0x89fd('0x5e')]({'where':{'id':_0x46bba5[_0x89fd('0xcb')]['id']}})[_0x89fd('0x1a')](handleEntityNotFound(_0x4d4845,null))[_0x89fd('0x1a')](function(_0x5a2e23){if(_0x5a2e23){return _0x5a2e23[_0x89fd('0xcd')](_0x46bba5[_0x89fd('0xca')][_0x89fd('0xce')],_[_0x89fd('0xcf')](_0x46bba5[_0x89fd('0xca')],['ids','id'])||{});}})[_0x89fd('0x1a')](respondWithResult(_0x4d4845,null))[_0x89fd('0x2c')](handleError(_0x4d4845,null));};exports['getMessages']=function(_0x32afa7,_0x1e5851){var _0x180360={'raw':![],'where':{}};var _0x1a4c40={};var _0x563c0a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x89fd('0x26')]({'where':{'id':_0x32afa7[_0x89fd('0xcb')]['id']}})[_0x89fd('0x1a')](handleEntityNotFound(_0x1e5851,null))[_0x89fd('0x1a')](function(_0x4f593f){if(_0x4f593f){_0x1a4c40['model']=_[_0x89fd('0x74')](db['MailMessage'][_0x89fd('0xd0')]);_0x1a4c40[_0x89fd('0x3a')]=_[_0x89fd('0x74')](_0x32afa7[_0x89fd('0x3a')]);_0x1a4c40[_0x89fd('0x3b')]=_[_0x89fd('0x3c')](_0x1a4c40['model'],_0x1a4c40[_0x89fd('0x3a')]);_0x180360[_0x89fd('0x3d')]=_[_0x89fd('0x3c')](_0x1a4c40['model'],qs['fields'](_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x3e')]));_0x180360[_0x89fd('0x3d')]=_0x180360['attributes'][_0x89fd('0x3f')]?_0x180360['attributes']:_0x1a4c40[_0x89fd('0x38')];if(!_0x32afa7[_0x89fd('0x3a')][_0x89fd('0xd1')](_0x89fd('0x40'))){_0x180360['limit']=qs[_0x89fd('0x14')](_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x14')]);_0x180360[_0x89fd('0x12')]=qs['offset'](_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x12')]);}_0x180360[_0x89fd('0x41')]=qs[_0x89fd('0x42')](_0x32afa7['query']['sort']);_0x180360[_0x89fd('0x43')]=qs['filters'](_[_0x89fd('0x44')](_0x32afa7[_0x89fd('0x3a')],_0x1a4c40[_0x89fd('0x3b')]));_0x180360[_0x89fd('0x43')][_0x89fd('0xc3')]=_0x4f593f['id'];if(_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x86')]){_0x180360[_0x89fd('0x43')]=_[_0x89fd('0xa0')](_0x180360[_0x89fd('0x43')],{'$or':_['map'](_0x180360['attributes'],function(_0x34c38c){var _0x2fa318={};_0x2fa318[_0x34c38c]={'$like':'%'+_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x86')]+'%'};return _0x2fa318;})});}if(_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x7c')]){var _0x643120=_0x32afa7[_0x89fd('0x3a')][_0x89fd('0x7c')][_0x89fd('0x23')](',');var _0x50bdd9={};_0x50bdd9[_0x643120[0x0]]={'$gte':moment(_0x643120[0x1])[_0x89fd('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x180360[_0x89fd('0x43')]=_[_0x89fd('0xa0')](_0x180360[_0x89fd('0x43')],_0x50bdd9);}_0x180360=_[_0x89fd('0xa0')]({},_0x180360,_0x32afa7[_0x89fd('0xc8')]);return db[_0x89fd('0x25')][_0x89fd('0x15')]({'where':_0x180360['where']})[_0x89fd('0x1a')](function(_0x52a779){_0x563c0a['count']=_0x52a779;if(_0x32afa7['query'][_0x89fd('0xd3')]){_0x180360[_0x89fd('0xc7')]=[{'all':!![]}];}return db[_0x89fd('0x25')][_0x89fd('0xd4')](_0x180360);})[_0x89fd('0x1a')](function(_0x1d6181){if(_0x32afa7[_0x89fd('0x3a')][_0x89fd('0xd5')]==='true'){for(var _0x12ee04=0x0;_0x12ee04<_0x1d6181['length'];_0x12ee04++){_0x1d6181[_0x12ee04][_0x89fd('0xca')]=juice(_0x1d6181[_0x12ee04][_0x89fd('0xca')]);}}_0x563c0a['rows']=_0x1d6181;return _0x563c0a;});}})['then'](respondWithFilteredResult(_0x1e5851,_0x180360))[_0x89fd('0x2c')](handleError(_0x1e5851,null));};exports['addTags']=function(_0x1d714a,_0x47beb7){return db[_0x89fd('0x35')][_0x89fd('0x5e')]({'where':{'id':_0x1d714a[_0x89fd('0xcb')]['id']}})[_0x89fd('0x1a')](handleEntityNotFound(_0x47beb7,null))[_0x89fd('0x1a')](function(_0xeb6917){if(_0xeb6917){return _0xeb6917[_0x89fd('0xd6')](_0x1d714a[_0x89fd('0xca')][_0x89fd('0xce')],_[_0x89fd('0xcf')](_0x1d714a[_0x89fd('0xca')],[_0x89fd('0xce'),'id'])||{})['spread'](function(){return db['Tag'][_0x89fd('0xd4')]({'attributes':['id',_0x89fd('0x39'),_0x89fd('0x46')],'where':{'id':_0x1d714a[_0x89fd('0xca')][_0x89fd('0xce')]}});})['then'](function(_0x32d89a){socket[_0x89fd('0xd7')](_0x89fd('0xd8'),{'id':Number(_0x1d714a[_0x89fd('0xcb')]['id']),'tags':_0x32d89a||[]});return{'id':Number(_0x1d714a[_0x89fd('0xcb')]['id']),'tags':_0x32d89a||[]};});}})[_0x89fd('0x1a')](respondWithResult(_0x47beb7,null))['catch'](handleError(_0x47beb7,null));};exports['removeTags']=function(_0x24ed15,_0x3b6527){return db[_0x89fd('0x35')][_0x89fd('0x5e')]({'where':{'id':_0x24ed15[_0x89fd('0xcb')]['id']}})['then'](handleEntityNotFound(_0x3b6527,null))[_0x89fd('0x1a')](function(_0x3f4001){if(_0x3f4001){return _0x3f4001[_0x89fd('0xd9')](_0x24ed15[_0x89fd('0x3a')][_0x89fd('0xce')]);}})['then'](respondWithStatusCode(_0x3b6527,null))['catch'](handleError(_0x3b6527,null));};exports['download']=function(_0x5d1178,_0x1ca251){var _0x93433e=moment()[_0x89fd('0xda')]()['toString']();var _0x553067=path[_0x89fd('0xdb')](config[_0x89fd('0xdc')],_0x89fd('0xdd'),_0x89fd('0xde'),_0x89fd('0xdf'));var _0x27f316=path['join'](config[_0x89fd('0xdc')],_0x89fd('0xdd'),'files',_0x89fd('0xe0'));var _0x1efb71=path['join'](_0x553067,_0x93433e);var _0x5ed734=util[_0x89fd('0xd2')]('transcript-%d-%s.zip',_0x5d1178[_0x89fd('0xcb')]['id'],_0x93433e);var _0x128e53=path[_0x89fd('0xdb')](_0x553067,_0x5ed734);var _0x1e203d=[];if(_0x5d1178[_0x89fd('0x3a')][_0x89fd('0xe0')]){_0x1e203d['push']({'model':db[_0x89fd('0xe1')],'as':_0x89fd('0xe2'),'raw':!![]});}var _0xc88a93=[{'model':db[_0x89fd('0x25')],'as':_0x89fd('0xe3'),'attributes':['id',_0x89fd('0xca'),_0x89fd('0x47'),'to','cc',_0x89fd('0xe4'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x89fd('0x42')]('id'),'include':_0x1e203d}];return db[_0x89fd('0x35')]['find']({'where':{'id':_0x5d1178[_0x89fd('0xcb')]['id']},'include':_0xc88a93})[_0x89fd('0x1a')](handleEntityNotFound(_0x1ca251,null))['then'](function(_0x1a68f3){if(_0x1a68f3&&_0x1a68f3[_0x89fd('0xe3')]){var _0x4b343a=_0x1a68f3[_0x89fd('0xe5')]({'plain':!![]});fs['mkdirSync'](_0x1efb71);return BPromise[_0x89fd('0xe6')](_0x4b343a[_0x89fd('0xe3')],function(_0x2f5fc7,_0x3565dd){var _0x411880={'from':_0x2f5fc7[_0x89fd('0x47')],'to':_0x2f5fc7['to'],'subject':_0x2f5fc7['subject'],'html':htmlEntities[_0x89fd('0xe7')](_0x2f5fc7[_0x89fd('0xca')]),'headers':{'Date':moment(_0x2f5fc7['createdAt'])[_0x89fd('0xd2')](_0x89fd('0xe8'))},'attachments':[]};if(_0x2f5fc7['cc']){_0x411880[_0x89fd('0xe9')]['Cc']=_0x2f5fc7['cc'];}if(_0x2f5fc7['bcc']){_0x411880[_0x89fd('0xe9')][_0x89fd('0xea')]=_0x2f5fc7[_0x89fd('0xe4')];}return new BPromise(function(_0x3e05c2,_0x5629b5){if(_0x2f5fc7[_0x89fd('0xe2')]){for(var _0x5dbc86=0x0;_0x5dbc86<_0x2f5fc7['Attachments'][_0x89fd('0x3f')];_0x5dbc86++){var _0x3d6aa3=_0x2f5fc7[_0x89fd('0xe2')][_0x5dbc86];var _0x591bb2=path[_0x89fd('0xdb')](_0x27f316,_0x3d6aa3[_0x89fd('0xeb')]);if(fs[_0x89fd('0xec')](_0x591bb2)){_0x411880[_0x89fd('0xe0')]['push']({'name':_0x3d6aa3[_0x89fd('0x39')],'contentType':_0x3d6aa3[_0x89fd('0x6b')],'data':fs[_0x89fd('0xed')](_0x591bb2)});}}}emlformat[_0x89fd('0xee')](_0x411880,function(_0x4cea23,_0x217762){if(_0x4cea23)return _0x5629b5(_0x4cea23);fs[_0x89fd('0xef')](path[_0x89fd('0xdb')](_0x1efb71,util['format']('message%d.eml',_0x3565dd)),_0x217762);return _0x3e05c2(_0x217762);});});})[_0x89fd('0x1a')](function(){return new BPromise(function(_0x52943d,_0x534b1a){zipdir(_0x1efb71,{'saveTo':_0x128e53},function(_0x4cd748,_0xd81ee){if(_0x4cd748)return _0x534b1a(_0x4cd748);return _0x52943d(_0xd81ee);});})[_0x89fd('0x1a')](function(){return new BPromise(function(_0x374a4d,_0x1e8a13){rimraf(_0x1efb71,function(_0x3d1c91){if(_0x3d1c91)_0x1e8a13(_0x3d1c91);return _0x374a4d();});});})[_0x89fd('0x1a')](function(){return _0x1ca251[_0x89fd('0xf0')](_0x128e53,_0x5ed734,function(_0x5b1264){if(!_0x5b1264)fs[_0x89fd('0xf1')](_0x128e53);});});});}else{return _0x1ca251[_0x89fd('0xf2')](0xc8);}})[_0x89fd('0x2c')](handleError(_0x1ca251,null));}; \ No newline at end of file +var _0xb603=['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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','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?','find','some','compact','isEmpty','MailAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','role','sequelize','toString','keyBy','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','a.email','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','c.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','enableEmailPreview','all','rows','show','includeAll','include','merge','options','create','body','addMessage','ids','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','true','addTags','params','setTags','omit','spread','color','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','mkdirSync','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','fullname','Tags','TagIds','split','forEach','push','MailMessage','findOne','out','-id','trimStart','plainBody','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','from','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','unreadMessages','value'];(function(_0x3d37f2,_0x238ab2){var _0x4df294=function(_0x4696ea){while(--_0x4696ea){_0x3d37f2['push'](_0x3d37f2['shift']());}};_0x4df294(++_0x238ab2);}(_0xb603,0x166));var _0x3b60=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xb603[_0x26462c];return _0x509a42;};'use strict';var emlformat=require(_0x3b60('0x0'));var rimraf=require(_0x3b60('0x1'));var zipdir=require(_0x3b60('0x2'));var moment=require(_0x3b60('0x3'));var BPromise=require(_0x3b60('0x4'));var util=require(_0x3b60('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x3b60('0x6'));var squel=require(_0x3b60('0x7'));var juice=require('juice');var Redis=require(_0x3b60('0x8'));var qs=require(_0x3b60('0x9'));var as=require(_0x3b60('0xa'));var logger=require('../../config/logger')(_0x3b60('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x3b60('0xc')]=_[_0x3b60('0xd')](config[_0x3b60('0xc')],{'host':_0x3b60('0xe'),'port':0x18eb});var socket=require(_0x3b60('0xf'))(new Redis(config['redis']));require(_0x3b60('0x10'))[_0x3b60('0x11')](socket);function respondWithStatusCode(_0x51da7b,_0xd54566){_0xd54566=_0xd54566||0xcc;return function(_0x479098){if(_0x479098){return _0x51da7b[_0x3b60('0x12')](_0xd54566);}return _0x51da7b[_0x3b60('0x13')](_0xd54566)[_0x3b60('0x14')]();};}function respondWithResult(_0x441db9,_0x4cd2b4){_0x4cd2b4=_0x4cd2b4||0xc8;return function(_0x5b59f5){if(_0x5b59f5){return _0x441db9['status'](_0x4cd2b4)[_0x3b60('0x15')](_0x5b59f5);}};}function respondWithFilteredResult(_0x33f2d4,_0x579cd3){return function(_0x4ed7a2){if(_0x4ed7a2){var _0x488f8d=typeof _0x579cd3[_0x3b60('0x16')]===_0x3b60('0x17')&&typeof _0x579cd3[_0x3b60('0x18')]===_0x3b60('0x17');var _0x17c48a=_0x4ed7a2[_0x3b60('0x19')];var _0x3d781b=_0x488f8d?0x0:_0x579cd3[_0x3b60('0x16')];var _0x208eee=_0x488f8d?_0x4ed7a2[_0x3b60('0x19')]:_0x579cd3[_0x3b60('0x16')]+_0x579cd3['limit'];var _0x322f73;if(_0x208eee>=_0x17c48a){_0x208eee=_0x17c48a;_0x322f73=0xc8;}else{_0x322f73=0xce;}_0x33f2d4['status'](_0x322f73);return _0x33f2d4[_0x3b60('0x1a')](_0x3b60('0x1b'),_0x3d781b+'-'+_0x208eee+'/'+_0x17c48a)[_0x3b60('0x15')](_0x4ed7a2);}return null;};}function saveUpdates(_0x3e1564){return function(_0x5df5d5){if(_0x5df5d5){return _0x5df5d5[_0x3b60('0x1c')](_0x3e1564)[_0x3b60('0x1d')](function(_0x3a353c){return _0x3a353c;});}return null;};}function removeEntity(_0xe7c30d){return function(_0x4de99d){if(_0x4de99d){return _0x4de99d[_0x3b60('0x1e')]()[_0x3b60('0x1d')](function(){_0xe7c30d[_0x3b60('0x13')](0xcc)[_0x3b60('0x14')]();});}};}function handleEntityNotFound(_0x2652ee){return function(_0x1945b3){if(!_0x1945b3){_0x2652ee[_0x3b60('0x12')](0x194);}return _0x1945b3;};}function handleError(_0x71b278,_0x138562){_0x138562=_0x138562||0x1f4;return function(_0x1895b8){logger['error'](_0x1895b8[_0x3b60('0x1f')]);if(_0x1895b8[_0x3b60('0x20')]){delete _0x1895b8[_0x3b60('0x20')];}_0x71b278[_0x3b60('0x13')](_0x138562)[_0x3b60('0x21')](_0x1895b8);};}function getInteractionUsers(_0x358c71,_0x2bd26e){return new BPromise(function(_0x2e9db0,_0x5bff1b){try{if(_0x2bd26e[_0x358c71['id']]){_0x358c71['Users']=_['map'](_0x2bd26e[_0x358c71['id']],function(_0x5555af){return{'id':_0x5555af['id'],'fullname':_0x5555af[_0x3b60('0x22')]};});}}catch(_0x20378f){_0x5bff1b(_0x20378f);}_0x2e9db0(_0x358c71);});}function getInteractionTags(_0x5713bd,_0x25d025){return new BPromise(function(_0xfde9f2,_0x2ae718){try{if(_0x5713bd['TagIds']){_0x5713bd[_0x3b60('0x23')]=[];_0x5713bd[_0x3b60('0x24')][_0x3b60('0x25')](',')[_0x3b60('0x26')](function(_0x5db07b){_0x5713bd[_0x3b60('0x23')][_0x3b60('0x27')](_0x25d025[_0x5db07b]);});}delete _0x5713bd['TagIds'];}catch(_0x563a90){_0x2ae718(_0x563a90);}_0xfde9f2(_0x5713bd);});}function getLastMessageText(_0x427f37){return new BPromise(function(_0x52506d,_0x36469b){return db[_0x3b60('0x28')][_0x3b60('0x29')]({'where':{'$and':[{'MailInteractionId':_0x427f37['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x3b60('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x3b60('0x2b'),'raw':!![]})[_0x3b60('0x1d')](function(_0x3e0b9e){if(_0x3e0b9e&&_0x3e0b9e['plainBody']){_0x427f37['lastMsgText']=_[_0x3b60('0x2c')](_0x3e0b9e[_0x3b60('0x2d')]);}_0x52506d(_0x427f37);})[_0x3b60('0x2e')](function(_0x95a58d){_0x36469b(_0x95a58d);});});}function updateMailInteraction(_0x53d2df,_0x3ecc16,_0x40339c,_0x3bc9c8){return new BPromise(function(_0x8a24f5,_0x1c1cd3){return getInteractionUsers(_0x53d2df,_0x40339c)[_0x3b60('0x1d')](function(_0x4daa38){return getInteractionTags(_0x4daa38,_0x3ecc16);})['then'](function(_0x3c62aa){return getStateInteraction(_0x3c62aa);})[_0x3b60('0x1d')](function(_0x58d12d){if(_0x3bc9c8){_0x8a24f5(getLastMessageText(_0x58d12d));}else{_0x8a24f5(_0x58d12d);}})[_0x3b60('0x2e')](function(_0x120f35){_0x1c1cd3(_0x120f35);});});}function getStateInteraction(_0x4d9db7){return new BPromise(function(_0x3a6a7e){_0x4d9db7[_0x3b60('0x2f')]=0x0;_0x4d9db7[_0x3b60('0x30')]=0x0;_0x4d9db7[_0x3b60('0x31')]=0x0;_0x4d9db7[_0x3b60('0x32')]=0x0;_0x4d9db7['total']=0x0;if(!_0x4d9db7[_0x3b60('0x33')]&&!_0x4d9db7[_0x3b60('0x34')]){_0x4d9db7['waiting']+=0x1;}if(!_0x4d9db7['closed']&&_0x4d9db7[_0x3b60('0x34')]){_0x4d9db7[_0x3b60('0x30')]+=0x1;if(_0x4d9db7[_0x3b60('0x2f')]){_0x4d9db7['waiting']-=0x1;}}if(_0x4d9db7[_0x3b60('0x33')]&&_0x4d9db7[_0x3b60('0x34')]){_0x4d9db7['answered']+=0x1;if(_0x4d9db7['talking']){_0x4d9db7['talking']-=0x1;}}if(_0x4d9db7[_0x3b60('0x33')]&&!_0x4d9db7[_0x3b60('0x34')]){_0x4d9db7[_0x3b60('0x32')]+=0x1;if(_0x4d9db7[_0x3b60('0x2f')]){_0x4d9db7[_0x3b60('0x2f')]-=0x1;}}_0x4d9db7[_0x3b60('0x35')]+=0x1;_0x3a6a7e(_0x4d9db7);});}exports[_0x3b60('0x36')]=function(_0x4d2f65,_0x5dcb53){var _0xc21bbb={},_0x27fadf={},_0x1c97fc={'count':0x0,'rows':[]};var _0x38e26d=_[_0x3b60('0x37')](db['MailInteraction'][_0x3b60('0x38')],function(_0xfca5d){return{'name':_0xfca5d['fieldName'],'type':_0xfca5d[_0x3b60('0x39')][_0x3b60('0x3a')]};});_0x27fadf[_0x3b60('0x3b')]=_[_0x3b60('0x37')](_0x38e26d,_0x3b60('0x20'));_0x27fadf[_0x3b60('0x3c')]=_[_0x3b60('0x3d')](_0x4d2f65[_0x3b60('0x3c')]);_0x27fadf[_0x3b60('0x3e')]=_[_0x3b60('0x3f')](_0x27fadf['model'],_0x27fadf[_0x3b60('0x3c')]);_0xc21bbb[_0x3b60('0x40')]=_[_0x3b60('0x3f')](_0x27fadf[_0x3b60('0x3b')],qs[_0x3b60('0x41')](_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x41')]));_0xc21bbb['attributes']=_0xc21bbb[_0x3b60('0x40')][_0x3b60('0x42')]?_0xc21bbb['attributes']:_0x27fadf['model'];if(!_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x43')](_0x3b60('0x44'))){_0xc21bbb[_0x3b60('0x18')]=qs[_0x3b60('0x18')](_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x18')]);_0xc21bbb[_0x3b60('0x16')]=qs[_0x3b60('0x16')](_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x16')]);}_0xc21bbb[_0x3b60('0x45')]=qs['sort'](_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x46')]);_0xc21bbb[_0x3b60('0x47')]=qs[_0x3b60('0x3e')](_[_0x3b60('0x48')](_0x4d2f65[_0x3b60('0x3c')],_0x27fadf[_0x3b60('0x3e')]),_0x38e26d);var _0xdd9d27=[];var _0x269728=squel[_0x3b60('0x49')]()[_0x3b60('0x4a')]('id')[_0x3b60('0x4a')](_0x3b60('0x20'))[_0x3b60('0x4a')]('color')['from'](_0x3b60('0x4b'));var _0xbfe20c=squel[_0x3b60('0x49')]()[_0x3b60('0x4a')](_0x3b60('0x4c'))[_0x3b60('0x4a')](_0x3b60('0x4d'))['field'](_0x3b60('0x4e'))['from']('user_has_mail_interactions','ui')[_0x3b60('0x4f')](_0x3b60('0x50'),'u',_0x3b60('0x51'));var _0xe4e82a=squel[_0x3b60('0x49')]()[_0x3b60('0x52')](_0x3b60('0x53'),'i')['left_join'](_0x3b60('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3b60('0x4f')](_0x3b60('0x50'),'o',_0x3b60('0x55'))[_0x3b60('0x4f')](_0x3b60('0x56'),'a','a.id\x20=\x20i.MailAccountId')[_0x3b60('0x4f')]('mail_messages','me',_0x3b60('0x57'))[_0x3b60('0x4f')](_0x3b60('0x58'),'it','it.MailInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x3b60('0x59'));var _0x22c015=squel[_0x3b60('0x5a')]();var _0x1d68e1=[];var _0x2fb5f5=squel['expr']();var _0x49919b;if(_0x4d2f65[_0x3b60('0x3c')]['search']){_0x49919b=as[_0x3b60('0x5b')](_0x4d2f65['query'][_0x3b60('0x5c')]);var _0x58787e=_0x49919b['sqlOperator'];for(var _0x388c7e=0x0;_0x388c7e<_0x49919b[_0x3b60('0x5d')][_0x3b60('0x42')];_0x388c7e++){var _0xc2922f=_0x49919b[_0x3b60('0x5d')][_0x388c7e];var _0x200482='i';var _0x33814b=_['find'](_0x38e26d,['name',_0xc2922f[_0x3b60('0x4a')]]);if(!_0x33814b){switch(_0xc2922f[_0x3b60('0x4a')]){case _0x3b60('0x5e'):if(_0xc2922f[_0x3b60('0x5f')]==0x1){_0xe4e82a[_0x3b60('0x60')]('`'+_0xc2922f[_0x3b60('0x4a')]+_0x3b60('0x61'));}else{_0xe4e82a[_0x3b60('0x60')]('`'+_0xc2922f[_0x3b60('0x4a')]+'`\x20>\x200');}break;case _0x3b60('0x62'):if(_0xc2922f[_0x3b60('0x63')]===_0x3b60('0x64')){if(_0xc2922f[_0x3b60('0x5f')][_0x3b60('0x25')]('\x20')['length']>0x1){_0x22c015[_0x58787e](_0x3b60('0x65'),qs['getFullTextValue'](_0xc2922f[_0x3b60('0x5f')]),null);}else{var _0x4e6b7c='%'+_0xc2922f[_0x3b60('0x5f')]+'%';_0x22c015[_0x58787e](_0x3b60('0x66'),_0x4e6b7c,_0x4e6b7c,_0x4e6b7c);}}else{_0x33814b=_['find'](_0x38e26d,[_0x3b60('0x20'),_0x3b60('0x67')]);_0xc2922f[_0x3b60('0x4a')]='ContactId';_0x397300=as[_0x3b60('0x68')](_0x200482,_0x33814b[_0x3b60('0x39')],_0xc2922f);_0x22c015[_0x58787e](_0x397300[_0x3b60('0x69')],_0x397300[_0x3b60('0x5f')][_0x3b60('0x6a')],_0x397300[_0x3b60('0x5f')]['end']);}break;case _0x3b60('0x6b'):var _0x287ff3=_0xc2922f[_0x3b60('0x5f')][_0x3b60('0x25')](',')[_0x3b60('0x37')](function(_0x4b9bec){return Number(_0x4b9bec);});_0x287ff3['forEach'](function(_0x52d804){_0x2fb5f5['or'](_0x3b60('0x6c'),'%,'+_0x52d804+',%');});_0x1d68e1=_[_0x3b60('0x6d')](_0x1d68e1,_0x287ff3);break;case _0x3b60('0x6e'):if(_0xc2922f[_0x3b60('0x63')]===_0x3b60('0x64')){_0x22c015[_0x58787e](_0x3b60('0x6f'),'%'+_0xc2922f['value']+'%',null);}else{_0x33814b=_[_0x3b60('0x70')](_0x38e26d,[_0x3b60('0x20'),_0x3b60('0x34')]);_0xc2922f[_0x3b60('0x4a')]=_0x3b60('0x34');_0x397300=as[_0x3b60('0x68')](_0x200482,_0x33814b[_0x3b60('0x39')],_0xc2922f);_0x22c015[_0x58787e](_0x397300[_0x3b60('0x69')],_0x397300[_0x3b60('0x5f')][_0x3b60('0x6a')],_0x397300[_0x3b60('0x5f')]['end']);}break;case _0x3b60('0x2d'):_0x397300=as[_0x3b60('0x68')]('me',null,_0xc2922f);_0x22c015[_0x58787e](_0x397300[_0x3b60('0x69')],_0x397300[_0x3b60('0x5f')][_0x3b60('0x6a')],_0x397300[_0x3b60('0x5f')][_0x3b60('0x14')]);break;}}else{var _0x397300=as[_0x3b60('0x68')](_0x200482,_0x33814b[_0x3b60('0x39')],_0xc2922f);_0x22c015[_0x58787e](_0x397300[_0x3b60('0x69')],_0x397300[_0x3b60('0x5f')][_0x3b60('0x6a')],_0x397300['value'][_0x3b60('0x14')]);}}}else{var _0x69676d=_(_0x4d2f65['query'])[_0x3b60('0x3d')]()['map'](function(_0x48424a){return _[_0x3b60('0x71')](_0x38e26d,[_0x3b60('0x20'),_0x48424a])?_0x48424a:undefined;})[_0x3b60('0x72')]()[_0x3b60('0x5f')]();if(!_[_0x3b60('0x73')](_0x69676d)){_0x69676d['forEach'](function(_0x9f037a){if(_0x9f037a===_0x3b60('0x74')){_0xe4e82a['where']('i.MailAccountId\x20IN\x20?',[][_0x3b60('0x75')](_0x4d2f65['query'][_0x9f037a]));}else if(_0x9f037a===_0x3b60('0x76')){var _0xf74745=JSON[_0x3b60('0x77')](_0x4d2f65['query'][_0x9f037a])['$gte'];var _0x1205b3=JSON[_0x3b60('0x77')](_0x4d2f65[_0x3b60('0x3c')][_0x9f037a])[_0x3b60('0x78')];_0xe4e82a[_0x3b60('0x47')](_0x3b60('0x79'),_0xf74745,_0x1205b3);}else{if(_0x4d2f65[_0x3b60('0x3c')][_0x9f037a]==='null'){_0xe4e82a[_0x3b60('0x47')]('i.'+_0x9f037a+'\x20IS\x20NULL');}else{_0xe4e82a[_0x3b60('0x47')]('i.'+_0x9f037a+'\x20=\x20?',_0x4d2f65[_0x3b60('0x3c')][_0x9f037a]);}}});}if(_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x7a')]){if(_0x4d2f65['query'][_0x3b60('0x7a')]==0x1){_0xe4e82a[_0x3b60('0x60')](_0x3b60('0x7b'));}else{_0xe4e82a[_0x3b60('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x7c')]){_0x1d68e1=_[_0x3b60('0x7d')](_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x7c')])?_0x4d2f65[_0x3b60('0x3c')]['tag']:new Array(_0x4d2f65['query']['tag']);_0x1d68e1[_0x3b60('0x26')](function(_0x14dcad){_0x2fb5f5['or'](_0x3b60('0x6c'),'%,'+_0x14dcad+',%');});}if(_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x7e')]){var _0x5ac040=_0x4d2f65['query'][_0x3b60('0x7e')][_0x3b60('0x7f')]('\x5c','\x5c\x5c')[_0x3b60('0x7f')](/'/g,'\x27\x27');if(qs[_0x3b60('0x80')](_0x5ac040)){_0x22c015['or'](_0x3b60('0x81'),_0x5ac040+'%');}else if(qs[_0x3b60('0x82')](_0x5ac040)){_0x22c015['or'](_0x3b60('0x83'),_0x5ac040+'%');}else{_0x22c015['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b60('0x84')](_0x5ac040))['or'](_0x3b60('0x85'),qs[_0x3b60('0x84')](_0x5ac040));}}}_0xe4e82a['where'](_0x22c015);_0xe4e82a['group']('i.id');var _0x5b0a6e={'type':db[_0x3b60('0x86')]['QueryTypes'][_0x3b60('0x87')],'raw':!![]};var _0x439c6e=_0xe4e82a['clone']();_0x439c6e[_0x3b60('0x4a')]('i.id');_0x439c6e['field'](_0x3b60('0x88'),'unreadMessages');if(_0xc21bbb['order']){_0xc21bbb[_0x3b60('0x45')]['forEach'](function(_0x355c77){var _0x3d3407=_0x355c77[0x0]===_0x3b60('0x89')?_0x355c77[0x0]:'i.'+_0x355c77[0x0];_0xe4e82a[_0x3b60('0x45')](_0x3d3407,_0x355c77[0x1]===_0x3b60('0x8a')?![]:!![]);});}if(!_[_0x3b60('0x73')](_0x1d68e1)){_0xe4e82a[_0x3b60('0x60')](_0x2fb5f5);_0x439c6e[_0x3b60('0x47')](_0x3b60('0x8b'),_0x1d68e1);}BPromise['resolve']()['then'](function(){if(!_0x49919b){if(_0x4d2f65[_0x3b60('0x3c')]['MailAccountId'])return;_0x439c6e['where'](_0x3b60('0x8c'));_0xe4e82a[_0x3b60('0x47')](_0x3b60('0x8c'));return;}if(_0x4d2f65['user']['role']!==_0x3b60('0x8d'))return;return _0x4d2f65[_0x3b60('0x8e')][_0x3b60('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a9321){if(_[_0x3b60('0x73')](_0x1a9321)){_0x439c6e[_0x3b60('0x47')](_0x3b60('0x90'));_0xe4e82a[_0x3b60('0x47')]('i.MailAccountId\x20IS\x20NULL');}else{_0x439c6e[_0x3b60('0x47')](_0x3b60('0x91'),_[_0x3b60('0x37')](_0x1a9321,'id'));_0xe4e82a[_0x3b60('0x47')](_0x3b60('0x91'),_[_0x3b60('0x37')](_0x1a9321,'id'));}});})[_0x3b60('0x1d')](function(){if(_0x4d2f65[_0x3b60('0x8e')][_0x3b60('0x92')]===_0x3b60('0x8d')&&!_0x49919b&&!_0x4d2f65['query'][_0x3b60('0x74')])return[];return db[_0x3b60('0x93')][_0x3b60('0x3c')](_0x439c6e['toString'](),_0x5b0a6e);})[_0x3b60('0x1d')](function(_0xf4844){_0x1c97fc[_0x3b60('0x19')]=_0xf4844['length'];if(_0x1c97fc[_0x3b60('0x19')]===0x0)return[];return db[_0x3b60('0x93')]['query'](_0x269728[_0x3b60('0x94')](),_0x5b0a6e)[_0x3b60('0x1d')](function(_0x325c55){_0xdd9d27=_[_0x3b60('0x95')](_0x325c55,'id');_0x5b0a6e=_['merge'](_0x5b0a6e,{'model':db[_0x3b60('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4d2f65[_0x3b60('0x3c')][_0x3b60('0x41')]){_0xc21bbb[_0x3b60('0x40')][_0x3b60('0x26')](function(_0x32c478){_0xe4e82a[_0x3b60('0x4a')]('i.'+_0x32c478);});}else{_0xe4e82a[_0x3b60('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3b60('0x5e'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0x97'),_0x3b60('0x98'));_0xe4e82a['field']('a.mandatoryDisposition',_0x3b60('0x99'));_0xe4e82a['field'](_0x3b60('0x9a'),'Account.email');_0xe4e82a[_0x3b60('0x4a')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3b60('0x89'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0x9b'));_0xe4e82a['field'](_0x3b60('0x9c'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0x9d'));_0xe4e82a['field'](_0x3b60('0x9e'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0x9f'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa0'));_0xe4e82a[_0x3b60('0x4a')]('i.lastMsgAt');_0xe4e82a[_0x3b60('0x4a')]('i.lastMsgDirection');_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa1'));_0xe4e82a['field'](_0x3b60('0xa2'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa3'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa4'));_0xe4e82a['field'](_0x3b60('0xa5'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa6'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa7'));_0xe4e82a[_0x3b60('0x4a')]('i.MailAccountId');_0xe4e82a['field']('i.UserId');_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa8'),'Contact.firstName');_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xa9'),'Contact.lastName');_0xe4e82a[_0x3b60('0x4a')]('c.email',_0x3b60('0xaa'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xab'),_0x3b60('0xac'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xad'),_0x3b60('0xae'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xaf'),'Contact.fax');_0xe4e82a[_0x3b60('0x4a')]('o.fullname','Owner.fullname');_0xe4e82a['field'](_0x3b60('0xb0'),_0x3b60('0xb1'));_0xe4e82a[_0x3b60('0x4a')](_0x3b60('0xb2'),_0x3b60('0x24'));}if(_0xc21bbb[_0x3b60('0x18')])_0xe4e82a[_0x3b60('0x18')](_0xc21bbb[_0x3b60('0x18')]);if(_0xc21bbb[_0x3b60('0x16')])_0xe4e82a[_0x3b60('0x16')](_0xc21bbb[_0x3b60('0x16')]);return db[_0x3b60('0x93')][_0x3b60('0x3c')](_0xe4e82a[_0x3b60('0x94')](),_0x5b0a6e);})[_0x3b60('0x1d')](function(_0x22bb6d){if(_0x22bb6d[_0x3b60('0x42')]>0x0)_0xbfe20c[_0x3b60('0x47')]('ui.MailInteractionId\x20IN\x20?',_[_0x3b60('0x37')](_0x22bb6d,'id'));return db[_0x3b60('0x93')][_0x3b60('0x3c')](_0xbfe20c['toString'](),_0x5b0a6e)[_0x3b60('0x1d')](function(_0x3e6ea6){var _0x5f5b87=_[_0x3b60('0xb3')](_0x3e6ea6,'MailInteractionId');var _0xb1cd=[];return db['Setting'][_0x3b60('0x29')]({'attributes':[_0x3b60('0xb4')],'raw':!![]})[_0x3b60('0x1d')](function(_0x14975f){var _0x28e090=_0x14975f[_0x3b60('0xb4')];_0x22bb6d[_0x3b60('0x26')](function(_0x4de7fb){_0xb1cd[_0x3b60('0x27')](updateMailInteraction(_0x4de7fb,_0xdd9d27,_0x5f5b87,_0x28e090));});return BPromise[_0x3b60('0xb5')](_0xb1cd);});});});})['then'](function(_0x587609){_0x1c97fc[_0x3b60('0xb6')]=_0x587609;return _0x1c97fc;})[_0x3b60('0x1d')](respondWithFilteredResult(_0x5dcb53,_0xc21bbb))[_0x3b60('0x2e')](handleError(_0x5dcb53,null));};exports[_0x3b60('0xb7')]=function(_0x1d8ee0,_0x47697a){var _0xb974ce={'raw':![],'where':{'id':_0x1d8ee0['params']['id']}},_0x780d14={};_0x780d14['model']=_[_0x3b60('0x3d')](db[_0x3b60('0x96')][_0x3b60('0x38')]);_0x780d14[_0x3b60('0x3c')]=_[_0x3b60('0x3d')](_0x1d8ee0[_0x3b60('0x3c')]);_0x780d14[_0x3b60('0x3e')]=_['intersection'](_0x780d14[_0x3b60('0x3b')],_0x780d14[_0x3b60('0x3c')]);_0xb974ce[_0x3b60('0x40')]=_[_0x3b60('0x3f')](_0x780d14[_0x3b60('0x3b')],qs['fields'](_0x1d8ee0[_0x3b60('0x3c')][_0x3b60('0x41')]));_0xb974ce[_0x3b60('0x40')]=_0xb974ce[_0x3b60('0x40')][_0x3b60('0x42')]?_0xb974ce[_0x3b60('0x40')]:_0x780d14[_0x3b60('0x3b')];if(_0x1d8ee0['query'][_0x3b60('0xb8')]){_0xb974ce[_0x3b60('0xb9')]=[{'all':!![]}];}_0xb974ce=_[_0x3b60('0xba')]({},_0xb974ce,_0x1d8ee0[_0x3b60('0xbb')]);return db[_0x3b60('0x96')][_0x3b60('0x70')](_0xb974ce)[_0x3b60('0x1d')](handleEntityNotFound(_0x47697a,null))[_0x3b60('0x1d')](respondWithResult(_0x47697a,null))[_0x3b60('0x2e')](handleError(_0x47697a,null));};exports[_0x3b60('0xbc')]=function(_0x1b3383,_0x6b1f60){return db[_0x3b60('0x96')][_0x3b60('0xbc')](_0x1b3383[_0x3b60('0xbd')],{})[_0x3b60('0x1d')](respondWithResult(_0x6b1f60,0xc9))[_0x3b60('0x2e')](handleError(_0x6b1f60,null));};exports[_0x3b60('0x1c')]=function(_0x37c350,_0x43e7f2){if(_0x37c350[_0x3b60('0xbd')]['id']){delete _0x37c350[_0x3b60('0xbd')]['id'];}return db[_0x3b60('0x96')]['find']({'where':{'id':_0x37c350['params']['id']}})[_0x3b60('0x1d')](handleEntityNotFound(_0x43e7f2,null))['then'](saveUpdates(_0x37c350[_0x3b60('0xbd')],null))[_0x3b60('0x1d')](respondWithResult(_0x43e7f2,null))[_0x3b60('0x2e')](handleError(_0x43e7f2,null));};exports[_0x3b60('0x1e')]=function(_0x52b760,_0x13b9a6){return db['MailInteraction'][_0x3b60('0x70')]({'where':{'id':_0x52b760['params']['id']}})['then'](handleEntityNotFound(_0x13b9a6,null))[_0x3b60('0x1d')](removeEntity(_0x13b9a6,null))[_0x3b60('0x2e')](handleError(_0x13b9a6,null));};exports['describe']=function(_0x114fb7,_0x2d406e){return db[_0x3b60('0x96')]['describe']()['then'](respondWithResult(_0x2d406e,null))[_0x3b60('0x2e')](handleError(_0x2d406e,null));};exports[_0x3b60('0xbe')]=function(_0x4850b4,_0x2b3c55){return db['MailMessage'][_0x3b60('0x70')]({'where':{'id':_0x4850b4['params']['id']}})[_0x3b60('0x1d')](handleEntityNotFound(_0x2b3c55,null))[_0x3b60('0x1d')](function(_0x2b532b){if(_0x2b532b){return _0x2b532b[_0x3b60('0xbe')](_0x4850b4['body'][_0x3b60('0xbf')],_['omit'](_0x4850b4[_0x3b60('0xbd')],['ids','id'])||{});}})[_0x3b60('0x1d')](respondWithResult(_0x2b3c55,null))['catch'](handleError(_0x2b3c55,null));};exports[_0x3b60('0xc0')]=function(_0xc948ec,_0x257028){var _0xd699ff={'raw':![],'where':{}};var _0x1933ed={};var _0x4e698f={'count':0x0,'rows':[]};return db[_0x3b60('0x96')][_0x3b60('0x29')]({'where':{'id':_0xc948ec['params']['id']}})[_0x3b60('0x1d')](handleEntityNotFound(_0x257028,null))[_0x3b60('0x1d')](function(_0x1c1b72){if(_0x1c1b72){_0x1933ed[_0x3b60('0x3b')]=_[_0x3b60('0x3d')](db['MailMessage'][_0x3b60('0x38')]);_0x1933ed[_0x3b60('0x3c')]=_[_0x3b60('0x3d')](_0xc948ec[_0x3b60('0x3c')]);_0x1933ed['filters']=_[_0x3b60('0x3f')](_0x1933ed[_0x3b60('0x3b')],_0x1933ed[_0x3b60('0x3c')]);_0xd699ff[_0x3b60('0x40')]=_[_0x3b60('0x3f')](_0x1933ed[_0x3b60('0x3b')],qs['fields'](_0xc948ec[_0x3b60('0x3c')][_0x3b60('0x41')]));_0xd699ff[_0x3b60('0x40')]=_0xd699ff[_0x3b60('0x40')]['length']?_0xd699ff[_0x3b60('0x40')]:_0x1933ed[_0x3b60('0x3b')];if(!_0xc948ec['query'][_0x3b60('0x43')](_0x3b60('0x44'))){_0xd699ff[_0x3b60('0x18')]=qs[_0x3b60('0x18')](_0xc948ec[_0x3b60('0x3c')][_0x3b60('0x18')]);_0xd699ff['offset']=qs['offset'](_0xc948ec[_0x3b60('0x3c')]['offset']);}_0xd699ff[_0x3b60('0x45')]=qs[_0x3b60('0x46')](_0xc948ec['query'][_0x3b60('0x46')]);_0xd699ff['where']=qs[_0x3b60('0x3e')](_['pick'](_0xc948ec[_0x3b60('0x3c')],_0x1933ed['filters']));_0xd699ff[_0x3b60('0x47')]['MailInteractionId']=_0x1c1b72['id'];if(_0xc948ec[_0x3b60('0x3c')][_0x3b60('0x7e')]){_0xd699ff['where']=_[_0x3b60('0xba')](_0xd699ff[_0x3b60('0x47')],{'$or':_[_0x3b60('0x37')](_0xd699ff[_0x3b60('0x40')],function(_0x110ca6){var _0x53b5c6={};_0x53b5c6[_0x110ca6]={'$like':'%'+_0xc948ec[_0x3b60('0x3c')][_0x3b60('0x7e')]+'%'};return _0x53b5c6;})});}if(_0xc948ec[_0x3b60('0x3c')][_0x3b60('0xc1')]){var _0x46b727=_0xc948ec[_0x3b60('0x3c')]['$gte'][_0x3b60('0x25')](',');var _0x12b5e3={};_0x12b5e3[_0x46b727[0x0]]={'$gte':moment(_0x46b727[0x1])[_0x3b60('0xc2')](_0x3b60('0xc3'))};_0xd699ff['where']=_[_0x3b60('0xba')](_0xd699ff[_0x3b60('0x47')],_0x12b5e3);}_0xd699ff=_[_0x3b60('0xba')]({},_0xd699ff,_0xc948ec[_0x3b60('0xbb')]);return db[_0x3b60('0x28')][_0x3b60('0x19')]({'where':_0xd699ff['where']})[_0x3b60('0x1d')](function(_0x274d03){_0x4e698f[_0x3b60('0x19')]=_0x274d03;if(_0xc948ec['query'][_0x3b60('0xb8')]){_0xd699ff['include']=[{'all':!![]}];}return db[_0x3b60('0x28')][_0x3b60('0xc4')](_0xd699ff);})[_0x3b60('0x1d')](function(_0x5e2c50){if(_0xc948ec[_0x3b60('0x3c')]['inlineCss']===_0x3b60('0xc5')){for(var _0x1cd601=0x0;_0x1cd601<_0x5e2c50['length'];_0x1cd601++){_0x5e2c50[_0x1cd601][_0x3b60('0xbd')]=juice(_0x5e2c50[_0x1cd601][_0x3b60('0xbd')]);}}_0x4e698f['rows']=_0x5e2c50;return _0x4e698f;});}})['then'](respondWithFilteredResult(_0x257028,_0xd699ff))[_0x3b60('0x2e')](handleError(_0x257028,null));};exports[_0x3b60('0xc6')]=function(_0x44fb3c,_0xc21d43){return db['MailInteraction'][_0x3b60('0x70')]({'where':{'id':_0x44fb3c[_0x3b60('0xc7')]['id']}})['then'](handleEntityNotFound(_0xc21d43,null))[_0x3b60('0x1d')](function(_0x44ec7e){if(_0x44ec7e){return _0x44ec7e[_0x3b60('0xc8')](_0x44fb3c['body'][_0x3b60('0xbf')],_[_0x3b60('0xc9')](_0x44fb3c['body'],[_0x3b60('0xbf'),'id'])||{})[_0x3b60('0xca')](function(){return db['Tag'][_0x3b60('0xc4')]({'attributes':['id',_0x3b60('0x20'),_0x3b60('0xcb')],'where':{'id':_0x44fb3c[_0x3b60('0xbd')][_0x3b60('0xbf')]}});})[_0x3b60('0x1d')](function(_0x33d635){socket['emit']('mailInteractionTags:save',{'id':Number(_0x44fb3c[_0x3b60('0xc7')]['id']),'tags':_0x33d635||[]});return{'id':Number(_0x44fb3c[_0x3b60('0xc7')]['id']),'tags':_0x33d635||[]};});}})[_0x3b60('0x1d')](respondWithResult(_0xc21d43,null))[_0x3b60('0x2e')](handleError(_0xc21d43,null));};exports[_0x3b60('0xcc')]=function(_0x222d0b,_0xb4e6a8){return db['MailInteraction'][_0x3b60('0x70')]({'where':{'id':_0x222d0b[_0x3b60('0xc7')]['id']}})[_0x3b60('0x1d')](handleEntityNotFound(_0xb4e6a8,null))[_0x3b60('0x1d')](function(_0x348460){if(_0x348460){return _0x348460[_0x3b60('0xcc')](_0x222d0b['query'][_0x3b60('0xbf')]);}})[_0x3b60('0x1d')](respondWithStatusCode(_0xb4e6a8,null))['catch'](handleError(_0xb4e6a8,null));};exports['download']=function(_0xc69561,_0x408cf2){var _0x2e36ef=moment()[_0x3b60('0xcd')]()['toString']();var _0x9e2a74=path[_0x3b60('0xce')](config[_0x3b60('0xcf')],_0x3b60('0xd0'),'files',_0x3b60('0xd1'));var _0x384fae=path[_0x3b60('0xce')](config[_0x3b60('0xcf')],_0x3b60('0xd0'),_0x3b60('0xd2'),_0x3b60('0xd3'));var _0x13b130=path[_0x3b60('0xce')](_0x9e2a74,_0x2e36ef);var _0x590480=util[_0x3b60('0xc2')](_0x3b60('0xd4'),_0xc69561['params']['id'],_0x2e36ef);var _0x51ff6f=path[_0x3b60('0xce')](_0x9e2a74,_0x590480);var _0x5e92de=[];if(_0xc69561[_0x3b60('0x3c')][_0x3b60('0xd3')]){_0x5e92de['push']({'model':db[_0x3b60('0xd5')],'as':_0x3b60('0xd6'),'raw':!![]});}var _0x125f7b=[{'model':db['MailMessage'],'as':_0x3b60('0xd7'),'attributes':['id',_0x3b60('0xbd'),'from','to','cc',_0x3b60('0xd8'),_0x3b60('0xd9'),_0x3b60('0x76')],'where':{'secret':![]},'order':qs[_0x3b60('0x46')]('id'),'include':_0x5e92de}];return db[_0x3b60('0x96')][_0x3b60('0x70')]({'where':{'id':_0xc69561[_0x3b60('0xc7')]['id']},'include':_0x125f7b})['then'](handleEntityNotFound(_0x408cf2,null))['then'](function(_0x5e6bf0){if(_0x5e6bf0&&_0x5e6bf0[_0x3b60('0xd7')]){var _0x2f2422=_0x5e6bf0['get']({'plain':!![]});fs[_0x3b60('0xda')](_0x13b130);return BPromise['each'](_0x2f2422[_0x3b60('0xd7')],function(_0x534c7d,_0x29cc23){var _0x78f2ee={'from':_0x534c7d[_0x3b60('0x52')],'to':_0x534c7d['to'],'subject':_0x534c7d[_0x3b60('0xd9')],'html':htmlEntities['decode'](_0x534c7d['body']),'headers':{'Date':moment(_0x534c7d[_0x3b60('0x76')])[_0x3b60('0xc2')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x534c7d['cc']){_0x78f2ee[_0x3b60('0xdb')]['Cc']=_0x534c7d['cc'];}if(_0x534c7d[_0x3b60('0xd8')]){_0x78f2ee[_0x3b60('0xdb')][_0x3b60('0xdc')]=_0x534c7d[_0x3b60('0xd8')];}return new BPromise(function(_0x52df8d,_0x49c7ff){if(_0x534c7d[_0x3b60('0xd6')]){for(var _0x38216c=0x0;_0x38216c<_0x534c7d[_0x3b60('0xd6')]['length'];_0x38216c++){var _0x4b6671=_0x534c7d[_0x3b60('0xd6')][_0x38216c];var _0x58aec8=path[_0x3b60('0xce')](_0x384fae,_0x4b6671[_0x3b60('0xdd')]);if(fs['existsSync'](_0x58aec8)){_0x78f2ee['attachments'][_0x3b60('0x27')]({'name':_0x4b6671['name'],'contentType':_0x4b6671[_0x3b60('0x39')],'data':fs[_0x3b60('0xde')](_0x58aec8)});}}}emlformat[_0x3b60('0xdf')](_0x78f2ee,function(_0x130ad5,_0xb93c27){if(_0x130ad5)return _0x49c7ff(_0x130ad5);fs[_0x3b60('0xe0')](path['join'](_0x13b130,util[_0x3b60('0xc2')](_0x3b60('0xe1'),_0x29cc23)),_0xb93c27);return _0x52df8d(_0xb93c27);});});})[_0x3b60('0x1d')](function(){return new BPromise(function(_0x23c61a,_0x3376da){zipdir(_0x13b130,{'saveTo':_0x51ff6f},function(_0x425a9a,_0x46ee76){if(_0x425a9a)return _0x3376da(_0x425a9a);return _0x23c61a(_0x46ee76);});})['then'](function(){return new BPromise(function(_0x5416cf,_0xb63cd2){rimraf(_0x13b130,function(_0x2222b9){if(_0x2222b9)_0xb63cd2(_0x2222b9);return _0x5416cf();});});})[_0x3b60('0x1d')](function(){return _0x408cf2['download'](_0x51ff6f,_0x590480,function(_0x17feec){if(!_0x17feec)fs[_0x3b60('0xe2')](_0x51ff6f);});});});}else{return _0x408cf2[_0x3b60('0x12')](0xc8);}})[_0x3b60('0x2e')](handleError(_0x408cf2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 527c1b0..f4eafce 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 _0xcec4=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xcec4,0x8c));var _0x4cec=function(_0x287cb6,_0x3ffa43){_0x287cb6=_0x287cb6-0x0;var _0x5176c8=_0xcec4[_0x287cb6];return _0x5176c8;};'use strict';var EventEmitter=require(_0x4cec('0x0'));var MailInteraction=require(_0x4cec('0x1'))['db'][_0x4cec('0x2')];var MailMessage=require(_0x4cec('0x1'))['db'][_0x4cec('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4cec('0x4')](0x0);var events={'afterCreate':_0x4cec('0x5'),'afterUpdate':_0x4cec('0x6'),'afterDestroy':_0x4cec('0x7')};function emitEvent(_0x3ec759){return function(_0x12d87b,_0x1c08a0,_0x5db3ea){_0x12d87b[_0x4cec('0x8')]({'attributes':['id'],'raw':!![]})[_0x4cec('0x9')](function(_0x4afb0e){_0x12d87b[_0x4cec('0xa')](_0x4cec('0xb'),_0x4afb0e[_0x4cec('0xc')](function(_0x2293e2){return{'id':_0x2293e2['id']};}));return MailMessage[_0x4cec('0xd')]({'where':{'MailInteractionId':_0x12d87b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30d0f3){_0x12d87b['setDataValue'](_0x4cec('0xe'),_0x30d0f3[_0x4cec('0xf')]);MailInteractionEvents[_0x4cec('0x10')](_0x3ec759+':'+_0x12d87b['id'],_0x12d87b);MailInteractionEvents[_0x4cec('0x10')](_0x3ec759,_0x12d87b);_0x5db3ea(null);})[_0x4cec('0x11')](_0x5db3ea(null));};}for(var e in events){if(events[_0x4cec('0x12')](e)){var event=events[e];MailInteraction[_0x4cec('0x13')](e,emitEvent(event));}}module[_0x4cec('0x14')]=MailInteractionEvents; \ No newline at end of file +var _0x1cbb=['length','emit','catch','hasOwnProperty','../../mysqldb','MailInteraction','MailMessage','save','update','remove','then','setDataValue','map','unreadMessages'];(function(_0x19b4ce,_0x187040){var _0x180b52=function(_0x44c611){while(--_0x44c611){_0x19b4ce['push'](_0x19b4ce['shift']());}};_0x180b52(++_0x187040);}(_0x1cbb,0x1c4));var _0xb1cb=function(_0x1644cf,_0x46f8c0){_0x1644cf=_0x1644cf-0x0;var _0x1a5d77=_0x1cbb[_0x1644cf];return _0x1a5d77;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xb1cb('0x0'))['db'][_0xb1cb('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xb1cb('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1cb('0x3'),'afterUpdate':_0xb1cb('0x4'),'afterDestroy':_0xb1cb('0x5')};function emitEvent(_0x10b0ae){return function(_0x45b8ee,_0x467524,_0x4194aa){_0x45b8ee['getUsers']({'attributes':['id'],'raw':!![]})[_0xb1cb('0x6')](function(_0x2dad4e){_0x45b8ee[_0xb1cb('0x7')]('Users',_0x2dad4e[_0xb1cb('0x8')](function(_0x46e612){return{'id':_0x46e612['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x45b8ee['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a62d0){_0x45b8ee[_0xb1cb('0x7')](_0xb1cb('0x9'),_0x2a62d0[_0xb1cb('0xa')]);MailInteractionEvents[_0xb1cb('0xb')](_0x10b0ae+':'+_0x45b8ee['id'],_0x45b8ee);MailInteractionEvents[_0xb1cb('0xb')](_0x10b0ae,_0x45b8ee);_0x4194aa(null);})[_0xb1cb('0xc')](_0x4194aa(null));};}for(var e in events){if(events[_0xb1cb('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index bf7685d..5dd9bcd 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 _0xead6=['substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','subject','FULLTEXT'];(function(_0x1474cd,_0xb479){var _0x170109=function(_0x20562d){while(--_0x20562d){_0x1474cd['push'](_0x1474cd['shift']());}};_0x170109(++_0xb479);}(_0xead6,0x152));var _0x6ead=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xead6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6ead('0x0'));var util=require(_0x6ead('0x1'));var logger=require(_0x6ead('0x2'))(_0x6ead('0x3'));var moment=require(_0x6ead('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ead('0x5'));var fs=require('fs');var path=require(_0x6ead('0x6'));var rimraf=require('rimraf');var config=require(_0x6ead('0x7'));var attributes=require(_0x6ead('0x8'));module[_0x6ead('0x9')]=function(_0x13b57f,_0x356874){return _0x13b57f[_0x6ead('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x6ead('0xb'),'to'],'type':_0x6ead('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11df88,_0x2b4c43,_0x3d1067){if(_0x11df88[_0x6ead('0xd')]){_0x11df88[_0x6ead('0xe')]=moment()[_0x6ead('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x11df88[_0x6ead('0x10')]){_0x11df88[_0x6ead('0x11')]=moment()[_0x6ead('0xf')](_0x6ead('0x12'));}_0x3d1067(null,_0x2b4c43);},'beforeUpdate':function(_0x4f34de,_0x51f919,_0x58fa1d){if(_0x4f34de[_0x6ead('0x13')](_0x6ead('0xd'))){_0x4f34de[_0x6ead('0xe')]=_0x4f34de[_0x6ead('0xd')]?moment()[_0x6ead('0xf')](_0x6ead('0x12')):null;}if(_0x4f34de[_0x6ead('0x13')](_0x6ead('0x10'))){_0x4f34de[_0x6ead('0x11')]=moment()['format'](_0x6ead('0x12'));_0x4f34de[_0x6ead('0xd')]=null;_0x4f34de[_0x6ead('0xe')]=null;}_0x58fa1d(null,_0x4f34de);},'afterUpdate':function(_0x3856a5,_0x3757e1,_0x4381c7){var _0x35b887=_0x13b57f[_0x6ead('0x14')];var _0x580385=_0x3856a5['get']({'plain':!![]});if(_0x580385[_0x6ead('0x10')]){return _0x35b887[_0x6ead('0x15')][_0x6ead('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x580385['id']}})[_0x6ead('0x17')](function(){_0x4381c7();})[_0x6ead('0x18')](function(_0x4cfcf6){_0x4381c7(_0x4cfcf6);});}else{_0x4381c7();}}},'charset':_0x6ead('0x19'),'collate':_0x6ead('0x1a')});}; \ No newline at end of file +var _0xbf00=['fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','substatusAt','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbf00,0xf9));var _0x0bf0=function(_0x4662e3,_0x3c9e27){_0x4662e3=_0x4662e3-0x0;var _0x3ab0e7=_0xbf00[_0x4662e3];return _0x3ab0e7;};'use strict';var _=require(_0x0bf0('0x0'));var util=require(_0x0bf0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0bf0('0x2'));var BPromise=require('bluebird');var rp=require(_0x0bf0('0x3'));var fs=require('fs');var path=require(_0x0bf0('0x4'));var rimraf=require(_0x0bf0('0x5'));var config=require(_0x0bf0('0x6'));var attributes=require(_0x0bf0('0x7'));module[_0x0bf0('0x8')]=function(_0x35d35f,_0x19bdf0){return _0x35d35f[_0x0bf0('0x9')](_0x0bf0('0xa'),attributes,{'tableName':_0x0bf0('0xb'),'paranoid':![],'indexes':[{'name':_0x0bf0('0xc'),'fields':[_0x0bf0('0xd'),'to'],'type':_0x0bf0('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f3a16,_0x56ff10,_0x1c19b1){if(_0x4f3a16[_0x0bf0('0xf')]){_0x4f3a16['substatusAt']=moment()[_0x0bf0('0x10')](_0x0bf0('0x11'));}if(_0x4f3a16[_0x0bf0('0x12')]){_0x4f3a16['closedAt']=moment()[_0x0bf0('0x10')](_0x0bf0('0x11'));}_0x1c19b1(null,_0x56ff10);},'beforeUpdate':function(_0x3d2473,_0x3bf520,_0x54ce9c){if(_0x3d2473[_0x0bf0('0x13')](_0x0bf0('0xf'))){_0x3d2473['substatusAt']=_0x3d2473[_0x0bf0('0xf')]?moment()[_0x0bf0('0x10')](_0x0bf0('0x11')):null;}if(_0x3d2473[_0x0bf0('0x13')](_0x0bf0('0x12'))){_0x3d2473[_0x0bf0('0x14')]=moment()[_0x0bf0('0x10')](_0x0bf0('0x11'));_0x3d2473[_0x0bf0('0xf')]=null;_0x3d2473[_0x0bf0('0x15')]=null;}_0x54ce9c(null,_0x3d2473);},'afterUpdate':function(_0x4d1789,_0x1a65ea,_0x446d40){var _0x47cb9e=_0x35d35f[_0x0bf0('0x16')];var _0x1dc24b=_0x4d1789['get']({'plain':!![]});if(_0x1dc24b['closed']){return _0x47cb9e[_0x0bf0('0x17')][_0x0bf0('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x1dc24b['id']}})[_0x0bf0('0x19')](function(){_0x446d40();})[_0x0bf0('0x1a')](function(_0x23f417){_0x446d40(_0x23f417);});}else{_0x446d40();}}},'charset':_0x0bf0('0x1b'),'collate':_0x0bf0('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 929f301..1d6a037 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 _0xc22d=['body','options','where','attributes','limit','debug','AddTagsToMailInteraction','MailInteraction','find','omit','ids','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateMailInteraction'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc22d,0xa8));var _0xdc22=function(_0x49a805,_0x54d533){_0x49a805=_0x49a805-0x0;var _0x51f8bc=_0xc22d[_0x49a805];return _0x51f8bc;};'use strict';var _=require(_0xdc22('0x0'));var util=require('util');var moment=require(_0xdc22('0x1'));var BPromise=require('bluebird');var rs=require(_0xdc22('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc22('0x3'))['db'];var utils=require(_0xdc22('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdc22('0x5'));var jayson=require(_0xdc22('0x6'));var client=jayson[_0xdc22('0x7')][_0xdc22('0x8')]({'port':0x232a});config[_0xdc22('0x9')]=_[_0xdc22('0xa')](config[_0xdc22('0x9')],{'host':_0xdc22('0xb'),'port':0x18eb});var socket=require(_0xdc22('0xc'))(new Redis(config['redis']));require(_0xdc22('0xd'))[_0xdc22('0xe')](socket);function respondWithRpcPromise(_0x1d5638,_0x212f92,_0x395cf4){return new BPromise(function(_0x24f7e5,_0x6fac02){return client[_0xdc22('0xf')](_0x1d5638,_0x395cf4)[_0xdc22('0x10')](function(_0x4c1aad){logger['info'](_0xdc22('0x11'),_0x212f92,_0xdc22('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x212f92,_0xdc22('0x12'),JSON[_0xdc22('0x13')](_0x4c1aad));if(_0x4c1aad[_0xdc22('0x14')]){if(_0x4c1aad[_0xdc22('0x14')][_0xdc22('0x15')]===0x1f4){logger[_0xdc22('0x14')](_0xdc22('0x11'),_0x212f92,_0x4c1aad['error'][_0xdc22('0x16')]);return _0x6fac02(_0x4c1aad[_0xdc22('0x14')]['message']);}logger[_0xdc22('0x14')](_0xdc22('0x11'),_0x212f92,_0x4c1aad[_0xdc22('0x14')]['message']);return _0x24f7e5(_0x4c1aad[_0xdc22('0x14')][_0xdc22('0x16')]);}else{logger[_0xdc22('0x17')](_0xdc22('0x11'),_0x212f92,_0xdc22('0x12'));_0x24f7e5(_0x4c1aad[_0xdc22('0x18')][_0xdc22('0x16')]);}})[_0xdc22('0x19')](function(_0xfe6ef3){logger['error']('MailInteraction,\x20%s,\x20%s',_0x212f92,_0xfe6ef3);_0x6fac02(_0xfe6ef3);});});}exports[_0xdc22('0x1a')]=function(_0x132266){var _0x16de1a=this;return new Promise(function(_0x3a89e8,_0x2082c3){return db['MailInteraction']['update'](_0x132266[_0xdc22('0x1b')],{'raw':_0x132266[_0xdc22('0x1c')]?_0x132266[_0xdc22('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132266[_0xdc22('0x1c')]?_0x132266[_0xdc22('0x1c')][_0xdc22('0x1d')]||null:null,'attributes':_0x132266['options']?_0x132266[_0xdc22('0x1c')][_0xdc22('0x1e')]||null:null,'limit':_0x132266['options']?_0x132266[_0xdc22('0x1c')][_0xdc22('0x1f')]||null:null})[_0xdc22('0x10')](function(_0x1e4d93){logger['info']('UpdateMailInteraction',_0x132266);logger[_0xdc22('0x20')]('UpdateMailInteraction',_0x132266,JSON[_0xdc22('0x13')](_0x1e4d93));_0x3a89e8(_0x1e4d93);})[_0xdc22('0x19')](function(_0x304dbd){logger[_0xdc22('0x14')](_0xdc22('0x1a'),_0x304dbd[_0xdc22('0x16')],_0x132266);_0x2082c3(_0x16de1a['error'](0x1f4,_0x304dbd['message']));});});};exports[_0xdc22('0x21')]=function(_0x4e8aac){return new Promise(function(_0x204609,_0x3eea7f){return db[_0xdc22('0x22')][_0xdc22('0x23')]({'where':_0x4e8aac['options']?_0x4e8aac[_0xdc22('0x1c')][_0xdc22('0x1d')]||null:null})[_0xdc22('0x10')](function(_0x20d8c3){if(_0x20d8c3){return _0x20d8c3['addTags'](_0x4e8aac['body']['ids'],_[_0xdc22('0x24')](_0x4e8aac[_0xdc22('0x1b')],[_0xdc22('0x25'),'id'])||{});}})['spread'](function(_0x5f451c){logger[_0xdc22('0x17')](_0xdc22('0x26'),_0x4e8aac);logger[_0xdc22('0x20')](_0xdc22('0x26'),_0x4e8aac,JSON[_0xdc22('0x13')](_0x5f451c));_0x204609(_0x5f451c);})[_0xdc22('0x19')](function(_0x149af9){logger[_0xdc22('0x14')](_0xdc22('0x26'),_0x149af9[_0xdc22('0x16')],_0x4e8aac);_0x3eea7f(_this[_0xdc22('0x14')](0x1f4,_0x149af9['message']));});});}; \ No newline at end of file +var _0x4a42=['catch','AddTagsToMailInteraction','find','then','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailInteraction.socket','register','request','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','result','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit'];(function(_0x26f342,_0x2e5617){var _0x5b6c18=function(_0x46615f){while(--_0x46615f){_0x26f342['push'](_0x26f342['shift']());}};_0x5b6c18(++_0x2e5617);}(_0x4a42,0x158));var _0x24a4=function(_0xc2f9d5,_0x29e742){_0xc2f9d5=_0xc2f9d5-0x0;var _0x4c8a6e=_0x4a42[_0xc2f9d5];return _0x4c8a6e;};'use strict';var _=require(_0x24a4('0x0'));var util=require(_0x24a4('0x1'));var moment=require(_0x24a4('0x2'));var BPromise=require(_0x24a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24a4('0x4'))['db'];var utils=require(_0x24a4('0x5'));var logger=require(_0x24a4('0x6'))(_0x24a4('0x7'));var config=require(_0x24a4('0x8'));var jayson=require(_0x24a4('0x9'));var client=jayson[_0x24a4('0xa')]['http']({'port':0x232a});config[_0x24a4('0xb')]=_[_0x24a4('0xc')](config[_0x24a4('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x24a4('0xd'))[_0x24a4('0xe')](socket);function respondWithRpcPromise(_0x50eb13,_0x1e9b31,_0x551b40){return new BPromise(function(_0x4cc074,_0x4ac2a0){return client[_0x24a4('0xf')](_0x50eb13,_0x551b40)['then'](function(_0x38eaa2){logger['info']('MailInteraction,\x20%s,\x20%s',_0x1e9b31,_0x24a4('0x10'));logger[_0x24a4('0x11')](_0x24a4('0x12'),_0x1e9b31,_0x24a4('0x10'),JSON[_0x24a4('0x13')](_0x38eaa2));if(_0x38eaa2[_0x24a4('0x14')]){if(_0x38eaa2[_0x24a4('0x14')][_0x24a4('0x15')]===0x1f4){logger[_0x24a4('0x14')](_0x24a4('0x16'),_0x1e9b31,_0x38eaa2[_0x24a4('0x14')]['message']);return _0x4ac2a0(_0x38eaa2[_0x24a4('0x14')][_0x24a4('0x17')]);}logger['error'](_0x24a4('0x16'),_0x1e9b31,_0x38eaa2[_0x24a4('0x14')]['message']);return _0x4cc074(_0x38eaa2[_0x24a4('0x14')][_0x24a4('0x17')]);}else{logger[_0x24a4('0x18')]('MailInteraction,\x20%s,\x20%s',_0x1e9b31,_0x24a4('0x10'));_0x4cc074(_0x38eaa2[_0x24a4('0x19')]['message']);}})['catch'](function(_0x3eee66){logger[_0x24a4('0x14')](_0x24a4('0x16'),_0x1e9b31,_0x3eee66);_0x4ac2a0(_0x3eee66);});});}exports[_0x24a4('0x1a')]=function(_0xba91ab){var _0x79ed2c=this;return new Promise(function(_0x1d22f8,_0x5cd7b1){return db[_0x24a4('0x1b')]['update'](_0xba91ab[_0x24a4('0x1c')],{'raw':_0xba91ab['options']?_0xba91ab[_0x24a4('0x1d')][_0x24a4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba91ab[_0x24a4('0x1d')]?_0xba91ab['options'][_0x24a4('0x1f')]||null:null,'attributes':_0xba91ab['options']?_0xba91ab['options'][_0x24a4('0x20')]||null:null,'limit':_0xba91ab[_0x24a4('0x1d')]?_0xba91ab[_0x24a4('0x1d')][_0x24a4('0x21')]||null:null})['then'](function(_0x4add3c){logger[_0x24a4('0x18')]('UpdateMailInteraction',_0xba91ab);logger['debug'](_0x24a4('0x1a'),_0xba91ab,JSON[_0x24a4('0x13')](_0x4add3c));_0x1d22f8(_0x4add3c);})[_0x24a4('0x22')](function(_0x2f3d08){logger[_0x24a4('0x14')](_0x24a4('0x1a'),_0x2f3d08[_0x24a4('0x17')],_0xba91ab);_0x5cd7b1(_0x79ed2c[_0x24a4('0x14')](0x1f4,_0x2f3d08[_0x24a4('0x17')]));});});};exports[_0x24a4('0x23')]=function(_0x5a037c){return new Promise(function(_0x274502,_0x425b42){return db[_0x24a4('0x1b')][_0x24a4('0x24')]({'where':_0x5a037c[_0x24a4('0x1d')]?_0x5a037c[_0x24a4('0x1d')]['where']||null:null})[_0x24a4('0x25')](function(_0x5ac9dd){if(_0x5ac9dd){return _0x5ac9dd[_0x24a4('0x26')](_0x5a037c[_0x24a4('0x1c')][_0x24a4('0x27')],_['omit'](_0x5a037c[_0x24a4('0x1c')],[_0x24a4('0x27'),'id'])||{});}})[_0x24a4('0x28')](function(_0x12c76f){logger['info'](_0x24a4('0x29'),_0x5a037c);logger[_0x24a4('0x11')](_0x24a4('0x29'),_0x5a037c,JSON[_0x24a4('0x13')](_0x12c76f));_0x274502(_0x12c76f);})['catch'](function(_0x3eea77){logger[_0x24a4('0x14')](_0x24a4('0x29'),_0x3eea77[_0x24a4('0x17')],_0x5a037c);_0x425b42(_this[_0x24a4('0x14')](0x1f4,_0x3eea77[_0x24a4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d302b42..5943313 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 _0xd0c9=['remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd0c9,0x9f));var _0x9d0c=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd0c9[_0x346737];return _0x1ade2e;};'use strict';var MailInteractionEvents=require(_0x9d0c('0x0'));var events=['save',_0x9d0c('0x1'),_0x9d0c('0x2')];function createListener(_0x35bdf5,_0x2d3cd6){return function(_0x50e72d){_0x2d3cd6[_0x9d0c('0x3')](_0x35bdf5,_0x50e72d);};}function removeListener(_0x12f322,_0x5f4495){return function(){MailInteractionEvents[_0x9d0c('0x4')](_0x12f322,_0x5f4495);};}exports[_0x9d0c('0x5')]=function(_0x13d845){for(var _0x128e01=0x0,_0x388030=events[_0x9d0c('0x6')];_0x128e01<_0x388030;_0x128e01++){var _0x33b066=events[_0x128e01];var _0x127576=createListener(_0x9d0c('0x7')+_0x33b066,_0x13d845);MailInteractionEvents['on'](_0x33b066,_0x127576);}}; \ No newline at end of file +var _0x3c65=['removeListener','mailInteraction:','update','emit'];(function(_0xe3bb46,_0x4ba544){var _0x45001c=function(_0x28afa0){while(--_0x28afa0){_0xe3bb46['push'](_0xe3bb46['shift']());}};_0x45001c(++_0x4ba544);}(_0x3c65,0x146));var _0x53c6=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x3c65[_0x3a8db5];return _0x2c03cd;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove',_0x53c6('0x0')];function createListener(_0x47aa62,_0x55bf4d){return function(_0x349e9a){_0x55bf4d[_0x53c6('0x1')](_0x47aa62,_0x349e9a);};}function removeListener(_0x5cceae,_0x3fb758){return function(){MailInteractionEvents[_0x53c6('0x2')](_0x5cceae,_0x3fb758);};}exports['register']=function(_0x2e7de4){for(var _0x310099=0x0,_0x469f8e=events['length'];_0x310099<_0x469f8e;_0x310099++){var _0x3631dc=events[_0x310099];var _0x312a89=createListener(_0x53c6('0x3')+_0x3631dc,_0x2e7de4);MailInteractionEvents['on'](_0x3631dc,_0x312a89);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9060af3..c79bb07 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 _0x65d2=['mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x2feb6c,_0xad7ddc){var _0x179b28=function(_0x3ef838){while(--_0x3ef838){_0x2feb6c['push'](_0x2feb6c['shift']());}};_0x179b28(++_0xad7ddc);}(_0x65d2,0xb8));var _0x265d=function(_0x3e12d6,_0x23835b){_0x3e12d6=_0x3e12d6-0x0;var _0x120759=_0x65d2[_0x3e12d6];return _0x120759;};'use strict';var multer=require(_0x265d('0x0'));var util=require(_0x265d('0x1'));var path=require('path');var timeout=require(_0x265d('0x2'));var express=require(_0x265d('0x3'));var router=express[_0x265d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x265d('0x5'));var interaction=require(_0x265d('0x6'));var config=require(_0x265d('0x7'));var controller=require('./mailMessage.controller');router[_0x265d('0x8')]('/',auth[_0x265d('0x9')](),controller[_0x265d('0xa')]);router[_0x265d('0x8')](_0x265d('0xb'),auth['isAuthenticated'](),controller[_0x265d('0xc')]);router[_0x265d('0x8')](_0x265d('0xd'),auth[_0x265d('0x9')](),controller[_0x265d('0xe')]);router['get'](_0x265d('0xf'),auth[_0x265d('0x9')](),controller['download']);router[_0x265d('0x10')]('/',auth[_0x265d('0x9')](),interaction[_0x265d('0x11')](_0x265d('0x12'),_0x265d('0x13')),controller['create']);router[_0x265d('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x265d('0x15')]);router[_0x265d('0x14')](_0x265d('0x16'),auth[_0x265d('0x9')](),controller[_0x265d('0x17')]);router['put'](_0x265d('0x18'),auth[_0x265d('0x9')](),controller[_0x265d('0x19')]);router[_0x265d('0x1a')](_0x265d('0xd'),auth[_0x265d('0x9')](),controller[_0x265d('0x1b')]);module[_0x265d('0x1c')]=router; \ No newline at end of file +var _0x693f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','isAuthenticated','show','download','tracked','mail','mailmessage:create','create','update','/:id/accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x1d6657,_0x46f914){var _0xa997e0=function(_0x20b644){while(--_0x20b644){_0x1d6657['push'](_0x1d6657['shift']());}};_0xa997e0(++_0x46f914);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var path=require(_0xf693('0x2'));var timeout=require(_0xf693('0x3'));var express=require('express');var router=express[_0xf693('0x4')]();var fs_extra=require(_0xf693('0x5'));var auth=require(_0xf693('0x6'));var interaction=require(_0xf693('0x7'));var config=require(_0xf693('0x8'));var controller=require(_0xf693('0x9'));router[_0xf693('0xa')]('/',auth['isAuthenticated'](),controller[_0xf693('0xb')]);router[_0xf693('0xa')]('/describe',auth[_0xf693('0xc')](),controller['describe']);router[_0xf693('0xa')]('/:id',auth[_0xf693('0xc')](),controller[_0xf693('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf693('0xe')]);router['post']('/',auth[_0xf693('0xc')](),interaction[_0xf693('0xf')](_0xf693('0x10'),_0xf693('0x11')),controller[_0xf693('0x12')]);router['put']('/:id',auth[_0xf693('0xc')](),controller[_0xf693('0x13')]);router['put'](_0xf693('0x14'),auth[_0xf693('0xc')](),controller['accept']);router['put'](_0xf693('0x15'),auth[_0xf693('0xc')](),controller[_0xf693('0x16')]);router[_0xf693('0x17')](_0xf693('0x18'),auth['isAuthenticated'](),controller[_0xf693('0x19')]);module[_0xf693('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e7c2f9b..6695dbc 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 _0x2396=['STRING','DATE','INTEGER','Email','Chat','sequelize','exports','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x51fb53,_0x398d31){var _0x53ba54=function(_0x2fa088){while(--_0x2fa088){_0x51fb53['push'](_0x51fb53['shift']());}};_0x53ba54(++_0x398d31);}(_0x2396,0xb9));var _0x6239=function(_0x465aa9,_0x1bf1c8){_0x465aa9=_0x465aa9-0x0;var _0x4104e4=_0x2396[_0x465aa9];return _0x4104e4;};'use strict';var Sequelize=require(_0x6239('0x0'));var _=require('lodash');module[_0x6239('0x1')]={'body':{'type':Sequelize[_0x6239('0x2')](_0x6239('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6239('0x2')]('medium')},'read':{'type':Sequelize[_0x6239('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6239('0x5')]('in',_0x6239('0x6')),'defaultValue':_0x6239('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6239('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x6239('0x2')](_0x6239('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x6239('0x3'))},'bcc':{'type':Sequelize[_0x6239('0x2')](_0x6239('0x3'))},'subject':{'type':Sequelize[_0x6239('0x2')]},'sentAt':{'type':Sequelize[_0x6239('0x8')]},'attach':{'type':Sequelize[_0x6239('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6239('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6239('0x2')](_0x6239('0x3'))},'originCc':{'type':Sequelize[_0x6239('0x2')]('long')},'originChannel':{'type':Sequelize[_0x6239('0x5')](_0x6239('0xa'),_0x6239('0xb')),'defaultValue':_0x6239('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xca4a=['INTEGER','BOOLEAN','DATE','Email','Chat','sequelize','exports','TEXT','long','ENUM','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca4a,0xd6));var _0xaca4=function(_0x1e0d21,_0x759889){_0x1e0d21=_0x1e0d21-0x0;var _0x33d79d=_0xca4a[_0x1e0d21];return _0x33d79d;};'use strict';var Sequelize=require(_0xaca4('0x0'));var _=require('lodash');module[_0xaca4('0x1')]={'body':{'type':Sequelize[_0xaca4('0x2')](_0xaca4('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xaca4('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaca4('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xaca4('0x5')](0x1fe)},'from':{'type':Sequelize[_0xaca4('0x5')]},'to':{'type':Sequelize[_0xaca4('0x2')](_0xaca4('0x3'))},'cc':{'type':Sequelize[_0xaca4('0x2')]('long')},'bcc':{'type':Sequelize[_0xaca4('0x2')](_0xaca4('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xaca4('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaca4('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaca4('0x8')]},'originTo':{'type':Sequelize[_0xaca4('0x2')](_0xaca4('0x3'))},'originCc':{'type':Sequelize[_0xaca4('0x2')]('long')},'originChannel':{'type':Sequelize[_0xaca4('0x4')](_0xaca4('0x9'),_0xaca4('0xa')),'defaultValue':_0xaca4('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 323067f..30f29e6 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 _0x907f=['path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','update','destroy','end','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','length','include','find','body','params','describe','create','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','basename','Contacts','List\x20not\x20found','SendMail','messageId','mail','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','email','fromString','rejectmessage','download','unix','toString','tmp','files','message-%s.eml','bcc','subject','createdAt','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','join','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x907f,0x1da));var _0xf907=function(_0x5ea149,_0x1986f3){_0x5ea149=_0x5ea149-0x0;var _0xf85b70=_0x907f[_0x5ea149];return _0xf85b70;};'use strict';var emlformat=require('eml-format');var moment=require(_0xf907('0x0'));var BPromise=require(_0xf907('0x1'));var util=require(_0xf907('0x2'));var path=require(_0xf907('0x3'));var fs=require('fs');var _=require(_0xf907('0x4'));var Redis=require(_0xf907('0x5'));var htmlToText=require(_0xf907('0x6'));var qs=require(_0xf907('0x7'));var logger=require('../../config/logger')(_0xf907('0x8'));var interaction_log=require(_0xf907('0x9'))('mail-interactions');var config=require(_0xf907('0xa'));var db=require(_0xf907('0xb'))['db'];config[_0xf907('0xc')]=_[_0xf907('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf907('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0xf907('0xf'));require(_0xf907('0x10'))[_0xf907('0x11')](socket);var jayson=require(_0xf907('0x12'));var client=jayson[_0xf907('0x13')]['http']({'port':0x232c});var client9003=jayson[_0xf907('0x13')]['http']({'port':0x232b});var client9002=jayson['client'][_0xf907('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1fc22e,_0xa9f710,_0x564ef9,_0x2354b4){return new BPromise(function(_0x3426c1,_0x28e5cc){var _0x11518f=_0x2354b4||client;return _0x11518f[_0xf907('0x15')](_0x1fc22e,_0x564ef9)[_0xf907('0x16')](function(_0x48a760){logger[_0xf907('0x17')](_0xf907('0x18'),_0xa9f710,_0xf907('0x19'));logger[_0xf907('0x1a')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xa9f710,_0xf907('0x19'),JSON[_0xf907('0x1b')](_0x48a760));if(_0x48a760['error']){if(_0x48a760[_0xf907('0x1c')][_0xf907('0x1d')]===0x1f4){logger['error'](_0xf907('0x18'),_0xa9f710,_0x48a760['error'][_0xf907('0x1e')]);return _0x28e5cc(_0x48a760['error'][_0xf907('0x1e')]);}logger[_0xf907('0x1c')]('MailMessage,\x20%s,\x20%s',_0xa9f710,_0x48a760['error'][_0xf907('0x1e')]);return _0x3426c1(_0x48a760[_0xf907('0x1c')]['message']);}else{logger[_0xf907('0x17')]('MailMessage,\x20%s,\x20%s',_0xa9f710,_0xf907('0x19'));_0x3426c1(_0x48a760[_0xf907('0x1f')][_0xf907('0x1e')]);}})[_0xf907('0x20')](function(_0x569ee8){logger[_0xf907('0x1c')](_0xf907('0x18'),_0xa9f710,_0x569ee8);_0x28e5cc(_0x569ee8);});});}function respondWithResult(_0x3b3b20,_0x3b71ca){_0x3b71ca=_0x3b71ca||0xc8;return function(_0x17220b){if(_0x17220b){return _0x3b3b20[_0xf907('0x21')](_0x3b71ca)[_0xf907('0x22')](_0x17220b);}};}function respondWithFilteredResult(_0x148fd4,_0x35cbc2){return function(_0x517a5b){if(_0x517a5b){var _0x1e0dd6=typeof _0x35cbc2[_0xf907('0x23')]===_0xf907('0x24')&&typeof _0x35cbc2['limit']===_0xf907('0x24');var _0x34469c=_0x517a5b[_0xf907('0x25')];var _0x160c16=_0x1e0dd6?0x0:_0x35cbc2[_0xf907('0x23')];var _0x4d48a9=_0x1e0dd6?_0x517a5b['count']:_0x35cbc2[_0xf907('0x23')]+_0x35cbc2[_0xf907('0x26')];var _0x51b505;if(_0x4d48a9>=_0x34469c){_0x4d48a9=_0x34469c;_0x51b505=0xc8;}else{_0x51b505=0xce;}_0x148fd4[_0xf907('0x21')](_0x51b505);return _0x148fd4['set']('Content-Range',_0x160c16+'-'+_0x4d48a9+'/'+_0x34469c)[_0xf907('0x22')](_0x517a5b);}return null;};}function saveUpdates(_0xe222cf){return function(_0x271dd7){if(_0x271dd7){return _0x271dd7[_0xf907('0x27')](_0xe222cf)['then'](function(_0x2d40a3){return _0x2d40a3;});}return null;};}function removeEntity(_0x1917e9){return function(_0x37aa15){if(_0x37aa15){return _0x37aa15[_0xf907('0x28')]()[_0xf907('0x16')](function(){_0x1917e9[_0xf907('0x21')](0xcc)[_0xf907('0x29')]();});}};}function handleEntityNotFound(_0x5bbbab){return function(_0x2bfa6f){if(!_0x2bfa6f){_0x5bbbab['sendStatus'](0x194);}return _0x2bfa6f;};}function handleError(_0x181141,_0x11aea3){_0x11aea3=_0x11aea3||0x1f4;return function(_0x4d5094){logger[_0xf907('0x1c')](_0x4d5094['stack']);if(_0x4d5094[_0xf907('0x2a')]){delete _0x4d5094['name'];}_0x181141[_0xf907('0x21')](_0x11aea3)[_0xf907('0x2b')](_0x4d5094);};}exports[_0xf907('0x2c')]=function(_0x24659c,_0x57a49a){var _0x1f4ff0={},_0x320fae={},_0x45b876={'count':0x0,'rows':[]};var _0x49cfe7=_[_0xf907('0x2d')](db[_0xf907('0x2e')][_0xf907('0x2f')],function(_0x54b50d){return{'name':_0x54b50d[_0xf907('0x30')],'type':_0x54b50d[_0xf907('0x31')][_0xf907('0x32')]};});_0x320fae[_0xf907('0x33')]=_[_0xf907('0x2d')](_0x49cfe7,'name');_0x320fae[_0xf907('0x34')]=_[_0xf907('0x35')](_0x24659c[_0xf907('0x34')]);_0x320fae[_0xf907('0x36')]=_[_0xf907('0x37')](_0x320fae['model'],_0x320fae[_0xf907('0x34')]);_0x1f4ff0[_0xf907('0x38')]=_[_0xf907('0x37')](_0x320fae[_0xf907('0x33')],qs[_0xf907('0x39')](_0x24659c[_0xf907('0x34')][_0xf907('0x39')]));_0x1f4ff0[_0xf907('0x38')]=_0x1f4ff0['attributes']['length']?_0x1f4ff0[_0xf907('0x38')]:_0x320fae[_0xf907('0x33')];if(!_0x24659c['query'][_0xf907('0x3a')](_0xf907('0x3b'))){_0x1f4ff0[_0xf907('0x26')]=qs['limit'](_0x24659c[_0xf907('0x34')][_0xf907('0x26')]);_0x1f4ff0[_0xf907('0x23')]=qs['offset'](_0x24659c[_0xf907('0x34')][_0xf907('0x23')]);}_0x1f4ff0[_0xf907('0x3c')]=qs[_0xf907('0x3d')](_0x24659c[_0xf907('0x34')]['sort']);_0x1f4ff0[_0xf907('0x3e')]=qs[_0xf907('0x36')](_[_0xf907('0x3f')](_0x24659c[_0xf907('0x34')],_0x320fae[_0xf907('0x36')]),_0x49cfe7);if(_0x24659c[_0xf907('0x34')][_0xf907('0x40')]){_0x1f4ff0['where']=_[_0xf907('0x41')](_0x1f4ff0[_0xf907('0x3e')],{'$or':_[_0xf907('0x2d')](_0x49cfe7,function(_0x49fdba){if(_0x49fdba[_0xf907('0x31')]!==_0xf907('0x42')){var _0x4a0ec6={};_0x4a0ec6[_0x49fdba[_0xf907('0x2a')]]={'$like':'%'+_0x24659c['query'][_0xf907('0x40')]+'%'};return _0x4a0ec6;}})});}_0x1f4ff0=_[_0xf907('0x41')]({},_0x1f4ff0,_0x24659c[_0xf907('0x43')]);var _0x1f893b={'where':_0x1f4ff0['where']};return db[_0xf907('0x2e')][_0xf907('0x25')](_0x1f893b)[_0xf907('0x16')](function(_0x2e9aaa){_0x45b876[_0xf907('0x25')]=_0x2e9aaa;if(_0x24659c[_0xf907('0x34')][_0xf907('0x44')]){_0x1f4ff0['include']=[{'all':!![]}];}return db[_0xf907('0x2e')][_0xf907('0x45')](_0x1f4ff0);})['then'](function(_0x16c161){_0x45b876[_0xf907('0x46')]=_0x16c161;return _0x45b876;})[_0xf907('0x16')](respondWithFilteredResult(_0x57a49a,_0x1f4ff0))['catch'](handleError(_0x57a49a,null));};exports[_0xf907('0x47')]=function(_0x275664,_0x738727){var _0x1fbd14={'raw':!![],'where':{'id':_0x275664['params']['id']}},_0x19f211={};_0x19f211[_0xf907('0x33')]=_[_0xf907('0x35')](db['MailMessage'][_0xf907('0x2f')]);_0x19f211[_0xf907('0x34')]=_[_0xf907('0x35')](_0x275664['query']);_0x19f211[_0xf907('0x36')]=_[_0xf907('0x37')](_0x19f211[_0xf907('0x33')],_0x19f211[_0xf907('0x34')]);_0x1fbd14[_0xf907('0x38')]=_[_0xf907('0x37')](_0x19f211[_0xf907('0x33')],qs[_0xf907('0x39')](_0x275664['query'][_0xf907('0x39')]));_0x1fbd14[_0xf907('0x38')]=_0x1fbd14[_0xf907('0x38')][_0xf907('0x48')]?_0x1fbd14['attributes']:_0x19f211[_0xf907('0x33')];if(_0x275664['query'][_0xf907('0x44')]){_0x1fbd14[_0xf907('0x49')]=[{'all':!![]}];}_0x1fbd14=_[_0xf907('0x41')]({},_0x1fbd14,_0x275664[_0xf907('0x43')]);return db[_0xf907('0x2e')][_0xf907('0x4a')](_0x1fbd14)['then'](handleEntityNotFound(_0x738727,null))[_0xf907('0x16')](respondWithResult(_0x738727,null))[_0xf907('0x20')](handleError(_0x738727,null));};exports['update']=function(_0x1d5981,_0x2179dc){if(_0x1d5981[_0xf907('0x4b')]['id']){delete _0x1d5981[_0xf907('0x4b')]['id'];}return db[_0xf907('0x2e')][_0xf907('0x4a')]({'where':{'id':_0x1d5981[_0xf907('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2179dc,null))['then'](saveUpdates(_0x1d5981[_0xf907('0x4b')],null))[_0xf907('0x16')](respondWithResult(_0x2179dc,null))[_0xf907('0x20')](handleError(_0x2179dc,null));};exports[_0xf907('0x28')]=function(_0x53f955,_0x15ab41){return db[_0xf907('0x2e')][_0xf907('0x4a')]({'where':{'id':_0x53f955[_0xf907('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15ab41,null))[_0xf907('0x16')](removeEntity(_0x15ab41,null))[_0xf907('0x20')](handleError(_0x15ab41,null));};exports[_0xf907('0x4d')]=function(_0x2fedfc,_0xf79534){return db[_0xf907('0x2e')][_0xf907('0x4d')]()[_0xf907('0x16')](respondWithResult(_0xf79534,null))[_0xf907('0x20')](handleError(_0xf79534,null));};exports[_0xf907('0x4e')]=function(_0x8cbc6d,_0x223310){return db['MailMessage'][_0xf907('0x4e')](_0x8cbc6d[_0xf907('0x4b')])[_0xf907('0x16')](function(_0x4ec307){if(_0x4ec307){if(_0x4ec307['direction']==='out'&&!_0x4ec307[_0xf907('0x4f')]){var _0x294f3c,_0x12ef00,_0x368aa5;if(_0x8cbc6d['body']['to']){_0x12ef00=_0x8cbc6d[_0xf907('0x4b')]['to'][_0xf907('0x50')](',')[0x0];}return db[_0xf907('0x51')]['findOne']({'where':{'id':_0x4ec307[_0xf907('0x52')]},'include':[{'model':db[_0xf907('0x53')],'as':_0xf907('0x54'),'include':[{'model':db[_0xf907('0x55')],'as':'Contacts','where':{'email':_0x12ef00},'limit':0x1,'order':[[_0xf907('0x56'),_0xf907('0x57')]]}]},{'model':db[_0xf907('0x58')],'as':_0xf907('0x59'),'raw':!![],'include':[{'model':db[_0xf907('0x5a')],'as':_0xf907('0x5a'),'raw':!![]}]}]})[_0xf907('0x16')](function(_0x5b5fba){_0x294f3c=_0x5b5fba;if(!_0x294f3c||!_0x294f3c[_0xf907('0x59')])return;var _0x1a53ad=_0x294f3c[_0xf907('0x5b')]();if(_0x8cbc6d[_0xf907('0x4b')][_0xf907('0x5c')]&&_0x8cbc6d['body']['attachments'][_0xf907('0x48')]){for(var _0x4f0678=0x0;_0x4f0678<_0x8cbc6d[_0xf907('0x4b')][_0xf907('0x5c')][_0xf907('0x48')];_0x4f0678+=0x1){_0x8cbc6d[_0xf907('0x4b')][_0xf907('0x5c')][_0x4f0678]={'filename':_0x8cbc6d[_0xf907('0x4b')]['attachments'][_0x4f0678][_0xf907('0x2a')],'path':path['join'](config[_0xf907('0x5d')],'server/files/attachments',_0x8cbc6d['body'][_0xf907('0x5c')][_0x4f0678][_0xf907('0x5e')])};}}_0x368aa5={'account':_0x1a53ad,'message':_0x8cbc6d[_0xf907('0x4b')]};return;})[_0xf907('0x16')](function(){if(_0x294f3c['List']){if(_0x294f3c[_0xf907('0x54')]['Contacts'][_0xf907('0x48')]){return _0x294f3c[_0xf907('0x54')][_0xf907('0x5f')][0x0];}else{return db['CmContact'][_0xf907('0x4e')](_[_0xf907('0xd')](_0x8cbc6d[_0xf907('0x4b')],{'firstName':_0x8cbc6d['body']['to'],'email':_0x8cbc6d[_0xf907('0x4b')]['to'],'phone':_0x8cbc6d[_0xf907('0x4b')]['to'],'ListId':_0x294f3c['ListId']}));}}else{throw new Error(_0xf907('0x60'));}})[_0xf907('0x16')](function(){if(_0x368aa5){return respondWithRpcPromise(_0xf907('0x61'),'sendMail',_0x368aa5,client9003)['then'](function(_0x1ae25e){return _0x4ec307[_0xf907('0x27')]({'read':!![],'messageId':_0x1ae25e[_0xf907('0x62')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x177135){logger[_0xf907('0x1c')]('%s',JSON[_0xf907('0x1b')](_0x177135));return _0x4ec307;});}return _0x4ec307;});}return _0x4ec307;}})['then'](respondWithResult(_0x223310,0xc9))[_0xf907('0x20')](handleError(_0x223310,null));};exports['accept']=function(_0x487843,_0x4ecde3){var _0x210c10={'agent':{},'channel':_0xf907('0x63')};if(_0x487843['body']['id']){delete _0x487843['body']['id'];}_0x487843[_0xf907('0x4b')][_0xf907('0x64')]=!![];_0x487843['body'][_0xf907('0x65')]=moment()[_0xf907('0x66')](_0xf907('0x67'));_0x487843[_0xf907('0x4b')]['UserId']=_0x487843[_0xf907('0x4b')][_0xf907('0x68')]||_0x487843[_0xf907('0x69')]['id'];_0x210c10['agent']['id']=_0x487843[_0xf907('0x4b')][_0xf907('0x68')];return db['MailMessage'][_0xf907('0x4a')]({'where':{'id':_0x487843[_0xf907('0x4c')]['id'],'UserId':null}})[_0xf907('0x16')](handleEntityNotFound(_0x4ecde3,null))[_0xf907('0x16')](saveUpdates(_0x487843[_0xf907('0x4b')],null))[_0xf907('0x16')](function(_0x49108b){if(_0x49108b){_0x210c10[_0xf907('0x1e')]=_0x49108b[_0xf907('0x6a')]({'plain':!![]});return db[_0xf907('0x6b')][_0xf907('0x4a')]({'where':{'id':_0x49108b['MailInteractionId']}});}return null;})[_0xf907('0x16')](handleEntityNotFound(_0x4ecde3,null))[_0xf907('0x16')](function(_0xd86e36){if(_0xd86e36){return _0xd86e36['update']({'UserId':_0x487843['body']['UserId'],'read1stAt':_['isNil'](_0xd86e36[_0xf907('0x6c')])?moment()[_0xf907('0x66')](_0xf907('0x67')):undefined});}return null;})[_0xf907('0x16')](function(_0x486742){if(_0x486742){_0x210c10[_0xf907('0x6d')]=_0x486742[_0xf907('0x6a')]({'plain':!![]});interaction_log[_0xf907('0x17')](_0xf907('0x6e'),_0x487843[_0xf907('0x69')]['id'],_0x487843['user']['name'],_0x487843[_0xf907('0x69')][_0xf907('0x6f')],_0x210c10['interaction']['id'],_0x487843['body']?JSON[_0xf907('0x1b')](_0x487843[_0xf907('0x4b')]):'null');return respondWithRpcPromise(_0xf907('0x70'),'acceptMessage',_0x210c10);}return null;})[_0xf907('0x16')](function(_0x1a53a8){var _0x1a45aa=_0xf907('0x71')+_0x1a53a8[_0xf907('0x1e')][_0xf907('0x72')];return db[_0xf907('0x73')][_0xf907('0x34')](_0x1a45aa,{'type':db[_0xf907('0x74')][_0xf907('0x75')][_0xf907('0x76')],'raw':!![]})[_0xf907('0x16')](function(_0x53f592){return _0x53f592;});})[_0xf907('0x16')](function(_0x54aabb){if(_0x54aabb){_0x210c10[_0xf907('0x1e')][_0xf907('0x77')]=_0x54aabb[0x0];if(!_0x487843[_0xf907('0x4b')][_0xf907('0x68')])return;return db[_0xf907('0x78')][_0xf907('0x4a')]({'where':{'id':_0x487843[_0xf907('0x4b')][_0xf907('0x68')],'role':_0xf907('0x79')},'attributes':['id',_0xf907('0x2a'),_0xf907('0x7a'),'email',_0xf907('0x7b')],'raw':!![]});}return null;})[_0xf907('0x16')](function(_0x277c2c){if(!_0x277c2c)return null;_0x210c10[_0xf907('0x1e')]['agent']=_0x277c2c;return _0x210c10;})[_0xf907('0x16')](function(_0x196ccb){if(_0x196ccb){if(_0x487843[_0xf907('0x4b')][_0xf907('0x7c')]){_0x210c10[_0xf907('0x1e')][_0xf907('0x7d')]=util['format'](_0xf907('0x7e'),_0x487843['user']['name']);_0x210c10[_0xf907('0x1e')][_0xf907('0x7f')]=_0x210c10['channel'];_0x210c10[_0xf907('0x1e')][_0xf907('0x80')]=_0x210c10[_0xf907('0x7f')];_0x210c10['message'][_0xf907('0x81')]=_0xf907('0x82');_0x210c10[_0xf907('0x1e')][_0xf907('0x4b')]=htmlToText['fromString'](_0x210c10[_0xf907('0x1e')]['body']);return respondWithRpcPromise(_0xf907('0x83'),'EventManager',{'event':'acceptmessage','message':_0x210c10[_0xf907('0x1e')]},client9002)[_0xf907('0x16')](function(){return _0x210c10;});}return _0x210c10;}return null;})[_0xf907('0x16')](respondWithResult(_0x4ecde3,null))[_0xf907('0x20')](handleError(_0x4ecde3,null));};exports[_0xf907('0x84')]=function(_0x50db11,_0x52c032){var _0x3891c0={'agent':{},'channel':_0xf907('0x63')};if(_0x50db11[_0xf907('0x4b')]['id']){delete _0x50db11[_0xf907('0x4b')]['id'];}_0x50db11[_0xf907('0x4b')][_0xf907('0x68')]=_0x50db11[_0xf907('0x4b')]['UserId']||_0x50db11['user']['id'];_0x3891c0[_0xf907('0x79')]['id']=_0x50db11[_0xf907('0x4b')][_0xf907('0x68')];return db[_0xf907('0x2e')][_0xf907('0x4a')]({'where':{'id':_0x50db11[_0xf907('0x4c')]['id'],'UserId':null}})[_0xf907('0x16')](handleEntityNotFound(_0x52c032,null))[_0xf907('0x16')](function(_0x2ea69e){if(_0x2ea69e){_0x3891c0['message']=_0x2ea69e[_0xf907('0x6a')]({'plain':!![]});return db[_0xf907('0x6b')][_0xf907('0x4a')]({'where':{'id':_0x2ea69e[_0xf907('0x85')]}});}return null;})[_0xf907('0x16')](handleEntityNotFound(_0x52c032,null))['then'](function(_0x38dcc7){if(_0x38dcc7){_0x3891c0[_0xf907('0x6d')]=_0x38dcc7[_0xf907('0x6a')]({'plain':!![]});interaction_log[_0xf907('0x17')](_0xf907('0x86'),_0x50db11['user']['id'],_0x50db11['user']['name'],_0x50db11[_0xf907('0x69')][_0xf907('0x6f')],_0x3891c0[_0xf907('0x6d')]['id'],_0x50db11[_0xf907('0x4b')]?JSON[_0xf907('0x1b')](_0x50db11[_0xf907('0x4b')]):_0xf907('0x87'));return respondWithRpcPromise(_0xf907('0x88'),'rejectMessage',_0x3891c0);}return null;})[_0xf907('0x16')](function(_0x4b9d5f){var _0x4c9ac2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b9d5f['message'][_0xf907('0x72')];return db[_0xf907('0x73')]['query'](_0x4c9ac2,{'type':db[_0xf907('0x74')][_0xf907('0x75')][_0xf907('0x76')],'raw':!![]})[_0xf907('0x16')](function(_0x1cdd13){return _0x1cdd13;});})['then'](function(_0x39ef0b){if(_0x39ef0b){_0x3891c0[_0xf907('0x1e')][_0xf907('0x77')]=_0x39ef0b[0x0];if(!_0x50db11[_0xf907('0x4b')]['UserId'])return;return db[_0xf907('0x78')]['find']({'where':{'id':_0x50db11[_0xf907('0x4b')][_0xf907('0x68')],'role':_0xf907('0x79')},'attributes':['id',_0xf907('0x2a'),_0xf907('0x7a'),_0xf907('0x89'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4c4670){if(!_0x4c4670)return null;_0x3891c0['message'][_0xf907('0x79')]=_0x4c4670;return _0x3891c0;})[_0xf907('0x16')](function(_0x24b5aa){if(_0x24b5aa){_0x24b5aa[_0xf907('0x1e')][_0xf907('0x7d')]=util[_0xf907('0x66')](_0xf907('0x7e'),_0x50db11['user'][_0xf907('0x2a')]);_0x24b5aa[_0xf907('0x1e')]['channel']=_0x3891c0[_0xf907('0x7f')];_0x24b5aa[_0xf907('0x1e')][_0xf907('0x80')]=_0x3891c0[_0xf907('0x7f')];_0x24b5aa[_0xf907('0x1e')][_0xf907('0x81')]=_0xf907('0x84');_0x24b5aa[_0xf907('0x1e')][_0xf907('0x4b')]=htmlToText[_0xf907('0x8a')](_0x3891c0[_0xf907('0x1e')][_0xf907('0x4b')]);respondWithRpcPromise(_0xf907('0x83'),'EventManager',{'event':_0xf907('0x8b'),'message':_0x24b5aa['message']},client9002);return _0x3891c0;}return null;})[_0xf907('0x16')](respondWithResult(_0x52c032,null))['catch'](handleError(_0x52c032,null));};exports[_0xf907('0x8c')]=function(_0x11e082,_0x397167){var _0x32fe22=moment()[_0xf907('0x8d')]()[_0xf907('0x8e')]();var _0x18b434=path['join'](config[_0xf907('0x5d')],'server','files',_0xf907('0x8f'));var _0x11e13e=path['join'](config[_0xf907('0x5d')],'server',_0xf907('0x90'),'attachments');var _0x4fdfe7=util[_0xf907('0x66')](_0xf907('0x91'),_0x32fe22);return db[_0xf907('0x2e')][_0xf907('0x4a')]({'where':{'id':_0x11e082[_0xf907('0x4c')]['id']},'attributes':['id',_0xf907('0x4b'),'from','to','cc',_0xf907('0x92'),_0xf907('0x93'),_0xf907('0x94')],'include':_0x11e082[_0xf907('0x34')][_0xf907('0x5c')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xf907('0x16')](handleEntityNotFound(_0x397167,null))[_0xf907('0x16')](function(_0x317323){if(_0x317323){var _0x1e47fe=_0x317323;var _0x5774a8={'from':_0x1e47fe[_0xf907('0x95')],'to':_0x1e47fe['to'],'subject':_0x1e47fe['subject'],'html':htmlEntities['decode'](_0x1e47fe['body']),'headers':{'Date':moment(_0x1e47fe[_0xf907('0x94')])[_0xf907('0x66')](_0xf907('0x96'))},'attachments':[]};if(_0x317323['cc']){_0x5774a8[_0xf907('0x97')]['Cc']=_0x317323['cc'];}if(_0x317323[_0xf907('0x92')]){_0x5774a8[_0xf907('0x97')]['Bcc']=_0x317323[_0xf907('0x92')];}return new BPromise(function(_0x206f4b,_0x2f4f75){if(_0x317323[_0xf907('0x98')]){for(var _0x540a6c=0x0;_0x540a6c<_0x317323[_0xf907('0x98')]['length'];_0x540a6c++){var _0x3d8fbe=_0x317323[_0xf907('0x98')][_0x540a6c];var _0x181085=path[_0xf907('0x99')](_0x11e13e,_0x3d8fbe[_0xf907('0x5e')]);if(fs['existsSync'](_0x181085)){_0x5774a8[_0xf907('0x5c')][_0xf907('0x9a')]({'name':_0x3d8fbe[_0xf907('0x2a')],'contentType':_0x3d8fbe[_0xf907('0x31')],'data':fs[_0xf907('0x9b')](_0x181085)});}}}emlformat[_0xf907('0x9c')](_0x5774a8,function(_0x4c9ad1,_0x14b9f4){if(_0x4c9ad1)return _0x2f4f75(_0x4c9ad1);fs[_0xf907('0x9d')](path[_0xf907('0x99')](_0x18b434,_0x4fdfe7),_0x14b9f4);return _0x206f4b(_0x14b9f4);});});}})['then'](function(_0x235532){if(_0x235532){return _0x397167[_0xf907('0x8c')](path[_0xf907('0x99')](_0x18b434,_0x4fdfe7),_0x4fdfe7,function(_0x2f2729){if(!_0x2f2729)fs[_0xf907('0x9e')](path[_0xf907('0x99')](_0x18b434,_0x4fdfe7));});}})[_0xf907('0x20')](handleError(_0x397167,null));}; \ No newline at end of file +var _0x85d0=['Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','fromString','acceptmessage','rejectMessage','sequelize','User','reject','EventManager','rejectmessage','download','server','files','tmp','message-%s.eml','from','subject','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','push','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','offset','undefined','limit','count','status','set','json','update','destroy','sendStatus','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','MailMessage','include','find','body','describe','create','direction','secret','split','findOne','CmList','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','List','Contacts','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x146ef3,_0x1c7bb0){var _0x5d9bae=function(_0x3b70f7){while(--_0x3b70f7){_0x146ef3['push'](_0x146ef3['shift']());}};_0x5d9bae(++_0x1c7bb0);}(_0x85d0,0xbf));var _0x085d=function(_0x216d81,_0x49a377){_0x216d81=_0x216d81-0x0;var _0x360f71=_0x85d0[_0x216d81];return _0x360f71;};'use strict';var emlformat=require(_0x085d('0x0'));var moment=require(_0x085d('0x1'));var BPromise=require(_0x085d('0x2'));var util=require(_0x085d('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x085d('0x4'));var qs=require(_0x085d('0x5'));var logger=require(_0x085d('0x6'))(_0x085d('0x7'));var interaction_log=require(_0x085d('0x6'))(_0x085d('0x8'));var config=require(_0x085d('0x9'));var db=require(_0x085d('0xa'))['db'];config['redis']=_[_0x085d('0xb')](config[_0x085d('0xc')],{'host':_0x085d('0xd'),'port':0x18eb});var socket=require(_0x085d('0xe'))(new Redis(config[_0x085d('0xc')]));var htmlEntities=require(_0x085d('0xf'));require(_0x085d('0x10'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x085d('0x11')]({'port':0x232c});var client9003=jayson[_0x085d('0x12')][_0x085d('0x11')]({'port':0x232b});var client9002=jayson[_0x085d('0x12')][_0x085d('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x3e0c1a,_0x21275a,_0x2ba439,_0x175942){return new BPromise(function(_0x12cdd5,_0xd1ea2f){var _0x17f398=_0x175942||client;return _0x17f398[_0x085d('0x13')](_0x3e0c1a,_0x2ba439)[_0x085d('0x14')](function(_0x23ee53){logger[_0x085d('0x15')](_0x085d('0x16'),_0x21275a,_0x085d('0x17'));logger[_0x085d('0x18')](_0x085d('0x19'),_0x21275a,_0x085d('0x17'),JSON[_0x085d('0x1a')](_0x23ee53));if(_0x23ee53['error']){if(_0x23ee53[_0x085d('0x1b')][_0x085d('0x1c')]===0x1f4){logger[_0x085d('0x1b')](_0x085d('0x16'),_0x21275a,_0x23ee53[_0x085d('0x1b')][_0x085d('0x1d')]);return _0xd1ea2f(_0x23ee53['error']['message']);}logger['error'](_0x085d('0x16'),_0x21275a,_0x23ee53[_0x085d('0x1b')]['message']);return _0x12cdd5(_0x23ee53[_0x085d('0x1b')][_0x085d('0x1d')]);}else{logger[_0x085d('0x15')](_0x085d('0x16'),_0x21275a,'request\x20sent');_0x12cdd5(_0x23ee53['result'][_0x085d('0x1d')]);}})[_0x085d('0x1e')](function(_0x12d603){logger['error'](_0x085d('0x16'),_0x21275a,_0x12d603);_0xd1ea2f(_0x12d603);});});}function respondWithResult(_0x34643a,_0x343f42){_0x343f42=_0x343f42||0xc8;return function(_0x236fea){if(_0x236fea){return _0x34643a['status'](_0x343f42)['json'](_0x236fea);}};}function respondWithFilteredResult(_0x5b8ad1,_0x2a845e){return function(_0x472f5b){if(_0x472f5b){var _0x5d2a0f=typeof _0x2a845e[_0x085d('0x1f')]===_0x085d('0x20')&&typeof _0x2a845e[_0x085d('0x21')]===_0x085d('0x20');var _0x4b2ae9=_0x472f5b[_0x085d('0x22')];var _0x320d28=_0x5d2a0f?0x0:_0x2a845e[_0x085d('0x1f')];var _0x179141=_0x5d2a0f?_0x472f5b[_0x085d('0x22')]:_0x2a845e[_0x085d('0x1f')]+_0x2a845e[_0x085d('0x21')];var _0x4f097d;if(_0x179141>=_0x4b2ae9){_0x179141=_0x4b2ae9;_0x4f097d=0xc8;}else{_0x4f097d=0xce;}_0x5b8ad1[_0x085d('0x23')](_0x4f097d);return _0x5b8ad1[_0x085d('0x24')]('Content-Range',_0x320d28+'-'+_0x179141+'/'+_0x4b2ae9)[_0x085d('0x25')](_0x472f5b);}return null;};}function saveUpdates(_0xfe9659){return function(_0x2a38f3){if(_0x2a38f3){return _0x2a38f3[_0x085d('0x26')](_0xfe9659)[_0x085d('0x14')](function(_0x2e364e){return _0x2e364e;});}return null;};}function removeEntity(_0x437a81){return function(_0x434875){if(_0x434875){return _0x434875[_0x085d('0x27')]()[_0x085d('0x14')](function(){_0x437a81['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x227cf9){return function(_0x3de1b6){if(!_0x3de1b6){_0x227cf9[_0x085d('0x28')](0x194);}return _0x3de1b6;};}function handleError(_0x51867a,_0x53effa){_0x53effa=_0x53effa||0x1f4;return function(_0x42b391){logger['error'](_0x42b391['stack']);if(_0x42b391['name']){delete _0x42b391['name'];}_0x51867a['status'](_0x53effa)[_0x085d('0x29')](_0x42b391);};}exports[_0x085d('0x2a')]=function(_0x6182b,_0x4b23f){var _0x588491={},_0x47b89a={},_0x2b7be4={'count':0x0,'rows':[]};var _0x2fc64c=_[_0x085d('0x2b')](db['MailMessage'][_0x085d('0x2c')],function(_0x7a9c94){return{'name':_0x7a9c94[_0x085d('0x2d')],'type':_0x7a9c94[_0x085d('0x2e')]['key']};});_0x47b89a[_0x085d('0x2f')]=_[_0x085d('0x2b')](_0x2fc64c,_0x085d('0x30'));_0x47b89a[_0x085d('0x31')]=_[_0x085d('0x32')](_0x6182b[_0x085d('0x31')]);_0x47b89a[_0x085d('0x33')]=_[_0x085d('0x34')](_0x47b89a[_0x085d('0x2f')],_0x47b89a[_0x085d('0x31')]);_0x588491[_0x085d('0x35')]=_[_0x085d('0x34')](_0x47b89a[_0x085d('0x2f')],qs[_0x085d('0x36')](_0x6182b[_0x085d('0x31')][_0x085d('0x36')]));_0x588491[_0x085d('0x35')]=_0x588491[_0x085d('0x35')][_0x085d('0x37')]?_0x588491[_0x085d('0x35')]:_0x47b89a[_0x085d('0x2f')];if(!_0x6182b[_0x085d('0x31')][_0x085d('0x38')](_0x085d('0x39'))){_0x588491['limit']=qs[_0x085d('0x21')](_0x6182b[_0x085d('0x31')][_0x085d('0x21')]);_0x588491[_0x085d('0x1f')]=qs[_0x085d('0x1f')](_0x6182b['query']['offset']);}_0x588491[_0x085d('0x3a')]=qs['sort'](_0x6182b[_0x085d('0x31')]['sort']);_0x588491[_0x085d('0x3b')]=qs[_0x085d('0x33')](_[_0x085d('0x3c')](_0x6182b['query'],_0x47b89a[_0x085d('0x33')]),_0x2fc64c);if(_0x6182b[_0x085d('0x31')]['filter']){_0x588491[_0x085d('0x3b')]=_[_0x085d('0x3d')](_0x588491[_0x085d('0x3b')],{'$or':_[_0x085d('0x2b')](_0x2fc64c,function(_0x44d32d){if(_0x44d32d[_0x085d('0x2e')]!=='VIRTUAL'){var _0x4d2d08={};_0x4d2d08[_0x44d32d['name']]={'$like':'%'+_0x6182b['query'][_0x085d('0x3e')]+'%'};return _0x4d2d08;}})});}_0x588491=_[_0x085d('0x3d')]({},_0x588491,_0x6182b[_0x085d('0x3f')]);var _0x139356={'where':_0x588491[_0x085d('0x3b')]};return db['MailMessage']['count'](_0x139356)['then'](function(_0xf6518d){_0x2b7be4[_0x085d('0x22')]=_0xf6518d;if(_0x6182b[_0x085d('0x31')][_0x085d('0x40')]){_0x588491['include']=[{'all':!![]}];}return db['MailMessage'][_0x085d('0x41')](_0x588491);})[_0x085d('0x14')](function(_0x31c52a){_0x2b7be4[_0x085d('0x42')]=_0x31c52a;return _0x2b7be4;})[_0x085d('0x14')](respondWithFilteredResult(_0x4b23f,_0x588491))[_0x085d('0x1e')](handleError(_0x4b23f,null));};exports[_0x085d('0x43')]=function(_0x103ba2,_0x39afa8){var _0x539509={'raw':!![],'where':{'id':_0x103ba2[_0x085d('0x44')]['id']}},_0x7dd28a={};_0x7dd28a['model']=_[_0x085d('0x32')](db[_0x085d('0x45')]['rawAttributes']);_0x7dd28a[_0x085d('0x31')]=_[_0x085d('0x32')](_0x103ba2[_0x085d('0x31')]);_0x7dd28a[_0x085d('0x33')]=_[_0x085d('0x34')](_0x7dd28a[_0x085d('0x2f')],_0x7dd28a[_0x085d('0x31')]);_0x539509[_0x085d('0x35')]=_[_0x085d('0x34')](_0x7dd28a[_0x085d('0x2f')],qs['fields'](_0x103ba2[_0x085d('0x31')][_0x085d('0x36')]));_0x539509[_0x085d('0x35')]=_0x539509['attributes'][_0x085d('0x37')]?_0x539509[_0x085d('0x35')]:_0x7dd28a[_0x085d('0x2f')];if(_0x103ba2['query']['includeAll']){_0x539509[_0x085d('0x46')]=[{'all':!![]}];}_0x539509=_[_0x085d('0x3d')]({},_0x539509,_0x103ba2[_0x085d('0x3f')]);return db[_0x085d('0x45')][_0x085d('0x47')](_0x539509)[_0x085d('0x14')](handleEntityNotFound(_0x39afa8,null))[_0x085d('0x14')](respondWithResult(_0x39afa8,null))[_0x085d('0x1e')](handleError(_0x39afa8,null));};exports[_0x085d('0x26')]=function(_0x16bac0,_0x27a43b){if(_0x16bac0['body']['id']){delete _0x16bac0[_0x085d('0x48')]['id'];}return db[_0x085d('0x45')][_0x085d('0x47')]({'where':{'id':_0x16bac0[_0x085d('0x44')]['id']}})['then'](handleEntityNotFound(_0x27a43b,null))['then'](saveUpdates(_0x16bac0[_0x085d('0x48')],null))[_0x085d('0x14')](respondWithResult(_0x27a43b,null))['catch'](handleError(_0x27a43b,null));};exports[_0x085d('0x27')]=function(_0x30ea74,_0x46890c){return db[_0x085d('0x45')]['find']({'where':{'id':_0x30ea74[_0x085d('0x44')]['id']}})['then'](handleEntityNotFound(_0x46890c,null))['then'](removeEntity(_0x46890c,null))['catch'](handleError(_0x46890c,null));};exports[_0x085d('0x49')]=function(_0x105c24,_0x138789){return db[_0x085d('0x45')][_0x085d('0x49')]()[_0x085d('0x14')](respondWithResult(_0x138789,null))[_0x085d('0x1e')](handleError(_0x138789,null));};exports[_0x085d('0x4a')]=function(_0x515d20,_0x382f42){return db['MailMessage'][_0x085d('0x4a')](_0x515d20[_0x085d('0x48')])[_0x085d('0x14')](function(_0x4bc608){if(_0x4bc608){if(_0x4bc608[_0x085d('0x4b')]==='out'&&!_0x4bc608[_0x085d('0x4c')]){var _0x213e92,_0x155e5b,_0x553e36;if(_0x515d20['body']['to']){_0x155e5b=_0x515d20[_0x085d('0x48')]['to'][_0x085d('0x4d')](',')[0x0];}return db['MailAccount'][_0x085d('0x4e')]({'where':{'id':_0x4bc608['MailAccountId']},'include':[{'model':db[_0x085d('0x4f')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x155e5b},'limit':0x1,'order':[[_0x085d('0x50'),_0x085d('0x51')]]}]},{'model':db[_0x085d('0x52')],'as':_0x085d('0x53'),'raw':!![],'include':[{'model':db[_0x085d('0x54')],'as':_0x085d('0x54'),'raw':!![]}]}]})[_0x085d('0x14')](function(_0x10f8ad){_0x213e92=_0x10f8ad;if(!_0x213e92||!_0x213e92[_0x085d('0x53')])return;var _0x149ea3=_0x213e92['getSmtpOptions']();if(_0x515d20[_0x085d('0x48')][_0x085d('0x55')]&&_0x515d20[_0x085d('0x48')][_0x085d('0x55')][_0x085d('0x37')]){for(var _0x51b5be=0x0;_0x51b5be<_0x515d20['body']['attachments'][_0x085d('0x37')];_0x51b5be+=0x1){_0x515d20['body'][_0x085d('0x55')][_0x51b5be]={'filename':_0x515d20['body'][_0x085d('0x55')][_0x51b5be][_0x085d('0x30')],'path':path[_0x085d('0x56')](config[_0x085d('0x57')],_0x085d('0x58'),_0x515d20[_0x085d('0x48')][_0x085d('0x55')][_0x51b5be][_0x085d('0x59')])};}}_0x553e36={'account':_0x149ea3,'message':_0x515d20[_0x085d('0x48')]};return;})[_0x085d('0x14')](function(){if(_0x213e92[_0x085d('0x5a')]){if(_0x213e92[_0x085d('0x5a')]['Contacts'][_0x085d('0x37')]){return _0x213e92[_0x085d('0x5a')][_0x085d('0x5b')][0x0];}else{return db[_0x085d('0x5c')]['create'](_[_0x085d('0xb')](_0x515d20['body'],{'firstName':_0x515d20[_0x085d('0x48')]['to'],'email':_0x515d20[_0x085d('0x48')]['to'],'phone':_0x515d20[_0x085d('0x48')]['to'],'ListId':_0x213e92[_0x085d('0x5d')]}));}}else{throw new Error(_0x085d('0x5e'));}})[_0x085d('0x14')](function(){if(_0x553e36){return respondWithRpcPromise(_0x085d('0x5f'),_0x085d('0x60'),_0x553e36,client9003)[_0x085d('0x14')](function(_0x3f3a8f){return _0x4bc608['update']({'read':!![],'messageId':_0x3f3a8f['messageId'],'sentAt':moment()['format'](_0x085d('0x61'))});})[_0x085d('0x1e')](function(_0x36e0a8){logger[_0x085d('0x1b')]('%s',JSON[_0x085d('0x1a')](_0x36e0a8));return _0x4bc608;});}return _0x4bc608;});}return _0x4bc608;}})['then'](respondWithResult(_0x382f42,0xc9))['catch'](handleError(_0x382f42,null));};exports[_0x085d('0x62')]=function(_0x130f70,_0x21fd19){var _0x57068d={'agent':{},'channel':_0x085d('0x63')};if(_0x130f70['body']['id']){delete _0x130f70[_0x085d('0x48')]['id'];}_0x130f70[_0x085d('0x48')][_0x085d('0x64')]=!![];_0x130f70[_0x085d('0x48')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x130f70[_0x085d('0x48')]['UserId']=_0x130f70['body'][_0x085d('0x65')]||_0x130f70[_0x085d('0x66')]['id'];_0x57068d[_0x085d('0x67')]['id']=_0x130f70['body'][_0x085d('0x65')];return db['MailMessage'][_0x085d('0x47')]({'where':{'id':_0x130f70[_0x085d('0x44')]['id'],'UserId':null}})[_0x085d('0x14')](handleEntityNotFound(_0x21fd19,null))['then'](saveUpdates(_0x130f70[_0x085d('0x48')],null))[_0x085d('0x14')](function(_0x2e788b){if(_0x2e788b){_0x57068d['message']=_0x2e788b[_0x085d('0x68')]({'plain':!![]});return db[_0x085d('0x69')][_0x085d('0x47')]({'where':{'id':_0x2e788b[_0x085d('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x21fd19,null))[_0x085d('0x14')](function(_0x315d45){if(_0x315d45){return _0x315d45[_0x085d('0x26')]({'UserId':_0x130f70[_0x085d('0x48')][_0x085d('0x65')],'read1stAt':_[_0x085d('0x6b')](_0x315d45[_0x085d('0x6c')])?moment()[_0x085d('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x085d('0x14')](function(_0x587a3b){if(_0x587a3b){_0x57068d[_0x085d('0x6e')]=_0x587a3b[_0x085d('0x68')]({'plain':!![]});interaction_log[_0x085d('0x15')](_0x085d('0x6f'),_0x130f70['user']['id'],_0x130f70[_0x085d('0x66')][_0x085d('0x30')],_0x130f70[_0x085d('0x66')][_0x085d('0x70')],_0x57068d[_0x085d('0x6e')]['id'],_0x130f70[_0x085d('0x48')]?JSON[_0x085d('0x1a')](_0x130f70['body']):'null');return respondWithRpcPromise(_0x085d('0x71'),_0x085d('0x72'),_0x57068d);}return null;})[_0x085d('0x14')](function(_0x33a069){var _0x4c4bdd=_0x085d('0x73')+_0x33a069['message'][_0x085d('0x74')];return db['sequelize']['query'](_0x4c4bdd,{'type':db[_0x085d('0x75')][_0x085d('0x76')][_0x085d('0x77')],'raw':!![]})['then'](function(_0x1f266c){return _0x1f266c;});})[_0x085d('0x14')](function(_0x976126){if(_0x976126){_0x57068d[_0x085d('0x1d')][_0x085d('0x78')]=_0x976126[0x0];if(!_0x130f70[_0x085d('0x48')][_0x085d('0x65')])return;return db['User']['find']({'where':{'id':_0x130f70[_0x085d('0x48')][_0x085d('0x65')],'role':_0x085d('0x67')},'attributes':['id','name',_0x085d('0x79'),_0x085d('0x7a'),_0x085d('0x7b')],'raw':!![]});}return null;})[_0x085d('0x14')](function(_0x421cfe){if(!_0x421cfe)return null;_0x57068d[_0x085d('0x1d')][_0x085d('0x67')]=_0x421cfe;return _0x57068d;})[_0x085d('0x14')](function(_0x35be22){if(_0x35be22){if(_0x130f70[_0x085d('0x48')][_0x085d('0x7c')]){_0x57068d[_0x085d('0x1d')][_0x085d('0x7d')]=util[_0x085d('0x6d')](_0x085d('0x7e'),_0x130f70['user'][_0x085d('0x30')]);_0x57068d[_0x085d('0x1d')]['channel']=_0x57068d[_0x085d('0x7f')];_0x57068d['message']['motionChannel']=_0x57068d[_0x085d('0x7f')];_0x57068d['message'][_0x085d('0x80')]=_0x085d('0x62');_0x57068d[_0x085d('0x1d')][_0x085d('0x48')]=htmlToText[_0x085d('0x81')](_0x57068d[_0x085d('0x1d')][_0x085d('0x48')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x085d('0x82'),'message':_0x57068d['message']},client9002)['then'](function(){return _0x57068d;});}return _0x57068d;}return null;})[_0x085d('0x14')](respondWithResult(_0x21fd19,null))[_0x085d('0x1e')](handleError(_0x21fd19,null));};exports['reject']=function(_0xcb2ad6,_0x354b1e){var _0x5a718e={'agent':{},'channel':_0x085d('0x63')};if(_0xcb2ad6[_0x085d('0x48')]['id']){delete _0xcb2ad6[_0x085d('0x48')]['id'];}_0xcb2ad6[_0x085d('0x48')][_0x085d('0x65')]=_0xcb2ad6[_0x085d('0x48')][_0x085d('0x65')]||_0xcb2ad6[_0x085d('0x66')]['id'];_0x5a718e[_0x085d('0x67')]['id']=_0xcb2ad6['body']['UserId'];return db['MailMessage'][_0x085d('0x47')]({'where':{'id':_0xcb2ad6['params']['id'],'UserId':null}})[_0x085d('0x14')](handleEntityNotFound(_0x354b1e,null))[_0x085d('0x14')](function(_0x22a6e9){if(_0x22a6e9){_0x5a718e[_0x085d('0x1d')]=_0x22a6e9[_0x085d('0x68')]({'plain':!![]});return db[_0x085d('0x69')]['find']({'where':{'id':_0x22a6e9[_0x085d('0x6a')]}});}return null;})[_0x085d('0x14')](handleEntityNotFound(_0x354b1e,null))[_0x085d('0x14')](function(_0x13bbf9){if(_0x13bbf9){_0x5a718e[_0x085d('0x6e')]=_0x13bbf9[_0x085d('0x68')]({'plain':!![]});interaction_log[_0x085d('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xcb2ad6[_0x085d('0x66')]['id'],_0xcb2ad6[_0x085d('0x66')][_0x085d('0x30')],_0xcb2ad6[_0x085d('0x66')][_0x085d('0x70')],_0x5a718e[_0x085d('0x6e')]['id'],_0xcb2ad6[_0x085d('0x48')]?JSON['stringify'](_0xcb2ad6[_0x085d('0x48')]):'null');return respondWithRpcPromise('RejectMessage',_0x085d('0x83'),_0x5a718e);}return null;})['then'](function(_0x3da00a){var _0x5dbbe9=_0x085d('0x73')+_0x3da00a[_0x085d('0x1d')][_0x085d('0x74')];return db[_0x085d('0x84')]['query'](_0x5dbbe9,{'type':db[_0x085d('0x75')][_0x085d('0x76')]['SELECT'],'raw':!![]})[_0x085d('0x14')](function(_0x1a61b1){return _0x1a61b1;});})[_0x085d('0x14')](function(_0x3a109f){if(_0x3a109f){_0x5a718e[_0x085d('0x1d')][_0x085d('0x78')]=_0x3a109f[0x0];if(!_0xcb2ad6['body']['UserId'])return;return db[_0x085d('0x85')]['find']({'where':{'id':_0xcb2ad6[_0x085d('0x48')][_0x085d('0x65')],'role':_0x085d('0x67')},'attributes':['id',_0x085d('0x30'),_0x085d('0x79'),_0x085d('0x7a'),_0x085d('0x7b')],'raw':!![]});}return null;})[_0x085d('0x14')](function(_0x27f55b){if(!_0x27f55b)return null;_0x5a718e[_0x085d('0x1d')][_0x085d('0x67')]=_0x27f55b;return _0x5a718e;})[_0x085d('0x14')](function(_0x5cb6c0){if(_0x5cb6c0){_0x5cb6c0[_0x085d('0x1d')]['interface']=util[_0x085d('0x6d')]('SIP/%s',_0xcb2ad6[_0x085d('0x66')]['name']);_0x5cb6c0[_0x085d('0x1d')][_0x085d('0x7f')]=_0x5a718e[_0x085d('0x7f')];_0x5cb6c0[_0x085d('0x1d')]['motionChannel']=_0x5a718e['channel'];_0x5cb6c0[_0x085d('0x1d')][_0x085d('0x80')]=_0x085d('0x86');_0x5cb6c0[_0x085d('0x1d')][_0x085d('0x48')]=htmlToText['fromString'](_0x5a718e[_0x085d('0x1d')][_0x085d('0x48')]);respondWithRpcPromise(_0x085d('0x87'),_0x085d('0x87'),{'event':_0x085d('0x88'),'message':_0x5cb6c0[_0x085d('0x1d')]},client9002);return _0x5a718e;}return null;})[_0x085d('0x14')](respondWithResult(_0x354b1e,null))[_0x085d('0x1e')](handleError(_0x354b1e,null));};exports[_0x085d('0x89')]=function(_0x284517,_0x3be6a1){var _0x5292f2=moment()['unix']()['toString']();var _0x43a41b=path[_0x085d('0x56')](config['root'],_0x085d('0x8a'),_0x085d('0x8b'),_0x085d('0x8c'));var _0x154b40=path['join'](config[_0x085d('0x57')],'server',_0x085d('0x8b'),_0x085d('0x55'));var _0x4fc310=util['format'](_0x085d('0x8d'),_0x5292f2);return db[_0x085d('0x45')][_0x085d('0x47')]({'where':{'id':_0x284517[_0x085d('0x44')]['id']},'attributes':['id',_0x085d('0x48'),_0x085d('0x8e'),'to','cc','bcc',_0x085d('0x8f'),'createdAt'],'include':_0x284517['query'][_0x085d('0x55')]?[{'model':db['Attachment'],'as':_0x085d('0x90')}]:undefined})[_0x085d('0x14')](handleEntityNotFound(_0x3be6a1,null))[_0x085d('0x14')](function(_0x344c6f){if(_0x344c6f){var _0x4fa35f=_0x344c6f;var _0x1b3c16={'from':_0x4fa35f[_0x085d('0x8e')],'to':_0x4fa35f['to'],'subject':_0x4fa35f['subject'],'html':htmlEntities[_0x085d('0x91')](_0x4fa35f['body']),'headers':{'Date':moment(_0x4fa35f[_0x085d('0x92')])[_0x085d('0x6d')](_0x085d('0x93'))},'attachments':[]};if(_0x344c6f['cc']){_0x1b3c16[_0x085d('0x94')]['Cc']=_0x344c6f['cc'];}if(_0x344c6f[_0x085d('0x95')]){_0x1b3c16[_0x085d('0x94')][_0x085d('0x96')]=_0x344c6f[_0x085d('0x95')];}return new BPromise(function(_0x512819,_0x57d2c7){if(_0x344c6f['Attachments']){for(var _0x312590=0x0;_0x312590<_0x344c6f[_0x085d('0x90')][_0x085d('0x37')];_0x312590++){var _0x38783c=_0x344c6f[_0x085d('0x90')][_0x312590];var _0x4bdd8c=path[_0x085d('0x56')](_0x154b40,_0x38783c[_0x085d('0x59')]);if(fs['existsSync'](_0x4bdd8c)){_0x1b3c16['attachments'][_0x085d('0x97')]({'name':_0x38783c['name'],'contentType':_0x38783c[_0x085d('0x2e')],'data':fs['readFileSync'](_0x4bdd8c)});}}}emlformat['build'](_0x1b3c16,function(_0x7ba0c4,_0x33cee1){if(_0x7ba0c4)return _0x57d2c7(_0x7ba0c4);fs[_0x085d('0x98')](path[_0x085d('0x56')](_0x43a41b,_0x4fc310),_0x33cee1);return _0x512819(_0x33cee1);});});}})[_0x085d('0x14')](function(_0x41aff2){if(_0x41aff2){return _0x3be6a1[_0x085d('0x89')](path[_0x085d('0x56')](_0x43a41b,_0x4fc310),_0x4fc310,function(_0x2338dd){if(!_0x2338dd)fs[_0x085d('0x99')](path['join'](_0x43a41b,_0x4fc310));});}})[_0x085d('0x1e')](handleError(_0x3be6a1,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e7f84a6..04e798b 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 _0xab6c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab6c,0x120));var _0xcab6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xab6c[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xcab6('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xcab6('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcab6('0x2')](0x0);var events={'afterCreate':_0xcab6('0x3'),'afterUpdate':_0xcab6('0x4'),'afterDestroy':_0xcab6('0x5')};function emitEvent(_0x2cf214){return function(_0x2ede84,_0x467084,_0x4fd11d){MailMessageEvents['emit'](_0x2cf214+':'+_0x2ede84['id'],_0x2ede84);MailMessageEvents[_0xcab6('0x6')](_0x2cf214,_0x2ede84);_0x4fd11d(null);};}for(var e in events){if(events[_0xcab6('0x7')](e)){var event=events[e];MailMessage[_0xcab6('0x8')](e,emitEvent(event));}}module[_0xcab6('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x089d=['emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x53c99b,_0x43455f){var _0x578a83=function(_0x22add9){while(--_0x22add9){_0x53c99b['push'](_0x53c99b['shift']());}};_0x578a83(++_0x43455f);}(_0x089d,0x1e0));var _0xd089=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x089d[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0xd089('0x0'));var MailMessage=require(_0xd089('0x1'))['db'][_0xd089('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd089('0x3')](0x0);var events={'afterCreate':_0xd089('0x4'),'afterUpdate':_0xd089('0x5'),'afterDestroy':'remove'};function emitEvent(_0x295d1e){return function(_0x5e9a51,_0x17cf87,_0x4bb388){MailMessageEvents[_0xd089('0x6')](_0x295d1e+':'+_0x5e9a51['id'],_0x5e9a51);MailMessageEvents[_0xd089('0x6')](_0x295d1e,_0x5e9a51);_0x4bb388(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xd089('0x7')](e,emitEvent(event));}}module[_0xd089('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a26a9eb..8f72362 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 _0x0f7a=['./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','../../config/environment'];(function(_0x4dd943,_0x5f379e){var _0x4e06ee=function(_0x2c1747){while(--_0x2c1747){_0x4dd943['push'](_0x4dd943['shift']());}};_0x4e06ee(++_0x5f379e);}(_0x0f7a,0x1d8));var _0xa0f7=function(_0xf5bbc2,_0x49e6c5){_0xf5bbc2=_0xf5bbc2-0x0;var _0x3d9a7b=_0x0f7a[_0xf5bbc2];return _0x3d9a7b;};'use strict';var _=require(_0xa0f7('0x0'));var util=require(_0xa0f7('0x1'));var logger=require('../../config/logger')(_0xa0f7('0x2'));var moment=require(_0xa0f7('0x3'));var BPromise=require(_0xa0f7('0x4'));var rp=require(_0xa0f7('0x5'));var htmlToText=require(_0xa0f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa0f7('0x7'));var attributes=require(_0xa0f7('0x8'));module['exports']=function(_0x2eb104,_0x2a21d2){return _0x2eb104['define'](_0xa0f7('0x9'),attributes,{'tableName':_0xa0f7('0xa'),'paranoid':![],'indexes':[{'name':_0xa0f7('0xb'),'fields':[_0xa0f7('0xb')]},{'name':_0xa0f7('0xc'),'fields':[_0xa0f7('0xd'),_0xa0f7('0xe')],'type':_0xa0f7('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x125d7a,_0x56e330,_0x342802){if(_0x125d7a[_0xa0f7('0x10')]){_0x125d7a[_0xa0f7('0xd')]=htmlToText['fromString'](_0x125d7a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x342802(null,_0x56e330);},'afterCreate':function(_0x389641,_0x7467f5,_0x2bc2ef){var _0x294a9c=_0x2eb104['models'];var _0x4e7d99=_0x389641[_0xa0f7('0x11')]({'plain':!![]});if(_0x4e7d99['direction']['toLowerCase']()==='in'||_0x4e7d99[_0xa0f7('0x12')][_0xa0f7('0x13')]()==='out'&&!_0x4e7d99[_0xa0f7('0x14')]&&!_[_0xa0f7('0x15')](_0x4e7d99[_0xa0f7('0x16')])){_0x294a9c[_0xa0f7('0x17')][_0xa0f7('0x18')]({'where':{'id':_0x4e7d99[_0xa0f7('0x19')]}})['then'](function(_0x233099){if(_0x233099){_0x233099['update']({'lastMsgAt':_0x4e7d99[_0xa0f7('0x1a')],'lastMsgDirection':_0x4e7d99['direction'][_0xa0f7('0x13')]()});}})[_0xa0f7('0x1b')](function(_0x58defb){console[_0xa0f7('0x1c')](_0x58defb);});}_0x2bc2ef();}},'charset':'utf8mb4','collate':_0xa0f7('0x1d')});}; \ No newline at end of file +var _0x670f=['plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages'];(function(_0xc79397,_0x112757){var _0x4fd3cb=function(_0x320566){while(--_0x320566){_0xc79397['push'](_0xc79397['shift']());}};_0x4fd3cb(++_0x112757);}(_0x670f,0xbb));var _0xf670=function(_0xd158d,_0x387e78){_0xd158d=_0xd158d-0x0;var _0x650214=_0x670f[_0xd158d];return _0x650214;};'use strict';var _=require(_0xf670('0x0'));var util=require(_0xf670('0x1'));var logger=require(_0xf670('0x2'))(_0xf670('0x3'));var moment=require(_0xf670('0x4'));var BPromise=require(_0xf670('0x5'));var rp=require(_0xf670('0x6'));var htmlToText=require(_0xf670('0x7'));var fs=require('fs');var path=require(_0xf670('0x8'));var rimraf=require(_0xf670('0x9'));var config=require(_0xf670('0xa'));var attributes=require(_0xf670('0xb'));module[_0xf670('0xc')]=function(_0x3e9e3a,_0x557e6f){return _0x3e9e3a['define'](_0xf670('0xd'),attributes,{'tableName':_0xf670('0xe'),'paranoid':![],'indexes':[{'name':_0xf670('0xf'),'fields':['messageId']},{'name':_0xf670('0x10'),'fields':[_0xf670('0x11'),_0xf670('0x12')],'type':_0xf670('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21f86e,_0x42cbe1,_0x94d9f5){if(_0x21f86e[_0xf670('0x14')]){_0x21f86e[_0xf670('0x11')]=htmlToText[_0xf670('0x15')](_0x21f86e[_0xf670('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x94d9f5(null,_0x42cbe1);},'afterCreate':function(_0x45e6f6,_0x701ba5,_0x2d018c){var _0x473599=_0x3e9e3a['models'];var _0x45bb71=_0x45e6f6[_0xf670('0x16')]({'plain':!![]});if(_0x45bb71[_0xf670('0x17')][_0xf670('0x18')]()==='in'||_0x45bb71[_0xf670('0x17')][_0xf670('0x18')]()===_0xf670('0x19')&&!_0x45bb71[_0xf670('0x1a')]&&!_[_0xf670('0x1b')](_0x45bb71['UserId'])){_0x473599[_0xf670('0x1c')][_0xf670('0x1d')]({'where':{'id':_0x45bb71['MailInteractionId']}})[_0xf670('0x1e')](function(_0x53f1a8){if(_0x53f1a8){_0x53f1a8['update']({'lastMsgAt':_0x45bb71[_0xf670('0x1f')],'lastMsgDirection':_0x45bb71[_0xf670('0x17')][_0xf670('0x18')]()});}})[_0xf670('0x20')](function(_0x426f26){console[_0xf670('0x21')](_0x426f26);});}_0x2d018c();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b50a11b..61847b0 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 _0x5b12=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5b12,0xa3));var _0x25b1=function(_0x47e50d,_0x4f7fd3){_0x47e50d=_0x47e50d-0x0;var _0x44624a=_0x5b12[_0x47e50d];return _0x44624a;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});config['redis']=_[_0x25b1('0x8')](config[_0x25b1('0x9')],{'host':_0x25b1('0xa'),'port':0x18eb});var socket=require(_0x25b1('0xb'))(new Redis(config[_0x25b1('0x9')]));require(_0x25b1('0xc'))[_0x25b1('0xd')](socket);function respondWithRpcPromise(_0x6235e2,_0x5b7224,_0x2b739e){return new BPromise(function(_0x1c28cf,_0x2cee35){return client[_0x25b1('0xe')](_0x6235e2,_0x2b739e)[_0x25b1('0xf')](function(_0x8a71af){logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));logger[_0x25b1('0x13')](_0x25b1('0x14'),_0x5b7224,_0x25b1('0x12'),JSON[_0x25b1('0x15')](_0x8a71af));if(_0x8a71af[_0x25b1('0x16')]){if(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x17')]===0x1f4){logger['error'](_0x25b1('0x11'),_0x5b7224,_0x8a71af[_0x25b1('0x16')]['message']);return _0x2cee35(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x18')]);}logger[_0x25b1('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x8a71af['error'][_0x25b1('0x18')]);return _0x1c28cf(_0x8a71af['error'][_0x25b1('0x18')]);}else{logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));_0x1c28cf(_0x8a71af[_0x25b1('0x19')][_0x25b1('0x18')]);}})[_0x25b1('0x1a')](function(_0x292463){logger['error']('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x292463);_0x2cee35(_0x292463);});});}exports[_0x25b1('0x1b')]=function(_0x501dc8){var _0x174f4a=this;return new Promise(function(_0x50ae0f,_0x3bfd7d){return db['MailMessage'][_0x25b1('0x1c')](_0x501dc8['body'],{'raw':_0x501dc8[_0x25b1('0x1d')]?_0x501dc8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bca9f){logger[_0x25b1('0x10')]('CreateMailMessage',_0x501dc8);logger[_0x25b1('0x13')](_0x25b1('0x1b'),_0x501dc8,JSON[_0x25b1('0x15')](_0x3bca9f));_0x50ae0f(_0x3bca9f);})[_0x25b1('0x1a')](function(_0x1aabbb){logger['error'](_0x25b1('0x1b'),_0x1aabbb[_0x25b1('0x18')],_0x501dc8);_0x3bfd7d(_0x174f4a[_0x25b1('0x16')](0x1f4,_0x1aabbb[_0x25b1('0x18')]));});});}; \ No newline at end of file +var _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x392865,_0x140fca){var _0x237ccd=function(_0x4979d6){while(--_0x4979d6){_0x392865['push'](_0x392865['shift']());}};_0x237ccd(++_0x140fca);}(_0xd943,0x15d));var _0x3d94=function(_0x5c348e,_0x3e12d5){_0x5c348e=_0x5c348e-0x0;var _0x3f0220=_0xd943[_0x5c348e];return _0x3f0220;};'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});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index dc000b4..23f2bc1 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 _0xf53b=['removeListener','register','length','remove','update','emit'];(function(_0x58b743,_0x5e2418){var _0x4602de=function(_0x32b2fb){while(--_0x32b2fb){_0x58b743['push'](_0x58b743['shift']());}};_0x4602de(++_0x5e2418);}(_0xf53b,0x189));var _0xbf53=function(_0x4d160e,_0x3a792b){_0x4d160e=_0x4d160e-0x0;var _0x1745ee=_0xf53b[_0x4d160e];return _0x1745ee;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xbf53('0x0'),_0xbf53('0x1')];function createListener(_0x255668,_0x473eb0){return function(_0x39387c){_0x473eb0[_0xbf53('0x2')](_0x255668,_0x39387c);};}function removeListener(_0x413647,_0x105eb8){return function(){MailMessageEvents[_0xbf53('0x3')](_0x413647,_0x105eb8);};}exports[_0xbf53('0x4')]=function(_0x3e3e2f){for(var _0x422a2b=0x0,_0x485404=events[_0xbf53('0x5')];_0x422a2b<_0x485404;_0x422a2b++){var _0x4b4116=events[_0x422a2b];var _0x510c52=createListener('mailMessage:'+_0x4b4116,_0x3e3e2f);MailMessageEvents['on'](_0x4b4116,_0x510c52);}}; \ No newline at end of file +var _0x569b=['./mailMessage.events','save','update','emit','removeListener','register','length'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x569b,0x173));var _0xb569=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x569b[_0x4b2436];return _0x4f5ab2;};'use strict';var MailMessageEvents=require(_0xb569('0x0'));var events=[_0xb569('0x1'),'remove',_0xb569('0x2')];function createListener(_0x359111,_0x4e8941){return function(_0x5371ea){_0x4e8941[_0xb569('0x3')](_0x359111,_0x5371ea);};}function removeListener(_0x1b35d6,_0x5eb2eb){return function(){MailMessageEvents[_0xb569('0x4')](_0x1b35d6,_0x5eb2eb);};}exports[_0xb569('0x5')]=function(_0x1730b2){for(var _0x4ab4e4=0x0,_0xbee933=events[_0xb569('0x6')];_0x4ab4e4<_0xbee933;_0x4ab4e4++){var _0x356854=events[_0x4ab4e4];var _0x1b8cb9=createListener('mailMessage:'+_0x356854,_0x1730b2);MailMessageEvents['on'](_0x356854,_0x1b8cb9);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 50b4baa..907c7cb 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 _0x9f91=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getAgents','post','addTeams','addAgents','put','update','delete','destroy','/:id/users','removeAgents','multer','connect-timeout','express','Router'];(function(_0x1dc511,_0x321ea6){var _0x4a4aa4=function(_0x2b0fa7){while(--_0x2b0fa7){_0x1dc511['push'](_0x1dc511['shift']());}};_0x4a4aa4(++_0x321ea6);}(_0x9f91,0x1f0));var _0x19f9=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x9f91[_0x58efa6];return _0x5d643c;};'use strict';var multer=require(_0x19f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x19f9('0x1'));var express=require(_0x19f9('0x2'));var router=express[_0x19f9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x19f9('0x4'));var config=require(_0x19f9('0x5'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0x19f9('0x6')](),controller[_0x19f9('0x7')]);router[_0x19f9('0x8')](_0x19f9('0x9'),auth[_0x19f9('0x6')](),controller[_0x19f9('0xa')]);router['get'](_0x19f9('0xb'),auth[_0x19f9('0x6')](),controller[_0x19f9('0xc')]);router[_0x19f9('0x8')](_0x19f9('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x19f9('0xe'),auth[_0x19f9('0x6')](),controller['getTeams']);router['get']('/:id/users',auth[_0x19f9('0x6')](),controller[_0x19f9('0xf')]);router['post']('/',auth[_0x19f9('0x6')](),controller['create']);router[_0x19f9('0x10')]('/:id/teams',auth[_0x19f9('0x6')](),controller[_0x19f9('0x11')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x19f9('0x12')]);router[_0x19f9('0x13')](_0x19f9('0xb'),auth[_0x19f9('0x6')](),controller[_0x19f9('0x14')]);router[_0x19f9('0x15')](_0x19f9('0xb'),auth['isAuthenticated'](),controller[_0x19f9('0x16')]);router['delete'](_0x19f9('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x19f9('0x15')](_0x19f9('0x17'),auth['isAuthenticated'](),controller[_0x19f9('0x18')]);module['exports']=router; \ No newline at end of file +var _0xfab3=['put','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xfab3,0x8c));var _0x3fab=function(_0x24086a,_0x3be9db){_0x24086a=_0x24086a-0x0;var _0x51351f=_0xfab3[_0x24086a];return _0x51351f;};'use strict';var multer=require(_0x3fab('0x0'));var util=require('util');var path=require(_0x3fab('0x1'));var timeout=require(_0x3fab('0x2'));var express=require(_0x3fab('0x3'));var router=express[_0x3fab('0x4')]();var fs_extra=require(_0x3fab('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3fab('0x6'));router[_0x3fab('0x7')]('/',auth[_0x3fab('0x8')](),controller[_0x3fab('0x9')]);router[_0x3fab('0x7')](_0x3fab('0xa'),auth[_0x3fab('0x8')](),controller[_0x3fab('0xb')]);router[_0x3fab('0x7')](_0x3fab('0xc'),auth[_0x3fab('0x8')](),controller[_0x3fab('0xd')]);router['get']('/:id/members',auth[_0x3fab('0x8')](),controller[_0x3fab('0xe')]);router[_0x3fab('0x7')](_0x3fab('0xf'),auth['isAuthenticated'](),controller[_0x3fab('0x10')]);router[_0x3fab('0x7')]('/:id/users',auth[_0x3fab('0x8')](),controller['getAgents']);router[_0x3fab('0x11')]('/',auth[_0x3fab('0x8')](),controller[_0x3fab('0x12')]);router[_0x3fab('0x11')](_0x3fab('0xf'),auth[_0x3fab('0x8')](),controller[_0x3fab('0x13')]);router[_0x3fab('0x11')](_0x3fab('0x14'),auth[_0x3fab('0x8')](),controller[_0x3fab('0x15')]);router[_0x3fab('0x16')](_0x3fab('0xc'),auth[_0x3fab('0x8')](),controller['update']);router[_0x3fab('0x17')](_0x3fab('0xc'),auth[_0x3fab('0x8')](),controller[_0x3fab('0x18')]);router[_0x3fab('0x17')](_0x3fab('0xf'),auth[_0x3fab('0x8')](),controller[_0x3fab('0x19')]);router['delete']('/:id/users',auth[_0x3fab('0x8')](),controller['removeAgents']);module[_0x3fab('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index dc75b09..7bad3f4 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 _0x096b=['roundrobin','STRING','name','ENUM','rrmemory','beepall'];(function(_0x39c95f,_0x2b07a3){var _0x298c2f=function(_0x54319a){while(--_0x54319a){_0x39c95f['push'](_0x39c95f['shift']());}};_0x298c2f(++_0x2b07a3);}(_0x096b,0xe5));var _0xb096=function(_0x1cdb38,_0x1f604c){_0x1cdb38=_0x1cdb38-0x0;var _0x3fb3dd=_0x096b[_0x1cdb38];return _0x3fb3dd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb096('0x0')],'unique':_0xb096('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb096('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb096('0x2')](_0xb096('0x3'),_0xb096('0x4'),_0xb096('0x5'))}}; \ No newline at end of file +var _0x53e5=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x53e5,0xfa));var _0x553e=function(_0x20a29a,_0x1730a0){_0x20a29a=_0x20a29a-0x0;var _0x4396f9=_0x53e5[_0x20a29a];return _0x4396f9;};'use strict';var Sequelize=require(_0x553e('0x0'));module['exports']={'name':{'type':Sequelize[_0x553e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x553e('0x1')]},'timeout':{'type':Sequelize[_0x553e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x553e('0x3')](_0x553e('0x4'),'beepall',_0x553e('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f8600f4..ae6f20b 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 _0x90ec=['role','UserProfileSection','autoAssociation','describe','getMembers','findOne','pick','MailQueueId','UserMailQueue','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','getTeams','Team','Agents','online','voicePause','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','get','MailQueues','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x90ec,0x1d9));var _0xc90e=function(_0x7a78d7,_0x2ad978){_0x7a78d7=_0x7a78d7-0x0;var _0x5b05d1=_0x90ec[_0x7a78d7];return _0x5b05d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc90e('0x0'));var zipdir=require(_0xc90e('0x1'));var jsonpatch=require(_0xc90e('0x2'));var rp=require(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var BPromise=require(_0xc90e('0x5'));var Mustache=require(_0xc90e('0x6'));var util=require(_0xc90e('0x7'));var path=require(_0xc90e('0x8'));var sox=require(_0xc90e('0x9'));var csv=require(_0xc90e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc90e('0xb'));var squel=require(_0xc90e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc90e('0xd'));var deskjs=require(_0xc90e('0xe'));var toCsv=require(_0xc90e('0xa'));var querystring=require(_0xc90e('0xf'));var Papa=require('papaparse');var Redis=require(_0xc90e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc90e('0x11'));var as=require(_0xc90e('0x12'));var hardwareService=require(_0xc90e('0x13'));var logger=require(_0xc90e('0x14'))(_0xc90e('0x15'));var utils=require('../../config/utils');var config=require(_0xc90e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc90e('0x17'))['db'];config['redis']=_[_0xc90e('0x18')](config['redis'],{'host':_0xc90e('0x19'),'port':0x18eb});var socket=require(_0xc90e('0x1a'))(new Redis(config['redis']));require(_0xc90e('0x1b'))['register'](socket);function respondWithStatusCode(_0x1d69bb,_0x1d095f){_0x1d095f=_0x1d095f||0xcc;return function(_0x1dec64){if(_0x1dec64){return _0x1d69bb[_0xc90e('0x1c')](_0x1d095f);}return _0x1d69bb[_0xc90e('0x1d')](_0x1d095f)[_0xc90e('0x1e')]();};}function respondWithResult(_0x1ea2f8,_0x954817){_0x954817=_0x954817||0xc8;return function(_0x4a7750){if(_0x4a7750){return _0x1ea2f8[_0xc90e('0x1d')](_0x954817)['json'](_0x4a7750);}};}function respondWithFilteredResult(_0x1ec1ec,_0xbeef7c){return function(_0x56499e){if(_0x56499e){var _0x209a08=typeof _0xbeef7c[_0xc90e('0x1f')]===_0xc90e('0x20')&&typeof _0xbeef7c['limit']==='undefined';var _0x329c31=_0x56499e[_0xc90e('0x21')];var _0x5bd1de=_0x209a08?0x0:_0xbeef7c[_0xc90e('0x1f')];var _0x192180=_0x209a08?_0x56499e[_0xc90e('0x21')]:_0xbeef7c[_0xc90e('0x1f')]+_0xbeef7c[_0xc90e('0x22')];var _0xb6dbfd;if(_0x192180>=_0x329c31){_0x192180=_0x329c31;_0xb6dbfd=0xc8;}else{_0xb6dbfd=0xce;}_0x1ec1ec[_0xc90e('0x1d')](_0xb6dbfd);return _0x1ec1ec[_0xc90e('0x23')](_0xc90e('0x24'),_0x5bd1de+'-'+_0x192180+'/'+_0x329c31)[_0xc90e('0x25')](_0x56499e);}return null;};}function patchUpdates(_0x3965fd){return function(_0xdc7fbe){try{jsonpatch['apply'](_0xdc7fbe,_0x3965fd,!![]);}catch(_0x867107){return BPromise['reject'](_0x867107);}return _0xdc7fbe[_0xc90e('0x26')]();};}function saveUpdates(_0x2e98ac,_0x34e0ec){return function(_0x5f24d7){if(_0x5f24d7){return _0x5f24d7[_0xc90e('0x27')](_0x2e98ac)[_0xc90e('0x28')](function(_0x4a56e0){return _0x4a56e0;});}return null;};}function removeEntity(_0x2c1aa1,_0x1e6bac){return function(_0x5d66ea){if(_0x5d66ea){return _0x5d66ea[_0xc90e('0x29')]()[_0xc90e('0x28')](function(){var _0x52c86f=_0x5d66ea[_0xc90e('0x2a')]({'plain':!![]});var _0x56138a=_0xc90e('0x2b');return db['UserProfileResource'][_0xc90e('0x29')]({'where':{'type':_0x56138a,'resourceId':_0x52c86f['id']}})[_0xc90e('0x28')](function(){return _0x5d66ea;});})[_0xc90e('0x28')](function(){_0x2c1aa1[_0xc90e('0x1d')](0xcc)[_0xc90e('0x1e')]();});}};}function handleEntityNotFound(_0x473835,_0x5eb8c0){return function(_0x558995){if(!_0x558995){_0x473835[_0xc90e('0x1c')](0x194);}return _0x558995;};}function handleError(_0x5901ed,_0x2c8869){_0x2c8869=_0x2c8869||0x1f4;return function(_0x426567){logger[_0xc90e('0x2c')](_0x426567[_0xc90e('0x2d')]);if(_0x426567[_0xc90e('0x2e')]){delete _0x426567[_0xc90e('0x2e')];}_0x5901ed[_0xc90e('0x1d')](_0x2c8869)[_0xc90e('0x2f')](_0x426567);};}exports[_0xc90e('0x30')]=function(_0x5d0c34,_0x397d73){var _0x2576e9={},_0x467cc0={},_0x14a97a={'count':0x0,'rows':[]};var _0x596db2=_['map'](db[_0xc90e('0x31')][_0xc90e('0x32')],function(_0x1798e8){return{'name':_0x1798e8[_0xc90e('0x33')],'type':_0x1798e8[_0xc90e('0x34')][_0xc90e('0x35')]};});_0x467cc0[_0xc90e('0x36')]=_['map'](_0x596db2,'name');_0x467cc0['query']=_['keys'](_0x5d0c34['query']);_0x467cc0[_0xc90e('0x37')]=_[_0xc90e('0x38')](_0x467cc0[_0xc90e('0x36')],_0x467cc0[_0xc90e('0x39')]);_0x2576e9['attributes']=_[_0xc90e('0x38')](_0x467cc0[_0xc90e('0x36')],qs['fields'](_0x5d0c34[_0xc90e('0x39')][_0xc90e('0x3a')]));_0x2576e9['attributes']=_0x2576e9[_0xc90e('0x3b')][_0xc90e('0x3c')]?_0x2576e9[_0xc90e('0x3b')]:_0x467cc0[_0xc90e('0x36')];if(!_0x5d0c34[_0xc90e('0x39')][_0xc90e('0x3d')](_0xc90e('0x3e'))){_0x2576e9[_0xc90e('0x22')]=qs[_0xc90e('0x22')](_0x5d0c34[_0xc90e('0x39')][_0xc90e('0x22')]);_0x2576e9[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x5d0c34[_0xc90e('0x39')][_0xc90e('0x1f')]);}_0x2576e9[_0xc90e('0x3f')]=qs['sort'](_0x5d0c34[_0xc90e('0x39')][_0xc90e('0x40')]);_0x2576e9[_0xc90e('0x41')]=qs[_0xc90e('0x37')](_['pick'](_0x5d0c34[_0xc90e('0x39')],_0x467cc0[_0xc90e('0x37')]),_0x596db2);if(_0x5d0c34['query'][_0xc90e('0x42')]){_0x2576e9['where']=_[_0xc90e('0x43')](_0x2576e9[_0xc90e('0x41')],{'$or':_[_0xc90e('0x44')](_0x596db2,function(_0x51c06d){if(_0x51c06d[_0xc90e('0x34')]!=='VIRTUAL'){var _0x5122c7={};_0x5122c7[_0x51c06d[_0xc90e('0x2e')]]={'$like':'%'+_0x5d0c34[_0xc90e('0x39')][_0xc90e('0x42')]+'%'};return _0x5122c7;}})});}_0x2576e9=_[_0xc90e('0x43')]({},_0x2576e9,_0x5d0c34[_0xc90e('0x45')]);var _0x548fad={'where':_0x2576e9[_0xc90e('0x41')]};return db['MailQueue'][_0xc90e('0x21')](_0x548fad)['then'](function(_0x55aa5c){_0x14a97a[_0xc90e('0x21')]=_0x55aa5c;if(_0x5d0c34[_0xc90e('0x39')]['includeAll']){_0x2576e9[_0xc90e('0x46')]=[{'all':!![]}];}return db[_0xc90e('0x31')][_0xc90e('0x47')](_0x2576e9);})[_0xc90e('0x28')](function(_0x2f644e){_0x14a97a[_0xc90e('0x48')]=_0x2f644e;return _0x14a97a;})[_0xc90e('0x28')](respondWithFilteredResult(_0x397d73,_0x2576e9))[_0xc90e('0x49')](handleError(_0x397d73,null));};exports[_0xc90e('0x4a')]=function(_0x57f715,_0x134ce7){var _0x4d3cc4={'raw':!![],'where':{'id':_0x57f715[_0xc90e('0x4b')]['id']}},_0x124473={};_0x124473[_0xc90e('0x36')]=_[_0xc90e('0x4c')](db[_0xc90e('0x31')]['rawAttributes']);_0x124473['query']=_[_0xc90e('0x4c')](_0x57f715['query']);_0x124473[_0xc90e('0x37')]=_[_0xc90e('0x38')](_0x124473[_0xc90e('0x36')],_0x124473[_0xc90e('0x39')]);_0x4d3cc4[_0xc90e('0x3b')]=_[_0xc90e('0x38')](_0x124473['model'],qs['fields'](_0x57f715['query'][_0xc90e('0x3a')]));_0x4d3cc4[_0xc90e('0x3b')]=_0x4d3cc4[_0xc90e('0x3b')][_0xc90e('0x3c')]?_0x4d3cc4[_0xc90e('0x3b')]:_0x124473['model'];if(_0x57f715[_0xc90e('0x39')][_0xc90e('0x4d')]){_0x4d3cc4[_0xc90e('0x46')]=[{'all':!![]}];}_0x4d3cc4=_[_0xc90e('0x43')]({},_0x4d3cc4,_0x57f715[_0xc90e('0x45')]);return db['MailQueue'][_0xc90e('0x4e')](_0x4d3cc4)[_0xc90e('0x28')](handleEntityNotFound(_0x134ce7,null))[_0xc90e('0x28')](respondWithResult(_0x134ce7,null))['catch'](handleError(_0x134ce7,null));};exports[_0xc90e('0x4f')]=function(_0x291687,_0x4c205d){return db[_0xc90e('0x31')][_0xc90e('0x4f')](_0x291687[_0xc90e('0x50')],{})['then'](function(_0x2a1d99){var _0x1bc948=_0x291687[_0xc90e('0x51')]['get']({'plain':!![]});if(!_0x1bc948)throw new Error(_0xc90e('0x52'));if(_0x1bc948[_0xc90e('0x53')]==='user'){var _0x5555f6=_0x2a1d99[_0xc90e('0x2a')]({'plain':!![]});var _0x233414=_0xc90e('0x2b');return db[_0xc90e('0x54')][_0xc90e('0x4e')]({'where':{'name':_0x233414,'userProfileId':_0x1bc948['userProfileId']},'raw':!![]})[_0xc90e('0x28')](function(_0x4ef5c4){if(_0x4ef5c4&&_0x4ef5c4[_0xc90e('0x55')]===0x0){return db['UserProfileResource'][_0xc90e('0x4f')]({'name':_0x5555f6[_0xc90e('0x2e')],'resourceId':_0x5555f6['id'],'type':_0x4ef5c4['name'],'sectionId':_0x4ef5c4['id']},{})[_0xc90e('0x28')](function(){return _0x2a1d99;});}else{return _0x2a1d99;}})['catch'](function(_0x5532fd){logger[_0xc90e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5532fd);throw _0x5532fd;});}return _0x2a1d99;})[_0xc90e('0x28')](respondWithResult(_0x4c205d,0xc9))[_0xc90e('0x49')](handleError(_0x4c205d,null));};exports[_0xc90e('0x27')]=function(_0x3b529b,_0x524cbf){if(_0x3b529b[_0xc90e('0x50')]['id']){delete _0x3b529b[_0xc90e('0x50')]['id'];}return db[_0xc90e('0x31')][_0xc90e('0x4e')]({'where':{'id':_0x3b529b[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](handleEntityNotFound(_0x524cbf,null))[_0xc90e('0x28')](saveUpdates(_0x3b529b['body'],null))[_0xc90e('0x28')](respondWithResult(_0x524cbf,null))[_0xc90e('0x49')](handleError(_0x524cbf,null));};exports[_0xc90e('0x29')]=function(_0x5b9bea,_0xf3dbd2){return db[_0xc90e('0x31')]['find']({'where':{'id':_0x5b9bea[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](handleEntityNotFound(_0xf3dbd2,null))[_0xc90e('0x28')](removeEntity(_0xf3dbd2,null))[_0xc90e('0x49')](handleError(_0xf3dbd2,null));};exports[_0xc90e('0x56')]=function(_0x50c8f3,_0x2fd9ac){return db[_0xc90e('0x31')][_0xc90e('0x56')]()['then'](respondWithResult(_0x2fd9ac,null))[_0xc90e('0x49')](handleError(_0x2fd9ac,null));};exports[_0xc90e('0x57')]=function(_0x353382,_0x375b41,_0x5b5729){var _0x2aab76={'raw':!![],'where':{}},_0x519b1c={},_0x506dcd;return db[_0xc90e('0x31')][_0xc90e('0x58')]({'where':{'id':_0x353382['params']['id']}})['then'](handleEntityNotFound(_0x375b41,null))[_0xc90e('0x28')](function(_0x2a90fc){if(_0x2a90fc){_0x506dcd=_0x2a90fc[_0xc90e('0x2a')]({'plain':!![]});_0x519b1c['model']=_[_0xc90e('0x4c')](db['UserMailQueue'][_0xc90e('0x32')]);_0x519b1c[_0xc90e('0x39')]=_[_0xc90e('0x4c')](_0x353382[_0xc90e('0x39')]);_0x519b1c['filters']=_['intersection'](_0x519b1c[_0xc90e('0x36')],_0x519b1c[_0xc90e('0x39')]);_0x2aab76[_0xc90e('0x3b')]=_[_0xc90e('0x38')](_0x519b1c[_0xc90e('0x36')],qs['fields'](_0x353382['query'][_0xc90e('0x3a')]));_0x2aab76[_0xc90e('0x3b')]=_0x2aab76['attributes'][_0xc90e('0x3c')]?_0x2aab76['attributes']:_0x519b1c[_0xc90e('0x36')];if(!_0x353382['query']['hasOwnProperty'](_0xc90e('0x3e'))){_0x2aab76[_0xc90e('0x22')]=qs[_0xc90e('0x22')](_0x353382['query'][_0xc90e('0x22')]);_0x2aab76[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x353382[_0xc90e('0x39')][_0xc90e('0x1f')]);}_0x2aab76['order']=qs['sort'](_0x353382[_0xc90e('0x39')][_0xc90e('0x40')]);_0x2aab76[_0xc90e('0x41')]=qs[_0xc90e('0x37')](_[_0xc90e('0x59')](_0x353382[_0xc90e('0x39')],_0x519b1c[_0xc90e('0x37')]));_0x2aab76[_0xc90e('0x41')][_0xc90e('0x5a')]=_0x2a90fc['id'];if(_0x353382[_0xc90e('0x39')][_0xc90e('0x42')]){_0x2aab76[_0xc90e('0x41')]=_[_0xc90e('0x43')](_0x2aab76[_0xc90e('0x41')],{'$or':_[_0xc90e('0x44')](_0x2aab76[_0xc90e('0x3b')],function(_0x39e8da){var _0x36673d={};_0x36673d[_0x39e8da]={'$like':'%'+_0x353382[_0xc90e('0x39')]['filter']+'%'};return _0x36673d;})});}_0x2aab76=_[_0xc90e('0x43')]({},_0x2aab76,_0x353382[_0xc90e('0x45')]);return db[_0xc90e('0x5b')][_0xc90e('0x47')](_0x2aab76);}})['then'](function(_0x1fc3bb){if(_0x1fc3bb){return db[_0xc90e('0x5c')][_0xc90e('0x5d')]({'where':{'id':_['map'](_0x1fc3bb,'UserId'),'role':_0xc90e('0x5e')},'attributes':['id',_0xc90e('0x2e'),_0xc90e('0x5f'),_0xc90e('0x60'),_0xc90e('0x61')]});}})['then'](function(_0x1e11b6){if(_0x1e11b6){return{'count':_0x1e11b6[_0xc90e('0x21')],'rows':_[_0xc90e('0x44')](_0x1e11b6['rows'],function(_0x38007c){return{'membername':_0x38007c['name'],'UserId':_0x38007c['id'],'queue_name':_0x506dcd[_0xc90e('0x2e')],'MailQueueId':_0x506dcd['id'],'interface':util[_0xc90e('0x62')]('%s/%s','SIP',_0x38007c[_0xc90e('0x2e')]),'penalty':0x0,'paused':_0x38007c['mailPause'],'createdAt':_0x38007c[_0xc90e('0x61')],'updatedAt':_0x38007c[_0xc90e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc90e('0x28')](respondWithFilteredResult(_0x375b41,_0x2aab76))[_0xc90e('0x49')](handleError(_0x375b41,null));};exports[_0xc90e('0x63')]=function(_0x469fab,_0x22df1d,_0x201b9a){var _0x2d533a={};var _0x4ead2c={};var _0x3b1867;var _0x2b9c16;return db[_0xc90e('0x31')][_0xc90e('0x58')]({'where':{'id':_0x469fab[_0xc90e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x22df1d,null))[_0xc90e('0x28')](function(_0x507b6c){if(_0x507b6c){_0x3b1867=_0x507b6c;_0x4ead2c[_0xc90e('0x36')]=_[_0xc90e('0x4c')](db[_0xc90e('0x64')][_0xc90e('0x32')]);_0x4ead2c[_0xc90e('0x39')]=_[_0xc90e('0x4c')](_0x469fab[_0xc90e('0x39')]);_0x4ead2c[_0xc90e('0x37')]=_[_0xc90e('0x38')](_0x4ead2c[_0xc90e('0x36')],_0x4ead2c[_0xc90e('0x39')]);_0x2d533a[_0xc90e('0x3b')]=_['intersection'](_0x4ead2c[_0xc90e('0x36')],qs[_0xc90e('0x3a')](_0x469fab[_0xc90e('0x39')]['fields']));_0x2d533a[_0xc90e('0x3b')]=_0x2d533a[_0xc90e('0x3b')][_0xc90e('0x3c')]?_0x2d533a[_0xc90e('0x3b')]:_0x4ead2c[_0xc90e('0x36')];_0x2d533a[_0xc90e('0x3f')]=qs[_0xc90e('0x40')](_0x469fab[_0xc90e('0x39')][_0xc90e('0x40')]);_0x2d533a['where']=qs[_0xc90e('0x37')](_['pick'](_0x469fab[_0xc90e('0x39')],_0x4ead2c[_0xc90e('0x37')]));if(_0x469fab[_0xc90e('0x39')][_0xc90e('0x42')]){_0x2d533a['where']=_['merge'](_0x2d533a[_0xc90e('0x41')],{'$or':_[_0xc90e('0x44')](_0x2d533a[_0xc90e('0x3b')],function(_0x490083){var _0x5b9785={};_0x5b9785[_0x490083]={'$like':'%'+_0x469fab['query'][_0xc90e('0x42')]+'%'};return _0x5b9785;})});}_0x2d533a=_['merge']({},_0x2d533a,_0x469fab[_0xc90e('0x45')]);return _0x3b1867[_0xc90e('0x63')](_0x2d533a);}})[_0xc90e('0x28')](function(_0x272f52){if(_0x272f52){_0x2b9c16=_0x272f52[_0xc90e('0x3c')];if(!_0x469fab[_0xc90e('0x39')]['hasOwnProperty'](_0xc90e('0x3e'))){_0x2d533a[_0xc90e('0x22')]=qs['limit'](_0x469fab[_0xc90e('0x39')]['limit']);_0x2d533a[_0xc90e('0x1f')]=qs['offset'](_0x469fab[_0xc90e('0x39')][_0xc90e('0x1f')]);}return _0x3b1867['getTeams'](_0x2d533a);}})[_0xc90e('0x28')](function(_0xa51148){if(_0xa51148){return _0xa51148?{'count':_0x2b9c16,'rows':_0xa51148}:null;}})[_0xc90e('0x28')](respondWithResult(_0x22df1d,null))['catch'](handleError(_0x22df1d,null));};exports['addTeams']=function(_0x20d215,_0x536f5f,_0x2050b2){var _0x1935f4=_0x20d215[_0xc90e('0x50')]['ids'];return db[_0xc90e('0x64')][_0xc90e('0x47')]({'where':{'id':_0x1935f4},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc90e('0x65'),'attributes':['id','name',_0xc90e('0x66'),_0xc90e('0x67'),'interface'],'raw':!![]}]})[_0xc90e('0x28')](function(_0x571330){if(_0x571330){var _0x1414b1=_[_0xc90e('0x68')](_0x571330,function(_0x17e8e6){var _0x5efbda=_0x17e8e6['get']({'plain':!![]});return _0x5efbda[_0xc90e('0x65')];});return db[_0xc90e('0x31')][_0xc90e('0x4e')]({'where':{'id':_0x20d215[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](function(_0x3dc108){return db[_0xc90e('0x69')]['transaction'](function(_0x440890){return _0x3dc108[_0xc90e('0x6a')](_0x1935f4,{'transaction':_0x440890})[_0xc90e('0x28')](function(){return BPromise[_0xc90e('0x6b')](_0x1414b1,function(_0x3721a8){return db['UserMailQueue'][_0xc90e('0x6c')]({'where':{'UserId':_0x3721a8['id'],'MailQueueId':_0x20d215[_0xc90e('0x4b')]['id']},'transaction':_0x440890});});})[_0xc90e('0x28')](function(){_0x1414b1[_0xc90e('0x6d')](function(_0x1867d6){socket[_0xc90e('0x6e')](_0xc90e('0x6f'),{'UserId':_0x1867d6['id'],'MailQueueId':_0x3dc108['id']});});});});});}})[_0xc90e('0x28')](respondWithStatusCode(_0x536f5f,null))['catch'](handleError(_0x536f5f,null));};exports['removeTeams']=function(_0x5cd34a,_0x54cabe,_0x6aa046){return db['Team'][_0xc90e('0x47')]({'where':{'id':_0x5cd34a[_0xc90e('0x39')][_0xc90e('0x70')]},'attributes':['id'],'include':[{'model':db[_0xc90e('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc90e('0x28')](handleEntityNotFound(_0x54cabe,null))[_0xc90e('0x28')](function(_0x29c30d){var _0x53d800=_[_0xc90e('0x44')](_0x29c30d,'id');var _0xfa2bfc=[];var _0x565b6a=[];var _0x4ce306=squel[_0xc90e('0x71')]();_0x4ce306[_0xc90e('0x72')](_0xc90e('0x73'))['from'](_0xc90e('0x74'),'tq')[_0xc90e('0x75')](_0xc90e('0x76'),'ut',_0xc90e('0x77'))[_0xc90e('0x41')](_0xc90e('0x78'),_0x5cd34a[_0xc90e('0x4b')]['id']);for(var _0x528967=0x0;_0x528967<_0x29c30d[_0xc90e('0x3c')];_0x528967+=0x1){let _0x357f28=_0x29c30d[_0x528967];for(var _0x29321c=0x0;_0x29321c<_0x357f28[_0xc90e('0x65')][_0xc90e('0x3c')];_0x29321c+=0x1){let _0x124611=_0x357f28[_0xc90e('0x65')][_0x29321c];var _0x4f6062=_0x4ce306[_0xc90e('0x79')]();_0x4f6062[_0xc90e('0x41')](_0xc90e('0x7a'),_0x124611['id']);_0x565b6a['push'](db['sequelize']['query'](_0x4f6062[_0xc90e('0x7b')](),{'type':db[_0xc90e('0x69')][_0xc90e('0x7c')][_0xc90e('0x7d')]})[_0xc90e('0x28')](function(_0x421dba){if(_0x421dba[_0xc90e('0x3c')]===0x1){return _0x124611['id'];}else{var _0x399ca0=_[_0xc90e('0x7e')](_[_0xc90e('0x44')](_0x421dba,'TeamId'),function(_0x37bcde){return _[_0xc90e('0x7f')](_0x53d800,_0x37bcde);});if(_0x399ca0){return _0x124611['id'];}}}));}}return BPromise[_0xc90e('0x80')](_0x565b6a)['then'](function(_0x43a127){_0xfa2bfc=_(_0xfa2bfc)['union'](_0x43a127)['compact']()[_0xc90e('0x81')]();return db['MailQueue']['find']({'where':{'id':_0x5cd34a[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](function(_0x1b770a){return db[_0xc90e('0x69')]['transaction'](function(_0x3917fb){return _0x1b770a[_0xc90e('0x82')](_0x5cd34a[_0xc90e('0x39')][_0xc90e('0x70')],{'transaction':_0x3917fb})[_0xc90e('0x28')](function(){if(!_[_0xc90e('0x83')](_0xfa2bfc)){return _0x1b770a[_0xc90e('0x84')](_0xfa2bfc,{'transaction':_0x3917fb});}})[_0xc90e('0x28')](function(){_0xfa2bfc[_0xc90e('0x6d')](function(_0x6b9e6c){socket[_0xc90e('0x6e')](_0xc90e('0x85'),{'UserId':_0x6b9e6c,'MailQueueId':_0x1b770a['id']});});});});});});})[_0xc90e('0x28')](respondWithStatusCode(_0x54cabe,null))['catch'](handleError(_0x54cabe,null));};exports[_0xc90e('0x86')]=function(_0x229944,_0x254bc5,_0x55cbaf){return db[_0xc90e('0x31')][_0xc90e('0x4e')]({'where':{'id':_0x229944[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](handleEntityNotFound(_0x254bc5,null))[_0xc90e('0x28')](function(_0x1215c6){if(_0x1215c6){return _0x1215c6[_0xc90e('0x86')](_0x229944[_0xc90e('0x50')]['ids'],_[_0xc90e('0x87')](_0x229944['body'],[_0xc90e('0x70'),'id'])||{})[_0xc90e('0x88')](function(_0x1a497c){for(var _0x57cb96=0x0;_0x57cb96<_0x229944[_0xc90e('0x50')][_0xc90e('0x70')][_0xc90e('0x3c')];_0x57cb96+=0x1){socket[_0xc90e('0x6e')](_0xc90e('0x6f'),{'UserId':Number(_0x229944[_0xc90e('0x50')]['ids'][_0x57cb96]),'MailQueueId':Number(_0x229944['params']['id'])});}return _0x1a497c;});}})[_0xc90e('0x28')](respondWithResult(_0x254bc5,null))[_0xc90e('0x49')](handleError(_0x254bc5,null));};exports[_0xc90e('0x84')]=function(_0xfca2da,_0x371efe,_0x4334d4){return db['MailQueue'][_0xc90e('0x4e')]({'where':{'id':_0xfca2da[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](handleEntityNotFound(_0x371efe,null))['then'](function(_0x5777ba){if(_0x5777ba){return _0x5777ba[_0xc90e('0x84')](_0xfca2da[_0xc90e('0x39')][_0xc90e('0x70')])[_0xc90e('0x28')](function(){if(_[_0xc90e('0x89')](_0xfca2da[_0xc90e('0x39')]['ids'])){for(var _0x4f46b6=0x0;_0x4f46b6<_0xfca2da[_0xc90e('0x39')]['ids']['length'];_0x4f46b6+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0xfca2da[_0xc90e('0x39')][_0xc90e('0x70')][_0x4f46b6]),'MailQueueId':Number(_0xfca2da[_0xc90e('0x4b')]['id'])});}}else{socket[_0xc90e('0x6e')](_0xc90e('0x85'),{'UserId':Number(_0xfca2da['query']['ids']),'MailQueueId':Number(_0xfca2da[_0xc90e('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x371efe,null))[_0xc90e('0x49')](handleError(_0x371efe,null));};exports[_0xc90e('0x8a')]=function(_0x32cb1d,_0x1bdbd1,_0x1a6afb){var _0x53418b={};var _0x3af890={};var _0x4b70ff;var _0x5c7d2a;return db[_0xc90e('0x31')][_0xc90e('0x58')]({'where':{'id':_0x32cb1d[_0xc90e('0x4b')]['id']}})[_0xc90e('0x28')](handleEntityNotFound(_0x1bdbd1,null))[_0xc90e('0x28')](function(_0x4548eb){if(_0x4548eb){_0x4b70ff=_0x4548eb;_0x3af890[_0xc90e('0x36')]=_[_0xc90e('0x4c')](db[_0xc90e('0x5c')][_0xc90e('0x32')]);_0x3af890[_0xc90e('0x39')]=_[_0xc90e('0x4c')](_0x32cb1d[_0xc90e('0x39')]);_0x3af890['filters']=_[_0xc90e('0x38')](_0x3af890[_0xc90e('0x36')],_0x3af890['query']);_0x53418b[_0xc90e('0x3b')]=_[_0xc90e('0x38')](_0x3af890[_0xc90e('0x36')],qs[_0xc90e('0x3a')](_0x32cb1d[_0xc90e('0x39')]['fields']));_0x53418b[_0xc90e('0x3b')]=_0x53418b[_0xc90e('0x3b')]['length']?_0x53418b[_0xc90e('0x3b')]:_0x3af890[_0xc90e('0x36')];_0x53418b[_0xc90e('0x3f')]=qs[_0xc90e('0x40')](_0x32cb1d[_0xc90e('0x39')]['sort']);_0x53418b['where']=qs[_0xc90e('0x37')](_[_0xc90e('0x59')](_0x32cb1d['query'],_0x3af890[_0xc90e('0x37')]));if(_0x32cb1d[_0xc90e('0x39')]['filter']){_0x53418b[_0xc90e('0x41')]=_[_0xc90e('0x43')](_0x53418b['where'],{'$or':_['map'](_0x53418b[_0xc90e('0x3b')],function(_0x539e93){var _0x483459={};_0x483459[_0x539e93]={'$like':'%'+_0x32cb1d[_0xc90e('0x39')]['filter']+'%'};return _0x483459;})});}_0x53418b=_['merge']({},_0x53418b,_0x32cb1d[_0xc90e('0x45')]);return _0x4b70ff[_0xc90e('0x8a')](_0x53418b);}})[_0xc90e('0x28')](function(_0x8f49fd){if(_0x8f49fd){_0x5c7d2a=_0x8f49fd[_0xc90e('0x3c')];if(!_0x32cb1d[_0xc90e('0x39')][_0xc90e('0x3d')]('nolimit')){_0x53418b['limit']=qs[_0xc90e('0x22')](_0x32cb1d[_0xc90e('0x39')]['limit']);_0x53418b[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x32cb1d[_0xc90e('0x39')]['offset']);}return _0x4b70ff[_0xc90e('0x8a')](_0x53418b);}})[_0xc90e('0x28')](function(_0xd59af1){if(_0xd59af1){return _0xd59af1?{'count':_0x5c7d2a,'rows':_0xd59af1}:null;}})[_0xc90e('0x28')](respondWithResult(_0x1bdbd1,null))['catch'](handleError(_0x1bdbd1,null));}; \ No newline at end of file +var _0x331c=['limit','undefined','count','set','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','error','name','index','MailQueue','type','key','map','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','length','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','moment','util','sox','to-csv','fs-extra','lodash','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x331c,0xf0));var _0xc331=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x331c[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0xc331('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc331('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc331('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc331('0x3'));var path=require('path');var sox=require(_0xc331('0x4'));var csv=require(_0xc331('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc331('0x6'));var _=require(_0xc331('0x7'));var squel=require('squel');var crypto=require(_0xc331('0x8'));var jsforce=require(_0xc331('0x9'));var deskjs=require(_0xc331('0xa'));var toCsv=require(_0xc331('0x5'));var querystring=require('querystring');var Papa=require(_0xc331('0xb'));var Redis=require('ioredis');var authService=require(_0xc331('0xc'));var qs=require(_0xc331('0xd'));var as=require(_0xc331('0xe'));var hardwareService=require(_0xc331('0xf'));var logger=require(_0xc331('0x10'))(_0xc331('0x11'));var utils=require(_0xc331('0x12'));var config=require(_0xc331('0x13'));var licenseUtil=require(_0xc331('0x14'));var db=require('../../mysqldb')['db'];config[_0xc331('0x15')]=_[_0xc331('0x16')](config[_0xc331('0x15')],{'host':_0xc331('0x17'),'port':0x18eb});var socket=require(_0xc331('0x18'))(new Redis(config[_0xc331('0x15')]));require('./mailQueue.socket')[_0xc331('0x19')](socket);function respondWithStatusCode(_0x32d7ad,_0x4dbe9a){_0x4dbe9a=_0x4dbe9a||0xcc;return function(_0x3492b9){if(_0x3492b9){return _0x32d7ad[_0xc331('0x1a')](_0x4dbe9a);}return _0x32d7ad[_0xc331('0x1b')](_0x4dbe9a)[_0xc331('0x1c')]();};}function respondWithResult(_0x5265b5,_0x5808f6){_0x5808f6=_0x5808f6||0xc8;return function(_0x108485){if(_0x108485){return _0x5265b5[_0xc331('0x1b')](_0x5808f6)['json'](_0x108485);}};}function respondWithFilteredResult(_0x1fa375,_0x3839ce){return function(_0x4ee88d){if(_0x4ee88d){var _0x24f515=typeof _0x3839ce[_0xc331('0x1d')]==='undefined'&&typeof _0x3839ce[_0xc331('0x1e')]===_0xc331('0x1f');var _0x19ed1f=_0x4ee88d[_0xc331('0x20')];var _0x34ccdd=_0x24f515?0x0:_0x3839ce['offset'];var _0x34d67c=_0x24f515?_0x4ee88d['count']:_0x3839ce[_0xc331('0x1d')]+_0x3839ce[_0xc331('0x1e')];var _0x571826;if(_0x34d67c>=_0x19ed1f){_0x34d67c=_0x19ed1f;_0x571826=0xc8;}else{_0x571826=0xce;}_0x1fa375[_0xc331('0x1b')](_0x571826);return _0x1fa375[_0xc331('0x21')](_0xc331('0x22'),_0x34ccdd+'-'+_0x34d67c+'/'+_0x19ed1f)['json'](_0x4ee88d);}return null;};}function patchUpdates(_0x176383){return function(_0x466252){try{jsonpatch['apply'](_0x466252,_0x176383,!![]);}catch(_0x2d274f){return BPromise['reject'](_0x2d274f);}return _0x466252['save']();};}function saveUpdates(_0x51154d,_0x32839f){return function(_0x5ddcf9){if(_0x5ddcf9){return _0x5ddcf9[_0xc331('0x23')](_0x51154d)[_0xc331('0x24')](function(_0x16ea9f){return _0x16ea9f;});}return null;};}function removeEntity(_0x148823,_0x59e015){return function(_0x3e5a23){if(_0x3e5a23){return _0x3e5a23['destroy']()['then'](function(){var _0x55338e=_0x3e5a23[_0xc331('0x25')]({'plain':!![]});var _0x5438e9=_0xc331('0x26');return db[_0xc331('0x27')][_0xc331('0x28')]({'where':{'type':_0x5438e9,'resourceId':_0x55338e['id']}})[_0xc331('0x24')](function(){return _0x3e5a23;});})[_0xc331('0x24')](function(){_0x148823[_0xc331('0x1b')](0xcc)[_0xc331('0x1c')]();});}};}function handleEntityNotFound(_0x35453b,_0x345ae4){return function(_0x2a1fbd){if(!_0x2a1fbd){_0x35453b['sendStatus'](0x194);}return _0x2a1fbd;};}function handleError(_0x8f656b,_0x20042a){_0x20042a=_0x20042a||0x1f4;return function(_0x5d49f7){logger[_0xc331('0x29')](_0x5d49f7['stack']);if(_0x5d49f7[_0xc331('0x2a')]){delete _0x5d49f7['name'];}_0x8f656b[_0xc331('0x1b')](_0x20042a)['send'](_0x5d49f7);};}exports[_0xc331('0x2b')]=function(_0x38d131,_0x21c4fe){var _0x41ef84={},_0xc27e13={},_0x2a27c2={'count':0x0,'rows':[]};var _0x5b448f=_['map'](db[_0xc331('0x2c')]['rawAttributes'],function(_0x58ea1c){return{'name':_0x58ea1c['fieldName'],'type':_0x58ea1c[_0xc331('0x2d')][_0xc331('0x2e')]};});_0xc27e13['model']=_[_0xc331('0x2f')](_0x5b448f,_0xc331('0x2a'));_0xc27e13[_0xc331('0x30')]=_[_0xc331('0x31')](_0x38d131[_0xc331('0x30')]);_0xc27e13[_0xc331('0x32')]=_[_0xc331('0x33')](_0xc27e13['model'],_0xc27e13[_0xc331('0x30')]);_0x41ef84[_0xc331('0x34')]=_['intersection'](_0xc27e13[_0xc331('0x35')],qs[_0xc331('0x36')](_0x38d131[_0xc331('0x30')][_0xc331('0x36')]));_0x41ef84[_0xc331('0x34')]=_0x41ef84[_0xc331('0x34')]['length']?_0x41ef84['attributes']:_0xc27e13[_0xc331('0x35')];if(!_0x38d131['query']['hasOwnProperty'](_0xc331('0x37'))){_0x41ef84['limit']=qs['limit'](_0x38d131[_0xc331('0x30')][_0xc331('0x1e')]);_0x41ef84[_0xc331('0x1d')]=qs['offset'](_0x38d131['query'][_0xc331('0x1d')]);}_0x41ef84[_0xc331('0x38')]=qs[_0xc331('0x39')](_0x38d131[_0xc331('0x30')]['sort']);_0x41ef84[_0xc331('0x3a')]=qs[_0xc331('0x32')](_['pick'](_0x38d131[_0xc331('0x30')],_0xc27e13[_0xc331('0x32')]),_0x5b448f);if(_0x38d131[_0xc331('0x30')][_0xc331('0x3b')]){_0x41ef84['where']=_[_0xc331('0x3c')](_0x41ef84[_0xc331('0x3a')],{'$or':_[_0xc331('0x2f')](_0x5b448f,function(_0x5aee94){if(_0x5aee94[_0xc331('0x2d')]!==_0xc331('0x3d')){var _0x490246={};_0x490246[_0x5aee94[_0xc331('0x2a')]]={'$like':'%'+_0x38d131[_0xc331('0x30')]['filter']+'%'};return _0x490246;}})});}_0x41ef84=_[_0xc331('0x3c')]({},_0x41ef84,_0x38d131['options']);var _0x12a47b={'where':_0x41ef84[_0xc331('0x3a')]};return db[_0xc331('0x2c')][_0xc331('0x20')](_0x12a47b)[_0xc331('0x24')](function(_0x29280b){_0x2a27c2[_0xc331('0x20')]=_0x29280b;if(_0x38d131[_0xc331('0x30')]['includeAll']){_0x41ef84['include']=[{'all':!![]}];}return db[_0xc331('0x2c')][_0xc331('0x3e')](_0x41ef84);})['then'](function(_0x517bee){_0x2a27c2[_0xc331('0x3f')]=_0x517bee;return _0x2a27c2;})['then'](respondWithFilteredResult(_0x21c4fe,_0x41ef84))[_0xc331('0x40')](handleError(_0x21c4fe,null));};exports[_0xc331('0x41')]=function(_0x409639,_0xa3c793){var _0x1aa1e1={'raw':!![],'where':{'id':_0x409639['params']['id']}},_0xab6536={};_0xab6536[_0xc331('0x35')]=_[_0xc331('0x31')](db[_0xc331('0x2c')][_0xc331('0x42')]);_0xab6536[_0xc331('0x30')]=_[_0xc331('0x31')](_0x409639[_0xc331('0x30')]);_0xab6536[_0xc331('0x32')]=_[_0xc331('0x33')](_0xab6536[_0xc331('0x35')],_0xab6536[_0xc331('0x30')]);_0x1aa1e1['attributes']=_['intersection'](_0xab6536[_0xc331('0x35')],qs[_0xc331('0x36')](_0x409639[_0xc331('0x30')][_0xc331('0x36')]));_0x1aa1e1['attributes']=_0x1aa1e1[_0xc331('0x34')]['length']?_0x1aa1e1[_0xc331('0x34')]:_0xab6536['model'];if(_0x409639[_0xc331('0x30')]['includeAll']){_0x1aa1e1[_0xc331('0x43')]=[{'all':!![]}];}_0x1aa1e1=_['merge']({},_0x1aa1e1,_0x409639[_0xc331('0x44')]);return db[_0xc331('0x2c')][_0xc331('0x45')](_0x1aa1e1)['then'](handleEntityNotFound(_0xa3c793,null))[_0xc331('0x24')](respondWithResult(_0xa3c793,null))[_0xc331('0x40')](handleError(_0xa3c793,null));};exports[_0xc331('0x46')]=function(_0x1bb113,_0x2bddc4){return db[_0xc331('0x2c')][_0xc331('0x46')](_0x1bb113[_0xc331('0x47')],{})[_0xc331('0x24')](function(_0x2f13d7){var _0x39c678=_0x1bb113[_0xc331('0x48')]['get']({'plain':!![]});if(!_0x39c678)throw new Error(_0xc331('0x49'));if(_0x39c678[_0xc331('0x4a')]===_0xc331('0x48')){var _0x142daa=_0x2f13d7[_0xc331('0x25')]({'plain':!![]});var _0x1b1293='MailQueues';return db[_0xc331('0x4b')][_0xc331('0x45')]({'where':{'name':_0x1b1293,'userProfileId':_0x39c678[_0xc331('0x4c')]},'raw':!![]})['then'](function(_0x914806){if(_0x914806&&_0x914806[_0xc331('0x4d')]===0x0){return db['UserProfileResource'][_0xc331('0x46')]({'name':_0x142daa[_0xc331('0x2a')],'resourceId':_0x142daa['id'],'type':_0x914806[_0xc331('0x2a')],'sectionId':_0x914806['id']},{})[_0xc331('0x24')](function(){return _0x2f13d7;});}else{return _0x2f13d7;}})[_0xc331('0x40')](function(_0x631a1d){logger[_0xc331('0x29')](_0xc331('0x4e'),_0x631a1d);throw _0x631a1d;});}return _0x2f13d7;})[_0xc331('0x24')](respondWithResult(_0x2bddc4,0xc9))[_0xc331('0x40')](handleError(_0x2bddc4,null));};exports[_0xc331('0x23')]=function(_0x8a0284,_0x15771c){if(_0x8a0284[_0xc331('0x47')]['id']){delete _0x8a0284[_0xc331('0x47')]['id'];}return db[_0xc331('0x2c')][_0xc331('0x45')]({'where':{'id':_0x8a0284[_0xc331('0x4f')]['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x15771c,null))['then'](saveUpdates(_0x8a0284['body'],null))[_0xc331('0x24')](respondWithResult(_0x15771c,null))['catch'](handleError(_0x15771c,null));};exports[_0xc331('0x28')]=function(_0x54d214,_0x250893){return db[_0xc331('0x2c')][_0xc331('0x45')]({'where':{'id':_0x54d214['params']['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x250893,null))[_0xc331('0x24')](removeEntity(_0x250893,null))[_0xc331('0x40')](handleError(_0x250893,null));};exports[_0xc331('0x50')]=function(_0x3750ae,_0x2e6dc8){return db['MailQueue'][_0xc331('0x50')]()[_0xc331('0x24')](respondWithResult(_0x2e6dc8,null))[_0xc331('0x40')](handleError(_0x2e6dc8,null));};exports[_0xc331('0x51')]=function(_0x3a318c,_0x30629c,_0x22daf5){var _0x208598={'raw':!![],'where':{}},_0x164f9e={},_0x52a9be;return db[_0xc331('0x2c')][_0xc331('0x52')]({'where':{'id':_0x3a318c[_0xc331('0x4f')]['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x30629c,null))[_0xc331('0x24')](function(_0xd5c93d){if(_0xd5c93d){_0x52a9be=_0xd5c93d['get']({'plain':!![]});_0x164f9e[_0xc331('0x35')]=_['keys'](db[_0xc331('0x53')][_0xc331('0x42')]);_0x164f9e[_0xc331('0x30')]=_[_0xc331('0x31')](_0x3a318c['query']);_0x164f9e[_0xc331('0x32')]=_[_0xc331('0x33')](_0x164f9e[_0xc331('0x35')],_0x164f9e[_0xc331('0x30')]);_0x208598[_0xc331('0x34')]=_[_0xc331('0x33')](_0x164f9e[_0xc331('0x35')],qs[_0xc331('0x36')](_0x3a318c['query']['fields']));_0x208598[_0xc331('0x34')]=_0x208598[_0xc331('0x34')]['length']?_0x208598[_0xc331('0x34')]:_0x164f9e[_0xc331('0x35')];if(!_0x3a318c[_0xc331('0x30')][_0xc331('0x54')]('nolimit')){_0x208598['limit']=qs[_0xc331('0x1e')](_0x3a318c['query'][_0xc331('0x1e')]);_0x208598['offset']=qs[_0xc331('0x1d')](_0x3a318c['query']['offset']);}_0x208598['order']=qs[_0xc331('0x39')](_0x3a318c[_0xc331('0x30')]['sort']);_0x208598[_0xc331('0x3a')]=qs[_0xc331('0x32')](_[_0xc331('0x55')](_0x3a318c['query'],_0x164f9e['filters']));_0x208598[_0xc331('0x3a')][_0xc331('0x56')]=_0xd5c93d['id'];if(_0x3a318c[_0xc331('0x30')][_0xc331('0x3b')]){_0x208598[_0xc331('0x3a')]=_[_0xc331('0x3c')](_0x208598[_0xc331('0x3a')],{'$or':_[_0xc331('0x2f')](_0x208598[_0xc331('0x34')],function(_0xeb07a1){var _0xb6ab08={};_0xb6ab08[_0xeb07a1]={'$like':'%'+_0x3a318c[_0xc331('0x30')]['filter']+'%'};return _0xb6ab08;})});}_0x208598=_[_0xc331('0x3c')]({},_0x208598,_0x3a318c[_0xc331('0x44')]);return db[_0xc331('0x53')][_0xc331('0x3e')](_0x208598);}})[_0xc331('0x24')](function(_0x2ba056){if(_0x2ba056){return db[_0xc331('0x57')][_0xc331('0x58')]({'where':{'id':_[_0xc331('0x2f')](_0x2ba056,_0xc331('0x59')),'role':_0xc331('0x5a')},'attributes':['id',_0xc331('0x2a'),_0xc331('0x5b'),_0xc331('0x5c'),_0xc331('0x5d')]});}})['then'](function(_0x343614){if(_0x343614){return{'count':_0x343614[_0xc331('0x20')],'rows':_[_0xc331('0x2f')](_0x343614['rows'],function(_0x13af70){return{'membername':_0x13af70['name'],'UserId':_0x13af70['id'],'queue_name':_0x52a9be[_0xc331('0x2a')],'MailQueueId':_0x52a9be['id'],'interface':util[_0xc331('0x5e')](_0xc331('0x5f'),_0xc331('0x60'),_0x13af70[_0xc331('0x2a')]),'penalty':0x0,'paused':_0x13af70[_0xc331('0x5b')],'createdAt':_0x13af70['createdAt'],'updatedAt':_0x13af70[_0xc331('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x30629c,_0x208598))['catch'](handleError(_0x30629c,null));};exports[_0xc331('0x61')]=function(_0x5cde48,_0x4aab75,_0x316a1a){var _0x442887={};var _0x5755e2={};var _0x4241d6;var _0xcbf5e8;return db[_0xc331('0x2c')][_0xc331('0x52')]({'where':{'id':_0x5cde48[_0xc331('0x4f')]['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x4aab75,null))['then'](function(_0x312cac){if(_0x312cac){_0x4241d6=_0x312cac;_0x5755e2[_0xc331('0x35')]=_['keys'](db[_0xc331('0x62')]['rawAttributes']);_0x5755e2['query']=_['keys'](_0x5cde48[_0xc331('0x30')]);_0x5755e2[_0xc331('0x32')]=_[_0xc331('0x33')](_0x5755e2[_0xc331('0x35')],_0x5755e2['query']);_0x442887[_0xc331('0x34')]=_[_0xc331('0x33')](_0x5755e2[_0xc331('0x35')],qs[_0xc331('0x36')](_0x5cde48[_0xc331('0x30')]['fields']));_0x442887[_0xc331('0x34')]=_0x442887[_0xc331('0x34')]['length']?_0x442887['attributes']:_0x5755e2[_0xc331('0x35')];_0x442887['order']=qs[_0xc331('0x39')](_0x5cde48['query']['sort']);_0x442887['where']=qs[_0xc331('0x32')](_[_0xc331('0x55')](_0x5cde48[_0xc331('0x30')],_0x5755e2[_0xc331('0x32')]));if(_0x5cde48[_0xc331('0x30')][_0xc331('0x3b')]){_0x442887['where']=_[_0xc331('0x3c')](_0x442887[_0xc331('0x3a')],{'$or':_[_0xc331('0x2f')](_0x442887[_0xc331('0x34')],function(_0x5b9d5d){var _0x483c30={};_0x483c30[_0x5b9d5d]={'$like':'%'+_0x5cde48[_0xc331('0x30')]['filter']+'%'};return _0x483c30;})});}_0x442887=_[_0xc331('0x3c')]({},_0x442887,_0x5cde48[_0xc331('0x44')]);return _0x4241d6[_0xc331('0x61')](_0x442887);}})[_0xc331('0x24')](function(_0x573b9a){if(_0x573b9a){_0xcbf5e8=_0x573b9a[_0xc331('0x63')];if(!_0x5cde48[_0xc331('0x30')][_0xc331('0x54')](_0xc331('0x37'))){_0x442887[_0xc331('0x1e')]=qs[_0xc331('0x1e')](_0x5cde48['query']['limit']);_0x442887['offset']=qs[_0xc331('0x1d')](_0x5cde48[_0xc331('0x30')][_0xc331('0x1d')]);}return _0x4241d6[_0xc331('0x61')](_0x442887);}})[_0xc331('0x24')](function(_0x512179){if(_0x512179){return _0x512179?{'count':_0xcbf5e8,'rows':_0x512179}:null;}})[_0xc331('0x24')](respondWithResult(_0x4aab75,null))[_0xc331('0x40')](handleError(_0x4aab75,null));};exports[_0xc331('0x64')]=function(_0x5cf8de,_0x5bfe36,_0x6bc521){var _0x5215c2=_0x5cf8de[_0xc331('0x47')][_0xc331('0x65')];return db[_0xc331('0x62')][_0xc331('0x3e')]({'where':{'id':_0x5215c2},'attributes':['id'],'include':[{'model':db[_0xc331('0x57')],'as':_0xc331('0x66'),'attributes':['id',_0xc331('0x2a'),_0xc331('0x67'),'voicePause',_0xc331('0x68')],'raw':!![]}]})[_0xc331('0x24')](function(_0x5dd2cc){if(_0x5dd2cc){var _0x1cb312=_[_0xc331('0x69')](_0x5dd2cc,function(_0x42f875){var _0x47cfeb=_0x42f875[_0xc331('0x25')]({'plain':!![]});return _0x47cfeb['Agents'];});return db['MailQueue'][_0xc331('0x45')]({'where':{'id':_0x5cf8de['params']['id']}})[_0xc331('0x24')](function(_0x22605e){return db[_0xc331('0x6a')][_0xc331('0x6b')](function(_0x50f6ac){return _0x22605e['addTeams'](_0x5215c2,{'transaction':_0x50f6ac})[_0xc331('0x24')](function(){return BPromise['each'](_0x1cb312,function(_0x5a9cb4){return db[_0xc331('0x53')]['findOrCreate']({'where':{'UserId':_0x5a9cb4['id'],'MailQueueId':_0x5cf8de[_0xc331('0x4f')]['id']},'transaction':_0x50f6ac});});})[_0xc331('0x24')](function(){_0x1cb312['forEach'](function(_0x5e1899){socket[_0xc331('0x6c')](_0xc331('0x6d'),{'UserId':_0x5e1899['id'],'MailQueueId':_0x22605e['id']});});});});});}})[_0xc331('0x24')](respondWithStatusCode(_0x5bfe36,null))[_0xc331('0x40')](handleError(_0x5bfe36,null));};exports[_0xc331('0x6e')]=function(_0x17b02a,_0x319742,_0x5b6cfd){return db[_0xc331('0x62')][_0xc331('0x3e')]({'where':{'id':_0x17b02a[_0xc331('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc331('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc331('0x24')](handleEntityNotFound(_0x319742,null))[_0xc331('0x24')](function(_0x5cd73f){var _0x79180d=_['map'](_0x5cd73f,'id');var _0xacfcbc=[];var _0x52f455=[];var _0x56e81e=squel[_0xc331('0x6f')]();_0x56e81e['field']('tq.TeamId')[_0xc331('0x70')](_0xc331('0x71'),'tq')[_0xc331('0x72')](_0xc331('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc331('0x74'),_0x17b02a[_0xc331('0x4f')]['id']);for(var _0x564988=0x0;_0x564988<_0x5cd73f[_0xc331('0x63')];_0x564988+=0x1){let _0x598cc5=_0x5cd73f[_0x564988];for(var _0x1645e9=0x0;_0x1645e9<_0x598cc5[_0xc331('0x66')][_0xc331('0x63')];_0x1645e9+=0x1){let _0x540f23=_0x598cc5['Agents'][_0x1645e9];var _0x168556=_0x56e81e[_0xc331('0x75')]();_0x168556[_0xc331('0x3a')](_0xc331('0x76'),_0x540f23['id']);_0x52f455['push'](db[_0xc331('0x6a')]['query'](_0x168556[_0xc331('0x77')](),{'type':db[_0xc331('0x6a')]['QueryTypes']['SELECT']})[_0xc331('0x24')](function(_0x17c9c6){if(_0x17c9c6[_0xc331('0x63')]===0x1){return _0x540f23['id'];}else{var _0x3d0076=_['every'](_['map'](_0x17c9c6,_0xc331('0x78')),function(_0x1494b8){return _[_0xc331('0x79')](_0x79180d,_0x1494b8);});if(_0x3d0076){return _0x540f23['id'];}}}));}}return BPromise[_0xc331('0x7a')](_0x52f455)[_0xc331('0x24')](function(_0x1b71da){_0xacfcbc=_(_0xacfcbc)[_0xc331('0x7b')](_0x1b71da)[_0xc331('0x7c')]()[_0xc331('0x7d')]();return db['MailQueue'][_0xc331('0x45')]({'where':{'id':_0x17b02a[_0xc331('0x4f')]['id']}})[_0xc331('0x24')](function(_0x48f58f){return db[_0xc331('0x6a')][_0xc331('0x6b')](function(_0x2d9cf3){return _0x48f58f[_0xc331('0x6e')](_0x17b02a[_0xc331('0x30')]['ids'],{'transaction':_0x2d9cf3})[_0xc331('0x24')](function(){if(!_[_0xc331('0x7e')](_0xacfcbc)){return _0x48f58f[_0xc331('0x7f')](_0xacfcbc,{'transaction':_0x2d9cf3});}})[_0xc331('0x24')](function(){_0xacfcbc[_0xc331('0x80')](function(_0x4cc689){socket[_0xc331('0x6c')](_0xc331('0x81'),{'UserId':_0x4cc689,'MailQueueId':_0x48f58f['id']});});});});});});})['then'](respondWithStatusCode(_0x319742,null))[_0xc331('0x40')](handleError(_0x319742,null));};exports[_0xc331('0x82')]=function(_0x23278d,_0x454cec,_0x59b4b2){return db[_0xc331('0x2c')][_0xc331('0x45')]({'where':{'id':_0x23278d['params']['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x454cec,null))['then'](function(_0x428090){if(_0x428090){return _0x428090[_0xc331('0x82')](_0x23278d[_0xc331('0x47')][_0xc331('0x65')],_[_0xc331('0x83')](_0x23278d['body'],[_0xc331('0x65'),'id'])||{})[_0xc331('0x84')](function(_0x3c55e7){for(var _0x378a1f=0x0;_0x378a1f<_0x23278d[_0xc331('0x47')][_0xc331('0x65')][_0xc331('0x63')];_0x378a1f+=0x1){socket[_0xc331('0x6c')]('userMailQueue:save',{'UserId':Number(_0x23278d[_0xc331('0x47')][_0xc331('0x65')][_0x378a1f]),'MailQueueId':Number(_0x23278d['params']['id'])});}return _0x3c55e7;});}})[_0xc331('0x24')](respondWithResult(_0x454cec,null))[_0xc331('0x40')](handleError(_0x454cec,null));};exports[_0xc331('0x7f')]=function(_0x23351f,_0x4c0bb1,_0x44f055){return db['MailQueue'][_0xc331('0x45')]({'where':{'id':_0x23351f[_0xc331('0x4f')]['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x4c0bb1,null))[_0xc331('0x24')](function(_0x25e4b2){if(_0x25e4b2){return _0x25e4b2[_0xc331('0x7f')](_0x23351f[_0xc331('0x30')][_0xc331('0x65')])[_0xc331('0x24')](function(){if(_[_0xc331('0x85')](_0x23351f['query']['ids'])){for(var _0x469b10=0x0;_0x469b10<_0x23351f[_0xc331('0x30')][_0xc331('0x65')]['length'];_0x469b10+=0x1){socket[_0xc331('0x6c')](_0xc331('0x81'),{'UserId':Number(_0x23351f[_0xc331('0x30')][_0xc331('0x65')][_0x469b10]),'MailQueueId':Number(_0x23351f[_0xc331('0x4f')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x23351f[_0xc331('0x30')][_0xc331('0x65')]),'MailQueueId':Number(_0x23351f['params']['id'])});}});}})[_0xc331('0x24')](respondWithStatusCode(_0x4c0bb1,null))[_0xc331('0x40')](handleError(_0x4c0bb1,null));};exports[_0xc331('0x86')]=function(_0x399d16,_0x59b9e8,_0x20dffd){var _0x33ac1e={};var _0x56e40e={};var _0x10be33;var _0x1c1d85;return db[_0xc331('0x2c')]['findOne']({'where':{'id':_0x399d16[_0xc331('0x4f')]['id']}})[_0xc331('0x24')](handleEntityNotFound(_0x59b9e8,null))[_0xc331('0x24')](function(_0x19d6c1){if(_0x19d6c1){_0x10be33=_0x19d6c1;_0x56e40e[_0xc331('0x35')]=_[_0xc331('0x31')](db[_0xc331('0x57')][_0xc331('0x42')]);_0x56e40e[_0xc331('0x30')]=_['keys'](_0x399d16[_0xc331('0x30')]);_0x56e40e[_0xc331('0x32')]=_[_0xc331('0x33')](_0x56e40e[_0xc331('0x35')],_0x56e40e[_0xc331('0x30')]);_0x33ac1e['attributes']=_[_0xc331('0x33')](_0x56e40e[_0xc331('0x35')],qs[_0xc331('0x36')](_0x399d16[_0xc331('0x30')][_0xc331('0x36')]));_0x33ac1e[_0xc331('0x34')]=_0x33ac1e[_0xc331('0x34')][_0xc331('0x63')]?_0x33ac1e[_0xc331('0x34')]:_0x56e40e['model'];_0x33ac1e['order']=qs[_0xc331('0x39')](_0x399d16[_0xc331('0x30')]['sort']);_0x33ac1e[_0xc331('0x3a')]=qs['filters'](_['pick'](_0x399d16['query'],_0x56e40e[_0xc331('0x32')]));if(_0x399d16[_0xc331('0x30')]['filter']){_0x33ac1e[_0xc331('0x3a')]=_['merge'](_0x33ac1e[_0xc331('0x3a')],{'$or':_[_0xc331('0x2f')](_0x33ac1e['attributes'],function(_0x48ccc7){var _0x4399a4={};_0x4399a4[_0x48ccc7]={'$like':'%'+_0x399d16[_0xc331('0x30')][_0xc331('0x3b')]+'%'};return _0x4399a4;})});}_0x33ac1e=_['merge']({},_0x33ac1e,_0x399d16[_0xc331('0x44')]);return _0x10be33[_0xc331('0x86')](_0x33ac1e);}})[_0xc331('0x24')](function(_0x4c4ed4){if(_0x4c4ed4){_0x1c1d85=_0x4c4ed4[_0xc331('0x63')];if(!_0x399d16[_0xc331('0x30')][_0xc331('0x54')](_0xc331('0x37'))){_0x33ac1e['limit']=qs[_0xc331('0x1e')](_0x399d16[_0xc331('0x30')][_0xc331('0x1e')]);_0x33ac1e[_0xc331('0x1d')]=qs[_0xc331('0x1d')](_0x399d16[_0xc331('0x30')][_0xc331('0x1d')]);}return _0x10be33[_0xc331('0x86')](_0x33ac1e);}})[_0xc331('0x24')](function(_0x5a5188){if(_0x5a5188){return _0x5a5188?{'count':_0x1c1d85,'rows':_0x5a5188}:null;}})[_0xc331('0x24')](respondWithResult(_0x59b9e8,null))[_0xc331('0x40')](handleError(_0x59b9e8,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b46e7e7..d5368c7 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 _0x3bd1=['emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3bd1,0x125));var _0x13bd=function(_0x170f96,_0x69735b){_0x170f96=_0x170f96-0x0;var _0x2ff1dc=_0x3bd1[_0x170f96];return _0x2ff1dc;};'use strict';var EventEmitter=require(_0x13bd('0x0'));var MailQueue=require(_0x13bd('0x1'))['db'][_0x13bd('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x13bd('0x3')](0x0);var events={'afterCreate':_0x13bd('0x4'),'afterUpdate':_0x13bd('0x5'),'afterDestroy':_0x13bd('0x6')};function emitEvent(_0x46d808){return function(_0x5b2507,_0x47b6fa,_0x21415f){MailQueueEvents[_0x13bd('0x7')](_0x46d808+':'+_0x5b2507['id'],_0x5b2507);MailQueueEvents['emit'](_0x46d808,_0x5b2507);_0x21415f(null);};}for(var e in events){if(events[_0x13bd('0x8')](e)){var event=events[e];MailQueue[_0x13bd('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xc4f5=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0x44ba7f,_0x28e094){var _0x10fceb=function(_0x3f4831){while(--_0x3f4831){_0x44ba7f['push'](_0x44ba7f['shift']());}};_0x10fceb(++_0x28e094);}(_0xc4f5,0x1ca));var _0x5c4f=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0xc4f5[_0x220afa];return _0x1b79d1;};'use strict';var EventEmitter=require(_0x5c4f('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c4f('0x1'),'afterUpdate':_0x5c4f('0x2'),'afterDestroy':_0x5c4f('0x3')};function emitEvent(_0x5a2771){return function(_0x1006ed,_0x47bd3c,_0x4ab0ab){MailQueueEvents[_0x5c4f('0x4')](_0x5a2771+':'+_0x1006ed['id'],_0x1006ed);MailQueueEvents[_0x5c4f('0x4')](_0x5a2771,_0x1006ed);_0x4ab0ab(null);};}for(var e in events){if(events[_0x5c4f('0x5')](e)){var event=events[e];MailQueue[_0x5c4f('0x6')](e,emitEvent(event));}}module[_0x5c4f('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 69ac2e5..b7de822 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 _0xc51e=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x3833fd,_0x3d4f6a){var _0x111c26=function(_0x703aa8){while(--_0x703aa8){_0x3833fd['push'](_0x3833fd['shift']());}};_0x111c26(++_0x3d4f6a);}(_0xc51e,0xf2));var _0xec51=function(_0xef1e4c,_0x5cb9ae){_0xef1e4c=_0xef1e4c-0x0;var _0x203904=_0xc51e[_0xef1e4c];return _0x203904;};'use strict';var _=require(_0xec51('0x0'));var util=require(_0xec51('0x1'));var logger=require(_0xec51('0x2'))(_0xec51('0x3'));var moment=require(_0xec51('0x4'));var BPromise=require(_0xec51('0x5'));var rp=require(_0xec51('0x6'));var fs=require('fs');var path=require(_0xec51('0x7'));var rimraf=require(_0xec51('0x8'));var config=require(_0xec51('0x9'));var attributes=require(_0xec51('0xa'));module[_0xec51('0xb')]=function(_0x51792a,_0x2bf298){return _0x51792a[_0xec51('0xc')](_0xec51('0xd'),attributes,{'tableName':_0xec51('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb50c=['moment','bluebird','request-promise','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','api'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0xb50c,0x195));var _0xcb50=function(_0x2a6ff4,_0x1b5522){_0x2a6ff4=_0x2a6ff4-0x0;var _0x3e09d2=_0xb50c[_0x2a6ff4];return _0x3e09d2;};'use strict';var _=require('lodash');var util=require(_0xcb50('0x0'));var logger=require(_0xcb50('0x1'))(_0xcb50('0x2'));var moment=require(_0xcb50('0x3'));var BPromise=require(_0xcb50('0x4'));var rp=require(_0xcb50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcb50('0x6'));var attributes=require(_0xcb50('0x7'));module[_0xcb50('0x8')]=function(_0x5b5f45,_0x1756cc){return _0x5b5f45[_0xcb50('0x9')](_0xcb50('0xa'),attributes,{'tableName':_0xcb50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 161d70f..4b62c02 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 _0x2750=['options','raw','attributes','limit','map','include','model','info','ShowMailQueue','MailQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2750,0x13b));var _0x0275=function(_0x3b0076,_0x263805){_0x3b0076=_0x3b0076-0x0;var _0x43436c=_0x2750[_0x3b0076];return _0x43436c;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});config[_0x0275('0xc')]=_[_0x0275('0xd')](config[_0x0275('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0275('0xe'))(new Redis(config[_0x0275('0xc')]));require(_0x0275('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ae225,_0x224e0f,_0x565377){return new BPromise(function(_0x26fa6b,_0x377087){return client[_0x0275('0x10')](_0x5ae225,_0x565377)[_0x0275('0x11')](function(_0x14bc3e){logger['info'](_0x0275('0x12'),_0x224e0f,_0x0275('0x13'));logger[_0x0275('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x224e0f,'request\x20sent',JSON[_0x0275('0x15')](_0x14bc3e));if(_0x14bc3e[_0x0275('0x16')]){if(_0x14bc3e[_0x0275('0x16')][_0x0275('0x17')]===0x1f4){logger[_0x0275('0x16')](_0x0275('0x12'),_0x224e0f,_0x14bc3e['error'][_0x0275('0x18')]);return _0x377087(_0x14bc3e[_0x0275('0x16')]['message']);}logger[_0x0275('0x16')](_0x0275('0x12'),_0x224e0f,_0x14bc3e['error'][_0x0275('0x18')]);return _0x26fa6b(_0x14bc3e[_0x0275('0x16')]['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x224e0f,'request\x20sent');_0x26fa6b(_0x14bc3e['result'][_0x0275('0x18')]);}})[_0x0275('0x19')](function(_0x48d3f4){logger['error'](_0x0275('0x12'),_0x224e0f,_0x48d3f4);_0x377087(_0x48d3f4);});});}exports[_0x0275('0x1a')]=function(_0x20c7fc){var _0x5c5036=this;return new Promise(function(_0x1bd201,_0x402f0d){return db['MailQueue']['findAll']({'raw':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc[_0x0275('0x1b')][_0x0275('0x1c')]===undefined?!![]:![]:!![],'where':_0x20c7fc['options']?_0x20c7fc[_0x0275('0x1b')]['where']||null:null,'attributes':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc['options'][_0x0275('0x1d')]||null:null,'limit':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc['options'][_0x0275('0x1e')]||null:null,'include':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc[_0x0275('0x1b')]['include']?_[_0x0275('0x1f')](_0x20c7fc[_0x0275('0x1b')][_0x0275('0x20')],function(_0x15813f){return{'model':db[_0x15813f[_0x0275('0x21')]],'as':_0x15813f['as'],'attributes':_0x15813f[_0x0275('0x1d')],'include':_0x15813f['include']?_[_0x0275('0x1f')](_0x15813f[_0x0275('0x20')],function(_0x1d24b2){return{'model':db[_0x1d24b2[_0x0275('0x21')]],'as':_0x1d24b2['as'],'attributes':_0x1d24b2[_0x0275('0x1d')],'include':_0x1d24b2['include']?_[_0x0275('0x1f')](_0x1d24b2[_0x0275('0x20')],function(_0x3246ea){return{'model':db[_0x3246ea[_0x0275('0x21')]],'as':_0x3246ea['as'],'attributes':_0x3246ea[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d49b4){logger[_0x0275('0x22')](_0x0275('0x1a'),_0x20c7fc);logger['debug']('GetMailQueue',_0x20c7fc,JSON[_0x0275('0x15')](_0x2d49b4));_0x1bd201(_0x2d49b4);})[_0x0275('0x19')](function(_0x5dc2bc){logger[_0x0275('0x16')](_0x0275('0x1a'),_0x5dc2bc[_0x0275('0x18')],_0x20c7fc);_0x402f0d(_0x5c5036[_0x0275('0x16')](0x1f4,_0x5dc2bc['message']));});});};exports[_0x0275('0x23')]=function(_0x86940b){var _0x3bba47=this;return new Promise(function(_0x2002c2,_0x58da2d){return db[_0x0275('0x24')]['find']({'raw':_0x86940b[_0x0275('0x1b')]?_0x86940b['options'][_0x0275('0x1c')]===undefined?!![]:![]:!![],'where':_0x86940b[_0x0275('0x1b')]?_0x86940b['options'][_0x0275('0x25')]||null:null,'attributes':_0x86940b[_0x0275('0x1b')]?_0x86940b[_0x0275('0x1b')][_0x0275('0x1d')]||null:null,'include':_0x86940b['options']?_0x86940b[_0x0275('0x1b')][_0x0275('0x20')]?_[_0x0275('0x1f')](_0x86940b[_0x0275('0x1b')][_0x0275('0x20')],function(_0x58e3f3){return{'model':db[_0x58e3f3[_0x0275('0x21')]],'as':_0x58e3f3['as'],'attributes':_0x58e3f3[_0x0275('0x1d')],'include':_0x58e3f3[_0x0275('0x20')]?_[_0x0275('0x1f')](_0x58e3f3[_0x0275('0x20')],function(_0x430307){return{'model':db[_0x430307[_0x0275('0x21')]],'as':_0x430307['as'],'attributes':_0x430307[_0x0275('0x1d')],'include':_0x430307[_0x0275('0x20')]?_[_0x0275('0x1f')](_0x430307[_0x0275('0x20')],function(_0x5b47bc){return{'model':db[_0x5b47bc[_0x0275('0x21')]],'as':_0x5b47bc['as'],'attributes':_0x5b47bc[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0x11')](function(_0x26408f){logger[_0x0275('0x22')](_0x0275('0x23'),_0x86940b);logger[_0x0275('0x14')](_0x0275('0x23'),_0x86940b,JSON[_0x0275('0x15')](_0x26408f));_0x2002c2(_0x26408f);})[_0x0275('0x19')](function(_0x124e7d){logger[_0x0275('0x16')](_0x0275('0x23'),_0x124e7d[_0x0275('0x18')],_0x86940b);_0x58da2d(_0x3bba47['error'](0x1f4,_0x124e7d[_0x0275('0x18')]));});});}; \ No newline at end of file +var _0xf56c=['../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x656c05,_0x1d4b18){var _0x28475a=function(_0x21ef6a){while(--_0x21ef6a){_0x656c05['push'](_0x656c05['shift']());}};_0x28475a(++_0x1d4b18);}(_0xf56c,0x106));var _0xcf56=function(_0x51fd1f,_0x453dfb){_0x51fd1f=_0x51fd1f-0x0;var _0x4f314b=_0xf56c[_0x51fd1f];return _0x4f314b;};'use strict';var _=require(_0xcf56('0x0'));var util=require(_0xcf56('0x1'));var moment=require(_0xcf56('0x2'));var BPromise=require(_0xcf56('0x3'));var rs=require(_0xcf56('0x4'));var fs=require('fs');var Redis=require(_0xcf56('0x5'));var db=require(_0xcf56('0x6'))['db'];var utils=require(_0xcf56('0x7'));var logger=require(_0xcf56('0x8'))(_0xcf56('0x9'));var config=require(_0xcf56('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcf56('0xb')][_0xcf56('0xc')]({'port':0x232a});config['redis']=_[_0xcf56('0xd')](config['redis'],{'host':_0xcf56('0xe'),'port':0x18eb});var socket=require(_0xcf56('0xf'))(new Redis(config[_0xcf56('0x10')]));require(_0xcf56('0x11'))[_0xcf56('0x12')](socket);function respondWithRpcPromise(_0x50e479,_0x31b2b4,_0x23328a){return new BPromise(function(_0x485ad7,_0x3ae030){return client[_0xcf56('0x13')](_0x50e479,_0x23328a)[_0xcf56('0x14')](function(_0xaf9894){logger[_0xcf56('0x15')](_0xcf56('0x16'),_0x31b2b4,_0xcf56('0x17'));logger[_0xcf56('0x18')](_0xcf56('0x19'),_0x31b2b4,'request\x20sent',JSON[_0xcf56('0x1a')](_0xaf9894));if(_0xaf9894['error']){if(_0xaf9894[_0xcf56('0x1b')][_0xcf56('0x1c')]===0x1f4){logger[_0xcf56('0x1b')](_0xcf56('0x16'),_0x31b2b4,_0xaf9894[_0xcf56('0x1b')]['message']);return _0x3ae030(_0xaf9894['error'][_0xcf56('0x1d')]);}logger[_0xcf56('0x1b')]('MailQueue,\x20%s,\x20%s',_0x31b2b4,_0xaf9894[_0xcf56('0x1b')][_0xcf56('0x1d')]);return _0x485ad7(_0xaf9894[_0xcf56('0x1b')]['message']);}else{logger[_0xcf56('0x15')](_0xcf56('0x16'),_0x31b2b4,_0xcf56('0x17'));_0x485ad7(_0xaf9894[_0xcf56('0x1e')][_0xcf56('0x1d')]);}})[_0xcf56('0x1f')](function(_0x256067){logger[_0xcf56('0x1b')](_0xcf56('0x16'),_0x31b2b4,_0x256067);_0x3ae030(_0x256067);});});}exports[_0xcf56('0x20')]=function(_0x6287e8){var _0x5cf61c=this;return new Promise(function(_0x40b73f,_0x445e38){return db['MailQueue'][_0xcf56('0x21')]({'raw':_0x6287e8[_0xcf56('0x22')]?_0x6287e8[_0xcf56('0x22')][_0xcf56('0x23')]===undefined?!![]:![]:!![],'where':_0x6287e8[_0xcf56('0x22')]?_0x6287e8[_0xcf56('0x22')][_0xcf56('0x24')]||null:null,'attributes':_0x6287e8[_0xcf56('0x22')]?_0x6287e8[_0xcf56('0x22')][_0xcf56('0x25')]||null:null,'limit':_0x6287e8['options']?_0x6287e8['options'][_0xcf56('0x26')]||null:null,'include':_0x6287e8[_0xcf56('0x22')]?_0x6287e8[_0xcf56('0x22')]['include']?_['map'](_0x6287e8[_0xcf56('0x22')][_0xcf56('0x27')],function(_0x1ff88e){return{'model':db[_0x1ff88e[_0xcf56('0x28')]],'as':_0x1ff88e['as'],'attributes':_0x1ff88e['attributes'],'include':_0x1ff88e[_0xcf56('0x27')]?_[_0xcf56('0x29')](_0x1ff88e[_0xcf56('0x27')],function(_0x4cd6e3){return{'model':db[_0x4cd6e3[_0xcf56('0x28')]],'as':_0x4cd6e3['as'],'attributes':_0x4cd6e3[_0xcf56('0x25')],'include':_0x4cd6e3['include']?_['map'](_0x4cd6e3['include'],function(_0x409df5){return{'model':db[_0x409df5[_0xcf56('0x28')]],'as':_0x409df5['as'],'attributes':_0x409df5[_0xcf56('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cfb47){logger[_0xcf56('0x15')]('GetMailQueue',_0x6287e8);logger[_0xcf56('0x18')](_0xcf56('0x20'),_0x6287e8,JSON[_0xcf56('0x1a')](_0x2cfb47));_0x40b73f(_0x2cfb47);})[_0xcf56('0x1f')](function(_0xfc5785){logger[_0xcf56('0x1b')](_0xcf56('0x20'),_0xfc5785[_0xcf56('0x1d')],_0x6287e8);_0x445e38(_0x5cf61c[_0xcf56('0x1b')](0x1f4,_0xfc5785[_0xcf56('0x1d')]));});});};exports[_0xcf56('0x2a')]=function(_0x55fbb6){var _0x166ff7=this;return new Promise(function(_0x574a7e,_0x4a9e1b){return db[_0xcf56('0x2b')][_0xcf56('0x2c')]({'raw':_0x55fbb6['options']?_0x55fbb6['options'][_0xcf56('0x23')]===undefined?!![]:![]:!![],'where':_0x55fbb6[_0xcf56('0x22')]?_0x55fbb6[_0xcf56('0x22')][_0xcf56('0x24')]||null:null,'attributes':_0x55fbb6[_0xcf56('0x22')]?_0x55fbb6[_0xcf56('0x22')][_0xcf56('0x25')]||null:null,'include':_0x55fbb6[_0xcf56('0x22')]?_0x55fbb6[_0xcf56('0x22')][_0xcf56('0x27')]?_[_0xcf56('0x29')](_0x55fbb6['options']['include'],function(_0x57500d){return{'model':db[_0x57500d[_0xcf56('0x28')]],'as':_0x57500d['as'],'attributes':_0x57500d[_0xcf56('0x25')],'include':_0x57500d[_0xcf56('0x27')]?_[_0xcf56('0x29')](_0x57500d[_0xcf56('0x27')],function(_0x39ba60){return{'model':db[_0x39ba60[_0xcf56('0x28')]],'as':_0x39ba60['as'],'attributes':_0x39ba60[_0xcf56('0x25')],'include':_0x39ba60[_0xcf56('0x27')]?_[_0xcf56('0x29')](_0x39ba60[_0xcf56('0x27')],function(_0x562c8d){return{'model':db[_0x562c8d[_0xcf56('0x28')]],'as':_0x562c8d['as'],'attributes':_0x562c8d['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf56('0x14')](function(_0x354afe){logger[_0xcf56('0x15')](_0xcf56('0x2a'),_0x55fbb6);logger[_0xcf56('0x18')](_0xcf56('0x2a'),_0x55fbb6,JSON[_0xcf56('0x1a')](_0x354afe));_0x574a7e(_0x354afe);})[_0xcf56('0x1f')](function(_0x13626e){logger['error']('ShowMailQueue',_0x13626e[_0xcf56('0x1d')],_0x55fbb6);_0x4a9e1b(_0x166ff7[_0xcf56('0x1b')](0x1f4,_0x13626e[_0xcf56('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 39b01ea..3650119 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 _0x1b55=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x487e6d,_0x84d2f6){var _0x1c0761=function(_0x1d22ce){while(--_0x1d22ce){_0x487e6d['push'](_0x487e6d['shift']());}};_0x1c0761(++_0x84d2f6);}(_0x1b55,0x1ca));var _0x51b5=function(_0x41358a,_0x322144){_0x41358a=_0x41358a-0x0;var _0x8c40ce=_0x1b55[_0x41358a];return _0x8c40ce;};'use strict';var MailQueueEvents=require(_0x51b5('0x0'));var events=[_0x51b5('0x1'),_0x51b5('0x2'),_0x51b5('0x3')];function createListener(_0x4e68cc,_0x293ef7){return function(_0x1a3c60){_0x293ef7[_0x51b5('0x4')](_0x4e68cc,_0x1a3c60);};}function removeListener(_0x171fb3,_0x541e50){return function(){MailQueueEvents[_0x51b5('0x5')](_0x171fb3,_0x541e50);};}exports[_0x51b5('0x6')]=function(_0x2d2466){for(var _0x7482a4=0x0,_0x4a5aef=events[_0x51b5('0x7')];_0x7482a4<_0x4a5aef;_0x7482a4++){var _0x39fa72=events[_0x7482a4];var _0x47fd38=createListener(_0x51b5('0x8')+_0x39fa72,_0x2d2466);MailQueueEvents['on'](_0x39fa72,_0x47fd38);}}; \ No newline at end of file +var _0xace6=['removeListener','register','mailQueue:','./mailQueue.events','save','emit'];(function(_0x141310,_0x4fb243){var _0x4680ae=function(_0x215303){while(--_0x215303){_0x141310['push'](_0x141310['shift']());}};_0x4680ae(++_0x4fb243);}(_0xace6,0xd5));var _0x6ace=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xace6[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require(_0x6ace('0x0'));var events=[_0x6ace('0x1'),'remove','update'];function createListener(_0x2f1cc6,_0x29f82a){return function(_0x406531){_0x29f82a[_0x6ace('0x2')](_0x2f1cc6,_0x406531);};}function removeListener(_0x201d6d,_0x356231){return function(){MailQueueEvents[_0x6ace('0x3')](_0x201d6d,_0x356231);};}exports[_0x6ace('0x4')]=function(_0x240dd4){for(var _0x5975c0=0x0,_0x11d620=events['length'];_0x5975c0<_0x11d620;_0x5975c0++){var _0x56c362=events[_0x5975c0];var _0xea4584=createListener(_0x6ace('0x5')+_0x56c362,_0x240dd4);MailQueueEvents['on'](_0x56c362,_0xea4584);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index cfb3b8c..91c12b7 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 _0x1847=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','util','path','express'];(function(_0x59f4f0,_0x30daa8){var _0x3eeec8=function(_0xab54b7){while(--_0xab54b7){_0x59f4f0['push'](_0x59f4f0['shift']());}};_0x3eeec8(++_0x30daa8);}(_0x1847,0x95));var _0x7184=function(_0x460e05,_0x37f195){_0x460e05=_0x460e05-0x0;var _0x48dcd9=_0x1847[_0x460e05];return _0x48dcd9;};'use strict';var multer=require('multer');var util=require(_0x7184('0x0'));var path=require(_0x7184('0x1'));var timeout=require('connect-timeout');var express=require(_0x7184('0x2'));var router=express[_0x7184('0x3')]();var fs_extra=require(_0x7184('0x4'));var auth=require(_0x7184('0x5'));var interaction=require(_0x7184('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x7184('0x7')]('/',auth[_0x7184('0x8')](),controller[_0x7184('0x9')]);router['get'](_0x7184('0xa'),auth[_0x7184('0x8')](),controller[_0x7184('0xb')]);router[_0x7184('0x7')](_0x7184('0xc'),auth[_0x7184('0x8')](),controller[_0x7184('0xd')]);router['post']('/',auth[_0x7184('0x8')](),controller[_0x7184('0xe')]);router[_0x7184('0xf')](_0x7184('0xc'),auth[_0x7184('0x8')](),controller[_0x7184('0x10')]);router[_0x7184('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7184('0x12')]);module['exports']=router; \ No newline at end of file +var _0xeb19=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x75267d,_0x5d286c){var _0x21ccec=function(_0x1a3c1f){while(--_0x1a3c1f){_0x75267d['push'](_0x75267d['shift']());}};_0x21ccec(++_0x5d286c);}(_0xeb19,0x166));var _0x9eb1=function(_0x2395e2,_0x998b37){_0x2395e2=_0x2395e2-0x0;var _0xf70eca=_0xeb19[_0x2395e2];return _0xf70eca;};'use strict';var multer=require('multer');var util=require(_0x9eb1('0x0'));var path=require(_0x9eb1('0x1'));var timeout=require(_0x9eb1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9eb1('0x3'));var auth=require(_0x9eb1('0x4'));var interaction=require(_0x9eb1('0x5'));var config=require(_0x9eb1('0x6'));var controller=require(_0x9eb1('0x7'));router[_0x9eb1('0x8')]('/',auth['isAuthenticated'](),controller[_0x9eb1('0x9')]);router[_0x9eb1('0x8')](_0x9eb1('0xa'),auth[_0x9eb1('0xb')](),controller['describe']);router[_0x9eb1('0x8')](_0x9eb1('0xc'),auth['isAuthenticated'](),controller[_0x9eb1('0xd')]);router[_0x9eb1('0xe')]('/',auth[_0x9eb1('0xb')](),controller[_0x9eb1('0xf')]);router[_0x9eb1('0x10')](_0x9eb1('0xc'),auth['isAuthenticated'](),controller[_0x9eb1('0x11')]);router[_0x9eb1('0x12')](_0x9eb1('0xc'),auth[_0x9eb1('0xb')](),controller[_0x9eb1('0x13')]);module[_0x9eb1('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 cd66582..98fa511 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 _0x4131=['exports','STRING','DATE','sequelize'];(function(_0x1cc925,_0x4c59a1){var _0x5a2e6c=function(_0x426cfb){while(--_0x426cfb){_0x1cc925['push'](_0x1cc925['shift']());}};_0x5a2e6c(++_0x4c59a1);}(_0x4131,0x17b));var _0x1413=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x4131[_0x403fc7];return _0x5d0827;};'use strict';var moment=require('moment');var Sequelize=require(_0x1413('0x0'));module[_0x1413('0x1')]={'uniqueid':{'type':Sequelize[_0x1413('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1413('0x2')]},'joinAt':{'type':Sequelize[_0x1413('0x3')]},'leaveAt':{'type':Sequelize[_0x1413('0x3')]},'acceptAt':{'type':Sequelize[_0x1413('0x3')]},'exitAt':{'type':Sequelize[_0x1413('0x3')]},'reason':{'type':Sequelize[_0x1413('0x2')]}}; \ No newline at end of file +var _0x017e=['STRING','DATE','moment','exports'];(function(_0x538967,_0x464c86){var _0x30bc9b=function(_0x5c1848){while(--_0x5c1848){_0x538967['push'](_0x538967['shift']());}};_0x30bc9b(++_0x464c86);}(_0x017e,0xee));var _0xe017=function(_0x417485,_0xdfeb87){_0x417485=_0x417485-0x0;var _0x528683=_0x017e[_0x417485];return _0x528683;};'use strict';var moment=require(_0xe017('0x0'));var Sequelize=require('sequelize');module[_0xe017('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe017('0x2')]},'joinAt':{'type':Sequelize[_0xe017('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe017('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fe7da3d..1a6b73d 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 _0x7b84=['sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','MailQueueReport','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0xf8a002,_0x1008d5){var _0x564eed=function(_0x4560cd){while(--_0x4560cd){_0xf8a002['push'](_0xf8a002['shift']());}};_0x564eed(++_0x1008d5);}(_0x7b84,0x17c));var _0x47b8=function(_0x2ff005,_0x3dd327){_0x2ff005=_0x2ff005-0x0;var _0x23ddb1=_0x7b84[_0x2ff005];return _0x23ddb1;};'use strict';var emlformat=require(_0x47b8('0x0'));var rimraf=require(_0x47b8('0x1'));var zipdir=require(_0x47b8('0x2'));var jsonpatch=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var BPromise=require(_0x47b8('0x6'));var Mustache=require('mustache');var util=require(_0x47b8('0x7'));var path=require(_0x47b8('0x8'));var sox=require(_0x47b8('0x9'));var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var authService=require(_0x47b8('0x14'));var qs=require(_0x47b8('0x15'));var as=require(_0x47b8('0x16'));var hardwareService=require(_0x47b8('0x17'));var logger=require(_0x47b8('0x18'))(_0x47b8('0x19'));var utils=require(_0x47b8('0x1a'));var config=require(_0x47b8('0x1b'));var licenseUtil=require(_0x47b8('0x1c'));var db=require(_0x47b8('0x1d'))['db'];function respondWithStatusCode(_0x25a224,_0x289ac7){_0x289ac7=_0x289ac7||0xcc;return function(_0x1edb4b){if(_0x1edb4b){return _0x25a224[_0x47b8('0x1e')](_0x289ac7);}return _0x25a224[_0x47b8('0x1f')](_0x289ac7)[_0x47b8('0x20')]();};}function respondWithResult(_0x173015,_0x223121){_0x223121=_0x223121||0xc8;return function(_0xf66dd6){if(_0xf66dd6){return _0x173015['status'](_0x223121)[_0x47b8('0x21')](_0xf66dd6);}};}function respondWithFilteredResult(_0x340da0,_0x3e760a){return function(_0x1217a4){if(_0x1217a4){var _0x34d5a5=typeof _0x3e760a[_0x47b8('0x22')]===_0x47b8('0x23')&&typeof _0x3e760a['limit']===_0x47b8('0x23');var _0x5c2b2c=_0x1217a4['count'];var _0x4f7317=_0x34d5a5?0x0:_0x3e760a[_0x47b8('0x22')];var _0x36faf1=_0x34d5a5?_0x1217a4[_0x47b8('0x24')]:_0x3e760a['offset']+_0x3e760a['limit'];var _0x4f6716;if(_0x36faf1>=_0x5c2b2c){_0x36faf1=_0x5c2b2c;_0x4f6716=0xc8;}else{_0x4f6716=0xce;}_0x340da0[_0x47b8('0x1f')](_0x4f6716);return _0x340da0['set'](_0x47b8('0x25'),_0x4f7317+'-'+_0x36faf1+'/'+_0x5c2b2c)[_0x47b8('0x21')](_0x1217a4);}return null;};}function patchUpdates(_0x303f19){return function(_0xfccf56){try{jsonpatch['apply'](_0xfccf56,_0x303f19,!![]);}catch(_0xc20df1){return BPromise[_0x47b8('0x26')](_0xc20df1);}return _0xfccf56[_0x47b8('0x27')]();};}function saveUpdates(_0x2f75d2,_0x168cde){return function(_0x232708){if(_0x232708){return _0x232708['update'](_0x2f75d2)[_0x47b8('0x28')](function(_0x2a22e3){return _0x2a22e3;});}return null;};}function removeEntity(_0x5301f8,_0x22e7dd){return function(_0x247429){if(_0x247429){return _0x247429[_0x47b8('0x29')]()[_0x47b8('0x28')](function(){_0x5301f8['status'](0xcc)[_0x47b8('0x20')]();});}};}function handleEntityNotFound(_0x332c23,_0x319d17){return function(_0x3e3de0){if(!_0x3e3de0){_0x332c23[_0x47b8('0x1e')](0x194);}return _0x3e3de0;};}function handleError(_0xbf5ce9,_0x40918f){_0x40918f=_0x40918f||0x1f4;return function(_0x568c1e){logger[_0x47b8('0x2a')](_0x568c1e[_0x47b8('0x2b')]);if(_0x568c1e['name']){delete _0x568c1e[_0x47b8('0x2c')];}_0xbf5ce9[_0x47b8('0x1f')](_0x40918f)[_0x47b8('0x2d')](_0x568c1e);};}exports[_0x47b8('0x2e')]=function(_0x4da0e0,_0x162d96){var _0x5c347f={},_0x2c89fc={},_0x2255ab={'count':0x0,'rows':[]};var _0x33e653=_[_0x47b8('0x2f')](db['MailQueueReport'][_0x47b8('0x30')],function(_0x264dd9){return{'name':_0x264dd9[_0x47b8('0x31')],'type':_0x264dd9[_0x47b8('0x32')][_0x47b8('0x33')]};});_0x2c89fc[_0x47b8('0x34')]=_['map'](_0x33e653,'name');_0x2c89fc['query']=_[_0x47b8('0x35')](_0x4da0e0[_0x47b8('0x36')]);_0x2c89fc[_0x47b8('0x37')]=_['intersection'](_0x2c89fc['model'],_0x2c89fc['query']);_0x5c347f['attributes']=_[_0x47b8('0x38')](_0x2c89fc[_0x47b8('0x34')],qs[_0x47b8('0x39')](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x39')]));_0x5c347f[_0x47b8('0x3a')]=_0x5c347f[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x5c347f[_0x47b8('0x3a')]:_0x2c89fc['model'];if(!_0x4da0e0['query'][_0x47b8('0x3c')](_0x47b8('0x3d'))){_0x5c347f['limit']=qs['limit'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x3e')]);_0x5c347f[_0x47b8('0x22')]=qs['offset'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x22')]);}_0x5c347f['order']=qs['sort'](_0x4da0e0['query']['sort']);_0x5c347f[_0x47b8('0x3f')]=qs[_0x47b8('0x37')](_[_0x47b8('0x40')](_0x4da0e0[_0x47b8('0x36')],_0x2c89fc[_0x47b8('0x37')]),_0x33e653);if(_0x4da0e0[_0x47b8('0x36')]['filter']){_0x5c347f['where']=_[_0x47b8('0x41')](_0x5c347f[_0x47b8('0x3f')],{'$or':_[_0x47b8('0x2f')](_0x33e653,function(_0x4a9ed6){if(_0x4a9ed6['type']!==_0x47b8('0x42')){var _0x2c89bc={};_0x2c89bc[_0x4a9ed6['name']]={'$like':'%'+_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x43')]+'%'};return _0x2c89bc;}})});}_0x5c347f=_['merge']({},_0x5c347f,_0x4da0e0['options']);var _0x493b69={'where':_0x5c347f['where']};return db[_0x47b8('0x44')][_0x47b8('0x24')](_0x493b69)[_0x47b8('0x28')](function(_0x28cf2c){_0x2255ab[_0x47b8('0x24')]=_0x28cf2c;if(_0x4da0e0['query'][_0x47b8('0x45')]){_0x5c347f['include']=[{'all':!![]}];}return db[_0x47b8('0x44')][_0x47b8('0x46')](_0x5c347f);})[_0x47b8('0x28')](function(_0x5bede8){_0x2255ab[_0x47b8('0x47')]=_0x5bede8;return _0x2255ab;})[_0x47b8('0x28')](respondWithFilteredResult(_0x162d96,_0x5c347f))[_0x47b8('0x48')](handleError(_0x162d96,null));};exports[_0x47b8('0x49')]=function(_0x3eaf01,_0x15b9a1){var _0x2d2971={'raw':!![],'where':{'id':_0x3eaf01[_0x47b8('0x4a')]['id']}},_0x569d29={};_0x569d29['model']=_[_0x47b8('0x35')](db[_0x47b8('0x44')][_0x47b8('0x30')]);_0x569d29[_0x47b8('0x36')]=_[_0x47b8('0x35')](_0x3eaf01[_0x47b8('0x36')]);_0x569d29['filters']=_['intersection'](_0x569d29[_0x47b8('0x34')],_0x569d29[_0x47b8('0x36')]);_0x2d2971[_0x47b8('0x3a')]=_['intersection'](_0x569d29[_0x47b8('0x34')],qs['fields'](_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x39')]));_0x2d2971[_0x47b8('0x3a')]=_0x2d2971[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x2d2971['attributes']:_0x569d29[_0x47b8('0x34')];if(_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x45')]){_0x2d2971[_0x47b8('0x4b')]=[{'all':!![]}];}_0x2d2971=_[_0x47b8('0x41')]({},_0x2d2971,_0x3eaf01[_0x47b8('0x4c')]);return db[_0x47b8('0x44')]['find'](_0x2d2971)[_0x47b8('0x28')](handleEntityNotFound(_0x15b9a1,null))['then'](respondWithResult(_0x15b9a1,null))[_0x47b8('0x48')](handleError(_0x15b9a1,null));};exports[_0x47b8('0x4d')]=function(_0x4a46eb,_0x132e9a){return db[_0x47b8('0x44')][_0x47b8('0x4d')](_0x4a46eb[_0x47b8('0x4e')],{})[_0x47b8('0x28')](respondWithResult(_0x132e9a,0xc9))[_0x47b8('0x48')](handleError(_0x132e9a,null));};exports[_0x47b8('0x4f')]=function(_0x381d3a,_0x4ad8a8){if(_0x381d3a[_0x47b8('0x4e')]['id']){delete _0x381d3a[_0x47b8('0x4e')]['id'];}return db[_0x47b8('0x44')]['find']({'where':{'id':_0x381d3a[_0x47b8('0x4a')]['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x4ad8a8,null))[_0x47b8('0x28')](saveUpdates(_0x381d3a[_0x47b8('0x4e')],null))['then'](respondWithResult(_0x4ad8a8,null))[_0x47b8('0x48')](handleError(_0x4ad8a8,null));};exports[_0x47b8('0x29')]=function(_0x51ac62,_0x270054){return db[_0x47b8('0x44')][_0x47b8('0x50')]({'where':{'id':_0x51ac62['params']['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x270054,null))['then'](removeEntity(_0x270054,null))[_0x47b8('0x48')](handleError(_0x270054,null));};exports['describe']=function(_0x2a03c2,_0x498512){return db[_0x47b8('0x44')][_0x47b8('0x51')]()[_0x47b8('0x28')](respondWithResult(_0x498512,null))[_0x47b8('0x48')](handleError(_0x498512,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0xba34,0x119));var _0x4ba3=function(_0x3ce202,_0x555aef){_0x3ce202=_0x3ce202-0x0;var _0x2b87d3=_0xba34[_0x3ce202];return _0x2b87d3;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['MailQueueReport']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2208267..7643511 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 _0x522e=['define','report_mail_queue','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x450363,_0x41fde1){var _0x279b49=function(_0x94ac2a){while(--_0x94ac2a){_0x450363['push'](_0x450363['shift']());}};_0x279b49(++_0x41fde1);}(_0x522e,0x9c));var _0xe522=function(_0x31cba4,_0xc4a9ff){_0x31cba4=_0x31cba4-0x0;var _0x7398e1=_0x522e[_0x31cba4];return _0x7398e1;};'use strict';var _=require(_0xe522('0x0'));var util=require(_0xe522('0x1'));var logger=require('../../config/logger')(_0xe522('0x2'));var moment=require(_0xe522('0x3'));var BPromise=require(_0xe522('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe522('0x5'));var rimraf=require(_0xe522('0x6'));var config=require(_0xe522('0x7'));var attributes=require(_0xe522('0x8'));module['exports']=function(_0x180985,_0xc9f18d){return _0x180985[_0xe522('0x9')]('MailQueueReport',attributes,{'tableName':_0xe522('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x4745,0x1e7));var _0x5474=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4745[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('MailQueueReport',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5474('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a4bb052..a901396 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x54e15b,_0x234bf3){var _0xb9713f=function(_0x5643fe){while(--_0x5643fe){_0x54e15b['push'](_0x54e15b['shift']());}};_0xb9713f(++_0x234bf3);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f0762,_0x18533c){_0x2f0762=_0x2f0762-0x0;var _0x1d2e3a=_0x2ef3[_0x2f0762];return _0x1d2e3a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _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(_0x1ed887,_0x480b1e){var _0x3aa48d=function(_0x18cd99){while(--_0x18cd99){_0x1ed887['push'](_0x1ed887['shift']());}};_0x3aa48d(++_0x480b1e);}(_0x326f,0xd1));var _0xf326=function(_0x3f00cb,_0x42dc6c){_0x3f00cb=_0x3f00cb-0x0;var _0x359305=_0x326f[_0x3f00cb];return _0x359305;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 70504f1..f3dddcc 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5dd5ad,_0x4f6fed){var _0x6abd92=function(_0x13814b){while(--_0x13814b){_0x5dd5ad['push'](_0x5dd5ad['shift']());}};_0x6abd92(++_0x4f6fed);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1c0dd3,_0x4efd75){var _0x57a5f9=function(_0x1d419c){while(--_0x1d419c){_0x1c0dd3['push'](_0x1c0dd3['shift']());}};_0x57a5f9(++_0x4efd75);}(_0x70e0,0x17b));var _0x070e=function(_0x3e90a5,_0x4d18a1){_0x3e90a5=_0x3e90a5-0x0;var _0x4f9f7a=_0x70e0[_0x3e90a5];return _0x4f9f7a;};'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 32df90c..e1d25a3 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 _0x753e=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x2f9bf6,_0x38a31d){var _0x2d88b5=function(_0x104137){while(--_0x104137){_0x2f9bf6['push'](_0x2f9bf6['shift']());}};_0x2d88b5(++_0x38a31d);}(_0x753e,0x1e2));var _0xe753=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x753e[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xe753('0x0'));module[_0xe753('0x1')]={'description':{'type':Sequelize[_0xe753('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe753('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe753('0x2')]},'password':{'type':Sequelize[_0xe753('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe753('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe753('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xe753('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdcc5=['INBOX','exports','STRING','INTEGER','BOOLEAN'];(function(_0x64265e,_0x484ac5){var _0x114601=function(_0x2a9570){while(--_0x2a9570){_0x64265e['push'](_0x64265e['shift']());}};_0x114601(++_0x484ac5);}(_0xdcc5,0x1cd));var _0x5dcc=function(_0x18900a,_0x5417eb){_0x18900a=_0x18900a-0x0;var _0x45fd93=_0xdcc5[_0x18900a];return _0x45fd93;};'use strict';var Sequelize=require('sequelize');module[_0x5dcc('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5dcc('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5dcc('0x1')]},'password':{'type':Sequelize[_0x5dcc('0x1')]},'port':{'type':Sequelize[_0x5dcc('0x2')]},'tls':{'type':Sequelize[_0x5dcc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5dcc('0x1')],'defaultValue':_0x5dcc('0x4')},'connTimeout':{'type':Sequelize[_0x5dcc('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5dcc('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5dcc('0x1')]},'modernAuthentication':{'type':Sequelize[_0x5dcc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 253a0cc..555bccf 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 _0x28cc=['bluebird','request-promise','path','rimraf','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0x28cc,0x68));var _0xc28c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28cc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc28c('0x0'));var util=require('util');var logger=require(_0xc28c('0x1'))(_0xc28c('0x2'));var moment=require(_0xc28c('0x3'));var BPromise=require(_0xc28c('0x4'));var rp=require(_0xc28c('0x5'));var fs=require('fs');var path=require(_0xc28c('0x6'));var rimraf=require(_0xc28c('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xc28c('0x8')]=function(_0x5ae222,_0x1666a1){return _0x5ae222[_0xc28c('0x9')](_0xc28c('0xa'),attributes,{'tableName':_0xc28c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefdd=['./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3cb10d,_0x26b91b){var _0xb504ba=function(_0x494943){while(--_0x494943){_0x3cb10d['push'](_0x3cb10d['shift']());}};_0xb504ba(++_0x26b91b);}(_0xefdd,0x185));var _0xdefd=function(_0x443754,_0x19560a){_0x443754=_0x443754-0x0;var _0x40a238=_0xefdd[_0x443754];return _0x40a238;};'use strict';var _=require(_0xdefd('0x0'));var util=require('util');var logger=require(_0xdefd('0x1'))(_0xdefd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdefd('0x3'));var fs=require('fs');var path=require(_0xdefd('0x4'));var rimraf=require(_0xdefd('0x5'));var config=require(_0xdefd('0x6'));var attributes=require(_0xdefd('0x7'));module[_0xdefd('0x8')]=function(_0x450802,_0x4df4fc){return _0x450802['define'](_0xdefd('0x9'),attributes,{'tableName':_0xdefd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index e438fdb..f92cdf1 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 _0x8a54=['error','code','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x8a54,0x11f));var _0x48a5=function(_0x2c04e3,_0x29b06c){_0x2c04e3=_0x2c04e3-0x0;var _0xc9d2a9=_0x8a54[_0x2c04e3];return _0xc9d2a9;};'use strict';var _=require(_0x48a5('0x0'));var util=require('util');var moment=require(_0x48a5('0x1'));var BPromise=require(_0x48a5('0x2'));var rs=require(_0x48a5('0x3'));var fs=require('fs');var Redis=require(_0x48a5('0x4'));var db=require(_0x48a5('0x5'))['db'];var utils=require(_0x48a5('0x6'));var logger=require('../../config/logger')(_0x48a5('0x7'));var config=require(_0x48a5('0x8'));var jayson=require(_0x48a5('0x9'));var client=jayson[_0x48a5('0xa')][_0x48a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10fc1a,_0x22722c,_0x2d2170){return new BPromise(function(_0x32ba69,_0x146c9a){return client[_0x48a5('0xc')](_0x10fc1a,_0x2d2170)[_0x48a5('0xd')](function(_0x521a54){logger[_0x48a5('0xe')]('MailServerIn,\x20%s,\x20%s',_0x22722c,_0x48a5('0xf'));logger[_0x48a5('0x10')](_0x48a5('0x11'),_0x22722c,_0x48a5('0xf'),JSON[_0x48a5('0x12')](_0x521a54));if(_0x521a54[_0x48a5('0x13')]){if(_0x521a54[_0x48a5('0x13')][_0x48a5('0x14')]===0x1f4){logger['error'](_0x48a5('0x15'),_0x22722c,_0x521a54['error'][_0x48a5('0x16')]);return _0x146c9a(_0x521a54[_0x48a5('0x13')][_0x48a5('0x16')]);}logger[_0x48a5('0x13')](_0x48a5('0x15'),_0x22722c,_0x521a54['error'][_0x48a5('0x16')]);return _0x32ba69(_0x521a54[_0x48a5('0x13')][_0x48a5('0x16')]);}else{logger[_0x48a5('0xe')](_0x48a5('0x15'),_0x22722c,_0x48a5('0xf'));_0x32ba69(_0x521a54['result']['message']);}})[_0x48a5('0x17')](function(_0x112abc){logger[_0x48a5('0x13')](_0x48a5('0x15'),_0x22722c,_0x112abc);_0x146c9a(_0x112abc);});});}exports[_0x48a5('0x18')]=function(_0x5670c4){var _0x5b118b=this;return new Promise(function(_0x18eeb5,_0x21847d){return db[_0x48a5('0x19')][_0x48a5('0x1a')]({'raw':_0x5670c4['options']?_0x5670c4[_0x48a5('0x1b')][_0x48a5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5670c4[_0x48a5('0x1b')]?_0x5670c4['options'][_0x48a5('0x1d')]||null:null,'attributes':_0x5670c4[_0x48a5('0x1b')]?_0x5670c4[_0x48a5('0x1b')]['attributes']||null:null,'limit':_0x5670c4[_0x48a5('0x1b')]?_0x5670c4[_0x48a5('0x1b')]['limit']||null:null,'include':_0x5670c4[_0x48a5('0x1b')]?_0x5670c4[_0x48a5('0x1b')][_0x48a5('0x1e')]?_[_0x48a5('0x1f')](_0x5670c4['options'][_0x48a5('0x1e')],function(_0x4450c2){return{'model':db[_0x4450c2['model']],'as':_0x4450c2['as'],'attributes':_0x4450c2['attributes'],'include':_0x4450c2[_0x48a5('0x1e')]?_[_0x48a5('0x1f')](_0x4450c2[_0x48a5('0x1e')],function(_0x26ae4c){return{'model':db[_0x26ae4c[_0x48a5('0x20')]],'as':_0x26ae4c['as'],'attributes':_0x26ae4c[_0x48a5('0x21')],'include':_0x26ae4c[_0x48a5('0x1e')]?_[_0x48a5('0x1f')](_0x26ae4c[_0x48a5('0x1e')],function(_0xb96534){return{'model':db[_0xb96534[_0x48a5('0x20')]],'as':_0xb96534['as'],'attributes':_0xb96534[_0x48a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3345b2){logger[_0x48a5('0xe')](_0x48a5('0x18'),_0x5670c4);logger['debug'](_0x48a5('0x18'),_0x5670c4,JSON['stringify'](_0x3345b2));_0x18eeb5(_0x3345b2);})[_0x48a5('0x17')](function(_0x1e0cbc){logger['error']('GetMailServerIn',_0x1e0cbc['message'],_0x5670c4);_0x21847d(_0x5b118b['error'](0x1f4,_0x1e0cbc[_0x48a5('0x16')]));});});}; \ No newline at end of file +var _0x64c4=['jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','debug','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3ac83e,_0x9032a6){var _0x3b0e4e=function(_0xee57aa){while(--_0xee57aa){_0x3ac83e['push'](_0x3ac83e['shift']());}};_0x3b0e4e(++_0x9032a6);}(_0x64c4,0x94));var _0x464c=function(_0x3d09b5,_0x49f9b3){_0x3d09b5=_0x3d09b5-0x0;var _0x1330a9=_0x64c4[_0x3d09b5];return _0x1330a9;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var moment=require(_0x464c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');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['client'][_0x464c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2d28,_0x4cba4d,_0xa7909){return new BPromise(function(_0x45ef21,_0x2d9831){return client[_0x464c('0x9')](_0x3d2d28,_0xa7909)[_0x464c('0xa')](function(_0x2445c8){logger[_0x464c('0xb')](_0x464c('0xc'),_0x4cba4d,_0x464c('0xd'));logger['debug'](_0x464c('0xe'),_0x4cba4d,_0x464c('0xd'),JSON[_0x464c('0xf')](_0x2445c8));if(_0x2445c8[_0x464c('0x10')]){if(_0x2445c8[_0x464c('0x10')]['code']===0x1f4){logger[_0x464c('0x10')](_0x464c('0xc'),_0x4cba4d,_0x2445c8[_0x464c('0x10')][_0x464c('0x11')]);return _0x2d9831(_0x2445c8[_0x464c('0x10')][_0x464c('0x11')]);}logger[_0x464c('0x10')](_0x464c('0xc'),_0x4cba4d,_0x2445c8[_0x464c('0x10')][_0x464c('0x11')]);return _0x45ef21(_0x2445c8[_0x464c('0x10')][_0x464c('0x11')]);}else{logger['info'](_0x464c('0xc'),_0x4cba4d,_0x464c('0xd'));_0x45ef21(_0x2445c8[_0x464c('0x12')][_0x464c('0x11')]);}})[_0x464c('0x13')](function(_0x4da153){logger[_0x464c('0x10')](_0x464c('0xc'),_0x4cba4d,_0x4da153);_0x2d9831(_0x4da153);});});}exports['GetMailServerIn']=function(_0x42d3b6){var _0xcfb49f=this;return new Promise(function(_0x17dce9,_0x325e37){return db[_0x464c('0x14')][_0x464c('0x15')]({'raw':_0x42d3b6[_0x464c('0x16')]?_0x42d3b6['options'][_0x464c('0x17')]===undefined?!![]:![]:!![],'where':_0x42d3b6[_0x464c('0x16')]?_0x42d3b6['options'][_0x464c('0x18')]||null:null,'attributes':_0x42d3b6[_0x464c('0x16')]?_0x42d3b6[_0x464c('0x16')][_0x464c('0x19')]||null:null,'limit':_0x42d3b6[_0x464c('0x16')]?_0x42d3b6[_0x464c('0x16')]['limit']||null:null,'include':_0x42d3b6['options']?_0x42d3b6['options'][_0x464c('0x1a')]?_[_0x464c('0x1b')](_0x42d3b6[_0x464c('0x16')][_0x464c('0x1a')],function(_0x1d83c3){return{'model':db[_0x1d83c3[_0x464c('0x1c')]],'as':_0x1d83c3['as'],'attributes':_0x1d83c3[_0x464c('0x19')],'include':_0x1d83c3[_0x464c('0x1a')]?_[_0x464c('0x1b')](_0x1d83c3[_0x464c('0x1a')],function(_0x3402c8){return{'model':db[_0x3402c8['model']],'as':_0x3402c8['as'],'attributes':_0x3402c8[_0x464c('0x19')],'include':_0x3402c8['include']?_[_0x464c('0x1b')](_0x3402c8['include'],function(_0x14b768){return{'model':db[_0x14b768[_0x464c('0x1c')]],'as':_0x14b768['as'],'attributes':_0x14b768[_0x464c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x464c('0xa')](function(_0x459ba6){logger[_0x464c('0xb')](_0x464c('0x1d'),_0x42d3b6);logger[_0x464c('0x1e')](_0x464c('0x1d'),_0x42d3b6,JSON[_0x464c('0xf')](_0x459ba6));_0x17dce9(_0x459ba6);})['catch'](function(_0x5d8c0b){logger[_0x464c('0x10')](_0x464c('0x1d'),_0x5d8c0b[_0x464c('0x11')],_0x42d3b6);_0x325e37(_0xcfb49f[_0x464c('0x10')](0x1f4,_0x5d8c0b[_0x464c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2e02038..91d0b4a 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(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x1d40a8,_0x10ac90){_0x1d40a8=_0x1d40a8-0x0;var _0x2a1ea8=_0x7a54[_0x1d40a8];return _0x2a1ea8;};'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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x4cfd12,_0x987e70){_0x4cfd12=_0x4cfd12-0x0;var _0x5829c5=_0x7a54[_0x4cfd12];return _0x5829c5;};'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 46b01eb..31f036f 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 _0xb574=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x58816c,_0x27612b){var _0x2a4926=function(_0x1fc298){while(--_0x1fc298){_0x58816c['push'](_0x58816c['shift']());}};_0x2a4926(++_0x27612b);}(_0xb574,0x106));var _0x4b57=function(_0x336198,_0x547f75){_0x336198=_0x336198-0x0;var _0xc094d6=_0xb574[_0x336198];return _0xc094d6;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4b57('0x2')]},'user':{'type':Sequelize[_0x4b57('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4b57('0x3')]},'secure':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4b57('0x2')]},'authentication':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x13f6=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x27c31c,_0x1ee064){var _0x3aae9b=function(_0x506578){while(--_0x506578){_0x27c31c['push'](_0x27c31c['shift']());}};_0x3aae9b(++_0x1ee064);}(_0x13f6,0x124));var _0x613f=function(_0x9d4500,_0x3283bc){_0x9d4500=_0x9d4500-0x0;var _0x3b64a1=_0x13f6[_0x9d4500];return _0x3b64a1;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x613f('0x2')]},'pass':{'type':Sequelize[_0x613f('0x2')]},'port':{'type':Sequelize[_0x613f('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x613f('0x2')]},'authentication':{'type':Sequelize[_0x613f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x613f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index dfd619a..2f56060 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 _0x6d4e=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x50499c,_0x188984){var _0xd422b3=function(_0x35e6cf){while(--_0x35e6cf){_0x50499c['push'](_0x50499c['shift']());}};_0xd422b3(++_0x188984);}(_0x6d4e,0x120));var _0xe6d4=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x6d4e[_0xb7b878];return _0x3c84b9;};'use strict';var emlformat=require(_0xe6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6d4('0x1'));var jsonpatch=require(_0xe6d4('0x2'));var rp=require(_0xe6d4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe6d4('0x4'));var util=require(_0xe6d4('0x5'));var path=require(_0xe6d4('0x6'));var sox=require(_0xe6d4('0x7'));var csv=require('to-csv');var ejs=require(_0xe6d4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6d4('0x9'));var squel=require(_0xe6d4('0xa'));var crypto=require(_0xe6d4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe6d4('0xc'));var querystring=require(_0xe6d4('0xd'));var Papa=require('papaparse');var Redis=require(_0xe6d4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe6d4('0xf'));var as=require(_0xe6d4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe6d4('0x11'));var utils=require(_0xe6d4('0x12'));var config=require(_0xe6d4('0x13'));var licenseUtil=require(_0xe6d4('0x14'));var db=require(_0xe6d4('0x15'))['db'];function respondWithStatusCode(_0x598450,_0x447e66){_0x447e66=_0x447e66||0xcc;return function(_0x3bed97){if(_0x3bed97){return _0x598450[_0xe6d4('0x16')](_0x447e66);}return _0x598450[_0xe6d4('0x17')](_0x447e66)[_0xe6d4('0x18')]();};}function respondWithResult(_0x545dc1,_0x342f7a){_0x342f7a=_0x342f7a||0xc8;return function(_0x26d076){if(_0x26d076){return _0x545dc1['status'](_0x342f7a)[_0xe6d4('0x19')](_0x26d076);}};}function respondWithFilteredResult(_0x1e5302,_0x5ef489){return function(_0x1d2118){if(_0x1d2118){var _0x1320b6=typeof _0x5ef489[_0xe6d4('0x1a')]==='undefined'&&typeof _0x5ef489['limit']==='undefined';var _0x486e19=_0x1d2118[_0xe6d4('0x1b')];var _0x7ab49e=_0x1320b6?0x0:_0x5ef489[_0xe6d4('0x1a')];var _0x1730d7=_0x1320b6?_0x1d2118['count']:_0x5ef489['offset']+_0x5ef489[_0xe6d4('0x1c')];var _0x4d0aed;if(_0x1730d7>=_0x486e19){_0x1730d7=_0x486e19;_0x4d0aed=0xc8;}else{_0x4d0aed=0xce;}_0x1e5302[_0xe6d4('0x17')](_0x4d0aed);return _0x1e5302[_0xe6d4('0x1d')](_0xe6d4('0x1e'),_0x7ab49e+'-'+_0x1730d7+'/'+_0x486e19)[_0xe6d4('0x19')](_0x1d2118);}return null;};}function patchUpdates(_0x546722){return function(_0x2f919a){try{jsonpatch[_0xe6d4('0x1f')](_0x2f919a,_0x546722,!![]);}catch(_0x57092a){return BPromise[_0xe6d4('0x20')](_0x57092a);}return _0x2f919a[_0xe6d4('0x21')]();};}function saveUpdates(_0x3c811f,_0x1eb312){return function(_0x8c713){if(_0x8c713){return _0x8c713[_0xe6d4('0x22')](_0x3c811f)[_0xe6d4('0x23')](function(_0x36af94){return _0x36af94;});}return null;};}function removeEntity(_0x573eb4,_0xfd553f){return function(_0x40b60d){if(_0x40b60d){return _0x40b60d[_0xe6d4('0x24')]()[_0xe6d4('0x23')](function(){_0x573eb4[_0xe6d4('0x17')](0xcc)[_0xe6d4('0x18')]();});}};}function handleEntityNotFound(_0x49ae28,_0x3df03d){return function(_0x4c06fa){if(!_0x4c06fa){_0x49ae28[_0xe6d4('0x16')](0x194);}return _0x4c06fa;};}function handleError(_0x1b5e02,_0x32735a){_0x32735a=_0x32735a||0x1f4;return function(_0x5c96d0){logger[_0xe6d4('0x25')](_0x5c96d0[_0xe6d4('0x26')]);if(_0x5c96d0[_0xe6d4('0x27')]){delete _0x5c96d0[_0xe6d4('0x27')];}_0x1b5e02[_0xe6d4('0x17')](_0x32735a)[_0xe6d4('0x28')](_0x5c96d0);};}exports[_0xe6d4('0x29')]=function(_0x3a7192,_0x45fcbb){var _0x5a92ab={},_0x496b34={},_0x1661a9={'count':0x0,'rows':[]};var _0x4e23a0=_[_0xe6d4('0x2a')](db[_0xe6d4('0x2b')][_0xe6d4('0x2c')],function(_0x3accfa){return{'name':_0x3accfa[_0xe6d4('0x2d')],'type':_0x3accfa[_0xe6d4('0x2e')][_0xe6d4('0x2f')]};});_0x496b34[_0xe6d4('0x30')]=_['map'](_0x4e23a0,_0xe6d4('0x27'));_0x496b34[_0xe6d4('0x31')]=_['keys'](_0x3a7192[_0xe6d4('0x31')]);_0x496b34['filters']=_[_0xe6d4('0x32')](_0x496b34[_0xe6d4('0x30')],_0x496b34['query']);_0x5a92ab[_0xe6d4('0x33')]=_['intersection'](_0x496b34[_0xe6d4('0x30')],qs[_0xe6d4('0x34')](_0x3a7192[_0xe6d4('0x31')][_0xe6d4('0x34')]));_0x5a92ab[_0xe6d4('0x33')]=_0x5a92ab['attributes'][_0xe6d4('0x35')]?_0x5a92ab[_0xe6d4('0x33')]:_0x496b34['model'];if(!_0x3a7192[_0xe6d4('0x31')][_0xe6d4('0x36')](_0xe6d4('0x37'))){_0x5a92ab[_0xe6d4('0x1c')]=qs[_0xe6d4('0x1c')](_0x3a7192[_0xe6d4('0x31')][_0xe6d4('0x1c')]);_0x5a92ab[_0xe6d4('0x1a')]=qs[_0xe6d4('0x1a')](_0x3a7192['query'][_0xe6d4('0x1a')]);}_0x5a92ab[_0xe6d4('0x38')]=qs[_0xe6d4('0x39')](_0x3a7192[_0xe6d4('0x31')][_0xe6d4('0x39')]);_0x5a92ab[_0xe6d4('0x3a')]=qs[_0xe6d4('0x3b')](_[_0xe6d4('0x3c')](_0x3a7192[_0xe6d4('0x31')],_0x496b34[_0xe6d4('0x3b')]),_0x4e23a0);if(_0x3a7192[_0xe6d4('0x31')][_0xe6d4('0x3d')]){_0x5a92ab[_0xe6d4('0x3a')]=_[_0xe6d4('0x3e')](_0x5a92ab['where'],{'$or':_[_0xe6d4('0x2a')](_0x4e23a0,function(_0x29b64d){if(_0x29b64d[_0xe6d4('0x2e')]!==_0xe6d4('0x3f')){var _0x3c17ff={};_0x3c17ff[_0x29b64d[_0xe6d4('0x27')]]={'$like':'%'+_0x3a7192['query'][_0xe6d4('0x3d')]+'%'};return _0x3c17ff;}})});}_0x5a92ab=_[_0xe6d4('0x3e')]({},_0x5a92ab,_0x3a7192[_0xe6d4('0x40')]);var _0x197505={'where':_0x5a92ab[_0xe6d4('0x3a')]};return db['MailServerOut'][_0xe6d4('0x1b')](_0x197505)['then'](function(_0x17d14f){_0x1661a9['count']=_0x17d14f;if(_0x3a7192['query']['includeAll']){_0x5a92ab['include']=[{'all':!![]}];}return db['MailServerOut'][_0xe6d4('0x41')](_0x5a92ab);})[_0xe6d4('0x23')](function(_0x1ddbbb){_0x1661a9[_0xe6d4('0x42')]=_0x1ddbbb;return _0x1661a9;})[_0xe6d4('0x23')](respondWithFilteredResult(_0x45fcbb,_0x5a92ab))['catch'](handleError(_0x45fcbb,null));};exports[_0xe6d4('0x43')]=function(_0x3356d3,_0x3af7ae){var _0x459724={'raw':!![],'where':{'id':_0x3356d3[_0xe6d4('0x44')]['id']}},_0x2abb3f={};_0x2abb3f['model']=_[_0xe6d4('0x45')](db['MailServerOut']['rawAttributes']);_0x2abb3f[_0xe6d4('0x31')]=_[_0xe6d4('0x45')](_0x3356d3[_0xe6d4('0x31')]);_0x2abb3f['filters']=_[_0xe6d4('0x32')](_0x2abb3f[_0xe6d4('0x30')],_0x2abb3f[_0xe6d4('0x31')]);_0x459724['attributes']=_[_0xe6d4('0x32')](_0x2abb3f['model'],qs['fields'](_0x3356d3[_0xe6d4('0x31')]['fields']));_0x459724[_0xe6d4('0x33')]=_0x459724[_0xe6d4('0x33')][_0xe6d4('0x35')]?_0x459724[_0xe6d4('0x33')]:_0x2abb3f[_0xe6d4('0x30')];if(_0x3356d3[_0xe6d4('0x31')][_0xe6d4('0x46')]){_0x459724[_0xe6d4('0x47')]=[{'all':!![]}];}_0x459724=_[_0xe6d4('0x3e')]({},_0x459724,_0x3356d3[_0xe6d4('0x40')]);return db[_0xe6d4('0x2b')][_0xe6d4('0x48')](_0x459724)['then'](handleEntityNotFound(_0x3af7ae,null))[_0xe6d4('0x23')](respondWithResult(_0x3af7ae,null))['catch'](handleError(_0x3af7ae,null));};exports[_0xe6d4('0x49')]=function(_0x69ebdd,_0x2f0ea4){return db[_0xe6d4('0x2b')][_0xe6d4('0x49')](_0x69ebdd[_0xe6d4('0x4a')],{})[_0xe6d4('0x23')](respondWithResult(_0x2f0ea4,0xc9))[_0xe6d4('0x4b')](handleError(_0x2f0ea4,null));};exports[_0xe6d4('0x22')]=function(_0x399f4d,_0x5423e6){if(_0x399f4d[_0xe6d4('0x4a')]['id']){delete _0x399f4d[_0xe6d4('0x4a')]['id'];}return db[_0xe6d4('0x2b')]['find']({'where':{'id':_0x399f4d[_0xe6d4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5423e6,null))[_0xe6d4('0x23')](saveUpdates(_0x399f4d[_0xe6d4('0x4a')],null))[_0xe6d4('0x23')](respondWithResult(_0x5423e6,null))[_0xe6d4('0x4b')](handleError(_0x5423e6,null));};exports[_0xe6d4('0x24')]=function(_0x3d786b,_0xc977ec){return db['MailServerOut'][_0xe6d4('0x48')]({'where':{'id':_0x3d786b[_0xe6d4('0x44')]['id']}})[_0xe6d4('0x23')](handleEntityNotFound(_0xc977ec,null))[_0xe6d4('0x23')](removeEntity(_0xc977ec,null))[_0xe6d4('0x4b')](handleError(_0xc977ec,null));}; \ No newline at end of file +var _0xd47d=['offset','set','apply','reject','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','create','body','catch','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count'];(function(_0x503f4d,_0x476e97){var _0x4ce6d1=function(_0x17b5fc){while(--_0x17b5fc){_0x503f4d['push'](_0x503f4d['shift']());}};_0x4ce6d1(++_0x476e97);}(_0xd47d,0xc1));var _0xdd47=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xd47d[_0x32c012];return _0x48562e;};'use strict';var emlformat=require(_0xdd47('0x0'));var rimraf=require(_0xdd47('0x1'));var zipdir=require(_0xdd47('0x2'));var jsonpatch=require(_0xdd47('0x3'));var rp=require(_0xdd47('0x4'));var moment=require(_0xdd47('0x5'));var BPromise=require(_0xdd47('0x6'));var Mustache=require(_0xdd47('0x7'));var util=require('util');var path=require(_0xdd47('0x8'));var sox=require(_0xdd47('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd47('0xa'));var _=require(_0xdd47('0xb'));var squel=require(_0xdd47('0xc'));var crypto=require(_0xdd47('0xd'));var jsforce=require(_0xdd47('0xe'));var deskjs=require(_0xdd47('0xf'));var toCsv=require(_0xdd47('0x10'));var querystring=require(_0xdd47('0x11'));var Papa=require('papaparse');var Redis=require(_0xdd47('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdd47('0x13'));var as=require(_0xdd47('0x14'));var hardwareService=require(_0xdd47('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xdd47('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdd47('0x17'));var db=require(_0xdd47('0x18'))['db'];function respondWithStatusCode(_0x5bd3ec,_0x3962fa){_0x3962fa=_0x3962fa||0xcc;return function(_0x40e72d){if(_0x40e72d){return _0x5bd3ec[_0xdd47('0x19')](_0x3962fa);}return _0x5bd3ec[_0xdd47('0x1a')](_0x3962fa)[_0xdd47('0x1b')]();};}function respondWithResult(_0x3bb660,_0x42a38f){_0x42a38f=_0x42a38f||0xc8;return function(_0x5e803f){if(_0x5e803f){return _0x3bb660['status'](_0x42a38f)[_0xdd47('0x1c')](_0x5e803f);}};}function respondWithFilteredResult(_0x446a1b,_0x24b5da){return function(_0x15e553){if(_0x15e553){var _0x13d238=typeof _0x24b5da['offset']==='undefined'&&typeof _0x24b5da[_0xdd47('0x1d')]===_0xdd47('0x1e');var _0x1296f1=_0x15e553[_0xdd47('0x1f')];var _0x4ff5cf=_0x13d238?0x0:_0x24b5da[_0xdd47('0x20')];var _0x405565=_0x13d238?_0x15e553[_0xdd47('0x1f')]:_0x24b5da[_0xdd47('0x20')]+_0x24b5da['limit'];var _0x4c4a04;if(_0x405565>=_0x1296f1){_0x405565=_0x1296f1;_0x4c4a04=0xc8;}else{_0x4c4a04=0xce;}_0x446a1b[_0xdd47('0x1a')](_0x4c4a04);return _0x446a1b[_0xdd47('0x21')]('Content-Range',_0x4ff5cf+'-'+_0x405565+'/'+_0x1296f1)['json'](_0x15e553);}return null;};}function patchUpdates(_0x1cb858){return function(_0x25ab1a){try{jsonpatch[_0xdd47('0x22')](_0x25ab1a,_0x1cb858,!![]);}catch(_0x8cd7de){return BPromise[_0xdd47('0x23')](_0x8cd7de);}return _0x25ab1a['save']();};}function saveUpdates(_0x4bd711,_0x56c62d){return function(_0x25a7dd){if(_0x25a7dd){return _0x25a7dd[_0xdd47('0x24')](_0x4bd711)['then'](function(_0x3cab66){return _0x3cab66;});}return null;};}function removeEntity(_0x2240db,_0x18a0df){return function(_0x5d676f){if(_0x5d676f){return _0x5d676f['destroy']()[_0xdd47('0x25')](function(){_0x2240db['status'](0xcc)[_0xdd47('0x1b')]();});}};}function handleEntityNotFound(_0x2f605d,_0x44a032){return function(_0x5b4035){if(!_0x5b4035){_0x2f605d[_0xdd47('0x19')](0x194);}return _0x5b4035;};}function handleError(_0x27b0dd,_0x130f6b){_0x130f6b=_0x130f6b||0x1f4;return function(_0x535286){logger[_0xdd47('0x26')](_0x535286[_0xdd47('0x27')]);if(_0x535286[_0xdd47('0x28')]){delete _0x535286['name'];}_0x27b0dd[_0xdd47('0x1a')](_0x130f6b)[_0xdd47('0x29')](_0x535286);};}exports[_0xdd47('0x2a')]=function(_0xf1c6d7,_0x4892a9){var _0x381070={},_0x54ed43={},_0x500d36={'count':0x0,'rows':[]};var _0x1ea2e0=_[_0xdd47('0x2b')](db[_0xdd47('0x2c')][_0xdd47('0x2d')],function(_0x2fb229){return{'name':_0x2fb229[_0xdd47('0x2e')],'type':_0x2fb229[_0xdd47('0x2f')]['key']};});_0x54ed43[_0xdd47('0x30')]=_[_0xdd47('0x2b')](_0x1ea2e0,_0xdd47('0x28'));_0x54ed43[_0xdd47('0x31')]=_[_0xdd47('0x32')](_0xf1c6d7[_0xdd47('0x31')]);_0x54ed43['filters']=_['intersection'](_0x54ed43[_0xdd47('0x30')],_0x54ed43[_0xdd47('0x31')]);_0x381070[_0xdd47('0x33')]=_[_0xdd47('0x34')](_0x54ed43['model'],qs[_0xdd47('0x35')](_0xf1c6d7[_0xdd47('0x31')][_0xdd47('0x35')]));_0x381070[_0xdd47('0x33')]=_0x381070[_0xdd47('0x33')]['length']?_0x381070[_0xdd47('0x33')]:_0x54ed43[_0xdd47('0x30')];if(!_0xf1c6d7['query'][_0xdd47('0x36')](_0xdd47('0x37'))){_0x381070['limit']=qs[_0xdd47('0x1d')](_0xf1c6d7[_0xdd47('0x31')][_0xdd47('0x1d')]);_0x381070[_0xdd47('0x20')]=qs[_0xdd47('0x20')](_0xf1c6d7['query'][_0xdd47('0x20')]);}_0x381070[_0xdd47('0x38')]=qs[_0xdd47('0x39')](_0xf1c6d7[_0xdd47('0x31')][_0xdd47('0x39')]);_0x381070[_0xdd47('0x3a')]=qs[_0xdd47('0x3b')](_[_0xdd47('0x3c')](_0xf1c6d7[_0xdd47('0x31')],_0x54ed43['filters']),_0x1ea2e0);if(_0xf1c6d7['query']['filter']){_0x381070['where']=_[_0xdd47('0x3d')](_0x381070[_0xdd47('0x3a')],{'$or':_[_0xdd47('0x2b')](_0x1ea2e0,function(_0x5a8062){if(_0x5a8062['type']!==_0xdd47('0x3e')){var _0x182449={};_0x182449[_0x5a8062[_0xdd47('0x28')]]={'$like':'%'+_0xf1c6d7[_0xdd47('0x31')][_0xdd47('0x3f')]+'%'};return _0x182449;}})});}_0x381070=_['merge']({},_0x381070,_0xf1c6d7[_0xdd47('0x40')]);var _0x6563a3={'where':_0x381070[_0xdd47('0x3a')]};return db['MailServerOut'][_0xdd47('0x1f')](_0x6563a3)[_0xdd47('0x25')](function(_0x74b28c){_0x500d36['count']=_0x74b28c;if(_0xf1c6d7[_0xdd47('0x31')]['includeAll']){_0x381070[_0xdd47('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xdd47('0x42')](_0x381070);})['then'](function(_0x574209){_0x500d36[_0xdd47('0x43')]=_0x574209;return _0x500d36;})[_0xdd47('0x25')](respondWithFilteredResult(_0x4892a9,_0x381070))['catch'](handleError(_0x4892a9,null));};exports[_0xdd47('0x44')]=function(_0x537f4,_0x1ca79a){var _0x2740f2={'raw':!![],'where':{'id':_0x537f4[_0xdd47('0x45')]['id']}},_0x494b99={};_0x494b99[_0xdd47('0x30')]=_[_0xdd47('0x32')](db[_0xdd47('0x2c')][_0xdd47('0x2d')]);_0x494b99['query']=_['keys'](_0x537f4[_0xdd47('0x31')]);_0x494b99[_0xdd47('0x3b')]=_[_0xdd47('0x34')](_0x494b99[_0xdd47('0x30')],_0x494b99[_0xdd47('0x31')]);_0x2740f2[_0xdd47('0x33')]=_[_0xdd47('0x34')](_0x494b99['model'],qs[_0xdd47('0x35')](_0x537f4['query'][_0xdd47('0x35')]));_0x2740f2[_0xdd47('0x33')]=_0x2740f2[_0xdd47('0x33')]['length']?_0x2740f2['attributes']:_0x494b99[_0xdd47('0x30')];if(_0x537f4[_0xdd47('0x31')]['includeAll']){_0x2740f2[_0xdd47('0x41')]=[{'all':!![]}];}_0x2740f2=_['merge']({},_0x2740f2,_0x537f4[_0xdd47('0x40')]);return db[_0xdd47('0x2c')]['find'](_0x2740f2)['then'](handleEntityNotFound(_0x1ca79a,null))[_0xdd47('0x25')](respondWithResult(_0x1ca79a,null))['catch'](handleError(_0x1ca79a,null));};exports[_0xdd47('0x46')]=function(_0xb27dd2,_0x531ab6){return db[_0xdd47('0x2c')][_0xdd47('0x46')](_0xb27dd2[_0xdd47('0x47')],{})['then'](respondWithResult(_0x531ab6,0xc9))[_0xdd47('0x48')](handleError(_0x531ab6,null));};exports[_0xdd47('0x24')]=function(_0x1050fa,_0x3b11bf){if(_0x1050fa[_0xdd47('0x47')]['id']){delete _0x1050fa[_0xdd47('0x47')]['id'];}return db[_0xdd47('0x2c')]['find']({'where':{'id':_0x1050fa[_0xdd47('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b11bf,null))['then'](saveUpdates(_0x1050fa[_0xdd47('0x47')],null))[_0xdd47('0x25')](respondWithResult(_0x3b11bf,null))['catch'](handleError(_0x3b11bf,null));};exports[_0xdd47('0x49')]=function(_0x1e3973,_0x5ee017){return db[_0xdd47('0x2c')][_0xdd47('0x4a')]({'where':{'id':_0x1e3973['params']['id']}})[_0xdd47('0x25')](handleEntityNotFound(_0x5ee017,null))[_0xdd47('0x25')](removeEntity(_0x5ee017,null))['catch'](handleError(_0x5ee017,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f9e856c..6d1590b 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 _0x918b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','api'];(function(_0x13ba54,_0x2bf9e1){var _0x1d2511=function(_0x2a6430){while(--_0x2a6430){_0x13ba54['push'](_0x13ba54['shift']());}};_0x1d2511(++_0x2bf9e1);}(_0x918b,0x1d9));var _0xb918=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0x918b[_0x4ed786];return _0x2f0243;};'use strict';var _=require(_0xb918('0x0'));var util=require('util');var logger=require(_0xb918('0x1'))(_0xb918('0x2'));var moment=require(_0xb918('0x3'));var BPromise=require(_0xb918('0x4'));var rp=require(_0xb918('0x5'));var fs=require('fs');var path=require(_0xb918('0x6'));var rimraf=require(_0xb918('0x7'));var config=require(_0xb918('0x8'));var attributes=require(_0xb918('0x9'));module[_0xb918('0xa')]=function(_0x4ceee1,_0x2c3d1e){return _0x4ceee1[_0xb918('0xb')](_0xb918('0xc'),attributes,{'tableName':_0xb918('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1813=['MailServerOut','mail_servers_out','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x1ea5db,_0xa6fb22){var _0x25c0bf=function(_0x17686f){while(--_0x17686f){_0x1ea5db['push'](_0x1ea5db['shift']());}};_0x25c0bf(++_0xa6fb22);}(_0x1813,0x92));var _0x3181=function(_0x3575ff,_0x109ae8){_0x3575ff=_0x3575ff-0x0;var _0x164d7a=_0x1813[_0x3575ff];return _0x164d7a;};'use strict';var _=require('lodash');var util=require(_0x3181('0x0'));var logger=require(_0x3181('0x1'))(_0x3181('0x2'));var moment=require(_0x3181('0x3'));var BPromise=require('bluebird');var rp=require(_0x3181('0x4'));var fs=require('fs');var path=require(_0x3181('0x5'));var rimraf=require(_0x3181('0x6'));var config=require(_0x3181('0x7'));var attributes=require(_0x3181('0x8'));module[_0x3181('0x9')]=function(_0x30deba,_0x5a284f){return _0x30deba['define'](_0x3181('0xa'),attributes,{'tableName':_0x3181('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 8cc7061..6d14eab 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0xdaf3b1,_0x509f1a){_0xdaf3b1=_0xdaf3b1-0x0;var _0x44ee07=_0x7a54[_0xdaf3b1];return _0x44ee07;};'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')]('MailServerOut,\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','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x584ca7,_0xf3d799){_0x584ca7=_0x584ca7-0x0;var _0x2a3bc8=_0x7a54[_0x584ca7];return _0x2a3bc8;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ca3b31c..fcbad87 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 _0x0bb3=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0bb3,0x153));var _0x30bb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x0bb3[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require(_0x30bb('0x0'));var path=require(_0x30bb('0x1'));var timeout=require(_0x30bb('0x2'));var express=require(_0x30bb('0x3'));var router=express[_0x30bb('0x4')]();var fs_extra=require(_0x30bb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x30bb('0x6'));var controller=require('./mailSubstatus.controller');router[_0x30bb('0x7')]('/',auth[_0x30bb('0x8')](),controller[_0x30bb('0x9')]);router[_0x30bb('0x7')](_0x30bb('0xa'),auth[_0x30bb('0x8')](),controller[_0x30bb('0xb')]);router[_0x30bb('0x7')](_0x30bb('0xc'),auth[_0x30bb('0x8')](),controller[_0x30bb('0xd')]);router['post']('/',auth[_0x30bb('0x8')](),controller[_0x30bb('0xe')]);router[_0x30bb('0xf')](_0x30bb('0xc'),auth[_0x30bb('0x8')](),controller[_0x30bb('0x10')]);router['delete'](_0x30bb('0xc'),auth['isAuthenticated'](),controller[_0x30bb('0x11')]);module[_0x30bb('0x12')]=router; \ No newline at end of file +var _0xa09e=['./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x444be0,_0x21ad2b){var _0x298401=function(_0x4a565a){while(--_0x4a565a){_0x444be0['push'](_0x444be0['shift']());}};_0x298401(++_0x21ad2b);}(_0xa09e,0x1ed));var _0xea09=function(_0x5da63e,_0x4d3503){_0x5da63e=_0x5da63e-0x0;var _0x442aca=_0xa09e[_0x5da63e];return _0x442aca;};'use strict';var multer=require(_0xea09('0x0'));var util=require(_0xea09('0x1'));var path=require(_0xea09('0x2'));var timeout=require('connect-timeout');var express=require(_0xea09('0x3'));var router=express['Router']();var fs_extra=require(_0xea09('0x4'));var auth=require(_0xea09('0x5'));var interaction=require(_0xea09('0x6'));var config=require('../../config/environment');var controller=require(_0xea09('0x7'));router[_0xea09('0x8')]('/',auth['isAuthenticated'](),controller[_0xea09('0x9')]);router[_0xea09('0x8')](_0xea09('0xa'),auth[_0xea09('0xb')](),controller[_0xea09('0xc')]);router[_0xea09('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xea09('0xd')]);router[_0xea09('0xe')]('/',auth[_0xea09('0xb')](),controller['create']);router[_0xea09('0xf')](_0xea09('0x10'),auth['isAuthenticated'](),controller[_0xea09('0x11')]);router[_0xea09('0x12')]('/:id',auth[_0xea09('0xb')](),controller['destroy']);module[_0xea09('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 937c6c0..e4abd34 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 _0x1883=['exports','STRING','name','sequelize'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x1883,0xab));var _0x3188=function(_0x1b13bb,_0x517c27){_0x1b13bb=_0x1b13bb-0x0;var _0x2a3483=_0x1883[_0x1b13bb];return _0x2a3483;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'unique':_0x3188('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3188('0x2')]}}; \ No newline at end of file +var _0x0d4d=['STRING','name','sequelize','exports'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x0d4d,0x132));var _0xd0d4=function(_0x328ffb,_0x15a855){_0x328ffb=_0x328ffb-0x0;var _0x531183=_0x0d4d[_0x328ffb];return _0x531183;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'name':{'type':Sequelize[_0xd0d4('0x2')],'unique':_0xd0d4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd0d4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1093a00..2a06537 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 _0x1407=['offset','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','show','params','include','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count'];(function(_0x5ecfd5,_0x377c29){var _0x15057f=function(_0x44f46a){while(--_0x44f46a){_0x5ecfd5['push'](_0x5ecfd5['shift']());}};_0x15057f(++_0x377c29);}(_0x1407,0x193));var _0x7140=function(_0x2a2bc3,_0x54c566){_0x2a2bc3=_0x2a2bc3-0x0;var _0x2acdd8=_0x1407[_0x2a2bc3];return _0x2acdd8;};'use strict';var emlformat=require(_0x7140('0x0'));var rimraf=require(_0x7140('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7140('0x2'));var rp=require(_0x7140('0x3'));var moment=require(_0x7140('0x4'));var BPromise=require(_0x7140('0x5'));var Mustache=require(_0x7140('0x6'));var util=require(_0x7140('0x7'));var path=require(_0x7140('0x8'));var sox=require('sox');var csv=require(_0x7140('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7140('0xa'));var squel=require(_0x7140('0xb'));var crypto=require(_0x7140('0xc'));var jsforce=require(_0x7140('0xd'));var deskjs=require(_0x7140('0xe'));var toCsv=require(_0x7140('0x9'));var querystring=require(_0x7140('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7140('0x10'));var as=require(_0x7140('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7140('0x12'))(_0x7140('0x13'));var utils=require(_0x7140('0x14'));var config=require(_0x7140('0x15'));var licenseUtil=require(_0x7140('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55f7c8,_0x1ac9c2){_0x1ac9c2=_0x1ac9c2||0xcc;return function(_0x531ef9){if(_0x531ef9){return _0x55f7c8['sendStatus'](_0x1ac9c2);}return _0x55f7c8[_0x7140('0x17')](_0x1ac9c2)[_0x7140('0x18')]();};}function respondWithResult(_0x18dc16,_0x217b01){_0x217b01=_0x217b01||0xc8;return function(_0x8f0e57){if(_0x8f0e57){return _0x18dc16['status'](_0x217b01)[_0x7140('0x19')](_0x8f0e57);}};}function respondWithFilteredResult(_0x2b03a0,_0x5c23d9){return function(_0x4c8023){if(_0x4c8023){var _0xe6796=typeof _0x5c23d9['offset']===_0x7140('0x1a')&&typeof _0x5c23d9[_0x7140('0x1b')]===_0x7140('0x1a');var _0x4745a5=_0x4c8023['count'];var _0x1e7abf=_0xe6796?0x0:_0x5c23d9['offset'];var _0x2ba788=_0xe6796?_0x4c8023[_0x7140('0x1c')]:_0x5c23d9[_0x7140('0x1d')]+_0x5c23d9['limit'];var _0x2df68f;if(_0x2ba788>=_0x4745a5){_0x2ba788=_0x4745a5;_0x2df68f=0xc8;}else{_0x2df68f=0xce;}_0x2b03a0[_0x7140('0x17')](_0x2df68f);return _0x2b03a0[_0x7140('0x1e')]('Content-Range',_0x1e7abf+'-'+_0x2ba788+'/'+_0x4745a5)[_0x7140('0x19')](_0x4c8023);}return null;};}function patchUpdates(_0x4099c4){return function(_0x369683){try{jsonpatch[_0x7140('0x1f')](_0x369683,_0x4099c4,!![]);}catch(_0x3b0826){return BPromise['reject'](_0x3b0826);}return _0x369683[_0x7140('0x20')]();};}function saveUpdates(_0x5aede6,_0x16c17a){return function(_0x9dcd0e){if(_0x9dcd0e){return _0x9dcd0e[_0x7140('0x21')](_0x5aede6)['then'](function(_0x2d573e){return _0x2d573e;});}return null;};}function removeEntity(_0x4474fe,_0x427f7b){return function(_0x5ead88){if(_0x5ead88){return _0x5ead88[_0x7140('0x22')]()[_0x7140('0x23')](function(){_0x4474fe[_0x7140('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f178,_0x2631b7){return function(_0x14c01f){if(!_0x14c01f){_0x32f178[_0x7140('0x24')](0x194);}return _0x14c01f;};}function handleError(_0x5b42e9,_0x44bf26){_0x44bf26=_0x44bf26||0x1f4;return function(_0x25f370){logger[_0x7140('0x25')](_0x25f370[_0x7140('0x26')]);if(_0x25f370[_0x7140('0x27')]){delete _0x25f370[_0x7140('0x27')];}_0x5b42e9[_0x7140('0x17')](_0x44bf26)[_0x7140('0x28')](_0x25f370);};}exports[_0x7140('0x29')]=function(_0x456381,_0x37f5ea){var _0x34366f={},_0xa8193e={},_0x429189={'count':0x0,'rows':[]};var _0x4d8088=_[_0x7140('0x2a')](db[_0x7140('0x2b')][_0x7140('0x2c')],function(_0x214c45){return{'name':_0x214c45['fieldName'],'type':_0x214c45[_0x7140('0x2d')][_0x7140('0x2e')]};});_0xa8193e[_0x7140('0x2f')]=_[_0x7140('0x2a')](_0x4d8088,'name');_0xa8193e[_0x7140('0x30')]=_[_0x7140('0x31')](_0x456381[_0x7140('0x30')]);_0xa8193e[_0x7140('0x32')]=_[_0x7140('0x33')](_0xa8193e['model'],_0xa8193e[_0x7140('0x30')]);_0x34366f[_0x7140('0x34')]=_[_0x7140('0x33')](_0xa8193e[_0x7140('0x2f')],qs[_0x7140('0x35')](_0x456381['query'][_0x7140('0x35')]));_0x34366f[_0x7140('0x34')]=_0x34366f[_0x7140('0x34')]['length']?_0x34366f['attributes']:_0xa8193e['model'];if(!_0x456381['query'][_0x7140('0x36')](_0x7140('0x37'))){_0x34366f[_0x7140('0x1b')]=qs[_0x7140('0x1b')](_0x456381[_0x7140('0x30')][_0x7140('0x1b')]);_0x34366f['offset']=qs[_0x7140('0x1d')](_0x456381[_0x7140('0x30')][_0x7140('0x1d')]);}_0x34366f[_0x7140('0x38')]=qs[_0x7140('0x39')](_0x456381[_0x7140('0x30')][_0x7140('0x39')]);_0x34366f[_0x7140('0x3a')]=qs['filters'](_['pick'](_0x456381[_0x7140('0x30')],_0xa8193e['filters']),_0x4d8088);if(_0x456381[_0x7140('0x30')][_0x7140('0x3b')]){_0x34366f[_0x7140('0x3a')]=_[_0x7140('0x3c')](_0x34366f[_0x7140('0x3a')],{'$or':_[_0x7140('0x2a')](_0x4d8088,function(_0xc60f){if(_0xc60f['type']!==_0x7140('0x3d')){var _0x257610={};_0x257610[_0xc60f[_0x7140('0x27')]]={'$like':'%'+_0x456381[_0x7140('0x30')]['filter']+'%'};return _0x257610;}})});}_0x34366f=_[_0x7140('0x3c')]({},_0x34366f,_0x456381[_0x7140('0x3e')]);var _0x50d289={'where':_0x34366f[_0x7140('0x3a')]};return db[_0x7140('0x2b')][_0x7140('0x1c')](_0x50d289)[_0x7140('0x23')](function(_0x5b03f7){_0x429189['count']=_0x5b03f7;if(_0x456381[_0x7140('0x30')][_0x7140('0x3f')]){_0x34366f['include']=[{'all':!![]}];}return db[_0x7140('0x2b')]['findAll'](_0x34366f);})[_0x7140('0x23')](function(_0xc3be96){_0x429189['rows']=_0xc3be96;return _0x429189;})[_0x7140('0x23')](respondWithFilteredResult(_0x37f5ea,_0x34366f))['catch'](handleError(_0x37f5ea,null));};exports[_0x7140('0x40')]=function(_0x5b44fd,_0x1fec78){var _0x59bbd1={'raw':!![],'where':{'id':_0x5b44fd[_0x7140('0x41')]['id']}},_0x4f9d94={};_0x4f9d94[_0x7140('0x2f')]=_[_0x7140('0x31')](db[_0x7140('0x2b')][_0x7140('0x2c')]);_0x4f9d94[_0x7140('0x30')]=_[_0x7140('0x31')](_0x5b44fd['query']);_0x4f9d94[_0x7140('0x32')]=_[_0x7140('0x33')](_0x4f9d94[_0x7140('0x2f')],_0x4f9d94[_0x7140('0x30')]);_0x59bbd1['attributes']=_[_0x7140('0x33')](_0x4f9d94[_0x7140('0x2f')],qs[_0x7140('0x35')](_0x5b44fd[_0x7140('0x30')][_0x7140('0x35')]));_0x59bbd1[_0x7140('0x34')]=_0x59bbd1[_0x7140('0x34')]['length']?_0x59bbd1[_0x7140('0x34')]:_0x4f9d94[_0x7140('0x2f')];if(_0x5b44fd[_0x7140('0x30')][_0x7140('0x3f')]){_0x59bbd1[_0x7140('0x42')]=[{'all':!![]}];}_0x59bbd1=_[_0x7140('0x3c')]({},_0x59bbd1,_0x5b44fd[_0x7140('0x3e')]);return db[_0x7140('0x2b')][_0x7140('0x43')](_0x59bbd1)[_0x7140('0x23')](handleEntityNotFound(_0x1fec78,null))[_0x7140('0x23')](respondWithResult(_0x1fec78,null))[_0x7140('0x44')](handleError(_0x1fec78,null));};exports[_0x7140('0x45')]=function(_0x94713,_0x1a1ab3){return db[_0x7140('0x2b')][_0x7140('0x45')](_0x94713['body'],{})[_0x7140('0x23')](respondWithResult(_0x1a1ab3,0xc9))[_0x7140('0x44')](handleError(_0x1a1ab3,null));};exports['update']=function(_0x564dec,_0x55e017){if(_0x564dec[_0x7140('0x46')]['id']){delete _0x564dec['body']['id'];}return db[_0x7140('0x2b')]['find']({'where':{'id':_0x564dec[_0x7140('0x41')]['id']}})[_0x7140('0x23')](handleEntityNotFound(_0x55e017,null))[_0x7140('0x23')](saveUpdates(_0x564dec[_0x7140('0x46')],null))[_0x7140('0x23')](respondWithResult(_0x55e017,null))[_0x7140('0x44')](handleError(_0x55e017,null));};exports['destroy']=function(_0x2dd27b,_0x589072){return db[_0x7140('0x2b')][_0x7140('0x43')]({'where':{'id':_0x2dd27b[_0x7140('0x41')]['id']}})[_0x7140('0x23')](handleEntityNotFound(_0x589072,null))[_0x7140('0x23')](removeEntity(_0x589072,null))[_0x7140('0x44')](handleError(_0x589072,null));};exports[_0x7140('0x47')]=function(_0x44fb97,_0x3998dc){return db[_0x7140('0x2b')][_0x7140('0x47')]()[_0x7140('0x23')](respondWithResult(_0x3998dc,null))[_0x7140('0x44')](handleError(_0x3998dc,null));}; \ No newline at end of file +var _0x1400=['pick','merge','filter','options','includeAll','findAll','rows','show','params','find','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x1400,0xe0));var _0x0140=function(_0x567602,_0x441607){_0x567602=_0x567602-0x0;var _0x49ce34=_0x1400[_0x567602];return _0x49ce34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0140('0x0'));var zipdir=require(_0x0140('0x1'));var jsonpatch=require(_0x0140('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0140('0x3'));var Mustache=require(_0x0140('0x4'));var util=require(_0x0140('0x5'));var path=require(_0x0140('0x6'));var sox=require(_0x0140('0x7'));var csv=require(_0x0140('0x8'));var ejs=require(_0x0140('0x9'));var fs=require('fs');var fs_extra=require(_0x0140('0xa'));var _=require(_0x0140('0xb'));var squel=require(_0x0140('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0140('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0140('0xe'));var Papa=require(_0x0140('0xf'));var Redis=require(_0x0140('0x10'));var authService=require(_0x0140('0x11'));var qs=require(_0x0140('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0140('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0140('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0140('0x15'))['db'];function respondWithStatusCode(_0x1f669c,_0x41f7ae){_0x41f7ae=_0x41f7ae||0xcc;return function(_0x4bd01d){if(_0x4bd01d){return _0x1f669c[_0x0140('0x16')](_0x41f7ae);}return _0x1f669c[_0x0140('0x17')](_0x41f7ae)[_0x0140('0x18')]();};}function respondWithResult(_0x300c42,_0xcc7301){_0xcc7301=_0xcc7301||0xc8;return function(_0x5317c5){if(_0x5317c5){return _0x300c42[_0x0140('0x17')](_0xcc7301)['json'](_0x5317c5);}};}function respondWithFilteredResult(_0x34e635,_0x2bde25){return function(_0x6450c){if(_0x6450c){var _0x79f144=typeof _0x2bde25[_0x0140('0x19')]===_0x0140('0x1a')&&typeof _0x2bde25[_0x0140('0x1b')]===_0x0140('0x1a');var _0x5387fc=_0x6450c['count'];var _0x5593af=_0x79f144?0x0:_0x2bde25[_0x0140('0x19')];var _0xc490b7=_0x79f144?_0x6450c[_0x0140('0x1c')]:_0x2bde25[_0x0140('0x19')]+_0x2bde25['limit'];var _0x11793f;if(_0xc490b7>=_0x5387fc){_0xc490b7=_0x5387fc;_0x11793f=0xc8;}else{_0x11793f=0xce;}_0x34e635[_0x0140('0x17')](_0x11793f);return _0x34e635['set'](_0x0140('0x1d'),_0x5593af+'-'+_0xc490b7+'/'+_0x5387fc)[_0x0140('0x1e')](_0x6450c);}return null;};}function patchUpdates(_0x347705){return function(_0x2e3100){try{jsonpatch[_0x0140('0x1f')](_0x2e3100,_0x347705,!![]);}catch(_0x5273a5){return BPromise[_0x0140('0x20')](_0x5273a5);}return _0x2e3100['save']();};}function saveUpdates(_0x4f9f7e,_0x6c2af3){return function(_0xd9ceea){if(_0xd9ceea){return _0xd9ceea['update'](_0x4f9f7e)['then'](function(_0x432f03){return _0x432f03;});}return null;};}function removeEntity(_0x296470,_0x555ae4){return function(_0xd3c90){if(_0xd3c90){return _0xd3c90[_0x0140('0x21')]()[_0x0140('0x22')](function(){_0x296470[_0x0140('0x17')](0xcc)[_0x0140('0x18')]();});}};}function handleEntityNotFound(_0x258ef8,_0x587da5){return function(_0x308b98){if(!_0x308b98){_0x258ef8[_0x0140('0x16')](0x194);}return _0x308b98;};}function handleError(_0x434f02,_0x12d7c0){_0x12d7c0=_0x12d7c0||0x1f4;return function(_0x47777c){logger['error'](_0x47777c[_0x0140('0x23')]);if(_0x47777c[_0x0140('0x24')]){delete _0x47777c[_0x0140('0x24')];}_0x434f02['status'](_0x12d7c0)[_0x0140('0x25')](_0x47777c);};}exports[_0x0140('0x26')]=function(_0x13c92c,_0x4bfbff){var _0x42a375={},_0x5cbfeb={},_0x2bbf8e={'count':0x0,'rows':[]};var _0x49a0cf=_[_0x0140('0x27')](db[_0x0140('0x28')][_0x0140('0x29')],function(_0x5586f4){return{'name':_0x5586f4[_0x0140('0x2a')],'type':_0x5586f4['type'][_0x0140('0x2b')]};});_0x5cbfeb[_0x0140('0x2c')]=_[_0x0140('0x27')](_0x49a0cf,'name');_0x5cbfeb['query']=_[_0x0140('0x2d')](_0x13c92c[_0x0140('0x2e')]);_0x5cbfeb[_0x0140('0x2f')]=_[_0x0140('0x30')](_0x5cbfeb[_0x0140('0x2c')],_0x5cbfeb['query']);_0x42a375[_0x0140('0x31')]=_[_0x0140('0x30')](_0x5cbfeb[_0x0140('0x2c')],qs['fields'](_0x13c92c[_0x0140('0x2e')][_0x0140('0x32')]));_0x42a375[_0x0140('0x31')]=_0x42a375[_0x0140('0x31')][_0x0140('0x33')]?_0x42a375[_0x0140('0x31')]:_0x5cbfeb[_0x0140('0x2c')];if(!_0x13c92c['query']['hasOwnProperty'](_0x0140('0x34'))){_0x42a375[_0x0140('0x1b')]=qs[_0x0140('0x1b')](_0x13c92c[_0x0140('0x2e')]['limit']);_0x42a375[_0x0140('0x19')]=qs[_0x0140('0x19')](_0x13c92c['query'][_0x0140('0x19')]);}_0x42a375[_0x0140('0x35')]=qs['sort'](_0x13c92c[_0x0140('0x2e')][_0x0140('0x36')]);_0x42a375[_0x0140('0x37')]=qs['filters'](_[_0x0140('0x38')](_0x13c92c[_0x0140('0x2e')],_0x5cbfeb[_0x0140('0x2f')]),_0x49a0cf);if(_0x13c92c[_0x0140('0x2e')]['filter']){_0x42a375['where']=_[_0x0140('0x39')](_0x42a375[_0x0140('0x37')],{'$or':_[_0x0140('0x27')](_0x49a0cf,function(_0x352351){if(_0x352351['type']!=='VIRTUAL'){var _0x5b239f={};_0x5b239f[_0x352351[_0x0140('0x24')]]={'$like':'%'+_0x13c92c[_0x0140('0x2e')][_0x0140('0x3a')]+'%'};return _0x5b239f;}})});}_0x42a375=_[_0x0140('0x39')]({},_0x42a375,_0x13c92c[_0x0140('0x3b')]);var _0x45a784={'where':_0x42a375[_0x0140('0x37')]};return db[_0x0140('0x28')][_0x0140('0x1c')](_0x45a784)[_0x0140('0x22')](function(_0x2d0b24){_0x2bbf8e[_0x0140('0x1c')]=_0x2d0b24;if(_0x13c92c[_0x0140('0x2e')][_0x0140('0x3c')]){_0x42a375['include']=[{'all':!![]}];}return db[_0x0140('0x28')][_0x0140('0x3d')](_0x42a375);})['then'](function(_0x29f313){_0x2bbf8e[_0x0140('0x3e')]=_0x29f313;return _0x2bbf8e;})[_0x0140('0x22')](respondWithFilteredResult(_0x4bfbff,_0x42a375))['catch'](handleError(_0x4bfbff,null));};exports[_0x0140('0x3f')]=function(_0x5dfb0b,_0x4c38c0){var _0x372d99={'raw':!![],'where':{'id':_0x5dfb0b[_0x0140('0x40')]['id']}},_0x568e87={};_0x568e87['model']=_[_0x0140('0x2d')](db[_0x0140('0x28')][_0x0140('0x29')]);_0x568e87['query']=_[_0x0140('0x2d')](_0x5dfb0b[_0x0140('0x2e')]);_0x568e87['filters']=_[_0x0140('0x30')](_0x568e87[_0x0140('0x2c')],_0x568e87[_0x0140('0x2e')]);_0x372d99['attributes']=_[_0x0140('0x30')](_0x568e87[_0x0140('0x2c')],qs[_0x0140('0x32')](_0x5dfb0b['query'][_0x0140('0x32')]));_0x372d99[_0x0140('0x31')]=_0x372d99['attributes'][_0x0140('0x33')]?_0x372d99[_0x0140('0x31')]:_0x568e87[_0x0140('0x2c')];if(_0x5dfb0b[_0x0140('0x2e')][_0x0140('0x3c')]){_0x372d99['include']=[{'all':!![]}];}_0x372d99=_[_0x0140('0x39')]({},_0x372d99,_0x5dfb0b[_0x0140('0x3b')]);return db['MailSubstatus'][_0x0140('0x41')](_0x372d99)[_0x0140('0x22')](handleEntityNotFound(_0x4c38c0,null))[_0x0140('0x22')](respondWithResult(_0x4c38c0,null))['catch'](handleError(_0x4c38c0,null));};exports['create']=function(_0x253c1a,_0x5f8734){return db[_0x0140('0x28')]['create'](_0x253c1a[_0x0140('0x42')],{})[_0x0140('0x22')](respondWithResult(_0x5f8734,0xc9))[_0x0140('0x43')](handleError(_0x5f8734,null));};exports[_0x0140('0x44')]=function(_0x23cbc3,_0x3e8173){if(_0x23cbc3[_0x0140('0x42')]['id']){delete _0x23cbc3[_0x0140('0x42')]['id'];}return db[_0x0140('0x28')][_0x0140('0x41')]({'where':{'id':_0x23cbc3[_0x0140('0x40')]['id']}})[_0x0140('0x22')](handleEntityNotFound(_0x3e8173,null))[_0x0140('0x22')](saveUpdates(_0x23cbc3[_0x0140('0x42')],null))[_0x0140('0x22')](respondWithResult(_0x3e8173,null))[_0x0140('0x43')](handleError(_0x3e8173,null));};exports[_0x0140('0x21')]=function(_0x5ca1de,_0x55f2db){return db[_0x0140('0x28')][_0x0140('0x41')]({'where':{'id':_0x5ca1de[_0x0140('0x40')]['id']}})[_0x0140('0x22')](handleEntityNotFound(_0x55f2db,null))[_0x0140('0x22')](removeEntity(_0x55f2db,null))[_0x0140('0x43')](handleError(_0x55f2db,null));};exports[_0x0140('0x45')]=function(_0x8c4d86,_0x44b2d7){return db[_0x0140('0x28')]['describe']()[_0x0140('0x22')](respondWithResult(_0x44b2d7,null))[_0x0140('0x43')](handleError(_0x44b2d7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 7b32863..99f7a9d 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 _0xf03a=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf03a,0x128));var _0xaf03=function(_0x133436,_0x43ad02){_0x133436=_0x133436-0x0;var _0x4c759b=_0xf03a[_0x133436];return _0x4c759b;};'use strict';var EventEmitter=require(_0xaf03('0x0'));var MailSubstatus=require(_0xaf03('0x1'))['db'][_0xaf03('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xaf03('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x213d65){return function(_0x489562,_0x2bd70b,_0x48f6c3){MailSubstatusEvents[_0xaf03('0x4')](_0x213d65+':'+_0x489562['id'],_0x489562);MailSubstatusEvents['emit'](_0x213d65,_0x489562);_0x48f6c3(null);};}for(var e in events){if(events[_0xaf03('0x5')](e)){var event=events[e];MailSubstatus[_0xaf03('0x6')](e,emitEvent(event));}}module[_0xaf03('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x9c4e=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c4e,0x162));var _0xe9c4=function(_0x578c1a,_0x3e720f){_0x578c1a=_0x578c1a-0x0;var _0x1cfbac=_0x9c4e[_0x578c1a];return _0x1cfbac;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xe9c4('0x0'))['db'][_0xe9c4('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xe9c4('0x2')};function emitEvent(_0x2ce2cc){return function(_0x467d4b,_0x3802d1,_0x48cdaf){MailSubstatusEvents[_0xe9c4('0x3')](_0x2ce2cc+':'+_0x467d4b['id'],_0x467d4b);MailSubstatusEvents[_0xe9c4('0x3')](_0x2ce2cc,_0x467d4b);_0x48cdaf(null);};}for(var e in events){if(events[_0xe9c4('0x4')](e)){var event=events[e];MailSubstatus[_0xe9c4('0x5')](e,emitEvent(event));}}module[_0xe9c4('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 6749abf..fb60096 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 _0xfea2=['define','MailSubstatus','mail_substatuses','update','name','then','catch','exports'];(function(_0x5b438b,_0x26cca5){var _0x18131e=function(_0x62c0c){while(--_0x62c0c){_0x5b438b['push'](_0x5b438b['shift']());}};_0x18131e(++_0x26cca5);}(_0xfea2,0x117));var _0x2fea=function(_0x141908,_0x4e61dc){_0x141908=_0x141908-0x0;var _0x37e9c9=_0xfea2[_0x141908];return _0x37e9c9;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x2fea('0x0')]=function(_0x15f27a){var _0x122118=_0x15f27a['models'];return _0x15f27a[_0x2fea('0x1')](_0x2fea('0x2'),attributes,{'tableName':_0x2fea('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x686892,_0x29a5a6,_0x323029){return _0x122118['Condition'][_0x2fea('0x4')]({'value':_0x686892[_0x2fea('0x5')]},{'where':{'field':'mailSubstatus','value':_0x686892['_previousDataValues'][_0x2fea('0x5')]}})[_0x2fea('0x6')](function(){_0x323029();})[_0x2fea('0x7')](function(_0x4b3bf3){_0x323029(_0x4b3bf3);});}}});}; \ No newline at end of file +var _0x9527=['name','then','catch','exports','define','MailSubstatus','mail_substatuses','Condition','update'];(function(_0x59385f,_0x218c19){var _0x3502df=function(_0x80e493){while(--_0x80e493){_0x59385f['push'](_0x59385f['shift']());}};_0x3502df(++_0x218c19);}(_0x9527,0x135));var _0x7952=function(_0x1b96d1,_0x1e1dd6){_0x1b96d1=_0x1b96d1-0x0;var _0x174247=_0x9527[_0x1b96d1];return _0x174247;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x7952('0x0')]=function(_0x43edda){var _0x301912=_0x43edda['models'];return _0x43edda[_0x7952('0x1')](_0x7952('0x2'),attributes,{'tableName':_0x7952('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x22e2a8,_0xf20ae8,_0x4aca8c){return _0x301912[_0x7952('0x4')][_0x7952('0x5')]({'value':_0x22e2a8['name']},{'where':{'field':'mailSubstatus','value':_0x22e2a8['_previousDataValues'][_0x7952('0x6')]}})[_0x7952('0x7')](function(){_0x4aca8c();})[_0x7952('0x8')](function(_0x32d288){_0x4aca8c(_0x32d288);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8ef04b4..b9ea24f 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 _0x8709=['jayson/promise','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40eabd,_0x174cff){var _0x3f8769=function(_0x4a7e52){while(--_0x4a7e52){_0x40eabd['push'](_0x40eabd['shift']());}};_0x3f8769(++_0x174cff);}(_0x8709,0xc6));var _0x9870=function(_0x3fa4bd,_0x14a72d){_0x3fa4bd=_0x3fa4bd-0x0;var _0x358c95=_0x8709[_0x3fa4bd];return _0x358c95;};'use strict';var _=require(_0x9870('0x0'));var util=require(_0x9870('0x1'));var moment=require('moment');var BPromise=require(_0x9870('0x2'));var rs=require(_0x9870('0x3'));var fs=require('fs');var Redis=require(_0x9870('0x4'));var db=require(_0x9870('0x5'))['db'];var utils=require(_0x9870('0x6'));var logger=require(_0x9870('0x7'))(_0x9870('0x8'));var config=require('../../config/environment');var jayson=require(_0x9870('0x9'));var client=jayson['client'][_0x9870('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42c288,_0x3cc26d,_0x5633ee){return new BPromise(function(_0x563605,_0x1a78a4){return client['request'](_0x42c288,_0x5633ee)[_0x9870('0xb')](function(_0x1aa017){logger['info'](_0x9870('0xc'),_0x3cc26d,_0x9870('0xd'));logger[_0x9870('0xe')](_0x9870('0xf'),_0x3cc26d,_0x9870('0xd'),JSON[_0x9870('0x10')](_0x1aa017));if(_0x1aa017[_0x9870('0x11')]){if(_0x1aa017[_0x9870('0x11')][_0x9870('0x12')]===0x1f4){logger[_0x9870('0x11')](_0x9870('0xc'),_0x3cc26d,_0x1aa017['error']['message']);return _0x1a78a4(_0x1aa017['error'][_0x9870('0x13')]);}logger[_0x9870('0x11')](_0x9870('0xc'),_0x3cc26d,_0x1aa017[_0x9870('0x11')][_0x9870('0x13')]);return _0x563605(_0x1aa017[_0x9870('0x11')][_0x9870('0x13')]);}else{logger[_0x9870('0x14')](_0x9870('0xc'),_0x3cc26d,_0x9870('0xd'));_0x563605(_0x1aa017[_0x9870('0x15')]['message']);}})[_0x9870('0x16')](function(_0xc6b0c0){logger[_0x9870('0x11')](_0x9870('0xc'),_0x3cc26d,_0xc6b0c0);_0x1a78a4(_0xc6b0c0);});});} \ No newline at end of file +var _0xd17b=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd17b,0x16b));var _0xbd17=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0xd17b[_0x53ddab];return _0x5819ac;};'use strict';var _=require(_0xbd17('0x0'));var util=require(_0xbd17('0x1'));var moment=require(_0xbd17('0x2'));var BPromise=require(_0xbd17('0x3'));var rs=require(_0xbd17('0x4'));var fs=require('fs');var Redis=require(_0xbd17('0x5'));var db=require(_0xbd17('0x6'))['db'];var utils=require(_0xbd17('0x7'));var logger=require('../../config/logger')(_0xbd17('0x8'));var config=require(_0xbd17('0x9'));var jayson=require(_0xbd17('0xa'));var client=jayson[_0xbd17('0xb')][_0xbd17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f6713,_0x21d55a,_0x5dade5){return new BPromise(function(_0x49aed9,_0x137a97){return client[_0xbd17('0xd')](_0x1f6713,_0x5dade5)[_0xbd17('0xe')](function(_0x5f5d14){logger[_0xbd17('0xf')](_0xbd17('0x10'),_0x21d55a,_0xbd17('0x11'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x21d55a,_0xbd17('0x11'),JSON[_0xbd17('0x12')](_0x5f5d14));if(_0x5f5d14[_0xbd17('0x13')]){if(_0x5f5d14[_0xbd17('0x13')][_0xbd17('0x14')]===0x1f4){logger[_0xbd17('0x13')](_0xbd17('0x10'),_0x21d55a,_0x5f5d14[_0xbd17('0x13')]['message']);return _0x137a97(_0x5f5d14[_0xbd17('0x13')]['message']);}logger[_0xbd17('0x13')](_0xbd17('0x10'),_0x21d55a,_0x5f5d14[_0xbd17('0x13')][_0xbd17('0x15')]);return _0x49aed9(_0x5f5d14[_0xbd17('0x13')]['message']);}else{logger[_0xbd17('0xf')](_0xbd17('0x10'),_0x21d55a,_0xbd17('0x11'));_0x49aed9(_0x5f5d14[_0xbd17('0x16')][_0xbd17('0x15')]);}})['catch'](function(_0x4f65e4){logger[_0xbd17('0x13')](_0xbd17('0x10'),_0x21d55a,_0x4f65e4);_0x137a97(_0x4f65e4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a30f870..38b8d03 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 _0xf230=['./mailTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x162fd8,_0x14bdc3){var _0x1fba01=function(_0x18c52e){while(--_0x18c52e){_0x162fd8['push'](_0x162fd8['shift']());}};_0x1fba01(++_0x14bdc3);}(_0xf230,0x1d9));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var path=require(_0x0f23('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0f23('0x3'));var auth=require(_0x0f23('0x4'));var interaction=require(_0x0f23('0x5'));var config=require(_0x0f23('0x6'));var controller=require(_0x0f23('0x7'));router[_0x0f23('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0f23('0x8')](_0x0f23('0x9'),auth[_0x0f23('0xa')](),controller[_0x0f23('0xb')]);router[_0x0f23('0x8')](_0x0f23('0xc'),auth[_0x0f23('0xa')](),controller[_0x0f23('0xd')]);router[_0x0f23('0xe')]('/',auth['isAuthenticated'](),controller[_0x0f23('0xf')]);router[_0x0f23('0x10')](_0x0f23('0xc'),auth['isAuthenticated'](),controller[_0x0f23('0x11')]);router[_0x0f23('0x12')](_0x0f23('0xc'),auth['isAuthenticated'](),controller[_0x0f23('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8325=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete'];(function(_0x54463d,_0x2c3e67){var _0x46af1e=function(_0x2f641a){while(--_0x2f641a){_0x54463d['push'](_0x54463d['shift']());}};_0x46af1e(++_0x2c3e67);}(_0x8325,0x1e2));var _0x5832=function(_0x347343,_0x495ba1){_0x347343=_0x347343-0x0;var _0x96764b=_0x8325[_0x347343];return _0x96764b;};'use strict';var multer=require(_0x5832('0x0'));var util=require(_0x5832('0x1'));var path=require(_0x5832('0x2'));var timeout=require('connect-timeout');var express=require(_0x5832('0x3'));var router=express[_0x5832('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5832('0x5'));var interaction=require(_0x5832('0x6'));var config=require('../../config/environment');var controller=require(_0x5832('0x7'));router[_0x5832('0x8')]('/',auth[_0x5832('0x9')](),controller[_0x5832('0xa')]);router[_0x5832('0x8')](_0x5832('0xb'),auth[_0x5832('0x9')](),controller[_0x5832('0xc')]);router[_0x5832('0x8')](_0x5832('0xd'),auth[_0x5832('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5832('0xe')]);router[_0x5832('0xf')]('/:id',auth[_0x5832('0x9')](),controller[_0x5832('0x10')]);router[_0x5832('0x11')](_0x5832('0xd'),auth['isAuthenticated'](),controller[_0x5832('0x12')]);module[_0x5832('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 00e998c..39b4d6c 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x44993c,_0x142c2a){var _0x4f706b=function(_0x5b01d9){while(--_0x5b01d9){_0x44993c['push'](_0x44993c['shift']());}};_0x4f706b(++_0x142c2a);}(_0x70e0,0x17b));var _0x070e=function(_0x671914,_0xba8562){_0x671914=_0x671914-0x0;var _0x796f34=_0x70e0[_0x671914];return _0x796f34;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x384691,_0x1f4e03){var _0x28b395=function(_0x541706){while(--_0x541706){_0x384691['push'](_0x384691['shift']());}};_0x28b395(++_0x1f4e03);}(_0x34e8,0x12c));var _0x834e=function(_0x16a361,_0x2298b1){_0x16a361=_0x16a361-0x0;var _0x1c5874=_0x34e8[_0x16a361];return _0x1c5874;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0bbb7d8..6615ac6 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 _0xf3b2=['intersection','attributes','fields','hasOwnProperty','filters','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys'];(function(_0x2c1d2b,_0x1ab115){var _0x182dfa=function(_0x1eae10){while(--_0x1eae10){_0x2c1d2b['push'](_0x2c1d2b['shift']());}};_0x182dfa(++_0x1ab115);}(_0xf3b2,0x1c7));var _0x2f3b=function(_0x78e522,_0x37c539){_0x78e522=_0x78e522-0x0;var _0x4a170d=_0xf3b2[_0x78e522];return _0x4a170d;};'use strict';var emlformat=require(_0x2f3b('0x0'));var rimraf=require(_0x2f3b('0x1'));var zipdir=require(_0x2f3b('0x2'));var jsonpatch=require(_0x2f3b('0x3'));var rp=require(_0x2f3b('0x4'));var moment=require(_0x2f3b('0x5'));var BPromise=require(_0x2f3b('0x6'));var Mustache=require(_0x2f3b('0x7'));var util=require(_0x2f3b('0x8'));var path=require(_0x2f3b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2f3b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f3b('0xb'));var squel=require(_0x2f3b('0xc'));var crypto=require(_0x2f3b('0xd'));var jsforce=require(_0x2f3b('0xe'));var deskjs=require(_0x2f3b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2f3b('0x10'));var Papa=require(_0x2f3b('0x11'));var Redis=require(_0x2f3b('0x12'));var authService=require(_0x2f3b('0x13'));var qs=require(_0x2f3b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f3b('0x15'));var logger=require(_0x2f3b('0x16'))(_0x2f3b('0x17'));var utils=require('../../config/utils');var config=require(_0x2f3b('0x18'));var licenseUtil=require(_0x2f3b('0x19'));var db=require(_0x2f3b('0x1a'))['db'];function respondWithStatusCode(_0x4fdbd9,_0x5f51d3){_0x5f51d3=_0x5f51d3||0xcc;return function(_0x124fb4){if(_0x124fb4){return _0x4fdbd9['sendStatus'](_0x5f51d3);}return _0x4fdbd9[_0x2f3b('0x1b')](_0x5f51d3)[_0x2f3b('0x1c')]();};}function respondWithResult(_0x562120,_0x12fc88){_0x12fc88=_0x12fc88||0xc8;return function(_0xc9bdb2){if(_0xc9bdb2){return _0x562120[_0x2f3b('0x1b')](_0x12fc88)[_0x2f3b('0x1d')](_0xc9bdb2);}};}function respondWithFilteredResult(_0x3643bd,_0xaa7e89){return function(_0x29fe62){if(_0x29fe62){var _0x2a98d3=typeof _0xaa7e89[_0x2f3b('0x1e')]===_0x2f3b('0x1f')&&typeof _0xaa7e89[_0x2f3b('0x20')]===_0x2f3b('0x1f');var _0x352c9b=_0x29fe62[_0x2f3b('0x21')];var _0x55e34d=_0x2a98d3?0x0:_0xaa7e89[_0x2f3b('0x1e')];var _0x5cac5c=_0x2a98d3?_0x29fe62[_0x2f3b('0x21')]:_0xaa7e89['offset']+_0xaa7e89[_0x2f3b('0x20')];var _0x502346;if(_0x5cac5c>=_0x352c9b){_0x5cac5c=_0x352c9b;_0x502346=0xc8;}else{_0x502346=0xce;}_0x3643bd[_0x2f3b('0x1b')](_0x502346);return _0x3643bd[_0x2f3b('0x22')](_0x2f3b('0x23'),_0x55e34d+'-'+_0x5cac5c+'/'+_0x352c9b)[_0x2f3b('0x1d')](_0x29fe62);}return null;};}function patchUpdates(_0xb35491){return function(_0x1c3893){try{jsonpatch['apply'](_0x1c3893,_0xb35491,!![]);}catch(_0x59031b){return BPromise['reject'](_0x59031b);}return _0x1c3893[_0x2f3b('0x24')]();};}function saveUpdates(_0xe2525c,_0x342751){return function(_0x1b3dff){if(_0x1b3dff){return _0x1b3dff[_0x2f3b('0x25')](_0xe2525c)['then'](function(_0x3ae4cd){return _0x3ae4cd;});}return null;};}function removeEntity(_0x4134f6,_0x42c7ca){return function(_0x13a10c){if(_0x13a10c){return _0x13a10c['destroy']()[_0x2f3b('0x26')](function(){_0x4134f6['status'](0xcc)[_0x2f3b('0x1c')]();});}};}function handleEntityNotFound(_0x3edbdc,_0x5bd548){return function(_0x5c64d5){if(!_0x5c64d5){_0x3edbdc[_0x2f3b('0x27')](0x194);}return _0x5c64d5;};}function handleError(_0x22ebb5,_0x293b0c){_0x293b0c=_0x293b0c||0x1f4;return function(_0x441f05){logger[_0x2f3b('0x28')](_0x441f05['stack']);if(_0x441f05['name']){delete _0x441f05['name'];}_0x22ebb5[_0x2f3b('0x1b')](_0x293b0c)['send'](_0x441f05);};}exports['index']=function(_0x1ad6db,_0x5e0bb8){var _0x36122d={},_0x17acca={},_0xedf7d5={'count':0x0,'rows':[]};var _0x216c21=_[_0x2f3b('0x29')](db[_0x2f3b('0x2a')][_0x2f3b('0x2b')],function(_0x1c17d9){return{'name':_0x1c17d9[_0x2f3b('0x2c')],'type':_0x1c17d9['type'][_0x2f3b('0x2d')]};});_0x17acca[_0x2f3b('0x2e')]=_[_0x2f3b('0x29')](_0x216c21,'name');_0x17acca[_0x2f3b('0x2f')]=_[_0x2f3b('0x30')](_0x1ad6db['query']);_0x17acca['filters']=_[_0x2f3b('0x31')](_0x17acca[_0x2f3b('0x2e')],_0x17acca[_0x2f3b('0x2f')]);_0x36122d[_0x2f3b('0x32')]=_['intersection'](_0x17acca['model'],qs[_0x2f3b('0x33')](_0x1ad6db[_0x2f3b('0x2f')][_0x2f3b('0x33')]));_0x36122d[_0x2f3b('0x32')]=_0x36122d[_0x2f3b('0x32')]['length']?_0x36122d[_0x2f3b('0x32')]:_0x17acca[_0x2f3b('0x2e')];if(!_0x1ad6db[_0x2f3b('0x2f')][_0x2f3b('0x34')]('nolimit')){_0x36122d[_0x2f3b('0x20')]=qs[_0x2f3b('0x20')](_0x1ad6db[_0x2f3b('0x2f')]['limit']);_0x36122d[_0x2f3b('0x1e')]=qs[_0x2f3b('0x1e')](_0x1ad6db['query'][_0x2f3b('0x1e')]);}_0x36122d['order']=qs['sort'](_0x1ad6db['query']['sort']);_0x36122d['where']=qs[_0x2f3b('0x35')](_['pick'](_0x1ad6db['query'],_0x17acca[_0x2f3b('0x35')]),_0x216c21);if(_0x1ad6db[_0x2f3b('0x2f')]['filter']){_0x36122d['where']=_[_0x2f3b('0x36')](_0x36122d[_0x2f3b('0x37')],{'$or':_[_0x2f3b('0x29')](_0x216c21,function(_0x4c8425){if(_0x4c8425[_0x2f3b('0x38')]!==_0x2f3b('0x39')){var _0x1dc4c3={};_0x1dc4c3[_0x4c8425['name']]={'$like':'%'+_0x1ad6db[_0x2f3b('0x2f')]['filter']+'%'};return _0x1dc4c3;}})});}_0x36122d=_[_0x2f3b('0x36')]({},_0x36122d,_0x1ad6db[_0x2f3b('0x3a')]);var _0x1168cf={'where':_0x36122d[_0x2f3b('0x37')]};return db[_0x2f3b('0x2a')][_0x2f3b('0x21')](_0x1168cf)[_0x2f3b('0x26')](function(_0x351320){_0xedf7d5[_0x2f3b('0x21')]=_0x351320;if(_0x1ad6db['query'][_0x2f3b('0x3b')]){_0x36122d[_0x2f3b('0x3c')]=[{'all':!![]}];}return db[_0x2f3b('0x2a')][_0x2f3b('0x3d')](_0x36122d);})[_0x2f3b('0x26')](function(_0x51900e){_0xedf7d5[_0x2f3b('0x3e')]=_0x51900e;return _0xedf7d5;})[_0x2f3b('0x26')](respondWithFilteredResult(_0x5e0bb8,_0x36122d))[_0x2f3b('0x3f')](handleError(_0x5e0bb8,null));};exports[_0x2f3b('0x40')]=function(_0x2e6add,_0x1ce2f1){var _0x169fda={'raw':!![],'where':{'id':_0x2e6add[_0x2f3b('0x41')]['id']}},_0x274512={};_0x274512['model']=_[_0x2f3b('0x30')](db['MailTransferReport'][_0x2f3b('0x2b')]);_0x274512[_0x2f3b('0x2f')]=_[_0x2f3b('0x30')](_0x2e6add[_0x2f3b('0x2f')]);_0x274512['filters']=_['intersection'](_0x274512[_0x2f3b('0x2e')],_0x274512[_0x2f3b('0x2f')]);_0x169fda['attributes']=_['intersection'](_0x274512[_0x2f3b('0x2e')],qs[_0x2f3b('0x33')](_0x2e6add[_0x2f3b('0x2f')]['fields']));_0x169fda[_0x2f3b('0x32')]=_0x169fda[_0x2f3b('0x32')][_0x2f3b('0x42')]?_0x169fda[_0x2f3b('0x32')]:_0x274512[_0x2f3b('0x2e')];if(_0x2e6add[_0x2f3b('0x2f')][_0x2f3b('0x3b')]){_0x169fda[_0x2f3b('0x3c')]=[{'all':!![]}];}_0x169fda=_[_0x2f3b('0x36')]({},_0x169fda,_0x2e6add[_0x2f3b('0x3a')]);return db['MailTransferReport'][_0x2f3b('0x43')](_0x169fda)[_0x2f3b('0x26')](handleEntityNotFound(_0x1ce2f1,null))[_0x2f3b('0x26')](respondWithResult(_0x1ce2f1,null))[_0x2f3b('0x3f')](handleError(_0x1ce2f1,null));};exports[_0x2f3b('0x44')]=function(_0x2cd422,_0x13d8b0){return db[_0x2f3b('0x2a')][_0x2f3b('0x44')](_0x2cd422[_0x2f3b('0x45')],{})[_0x2f3b('0x26')](respondWithResult(_0x13d8b0,0xc9))[_0x2f3b('0x3f')](handleError(_0x13d8b0,null));};exports[_0x2f3b('0x25')]=function(_0x523737,_0x938d57){if(_0x523737[_0x2f3b('0x45')]['id']){delete _0x523737[_0x2f3b('0x45')]['id'];}return db[_0x2f3b('0x2a')]['find']({'where':{'id':_0x523737[_0x2f3b('0x41')]['id']}})[_0x2f3b('0x26')](handleEntityNotFound(_0x938d57,null))['then'](saveUpdates(_0x523737['body'],null))['then'](respondWithResult(_0x938d57,null))[_0x2f3b('0x3f')](handleError(_0x938d57,null));};exports[_0x2f3b('0x46')]=function(_0x518f3d,_0x462705){return db['MailTransferReport'][_0x2f3b('0x43')]({'where':{'id':_0x518f3d[_0x2f3b('0x41')]['id']}})['then'](handleEntityNotFound(_0x462705,null))[_0x2f3b('0x26')](removeEntity(_0x462705,null))['catch'](handleError(_0x462705,null));};exports[_0x2f3b('0x47')]=function(_0x40cc28,_0x4fe342){return db[_0x2f3b('0x2a')]['describe']()[_0x2f3b('0x26')](respondWithResult(_0x4fe342,null))[_0x2f3b('0x3f')](handleError(_0x4fe342,null));}; \ No newline at end of file +var _0xa54d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x126584,_0x87241f){var _0x37df97=function(_0x8ad893){while(--_0x8ad893){_0x126584['push'](_0x126584['shift']());}};_0x37df97(++_0x87241f);}(_0xa54d,0x118));var _0xda54=function(_0x212c85,_0x250f6a){_0x212c85=_0x212c85-0x0;var _0x424cc2=_0xa54d[_0x212c85];return _0x424cc2;};'use strict';var emlformat=require(_0xda54('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xda54('0x1'));var moment=require(_0xda54('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xda54('0x3'));var util=require('util');var path=require(_0xda54('0x4'));var sox=require(_0xda54('0x5'));var csv=require(_0xda54('0x6'));var ejs=require(_0xda54('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda54('0x8'));var squel=require(_0xda54('0x9'));var crypto=require(_0xda54('0xa'));var jsforce=require(_0xda54('0xb'));var deskjs=require(_0xda54('0xc'));var toCsv=require('to-csv');var querystring=require(_0xda54('0xd'));var Papa=require(_0xda54('0xe'));var Redis=require(_0xda54('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xda54('0x10'));var as=require(_0xda54('0x11'));var hardwareService=require(_0xda54('0x12'));var logger=require(_0xda54('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda54('0x14'));var db=require(_0xda54('0x15'))['db'];function respondWithStatusCode(_0xb73281,_0x5247b1){_0x5247b1=_0x5247b1||0xcc;return function(_0x1c5065){if(_0x1c5065){return _0xb73281['sendStatus'](_0x5247b1);}return _0xb73281[_0xda54('0x16')](_0x5247b1)['end']();};}function respondWithResult(_0x4aad80,_0x5e0e0e){_0x5e0e0e=_0x5e0e0e||0xc8;return function(_0x5dea31){if(_0x5dea31){return _0x4aad80[_0xda54('0x16')](_0x5e0e0e)[_0xda54('0x17')](_0x5dea31);}};}function respondWithFilteredResult(_0x9ab432,_0x1cb80b){return function(_0x38535f){if(_0x38535f){var _0x6f1104=typeof _0x1cb80b['offset']===_0xda54('0x18')&&typeof _0x1cb80b[_0xda54('0x19')]===_0xda54('0x18');var _0x362007=_0x38535f[_0xda54('0x1a')];var _0x3247ba=_0x6f1104?0x0:_0x1cb80b['offset'];var _0x89a8ba=_0x6f1104?_0x38535f[_0xda54('0x1a')]:_0x1cb80b[_0xda54('0x1b')]+_0x1cb80b[_0xda54('0x19')];var _0x8d6e8b;if(_0x89a8ba>=_0x362007){_0x89a8ba=_0x362007;_0x8d6e8b=0xc8;}else{_0x8d6e8b=0xce;}_0x9ab432[_0xda54('0x16')](_0x8d6e8b);return _0x9ab432[_0xda54('0x1c')](_0xda54('0x1d'),_0x3247ba+'-'+_0x89a8ba+'/'+_0x362007)[_0xda54('0x17')](_0x38535f);}return null;};}function patchUpdates(_0xe2af11){return function(_0x221aae){try{jsonpatch[_0xda54('0x1e')](_0x221aae,_0xe2af11,!![]);}catch(_0x5df764){return BPromise[_0xda54('0x1f')](_0x5df764);}return _0x221aae[_0xda54('0x20')]();};}function saveUpdates(_0x429940,_0x3ecd25){return function(_0x3b6120){if(_0x3b6120){return _0x3b6120['update'](_0x429940)[_0xda54('0x21')](function(_0x2debf4){return _0x2debf4;});}return null;};}function removeEntity(_0x94a1f,_0x1f47eb){return function(_0x5cd7b8){if(_0x5cd7b8){return _0x5cd7b8[_0xda54('0x22')]()[_0xda54('0x21')](function(){_0x94a1f[_0xda54('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe4505b,_0x64363d){return function(_0x209d05){if(!_0x209d05){_0xe4505b['sendStatus'](0x194);}return _0x209d05;};}function handleError(_0x46b0b5,_0x384746){_0x384746=_0x384746||0x1f4;return function(_0x3cc94d){logger[_0xda54('0x23')](_0x3cc94d[_0xda54('0x24')]);if(_0x3cc94d[_0xda54('0x25')]){delete _0x3cc94d[_0xda54('0x25')];}_0x46b0b5[_0xda54('0x16')](_0x384746)[_0xda54('0x26')](_0x3cc94d);};}exports[_0xda54('0x27')]=function(_0x4fc4d6,_0x8a6d39){var _0x4efe4d={},_0x2d1a92={},_0x43e17f={'count':0x0,'rows':[]};var _0x1d8150=_[_0xda54('0x28')](db[_0xda54('0x29')][_0xda54('0x2a')],function(_0x11fcec){return{'name':_0x11fcec['fieldName'],'type':_0x11fcec[_0xda54('0x2b')][_0xda54('0x2c')]};});_0x2d1a92[_0xda54('0x2d')]=_[_0xda54('0x28')](_0x1d8150,_0xda54('0x25'));_0x2d1a92[_0xda54('0x2e')]=_[_0xda54('0x2f')](_0x4fc4d6['query']);_0x2d1a92[_0xda54('0x30')]=_[_0xda54('0x31')](_0x2d1a92[_0xda54('0x2d')],_0x2d1a92[_0xda54('0x2e')]);_0x4efe4d[_0xda54('0x32')]=_['intersection'](_0x2d1a92[_0xda54('0x2d')],qs[_0xda54('0x33')](_0x4fc4d6[_0xda54('0x2e')]['fields']));_0x4efe4d[_0xda54('0x32')]=_0x4efe4d[_0xda54('0x32')]['length']?_0x4efe4d['attributes']:_0x2d1a92['model'];if(!_0x4fc4d6[_0xda54('0x2e')]['hasOwnProperty'](_0xda54('0x34'))){_0x4efe4d[_0xda54('0x19')]=qs[_0xda54('0x19')](_0x4fc4d6[_0xda54('0x2e')][_0xda54('0x19')]);_0x4efe4d[_0xda54('0x1b')]=qs[_0xda54('0x1b')](_0x4fc4d6['query'][_0xda54('0x1b')]);}_0x4efe4d[_0xda54('0x35')]=qs[_0xda54('0x36')](_0x4fc4d6[_0xda54('0x2e')][_0xda54('0x36')]);_0x4efe4d[_0xda54('0x37')]=qs[_0xda54('0x30')](_[_0xda54('0x38')](_0x4fc4d6['query'],_0x2d1a92['filters']),_0x1d8150);if(_0x4fc4d6['query'][_0xda54('0x39')]){_0x4efe4d[_0xda54('0x37')]=_[_0xda54('0x3a')](_0x4efe4d[_0xda54('0x37')],{'$or':_[_0xda54('0x28')](_0x1d8150,function(_0x421876){if(_0x421876[_0xda54('0x2b')]!==_0xda54('0x3b')){var _0x4c0f1c={};_0x4c0f1c[_0x421876['name']]={'$like':'%'+_0x4fc4d6['query'][_0xda54('0x39')]+'%'};return _0x4c0f1c;}})});}_0x4efe4d=_[_0xda54('0x3a')]({},_0x4efe4d,_0x4fc4d6[_0xda54('0x3c')]);var _0x5a0cdf={'where':_0x4efe4d['where']};return db[_0xda54('0x29')][_0xda54('0x1a')](_0x5a0cdf)[_0xda54('0x21')](function(_0x4d557d){_0x43e17f[_0xda54('0x1a')]=_0x4d557d;if(_0x4fc4d6[_0xda54('0x2e')][_0xda54('0x3d')]){_0x4efe4d[_0xda54('0x3e')]=[{'all':!![]}];}return db[_0xda54('0x29')][_0xda54('0x3f')](_0x4efe4d);})[_0xda54('0x21')](function(_0x46410d){_0x43e17f[_0xda54('0x40')]=_0x46410d;return _0x43e17f;})[_0xda54('0x21')](respondWithFilteredResult(_0x8a6d39,_0x4efe4d))[_0xda54('0x41')](handleError(_0x8a6d39,null));};exports[_0xda54('0x42')]=function(_0x30c8e9,_0x40e784){var _0x945cd={'raw':!![],'where':{'id':_0x30c8e9[_0xda54('0x43')]['id']}},_0x2469f5={};_0x2469f5[_0xda54('0x2d')]=_[_0xda54('0x2f')](db[_0xda54('0x29')][_0xda54('0x2a')]);_0x2469f5[_0xda54('0x2e')]=_[_0xda54('0x2f')](_0x30c8e9[_0xda54('0x2e')]);_0x2469f5['filters']=_[_0xda54('0x31')](_0x2469f5[_0xda54('0x2d')],_0x2469f5[_0xda54('0x2e')]);_0x945cd[_0xda54('0x32')]=_[_0xda54('0x31')](_0x2469f5[_0xda54('0x2d')],qs[_0xda54('0x33')](_0x30c8e9[_0xda54('0x2e')][_0xda54('0x33')]));_0x945cd[_0xda54('0x32')]=_0x945cd[_0xda54('0x32')][_0xda54('0x44')]?_0x945cd['attributes']:_0x2469f5['model'];if(_0x30c8e9[_0xda54('0x2e')][_0xda54('0x3d')]){_0x945cd[_0xda54('0x3e')]=[{'all':!![]}];}_0x945cd=_[_0xda54('0x3a')]({},_0x945cd,_0x30c8e9['options']);return db['MailTransferReport']['find'](_0x945cd)['then'](handleEntityNotFound(_0x40e784,null))[_0xda54('0x21')](respondWithResult(_0x40e784,null))[_0xda54('0x41')](handleError(_0x40e784,null));};exports['create']=function(_0x3c293d,_0x342e57){return db[_0xda54('0x29')][_0xda54('0x45')](_0x3c293d[_0xda54('0x46')],{})[_0xda54('0x21')](respondWithResult(_0x342e57,0xc9))[_0xda54('0x41')](handleError(_0x342e57,null));};exports[_0xda54('0x47')]=function(_0x141dbd,_0x5e9552){if(_0x141dbd['body']['id']){delete _0x141dbd[_0xda54('0x46')]['id'];}return db[_0xda54('0x29')][_0xda54('0x48')]({'where':{'id':_0x141dbd[_0xda54('0x43')]['id']}})[_0xda54('0x21')](handleEntityNotFound(_0x5e9552,null))[_0xda54('0x21')](saveUpdates(_0x141dbd['body'],null))[_0xda54('0x21')](respondWithResult(_0x5e9552,null))[_0xda54('0x41')](handleError(_0x5e9552,null));};exports['destroy']=function(_0x3c0347,_0x4b79f1){return db[_0xda54('0x29')][_0xda54('0x48')]({'where':{'id':_0x3c0347[_0xda54('0x43')]['id']}})[_0xda54('0x21')](handleEntityNotFound(_0x4b79f1,null))[_0xda54('0x21')](removeEntity(_0x4b79f1,null))[_0xda54('0x41')](handleError(_0x4b79f1,null));};exports[_0xda54('0x49')]=function(_0x42fe5b,_0xa1ea78){return db[_0xda54('0x29')]['describe']()[_0xda54('0x21')](respondWithResult(_0xa1ea78,null))[_0xda54('0x41')](handleError(_0xa1ea78,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b52852a..14673f6 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 _0x72bd=['api','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x633a64,_0x546fe2){var _0x3f60e7=function(_0x3401a8){while(--_0x3401a8){_0x633a64['push'](_0x633a64['shift']());}};_0x3f60e7(++_0x546fe2);}(_0x72bd,0xcf));var _0xd72b=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x72bd[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xd72b('0x0'));var util=require('util');var logger=require(_0xd72b('0x1'))(_0xd72b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd72b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd72b('0x4'));var config=require(_0xd72b('0x5'));var attributes=require(_0xd72b('0x6'));module['exports']=function(_0x3f3b04,_0x1668d8){return _0x3f3b04[_0xd72b('0x7')](_0xd72b('0x8'),attributes,{'tableName':_0xd72b('0x9'),'paranoid':![],'indexes':[{'name':_0xd72b('0xa'),'fields':[_0xd72b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb205=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x1d0764,_0x2beb7c){var _0x423f49=function(_0x5334ee){while(--_0x5334ee){_0x1d0764['push'](_0x1d0764['shift']());}};_0x423f49(++_0x2beb7c);}(_0xb205,0x156));var _0x5b20=function(_0x4f9fa1,_0x1795fa){_0x4f9fa1=_0x4f9fa1-0x0;var _0x3dc380=_0xb205[_0x4f9fa1];return _0x3dc380;};'use strict';var _=require(_0x5b20('0x0'));var util=require('util');var logger=require(_0x5b20('0x1'))(_0x5b20('0x2'));var moment=require('moment');var BPromise=require(_0x5b20('0x3'));var rp=require(_0x5b20('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b20('0x5'));var config=require(_0x5b20('0x6'));var attributes=require(_0x5b20('0x7'));module[_0x5b20('0x8')]=function(_0x329ad4,_0xb51467){return _0x329ad4[_0x5b20('0x9')](_0x5b20('0xa'),attributes,{'tableName':_0x5b20('0xb'),'paranoid':![],'indexes':[{'name':_0x5b20('0xc'),'fields':[_0x5b20('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7205c2d..f8f5cae 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 _0x0586=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0xa54be,_0x4a6caa){var _0xa929c5=function(_0x3c44f1){while(--_0x3c44f1){_0xa54be['push'](_0xa54be['shift']());}};_0xa929c5(++_0x4a6caa);}(_0x0586,0xe4));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6058('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6058('0x1'));var fs=require('fs');var Redis=require(_0x6058('0x2'));var db=require(_0x6058('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6058('0x4'))(_0x6058('0x5'));var config=require(_0x6058('0x6'));var jayson=require(_0x6058('0x7'));var client=jayson['client'][_0x6058('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d4801,_0x548eb9,_0x31e8d5){return new BPromise(function(_0x279662,_0x1ff9e9){return client[_0x6058('0x9')](_0x1d4801,_0x31e8d5)['then'](function(_0x3b1e5c){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x548eb9,_0x6058('0xa'));logger['debug'](_0x6058('0xb'),_0x548eb9,_0x6058('0xa'),JSON[_0x6058('0xc')](_0x3b1e5c));if(_0x3b1e5c['error']){if(_0x3b1e5c[_0x6058('0xd')]['code']===0x1f4){logger[_0x6058('0xd')](_0x6058('0xe'),_0x548eb9,_0x3b1e5c['error']['message']);return _0x1ff9e9(_0x3b1e5c[_0x6058('0xd')][_0x6058('0xf')]);}logger[_0x6058('0xd')](_0x6058('0xe'),_0x548eb9,_0x3b1e5c['error'][_0x6058('0xf')]);return _0x279662(_0x3b1e5c[_0x6058('0xd')]['message']);}else{logger[_0x6058('0x10')](_0x6058('0xe'),_0x548eb9,'request\x20sent');_0x279662(_0x3b1e5c[_0x6058('0x11')][_0x6058('0xf')]);}})[_0x6058('0x12')](function(_0x5039c0){logger[_0x6058('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x548eb9,_0x5039c0);_0x1ff9e9(_0x5039c0);});});} \ No newline at end of file +var _0x2d53=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31cb77,_0x348021){var _0x710374=function(_0x5e92f6){while(--_0x5e92f6){_0x31cb77['push'](_0x31cb77['shift']());}};_0x710374(++_0x348021);}(_0x2d53,0xae));var _0x32d5=function(_0xce06d0,_0xe944b9){_0xce06d0=_0xce06d0-0x0;var _0x360347=_0x2d53[_0xce06d0];return _0x360347;};'use strict';var _=require(_0x32d5('0x0'));var util=require(_0x32d5('0x1'));var moment=require(_0x32d5('0x2'));var BPromise=require(_0x32d5('0x3'));var rs=require(_0x32d5('0x4'));var fs=require('fs');var Redis=require(_0x32d5('0x5'));var db=require(_0x32d5('0x6'))['db'];var utils=require(_0x32d5('0x7'));var logger=require(_0x32d5('0x8'))(_0x32d5('0x9'));var config=require(_0x32d5('0xa'));var jayson=require(_0x32d5('0xb'));var client=jayson[_0x32d5('0xc')][_0x32d5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x297ddd,_0x406557,_0x4fa833){return new BPromise(function(_0x1cc731,_0x2aef6d){return client[_0x32d5('0xe')](_0x297ddd,_0x4fa833)[_0x32d5('0xf')](function(_0x242c24){logger['info'](_0x32d5('0x10'),_0x406557,'request\x20sent');logger[_0x32d5('0x11')](_0x32d5('0x12'),_0x406557,'request\x20sent',JSON['stringify'](_0x242c24));if(_0x242c24[_0x32d5('0x13')]){if(_0x242c24[_0x32d5('0x13')][_0x32d5('0x14')]===0x1f4){logger['error'](_0x32d5('0x10'),_0x406557,_0x242c24['error']['message']);return _0x2aef6d(_0x242c24[_0x32d5('0x13')]['message']);}logger[_0x32d5('0x13')](_0x32d5('0x10'),_0x406557,_0x242c24[_0x32d5('0x13')][_0x32d5('0x15')]);return _0x1cc731(_0x242c24['error'][_0x32d5('0x15')]);}else{logger[_0x32d5('0x16')](_0x32d5('0x10'),_0x406557,_0x32d5('0x17'));_0x1cc731(_0x242c24[_0x32d5('0x18')]['message']);}})[_0x32d5('0x19')](function(_0x596018){logger[_0x32d5('0x13')](_0x32d5('0x10'),_0x406557,_0x596018);_0x2aef6d(_0x596018);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index e8e826b..4921081 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 _0x9d17=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x58e00d,_0x4366f1){var _0x421800=function(_0x12d1cc){while(--_0x12d1cc){_0x58e00d['push'](_0x58e00d['shift']());}};_0x421800(++_0x4366f1);}(_0x9d17,0x16f));var _0x79d1=function(_0x114c56,_0x2a4fa6){_0x114c56=_0x114c56-0x0;var _0x495e3a=_0x9d17[_0x114c56];return _0x495e3a;};'use strict';var multer=require(_0x79d1('0x0'));var util=require(_0x79d1('0x1'));var path=require(_0x79d1('0x2'));var timeout=require(_0x79d1('0x3'));var express=require('express');var router=express[_0x79d1('0x4')]();var fs_extra=require(_0x79d1('0x5'));var auth=require(_0x79d1('0x6'));var interaction=require(_0x79d1('0x7'));var config=require(_0x79d1('0x8'));var controller=require(_0x79d1('0x9'));router[_0x79d1('0xa')]('/',auth[_0x79d1('0xb')](),controller[_0x79d1('0xc')]);router[_0x79d1('0xa')](_0x79d1('0xd'),auth[_0x79d1('0xb')](),controller[_0x79d1('0xe')]);router[_0x79d1('0xa')](_0x79d1('0xf'),auth[_0x79d1('0xb')](),controller[_0x79d1('0x10')]);router[_0x79d1('0x11')]('/',auth[_0x79d1('0xb')](),controller[_0x79d1('0x12')]);router[_0x79d1('0x13')]('/:id',auth[_0x79d1('0xb')](),controller[_0x79d1('0x14')]);router[_0x79d1('0x15')]('/:id',auth[_0x79d1('0xb')](),controller[_0x79d1('0x16')]);module[_0x79d1('0x17')]=router; \ No newline at end of file +var _0x13e5=['describe','/:id','post','create','put','update','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x13e5,0xc2));var _0x513e=function(_0x105ccc,_0x4ff3c9){_0x105ccc=_0x105ccc-0x0;var _0x4be68c=_0x13e5[_0x105ccc];return _0x4be68c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x513e('0x0'));var timeout=require(_0x513e('0x1'));var express=require(_0x513e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x513e('0x3'));var interaction=require(_0x513e('0x4'));var config=require(_0x513e('0x5'));var controller=require('./memberReport.controller');router[_0x513e('0x6')]('/',auth[_0x513e('0x7')](),controller[_0x513e('0x8')]);router[_0x513e('0x6')](_0x513e('0x9'),auth[_0x513e('0x7')](),controller[_0x513e('0xa')]);router[_0x513e('0x6')](_0x513e('0xb'),auth[_0x513e('0x7')](),controller['show']);router[_0x513e('0xc')]('/',auth['isAuthenticated'](),controller[_0x513e('0xd')]);router[_0x513e('0xe')](_0x513e('0xb'),auth[_0x513e('0x7')](),controller[_0x513e('0xf')]);router['delete']('/:id',auth[_0x513e('0x7')](),controller['destroy']);module[_0x513e('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 4504108..22f71ef 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 _0x26c9=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x26c9,0x14d));var _0x926c=function(_0x452d9d,_0x54304a){_0x452d9d=_0x452d9d-0x0;var _0x5966a1=_0x26c9[_0x452d9d];return _0x5966a1;};'use strict';var Sequelize=require(_0x926c('0x0'));var moment=require('moment');module[_0x926c('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x926c('0x2')]},'interface':{'type':Sequelize[_0x926c('0x2')]},'type':{'type':Sequelize[_0x926c('0x2')],'defaultValue':_0x926c('0x3'),'comment':_0x926c('0x4')},'duration':{'type':Sequelize[_0x926c('0x5')]},'enterAt':{'type':Sequelize[_0x926c('0x6')]},'exitAt':{'type':Sequelize[_0x926c('0x6')],'set':function(_0x36fb51){var _0x9740f6=moment(_0x36fb51);var _0x5005d8=moment(this[_0x926c('0x7')](_0x926c('0x8')));var _0x57047d=_0x9740f6['diff'](_0x5005d8,_0x926c('0x9'));this[_0x926c('0xa')](_0x926c('0xb'),_0x36fb51);this['setDataValue']('duration',_0x57047d>=0x0?_0x57047d:null);}},'data1':{'type':Sequelize[_0x926c('0x2')],'comment':_0x926c('0xc')},'data2':{'type':Sequelize[_0x926c('0x2')],'comment':_0x926c('0xd')},'data3':{'type':Sequelize[_0x926c('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x926c('0xe')},'data5':{'type':Sequelize[_0x926c('0x2')],'comment':_0x926c('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x926c('0x5')]},'uniqueid':{'type':Sequelize[_0x926c('0x2')]}}; \ No newline at end of file +var _0x9630=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x4631bc,_0x19e913){var _0x5701e7=function(_0x23c046){while(--_0x23c046){_0x4631bc['push'](_0x4631bc['shift']());}};_0x5701e7(++_0x19e913);}(_0x9630,0x188));var _0x0963=function(_0x3e69fd,_0x3cb065){_0x3e69fd=_0x3e69fd-0x0;var _0x2df8ad=_0x9630[_0x3e69fd];return _0x2df8ad;};'use strict';var Sequelize=require(_0x0963('0x0'));var moment=require(_0x0963('0x1'));module[_0x0963('0x2')]={'channel':{'type':Sequelize[_0x0963('0x3')]},'membername':{'type':Sequelize[_0x0963('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0963('0x3')],'defaultValue':_0x0963('0x4'),'comment':_0x0963('0x5')},'duration':{'type':Sequelize[_0x0963('0x6')]},'enterAt':{'type':Sequelize[_0x0963('0x7')]},'exitAt':{'type':Sequelize[_0x0963('0x7')],'set':function(_0x104cdd){var _0x28d4aa=moment(_0x104cdd);var _0x4bae39=moment(this[_0x0963('0x8')](_0x0963('0x9')));var _0x184109=_0x28d4aa[_0x0963('0xa')](_0x4bae39,_0x0963('0xb'));this[_0x0963('0xc')](_0x0963('0xd'),_0x104cdd);this[_0x0963('0xc')](_0x0963('0xe'),_0x184109>=0x0?_0x184109:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x0963('0xf')},'data2':{'type':Sequelize[_0x0963('0x3')],'comment':_0x0963('0x10')},'data3':{'type':Sequelize[_0x0963('0x3')],'comment':_0x0963('0x11')},'data4':{'type':Sequelize[_0x0963('0x3')],'comment':_0x0963('0x12')},'data5':{'type':Sequelize[_0x0963('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x0963('0x3')]},'internal':{'type':Sequelize[_0x0963('0x6')]},'uniqueid':{'type':Sequelize[_0x0963('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 31084d9..9f4edaf 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x34e8,0x12c));var _0x834e=function(_0x5b49bf,_0x2dc679){_0x5b49bf=_0x5b49bf-0x0;var _0x466c73=_0x34e8[_0x5b49bf];return _0x466c73;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xf9e32c,_0x1d614f){var _0x3bf4e3=function(_0x2aae2b){while(--_0x2aae2b){_0xf9e32c['push'](_0xf9e32c['shift']());}};_0x3bf4e3(++_0x1d614f);}(_0x3e74,0x175));var _0x43e7=function(_0x301d0f,_0x2b71bc){_0x301d0f=_0x301d0f-0x0;var _0x277364=_0x3e74[_0x301d0f];return _0x277364;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index bf9938e..75a951f 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 _0x219d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','report_member','membername','lodash','util','../../config/logger','api'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x219d,0xa4));var _0xd219=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x219d[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xd219('0x0'));var util=require(_0xd219('0x1'));var logger=require(_0xd219('0x2'))(_0xd219('0x3'));var moment=require(_0xd219('0x4'));var BPromise=require(_0xd219('0x5'));var rp=require(_0xd219('0x6'));var fs=require('fs');var path=require(_0xd219('0x7'));var rimraf=require(_0xd219('0x8'));var config=require(_0xd219('0x9'));var attributes=require(_0xd219('0xa'));module['exports']=function(_0x4f325f,_0x2658a2){return _0x4f325f[_0xd219('0xb')]('MemberReport',attributes,{'tableName':_0xd219('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xd219('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf935=['define','MemberReport','membername_interface','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0xb07408,_0x81407){var _0x35389e=function(_0x2965ab){while(--_0x2965ab){_0xb07408['push'](_0xb07408['shift']());}};_0x35389e(++_0x81407);}(_0xf935,0x1ef));var _0x5f93=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf935[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5f93('0x0'));var util=require(_0x5f93('0x1'));var logger=require(_0x5f93('0x2'))(_0x5f93('0x3'));var moment=require(_0x5f93('0x4'));var BPromise=require(_0x5f93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f93('0x6'));var rimraf=require('rimraf');var config=require(_0x5f93('0x7'));var attributes=require('./memberReport.attributes');module[_0x5f93('0x8')]=function(_0x2dec7b,_0x241a62){return _0x2dec7b[_0x5f93('0x9')](_0x5f93('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x5f93('0xb'),'fields':['membername','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 e08a45b..a23dd27 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 _0x0fcd=['map','model','debug','catch','CreateMemberReport','MemberReport','body','update','UpdateMemberReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetMemberReport','options','raw','where','attributes','limit','include'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x0fcd,0x129));var _0xd0fc=function(_0x415e36,_0x3f8be8){_0x415e36=_0x415e36-0x0;var _0x3bce2e=_0x0fcd[_0x415e36];return _0x3bce2e;};'use strict';var _=require('lodash');var util=require(_0xd0fc('0x0'));var moment=require(_0xd0fc('0x1'));var BPromise=require(_0xd0fc('0x2'));var rs=require(_0xd0fc('0x3'));var fs=require('fs');var Redis=require(_0xd0fc('0x4'));var db=require(_0xd0fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0fc('0x6'))(_0xd0fc('0x7'));var config=require(_0xd0fc('0x8'));var jayson=require(_0xd0fc('0x9'));var client=jayson['client'][_0xd0fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d93cc,_0x5efebd,_0x5ad581){return new BPromise(function(_0x5e42a1,_0x2f1e84){return client[_0xd0fc('0xb')](_0x5d93cc,_0x5ad581)[_0xd0fc('0xc')](function(_0x499260){logger[_0xd0fc('0xd')](_0xd0fc('0xe'),_0x5efebd,'request\x20sent');logger['debug'](_0xd0fc('0xf'),_0x5efebd,_0xd0fc('0x10'),JSON[_0xd0fc('0x11')](_0x499260));if(_0x499260['error']){if(_0x499260[_0xd0fc('0x12')]['code']===0x1f4){logger[_0xd0fc('0x12')](_0xd0fc('0xe'),_0x5efebd,_0x499260['error'][_0xd0fc('0x13')]);return _0x2f1e84(_0x499260[_0xd0fc('0x12')][_0xd0fc('0x13')]);}logger['error'](_0xd0fc('0xe'),_0x5efebd,_0x499260[_0xd0fc('0x12')][_0xd0fc('0x13')]);return _0x5e42a1(_0x499260['error']['message']);}else{logger[_0xd0fc('0xd')](_0xd0fc('0xe'),_0x5efebd,_0xd0fc('0x10'));_0x5e42a1(_0x499260['result']['message']);}})['catch'](function(_0x53e28d){logger[_0xd0fc('0x12')]('MemberReport,\x20%s,\x20%s',_0x5efebd,_0x53e28d);_0x2f1e84(_0x53e28d);});});}exports[_0xd0fc('0x14')]=function(_0x5703f1){var _0x2ab894=this;return new Promise(function(_0x20849d,_0xae6918){return db['MemberReport']['findAll']({'raw':_0x5703f1[_0xd0fc('0x15')]?_0x5703f1['options'][_0xd0fc('0x16')]===undefined?!![]:![]:!![],'where':_0x5703f1[_0xd0fc('0x15')]?_0x5703f1[_0xd0fc('0x15')][_0xd0fc('0x17')]||null:null,'attributes':_0x5703f1[_0xd0fc('0x15')]?_0x5703f1[_0xd0fc('0x15')][_0xd0fc('0x18')]||null:null,'limit':_0x5703f1['options']?_0x5703f1[_0xd0fc('0x15')][_0xd0fc('0x19')]||null:null,'include':_0x5703f1['options']?_0x5703f1['options'][_0xd0fc('0x1a')]?_[_0xd0fc('0x1b')](_0x5703f1[_0xd0fc('0x15')][_0xd0fc('0x1a')],function(_0x1cdb25){return{'model':db[_0x1cdb25[_0xd0fc('0x1c')]],'as':_0x1cdb25['as'],'attributes':_0x1cdb25[_0xd0fc('0x18')],'include':_0x1cdb25[_0xd0fc('0x1a')]?_[_0xd0fc('0x1b')](_0x1cdb25[_0xd0fc('0x1a')],function(_0x57d598){return{'model':db[_0x57d598[_0xd0fc('0x1c')]],'as':_0x57d598['as'],'attributes':_0x57d598[_0xd0fc('0x18')],'include':_0x57d598[_0xd0fc('0x1a')]?_[_0xd0fc('0x1b')](_0x57d598[_0xd0fc('0x1a')],function(_0x94cbd){return{'model':db[_0x94cbd[_0xd0fc('0x1c')]],'as':_0x94cbd['as'],'attributes':_0x94cbd[_0xd0fc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd0fc('0xc')](function(_0x4389a8){logger[_0xd0fc('0xd')](_0xd0fc('0x14'),_0x5703f1);logger[_0xd0fc('0x1d')](_0xd0fc('0x14'),_0x5703f1,JSON[_0xd0fc('0x11')](_0x4389a8));_0x20849d(_0x4389a8);})[_0xd0fc('0x1e')](function(_0x131fdc){logger[_0xd0fc('0x12')](_0xd0fc('0x14'),_0x131fdc[_0xd0fc('0x13')],_0x5703f1);_0xae6918(_0x2ab894['error'](0x1f4,_0x131fdc[_0xd0fc('0x13')]));});});};exports[_0xd0fc('0x1f')]=function(_0x438c6a){var _0x27255e=this;return new Promise(function(_0x43afe1,_0x18e2e4){return db[_0xd0fc('0x20')]['create'](_0x438c6a[_0xd0fc('0x21')],{'raw':_0x438c6a[_0xd0fc('0x15')]?_0x438c6a['options']['raw']===undefined?!![]:![]:!![]})[_0xd0fc('0xc')](function(_0x124509){logger[_0xd0fc('0xd')](_0xd0fc('0x1f'),_0x438c6a);logger[_0xd0fc('0x1d')]('CreateMemberReport',_0x438c6a,JSON[_0xd0fc('0x11')](_0x124509));_0x43afe1(_0x124509);})[_0xd0fc('0x1e')](function(_0x16f7f3){logger[_0xd0fc('0x12')](_0xd0fc('0x1f'),_0x16f7f3[_0xd0fc('0x13')],_0x438c6a);_0x18e2e4(_0x27255e[_0xd0fc('0x12')](0x1f4,_0x16f7f3[_0xd0fc('0x13')]));});});};exports['UpdateMemberReport']=function(_0xb213fe){var _0x5d193e=this;return new Promise(function(_0x4f8ef4,_0x4fef30){return db['MemberReport'][_0xd0fc('0x22')](_0xb213fe[_0xd0fc('0x21')],{'raw':_0xb213fe[_0xd0fc('0x15')]?_0xb213fe[_0xd0fc('0x15')][_0xd0fc('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb213fe[_0xd0fc('0x15')]?_0xb213fe[_0xd0fc('0x15')][_0xd0fc('0x17')]||null:null,'attributes':_0xb213fe[_0xd0fc('0x15')]?_0xb213fe['options'][_0xd0fc('0x18')]||null:null,'limit':_0xb213fe['options']?_0xb213fe['options'][_0xd0fc('0x19')]||null:null})[_0xd0fc('0xc')](function(_0x56bb7b){logger[_0xd0fc('0xd')](_0xd0fc('0x23'),_0xb213fe);logger[_0xd0fc('0x1d')](_0xd0fc('0x23'),_0xb213fe,JSON[_0xd0fc('0x11')](_0x56bb7b));_0x4f8ef4(_0x56bb7b);})[_0xd0fc('0x1e')](function(_0x4245a8){logger[_0xd0fc('0x12')](_0xd0fc('0x23'),_0x4245a8[_0xd0fc('0x13')],_0xb213fe);_0x4fef30(_0x5d193e[_0xd0fc('0x12')](0x1f4,_0x4245a8[_0xd0fc('0x13')]));});});}; \ No newline at end of file +var _0x5f71=['MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','create','CreateMemberReport','UpdateMemberReport','update','body','lodash','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5f71,0xc9));var _0x15f7=function(_0x378557,_0x29e6d0){_0x378557=_0x378557-0x0;var _0x127720=_0x5f71[_0x378557];return _0x127720;};'use strict';var _=require(_0x15f7('0x0'));var util=require('util');var moment=require(_0x15f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x15f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15f7('0x3'))(_0x15f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x15f7('0x5'));var client=jayson[_0x15f7('0x6')][_0x15f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1de7b3,_0x307158,_0x30d083){return new BPromise(function(_0x1c9509,_0x3f1490){return client[_0x15f7('0x8')](_0x1de7b3,_0x30d083)[_0x15f7('0x9')](function(_0x3e2f43){logger[_0x15f7('0xa')]('MemberReport,\x20%s,\x20%s',_0x307158,'request\x20sent');logger[_0x15f7('0xb')](_0x15f7('0xc'),_0x307158,'request\x20sent',JSON[_0x15f7('0xd')](_0x3e2f43));if(_0x3e2f43[_0x15f7('0xe')]){if(_0x3e2f43[_0x15f7('0xe')][_0x15f7('0xf')]===0x1f4){logger[_0x15f7('0xe')](_0x15f7('0x10'),_0x307158,_0x3e2f43[_0x15f7('0xe')]['message']);return _0x3f1490(_0x3e2f43[_0x15f7('0xe')][_0x15f7('0x11')]);}logger[_0x15f7('0xe')]('MemberReport,\x20%s,\x20%s',_0x307158,_0x3e2f43[_0x15f7('0xe')][_0x15f7('0x11')]);return _0x1c9509(_0x3e2f43['error'][_0x15f7('0x11')]);}else{logger[_0x15f7('0xa')](_0x15f7('0x10'),_0x307158,_0x15f7('0x12'));_0x1c9509(_0x3e2f43[_0x15f7('0x13')][_0x15f7('0x11')]);}})[_0x15f7('0x14')](function(_0x4b0d42){logger[_0x15f7('0xe')](_0x15f7('0x10'),_0x307158,_0x4b0d42);_0x3f1490(_0x4b0d42);});});}exports['GetMemberReport']=function(_0x2c78ca){var _0x333ff8=this;return new Promise(function(_0x2d4bc3,_0x40b752){return db[_0x15f7('0x15')][_0x15f7('0x16')]({'raw':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca['options'][_0x15f7('0x18')]===undefined?!![]:![]:!![],'where':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca[_0x15f7('0x17')][_0x15f7('0x19')]||null:null,'attributes':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca[_0x15f7('0x17')][_0x15f7('0x1a')]||null:null,'limit':_0x2c78ca['options']?_0x2c78ca['options'][_0x15f7('0x1b')]||null:null,'include':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca[_0x15f7('0x17')][_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x2c78ca['options'][_0x15f7('0x1c')],function(_0x4fe2ca){return{'model':db[_0x4fe2ca[_0x15f7('0x1e')]],'as':_0x4fe2ca['as'],'attributes':_0x4fe2ca[_0x15f7('0x1a')],'include':_0x4fe2ca['include']?_['map'](_0x4fe2ca[_0x15f7('0x1c')],function(_0x5a1e21){return{'model':db[_0x5a1e21['model']],'as':_0x5a1e21['as'],'attributes':_0x5a1e21[_0x15f7('0x1a')],'include':_0x5a1e21['include']?_[_0x15f7('0x1d')](_0x5a1e21[_0x15f7('0x1c')],function(_0x64f9d9){return{'model':db[_0x64f9d9[_0x15f7('0x1e')]],'as':_0x64f9d9['as'],'attributes':_0x64f9d9[_0x15f7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3adf28){logger[_0x15f7('0xa')](_0x15f7('0x1f'),_0x2c78ca);logger['debug']('GetMemberReport',_0x2c78ca,JSON['stringify'](_0x3adf28));_0x2d4bc3(_0x3adf28);})['catch'](function(_0x1aef2b){logger[_0x15f7('0xe')](_0x15f7('0x1f'),_0x1aef2b[_0x15f7('0x11')],_0x2c78ca);_0x40b752(_0x333ff8[_0x15f7('0xe')](0x1f4,_0x1aef2b[_0x15f7('0x11')]));});});};exports['CreateMemberReport']=function(_0x521934){var _0x31bf43=this;return new Promise(function(_0xd240bb,_0x350f8a){return db['MemberReport'][_0x15f7('0x20')](_0x521934['body'],{'raw':_0x521934[_0x15f7('0x17')]?_0x521934['options'][_0x15f7('0x18')]===undefined?!![]:![]:!![]})[_0x15f7('0x9')](function(_0x244c16){logger[_0x15f7('0xa')]('CreateMemberReport',_0x521934);logger['debug'](_0x15f7('0x21'),_0x521934,JSON[_0x15f7('0xd')](_0x244c16));_0xd240bb(_0x244c16);})[_0x15f7('0x14')](function(_0x348bb8){logger[_0x15f7('0xe')](_0x15f7('0x21'),_0x348bb8[_0x15f7('0x11')],_0x521934);_0x350f8a(_0x31bf43[_0x15f7('0xe')](0x1f4,_0x348bb8[_0x15f7('0x11')]));});});};exports[_0x15f7('0x22')]=function(_0x89637){var _0x4f3fe9=this;return new Promise(function(_0x1c737c,_0x54db19){return db[_0x15f7('0x15')][_0x15f7('0x23')](_0x89637[_0x15f7('0x24')],{'raw':_0x89637[_0x15f7('0x17')]?_0x89637[_0x15f7('0x17')][_0x15f7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x89637['options']?_0x89637[_0x15f7('0x17')]['where']||null:null,'attributes':_0x89637[_0x15f7('0x17')]?_0x89637[_0x15f7('0x17')][_0x15f7('0x1a')]||null:null,'limit':_0x89637[_0x15f7('0x17')]?_0x89637[_0x15f7('0x17')]['limit']||null:null})[_0x15f7('0x9')](function(_0x4fd128){logger['info'](_0x15f7('0x22'),_0x89637);logger['debug'](_0x15f7('0x22'),_0x89637,JSON[_0x15f7('0xd')](_0x4fd128));_0x1c737c(_0x4fd128);})[_0x15f7('0x14')](function(_0x69d8dd){logger[_0x15f7('0xe')](_0x15f7('0x22'),_0x69d8dd[_0x15f7('0x11')],_0x89637);_0x54db19(_0x4f3fe9['error'](0x1f4,_0x69d8dd[_0x15f7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2de1742..608eee2 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 _0x3feb=['connect-timeout','Router','fs-extra','../../config/environment','./migration.controller','get','path'];(function(_0x58cbe8,_0x3b7330){var _0x14d491=function(_0x152c7f){while(--_0x152c7f){_0x58cbe8['push'](_0x58cbe8['shift']());}};_0x14d491(++_0x3b7330);}(_0x3feb,0xf4));var _0xb3fe=function(_0x208bb3,_0x40d440){_0x208bb3=_0x208bb3-0x0;var _0x112085=_0x3feb[_0x208bb3];return _0x112085;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3fe('0x0'));var timeout=require(_0xb3fe('0x1'));var express=require('express');var router=express[_0xb3fe('0x2')]();var fs_extra=require(_0xb3fe('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3fe('0x4'));var controller=require(_0xb3fe('0x5'));router[_0xb3fe('0x6')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x6d16=['index','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x3b5b54,_0x60b6e7){var _0x40a644=function(_0x3b22ad){while(--_0x3b22ad){_0x3b5b54['push'](_0x3b5b54['shift']());}};_0x40a644(++_0x60b6e7);}(_0x6d16,0x169));var _0x66d1=function(_0x5bce33,_0x589030){_0x5bce33=_0x5bce33-0x0;var _0x4fa061=_0x6d16[_0x5bce33];return _0x4fa061;};'use strict';var multer=require(_0x66d1('0x0'));var util=require('util');var path=require(_0x66d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x66d1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x66d1('0x3'));var interaction=require(_0x66d1('0x4'));var config=require(_0x66d1('0x5'));var controller=require(_0x66d1('0x6'));router[_0x66d1('0x7')]('/',controller[_0x66d1('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2e236af..326e2c8 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 _0x1df9=['STRING','version','sequelize','exports'];(function(_0x131729,_0x3690ed){var _0x3fbffb=function(_0x11b44a){while(--_0x11b44a){_0x131729['push'](_0x131729['shift']());}};_0x3fbffb(++_0x3690ed);}(_0x1df9,0x8a));var _0x91df=function(_0x49634c,_0x193b98){_0x49634c=_0x49634c-0x0;var _0x42ce75=_0x1df9[_0x49634c];return _0x42ce75;};'use strict';var Sequelize=require(_0x91df('0x0'));module[_0x91df('0x1')]={'version':{'type':Sequelize[_0x91df('0x2')],'unique':_0x91df('0x3')}}; \ No newline at end of file +var _0x4486=['STRING','version','sequelize'];(function(_0xabcc86,_0x53728a){var _0x52d24e=function(_0x2c60a1){while(--_0x2c60a1){_0xabcc86['push'](_0xabcc86['shift']());}};_0x52d24e(++_0x53728a);}(_0x4486,0x7d));var _0x6448=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0x4486[_0x15f3c0];return _0x1adfe0;};'use strict';var Sequelize=require(_0x6448('0x0'));module['exports']={'version':{'type':Sequelize[_0x6448('0x1')],'unique':_0x6448('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 032c7f2..2221f5e 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 _0x3168=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','send','index','Migration','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x5f5376,_0x39976e){var _0x2ba21d=function(_0x14e535){while(--_0x14e535){_0x5f5376['push'](_0x5f5376['shift']());}};_0x2ba21d(++_0x39976e);}(_0x3168,0x148));var _0x8316=function(_0x1635e3,_0x22f7c4){_0x1635e3=_0x1635e3-0x0;var _0x51122c=_0x3168[_0x1635e3];return _0x51122c;};'use strict';var emlformat=require(_0x8316('0x0'));var rimraf=require(_0x8316('0x1'));var zipdir=require(_0x8316('0x2'));var jsonpatch=require(_0x8316('0x3'));var rp=require(_0x8316('0x4'));var moment=require(_0x8316('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8316('0x6'));var util=require(_0x8316('0x7'));var path=require(_0x8316('0x8'));var sox=require('sox');var csv=require(_0x8316('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8316('0xa'));var squel=require(_0x8316('0xb'));var crypto=require(_0x8316('0xc'));var jsforce=require(_0x8316('0xd'));var deskjs=require(_0x8316('0xe'));var toCsv=require(_0x8316('0x9'));var querystring=require('querystring');var Papa=require(_0x8316('0xf'));var Redis=require(_0x8316('0x10'));var authService=require(_0x8316('0x11'));var qs=require(_0x8316('0x12'));var as=require(_0x8316('0x13'));var hardwareService=require(_0x8316('0x14'));var logger=require('../../config/logger')(_0x8316('0x15'));var utils=require(_0x8316('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8316('0x17'));var db=require(_0x8316('0x18'))['db'];function respondWithStatusCode(_0x4381c8,_0x405dad){_0x405dad=_0x405dad||0xcc;return function(_0x52b644){if(_0x52b644){return _0x4381c8[_0x8316('0x19')](_0x405dad);}return _0x4381c8[_0x8316('0x1a')](_0x405dad)[_0x8316('0x1b')]();};}function respondWithResult(_0xf901a7,_0x12b7fb){_0x12b7fb=_0x12b7fb||0xc8;return function(_0x471f17){if(_0x471f17){return _0xf901a7['status'](_0x12b7fb)[_0x8316('0x1c')](_0x471f17);}};}function respondWithFilteredResult(_0x294989,_0x1e6dc7){return function(_0x4ee2ff){if(_0x4ee2ff){var _0x56e2fc=typeof _0x1e6dc7[_0x8316('0x1d')]===_0x8316('0x1e')&&typeof _0x1e6dc7[_0x8316('0x1f')]==='undefined';var _0x4b7160=_0x4ee2ff['count'];var _0x200a3a=_0x56e2fc?0x0:_0x1e6dc7[_0x8316('0x1d')];var _0x29a2ed=_0x56e2fc?_0x4ee2ff[_0x8316('0x20')]:_0x1e6dc7[_0x8316('0x1d')]+_0x1e6dc7[_0x8316('0x1f')];var _0x3a4591;if(_0x29a2ed>=_0x4b7160){_0x29a2ed=_0x4b7160;_0x3a4591=0xc8;}else{_0x3a4591=0xce;}_0x294989[_0x8316('0x1a')](_0x3a4591);return _0x294989[_0x8316('0x21')]('Content-Range',_0x200a3a+'-'+_0x29a2ed+'/'+_0x4b7160)[_0x8316('0x1c')](_0x4ee2ff);}return null;};}function patchUpdates(_0x2dbad8){return function(_0x138ba0){try{jsonpatch[_0x8316('0x22')](_0x138ba0,_0x2dbad8,!![]);}catch(_0x32be49){return BPromise['reject'](_0x32be49);}return _0x138ba0[_0x8316('0x23')]();};}function saveUpdates(_0x1b6b60,_0x29bc57){return function(_0x3e01d7){if(_0x3e01d7){return _0x3e01d7[_0x8316('0x24')](_0x1b6b60)[_0x8316('0x25')](function(_0x3282d1){return _0x3282d1;});}return null;};}function removeEntity(_0x6b65f4,_0x101bc3){return function(_0x38ffd5){if(_0x38ffd5){return _0x38ffd5[_0x8316('0x26')]()[_0x8316('0x25')](function(){_0x6b65f4[_0x8316('0x1a')](0xcc)[_0x8316('0x1b')]();});}};}function handleEntityNotFound(_0x5e6034,_0x5ee184){return function(_0x1337dc){if(!_0x1337dc){_0x5e6034['sendStatus'](0x194);}return _0x1337dc;};}function handleError(_0x394802,_0x40f01f){_0x40f01f=_0x40f01f||0x1f4;return function(_0x4c2772){logger['error'](_0x4c2772[_0x8316('0x27')]);if(_0x4c2772['name']){delete _0x4c2772['name'];}_0x394802[_0x8316('0x1a')](_0x40f01f)[_0x8316('0x28')](_0x4c2772);};}exports[_0x8316('0x29')]=function(_0x5ef704,_0x4729b0){var _0x5dd7db={},_0x244ca4={},_0x4066bc={'count':0x0,'rows':[]};var _0x3b9b20=_['map'](db[_0x8316('0x2a')]['rawAttributes'],function(_0x40f31f){return{'name':_0x40f31f[_0x8316('0x2b')],'type':_0x40f31f[_0x8316('0x2c')][_0x8316('0x2d')]};});_0x244ca4[_0x8316('0x2e')]=_[_0x8316('0x2f')](_0x3b9b20,_0x8316('0x30'));_0x244ca4[_0x8316('0x31')]=_[_0x8316('0x32')](_0x5ef704['query']);_0x244ca4[_0x8316('0x33')]=_[_0x8316('0x34')](_0x244ca4[_0x8316('0x2e')],_0x244ca4[_0x8316('0x31')]);_0x5dd7db[_0x8316('0x35')]=_[_0x8316('0x34')](_0x244ca4[_0x8316('0x2e')],qs[_0x8316('0x36')](_0x5ef704[_0x8316('0x31')][_0x8316('0x36')]));_0x5dd7db['attributes']=_0x5dd7db[_0x8316('0x35')][_0x8316('0x37')]?_0x5dd7db['attributes']:_0x244ca4[_0x8316('0x2e')];if(!_0x5ef704[_0x8316('0x31')][_0x8316('0x38')](_0x8316('0x39'))){_0x5dd7db[_0x8316('0x1f')]=qs[_0x8316('0x1f')](_0x5ef704[_0x8316('0x31')]['limit']);_0x5dd7db[_0x8316('0x1d')]=qs[_0x8316('0x1d')](_0x5ef704[_0x8316('0x31')][_0x8316('0x1d')]);}_0x5dd7db[_0x8316('0x3a')]=qs[_0x8316('0x3b')](_0x5ef704[_0x8316('0x31')][_0x8316('0x3b')]);_0x5dd7db[_0x8316('0x3c')]=qs['filters'](_['pick'](_0x5ef704[_0x8316('0x31')],_0x244ca4[_0x8316('0x33')]),_0x3b9b20);if(_0x5ef704[_0x8316('0x31')][_0x8316('0x3d')]){_0x5dd7db[_0x8316('0x3c')]=_[_0x8316('0x3e')](_0x5dd7db[_0x8316('0x3c')],{'$or':_[_0x8316('0x2f')](_0x3b9b20,function(_0xc249f6){if(_0xc249f6[_0x8316('0x2c')]!==_0x8316('0x3f')){var _0x491560={};_0x491560[_0xc249f6[_0x8316('0x30')]]={'$like':'%'+_0x5ef704[_0x8316('0x31')]['filter']+'%'};return _0x491560;}})});}_0x5dd7db=_[_0x8316('0x3e')]({},_0x5dd7db,_0x5ef704['options']);var _0x4db173={'where':_0x5dd7db[_0x8316('0x3c')]};return db[_0x8316('0x2a')]['count'](_0x4db173)[_0x8316('0x25')](function(_0x556318){_0x4066bc['count']=_0x556318;if(_0x5ef704[_0x8316('0x31')][_0x8316('0x40')]){_0x5dd7db[_0x8316('0x41')]=[{'all':!![]}];}return db['Migration'][_0x8316('0x42')](_0x5dd7db);})[_0x8316('0x25')](function(_0xbacc30){_0x4066bc[_0x8316('0x43')]=_0xbacc30;return _0x4066bc;})['then'](respondWithFilteredResult(_0x4729b0,_0x5dd7db))[_0x8316('0x44')](handleError(_0x4729b0,null));}; \ No newline at end of file +var _0xe5be=['include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','status','end','error','name','index','Migration','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','VIRTUAL','merge','options'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xe5be,0xc1));var _0xee5b=function(_0xe787b5,_0xce1afc){_0xe787b5=_0xe787b5-0x0;var _0x15c086=_0xe5be[_0xe787b5];return _0x15c086;};'use strict';var emlformat=require(_0xee5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee5b('0x1'));var jsonpatch=require(_0xee5b('0x2'));var rp=require(_0xee5b('0x3'));var moment=require(_0xee5b('0x4'));var BPromise=require(_0xee5b('0x5'));var Mustache=require(_0xee5b('0x6'));var util=require(_0xee5b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee5b('0x8'));var fs=require('fs');var fs_extra=require(_0xee5b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xee5b('0xa'));var jsforce=require(_0xee5b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee5b('0xc'));var querystring=require(_0xee5b('0xd'));var Papa=require(_0xee5b('0xe'));var Redis=require(_0xee5b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee5b('0x10'));var hardwareService=require(_0xee5b('0x11'));var logger=require(_0xee5b('0x12'))(_0xee5b('0x13'));var utils=require(_0xee5b('0x14'));var config=require(_0xee5b('0x15'));var licenseUtil=require(_0xee5b('0x16'));var db=require(_0xee5b('0x17'))['db'];function respondWithStatusCode(_0x6ffdf,_0x46bad1){_0x46bad1=_0x46bad1||0xcc;return function(_0x2a0498){if(_0x2a0498){return _0x6ffdf[_0xee5b('0x18')](_0x46bad1);}return _0x6ffdf['status'](_0x46bad1)['end']();};}function respondWithResult(_0x3c0325,_0x1b11fd){_0x1b11fd=_0x1b11fd||0xc8;return function(_0x2ef0b6){if(_0x2ef0b6){return _0x3c0325['status'](_0x1b11fd)[_0xee5b('0x19')](_0x2ef0b6);}};}function respondWithFilteredResult(_0x32cd67,_0x5aee8d){return function(_0x4d0ede){if(_0x4d0ede){var _0x50b6ee=typeof _0x5aee8d[_0xee5b('0x1a')]===_0xee5b('0x1b')&&typeof _0x5aee8d[_0xee5b('0x1c')]===_0xee5b('0x1b');var _0x2d0510=_0x4d0ede[_0xee5b('0x1d')];var _0x4464a7=_0x50b6ee?0x0:_0x5aee8d[_0xee5b('0x1a')];var _0x40efa6=_0x50b6ee?_0x4d0ede[_0xee5b('0x1d')]:_0x5aee8d[_0xee5b('0x1a')]+_0x5aee8d[_0xee5b('0x1c')];var _0x47c539;if(_0x40efa6>=_0x2d0510){_0x40efa6=_0x2d0510;_0x47c539=0xc8;}else{_0x47c539=0xce;}_0x32cd67['status'](_0x47c539);return _0x32cd67[_0xee5b('0x1e')](_0xee5b('0x1f'),_0x4464a7+'-'+_0x40efa6+'/'+_0x2d0510)[_0xee5b('0x19')](_0x4d0ede);}return null;};}function patchUpdates(_0x39013a){return function(_0x2aaade){try{jsonpatch[_0xee5b('0x20')](_0x2aaade,_0x39013a,!![]);}catch(_0xb36edf){return BPromise[_0xee5b('0x21')](_0xb36edf);}return _0x2aaade['save']();};}function saveUpdates(_0x589442,_0x40dc2b){return function(_0x39e284){if(_0x39e284){return _0x39e284['update'](_0x589442)[_0xee5b('0x22')](function(_0x2c0ad6){return _0x2c0ad6;});}return null;};}function removeEntity(_0x2ea90a,_0x5625e6){return function(_0x1d2eb9){if(_0x1d2eb9){return _0x1d2eb9[_0xee5b('0x23')]()[_0xee5b('0x22')](function(){_0x2ea90a[_0xee5b('0x24')](0xcc)[_0xee5b('0x25')]();});}};}function handleEntityNotFound(_0x134b77,_0x37364c){return function(_0x42d849){if(!_0x42d849){_0x134b77[_0xee5b('0x18')](0x194);}return _0x42d849;};}function handleError(_0x5d47aa,_0x574bfc){_0x574bfc=_0x574bfc||0x1f4;return function(_0x22963d){logger[_0xee5b('0x26')](_0x22963d['stack']);if(_0x22963d[_0xee5b('0x27')]){delete _0x22963d[_0xee5b('0x27')];}_0x5d47aa[_0xee5b('0x24')](_0x574bfc)['send'](_0x22963d);};}exports[_0xee5b('0x28')]=function(_0x3903b8,_0x4e9ff8){var _0x23803b={},_0x38692c={},_0x28ead2={'count':0x0,'rows':[]};var _0x20d2ab=_['map'](db[_0xee5b('0x29')][_0xee5b('0x2a')],function(_0x3ae5e0){return{'name':_0x3ae5e0['fieldName'],'type':_0x3ae5e0[_0xee5b('0x2b')]['key']};});_0x38692c['model']=_[_0xee5b('0x2c')](_0x20d2ab,_0xee5b('0x27'));_0x38692c[_0xee5b('0x2d')]=_[_0xee5b('0x2e')](_0x3903b8[_0xee5b('0x2d')]);_0x38692c[_0xee5b('0x2f')]=_[_0xee5b('0x30')](_0x38692c[_0xee5b('0x31')],_0x38692c[_0xee5b('0x2d')]);_0x23803b['attributes']=_[_0xee5b('0x30')](_0x38692c[_0xee5b('0x31')],qs[_0xee5b('0x32')](_0x3903b8['query'][_0xee5b('0x32')]));_0x23803b[_0xee5b('0x33')]=_0x23803b[_0xee5b('0x33')][_0xee5b('0x34')]?_0x23803b[_0xee5b('0x33')]:_0x38692c[_0xee5b('0x31')];if(!_0x3903b8[_0xee5b('0x2d')]['hasOwnProperty'](_0xee5b('0x35'))){_0x23803b[_0xee5b('0x1c')]=qs[_0xee5b('0x1c')](_0x3903b8[_0xee5b('0x2d')]['limit']);_0x23803b[_0xee5b('0x1a')]=qs[_0xee5b('0x1a')](_0x3903b8[_0xee5b('0x2d')][_0xee5b('0x1a')]);}_0x23803b['order']=qs[_0xee5b('0x36')](_0x3903b8[_0xee5b('0x2d')][_0xee5b('0x36')]);_0x23803b[_0xee5b('0x37')]=qs[_0xee5b('0x2f')](_['pick'](_0x3903b8[_0xee5b('0x2d')],_0x38692c[_0xee5b('0x2f')]),_0x20d2ab);if(_0x3903b8[_0xee5b('0x2d')]['filter']){_0x23803b[_0xee5b('0x37')]=_['merge'](_0x23803b['where'],{'$or':_[_0xee5b('0x2c')](_0x20d2ab,function(_0x2d00cb){if(_0x2d00cb[_0xee5b('0x2b')]!==_0xee5b('0x38')){var _0x4a6d63={};_0x4a6d63[_0x2d00cb['name']]={'$like':'%'+_0x3903b8['query']['filter']+'%'};return _0x4a6d63;}})});}_0x23803b=_[_0xee5b('0x39')]({},_0x23803b,_0x3903b8[_0xee5b('0x3a')]);var _0x1af8c3={'where':_0x23803b['where']};return db['Migration'][_0xee5b('0x1d')](_0x1af8c3)['then'](function(_0x173e40){_0x28ead2[_0xee5b('0x1d')]=_0x173e40;if(_0x3903b8[_0xee5b('0x2d')]['includeAll']){_0x23803b[_0xee5b('0x3b')]=[{'all':!![]}];}return db[_0xee5b('0x29')][_0xee5b('0x3c')](_0x23803b);})[_0xee5b('0x22')](function(_0x419ffe){_0x28ead2[_0xee5b('0x3d')]=_0x419ffe;return _0x28ead2;})[_0xee5b('0x22')](respondWithFilteredResult(_0x4e9ff8,_0x23803b))[_0xee5b('0x3e')](handleError(_0x4e9ff8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 181faea..57f4d6d 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 _0x9863=['path','rimraf','./migration.attributes','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33e10b,_0x173a8c){var _0x58bb2b=function(_0x5c802b){while(--_0x5c802b){_0x33e10b['push'](_0x33e10b['shift']());}};_0x58bb2b(++_0x173a8c);}(_0x9863,0xf0));var _0x3986=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9863[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3986('0x0'));var util=require(_0x3986('0x1'));var logger=require(_0x3986('0x2'))(_0x3986('0x3'));var moment=require(_0x3986('0x4'));var BPromise=require(_0x3986('0x5'));var rp=require(_0x3986('0x6'));var fs=require('fs');var path=require(_0x3986('0x7'));var rimraf=require(_0x3986('0x8'));var config=require('../../config/environment');var attributes=require(_0x3986('0x9'));module['exports']=function(_0x27cba0,_0x320cee){return _0x27cba0[_0x3986('0xa')](_0x3986('0xb'),attributes,{'tableName':_0x3986('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ad=['./migration.attributes','exports','define','Migration','lodash','moment','path','rimraf','../../config/environment'];(function(_0x33e9b7,_0x362f1a){var _0xaf3268=function(_0x3f1f5a){while(--_0x3f1f5a){_0x33e9b7['push'](_0x33e9b7['shift']());}};_0xaf3268(++_0x362f1a);}(_0xb7ad,0xdc));var _0xdb7a=function(_0xa5e74,_0x24cb66){_0xa5e74=_0xa5e74-0x0;var _0x562c17=_0xb7ad[_0xa5e74];return _0x562c17;};'use strict';var _=require(_0xdb7a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdb7a('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb7a('0x2'));var rimraf=require(_0xdb7a('0x3'));var config=require(_0xdb7a('0x4'));var attributes=require(_0xdb7a('0x5'));module[_0xdb7a('0x6')]=function(_0x5a31db,_0x23c30d){return _0x5a31db[_0xdb7a('0x7')](_0xdb7a('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 844b49f..0710578 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 _0xcbe1=['then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x444d9e,_0x2b0cc8){var _0xdf2331=function(_0x484ae7){while(--_0x484ae7){_0x444d9e['push'](_0x444d9e['shift']());}};_0xdf2331(++_0x2b0cc8);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x173f79,_0x3b2224){_0x173f79=_0x173f79-0x0;var _0x59ce8c=_0xcbe1[_0x173f79];return _0x59ce8c;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cbe('0x1'))['db'];var utils=require(_0x1cbe('0x2'));var logger=require('../../config/logger')(_0x1cbe('0x3'));var config=require('../../config/environment');var jayson=require(_0x1cbe('0x4'));var client=jayson[_0x1cbe('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a02c7,_0x21342a,_0x3882e1){return new BPromise(function(_0x18e76b,_0x21b2a5){return client[_0x1cbe('0x6')](_0x1a02c7,_0x3882e1)[_0x1cbe('0x7')](function(_0x42232d){logger['info'](_0x1cbe('0x8'),_0x21342a,'request\x20sent');logger[_0x1cbe('0x9')](_0x1cbe('0xa'),_0x21342a,_0x1cbe('0xb'),JSON[_0x1cbe('0xc')](_0x42232d));if(_0x42232d['error']){if(_0x42232d[_0x1cbe('0xd')]['code']===0x1f4){logger[_0x1cbe('0xd')](_0x1cbe('0x8'),_0x21342a,_0x42232d['error'][_0x1cbe('0xe')]);return _0x21b2a5(_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);}logger['error'](_0x1cbe('0x8'),_0x21342a,_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);return _0x18e76b(_0x42232d[_0x1cbe('0xd')][_0x1cbe('0xe')]);}else{logger[_0x1cbe('0xf')](_0x1cbe('0x8'),_0x21342a,_0x1cbe('0xb'));_0x18e76b(_0x42232d[_0x1cbe('0x10')][_0x1cbe('0xe')]);}})['catch'](function(_0x228488){logger[_0x1cbe('0xd')](_0x1cbe('0x8'),_0x21342a,_0x228488);_0x21b2a5(_0x228488);});});} \ No newline at end of file +var _0x85cf=['jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x283779,_0x1563e0){var _0x5b04b6=function(_0x4bbf57){while(--_0x4bbf57){_0x283779['push'](_0x283779['shift']());}};_0x5b04b6(++_0x1563e0);}(_0x85cf,0x76));var _0xf85c=function(_0x269053,_0x4b998c){_0x269053=_0x269053-0x0;var _0x47f54e=_0x85cf[_0x269053];return _0x47f54e;};'use strict';var _=require('lodash');var util=require(_0xf85c('0x0'));var moment=require(_0xf85c('0x1'));var BPromise=require(_0xf85c('0x2'));var rs=require(_0xf85c('0x3'));var fs=require('fs');var Redis=require(_0xf85c('0x4'));var db=require(_0xf85c('0x5'))['db'];var utils=require(_0xf85c('0x6'));var logger=require(_0xf85c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf85c('0x8'));var client=jayson[_0xf85c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x386a60,_0x41d08d,_0xe1be83){return new BPromise(function(_0x1bebcf,_0x1857d9){return client[_0xf85c('0xa')](_0x386a60,_0xe1be83)['then'](function(_0x25aa6e){logger[_0xf85c('0xb')]('Migration,\x20%s,\x20%s',_0x41d08d,'request\x20sent');logger[_0xf85c('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x41d08d,_0xf85c('0xd'),JSON[_0xf85c('0xe')](_0x25aa6e));if(_0x25aa6e[_0xf85c('0xf')]){if(_0x25aa6e['error'][_0xf85c('0x10')]===0x1f4){logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x25aa6e[_0xf85c('0xf')]['message']);return _0x1857d9(_0x25aa6e[_0xf85c('0xf')][_0xf85c('0x12')]);}logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x25aa6e['error'][_0xf85c('0x12')]);return _0x1bebcf(_0x25aa6e['error'][_0xf85c('0x12')]);}else{logger['info'](_0xf85c('0x11'),_0x41d08d,'request\x20sent');_0x1bebcf(_0x25aa6e[_0xf85c('0x13')]['message']);}})[_0xf85c('0x14')](function(_0x30b768){logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x30b768);_0x1857d9(_0x30b768);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 4dc177a..51f511e 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 _0x86be=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','create','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3f37c8,_0x2de1ad){var _0x1c3bc2=function(_0x45caf0){while(--_0x45caf0){_0x3f37c8['push'](_0x3f37c8['shift']());}};_0x1c3bc2(++_0x2de1ad);}(_0x86be,0x176));var _0xe86b=function(_0x54e3b7,_0x1fc018){_0x54e3b7=_0x54e3b7-0x0;var _0x5e39c2=_0x86be[_0x54e3b7];return _0x5e39c2;};'use strict';var multer=require(_0xe86b('0x0'));var util=require('util');var path=require(_0xe86b('0x1'));var timeout=require(_0xe86b('0x2'));var express=require(_0xe86b('0x3'));var router=express[_0xe86b('0x4')]();var fs_extra=require(_0xe86b('0x5'));var auth=require(_0xe86b('0x6'));var interaction=require(_0xe86b('0x7'));var config=require(_0xe86b('0x8'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe86b('0x9')]);router[_0xe86b('0xa')](_0xe86b('0xb'),auth[_0xe86b('0xc')](),controller['show']);router[_0xe86b('0xd')]('/',auth[_0xe86b('0xc')](),controller[_0xe86b('0xe')]);router['put'](_0xe86b('0xb'),auth[_0xe86b('0xc')](),controller[_0xe86b('0xf')]);router['delete'](_0xe86b('0xb'),auth[_0xe86b('0xc')](),controller[_0xe86b('0x10')]);module[_0xe86b('0x11')]=router; \ No newline at end of file +var _0x5a9e=['/:id','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated','create','put','update'];(function(_0x2b27ab,_0x2f6584){var _0xe7458f=function(_0x50b662){while(--_0x50b662){_0x2b27ab['push'](_0x2b27ab['shift']());}};_0xe7458f(++_0x2f6584);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x5a9e[_0x427217];return _0x5b28fb;};'use strict';var multer=require('multer');var util=require(_0xe5a9('0x0'));var path=require(_0xe5a9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe5a9('0x2')]();var fs_extra=require(_0xe5a9('0x3'));var auth=require(_0xe5a9('0x4'));var interaction=require(_0xe5a9('0x5'));var config=require(_0xe5a9('0x6'));var controller=require('./network.controller');router[_0xe5a9('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5a9('0x8')]);router[_0xe5a9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe5a9('0x9')]);router[_0xe5a9('0xa')]('/',auth[_0xe5a9('0xb')](),controller[_0xe5a9('0xc')]);router[_0xe5a9('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe5a9('0xe')]);router['delete'](_0xe5a9('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xe5a9('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 99f7acd..3a5b356 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 _0xeba1=['localnet','externip','stun','STRING','sequelize'];(function(_0x4280f0,_0x58ab10){var _0x305f25=function(_0x505e40){while(--_0x505e40){_0x4280f0['push'](_0x4280f0['shift']());}};_0x305f25(++_0x58ab10);}(_0xeba1,0x10d));var _0x1eba=function(_0x587dec,_0x3abea7){_0x587dec=_0x587dec-0x0;var _0x5f4d2e=_0xeba1[_0x587dec];return _0x5f4d2e;};'use strict';var Sequelize=require(_0x1eba('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1eba('0x1'),_0x1eba('0x2'),_0x1eba('0x3'),'turn')},'value':{'type':Sequelize[_0x1eba('0x4')]},'username':{'type':Sequelize[_0x1eba('0x4')]},'password':{'type':Sequelize[_0x1eba('0x4')]}}; \ No newline at end of file +var _0x4762=['turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4762,0x74));var _0x2476=function(_0x40f6d9,_0x286c56){_0x40f6d9=_0x40f6d9-0x0;var _0x58884=_0x4762[_0x40f6d9];return _0x58884;};'use strict';var Sequelize=require(_0x2476('0x0'));module[_0x2476('0x1')]={'type':{'type':Sequelize[_0x2476('0x2')]('localnet',_0x2476('0x3'),'stun',_0x2476('0x4'))},'value':{'type':Sequelize[_0x2476('0x5')]},'username':{'type':Sequelize[_0x2476('0x5')]},'password':{'type':Sequelize[_0x2476('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 72b3c8a..40b408c 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 _0xbb31=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xbb31,0x18a));var _0x1bb3=function(_0x47ae0e,_0x250906){_0x47ae0e=_0x47ae0e-0x0;var _0x997b0e=_0xbb31[_0x47ae0e];return _0x997b0e;};'use strict';var util=require('util');var path=require(_0x1bb3('0x0'));var ejs=require(_0x1bb3('0x1'));var fs=require('fs');var _=require(_0x1bb3('0x2'));var qs=require(_0x1bb3('0x3'));var logger=require(_0x1bb3('0x4'))(_0x1bb3('0x5'));var config=require('../../config/environment');var db=require(_0x1bb3('0x6'))['db'];var jayson=require(_0x1bb3('0x7'));var client=jayson[_0x1bb3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcc8cc0,_0x53e36b,_0x57ae00,_0x4a1997){return new Promise(function(_0x9a365c,_0xfc330a){var _0x41f64e=_0x4a1997||client;return _0x41f64e[_0x1bb3('0x9')](_0xcc8cc0,_0x57ae00)[_0x1bb3('0xa')](function(_0x28446f){logger[_0x1bb3('0xb')](_0x1bb3('0xc'),_0x53e36b,_0x1bb3('0xd'));logger[_0x1bb3('0xe')](_0x1bb3('0xf'),_0x53e36b,_0x1bb3('0xd'),JSON[_0x1bb3('0x10')](_0x28446f));if(_0x28446f[_0x1bb3('0x11')]){if(_0x28446f[_0x1bb3('0x11')][_0x1bb3('0x12')]===0x1f4){logger[_0x1bb3('0x11')](_0x1bb3('0xc'),_0x53e36b,_0x28446f['error'][_0x1bb3('0x13')]);return _0xfc330a(_0x28446f['error'][_0x1bb3('0x13')]);}logger['error'](_0x1bb3('0xc'),_0x53e36b,_0x28446f[_0x1bb3('0x11')][_0x1bb3('0x13')]);return _0x9a365c(_0x28446f['error'][_0x1bb3('0x13')]);}else{logger[_0x1bb3('0xb')](_0x1bb3('0xc'),_0x53e36b,'request\x20sent');_0x9a365c(_0x28446f[_0x1bb3('0x14')]['message']);}})[_0x1bb3('0x15')](function(_0x331e6b){logger[_0x1bb3('0x11')]('Network,\x20%s,\x20%s',_0x53e36b,_0x331e6b);_0xfc330a(_0x331e6b);});});}function respondWithResult(_0x750a5a,_0x2bbc71){_0x2bbc71=_0x2bbc71||0xc8;return function(_0x28bff1){if(_0x28bff1){return _0x750a5a[_0x1bb3('0x16')](_0x2bbc71)[_0x1bb3('0x17')](_0x28bff1);}};}function respondWithFilteredResult(_0x6aca66,_0x14c8b3){return function(_0x30b854){if(_0x30b854){var _0x50df5d=typeof _0x14c8b3[_0x1bb3('0x18')]===_0x1bb3('0x19')&&typeof _0x14c8b3[_0x1bb3('0x1a')]===_0x1bb3('0x19');var _0x557aae=_0x30b854[_0x1bb3('0x1b')];var _0x167529=_0x50df5d?0x0:_0x14c8b3[_0x1bb3('0x18')];var _0x3f4862=_0x50df5d?_0x30b854[_0x1bb3('0x1b')]:_0x14c8b3[_0x1bb3('0x18')]+_0x14c8b3[_0x1bb3('0x1a')];var _0x2d0ef8;if(_0x3f4862>=_0x557aae){_0x3f4862=_0x557aae;_0x2d0ef8=0xc8;}else{_0x2d0ef8=0xce;}_0x6aca66[_0x1bb3('0x16')](_0x2d0ef8);return _0x6aca66[_0x1bb3('0x1c')](_0x1bb3('0x1d'),_0x167529+'-'+_0x3f4862+'/'+_0x557aae)['json'](_0x30b854);}return null;};}function saveUpdates(_0x4393f8){return function(_0x41004f){if(_0x41004f){return _0x41004f[_0x1bb3('0x1e')](_0x4393f8)[_0x1bb3('0xa')](function(_0x5b6b63){return _0x5b6b63;});}return null;};}function removeEntity(_0x2f9552){return function(_0x295ef2){if(_0x295ef2){return _0x295ef2[_0x1bb3('0x1f')]()['then'](function(){_0x2f9552[_0x1bb3('0x16')](0xcc)[_0x1bb3('0x20')]();});}};}function handleEntityNotFound(_0x201d4a){return function(_0x1c9b80){if(!_0x1c9b80){_0x201d4a['sendStatus'](0x194);}return _0x1c9b80;};}function handleError(_0xcbc0e0,_0x3ea2e2){_0x3ea2e2=_0x3ea2e2||0x1f4;return function(_0x148a7b){logger[_0x1bb3('0x11')](_0x148a7b[_0x1bb3('0x21')]);if(_0x148a7b['name']){delete _0x148a7b[_0x1bb3('0x22')];}_0xcbc0e0['status'](_0x3ea2e2)[_0x1bb3('0x23')](_0x148a7b);};}exports[_0x1bb3('0x24')]=function(_0x4df656,_0x44ad6f){var _0x367f7d={},_0x3c3803={},_0x427552={'count':0x0,'rows':[]};var _0x48d0fc=_['map'](db[_0x1bb3('0x25')][_0x1bb3('0x26')],function(_0x2a0c0f){return{'name':_0x2a0c0f[_0x1bb3('0x27')],'type':_0x2a0c0f[_0x1bb3('0x28')][_0x1bb3('0x29')]};});_0x3c3803[_0x1bb3('0x2a')]=_[_0x1bb3('0x2b')](_0x48d0fc,_0x1bb3('0x22'));_0x3c3803[_0x1bb3('0x2c')]=_[_0x1bb3('0x2d')](_0x4df656['query']);_0x3c3803[_0x1bb3('0x2e')]=_['intersection'](_0x3c3803[_0x1bb3('0x2a')],_0x3c3803[_0x1bb3('0x2c')]);_0x367f7d[_0x1bb3('0x2f')]=_[_0x1bb3('0x30')](_0x3c3803[_0x1bb3('0x2a')],qs[_0x1bb3('0x31')](_0x4df656['query'][_0x1bb3('0x31')]));_0x367f7d[_0x1bb3('0x2f')]=_0x367f7d[_0x1bb3('0x2f')][_0x1bb3('0x32')]?_0x367f7d[_0x1bb3('0x2f')]:_0x3c3803['model'];if(!_0x4df656[_0x1bb3('0x2c')][_0x1bb3('0x33')](_0x1bb3('0x34'))){_0x367f7d[_0x1bb3('0x1a')]=qs[_0x1bb3('0x1a')](_0x4df656[_0x1bb3('0x2c')][_0x1bb3('0x1a')]);_0x367f7d['offset']=qs[_0x1bb3('0x18')](_0x4df656[_0x1bb3('0x2c')][_0x1bb3('0x18')]);}_0x367f7d[_0x1bb3('0x35')]=qs['sort'](_0x4df656[_0x1bb3('0x2c')][_0x1bb3('0x36')]);_0x367f7d[_0x1bb3('0x37')]=qs[_0x1bb3('0x2e')](_[_0x1bb3('0x38')](_0x4df656[_0x1bb3('0x2c')],_0x3c3803[_0x1bb3('0x2e')]),_0x48d0fc);if(_0x4df656['query'][_0x1bb3('0x39')]){_0x367f7d[_0x1bb3('0x37')]=_[_0x1bb3('0x3a')](_0x367f7d['where'],{'$or':_['map'](_0x48d0fc,function(_0x116155){if(_0x116155[_0x1bb3('0x28')]!==_0x1bb3('0x3b')){var _0x7b1bd8={};_0x7b1bd8[_0x116155[_0x1bb3('0x22')]]={'$like':'%'+_0x4df656[_0x1bb3('0x2c')][_0x1bb3('0x39')]+'%'};return _0x7b1bd8;}})});}_0x367f7d=_[_0x1bb3('0x3a')]({},_0x367f7d,_0x4df656[_0x1bb3('0x3c')]);var _0x4932f2={'where':_0x367f7d[_0x1bb3('0x37')]};return db['Network'][_0x1bb3('0x1b')](_0x4932f2)[_0x1bb3('0xa')](function(_0x4002c8){_0x427552[_0x1bb3('0x1b')]=_0x4002c8;if(_0x4df656[_0x1bb3('0x2c')][_0x1bb3('0x3d')]){_0x367f7d[_0x1bb3('0x3e')]=[{'all':!![]}];}return db[_0x1bb3('0x25')][_0x1bb3('0x3f')](_0x367f7d);})[_0x1bb3('0xa')](function(_0x44827f){_0x427552[_0x1bb3('0x40')]=_0x44827f;return _0x427552;})[_0x1bb3('0xa')](respondWithFilteredResult(_0x44ad6f,_0x367f7d))[_0x1bb3('0x15')](handleError(_0x44ad6f,null));};exports[_0x1bb3('0x41')]=function(_0x2a1c73,_0x348ee4){var _0x475ecc={'raw':!![],'where':{'id':_0x2a1c73[_0x1bb3('0x42')]['id']}},_0x564369={};_0x564369[_0x1bb3('0x2a')]=_[_0x1bb3('0x2d')](db[_0x1bb3('0x25')][_0x1bb3('0x26')]);_0x564369[_0x1bb3('0x2c')]=_['keys'](_0x2a1c73[_0x1bb3('0x2c')]);_0x564369[_0x1bb3('0x2e')]=_['intersection'](_0x564369['model'],_0x564369[_0x1bb3('0x2c')]);_0x475ecc['attributes']=_[_0x1bb3('0x30')](_0x564369['model'],qs[_0x1bb3('0x31')](_0x2a1c73[_0x1bb3('0x2c')][_0x1bb3('0x31')]));_0x475ecc[_0x1bb3('0x2f')]=_0x475ecc['attributes']['length']?_0x475ecc[_0x1bb3('0x2f')]:_0x564369[_0x1bb3('0x2a')];if(_0x2a1c73[_0x1bb3('0x2c')][_0x1bb3('0x3d')]){_0x475ecc['include']=[{'all':!![]}];}_0x475ecc=_[_0x1bb3('0x3a')]({},_0x475ecc,_0x2a1c73['options']);return db[_0x1bb3('0x25')][_0x1bb3('0x43')](_0x475ecc)[_0x1bb3('0xa')](handleEntityNotFound(_0x348ee4,null))[_0x1bb3('0xa')](respondWithResult(_0x348ee4,null))[_0x1bb3('0x15')](handleError(_0x348ee4,null));};exports[_0x1bb3('0x44')]=function(_0x511a3c,_0x547d80){var _0x1bbad0;return db[_0x1bb3('0x25')][_0x1bb3('0x44')](_0x511a3c[_0x1bb3('0x45')],{'raw':!![]})[_0x1bb3('0xa')](function(_0x21cce1){_0x1bbad0=_0x21cce1;return db[_0x1bb3('0x25')][_0x1bb3('0x3f')]({'where':{'type':_0x511a3c[_0x1bb3('0x45')]['type']},'raw':!![]});})[_0x1bb3('0xa')](function(_0x81dc8f){if(_0x1bbad0[_0x1bb3('0x28')]['toUpperCase']()==_0x1bb3('0x46')){var _0x579409=fs[_0x1bb3('0x47')](path[_0x1bb3('0x48')](config[_0x1bb3('0x49')],_0x1bb3('0x4a')),_0x1bb3('0x4b'));var _0x1c060c=ejs[_0x1bb3('0x4c')](_0x579409,{'networks':_0x81dc8f||[]});fs[_0x1bb3('0x4d')](_0x1bb3('0x4e'),_0x1c060c);return respondWithRpcPromise(_0x1bb3('0x4f'),_0x1bb3('0x44'),{'module':_0x1bb3('0x50')});}else if(_0x1bbad0[_0x1bb3('0x28')][_0x1bb3('0x51')]()==_0x1bb3('0x52')){var _0x400093=fs[_0x1bb3('0x47')](path[_0x1bb3('0x48')](config['root'],_0x1bb3('0x53')),'utf8');var _0x164b24=ejs[_0x1bb3('0x4c')](_0x400093,{'networks':_0x81dc8f||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x164b24);return respondWithRpcPromise(_0x1bb3('0x4f'),_0x1bb3('0x44'),{'module':_0x1bb3('0x50')});}else{var _0x54d29b=fs[_0x1bb3('0x47')](path[_0x1bb3('0x48')](config[_0x1bb3('0x49')],_0x1bb3('0x54')),_0x1bb3('0x4b'));var _0x4137e4=ejs['render'](_0x54d29b,{'networks':_0x81dc8f||[]});fs[_0x1bb3('0x4d')](util[_0x1bb3('0x55')]('/etc/asterisk/sip_xcally_%s.conf',_0x511a3c[_0x1bb3('0x45')]['type'][_0x1bb3('0x56')]()),_0x4137e4);return respondWithRpcPromise(_0x1bb3('0x4f'),_0x1bb3('0x44'),{'module':_0x1bb3('0x57')});}})[_0x1bb3('0xa')](function(){return _0x1bbad0;})[_0x1bb3('0xa')](respondWithResult(_0x547d80,0xc9))[_0x1bb3('0x15')](handleError(_0x547d80,null));};exports[_0x1bb3('0x1e')]=function(_0x433f84,_0x585acb){var _0x8fddb2;return db['Network'][_0x1bb3('0x43')]({'where':{'id':_0x433f84[_0x1bb3('0x42')]['id']}})[_0x1bb3('0xa')](handleEntityNotFound(_0x585acb,null))[_0x1bb3('0xa')](saveUpdates(_0x433f84[_0x1bb3('0x45')],null))['then'](function(_0x5cfabe){if(_0x5cfabe){_0x8fddb2=_0x5cfabe;return db[_0x1bb3('0x25')][_0x1bb3('0x3f')]({'where':{'type':_0x8fddb2['type']},'raw':!![]});}return null;})[_0x1bb3('0xa')](function(_0x19e9af){if(_0x8fddb2[_0x1bb3('0x28')][_0x1bb3('0x51')]()=='STUN'){var _0x203fe2=fs['readFileSync'](path[_0x1bb3('0x48')](config[_0x1bb3('0x49')],_0x1bb3('0x4a')),_0x1bb3('0x4b'));var _0x453456=ejs[_0x1bb3('0x4c')](_0x203fe2,{'networks':_0x19e9af||[]});fs['writeFileSync'](_0x1bb3('0x4e'),_0x453456);return respondWithRpcPromise('Reload',_0x1bb3('0x1e'),{'module':_0x1bb3('0x50')});}else if(_0x8fddb2[_0x1bb3('0x28')][_0x1bb3('0x51')]()==_0x1bb3('0x52')){var _0x3d5f88=fs[_0x1bb3('0x47')](path[_0x1bb3('0x48')](config[_0x1bb3('0x49')],_0x1bb3('0x53')),_0x1bb3('0x4b'));var _0x1746f4=ejs['render'](_0x3d5f88,{'networks':_0x19e9af||[]});fs[_0x1bb3('0x4d')](_0x1bb3('0x58'),_0x1746f4);return respondWithRpcPromise(_0x1bb3('0x4f'),_0x1bb3('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x4a127a=fs[_0x1bb3('0x47')](path['join'](config[_0x1bb3('0x49')],_0x1bb3('0x54')),_0x1bb3('0x4b'));var _0x4a654c=ejs[_0x1bb3('0x4c')](_0x4a127a,{'networks':_0x19e9af||[]});fs[_0x1bb3('0x4d')](util[_0x1bb3('0x55')](_0x1bb3('0x59'),_0x433f84[_0x1bb3('0x45')]['type'][_0x1bb3('0x56')]()),_0x4a654c);return respondWithRpcPromise(_0x1bb3('0x4f'),'update',{'module':_0x1bb3('0x57')});}})[_0x1bb3('0xa')](function(_0x71dab9){if(_0x71dab9){return _0x8fddb2;}return null;})[_0x1bb3('0xa')](respondWithResult(_0x585acb,null))[_0x1bb3('0x15')](handleError(_0x585acb,null));};exports[_0x1bb3('0x1f')]=function(_0x133e04,_0xfc84dc){var _0x2f8fad;return db[_0x1bb3('0x25')][_0x1bb3('0x43')]({'where':{'id':_0x133e04[_0x1bb3('0x42')]['id']}})[_0x1bb3('0xa')](function(_0x2e6e09){_0x2f8fad=_0x2e6e09;return _0x2e6e09;})['then'](handleEntityNotFound(_0xfc84dc,null))[_0x1bb3('0xa')](removeEntity(_0xfc84dc,null))[_0x1bb3('0xa')](function(){if(_0x2f8fad){return db['Network'][_0x1bb3('0x3f')]({'where':{'type':_0x2f8fad[_0x1bb3('0x28')]},'raw':!![]});}})['then'](function(_0x52f243){if(_0x2f8fad[_0x1bb3('0x28')][_0x1bb3('0x51')]()==_0x1bb3('0x46')){var _0x1d95c3=fs[_0x1bb3('0x47')](path[_0x1bb3('0x48')](config[_0x1bb3('0x49')],_0x1bb3('0x4a')),_0x1bb3('0x4b'));var _0x9a21cc=ejs['render'](_0x1d95c3,{'networks':_0x52f243||[]});fs[_0x1bb3('0x4d')](_0x1bb3('0x4e'),_0x9a21cc);return respondWithRpcPromise(_0x1bb3('0x4f'),_0x1bb3('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x2f8fad[_0x1bb3('0x28')][_0x1bb3('0x51')]()==_0x1bb3('0x52')){var _0x51ceaa=fs['readFileSync'](path['join'](config[_0x1bb3('0x49')],'server/files/templates/turn_multiple.ejs'),_0x1bb3('0x4b'));var _0x4bdb0e=ejs[_0x1bb3('0x4c')](_0x51ceaa,{'networks':_0x52f243||[]});fs[_0x1bb3('0x4d')](_0x1bb3('0x58'),_0x4bdb0e);return respondWithRpcPromise(_0x1bb3('0x4f'),_0x1bb3('0x1f'),{'module':_0x1bb3('0x50')});}else{var _0x2fae18=fs[_0x1bb3('0x47')](path[_0x1bb3('0x48')](config[_0x1bb3('0x49')],'server/files/templates/network.ejs'),_0x1bb3('0x4b'));var _0x132edb=ejs['render'](_0x2fae18,{'networks':_0x52f243||[]});fs[_0x1bb3('0x4d')](util[_0x1bb3('0x55')]('/etc/asterisk/sip_xcally_%s.conf',_0x2f8fad[_0x1bb3('0x28')]['toLowerCase']()),_0x132edb);return respondWithRpcPromise('Reload','destroy',{'module':_0x1bb3('0x57')});}})[_0x1bb3('0x15')](handleError(_0xfc84dc,null));}; \ No newline at end of file +var _0xabd9=['message','catch','status','json','undefined','count','offset','set','update','sendStatus','stack','name','send','map','Network','type','key','model','filters','intersection','query','attributes','fields','length','limit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','rawAttributes','includeAll','find','create','body','toUpperCase','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','server/files/templates/turn_multiple.ejs','format','toLowerCase','destroy','TURN','path','ejs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabd9,0x127));var _0x9abd=function(_0x5d3e8e,_0x42274b){_0x5d3e8e=_0x5d3e8e-0x0;var _0x3d2e2a=_0xabd9[_0x5d3e8e];return _0x3d2e2a;};'use strict';var util=require('util');var path=require(_0x9abd('0x0'));var ejs=require(_0x9abd('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9abd('0x2'));var config=require(_0x9abd('0x3'));var db=require(_0x9abd('0x4'))['db'];var jayson=require(_0x9abd('0x5'));var client=jayson[_0x9abd('0x6')][_0x9abd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15f1e3,_0x30357d,_0x551794,_0x29fc2f){return new Promise(function(_0x53cc92,_0x20a719){var _0x43c75b=_0x29fc2f||client;return _0x43c75b[_0x9abd('0x8')](_0x15f1e3,_0x551794)[_0x9abd('0x9')](function(_0x52e0c1){logger[_0x9abd('0xa')](_0x9abd('0xb'),_0x30357d,_0x9abd('0xc'));logger[_0x9abd('0xd')](_0x9abd('0xe'),_0x30357d,_0x9abd('0xc'),JSON['stringify'](_0x52e0c1));if(_0x52e0c1[_0x9abd('0xf')]){if(_0x52e0c1[_0x9abd('0xf')][_0x9abd('0x10')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x30357d,_0x52e0c1[_0x9abd('0xf')][_0x9abd('0x11')]);return _0x20a719(_0x52e0c1['error'][_0x9abd('0x11')]);}logger[_0x9abd('0xf')](_0x9abd('0xb'),_0x30357d,_0x52e0c1[_0x9abd('0xf')][_0x9abd('0x11')]);return _0x53cc92(_0x52e0c1[_0x9abd('0xf')][_0x9abd('0x11')]);}else{logger[_0x9abd('0xa')](_0x9abd('0xb'),_0x30357d,_0x9abd('0xc'));_0x53cc92(_0x52e0c1['result'][_0x9abd('0x11')]);}})[_0x9abd('0x12')](function(_0x5615b1){logger['error'](_0x9abd('0xb'),_0x30357d,_0x5615b1);_0x20a719(_0x5615b1);});});}function respondWithResult(_0x55158b,_0x213fd5){_0x213fd5=_0x213fd5||0xc8;return function(_0x524390){if(_0x524390){return _0x55158b[_0x9abd('0x13')](_0x213fd5)[_0x9abd('0x14')](_0x524390);}};}function respondWithFilteredResult(_0x556741,_0x286541){return function(_0xaf58bf){if(_0xaf58bf){var _0x16da85=typeof _0x286541['offset']==='undefined'&&typeof _0x286541['limit']===_0x9abd('0x15');var _0x525ff2=_0xaf58bf['count'];var _0x3ffbf7=_0x16da85?0x0:_0x286541['offset'];var _0x228e5d=_0x16da85?_0xaf58bf[_0x9abd('0x16')]:_0x286541[_0x9abd('0x17')]+_0x286541['limit'];var _0xfec250;if(_0x228e5d>=_0x525ff2){_0x228e5d=_0x525ff2;_0xfec250=0xc8;}else{_0xfec250=0xce;}_0x556741[_0x9abd('0x13')](_0xfec250);return _0x556741[_0x9abd('0x18')]('Content-Range',_0x3ffbf7+'-'+_0x228e5d+'/'+_0x525ff2)[_0x9abd('0x14')](_0xaf58bf);}return null;};}function saveUpdates(_0x1424ab){return function(_0x4f653d){if(_0x4f653d){return _0x4f653d[_0x9abd('0x19')](_0x1424ab)['then'](function(_0x1748e9){return _0x1748e9;});}return null;};}function removeEntity(_0x48e9d5){return function(_0x472df8){if(_0x472df8){return _0x472df8['destroy']()[_0x9abd('0x9')](function(){_0x48e9d5[_0x9abd('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c49f){return function(_0x2cf4fa){if(!_0x2cf4fa){_0x18c49f[_0x9abd('0x1a')](0x194);}return _0x2cf4fa;};}function handleError(_0x384344,_0xd59aaf){_0xd59aaf=_0xd59aaf||0x1f4;return function(_0x18418c){logger[_0x9abd('0xf')](_0x18418c[_0x9abd('0x1b')]);if(_0x18418c[_0x9abd('0x1c')]){delete _0x18418c[_0x9abd('0x1c')];}_0x384344[_0x9abd('0x13')](_0xd59aaf)[_0x9abd('0x1d')](_0x18418c);};}exports['index']=function(_0x4b457d,_0x33ebd6){var _0x3ab262={},_0x109e6b={},_0x590f79={'count':0x0,'rows':[]};var _0x107d6a=_[_0x9abd('0x1e')](db[_0x9abd('0x1f')]['rawAttributes'],function(_0x525c9c){return{'name':_0x525c9c['fieldName'],'type':_0x525c9c[_0x9abd('0x20')][_0x9abd('0x21')]};});_0x109e6b[_0x9abd('0x22')]=_[_0x9abd('0x1e')](_0x107d6a,'name');_0x109e6b['query']=_['keys'](_0x4b457d['query']);_0x109e6b[_0x9abd('0x23')]=_[_0x9abd('0x24')](_0x109e6b['model'],_0x109e6b[_0x9abd('0x25')]);_0x3ab262[_0x9abd('0x26')]=_['intersection'](_0x109e6b[_0x9abd('0x22')],qs[_0x9abd('0x27')](_0x4b457d[_0x9abd('0x25')][_0x9abd('0x27')]));_0x3ab262[_0x9abd('0x26')]=_0x3ab262[_0x9abd('0x26')][_0x9abd('0x28')]?_0x3ab262[_0x9abd('0x26')]:_0x109e6b['model'];if(!_0x4b457d[_0x9abd('0x25')]['hasOwnProperty']('nolimit')){_0x3ab262['limit']=qs['limit'](_0x4b457d[_0x9abd('0x25')][_0x9abd('0x29')]);_0x3ab262['offset']=qs[_0x9abd('0x17')](_0x4b457d[_0x9abd('0x25')]['offset']);}_0x3ab262[_0x9abd('0x2a')]=qs[_0x9abd('0x2b')](_0x4b457d[_0x9abd('0x25')][_0x9abd('0x2b')]);_0x3ab262[_0x9abd('0x2c')]=qs['filters'](_[_0x9abd('0x2d')](_0x4b457d[_0x9abd('0x25')],_0x109e6b[_0x9abd('0x23')]),_0x107d6a);if(_0x4b457d[_0x9abd('0x25')][_0x9abd('0x2e')]){_0x3ab262['where']=_[_0x9abd('0x2f')](_0x3ab262[_0x9abd('0x2c')],{'$or':_['map'](_0x107d6a,function(_0x27838a){if(_0x27838a['type']!=='VIRTUAL'){var _0x363568={};_0x363568[_0x27838a['name']]={'$like':'%'+_0x4b457d[_0x9abd('0x25')][_0x9abd('0x2e')]+'%'};return _0x363568;}})});}_0x3ab262=_[_0x9abd('0x2f')]({},_0x3ab262,_0x4b457d[_0x9abd('0x30')]);var _0xf6305={'where':_0x3ab262[_0x9abd('0x2c')]};return db[_0x9abd('0x1f')][_0x9abd('0x16')](_0xf6305)[_0x9abd('0x9')](function(_0x3b26f8){_0x590f79[_0x9abd('0x16')]=_0x3b26f8;if(_0x4b457d[_0x9abd('0x25')]['includeAll']){_0x3ab262[_0x9abd('0x31')]=[{'all':!![]}];}return db[_0x9abd('0x1f')][_0x9abd('0x32')](_0x3ab262);})[_0x9abd('0x9')](function(_0x1ffc40){_0x590f79['rows']=_0x1ffc40;return _0x590f79;})['then'](respondWithFilteredResult(_0x33ebd6,_0x3ab262))[_0x9abd('0x12')](handleError(_0x33ebd6,null));};exports[_0x9abd('0x33')]=function(_0x435683,_0x78f0c6){var _0x5de23a={'raw':!![],'where':{'id':_0x435683[_0x9abd('0x34')]['id']}},_0x1f4c29={};_0x1f4c29[_0x9abd('0x22')]=_['keys'](db[_0x9abd('0x1f')][_0x9abd('0x35')]);_0x1f4c29['query']=_['keys'](_0x435683[_0x9abd('0x25')]);_0x1f4c29[_0x9abd('0x23')]=_[_0x9abd('0x24')](_0x1f4c29[_0x9abd('0x22')],_0x1f4c29[_0x9abd('0x25')]);_0x5de23a[_0x9abd('0x26')]=_[_0x9abd('0x24')](_0x1f4c29['model'],qs[_0x9abd('0x27')](_0x435683['query'][_0x9abd('0x27')]));_0x5de23a[_0x9abd('0x26')]=_0x5de23a[_0x9abd('0x26')][_0x9abd('0x28')]?_0x5de23a[_0x9abd('0x26')]:_0x1f4c29['model'];if(_0x435683['query'][_0x9abd('0x36')]){_0x5de23a[_0x9abd('0x31')]=[{'all':!![]}];}_0x5de23a=_['merge']({},_0x5de23a,_0x435683[_0x9abd('0x30')]);return db[_0x9abd('0x1f')][_0x9abd('0x37')](_0x5de23a)[_0x9abd('0x9')](handleEntityNotFound(_0x78f0c6,null))['then'](respondWithResult(_0x78f0c6,null))[_0x9abd('0x12')](handleError(_0x78f0c6,null));};exports[_0x9abd('0x38')]=function(_0x4f9c23,_0x352f81){var _0x47c19b;return db[_0x9abd('0x1f')][_0x9abd('0x38')](_0x4f9c23[_0x9abd('0x39')],{'raw':!![]})[_0x9abd('0x9')](function(_0x1e1e8e){_0x47c19b=_0x1e1e8e;return db[_0x9abd('0x1f')]['findAll']({'where':{'type':_0x4f9c23[_0x9abd('0x39')]['type']},'raw':!![]});})[_0x9abd('0x9')](function(_0xd9226f){if(_0x47c19b['type'][_0x9abd('0x3a')]()=='STUN'){var _0x5144df=fs['readFileSync'](path[_0x9abd('0x3b')](config['root'],_0x9abd('0x3c')),_0x9abd('0x3d'));var _0x3b7860=ejs[_0x9abd('0x3e')](_0x5144df,{'networks':_0xd9226f||[]});fs[_0x9abd('0x3f')](_0x9abd('0x40'),_0x3b7860);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x38'),{'module':_0x9abd('0x42')});}else if(_0x47c19b[_0x9abd('0x20')][_0x9abd('0x3a')]()=='TURN'){var _0x39df13=fs['readFileSync'](path[_0x9abd('0x3b')](config[_0x9abd('0x43')],'server/files/templates/turn_multiple.ejs'),_0x9abd('0x3d'));var _0x5d9292=ejs['render'](_0x39df13,{'networks':_0xd9226f||[]});fs['writeFileSync'](_0x9abd('0x44'),_0x5d9292);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x38'),{'module':_0x9abd('0x42')});}else{var _0x37da39=fs[_0x9abd('0x45')](path[_0x9abd('0x3b')](config[_0x9abd('0x43')],_0x9abd('0x46')),_0x9abd('0x3d'));var _0x593a76=ejs['render'](_0x37da39,{'networks':_0xd9226f||[]});fs[_0x9abd('0x3f')](util['format'](_0x9abd('0x47'),_0x4f9c23[_0x9abd('0x39')]['type']['toLowerCase']()),_0x593a76);return respondWithRpcPromise(_0x9abd('0x41'),'create',{'module':_0x9abd('0x48')});}})[_0x9abd('0x9')](function(){return _0x47c19b;})[_0x9abd('0x9')](respondWithResult(_0x352f81,0xc9))[_0x9abd('0x12')](handleError(_0x352f81,null));};exports['update']=function(_0xa9795,_0x115d3a){var _0xad0926;return db[_0x9abd('0x1f')][_0x9abd('0x37')]({'where':{'id':_0xa9795[_0x9abd('0x34')]['id']}})['then'](handleEntityNotFound(_0x115d3a,null))[_0x9abd('0x9')](saveUpdates(_0xa9795[_0x9abd('0x39')],null))[_0x9abd('0x9')](function(_0x20edae){if(_0x20edae){_0xad0926=_0x20edae;return db[_0x9abd('0x1f')][_0x9abd('0x32')]({'where':{'type':_0xad0926['type']},'raw':!![]});}return null;})['then'](function(_0x27339b){if(_0xad0926[_0x9abd('0x20')][_0x9abd('0x3a')]()=='STUN'){var _0x4cd41d=fs[_0x9abd('0x45')](path[_0x9abd('0x3b')](config[_0x9abd('0x43')],_0x9abd('0x3c')),'utf8');var _0x355ce0=ejs[_0x9abd('0x3e')](_0x4cd41d,{'networks':_0x27339b||[]});fs['writeFileSync'](_0x9abd('0x40'),_0x355ce0);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x19'),{'module':_0x9abd('0x42')});}else if(_0xad0926[_0x9abd('0x20')][_0x9abd('0x3a')]()=='TURN'){var _0x38aebc=fs[_0x9abd('0x45')](path[_0x9abd('0x3b')](config['root'],_0x9abd('0x49')),_0x9abd('0x3d'));var _0x2f4886=ejs[_0x9abd('0x3e')](_0x38aebc,{'networks':_0x27339b||[]});fs[_0x9abd('0x3f')](_0x9abd('0x44'),_0x2f4886);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x158dd7=fs[_0x9abd('0x45')](path[_0x9abd('0x3b')](config[_0x9abd('0x43')],_0x9abd('0x46')),_0x9abd('0x3d'));var _0x479218=ejs[_0x9abd('0x3e')](_0x158dd7,{'networks':_0x27339b||[]});fs[_0x9abd('0x3f')](util[_0x9abd('0x4a')](_0x9abd('0x47'),_0xa9795[_0x9abd('0x39')][_0x9abd('0x20')][_0x9abd('0x4b')]()),_0x479218);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x19'),{'module':_0x9abd('0x48')});}})[_0x9abd('0x9')](function(_0x1c9892){if(_0x1c9892){return _0xad0926;}return null;})[_0x9abd('0x9')](respondWithResult(_0x115d3a,null))['catch'](handleError(_0x115d3a,null));};exports['destroy']=function(_0x162412,_0x1ae141){var _0x48ee70;return db[_0x9abd('0x1f')]['find']({'where':{'id':_0x162412[_0x9abd('0x34')]['id']}})[_0x9abd('0x9')](function(_0x1723ee){_0x48ee70=_0x1723ee;return _0x1723ee;})[_0x9abd('0x9')](handleEntityNotFound(_0x1ae141,null))[_0x9abd('0x9')](removeEntity(_0x1ae141,null))[_0x9abd('0x9')](function(){if(_0x48ee70){return db[_0x9abd('0x1f')][_0x9abd('0x32')]({'where':{'type':_0x48ee70[_0x9abd('0x20')]},'raw':!![]});}})[_0x9abd('0x9')](function(_0x890ad7){if(_0x48ee70[_0x9abd('0x20')][_0x9abd('0x3a')]()=='STUN'){var _0x83c17a=fs[_0x9abd('0x45')](path['join'](config[_0x9abd('0x43')],_0x9abd('0x3c')),'utf8');var _0x19c533=ejs[_0x9abd('0x3e')](_0x83c17a,{'networks':_0x890ad7||[]});fs[_0x9abd('0x3f')](_0x9abd('0x40'),_0x19c533);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x4c'),{'module':_0x9abd('0x42')});}else if(_0x48ee70[_0x9abd('0x20')][_0x9abd('0x3a')]()==_0x9abd('0x4d')){var _0x1bbfdc=fs[_0x9abd('0x45')](path[_0x9abd('0x3b')](config[_0x9abd('0x43')],_0x9abd('0x49')),_0x9abd('0x3d'));var _0x1a8622=ejs[_0x9abd('0x3e')](_0x1bbfdc,{'networks':_0x890ad7||[]});fs[_0x9abd('0x3f')](_0x9abd('0x44'),_0x1a8622);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x4c'),{'module':_0x9abd('0x42')});}else{var _0x42ed8a=fs[_0x9abd('0x45')](path[_0x9abd('0x3b')](config['root'],'server/files/templates/network.ejs'),_0x9abd('0x3d'));var _0x4d8e8b=ejs[_0x9abd('0x3e')](_0x42ed8a,{'networks':_0x890ad7||[]});fs['writeFileSync'](util[_0x9abd('0x4a')](_0x9abd('0x47'),_0x48ee70[_0x9abd('0x20')]['toLowerCase']()),_0x4d8e8b);return respondWithRpcPromise(_0x9abd('0x41'),_0x9abd('0x4c'),{'module':_0x9abd('0x48')});}})[_0x9abd('0x12')](handleError(_0x1ae141,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e8c5f87..a166480 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 _0xbdb7=['request-promise','path','rimraf','./network.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xbdb7[_0x13f980];return _0x27153c;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e5c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','network','lodash','util'];(function(_0x1824c9,_0x475d83){var _0x3ad7e9=function(_0x346a23){while(--_0x346a23){_0x1824c9['push'](_0x1824c9['shift']());}};_0x3ad7e9(++_0x475d83);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x388863,_0x10bdd7){_0x388863=_0x388863-0x0;var _0x40b27c=_0x3e5c[_0x388863];return _0x40b27c;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var logger=require(_0xc3e5('0x2'))(_0xc3e5('0x3'));var moment=require('moment');var BPromise=require(_0xc3e5('0x4'));var rp=require(_0xc3e5('0x5'));var fs=require('fs');var path=require(_0xc3e5('0x6'));var rimraf=require(_0xc3e5('0x7'));var config=require(_0xc3e5('0x8'));var attributes=require(_0xc3e5('0x9'));module['exports']=function(_0xf61ec2,_0xdf5a06){return _0xf61ec2[_0xc3e5('0xa')](_0xc3e5('0xb'),attributes,{'tableName':_0xc3e5('0xc'),'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 fa14afb..3d61209 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x54ac9a,_0x1f66c1){var _0x3197ca=function(_0x8c3f3c){while(--_0x8c3f3c){_0x54ac9a['push'](_0x54ac9a['shift']());}};_0x3197ca(++_0x1f66c1);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x37076f,_0x545aba){_0x37076f=_0x37076f-0x0;var _0x2dbd6d=_0x7a54[_0x37076f];return _0x2dbd6d;};'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 a1beeda..1d4af06 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 _0x99d8=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','delete','destroy','removeAnswers','removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x279481,_0x58bd61){var _0x1bf270=function(_0xe981f6){while(--_0xe981f6){_0x279481['push'](_0x279481['shift']());}};_0x1bf270(++_0x58bd61);}(_0x99d8,0x64));var _0x899d=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x99d8[_0xaa6a4];return _0xdc31a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x899d('0x0'));var timeout=require(_0x899d('0x1'));var express=require(_0x899d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x899d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x899d('0x4'));var controller=require(_0x899d('0x5'));router[_0x899d('0x6')]('/',auth[_0x899d('0x7')](),controller[_0x899d('0x8')]);router[_0x899d('0x6')]('/describe',auth[_0x899d('0x7')](),controller[_0x899d('0x9')]);router[_0x899d('0x6')](_0x899d('0xa'),auth[_0x899d('0x7')](),controller[_0x899d('0xb')]);router[_0x899d('0x6')](_0x899d('0xc'),auth[_0x899d('0x7')](),controller[_0x899d('0xd')]);router[_0x899d('0x6')](_0x899d('0xe'),auth[_0x899d('0x7')](),controller[_0x899d('0xf')]);router[_0x899d('0x6')](_0x899d('0x10'),auth[_0x899d('0x7')](),controller[_0x899d('0x11')]);router['get'](_0x899d('0x12'),auth[_0x899d('0x7')](),controller[_0x899d('0x13')]);router[_0x899d('0x6')](_0x899d('0x14'),auth[_0x899d('0x7')](),controller[_0x899d('0x15')]);router[_0x899d('0x16')]('/',auth[_0x899d('0x7')](),controller[_0x899d('0x17')]);router[_0x899d('0x16')](_0x899d('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x899d('0xe'),auth[_0x899d('0x7')](),controller[_0x899d('0x18')]);router['post'](_0x899d('0x19'),controller[_0x899d('0x1a')]);router[_0x899d('0x16')](_0x899d('0x10'),auth[_0x899d('0x7')](),controller[_0x899d('0x1b')]);router[_0x899d('0x16')]('/:id/users',auth[_0x899d('0x7')](),controller[_0x899d('0x1c')]);router[_0x899d('0x16')](_0x899d('0x1d'),auth[_0x899d('0x7')](),controller[_0x899d('0x1e')]);router['put'](_0x899d('0xa'),auth['isAuthenticated'](),controller[_0x899d('0x1f')]);router[_0x899d('0x20')](_0x899d('0xa'),auth['isAuthenticated'](),controller[_0x899d('0x21')]);router[_0x899d('0x20')](_0x899d('0xc'),auth[_0x899d('0x7')](),controller['removeDispositions']);router[_0x899d('0x20')](_0x899d('0xe'),auth['isAuthenticated'](),controller[_0x899d('0x22')]);router[_0x899d('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0x899d('0x23')]);module[_0x899d('0x24')]=router; \ No newline at end of file +var _0xa054=['../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAgents','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa054,0x13d));var _0x4a05=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa054[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x4a05('0x0'));var util=require(_0x4a05('0x1'));var path=require(_0x4a05('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a05('0x3'));var router=express['Router']();var fs_extra=require(_0x4a05('0x4'));var auth=require(_0x4a05('0x5'));var interaction=require(_0x4a05('0x6'));var config=require(_0x4a05('0x7'));var controller=require(_0x4a05('0x8'));router['get']('/',auth[_0x4a05('0x9')](),controller[_0x4a05('0xa')]);router[_0x4a05('0xb')](_0x4a05('0xc'),auth[_0x4a05('0x9')](),controller['describe']);router[_0x4a05('0xb')](_0x4a05('0xd'),auth['isAuthenticated'](),controller[_0x4a05('0xe')]);router[_0x4a05('0xb')](_0x4a05('0xf'),auth[_0x4a05('0x9')](),controller['getDispositions']);router['get'](_0x4a05('0x10'),auth[_0x4a05('0x9')](),controller[_0x4a05('0x11')]);router[_0x4a05('0xb')](_0x4a05('0x12'),auth[_0x4a05('0x9')](),controller[_0x4a05('0x13')]);router[_0x4a05('0xb')]('/:id/interactions',auth[_0x4a05('0x9')](),controller[_0x4a05('0x14')]);router[_0x4a05('0xb')](_0x4a05('0x15'),auth['isAuthenticated'](),controller[_0x4a05('0x16')]);router[_0x4a05('0x17')]('/',auth[_0x4a05('0x9')](),controller['create']);router[_0x4a05('0x17')]('/:id/dispositions',auth[_0x4a05('0x9')](),controller[_0x4a05('0x18')]);router['post'](_0x4a05('0x10'),auth[_0x4a05('0x9')](),controller[_0x4a05('0x19')]);router[_0x4a05('0x17')](_0x4a05('0x1a'),controller['notify']);router[_0x4a05('0x17')](_0x4a05('0x12'),auth['isAuthenticated'](),controller[_0x4a05('0x1b')]);router[_0x4a05('0x17')](_0x4a05('0x15'),auth[_0x4a05('0x9')](),controller[_0x4a05('0x1c')]);router[_0x4a05('0x17')](_0x4a05('0x1d'),auth[_0x4a05('0x9')](),controller[_0x4a05('0x1e')]);router[_0x4a05('0x1f')](_0x4a05('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x4a05('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x4a05('0x21')]);router[_0x4a05('0x20')](_0x4a05('0xf'),auth['isAuthenticated'](),controller[_0x4a05('0x22')]);router[_0x4a05('0x20')](_0x4a05('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x4a05('0x15'),auth[_0x4a05('0x9')](),controller[_0x4a05('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index df65079..e8c381e 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 _0xe40b=['name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING'];(function(_0x540624,_0x4aeeff){var _0x49a3d4=function(_0x42dfb9){while(--_0x42dfb9){_0x540624['push'](_0x540624['shift']());}};_0x49a3d4(++_0x4aeeff);}(_0xe40b,0x17e));var _0xbe40=function(_0x52d1ca,_0x58272f){_0x52d1ca=_0x52d1ca-0x0;var _0x55d455=_0xe40b[_0x52d1ca];return _0x55d455;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbe40('0x0'));module[_0xbe40('0x1')]={'name':{'type':Sequelize[_0xbe40('0x2')],'unique':_0xbe40('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbe40('0x4')]();}},'replyUri':{'type':Sequelize[_0xbe40('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbe40('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe40('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbe40('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe40('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe40('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xbe40('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbe40('0x6')],'defaultValue':![],'comment':_0xbe40('0x9'),'set':function(_0x4111ba){if(!_0x4111ba)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xbe40('0xa')]('mandatoryDisposition',_0x4111ba);}}}; \ No newline at end of file +var _0x4977=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1fafb0,_0x546098){var _0x10efaa=function(_0x1a82f2){while(--_0x1a82f2){_0x1fafb0['push'](_0x1fafb0['shift']());}};_0x10efaa(++_0x546098);}(_0x4977,0xff));var _0x7497=function(_0x5c7bb3,_0x5c3330){_0x5c7bb3=_0x5c7bb3-0x0;var _0x3bcbe2=_0x4977[_0x5c7bb3];return _0x3bcbe2;};'use strict';var Sequelize=require(_0x7497('0x0'));var rs=require(_0x7497('0x1'));module[_0x7497('0x2')]={'name':{'type':Sequelize[_0x7497('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x7497('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7497('0x4')]();}},'replyUri':{'type':Sequelize[_0x7497('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7497('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7497('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7497('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7497('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x7497('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7497('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7497('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7497('0x6')],'defaultValue':![],'comment':_0x7497('0x8'),'set':function(_0x5857cd){if(!_0x5857cd)this['setDataValue'](_0x7497('0x9'),null);this[_0x7497('0xa')](_0x7497('0xb'),_0x5857cd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4d6c40c..3c1d54f 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 _0x9901=['client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','OpenchannelAccounts','UserProfileResource','destroy','stack','name','index','map','OpenchannelAccount','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','fields','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','filter','addAnswer','CannedAnswer','findOne','order','removeAnswers','ids','notify','CmContact','difference','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','list','orderBy','priority','asc','defaults','ListId','mapKey','contact','firstName','threadId','OpenchannelInteraction','ContactId','spread','lastName','messageId','created','interaction','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','send','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','addAgents','omit','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','jayson/promise'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x9901,0x15e));var _0x1990=function(_0x19f183,_0x540981){_0x19f183=_0x19f183-0x0;var _0x317275=_0x9901[_0x19f183];return _0x317275;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1990('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1990('0x1'));var rp=require(_0x1990('0x2'));var moment=require(_0x1990('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1990('0x4'));var util=require(_0x1990('0x5'));var path=require(_0x1990('0x6'));var sox=require(_0x1990('0x7'));var csv=require(_0x1990('0x8'));var ejs=require(_0x1990('0x9'));var fs=require('fs');var fs_extra=require(_0x1990('0xa'));var _=require(_0x1990('0xb'));var squel=require(_0x1990('0xc'));var crypto=require(_0x1990('0xd'));var jsforce=require(_0x1990('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1990('0x8'));var querystring=require(_0x1990('0xf'));var Papa=require(_0x1990('0x10'));var Redis=require(_0x1990('0x11'));var authService=require(_0x1990('0x12'));var qs=require(_0x1990('0x13'));var as=require(_0x1990('0x14'));var hardwareService=require(_0x1990('0x15'));var logger=require(_0x1990('0x16'))(_0x1990('0x17'));var utils=require(_0x1990('0x18'));var config=require(_0x1990('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1990('0x1a'))['db'];config['redis']=_['defaults'](config[_0x1990('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1990('0x1c'))(new Redis(config[_0x1990('0x1b')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x1990('0x1d'));var client=jayson[_0x1990('0x1e')][_0x1990('0x1f')]({'port':0x232c});var client9002=jayson[_0x1990('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279e51,_0x3699d9,_0x3d3a5e,_0x3c9b0f){return new BPromise(function(_0x3b09ad,_0x4d3b35){var _0x242df5=_0x3c9b0f||client;return _0x242df5['request'](_0x279e51,_0x3d3a5e)['then'](function(_0x31962a){logger[_0x1990('0x20')](_0x1990('0x21'),_0x3699d9,_0x1990('0x22'));logger[_0x1990('0x23')](_0x1990('0x24'),_0x3699d9,'request\x20sent',JSON[_0x1990('0x25')](_0x31962a));if(_0x31962a['error']){if(_0x31962a[_0x1990('0x26')]['code']===0x1f4){logger[_0x1990('0x26')](_0x1990('0x21'),_0x3699d9,_0x31962a['error'][_0x1990('0x27')]);return _0x4d3b35(_0x31962a[_0x1990('0x26')]['message']);}logger[_0x1990('0x26')](_0x1990('0x21'),_0x3699d9,_0x31962a[_0x1990('0x26')][_0x1990('0x27')]);return _0x3b09ad(_0x31962a[_0x1990('0x26')][_0x1990('0x27')]);}else{logger[_0x1990('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x3699d9,_0x1990('0x22'));_0x3b09ad(_0x31962a[_0x1990('0x28')][_0x1990('0x27')]);}})[_0x1990('0x29')](function(_0x460498){logger[_0x1990('0x26')](_0x1990('0x21'),_0x3699d9,_0x460498);_0x4d3b35(_0x460498);});});}function respondWithStatusCode(_0x1e4edf,_0x1a7e4d){_0x1a7e4d=_0x1a7e4d||0xcc;return function(_0x482aa4){if(_0x482aa4){return _0x1e4edf[_0x1990('0x2a')](_0x1a7e4d);}return _0x1e4edf['status'](_0x1a7e4d)[_0x1990('0x2b')]();};}function respondWithResult(_0xfe9a37,_0x1317da){_0x1317da=_0x1317da||0xc8;return function(_0x359589){if(_0x359589){return _0xfe9a37[_0x1990('0x2c')](_0x1317da)[_0x1990('0x2d')](_0x359589);}};}function respondWithFilteredResult(_0x307300,_0x2121fe){return function(_0x5a37f8){if(_0x5a37f8){var _0x495b85=typeof _0x2121fe[_0x1990('0x2e')]===_0x1990('0x2f')&&typeof _0x2121fe[_0x1990('0x30')]===_0x1990('0x2f');var _0x3785a8=_0x5a37f8[_0x1990('0x31')];var _0x3b3463=_0x495b85?0x0:_0x2121fe[_0x1990('0x2e')];var _0x31a2e4=_0x495b85?_0x5a37f8['count']:_0x2121fe[_0x1990('0x2e')]+_0x2121fe['limit'];var _0x5bbbd8;if(_0x31a2e4>=_0x3785a8){_0x31a2e4=_0x3785a8;_0x5bbbd8=0xc8;}else{_0x5bbbd8=0xce;}_0x307300[_0x1990('0x2c')](_0x5bbbd8);return _0x307300[_0x1990('0x32')](_0x1990('0x33'),_0x3b3463+'-'+_0x31a2e4+'/'+_0x3785a8)[_0x1990('0x2d')](_0x5a37f8);}return null;};}function patchUpdates(_0x2a62d5){return function(_0x41ce36){try{jsonpatch[_0x1990('0x34')](_0x41ce36,_0x2a62d5,!![]);}catch(_0x5e4ef1){return BPromise[_0x1990('0x35')](_0x5e4ef1);}return _0x41ce36[_0x1990('0x36')]();};}function saveUpdates(_0xfae0bb,_0x2859fc){return function(_0x29ea91){if(_0x29ea91){return _0x29ea91[_0x1990('0x37')](_0xfae0bb)[_0x1990('0x38')](function(_0x52dcad){return _0x52dcad;});}return null;};}function removeEntity(_0x2177e4,_0x300a2a){return function(_0x33660b){if(_0x33660b){return _0x33660b['destroy']()[_0x1990('0x38')](function(){var _0x1eb3d6=_0x33660b['get']({'plain':!![]});var _0x1d9a9e=_0x1990('0x39');return db[_0x1990('0x3a')][_0x1990('0x3b')]({'where':{'type':_0x1d9a9e,'resourceId':_0x1eb3d6['id']}})[_0x1990('0x38')](function(){return _0x33660b;});})['then'](function(){_0x2177e4[_0x1990('0x2c')](0xcc)[_0x1990('0x2b')]();});}};}function handleEntityNotFound(_0x451293,_0x4aa02a){return function(_0x191786){if(!_0x191786){_0x451293[_0x1990('0x2a')](0x194);}return _0x191786;};}function handleError(_0x379bec,_0x38df05){_0x38df05=_0x38df05||0x1f4;return function(_0x405c8a){logger[_0x1990('0x26')](_0x405c8a[_0x1990('0x3c')]);if(_0x405c8a['name']){delete _0x405c8a[_0x1990('0x3d')];}_0x379bec[_0x1990('0x2c')](_0x38df05)['send'](_0x405c8a);};}exports[_0x1990('0x3e')]=function(_0x27b521,_0x2cac9d){var _0x55e2de={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x57a44f={},_0x55686f={'count':0x0,'rows':[]};var _0xe0a16d=_[_0x1990('0x3f')](db[_0x1990('0x40')]['rawAttributes'],function(_0x2c230a){return{'name':_0x2c230a['fieldName'],'type':_0x2c230a['type'][_0x1990('0x41')]};});_0x57a44f[_0x1990('0x42')]=_[_0x1990('0x3f')](_0xe0a16d,_0x1990('0x3d'));_0x57a44f[_0x1990('0x43')]=_[_0x1990('0x44')](_0x27b521['query']);_0x57a44f['filters']=_[_0x1990('0x45')](_0x57a44f[_0x1990('0x42')],_0x57a44f[_0x1990('0x43')]);_0x55e2de[_0x1990('0x46')]=_['intersection'](_0x57a44f[_0x1990('0x42')],qs['fields'](_0x27b521[_0x1990('0x43')]['fields']));_0x55e2de[_0x1990('0x46')]=_0x55e2de[_0x1990('0x46')][_0x1990('0x47')]?_0x55e2de[_0x1990('0x46')]:_0x57a44f['model'];if(!_0x27b521[_0x1990('0x43')][_0x1990('0x48')](_0x1990('0x49'))){_0x55e2de['limit']=qs[_0x1990('0x30')](_0x27b521[_0x1990('0x43')]['limit']);_0x55e2de[_0x1990('0x2e')]=qs[_0x1990('0x2e')](_0x27b521[_0x1990('0x43')][_0x1990('0x2e')]);}_0x55e2de['order']=qs[_0x1990('0x4a')](_0x27b521[_0x1990('0x43')][_0x1990('0x4a')]);_0x55e2de[_0x1990('0x4b')]=qs[_0x1990('0x4c')](_[_0x1990('0x4d')](_0x27b521[_0x1990('0x43')],_0x57a44f[_0x1990('0x4c')]),_0xe0a16d);if(_0x27b521['query']['filter']){_0x55e2de['where']=_[_0x1990('0x4e')](_0x55e2de[_0x1990('0x4b')],{'$or':_[_0x1990('0x3f')](_0xe0a16d,function(_0x3a675a){if(_0x3a675a[_0x1990('0x4f')]!==_0x1990('0x50')){var _0x46fbf5={};_0x46fbf5[_0x3a675a['name']]={'$like':'%'+_0x27b521[_0x1990('0x43')]['filter']+'%'};return _0x46fbf5;}})});}_0x55e2de=_[_0x1990('0x4e')]({},_0x55e2de,_0x27b521[_0x1990('0x51')]);var _0x339311={'where':_0x55e2de[_0x1990('0x4b')]};return db[_0x1990('0x40')][_0x1990('0x31')](_0x339311)['then'](function(_0x1789bc){_0x55686f[_0x1990('0x31')]=_0x1789bc;if(_0x27b521[_0x1990('0x43')][_0x1990('0x52')]){_0x55e2de[_0x1990('0x53')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1990('0x54')](_0x55e2de);})[_0x1990('0x38')](function(_0x246ed0){_0x55686f[_0x1990('0x55')]=_0x246ed0;return _0x55686f;})[_0x1990('0x38')](respondWithFilteredResult(_0x2cac9d,_0x55e2de))[_0x1990('0x29')](handleError(_0x2cac9d,null));};exports[_0x1990('0x56')]=function(_0x4e21e6,_0x5d2a9a){var _0x58ef01={'raw':![],'where':{'id':_0x4e21e6[_0x1990('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x1990('0x58')}]},_0x28203a={};_0x28203a[_0x1990('0x42')]=_[_0x1990('0x44')](db[_0x1990('0x40')][_0x1990('0x59')]);_0x28203a[_0x1990('0x43')]=_[_0x1990('0x44')](_0x4e21e6['query']);_0x28203a['filters']=_[_0x1990('0x45')](_0x28203a['model'],_0x28203a['query']);_0x58ef01[_0x1990('0x46')]=_[_0x1990('0x45')](_0x28203a['model'],qs[_0x1990('0x5a')](_0x4e21e6[_0x1990('0x43')][_0x1990('0x5a')]));_0x58ef01[_0x1990('0x46')]=_0x58ef01['attributes'][_0x1990('0x47')]?_0x58ef01['attributes']:_0x28203a[_0x1990('0x42')];if(_0x4e21e6[_0x1990('0x43')][_0x1990('0x52')]){_0x58ef01[_0x1990('0x53')]=[{'all':!![]}];}_0x58ef01=_[_0x1990('0x4e')]({},_0x58ef01,_0x4e21e6[_0x1990('0x51')]);return db[_0x1990('0x40')][_0x1990('0x5b')](_0x58ef01)['then'](handleEntityNotFound(_0x5d2a9a,null))['then'](respondWithResult(_0x5d2a9a,null))[_0x1990('0x29')](handleError(_0x5d2a9a,null));};exports[_0x1990('0x5c')]=function(_0x38dc9d,_0x30c970){return db[_0x1990('0x40')][_0x1990('0x5c')](_0x38dc9d['body'],{})[_0x1990('0x38')](function(_0x156f99){var _0x1431dc=_0x38dc9d['user'][_0x1990('0x5d')]({'plain':!![]});if(!_0x1431dc)throw new Error(_0x1990('0x5e'));if(_0x1431dc[_0x1990('0x5f')]===_0x1990('0x60')){var _0x562f7a=_0x156f99[_0x1990('0x5d')]({'plain':!![]});var _0x1fb926=_0x1990('0x39');return db[_0x1990('0x61')]['find']({'where':{'name':_0x1fb926,'userProfileId':_0x1431dc[_0x1990('0x62')]},'raw':!![]})[_0x1990('0x38')](function(_0x3809ad){if(_0x3809ad&&_0x3809ad[_0x1990('0x63')]===0x0){return db[_0x1990('0x3a')][_0x1990('0x5c')]({'name':_0x562f7a[_0x1990('0x3d')],'resourceId':_0x562f7a['id'],'type':_0x3809ad[_0x1990('0x3d')],'sectionId':_0x3809ad['id']},{})['then'](function(){return _0x156f99;});}else{return _0x156f99;}})[_0x1990('0x29')](function(_0x27c5ab){logger['error'](_0x1990('0x64'),_0x27c5ab);throw _0x27c5ab;});}return _0x156f99;})[_0x1990('0x38')](respondWithResult(_0x30c970,0xc9))[_0x1990('0x29')](handleError(_0x30c970,null));};exports[_0x1990('0x37')]=function(_0x44fa18,_0x19da6a){if(_0x44fa18[_0x1990('0x65')]['id']){delete _0x44fa18['body']['id'];}return db[_0x1990('0x40')][_0x1990('0x5b')]({'where':{'id':_0x44fa18[_0x1990('0x57')]['id']},'include':[{'model':db[_0x1990('0x66')],'as':_0x1990('0x58')}]})[_0x1990('0x38')](handleEntityNotFound(_0x19da6a,null))[_0x1990('0x38')](saveUpdates(_0x44fa18['body'],null))[_0x1990('0x38')](respondWithResult(_0x19da6a,null))[_0x1990('0x29')](handleError(_0x19da6a,null));};exports[_0x1990('0x3b')]=function(_0x6f206d,_0x1b8733){return db[_0x1990('0x40')][_0x1990('0x5b')]({'where':{'id':_0x6f206d[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x1b8733,null))[_0x1990('0x38')](removeEntity(_0x1b8733,null))[_0x1990('0x29')](handleError(_0x1b8733,null));};exports['describe']=function(_0x3efac4,_0x56032a){return db[_0x1990('0x40')][_0x1990('0x67')]()[_0x1990('0x38')](respondWithResult(_0x56032a,null))[_0x1990('0x29')](handleError(_0x56032a,null));};exports[_0x1990('0x68')]=function(_0x5b78eb,_0x48163a,_0x2fd3ca){if(_0x5b78eb[_0x1990('0x65')]['id']){delete _0x5b78eb[_0x1990('0x65')]['id'];}return db['OpenchannelAccount'][_0x1990('0x5b')]({'where':{'id':_0x5b78eb['params']['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x48163a,null))[_0x1990('0x38')](function(_0x432dd9){if(_0x432dd9){_0x5b78eb[_0x1990('0x65')][_0x1990('0x69')]=_0x432dd9['id'];return db[_0x1990('0x6a')][_0x1990('0x5c')](_0x5b78eb['body']);}})['then'](respondWithResult(_0x48163a,null))[_0x1990('0x29')](handleError(_0x48163a,null));};exports[_0x1990('0x6b')]=function(_0x3c1d78,_0x165009,_0x55a7de){var _0x32155c={'raw':![],'where':{}};var _0xd52c02={};var _0x31f0b5={'count':0x0,'rows':[]};return db[_0x1990('0x40')]['findOne']({'where':{'id':_0x3c1d78[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x165009,null))[_0x1990('0x38')](function(_0x37ec28){if(_0x37ec28){_0xd52c02['model']=_[_0x1990('0x44')](db[_0x1990('0x6a')]['rawAttributes']);_0xd52c02[_0x1990('0x43')]=_[_0x1990('0x44')](_0x3c1d78[_0x1990('0x43')]);_0xd52c02[_0x1990('0x4c')]=_['intersection'](_0xd52c02[_0x1990('0x42')],_0xd52c02['query']);_0x32155c[_0x1990('0x46')]=_[_0x1990('0x45')](_0xd52c02['model'],qs['fields'](_0x3c1d78[_0x1990('0x43')][_0x1990('0x5a')]));_0x32155c[_0x1990('0x46')]=_0x32155c[_0x1990('0x46')][_0x1990('0x47')]?_0x32155c[_0x1990('0x46')]:_0xd52c02['model'];if(!_0x3c1d78['query'][_0x1990('0x48')]('nolimit')){_0x32155c[_0x1990('0x30')]=qs['limit'](_0x3c1d78[_0x1990('0x43')][_0x1990('0x30')]);_0x32155c[_0x1990('0x2e')]=qs[_0x1990('0x2e')](_0x3c1d78['query'][_0x1990('0x2e')]);}_0x32155c['order']=qs[_0x1990('0x4a')](_0x3c1d78[_0x1990('0x43')][_0x1990('0x4a')]);_0x32155c[_0x1990('0x4b')]=qs[_0x1990('0x4c')](_[_0x1990('0x4d')](_0x3c1d78[_0x1990('0x43')],_0xd52c02[_0x1990('0x4c')]));_0x32155c[_0x1990('0x4b')][_0x1990('0x69')]=_0x37ec28['id'];if(_0x3c1d78[_0x1990('0x43')][_0x1990('0x6c')]){_0x32155c[_0x1990('0x4b')]=_[_0x1990('0x4e')](_0x32155c['where'],{'$or':_[_0x1990('0x3f')](_0x32155c['attributes'],function(_0x1914b5){var _0x24e1cb={};_0x24e1cb[_0x1914b5]={'$like':'%'+_0x3c1d78[_0x1990('0x43')][_0x1990('0x6c')]+'%'};return _0x24e1cb;})});}_0x32155c=_[_0x1990('0x4e')]({},_0x32155c,_0x3c1d78[_0x1990('0x51')]);return db[_0x1990('0x6a')][_0x1990('0x31')]({'where':_0x32155c[_0x1990('0x4b')]})[_0x1990('0x38')](function(_0x5cb108){_0x31f0b5['count']=_0x5cb108;if(_0x3c1d78[_0x1990('0x43')][_0x1990('0x52')]){_0x32155c[_0x1990('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x1990('0x54')](_0x32155c);})[_0x1990('0x38')](function(_0x2124f){_0x31f0b5[_0x1990('0x55')]=_0x2124f;return _0x31f0b5;});}})[_0x1990('0x38')](respondWithFilteredResult(_0x165009,_0x32155c))[_0x1990('0x29')](handleError(_0x165009,null));};exports['removeDispositions']=function(_0x5edbdd,_0x252b82,_0x54c3d7){return db[_0x1990('0x40')][_0x1990('0x5b')]({'where':{'id':_0x5edbdd[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x252b82,null))[_0x1990('0x38')](function(_0xbac6b){if(_0xbac6b){return _0xbac6b['removeDispositions'](_0x5edbdd[_0x1990('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x252b82,null))[_0x1990('0x29')](handleError(_0x252b82,null));};exports[_0x1990('0x6d')]=function(_0x2ea41a,_0x3e20da,_0x1615de){if(_0x2ea41a[_0x1990('0x65')]['id']){delete _0x2ea41a[_0x1990('0x65')]['id'];}return db['OpenchannelAccount'][_0x1990('0x5b')]({'where':{'id':_0x2ea41a[_0x1990('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e20da,null))[_0x1990('0x38')](function(_0x367a46){if(_0x367a46){_0x2ea41a[_0x1990('0x65')][_0x1990('0x69')]=_0x367a46['id'];return db[_0x1990('0x6e')][_0x1990('0x5c')](_0x2ea41a[_0x1990('0x65')]);}})[_0x1990('0x38')](respondWithResult(_0x3e20da,null))['catch'](handleError(_0x3e20da,null));};exports['getAnswers']=function(_0x7ab24c,_0x2f1657,_0x2e71a4){var _0x41b2e3={'raw':![],'where':{}};var _0x5de7f4={};var _0x5a09f9={'count':0x0,'rows':[]};return db[_0x1990('0x40')][_0x1990('0x6f')]({'where':{'id':_0x7ab24c[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x2f1657,null))[_0x1990('0x38')](function(_0x3485ff){if(_0x3485ff){_0x5de7f4[_0x1990('0x42')]=_[_0x1990('0x44')](db[_0x1990('0x6e')][_0x1990('0x59')]);_0x5de7f4[_0x1990('0x43')]=_[_0x1990('0x44')](_0x7ab24c[_0x1990('0x43')]);_0x5de7f4[_0x1990('0x4c')]=_[_0x1990('0x45')](_0x5de7f4[_0x1990('0x42')],_0x5de7f4[_0x1990('0x43')]);_0x41b2e3[_0x1990('0x46')]=_[_0x1990('0x45')](_0x5de7f4[_0x1990('0x42')],qs[_0x1990('0x5a')](_0x7ab24c[_0x1990('0x43')][_0x1990('0x5a')]));_0x41b2e3['attributes']=_0x41b2e3['attributes'][_0x1990('0x47')]?_0x41b2e3['attributes']:_0x5de7f4[_0x1990('0x42')];if(!_0x7ab24c[_0x1990('0x43')][_0x1990('0x48')]('nolimit')){_0x41b2e3['limit']=qs['limit'](_0x7ab24c[_0x1990('0x43')]['limit']);_0x41b2e3[_0x1990('0x2e')]=qs[_0x1990('0x2e')](_0x7ab24c[_0x1990('0x43')][_0x1990('0x2e')]);}_0x41b2e3[_0x1990('0x70')]=qs[_0x1990('0x4a')](_0x7ab24c[_0x1990('0x43')][_0x1990('0x4a')]);_0x41b2e3[_0x1990('0x4b')]=qs[_0x1990('0x4c')](_['pick'](_0x7ab24c[_0x1990('0x43')],_0x5de7f4[_0x1990('0x4c')]));_0x41b2e3['where']['OpenchannelAccountId']=_0x3485ff['id'];if(_0x7ab24c[_0x1990('0x43')]['filter']){_0x41b2e3[_0x1990('0x4b')]=_[_0x1990('0x4e')](_0x41b2e3[_0x1990('0x4b')],{'$or':_['map'](_0x41b2e3[_0x1990('0x46')],function(_0x579005){var _0x131b07={};_0x131b07[_0x579005]={'$like':'%'+_0x7ab24c[_0x1990('0x43')][_0x1990('0x6c')]+'%'};return _0x131b07;})});}_0x41b2e3=_[_0x1990('0x4e')]({},_0x41b2e3,_0x7ab24c['options']);return db[_0x1990('0x6e')][_0x1990('0x31')]({'where':_0x41b2e3[_0x1990('0x4b')]})[_0x1990('0x38')](function(_0x31cb26){_0x5a09f9[_0x1990('0x31')]=_0x31cb26;if(_0x7ab24c[_0x1990('0x43')]['includeAll']){_0x41b2e3[_0x1990('0x53')]=[{'all':!![]}];}return db[_0x1990('0x6e')]['findAll'](_0x41b2e3);})[_0x1990('0x38')](function(_0x46158f){_0x5a09f9['rows']=_0x46158f;return _0x5a09f9;});}})[_0x1990('0x38')](respondWithFilteredResult(_0x2f1657,_0x41b2e3))['catch'](handleError(_0x2f1657,null));};exports[_0x1990('0x71')]=function(_0x5620e8,_0x49aac4,_0x1706ae){return db[_0x1990('0x40')][_0x1990('0x5b')]({'where':{'id':_0x5620e8['params']['id']}})['then'](handleEntityNotFound(_0x49aac4,null))['then'](function(_0x177bed){if(_0x177bed){return _0x177bed['removeAnswers'](_0x5620e8['query'][_0x1990('0x72')]);}})[_0x1990('0x38')](respondWithStatusCode(_0x49aac4,null))[_0x1990('0x29')](handleError(_0x49aac4,null));};exports[_0x1990('0x73')]=function(_0x1f9623,_0x1fd385,_0xaf3565){var _0x163d47={'body':_0x1f9623[_0x1990('0x65')],'channel':'openchannel'};var _0x141205=[];var _0x2b4e65=[];var _0x56c9e0={};var _0xfa51de=![];return db[_0x1990('0x74')]['describe']()['then'](function(_0x52b020){if(!_0x52b020){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x141205=_[_0x1990('0x75')](_[_0x1990('0x44')](_0x52b020),[_0x1990('0x76'),_0x1990('0x77')]);_0x2b4e65=_[_0x1990('0x75')](_[_0x1990('0x44')](_0x52b020),[_0x1990('0x76'),_0x1990('0x77'),_0x1990('0x78'),'ListId']);if(_0x1f9623[_0x1990('0x65')]['id']){delete _0x1f9623[_0x1990('0x65')]['id'];}if(_[_0x1990('0x79')](_0x1f9623['body'][_0x1990('0x7a')])){throw new db['Sequelize'][(_0x1990('0x7b'))]('from\x20is\x20mandatory');}if(_[_0x1990('0x79')](_0x1f9623[_0x1990('0x65')][_0x1990('0x65')])||_0x1f9623[_0x1990('0x65')][_0x1990('0x65')]===''){throw new db[(_0x1990('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1990('0x79')](_0x1f9623['body']['mapKey'])){throw new db[(_0x1990('0x7c'))][(_0x1990('0x7b'))](_0x1990('0x7d')+_0x2b4e65);}if(!_['includes'](_0x2b4e65,_0x1f9623[_0x1990('0x65')]['mapKey'])){throw new db[(_0x1990('0x7c'))][(_0x1990('0x7b'))](_0x1990('0x7e')+_0x2b4e65);}_0x56c9e0[_0x1f9623[_0x1990('0x65')]['mapKey']]=_0x1f9623[_0x1990('0x65')]['from'];})['then'](function(){return db[_0x1990('0x40')]['find']({'where':{'id':_0x1f9623[_0x1990('0x57')]['id']},'include':[{'model':db[_0x1990('0x7f')],'as':_0x1990('0x80'),'include':[{'model':db[_0x1990('0x74')],'as':_0x1990('0x81'),'where':_0x56c9e0,'limit':0x1,'order':[[_0x1990('0x77'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x1990('0x82')}]});})[_0x1990('0x38')](handleEntityNotFound(_0x1fd385,null))[_0x1990('0x38')](function(_0x2edc12){if(_0x2edc12&&_0x2edc12[_0x1990('0x80')]){_0x163d47[_0x1990('0x83')]=_0x2edc12;_0x163d47[_0x1990('0x84')]=_0x2edc12[_0x1990('0x82')];_0x163d47[_0x1990('0x85')]=_0x2edc12['List'];_0x163d47[_0x1990('0x84')]=_[_0x1990('0x86')](_0x163d47['applications'],[_0x1990('0x87')],[_0x1990('0x88')]);if(_0x163d47[_0x1990('0x83')][_0x1990('0x82')]){delete _0x163d47[_0x1990('0x83')][_0x1990('0x82')];}if(_0x163d47[_0x1990('0x83')][_0x1990('0x80')]&&_0x163d47[_0x1990('0x83')][_0x1990('0x80')]['Contacts']['length']){return _0x163d47['account']['List'][_0x1990('0x81')][0x0];}var _0x123b33=_[_0x1990('0x89')](_0x1f9623[_0x1990('0x65')],{'firstName':_0x1f9623[_0x1990('0x65')][_0x1990('0x7a')],'ListId':_0x2edc12[_0x1990('0x8a')]});_0x123b33[_0x1f9623[_0x1990('0x65')][_0x1990('0x8b')]]=_0x1f9623[_0x1990('0x65')][_0x1990('0x7a')];return db[_0x1990('0x74')][_0x1990('0x5c')](_0x123b33,{'fields':_0x141205,'raw':!![]});}})[_0x1990('0x38')](handleEntityNotFound(_0x1fd385,null))[_0x1990('0x38')](function(_0x443ebf){_0x163d47[_0x1990('0x8c')]=_0x443ebf;if(_0x443ebf){var _0xb2ca25={'ContactId':_0x443ebf['id'],'OpenchannelAccountId':_0x1f9623[_0x1990('0x57')]['id'],'from':(_0x443ebf[_0x1990('0x8d')]||'')+'\x20'+(_0x443ebf['lastName']||'')};var _0x59145e={'OpenchannelAccountId':_0x1f9623[_0x1990('0x57')]['id'],'closed':![]};if(_0x1f9623[_0x1990('0x65')]['threadId']){_0x59145e['threadId']=_0x1f9623['body'][_0x1990('0x8e')];return db[_0x1990('0x8f')][_0x1990('0x5b')]({'where':_0x59145e})[_0x1990('0x38')](function(_0x2bfb7a){if(_0x2bfb7a){return[_0x2bfb7a,![]];}_0xb2ca25[_0x1990('0x8e')]=_0x1f9623[_0x1990('0x65')][_0x1990('0x8e')];_0xb2ca25['externalUrl']=_0x1f9623['body']['externalUrl'];return db['OpenchannelInteraction'][_0x1990('0x5c')](_0xb2ca25)[_0x1990('0x38')](function(_0x3b8282){return[_0x3b8282,!![]];});});}else{_0x59145e[_0x1990('0x8e')]=null;}_0x59145e[_0x1990('0x90')]=_0x443ebf['id'];return db['OpenchannelInteraction'][_0x1990('0x5b')]({'where':_0x59145e})['then'](function(_0x4274d6){if(_0x4274d6){return[_0x4274d6,![]];}return db[_0x1990('0x8f')]['create'](_0xb2ca25)[_0x1990('0x38')](function(_0x4e688a){return[_0x4e688a,!![]];});});}})[_0x1990('0x91')](function(_0x17fe8f,_0x22997a){if(_0x17fe8f){_0xfa51de=_0x22997a;if(!_0x22997a){var _0x545cdb={'from':(_0x163d47[_0x1990('0x8c')][_0x1990('0x8d')]||'')+'\x20'+(_0x163d47[_0x1990('0x8c')][_0x1990('0x92')]||'')};if(_0x1f9623[_0x1990('0x65')][_0x1990('0x8e')]&&_0x1f9623['body']['messageId']&&_0x1f9623[_0x1990('0x65')][_0x1990('0x8e')]!=_0x1f9623[_0x1990('0x65')][_0x1990('0x93')]){_0x545cdb[_0x1990('0x8e')]=_0x1f9623[_0x1990('0x65')][_0x1990('0x93')];}return _0x17fe8f[_0x1990('0x37')](_0x545cdb);}else{return _0x17fe8f;}}})[_0x1990('0x38')](function(_0x4205aa){_0x163d47['interaction']=_0x4205aa[_0x1990('0x5d')]({'plain':!![]});_0x163d47['interaction'][_0x1990('0x94')]=_0xfa51de;if(_0x163d47[_0x1990('0x95')]['created']){if(_0x163d47[_0x1990('0x83')][_0x1990('0x96')]){_0x163d47[_0x1990('0x84')][_0x1990('0x97')]({'id':0x0,'priority':_0x163d47[_0x1990('0x84')][_0x1990('0x47')]+0x1,'app':_0x1990('0x98'),'appdata':_0x1990('0x99'),'interval':'*,*,*,*'});}}return db[_0x1990('0x9a')]['create']({'body':_0x1f9623[_0x1990('0x65')][_0x1990('0x65')],'OpenchannelAccountId':_0x1f9623['params']['id'],'OpenchannelInteractionId':_0x4205aa['id'],'direction':'in','ContactId':_0x163d47[_0x1990('0x8c')]['id'],'AttachmentId':_0x1f9623[_0x1990('0x65')][_0x1990('0x9b')]});})[_0x1990('0x38')](function(_0x3068cd){_0x163d47['message']=_0x3068cd;if(_0x163d47[_0x1990('0x95')]['UserId']){return db[_0x1990('0x9c')]['find']({'attributes':['id','name'],'where':{'id':_0x163d47[_0x1990('0x95')]['UserId']}})[_0x1990('0x38')](function(_0x1fc9a1){if(_0x1fc9a1){_0x163d47['applications'][_0x1990('0x9d')]({'id':0x0,'priority':0x0,'app':_0x1990('0x9e'),'appdata':_0x1fc9a1[_0x1990('0x3d')]+','+(_0x163d47['account'][_0x1990('0x9f')]||0xa),'interval':'*,*,*,*'});_0x163d47[_0x1990('0xa0')]=![];}return respondWithRpcPromise(_0x1990('0xa1'),_0x1990('0xa2'),_0x163d47);});}return respondWithRpcPromise(_0x1990('0xa1'),'startRouting',_0x163d47);})[_0x1990('0x38')](function(_0x220978){respondWithRpcPromise(_0x1990('0xa3'),_0x1990('0xa3'),{'event':_0x1990('0x73'),'message':_0x220978},client9002);return _0x220978;})[_0x1990('0x38')](respondWithResult(_0x1fd385,null))[_0x1990('0x29')](handleError(_0x1fd385,null));};exports[_0x1990('0xa4')]=function(_0xbd7251,_0x1553a3){var _0x5495e0=_0xbd7251[_0x1990('0x57')]['id'];var _0x3f85f3=_0xbd7251[_0x1990('0x65')];var _0x1127a1=0xc8;var _0x58d0e1=null;return db['sequelize'][_0x1990('0xa5')]({'isolationLevel':db['sequelize'][_0x1990('0xa6')][_0x1990('0xa7')]['READ_COMMITTED']},function(_0x4c3829){return db[_0x1990('0x40')][_0x1990('0x6f')]({'where':{'id':_0x5495e0},'transaction':_0x4c3829})['then'](function(_0x4f61c2){if(_0x4f61c2){return db['OpenchannelApplication'][_0x1990('0x3b')]({'where':{'OpenchannelAccountId':_0x5495e0},'transaction':_0x4c3829})[_0x1990('0x38')](function(){var _0x151d2d=_[_0x1990('0x3f')](_0x3f85f3,function(_0x410274){_0x410274[_0x1990('0x69')]=_0x5495e0;return _0x410274;});return db[_0x1990('0xa8')][_0x1990('0xa9')](_0x151d2d,{'transaction':_0x4c3829});});}else{_0x1127a1=0x194;_0x58d0e1=[];}});})[_0x1990('0x38')](function(){if(_0x1127a1!==0x194){return db[_0x1990('0xa8')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5495e0},'order':_0x1990('0x87')})[_0x1990('0x38')](function(_0x160563){_0x58d0e1=_0x160563;});}})[_0x1990('0x29')](function(_0x35469b){_0x1127a1=0x1f4;logger[_0x1990('0x26')](_0x35469b[_0x1990('0x3c')]);if(_0x35469b[_0x1990('0x3d')]){delete _0x35469b[_0x1990('0x3d')];}_0x58d0e1=_0x35469b;})['finally'](function(){if(_0x58d0e1===null){_0x1553a3[_0x1990('0x2a')](_0x1127a1);}else{if(_0x1127a1===0x1f4){_0x1553a3[_0x1990('0x2c')](_0x1127a1)[_0x1990('0xaa')](_0x58d0e1);}else{_0x1553a3[_0x1990('0x2c')](_0x1127a1)[_0x1990('0x2d')](_0x58d0e1);}}});};exports['getApplications']=function(_0x544aa8,_0x7baa96,_0x449da5){var _0x25676a={};var _0x181a12={};var _0x419c09;var _0x19146b;return db[_0x1990('0x40')]['findOne']({'where':{'id':_0x544aa8[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x7baa96,null))[_0x1990('0x38')](function(_0xebe2f9){if(_0xebe2f9){_0x419c09=_0xebe2f9;_0x181a12[_0x1990('0x42')]=_['keys'](db[_0x1990('0xa8')][_0x1990('0x59')]);_0x181a12[_0x1990('0x43')]=_[_0x1990('0x44')](_0x544aa8[_0x1990('0x43')]);_0x181a12['filters']=_[_0x1990('0x45')](_0x181a12[_0x1990('0x42')],_0x181a12['query']);_0x25676a[_0x1990('0x46')]=_[_0x1990('0x45')](_0x181a12[_0x1990('0x42')],qs['fields'](_0x544aa8[_0x1990('0x43')][_0x1990('0x5a')]));_0x25676a[_0x1990('0x46')]=_0x25676a[_0x1990('0x46')][_0x1990('0x47')]?_0x25676a['attributes']:_0x181a12['model'];_0x25676a['order']=qs['sort'](_0x544aa8[_0x1990('0x43')][_0x1990('0x4a')]);_0x25676a['where']=qs[_0x1990('0x4c')](_[_0x1990('0x4d')](_0x544aa8[_0x1990('0x43')],_0x181a12['filters']));if(_0x544aa8[_0x1990('0x43')][_0x1990('0x6c')]){_0x25676a['where']=_[_0x1990('0x4e')](_0x25676a[_0x1990('0x4b')],{'$or':_[_0x1990('0x3f')](_0x25676a[_0x1990('0x46')],function(_0x5e931f){var _0x2c8655={};_0x2c8655[_0x5e931f]={'$like':'%'+_0x544aa8[_0x1990('0x43')]['filter']+'%'};return _0x2c8655;})});}_0x25676a=_['merge']({},_0x25676a,_0x544aa8[_0x1990('0x51')]);return _0x419c09['getApplications'](_0x25676a);}})['then'](function(_0x21dbb9){if(_0x21dbb9){_0x19146b=_0x21dbb9[_0x1990('0x47')];if(!_0x544aa8['query'][_0x1990('0x48')](_0x1990('0x49'))){_0x25676a[_0x1990('0x30')]=qs[_0x1990('0x30')](_0x544aa8[_0x1990('0x43')][_0x1990('0x30')]);_0x25676a[_0x1990('0x2e')]=qs[_0x1990('0x2e')](_0x544aa8[_0x1990('0x43')][_0x1990('0x2e')]);}return _0x419c09['getApplications'](_0x25676a);}})[_0x1990('0x38')](function(_0x592664){if(_0x592664){return _0x592664?{'count':_0x19146b,'rows':_0x592664}:null;}})[_0x1990('0x38')](respondWithResult(_0x7baa96,null))[_0x1990('0x29')](handleError(_0x7baa96,null));};exports[_0x1990('0xab')]=function(_0x546e47,_0x42cc95,_0x25ebd3){var _0x428a2e={'raw':![],'where':{}};var _0xdcbeef={};var _0x44fa4d={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x546e47['params']['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x42cc95,null))['then'](function(_0x4afd2a){if(_0x4afd2a){_0xdcbeef[_0x1990('0x42')]=_['keys'](db[_0x1990('0x8f')][_0x1990('0x59')]);_0xdcbeef[_0x1990('0x43')]=_[_0x1990('0x44')](_0x546e47['query']);_0xdcbeef[_0x1990('0x4c')]=_[_0x1990('0x45')](_0xdcbeef['model'],_0xdcbeef['query']);_0x428a2e[_0x1990('0x46')]=_['intersection'](_0xdcbeef[_0x1990('0x42')],qs['fields'](_0x546e47[_0x1990('0x43')]['fields']));_0x428a2e['attributes']=_0x428a2e[_0x1990('0x46')]['length']?_0x428a2e['attributes']:_0xdcbeef[_0x1990('0x42')];if(!_0x546e47[_0x1990('0x43')][_0x1990('0x48')](_0x1990('0x49'))){_0x428a2e[_0x1990('0x30')]=qs['limit'](_0x546e47[_0x1990('0x43')]['limit']);_0x428a2e[_0x1990('0x2e')]=qs['offset'](_0x546e47[_0x1990('0x43')][_0x1990('0x2e')]);}_0x428a2e[_0x1990('0x70')]=qs['sort'](_0x546e47[_0x1990('0x43')][_0x1990('0x4a')]);_0x428a2e[_0x1990('0x4b')]=qs[_0x1990('0x4c')](_[_0x1990('0x4d')](_0x546e47['query'],_0xdcbeef[_0x1990('0x4c')]));_0x428a2e[_0x1990('0x4b')][_0x1990('0x69')]=_0x4afd2a['id'];if(_0x546e47[_0x1990('0x43')][_0x1990('0x6c')]){_0x428a2e[_0x1990('0x4b')]=_[_0x1990('0x4e')](_0x428a2e[_0x1990('0x4b')],{'$or':_[_0x1990('0x3f')](_0x428a2e[_0x1990('0x46')],function(_0x231a42){var _0x484793={};_0x484793[_0x231a42]={'$like':'%'+_0x546e47[_0x1990('0x43')][_0x1990('0x6c')]+'%'};return _0x484793;})});}_0x428a2e=_[_0x1990('0x4e')]({},_0x428a2e,_0x546e47[_0x1990('0x51')]);return db[_0x1990('0x8f')]['count']({'where':_0x428a2e['where']})[_0x1990('0x38')](function(_0x488161){_0x44fa4d[_0x1990('0x31')]=_0x488161;if(_0x546e47[_0x1990('0x43')][_0x1990('0x52')]){_0x428a2e['include']=[{'model':db[_0x1990('0x74')],'as':_0x1990('0xac'),'required':![]},{'model':db[_0x1990('0x9c')],'as':_0x1990('0xad'),'attributes':[_0x1990('0x3d'),_0x1990('0xae'),_0x1990('0xaf')],'required':![]},{'model':db[_0x1990('0xb0')],'as':_0x1990('0xb1'),'attributes':['id','name',_0x1990('0xb2')],'where':_0x546e47[_0x1990('0x43')]['tag']?{'id':_0x546e47[_0x1990('0x43')]['tag']}:undefined,'required':_0x546e47[_0x1990('0x43')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x1990('0x54')](_0x428a2e);})[_0x1990('0x38')](function(_0x3f8b2c){_0x44fa4d[_0x1990('0x55')]=_0x3f8b2c;return _0x44fa4d;});}})['then'](respondWithFilteredResult(_0x42cc95,_0x428a2e))[_0x1990('0x29')](handleError(_0x42cc95,null));};exports['addAgents']=function(_0x442e50,_0x5961de,_0x1aedde){return db[_0x1990('0x40')][_0x1990('0x5b')]({'where':{'id':_0x442e50[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x5961de,null))[_0x1990('0x38')](function(_0x5df5e4){if(_0x5df5e4){return _0x5df5e4[_0x1990('0xb3')](_0x442e50['body'][_0x1990('0x72')],_[_0x1990('0xb4')](_0x442e50[_0x1990('0x65')],['ids','id'])||{})[_0x1990('0x91')](function(_0x11c14f){for(var _0x2d34f2=0x0;_0x2d34f2<_0x442e50[_0x1990('0x65')][_0x1990('0x72')][_0x1990('0x47')];_0x2d34f2+=0x1){socket[_0x1990('0xb5')](_0x1990('0xb6'),{'UserId':Number(_0x442e50['body'][_0x1990('0x72')][_0x2d34f2]),'OpenchannelAccountId':Number(_0x442e50[_0x1990('0x57')]['id'])});}return _0x11c14f;});}})[_0x1990('0x38')](respondWithResult(_0x5961de,null))[_0x1990('0x29')](handleError(_0x5961de,null));};exports['removeAgents']=function(_0x464631,_0x1d076d,_0x331d4c){return db[_0x1990('0x40')][_0x1990('0x5b')]({'where':{'id':_0x464631[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x1d076d,null))[_0x1990('0x38')](function(_0x539256){if(_0x539256){return _0x539256['removeAgents'](_0x464631[_0x1990('0x43')]['ids'])['then'](function(){if(_[_0x1990('0xb7')](_0x464631['query']['ids'])){for(var _0xb942f7=0x0;_0xb942f7<_0x464631['query'][_0x1990('0x72')][_0x1990('0x47')];_0xb942f7+=0x1){socket[_0x1990('0xb5')](_0x1990('0xb8'),{'UserId':Number(_0x464631[_0x1990('0x43')][_0x1990('0x72')][_0xb942f7]),'OpenchannelAccountId':Number(_0x464631['params']['id'])});}}else{socket[_0x1990('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x464631['query']['ids']),'OpenchannelAccountId':Number(_0x464631[_0x1990('0x57')]['id'])});}});}})[_0x1990('0x38')](respondWithStatusCode(_0x1d076d,null))['catch'](handleError(_0x1d076d,null));};exports[_0x1990('0xb9')]=function(_0x161533,_0x2d00e9,_0x548166){var _0x389909={};var _0x222576={};var _0x40bfdf;var _0x3f9ded;return db[_0x1990('0x40')][_0x1990('0x6f')]({'where':{'id':_0x161533[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x2d00e9,null))[_0x1990('0x38')](function(_0x28260b){if(_0x28260b){_0x40bfdf=_0x28260b;_0x222576[_0x1990('0x42')]=_[_0x1990('0x44')](db[_0x1990('0x9c')][_0x1990('0x59')]);_0x222576[_0x1990('0x43')]=_[_0x1990('0x44')](_0x161533[_0x1990('0x43')]);_0x222576[_0x1990('0x4c')]=_[_0x1990('0x45')](_0x222576[_0x1990('0x42')],_0x222576[_0x1990('0x43')]);_0x389909[_0x1990('0x46')]=_[_0x1990('0x45')](_0x222576[_0x1990('0x42')],qs[_0x1990('0x5a')](_0x161533[_0x1990('0x43')]['fields']));_0x389909[_0x1990('0x46')]=_0x389909[_0x1990('0x46')][_0x1990('0x47')]?_0x389909['attributes']:_0x222576[_0x1990('0x42')];_0x389909[_0x1990('0x70')]=qs[_0x1990('0x4a')](_0x161533[_0x1990('0x43')][_0x1990('0x4a')]);_0x389909[_0x1990('0x4b')]=qs[_0x1990('0x4c')](_[_0x1990('0x4d')](_0x161533[_0x1990('0x43')],_0x222576[_0x1990('0x4c')]));if(_0x161533['query'][_0x1990('0x6c')]){_0x389909[_0x1990('0x4b')]=_[_0x1990('0x4e')](_0x389909[_0x1990('0x4b')],{'$or':_[_0x1990('0x3f')](_0x389909[_0x1990('0x46')],function(_0x2ecaa8){var _0x12e2aa={};_0x12e2aa[_0x2ecaa8]={'$like':'%'+_0x161533['query'][_0x1990('0x6c')]+'%'};return _0x12e2aa;})});}_0x389909=_[_0x1990('0x4e')]({},_0x389909,_0x161533['options']);return _0x40bfdf[_0x1990('0xb9')](_0x389909);}})[_0x1990('0x38')](function(_0x5598cd){if(_0x5598cd){_0x3f9ded=_0x5598cd[_0x1990('0x47')];if(!_0x161533[_0x1990('0x43')][_0x1990('0x48')]('nolimit')){_0x389909[_0x1990('0x30')]=qs[_0x1990('0x30')](_0x161533['query'][_0x1990('0x30')]);_0x389909[_0x1990('0x2e')]=qs[_0x1990('0x2e')](_0x161533['query'][_0x1990('0x2e')]);}return _0x40bfdf['getAgents'](_0x389909);}})[_0x1990('0x38')](function(_0x3dc50e){if(_0x3dc50e){return _0x3dc50e?{'count':_0x3f9ded,'rows':_0x3dc50e}:null;}})[_0x1990('0x38')](respondWithResult(_0x2d00e9,null))[_0x1990('0x29')](handleError(_0x2d00e9,null));};exports[_0x1990('0xaa')]=function(_0x1e6b21,_0x5d76af,_0x21ed11){var _0x4cb1b7,_0x722cc3,_0x2603f5;if(_[_0x1990('0x79')](_0x1e6b21['body'][_0x1990('0x65')])||_0x1e6b21[_0x1990('0x65')][_0x1990('0x65')]===''){throw new db['Sequelize'][(_0x1990('0x7b'))](_0x1990('0xba'));}if(_[_0x1990('0x79')](_0x1e6b21[_0x1990('0x65')]['to'])){}_0x4cb1b7=_0x1e6b21[_0x1990('0x65')]['to'];return db[_0x1990('0x40')][_0x1990('0x6f')]({'where':{'id':_0x1e6b21[_0x1990('0x57')]['id']}})[_0x1990('0x38')](handleEntityNotFound(_0x5d76af,null))['then'](function(_0x147d9d){if(_0x147d9d){return db['OpenchannelAccount'][_0x1990('0x5b')]({'where':{'id':_0x147d9d['id']},'include':[{'model':db[_0x1990('0x7f')],'as':'List','include':[{'model':db[_0x1990('0x74')],'as':_0x1990('0x81'),'where':{[_0x147d9d[_0x1990('0x8b')]]:_0x4cb1b7},'limit':0x1,'order':[[_0x1990('0x77'),'DESC']]}]}]})[_0x1990('0x38')](handleEntityNotFound(_0x5d76af,null))[_0x1990('0x38')](function(_0xc5def1){if(_0xc5def1&&_0xc5def1['List']){_0x722cc3=_0xc5def1['get']({'plain':!![]});if(_0x722cc3[_0x1990('0x80')]&&_0x722cc3[_0x1990('0x80')][_0x1990('0x81')]['length']){return _0x722cc3[_0x1990('0x80')][_0x1990('0x81')][0x0];}return db[_0x1990('0x74')][_0x1990('0x5c')](_[_0x1990('0x89')](_0x1e6b21[_0x1990('0x65')],{'firstName':_0x4cb1b7,[_0xc5def1[_0x1990('0x8b')]]:_0x4cb1b7,'phone':_0x4cb1b7,'ListId':_0x722cc3[_0x1990('0x8a')]}));}})['then'](handleEntityNotFound(_0x5d76af,null))['then'](function(_0x2291cd){if(_0x2291cd){_0x2603f5=_0x2291cd;return db[_0x1990('0x8f')]['find']({'where':{'ContactId':_0x2603f5['id'],'closed':![],'OpenchannelAccountId':_0x722cc3['id']}})[_0x1990('0x38')](function(_0x4cb6cd){if(_0x4cb6cd){return[_0x4cb6cd,![]];}return db[_0x1990('0x8f')][_0x1990('0x5c')]({'UserId':_0x1e6b21[_0x1990('0x60')]['id'],'ContactId':_0x2603f5['id'],'OpenchannelAccountId':_0x722cc3['id'],'lastMsgDirection':'out','firstMsgDirection':_0x1990('0xbb'),'Messages':[_[_0x1990('0x4e')](_0x1e6b21['body'],{'read':![],'body':_0x1e6b21['body'][_0x1990('0x65')],'OpenchannelAccountId':_0x722cc3['id'],'UserId':_0x1e6b21[_0x1990('0x60')]['id'],'ContactId':_0x2603f5['id']})]},{'include':[{'model':db[_0x1990('0x9a')],'as':_0x1990('0xbc')}]})[_0x1990('0x38')](function(_0x547d5a){return[_0x547d5a,!![]];});});}})['spread'](function(_0x3f1621,_0x54bd6f){if(_0x54bd6f){return _0x3f1621;}return db[_0x1990('0x9a')][_0x1990('0x5c')](_[_0x1990('0x4e')](_0x1e6b21[_0x1990('0x65')],{'read':![],'body':_0x1e6b21[_0x1990('0x65')][_0x1990('0x65')],'OpenchannelAccountId':_0x722cc3['id'],'OpenchannelInteractionId':_0x3f1621['id'],'UserId':_0x1e6b21[_0x1990('0x60')]['id'],'ContactId':_0x2603f5['id']}))['then'](function(_0x39be71){_0x3f1621[_0x1990('0xbd')]['Messages']=[];_0x3f1621[_0x1990('0xbd')][_0x1990('0xbc')]['push'](_0x39be71[_0x1990('0xbd')]);return _0x3f1621;});});}})[_0x1990('0x38')](respondWithResult(_0x5d76af,null))['catch'](handleError(_0x5d76af,null));}; \ No newline at end of file +var _0x3685=['account','Contacts','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','finally','send','getApplications','Contact','Owner','internal','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','autoAssociation','update','find','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','DESC','OpenchannelApplication','Applications','list','orderBy','applications','priority','asc'];(function(_0x1e5c8d,_0x1bd355){var _0x17f720=function(_0x4cdadf){while(--_0x4cdadf){_0x1e5c8d['push'](_0x1e5c8d['shift']());}};_0x17f720(++_0x1bd355);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5368('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5368('0x1'));var jsonpatch=require(_0x5368('0x2'));var rp=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var BPromise=require(_0x5368('0x5'));var Mustache=require(_0x5368('0x6'));var util=require(_0x5368('0x7'));var path=require(_0x5368('0x8'));var sox=require(_0x5368('0x9'));var csv=require(_0x5368('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5368('0xb'));var _=require(_0x5368('0xc'));var squel=require(_0x5368('0xd'));var crypto=require(_0x5368('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5368('0xf'));var toCsv=require(_0x5368('0xa'));var querystring=require(_0x5368('0x10'));var Papa=require(_0x5368('0x11'));var Redis=require(_0x5368('0x12'));var authService=require(_0x5368('0x13'));var qs=require(_0x5368('0x14'));var as=require(_0x5368('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5368('0x16'))(_0x5368('0x17'));var utils=require(_0x5368('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5368('0x19'));var db=require(_0x5368('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5368('0x1b'),'port':0x18eb});var socket=require(_0x5368('0x1c'))(new Redis(config[_0x5368('0x1d')]));require(_0x5368('0x1e'))[_0x5368('0x1f')](socket);var jayson=require(_0x5368('0x20'));var client=jayson[_0x5368('0x21')][_0x5368('0x22')]({'port':0x232c});var client9002=jayson[_0x5368('0x21')][_0x5368('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x524fbf,_0x41ce0e,_0x183041,_0x59c422){return new BPromise(function(_0x19790d,_0x1c04bd){var _0x973143=_0x59c422||client;return _0x973143[_0x5368('0x23')](_0x524fbf,_0x183041)['then'](function(_0x3fcae0){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x41ce0e,_0x5368('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x41ce0e,'request\x20sent',JSON[_0x5368('0x25')](_0x3fcae0));if(_0x3fcae0[_0x5368('0x26')]){if(_0x3fcae0[_0x5368('0x26')]['code']===0x1f4){logger['error'](_0x5368('0x27'),_0x41ce0e,_0x3fcae0[_0x5368('0x26')][_0x5368('0x28')]);return _0x1c04bd(_0x3fcae0[_0x5368('0x26')][_0x5368('0x28')]);}logger[_0x5368('0x26')](_0x5368('0x27'),_0x41ce0e,_0x3fcae0[_0x5368('0x26')][_0x5368('0x28')]);return _0x19790d(_0x3fcae0[_0x5368('0x26')]['message']);}else{logger[_0x5368('0x29')](_0x5368('0x27'),_0x41ce0e,_0x5368('0x24'));_0x19790d(_0x3fcae0[_0x5368('0x2a')][_0x5368('0x28')]);}})[_0x5368('0x2b')](function(_0xabac8c){logger[_0x5368('0x26')](_0x5368('0x27'),_0x41ce0e,_0xabac8c);_0x1c04bd(_0xabac8c);});});}function respondWithStatusCode(_0x569d81,_0x49c518){_0x49c518=_0x49c518||0xcc;return function(_0x15c206){if(_0x15c206){return _0x569d81[_0x5368('0x2c')](_0x49c518);}return _0x569d81[_0x5368('0x2d')](_0x49c518)[_0x5368('0x2e')]();};}function respondWithResult(_0x131722,_0x4b94cd){_0x4b94cd=_0x4b94cd||0xc8;return function(_0x725f8e){if(_0x725f8e){return _0x131722[_0x5368('0x2d')](_0x4b94cd)[_0x5368('0x2f')](_0x725f8e);}};}function respondWithFilteredResult(_0x2bcf41,_0x42d4b4){return function(_0x3af128){if(_0x3af128){var _0x3d40de=typeof _0x42d4b4[_0x5368('0x30')]===_0x5368('0x31')&&typeof _0x42d4b4[_0x5368('0x32')]===_0x5368('0x31');var _0x46ea22=_0x3af128[_0x5368('0x33')];var _0x5810cb=_0x3d40de?0x0:_0x42d4b4[_0x5368('0x30')];var _0x256abd=_0x3d40de?_0x3af128[_0x5368('0x33')]:_0x42d4b4['offset']+_0x42d4b4[_0x5368('0x32')];var _0x50131a;if(_0x256abd>=_0x46ea22){_0x256abd=_0x46ea22;_0x50131a=0xc8;}else{_0x50131a=0xce;}_0x2bcf41[_0x5368('0x2d')](_0x50131a);return _0x2bcf41[_0x5368('0x34')]('Content-Range',_0x5810cb+'-'+_0x256abd+'/'+_0x46ea22)[_0x5368('0x2f')](_0x3af128);}return null;};}function patchUpdates(_0x1ce386){return function(_0x592f21){try{jsonpatch['apply'](_0x592f21,_0x1ce386,!![]);}catch(_0x32a50e){return BPromise[_0x5368('0x35')](_0x32a50e);}return _0x592f21['save']();};}function saveUpdates(_0x46169e,_0x2fde35){return function(_0x211762){if(_0x211762){return _0x211762['update'](_0x46169e)[_0x5368('0x36')](function(_0x5b4993){return _0x5b4993;});}return null;};}function removeEntity(_0x22b489,_0x16f6a6){return function(_0x7ec790){if(_0x7ec790){return _0x7ec790['destroy']()[_0x5368('0x36')](function(){var _0x20c1f2=_0x7ec790[_0x5368('0x37')]({'plain':!![]});var _0x2a3bed='OpenchannelAccounts';return db[_0x5368('0x38')]['destroy']({'where':{'type':_0x2a3bed,'resourceId':_0x20c1f2['id']}})[_0x5368('0x36')](function(){return _0x7ec790;});})[_0x5368('0x36')](function(){_0x22b489['status'](0xcc)[_0x5368('0x2e')]();});}};}function handleEntityNotFound(_0x197659,_0x46e59a){return function(_0x3d65a8){if(!_0x3d65a8){_0x197659['sendStatus'](0x194);}return _0x3d65a8;};}function handleError(_0x432b42,_0x19de44){_0x19de44=_0x19de44||0x1f4;return function(_0x7b30ae){logger[_0x5368('0x26')](_0x7b30ae[_0x5368('0x39')]);if(_0x7b30ae['name']){delete _0x7b30ae[_0x5368('0x3a')];}_0x432b42[_0x5368('0x2d')](_0x19de44)['send'](_0x7b30ae);};}exports[_0x5368('0x3b')]=function(_0x871e13,_0x20e24c){var _0x5e796f={'include':[{'model':db[_0x5368('0x3c')],'as':_0x5368('0x3d')}]},_0x7b102f={},_0x3f9f1b={'count':0x0,'rows':[]};var _0x55449f=_['map'](db[_0x5368('0x3e')][_0x5368('0x3f')],function(_0x3015fc){return{'name':_0x3015fc['fieldName'],'type':_0x3015fc['type'][_0x5368('0x40')]};});_0x7b102f['model']=_[_0x5368('0x41')](_0x55449f,_0x5368('0x3a'));_0x7b102f['query']=_[_0x5368('0x42')](_0x871e13[_0x5368('0x43')]);_0x7b102f[_0x5368('0x44')]=_[_0x5368('0x45')](_0x7b102f[_0x5368('0x46')],_0x7b102f[_0x5368('0x43')]);_0x5e796f[_0x5368('0x47')]=_[_0x5368('0x45')](_0x7b102f[_0x5368('0x46')],qs[_0x5368('0x48')](_0x871e13[_0x5368('0x43')][_0x5368('0x48')]));_0x5e796f['attributes']=_0x5e796f[_0x5368('0x47')][_0x5368('0x49')]?_0x5e796f[_0x5368('0x47')]:_0x7b102f['model'];if(!_0x871e13[_0x5368('0x43')][_0x5368('0x4a')]('nolimit')){_0x5e796f[_0x5368('0x32')]=qs[_0x5368('0x32')](_0x871e13[_0x5368('0x43')][_0x5368('0x32')]);_0x5e796f[_0x5368('0x30')]=qs[_0x5368('0x30')](_0x871e13[_0x5368('0x43')][_0x5368('0x30')]);}_0x5e796f[_0x5368('0x4b')]=qs[_0x5368('0x4c')](_0x871e13['query']['sort']);_0x5e796f[_0x5368('0x4d')]=qs[_0x5368('0x44')](_[_0x5368('0x4e')](_0x871e13[_0x5368('0x43')],_0x7b102f['filters']),_0x55449f);if(_0x871e13['query'][_0x5368('0x4f')]){_0x5e796f['where']=_[_0x5368('0x50')](_0x5e796f['where'],{'$or':_[_0x5368('0x41')](_0x55449f,function(_0x56ae84){if(_0x56ae84[_0x5368('0x51')]!==_0x5368('0x52')){var _0x4cbb23={};_0x4cbb23[_0x56ae84['name']]={'$like':'%'+_0x871e13[_0x5368('0x43')]['filter']+'%'};return _0x4cbb23;}})});}_0x5e796f=_[_0x5368('0x50')]({},_0x5e796f,_0x871e13[_0x5368('0x53')]);var _0x2ee00b={'where':_0x5e796f[_0x5368('0x4d')]};return db['OpenchannelAccount'][_0x5368('0x33')](_0x2ee00b)[_0x5368('0x36')](function(_0x3ccf2d){_0x3f9f1b[_0x5368('0x33')]=_0x3ccf2d;if(_0x871e13[_0x5368('0x43')][_0x5368('0x54')]){_0x5e796f[_0x5368('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x5e796f);})[_0x5368('0x36')](function(_0x7d7a5){_0x3f9f1b[_0x5368('0x56')]=_0x7d7a5;return _0x3f9f1b;})['then'](respondWithFilteredResult(_0x20e24c,_0x5e796f))[_0x5368('0x2b')](handleError(_0x20e24c,null));};exports[_0x5368('0x57')]=function(_0x1791d4,_0xabc024){var _0x2a3545={'raw':![],'where':{'id':_0x1791d4[_0x5368('0x58')]['id']},'include':[{'model':db[_0x5368('0x3c')],'as':'mandatoryDispositionPause'}]},_0x233bf6={};_0x233bf6[_0x5368('0x46')]=_[_0x5368('0x42')](db[_0x5368('0x3e')][_0x5368('0x3f')]);_0x233bf6['query']=_[_0x5368('0x42')](_0x1791d4[_0x5368('0x43')]);_0x233bf6[_0x5368('0x44')]=_[_0x5368('0x45')](_0x233bf6[_0x5368('0x46')],_0x233bf6[_0x5368('0x43')]);_0x2a3545[_0x5368('0x47')]=_[_0x5368('0x45')](_0x233bf6[_0x5368('0x46')],qs[_0x5368('0x48')](_0x1791d4[_0x5368('0x43')][_0x5368('0x48')]));_0x2a3545[_0x5368('0x47')]=_0x2a3545[_0x5368('0x47')]['length']?_0x2a3545[_0x5368('0x47')]:_0x233bf6[_0x5368('0x46')];if(_0x1791d4[_0x5368('0x43')][_0x5368('0x54')]){_0x2a3545[_0x5368('0x55')]=[{'all':!![]}];}_0x2a3545=_[_0x5368('0x50')]({},_0x2a3545,_0x1791d4['options']);return db[_0x5368('0x3e')]['find'](_0x2a3545)[_0x5368('0x36')](handleEntityNotFound(_0xabc024,null))[_0x5368('0x36')](respondWithResult(_0xabc024,null))[_0x5368('0x2b')](handleError(_0xabc024,null));};exports[_0x5368('0x59')]=function(_0xe348e1,_0x257a24){return db[_0x5368('0x3e')]['create'](_0xe348e1[_0x5368('0x5a')],{})[_0x5368('0x36')](function(_0x45bba1){var _0x3822ff=_0xe348e1[_0x5368('0x5b')][_0x5368('0x37')]({'plain':!![]});if(!_0x3822ff)throw new Error(_0x5368('0x5c'));if(_0x3822ff[_0x5368('0x5d')]===_0x5368('0x5b')){var _0x15c126=_0x45bba1[_0x5368('0x37')]({'plain':!![]});var _0xd9f792=_0x5368('0x5e');return db['UserProfileSection']['find']({'where':{'name':_0xd9f792,'userProfileId':_0x3822ff['userProfileId']},'raw':!![]})[_0x5368('0x36')](function(_0x32532a){if(_0x32532a&&_0x32532a[_0x5368('0x5f')]===0x0){return db[_0x5368('0x38')]['create']({'name':_0x15c126['name'],'resourceId':_0x15c126['id'],'type':_0x32532a[_0x5368('0x3a')],'sectionId':_0x32532a['id']},{})[_0x5368('0x36')](function(){return _0x45bba1;});}else{return _0x45bba1;}})[_0x5368('0x2b')](function(_0x4d1793){logger[_0x5368('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d1793);throw _0x4d1793;});}return _0x45bba1;})[_0x5368('0x36')](respondWithResult(_0x257a24,0xc9))[_0x5368('0x2b')](handleError(_0x257a24,null));};exports[_0x5368('0x60')]=function(_0x39f44f,_0x3a62f7){if(_0x39f44f['body']['id']){delete _0x39f44f[_0x5368('0x5a')]['id'];}return db[_0x5368('0x3e')][_0x5368('0x61')]({'where':{'id':_0x39f44f['params']['id']},'include':[{'model':db['Pause'],'as':_0x5368('0x3d')}]})[_0x5368('0x36')](handleEntityNotFound(_0x3a62f7,null))['then'](saveUpdates(_0x39f44f['body'],null))[_0x5368('0x36')](respondWithResult(_0x3a62f7,null))[_0x5368('0x2b')](handleError(_0x3a62f7,null));};exports[_0x5368('0x62')]=function(_0x5834d6,_0x2b5cb3){return db[_0x5368('0x3e')][_0x5368('0x61')]({'where':{'id':_0x5834d6[_0x5368('0x58')]['id']}})['then'](handleEntityNotFound(_0x2b5cb3,null))[_0x5368('0x36')](removeEntity(_0x2b5cb3,null))['catch'](handleError(_0x2b5cb3,null));};exports[_0x5368('0x63')]=function(_0xfbb98c,_0x1c2da8){return db['OpenchannelAccount'][_0x5368('0x63')]()[_0x5368('0x36')](respondWithResult(_0x1c2da8,null))[_0x5368('0x2b')](handleError(_0x1c2da8,null));};exports[_0x5368('0x64')]=function(_0x3a8863,_0x3f10b2,_0x2cd882){if(_0x3a8863[_0x5368('0x5a')]['id']){delete _0x3a8863[_0x5368('0x5a')]['id'];}return db[_0x5368('0x3e')][_0x5368('0x61')]({'where':{'id':_0x3a8863[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x3f10b2,null))[_0x5368('0x36')](function(_0x27e47a){if(_0x27e47a){_0x3a8863[_0x5368('0x5a')][_0x5368('0x65')]=_0x27e47a['id'];return db[_0x5368('0x66')][_0x5368('0x59')](_0x3a8863['body']);}})[_0x5368('0x36')](respondWithResult(_0x3f10b2,null))[_0x5368('0x2b')](handleError(_0x3f10b2,null));};exports[_0x5368('0x67')]=function(_0x486ab6,_0x35ff81,_0x2f9c6e){var _0xab0f2e={'raw':![],'where':{}};var _0x1d2d60={};var _0x433096={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x486ab6['params']['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x35ff81,null))[_0x5368('0x36')](function(_0x14b946){if(_0x14b946){_0x1d2d60['model']=_[_0x5368('0x42')](db['Disposition']['rawAttributes']);_0x1d2d60[_0x5368('0x43')]=_[_0x5368('0x42')](_0x486ab6[_0x5368('0x43')]);_0x1d2d60[_0x5368('0x44')]=_[_0x5368('0x45')](_0x1d2d60[_0x5368('0x46')],_0x1d2d60[_0x5368('0x43')]);_0xab0f2e[_0x5368('0x47')]=_[_0x5368('0x45')](_0x1d2d60[_0x5368('0x46')],qs['fields'](_0x486ab6[_0x5368('0x43')][_0x5368('0x48')]));_0xab0f2e[_0x5368('0x47')]=_0xab0f2e['attributes'][_0x5368('0x49')]?_0xab0f2e[_0x5368('0x47')]:_0x1d2d60[_0x5368('0x46')];if(!_0x486ab6['query'][_0x5368('0x4a')](_0x5368('0x68'))){_0xab0f2e['limit']=qs[_0x5368('0x32')](_0x486ab6['query'][_0x5368('0x32')]);_0xab0f2e['offset']=qs[_0x5368('0x30')](_0x486ab6[_0x5368('0x43')][_0x5368('0x30')]);}_0xab0f2e['order']=qs['sort'](_0x486ab6[_0x5368('0x43')][_0x5368('0x4c')]);_0xab0f2e[_0x5368('0x4d')]=qs[_0x5368('0x44')](_['pick'](_0x486ab6['query'],_0x1d2d60[_0x5368('0x44')]));_0xab0f2e['where'][_0x5368('0x65')]=_0x14b946['id'];if(_0x486ab6['query'][_0x5368('0x4f')]){_0xab0f2e['where']=_['merge'](_0xab0f2e[_0x5368('0x4d')],{'$or':_['map'](_0xab0f2e[_0x5368('0x47')],function(_0x3119a0){var _0x4c1a45={};_0x4c1a45[_0x3119a0]={'$like':'%'+_0x486ab6[_0x5368('0x43')][_0x5368('0x4f')]+'%'};return _0x4c1a45;})});}_0xab0f2e=_[_0x5368('0x50')]({},_0xab0f2e,_0x486ab6[_0x5368('0x53')]);return db['Disposition'][_0x5368('0x33')]({'where':_0xab0f2e[_0x5368('0x4d')]})[_0x5368('0x36')](function(_0x17a080){_0x433096[_0x5368('0x33')]=_0x17a080;if(_0x486ab6[_0x5368('0x43')]['includeAll']){_0xab0f2e[_0x5368('0x55')]=[{'all':!![]}];}return db[_0x5368('0x66')][_0x5368('0x69')](_0xab0f2e);})[_0x5368('0x36')](function(_0xb94224){_0x433096[_0x5368('0x56')]=_0xb94224;return _0x433096;});}})[_0x5368('0x36')](respondWithFilteredResult(_0x35ff81,_0xab0f2e))[_0x5368('0x2b')](handleError(_0x35ff81,null));};exports[_0x5368('0x6a')]=function(_0x58fbd5,_0x9edb90,_0x3a2453){return db[_0x5368('0x3e')][_0x5368('0x61')]({'where':{'id':_0x58fbd5[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x9edb90,null))[_0x5368('0x36')](function(_0x290bb8){if(_0x290bb8){return _0x290bb8[_0x5368('0x6a')](_0x58fbd5[_0x5368('0x43')][_0x5368('0x6b')]);}})[_0x5368('0x36')](respondWithStatusCode(_0x9edb90,null))[_0x5368('0x2b')](handleError(_0x9edb90,null));};exports[_0x5368('0x6c')]=function(_0x4e0ed0,_0x368f6c,_0x85ca09){if(_0x4e0ed0['body']['id']){delete _0x4e0ed0[_0x5368('0x5a')]['id'];}return db['OpenchannelAccount'][_0x5368('0x61')]({'where':{'id':_0x4e0ed0[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x368f6c,null))['then'](function(_0x2e93c8){if(_0x2e93c8){_0x4e0ed0[_0x5368('0x5a')]['OpenchannelAccountId']=_0x2e93c8['id'];return db[_0x5368('0x6d')][_0x5368('0x59')](_0x4e0ed0[_0x5368('0x5a')]);}})[_0x5368('0x36')](respondWithResult(_0x368f6c,null))[_0x5368('0x2b')](handleError(_0x368f6c,null));};exports[_0x5368('0x6e')]=function(_0x10656a,_0xd242f3,_0x58955f){var _0x2af3f6={'raw':![],'where':{}};var _0x3d6472={};var _0x3f8bec={'count':0x0,'rows':[]};return db[_0x5368('0x3e')]['findOne']({'where':{'id':_0x10656a[_0x5368('0x58')]['id']}})['then'](handleEntityNotFound(_0xd242f3,null))['then'](function(_0x599fc8){if(_0x599fc8){_0x3d6472['model']=_[_0x5368('0x42')](db['CannedAnswer'][_0x5368('0x3f')]);_0x3d6472['query']=_[_0x5368('0x42')](_0x10656a[_0x5368('0x43')]);_0x3d6472['filters']=_[_0x5368('0x45')](_0x3d6472['model'],_0x3d6472[_0x5368('0x43')]);_0x2af3f6[_0x5368('0x47')]=_[_0x5368('0x45')](_0x3d6472['model'],qs[_0x5368('0x48')](_0x10656a[_0x5368('0x43')][_0x5368('0x48')]));_0x2af3f6[_0x5368('0x47')]=_0x2af3f6[_0x5368('0x47')][_0x5368('0x49')]?_0x2af3f6[_0x5368('0x47')]:_0x3d6472[_0x5368('0x46')];if(!_0x10656a[_0x5368('0x43')]['hasOwnProperty'](_0x5368('0x68'))){_0x2af3f6[_0x5368('0x32')]=qs[_0x5368('0x32')](_0x10656a['query'][_0x5368('0x32')]);_0x2af3f6['offset']=qs[_0x5368('0x30')](_0x10656a[_0x5368('0x43')]['offset']);}_0x2af3f6['order']=qs[_0x5368('0x4c')](_0x10656a[_0x5368('0x43')][_0x5368('0x4c')]);_0x2af3f6[_0x5368('0x4d')]=qs['filters'](_[_0x5368('0x4e')](_0x10656a[_0x5368('0x43')],_0x3d6472[_0x5368('0x44')]));_0x2af3f6[_0x5368('0x4d')][_0x5368('0x65')]=_0x599fc8['id'];if(_0x10656a[_0x5368('0x43')][_0x5368('0x4f')]){_0x2af3f6['where']=_[_0x5368('0x50')](_0x2af3f6[_0x5368('0x4d')],{'$or':_[_0x5368('0x41')](_0x2af3f6[_0x5368('0x47')],function(_0xde62e9){var _0xc4d3ad={};_0xc4d3ad[_0xde62e9]={'$like':'%'+_0x10656a[_0x5368('0x43')][_0x5368('0x4f')]+'%'};return _0xc4d3ad;})});}_0x2af3f6=_[_0x5368('0x50')]({},_0x2af3f6,_0x10656a['options']);return db[_0x5368('0x6d')][_0x5368('0x33')]({'where':_0x2af3f6[_0x5368('0x4d')]})[_0x5368('0x36')](function(_0x5d4ff1){_0x3f8bec[_0x5368('0x33')]=_0x5d4ff1;if(_0x10656a[_0x5368('0x43')][_0x5368('0x54')]){_0x2af3f6[_0x5368('0x55')]=[{'all':!![]}];}return db[_0x5368('0x6d')][_0x5368('0x69')](_0x2af3f6);})[_0x5368('0x36')](function(_0x3cf884){_0x3f8bec[_0x5368('0x56')]=_0x3cf884;return _0x3f8bec;});}})['then'](respondWithFilteredResult(_0xd242f3,_0x2af3f6))[_0x5368('0x2b')](handleError(_0xd242f3,null));};exports[_0x5368('0x6f')]=function(_0x5c9afa,_0x21a7b0,_0x14a279){return db[_0x5368('0x3e')][_0x5368('0x61')]({'where':{'id':_0x5c9afa[_0x5368('0x58')]['id']}})['then'](handleEntityNotFound(_0x21a7b0,null))[_0x5368('0x36')](function(_0x28e592){if(_0x28e592){return _0x28e592[_0x5368('0x6f')](_0x5c9afa['query'][_0x5368('0x6b')]);}})[_0x5368('0x36')](respondWithStatusCode(_0x21a7b0,null))[_0x5368('0x2b')](handleError(_0x21a7b0,null));};exports[_0x5368('0x70')]=function(_0x257e05,_0x2dc9a1,_0x1f5122){var _0x30ce99={'body':_0x257e05[_0x5368('0x5a')],'channel':_0x5368('0x71')};var _0x19836f=[];var _0x50137e=[];var _0x117590={};var _0x45b55e=![];return db[_0x5368('0x72')][_0x5368('0x63')]()['then'](function(_0x2dbe1e){if(!_0x2dbe1e){throw new db['Sequelize'][(_0x5368('0x73'))]('no\x20available\x20attributes');}_0x19836f=_[_0x5368('0x74')](_[_0x5368('0x42')](_0x2dbe1e),['createdAt','updatedAt']);_0x50137e=_[_0x5368('0x74')](_[_0x5368('0x42')](_0x2dbe1e),['createdAt','updatedAt','CompanyId',_0x5368('0x75')]);if(_0x257e05[_0x5368('0x5a')]['id']){delete _0x257e05['body']['id'];}if(_[_0x5368('0x76')](_0x257e05['body'][_0x5368('0x77')])){throw new db[(_0x5368('0x78'))][(_0x5368('0x73'))](_0x5368('0x79'));}if(_[_0x5368('0x76')](_0x257e05['body']['body'])||_0x257e05['body'][_0x5368('0x5a')]===''){throw new db[(_0x5368('0x78'))][(_0x5368('0x73'))](_0x5368('0x7a'));}if(_[_0x5368('0x76')](_0x257e05[_0x5368('0x5a')][_0x5368('0x7b')])){throw new db['Sequelize']['ValidationError'](_0x5368('0x7c')+_0x50137e);}if(!_[_0x5368('0x7d')](_0x50137e,_0x257e05[_0x5368('0x5a')]['mapKey'])){throw new db['Sequelize'][(_0x5368('0x73'))](_0x5368('0x7e')+_0x50137e);}_0x117590[_0x257e05[_0x5368('0x5a')][_0x5368('0x7b')]]=_0x257e05[_0x5368('0x5a')][_0x5368('0x77')];})[_0x5368('0x36')](function(){return db['OpenchannelAccount'][_0x5368('0x61')]({'where':{'id':_0x257e05['params']['id']},'include':[{'model':db[_0x5368('0x7f')],'as':_0x5368('0x80'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x117590,'limit':0x1,'order':[[_0x5368('0x81'),_0x5368('0x82')]]}]},{'model':db[_0x5368('0x83')],'as':'Applications'}]});})[_0x5368('0x36')](handleEntityNotFound(_0x2dc9a1,null))[_0x5368('0x36')](function(_0x28b8d9){if(_0x28b8d9&&_0x28b8d9[_0x5368('0x80')]){_0x30ce99['account']=_0x28b8d9;_0x30ce99['applications']=_0x28b8d9[_0x5368('0x84')];_0x30ce99[_0x5368('0x85')]=_0x28b8d9[_0x5368('0x80')];_0x30ce99['applications']=_[_0x5368('0x86')](_0x30ce99[_0x5368('0x87')],[_0x5368('0x88')],[_0x5368('0x89')]);if(_0x30ce99['account'][_0x5368('0x84')]){delete _0x30ce99['account']['Applications'];}if(_0x30ce99[_0x5368('0x8a')][_0x5368('0x80')]&&_0x30ce99['account'][_0x5368('0x80')][_0x5368('0x8b')][_0x5368('0x49')]){return _0x30ce99['account'][_0x5368('0x80')][_0x5368('0x8b')][0x0];}var _0x15f2af=_[_0x5368('0x8c')](_0x257e05['body'],{'firstName':_0x257e05[_0x5368('0x5a')][_0x5368('0x77')],'ListId':_0x28b8d9[_0x5368('0x75')]});_0x15f2af[_0x257e05[_0x5368('0x5a')][_0x5368('0x7b')]]=_0x257e05[_0x5368('0x5a')]['from'];return db[_0x5368('0x72')][_0x5368('0x59')](_0x15f2af,{'fields':_0x19836f,'raw':!![]});}})[_0x5368('0x36')](handleEntityNotFound(_0x2dc9a1,null))[_0x5368('0x36')](function(_0x1c1854){_0x30ce99[_0x5368('0x8d')]=_0x1c1854;if(_0x1c1854){var _0x587058={'ContactId':_0x1c1854['id'],'OpenchannelAccountId':_0x257e05[_0x5368('0x58')]['id'],'from':(_0x1c1854[_0x5368('0x8e')]||'')+'\x20'+(_0x1c1854[_0x5368('0x8f')]||'')};var _0x5215dd={'OpenchannelAccountId':_0x257e05['params']['id'],'closed':![]};if(_0x257e05[_0x5368('0x5a')][_0x5368('0x90')]){_0x5215dd[_0x5368('0x90')]=_0x257e05[_0x5368('0x5a')]['threadId'];return db[_0x5368('0x91')][_0x5368('0x61')]({'where':_0x5215dd})[_0x5368('0x36')](function(_0x2d62ae){if(_0x2d62ae){return[_0x2d62ae,![]];}_0x587058[_0x5368('0x90')]=_0x257e05['body'][_0x5368('0x90')];_0x587058[_0x5368('0x92')]=_0x257e05['body'][_0x5368('0x92')];return db[_0x5368('0x91')]['create'](_0x587058)[_0x5368('0x36')](function(_0x5766d4){return[_0x5766d4,!![]];});});}else{_0x5215dd[_0x5368('0x90')]=null;}_0x5215dd['ContactId']=_0x1c1854['id'];return db['OpenchannelInteraction'][_0x5368('0x61')]({'where':_0x5215dd})[_0x5368('0x36')](function(_0x2bbd48){if(_0x2bbd48){return[_0x2bbd48,![]];}return db[_0x5368('0x91')]['create'](_0x587058)[_0x5368('0x36')](function(_0x5a7aa5){return[_0x5a7aa5,!![]];});});}})['spread'](function(_0x1698f3,_0x1fb94a){if(_0x1698f3){_0x45b55e=_0x1fb94a;if(!_0x1fb94a){var _0x4ae15a={'from':(_0x30ce99[_0x5368('0x8d')]['firstName']||'')+'\x20'+(_0x30ce99[_0x5368('0x8d')][_0x5368('0x8f')]||'')};if(_0x257e05['body']['threadId']&&_0x257e05[_0x5368('0x5a')]['messageId']&&_0x257e05[_0x5368('0x5a')][_0x5368('0x90')]!=_0x257e05['body'][_0x5368('0x93')]){_0x4ae15a[_0x5368('0x90')]=_0x257e05[_0x5368('0x5a')][_0x5368('0x93')];}return _0x1698f3[_0x5368('0x60')](_0x4ae15a);}else{return _0x1698f3;}}})['then'](function(_0x393a21){_0x30ce99[_0x5368('0x94')]=_0x393a21[_0x5368('0x37')]({'plain':!![]});_0x30ce99[_0x5368('0x94')]['created']=_0x45b55e;if(_0x30ce99['interaction'][_0x5368('0x95')]){if(_0x30ce99[_0x5368('0x8a')][_0x5368('0x96')]){_0x30ce99['applications'][_0x5368('0x97')]({'id':0x0,'priority':_0x30ce99[_0x5368('0x87')][_0x5368('0x49')]+0x1,'app':_0x5368('0x98'),'appdata':_0x5368('0x99'),'interval':_0x5368('0x9a')});}}return db[_0x5368('0x9b')][_0x5368('0x59')]({'body':_0x257e05[_0x5368('0x5a')][_0x5368('0x5a')],'OpenchannelAccountId':_0x257e05[_0x5368('0x58')]['id'],'OpenchannelInteractionId':_0x393a21['id'],'direction':'in','ContactId':_0x30ce99[_0x5368('0x8d')]['id'],'AttachmentId':_0x257e05['body'][_0x5368('0x9c')]});})['then'](function(_0x144e42){_0x30ce99[_0x5368('0x28')]=_0x144e42;if(_0x30ce99[_0x5368('0x94')][_0x5368('0x9d')]){return db[_0x5368('0x9e')][_0x5368('0x61')]({'attributes':['id',_0x5368('0x3a')],'where':{'id':_0x30ce99[_0x5368('0x94')][_0x5368('0x9d')]}})[_0x5368('0x36')](function(_0x5adf53){if(_0x5adf53){_0x30ce99[_0x5368('0x87')][_0x5368('0x9f')]({'id':0x0,'priority':0x0,'app':_0x5368('0xa0'),'appdata':_0x5adf53[_0x5368('0x3a')]+','+(_0x30ce99['account'][_0x5368('0xa1')]||0xa),'interval':_0x5368('0x9a')});_0x30ce99[_0x5368('0xa2')]=![];}return respondWithRpcPromise(_0x5368('0xa3'),'startRouting',_0x30ce99);});}return respondWithRpcPromise(_0x5368('0xa3'),_0x5368('0xa4'),_0x30ce99);})['then'](function(_0x472252){respondWithRpcPromise(_0x5368('0xa5'),'EventManager',{'event':'notify','message':_0x472252},client9002);return _0x472252;})['then'](respondWithResult(_0x2dc9a1,null))[_0x5368('0x2b')](handleError(_0x2dc9a1,null));};exports[_0x5368('0xa6')]=function(_0x1ddf1f,_0x9cd24b){var _0x40e0c2=_0x1ddf1f[_0x5368('0x58')]['id'];var _0x5c68e4=_0x1ddf1f[_0x5368('0x5a')];var _0xefea41=0xc8;var _0x3c104d=null;return db[_0x5368('0xa7')][_0x5368('0xa8')]({'isolationLevel':db[_0x5368('0xa7')][_0x5368('0xa9')][_0x5368('0xaa')][_0x5368('0xab')]},function(_0x14ac47){return db['OpenchannelAccount'][_0x5368('0xac')]({'where':{'id':_0x40e0c2},'transaction':_0x14ac47})[_0x5368('0x36')](function(_0x29ab8c){if(_0x29ab8c){return db[_0x5368('0x83')][_0x5368('0x62')]({'where':{'OpenchannelAccountId':_0x40e0c2},'transaction':_0x14ac47})[_0x5368('0x36')](function(){var _0x1ca4b9=_['map'](_0x5c68e4,function(_0x106d8a){_0x106d8a[_0x5368('0x65')]=_0x40e0c2;return _0x106d8a;});return db[_0x5368('0x83')]['bulkCreate'](_0x1ca4b9,{'transaction':_0x14ac47});});}else{_0xefea41=0x194;_0x3c104d=[];}});})[_0x5368('0x36')](function(){if(_0xefea41!==0x194){return db['OpenchannelApplication'][_0x5368('0xad')]({'where':{'OpenchannelAccountId':_0x40e0c2},'order':_0x5368('0x88')})['then'](function(_0x20fd08){_0x3c104d=_0x20fd08;});}})[_0x5368('0x2b')](function(_0x3fbdbf){_0xefea41=0x1f4;logger['error'](_0x3fbdbf[_0x5368('0x39')]);if(_0x3fbdbf[_0x5368('0x3a')]){delete _0x3fbdbf['name'];}_0x3c104d=_0x3fbdbf;})[_0x5368('0xae')](function(){if(_0x3c104d===null){_0x9cd24b[_0x5368('0x2c')](_0xefea41);}else{if(_0xefea41===0x1f4){_0x9cd24b[_0x5368('0x2d')](_0xefea41)[_0x5368('0xaf')](_0x3c104d);}else{_0x9cd24b[_0x5368('0x2d')](_0xefea41)['json'](_0x3c104d);}}});};exports[_0x5368('0xb0')]=function(_0x256053,_0xabf083,_0x33393c){var _0x4a6d52={};var _0x235c86={};var _0xffbfa8;var _0x2db9d9;return db[_0x5368('0x3e')]['findOne']({'where':{'id':_0x256053[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0xabf083,null))['then'](function(_0x5c5eb2){if(_0x5c5eb2){_0xffbfa8=_0x5c5eb2;_0x235c86[_0x5368('0x46')]=_[_0x5368('0x42')](db['OpenchannelApplication'][_0x5368('0x3f')]);_0x235c86[_0x5368('0x43')]=_[_0x5368('0x42')](_0x256053[_0x5368('0x43')]);_0x235c86[_0x5368('0x44')]=_[_0x5368('0x45')](_0x235c86[_0x5368('0x46')],_0x235c86[_0x5368('0x43')]);_0x4a6d52[_0x5368('0x47')]=_['intersection'](_0x235c86['model'],qs['fields'](_0x256053[_0x5368('0x43')]['fields']));_0x4a6d52[_0x5368('0x47')]=_0x4a6d52[_0x5368('0x47')][_0x5368('0x49')]?_0x4a6d52[_0x5368('0x47')]:_0x235c86['model'];_0x4a6d52[_0x5368('0x4b')]=qs[_0x5368('0x4c')](_0x256053['query'][_0x5368('0x4c')]);_0x4a6d52[_0x5368('0x4d')]=qs[_0x5368('0x44')](_[_0x5368('0x4e')](_0x256053['query'],_0x235c86[_0x5368('0x44')]));if(_0x256053['query'][_0x5368('0x4f')]){_0x4a6d52[_0x5368('0x4d')]=_['merge'](_0x4a6d52[_0x5368('0x4d')],{'$or':_[_0x5368('0x41')](_0x4a6d52['attributes'],function(_0x3d1195){var _0x336f42={};_0x336f42[_0x3d1195]={'$like':'%'+_0x256053['query'][_0x5368('0x4f')]+'%'};return _0x336f42;})});}_0x4a6d52=_[_0x5368('0x50')]({},_0x4a6d52,_0x256053[_0x5368('0x53')]);return _0xffbfa8[_0x5368('0xb0')](_0x4a6d52);}})[_0x5368('0x36')](function(_0x3d73a9){if(_0x3d73a9){_0x2db9d9=_0x3d73a9['length'];if(!_0x256053[_0x5368('0x43')][_0x5368('0x4a')](_0x5368('0x68'))){_0x4a6d52['limit']=qs[_0x5368('0x32')](_0x256053[_0x5368('0x43')]['limit']);_0x4a6d52['offset']=qs['offset'](_0x256053[_0x5368('0x43')][_0x5368('0x30')]);}return _0xffbfa8[_0x5368('0xb0')](_0x4a6d52);}})[_0x5368('0x36')](function(_0x35aeb6){if(_0x35aeb6){return _0x35aeb6?{'count':_0x2db9d9,'rows':_0x35aeb6}:null;}})['then'](respondWithResult(_0xabf083,null))[_0x5368('0x2b')](handleError(_0xabf083,null));};exports['getInteractions']=function(_0x28b901,_0x31943c,_0x3f72c7){var _0x18e5c6={'raw':![],'where':{}};var _0x5e1193={};var _0x1b71e0={'count':0x0,'rows':[]};return db[_0x5368('0x3e')]['findOne']({'where':{'id':_0x28b901[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x31943c,null))['then'](function(_0xdb07d3){if(_0xdb07d3){_0x5e1193['model']=_[_0x5368('0x42')](db[_0x5368('0x91')][_0x5368('0x3f')]);_0x5e1193[_0x5368('0x43')]=_[_0x5368('0x42')](_0x28b901[_0x5368('0x43')]);_0x5e1193[_0x5368('0x44')]=_[_0x5368('0x45')](_0x5e1193[_0x5368('0x46')],_0x5e1193['query']);_0x18e5c6[_0x5368('0x47')]=_[_0x5368('0x45')](_0x5e1193[_0x5368('0x46')],qs[_0x5368('0x48')](_0x28b901[_0x5368('0x43')][_0x5368('0x48')]));_0x18e5c6[_0x5368('0x47')]=_0x18e5c6[_0x5368('0x47')][_0x5368('0x49')]?_0x18e5c6[_0x5368('0x47')]:_0x5e1193[_0x5368('0x46')];if(!_0x28b901[_0x5368('0x43')]['hasOwnProperty']('nolimit')){_0x18e5c6[_0x5368('0x32')]=qs[_0x5368('0x32')](_0x28b901[_0x5368('0x43')][_0x5368('0x32')]);_0x18e5c6[_0x5368('0x30')]=qs['offset'](_0x28b901['query']['offset']);}_0x18e5c6[_0x5368('0x4b')]=qs['sort'](_0x28b901['query']['sort']);_0x18e5c6[_0x5368('0x4d')]=qs[_0x5368('0x44')](_[_0x5368('0x4e')](_0x28b901['query'],_0x5e1193['filters']));_0x18e5c6['where'][_0x5368('0x65')]=_0xdb07d3['id'];if(_0x28b901['query'][_0x5368('0x4f')]){_0x18e5c6[_0x5368('0x4d')]=_['merge'](_0x18e5c6[_0x5368('0x4d')],{'$or':_[_0x5368('0x41')](_0x18e5c6['attributes'],function(_0x46a793){var _0x532f3d={};_0x532f3d[_0x46a793]={'$like':'%'+_0x28b901[_0x5368('0x43')]['filter']+'%'};return _0x532f3d;})});}_0x18e5c6=_[_0x5368('0x50')]({},_0x18e5c6,_0x28b901['options']);return db[_0x5368('0x91')]['count']({'where':_0x18e5c6[_0x5368('0x4d')]})['then'](function(_0x2a80a3){_0x1b71e0[_0x5368('0x33')]=_0x2a80a3;if(_0x28b901[_0x5368('0x43')][_0x5368('0x54')]){_0x18e5c6[_0x5368('0x55')]=[{'model':db['CmContact'],'as':_0x5368('0xb1'),'required':![]},{'model':db[_0x5368('0x9e')],'as':_0x5368('0xb2'),'attributes':['name','fullname',_0x5368('0xb3')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5368('0x3a'),_0x5368('0xb4')],'where':_0x28b901['query']['tag']?{'id':_0x28b901[_0x5368('0x43')][_0x5368('0xb5')]}:undefined,'required':_0x28b901[_0x5368('0x43')][_0x5368('0xb5')]?!![]:![]}];}return db[_0x5368('0x91')]['findAll'](_0x18e5c6);})['then'](function(_0x2f2bea){_0x1b71e0['rows']=_0x2f2bea;return _0x1b71e0;});}})[_0x5368('0x36')](respondWithFilteredResult(_0x31943c,_0x18e5c6))[_0x5368('0x2b')](handleError(_0x31943c,null));};exports[_0x5368('0xb6')]=function(_0x4f4e70,_0x5ba0b5,_0x2ad6a1){return db[_0x5368('0x3e')]['find']({'where':{'id':_0x4f4e70[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x5ba0b5,null))[_0x5368('0x36')](function(_0x457731){if(_0x457731){return _0x457731[_0x5368('0xb6')](_0x4f4e70[_0x5368('0x5a')]['ids'],_[_0x5368('0xb7')](_0x4f4e70['body'],['ids','id'])||{})[_0x5368('0xb8')](function(_0x2caf23){for(var _0x41a1eb=0x0;_0x41a1eb<_0x4f4e70[_0x5368('0x5a')][_0x5368('0x6b')]['length'];_0x41a1eb+=0x1){socket[_0x5368('0xb9')](_0x5368('0xba'),{'UserId':Number(_0x4f4e70[_0x5368('0x5a')][_0x5368('0x6b')][_0x41a1eb]),'OpenchannelAccountId':Number(_0x4f4e70['params']['id'])});}return _0x2caf23;});}})[_0x5368('0x36')](respondWithResult(_0x5ba0b5,null))['catch'](handleError(_0x5ba0b5,null));};exports[_0x5368('0xbb')]=function(_0x524b54,_0x2b9f4a,_0x540185){return db[_0x5368('0x3e')][_0x5368('0x61')]({'where':{'id':_0x524b54[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x2b9f4a,null))['then'](function(_0x353e06){if(_0x353e06){return _0x353e06[_0x5368('0xbb')](_0x524b54[_0x5368('0x43')][_0x5368('0x6b')])[_0x5368('0x36')](function(){if(_['isArray'](_0x524b54[_0x5368('0x43')]['ids'])){for(var _0x5d03f5=0x0;_0x5d03f5<_0x524b54[_0x5368('0x43')][_0x5368('0x6b')][_0x5368('0x49')];_0x5d03f5+=0x1){socket[_0x5368('0xb9')](_0x5368('0xbc'),{'UserId':Number(_0x524b54[_0x5368('0x43')][_0x5368('0x6b')][_0x5d03f5]),'OpenchannelAccountId':Number(_0x524b54[_0x5368('0x58')]['id'])});}}else{socket[_0x5368('0xb9')](_0x5368('0xbc'),{'UserId':Number(_0x524b54[_0x5368('0x43')][_0x5368('0x6b')]),'OpenchannelAccountId':Number(_0x524b54[_0x5368('0x58')]['id'])});}});}})[_0x5368('0x36')](respondWithStatusCode(_0x2b9f4a,null))[_0x5368('0x2b')](handleError(_0x2b9f4a,null));};exports[_0x5368('0xbd')]=function(_0x1522a0,_0x5e6f98,_0x11a12d){var _0x4f0c20={};var _0x1c0922={};var _0x54c9e3;var _0x6ac54f;return db[_0x5368('0x3e')][_0x5368('0xac')]({'where':{'id':_0x1522a0[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x5e6f98,null))[_0x5368('0x36')](function(_0x1f6cdb){if(_0x1f6cdb){_0x54c9e3=_0x1f6cdb;_0x1c0922[_0x5368('0x46')]=_[_0x5368('0x42')](db[_0x5368('0x9e')][_0x5368('0x3f')]);_0x1c0922[_0x5368('0x43')]=_[_0x5368('0x42')](_0x1522a0[_0x5368('0x43')]);_0x1c0922[_0x5368('0x44')]=_[_0x5368('0x45')](_0x1c0922['model'],_0x1c0922[_0x5368('0x43')]);_0x4f0c20['attributes']=_['intersection'](_0x1c0922[_0x5368('0x46')],qs[_0x5368('0x48')](_0x1522a0['query'][_0x5368('0x48')]));_0x4f0c20['attributes']=_0x4f0c20[_0x5368('0x47')][_0x5368('0x49')]?_0x4f0c20[_0x5368('0x47')]:_0x1c0922[_0x5368('0x46')];_0x4f0c20['order']=qs[_0x5368('0x4c')](_0x1522a0['query']['sort']);_0x4f0c20[_0x5368('0x4d')]=qs[_0x5368('0x44')](_[_0x5368('0x4e')](_0x1522a0[_0x5368('0x43')],_0x1c0922[_0x5368('0x44')]));if(_0x1522a0['query'][_0x5368('0x4f')]){_0x4f0c20['where']=_[_0x5368('0x50')](_0x4f0c20[_0x5368('0x4d')],{'$or':_['map'](_0x4f0c20[_0x5368('0x47')],function(_0x32f255){var _0x399ad3={};_0x399ad3[_0x32f255]={'$like':'%'+_0x1522a0[_0x5368('0x43')][_0x5368('0x4f')]+'%'};return _0x399ad3;})});}_0x4f0c20=_[_0x5368('0x50')]({},_0x4f0c20,_0x1522a0['options']);return _0x54c9e3[_0x5368('0xbd')](_0x4f0c20);}})[_0x5368('0x36')](function(_0xca43c1){if(_0xca43c1){_0x6ac54f=_0xca43c1[_0x5368('0x49')];if(!_0x1522a0[_0x5368('0x43')]['hasOwnProperty']('nolimit')){_0x4f0c20[_0x5368('0x32')]=qs['limit'](_0x1522a0[_0x5368('0x43')]['limit']);_0x4f0c20[_0x5368('0x30')]=qs['offset'](_0x1522a0[_0x5368('0x43')][_0x5368('0x30')]);}return _0x54c9e3[_0x5368('0xbd')](_0x4f0c20);}})[_0x5368('0x36')](function(_0x34ff41){if(_0x34ff41){return _0x34ff41?{'count':_0x6ac54f,'rows':_0x34ff41}:null;}})['then'](respondWithResult(_0x5e6f98,null))[_0x5368('0x2b')](handleError(_0x5e6f98,null));};exports[_0x5368('0xaf')]=function(_0x50c80d,_0x2d93e0,_0x227e79){var _0x5c9436,_0x2a3692,_0x2719cd;if(_[_0x5368('0x76')](_0x50c80d[_0x5368('0x5a')]['body'])||_0x50c80d[_0x5368('0x5a')]['body']===''){throw new db['Sequelize'][(_0x5368('0x73'))](_0x5368('0x7a'));}if(_['isNil'](_0x50c80d[_0x5368('0x5a')]['to'])){}_0x5c9436=_0x50c80d[_0x5368('0x5a')]['to'];return db[_0x5368('0x3e')][_0x5368('0xac')]({'where':{'id':_0x50c80d[_0x5368('0x58')]['id']}})[_0x5368('0x36')](handleEntityNotFound(_0x2d93e0,null))[_0x5368('0x36')](function(_0x2960b7){if(_0x2960b7){return db[_0x5368('0x3e')]['find']({'where':{'id':_0x2960b7['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x5368('0x72')],'as':_0x5368('0x8b'),'where':{[_0x2960b7['mapKey']]:_0x5c9436},'limit':0x1,'order':[[_0x5368('0x81'),_0x5368('0x82')]]}]}]})[_0x5368('0x36')](handleEntityNotFound(_0x2d93e0,null))[_0x5368('0x36')](function(_0x290397){if(_0x290397&&_0x290397[_0x5368('0x80')]){_0x2a3692=_0x290397['get']({'plain':!![]});if(_0x2a3692['List']&&_0x2a3692[_0x5368('0x80')][_0x5368('0x8b')][_0x5368('0x49')]){return _0x2a3692[_0x5368('0x80')][_0x5368('0x8b')][0x0];}return db['CmContact']['create'](_['defaults'](_0x50c80d[_0x5368('0x5a')],{'firstName':_0x5c9436,[_0x290397['mapKey']]:_0x5c9436,'phone':_0x5c9436,'ListId':_0x2a3692[_0x5368('0x75')]}));}})['then'](handleEntityNotFound(_0x2d93e0,null))[_0x5368('0x36')](function(_0x3584dd){if(_0x3584dd){_0x2719cd=_0x3584dd;return db['OpenchannelInteraction'][_0x5368('0x61')]({'where':{'ContactId':_0x2719cd['id'],'closed':![],'OpenchannelAccountId':_0x2a3692['id']}})['then'](function(_0x37edca){if(_0x37edca){return[_0x37edca,![]];}return db['OpenchannelInteraction'][_0x5368('0x59')]({'UserId':_0x50c80d[_0x5368('0x5b')]['id'],'ContactId':_0x2719cd['id'],'OpenchannelAccountId':_0x2a3692['id'],'lastMsgDirection':_0x5368('0xbe'),'firstMsgDirection':_0x5368('0xbe'),'Messages':[_[_0x5368('0x50')](_0x50c80d['body'],{'read':![],'body':_0x50c80d['body']['body'],'OpenchannelAccountId':_0x2a3692['id'],'UserId':_0x50c80d['user']['id'],'ContactId':_0x2719cd['id']})]},{'include':[{'model':db[_0x5368('0x9b')],'as':_0x5368('0xbf')}]})[_0x5368('0x36')](function(_0xb7eaa){return[_0xb7eaa,!![]];});});}})[_0x5368('0xb8')](function(_0x23f2e9,_0x429291){if(_0x429291){return _0x23f2e9;}return db['OpenchannelMessage'][_0x5368('0x59')](_[_0x5368('0x50')](_0x50c80d['body'],{'read':![],'body':_0x50c80d[_0x5368('0x5a')]['body'],'OpenchannelAccountId':_0x2a3692['id'],'OpenchannelInteractionId':_0x23f2e9['id'],'UserId':_0x50c80d[_0x5368('0x5b')]['id'],'ContactId':_0x2719cd['id']}))[_0x5368('0x36')](function(_0x1945f2){_0x23f2e9['dataValues']['Messages']=[];_0x23f2e9[_0x5368('0xc0')][_0x5368('0xbf')][_0x5368('0x97')](_0x1945f2[_0x5368('0xc0')]);return _0x23f2e9;});});}})['then'](respondWithResult(_0x2d93e0,null))[_0x5368('0x2b')](handleError(_0x2d93e0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7efacc4..e6d3772 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 _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x5e05e3,_0x178906){var _0x6e667f=function(_0xbe4374){while(--_0xbe4374){_0x5e05e3['push'](_0x5e05e3['shift']());}};_0x6e667f(++_0x178906);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var OpenchannelAccount=require(_0x0d8b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){OpenchannelAccountEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);OpenchannelAccountEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0d8b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x2dae=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x349e98,_0x56d779){var _0x5b419b=function(_0x21e50c){while(--_0x21e50c){_0x349e98['push'](_0x349e98['shift']());}};_0x5b419b(++_0x56d779);}(_0x2dae,0xc3));var _0xe2da=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0x2dae[_0x4d7116];return _0x4593dc;};'use strict';var EventEmitter=require(_0xe2da('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe2da('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe2da('0x2')](0x0);var events={'afterCreate':_0xe2da('0x3'),'afterUpdate':_0xe2da('0x4'),'afterDestroy':_0xe2da('0x5')};function emitEvent(_0x481d97){return function(_0x25b9f2,_0x439b5d,_0x77e45e){OpenchannelAccountEvents[_0xe2da('0x6')](_0x481d97+':'+_0x25b9f2['id'],_0x25b9f2);OpenchannelAccountEvents['emit'](_0x481d97,_0x25b9f2);_0x77e45e(null);};}for(var e in events){if(events[_0xe2da('0x7')](e)){var event=events[e];OpenchannelAccount[_0xe2da('0x8')](e,emitEvent(event));}}module[_0xe2da('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 54dcb7e..2efbe19 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(_0x5e2af9,_0x5808ec){var _0x25fbac=function(_0x2950f2){while(--_0x2950f2){_0x5e2af9['push'](_0x5e2af9['shift']());}};_0x25fbac(++_0x5808ec);}(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x38ef37,_0x3a9b9c){var _0x2a023d=function(_0xba16fa){while(--_0xba16fa){_0x38ef37['push'](_0x38ef37['shift']());}};_0x2a023d(++_0x3a9b9c);}(_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 34e7ebe..13592e6 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 _0xd4f4=['request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register'];(function(_0x5c7aa1,_0x2a9324){var _0x11a615=function(_0x3f75d4){while(--_0x3f75d4){_0x5c7aa1['push'](_0x5c7aa1['shift']());}};_0x11a615(++_0x2a9324);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3841df,_0x952aad){_0x3841df=_0x3841df-0x0;var _0x3a2a6c=_0xd4f4[_0x3841df];return _0x3a2a6c;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4d4f('0xb')]=_[_0x4d4f('0xc')](config[_0x4d4f('0xb')],{'host':_0x4d4f('0xd'),'port':0x18eb});var socket=require(_0x4d4f('0xe'))(new Redis(config[_0x4d4f('0xb')]));require(_0x4d4f('0xf'))[_0x4d4f('0x10')](socket);function respondWithRpcPromise(_0x385597,_0xba5200,_0x20db50){return new BPromise(function(_0x88b592,_0x128d39){return client[_0x4d4f('0x11')](_0x385597,_0x20db50)[_0x4d4f('0x12')](function(_0x28fb3e){logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xba5200,_0x4d4f('0x15'),JSON[_0x4d4f('0x16')](_0x28fb3e));if(_0x28fb3e['error']){if(_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x18')]===0x1f4){logger[_0x4d4f('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x128d39(_0x28fb3e[_0x4d4f('0x17')]['message']);}logger[_0x4d4f('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x88b592(_0x28fb3e[_0x4d4f('0x17')]['message']);}else{logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');_0x88b592(_0x28fb3e['result']['message']);}})['catch'](function(_0x5eebec){logger[_0x4d4f('0x17')](_0x4d4f('0x14'),_0xba5200,_0x5eebec);_0x128d39(_0x5eebec);});});} \ No newline at end of file +var _0xa25c=['error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x57c7cd,_0x5c074a){var _0xbe9d46=function(_0x9ea8e3){while(--_0x9ea8e3){_0x57c7cd['push'](_0x57c7cd['shift']());}};_0xbe9d46(++_0x5c074a);}(_0xa25c,0x13f));var _0xca25=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xa25c[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var moment=require(_0xca25('0x1'));var BPromise=require(_0xca25('0x2'));var rs=require(_0xca25('0x3'));var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))('rpc');var config=require(_0xca25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca25('0x9')]({'port':0x232a});config['redis']=_[_0xca25('0xa')](config[_0xca25('0xb')],{'host':_0xca25('0xc'),'port':0x18eb});var socket=require(_0xca25('0xd'))(new Redis(config[_0xca25('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x44d596,_0x520a0a,_0x41b943){return new BPromise(function(_0xa6e8b2,_0x216c6a){return client['request'](_0x44d596,_0x41b943)['then'](function(_0x571c66){logger[_0xca25('0xe')](_0xca25('0xf'),_0x520a0a,_0xca25('0x10'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x520a0a,_0xca25('0x10'),JSON['stringify'](_0x571c66));if(_0x571c66[_0xca25('0x11')]){if(_0x571c66[_0xca25('0x11')][_0xca25('0x12')]===0x1f4){logger[_0xca25('0x11')](_0xca25('0xf'),_0x520a0a,_0x571c66[_0xca25('0x11')][_0xca25('0x13')]);return _0x216c6a(_0x571c66[_0xca25('0x11')][_0xca25('0x13')]);}logger[_0xca25('0x11')](_0xca25('0xf'),_0x520a0a,_0x571c66['error'][_0xca25('0x13')]);return _0xa6e8b2(_0x571c66[_0xca25('0x11')]['message']);}else{logger[_0xca25('0xe')](_0xca25('0xf'),_0x520a0a,_0xca25('0x10'));_0xa6e8b2(_0x571c66[_0xca25('0x14')][_0xca25('0x13')]);}})['catch'](function(_0x11d7f4){logger[_0xca25('0x11')](_0xca25('0xf'),_0x520a0a,_0x11d7f4);_0x216c6a(_0x11d7f4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a744874..281e7ac 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 _0xe3ee=['register','length','openchannelAccount:','remove','update'];(function(_0x16cbad,_0x4ced08){var _0x31ca31=function(_0x6fb9fb){while(--_0x6fb9fb){_0x16cbad['push'](_0x16cbad['shift']());}};_0x31ca31(++_0x4ced08);}(_0xe3ee,0x116));var _0xee3e=function(_0x37f7cb,_0x51bb96){_0x37f7cb=_0x37f7cb-0x0;var _0x5b383e=_0xe3ee[_0x37f7cb];return _0x5b383e;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xee3e('0x0'),_0xee3e('0x1')];function createListener(_0x5927b6,_0x52bcf2){return function(_0x45bf25){_0x52bcf2['emit'](_0x5927b6,_0x45bf25);};}function removeListener(_0x4c48ed,_0x12b41d){return function(){OpenchannelAccountEvents['removeListener'](_0x4c48ed,_0x12b41d);};}exports[_0xee3e('0x2')]=function(_0x352eca){for(var _0x3907a7=0x0,_0xd893ca=events[_0xee3e('0x3')];_0x3907a7<_0xd893ca;_0x3907a7++){var _0x39a770=events[_0x3907a7];var _0x43ab67=createListener(_0xee3e('0x4')+_0x39a770,_0x352eca);OpenchannelAccountEvents['on'](_0x39a770,_0x43ab67);}}; \ No newline at end of file +var _0xb16f=['openchannelAccount:','./openchannelAccount.events','save','remove','emit'];(function(_0x10b3e0,_0x1c4f62){var _0x59d6ff=function(_0x1029a3){while(--_0x1029a3){_0x10b3e0['push'](_0x10b3e0['shift']());}};_0x59d6ff(++_0x1c4f62);}(_0xb16f,0xf6));var _0xfb16=function(_0x11dde4,_0x1d4852){_0x11dde4=_0x11dde4-0x0;var _0x6eea94=_0xb16f[_0x11dde4];return _0x6eea94;};'use strict';var OpenchannelAccountEvents=require(_0xfb16('0x0'));var events=[_0xfb16('0x1'),_0xfb16('0x2'),'update'];function createListener(_0x144a71,_0x4483aa){return function(_0x402009){_0x4483aa[_0xfb16('0x3')](_0x144a71,_0x402009);};}function removeListener(_0x5caa17,_0x21fee8){return function(){OpenchannelAccountEvents['removeListener'](_0x5caa17,_0x21fee8);};}exports['register']=function(_0x5ed3ef){for(var _0x552b74=0x0,_0x3cdd5e=events['length'];_0x552b74<_0x3cdd5e;_0x552b74++){var _0x1e615f=events[_0x552b74];var _0x4b5296=createListener(_0xfb16('0x4')+_0x1e615f,_0x5ed3ef);OpenchannelAccountEvents['on'](_0x1e615f,_0x4b5296);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a91cc82..984115d 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 _0x4933=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3280d9,_0x3650ff){var _0x22cec2=function(_0xe2f3d6){while(--_0xe2f3d6){_0x3280d9['push'](_0x3280d9['shift']());}};_0x22cec2(++_0x3650ff);}(_0x4933,0x1cc));var _0x3493=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x4933[_0x14363e];return _0x17c56d;};'use strict';var multer=require(_0x3493('0x0'));var util=require(_0x3493('0x1'));var path=require(_0x3493('0x2'));var timeout=require(_0x3493('0x3'));var express=require('express');var router=express[_0x3493('0x4')]();var fs_extra=require(_0x3493('0x5'));var auth=require(_0x3493('0x6'));var interaction=require(_0x3493('0x7'));var config=require(_0x3493('0x8'));var controller=require(_0x3493('0x9'));router[_0x3493('0xa')]('/',auth[_0x3493('0xb')](),controller[_0x3493('0xc')]);router[_0x3493('0xa')]('/:id',auth[_0x3493('0xb')](),controller[_0x3493('0xd')]);router[_0x3493('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x3493('0xb')](),controller[_0x3493('0xf')]);router[_0x3493('0x10')]('/:id',auth[_0x3493('0xb')](),controller['destroy']);module[_0x3493('0x11')]=router; \ No newline at end of file +var _0xcba7=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcba7,0x1c4));var _0x7cba=function(_0x20c512,_0x36c198){_0x20c512=_0x20c512-0x0;var _0x25236e=_0xcba7[_0x20c512];return _0x25236e;};'use strict';var multer=require(_0x7cba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7cba('0x1'));var express=require(_0x7cba('0x2'));var router=express[_0x7cba('0x3')]();var fs_extra=require(_0x7cba('0x4'));var auth=require(_0x7cba('0x5'));var interaction=require(_0x7cba('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x7cba('0x7')](),controller['index']);router[_0x7cba('0x8')](_0x7cba('0x9'),auth[_0x7cba('0x7')](),controller[_0x7cba('0xa')]);router[_0x7cba('0xb')]('/',auth[_0x7cba('0x7')](),controller[_0x7cba('0xc')]);router[_0x7cba('0xd')]('/:id',auth[_0x7cba('0x7')](),controller[_0x7cba('0xe')]);router[_0x7cba('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7cba('0x10')]);module[_0x7cba('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ddf376e..a40b675 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 _0xca61=['*,*,*,*','sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x4a20c8,_0x7fa639){var _0x277864=function(_0x308acd){while(--_0x308acd){_0x4a20c8['push'](_0x4a20c8['shift']());}};_0x277864(++_0x7fa639);}(_0xca61,0x13f));var _0x1ca6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca61[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x1ca6('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1ca6('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ca6('0x2')},'appdata':{'type':Sequelize[_0x1ca6('0x3')]()},'description':{'type':Sequelize[_0x1ca6('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1ca6('0x5')}}; \ No newline at end of file +var _0xee94=['exports','STRING','noop','*,*,*,*'];(function(_0x4627f2,_0x4add6f){var _0x179781=function(_0x2edccd){while(--_0x2edccd){_0x4627f2['push'](_0x4627f2['shift']());}};_0x179781(++_0x4add6f);}(_0xee94,0x1c0));var _0x4ee9=function(_0x36226f,_0x58354a){_0x36226f=_0x36226f-0x0;var _0x33eeb5=_0xee94[_0x36226f];return _0x33eeb5;};'use strict';var Sequelize=require('sequelize');module[_0x4ee9('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4ee9('0x1')],'allowNull':![],'defaultValue':_0x4ee9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4ee9('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4ee9('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 50567e4..912f3a3 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 _0x1780=['squel','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1780,0xd1));var _0x0178=function(_0x253296,_0x4d8f2f){_0x253296=_0x253296-0x0;var _0x4762f3=_0x1780[_0x253296];return _0x4762f3;};'use strict';var emlformat=require(_0x0178('0x0'));var rimraf=require(_0x0178('0x1'));var zipdir=require(_0x0178('0x2'));var jsonpatch=require(_0x0178('0x3'));var rp=require(_0x0178('0x4'));var moment=require(_0x0178('0x5'));var BPromise=require(_0x0178('0x6'));var Mustache=require('mustache');var util=require(_0x0178('0x7'));var path=require(_0x0178('0x8'));var sox=require(_0x0178('0x9'));var csv=require('to-csv');var ejs=require(_0x0178('0xa'));var fs=require('fs');var fs_extra=require(_0x0178('0xb'));var _=require(_0x0178('0xc'));var squel=require(_0x0178('0xd'));var crypto=require(_0x0178('0xe'));var jsforce=require(_0x0178('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0178('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0178('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0178('0x12'))(_0x0178('0x13'));var utils=require(_0x0178('0x14'));var config=require(_0x0178('0x15'));var licenseUtil=require(_0x0178('0x16'));var db=require(_0x0178('0x17'))['db'];function respondWithStatusCode(_0x3fb48a,_0x4c3963){_0x4c3963=_0x4c3963||0xcc;return function(_0x4b30ff){if(_0x4b30ff){return _0x3fb48a[_0x0178('0x18')](_0x4c3963);}return _0x3fb48a[_0x0178('0x19')](_0x4c3963)['end']();};}function respondWithResult(_0x29c294,_0x505829){_0x505829=_0x505829||0xc8;return function(_0x501465){if(_0x501465){return _0x29c294[_0x0178('0x19')](_0x505829)[_0x0178('0x1a')](_0x501465);}};}function respondWithFilteredResult(_0x50a7dd,_0xc9a31f){return function(_0x365a49){if(_0x365a49){var _0x41c9bb=typeof _0xc9a31f[_0x0178('0x1b')]===_0x0178('0x1c')&&typeof _0xc9a31f[_0x0178('0x1d')]===_0x0178('0x1c');var _0x56b76c=_0x365a49[_0x0178('0x1e')];var _0xb8e94e=_0x41c9bb?0x0:_0xc9a31f[_0x0178('0x1b')];var _0x236b68=_0x41c9bb?_0x365a49['count']:_0xc9a31f['offset']+_0xc9a31f[_0x0178('0x1d')];var _0xbf197d;if(_0x236b68>=_0x56b76c){_0x236b68=_0x56b76c;_0xbf197d=0xc8;}else{_0xbf197d=0xce;}_0x50a7dd[_0x0178('0x19')](_0xbf197d);return _0x50a7dd[_0x0178('0x1f')](_0x0178('0x20'),_0xb8e94e+'-'+_0x236b68+'/'+_0x56b76c)[_0x0178('0x1a')](_0x365a49);}return null;};}function patchUpdates(_0x153913){return function(_0xf0a92f){try{jsonpatch[_0x0178('0x21')](_0xf0a92f,_0x153913,!![]);}catch(_0x1afd00){return BPromise['reject'](_0x1afd00);}return _0xf0a92f[_0x0178('0x22')]();};}function saveUpdates(_0x49d44c,_0x3ef9bc){return function(_0x25770a){if(_0x25770a){return _0x25770a[_0x0178('0x23')](_0x49d44c)['then'](function(_0x514283){return _0x514283;});}return null;};}function removeEntity(_0x1233b7,_0x494e5f){return function(_0x2a97a6){if(_0x2a97a6){return _0x2a97a6['destroy']()[_0x0178('0x24')](function(){_0x1233b7['status'](0xcc)[_0x0178('0x25')]();});}};}function handleEntityNotFound(_0x59c671,_0x20bd48){return function(_0x3bce5d){if(!_0x3bce5d){_0x59c671[_0x0178('0x18')](0x194);}return _0x3bce5d;};}function handleError(_0x27540f,_0x354d77){_0x354d77=_0x354d77||0x1f4;return function(_0x11a702){logger[_0x0178('0x26')](_0x11a702[_0x0178('0x27')]);if(_0x11a702[_0x0178('0x28')]){delete _0x11a702[_0x0178('0x28')];}_0x27540f['status'](_0x354d77)[_0x0178('0x29')](_0x11a702);};}exports[_0x0178('0x2a')]=function(_0x57fa17,_0x351eea){var _0x25031c={},_0xbb7fae={},_0x33fca1={'count':0x0,'rows':[]};var _0x5a9e3e=_[_0x0178('0x2b')](db[_0x0178('0x2c')]['rawAttributes'],function(_0x37d6a9){return{'name':_0x37d6a9[_0x0178('0x2d')],'type':_0x37d6a9[_0x0178('0x2e')][_0x0178('0x2f')]};});_0xbb7fae[_0x0178('0x30')]=_[_0x0178('0x2b')](_0x5a9e3e,_0x0178('0x28'));_0xbb7fae[_0x0178('0x31')]=_[_0x0178('0x32')](_0x57fa17['query']);_0xbb7fae['filters']=_[_0x0178('0x33')](_0xbb7fae['model'],_0xbb7fae[_0x0178('0x31')]);_0x25031c[_0x0178('0x34')]=_[_0x0178('0x33')](_0xbb7fae['model'],qs[_0x0178('0x35')](_0x57fa17[_0x0178('0x31')][_0x0178('0x35')]));_0x25031c[_0x0178('0x34')]=_0x25031c[_0x0178('0x34')][_0x0178('0x36')]?_0x25031c[_0x0178('0x34')]:_0xbb7fae[_0x0178('0x30')];if(!_0x57fa17[_0x0178('0x31')][_0x0178('0x37')](_0x0178('0x38'))){_0x25031c['limit']=qs[_0x0178('0x1d')](_0x57fa17['query']['limit']);_0x25031c[_0x0178('0x1b')]=qs[_0x0178('0x1b')](_0x57fa17[_0x0178('0x31')][_0x0178('0x1b')]);}_0x25031c[_0x0178('0x39')]=qs[_0x0178('0x3a')](_0x57fa17['query'][_0x0178('0x3a')]);_0x25031c[_0x0178('0x3b')]=qs[_0x0178('0x3c')](_[_0x0178('0x3d')](_0x57fa17['query'],_0xbb7fae[_0x0178('0x3c')]),_0x5a9e3e);if(_0x57fa17['query'][_0x0178('0x3e')]){_0x25031c[_0x0178('0x3b')]=_[_0x0178('0x3f')](_0x25031c['where'],{'$or':_[_0x0178('0x2b')](_0x5a9e3e,function(_0x1660c1){if(_0x1660c1[_0x0178('0x2e')]!==_0x0178('0x40')){var _0x872161={};_0x872161[_0x1660c1[_0x0178('0x28')]]={'$like':'%'+_0x57fa17[_0x0178('0x31')][_0x0178('0x3e')]+'%'};return _0x872161;}})});}_0x25031c=_['merge']({},_0x25031c,_0x57fa17['options']);var _0x3fdccf={'where':_0x25031c[_0x0178('0x3b')]};return db[_0x0178('0x2c')][_0x0178('0x1e')](_0x3fdccf)['then'](function(_0x3a1f03){_0x33fca1[_0x0178('0x1e')]=_0x3a1f03;if(_0x57fa17[_0x0178('0x31')][_0x0178('0x41')]){_0x25031c['include']=[{'all':!![]}];}return db[_0x0178('0x2c')]['findAll'](_0x25031c);})[_0x0178('0x24')](function(_0x223ff8){_0x33fca1[_0x0178('0x42')]=_0x223ff8;return _0x33fca1;})['then'](respondWithFilteredResult(_0x351eea,_0x25031c))[_0x0178('0x43')](handleError(_0x351eea,null));};exports[_0x0178('0x44')]=function(_0x4aa6ef,_0x44735b){var _0x3f8df0={'raw':!![],'where':{'id':_0x4aa6ef[_0x0178('0x45')]['id']}},_0x406880={};_0x406880['model']=_[_0x0178('0x32')](db[_0x0178('0x2c')]['rawAttributes']);_0x406880[_0x0178('0x31')]=_[_0x0178('0x32')](_0x4aa6ef[_0x0178('0x31')]);_0x406880[_0x0178('0x3c')]=_['intersection'](_0x406880[_0x0178('0x30')],_0x406880[_0x0178('0x31')]);_0x3f8df0[_0x0178('0x34')]=_[_0x0178('0x33')](_0x406880[_0x0178('0x30')],qs[_0x0178('0x35')](_0x4aa6ef['query'][_0x0178('0x35')]));_0x3f8df0[_0x0178('0x34')]=_0x3f8df0['attributes'][_0x0178('0x36')]?_0x3f8df0[_0x0178('0x34')]:_0x406880[_0x0178('0x30')];if(_0x4aa6ef[_0x0178('0x31')]['includeAll']){_0x3f8df0['include']=[{'all':!![]}];}_0x3f8df0=_[_0x0178('0x3f')]({},_0x3f8df0,_0x4aa6ef['options']);return db['OpenchannelApplication'][_0x0178('0x46')](_0x3f8df0)['then'](handleEntityNotFound(_0x44735b,null))[_0x0178('0x24')](respondWithResult(_0x44735b,null))['catch'](handleError(_0x44735b,null));};exports[_0x0178('0x47')]=function(_0x4e8016,_0xd50380){return db[_0x0178('0x2c')][_0x0178('0x47')](_0x4e8016['body'],{})[_0x0178('0x24')](respondWithResult(_0xd50380,0xc9))[_0x0178('0x43')](handleError(_0xd50380,null));};exports[_0x0178('0x23')]=function(_0x26e71b,_0x2c1bbd){if(_0x26e71b[_0x0178('0x48')]['id']){delete _0x26e71b[_0x0178('0x48')]['id'];}return db[_0x0178('0x2c')][_0x0178('0x46')]({'where':{'id':_0x26e71b[_0x0178('0x45')]['id']}})[_0x0178('0x24')](handleEntityNotFound(_0x2c1bbd,null))[_0x0178('0x24')](saveUpdates(_0x26e71b[_0x0178('0x48')],null))[_0x0178('0x24')](respondWithResult(_0x2c1bbd,null))['catch'](handleError(_0x2c1bbd,null));};exports[_0x0178('0x49')]=function(_0x2be08c,_0x5965b4){return db[_0x0178('0x2c')][_0x0178('0x46')]({'where':{'id':_0x2be08c[_0x0178('0x45')]['id']}})['then'](handleEntityNotFound(_0x5965b4,null))[_0x0178('0x24')](removeEntity(_0x5965b4,null))[_0x0178('0x43')](handleError(_0x5965b4,null));}; \ No newline at end of file +var _0xa463=['send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x357419,_0x15704a){var _0x340890=function(_0xc83486){while(--_0xc83486){_0x357419['push'](_0x357419['shift']());}};_0x340890(++_0x15704a);}(_0xa463,0xb7));var _0x3a46=function(_0x479ada,_0x171a31){_0x479ada=_0x479ada-0x0;var _0x1cc66e=_0xa463[_0x479ada];return _0x1cc66e;};'use strict';var emlformat=require(_0x3a46('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a46('0x1'));var rp=require(_0x3a46('0x2'));var moment=require(_0x3a46('0x3'));var BPromise=require(_0x3a46('0x4'));var Mustache=require(_0x3a46('0x5'));var util=require(_0x3a46('0x6'));var path=require(_0x3a46('0x7'));var sox=require(_0x3a46('0x8'));var csv=require(_0x3a46('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a46('0xa'));var _=require(_0x3a46('0xb'));var squel=require(_0x3a46('0xc'));var crypto=require(_0x3a46('0xd'));var jsforce=require(_0x3a46('0xe'));var deskjs=require(_0x3a46('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3a46('0x10'));var authService=require(_0x3a46('0x11'));var qs=require(_0x3a46('0x12'));var as=require(_0x3a46('0x13'));var hardwareService=require(_0x3a46('0x14'));var logger=require('../../config/logger')(_0x3a46('0x15'));var utils=require(_0x3a46('0x16'));var config=require(_0x3a46('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a46('0x18'))['db'];function respondWithStatusCode(_0x1938c1,_0x516ae8){_0x516ae8=_0x516ae8||0xcc;return function(_0x1fde47){if(_0x1fde47){return _0x1938c1[_0x3a46('0x19')](_0x516ae8);}return _0x1938c1[_0x3a46('0x1a')](_0x516ae8)[_0x3a46('0x1b')]();};}function respondWithResult(_0x2ce855,_0x22a3c7){_0x22a3c7=_0x22a3c7||0xc8;return function(_0x2ecc13){if(_0x2ecc13){return _0x2ce855[_0x3a46('0x1a')](_0x22a3c7)[_0x3a46('0x1c')](_0x2ecc13);}};}function respondWithFilteredResult(_0x5eec34,_0x5dac64){return function(_0x20465e){if(_0x20465e){var _0x3f1b5e=typeof _0x5dac64[_0x3a46('0x1d')]===_0x3a46('0x1e')&&typeof _0x5dac64[_0x3a46('0x1f')]===_0x3a46('0x1e');var _0x5605d2=_0x20465e[_0x3a46('0x20')];var _0x124433=_0x3f1b5e?0x0:_0x5dac64[_0x3a46('0x1d')];var _0x57a910=_0x3f1b5e?_0x20465e['count']:_0x5dac64[_0x3a46('0x1d')]+_0x5dac64[_0x3a46('0x1f')];var _0x552382;if(_0x57a910>=_0x5605d2){_0x57a910=_0x5605d2;_0x552382=0xc8;}else{_0x552382=0xce;}_0x5eec34[_0x3a46('0x1a')](_0x552382);return _0x5eec34[_0x3a46('0x21')](_0x3a46('0x22'),_0x124433+'-'+_0x57a910+'/'+_0x5605d2)[_0x3a46('0x1c')](_0x20465e);}return null;};}function patchUpdates(_0x2cd69b){return function(_0x17068f){try{jsonpatch['apply'](_0x17068f,_0x2cd69b,!![]);}catch(_0x1a706a){return BPromise[_0x3a46('0x23')](_0x1a706a);}return _0x17068f['save']();};}function saveUpdates(_0x40d689,_0x3108ca){return function(_0x5e8938){if(_0x5e8938){return _0x5e8938[_0x3a46('0x24')](_0x40d689)[_0x3a46('0x25')](function(_0x19c6d7){return _0x19c6d7;});}return null;};}function removeEntity(_0x4de2fd,_0x2acb44){return function(_0x31e76d){if(_0x31e76d){return _0x31e76d[_0x3a46('0x26')]()[_0x3a46('0x25')](function(){_0x4de2fd[_0x3a46('0x1a')](0xcc)[_0x3a46('0x1b')]();});}};}function handleEntityNotFound(_0x56d802,_0x3c0062){return function(_0x227758){if(!_0x227758){_0x56d802['sendStatus'](0x194);}return _0x227758;};}function handleError(_0x25ff1e,_0x285157){_0x285157=_0x285157||0x1f4;return function(_0x1839af){logger[_0x3a46('0x27')](_0x1839af[_0x3a46('0x28')]);if(_0x1839af[_0x3a46('0x29')]){delete _0x1839af[_0x3a46('0x29')];}_0x25ff1e[_0x3a46('0x1a')](_0x285157)[_0x3a46('0x2a')](_0x1839af);};}exports[_0x3a46('0x2b')]=function(_0x23405b,_0xce2248){var _0x3b959b={},_0x3c3ce2={},_0x447b99={'count':0x0,'rows':[]};var _0x4869db=_[_0x3a46('0x2c')](db[_0x3a46('0x2d')][_0x3a46('0x2e')],function(_0x428507){return{'name':_0x428507[_0x3a46('0x2f')],'type':_0x428507[_0x3a46('0x30')]['key']};});_0x3c3ce2[_0x3a46('0x31')]=_[_0x3a46('0x2c')](_0x4869db,_0x3a46('0x29'));_0x3c3ce2[_0x3a46('0x32')]=_[_0x3a46('0x33')](_0x23405b[_0x3a46('0x32')]);_0x3c3ce2[_0x3a46('0x34')]=_[_0x3a46('0x35')](_0x3c3ce2[_0x3a46('0x31')],_0x3c3ce2[_0x3a46('0x32')]);_0x3b959b[_0x3a46('0x36')]=_[_0x3a46('0x35')](_0x3c3ce2[_0x3a46('0x31')],qs[_0x3a46('0x37')](_0x23405b['query'][_0x3a46('0x37')]));_0x3b959b[_0x3a46('0x36')]=_0x3b959b[_0x3a46('0x36')][_0x3a46('0x38')]?_0x3b959b[_0x3a46('0x36')]:_0x3c3ce2['model'];if(!_0x23405b[_0x3a46('0x32')]['hasOwnProperty'](_0x3a46('0x39'))){_0x3b959b['limit']=qs['limit'](_0x23405b[_0x3a46('0x32')][_0x3a46('0x1f')]);_0x3b959b[_0x3a46('0x1d')]=qs['offset'](_0x23405b[_0x3a46('0x32')][_0x3a46('0x1d')]);}_0x3b959b[_0x3a46('0x3a')]=qs[_0x3a46('0x3b')](_0x23405b[_0x3a46('0x32')][_0x3a46('0x3b')]);_0x3b959b[_0x3a46('0x3c')]=qs[_0x3a46('0x34')](_[_0x3a46('0x3d')](_0x23405b[_0x3a46('0x32')],_0x3c3ce2['filters']),_0x4869db);if(_0x23405b[_0x3a46('0x32')][_0x3a46('0x3e')]){_0x3b959b[_0x3a46('0x3c')]=_[_0x3a46('0x3f')](_0x3b959b[_0x3a46('0x3c')],{'$or':_['map'](_0x4869db,function(_0x4ca14e){if(_0x4ca14e['type']!==_0x3a46('0x40')){var _0x1551c2={};_0x1551c2[_0x4ca14e['name']]={'$like':'%'+_0x23405b[_0x3a46('0x32')][_0x3a46('0x3e')]+'%'};return _0x1551c2;}})});}_0x3b959b=_[_0x3a46('0x3f')]({},_0x3b959b,_0x23405b[_0x3a46('0x41')]);var _0x590496={'where':_0x3b959b[_0x3a46('0x3c')]};return db[_0x3a46('0x2d')]['count'](_0x590496)[_0x3a46('0x25')](function(_0xb32c40){_0x447b99[_0x3a46('0x20')]=_0xb32c40;if(_0x23405b[_0x3a46('0x32')][_0x3a46('0x42')]){_0x3b959b[_0x3a46('0x43')]=[{'all':!![]}];}return db[_0x3a46('0x2d')]['findAll'](_0x3b959b);})[_0x3a46('0x25')](function(_0x50ebfc){_0x447b99[_0x3a46('0x44')]=_0x50ebfc;return _0x447b99;})[_0x3a46('0x25')](respondWithFilteredResult(_0xce2248,_0x3b959b))['catch'](handleError(_0xce2248,null));};exports[_0x3a46('0x45')]=function(_0x2598c7,_0x29b8b3){var _0x4a8344={'raw':!![],'where':{'id':_0x2598c7[_0x3a46('0x46')]['id']}},_0x53d730={};_0x53d730[_0x3a46('0x31')]=_[_0x3a46('0x33')](db[_0x3a46('0x2d')]['rawAttributes']);_0x53d730[_0x3a46('0x32')]=_['keys'](_0x2598c7[_0x3a46('0x32')]);_0x53d730['filters']=_['intersection'](_0x53d730[_0x3a46('0x31')],_0x53d730[_0x3a46('0x32')]);_0x4a8344[_0x3a46('0x36')]=_[_0x3a46('0x35')](_0x53d730[_0x3a46('0x31')],qs[_0x3a46('0x37')](_0x2598c7[_0x3a46('0x32')]['fields']));_0x4a8344[_0x3a46('0x36')]=_0x4a8344[_0x3a46('0x36')][_0x3a46('0x38')]?_0x4a8344[_0x3a46('0x36')]:_0x53d730[_0x3a46('0x31')];if(_0x2598c7['query']['includeAll']){_0x4a8344[_0x3a46('0x43')]=[{'all':!![]}];}_0x4a8344=_[_0x3a46('0x3f')]({},_0x4a8344,_0x2598c7[_0x3a46('0x41')]);return db[_0x3a46('0x2d')][_0x3a46('0x47')](_0x4a8344)['then'](handleEntityNotFound(_0x29b8b3,null))[_0x3a46('0x25')](respondWithResult(_0x29b8b3,null))['catch'](handleError(_0x29b8b3,null));};exports[_0x3a46('0x48')]=function(_0x516569,_0x1a8a9d){return db['OpenchannelApplication'][_0x3a46('0x48')](_0x516569[_0x3a46('0x49')],{})['then'](respondWithResult(_0x1a8a9d,0xc9))[_0x3a46('0x4a')](handleError(_0x1a8a9d,null));};exports[_0x3a46('0x24')]=function(_0x37043f,_0x41db55){if(_0x37043f[_0x3a46('0x49')]['id']){delete _0x37043f[_0x3a46('0x49')]['id'];}return db[_0x3a46('0x2d')][_0x3a46('0x47')]({'where':{'id':_0x37043f[_0x3a46('0x46')]['id']}})[_0x3a46('0x25')](handleEntityNotFound(_0x41db55,null))['then'](saveUpdates(_0x37043f[_0x3a46('0x49')],null))['then'](respondWithResult(_0x41db55,null))[_0x3a46('0x4a')](handleError(_0x41db55,null));};exports[_0x3a46('0x26')]=function(_0x31dd2f,_0x449c5b){return db[_0x3a46('0x2d')][_0x3a46('0x47')]({'where':{'id':_0x31dd2f[_0x3a46('0x46')]['id']}})['then'](handleEntityNotFound(_0x449c5b,null))[_0x3a46('0x25')](removeEntity(_0x449c5b,null))[_0x3a46('0x4a')](handleError(_0x449c5b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 91ddb95..ebbe459 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 _0xbb25=['moment','request-promise','rimraf','./openchannelApplication.attributes','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0xbb25,0xe3));var _0x5bb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb25[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5bb2('0x0'));var util=require('util');var logger=require(_0x5bb2('0x1'))(_0x5bb2('0x2'));var moment=require(_0x5bb2('0x3'));var BPromise=require('bluebird');var rp=require(_0x5bb2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bb2('0x5'));var config=require('../../config/environment');var attributes=require(_0x5bb2('0x6'));module['exports']=function(_0x2d9125,_0x3a630d){return _0x2d9125['define']('OpenchannelApplication',attributes,{'tableName':_0x5bb2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bb2('0x8'),'collate':_0x5bb2('0x9')});}; \ No newline at end of file +var _0x8c01=['define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x2adc55,_0x1e1565){var _0x735331=function(_0x387b18){while(--_0x387b18){_0x2adc55['push'](_0x2adc55['shift']());}};_0x735331(++_0x1e1565);}(_0x8c01,0x190));var _0x18c0=function(_0x4d4a10,_0x4cee2a){_0x4d4a10=_0x4d4a10-0x0;var _0x1be04d=_0x8c01[_0x4d4a10];return _0x1be04d;};'use strict';var _=require(_0x18c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x18c0('0x1'));var moment=require(_0x18c0('0x2'));var BPromise=require(_0x18c0('0x3'));var rp=require(_0x18c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18c0('0x5'));var config=require(_0x18c0('0x6'));var attributes=require(_0x18c0('0x7'));module['exports']=function(_0x1890c5,_0x283b33){return _0x1890c5[_0x18c0('0x8')](_0x18c0('0x9'),attributes,{'tableName':_0x18c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x18c0('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a0400d1..1a2ba44 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 _0xd30b=['attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','OpenchannelApplication','update','body','options','where'];(function(_0x21b1b7,_0x2fc411){var _0x39e88a=function(_0x477f3a){while(--_0x477f3a){_0x21b1b7['push'](_0x21b1b7['shift']());}};_0x39e88a(++_0x2fc411);}(_0xd30b,0x1a7));var _0xbd30=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xd30b[_0x41c381];return _0x427981;};'use strict';var _=require(_0xbd30('0x0'));var util=require(_0xbd30('0x1'));var moment=require(_0xbd30('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd30('0x3'));var fs=require('fs');var Redis=require(_0xbd30('0x4'));var db=require(_0xbd30('0x5'))['db'];var utils=require(_0xbd30('0x6'));var logger=require('../../config/logger')(_0xbd30('0x7'));var config=require('../../config/environment');var jayson=require(_0xbd30('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x288649,_0x3e7728,_0x4b488e){return new BPromise(function(_0x2a7121,_0x26c792){return client['request'](_0x288649,_0x4b488e)[_0xbd30('0x9')](function(_0x47a7a1){logger[_0xbd30('0xa')](_0xbd30('0xb'),_0x3e7728,'request\x20sent');logger[_0xbd30('0xc')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3e7728,_0xbd30('0xd'),JSON[_0xbd30('0xe')](_0x47a7a1));if(_0x47a7a1[_0xbd30('0xf')]){if(_0x47a7a1['error'][_0xbd30('0x10')]===0x1f4){logger['error'](_0xbd30('0xb'),_0x3e7728,_0x47a7a1[_0xbd30('0xf')][_0xbd30('0x11')]);return _0x26c792(_0x47a7a1[_0xbd30('0xf')]['message']);}logger[_0xbd30('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x3e7728,_0x47a7a1[_0xbd30('0xf')][_0xbd30('0x11')]);return _0x2a7121(_0x47a7a1[_0xbd30('0xf')][_0xbd30('0x11')]);}else{logger[_0xbd30('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x3e7728,_0xbd30('0xd'));_0x2a7121(_0x47a7a1[_0xbd30('0x12')][_0xbd30('0x11')]);}})[_0xbd30('0x13')](function(_0x194c5c){logger[_0xbd30('0xf')](_0xbd30('0xb'),_0x3e7728,_0x194c5c);_0x26c792(_0x194c5c);});});}exports['UpdateOpenchannelApplication']=function(_0x171c62){var _0x1a2238=this;return new Promise(function(_0x35f5ef,_0x5efdd7){return db[_0xbd30('0x14')][_0xbd30('0x15')](_0x171c62[_0xbd30('0x16')],{'raw':_0x171c62['options']?_0x171c62[_0xbd30('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171c62['options']?_0x171c62[_0xbd30('0x17')][_0xbd30('0x18')]||null:null,'attributes':_0x171c62['options']?_0x171c62[_0xbd30('0x17')][_0xbd30('0x19')]||null:null,'limit':_0x171c62[_0xbd30('0x17')]?_0x171c62[_0xbd30('0x17')][_0xbd30('0x1a')]||null:null})['then'](function(_0x5f17cb){logger['info']('UpdateOpenchannelApplication',_0x171c62);logger[_0xbd30('0xc')](_0xbd30('0x1b'),_0x171c62,JSON[_0xbd30('0xe')](_0x5f17cb));_0x35f5ef(_0x5f17cb);})[_0xbd30('0x13')](function(_0x9a3920){logger[_0xbd30('0xf')](_0xbd30('0x1b'),_0x9a3920[_0xbd30('0x11')],_0x171c62);_0x5efdd7(_0x1a2238[_0xbd30('0xf')](0x1f4,_0x9a3920[_0xbd30('0x11')]));});});}; \ No newline at end of file +var _0x3d8f=['error','code','message','OpenchannelApplication,\x20%s,\x20%s','catch','UpdateOpenchannelApplication','update','body','options','raw','attributes','limit','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','stringify'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x3d8f,0xe5));var _0xf3d8=function(_0x49fa21,_0xce4027){_0x49fa21=_0x49fa21-0x0;var _0x2e33a5=_0x3d8f[_0x49fa21];return _0x2e33a5;};'use strict';var _=require('lodash');var util=require(_0xf3d8('0x0'));var moment=require('moment');var BPromise=require(_0xf3d8('0x1'));var rs=require(_0xf3d8('0x2'));var fs=require('fs');var Redis=require(_0xf3d8('0x3'));var db=require(_0xf3d8('0x4'))['db'];var utils=require(_0xf3d8('0x5'));var logger=require(_0xf3d8('0x6'))(_0xf3d8('0x7'));var config=require('../../config/environment');var jayson=require(_0xf3d8('0x8'));var client=jayson['client'][_0xf3d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce1d7,_0x1e5003,_0x102cd5){return new BPromise(function(_0x243f10,_0x631594){return client['request'](_0x2ce1d7,_0x102cd5)[_0xf3d8('0xa')](function(_0x2ba929){logger[_0xf3d8('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e5003,_0xf3d8('0xc'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1e5003,_0xf3d8('0xc'),JSON[_0xf3d8('0xd')](_0x2ba929));if(_0x2ba929[_0xf3d8('0xe')]){if(_0x2ba929[_0xf3d8('0xe')][_0xf3d8('0xf')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1e5003,_0x2ba929[_0xf3d8('0xe')]['message']);return _0x631594(_0x2ba929[_0xf3d8('0xe')][_0xf3d8('0x10')]);}logger[_0xf3d8('0xe')](_0xf3d8('0x11'),_0x1e5003,_0x2ba929[_0xf3d8('0xe')][_0xf3d8('0x10')]);return _0x243f10(_0x2ba929[_0xf3d8('0xe')][_0xf3d8('0x10')]);}else{logger[_0xf3d8('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e5003,_0xf3d8('0xc'));_0x243f10(_0x2ba929['result'][_0xf3d8('0x10')]);}})[_0xf3d8('0x12')](function(_0x409b6f){logger[_0xf3d8('0xe')](_0xf3d8('0x11'),_0x1e5003,_0x409b6f);_0x631594(_0x409b6f);});});}exports[_0xf3d8('0x13')]=function(_0x1589e8){var _0x5b031c=this;return new Promise(function(_0xba51d6,_0x46af94){return db['OpenchannelApplication'][_0xf3d8('0x14')](_0x1589e8[_0xf3d8('0x15')],{'raw':_0x1589e8[_0xf3d8('0x16')]?_0x1589e8['options'][_0xf3d8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1589e8[_0xf3d8('0x16')]?_0x1589e8[_0xf3d8('0x16')]['where']||null:null,'attributes':_0x1589e8[_0xf3d8('0x16')]?_0x1589e8[_0xf3d8('0x16')][_0xf3d8('0x18')]||null:null,'limit':_0x1589e8[_0xf3d8('0x16')]?_0x1589e8[_0xf3d8('0x16')][_0xf3d8('0x19')]||null:null})[_0xf3d8('0xa')](function(_0x4bfdb7){logger['info'](_0xf3d8('0x13'),_0x1589e8);logger[_0xf3d8('0x1a')]('UpdateOpenchannelApplication',_0x1589e8,JSON['stringify'](_0x4bfdb7));_0xba51d6(_0x4bfdb7);})[_0xf3d8('0x12')](function(_0x2cc238){logger['error'](_0xf3d8('0x13'),_0x2cc238[_0xf3d8('0x10')],_0x1589e8);_0x46af94(_0x5b031c[_0xf3d8('0xe')](0x1f4,_0x2cc238[_0xf3d8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1160b86..b613263 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 _0x4f61=['destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy'];(function(_0x47930b,_0x44f33b){var _0x110ee9=function(_0x1194ce){while(--_0x1194ce){_0x47930b['push'](_0x47930b['shift']());}};_0x110ee9(++_0x44f33b);}(_0x4f61,0x87));var _0x14f6=function(_0x12b09d,_0x3cb8c9){_0x12b09d=_0x12b09d-0x0;var _0x268a40=_0x4f61[_0x12b09d];return _0x268a40;};'use strict';var multer=require(_0x14f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x14f6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x14f6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x14f6('0x3'));var config=require(_0x14f6('0x4'));var controller=require(_0x14f6('0x5'));router[_0x14f6('0x6')]('/',auth[_0x14f6('0x7')](),controller[_0x14f6('0x8')]);router[_0x14f6('0x6')](_0x14f6('0x9'),auth['isAuthenticated'](),controller[_0x14f6('0xa')]);router['get'](_0x14f6('0xb'),auth['isAuthenticated'](),controller[_0x14f6('0xc')]);router[_0x14f6('0x6')](_0x14f6('0xd'),auth[_0x14f6('0x7')](),controller[_0x14f6('0xe')]);router[_0x14f6('0x6')](_0x14f6('0xf'),auth[_0x14f6('0x7')](),controller[_0x14f6('0x10')]);router[_0x14f6('0x11')]('/',auth['isAuthenticated'](),controller[_0x14f6('0x12')]);router[_0x14f6('0x11')](_0x14f6('0xd'),auth[_0x14f6('0x7')](),controller[_0x14f6('0x13')]);router[_0x14f6('0x11')](_0x14f6('0x14'),auth['isAuthenticated'](),interaction[_0x14f6('0x15')](_0x14f6('0x16'),_0x14f6('0x17')),controller[_0x14f6('0x18')]);router[_0x14f6('0x19')](_0x14f6('0xb'),auth[_0x14f6('0x7')](),interaction[_0x14f6('0x15')](_0x14f6('0x16'),_0x14f6('0x1a')),controller[_0x14f6('0x1b')]);router[_0x14f6('0x1c')](_0x14f6('0xb'),auth[_0x14f6('0x7')](),interaction[_0x14f6('0x15')](_0x14f6('0x16'),_0x14f6('0x1d')),controller[_0x14f6('0x1e')]);router[_0x14f6('0x1c')](_0x14f6('0x14'),auth[_0x14f6('0x7')](),controller[_0x14f6('0x1f')]);module[_0x14f6('0x20')]=router; \ No newline at end of file +var _0xd24a=['update','delete','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','post','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update'];(function(_0x55fe45,_0x23c664){var _0x1e64e6=function(_0x26f035){while(--_0x26f035){_0x55fe45['push'](_0x55fe45['shift']());}};_0x1e64e6(++_0x23c664);}(_0xd24a,0xd6));var _0xad24=function(_0x2e0a9b,_0x4ced4d){_0x2e0a9b=_0x2e0a9b-0x0;var _0x113fa4=_0xd24a[_0x2e0a9b];return _0x113fa4;};'use strict';var multer=require('multer');var util=require(_0xad24('0x0'));var path=require(_0xad24('0x1'));var timeout=require(_0xad24('0x2'));var express=require(_0xad24('0x3'));var router=express[_0xad24('0x4')]();var fs_extra=require(_0xad24('0x5'));var auth=require(_0xad24('0x6'));var interaction=require(_0xad24('0x7'));var config=require(_0xad24('0x8'));var controller=require('./openchannelInteraction.controller');router[_0xad24('0x9')]('/',auth[_0xad24('0xa')](),controller[_0xad24('0xb')]);router['get'](_0xad24('0xc'),auth[_0xad24('0xa')](),controller[_0xad24('0xd')]);router[_0xad24('0x9')]('/:id',auth[_0xad24('0xa')](),controller[_0xad24('0xe')]);router['get']('/:id/messages',auth[_0xad24('0xa')](),controller[_0xad24('0xf')]);router[_0xad24('0x9')](_0xad24('0x10'),auth[_0xad24('0xa')](),controller['download']);router[_0xad24('0x11')]('/',auth[_0xad24('0xa')](),controller['create']);router[_0xad24('0x11')](_0xad24('0x12'),auth[_0xad24('0xa')](),controller['addMessage']);router[_0xad24('0x11')](_0xad24('0x13'),auth[_0xad24('0xa')](),interaction[_0xad24('0x14')](_0xad24('0x15'),_0xad24('0x16')),controller['addTags']);router[_0xad24('0x17')](_0xad24('0x18'),auth[_0xad24('0xa')](),interaction[_0xad24('0x14')](_0xad24('0x15'),_0xad24('0x19')),controller[_0xad24('0x1a')]);router[_0xad24('0x1b')](_0xad24('0x18'),auth['isAuthenticated'](),interaction[_0xad24('0x14')]('openchannel','openchannelinteraction:destroy'),controller['destroy']);router[_0xad24('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xad24('0x1c')]);module[_0xad24('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 849b426..b4aa28e 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 _0x6c32=['STRING','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x7b5f53,_0x4ffc21){var _0x12aefe=function(_0x10709a){while(--_0x10709a){_0x7b5f53['push'](_0x7b5f53['shift']());}};_0x12aefe(++_0x4ffc21);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module[_0x26c3('0x1')]={'closed':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x26c3('0x3')]},'disposition':{'type':Sequelize[_0x26c3('0x4')]},'secondDisposition':{'type':Sequelize[_0x26c3('0x4')]},'thirdDisposition':{'type':Sequelize[_0x26c3('0x4')]},'note':{'type':Sequelize[_0x26c3('0x4')]},'read1stAt':{'type':Sequelize[_0x26c3('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x26c3('0x4')]},'lastMsgAt':{'type':Sequelize[_0x26c3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x26c3('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x26c3('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x26c3('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9f75=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x9f75,0x15a));var _0x59f7=function(_0x3b70d4,_0x5ae210){_0x3b70d4=_0x3b70d4-0x0;var _0x504a71=_0x9f75[_0x3b70d4];return _0x504a71;};'use strict';var Sequelize=require(_0x59f7('0x0'));module['exports']={'closed':{'type':Sequelize[_0x59f7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x59f7('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x59f7('0x3')]},'note':{'type':Sequelize[_0x59f7('0x3')]},'read1stAt':{'type':Sequelize[_0x59f7('0x2')]},'threadId':{'type':Sequelize[_0x59f7('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x59f7('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x59f7('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x59f7('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x59f7('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x59f7('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 61bb6b6..22213d6 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 _0xd496=['index','OpenchannelInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','start','body','keys','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\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?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.fax','Contact.fax','Owner.fullname','o.internal','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','rawAttributes','includeAll','include','catch','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','pick','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','removeTags','download','join','root','server','tmp','files','attachments','format','fullname','CmContact','firstName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','Openchannel','closedAt','disposition','Public','Private','pipe','createWriteStream','basename','direction','System','lastName','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId'];(function(_0x184f7e,_0x7c9d1e){var _0x1905d1=function(_0x36a0aa){while(--_0x36a0aa){_0x184f7e['push'](_0x184f7e['shift']());}};_0x1905d1(++_0x7c9d1e);}(_0xd496,0x195));var _0x6d49=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xd496[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0x6d49('0x0'));var rimraf=require(_0x6d49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d49('0x2'));var rp=require('request-promise');var moment=require(_0x6d49('0x3'));var BPromise=require(_0x6d49('0x4'));var Mustache=require('mustache');var util=require(_0x6d49('0x5'));var path=require(_0x6d49('0x6'));var sox=require(_0x6d49('0x7'));var csv=require(_0x6d49('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d49('0x9'));var _=require(_0x6d49('0xa'));var squel=require('squel');var crypto=require(_0x6d49('0xb'));var jsforce=require(_0x6d49('0xc'));var deskjs=require(_0x6d49('0xd'));var toCsv=require(_0x6d49('0x8'));var querystring=require('querystring');var Papa=require(_0x6d49('0xe'));var Redis=require(_0x6d49('0xf'));var authService=require(_0x6d49('0x10'));var qs=require(_0x6d49('0x11'));var as=require(_0x6d49('0x12'));var pdf=require(_0x6d49('0x13'));var hardwareService=require(_0x6d49('0x14'));var logger=require('../../config/logger')(_0x6d49('0x15'));var utils=require(_0x6d49('0x16'));var config=require(_0x6d49('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d49('0x18'))['db'];config['redis']=_[_0x6d49('0x19')](config[_0x6d49('0x1a')],{'host':_0x6d49('0x1b'),'port':0x18eb});var socket=require(_0x6d49('0x1c'))(new Redis(config[_0x6d49('0x1a')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x47d932,_0x3e62e9){_0x3e62e9=_0x3e62e9||0xcc;return function(_0x48341d){if(_0x48341d){return _0x47d932[_0x6d49('0x1d')](_0x3e62e9);}return _0x47d932[_0x6d49('0x1e')](_0x3e62e9)[_0x6d49('0x1f')]();};}function respondWithResult(_0x4e1d2d,_0x22f474){_0x22f474=_0x22f474||0xc8;return function(_0x1722ed){if(_0x1722ed){return _0x4e1d2d['status'](_0x22f474)[_0x6d49('0x20')](_0x1722ed);}};}function respondWithFilteredResult(_0x5e471e,_0xdf86ba){return function(_0x109825){if(_0x109825){var _0x26fe82=typeof _0xdf86ba[_0x6d49('0x21')]===_0x6d49('0x22')&&typeof _0xdf86ba[_0x6d49('0x23')]===_0x6d49('0x22');var _0x3f9825=_0x109825[_0x6d49('0x24')];var _0x389b2c=_0x26fe82?0x0:_0xdf86ba[_0x6d49('0x21')];var _0x98f655=_0x26fe82?_0x109825[_0x6d49('0x24')]:_0xdf86ba[_0x6d49('0x21')]+_0xdf86ba[_0x6d49('0x23')];var _0x14f2c9;if(_0x98f655>=_0x3f9825){_0x98f655=_0x3f9825;_0x14f2c9=0xc8;}else{_0x14f2c9=0xce;}_0x5e471e['status'](_0x14f2c9);return _0x5e471e[_0x6d49('0x25')](_0x6d49('0x26'),_0x389b2c+'-'+_0x98f655+'/'+_0x3f9825)['json'](_0x109825);}return null;};}function patchUpdates(_0x3ecfb3){return function(_0x16f639){try{jsonpatch['apply'](_0x16f639,_0x3ecfb3,!![]);}catch(_0x4df6c7){return BPromise[_0x6d49('0x27')](_0x4df6c7);}return _0x16f639[_0x6d49('0x28')]();};}function saveUpdates(_0x35b71a,_0x5e4c16){return function(_0xbea6){if(_0xbea6){return _0xbea6[_0x6d49('0x29')](_0x35b71a)[_0x6d49('0x2a')](function(_0x3ac5e6){return _0x3ac5e6;});}return null;};}function removeEntity(_0x3d7262,_0x5b201f){return function(_0x1ac589){if(_0x1ac589){return _0x1ac589[_0x6d49('0x2b')]()[_0x6d49('0x2a')](function(){_0x3d7262['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5167a7,_0x592731){return function(_0x5b2a3e){if(!_0x5b2a3e){_0x5167a7['sendStatus'](0x194);}return _0x5b2a3e;};}function handleError(_0x55b040,_0x191e7f){_0x191e7f=_0x191e7f||0x1f4;return function(_0xb42763){logger[_0x6d49('0x2c')](_0xb42763[_0x6d49('0x2d')]);if(_0xb42763['name']){delete _0xb42763[_0x6d49('0x2e')];}_0x55b040[_0x6d49('0x1e')](_0x191e7f)[_0x6d49('0x2f')](_0xb42763);};}function getInteractionUsers(_0xfa9f3a,_0x5343bd){return new BPromise(function(_0xcfb35,_0x2781da){try{if(_0x5343bd[_0xfa9f3a['id']]){_0xfa9f3a[_0x6d49('0x30')]=_[_0x6d49('0x31')](_0x5343bd[_0xfa9f3a['id']],function(_0x2d8dfe){return{'id':_0x2d8dfe['id'],'fullname':_0x2d8dfe['fullname']};});}}catch(_0x3e1673){_0x2781da(_0x3e1673);}_0xcfb35(_0xfa9f3a);});}function getInteractionTags(_0x6a6e7a,_0x28c94a){return new BPromise(function(_0x914e7f,_0x1c6a16){try{if(_0x6a6e7a[_0x6d49('0x32')]){_0x6a6e7a[_0x6d49('0x33')]=[];_0x6a6e7a[_0x6d49('0x32')]['split'](',')[_0x6d49('0x34')](function(_0x3465c7){_0x6a6e7a[_0x6d49('0x33')][_0x6d49('0x35')](_0x28c94a[_0x3465c7]);});}delete _0x6a6e7a[_0x6d49('0x32')];}catch(_0x4ffcb8){_0x1c6a16(_0x4ffcb8);}_0x914e7f(_0x6a6e7a);});}function updateOpenchannelInteraction(_0x329a86,_0x19d8b0,_0x270578){return new BPromise(function(_0x228fbf,_0x1f02fd){return getInteractionUsers(_0x329a86,_0x270578)['then'](function(_0x225aac){return getInteractionTags(_0x225aac,_0x19d8b0);})['then'](function(_0x290438){return getStateInteraction(_0x290438);})[_0x6d49('0x2a')](function(_0xe2b981){_0x228fbf(_0xe2b981);})['catch'](function(_0x58a475){_0x1f02fd(_0x58a475);});});}function getStateInteraction(_0x3f12cf){return new BPromise(function(_0x1da751){_0x3f12cf[_0x6d49('0x36')]=0x0;_0x3f12cf[_0x6d49('0x37')]=0x0;_0x3f12cf[_0x6d49('0x38')]=0x0;_0x3f12cf[_0x6d49('0x39')]=0x0;_0x3f12cf[_0x6d49('0x3a')]=0x0;if(!_0x3f12cf[_0x6d49('0x3b')]&&!_0x3f12cf[_0x6d49('0x3c')]){_0x3f12cf[_0x6d49('0x36')]+=0x1;}if(!_0x3f12cf[_0x6d49('0x3b')]&&_0x3f12cf['UserId']){_0x3f12cf[_0x6d49('0x37')]+=0x1;if(_0x3f12cf[_0x6d49('0x36')]){_0x3f12cf[_0x6d49('0x36')]-=0x1;}}if(_0x3f12cf[_0x6d49('0x3b')]&&_0x3f12cf['UserId']){_0x3f12cf[_0x6d49('0x38')]+=0x1;if(_0x3f12cf[_0x6d49('0x37')]){_0x3f12cf[_0x6d49('0x37')]-=0x1;}}if(_0x3f12cf[_0x6d49('0x3b')]&&!_0x3f12cf[_0x6d49('0x3c')]){_0x3f12cf[_0x6d49('0x39')]+=0x1;if(_0x3f12cf[_0x6d49('0x36')]){_0x3f12cf['waiting']-=0x1;}}_0x3f12cf['total']+=0x1;_0x1da751(_0x3f12cf);});}exports[_0x6d49('0x3d')]=function(_0x52ac07,_0xb75da5){var _0x6b0e50={},_0x27b636={},_0x934fe8={'count':0x0,'rows':[]};var _0x39df5c=_[_0x6d49('0x31')](db[_0x6d49('0x3e')]['rawAttributes'],function(_0x6b08b3){return{'name':_0x6b08b3[_0x6d49('0x3f')],'type':_0x6b08b3[_0x6d49('0x40')][_0x6d49('0x41')]};});_0x27b636[_0x6d49('0x42')]=_[_0x6d49('0x31')](_0x39df5c,'name');_0x27b636[_0x6d49('0x43')]=_['keys'](_0x52ac07[_0x6d49('0x43')]);_0x27b636[_0x6d49('0x44')]=_[_0x6d49('0x45')](_0x27b636[_0x6d49('0x42')],_0x27b636[_0x6d49('0x43')]);_0x6b0e50[_0x6d49('0x46')]=_[_0x6d49('0x45')](_0x27b636[_0x6d49('0x42')],qs[_0x6d49('0x47')](_0x52ac07[_0x6d49('0x43')]['fields']));_0x6b0e50['attributes']=_0x6b0e50['attributes'][_0x6d49('0x48')]?_0x6b0e50[_0x6d49('0x46')]:_0x27b636[_0x6d49('0x42')];if(!_0x52ac07['query']['hasOwnProperty'](_0x6d49('0x49'))){_0x6b0e50[_0x6d49('0x23')]=qs[_0x6d49('0x23')](_0x52ac07[_0x6d49('0x43')][_0x6d49('0x23')]);_0x6b0e50[_0x6d49('0x21')]=qs[_0x6d49('0x21')](_0x52ac07[_0x6d49('0x43')][_0x6d49('0x21')]);}_0x6b0e50[_0x6d49('0x4a')]=qs[_0x6d49('0x4b')](_0x52ac07[_0x6d49('0x43')][_0x6d49('0x4b')]);_0x6b0e50[_0x6d49('0x4c')]=qs[_0x6d49('0x44')](_['pick'](_0x52ac07[_0x6d49('0x43')],_0x27b636[_0x6d49('0x44')]),_0x39df5c);var _0x23a662=[];var _0x19a566=squel[_0x6d49('0x4d')]()[_0x6d49('0x4e')]('id')[_0x6d49('0x4e')](_0x6d49('0x2e'))[_0x6d49('0x4e')](_0x6d49('0x4f'))[_0x6d49('0x50')](_0x6d49('0x51'));var _0x5d9bd5=squel[_0x6d49('0x4d')]()[_0x6d49('0x4e')]('u.id')['field']('u.fullname')[_0x6d49('0x4e')](_0x6d49('0x52'))['from']('user_has_openchannel_interactions','ui')[_0x6d49('0x53')](_0x6d49('0x54'),'u',_0x6d49('0x55'));var _0x5f5ac4=squel[_0x6d49('0x4d')]()['from'](_0x6d49('0x56'),'i')['left_join'](_0x6d49('0x57'),'c',_0x6d49('0x58'))['left_join'](_0x6d49('0x54'),'o',_0x6d49('0x59'))[_0x6d49('0x53')]('openchannel_accounts','a',_0x6d49('0x5a'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x6d49('0x53')]('openchannel_interaction_has_tags','it',_0x6d49('0x5b'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1f308b=squel[_0x6d49('0x5c')]();var _0x3f2399=[];var _0x2ee2c5=squel[_0x6d49('0x5c')]();var _0x2202de;if(_0x52ac07[_0x6d49('0x43')][_0x6d49('0x5d')]){_0x2202de=as[_0x6d49('0x5e')](_0x52ac07['query']['search']);var _0x3c0895=_0x2202de[_0x6d49('0x5f')];for(var _0x108378=0x0;_0x108378<_0x2202de['conditions'][_0x6d49('0x48')];_0x108378++){var _0x2ed16b=_0x2202de[_0x6d49('0x60')][_0x108378];var _0x3d4534='i';var _0x2fd555=_[_0x6d49('0x61')](_0x39df5c,[_0x6d49('0x2e'),_0x2ed16b[_0x6d49('0x4e')]]);if(!_0x2fd555){switch(_0x2ed16b[_0x6d49('0x4e')]){case _0x6d49('0x62'):if(_0x2ed16b[_0x6d49('0x63')]==0x1){_0x5f5ac4['having']('`'+_0x2ed16b[_0x6d49('0x4e')]+_0x6d49('0x64'));}else{_0x5f5ac4[_0x6d49('0x65')]('`'+_0x2ed16b[_0x6d49('0x4e')]+_0x6d49('0x66'));}break;case _0x6d49('0x67'):if(_0x2ed16b['operator']===_0x6d49('0x68')){if(_0x2ed16b[_0x6d49('0x63')][_0x6d49('0x69')]('\x20')[_0x6d49('0x48')]>0x1){_0x1f308b[_0x3c0895]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2ed16b['value']),null);}else{var _0x552b98='%'+_0x2ed16b[_0x6d49('0x63')]+'%';_0x1f308b[_0x3c0895](_0x6d49('0x6a'),_0x552b98,_0x552b98,_0x552b98);}}else{_0x2fd555=_[_0x6d49('0x61')](_0x39df5c,[_0x6d49('0x2e'),'ContactId']);_0x2ed16b['field']=_0x6d49('0x6b');_0x448c0a=as['buildExpression'](_0x3d4534,_0x2fd555['type'],_0x2ed16b);_0x1f308b[_0x3c0895](_0x448c0a['text'],_0x448c0a[_0x6d49('0x63')]['start'],_0x448c0a[_0x6d49('0x63')][_0x6d49('0x1f')]);}break;case _0x6d49('0x6c'):var _0x3e06ee=_0x2ed16b['value']['split'](',')[_0x6d49('0x31')](function(_0x57326a){return Number(_0x57326a);});_0x3e06ee[_0x6d49('0x34')](function(_0x504464){_0x2ee2c5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x504464+',%');});_0x3f2399=_[_0x6d49('0x6d')](_0x3f2399,_0x3e06ee);break;case _0x6d49('0x6e'):if(_0x2ed16b['operator']==='$substring'){_0x1f308b[_0x3c0895](_0x6d49('0x6f'),'%'+_0x2ed16b[_0x6d49('0x63')]+'%',null);}else{_0x2fd555=_[_0x6d49('0x61')](_0x39df5c,[_0x6d49('0x2e'),'UserId']);_0x2ed16b[_0x6d49('0x4e')]=_0x6d49('0x3c');_0x448c0a=as[_0x6d49('0x70')](_0x3d4534,_0x2fd555['type'],_0x2ed16b);_0x1f308b[_0x3c0895](_0x448c0a[_0x6d49('0x71')],_0x448c0a[_0x6d49('0x63')][_0x6d49('0x72')],_0x448c0a[_0x6d49('0x63')][_0x6d49('0x1f')]);}break;case _0x6d49('0x73'):_0x448c0a=as[_0x6d49('0x70')]('me',null,_0x2ed16b);_0x1f308b[_0x3c0895](_0x448c0a[_0x6d49('0x71')],_0x448c0a['value']['start'],_0x448c0a[_0x6d49('0x63')][_0x6d49('0x1f')]);break;}}else{var _0x448c0a=as[_0x6d49('0x70')](_0x3d4534,_0x2fd555[_0x6d49('0x40')],_0x2ed16b);_0x1f308b[_0x3c0895](_0x448c0a[_0x6d49('0x71')],_0x448c0a[_0x6d49('0x63')][_0x6d49('0x72')],_0x448c0a[_0x6d49('0x63')][_0x6d49('0x1f')]);}}}else{var _0x451801=_(_0x52ac07[_0x6d49('0x43')])[_0x6d49('0x74')]()[_0x6d49('0x31')](function(_0x31779b){return _['some'](_0x39df5c,['name',_0x31779b])?_0x31779b:undefined;})['compact']()[_0x6d49('0x63')]();if(!_[_0x6d49('0x75')](_0x451801)){_0x451801[_0x6d49('0x34')](function(_0x1331d6){if(_0x1331d6===_0x6d49('0x76')){_0x5f5ac4[_0x6d49('0x4c')](_0x6d49('0x77'),[]['concat'](_0x52ac07['query'][_0x1331d6]));}else if(_0x1331d6===_0x6d49('0x78')){var _0xafdd96=JSON[_0x6d49('0x79')](_0x52ac07[_0x6d49('0x43')][_0x1331d6])[_0x6d49('0x7a')];var _0x52542f=JSON[_0x6d49('0x79')](_0x52ac07['query'][_0x1331d6])['$lte'];_0x5f5ac4[_0x6d49('0x4c')](_0x6d49('0x7b'),_0xafdd96,_0x52542f);}else{if(_0x52ac07[_0x6d49('0x43')][_0x1331d6]==='null'){_0x5f5ac4[_0x6d49('0x4c')]('i.'+_0x1331d6+_0x6d49('0x7c'));}else{_0x5f5ac4[_0x6d49('0x4c')]('i.'+_0x1331d6+'\x20=\x20?',_0x52ac07[_0x6d49('0x43')][_0x1331d6]);}}});}if(_0x52ac07[_0x6d49('0x43')][_0x6d49('0x7d')]){if(_0x52ac07[_0x6d49('0x43')][_0x6d49('0x7d')]==0x1){_0x5f5ac4['having'](_0x6d49('0x7e'));}else{_0x5f5ac4[_0x6d49('0x65')](_0x6d49('0x7f'));}}if(_0x52ac07[_0x6d49('0x43')][_0x6d49('0x80')]){_0x3f2399=_[_0x6d49('0x81')](_0x52ac07[_0x6d49('0x43')]['tag'])?_0x52ac07[_0x6d49('0x43')][_0x6d49('0x80')]:new Array(_0x52ac07[_0x6d49('0x43')][_0x6d49('0x80')]);_0x3f2399[_0x6d49('0x34')](function(_0xa82ac5){_0x2ee2c5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa82ac5+',%');});}if(_0x52ac07['query']['filter']){var _0x4dd9f7=_0x52ac07['query'][_0x6d49('0x82')][_0x6d49('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6d49('0x84')](_0x4dd9f7)){_0x1f308b['or']('i.id\x20LIKE\x20?',_0x4dd9f7+'%');}else{_0x1f308b['or'](_0x6d49('0x85'),qs[_0x6d49('0x86')](_0x4dd9f7))['or'](_0x6d49('0x87'),_0x4dd9f7+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4dd9f7+'%');}}}_0x5f5ac4[_0x6d49('0x4c')](_0x1f308b);_0x5f5ac4[_0x6d49('0x88')](_0x6d49('0x89'));var _0x3e03e2={'type':db[_0x6d49('0x8a')][_0x6d49('0x8b')][_0x6d49('0x8c')],'raw':!![]};var _0x140a64=_0x5f5ac4[_0x6d49('0x8d')]();_0x140a64[_0x6d49('0x4e')]('i.id');_0x140a64[_0x6d49('0x4e')](_0x6d49('0x8e'),'unreadMessages');if(_0x6b0e50['order']){_0x6b0e50[_0x6d49('0x4a')][_0x6d49('0x34')](function(_0x5c769a){var _0x2a79eb=_0x5c769a[0x0]===_0x6d49('0x8f')?_0x5c769a[0x0]:'i.'+_0x5c769a[0x0];_0x5f5ac4['order'](_0x2a79eb,_0x5c769a[0x1]===_0x6d49('0x90')?![]:!![]);});}if(!_[_0x6d49('0x75')](_0x3f2399)){_0x5f5ac4[_0x6d49('0x65')](_0x2ee2c5);_0x140a64[_0x6d49('0x4c')](_0x6d49('0x91'),_0x3f2399);}BPromise['resolve']()[_0x6d49('0x2a')](function(){if(!_0x2202de){if(_0x52ac07['query'][_0x6d49('0x76')])return;_0x140a64[_0x6d49('0x4c')](_0x6d49('0x92'));_0x5f5ac4[_0x6d49('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x52ac07[_0x6d49('0x93')]['role']!==_0x6d49('0x94'))return;return _0x52ac07[_0x6d49('0x93')][_0x6d49('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2122df){if(_['isEmpty'](_0x2122df)){_0x140a64[_0x6d49('0x4c')](_0x6d49('0x96'));_0x5f5ac4[_0x6d49('0x4c')](_0x6d49('0x96'));}else{_0x140a64[_0x6d49('0x4c')](_0x6d49('0x77'),_[_0x6d49('0x31')](_0x2122df,'id'));_0x5f5ac4['where'](_0x6d49('0x77'),_['map'](_0x2122df,'id'));}});})[_0x6d49('0x2a')](function(){if(_0x52ac07[_0x6d49('0x93')][_0x6d49('0x97')]===_0x6d49('0x94')&&!_0x2202de&&!_0x52ac07[_0x6d49('0x43')][_0x6d49('0x76')])return[];return db[_0x6d49('0x98')][_0x6d49('0x43')](_0x140a64['toString'](),_0x3e03e2);})[_0x6d49('0x2a')](function(_0x1a60c6){_0x934fe8[_0x6d49('0x24')]=_0x1a60c6['length'];if(_0x934fe8[_0x6d49('0x24')]===0x0)return[];return db[_0x6d49('0x98')][_0x6d49('0x43')](_0x19a566['toString'](),_0x3e03e2)[_0x6d49('0x2a')](function(_0x294508){_0x23a662=_[_0x6d49('0x99')](_0x294508,'id');_0x3e03e2=_[_0x6d49('0x9a')](_0x3e03e2,{'model':db[_0x6d49('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52ac07[_0x6d49('0x43')][_0x6d49('0x47')]){_0x6b0e50[_0x6d49('0x46')][_0x6d49('0x34')](function(_0x316273){_0x5f5ac4['field']('i.'+_0x316273);});}else{_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0x8e'),_0x6d49('0x62'));_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0x9b'),_0x6d49('0x9c'));_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0x9d'),_0x6d49('0x9e'));_0x5f5ac4[_0x6d49('0x4e')]('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');_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0x9f'));_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0xa0'),'Contact.firstName');_0x5f5ac4['field'](_0x6d49('0xa1'),_0x6d49('0xa2'));_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0xa3'),'Contact.email');_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0xa4'),_0x6d49('0xa5'));_0x5f5ac4[_0x6d49('0x4e')]('c.mobile','Contact.mobile');_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0xa6'),_0x6d49('0xa7'));_0x5f5ac4['field']('o.fullname',_0x6d49('0xa8'));_0x5f5ac4[_0x6d49('0x4e')](_0x6d49('0xa9'),'Owner.internal');_0x5f5ac4[_0x6d49('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6d49('0x32'));}if(_0x6b0e50[_0x6d49('0x23')])_0x5f5ac4[_0x6d49('0x23')](_0x6b0e50['limit']);if(_0x6b0e50[_0x6d49('0x21')])_0x5f5ac4[_0x6d49('0x21')](_0x6b0e50[_0x6d49('0x21')]);return db[_0x6d49('0x98')][_0x6d49('0x43')](_0x5f5ac4[_0x6d49('0xaa')](),_0x3e03e2);})[_0x6d49('0x2a')](function(_0x5937f1){if(_0x5937f1[_0x6d49('0x48')]>0x0)_0x5d9bd5[_0x6d49('0x4c')](_0x6d49('0xab'),_[_0x6d49('0x31')](_0x5937f1,'id'));return db[_0x6d49('0x98')]['query'](_0x5d9bd5[_0x6d49('0xaa')](),_0x3e03e2)['then'](function(_0xebcbae){var _0x4028c3=_[_0x6d49('0xac')](_0xebcbae,_0x6d49('0xad'));var _0x22cdfa=[];_0x5937f1[_0x6d49('0x34')](function(_0xd44ab1){_0x22cdfa[_0x6d49('0x35')](updateOpenchannelInteraction(_0xd44ab1,_0x23a662,_0x4028c3));});return BPromise[_0x6d49('0xae')](_0x22cdfa);});});})['then'](function(_0x33bf71){_0x934fe8[_0x6d49('0xaf')]=_0x33bf71;return _0x934fe8;})[_0x6d49('0x2a')](respondWithFilteredResult(_0xb75da5,_0x6b0e50))['catch'](handleError(_0xb75da5,null));};exports['show']=function(_0x54558c,_0x2d7c1a){var _0x29bfa0={};if(_0x54558c[_0x6d49('0x43')][_0x6d49('0x40')]&&_0x54558c[_0x6d49('0x43')][_0x6d49('0x40')]==='from'){_0x29bfa0['from']=_0x54558c['params']['id'];}else{_0x29bfa0['id']=_0x54558c[_0x6d49('0xb0')]['id'];}var _0x34841a={'raw':![],'where':_0x29bfa0},_0x3b1cf2={};_0x3b1cf2['model']=_[_0x6d49('0x74')](db[_0x6d49('0x3e')][_0x6d49('0xb1')]);_0x3b1cf2[_0x6d49('0x43')]=_['keys'](_0x54558c[_0x6d49('0x43')]);_0x3b1cf2[_0x6d49('0x44')]=_[_0x6d49('0x45')](_0x3b1cf2[_0x6d49('0x42')],_0x3b1cf2[_0x6d49('0x43')]);_0x34841a['attributes']=_[_0x6d49('0x45')](_0x3b1cf2[_0x6d49('0x42')],qs[_0x6d49('0x47')](_0x54558c['query'][_0x6d49('0x47')]));_0x34841a['attributes']=_0x34841a['attributes'][_0x6d49('0x48')]?_0x34841a[_0x6d49('0x46')]:_0x3b1cf2[_0x6d49('0x42')];if(_0x54558c[_0x6d49('0x43')][_0x6d49('0xb2')]){_0x34841a[_0x6d49('0xb3')]=[{'all':!![]}];}_0x34841a=_[_0x6d49('0x9a')]({},_0x34841a,_0x54558c['options']);return db[_0x6d49('0x3e')][_0x6d49('0x61')](_0x34841a)[_0x6d49('0x2a')](handleEntityNotFound(_0x2d7c1a,null))[_0x6d49('0x2a')](respondWithResult(_0x2d7c1a,null))['catch'](handleError(_0x2d7c1a,null));};exports['create']=function(_0x39a0a0,_0x50ffe7){return db[_0x6d49('0x3e')]['create'](_0x39a0a0['body'],{})['then'](respondWithResult(_0x50ffe7,0xc9))[_0x6d49('0xb4')](handleError(_0x50ffe7,null));};exports[_0x6d49('0x29')]=function(_0x5729e7,_0x2145dc){if(_0x5729e7[_0x6d49('0x73')]['id']){delete _0x5729e7[_0x6d49('0x73')]['id'];}return db[_0x6d49('0x3e')][_0x6d49('0x61')]({'where':{'id':_0x5729e7[_0x6d49('0xb0')]['id']}})[_0x6d49('0x2a')](handleEntityNotFound(_0x2145dc,null))[_0x6d49('0x2a')](saveUpdates(_0x5729e7[_0x6d49('0x73')],null))[_0x6d49('0x2a')](respondWithResult(_0x2145dc,null))['catch'](handleError(_0x2145dc,null));};exports[_0x6d49('0x2b')]=function(_0x2fe06a,_0x52f7a1){return db['OpenchannelInteraction'][_0x6d49('0x61')]({'where':{'id':_0x2fe06a[_0x6d49('0xb0')]['id']}})['then'](handleEntityNotFound(_0x52f7a1,null))[_0x6d49('0x2a')](removeEntity(_0x52f7a1,null))[_0x6d49('0xb4')](handleError(_0x52f7a1,null));};exports[_0x6d49('0xb5')]=function(_0x3ffb9e,_0x2c4d3a){return db[_0x6d49('0x3e')][_0x6d49('0xb5')]()[_0x6d49('0x2a')](respondWithResult(_0x2c4d3a,null))[_0x6d49('0xb4')](handleError(_0x2c4d3a,null));};exports[_0x6d49('0xb6')]=function(_0x3b1d42,_0x502d54,_0x12bc91){return db[_0x6d49('0xb7')][_0x6d49('0x61')]({'where':{'id':_0x3b1d42['params']['id']}})[_0x6d49('0x2a')](handleEntityNotFound(_0x502d54,null))[_0x6d49('0x2a')](function(_0x5bb723){if(_0x5bb723){return _0x5bb723[_0x6d49('0xb6')](_0x3b1d42[_0x6d49('0x73')][_0x6d49('0xb8')],_[_0x6d49('0xb9')](_0x3b1d42['body'],[_0x6d49('0xb8'),'id'])||{});}})[_0x6d49('0x2a')](respondWithResult(_0x502d54,null))[_0x6d49('0xb4')](handleError(_0x502d54,null));};exports[_0x6d49('0xba')]=function(_0x65ceb3,_0x355065,_0x5abf7c){var _0x3f7512={'raw':![],'where':{}};var _0x273d51={};var _0x20b2ee={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x6d49('0xbb')]({'where':{'id':_0x65ceb3[_0x6d49('0xb0')]['id']}})['then'](handleEntityNotFound(_0x355065,null))[_0x6d49('0x2a')](function(_0x2e8bd3){if(_0x2e8bd3){_0x273d51[_0x6d49('0x42')]=_[_0x6d49('0x74')](db[_0x6d49('0xb7')]['rawAttributes']);_0x273d51[_0x6d49('0x43')]=_['keys'](_0x65ceb3['query']);_0x273d51[_0x6d49('0x44')]=_[_0x6d49('0x45')](_0x273d51[_0x6d49('0x42')],_0x273d51['query']);_0x3f7512[_0x6d49('0x46')]=_[_0x6d49('0x45')](_0x273d51[_0x6d49('0x42')],qs['fields'](_0x65ceb3[_0x6d49('0x43')][_0x6d49('0x47')]));_0x3f7512[_0x6d49('0x46')]=_0x3f7512[_0x6d49('0x46')][_0x6d49('0x48')]?_0x3f7512['attributes']:_0x273d51[_0x6d49('0x42')];if(!_0x65ceb3[_0x6d49('0x43')][_0x6d49('0xbc')](_0x6d49('0x49'))){_0x3f7512[_0x6d49('0x23')]=qs[_0x6d49('0x23')](_0x65ceb3[_0x6d49('0x43')]['limit']);_0x3f7512[_0x6d49('0x21')]=qs[_0x6d49('0x21')](_0x65ceb3[_0x6d49('0x43')][_0x6d49('0x21')]);}_0x3f7512[_0x6d49('0x4a')]=qs[_0x6d49('0x4b')](_0x65ceb3[_0x6d49('0x43')]['sort']);_0x3f7512[_0x6d49('0x4c')]=qs[_0x6d49('0x44')](_[_0x6d49('0xbd')](_0x65ceb3[_0x6d49('0x43')],_0x273d51[_0x6d49('0x44')]));_0x3f7512[_0x6d49('0x4c')][_0x6d49('0xad')]=_0x2e8bd3['id'];if(_0x65ceb3['query'][_0x6d49('0x82')]){_0x3f7512[_0x6d49('0x4c')]=_[_0x6d49('0x9a')](_0x3f7512[_0x6d49('0x4c')],{'$or':_[_0x6d49('0x31')](_0x3f7512['attributes'],function(_0x366299){var _0x451f5d={};_0x451f5d[_0x366299]={'$like':'%'+_0x65ceb3[_0x6d49('0x43')][_0x6d49('0x82')]+'%'};return _0x451f5d;})});}if(_0x65ceb3['query'][_0x6d49('0x7a')]){var _0x3316fe=_0x65ceb3['query'][_0x6d49('0x7a')][_0x6d49('0x69')](',');var _0x833fac={};_0x833fac[_0x3316fe[0x0]]={'$gte':moment(_0x3316fe[0x1])['format'](_0x6d49('0xbe'))};_0x3f7512[_0x6d49('0x4c')]=_[_0x6d49('0x9a')](_0x3f7512[_0x6d49('0x4c')],_0x833fac);}_0x3f7512=_[_0x6d49('0x9a')]({},_0x3f7512,_0x65ceb3[_0x6d49('0xbf')]);return db[_0x6d49('0xb7')][_0x6d49('0x24')]({'where':_0x3f7512[_0x6d49('0x4c')]})[_0x6d49('0x2a')](function(_0x49b0e1){_0x20b2ee[_0x6d49('0x24')]=_0x49b0e1;if(_0x65ceb3[_0x6d49('0x43')][_0x6d49('0xb2')]){_0x3f7512['include']=[{'all':!![]}];}return db[_0x6d49('0xb7')][_0x6d49('0xc0')](_0x3f7512);})[_0x6d49('0x2a')](function(_0xb3b6c7){_0x20b2ee['rows']=_0xb3b6c7;return _0x20b2ee;});}})[_0x6d49('0x2a')](respondWithFilteredResult(_0x355065,_0x3f7512))[_0x6d49('0xb4')](handleError(_0x355065,null));};exports[_0x6d49('0xc1')]=function(_0x48d121,_0x5bf9ef,_0x30fab8){return db[_0x6d49('0x3e')][_0x6d49('0x61')]({'where':{'id':_0x48d121[_0x6d49('0xb0')]['id']}})[_0x6d49('0x2a')](handleEntityNotFound(_0x5bf9ef,null))[_0x6d49('0x2a')](function(_0x440e4b){if(_0x440e4b){return _0x440e4b[_0x6d49('0xc2')](_0x48d121[_0x6d49('0x73')][_0x6d49('0xb8')],_[_0x6d49('0xb9')](_0x48d121['body'],['ids','id'])||{})[_0x6d49('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id',_0x6d49('0x2e'),'color'],'where':{'id':_0x48d121['body']['ids']}});})[_0x6d49('0x2a')](function(_0x598892){socket[_0x6d49('0xc4')]('openchannelInteractionTags:save',{'id':Number(_0x48d121[_0x6d49('0xb0')]['id']),'tags':_0x598892||[]});return{'id':Number(_0x48d121[_0x6d49('0xb0')]['id']),'tags':_0x598892||[]};});}})[_0x6d49('0x2a')](respondWithResult(_0x5bf9ef,null))['catch'](handleError(_0x5bf9ef,null));};exports[_0x6d49('0xc5')]=function(_0x262a90,_0x454b88,_0x53c1b5){return db[_0x6d49('0x3e')]['find']({'where':{'id':_0x262a90['params']['id']}})[_0x6d49('0x2a')](handleEntityNotFound(_0x454b88,null))['then'](function(_0x472877){if(_0x472877){return _0x472877[_0x6d49('0xc5')](_0x262a90[_0x6d49('0x43')][_0x6d49('0xb8')]);}})[_0x6d49('0x2a')](respondWithStatusCode(_0x454b88,null))[_0x6d49('0xb4')](handleError(_0x454b88,null));};exports[_0x6d49('0xc6')]=function(_0x4c6fee,_0x27d4eb){var _0x578233=moment()['unix']()[_0x6d49('0xaa')]();var _0x121837=path[_0x6d49('0xc7')](config[_0x6d49('0xc8')],_0x6d49('0xc9'),'files',_0x6d49('0xca'));var _0x594fcb=path[_0x6d49('0xc7')](config['root'],_0x6d49('0xc9'),_0x6d49('0xcb'),_0x6d49('0xcc'));var _0x15e3ea=path[_0x6d49('0xc7')](_0x121837,_0x578233);var _0x3fbe2a=util[_0x6d49('0xcd')]('transcript-%d-%s.zip',_0x4c6fee[_0x6d49('0xb0')]['id'],_0x578233);var _0x5588ec=path[_0x6d49('0xc7')](_0x121837,_0x3fbe2a);var _0x188622=[];_0x188622[_0x6d49('0x35')]({'model':db[_0x6d49('0x6e')],'as':_0x6d49('0x6e'),'attributes':['id',_0x6d49('0xce')],'raw':!![]});_0x188622[_0x6d49('0x35')]({'model':db[_0x6d49('0xcf')],'as':_0x6d49('0x67'),'attributes':['id',_0x6d49('0xd0'),'lastName'],'raw':!![]});if(_0x4c6fee[_0x6d49('0x43')]['attachments']){_0x188622[_0x6d49('0x35')]({'model':db[_0x6d49('0xd1')],'as':_0x6d49('0xd1'),'raw':!![]});}var _0x52d919=[{'model':db[_0x6d49('0xb7')],'as':_0x6d49('0xd2'),'attributes':['id',_0x6d49('0x73'),'createdAt','direction',_0x6d49('0xd3'),_0x6d49('0x7d')],'include':_0x188622}];_0x52d919[_0x6d49('0x35')]({'model':db[_0x6d49('0xd4')],'as':_0x6d49('0xd5'),'attributes':['id',_0x6d49('0x2e')]});_0x52d919[_0x6d49('0x35')]({'model':db[_0x6d49('0x6e')],'as':_0x6d49('0xd6'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x6d49('0x61')]({'where':{'id':_0x4c6fee['params']['id']},'include':_0x52d919})[_0x6d49('0x2a')](handleEntityNotFound(_0x27d4eb,null))[_0x6d49('0x2a')](function(_0xcfc1ea){if(_0xcfc1ea){var _0x1ea876=_0xcfc1ea['get']({'plain':!![]});fs['mkdirSync'](_0x15e3ea);var _0x12be69={'channel':_0x6d49('0xd7'),'account':_0x1ea876['Account']['name'],'agent':_0x1ea876[_0x6d49('0xd6')]?_0x1ea876[_0x6d49('0xd6')][_0x6d49('0xce')]:'N.A.','createdAt':moment(_0x1ea876['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1ea876[_0x6d49('0x3b')]?moment(_0x1ea876[_0x6d49('0xd8')])[_0x6d49('0xcd')](_0x6d49('0xbe'))[_0x6d49('0xaa')]():'','disposition':_0x1ea876[_0x6d49('0xd9')],'visibility':_0x1ea876['threadId']?_0x6d49('0xda'):_0x6d49('0xdb'),'messages':_(_0x1ea876[_0x6d49('0xd2')])[_0x6d49('0x82')]({'secret':![]})[_0x6d49('0x31')](function(_0x6879f1){if(_0x6879f1[_0x6d49('0xd1')]){var _0x48a1c8=path['join'](_0x594fcb,_0x6879f1[_0x6d49('0xd1')]['basename']);if(fs['existsSync'](_0x48a1c8)){fs['createReadStream'](_0x48a1c8)[_0x6d49('0xdc')](fs[_0x6d49('0xdd')](path[_0x6d49('0xc7')](_0x15e3ea,_0x6879f1[_0x6d49('0xd1')][_0x6d49('0xde')])));}}return{'date':moment(_0x6879f1[_0x6d49('0x78')])['format'](_0x6d49('0xbe'))[_0x6d49('0xaa')](),'sender':_0x6879f1[_0x6d49('0xdf')]==='out'?_0x6879f1[_0x6d49('0x6e')]?_0x6879f1[_0x6d49('0x6e')]['fullname']:_0x6d49('0xe0'):_0x6879f1['Contact'][_0x6d49('0xd0')]+(_0x6879f1[_0x6d49('0x67')]['lastName']?'\x20'+_0x6879f1[_0x6d49('0x67')][_0x6d49('0xe1')]:''),'body':_0x6879f1[_0x6d49('0xd1')]?_0x6879f1[_0x6d49('0xd1')]['basename']:_0x6879f1['body'],'direction':_0x6879f1[_0x6d49('0xdf')]===_0x6d49('0xe2')?'A':'C','secret':_0x6879f1[_0x6d49('0xd3')],'read':_0x6879f1[_0x6d49('0x7d')],'attachment':_0x6879f1[_0x6d49('0xd1')]};})[_0x6d49('0x63')]()};return ejs[_0x6d49('0xe3')](path['join'](config[_0x6d49('0xc8')],_0x6d49('0xc9'),_0x6d49('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x12be69})[_0x6d49('0x2a')](function(_0xa0b038){var _0x54e876=path['join'](_0x15e3ea,_0x6d49('0xe5')+_0x1ea876['id']+'-'+_0x578233+_0x6d49('0xe6'));var _0x503c96={'path':_0x54e876,'channel':_0x6d49('0xd7'),'interactionId':_0x1ea876['id']};return pdf[_0x6d49('0xe7')](_0xa0b038,_0x503c96);})[_0x6d49('0x2a')](function(){return new BPromise(function(_0x417087,_0x233426){zipdir(_0x15e3ea,{'saveTo':_0x5588ec},function(_0x1abeb3,_0x56c34f){if(_0x1abeb3)return _0x233426(_0x1abeb3);return _0x417087(_0x56c34f);});})[_0x6d49('0x2a')](function(){return new BPromise(function(_0x22881b,_0xa4dea3){rimraf(_0x15e3ea,function(_0x102ebc){if(_0x102ebc)_0xa4dea3(_0x102ebc);return _0x22881b();});});})[_0x6d49('0x2a')](function(){return _0x27d4eb['download'](_0x5588ec,_0x3fbe2a,function(_0x545b09){if(_0x545b09){console[_0x6d49('0xe8')]('err',_0x545b09);}else{fs['unlinkSync'](_0x5588ec);}});});});}else{return _0x27d4eb[_0x6d49('0x1d')](0xc8);}})[_0x6d49('0xb4')](handleError(_0x27d4eb,null));}; \ No newline at end of file +var _0xac20=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`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)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','show','params','includeAll','include','options','create','describe','OpenchannelMessage','ids','getMessages','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','out','System','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection'];(function(_0x31c711,_0x501165){var _0x581b42=function(_0x393eef){while(--_0x393eef){_0x31c711['push'](_0x31c711['shift']());}};_0x581b42(++_0x501165);}(_0xac20,0xad));var _0x0ac2=function(_0xbd7db7,_0x29805e){_0xbd7db7=_0xbd7db7-0x0;var _0x22df07=_0xac20[_0xbd7db7];return _0x22df07;};'use strict';var emlformat=require(_0x0ac2('0x0'));var rimraf=require(_0x0ac2('0x1'));var zipdir=require(_0x0ac2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ac2('0x3'));var moment=require(_0x0ac2('0x4'));var BPromise=require(_0x0ac2('0x5'));var Mustache=require(_0x0ac2('0x6'));var util=require('util');var path=require(_0x0ac2('0x7'));var sox=require('sox');var csv=require(_0x0ac2('0x8'));var ejs=require(_0x0ac2('0x9'));var fs=require('fs');var fs_extra=require(_0x0ac2('0xa'));var _=require(_0x0ac2('0xb'));var squel=require(_0x0ac2('0xc'));var crypto=require(_0x0ac2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ac2('0x8'));var querystring=require(_0x0ac2('0xe'));var Papa=require(_0x0ac2('0xf'));var Redis=require(_0x0ac2('0x10'));var authService=require(_0x0ac2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0ac2('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0ac2('0x13'));var logger=require(_0x0ac2('0x14'))(_0x0ac2('0x15'));var utils=require(_0x0ac2('0x16'));var config=require(_0x0ac2('0x17'));var licenseUtil=require(_0x0ac2('0x18'));var db=require(_0x0ac2('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0ac2('0x1a'),'port':0x18eb});var socket=require(_0x0ac2('0x1b'))(new Redis(config['redis']));require(_0x0ac2('0x1c'))[_0x0ac2('0x1d')](socket);function respondWithStatusCode(_0x5e69b2,_0x23ff75){_0x23ff75=_0x23ff75||0xcc;return function(_0x2cccfc){if(_0x2cccfc){return _0x5e69b2[_0x0ac2('0x1e')](_0x23ff75);}return _0x5e69b2[_0x0ac2('0x1f')](_0x23ff75)[_0x0ac2('0x20')]();};}function respondWithResult(_0x5379de,_0xa7b902){_0xa7b902=_0xa7b902||0xc8;return function(_0xc90dab){if(_0xc90dab){return _0x5379de['status'](_0xa7b902)[_0x0ac2('0x21')](_0xc90dab);}};}function respondWithFilteredResult(_0x55b7a4,_0xce0b0d){return function(_0x1fb36f){if(_0x1fb36f){var _0x3d01f6=typeof _0xce0b0d[_0x0ac2('0x22')]===_0x0ac2('0x23')&&typeof _0xce0b0d[_0x0ac2('0x24')]===_0x0ac2('0x23');var _0x23af97=_0x1fb36f[_0x0ac2('0x25')];var _0x5b31b5=_0x3d01f6?0x0:_0xce0b0d[_0x0ac2('0x22')];var _0xd6abf8=_0x3d01f6?_0x1fb36f[_0x0ac2('0x25')]:_0xce0b0d[_0x0ac2('0x22')]+_0xce0b0d[_0x0ac2('0x24')];var _0x17e836;if(_0xd6abf8>=_0x23af97){_0xd6abf8=_0x23af97;_0x17e836=0xc8;}else{_0x17e836=0xce;}_0x55b7a4[_0x0ac2('0x1f')](_0x17e836);return _0x55b7a4[_0x0ac2('0x26')](_0x0ac2('0x27'),_0x5b31b5+'-'+_0xd6abf8+'/'+_0x23af97)[_0x0ac2('0x21')](_0x1fb36f);}return null;};}function patchUpdates(_0x2025b9){return function(_0xbdb25b){try{jsonpatch[_0x0ac2('0x28')](_0xbdb25b,_0x2025b9,!![]);}catch(_0x545169){return BPromise[_0x0ac2('0x29')](_0x545169);}return _0xbdb25b[_0x0ac2('0x2a')]();};}function saveUpdates(_0x45f6de,_0x1ca114){return function(_0x34e881){if(_0x34e881){return _0x34e881[_0x0ac2('0x2b')](_0x45f6de)[_0x0ac2('0x2c')](function(_0x13ccf2){return _0x13ccf2;});}return null;};}function removeEntity(_0x26d399,_0x4cf5ef){return function(_0x270ea1){if(_0x270ea1){return _0x270ea1[_0x0ac2('0x2d')]()[_0x0ac2('0x2c')](function(){_0x26d399['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a9cc,_0x273539){return function(_0x4f871e){if(!_0x4f871e){_0x13a9cc[_0x0ac2('0x1e')](0x194);}return _0x4f871e;};}function handleError(_0x2646b1,_0x18da4e){_0x18da4e=_0x18da4e||0x1f4;return function(_0x2be19d){logger[_0x0ac2('0x2e')](_0x2be19d['stack']);if(_0x2be19d[_0x0ac2('0x2f')]){delete _0x2be19d[_0x0ac2('0x2f')];}_0x2646b1[_0x0ac2('0x1f')](_0x18da4e)['send'](_0x2be19d);};}function getInteractionUsers(_0x599f1c,_0x23c27b){return new BPromise(function(_0x1cd950,_0x1adc13){try{if(_0x23c27b[_0x599f1c['id']]){_0x599f1c[_0x0ac2('0x30')]=_[_0x0ac2('0x31')](_0x23c27b[_0x599f1c['id']],function(_0x1552fa){return{'id':_0x1552fa['id'],'fullname':_0x1552fa[_0x0ac2('0x32')]};});}}catch(_0xfa0fc8){_0x1adc13(_0xfa0fc8);}_0x1cd950(_0x599f1c);});}function getInteractionTags(_0x55200f,_0x2c2fef){return new BPromise(function(_0x548f4c,_0x132d35){try{if(_0x55200f[_0x0ac2('0x33')]){_0x55200f[_0x0ac2('0x34')]=[];_0x55200f[_0x0ac2('0x33')][_0x0ac2('0x35')](',')[_0x0ac2('0x36')](function(_0x1ed583){_0x55200f['Tags'][_0x0ac2('0x37')](_0x2c2fef[_0x1ed583]);});}delete _0x55200f[_0x0ac2('0x33')];}catch(_0x560315){_0x132d35(_0x560315);}_0x548f4c(_0x55200f);});}function updateOpenchannelInteraction(_0x5f5211,_0x457583,_0x57b03a){return new BPromise(function(_0x945d7d,_0x1b3fe7){return getInteractionUsers(_0x5f5211,_0x57b03a)['then'](function(_0x121399){return getInteractionTags(_0x121399,_0x457583);})[_0x0ac2('0x2c')](function(_0x18af79){return getStateInteraction(_0x18af79);})[_0x0ac2('0x2c')](function(_0x5bc11a){_0x945d7d(_0x5bc11a);})[_0x0ac2('0x38')](function(_0x2212a5){_0x1b3fe7(_0x2212a5);});});}function getStateInteraction(_0x47d60a){return new BPromise(function(_0x279451){_0x47d60a[_0x0ac2('0x39')]=0x0;_0x47d60a[_0x0ac2('0x3a')]=0x0;_0x47d60a[_0x0ac2('0x3b')]=0x0;_0x47d60a[_0x0ac2('0x3c')]=0x0;_0x47d60a[_0x0ac2('0x3d')]=0x0;if(!_0x47d60a[_0x0ac2('0x3e')]&&!_0x47d60a['UserId']){_0x47d60a[_0x0ac2('0x39')]+=0x1;}if(!_0x47d60a[_0x0ac2('0x3e')]&&_0x47d60a[_0x0ac2('0x3f')]){_0x47d60a[_0x0ac2('0x3a')]+=0x1;if(_0x47d60a[_0x0ac2('0x39')]){_0x47d60a[_0x0ac2('0x39')]-=0x1;}}if(_0x47d60a[_0x0ac2('0x3e')]&&_0x47d60a[_0x0ac2('0x3f')]){_0x47d60a['answered']+=0x1;if(_0x47d60a[_0x0ac2('0x3a')]){_0x47d60a[_0x0ac2('0x3a')]-=0x1;}}if(_0x47d60a['closed']&&!_0x47d60a[_0x0ac2('0x3f')]){_0x47d60a['unmanaged']+=0x1;if(_0x47d60a[_0x0ac2('0x39')]){_0x47d60a['waiting']-=0x1;}}_0x47d60a['total']+=0x1;_0x279451(_0x47d60a);});}exports[_0x0ac2('0x40')]=function(_0x13f4d6,_0x5c4e10){var _0x352321={},_0x194612={},_0x586699={'count':0x0,'rows':[]};var _0x39cfdf=_['map'](db[_0x0ac2('0x41')][_0x0ac2('0x42')],function(_0x54668b){return{'name':_0x54668b[_0x0ac2('0x43')],'type':_0x54668b['type']['key']};});_0x194612[_0x0ac2('0x44')]=_[_0x0ac2('0x31')](_0x39cfdf,_0x0ac2('0x2f'));_0x194612[_0x0ac2('0x45')]=_[_0x0ac2('0x46')](_0x13f4d6[_0x0ac2('0x45')]);_0x194612[_0x0ac2('0x47')]=_[_0x0ac2('0x48')](_0x194612['model'],_0x194612['query']);_0x352321[_0x0ac2('0x49')]=_[_0x0ac2('0x48')](_0x194612[_0x0ac2('0x44')],qs['fields'](_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x4a')]));_0x352321['attributes']=_0x352321[_0x0ac2('0x49')][_0x0ac2('0x4b')]?_0x352321[_0x0ac2('0x49')]:_0x194612[_0x0ac2('0x44')];if(!_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x4c')]('nolimit')){_0x352321[_0x0ac2('0x24')]=qs[_0x0ac2('0x24')](_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x24')]);_0x352321[_0x0ac2('0x22')]=qs[_0x0ac2('0x22')](_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x22')]);}_0x352321[_0x0ac2('0x4d')]=qs[_0x0ac2('0x4e')](_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x4e')]);_0x352321[_0x0ac2('0x4f')]=qs['filters'](_[_0x0ac2('0x50')](_0x13f4d6[_0x0ac2('0x45')],_0x194612[_0x0ac2('0x47')]),_0x39cfdf);var _0x464f61=[];var _0x1eac6a=squel[_0x0ac2('0x51')]()[_0x0ac2('0x52')]('id')['field'](_0x0ac2('0x2f'))[_0x0ac2('0x52')](_0x0ac2('0x53'))['from'](_0x0ac2('0x54'));var _0x1cfcdd=squel[_0x0ac2('0x51')]()[_0x0ac2('0x52')](_0x0ac2('0x55'))[_0x0ac2('0x52')](_0x0ac2('0x56'))['field'](_0x0ac2('0x57'))[_0x0ac2('0x58')]('user_has_openchannel_interactions','ui')[_0x0ac2('0x59')](_0x0ac2('0x5a'),'u',_0x0ac2('0x5b'));var _0x411e89=squel[_0x0ac2('0x51')]()[_0x0ac2('0x58')](_0x0ac2('0x5c'),'i')[_0x0ac2('0x59')](_0x0ac2('0x5d'),'c',_0x0ac2('0x5e'))[_0x0ac2('0x59')](_0x0ac2('0x5a'),'o',_0x0ac2('0x5f'))[_0x0ac2('0x59')](_0x0ac2('0x60'),'a',_0x0ac2('0x61'))[_0x0ac2('0x59')](_0x0ac2('0x62'),'me',_0x0ac2('0x63'))[_0x0ac2('0x59')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x0ac2('0x59')](_0x0ac2('0x54'),'t',_0x0ac2('0x64'));var _0x3c595c=squel[_0x0ac2('0x65')]();var _0x2bf628=[];var _0x1cdb1f=squel['expr']();var _0x5f18da;if(_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x66')]){_0x5f18da=as[_0x0ac2('0x67')](_0x13f4d6['query']['search']);var _0x5ac84f=_0x5f18da[_0x0ac2('0x68')];for(var _0x25c980=0x0;_0x25c980<_0x5f18da[_0x0ac2('0x69')][_0x0ac2('0x4b')];_0x25c980++){var _0x8e43c2=_0x5f18da[_0x0ac2('0x69')][_0x25c980];var _0x5a5ddc='i';var _0x1d16da=_[_0x0ac2('0x6a')](_0x39cfdf,['name',_0x8e43c2[_0x0ac2('0x52')]]);if(!_0x1d16da){switch(_0x8e43c2[_0x0ac2('0x52')]){case _0x0ac2('0x6b'):if(_0x8e43c2[_0x0ac2('0x6c')]==0x1){_0x411e89[_0x0ac2('0x6d')]('`'+_0x8e43c2[_0x0ac2('0x52')]+_0x0ac2('0x6e'));}else{_0x411e89[_0x0ac2('0x6d')]('`'+_0x8e43c2['field']+_0x0ac2('0x6f'));}break;case _0x0ac2('0x70'):if(_0x8e43c2['operator']===_0x0ac2('0x71')){if(_0x8e43c2[_0x0ac2('0x6c')][_0x0ac2('0x35')]('\x20')['length']>0x1){_0x3c595c[_0x5ac84f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x8e43c2[_0x0ac2('0x6c')]),null);}else{var _0x3eb380='%'+_0x8e43c2['value']+'%';_0x3c595c[_0x5ac84f](_0x0ac2('0x72'),_0x3eb380,_0x3eb380,_0x3eb380);}}else{_0x1d16da=_[_0x0ac2('0x6a')](_0x39cfdf,['name','ContactId']);_0x8e43c2[_0x0ac2('0x52')]='ContactId';_0x95a21a=as[_0x0ac2('0x73')](_0x5a5ddc,_0x1d16da[_0x0ac2('0x74')],_0x8e43c2);_0x3c595c[_0x5ac84f](_0x95a21a[_0x0ac2('0x75')],_0x95a21a[_0x0ac2('0x6c')][_0x0ac2('0x76')],_0x95a21a[_0x0ac2('0x6c')][_0x0ac2('0x20')]);}break;case _0x0ac2('0x77'):var _0x1efd82=_0x8e43c2[_0x0ac2('0x6c')][_0x0ac2('0x35')](',')[_0x0ac2('0x31')](function(_0x4dbe35){return Number(_0x4dbe35);});_0x1efd82[_0x0ac2('0x36')](function(_0x2f8aec){_0x1cdb1f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2f8aec+',%');});_0x2bf628=_[_0x0ac2('0x78')](_0x2bf628,_0x1efd82);break;case _0x0ac2('0x79'):if(_0x8e43c2[_0x0ac2('0x7a')]==='$substring'){_0x3c595c[_0x5ac84f](_0x0ac2('0x7b'),'%'+_0x8e43c2[_0x0ac2('0x6c')]+'%',null);}else{_0x1d16da=_['find'](_0x39cfdf,[_0x0ac2('0x2f'),_0x0ac2('0x3f')]);_0x8e43c2[_0x0ac2('0x52')]='UserId';_0x95a21a=as['buildExpression'](_0x5a5ddc,_0x1d16da['type'],_0x8e43c2);_0x3c595c[_0x5ac84f](_0x95a21a[_0x0ac2('0x75')],_0x95a21a[_0x0ac2('0x6c')]['start'],_0x95a21a['value'][_0x0ac2('0x20')]);}break;case _0x0ac2('0x7c'):_0x95a21a=as[_0x0ac2('0x73')]('me',null,_0x8e43c2);_0x3c595c[_0x5ac84f](_0x95a21a[_0x0ac2('0x75')],_0x95a21a['value'][_0x0ac2('0x76')],_0x95a21a[_0x0ac2('0x6c')]['end']);break;}}else{var _0x95a21a=as['buildExpression'](_0x5a5ddc,_0x1d16da[_0x0ac2('0x74')],_0x8e43c2);_0x3c595c[_0x5ac84f](_0x95a21a[_0x0ac2('0x75')],_0x95a21a[_0x0ac2('0x6c')][_0x0ac2('0x76')],_0x95a21a['value'][_0x0ac2('0x20')]);}}}else{var _0x1e23ea=_(_0x13f4d6[_0x0ac2('0x45')])[_0x0ac2('0x46')]()['map'](function(_0x5392eb){return _[_0x0ac2('0x7d')](_0x39cfdf,['name',_0x5392eb])?_0x5392eb:undefined;})[_0x0ac2('0x7e')]()[_0x0ac2('0x6c')]();if(!_[_0x0ac2('0x7f')](_0x1e23ea)){_0x1e23ea[_0x0ac2('0x36')](function(_0x7e6aa6){if(_0x7e6aa6===_0x0ac2('0x80')){_0x411e89[_0x0ac2('0x4f')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x0ac2('0x81')](_0x13f4d6[_0x0ac2('0x45')][_0x7e6aa6]));}else if(_0x7e6aa6===_0x0ac2('0x82')){var _0x15dca6=JSON['parse'](_0x13f4d6[_0x0ac2('0x45')][_0x7e6aa6])[_0x0ac2('0x83')];var _0x5aadf6=JSON['parse'](_0x13f4d6[_0x0ac2('0x45')][_0x7e6aa6])[_0x0ac2('0x84')];_0x411e89[_0x0ac2('0x4f')](_0x0ac2('0x85'),_0x15dca6,_0x5aadf6);}else{if(_0x13f4d6[_0x0ac2('0x45')][_0x7e6aa6]==='null'){_0x411e89['where']('i.'+_0x7e6aa6+'\x20IS\x20NULL');}else{_0x411e89[_0x0ac2('0x4f')]('i.'+_0x7e6aa6+_0x0ac2('0x86'),_0x13f4d6[_0x0ac2('0x45')][_0x7e6aa6]);}}});}if(_0x13f4d6[_0x0ac2('0x45')]['read']){if(_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x87')]==0x1){_0x411e89[_0x0ac2('0x6d')](_0x0ac2('0x88'));}else{_0x411e89[_0x0ac2('0x6d')](_0x0ac2('0x89'));}}if(_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x8a')]){_0x2bf628=_[_0x0ac2('0x8b')](_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x8a')])?_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x8a')]:new Array(_0x13f4d6['query'][_0x0ac2('0x8a')]);_0x2bf628[_0x0ac2('0x36')](function(_0x247d26){_0x1cdb1f['or'](_0x0ac2('0x8c'),'%,'+_0x247d26+',%');});}if(_0x13f4d6[_0x0ac2('0x45')]['filter']){var _0x14aaf0=_0x13f4d6['query'][_0x0ac2('0x8d')][_0x0ac2('0x8e')]('\x5c','\x5c\x5c')[_0x0ac2('0x8e')](/'/g,'\x27\x27');if(qs[_0x0ac2('0x8f')](_0x14aaf0)){_0x3c595c['or'](_0x0ac2('0x90'),_0x14aaf0+'%');}else{_0x3c595c['or'](_0x0ac2('0x91'),qs[_0x0ac2('0x92')](_0x14aaf0))['or'](_0x0ac2('0x93'),_0x14aaf0+'%')['or'](_0x0ac2('0x94'),_0x14aaf0+'%');}}}_0x411e89[_0x0ac2('0x4f')](_0x3c595c);_0x411e89[_0x0ac2('0x95')](_0x0ac2('0x96'));var _0x4ff48b={'type':db['Sequelize'][_0x0ac2('0x97')]['SELECT'],'raw':!![]};var _0x2ba467=_0x411e89['clone']();_0x2ba467['field'](_0x0ac2('0x96'));_0x2ba467[_0x0ac2('0x52')](_0x0ac2('0x98'),_0x0ac2('0x6b'));if(_0x352321[_0x0ac2('0x4d')]){_0x352321[_0x0ac2('0x4d')][_0x0ac2('0x36')](function(_0x428a89){var _0x3fb2d0=_0x428a89[0x0]===_0x0ac2('0x99')?_0x428a89[0x0]:'i.'+_0x428a89[0x0];_0x411e89[_0x0ac2('0x4d')](_0x3fb2d0,_0x428a89[0x1]===_0x0ac2('0x9a')?![]:!![]);});}if(!_[_0x0ac2('0x7f')](_0x2bf628)){_0x411e89['having'](_0x1cdb1f);_0x2ba467[_0x0ac2('0x4f')](_0x0ac2('0x9b'),_0x2bf628);}BPromise['resolve']()[_0x0ac2('0x2c')](function(){if(!_0x5f18da){if(_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x80')])return;_0x2ba467['where'](_0x0ac2('0x9c'));_0x411e89[_0x0ac2('0x4f')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x13f4d6[_0x0ac2('0x9d')][_0x0ac2('0x9e')]!==_0x0ac2('0x9f'))return;return _0x13f4d6[_0x0ac2('0x9d')][_0x0ac2('0xa0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x41ffdb){if(_[_0x0ac2('0x7f')](_0x41ffdb)){_0x2ba467[_0x0ac2('0x4f')](_0x0ac2('0xa1'));_0x411e89[_0x0ac2('0x4f')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x2ba467[_0x0ac2('0x4f')](_0x0ac2('0xa2'),_['map'](_0x41ffdb,'id'));_0x411e89['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x0ac2('0x31')](_0x41ffdb,'id'));}});})[_0x0ac2('0x2c')](function(){if(_0x13f4d6[_0x0ac2('0x9d')][_0x0ac2('0x9e')]==='agent'&&!_0x5f18da&&!_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x80')])return[];return db[_0x0ac2('0xa3')][_0x0ac2('0x45')](_0x2ba467['toString'](),_0x4ff48b);})[_0x0ac2('0x2c')](function(_0x58dd0c){_0x586699[_0x0ac2('0x25')]=_0x58dd0c[_0x0ac2('0x4b')];if(_0x586699[_0x0ac2('0x25')]===0x0)return[];return db[_0x0ac2('0xa3')][_0x0ac2('0x45')](_0x1eac6a[_0x0ac2('0xa4')](),_0x4ff48b)[_0x0ac2('0x2c')](function(_0x381a3f){_0x464f61=_[_0x0ac2('0xa5')](_0x381a3f,'id');_0x4ff48b=_[_0x0ac2('0xa6')](_0x4ff48b,{'model':db[_0x0ac2('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13f4d6[_0x0ac2('0x45')][_0x0ac2('0x4a')]){_0x352321[_0x0ac2('0x49')]['forEach'](function(_0x16b178){_0x411e89['field']('i.'+_0x16b178);});}else{_0x411e89[_0x0ac2('0x52')](_0x0ac2('0x98'),'unreadMessages');_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xa7'),_0x0ac2('0xa8'));_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xa9'),_0x0ac2('0xaa'));_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xab'),'contactName');_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xac'));_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xad'),_0x0ac2('0xae'));_0x411e89['field'](_0x0ac2('0xaf'),_0x0ac2('0xb0'));_0x411e89['field'](_0x0ac2('0xb1'),_0x0ac2('0xb2'));_0x411e89['field']('c.phone','Contact.phone');_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xb3'),'Contact.mobile');_0x411e89[_0x0ac2('0x52')]('c.fax',_0x0ac2('0xb4'));_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xb5'),'Owner.fullname');_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xb6'),_0x0ac2('0xb7'));_0x411e89[_0x0ac2('0x52')](_0x0ac2('0xb8'),_0x0ac2('0x33'));}if(_0x352321[_0x0ac2('0x24')])_0x411e89['limit'](_0x352321[_0x0ac2('0x24')]);if(_0x352321[_0x0ac2('0x22')])_0x411e89['offset'](_0x352321['offset']);return db[_0x0ac2('0xa3')][_0x0ac2('0x45')](_0x411e89[_0x0ac2('0xa4')](),_0x4ff48b);})['then'](function(_0x56f5eb){if(_0x56f5eb[_0x0ac2('0x4b')]>0x0)_0x1cfcdd[_0x0ac2('0x4f')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x56f5eb,'id'));return db[_0x0ac2('0xa3')][_0x0ac2('0x45')](_0x1cfcdd[_0x0ac2('0xa4')](),_0x4ff48b)['then'](function(_0x3749cf){var _0x5489c7=_['groupBy'](_0x3749cf,'OpenchannelInteractionId');var _0x4ff33b=[];_0x56f5eb[_0x0ac2('0x36')](function(_0x2f091a){_0x4ff33b[_0x0ac2('0x37')](updateOpenchannelInteraction(_0x2f091a,_0x464f61,_0x5489c7));});return BPromise[_0x0ac2('0xb9')](_0x4ff33b);});});})[_0x0ac2('0x2c')](function(_0x44f4f0){_0x586699['rows']=_0x44f4f0;return _0x586699;})[_0x0ac2('0x2c')](respondWithFilteredResult(_0x5c4e10,_0x352321))['catch'](handleError(_0x5c4e10,null));};exports[_0x0ac2('0xba')]=function(_0x521a34,_0x25d1a5){var _0x332b96={};if(_0x521a34[_0x0ac2('0x45')][_0x0ac2('0x74')]&&_0x521a34['query'][_0x0ac2('0x74')]===_0x0ac2('0x58')){_0x332b96[_0x0ac2('0x58')]=_0x521a34[_0x0ac2('0xbb')]['id'];}else{_0x332b96['id']=_0x521a34[_0x0ac2('0xbb')]['id'];}var _0x4d386a={'raw':![],'where':_0x332b96},_0xd96d3e={};_0xd96d3e[_0x0ac2('0x44')]=_[_0x0ac2('0x46')](db['OpenchannelInteraction'][_0x0ac2('0x42')]);_0xd96d3e['query']=_['keys'](_0x521a34['query']);_0xd96d3e[_0x0ac2('0x47')]=_[_0x0ac2('0x48')](_0xd96d3e[_0x0ac2('0x44')],_0xd96d3e[_0x0ac2('0x45')]);_0x4d386a['attributes']=_[_0x0ac2('0x48')](_0xd96d3e[_0x0ac2('0x44')],qs[_0x0ac2('0x4a')](_0x521a34[_0x0ac2('0x45')][_0x0ac2('0x4a')]));_0x4d386a['attributes']=_0x4d386a[_0x0ac2('0x49')]['length']?_0x4d386a[_0x0ac2('0x49')]:_0xd96d3e[_0x0ac2('0x44')];if(_0x521a34[_0x0ac2('0x45')][_0x0ac2('0xbc')]){_0x4d386a[_0x0ac2('0xbd')]=[{'all':!![]}];}_0x4d386a=_[_0x0ac2('0xa6')]({},_0x4d386a,_0x521a34[_0x0ac2('0xbe')]);return db['OpenchannelInteraction'][_0x0ac2('0x6a')](_0x4d386a)[_0x0ac2('0x2c')](handleEntityNotFound(_0x25d1a5,null))[_0x0ac2('0x2c')](respondWithResult(_0x25d1a5,null))[_0x0ac2('0x38')](handleError(_0x25d1a5,null));};exports[_0x0ac2('0xbf')]=function(_0xeecd4,_0x5eb074){return db[_0x0ac2('0x41')][_0x0ac2('0xbf')](_0xeecd4[_0x0ac2('0x7c')],{})[_0x0ac2('0x2c')](respondWithResult(_0x5eb074,0xc9))[_0x0ac2('0x38')](handleError(_0x5eb074,null));};exports[_0x0ac2('0x2b')]=function(_0x398606,_0x563d59){if(_0x398606[_0x0ac2('0x7c')]['id']){delete _0x398606[_0x0ac2('0x7c')]['id'];}return db['OpenchannelInteraction'][_0x0ac2('0x6a')]({'where':{'id':_0x398606[_0x0ac2('0xbb')]['id']}})[_0x0ac2('0x2c')](handleEntityNotFound(_0x563d59,null))[_0x0ac2('0x2c')](saveUpdates(_0x398606[_0x0ac2('0x7c')],null))[_0x0ac2('0x2c')](respondWithResult(_0x563d59,null))[_0x0ac2('0x38')](handleError(_0x563d59,null));};exports[_0x0ac2('0x2d')]=function(_0x649398,_0x56f8e6){return db[_0x0ac2('0x41')]['find']({'where':{'id':_0x649398[_0x0ac2('0xbb')]['id']}})['then'](handleEntityNotFound(_0x56f8e6,null))[_0x0ac2('0x2c')](removeEntity(_0x56f8e6,null))['catch'](handleError(_0x56f8e6,null));};exports[_0x0ac2('0xc0')]=function(_0x1f2df2,_0xa9a2a8){return db[_0x0ac2('0x41')][_0x0ac2('0xc0')]()[_0x0ac2('0x2c')](respondWithResult(_0xa9a2a8,null))[_0x0ac2('0x38')](handleError(_0xa9a2a8,null));};exports['addMessage']=function(_0x498dad,_0x34777d,_0x184267){return db[_0x0ac2('0xc1')][_0x0ac2('0x6a')]({'where':{'id':_0x498dad[_0x0ac2('0xbb')]['id']}})[_0x0ac2('0x2c')](handleEntityNotFound(_0x34777d,null))[_0x0ac2('0x2c')](function(_0x318076){if(_0x318076){return _0x318076['addMessage'](_0x498dad[_0x0ac2('0x7c')][_0x0ac2('0xc2')],_['omit'](_0x498dad[_0x0ac2('0x7c')],[_0x0ac2('0xc2'),'id'])||{});}})[_0x0ac2('0x2c')](respondWithResult(_0x34777d,null))[_0x0ac2('0x38')](handleError(_0x34777d,null));};exports[_0x0ac2('0xc3')]=function(_0x303fc2,_0x1b3d7f,_0xc3f0c9){var _0x236a74={'raw':![],'where':{}};var _0x5c63bb={};var _0x1887de={'count':0x0,'rows':[]};return db[_0x0ac2('0x41')][_0x0ac2('0xc4')]({'where':{'id':_0x303fc2[_0x0ac2('0xbb')]['id']}})[_0x0ac2('0x2c')](handleEntityNotFound(_0x1b3d7f,null))[_0x0ac2('0x2c')](function(_0x5ea7f5){if(_0x5ea7f5){_0x5c63bb['model']=_[_0x0ac2('0x46')](db[_0x0ac2('0xc1')]['rawAttributes']);_0x5c63bb[_0x0ac2('0x45')]=_[_0x0ac2('0x46')](_0x303fc2['query']);_0x5c63bb['filters']=_['intersection'](_0x5c63bb[_0x0ac2('0x44')],_0x5c63bb[_0x0ac2('0x45')]);_0x236a74[_0x0ac2('0x49')]=_['intersection'](_0x5c63bb[_0x0ac2('0x44')],qs[_0x0ac2('0x4a')](_0x303fc2[_0x0ac2('0x45')][_0x0ac2('0x4a')]));_0x236a74[_0x0ac2('0x49')]=_0x236a74[_0x0ac2('0x49')][_0x0ac2('0x4b')]?_0x236a74[_0x0ac2('0x49')]:_0x5c63bb['model'];if(!_0x303fc2['query']['hasOwnProperty']('nolimit')){_0x236a74[_0x0ac2('0x24')]=qs[_0x0ac2('0x24')](_0x303fc2[_0x0ac2('0x45')][_0x0ac2('0x24')]);_0x236a74['offset']=qs['offset'](_0x303fc2[_0x0ac2('0x45')][_0x0ac2('0x22')]);}_0x236a74[_0x0ac2('0x4d')]=qs['sort'](_0x303fc2[_0x0ac2('0x45')][_0x0ac2('0x4e')]);_0x236a74[_0x0ac2('0x4f')]=qs[_0x0ac2('0x47')](_['pick'](_0x303fc2[_0x0ac2('0x45')],_0x5c63bb[_0x0ac2('0x47')]));_0x236a74[_0x0ac2('0x4f')][_0x0ac2('0xc5')]=_0x5ea7f5['id'];if(_0x303fc2[_0x0ac2('0x45')][_0x0ac2('0x8d')]){_0x236a74[_0x0ac2('0x4f')]=_[_0x0ac2('0xa6')](_0x236a74[_0x0ac2('0x4f')],{'$or':_[_0x0ac2('0x31')](_0x236a74['attributes'],function(_0x4a9d13){var _0x2a4f1b={};_0x2a4f1b[_0x4a9d13]={'$like':'%'+_0x303fc2['query'][_0x0ac2('0x8d')]+'%'};return _0x2a4f1b;})});}if(_0x303fc2[_0x0ac2('0x45')]['$gte']){var _0x40a8b4=_0x303fc2[_0x0ac2('0x45')]['$gte'][_0x0ac2('0x35')](',');var _0x41f63c={};_0x41f63c[_0x40a8b4[0x0]]={'$gte':moment(_0x40a8b4[0x1])[_0x0ac2('0xc6')](_0x0ac2('0xc7'))};_0x236a74['where']=_[_0x0ac2('0xa6')](_0x236a74[_0x0ac2('0x4f')],_0x41f63c);}_0x236a74=_[_0x0ac2('0xa6')]({},_0x236a74,_0x303fc2[_0x0ac2('0xbe')]);return db[_0x0ac2('0xc1')][_0x0ac2('0x25')]({'where':_0x236a74[_0x0ac2('0x4f')]})[_0x0ac2('0x2c')](function(_0x313196){_0x1887de[_0x0ac2('0x25')]=_0x313196;if(_0x303fc2[_0x0ac2('0x45')][_0x0ac2('0xbc')]){_0x236a74[_0x0ac2('0xbd')]=[{'all':!![]}];}return db[_0x0ac2('0xc1')]['findAll'](_0x236a74);})[_0x0ac2('0x2c')](function(_0x40c5a1){_0x1887de[_0x0ac2('0xc8')]=_0x40c5a1;return _0x1887de;});}})[_0x0ac2('0x2c')](respondWithFilteredResult(_0x1b3d7f,_0x236a74))[_0x0ac2('0x38')](handleError(_0x1b3d7f,null));};exports[_0x0ac2('0xc9')]=function(_0x171720,_0x17a06f,_0x3c02be){return db[_0x0ac2('0x41')][_0x0ac2('0x6a')]({'where':{'id':_0x171720[_0x0ac2('0xbb')]['id']}})[_0x0ac2('0x2c')](handleEntityNotFound(_0x17a06f,null))['then'](function(_0x514b00){if(_0x514b00){return _0x514b00['setTags'](_0x171720[_0x0ac2('0x7c')][_0x0ac2('0xc2')],_[_0x0ac2('0xca')](_0x171720['body'],[_0x0ac2('0xc2'),'id'])||{})[_0x0ac2('0xcb')](function(){return db[_0x0ac2('0x77')]['findAll']({'attributes':['id',_0x0ac2('0x2f'),_0x0ac2('0x53')],'where':{'id':_0x171720[_0x0ac2('0x7c')]['ids']}});})[_0x0ac2('0x2c')](function(_0x1c1a85){socket[_0x0ac2('0xcc')](_0x0ac2('0xcd'),{'id':Number(_0x171720[_0x0ac2('0xbb')]['id']),'tags':_0x1c1a85||[]});return{'id':Number(_0x171720[_0x0ac2('0xbb')]['id']),'tags':_0x1c1a85||[]};});}})['then'](respondWithResult(_0x17a06f,null))[_0x0ac2('0x38')](handleError(_0x17a06f,null));};exports[_0x0ac2('0xce')]=function(_0x186f92,_0x2b0680,_0xccd275){return db[_0x0ac2('0x41')]['find']({'where':{'id':_0x186f92['params']['id']}})[_0x0ac2('0x2c')](handleEntityNotFound(_0x2b0680,null))['then'](function(_0x2e459d){if(_0x2e459d){return _0x2e459d['removeTags'](_0x186f92[_0x0ac2('0x45')]['ids']);}})[_0x0ac2('0x2c')](respondWithStatusCode(_0x2b0680,null))[_0x0ac2('0x38')](handleError(_0x2b0680,null));};exports['download']=function(_0x46d3fb,_0x522b34){var _0x3b3557=moment()[_0x0ac2('0xcf')]()[_0x0ac2('0xa4')]();var _0x4ba776=path['join'](config[_0x0ac2('0xd0')],_0x0ac2('0xd1'),_0x0ac2('0xd2'),_0x0ac2('0xd3'));var _0x4a2e9f=path['join'](config[_0x0ac2('0xd0')],_0x0ac2('0xd1'),_0x0ac2('0xd2'),_0x0ac2('0xd4'));var _0x2a1dde=path[_0x0ac2('0xd5')](_0x4ba776,_0x3b3557);var _0xc970ce=util[_0x0ac2('0xc6')](_0x0ac2('0xd6'),_0x46d3fb[_0x0ac2('0xbb')]['id'],_0x3b3557);var _0x5ec55b=path[_0x0ac2('0xd5')](_0x4ba776,_0xc970ce);var _0x8ef57f=[];_0x8ef57f[_0x0ac2('0x37')]({'model':db[_0x0ac2('0x79')],'as':_0x0ac2('0x79'),'attributes':['id',_0x0ac2('0x32')],'raw':!![]});_0x8ef57f[_0x0ac2('0x37')]({'model':db[_0x0ac2('0xd7')],'as':_0x0ac2('0x70'),'attributes':['id',_0x0ac2('0xd8'),_0x0ac2('0xd9')],'raw':!![]});if(_0x46d3fb[_0x0ac2('0x45')]['attachments']){_0x8ef57f['push']({'model':db[_0x0ac2('0xda')],'as':_0x0ac2('0xda'),'raw':!![]});}var _0x3f85e9=[{'model':db[_0x0ac2('0xc1')],'as':'Messages','attributes':['id',_0x0ac2('0x7c'),_0x0ac2('0x82'),_0x0ac2('0xdb'),'secret',_0x0ac2('0x87')],'include':_0x8ef57f}];_0x3f85e9[_0x0ac2('0x37')]({'model':db[_0x0ac2('0xdc')],'as':'Account','attributes':['id',_0x0ac2('0x2f')]});_0x3f85e9[_0x0ac2('0x37')]({'model':db[_0x0ac2('0x79')],'as':_0x0ac2('0xdd'),'attributes':['id',_0x0ac2('0x32')]});return db[_0x0ac2('0x41')]['find']({'where':{'id':_0x46d3fb[_0x0ac2('0xbb')]['id']},'include':_0x3f85e9})[_0x0ac2('0x2c')](handleEntityNotFound(_0x522b34,null))[_0x0ac2('0x2c')](function(_0xea5e94){if(_0xea5e94){var _0x1c7b03=_0xea5e94[_0x0ac2('0xde')]({'plain':!![]});fs[_0x0ac2('0xdf')](_0x2a1dde);var _0xa7f304={'channel':_0x0ac2('0xe0'),'account':_0x1c7b03[_0x0ac2('0xe1')][_0x0ac2('0x2f')],'agent':_0x1c7b03[_0x0ac2('0xdd')]?_0x1c7b03['Owner'][_0x0ac2('0x32')]:_0x0ac2('0xe2'),'createdAt':moment(_0x1c7b03[_0x0ac2('0x82')])['format'](_0x0ac2('0xc7'))[_0x0ac2('0xa4')](),'closedAt':_0x1c7b03[_0x0ac2('0x3e')]?moment(_0x1c7b03[_0x0ac2('0xe3')])[_0x0ac2('0xc6')](_0x0ac2('0xc7'))[_0x0ac2('0xa4')]():'','disposition':_0x1c7b03[_0x0ac2('0xe4')],'visibility':_0x1c7b03[_0x0ac2('0xe5')]?_0x0ac2('0xe6'):_0x0ac2('0xe7'),'messages':_(_0x1c7b03[_0x0ac2('0xe8')])['filter']({'secret':![]})[_0x0ac2('0x31')](function(_0x4b9d07){if(_0x4b9d07[_0x0ac2('0xda')]){var _0x2099e3=path[_0x0ac2('0xd5')](_0x4a2e9f,_0x4b9d07[_0x0ac2('0xda')][_0x0ac2('0xe9')]);if(fs[_0x0ac2('0xea')](_0x2099e3)){fs[_0x0ac2('0xeb')](_0x2099e3)[_0x0ac2('0xec')](fs['createWriteStream'](path[_0x0ac2('0xd5')](_0x2a1dde,_0x4b9d07[_0x0ac2('0xda')][_0x0ac2('0xe9')])));}}return{'date':moment(_0x4b9d07[_0x0ac2('0x82')])['format'](_0x0ac2('0xc7'))[_0x0ac2('0xa4')](),'sender':_0x4b9d07[_0x0ac2('0xdb')]===_0x0ac2('0xed')?_0x4b9d07[_0x0ac2('0x79')]?_0x4b9d07[_0x0ac2('0x79')][_0x0ac2('0x32')]:_0x0ac2('0xee'):_0x4b9d07[_0x0ac2('0x70')][_0x0ac2('0xd8')]+(_0x4b9d07[_0x0ac2('0x70')]['lastName']?'\x20'+_0x4b9d07[_0x0ac2('0x70')][_0x0ac2('0xd9')]:''),'body':_0x4b9d07[_0x0ac2('0xda')]?_0x4b9d07[_0x0ac2('0xda')][_0x0ac2('0xe9')]:_0x4b9d07[_0x0ac2('0x7c')],'direction':_0x4b9d07[_0x0ac2('0xdb')]==='out'?'A':'C','secret':_0x4b9d07['secret'],'read':_0x4b9d07[_0x0ac2('0x87')],'attachment':_0x4b9d07['Attachment']};})['value']()};return ejs['renderFile'](path[_0x0ac2('0xd5')](config[_0x0ac2('0xd0')],_0x0ac2('0xd1'),'views',_0x0ac2('0xef')),{'interaction':_0xa7f304})['then'](function(_0x1b360c){var _0x2841a9=path['join'](_0x2a1dde,_0x0ac2('0xf0')+_0x1c7b03['id']+'-'+_0x3b3557+_0x0ac2('0xf1'));var _0x1afaaf={'path':_0x2841a9,'channel':_0x0ac2('0xe0'),'interactionId':_0x1c7b03['id']};return pdf[_0x0ac2('0xf2')](_0x1b360c,_0x1afaaf);})[_0x0ac2('0x2c')](function(){return new BPromise(function(_0x36ceb6,_0x1a777c){zipdir(_0x2a1dde,{'saveTo':_0x5ec55b},function(_0x470c96,_0x1afde5){if(_0x470c96)return _0x1a777c(_0x470c96);return _0x36ceb6(_0x1afde5);});})[_0x0ac2('0x2c')](function(){return new BPromise(function(_0x132a87,_0x3667ce){rimraf(_0x2a1dde,function(_0x117bec){if(_0x117bec)_0x3667ce(_0x117bec);return _0x132a87();});});})[_0x0ac2('0x2c')](function(){return _0x522b34[_0x0ac2('0xf3')](_0x5ec55b,_0xc970ce,function(_0x17e8ee){if(_0x17e8ee){console[_0x0ac2('0xf4')]('err',_0x17e8ee);}else{fs[_0x0ac2('0xf5')](_0x5ec55b);}});});});}else{return _0x522b34[_0x0ac2('0x1e')](0xc8);}})['catch'](handleError(_0x522b34,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e2acd4b..f8fec40 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 _0xe7f6=['save','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x496c0e,_0xb4d8a8){var _0x386ef1=function(_0x36d025){while(--_0x36d025){_0x496c0e['push'](_0x496c0e['shift']());}};_0x386ef1(++_0xb4d8a8);}(_0xe7f6,0x1e9));var _0x6e7f=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xe7f6[_0x3cb152];return _0x4f54c3;};'use strict';var EventEmitter=require(_0x6e7f('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6e7f('0x1'))['db'][_0x6e7f('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6e7f('0x3')](0x0);var events={'afterCreate':_0x6e7f('0x4'),'afterUpdate':'update','afterDestroy':_0x6e7f('0x5')};function emitEvent(_0x5c926b){return function(_0x5c7940,_0xbde1d9,_0x2b6233){_0x5c7940['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5c547a){_0x5c7940[_0x6e7f('0x6')](_0x6e7f('0x7'),_0x5c547a[_0x6e7f('0x8')](function(_0x5a98fe){return{'id':_0x5a98fe['id']};}));return OpenchannelMessage[_0x6e7f('0x9')]({'where':{'OpenchannelInteractionId':_0x5c7940['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6e7f('0xa')](function(_0x376655){_0x5c7940[_0x6e7f('0x6')](_0x6e7f('0xb'),_0x376655[_0x6e7f('0xc')]);OpenchannelInteractionEvents[_0x6e7f('0xd')](_0x5c926b+':'+_0x5c7940['id'],_0x5c7940);OpenchannelInteractionEvents['emit'](_0x5c926b,_0x5c7940);_0x2b6233(null);})[_0x6e7f('0xe')](_0x2b6233(null));};}for(var e in events){if(events[_0x6e7f('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x6e7f('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3db8=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x382459,_0x331101){var _0x19ebb2=function(_0x3ecbf2){while(--_0x3ecbf2){_0x382459['push'](_0x382459['shift']());}};_0x19ebb2(++_0x331101);}(_0x3db8,0x1d2));var _0x83db=function(_0x2e5111,_0x5b8f9e){_0x2e5111=_0x2e5111-0x0;var _0x1174ec=_0x3db8[_0x2e5111];return _0x1174ec;};'use strict';var EventEmitter=require(_0x83db('0x0'));var OpenchannelInteraction=require(_0x83db('0x1'))['db'][_0x83db('0x2')];var OpenchannelMessage=require(_0x83db('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x83db('0x3')](0x0);var events={'afterCreate':_0x83db('0x4'),'afterUpdate':_0x83db('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3ee720){return function(_0x50aa86,_0x5b6b6f,_0x44dd51){_0x50aa86[_0x83db('0x6')]({'attributes':['id'],'raw':!![]})[_0x83db('0x7')](function(_0x100347){_0x50aa86[_0x83db('0x8')](_0x83db('0x9'),_0x100347[_0x83db('0xa')](function(_0x232125){return{'id':_0x232125['id']};}));return OpenchannelMessage[_0x83db('0xb')]({'where':{'OpenchannelInteractionId':_0x50aa86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x83db('0x7')](function(_0x5834f5){_0x50aa86['setDataValue'](_0x83db('0xc'),_0x5834f5[_0x83db('0xd')]);OpenchannelInteractionEvents[_0x83db('0xe')](_0x3ee720+':'+_0x50aa86['id'],_0x50aa86);OpenchannelInteractionEvents['emit'](_0x3ee720,_0x50aa86);_0x44dd51(null);})[_0x83db('0xf')](_0x44dd51(null));};}for(var e in events){if(events[_0x83db('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x83db('0x11')](e,emitEvent(event));}}module[_0x83db('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e9a5940..9499942 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 _0x436c=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed'];(function(_0x516e1f,_0x15cf63){var _0x3a01f2=function(_0x5c2d29){while(--_0x5c2d29){_0x516e1f['push'](_0x516e1f['shift']());}};_0x3a01f2(++_0x15cf63);}(_0x436c,0x82));var _0xc436=function(_0x3dfe43,_0xb611a1){_0x3dfe43=_0x3dfe43-0x0;var _0x4c94c9=_0x436c[_0x3dfe43];return _0x4c94c9;};'use strict';var _=require('lodash');var util=require(_0xc436('0x0'));var logger=require(_0xc436('0x1'))(_0xc436('0x2'));var moment=require(_0xc436('0x3'));var BPromise=require(_0xc436('0x4'));var rp=require(_0xc436('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc436('0x6'));var attributes=require(_0xc436('0x7'));module['exports']=function(_0x49e1ec,_0x40b447){return _0x49e1ec[_0xc436('0x8')](_0xc436('0x9'),attributes,{'tableName':_0xc436('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc436('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x43010c,_0x40018b,_0x4361d4){if(_0x43010c[_0xc436('0xc')](_0xc436('0xd'))){_0x43010c['closedAt']=moment()[_0xc436('0xe')](_0xc436('0xf'));}_0x4361d4(null,_0x43010c);}}});}; \ No newline at end of file +var _0xa9e4=['rimraf','../../config/environment','exports','define','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x41904d,_0x59d8c0){var _0x4b3da8=function(_0x24c3e4){while(--_0x24c3e4){_0x41904d['push'](_0x41904d['shift']());}};_0x4b3da8(++_0x59d8c0);}(_0xa9e4,0x89));var _0x4a9e=function(_0x11f18e,_0xcc3541){_0x11f18e=_0x11f18e-0x0;var _0x2f9e81=_0xa9e4[_0x11f18e];return _0x2f9e81;};'use strict';var _=require(_0x4a9e('0x0'));var util=require(_0x4a9e('0x1'));var logger=require(_0x4a9e('0x2'))(_0x4a9e('0x3'));var moment=require(_0x4a9e('0x4'));var BPromise=require(_0x4a9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a9e('0x6'));var rimraf=require(_0x4a9e('0x7'));var config=require(_0x4a9e('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x4a9e('0x9')]=function(_0xa541ce,_0x2cb9a4){return _0xa541ce[_0x4a9e('0xa')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4a9e('0xb'),'hooks':{'beforeUpdate':function(_0x2cf532,_0x1b90d4,_0x3ae267){if(_0x2cf532[_0x4a9e('0xc')]('closed')){_0x2cf532[_0x4a9e('0xd')]=moment()[_0x4a9e('0xe')](_0x4a9e('0xf'));}_0x3ae267(null,_0x2cf532);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index dc52b81..b6f51e6 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 _0xcc39=['code','message','result','OpenchannelInteraction','update','body','options','attributes','limit','UpdateOpenchannelInteraction','catch','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2f079c,_0x5cf32c){var _0xc278c=function(_0x203869){while(--_0x203869){_0x2f079c['push'](_0x2f079c['shift']());}};_0xc278c(++_0x5cf32c);}(_0xcc39,0x100));var _0x9cc3=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xcc39[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0x9cc3('0x0'));var util=require(_0x9cc3('0x1'));var moment=require(_0x9cc3('0x2'));var BPromise=require('bluebird');var rs=require(_0x9cc3('0x3'));var fs=require('fs');var Redis=require(_0x9cc3('0x4'));var db=require(_0x9cc3('0x5'))['db'];var utils=require(_0x9cc3('0x6'));var logger=require(_0x9cc3('0x7'))('rpc');var config=require(_0x9cc3('0x8'));var jayson=require(_0x9cc3('0x9'));var client=jayson[_0x9cc3('0xa')][_0x9cc3('0xb')]({'port':0x232a});config[_0x9cc3('0xc')]=_[_0x9cc3('0xd')](config[_0x9cc3('0xc')],{'host':_0x9cc3('0xe'),'port':0x18eb});var socket=require(_0x9cc3('0xf'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x9cc3('0x10')](socket);function respondWithRpcPromise(_0x2d4e9d,_0x48e0f2,_0x18e7ab){return new BPromise(function(_0x3aaf0c,_0x27a6b4){return client['request'](_0x2d4e9d,_0x18e7ab)[_0x9cc3('0x11')](function(_0x53ea08){logger[_0x9cc3('0x12')](_0x9cc3('0x13'),_0x48e0f2,_0x9cc3('0x14'));logger[_0x9cc3('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x48e0f2,_0x9cc3('0x14'),JSON[_0x9cc3('0x16')](_0x53ea08));if(_0x53ea08[_0x9cc3('0x17')]){if(_0x53ea08['error'][_0x9cc3('0x18')]===0x1f4){logger['error'](_0x9cc3('0x13'),_0x48e0f2,_0x53ea08[_0x9cc3('0x17')][_0x9cc3('0x19')]);return _0x27a6b4(_0x53ea08['error'][_0x9cc3('0x19')]);}logger[_0x9cc3('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48e0f2,_0x53ea08[_0x9cc3('0x17')][_0x9cc3('0x19')]);return _0x3aaf0c(_0x53ea08[_0x9cc3('0x17')][_0x9cc3('0x19')]);}else{logger['info'](_0x9cc3('0x13'),_0x48e0f2,_0x9cc3('0x14'));_0x3aaf0c(_0x53ea08[_0x9cc3('0x1a')][_0x9cc3('0x19')]);}})['catch'](function(_0x3ed0c7){logger[_0x9cc3('0x17')](_0x9cc3('0x13'),_0x48e0f2,_0x3ed0c7);_0x27a6b4(_0x3ed0c7);});});}exports['UpdateOpenchannelInteraction']=function(_0xe0d324){var _0x363a1c=this;return new Promise(function(_0x4dc757,_0x4916ba){return db[_0x9cc3('0x1b')][_0x9cc3('0x1c')](_0xe0d324[_0x9cc3('0x1d')],{'raw':_0xe0d324[_0x9cc3('0x1e')]?_0xe0d324[_0x9cc3('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe0d324['options']?_0xe0d324[_0x9cc3('0x1e')]['where']||null:null,'attributes':_0xe0d324[_0x9cc3('0x1e')]?_0xe0d324['options'][_0x9cc3('0x1f')]||null:null,'limit':_0xe0d324['options']?_0xe0d324[_0x9cc3('0x1e')][_0x9cc3('0x20')]||null:null})[_0x9cc3('0x11')](function(_0x4ff7df){logger[_0x9cc3('0x12')](_0x9cc3('0x21'),_0xe0d324);logger[_0x9cc3('0x15')]('UpdateOpenchannelInteraction',_0xe0d324,JSON['stringify'](_0x4ff7df));_0x4dc757(_0x4ff7df);})[_0x9cc3('0x22')](function(_0x2db828){logger[_0x9cc3('0x17')]('UpdateOpenchannelInteraction',_0x2db828[_0x9cc3('0x19')],_0xe0d324);_0x4916ba(_0x363a1c[_0x9cc3('0x17')](0x1f4,_0x2db828[_0x9cc3('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xed214f){return new Promise(function(_0x1722cc,_0x1c9c7a){return db[_0x9cc3('0x1b')]['find']({'where':_0xed214f['options']?_0xed214f[_0x9cc3('0x1e')][_0x9cc3('0x23')]||null:null})[_0x9cc3('0x11')](function(_0x1a646c){if(_0x1a646c){return _0x1a646c[_0x9cc3('0x24')](_0xed214f[_0x9cc3('0x1d')][_0x9cc3('0x25')],_['omit'](_0xed214f[_0x9cc3('0x1d')],[_0x9cc3('0x25'),'id'])||{});}})[_0x9cc3('0x26')](function(_0x14b0bb){logger[_0x9cc3('0x12')](_0x9cc3('0x27'),_0xed214f);logger[_0x9cc3('0x15')]('AddTags',_0xed214f,JSON[_0x9cc3('0x16')](_0x14b0bb));_0x1722cc(_0x14b0bb);})['catch'](function(_0x43797d){logger[_0x9cc3('0x17')](_0x9cc3('0x27'),_0x43797d[_0x9cc3('0x19')],_0xed214f);_0x1c9c7a(_this[_0x9cc3('0x17')](0x1f4,_0x43797d[_0x9cc3('0x19')]));});});}; \ No newline at end of file +var _0x555b=['lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','then','OpenchannelInteraction,\x20%s,\x20%s','debug','error','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','stringify','AddTagsToOpenchannelInteraction','find','where','ids','spread','AddTags','catch'];(function(_0x5e022d,_0x30e1d8){var _0x5d2c41=function(_0x30491d){while(--_0x30491d){_0x5e022d['push'](_0x5e022d['shift']());}};_0x5d2c41(++_0x30e1d8);}(_0x555b,0x198));var _0xb555=function(_0x3a1f0a,_0x5270e8){_0x3a1f0a=_0x3a1f0a-0x0;var _0xb31b57=_0x555b[_0x3a1f0a];return _0xb31b57;};'use strict';var _=require(_0xb555('0x0'));var util=require(_0xb555('0x1'));var moment=require('moment');var BPromise=require(_0xb555('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb555('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb555('0x4'))(_0xb555('0x5'));var config=require(_0xb555('0x6'));var jayson=require(_0xb555('0x7'));var client=jayson[_0xb555('0x8')][_0xb555('0x9')]({'port':0x232a});config[_0xb555('0xa')]=_[_0xb555('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb555('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x23eb61,_0x200862,_0x3ef135){return new BPromise(function(_0x3939bf,_0x4c897d){return client['request'](_0x23eb61,_0x3ef135)[_0xb555('0xc')](function(_0x47aca0){logger['info'](_0xb555('0xd'),_0x200862,'request\x20sent');logger[_0xb555('0xe')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x200862,'request\x20sent',JSON['stringify'](_0x47aca0));if(_0x47aca0[_0xb555('0xf')]){if(_0x47aca0[_0xb555('0xf')]['code']===0x1f4){logger[_0xb555('0xf')](_0xb555('0xd'),_0x200862,_0x47aca0['error'][_0xb555('0x10')]);return _0x4c897d(_0x47aca0[_0xb555('0xf')][_0xb555('0x10')]);}logger['error'](_0xb555('0xd'),_0x200862,_0x47aca0[_0xb555('0xf')][_0xb555('0x10')]);return _0x3939bf(_0x47aca0[_0xb555('0xf')][_0xb555('0x10')]);}else{logger[_0xb555('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x200862,'request\x20sent');_0x3939bf(_0x47aca0[_0xb555('0x12')][_0xb555('0x10')]);}})['catch'](function(_0x171a21){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x200862,_0x171a21);_0x4c897d(_0x171a21);});});}exports[_0xb555('0x13')]=function(_0x38ba2f){var _0x5786a8=this;return new Promise(function(_0x2efd3f,_0x5ae943){return db[_0xb555('0x14')][_0xb555('0x15')](_0x38ba2f[_0xb555('0x16')],{'raw':_0x38ba2f[_0xb555('0x17')]?_0x38ba2f['options'][_0xb555('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38ba2f[_0xb555('0x17')]?_0x38ba2f['options']['where']||null:null,'attributes':_0x38ba2f[_0xb555('0x17')]?_0x38ba2f[_0xb555('0x17')][_0xb555('0x19')]||null:null,'limit':_0x38ba2f[_0xb555('0x17')]?_0x38ba2f[_0xb555('0x17')]['limit']||null:null})[_0xb555('0xc')](function(_0x27bf49){logger[_0xb555('0x11')](_0xb555('0x13'),_0x38ba2f);logger[_0xb555('0xe')]('UpdateOpenchannelInteraction',_0x38ba2f,JSON[_0xb555('0x1a')](_0x27bf49));_0x2efd3f(_0x27bf49);})['catch'](function(_0x283f95){logger['error'](_0xb555('0x13'),_0x283f95[_0xb555('0x10')],_0x38ba2f);_0x5ae943(_0x5786a8[_0xb555('0xf')](0x1f4,_0x283f95[_0xb555('0x10')]));});});};exports[_0xb555('0x1b')]=function(_0x443344){return new Promise(function(_0x39fd98,_0x2258cb){return db[_0xb555('0x14')][_0xb555('0x1c')]({'where':_0x443344['options']?_0x443344[_0xb555('0x17')][_0xb555('0x1d')]||null:null})[_0xb555('0xc')](function(_0x2b6c82){if(_0x2b6c82){return _0x2b6c82['addTags'](_0x443344['body'][_0xb555('0x1e')],_['omit'](_0x443344[_0xb555('0x16')],[_0xb555('0x1e'),'id'])||{});}})[_0xb555('0x1f')](function(_0xfb6729){logger[_0xb555('0x11')](_0xb555('0x20'),_0x443344);logger[_0xb555('0xe')](_0xb555('0x20'),_0x443344,JSON[_0xb555('0x1a')](_0xfb6729));_0x39fd98(_0xfb6729);})[_0xb555('0x21')](function(_0x5992ff){logger[_0xb555('0xf')]('AddTags',_0x5992ff[_0xb555('0x10')],_0x443344);_0x2258cb(_this[_0xb555('0xf')](0x1f4,_0x5992ff[_0xb555('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f65e97e..51fb58d 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 _0x80ce=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x3bacd2,_0x126ae8){var _0x4b316b=function(_0x22748b){while(--_0x22748b){_0x3bacd2['push'](_0x3bacd2['shift']());}};_0x4b316b(++_0x126ae8);}(_0x80ce,0xba));var _0xe80c=function(_0x33e65a,_0x214e21){_0x33e65a=_0x33e65a-0x0;var _0x470956=_0x80ce[_0x33e65a];return _0x470956;};'use strict';var OpenchannelInteractionEvents=require(_0xe80c('0x0'));var events=[_0xe80c('0x1'),_0xe80c('0x2'),_0xe80c('0x3')];function createListener(_0x3af030,_0x51f8b3){return function(_0x397443){_0x51f8b3[_0xe80c('0x4')](_0x3af030,_0x397443);};}function removeListener(_0xc87a7e,_0x51048f){return function(){OpenchannelInteractionEvents[_0xe80c('0x5')](_0xc87a7e,_0x51048f);};}exports[_0xe80c('0x6')]=function(_0x254178){for(var _0x40daa5=0x0,_0x357079=events[_0xe80c('0x7')];_0x40daa5<_0x357079;_0x40daa5++){var _0x404372=events[_0x40daa5];var _0x4fb52e=createListener(_0xe80c('0x8')+_0x404372,_0x254178);OpenchannelInteractionEvents['on'](_0x404372,_0x4fb52e);}}; \ No newline at end of file +var _0x5674=['removeListener','register','length','openchannelInteraction:','remove','emit'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x5674,0x100));var _0x4567=function(_0xa53c31,_0x46f6d5){_0xa53c31=_0xa53c31-0x0;var _0x4c9f63=_0x5674[_0xa53c31];return _0x4c9f63;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x4567('0x0'),'update'];function createListener(_0x690090,_0x3d9938){return function(_0x45f20a){_0x3d9938[_0x4567('0x1')](_0x690090,_0x45f20a);};}function removeListener(_0x124000,_0x4e2709){return function(){OpenchannelInteractionEvents[_0x4567('0x2')](_0x124000,_0x4e2709);};}exports[_0x4567('0x3')]=function(_0x494314){for(var _0x2a3d3f=0x0,_0x141935=events[_0x4567('0x4')];_0x2a3d3f<_0x141935;_0x2a3d3f++){var _0x29887a=events[_0x2a3d3f];var _0x34dcc2=createListener(_0x4567('0x5')+_0x29887a,_0x494314);OpenchannelInteractionEvents['on'](_0x29887a,_0x34dcc2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 2641b8e..805c111 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(_0x1e69ed,_0x26879f){var _0x215adc=function(_0xcd5a96){while(--_0xcd5a96){_0x1e69ed['push'](_0x1e69ed['shift']());}};_0x215adc(++_0x26879f);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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 _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(_0x72de8b,_0x161b46){var _0x33b93e=function(_0x38e161){while(--_0x38e161){_0x72de8b['push'](_0x72de8b['shift']());}};_0x33b93e(++_0x161b46);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ad2aa28..9666bf7 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 _0x253d=['out','DATE','TEXT','sequelize','BOOLEAN','ENUM'];(function(_0x30a985,_0x4247e6){var _0x2b1515=function(_0x252ff2){while(--_0x252ff2){_0x30a985['push'](_0x30a985['shift']());}};_0x2b1515(++_0x4247e6);}(_0x253d,0x1b3));var _0xd253=function(_0x3c2e0e,_0x2a21a5){_0x3c2e0e=_0x3c2e0e-0x0;var _0x4c44a7=_0x253d[_0x3c2e0e];return _0x4c44a7;};'use strict';var Sequelize=require(_0xd253('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd253('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd253('0x2')]('in',_0xd253('0x3')),'defaultValue':_0xd253('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd253('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd253('0x5')]}}; \ No newline at end of file +var _0x282b=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x134f2a,_0x32d370){var _0x5c4693=function(_0x18fd95){while(--_0x18fd95){_0x134f2a['push'](_0x134f2a['shift']());}};_0x5c4693(++_0x32d370);}(_0x282b,0xec));var _0xb282=function(_0x358e39,_0x36c129){_0x358e39=_0x358e39-0x0;var _0x4226ac=_0x282b[_0x358e39];return _0x4226ac;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'body':{'type':Sequelize[_0xb282('0x2')](_0xb282('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb282('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb282('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb282('0x6')]},'providerName':{'type':Sequelize[_0xb282('0x7')]},'providerResponse':{'type':Sequelize[_0xb282('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index cff2f0c..afa036c 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 _0x6fc8=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','OpenchannelInteractionId','isNil','read1stAt','interaction','info','role','null','AcceptMessage','acceptMessage','Sequelize','SELECT','contact','email','internal','manual','interface','channel','event','EventManager','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','User','motionChannel','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus'];(function(_0x5d98e6,_0xa0a8b4){var _0x4a5a12=function(_0x44185d){while(--_0x44185d){_0x5d98e6['push'](_0x5d98e6['shift']());}};_0x4a5a12(++_0xa0a8b4);}(_0x6fc8,0x156));var _0x86fc=function(_0x307ddf,_0x49ff2b){_0x307ddf=_0x307ddf-0x0;var _0x53914d=_0x6fc8[_0x307ddf];return _0x53914d;};'use strict';var emlformat=require(_0x86fc('0x0'));var rimraf=require(_0x86fc('0x1'));var zipdir=require(_0x86fc('0x2'));var jsonpatch=require(_0x86fc('0x3'));var rp=require(_0x86fc('0x4'));var moment=require(_0x86fc('0x5'));var BPromise=require(_0x86fc('0x6'));var Mustache=require(_0x86fc('0x7'));var util=require('util');var path=require(_0x86fc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x86fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x86fc('0xa'));var crypto=require('crypto');var jsforce=require(_0x86fc('0xb'));var deskjs=require(_0x86fc('0xc'));var toCsv=require(_0x86fc('0xd'));var querystring=require(_0x86fc('0xe'));var Papa=require('papaparse');var Redis=require(_0x86fc('0xf'));var authService=require(_0x86fc('0x10'));var qs=require(_0x86fc('0x11'));var as=require(_0x86fc('0x12'));var hardwareService=require(_0x86fc('0x13'));var logger=require('../../config/logger')(_0x86fc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x86fc('0x15'))['db'];config[_0x86fc('0x16')]=_['defaults'](config[_0x86fc('0x16')],{'host':_0x86fc('0x17'),'port':0x18eb});var socket=require(_0x86fc('0x18'))(new Redis(config[_0x86fc('0x16')]));require('./openchannelMessage.socket')[_0x86fc('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x86fc('0x1a')][_0x86fc('0x1b')]({'port':0x232c});var client9002=jayson[_0x86fc('0x1a')][_0x86fc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56239a,_0x281e0f,_0x4dd1a0,_0x39ad3c){return new BPromise(function(_0x346bf4,_0x48632f){var _0x312f1c=_0x39ad3c||client;return _0x312f1c[_0x86fc('0x1c')](_0x56239a,_0x4dd1a0)[_0x86fc('0x1d')](function(_0x58e3c3){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x281e0f,'request\x20sent');logger[_0x86fc('0x1e')](_0x86fc('0x1f'),_0x281e0f,'request\x20sent',JSON['stringify'](_0x58e3c3));if(_0x58e3c3[_0x86fc('0x20')]){if(_0x58e3c3[_0x86fc('0x20')]['code']===0x1f4){logger[_0x86fc('0x20')](_0x86fc('0x21'),_0x281e0f,_0x58e3c3[_0x86fc('0x20')]['message']);return _0x48632f(_0x58e3c3[_0x86fc('0x20')][_0x86fc('0x22')]);}logger[_0x86fc('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x281e0f,_0x58e3c3[_0x86fc('0x20')][_0x86fc('0x22')]);return _0x346bf4(_0x58e3c3[_0x86fc('0x20')]['message']);}else{logger['info'](_0x86fc('0x21'),_0x281e0f,_0x86fc('0x23'));_0x346bf4(_0x58e3c3[_0x86fc('0x24')][_0x86fc('0x22')]);}})[_0x86fc('0x25')](function(_0x355938){logger[_0x86fc('0x20')](_0x86fc('0x21'),_0x281e0f,_0x355938);_0x48632f(_0x355938);});});}function respondWithStatusCode(_0x447a91,_0x339301){_0x339301=_0x339301||0xcc;return function(_0x51cc75){if(_0x51cc75){return _0x447a91[_0x86fc('0x26')](_0x339301);}return _0x447a91[_0x86fc('0x27')](_0x339301)[_0x86fc('0x28')]();};}function respondWithResult(_0x49c8ae,_0x250c28){_0x250c28=_0x250c28||0xc8;return function(_0x477657){if(_0x477657){return _0x49c8ae[_0x86fc('0x27')](_0x250c28)['json'](_0x477657);}};}function respondWithFilteredResult(_0xb4d5a,_0x4fc901){return function(_0x110a37){if(_0x110a37){var _0x5f312a=typeof _0x4fc901[_0x86fc('0x29')]===_0x86fc('0x2a')&&typeof _0x4fc901[_0x86fc('0x2b')]===_0x86fc('0x2a');var _0x325146=_0x110a37['count'];var _0x131aea=_0x5f312a?0x0:_0x4fc901[_0x86fc('0x29')];var _0x5b3591=_0x5f312a?_0x110a37[_0x86fc('0x2c')]:_0x4fc901[_0x86fc('0x29')]+_0x4fc901[_0x86fc('0x2b')];var _0x37752b;if(_0x5b3591>=_0x325146){_0x5b3591=_0x325146;_0x37752b=0xc8;}else{_0x37752b=0xce;}_0xb4d5a[_0x86fc('0x27')](_0x37752b);return _0xb4d5a[_0x86fc('0x2d')](_0x86fc('0x2e'),_0x131aea+'-'+_0x5b3591+'/'+_0x325146)[_0x86fc('0x2f')](_0x110a37);}return null;};}function patchUpdates(_0x3d1ae3){return function(_0xa4e726){try{jsonpatch[_0x86fc('0x30')](_0xa4e726,_0x3d1ae3,!![]);}catch(_0xe17eeb){return BPromise[_0x86fc('0x31')](_0xe17eeb);}return _0xa4e726[_0x86fc('0x32')]();};}function saveUpdates(_0x2569c9,_0x44f738){return function(_0x471b0f){if(_0x471b0f){return _0x471b0f[_0x86fc('0x33')](_0x2569c9)[_0x86fc('0x1d')](function(_0x342004){return _0x342004;});}return null;};}function removeEntity(_0x1e7236,_0x27e6c5){return function(_0x283828){if(_0x283828){return _0x283828['destroy']()['then'](function(){_0x1e7236[_0x86fc('0x27')](0xcc)[_0x86fc('0x28')]();});}};}function handleEntityNotFound(_0x235a12,_0x3e1833){return function(_0x48a1a0){if(!_0x48a1a0){_0x235a12[_0x86fc('0x26')](0x194);}return _0x48a1a0;};}function handleError(_0xdf8711,_0x71b008){_0x71b008=_0x71b008||0x1f4;return function(_0x3f0a6a){logger['error'](_0x3f0a6a[_0x86fc('0x34')]);if(_0x3f0a6a[_0x86fc('0x35')]){delete _0x3f0a6a[_0x86fc('0x35')];}_0xdf8711[_0x86fc('0x27')](_0x71b008)[_0x86fc('0x36')](_0x3f0a6a);};}exports[_0x86fc('0x37')]=function(_0x44a36c,_0x4a6b57){var _0x47c62f={},_0x16c0b3={},_0x4cdddd={'count':0x0,'rows':[]};var _0x246c76=_[_0x86fc('0x38')](db[_0x86fc('0x39')]['rawAttributes'],function(_0x8f3a33){return{'name':_0x8f3a33[_0x86fc('0x3a')],'type':_0x8f3a33[_0x86fc('0x3b')][_0x86fc('0x3c')]};});_0x16c0b3[_0x86fc('0x3d')]=_[_0x86fc('0x38')](_0x246c76,_0x86fc('0x35'));_0x16c0b3[_0x86fc('0x3e')]=_[_0x86fc('0x3f')](_0x44a36c[_0x86fc('0x3e')]);_0x16c0b3[_0x86fc('0x40')]=_[_0x86fc('0x41')](_0x16c0b3[_0x86fc('0x3d')],_0x16c0b3[_0x86fc('0x3e')]);_0x47c62f[_0x86fc('0x42')]=_[_0x86fc('0x41')](_0x16c0b3[_0x86fc('0x3d')],qs[_0x86fc('0x43')](_0x44a36c[_0x86fc('0x3e')][_0x86fc('0x43')]));_0x47c62f[_0x86fc('0x42')]=_0x47c62f['attributes']['length']?_0x47c62f['attributes']:_0x16c0b3['model'];if(!_0x44a36c['query']['hasOwnProperty'](_0x86fc('0x44'))){_0x47c62f[_0x86fc('0x2b')]=qs[_0x86fc('0x2b')](_0x44a36c['query'][_0x86fc('0x2b')]);_0x47c62f[_0x86fc('0x29')]=qs[_0x86fc('0x29')](_0x44a36c[_0x86fc('0x3e')]['offset']);}_0x47c62f['order']=qs['sort'](_0x44a36c[_0x86fc('0x3e')][_0x86fc('0x45')]);_0x47c62f[_0x86fc('0x46')]=qs[_0x86fc('0x40')](_[_0x86fc('0x47')](_0x44a36c[_0x86fc('0x3e')],_0x16c0b3[_0x86fc('0x40')]),_0x246c76);if(_0x44a36c[_0x86fc('0x3e')][_0x86fc('0x48')]){_0x47c62f[_0x86fc('0x46')]=_[_0x86fc('0x49')](_0x47c62f[_0x86fc('0x46')],{'$or':_['map'](_0x246c76,function(_0x44fe12){if(_0x44fe12[_0x86fc('0x3b')]!==_0x86fc('0x4a')){var _0x8b6a4f={};_0x8b6a4f[_0x44fe12[_0x86fc('0x35')]]={'$like':'%'+_0x44a36c['query'][_0x86fc('0x48')]+'%'};return _0x8b6a4f;}})});}_0x47c62f=_[_0x86fc('0x49')]({},_0x47c62f,_0x44a36c[_0x86fc('0x4b')]);var _0x50f0de={'where':_0x47c62f[_0x86fc('0x46')]};return db[_0x86fc('0x39')][_0x86fc('0x2c')](_0x50f0de)['then'](function(_0x4c67f5){_0x4cdddd[_0x86fc('0x2c')]=_0x4c67f5;if(_0x44a36c[_0x86fc('0x3e')][_0x86fc('0x4c')]){_0x47c62f[_0x86fc('0x4d')]=[{'all':!![]}];}return db[_0x86fc('0x39')][_0x86fc('0x4e')](_0x47c62f);})[_0x86fc('0x1d')](function(_0x20f357){_0x4cdddd[_0x86fc('0x4f')]=_0x20f357;return _0x4cdddd;})[_0x86fc('0x1d')](respondWithFilteredResult(_0x4a6b57,_0x47c62f))[_0x86fc('0x25')](handleError(_0x4a6b57,null));};exports['show']=function(_0x3000d2,_0x3ad33e){var _0x47cd5a={'raw':!![],'where':{'id':_0x3000d2[_0x86fc('0x50')]['id']}},_0x261b19={};_0x261b19['model']=_[_0x86fc('0x3f')](db['OpenchannelMessage'][_0x86fc('0x51')]);_0x261b19[_0x86fc('0x3e')]=_['keys'](_0x3000d2[_0x86fc('0x3e')]);_0x261b19[_0x86fc('0x40')]=_['intersection'](_0x261b19[_0x86fc('0x3d')],_0x261b19[_0x86fc('0x3e')]);_0x47cd5a[_0x86fc('0x42')]=_[_0x86fc('0x41')](_0x261b19[_0x86fc('0x3d')],qs['fields'](_0x3000d2[_0x86fc('0x3e')][_0x86fc('0x43')]));_0x47cd5a[_0x86fc('0x42')]=_0x47cd5a[_0x86fc('0x42')]['length']?_0x47cd5a[_0x86fc('0x42')]:_0x261b19[_0x86fc('0x3d')];if(_0x3000d2['query'][_0x86fc('0x4c')]){_0x47cd5a[_0x86fc('0x4d')]=[{'all':!![]}];}_0x47cd5a=_[_0x86fc('0x49')]({},_0x47cd5a,_0x3000d2[_0x86fc('0x4b')]);return db[_0x86fc('0x39')][_0x86fc('0x52')](_0x47cd5a)[_0x86fc('0x1d')](handleEntityNotFound(_0x3ad33e,null))['then'](respondWithResult(_0x3ad33e,null))[_0x86fc('0x25')](handleError(_0x3ad33e,null));};exports['create']=function(_0x2dac1f,_0x1ba72a){return db['OpenchannelMessage'][_0x86fc('0x53')](_0x2dac1f[_0x86fc('0x54')],{})['then'](respondWithResult(_0x1ba72a,0xc9))[_0x86fc('0x25')](handleError(_0x1ba72a,null));};exports['update']=function(_0x3dc6a9,_0x2bf228){if(_0x3dc6a9[_0x86fc('0x54')]['id']){delete _0x3dc6a9[_0x86fc('0x54')]['id'];}return db['OpenchannelMessage'][_0x86fc('0x52')]({'where':{'id':_0x3dc6a9[_0x86fc('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bf228,null))[_0x86fc('0x1d')](saveUpdates(_0x3dc6a9[_0x86fc('0x54')],null))[_0x86fc('0x1d')](respondWithResult(_0x2bf228,null))['catch'](handleError(_0x2bf228,null));};exports[_0x86fc('0x55')]=function(_0x26eeea,_0xb8cf5f){return db['OpenchannelMessage'][_0x86fc('0x52')]({'where':{'id':_0x26eeea[_0x86fc('0x50')]['id']}})[_0x86fc('0x1d')](handleEntityNotFound(_0xb8cf5f,null))[_0x86fc('0x1d')](removeEntity(_0xb8cf5f,null))['catch'](handleError(_0xb8cf5f,null));};exports[_0x86fc('0x56')]=function(_0x49846a,_0x11b147){return db[_0x86fc('0x39')]['describe']()['then'](respondWithResult(_0x11b147,null))['catch'](handleError(_0x11b147,null));};var interaction_log=require(_0x86fc('0x57'))(_0x86fc('0x58'));exports[_0x86fc('0x59')]=function(_0x3ed042,_0x4dfe08,_0x4a514e){var _0x48fac8={'agent':{},'channel':_0x86fc('0x5a')};if(_0x3ed042['body']['id']){delete _0x3ed042[_0x86fc('0x54')]['id'];}_0x3ed042[_0x86fc('0x54')][_0x86fc('0x5b')]=!![];_0x3ed042[_0x86fc('0x54')][_0x86fc('0x5c')]=moment()[_0x86fc('0x5d')](_0x86fc('0x5e'));_0x3ed042[_0x86fc('0x54')]['UserId']=_0x3ed042[_0x86fc('0x54')]['UserId']||_0x3ed042[_0x86fc('0x5f')]['id'];_0x48fac8[_0x86fc('0x60')]['id']=_0x3ed042[_0x86fc('0x54')][_0x86fc('0x61')];return db[_0x86fc('0x39')][_0x86fc('0x52')]({'where':{'id':_0x3ed042[_0x86fc('0x50')]['id'],'UserId':null}})[_0x86fc('0x1d')](handleEntityNotFound(_0x4dfe08,null))[_0x86fc('0x1d')](saveUpdates(_0x3ed042['body'],null))[_0x86fc('0x1d')](function(_0x210e8d){if(_0x210e8d){_0x48fac8[_0x86fc('0x22')]=_0x210e8d[_0x86fc('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x86fc('0x52')]({'where':{'id':_0x210e8d[_0x86fc('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4dfe08,null))[_0x86fc('0x1d')](function(_0x2bd854){if(_0x2bd854){return _0x2bd854['update']({'UserId':_0x3ed042['body'][_0x86fc('0x61')],'read1stAt':_[_0x86fc('0x64')](_0x2bd854[_0x86fc('0x65')])?moment()['format'](_0x86fc('0x5e')):undefined});}return null;})[_0x86fc('0x1d')](function(_0x2047b6){if(_0x2047b6){_0x48fac8[_0x86fc('0x66')]=_0x2047b6[_0x86fc('0x62')]({'plain':!![]});interaction_log[_0x86fc('0x67')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ed042[_0x86fc('0x5f')]['id'],_0x3ed042['user']['name'],_0x3ed042['user'][_0x86fc('0x68')],_0x48fac8[_0x86fc('0x66')]['id'],_0x3ed042[_0x86fc('0x54')]?JSON['stringify'](_0x3ed042['body']):_0x86fc('0x69'));return respondWithRpcPromise(_0x86fc('0x6a'),_0x86fc('0x6b'),_0x48fac8);}return null;})['then'](function(_0x3c2f50){var _0x4dc164='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c2f50[_0x86fc('0x22')]['ContactId'];return db['sequelize'][_0x86fc('0x3e')](_0x4dc164,{'type':db[_0x86fc('0x6c')]['QueryTypes'][_0x86fc('0x6d')],'raw':!![]})[_0x86fc('0x1d')](function(_0x565bde){return _0x565bde;});})['then'](function(_0x5f0987){if(_0x5f0987){_0x48fac8[_0x86fc('0x22')][_0x86fc('0x6e')]=_0x5f0987[0x0];if(!_0x3ed042[_0x86fc('0x54')][_0x86fc('0x61')])return;return db['User'][_0x86fc('0x52')]({'where':{'id':_0x3ed042[_0x86fc('0x54')][_0x86fc('0x61')],'role':'agent'},'attributes':['id',_0x86fc('0x35'),'fullname',_0x86fc('0x6f'),_0x86fc('0x70')],'raw':!![]});}return null;})['then'](function(_0x187594){if(!_0x187594)return null;_0x48fac8[_0x86fc('0x22')][_0x86fc('0x60')]=_0x187594;return _0x48fac8;})['then'](function(_0x462acc){if(_0x462acc){if(_0x3ed042[_0x86fc('0x54')][_0x86fc('0x71')]){_0x48fac8['message'][_0x86fc('0x72')]=util[_0x86fc('0x5d')]('SIP/%s',_0x3ed042[_0x86fc('0x5f')]['name']);_0x48fac8[_0x86fc('0x22')][_0x86fc('0x73')]=_0x48fac8[_0x86fc('0x73')];_0x48fac8[_0x86fc('0x22')]['motionChannel']=_0x48fac8[_0x86fc('0x73')];_0x48fac8[_0x86fc('0x22')][_0x86fc('0x74')]='accept';return respondWithRpcPromise(_0x86fc('0x75'),_0x86fc('0x75'),{'event':'acceptmessage','message':_0x48fac8[_0x86fc('0x22')]},client9002)['then'](function(){return _0x48fac8;});}return _0x48fac8;}return null;})[_0x86fc('0x1d')](respondWithResult(_0x4dfe08,null))[_0x86fc('0x25')](handleError(_0x4dfe08,null));};var interaction_log=require('../../config/logger')(_0x86fc('0x58'));exports[_0x86fc('0x31')]=function(_0x35c2c7,_0x4baf6d,_0x2cd1bf){var _0x1dca15={'agent':{},'channel':_0x86fc('0x5a')};if(_0x35c2c7[_0x86fc('0x54')]['id']){delete _0x35c2c7[_0x86fc('0x54')]['id'];}_0x35c2c7[_0x86fc('0x54')][_0x86fc('0x61')]=_0x35c2c7[_0x86fc('0x54')][_0x86fc('0x61')]||_0x35c2c7['user']['id'];_0x1dca15[_0x86fc('0x60')]['id']=_0x35c2c7['body'][_0x86fc('0x61')];return db[_0x86fc('0x39')][_0x86fc('0x52')]({'where':{'id':_0x35c2c7[_0x86fc('0x50')]['id'],'UserId':null}})[_0x86fc('0x1d')](handleEntityNotFound(_0x4baf6d,null))['then'](function(_0x478906){if(_0x478906){_0x1dca15[_0x86fc('0x22')]=_0x478906[_0x86fc('0x62')]({'plain':!![]});return db[_0x86fc('0x76')][_0x86fc('0x52')]({'where':{'id':_0x478906[_0x86fc('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4baf6d,null))[_0x86fc('0x1d')](function(_0x55be8b){if(_0x55be8b){_0x1dca15[_0x86fc('0x66')]=_0x55be8b[_0x86fc('0x62')]({'plain':!![]});interaction_log[_0x86fc('0x67')](_0x86fc('0x77'),_0x35c2c7['user']['id'],_0x35c2c7['user']['name'],_0x35c2c7[_0x86fc('0x5f')][_0x86fc('0x68')],_0x1dca15[_0x86fc('0x66')]['id'],_0x35c2c7[_0x86fc('0x54')]?JSON[_0x86fc('0x78')](_0x35c2c7[_0x86fc('0x54')]):_0x86fc('0x69'));return respondWithRpcPromise(_0x86fc('0x79'),'rejectMessage',_0x1dca15);}return null;})['then'](function(_0x3ef958){var _0x460a79=_0x86fc('0x7a')+_0x3ef958[_0x86fc('0x22')][_0x86fc('0x7b')];return db['sequelize'][_0x86fc('0x3e')](_0x460a79,{'type':db['Sequelize'][_0x86fc('0x7c')][_0x86fc('0x6d')],'raw':!![]})[_0x86fc('0x1d')](function(_0xbecb02){return _0xbecb02;});})[_0x86fc('0x1d')](function(_0x37a4a7){if(_0x37a4a7){_0x1dca15[_0x86fc('0x22')][_0x86fc('0x6e')]=_0x37a4a7[0x0];if(!_0x35c2c7[_0x86fc('0x54')][_0x86fc('0x61')])return;return db[_0x86fc('0x7d')]['find']({'where':{'id':_0x35c2c7[_0x86fc('0x54')][_0x86fc('0x61')],'role':_0x86fc('0x60')},'attributes':['id',_0x86fc('0x35'),'fullname',_0x86fc('0x6f'),_0x86fc('0x70')],'raw':!![]});}return null;})[_0x86fc('0x1d')](function(_0xe651c){if(!_0xe651c)return null;_0x1dca15[_0x86fc('0x22')][_0x86fc('0x60')]=_0xe651c;return _0x1dca15;})[_0x86fc('0x1d')](function(_0x4179c5){if(_0x4179c5){_0x4179c5[_0x86fc('0x22')][_0x86fc('0x72')]=util[_0x86fc('0x5d')]('SIP/%s',_0x35c2c7[_0x86fc('0x5f')][_0x86fc('0x35')]);_0x4179c5[_0x86fc('0x22')][_0x86fc('0x73')]=_0x1dca15[_0x86fc('0x73')];_0x4179c5[_0x86fc('0x22')][_0x86fc('0x7e')]=_0x1dca15[_0x86fc('0x73')];_0x4179c5[_0x86fc('0x22')][_0x86fc('0x74')]=_0x86fc('0x31');respondWithRpcPromise(_0x86fc('0x75'),'EventManager',{'event':'rejectmessage','message':_0x4179c5[_0x86fc('0x22')]},client9002);return _0x1dca15;}return null;})[_0x86fc('0x1d')](respondWithResult(_0x4baf6d,null))[_0x86fc('0x25')](handleError(_0x4baf6d,null));}; \ No newline at end of file +var _0x4491=['OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','params','length','find','body','destroy','describe','openchannel-interactions','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','reject','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','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','limit','count','offset','set','Content-Range','json','apply','save','update','stack','name','send','index','map'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x4491,0x1bb));var _0x1449=function(_0x1813a3,_0xabd532){_0x1813a3=_0x1813a3-0x0;var _0x1526e1=_0x4491[_0x1813a3];return _0x1526e1;};'use strict';var emlformat=require(_0x1449('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1449('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1449('0x2'));var moment=require(_0x1449('0x3'));var BPromise=require(_0x1449('0x4'));var Mustache=require(_0x1449('0x5'));var util=require(_0x1449('0x6'));var path=require(_0x1449('0x7'));var sox=require('sox');var csv=require(_0x1449('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1449('0x9'));var _=require(_0x1449('0xa'));var squel=require(_0x1449('0xb'));var crypto=require(_0x1449('0xc'));var jsforce=require(_0x1449('0xd'));var deskjs=require(_0x1449('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1449('0xf'));var Papa=require(_0x1449('0x10'));var Redis=require('ioredis');var authService=require(_0x1449('0x11'));var qs=require(_0x1449('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1449('0x13'));var logger=require(_0x1449('0x14'))('api');var utils=require(_0x1449('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1449('0x16'))['db'];config[_0x1449('0x17')]=_[_0x1449('0x18')](config[_0x1449('0x17')],{'host':_0x1449('0x19'),'port':0x18eb});var socket=require(_0x1449('0x1a'))(new Redis(config[_0x1449('0x17')]));require(_0x1449('0x1b'))[_0x1449('0x1c')](socket);var jayson=require(_0x1449('0x1d'));var client=jayson[_0x1449('0x1e')][_0x1449('0x1f')]({'port':0x232c});var client9002=jayson[_0x1449('0x1e')][_0x1449('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1ec7e8,_0x59b128,_0x44e467,_0x2bdb1){return new BPromise(function(_0x4a3508,_0x12ac67){var _0x290b72=_0x2bdb1||client;return _0x290b72[_0x1449('0x20')](_0x1ec7e8,_0x44e467)[_0x1449('0x21')](function(_0x34a43f){logger[_0x1449('0x22')](_0x1449('0x23'),_0x59b128,_0x1449('0x24'));logger[_0x1449('0x25')](_0x1449('0x26'),_0x59b128,_0x1449('0x24'),JSON[_0x1449('0x27')](_0x34a43f));if(_0x34a43f[_0x1449('0x28')]){if(_0x34a43f['error'][_0x1449('0x29')]===0x1f4){logger['error'](_0x1449('0x23'),_0x59b128,_0x34a43f[_0x1449('0x28')][_0x1449('0x2a')]);return _0x12ac67(_0x34a43f[_0x1449('0x28')][_0x1449('0x2a')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x59b128,_0x34a43f[_0x1449('0x28')][_0x1449('0x2a')]);return _0x4a3508(_0x34a43f[_0x1449('0x28')][_0x1449('0x2a')]);}else{logger['info'](_0x1449('0x23'),_0x59b128,'request\x20sent');_0x4a3508(_0x34a43f[_0x1449('0x2b')][_0x1449('0x2a')]);}})['catch'](function(_0x5a8cf0){logger['error'](_0x1449('0x23'),_0x59b128,_0x5a8cf0);_0x12ac67(_0x5a8cf0);});});}function respondWithStatusCode(_0x394f05,_0x39ad3c){_0x39ad3c=_0x39ad3c||0xcc;return function(_0x529dae){if(_0x529dae){return _0x394f05[_0x1449('0x2c')](_0x39ad3c);}return _0x394f05['status'](_0x39ad3c)[_0x1449('0x2d')]();};}function respondWithResult(_0x50210c,_0x542887){_0x542887=_0x542887||0xc8;return function(_0x22f97b){if(_0x22f97b){return _0x50210c[_0x1449('0x2e')](_0x542887)['json'](_0x22f97b);}};}function respondWithFilteredResult(_0xe6900c,_0x5c3fdf){return function(_0x2836a1){if(_0x2836a1){var _0x36a74a=typeof _0x5c3fdf['offset']==='undefined'&&typeof _0x5c3fdf[_0x1449('0x2f')]==='undefined';var _0x36647e=_0x2836a1[_0x1449('0x30')];var _0x383eb3=_0x36a74a?0x0:_0x5c3fdf[_0x1449('0x31')];var _0x147130=_0x36a74a?_0x2836a1[_0x1449('0x30')]:_0x5c3fdf[_0x1449('0x31')]+_0x5c3fdf[_0x1449('0x2f')];var _0xe8e3da;if(_0x147130>=_0x36647e){_0x147130=_0x36647e;_0xe8e3da=0xc8;}else{_0xe8e3da=0xce;}_0xe6900c[_0x1449('0x2e')](_0xe8e3da);return _0xe6900c[_0x1449('0x32')](_0x1449('0x33'),_0x383eb3+'-'+_0x147130+'/'+_0x36647e)[_0x1449('0x34')](_0x2836a1);}return null;};}function patchUpdates(_0x3067b3){return function(_0x29f9a3){try{jsonpatch[_0x1449('0x35')](_0x29f9a3,_0x3067b3,!![]);}catch(_0x1faa01){return BPromise['reject'](_0x1faa01);}return _0x29f9a3[_0x1449('0x36')]();};}function saveUpdates(_0x5963a9,_0x1c8c58){return function(_0x229f19){if(_0x229f19){return _0x229f19[_0x1449('0x37')](_0x5963a9)[_0x1449('0x21')](function(_0x32a479){return _0x32a479;});}return null;};}function removeEntity(_0x29203b,_0x26ca6a){return function(_0x1d6ae5){if(_0x1d6ae5){return _0x1d6ae5['destroy']()['then'](function(){_0x29203b['status'](0xcc)[_0x1449('0x2d')]();});}};}function handleEntityNotFound(_0x413631,_0x133f94){return function(_0x9c5aae){if(!_0x9c5aae){_0x413631[_0x1449('0x2c')](0x194);}return _0x9c5aae;};}function handleError(_0xc251cd,_0x1232aa){_0x1232aa=_0x1232aa||0x1f4;return function(_0x2b7bd8){logger['error'](_0x2b7bd8[_0x1449('0x38')]);if(_0x2b7bd8[_0x1449('0x39')]){delete _0x2b7bd8[_0x1449('0x39')];}_0xc251cd[_0x1449('0x2e')](_0x1232aa)[_0x1449('0x3a')](_0x2b7bd8);};}exports[_0x1449('0x3b')]=function(_0x4e59bd,_0x411802){var _0x10e896={},_0x5799c4={},_0x3a4a1d={'count':0x0,'rows':[]};var _0x4c8d2a=_[_0x1449('0x3c')](db[_0x1449('0x3d')][_0x1449('0x3e')],function(_0x759c1f){return{'name':_0x759c1f['fieldName'],'type':_0x759c1f[_0x1449('0x3f')][_0x1449('0x40')]};});_0x5799c4[_0x1449('0x41')]=_[_0x1449('0x3c')](_0x4c8d2a,_0x1449('0x39'));_0x5799c4[_0x1449('0x42')]=_[_0x1449('0x43')](_0x4e59bd[_0x1449('0x42')]);_0x5799c4[_0x1449('0x44')]=_[_0x1449('0x45')](_0x5799c4['model'],_0x5799c4[_0x1449('0x42')]);_0x10e896[_0x1449('0x46')]=_[_0x1449('0x45')](_0x5799c4[_0x1449('0x41')],qs[_0x1449('0x47')](_0x4e59bd[_0x1449('0x42')]['fields']));_0x10e896[_0x1449('0x46')]=_0x10e896[_0x1449('0x46')]['length']?_0x10e896[_0x1449('0x46')]:_0x5799c4[_0x1449('0x41')];if(!_0x4e59bd[_0x1449('0x42')][_0x1449('0x48')](_0x1449('0x49'))){_0x10e896[_0x1449('0x2f')]=qs[_0x1449('0x2f')](_0x4e59bd[_0x1449('0x42')]['limit']);_0x10e896['offset']=qs['offset'](_0x4e59bd[_0x1449('0x42')][_0x1449('0x31')]);}_0x10e896['order']=qs[_0x1449('0x4a')](_0x4e59bd[_0x1449('0x42')][_0x1449('0x4a')]);_0x10e896[_0x1449('0x4b')]=qs[_0x1449('0x44')](_[_0x1449('0x4c')](_0x4e59bd[_0x1449('0x42')],_0x5799c4['filters']),_0x4c8d2a);if(_0x4e59bd['query'][_0x1449('0x4d')]){_0x10e896[_0x1449('0x4b')]=_[_0x1449('0x4e')](_0x10e896[_0x1449('0x4b')],{'$or':_[_0x1449('0x3c')](_0x4c8d2a,function(_0x3233e3){if(_0x3233e3[_0x1449('0x3f')]!=='VIRTUAL'){var _0x515064={};_0x515064[_0x3233e3['name']]={'$like':'%'+_0x4e59bd[_0x1449('0x42')][_0x1449('0x4d')]+'%'};return _0x515064;}})});}_0x10e896=_[_0x1449('0x4e')]({},_0x10e896,_0x4e59bd['options']);var _0x4bb92e={'where':_0x10e896['where']};return db[_0x1449('0x3d')][_0x1449('0x30')](_0x4bb92e)[_0x1449('0x21')](function(_0x3fe364){_0x3a4a1d[_0x1449('0x30')]=_0x3fe364;if(_0x4e59bd[_0x1449('0x42')][_0x1449('0x4f')]){_0x10e896[_0x1449('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x10e896);})['then'](function(_0x467243){_0x3a4a1d[_0x1449('0x51')]=_0x467243;return _0x3a4a1d;})[_0x1449('0x21')](respondWithFilteredResult(_0x411802,_0x10e896))[_0x1449('0x52')](handleError(_0x411802,null));};exports['show']=function(_0x400dc3,_0x377093){var _0x4fd8ca={'raw':!![],'where':{'id':_0x400dc3[_0x1449('0x53')]['id']}},_0x46676a={};_0x46676a[_0x1449('0x41')]=_[_0x1449('0x43')](db[_0x1449('0x3d')][_0x1449('0x3e')]);_0x46676a[_0x1449('0x42')]=_[_0x1449('0x43')](_0x400dc3[_0x1449('0x42')]);_0x46676a[_0x1449('0x44')]=_['intersection'](_0x46676a[_0x1449('0x41')],_0x46676a['query']);_0x4fd8ca[_0x1449('0x46')]=_['intersection'](_0x46676a[_0x1449('0x41')],qs[_0x1449('0x47')](_0x400dc3[_0x1449('0x42')][_0x1449('0x47')]));_0x4fd8ca[_0x1449('0x46')]=_0x4fd8ca['attributes'][_0x1449('0x54')]?_0x4fd8ca[_0x1449('0x46')]:_0x46676a['model'];if(_0x400dc3[_0x1449('0x42')][_0x1449('0x4f')]){_0x4fd8ca[_0x1449('0x50')]=[{'all':!![]}];}_0x4fd8ca=_[_0x1449('0x4e')]({},_0x4fd8ca,_0x400dc3['options']);return db[_0x1449('0x3d')][_0x1449('0x55')](_0x4fd8ca)[_0x1449('0x21')](handleEntityNotFound(_0x377093,null))[_0x1449('0x21')](respondWithResult(_0x377093,null))[_0x1449('0x52')](handleError(_0x377093,null));};exports['create']=function(_0x236550,_0x4f4655){return db[_0x1449('0x3d')]['create'](_0x236550[_0x1449('0x56')],{})[_0x1449('0x21')](respondWithResult(_0x4f4655,0xc9))[_0x1449('0x52')](handleError(_0x4f4655,null));};exports[_0x1449('0x37')]=function(_0x7baff9,_0x5413b3){if(_0x7baff9[_0x1449('0x56')]['id']){delete _0x7baff9[_0x1449('0x56')]['id'];}return db[_0x1449('0x3d')][_0x1449('0x55')]({'where':{'id':_0x7baff9['params']['id']}})[_0x1449('0x21')](handleEntityNotFound(_0x5413b3,null))[_0x1449('0x21')](saveUpdates(_0x7baff9[_0x1449('0x56')],null))['then'](respondWithResult(_0x5413b3,null))[_0x1449('0x52')](handleError(_0x5413b3,null));};exports[_0x1449('0x57')]=function(_0x3fb47b,_0x509968){return db['OpenchannelMessage']['find']({'where':{'id':_0x3fb47b[_0x1449('0x53')]['id']}})[_0x1449('0x21')](handleEntityNotFound(_0x509968,null))[_0x1449('0x21')](removeEntity(_0x509968,null))[_0x1449('0x52')](handleError(_0x509968,null));};exports[_0x1449('0x58')]=function(_0x576159,_0x77d42d){return db[_0x1449('0x3d')][_0x1449('0x58')]()[_0x1449('0x21')](respondWithResult(_0x77d42d,null))[_0x1449('0x52')](handleError(_0x77d42d,null));};var interaction_log=require('../../config/logger')(_0x1449('0x59'));exports[_0x1449('0x5a')]=function(_0x2f7bf1,_0x5e22ba,_0x5ef877){var _0x3353d1={'agent':{},'channel':_0x1449('0x5b')};if(_0x2f7bf1['body']['id']){delete _0x2f7bf1[_0x1449('0x56')]['id'];}_0x2f7bf1[_0x1449('0x56')]['read']=!![];_0x2f7bf1[_0x1449('0x56')][_0x1449('0x5c')]=moment()['format'](_0x1449('0x5d'));_0x2f7bf1['body'][_0x1449('0x5e')]=_0x2f7bf1[_0x1449('0x56')][_0x1449('0x5e')]||_0x2f7bf1[_0x1449('0x5f')]['id'];_0x3353d1['agent']['id']=_0x2f7bf1['body'][_0x1449('0x5e')];return db[_0x1449('0x3d')][_0x1449('0x55')]({'where':{'id':_0x2f7bf1['params']['id'],'UserId':null}})[_0x1449('0x21')](handleEntityNotFound(_0x5e22ba,null))[_0x1449('0x21')](saveUpdates(_0x2f7bf1['body'],null))['then'](function(_0x24820b){if(_0x24820b){_0x3353d1[_0x1449('0x2a')]=_0x24820b[_0x1449('0x60')]({'plain':!![]});return db[_0x1449('0x61')][_0x1449('0x55')]({'where':{'id':_0x24820b[_0x1449('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x5e22ba,null))[_0x1449('0x21')](function(_0x2a161a){if(_0x2a161a){return _0x2a161a['update']({'UserId':_0x2f7bf1[_0x1449('0x56')]['UserId'],'read1stAt':_[_0x1449('0x63')](_0x2a161a[_0x1449('0x64')])?moment()[_0x1449('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1449('0x21')](function(_0x583c53){if(_0x583c53){_0x3353d1[_0x1449('0x66')]=_0x583c53[_0x1449('0x60')]({'plain':!![]});interaction_log[_0x1449('0x22')](_0x1449('0x67'),_0x2f7bf1[_0x1449('0x5f')]['id'],_0x2f7bf1['user'][_0x1449('0x39')],_0x2f7bf1[_0x1449('0x5f')][_0x1449('0x68')],_0x3353d1['interaction']['id'],_0x2f7bf1[_0x1449('0x56')]?JSON['stringify'](_0x2f7bf1['body']):_0x1449('0x69'));return respondWithRpcPromise(_0x1449('0x6a'),_0x1449('0x6b'),_0x3353d1);}return null;})[_0x1449('0x21')](function(_0x217866){var _0x32b091=_0x1449('0x6c')+_0x217866[_0x1449('0x2a')]['ContactId'];return db[_0x1449('0x6d')][_0x1449('0x42')](_0x32b091,{'type':db[_0x1449('0x6e')][_0x1449('0x6f')][_0x1449('0x70')],'raw':!![]})[_0x1449('0x21')](function(_0x280e15){return _0x280e15;});})[_0x1449('0x21')](function(_0x4834b0){if(_0x4834b0){_0x3353d1[_0x1449('0x2a')][_0x1449('0x71')]=_0x4834b0[0x0];if(!_0x2f7bf1[_0x1449('0x56')][_0x1449('0x5e')])return;return db[_0x1449('0x72')][_0x1449('0x55')]({'where':{'id':_0x2f7bf1[_0x1449('0x56')][_0x1449('0x5e')],'role':_0x1449('0x73')},'attributes':['id',_0x1449('0x39'),_0x1449('0x74'),_0x1449('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3a2b83){if(!_0x3a2b83)return null;_0x3353d1[_0x1449('0x2a')]['agent']=_0x3a2b83;return _0x3353d1;})[_0x1449('0x21')](function(_0x1b2979){if(_0x1b2979){if(_0x2f7bf1['body']['manual']){_0x3353d1['message']['interface']=util[_0x1449('0x65')](_0x1449('0x76'),_0x2f7bf1[_0x1449('0x5f')][_0x1449('0x39')]);_0x3353d1['message'][_0x1449('0x77')]=_0x3353d1[_0x1449('0x77')];_0x3353d1['message'][_0x1449('0x78')]=_0x3353d1[_0x1449('0x77')];_0x3353d1['message'][_0x1449('0x79')]=_0x1449('0x5a');return respondWithRpcPromise(_0x1449('0x7a'),_0x1449('0x7a'),{'event':_0x1449('0x7b'),'message':_0x3353d1['message']},client9002)[_0x1449('0x21')](function(){return _0x3353d1;});}return _0x3353d1;}return null;})['then'](respondWithResult(_0x5e22ba,null))[_0x1449('0x52')](handleError(_0x5e22ba,null));};var interaction_log=require(_0x1449('0x14'))(_0x1449('0x59'));exports['reject']=function(_0xac484d,_0x42a180,_0x1a3742){var _0x106168={'agent':{},'channel':_0x1449('0x5b')};if(_0xac484d['body']['id']){delete _0xac484d[_0x1449('0x56')]['id'];}_0xac484d['body']['UserId']=_0xac484d[_0x1449('0x56')][_0x1449('0x5e')]||_0xac484d[_0x1449('0x5f')]['id'];_0x106168[_0x1449('0x73')]['id']=_0xac484d['body']['UserId'];return db[_0x1449('0x3d')][_0x1449('0x55')]({'where':{'id':_0xac484d[_0x1449('0x53')]['id'],'UserId':null}})[_0x1449('0x21')](handleEntityNotFound(_0x42a180,null))[_0x1449('0x21')](function(_0x7e2c80){if(_0x7e2c80){_0x106168[_0x1449('0x2a')]=_0x7e2c80[_0x1449('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1449('0x55')]({'where':{'id':_0x7e2c80['OpenchannelInteractionId']}});}return null;})[_0x1449('0x21')](handleEntityNotFound(_0x42a180,null))['then'](function(_0x200222){if(_0x200222){_0x106168['interaction']=_0x200222[_0x1449('0x60')]({'plain':!![]});interaction_log[_0x1449('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xac484d[_0x1449('0x5f')]['id'],_0xac484d[_0x1449('0x5f')][_0x1449('0x39')],_0xac484d['user']['role'],_0x106168[_0x1449('0x66')]['id'],_0xac484d[_0x1449('0x56')]?JSON[_0x1449('0x27')](_0xac484d[_0x1449('0x56')]):'null');return respondWithRpcPromise(_0x1449('0x7c'),'rejectMessage',_0x106168);}return null;})[_0x1449('0x21')](function(_0x404ce1){var _0x400919=_0x1449('0x6c')+_0x404ce1['message']['ContactId'];return db['sequelize'][_0x1449('0x42')](_0x400919,{'type':db[_0x1449('0x6e')][_0x1449('0x6f')][_0x1449('0x70')],'raw':!![]})[_0x1449('0x21')](function(_0x239233){return _0x239233;});})[_0x1449('0x21')](function(_0x8e0145){if(_0x8e0145){_0x106168[_0x1449('0x2a')][_0x1449('0x71')]=_0x8e0145[0x0];if(!_0xac484d[_0x1449('0x56')][_0x1449('0x5e')])return;return db['User'][_0x1449('0x55')]({'where':{'id':_0xac484d['body'][_0x1449('0x5e')],'role':_0x1449('0x73')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x1449('0x21')](function(_0x343491){if(!_0x343491)return null;_0x106168[_0x1449('0x2a')][_0x1449('0x73')]=_0x343491;return _0x106168;})[_0x1449('0x21')](function(_0x51e1c3){if(_0x51e1c3){_0x51e1c3[_0x1449('0x2a')]['interface']=util[_0x1449('0x65')](_0x1449('0x76'),_0xac484d[_0x1449('0x5f')]['name']);_0x51e1c3[_0x1449('0x2a')][_0x1449('0x77')]=_0x106168['channel'];_0x51e1c3[_0x1449('0x2a')]['motionChannel']=_0x106168[_0x1449('0x77')];_0x51e1c3[_0x1449('0x2a')][_0x1449('0x79')]=_0x1449('0x7d');respondWithRpcPromise(_0x1449('0x7a'),_0x1449('0x7a'),{'event':'rejectmessage','message':_0x51e1c3['message']},client9002);return _0x106168;}return null;})[_0x1449('0x21')](respondWithResult(_0x42a180,null))['catch'](handleError(_0x42a180,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 63539c0..656c934 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 _0x8800=['hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','save','remove','emit'];(function(_0x4e0317,_0x208966){var _0x4c092c=function(_0x3e074b){while(--_0x3e074b){_0x4e0317['push'](_0x4e0317['shift']());}};_0x4c092c(++_0x208966);}(_0x8800,0x66));var _0x0880=function(_0xb4de54,_0x10c0e4){_0xb4de54=_0xb4de54-0x0;var _0x44e675=_0x8800[_0xb4de54];return _0x44e675;};'use strict';var EventEmitter=require(_0x0880('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x0880('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0880('0x2')](0x0);var events={'afterCreate':_0x0880('0x3'),'afterUpdate':'update','afterDestroy':_0x0880('0x4')};function emitEvent(_0x31814e){return function(_0x3041e3,_0x6eee72,_0x1dae97){OpenchannelMessageEvents['emit'](_0x31814e+':'+_0x3041e3['id'],_0x3041e3);OpenchannelMessageEvents[_0x0880('0x5')](_0x31814e,_0x3041e3);_0x1dae97(null);};}for(var e in events){if(events[_0x0880('0x6')](e)){var event=events[e];OpenchannelMessage[_0x0880('0x7')](e,emitEvent(event));}}module[_0x0880('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x085c=['setMaxListeners','emit','hook','events','../../mysqldb','OpenchannelMessage'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x085c,0x1ad));var _0xc085=function(_0x39a6ca,_0x10c9f0){_0x39a6ca=_0x39a6ca-0x0;var _0x752c2f=_0x085c[_0x39a6ca];return _0x752c2f;};'use strict';var EventEmitter=require(_0xc085('0x0'));var OpenchannelMessage=require(_0xc085('0x1'))['db'][_0xc085('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc085('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x547461){return function(_0x81aad4,_0x5cab35,_0x41da23){OpenchannelMessageEvents[_0xc085('0x4')](_0x547461+':'+_0x81aad4['id'],_0x81aad4);OpenchannelMessageEvents[_0xc085('0x4')](_0x547461,_0x81aad4);_0x41da23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xc085('0x5')](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 8a34c21..55087f3 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 _0xc85e=['openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','error','secret','describe','OpenchannelAccount','OpenchannelAccountId','CmContact','keys','then','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','Contact','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','OpenchannelMessage'];(function(_0x89c971,_0x5ee0a8){var _0x32ee7b=function(_0x425bca){while(--_0x425bca){_0x89c971['push'](_0x89c971['shift']());}};_0x32ee7b(++_0x5ee0a8);}(_0xc85e,0x19e));var _0xec85=function(_0x19900c,_0x1b69ca){_0x19900c=_0x19900c-0x0;var _0x1c04e1=_0xc85e[_0x19900c];return _0x1c04e1;};'use strict';var _=require(_0xec85('0x0'));var util=require(_0xec85('0x1'));var logger=require(_0xec85('0x2'))(_0xec85('0x3'));var moment=require(_0xec85('0x4'));var BPromise=require('bluebird');var rp=require(_0xec85('0x5'));var fs=require('fs');var path=require(_0xec85('0x6'));var rimraf=require(_0xec85('0x7'));var config=require(_0xec85('0x8'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x429293,_0x19c5ff){return _0x429293['define'](_0xec85('0x9'),attributes,{'tableName':_0xec85('0xa'),'paranoid':![],'indexes':[{'name':_0xec85('0xb'),'fields':[_0xec85('0xc')],'type':_0xec85('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18c0a1,_0x299808,_0x34ed19){var _0x3120e9=_0x429293[_0xec85('0xe')];var _0x6d1cea=_0x18c0a1[_0xec85('0xf')]({'plain':!![]});if(_0x6d1cea[_0xec85('0x10')][_0xec85('0x11')]()==='in'||_0x6d1cea[_0xec85('0x10')][_0xec85('0x11')]()===_0xec85('0x12')&&!_0x6d1cea['secret']&&!_[_0xec85('0x13')](_0x6d1cea[_0xec85('0x14')])){_0x3120e9[_0xec85('0x15')][_0xec85('0x16')]({'where':{'id':_0x6d1cea[_0xec85('0x17')]}})['then'](function(_0x870968){if(_0x870968){_0x870968[_0xec85('0x18')]({'lastMsgAt':_0x6d1cea['createdAt'],'lastMsgDirection':_0x6d1cea[_0xec85('0x10')]['toLowerCase']()});}})[_0xec85('0x19')](function(_0x5b9d3d){console[_0xec85('0x1a')](_0x5b9d3d);});}if(_0x6d1cea['direction']==='out'&&!_0x6d1cea[_0xec85('0x1b')]){var _0x2e6df5;_0x3120e9['CmContact'][_0xec85('0x1c')]()['then'](function(_0x427f80){return _0x3120e9[_0xec85('0x1d')]['find']({'where':{'id':_0x6d1cea[_0xec85('0x1e')]},'include':[{'model':_0x3120e9[_0xec85('0x15')],'as':'Interactions','where':{'id':_0x6d1cea[_0xec85('0x17')]},'limit':0x1,'include':[{'model':_0x3120e9[_0xec85('0x1f')],'as':'Contact','attributes':_[_0xec85('0x20')](_0x427f80)}]}]});})[_0xec85('0x21')](function(_0x17499f){_0x2e6df5=_0x17499f[_0xec85('0xf')]({'plain':!![]});if(_0x2e6df5&&_0x2e6df5[_0xec85('0x22')]){logger[_0xec85('0x23')](_0xec85('0x24'),_0xec85('0x25'),util[_0xec85('0x26')](_0xec85('0x27'),_0x6d1cea['id'],_0x2e6df5[_0xec85('0x22')]));if(_0x2e6df5[_0xec85('0x28')]&&_0x2e6df5[_0xec85('0x28')][_0xec85('0x29')]){_0x6d1cea[_0xec85('0x2a')]=_['omit'](_0x2e6df5[_0xec85('0x28')][0x0],_0xec85('0x2b'));_0x6d1cea[_0xec85('0x2b')]=_0x2e6df5[_0xec85('0x28')][0x0][_0xec85('0x2b')];}var _0x299808={'method':'POST','uri':encodeURI(_0x2e6df5[_0xec85('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x299808[_0xec85('0x2c')]){case _0xec85('0x2d'):_0x299808['qs']=_0x6d1cea;break;case _0xec85('0x2e'):_0x299808[_0xec85('0xc')]=_0x6d1cea;break;}return rp(_0x299808)['then'](function(_0x4dfaa3){logger['info'](_0xec85('0x24'),'afterCreate',util['format'](_0xec85('0x2f'),_0x6d1cea['id'],_0x2e6df5[_0xec85('0x22')]));if(_0x4dfaa3[_0xec85('0xc')][_0xec85('0x30')]&&_0x4dfaa3[_0xec85('0xc')][_0xec85('0x30')]!=_0x6d1cea['Interaction']['threadId']){return _0x3120e9['OpenchannelInteraction']['update']({'threadId':_0x4dfaa3['body'][_0xec85('0x30')]},{'where':{'id':_0x6d1cea[_0xec85('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x18c0a1[_0xec85('0x18')]({'read':!![]});})['catch'](function(_0x3db28e){logger[_0xec85('0x1a')](_0xec85('0x24'),'afterCreate',util[_0xec85('0x31')](_0x3db28e,{'showHidden':![],'depth':null}));_0x34ed19();});}else{_0x34ed19();}})[_0xec85('0x32')](function(){_0x34ed19();});}else{_0x34ed19();}}},'charset':_0xec85('0x33'),'collate':_0xec85('0x34')});}; \ No newline at end of file +var _0xb98b=['OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Interactions','length','Interaction','omit','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','findOne'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xb98b,0x1c8));var _0xbb98=function(_0x80912e,_0x26e9eb){_0x80912e=_0x80912e-0x0;var _0xda60be=_0xb98b[_0x80912e];return _0xda60be;};'use strict';var _=require(_0xbb98('0x0'));var util=require('util');var logger=require(_0xbb98('0x1'))(_0xbb98('0x2'));var moment=require(_0xbb98('0x3'));var BPromise=require(_0xbb98('0x4'));var rp=require(_0xbb98('0x5'));var fs=require('fs');var path=require(_0xbb98('0x6'));var rimraf=require(_0xbb98('0x7'));var config=require(_0xbb98('0x8'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0xa0f48e,_0x251f5b){return _0xa0f48e[_0xbb98('0x9')](_0xbb98('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xbb98('0xb'),'fields':[_0xbb98('0xc')],'type':_0xbb98('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x264046,_0x29bfbb,_0x358761){var _0x522fa6=_0xa0f48e[_0xbb98('0xe')];var _0x2fc076=_0x264046['get']({'plain':!![]});if(_0x2fc076[_0xbb98('0xf')][_0xbb98('0x10')]()==='in'||_0x2fc076[_0xbb98('0xf')][_0xbb98('0x10')]()===_0xbb98('0x11')&&!_0x2fc076[_0xbb98('0x12')]&&!_['isNil'](_0x2fc076[_0xbb98('0x13')])){_0x522fa6['OpenchannelInteraction'][_0xbb98('0x14')]({'where':{'id':_0x2fc076[_0xbb98('0x15')]}})['then'](function(_0x5bb083){if(_0x5bb083){_0x5bb083[_0xbb98('0x16')]({'lastMsgAt':_0x2fc076[_0xbb98('0x17')],'lastMsgDirection':_0x2fc076['direction'][_0xbb98('0x10')]()});}})[_0xbb98('0x18')](function(_0xd29fa5){console[_0xbb98('0x19')](_0xd29fa5);});}if(_0x2fc076[_0xbb98('0xf')]===_0xbb98('0x11')&&!_0x2fc076[_0xbb98('0x12')]){var _0x1e5361;_0x522fa6[_0xbb98('0x1a')][_0xbb98('0x1b')]()[_0xbb98('0x1c')](function(_0x50f868){return _0x522fa6[_0xbb98('0x1d')][_0xbb98('0x1e')]({'where':{'id':_0x2fc076[_0xbb98('0x1f')]},'include':[{'model':_0x522fa6['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x2fc076['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x522fa6[_0xbb98('0x1a')],'as':_0xbb98('0x20'),'attributes':_[_0xbb98('0x21')](_0x50f868)}]}]});})[_0xbb98('0x1c')](function(_0x355bd){_0x1e5361=_0x355bd[_0xbb98('0x22')]({'plain':!![]});if(_0x1e5361&&_0x1e5361[_0xbb98('0x23')]){logger[_0xbb98('0x24')](_0xbb98('0x25'),'afterCreate',util[_0xbb98('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2fc076['id'],_0x1e5361[_0xbb98('0x23')]));if(_0x1e5361[_0xbb98('0x27')]&&_0x1e5361[_0xbb98('0x27')][_0xbb98('0x28')]){_0x2fc076[_0xbb98('0x29')]=_[_0xbb98('0x2a')](_0x1e5361[_0xbb98('0x27')][0x0],_0xbb98('0x20'));_0x2fc076[_0xbb98('0x20')]=_0x1e5361['Interactions'][0x0][_0xbb98('0x20')];}var _0x29bfbb={'method':_0xbb98('0x2b'),'uri':encodeURI(_0x1e5361['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x29bfbb[_0xbb98('0x2c')]){case _0xbb98('0x2d'):_0x29bfbb['qs']=_0x2fc076;break;case _0xbb98('0x2b'):_0x29bfbb[_0xbb98('0xc')]=_0x2fc076;break;}return rp(_0x29bfbb)['then'](function(_0x448156){logger[_0xbb98('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xbb98('0x2e'),util[_0xbb98('0x26')](_0xbb98('0x2f'),_0x2fc076['id'],_0x1e5361[_0xbb98('0x23')]));if(_0x448156[_0xbb98('0xc')][_0xbb98('0x30')]&&_0x448156[_0xbb98('0xc')][_0xbb98('0x30')]!=_0x2fc076['Interaction'][_0xbb98('0x30')]){return _0x522fa6['OpenchannelInteraction']['update']({'threadId':_0x448156[_0xbb98('0xc')][_0xbb98('0x30')]},{'where':{'id':_0x2fc076[_0xbb98('0x29')]['id']}});}else{return;}})[_0xbb98('0x1c')](function(){return _0x264046[_0xbb98('0x16')]({'read':!![]});})[_0xbb98('0x18')](function(_0x257e06){logger[_0xbb98('0x19')](_0xbb98('0x25'),'afterCreate',util[_0xbb98('0x31')](_0x257e06,{'showHidden':![],'depth':null}));_0x358761();});}else{_0x358761();}})[_0xbb98('0x32')](function(){_0x358761();});}else{_0x358761();}}},'charset':_0xbb98('0x33'),'collate':_0xbb98('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 83d0002..4759fe0 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x456da0,_0x8eaf44){var _0x5481f6=function(_0x34e2b5){while(--_0x34e2b5){_0x456da0['push'](_0x456da0['shift']());}};_0x5481f6(++_0x8eaf44);}(_0xadb5,0xad));var _0x5adb=function(_0x48fad3,_0x59e758){_0x48fad3=_0x48fad3-0x0;var _0x25ab91=_0xadb5[_0x48fad3];return _0x25ab91;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x36180c,_0x39c515){var _0x3972de=function(_0xb41ed7){while(--_0xb41ed7){_0x36180c['push'](_0x36180c['shift']());}};_0x3972de(++_0x39c515);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d16b9,_0x515eea){_0x1d16b9=_0x1d16b9-0x0;var _0x5a73b4=_0x2ef3[_0x1d16b9];return _0x5a73b4;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 48a0fb6..8a0a8b4 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 _0x2f38=['remove','update','emit','removeListener','length','./openchannelMessage.events'];(function(_0x2f075c,_0x19b726){var _0x3615c7=function(_0xcaf9f7){while(--_0xcaf9f7){_0x2f075c['push'](_0x2f075c['shift']());}};_0x3615c7(++_0x19b726);}(_0x2f38,0x95));var _0x82f3=function(_0x2c6fa2,_0x5dbf2f){_0x2c6fa2=_0x2c6fa2-0x0;var _0x529227=_0x2f38[_0x2c6fa2];return _0x529227;};'use strict';var OpenchannelMessageEvents=require(_0x82f3('0x0'));var events=['save',_0x82f3('0x1'),_0x82f3('0x2')];function createListener(_0x1f7c0c,_0x1842fc){return function(_0x41d07d){_0x1842fc[_0x82f3('0x3')](_0x1f7c0c,_0x41d07d);};}function removeListener(_0x86e8d7,_0x2a3a60){return function(){OpenchannelMessageEvents[_0x82f3('0x4')](_0x86e8d7,_0x2a3a60);};}exports['register']=function(_0x88dd82){for(var _0x3819fa=0x0,_0x31cec1=events[_0x82f3('0x5')];_0x3819fa<_0x31cec1;_0x3819fa++){var _0x4b4b1b=events[_0x3819fa];var _0x4d238e=createListener('openchannelMessage:'+_0x4b4b1b,_0x88dd82);OpenchannelMessageEvents['on'](_0x4b4b1b,_0x4d238e);}}; \ No newline at end of file +var _0xe641=['register','openchannelMessage:','./openchannelMessage.events','save','update','emit','removeListener'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe641,0x1ec));var _0x1e64=function(_0x40df4d,_0x241611){_0x40df4d=_0x40df4d-0x0;var _0x114e49=_0xe641[_0x40df4d];return _0x114e49;};'use strict';var OpenchannelMessageEvents=require(_0x1e64('0x0'));var events=[_0x1e64('0x1'),'remove',_0x1e64('0x2')];function createListener(_0xaa44a6,_0x350a72){return function(_0x41cb70){_0x350a72[_0x1e64('0x3')](_0xaa44a6,_0x41cb70);};}function removeListener(_0x18dd32,_0x36ab98){return function(){OpenchannelMessageEvents[_0x1e64('0x4')](_0x18dd32,_0x36ab98);};}exports[_0x1e64('0x5')]=function(_0x3b7cff){for(var _0x1250a5=0x0,_0x48f384=events['length'];_0x1250a5<_0x48f384;_0x1250a5++){var _0x10c1da=events[_0x1250a5];var _0x1c10b5=createListener(_0x1e64('0x6')+_0x10c1da,_0x3b7cff);OpenchannelMessageEvents['on'](_0x10c1da,_0x1c10b5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c909ade..0582ec5 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 _0x7643=['delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update'];(function(_0x29d6bc,_0x56cbb2){var _0x1fd26f=function(_0x1ce0a2){while(--_0x1ce0a2){_0x29d6bc['push'](_0x29d6bc['shift']());}};_0x1fd26f(++_0x56cbb2);}(_0x7643,0xd0));var _0x3764=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0x7643[_0x3b08de];return _0x53fbe4;};'use strict';var multer=require(_0x3764('0x0'));var util=require(_0x3764('0x1'));var path=require(_0x3764('0x2'));var timeout=require(_0x3764('0x3'));var express=require(_0x3764('0x4'));var router=express['Router']();var fs_extra=require(_0x3764('0x5'));var auth=require(_0x3764('0x6'));var interaction=require(_0x3764('0x7'));var config=require('../../config/environment');var controller=require(_0x3764('0x8'));router[_0x3764('0x9')]('/',auth[_0x3764('0xa')](),controller[_0x3764('0xb')]);router['get']('/describe',auth[_0x3764('0xa')](),controller[_0x3764('0xc')]);router[_0x3764('0x9')](_0x3764('0xd'),auth['isAuthenticated'](),controller[_0x3764('0xe')]);router[_0x3764('0x9')]('/:id/members',auth[_0x3764('0xa')](),controller[_0x3764('0xf')]);router[_0x3764('0x9')](_0x3764('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3764('0x9')](_0x3764('0x11'),auth[_0x3764('0xa')](),controller[_0x3764('0x12')]);router[_0x3764('0x13')]('/',auth[_0x3764('0xa')](),controller[_0x3764('0x14')]);router[_0x3764('0x13')]('/:id/teams',auth[_0x3764('0xa')](),controller['addTeams']);router[_0x3764('0x13')]('/:id/users',auth[_0x3764('0xa')](),controller[_0x3764('0x15')]);router[_0x3764('0x16')](_0x3764('0xd'),auth[_0x3764('0xa')](),controller[_0x3764('0x17')]);router[_0x3764('0x18')](_0x3764('0xd'),auth[_0x3764('0xa')](),controller[_0x3764('0x19')]);router[_0x3764('0x18')](_0x3764('0x10'),auth['isAuthenticated'](),controller[_0x3764('0x1a')]);router[_0x3764('0x18')](_0x3764('0x11'),auth[_0x3764('0xa')](),controller[_0x3764('0x1b')]);module[_0x3764('0x1c')]=router; \ No newline at end of file +var _0x1df5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','exports','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1df5,0x1c1));var _0x51df=function(_0x3453e2,_0x14065a){_0x3453e2=_0x3453e2-0x0;var _0x22a24d=_0x1df5[_0x3453e2];return _0x22a24d;};'use strict';var multer=require('multer');var util=require(_0x51df('0x0'));var path=require(_0x51df('0x1'));var timeout=require(_0x51df('0x2'));var express=require(_0x51df('0x3'));var router=express[_0x51df('0x4')]();var fs_extra=require(_0x51df('0x5'));var auth=require(_0x51df('0x6'));var interaction=require(_0x51df('0x7'));var config=require(_0x51df('0x8'));var controller=require(_0x51df('0x9'));router[_0x51df('0xa')]('/',auth['isAuthenticated'](),controller[_0x51df('0xb')]);router[_0x51df('0xa')](_0x51df('0xc'),auth[_0x51df('0xd')](),controller[_0x51df('0xe')]);router[_0x51df('0xa')](_0x51df('0xf'),auth[_0x51df('0xd')](),controller['show']);router[_0x51df('0xa')](_0x51df('0x10'),auth[_0x51df('0xd')](),controller['getMembers']);router[_0x51df('0xa')](_0x51df('0x11'),auth[_0x51df('0xd')](),controller[_0x51df('0x12')]);router['get'](_0x51df('0x13'),auth[_0x51df('0xd')](),controller[_0x51df('0x14')]);router[_0x51df('0x15')]('/',auth['isAuthenticated'](),controller[_0x51df('0x16')]);router[_0x51df('0x15')]('/:id/teams',auth[_0x51df('0xd')](),controller[_0x51df('0x17')]);router[_0x51df('0x15')](_0x51df('0x13'),auth['isAuthenticated'](),controller[_0x51df('0x18')]);router['put'](_0x51df('0xf'),auth[_0x51df('0xd')](),controller[_0x51df('0x19')]);router[_0x51df('0x1a')](_0x51df('0xf'),auth['isAuthenticated'](),controller[_0x51df('0x1b')]);router['delete'](_0x51df('0x11'),auth[_0x51df('0xd')](),controller[_0x51df('0x1c')]);router[_0x51df('0x1a')](_0x51df('0x13'),auth[_0x51df('0xd')](),controller['removeAgents']);module[_0x51df('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b33d283..a8a0aae 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 _0x6ea3=['ENUM','beepall','roundrobin','sequelize','STRING'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x6ea3,0x17a));var _0x36ea=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x6ea3[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x36ea('0x0'));module['exports']={'name':{'type':Sequelize[_0x36ea('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x36ea('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36ea('0x2')]('rrmemory',_0x36ea('0x3'),_0x36ea('0x4'))}}; \ No newline at end of file +var _0x5135=['STRING','name','INTEGER','roundrobin','sequelize','exports'];(function(_0x2ef57c,_0x32cfd6){var _0x3ce380=function(_0x1eb283){while(--_0x1eb283){_0x2ef57c['push'](_0x2ef57c['shift']());}};_0x3ce380(++_0x32cfd6);}(_0x5135,0x88));var _0x5513=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x5135[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require(_0x5513('0x0'));module[_0x5513('0x1')]={'name':{'type':Sequelize[_0x5513('0x2')],'unique':_0x5513('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5513('0x2')]},'timeout':{'type':Sequelize[_0x5513('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x5513('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cd7eb3a..35db72b 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 _0xd484=['includeAll','include','findAll','catch','show','find','create','body','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','openchannelPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','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/license/util','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelQueue'];(function(_0x5108bf,_0x1e9b2a){var _0x343c7e=function(_0xebcba1){while(--_0xebcba1){_0x5108bf['push'](_0x5108bf['shift']());}};_0x343c7e(++_0x1e9b2a);}(_0xd484,0x1dc));var _0x4d48=function(_0x162be5,_0x4140aa){_0x162be5=_0x162be5-0x0;var _0x271150=_0xd484[_0x162be5];return _0x271150;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d48('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d48('0x1'));var rp=require(_0x4d48('0x2'));var moment=require('moment');var BPromise=require(_0x4d48('0x3'));var Mustache=require(_0x4d48('0x4'));var util=require(_0x4d48('0x5'));var path=require(_0x4d48('0x6'));var sox=require('sox');var csv=require(_0x4d48('0x7'));var ejs=require(_0x4d48('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d48('0x9'));var squel=require(_0x4d48('0xa'));var crypto=require(_0x4d48('0xb'));var jsforce=require(_0x4d48('0xc'));var deskjs=require(_0x4d48('0xd'));var toCsv=require(_0x4d48('0x7'));var querystring=require(_0x4d48('0xe'));var Papa=require(_0x4d48('0xf'));var Redis=require(_0x4d48('0x10'));var authService=require(_0x4d48('0x11'));var qs=require(_0x4d48('0x12'));var as=require(_0x4d48('0x13'));var hardwareService=require(_0x4d48('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d48('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4d48('0x16')](config[_0x4d48('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d48('0x18'))(new Redis(config[_0x4d48('0x17')]));require(_0x4d48('0x19'))[_0x4d48('0x1a')](socket);function respondWithStatusCode(_0x3c993a,_0x4b7b0f){_0x4b7b0f=_0x4b7b0f||0xcc;return function(_0x1d90da){if(_0x1d90da){return _0x3c993a['sendStatus'](_0x4b7b0f);}return _0x3c993a[_0x4d48('0x1b')](_0x4b7b0f)[_0x4d48('0x1c')]();};}function respondWithResult(_0x5ac522,_0x5ee8e8){_0x5ee8e8=_0x5ee8e8||0xc8;return function(_0x2e048b){if(_0x2e048b){return _0x5ac522[_0x4d48('0x1b')](_0x5ee8e8)[_0x4d48('0x1d')](_0x2e048b);}};}function respondWithFilteredResult(_0x2616de,_0x16de41){return function(_0xa4cfc6){if(_0xa4cfc6){var _0x51dfbd=typeof _0x16de41[_0x4d48('0x1e')]===_0x4d48('0x1f')&&typeof _0x16de41[_0x4d48('0x20')]===_0x4d48('0x1f');var _0x468843=_0xa4cfc6['count'];var _0x2507dd=_0x51dfbd?0x0:_0x16de41['offset'];var _0x1f8843=_0x51dfbd?_0xa4cfc6[_0x4d48('0x21')]:_0x16de41[_0x4d48('0x1e')]+_0x16de41[_0x4d48('0x20')];var _0x4a100a;if(_0x1f8843>=_0x468843){_0x1f8843=_0x468843;_0x4a100a=0xc8;}else{_0x4a100a=0xce;}_0x2616de[_0x4d48('0x1b')](_0x4a100a);return _0x2616de['set'](_0x4d48('0x22'),_0x2507dd+'-'+_0x1f8843+'/'+_0x468843)['json'](_0xa4cfc6);}return null;};}function patchUpdates(_0x185fcf){return function(_0xe9b2b3){try{jsonpatch['apply'](_0xe9b2b3,_0x185fcf,!![]);}catch(_0x130e76){return BPromise['reject'](_0x130e76);}return _0xe9b2b3[_0x4d48('0x23')]();};}function saveUpdates(_0x25a751,_0x289c36){return function(_0x183cff){if(_0x183cff){return _0x183cff[_0x4d48('0x24')](_0x25a751)[_0x4d48('0x25')](function(_0xd34362){return _0xd34362;});}return null;};}function removeEntity(_0x305ecf,_0x27e3d7){return function(_0x5e3266){if(_0x5e3266){return _0x5e3266[_0x4d48('0x26')]()[_0x4d48('0x25')](function(){var _0x10aac0=_0x5e3266['get']({'plain':!![]});var _0x3f471f=_0x4d48('0x27');return db[_0x4d48('0x28')]['destroy']({'where':{'type':_0x3f471f,'resourceId':_0x10aac0['id']}})['then'](function(){return _0x5e3266;});})[_0x4d48('0x25')](function(){_0x305ecf[_0x4d48('0x1b')](0xcc)[_0x4d48('0x1c')]();});}};}function handleEntityNotFound(_0x5e9eaa,_0x43f45f){return function(_0x2381b9){if(!_0x2381b9){_0x5e9eaa[_0x4d48('0x29')](0x194);}return _0x2381b9;};}function handleError(_0x1f945b,_0x469b58){_0x469b58=_0x469b58||0x1f4;return function(_0x3edfb2){logger['error'](_0x3edfb2['stack']);if(_0x3edfb2[_0x4d48('0x2a')]){delete _0x3edfb2[_0x4d48('0x2a')];}_0x1f945b[_0x4d48('0x1b')](_0x469b58)[_0x4d48('0x2b')](_0x3edfb2);};}exports[_0x4d48('0x2c')]=function(_0x5ab7cc,_0x2c3fec){var _0x58df99={},_0x56f86f={},_0x408580={'count':0x0,'rows':[]};var _0x5b54e2=_['map'](db['OpenchannelQueue'][_0x4d48('0x2d')],function(_0x211bf2){return{'name':_0x211bf2['fieldName'],'type':_0x211bf2[_0x4d48('0x2e')][_0x4d48('0x2f')]};});_0x56f86f['model']=_[_0x4d48('0x30')](_0x5b54e2,_0x4d48('0x2a'));_0x56f86f['query']=_[_0x4d48('0x31')](_0x5ab7cc[_0x4d48('0x32')]);_0x56f86f['filters']=_[_0x4d48('0x33')](_0x56f86f[_0x4d48('0x34')],_0x56f86f[_0x4d48('0x32')]);_0x58df99[_0x4d48('0x35')]=_[_0x4d48('0x33')](_0x56f86f[_0x4d48('0x34')],qs[_0x4d48('0x36')](_0x5ab7cc['query']['fields']));_0x58df99[_0x4d48('0x35')]=_0x58df99[_0x4d48('0x35')][_0x4d48('0x37')]?_0x58df99['attributes']:_0x56f86f[_0x4d48('0x34')];if(!_0x5ab7cc[_0x4d48('0x32')][_0x4d48('0x38')](_0x4d48('0x39'))){_0x58df99[_0x4d48('0x20')]=qs[_0x4d48('0x20')](_0x5ab7cc[_0x4d48('0x32')][_0x4d48('0x20')]);_0x58df99[_0x4d48('0x1e')]=qs[_0x4d48('0x1e')](_0x5ab7cc[_0x4d48('0x32')][_0x4d48('0x1e')]);}_0x58df99[_0x4d48('0x3a')]=qs['sort'](_0x5ab7cc[_0x4d48('0x32')][_0x4d48('0x3b')]);_0x58df99[_0x4d48('0x3c')]=qs[_0x4d48('0x3d')](_[_0x4d48('0x3e')](_0x5ab7cc[_0x4d48('0x32')],_0x56f86f[_0x4d48('0x3d')]),_0x5b54e2);if(_0x5ab7cc['query'][_0x4d48('0x3f')]){_0x58df99['where']=_[_0x4d48('0x40')](_0x58df99['where'],{'$or':_[_0x4d48('0x30')](_0x5b54e2,function(_0x442e51){if(_0x442e51['type']!==_0x4d48('0x41')){var _0x520284={};_0x520284[_0x442e51[_0x4d48('0x2a')]]={'$like':'%'+_0x5ab7cc[_0x4d48('0x32')][_0x4d48('0x3f')]+'%'};return _0x520284;}})});}_0x58df99=_[_0x4d48('0x40')]({},_0x58df99,_0x5ab7cc[_0x4d48('0x42')]);var _0x5f0f27={'where':_0x58df99[_0x4d48('0x3c')]};return db[_0x4d48('0x43')][_0x4d48('0x21')](_0x5f0f27)[_0x4d48('0x25')](function(_0x454a12){_0x408580['count']=_0x454a12;if(_0x5ab7cc[_0x4d48('0x32')][_0x4d48('0x44')]){_0x58df99[_0x4d48('0x45')]=[{'all':!![]}];}return db[_0x4d48('0x43')][_0x4d48('0x46')](_0x58df99);})[_0x4d48('0x25')](function(_0x2db97d){_0x408580['rows']=_0x2db97d;return _0x408580;})[_0x4d48('0x25')](respondWithFilteredResult(_0x2c3fec,_0x58df99))[_0x4d48('0x47')](handleError(_0x2c3fec,null));};exports[_0x4d48('0x48')]=function(_0xee94da,_0x47fecb){var _0x53ecbd={'raw':!![],'where':{'id':_0xee94da['params']['id']}},_0x1fc569={};_0x1fc569[_0x4d48('0x34')]=_[_0x4d48('0x31')](db[_0x4d48('0x43')][_0x4d48('0x2d')]);_0x1fc569[_0x4d48('0x32')]=_[_0x4d48('0x31')](_0xee94da[_0x4d48('0x32')]);_0x1fc569[_0x4d48('0x3d')]=_[_0x4d48('0x33')](_0x1fc569[_0x4d48('0x34')],_0x1fc569[_0x4d48('0x32')]);_0x53ecbd[_0x4d48('0x35')]=_[_0x4d48('0x33')](_0x1fc569[_0x4d48('0x34')],qs[_0x4d48('0x36')](_0xee94da[_0x4d48('0x32')]['fields']));_0x53ecbd[_0x4d48('0x35')]=_0x53ecbd[_0x4d48('0x35')][_0x4d48('0x37')]?_0x53ecbd['attributes']:_0x1fc569[_0x4d48('0x34')];if(_0xee94da[_0x4d48('0x32')]['includeAll']){_0x53ecbd[_0x4d48('0x45')]=[{'all':!![]}];}_0x53ecbd=_[_0x4d48('0x40')]({},_0x53ecbd,_0xee94da['options']);return db[_0x4d48('0x43')][_0x4d48('0x49')](_0x53ecbd)[_0x4d48('0x25')](handleEntityNotFound(_0x47fecb,null))[_0x4d48('0x25')](respondWithResult(_0x47fecb,null))[_0x4d48('0x47')](handleError(_0x47fecb,null));};exports[_0x4d48('0x4a')]=function(_0x350e71,_0x41075c){return db['OpenchannelQueue'][_0x4d48('0x4a')](_0x350e71[_0x4d48('0x4b')],{})[_0x4d48('0x25')](function(_0x376ea4){var _0x3c1075=_0x350e71[_0x4d48('0x4c')][_0x4d48('0x4d')]({'plain':!![]});if(!_0x3c1075)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c1075[_0x4d48('0x4e')]===_0x4d48('0x4c')){var _0x1557e1=_0x376ea4['get']({'plain':!![]});var _0x10a3d1='OpenchannelQueues';return db['UserProfileSection'][_0x4d48('0x49')]({'where':{'name':_0x10a3d1,'userProfileId':_0x3c1075[_0x4d48('0x4f')]},'raw':!![]})[_0x4d48('0x25')](function(_0x62d232){if(_0x62d232&&_0x62d232[_0x4d48('0x50')]===0x0){return db[_0x4d48('0x28')]['create']({'name':_0x1557e1['name'],'resourceId':_0x1557e1['id'],'type':_0x62d232['name'],'sectionId':_0x62d232['id']},{})['then'](function(){return _0x376ea4;});}else{return _0x376ea4;}})['catch'](function(_0x298b18){logger[_0x4d48('0x51')](_0x4d48('0x52'),_0x298b18);throw _0x298b18;});}return _0x376ea4;})[_0x4d48('0x25')](respondWithResult(_0x41075c,0xc9))[_0x4d48('0x47')](handleError(_0x41075c,null));};exports['update']=function(_0x1bbfe6,_0x200563){if(_0x1bbfe6[_0x4d48('0x4b')]['id']){delete _0x1bbfe6[_0x4d48('0x4b')]['id'];}return db[_0x4d48('0x43')][_0x4d48('0x49')]({'where':{'id':_0x1bbfe6[_0x4d48('0x53')]['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x200563,null))[_0x4d48('0x25')](saveUpdates(_0x1bbfe6[_0x4d48('0x4b')],null))['then'](respondWithResult(_0x200563,null))[_0x4d48('0x47')](handleError(_0x200563,null));};exports[_0x4d48('0x26')]=function(_0x465e3b,_0x19fb3e){return db[_0x4d48('0x43')]['find']({'where':{'id':_0x465e3b['params']['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x19fb3e,null))[_0x4d48('0x25')](removeEntity(_0x19fb3e,null))[_0x4d48('0x47')](handleError(_0x19fb3e,null));};exports[_0x4d48('0x54')]=function(_0x51719e,_0x3ad739){return db[_0x4d48('0x43')][_0x4d48('0x54')]()[_0x4d48('0x25')](respondWithResult(_0x3ad739,null))['catch'](handleError(_0x3ad739,null));};exports['getMembers']=function(_0x2b093d,_0x12873f,_0x5ce5ea){var _0x292c49={'raw':!![],'where':{}},_0x50c250={},_0x366901;return db[_0x4d48('0x43')][_0x4d48('0x55')]({'where':{'id':_0x2b093d[_0x4d48('0x53')]['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x12873f,null))[_0x4d48('0x25')](function(_0x2f828a){if(_0x2f828a){_0x366901=_0x2f828a[_0x4d48('0x4d')]({'plain':!![]});_0x50c250[_0x4d48('0x34')]=_[_0x4d48('0x31')](db[_0x4d48('0x56')][_0x4d48('0x2d')]);_0x50c250[_0x4d48('0x32')]=_[_0x4d48('0x31')](_0x2b093d[_0x4d48('0x32')]);_0x50c250[_0x4d48('0x3d')]=_['intersection'](_0x50c250[_0x4d48('0x34')],_0x50c250['query']);_0x292c49[_0x4d48('0x35')]=_[_0x4d48('0x33')](_0x50c250[_0x4d48('0x34')],qs['fields'](_0x2b093d['query'][_0x4d48('0x36')]));_0x292c49[_0x4d48('0x35')]=_0x292c49[_0x4d48('0x35')][_0x4d48('0x37')]?_0x292c49[_0x4d48('0x35')]:_0x50c250[_0x4d48('0x34')];if(!_0x2b093d[_0x4d48('0x32')][_0x4d48('0x38')](_0x4d48('0x39'))){_0x292c49['limit']=qs[_0x4d48('0x20')](_0x2b093d[_0x4d48('0x32')][_0x4d48('0x20')]);_0x292c49['offset']=qs[_0x4d48('0x1e')](_0x2b093d[_0x4d48('0x32')][_0x4d48('0x1e')]);}_0x292c49['order']=qs[_0x4d48('0x3b')](_0x2b093d[_0x4d48('0x32')][_0x4d48('0x3b')]);_0x292c49[_0x4d48('0x3c')]=qs['filters'](_[_0x4d48('0x3e')](_0x2b093d[_0x4d48('0x32')],_0x50c250[_0x4d48('0x3d')]));_0x292c49[_0x4d48('0x3c')][_0x4d48('0x57')]=_0x2f828a['id'];if(_0x2b093d[_0x4d48('0x32')][_0x4d48('0x3f')]){_0x292c49[_0x4d48('0x3c')]=_['merge'](_0x292c49[_0x4d48('0x3c')],{'$or':_[_0x4d48('0x30')](_0x292c49['attributes'],function(_0x428485){var _0x10030b={};_0x10030b[_0x428485]={'$like':'%'+_0x2b093d[_0x4d48('0x32')][_0x4d48('0x3f')]+'%'};return _0x10030b;})});}_0x292c49=_['merge']({},_0x292c49,_0x2b093d['options']);return db[_0x4d48('0x56')]['findAll'](_0x292c49);}})[_0x4d48('0x25')](function(_0x1f4ebd){if(_0x1f4ebd){return db[_0x4d48('0x58')]['findAndCountAll']({'where':{'id':_[_0x4d48('0x30')](_0x1f4ebd,'UserId'),'role':'agent'},'attributes':['id',_0x4d48('0x2a'),_0x4d48('0x59'),_0x4d48('0x5a'),_0x4d48('0x5b')]});}})[_0x4d48('0x25')](function(_0x37b3be){if(_0x37b3be){return{'count':_0x37b3be[_0x4d48('0x21')],'rows':_['map'](_0x37b3be[_0x4d48('0x5c')],function(_0xc30d29){return{'membername':_0xc30d29[_0x4d48('0x2a')],'UserId':_0xc30d29['id'],'queue_name':_0x366901['name'],'OpenchannelQueueId':_0x366901['id'],'interface':util[_0x4d48('0x5d')]('%s/%s',_0x4d48('0x5e'),_0xc30d29[_0x4d48('0x2a')]),'penalty':0x0,'paused':_0xc30d29[_0x4d48('0x59')],'createdAt':_0xc30d29[_0x4d48('0x5b')],'updatedAt':_0xc30d29[_0x4d48('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4d48('0x25')](respondWithFilteredResult(_0x12873f,_0x292c49))[_0x4d48('0x47')](handleError(_0x12873f,null));};exports[_0x4d48('0x5f')]=function(_0x459a29,_0x9f06ff,_0x187bdd){var _0x1b09f7={};var _0x17a6a0={};var _0xc1c2d2;var _0x26137c;return db[_0x4d48('0x43')][_0x4d48('0x55')]({'where':{'id':_0x459a29[_0x4d48('0x53')]['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x9f06ff,null))[_0x4d48('0x25')](function(_0x15fe76){if(_0x15fe76){_0xc1c2d2=_0x15fe76;_0x17a6a0['model']=_[_0x4d48('0x31')](db[_0x4d48('0x60')]['rawAttributes']);_0x17a6a0[_0x4d48('0x32')]=_['keys'](_0x459a29['query']);_0x17a6a0[_0x4d48('0x3d')]=_[_0x4d48('0x33')](_0x17a6a0[_0x4d48('0x34')],_0x17a6a0[_0x4d48('0x32')]);_0x1b09f7[_0x4d48('0x35')]=_[_0x4d48('0x33')](_0x17a6a0[_0x4d48('0x34')],qs[_0x4d48('0x36')](_0x459a29[_0x4d48('0x32')][_0x4d48('0x36')]));_0x1b09f7[_0x4d48('0x35')]=_0x1b09f7[_0x4d48('0x35')][_0x4d48('0x37')]?_0x1b09f7[_0x4d48('0x35')]:_0x17a6a0[_0x4d48('0x34')];_0x1b09f7[_0x4d48('0x3a')]=qs[_0x4d48('0x3b')](_0x459a29[_0x4d48('0x32')][_0x4d48('0x3b')]);_0x1b09f7[_0x4d48('0x3c')]=qs[_0x4d48('0x3d')](_['pick'](_0x459a29[_0x4d48('0x32')],_0x17a6a0[_0x4d48('0x3d')]));if(_0x459a29[_0x4d48('0x32')][_0x4d48('0x3f')]){_0x1b09f7[_0x4d48('0x3c')]=_[_0x4d48('0x40')](_0x1b09f7['where'],{'$or':_[_0x4d48('0x30')](_0x1b09f7[_0x4d48('0x35')],function(_0x19ec96){var _0x2482f9={};_0x2482f9[_0x19ec96]={'$like':'%'+_0x459a29['query'][_0x4d48('0x3f')]+'%'};return _0x2482f9;})});}_0x1b09f7=_[_0x4d48('0x40')]({},_0x1b09f7,_0x459a29['options']);return _0xc1c2d2['getTeams'](_0x1b09f7);}})['then'](function(_0x1cfcb9){if(_0x1cfcb9){_0x26137c=_0x1cfcb9[_0x4d48('0x37')];if(!_0x459a29[_0x4d48('0x32')][_0x4d48('0x38')](_0x4d48('0x39'))){_0x1b09f7[_0x4d48('0x20')]=qs[_0x4d48('0x20')](_0x459a29[_0x4d48('0x32')][_0x4d48('0x20')]);_0x1b09f7['offset']=qs['offset'](_0x459a29['query'][_0x4d48('0x1e')]);}return _0xc1c2d2[_0x4d48('0x5f')](_0x1b09f7);}})['then'](function(_0x3bb9f1){if(_0x3bb9f1){return _0x3bb9f1?{'count':_0x26137c,'rows':_0x3bb9f1}:null;}})['then'](respondWithResult(_0x9f06ff,null))['catch'](handleError(_0x9f06ff,null));};exports[_0x4d48('0x61')]=function(_0x434baa,_0x2cc808,_0x1725cc){var _0x5ef035=_0x434baa[_0x4d48('0x4b')][_0x4d48('0x62')];return db[_0x4d48('0x60')][_0x4d48('0x46')]({'where':{'id':_0x5ef035},'attributes':['id'],'include':[{'model':db[_0x4d48('0x58')],'as':_0x4d48('0x63'),'attributes':['id',_0x4d48('0x2a'),_0x4d48('0x64'),_0x4d48('0x65'),_0x4d48('0x66')],'raw':!![]}]})['then'](function(_0x1e08df){if(_0x1e08df){var _0x4dcbe0=_['flatMap'](_0x1e08df,function(_0x5d7e6c){var _0x4bf4ff=_0x5d7e6c['get']({'plain':!![]});return _0x4bf4ff[_0x4d48('0x63')];});return db[_0x4d48('0x43')][_0x4d48('0x49')]({'where':{'id':_0x434baa['params']['id']}})[_0x4d48('0x25')](function(_0xc7d1ba){return db[_0x4d48('0x67')][_0x4d48('0x68')](function(_0x5bd126){return _0xc7d1ba[_0x4d48('0x61')](_0x5ef035,{'transaction':_0x5bd126})[_0x4d48('0x25')](function(){return BPromise[_0x4d48('0x69')](_0x4dcbe0,function(_0x3cd091){return db[_0x4d48('0x56')][_0x4d48('0x6a')]({'where':{'UserId':_0x3cd091['id'],'OpenchannelQueueId':_0x434baa[_0x4d48('0x53')]['id']},'transaction':_0x5bd126});});})[_0x4d48('0x25')](function(){_0x4dcbe0[_0x4d48('0x6b')](function(_0x1c3b03){socket['emit'](_0x4d48('0x6c'),{'UserId':_0x1c3b03['id'],'OpenchannelQueueId':_0xc7d1ba['id']});});});});});}})[_0x4d48('0x25')](respondWithStatusCode(_0x2cc808,null))[_0x4d48('0x47')](handleError(_0x2cc808,null));};exports[_0x4d48('0x6d')]=function(_0x3b12f7,_0x431426,_0x39552f){return db[_0x4d48('0x60')]['findAll']({'where':{'id':_0x3b12f7[_0x4d48('0x32')][_0x4d48('0x62')]},'attributes':['id'],'include':[{'model':db[_0x4d48('0x58')],'as':_0x4d48('0x63'),'attributes':['id'],'raw':!![]}]})[_0x4d48('0x25')](handleEntityNotFound(_0x431426,null))[_0x4d48('0x25')](function(_0x5ef58c){var _0x5563a9=_[_0x4d48('0x30')](_0x5ef58c,'id');var _0x4d0133=[];var _0x35154d=[];var _0x5ec56b=squel[_0x4d48('0x6e')]();_0x5ec56b[_0x4d48('0x6f')](_0x4d48('0x70'))[_0x4d48('0x71')](_0x4d48('0x72'),'tq')[_0x4d48('0x73')](_0x4d48('0x74'),'ut',_0x4d48('0x75'))[_0x4d48('0x3c')]('OpenchannelQueueId\x20=\x20?',_0x3b12f7[_0x4d48('0x53')]['id']);for(var _0x2b3feb=0x0;_0x2b3feb<_0x5ef58c[_0x4d48('0x37')];_0x2b3feb+=0x1){let _0x161b4b=_0x5ef58c[_0x2b3feb];for(var _0x2054a8=0x0;_0x2054a8<_0x161b4b[_0x4d48('0x63')][_0x4d48('0x37')];_0x2054a8+=0x1){let _0xdae1eb=_0x161b4b[_0x4d48('0x63')][_0x2054a8];var _0x591472=_0x5ec56b['clone']();_0x591472[_0x4d48('0x3c')](_0x4d48('0x76'),_0xdae1eb['id']);_0x35154d[_0x4d48('0x77')](db[_0x4d48('0x67')]['query'](_0x591472[_0x4d48('0x78')](),{'type':db[_0x4d48('0x67')][_0x4d48('0x79')][_0x4d48('0x7a')]})[_0x4d48('0x25')](function(_0x10c53c){if(_0x10c53c[_0x4d48('0x37')]===0x1){return _0xdae1eb['id'];}else{var _0x425eff=_['every'](_[_0x4d48('0x30')](_0x10c53c,_0x4d48('0x7b')),function(_0x20499d){return _[_0x4d48('0x7c')](_0x5563a9,_0x20499d);});if(_0x425eff){return _0xdae1eb['id'];}}}));}}return BPromise['all'](_0x35154d)[_0x4d48('0x25')](function(_0x2f67a6){_0x4d0133=_(_0x4d0133)[_0x4d48('0x7d')](_0x2f67a6)[_0x4d48('0x7e')]()[_0x4d48('0x7f')]();return db[_0x4d48('0x43')][_0x4d48('0x49')]({'where':{'id':_0x3b12f7['params']['id']}})[_0x4d48('0x25')](function(_0x4aea5a){return db['sequelize'][_0x4d48('0x68')](function(_0x5f3850){return _0x4aea5a[_0x4d48('0x6d')](_0x3b12f7[_0x4d48('0x32')]['ids'],{'transaction':_0x5f3850})[_0x4d48('0x25')](function(){if(!_[_0x4d48('0x80')](_0x4d0133)){return _0x4aea5a[_0x4d48('0x81')](_0x4d0133,{'transaction':_0x5f3850});}})['then'](function(){_0x4d0133['forEach'](function(_0x2d977b){socket[_0x4d48('0x82')](_0x4d48('0x83'),{'UserId':_0x2d977b,'OpenchannelQueueId':_0x4aea5a['id']});});});});});});})[_0x4d48('0x25')](respondWithStatusCode(_0x431426,null))[_0x4d48('0x47')](handleError(_0x431426,null));};exports['addAgents']=function(_0x3b8def,_0x36a4a8,_0x3a54f9){return db[_0x4d48('0x43')][_0x4d48('0x49')]({'where':{'id':_0x3b8def['params']['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x36a4a8,null))['then'](function(_0x1e42de){if(_0x1e42de){return _0x1e42de['addAgents'](_0x3b8def['body']['ids'],_[_0x4d48('0x84')](_0x3b8def[_0x4d48('0x4b')],[_0x4d48('0x62'),'id'])||{})[_0x4d48('0x85')](function(_0x33db15){for(var _0x35e6fc=0x0;_0x35e6fc<_0x3b8def[_0x4d48('0x4b')][_0x4d48('0x62')][_0x4d48('0x37')];_0x35e6fc+=0x1){socket['emit'](_0x4d48('0x6c'),{'UserId':Number(_0x3b8def[_0x4d48('0x4b')][_0x4d48('0x62')][_0x35e6fc]),'OpenchannelQueueId':Number(_0x3b8def[_0x4d48('0x53')]['id'])});}return _0x33db15;});}})['then'](respondWithResult(_0x36a4a8,null))[_0x4d48('0x47')](handleError(_0x36a4a8,null));};exports['removeAgents']=function(_0x4dffeb,_0x36d4d2,_0x873aaf){return db[_0x4d48('0x43')]['find']({'where':{'id':_0x4dffeb['params']['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x36d4d2,null))['then'](function(_0x194ef4){if(_0x194ef4){return _0x194ef4[_0x4d48('0x81')](_0x4dffeb[_0x4d48('0x32')]['ids'])[_0x4d48('0x25')](function(){if(_[_0x4d48('0x86')](_0x4dffeb[_0x4d48('0x32')][_0x4d48('0x62')])){for(var _0x28ce32=0x0;_0x28ce32<_0x4dffeb[_0x4d48('0x32')][_0x4d48('0x62')]['length'];_0x28ce32+=0x1){socket[_0x4d48('0x82')](_0x4d48('0x83'),{'UserId':Number(_0x4dffeb[_0x4d48('0x32')][_0x4d48('0x62')][_0x28ce32]),'OpenchannelQueueId':Number(_0x4dffeb['params']['id'])});}}else{socket[_0x4d48('0x82')](_0x4d48('0x83'),{'UserId':Number(_0x4dffeb[_0x4d48('0x32')][_0x4d48('0x62')]),'OpenchannelQueueId':Number(_0x4dffeb[_0x4d48('0x53')]['id'])});}});}})[_0x4d48('0x25')](respondWithStatusCode(_0x36d4d2,null))[_0x4d48('0x47')](handleError(_0x36d4d2,null));};exports['getAgents']=function(_0x12c0b8,_0x2c0d26,_0x182359){var _0x5a074c={};var _0x5c0496={};var _0x49125a;var _0x670e3b;return db[_0x4d48('0x43')][_0x4d48('0x55')]({'where':{'id':_0x12c0b8[_0x4d48('0x53')]['id']}})['then'](handleEntityNotFound(_0x2c0d26,null))[_0x4d48('0x25')](function(_0x2a7d13){if(_0x2a7d13){_0x49125a=_0x2a7d13;_0x5c0496[_0x4d48('0x34')]=_[_0x4d48('0x31')](db['User'][_0x4d48('0x2d')]);_0x5c0496[_0x4d48('0x32')]=_[_0x4d48('0x31')](_0x12c0b8[_0x4d48('0x32')]);_0x5c0496[_0x4d48('0x3d')]=_[_0x4d48('0x33')](_0x5c0496['model'],_0x5c0496['query']);_0x5a074c[_0x4d48('0x35')]=_[_0x4d48('0x33')](_0x5c0496[_0x4d48('0x34')],qs[_0x4d48('0x36')](_0x12c0b8['query'][_0x4d48('0x36')]));_0x5a074c[_0x4d48('0x35')]=_0x5a074c[_0x4d48('0x35')][_0x4d48('0x37')]?_0x5a074c[_0x4d48('0x35')]:_0x5c0496[_0x4d48('0x34')];_0x5a074c['order']=qs[_0x4d48('0x3b')](_0x12c0b8[_0x4d48('0x32')][_0x4d48('0x3b')]);_0x5a074c[_0x4d48('0x3c')]=qs['filters'](_[_0x4d48('0x3e')](_0x12c0b8[_0x4d48('0x32')],_0x5c0496[_0x4d48('0x3d')]));if(_0x12c0b8[_0x4d48('0x32')]['filter']){_0x5a074c[_0x4d48('0x3c')]=_[_0x4d48('0x40')](_0x5a074c[_0x4d48('0x3c')],{'$or':_[_0x4d48('0x30')](_0x5a074c[_0x4d48('0x35')],function(_0x1559b8){var _0x40c841={};_0x40c841[_0x1559b8]={'$like':'%'+_0x12c0b8['query'][_0x4d48('0x3f')]+'%'};return _0x40c841;})});}_0x5a074c=_[_0x4d48('0x40')]({},_0x5a074c,_0x12c0b8[_0x4d48('0x42')]);return _0x49125a[_0x4d48('0x87')](_0x5a074c);}})[_0x4d48('0x25')](function(_0x431556){if(_0x431556){_0x670e3b=_0x431556[_0x4d48('0x37')];if(!_0x12c0b8[_0x4d48('0x32')][_0x4d48('0x38')](_0x4d48('0x39'))){_0x5a074c['limit']=qs[_0x4d48('0x20')](_0x12c0b8['query'][_0x4d48('0x20')]);_0x5a074c[_0x4d48('0x1e')]=qs[_0x4d48('0x1e')](_0x12c0b8[_0x4d48('0x32')][_0x4d48('0x1e')]);}return _0x49125a[_0x4d48('0x87')](_0x5a074c);}})[_0x4d48('0x25')](function(_0x22e339){if(_0x22e339){return _0x22e339?{'count':_0x670e3b,'rows':_0x22e339}:null;}})[_0x4d48('0x25')](respondWithResult(_0x2c0d26,null))[_0x4d48('0x47')](handleError(_0x2c0d26,null));}; \ No newline at end of file +var _0x5781=['OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','ids','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','redis','localhost','./openchannelQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','OpenchannelQueues','sendStatus','error','stack','name','OpenchannelQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','find','catch','create','body','user','get','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','format','%s/%s','getTeams','Team','options','addTeams','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x563978,_0x409b8a){var _0x57b03f=function(_0x26808f){while(--_0x26808f){_0x563978['push'](_0x563978['shift']());}};_0x57b03f(++_0x409b8a);}(_0x5781,0xa9));var _0x1578=function(_0x28c4cc,_0x146edc){_0x28c4cc=_0x28c4cc-0x0;var _0x11f626=_0x5781[_0x28c4cc];return _0x11f626;};'use strict';var emlformat=require(_0x1578('0x0'));var rimraf=require(_0x1578('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1578('0x2'));var rp=require('request-promise');var moment=require(_0x1578('0x3'));var BPromise=require(_0x1578('0x4'));var Mustache=require(_0x1578('0x5'));var util=require(_0x1578('0x6'));var path=require(_0x1578('0x7'));var sox=require(_0x1578('0x8'));var csv=require(_0x1578('0x9'));var ejs=require(_0x1578('0xa'));var fs=require('fs');var fs_extra=require(_0x1578('0xb'));var _=require(_0x1578('0xc'));var squel=require('squel');var crypto=require(_0x1578('0xd'));var jsforce=require(_0x1578('0xe'));var deskjs=require(_0x1578('0xf'));var toCsv=require(_0x1578('0x9'));var querystring=require(_0x1578('0x10'));var Papa=require(_0x1578('0x11'));var Redis=require(_0x1578('0x12'));var authService=require(_0x1578('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1578('0x14'));var logger=require(_0x1578('0x15'))(_0x1578('0x16'));var utils=require(_0x1578('0x17'));var config=require(_0x1578('0x18'));var licenseUtil=require(_0x1578('0x19'));var db=require(_0x1578('0x1a'))['db'];config[_0x1578('0x1b')]=_['defaults'](config['redis'],{'host':_0x1578('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1578('0x1b')]));require(_0x1578('0x1d'))[_0x1578('0x1e')](socket);function respondWithStatusCode(_0x354f6a,_0x2a01b9){_0x2a01b9=_0x2a01b9||0xcc;return function(_0x5bffcd){if(_0x5bffcd){return _0x354f6a['sendStatus'](_0x2a01b9);}return _0x354f6a[_0x1578('0x1f')](_0x2a01b9)[_0x1578('0x20')]();};}function respondWithResult(_0x523778,_0x2b0136){_0x2b0136=_0x2b0136||0xc8;return function(_0x1844b9){if(_0x1844b9){return _0x523778[_0x1578('0x1f')](_0x2b0136)['json'](_0x1844b9);}};}function respondWithFilteredResult(_0x441d35,_0x4bab33){return function(_0x54383e){if(_0x54383e){var _0x2204cd=typeof _0x4bab33[_0x1578('0x21')]===_0x1578('0x22')&&typeof _0x4bab33[_0x1578('0x23')]===_0x1578('0x22');var _0x19c060=_0x54383e['count'];var _0x32eb1a=_0x2204cd?0x0:_0x4bab33['offset'];var _0x4ef6b1=_0x2204cd?_0x54383e[_0x1578('0x24')]:_0x4bab33[_0x1578('0x21')]+_0x4bab33[_0x1578('0x23')];var _0x219a69;if(_0x4ef6b1>=_0x19c060){_0x4ef6b1=_0x19c060;_0x219a69=0xc8;}else{_0x219a69=0xce;}_0x441d35['status'](_0x219a69);return _0x441d35[_0x1578('0x25')](_0x1578('0x26'),_0x32eb1a+'-'+_0x4ef6b1+'/'+_0x19c060)[_0x1578('0x27')](_0x54383e);}return null;};}function patchUpdates(_0x562fc6){return function(_0x36bd77){try{jsonpatch[_0x1578('0x28')](_0x36bd77,_0x562fc6,!![]);}catch(_0x38e605){return BPromise[_0x1578('0x29')](_0x38e605);}return _0x36bd77[_0x1578('0x2a')]();};}function saveUpdates(_0x521d4b,_0x3c5cfb){return function(_0x233ddb){if(_0x233ddb){return _0x233ddb[_0x1578('0x2b')](_0x521d4b)['then'](function(_0x42f1e2){return _0x42f1e2;});}return null;};}function removeEntity(_0x35e860,_0x20450c){return function(_0x1a88f6){if(_0x1a88f6){return _0x1a88f6[_0x1578('0x2c')]()[_0x1578('0x2d')](function(){var _0x4ab79f=_0x1a88f6['get']({'plain':!![]});var _0x212238=_0x1578('0x2e');return db['UserProfileResource'][_0x1578('0x2c')]({'where':{'type':_0x212238,'resourceId':_0x4ab79f['id']}})['then'](function(){return _0x1a88f6;});})[_0x1578('0x2d')](function(){_0x35e860['status'](0xcc)[_0x1578('0x20')]();});}};}function handleEntityNotFound(_0x2b0020,_0x34ed60){return function(_0x1c7677){if(!_0x1c7677){_0x2b0020[_0x1578('0x2f')](0x194);}return _0x1c7677;};}function handleError(_0x17f2ca,_0x31740f){_0x31740f=_0x31740f||0x1f4;return function(_0x49d1b6){logger[_0x1578('0x30')](_0x49d1b6[_0x1578('0x31')]);if(_0x49d1b6[_0x1578('0x32')]){delete _0x49d1b6['name'];}_0x17f2ca[_0x1578('0x1f')](_0x31740f)['send'](_0x49d1b6);};}exports['index']=function(_0x2f0bc7,_0x39193a){var _0x542539={},_0xf5a5ee={},_0x490719={'count':0x0,'rows':[]};var _0x83120e=_['map'](db[_0x1578('0x33')][_0x1578('0x34')],function(_0x2d193a){return{'name':_0x2d193a[_0x1578('0x35')],'type':_0x2d193a[_0x1578('0x36')]['key']};});_0xf5a5ee[_0x1578('0x37')]=_[_0x1578('0x38')](_0x83120e,_0x1578('0x32'));_0xf5a5ee[_0x1578('0x39')]=_[_0x1578('0x3a')](_0x2f0bc7[_0x1578('0x39')]);_0xf5a5ee[_0x1578('0x3b')]=_[_0x1578('0x3c')](_0xf5a5ee[_0x1578('0x37')],_0xf5a5ee[_0x1578('0x39')]);_0x542539[_0x1578('0x3d')]=_[_0x1578('0x3c')](_0xf5a5ee[_0x1578('0x37')],qs[_0x1578('0x3e')](_0x2f0bc7[_0x1578('0x39')][_0x1578('0x3e')]));_0x542539['attributes']=_0x542539[_0x1578('0x3d')][_0x1578('0x3f')]?_0x542539[_0x1578('0x3d')]:_0xf5a5ee[_0x1578('0x37')];if(!_0x2f0bc7[_0x1578('0x39')]['hasOwnProperty'](_0x1578('0x40'))){_0x542539[_0x1578('0x23')]=qs['limit'](_0x2f0bc7['query'][_0x1578('0x23')]);_0x542539['offset']=qs[_0x1578('0x21')](_0x2f0bc7[_0x1578('0x39')][_0x1578('0x21')]);}_0x542539[_0x1578('0x41')]=qs[_0x1578('0x42')](_0x2f0bc7[_0x1578('0x39')][_0x1578('0x42')]);_0x542539['where']=qs['filters'](_[_0x1578('0x43')](_0x2f0bc7['query'],_0xf5a5ee[_0x1578('0x3b')]),_0x83120e);if(_0x2f0bc7[_0x1578('0x39')][_0x1578('0x44')]){_0x542539[_0x1578('0x45')]=_[_0x1578('0x46')](_0x542539[_0x1578('0x45')],{'$or':_[_0x1578('0x38')](_0x83120e,function(_0x5aea57){if(_0x5aea57[_0x1578('0x36')]!==_0x1578('0x47')){var _0x38fac1={};_0x38fac1[_0x5aea57[_0x1578('0x32')]]={'$like':'%'+_0x2f0bc7[_0x1578('0x39')]['filter']+'%'};return _0x38fac1;}})});}_0x542539=_[_0x1578('0x46')]({},_0x542539,_0x2f0bc7['options']);var _0x10b4a8={'where':_0x542539['where']};return db['OpenchannelQueue'][_0x1578('0x24')](_0x10b4a8)[_0x1578('0x2d')](function(_0x1de493){_0x490719[_0x1578('0x24')]=_0x1de493;if(_0x2f0bc7[_0x1578('0x39')][_0x1578('0x48')]){_0x542539['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x1578('0x49')](_0x542539);})[_0x1578('0x2d')](function(_0x417c55){_0x490719[_0x1578('0x4a')]=_0x417c55;return _0x490719;})['then'](respondWithFilteredResult(_0x39193a,_0x542539))['catch'](handleError(_0x39193a,null));};exports[_0x1578('0x4b')]=function(_0x2e82c5,_0x44be31){var _0x5cfdd2={'raw':!![],'where':{'id':_0x2e82c5[_0x1578('0x4c')]['id']}},_0x3ec9f2={};_0x3ec9f2[_0x1578('0x37')]=_[_0x1578('0x3a')](db[_0x1578('0x33')]['rawAttributes']);_0x3ec9f2[_0x1578('0x39')]=_['keys'](_0x2e82c5['query']);_0x3ec9f2[_0x1578('0x3b')]=_[_0x1578('0x3c')](_0x3ec9f2['model'],_0x3ec9f2[_0x1578('0x39')]);_0x5cfdd2[_0x1578('0x3d')]=_['intersection'](_0x3ec9f2['model'],qs[_0x1578('0x3e')](_0x2e82c5[_0x1578('0x39')][_0x1578('0x3e')]));_0x5cfdd2[_0x1578('0x3d')]=_0x5cfdd2[_0x1578('0x3d')][_0x1578('0x3f')]?_0x5cfdd2[_0x1578('0x3d')]:_0x3ec9f2[_0x1578('0x37')];if(_0x2e82c5[_0x1578('0x39')][_0x1578('0x48')]){_0x5cfdd2['include']=[{'all':!![]}];}_0x5cfdd2=_['merge']({},_0x5cfdd2,_0x2e82c5['options']);return db[_0x1578('0x33')][_0x1578('0x4d')](_0x5cfdd2)[_0x1578('0x2d')](handleEntityNotFound(_0x44be31,null))['then'](respondWithResult(_0x44be31,null))[_0x1578('0x4e')](handleError(_0x44be31,null));};exports['create']=function(_0x48f8b2,_0x11aebe){return db[_0x1578('0x33')][_0x1578('0x4f')](_0x48f8b2[_0x1578('0x50')],{})[_0x1578('0x2d')](function(_0x1f9cb5){var _0x909516=_0x48f8b2[_0x1578('0x51')][_0x1578('0x52')]({'plain':!![]});if(!_0x909516)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x909516[_0x1578('0x53')]===_0x1578('0x51')){var _0x144ac2=_0x1f9cb5[_0x1578('0x52')]({'plain':!![]});var _0x30c5f4=_0x1578('0x2e');return db[_0x1578('0x54')][_0x1578('0x4d')]({'where':{'name':_0x30c5f4,'userProfileId':_0x909516['userProfileId']},'raw':!![]})[_0x1578('0x2d')](function(_0x1ceb18){if(_0x1ceb18&&_0x1ceb18['autoAssociation']===0x0){return db[_0x1578('0x55')][_0x1578('0x4f')]({'name':_0x144ac2[_0x1578('0x32')],'resourceId':_0x144ac2['id'],'type':_0x1ceb18['name'],'sectionId':_0x1ceb18['id']},{})['then'](function(){return _0x1f9cb5;});}else{return _0x1f9cb5;}})[_0x1578('0x4e')](function(_0x4b3c53){logger[_0x1578('0x30')](_0x1578('0x56'),_0x4b3c53);throw _0x4b3c53;});}return _0x1f9cb5;})[_0x1578('0x2d')](respondWithResult(_0x11aebe,0xc9))[_0x1578('0x4e')](handleError(_0x11aebe,null));};exports[_0x1578('0x2b')]=function(_0x238166,_0x164e3d){if(_0x238166[_0x1578('0x50')]['id']){delete _0x238166['body']['id'];}return db[_0x1578('0x33')][_0x1578('0x4d')]({'where':{'id':_0x238166[_0x1578('0x4c')]['id']}})[_0x1578('0x2d')](handleEntityNotFound(_0x164e3d,null))[_0x1578('0x2d')](saveUpdates(_0x238166[_0x1578('0x50')],null))['then'](respondWithResult(_0x164e3d,null))[_0x1578('0x4e')](handleError(_0x164e3d,null));};exports[_0x1578('0x2c')]=function(_0xe0c170,_0x1e4ec1){return db[_0x1578('0x33')][_0x1578('0x4d')]({'where':{'id':_0xe0c170[_0x1578('0x4c')]['id']}})[_0x1578('0x2d')](handleEntityNotFound(_0x1e4ec1,null))[_0x1578('0x2d')](removeEntity(_0x1e4ec1,null))[_0x1578('0x4e')](handleError(_0x1e4ec1,null));};exports['describe']=function(_0x513b92,_0x55e699){return db[_0x1578('0x33')]['describe']()['then'](respondWithResult(_0x55e699,null))['catch'](handleError(_0x55e699,null));};exports[_0x1578('0x57')]=function(_0x3056ed,_0x38e889,_0x2f8b9f){var _0x552414={'raw':!![],'where':{}},_0x8ebecf={},_0x43d8ab;return db[_0x1578('0x33')][_0x1578('0x58')]({'where':{'id':_0x3056ed[_0x1578('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38e889,null))[_0x1578('0x2d')](function(_0x37835d){if(_0x37835d){_0x43d8ab=_0x37835d[_0x1578('0x52')]({'plain':!![]});_0x8ebecf[_0x1578('0x37')]=_[_0x1578('0x3a')](db[_0x1578('0x59')][_0x1578('0x34')]);_0x8ebecf[_0x1578('0x39')]=_[_0x1578('0x3a')](_0x3056ed[_0x1578('0x39')]);_0x8ebecf[_0x1578('0x3b')]=_[_0x1578('0x3c')](_0x8ebecf[_0x1578('0x37')],_0x8ebecf['query']);_0x552414[_0x1578('0x3d')]=_[_0x1578('0x3c')](_0x8ebecf[_0x1578('0x37')],qs[_0x1578('0x3e')](_0x3056ed['query']['fields']));_0x552414['attributes']=_0x552414['attributes'][_0x1578('0x3f')]?_0x552414[_0x1578('0x3d')]:_0x8ebecf['model'];if(!_0x3056ed[_0x1578('0x39')][_0x1578('0x5a')](_0x1578('0x40'))){_0x552414[_0x1578('0x23')]=qs[_0x1578('0x23')](_0x3056ed[_0x1578('0x39')][_0x1578('0x23')]);_0x552414['offset']=qs[_0x1578('0x21')](_0x3056ed[_0x1578('0x39')][_0x1578('0x21')]);}_0x552414[_0x1578('0x41')]=qs[_0x1578('0x42')](_0x3056ed[_0x1578('0x39')][_0x1578('0x42')]);_0x552414['where']=qs[_0x1578('0x3b')](_['pick'](_0x3056ed[_0x1578('0x39')],_0x8ebecf[_0x1578('0x3b')]));_0x552414[_0x1578('0x45')][_0x1578('0x5b')]=_0x37835d['id'];if(_0x3056ed[_0x1578('0x39')][_0x1578('0x44')]){_0x552414[_0x1578('0x45')]=_['merge'](_0x552414[_0x1578('0x45')],{'$or':_['map'](_0x552414['attributes'],function(_0x213480){var _0x377158={};_0x377158[_0x213480]={'$like':'%'+_0x3056ed[_0x1578('0x39')]['filter']+'%'};return _0x377158;})});}_0x552414=_['merge']({},_0x552414,_0x3056ed['options']);return db['UserOpenchannelQueue']['findAll'](_0x552414);}})[_0x1578('0x2d')](function(_0x32089b){if(_0x32089b){return db[_0x1578('0x5c')][_0x1578('0x5d')]({'where':{'id':_[_0x1578('0x38')](_0x32089b,_0x1578('0x5e')),'role':'agent'},'attributes':['id',_0x1578('0x32'),_0x1578('0x5f'),_0x1578('0x60'),'createdAt']});}})[_0x1578('0x2d')](function(_0x536418){if(_0x536418){return{'count':_0x536418[_0x1578('0x24')],'rows':_[_0x1578('0x38')](_0x536418[_0x1578('0x4a')],function(_0x56c4dc){return{'membername':_0x56c4dc[_0x1578('0x32')],'UserId':_0x56c4dc['id'],'queue_name':_0x43d8ab[_0x1578('0x32')],'OpenchannelQueueId':_0x43d8ab['id'],'interface':util[_0x1578('0x61')](_0x1578('0x62'),'SIP',_0x56c4dc[_0x1578('0x32')]),'penalty':0x0,'paused':_0x56c4dc[_0x1578('0x5f')],'createdAt':_0x56c4dc['createdAt'],'updatedAt':_0x56c4dc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1578('0x2d')](respondWithFilteredResult(_0x38e889,_0x552414))[_0x1578('0x4e')](handleError(_0x38e889,null));};exports[_0x1578('0x63')]=function(_0x422ae4,_0x54a42b,_0x2e74fc){var _0x30ac12={};var _0x5b95b5={};var _0x46d997;var _0x473796;return db['OpenchannelQueue'][_0x1578('0x58')]({'where':{'id':_0x422ae4[_0x1578('0x4c')]['id']}})[_0x1578('0x2d')](handleEntityNotFound(_0x54a42b,null))[_0x1578('0x2d')](function(_0x1fffb1){if(_0x1fffb1){_0x46d997=_0x1fffb1;_0x5b95b5[_0x1578('0x37')]=_[_0x1578('0x3a')](db[_0x1578('0x64')][_0x1578('0x34')]);_0x5b95b5['query']=_['keys'](_0x422ae4[_0x1578('0x39')]);_0x5b95b5['filters']=_['intersection'](_0x5b95b5[_0x1578('0x37')],_0x5b95b5['query']);_0x30ac12['attributes']=_['intersection'](_0x5b95b5['model'],qs[_0x1578('0x3e')](_0x422ae4['query'][_0x1578('0x3e')]));_0x30ac12[_0x1578('0x3d')]=_0x30ac12['attributes'][_0x1578('0x3f')]?_0x30ac12[_0x1578('0x3d')]:_0x5b95b5[_0x1578('0x37')];_0x30ac12[_0x1578('0x41')]=qs[_0x1578('0x42')](_0x422ae4[_0x1578('0x39')][_0x1578('0x42')]);_0x30ac12[_0x1578('0x45')]=qs[_0x1578('0x3b')](_[_0x1578('0x43')](_0x422ae4[_0x1578('0x39')],_0x5b95b5['filters']));if(_0x422ae4[_0x1578('0x39')]['filter']){_0x30ac12[_0x1578('0x45')]=_['merge'](_0x30ac12[_0x1578('0x45')],{'$or':_[_0x1578('0x38')](_0x30ac12[_0x1578('0x3d')],function(_0x1d3426){var _0x4ba0dc={};_0x4ba0dc[_0x1d3426]={'$like':'%'+_0x422ae4['query']['filter']+'%'};return _0x4ba0dc;})});}_0x30ac12=_[_0x1578('0x46')]({},_0x30ac12,_0x422ae4[_0x1578('0x65')]);return _0x46d997[_0x1578('0x63')](_0x30ac12);}})[_0x1578('0x2d')](function(_0x27f41b){if(_0x27f41b){_0x473796=_0x27f41b['length'];if(!_0x422ae4[_0x1578('0x39')]['hasOwnProperty'](_0x1578('0x40'))){_0x30ac12[_0x1578('0x23')]=qs['limit'](_0x422ae4[_0x1578('0x39')][_0x1578('0x23')]);_0x30ac12[_0x1578('0x21')]=qs['offset'](_0x422ae4[_0x1578('0x39')][_0x1578('0x21')]);}return _0x46d997[_0x1578('0x63')](_0x30ac12);}})[_0x1578('0x2d')](function(_0x3965fe){if(_0x3965fe){return _0x3965fe?{'count':_0x473796,'rows':_0x3965fe}:null;}})[_0x1578('0x2d')](respondWithResult(_0x54a42b,null))[_0x1578('0x4e')](handleError(_0x54a42b,null));};exports[_0x1578('0x66')]=function(_0x3c3b60,_0x19ea0b,_0x167dab){var _0x551106=_0x3c3b60[_0x1578('0x50')]['ids'];return db['Team']['findAll']({'where':{'id':_0x551106},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x1578('0x32'),_0x1578('0x67'),_0x1578('0x68'),_0x1578('0x69')],'raw':!![]}]})[_0x1578('0x2d')](function(_0xc83f1c){if(_0xc83f1c){var _0x54c1a4=_[_0x1578('0x6a')](_0xc83f1c,function(_0x5914ce){var _0xc7ee5b=_0x5914ce[_0x1578('0x52')]({'plain':!![]});return _0xc7ee5b['Agents'];});return db['OpenchannelQueue'][_0x1578('0x4d')]({'where':{'id':_0x3c3b60[_0x1578('0x4c')]['id']}})[_0x1578('0x2d')](function(_0x309226){return db['sequelize'][_0x1578('0x6b')](function(_0x3e4dd2){return _0x309226['addTeams'](_0x551106,{'transaction':_0x3e4dd2})['then'](function(){return BPromise[_0x1578('0x6c')](_0x54c1a4,function(_0x203546){return db['UserOpenchannelQueue'][_0x1578('0x6d')]({'where':{'UserId':_0x203546['id'],'OpenchannelQueueId':_0x3c3b60[_0x1578('0x4c')]['id']},'transaction':_0x3e4dd2});});})[_0x1578('0x2d')](function(){_0x54c1a4['forEach'](function(_0x3222c7){socket[_0x1578('0x6e')](_0x1578('0x6f'),{'UserId':_0x3222c7['id'],'OpenchannelQueueId':_0x309226['id']});});});});});}})[_0x1578('0x2d')](respondWithStatusCode(_0x19ea0b,null))[_0x1578('0x4e')](handleError(_0x19ea0b,null));};exports[_0x1578('0x70')]=function(_0x1d0c0e,_0x4e553d,_0x2872d9){return db[_0x1578('0x64')][_0x1578('0x49')]({'where':{'id':_0x1d0c0e[_0x1578('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1578('0x71'),'attributes':['id'],'raw':!![]}]})[_0x1578('0x2d')](handleEntityNotFound(_0x4e553d,null))[_0x1578('0x2d')](function(_0x3f119f){var _0x237472=_[_0x1578('0x38')](_0x3f119f,'id');var _0x3f904c=[];var _0x2a4f4f=[];var _0x4fa566=squel[_0x1578('0x72')]();_0x4fa566[_0x1578('0x73')](_0x1578('0x74'))[_0x1578('0x75')](_0x1578('0x76'),'tq')['join'](_0x1578('0x77'),'ut',_0x1578('0x78'))[_0x1578('0x45')](_0x1578('0x79'),_0x1d0c0e[_0x1578('0x4c')]['id']);for(var _0x3fa61d=0x0;_0x3fa61d<_0x3f119f['length'];_0x3fa61d+=0x1){let _0x4565c8=_0x3f119f[_0x3fa61d];for(var _0x50f2dd=0x0;_0x50f2dd<_0x4565c8[_0x1578('0x71')]['length'];_0x50f2dd+=0x1){let _0x2c1f13=_0x4565c8[_0x1578('0x71')][_0x50f2dd];var _0x4ff7da=_0x4fa566[_0x1578('0x7a')]();_0x4ff7da['where'](_0x1578('0x7b'),_0x2c1f13['id']);_0x2a4f4f[_0x1578('0x7c')](db[_0x1578('0x7d')][_0x1578('0x39')](_0x4ff7da[_0x1578('0x7e')](),{'type':db['sequelize'][_0x1578('0x7f')][_0x1578('0x80')]})[_0x1578('0x2d')](function(_0x4bf552){if(_0x4bf552[_0x1578('0x3f')]===0x1){return _0x2c1f13['id'];}else{var _0x5dfe3d=_[_0x1578('0x81')](_['map'](_0x4bf552,_0x1578('0x82')),function(_0xe5bd25){return _[_0x1578('0x83')](_0x237472,_0xe5bd25);});if(_0x5dfe3d){return _0x2c1f13['id'];}}}));}}return BPromise[_0x1578('0x84')](_0x2a4f4f)[_0x1578('0x2d')](function(_0x407b43){_0x3f904c=_(_0x3f904c)[_0x1578('0x85')](_0x407b43)['compact']()[_0x1578('0x86')]();return db[_0x1578('0x33')][_0x1578('0x4d')]({'where':{'id':_0x1d0c0e['params']['id']}})[_0x1578('0x2d')](function(_0x16da5c){return db[_0x1578('0x7d')][_0x1578('0x6b')](function(_0x40848b){return _0x16da5c[_0x1578('0x70')](_0x1d0c0e[_0x1578('0x39')][_0x1578('0x87')],{'transaction':_0x40848b})[_0x1578('0x2d')](function(){if(!_[_0x1578('0x88')](_0x3f904c)){return _0x16da5c['removeAgents'](_0x3f904c,{'transaction':_0x40848b});}})[_0x1578('0x2d')](function(){_0x3f904c[_0x1578('0x89')](function(_0x1dea0b){socket['emit'](_0x1578('0x8a'),{'UserId':_0x1dea0b,'OpenchannelQueueId':_0x16da5c['id']});});});});});});})['then'](respondWithStatusCode(_0x4e553d,null))[_0x1578('0x4e')](handleError(_0x4e553d,null));};exports['addAgents']=function(_0x513a4d,_0x1c3c11,_0x33620d){return db[_0x1578('0x33')][_0x1578('0x4d')]({'where':{'id':_0x513a4d[_0x1578('0x4c')]['id']}})[_0x1578('0x2d')](handleEntityNotFound(_0x1c3c11,null))['then'](function(_0x126e80){if(_0x126e80){return _0x126e80[_0x1578('0x8b')](_0x513a4d['body']['ids'],_[_0x1578('0x8c')](_0x513a4d[_0x1578('0x50')],['ids','id'])||{})[_0x1578('0x8d')](function(_0x3144ea){for(var _0x294948=0x0;_0x294948<_0x513a4d['body'][_0x1578('0x87')][_0x1578('0x3f')];_0x294948+=0x1){socket[_0x1578('0x6e')](_0x1578('0x6f'),{'UserId':Number(_0x513a4d['body'][_0x1578('0x87')][_0x294948]),'OpenchannelQueueId':Number(_0x513a4d[_0x1578('0x4c')]['id'])});}return _0x3144ea;});}})['then'](respondWithResult(_0x1c3c11,null))[_0x1578('0x4e')](handleError(_0x1c3c11,null));};exports[_0x1578('0x8e')]=function(_0x3ef508,_0x4ddec1,_0x152f4d){return db[_0x1578('0x33')]['find']({'where':{'id':_0x3ef508[_0x1578('0x4c')]['id']}})[_0x1578('0x2d')](handleEntityNotFound(_0x4ddec1,null))[_0x1578('0x2d')](function(_0x1c1323){if(_0x1c1323){return _0x1c1323[_0x1578('0x8e')](_0x3ef508[_0x1578('0x39')]['ids'])[_0x1578('0x2d')](function(){if(_[_0x1578('0x8f')](_0x3ef508[_0x1578('0x39')][_0x1578('0x87')])){for(var _0x284dc1=0x0;_0x284dc1<_0x3ef508[_0x1578('0x39')][_0x1578('0x87')][_0x1578('0x3f')];_0x284dc1+=0x1){socket[_0x1578('0x6e')](_0x1578('0x8a'),{'UserId':Number(_0x3ef508[_0x1578('0x39')]['ids'][_0x284dc1]),'OpenchannelQueueId':Number(_0x3ef508[_0x1578('0x4c')]['id'])});}}else{socket[_0x1578('0x6e')](_0x1578('0x8a'),{'UserId':Number(_0x3ef508[_0x1578('0x39')][_0x1578('0x87')]),'OpenchannelQueueId':Number(_0x3ef508[_0x1578('0x4c')]['id'])});}});}})[_0x1578('0x2d')](respondWithStatusCode(_0x4ddec1,null))['catch'](handleError(_0x4ddec1,null));};exports['getAgents']=function(_0x48e0bb,_0x153cac,_0x401184){var _0x44fb78={};var _0x2076f4={};var _0x13ddef;var _0x16798f;return db[_0x1578('0x33')]['findOne']({'where':{'id':_0x48e0bb['params']['id']}})[_0x1578('0x2d')](handleEntityNotFound(_0x153cac,null))[_0x1578('0x2d')](function(_0x3f8a9e){if(_0x3f8a9e){_0x13ddef=_0x3f8a9e;_0x2076f4[_0x1578('0x37')]=_[_0x1578('0x3a')](db[_0x1578('0x5c')][_0x1578('0x34')]);_0x2076f4['query']=_[_0x1578('0x3a')](_0x48e0bb[_0x1578('0x39')]);_0x2076f4[_0x1578('0x3b')]=_[_0x1578('0x3c')](_0x2076f4[_0x1578('0x37')],_0x2076f4['query']);_0x44fb78[_0x1578('0x3d')]=_[_0x1578('0x3c')](_0x2076f4['model'],qs[_0x1578('0x3e')](_0x48e0bb['query'][_0x1578('0x3e')]));_0x44fb78[_0x1578('0x3d')]=_0x44fb78[_0x1578('0x3d')][_0x1578('0x3f')]?_0x44fb78[_0x1578('0x3d')]:_0x2076f4[_0x1578('0x37')];_0x44fb78[_0x1578('0x41')]=qs[_0x1578('0x42')](_0x48e0bb[_0x1578('0x39')][_0x1578('0x42')]);_0x44fb78['where']=qs[_0x1578('0x3b')](_[_0x1578('0x43')](_0x48e0bb[_0x1578('0x39')],_0x2076f4[_0x1578('0x3b')]));if(_0x48e0bb[_0x1578('0x39')][_0x1578('0x44')]){_0x44fb78[_0x1578('0x45')]=_['merge'](_0x44fb78[_0x1578('0x45')],{'$or':_[_0x1578('0x38')](_0x44fb78['attributes'],function(_0x432318){var _0x549544={};_0x549544[_0x432318]={'$like':'%'+_0x48e0bb[_0x1578('0x39')][_0x1578('0x44')]+'%'};return _0x549544;})});}_0x44fb78=_[_0x1578('0x46')]({},_0x44fb78,_0x48e0bb['options']);return _0x13ddef['getAgents'](_0x44fb78);}})[_0x1578('0x2d')](function(_0x118716){if(_0x118716){_0x16798f=_0x118716[_0x1578('0x3f')];if(!_0x48e0bb[_0x1578('0x39')][_0x1578('0x5a')](_0x1578('0x40'))){_0x44fb78['limit']=qs['limit'](_0x48e0bb[_0x1578('0x39')][_0x1578('0x23')]);_0x44fb78[_0x1578('0x21')]=qs[_0x1578('0x21')](_0x48e0bb[_0x1578('0x39')][_0x1578('0x21')]);}return _0x13ddef[_0x1578('0x90')](_0x44fb78);}})['then'](function(_0x3b06bb){if(_0x3b06bb){return _0x3b06bb?{'count':_0x16798f,'rows':_0x3b06bb}:null;}})[_0x1578('0x2d')](respondWithResult(_0x153cac,null))[_0x1578('0x4e')](handleError(_0x153cac,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3b2030a..61cc134 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 _0xfd35=['events','setMaxListeners','save','remove','hasOwnProperty','hook','exports'];(function(_0x4e19b0,_0x8c88d9){var _0xb628be=function(_0x3147b0){while(--_0x3147b0){_0x4e19b0['push'](_0x4e19b0['shift']());}};_0xb628be(++_0x8c88d9);}(_0xfd35,0x1c0));var _0x5fd3=function(_0x3a57b0,_0x23145a){_0x3a57b0=_0x3a57b0-0x0;var _0x2b8f3e=_0xfd35[_0x3a57b0];return _0x2b8f3e;};'use strict';var EventEmitter=require(_0x5fd3('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5fd3('0x1')](0x0);var events={'afterCreate':_0x5fd3('0x2'),'afterUpdate':'update','afterDestroy':_0x5fd3('0x3')};function emitEvent(_0x1ee450){return function(_0x809d08,_0x2e9012,_0x28b17a){OpenchannelQueueEvents['emit'](_0x1ee450+':'+_0x809d08['id'],_0x809d08);OpenchannelQueueEvents['emit'](_0x1ee450,_0x809d08);_0x28b17a(null);};}for(var e in events){if(events[_0x5fd3('0x4')](e)){var event=events[e];OpenchannelQueue[_0x5fd3('0x5')](e,emitEvent(event));}}module[_0x5fd3('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xee50=['emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x31e3e6,_0x2691a4){var _0x2787bb=function(_0x22a235){while(--_0x22a235){_0x31e3e6['push'](_0x31e3e6['shift']());}};_0x2787bb(++_0x2691a4);}(_0xee50,0xe4));var _0x0ee5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xee50[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x0ee5('0x0'));var OpenchannelQueue=require(_0x0ee5('0x1'))['db'][_0x0ee5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0ee5('0x3')](0x0);var events={'afterCreate':_0x0ee5('0x4'),'afterUpdate':_0x0ee5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a65ac){return function(_0x197cf6,_0x466657,_0xd0227b){OpenchannelQueueEvents['emit'](_0x1a65ac+':'+_0x197cf6['id'],_0x197cf6);OpenchannelQueueEvents[_0x0ee5('0x6')](_0x1a65ac,_0x197cf6);_0xd0227b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x0ee5('0x7')](e,emitEvent(event));}}module[_0x0ee5('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 0595e65..4e34926 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 _0xae80=['exports','define','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x514944,_0x1ca56f){var _0x288f68=function(_0x9d8de2){while(--_0x9d8de2){_0x514944['push'](_0x514944['shift']());}};_0x288f68(++_0x1ca56f);}(_0xae80,0xb6));var _0x0ae8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xae80[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0ae8('0x0'));var util=require('util');var logger=require(_0x0ae8('0x1'))('api');var moment=require(_0x0ae8('0x2'));var BPromise=require(_0x0ae8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae8('0x4'));var config=require(_0x0ae8('0x5'));var attributes=require(_0x0ae8('0x6'));module[_0x0ae8('0x7')]=function(_0x1985c9,_0xc94a35){return _0x1985c9[_0x0ae8('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x704b=['path','rimraf','../../config/environment','openchannel_queues','lodash','util','api','moment'];(function(_0x5bba0e,_0x81e4fe){var _0x3f39ed=function(_0x2e1c60){while(--_0x2e1c60){_0x5bba0e['push'](_0x5bba0e['shift']());}};_0x3f39ed(++_0x81e4fe);}(_0x704b,0x1a4));var _0xb704=function(_0x81ea09,_0x28ccd1){_0x81ea09=_0x81ea09-0x0;var _0x300e8c=_0x704b[_0x81ea09];return _0x300e8c;};'use strict';var _=require(_0xb704('0x0'));var util=require(_0xb704('0x1'));var logger=require('../../config/logger')(_0xb704('0x2'));var moment=require(_0xb704('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb704('0x4'));var rimraf=require(_0xb704('0x5'));var config=require(_0xb704('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x50284b,_0x3f358a){return _0x50284b['define']('OpenchannelQueue',attributes,{'tableName':_0xb704('0x7'),'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 2436489..8b723a2 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 _0xaa9f=['../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xaa9f,0x93));var _0xfaa9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xaa9f[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xfaa9('0x0'));var util=require('util');var moment=require(_0xfaa9('0x1'));var BPromise=require(_0xfaa9('0x2'));var rs=require(_0xfaa9('0x3'));var fs=require('fs');var Redis=require(_0xfaa9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfaa9('0x5'));var logger=require('../../config/logger')(_0xfaa9('0x6'));var config=require(_0xfaa9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfaa9('0x8')]({'port':0x232a});config[_0xfaa9('0x9')]=_['defaults'](config[_0xfaa9('0x9')],{'host':_0xfaa9('0xa'),'port':0x18eb});var socket=require(_0xfaa9('0xb'))(new Redis(config[_0xfaa9('0x9')]));require('./openchannelQueue.socket')[_0xfaa9('0xc')](socket);function respondWithRpcPromise(_0x59e70d,_0x13457f,_0x2d1d68){return new BPromise(function(_0x45cdb6,_0x4a12f9){return client[_0xfaa9('0xd')](_0x59e70d,_0x2d1d68)[_0xfaa9('0xe')](function(_0x38af0e){logger['info'](_0xfaa9('0xf'),_0x13457f,'request\x20sent');logger[_0xfaa9('0x10')](_0xfaa9('0x11'),_0x13457f,_0xfaa9('0x12'),JSON[_0xfaa9('0x13')](_0x38af0e));if(_0x38af0e[_0xfaa9('0x14')]){if(_0x38af0e[_0xfaa9('0x14')][_0xfaa9('0x15')]===0x1f4){logger[_0xfaa9('0x14')](_0xfaa9('0xf'),_0x13457f,_0x38af0e['error'][_0xfaa9('0x16')]);return _0x4a12f9(_0x38af0e[_0xfaa9('0x14')][_0xfaa9('0x16')]);}logger[_0xfaa9('0x14')](_0xfaa9('0xf'),_0x13457f,_0x38af0e[_0xfaa9('0x14')][_0xfaa9('0x16')]);return _0x45cdb6(_0x38af0e['error'][_0xfaa9('0x16')]);}else{logger[_0xfaa9('0x17')](_0xfaa9('0xf'),_0x13457f,'request\x20sent');_0x45cdb6(_0x38af0e[_0xfaa9('0x18')][_0xfaa9('0x16')]);}})[_0xfaa9('0x19')](function(_0x84f2d4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x13457f,_0x84f2d4);_0x4a12f9(_0x84f2d4);});});}exports['GetOpenchannelQueue']=function(_0x411cde){var _0x5db424=this;return new Promise(function(_0x2a04ad,_0x3fa78d){return db[_0xfaa9('0x1a')][_0xfaa9('0x1b')]({'raw':_0x411cde[_0xfaa9('0x1c')]?_0x411cde[_0xfaa9('0x1c')][_0xfaa9('0x1d')]===undefined?!![]:![]:!![],'where':_0x411cde[_0xfaa9('0x1c')]?_0x411cde[_0xfaa9('0x1c')]['where']||null:null,'attributes':_0x411cde[_0xfaa9('0x1c')]?_0x411cde['options'][_0xfaa9('0x1e')]||null:null,'limit':_0x411cde['options']?_0x411cde[_0xfaa9('0x1c')][_0xfaa9('0x1f')]||null:null,'include':_0x411cde[_0xfaa9('0x1c')]?_0x411cde[_0xfaa9('0x1c')][_0xfaa9('0x20')]?_[_0xfaa9('0x21')](_0x411cde[_0xfaa9('0x1c')][_0xfaa9('0x20')],function(_0x3e4f53){return{'model':db[_0x3e4f53[_0xfaa9('0x22')]],'as':_0x3e4f53['as'],'attributes':_0x3e4f53[_0xfaa9('0x1e')],'include':_0x3e4f53[_0xfaa9('0x20')]?_[_0xfaa9('0x21')](_0x3e4f53[_0xfaa9('0x20')],function(_0x58afab){return{'model':db[_0x58afab[_0xfaa9('0x22')]],'as':_0x58afab['as'],'attributes':_0x58afab['attributes'],'include':_0x58afab[_0xfaa9('0x20')]?_[_0xfaa9('0x21')](_0x58afab[_0xfaa9('0x20')],function(_0x1e8f5b){return{'model':db[_0x1e8f5b[_0xfaa9('0x22')]],'as':_0x1e8f5b['as'],'attributes':_0x1e8f5b[_0xfaa9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfaa9('0xe')](function(_0x543275){logger['info'](_0xfaa9('0x23'),_0x411cde);logger['debug'](_0xfaa9('0x23'),_0x411cde,JSON[_0xfaa9('0x13')](_0x543275));_0x2a04ad(_0x543275);})[_0xfaa9('0x19')](function(_0x5ccc80){logger['error']('GetOpenchannelQueue',_0x5ccc80[_0xfaa9('0x16')],_0x411cde);_0x3fa78d(_0x5db424['error'](0x1f4,_0x5ccc80[_0xfaa9('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x17d802){var _0x5585f7=this;return new Promise(function(_0x153cc9,_0x471f6a){return db[_0xfaa9('0x1a')][_0xfaa9('0x24')]({'raw':_0x17d802[_0xfaa9('0x1c')]?_0x17d802[_0xfaa9('0x1c')][_0xfaa9('0x1d')]===undefined?!![]:![]:!![],'where':_0x17d802['options']?_0x17d802[_0xfaa9('0x1c')]['where']||null:null,'attributes':_0x17d802[_0xfaa9('0x1c')]?_0x17d802['options'][_0xfaa9('0x1e')]||null:null,'include':_0x17d802[_0xfaa9('0x1c')]?_0x17d802[_0xfaa9('0x1c')]['include']?_[_0xfaa9('0x21')](_0x17d802['options']['include'],function(_0x37a41f){return{'model':db[_0x37a41f['model']],'as':_0x37a41f['as'],'attributes':_0x37a41f['attributes'],'include':_0x37a41f['include']?_[_0xfaa9('0x21')](_0x37a41f[_0xfaa9('0x20')],function(_0x27be0f){return{'model':db[_0x27be0f[_0xfaa9('0x22')]],'as':_0x27be0f['as'],'attributes':_0x27be0f[_0xfaa9('0x1e')],'include':_0x27be0f[_0xfaa9('0x20')]?_[_0xfaa9('0x21')](_0x27be0f[_0xfaa9('0x20')],function(_0x130da4){return{'model':db[_0x130da4[_0xfaa9('0x22')]],'as':_0x130da4['as'],'attributes':_0x130da4['attributes']};}):[]};}):[]};}):[]:[]})[_0xfaa9('0xe')](function(_0x216121){logger['info'](_0xfaa9('0x25'),_0x17d802);logger[_0xfaa9('0x10')](_0xfaa9('0x25'),_0x17d802,JSON[_0xfaa9('0x13')](_0x216121));_0x153cc9(_0x216121);})[_0xfaa9('0x19')](function(_0x4f4da0){logger[_0xfaa9('0x14')](_0xfaa9('0x25'),_0x4f4da0[_0xfaa9('0x16')],_0x17d802);_0x471f6a(_0x5585f7[_0xfaa9('0x14')](0x1f4,_0x4f4da0[_0xfaa9('0x16')]));});});}; \ No newline at end of file +var _0x88e2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./openchannelQueue.socket','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','OpenchannelQueue','findAll','options','raw','where','attributes','include','model','map','then','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x288771,_0x2e2b23){var _0x295004=function(_0x46472a){while(--_0x46472a){_0x288771['push'](_0x288771['shift']());}};_0x295004(++_0x2e2b23);}(_0x88e2,0x96));var _0x288e=function(_0x5f4747,_0xcd6422){_0x5f4747=_0x5f4747-0x0;var _0x415aa5=_0x88e2[_0x5f4747];return _0x415aa5;};'use strict';var _=require(_0x288e('0x0'));var util=require(_0x288e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x288e('0x2'));var fs=require('fs');var Redis=require(_0x288e('0x3'));var db=require(_0x288e('0x4'))['db'];var utils=require(_0x288e('0x5'));var logger=require(_0x288e('0x6'))(_0x288e('0x7'));var config=require(_0x288e('0x8'));var jayson=require(_0x288e('0x9'));var client=jayson[_0x288e('0xa')][_0x288e('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x288e('0xc'),'port':0x18eb});var socket=require(_0x288e('0xd'))(new Redis(config[_0x288e('0xe')]));require(_0x288e('0xf'))['register'](socket);function respondWithRpcPromise(_0x2a1fcb,_0x12016c,_0x446e6e){return new BPromise(function(_0x4cbf98,_0x2e8379){return client[_0x288e('0x10')](_0x2a1fcb,_0x446e6e)['then'](function(_0x50d420){logger['info'](_0x288e('0x11'),_0x12016c,_0x288e('0x12'));logger[_0x288e('0x13')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x12016c,'request\x20sent',JSON[_0x288e('0x14')](_0x50d420));if(_0x50d420[_0x288e('0x15')]){if(_0x50d420['error'][_0x288e('0x16')]===0x1f4){logger[_0x288e('0x15')](_0x288e('0x11'),_0x12016c,_0x50d420['error'][_0x288e('0x17')]);return _0x2e8379(_0x50d420[_0x288e('0x15')]['message']);}logger[_0x288e('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x12016c,_0x50d420[_0x288e('0x15')]['message']);return _0x4cbf98(_0x50d420['error'][_0x288e('0x17')]);}else{logger[_0x288e('0x18')](_0x288e('0x11'),_0x12016c,_0x288e('0x12'));_0x4cbf98(_0x50d420[_0x288e('0x19')][_0x288e('0x17')]);}})['catch'](function(_0x10c8bc){logger[_0x288e('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x12016c,_0x10c8bc);_0x2e8379(_0x10c8bc);});});}exports['GetOpenchannelQueue']=function(_0x2c446f){var _0x16ee92=this;return new Promise(function(_0x1edce8,_0x30f9db){return db[_0x288e('0x1a')][_0x288e('0x1b')]({'raw':_0x2c446f[_0x288e('0x1c')]?_0x2c446f[_0x288e('0x1c')][_0x288e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c446f[_0x288e('0x1c')]?_0x2c446f['options'][_0x288e('0x1e')]||null:null,'attributes':_0x2c446f[_0x288e('0x1c')]?_0x2c446f[_0x288e('0x1c')][_0x288e('0x1f')]||null:null,'limit':_0x2c446f[_0x288e('0x1c')]?_0x2c446f[_0x288e('0x1c')]['limit']||null:null,'include':_0x2c446f[_0x288e('0x1c')]?_0x2c446f[_0x288e('0x1c')]['include']?_['map'](_0x2c446f[_0x288e('0x1c')][_0x288e('0x20')],function(_0x11b8b2){return{'model':db[_0x11b8b2[_0x288e('0x21')]],'as':_0x11b8b2['as'],'attributes':_0x11b8b2[_0x288e('0x1f')],'include':_0x11b8b2[_0x288e('0x20')]?_[_0x288e('0x22')](_0x11b8b2[_0x288e('0x20')],function(_0x4aa390){return{'model':db[_0x4aa390[_0x288e('0x21')]],'as':_0x4aa390['as'],'attributes':_0x4aa390[_0x288e('0x1f')],'include':_0x4aa390['include']?_[_0x288e('0x22')](_0x4aa390['include'],function(_0x21f955){return{'model':db[_0x21f955[_0x288e('0x21')]],'as':_0x21f955['as'],'attributes':_0x21f955[_0x288e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x288e('0x23')](function(_0x2ac76e){logger[_0x288e('0x18')](_0x288e('0x24'),_0x2c446f);logger['debug']('GetOpenchannelQueue',_0x2c446f,JSON['stringify'](_0x2ac76e));_0x1edce8(_0x2ac76e);})['catch'](function(_0x2900ec){logger[_0x288e('0x15')](_0x288e('0x24'),_0x2900ec['message'],_0x2c446f);_0x30f9db(_0x16ee92[_0x288e('0x15')](0x1f4,_0x2900ec[_0x288e('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x41035f){var _0x12c119=this;return new Promise(function(_0x220bc8,_0x4b54c9){return db[_0x288e('0x1a')][_0x288e('0x25')]({'raw':_0x41035f[_0x288e('0x1c')]?_0x41035f['options'][_0x288e('0x1d')]===undefined?!![]:![]:!![],'where':_0x41035f['options']?_0x41035f[_0x288e('0x1c')]['where']||null:null,'attributes':_0x41035f[_0x288e('0x1c')]?_0x41035f[_0x288e('0x1c')][_0x288e('0x1f')]||null:null,'include':_0x41035f['options']?_0x41035f['options'][_0x288e('0x20')]?_[_0x288e('0x22')](_0x41035f['options'][_0x288e('0x20')],function(_0x5cc61a){return{'model':db[_0x5cc61a[_0x288e('0x21')]],'as':_0x5cc61a['as'],'attributes':_0x5cc61a[_0x288e('0x1f')],'include':_0x5cc61a[_0x288e('0x20')]?_[_0x288e('0x22')](_0x5cc61a[_0x288e('0x20')],function(_0x4da449){return{'model':db[_0x4da449['model']],'as':_0x4da449['as'],'attributes':_0x4da449[_0x288e('0x1f')],'include':_0x4da449[_0x288e('0x20')]?_[_0x288e('0x22')](_0x4da449[_0x288e('0x20')],function(_0x5e836b){return{'model':db[_0x5e836b[_0x288e('0x21')]],'as':_0x5e836b['as'],'attributes':_0x5e836b['attributes']};}):[]};}):[]};}):[]:[]})[_0x288e('0x23')](function(_0xd614c5){logger[_0x288e('0x18')](_0x288e('0x26'),_0x41035f);logger[_0x288e('0x13')](_0x288e('0x26'),_0x41035f,JSON[_0x288e('0x14')](_0xd614c5));_0x220bc8(_0xd614c5);})['catch'](function(_0x2a68b6){logger[_0x288e('0x15')](_0x288e('0x26'),_0x2a68b6[_0x288e('0x17')],_0x41035f);_0x4b54c9(_0x12c119[_0x288e('0x15')](0x1f4,_0x2a68b6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index dfe60e7..49c8523 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 _0xd64f=['remove','update','emit','removeListener','register','length','./openchannelQueue.events','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd64f,0x13e));var _0xfd64=function(_0x116825,_0x53de51){_0x116825=_0x116825-0x0;var _0x349538=_0xd64f[_0x116825];return _0x349538;};'use strict';var OpenchannelQueueEvents=require(_0xfd64('0x0'));var events=[_0xfd64('0x1'),_0xfd64('0x2'),_0xfd64('0x3')];function createListener(_0x5b441c,_0x23a745){return function(_0x3c5552){_0x23a745[_0xfd64('0x4')](_0x5b441c,_0x3c5552);};}function removeListener(_0x11bdff,_0x43c599){return function(){OpenchannelQueueEvents[_0xfd64('0x5')](_0x11bdff,_0x43c599);};}exports[_0xfd64('0x6')]=function(_0x5b67f6){for(var _0x16f5a0=0x0,_0x40b762=events[_0xfd64('0x7')];_0x16f5a0<_0x40b762;_0x16f5a0++){var _0x16ea20=events[_0x16f5a0];var _0x310ffa=createListener('openchannelQueue:'+_0x16ea20,_0x5b67f6);OpenchannelQueueEvents['on'](_0x16ea20,_0x310ffa);}}; \ No newline at end of file +var _0x5c33=['register','length','openchannelQueue:','./openchannelQueue.events','save','emit','removeListener'];(function(_0x319d2c,_0x44481e){var _0x381d76=function(_0x5992c){while(--_0x5992c){_0x319d2c['push'](_0x319d2c['shift']());}};_0x381d76(++_0x44481e);}(_0x5c33,0x199));var _0x35c3=function(_0x5417bc,_0x3d9413){_0x5417bc=_0x5417bc-0x0;var _0x1bb0bc=_0x5c33[_0x5417bc];return _0x1bb0bc;};'use strict';var OpenchannelQueueEvents=require(_0x35c3('0x0'));var events=[_0x35c3('0x1'),'remove','update'];function createListener(_0x1cca13,_0x3f323a){return function(_0x2f3c9f){_0x3f323a[_0x35c3('0x2')](_0x1cca13,_0x2f3c9f);};}function removeListener(_0x5d5033,_0x3f2205){return function(){OpenchannelQueueEvents[_0x35c3('0x3')](_0x5d5033,_0x3f2205);};}exports[_0x35c3('0x4')]=function(_0x1bd970){for(var _0x20ee59=0x0,_0x15d474=events[_0x35c3('0x5')];_0x20ee59<_0x15d474;_0x20ee59++){var _0x127032=events[_0x20ee59];var _0x6918fd=createListener(_0x35c3('0x6')+_0x127032,_0x1bd970);OpenchannelQueueEvents['on'](_0x127032,_0x6918fd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2f090fe..440bc05 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 _0x4ed1=['fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','/describe','get','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x9dfc87,_0x1c845f){var _0x3b0197=function(_0x5530d6){while(--_0x5530d6){_0x9dfc87['push'](_0x9dfc87['shift']());}};_0x3b0197(++_0x1c845f);}(_0x4ed1,0x119));var _0x14ed=function(_0x24eb38,_0x2199e1){_0x24eb38=_0x24eb38-0x0;var _0x5cc25f=_0x4ed1[_0x24eb38];return _0x5cc25f;};'use strict';var multer=require(_0x14ed('0x0'));var util=require('util');var path=require(_0x14ed('0x1'));var timeout=require(_0x14ed('0x2'));var express=require(_0x14ed('0x3'));var router=express['Router']();var fs_extra=require(_0x14ed('0x4'));var auth=require(_0x14ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x14ed('0x6'));var controller=require(_0x14ed('0x7'));router['get']('/',auth[_0x14ed('0x8')](),controller[_0x14ed('0x9')]);router['get'](_0x14ed('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x14ed('0xb')](_0x14ed('0xc'),auth[_0x14ed('0x8')](),controller['show']);router[_0x14ed('0xd')]('/',auth['isAuthenticated'](),controller[_0x14ed('0xe')]);router[_0x14ed('0xf')]('/:id',auth[_0x14ed('0x8')](),controller[_0x14ed('0x10')]);router[_0x14ed('0x11')](_0x14ed('0xc'),auth[_0x14ed('0x8')](),controller[_0x14ed('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2aad=['./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x336dc4,_0x100d37){var _0x56e495=function(_0xddce2c){while(--_0xddce2c){_0x336dc4['push'](_0x336dc4['shift']());}};_0x56e495(++_0x100d37);}(_0x2aad,0x174));var _0xd2aa=function(_0x1b890f,_0x35a94b){_0x1b890f=_0x1b890f-0x0;var _0x568fda=_0x2aad[_0x1b890f];return _0x568fda;};'use strict';var multer=require(_0xd2aa('0x0'));var util=require(_0xd2aa('0x1'));var path=require(_0xd2aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2aa('0x3'));var router=express['Router']();var fs_extra=require(_0xd2aa('0x4'));var auth=require(_0xd2aa('0x5'));var interaction=require(_0xd2aa('0x6'));var config=require(_0xd2aa('0x7'));var controller=require(_0xd2aa('0x8'));router[_0xd2aa('0x9')]('/',auth[_0xd2aa('0xa')](),controller['index']);router[_0xd2aa('0x9')](_0xd2aa('0xb'),auth[_0xd2aa('0xa')](),controller['describe']);router[_0xd2aa('0x9')](_0xd2aa('0xc'),auth[_0xd2aa('0xa')](),controller['show']);router[_0xd2aa('0xd')]('/',auth[_0xd2aa('0xa')](),controller[_0xd2aa('0xe')]);router[_0xd2aa('0xf')](_0xd2aa('0xc'),auth[_0xd2aa('0xa')](),controller[_0xd2aa('0x10')]);router[_0xd2aa('0x11')](_0xd2aa('0xc'),auth[_0xd2aa('0xa')](),controller[_0xd2aa('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 836ccce..fe880ff 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 _0xa265=['moment','sequelize','exports','STRING','DATE'];(function(_0x270abe,_0x439965){var _0x1f14ad=function(_0x406447){while(--_0x406447){_0x270abe['push'](_0x270abe['shift']());}};_0x1f14ad(++_0x439965);}(_0xa265,0xe6));var _0x5a26=function(_0x441749,_0xf9b3a9){_0x441749=_0x441749-0x0;var _0x1d80e4=_0xa265[_0x441749];return _0x1d80e4;};'use strict';var moment=require(_0x5a26('0x0'));var Sequelize=require(_0x5a26('0x1'));module[_0x5a26('0x2')]={'uniqueid':{'type':Sequelize[_0x5a26('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5a26('0x3')]},'joinAt':{'type':Sequelize[_0x5a26('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x745d=['exports','STRING','DATE'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x745d,0x1cb));var _0xd745=function(_0x1b513a,_0x24514c){_0x1b513a=_0x1b513a-0x0;var _0x2b3e30=_0x745d[_0x1b513a];return _0x2b3e30;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd745('0x0')]={'uniqueid':{'type':Sequelize[_0xd745('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd745('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd745('0x2')]},'acceptAt':{'type':Sequelize[_0xd745('0x2')]},'exitAt':{'type':Sequelize[_0xd745('0x2')]},'reason':{'type':Sequelize[_0xd745('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index aa9967a..374da4c 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 _0x4c96=['error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','length','includeAll','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x4c96,0x71));var _0x64c9=function(_0x5d590c,_0x37d9c4){_0x5d590c=_0x5d590c-0x0;var _0x37ac07=_0x4c96[_0x5d590c];return _0x37ac07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64c9('0x0'));var zipdir=require(_0x64c9('0x1'));var jsonpatch=require(_0x64c9('0x2'));var rp=require(_0x64c9('0x3'));var moment=require(_0x64c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x64c9('0x5'));var util=require(_0x64c9('0x6'));var path=require(_0x64c9('0x7'));var sox=require('sox');var csv=require(_0x64c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64c9('0x9'));var _=require('lodash');var squel=require(_0x64c9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x64c9('0xb'));var toCsv=require(_0x64c9('0x8'));var querystring=require(_0x64c9('0xc'));var Papa=require(_0x64c9('0xd'));var Redis=require(_0x64c9('0xe'));var authService=require(_0x64c9('0xf'));var qs=require(_0x64c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64c9('0x11'));var logger=require('../../config/logger')(_0x64c9('0x12'));var utils=require(_0x64c9('0x13'));var config=require(_0x64c9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x64c9('0x15'))['db'];function respondWithStatusCode(_0x3582e2,_0x1d1d19){_0x1d1d19=_0x1d1d19||0xcc;return function(_0x25d8e2){if(_0x25d8e2){return _0x3582e2[_0x64c9('0x16')](_0x1d1d19);}return _0x3582e2[_0x64c9('0x17')](_0x1d1d19)[_0x64c9('0x18')]();};}function respondWithResult(_0x249564,_0x2dc42a){_0x2dc42a=_0x2dc42a||0xc8;return function(_0x20fe47){if(_0x20fe47){return _0x249564[_0x64c9('0x17')](_0x2dc42a)['json'](_0x20fe47);}};}function respondWithFilteredResult(_0x5439e2,_0x374871){return function(_0x16c8d5){if(_0x16c8d5){var _0x54f922=typeof _0x374871[_0x64c9('0x19')]===_0x64c9('0x1a')&&typeof _0x374871['limit']===_0x64c9('0x1a');var _0x2b0cbb=_0x16c8d5['count'];var _0x407f1c=_0x54f922?0x0:_0x374871[_0x64c9('0x19')];var _0x1ab790=_0x54f922?_0x16c8d5[_0x64c9('0x1b')]:_0x374871['offset']+_0x374871[_0x64c9('0x1c')];var _0x1df5f3;if(_0x1ab790>=_0x2b0cbb){_0x1ab790=_0x2b0cbb;_0x1df5f3=0xc8;}else{_0x1df5f3=0xce;}_0x5439e2[_0x64c9('0x17')](_0x1df5f3);return _0x5439e2['set'](_0x64c9('0x1d'),_0x407f1c+'-'+_0x1ab790+'/'+_0x2b0cbb)[_0x64c9('0x1e')](_0x16c8d5);}return null;};}function patchUpdates(_0x28111f){return function(_0x15f292){try{jsonpatch[_0x64c9('0x1f')](_0x15f292,_0x28111f,!![]);}catch(_0x4abf66){return BPromise['reject'](_0x4abf66);}return _0x15f292[_0x64c9('0x20')]();};}function saveUpdates(_0x3f9b9b,_0x2e810a){return function(_0x1a1201){if(_0x1a1201){return _0x1a1201[_0x64c9('0x21')](_0x3f9b9b)[_0x64c9('0x22')](function(_0x20194a){return _0x20194a;});}return null;};}function removeEntity(_0x5ef63d,_0x14a58b){return function(_0x62698d){if(_0x62698d){return _0x62698d['destroy']()[_0x64c9('0x22')](function(){_0x5ef63d[_0x64c9('0x17')](0xcc)[_0x64c9('0x18')]();});}};}function handleEntityNotFound(_0x5a7b53,_0x416848){return function(_0x5b7d49){if(!_0x5b7d49){_0x5a7b53[_0x64c9('0x16')](0x194);}return _0x5b7d49;};}function handleError(_0x5b765f,_0x27dfcc){_0x27dfcc=_0x27dfcc||0x1f4;return function(_0x56938f){logger[_0x64c9('0x23')](_0x56938f['stack']);if(_0x56938f[_0x64c9('0x24')]){delete _0x56938f['name'];}_0x5b765f['status'](_0x27dfcc)[_0x64c9('0x25')](_0x56938f);};}exports[_0x64c9('0x26')]=function(_0x5c5098,_0x2bbeda){var _0x2dc856={},_0x51dcf0={},_0x27445c={'count':0x0,'rows':[]};var _0x2747c0=_[_0x64c9('0x27')](db[_0x64c9('0x28')][_0x64c9('0x29')],function(_0x5c1fec){return{'name':_0x5c1fec[_0x64c9('0x2a')],'type':_0x5c1fec[_0x64c9('0x2b')][_0x64c9('0x2c')]};});_0x51dcf0[_0x64c9('0x2d')]=_[_0x64c9('0x27')](_0x2747c0,_0x64c9('0x24'));_0x51dcf0[_0x64c9('0x2e')]=_[_0x64c9('0x2f')](_0x5c5098[_0x64c9('0x2e')]);_0x51dcf0[_0x64c9('0x30')]=_[_0x64c9('0x31')](_0x51dcf0['model'],_0x51dcf0[_0x64c9('0x2e')]);_0x2dc856[_0x64c9('0x32')]=_[_0x64c9('0x31')](_0x51dcf0[_0x64c9('0x2d')],qs[_0x64c9('0x33')](_0x5c5098[_0x64c9('0x2e')][_0x64c9('0x33')]));_0x2dc856['attributes']=_0x2dc856[_0x64c9('0x32')]['length']?_0x2dc856[_0x64c9('0x32')]:_0x51dcf0[_0x64c9('0x2d')];if(!_0x5c5098[_0x64c9('0x2e')][_0x64c9('0x34')](_0x64c9('0x35'))){_0x2dc856[_0x64c9('0x1c')]=qs['limit'](_0x5c5098[_0x64c9('0x2e')][_0x64c9('0x1c')]);_0x2dc856['offset']=qs[_0x64c9('0x19')](_0x5c5098[_0x64c9('0x2e')][_0x64c9('0x19')]);}_0x2dc856[_0x64c9('0x36')]=qs[_0x64c9('0x37')](_0x5c5098['query'][_0x64c9('0x37')]);_0x2dc856[_0x64c9('0x38')]=qs[_0x64c9('0x30')](_[_0x64c9('0x39')](_0x5c5098[_0x64c9('0x2e')],_0x51dcf0['filters']),_0x2747c0);if(_0x5c5098[_0x64c9('0x2e')][_0x64c9('0x3a')]){_0x2dc856[_0x64c9('0x38')]=_[_0x64c9('0x3b')](_0x2dc856['where'],{'$or':_[_0x64c9('0x27')](_0x2747c0,function(_0x4e0ef7){if(_0x4e0ef7[_0x64c9('0x2b')]!==_0x64c9('0x3c')){var _0x326a5e={};_0x326a5e[_0x4e0ef7[_0x64c9('0x24')]]={'$like':'%'+_0x5c5098[_0x64c9('0x2e')][_0x64c9('0x3a')]+'%'};return _0x326a5e;}})});}_0x2dc856=_[_0x64c9('0x3b')]({},_0x2dc856,_0x5c5098[_0x64c9('0x3d')]);var _0x3a9a48={'where':_0x2dc856[_0x64c9('0x38')]};return db[_0x64c9('0x28')][_0x64c9('0x1b')](_0x3a9a48)['then'](function(_0x287952){_0x27445c['count']=_0x287952;if(_0x5c5098[_0x64c9('0x2e')]['includeAll']){_0x2dc856[_0x64c9('0x3e')]=[{'all':!![]}];}return db[_0x64c9('0x28')]['findAll'](_0x2dc856);})[_0x64c9('0x22')](function(_0x166575){_0x27445c[_0x64c9('0x3f')]=_0x166575;return _0x27445c;})['then'](respondWithFilteredResult(_0x2bbeda,_0x2dc856))['catch'](handleError(_0x2bbeda,null));};exports[_0x64c9('0x40')]=function(_0x2bfa1e,_0x2e9b66){var _0x42afcb={'raw':!![],'where':{'id':_0x2bfa1e['params']['id']}},_0xe4b8e9={};_0xe4b8e9['model']=_[_0x64c9('0x2f')](db[_0x64c9('0x28')][_0x64c9('0x29')]);_0xe4b8e9[_0x64c9('0x2e')]=_[_0x64c9('0x2f')](_0x2bfa1e[_0x64c9('0x2e')]);_0xe4b8e9['filters']=_[_0x64c9('0x31')](_0xe4b8e9[_0x64c9('0x2d')],_0xe4b8e9[_0x64c9('0x2e')]);_0x42afcb[_0x64c9('0x32')]=_[_0x64c9('0x31')](_0xe4b8e9[_0x64c9('0x2d')],qs[_0x64c9('0x33')](_0x2bfa1e[_0x64c9('0x2e')][_0x64c9('0x33')]));_0x42afcb[_0x64c9('0x32')]=_0x42afcb['attributes'][_0x64c9('0x41')]?_0x42afcb[_0x64c9('0x32')]:_0xe4b8e9[_0x64c9('0x2d')];if(_0x2bfa1e['query'][_0x64c9('0x42')]){_0x42afcb[_0x64c9('0x3e')]=[{'all':!![]}];}_0x42afcb=_['merge']({},_0x42afcb,_0x2bfa1e[_0x64c9('0x3d')]);return db[_0x64c9('0x28')][_0x64c9('0x43')](_0x42afcb)[_0x64c9('0x22')](handleEntityNotFound(_0x2e9b66,null))[_0x64c9('0x22')](respondWithResult(_0x2e9b66,null))[_0x64c9('0x44')](handleError(_0x2e9b66,null));};exports[_0x64c9('0x45')]=function(_0x5d6b78,_0x4b6501){return db['OpenchannelQueueReport']['create'](_0x5d6b78['body'],{})[_0x64c9('0x22')](respondWithResult(_0x4b6501,0xc9))['catch'](handleError(_0x4b6501,null));};exports[_0x64c9('0x21')]=function(_0x4197ae,_0x2158b7){if(_0x4197ae[_0x64c9('0x46')]['id']){delete _0x4197ae['body']['id'];}return db[_0x64c9('0x28')][_0x64c9('0x43')]({'where':{'id':_0x4197ae[_0x64c9('0x47')]['id']}})[_0x64c9('0x22')](handleEntityNotFound(_0x2158b7,null))[_0x64c9('0x22')](saveUpdates(_0x4197ae[_0x64c9('0x46')],null))[_0x64c9('0x22')](respondWithResult(_0x2158b7,null))[_0x64c9('0x44')](handleError(_0x2158b7,null));};exports[_0x64c9('0x48')]=function(_0x238db0,_0x5f18cb){return db[_0x64c9('0x28')][_0x64c9('0x43')]({'where':{'id':_0x238db0['params']['id']}})[_0x64c9('0x22')](handleEntityNotFound(_0x5f18cb,null))['then'](removeEntity(_0x5f18cb,null))['catch'](handleError(_0x5f18cb,null));};exports[_0x64c9('0x49')]=function(_0x124cf9,_0x452cb6){return db[_0x64c9('0x28')]['describe']()[_0x64c9('0x22')](respondWithResult(_0x452cb6,null))[_0x64c9('0x44')](handleError(_0x452cb6,null));}; \ No newline at end of file +var _0x1225=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','index','OpenchannelQueueReport','type','key','model','map','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','keys','rawAttributes','include','create','body','params','destroy','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x1225,0x86));var _0x5122=function(_0x1a585f,_0x5ca8a9){_0x1a585f=_0x1a585f-0x0;var _0x4a9f1c=_0x1225[_0x1a585f];return _0x4a9f1c;};'use strict';var emlformat=require(_0x5122('0x0'));var rimraf=require(_0x5122('0x1'));var zipdir=require(_0x5122('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5122('0x3'));var moment=require('moment');var BPromise=require(_0x5122('0x4'));var Mustache=require('mustache');var util=require(_0x5122('0x5'));var path=require(_0x5122('0x6'));var sox=require('sox');var csv=require(_0x5122('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5122('0x8'));var _=require('lodash');var squel=require(_0x5122('0x9'));var crypto=require(_0x5122('0xa'));var jsforce=require(_0x5122('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5122('0x7'));var querystring=require('querystring');var Papa=require(_0x5122('0xc'));var Redis=require(_0x5122('0xd'));var authService=require(_0x5122('0xe'));var qs=require(_0x5122('0xf'));var as=require(_0x5122('0x10'));var hardwareService=require(_0x5122('0x11'));var logger=require(_0x5122('0x12'))(_0x5122('0x13'));var utils=require(_0x5122('0x14'));var config=require(_0x5122('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x123b0b,_0x2acae0){_0x2acae0=_0x2acae0||0xcc;return function(_0x4eba13){if(_0x4eba13){return _0x123b0b['sendStatus'](_0x2acae0);}return _0x123b0b[_0x5122('0x16')](_0x2acae0)['end']();};}function respondWithResult(_0x30daf5,_0x12f868){_0x12f868=_0x12f868||0xc8;return function(_0x5398a3){if(_0x5398a3){return _0x30daf5[_0x5122('0x16')](_0x12f868)[_0x5122('0x17')](_0x5398a3);}};}function respondWithFilteredResult(_0x3af2ee,_0x22f634){return function(_0x239a8a){if(_0x239a8a){var _0xc5895b=typeof _0x22f634[_0x5122('0x18')]===_0x5122('0x19')&&typeof _0x22f634[_0x5122('0x1a')]===_0x5122('0x19');var _0x268a28=_0x239a8a['count'];var _0x3b5421=_0xc5895b?0x0:_0x22f634[_0x5122('0x18')];var _0x33bbbf=_0xc5895b?_0x239a8a[_0x5122('0x1b')]:_0x22f634[_0x5122('0x18')]+_0x22f634[_0x5122('0x1a')];var _0x21097f;if(_0x33bbbf>=_0x268a28){_0x33bbbf=_0x268a28;_0x21097f=0xc8;}else{_0x21097f=0xce;}_0x3af2ee['status'](_0x21097f);return _0x3af2ee[_0x5122('0x1c')](_0x5122('0x1d'),_0x3b5421+'-'+_0x33bbbf+'/'+_0x268a28)['json'](_0x239a8a);}return null;};}function patchUpdates(_0xe3e023){return function(_0x5d648b){try{jsonpatch[_0x5122('0x1e')](_0x5d648b,_0xe3e023,!![]);}catch(_0x56f7a5){return BPromise[_0x5122('0x1f')](_0x56f7a5);}return _0x5d648b[_0x5122('0x20')]();};}function saveUpdates(_0x3141d9,_0x539539){return function(_0x607d53){if(_0x607d53){return _0x607d53[_0x5122('0x21')](_0x3141d9)[_0x5122('0x22')](function(_0x113142){return _0x113142;});}return null;};}function removeEntity(_0x5b4ef0,_0x455be7){return function(_0x389a63){if(_0x389a63){return _0x389a63['destroy']()[_0x5122('0x22')](function(){_0x5b4ef0[_0x5122('0x16')](0xcc)[_0x5122('0x23')]();});}};}function handleEntityNotFound(_0xe0ceb1,_0x382cd5){return function(_0x464a60){if(!_0x464a60){_0xe0ceb1[_0x5122('0x24')](0x194);}return _0x464a60;};}function handleError(_0x574b6d,_0x3c14ce){_0x3c14ce=_0x3c14ce||0x1f4;return function(_0x50153e){logger[_0x5122('0x25')](_0x50153e['stack']);if(_0x50153e[_0x5122('0x26')]){delete _0x50153e[_0x5122('0x26')];}_0x574b6d[_0x5122('0x16')](_0x3c14ce)[_0x5122('0x27')](_0x50153e);};}exports[_0x5122('0x28')]=function(_0x227746,_0x2045ce){var _0x105a56={},_0x38ba4d={},_0x36635d={'count':0x0,'rows':[]};var _0x1c4c08=_['map'](db[_0x5122('0x29')]['rawAttributes'],function(_0x24145d){return{'name':_0x24145d['fieldName'],'type':_0x24145d[_0x5122('0x2a')][_0x5122('0x2b')]};});_0x38ba4d[_0x5122('0x2c')]=_[_0x5122('0x2d')](_0x1c4c08,_0x5122('0x26'));_0x38ba4d['query']=_['keys'](_0x227746['query']);_0x38ba4d[_0x5122('0x2e')]=_['intersection'](_0x38ba4d[_0x5122('0x2c')],_0x38ba4d[_0x5122('0x2f')]);_0x105a56[_0x5122('0x30')]=_[_0x5122('0x31')](_0x38ba4d[_0x5122('0x2c')],qs[_0x5122('0x32')](_0x227746[_0x5122('0x2f')]['fields']));_0x105a56[_0x5122('0x30')]=_0x105a56[_0x5122('0x30')][_0x5122('0x33')]?_0x105a56[_0x5122('0x30')]:_0x38ba4d[_0x5122('0x2c')];if(!_0x227746[_0x5122('0x2f')][_0x5122('0x34')](_0x5122('0x35'))){_0x105a56[_0x5122('0x1a')]=qs[_0x5122('0x1a')](_0x227746[_0x5122('0x2f')]['limit']);_0x105a56['offset']=qs[_0x5122('0x18')](_0x227746['query'][_0x5122('0x18')]);}_0x105a56[_0x5122('0x36')]=qs[_0x5122('0x37')](_0x227746[_0x5122('0x2f')][_0x5122('0x37')]);_0x105a56[_0x5122('0x38')]=qs[_0x5122('0x2e')](_[_0x5122('0x39')](_0x227746[_0x5122('0x2f')],_0x38ba4d['filters']),_0x1c4c08);if(_0x227746[_0x5122('0x2f')][_0x5122('0x3a')]){_0x105a56[_0x5122('0x38')]=_['merge'](_0x105a56['where'],{'$or':_[_0x5122('0x2d')](_0x1c4c08,function(_0x13abba){if(_0x13abba['type']!==_0x5122('0x3b')){var _0x1f3d4a={};_0x1f3d4a[_0x13abba[_0x5122('0x26')]]={'$like':'%'+_0x227746[_0x5122('0x2f')]['filter']+'%'};return _0x1f3d4a;}})});}_0x105a56=_[_0x5122('0x3c')]({},_0x105a56,_0x227746[_0x5122('0x3d')]);var _0x517522={'where':_0x105a56['where']};return db[_0x5122('0x29')][_0x5122('0x1b')](_0x517522)['then'](function(_0x4c87b6){_0x36635d[_0x5122('0x1b')]=_0x4c87b6;if(_0x227746[_0x5122('0x2f')][_0x5122('0x3e')]){_0x105a56['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5122('0x3f')](_0x105a56);})[_0x5122('0x22')](function(_0x32807d){_0x36635d['rows']=_0x32807d;return _0x36635d;})[_0x5122('0x22')](respondWithFilteredResult(_0x2045ce,_0x105a56))[_0x5122('0x40')](handleError(_0x2045ce,null));};exports[_0x5122('0x41')]=function(_0x51bf17,_0x12f40f){var _0x3bd763={'raw':!![],'where':{'id':_0x51bf17['params']['id']}},_0x260661={};_0x260661[_0x5122('0x2c')]=_[_0x5122('0x42')](db['OpenchannelQueueReport'][_0x5122('0x43')]);_0x260661[_0x5122('0x2f')]=_[_0x5122('0x42')](_0x51bf17[_0x5122('0x2f')]);_0x260661['filters']=_['intersection'](_0x260661[_0x5122('0x2c')],_0x260661[_0x5122('0x2f')]);_0x3bd763['attributes']=_[_0x5122('0x31')](_0x260661[_0x5122('0x2c')],qs[_0x5122('0x32')](_0x51bf17[_0x5122('0x2f')][_0x5122('0x32')]));_0x3bd763['attributes']=_0x3bd763[_0x5122('0x30')]['length']?_0x3bd763[_0x5122('0x30')]:_0x260661[_0x5122('0x2c')];if(_0x51bf17[_0x5122('0x2f')][_0x5122('0x3e')]){_0x3bd763[_0x5122('0x44')]=[{'all':!![]}];}_0x3bd763=_[_0x5122('0x3c')]({},_0x3bd763,_0x51bf17[_0x5122('0x3d')]);return db[_0x5122('0x29')]['find'](_0x3bd763)[_0x5122('0x22')](handleEntityNotFound(_0x12f40f,null))[_0x5122('0x22')](respondWithResult(_0x12f40f,null))[_0x5122('0x40')](handleError(_0x12f40f,null));};exports[_0x5122('0x45')]=function(_0x4acfc9,_0x42e8d1){return db[_0x5122('0x29')][_0x5122('0x45')](_0x4acfc9[_0x5122('0x46')],{})['then'](respondWithResult(_0x42e8d1,0xc9))[_0x5122('0x40')](handleError(_0x42e8d1,null));};exports[_0x5122('0x21')]=function(_0x2cb7f6,_0x1a6163){if(_0x2cb7f6[_0x5122('0x46')]['id']){delete _0x2cb7f6[_0x5122('0x46')]['id'];}return db[_0x5122('0x29')]['find']({'where':{'id':_0x2cb7f6[_0x5122('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a6163,null))[_0x5122('0x22')](saveUpdates(_0x2cb7f6[_0x5122('0x46')],null))['then'](respondWithResult(_0x1a6163,null))[_0x5122('0x40')](handleError(_0x1a6163,null));};exports[_0x5122('0x48')]=function(_0x4b070c,_0x3822cd){return db[_0x5122('0x29')][_0x5122('0x49')]({'where':{'id':_0x4b070c[_0x5122('0x47')]['id']}})['then'](handleEntityNotFound(_0x3822cd,null))[_0x5122('0x22')](removeEntity(_0x3822cd,null))[_0x5122('0x40')](handleError(_0x3822cd,null));};exports[_0x5122('0x4a')]=function(_0x5ebde8,_0x304a66){return db[_0x5122('0x29')]['describe']()[_0x5122('0x22')](respondWithResult(_0x304a66,null))[_0x5122('0x40')](handleError(_0x304a66,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 00e3d05..15909ae 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2ba7b9,_0x2a0e19){var _0x2ab9d1=function(_0x4a7a35){while(--_0x4a7a35){_0x2ba7b9['push'](_0x2ba7b9['shift']());}};_0x2ab9d1(++_0x2a0e19);}(_0x5fc3,0xa8));var _0x35fc=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x5fc3[_0xa8883];return _0x479426;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x1c2071,_0x219cdf){var _0x307f72=function(_0x1fd6ba){while(--_0x1fd6ba){_0x1c2071['push'](_0x1c2071['shift']());}};_0x307f72(++_0x219cdf);}(_0x326f,0xd1));var _0xf326=function(_0x3d004d,_0x5dcf77){_0x3d004d=_0x3d004d-0x0;var _0x1823ac=_0x326f[_0x3d004d];return _0x1823ac;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 4dadd7f..46702af 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 _0xd290=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x1bc02a,_0x2179ac){var _0x3a8162=function(_0x451697){while(--_0x451697){_0x1bc02a['push'](_0x1bc02a['shift']());}};_0x3a8162(++_0x2179ac);}(_0xd290,0x165));var _0x0d29=function(_0x44ad5e,_0x3b38c5){_0x44ad5e=_0x44ad5e-0x0;var _0x5a0383=_0xd290[_0x44ad5e];return _0x5a0383;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')](_0x488fa2[_0x0d29('0x19')],{'raw':_0x488fa2[_0x0d29('0x1a')]?_0x488fa2['options'][_0x0d29('0x1b')]===undefined?!![]:![]:!![]})[_0x0d29('0xb')](function(_0x215cd7){logger[_0x0d29('0xc')](_0x0d29('0x16'),_0x488fa2);logger[_0x0d29('0xe')](_0x0d29('0x16'),_0x488fa2,JSON[_0x0d29('0x10')](_0x215cd7));_0x2600b3(_0x215cd7);})[_0x0d29('0x15')](function(_0xed8228){logger[_0x0d29('0x11')](_0x0d29('0x16'),_0xed8228[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36['error'](0x1f4,_0xed8228[_0x0d29('0x13')]));});});};exports[_0x0d29('0x1c')]=function(_0x2f0fe2){var _0xd3afa0=this;return new Promise(function(_0x4adc85,_0x249205){return db[_0x0d29('0x17')][_0x0d29('0x1d')](_0x2f0fe2[_0x0d29('0x19')],{'raw':_0x2f0fe2[_0x0d29('0x1a')]?_0x2f0fe2[_0x0d29('0x1a')][_0x0d29('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f0fe2['options']?_0x2f0fe2['options'][_0x0d29('0x1e')]||null:null,'attributes':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['attributes']||null:null,'limit':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['limit']||null:null})[_0x0d29('0xb')](function(_0x5c197f){logger[_0x0d29('0xc')](_0x0d29('0x1c'),_0x2f0fe2);logger['debug'](_0x0d29('0x1c'),_0x2f0fe2,JSON[_0x0d29('0x10')](_0x5c197f));_0x4adc85(_0x5c197f);})[_0x0d29('0x15')](function(_0x58caa6){logger[_0x0d29('0x11')](_0x0d29('0x1c'),_0x58caa6[_0x0d29('0x13')],_0x2f0fe2);_0x249205(_0xd3afa0[_0x0d29('0x11')](0x1f4,_0x58caa6[_0x0d29('0x13')]));});});}; \ No newline at end of file +var _0xe9e8=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','then'];(function(_0x305a91,_0x182183){var _0x504092=function(_0x2c15d7){while(--_0x2c15d7){_0x305a91['push'](_0x305a91['shift']());}};_0x504092(++_0x182183);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x1aa1d7,_0x539b35){_0x1aa1d7=_0x1aa1d7-0x0;var _0x3d41de=_0xe9e8[_0x1aa1d7];return _0x3d41de;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});}exports['CreateOpenchannelQueueReport']=function(_0x42f8e8){var _0x40f4fd=this;return new Promise(function(_0x41cdc0,_0x28584b){return db[_0x8e9e('0x18')][_0x8e9e('0x19')](_0x42f8e8[_0x8e9e('0x1a')],{'raw':_0x42f8e8['options']?_0x42f8e8[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8e9e('0x1c')](function(_0x19a890){logger['info'](_0x8e9e('0x1d'),_0x42f8e8);logger[_0x8e9e('0xf')](_0x8e9e('0x1d'),_0x42f8e8,JSON[_0x8e9e('0x12')](_0x19a890));_0x41cdc0(_0x19a890);})[_0x8e9e('0x17')](function(_0x6a311b){logger[_0x8e9e('0x13')](_0x8e9e('0x1d'),_0x6a311b['message'],_0x42f8e8);_0x28584b(_0x40f4fd['error'](0x1f4,_0x6a311b[_0x8e9e('0x15')]));});});};exports[_0x8e9e('0x1e')]=function(_0x2ad495){var _0x5a1e59=this;return new Promise(function(_0x2d6190,_0x5d2128){return db[_0x8e9e('0x18')][_0x8e9e('0x1f')](_0x2ad495[_0x8e9e('0x1a')],{'raw':_0x2ad495['options']?_0x2ad495[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad495['options']?_0x2ad495[_0x8e9e('0x1b')]['where']||null:null,'attributes':_0x2ad495[_0x8e9e('0x1b')]?_0x2ad495['options'][_0x8e9e('0x20')]||null:null,'limit':_0x2ad495[_0x8e9e('0x1b')]?_0x2ad495['options'][_0x8e9e('0x21')]||null:null})[_0x8e9e('0x1c')](function(_0x2be576){logger[_0x8e9e('0xd')](_0x8e9e('0x1e'),_0x2ad495);logger[_0x8e9e('0xf')](_0x8e9e('0x1e'),_0x2ad495,JSON[_0x8e9e('0x12')](_0x2be576));_0x2d6190(_0x2be576);})[_0x8e9e('0x17')](function(_0x4ca308){logger[_0x8e9e('0x13')](_0x8e9e('0x1e'),_0x4ca308[_0x8e9e('0x15')],_0x2ad495);_0x5d2128(_0x5a1e59[_0x8e9e('0x13')](0x1f4,_0x4ca308['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7f856fb..8045eec 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 _0xcc9a=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x3f4315,_0xd6ec89){var _0x5842e3=function(_0x4b12f5){while(--_0x4b12f5){_0x3f4315['push'](_0x3f4315['shift']());}};_0x5842e3(++_0xd6ec89);}(_0xcc9a,0x1aa));var _0xacc9=function(_0x3bffe9,_0x1f4453){_0x3bffe9=_0x3bffe9-0x0;var _0x499f82=_0xcc9a[_0x3bffe9];return _0x499f82;};'use strict';var multer=require(_0xacc9('0x0'));var util=require(_0xacc9('0x1'));var path=require(_0xacc9('0x2'));var timeout=require(_0xacc9('0x3'));var express=require('express');var router=express[_0xacc9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xacc9('0x5'));var interaction=require(_0xacc9('0x6'));var config=require(_0xacc9('0x7'));var controller=require(_0xacc9('0x8'));router[_0xacc9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xacc9('0x9')](_0xacc9('0xa'),auth[_0xacc9('0xb')](),controller[_0xacc9('0xc')]);router[_0xacc9('0x9')](_0xacc9('0xd'),auth[_0xacc9('0xb')](),controller['show']);router[_0xacc9('0xe')]('/',auth[_0xacc9('0xb')](),controller[_0xacc9('0xf')]);router[_0xacc9('0x10')](_0xacc9('0xd'),auth[_0xacc9('0xb')](),controller[_0xacc9('0x11')]);router[_0xacc9('0x12')](_0xacc9('0xd'),auth[_0xacc9('0xb')](),controller[_0xacc9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x77da=['/:id','isAuthenticated','post','create','put','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','describe'];(function(_0x28e9cd,_0x3da3db){var _0xf02d83=function(_0x1ba24a){while(--_0x1ba24a){_0x28e9cd['push'](_0x28e9cd['shift']());}};_0xf02d83(++_0x3da3db);}(_0x77da,0xb2));var _0xa77d=function(_0x24c546,_0x18d878){_0x24c546=_0x24c546-0x0;var _0x1504ea=_0x77da[_0x24c546];return _0x1504ea;};'use strict';var multer=require(_0xa77d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa77d('0x1'));var router=express[_0xa77d('0x2')]();var fs_extra=require(_0xa77d('0x3'));var auth=require(_0xa77d('0x4'));var interaction=require(_0xa77d('0x5'));var config=require(_0xa77d('0x6'));var controller=require(_0xa77d('0x7'));router[_0xa77d('0x8')]('/',auth['isAuthenticated'](),controller[_0xa77d('0x9')]);router['get'](_0xa77d('0xa'),auth['isAuthenticated'](),controller[_0xa77d('0xb')]);router[_0xa77d('0x8')](_0xa77d('0xc'),auth[_0xa77d('0xd')](),controller['show']);router[_0xa77d('0xe')]('/',auth[_0xa77d('0xd')](),controller[_0xa77d('0xf')]);router[_0xa77d('0x10')](_0xa77d('0xc'),auth[_0xa77d('0xd')](),controller['update']);router['delete'](_0xa77d('0xc'),auth[_0xa77d('0xd')](),controller[_0xa77d('0x11')]);module[_0xa77d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1cab7cf..10620bf 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5426a2,_0x4c9f21){var _0x1c7453=function(_0x4f6e55){while(--_0x4f6e55){_0x5426a2['push'](_0x5426a2['shift']());}};_0x1c7453(++_0x4c9f21);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c3c5b,_0x3d57a2){_0x4c3c5b=_0x4c3c5b-0x0;var _0x2236f1=_0xedd9[_0x4c3c5b];return _0x2236f1;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3a8758,_0x347f09){var _0x3f5450=function(_0x16cfaf){while(--_0x16cfaf){_0x3a8758['push'](_0x3a8758['shift']());}};_0x3f5450(++_0x347f09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index dc24716..a42751f 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 _0xa7ae=['../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','OpenchannelTransferReport','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x16f77c,_0x5256b1){var _0x78986e=function(_0x10430){while(--_0x10430){_0x16f77c['push'](_0x16f77c['shift']());}};_0x78986e(++_0x5256b1);}(_0xa7ae,0x89));var _0xea7a=function(_0x26ad20,_0x49da86){_0x26ad20=_0x26ad20-0x0;var _0x2095fd=_0xa7ae[_0x26ad20];return _0x2095fd;};'use strict';var emlformat=require(_0xea7a('0x0'));var rimraf=require(_0xea7a('0x1'));var zipdir=require(_0xea7a('0x2'));var jsonpatch=require(_0xea7a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xea7a('0x4'));var Mustache=require(_0xea7a('0x5'));var util=require('util');var path=require(_0xea7a('0x6'));var sox=require(_0xea7a('0x7'));var csv=require(_0xea7a('0x8'));var ejs=require(_0xea7a('0x9'));var fs=require('fs');var fs_extra=require(_0xea7a('0xa'));var _=require(_0xea7a('0xb'));var squel=require(_0xea7a('0xc'));var crypto=require('crypto');var jsforce=require(_0xea7a('0xd'));var deskjs=require(_0xea7a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea7a('0xf'));var Papa=require(_0xea7a('0x10'));var Redis=require(_0xea7a('0x11'));var authService=require(_0xea7a('0x12'));var qs=require(_0xea7a('0x13'));var as=require(_0xea7a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea7a('0x15'))(_0xea7a('0x16'));var utils=require(_0xea7a('0x17'));var config=require(_0xea7a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f05b7,_0x471cdf){_0x471cdf=_0x471cdf||0xcc;return function(_0x5e7f9c){if(_0x5e7f9c){return _0x5f05b7[_0xea7a('0x19')](_0x471cdf);}return _0x5f05b7[_0xea7a('0x1a')](_0x471cdf)['end']();};}function respondWithResult(_0x21f7e0,_0x3b6dcb){_0x3b6dcb=_0x3b6dcb||0xc8;return function(_0x4a4ee7){if(_0x4a4ee7){return _0x21f7e0[_0xea7a('0x1a')](_0x3b6dcb)['json'](_0x4a4ee7);}};}function respondWithFilteredResult(_0x41d566,_0x349e55){return function(_0x57e3cb){if(_0x57e3cb){var _0x8df62a=typeof _0x349e55[_0xea7a('0x1b')]===_0xea7a('0x1c')&&typeof _0x349e55[_0xea7a('0x1d')]===_0xea7a('0x1c');var _0x3cdf83=_0x57e3cb[_0xea7a('0x1e')];var _0x5cba8c=_0x8df62a?0x0:_0x349e55[_0xea7a('0x1b')];var _0x5cbc37=_0x8df62a?_0x57e3cb[_0xea7a('0x1e')]:_0x349e55['offset']+_0x349e55[_0xea7a('0x1d')];var _0xe0c739;if(_0x5cbc37>=_0x3cdf83){_0x5cbc37=_0x3cdf83;_0xe0c739=0xc8;}else{_0xe0c739=0xce;}_0x41d566[_0xea7a('0x1a')](_0xe0c739);return _0x41d566['set'](_0xea7a('0x1f'),_0x5cba8c+'-'+_0x5cbc37+'/'+_0x3cdf83)[_0xea7a('0x20')](_0x57e3cb);}return null;};}function patchUpdates(_0x2d8bfa){return function(_0x4488e3){try{jsonpatch[_0xea7a('0x21')](_0x4488e3,_0x2d8bfa,!![]);}catch(_0x1ce5ba){return BPromise[_0xea7a('0x22')](_0x1ce5ba);}return _0x4488e3[_0xea7a('0x23')]();};}function saveUpdates(_0x42dd0c,_0x3f5533){return function(_0x403413){if(_0x403413){return _0x403413[_0xea7a('0x24')](_0x42dd0c)[_0xea7a('0x25')](function(_0x380513){return _0x380513;});}return null;};}function removeEntity(_0x150b95,_0x37bec4){return function(_0x57c5c7){if(_0x57c5c7){return _0x57c5c7[_0xea7a('0x26')]()[_0xea7a('0x25')](function(){_0x150b95[_0xea7a('0x1a')](0xcc)[_0xea7a('0x27')]();});}};}function handleEntityNotFound(_0x18ec9f,_0x5d7043){return function(_0x5c9e6e){if(!_0x5c9e6e){_0x18ec9f[_0xea7a('0x19')](0x194);}return _0x5c9e6e;};}function handleError(_0x271c11,_0x2b6767){_0x2b6767=_0x2b6767||0x1f4;return function(_0x4c53f7){logger[_0xea7a('0x28')](_0x4c53f7[_0xea7a('0x29')]);if(_0x4c53f7['name']){delete _0x4c53f7[_0xea7a('0x2a')];}_0x271c11[_0xea7a('0x1a')](_0x2b6767)[_0xea7a('0x2b')](_0x4c53f7);};}exports[_0xea7a('0x2c')]=function(_0x2ecc1d,_0xf62fb2){var _0x473983={},_0x5deda7={},_0x32c375={'count':0x0,'rows':[]};var _0x1119ee=_[_0xea7a('0x2d')](db['OpenchannelTransferReport'][_0xea7a('0x2e')],function(_0x3b11ea){return{'name':_0x3b11ea[_0xea7a('0x2f')],'type':_0x3b11ea['type'][_0xea7a('0x30')]};});_0x5deda7['model']=_[_0xea7a('0x2d')](_0x1119ee,_0xea7a('0x2a'));_0x5deda7['query']=_['keys'](_0x2ecc1d[_0xea7a('0x31')]);_0x5deda7[_0xea7a('0x32')]=_[_0xea7a('0x33')](_0x5deda7[_0xea7a('0x34')],_0x5deda7['query']);_0x473983['attributes']=_[_0xea7a('0x33')](_0x5deda7[_0xea7a('0x34')],qs['fields'](_0x2ecc1d[_0xea7a('0x31')][_0xea7a('0x35')]));_0x473983['attributes']=_0x473983[_0xea7a('0x36')][_0xea7a('0x37')]?_0x473983[_0xea7a('0x36')]:_0x5deda7['model'];if(!_0x2ecc1d[_0xea7a('0x31')][_0xea7a('0x38')](_0xea7a('0x39'))){_0x473983[_0xea7a('0x1d')]=qs['limit'](_0x2ecc1d[_0xea7a('0x31')][_0xea7a('0x1d')]);_0x473983[_0xea7a('0x1b')]=qs[_0xea7a('0x1b')](_0x2ecc1d[_0xea7a('0x31')]['offset']);}_0x473983[_0xea7a('0x3a')]=qs[_0xea7a('0x3b')](_0x2ecc1d[_0xea7a('0x31')][_0xea7a('0x3b')]);_0x473983['where']=qs['filters'](_[_0xea7a('0x3c')](_0x2ecc1d[_0xea7a('0x31')],_0x5deda7[_0xea7a('0x32')]),_0x1119ee);if(_0x2ecc1d[_0xea7a('0x31')][_0xea7a('0x3d')]){_0x473983['where']=_['merge'](_0x473983[_0xea7a('0x3e')],{'$or':_[_0xea7a('0x2d')](_0x1119ee,function(_0x4ce578){if(_0x4ce578[_0xea7a('0x3f')]!==_0xea7a('0x40')){var _0x30623a={};_0x30623a[_0x4ce578['name']]={'$like':'%'+_0x2ecc1d[_0xea7a('0x31')]['filter']+'%'};return _0x30623a;}})});}_0x473983=_[_0xea7a('0x41')]({},_0x473983,_0x2ecc1d[_0xea7a('0x42')]);var _0x23ff48={'where':_0x473983[_0xea7a('0x3e')]};return db['OpenchannelTransferReport'][_0xea7a('0x1e')](_0x23ff48)[_0xea7a('0x25')](function(_0x2af38b){_0x32c375[_0xea7a('0x1e')]=_0x2af38b;if(_0x2ecc1d['query'][_0xea7a('0x43')]){_0x473983[_0xea7a('0x44')]=[{'all':!![]}];}return db[_0xea7a('0x45')][_0xea7a('0x46')](_0x473983);})[_0xea7a('0x25')](function(_0x34d64f){_0x32c375[_0xea7a('0x47')]=_0x34d64f;return _0x32c375;})[_0xea7a('0x25')](respondWithFilteredResult(_0xf62fb2,_0x473983))[_0xea7a('0x48')](handleError(_0xf62fb2,null));};exports[_0xea7a('0x49')]=function(_0x141790,_0x4d7036){var _0x29604a={'raw':!![],'where':{'id':_0x141790[_0xea7a('0x4a')]['id']}},_0x2ec0cf={};_0x2ec0cf[_0xea7a('0x34')]=_[_0xea7a('0x4b')](db[_0xea7a('0x45')][_0xea7a('0x2e')]);_0x2ec0cf[_0xea7a('0x31')]=_[_0xea7a('0x4b')](_0x141790['query']);_0x2ec0cf['filters']=_[_0xea7a('0x33')](_0x2ec0cf[_0xea7a('0x34')],_0x2ec0cf[_0xea7a('0x31')]);_0x29604a[_0xea7a('0x36')]=_['intersection'](_0x2ec0cf[_0xea7a('0x34')],qs[_0xea7a('0x35')](_0x141790[_0xea7a('0x31')][_0xea7a('0x35')]));_0x29604a['attributes']=_0x29604a[_0xea7a('0x36')][_0xea7a('0x37')]?_0x29604a[_0xea7a('0x36')]:_0x2ec0cf['model'];if(_0x141790[_0xea7a('0x31')][_0xea7a('0x43')]){_0x29604a['include']=[{'all':!![]}];}_0x29604a=_[_0xea7a('0x41')]({},_0x29604a,_0x141790[_0xea7a('0x42')]);return db['OpenchannelTransferReport'][_0xea7a('0x4c')](_0x29604a)[_0xea7a('0x25')](handleEntityNotFound(_0x4d7036,null))[_0xea7a('0x25')](respondWithResult(_0x4d7036,null))[_0xea7a('0x48')](handleError(_0x4d7036,null));};exports['create']=function(_0x2fba5d,_0x5c2041){return db[_0xea7a('0x45')][_0xea7a('0x4d')](_0x2fba5d[_0xea7a('0x4e')],{})[_0xea7a('0x25')](respondWithResult(_0x5c2041,0xc9))['catch'](handleError(_0x5c2041,null));};exports['update']=function(_0x1fd3cd,_0x125678){if(_0x1fd3cd['body']['id']){delete _0x1fd3cd[_0xea7a('0x4e')]['id'];}return db[_0xea7a('0x45')]['find']({'where':{'id':_0x1fd3cd[_0xea7a('0x4a')]['id']}})[_0xea7a('0x25')](handleEntityNotFound(_0x125678,null))[_0xea7a('0x25')](saveUpdates(_0x1fd3cd[_0xea7a('0x4e')],null))[_0xea7a('0x25')](respondWithResult(_0x125678,null))[_0xea7a('0x48')](handleError(_0x125678,null));};exports[_0xea7a('0x26')]=function(_0x5a5396,_0x2d93ee){return db[_0xea7a('0x45')][_0xea7a('0x4c')]({'where':{'id':_0x5a5396[_0xea7a('0x4a')]['id']}})[_0xea7a('0x25')](handleEntityNotFound(_0x2d93ee,null))[_0xea7a('0x25')](removeEntity(_0x2d93ee,null))[_0xea7a('0x48')](handleError(_0x2d93ee,null));};exports['describe']=function(_0x5c0559,_0x17c568){return db['OpenchannelTransferReport'][_0xea7a('0x4f')]()[_0xea7a('0x25')](respondWithResult(_0x17c568,null))['catch'](handleError(_0x17c568,null));}; \ No newline at end of file +var _0x3716=['status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','OpenchannelTransferReport','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x3716,0x122));var _0x6371=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x3716[_0x3c59fc];return _0x2b78d4;};'use strict';var emlformat=require(_0x6371('0x0'));var rimraf=require(_0x6371('0x1'));var zipdir=require(_0x6371('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6371('0x3'));var moment=require('moment');var BPromise=require(_0x6371('0x4'));var Mustache=require(_0x6371('0x5'));var util=require(_0x6371('0x6'));var path=require(_0x6371('0x7'));var sox=require(_0x6371('0x8'));var csv=require(_0x6371('0x9'));var ejs=require(_0x6371('0xa'));var fs=require('fs');var fs_extra=require(_0x6371('0xb'));var _=require(_0x6371('0xc'));var squel=require(_0x6371('0xd'));var crypto=require(_0x6371('0xe'));var jsforce=require(_0x6371('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6371('0x9'));var querystring=require(_0x6371('0x10'));var Papa=require('papaparse');var Redis=require(_0x6371('0x11'));var authService=require(_0x6371('0x12'));var qs=require(_0x6371('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6371('0x14'));var logger=require(_0x6371('0x15'))(_0x6371('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6371('0x17'));var db=require(_0x6371('0x18'))['db'];function respondWithStatusCode(_0x10c5f5,_0x2e7bc5){_0x2e7bc5=_0x2e7bc5||0xcc;return function(_0x42ad93){if(_0x42ad93){return _0x10c5f5['sendStatus'](_0x2e7bc5);}return _0x10c5f5['status'](_0x2e7bc5)[_0x6371('0x19')]();};}function respondWithResult(_0x26a358,_0xf7a63d){_0xf7a63d=_0xf7a63d||0xc8;return function(_0x3b4d70){if(_0x3b4d70){return _0x26a358[_0x6371('0x1a')](_0xf7a63d)[_0x6371('0x1b')](_0x3b4d70);}};}function respondWithFilteredResult(_0x18ce7c,_0x40f838){return function(_0x1f6a55){if(_0x1f6a55){var _0x178db0=typeof _0x40f838['offset']===_0x6371('0x1c')&&typeof _0x40f838[_0x6371('0x1d')]===_0x6371('0x1c');var _0x4082d5=_0x1f6a55[_0x6371('0x1e')];var _0xf9889a=_0x178db0?0x0:_0x40f838[_0x6371('0x1f')];var _0x357e1d=_0x178db0?_0x1f6a55[_0x6371('0x1e')]:_0x40f838['offset']+_0x40f838[_0x6371('0x1d')];var _0xb2db05;if(_0x357e1d>=_0x4082d5){_0x357e1d=_0x4082d5;_0xb2db05=0xc8;}else{_0xb2db05=0xce;}_0x18ce7c['status'](_0xb2db05);return _0x18ce7c[_0x6371('0x20')](_0x6371('0x21'),_0xf9889a+'-'+_0x357e1d+'/'+_0x4082d5)[_0x6371('0x1b')](_0x1f6a55);}return null;};}function patchUpdates(_0x1f5606){return function(_0x4c15e6){try{jsonpatch[_0x6371('0x22')](_0x4c15e6,_0x1f5606,!![]);}catch(_0x39be30){return BPromise[_0x6371('0x23')](_0x39be30);}return _0x4c15e6[_0x6371('0x24')]();};}function saveUpdates(_0x4ce931,_0x4043c9){return function(_0x57c988){if(_0x57c988){return _0x57c988[_0x6371('0x25')](_0x4ce931)['then'](function(_0x3cc2de){return _0x3cc2de;});}return null;};}function removeEntity(_0x306c7d,_0xa3958e){return function(_0x3ee8bb){if(_0x3ee8bb){return _0x3ee8bb[_0x6371('0x26')]()['then'](function(){_0x306c7d[_0x6371('0x1a')](0xcc)[_0x6371('0x19')]();});}};}function handleEntityNotFound(_0x6651f5,_0x3271a7){return function(_0x2c5ccc){if(!_0x2c5ccc){_0x6651f5[_0x6371('0x27')](0x194);}return _0x2c5ccc;};}function handleError(_0x3ed193,_0x59d2fe){_0x59d2fe=_0x59d2fe||0x1f4;return function(_0x1e31ec){logger['error'](_0x1e31ec[_0x6371('0x28')]);if(_0x1e31ec[_0x6371('0x29')]){delete _0x1e31ec[_0x6371('0x29')];}_0x3ed193['status'](_0x59d2fe)[_0x6371('0x2a')](_0x1e31ec);};}exports[_0x6371('0x2b')]=function(_0xf5de31,_0x37fabc){var _0x103f71={},_0x151b80={},_0x4fe761={'count':0x0,'rows':[]};var _0x519cdc=_[_0x6371('0x2c')](db['OpenchannelTransferReport'][_0x6371('0x2d')],function(_0x1c6686){return{'name':_0x1c6686[_0x6371('0x2e')],'type':_0x1c6686[_0x6371('0x2f')][_0x6371('0x30')]};});_0x151b80[_0x6371('0x31')]=_[_0x6371('0x2c')](_0x519cdc,'name');_0x151b80[_0x6371('0x32')]=_[_0x6371('0x33')](_0xf5de31['query']);_0x151b80['filters']=_[_0x6371('0x34')](_0x151b80[_0x6371('0x31')],_0x151b80[_0x6371('0x32')]);_0x103f71[_0x6371('0x35')]=_[_0x6371('0x34')](_0x151b80[_0x6371('0x31')],qs[_0x6371('0x36')](_0xf5de31[_0x6371('0x32')][_0x6371('0x36')]));_0x103f71[_0x6371('0x35')]=_0x103f71[_0x6371('0x35')]['length']?_0x103f71[_0x6371('0x35')]:_0x151b80[_0x6371('0x31')];if(!_0xf5de31[_0x6371('0x32')]['hasOwnProperty'](_0x6371('0x37'))){_0x103f71[_0x6371('0x1d')]=qs['limit'](_0xf5de31[_0x6371('0x32')]['limit']);_0x103f71[_0x6371('0x1f')]=qs[_0x6371('0x1f')](_0xf5de31['query'][_0x6371('0x1f')]);}_0x103f71[_0x6371('0x38')]=qs[_0x6371('0x39')](_0xf5de31['query'][_0x6371('0x39')]);_0x103f71[_0x6371('0x3a')]=qs['filters'](_[_0x6371('0x3b')](_0xf5de31['query'],_0x151b80[_0x6371('0x3c')]),_0x519cdc);if(_0xf5de31['query'][_0x6371('0x3d')]){_0x103f71['where']=_[_0x6371('0x3e')](_0x103f71['where'],{'$or':_[_0x6371('0x2c')](_0x519cdc,function(_0x56fc33){if(_0x56fc33[_0x6371('0x2f')]!==_0x6371('0x3f')){var _0x5e2b52={};_0x5e2b52[_0x56fc33[_0x6371('0x29')]]={'$like':'%'+_0xf5de31[_0x6371('0x32')][_0x6371('0x3d')]+'%'};return _0x5e2b52;}})});}_0x103f71=_[_0x6371('0x3e')]({},_0x103f71,_0xf5de31[_0x6371('0x40')]);var _0x10a7a8={'where':_0x103f71[_0x6371('0x3a')]};return db[_0x6371('0x41')][_0x6371('0x1e')](_0x10a7a8)[_0x6371('0x42')](function(_0x4b29e8){_0x4fe761['count']=_0x4b29e8;if(_0xf5de31[_0x6371('0x32')][_0x6371('0x43')]){_0x103f71[_0x6371('0x44')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x6371('0x45')](_0x103f71);})['then'](function(_0xca0953){_0x4fe761[_0x6371('0x46')]=_0xca0953;return _0x4fe761;})[_0x6371('0x42')](respondWithFilteredResult(_0x37fabc,_0x103f71))[_0x6371('0x47')](handleError(_0x37fabc,null));};exports[_0x6371('0x48')]=function(_0x2ca79f,_0x25dda0){var _0xf29b57={'raw':!![],'where':{'id':_0x2ca79f[_0x6371('0x49')]['id']}},_0x1cea15={};_0x1cea15[_0x6371('0x31')]=_['keys'](db[_0x6371('0x41')]['rawAttributes']);_0x1cea15[_0x6371('0x32')]=_[_0x6371('0x33')](_0x2ca79f[_0x6371('0x32')]);_0x1cea15[_0x6371('0x3c')]=_[_0x6371('0x34')](_0x1cea15[_0x6371('0x31')],_0x1cea15[_0x6371('0x32')]);_0xf29b57['attributes']=_[_0x6371('0x34')](_0x1cea15[_0x6371('0x31')],qs[_0x6371('0x36')](_0x2ca79f[_0x6371('0x32')][_0x6371('0x36')]));_0xf29b57[_0x6371('0x35')]=_0xf29b57[_0x6371('0x35')][_0x6371('0x4a')]?_0xf29b57[_0x6371('0x35')]:_0x1cea15['model'];if(_0x2ca79f[_0x6371('0x32')][_0x6371('0x43')]){_0xf29b57[_0x6371('0x44')]=[{'all':!![]}];}_0xf29b57=_['merge']({},_0xf29b57,_0x2ca79f[_0x6371('0x40')]);return db[_0x6371('0x41')][_0x6371('0x4b')](_0xf29b57)[_0x6371('0x42')](handleEntityNotFound(_0x25dda0,null))[_0x6371('0x42')](respondWithResult(_0x25dda0,null))[_0x6371('0x47')](handleError(_0x25dda0,null));};exports[_0x6371('0x4c')]=function(_0x46a7a2,_0x45c0c9){return db['OpenchannelTransferReport']['create'](_0x46a7a2[_0x6371('0x4d')],{})[_0x6371('0x42')](respondWithResult(_0x45c0c9,0xc9))[_0x6371('0x47')](handleError(_0x45c0c9,null));};exports[_0x6371('0x25')]=function(_0x48ec4e,_0x369dee){if(_0x48ec4e[_0x6371('0x4d')]['id']){delete _0x48ec4e[_0x6371('0x4d')]['id'];}return db[_0x6371('0x41')][_0x6371('0x4b')]({'where':{'id':_0x48ec4e['params']['id']}})[_0x6371('0x42')](handleEntityNotFound(_0x369dee,null))[_0x6371('0x42')](saveUpdates(_0x48ec4e[_0x6371('0x4d')],null))[_0x6371('0x42')](respondWithResult(_0x369dee,null))[_0x6371('0x47')](handleError(_0x369dee,null));};exports[_0x6371('0x26')]=function(_0x5147f6,_0x2d8256){return db['OpenchannelTransferReport'][_0x6371('0x4b')]({'where':{'id':_0x5147f6['params']['id']}})[_0x6371('0x42')](handleEntityNotFound(_0x2d8256,null))[_0x6371('0x42')](removeEntity(_0x2d8256,null))[_0x6371('0x47')](handleError(_0x2d8256,null));};exports[_0x6371('0x4e')]=function(_0x36b9de,_0x30d3be){return db[_0x6371('0x41')]['describe']()[_0x6371('0x42')](respondWithResult(_0x30d3be,null))[_0x6371('0x47')](handleError(_0x30d3be,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 30b4f04..1313bba 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 _0x4786=['util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','uniqueid'];(function(_0x4e5609,_0x5b8221){var _0x1e2a19=function(_0x375ad1){while(--_0x375ad1){_0x4e5609['push'](_0x4e5609['shift']());}};_0x1e2a19(++_0x5b8221);}(_0x4786,0x1a7));var _0x6478=function(_0x7372c3,_0x28f98f){_0x7372c3=_0x7372c3-0x0;var _0xd1715b=_0x4786[_0x7372c3];return _0xd1715b;};'use strict';var _=require('lodash');var util=require(_0x6478('0x0'));var logger=require(_0x6478('0x1'))(_0x6478('0x2'));var moment=require(_0x6478('0x3'));var BPromise=require('bluebird');var rp=require(_0x6478('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6478('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6478('0x6')]=function(_0x20e740,_0xe5efd1){return _0x20e740[_0x6478('0x7')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6478('0x8'),'fields':[_0x6478('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed5a=['moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','api'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xed5a,0x75));var _0xaed5=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0xed5a[_0x516ffb];return _0x319667;};'use strict';var _=require(_0xaed5('0x0'));var util=require('util');var logger=require(_0xaed5('0x1'))(_0xaed5('0x2'));var moment=require(_0xaed5('0x3'));var BPromise=require(_0xaed5('0x4'));var rp=require(_0xaed5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaed5('0x6'));var config=require('../../config/environment');var attributes=require(_0xaed5('0x7'));module[_0xaed5('0x8')]=function(_0x1e147e,_0x3ef141){return _0x1e147e[_0xaed5('0x9')](_0xaed5('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaed5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c3da827..d372030 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6596=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug'];(function(_0x42013a,_0x44dc2f){var _0xb1b5d4=function(_0x2f4cee){while(--_0x2f4cee){_0x42013a['push'](_0x42013a['shift']());}};_0xb1b5d4(++_0x44dc2f);}(_0x6596,0x1d3));var _0x6659=function(_0x39fec4,_0x300e24){_0x39fec4=_0x39fec4-0x0;var _0x238bc7=_0x6596[_0x39fec4];return _0x238bc7;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var moment=require('moment');var BPromise=require(_0x6659('0x2'));var rs=require(_0x6659('0x3'));var fs=require('fs');var Redis=require(_0x6659('0x4'));var db=require(_0x6659('0x5'))['db'];var utils=require(_0x6659('0x6'));var logger=require(_0x6659('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6659('0x8'));var client=jayson[_0x6659('0x9')][_0x6659('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ed458,_0x29292b,_0x4a900d){return new BPromise(function(_0x485ea0,_0x24bfdf){return client[_0x6659('0xb')](_0x1ed458,_0x4a900d)[_0x6659('0xc')](function(_0x2aee6e){logger[_0x6659('0xd')](_0x6659('0xe'),_0x29292b,'request\x20sent');logger[_0x6659('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x29292b,'request\x20sent',JSON[_0x6659('0x10')](_0x2aee6e));if(_0x2aee6e['error']){if(_0x2aee6e[_0x6659('0x11')][_0x6659('0x12')]===0x1f4){logger[_0x6659('0x11')](_0x6659('0xe'),_0x29292b,_0x2aee6e['error'][_0x6659('0x13')]);return _0x24bfdf(_0x2aee6e[_0x6659('0x11')]['message']);}logger[_0x6659('0x11')](_0x6659('0xe'),_0x29292b,_0x2aee6e[_0x6659('0x11')][_0x6659('0x13')]);return _0x485ea0(_0x2aee6e[_0x6659('0x11')][_0x6659('0x13')]);}else{logger['info'](_0x6659('0xe'),_0x29292b,_0x6659('0x14'));_0x485ea0(_0x2aee6e[_0x6659('0x15')][_0x6659('0x13')]);}})[_0x6659('0x16')](function(_0x75836a){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x29292b,_0x75836a);_0x24bfdf(_0x75836a);});});} \ No newline at end of file +var _0x9f5a=['client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x38a9ee,_0x42b080){var _0x2f3320=function(_0x4e71dd){while(--_0x4e71dd){_0x38a9ee['push'](_0x38a9ee['shift']());}};_0x2f3320(++_0x42b080);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x45285e,_0x5c1aaa){_0x45285e=_0x45285e-0x0;var _0x580fe9=_0x9f5a[_0x45285e];return _0x580fe9;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var moment=require(_0xa9f5('0x2'));var BPromise=require(_0xa9f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];var utils=require(_0xa9f5('0x6'));var logger=require('../../config/logger')(_0xa9f5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9f5('0x8'));var client=jayson[_0xa9f5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c040d,_0x285dad,_0x3f644f){return new BPromise(function(_0x1f6c78,_0x21006b){return client[_0xa9f5('0xa')](_0x6c040d,_0x3f644f)[_0xa9f5('0xb')](function(_0x4cb5a5){logger[_0xa9f5('0xc')](_0xa9f5('0xd'),_0x285dad,'request\x20sent');logger[_0xa9f5('0xe')](_0xa9f5('0xf'),_0x285dad,'request\x20sent',JSON['stringify'](_0x4cb5a5));if(_0x4cb5a5[_0xa9f5('0x10')]){if(_0x4cb5a5[_0xa9f5('0x10')][_0xa9f5('0x11')]===0x1f4){logger[_0xa9f5('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x285dad,_0x4cb5a5[_0xa9f5('0x10')][_0xa9f5('0x12')]);return _0x21006b(_0x4cb5a5[_0xa9f5('0x10')]['message']);}logger[_0xa9f5('0x10')](_0xa9f5('0xd'),_0x285dad,_0x4cb5a5['error']['message']);return _0x1f6c78(_0x4cb5a5['error'][_0xa9f5('0x12')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x285dad,_0xa9f5('0x13'));_0x1f6c78(_0x4cb5a5[_0xa9f5('0x14')][_0xa9f5('0x12')]);}})[_0xa9f5('0x15')](function(_0x4c70f0){logger[_0xa9f5('0x10')](_0xa9f5('0xd'),_0x285dad,_0x4c70f0);_0x21006b(_0x4c70f0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9636493..ac746ca 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 _0x6cd3=['isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6cd3,0x1cc));var _0x36cd=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x6cd3[_0x5e77db];return _0x34b675;};'use strict';var multer=require(_0x36cd('0x0'));var util=require(_0x36cd('0x1'));var path=require('path');var timeout=require(_0x36cd('0x2'));var express=require(_0x36cd('0x3'));var router=express[_0x36cd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36cd('0x5'));var config=require(_0x36cd('0x6'));var controller=require(_0x36cd('0x7'));router['get']('/',auth[_0x36cd('0x8')](),controller[_0x36cd('0x9')]);router[_0x36cd('0xa')](_0x36cd('0xb'),auth[_0x36cd('0x8')](),controller[_0x36cd('0xc')]);router[_0x36cd('0xd')]('/',auth[_0x36cd('0x8')](),controller[_0x36cd('0xe')]);router[_0x36cd('0xf')](_0x36cd('0xb'),auth[_0x36cd('0x8')](),controller['update']);router['delete'](_0x36cd('0xb'),auth['isAuthenticated'](),controller[_0x36cd('0x10')]);module[_0x36cd('0x11')]=router; \ No newline at end of file +var _0x3fef=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3fef,0x1a5));var _0xf3fe=function(_0xb533c1,_0x52e2b2){_0xb533c1=_0xb533c1-0x0;var _0x582c36=_0x3fef[_0xb533c1];return _0x582c36;};'use strict';var multer=require(_0xf3fe('0x0'));var util=require(_0xf3fe('0x1'));var path=require(_0xf3fe('0x2'));var timeout=require(_0xf3fe('0x3'));var express=require('express');var router=express[_0xf3fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf3fe('0x6'));var controller=require('./pause.controller');router[_0xf3fe('0x7')]('/',auth[_0xf3fe('0x8')](),controller['index']);router[_0xf3fe('0x7')](_0xf3fe('0x9'),auth['isAuthenticated'](),controller[_0xf3fe('0xa')]);router['post']('/',auth[_0xf3fe('0x8')](),controller['create']);router[_0xf3fe('0xb')](_0xf3fe('0x9'),auth[_0xf3fe('0x8')](),controller[_0xf3fe('0xc')]);router[_0xf3fe('0xd')](_0xf3fe('0x9'),auth[_0xf3fe('0x8')](),controller['destroy']);module[_0xf3fe('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 624fc01..d4d4e91 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 _0xa38f=['exports','sequelize'];(function(_0x95307c,_0x55cc74){var _0x28b7c3=function(_0x3d6123){while(--_0x3d6123){_0x95307c['push'](_0x95307c['shift']());}};_0x28b7c3(++_0x55cc74);}(_0xa38f,0x99));var _0xfa38=function(_0x5e01af,_0x26a03b){_0x5e01af=_0x5e01af-0x0;var _0x2ff34b=_0xa38f[_0x5e01af];return _0x2ff34b;};'use strict';var Sequelize=require(_0xfa38('0x0'));module[_0xfa38('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e5a=['exports','name','STRING','sequelize'];(function(_0x25f4e5,_0x21b1a4){var _0x35b9e1=function(_0x5baa69){while(--_0x5baa69){_0x25f4e5['push'](_0x25f4e5['shift']());}};_0x35b9e1(++_0x21b1a4);}(_0x1e5a,0x173));var _0xa1e5=function(_0xc033f3,_0x4edd5c){_0xc033f3=_0xc033f3-0x0;var _0x57eb11=_0x1e5a[_0xc033f3];return _0x57eb11;};'use strict';var Sequelize=require(_0xa1e5('0x0'));module[_0xa1e5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa1e5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa1e5('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2de0443..ed3c312 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 _0x4945=['catch','show','rawAttributes','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','Pause','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows'];(function(_0x1be8fb,_0x5b7eac){var _0x1b7897=function(_0xb013ed){while(--_0xb013ed){_0x1be8fb['push'](_0x1be8fb['shift']());}};_0x1b7897(++_0x5b7eac);}(_0x4945,0xf9));var _0x5494=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4945[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5494('0x0'));var zipdir=require(_0x5494('0x1'));var jsonpatch=require(_0x5494('0x2'));var rp=require('request-promise');var moment=require(_0x5494('0x3'));var BPromise=require(_0x5494('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5494('0x5'));var csv=require(_0x5494('0x6'));var ejs=require(_0x5494('0x7'));var fs=require('fs');var fs_extra=require(_0x5494('0x8'));var _=require(_0x5494('0x9'));var squel=require(_0x5494('0xa'));var crypto=require(_0x5494('0xb'));var jsforce=require(_0x5494('0xc'));var deskjs=require(_0x5494('0xd'));var toCsv=require(_0x5494('0x6'));var querystring=require('querystring');var Papa=require(_0x5494('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5494('0xf'));var as=require(_0x5494('0x10'));var hardwareService=require(_0x5494('0x11'));var logger=require(_0x5494('0x12'))(_0x5494('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5494('0x14'));var db=require(_0x5494('0x15'))['db'];function respondWithStatusCode(_0x4ad391,_0x5e6405){_0x5e6405=_0x5e6405||0xcc;return function(_0x53c74e){if(_0x53c74e){return _0x4ad391[_0x5494('0x16')](_0x5e6405);}return _0x4ad391[_0x5494('0x17')](_0x5e6405)['end']();};}function respondWithResult(_0x2e5d37,_0x5e0cad){_0x5e0cad=_0x5e0cad||0xc8;return function(_0x50e7a5){if(_0x50e7a5){return _0x2e5d37[_0x5494('0x17')](_0x5e0cad)['json'](_0x50e7a5);}};}function respondWithFilteredResult(_0x23ef75,_0x50ad51){return function(_0x548e38){if(_0x548e38){var _0x5410f4=typeof _0x50ad51['offset']===_0x5494('0x18')&&typeof _0x50ad51['limit']===_0x5494('0x18');var _0xa6e4c6=_0x548e38['count'];var _0x2aebe2=_0x5410f4?0x0:_0x50ad51[_0x5494('0x19')];var _0x450fd3=_0x5410f4?_0x548e38[_0x5494('0x1a')]:_0x50ad51[_0x5494('0x19')]+_0x50ad51[_0x5494('0x1b')];var _0x570085;if(_0x450fd3>=_0xa6e4c6){_0x450fd3=_0xa6e4c6;_0x570085=0xc8;}else{_0x570085=0xce;}_0x23ef75[_0x5494('0x17')](_0x570085);return _0x23ef75[_0x5494('0x1c')](_0x5494('0x1d'),_0x2aebe2+'-'+_0x450fd3+'/'+_0xa6e4c6)[_0x5494('0x1e')](_0x548e38);}return null;};}function patchUpdates(_0x34583f){return function(_0x13e0be){try{jsonpatch[_0x5494('0x1f')](_0x13e0be,_0x34583f,!![]);}catch(_0x584d33){return BPromise[_0x5494('0x20')](_0x584d33);}return _0x13e0be[_0x5494('0x21')]();};}function saveUpdates(_0x331fcd,_0x49ca89){return function(_0x2baabe){if(_0x2baabe){return _0x2baabe['update'](_0x331fcd)['then'](function(_0x343984){return _0x343984;});}return null;};}function removeEntity(_0x55fae5,_0x426341){return function(_0x2cd0f5){if(_0x2cd0f5){return _0x2cd0f5[_0x5494('0x22')]()[_0x5494('0x23')](function(){var _0x1fdc19=_0x2cd0f5[_0x5494('0x24')]({'plain':!![]});var _0x1892a5=_0x5494('0x25');return db[_0x5494('0x26')][_0x5494('0x22')]({'where':{'type':_0x1892a5,'resourceId':_0x1fdc19['id']}})[_0x5494('0x23')](function(){return _0x2cd0f5;});})['then'](function(){_0x55fae5[_0x5494('0x17')](0xcc)[_0x5494('0x27')]();});}};}function handleEntityNotFound(_0x1291da,_0x40c4c0){return function(_0x1a6e7f){if(!_0x1a6e7f){_0x1291da[_0x5494('0x16')](0x194);}return _0x1a6e7f;};}function handleError(_0x3b84bd,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x333e61){logger[_0x5494('0x28')](_0x333e61[_0x5494('0x29')]);if(_0x333e61[_0x5494('0x2a')]){delete _0x333e61[_0x5494('0x2a')];}_0x3b84bd['status'](_0x1c04dd)[_0x5494('0x2b')](_0x333e61);};}exports[_0x5494('0x2c')]=function(_0x18c008,_0x33a9a6){var _0xc471b2={},_0x5026e0={},_0x5722a7={'count':0x0,'rows':[]};var _0x4679dd=_[_0x5494('0x2d')](db[_0x5494('0x2e')]['rawAttributes'],function(_0x2eb718){return{'name':_0x2eb718[_0x5494('0x2f')],'type':_0x2eb718[_0x5494('0x30')][_0x5494('0x31')]};});_0x5026e0[_0x5494('0x32')]=_[_0x5494('0x2d')](_0x4679dd,_0x5494('0x2a'));_0x5026e0['query']=_[_0x5494('0x33')](_0x18c008[_0x5494('0x34')]);_0x5026e0[_0x5494('0x35')]=_[_0x5494('0x36')](_0x5026e0[_0x5494('0x32')],_0x5026e0[_0x5494('0x34')]);_0xc471b2[_0x5494('0x37')]=_[_0x5494('0x36')](_0x5026e0[_0x5494('0x32')],qs[_0x5494('0x38')](_0x18c008[_0x5494('0x34')][_0x5494('0x38')]));_0xc471b2[_0x5494('0x37')]=_0xc471b2[_0x5494('0x37')][_0x5494('0x39')]?_0xc471b2[_0x5494('0x37')]:_0x5026e0[_0x5494('0x32')];if(!_0x18c008[_0x5494('0x34')]['hasOwnProperty'](_0x5494('0x3a'))){_0xc471b2[_0x5494('0x1b')]=qs[_0x5494('0x1b')](_0x18c008['query'][_0x5494('0x1b')]);_0xc471b2[_0x5494('0x19')]=qs[_0x5494('0x19')](_0x18c008[_0x5494('0x34')][_0x5494('0x19')]);}_0xc471b2['order']=qs['sort'](_0x18c008['query'][_0x5494('0x3b')]);_0xc471b2[_0x5494('0x3c')]=qs['filters'](_['pick'](_0x18c008[_0x5494('0x34')],_0x5026e0[_0x5494('0x35')]),_0x4679dd);if(_0x18c008[_0x5494('0x34')][_0x5494('0x3d')]){_0xc471b2[_0x5494('0x3c')]=_[_0x5494('0x3e')](_0xc471b2['where'],{'$or':_[_0x5494('0x2d')](_0x4679dd,function(_0x1435fe){if(_0x1435fe['type']!==_0x5494('0x3f')){var _0x56d1fb={};_0x56d1fb[_0x1435fe[_0x5494('0x2a')]]={'$like':'%'+_0x18c008[_0x5494('0x34')][_0x5494('0x3d')]+'%'};return _0x56d1fb;}})});}_0xc471b2=_[_0x5494('0x3e')]({},_0xc471b2,_0x18c008[_0x5494('0x40')]);var _0x1a6ad8={'where':_0xc471b2[_0x5494('0x3c')]};return db[_0x5494('0x2e')][_0x5494('0x1a')](_0x1a6ad8)[_0x5494('0x23')](function(_0x25afc1){_0x5722a7['count']=_0x25afc1;if(_0x18c008[_0x5494('0x34')]['includeAll']){_0xc471b2['include']=[{'all':!![]}];}return db[_0x5494('0x2e')][_0x5494('0x41')](_0xc471b2);})[_0x5494('0x23')](function(_0x57f222){_0x5722a7[_0x5494('0x42')]=_0x57f222;return _0x5722a7;})['then'](respondWithFilteredResult(_0x33a9a6,_0xc471b2))[_0x5494('0x43')](handleError(_0x33a9a6,null));};exports[_0x5494('0x44')]=function(_0x2eedf2,_0x585c16){var _0x2e4974={'raw':!![],'where':{'id':_0x2eedf2['params']['id']}},_0x41f2dc={};_0x41f2dc['model']=_['keys'](db[_0x5494('0x2e')][_0x5494('0x45')]);_0x41f2dc['query']=_[_0x5494('0x33')](_0x2eedf2[_0x5494('0x34')]);_0x41f2dc[_0x5494('0x35')]=_[_0x5494('0x36')](_0x41f2dc[_0x5494('0x32')],_0x41f2dc[_0x5494('0x34')]);_0x2e4974[_0x5494('0x37')]=_[_0x5494('0x36')](_0x41f2dc[_0x5494('0x32')],qs['fields'](_0x2eedf2['query']['fields']));_0x2e4974[_0x5494('0x37')]=_0x2e4974['attributes']['length']?_0x2e4974[_0x5494('0x37')]:_0x41f2dc['model'];if(_0x2eedf2[_0x5494('0x34')]['includeAll']){_0x2e4974['include']=[{'all':!![]}];}_0x2e4974=_[_0x5494('0x3e')]({},_0x2e4974,_0x2eedf2['options']);return db['Pause'][_0x5494('0x46')](_0x2e4974)[_0x5494('0x23')](handleEntityNotFound(_0x585c16,null))[_0x5494('0x23')](respondWithResult(_0x585c16,null))['catch'](handleError(_0x585c16,null));};exports[_0x5494('0x47')]=function(_0x482c01,_0x81fd29){return db[_0x5494('0x2e')][_0x5494('0x47')](_0x482c01[_0x5494('0x48')],{})['then'](function(_0x224f80){var _0x3146a9=_0x482c01[_0x5494('0x49')]['get']({'plain':!![]});if(!_0x3146a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3146a9['role']===_0x5494('0x49')){var _0x2c7711=_0x224f80['get']({'plain':!![]});var _0x6b5a8a=_0x5494('0x25');return db['UserProfileSection'][_0x5494('0x46')]({'where':{'name':_0x6b5a8a,'userProfileId':_0x3146a9[_0x5494('0x4a')]},'raw':!![]})[_0x5494('0x23')](function(_0x2c7fea){if(_0x2c7fea&&_0x2c7fea[_0x5494('0x4b')]===0x0){return db['UserProfileResource'][_0x5494('0x47')]({'name':_0x2c7711[_0x5494('0x2a')],'resourceId':_0x2c7711['id'],'type':_0x2c7fea[_0x5494('0x2a')],'sectionId':_0x2c7fea['id']},{})[_0x5494('0x23')](function(){return _0x224f80;});}else{return _0x224f80;}})[_0x5494('0x43')](function(_0x2cfab2){logger['error'](_0x5494('0x4c'),_0x2cfab2);throw _0x2cfab2;});}return _0x224f80;})['then'](respondWithResult(_0x81fd29,0xc9))[_0x5494('0x43')](handleError(_0x81fd29,null));};exports[_0x5494('0x4d')]=function(_0x54ec91,_0xd7540){if(_0x54ec91['body']['id']){delete _0x54ec91[_0x5494('0x48')]['id'];}return db['Pause'][_0x5494('0x46')]({'where':{'id':_0x54ec91[_0x5494('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd7540,null))[_0x5494('0x23')](saveUpdates(_0x54ec91[_0x5494('0x48')],null))[_0x5494('0x23')](respondWithResult(_0xd7540,null))[_0x5494('0x43')](handleError(_0xd7540,null));};exports['destroy']=function(_0x222c9b,_0x1b616a){return db['Pause'][_0x5494('0x46')]({'where':{'id':_0x222c9b[_0x5494('0x4e')]['id']}})[_0x5494('0x23')](handleEntityNotFound(_0x1b616a,null))[_0x5494('0x23')](removeEntity(_0x1b616a,null))[_0x5494('0x43')](handleError(_0x1b616a,null));}; \ No newline at end of file +var _0x6387=['index','map','Pause','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','sort','where','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','stack','name','send'];(function(_0x19d575,_0x40ab33){var _0x4d1eff=function(_0x4142c2){while(--_0x4142c2){_0x19d575['push'](_0x19d575['shift']());}};_0x4d1eff(++_0x40ab33);}(_0x6387,0xc4));var _0x7638=function(_0x956e17,_0xd23728){_0x956e17=_0x956e17-0x0;var _0x2dc165=_0x6387[_0x956e17];return _0x2dc165;};'use strict';var emlformat=require(_0x7638('0x0'));var rimraf=require(_0x7638('0x1'));var zipdir=require(_0x7638('0x2'));var jsonpatch=require(_0x7638('0x3'));var rp=require(_0x7638('0x4'));var moment=require(_0x7638('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7638('0x6'));var path=require(_0x7638('0x7'));var sox=require(_0x7638('0x8'));var csv=require(_0x7638('0x9'));var ejs=require(_0x7638('0xa'));var fs=require('fs');var fs_extra=require(_0x7638('0xb'));var _=require(_0x7638('0xc'));var squel=require('squel');var crypto=require(_0x7638('0xd'));var jsforce=require(_0x7638('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7638('0x9'));var querystring=require(_0x7638('0xf'));var Papa=require(_0x7638('0x10'));var Redis=require(_0x7638('0x11'));var authService=require(_0x7638('0x12'));var qs=require(_0x7638('0x13'));var as=require(_0x7638('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7638('0x15'))(_0x7638('0x16'));var utils=require(_0x7638('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7638('0x18'));var db=require(_0x7638('0x19'))['db'];function respondWithStatusCode(_0x518187,_0xa3a05b){_0xa3a05b=_0xa3a05b||0xcc;return function(_0x290da9){if(_0x290da9){return _0x518187[_0x7638('0x1a')](_0xa3a05b);}return _0x518187[_0x7638('0x1b')](_0xa3a05b)[_0x7638('0x1c')]();};}function respondWithResult(_0x541c0f,_0x22c060){_0x22c060=_0x22c060||0xc8;return function(_0x3bc861){if(_0x3bc861){return _0x541c0f[_0x7638('0x1b')](_0x22c060)[_0x7638('0x1d')](_0x3bc861);}};}function respondWithFilteredResult(_0x1f140e,_0x93441d){return function(_0x2d8e9d){if(_0x2d8e9d){var _0x4acee1=typeof _0x93441d['offset']===_0x7638('0x1e')&&typeof _0x93441d['limit']===_0x7638('0x1e');var _0x1a9d7b=_0x2d8e9d[_0x7638('0x1f')];var _0x321b5b=_0x4acee1?0x0:_0x93441d[_0x7638('0x20')];var _0x46e60c=_0x4acee1?_0x2d8e9d[_0x7638('0x1f')]:_0x93441d[_0x7638('0x20')]+_0x93441d[_0x7638('0x21')];var _0x3718a6;if(_0x46e60c>=_0x1a9d7b){_0x46e60c=_0x1a9d7b;_0x3718a6=0xc8;}else{_0x3718a6=0xce;}_0x1f140e['status'](_0x3718a6);return _0x1f140e['set'](_0x7638('0x22'),_0x321b5b+'-'+_0x46e60c+'/'+_0x1a9d7b)['json'](_0x2d8e9d);}return null;};}function patchUpdates(_0x4f8910){return function(_0x296a61){try{jsonpatch[_0x7638('0x23')](_0x296a61,_0x4f8910,!![]);}catch(_0x13db26){return BPromise[_0x7638('0x24')](_0x13db26);}return _0x296a61[_0x7638('0x25')]();};}function saveUpdates(_0x3654a7,_0x45082d){return function(_0x2ab8a9){if(_0x2ab8a9){return _0x2ab8a9[_0x7638('0x26')](_0x3654a7)[_0x7638('0x27')](function(_0x57a0d9){return _0x57a0d9;});}return null;};}function removeEntity(_0x157f5e,_0x39d7da){return function(_0x3ca9b5){if(_0x3ca9b5){return _0x3ca9b5[_0x7638('0x28')]()[_0x7638('0x27')](function(){var _0x2bcbb8=_0x3ca9b5[_0x7638('0x29')]({'plain':!![]});var _0x1de44f=_0x7638('0x2a');return db[_0x7638('0x2b')][_0x7638('0x28')]({'where':{'type':_0x1de44f,'resourceId':_0x2bcbb8['id']}})[_0x7638('0x27')](function(){return _0x3ca9b5;});})[_0x7638('0x27')](function(){_0x157f5e[_0x7638('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4264,_0x48850b){return function(_0x3a0d3c){if(!_0x3a0d3c){_0x2f4264['sendStatus'](0x194);}return _0x3a0d3c;};}function handleError(_0x47d101,_0x46fc2a){_0x46fc2a=_0x46fc2a||0x1f4;return function(_0x17264e){logger['error'](_0x17264e[_0x7638('0x2c')]);if(_0x17264e[_0x7638('0x2d')]){delete _0x17264e[_0x7638('0x2d')];}_0x47d101[_0x7638('0x1b')](_0x46fc2a)[_0x7638('0x2e')](_0x17264e);};}exports[_0x7638('0x2f')]=function(_0x4766ea,_0x509baa){var _0x11b788={},_0x1fde66={},_0x17f228={'count':0x0,'rows':[]};var _0x907be4=_[_0x7638('0x30')](db[_0x7638('0x31')]['rawAttributes'],function(_0x559976){return{'name':_0x559976[_0x7638('0x32')],'type':_0x559976[_0x7638('0x33')][_0x7638('0x34')]};});_0x1fde66[_0x7638('0x35')]=_['map'](_0x907be4,_0x7638('0x2d'));_0x1fde66[_0x7638('0x36')]=_[_0x7638('0x37')](_0x4766ea[_0x7638('0x36')]);_0x1fde66[_0x7638('0x38')]=_[_0x7638('0x39')](_0x1fde66[_0x7638('0x35')],_0x1fde66[_0x7638('0x36')]);_0x11b788['attributes']=_[_0x7638('0x39')](_0x1fde66[_0x7638('0x35')],qs['fields'](_0x4766ea[_0x7638('0x36')][_0x7638('0x3a')]));_0x11b788['attributes']=_0x11b788['attributes'][_0x7638('0x3b')]?_0x11b788[_0x7638('0x3c')]:_0x1fde66['model'];if(!_0x4766ea[_0x7638('0x36')]['hasOwnProperty'](_0x7638('0x3d'))){_0x11b788[_0x7638('0x21')]=qs[_0x7638('0x21')](_0x4766ea[_0x7638('0x36')][_0x7638('0x21')]);_0x11b788[_0x7638('0x20')]=qs[_0x7638('0x20')](_0x4766ea[_0x7638('0x36')]['offset']);}_0x11b788['order']=qs[_0x7638('0x3e')](_0x4766ea['query'][_0x7638('0x3e')]);_0x11b788[_0x7638('0x3f')]=qs[_0x7638('0x38')](_['pick'](_0x4766ea[_0x7638('0x36')],_0x1fde66[_0x7638('0x38')]),_0x907be4);if(_0x4766ea[_0x7638('0x36')][_0x7638('0x40')]){_0x11b788[_0x7638('0x3f')]=_[_0x7638('0x41')](_0x11b788[_0x7638('0x3f')],{'$or':_[_0x7638('0x30')](_0x907be4,function(_0x55091a){if(_0x55091a['type']!=='VIRTUAL'){var _0x26b03d={};_0x26b03d[_0x55091a[_0x7638('0x2d')]]={'$like':'%'+_0x4766ea[_0x7638('0x36')][_0x7638('0x40')]+'%'};return _0x26b03d;}})});}_0x11b788=_[_0x7638('0x41')]({},_0x11b788,_0x4766ea[_0x7638('0x42')]);var _0x408012={'where':_0x11b788[_0x7638('0x3f')]};return db['Pause'][_0x7638('0x1f')](_0x408012)[_0x7638('0x27')](function(_0x477c5f){_0x17f228[_0x7638('0x1f')]=_0x477c5f;if(_0x4766ea[_0x7638('0x36')][_0x7638('0x43')]){_0x11b788[_0x7638('0x44')]=[{'all':!![]}];}return db[_0x7638('0x31')]['findAll'](_0x11b788);})['then'](function(_0x1b65df){_0x17f228[_0x7638('0x45')]=_0x1b65df;return _0x17f228;})[_0x7638('0x27')](respondWithFilteredResult(_0x509baa,_0x11b788))['catch'](handleError(_0x509baa,null));};exports[_0x7638('0x46')]=function(_0x1a8cda,_0x6a4239){var _0x2bda81={'raw':!![],'where':{'id':_0x1a8cda[_0x7638('0x47')]['id']}},_0x5979b9={};_0x5979b9[_0x7638('0x35')]=_[_0x7638('0x37')](db[_0x7638('0x31')][_0x7638('0x48')]);_0x5979b9['query']=_['keys'](_0x1a8cda[_0x7638('0x36')]);_0x5979b9['filters']=_['intersection'](_0x5979b9[_0x7638('0x35')],_0x5979b9['query']);_0x2bda81[_0x7638('0x3c')]=_['intersection'](_0x5979b9[_0x7638('0x35')],qs[_0x7638('0x3a')](_0x1a8cda[_0x7638('0x36')][_0x7638('0x3a')]));_0x2bda81[_0x7638('0x3c')]=_0x2bda81['attributes'][_0x7638('0x3b')]?_0x2bda81['attributes']:_0x5979b9[_0x7638('0x35')];if(_0x1a8cda[_0x7638('0x36')][_0x7638('0x43')]){_0x2bda81[_0x7638('0x44')]=[{'all':!![]}];}_0x2bda81=_[_0x7638('0x41')]({},_0x2bda81,_0x1a8cda[_0x7638('0x42')]);return db['Pause'][_0x7638('0x49')](_0x2bda81)[_0x7638('0x27')](handleEntityNotFound(_0x6a4239,null))[_0x7638('0x27')](respondWithResult(_0x6a4239,null))[_0x7638('0x4a')](handleError(_0x6a4239,null));};exports[_0x7638('0x4b')]=function(_0x203a36,_0x4aa6e9){return db['Pause'][_0x7638('0x4b')](_0x203a36[_0x7638('0x4c')],{})[_0x7638('0x27')](function(_0x2ea08c){var _0x3f446f=_0x203a36['user'][_0x7638('0x29')]({'plain':!![]});if(!_0x3f446f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f446f['role']===_0x7638('0x4d')){var _0x2758ef=_0x2ea08c['get']({'plain':!![]});var _0x49ad22=_0x7638('0x2a');return db['UserProfileSection'][_0x7638('0x49')]({'where':{'name':_0x49ad22,'userProfileId':_0x3f446f['userProfileId']},'raw':!![]})[_0x7638('0x27')](function(_0x23bb0d){if(_0x23bb0d&&_0x23bb0d[_0x7638('0x4e')]===0x0){return db[_0x7638('0x2b')]['create']({'name':_0x2758ef[_0x7638('0x2d')],'resourceId':_0x2758ef['id'],'type':_0x23bb0d[_0x7638('0x2d')],'sectionId':_0x23bb0d['id']},{})[_0x7638('0x27')](function(){return _0x2ea08c;});}else{return _0x2ea08c;}})[_0x7638('0x4a')](function(_0xf8af3b){logger[_0x7638('0x4f')](_0x7638('0x50'),_0xf8af3b);throw _0xf8af3b;});}return _0x2ea08c;})[_0x7638('0x27')](respondWithResult(_0x4aa6e9,0xc9))[_0x7638('0x4a')](handleError(_0x4aa6e9,null));};exports[_0x7638('0x26')]=function(_0x5b6746,_0x2b85ac){if(_0x5b6746['body']['id']){delete _0x5b6746['body']['id'];}return db[_0x7638('0x31')][_0x7638('0x49')]({'where':{'id':_0x5b6746[_0x7638('0x47')]['id']}})[_0x7638('0x27')](handleEntityNotFound(_0x2b85ac,null))['then'](saveUpdates(_0x5b6746['body'],null))[_0x7638('0x27')](respondWithResult(_0x2b85ac,null))[_0x7638('0x4a')](handleError(_0x2b85ac,null));};exports[_0x7638('0x28')]=function(_0x4e542a,_0x590079){return db[_0x7638('0x31')]['find']({'where':{'id':_0x4e542a[_0x7638('0x47')]['id']}})[_0x7638('0x27')](handleEntityNotFound(_0x590079,null))[_0x7638('0x27')](removeEntity(_0x590079,null))[_0x7638('0x4a')](handleError(_0x590079,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 94dd814..03cdb14 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x35461b,_0x465a44){var _0x553067=function(_0x49c8c9){while(--_0x49c8c9){_0x35461b['push'](_0x35461b['shift']());}};_0x553067(++_0x465a44);}(_0xe14b,0x93));var _0xbe14=function(_0x96de37,_0x1a0413){_0x96de37=_0x96de37-0x0;var _0x500f75=_0xe14b[_0x96de37];return _0x500f75;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0xc16298,_0xa1c147){var _0x37b29e=function(_0x8d0d22){while(--_0x8d0d22){_0xc16298['push'](_0xc16298['shift']());}};_0x37b29e(++_0xa1c147);}(_0x326f,0xd1));var _0xf326=function(_0xf7921f,_0x3c0814){_0xf7921f=_0xf7921f-0x0;var _0x13bed8=_0x326f[_0xf7921f];return _0x13bed8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1cf5f6f..7d2e1e0 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1f1907,_0x2d3ee9){var _0x1c22ea=function(_0x2f1d30){while(--_0x2f1d30){_0x1f1907['push'](_0x1f1907['shift']());}};_0x1c22ea(++_0x2d3ee9);}(_0xb10b,0x12a));var _0xbb10=function(_0x173336,_0x3f98c4){_0x173336=_0x173336-0x0;var _0x12dc79=_0xb10b[_0x173336];return _0x12dc79;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x10a66f,_0x37c136){var _0x35ad96=function(_0x3ffeea){while(--_0x3ffeea){_0x10a66f['push'](_0x10a66f['shift']());}};_0x35ad96(++_0x37c136);}(_0x7a54,0x106));var _0x47a5=function(_0x314587,_0x3e2ab0){_0x314587=_0x314587-0x0;var _0x6eb238=_0x7a54[_0x314587];return _0x6eb238;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fe1734a..dc6676e 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 _0x9b67=['../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9b67,0xf6));var _0x79b6=function(_0xb0237b,_0x255933){_0xb0237b=_0xb0237b-0x0;var _0x3a16d7=_0x9b67[_0xb0237b];return _0x3a16d7;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),controller[_0x79b6('0xc')]);router['get'](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xe')]);router[_0x79b6('0x8')](_0x79b6('0xf'),auth['isAuthenticated'](),controller[_0x79b6('0x10')]);var upload=multer({'storage':multer[_0x79b6('0x11')]({'destination':function(_0x3f3b44,_0x301f13,_0x58a98b){_0x58a98b(null,path['join'](config[_0x79b6('0x12')],_0x79b6('0x13')));},'filename':function(_0x303cfb,_0x526727,_0xc05a77){_0x526727[_0x79b6('0x14')]=_0x526727[_0x79b6('0x14')][_0x79b6('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xc05a77(null,util[_0x79b6('0x16')](_0x79b6('0x17'),path[_0x79b6('0x18')](_0x526727[_0x79b6('0x14')],path[_0x79b6('0x19')](_0x526727[_0x79b6('0x14')])),Date[_0x79b6('0x1a')](),path[_0x79b6('0x19')](_0x526727[_0x79b6('0x14')])));}})});router['post']('/',upload[_0x79b6('0x1b')](_0x79b6('0x1c')),controller[_0x79b6('0x1d')]);router[_0x79b6('0x1e')](_0x79b6('0xb'),controller[_0x79b6('0x1f')]);router[_0x79b6('0x20')](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x21')]);router[_0x79b6('0x22')](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller['delete']);module[_0x79b6('0x23')]=router; \ No newline at end of file +var _0xcb99=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x5e79b5,_0x2d6343){var _0x54732d=function(_0x5c4205){while(--_0x5c4205){_0x5e79b5['push'](_0x5e79b5['shift']());}};_0x54732d(++_0x2d6343);}(_0xcb99,0x8b));var _0x9cb9=function(_0x255caf,_0x2f893b){_0x255caf=_0x255caf-0x0;var _0x25e862=_0xcb99[_0x255caf];return _0x25e862;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);var upload=multer({'storage':multer[_0x9cb9('0xe')]({'destination':function(_0x1b4fa6,_0x5a0ac7,_0x3be02c){_0x3be02c(null,path[_0x9cb9('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x227d49,_0x2e687e,_0x3382c8){_0x2e687e[_0x9cb9('0x10')]=_0x2e687e['originalname'][_0x9cb9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3382c8(null,util[_0x9cb9('0x12')](_0x9cb9('0x13'),path[_0x9cb9('0x14')](_0x2e687e[_0x9cb9('0x10')],path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])),Date[_0x9cb9('0x16')](),path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])));}})});router[_0x9cb9('0x17')]('/',upload[_0x9cb9('0x18')](_0x9cb9('0x19')),controller[_0x9cb9('0x1a')]);router[_0x9cb9('0x17')](_0x9cb9('0x9'),controller[_0x9cb9('0x1b')]);router[_0x9cb9('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bf77979..2f52d4b 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 _0x2054=['BOOLEAN','adminOnly','agentOnly','always','never','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x4f2be9,_0x5ebdd8){var _0x536f6c=function(_0x1df087){while(--_0x1df087){_0x4f2be9['push'](_0x4f2be9['shift']());}};_0x536f6c(++_0x5ebdd8);}(_0x2054,0x1a9));var _0x4205=function(_0x292f35,_0x72e859){_0x292f35=_0x292f35-0x0;var _0x288e75=_0x2054[_0x292f35];return _0x288e75;};'use strict';var Sequelize=require(_0x4205('0x0'));module[_0x4205('0x1')]={'name':{'type':Sequelize[_0x4205('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4205('0x3'),_0x4205('0x4'))},'description':{'type':Sequelize[_0x4205('0x5')]},'version':{'type':Sequelize[_0x4205('0x5')]},'path':{'type':Sequelize[_0x4205('0x2')],'comment':_0x4205('0x6')},'active':{'type':Sequelize[_0x4205('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x4205('0x8'),_0x4205('0x9'),_0x4205('0xa'),_0x4205('0xb')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x4205('0x2')]},'adminUrl':{'type':Sequelize[_0x4205('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4205('0x2')]},'scriptPath':{'type':Sequelize[_0x4205('0x2')]}}; \ No newline at end of file +var _0x3a23=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0xe3f360,_0x203484){var _0x4b6d3d=function(_0x50c315){while(--_0x50c315){_0xe3f360['push'](_0xe3f360['shift']());}};_0x4b6d3d(++_0x203484);}(_0x3a23,0x75));var _0x33a2=function(_0x521674,_0x141164){_0x521674=_0x521674-0x0;var _0x137bbc=_0x3a23[_0x521674];return _0x137bbc;};'use strict';var Sequelize=require(_0x33a2('0x0'));module[_0x33a2('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x33a2('0x2')](_0x33a2('0x3'),_0x33a2('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x33a2('0x5')]},'path':{'type':Sequelize[_0x33a2('0x6')],'comment':_0x33a2('0x7')},'active':{'type':Sequelize[_0x33a2('0x8')],'defaultValue':0x0,'comment':_0x33a2('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x33a2('0xa'),_0x33a2('0xb'),_0x33a2('0xc'),_0x33a2('0xd')),'defaultValue':_0x33a2('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x33a2('0x6')]},'adminUrl':{'type':Sequelize[_0x33a2('0x6')]},'agentUrl':{'type':Sequelize[_0x33a2('0x6')]},'scriptName':{'type':Sequelize[_0x33a2('0x6')]},'scriptPath':{'type':Sequelize[_0x33a2('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 67fb3f4..dba32d8 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 _0x661e=['filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','hostname','set','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','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','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','Plugins','UserProfileResource','destroy','error','name','send','index','map','Plugin','fieldName','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','length','find','catch','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x661e,0x19d));var _0xe661=function(_0x1f562a,_0x142296){_0x1f562a=_0x1f562a-0x0;var _0x287717=_0x661e[_0x1f562a];return _0x287717;};'use strict';var emlformat=require(_0xe661('0x0'));var rimraf=require(_0xe661('0x1'));var zipdir=require(_0xe661('0x2'));var jsonpatch=require(_0xe661('0x3'));var rp=require('request-promise');var moment=require(_0xe661('0x4'));var BPromise=require(_0xe661('0x5'));var Mustache=require(_0xe661('0x6'));var util=require(_0xe661('0x7'));var path=require(_0xe661('0x8'));var sox=require(_0xe661('0x9'));var csv=require(_0xe661('0xa'));var ejs=require(_0xe661('0xb'));var fs=require('fs');var fs_extra=require(_0xe661('0xc'));var _=require(_0xe661('0xd'));var squel=require(_0xe661('0xe'));var crypto=require(_0xe661('0xf'));var jsforce=require(_0xe661('0x10'));var deskjs=require(_0xe661('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe661('0x12'));var Papa=require('papaparse');var extract=require(_0xe661('0x13'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xe661('0x14'));var authService=require(_0xe661('0x15'));var qs=require(_0xe661('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe661('0x17'));var logger=require(_0xe661('0x18'))(_0xe661('0x19'));var utils=require(_0xe661('0x1a'));var config=require(_0xe661('0x1b'));var licenseUtil=require(_0xe661('0x1c'));var db=require(_0xe661('0x1d'))['db'];config[_0xe661('0x1e')]=_[_0xe661('0x1f')](config['redis'],{'host':_0xe661('0x20'),'port':0x18eb});var socket=require(_0xe661('0x21'))(new Redis(config['redis']));require(_0xe661('0x22'))[_0xe661('0x23')](socket);function respondWithStatusCode(_0x927ed0,_0x3f2d97){_0x3f2d97=_0x3f2d97||0xcc;return function(_0x25c2bd){if(_0x25c2bd){return _0x927ed0[_0xe661('0x24')](_0x3f2d97);}return _0x927ed0[_0xe661('0x25')](_0x3f2d97)[_0xe661('0x26')]();};}function respondWithResult(_0x2a0d90,_0x24f271){_0x24f271=_0x24f271||0xc8;return function(_0x5db31c){if(_0x5db31c){return _0x2a0d90[_0xe661('0x25')](_0x24f271)[_0xe661('0x27')](_0x5db31c);}};}function respondWithFilteredResult(_0x3d8a50,_0x30fa58){return function(_0xc54423){if(_0xc54423){var _0x1851dd=typeof _0x30fa58['offset']===_0xe661('0x28')&&typeof _0x30fa58[_0xe661('0x29')]===_0xe661('0x28');var _0xe18baf=_0xc54423['count'];var _0x77f49a=_0x1851dd?0x0:_0x30fa58[_0xe661('0x2a')];var _0x5dd33e=_0x1851dd?_0xc54423[_0xe661('0x2b')]:_0x30fa58[_0xe661('0x2a')]+_0x30fa58[_0xe661('0x29')];var _0x287b89;if(_0x5dd33e>=_0xe18baf){_0x5dd33e=_0xe18baf;_0x287b89=0xc8;}else{_0x287b89=0xce;}_0x3d8a50['status'](_0x287b89);return _0x3d8a50['set'](_0xe661('0x2c'),_0x77f49a+'-'+_0x5dd33e+'/'+_0xe18baf)[_0xe661('0x27')](_0xc54423);}return null;};}function patchUpdates(_0x1b718){return function(_0x48ed80){try{jsonpatch[_0xe661('0x2d')](_0x48ed80,_0x1b718,!![]);}catch(_0x5f0435){return BPromise['reject'](_0x5f0435);}return _0x48ed80[_0xe661('0x2e')]();};}function saveUpdates(_0x4f2eda,_0x4e37ab){return function(_0x354932){if(_0x354932){return _0x354932[_0xe661('0x2f')](_0x4f2eda)[_0xe661('0x30')](function(_0x3920be){return _0x3920be;});}return null;};}function removeEntity(_0x4c92ab,_0x354a92){return function(_0x1ef3bb){if(_0x1ef3bb){return _0x1ef3bb['destroy']()[_0xe661('0x30')](function(){var _0x2f8665=_0x1ef3bb['get']({'plain':!![]});var _0xf01662=_0xe661('0x31');return db[_0xe661('0x32')][_0xe661('0x33')]({'where':{'type':_0xf01662,'resourceId':_0x2f8665['id']}})['then'](function(){return _0x1ef3bb;});})['then'](function(){_0x4c92ab[_0xe661('0x25')](0xcc)[_0xe661('0x26')]();});}};}function handleEntityNotFound(_0x12f1d1,_0x2a993b){return function(_0x5cf596){if(!_0x5cf596){_0x12f1d1[_0xe661('0x24')](0x194);}return _0x5cf596;};}function handleError(_0x5215ba,_0x139154){_0x139154=_0x139154||0x1f4;return function(_0x1b630a){logger[_0xe661('0x34')](_0x1b630a['stack']);if(_0x1b630a[_0xe661('0x35')]){delete _0x1b630a[_0xe661('0x35')];}_0x5215ba[_0xe661('0x25')](_0x139154)[_0xe661('0x36')](_0x1b630a);};}exports[_0xe661('0x37')]=function(_0x24e5a8,_0x50b81b){var _0x1fd765={},_0x531994={},_0x2a9a07={'count':0x0,'rows':[]};var _0x8af6ce=_[_0xe661('0x38')](db[_0xe661('0x39')]['rawAttributes'],function(_0x3f1e48){return{'name':_0x3f1e48[_0xe661('0x3a')],'type':_0x3f1e48[_0xe661('0x3b')]['key']};});_0x531994['model']=_[_0xe661('0x38')](_0x8af6ce,_0xe661('0x35'));_0x531994[_0xe661('0x3c')]=_['keys'](_0x24e5a8[_0xe661('0x3c')]);_0x531994[_0xe661('0x3d')]=_[_0xe661('0x3e')](_0x531994['model'],_0x531994[_0xe661('0x3c')]);_0x1fd765['attributes']=_[_0xe661('0x3e')](_0x531994[_0xe661('0x3f')],qs[_0xe661('0x40')](_0x24e5a8[_0xe661('0x3c')][_0xe661('0x40')]));_0x1fd765[_0xe661('0x41')]=_0x1fd765[_0xe661('0x41')]['length']?_0x1fd765[_0xe661('0x41')]:_0x531994['model'];if(!_0x24e5a8[_0xe661('0x3c')][_0xe661('0x42')](_0xe661('0x43'))){_0x1fd765['limit']=qs[_0xe661('0x29')](_0x24e5a8['query'][_0xe661('0x29')]);_0x1fd765[_0xe661('0x2a')]=qs[_0xe661('0x2a')](_0x24e5a8[_0xe661('0x3c')][_0xe661('0x2a')]);}_0x1fd765[_0xe661('0x44')]=qs[_0xe661('0x45')](_0x24e5a8[_0xe661('0x3c')][_0xe661('0x45')]);_0x1fd765['where']=qs[_0xe661('0x3d')](_[_0xe661('0x46')](_0x24e5a8['query'],_0x531994[_0xe661('0x3d')]),_0x8af6ce);if(_0x24e5a8[_0xe661('0x3c')][_0xe661('0x47')]){_0x1fd765[_0xe661('0x48')]=_['merge'](_0x1fd765['where'],{'$or':_[_0xe661('0x38')](_0x8af6ce,function(_0x7bfe1a){if(_0x7bfe1a[_0xe661('0x3b')]!==_0xe661('0x49')){var _0x4e0c2c={};_0x4e0c2c[_0x7bfe1a['name']]={'$like':'%'+_0x24e5a8[_0xe661('0x3c')]['filter']+'%'};return _0x4e0c2c;}})});}_0x1fd765=_[_0xe661('0x4a')]({},_0x1fd765,_0x24e5a8[_0xe661('0x4b')]);var _0x1b17d7={'where':_0x1fd765['where']};return db[_0xe661('0x39')]['count'](_0x1b17d7)[_0xe661('0x30')](function(_0x261ab7){_0x2a9a07[_0xe661('0x2b')]=_0x261ab7;if(_0x24e5a8[_0xe661('0x3c')][_0xe661('0x4c')]){_0x1fd765[_0xe661('0x4d')]=[{'all':!![]}];}return db['Plugin'][_0xe661('0x4e')](_0x1fd765);})['then'](function(_0x14ba16){_0x2a9a07[_0xe661('0x4f')]=_0x14ba16;return _0x2a9a07;})[_0xe661('0x30')](respondWithFilteredResult(_0x50b81b,_0x1fd765))['catch'](handleError(_0x50b81b,null));};exports[_0xe661('0x50')]=function(_0x448010,_0x4f5097){var _0x336cf4={'raw':!![],'where':{'id':_0x448010['params']['id']}},_0x25cf9c={};_0x25cf9c['model']=_[_0xe661('0x51')](db[_0xe661('0x39')][_0xe661('0x52')]);_0x25cf9c[_0xe661('0x3c')]=_['keys'](_0x448010[_0xe661('0x3c')]);_0x25cf9c[_0xe661('0x3d')]=_[_0xe661('0x3e')](_0x25cf9c['model'],_0x25cf9c[_0xe661('0x3c')]);_0x336cf4['attributes']=_['intersection'](_0x25cf9c[_0xe661('0x3f')],qs[_0xe661('0x40')](_0x448010[_0xe661('0x3c')][_0xe661('0x40')]));_0x336cf4[_0xe661('0x41')]=_0x336cf4[_0xe661('0x41')][_0xe661('0x53')]?_0x336cf4[_0xe661('0x41')]:_0x25cf9c[_0xe661('0x3f')];if(_0x448010[_0xe661('0x3c')]['includeAll']){_0x336cf4[_0xe661('0x4d')]=[{'all':!![]}];}_0x336cf4=_[_0xe661('0x4a')]({},_0x336cf4,_0x448010['options']);return db[_0xe661('0x39')][_0xe661('0x54')](_0x336cf4)[_0xe661('0x30')](handleEntityNotFound(_0x4f5097,null))[_0xe661('0x30')](respondWithResult(_0x4f5097,null))[_0xe661('0x55')](handleError(_0x4f5097,null));};exports['download']=function(_0x28e783,_0x57b3cd,_0x44b246){return db[_0xe661('0x39')][_0xe661('0x54')]({'where':{'id':_0x28e783['params']['id']},'attributes':[_0xe661('0x35'),_0xe661('0x8')],'raw':!![]})[_0xe661('0x30')](handleEntityNotFound(_0x57b3cd,null))[_0xe661('0x30')](function(_0x125801){if(_0x125801){var _0x3825e5=path['join'](config[_0xe661('0x56')],_0xe661('0x57'),util[_0xe661('0x58')](_0xe661('0x59'),path[_0xe661('0x5a')](_0x125801[_0xe661('0x8')])));var _0x28765d=fs[_0xe661('0x5b')](_0x3825e5);var _0xb31905=archiver('zip',{'zlib':{'level':0x9}});_0xb31905['on'](_0xe661('0x5c'),function(_0x47b453){if(_0x47b453['code']===_0xe661('0x5d')){logger[_0xe661('0x34')](_0x47b453);}else{throw new db[(_0xe661('0x5e'))][(_0xe661('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xb31905['on'](_0xe661('0x34'),function(_0x245290){throw new db[(_0xe661('0x5e'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xb31905[_0xe661('0x60')](_0x28765d);_0xb31905['glob'](_0xe661('0x61'),{'cwd':path[_0xe661('0x62')](config[_0xe661('0x56')],_0xe661('0x57'),path[_0xe661('0x63')](_0x125801['path'])),'ignore':[path[_0xe661('0x62')](path['basename'](_0x125801['path']),_0xe661('0x64')),path[_0xe661('0x62')](path['basename'](_0x125801[_0xe661('0x8')]),_0xe661('0x65'))],'nodir':!![]})[_0xe661('0x66')]();_0x28765d['on'](_0xe661('0x67'),function(){if(!fs[_0xe661('0x68')](_0x3825e5)){throw new db[(_0xe661('0x5e'))][(_0xe661('0x5f'))](_0xe661('0x69'));}return _0x57b3cd[_0xe661('0x6a')](_0x3825e5,util['format'](_0xe661('0x59'),path[_0xe661('0x5a')](_0x125801['path'])),function(_0x12974a){if(_0x12974a){throw new db[(_0xe661('0x5e'))][(_0xe661('0x5f'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xe661('0x6b')](_0x3825e5);logger[_0xe661('0x6c')](_0xe661('0x6d'));logger[_0xe661('0x6c')](_0xe661('0x6e'));});});}return null;})[_0xe661('0x55')](handleError(_0x57b3cd,null));};exports[_0xe661('0x6f')]=function(_0x58ff69,_0x8f9b1f,_0x3898d5){var _0x266faa=path[_0xe661('0x5a')](_0x58ff69['file'][_0xe661('0x70')],path[_0xe661('0x71')](_0x58ff69[_0xe661('0x72')][_0xe661('0x70')]));var _0x17b151=path[_0xe661('0x62')](config[_0xe661('0x56')],_0xe661('0x57'),_0x58ff69[_0xe661('0x72')][_0xe661('0x70')]);var _0x3ef6cc=path[_0xe661('0x62')](config['root'],_0xe661('0x57'),_0x266faa);logger['info'](_0xe661('0x73'),_0x17b151);logger[_0xe661('0x6c')](_0xe661('0x74'),_0x3ef6cc);try{fs[_0xe661('0x75')](_0x17b151,parseInt('0777',0x8));extract(_0x17b151,{'dir':_0x3ef6cc},function(_0x23c9f8){if(_0x23c9f8){logger[_0xe661('0x34')](_0x23c9f8);handleError(_0x23c9f8,!![]);};var _0x498a47=fs['readdirSync'](_0x3ef6cc);if(_0x498a47[_0xe661('0x53')]>0x1){removeReferences(_0x17b151,_0x3ef6cc);logger[_0xe661('0x34')](_0xe661('0x76'));return _0x3898d5(new Error(_0xe661('0x76')));}var _0x5d0fd0=fs['lstatSync'](path[_0xe661('0x62')](_0x3ef6cc,_0x498a47[0x0]));if(_0x5d0fd0['isFile']()){removeReferences(_0x17b151,_0x3ef6cc);logger[_0xe661('0x34')](_0xe661('0x76'));return _0x3898d5(new Error(_0xe661('0x76')));}if(_0x5d0fd0[_0xe661('0x77')]()){var _0x1d71bd=fs[_0xe661('0x78')](path[_0xe661('0x62')](_0x3ef6cc,_0x498a47[0x0]));if(_0x1d71bd[_0xe661('0x53')]===0x0){removeReferences(_0x17b151,_0x3ef6cc);logger['error']('Invalid\x20plugin\x20structure');return _0x3898d5(new Error(_0xe661('0x76')));}var _0x43c4f0=_0x1d71bd[_0xe661('0x79')](function(_0x2f0d4a){return _0x2f0d4a===_0xe661('0x7a');});if(!_0x43c4f0){return _0x3898d5(new Error(_0xe661('0x7b')));}var _0x2cfef4=fs['readFileSync'](path[_0xe661('0x62')](_0x3ef6cc,_0x498a47[0x0],_0xe661('0x7a')));var _0x1b32eb=JSON['parse'](_0x2cfef4);if(_0xe661('0x28')==typeof _0x1b32eb[_0xe661('0x35')]){return _0x3898d5(new Error(_0xe661('0x7c')));}if('undefined'==typeof _0x1b32eb[_0xe661('0x3b')]){return _0x3898d5(new Error(_0xe661('0x7d')));}if(_0xe661('0x28')==typeof _0x1b32eb[_0xe661('0x7e')]){return _0x3898d5(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe661('0x28')==typeof _0x1b32eb[_0xe661('0x7f')]){return _0x3898d5(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1b32eb[_0xe661('0x3b')]==='html'){if('undefined'==typeof _0x1b32eb['parameters']['views']){return _0x3898d5(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xe661('0x28')==typeof _0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')][_0xe661('0x81')]&&'undefined'==typeof _0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')][_0xe661('0x82')]){return _0x3898d5(new Error(_0xe661('0x83')));}}else if(_0x1b32eb[_0xe661('0x3b')]===_0xe661('0x84')){if('undefined'==typeof _0x1b32eb['parameters'][_0xe661('0x85')]){return _0x3898d5(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xe661('0x28')==typeof _0x1b32eb[_0xe661('0x7f')][_0xe661('0x86')]){return _0x3898d5(new Error(_0xe661('0x87')));}}else{return _0x3898d5(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2b3dc3=_0x1b32eb[_0xe661('0x35')];var _0x5c56b=_0x1b32eb[_0xe661('0x88')];var _0x54d125=_0x1b32eb[_0xe661('0x3b')];var _0x36556c=_0x1b32eb[_0xe661('0x89')]?_0x1b32eb[_0xe661('0x89')]:_0xe661('0x8a');var _0x112efd=_0x1b32eb[_0xe661('0x8b')]?_0x1b32eb[_0xe661('0x8b')]:_0xe661('0x8c');var _0x327b8d='';var _0xca925c='';var _0x4a6260='';var _0x555250='';var _0x91eff0=_0x1b32eb[_0xe661('0x7e')];if(_0x54d125===_0xe661('0x8d')){if(_0xe661('0x28')!=typeof _0x1b32eb['parameters']['views']['admin']){var _0x3844f2=_0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')][_0xe661('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe661('0x8e')](_0x3844f2)){_0x327b8d=path[_0xe661('0x62')]('plugins',_0x266faa,_0x498a47[0x0],_0x3844f2);}else{_0x327b8d=_0x3844f2;}}else{logger[_0xe661('0x6c')](_0xe661('0x8f'));}if(_0xe661('0x28')!=typeof _0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')][_0xe661('0x82')]){var _0x245998=_0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xe661('0x8e')](_0x245998)){_0xca925c=path[_0xe661('0x62')]('plugins',_0x266faa,_0x498a47[0x0],_0x245998);}else{_0xca925c=_0x245998;}}else{logger[_0xe661('0x6c')](_0xe661('0x90'));}}else if(_0x54d125===_0xe661('0x84')){_0x4a6260=_0x1b32eb[_0xe661('0x7f')][_0xe661('0x85')];_0x555250=_0x1b32eb[_0xe661('0x7f')][_0xe661('0x86')];if(_0xe661('0x28')!=typeof _0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')]){if(_0xe661('0x28')!=typeof _0x1b32eb['parameters'][_0xe661('0x80')][_0xe661('0x81')]){var _0x3844f2=_0x1b32eb['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe661('0x8e')](_0x3844f2)){_0x327b8d=path[_0xe661('0x62')]('plugins',_0x266faa,_0x498a47[0x0],_0x3844f2);}else{_0x327b8d=_0x3844f2;}}if(_0xe661('0x28')!=typeof _0x1b32eb['parameters']['views']['agent']){var _0x245998=_0x1b32eb[_0xe661('0x7f')][_0xe661('0x80')][_0xe661('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xe661('0x8e')](_0x245998)){_0xca925c=path['join']('plugins',_0x266faa,_0x498a47[0x0],_0x245998);}else{_0xca925c=_0x245998;}}}}var _0x5b0e0d={'name':_0x2b3dc3,'description':_0x5c56b,'path':path[_0xe661('0x62')](_0x266faa,_0x498a47[0x0]),'type':_0x54d125,'sidebar':_0x36556c,'icon':_0x112efd,'adminUrl':_0x327b8d,'agentUrl':_0xca925c,'scriptName':_0x4a6260,'scriptPath':_0x555250,'version':_0x91eff0};removeReferences(_0x17b151,null);return db[_0xe661('0x39')][_0xe661('0x91')](_0x5b0e0d)[_0xe661('0x30')](function(_0x3a55be){var _0xc82968={'role':_0x58ff69[_0xe661('0x92')][_0xe661('0x93')],'userProfileId':_0x58ff69[_0xe661('0x92')][_0xe661('0x94')]};if(!_0xc82968)throw new Error(_0xe661('0x95'));if(_0xc82968[_0xe661('0x93')]===_0xe661('0x96')){var _0x1efb41=_0x3a55be[_0xe661('0x97')]({'plain':!![]});return db[_0xe661('0x98')]['find']({'where':{'name':_0xe661('0x31'),'userProfileId':_0xc82968[_0xe661('0x94')]},'raw':!![]})[_0xe661('0x30')](function(_0x28f102){if(_0x28f102&&_0x28f102[_0xe661('0x99')]===0x0){return db['UserProfileResource'][_0xe661('0x91')]({'name':_0x1efb41[_0xe661('0x35')],'resourceId':_0x1efb41['id'],'type':_0x28f102[_0xe661('0x35')],'sectionId':_0x28f102['id']},{})[_0xe661('0x30')](function(){return _0x3a55be;});}else{return _0x3a55be;}})[_0xe661('0x55')](function(_0x393394){logger['error'](_0xe661('0x9a'),_0x393394);throw _0x393394;});}return _0x3a55be;})[_0xe661('0x30')](respondWithResult(_0x8f9b1f,null))['catch'](handleError(_0x8f9b1f,null));}});}catch(_0x5293c2){_0x8f9b1f[_0xe661('0x25')](0x1f4)[_0xe661('0x36')](_0x5293c2);}};function removeReferences(_0x169c11,_0x229769){try{if(_0x169c11){fs[_0xe661('0x6b')](_0x169c11);logger[_0xe661('0x6c')](_0xe661('0x9b'));}if(_0x229769){rimraf(_0x229769,function(){});logger[_0xe661('0x6c')](_0xe661('0x9c'));}}catch(_0x4ab0ab){logger[_0xe661('0x34')](_0x4ab0ab);}}exports[_0xe661('0x2f')]=function(_0x3d6f76,_0x4b252d,_0x845311){return db[_0xe661('0x39')][_0xe661('0x54')]({'where':{'id':_0x3d6f76['params']['id']}})[_0xe661('0x30')](handleEntityNotFound(_0x4b252d,null))[_0xe661('0x30')](saveUpdates(_0x3d6f76[_0xe661('0x92')],null))[_0xe661('0x30')](respondWithResult(_0x4b252d,null))[_0xe661('0x55')](handleError(_0x4b252d,null));};exports['delete']=function(_0x41e699,_0x2f541f,_0x2e8d37){return db['Plugin'][_0xe661('0x54')]({'where':{'id':_0x41e699[_0xe661('0x9d')]['id']}})['then'](function(_0x5c3904){if(_0x5c3904){return _0x5c3904['destroy']();}})[_0xe661('0x30')](function(_0x33190a){rimraf(path[_0xe661('0x62')](config[_0xe661('0x56')],_0xe661('0x57'),path['dirname'](_0x33190a[_0xe661('0x8')])),function(){});return _0x33190a;})['then'](handleEntityNotFound(_0x2f541f,null))[_0xe661('0x30')](respondWithStatusCode(_0x2f541f,null))['catch'](handleError(_0x2f541f,null));};exports[_0xe661('0x9e')]=function(_0x979b5d,_0x508c94,_0x15cfc4){return BPromise[_0xe661('0x9f')]()[_0xe661('0x30')](function(){if(!_0x979b5d[_0xe661('0x3c')][_0xe661('0x8')]){throw new Error(_0xe661('0xa0'));}if(!_0x979b5d[_0xe661('0x3c')][_0xe661('0xa1')]){throw new Error(_0xe661('0xa2'));}var _0x2e3fb3=_0x979b5d[_0xe661('0x3c')]['hostname']?_0x979b5d[_0xe661('0x3c')]['hostname']+':'+_0x979b5d[_0xe661('0x3c')]['port']:_0xe661('0xa3')+_0x979b5d['query']['port'];var _0xc89918=_0x979b5d['query'][_0xe661('0x27')]?_0x979b5d[_0xe661('0x3c')][_0xe661('0x27')]:!![];var _0x5ebf1f=_0x979b5d[_0xe661('0x3c')][_0xe661('0xa4')]?_0x979b5d[_0xe661('0x3c')][_0xe661('0xa4')]:null;var _0x173b1b={'method':_0x979b5d[_0xe661('0xa5')],'uri':util['format'](_0xe661('0xa6'),_0x2e3fb3,_0x979b5d['query'][_0xe661('0x8')]),'json':_0xc89918,'resolveWithFullResponse':!![],'encoding':_0x5ebf1f,'qs':_0x979b5d['query']};if(_0x979b5d[_0xe661('0xa7')]){_0x173b1b[_0xe661('0xa7')]=_0x979b5d[_0xe661('0xa7')];if(_0x173b1b[_0xe661('0xa7')][_0xe661('0xa8')]){delete _0x173b1b[_0xe661('0xa7')][_0xe661('0xa8')];}}if(_0x173b1b[_0xe661('0xa7')][_0xe661('0xa9')]){delete _0x173b1b[_0xe661('0xa7')][_0xe661('0xa9')];}return rp(_0x173b1b);})[_0xe661('0x30')](function(_0x3f59e0){if(_0x3f59e0){_0x508c94['set'](_0x3f59e0[_0xe661('0xa7')]);logger['info'](_0x3f59e0[_0xe661('0x92')]);if(_[_0xe661('0xaa')](_0x979b5d[_0xe661('0x3c')][_0xe661('0x8')],'download')&&_0x3f59e0[_0xe661('0xab')]==0x1f4){return _0x508c94[_0xe661('0x24')](_0x3f59e0[_0xe661('0xab')]);}else{return _0x508c94[_0xe661('0x25')](_0x3f59e0[_0xe661('0xab')])[_0xe661('0x36')](_0x3f59e0[_0xe661('0x92')]);}}else{return _0x508c94[_0xe661('0x24')](0xc8);}})['catch'](handleError(_0x508c94,null));};exports[_0xe661('0xac')]=function(_0xc3aebc,_0x1ce275,_0x1f5dcc){return BPromise['resolve']()[_0xe661('0x30')](function(){if(!_0xc3aebc['query'][_0xe661('0x8')]){throw new Error(_0xe661('0xa0'));}if(!_0xc3aebc[_0xe661('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3df345=_0xc3aebc[_0xe661('0x3c')]['hostname']?_0xc3aebc[_0xe661('0x3c')][_0xe661('0xad')]+':'+_0xc3aebc[_0xe661('0x3c')]['port']:'http://localhost:'+_0xc3aebc[_0xe661('0x3c')][_0xe661('0xa1')];var _0x308314=_0xc3aebc['query'][_0xe661('0x27')]?_0xc3aebc['query']['json']:!![];var _0x5cc90c=_0xc3aebc[_0xe661('0x3c')][_0xe661('0xa4')]?_0xc3aebc['query'][_0xe661('0xa4')]:null;var _0x42deaa={'method':_0xc3aebc[_0xe661('0xa5')],'uri':util[_0xe661('0x58')](_0xe661('0xa6'),_0x3df345,_0xc3aebc[_0xe661('0x3c')][_0xe661('0x8')]),'json':_0x308314,'resolveWithFullResponse':!![],'encoding':_0x5cc90c,'body':_0xc3aebc[_0xe661('0x92')]};if(_0xc3aebc['headers']){_0x42deaa['headers']=_0xc3aebc[_0xe661('0xa7')];if(_0x42deaa['headers']['content-length']){delete _0x42deaa[_0xe661('0xa7')][_0xe661('0xa8')];}}if(_0x42deaa[_0xe661('0xa7')][_0xe661('0xa9')]){delete _0x42deaa[_0xe661('0xa7')]['content-type'];}return rp(_0x42deaa);})['then'](function(_0x2e4158){if(_0x2e4158){_0x1ce275[_0xe661('0xae')](_0x2e4158[_0xe661('0xa7')]);logger['info'](_0x2e4158[_0xe661('0x92')]);return _0x1ce275[_0xe661('0x25')](_0x2e4158[_0xe661('0xab')])[_0xe661('0x36')](_0x2e4158['body']);}else{return _0x1ce275['sendStatus'](0xc8);}})[_0xe661('0x55')](handleError(_0x1ce275,null));}; \ No newline at end of file +var _0x07e6=['delete','destroy','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','UserProfileResource','error','stack','name','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','join','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update'];(function(_0x5b833a,_0x32750d){var _0x1a84fa=function(_0x54e003){while(--_0x54e003){_0x5b833a['push'](_0x5b833a['shift']());}};_0x1a84fa(++_0x32750d);}(_0x07e6,0x152));var _0x607e=function(_0x429807,_0x219ad2){_0x429807=_0x429807-0x0;var _0x223cfd=_0x07e6[_0x429807];return _0x223cfd;};'use strict';var emlformat=require(_0x607e('0x0'));var rimraf=require(_0x607e('0x1'));var zipdir=require(_0x607e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x607e('0x3'));var moment=require(_0x607e('0x4'));var BPromise=require(_0x607e('0x5'));var Mustache=require('mustache');var util=require(_0x607e('0x6'));var path=require(_0x607e('0x7'));var sox=require(_0x607e('0x8'));var csv=require(_0x607e('0x9'));var ejs=require(_0x607e('0xa'));var fs=require('fs');var fs_extra=require(_0x607e('0xb'));var _=require(_0x607e('0xc'));var squel=require(_0x607e('0xd'));var crypto=require(_0x607e('0xe'));var jsforce=require(_0x607e('0xf'));var deskjs=require(_0x607e('0x10'));var toCsv=require(_0x607e('0x9'));var querystring=require(_0x607e('0x11'));var Papa=require(_0x607e('0x12'));var extract=require(_0x607e('0x13'));var rimraf=require(_0x607e('0x1'));var archiver=require(_0x607e('0x14'));var Redis=require(_0x607e('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x607e('0x16'));var as=require(_0x607e('0x17'));var hardwareService=require(_0x607e('0x18'));var logger=require(_0x607e('0x19'))('api');var utils=require(_0x607e('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x607e('0x1b'))['db'];config[_0x607e('0x1c')]=_[_0x607e('0x1d')](config[_0x607e('0x1c')],{'host':_0x607e('0x1e'),'port':0x18eb});var socket=require(_0x607e('0x1f'))(new Redis(config[_0x607e('0x1c')]));require('./plugin.socket')[_0x607e('0x20')](socket);function respondWithStatusCode(_0x16c44a,_0x2211d5){_0x2211d5=_0x2211d5||0xcc;return function(_0x1bdf51){if(_0x1bdf51){return _0x16c44a[_0x607e('0x21')](_0x2211d5);}return _0x16c44a[_0x607e('0x22')](_0x2211d5)[_0x607e('0x23')]();};}function respondWithResult(_0x4d7c53,_0x1bff71){_0x1bff71=_0x1bff71||0xc8;return function(_0x3fa043){if(_0x3fa043){return _0x4d7c53[_0x607e('0x22')](_0x1bff71)[_0x607e('0x24')](_0x3fa043);}};}function respondWithFilteredResult(_0x32c4d9,_0x6b73b7){return function(_0x3eabf8){if(_0x3eabf8){var _0x38d9c4=typeof _0x6b73b7['offset']===_0x607e('0x25')&&typeof _0x6b73b7[_0x607e('0x26')]==='undefined';var _0x2e5b79=_0x3eabf8[_0x607e('0x27')];var _0x4656af=_0x38d9c4?0x0:_0x6b73b7[_0x607e('0x28')];var _0x22a304=_0x38d9c4?_0x3eabf8[_0x607e('0x27')]:_0x6b73b7[_0x607e('0x28')]+_0x6b73b7[_0x607e('0x26')];var _0x2ac80f;if(_0x22a304>=_0x2e5b79){_0x22a304=_0x2e5b79;_0x2ac80f=0xc8;}else{_0x2ac80f=0xce;}_0x32c4d9[_0x607e('0x22')](_0x2ac80f);return _0x32c4d9['set'](_0x607e('0x29'),_0x4656af+'-'+_0x22a304+'/'+_0x2e5b79)[_0x607e('0x24')](_0x3eabf8);}return null;};}function patchUpdates(_0x1ecfae){return function(_0x211729){try{jsonpatch[_0x607e('0x2a')](_0x211729,_0x1ecfae,!![]);}catch(_0x52bcd0){return BPromise[_0x607e('0x2b')](_0x52bcd0);}return _0x211729['save']();};}function saveUpdates(_0x5d7649,_0x1c36a4){return function(_0x453eb4){if(_0x453eb4){return _0x453eb4['update'](_0x5d7649)['then'](function(_0x5f2b76){return _0x5f2b76;});}return null;};}function removeEntity(_0x4790e5,_0x44a0ec){return function(_0x27e18f){if(_0x27e18f){return _0x27e18f['destroy']()[_0x607e('0x2c')](function(){var _0x1b2d0a=_0x27e18f['get']({'plain':!![]});var _0x4373b7='Plugins';return db[_0x607e('0x2d')]['destroy']({'where':{'type':_0x4373b7,'resourceId':_0x1b2d0a['id']}})['then'](function(){return _0x27e18f;});})[_0x607e('0x2c')](function(){_0x4790e5[_0x607e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33b07d,_0x24251c){return function(_0x7271c9){if(!_0x7271c9){_0x33b07d[_0x607e('0x21')](0x194);}return _0x7271c9;};}function handleError(_0xefcea1,_0x21a10d){_0x21a10d=_0x21a10d||0x1f4;return function(_0x4f6615){logger[_0x607e('0x2e')](_0x4f6615[_0x607e('0x2f')]);if(_0x4f6615[_0x607e('0x30')]){delete _0x4f6615['name'];}_0xefcea1[_0x607e('0x22')](_0x21a10d)['send'](_0x4f6615);};}exports['index']=function(_0x41914a,_0x34f008){var _0x12d93={},_0x50c68e={},_0x27d9a7={'count':0x0,'rows':[]};var _0xa83e39=_[_0x607e('0x31')](db[_0x607e('0x32')][_0x607e('0x33')],function(_0x427874){return{'name':_0x427874[_0x607e('0x34')],'type':_0x427874['type'][_0x607e('0x35')]};});_0x50c68e[_0x607e('0x36')]=_[_0x607e('0x31')](_0xa83e39,_0x607e('0x30'));_0x50c68e[_0x607e('0x37')]=_[_0x607e('0x38')](_0x41914a[_0x607e('0x37')]);_0x50c68e[_0x607e('0x39')]=_[_0x607e('0x3a')](_0x50c68e[_0x607e('0x36')],_0x50c68e[_0x607e('0x37')]);_0x12d93[_0x607e('0x3b')]=_[_0x607e('0x3a')](_0x50c68e[_0x607e('0x36')],qs[_0x607e('0x3c')](_0x41914a[_0x607e('0x37')][_0x607e('0x3c')]));_0x12d93[_0x607e('0x3b')]=_0x12d93[_0x607e('0x3b')][_0x607e('0x3d')]?_0x12d93[_0x607e('0x3b')]:_0x50c68e[_0x607e('0x36')];if(!_0x41914a['query'][_0x607e('0x3e')]('nolimit')){_0x12d93[_0x607e('0x26')]=qs['limit'](_0x41914a[_0x607e('0x37')][_0x607e('0x26')]);_0x12d93[_0x607e('0x28')]=qs[_0x607e('0x28')](_0x41914a['query'][_0x607e('0x28')]);}_0x12d93[_0x607e('0x3f')]=qs[_0x607e('0x40')](_0x41914a[_0x607e('0x37')]['sort']);_0x12d93['where']=qs[_0x607e('0x39')](_['pick'](_0x41914a[_0x607e('0x37')],_0x50c68e['filters']),_0xa83e39);if(_0x41914a[_0x607e('0x37')][_0x607e('0x41')]){_0x12d93[_0x607e('0x42')]=_[_0x607e('0x43')](_0x12d93[_0x607e('0x42')],{'$or':_[_0x607e('0x31')](_0xa83e39,function(_0xfd941){if(_0xfd941[_0x607e('0x44')]!=='VIRTUAL'){var _0x3c4b31={};_0x3c4b31[_0xfd941['name']]={'$like':'%'+_0x41914a[_0x607e('0x37')][_0x607e('0x41')]+'%'};return _0x3c4b31;}})});}_0x12d93=_[_0x607e('0x43')]({},_0x12d93,_0x41914a[_0x607e('0x45')]);var _0x54d757={'where':_0x12d93[_0x607e('0x42')]};return db[_0x607e('0x32')][_0x607e('0x27')](_0x54d757)[_0x607e('0x2c')](function(_0x523729){_0x27d9a7[_0x607e('0x27')]=_0x523729;if(_0x41914a['query'][_0x607e('0x46')]){_0x12d93[_0x607e('0x47')]=[{'all':!![]}];}return db['Plugin'][_0x607e('0x48')](_0x12d93);})[_0x607e('0x2c')](function(_0x53d8c0){_0x27d9a7[_0x607e('0x49')]=_0x53d8c0;return _0x27d9a7;})[_0x607e('0x2c')](respondWithFilteredResult(_0x34f008,_0x12d93))[_0x607e('0x4a')](handleError(_0x34f008,null));};exports[_0x607e('0x4b')]=function(_0x27e375,_0x50f4b1){var _0xfb4dda={'raw':!![],'where':{'id':_0x27e375[_0x607e('0x4c')]['id']}},_0x26b010={};_0x26b010[_0x607e('0x36')]=_[_0x607e('0x38')](db['Plugin'][_0x607e('0x33')]);_0x26b010[_0x607e('0x37')]=_['keys'](_0x27e375[_0x607e('0x37')]);_0x26b010[_0x607e('0x39')]=_[_0x607e('0x3a')](_0x26b010[_0x607e('0x36')],_0x26b010['query']);_0xfb4dda[_0x607e('0x3b')]=_[_0x607e('0x3a')](_0x26b010[_0x607e('0x36')],qs[_0x607e('0x3c')](_0x27e375[_0x607e('0x37')][_0x607e('0x3c')]));_0xfb4dda[_0x607e('0x3b')]=_0xfb4dda['attributes'][_0x607e('0x3d')]?_0xfb4dda[_0x607e('0x3b')]:_0x26b010['model'];if(_0x27e375[_0x607e('0x37')][_0x607e('0x46')]){_0xfb4dda[_0x607e('0x47')]=[{'all':!![]}];}_0xfb4dda=_[_0x607e('0x43')]({},_0xfb4dda,_0x27e375[_0x607e('0x45')]);return db[_0x607e('0x32')][_0x607e('0x4d')](_0xfb4dda)[_0x607e('0x2c')](handleEntityNotFound(_0x50f4b1,null))['then'](respondWithResult(_0x50f4b1,null))[_0x607e('0x4a')](handleError(_0x50f4b1,null));};exports['download']=function(_0x2bfb47,_0x50f48a,_0x421a19){return db[_0x607e('0x32')][_0x607e('0x4d')]({'where':{'id':_0x2bfb47[_0x607e('0x4c')]['id']},'attributes':[_0x607e('0x30'),_0x607e('0x7')],'raw':!![]})[_0x607e('0x2c')](handleEntityNotFound(_0x50f48a,null))['then'](function(_0x171f65){if(_0x171f65){var _0x228085=path['join'](config[_0x607e('0x4e')],'server/files/plugins',util[_0x607e('0x4f')](_0x607e('0x50'),path[_0x607e('0x51')](_0x171f65[_0x607e('0x7')])));var _0x12757b=fs[_0x607e('0x52')](_0x228085);var _0x41987d=archiver('zip',{'zlib':{'level':0x9}});_0x41987d['on'](_0x607e('0x53'),function(_0x49cf90){if(_0x49cf90[_0x607e('0x54')]===_0x607e('0x55')){logger['error'](_0x49cf90);}else{throw new db[(_0x607e('0x56'))][(_0x607e('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x41987d['on'](_0x607e('0x2e'),function(_0x5c3854){throw new db['Sequelize'][(_0x607e('0x57'))](_0x607e('0x58'));});_0x41987d['pipe'](_0x12757b);_0x41987d['glob'](_0x607e('0x59'),{'cwd':path[_0x607e('0x5a')](config['root'],_0x607e('0x5b'),path[_0x607e('0x5c')](_0x171f65[_0x607e('0x7')])),'ignore':[path[_0x607e('0x5a')](path[_0x607e('0x51')](_0x171f65[_0x607e('0x7')]),_0x607e('0x5d')),path[_0x607e('0x5a')](path[_0x607e('0x51')](_0x171f65['path']),_0x607e('0x5e'))],'nodir':!![]})[_0x607e('0x5f')]();_0x12757b['on']('close',function(){if(!fs[_0x607e('0x60')](_0x228085)){throw new db[(_0x607e('0x56'))][(_0x607e('0x57'))]('Plugin\x20not\x20found');}return _0x50f48a[_0x607e('0x61')](_0x228085,util[_0x607e('0x4f')](_0x607e('0x50'),path['basename'](_0x171f65[_0x607e('0x7')])),function(_0x508c31){if(_0x508c31){throw new db[(_0x607e('0x56'))][(_0x607e('0x57'))](_0x607e('0x62'));}fs['unlinkSync'](_0x228085);logger['info']('Download\x20completed');logger[_0x607e('0x63')]('Temporary\x20file\x20removed');});});}return null;})[_0x607e('0x4a')](handleError(_0x50f48a,null));};exports[_0x607e('0x64')]=function(_0x5daddb,_0x2f4969,_0x4502a2){var _0x1d1e77=path[_0x607e('0x51')](_0x5daddb[_0x607e('0x65')][_0x607e('0x66')],path['extname'](_0x5daddb[_0x607e('0x65')][_0x607e('0x66')]));var _0x11c7b3=path[_0x607e('0x5a')](config[_0x607e('0x4e')],'server/files/plugins',_0x5daddb['file'][_0x607e('0x66')]);var _0x44127d=path[_0x607e('0x5a')](config[_0x607e('0x4e')],_0x607e('0x5b'),_0x1d1e77);logger['info'](_0x607e('0x67'),_0x11c7b3);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x44127d);try{fs['chmodSync'](_0x11c7b3,parseInt('0777',0x8));extract(_0x11c7b3,{'dir':_0x44127d},function(_0x5115c2){if(_0x5115c2){logger['error'](_0x5115c2);handleError(_0x5115c2,!![]);};var _0x39728c=fs['readdirSync'](_0x44127d);if(_0x39728c[_0x607e('0x3d')]>0x1){removeReferences(_0x11c7b3,_0x44127d);logger[_0x607e('0x2e')](_0x607e('0x68'));return _0x4502a2(new Error(_0x607e('0x68')));}var _0x5ab543=fs[_0x607e('0x69')](path[_0x607e('0x5a')](_0x44127d,_0x39728c[0x0]));if(_0x5ab543['isFile']()){removeReferences(_0x11c7b3,_0x44127d);logger['error'](_0x607e('0x68'));return _0x4502a2(new Error(_0x607e('0x68')));}if(_0x5ab543[_0x607e('0x6a')]()){var _0x9674a0=fs[_0x607e('0x6b')](path[_0x607e('0x5a')](_0x44127d,_0x39728c[0x0]));if(_0x9674a0['length']===0x0){removeReferences(_0x11c7b3,_0x44127d);logger[_0x607e('0x2e')](_0x607e('0x68'));return _0x4502a2(new Error(_0x607e('0x68')));}var _0x1cae33=_0x9674a0['some'](function(_0x244ca6){return _0x244ca6==='manifest.json';});if(!_0x1cae33){return _0x4502a2(new Error(_0x607e('0x6c')));}var _0x4f6eff=fs[_0x607e('0x6d')](path['join'](_0x44127d,_0x39728c[0x0],_0x607e('0x6e')));var _0x49b415=JSON[_0x607e('0x6f')](_0x4f6eff);if(_0x607e('0x25')==typeof _0x49b415['name']){return _0x4502a2(new Error(_0x607e('0x70')));}if('undefined'==typeof _0x49b415[_0x607e('0x44')]){return _0x4502a2(new Error(_0x607e('0x71')));}if('undefined'==typeof _0x49b415[_0x607e('0x72')]){return _0x4502a2(new Error(_0x607e('0x73')));}if('undefined'==typeof _0x49b415[_0x607e('0x74')]){return _0x4502a2(new Error(_0x607e('0x75')));}if(_0x49b415[_0x607e('0x44')]===_0x607e('0x76')){if(_0x607e('0x25')==typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')]){return _0x4502a2(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')][_0x607e('0x78')]&&'undefined'==typeof _0x49b415[_0x607e('0x74')]['views'][_0x607e('0x79')]){return _0x4502a2(new Error(_0x607e('0x7a')));}}else if(_0x49b415[_0x607e('0x44')]===_0x607e('0x7b')){if(_0x607e('0x25')==typeof _0x49b415['parameters'][_0x607e('0x7c')]){return _0x4502a2(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x607e('0x25')==typeof _0x49b415['parameters'][_0x607e('0x7d')]){return _0x4502a2(new Error(_0x607e('0x7e')));}}else{return _0x4502a2(new Error(_0x607e('0x7f')));}var _0x43d8cb=_0x49b415[_0x607e('0x30')];var _0x3f5dfa=_0x49b415[_0x607e('0x80')];var _0x1e2c3d=_0x49b415[_0x607e('0x44')];var _0x4999b1=_0x49b415[_0x607e('0x81')]?_0x49b415[_0x607e('0x81')]:'always';var _0x2f0007=_0x49b415[_0x607e('0x82')]?_0x49b415[_0x607e('0x82')]:_0x607e('0x83');var _0x511955='';var _0x1d943e='';var _0xe7fe84='';var _0x44d587='';var _0x599cc0=_0x49b415[_0x607e('0x72')];if(_0x1e2c3d===_0x607e('0x76')){if(_0x607e('0x25')!=typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')][_0x607e('0x78')]){var _0x127a20=_0x49b415[_0x607e('0x74')][_0x607e('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x607e('0x84')](_0x127a20)){_0x511955=path[_0x607e('0x5a')](_0x607e('0x85'),_0x1d1e77,_0x39728c[0x0],_0x127a20);}else{_0x511955=_0x127a20;}}else{logger[_0x607e('0x63')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x607e('0x25')!=typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')][_0x607e('0x79')]){var _0x3ea747=_0x49b415[_0x607e('0x74')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x607e('0x84')](_0x3ea747)){_0x1d943e=path[_0x607e('0x5a')](_0x607e('0x85'),_0x1d1e77,_0x39728c[0x0],_0x3ea747);}else{_0x1d943e=_0x3ea747;}}else{logger[_0x607e('0x63')](_0x607e('0x86'));}}else if(_0x1e2c3d==='script'){_0xe7fe84=_0x49b415['parameters'][_0x607e('0x7c')];_0x44d587=_0x49b415[_0x607e('0x74')][_0x607e('0x7d')];if(_0x607e('0x25')!=typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')]){if(_0x607e('0x25')!=typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')][_0x607e('0x78')]){var _0x127a20=_0x49b415[_0x607e('0x74')][_0x607e('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x127a20)){_0x511955=path[_0x607e('0x5a')](_0x607e('0x85'),_0x1d1e77,_0x39728c[0x0],_0x127a20);}else{_0x511955=_0x127a20;}}if(_0x607e('0x25')!=typeof _0x49b415[_0x607e('0x74')][_0x607e('0x77')]['agent']){var _0x3ea747=_0x49b415[_0x607e('0x74')][_0x607e('0x77')][_0x607e('0x79')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ea747)){_0x1d943e=path[_0x607e('0x5a')](_0x607e('0x85'),_0x1d1e77,_0x39728c[0x0],_0x3ea747);}else{_0x1d943e=_0x3ea747;}}}}var _0x306478={'name':_0x43d8cb,'description':_0x3f5dfa,'path':path[_0x607e('0x5a')](_0x1d1e77,_0x39728c[0x0]),'type':_0x1e2c3d,'sidebar':_0x4999b1,'icon':_0x2f0007,'adminUrl':_0x511955,'agentUrl':_0x1d943e,'scriptName':_0xe7fe84,'scriptPath':_0x44d587,'version':_0x599cc0};removeReferences(_0x11c7b3,null);return db[_0x607e('0x32')][_0x607e('0x87')](_0x306478)[_0x607e('0x2c')](function(_0x188274){var _0xee35ca={'role':_0x5daddb['body']['role'],'userProfileId':_0x5daddb[_0x607e('0x88')]['userProfileId']};if(!_0xee35ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xee35ca[_0x607e('0x89')]===_0x607e('0x8a')){var _0x923890=_0x188274['get']({'plain':!![]});return db[_0x607e('0x8b')][_0x607e('0x4d')]({'where':{'name':'Plugins','userProfileId':_0xee35ca[_0x607e('0x8c')]},'raw':!![]})[_0x607e('0x2c')](function(_0x46fb9c){if(_0x46fb9c&&_0x46fb9c[_0x607e('0x8d')]===0x0){return db['UserProfileResource'][_0x607e('0x87')]({'name':_0x923890['name'],'resourceId':_0x923890['id'],'type':_0x46fb9c[_0x607e('0x30')],'sectionId':_0x46fb9c['id']},{})[_0x607e('0x2c')](function(){return _0x188274;});}else{return _0x188274;}})['catch'](function(_0x172466){logger[_0x607e('0x2e')](_0x607e('0x8e'),_0x172466);throw _0x172466;});}return _0x188274;})[_0x607e('0x2c')](respondWithResult(_0x2f4969,null))[_0x607e('0x4a')](handleError(_0x2f4969,null));}});}catch(_0x3e3262){_0x2f4969[_0x607e('0x22')](0x1f4)[_0x607e('0x8f')](_0x3e3262);}};function removeReferences(_0x309715,_0xa43c18){try{if(_0x309715){fs[_0x607e('0x90')](_0x309715);logger['info'](_0x607e('0x91'));}if(_0xa43c18){rimraf(_0xa43c18,function(){});logger[_0x607e('0x63')](_0x607e('0x92'));}}catch(_0x3d3bcc){logger[_0x607e('0x2e')](_0x3d3bcc);}}exports[_0x607e('0x93')]=function(_0x479a6b,_0x5eaec1,_0x36bcd3){return db[_0x607e('0x32')][_0x607e('0x4d')]({'where':{'id':_0x479a6b[_0x607e('0x4c')]['id']}})[_0x607e('0x2c')](handleEntityNotFound(_0x5eaec1,null))['then'](saveUpdates(_0x479a6b[_0x607e('0x88')],null))[_0x607e('0x2c')](respondWithResult(_0x5eaec1,null))[_0x607e('0x4a')](handleError(_0x5eaec1,null));};exports[_0x607e('0x94')]=function(_0x4a18ae,_0x442ea9,_0x66e235){return db['Plugin'][_0x607e('0x4d')]({'where':{'id':_0x4a18ae[_0x607e('0x4c')]['id']}})[_0x607e('0x2c')](function(_0x3496d1){if(_0x3496d1){return _0x3496d1[_0x607e('0x95')]();}})[_0x607e('0x2c')](function(_0x8c5931){rimraf(path[_0x607e('0x5a')](config[_0x607e('0x4e')],_0x607e('0x5b'),path[_0x607e('0x5c')](_0x8c5931[_0x607e('0x7')])),function(){});return _0x8c5931;})[_0x607e('0x2c')](handleEntityNotFound(_0x442ea9,null))[_0x607e('0x2c')](respondWithStatusCode(_0x442ea9,null))[_0x607e('0x4a')](handleError(_0x442ea9,null));};exports[_0x607e('0x96')]=function(_0x220cc1,_0x51ddef,_0x2d009f){return BPromise['resolve']()[_0x607e('0x2c')](function(){if(!_0x220cc1[_0x607e('0x37')][_0x607e('0x7')]){throw new Error(_0x607e('0x97'));}if(!_0x220cc1['query'][_0x607e('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x583766=_0x220cc1[_0x607e('0x37')][_0x607e('0x99')]?_0x220cc1[_0x607e('0x37')]['hostname']+':'+_0x220cc1[_0x607e('0x37')][_0x607e('0x98')]:'http://localhost:'+_0x220cc1['query']['port'];var _0x10b68c=_0x220cc1[_0x607e('0x37')][_0x607e('0x24')]?_0x220cc1['query'][_0x607e('0x24')]:!![];var _0x486d37=_0x220cc1[_0x607e('0x37')][_0x607e('0x9a')]?_0x220cc1[_0x607e('0x37')][_0x607e('0x9a')]:null;var _0x172b68={'method':_0x220cc1[_0x607e('0x9b')],'uri':util['format'](_0x607e('0x9c'),_0x583766,_0x220cc1[_0x607e('0x37')][_0x607e('0x7')]),'json':_0x10b68c,'resolveWithFullResponse':!![],'encoding':_0x486d37,'qs':_0x220cc1[_0x607e('0x37')]};if(_0x220cc1[_0x607e('0x9d')]){_0x172b68['headers']=_0x220cc1['headers'];if(_0x172b68['headers'][_0x607e('0x9e')]){delete _0x172b68[_0x607e('0x9d')][_0x607e('0x9e')];}}if(_0x172b68[_0x607e('0x9d')][_0x607e('0x9f')]){delete _0x172b68[_0x607e('0x9d')]['content-type'];}return rp(_0x172b68);})[_0x607e('0x2c')](function(_0x7a01a1){if(_0x7a01a1){_0x51ddef['set'](_0x7a01a1['headers']);logger[_0x607e('0x63')](_0x7a01a1[_0x607e('0x88')]);if(_[_0x607e('0xa0')](_0x220cc1[_0x607e('0x37')][_0x607e('0x7')],_0x607e('0x61'))&&_0x7a01a1[_0x607e('0xa1')]==0x1f4){return _0x51ddef[_0x607e('0x21')](_0x7a01a1[_0x607e('0xa1')]);}else{return _0x51ddef[_0x607e('0x22')](_0x7a01a1['statusCode'])[_0x607e('0x8f')](_0x7a01a1[_0x607e('0x88')]);}}else{return _0x51ddef['sendStatus'](0xc8);}})[_0x607e('0x4a')](handleError(_0x51ddef,null));};exports['webhookPost']=function(_0x27957c,_0x22fa4e,_0x940ecc){return BPromise['resolve']()['then'](function(){if(!_0x27957c['query'][_0x607e('0x7')]){throw new Error(_0x607e('0x97'));}if(!_0x27957c[_0x607e('0x37')][_0x607e('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2f5d5c=_0x27957c[_0x607e('0x37')][_0x607e('0x99')]?_0x27957c[_0x607e('0x37')][_0x607e('0x99')]+':'+_0x27957c[_0x607e('0x37')][_0x607e('0x98')]:'http://localhost:'+_0x27957c[_0x607e('0x37')]['port'];var _0x5a4a12=_0x27957c['query'][_0x607e('0x24')]?_0x27957c['query'][_0x607e('0x24')]:!![];var _0x145b96=_0x27957c[_0x607e('0x37')][_0x607e('0x9a')]?_0x27957c[_0x607e('0x37')][_0x607e('0x9a')]:null;var _0xa1012b={'method':_0x27957c[_0x607e('0x9b')],'uri':util[_0x607e('0x4f')]('%s%s',_0x2f5d5c,_0x27957c[_0x607e('0x37')][_0x607e('0x7')]),'json':_0x5a4a12,'resolveWithFullResponse':!![],'encoding':_0x145b96,'body':_0x27957c[_0x607e('0x88')]};if(_0x27957c['headers']){_0xa1012b['headers']=_0x27957c[_0x607e('0x9d')];if(_0xa1012b[_0x607e('0x9d')][_0x607e('0x9e')]){delete _0xa1012b['headers'][_0x607e('0x9e')];}}if(_0xa1012b[_0x607e('0x9d')][_0x607e('0x9f')]){delete _0xa1012b[_0x607e('0x9d')][_0x607e('0x9f')];}return rp(_0xa1012b);})[_0x607e('0x2c')](function(_0x38ece5){if(_0x38ece5){_0x22fa4e['set'](_0x38ece5['headers']);logger[_0x607e('0x63')](_0x38ece5[_0x607e('0x88')]);return _0x22fa4e[_0x607e('0x22')](_0x38ece5['statusCode'])['send'](_0x38ece5['body']);}else{return _0x22fa4e[_0x607e('0x21')](0xc8);}})[_0x607e('0x4a')](handleError(_0x22fa4e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f9728dc..4c6b2c3 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 _0x5549=['save','remove','emit','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5549,0x1f4));var _0x9554=function(_0x5b1d60,_0x159224){_0x5b1d60=_0x5b1d60-0x0;var _0x3ba2c1=_0x5549[_0x5b1d60];return _0x3ba2c1;};'use strict';var EventEmitter=require(_0x9554('0x0'));var Plugin=require(_0x9554('0x1'))['db'][_0x9554('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9554('0x3')](0x0);var events={'afterCreate':_0x9554('0x4'),'afterUpdate':'update','afterDestroy':_0x9554('0x5')};function emitEvent(_0x25e709){return function(_0x244b13,_0x36fc55,_0x319ad6){PluginEvents['emit'](_0x25e709+':'+_0x244b13['id'],_0x244b13);PluginEvents[_0x9554('0x6')](_0x25e709,_0x244b13);_0x319ad6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x9554('0x7')](e,emitEvent(event));}}module[_0x9554('0x8')]=PluginEvents; \ No newline at end of file +var _0xa786=['exports','events','../../mysqldb','Plugin','save','emit','hasOwnProperty'];(function(_0x3b0515,_0x1fa41d){var _0x198d7a=function(_0x17b712){while(--_0x17b712){_0x3b0515['push'](_0x3b0515['shift']());}};_0x198d7a(++_0x1fa41d);}(_0xa786,0x71));var _0x6a78=function(_0x278fe3,_0x41c8d5){_0x278fe3=_0x278fe3-0x0;var _0x546bbb=_0xa786[_0x278fe3];return _0x546bbb;};'use strict';var EventEmitter=require(_0x6a78('0x0'));var Plugin=require(_0x6a78('0x1'))['db'][_0x6a78('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a78('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47d5d5){return function(_0x2b0fed,_0x3b3608,_0x19285c){PluginEvents[_0x6a78('0x4')](_0x47d5d5+':'+_0x2b0fed['id'],_0x2b0fed);PluginEvents[_0x6a78('0x4')](_0x47d5d5,_0x2b0fed);_0x19285c(null);};}for(var e in events){if(events[_0x6a78('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x6a78('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 1b4fd29..9d31d6c 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 _0xf404=['moment','bluebird','path','../../config/environment','exports','define','Plugin','plugins','lodash','api'];(function(_0x422ab2,_0xf72712){var _0x8ea82c=function(_0x2cf83c){while(--_0x2cf83c){_0x422ab2['push'](_0x422ab2['shift']());}};_0x8ea82c(++_0xf72712);}(_0xf404,0x120));var _0x4f40=function(_0x2ab4aa,_0x9ac327){_0x2ab4aa=_0x2ab4aa-0x0;var _0x5be4b5=_0xf404[_0x2ab4aa];return _0x5be4b5;};'use strict';var _=require(_0x4f40('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f40('0x1'));var moment=require(_0x4f40('0x2'));var BPromise=require(_0x4f40('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f40('0x4'));var rimraf=require('rimraf');var config=require(_0x4f40('0x5'));var attributes=require('./plugin.attributes');module[_0x4f40('0x6')]=function(_0x49bd76,_0x3f3af7){return _0x49bd76[_0x4f40('0x7')](_0x4f40('0x8'),attributes,{'tableName':_0x4f40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22d6=['./plugin.attributes','exports','define','plugins','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x22d6,0xea));var _0x622d=function(_0x49f856,_0x26dc54){_0x49f856=_0x49f856-0x0;var _0x1bacb6=_0x22d6[_0x49f856];return _0x1bacb6;};'use strict';var _=require(_0x622d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x622d('0x1'));var moment=require(_0x622d('0x2'));var BPromise=require(_0x622d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x622d('0x4'));var rimraf=require('rimraf');var config=require(_0x622d('0x5'));var attributes=require(_0x622d('0x6'));module[_0x622d('0x7')]=function(_0x494623,_0x5f8fc1){return _0x494623[_0x622d('0x8')]('Plugin',attributes,{'tableName':_0x622d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 0274ee0..a031577 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 _0x0ffc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','Plugin','create','body','options','raw','CreatePlugin','catch','util','moment'];(function(_0x480369,_0x5b44cb){var _0x424b4c=function(_0x4cd43b){while(--_0x4cd43b){_0x480369['push'](_0x480369['shift']());}};_0x424b4c(++_0x5b44cb);}(_0x0ffc,0x9e));var _0xc0ff=function(_0xebf7b3,_0x7ba3a6){_0xebf7b3=_0xebf7b3-0x0;var _0x393f89=_0x0ffc[_0xebf7b3];return _0x393f89;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var moment=require(_0xc0ff('0x1'));var BPromise=require('bluebird');var rs=require(_0xc0ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0ff('0x3'))['db'];var utils=require(_0xc0ff('0x4'));var logger=require(_0xc0ff('0x5'))(_0xc0ff('0x6'));var config=require(_0xc0ff('0x7'));var jayson=require(_0xc0ff('0x8'));var client=jayson[_0xc0ff('0x9')][_0xc0ff('0xa')]({'port':0x232a});config[_0xc0ff('0xb')]=_['defaults'](config[_0xc0ff('0xb')],{'host':_0xc0ff('0xc'),'port':0x18eb});var socket=require(_0xc0ff('0xd'))(new Redis(config[_0xc0ff('0xb')]));require(_0xc0ff('0xe'))[_0xc0ff('0xf')](socket);function respondWithRpcPromise(_0xd6241,_0x8b3fbd,_0x578a8a){return new BPromise(function(_0x5ee6f4,_0xdd47a6){return client['request'](_0xd6241,_0x578a8a)[_0xc0ff('0x10')](function(_0x2c5060){logger[_0xc0ff('0x11')](_0xc0ff('0x12'),_0x8b3fbd,'request\x20sent');logger[_0xc0ff('0x13')](_0xc0ff('0x14'),_0x8b3fbd,'request\x20sent',JSON[_0xc0ff('0x15')](_0x2c5060));if(_0x2c5060['error']){if(_0x2c5060['error']['code']===0x1f4){logger[_0xc0ff('0x16')](_0xc0ff('0x12'),_0x8b3fbd,_0x2c5060[_0xc0ff('0x16')]['message']);return _0xdd47a6(_0x2c5060[_0xc0ff('0x16')][_0xc0ff('0x17')]);}logger[_0xc0ff('0x16')](_0xc0ff('0x12'),_0x8b3fbd,_0x2c5060[_0xc0ff('0x16')][_0xc0ff('0x17')]);return _0x5ee6f4(_0x2c5060[_0xc0ff('0x16')][_0xc0ff('0x17')]);}else{logger[_0xc0ff('0x11')](_0xc0ff('0x12'),_0x8b3fbd,_0xc0ff('0x18'));_0x5ee6f4(_0x2c5060['result'][_0xc0ff('0x17')]);}})['catch'](function(_0x13b3f3){logger[_0xc0ff('0x16')](_0xc0ff('0x12'),_0x8b3fbd,_0x13b3f3);_0xdd47a6(_0x13b3f3);});});}exports['CreatePlugin']=function(_0x3f8d83){var _0x1d0157=this;return new Promise(function(_0x423b17,_0x212e4f){return db[_0xc0ff('0x19')][_0xc0ff('0x1a')](_0x3f8d83[_0xc0ff('0x1b')],{'raw':_0x3f8d83[_0xc0ff('0x1c')]?_0x3f8d83[_0xc0ff('0x1c')][_0xc0ff('0x1d')]===undefined?!![]:![]:!![]})[_0xc0ff('0x10')](function(_0x219be9){logger[_0xc0ff('0x11')](_0xc0ff('0x1e'),_0x3f8d83);logger[_0xc0ff('0x13')](_0xc0ff('0x1e'),_0x3f8d83,JSON['stringify'](_0x219be9));_0x423b17(_0x219be9);})[_0xc0ff('0x1f')](function(_0x5ba2c3){logger[_0xc0ff('0x16')](_0xc0ff('0x1e'),_0x5ba2c3[_0xc0ff('0x17')],_0x3f8d83);_0x212e4f(_0x1d0157[_0xc0ff('0x16')](0x1f4,_0x5ba2c3[_0xc0ff('0x17')]));});});}; \ No newline at end of file +var _0xf2d0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','body','options','raw','util','moment','bluebird','randomstring'];(function(_0x1bf9bf,_0x645bea){var _0x3762d6=function(_0x4236e2){while(--_0x4236e2){_0x1bf9bf['push'](_0x1bf9bf['shift']());}};_0x3762d6(++_0x645bea);}(_0xf2d0,0x137));var _0x0f2d=function(_0x357256,_0x1f3d84){_0x357256=_0x357256-0x0;var _0x1b0ef4=_0xf2d0[_0x357256];return _0x1b0ef4;};'use strict';var _=require('lodash');var util=require(_0x0f2d('0x0'));var moment=require(_0x0f2d('0x1'));var BPromise=require(_0x0f2d('0x2'));var rs=require(_0x0f2d('0x3'));var fs=require('fs');var Redis=require(_0x0f2d('0x4'));var db=require(_0x0f2d('0x5'))['db'];var utils=require(_0x0f2d('0x6'));var logger=require(_0x0f2d('0x7'))(_0x0f2d('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f2d('0x9'));var client=jayson[_0x0f2d('0xa')][_0x0f2d('0xb')]({'port':0x232a});config[_0x0f2d('0xc')]=_[_0x0f2d('0xd')](config[_0x0f2d('0xc')],{'host':_0x0f2d('0xe'),'port':0x18eb});var socket=require(_0x0f2d('0xf'))(new Redis(config[_0x0f2d('0xc')]));require('./plugin.socket')[_0x0f2d('0x10')](socket);function respondWithRpcPromise(_0x425328,_0xcc912b,_0x525112){return new BPromise(function(_0x5b07ab,_0x571d5f){return client[_0x0f2d('0x11')](_0x425328,_0x525112)[_0x0f2d('0x12')](function(_0x1a028f){logger[_0x0f2d('0x13')](_0x0f2d('0x14'),_0xcc912b,_0x0f2d('0x15'));logger[_0x0f2d('0x16')](_0x0f2d('0x17'),_0xcc912b,_0x0f2d('0x15'),JSON[_0x0f2d('0x18')](_0x1a028f));if(_0x1a028f[_0x0f2d('0x19')]){if(_0x1a028f[_0x0f2d('0x19')][_0x0f2d('0x1a')]===0x1f4){logger['error'](_0x0f2d('0x14'),_0xcc912b,_0x1a028f[_0x0f2d('0x19')][_0x0f2d('0x1b')]);return _0x571d5f(_0x1a028f[_0x0f2d('0x19')]['message']);}logger[_0x0f2d('0x19')](_0x0f2d('0x14'),_0xcc912b,_0x1a028f[_0x0f2d('0x19')]['message']);return _0x5b07ab(_0x1a028f[_0x0f2d('0x19')]['message']);}else{logger[_0x0f2d('0x13')](_0x0f2d('0x14'),_0xcc912b,_0x0f2d('0x15'));_0x5b07ab(_0x1a028f[_0x0f2d('0x1c')][_0x0f2d('0x1b')]);}})[_0x0f2d('0x1d')](function(_0xbda1fb){logger['error'](_0x0f2d('0x14'),_0xcc912b,_0xbda1fb);_0x571d5f(_0xbda1fb);});});}exports[_0x0f2d('0x1e')]=function(_0xb3671f){var _0x58bc99=this;return new Promise(function(_0x84b52c,_0x11c607){return db['Plugin'][_0x0f2d('0x1f')](_0xb3671f[_0x0f2d('0x20')],{'raw':_0xb3671f[_0x0f2d('0x21')]?_0xb3671f[_0x0f2d('0x21')][_0x0f2d('0x22')]===undefined?!![]:![]:!![]})[_0x0f2d('0x12')](function(_0x493d22){logger['info'](_0x0f2d('0x1e'),_0xb3671f);logger[_0x0f2d('0x16')](_0x0f2d('0x1e'),_0xb3671f,JSON['stringify'](_0x493d22));_0x84b52c(_0x493d22);})[_0x0f2d('0x1d')](function(_0x4c3571){logger['error'](_0x0f2d('0x1e'),_0x4c3571['message'],_0xb3671f);_0x11c607(_0x58bc99[_0x0f2d('0x19')](0x1f4,_0x4c3571[_0x0f2d('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c036eb8..782e2a9 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 _0x52c5=['length','plugin:','./plugin.events','save','remove','update','emit','register'];(function(_0x6e2e26,_0x5ddf08){var _0x583af2=function(_0x3b2ee6){while(--_0x3b2ee6){_0x6e2e26['push'](_0x6e2e26['shift']());}};_0x583af2(++_0x5ddf08);}(_0x52c5,0x18a));var _0x552c=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x52c5[_0x3f3bad];return _0x4f0801;};'use strict';var PluginEvents=require(_0x552c('0x0'));var events=[_0x552c('0x1'),_0x552c('0x2'),_0x552c('0x3')];function createListener(_0xb3c836,_0x31a9f9){return function(_0x1a65d7){_0x31a9f9[_0x552c('0x4')](_0xb3c836,_0x1a65d7);};}function removeListener(_0x41419a,_0x41217f){return function(){PluginEvents['removeListener'](_0x41419a,_0x41217f);};}exports[_0x552c('0x5')]=function(_0x6a0b19){for(var _0x289d82=0x0,_0x36d880=events[_0x552c('0x6')];_0x289d82<_0x36d880;_0x289d82++){var _0x565460=events[_0x289d82];var _0x588278=createListener(_0x552c('0x7')+_0x565460,_0x6a0b19);PluginEvents['on'](_0x565460,_0x588278);}}; \ No newline at end of file +var _0xf777=['removeListener','register','length','plugin:','./plugin.events','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf777,0xe2));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var PluginEvents=require(_0x7f77('0x0'));var events=['save',_0x7f77('0x1'),'update'];function createListener(_0x496aa3,_0x2c455e){return function(_0x509836){_0x2c455e['emit'](_0x496aa3,_0x509836);};}function removeListener(_0x52ced1,_0x3b7207){return function(){PluginEvents[_0x7f77('0x2')](_0x52ced1,_0x3b7207);};}exports[_0x7f77('0x3')]=function(_0x4abf7a){for(var _0x53b57d=0x0,_0x198a7e=events[_0x7f77('0x4')];_0x53b57d<_0x198a7e;_0x53b57d++){var _0x4fdd1d=events[_0x53b57d];var _0x4ef6c0=createListener(_0x7f77('0x5')+_0x4fdd1d,_0x4abf7a);PluginEvents['on'](_0x4fdd1d,_0x4ef6c0);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b59bef1..62f3e2b 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(_0x4823e2,_0xe74585){var _0x5dc63d=function(_0x29b425){while(--_0x29b425){_0x4823e2['push'](_0x4823e2['shift']());}};_0x5dc63d(++_0xe74585);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x2652eb,_0x3c489d){var _0x54b2ed=function(_0x2e3ed9){while(--_0x2e3ed9){_0x2652eb['push'](_0x2652eb['shift']());}};_0x54b2ed(++_0x3c489d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 03eafd3..439e239 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 _0x96cc=['bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','lodash','../../config/logger','path','child_process','exec'];(function(_0xc52e5b,_0x47e4ef){var _0x52df70=function(_0x14b6dc){while(--_0x14b6dc){_0xc52e5b['push'](_0xc52e5b['shift']());}};_0x52df70(++_0x47e4ef);}(_0x96cc,0x16c));var _0xc96c=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x96cc[_0x10852d];return _0x13a8d6;};'use strict';var _=require(_0xc96c('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xc96c('0x1'))('api');var path=require(_0xc96c('0x2'));var exec=require(_0xc96c('0x3'))[_0xc96c('0x4')];var BPromise=require(_0xc96c('0x5'));function handleEntityNotFound(_0x71140d,_0x29b6f1){return function(_0x377e6c){if(!_0x377e6c){_0x71140d[_0xc96c('0x6')](0x194);;}return _0x377e6c;};}function respondWithResult(_0x3b7f45,_0x5142cd){_0x5142cd=_0x5142cd||0xc8;return function(_0x10b411){if(_0x10b411){return _0x3b7f45[_0xc96c('0x7')](_0x5142cd)[_0xc96c('0x8')](_0x10b411);}return null;};}function handleError(_0x86c1a8,_0x13363d){_0x13363d=_0x13363d||0x1f4;return function(_0x4c9f93){logger[_0xc96c('0x9')](_0x4c9f93['stack']);if(_0x4c9f93[_0xc96c('0xa')]){delete _0x4c9f93[_0xc96c('0xa')];}_0x86c1a8[_0xc96c('0x7')](_0x13363d)['send'](_0x4c9f93);};}function execChildProcess(){return new BPromise(function(_0x95ce8e,_0x4a91dd){exec(_0xc96c('0xb'),function(_0x559477,_0x18a1a6,_0x32f682){logger[_0xc96c('0xc')](_0x18a1a6);logger[_0xc96c('0xc')](_0x32f682);if(_0x559477){logger['error'](_0x559477);return _0x4a91dd(_0x559477);}return _0x95ce8e(_0x18a1a6);});});}exports[_0xc96c('0xd')]=function(_0x43fcaa,_0x1e7742){return pm2[_0xc96c('0xe')]()['then'](function(_0x35da94){if(_0x35da94){var _0xbed0c9=_[_0xc96c('0xf')](_0x35da94,function(_0x32e640){return _0x32e640[_0xc96c('0xa')]===_0xc96c('0x10')||_0x32e640[_0xc96c('0xa')]===_0xc96c('0x11');});return{'rows':_0xbed0c9,'count':_0xbed0c9[_0xc96c('0x12')]};}return null;})[_0xc96c('0x13')](respondWithResult(_0x1e7742,null))[_0xc96c('0x14')](handleError(_0x1e7742,null));};exports['show']=function(_0x509376,_0x406791){return pm2[_0xc96c('0x15')](_0x509376[_0xc96c('0x16')]['id'])[_0xc96c('0x13')](respondWithResult(_0x406791,null))['then'](handleEntityNotFound(_0x406791,null))[_0xc96c('0x14')](handleError(_0x406791,null));};exports[_0xc96c('0x17')]=function(_0x2a361c,_0x3c0864){if(_0x2a361c[_0xc96c('0x18')][_0xc96c('0xa')]&&_0x2a361c[_0xc96c('0x18')][_0xc96c('0x19')]){var _0x28d762=path[_0xc96c('0x1a')](__dirname,_0xc96c('0x1b'),_0x2a361c[_0xc96c('0x18')][_0xc96c('0x19')]);var _0x45edee=process[_0xc96c('0x1c')]();process[_0xc96c('0x1d')](path[_0xc96c('0x1e')](_0x28d762));return execChildProcess()['then'](function(_0xd63951){process[_0xc96c('0x1d')](_0x45edee);return pm2[_0xc96c('0x1f')]({'name':_0x2a361c[_0xc96c('0x18')][_0xc96c('0xa')],'script':_0x28d762});})[_0xc96c('0x13')](function(_0x40f23d){pm2[_0xc96c('0x20')]();return _0x40f23d[0x0];})[_0xc96c('0x13')](respondWithResult(_0x3c0864,0xc9))[_0xc96c('0x14')](handleError(_0x3c0864,null));}else{return _0x3c0864['status'](0x1f4)[_0xc96c('0x21')]({'message':_0xc96c('0x22')});}};exports[_0xc96c('0x23')]=function(_0x294fee,_0x58fab3){if(_0x294fee['body']['id']){delete _0x294fee[_0xc96c('0x18')]['id'];}var _0x12c293={'online':_0xc96c('0x24'),'stopped':_0xc96c('0x25')};if(_0x12c293[_0xc96c('0x26')](_0x294fee[_0xc96c('0x18')][_0xc96c('0x7')])){return pm2[_0x12c293[_0x294fee[_0xc96c('0x18')][_0xc96c('0x7')]]](_0x294fee[_0xc96c('0x16')]['id'])[_0xc96c('0x13')](respondWithResult(_0x58fab3,0xc8))[_0xc96c('0x14')](handleError(_0x58fab3,null));}else{return _0x58fab3[_0xc96c('0x7')](0x1f4)[_0xc96c('0x21')]({'message':'Unknown\x20status'});}};exports[_0xc96c('0x27')]=function(_0x53c994,_0x3f4b0e){if(_0x53c994[_0xc96c('0x18')]['id']){delete _0x53c994[_0xc96c('0x18')]['id'];}if(_0x53c994['params']['id']){return pm2[_0xc96c('0x28')](_0x53c994[_0xc96c('0x16')]['id'])[_0xc96c('0x13')](function(_0x26c5b7){pm2['dump']();return _0x26c5b7[0x0];})['then'](respondWithResult(_0x3f4b0e,null))[_0xc96c('0x14')](handleError(_0x3f4b0e,null));}else{return _0x3f4b0e[_0xc96c('0x7')](0x1f4)[_0xc96c('0x21')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x0fd9=['error','index','list','reject','express','then','catch','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','hasOwnProperty','Unknown\x20status','params','Unknown\x20id','../../config/pm2','../../config/logger','api','path','bluebird','sendStatus','status','stack','name','send','npm\x20install','info'];(function(_0x1296e4,_0x3e5292){var _0x1196c5=function(_0x40046a){while(--_0x40046a){_0x1296e4['push'](_0x1296e4['shift']());}};_0x1196c5(++_0x3e5292);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x0fd9[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var pm2=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var path=require(_0x90fd('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0x90fd('0x4'));function handleEntityNotFound(_0x2a5f76,_0xb7cf6){return function(_0x37a8be){if(!_0x37a8be){_0x2a5f76[_0x90fd('0x5')](0x194);;}return _0x37a8be;};}function respondWithResult(_0x23e11b,_0x5e2107){_0x5e2107=_0x5e2107||0xc8;return function(_0x4ff2d4){if(_0x4ff2d4){return _0x23e11b[_0x90fd('0x6')](_0x5e2107)['json'](_0x4ff2d4);}return null;};}function handleError(_0x5a604a,_0x2acef7){_0x2acef7=_0x2acef7||0x1f4;return function(_0x1becf2){logger['error'](_0x1becf2[_0x90fd('0x7')]);if(_0x1becf2[_0x90fd('0x8')]){delete _0x1becf2[_0x90fd('0x8')];}_0x5a604a[_0x90fd('0x6')](_0x2acef7)[_0x90fd('0x9')](_0x1becf2);};}function execChildProcess(){return new BPromise(function(_0x3be346,_0x2aae77){exec(_0x90fd('0xa'),function(_0x3c541e,_0x48943e,_0x23c417){logger[_0x90fd('0xb')](_0x48943e);logger['info'](_0x23c417);if(_0x3c541e){logger[_0x90fd('0xc')](_0x3c541e);return _0x2aae77(_0x3c541e);}return _0x3be346(_0x48943e);});});}exports[_0x90fd('0xd')]=function(_0x19a594,_0x5f28ab){return pm2[_0x90fd('0xe')]()['then'](function(_0x1cae40){if(_0x1cae40){var _0xb402d9=_[_0x90fd('0xf')](_0x1cae40,function(_0x1b3f3b){return _0x1b3f3b[_0x90fd('0x8')]===_0x90fd('0x10')||_0x1b3f3b[_0x90fd('0x8')]==='motion2';});return{'rows':_0xb402d9,'count':_0xb402d9['length']};}return null;})[_0x90fd('0x11')](respondWithResult(_0x5f28ab,null))[_0x90fd('0x12')](handleError(_0x5f28ab,null));};exports['show']=function(_0x130489,_0x13a694){return pm2[_0x90fd('0x13')](_0x130489['params']['id'])[_0x90fd('0x11')](respondWithResult(_0x13a694,null))[_0x90fd('0x11')](handleEntityNotFound(_0x13a694,null))[_0x90fd('0x12')](handleError(_0x13a694,null));};exports[_0x90fd('0x14')]=function(_0x251957,_0x58866f){if(_0x251957[_0x90fd('0x15')][_0x90fd('0x8')]&&_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]){var _0x19e79b=path[_0x90fd('0x17')](__dirname,_0x90fd('0x18'),_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]);var _0x493c26=process[_0x90fd('0x19')]();process[_0x90fd('0x1a')](path[_0x90fd('0x1b')](_0x19e79b));return execChildProcess()[_0x90fd('0x11')](function(_0x411a6a){process[_0x90fd('0x1a')](_0x493c26);return pm2[_0x90fd('0x1c')]({'name':_0x251957[_0x90fd('0x15')]['name'],'script':_0x19e79b});})[_0x90fd('0x11')](function(_0x52b066){pm2[_0x90fd('0x1d')]();return _0x52b066[0x0];})[_0x90fd('0x11')](respondWithResult(_0x58866f,0xc9))[_0x90fd('0x12')](handleError(_0x58866f,null));}else{return _0x58866f[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x90fd('0x1e')]=function(_0xe333f0,_0x2fffe6){if(_0xe333f0[_0x90fd('0x15')]['id']){delete _0xe333f0[_0x90fd('0x15')]['id'];}var _0x428bc2={'online':'restart','stopped':'stop'};if(_0x428bc2[_0x90fd('0x1f')](_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')])){return pm2[_0x428bc2[_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')]]](_0xe333f0['params']['id'])['then'](respondWithResult(_0x2fffe6,0xc8))[_0x90fd('0x12')](handleError(_0x2fffe6,null));}else{return _0x2fffe6[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x20')});}};exports['destroy']=function(_0x59aede,_0x12dea4){if(_0x59aede[_0x90fd('0x15')]['id']){delete _0x59aede[_0x90fd('0x15')]['id'];}if(_0x59aede[_0x90fd('0x21')]['id']){return pm2['delete'](_0x59aede[_0x90fd('0x21')]['id'])[_0x90fd('0x11')](function(_0x7fb8bc){pm2[_0x90fd('0x1d')]();return _0x7fb8bc[0x0];})[_0x90fd('0x11')](respondWithResult(_0x12dea4,null))[_0x90fd('0x12')](handleError(_0x12dea4,null));}else{return _0x12dea4[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b273a3d..b404046 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 _0x56fa=['/queues','getQueues','express','../../components/auth/service','./realtime.controller','isAuthenticated','getAgents'];(function(_0x1062e3,_0x49349e){var _0x92e616=function(_0x1ca4fe){while(--_0x1ca4fe){_0x1062e3['push'](_0x1062e3['shift']());}};_0x92e616(++_0x49349e);}(_0x56fa,0x11a));var _0xa56f=function(_0x224764,_0x9115f0){_0x224764=_0x224764-0x0;var _0x54d17a=_0x56fa[_0x224764];return _0x54d17a;};'use strict';var express=require(_0xa56f('0x0'));var router=express['Router']();var auth=require(_0xa56f('0x1'));var controller=require(_0xa56f('0x2'));router['get']('/agents',auth[_0xa56f('0x3')](),controller[_0xa56f('0x4')]);router['get'](_0xa56f('0x5'),auth['isAuthenticated'](),controller[_0xa56f('0x6')]);module['exports']=router; \ No newline at end of file +var _0xeb87=['../../components/auth/service','./realtime.controller','get','/agents','getAgents','getQueues','exports','express','Router'];(function(_0x15a99d,_0x4486ea){var _0x2cb908=function(_0x1243c1){while(--_0x1243c1){_0x15a99d['push'](_0x15a99d['shift']());}};_0x2cb908(++_0x4486ea);}(_0xeb87,0x103));var _0x7eb8=function(_0x531a68,_0x358578){_0x531a68=_0x531a68-0x0;var _0x2756e8=_0xeb87[_0x531a68];return _0x2756e8;};'use strict';var express=require(_0x7eb8('0x0'));var router=express[_0x7eb8('0x1')]();var auth=require(_0x7eb8('0x2'));var controller=require(_0x7eb8('0x3'));router[_0x7eb8('0x4')](_0x7eb8('0x5'),auth['isAuthenticated'](),controller[_0x7eb8('0x6')]);router[_0x7eb8('0x4')]('/queues',auth['isAuthenticated'](),controller[_0x7eb8('0x7')]);module[_0x7eb8('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 6ffc3db..9f5a1a1 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 _0x9dd3=['length','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','User','Queue','Pause','findAll','QueueId','idle','ringing','isNil','chatPause','faxPause','every','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','whatsappStatus','mail','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','Invalid\x20channel','isArray','map','getAgents','all','flatten','uniq','value','order','startsWith','DESC','ASC','globalStatus','pauseType','userpic','lastLoginAt','lastPauseAt','address','openchannelPause','mailPause','smsPause','whatsappPause','voicePause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','smsStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','channel','query','sort','fields','join','globalQueueFilter','rawAttributes','fieldName','agent','getOptions','raw','where','user','role','userProfileId','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','getQueues','type','QueueCampaigns','UserProfile','getResources','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','limit','undefined','count','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','result','merge','catch','voice','startCase','Queues','VoiceQueuesChannels','available','waiting','talking','paused','outbound','push','pTalking','originated','dialActive','dialMethod','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','agents','loggedInDb','loggedIn','busy','filter','queue'];(function(_0x4aafca,_0x17cd90){var _0x135c01=function(_0x45be28){while(--_0x45be28){_0x4aafca['push'](_0x4aafca['shift']());}};_0x135c01(++_0x17cd90);}(_0x9dd3,0x108));var _0x39dd=function(_0x3878af,_0x29e9ad){_0x3878af=_0x3878af-0x0;var _0x421a3d=_0x9dd3[_0x3878af];return _0x421a3d;};'use strict';var util=require(_0x39dd('0x0'));var _=require(_0x39dd('0x1'));var jayson=require('jayson/promise');var qs=require(_0x39dd('0x2'));var logger=require(_0x39dd('0x3'))(_0x39dd('0x4'));var db=require(_0x39dd('0x5'))['db'];var amiClient=jayson[_0x39dd('0x6')][_0x39dd('0x7')]({'port':0x232a});var routingClient=jayson[_0x39dd('0x6')]['http']({'port':0x232c});function respondWithFilteredResult(_0x2d695d,_0x4a7c18){return function(_0x719e3b){if(_0x719e3b){var _0x5dbf1f=typeof _0x4a7c18[_0x39dd('0x8')]==='undefined'&&typeof _0x4a7c18[_0x39dd('0x9')]===_0x39dd('0xa');var _0x3ead51=_0x719e3b[_0x39dd('0xb')];var _0xa12577=_0x5dbf1f?0x0:_0x4a7c18[_0x39dd('0x8')];var _0x530182=_0x5dbf1f?_0x719e3b[_0x39dd('0xb')]:_0x4a7c18[_0x39dd('0x8')]+_0x4a7c18[_0x39dd('0x9')];var _0x3b869d;if(_0x530182>=_0x3ead51){_0x530182=_0x3ead51;_0x3b869d=0xc8;}else{_0x3b869d=0xce;}_0x2d695d[_0x39dd('0xc')](_0x3b869d);return _0x2d695d[_0x39dd('0xd')](_0x39dd('0xe'),_0xa12577+'-'+_0x530182+'/'+_0x3ead51)[_0x39dd('0xf')](_0x719e3b);}return null;};}function handleError(_0x444f04,_0x29997a){_0x29997a=_0x29997a||0x1f4;return function(_0x916d8d){logger[_0x39dd('0x10')](_0x916d8d[_0x39dd('0x11')]);if(_0x916d8d['name']){delete _0x916d8d[_0x39dd('0x12')];}_0x444f04[_0x39dd('0xc')](_0x29997a)[_0x39dd('0x13')](_0x916d8d);};}function getRealtimeAgents(){return new Promise(function(_0x37a698,_0x48d442){return amiClient[_0x39dd('0x14')](_0x39dd('0x15'),{})[_0x39dd('0x16')](function(_0x48d36a){if(_0x48d36a[_0x39dd('0x10')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x2f8491=_0x48d36a[_0x39dd('0x17')];return routingClient['request'](_0x39dd('0x15'),{})[_0x39dd('0x16')](function(_0x1a2bdd){if(_0x1a2bdd[_0x39dd('0x10')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0xee0f30=_0x1a2bdd[_0x39dd('0x17')];return _0x37a698(_[_0x39dd('0x18')]({},_0x2f8491,_0xee0f30));});})[_0x39dd('0x19')](function(_0x491a3f){_0x48d442(_0x491a3f);});});}function getRealtimeQueues(_0x4602c6,_0x3c7aa9){return new Promise(function(_0x1b30da,_0x4c1905){var _0x4903b4=_0x3c7aa9===_0x39dd('0x1a')?amiClient:routingClient;return _0x4903b4[_0x39dd('0x14')](_[_0x39dd('0x1b')](_0x3c7aa9)+_0x39dd('0x1c'),_0x4602c6)[_0x39dd('0x16')](function(_0x2b0dea){if(_0x2b0dea['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x3c7aa9));return _0x1b30da(_0x2b0dea[_0x39dd('0x17')]);})[_0x39dd('0x19')](function(_0x505ba7){_0x4c1905(_0x505ba7);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x74375c,_0x23388c){return amiClient[_0x39dd('0x14')](_0x39dd('0x1d'),{})[_0x39dd('0x16')](function(_0x382065){if(_0x382065[_0x39dd('0x10')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x74375c(_0x382065[_0x39dd('0x17')]);})[_0x39dd('0x19')](function(_0x1c8ea1){_0x23388c(_0x1c8ea1);});});}function initializeQueues(_0x3b0d40,_0x31ef3f,_0xba8782,_0x1a3b7a){var _0x26213c=['loggedIn',_0x39dd('0x1e'),_0x39dd('0x1f'),_0x39dd('0x20'),_0x39dd('0x21')];if(_0xba8782===_0x39dd('0x1a')&&_0x1a3b7a===_0x39dd('0x22')){_0x26213c[_0x39dd('0x23')](_0x39dd('0x24'),_0x39dd('0x25'),'message',_0x39dd('0x26'),_0x39dd('0x27'),_0x39dd('0x28'),'startPredictive',_0x39dd('0x29'),'erlangCalls',_0x39dd('0x2a'),_0x39dd('0x2b'),_0x39dd('0x2c'),_0x39dd('0x2d'),'dialPredictiveIntervalMaxThreshold',_0x39dd('0x2e'),_0x39dd('0x2f'),'predictiveIntervalTotalCalls',_0x39dd('0x30'),'predictiveIntervalDroppedCallsTimeout',_0x39dd('0x31'),_0x39dd('0x32'),'predictiveIntervalAvgTalktime');}return _0x3b0d40['map'](function(_0x9cc5b4){var _0x1345fe=_0x9cc5b4[_0x39dd('0x33')]({'plain':!![]});_0x1345fe[_0x39dd('0x34')]=[];_0x1345fe[_0x39dd('0x21')]=0x0;_0x1345fe[_0x39dd('0x35')]=0x0;_0x1345fe[_0x39dd('0x36')]=0x0;_0x1345fe['available']=0x0;_0x1345fe[_0x39dd('0x1f')]=0x0;if(_0xba8782===_0x39dd('0x1a')){_0x1345fe[_0x39dd('0x20')]=0x0;_0x1345fe[_0x39dd('0x37')]=0x0;if(_0x1a3b7a==='outbound'){_0x1345fe[_0x39dd('0x24')]=0x0;_0x1345fe[_0x39dd('0x25')]=0x0;}}var _0x4a2b43=_['find'](_0x31ef3f,['id',_0x1345fe['id']]);if(_0x4a2b43)_[_0x39dd('0x18')](_0x1345fe,_['pick'](_0x4a2b43,_0x26213c));return _0x1345fe;});}function updateAgentVoiceStatus(_0x3f3d68,_0x26e685,_0x2ca244){var _0x2f979c=_[_0x39dd('0x38')](_0x2ca244,[_0x39dd('0x39'),_0x26e685[_0x39dd('0x12')]]);if(_0x2f979c[_0x39dd('0x3a')]===0x0)return _0x3f3d68[_0x39dd('0x37')]=!![];if(_[_0x39dd('0x3b')](_0x2f979c,[_0x39dd('0x3c'),_0x3f3d68[_0x39dd('0x3d')][_0x39dd('0x3e')]()]))return _0x3f3d68['talking']=!![];if(!_0x3f3d68[_0x39dd('0x20')])return _0x3f3d68['busy']=!![];}function getVoiceQueueAgents(_0x385b89,_0x5a6373,_0x3f053f,_0x1dc588){var _0x465440=_[_0x39dd('0x3f')](_0x5a6373,['id',_0x385b89['id']]);if(!_0x465440)return _0x385b89;return _0x465440['getMembers']({'raw':!![]})[_0x39dd('0x16')](function(_0x1ff76c){for(var _0x1e4c07=0x0;_0x1e4c07<_0x1ff76c['length'];_0x1e4c07++){var _0x35ad93=_[_0x39dd('0x3f')](_0x3f053f,['id',_0x1ff76c[_0x1e4c07][_0x39dd('0x40')]]);if(!_0x35ad93){_0x35ad93={'id':_0x1ff76c[_0x1e4c07][_0x39dd('0x40')],'name':_0x1ff76c[_0x1e4c07][_0x39dd('0x40')],'accountcode':'','online':![]};}var _0x19ecdc={'id':_0x35ad93['id'],'name':_0x35ad93[_0x39dd('0x12')],'internal':_0x35ad93[_0x39dd('0x41')],'online':Boolean(_0x35ad93[_0x39dd('0x42')]),'paused':Boolean(_0x1ff76c[_0x1e4c07]['paused'])};if(_0x35ad93['voiceStatus']==='talking')updateAgentVoiceStatus(_0x19ecdc,_0x385b89,_0x1dc588);if(_0x19ecdc['online'])_0x385b89[_0x39dd('0x35')]++;if(_0x19ecdc[_0x39dd('0x37')])_0x385b89[_0x39dd('0x37')]++;if(_0x19ecdc[_0x39dd('0x21')]&&!_0x19ecdc[_0x39dd('0x37')]&&!_0x19ecdc['talking'])_0x385b89['paused']++;_0x385b89[_0x39dd('0x34')]['push'](_0x19ecdc);}return _0x385b89;});}function getQueueAgents(_0x190467,_0x458101,_0x139343){var _0x13d55f=_0x39dd('0x43')+_[_0x39dd('0x1b')](_0x139343)+_0x39dd('0x44');var _0x42d5b6=_0x139343+_0x39dd('0x45');return db[_0x13d55f][_0x39dd('0x46')]({'where':{[_[_0x39dd('0x1b')](_0x139343)+_0x39dd('0x47')]:_0x190467['id']},'raw':!![]})[_0x39dd('0x16')](function(_0x1a37c0){for(var _0x6ccde3=0x0;_0x6ccde3<_0x1a37c0['length'];_0x6ccde3++){var _0x10fa05=_['find'](_0x458101,['id',_0x1a37c0[_0x6ccde3][_0x39dd('0x40')]]);if(!_0x10fa05){_0x10fa05={'id':_0x1a37c0[_0x6ccde3]['UserId'],'name':_0x1a37c0[_0x6ccde3][_0x39dd('0x40')],'online':![],['pauseField']:![]};}var _0x126dc3={'id':_0x10fa05['id'],'name':_0x10fa05[_0x39dd('0x12')],'online':Boolean(_0x10fa05[_0x39dd('0x42')]),'paused':Boolean(_0x10fa05[_0x42d5b6])};if(_0x126dc3[_0x39dd('0x42')])_0x190467[_0x39dd('0x35')]++;_0x190467[_0x39dd('0x34')][_0x39dd('0x23')](_0x126dc3);}return _0x190467;});}function isIdle(_0x323c16){return _0x323c16===_0x39dd('0x48')||_0x323c16==='unknown'||_0x323c16==='unavailable'||_0x323c16===_0x39dd('0x49')||_[_0x39dd('0x4a')](_0x323c16);}function isAgentPaused(_0x5a3ca3,_0x177dda){var _0x364ce0=[_0x5a3ca3[_0x39dd('0x4b')],_0x5a3ca3[_0x39dd('0x4c')],_0x5a3ca3['mailPause'],_0x5a3ca3['openchannelPause'],_0x5a3ca3['smsPause'],_0x5a3ca3['voicePause'],_0x5a3ca3['whatsappPause']];if(!_0x177dda)return _[_0x39dd('0x4d')](_0x364ce0);var _0x12255e=_['filter'](_0x364ce0);return _0x12255e[_0x39dd('0x3a')]>0x0&&_0x12255e[_0x39dd('0x3a')]<_0x364ce0[_0x39dd('0x3a')]?!![]:![];}function isAgentIdle(_0x34baa0){if(_0x34baa0['voiceStatus']!=='idle'&&_0x34baa0['voicePause']){_0x34baa0[_0x39dd('0x4e')]=_0x39dd('0x4f');return![];}return _[_0x39dd('0x4d')]([_0x34baa0[_0x39dd('0x50')],_0x34baa0[_0x39dd('0x51')],_0x34baa0['mailStatus'],_0x34baa0[_0x39dd('0x52')],_0x34baa0['smsStatus'],_0x34baa0[_0x39dd('0x4e')],_0x34baa0[_0x39dd('0x53')]],isIdle);}function getAgentStatus(_0x1e6ade){var _0x2971a0='unknown';if(isAgentPaused(_0x1e6ade))_0x2971a0=_0x39dd('0x4f');else if(isAgentPaused(_0x1e6ade,!![]))_0x2971a0='*pause';else if(isAgentIdle(_0x1e6ade))_0x2971a0='idle';else _0x2971a0=_0x39dd('0x37');return _0x2971a0;}function validateChannel(_0x17e074){var _0x3b45f2=[_0x39dd('0x54'),_0x39dd('0x55'),_0x39dd('0x56'),_0x39dd('0x57'),_0x39dd('0x58'),_0x39dd('0x59'),_0x39dd('0x1a')];if(!_[_0x39dd('0x5a')](_0x3b45f2,_0x17e074[_0x39dd('0x5b')]()))throw new Error(_0x39dd('0x5c'));return _0x17e074[_0x39dd('0x5b')]();}function getFilteredAgentIds(_0x260ae1,_0x4708a3){var _0x2cc575=_[_0x39dd('0x5d')](_0x260ae1)?_0x260ae1:[_0x260ae1];var _0xb9edad=_[_0x39dd('0x5e')](_0x2cc575,function(_0xf9fd02){return db[_0x4708a3]['findOne']({'where':{'name':_0xf9fd02}})['then'](function(_0x513955){if(!_0x513955)return[];return _0x513955[_0x39dd('0x5f')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x39dd('0x60')](_0xb9edad)['then'](function(_0x3de2af){var _0x27efb9=_(_0x3de2af)[_0x39dd('0x61')]()[_0x39dd('0x5e')]('id')[_0x39dd('0x62')]()[_0x39dd('0x63')]();return _0x27efb9;});}function getUpdatedSortOptions(_0x52fafa){var _0x3e86be={'fields':[],'order':null};var _0x3356ad=_0x52fafa['split'](',');_0x3e86be['fields']=_[_0x39dd('0x38')](_0x3356ad,function(_0x3eb169){if(!_0x3eb169[_0x39dd('0x5a')]('globalStatus'))return!![];_0x3e86be[_0x39dd('0x64')]=_[_0x39dd('0x65')](_0x3eb169,'-')?_0x39dd('0x66'):_0x39dd('0x67');return![];});return _0x3e86be;}function orderAgentsByStatus(_0x20f8d6,_0x5e656d){return _0x20f8d6['sort'](function(_0x24ba24,_0x44a120){if(_0x24ba24[_0x39dd('0x68')]===_0x44a120[_0x39dd('0x68')]&&_0x24ba24[_0x39dd('0x68')]==='pause'){if(_0x5e656d==='DESC')return(_0x24ba24[_0x39dd('0x69')]||'')<(_0x44a120[_0x39dd('0x69')]||'')?0x1:-0x1;return _0x24ba24[_0x39dd('0x69')]<_0x44a120[_0x39dd('0x69')]?-0x1:0x1;}else{if(_0x5e656d==='DESC')return _0x24ba24['globalStatus']<_0x44a120[_0x39dd('0x68')]?0x1:-0x1;return _0x24ba24['globalStatus']<_0x44a120['globalStatus']?-0x1:0x1;}});}exports[_0x39dd('0x5f')]=function(_0x107c8a,_0x433567){var _0x52a308={'count':0x0,'rows':[]},_0x579d76={},_0x417767,_0x1ff6a,_0x53b5e6,_0x4cfa26,_0x4c1826=[_0x39dd('0x6a'),_0x39dd('0x42'),_0x39dd('0x6b'),'lastPauseAt','pauseType',_0x39dd('0x6c'),'internal',_0x39dd('0x6d'),_0x39dd('0x4b'),_0x39dd('0x6e'),_0x39dd('0x6f'),_0x39dd('0x70'),_0x39dd('0x71'),_0x39dd('0x4c'),_0x39dd('0x72'),_0x39dd('0x73'),_0x39dd('0x74'),_0x39dd('0x75'),_0x39dd('0x76'),'whatsappCapacity',_0x39dd('0x77'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x39dd('0x78'),_0x39dd('0x79'),'whatsappCurrentCapacity',_0x39dd('0x7a'),_0x39dd('0x50'),'openchannelStatus','mailStatus',_0x39dd('0x7b'),_0x39dd('0x53'),_0x39dd('0x51'),_0x39dd('0x4e'),'chatStatusTime',_0x39dd('0x7c'),_0x39dd('0x7d'),_0x39dd('0x7e'),_0x39dd('0x7f'),_0x39dd('0x80'),'voiceStatusTime',_0x39dd('0x39'),_0x39dd('0x81'),_0x39dd('0x82'),_0x39dd('0x83'),_0x39dd('0x84'),_0x39dd('0x85')],_0x5193fa=[_0x39dd('0x4b'),_0x39dd('0x6e'),_0x39dd('0x6f'),'smsPause',_0x39dd('0x71'),_0x39dd('0x4c'),_0x39dd('0x72'),_0x39dd('0x42')];Promise[_0x39dd('0x86')]()[_0x39dd('0x16')](function(){if(_0x107c8a['query'][_0x39dd('0x87')])_0x417767=validateChannel(_0x107c8a[_0x39dd('0x88')]['channel']);if(!_0x107c8a[_0x39dd('0x88')]['sort']||!_0x107c8a['query'][_0x39dd('0x89')][_0x39dd('0x5a')]('globalStatus'))return;var _0x278f12=getUpdatedSortOptions(_0x107c8a['query']['sort']);_0x107c8a[_0x39dd('0x88')][_0x39dd('0x89')]=_0x278f12[_0x39dd('0x8a')][_0x39dd('0x8b')](',');_0x1ff6a=_0x278f12[_0x39dd('0x64')];})[_0x39dd('0x16')](function(){if(!_0x107c8a[_0x39dd('0x88')][_0x39dd('0x8c')])return[];var _0x1abab6=_[_0x39dd('0x1b')](_0x417767)+_0x39dd('0x44');return getFilteredAgentIds(_0x107c8a[_0x39dd('0x88')][_0x39dd('0x8c')],_0x1abab6);})['then'](function(_0x7ddb58){var _0x5e895b=_[_0x39dd('0x5e')](db[_0x39dd('0x43')][_0x39dd('0x8d')],function(_0x49b749){return{'name':_0x49b749[_0x39dd('0x8e')],'type':_0x49b749['type']['key']};});_0x107c8a[_0x39dd('0x88')]['role']=_0x39dd('0x8f');_0x107c8a[_0x39dd('0x88')]['online']=!![];_0x579d76=qs[_0x39dd('0x90')](_0x5e895b,_0x107c8a);_0x579d76[_0x39dd('0x91')]=!![];if(!_['isEmpty'](_0x7ddb58)){_0x579d76[_0x39dd('0x92')]=_[_0x39dd('0x18')](_0x579d76[_0x39dd('0x92')],{'$and':[{'id':{'$in':_0x7ddb58}}]});}else if(!_['isEmpty'](_0x107c8a[_0x39dd('0x88')][_0x39dd('0x8c')])){return _0x52a308;}if(_0x107c8a[_0x39dd('0x93')][_0x39dd('0x94')]===_0x39dd('0x93')){var _0x5154e2={'params':{'id':_0x107c8a['user'][_0x39dd('0x95')]},'query':{'section':_0x39dd('0x15'),'role':_0x39dd('0x8f'),'online':!![],'nolimit':_0x107c8a['query']['nolimit'],'sort':_0x107c8a[_0x39dd('0x88')][_0x39dd('0x89')],'filter':_0x107c8a[_0x39dd('0x88')]['filter'],'raw':!![],'ids':_0x7ddb58}};return db['UserProfile']['getResources'](_0x5154e2);}return db[_0x39dd('0x43')][_0x39dd('0x96')](_0x579d76);})['then'](function(_0xd2ad09){_0x52a308['count']=_0xd2ad09[_0x39dd('0xb')];_0x53b5e6=_0xd2ad09[_0x39dd('0x97')];return getRealtimeAgents();})[_0x39dd('0x16')](function(_0x34bf9b){_0x4cfa26=_0x34bf9b[_0x39dd('0x97')];return _0x53b5e6[_0x39dd('0x5e')](function(_0x204c35){var _0x24bd64=_['find'](_0x4cfa26,['id',_0x204c35['id']]);if(_0x24bd64)_[_0x39dd('0x18')](_0x204c35,_[_0x39dd('0x98')](_[_0x39dd('0x99')](_0x24bd64,_0x5193fa),_0x4c1826));_0x204c35[_0x39dd('0x68')]=getAgentStatus(_0x204c35);return _0x204c35;});})['then'](function(_0x29be1f){var _0x2104e5;if(_0x107c8a[_0x39dd('0x88')][_0x39dd('0x9a')]){_0x2104e5=_['filter'](_0x29be1f,['globalStatus',_0x107c8a[_0x39dd('0x88')][_0x39dd('0x9a')]]);if(_0x107c8a[_0x39dd('0x88')][_0x39dd('0x9b')]){_0x2104e5=_[_0x39dd('0x38')](_0x2104e5,[_0x39dd('0x69'),_0x107c8a[_0x39dd('0x88')][_0x39dd('0x9b')]]);}}if(_0x2104e5)_0x29be1f=_0x2104e5;if(!_0x1ff6a)return _0x29be1f;return orderAgentsByStatus(_0x29be1f,_0x1ff6a);})[_0x39dd('0x16')](function(_0x197673){_0x52a308[_0x39dd('0x97')]=_0x197673;return _0x52a308;})[_0x39dd('0x16')](respondWithFilteredResult(_0x433567,_0x579d76))[_0x39dd('0x19')](handleError(_0x433567,null));};exports[_0x39dd('0x9c')]=function(_0x4bd07b,_0x18692c){var _0xbd5455={'count':0x0,'rows':[]},_0x30491c={},_0x32a0ec,_0x15b41f,_0x1f0209,_0x414397,_0x35b113;Promise[_0x39dd('0x86')]()[_0x39dd('0x16')](function(){if(_0x4bd07b[_0x39dd('0x88')][_0x39dd('0x87')])_0x32a0ec=validateChannel(_0x4bd07b[_0x39dd('0x88')][_0x39dd('0x87')]);var _0x126dca=_['startCase'](_0x32a0ec)+'Queue';var _0x36572d=_[_0x39dd('0x5e')](db[_0x126dca]['rawAttributes'],function(_0x49eb37){return{'name':_0x49eb37['fieldName'],'type':_0x49eb37[_0x39dd('0x9d')]['key']};});_0x30491c=qs[_0x39dd('0x90')](_0x36572d,_0x4bd07b);if(_0x4bd07b[_0x39dd('0x93')]['role']===_0x39dd('0x93')){var _0x4ee763={'params':{'id':_0x4bd07b[_0x39dd('0x93')][_0x39dd('0x95')]},'query':{'section':_0x32a0ec===_0x39dd('0x1a')&&_0x4bd07b[_0x39dd('0x88')][_0x39dd('0x9d')]==='outbound'?_0x39dd('0x9e'):_['startCase'](_0x32a0ec)+'Queues','type':_0x4bd07b[_0x39dd('0x88')][_0x39dd('0x9d')],'nolimit':!![],'sort':'name','filter':_0x4bd07b['query'][_0x39dd('0x38')]}};return db[_0x39dd('0x9f')][_0x39dd('0xa0')](_0x4ee763);}return db[_0x126dca][_0x39dd('0x96')](_0x30491c);})['then'](function(_0x338259){_0xbd5455[_0x39dd('0xb')]=_0x338259[_0x39dd('0xb')];_0x15b41f=_0x338259['rows'];return getRealtimeQueues(_0x4bd07b,_0x32a0ec);})[_0x39dd('0x16')](function(_0x6aedb7){_0x414397=_0x6aedb7[_0x39dd('0x97')];return getRealtimeAgents();})[_0x39dd('0x16')](function(_0x2695b3){_0x1f0209=_0x2695b3[_0x39dd('0x97')];if(_0x32a0ec!=_0x39dd('0x1a'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x2aadfe){_0x35b113=_0x2aadfe?_0x2aadfe['rows']:[];return initializeQueues(_0x15b41f,_0x414397,_0x32a0ec,_0x4bd07b[_0x39dd('0x88')]['type']);})[_0x39dd('0x16')](function(_0x33b751){var _0x13a1b9=_0x33b751[_0x39dd('0x5e')](function(_0x5af23f){if(_0x32a0ec===_0x39dd('0x1a'))return getVoiceQueueAgents(_0x5af23f,_0x15b41f,_0x1f0209,_0x35b113);else return getQueueAgents(_0x5af23f,_0x1f0209,_0x32a0ec);});return Promise[_0x39dd('0x60')](_0x13a1b9);})[_0x39dd('0x16')](function(_0x44759f){_0xbd5455[_0x39dd('0x97')]=_0x44759f;return _0xbd5455;})[_0x39dd('0x16')](respondWithFilteredResult(_0x18692c,_0x30491c))[_0x39dd('0x19')](handleError(_0x18692c,null));}; \ No newline at end of file +var _0xd150=['filter','queue','length','some','connectedlinenum','internal','find','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','push','User','Queue','Pause','QueueId','name','unknown','unavailable','ringing','chatPause','mailPause','openchannelPause','smsPause','whatsappPause','every','smsStatus','whatsappStatus','pause','*pause','mail','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','map','findOne','getAgents','all','flatten','uniq','value','split','fields','globalStatus','order','DESC','ASC','sort','pauseType','lastLoginAt','lastPauseAt','address','faxPause','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','voicePause','resolve','query','channel','join','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','isEmpty','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','globalStatusFilter','pauseTypeFilter','getQueues','QueueCampaigns','lodash','jayson/promise','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','set','Content-Range','json','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','voice','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','originated','dialActive','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','agents','loggedIn','busy','pTalking','pick'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xd150,0x10c));var _0x0d15=function(_0x42cf9a,_0x3b3acd){_0x42cf9a=_0x42cf9a-0x0;var _0x5b799b=_0xd150[_0x42cf9a];return _0x5b799b;};'use strict';var util=require('util');var _=require(_0x0d15('0x0'));var jayson=require(_0x0d15('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d15('0x2'))('api');var db=require(_0x0d15('0x3'))['db'];var amiClient=jayson[_0x0d15('0x4')][_0x0d15('0x5')]({'port':0x232a});var routingClient=jayson[_0x0d15('0x4')][_0x0d15('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x29144a,_0x2569f2){return function(_0x58073c){if(_0x58073c){var _0x3f46ce=typeof _0x2569f2[_0x0d15('0x6')]===_0x0d15('0x7')&&typeof _0x2569f2[_0x0d15('0x8')]==='undefined';var _0x26aec4=_0x58073c['count'];var _0x5d01e9=_0x3f46ce?0x0:_0x2569f2['offset'];var _0xd911b4=_0x3f46ce?_0x58073c[_0x0d15('0x9')]:_0x2569f2['offset']+_0x2569f2[_0x0d15('0x8')];var _0x3ca394;if(_0xd911b4>=_0x26aec4){_0xd911b4=_0x26aec4;_0x3ca394=0xc8;}else{_0x3ca394=0xce;}_0x29144a['status'](_0x3ca394);return _0x29144a[_0x0d15('0xa')](_0x0d15('0xb'),_0x5d01e9+'-'+_0xd911b4+'/'+_0x26aec4)[_0x0d15('0xc')](_0x58073c);}return null;};}function handleError(_0x191ad8,_0x132f42){_0x132f42=_0x132f42||0x1f4;return function(_0x50307b){logger['error'](_0x50307b['stack']);if(_0x50307b['name']){delete _0x50307b['name'];}_0x191ad8['status'](_0x132f42)['send'](_0x50307b);};}function getRealtimeAgents(){return new Promise(function(_0x3e3387,_0x5ad5b2){return amiClient['request'](_0x0d15('0xd'),{})[_0x0d15('0xe')](function(_0x596fd9){if(_0x596fd9['error'])throw new Error(_0x0d15('0xf'));var _0x572d06=_0x596fd9[_0x0d15('0x10')];return routingClient[_0x0d15('0x11')](_0x0d15('0xd'),{})[_0x0d15('0xe')](function(_0x432c80){if(_0x432c80['error'])throw new Error(_0x0d15('0x12'));var _0x13613c=_0x432c80[_0x0d15('0x10')];return _0x3e3387(_[_0x0d15('0x13')]({},_0x572d06,_0x13613c));});})['catch'](function(_0x51ec4f){_0x5ad5b2(_0x51ec4f);});});}function getRealtimeQueues(_0x57dae3,_0x1d0902){return new Promise(function(_0x543bd6,_0x5dee5c){var _0x3d3aa8=_0x1d0902===_0x0d15('0x14')?amiClient:routingClient;return _0x3d3aa8[_0x0d15('0x11')](_[_0x0d15('0x15')](_0x1d0902)+_0x0d15('0x16'),_0x57dae3)[_0x0d15('0xe')](function(_0x11ae80){if(_0x11ae80[_0x0d15('0x17')])throw new Error(util[_0x0d15('0x18')](_0x0d15('0x19'),_0x1d0902));return _0x543bd6(_0x11ae80[_0x0d15('0x10')]);})[_0x0d15('0x1a')](function(_0x1cc6db){_0x5dee5c(_0x1cc6db);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x4755d7,_0x5644ce){return amiClient[_0x0d15('0x11')]('VoiceQueuesChannels',{})[_0x0d15('0xe')](function(_0x488d25){if(_0x488d25[_0x0d15('0x17')])throw new Error(_0x0d15('0x1b'));return _0x4755d7(_0x488d25[_0x0d15('0x10')]);})['catch'](function(_0x22e412){_0x5644ce(_0x22e412);});});}function initializeQueues(_0x4c4e2d,_0x3a5b10,_0x29d77b,_0x2b9163){var _0x166bee=['loggedIn',_0x0d15('0x1c'),_0x0d15('0x1d'),_0x0d15('0x1e'),_0x0d15('0x1f')];if(_0x29d77b==='voice'&&_0x2b9163===_0x0d15('0x20')){_0x166bee['push']('pTalking',_0x0d15('0x21'),'message',_0x0d15('0x22'),'dialMethod',_0x0d15('0x23'),'startPredictive','startProgressive',_0x0d15('0x24'),_0x0d15('0x25'),_0x0d15('0x26'),_0x0d15('0x27'),_0x0d15('0x28'),_0x0d15('0x29'),_0x0d15('0x2a'),_0x0d15('0x2b'),_0x0d15('0x2c'),_0x0d15('0x2d'),_0x0d15('0x2e'),'predictiveIntervalDroppedCallsCallersExit',_0x0d15('0x2f'),_0x0d15('0x30'));}return _0x4c4e2d['map'](function(_0x35b5fa){var _0x254d24=_0x35b5fa['get']({'plain':!![]});_0x254d24[_0x0d15('0x31')]=[];_0x254d24['paused']=0x0;_0x254d24['loggedInDb']=0x0;_0x254d24[_0x0d15('0x32')]=0x0;_0x254d24['available']=0x0;_0x254d24['waiting']=0x0;if(_0x29d77b===_0x0d15('0x14')){_0x254d24[_0x0d15('0x1e')]=0x0;_0x254d24[_0x0d15('0x33')]=0x0;if(_0x2b9163===_0x0d15('0x20')){_0x254d24[_0x0d15('0x34')]=0x0;_0x254d24[_0x0d15('0x21')]=0x0;}}var _0x387e62=_['find'](_0x3a5b10,['id',_0x254d24['id']]);if(_0x387e62)_['merge'](_0x254d24,_[_0x0d15('0x35')](_0x387e62,_0x166bee));return _0x254d24;});}function updateAgentVoiceStatus(_0x3e2c82,_0x2deebe,_0x517220){var _0x16a094=_[_0x0d15('0x36')](_0x517220,[_0x0d15('0x37'),_0x2deebe['name']]);if(_0x16a094[_0x0d15('0x38')]===0x0)return _0x3e2c82[_0x0d15('0x33')]=!![];if(_[_0x0d15('0x39')](_0x16a094,[_0x0d15('0x3a'),_0x3e2c82[_0x0d15('0x3b')]['toString']()]))return _0x3e2c82[_0x0d15('0x1e')]=!![];if(!_0x3e2c82[_0x0d15('0x1e')])return _0x3e2c82[_0x0d15('0x33')]=!![];}function getVoiceQueueAgents(_0x305de,_0x5926bb,_0x3d7464,_0x4615ef){var _0x15620f=_[_0x0d15('0x3c')](_0x5926bb,['id',_0x305de['id']]);if(!_0x15620f)return _0x305de;return _0x15620f[_0x0d15('0x3d')]({'raw':!![]})[_0x0d15('0xe')](function(_0x3b9371){for(var _0x378fca=0x0;_0x378fca<_0x3b9371[_0x0d15('0x38')];_0x378fca++){var _0x3df017=_[_0x0d15('0x3c')](_0x3d7464,['id',_0x3b9371[_0x378fca][_0x0d15('0x3e')]]);if(!_0x3df017){_0x3df017={'id':_0x3b9371[_0x378fca][_0x0d15('0x3e')],'name':_0x3b9371[_0x378fca][_0x0d15('0x3e')],'accountcode':'','online':![]};}var _0x52cf65={'id':_0x3df017['id'],'name':_0x3df017['name'],'internal':_0x3df017[_0x0d15('0x3f')],'online':Boolean(_0x3df017[_0x0d15('0x40')]),'paused':Boolean(_0x3b9371[_0x378fca][_0x0d15('0x1f')])};if(_0x3df017[_0x0d15('0x41')]==='talking')updateAgentVoiceStatus(_0x52cf65,_0x305de,_0x4615ef);if(_0x52cf65[_0x0d15('0x40')])_0x305de[_0x0d15('0x42')]++;if(_0x52cf65['busy'])_0x305de[_0x0d15('0x33')]++;if(_0x52cf65[_0x0d15('0x1f')]&&!_0x52cf65['busy']&&!_0x52cf65['talking'])_0x305de[_0x0d15('0x1f')]++;_0x305de[_0x0d15('0x31')][_0x0d15('0x43')](_0x52cf65);}return _0x305de;});}function getQueueAgents(_0x519bf,_0x15a830,_0x4d3f33){var _0x544258=_0x0d15('0x44')+_[_0x0d15('0x15')](_0x4d3f33)+_0x0d15('0x45');var _0x4051f3=_0x4d3f33+_0x0d15('0x46');return db[_0x544258]['findAll']({'where':{[_[_0x0d15('0x15')](_0x4d3f33)+_0x0d15('0x47')]:_0x519bf['id']},'raw':!![]})[_0x0d15('0xe')](function(_0x236102){for(var _0x433ce5=0x0;_0x433ce5<_0x236102[_0x0d15('0x38')];_0x433ce5++){var _0x16a239=_[_0x0d15('0x3c')](_0x15a830,['id',_0x236102[_0x433ce5][_0x0d15('0x3e')]]);if(!_0x16a239){_0x16a239={'id':_0x236102[_0x433ce5][_0x0d15('0x3e')],'name':_0x236102[_0x433ce5]['UserId'],'online':![],['pauseField']:![]};}var _0x256ef4={'id':_0x16a239['id'],'name':_0x16a239[_0x0d15('0x48')],'online':Boolean(_0x16a239['online']),'paused':Boolean(_0x16a239[_0x4051f3])};if(_0x256ef4[_0x0d15('0x40')])_0x519bf[_0x0d15('0x42')]++;_0x519bf['agents']['push'](_0x256ef4);}return _0x519bf;});}function isIdle(_0x4a764e){return _0x4a764e==='idle'||_0x4a764e===_0x0d15('0x49')||_0x4a764e===_0x0d15('0x4a')||_0x4a764e===_0x0d15('0x4b')||_['isNil'](_0x4a764e);}function isAgentPaused(_0x4ac944,_0x5664ea){var _0x83059d=[_0x4ac944[_0x0d15('0x4c')],_0x4ac944['faxPause'],_0x4ac944[_0x0d15('0x4d')],_0x4ac944[_0x0d15('0x4e')],_0x4ac944[_0x0d15('0x4f')],_0x4ac944['voicePause'],_0x4ac944[_0x0d15('0x50')]];if(!_0x5664ea)return _[_0x0d15('0x51')](_0x83059d);var _0x3e44c5=_[_0x0d15('0x36')](_0x83059d);return _0x3e44c5[_0x0d15('0x38')]>0x0&&_0x3e44c5['length']<_0x83059d['length']?!![]:![];}function isAgentIdle(_0x1f9664){if(_0x1f9664[_0x0d15('0x41')]!=='idle'&&_0x1f9664['voicePause']){_0x1f9664[_0x0d15('0x41')]='pause';return![];}return _[_0x0d15('0x51')]([_0x1f9664['chatStatus'],_0x1f9664['faxStatus'],_0x1f9664['mailStatus'],_0x1f9664['openchannelStatus'],_0x1f9664[_0x0d15('0x52')],_0x1f9664[_0x0d15('0x41')],_0x1f9664[_0x0d15('0x53')]],isIdle);}function getAgentStatus(_0x3e5e9d){var _0x46f3e6=_0x0d15('0x49');if(isAgentPaused(_0x3e5e9d))_0x46f3e6=_0x0d15('0x54');else if(isAgentPaused(_0x3e5e9d,!![]))_0x46f3e6=_0x0d15('0x55');else if(isAgentIdle(_0x3e5e9d))_0x46f3e6='idle';else _0x46f3e6=_0x0d15('0x33');return _0x46f3e6;}function validateChannel(_0x489eea){var _0x17f017=[_0x0d15('0x56'),_0x0d15('0x57'),_0x0d15('0x58'),_0x0d15('0x59'),_0x0d15('0x5a'),_0x0d15('0x5b'),_0x0d15('0x14')];if(!_[_0x0d15('0x5c')](_0x17f017,_0x489eea[_0x0d15('0x5d')]()))throw new Error('Invalid\x20channel');return _0x489eea[_0x0d15('0x5d')]();}function getFilteredAgentIds(_0x21d1a6,_0x8c6579){var _0x39d623=_['isArray'](_0x21d1a6)?_0x21d1a6:[_0x21d1a6];var _0x208a26=_[_0x0d15('0x5e')](_0x39d623,function(_0x208c71){return db[_0x8c6579][_0x0d15('0x5f')]({'where':{'name':_0x208c71}})['then'](function(_0x3e7001){if(!_0x3e7001)return[];return _0x3e7001[_0x0d15('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x0d15('0x61')](_0x208a26)['then'](function(_0x43538a){var _0x5e6c19=_(_0x43538a)[_0x0d15('0x62')]()['map']('id')[_0x0d15('0x63')]()[_0x0d15('0x64')]();return _0x5e6c19;});}function getUpdatedSortOptions(_0x312fbf){var _0x5786bc={'fields':[],'order':null};var _0x1909e9=_0x312fbf[_0x0d15('0x65')](',');_0x5786bc[_0x0d15('0x66')]=_[_0x0d15('0x36')](_0x1909e9,function(_0x36fcf1){if(!_0x36fcf1['includes'](_0x0d15('0x67')))return!![];_0x5786bc[_0x0d15('0x68')]=_['startsWith'](_0x36fcf1,'-')?_0x0d15('0x69'):_0x0d15('0x6a');return![];});return _0x5786bc;}function orderAgentsByStatus(_0x1c2edc,_0x3397ed){return _0x1c2edc[_0x0d15('0x6b')](function(_0x45d2cb,_0x4b0c01){if(_0x45d2cb['globalStatus']===_0x4b0c01[_0x0d15('0x67')]&&_0x45d2cb['globalStatus']===_0x0d15('0x54')){if(_0x3397ed==='DESC')return(_0x45d2cb[_0x0d15('0x6c')]||'')<(_0x4b0c01[_0x0d15('0x6c')]||'')?0x1:-0x1;return _0x45d2cb[_0x0d15('0x6c')]<_0x4b0c01[_0x0d15('0x6c')]?-0x1:0x1;}else{if(_0x3397ed==='DESC')return _0x45d2cb[_0x0d15('0x67')]<_0x4b0c01[_0x0d15('0x67')]?0x1:-0x1;return _0x45d2cb[_0x0d15('0x67')]<_0x4b0c01[_0x0d15('0x67')]?-0x1:0x1;}});}exports['getAgents']=function(_0x458a9f,_0x3c91f7){var _0x2c36d8={'count':0x0,'rows':[]},_0x52340a={},_0x3b56ee,_0x104937,_0x12a7f4,_0x1b6a7d,_0x5ae0fc=['userpic','online',_0x0d15('0x6d'),_0x0d15('0x6e'),_0x0d15('0x6c'),_0x0d15('0x6e'),_0x0d15('0x3b'),_0x0d15('0x6f'),_0x0d15('0x4c'),_0x0d15('0x4e'),_0x0d15('0x4d'),'smsPause',_0x0d15('0x50'),_0x0d15('0x70'),'voicePause','chatCapacity',_0x0d15('0x71'),'mailCapacity',_0x0d15('0x72'),'whatsappCapacity',_0x0d15('0x73'),_0x0d15('0x74'),_0x0d15('0x75'),_0x0d15('0x76'),_0x0d15('0x77'),_0x0d15('0x78'),_0x0d15('0x79'),_0x0d15('0x7a'),_0x0d15('0x7b'),_0x0d15('0x7c'),_0x0d15('0x52'),_0x0d15('0x53'),_0x0d15('0x7d'),_0x0d15('0x41'),_0x0d15('0x7e'),_0x0d15('0x7f'),_0x0d15('0x80'),_0x0d15('0x81'),_0x0d15('0x82'),_0x0d15('0x83'),'voiceStatusTime','queue','destconnectedlinenum',_0x0d15('0x84'),'phoneBarEnableScreenRecordingByAgent',_0x0d15('0x85'),_0x0d15('0x86')],_0x4edb2=[_0x0d15('0x4c'),'openchannelPause',_0x0d15('0x4d'),_0x0d15('0x4f'),_0x0d15('0x50'),'faxPause',_0x0d15('0x87'),_0x0d15('0x40')];Promise[_0x0d15('0x88')]()[_0x0d15('0xe')](function(){if(_0x458a9f[_0x0d15('0x89')][_0x0d15('0x8a')])_0x3b56ee=validateChannel(_0x458a9f['query']['channel']);if(!_0x458a9f['query'][_0x0d15('0x6b')]||!_0x458a9f[_0x0d15('0x89')][_0x0d15('0x6b')]['includes']('globalStatus'))return;var _0x163205=getUpdatedSortOptions(_0x458a9f['query'][_0x0d15('0x6b')]);_0x458a9f[_0x0d15('0x89')][_0x0d15('0x6b')]=_0x163205[_0x0d15('0x66')][_0x0d15('0x8b')](',');_0x104937=_0x163205[_0x0d15('0x68')];})[_0x0d15('0xe')](function(){if(!_0x458a9f[_0x0d15('0x89')]['globalQueueFilter'])return[];var _0x33d4dd=_['startCase'](_0x3b56ee)+'Queue';return getFilteredAgentIds(_0x458a9f[_0x0d15('0x89')][_0x0d15('0x8c')],_0x33d4dd);})['then'](function(_0x420bcc){var _0x109959=_[_0x0d15('0x5e')](db[_0x0d15('0x44')][_0x0d15('0x8d')],function(_0x57101b){return{'name':_0x57101b[_0x0d15('0x8e')],'type':_0x57101b[_0x0d15('0x8f')][_0x0d15('0x90')]};});_0x458a9f[_0x0d15('0x89')][_0x0d15('0x91')]=_0x0d15('0x92');_0x458a9f[_0x0d15('0x89')]['online']=!![];_0x52340a=qs[_0x0d15('0x93')](_0x109959,_0x458a9f);_0x52340a[_0x0d15('0x94')]=!![];if(!_[_0x0d15('0x95')](_0x420bcc)){_0x52340a['where']=_['merge'](_0x52340a['where'],{'$and':[{'id':{'$in':_0x420bcc}}]});}else if(!_[_0x0d15('0x95')](_0x458a9f[_0x0d15('0x89')][_0x0d15('0x8c')])){return _0x2c36d8;}if(_0x458a9f[_0x0d15('0x96')][_0x0d15('0x91')]==='user'){var _0xd7d6bb={'params':{'id':_0x458a9f['user'][_0x0d15('0x97')]},'query':{'section':_0x0d15('0xd'),'role':_0x0d15('0x92'),'online':!![],'nolimit':_0x458a9f[_0x0d15('0x89')][_0x0d15('0x98')],'sort':_0x458a9f['query'][_0x0d15('0x6b')],'filter':_0x458a9f[_0x0d15('0x89')][_0x0d15('0x36')],'raw':!![],'ids':_0x420bcc}};return db[_0x0d15('0x99')][_0x0d15('0x9a')](_0xd7d6bb);}return db[_0x0d15('0x44')][_0x0d15('0x9b')](_0x52340a);})[_0x0d15('0xe')](function(_0x33fc8e){_0x2c36d8['count']=_0x33fc8e[_0x0d15('0x9')];_0x12a7f4=_0x33fc8e[_0x0d15('0x9c')];return getRealtimeAgents();})[_0x0d15('0xe')](function(_0x3c4075){_0x1b6a7d=_0x3c4075[_0x0d15('0x9c')];return _0x12a7f4['map'](function(_0x457fc2){var _0x1073c6=_[_0x0d15('0x3c')](_0x1b6a7d,['id',_0x457fc2['id']]);if(_0x1073c6)_[_0x0d15('0x13')](_0x457fc2,_[_0x0d15('0x35')](_['omit'](_0x1073c6,_0x4edb2),_0x5ae0fc));_0x457fc2[_0x0d15('0x67')]=getAgentStatus(_0x457fc2);return _0x457fc2;});})['then'](function(_0x5ea7dd){var _0x34d7e7;if(_0x458a9f[_0x0d15('0x89')][_0x0d15('0x9d')]){_0x34d7e7=_[_0x0d15('0x36')](_0x5ea7dd,['globalStatus',_0x458a9f[_0x0d15('0x89')][_0x0d15('0x9d')]]);if(_0x458a9f[_0x0d15('0x89')][_0x0d15('0x9e')]){_0x34d7e7=_[_0x0d15('0x36')](_0x34d7e7,['pauseType',_0x458a9f[_0x0d15('0x89')][_0x0d15('0x9e')]]);}}if(_0x34d7e7)_0x5ea7dd=_0x34d7e7;if(!_0x104937)return _0x5ea7dd;return orderAgentsByStatus(_0x5ea7dd,_0x104937);})['then'](function(_0x197117){_0x2c36d8[_0x0d15('0x9c')]=_0x197117;return _0x2c36d8;})[_0x0d15('0xe')](respondWithFilteredResult(_0x3c91f7,_0x52340a))[_0x0d15('0x1a')](handleError(_0x3c91f7,null));};exports[_0x0d15('0x9f')]=function(_0x1e9290,_0xd0313f){var _0x10e97c={'count':0x0,'rows':[]},_0x58fe44={},_0x41d5f3,_0xa795af,_0x2fe416,_0x10632d,_0xa3dbd7;Promise['resolve']()[_0x0d15('0xe')](function(){if(_0x1e9290[_0x0d15('0x89')]['channel'])_0x41d5f3=validateChannel(_0x1e9290[_0x0d15('0x89')][_0x0d15('0x8a')]);var _0x186acd=_[_0x0d15('0x15')](_0x41d5f3)+_0x0d15('0x45');var _0x2a3caa=_['map'](db[_0x186acd][_0x0d15('0x8d')],function(_0x4076dd){return{'name':_0x4076dd[_0x0d15('0x8e')],'type':_0x4076dd[_0x0d15('0x8f')]['key']};});_0x58fe44=qs[_0x0d15('0x93')](_0x2a3caa,_0x1e9290);if(_0x1e9290[_0x0d15('0x96')][_0x0d15('0x91')]==='user'){var _0x46ef46={'params':{'id':_0x1e9290[_0x0d15('0x96')][_0x0d15('0x97')]},'query':{'section':_0x41d5f3===_0x0d15('0x14')&&_0x1e9290[_0x0d15('0x89')][_0x0d15('0x8f')]==='outbound'?_0x0d15('0xa0'):_['startCase'](_0x41d5f3)+_0x0d15('0x16'),'type':_0x1e9290['query']['type'],'nolimit':!![],'sort':'name','filter':_0x1e9290[_0x0d15('0x89')]['filter']}};return db['UserProfile'][_0x0d15('0x9a')](_0x46ef46);}return db[_0x186acd][_0x0d15('0x9b')](_0x58fe44);})[_0x0d15('0xe')](function(_0x29a51d){_0x10e97c['count']=_0x29a51d[_0x0d15('0x9')];_0xa795af=_0x29a51d[_0x0d15('0x9c')];return getRealtimeQueues(_0x1e9290,_0x41d5f3);})[_0x0d15('0xe')](function(_0x4916de){_0x10632d=_0x4916de[_0x0d15('0x9c')];return getRealtimeAgents();})[_0x0d15('0xe')](function(_0x237233){_0x2fe416=_0x237233[_0x0d15('0x9c')];if(_0x41d5f3!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x0d15('0xe')](function(_0x2a966e){_0xa3dbd7=_0x2a966e?_0x2a966e[_0x0d15('0x9c')]:[];return initializeQueues(_0xa795af,_0x10632d,_0x41d5f3,_0x1e9290[_0x0d15('0x89')][_0x0d15('0x8f')]);})[_0x0d15('0xe')](function(_0x697c5){var _0xfe7326=_0x697c5['map'](function(_0x282114){if(_0x41d5f3===_0x0d15('0x14'))return getVoiceQueueAgents(_0x282114,_0xa795af,_0x2fe416,_0xa3dbd7);else return getQueueAgents(_0x282114,_0x2fe416,_0x41d5f3);});return Promise[_0x0d15('0x61')](_0xfe7326);})[_0x0d15('0xe')](function(_0x2f0b90){_0x10e97c['rows']=_0x2f0b90;return _0x10e97c;})['then'](respondWithFilteredResult(_0xd0313f,_0x58fe44))['catch'](handleError(_0xd0313f,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bc45c37..634ac1c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x32b8b2,_0x258c4e){var _0x28bd16=function(_0x5976fe){while(--_0x5976fe){_0x32b8b2['push'](_0x32b8b2['shift']());}};_0x28bd16(++_0x258c4e);}(_0x70e0,0x17b));var _0x070e=function(_0x240b01,_0x22e055){_0x240b01=_0x240b01-0x0;var _0x399d1a=_0x70e0[_0x240b01];return _0x399d1a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3f415c,_0x310f72){var _0x8f2df8=function(_0x3e7afe){while(--_0x3e7afe){_0x3f415c['push'](_0x3f415c['shift']());}};_0x8f2df8(++_0x310f72);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 7240e10..15a0416 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 _0x7ed1=['STRING','DATE','sequelize','INTEGER'];(function(_0x459eb6,_0x5af3d4){var _0x42435f=function(_0x4e919d){while(--_0x4e919d){_0x459eb6['push'](_0x459eb6['shift']());}};_0x42435f(++_0x5af3d4);}(_0x7ed1,0xca));var _0x17ed=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7ed1[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x17ed('0x0'));module['exports']={'state':{'type':Sequelize[_0x17ed('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x17ed('0x2')]},'scheduledat':{'type':Sequelize[_0x17ed('0x3')]},'uniqueid':{'type':Sequelize[_0x17ed('0x2')]},'starttime':{'type':Sequelize[_0x17ed('0x3')]},'responsetime':{'type':Sequelize[_0x17ed('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x17ed('0x2')]},'campaigntype':{'type':Sequelize[_0x17ed('0x2')]},'membername':{'type':Sequelize[_0x17ed('0x2')]}}; \ No newline at end of file +var _0xdf70=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x555fae,_0x24facc){var _0x12adf2=function(_0x527e95){while(--_0x527e95){_0x555fae['push'](_0x555fae['shift']());}};_0x12adf2(++_0x24facc);}(_0xdf70,0x86));var _0x0df7=function(_0xfa6fa2,_0x17b393){_0xfa6fa2=_0xfa6fa2-0x0;var _0x20d7d5=_0xdf70[_0xfa6fa2];return _0x20d7d5;};'use strict';var Sequelize=require(_0x0df7('0x0'));module[_0x0df7('0x1')]={'state':{'type':Sequelize[_0x0df7('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0df7('0x3')]},'uniqueid':{'type':Sequelize[_0x0df7('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0df7('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0df7('0x4')]},'campaigntype':{'type':Sequelize[_0x0df7('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f9bc091..0eca750 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 _0xd6dc=['exports','define','report_agent_preview','lodash','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0xcb4399,_0x554af1){var _0x492403=function(_0x31863e){while(--_0x31863e){_0xcb4399['push'](_0xcb4399['shift']());}};_0x492403(++_0x554af1);}(_0xd6dc,0x147));var _0xcd6d=function(_0x193670,_0x371265){_0x193670=_0x193670-0x0;var _0xa6c234=_0xd6dc[_0x193670];return _0xa6c234;};'use strict';var _=require(_0xcd6d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcd6d('0x1'));var rp=require(_0xcd6d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd6d('0x3'));var config=require(_0xcd6d('0x4'));var attributes=require(_0xcd6d('0x5'));module[_0xcd6d('0x6')]=function(_0x25bcd8,_0x2f3f9a){return _0x25bcd8[_0xcd6d('0x7')]('ReportAgentPreview',attributes,{'tableName':_0xcd6d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x506c=['../../config/logger','moment','bluebird','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x2a8164,_0x9b90e1){var _0x4a3173=function(_0x5383af){while(--_0x5383af){_0x2a8164['push'](_0x2a8164['shift']());}};_0x4a3173(++_0x9b90e1);}(_0x506c,0x166));var _0xc506=function(_0x9fc04d,_0xd7704e){_0x9fc04d=_0x9fc04d-0x0;var _0x106e45=_0x506c[_0x9fc04d];return _0x106e45;};'use strict';var _=require(_0xc506('0x0'));var util=require(_0xc506('0x1'));var logger=require(_0xc506('0x2'))('api');var moment=require(_0xc506('0x3'));var BPromise=require(_0xc506('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc506('0x5'));var rimraf=require(_0xc506('0x6'));var config=require('../../config/environment');var attributes=require(_0xc506('0x7'));module[_0xc506('0x8')]=function(_0x4a963b,_0x419ed0){return _0x4a963b[_0xc506('0x9')](_0xc506('0xa'),attributes,{'tableName':_0xc506('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 6b2e4e9..a69afd8 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 _0x7271=['bluebird','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','CreateReportAgentPreview','create','body','options','raw','then','stringify','catch','moment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7271,0x107));var _0x1727=function(_0x174e46,_0x468ef3){_0x174e46=_0x174e46-0x0;var _0x1cfb93=_0x7271[_0x174e46];return _0x1cfb93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1727('0x0'));var BPromise=require(_0x1727('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(_0x1727('0x2'))(_0x1727('0x3'));var config=require('../../config/environment');var jayson=require(_0x1727('0x4'));var client=jayson['client'][_0x1727('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x45eaf4,_0x3418a4,_0x166a11){return new BPromise(function(_0x51ceb7,_0x11e8ce){return client[_0x1727('0x6')](_0x45eaf4,_0x166a11)['then'](function(_0x185657){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3418a4,_0x1727('0x7'));logger[_0x1727('0x8')](_0x1727('0x9'),_0x3418a4,_0x1727('0x7'),JSON['stringify'](_0x185657));if(_0x185657[_0x1727('0xa')]){if(_0x185657[_0x1727('0xa')][_0x1727('0xb')]===0x1f4){logger[_0x1727('0xa')](_0x1727('0xc'),_0x3418a4,_0x185657[_0x1727('0xa')]['message']);return _0x11e8ce(_0x185657[_0x1727('0xa')]['message']);}logger[_0x1727('0xa')](_0x1727('0xc'),_0x3418a4,_0x185657[_0x1727('0xa')][_0x1727('0xd')]);return _0x51ceb7(_0x185657[_0x1727('0xa')]['message']);}else{logger[_0x1727('0xe')](_0x1727('0xc'),_0x3418a4,'request\x20sent');_0x51ceb7(_0x185657[_0x1727('0xf')][_0x1727('0xd')]);}})['catch'](function(_0x131f23){logger[_0x1727('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x3418a4,_0x131f23);_0x11e8ce(_0x131f23);});});}exports[_0x1727('0x10')]=function(_0x51439c){var _0x7c3b79=this;return new Promise(function(_0x12a093,_0x1f663b){return db['ReportAgentPreview'][_0x1727('0x11')](_0x51439c[_0x1727('0x12')],{'raw':_0x51439c[_0x1727('0x13')]?_0x51439c[_0x1727('0x13')][_0x1727('0x14')]===undefined?!![]:![]:!![]})[_0x1727('0x15')](function(_0x246640){logger[_0x1727('0xe')](_0x1727('0x10'),_0x51439c);logger[_0x1727('0x8')](_0x1727('0x10'),_0x51439c,JSON[_0x1727('0x16')](_0x246640));_0x12a093(_0x246640);})[_0x1727('0x17')](function(_0x4269e7){logger[_0x1727('0xa')](_0x1727('0x10'),_0x4269e7[_0x1727('0xd')],_0x51439c);_0x1f663b(_0x7c3b79[_0x1727('0xa')](0x1f4,_0x4269e7[_0x1727('0xd')]));});});}; \ No newline at end of file +var _0x74ac=['result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5948dd,_0x15e462){var _0x27a257=function(_0x68275){while(--_0x68275){_0x5948dd['push'](_0x5948dd['shift']());}};_0x27a257(++_0x15e462);}(_0x74ac,0xef));var _0xc74a=function(_0x3a59a1,_0x2d1f2e){_0x3a59a1=_0x3a59a1-0x0;var _0x4b3f3a=_0x74ac[_0x3a59a1];return _0x4b3f3a;};'use strict';var _=require(_0xc74a('0x0'));var util=require(_0xc74a('0x1'));var moment=require(_0xc74a('0x2'));var BPromise=require(_0xc74a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc74a('0x4'));var db=require(_0xc74a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc74a('0x6'))(_0xc74a('0x7'));var config=require(_0xc74a('0x8'));var jayson=require(_0xc74a('0x9'));var client=jayson[_0xc74a('0xa')][_0xc74a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x390072,_0x2cedfb,_0x5532dc){return new BPromise(function(_0x406af7,_0x125918){return client[_0xc74a('0xc')](_0x390072,_0x5532dc)[_0xc74a('0xd')](function(_0x1536f9){logger[_0xc74a('0xe')](_0xc74a('0xf'),_0x2cedfb,_0xc74a('0x10'));logger[_0xc74a('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2cedfb,_0xc74a('0x10'),JSON[_0xc74a('0x12')](_0x1536f9));if(_0x1536f9['error']){if(_0x1536f9[_0xc74a('0x13')][_0xc74a('0x14')]===0x1f4){logger[_0xc74a('0x13')](_0xc74a('0xf'),_0x2cedfb,_0x1536f9[_0xc74a('0x13')][_0xc74a('0x15')]);return _0x125918(_0x1536f9[_0xc74a('0x13')]['message']);}logger[_0xc74a('0x13')](_0xc74a('0xf'),_0x2cedfb,_0x1536f9[_0xc74a('0x13')][_0xc74a('0x15')]);return _0x406af7(_0x1536f9[_0xc74a('0x13')][_0xc74a('0x15')]);}else{logger[_0xc74a('0xe')](_0xc74a('0xf'),_0x2cedfb,'request\x20sent');_0x406af7(_0x1536f9[_0xc74a('0x16')][_0xc74a('0x15')]);}})[_0xc74a('0x17')](function(_0x245bb2){logger[_0xc74a('0x13')](_0xc74a('0xf'),_0x2cedfb,_0x245bb2);_0x125918(_0x245bb2);});});}exports[_0xc74a('0x18')]=function(_0x43cbe1){var _0x5cfa88=this;return new Promise(function(_0x30b09e,_0x523cf0){return db[_0xc74a('0x19')]['create'](_0x43cbe1[_0xc74a('0x1a')],{'raw':_0x43cbe1[_0xc74a('0x1b')]?_0x43cbe1[_0xc74a('0x1b')][_0xc74a('0x1c')]===undefined?!![]:![]:!![]})[_0xc74a('0xd')](function(_0x1a428a){logger['info'](_0xc74a('0x18'),_0x43cbe1);logger[_0xc74a('0x11')](_0xc74a('0x18'),_0x43cbe1,JSON[_0xc74a('0x12')](_0x1a428a));_0x30b09e(_0x1a428a);})[_0xc74a('0x17')](function(_0x34f9b4){logger[_0xc74a('0x13')](_0xc74a('0x18'),_0x34f9b4[_0xc74a('0x15')],_0x43cbe1);_0x523cf0(_0x5cfa88[_0xc74a('0x13')](0x1f4,_0x34f9b4[_0xc74a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7db17d8..ba44fda 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 _0x21d4=['/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues'];(function(_0x4cad49,_0x5c3bb3){var _0x5e0a00=function(_0x55fa1a){while(--_0x55fa1a){_0x4cad49['push'](_0x4cad49['shift']());}};_0x5e0a00(++_0x5c3bb3);}(_0x21d4,0x7c));var _0x421d=function(_0x115c1d,_0x5d7354){_0x115c1d=_0x115c1d-0x0;var _0x404bbc=_0x21d4[_0x115c1d];return _0x404bbc;};'use strict';var multer=require(_0x421d('0x0'));var util=require(_0x421d('0x1'));var path=require(_0x421d('0x2'));var express=require(_0x421d('0x3'));var router=express[_0x421d('0x4')]();var auth=require(_0x421d('0x5'));var controller=require(_0x421d('0x6'));router['get']('/voice/channels',auth['isAuthenticated'](),controller[_0x421d('0x7')]);router[_0x421d('0x8')](_0x421d('0x9'),auth[_0x421d('0xa')](),controller[_0x421d('0xb')]);router[_0x421d('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x421d('0xa')](),controller[_0x421d('0xc')]);router[_0x421d('0x8')]('/voice/queues',auth[_0x421d('0xa')](),controller[_0x421d('0xd')]);router[_0x421d('0x8')]('/chat/queues',auth[_0x421d('0xa')](),controller[_0x421d('0xe')]);router[_0x421d('0x8')]('/mail/queues',auth['isAuthenticated'](),controller[_0x421d('0xf')]);router[_0x421d('0x8')]('/mail/accounts',auth[_0x421d('0xa')](),controller[_0x421d('0x10')]);router[_0x421d('0x8')](_0x421d('0x11'),auth[_0x421d('0xa')](),controller[_0x421d('0x12')]);router[_0x421d('0x8')](_0x421d('0x13'),auth['isAuthenticated'](),controller[_0x421d('0x14')]);router[_0x421d('0x8')]('/whatsapp/queues',auth[_0x421d('0xa')](),controller[_0x421d('0x15')]);router['get'](_0x421d('0x16'),auth[_0x421d('0xa')](),controller['faxQueues']);router['get'](_0x421d('0x17'),auth[_0x421d('0xa')](),controller[_0x421d('0x18')]);router[_0x421d('0x8')]('/voice/queues/channels',auth[_0x421d('0xa')](),controller['voiceQueuesChannels']);router[_0x421d('0x8')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x421d('0x19')]);router[_0x421d('0x8')](_0x421d('0x1a'),auth[_0x421d('0xa')](),controller[_0x421d('0x1b')]);router[_0x421d('0x8')](_0x421d('0x1c'),auth[_0x421d('0xa')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x421d('0x1d'),auth[_0x421d('0xa')](),controller[_0x421d('0x1e')]);router[_0x421d('0x1f')](_0x421d('0x1d'),auth[_0x421d('0xa')](),controller[_0x421d('0x20')]);router[_0x421d('0x8')](_0x421d('0x21'),auth['isAuthenticated'](),controller[_0x421d('0x22')]);router['get'](_0x421d('0x23'),auth[_0x421d('0xa')](),controller['outboundChannels']);router[_0x421d('0x8')](_0x421d('0x24'),auth[_0x421d('0xa')](),controller['agents']);router[_0x421d('0x1f')](_0x421d('0x25'),auth[_0x421d('0xa')](),controller[_0x421d('0x26')]);router[_0x421d('0x8')](_0x421d('0x27'),auth[_0x421d('0xa')](),controller[_0x421d('0x28')]);router['get'](_0x421d('0x29'),auth['isAuthenticated'](),controller[_0x421d('0x2a')]);router[_0x421d('0x8')](_0x421d('0x2b'),auth['isAuthenticated'](),controller[_0x421d('0x2c')]);router['get'](_0x421d('0x2d'),auth[_0x421d('0xa')](),controller[_0x421d('0x2e')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x421d('0x8')]('/mail/queues/waitinginteractions',auth[_0x421d('0xa')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x421d('0x2f'),auth[_0x421d('0xa')](),controller['openchannelQueuesWaitingInteractions']);router[_0x421d('0x8')](_0x421d('0x30'),auth['isAuthenticated'](),controller[_0x421d('0x31')]);router[_0x421d('0x8')](_0x421d('0x32'),auth[_0x421d('0xa')](),controller['smsQueuesWaitingInteractions']);router[_0x421d('0x8')]('/whatsapp/queues/waitinginteractions',auth[_0x421d('0xa')](),controller[_0x421d('0x33')]);router[_0x421d('0x8')](_0x421d('0x34'),auth[_0x421d('0xa')](),controller[_0x421d('0x35')]);router[_0x421d('0x36')](_0x421d('0x37'),auth[_0x421d('0xa')](),controller[_0x421d('0x38')](_0x421d('0x39')));router[_0x421d('0x8')](_0x421d('0x3a'),auth[_0x421d('0xa')](),controller[_0x421d('0x3b')]);router[_0x421d('0x36')](_0x421d('0x3c'),auth[_0x421d('0xa')](),controller[_0x421d('0x38')](_0x421d('0x3d')));router[_0x421d('0x8')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x421d('0x38')]('fax'));router[_0x421d('0x8')](_0x421d('0x3e'),auth['isAuthenticated'](),controller[_0x421d('0x3f')]);router[_0x421d('0x36')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x421d('0x38')](_0x421d('0x40')));router[_0x421d('0x8')](_0x421d('0x41'),auth[_0x421d('0xa')](),controller['showOpenchannelQueues']);router[_0x421d('0x36')](_0x421d('0x42'),auth[_0x421d('0xa')](),controller[_0x421d('0x38')](_0x421d('0x43')));router[_0x421d('0x36')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x421d('0x38')]('whatsapp'));router[_0x421d('0x8')](_0x421d('0x44'),auth[_0x421d('0xa')](),controller[_0x421d('0x45')]);router[_0x421d('0x8')](_0x421d('0x46'),auth['isAuthenticated'](),controller[_0x421d('0x47')]);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x421d('0x48')]);module['exports']=router; \ No newline at end of file +var _0x9a97=['put','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/:id'];(function(_0x209bbb,_0x38dad7){var _0x4b4d89=function(_0x498728){while(--_0x498728){_0x209bbb['push'](_0x209bbb['shift']());}};_0x4b4d89(++_0x38dad7);}(_0x9a97,0x77));var _0x79a9=function(_0x28d78e,_0x433f96){_0x28d78e=_0x28d78e-0x0;var _0x1addab=_0x9a97[_0x28d78e];return _0x1addab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79a9('0x0'));var express=require(_0x79a9('0x1'));var router=express[_0x79a9('0x2')]();var auth=require(_0x79a9('0x3'));var controller=require(_0x79a9('0x4'));router[_0x79a9('0x5')]('/voice/channels',auth[_0x79a9('0x6')](),controller[_0x79a9('0x7')]);router[_0x79a9('0x5')](_0x79a9('0x8'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x9')]);router[_0x79a9('0x5')](_0x79a9('0xa'),auth[_0x79a9('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x79a9('0x5')](_0x79a9('0xb'),auth[_0x79a9('0x6')](),controller[_0x79a9('0xc')]);router[_0x79a9('0x5')](_0x79a9('0xd'),auth[_0x79a9('0x6')](),controller[_0x79a9('0xe')]);router[_0x79a9('0x5')](_0x79a9('0xf'),auth[_0x79a9('0x6')](),controller['mailQueues']);router[_0x79a9('0x5')]('/mail/accounts',auth[_0x79a9('0x6')](),controller[_0x79a9('0x10')]);router['get'](_0x79a9('0x11'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x79a9('0x5')](_0x79a9('0x12'),auth[_0x79a9('0x6')](),controller['smsQueues']);router[_0x79a9('0x5')](_0x79a9('0x13'),auth['isAuthenticated'](),controller[_0x79a9('0x14')]);router[_0x79a9('0x5')](_0x79a9('0x15'),auth[_0x79a9('0x6')](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x79a9('0x16')]);router[_0x79a9('0x5')](_0x79a9('0x17'),auth[_0x79a9('0x6')](),controller['voiceQueuesChannels']);router[_0x79a9('0x5')](_0x79a9('0x18'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x19')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x79a9('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x79a9('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x79a9('0x6')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x79a9('0x1a'),auth[_0x79a9('0x6')](),controller['showVoiceQueues']);router[_0x79a9('0x1b')]('/voice/queues/:id',auth[_0x79a9('0x6')](),controller['updateVoiceQueue']);router[_0x79a9('0x5')](_0x79a9('0x1c'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x1d')]);router[_0x79a9('0x5')](_0x79a9('0x1e'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x1f')]);router[_0x79a9('0x5')]('/agents',auth[_0x79a9('0x6')](),controller[_0x79a9('0x20')]);router[_0x79a9('0x1b')](_0x79a9('0x21'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x22')]);router['get'](_0x79a9('0x23'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x24')]);router[_0x79a9('0x5')](_0x79a9('0x25'),auth[_0x79a9('0x6')](),controller['trunks']);router['get'](_0x79a9('0x26'),auth[_0x79a9('0x6')](),controller['campaigns']);router[_0x79a9('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x79a9('0x5')](_0x79a9('0x27'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x79a9('0x5')](_0x79a9('0x28'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x29')]);router['get'](_0x79a9('0x2a'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x2b')]);router['get'](_0x79a9('0x2c'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x2d')]);router[_0x79a9('0x5')](_0x79a9('0x2e'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x79a9('0x5')](_0x79a9('0x2f'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x30')]);router[_0x79a9('0x5')](_0x79a9('0x31'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x32')]);router[_0x79a9('0x33')](_0x79a9('0x34'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x35')]('mail'));router[_0x79a9('0x5')](_0x79a9('0x36'),auth['isAuthenticated'](),controller[_0x79a9('0x37')]);router['post'](_0x79a9('0x38'),auth['isAuthenticated'](),controller[_0x79a9('0x35')](_0x79a9('0x39')));router[_0x79a9('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x79a9('0x3a')]);router[_0x79a9('0x33')](_0x79a9('0x3b'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x35')](_0x79a9('0x3c')));router[_0x79a9('0x5')](_0x79a9('0x3d'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x3e')]);router['post']('/openchannel/queues/:id/notify',auth[_0x79a9('0x6')](),controller[_0x79a9('0x35')](_0x79a9('0x3f')));router['get'](_0x79a9('0x40'),auth[_0x79a9('0x6')](),controller['showOpenchannelQueues']);router[_0x79a9('0x33')](_0x79a9('0x41'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x35')](_0x79a9('0x42')));router[_0x79a9('0x33')](_0x79a9('0x43'),auth[_0x79a9('0x6')](),controller['queueNotify'](_0x79a9('0x44')));router[_0x79a9('0x5')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x79a9('0x45')]);router[_0x79a9('0x5')](_0x79a9('0x46'),auth[_0x79a9('0x6')](),controller[_0x79a9('0x47')]);router[_0x79a9('0x33')](_0x79a9('0x48'),auth[_0x79a9('0x6')](),controller['agentNotify']);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 47bfe8b..2b4113b 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 _0x7217=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','rows','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','Message','findOne','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','channel','Channel\x20field\x20is\x20mandatory','\x20Message\x20not\x20found','update','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','send','isNil','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','name','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','SIP/%s','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'use strict';var BPromise=require(_0x7721('0x0'));var moment=require('moment');var _=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var db=require(_0x7721('0x3'))['db'];var logger=require(_0x7721('0x4'))(_0x7721('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x7721('0x6')]({'port':0x232a});var mailClient=jayson[_0x7721('0x7')][_0x7721('0x6')]({'port':0x232b});var routingClient=jayson[_0x7721('0x7')][_0x7721('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){var _0x3e6368=_0x21f680?_0x21f680:amiClient;return _0x3e6368[_0x7721('0x8')](_0xf7ff37,_0x18ab6b)[_0x7721('0x9')](function(_0x138740){if(_0x138740[_0x7721('0xa')]){if(_0x138740['error'][_0x7721('0xb')]===0x1f4){return _0x2f99ed(_0x138740[_0x7721('0xa')][_0x7721('0xc')]);}return _0x225610(_0x138740[_0x7721('0xa')][_0x7721('0xc')]);}else{_0x225610(_0x138740[_0x7721('0xd')]);}})[_0x7721('0xe')](function(_0x27b36b){_0x2f99ed(_0x27b36b);});});}function respondWithResult(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xc8;return function(_0x199930){if(_0x199930){return _0x55b4ca['status'](_0x2911ec)[_0x7721('0xf')](_0x199930);}return _0x55b4ca[_0x7721('0x10')](0x194);};}function handleError(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0x1f4;return function(_0x5069da){logger[_0x7721('0xa')](_0x5069da[_0x7721('0x11')]);if(_0x5069da['name']){delete _0x5069da['name'];}_0x3f01c5['status'](_0x2e9752)[_0x7721('0x12')](_0x5069da);};}function findById(_0x25a628){return function(_0x3cc909){if(!_[_0x7721('0x13')](_0x25a628)&&!_['isNil'](_0x3cc909)&&!_[_0x7721('0x13')](_0x3cc909['rows'])){return _[_0x7721('0x14')](_0x3cc909['rows'],function(_0xfec626){return _0xfec626['id']==_0x25a628;});}return null;};}exports[_0x7721('0x15')]=function(_0x3ab5a5,_0x3e140d){return respondWithRpcPromise(_0x7721('0x16'),_0x3ab5a5[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x3e140d,null))[_0x7721('0xe')](handleError(_0x3e140d,null));};exports[_0x7721('0x18')]=function(_0xaeccc4,_0x4ce1db){return respondWithRpcPromise(_0x7721('0x19'),_[_0x7721('0x1a')](_0xaeccc4[_0x7721('0x17')],_0xaeccc4[_0x7721('0x1b')]))['then'](respondWithResult(_0x4ce1db,null))[_0x7721('0xe')](handleError(_0x4ce1db,null));};exports['voiceChannelStopMixMonitor']=function(_0xb9e9dd,_0x288e3a){return respondWithRpcPromise(_0x7721('0x1c'),_[_0x7721('0x1a')](_0xb9e9dd[_0x7721('0x17')],_0xb9e9dd[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x288e3a,null))['catch'](handleError(_0x288e3a,null));};exports[_0x7721('0x1d')]=function(_0x1abedb,_0x125564){return respondWithRpcPromise(_0x7721('0x1e'),_0x1abedb[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x125564,null))[_0x7721('0xe')](handleError(_0x125564,null));};exports[_0x7721('0x1f')]=function(_0x40f367,_0x52316e){return respondWithRpcPromise(_0x7721('0x1e'),_0x40f367['query'])['then'](findById(_0x40f367[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x52316e,null))[_0x7721('0xe')](handleError(_0x52316e,null));};exports[_0x7721('0x20')]=function(_0x1ea4d,_0x37b9f0){return respondWithRpcPromise(_0x7721('0x21'),_[_0x7721('0x1a')](_0x1ea4d['body'],_0x1ea4d[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x37b9f0,null))['catch'](handleError(_0x37b9f0,null));};exports['voiceQueuesPreview']=function(_0xfde9ec,_0x220bbf){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x7721('0x1a')](_0xfde9ec[_0x7721('0x17')],_0xfde9ec[_0x7721('0x1b')]))['then'](respondWithResult(_0x220bbf,null))[_0x7721('0xe')](handleError(_0x220bbf,null));};exports[_0x7721('0x22')]=function(_0x1492d4,_0x3f15e2){return respondWithRpcPromise(_0x7721('0x23'),_0x1492d4['query'])[_0x7721('0x9')](respondWithResult(_0x3f15e2,null))[_0x7721('0xe')](handleError(_0x3f15e2,null));};exports[_0x7721('0x24')]=function(_0x5c5b33,_0x35de7a){return respondWithRpcPromise(_0x7721('0x25'),_['merge'](_0x5c5b33[_0x7721('0x17')],_0x5c5b33['params']))[_0x7721('0x9')](respondWithResult(_0x35de7a,null))[_0x7721('0xe')](handleError(_0x35de7a,null));};exports[_0x7721('0x26')]=function(_0x1d894b,_0x1c84c0){return respondWithRpcPromise(_0x7721('0x27'),_[_0x7721('0x1a')](_0x1d894b[_0x7721('0x17')],_0x1d894b[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x1c84c0,null))[_0x7721('0xe')](handleError(_0x1c84c0,null));};exports['voiceQueuesChannelRedirect']=function(_0xd1df68,_0x5e6663){return respondWithRpcPromise(_0x7721('0x28'),_[_0x7721('0x1a')](_0xd1df68[_0x7721('0x17')],_0xd1df68[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x5e6663,null))[_0x7721('0xe')](handleError(_0x5e6663,null));};exports['outbound']=function(_0x557c34,_0x4cadef){return respondWithRpcPromise('Outbound',_0x557c34[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x4cadef,null))[_0x7721('0xe')](handleError(_0x4cadef,null));};exports[_0x7721('0x29')]=function(_0x4a90ce,_0xa389fa){return respondWithRpcPromise('OutboundChannels',_0x4a90ce[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0xa389fa,null))['catch'](handleError(_0xa389fa,null));};exports[_0x7721('0x2a')]=function(_0x3a47c8,_0x4e77ff){var _0x4d0111;return respondWithRpcPromise(_0x7721('0x2b'),_0x3a47c8[_0x7721('0x17')])[_0x7721('0x9')](function(_0x15e34d){_0x4d0111=_0x15e34d;return respondWithRpcPromise('Agents',_0x3a47c8[_0x7721('0x17')],routingClient);})[_0x7721('0x9')](function(_0x40ce8c){return _[_0x7721('0x1a')]({},_0x40ce8c,_0x4d0111);})[_0x7721('0x9')](respondWithResult(_0x4e77ff,null))['catch'](handleError(_0x4e77ff,null));};exports[_0x7721('0x2c')]=function(_0x4a2c28,_0xaa3216){if(_0x4a2c28['body']&&_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')]&&_0x4a2c28[_0x7721('0x2f')]&&_0x4a2c28['user'][_0x7721('0x30')]){for(var _0x11d853 in _0x4a2c28[_0x7721('0x2d')]['interaction']){if(_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x7721('0x31')](_0x11d853)){db[_0x7721('0x32')][_0x7721('0x33')]({'where':{'channel':_0x11d853,'membername':_0x4a2c28[_0x7721('0x2f')][_0x7721('0x30')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4a2c28['body'][_0x7721('0x2e')][_0x11d853]&&_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853][_0x7721('0x34')]?{'$notIn':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853]}:{'$ne':null}}})[_0x7721('0x9')](function(_0x2966fe){var _0xa601bc=moment()[_0x7721('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x578867=0x0,_0x5ed70d=_0x2966fe[_0x7721('0x34')];_0x578867<_0x5ed70d;_0x578867+=0x1){_0x2966fe[_0x578867][_0x7721('0x36')]({'exitAt':_0xa601bc});}});for(var _0x219c9f=0x0;_0x219c9f<_0x4a2c28['body'][_0x7721('0x2e')][_0x11d853][_0x7721('0x34')];_0x219c9f+=0x1){db['MemberReport'][_0x7721('0x37')]({'where':{'channel':_0x11d853,'membername':_0x4a2c28['user'][_0x7721('0x30')],'type':'INTERACTION','uniqueid':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853][_0x219c9f],'exitAt':null},'defaults':{'channel':_0x11d853,'membername':_0x4a2c28[_0x7721('0x2f')]['name'],'interface':_[_0x7721('0x13')](_0x4a2c28[_0x7721('0x2f')]['interface'])?util[_0x7721('0x35')](_0x7721('0x38'),_0x4a2c28[_0x7721('0x2f')]['name']):_0x4a2c28[_0x7721('0x2f')]['interface'],'type':_0x7721('0x39'),'enterAt':moment()[_0x7721('0x35')](_0x7721('0x3a')),'role':_0x7721('0x3b'),'internal':_0x4a2c28[_0x7721('0x2f')][_0x7721('0x3c')],'uniqueid':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853][_0x219c9f]}});}}}}return respondWithRpcPromise(_0x7721('0x3d'),{'id':_0x4a2c28[_0x7721('0x1b')]['id'],'capacity':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x3e')]},routingClient)[_0x7721('0x9')](respondWithResult(_0xaa3216,null))[_0x7721('0xe')](handleError(_0xaa3216,null));};exports[_0x7721('0x3f')]=function(_0x5b741d,_0x474f32){return respondWithRpcPromise(_0x7721('0x40'),_0x5b741d[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x474f32,null))[_0x7721('0xe')](handleError(_0x474f32,null));};exports[_0x7721('0x41')]=function(_0x267f5e,_0x57484c){return respondWithRpcPromise(_0x7721('0x42'),_0x267f5e[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x57484c,null))[_0x7721('0xe')](handleError(_0x57484c,null));};exports[_0x7721('0x43')]=function(_0x9c0d4,_0x7fbd6c){return respondWithRpcPromise(_0x7721('0x44'),_0x9c0d4[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x7fbd6c,null))[_0x7721('0xe')](handleError(_0x7fbd6c,null));};exports['chatQueues']=function(_0x421c27,_0xadb365){return respondWithRpcPromise(_0x7721('0x45'),_0x421c27[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0xadb365,null))[_0x7721('0xe')](handleError(_0xadb365,null));};exports[_0x7721('0x46')]=function(_0x36fe6f,_0x360882){return respondWithRpcPromise(_0x7721('0x45'),_0x36fe6f[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x36fe6f[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x360882,null))[_0x7721('0xe')](handleError(_0x360882,null));};exports['mailQueues']=function(_0x50e9e9,_0x4e112e){return respondWithRpcPromise(_0x7721('0x47'),_0x50e9e9['query'],routingClient)['then'](respondWithResult(_0x4e112e,null))['catch'](handleError(_0x4e112e,null));};exports['showMailQueues']=function(_0x47925a,_0x219181){return respondWithRpcPromise(_0x7721('0x47'),_0x47925a['query'],routingClient)[_0x7721('0x9')](findById(_0x47925a['params']['id']))['then'](respondWithResult(_0x219181,null))['catch'](handleError(_0x219181,null));};exports[_0x7721('0x48')]=function(_0x4f0d38,_0x48e7e3){return respondWithRpcPromise('MailAccounts',_0x4f0d38[_0x7721('0x17')],mailClient)[_0x7721('0x9')](respondWithResult(_0x48e7e3,null))[_0x7721('0xe')](handleError(_0x48e7e3,null));};exports['openchannelQueues']=function(_0x2a025c,_0x1f1890){return respondWithRpcPromise(_0x7721('0x49'),_0x2a025c[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x1f1890,null))[_0x7721('0xe')](handleError(_0x1f1890,null));};exports[_0x7721('0x4a')]=function(_0x3e3301,_0x127f46){return respondWithRpcPromise(_0x7721('0x49'),_0x3e3301[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x3e3301[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x127f46,null))[_0x7721('0xe')](handleError(_0x127f46,null));};exports['smsQueues']=function(_0x233e5d,_0x2c93b0){return respondWithRpcPromise(_0x7721('0x4b'),_0x233e5d[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x2c93b0,null))[_0x7721('0xe')](handleError(_0x2c93b0,null));};exports[_0x7721('0x4c')]=function(_0x4c8284,_0x3e7df3){return respondWithRpcPromise('SmsQueues',_0x4c8284[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x4c8284[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x3e7df3,null))[_0x7721('0xe')](handleError(_0x3e7df3,null));};exports[_0x7721('0x4d')]=function(_0x3121e0,_0x167ce7){return respondWithRpcPromise(_0x7721('0x4e'),_0x3121e0['query'],routingClient)[_0x7721('0x9')](respondWithResult(_0x167ce7,null))[_0x7721('0xe')](handleError(_0x167ce7,null));};exports[_0x7721('0x4f')]=function(_0x3a11e2,_0x56a988){return respondWithRpcPromise(_0x7721('0x4e'),_0x3a11e2[_0x7721('0x17')],routingClient)['then'](findById(_0x3a11e2[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x56a988,null))['catch'](handleError(_0x56a988,null));};exports[_0x7721('0x50')]=function(_0x565c49,_0x14b543){return respondWithRpcPromise(_0x7721('0x51'),_0x565c49[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x14b543,null))[_0x7721('0xe')](handleError(_0x14b543,null));};exports[_0x7721('0x52')]=function(_0x258c57,_0x5dca04){return respondWithRpcPromise(_0x7721('0x51'),_0x258c57[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x258c57['params']['id']))['then'](respondWithResult(_0x5dca04,null))['catch'](handleError(_0x5dca04,null));};exports['faxAccounts']=function(_0x5e966f,_0x1fc5f7){return respondWithRpcPromise(_0x7721('0x53'),_0x5e966f['query'])[_0x7721('0x9')](respondWithResult(_0x1fc5f7,null))[_0x7721('0xe')](handleError(_0x1fc5f7,null));};exports[_0x7721('0x54')]=function(_0x4593e1,_0x53ebb1){return respondWithRpcPromise(_0x7721('0x55'),_0x4593e1[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x53ebb1,null))[_0x7721('0xe')](handleError(_0x53ebb1,null));};exports[_0x7721('0x56')]=function(_0x53adb1,_0x29ac64){return respondWithRpcPromise(_0x7721('0x57'),_0x53adb1[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x29ac64,null))['catch'](handleError(_0x29ac64,null));};exports[_0x7721('0x58')]=function(_0x752564,_0x423040){return respondWithRpcPromise(_0x7721('0x59'),_0x752564[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x423040,null))['catch'](handleError(_0x423040,null));};exports[_0x7721('0x5a')]=function(_0x1bd97e,_0x68de4){return respondWithRpcPromise(_0x7721('0x59'),_0x1bd97e[_0x7721('0x17')],routingClient)[_0x7721('0x9')](function(_0x34187f){if(_0x1bd97e['query'][_0x7721('0x5b')]!==undefined){var _0x413185=_(_0x34187f[_0x7721('0x5c')])['filter']([_0x1bd97e[_0x7721('0x17')][_0x7721('0x5b')],_0x1bd97e[_0x7721('0x1b')]['id']])[_0x7721('0x5d')]('queue_id')['uniq']()[_0x7721('0x5e')]();return _0x34187f[_0x7721('0x5c')][_0x7721('0x5f')](function(_0x42c849){return _0x413185[_0x7721('0x60')](_0x42c849[_0x7721('0x61')])>-0x1;});}else{return _0x34187f['rows'][_0x7721('0x5f')](function(_0x42bb5a){return _0x42bb5a[_0x7721('0x61')]===parseInt(_0x1bd97e['params']['id']);});}})[_0x7721('0x9')](respondWithResult(_0x68de4,null))[_0x7721('0xe')](handleError(_0x68de4,null));};exports[_0x7721('0x62')]=function(_0xc20188,_0x457d7f){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0xc20188[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x457d7f,null))[_0x7721('0xe')](handleError(_0x457d7f,null));};exports[_0x7721('0x63')]=function(_0x2d5433,_0x7f0598){return respondWithRpcPromise(_0x7721('0x64'),_0x2d5433[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x7f0598,null))[_0x7721('0xe')](handleError(_0x7f0598,null));};exports[_0x7721('0x65')]=function(_0x3b78f5,_0x2c74d8){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x3b78f5[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x2c74d8,null))[_0x7721('0xe')](handleError(_0x2c74d8,null));};exports['queueNotify']=function(_0x94af20){return function(_0x26b2cc,_0x139517){var _0xc9761e,_0xcd9f0d;var _0x594059=_[_0x7721('0x66')](_0x94af20);var _0x22f15a=_0x94af20===_0x7721('0x67')?_0x7721('0x68'):_0x7721('0x69');return db[_0x594059+_0x7721('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x26b2cc[_0x7721('0x1b')]['id']}})[_0x7721('0x9')](function(_0x480a03){if(_[_0x7721('0x13')](_0x480a03)){throw new Error(_0x594059+'\x20Queue\x20not\x20found');}_0xc9761e=_0x480a03;return db[_0x594059+_0x7721('0x6b')][_0x7721('0x6c')]({'where':{'id':_0x26b2cc['body'][_0x7721('0x6d')]},'include':[{'model':db[_0x594059+'Interaction'],'as':'Interaction'},{'model':db[_0x594059+_0x22f15a],'as':'Account'}]});})[_0x7721('0x9')](function(_0x20f12e){if(_[_0x7721('0x13')](_0x20f12e)){throw new Error(_0x594059+'\x20Message\x20not\x20found');}_0xcd9f0d=_0x20f12e;return _0x20f12e['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x355aa8={'uniqueid':_0x94af20+'.'+_0xcd9f0d['id']+'.'+_0xcd9f0d[_0x7721('0x6e')]['id'],'FromUserId':_0x26b2cc[_0x7721('0x2f')]['id'],'type':_0x7721('0x6f')};_0x355aa8[_0x594059+_0x7721('0x70')]=_0xcd9f0d['id'];_0x355aa8[_0x594059+_0x7721('0x71')]=_0xcd9f0d['Interaction']['id'];_0x355aa8[_0x7721('0x72')+_0x594059+_0x22f15a+'Id']=_0xcd9f0d[_0x7721('0x69')]['id'];_0x355aa8['To'+_0x594059+_0x7721('0x73')]=_0xc9761e['id'];return db[_0x594059+_0x7721('0x74')][_0x7721('0x75')](_0x355aa8);})[_0x7721('0x9')](function(){return respondWithRpcPromise(_0x7721('0x76'),{'channel':_0x94af20,'interaction':_0xcd9f0d[_0x7721('0x6e')],'message':_0xcd9f0d,'account':_0xcd9f0d[_0x7721('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7721('0x6f'),'appdata':_0xc9761e[_0x7721('0x30')]+','+(_0xcd9f0d[_0x7721('0x69')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x7721('0x9')](respondWithResult(_0x139517,null))[_0x7721('0xe')](handleError(_0x139517,null));};};exports['agentNotify']=function(_0x167e05,_0x570cf4){var _0x4e3c93,_0x154b4b;if(_['isNil'](_0x167e05['body'][_0x7721('0x77')])){throw new Error(_0x7721('0x78'));}var _0x28e123=_0x167e05[_0x7721('0x2d')][_0x7721('0x77')];var _0x494c5e=_[_0x7721('0x66')](_0x28e123);var _0xcf2c06=_0x28e123===_0x7721('0x67')?_0x7721('0x68'):'Account';return db['User'][_0x7721('0x6c')]({'raw':!![],'where':{'id':_0x167e05[_0x7721('0x1b')]['id'],'role':'agent'}})[_0x7721('0x9')](function(_0x13dc8a){if(_['isNil'](_0x13dc8a)){throw new Error('Agent\x20not\x20found');}_0x4e3c93=_0x13dc8a;return db[_0x494c5e+_0x7721('0x6b')][_0x7721('0x6c')]({'where':{'id':_0x167e05[_0x7721('0x2d')][_0x7721('0x6d')]},'include':[{'model':db[_0x494c5e+_0x7721('0x6e')],'as':_0x7721('0x6e')},{'model':db[_0x494c5e+_0xcf2c06],'as':_0x7721('0x69')}]});})[_0x7721('0x9')](function(_0x59de30){if(_[_0x7721('0x13')](_0x59de30)){throw new Error(_0x494c5e+_0x7721('0x79'));}_0x154b4b=_0x59de30;return _0x59de30[_0x7721('0x7a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7721('0x9')](function(){var _0xe1c795={'uniqueid':_0x28e123+'.'+_0x154b4b['id']+'.'+_0x154b4b[_0x7721('0x6e')]['id'],'FromUserId':_0x167e05[_0x7721('0x2f')]['id'],'type':'queue','ToUserId':_0x4e3c93['id']};_0xe1c795[_0x494c5e+_0x7721('0x70')]=_0x154b4b['id'];_0xe1c795[_0x494c5e+_0x7721('0x71')]=_0x154b4b['Interaction']['id'];_0xe1c795[_0x7721('0x72')+_0x494c5e+_0xcf2c06+'Id']=_0x154b4b[_0x7721('0x69')]['id'];return db[_0x494c5e+_0x7721('0x74')][_0x7721('0x75')](_0xe1c795);})[_0x7721('0x9')](function(){return respondWithRpcPromise(_0x7721('0x76'),{'channel':_0x28e123,'interaction':_0x154b4b[_0x7721('0x6e')],'message':_0x154b4b,'account':_0x154b4b[_0x7721('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7721('0x3b'),'appdata':_0x4e3c93[_0x7721('0x30')]+','+(_0x154b4b['Account'][_0x7721('0x7b')]||0x12c),'interval':_0x7721('0x7c')}]},routingClient);})[_0x7721('0x9')](respondWithResult(_0x570cf4,null))[_0x7721('0xe')](handleError(_0x570cf4,null));}; \ No newline at end of file +var _0xac31=['MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','value','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','Start','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','json','sendStatus','name','isNil','find','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user'];(function(_0x288d33,_0x58ee36){var _0x1033bd=function(_0x2e22f1){while(--_0x2e22f1){_0x288d33['push'](_0x288d33['shift']());}};_0x1033bd(++_0x58ee36);}(_0xac31,0xca));var _0x1ac3=function(_0x33c277,_0x232925){_0x33c277=_0x33c277-0x0;var _0x1ad64a=_0xac31[_0x33c277];return _0x1ad64a;};'use strict';var BPromise=require(_0x1ac3('0x0'));var moment=require(_0x1ac3('0x1'));var _=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var db=require(_0x1ac3('0x4'))['db'];var logger=require(_0x1ac3('0x5'))(_0x1ac3('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1ac3('0x7')][_0x1ac3('0x8')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x1ac3('0x7')][_0x1ac3('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){var _0x4d7695=_0x157604?_0x157604:amiClient;return _0x4d7695[_0x1ac3('0x9')](_0x2bf9b1,_0x1be223)[_0x1ac3('0xa')](function(_0x344674){if(_0x344674['error']){if(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xc')]===0x1f4){return _0x2d17de(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xd')]);}return _0x57893c(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xd')]);}else{_0x57893c(_0x344674['result']);}})[_0x1ac3('0xe')](function(_0x376814){_0x2d17de(_0x376814);});});}function respondWithResult(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xc8;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0xf')](_0x2338b9)[_0x1ac3('0x10')](_0x50d3b6);}return _0x2eeabf[_0x1ac3('0x11')](0x194);};}function handleError(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0x1f4;return function(_0x24bb5e){logger[_0x1ac3('0xb')](_0x24bb5e['stack']);if(_0x24bb5e[_0x1ac3('0x12')]){delete _0x24bb5e[_0x1ac3('0x12')];}_0x2def9f[_0x1ac3('0xf')](_0x53cc35)['send'](_0x24bb5e);};}function findById(_0x2f14ca){return function(_0x8590ce){if(!_[_0x1ac3('0x13')](_0x2f14ca)&&!_['isNil'](_0x8590ce)&&!_[_0x1ac3('0x13')](_0x8590ce['rows'])){return _[_0x1ac3('0x14')](_0x8590ce[_0x1ac3('0x15')],function(_0x20091d){return _0x20091d['id']==_0x2f14ca;});}return null;};}exports[_0x1ac3('0x16')]=function(_0x18b985,_0x557076){return respondWithRpcPromise(_0x1ac3('0x17'),_0x18b985[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x557076,null))[_0x1ac3('0xe')](handleError(_0x557076,null));};exports['voiceChannelMixMonitor']=function(_0x48d18a,_0x2879d8){return respondWithRpcPromise(_0x1ac3('0x19'),_[_0x1ac3('0x1a')](_0x48d18a[_0x1ac3('0x18')],_0x48d18a[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x2879d8,null))[_0x1ac3('0xe')](handleError(_0x2879d8,null));};exports[_0x1ac3('0x1c')]=function(_0x3d30b8,_0x565141){return respondWithRpcPromise(_0x1ac3('0x1d'),_[_0x1ac3('0x1a')](_0x3d30b8['query'],_0x3d30b8[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x565141,null))['catch'](handleError(_0x565141,null));};exports[_0x1ac3('0x1e')]=function(_0x2f65e8,_0x145486){return respondWithRpcPromise(_0x1ac3('0x1f'),_0x2f65e8[_0x1ac3('0x18')])['then'](respondWithResult(_0x145486,null))['catch'](handleError(_0x145486,null));};exports['showVoiceQueues']=function(_0x528807,_0x52a1a5){return respondWithRpcPromise(_0x1ac3('0x1f'),_0x528807['query'])[_0x1ac3('0xa')](findById(_0x528807[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x52a1a5,null))[_0x1ac3('0xe')](handleError(_0x52a1a5,null));};exports['updateVoiceQueue']=function(_0x61441d,_0x541da0){return respondWithRpcPromise(_0x1ac3('0x20'),_[_0x1ac3('0x1a')](_0x61441d[_0x1ac3('0x21')],_0x61441d[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x541da0,null))[_0x1ac3('0xe')](handleError(_0x541da0,null));};exports[_0x1ac3('0x22')]=function(_0x5351b2,_0x2248b6){return respondWithRpcPromise(_0x1ac3('0x23'),_[_0x1ac3('0x1a')](_0x5351b2[_0x1ac3('0x18')],_0x5351b2['params']))[_0x1ac3('0xa')](respondWithResult(_0x2248b6,null))[_0x1ac3('0xe')](handleError(_0x2248b6,null));};exports[_0x1ac3('0x24')]=function(_0x294513,_0x204d78){return respondWithRpcPromise('VoiceQueuesChannels',_0x294513[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x204d78,null))[_0x1ac3('0xe')](handleError(_0x204d78,null));};exports[_0x1ac3('0x25')]=function(_0x1a47d4,_0x43362a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x1ac3('0x1a')](_0x1a47d4[_0x1ac3('0x18')],_0x1a47d4[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x43362a,null))['catch'](handleError(_0x43362a,null));};exports[_0x1ac3('0x26')]=function(_0x22404f,_0x2259f5){return respondWithRpcPromise(_0x1ac3('0x27'),_[_0x1ac3('0x1a')](_0x22404f[_0x1ac3('0x18')],_0x22404f[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x2259f5,null))[_0x1ac3('0xe')](handleError(_0x2259f5,null));};exports['voiceQueuesChannelRedirect']=function(_0xe6f9c0,_0x27b017){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x1ac3('0x1a')](_0xe6f9c0[_0x1ac3('0x18')],_0xe6f9c0[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x27b017,null))[_0x1ac3('0xe')](handleError(_0x27b017,null));};exports[_0x1ac3('0x28')]=function(_0x1c8bf5,_0xa15199){return respondWithRpcPromise('Outbound',_0x1c8bf5[_0x1ac3('0x18')])['then'](respondWithResult(_0xa15199,null))[_0x1ac3('0xe')](handleError(_0xa15199,null));};exports[_0x1ac3('0x29')]=function(_0x2d449e,_0x1e2f5e){return respondWithRpcPromise(_0x1ac3('0x2a'),_0x2d449e[_0x1ac3('0x18')])['then'](respondWithResult(_0x1e2f5e,null))[_0x1ac3('0xe')](handleError(_0x1e2f5e,null));};exports[_0x1ac3('0x2b')]=function(_0x43d15,_0x4e2442){var _0x34380d;return respondWithRpcPromise(_0x1ac3('0x2c'),_0x43d15['query'])[_0x1ac3('0xa')](function(_0x43a2ee){_0x34380d=_0x43a2ee;return respondWithRpcPromise(_0x1ac3('0x2c'),_0x43d15[_0x1ac3('0x18')],routingClient);})[_0x1ac3('0xa')](function(_0x21d8d6){return _[_0x1ac3('0x1a')]({},_0x21d8d6,_0x34380d);})[_0x1ac3('0xa')](respondWithResult(_0x4e2442,null))['catch'](handleError(_0x4e2442,null));};exports[_0x1ac3('0x2d')]=function(_0x3e606f,_0x40ea2c){if(_0x3e606f[_0x1ac3('0x21')]&&_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')]&&_0x3e606f[_0x1ac3('0x2f')]&&_0x3e606f['user']['name']){for(var _0x2c2099 in _0x3e606f[_0x1ac3('0x21')]['interaction']){if(_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')]['hasOwnProperty'](_0x2c2099)){db[_0x1ac3('0x30')]['findAll']({'where':{'channel':_0x2c2099,'membername':_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')],'type':_0x1ac3('0x31'),'exitAt':null,'uniqueid':_0x3e606f[_0x1ac3('0x21')]['interaction'][_0x2c2099]&&_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x1ac3('0x32')]?{'$notIn':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099]}:{'$ne':null}}})['then'](function(_0x26b5b1){var _0x842f83=moment()[_0x1ac3('0x33')](_0x1ac3('0x34'));for(var _0x589434=0x0,_0x16d56a=_0x26b5b1[_0x1ac3('0x32')];_0x589434<_0x16d56a;_0x589434+=0x1){_0x26b5b1[_0x589434][_0x1ac3('0x35')]({'exitAt':_0x842f83});}});for(var _0x4019c6=0x0;_0x4019c6<_0x3e606f['body'][_0x1ac3('0x2e')][_0x2c2099][_0x1ac3('0x32')];_0x4019c6+=0x1){db[_0x1ac3('0x30')][_0x1ac3('0x36')]({'where':{'channel':_0x2c2099,'membername':_0x3e606f['user'][_0x1ac3('0x12')],'type':'INTERACTION','uniqueid':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x4019c6],'exitAt':null},'defaults':{'channel':_0x2c2099,'membername':_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')],'interface':_[_0x1ac3('0x13')](_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x37')])?util['format']('SIP/%s',_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')]):_0x3e606f[_0x1ac3('0x2f')]['interface'],'type':'INTERACTION','enterAt':moment()['format'](_0x1ac3('0x34')),'role':_0x1ac3('0x38'),'internal':_0x3e606f['user'][_0x1ac3('0x39')],'uniqueid':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x4019c6]}});}}}}return respondWithRpcPromise(_0x1ac3('0x3a'),{'id':_0x3e606f['params']['id'],'capacity':_0x3e606f['body'][_0x1ac3('0x3b')]},routingClient)[_0x1ac3('0xa')](respondWithResult(_0x40ea2c,null))['catch'](handleError(_0x40ea2c,null));};exports[_0x1ac3('0x3c')]=function(_0x5231f7,_0x4e4945){return respondWithRpcPromise(_0x1ac3('0x3d'),_0x5231f7[_0x1ac3('0x18')])['then'](respondWithResult(_0x4e4945,null))[_0x1ac3('0xe')](handleError(_0x4e4945,null));};exports['trunks']=function(_0x267541,_0x4762d3){return respondWithRpcPromise(_0x1ac3('0x3e'),_0x267541[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x4762d3,null))[_0x1ac3('0xe')](handleError(_0x4762d3,null));};exports[_0x1ac3('0x3f')]=function(_0x331374,_0xeb7e49){return respondWithRpcPromise(_0x1ac3('0x40'),_0x331374[_0x1ac3('0x18')])['then'](respondWithResult(_0xeb7e49,null))['catch'](handleError(_0xeb7e49,null));};exports[_0x1ac3('0x41')]=function(_0x310eb7,_0x3bf701){return respondWithRpcPromise(_0x1ac3('0x42'),_0x310eb7[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x3bf701,null))[_0x1ac3('0xe')](handleError(_0x3bf701,null));};exports[_0x1ac3('0x43')]=function(_0xcf3bba,_0x3149f6){return respondWithRpcPromise('ChatQueues',_0xcf3bba[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0xcf3bba[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x3149f6,null))[_0x1ac3('0xe')](handleError(_0x3149f6,null));};exports['mailQueues']=function(_0xb74cdf,_0x35895d){return respondWithRpcPromise('MailQueues',_0xb74cdf['query'],routingClient)['then'](respondWithResult(_0x35895d,null))[_0x1ac3('0xe')](handleError(_0x35895d,null));};exports[_0x1ac3('0x44')]=function(_0x2a1f66,_0x5ad546){return respondWithRpcPromise(_0x1ac3('0x45'),_0x2a1f66['query'],routingClient)['then'](findById(_0x2a1f66['params']['id']))['then'](respondWithResult(_0x5ad546,null))[_0x1ac3('0xe')](handleError(_0x5ad546,null));};exports[_0x1ac3('0x46')]=function(_0x42218b,_0x13294a){return respondWithRpcPromise(_0x1ac3('0x47'),_0x42218b['query'],mailClient)[_0x1ac3('0xa')](respondWithResult(_0x13294a,null))[_0x1ac3('0xe')](handleError(_0x13294a,null));};exports['openchannelQueues']=function(_0x2bcb4b,_0x1ffbb1){return respondWithRpcPromise(_0x1ac3('0x48'),_0x2bcb4b[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x1ffbb1,null))['catch'](handleError(_0x1ffbb1,null));};exports[_0x1ac3('0x49')]=function(_0x40907d,_0x1f4294){return respondWithRpcPromise(_0x1ac3('0x48'),_0x40907d['query'],routingClient)[_0x1ac3('0xa')](findById(_0x40907d[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x1f4294,null))[_0x1ac3('0xe')](handleError(_0x1f4294,null));};exports[_0x1ac3('0x4a')]=function(_0x1ac283,_0x5541c3){return respondWithRpcPromise('SmsQueues',_0x1ac283['query'],routingClient)['then'](respondWithResult(_0x5541c3,null))[_0x1ac3('0xe')](handleError(_0x5541c3,null));};exports['showSmsQueues']=function(_0x2a5413,_0x19359f){return respondWithRpcPromise(_0x1ac3('0x4b'),_0x2a5413[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0x2a5413[_0x1ac3('0x1b')]['id']))['then'](respondWithResult(_0x19359f,null))[_0x1ac3('0xe')](handleError(_0x19359f,null));};exports[_0x1ac3('0x4c')]=function(_0x3597cb,_0x422b15){return respondWithRpcPromise('WhatsappQueues',_0x3597cb[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x422b15,null))[_0x1ac3('0xe')](handleError(_0x422b15,null));};exports[_0x1ac3('0x4d')]=function(_0x380ed8,_0x49ced4){return respondWithRpcPromise(_0x1ac3('0x4e'),_0x380ed8['query'],routingClient)['then'](findById(_0x380ed8[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x49ced4,null))[_0x1ac3('0xe')](handleError(_0x49ced4,null));};exports[_0x1ac3('0x4f')]=function(_0x355429,_0x3959bb){return respondWithRpcPromise(_0x1ac3('0x50'),_0x355429[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x3959bb,null))['catch'](handleError(_0x3959bb,null));};exports[_0x1ac3('0x51')]=function(_0xd36c71,_0x303d58){return respondWithRpcPromise('FaxQueues',_0xd36c71[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0xd36c71[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x303d58,null))[_0x1ac3('0xe')](handleError(_0x303d58,null));};exports[_0x1ac3('0x52')]=function(_0x8740b4,_0x215966){return respondWithRpcPromise(_0x1ac3('0x53'),_0x8740b4[_0x1ac3('0x18')])['then'](respondWithResult(_0x215966,null))[_0x1ac3('0xe')](handleError(_0x215966,null));};exports[_0x1ac3('0x54')]=function(_0x41ffd0,_0x566ddc){return respondWithRpcPromise(_0x1ac3('0x55'),_0x41ffd0[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x566ddc,null))[_0x1ac3('0xe')](handleError(_0x566ddc,null));};exports[_0x1ac3('0x56')]=function(_0x519b80,_0x4d9d77){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x519b80[_0x1ac3('0x18')],routingClient)['then'](respondWithResult(_0x4d9d77,null))[_0x1ac3('0xe')](handleError(_0x4d9d77,null));};exports[_0x1ac3('0x57')]=function(_0x433dd0,_0x5cf974){return respondWithRpcPromise(_0x1ac3('0x58'),_0x433dd0[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x5cf974,null))[_0x1ac3('0xe')](handleError(_0x5cf974,null));};exports[_0x1ac3('0x59')]=function(_0x59def5,_0x5ec89d){return respondWithRpcPromise(_0x1ac3('0x58'),_0x59def5[_0x1ac3('0x18')],routingClient)['then'](function(_0x29b026){if(_0x59def5[_0x1ac3('0x18')][_0x1ac3('0x5a')]!==undefined){var _0x5cc2e0=_(_0x29b026[_0x1ac3('0x15')])[_0x1ac3('0x5b')]([_0x59def5['query'][_0x1ac3('0x5a')],_0x59def5['params']['id']])[_0x1ac3('0x5c')]('queue_id')['uniq']()[_0x1ac3('0x5d')]();return _0x29b026[_0x1ac3('0x15')][_0x1ac3('0x5b')](function(_0x3f5c44){return _0x5cc2e0[_0x1ac3('0x5e')](_0x3f5c44[_0x1ac3('0x5f')])>-0x1;});}else{return _0x29b026[_0x1ac3('0x15')][_0x1ac3('0x5b')](function(_0x408e3c){return _0x408e3c[_0x1ac3('0x5f')]===parseInt(_0x59def5[_0x1ac3('0x1b')]['id']);});}})[_0x1ac3('0xa')](respondWithResult(_0x5ec89d,null))['catch'](handleError(_0x5ec89d,null));};exports['smsQueuesWaitingInteractions']=function(_0x588726,_0x2ef69a){return respondWithRpcPromise(_0x1ac3('0x60'),_0x588726['query'],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x2ef69a,null))[_0x1ac3('0xe')](handleError(_0x2ef69a,null));};exports[_0x1ac3('0x61')]=function(_0x364748,_0xbadca5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x364748[_0x1ac3('0x18')],routingClient)['then'](respondWithResult(_0xbadca5,null))[_0x1ac3('0xe')](handleError(_0xbadca5,null));};exports['faxQueuesWaitingInteractions']=function(_0x218712,_0x50278a){return respondWithRpcPromise(_0x1ac3('0x62'),_0x218712[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x50278a,null))[_0x1ac3('0xe')](handleError(_0x50278a,null));};exports[_0x1ac3('0x63')]=function(_0x5bf7f1){return function(_0x4f9822,_0x4887a5){var _0x369ed0,_0x22e88d;var _0xbadd54=_[_0x1ac3('0x64')](_0x5bf7f1);var _0x5b4e54=_0x5bf7f1===_0x1ac3('0x65')?_0x1ac3('0x66'):'Account';return db[_0xbadd54+_0x1ac3('0x67')]['findOne']({'raw':!![],'where':{'id':_0x4f9822[_0x1ac3('0x1b')]['id']}})['then'](function(_0x5524a4){if(_['isNil'](_0x5524a4)){throw new Error(_0xbadd54+_0x1ac3('0x68'));}_0x369ed0=_0x5524a4;return db[_0xbadd54+_0x1ac3('0x69')][_0x1ac3('0x6a')]({'where':{'id':_0x4f9822[_0x1ac3('0x21')][_0x1ac3('0x6b')]},'include':[{'model':db[_0xbadd54+'Interaction'],'as':_0x1ac3('0x6c')},{'model':db[_0xbadd54+_0x5b4e54],'as':_0x1ac3('0x6d')}]});})[_0x1ac3('0xa')](function(_0x34377b){if(_['isNil'](_0x34377b)){throw new Error(_0xbadd54+_0x1ac3('0x6e'));}_0x22e88d=_0x34377b;return _0x34377b[_0x1ac3('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x55d53c={'uniqueid':_0x5bf7f1+'.'+_0x22e88d['id']+'.'+_0x22e88d['Interaction']['id'],'FromUserId':_0x4f9822[_0x1ac3('0x2f')]['id'],'type':_0x1ac3('0x70')};_0x55d53c[_0xbadd54+_0x1ac3('0x71')]=_0x22e88d['id'];_0x55d53c[_0xbadd54+_0x1ac3('0x72')]=_0x22e88d['Interaction']['id'];_0x55d53c[_0x1ac3('0x73')+_0xbadd54+_0x5b4e54+'Id']=_0x22e88d[_0x1ac3('0x6d')]['id'];_0x55d53c['To'+_0xbadd54+'QueueId']=_0x369ed0['id'];return db[_0xbadd54+_0x1ac3('0x74')][_0x1ac3('0x75')](_0x55d53c);})[_0x1ac3('0xa')](function(){return respondWithRpcPromise(_0x1ac3('0x76'),{'channel':_0x5bf7f1,'interaction':_0x22e88d['Interaction'],'message':_0x22e88d,'account':_0x22e88d[_0x1ac3('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1ac3('0x70'),'appdata':_0x369ed0[_0x1ac3('0x12')]+','+(_0x22e88d[_0x1ac3('0x6d')][_0x1ac3('0x77')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1ac3('0xa')](respondWithResult(_0x4887a5,null))[_0x1ac3('0xe')](handleError(_0x4887a5,null));};};exports['agentNotify']=function(_0x48335c,_0xfc252a){var _0x1c5f68,_0x554c7b;if(_['isNil'](_0x48335c[_0x1ac3('0x21')]['channel'])){throw new Error(_0x1ac3('0x78'));}var _0x20928f=_0x48335c['body']['channel'];var _0x3389be=_['capitalize'](_0x20928f);var _0x45faf6=_0x20928f===_0x1ac3('0x65')?_0x1ac3('0x66'):_0x1ac3('0x6d');return db[_0x1ac3('0x79')][_0x1ac3('0x6a')]({'raw':!![],'where':{'id':_0x48335c[_0x1ac3('0x1b')]['id'],'role':_0x1ac3('0x38')}})[_0x1ac3('0xa')](function(_0x588b98){if(_[_0x1ac3('0x13')](_0x588b98)){throw new Error(_0x1ac3('0x7a'));}_0x1c5f68=_0x588b98;return db[_0x3389be+'Message'][_0x1ac3('0x6a')]({'where':{'id':_0x48335c[_0x1ac3('0x21')]['messageId']},'include':[{'model':db[_0x3389be+_0x1ac3('0x6c')],'as':'Interaction'},{'model':db[_0x3389be+_0x45faf6],'as':'Account'}]});})[_0x1ac3('0xa')](function(_0x19a898){if(_[_0x1ac3('0x13')](_0x19a898)){throw new Error(_0x3389be+'\x20Message\x20not\x20found');}_0x554c7b=_0x19a898;return _0x19a898['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x1ac3('0xa')](function(){var _0x12b987={'uniqueid':_0x20928f+'.'+_0x554c7b['id']+'.'+_0x554c7b[_0x1ac3('0x6c')]['id'],'FromUserId':_0x48335c[_0x1ac3('0x2f')]['id'],'type':_0x1ac3('0x70'),'ToUserId':_0x1c5f68['id']};_0x12b987[_0x3389be+_0x1ac3('0x71')]=_0x554c7b['id'];_0x12b987[_0x3389be+_0x1ac3('0x72')]=_0x554c7b[_0x1ac3('0x6c')]['id'];_0x12b987[_0x1ac3('0x73')+_0x3389be+_0x45faf6+'Id']=_0x554c7b[_0x1ac3('0x6d')]['id'];return db[_0x3389be+_0x1ac3('0x74')][_0x1ac3('0x75')](_0x12b987);})[_0x1ac3('0xa')](function(){return respondWithRpcPromise(_0x1ac3('0x76'),{'channel':_0x20928f,'interaction':_0x554c7b[_0x1ac3('0x6c')],'message':_0x554c7b,'account':_0x554c7b[_0x1ac3('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1ac3('0x38'),'appdata':_0x1c5f68[_0x1ac3('0x12')]+','+(_0x554c7b[_0x1ac3('0x6d')][_0x1ac3('0x7b')]||0x12c),'interval':_0x1ac3('0x7c')}]},routingClient);})[_0x1ac3('0xa')](respondWithResult(_0xfc252a,null))['catch'](handleError(_0xfc252a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1f95586..5cd9ebb 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 _0x4946=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','put','update'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4946,0x193));var _0x6494=function(_0x534bd8,_0x5ae7d0){_0x534bd8=_0x534bd8-0x0;var _0x2f1784=_0x4946[_0x534bd8];return _0x2f1784;};'use strict';var multer=require(_0x6494('0x0'));var util=require(_0x6494('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6494('0x2'));var router=express[_0x6494('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6494('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6494('0x5'));var controller=require(_0x6494('0x6'));router[_0x6494('0x7')]('/',auth[_0x6494('0x8')](),controller['index']);router[_0x6494('0x7')](_0x6494('0x9'),auth[_0x6494('0x8')](),controller[_0x6494('0xa')]);router['get'](_0x6494('0xb'),auth[_0x6494('0x8')](),controller[_0x6494('0xc')]);router[_0x6494('0xd')]('/',auth[_0x6494('0x8')](),controller[_0x6494('0xe')]);router[_0x6494('0xf')]('/:id',auth[_0x6494('0x8')](),controller[_0x6494('0x10')]);router[_0x6494('0x11')](_0x6494('0x9'),auth[_0x6494('0x8')](),controller[_0x6494('0x12')]);module[_0x6494('0x13')]=router; \ No newline at end of file +var _0xf7b7=['isAuthenticated','index','/:id','/:id/run','run','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf7b7,0x1d8));var _0x7f7b=function(_0x28e4a8,_0x538c1b){_0x28e4a8=_0x28e4a8-0x0;var _0x2d6184=_0xf7b7[_0x28e4a8];return _0x2d6184;};'use strict';var multer=require('multer');var util=require(_0x7f7b('0x0'));var path=require(_0x7f7b('0x1'));var timeout=require(_0x7f7b('0x2'));var express=require(_0x7f7b('0x3'));var router=express[_0x7f7b('0x4')]();var fs_extra=require(_0x7f7b('0x5'));var auth=require(_0x7f7b('0x6'));var interaction=require(_0x7f7b('0x7'));var config=require(_0x7f7b('0x8'));var controller=require(_0x7f7b('0x9'));router[_0x7f7b('0xa')]('/',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0xc')]);router['get'](_0x7f7b('0xd'),auth[_0x7f7b('0xb')](),controller['show']);router[_0x7f7b('0xa')](_0x7f7b('0xe'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0xf')]);router[_0x7f7b('0x10')]('/',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x11')]);router[_0x7f7b('0x12')](_0x7f7b('0xd'),auth['isAuthenticated'](),controller[_0x7f7b('0x13')]);router[_0x7f7b('0x14')]('/:id',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x15')]);module[_0x7f7b('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 37d69af..75f5601 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 _0x6eec=['quarters','months','weeks','days','hours','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x30c1fa,_0x2554a0){var _0x1c6ae5=function(_0x4309c0){while(--_0x4309c0){_0x30c1fa['push'](_0x30c1fa['shift']());}};_0x1c6ae5(++_0x2554a0);}(_0x6eec,0x183));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc6ee('0x0'));module[_0xc6ee('0x1')]={'name':{'type':Sequelize[_0xc6ee('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc6ee('0x2')]},'active':{'type':Sequelize[_0xc6ee('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc6ee('0x2')],'allowNull':![],'defaultValue':_0xc6ee('0x4')},'startAt':{'type':Sequelize[_0xc6ee('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc6ee('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc6ee('0x7')](_0xc6ee('0x8'),_0xc6ee('0x9'),_0xc6ee('0xa'),_0xc6ee('0xb'),_0xc6ee('0xc'),_0xc6ee('0xd'),'minutes'),'allowNull':![],'defaultValue':_0xc6ee('0xc')},'output':{'type':Sequelize[_0xc6ee('0x7')](_0xc6ee('0xe'),_0xc6ee('0xf'),'xlsx'),'allowNull':![],'defaultValue':_0xc6ee('0xe')},'type':{'type':Sequelize['ENUM'](_0xc6ee('0x10'),'default'),'allowNull':![],'defaultValue':_0xc6ee('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc6ee('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xc6ee('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xc6ee('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x24b2=['exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize'];(function(_0x52e487,_0x53cd60){var _0x34b13e=function(_0x24036a){while(--_0x24036a){_0x52e487['push'](_0x52e487['shift']());}};_0x34b13e(++_0x53cd60);}(_0x24b2,0x9f));var _0x224b=function(_0x43cf4e,_0x3b6f35){_0x43cf4e=_0x43cf4e-0x0;var _0x1af27f=_0x24b2[_0x43cf4e];return _0x1af27f;};'use strict';var Sequelize=require(_0x224b('0x0'));module[_0x224b('0x1')]={'name':{'type':Sequelize[_0x224b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x224b('0x3')},'startAt':{'type':Sequelize[_0x224b('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x224b('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x224b('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x224b('0x6')](_0x224b('0x7'),_0x224b('0x8'),_0x224b('0x9'),_0x224b('0xa'),_0x224b('0xb'),_0x224b('0xc'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x224b('0xd'),_0x224b('0xe'),_0x224b('0xf')),'allowNull':![],'defaultValue':_0x224b('0xd')},'type':{'type':Sequelize[_0x224b('0x6')](_0x224b('0x10'),_0x224b('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x224b('0x12')],'defaultValue':![]},'email':{'type':Sequelize[_0x224b('0x2')]},'cc':{'type':Sequelize[_0x224b('0x13')]},'bcc':{'type':Sequelize[_0x224b('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x224b('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8c46c8c..a8d5af7 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 _0x14ea=['map','Schedule','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14ea,0x1c0));var _0xa14e=function(_0x1115d7,_0x27e69c){_0x1115d7=_0x1115d7-0x0;var _0x419422=_0x14ea[_0x1115d7];return _0x419422;};'use strict';var emlformat=require(_0xa14e('0x0'));var rimraf=require(_0xa14e('0x1'));var zipdir=require(_0xa14e('0x2'));var jsonpatch=require(_0xa14e('0x3'));var rp=require(_0xa14e('0x4'));var moment=require(_0xa14e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa14e('0x6'));var util=require(_0xa14e('0x7'));var path=require('path');var sox=require(_0xa14e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa14e('0x9'));var _=require('lodash');var squel=require(_0xa14e('0xa'));var crypto=require(_0xa14e('0xb'));var jsforce=require(_0xa14e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa14e('0xd'));var querystring=require('querystring');var Papa=require(_0xa14e('0xe'));var Redis=require(_0xa14e('0xf'));var authService=require(_0xa14e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa14e('0x11'));var logger=require('../../config/logger')(_0xa14e('0x12'));var utils=require(_0xa14e('0x13'));var config=require(_0xa14e('0x14'));var licenseUtil=require(_0xa14e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x133c86,_0x1382f3){_0x1382f3=_0x1382f3||0xcc;return function(_0x5f39e4){if(_0x5f39e4){return _0x133c86['sendStatus'](_0x1382f3);}return _0x133c86['status'](_0x1382f3)[_0xa14e('0x16')]();};}function respondWithResult(_0x1b48d5,_0x3b4828){_0x3b4828=_0x3b4828||0xc8;return function(_0x285a9e){if(_0x285a9e){return _0x1b48d5['status'](_0x3b4828)[_0xa14e('0x17')](_0x285a9e);}};}function respondWithFilteredResult(_0x428a29,_0x1d7cab){return function(_0x36d442){if(_0x36d442){var _0x580a76=typeof _0x1d7cab[_0xa14e('0x18')]===_0xa14e('0x19')&&typeof _0x1d7cab[_0xa14e('0x1a')]==='undefined';var _0x42dd7d=_0x36d442[_0xa14e('0x1b')];var _0x54cb99=_0x580a76?0x0:_0x1d7cab[_0xa14e('0x18')];var _0x5c74ae=_0x580a76?_0x36d442[_0xa14e('0x1b')]:_0x1d7cab[_0xa14e('0x18')]+_0x1d7cab[_0xa14e('0x1a')];var _0x35a2b4;if(_0x5c74ae>=_0x42dd7d){_0x5c74ae=_0x42dd7d;_0x35a2b4=0xc8;}else{_0x35a2b4=0xce;}_0x428a29[_0xa14e('0x1c')](_0x35a2b4);return _0x428a29['set'](_0xa14e('0x1d'),_0x54cb99+'-'+_0x5c74ae+'/'+_0x42dd7d)[_0xa14e('0x17')](_0x36d442);}return null;};}function patchUpdates(_0x3217d4){return function(_0x4b694a){try{jsonpatch[_0xa14e('0x1e')](_0x4b694a,_0x3217d4,!![]);}catch(_0x3b41d0){return BPromise[_0xa14e('0x1f')](_0x3b41d0);}return _0x4b694a[_0xa14e('0x20')]();};}function saveUpdates(_0x2f64e7,_0x30d665){return function(_0x2435b3){if(_0x2435b3){return _0x2435b3[_0xa14e('0x21')](_0x2f64e7)[_0xa14e('0x22')](function(_0xd4fa75){return _0xd4fa75;});}return null;};}function removeEntity(_0x293361,_0x50ea78){return function(_0x4ecf7c){if(_0x4ecf7c){return _0x4ecf7c[_0xa14e('0x23')]()[_0xa14e('0x22')](function(){var _0x300010=_0x4ecf7c[_0xa14e('0x24')]({'plain':!![]});var _0x363b9c=_0xa14e('0x25');return db[_0xa14e('0x26')]['destroy']({'where':{'type':_0x363b9c,'resourceId':_0x300010['id']}})[_0xa14e('0x22')](function(){return _0x4ecf7c;});})[_0xa14e('0x22')](function(){_0x293361[_0xa14e('0x1c')](0xcc)[_0xa14e('0x16')]();});}};}function handleEntityNotFound(_0x4abda3,_0x3cc39e){return function(_0x58829e){if(!_0x58829e){_0x4abda3[_0xa14e('0x27')](0x194);}return _0x58829e;};}function handleError(_0x479382,_0x312119){_0x312119=_0x312119||0x1f4;return function(_0x4848cc){logger[_0xa14e('0x28')](_0x4848cc['stack']);if(_0x4848cc[_0xa14e('0x29')]){delete _0x4848cc[_0xa14e('0x29')];}_0x479382[_0xa14e('0x1c')](_0x312119)[_0xa14e('0x2a')](_0x4848cc);};}exports[_0xa14e('0x2b')]=function(_0x39d0e1,_0x20b5ba){var _0xded572={},_0x37b935={},_0x454b1f={'count':0x0,'rows':[]};var _0x3287c7=_[_0xa14e('0x2c')](db[_0xa14e('0x2d')]['rawAttributes'],function(_0x5201b1){return{'name':_0x5201b1[_0xa14e('0x2e')],'type':_0x5201b1[_0xa14e('0x2f')]['key']};});_0x37b935[_0xa14e('0x30')]=_[_0xa14e('0x2c')](_0x3287c7,_0xa14e('0x29'));_0x37b935[_0xa14e('0x31')]=_[_0xa14e('0x32')](_0x39d0e1[_0xa14e('0x31')]);_0x37b935[_0xa14e('0x33')]=_[_0xa14e('0x34')](_0x37b935['model'],_0x37b935[_0xa14e('0x31')]);_0xded572[_0xa14e('0x35')]=_[_0xa14e('0x34')](_0x37b935[_0xa14e('0x30')],qs[_0xa14e('0x36')](_0x39d0e1['query'][_0xa14e('0x36')]));_0xded572['attributes']=_0xded572[_0xa14e('0x35')]['length']?_0xded572['attributes']:_0x37b935[_0xa14e('0x30')];if(!_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x37')](_0xa14e('0x38'))){_0xded572[_0xa14e('0x1a')]=qs[_0xa14e('0x1a')](_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x1a')]);_0xded572[_0xa14e('0x18')]=qs[_0xa14e('0x18')](_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x18')]);}_0xded572['order']=qs[_0xa14e('0x39')](_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x39')]);_0xded572[_0xa14e('0x3a')]=qs[_0xa14e('0x33')](_[_0xa14e('0x3b')](_0x39d0e1[_0xa14e('0x31')],_0x37b935[_0xa14e('0x33')]),_0x3287c7);if(_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x3c')]){_0xded572[_0xa14e('0x3a')]=_[_0xa14e('0x3d')](_0xded572[_0xa14e('0x3a')],{'$or':_['map'](_0x3287c7,function(_0x39c225){if(_0x39c225['type']!==_0xa14e('0x3e')){var _0x58200c={};_0x58200c[_0x39c225[_0xa14e('0x29')]]={'$like':'%'+_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x3c')]+'%'};return _0x58200c;}})});}_0xded572=_[_0xa14e('0x3d')]({},_0xded572,_0x39d0e1[_0xa14e('0x3f')]);var _0x4c3b10={'where':_0xded572[_0xa14e('0x3a')]};return db[_0xa14e('0x2d')][_0xa14e('0x1b')](_0x4c3b10)[_0xa14e('0x22')](function(_0x56880a){_0x454b1f[_0xa14e('0x1b')]=_0x56880a;if(_0x39d0e1[_0xa14e('0x31')][_0xa14e('0x40')]){_0xded572[_0xa14e('0x41')]=[{'all':!![]}];}return db['Schedule'][_0xa14e('0x42')](_0xded572);})[_0xa14e('0x22')](function(_0x3d80b7){_0x454b1f[_0xa14e('0x43')]=_0x3d80b7;return _0x454b1f;})[_0xa14e('0x22')](respondWithFilteredResult(_0x20b5ba,_0xded572))[_0xa14e('0x44')](handleError(_0x20b5ba,null));};exports[_0xa14e('0x45')]=function(_0xf4a788,_0x37b98e){var _0x2d12e3={'raw':![],'where':{'id':_0xf4a788[_0xa14e('0x46')]['id']}},_0x3c8531={};_0x3c8531[_0xa14e('0x30')]=_[_0xa14e('0x32')](db['Schedule'][_0xa14e('0x47')]);_0x3c8531[_0xa14e('0x31')]=_[_0xa14e('0x32')](_0xf4a788[_0xa14e('0x31')]);_0x3c8531[_0xa14e('0x33')]=_[_0xa14e('0x34')](_0x3c8531['model'],_0x3c8531[_0xa14e('0x31')]);_0x2d12e3['attributes']=_[_0xa14e('0x34')](_0x3c8531[_0xa14e('0x30')],qs['fields'](_0xf4a788[_0xa14e('0x31')][_0xa14e('0x36')]));_0x2d12e3[_0xa14e('0x35')]=_0x2d12e3[_0xa14e('0x35')]['length']?_0x2d12e3[_0xa14e('0x35')]:_0x3c8531[_0xa14e('0x30')];if(_0xf4a788[_0xa14e('0x31')][_0xa14e('0x40')]){_0x2d12e3[_0xa14e('0x41')]=[{'all':!![]}];}_0x2d12e3=_[_0xa14e('0x3d')]({},_0x2d12e3,_0xf4a788[_0xa14e('0x3f')]);return db[_0xa14e('0x2d')][_0xa14e('0x48')](_0x2d12e3)[_0xa14e('0x22')](handleEntityNotFound(_0x37b98e,null))[_0xa14e('0x22')](respondWithResult(_0x37b98e,null))[_0xa14e('0x44')](handleError(_0x37b98e,null));};exports['create']=function(_0x2210ec,_0x21c5ba){return db[_0xa14e('0x2d')][_0xa14e('0x49')](_0x2210ec[_0xa14e('0x4a')],{})[_0xa14e('0x22')](function(_0x2bc26d){var _0x4b5a74=_0x2210ec[_0xa14e('0x4b')]['get']({'plain':!![]});if(!_0x4b5a74)throw new Error(_0xa14e('0x4c'));if(_0x4b5a74[_0xa14e('0x4d')]===_0xa14e('0x4b')){var _0x9f54ab=_0x2bc26d[_0xa14e('0x24')]({'plain':!![]});var _0x255c66='Scheduler';return db['UserProfileSection'][_0xa14e('0x48')]({'where':{'name':_0x255c66,'userProfileId':_0x4b5a74['userProfileId']},'raw':!![]})[_0xa14e('0x22')](function(_0x475914){if(_0x475914&&_0x475914[_0xa14e('0x4e')]===0x0){return db['UserProfileResource'][_0xa14e('0x49')]({'name':_0x9f54ab[_0xa14e('0x29')],'resourceId':_0x9f54ab['id'],'type':_0x475914[_0xa14e('0x29')],'sectionId':_0x475914['id']},{})[_0xa14e('0x22')](function(){return _0x2bc26d;});}else{return _0x2bc26d;}})[_0xa14e('0x44')](function(_0x5bbb12){logger[_0xa14e('0x28')](_0xa14e('0x4f'),_0x5bbb12);throw _0x5bbb12;});}return _0x2bc26d;})[_0xa14e('0x22')](respondWithResult(_0x21c5ba,0xc9))['catch'](handleError(_0x21c5ba,null));};exports[_0xa14e('0x21')]=function(_0x20806f,_0x2b4cd8){if(_0x20806f['body']['id']){delete _0x20806f[_0xa14e('0x4a')]['id'];}return db[_0xa14e('0x2d')][_0xa14e('0x48')]({'where':{'id':_0x20806f[_0xa14e('0x46')]['id']}})[_0xa14e('0x22')](handleEntityNotFound(_0x2b4cd8,null))['then'](saveUpdates(_0x20806f[_0xa14e('0x4a')],null))[_0xa14e('0x22')](respondWithResult(_0x2b4cd8,null))[_0xa14e('0x44')](handleError(_0x2b4cd8,null));};exports[_0xa14e('0x23')]=function(_0x335cc1,_0x10ce66){return db[_0xa14e('0x2d')][_0xa14e('0x48')]({'where':{'id':_0x335cc1[_0xa14e('0x46')]['id']}})['then'](handleEntityNotFound(_0x10ce66,null))['then'](removeEntity(_0x10ce66,null))[_0xa14e('0x44')](handleError(_0x10ce66,null));};exports[_0xa14e('0x50')]=function(_0x1231c6,_0x40a7d4,_0x56bb40){var _0x4881f5=require(_0xa14e('0x51'));return db[_0xa14e('0x2d')][_0xa14e('0x48')]({'where':{'id':_0x1231c6['params']['id']},'raw':!![]})[_0xa14e('0x22')](handleEntityNotFound(_0x40a7d4,null))['then'](function(){_0x4881f5['run'](_0x1231c6[_0xa14e('0x46')]['id']);})[_0xa14e('0x22')](respondWithStatusCode(_0x40a7d4,null))[_0xa14e('0x44')](handleError(_0x40a7d4,null));}; \ No newline at end of file +var _0xc8ce=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Schedule','rows','params','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','body','run','../../config/schedule','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xc8ce,0x1ea));var _0xec8c=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xc8ce[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0xec8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec8c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec8c('0x2'));var moment=require(_0xec8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xec8c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xec8c('0x5'));var csv=require(_0xec8c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec8c('0x7'));var _=require('lodash');var squel=require(_0xec8c('0x8'));var crypto=require(_0xec8c('0x9'));var jsforce=require(_0xec8c('0xa'));var deskjs=require(_0xec8c('0xb'));var toCsv=require(_0xec8c('0x6'));var querystring=require(_0xec8c('0xc'));var Papa=require(_0xec8c('0xd'));var Redis=require('ioredis');var authService=require(_0xec8c('0xe'));var qs=require(_0xec8c('0xf'));var as=require(_0xec8c('0x10'));var hardwareService=require(_0xec8c('0x11'));var logger=require('../../config/logger')(_0xec8c('0x12'));var utils=require('../../config/utils');var config=require(_0xec8c('0x13'));var licenseUtil=require(_0xec8c('0x14'));var db=require(_0xec8c('0x15'))['db'];function respondWithStatusCode(_0x15141a,_0x5769bb){_0x5769bb=_0x5769bb||0xcc;return function(_0x38e751){if(_0x38e751){return _0x15141a[_0xec8c('0x16')](_0x5769bb);}return _0x15141a['status'](_0x5769bb)[_0xec8c('0x17')]();};}function respondWithResult(_0x3fadde,_0x2c7a85){_0x2c7a85=_0x2c7a85||0xc8;return function(_0x6663ce){if(_0x6663ce){return _0x3fadde['status'](_0x2c7a85)[_0xec8c('0x18')](_0x6663ce);}};}function respondWithFilteredResult(_0x40df8c,_0x273cf2){return function(_0x2f627c){if(_0x2f627c){var _0x442eba=typeof _0x273cf2[_0xec8c('0x19')]===_0xec8c('0x1a')&&typeof _0x273cf2['limit']===_0xec8c('0x1a');var _0x1fa898=_0x2f627c[_0xec8c('0x1b')];var _0x18f352=_0x442eba?0x0:_0x273cf2[_0xec8c('0x19')];var _0x53dac0=_0x442eba?_0x2f627c['count']:_0x273cf2[_0xec8c('0x19')]+_0x273cf2['limit'];var _0x4e91fc;if(_0x53dac0>=_0x1fa898){_0x53dac0=_0x1fa898;_0x4e91fc=0xc8;}else{_0x4e91fc=0xce;}_0x40df8c[_0xec8c('0x1c')](_0x4e91fc);return _0x40df8c[_0xec8c('0x1d')](_0xec8c('0x1e'),_0x18f352+'-'+_0x53dac0+'/'+_0x1fa898)['json'](_0x2f627c);}return null;};}function patchUpdates(_0x4d5687){return function(_0x526566){try{jsonpatch[_0xec8c('0x1f')](_0x526566,_0x4d5687,!![]);}catch(_0x4b1197){return BPromise[_0xec8c('0x20')](_0x4b1197);}return _0x526566[_0xec8c('0x21')]();};}function saveUpdates(_0x630039,_0x26f320){return function(_0x3fd614){if(_0x3fd614){return _0x3fd614[_0xec8c('0x22')](_0x630039)[_0xec8c('0x23')](function(_0x38d1b4){return _0x38d1b4;});}return null;};}function removeEntity(_0x2b1ca0,_0x4758fe){return function(_0x519155){if(_0x519155){return _0x519155['destroy']()['then'](function(){var _0x5bfa7f=_0x519155['get']({'plain':!![]});var _0x1cd4ce=_0xec8c('0x24');return db[_0xec8c('0x25')][_0xec8c('0x26')]({'where':{'type':_0x1cd4ce,'resourceId':_0x5bfa7f['id']}})[_0xec8c('0x23')](function(){return _0x519155;});})['then'](function(){_0x2b1ca0[_0xec8c('0x1c')](0xcc)[_0xec8c('0x17')]();});}};}function handleEntityNotFound(_0x14e781,_0x379c96){return function(_0x263ebf){if(!_0x263ebf){_0x14e781['sendStatus'](0x194);}return _0x263ebf;};}function handleError(_0x21be7a,_0x38f534){_0x38f534=_0x38f534||0x1f4;return function(_0x596d19){logger[_0xec8c('0x27')](_0x596d19[_0xec8c('0x28')]);if(_0x596d19[_0xec8c('0x29')]){delete _0x596d19['name'];}_0x21be7a[_0xec8c('0x1c')](_0x38f534)[_0xec8c('0x2a')](_0x596d19);};}exports[_0xec8c('0x2b')]=function(_0x506fae,_0x116369){var _0x1e578a={},_0x591c2d={},_0x408e7e={'count':0x0,'rows':[]};var _0x47ce0a=_[_0xec8c('0x2c')](db['Schedule'][_0xec8c('0x2d')],function(_0x4cf0f3){return{'name':_0x4cf0f3[_0xec8c('0x2e')],'type':_0x4cf0f3[_0xec8c('0x2f')][_0xec8c('0x30')]};});_0x591c2d[_0xec8c('0x31')]=_['map'](_0x47ce0a,_0xec8c('0x29'));_0x591c2d[_0xec8c('0x32')]=_[_0xec8c('0x33')](_0x506fae[_0xec8c('0x32')]);_0x591c2d[_0xec8c('0x34')]=_[_0xec8c('0x35')](_0x591c2d[_0xec8c('0x31')],_0x591c2d[_0xec8c('0x32')]);_0x1e578a[_0xec8c('0x36')]=_[_0xec8c('0x35')](_0x591c2d[_0xec8c('0x31')],qs[_0xec8c('0x37')](_0x506fae[_0xec8c('0x32')][_0xec8c('0x37')]));_0x1e578a[_0xec8c('0x36')]=_0x1e578a[_0xec8c('0x36')][_0xec8c('0x38')]?_0x1e578a[_0xec8c('0x36')]:_0x591c2d[_0xec8c('0x31')];if(!_0x506fae[_0xec8c('0x32')][_0xec8c('0x39')]('nolimit')){_0x1e578a[_0xec8c('0x3a')]=qs[_0xec8c('0x3a')](_0x506fae[_0xec8c('0x32')][_0xec8c('0x3a')]);_0x1e578a[_0xec8c('0x19')]=qs[_0xec8c('0x19')](_0x506fae[_0xec8c('0x32')][_0xec8c('0x19')]);}_0x1e578a[_0xec8c('0x3b')]=qs['sort'](_0x506fae['query'][_0xec8c('0x3c')]);_0x1e578a[_0xec8c('0x3d')]=qs['filters'](_[_0xec8c('0x3e')](_0x506fae[_0xec8c('0x32')],_0x591c2d[_0xec8c('0x34')]),_0x47ce0a);if(_0x506fae[_0xec8c('0x32')][_0xec8c('0x3f')]){_0x1e578a[_0xec8c('0x3d')]=_['merge'](_0x1e578a[_0xec8c('0x3d')],{'$or':_['map'](_0x47ce0a,function(_0x3f9233){if(_0x3f9233[_0xec8c('0x2f')]!==_0xec8c('0x40')){var _0x262e28={};_0x262e28[_0x3f9233[_0xec8c('0x29')]]={'$like':'%'+_0x506fae[_0xec8c('0x32')]['filter']+'%'};return _0x262e28;}})});}_0x1e578a=_[_0xec8c('0x41')]({},_0x1e578a,_0x506fae[_0xec8c('0x42')]);var _0x34e83e={'where':_0x1e578a[_0xec8c('0x3d')]};return db['Schedule'][_0xec8c('0x1b')](_0x34e83e)[_0xec8c('0x23')](function(_0x51ff8e){_0x408e7e['count']=_0x51ff8e;if(_0x506fae[_0xec8c('0x32')][_0xec8c('0x43')]){_0x1e578a[_0xec8c('0x44')]=[{'all':!![]}];}return db[_0xec8c('0x45')]['findAll'](_0x1e578a);})['then'](function(_0x25e112){_0x408e7e[_0xec8c('0x46')]=_0x25e112;return _0x408e7e;})[_0xec8c('0x23')](respondWithFilteredResult(_0x116369,_0x1e578a))['catch'](handleError(_0x116369,null));};exports['show']=function(_0x25cef0,_0x3e676b){var _0x5cc122={'raw':![],'where':{'id':_0x25cef0[_0xec8c('0x47')]['id']}},_0x34234b={};_0x34234b[_0xec8c('0x31')]=_[_0xec8c('0x33')](db[_0xec8c('0x45')][_0xec8c('0x2d')]);_0x34234b['query']=_[_0xec8c('0x33')](_0x25cef0[_0xec8c('0x32')]);_0x34234b['filters']=_['intersection'](_0x34234b[_0xec8c('0x31')],_0x34234b[_0xec8c('0x32')]);_0x5cc122[_0xec8c('0x36')]=_[_0xec8c('0x35')](_0x34234b[_0xec8c('0x31')],qs['fields'](_0x25cef0['query'][_0xec8c('0x37')]));_0x5cc122[_0xec8c('0x36')]=_0x5cc122['attributes'][_0xec8c('0x38')]?_0x5cc122[_0xec8c('0x36')]:_0x34234b['model'];if(_0x25cef0[_0xec8c('0x32')][_0xec8c('0x43')]){_0x5cc122['include']=[{'all':!![]}];}_0x5cc122=_['merge']({},_0x5cc122,_0x25cef0['options']);return db['Schedule'][_0xec8c('0x48')](_0x5cc122)[_0xec8c('0x23')](handleEntityNotFound(_0x3e676b,null))[_0xec8c('0x23')](respondWithResult(_0x3e676b,null))[_0xec8c('0x49')](handleError(_0x3e676b,null));};exports[_0xec8c('0x4a')]=function(_0x3d6ac2,_0x226536){return db[_0xec8c('0x45')][_0xec8c('0x4a')](_0x3d6ac2['body'],{})[_0xec8c('0x23')](function(_0x5c2f8c){var _0x88d7c8=_0x3d6ac2['user'][_0xec8c('0x4b')]({'plain':!![]});if(!_0x88d7c8)throw new Error(_0xec8c('0x4c'));if(_0x88d7c8['role']===_0xec8c('0x4d')){var _0x4be530=_0x5c2f8c[_0xec8c('0x4b')]({'plain':!![]});var _0x551c4d=_0xec8c('0x24');return db[_0xec8c('0x4e')][_0xec8c('0x48')]({'where':{'name':_0x551c4d,'userProfileId':_0x88d7c8[_0xec8c('0x4f')]},'raw':!![]})[_0xec8c('0x23')](function(_0x559691){if(_0x559691&&_0x559691[_0xec8c('0x50')]===0x0){return db['UserProfileResource'][_0xec8c('0x4a')]({'name':_0x4be530[_0xec8c('0x29')],'resourceId':_0x4be530['id'],'type':_0x559691['name'],'sectionId':_0x559691['id']},{})[_0xec8c('0x23')](function(){return _0x5c2f8c;});}else{return _0x5c2f8c;}})[_0xec8c('0x49')](function(_0xb76db){logger[_0xec8c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb76db);throw _0xb76db;});}return _0x5c2f8c;})['then'](respondWithResult(_0x226536,0xc9))[_0xec8c('0x49')](handleError(_0x226536,null));};exports[_0xec8c('0x22')]=function(_0x130022,_0x296212){if(_0x130022[_0xec8c('0x51')]['id']){delete _0x130022[_0xec8c('0x51')]['id'];}return db[_0xec8c('0x45')]['find']({'where':{'id':_0x130022[_0xec8c('0x47')]['id']}})[_0xec8c('0x23')](handleEntityNotFound(_0x296212,null))[_0xec8c('0x23')](saveUpdates(_0x130022[_0xec8c('0x51')],null))[_0xec8c('0x23')](respondWithResult(_0x296212,null))[_0xec8c('0x49')](handleError(_0x296212,null));};exports[_0xec8c('0x26')]=function(_0x40402a,_0x24348d){return db[_0xec8c('0x45')]['find']({'where':{'id':_0x40402a['params']['id']}})['then'](handleEntityNotFound(_0x24348d,null))[_0xec8c('0x23')](removeEntity(_0x24348d,null))[_0xec8c('0x49')](handleError(_0x24348d,null));};exports[_0xec8c('0x52')]=function(_0x4bc028,_0x32ecb0,_0x673393){var _0x3ade11=require(_0xec8c('0x53'));return db[_0xec8c('0x45')][_0xec8c('0x48')]({'where':{'id':_0x4bc028[_0xec8c('0x47')]['id']},'raw':!![]})[_0xec8c('0x23')](handleEntityNotFound(_0x32ecb0,null))[_0xec8c('0x23')](function(){_0x3ade11[_0xec8c('0x52')](_0x4bc028[_0xec8c('0x47')]['id']);})[_0xec8c('0x23')](respondWithStatusCode(_0x32ecb0,null))[_0xec8c('0x49')](handleError(_0x32ecb0,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7ec7f14..c35f826 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 _0x9ec6=['path','rimraf','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x9ec6,0x73));var _0x69ec=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x9ec6[_0x54b062];return _0x255e41;};'use strict';var _=require(_0x69ec('0x0'));var util=require(_0x69ec('0x1'));var logger=require(_0x69ec('0x2'))(_0x69ec('0x3'));var moment=require(_0x69ec('0x4'));var BPromise=require(_0x69ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69ec('0x6'));var rimraf=require(_0x69ec('0x7'));var config=require('../../config/environment');var attributes=require(_0x69ec('0x8'));module[_0x69ec('0x9')]=function(_0x4462fb,_0x2612f9){return _0x4462fb['define'](_0x69ec('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d83=['Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d83,0xf0));var _0x36d8=function(_0x3446af,_0x3b2f92){_0x3446af=_0x3446af-0x0;var _0x252b14=_0x6d83[_0x3446af];return _0x252b14;};'use strict';var _=require(_0x36d8('0x0'));var util=require(_0x36d8('0x1'));var logger=require(_0x36d8('0x2'))(_0x36d8('0x3'));var moment=require(_0x36d8('0x4'));var BPromise=require(_0x36d8('0x5'));var rp=require(_0x36d8('0x6'));var fs=require('fs');var path=require(_0x36d8('0x7'));var rimraf=require(_0x36d8('0x8'));var config=require(_0x36d8('0x9'));var attributes=require(_0x36d8('0xa'));module[_0x36d8('0xb')]=function(_0x12c650,_0x22fe6c){return _0x12c650['define'](_0x36d8('0xc'),attributes,{'tableName':_0x36d8('0xd'),'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 e650c1a..7f0a387 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 _0xd6a2=['rpc','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3b8d7b,_0x39001c){var _0xccee16=function(_0x44b2cd){while(--_0x44b2cd){_0x3b8d7b['push'](_0x3b8d7b['shift']());}};_0xccee16(++_0x39001c);}(_0xd6a2,0xea));var _0x2d6a=function(_0x4592d0,_0x3651b3){_0x4592d0=_0x4592d0-0x0;var _0x3df4f3=_0xd6a2[_0x4592d0];return _0x3df4f3;};'use strict';var _=require(_0x2d6a('0x0'));var util=require(_0x2d6a('0x1'));var moment=require(_0x2d6a('0x2'));var BPromise=require(_0x2d6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d6a('0x4'))['db'];var utils=require(_0x2d6a('0x5'));var logger=require('../../config/logger')(_0x2d6a('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d6a('0x7'));var client=jayson[_0x2d6a('0x8')][_0x2d6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53f9e5,_0x404245,_0x78348){return new BPromise(function(_0x244de8,_0x5ca634){return client['request'](_0x53f9e5,_0x78348)[_0x2d6a('0xa')](function(_0x365788){logger[_0x2d6a('0xb')](_0x2d6a('0xc'),_0x404245,_0x2d6a('0xd'));logger[_0x2d6a('0xe')](_0x2d6a('0xf'),_0x404245,'request\x20sent',JSON[_0x2d6a('0x10')](_0x365788));if(_0x365788['error']){if(_0x365788[_0x2d6a('0x11')]['code']===0x1f4){logger['error'](_0x2d6a('0xc'),_0x404245,_0x365788['error'][_0x2d6a('0x12')]);return _0x5ca634(_0x365788[_0x2d6a('0x11')][_0x2d6a('0x12')]);}logger[_0x2d6a('0x11')](_0x2d6a('0xc'),_0x404245,_0x365788[_0x2d6a('0x11')]['message']);return _0x244de8(_0x365788[_0x2d6a('0x11')][_0x2d6a('0x12')]);}else{logger[_0x2d6a('0xb')](_0x2d6a('0xc'),_0x404245,_0x2d6a('0xd'));_0x244de8(_0x365788[_0x2d6a('0x13')][_0x2d6a('0x12')]);}})['catch'](function(_0x485b81){logger[_0x2d6a('0x11')](_0x2d6a('0xc'),_0x404245,_0x485b81);_0x5ca634(_0x485b81);});});} \ No newline at end of file +var _0x5822=['rpc','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5822,0x1f1));var _0x2582=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x5822[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0x2582('0x0'));var util=require(_0x2582('0x1'));var moment=require('moment');var BPromise=require(_0x2582('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2582('0x3'));var db=require(_0x2582('0x4'))['db'];var utils=require(_0x2582('0x5'));var logger=require(_0x2582('0x6'))(_0x2582('0x7'));var config=require('../../config/environment');var jayson=require(_0x2582('0x8'));var client=jayson[_0x2582('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4720f1,_0x3fda00,_0x2260f3){return new BPromise(function(_0x4346b8,_0x2fe27e){return client['request'](_0x4720f1,_0x2260f3)[_0x2582('0xa')](function(_0x59ca07){logger[_0x2582('0xb')](_0x2582('0xc'),_0x3fda00,_0x2582('0xd'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x3fda00,_0x2582('0xd'),JSON['stringify'](_0x59ca07));if(_0x59ca07[_0x2582('0xe')]){if(_0x59ca07['error'][_0x2582('0xf')]===0x1f4){logger[_0x2582('0xe')](_0x2582('0xc'),_0x3fda00,_0x59ca07[_0x2582('0xe')][_0x2582('0x10')]);return _0x2fe27e(_0x59ca07['error']['message']);}logger[_0x2582('0xe')]('Schedule,\x20%s,\x20%s',_0x3fda00,_0x59ca07['error'][_0x2582('0x10')]);return _0x4346b8(_0x59ca07[_0x2582('0xe')][_0x2582('0x10')]);}else{logger[_0x2582('0xb')]('Schedule,\x20%s,\x20%s',_0x3fda00,_0x2582('0xd'));_0x4346b8(_0x59ca07[_0x2582('0x11')]['message']);}})['catch'](function(_0x479b34){logger['error'](_0x2582('0xc'),_0x3fda00,_0x479b34);_0x2fe27e(_0x479b34);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 57469d9..63a7405 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 _0x2500=['fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0xc14968,_0x1dd94d){var _0x26b15b=function(_0x8c41b2){while(--_0x8c41b2){_0xc14968['push'](_0xc14968['shift']());}};_0x26b15b(++_0x1dd94d);}(_0x2500,0x12d));var _0x0250=function(_0x236654,_0x16e44f){_0x236654=_0x236654-0x0;var _0x27653b=_0x2500[_0x236654];return _0x27653b;};'use strict';var multer=require(_0x0250('0x0'));var util=require('util');var path=require(_0x0250('0x1'));var timeout=require(_0x0250('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0250('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0250('0x4'));var config=require('../../config/environment');var controller=require(_0x0250('0x5'));router[_0x0250('0x6')]('/',auth[_0x0250('0x7')](),controller['index']);router[_0x0250('0x6')](_0x0250('0x8'),auth[_0x0250('0x7')](),controller[_0x0250('0x9')]);router[_0x0250('0x6')](_0x0250('0xa'),auth['isAuthenticated'](),controller[_0x0250('0xb')]);router[_0x0250('0x6')](_0x0250('0xc'),auth[_0x0250('0x7')](),controller[_0x0250('0xd')]);router[_0x0250('0xe')]('/',auth['isAuthenticated'](),controller[_0x0250('0xf')]);router[_0x0250('0x10')](_0x0250('0xa'),auth[_0x0250('0x7')](),controller['update']);router[_0x0250('0x11')](_0x0250('0xa'),auth['isAuthenticated'](),controller[_0x0250('0x12')]);module['exports']=router; \ No newline at end of file +var _0x20a3=['post','put','/:id','update','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','show','/:id/download'];(function(_0x43aa52,_0x511590){var _0x341c17=function(_0x2d9836){while(--_0x2d9836){_0x43aa52['push'](_0x43aa52['shift']());}};_0x341c17(++_0x511590);}(_0x20a3,0x15b));var _0x320a=function(_0x5bd1f8,_0x1724cd){_0x5bd1f8=_0x5bd1f8-0x0;var _0x5c4987=_0x20a3[_0x5bd1f8];return _0x5c4987;};'use strict';var multer=require(_0x320a('0x0'));var util=require('util');var path=require(_0x320a('0x1'));var timeout=require(_0x320a('0x2'));var express=require(_0x320a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x320a('0x4'));var config=require(_0x320a('0x5'));var controller=require(_0x320a('0x6'));router[_0x320a('0x7')]('/',auth[_0x320a('0x8')](),controller[_0x320a('0x9')]);router['get']('/describe',auth[_0x320a('0x8')](),controller[_0x320a('0xa')]);router[_0x320a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x320a('0xb')]);router['get'](_0x320a('0xc'),auth[_0x320a('0x8')](),controller['download']);router[_0x320a('0xd')]('/',auth[_0x320a('0x8')](),controller['create']);router[_0x320a('0xe')](_0x320a('0xf'),auth[_0x320a('0x8')](),controller[_0x320a('0x10')]);router['delete'](_0x320a('0xf'),auth[_0x320a('0x8')](),controller[_0x320a('0x11')]);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 f5c5a10..eae1661 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 _0x10ad=['duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10ad,0xf4));var _0xd10a=function(_0x43f7eb,_0x4919a6){_0x43f7eb=_0x43f7eb-0x0;var _0x2800b6=_0x10ad[_0x43f7eb];return _0x2800b6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');var config=require(_0xd10a('0x0'));module['exports']={'format':{'type':Sequelize[_0xd10a('0x1')],'get':function(){return this[_0xd10a('0x2')](_0xd10a('0x3'))?path[_0xd10a('0x4')](this['getDataValue'](_0xd10a('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0xd10a('0x5')]},'channel':{'type':Sequelize[_0xd10a('0x5')]},'value':{'type':Sequelize[_0xd10a('0x5')],'set':function(_0x429316){var _0xdae354=_0x429316[_0xd10a('0x6')](/\\/g,'/');this[_0xd10a('0x7')]('value',_0xdae354);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd10a('0x8')],'set':function(_0x4d8613){this[_0xd10a('0x7')](_0xd10a('0x9'),moment()[_0xd10a('0xa')](_0x4d8613,'ms'));this[_0xd10a('0x7')]('closedAt',moment());this[_0xd10a('0x7')](_0xd10a('0xb'),_0x4d8613);}},'startedAt':{'type':Sequelize[_0xd10a('0xc')],'get':function(){return moment(this['getDataValue'](_0xd10a('0x9')))[_0xd10a('0xd')](_0xd10a('0xe'))[_0xd10a('0xf')]();}},'closedAt':{'type':Sequelize[_0xd10a('0xc')],'get':function(){return moment(this[_0xd10a('0x2')]('closedAt'))['format'](_0xd10a('0xe'))[_0xd10a('0xf')]();}},'createdAt':{'type':Sequelize[_0xd10a('0xc')],'get':function(){return moment(this[_0xd10a('0x2')]('createdAt'))['format'](_0xd10a('0xe'))[_0xd10a('0xf')]();}},'updatedAt':{'type':Sequelize[_0xd10a('0xc')],'get':function(){return moment(this[_0xd10a('0x2')](_0xd10a('0x10')))[_0xd10a('0xd')](_0xd10a('0xe'))[_0xd10a('0xf')]();}}}; \ No newline at end of file +var _0x6fad=['path','../../config/environment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','format','sequelize','moment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x6fad,0x17a));var _0xd6fa=function(_0x1c6664,_0x45566e){_0x1c6664=_0x1c6664-0x0;var _0x33124b=_0x6fad[_0x1c6664];return _0x33124b;};'use strict';var Sequelize=require(_0xd6fa('0x0'));var moment=require(_0xd6fa('0x1'));var path=require(_0xd6fa('0x2'));var config=require(_0xd6fa('0x3'));module[_0xd6fa('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd6fa('0x5')]('value')?path[_0xd6fa('0x6')](this['getDataValue'](_0xd6fa('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd6fa('0x8')]},'value':{'type':Sequelize[_0xd6fa('0x8')],'set':function(_0x2ed68a){var _0x1d5e36=_0x2ed68a[_0xd6fa('0x9')](/\\/g,'/');this[_0xd6fa('0xa')](_0xd6fa('0x7'),_0x1d5e36);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd6fa('0xb')],'set':function(_0x48092f){this[_0xd6fa('0xa')](_0xd6fa('0xc'),moment()[_0xd6fa('0xd')](_0x48092f,'ms'));this[_0xd6fa('0xa')](_0xd6fa('0xe'),moment());this['setDataValue']('duration',_0x48092f);}},'startedAt':{'type':Sequelize[_0xd6fa('0xf')],'get':function(){return moment(this[_0xd6fa('0x5')](_0xd6fa('0xc')))['format'](_0xd6fa('0x10'))[_0xd6fa('0x11')]();}},'closedAt':{'type':Sequelize[_0xd6fa('0xf')],'get':function(){return moment(this[_0xd6fa('0x5')](_0xd6fa('0xe')))[_0xd6fa('0x12')](_0xd6fa('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xd6fa('0xf')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xd6fa('0x12')](_0xd6fa('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xd6fa('0xf')],'get':function(){return moment(this[_0xd6fa('0x5')]('updatedAt'))[_0xd6fa('0x12')](_0xd6fa('0x10'))[_0xd6fa('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1e36b9a..2ab9b9a 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 _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x0e85,0x7c));var _0x50e8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0e85[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file +var _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x5be2f0,_0x60d4ef){var _0x5cd369=function(_0x374989){while(--_0x374989){_0x5be2f0['push'](_0x5be2f0['shift']());}};_0x5cd369(++_0x60d4ef);}(_0x4b84,0x1cc));var _0x44b8=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0x4b84[_0x292423];return _0x2801cb;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 06a7609..715d35a 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 _0xbda3=['api','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util'];(function(_0x2179f2,_0x2dff7c){var _0x236d1b=function(_0x3a0e47){while(--_0x3a0e47){_0x2179f2['push'](_0x2179f2['shift']());}};_0x236d1b(++_0x2dff7c);}(_0xbda3,0x11e));var _0x3bda=function(_0x587a0f,_0x697755){_0x587a0f=_0x587a0f-0x0;var _0x24ccc5=_0xbda3[_0x587a0f];return _0x24ccc5;};'use strict';var _=require(_0x3bda('0x0'));var util=require(_0x3bda('0x1'));var logger=require('../../config/logger')(_0x3bda('0x2'));var moment=require('moment');var BPromise=require(_0x3bda('0x3'));var rp=require(_0x3bda('0x4'));var fs=require('fs');var path=require(_0x3bda('0x5'));var rimraf=require(_0x3bda('0x6'));var config=require('../../config/environment');var attributes=require(_0x3bda('0x7'));module[_0x3bda('0x8')]=function(_0x487b96,_0x569fb5){return _0x487b96[_0x3bda('0x9')](_0x3bda('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x3bda('0xb'),'fields':[_0x3bda('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17cf=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api'];(function(_0x376760,_0x37043e){var _0x22c0f3=function(_0x4bb6d5){while(--_0x4bb6d5){_0x376760['push'](_0x376760['shift']());}};_0x22c0f3(++_0x37043e);}(_0x17cf,0x190));var _0xf17c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x17cf[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xf17c('0x0'));var logger=require(_0xf17c('0x1'))(_0xf17c('0x2'));var moment=require('moment');var BPromise=require(_0xf17c('0x3'));var rp=require(_0xf17c('0x4'));var fs=require('fs');var path=require(_0xf17c('0x5'));var rimraf=require(_0xf17c('0x6'));var config=require(_0xf17c('0x7'));var attributes=require(_0xf17c('0x8'));module['exports']=function(_0x1e98ab,_0x1195ff){return _0x1e98ab[_0xf17c('0x9')](_0xf17c('0xa'),attributes,{'tableName':_0xf17c('0xb'),'paranoid':![],'indexes':[{'name':_0xf17c('0xc'),'fields':[_0xf17c('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 2ac8597..de8f7cf 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 _0x0380=['ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ScreenRecording,\x20%s,\x20%s','debug'];(function(_0x42168c,_0x54a3c4){var _0x1095db=function(_0x351e7d){while(--_0x351e7d){_0x42168c['push'](_0x42168c['shift']());}};_0x1095db(++_0x54a3c4);}(_0x0380,0xb7));var _0x0038=function(_0x5c51d7,_0x45a85d){_0x5c51d7=_0x5c51d7-0x0;var _0xf3b7e5=_0x0380[_0x5c51d7];return _0xf3b7e5;};'use strict';var _=require(_0x0038('0x0'));var util=require(_0x0038('0x1'));var moment=require(_0x0038('0x2'));var BPromise=require(_0x0038('0x3'));var rs=require(_0x0038('0x4'));var fs=require('fs');var Redis=require(_0x0038('0x5'));var db=require(_0x0038('0x6'))['db'];var utils=require(_0x0038('0x7'));var logger=require(_0x0038('0x8'))(_0x0038('0x9'));var config=require(_0x0038('0xa'));var jayson=require(_0x0038('0xb'));var client=jayson[_0x0038('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x177a5c,_0x6f87ea,_0x14101c){return new BPromise(function(_0x33ea32,_0x3d5b94){return client[_0x0038('0xd')](_0x177a5c,_0x14101c)[_0x0038('0xe')](function(_0x2741e9){logger['info'](_0x0038('0xf'),_0x6f87ea,'request\x20sent');logger[_0x0038('0x10')](_0x0038('0x11'),_0x6f87ea,_0x0038('0x12'),JSON[_0x0038('0x13')](_0x2741e9));if(_0x2741e9['error']){if(_0x2741e9[_0x0038('0x14')][_0x0038('0x15')]===0x1f4){logger[_0x0038('0x14')](_0x0038('0xf'),_0x6f87ea,_0x2741e9[_0x0038('0x14')][_0x0038('0x16')]);return _0x3d5b94(_0x2741e9[_0x0038('0x14')]['message']);}logger[_0x0038('0x14')](_0x0038('0xf'),_0x6f87ea,_0x2741e9[_0x0038('0x14')][_0x0038('0x16')]);return _0x33ea32(_0x2741e9[_0x0038('0x14')][_0x0038('0x16')]);}else{logger[_0x0038('0x17')](_0x0038('0xf'),_0x6f87ea,_0x0038('0x12'));_0x33ea32(_0x2741e9['result'][_0x0038('0x16')]);}})[_0x0038('0x18')](function(_0x341912){logger[_0x0038('0x14')](_0x0038('0xf'),_0x6f87ea,_0x341912);_0x3d5b94(_0x341912);});});} \ No newline at end of file +var _0x27cf=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0xf1977b,_0x5ad435){var _0x2ee274=function(_0x538b5c){while(--_0x538b5c){_0xf1977b['push'](_0xf1977b['shift']());}};_0x2ee274(++_0x5ad435);}(_0x27cf,0x169));var _0xf27c=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x27cf[_0x3ea913];return _0x2b4f28;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf27c('0x0'));var BPromise=require('bluebird');var rs=require(_0xf27c('0x1'));var fs=require('fs');var Redis=require(_0xf27c('0x2'));var db=require(_0xf27c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf27c('0x4'));var config=require(_0xf27c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf27c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x598fae,_0x1cc9d3,_0x1a9a3e){return new BPromise(function(_0x428975,_0x4b6b4d){return client[_0xf27c('0x7')](_0x598fae,_0x1a9a3e)[_0xf27c('0x8')](function(_0x5d0e19){logger[_0xf27c('0x9')](_0xf27c('0xa'),_0x1cc9d3,'request\x20sent');logger['debug'](_0xf27c('0xb'),_0x1cc9d3,'request\x20sent',JSON[_0xf27c('0xc')](_0x5d0e19));if(_0x5d0e19[_0xf27c('0xd')]){if(_0x5d0e19[_0xf27c('0xd')][_0xf27c('0xe')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x1cc9d3,_0x5d0e19['error']['message']);return _0x4b6b4d(_0x5d0e19[_0xf27c('0xd')][_0xf27c('0xf')]);}logger[_0xf27c('0xd')](_0xf27c('0xa'),_0x1cc9d3,_0x5d0e19[_0xf27c('0xd')]['message']);return _0x428975(_0x5d0e19['error'][_0xf27c('0xf')]);}else{logger[_0xf27c('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x1cc9d3,_0xf27c('0x10'));_0x428975(_0x5d0e19[_0xf27c('0x11')][_0xf27c('0xf')]);}})[_0xf27c('0x12')](function(_0x6fe813){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x1cc9d3,_0x6fe813);_0x4b6b4d(_0x6fe813);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7b6457a..9bd24ad 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 _0xfd3d=['diskStorage','join','root','extname','originalname','post','single','file','addLogo','server/files/images/logos/','format','%s%s','logologin','preferred','addPreferred','favicon','put','/:id','isAuthenticated','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x38b9af,_0x30a6ed){var _0x521fa4=function(_0x4d69ac){while(--_0x4d69ac){_0x38b9af['push'](_0x38b9af['shift']());}};_0x521fa4(++_0x30a6ed);}(_0xfd3d,0x15d));var _0xdfd3=function(_0x39b245,_0x540f57){_0x39b245=_0x39b245-0x0;var _0x31c44d=_0xfd3d[_0x39b245];return _0x31c44d;};'use strict';var multer=require(_0xdfd3('0x0'));var util=require(_0xdfd3('0x1'));var path=require(_0xdfd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xdfd3('0x3'));var router=express[_0xdfd3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdfd3('0x5'));var interaction=require(_0xdfd3('0x6'));var config=require('../../config/environment');var controller=require(_0xdfd3('0x7'));router[_0xdfd3('0x8')]('/',auth['isAuthenticated'](),controller[_0xdfd3('0x9')]);router[_0xdfd3('0x8')]('/now',controller[_0xdfd3('0xa')]);router[_0xdfd3('0x8')]('/:id',controller['show']);router[_0xdfd3('0x8')](_0xdfd3('0xb'),controller[_0xdfd3('0xc')]);router[_0xdfd3('0x8')](_0xdfd3('0xd'),controller[_0xdfd3('0xe')]);router[_0xdfd3('0x8')]('/:id/gdpr',controller[_0xdfd3('0xf')]);router[_0xdfd3('0x8')](_0xdfd3('0x10'),controller[_0xdfd3('0x11')]);router[_0xdfd3('0x8')](_0xdfd3('0x12'),controller[_0xdfd3('0x13')]);var upload=multer({'storage':multer[_0xdfd3('0x14')]({'destination':function(_0x3b37ea,_0x58a1dc,_0x5436db){_0x5436db(null,path[_0xdfd3('0x15')](config[_0xdfd3('0x16')],'server/files/images/logos/'));},'filename':function(_0x41b42f,_0x29f3d3,_0x428bce){_0x428bce(null,util['format']('%s%s','logo',path[_0xdfd3('0x17')](_0x29f3d3[_0xdfd3('0x18')])));}})});router[_0xdfd3('0x19')]('/:id/logo',upload[_0xdfd3('0x1a')](_0xdfd3('0x1b')),controller[_0xdfd3('0x1c')]);var upload=multer({'storage':multer[_0xdfd3('0x14')]({'destination':function(_0x533ec2,_0x4090f0,_0xd92a21){_0xd92a21(null,path[_0xdfd3('0x15')](config[_0xdfd3('0x16')],_0xdfd3('0x1d')));},'filename':function(_0x115443,_0x168104,_0xaab7bd){_0xaab7bd(null,util[_0xdfd3('0x1e')](_0xdfd3('0x1f'),_0xdfd3('0x20'),path[_0xdfd3('0x17')](_0x168104[_0xdfd3('0x18')])));}})});router[_0xdfd3('0x19')](_0xdfd3('0xd'),upload[_0xdfd3('0x1a')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xdfd3('0x14')]({'destination':function(_0x2e8cca,_0x21b61c,_0x59ef85){_0x59ef85(null,path[_0xdfd3('0x15')](config['root'],_0xdfd3('0x1d')));},'filename':function(_0x211460,_0x4a5b51,_0x4153ee){_0x4153ee(null,util[_0xdfd3('0x1e')]('%s%s',_0xdfd3('0x21'),path['extname'](_0x4a5b51[_0xdfd3('0x18')])));}})});router[_0xdfd3('0x19')]('/:id/preferred',upload[_0xdfd3('0x1a')](_0xdfd3('0x1b')),controller[_0xdfd3('0x22')]);var upload=multer({'storage':multer[_0xdfd3('0x14')]({'destination':function(_0x372926,_0x3f6495,_0x7a77f2){_0x7a77f2(null,path['join'](config[_0xdfd3('0x16')],'server/files/images/logos/'));},'filename':function(_0x1ed0f6,_0x1e7ee6,_0x39445a){_0x39445a(null,util['format'](_0xdfd3('0x1f'),_0xdfd3('0x23'),path[_0xdfd3('0x17')](_0x1e7ee6[_0xdfd3('0x18')])));}})});router['post']('/:id/favicon',upload[_0xdfd3('0x1a')](_0xdfd3('0x1b')),controller['addFavicon']);router[_0xdfd3('0x24')](_0xdfd3('0x25'),auth[_0xdfd3('0x26')](),controller[_0xdfd3('0x27')]);module[_0xdfd3('0x28')]=router; \ No newline at end of file +var _0xf8ef=['gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','addLogo','server/files/images/logos/','file','addLogoLogin','addPreferred','favicon','/:id/favicon','put','/:id','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/now','getDate','show','get','/:id/logo','/:id/logo_login','getLogoLogin'];(function(_0x138b7f,_0x1c1663){var _0xa24ace=function(_0x3690e5){while(--_0x3690e5){_0x138b7f['push'](_0x138b7f['shift']());}};_0xa24ace(++_0x1c1663);}(_0xf8ef,0x1e6));var _0xff8e=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0xf8ef[_0x132d9e];return _0x40b733;};'use strict';var multer=require(_0xff8e('0x0'));var util=require(_0xff8e('0x1'));var path=require(_0xff8e('0x2'));var timeout=require(_0xff8e('0x3'));var express=require('express');var router=express[_0xff8e('0x4')]();var fs_extra=require(_0xff8e('0x5'));var auth=require(_0xff8e('0x6'));var interaction=require(_0xff8e('0x7'));var config=require(_0xff8e('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0xff8e('0x9')](),controller[_0xff8e('0xa')]);router['get'](_0xff8e('0xb'),controller[_0xff8e('0xc')]);router['get']('/:id',controller[_0xff8e('0xd')]);router[_0xff8e('0xe')](_0xff8e('0xf'),controller['getLogo']);router[_0xff8e('0xe')](_0xff8e('0x10'),controller[_0xff8e('0x11')]);router['get']('/:id/gdpr',controller[_0xff8e('0x12')]);router[_0xff8e('0xe')](_0xff8e('0x13'),controller[_0xff8e('0x14')]);router[_0xff8e('0xe')]('/:id/favicon',controller[_0xff8e('0x15')]);var upload=multer({'storage':multer[_0xff8e('0x16')]({'destination':function(_0x512202,_0x56efb9,_0x3b76e9){_0x3b76e9(null,path[_0xff8e('0x17')](config[_0xff8e('0x18')],'server/files/images/logos/'));},'filename':function(_0x499049,_0x125673,_0xde4bd2){_0xde4bd2(null,util[_0xff8e('0x19')](_0xff8e('0x1a'),_0xff8e('0x1b'),path[_0xff8e('0x1c')](_0x125673[_0xff8e('0x1d')])));}})});router[_0xff8e('0x1e')](_0xff8e('0xf'),upload[_0xff8e('0x1f')]('file'),controller[_0xff8e('0x20')]);var upload=multer({'storage':multer[_0xff8e('0x16')]({'destination':function(_0x453e4b,_0x561e7d,_0x2a6893){_0x2a6893(null,path['join'](config[_0xff8e('0x18')],_0xff8e('0x21')));},'filename':function(_0x2e2f3e,_0x15008c,_0x1060b9){_0x1060b9(null,util[_0xff8e('0x19')](_0xff8e('0x1a'),'logologin',path[_0xff8e('0x1c')](_0x15008c[_0xff8e('0x1d')])));}})});router['post'](_0xff8e('0x10'),upload[_0xff8e('0x1f')](_0xff8e('0x22')),controller[_0xff8e('0x23')]);var upload=multer({'storage':multer[_0xff8e('0x16')]({'destination':function(_0xbd44fd,_0x295af5,_0x5cca61){_0x5cca61(null,path[_0xff8e('0x17')](config[_0xff8e('0x18')],_0xff8e('0x21')));},'filename':function(_0x566c6f,_0x23278a,_0x30aae3){_0x30aae3(null,util['format'](_0xff8e('0x1a'),'preferred',path[_0xff8e('0x1c')](_0x23278a[_0xff8e('0x1d')])));}})});router[_0xff8e('0x1e')](_0xff8e('0x13'),upload[_0xff8e('0x1f')](_0xff8e('0x22')),controller[_0xff8e('0x24')]);var upload=multer({'storage':multer[_0xff8e('0x16')]({'destination':function(_0x1bee4a,_0x4aebdc,_0x1e82a3){_0x1e82a3(null,path[_0xff8e('0x17')](config[_0xff8e('0x18')],_0xff8e('0x21')));},'filename':function(_0x41e200,_0x2f3778,_0x26f830){_0x26f830(null,util[_0xff8e('0x19')](_0xff8e('0x1a'),_0xff8e('0x25'),path[_0xff8e('0x1c')](_0x2f3778[_0xff8e('0x1d')])));}})});router[_0xff8e('0x1e')](_0xff8e('0x26'),upload['single'](_0xff8e('0x22')),controller['addFavicon']);router[_0xff8e('0x27')](_0xff8e('0x28'),auth[_0xff8e('0x9')](),controller[_0xff8e('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 2749042..50ac595 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2b73cc,_0x31232a){var _0x47ed8b=function(_0x2b281){while(--_0x2b281){_0x2b73cc['push'](_0x2b73cc['shift']());}};_0x47ed8b(++_0x31232a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x49b887,_0x216339){var _0x2369e4=function(_0x3e396b){while(--_0x3e396b){_0x49b887['push'](_0x49b887['shift']());}};_0x2369e4(++_0x216339);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9e65af7..fcc98cd 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 _0x863f=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','Setting','then','include','findAll','rows','show','params','includeAll','find','body','file','filename','getLogo','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','toLower','join','root','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','download','getLogoLogin','loginLogo','preferred','defaultPreferred','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5e34a4,_0x2e63ed){var _0x8d41d7=function(_0x45c61b){while(--_0x45c61b){_0x5e34a4['push'](_0x5e34a4['shift']());}};_0x8d41d7(++_0x2e63ed);}(_0x863f,0xda));var _0xf863=function(_0xec33d0,_0x3452c9){_0xec33d0=_0xec33d0-0x0;var _0x1e01bb=_0x863f[_0xec33d0];return _0x1e01bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf863('0x0'));var zipdir=require(_0xf863('0x1'));var jsonpatch=require(_0xf863('0x2'));var rp=require('request-promise');var moment=require(_0xf863('0x3'));var BPromise=require(_0xf863('0x4'));var Mustache=require('mustache');var util=require(_0xf863('0x5'));var path=require(_0xf863('0x6'));var sox=require(_0xf863('0x7'));var csv=require(_0xf863('0x8'));var ejs=require(_0xf863('0x9'));var fs=require('fs');var fs_extra=require(_0xf863('0xa'));var _=require(_0xf863('0xb'));var squel=require(_0xf863('0xc'));var crypto=require('crypto');var jsforce=require(_0xf863('0xd'));var deskjs=require(_0xf863('0xe'));var toCsv=require(_0xf863('0x8'));var querystring=require(_0xf863('0xf'));var Papa=require(_0xf863('0x10'));var Redis=require(_0xf863('0x11'));var authService=require(_0xf863('0x12'));var qs=require(_0xf863('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf863('0x14'));var logger=require(_0xf863('0x15'))('api');var utils=require(_0xf863('0x16'));var config=require(_0xf863('0x17'));var licenseUtil=require(_0xf863('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xf863('0x19')][_0xf863('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1bebd7,_0x3b3c6b,_0x404df8,_0x1af33f){return new BPromise(function(_0x1d9135,_0x42214e){var _0xe48c3f=_0x1af33f||client;return _0xe48c3f[_0xf863('0x1b')](_0x1bebd7,_0x404df8)['then'](function(_0xf0754b){logger[_0xf863('0x1c')](_0xf863('0x1d'),_0x3b3c6b,_0xf863('0x1e'));logger[_0xf863('0x1f')](_0xf863('0x20'),_0x3b3c6b,'request\x20sent',JSON[_0xf863('0x21')](_0xf0754b));if(_0xf0754b[_0xf863('0x22')]){if(_0xf0754b[_0xf863('0x22')][_0xf863('0x23')]===0x1f4){logger[_0xf863('0x22')](_0xf863('0x1d'),_0x3b3c6b,_0xf0754b[_0xf863('0x22')]['message']);return _0x42214e(_0xf0754b[_0xf863('0x22')][_0xf863('0x24')]);}logger[_0xf863('0x22')](_0xf863('0x1d'),_0x3b3c6b,_0xf0754b[_0xf863('0x22')][_0xf863('0x24')]);return _0x1d9135(_0xf0754b['error'][_0xf863('0x24')]);}else{logger[_0xf863('0x1c')](_0xf863('0x1d'),_0x3b3c6b,_0xf863('0x1e'));_0x1d9135(_0xf0754b['result'][_0xf863('0x24')]);}})[_0xf863('0x25')](function(_0x44dc07){logger['error'](_0xf863('0x1d'),_0x3b3c6b,_0x44dc07);_0x42214e(_0x44dc07);});});}function respondWithStatusCode(_0x429c53,_0x446c69){_0x446c69=_0x446c69||0xcc;return function(_0x30cc55){if(_0x30cc55){return _0x429c53[_0xf863('0x26')](_0x446c69);}return _0x429c53[_0xf863('0x27')](_0x446c69)[_0xf863('0x28')]();};}function respondWithResult(_0x46cb29,_0x3a0556){_0x3a0556=_0x3a0556||0xc8;return function(_0x3e78db){if(_0x3e78db){return _0x46cb29[_0xf863('0x27')](_0x3a0556)[_0xf863('0x29')](_0x3e78db);}};}function respondWithFilteredResult(_0xc11b43,_0x10f098){return function(_0x51539d){if(_0x51539d){var _0x57a60e=typeof _0x10f098['offset']===_0xf863('0x2a')&&typeof _0x10f098['limit']===_0xf863('0x2a');var _0x3e4ae6=_0x51539d[_0xf863('0x2b')];var _0x4fc321=_0x57a60e?0x0:_0x10f098[_0xf863('0x2c')];var _0x28520b=_0x57a60e?_0x51539d[_0xf863('0x2b')]:_0x10f098[_0xf863('0x2c')]+_0x10f098[_0xf863('0x2d')];var _0x2607f1;if(_0x28520b>=_0x3e4ae6){_0x28520b=_0x3e4ae6;_0x2607f1=0xc8;}else{_0x2607f1=0xce;}_0xc11b43[_0xf863('0x27')](_0x2607f1);return _0xc11b43[_0xf863('0x2e')](_0xf863('0x2f'),_0x4fc321+'-'+_0x28520b+'/'+_0x3e4ae6)[_0xf863('0x29')](_0x51539d);}return null;};}function patchUpdates(_0x5e5119){return function(_0x780f2b){try{jsonpatch[_0xf863('0x30')](_0x780f2b,_0x5e5119,!![]);}catch(_0x132ae8){return BPromise[_0xf863('0x31')](_0x132ae8);}return _0x780f2b[_0xf863('0x32')]();};}function saveUpdates(_0xc55609,_0x1ee7ac){return function(_0x1ad48f){if(_0x1ad48f){return _0x1ad48f[_0xf863('0x33')](_0xc55609)['then'](function(_0x55c69e){return _0x55c69e;});}return null;};}function removeEntity(_0x3bfb70,_0x2e2a75){return function(_0x8153c0){if(_0x8153c0){return _0x8153c0[_0xf863('0x34')]()['then'](function(){_0x3bfb70[_0xf863('0x27')](0xcc)[_0xf863('0x28')]();});}};}function handleEntityNotFound(_0x53b79d,_0x8e0719){return function(_0x25be47){if(!_0x25be47){_0x53b79d['sendStatus'](0x194);}return _0x25be47;};}function handleError(_0x5308c4,_0x407b05){_0x407b05=_0x407b05||0x1f4;return function(_0x4314dc){logger[_0xf863('0x22')](_0x4314dc[_0xf863('0x35')]);if(_0x4314dc[_0xf863('0x36')]){delete _0x4314dc[_0xf863('0x36')];}_0x5308c4[_0xf863('0x27')](_0x407b05)[_0xf863('0x37')](_0x4314dc);};}exports[_0xf863('0x38')]=function(_0x29ca6b,_0x105f5c){var _0x18ce70={},_0x27f2f9={},_0xddfd28={'count':0x0,'rows':[]};var _0x45b754=_[_0xf863('0x39')](db['Setting'][_0xf863('0x3a')],function(_0x1a7c68){return{'name':_0x1a7c68[_0xf863('0x3b')],'type':_0x1a7c68[_0xf863('0x3c')][_0xf863('0x3d')]};});_0x27f2f9[_0xf863('0x3e')]=_[_0xf863('0x39')](_0x45b754,_0xf863('0x36'));_0x27f2f9[_0xf863('0x3f')]=_[_0xf863('0x40')](_0x29ca6b['query']);_0x27f2f9['filters']=_[_0xf863('0x41')](_0x27f2f9['model'],_0x27f2f9['query']);_0x18ce70[_0xf863('0x42')]=_['intersection'](_0x27f2f9[_0xf863('0x3e')],qs[_0xf863('0x43')](_0x29ca6b[_0xf863('0x3f')][_0xf863('0x43')]));_0x18ce70[_0xf863('0x42')]=_0x18ce70[_0xf863('0x42')][_0xf863('0x44')]?_0x18ce70[_0xf863('0x42')]:_0x27f2f9[_0xf863('0x3e')];if(!_0x29ca6b[_0xf863('0x3f')][_0xf863('0x45')](_0xf863('0x46'))){_0x18ce70[_0xf863('0x2d')]=qs[_0xf863('0x2d')](_0x29ca6b[_0xf863('0x3f')][_0xf863('0x2d')]);_0x18ce70[_0xf863('0x2c')]=qs['offset'](_0x29ca6b[_0xf863('0x3f')]['offset']);}_0x18ce70['order']=qs[_0xf863('0x47')](_0x29ca6b[_0xf863('0x3f')][_0xf863('0x47')]);_0x18ce70[_0xf863('0x48')]=qs[_0xf863('0x49')](_['pick'](_0x29ca6b['query'],_0x27f2f9[_0xf863('0x49')]),_0x45b754);if(_0x29ca6b['query'][_0xf863('0x4a')]){_0x18ce70[_0xf863('0x48')]=_[_0xf863('0x4b')](_0x18ce70['where'],{'$or':_['map'](_0x45b754,function(_0x30aa07){if(_0x30aa07[_0xf863('0x3c')]!==_0xf863('0x4c')){var _0x5df042={};_0x5df042[_0x30aa07['name']]={'$like':'%'+_0x29ca6b['query'][_0xf863('0x4a')]+'%'};return _0x5df042;}})});}_0x18ce70=_[_0xf863('0x4b')]({},_0x18ce70,_0x29ca6b[_0xf863('0x4d')]);var _0x1472a0={'where':_0x18ce70[_0xf863('0x48')]};return db[_0xf863('0x4e')][_0xf863('0x2b')](_0x1472a0)[_0xf863('0x4f')](function(_0x45e677){_0xddfd28[_0xf863('0x2b')]=_0x45e677;if(_0x29ca6b[_0xf863('0x3f')]['includeAll']){_0x18ce70[_0xf863('0x50')]=[{'all':!![]}];}return db['Setting'][_0xf863('0x51')](_0x18ce70);})[_0xf863('0x4f')](function(_0x247c88){_0xddfd28[_0xf863('0x52')]=_0x247c88;return _0xddfd28;})['then'](respondWithFilteredResult(_0x105f5c,_0x18ce70))['catch'](handleError(_0x105f5c,null));};exports[_0xf863('0x53')]=function(_0xbc2445,_0xd18dd5){var _0x1f5e30={'raw':![],'where':{'id':_0xbc2445[_0xf863('0x54')]['id']}},_0x448987={};_0x448987[_0xf863('0x3e')]=_['keys'](db[_0xf863('0x4e')][_0xf863('0x3a')]);_0x448987['query']=_[_0xf863('0x40')](_0xbc2445[_0xf863('0x3f')]);_0x448987['filters']=_[_0xf863('0x41')](_0x448987[_0xf863('0x3e')],_0x448987[_0xf863('0x3f')]);_0x1f5e30[_0xf863('0x42')]=_[_0xf863('0x41')](_0x448987[_0xf863('0x3e')],qs[_0xf863('0x43')](_0xbc2445[_0xf863('0x3f')][_0xf863('0x43')]));_0x1f5e30[_0xf863('0x42')]=_0x1f5e30[_0xf863('0x42')]['length']?_0x1f5e30[_0xf863('0x42')]:_0x448987[_0xf863('0x3e')];if(_0xbc2445['query'][_0xf863('0x55')]){_0x1f5e30[_0xf863('0x50')]=[{'all':!![]}];}_0x1f5e30=_[_0xf863('0x4b')]({},_0x1f5e30,_0xbc2445[_0xf863('0x4d')]);return db[_0xf863('0x4e')][_0xf863('0x56')](_0x1f5e30)['then'](handleEntityNotFound(_0xd18dd5,null))['then'](respondWithResult(_0xd18dd5,null))[_0xf863('0x25')](handleError(_0xd18dd5,null));};exports[_0xf863('0x33')]=function(_0x20dc56,_0x1d8d51){if(_0x20dc56['body']['id']){delete _0x20dc56[_0xf863('0x57')]['id'];}return db[_0xf863('0x4e')][_0xf863('0x56')]({'where':{'id':_0x20dc56['params']['id']}})['then'](handleEntityNotFound(_0x1d8d51,null))[_0xf863('0x4f')](saveUpdates(_0x20dc56[_0xf863('0x57')],null))[_0xf863('0x4f')](respondWithResult(_0x1d8d51,null))['catch'](handleError(_0x1d8d51,null));};exports['addLogo']=function(_0x51986,_0x494ae3,_0x3aaa90){if(_0x51986['file']&&_0x51986[_0xf863('0x58')][_0xf863('0x59')]){_0x51986[_0xf863('0x57')]['logo']=_0x51986[_0xf863('0x58')][_0xf863('0x59')];}return db['Setting'][_0xf863('0x56')]({'where':{'id':_0x51986[_0xf863('0x54')]['id']}})[_0xf863('0x4f')](handleEntityNotFound(_0x494ae3,null))[_0xf863('0x4f')](saveUpdates(_0x51986[_0xf863('0x57')],null))[_0xf863('0x4f')](respondWithResult(_0x494ae3,null))[_0xf863('0x25')](handleError(_0x494ae3,null));};exports['addLogoLogin']=function(_0x69ccae,_0x41dc45,_0x4978e3){if(_0x69ccae[_0xf863('0x58')]&&_0x69ccae[_0xf863('0x58')]['filename']){_0x69ccae['body']['loginLogo']=_0x69ccae[_0xf863('0x58')][_0xf863('0x59')];}return db[_0xf863('0x4e')]['find']({'where':{'id':_0x69ccae['params']['id']}})[_0xf863('0x4f')](handleEntityNotFound(_0x41dc45,null))['then'](saveUpdates(_0x69ccae[_0xf863('0x57')],null))[_0xf863('0x4f')](respondWithResult(_0x41dc45,null))['catch'](handleError(_0x41dc45,null));};var utilLicense=require(_0xf863('0x18'));exports[_0xf863('0x5a')]=function(_0x28c987,_0x2cc372,_0x31b992){var _0x7309d7=_0xf863('0x5b');var _0x3d3433={'custom':![]};return utilLicense[_0xf863('0x5c')]()['then'](function(_0x532cb9){if(_0x532cb9){_0x3d3433=_0x532cb9;}return db[_0xf863('0x4e')][_0xf863('0x56')]({'where':{'id':_0x28c987[_0xf863('0x54')]['id']},'attributes':[_0xf863('0x5d'),'loginLogo','preferred',_0xf863('0x5e'),_0xf863('0x5f'),_0xf863('0x60'),'defaultPreferred',_0xf863('0x61')],'raw':!![]});})[_0xf863('0x4f')](handleEntityNotFound(_0x2cc372,null))[_0xf863('0x4f')](function(_0x4efe9a){if(_0x4efe9a){var _0x4e6860=_0x4efe9a[_0xf863('0x5d')]&&fs[_0xf863('0x62')](path['join'](config['root'],_0x7309d7,_[_0xf863('0x63')](_0x4efe9a[_0xf863('0x5d')])))?path[_0xf863('0x64')](config[_0xf863('0x65')],_0x7309d7,_[_0xf863('0x63')](_0x4efe9a[_0xf863('0x5d')])):path[_0xf863('0x64')](config[_0xf863('0x65')],_0x7309d7,_[_0xf863('0x63')]('default_logo.svg'));var _0x510ce0=_0xf863('0x66')+_[_0xf863('0x67')](_0xf863('0x5d'));if(_0x4efe9a[_0x510ce0]||!_0x3d3433[_0xf863('0x68')]){_0x4e6860=path[_0xf863('0x64')](config[_0xf863('0x65')],_0x7309d7,_[_0xf863('0x63')](_0xf863('0x69')));}if(!fs['existsSync'](_0x4e6860)){throw new db[(_0xf863('0x6a'))][(_0xf863('0x6b'))](_[_0xf863('0x67')]('logo')+'\x20not\x20found');}return _0x2cc372[_0xf863('0x6c')](_0x4e6860);}})[_0xf863('0x25')](handleError(_0x2cc372,null));};var utilLicense=require(_0xf863('0x18'));exports[_0xf863('0x6d')]=function(_0xa6d9e,_0xd005b4,_0x52a3de){var _0x566347=_0xf863('0x5b');var _0x3791bd={'custom':![]};return utilLicense[_0xf863('0x5c')]()[_0xf863('0x4f')](function(_0x53478d){if(_0x53478d){_0x3791bd=_0x53478d;}return db[_0xf863('0x4e')][_0xf863('0x56')]({'where':{'id':_0xa6d9e['params']['id']},'attributes':[_0xf863('0x5d'),_0xf863('0x6e'),_0xf863('0x6f'),'favicon',_0xf863('0x5f'),_0xf863('0x60'),_0xf863('0x70'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xd005b4,null))[_0xf863('0x4f')](function(_0x231305){if(_0x231305){var _0x38f349=_0x231305['loginLogo']&&fs['existsSync'](path['join'](config[_0xf863('0x65')],_0x566347,_[_0xf863('0x63')](_0x231305[_0xf863('0x6e')])))?path['join'](config[_0xf863('0x65')],_0x566347,_[_0xf863('0x63')](_0x231305[_0xf863('0x6e')])):path[_0xf863('0x64')](config[_0xf863('0x65')],_0x566347,_[_0xf863('0x63')]('default_loginLogo.svg'));var _0x232766=_0xf863('0x66')+_[_0xf863('0x67')](_0xf863('0x6e'));if(_0x231305[_0x232766]||!_0x3791bd[_0xf863('0x68')]){_0x38f349=path['join'](config[_0xf863('0x65')],_0x566347,_[_0xf863('0x63')](_0xf863('0x71')));}if(!fs[_0xf863('0x62')](_0x38f349)){throw new db['Sequelize'][(_0xf863('0x6b'))](_[_0xf863('0x67')](_0xf863('0x6e'))+_0xf863('0x72'));}return _0xd005b4[_0xf863('0x6c')](_0x38f349);}})[_0xf863('0x25')](handleError(_0xd005b4,null));};exports[_0xf863('0x73')]=function(_0x56e998,_0x49ae08){return db[_0xf863('0x4e')][_0xf863('0x56')]({'where':{'id':_0x56e998[_0xf863('0x54')]['id']},'attributes':[_0xf863('0x74')]})[_0xf863('0x4f')](respondWithResult(_0x49ae08,null))['catch'](handleError(_0x49ae08,null));};exports['addPreferred']=function(_0x3a8448,_0x12e57d,_0x492966){if(_0x3a8448[_0xf863('0x58')]&&_0x3a8448[_0xf863('0x58')][_0xf863('0x59')]){_0x3a8448['body'][_0xf863('0x6f')]=_0x3a8448[_0xf863('0x58')][_0xf863('0x59')];}return db[_0xf863('0x4e')][_0xf863('0x56')]({'where':{'id':_0x3a8448[_0xf863('0x54')]['id']}})[_0xf863('0x4f')](handleEntityNotFound(_0x12e57d,null))['then'](saveUpdates(_0x3a8448[_0xf863('0x57')],null))[_0xf863('0x4f')](respondWithResult(_0x12e57d,null))['catch'](handleError(_0x12e57d,null));};var utilLicense=require(_0xf863('0x18'));exports['getPreferred']=function(_0x2c8a07,_0xa7a652,_0x4aa2e1){var _0x25dbd2=_0xf863('0x5b');var _0x10cf28={'custom':![]};return utilLicense[_0xf863('0x5c')]()[_0xf863('0x4f')](function(_0x12b618){if(_0x12b618){_0x10cf28=_0x12b618;}return db[_0xf863('0x4e')][_0xf863('0x56')]({'where':{'id':_0x2c8a07[_0xf863('0x54')]['id']},'attributes':[_0xf863('0x5d'),_0xf863('0x6e'),_0xf863('0x6f'),_0xf863('0x5e'),_0xf863('0x5f'),'defaultLoginLogo',_0xf863('0x70'),_0xf863('0x61')],'raw':!![]});})[_0xf863('0x4f')](handleEntityNotFound(_0xa7a652,null))[_0xf863('0x4f')](function(_0x301d05){if(_0x301d05){var _0x269b33=_0x301d05[_0xf863('0x6f')]&&fs[_0xf863('0x62')](path['join'](config[_0xf863('0x65')],_0x25dbd2,_[_0xf863('0x63')](_0x301d05['preferred'])))?path[_0xf863('0x64')](config[_0xf863('0x65')],_0x25dbd2,_[_0xf863('0x63')](_0x301d05['preferred'])):path[_0xf863('0x64')](config[_0xf863('0x65')],_0x25dbd2,_[_0xf863('0x63')]('default_preferred.png'));var _0x2a7661=_0xf863('0x66')+_[_0xf863('0x67')]('preferred');if(_0x301d05[_0x2a7661]||!_0x10cf28[_0xf863('0x68')]||!_0x10cf28[_0xf863('0x6f')]){_0x269b33=path['join'](config[_0xf863('0x65')],_0x25dbd2,_[_0xf863('0x63')](_0xf863('0x75')));}if(!fs['existsSync'](_0x269b33)){throw new db[(_0xf863('0x6a'))][(_0xf863('0x6b'))](_[_0xf863('0x67')]('preferred')+_0xf863('0x72'));}return _0xa7a652[_0xf863('0x6c')](_0x269b33);}})[_0xf863('0x25')](handleError(_0xa7a652,null));};exports[_0xf863('0x76')]=function(_0x56e0e1,_0x23f469,_0xbf4a75){if(_0x56e0e1[_0xf863('0x58')]&&_0x56e0e1[_0xf863('0x58')][_0xf863('0x59')]){_0x56e0e1[_0xf863('0x57')][_0xf863('0x5e')]=_0x56e0e1[_0xf863('0x58')][_0xf863('0x59')];}return db['Setting'][_0xf863('0x56')]({'where':{'id':_0x56e0e1[_0xf863('0x54')]['id']}})[_0xf863('0x4f')](handleEntityNotFound(_0x23f469,null))['then'](saveUpdates(_0x56e0e1['body'],null))[_0xf863('0x4f')](respondWithResult(_0x23f469,null))[_0xf863('0x25')](handleError(_0x23f469,null));};var utilLicense=require('../../config/license/util');exports[_0xf863('0x77')]=function(_0x2cdfb6,_0x9b666d,_0x8078cf){var _0x35fd33=_0xf863('0x5b');var _0x587aac={'custom':![]};return utilLicense[_0xf863('0x5c')]()['then'](function(_0x153539){if(_0x153539){_0x587aac=_0x153539;}return db['Setting'][_0xf863('0x56')]({'where':{'id':_0x2cdfb6[_0xf863('0x54')]['id']},'attributes':[_0xf863('0x5d'),_0xf863('0x6e'),_0xf863('0x6f'),_0xf863('0x5e'),_0xf863('0x5f'),_0xf863('0x60'),_0xf863('0x70'),_0xf863('0x61')],'raw':!![]});})[_0xf863('0x4f')](handleEntityNotFound(_0x9b666d,null))['then'](function(_0x138794){if(_0x138794){var _0x5a9350=_0x138794['favicon']&&fs[_0xf863('0x62')](path[_0xf863('0x64')](config[_0xf863('0x65')],_0x35fd33,_[_0xf863('0x63')](_0x138794[_0xf863('0x5e')])))?path[_0xf863('0x64')](config[_0xf863('0x65')],_0x35fd33,_[_0xf863('0x63')](_0x138794['favicon'])):path[_0xf863('0x64')](config[_0xf863('0x65')],_0x35fd33,_[_0xf863('0x63')](_0xf863('0x78')));var _0x6d3616='default'+_['upperFirst'](_0xf863('0x5e'));if(_0x138794[_0x6d3616]||!_0x587aac['custom']){_0x5a9350=path[_0xf863('0x64')](config[_0xf863('0x65')],_0x35fd33,_['toLower']('default_favicon.ico'));}if(!fs[_0xf863('0x62')](_0x5a9350)){throw new db[(_0xf863('0x6a'))][(_0xf863('0x6b'))](_['upperFirst'](_0xf863('0x5e'))+'\x20not\x20found');}return _0x9b666d[_0xf863('0x6c')](_0x5a9350);}})[_0xf863('0x25')](handleError(_0x9b666d,null));};exports['getDate']=function(_0x193093,_0x420fff){var _0x5aef4d={'offset':moment()[_0xf863('0x79')]()};_0x5aef4d[_0xf863('0x7a')]=moment()[_0xf863('0x79')](_0x5aef4d['offset'])[_0xf863('0x7b')](_0xf863('0x7c'));return _0x420fff[_0xf863('0x27')](0xc8)['send'](_0x5aef4d);}; \ No newline at end of file +var _0xa1f4=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','update','destroy','stack','name','send','map','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Setting','include','rows','show','length','includeAll','options','body','params','addLogo','file','filename','find','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','ValidationError','\x20not\x20found','getLogoLogin','Sequelize','securePassword','addPreferred','getPreferred','default_preferred.png','upperFirst','download','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format'];(function(_0x5deb77,_0xaac40d){var _0x63629e=function(_0x53a20a){while(--_0x53a20a){_0x5deb77['push'](_0x5deb77['shift']());}};_0x63629e(++_0xaac40d);}(_0xa1f4,0x1d3));var _0x4a1f=function(_0x876628,_0x31f909){_0x876628=_0x876628-0x0;var _0x3e8397=_0xa1f4[_0x876628];return _0x3e8397;};'use strict';var emlformat=require(_0x4a1f('0x0'));var rimraf=require(_0x4a1f('0x1'));var zipdir=require(_0x4a1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a1f('0x3'));var moment=require(_0x4a1f('0x4'));var BPromise=require(_0x4a1f('0x5'));var Mustache=require(_0x4a1f('0x6'));var util=require(_0x4a1f('0x7'));var path=require(_0x4a1f('0x8'));var sox=require(_0x4a1f('0x9'));var csv=require('to-csv');var ejs=require(_0x4a1f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a1f('0xb'));var squel=require('squel');var crypto=require(_0x4a1f('0xc'));var jsforce=require(_0x4a1f('0xd'));var deskjs=require(_0x4a1f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4a1f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a1f('0x10'));var qs=require(_0x4a1f('0x11'));var as=require(_0x4a1f('0x12'));var hardwareService=require(_0x4a1f('0x13'));var logger=require(_0x4a1f('0x14'))('api');var utils=require(_0x4a1f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4a1f('0x16'));var db=require(_0x4a1f('0x17'))['db'];var jayson=require(_0x4a1f('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9d15,_0x489d4e,_0x5eeee2,_0x3c21ce){return new BPromise(function(_0x4ef5e6,_0x7eaedb){var _0x39975f=_0x3c21ce||client;return _0x39975f[_0x4a1f('0x19')](_0x1e9d15,_0x5eeee2)[_0x4a1f('0x1a')](function(_0x139c88){logger[_0x4a1f('0x1b')](_0x4a1f('0x1c'),_0x489d4e,_0x4a1f('0x1d'));logger[_0x4a1f('0x1e')](_0x4a1f('0x1f'),_0x489d4e,_0x4a1f('0x1d'),JSON['stringify'](_0x139c88));if(_0x139c88[_0x4a1f('0x20')]){if(_0x139c88[_0x4a1f('0x20')]['code']===0x1f4){logger[_0x4a1f('0x20')](_0x4a1f('0x1c'),_0x489d4e,_0x139c88[_0x4a1f('0x20')]['message']);return _0x7eaedb(_0x139c88['error'][_0x4a1f('0x21')]);}logger['error'](_0x4a1f('0x1c'),_0x489d4e,_0x139c88[_0x4a1f('0x20')][_0x4a1f('0x21')]);return _0x4ef5e6(_0x139c88[_0x4a1f('0x20')][_0x4a1f('0x21')]);}else{logger['info'](_0x4a1f('0x1c'),_0x489d4e,_0x4a1f('0x1d'));_0x4ef5e6(_0x139c88[_0x4a1f('0x22')]['message']);}})[_0x4a1f('0x23')](function(_0xa98755){logger[_0x4a1f('0x20')](_0x4a1f('0x1c'),_0x489d4e,_0xa98755);_0x7eaedb(_0xa98755);});});}function respondWithStatusCode(_0x1fa12e,_0x564d59){_0x564d59=_0x564d59||0xcc;return function(_0x4a6280){if(_0x4a6280){return _0x1fa12e[_0x4a1f('0x24')](_0x564d59);}return _0x1fa12e['status'](_0x564d59)[_0x4a1f('0x25')]();};}function respondWithResult(_0xb2e8ee,_0x377209){_0x377209=_0x377209||0xc8;return function(_0x2d63fc){if(_0x2d63fc){return _0xb2e8ee[_0x4a1f('0x26')](_0x377209)[_0x4a1f('0x27')](_0x2d63fc);}};}function respondWithFilteredResult(_0x588176,_0x33bc66){return function(_0x1106e6){if(_0x1106e6){var _0x306659=typeof _0x33bc66['offset']===_0x4a1f('0x28')&&typeof _0x33bc66[_0x4a1f('0x29')]===_0x4a1f('0x28');var _0x5c329c=_0x1106e6[_0x4a1f('0x2a')];var _0x2373c2=_0x306659?0x0:_0x33bc66[_0x4a1f('0x2b')];var _0x51e031=_0x306659?_0x1106e6[_0x4a1f('0x2a')]:_0x33bc66[_0x4a1f('0x2b')]+_0x33bc66[_0x4a1f('0x29')];var _0x1e03fd;if(_0x51e031>=_0x5c329c){_0x51e031=_0x5c329c;_0x1e03fd=0xc8;}else{_0x1e03fd=0xce;}_0x588176[_0x4a1f('0x26')](_0x1e03fd);return _0x588176[_0x4a1f('0x2c')]('Content-Range',_0x2373c2+'-'+_0x51e031+'/'+_0x5c329c)['json'](_0x1106e6);}return null;};}function patchUpdates(_0x328fc1){return function(_0x5ccc40){try{jsonpatch['apply'](_0x5ccc40,_0x328fc1,!![]);}catch(_0x5c9d68){return BPromise[_0x4a1f('0x2d')](_0x5c9d68);}return _0x5ccc40[_0x4a1f('0x2e')]();};}function saveUpdates(_0x13b8f2,_0x366650){return function(_0x489f23){if(_0x489f23){return _0x489f23[_0x4a1f('0x2f')](_0x13b8f2)[_0x4a1f('0x1a')](function(_0x2b957f){return _0x2b957f;});}return null;};}function removeEntity(_0x29f06b,_0x2e7d05){return function(_0x70005b){if(_0x70005b){return _0x70005b[_0x4a1f('0x30')]()[_0x4a1f('0x1a')](function(){_0x29f06b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48cfec,_0x4c8c77){return function(_0x56f33f){if(!_0x56f33f){_0x48cfec[_0x4a1f('0x24')](0x194);}return _0x56f33f;};}function handleError(_0x2a222b,_0x3972ca){_0x3972ca=_0x3972ca||0x1f4;return function(_0x308d92){logger['error'](_0x308d92[_0x4a1f('0x31')]);if(_0x308d92[_0x4a1f('0x32')]){delete _0x308d92[_0x4a1f('0x32')];}_0x2a222b['status'](_0x3972ca)[_0x4a1f('0x33')](_0x308d92);};}exports['index']=function(_0x291564,_0x2fde55){var _0x22a8a5={},_0x4ac949={},_0x403e59={'count':0x0,'rows':[]};var _0xe041cf=_[_0x4a1f('0x34')](db['Setting']['rawAttributes'],function(_0x5b510f){return{'name':_0x5b510f['fieldName'],'type':_0x5b510f[_0x4a1f('0x35')]['key']};});_0x4ac949[_0x4a1f('0x36')]=_[_0x4a1f('0x34')](_0xe041cf,'name');_0x4ac949[_0x4a1f('0x37')]=_[_0x4a1f('0x38')](_0x291564[_0x4a1f('0x37')]);_0x4ac949[_0x4a1f('0x39')]=_[_0x4a1f('0x3a')](_0x4ac949[_0x4a1f('0x36')],_0x4ac949[_0x4a1f('0x37')]);_0x22a8a5[_0x4a1f('0x3b')]=_['intersection'](_0x4ac949[_0x4a1f('0x36')],qs[_0x4a1f('0x3c')](_0x291564['query'][_0x4a1f('0x3c')]));_0x22a8a5[_0x4a1f('0x3b')]=_0x22a8a5[_0x4a1f('0x3b')]['length']?_0x22a8a5[_0x4a1f('0x3b')]:_0x4ac949[_0x4a1f('0x36')];if(!_0x291564[_0x4a1f('0x37')][_0x4a1f('0x3d')](_0x4a1f('0x3e'))){_0x22a8a5[_0x4a1f('0x29')]=qs[_0x4a1f('0x29')](_0x291564[_0x4a1f('0x37')][_0x4a1f('0x29')]);_0x22a8a5['offset']=qs['offset'](_0x291564[_0x4a1f('0x37')]['offset']);}_0x22a8a5[_0x4a1f('0x3f')]=qs[_0x4a1f('0x40')](_0x291564[_0x4a1f('0x37')][_0x4a1f('0x40')]);_0x22a8a5[_0x4a1f('0x41')]=qs['filters'](_[_0x4a1f('0x42')](_0x291564['query'],_0x4ac949[_0x4a1f('0x39')]),_0xe041cf);if(_0x291564[_0x4a1f('0x37')][_0x4a1f('0x43')]){_0x22a8a5[_0x4a1f('0x41')]=_[_0x4a1f('0x44')](_0x22a8a5[_0x4a1f('0x41')],{'$or':_[_0x4a1f('0x34')](_0xe041cf,function(_0x358893){if(_0x358893[_0x4a1f('0x35')]!=='VIRTUAL'){var _0x2a4d2f={};_0x2a4d2f[_0x358893[_0x4a1f('0x32')]]={'$like':'%'+_0x291564[_0x4a1f('0x37')][_0x4a1f('0x43')]+'%'};return _0x2a4d2f;}})});}_0x22a8a5=_['merge']({},_0x22a8a5,_0x291564['options']);var _0x393be5={'where':_0x22a8a5['where']};return db[_0x4a1f('0x45')][_0x4a1f('0x2a')](_0x393be5)['then'](function(_0x1d15e0){_0x403e59[_0x4a1f('0x2a')]=_0x1d15e0;if(_0x291564[_0x4a1f('0x37')]['includeAll']){_0x22a8a5[_0x4a1f('0x46')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x22a8a5);})[_0x4a1f('0x1a')](function(_0xf8304f){_0x403e59[_0x4a1f('0x47')]=_0xf8304f;return _0x403e59;})[_0x4a1f('0x1a')](respondWithFilteredResult(_0x2fde55,_0x22a8a5))[_0x4a1f('0x23')](handleError(_0x2fde55,null));};exports[_0x4a1f('0x48')]=function(_0x588e84,_0x1ea1bd){var _0x39ea9c={'raw':![],'where':{'id':_0x588e84['params']['id']}},_0x4d3b03={};_0x4d3b03[_0x4a1f('0x36')]=_[_0x4a1f('0x38')](db['Setting']['rawAttributes']);_0x4d3b03[_0x4a1f('0x37')]=_[_0x4a1f('0x38')](_0x588e84['query']);_0x4d3b03[_0x4a1f('0x39')]=_['intersection'](_0x4d3b03[_0x4a1f('0x36')],_0x4d3b03['query']);_0x39ea9c[_0x4a1f('0x3b')]=_[_0x4a1f('0x3a')](_0x4d3b03[_0x4a1f('0x36')],qs['fields'](_0x588e84['query'][_0x4a1f('0x3c')]));_0x39ea9c['attributes']=_0x39ea9c[_0x4a1f('0x3b')][_0x4a1f('0x49')]?_0x39ea9c['attributes']:_0x4d3b03[_0x4a1f('0x36')];if(_0x588e84[_0x4a1f('0x37')][_0x4a1f('0x4a')]){_0x39ea9c[_0x4a1f('0x46')]=[{'all':!![]}];}_0x39ea9c=_[_0x4a1f('0x44')]({},_0x39ea9c,_0x588e84[_0x4a1f('0x4b')]);return db[_0x4a1f('0x45')]['find'](_0x39ea9c)[_0x4a1f('0x1a')](handleEntityNotFound(_0x1ea1bd,null))[_0x4a1f('0x1a')](respondWithResult(_0x1ea1bd,null))[_0x4a1f('0x23')](handleError(_0x1ea1bd,null));};exports[_0x4a1f('0x2f')]=function(_0xcb5f9a,_0x3e6e9c){if(_0xcb5f9a[_0x4a1f('0x4c')]['id']){delete _0xcb5f9a['body']['id'];}return db[_0x4a1f('0x45')]['find']({'where':{'id':_0xcb5f9a[_0x4a1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e6e9c,null))[_0x4a1f('0x1a')](saveUpdates(_0xcb5f9a[_0x4a1f('0x4c')],null))['then'](respondWithResult(_0x3e6e9c,null))['catch'](handleError(_0x3e6e9c,null));};exports[_0x4a1f('0x4e')]=function(_0x2ea633,_0x4ea369,_0x1734ad){if(_0x2ea633[_0x4a1f('0x4f')]&&_0x2ea633[_0x4a1f('0x4f')][_0x4a1f('0x50')]){_0x2ea633[_0x4a1f('0x4c')]['logo']=_0x2ea633[_0x4a1f('0x4f')]['filename'];}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x2ea633[_0x4a1f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4ea369,null))['then'](saveUpdates(_0x2ea633[_0x4a1f('0x4c')],null))['then'](respondWithResult(_0x4ea369,null))['catch'](handleError(_0x4ea369,null));};exports[_0x4a1f('0x52')]=function(_0x44f58f,_0x530dc1,_0x54bad1){if(_0x44f58f[_0x4a1f('0x4f')]&&_0x44f58f[_0x4a1f('0x4f')][_0x4a1f('0x50')]){_0x44f58f[_0x4a1f('0x4c')][_0x4a1f('0x53')]=_0x44f58f[_0x4a1f('0x4f')]['filename'];}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x44f58f['params']['id']}})[_0x4a1f('0x1a')](handleEntityNotFound(_0x530dc1,null))['then'](saveUpdates(_0x44f58f[_0x4a1f('0x4c')],null))[_0x4a1f('0x1a')](respondWithResult(_0x530dc1,null))[_0x4a1f('0x23')](handleError(_0x530dc1,null));};var utilLicense=require(_0x4a1f('0x16'));exports[_0x4a1f('0x54')]=function(_0x28d66a,_0x1f5e70,_0x42cfc0){var _0x189080=_0x4a1f('0x55');var _0x16b44e={'custom':![]};return utilLicense[_0x4a1f('0x56')]()[_0x4a1f('0x1a')](function(_0x6b5f9b){if(_0x6b5f9b){_0x16b44e=_0x6b5f9b;}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x28d66a[_0x4a1f('0x4d')]['id']},'attributes':[_0x4a1f('0x57'),_0x4a1f('0x53'),_0x4a1f('0x58'),_0x4a1f('0x59'),_0x4a1f('0x5a'),_0x4a1f('0x5b'),_0x4a1f('0x5c'),_0x4a1f('0x5d')],'raw':!![]});})[_0x4a1f('0x1a')](handleEntityNotFound(_0x1f5e70,null))[_0x4a1f('0x1a')](function(_0x2cea75){if(_0x2cea75){var _0x313baa=_0x2cea75[_0x4a1f('0x57')]&&fs[_0x4a1f('0x5e')](path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x189080,_[_0x4a1f('0x61')](_0x2cea75[_0x4a1f('0x57')])))?path['join'](config[_0x4a1f('0x60')],_0x189080,_[_0x4a1f('0x61')](_0x2cea75['logo'])):path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x189080,_[_0x4a1f('0x61')](_0x4a1f('0x62')));var _0x5e8a28=_0x4a1f('0x63')+_['upperFirst'](_0x4a1f('0x57'));if(_0x2cea75[_0x5e8a28]||!_0x16b44e[_0x4a1f('0x64')]){_0x313baa=path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x189080,_['toLower'](_0x4a1f('0x62')));}if(!fs[_0x4a1f('0x5e')](_0x313baa)){throw new db['Sequelize'][(_0x4a1f('0x65'))](_['upperFirst'](_0x4a1f('0x57'))+_0x4a1f('0x66'));}return _0x1f5e70['download'](_0x313baa);}})[_0x4a1f('0x23')](handleError(_0x1f5e70,null));};var utilLicense=require('../../config/license/util');exports[_0x4a1f('0x67')]=function(_0x3c3b13,_0x58daf4,_0x18b478){var _0x39dceb='server/files/images/logos';var _0x56c00c={'custom':![]};return utilLicense[_0x4a1f('0x56')]()['then'](function(_0x4c6a4e){if(_0x4c6a4e){_0x56c00c=_0x4c6a4e;}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x3c3b13[_0x4a1f('0x4d')]['id']},'attributes':['logo',_0x4a1f('0x53'),'preferred',_0x4a1f('0x59'),_0x4a1f('0x5a'),_0x4a1f('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4a1f('0x1a')](handleEntityNotFound(_0x58daf4,null))[_0x4a1f('0x1a')](function(_0x23118){if(_0x23118){var _0x5b3564=_0x23118['loginLogo']&&fs[_0x4a1f('0x5e')](path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x39dceb,_['toLower'](_0x23118[_0x4a1f('0x53')])))?path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x39dceb,_[_0x4a1f('0x61')](_0x23118['loginLogo'])):path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x39dceb,_[_0x4a1f('0x61')]('default_loginLogo.svg'));var _0x83821=_0x4a1f('0x63')+_['upperFirst'](_0x4a1f('0x53'));if(_0x23118[_0x83821]||!_0x56c00c[_0x4a1f('0x64')]){_0x5b3564=path['join'](config[_0x4a1f('0x60')],_0x39dceb,_[_0x4a1f('0x61')]('default_loginLogo.svg'));}if(!fs[_0x4a1f('0x5e')](_0x5b3564)){throw new db[(_0x4a1f('0x68'))][(_0x4a1f('0x65'))](_['upperFirst'](_0x4a1f('0x53'))+_0x4a1f('0x66'));}return _0x58daf4['download'](_0x5b3564);}})[_0x4a1f('0x23')](handleError(_0x58daf4,null));};exports['gdpr']=function(_0x23e6a3,_0x515536){return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x23e6a3[_0x4a1f('0x4d')]['id']},'attributes':[_0x4a1f('0x69')]})[_0x4a1f('0x1a')](respondWithResult(_0x515536,null))[_0x4a1f('0x23')](handleError(_0x515536,null));};exports[_0x4a1f('0x6a')]=function(_0x18d577,_0x2d1291,_0x5334eb){if(_0x18d577[_0x4a1f('0x4f')]&&_0x18d577['file'][_0x4a1f('0x50')]){_0x18d577[_0x4a1f('0x4c')][_0x4a1f('0x58')]=_0x18d577[_0x4a1f('0x4f')][_0x4a1f('0x50')];}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x18d577['params']['id']}})[_0x4a1f('0x1a')](handleEntityNotFound(_0x2d1291,null))[_0x4a1f('0x1a')](saveUpdates(_0x18d577[_0x4a1f('0x4c')],null))[_0x4a1f('0x1a')](respondWithResult(_0x2d1291,null))[_0x4a1f('0x23')](handleError(_0x2d1291,null));};var utilLicense=require(_0x4a1f('0x16'));exports[_0x4a1f('0x6b')]=function(_0x63fc89,_0x801f4c,_0x5b73a9){var _0x14cc51='server/files/images/logos';var _0x5b9135={'custom':![]};return utilLicense[_0x4a1f('0x56')]()[_0x4a1f('0x1a')](function(_0x6d585d){if(_0x6d585d){_0x5b9135=_0x6d585d;}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x63fc89['params']['id']},'attributes':[_0x4a1f('0x57'),_0x4a1f('0x53'),_0x4a1f('0x58'),_0x4a1f('0x59'),_0x4a1f('0x5a'),_0x4a1f('0x5b'),_0x4a1f('0x5c'),_0x4a1f('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x801f4c,null))[_0x4a1f('0x1a')](function(_0x5db4a3){if(_0x5db4a3){var _0x33c5b2=_0x5db4a3['preferred']&&fs[_0x4a1f('0x5e')](path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x14cc51,_[_0x4a1f('0x61')](_0x5db4a3[_0x4a1f('0x58')])))?path[_0x4a1f('0x5f')](config['root'],_0x14cc51,_[_0x4a1f('0x61')](_0x5db4a3[_0x4a1f('0x58')])):path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x14cc51,_['toLower'](_0x4a1f('0x6c')));var _0x28f1b1=_0x4a1f('0x63')+_[_0x4a1f('0x6d')](_0x4a1f('0x58'));if(_0x5db4a3[_0x28f1b1]||!_0x5b9135[_0x4a1f('0x64')]||!_0x5b9135['preferred']){_0x33c5b2=path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x14cc51,_[_0x4a1f('0x61')]('default_preferred.png'));}if(!fs[_0x4a1f('0x5e')](_0x33c5b2)){throw new db[(_0x4a1f('0x68'))]['ValidationError'](_[_0x4a1f('0x6d')]('preferred')+'\x20not\x20found');}return _0x801f4c[_0x4a1f('0x6e')](_0x33c5b2);}})[_0x4a1f('0x23')](handleError(_0x801f4c,null));};exports['addFavicon']=function(_0x54c3dd,_0x5d5ab1,_0x24b195){if(_0x54c3dd[_0x4a1f('0x4f')]&&_0x54c3dd[_0x4a1f('0x4f')][_0x4a1f('0x50')]){_0x54c3dd[_0x4a1f('0x4c')][_0x4a1f('0x59')]=_0x54c3dd[_0x4a1f('0x4f')][_0x4a1f('0x50')];}return db[_0x4a1f('0x45')]['find']({'where':{'id':_0x54c3dd[_0x4a1f('0x4d')]['id']}})[_0x4a1f('0x1a')](handleEntityNotFound(_0x5d5ab1,null))[_0x4a1f('0x1a')](saveUpdates(_0x54c3dd[_0x4a1f('0x4c')],null))[_0x4a1f('0x1a')](respondWithResult(_0x5d5ab1,null))[_0x4a1f('0x23')](handleError(_0x5d5ab1,null));};var utilLicense=require('../../config/license/util');exports[_0x4a1f('0x6f')]=function(_0x5249f9,_0xea8f4d,_0x1587ec){var _0x3c4c86='server/files/images/logos';var _0x52711e={'custom':![]};return utilLicense[_0x4a1f('0x56')]()[_0x4a1f('0x1a')](function(_0xdcf87){if(_0xdcf87){_0x52711e=_0xdcf87;}return db[_0x4a1f('0x45')][_0x4a1f('0x51')]({'where':{'id':_0x5249f9[_0x4a1f('0x4d')]['id']},'attributes':[_0x4a1f('0x57'),_0x4a1f('0x53'),'preferred',_0x4a1f('0x59'),_0x4a1f('0x5a'),_0x4a1f('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4a1f('0x1a')](handleEntityNotFound(_0xea8f4d,null))[_0x4a1f('0x1a')](function(_0x448a1f){if(_0x448a1f){var _0x4070c7=_0x448a1f[_0x4a1f('0x59')]&&fs['existsSync'](path[_0x4a1f('0x5f')](config[_0x4a1f('0x60')],_0x3c4c86,_[_0x4a1f('0x61')](_0x448a1f[_0x4a1f('0x59')])))?path['join'](config[_0x4a1f('0x60')],_0x3c4c86,_[_0x4a1f('0x61')](_0x448a1f[_0x4a1f('0x59')])):path['join'](config['root'],_0x3c4c86,_[_0x4a1f('0x61')](_0x4a1f('0x70')));var _0x333572=_0x4a1f('0x63')+_['upperFirst'](_0x4a1f('0x59'));if(_0x448a1f[_0x333572]||!_0x52711e[_0x4a1f('0x64')]){_0x4070c7=path[_0x4a1f('0x5f')](config['root'],_0x3c4c86,_[_0x4a1f('0x61')](_0x4a1f('0x70')));}if(!fs[_0x4a1f('0x5e')](_0x4070c7)){throw new db['Sequelize']['ValidationError'](_[_0x4a1f('0x6d')]('favicon')+_0x4a1f('0x66'));}return _0xea8f4d[_0x4a1f('0x6e')](_0x4070c7);}})[_0x4a1f('0x23')](handleError(_0xea8f4d,null));};exports[_0x4a1f('0x71')]=function(_0x4834e2,_0x3e68ce){var _0x47bb24={'offset':moment()[_0x4a1f('0x72')]()};_0x47bb24[_0x4a1f('0x73')]=moment()[_0x4a1f('0x72')](_0x47bb24[_0x4a1f('0x2b')])['format'](_0x4a1f('0x74'));return _0x3e68ce[_0x4a1f('0x26')](0xc8)[_0x4a1f('0x33')](_0x47bb24);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f7d731c..d3734c0 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(_0x2520cf,_0x3b86be){var _0x30a6fd=function(_0x440a03){while(--_0x440a03){_0x2520cf['push'](_0x2520cf['shift']());}};_0x30a6fd(++_0x3b86be);}(_0x34e8,0x12c));var _0x834e=function(_0x2e233f,_0x2020c7){_0x2e233f=_0x2e233f-0x0;var _0x57dad1=_0x34e8[_0x2e233f];return _0x57dad1;};'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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x7217,0x19e));var _0x7721=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7217[_0x187ee1];return _0x388160;};'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/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5ac28e3..4a9a831 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 _0xb2e2=['stringify','error','code','message','result','ShowSetting','Setting','find','options','raw','where','include','map','model','attributes','debug','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x2e3f77,_0x4d8f26){var _0x15e60c=function(_0x440e7f){while(--_0x440e7f){_0x2e3f77['push'](_0x2e3f77['shift']());}};_0x15e60c(++_0x4d8f26);}(_0xb2e2,0x191));var _0x2b2e=function(_0x30bcc0,_0x1002f1){_0x30bcc0=_0x30bcc0-0x0;var _0x47f4a7=_0xb2e2[_0x30bcc0];return _0x47f4a7;};'use strict';var _=require(_0x2b2e('0x0'));var util=require(_0x2b2e('0x1'));var moment=require(_0x2b2e('0x2'));var BPromise=require('bluebird');var rs=require(_0x2b2e('0x3'));var fs=require('fs');var Redis=require(_0x2b2e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b2e('0x5'))(_0x2b2e('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b2e('0x7'));var client=jayson[_0x2b2e('0x8')][_0x2b2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493cb9,_0x45f95d,_0x471c82){return new BPromise(function(_0xabff07,_0x27ea88){return client['request'](_0x493cb9,_0x471c82)[_0x2b2e('0xa')](function(_0x184e06){logger[_0x2b2e('0xb')](_0x2b2e('0xc'),_0x45f95d,_0x2b2e('0xd'));logger['debug'](_0x2b2e('0xe'),_0x45f95d,_0x2b2e('0xd'),JSON[_0x2b2e('0xf')](_0x184e06));if(_0x184e06['error']){if(_0x184e06[_0x2b2e('0x10')][_0x2b2e('0x11')]===0x1f4){logger[_0x2b2e('0x10')]('Setting,\x20%s,\x20%s',_0x45f95d,_0x184e06[_0x2b2e('0x10')][_0x2b2e('0x12')]);return _0x27ea88(_0x184e06['error'][_0x2b2e('0x12')]);}logger['error']('Setting,\x20%s,\x20%s',_0x45f95d,_0x184e06['error'][_0x2b2e('0x12')]);return _0xabff07(_0x184e06[_0x2b2e('0x10')][_0x2b2e('0x12')]);}else{logger[_0x2b2e('0xb')]('Setting,\x20%s,\x20%s',_0x45f95d,_0x2b2e('0xd'));_0xabff07(_0x184e06[_0x2b2e('0x13')][_0x2b2e('0x12')]);}})['catch'](function(_0x3c7fa1){logger['error'](_0x2b2e('0xc'),_0x45f95d,_0x3c7fa1);_0x27ea88(_0x3c7fa1);});});}exports[_0x2b2e('0x14')]=function(_0x48aad0){var _0x291796=this;return new Promise(function(_0x424565,_0x153f47){return db[_0x2b2e('0x15')][_0x2b2e('0x16')]({'raw':_0x48aad0[_0x2b2e('0x17')]?_0x48aad0[_0x2b2e('0x17')][_0x2b2e('0x18')]===undefined?!![]:![]:!![],'where':_0x48aad0[_0x2b2e('0x17')]?_0x48aad0['options'][_0x2b2e('0x19')]||null:null,'attributes':_0x48aad0[_0x2b2e('0x17')]?_0x48aad0['options']['attributes']||null:null,'include':_0x48aad0['options']?_0x48aad0[_0x2b2e('0x17')][_0x2b2e('0x1a')]?_[_0x2b2e('0x1b')](_0x48aad0[_0x2b2e('0x17')][_0x2b2e('0x1a')],function(_0x76e30e){return{'model':db[_0x76e30e[_0x2b2e('0x1c')]],'as':_0x76e30e['as'],'attributes':_0x76e30e['attributes'],'include':_0x76e30e[_0x2b2e('0x1a')]?_[_0x2b2e('0x1b')](_0x76e30e[_0x2b2e('0x1a')],function(_0x380db4){return{'model':db[_0x380db4[_0x2b2e('0x1c')]],'as':_0x380db4['as'],'attributes':_0x380db4['attributes'],'include':_0x380db4[_0x2b2e('0x1a')]?_[_0x2b2e('0x1b')](_0x380db4[_0x2b2e('0x1a')],function(_0xb88009){return{'model':db[_0xb88009['model']],'as':_0xb88009['as'],'attributes':_0xb88009[_0x2b2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b2e('0xa')](function(_0x34fbb0){logger[_0x2b2e('0xb')]('ShowSetting',_0x48aad0);logger[_0x2b2e('0x1e')](_0x2b2e('0x14'),_0x48aad0,JSON[_0x2b2e('0xf')](_0x34fbb0));_0x424565(_0x34fbb0);})[_0x2b2e('0x1f')](function(_0x1dcf08){logger['error']('ShowSetting',_0x1dcf08[_0x2b2e('0x12')],_0x48aad0);_0x153f47(_0x291796['error'](0x1f4,_0x1dcf08[_0x2b2e('0x12')]));});});}; \ No newline at end of file +var _0xc915=['include','attributes','model','debug','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','map'];(function(_0x1743ae,_0x4a62ca){var _0x48c561=function(_0x1f580c){while(--_0x1f580c){_0x1743ae['push'](_0x1743ae['shift']());}};_0x48c561(++_0x4a62ca);}(_0xc915,0x10c));var _0x5c91=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc915[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5c91('0x0'));var util=require(_0x5c91('0x1'));var moment=require(_0x5c91('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c91('0x4'));var logger=require(_0x5c91('0x5'))(_0x5c91('0x6'));var config=require(_0x5c91('0x7'));var jayson=require(_0x5c91('0x8'));var client=jayson[_0x5c91('0x9')][_0x5c91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd96b2e,_0x23dcfe,_0x4e924b){return new BPromise(function(_0x8ab24f,_0x5b866e){return client[_0x5c91('0xb')](_0xd96b2e,_0x4e924b)[_0x5c91('0xc')](function(_0x175893){logger[_0x5c91('0xd')]('Setting,\x20%s,\x20%s',_0x23dcfe,_0x5c91('0xe'));logger['debug'](_0x5c91('0xf'),_0x23dcfe,_0x5c91('0xe'),JSON[_0x5c91('0x10')](_0x175893));if(_0x175893[_0x5c91('0x11')]){if(_0x175893[_0x5c91('0x11')]['code']===0x1f4){logger[_0x5c91('0x11')](_0x5c91('0x12'),_0x23dcfe,_0x175893['error'][_0x5c91('0x13')]);return _0x5b866e(_0x175893[_0x5c91('0x11')]['message']);}logger[_0x5c91('0x11')](_0x5c91('0x12'),_0x23dcfe,_0x175893[_0x5c91('0x11')][_0x5c91('0x13')]);return _0x8ab24f(_0x175893['error'][_0x5c91('0x13')]);}else{logger[_0x5c91('0xd')](_0x5c91('0x12'),_0x23dcfe,_0x5c91('0xe'));_0x8ab24f(_0x175893[_0x5c91('0x14')][_0x5c91('0x13')]);}})[_0x5c91('0x15')](function(_0x30530e){logger[_0x5c91('0x11')](_0x5c91('0x12'),_0x23dcfe,_0x30530e);_0x5b866e(_0x30530e);});});}exports[_0x5c91('0x16')]=function(_0x5b7cc3){var _0x46bcb0=this;return new Promise(function(_0x7c4de6,_0xc53b35){return db[_0x5c91('0x17')][_0x5c91('0x18')]({'raw':_0x5b7cc3[_0x5c91('0x19')]?_0x5b7cc3[_0x5c91('0x19')][_0x5c91('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b7cc3[_0x5c91('0x19')]?_0x5b7cc3[_0x5c91('0x19')][_0x5c91('0x1b')]||null:null,'attributes':_0x5b7cc3[_0x5c91('0x19')]?_0x5b7cc3['options']['attributes']||null:null,'include':_0x5b7cc3[_0x5c91('0x19')]?_0x5b7cc3[_0x5c91('0x19')]['include']?_[_0x5c91('0x1c')](_0x5b7cc3[_0x5c91('0x19')][_0x5c91('0x1d')],function(_0x5ddbdf){return{'model':db[_0x5ddbdf['model']],'as':_0x5ddbdf['as'],'attributes':_0x5ddbdf[_0x5c91('0x1e')],'include':_0x5ddbdf[_0x5c91('0x1d')]?_[_0x5c91('0x1c')](_0x5ddbdf['include'],function(_0x48c2c9){return{'model':db[_0x48c2c9[_0x5c91('0x1f')]],'as':_0x48c2c9['as'],'attributes':_0x48c2c9[_0x5c91('0x1e')],'include':_0x48c2c9[_0x5c91('0x1d')]?_['map'](_0x48c2c9[_0x5c91('0x1d')],function(_0x24bde3){return{'model':db[_0x24bde3[_0x5c91('0x1f')]],'as':_0x24bde3['as'],'attributes':_0x24bde3[_0x5c91('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c91('0xc')](function(_0x3f3ac6){logger[_0x5c91('0xd')](_0x5c91('0x16'),_0x5b7cc3);logger[_0x5c91('0x20')]('ShowSetting',_0x5b7cc3,JSON['stringify'](_0x3f3ac6));_0x7c4de6(_0x3f3ac6);})[_0x5c91('0x15')](function(_0x3071dd){logger['error'](_0x5c91('0x16'),_0x3071dd[_0x5c91('0x13')],_0x5b7cc3);_0xc53b35(_0x46bcb0[_0x5c91('0x11')](0x1f4,_0x3071dd[_0x5c91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7712ac7..961c956 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x38223f,_0x3a0dfc){var _0x3e3fab=function(_0x2b40d0){while(--_0x2b40d0){_0x38223f['push'](_0x38223f['shift']());}};_0x3e3fab(++_0x3a0dfc);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=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(_0x27a260,_0x42dedb){var _0x2cec78=function(_0x37dea8){while(--_0x37dea8){_0x27a260['push'](_0x27a260['shift']());}};_0x2cec78(++_0x42dedb);}(_0x6aa7,0x178));var _0x76aa=function(_0x319d4d,_0x326f1f){_0x319d4d=_0x319d4d-0x0;var _0x4e4bdc=_0x6aa7[_0x319d4d];return _0x4e4bdc;};'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 78493f8..696a2a5 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 _0x39a7=['intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','skebby','connectel','clickatell','bandwidth','csc'];(function(_0x985286,_0x2ae483){var _0x277f16=function(_0x378e38){while(--_0x378e38){_0x985286['push'](_0x985286['shift']());}};_0x277f16(++_0x2ae483);}(_0x39a7,0x173));var _0x739a=function(_0x2cfbcf,_0x2cf96f){_0x2cfbcf=_0x2cfbcf-0x0;var _0x41fc13=_0x39a7[_0x2cfbcf];return _0x41fc13;};'use strict';var Sequelize=require(_0x739a('0x0'));var rs=require(_0x739a('0x1'));module[_0x739a('0x2')]={'name':{'type':Sequelize[_0x739a('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x739a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x739a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x739a('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x739a('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x739a('0x4'),_0x739a('0x5'),'clicksend','plivo',_0x739a('0x6'),_0x739a('0x7'),_0x739a('0x8'),'infobip',_0x739a('0x9'))},'accountSid':{'type':Sequelize[_0x739a('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x739a('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x739a('0x3')]},'password':{'type':Sequelize[_0x739a('0x3')]},'apiKey':{'type':Sequelize[_0x739a('0x3')]},'applicationId':{'type':Sequelize[_0x739a('0x3')]},'accountId':{'type':Sequelize[_0x739a('0x3')]},'senderString':{'type':Sequelize[_0x739a('0x3')]},'deliveryReport':{'type':Sequelize[_0x739a('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x739a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x739a('0xc')],'defaultValue':function(){return _0x739a('0xd');}},'notificationSound':{'type':Sequelize[_0x739a('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x739a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x739a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x739a('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x739a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x739a('0xe')],'comment':_0x739a('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x739a('0xb')],'defaultValue':![],'comment':_0x739a('0x10'),'set':function(_0x21f84f){if(!_0x21f84f)this[_0x739a('0x11')](_0x739a('0x12'),null);this['setDataValue'](_0x739a('0x13'),_0x21f84f);}}}; \ No newline at end of file +var _0x9a15=['clicksend','plivo','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x18b6cb,_0x5afbee){var _0x1ad094=function(_0x4d43f5){while(--_0x4d43f5){_0x18b6cb['push'](_0x18b6cb['shift']());}};_0x1ad094(++_0x5afbee);}(_0x9a15,0x71));var _0x59a1=function(_0x5b3ff5,_0x4a5b45){_0x5b3ff5=_0x5b3ff5-0x0;var _0x323902=_0x9a15[_0x5b3ff5];return _0x323902;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x59a1('0x0'));module[_0x59a1('0x1')]={'name':{'type':Sequelize[_0x59a1('0x2')],'unique':_0x59a1('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x59a1('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x59a1('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x59a1('0x2')],'defaultValue':function(){return rs[_0x59a1('0x4')]();}},'phone':{'type':Sequelize[_0x59a1('0x2')]},'type':{'type':Sequelize[_0x59a1('0x5')]('twilio','skebby','connectel',_0x59a1('0x6'),_0x59a1('0x7'),'clickatell',_0x59a1('0x8'),'csc',_0x59a1('0x9'),_0x59a1('0xa'))},'accountSid':{'type':Sequelize[_0x59a1('0x2')]},'authId':{'type':Sequelize[_0x59a1('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x59a1('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x59a1('0x2')]},'applicationId':{'type':Sequelize[_0x59a1('0x2')]},'accountId':{'type':Sequelize[_0x59a1('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x59a1('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x59a1('0x2')]},'notificationTemplate':{'type':Sequelize[_0x59a1('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x59a1('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x59a1('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x59a1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59a1('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x59a1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x59a1('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x59a1('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x59a1('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x394d34){if(!_0x394d34)this[_0x59a1('0xe')](_0x59a1('0xf'),null);this[_0x59a1('0xe')](_0x59a1('0x10'),_0x394d34);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2738b92..c99b96a 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 _0xbf32=['SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','name','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','notify','sms','SmsApplication','Applications','applications','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','fromNumber','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','finally','getApplications','getInteractions','User','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','message_id','status_code','infobip','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','bandwidth','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','getAgents','rimraf','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info'];(function(_0x299d27,_0x4cbc19){var _0x5692a1=function(_0x431513){while(--_0x431513){_0x299d27['push'](_0x299d27['shift']());}};_0x5692a1(++_0x4cbc19);}(_0xbf32,0xbe));var _0x2bf3=function(_0x9628ba,_0x8abd82){_0x9628ba=_0x9628ba-0x0;var _0x8ea0a8=_0xbf32[_0x9628ba];return _0x8ea0a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bf3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bf3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2bf3('0x2'));var util=require('util');var path=require('path');var sox=require(_0x2bf3('0x3'));var csv=require(_0x2bf3('0x4'));var ejs=require(_0x2bf3('0x5'));var fs=require('fs');var fs_extra=require(_0x2bf3('0x6'));var _=require(_0x2bf3('0x7'));var squel=require(_0x2bf3('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2bf3('0x9'));var toCsv=require(_0x2bf3('0x4'));var querystring=require(_0x2bf3('0xa'));var Papa=require(_0x2bf3('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2bf3('0xc'));var as=require(_0x2bf3('0xd'));var hardwareService=require(_0x2bf3('0xe'));var logger=require('../../config/logger')(_0x2bf3('0xf'));var utils=require('../../config/utils');var config=require(_0x2bf3('0x10'));var licenseUtil=require(_0x2bf3('0x11'));var db=require('../../mysqldb')['db'];config[_0x2bf3('0x12')]=_[_0x2bf3('0x13')](config[_0x2bf3('0x12')],{'host':_0x2bf3('0x14'),'port':0x18eb});var socket=require(_0x2bf3('0x15'))(new Redis(config[_0x2bf3('0x12')]));require(_0x2bf3('0x16'))[_0x2bf3('0x17')](socket);var jayson=require(_0x2bf3('0x18'));var client=jayson[_0x2bf3('0x19')][_0x2bf3('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x4acd3a,_0x308e9f,_0x48e58d,_0xb1b6b2){return new BPromise(function(_0x1cb5da,_0x15624f){var _0x37f54e=_0xb1b6b2||client;return _0x37f54e['request'](_0x4acd3a,_0x48e58d)[_0x2bf3('0x1b')](function(_0x4b3f82){logger[_0x2bf3('0x1c')](_0x2bf3('0x1d'),_0x308e9f,_0x2bf3('0x1e'));logger[_0x2bf3('0x1f')](_0x2bf3('0x20'),_0x308e9f,'request\x20sent',JSON[_0x2bf3('0x21')](_0x4b3f82));if(_0x4b3f82[_0x2bf3('0x22')]){if(_0x4b3f82[_0x2bf3('0x22')]['code']===0x1f4){logger[_0x2bf3('0x22')]('SmsAccount,\x20%s,\x20%s',_0x308e9f,_0x4b3f82[_0x2bf3('0x22')][_0x2bf3('0x23')]);return _0x15624f(_0x4b3f82['error'][_0x2bf3('0x23')]);}logger['error'](_0x2bf3('0x1d'),_0x308e9f,_0x4b3f82['error']['message']);return _0x1cb5da(_0x4b3f82[_0x2bf3('0x22')][_0x2bf3('0x23')]);}else{logger[_0x2bf3('0x1c')](_0x2bf3('0x1d'),_0x308e9f,_0x2bf3('0x1e'));_0x1cb5da(_0x4b3f82[_0x2bf3('0x24')]['message']);}})[_0x2bf3('0x25')](function(_0x19b2a4){logger['error'](_0x2bf3('0x1d'),_0x308e9f,_0x19b2a4);_0x15624f(_0x19b2a4);});});}function respondWithStatusCode(_0x22ec87,_0x4fb0c7){_0x4fb0c7=_0x4fb0c7||0xcc;return function(_0x115c13){if(_0x115c13){return _0x22ec87[_0x2bf3('0x26')](_0x4fb0c7);}return _0x22ec87[_0x2bf3('0x27')](_0x4fb0c7)[_0x2bf3('0x28')]();};}function respondWithResult(_0x30f663,_0x4f28bb){_0x4f28bb=_0x4f28bb||0xc8;return function(_0xe10b82){if(_0xe10b82){return _0x30f663[_0x2bf3('0x27')](_0x4f28bb)[_0x2bf3('0x29')](_0xe10b82);}};}function respondWithFilteredResult(_0x1ebd7c,_0x13f01b){return function(_0x69a9ee){if(_0x69a9ee){var _0x2e1e1b=typeof _0x13f01b[_0x2bf3('0x2a')]===_0x2bf3('0x2b')&&typeof _0x13f01b['limit']===_0x2bf3('0x2b');var _0x4734ca=_0x69a9ee['count'];var _0x24e674=_0x2e1e1b?0x0:_0x13f01b['offset'];var _0x168651=_0x2e1e1b?_0x69a9ee[_0x2bf3('0x2c')]:_0x13f01b[_0x2bf3('0x2a')]+_0x13f01b[_0x2bf3('0x2d')];var _0x33df23;if(_0x168651>=_0x4734ca){_0x168651=_0x4734ca;_0x33df23=0xc8;}else{_0x33df23=0xce;}_0x1ebd7c[_0x2bf3('0x27')](_0x33df23);return _0x1ebd7c['set']('Content-Range',_0x24e674+'-'+_0x168651+'/'+_0x4734ca)[_0x2bf3('0x29')](_0x69a9ee);}return null;};}function patchUpdates(_0x4b9e95){return function(_0x4fb4fd){try{jsonpatch[_0x2bf3('0x2e')](_0x4fb4fd,_0x4b9e95,!![]);}catch(_0x5dff75){return BPromise[_0x2bf3('0x2f')](_0x5dff75);}return _0x4fb4fd[_0x2bf3('0x30')]();};}function saveUpdates(_0x184e3a,_0x36ab30){return function(_0x5f1ca6){if(_0x5f1ca6){return _0x5f1ca6[_0x2bf3('0x31')](_0x184e3a)[_0x2bf3('0x1b')](function(_0x49e19a){return _0x49e19a;});}return null;};}function removeEntity(_0x252c1f,_0x32504a){return function(_0x49e416){if(_0x49e416){return _0x49e416[_0x2bf3('0x32')]()[_0x2bf3('0x1b')](function(){var _0x19ed15=_0x49e416[_0x2bf3('0x33')]({'plain':!![]});var _0x3f0f7c=_0x2bf3('0x34');return db[_0x2bf3('0x35')][_0x2bf3('0x32')]({'where':{'type':_0x3f0f7c,'resourceId':_0x19ed15['id']}})[_0x2bf3('0x1b')](function(){return _0x49e416;});})[_0x2bf3('0x1b')](function(){_0x252c1f[_0x2bf3('0x27')](0xcc)[_0x2bf3('0x28')]();});}};}function handleEntityNotFound(_0x4d4310,_0x5cec71){return function(_0x996356){if(!_0x996356){_0x4d4310[_0x2bf3('0x26')](0x194);}return _0x996356;};}function handleError(_0x157022,_0x3f6cf7){_0x3f6cf7=_0x3f6cf7||0x1f4;return function(_0x4d613){logger[_0x2bf3('0x22')](_0x4d613['stack']);if(_0x4d613[_0x2bf3('0x36')]){delete _0x4d613['name'];}_0x157022[_0x2bf3('0x27')](_0x3f6cf7)['send'](_0x4d613);};}exports['index']=function(_0x30b34b,_0x34567b){var _0x4529a5={'include':[{'model':db[_0x2bf3('0x37')],'as':'mandatoryDispositionPause'}]},_0x4f3938={},_0xf9a23c={'count':0x0,'rows':[]};var _0x18999b=_['map'](db[_0x2bf3('0x38')][_0x2bf3('0x39')],function(_0x46d420){return{'name':_0x46d420[_0x2bf3('0x3a')],'type':_0x46d420[_0x2bf3('0x3b')][_0x2bf3('0x3c')]};});_0x4f3938[_0x2bf3('0x3d')]=_[_0x2bf3('0x3e')](_0x18999b,_0x2bf3('0x36'));_0x4f3938[_0x2bf3('0x3f')]=_['keys'](_0x30b34b['query']);_0x4f3938[_0x2bf3('0x40')]=_[_0x2bf3('0x41')](_0x4f3938[_0x2bf3('0x3d')],_0x4f3938[_0x2bf3('0x3f')]);_0x4529a5[_0x2bf3('0x42')]=_[_0x2bf3('0x41')](_0x4f3938['model'],qs[_0x2bf3('0x43')](_0x30b34b[_0x2bf3('0x3f')][_0x2bf3('0x43')]));_0x4529a5[_0x2bf3('0x42')]=_0x4529a5[_0x2bf3('0x42')][_0x2bf3('0x44')]?_0x4529a5[_0x2bf3('0x42')]:_0x4f3938[_0x2bf3('0x3d')];if(!_0x30b34b['query'][_0x2bf3('0x45')](_0x2bf3('0x46'))){_0x4529a5['limit']=qs['limit'](_0x30b34b[_0x2bf3('0x3f')][_0x2bf3('0x2d')]);_0x4529a5[_0x2bf3('0x2a')]=qs['offset'](_0x30b34b['query'][_0x2bf3('0x2a')]);}_0x4529a5['order']=qs[_0x2bf3('0x47')](_0x30b34b[_0x2bf3('0x3f')][_0x2bf3('0x47')]);_0x4529a5['where']=qs[_0x2bf3('0x40')](_[_0x2bf3('0x48')](_0x30b34b[_0x2bf3('0x3f')],_0x4f3938[_0x2bf3('0x40')]),_0x18999b);if(_0x30b34b[_0x2bf3('0x3f')]['filter']){_0x4529a5[_0x2bf3('0x49')]=_[_0x2bf3('0x4a')](_0x4529a5['where'],{'$or':_[_0x2bf3('0x3e')](_0x18999b,function(_0x181c8d){if(_0x181c8d['type']!=='VIRTUAL'){var _0x164794={};_0x164794[_0x181c8d[_0x2bf3('0x36')]]={'$like':'%'+_0x30b34b['query'][_0x2bf3('0x4b')]+'%'};return _0x164794;}})});}_0x4529a5=_[_0x2bf3('0x4a')]({},_0x4529a5,_0x30b34b[_0x2bf3('0x4c')]);var _0x1a44ea={'where':_0x4529a5[_0x2bf3('0x49')]};return db[_0x2bf3('0x38')][_0x2bf3('0x2c')](_0x1a44ea)[_0x2bf3('0x1b')](function(_0x12e6d6){_0xf9a23c[_0x2bf3('0x2c')]=_0x12e6d6;if(_0x30b34b['query'][_0x2bf3('0x4d')]){_0x4529a5[_0x2bf3('0x4e')]=[{'all':!![]}];}return db[_0x2bf3('0x38')][_0x2bf3('0x4f')](_0x4529a5);})['then'](function(_0x365fe1){_0xf9a23c[_0x2bf3('0x50')]=_0x365fe1;return _0xf9a23c;})[_0x2bf3('0x1b')](respondWithFilteredResult(_0x34567b,_0x4529a5))[_0x2bf3('0x25')](handleError(_0x34567b,null));};exports[_0x2bf3('0x51')]=function(_0x5e8384,_0x1afad5){var _0x1fa91c={'raw':![],'where':{'id':_0x5e8384[_0x2bf3('0x52')]['id']},'include':[{'model':db[_0x2bf3('0x37')],'as':_0x2bf3('0x53')}]},_0x1878ce={};_0x1878ce[_0x2bf3('0x3d')]=_[_0x2bf3('0x54')](db[_0x2bf3('0x38')][_0x2bf3('0x39')]);_0x1878ce[_0x2bf3('0x3f')]=_[_0x2bf3('0x54')](_0x5e8384[_0x2bf3('0x3f')]);_0x1878ce[_0x2bf3('0x40')]=_[_0x2bf3('0x41')](_0x1878ce[_0x2bf3('0x3d')],_0x1878ce[_0x2bf3('0x3f')]);_0x1fa91c[_0x2bf3('0x42')]=_[_0x2bf3('0x41')](_0x1878ce[_0x2bf3('0x3d')],qs[_0x2bf3('0x43')](_0x5e8384[_0x2bf3('0x3f')][_0x2bf3('0x43')]));_0x1fa91c['attributes']=_0x1fa91c['attributes'][_0x2bf3('0x44')]?_0x1fa91c[_0x2bf3('0x42')]:_0x1878ce[_0x2bf3('0x3d')];if(_0x5e8384[_0x2bf3('0x3f')][_0x2bf3('0x4d')]){_0x1fa91c['include']=[{'all':!![]}];}_0x1fa91c=_['merge']({},_0x1fa91c,_0x5e8384[_0x2bf3('0x4c')]);return db['SmsAccount']['find'](_0x1fa91c)[_0x2bf3('0x1b')](handleEntityNotFound(_0x1afad5,null))[_0x2bf3('0x1b')](respondWithResult(_0x1afad5,null))['catch'](handleError(_0x1afad5,null));};exports[_0x2bf3('0x55')]=function(_0x557c52,_0x174b80){return db[_0x2bf3('0x38')][_0x2bf3('0x55')](_0x557c52['body'],{})[_0x2bf3('0x1b')](function(_0x5121b1){var _0x24b6ec=_0x557c52[_0x2bf3('0x56')][_0x2bf3('0x33')]({'plain':!![]});if(!_0x24b6ec)throw new Error(_0x2bf3('0x57'));if(_0x24b6ec['role']===_0x2bf3('0x56')){var _0x352fa0=_0x5121b1[_0x2bf3('0x33')]({'plain':!![]});var _0x129db0='SmsAccounts';return db[_0x2bf3('0x58')]['find']({'where':{'name':_0x129db0,'userProfileId':_0x24b6ec['userProfileId']},'raw':!![]})[_0x2bf3('0x1b')](function(_0x322a76){if(_0x322a76&&_0x322a76['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x352fa0[_0x2bf3('0x36')],'resourceId':_0x352fa0['id'],'type':_0x322a76[_0x2bf3('0x36')],'sectionId':_0x322a76['id']},{})['then'](function(){return _0x5121b1;});}else{return _0x5121b1;}})[_0x2bf3('0x25')](function(_0x174397){logger['error'](_0x2bf3('0x59'),_0x174397);throw _0x174397;});}return _0x5121b1;})[_0x2bf3('0x1b')](respondWithResult(_0x174b80,0xc9))[_0x2bf3('0x25')](handleError(_0x174b80,null));};exports['update']=function(_0x2f8afd,_0x10e4b4){if(_0x2f8afd[_0x2bf3('0x5a')]['id']){delete _0x2f8afd[_0x2bf3('0x5a')]['id'];}return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x2f8afd[_0x2bf3('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x2bf3('0x53')}]})[_0x2bf3('0x1b')](handleEntityNotFound(_0x10e4b4,null))[_0x2bf3('0x1b')](saveUpdates(_0x2f8afd['body'],null))[_0x2bf3('0x1b')](respondWithResult(_0x10e4b4,null))[_0x2bf3('0x25')](handleError(_0x10e4b4,null));};exports[_0x2bf3('0x32')]=function(_0x1426d2,_0xec437f){return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x1426d2[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0xec437f,null))[_0x2bf3('0x1b')](removeEntity(_0xec437f,null))[_0x2bf3('0x25')](handleError(_0xec437f,null));};exports[_0x2bf3('0x5c')]=function(_0x3b16fe,_0x265291){return db[_0x2bf3('0x38')][_0x2bf3('0x5c')]()[_0x2bf3('0x1b')](respondWithResult(_0x265291,null))[_0x2bf3('0x25')](handleError(_0x265291,null));};exports[_0x2bf3('0x5d')]=function(_0x89de62,_0x406001,_0x2a2288){if(_0x89de62['body']['id']){delete _0x89de62[_0x2bf3('0x5a')]['id'];}return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x89de62[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x406001,null))[_0x2bf3('0x1b')](function(_0x47aaa6){if(_0x47aaa6){_0x89de62[_0x2bf3('0x5a')][_0x2bf3('0x5e')]=_0x47aaa6['id'];return db[_0x2bf3('0x5f')][_0x2bf3('0x55')](_0x89de62[_0x2bf3('0x5a')]);}})['then'](respondWithResult(_0x406001,null))[_0x2bf3('0x25')](handleError(_0x406001,null));};exports[_0x2bf3('0x60')]=function(_0x527de2,_0x4d637c,_0x571e96){var _0x584aba={'raw':![],'where':{}};var _0xdf9e3a={};var _0x6b7cf2={'count':0x0,'rows':[]};return db[_0x2bf3('0x38')][_0x2bf3('0x61')]({'where':{'id':_0x527de2['params']['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x4d637c,null))[_0x2bf3('0x1b')](function(_0x1ef21b){if(_0x1ef21b){_0xdf9e3a[_0x2bf3('0x3d')]=_['keys'](db[_0x2bf3('0x5f')][_0x2bf3('0x39')]);_0xdf9e3a[_0x2bf3('0x3f')]=_['keys'](_0x527de2['query']);_0xdf9e3a[_0x2bf3('0x40')]=_[_0x2bf3('0x41')](_0xdf9e3a[_0x2bf3('0x3d')],_0xdf9e3a[_0x2bf3('0x3f')]);_0x584aba[_0x2bf3('0x42')]=_[_0x2bf3('0x41')](_0xdf9e3a['model'],qs[_0x2bf3('0x43')](_0x527de2['query'][_0x2bf3('0x43')]));_0x584aba[_0x2bf3('0x42')]=_0x584aba['attributes'][_0x2bf3('0x44')]?_0x584aba[_0x2bf3('0x42')]:_0xdf9e3a[_0x2bf3('0x3d')];if(!_0x527de2['query']['hasOwnProperty'](_0x2bf3('0x46'))){_0x584aba['limit']=qs[_0x2bf3('0x2d')](_0x527de2[_0x2bf3('0x3f')][_0x2bf3('0x2d')]);_0x584aba[_0x2bf3('0x2a')]=qs[_0x2bf3('0x2a')](_0x527de2[_0x2bf3('0x3f')]['offset']);}_0x584aba[_0x2bf3('0x62')]=qs[_0x2bf3('0x47')](_0x527de2[_0x2bf3('0x3f')][_0x2bf3('0x47')]);_0x584aba[_0x2bf3('0x49')]=qs[_0x2bf3('0x40')](_[_0x2bf3('0x48')](_0x527de2[_0x2bf3('0x3f')],_0xdf9e3a[_0x2bf3('0x40')]));_0x584aba[_0x2bf3('0x49')][_0x2bf3('0x5e')]=_0x1ef21b['id'];if(_0x527de2[_0x2bf3('0x3f')][_0x2bf3('0x4b')]){_0x584aba[_0x2bf3('0x49')]=_[_0x2bf3('0x4a')](_0x584aba[_0x2bf3('0x49')],{'$or':_[_0x2bf3('0x3e')](_0x584aba[_0x2bf3('0x42')],function(_0x2cf055){var _0x4f202b={};_0x4f202b[_0x2cf055]={'$like':'%'+_0x527de2['query'][_0x2bf3('0x4b')]+'%'};return _0x4f202b;})});}_0x584aba=_[_0x2bf3('0x4a')]({},_0x584aba,_0x527de2[_0x2bf3('0x4c')]);return db['Disposition'][_0x2bf3('0x2c')]({'where':_0x584aba[_0x2bf3('0x49')]})[_0x2bf3('0x1b')](function(_0x24dc45){_0x6b7cf2[_0x2bf3('0x2c')]=_0x24dc45;if(_0x527de2[_0x2bf3('0x3f')][_0x2bf3('0x4d')]){_0x584aba[_0x2bf3('0x4e')]=[{'all':!![]}];}return db[_0x2bf3('0x5f')]['findAll'](_0x584aba);})[_0x2bf3('0x1b')](function(_0x104cc3){_0x6b7cf2[_0x2bf3('0x50')]=_0x104cc3;return _0x6b7cf2;});}})['then'](respondWithFilteredResult(_0x4d637c,_0x584aba))['catch'](handleError(_0x4d637c,null));};exports[_0x2bf3('0x63')]=function(_0x5a0c0e,_0x33f9a6,_0x2404f8){return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x5a0c0e['params']['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x33f9a6,null))[_0x2bf3('0x1b')](function(_0x4bb65b){if(_0x4bb65b){return _0x4bb65b['removeDispositions'](_0x5a0c0e[_0x2bf3('0x3f')][_0x2bf3('0x64')]);}})['then'](respondWithStatusCode(_0x33f9a6,null))['catch'](handleError(_0x33f9a6,null));};exports[_0x2bf3('0x65')]=function(_0x4e1b2a,_0xfcc551,_0x38a300){if(_0x4e1b2a[_0x2bf3('0x5a')]['id']){delete _0x4e1b2a['body']['id'];}return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x4e1b2a[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0xfcc551,null))[_0x2bf3('0x1b')](function(_0x2b7542){if(_0x2b7542){_0x4e1b2a[_0x2bf3('0x5a')]['SmsAccountId']=_0x2b7542['id'];return db[_0x2bf3('0x66')][_0x2bf3('0x55')](_0x4e1b2a[_0x2bf3('0x5a')]);}})['then'](respondWithResult(_0xfcc551,null))[_0x2bf3('0x25')](handleError(_0xfcc551,null));};exports['getAnswers']=function(_0x369d46,_0x496da8,_0x12225f){var _0xef50bd={'raw':![],'where':{}};var _0x79260d={};var _0xd35c86={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2bf3('0x61')]({'where':{'id':_0x369d46['params']['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x496da8,null))[_0x2bf3('0x1b')](function(_0x31ec83){if(_0x31ec83){_0x79260d['model']=_[_0x2bf3('0x54')](db[_0x2bf3('0x66')][_0x2bf3('0x39')]);_0x79260d[_0x2bf3('0x3f')]=_['keys'](_0x369d46[_0x2bf3('0x3f')]);_0x79260d['filters']=_[_0x2bf3('0x41')](_0x79260d[_0x2bf3('0x3d')],_0x79260d[_0x2bf3('0x3f')]);_0xef50bd[_0x2bf3('0x42')]=_['intersection'](_0x79260d[_0x2bf3('0x3d')],qs[_0x2bf3('0x43')](_0x369d46[_0x2bf3('0x3f')]['fields']));_0xef50bd['attributes']=_0xef50bd['attributes']['length']?_0xef50bd['attributes']:_0x79260d[_0x2bf3('0x3d')];if(!_0x369d46[_0x2bf3('0x3f')][_0x2bf3('0x45')]('nolimit')){_0xef50bd[_0x2bf3('0x2d')]=qs['limit'](_0x369d46[_0x2bf3('0x3f')][_0x2bf3('0x2d')]);_0xef50bd['offset']=qs[_0x2bf3('0x2a')](_0x369d46[_0x2bf3('0x3f')][_0x2bf3('0x2a')]);}_0xef50bd['order']=qs[_0x2bf3('0x47')](_0x369d46['query']['sort']);_0xef50bd[_0x2bf3('0x49')]=qs[_0x2bf3('0x40')](_[_0x2bf3('0x48')](_0x369d46['query'],_0x79260d[_0x2bf3('0x40')]));_0xef50bd[_0x2bf3('0x49')][_0x2bf3('0x5e')]=_0x31ec83['id'];if(_0x369d46[_0x2bf3('0x3f')][_0x2bf3('0x4b')]){_0xef50bd[_0x2bf3('0x49')]=_[_0x2bf3('0x4a')](_0xef50bd[_0x2bf3('0x49')],{'$or':_[_0x2bf3('0x3e')](_0xef50bd[_0x2bf3('0x42')],function(_0x5c7018){var _0x25398c={};_0x25398c[_0x5c7018]={'$like':'%'+_0x369d46[_0x2bf3('0x3f')]['filter']+'%'};return _0x25398c;})});}_0xef50bd=_['merge']({},_0xef50bd,_0x369d46[_0x2bf3('0x4c')]);return db[_0x2bf3('0x66')][_0x2bf3('0x2c')]({'where':_0xef50bd['where']})['then'](function(_0x2da377){_0xd35c86[_0x2bf3('0x2c')]=_0x2da377;if(_0x369d46[_0x2bf3('0x3f')]['includeAll']){_0xef50bd['include']=[{'all':!![]}];}return db[_0x2bf3('0x66')][_0x2bf3('0x4f')](_0xef50bd);})[_0x2bf3('0x1b')](function(_0x5a1b32){_0xd35c86[_0x2bf3('0x50')]=_0x5a1b32;return _0xd35c86;});}})[_0x2bf3('0x1b')](respondWithFilteredResult(_0x496da8,_0xef50bd))[_0x2bf3('0x25')](handleError(_0x496da8,null));};exports['removeAnswers']=function(_0x3cff91,_0x2d261f,_0x46f340){return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x3cff91[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x2d261f,null))[_0x2bf3('0x1b')](function(_0x1b563c){if(_0x1b563c){return _0x1b563c['removeAnswers'](_0x3cff91['query'][_0x2bf3('0x64')]);}})[_0x2bf3('0x1b')](respondWithStatusCode(_0x2d261f,null))[_0x2bf3('0x25')](handleError(_0x2d261f,null));};exports[_0x2bf3('0x67')]=function(_0xf28c72,_0x214d95,_0x4c721c){var _0x2f9812={'channel':_0x2bf3('0x68')};var _0x1b186c=[];var _0x2ddcb1=[];var _0x51524e={};return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0xf28c72[_0x2bf3('0x52')]['id']},'include':[{'model':db[_0x2bf3('0x69')],'as':_0x2bf3('0x6a')}]})[_0x2bf3('0x1b')](handleEntityNotFound(_0x214d95,null))[_0x2bf3('0x1b')](function(_0xc3fc02){_0x2f9812['account']=_0xc3fc02;_0x2f9812[_0x2bf3('0x6b')]=_['orderBy'](_0xc3fc02[_0x2bf3('0x6a')],['priority'],[_0x2bf3('0x6c')]);if(_0x2f9812[_0x2bf3('0x6d')][_0x2bf3('0x6a')]){delete _0x2f9812['account'][_0x2bf3('0x6a')];}return db[_0x2bf3('0x6e')]['describe']();})['then'](function(_0x217943){if(!_0x217943){throw new db['Sequelize'][(_0x2bf3('0x6f'))](_0x2bf3('0x70'));}_0x1b186c=_[_0x2bf3('0x71')](_[_0x2bf3('0x54')](_0x217943),[_0x2bf3('0x72'),'updatedAt']);_0x2ddcb1=_[_0x2bf3('0x71')](_[_0x2bf3('0x54')](_0x217943),[_0x2bf3('0x72'),_0x2bf3('0x73'),_0x2bf3('0x74'),_0x2bf3('0x75')]);_0x2f9812['body']={'mapKey':_0x2bf3('0x76')};if(_0x2f9812[_0x2bf3('0x6d')]['type']){switch(_0x2f9812[_0x2bf3('0x6d')]['type']){case'twilio':_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x78')];_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x5a')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x79')];_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x7a')]=_0xf28c72[_0x2bf3('0x5a')]['MessageSid'];break;case _0x2bf3('0x7b'):_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]='+'+_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x7c')];_0x2f9812['body'][_0x2bf3('0x5a')]=_0xf28c72['body'][_0x2bf3('0x7d')];break;case _0x2bf3('0x7e'):_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]=_0xf28c72[_0x2bf3('0x5a')]['from'];_0x2f9812['body'][_0x2bf3('0x5a')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x23')];break;case _0x2bf3('0x7f'):_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x77')];_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x5a')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x5a')];_0x2f9812[_0x2bf3('0x5a')]['messageId']=_0xf28c72[_0x2bf3('0x5a')]['message_id'];break;case _0x2bf3('0x80'):_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]=_0xf28c72['body'][_0x2bf3('0x78')];_0x2f9812['body'][_0x2bf3('0x5a')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x81')];_0x2f9812[_0x2bf3('0x5a')]['messageId']=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x82')];break;case'infobip':_0x2f9812[_0x2bf3('0x5a')]['from']='+'+_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x83')][0x0][_0x2bf3('0x77')];_0x2f9812[_0x2bf3('0x5a')]['body']=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x83')][0x0][_0x2bf3('0x7d')];_0x2f9812[_0x2bf3('0x5a')]['messageId']=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x83')][0x0][_0x2bf3('0x7a')];break;case'csc':_0x2f9812[_0x2bf3('0x5a')]['from']=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x84')];_0x2f9812['body'][_0x2bf3('0x5a')]=_0xf28c72['body'][_0x2bf3('0x85')][_0x2bf3('0x23')];break;case _0x2bf3('0x86'):_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x87')];_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x5a')]=_0xf28c72['body']['text'];_0x2f9812[_0x2bf3('0x5a')]['messageId']=_0xf28c72[_0x2bf3('0x5a')]['replyMessageId'];break;case'bandwidth':_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x7a')]=_0xf28c72[_0x2bf3('0x5a')][0x0][_0x2bf3('0x23')]['id'];_0x2f9812[_0x2bf3('0x5a')]['from']=_0xf28c72[_0x2bf3('0x5a')][0x0]['message'][_0x2bf3('0x77')];_0x2f9812[_0x2bf3('0x5a')]['body']=_0xf28c72['body'][0x0][_0x2bf3('0x23')][_0x2bf3('0x7d')];break;case'intelepeer':_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')]=_0xf28c72[_0x2bf3('0x5a')][_0x2bf3('0x77')];_0x2f9812[_0x2bf3('0x5a')]['body']=_0xf28c72[_0x2bf3('0x5a')]['message'];_0x2f9812['body'][_0x2bf3('0x7a')]=_0xf28c72[_0x2bf3('0x5a')]['refid'];break;}}if(_0x2f9812['body']['id']){delete _0x2f9812[_0x2bf3('0x5a')]['id'];}if(_[_0x2bf3('0x88')](_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')])){throw new db[(_0x2bf3('0x89'))]['ValidationError'](_0x2bf3('0x8a'));}if(_[_0x2bf3('0x88')](_0x2f9812['body'][_0x2bf3('0x5a')])||_0x2f9812[_0x2bf3('0x5a')]['body']===''){throw new db[(_0x2bf3('0x89'))][(_0x2bf3('0x6f'))](_0x2bf3('0x8b'));}if(_[_0x2bf3('0x88')](_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x8c')])){throw new db[(_0x2bf3('0x89'))][(_0x2bf3('0x6f'))](_0x2bf3('0x8d')+_0x2ddcb1);}if(!_[_0x2bf3('0x8e')](_0x2ddcb1,_0x2f9812['body'][_0x2bf3('0x8c')])){throw new db[(_0x2bf3('0x89'))][(_0x2bf3('0x6f'))](_0x2bf3('0x8f')+_0x2ddcb1);}_0x51524e[_0x2f9812['body']['mapKey']]=_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')];return db[_0x2bf3('0x90')][_0x2bf3('0x5b')]({'where':{'id':_0x2f9812[_0x2bf3('0x6d')]['ListId']},'include':[{'model':db[_0x2bf3('0x6e')],'as':'Contacts','where':_0x51524e,'limit':0x1,'order':[[_0x2bf3('0x73'),_0x2bf3('0x91')]]}]});})[_0x2bf3('0x1b')](handleEntityNotFound(_0x214d95,null))[_0x2bf3('0x1b')](function(_0x5b1196){if(_0x5b1196){_0x2f9812[_0x2bf3('0x92')]=_[_0x2bf3('0x93')](_0x5b1196,[_0x2bf3('0x94')]);if(_0x5b1196['Contacts'][_0x2bf3('0x44')]){return _0x5b1196['Contacts'][0x0];}var _0x113f86=_[_0x2bf3('0x13')](_0x2f9812[_0x2bf3('0x5a')],{'firstName':_0x2f9812['body'][_0x2bf3('0x77')],'ListId':_0x5b1196['id']});_0x113f86[_0x2f9812['body'][_0x2bf3('0x8c')]]=_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')];return db[_0x2bf3('0x6e')][_0x2bf3('0x55')](_0x113f86,{'fields':_0x1b186c,'raw':!![]});}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x214d95,null))[_0x2bf3('0x1b')](function(_0x438589){if(_0x438589){_0x2f9812[_0x2bf3('0x95')]=_0x438589;var _0xfbb339={'ContactId':_0x438589['id'],'phone':_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')],'SmsAccountId':_0xf28c72['params']['id']};var _0x3aaab4={'ContactId':_0x438589['id'],'SmsAccountId':_0xf28c72[_0x2bf3('0x52')]['id'],'closed':![]};return db[_0x2bf3('0x96')][_0x2bf3('0x5b')]({'where':_0x3aaab4})[_0x2bf3('0x1b')](function(_0x4ff24a){if(_0x4ff24a){return[_0x4ff24a,![]];}return db['SmsInteraction']['create'](_0xfbb339)['then'](function(_0x452e20){return[_0x452e20,!![]];});});}})['spread'](function(_0x6f0bc0,_0xa6b40d){_0x2f9812['interaction']=_0x6f0bc0['get']({'plain':!![]});_0x2f9812[_0x2bf3('0x97')][_0x2bf3('0x98')]=![];if(_0xa6b40d){if(_0x2f9812[_0x2bf3('0x6d')][_0x2bf3('0x99')]){_0x2f9812[_0x2bf3('0x6b')][_0x2bf3('0x9a')]({'id':0x0,'priority':_0x2f9812[_0x2bf3('0x6b')]['length']+0x1,'app':_0x2bf3('0x9b'),'appdata':_0x2bf3('0x9c'),'interval':'*,*,*,*'});}_0x2f9812[_0x2bf3('0x97')][_0x2bf3('0x98')]=!![];}return db[_0x2bf3('0x9d')]['create']({'phone':_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x77')],'messageId':_0x2f9812['body'][_0x2bf3('0x7a')],'body':_0x2f9812['body']['body'],'SmsAccountId':_0xf28c72['params']['id'],'SmsInteractionId':_0x6f0bc0['id'],'direction':'in','ContactId':_0x6f0bc0['ContactId'],'AttachmentId':_0x2f9812[_0x2bf3('0x5a')][_0x2bf3('0x9e')]});})[_0x2bf3('0x1b')](function(_0x577480){_0x2f9812[_0x2bf3('0x23')]=_0x577480;if(_0x2f9812[_0x2bf3('0x97')]['UserId']){return db['User']['find']({'attributes':['id',_0x2bf3('0x36')],'where':{'id':_0x2f9812['interaction'][_0x2bf3('0x9f')]}})[_0x2bf3('0x1b')](function(_0x1a0ac6){if(_0x1a0ac6){_0x2f9812[_0x2bf3('0x6b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2bf3('0xa0'),'appdata':_0x1a0ac6[_0x2bf3('0x36')]+','+(_0x2f9812[_0x2bf3('0x6d')]['waitForTheAssignedAgent']||0xa),'interval':_0x2bf3('0xa1')});}return respondWithRpcPromise(_0x2bf3('0xa2'),_0x2bf3('0xa3'),_0x2f9812);});}return respondWithRpcPromise(_0x2bf3('0xa2'),_0x2bf3('0xa3'),_0x2f9812);})[_0x2bf3('0x1b')](function(_0x30efd5){if(_0x30efd5){var _0x51470e=0xc8;var _0x35b5c4=_0x2bf3('0xa4');logger[_0x2bf3('0x1c')](_0x2bf3('0x20'),_0x35b5c4,_0x51470e,_0x2bf3('0xa5'));logger[_0x2bf3('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x35b5c4,_0x51470e,'entity\x20found',JSON[_0x2bf3('0x21')](_0x30efd5));if(_0x2f9812[_0x2bf3('0x6d')][_0x2bf3('0x3b')]===_0x2bf3('0xa6')){return _0x214d95[_0x2bf3('0x27')](_0x51470e)['set'](_0x2bf3('0xa7'),_0x2bf3('0xa8'))[_0x2bf3('0xa9')](_0x2bf3('0xaa'));}else{return _0x214d95[_0x2bf3('0x27')](_0x51470e)[_0x2bf3('0x29')](_0x30efd5);}}})[_0x2bf3('0x25')](handleError(_0x214d95,null));};exports[_0x2bf3('0xab')]=function(_0x1ca60d,_0x41596b){var _0x1d63d3=_0x1ca60d[_0x2bf3('0x52')]['id'];var _0x3a0bad=_0x1ca60d[_0x2bf3('0x5a')];var _0x4a93d7=0xc8;var _0x4e9a0c=null;return db[_0x2bf3('0xac')][_0x2bf3('0xad')]({'isolationLevel':db[_0x2bf3('0xac')][_0x2bf3('0xae')][_0x2bf3('0xaf')][_0x2bf3('0xb0')]},function(_0x3b0ba3){return db['SmsAccount'][_0x2bf3('0x61')]({'where':{'id':_0x1d63d3},'transaction':_0x3b0ba3})['then'](function(_0x211db6){if(_0x211db6){return db[_0x2bf3('0x69')]['destroy']({'where':{'SmsAccountId':_0x1d63d3},'transaction':_0x3b0ba3})['then'](function(){var _0x446767=_['map'](_0x3a0bad,function(_0xd25e13){_0xd25e13[_0x2bf3('0x5e')]=_0x1d63d3;return _0xd25e13;});return db[_0x2bf3('0x69')]['bulkCreate'](_0x446767,{'transaction':_0x3b0ba3});});}else{_0x4a93d7=0x194;_0x4e9a0c=[];}});})[_0x2bf3('0x1b')](function(){if(_0x4a93d7!==0x194){return db[_0x2bf3('0x69')]['findAndCountAll']({'where':{'SmsAccountId':_0x1d63d3},'order':'priority'})[_0x2bf3('0x1b')](function(_0x1659e7){_0x4e9a0c=_0x1659e7;});}})[_0x2bf3('0x25')](function(_0x3700a2){_0x4a93d7=0x1f4;logger['error'](_0x3700a2[_0x2bf3('0xb1')]);if(_0x3700a2[_0x2bf3('0x36')]){delete _0x3700a2[_0x2bf3('0x36')];}_0x4e9a0c=_0x3700a2;})[_0x2bf3('0xb2')](function(){if(_0x4e9a0c===null){_0x41596b[_0x2bf3('0x26')](_0x4a93d7);}else{if(_0x4a93d7===0x1f4){_0x41596b[_0x2bf3('0x27')](_0x4a93d7)[_0x2bf3('0xa9')](_0x4e9a0c);}else{_0x41596b[_0x2bf3('0x27')](_0x4a93d7)[_0x2bf3('0x29')](_0x4e9a0c);}}});};exports[_0x2bf3('0xb3')]=function(_0x1fbbde,_0x35d0e4,_0x41e343){var _0xf45fe5={};var _0x59618c={};var _0x23d27b;var _0x33973b;return db[_0x2bf3('0x38')][_0x2bf3('0x61')]({'where':{'id':_0x1fbbde[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x35d0e4,null))[_0x2bf3('0x1b')](function(_0x22cf37){if(_0x22cf37){_0x23d27b=_0x22cf37;_0x59618c[_0x2bf3('0x3d')]=_[_0x2bf3('0x54')](db[_0x2bf3('0x69')]['rawAttributes']);_0x59618c['query']=_[_0x2bf3('0x54')](_0x1fbbde[_0x2bf3('0x3f')]);_0x59618c[_0x2bf3('0x40')]=_[_0x2bf3('0x41')](_0x59618c[_0x2bf3('0x3d')],_0x59618c[_0x2bf3('0x3f')]);_0xf45fe5[_0x2bf3('0x42')]=_['intersection'](_0x59618c[_0x2bf3('0x3d')],qs[_0x2bf3('0x43')](_0x1fbbde[_0x2bf3('0x3f')]['fields']));_0xf45fe5[_0x2bf3('0x42')]=_0xf45fe5['attributes'][_0x2bf3('0x44')]?_0xf45fe5['attributes']:_0x59618c[_0x2bf3('0x3d')];_0xf45fe5[_0x2bf3('0x62')]=qs['sort'](_0x1fbbde['query'][_0x2bf3('0x47')]);_0xf45fe5['where']=qs[_0x2bf3('0x40')](_[_0x2bf3('0x48')](_0x1fbbde[_0x2bf3('0x3f')],_0x59618c[_0x2bf3('0x40')]));if(_0x1fbbde[_0x2bf3('0x3f')][_0x2bf3('0x4b')]){_0xf45fe5[_0x2bf3('0x49')]=_[_0x2bf3('0x4a')](_0xf45fe5['where'],{'$or':_[_0x2bf3('0x3e')](_0xf45fe5[_0x2bf3('0x42')],function(_0x22eb3d){var _0x529e7e={};_0x529e7e[_0x22eb3d]={'$like':'%'+_0x1fbbde[_0x2bf3('0x3f')][_0x2bf3('0x4b')]+'%'};return _0x529e7e;})});}_0xf45fe5=_[_0x2bf3('0x4a')]({},_0xf45fe5,_0x1fbbde['options']);return _0x23d27b['getApplications'](_0xf45fe5);}})['then'](function(_0x503b81){if(_0x503b81){_0x33973b=_0x503b81[_0x2bf3('0x44')];if(!_0x1fbbde[_0x2bf3('0x3f')][_0x2bf3('0x45')](_0x2bf3('0x46'))){_0xf45fe5[_0x2bf3('0x2d')]=qs[_0x2bf3('0x2d')](_0x1fbbde[_0x2bf3('0x3f')]['limit']);_0xf45fe5['offset']=qs[_0x2bf3('0x2a')](_0x1fbbde['query']['offset']);}return _0x23d27b['getApplications'](_0xf45fe5);}})[_0x2bf3('0x1b')](function(_0x30c911){if(_0x30c911){return _0x30c911?{'count':_0x33973b,'rows':_0x30c911}:null;}})['then'](respondWithResult(_0x35d0e4,null))[_0x2bf3('0x25')](handleError(_0x35d0e4,null));};exports[_0x2bf3('0xb4')]=function(_0x50c28d,_0x590ffd,_0x48185c){var _0x337fcd={'raw':![],'where':{}};var _0x423b68={};var _0x52250c={'count':0x0,'rows':[]};return db[_0x2bf3('0x38')][_0x2bf3('0x61')]({'where':{'id':_0x50c28d[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x590ffd,null))[_0x2bf3('0x1b')](function(_0x26459e){if(_0x26459e){_0x423b68[_0x2bf3('0x3d')]=_[_0x2bf3('0x54')](db[_0x2bf3('0x96')]['rawAttributes']);_0x423b68[_0x2bf3('0x3f')]=_[_0x2bf3('0x54')](_0x50c28d['query']);_0x423b68['filters']=_[_0x2bf3('0x41')](_0x423b68[_0x2bf3('0x3d')],_0x423b68[_0x2bf3('0x3f')]);_0x337fcd[_0x2bf3('0x42')]=_['intersection'](_0x423b68[_0x2bf3('0x3d')],qs[_0x2bf3('0x43')](_0x50c28d[_0x2bf3('0x3f')][_0x2bf3('0x43')]));_0x337fcd[_0x2bf3('0x42')]=_0x337fcd[_0x2bf3('0x42')][_0x2bf3('0x44')]?_0x337fcd[_0x2bf3('0x42')]:_0x423b68[_0x2bf3('0x3d')];if(!_0x50c28d[_0x2bf3('0x3f')][_0x2bf3('0x45')](_0x2bf3('0x46'))){_0x337fcd[_0x2bf3('0x2d')]=qs[_0x2bf3('0x2d')](_0x50c28d[_0x2bf3('0x3f')][_0x2bf3('0x2d')]);_0x337fcd[_0x2bf3('0x2a')]=qs[_0x2bf3('0x2a')](_0x50c28d['query'][_0x2bf3('0x2a')]);}_0x337fcd[_0x2bf3('0x62')]=qs['sort'](_0x50c28d['query'][_0x2bf3('0x47')]);_0x337fcd[_0x2bf3('0x49')]=qs[_0x2bf3('0x40')](_[_0x2bf3('0x48')](_0x50c28d[_0x2bf3('0x3f')],_0x423b68[_0x2bf3('0x40')]));_0x337fcd[_0x2bf3('0x49')]['SmsAccountId']=_0x26459e['id'];if(_0x50c28d[_0x2bf3('0x3f')][_0x2bf3('0x4b')]){_0x337fcd[_0x2bf3('0x49')]=_[_0x2bf3('0x4a')](_0x337fcd[_0x2bf3('0x49')],{'$or':_[_0x2bf3('0x3e')](_0x337fcd[_0x2bf3('0x42')],function(_0x57f031){var _0x3e5cba={};_0x3e5cba[_0x57f031]={'$like':'%'+_0x50c28d['query'][_0x2bf3('0x4b')]+'%'};return _0x3e5cba;})});}_0x337fcd=_[_0x2bf3('0x4a')]({},_0x337fcd,_0x50c28d['options']);return db['SmsInteraction']['count']({'where':_0x337fcd['where']})[_0x2bf3('0x1b')](function(_0x494f66){_0x52250c[_0x2bf3('0x2c')]=_0x494f66;if(_0x50c28d['query']['includeAll']){_0x337fcd[_0x2bf3('0x4e')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x2bf3('0xb5')],'as':_0x2bf3('0xb6'),'attributes':[_0x2bf3('0x36'),_0x2bf3('0xb7'),'internal'],'required':![]},{'model':db[_0x2bf3('0xb8')],'as':_0x2bf3('0xb9'),'attributes':['id',_0x2bf3('0x36'),_0x2bf3('0xba')],'where':_0x50c28d[_0x2bf3('0x3f')][_0x2bf3('0xbb')]?{'id':_0x50c28d[_0x2bf3('0x3f')][_0x2bf3('0xbb')]}:undefined,'required':_0x50c28d[_0x2bf3('0x3f')]['tag']?!![]:![]}];}return db[_0x2bf3('0x96')][_0x2bf3('0x4f')](_0x337fcd);})['then'](function(_0x33bf03){_0x52250c['rows']=_0x33bf03;return _0x52250c;});}})[_0x2bf3('0x1b')](respondWithFilteredResult(_0x590ffd,_0x337fcd))[_0x2bf3('0x25')](handleError(_0x590ffd,null));};exports[_0x2bf3('0xa9')]=function(_0x49fdf1,_0x3f2cfa,_0x30be0e){var _0x5a2d69,_0x1a0618,_0xec1ce9;if(_[_0x2bf3('0x88')](_0x49fdf1['body'][_0x2bf3('0x5a')])||_0x49fdf1[_0x2bf3('0x5a')][_0x2bf3('0x5a')]===''){throw new db[(_0x2bf3('0x89'))][(_0x2bf3('0x6f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2bf3('0x88')](_0x49fdf1[_0x2bf3('0x5a')]['to'])){throw new db[(_0x2bf3('0x89'))]['ValidationError'](_0x2bf3('0xbc'));}_0x5a2d69=_0x49fdf1[_0x2bf3('0x5a')]['to'];return db['SmsAccount'][_0x2bf3('0x5b')]({'where':{'id':_0x49fdf1['params']['id']},'include':[{'model':db['CmList'],'as':_0x2bf3('0xbd'),'include':[{'model':db[_0x2bf3('0x6e')],'as':'Contacts','where':{'mobile':_0x5a2d69},'limit':0x1,'order':[[_0x2bf3('0x73'),_0x2bf3('0x91')]]}]}]})[_0x2bf3('0x1b')](handleEntityNotFound(_0x3f2cfa,null))[_0x2bf3('0x1b')](function(_0x2f8825){if(_0x2f8825&&_0x2f8825['List']){_0x1a0618=_0x2f8825['get']({'plain':!![]});if(_0x1a0618[_0x2bf3('0xbd')]&&_0x1a0618[_0x2bf3('0xbd')]['Contacts'][_0x2bf3('0x44')]){return _0x1a0618[_0x2bf3('0xbd')]['Contacts'][0x0];}return db['CmContact'][_0x2bf3('0x55')](_[_0x2bf3('0x13')](_0x49fdf1[_0x2bf3('0x5a')],{'firstName':_0x5a2d69,'mobile':_0x5a2d69,'phone':_0x5a2d69,'ListId':_0x1a0618[_0x2bf3('0x75')]}));}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x3f2cfa,null))[_0x2bf3('0x1b')](function(_0x2907a9){if(_0x2907a9){_0xec1ce9=_0x2907a9;return db[_0x2bf3('0x96')][_0x2bf3('0x5b')]({'where':{'ContactId':_0xec1ce9['id'],'closed':![],'SmsAccountId':_0x1a0618['id']}})['then'](function(_0x52580a){if(_0x52580a){return[_0x52580a,![]];}return db[_0x2bf3('0x96')][_0x2bf3('0x55')]({'UserId':_0x49fdf1[_0x2bf3('0x56')]['id'],'ContactId':_0xec1ce9['id'],'SmsAccountId':_0x1a0618['id'],'phone':_0x5a2d69,'firstMsgDirection':_0x2bf3('0xbe'),'Messages':[_[_0x2bf3('0x4a')](_0x49fdf1[_0x2bf3('0x5a')],{'read':![],'body':_0x49fdf1[_0x2bf3('0x5a')][_0x2bf3('0x5a')],'phone':_0x5a2d69,'SmsAccountId':_0x1a0618['id'],'UserId':_0x49fdf1[_0x2bf3('0x56')]['id'],'ContactId':_0xec1ce9['id']})]},{'include':[{'model':db[_0x2bf3('0x9d')],'as':'Messages'}]})[_0x2bf3('0x1b')](function(_0x3dce72){return[_0x3dce72,!![]];});});}})['spread'](function(_0x2a9d43,_0x478444){if(_0x478444){return _0x2a9d43;}return db[_0x2bf3('0x9d')][_0x2bf3('0x55')](_['merge'](_0x49fdf1[_0x2bf3('0x5a')],{'read':![],'body':_0x49fdf1[_0x2bf3('0x5a')][_0x2bf3('0x5a')],'phone':_0x5a2d69,'SmsAccountId':_0x1a0618['id'],'SmsInteractionId':_0x2a9d43['id'],'UserId':_0x49fdf1[_0x2bf3('0x56')]['id'],'ContactId':_0xec1ce9['id']}))[_0x2bf3('0x1b')](function(_0x9c7b0){_0x2a9d43['dataValues'][_0x2bf3('0xbf')]=[];_0x2a9d43[_0x2bf3('0xc0')][_0x2bf3('0xbf')]['push'](_0x9c7b0[_0x2bf3('0xc0')]);return _0x2a9d43;});})[_0x2bf3('0x1b')](respondWithResult(_0x3f2cfa,null))[_0x2bf3('0x25')](handleError(_0x3f2cfa,null));};exports[_0x2bf3('0x27')]=function(_0x5e94ec,_0x20ec10,_0x408371){if(_0x5e94ec[_0x2bf3('0x5a')]['id']){delete _0x5e94ec['body']['id'];}var _0x28c465,_0x845ad7,_0x444394;return db[_0x2bf3('0x38')][_0x2bf3('0x5b')]({'where':{'id':_0x5e94ec[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x20ec10,null))[_0x2bf3('0x1b')](function(_0x4ee14b){if(_0x4ee14b){_0x444394=_0x4ee14b;logger[_0x2bf3('0x1f')](_0x2bf3('0x20'),_0x2bf3('0x27'),_0x2bf3('0xc1'),_0x4ee14b[_0x2bf3('0x3b')],util[_0x2bf3('0xc2')](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4ee14b[_0x2bf3('0x3b')]){case _0x2bf3('0x7b'):if(_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xc3')]&&_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x27')]){_0x845ad7=_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x27')];return db['SmsMessage'][_0x2bf3('0x5b')]({'where':{'messageId':_0x5e94ec[_0x2bf3('0x5a')]['skebby_dispatch_id']}});}break;case _0x2bf3('0x7e'):if(_0x5e94ec[_0x2bf3('0x5a')]['requestid']&&_0x5e94ec[_0x2bf3('0x5a')]['statusInt']){_0x845ad7=_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xc4')];return db[_0x2bf3('0x9d')]['find']({'where':{'messageId':_0x5e94ec[_0x2bf3('0x5a')]['requestid']}});}break;case _0x2bf3('0x7f'):if(_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xc5')]&&_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xc6')]){_0x845ad7=_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xc6')];return db[_0x2bf3('0x9d')][_0x2bf3('0x5b')]({'where':{'messageId':_0x5e94ec['body'][_0x2bf3('0xc5')]}});}break;case _0x2bf3('0xc7'):var _0x263d25=_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x83')][0x0];if(_0x263d25[_0x2bf3('0x7a')]&&_0x263d25['status'][_0x2bf3('0xc8')]===_0x2bf3('0xc9')){_0x845ad7=_0x263d25[_0x2bf3('0x27')][_0x2bf3('0xc8')];return db[_0x2bf3('0x9d')][_0x2bf3('0x5b')]({'where':{'messageId':_0x263d25[_0x2bf3('0x7a')]}});}break;case'clickatell':if(_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x7a')]&&_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x27')]){_0x845ad7=_0x5e94ec[_0x2bf3('0x5a')]['status'];return db[_0x2bf3('0x9d')]['find']({'where':{'messageId':_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x7a')]}});}break;case'bandwidth':if(_0x5e94ec[_0x2bf3('0x5a')][0x0]['message']['id']){_0x845ad7=_0x5e94ec[_0x2bf3('0x5a')][0x0]['type'];return db['SmsMessage'][_0x2bf3('0x5b')]({'where':{'messageId':_0x5e94ec['body'][0x0][_0x2bf3('0x23')]['id']}});}break;case _0x2bf3('0xca'):if(_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xcb')]&&_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x27')]){_0x845ad7=_0x5e94ec[_0x2bf3('0x5a')]['status'];return db[_0x2bf3('0x9d')][_0x2bf3('0x5b')]({'where':{'messageId':_0x5e94ec['body'][_0x2bf3('0xcb')]}});}break;}}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x20ec10,null))[_0x2bf3('0x1b')](function(_0x4bd2cd){if(_0x4bd2cd){_0x28c465=_0x4bd2cd;switch(_0x444394[_0x2bf3('0x3b')]){case'skebby':if(_0x845ad7==='DELIVERED'){return _0x28c465['update']({'read':!![]});}else{logger['error'](_0x2bf3('0x20'),_0x2bf3('0x27'),_0x2bf3('0x7b'),util[_0x2bf3('0xc2')](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x845ad7==='1'){return _0x28c465['update']({'read':!![]});}else{logger['error'](_0x2bf3('0x20'),_0x2bf3('0x27'),_0x2bf3('0x7b'),util['inspect'](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0xcc')]&&_0x845ad7>=0xc8&&_0x845ad7<=0xce){return _0x28c465[_0x2bf3('0x31')]({'read':!![]});}else{logger[_0x2bf3('0x22')](_0x2bf3('0x20'),_0x2bf3('0x27'),_0x2bf3('0x7f'),util[_0x2bf3('0xc2')](_0x5e94ec['body'],{'showHidden':![],'depth':null}));}break;case _0x2bf3('0xc7'):var _0x89c910=_0x5e94ec[_0x2bf3('0x5a')][_0x2bf3('0x83')][0x0];if(_0x89c910[_0x2bf3('0x27')][_0x2bf3('0xc8')]===_0x2bf3('0xc9')){return _0x28c465[_0x2bf3('0x31')]({'read':!![]});}else{logger[_0x2bf3('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2bf3('0x27'),_0x2bf3('0xc7'),util[_0x2bf3('0xc2')](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x845ad7==_0x2bf3('0xcd')||_0x845ad7==_0x2bf3('0xce')){return _0x28c465[_0x2bf3('0x31')]({'read':!![]});}else{logger[_0x2bf3('0x22')](_0x2bf3('0x20'),_0x2bf3('0x27'),'clickatell',util[_0x2bf3('0xc2')](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x845ad7==_0x2bf3('0xcf')){return _0x28c465[_0x2bf3('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2bf3('0x27'),_0x2bf3('0xd0'),util[_0x2bf3('0xc2')](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x845ad7===_0x2bf3('0xd1')||_0x845ad7===_0x2bf3('0xd2')){return _0x28c465[_0x2bf3('0x31')]({'read':!![]});}else{logger['error'](_0x2bf3('0x20'),_0x2bf3('0x27'),_0x2bf3('0xca'),util[_0x2bf3('0xc2')](_0x5e94ec[_0x2bf3('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x28c465;}})[_0x2bf3('0x1b')](respondWithResult(_0x20ec10,null))[_0x2bf3('0x25')](handleError(_0x20ec10,null));};exports['statusGet']=function(_0x1cb0c2,_0x47e7c1,_0xcb6c51){var _0x55f1c9,_0x1ba982,_0x1c721e;return db['SmsAccount'][_0x2bf3('0x5b')]({'where':{'id':_0x1cb0c2['params']['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x47e7c1,null))[_0x2bf3('0x1b')](function(_0x1fb936){if(_0x1fb936){_0x1c721e=_0x1fb936;logger[_0x2bf3('0x1f')](_0x2bf3('0x20'),_0x2bf3('0x27'),_0x2bf3('0xc1'),_0x1fb936[_0x2bf3('0x3b')],util['inspect'](_0x1cb0c2['query'],{'showHidden':![],'depth':null}));switch(_0x1fb936[_0x2bf3('0x3b')]){case _0x2bf3('0xd3'):if(_0x1cb0c2['query'][_0x2bf3('0xd4')]&&_0x1cb0c2[_0x2bf3('0x3f')][_0x2bf3('0xd5')]){_0x1ba982=_0x1cb0c2[_0x2bf3('0x3f')]['state'];return db[_0x2bf3('0x9d')][_0x2bf3('0x5b')]({'where':{'messageId':_0x1cb0c2[_0x2bf3('0x3f')][_0x2bf3('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x47e7c1,null))[_0x2bf3('0x1b')](function(_0x4d5fb3){if(_0x4d5fb3){_0x55f1c9=_0x4d5fb3;switch(_0x1c721e[_0x2bf3('0x3b')]){case _0x2bf3('0xd3'):if(_0x1ba982==='2'||_0x1ba982==='6'){return _0x55f1c9[_0x2bf3('0x31')]({'read':!![]});}else{logger['error'](_0x2bf3('0x20'),_0x2bf3('0x27'),'csc',util[_0x2bf3('0xc2')](_0x1cb0c2['query'],{'showHidden':![],'depth':null}));};break;}return _0x55f1c9;}})[_0x2bf3('0x1b')](respondWithResult(_0x47e7c1,null))['catch'](handleError(_0x47e7c1,null));};exports['addAgents']=function(_0x580cd9,_0xb552f2,_0x38d8d1){return db['SmsAccount'][_0x2bf3('0x5b')]({'where':{'id':_0x580cd9[_0x2bf3('0x52')]['id']}})['then'](handleEntityNotFound(_0xb552f2,null))[_0x2bf3('0x1b')](function(_0xb3fb98){if(_0xb3fb98){return _0xb3fb98[_0x2bf3('0xd6')](_0x580cd9['body'][_0x2bf3('0x64')],_['omit'](_0x580cd9['body'],[_0x2bf3('0x64'),'id'])||{})['spread'](function(_0x5864a2){for(var _0x178a19=0x0;_0x178a19<_0x580cd9[_0x2bf3('0x5a')][_0x2bf3('0x64')]['length'];_0x178a19+=0x1){socket[_0x2bf3('0xd7')](_0x2bf3('0xd8'),{'UserId':Number(_0x580cd9[_0x2bf3('0x5a')][_0x2bf3('0x64')][_0x178a19]),'SmsAccountId':Number(_0x580cd9['params']['id'])});}return _0x5864a2;});}})[_0x2bf3('0x1b')](respondWithResult(_0xb552f2,null))[_0x2bf3('0x25')](handleError(_0xb552f2,null));};exports['removeAgents']=function(_0x2f6581,_0x99665f,_0x58ba70){return db['SmsAccount'][_0x2bf3('0x5b')]({'where':{'id':_0x2f6581[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x99665f,null))[_0x2bf3('0x1b')](function(_0x56d0fa){if(_0x56d0fa){return _0x56d0fa[_0x2bf3('0xd9')](_0x2f6581[_0x2bf3('0x3f')][_0x2bf3('0x64')])[_0x2bf3('0x1b')](function(){if(_['isArray'](_0x2f6581[_0x2bf3('0x3f')][_0x2bf3('0x64')])){for(var _0x319f2a=0x0;_0x319f2a<_0x2f6581['query'][_0x2bf3('0x64')]['length'];_0x319f2a+=0x1){socket[_0x2bf3('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x2f6581['query'][_0x2bf3('0x64')][_0x319f2a]),'SmsAccountId':Number(_0x2f6581[_0x2bf3('0x52')]['id'])});}}else{socket[_0x2bf3('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x2f6581[_0x2bf3('0x3f')][_0x2bf3('0x64')]),'SmsAccountId':Number(_0x2f6581['params']['id'])});}});}})['then'](respondWithStatusCode(_0x99665f,null))[_0x2bf3('0x25')](handleError(_0x99665f,null));};exports[_0x2bf3('0xda')]=function(_0x48dc0f,_0x2b4d15,_0x4578cc){var _0x3769a4={};var _0x570a55={};var _0x3ac829;var _0x5ede24;return db['SmsAccount']['findOne']({'where':{'id':_0x48dc0f[_0x2bf3('0x52')]['id']}})[_0x2bf3('0x1b')](handleEntityNotFound(_0x2b4d15,null))[_0x2bf3('0x1b')](function(_0x40c4e1){if(_0x40c4e1){_0x3ac829=_0x40c4e1;_0x570a55[_0x2bf3('0x3d')]=_[_0x2bf3('0x54')](db[_0x2bf3('0xb5')][_0x2bf3('0x39')]);_0x570a55[_0x2bf3('0x3f')]=_[_0x2bf3('0x54')](_0x48dc0f[_0x2bf3('0x3f')]);_0x570a55['filters']=_[_0x2bf3('0x41')](_0x570a55[_0x2bf3('0x3d')],_0x570a55[_0x2bf3('0x3f')]);_0x3769a4[_0x2bf3('0x42')]=_[_0x2bf3('0x41')](_0x570a55[_0x2bf3('0x3d')],qs[_0x2bf3('0x43')](_0x48dc0f['query']['fields']));_0x3769a4['attributes']=_0x3769a4['attributes']['length']?_0x3769a4[_0x2bf3('0x42')]:_0x570a55['model'];_0x3769a4['order']=qs[_0x2bf3('0x47')](_0x48dc0f['query'][_0x2bf3('0x47')]);_0x3769a4['where']=qs[_0x2bf3('0x40')](_[_0x2bf3('0x48')](_0x48dc0f['query'],_0x570a55['filters']));if(_0x48dc0f[_0x2bf3('0x3f')]['filter']){_0x3769a4[_0x2bf3('0x49')]=_[_0x2bf3('0x4a')](_0x3769a4[_0x2bf3('0x49')],{'$or':_[_0x2bf3('0x3e')](_0x3769a4['attributes'],function(_0xfeb9c1){var _0x50806c={};_0x50806c[_0xfeb9c1]={'$like':'%'+_0x48dc0f[_0x2bf3('0x3f')][_0x2bf3('0x4b')]+'%'};return _0x50806c;})});}_0x3769a4=_[_0x2bf3('0x4a')]({},_0x3769a4,_0x48dc0f[_0x2bf3('0x4c')]);return _0x3ac829[_0x2bf3('0xda')](_0x3769a4);}})[_0x2bf3('0x1b')](function(_0x4af953){if(_0x4af953){_0x5ede24=_0x4af953[_0x2bf3('0x44')];if(!_0x48dc0f[_0x2bf3('0x3f')][_0x2bf3('0x45')](_0x2bf3('0x46'))){_0x3769a4[_0x2bf3('0x2d')]=qs['limit'](_0x48dc0f[_0x2bf3('0x3f')][_0x2bf3('0x2d')]);_0x3769a4[_0x2bf3('0x2a')]=qs[_0x2bf3('0x2a')](_0x48dc0f[_0x2bf3('0x3f')][_0x2bf3('0x2a')]);}return _0x3ac829[_0x2bf3('0xda')](_0x3769a4);}})['then'](function(_0x398384){if(_0x398384){return _0x398384?{'count':_0x5ede24,'rows':_0x398384}:null;}})[_0x2bf3('0x1b')](respondWithResult(_0x2b4d15,null))[_0x2bf3('0x25')](handleError(_0x2b4d15,null));}; \ No newline at end of file +var _0xd857=['error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','SmsAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','SmsAccount','findAll','rows','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','describe','Disposition','getDispositions','findOne','nolimit','order','pick','SmsAccountId','includeAll','removeDispositions','addAnswer','CannedAnswer','rawAttributes','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','messageId','MessageSid','skebby','sender','clicksend','message_id','plivo','From','MessageUUID','infobip','text','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','send','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xd857,0x1dc));var _0x7d85=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd857[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x7d85('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d85('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d85('0x2'));var moment=require(_0x7d85('0x3'));var BPromise=require(_0x7d85('0x4'));var Mustache=require('mustache');var util=require(_0x7d85('0x5'));var path=require(_0x7d85('0x6'));var sox=require(_0x7d85('0x7'));var csv=require(_0x7d85('0x8'));var ejs=require(_0x7d85('0x9'));var fs=require('fs');var fs_extra=require(_0x7d85('0xa'));var _=require(_0x7d85('0xb'));var squel=require(_0x7d85('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d85('0xd'));var deskjs=require(_0x7d85('0xe'));var toCsv=require(_0x7d85('0x8'));var querystring=require('querystring');var Papa=require(_0x7d85('0xf'));var Redis=require(_0x7d85('0x10'));var authService=require(_0x7d85('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7d85('0x12'));var hardwareService=require(_0x7d85('0x13'));var logger=require(_0x7d85('0x14'))(_0x7d85('0x15'));var utils=require(_0x7d85('0x16'));var config=require(_0x7d85('0x17'));var licenseUtil=require(_0x7d85('0x18'));var db=require(_0x7d85('0x19'))['db'];config[_0x7d85('0x1a')]=_[_0x7d85('0x1b')](config[_0x7d85('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d85('0x1c'))(new Redis(config[_0x7d85('0x1a')]));require(_0x7d85('0x1d'))[_0x7d85('0x1e')](socket);var jayson=require(_0x7d85('0x1f'));var client=jayson['client'][_0x7d85('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2a3944,_0x3c05e8,_0x287ffc,_0x34763f){return new BPromise(function(_0x34b3c9,_0x5eadf5){var _0x16f21d=_0x34763f||client;return _0x16f21d[_0x7d85('0x21')](_0x2a3944,_0x287ffc)['then'](function(_0x4276d5){logger[_0x7d85('0x22')](_0x7d85('0x23'),_0x3c05e8,'request\x20sent');logger['debug'](_0x7d85('0x24'),_0x3c05e8,_0x7d85('0x25'),JSON[_0x7d85('0x26')](_0x4276d5));if(_0x4276d5[_0x7d85('0x27')]){if(_0x4276d5[_0x7d85('0x27')][_0x7d85('0x28')]===0x1f4){logger[_0x7d85('0x27')](_0x7d85('0x23'),_0x3c05e8,_0x4276d5[_0x7d85('0x27')]['message']);return _0x5eadf5(_0x4276d5['error'][_0x7d85('0x29')]);}logger['error'](_0x7d85('0x23'),_0x3c05e8,_0x4276d5['error'][_0x7d85('0x29')]);return _0x34b3c9(_0x4276d5[_0x7d85('0x27')][_0x7d85('0x29')]);}else{logger['info'](_0x7d85('0x23'),_0x3c05e8,_0x7d85('0x25'));_0x34b3c9(_0x4276d5[_0x7d85('0x2a')][_0x7d85('0x29')]);}})[_0x7d85('0x2b')](function(_0x1163b8){logger[_0x7d85('0x27')](_0x7d85('0x23'),_0x3c05e8,_0x1163b8);_0x5eadf5(_0x1163b8);});});}function respondWithStatusCode(_0x3f568b,_0x1d850d){_0x1d850d=_0x1d850d||0xcc;return function(_0x2d1fe9){if(_0x2d1fe9){return _0x3f568b[_0x7d85('0x2c')](_0x1d850d);}return _0x3f568b[_0x7d85('0x2d')](_0x1d850d)['end']();};}function respondWithResult(_0x53ca56,_0x36aef9){_0x36aef9=_0x36aef9||0xc8;return function(_0xdfe3c9){if(_0xdfe3c9){return _0x53ca56[_0x7d85('0x2d')](_0x36aef9)[_0x7d85('0x2e')](_0xdfe3c9);}};}function respondWithFilteredResult(_0x59066c,_0x36aed0){return function(_0x19d0ec){if(_0x19d0ec){var _0x4ad763=typeof _0x36aed0['offset']===_0x7d85('0x2f')&&typeof _0x36aed0[_0x7d85('0x30')]===_0x7d85('0x2f');var _0x55c312=_0x19d0ec[_0x7d85('0x31')];var _0x2fc8a8=_0x4ad763?0x0:_0x36aed0[_0x7d85('0x32')];var _0x2ca065=_0x4ad763?_0x19d0ec[_0x7d85('0x31')]:_0x36aed0[_0x7d85('0x32')]+_0x36aed0[_0x7d85('0x30')];var _0x37dd27;if(_0x2ca065>=_0x55c312){_0x2ca065=_0x55c312;_0x37dd27=0xc8;}else{_0x37dd27=0xce;}_0x59066c[_0x7d85('0x2d')](_0x37dd27);return _0x59066c[_0x7d85('0x33')]('Content-Range',_0x2fc8a8+'-'+_0x2ca065+'/'+_0x55c312)[_0x7d85('0x2e')](_0x19d0ec);}return null;};}function patchUpdates(_0x256911){return function(_0x350e4d){try{jsonpatch['apply'](_0x350e4d,_0x256911,!![]);}catch(_0x41983c){return BPromise[_0x7d85('0x34')](_0x41983c);}return _0x350e4d[_0x7d85('0x35')]();};}function saveUpdates(_0x34ff18,_0x25012b){return function(_0x459eb2){if(_0x459eb2){return _0x459eb2[_0x7d85('0x36')](_0x34ff18)[_0x7d85('0x37')](function(_0x488080){return _0x488080;});}return null;};}function removeEntity(_0x557d7f,_0x4b2bde){return function(_0x39e0d3){if(_0x39e0d3){return _0x39e0d3[_0x7d85('0x38')]()[_0x7d85('0x37')](function(){var _0x4ead49=_0x39e0d3['get']({'plain':!![]});var _0x141cb5=_0x7d85('0x39');return db[_0x7d85('0x3a')][_0x7d85('0x38')]({'where':{'type':_0x141cb5,'resourceId':_0x4ead49['id']}})['then'](function(){return _0x39e0d3;});})[_0x7d85('0x37')](function(){_0x557d7f[_0x7d85('0x2d')](0xcc)[_0x7d85('0x3b')]();});}};}function handleEntityNotFound(_0xfd7d10,_0x2d65b0){return function(_0x32416){if(!_0x32416){_0xfd7d10[_0x7d85('0x2c')](0x194);}return _0x32416;};}function handleError(_0x5267dd,_0x4269d3){_0x4269d3=_0x4269d3||0x1f4;return function(_0x37e842){logger[_0x7d85('0x27')](_0x37e842[_0x7d85('0x3c')]);if(_0x37e842[_0x7d85('0x3d')]){delete _0x37e842[_0x7d85('0x3d')];}_0x5267dd[_0x7d85('0x2d')](_0x4269d3)['send'](_0x37e842);};}exports[_0x7d85('0x3e')]=function(_0x122e5c,_0x59cc83){var _0x430d94={'include':[{'model':db[_0x7d85('0x3f')],'as':_0x7d85('0x40')}]},_0x2370c5={},_0x344206={'count':0x0,'rows':[]};var _0x35a47f=_[_0x7d85('0x41')](db['SmsAccount']['rawAttributes'],function(_0x814e12){return{'name':_0x814e12['fieldName'],'type':_0x814e12[_0x7d85('0x42')][_0x7d85('0x43')]};});_0x2370c5[_0x7d85('0x44')]=_['map'](_0x35a47f,_0x7d85('0x3d'));_0x2370c5[_0x7d85('0x45')]=_[_0x7d85('0x46')](_0x122e5c[_0x7d85('0x45')]);_0x2370c5[_0x7d85('0x47')]=_['intersection'](_0x2370c5[_0x7d85('0x44')],_0x2370c5[_0x7d85('0x45')]);_0x430d94[_0x7d85('0x48')]=_['intersection'](_0x2370c5[_0x7d85('0x44')],qs[_0x7d85('0x49')](_0x122e5c[_0x7d85('0x45')]['fields']));_0x430d94['attributes']=_0x430d94['attributes'][_0x7d85('0x4a')]?_0x430d94[_0x7d85('0x48')]:_0x2370c5['model'];if(!_0x122e5c[_0x7d85('0x45')][_0x7d85('0x4b')]('nolimit')){_0x430d94[_0x7d85('0x30')]=qs[_0x7d85('0x30')](_0x122e5c[_0x7d85('0x45')][_0x7d85('0x30')]);_0x430d94[_0x7d85('0x32')]=qs[_0x7d85('0x32')](_0x122e5c['query']['offset']);}_0x430d94['order']=qs[_0x7d85('0x4c')](_0x122e5c[_0x7d85('0x45')][_0x7d85('0x4c')]);_0x430d94[_0x7d85('0x4d')]=qs[_0x7d85('0x47')](_['pick'](_0x122e5c[_0x7d85('0x45')],_0x2370c5[_0x7d85('0x47')]),_0x35a47f);if(_0x122e5c[_0x7d85('0x45')][_0x7d85('0x4e')]){_0x430d94[_0x7d85('0x4d')]=_[_0x7d85('0x4f')](_0x430d94[_0x7d85('0x4d')],{'$or':_[_0x7d85('0x41')](_0x35a47f,function(_0x3b3e2a){if(_0x3b3e2a[_0x7d85('0x42')]!=='VIRTUAL'){var _0x56eb87={};_0x56eb87[_0x3b3e2a['name']]={'$like':'%'+_0x122e5c[_0x7d85('0x45')][_0x7d85('0x4e')]+'%'};return _0x56eb87;}})});}_0x430d94=_['merge']({},_0x430d94,_0x122e5c['options']);var _0x3e497c={'where':_0x430d94['where']};return db['SmsAccount'][_0x7d85('0x31')](_0x3e497c)[_0x7d85('0x37')](function(_0x36bf69){_0x344206[_0x7d85('0x31')]=_0x36bf69;if(_0x122e5c[_0x7d85('0x45')]['includeAll']){_0x430d94['include']=[{'all':!![]}];}return db[_0x7d85('0x50')][_0x7d85('0x51')](_0x430d94);})[_0x7d85('0x37')](function(_0x9744b6){_0x344206[_0x7d85('0x52')]=_0x9744b6;return _0x344206;})['then'](respondWithFilteredResult(_0x59cc83,_0x430d94))['catch'](handleError(_0x59cc83,null));};exports[_0x7d85('0x53')]=function(_0x5b08f2,_0x1c4a8f){var _0x53fc76={'raw':![],'where':{'id':_0x5b08f2[_0x7d85('0x54')]['id']},'include':[{'model':db[_0x7d85('0x3f')],'as':_0x7d85('0x40')}]},_0x19c0b4={};_0x19c0b4['model']=_[_0x7d85('0x46')](db[_0x7d85('0x50')]['rawAttributes']);_0x19c0b4[_0x7d85('0x45')]=_[_0x7d85('0x46')](_0x5b08f2[_0x7d85('0x45')]);_0x19c0b4[_0x7d85('0x47')]=_[_0x7d85('0x55')](_0x19c0b4['model'],_0x19c0b4[_0x7d85('0x45')]);_0x53fc76[_0x7d85('0x48')]=_['intersection'](_0x19c0b4[_0x7d85('0x44')],qs[_0x7d85('0x49')](_0x5b08f2['query'][_0x7d85('0x49')]));_0x53fc76[_0x7d85('0x48')]=_0x53fc76[_0x7d85('0x48')]['length']?_0x53fc76[_0x7d85('0x48')]:_0x19c0b4['model'];if(_0x5b08f2[_0x7d85('0x45')]['includeAll']){_0x53fc76[_0x7d85('0x56')]=[{'all':!![]}];}_0x53fc76=_[_0x7d85('0x4f')]({},_0x53fc76,_0x5b08f2[_0x7d85('0x57')]);return db[_0x7d85('0x50')][_0x7d85('0x58')](_0x53fc76)[_0x7d85('0x37')](handleEntityNotFound(_0x1c4a8f,null))[_0x7d85('0x37')](respondWithResult(_0x1c4a8f,null))[_0x7d85('0x2b')](handleError(_0x1c4a8f,null));};exports[_0x7d85('0x59')]=function(_0x20b09b,_0x6fe640){return db[_0x7d85('0x50')]['create'](_0x20b09b['body'],{})[_0x7d85('0x37')](function(_0x2ac281){var _0x583f60=_0x20b09b[_0x7d85('0x5a')]['get']({'plain':!![]});if(!_0x583f60)throw new Error(_0x7d85('0x5b'));if(_0x583f60[_0x7d85('0x5c')]===_0x7d85('0x5a')){var _0x29b9f8=_0x2ac281[_0x7d85('0x5d')]({'plain':!![]});var _0x3c5df2=_0x7d85('0x39');return db[_0x7d85('0x5e')][_0x7d85('0x58')]({'where':{'name':_0x3c5df2,'userProfileId':_0x583f60[_0x7d85('0x5f')]},'raw':!![]})[_0x7d85('0x37')](function(_0x4e80b9){if(_0x4e80b9&&_0x4e80b9[_0x7d85('0x60')]===0x0){return db[_0x7d85('0x3a')][_0x7d85('0x59')]({'name':_0x29b9f8[_0x7d85('0x3d')],'resourceId':_0x29b9f8['id'],'type':_0x4e80b9['name'],'sectionId':_0x4e80b9['id']},{})[_0x7d85('0x37')](function(){return _0x2ac281;});}else{return _0x2ac281;}})[_0x7d85('0x2b')](function(_0x129d62){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x129d62);throw _0x129d62;});}return _0x2ac281;})[_0x7d85('0x37')](respondWithResult(_0x6fe640,0xc9))[_0x7d85('0x2b')](handleError(_0x6fe640,null));};exports[_0x7d85('0x36')]=function(_0x34a924,_0x2bdc98){if(_0x34a924[_0x7d85('0x61')]['id']){delete _0x34a924['body']['id'];}return db[_0x7d85('0x50')]['find']({'where':{'id':_0x34a924[_0x7d85('0x54')]['id']},'include':[{'model':db[_0x7d85('0x3f')],'as':_0x7d85('0x40')}]})[_0x7d85('0x37')](handleEntityNotFound(_0x2bdc98,null))[_0x7d85('0x37')](saveUpdates(_0x34a924[_0x7d85('0x61')],null))[_0x7d85('0x37')](respondWithResult(_0x2bdc98,null))[_0x7d85('0x2b')](handleError(_0x2bdc98,null));};exports['destroy']=function(_0x476232,_0x1ae432){return db[_0x7d85('0x50')]['find']({'where':{'id':_0x476232[_0x7d85('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ae432,null))[_0x7d85('0x37')](removeEntity(_0x1ae432,null))[_0x7d85('0x2b')](handleError(_0x1ae432,null));};exports[_0x7d85('0x62')]=function(_0x42a76b,_0x3b6f80){return db['SmsAccount'][_0x7d85('0x62')]()['then'](respondWithResult(_0x3b6f80,null))['catch'](handleError(_0x3b6f80,null));};exports['addDisposition']=function(_0x2fe4a5,_0x46c883,_0x41c582){if(_0x2fe4a5[_0x7d85('0x61')]['id']){delete _0x2fe4a5['body']['id'];}return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x2fe4a5[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x46c883,null))['then'](function(_0x50d09c){if(_0x50d09c){_0x2fe4a5[_0x7d85('0x61')]['SmsAccountId']=_0x50d09c['id'];return db[_0x7d85('0x63')][_0x7d85('0x59')](_0x2fe4a5[_0x7d85('0x61')]);}})[_0x7d85('0x37')](respondWithResult(_0x46c883,null))[_0x7d85('0x2b')](handleError(_0x46c883,null));};exports[_0x7d85('0x64')]=function(_0x3c8a92,_0x3da621,_0x316e22){var _0x194133={'raw':![],'where':{}};var _0x52c17c={};var _0x363207={'count':0x0,'rows':[]};return db[_0x7d85('0x50')][_0x7d85('0x65')]({'where':{'id':_0x3c8a92[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x3da621,null))[_0x7d85('0x37')](function(_0x3613b5){if(_0x3613b5){_0x52c17c[_0x7d85('0x44')]=_[_0x7d85('0x46')](db[_0x7d85('0x63')]['rawAttributes']);_0x52c17c[_0x7d85('0x45')]=_[_0x7d85('0x46')](_0x3c8a92['query']);_0x52c17c['filters']=_[_0x7d85('0x55')](_0x52c17c[_0x7d85('0x44')],_0x52c17c[_0x7d85('0x45')]);_0x194133[_0x7d85('0x48')]=_[_0x7d85('0x55')](_0x52c17c[_0x7d85('0x44')],qs[_0x7d85('0x49')](_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x49')]));_0x194133[_0x7d85('0x48')]=_0x194133['attributes'][_0x7d85('0x4a')]?_0x194133[_0x7d85('0x48')]:_0x52c17c[_0x7d85('0x44')];if(!_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x4b')](_0x7d85('0x66'))){_0x194133[_0x7d85('0x30')]=qs['limit'](_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x30')]);_0x194133['offset']=qs[_0x7d85('0x32')](_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x32')]);}_0x194133[_0x7d85('0x67')]=qs['sort'](_0x3c8a92['query'][_0x7d85('0x4c')]);_0x194133[_0x7d85('0x4d')]=qs['filters'](_[_0x7d85('0x68')](_0x3c8a92['query'],_0x52c17c[_0x7d85('0x47')]));_0x194133['where'][_0x7d85('0x69')]=_0x3613b5['id'];if(_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x4e')]){_0x194133[_0x7d85('0x4d')]=_[_0x7d85('0x4f')](_0x194133[_0x7d85('0x4d')],{'$or':_[_0x7d85('0x41')](_0x194133[_0x7d85('0x48')],function(_0x415e03){var _0x206081={};_0x206081[_0x415e03]={'$like':'%'+_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x4e')]+'%'};return _0x206081;})});}_0x194133=_[_0x7d85('0x4f')]({},_0x194133,_0x3c8a92[_0x7d85('0x57')]);return db[_0x7d85('0x63')][_0x7d85('0x31')]({'where':_0x194133['where']})[_0x7d85('0x37')](function(_0x397b1b){_0x363207[_0x7d85('0x31')]=_0x397b1b;if(_0x3c8a92[_0x7d85('0x45')][_0x7d85('0x6a')]){_0x194133[_0x7d85('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x7d85('0x51')](_0x194133);})[_0x7d85('0x37')](function(_0x3eabee){_0x363207[_0x7d85('0x52')]=_0x3eabee;return _0x363207;});}})[_0x7d85('0x37')](respondWithFilteredResult(_0x3da621,_0x194133))[_0x7d85('0x2b')](handleError(_0x3da621,null));};exports[_0x7d85('0x6b')]=function(_0x1b5669,_0x9ad0e8,_0x567ca8){return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x1b5669[_0x7d85('0x54')]['id']}})['then'](handleEntityNotFound(_0x9ad0e8,null))[_0x7d85('0x37')](function(_0xe5d3ac){if(_0xe5d3ac){return _0xe5d3ac['removeDispositions'](_0x1b5669[_0x7d85('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x9ad0e8,null))['catch'](handleError(_0x9ad0e8,null));};exports[_0x7d85('0x6c')]=function(_0x1610b7,_0x2fd264,_0x10b072){if(_0x1610b7[_0x7d85('0x61')]['id']){delete _0x1610b7[_0x7d85('0x61')]['id'];}return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x1610b7[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x2fd264,null))[_0x7d85('0x37')](function(_0x3630f7){if(_0x3630f7){_0x1610b7['body']['SmsAccountId']=_0x3630f7['id'];return db[_0x7d85('0x6d')]['create'](_0x1610b7[_0x7d85('0x61')]);}})[_0x7d85('0x37')](respondWithResult(_0x2fd264,null))[_0x7d85('0x2b')](handleError(_0x2fd264,null));};exports['getAnswers']=function(_0x2716fd,_0x3eaeb9,_0x10e23a){var _0x377b39={'raw':![],'where':{}};var _0x33d180={};var _0x5474d3={'count':0x0,'rows':[]};return db[_0x7d85('0x50')][_0x7d85('0x65')]({'where':{'id':_0x2716fd['params']['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x3eaeb9,null))[_0x7d85('0x37')](function(_0x37cd11){if(_0x37cd11){_0x33d180[_0x7d85('0x44')]=_[_0x7d85('0x46')](db[_0x7d85('0x6d')][_0x7d85('0x6e')]);_0x33d180[_0x7d85('0x45')]=_[_0x7d85('0x46')](_0x2716fd[_0x7d85('0x45')]);_0x33d180['filters']=_['intersection'](_0x33d180[_0x7d85('0x44')],_0x33d180['query']);_0x377b39['attributes']=_['intersection'](_0x33d180['model'],qs[_0x7d85('0x49')](_0x2716fd[_0x7d85('0x45')][_0x7d85('0x49')]));_0x377b39[_0x7d85('0x48')]=_0x377b39[_0x7d85('0x48')][_0x7d85('0x4a')]?_0x377b39[_0x7d85('0x48')]:_0x33d180[_0x7d85('0x44')];if(!_0x2716fd['query']['hasOwnProperty'](_0x7d85('0x66'))){_0x377b39[_0x7d85('0x30')]=qs[_0x7d85('0x30')](_0x2716fd[_0x7d85('0x45')]['limit']);_0x377b39[_0x7d85('0x32')]=qs[_0x7d85('0x32')](_0x2716fd[_0x7d85('0x45')][_0x7d85('0x32')]);}_0x377b39['order']=qs[_0x7d85('0x4c')](_0x2716fd[_0x7d85('0x45')]['sort']);_0x377b39[_0x7d85('0x4d')]=qs[_0x7d85('0x47')](_[_0x7d85('0x68')](_0x2716fd[_0x7d85('0x45')],_0x33d180[_0x7d85('0x47')]));_0x377b39[_0x7d85('0x4d')][_0x7d85('0x69')]=_0x37cd11['id'];if(_0x2716fd[_0x7d85('0x45')][_0x7d85('0x4e')]){_0x377b39[_0x7d85('0x4d')]=_[_0x7d85('0x4f')](_0x377b39[_0x7d85('0x4d')],{'$or':_[_0x7d85('0x41')](_0x377b39['attributes'],function(_0x204f2a){var _0x18a93b={};_0x18a93b[_0x204f2a]={'$like':'%'+_0x2716fd['query']['filter']+'%'};return _0x18a93b;})});}_0x377b39=_[_0x7d85('0x4f')]({},_0x377b39,_0x2716fd['options']);return db['CannedAnswer'][_0x7d85('0x31')]({'where':_0x377b39[_0x7d85('0x4d')]})[_0x7d85('0x37')](function(_0x5d81e0){_0x5474d3[_0x7d85('0x31')]=_0x5d81e0;if(_0x2716fd[_0x7d85('0x45')][_0x7d85('0x6a')]){_0x377b39[_0x7d85('0x56')]=[{'all':!![]}];}return db[_0x7d85('0x6d')][_0x7d85('0x51')](_0x377b39);})[_0x7d85('0x37')](function(_0x397618){_0x5474d3[_0x7d85('0x52')]=_0x397618;return _0x5474d3;});}})[_0x7d85('0x37')](respondWithFilteredResult(_0x3eaeb9,_0x377b39))[_0x7d85('0x2b')](handleError(_0x3eaeb9,null));};exports[_0x7d85('0x6f')]=function(_0x248303,_0x24da2e,_0x58f71b){return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x248303['params']['id']}})['then'](handleEntityNotFound(_0x24da2e,null))[_0x7d85('0x37')](function(_0x581662){if(_0x581662){return _0x581662['removeAnswers'](_0x248303[_0x7d85('0x45')]['ids']);}})[_0x7d85('0x37')](respondWithStatusCode(_0x24da2e,null))[_0x7d85('0x2b')](handleError(_0x24da2e,null));};exports[_0x7d85('0x70')]=function(_0x58cde5,_0x28178a,_0x39d025){var _0x15c8ee={'channel':'sms'};var _0xeef08a=[];var _0x430b9f=[];var _0x203046={};return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x58cde5[_0x7d85('0x54')]['id']},'include':[{'model':db[_0x7d85('0x71')],'as':_0x7d85('0x72')}]})['then'](handleEntityNotFound(_0x28178a,null))['then'](function(_0x13046f){_0x15c8ee[_0x7d85('0x73')]=_0x13046f;_0x15c8ee[_0x7d85('0x74')]=_['orderBy'](_0x13046f[_0x7d85('0x72')],[_0x7d85('0x75')],['asc']);if(_0x15c8ee[_0x7d85('0x73')][_0x7d85('0x72')]){delete _0x15c8ee[_0x7d85('0x73')][_0x7d85('0x72')];}return db[_0x7d85('0x76')][_0x7d85('0x62')]();})[_0x7d85('0x37')](function(_0x4fec01){if(!_0x4fec01){throw new db[(_0x7d85('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0xeef08a=_[_0x7d85('0x78')](_[_0x7d85('0x46')](_0x4fec01),[_0x7d85('0x79'),_0x7d85('0x7a')]);_0x430b9f=_[_0x7d85('0x78')](_[_0x7d85('0x46')](_0x4fec01),[_0x7d85('0x79'),'updatedAt',_0x7d85('0x7b'),_0x7d85('0x7c')]);_0x15c8ee[_0x7d85('0x61')]={'mapKey':_0x7d85('0x7d')};if(_0x15c8ee[_0x7d85('0x73')][_0x7d85('0x42')]){switch(_0x15c8ee[_0x7d85('0x73')]['type']){case'twilio':_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')]=_0x58cde5[_0x7d85('0x61')]['From'];_0x15c8ee[_0x7d85('0x61')]['body']=_0x58cde5['body']['Body'];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7f')]=_0x58cde5['body'][_0x7d85('0x80')];break;case _0x7d85('0x81'):_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')]='+'+_0x58cde5['body'][_0x7d85('0x82')];_0x15c8ee['body'][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')]['text'];break;case'connectel':_0x15c8ee['body'][_0x7d85('0x7e')]=_0x58cde5['body'][_0x7d85('0x7e')];_0x15c8ee['body']['body']=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x29')];break;case _0x7d85('0x83'):_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x7e')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')]['body'];_0x15c8ee[_0x7d85('0x61')]['messageId']=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x84')];break;case _0x7d85('0x85'):_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x86')];_0x15c8ee['body'][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')]['Text'];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7f')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x87')];break;case _0x7d85('0x88'):_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')]='+'+_0x58cde5['body']['results'][0x0][_0x7d85('0x7e')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')]['results'][0x0][_0x7d85('0x89')];_0x15c8ee['body'][_0x7d85('0x7f')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x8a')][0x0][_0x7d85('0x7f')];break;case _0x7d85('0x8b'):_0x15c8ee[_0x7d85('0x61')]['from']=_0x58cde5['body'][_0x7d85('0x8c')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x8d')][_0x7d85('0x29')];break;case'clickatell':_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')]=_0x58cde5['body'][_0x7d85('0x8e')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x89')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7f')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x8f')];break;case _0x7d85('0x90'):_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7f')]=_0x58cde5['body'][0x0]['message']['id'];_0x15c8ee['body'][_0x7d85('0x7e')]=_0x58cde5[_0x7d85('0x61')][0x0][_0x7d85('0x29')][_0x7d85('0x7e')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')][0x0][_0x7d85('0x29')][_0x7d85('0x89')];break;case _0x7d85('0x91'):_0x15c8ee['body'][_0x7d85('0x7e')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x7e')];_0x15c8ee['body'][_0x7d85('0x61')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x29')];_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7f')]=_0x58cde5[_0x7d85('0x61')][_0x7d85('0x92')];break;}}if(_0x15c8ee[_0x7d85('0x61')]['id']){delete _0x15c8ee[_0x7d85('0x61')]['id'];}if(_[_0x7d85('0x93')](_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')])){throw new db[(_0x7d85('0x77'))]['ValidationError'](_0x7d85('0x94'));}if(_[_0x7d85('0x93')](_0x15c8ee['body'][_0x7d85('0x61')])||_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')]===''){throw new db[(_0x7d85('0x77'))][(_0x7d85('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x15c8ee['body'][_0x7d85('0x96')])){throw new db['Sequelize'][(_0x7d85('0x95'))](_0x7d85('0x97')+_0x430b9f);}if(!_[_0x7d85('0x98')](_0x430b9f,_0x15c8ee[_0x7d85('0x61')]['mapKey'])){throw new db['Sequelize'][(_0x7d85('0x95'))](_0x7d85('0x99')+_0x430b9f);}_0x203046[_0x15c8ee[_0x7d85('0x61')]['mapKey']]=_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')];return db[_0x7d85('0x9a')][_0x7d85('0x58')]({'where':{'id':_0x15c8ee[_0x7d85('0x73')][_0x7d85('0x7c')]},'include':[{'model':db[_0x7d85('0x76')],'as':_0x7d85('0x9b'),'where':_0x203046,'limit':0x1,'order':[[_0x7d85('0x7a'),_0x7d85('0x9c')]]}]});})[_0x7d85('0x37')](handleEntityNotFound(_0x28178a,null))['then'](function(_0x3c9502){if(_0x3c9502){_0x15c8ee[_0x7d85('0x9d')]=_[_0x7d85('0x9e')](_0x3c9502,[_0x7d85('0x9b')]);if(_0x3c9502[_0x7d85('0x9b')][_0x7d85('0x4a')]){return _0x3c9502[_0x7d85('0x9b')][0x0];}var _0x8af87b=_['defaults'](_0x15c8ee['body'],{'firstName':_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')],'ListId':_0x3c9502['id']});_0x8af87b[_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x96')]]=_0x15c8ee[_0x7d85('0x61')]['from'];return db[_0x7d85('0x76')][_0x7d85('0x59')](_0x8af87b,{'fields':_0xeef08a,'raw':!![]});}})[_0x7d85('0x37')](handleEntityNotFound(_0x28178a,null))[_0x7d85('0x37')](function(_0x433cc2){if(_0x433cc2){_0x15c8ee['contact']=_0x433cc2;var _0x4a25ea={'ContactId':_0x433cc2['id'],'phone':_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')],'SmsAccountId':_0x58cde5[_0x7d85('0x54')]['id']};var _0x2f194c={'ContactId':_0x433cc2['id'],'SmsAccountId':_0x58cde5[_0x7d85('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0x7d85('0x58')]({'where':_0x2f194c})['then'](function(_0x4e3edc){if(_0x4e3edc){return[_0x4e3edc,![]];}return db[_0x7d85('0x9f')][_0x7d85('0x59')](_0x4a25ea)[_0x7d85('0x37')](function(_0x4062de){return[_0x4062de,!![]];});});}})[_0x7d85('0xa0')](function(_0x12e5c1,_0x1adfa2){_0x15c8ee[_0x7d85('0xa1')]=_0x12e5c1[_0x7d85('0x5d')]({'plain':!![]});_0x15c8ee['interaction'][_0x7d85('0xa2')]=![];if(_0x1adfa2){if(_0x15c8ee[_0x7d85('0x73')][_0x7d85('0xa3')]){_0x15c8ee[_0x7d85('0x74')]['push']({'id':0x0,'priority':_0x15c8ee['applications']['length']+0x1,'app':_0x7d85('0xa4'),'appdata':_0x7d85('0xa5'),'interval':_0x7d85('0xa6')});}_0x15c8ee['interaction'][_0x7d85('0xa2')]=!![];}return db[_0x7d85('0xa7')][_0x7d85('0x59')]({'phone':_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x7e')],'messageId':_0x15c8ee['body'][_0x7d85('0x7f')],'body':_0x15c8ee[_0x7d85('0x61')][_0x7d85('0x61')],'SmsAccountId':_0x58cde5[_0x7d85('0x54')]['id'],'SmsInteractionId':_0x12e5c1['id'],'direction':'in','ContactId':_0x12e5c1['ContactId'],'AttachmentId':_0x15c8ee['body'][_0x7d85('0xa8')]});})[_0x7d85('0x37')](function(_0x4c9c52){_0x15c8ee[_0x7d85('0x29')]=_0x4c9c52;if(_0x15c8ee[_0x7d85('0xa1')][_0x7d85('0xa9')]){return db[_0x7d85('0xaa')][_0x7d85('0x58')]({'attributes':['id',_0x7d85('0x3d')],'where':{'id':_0x15c8ee['interaction']['UserId']}})[_0x7d85('0x37')](function(_0x25a5c8){if(_0x25a5c8){_0x15c8ee[_0x7d85('0x74')][_0x7d85('0xab')]({'id':0x0,'priority':0x0,'app':_0x7d85('0xac'),'appdata':_0x25a5c8[_0x7d85('0x3d')]+','+(_0x15c8ee['account'][_0x7d85('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7d85('0xae'),_0x7d85('0xaf'),_0x15c8ee);});}return respondWithRpcPromise(_0x7d85('0xae'),'startRouting',_0x15c8ee);})[_0x7d85('0x37')](function(_0x404b24){if(_0x404b24){var _0x12fc6b=0xc8;var _0x2066e2='receiveMessage';logger['info'](_0x7d85('0x24'),_0x2066e2,_0x12fc6b,_0x7d85('0xb0'));logger[_0x7d85('0xb1')](_0x7d85('0xb2'),_0x2066e2,_0x12fc6b,'entity\x20found',JSON[_0x7d85('0x26')](_0x404b24));if(_0x15c8ee[_0x7d85('0x73')][_0x7d85('0x42')]===_0x7d85('0xb3')){return _0x28178a['status'](_0x12fc6b)[_0x7d85('0x33')]('Content-Type',_0x7d85('0xb4'))[_0x7d85('0xb5')]('\x0a');}else{return _0x28178a[_0x7d85('0x2d')](_0x12fc6b)['json'](_0x404b24);}}})[_0x7d85('0x2b')](handleError(_0x28178a,null));};exports[_0x7d85('0xb6')]=function(_0xea3215,_0x1366a5){var _0x30efe8=_0xea3215[_0x7d85('0x54')]['id'];var _0x357250=_0xea3215[_0x7d85('0x61')];var _0x4a811e=0xc8;var _0x499d1d=null;return db[_0x7d85('0xb7')]['transaction']({'isolationLevel':db['sequelize'][_0x7d85('0xb8')][_0x7d85('0xb9')][_0x7d85('0xba')]},function(_0x51ba3f){return db[_0x7d85('0x50')][_0x7d85('0x65')]({'where':{'id':_0x30efe8},'transaction':_0x51ba3f})['then'](function(_0x3e4b75){if(_0x3e4b75){return db[_0x7d85('0x71')][_0x7d85('0x38')]({'where':{'SmsAccountId':_0x30efe8},'transaction':_0x51ba3f})[_0x7d85('0x37')](function(){var _0xb3aeef=_[_0x7d85('0x41')](_0x357250,function(_0x4122a3){_0x4122a3['SmsAccountId']=_0x30efe8;return _0x4122a3;});return db['SmsApplication'][_0x7d85('0xbb')](_0xb3aeef,{'transaction':_0x51ba3f});});}else{_0x4a811e=0x194;_0x499d1d=[];}});})[_0x7d85('0x37')](function(){if(_0x4a811e!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x30efe8},'order':_0x7d85('0x75')})[_0x7d85('0x37')](function(_0xb648ea){_0x499d1d=_0xb648ea;});}})[_0x7d85('0x2b')](function(_0x27f287){_0x4a811e=0x1f4;logger[_0x7d85('0x27')](_0x27f287[_0x7d85('0x3c')]);if(_0x27f287[_0x7d85('0x3d')]){delete _0x27f287[_0x7d85('0x3d')];}_0x499d1d=_0x27f287;})[_0x7d85('0xbc')](function(){if(_0x499d1d===null){_0x1366a5['sendStatus'](_0x4a811e);}else{if(_0x4a811e===0x1f4){_0x1366a5[_0x7d85('0x2d')](_0x4a811e)[_0x7d85('0xb5')](_0x499d1d);}else{_0x1366a5[_0x7d85('0x2d')](_0x4a811e)[_0x7d85('0x2e')](_0x499d1d);}}});};exports['getApplications']=function(_0x4a2e92,_0x5d9048,_0x2c4167){var _0x32c222={};var _0x4be936={};var _0x54c493;var _0x236f2f;return db[_0x7d85('0x50')]['findOne']({'where':{'id':_0x4a2e92[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x5d9048,null))['then'](function(_0x37babb){if(_0x37babb){_0x54c493=_0x37babb;_0x4be936[_0x7d85('0x44')]=_[_0x7d85('0x46')](db[_0x7d85('0x71')][_0x7d85('0x6e')]);_0x4be936[_0x7d85('0x45')]=_[_0x7d85('0x46')](_0x4a2e92[_0x7d85('0x45')]);_0x4be936['filters']=_[_0x7d85('0x55')](_0x4be936[_0x7d85('0x44')],_0x4be936[_0x7d85('0x45')]);_0x32c222[_0x7d85('0x48')]=_[_0x7d85('0x55')](_0x4be936[_0x7d85('0x44')],qs[_0x7d85('0x49')](_0x4a2e92['query'][_0x7d85('0x49')]));_0x32c222[_0x7d85('0x48')]=_0x32c222[_0x7d85('0x48')][_0x7d85('0x4a')]?_0x32c222['attributes']:_0x4be936[_0x7d85('0x44')];_0x32c222[_0x7d85('0x67')]=qs[_0x7d85('0x4c')](_0x4a2e92[_0x7d85('0x45')][_0x7d85('0x4c')]);_0x32c222[_0x7d85('0x4d')]=qs['filters'](_['pick'](_0x4a2e92[_0x7d85('0x45')],_0x4be936[_0x7d85('0x47')]));if(_0x4a2e92['query'][_0x7d85('0x4e')]){_0x32c222['where']=_['merge'](_0x32c222[_0x7d85('0x4d')],{'$or':_[_0x7d85('0x41')](_0x32c222[_0x7d85('0x48')],function(_0x7cdd71){var _0x2670c1={};_0x2670c1[_0x7cdd71]={'$like':'%'+_0x4a2e92[_0x7d85('0x45')]['filter']+'%'};return _0x2670c1;})});}_0x32c222=_[_0x7d85('0x4f')]({},_0x32c222,_0x4a2e92['options']);return _0x54c493['getApplications'](_0x32c222);}})[_0x7d85('0x37')](function(_0x17e740){if(_0x17e740){_0x236f2f=_0x17e740['length'];if(!_0x4a2e92[_0x7d85('0x45')][_0x7d85('0x4b')](_0x7d85('0x66'))){_0x32c222[_0x7d85('0x30')]=qs['limit'](_0x4a2e92[_0x7d85('0x45')]['limit']);_0x32c222['offset']=qs[_0x7d85('0x32')](_0x4a2e92[_0x7d85('0x45')][_0x7d85('0x32')]);}return _0x54c493[_0x7d85('0xbd')](_0x32c222);}})[_0x7d85('0x37')](function(_0x37175b){if(_0x37175b){return _0x37175b?{'count':_0x236f2f,'rows':_0x37175b}:null;}})[_0x7d85('0x37')](respondWithResult(_0x5d9048,null))['catch'](handleError(_0x5d9048,null));};exports[_0x7d85('0xbe')]=function(_0x69b25a,_0x4c8cbb,_0x2b91){var _0x4af5c7={'raw':![],'where':{}};var _0x549c51={};var _0x1b4723={'count':0x0,'rows':[]};return db[_0x7d85('0x50')][_0x7d85('0x65')]({'where':{'id':_0x69b25a[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x4c8cbb,null))[_0x7d85('0x37')](function(_0x3778ed){if(_0x3778ed){_0x549c51[_0x7d85('0x44')]=_[_0x7d85('0x46')](db[_0x7d85('0x9f')][_0x7d85('0x6e')]);_0x549c51[_0x7d85('0x45')]=_[_0x7d85('0x46')](_0x69b25a[_0x7d85('0x45')]);_0x549c51[_0x7d85('0x47')]=_['intersection'](_0x549c51[_0x7d85('0x44')],_0x549c51[_0x7d85('0x45')]);_0x4af5c7[_0x7d85('0x48')]=_[_0x7d85('0x55')](_0x549c51[_0x7d85('0x44')],qs[_0x7d85('0x49')](_0x69b25a[_0x7d85('0x45')][_0x7d85('0x49')]));_0x4af5c7[_0x7d85('0x48')]=_0x4af5c7[_0x7d85('0x48')]['length']?_0x4af5c7[_0x7d85('0x48')]:_0x549c51['model'];if(!_0x69b25a['query'][_0x7d85('0x4b')](_0x7d85('0x66'))){_0x4af5c7[_0x7d85('0x30')]=qs[_0x7d85('0x30')](_0x69b25a[_0x7d85('0x45')][_0x7d85('0x30')]);_0x4af5c7[_0x7d85('0x32')]=qs[_0x7d85('0x32')](_0x69b25a[_0x7d85('0x45')][_0x7d85('0x32')]);}_0x4af5c7[_0x7d85('0x67')]=qs[_0x7d85('0x4c')](_0x69b25a['query'][_0x7d85('0x4c')]);_0x4af5c7[_0x7d85('0x4d')]=qs[_0x7d85('0x47')](_[_0x7d85('0x68')](_0x69b25a[_0x7d85('0x45')],_0x549c51['filters']));_0x4af5c7[_0x7d85('0x4d')][_0x7d85('0x69')]=_0x3778ed['id'];if(_0x69b25a[_0x7d85('0x45')][_0x7d85('0x4e')]){_0x4af5c7[_0x7d85('0x4d')]=_[_0x7d85('0x4f')](_0x4af5c7['where'],{'$or':_[_0x7d85('0x41')](_0x4af5c7[_0x7d85('0x48')],function(_0xa851c0){var _0x4ce569={};_0x4ce569[_0xa851c0]={'$like':'%'+_0x69b25a['query']['filter']+'%'};return _0x4ce569;})});}_0x4af5c7=_[_0x7d85('0x4f')]({},_0x4af5c7,_0x69b25a[_0x7d85('0x57')]);return db[_0x7d85('0x9f')]['count']({'where':_0x4af5c7[_0x7d85('0x4d')]})[_0x7d85('0x37')](function(_0x209bf3){_0x1b4723[_0x7d85('0x31')]=_0x209bf3;if(_0x69b25a[_0x7d85('0x45')][_0x7d85('0x6a')]){_0x4af5c7[_0x7d85('0x56')]=[{'model':db[_0x7d85('0x76')],'as':_0x7d85('0xbf'),'required':![]},{'model':db[_0x7d85('0xaa')],'as':_0x7d85('0xc0'),'attributes':[_0x7d85('0x3d'),_0x7d85('0xc1'),'internal'],'required':![]},{'model':db[_0x7d85('0xc2')],'as':_0x7d85('0xc3'),'attributes':['id','name',_0x7d85('0xc4')],'where':_0x69b25a[_0x7d85('0x45')][_0x7d85('0xc5')]?{'id':_0x69b25a[_0x7d85('0x45')][_0x7d85('0xc5')]}:undefined,'required':_0x69b25a[_0x7d85('0x45')][_0x7d85('0xc5')]?!![]:![]}];}return db['SmsInteraction'][_0x7d85('0x51')](_0x4af5c7);})[_0x7d85('0x37')](function(_0x2a3dab){_0x1b4723[_0x7d85('0x52')]=_0x2a3dab;return _0x1b4723;});}})[_0x7d85('0x37')](respondWithFilteredResult(_0x4c8cbb,_0x4af5c7))[_0x7d85('0x2b')](handleError(_0x4c8cbb,null));};exports[_0x7d85('0xb5')]=function(_0x357b0e,_0x4f4d72,_0x167195){var _0x530fc0,_0x5d7815,_0xfc1e4b;if(_[_0x7d85('0x93')](_0x357b0e[_0x7d85('0x61')][_0x7d85('0x61')])||_0x357b0e[_0x7d85('0x61')][_0x7d85('0x61')]===''){throw new db['Sequelize'][(_0x7d85('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x357b0e['body']['to'])){throw new db[(_0x7d85('0x77'))][(_0x7d85('0x95'))](_0x7d85('0xc6'));}_0x530fc0=_0x357b0e[_0x7d85('0x61')]['to'];return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x357b0e[_0x7d85('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x7d85('0xc7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x530fc0},'limit':0x1,'order':[[_0x7d85('0x7a'),_0x7d85('0x9c')]]}]}]})[_0x7d85('0x37')](handleEntityNotFound(_0x4f4d72,null))['then'](function(_0x5251b7){if(_0x5251b7&&_0x5251b7['List']){_0x5d7815=_0x5251b7[_0x7d85('0x5d')]({'plain':!![]});if(_0x5d7815[_0x7d85('0xc7')]&&_0x5d7815[_0x7d85('0xc7')][_0x7d85('0x9b')][_0x7d85('0x4a')]){return _0x5d7815['List'][_0x7d85('0x9b')][0x0];}return db['CmContact'][_0x7d85('0x59')](_['defaults'](_0x357b0e[_0x7d85('0x61')],{'firstName':_0x530fc0,'mobile':_0x530fc0,'phone':_0x530fc0,'ListId':_0x5d7815[_0x7d85('0x7c')]}));}})['then'](handleEntityNotFound(_0x4f4d72,null))[_0x7d85('0x37')](function(_0x3a3eb9){if(_0x3a3eb9){_0xfc1e4b=_0x3a3eb9;return db['SmsInteraction'][_0x7d85('0x58')]({'where':{'ContactId':_0xfc1e4b['id'],'closed':![],'SmsAccountId':_0x5d7815['id']}})['then'](function(_0x33bc8e){if(_0x33bc8e){return[_0x33bc8e,![]];}return db[_0x7d85('0x9f')][_0x7d85('0x59')]({'UserId':_0x357b0e['user']['id'],'ContactId':_0xfc1e4b['id'],'SmsAccountId':_0x5d7815['id'],'phone':_0x530fc0,'firstMsgDirection':'out','Messages':[_['merge'](_0x357b0e['body'],{'read':![],'body':_0x357b0e[_0x7d85('0x61')][_0x7d85('0x61')],'phone':_0x530fc0,'SmsAccountId':_0x5d7815['id'],'UserId':_0x357b0e[_0x7d85('0x5a')]['id'],'ContactId':_0xfc1e4b['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x7d85('0xc8')}]})[_0x7d85('0x37')](function(_0x256f9f){return[_0x256f9f,!![]];});});}})[_0x7d85('0xa0')](function(_0x5bafb8,_0xf78024){if(_0xf78024){return _0x5bafb8;}return db[_0x7d85('0xa7')]['create'](_['merge'](_0x357b0e['body'],{'read':![],'body':_0x357b0e[_0x7d85('0x61')]['body'],'phone':_0x530fc0,'SmsAccountId':_0x5d7815['id'],'SmsInteractionId':_0x5bafb8['id'],'UserId':_0x357b0e['user']['id'],'ContactId':_0xfc1e4b['id']}))[_0x7d85('0x37')](function(_0x373b85){_0x5bafb8[_0x7d85('0xc9')][_0x7d85('0xc8')]=[];_0x5bafb8[_0x7d85('0xc9')][_0x7d85('0xc8')][_0x7d85('0xca')](_0x373b85[_0x7d85('0xc9')]);return _0x5bafb8;});})[_0x7d85('0x37')](respondWithResult(_0x4f4d72,null))[_0x7d85('0x2b')](handleError(_0x4f4d72,null));};exports[_0x7d85('0x2d')]=function(_0x2560dd,_0x2458c7,_0x4466e1){if(_0x2560dd['body']['id']){delete _0x2560dd['body']['id'];}var _0x319172,_0x3f10b2,_0x157c25;return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x2560dd[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x2458c7,null))[_0x7d85('0x37')](function(_0x17fce1){if(_0x17fce1){_0x157c25=_0x17fce1;logger['debug'](_0x7d85('0x24'),_0x7d85('0x2d'),_0x7d85('0xcb'),_0x17fce1['type'],util[_0x7d85('0xcc')](_0x2560dd[_0x7d85('0x61')],{'showHidden':![],'depth':null}));switch(_0x17fce1[_0x7d85('0x42')]){case _0x7d85('0x81'):if(_0x2560dd[_0x7d85('0x61')]['skebby_dispatch_id']&&_0x2560dd[_0x7d85('0x61')][_0x7d85('0x2d')]){_0x3f10b2=_0x2560dd['body'][_0x7d85('0x2d')];return db[_0x7d85('0xa7')][_0x7d85('0x58')]({'where':{'messageId':_0x2560dd['body'][_0x7d85('0xcd')]}});}break;case _0x7d85('0xce'):if(_0x2560dd[_0x7d85('0x61')][_0x7d85('0xcf')]&&_0x2560dd['body'][_0x7d85('0xd0')]){_0x3f10b2=_0x2560dd[_0x7d85('0x61')][_0x7d85('0xd0')];return db[_0x7d85('0xa7')][_0x7d85('0x58')]({'where':{'messageId':_0x2560dd[_0x7d85('0x61')][_0x7d85('0xcf')]}});}break;case _0x7d85('0x83'):if(_0x2560dd['body']['message_id']&&_0x2560dd[_0x7d85('0x61')]['status_code']){_0x3f10b2=_0x2560dd[_0x7d85('0x61')][_0x7d85('0xd1')];return db[_0x7d85('0xa7')][_0x7d85('0x58')]({'where':{'messageId':_0x2560dd[_0x7d85('0x61')][_0x7d85('0x84')]}});}break;case _0x7d85('0x88'):var _0x24ea0e=_0x2560dd['body']['results'][0x0];if(_0x24ea0e[_0x7d85('0x7f')]&&_0x24ea0e['status'][_0x7d85('0xd2')]===_0x7d85('0xd3')){_0x3f10b2=_0x24ea0e['status']['groupName'];return db['SmsMessage'][_0x7d85('0x58')]({'where':{'messageId':_0x24ea0e[_0x7d85('0x7f')]}});}break;case _0x7d85('0xd4'):if(_0x2560dd[_0x7d85('0x61')][_0x7d85('0x7f')]&&_0x2560dd[_0x7d85('0x61')][_0x7d85('0x2d')]){_0x3f10b2=_0x2560dd['body'][_0x7d85('0x2d')];return db['SmsMessage']['find']({'where':{'messageId':_0x2560dd['body'][_0x7d85('0x7f')]}});}break;case'bandwidth':if(_0x2560dd[_0x7d85('0x61')][0x0][_0x7d85('0x29')]['id']){_0x3f10b2=_0x2560dd[_0x7d85('0x61')][0x0][_0x7d85('0x42')];return db[_0x7d85('0xa7')][_0x7d85('0x58')]({'where':{'messageId':_0x2560dd['body'][0x0][_0x7d85('0x29')]['id']}});}break;case _0x7d85('0x91'):if(_0x2560dd['body'][_0x7d85('0xd5')]&&_0x2560dd[_0x7d85('0x61')]['status']){_0x3f10b2=_0x2560dd[_0x7d85('0x61')][_0x7d85('0x2d')];return db['SmsMessage'][_0x7d85('0x58')]({'where':{'messageId':_0x2560dd[_0x7d85('0x61')][_0x7d85('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x2458c7,null))[_0x7d85('0x37')](function(_0x2baa21){if(_0x2baa21){_0x319172=_0x2baa21;switch(_0x157c25[_0x7d85('0x42')]){case _0x7d85('0x81'):if(_0x3f10b2===_0x7d85('0xd3')){return _0x319172[_0x7d85('0x36')]({'read':!![]});}else{logger[_0x7d85('0x27')](_0x7d85('0x24'),_0x7d85('0x2d'),_0x7d85('0x81'),util[_0x7d85('0xcc')](_0x2560dd['body'],{'showHidden':![],'depth':null}));}break;case _0x7d85('0xce'):if(_0x3f10b2==='1'){return _0x319172[_0x7d85('0x36')]({'read':!![]});}else{logger[_0x7d85('0x27')](_0x7d85('0x24'),_0x7d85('0x2d'),_0x7d85('0x81'),util[_0x7d85('0xcc')](_0x2560dd['body'],{'showHidden':![],'depth':null}));}break;case _0x7d85('0x83'):if(!_0x2560dd[_0x7d85('0x61')][_0x7d85('0xd6')]&&_0x3f10b2>=0xc8&&_0x3f10b2<=0xce){return _0x319172[_0x7d85('0x36')]({'read':!![]});}else{logger[_0x7d85('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7d85('0x2d'),_0x7d85('0x83'),util[_0x7d85('0xcc')](_0x2560dd[_0x7d85('0x61')],{'showHidden':![],'depth':null}));}break;case _0x7d85('0x88'):var _0x14bd0e=_0x2560dd[_0x7d85('0x61')][_0x7d85('0x8a')][0x0];if(_0x14bd0e['status'][_0x7d85('0xd2')]==='DELIVERED'){return _0x319172['update']({'read':!![]});}else{logger['error'](_0x7d85('0x24'),_0x7d85('0x2d'),'infobip',util[_0x7d85('0xcc')](_0x2560dd[_0x7d85('0x61')],{'showHidden':![],'depth':null}));}break;case _0x7d85('0xd4'):if(_0x3f10b2==_0x7d85('0xd7')||_0x3f10b2==_0x7d85('0xd8')){return _0x319172[_0x7d85('0x36')]({'read':!![]});}else{logger['error'](_0x7d85('0x24'),_0x7d85('0x2d'),'clickatell',util[_0x7d85('0xcc')](_0x2560dd[_0x7d85('0x61')],{'showHidden':![],'depth':null}));}break;case _0x7d85('0x90'):if(_0x3f10b2==_0x7d85('0xd9')){return _0x319172[_0x7d85('0x36')]({'read':!![]});}else{logger[_0x7d85('0x27')](_0x7d85('0x24'),_0x7d85('0x2d'),_0x7d85('0x90'),util[_0x7d85('0xcc')](_0x2560dd[_0x7d85('0x61')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3f10b2===_0x7d85('0xda')||_0x3f10b2===_0x7d85('0xdb')){return _0x319172[_0x7d85('0x36')]({'read':!![]});}else{logger[_0x7d85('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7d85('0x2d'),'intelepeer',util['inspect'](_0x2560dd[_0x7d85('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x319172;}})[_0x7d85('0x37')](respondWithResult(_0x2458c7,null))[_0x7d85('0x2b')](handleError(_0x2458c7,null));};exports[_0x7d85('0xdc')]=function(_0x4d2347,_0x1ee868,_0xaf1644){var _0x1b78a7,_0x373b2c,_0x2d57f;return db[_0x7d85('0x50')][_0x7d85('0x58')]({'where':{'id':_0x4d2347[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x1ee868,null))[_0x7d85('0x37')](function(_0x321139){if(_0x321139){_0x2d57f=_0x321139;logger[_0x7d85('0xb1')](_0x7d85('0x24'),_0x7d85('0x2d'),_0x7d85('0xcb'),_0x321139[_0x7d85('0x42')],util[_0x7d85('0xcc')](_0x4d2347[_0x7d85('0x45')],{'showHidden':![],'depth':null}));switch(_0x321139['type']){case _0x7d85('0x8b'):if(_0x4d2347['query'][_0x7d85('0xdd')]&&_0x4d2347[_0x7d85('0x45')]['state']){_0x373b2c=_0x4d2347[_0x7d85('0x45')][_0x7d85('0xde')];return db[_0x7d85('0xa7')]['find']({'where':{'messageId':_0x4d2347['query'][_0x7d85('0xdd')]}});}break;}}})[_0x7d85('0x37')](handleEntityNotFound(_0x1ee868,null))['then'](function(_0x550b68){if(_0x550b68){_0x1b78a7=_0x550b68;switch(_0x2d57f['type']){case _0x7d85('0x8b'):if(_0x373b2c==='2'||_0x373b2c==='6'){return _0x1b78a7['update']({'read':!![]});}else{logger['error'](_0x7d85('0x24'),_0x7d85('0x2d'),_0x7d85('0x8b'),util['inspect'](_0x4d2347['query'],{'showHidden':![],'depth':null}));};break;}return _0x1b78a7;}})['then'](respondWithResult(_0x1ee868,null))[_0x7d85('0x2b')](handleError(_0x1ee868,null));};exports[_0x7d85('0xdf')]=function(_0x3c29a3,_0x1d0a18,_0x2f296c){return db['SmsAccount']['find']({'where':{'id':_0x3c29a3[_0x7d85('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d0a18,null))[_0x7d85('0x37')](function(_0x67b4ac){if(_0x67b4ac){return _0x67b4ac[_0x7d85('0xdf')](_0x3c29a3[_0x7d85('0x61')][_0x7d85('0xe0')],_['omit'](_0x3c29a3[_0x7d85('0x61')],['ids','id'])||{})[_0x7d85('0xa0')](function(_0x3c8616){for(var _0x571696=0x0;_0x571696<_0x3c29a3[_0x7d85('0x61')]['ids'][_0x7d85('0x4a')];_0x571696+=0x1){socket[_0x7d85('0xe1')](_0x7d85('0xe2'),{'UserId':Number(_0x3c29a3['body'][_0x7d85('0xe0')][_0x571696]),'SmsAccountId':Number(_0x3c29a3['params']['id'])});}return _0x3c8616;});}})[_0x7d85('0x37')](respondWithResult(_0x1d0a18,null))[_0x7d85('0x2b')](handleError(_0x1d0a18,null));};exports[_0x7d85('0xe3')]=function(_0x181591,_0x235ede,_0xe5acf){return db['SmsAccount'][_0x7d85('0x58')]({'where':{'id':_0x181591[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x235ede,null))[_0x7d85('0x37')](function(_0x892a55){if(_0x892a55){return _0x892a55[_0x7d85('0xe3')](_0x181591[_0x7d85('0x45')]['ids'])[_0x7d85('0x37')](function(){if(_[_0x7d85('0xe4')](_0x181591[_0x7d85('0x45')][_0x7d85('0xe0')])){for(var _0x5b1991=0x0;_0x5b1991<_0x181591['query'][_0x7d85('0xe0')]['length'];_0x5b1991+=0x1){socket[_0x7d85('0xe1')](_0x7d85('0xe5'),{'UserId':Number(_0x181591[_0x7d85('0x45')][_0x7d85('0xe0')][_0x5b1991]),'SmsAccountId':Number(_0x181591[_0x7d85('0x54')]['id'])});}}else{socket[_0x7d85('0xe1')](_0x7d85('0xe5'),{'UserId':Number(_0x181591[_0x7d85('0x45')][_0x7d85('0xe0')]),'SmsAccountId':Number(_0x181591[_0x7d85('0x54')]['id'])});}});}})[_0x7d85('0x37')](respondWithStatusCode(_0x235ede,null))[_0x7d85('0x2b')](handleError(_0x235ede,null));};exports['getAgents']=function(_0x13f84c,_0x5e70f2,_0x551cec){var _0x2498a1={};var _0x42edd4={};var _0x37f9f;var _0x224bbd;return db['SmsAccount'][_0x7d85('0x65')]({'where':{'id':_0x13f84c[_0x7d85('0x54')]['id']}})[_0x7d85('0x37')](handleEntityNotFound(_0x5e70f2,null))[_0x7d85('0x37')](function(_0x51e7ed){if(_0x51e7ed){_0x37f9f=_0x51e7ed;_0x42edd4[_0x7d85('0x44')]=_['keys'](db[_0x7d85('0xaa')]['rawAttributes']);_0x42edd4[_0x7d85('0x45')]=_['keys'](_0x13f84c[_0x7d85('0x45')]);_0x42edd4[_0x7d85('0x47')]=_[_0x7d85('0x55')](_0x42edd4[_0x7d85('0x44')],_0x42edd4[_0x7d85('0x45')]);_0x2498a1[_0x7d85('0x48')]=_[_0x7d85('0x55')](_0x42edd4[_0x7d85('0x44')],qs[_0x7d85('0x49')](_0x13f84c[_0x7d85('0x45')]['fields']));_0x2498a1[_0x7d85('0x48')]=_0x2498a1[_0x7d85('0x48')]['length']?_0x2498a1[_0x7d85('0x48')]:_0x42edd4[_0x7d85('0x44')];_0x2498a1[_0x7d85('0x67')]=qs[_0x7d85('0x4c')](_0x13f84c['query']['sort']);_0x2498a1[_0x7d85('0x4d')]=qs['filters'](_[_0x7d85('0x68')](_0x13f84c[_0x7d85('0x45')],_0x42edd4['filters']));if(_0x13f84c[_0x7d85('0x45')]['filter']){_0x2498a1[_0x7d85('0x4d')]=_[_0x7d85('0x4f')](_0x2498a1[_0x7d85('0x4d')],{'$or':_['map'](_0x2498a1[_0x7d85('0x48')],function(_0x85442f){var _0x36c09f={};_0x36c09f[_0x85442f]={'$like':'%'+_0x13f84c[_0x7d85('0x45')][_0x7d85('0x4e')]+'%'};return _0x36c09f;})});}_0x2498a1=_[_0x7d85('0x4f')]({},_0x2498a1,_0x13f84c[_0x7d85('0x57')]);return _0x37f9f['getAgents'](_0x2498a1);}})[_0x7d85('0x37')](function(_0x23c561){if(_0x23c561){_0x224bbd=_0x23c561[_0x7d85('0x4a')];if(!_0x13f84c[_0x7d85('0x45')]['hasOwnProperty'](_0x7d85('0x66'))){_0x2498a1[_0x7d85('0x30')]=qs[_0x7d85('0x30')](_0x13f84c[_0x7d85('0x45')][_0x7d85('0x30')]);_0x2498a1[_0x7d85('0x32')]=qs[_0x7d85('0x32')](_0x13f84c['query'][_0x7d85('0x32')]);}return _0x37f9f['getAgents'](_0x2498a1);}})[_0x7d85('0x37')](function(_0x4102e8){if(_0x4102e8){return _0x4102e8?{'count':_0x224bbd,'rows':_0x4102e8}:null;}})[_0x7d85('0x37')](respondWithResult(_0x5e70f2,null))[_0x7d85('0x2b')](handleError(_0x5e70f2,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fcde4b2..def823e 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 _0x4dea=['events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3b100c,_0x628950){var _0x5e81e0=function(_0x53c774){while(--_0x53c774){_0x3b100c['push'](_0x3b100c['shift']());}};_0x5e81e0(++_0x628950);}(_0x4dea,0x165));var _0xa4de=function(_0x34daca,_0x524913){_0x34daca=_0x34daca-0x0;var _0xec7b9a=_0x4dea[_0x34daca];return _0xec7b9a;};'use strict';var EventEmitter=require(_0xa4de('0x0'));var SmsAccount=require(_0xa4de('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa4de('0x2')](0x0);var events={'afterCreate':_0xa4de('0x3'),'afterUpdate':_0xa4de('0x4'),'afterDestroy':_0xa4de('0x5')};function emitEvent(_0x617c56){return function(_0x43f071,_0x5a70fc,_0x5d3b70){SmsAccountEvents[_0xa4de('0x6')](_0x617c56+':'+_0x43f071['id'],_0x43f071);SmsAccountEvents['emit'](_0x617c56,_0x43f071);_0x5d3b70(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x9dc5=['update','remove','emit','hasOwnProperty','events','SmsAccount','setMaxListeners','save'];(function(_0x53d148,_0x5b6fd5){var _0x399e69=function(_0x204eb5){while(--_0x204eb5){_0x53d148['push'](_0x53d148['shift']());}};_0x399e69(++_0x5b6fd5);}(_0x9dc5,0xbc));var _0x59dc=function(_0x391c10,_0x69974d){_0x391c10=_0x391c10-0x0;var _0x1e220f=_0x9dc5[_0x391c10];return _0x1e220f;};'use strict';var EventEmitter=require(_0x59dc('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x59dc('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x59dc('0x2')](0x0);var events={'afterCreate':_0x59dc('0x3'),'afterUpdate':_0x59dc('0x4'),'afterDestroy':_0x59dc('0x5')};function emitEvent(_0x57d65f){return function(_0xd3dbf8,_0x33ce80,_0x2a5bce){SmsAccountEvents[_0x59dc('0x6')](_0x57d65f+':'+_0xd3dbf8['id'],_0xd3dbf8);SmsAccountEvents[_0x59dc('0x6')](_0x57d65f,_0xd3dbf8);_0x2a5bce(null);};}for(var e in events){if(events[_0x59dc('0x7')](e)){var event=events[e];SmsAccount['hook'](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 5f70201..e986762 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 _0xe5c7=['exports','define','SmsAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes'];(function(_0x3ff417,_0x1217d8){var _0x208cee=function(_0x165a04){while(--_0x165a04){_0x3ff417['push'](_0x3ff417['shift']());}};_0x208cee(++_0x1217d8);}(_0xe5c7,0xe0));var _0x7e5c=function(_0x37d050,_0x3d31ca){_0x37d050=_0x37d050-0x0;var _0x1b658c=_0xe5c7[_0x37d050];return _0x1b658c;};'use strict';var _=require(_0x7e5c('0x0'));var util=require(_0x7e5c('0x1'));var logger=require(_0x7e5c('0x2'))(_0x7e5c('0x3'));var moment=require(_0x7e5c('0x4'));var BPromise=require(_0x7e5c('0x5'));var rp=require(_0x7e5c('0x6'));var fs=require('fs');var path=require(_0x7e5c('0x7'));var rimraf=require('rimraf');var config=require(_0x7e5c('0x8'));var attributes=require(_0x7e5c('0x9'));module[_0x7e5c('0xa')]=function(_0x12c928,_0x53571a){return _0x12c928[_0x7e5c('0xb')](_0x7e5c('0xc'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d66=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x39b3ed,_0x430e1e){var _0x9b596=function(_0x19a78f){while(--_0x19a78f){_0x39b3ed['push'](_0x39b3ed['shift']());}};_0x9b596(++_0x430e1e);}(_0x2d66,0x144));var _0x62d6=function(_0x907bee,_0x314ceb){_0x907bee=_0x907bee-0x0;var _0xeb47c6=_0x2d66[_0x907bee];return _0xeb47c6;};'use strict';var _=require(_0x62d6('0x0'));var util=require(_0x62d6('0x1'));var logger=require(_0x62d6('0x2'))(_0x62d6('0x3'));var moment=require(_0x62d6('0x4'));var BPromise=require(_0x62d6('0x5'));var rp=require(_0x62d6('0x6'));var fs=require('fs');var path=require(_0x62d6('0x7'));var rimraf=require(_0x62d6('0x8'));var config=require(_0x62d6('0x9'));var attributes=require(_0x62d6('0xa'));module[_0x62d6('0xb')]=function(_0x3ed215,_0x479faa){return _0x3ed215[_0x62d6('0xc')](_0x62d6('0xd'),attributes,{'tableName':_0x62d6('0xe'),'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 5b2ed70..db4d178 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 _0x3329=['ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','then','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x59cf44,_0x40e239){var _0x46d79c=function(_0x5481be){while(--_0x5481be){_0x59cf44['push'](_0x59cf44['shift']());}};_0x46d79c(++_0x40e239);}(_0x3329,0x12b));var _0x9332=function(_0x49ac86,_0x3855b6){_0x49ac86=_0x49ac86-0x0;var _0x48f2c0=_0x3329[_0x49ac86];return _0x48f2c0;};'use strict';var _=require(_0x9332('0x0'));var util=require(_0x9332('0x1'));var moment=require('moment');var BPromise=require(_0x9332('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9332('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9332('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9332('0x5'));var jayson=require(_0x9332('0x6'));var client=jayson[_0x9332('0x7')][_0x9332('0x8')]({'port':0x232a});config[_0x9332('0x9')]=_[_0x9332('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9332('0xb'))(new Redis(config['redis']));require(_0x9332('0xc'))['register'](socket);function respondWithRpcPromise(_0x719cff,_0x5ad753,_0x93f077){return new BPromise(function(_0x5a252a,_0x3548c7){return client[_0x9332('0xd')](_0x719cff,_0x93f077)['then'](function(_0x2a1de5){logger[_0x9332('0xe')](_0x9332('0xf'),_0x5ad753,_0x9332('0x10'));logger[_0x9332('0x11')](_0x9332('0x12'),_0x5ad753,_0x9332('0x10'),JSON[_0x9332('0x13')](_0x2a1de5));if(_0x2a1de5['error']){if(_0x2a1de5[_0x9332('0x14')][_0x9332('0x15')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5ad753,_0x2a1de5[_0x9332('0x14')]['message']);return _0x3548c7(_0x2a1de5['error']['message']);}logger[_0x9332('0x14')](_0x9332('0xf'),_0x5ad753,_0x2a1de5[_0x9332('0x14')][_0x9332('0x16')]);return _0x5a252a(_0x2a1de5[_0x9332('0x14')][_0x9332('0x16')]);}else{logger[_0x9332('0xe')](_0x9332('0xf'),_0x5ad753,_0x9332('0x10'));_0x5a252a(_0x2a1de5[_0x9332('0x17')]['message']);}})[_0x9332('0x18')](function(_0x2457f7){logger[_0x9332('0x14')](_0x9332('0xf'),_0x5ad753,_0x2457f7);_0x3548c7(_0x2457f7);});});}exports[_0x9332('0x19')]=function(_0x1026a6){var _0x36a951=this;return new Promise(function(_0x2f6b2b,_0x14c1f0){return db[_0x9332('0x1a')][_0x9332('0x1b')]({'raw':_0x1026a6['options']?_0x1026a6[_0x9332('0x1c')][_0x9332('0x1d')]===undefined?!![]:![]:!![],'where':_0x1026a6['options']?_0x1026a6['options'][_0x9332('0x1e')]||null:null,'attributes':_0x1026a6[_0x9332('0x1c')]?_0x1026a6[_0x9332('0x1c')]['attributes']||null:null,'include':_0x1026a6[_0x9332('0x1c')]?_0x1026a6['options'][_0x9332('0x1f')]?_[_0x9332('0x20')](_0x1026a6['options'][_0x9332('0x1f')],function(_0x442782){return{'model':db[_0x442782[_0x9332('0x21')]],'as':_0x442782['as'],'attributes':_0x442782[_0x9332('0x22')],'include':_0x442782[_0x9332('0x1f')]?_[_0x9332('0x20')](_0x442782['include'],function(_0x5c10fe){return{'model':db[_0x5c10fe[_0x9332('0x21')]],'as':_0x5c10fe['as'],'attributes':_0x5c10fe[_0x9332('0x22')],'include':_0x5c10fe['include']?_[_0x9332('0x20')](_0x5c10fe[_0x9332('0x1f')],function(_0x3e96b9){return{'model':db[_0x3e96b9[_0x9332('0x21')]],'as':_0x3e96b9['as'],'attributes':_0x3e96b9[_0x9332('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9332('0x23')](function(_0x49580b){logger[_0x9332('0xe')]('ShowSmsAccount',_0x1026a6);logger[_0x9332('0x11')](_0x9332('0x19'),_0x1026a6,JSON[_0x9332('0x13')](_0x49580b));_0x2f6b2b(_0x49580b);})['catch'](function(_0x20531e){logger[_0x9332('0x14')](_0x9332('0x19'),_0x20531e['message'],_0x1026a6);_0x14c1f0(_0x36a951[_0x9332('0x14')](0x1f4,_0x20531e[_0x9332('0x16')]));});});}; \ No newline at end of file +var _0x287b=['ShowSmsAccount','stringify','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','SmsAccount','options','where','include','model','attributes','map'];(function(_0x56abc7,_0xf22e21){var _0x29cb27=function(_0x57feb8){while(--_0x57feb8){_0x56abc7['push'](_0x56abc7['shift']());}};_0x29cb27(++_0xf22e21);}(_0x287b,0x19b));var _0xb287=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x287b[_0x5f36cd];return _0x49832a;};'use strict';var _=require(_0xb287('0x0'));var util=require(_0xb287('0x1'));var moment=require(_0xb287('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb287('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb287('0x4'));var logger=require(_0xb287('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb287('0x6'));var client=jayson[_0xb287('0x7')][_0xb287('0x8')]({'port':0x232a});config[_0xb287('0x9')]=_[_0xb287('0xa')](config[_0xb287('0x9')],{'host':_0xb287('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb287('0x9')]));require(_0xb287('0xc'))[_0xb287('0xd')](socket);function respondWithRpcPromise(_0x1cb0c5,_0x4f7d4a,_0x571541){return new BPromise(function(_0x5d8151,_0x58b8e3){return client[_0xb287('0xe')](_0x1cb0c5,_0x571541)[_0xb287('0xf')](function(_0x5adda2){logger[_0xb287('0x10')](_0xb287('0x11'),_0x4f7d4a,_0xb287('0x12'));logger[_0xb287('0x13')](_0xb287('0x14'),_0x4f7d4a,'request\x20sent',JSON['stringify'](_0x5adda2));if(_0x5adda2['error']){if(_0x5adda2[_0xb287('0x15')]['code']===0x1f4){logger[_0xb287('0x15')](_0xb287('0x11'),_0x4f7d4a,_0x5adda2[_0xb287('0x15')][_0xb287('0x16')]);return _0x58b8e3(_0x5adda2['error'][_0xb287('0x16')]);}logger[_0xb287('0x15')]('SmsAccount,\x20%s,\x20%s',_0x4f7d4a,_0x5adda2[_0xb287('0x15')][_0xb287('0x16')]);return _0x5d8151(_0x5adda2['error'][_0xb287('0x16')]);}else{logger['info'](_0xb287('0x11'),_0x4f7d4a,_0xb287('0x12'));_0x5d8151(_0x5adda2[_0xb287('0x17')]['message']);}})['catch'](function(_0x4fe8a1){logger[_0xb287('0x15')](_0xb287('0x11'),_0x4f7d4a,_0x4fe8a1);_0x58b8e3(_0x4fe8a1);});});}exports['ShowSmsAccount']=function(_0x3f9fac){var _0x1e096b=this;return new Promise(function(_0x47dce4,_0x94b181){return db[_0xb287('0x18')]['find']({'raw':_0x3f9fac[_0xb287('0x19')]?_0x3f9fac[_0xb287('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9fac[_0xb287('0x19')]?_0x3f9fac[_0xb287('0x19')][_0xb287('0x1a')]||null:null,'attributes':_0x3f9fac[_0xb287('0x19')]?_0x3f9fac[_0xb287('0x19')]['attributes']||null:null,'include':_0x3f9fac['options']?_0x3f9fac[_0xb287('0x19')]['include']?_['map'](_0x3f9fac[_0xb287('0x19')][_0xb287('0x1b')],function(_0x1c29e9){return{'model':db[_0x1c29e9[_0xb287('0x1c')]],'as':_0x1c29e9['as'],'attributes':_0x1c29e9[_0xb287('0x1d')],'include':_0x1c29e9[_0xb287('0x1b')]?_[_0xb287('0x1e')](_0x1c29e9[_0xb287('0x1b')],function(_0x5608af){return{'model':db[_0x5608af['model']],'as':_0x5608af['as'],'attributes':_0x5608af[_0xb287('0x1d')],'include':_0x5608af[_0xb287('0x1b')]?_[_0xb287('0x1e')](_0x5608af[_0xb287('0x1b')],function(_0x359001){return{'model':db[_0x359001[_0xb287('0x1c')]],'as':_0x359001['as'],'attributes':_0x359001[_0xb287('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb287('0xf')](function(_0x170582){logger['info'](_0xb287('0x1f'),_0x3f9fac);logger['debug'](_0xb287('0x1f'),_0x3f9fac,JSON[_0xb287('0x20')](_0x170582));_0x47dce4(_0x170582);})[_0xb287('0x21')](function(_0x34ab11){logger['error']('ShowSmsAccount',_0x34ab11['message'],_0x3f9fac);_0x94b181(_0x1e096b['error'](0x1f4,_0x34ab11['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 149cd1f..d6f7aac 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(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 333f5f8..42eb475 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(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x10bd17,_0x1df557){var _0x244ed8=function(_0x5bde0f){while(--_0x5bde0f){_0x10bd17['push'](_0x10bd17['shift']());}};_0x244ed8(++_0x1df557);}(_0x55ca,0x126));var _0xa55c=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0x55ca[_0x112147];return _0x3ba744;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('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 9ce9b32..f6c33de 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 _0xd4df=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0x59dd54,_0x495d0a){var _0x1025d3=function(_0x4fe209){while(--_0x4fe209){_0x59dd54['push'](_0x59dd54['shift']());}};_0x1025d3(++_0x495d0a);}(_0xd4df,0x96));var _0xfd4d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4df[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfd4d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfd4d('0x1')],'allowNull':![],'defaultValue':_0xfd4d('0x2')},'appdata':{'type':Sequelize[_0xfd4d('0x3')]()},'description':{'type':Sequelize[_0xfd4d('0x1')]},'interval':{'type':Sequelize[_0xfd4d('0x1')],'defaultValue':_0xfd4d('0x4')}}; \ No newline at end of file +var _0x1266=['sequelize','INTEGER','STRING'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x1266,0x75));var _0x6126=function(_0x4676f8,_0x23f45e){_0x4676f8=_0x4676f8-0x0;var _0x4819d4=_0x1266[_0x4676f8];return _0x4819d4;};'use strict';var Sequelize=require(_0x6126('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6126('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6126('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6126('0x2')]},'interval':{'type':Sequelize[_0x6126('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 47b5d9e..f8c0f40 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 _0x3ef6=['map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','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/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','then','destroy','end','error','stack','name','send','index'];(function(_0x70efcf,_0x5b840a){var _0x56b853=function(_0x510bdd){while(--_0x510bdd){_0x70efcf['push'](_0x70efcf['shift']());}};_0x56b853(++_0x5b840a);}(_0x3ef6,0x1a2));var _0x63ef=function(_0x11dc6c,_0x21bdfe){_0x11dc6c=_0x11dc6c-0x0;var _0xddae9c=_0x3ef6[_0x11dc6c];return _0xddae9c;};'use strict';var emlformat=require(_0x63ef('0x0'));var rimraf=require(_0x63ef('0x1'));var zipdir=require(_0x63ef('0x2'));var jsonpatch=require(_0x63ef('0x3'));var rp=require('request-promise');var moment=require(_0x63ef('0x4'));var BPromise=require(_0x63ef('0x5'));var Mustache=require(_0x63ef('0x6'));var util=require('util');var path=require(_0x63ef('0x7'));var sox=require(_0x63ef('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63ef('0x9'));var _=require(_0x63ef('0xa'));var squel=require(_0x63ef('0xb'));var crypto=require(_0x63ef('0xc'));var jsforce=require(_0x63ef('0xd'));var deskjs=require(_0x63ef('0xe'));var toCsv=require(_0x63ef('0xf'));var querystring=require(_0x63ef('0x10'));var Papa=require(_0x63ef('0x11'));var Redis=require('ioredis');var authService=require(_0x63ef('0x12'));var qs=require(_0x63ef('0x13'));var as=require(_0x63ef('0x14'));var hardwareService=require(_0x63ef('0x15'));var logger=require(_0x63ef('0x16'))(_0x63ef('0x17'));var utils=require(_0x63ef('0x18'));var config=require(_0x63ef('0x19'));var licenseUtil=require(_0x63ef('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9de8,_0x3486cc){_0x3486cc=_0x3486cc||0xcc;return function(_0x57f214){if(_0x57f214){return _0x5e9de8[_0x63ef('0x1b')](_0x3486cc);}return _0x5e9de8[_0x63ef('0x1c')](_0x3486cc)['end']();};}function respondWithResult(_0x3aabf1,_0x161299){_0x161299=_0x161299||0xc8;return function(_0x325986){if(_0x325986){return _0x3aabf1['status'](_0x161299)[_0x63ef('0x1d')](_0x325986);}};}function respondWithFilteredResult(_0x1b2c12,_0xe824d5){return function(_0x21fc8b){if(_0x21fc8b){var _0x3caf9a=typeof _0xe824d5['offset']===_0x63ef('0x1e')&&typeof _0xe824d5[_0x63ef('0x1f')]===_0x63ef('0x1e');var _0x56db15=_0x21fc8b[_0x63ef('0x20')];var _0x115844=_0x3caf9a?0x0:_0xe824d5['offset'];var _0x45659f=_0x3caf9a?_0x21fc8b['count']:_0xe824d5[_0x63ef('0x21')]+_0xe824d5[_0x63ef('0x1f')];var _0x2d28c6;if(_0x45659f>=_0x56db15){_0x45659f=_0x56db15;_0x2d28c6=0xc8;}else{_0x2d28c6=0xce;}_0x1b2c12[_0x63ef('0x1c')](_0x2d28c6);return _0x1b2c12[_0x63ef('0x22')]('Content-Range',_0x115844+'-'+_0x45659f+'/'+_0x56db15)[_0x63ef('0x1d')](_0x21fc8b);}return null;};}function patchUpdates(_0x2e2c78){return function(_0x2230b9){try{jsonpatch[_0x63ef('0x23')](_0x2230b9,_0x2e2c78,!![]);}catch(_0x27d62f){return BPromise['reject'](_0x27d62f);}return _0x2230b9['save']();};}function saveUpdates(_0x27efa9,_0x473703){return function(_0x2661ea){if(_0x2661ea){return _0x2661ea['update'](_0x27efa9)[_0x63ef('0x24')](function(_0x33779a){return _0x33779a;});}return null;};}function removeEntity(_0x1e4d7b,_0x95c6c5){return function(_0x3b1c4a){if(_0x3b1c4a){return _0x3b1c4a[_0x63ef('0x25')]()[_0x63ef('0x24')](function(){_0x1e4d7b['status'](0xcc)[_0x63ef('0x26')]();});}};}function handleEntityNotFound(_0x3fc7fe,_0x18323a){return function(_0x3c64f3){if(!_0x3c64f3){_0x3fc7fe[_0x63ef('0x1b')](0x194);}return _0x3c64f3;};}function handleError(_0xff6e3f,_0x5e024f){_0x5e024f=_0x5e024f||0x1f4;return function(_0x2f0f37){logger[_0x63ef('0x27')](_0x2f0f37[_0x63ef('0x28')]);if(_0x2f0f37[_0x63ef('0x29')]){delete _0x2f0f37[_0x63ef('0x29')];}_0xff6e3f[_0x63ef('0x1c')](_0x5e024f)[_0x63ef('0x2a')](_0x2f0f37);};}exports[_0x63ef('0x2b')]=function(_0x553e9b,_0x151843){var _0x30df1f={},_0x3880e9={},_0x4f3d01={'count':0x0,'rows':[]};var _0x399d0c=_[_0x63ef('0x2c')](db[_0x63ef('0x2d')][_0x63ef('0x2e')],function(_0x203d7b){return{'name':_0x203d7b[_0x63ef('0x2f')],'type':_0x203d7b[_0x63ef('0x30')][_0x63ef('0x31')]};});_0x3880e9[_0x63ef('0x32')]=_[_0x63ef('0x2c')](_0x399d0c,'name');_0x3880e9[_0x63ef('0x33')]=_[_0x63ef('0x34')](_0x553e9b[_0x63ef('0x33')]);_0x3880e9['filters']=_['intersection'](_0x3880e9[_0x63ef('0x32')],_0x3880e9[_0x63ef('0x33')]);_0x30df1f[_0x63ef('0x35')]=_[_0x63ef('0x36')](_0x3880e9[_0x63ef('0x32')],qs[_0x63ef('0x37')](_0x553e9b['query'][_0x63ef('0x37')]));_0x30df1f[_0x63ef('0x35')]=_0x30df1f['attributes'][_0x63ef('0x38')]?_0x30df1f['attributes']:_0x3880e9[_0x63ef('0x32')];if(!_0x553e9b[_0x63ef('0x33')][_0x63ef('0x39')](_0x63ef('0x3a'))){_0x30df1f['limit']=qs['limit'](_0x553e9b[_0x63ef('0x33')][_0x63ef('0x1f')]);_0x30df1f['offset']=qs['offset'](_0x553e9b[_0x63ef('0x33')][_0x63ef('0x21')]);}_0x30df1f[_0x63ef('0x3b')]=qs[_0x63ef('0x3c')](_0x553e9b[_0x63ef('0x33')][_0x63ef('0x3c')]);_0x30df1f[_0x63ef('0x3d')]=qs[_0x63ef('0x3e')](_[_0x63ef('0x3f')](_0x553e9b[_0x63ef('0x33')],_0x3880e9[_0x63ef('0x3e')]),_0x399d0c);if(_0x553e9b[_0x63ef('0x33')][_0x63ef('0x40')]){_0x30df1f[_0x63ef('0x3d')]=_['merge'](_0x30df1f[_0x63ef('0x3d')],{'$or':_[_0x63ef('0x2c')](_0x399d0c,function(_0x349bda){if(_0x349bda[_0x63ef('0x30')]!=='VIRTUAL'){var _0x2c6ac4={};_0x2c6ac4[_0x349bda[_0x63ef('0x29')]]={'$like':'%'+_0x553e9b[_0x63ef('0x33')]['filter']+'%'};return _0x2c6ac4;}})});}_0x30df1f=_[_0x63ef('0x41')]({},_0x30df1f,_0x553e9b[_0x63ef('0x42')]);var _0x267298={'where':_0x30df1f[_0x63ef('0x3d')]};return db['SmsApplication'][_0x63ef('0x20')](_0x267298)[_0x63ef('0x24')](function(_0x4c97ed){_0x4f3d01[_0x63ef('0x20')]=_0x4c97ed;if(_0x553e9b[_0x63ef('0x33')]['includeAll']){_0x30df1f[_0x63ef('0x43')]=[{'all':!![]}];}return db[_0x63ef('0x2d')][_0x63ef('0x44')](_0x30df1f);})[_0x63ef('0x24')](function(_0xebc09a){_0x4f3d01['rows']=_0xebc09a;return _0x4f3d01;})[_0x63ef('0x24')](respondWithFilteredResult(_0x151843,_0x30df1f))[_0x63ef('0x45')](handleError(_0x151843,null));};exports[_0x63ef('0x46')]=function(_0x343885,_0x8d15b7){var _0x2d8a3d={'raw':!![],'where':{'id':_0x343885[_0x63ef('0x47')]['id']}},_0x9c8561={};_0x9c8561[_0x63ef('0x32')]=_[_0x63ef('0x34')](db[_0x63ef('0x2d')][_0x63ef('0x2e')]);_0x9c8561[_0x63ef('0x33')]=_[_0x63ef('0x34')](_0x343885['query']);_0x9c8561['filters']=_[_0x63ef('0x36')](_0x9c8561[_0x63ef('0x32')],_0x9c8561[_0x63ef('0x33')]);_0x2d8a3d[_0x63ef('0x35')]=_[_0x63ef('0x36')](_0x9c8561[_0x63ef('0x32')],qs[_0x63ef('0x37')](_0x343885[_0x63ef('0x33')]['fields']));_0x2d8a3d[_0x63ef('0x35')]=_0x2d8a3d[_0x63ef('0x35')][_0x63ef('0x38')]?_0x2d8a3d[_0x63ef('0x35')]:_0x9c8561[_0x63ef('0x32')];if(_0x343885[_0x63ef('0x33')][_0x63ef('0x48')]){_0x2d8a3d[_0x63ef('0x43')]=[{'all':!![]}];}_0x2d8a3d=_[_0x63ef('0x41')]({},_0x2d8a3d,_0x343885[_0x63ef('0x42')]);return db[_0x63ef('0x2d')][_0x63ef('0x49')](_0x2d8a3d)[_0x63ef('0x24')](handleEntityNotFound(_0x8d15b7,null))[_0x63ef('0x24')](respondWithResult(_0x8d15b7,null))[_0x63ef('0x45')](handleError(_0x8d15b7,null));};exports[_0x63ef('0x4a')]=function(_0x3ed8cf,_0xc5592a){return db[_0x63ef('0x2d')][_0x63ef('0x4a')](_0x3ed8cf[_0x63ef('0x4b')],{})['then'](respondWithResult(_0xc5592a,0xc9))['catch'](handleError(_0xc5592a,null));};exports[_0x63ef('0x4c')]=function(_0x1fd51f,_0x39f2be){if(_0x1fd51f[_0x63ef('0x4b')]['id']){delete _0x1fd51f[_0x63ef('0x4b')]['id'];}return db[_0x63ef('0x2d')][_0x63ef('0x49')]({'where':{'id':_0x1fd51f[_0x63ef('0x47')]['id']}})[_0x63ef('0x24')](handleEntityNotFound(_0x39f2be,null))[_0x63ef('0x24')](saveUpdates(_0x1fd51f[_0x63ef('0x4b')],null))[_0x63ef('0x24')](respondWithResult(_0x39f2be,null))['catch'](handleError(_0x39f2be,null));};exports[_0x63ef('0x25')]=function(_0x35f26a,_0x13574e){return db[_0x63ef('0x2d')][_0x63ef('0x49')]({'where':{'id':_0x35f26a[_0x63ef('0x47')]['id']}})[_0x63ef('0x24')](handleEntityNotFound(_0x13574e,null))['then'](removeEntity(_0x13574e,null))[_0x63ef('0x45')](handleError(_0x13574e,null));}; \ No newline at end of file +var _0x60a4=['undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x5a5ad8,_0x34911c){var _0x5512e5=function(_0x18cbe6){while(--_0x18cbe6){_0x5a5ad8['push'](_0x5a5ad8['shift']());}};_0x5512e5(++_0x34911c);}(_0x60a4,0x15b));var _0x460a=function(_0x21d0d7,_0x4c55a3){_0x21d0d7=_0x21d0d7-0x0;var _0x5e725b=_0x60a4[_0x21d0d7];return _0x5e725b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x460a('0x0'));var zipdir=require(_0x460a('0x1'));var jsonpatch=require(_0x460a('0x2'));var rp=require(_0x460a('0x3'));var moment=require('moment');var BPromise=require(_0x460a('0x4'));var Mustache=require(_0x460a('0x5'));var util=require('util');var path=require(_0x460a('0x6'));var sox=require(_0x460a('0x7'));var csv=require(_0x460a('0x8'));var ejs=require(_0x460a('0x9'));var fs=require('fs');var fs_extra=require(_0x460a('0xa'));var _=require(_0x460a('0xb'));var squel=require(_0x460a('0xc'));var crypto=require(_0x460a('0xd'));var jsforce=require(_0x460a('0xe'));var deskjs=require(_0x460a('0xf'));var toCsv=require(_0x460a('0x8'));var querystring=require(_0x460a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x460a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x460a('0x12'));var hardwareService=require(_0x460a('0x13'));var logger=require(_0x460a('0x14'))(_0x460a('0x15'));var utils=require('../../config/utils');var config=require(_0x460a('0x16'));var licenseUtil=require(_0x460a('0x17'));var db=require(_0x460a('0x18'))['db'];function respondWithStatusCode(_0x1145ad,_0x47b14f){_0x47b14f=_0x47b14f||0xcc;return function(_0x2807ab){if(_0x2807ab){return _0x1145ad['sendStatus'](_0x47b14f);}return _0x1145ad[_0x460a('0x19')](_0x47b14f)[_0x460a('0x1a')]();};}function respondWithResult(_0x65bd48,_0x52468a){_0x52468a=_0x52468a||0xc8;return function(_0x580116){if(_0x580116){return _0x65bd48[_0x460a('0x19')](_0x52468a)['json'](_0x580116);}};}function respondWithFilteredResult(_0x50577e,_0x2ba383){return function(_0x1a70cd){if(_0x1a70cd){var _0x4a0dff=typeof _0x2ba383[_0x460a('0x1b')]===_0x460a('0x1c')&&typeof _0x2ba383['limit']==='undefined';var _0x27e69f=_0x1a70cd[_0x460a('0x1d')];var _0x4f86e0=_0x4a0dff?0x0:_0x2ba383[_0x460a('0x1b')];var _0x297ea6=_0x4a0dff?_0x1a70cd[_0x460a('0x1d')]:_0x2ba383[_0x460a('0x1b')]+_0x2ba383['limit'];var _0x554a2d;if(_0x297ea6>=_0x27e69f){_0x297ea6=_0x27e69f;_0x554a2d=0xc8;}else{_0x554a2d=0xce;}_0x50577e['status'](_0x554a2d);return _0x50577e[_0x460a('0x1e')](_0x460a('0x1f'),_0x4f86e0+'-'+_0x297ea6+'/'+_0x27e69f)[_0x460a('0x20')](_0x1a70cd);}return null;};}function patchUpdates(_0x5be8b4){return function(_0x1e2c9e){try{jsonpatch[_0x460a('0x21')](_0x1e2c9e,_0x5be8b4,!![]);}catch(_0x5e492c){return BPromise[_0x460a('0x22')](_0x5e492c);}return _0x1e2c9e[_0x460a('0x23')]();};}function saveUpdates(_0x3d7b64,_0x544728){return function(_0x33ceaa){if(_0x33ceaa){return _0x33ceaa[_0x460a('0x24')](_0x3d7b64)[_0x460a('0x25')](function(_0x2df6a9){return _0x2df6a9;});}return null;};}function removeEntity(_0x25f964,_0x3be1de){return function(_0x71a3e4){if(_0x71a3e4){return _0x71a3e4[_0x460a('0x26')]()[_0x460a('0x25')](function(){_0x25f964['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe17eb3,_0x2810a5){return function(_0x19f68c){if(!_0x19f68c){_0xe17eb3[_0x460a('0x27')](0x194);}return _0x19f68c;};}function handleError(_0x26ec29,_0xf95933){_0xf95933=_0xf95933||0x1f4;return function(_0x5d8216){logger[_0x460a('0x28')](_0x5d8216[_0x460a('0x29')]);if(_0x5d8216['name']){delete _0x5d8216[_0x460a('0x2a')];}_0x26ec29[_0x460a('0x19')](_0xf95933)[_0x460a('0x2b')](_0x5d8216);};}exports['index']=function(_0x4b9ccc,_0x338bd4){var _0x2b7c58={},_0x58bec2={},_0x3969bf={'count':0x0,'rows':[]};var _0x474a5c=_[_0x460a('0x2c')](db[_0x460a('0x2d')][_0x460a('0x2e')],function(_0x3f9e5b){return{'name':_0x3f9e5b[_0x460a('0x2f')],'type':_0x3f9e5b['type']['key']};});_0x58bec2[_0x460a('0x30')]=_['map'](_0x474a5c,'name');_0x58bec2[_0x460a('0x31')]=_[_0x460a('0x32')](_0x4b9ccc[_0x460a('0x31')]);_0x58bec2[_0x460a('0x33')]=_['intersection'](_0x58bec2[_0x460a('0x30')],_0x58bec2[_0x460a('0x31')]);_0x2b7c58[_0x460a('0x34')]=_[_0x460a('0x35')](_0x58bec2[_0x460a('0x30')],qs['fields'](_0x4b9ccc[_0x460a('0x31')][_0x460a('0x36')]));_0x2b7c58[_0x460a('0x34')]=_0x2b7c58[_0x460a('0x34')]['length']?_0x2b7c58['attributes']:_0x58bec2[_0x460a('0x30')];if(!_0x4b9ccc[_0x460a('0x31')][_0x460a('0x37')]('nolimit')){_0x2b7c58[_0x460a('0x38')]=qs[_0x460a('0x38')](_0x4b9ccc[_0x460a('0x31')][_0x460a('0x38')]);_0x2b7c58[_0x460a('0x1b')]=qs[_0x460a('0x1b')](_0x4b9ccc[_0x460a('0x31')]['offset']);}_0x2b7c58[_0x460a('0x39')]=qs[_0x460a('0x3a')](_0x4b9ccc['query'][_0x460a('0x3a')]);_0x2b7c58[_0x460a('0x3b')]=qs[_0x460a('0x33')](_[_0x460a('0x3c')](_0x4b9ccc['query'],_0x58bec2[_0x460a('0x33')]),_0x474a5c);if(_0x4b9ccc[_0x460a('0x31')][_0x460a('0x3d')]){_0x2b7c58[_0x460a('0x3b')]=_[_0x460a('0x3e')](_0x2b7c58[_0x460a('0x3b')],{'$or':_[_0x460a('0x2c')](_0x474a5c,function(_0x57a2c8){if(_0x57a2c8[_0x460a('0x3f')]!==_0x460a('0x40')){var _0x3ebf43={};_0x3ebf43[_0x57a2c8[_0x460a('0x2a')]]={'$like':'%'+_0x4b9ccc[_0x460a('0x31')][_0x460a('0x3d')]+'%'};return _0x3ebf43;}})});}_0x2b7c58=_[_0x460a('0x3e')]({},_0x2b7c58,_0x4b9ccc['options']);var _0x4cbd6b={'where':_0x2b7c58[_0x460a('0x3b')]};return db[_0x460a('0x2d')][_0x460a('0x1d')](_0x4cbd6b)['then'](function(_0x3ebbb5){_0x3969bf[_0x460a('0x1d')]=_0x3ebbb5;if(_0x4b9ccc[_0x460a('0x31')][_0x460a('0x41')]){_0x2b7c58[_0x460a('0x42')]=[{'all':!![]}];}return db[_0x460a('0x2d')][_0x460a('0x43')](_0x2b7c58);})[_0x460a('0x25')](function(_0x29cad5){_0x3969bf[_0x460a('0x44')]=_0x29cad5;return _0x3969bf;})[_0x460a('0x25')](respondWithFilteredResult(_0x338bd4,_0x2b7c58))[_0x460a('0x45')](handleError(_0x338bd4,null));};exports[_0x460a('0x46')]=function(_0x7470ca,_0x91e93d){var _0x58ad0b={'raw':!![],'where':{'id':_0x7470ca[_0x460a('0x47')]['id']}},_0x3023df={};_0x3023df[_0x460a('0x30')]=_[_0x460a('0x32')](db['SmsApplication']['rawAttributes']);_0x3023df[_0x460a('0x31')]=_[_0x460a('0x32')](_0x7470ca[_0x460a('0x31')]);_0x3023df[_0x460a('0x33')]=_[_0x460a('0x35')](_0x3023df[_0x460a('0x30')],_0x3023df[_0x460a('0x31')]);_0x58ad0b[_0x460a('0x34')]=_[_0x460a('0x35')](_0x3023df['model'],qs['fields'](_0x7470ca[_0x460a('0x31')][_0x460a('0x36')]));_0x58ad0b['attributes']=_0x58ad0b[_0x460a('0x34')][_0x460a('0x48')]?_0x58ad0b[_0x460a('0x34')]:_0x3023df[_0x460a('0x30')];if(_0x7470ca['query'][_0x460a('0x41')]){_0x58ad0b[_0x460a('0x42')]=[{'all':!![]}];}_0x58ad0b=_['merge']({},_0x58ad0b,_0x7470ca['options']);return db[_0x460a('0x2d')][_0x460a('0x49')](_0x58ad0b)[_0x460a('0x25')](handleEntityNotFound(_0x91e93d,null))[_0x460a('0x25')](respondWithResult(_0x91e93d,null))[_0x460a('0x45')](handleError(_0x91e93d,null));};exports['create']=function(_0x89ce82,_0x2324c8){return db[_0x460a('0x2d')][_0x460a('0x4a')](_0x89ce82['body'],{})[_0x460a('0x25')](respondWithResult(_0x2324c8,0xc9))[_0x460a('0x45')](handleError(_0x2324c8,null));};exports[_0x460a('0x24')]=function(_0x36c75a,_0x2f350a){if(_0x36c75a['body']['id']){delete _0x36c75a['body']['id'];}return db['SmsApplication'][_0x460a('0x49')]({'where':{'id':_0x36c75a[_0x460a('0x47')]['id']}})[_0x460a('0x25')](handleEntityNotFound(_0x2f350a,null))[_0x460a('0x25')](saveUpdates(_0x36c75a['body'],null))[_0x460a('0x25')](respondWithResult(_0x2f350a,null))['catch'](handleError(_0x2f350a,null));};exports[_0x460a('0x26')]=function(_0x36e8c9,_0x589370){return db[_0x460a('0x2d')][_0x460a('0x49')]({'where':{'id':_0x36e8c9[_0x460a('0x47')]['id']}})['then'](handleEntityNotFound(_0x589370,null))['then'](removeEntity(_0x589370,null))[_0x460a('0x45')](handleError(_0x589370,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 33ca88f..24aceed 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 _0x266b=['utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4'];(function(_0x4e9eac,_0x2b99a7){var _0x207d18=function(_0x40781e){while(--_0x40781e){_0x4e9eac['push'](_0x4e9eac['shift']());}};_0x207d18(++_0x2b99a7);}(_0x266b,0x12d));var _0xb266=function(_0x20c0e6,_0x5db30f){_0x20c0e6=_0x20c0e6-0x0;var _0x4504b2=_0x266b[_0x20c0e6];return _0x4504b2;};'use strict';var _=require('lodash');var util=require(_0xb266('0x0'));var logger=require('../../config/logger')(_0xb266('0x1'));var moment=require(_0xb266('0x2'));var BPromise=require('bluebird');var rp=require(_0xb266('0x3'));var fs=require('fs');var path=require(_0xb266('0x4'));var rimraf=require(_0xb266('0x5'));var config=require(_0xb266('0x6'));var attributes=require(_0xb266('0x7'));module['exports']=function(_0x2c1547,_0x5d0d63){return _0x2c1547[_0xb266('0x8')](_0xb266('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb266('0xa'),'collate':_0xb266('0xb')});}; \ No newline at end of file +var _0xa308=['../../config/environment','./smsApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xa308,0x191));var _0x8a30=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0xa308[_0x333714];return _0x4c211e;};'use strict';var _=require(_0x8a30('0x0'));var util=require('util');var logger=require(_0x8a30('0x1'))(_0x8a30('0x2'));var moment=require(_0x8a30('0x3'));var BPromise=require(_0x8a30('0x4'));var rp=require(_0x8a30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a30('0x6'));var config=require(_0x8a30('0x7'));var attributes=require(_0x8a30('0x8'));module['exports']=function(_0x40b2f6,_0x28538b){return _0x40b2f6[_0x8a30('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a30('0xa'),'collate':_0x8a30('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c3f83e1..6cc0dc0 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 _0x1867=['http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xdfa3a7,_0x581418){var _0x55c2a6=function(_0x4219ae){while(--_0x4219ae){_0xdfa3a7['push'](_0xdfa3a7['shift']());}};_0x55c2a6(++_0x581418);}(_0x1867,0xb5));var _0x7186=function(_0x24381a,_0x374f04){_0x24381a=_0x24381a-0x0;var _0x3a2caa=_0x1867[_0x24381a];return _0x3a2caa;};'use strict';var _=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var moment=require('moment');var BPromise=require(_0x7186('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7186('0x3'));var db=require(_0x7186('0x4'))['db'];var utils=require(_0x7186('0x5'));var logger=require(_0x7186('0x6'))(_0x7186('0x7'));var config=require(_0x7186('0x8'));var jayson=require(_0x7186('0x9'));var client=jayson[_0x7186('0xa')][_0x7186('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bea9f,_0x45938b,_0x18c4b9){return new BPromise(function(_0x546a90,_0x350c54){return client[_0x7186('0xc')](_0x4bea9f,_0x18c4b9)[_0x7186('0xd')](function(_0xb49c4b){logger['info'](_0x7186('0xe'),_0x45938b,_0x7186('0xf'));logger[_0x7186('0x10')](_0x7186('0x11'),_0x45938b,_0x7186('0xf'),JSON['stringify'](_0xb49c4b));if(_0xb49c4b[_0x7186('0x12')]){if(_0xb49c4b[_0x7186('0x12')][_0x7186('0x13')]===0x1f4){logger[_0x7186('0x12')]('SmsApplication,\x20%s,\x20%s',_0x45938b,_0xb49c4b[_0x7186('0x12')][_0x7186('0x14')]);return _0x350c54(_0xb49c4b[_0x7186('0x12')][_0x7186('0x14')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x45938b,_0xb49c4b['error'][_0x7186('0x14')]);return _0x546a90(_0xb49c4b[_0x7186('0x12')][_0x7186('0x14')]);}else{logger[_0x7186('0x15')]('SmsApplication,\x20%s,\x20%s',_0x45938b,_0x7186('0xf'));_0x546a90(_0xb49c4b[_0x7186('0x16')][_0x7186('0x14')]);}})[_0x7186('0x17')](function(_0x6508f5){logger[_0x7186('0x12')](_0x7186('0xe'),_0x45938b,_0x6508f5);_0x350c54(_0x6508f5);});});} \ No newline at end of file +var _0x1921=['rpc','../../config/environment','jayson/promise','client','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1921,0xf2));var _0x1192=function(_0x6e6891,_0x52c2ca){_0x6e6891=_0x6e6891-0x0;var _0x10816e=_0x1921[_0x6e6891];return _0x10816e;};'use strict';var _=require(_0x1192('0x0'));var util=require('util');var moment=require(_0x1192('0x1'));var BPromise=require(_0x1192('0x2'));var rs=require(_0x1192('0x3'));var fs=require('fs');var Redis=require(_0x1192('0x4'));var db=require(_0x1192('0x5'))['db'];var utils=require(_0x1192('0x6'));var logger=require(_0x1192('0x7'))(_0x1192('0x8'));var config=require(_0x1192('0x9'));var jayson=require(_0x1192('0xa'));var client=jayson[_0x1192('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56989b,_0x350776,_0x1df881){return new BPromise(function(_0x19ed6f,_0x2d7ae4){return client[_0x1192('0xc')](_0x56989b,_0x1df881)[_0x1192('0xd')](function(_0x1fc22e){logger[_0x1192('0xe')]('SmsApplication,\x20%s,\x20%s',_0x350776,'request\x20sent');logger[_0x1192('0xf')](_0x1192('0x10'),_0x350776,_0x1192('0x11'),JSON[_0x1192('0x12')](_0x1fc22e));if(_0x1fc22e[_0x1192('0x13')]){if(_0x1fc22e[_0x1192('0x13')][_0x1192('0x14')]===0x1f4){logger['error'](_0x1192('0x15'),_0x350776,_0x1fc22e['error'][_0x1192('0x16')]);return _0x2d7ae4(_0x1fc22e[_0x1192('0x13')]['message']);}logger[_0x1192('0x13')](_0x1192('0x15'),_0x350776,_0x1fc22e[_0x1192('0x13')]['message']);return _0x19ed6f(_0x1fc22e[_0x1192('0x13')][_0x1192('0x16')]);}else{logger['info'](_0x1192('0x15'),_0x350776,_0x1192('0x11'));_0x19ed6f(_0x1fc22e[_0x1192('0x17')]['message']);}})[_0x1192('0x18')](function(_0x5ed569){logger[_0x1192('0x13')](_0x1192('0x15'),_0x350776,_0x5ed569);_0x2d7ae4(_0x5ed569);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5c6e9dc..dc3fdf0 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 _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x21a9d1,_0x21d35b){var _0x12cd7f=function(_0x56d542){while(--_0x56d542){_0x21a9d1['push'](_0x21a9d1['shift']());}};_0x12cd7f(++_0x21d35b);}(_0x087b,0x11a));var _0xb087=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x087b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router; \ No newline at end of file +var _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x4ca3ee,_0x20619c){_0x4ca3ee=_0x4ca3ee-0x0;var _0xb519cd=_0x757a[_0x4ca3ee];return _0xb519cd;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 3eaca70..9c290d2 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 _0xe314=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x2552a8,_0x120036){var _0x2b42b6=function(_0x4757af){while(--_0x4757af){_0x2552a8['push'](_0x2552a8['shift']());}};_0x2b42b6(++_0x120036);}(_0xe314,0x7c));var _0x4e31=function(_0x144ba6,_0x195e93){_0x144ba6=_0x144ba6-0x0;var _0x4e68e1=_0xe314[_0x144ba6];return _0x4e68e1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4e31('0x0'));module[_0x4e31('0x1')]={'closed':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4e31('0x3')]},'disposition':{'type':Sequelize[_0x4e31('0x4')]},'secondDisposition':{'type':Sequelize[_0x4e31('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4e31('0x4')]},'note':{'type':Sequelize[_0x4e31('0x4')]},'phone':{'type':Sequelize[_0x4e31('0x4')]},'read1stAt':{'type':Sequelize[_0x4e31('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4e31('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4e31('0x5')]('in',_0x4e31('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ca4=['STRING','DATE','ENUM','out','BOOLEAN','sequelize','moment','exports'];(function(_0x1c6b61,_0x5d0fe0){var _0xb6c7e2=function(_0xda019f){while(--_0xda019f){_0x1c6b61['push'](_0x1c6b61['shift']());}};_0xb6c7e2(++_0x5d0fe0);}(_0x3ca4,0x17d));var _0x43ca=function(_0x58555c,_0xb442be){_0x58555c=_0x58555c-0x0;var _0x3b5af9=_0x3ca4[_0x58555c];return _0x3b5af9;};'use strict';var Sequelize=require(_0x43ca('0x0'));var moment=require(_0x43ca('0x1'));module[_0x43ca('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x43ca('0x3')]},'secondDisposition':{'type':Sequelize[_0x43ca('0x3')]},'thirdDisposition':{'type':Sequelize[_0x43ca('0x3')]},'note':{'type':Sequelize[_0x43ca('0x3')]},'phone':{'type':Sequelize[_0x43ca('0x3')]},'read1stAt':{'type':Sequelize[_0x43ca('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x43ca('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x43ca('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x43ca('0x5')]('in',_0x43ca('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x43ca('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6116d72..a10e165 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 _0xa3c5=['sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','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','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?','body','buildExpression','some','compact','isEmpty','SmsAccountId','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','clone','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','role','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','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','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','catch','show','params','fields','includeAll','include','options','create','update','describe','addMessage','SmsMessage','ids','findOne','format','addTags','spread','emit','removeTags','download','unix','join','server','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','Sms','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsInteraction.socket','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','sendStatus','error','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','then','waiting','talking','answered','unmanaged','total','UserId','closed','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','ui.SmsInteractionId','user_has_sms_interactions','users','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3c5,0x87));var _0x5a3c=function(_0x313151,_0x1cc349){_0x313151=_0x313151-0x0;var _0x26ee0a=_0xa3c5[_0x313151];return _0x26ee0a;};'use strict';var emlformat=require(_0x5a3c('0x0'));var rimraf=require(_0x5a3c('0x1'));var zipdir=require(_0x5a3c('0x2'));var jsonpatch=require(_0x5a3c('0x3'));var rp=require('request-promise');var moment=require(_0x5a3c('0x4'));var BPromise=require(_0x5a3c('0x5'));var Mustache=require(_0x5a3c('0x6'));var util=require(_0x5a3c('0x7'));var path=require('path');var sox=require(_0x5a3c('0x8'));var csv=require(_0x5a3c('0x9'));var ejs=require(_0x5a3c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a3c('0xb'));var squel=require(_0x5a3c('0xc'));var crypto=require(_0x5a3c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a3c('0x9'));var querystring=require(_0x5a3c('0xe'));var Papa=require(_0x5a3c('0xf'));var Redis=require(_0x5a3c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5a3c('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x5a3c('0x12'));var logger=require(_0x5a3c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5a3c('0x14'));var licenseUtil=require(_0x5a3c('0x15'));var db=require('../../mysqldb')['db'];config[_0x5a3c('0x16')]=_['defaults'](config['redis'],{'host':_0x5a3c('0x17'),'port':0x18eb});var socket=require(_0x5a3c('0x18'))(new Redis(config[_0x5a3c('0x16')]));require(_0x5a3c('0x19'))['register'](socket);function respondWithStatusCode(_0x2e451f,_0x2db818){_0x2db818=_0x2db818||0xcc;return function(_0x2f0d19){if(_0x2f0d19){return _0x2e451f['sendStatus'](_0x2db818);}return _0x2e451f[_0x5a3c('0x1a')](_0x2db818)[_0x5a3c('0x1b')]();};}function respondWithResult(_0xf1696e,_0x14cc93){_0x14cc93=_0x14cc93||0xc8;return function(_0x4a3cf8){if(_0x4a3cf8){return _0xf1696e[_0x5a3c('0x1a')](_0x14cc93)[_0x5a3c('0x1c')](_0x4a3cf8);}};}function respondWithFilteredResult(_0x35fffa,_0x4cff1e){return function(_0x605fa3){if(_0x605fa3){var _0x4e2c3e=typeof _0x4cff1e[_0x5a3c('0x1d')]===_0x5a3c('0x1e')&&typeof _0x4cff1e[_0x5a3c('0x1f')]==='undefined';var _0x3a92ce=_0x605fa3[_0x5a3c('0x20')];var _0xa6bff4=_0x4e2c3e?0x0:_0x4cff1e[_0x5a3c('0x1d')];var _0x54a873=_0x4e2c3e?_0x605fa3[_0x5a3c('0x20')]:_0x4cff1e[_0x5a3c('0x1d')]+_0x4cff1e[_0x5a3c('0x1f')];var _0xb7ea4d;if(_0x54a873>=_0x3a92ce){_0x54a873=_0x3a92ce;_0xb7ea4d=0xc8;}else{_0xb7ea4d=0xce;}_0x35fffa[_0x5a3c('0x1a')](_0xb7ea4d);return _0x35fffa[_0x5a3c('0x21')]('Content-Range',_0xa6bff4+'-'+_0x54a873+'/'+_0x3a92ce)[_0x5a3c('0x1c')](_0x605fa3);}return null;};}function patchUpdates(_0x6bc5d1){return function(_0x213864){try{jsonpatch[_0x5a3c('0x22')](_0x213864,_0x6bc5d1,!![]);}catch(_0x33991e){return BPromise['reject'](_0x33991e);}return _0x213864[_0x5a3c('0x23')]();};}function saveUpdates(_0x7ff72f,_0x65f49f){return function(_0x32f39b){if(_0x32f39b){return _0x32f39b['update'](_0x7ff72f)['then'](function(_0x96172c){return _0x96172c;});}return null;};}function removeEntity(_0xe0b27d,_0x96007b){return function(_0x55b57a){if(_0x55b57a){return _0x55b57a[_0x5a3c('0x24')]()['then'](function(){_0xe0b27d[_0x5a3c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf392,_0x7fa1b4){return function(_0x3366c7){if(!_0x3366c7){_0x5bf392[_0x5a3c('0x25')](0x194);}return _0x3366c7;};}function handleError(_0x3105d3,_0x95ed25){_0x95ed25=_0x95ed25||0x1f4;return function(_0x154b2c){logger[_0x5a3c('0x26')](_0x154b2c[_0x5a3c('0x27')]);if(_0x154b2c[_0x5a3c('0x28')]){delete _0x154b2c[_0x5a3c('0x28')];}_0x3105d3[_0x5a3c('0x1a')](_0x95ed25)[_0x5a3c('0x29')](_0x154b2c);};}function getInteractionUsers(_0x546fa6,_0x4c8108){return new BPromise(function(_0x35fef2,_0x107136){try{if(_0x4c8108[_0x546fa6['id']]){_0x546fa6['Users']=_[_0x5a3c('0x2a')](_0x4c8108[_0x546fa6['id']],function(_0x5584b7){return{'id':_0x5584b7['id'],'fullname':_0x5584b7[_0x5a3c('0x2b')]};});}}catch(_0x21fac5){_0x107136(_0x21fac5);}_0x35fef2(_0x546fa6);});}function getInteractionTags(_0x4b29d2,_0x5e3052){return new BPromise(function(_0x50a32e,_0x4d3a09){try{if(_0x4b29d2['TagIds']){_0x4b29d2['Tags']=[];_0x4b29d2[_0x5a3c('0x2c')][_0x5a3c('0x2d')](',')[_0x5a3c('0x2e')](function(_0x38434f){_0x4b29d2[_0x5a3c('0x2f')][_0x5a3c('0x30')](_0x5e3052[_0x38434f]);});}delete _0x4b29d2[_0x5a3c('0x2c')];}catch(_0x4f9684){_0x4d3a09(_0x4f9684);}_0x50a32e(_0x4b29d2);});}function updateSmsInteraction(_0x5b012b,_0x11d76a,_0xa804a1){return new BPromise(function(_0x532ce6,_0x5f5080){return getInteractionUsers(_0x5b012b,_0xa804a1)[_0x5a3c('0x31')](function(_0x3cdb22){return getInteractionTags(_0x3cdb22,_0x11d76a);})[_0x5a3c('0x31')](function(_0x56979b){return getStateInteraction(_0x56979b);})[_0x5a3c('0x31')](function(_0xd76fc9){_0x532ce6(_0xd76fc9);})['catch'](function(_0x5e6c2e){_0x5f5080(_0x5e6c2e);});});}function getStateInteraction(_0x4ed16e){return new BPromise(function(_0x2b304e){_0x4ed16e[_0x5a3c('0x32')]=0x0;_0x4ed16e[_0x5a3c('0x33')]=0x0;_0x4ed16e[_0x5a3c('0x34')]=0x0;_0x4ed16e[_0x5a3c('0x35')]=0x0;_0x4ed16e[_0x5a3c('0x36')]=0x0;if(!_0x4ed16e['closed']&&!_0x4ed16e[_0x5a3c('0x37')]){_0x4ed16e[_0x5a3c('0x32')]+=0x1;}if(!_0x4ed16e[_0x5a3c('0x38')]&&_0x4ed16e[_0x5a3c('0x37')]){_0x4ed16e['talking']+=0x1;if(_0x4ed16e['waiting']){_0x4ed16e['waiting']-=0x1;}}if(_0x4ed16e[_0x5a3c('0x38')]&&_0x4ed16e[_0x5a3c('0x37')]){_0x4ed16e[_0x5a3c('0x34')]+=0x1;if(_0x4ed16e[_0x5a3c('0x33')]){_0x4ed16e[_0x5a3c('0x33')]-=0x1;}}if(_0x4ed16e[_0x5a3c('0x38')]&&!_0x4ed16e[_0x5a3c('0x37')]){_0x4ed16e[_0x5a3c('0x35')]+=0x1;if(_0x4ed16e[_0x5a3c('0x32')]){_0x4ed16e[_0x5a3c('0x32')]-=0x1;}}_0x4ed16e[_0x5a3c('0x36')]+=0x1;_0x2b304e(_0x4ed16e);});}exports[_0x5a3c('0x39')]=function(_0x504fda,_0x3a3de0){var _0x39643a={},_0x1c1d6e={},_0x3de677={'count':0x0,'rows':[]};var _0x435b8=_[_0x5a3c('0x2a')](db[_0x5a3c('0x3a')][_0x5a3c('0x3b')],function(_0x5aae8c){return{'name':_0x5aae8c[_0x5a3c('0x3c')],'type':_0x5aae8c[_0x5a3c('0x3d')][_0x5a3c('0x3e')]};});_0x1c1d6e[_0x5a3c('0x3f')]=_[_0x5a3c('0x2a')](_0x435b8,_0x5a3c('0x28'));_0x1c1d6e[_0x5a3c('0x40')]=_[_0x5a3c('0x41')](_0x504fda[_0x5a3c('0x40')]);_0x1c1d6e[_0x5a3c('0x42')]=_[_0x5a3c('0x43')](_0x1c1d6e[_0x5a3c('0x3f')],_0x1c1d6e[_0x5a3c('0x40')]);_0x39643a['attributes']=_['intersection'](_0x1c1d6e[_0x5a3c('0x3f')],qs['fields'](_0x504fda[_0x5a3c('0x40')]['fields']));_0x39643a[_0x5a3c('0x44')]=_0x39643a['attributes'][_0x5a3c('0x45')]?_0x39643a[_0x5a3c('0x44')]:_0x1c1d6e[_0x5a3c('0x3f')];if(!_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x46')](_0x5a3c('0x47'))){_0x39643a['limit']=qs[_0x5a3c('0x1f')](_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x1f')]);_0x39643a[_0x5a3c('0x1d')]=qs[_0x5a3c('0x1d')](_0x504fda['query'][_0x5a3c('0x1d')]);}_0x39643a[_0x5a3c('0x48')]=qs['sort'](_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x49')]);_0x39643a[_0x5a3c('0x4a')]=qs[_0x5a3c('0x42')](_[_0x5a3c('0x4b')](_0x504fda[_0x5a3c('0x40')],_0x1c1d6e[_0x5a3c('0x42')]),_0x435b8);var _0x4a1a0c=[];var _0x479901=squel[_0x5a3c('0x4c')]()[_0x5a3c('0x4d')]('id')[_0x5a3c('0x4d')]('name')[_0x5a3c('0x4d')](_0x5a3c('0x4e'))[_0x5a3c('0x4f')]('tools_tags');var _0x3a0bac=squel[_0x5a3c('0x4c')]()['field'](_0x5a3c('0x50'))[_0x5a3c('0x4d')]('u.fullname')[_0x5a3c('0x4d')](_0x5a3c('0x51'))[_0x5a3c('0x4f')](_0x5a3c('0x52'),'ui')['left_join'](_0x5a3c('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x515769=squel[_0x5a3c('0x4c')]()[_0x5a3c('0x4f')](_0x5a3c('0x54'),'i')[_0x5a3c('0x55')](_0x5a3c('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5a3c('0x55')](_0x5a3c('0x53'),'o',_0x5a3c('0x57'))[_0x5a3c('0x55')]('sms_accounts','a',_0x5a3c('0x58'))['left_join'](_0x5a3c('0x59'),'me',_0x5a3c('0x5a'))[_0x5a3c('0x55')]('sms_interaction_has_tags','it',_0x5a3c('0x5b'))[_0x5a3c('0x55')](_0x5a3c('0x5c'),'t',_0x5a3c('0x5d'));var _0x4c8cde=squel['expr']();var _0x30ab77=[];var _0x312b37=squel[_0x5a3c('0x5e')]();var _0x55c37f;if(_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x5f')]){_0x55c37f=as['parseSearch'](_0x504fda['query'][_0x5a3c('0x5f')]);var _0x206ef6=_0x55c37f[_0x5a3c('0x60')];for(var _0x235d1b=0x0;_0x235d1b<_0x55c37f[_0x5a3c('0x61')][_0x5a3c('0x45')];_0x235d1b++){var _0x40d868=_0x55c37f[_0x5a3c('0x61')][_0x235d1b];var _0x322212='i';var _0x4f9817=_[_0x5a3c('0x62')](_0x435b8,[_0x5a3c('0x28'),_0x40d868[_0x5a3c('0x4d')]]);if(!_0x4f9817){switch(_0x40d868['field']){case'unreadMessages':if(_0x40d868[_0x5a3c('0x63')]==0x1){_0x515769[_0x5a3c('0x64')]('`'+_0x40d868[_0x5a3c('0x4d')]+_0x5a3c('0x65'));}else{_0x515769[_0x5a3c('0x64')]('`'+_0x40d868[_0x5a3c('0x4d')]+'`\x20>\x200');}break;case _0x5a3c('0x66'):if(_0x40d868[_0x5a3c('0x67')]===_0x5a3c('0x68')){if(_0x40d868[_0x5a3c('0x63')][_0x5a3c('0x2d')]('\x20')['length']>0x1){_0x4c8cde[_0x206ef6](_0x5a3c('0x69'),qs[_0x5a3c('0x6a')](_0x40d868[_0x5a3c('0x63')]),null);}else{var _0x47d62c='%'+_0x40d868[_0x5a3c('0x63')]+'%';_0x4c8cde[_0x206ef6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x47d62c,_0x47d62c,_0x47d62c);}}else{_0x4f9817=_[_0x5a3c('0x62')](_0x435b8,[_0x5a3c('0x28'),_0x5a3c('0x6b')]);_0x40d868['field']=_0x5a3c('0x6b');_0x3a0b73=as['buildExpression'](_0x322212,_0x4f9817[_0x5a3c('0x3d')],_0x40d868);_0x4c8cde[_0x206ef6](_0x3a0b73[_0x5a3c('0x6c')],_0x3a0b73[_0x5a3c('0x63')][_0x5a3c('0x6d')],_0x3a0b73[_0x5a3c('0x63')][_0x5a3c('0x1b')]);}break;case _0x5a3c('0x6e'):var _0x4a9117=_0x40d868[_0x5a3c('0x63')][_0x5a3c('0x2d')](',')['map'](function(_0x544d37){return Number(_0x544d37);});_0x4a9117[_0x5a3c('0x2e')](function(_0x33647c){_0x312b37['or'](_0x5a3c('0x6f'),'%,'+_0x33647c+',%');});_0x30ab77=_[_0x5a3c('0x70')](_0x30ab77,_0x4a9117);break;case'User':if(_0x40d868['operator']===_0x5a3c('0x68')){_0x4c8cde[_0x206ef6](_0x5a3c('0x71'),'%'+_0x40d868[_0x5a3c('0x63')]+'%',null);}else{_0x4f9817=_[_0x5a3c('0x62')](_0x435b8,[_0x5a3c('0x28'),_0x5a3c('0x37')]);_0x40d868[_0x5a3c('0x4d')]='UserId';_0x3a0b73=as['buildExpression'](_0x322212,_0x4f9817[_0x5a3c('0x3d')],_0x40d868);_0x4c8cde[_0x206ef6](_0x3a0b73[_0x5a3c('0x6c')],_0x3a0b73['value']['start'],_0x3a0b73[_0x5a3c('0x63')]['end']);}break;case _0x5a3c('0x72'):_0x3a0b73=as[_0x5a3c('0x73')]('me',null,_0x40d868);_0x4c8cde[_0x206ef6](_0x3a0b73[_0x5a3c('0x6c')],_0x3a0b73['value']['start'],_0x3a0b73['value']['end']);break;}}else{var _0x3a0b73=as['buildExpression'](_0x322212,_0x4f9817['type'],_0x40d868);_0x4c8cde[_0x206ef6](_0x3a0b73[_0x5a3c('0x6c')],_0x3a0b73[_0x5a3c('0x63')][_0x5a3c('0x6d')],_0x3a0b73['value'][_0x5a3c('0x1b')]);}}}else{var _0x47c9af=_(_0x504fda['query'])[_0x5a3c('0x41')]()[_0x5a3c('0x2a')](function(_0x39a0ab){return _[_0x5a3c('0x74')](_0x435b8,[_0x5a3c('0x28'),_0x39a0ab])?_0x39a0ab:undefined;})[_0x5a3c('0x75')]()[_0x5a3c('0x63')]();if(!_[_0x5a3c('0x76')](_0x47c9af)){_0x47c9af[_0x5a3c('0x2e')](function(_0x1b79e1){if(_0x1b79e1===_0x5a3c('0x77')){_0x515769[_0x5a3c('0x4a')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x504fda['query'][_0x1b79e1]));}else if(_0x1b79e1===_0x5a3c('0x78')){var _0x11edeb=JSON[_0x5a3c('0x79')](_0x504fda['query'][_0x1b79e1])[_0x5a3c('0x7a')];var _0x41b7cc=JSON[_0x5a3c('0x79')](_0x504fda[_0x5a3c('0x40')][_0x1b79e1])['$lte'];_0x515769['where'](_0x5a3c('0x7b'),_0x11edeb,_0x41b7cc);}else{if(_0x504fda[_0x5a3c('0x40')][_0x1b79e1]===_0x5a3c('0x7c')){_0x515769[_0x5a3c('0x4a')]('i.'+_0x1b79e1+_0x5a3c('0x7d'));}else{_0x515769['where']('i.'+_0x1b79e1+_0x5a3c('0x7e'),_0x504fda[_0x5a3c('0x40')][_0x1b79e1]);}}});}if(_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x7f')]){if(_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x7f')]==0x1){_0x515769[_0x5a3c('0x64')](_0x5a3c('0x80'));}else{_0x515769['having']('`unreadMessages`\x20>\x200');}}if(_0x504fda[_0x5a3c('0x40')]['tag']){_0x30ab77=_[_0x5a3c('0x81')](_0x504fda['query']['tag'])?_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x82')]:new Array(_0x504fda[_0x5a3c('0x40')][_0x5a3c('0x82')]);_0x30ab77[_0x5a3c('0x2e')](function(_0x4a3227){_0x312b37['or'](_0x5a3c('0x6f'),'%,'+_0x4a3227+',%');});}if(_0x504fda['query'][_0x5a3c('0x83')]){var _0x1b0933=_0x504fda['query'][_0x5a3c('0x83')]['replace']('\x5c','\x5c\x5c')[_0x5a3c('0x84')](/'/g,'\x27\x27');if(qs[_0x5a3c('0x85')](_0x1b0933)){_0x4c8cde['or']('i.id\x20LIKE\x20?',_0x1b0933+'%')['or'](_0x5a3c('0x86'),_0x1b0933+'%');}else{_0x4c8cde['or'](_0x5a3c('0x87'),qs['getFullTextValue'](_0x1b0933))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1b0933+'%');}}}_0x515769['where'](_0x4c8cde);_0x515769['group']('i.id');var _0x9c2410={'type':db[_0x5a3c('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x538ef8=_0x515769[_0x5a3c('0x89')]();_0x538ef8[_0x5a3c('0x4d')]('i.id');_0x538ef8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x39643a[_0x5a3c('0x48')]){_0x39643a[_0x5a3c('0x48')][_0x5a3c('0x2e')](function(_0x94054f){var _0x5b1484=_0x94054f[0x0]===_0x5a3c('0x8a')?_0x94054f[0x0]:'i.'+_0x94054f[0x0];_0x515769['order'](_0x5b1484,_0x94054f[0x1]===_0x5a3c('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x30ab77)){_0x515769[_0x5a3c('0x64')](_0x312b37);_0x538ef8[_0x5a3c('0x4a')]('t.id\x20IN\x20?',_0x30ab77);}BPromise[_0x5a3c('0x8c')]()[_0x5a3c('0x31')](function(){if(!_0x55c37f){if(_0x504fda['query']['SmsAccountId'])return;_0x538ef8[_0x5a3c('0x4a')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x515769['where'](_0x5a3c('0x8d'));return;}if(_0x504fda['user']['role']!==_0x5a3c('0x8e'))return;return _0x504fda['user'][_0x5a3c('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x266494){if(_[_0x5a3c('0x76')](_0x266494)){_0x538ef8[_0x5a3c('0x4a')](_0x5a3c('0x90'));_0x515769[_0x5a3c('0x4a')](_0x5a3c('0x90'));}else{_0x538ef8[_0x5a3c('0x4a')](_0x5a3c('0x91'),_[_0x5a3c('0x2a')](_0x266494,'id'));_0x515769['where']('i.SmsAccountId\x20IN\x20?',_[_0x5a3c('0x2a')](_0x266494,'id'));}});})[_0x5a3c('0x31')](function(){if(_0x504fda['user'][_0x5a3c('0x92')]===_0x5a3c('0x8e')&&!_0x55c37f&&!_0x504fda['query'][_0x5a3c('0x77')])return[];return db[_0x5a3c('0x93')][_0x5a3c('0x40')](_0x538ef8[_0x5a3c('0x94')](),_0x9c2410);})[_0x5a3c('0x31')](function(_0x544577){_0x3de677[_0x5a3c('0x20')]=_0x544577['length'];if(_0x3de677[_0x5a3c('0x20')]===0x0)return[];return db['sequelize']['query'](_0x479901[_0x5a3c('0x94')](),_0x9c2410)[_0x5a3c('0x31')](function(_0x3daf13){_0x4a1a0c=_['keyBy'](_0x3daf13,'id');_0x9c2410=_[_0x5a3c('0x95')](_0x9c2410,{'model':db[_0x5a3c('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x504fda[_0x5a3c('0x40')]['fields']){_0x39643a['attributes'][_0x5a3c('0x2e')](function(_0x3c492b){_0x515769[_0x5a3c('0x4d')]('i.'+_0x3c492b);});}else{_0x515769['field'](_0x5a3c('0x96'),_0x5a3c('0x97'));_0x515769['field']('a.key',_0x5a3c('0x98'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0x99'),_0x5a3c('0x9a'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0x9b'),'contactName');_0x515769[_0x5a3c('0x4d')]('i.*');_0x515769[_0x5a3c('0x4d')](_0x5a3c('0x9c'),'Contact.firstName');_0x515769[_0x5a3c('0x4d')](_0x5a3c('0x9d'),_0x5a3c('0x9e'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0x9f'),'Contact.email');_0x515769[_0x5a3c('0x4d')](_0x5a3c('0xa0'),_0x5a3c('0xa1'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0xa2'),_0x5a3c('0xa3'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0xa4'),_0x5a3c('0xa5'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0xa6'),_0x5a3c('0xa7'));_0x515769[_0x5a3c('0x4d')]('o.internal',_0x5a3c('0xa8'));_0x515769[_0x5a3c('0x4d')](_0x5a3c('0xa9'),_0x5a3c('0x2c'));}if(_0x39643a[_0x5a3c('0x1f')])_0x515769[_0x5a3c('0x1f')](_0x39643a['limit']);if(_0x39643a['offset'])_0x515769['offset'](_0x39643a['offset']);return db[_0x5a3c('0x93')][_0x5a3c('0x40')](_0x515769[_0x5a3c('0x94')](),_0x9c2410);})[_0x5a3c('0x31')](function(_0x16684e){if(_0x16684e[_0x5a3c('0x45')]>0x0)_0x3a0bac[_0x5a3c('0x4a')](_0x5a3c('0xaa'),_[_0x5a3c('0x2a')](_0x16684e,'id'));return db[_0x5a3c('0x93')][_0x5a3c('0x40')](_0x3a0bac[_0x5a3c('0x94')](),_0x9c2410)[_0x5a3c('0x31')](function(_0x24e9e2){var _0x514f77=_[_0x5a3c('0xab')](_0x24e9e2,_0x5a3c('0xac'));var _0x78c534=[];_0x16684e['forEach'](function(_0x3a0500){_0x78c534[_0x5a3c('0x30')](updateSmsInteraction(_0x3a0500,_0x4a1a0c,_0x514f77));});return BPromise[_0x5a3c('0xad')](_0x78c534);});});})[_0x5a3c('0x31')](function(_0x408399){_0x3de677['rows']=_0x408399;return _0x3de677;})[_0x5a3c('0x31')](respondWithFilteredResult(_0x3a3de0,_0x39643a))[_0x5a3c('0xae')](handleError(_0x3a3de0,null));};exports[_0x5a3c('0xaf')]=function(_0x49a760,_0x18aca3){var _0xb91fc9={'raw':![],'where':{'id':_0x49a760[_0x5a3c('0xb0')]['id']}},_0x513d39={};_0x513d39[_0x5a3c('0x3f')]=_['keys'](db['SmsInteraction'][_0x5a3c('0x3b')]);_0x513d39[_0x5a3c('0x40')]=_[_0x5a3c('0x41')](_0x49a760[_0x5a3c('0x40')]);_0x513d39['filters']=_[_0x5a3c('0x43')](_0x513d39['model'],_0x513d39['query']);_0xb91fc9[_0x5a3c('0x44')]=_[_0x5a3c('0x43')](_0x513d39[_0x5a3c('0x3f')],qs[_0x5a3c('0xb1')](_0x49a760[_0x5a3c('0x40')][_0x5a3c('0xb1')]));_0xb91fc9[_0x5a3c('0x44')]=_0xb91fc9[_0x5a3c('0x44')]['length']?_0xb91fc9['attributes']:_0x513d39[_0x5a3c('0x3f')];if(_0x49a760['query'][_0x5a3c('0xb2')]){_0xb91fc9[_0x5a3c('0xb3')]=[{'all':!![]}];}_0xb91fc9=_[_0x5a3c('0x95')]({},_0xb91fc9,_0x49a760[_0x5a3c('0xb4')]);return db[_0x5a3c('0x3a')][_0x5a3c('0x62')](_0xb91fc9)[_0x5a3c('0x31')](handleEntityNotFound(_0x18aca3,null))[_0x5a3c('0x31')](respondWithResult(_0x18aca3,null))[_0x5a3c('0xae')](handleError(_0x18aca3,null));};exports[_0x5a3c('0xb5')]=function(_0x28b81a,_0x1d1809){return db[_0x5a3c('0x3a')]['create'](_0x28b81a[_0x5a3c('0x72')],{})['then'](respondWithResult(_0x1d1809,0xc9))[_0x5a3c('0xae')](handleError(_0x1d1809,null));};exports[_0x5a3c('0xb6')]=function(_0x3608ab,_0x13deb1){if(_0x3608ab[_0x5a3c('0x72')]['id']){delete _0x3608ab['body']['id'];}return db[_0x5a3c('0x3a')][_0x5a3c('0x62')]({'where':{'id':_0x3608ab[_0x5a3c('0xb0')]['id']}})[_0x5a3c('0x31')](handleEntityNotFound(_0x13deb1,null))['then'](saveUpdates(_0x3608ab['body'],null))[_0x5a3c('0x31')](respondWithResult(_0x13deb1,null))[_0x5a3c('0xae')](handleError(_0x13deb1,null));};exports[_0x5a3c('0x24')]=function(_0xb7e581,_0x46a18c){return db[_0x5a3c('0x3a')]['find']({'where':{'id':_0xb7e581[_0x5a3c('0xb0')]['id']}})[_0x5a3c('0x31')](handleEntityNotFound(_0x46a18c,null))[_0x5a3c('0x31')](removeEntity(_0x46a18c,null))[_0x5a3c('0xae')](handleError(_0x46a18c,null));};exports[_0x5a3c('0xb7')]=function(_0x21b3dd,_0x1e4678){return db['SmsInteraction'][_0x5a3c('0xb7')]()['then'](respondWithResult(_0x1e4678,null))[_0x5a3c('0xae')](handleError(_0x1e4678,null));};exports[_0x5a3c('0xb8')]=function(_0x1ea81b,_0xcce0b7,_0x21a20e){return db[_0x5a3c('0xb9')]['find']({'where':{'id':_0x1ea81b['params']['id']}})[_0x5a3c('0x31')](handleEntityNotFound(_0xcce0b7,null))[_0x5a3c('0x31')](function(_0x4b7a14){if(_0x4b7a14){return _0x4b7a14[_0x5a3c('0xb8')](_0x1ea81b[_0x5a3c('0x72')][_0x5a3c('0xba')],_['omit'](_0x1ea81b['body'],['ids','id'])||{});}})[_0x5a3c('0x31')](respondWithResult(_0xcce0b7,null))['catch'](handleError(_0xcce0b7,null));};exports['getMessages']=function(_0x5d717c,_0x422a41,_0x1e14cf){var _0x2748f7={'raw':![],'where':{}};var _0x2257cb={};var _0x3c5e93={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x5a3c('0xbb')]({'where':{'id':_0x5d717c[_0x5a3c('0xb0')]['id']}})[_0x5a3c('0x31')](handleEntityNotFound(_0x422a41,null))[_0x5a3c('0x31')](function(_0x803725){if(_0x803725){_0x2257cb['model']=_['keys'](db['SmsMessage'][_0x5a3c('0x3b')]);_0x2257cb[_0x5a3c('0x40')]=_['keys'](_0x5d717c[_0x5a3c('0x40')]);_0x2257cb['filters']=_['intersection'](_0x2257cb['model'],_0x2257cb[_0x5a3c('0x40')]);_0x2748f7[_0x5a3c('0x44')]=_[_0x5a3c('0x43')](_0x2257cb[_0x5a3c('0x3f')],qs[_0x5a3c('0xb1')](_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0xb1')]));_0x2748f7['attributes']=_0x2748f7[_0x5a3c('0x44')][_0x5a3c('0x45')]?_0x2748f7['attributes']:_0x2257cb[_0x5a3c('0x3f')];if(!_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x46')](_0x5a3c('0x47'))){_0x2748f7[_0x5a3c('0x1f')]=qs[_0x5a3c('0x1f')](_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x1f')]);_0x2748f7['offset']=qs[_0x5a3c('0x1d')](_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x1d')]);}_0x2748f7[_0x5a3c('0x48')]=qs[_0x5a3c('0x49')](_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x49')]);_0x2748f7[_0x5a3c('0x4a')]=qs[_0x5a3c('0x42')](_['pick'](_0x5d717c[_0x5a3c('0x40')],_0x2257cb[_0x5a3c('0x42')]));_0x2748f7[_0x5a3c('0x4a')]['SmsInteractionId']=_0x803725['id'];if(_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x83')]){_0x2748f7[_0x5a3c('0x4a')]=_[_0x5a3c('0x95')](_0x2748f7['where'],{'$or':_[_0x5a3c('0x2a')](_0x2748f7[_0x5a3c('0x44')],function(_0x57bcb3){var _0x42fc9b={};_0x42fc9b[_0x57bcb3]={'$like':'%'+_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x83')]+'%'};return _0x42fc9b;})});}if(_0x5d717c[_0x5a3c('0x40')]['$gte']){var _0x29d250=_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0x7a')]['split'](',');var _0xc31dbb={};_0xc31dbb[_0x29d250[0x0]]={'$gte':moment(_0x29d250[0x1])[_0x5a3c('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2748f7[_0x5a3c('0x4a')]=_[_0x5a3c('0x95')](_0x2748f7[_0x5a3c('0x4a')],_0xc31dbb);}_0x2748f7=_[_0x5a3c('0x95')]({},_0x2748f7,_0x5d717c[_0x5a3c('0xb4')]);return db[_0x5a3c('0xb9')][_0x5a3c('0x20')]({'where':_0x2748f7[_0x5a3c('0x4a')]})['then'](function(_0x429800){_0x3c5e93[_0x5a3c('0x20')]=_0x429800;if(_0x5d717c[_0x5a3c('0x40')][_0x5a3c('0xb2')]){_0x2748f7[_0x5a3c('0xb3')]=[{'all':!![]}];}return db[_0x5a3c('0xb9')]['findAll'](_0x2748f7);})['then'](function(_0x9e53a0){_0x3c5e93['rows']=_0x9e53a0;return _0x3c5e93;});}})[_0x5a3c('0x31')](respondWithFilteredResult(_0x422a41,_0x2748f7))['catch'](handleError(_0x422a41,null));};exports[_0x5a3c('0xbd')]=function(_0x4409f1,_0x174726,_0x432756){return db['SmsInteraction'][_0x5a3c('0x62')]({'where':{'id':_0x4409f1['params']['id']}})[_0x5a3c('0x31')](handleEntityNotFound(_0x174726,null))[_0x5a3c('0x31')](function(_0x13a020){if(_0x13a020){return _0x13a020['setTags'](_0x4409f1[_0x5a3c('0x72')][_0x5a3c('0xba')],_['omit'](_0x4409f1[_0x5a3c('0x72')],[_0x5a3c('0xba'),'id'])||{})[_0x5a3c('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x5a3c('0x4e')],'where':{'id':_0x4409f1[_0x5a3c('0x72')][_0x5a3c('0xba')]}});})[_0x5a3c('0x31')](function(_0x308b9d){socket[_0x5a3c('0xbf')]('smsInteractionTags:save',{'id':Number(_0x4409f1[_0x5a3c('0xb0')]['id']),'tags':_0x308b9d||[]});return{'id':Number(_0x4409f1[_0x5a3c('0xb0')]['id']),'tags':_0x308b9d||[]};});}})[_0x5a3c('0x31')](respondWithResult(_0x174726,null))[_0x5a3c('0xae')](handleError(_0x174726,null));};exports[_0x5a3c('0xc0')]=function(_0x31e42c,_0x11ae5f,_0x19e978){return db[_0x5a3c('0x3a')][_0x5a3c('0x62')]({'where':{'id':_0x31e42c[_0x5a3c('0xb0')]['id']}})[_0x5a3c('0x31')](handleEntityNotFound(_0x11ae5f,null))[_0x5a3c('0x31')](function(_0x7eecd4){if(_0x7eecd4){return _0x7eecd4['removeTags'](_0x31e42c[_0x5a3c('0x40')][_0x5a3c('0xba')]);}})[_0x5a3c('0x31')](respondWithStatusCode(_0x11ae5f,null))['catch'](handleError(_0x11ae5f,null));};exports[_0x5a3c('0xc1')]=function(_0x29319b,_0x59cde6){var _0x2be76c=moment()[_0x5a3c('0xc2')]()['toString']();var _0x299f18=path[_0x5a3c('0xc3')](config['root'],_0x5a3c('0xc4'),'files',_0x5a3c('0xc5'));var _0xfe68f9=path[_0x5a3c('0xc3')](config['root'],_0x5a3c('0xc4'),'files',_0x5a3c('0xc6'));var _0x5c6d81=path[_0x5a3c('0xc3')](_0x299f18,_0x2be76c);var _0x9928c0=util[_0x5a3c('0xbc')](_0x5a3c('0xc7'),_0x29319b[_0x5a3c('0xb0')]['id'],_0x2be76c);var _0x372f14=path['join'](_0x299f18,_0x9928c0);var _0x357d1d=[];_0x357d1d['push']({'model':db[_0x5a3c('0xc8')],'as':_0x5a3c('0xc8'),'attributes':['id','fullname'],'raw':!![]});_0x357d1d[_0x5a3c('0x30')]({'model':db[_0x5a3c('0xc9')],'as':_0x5a3c('0x66'),'attributes':['id',_0x5a3c('0xca'),_0x5a3c('0xcb')],'raw':!![]});var _0x326320=[{'model':db[_0x5a3c('0xb9')],'as':_0x5a3c('0xcc'),'attributes':['id','body',_0x5a3c('0x78'),_0x5a3c('0xcd'),_0x5a3c('0xce'),_0x5a3c('0x7f')],'include':_0x357d1d}];_0x326320[_0x5a3c('0x30')]({'model':db['SmsAccount'],'as':_0x5a3c('0xcf'),'attributes':['id',_0x5a3c('0x28')]});_0x326320['push']({'model':db[_0x5a3c('0xc8')],'as':_0x5a3c('0xd0'),'attributes':['id',_0x5a3c('0x2b')]});return db[_0x5a3c('0x3a')][_0x5a3c('0x62')]({'where':{'id':_0x29319b['params']['id']},'include':_0x326320})['then'](handleEntityNotFound(_0x59cde6,null))[_0x5a3c('0x31')](function(_0x352b03){if(_0x352b03){var _0x3117b6=_0x352b03[_0x5a3c('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x5c6d81);var _0xe74d4a={'channel':_0x5a3c('0xd2'),'account':_0x3117b6[_0x5a3c('0xcf')][_0x5a3c('0x28')],'agent':_0x3117b6[_0x5a3c('0xd0')]?_0x3117b6[_0x5a3c('0xd0')][_0x5a3c('0x2b')]:'N.A.','createdAt':moment(_0x3117b6[_0x5a3c('0x78')])[_0x5a3c('0xbc')](_0x5a3c('0xd3'))[_0x5a3c('0x94')](),'closedAt':_0x3117b6['closed']?moment(_0x3117b6[_0x5a3c('0xd4')])['format'](_0x5a3c('0xd3'))[_0x5a3c('0x94')]():'','disposition':_0x3117b6[_0x5a3c('0xd5')],'messages':_(_0x3117b6[_0x5a3c('0xcc')])[_0x5a3c('0x83')]({'secret':![]})[_0x5a3c('0x2a')](function(_0x47a870){return{'date':moment(_0x47a870[_0x5a3c('0x78')])[_0x5a3c('0xbc')](_0x5a3c('0xd3'))[_0x5a3c('0x94')](),'sender':_0x47a870[_0x5a3c('0xcd')]===_0x5a3c('0xd6')?_0x47a870[_0x5a3c('0xc8')]?_0x47a870['User'][_0x5a3c('0x2b')]:_0x5a3c('0xd7'):_0x47a870[_0x5a3c('0x66')][_0x5a3c('0xca')]+(_0x47a870[_0x5a3c('0x66')][_0x5a3c('0xcb')]?'\x20'+_0x47a870[_0x5a3c('0x66')][_0x5a3c('0xcb')]:''),'body':_0x47a870[_0x5a3c('0x72')],'direction':_0x47a870[_0x5a3c('0xcd')]==='out'?'A':'C','secret':_0x47a870['secret'],'read':_0x47a870['read']};})[_0x5a3c('0x63')]()};return ejs[_0x5a3c('0xd8')](path['join'](config['root'],_0x5a3c('0xc4'),_0x5a3c('0xd9'),'downloadInteraction.ejs'),{'interaction':_0xe74d4a})[_0x5a3c('0x31')](function(_0x643650){var _0x3a3f54=path['join'](_0x5c6d81,_0x5a3c('0xda')+_0x3117b6['id']+'-'+_0x2be76c+_0x5a3c('0xdb'));var _0xb28f3={'path':_0x3a3f54,'channel':_0x5a3c('0xd2'),'interactionId':_0x3117b6['id']};return pdf[_0x5a3c('0xdc')](_0x643650,_0xb28f3);})['then'](function(){return new BPromise(function(_0x3d48df,_0x5990d8){zipdir(_0x5c6d81,{'saveTo':_0x372f14},function(_0xf2393,_0x358c3b){if(_0xf2393)return _0x5990d8(_0xf2393);return _0x3d48df(_0x358c3b);});})[_0x5a3c('0x31')](function(){return new BPromise(function(_0x1f8f85,_0xea1399){rimraf(_0x5c6d81,function(_0x2f14f1){if(_0x2f14f1)_0xea1399(_0x2f14f1);return _0x1f8f85();});});})[_0x5a3c('0x31')](function(){return _0x59cde6[_0x5a3c('0xc1')](_0x372f14,_0x9928c0,function(_0x1744f0){if(_0x1744f0){console[_0x5a3c('0xdd')](_0x5a3c('0xde'),_0x1744f0);}else{fs[_0x5a3c('0xdf')](_0x372f14);}});});});}else{return _0x59cde6['sendStatus'](0xc8);}})[_0x5a3c('0xae')](handleError(_0x59cde6,null));}; \ No newline at end of file +var _0xb64e=['sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','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','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','end','body','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','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','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.mandatoryDisposition','i.*','c.firstName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','show','params','includeAll','create','destroy','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','rows','addTags','setTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','User','firstName','Messages','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','closedAt','disposition','System','Contact','lastName','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','name','send','map','fullname','TagIds','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filters','field','color','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','expr','search'];(function(_0x56206d,_0x551d91){var _0xddd154=function(_0x84fcce){while(--_0x84fcce){_0x56206d['push'](_0x56206d['shift']());}};_0xddd154(++_0x551d91);}(_0xb64e,0x89));var _0xeb64=function(_0x503411,_0x49eabd){_0x503411=_0x503411-0x0;var _0x2e61ac=_0xb64e[_0x503411];return _0x2e61ac;};'use strict';var emlformat=require(_0xeb64('0x0'));var rimraf=require(_0xeb64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb64('0x2'));var rp=require(_0xeb64('0x3'));var moment=require(_0xeb64('0x4'));var BPromise=require(_0xeb64('0x5'));var Mustache=require(_0xeb64('0x6'));var util=require('util');var path=require('path');var sox=require(_0xeb64('0x7'));var csv=require(_0xeb64('0x8'));var ejs=require(_0xeb64('0x9'));var fs=require('fs');var fs_extra=require(_0xeb64('0xa'));var _=require(_0xeb64('0xb'));var squel=require(_0xeb64('0xc'));var crypto=require(_0xeb64('0xd'));var jsforce=require(_0xeb64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeb64('0x8'));var querystring=require('querystring');var Papa=require(_0xeb64('0xf'));var Redis=require('ioredis');var authService=require(_0xeb64('0x10'));var qs=require(_0xeb64('0x11'));var as=require(_0xeb64('0x12'));var pdf=require(_0xeb64('0x13'));var hardwareService=require(_0xeb64('0x14'));var logger=require('../../config/logger')(_0xeb64('0x15'));var utils=require(_0xeb64('0x16'));var config=require(_0xeb64('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb64('0x18'))['db'];config[_0xeb64('0x19')]=_[_0xeb64('0x1a')](config[_0xeb64('0x19')],{'host':_0xeb64('0x1b'),'port':0x18eb});var socket=require(_0xeb64('0x1c'))(new Redis(config[_0xeb64('0x19')]));require(_0xeb64('0x1d'))[_0xeb64('0x1e')](socket);function respondWithStatusCode(_0xebd47e,_0x2ab273){_0x2ab273=_0x2ab273||0xcc;return function(_0x3878a7){if(_0x3878a7){return _0xebd47e[_0xeb64('0x1f')](_0x2ab273);}return _0xebd47e[_0xeb64('0x20')](_0x2ab273)['end']();};}function respondWithResult(_0x4ca119,_0x597fc9){_0x597fc9=_0x597fc9||0xc8;return function(_0x17087b){if(_0x17087b){return _0x4ca119[_0xeb64('0x20')](_0x597fc9)[_0xeb64('0x21')](_0x17087b);}};}function respondWithFilteredResult(_0x24df54,_0x28ecb0){return function(_0x39caf2){if(_0x39caf2){var _0x388f1a=typeof _0x28ecb0[_0xeb64('0x22')]===_0xeb64('0x23')&&typeof _0x28ecb0[_0xeb64('0x24')]===_0xeb64('0x23');var _0xd05b9f=_0x39caf2[_0xeb64('0x25')];var _0x4efbef=_0x388f1a?0x0:_0x28ecb0[_0xeb64('0x22')];var _0x537417=_0x388f1a?_0x39caf2['count']:_0x28ecb0[_0xeb64('0x22')]+_0x28ecb0['limit'];var _0x3a0f92;if(_0x537417>=_0xd05b9f){_0x537417=_0xd05b9f;_0x3a0f92=0xc8;}else{_0x3a0f92=0xce;}_0x24df54[_0xeb64('0x20')](_0x3a0f92);return _0x24df54[_0xeb64('0x26')]('Content-Range',_0x4efbef+'-'+_0x537417+'/'+_0xd05b9f)[_0xeb64('0x21')](_0x39caf2);}return null;};}function patchUpdates(_0x598d81){return function(_0x2be8ed){try{jsonpatch[_0xeb64('0x27')](_0x2be8ed,_0x598d81,!![]);}catch(_0x5202a2){return BPromise[_0xeb64('0x28')](_0x5202a2);}return _0x2be8ed[_0xeb64('0x29')]();};}function saveUpdates(_0x86b4cf,_0x471bbe){return function(_0x251884){if(_0x251884){return _0x251884[_0xeb64('0x2a')](_0x86b4cf)[_0xeb64('0x2b')](function(_0x207c15){return _0x207c15;});}return null;};}function removeEntity(_0x171b11,_0x17edcb){return function(_0x171e29){if(_0x171e29){return _0x171e29['destroy']()['then'](function(){_0x171b11[_0xeb64('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42afdd,_0x11ff0e){return function(_0x29ffc6){if(!_0x29ffc6){_0x42afdd[_0xeb64('0x1f')](0x194);}return _0x29ffc6;};}function handleError(_0x2f1643,_0x388871){_0x388871=_0x388871||0x1f4;return function(_0x344927){logger['error'](_0x344927['stack']);if(_0x344927[_0xeb64('0x2c')]){delete _0x344927['name'];}_0x2f1643[_0xeb64('0x20')](_0x388871)[_0xeb64('0x2d')](_0x344927);};}function getInteractionUsers(_0x220fba,_0x3ca66b){return new BPromise(function(_0x3fbc06,_0xae4b82){try{if(_0x3ca66b[_0x220fba['id']]){_0x220fba['Users']=_[_0xeb64('0x2e')](_0x3ca66b[_0x220fba['id']],function(_0x55779c){return{'id':_0x55779c['id'],'fullname':_0x55779c[_0xeb64('0x2f')]};});}}catch(_0xa8d8c5){_0xae4b82(_0xa8d8c5);}_0x3fbc06(_0x220fba);});}function getInteractionTags(_0x3720d7,_0x179a8b){return new BPromise(function(_0x5ac7fd,_0x4a8819){try{if(_0x3720d7['TagIds']){_0x3720d7['Tags']=[];_0x3720d7[_0xeb64('0x30')][_0xeb64('0x31')](',')[_0xeb64('0x32')](function(_0x228969){_0x3720d7['Tags'][_0xeb64('0x33')](_0x179a8b[_0x228969]);});}delete _0x3720d7[_0xeb64('0x30')];}catch(_0xafee17){_0x4a8819(_0xafee17);}_0x5ac7fd(_0x3720d7);});}function updateSmsInteraction(_0x72193e,_0x3afb56,_0x542e49){return new BPromise(function(_0x30dc6d,_0x2df10f){return getInteractionUsers(_0x72193e,_0x542e49)[_0xeb64('0x2b')](function(_0x302384){return getInteractionTags(_0x302384,_0x3afb56);})['then'](function(_0x49768f){return getStateInteraction(_0x49768f);})[_0xeb64('0x2b')](function(_0x24e2af){_0x30dc6d(_0x24e2af);})[_0xeb64('0x34')](function(_0x275d37){_0x2df10f(_0x275d37);});});}function getStateInteraction(_0x5a5093){return new BPromise(function(_0x3bb0ae){_0x5a5093[_0xeb64('0x35')]=0x0;_0x5a5093[_0xeb64('0x36')]=0x0;_0x5a5093[_0xeb64('0x37')]=0x0;_0x5a5093[_0xeb64('0x38')]=0x0;_0x5a5093[_0xeb64('0x39')]=0x0;if(!_0x5a5093['closed']&&!_0x5a5093['UserId']){_0x5a5093[_0xeb64('0x35')]+=0x1;}if(!_0x5a5093[_0xeb64('0x3a')]&&_0x5a5093[_0xeb64('0x3b')]){_0x5a5093[_0xeb64('0x36')]+=0x1;if(_0x5a5093[_0xeb64('0x35')]){_0x5a5093[_0xeb64('0x35')]-=0x1;}}if(_0x5a5093['closed']&&_0x5a5093[_0xeb64('0x3b')]){_0x5a5093['answered']+=0x1;if(_0x5a5093[_0xeb64('0x36')]){_0x5a5093['talking']-=0x1;}}if(_0x5a5093[_0xeb64('0x3a')]&&!_0x5a5093[_0xeb64('0x3b')]){_0x5a5093[_0xeb64('0x38')]+=0x1;if(_0x5a5093[_0xeb64('0x35')]){_0x5a5093['waiting']-=0x1;}}_0x5a5093[_0xeb64('0x39')]+=0x1;_0x3bb0ae(_0x5a5093);});}exports[_0xeb64('0x3c')]=function(_0x397f6f,_0x3a0ec1){var _0x999376={},_0x12fd27={},_0xe46122={'count':0x0,'rows':[]};var _0x1e457d=_[_0xeb64('0x2e')](db[_0xeb64('0x3d')][_0xeb64('0x3e')],function(_0x348983){return{'name':_0x348983[_0xeb64('0x3f')],'type':_0x348983[_0xeb64('0x40')]['key']};});_0x12fd27['model']=_['map'](_0x1e457d,'name');_0x12fd27[_0xeb64('0x41')]=_['keys'](_0x397f6f[_0xeb64('0x41')]);_0x12fd27['filters']=_[_0xeb64('0x42')](_0x12fd27[_0xeb64('0x43')],_0x12fd27['query']);_0x999376[_0xeb64('0x44')]=_['intersection'](_0x12fd27[_0xeb64('0x43')],qs['fields'](_0x397f6f[_0xeb64('0x41')][_0xeb64('0x45')]));_0x999376[_0xeb64('0x44')]=_0x999376['attributes']['length']?_0x999376[_0xeb64('0x44')]:_0x12fd27[_0xeb64('0x43')];if(!_0x397f6f['query']['hasOwnProperty'](_0xeb64('0x46'))){_0x999376['limit']=qs['limit'](_0x397f6f['query']['limit']);_0x999376[_0xeb64('0x22')]=qs['offset'](_0x397f6f[_0xeb64('0x41')]['offset']);}_0x999376[_0xeb64('0x47')]=qs[_0xeb64('0x48')](_0x397f6f[_0xeb64('0x41')]['sort']);_0x999376[_0xeb64('0x49')]=qs['filters'](_[_0xeb64('0x4a')](_0x397f6f[_0xeb64('0x41')],_0x12fd27[_0xeb64('0x4b')]),_0x1e457d);var _0x5735ad=[];var _0x25ebc3=squel['select']()['field']('id')[_0xeb64('0x4c')](_0xeb64('0x2c'))['field'](_0xeb64('0x4d'))[_0xeb64('0x4e')](_0xeb64('0x4f'));var _0x4c3a0b=squel[_0xeb64('0x50')]()['field'](_0xeb64('0x51'))[_0xeb64('0x4c')](_0xeb64('0x52'))[_0xeb64('0x4c')](_0xeb64('0x53'))[_0xeb64('0x4e')](_0xeb64('0x54'),'ui')[_0xeb64('0x55')](_0xeb64('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x3a01c1=squel[_0xeb64('0x50')]()['from']('sms_interactions','i')[_0xeb64('0x55')]('cm_contacts','c',_0xeb64('0x57'))['left_join'](_0xeb64('0x56'),'o',_0xeb64('0x58'))[_0xeb64('0x55')](_0xeb64('0x59'),'a',_0xeb64('0x5a'))[_0xeb64('0x55')](_0xeb64('0x5b'),'me',_0xeb64('0x5c'))[_0xeb64('0x55')]('sms_interaction_has_tags','it',_0xeb64('0x5d'))[_0xeb64('0x55')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3e6a07=squel[_0xeb64('0x5e')]();var _0x3a8f3e=[];var _0x32c1e0=squel[_0xeb64('0x5e')]();var _0x59c5c0;if(_0x397f6f[_0xeb64('0x41')]['search']){_0x59c5c0=as['parseSearch'](_0x397f6f[_0xeb64('0x41')][_0xeb64('0x5f')]);var _0x165a92=_0x59c5c0[_0xeb64('0x60')];for(var _0x7f2b17=0x0;_0x7f2b17<_0x59c5c0[_0xeb64('0x61')][_0xeb64('0x62')];_0x7f2b17++){var _0x37865d=_0x59c5c0[_0xeb64('0x61')][_0x7f2b17];var _0x1df1f6='i';var _0x47d570=_['find'](_0x1e457d,['name',_0x37865d[_0xeb64('0x4c')]]);if(!_0x47d570){switch(_0x37865d[_0xeb64('0x4c')]){case _0xeb64('0x63'):if(_0x37865d[_0xeb64('0x64')]==0x1){_0x3a01c1[_0xeb64('0x65')]('`'+_0x37865d[_0xeb64('0x4c')]+_0xeb64('0x66'));}else{_0x3a01c1[_0xeb64('0x65')]('`'+_0x37865d[_0xeb64('0x4c')]+_0xeb64('0x67'));}break;case'Contact':if(_0x37865d[_0xeb64('0x68')]===_0xeb64('0x69')){if(_0x37865d['value'][_0xeb64('0x31')]('\x20')['length']>0x1){_0x3e6a07[_0x165a92](_0xeb64('0x6a'),qs[_0xeb64('0x6b')](_0x37865d['value']),null);}else{var _0x74bbc='%'+_0x37865d[_0xeb64('0x64')]+'%';_0x3e6a07[_0x165a92](_0xeb64('0x6c'),_0x74bbc,_0x74bbc,_0x74bbc);}}else{_0x47d570=_[_0xeb64('0x6d')](_0x1e457d,['name',_0xeb64('0x6e')]);_0x37865d[_0xeb64('0x4c')]=_0xeb64('0x6e');_0x514036=as[_0xeb64('0x6f')](_0x1df1f6,_0x47d570[_0xeb64('0x40')],_0x37865d);_0x3e6a07[_0x165a92](_0x514036[_0xeb64('0x70')],_0x514036[_0xeb64('0x64')]['start'],_0x514036[_0xeb64('0x64')]['end']);}break;case'Tag':var _0x38ba6e=_0x37865d[_0xeb64('0x64')][_0xeb64('0x31')](',')[_0xeb64('0x2e')](function(_0x48d65f){return Number(_0x48d65f);});_0x38ba6e[_0xeb64('0x32')](function(_0xa38a8f){_0x32c1e0['or'](_0xeb64('0x71'),'%,'+_0xa38a8f+',%');});_0x3a8f3e=_[_0xeb64('0x72')](_0x3a8f3e,_0x38ba6e);break;case'User':if(_0x37865d[_0xeb64('0x68')]===_0xeb64('0x69')){_0x3e6a07[_0x165a92](_0xeb64('0x73'),'%'+_0x37865d['value']+'%',null);}else{_0x47d570=_[_0xeb64('0x6d')](_0x1e457d,[_0xeb64('0x2c'),_0xeb64('0x3b')]);_0x37865d[_0xeb64('0x4c')]=_0xeb64('0x3b');_0x514036=as[_0xeb64('0x6f')](_0x1df1f6,_0x47d570['type'],_0x37865d);_0x3e6a07[_0x165a92](_0x514036['text'],_0x514036['value'][_0xeb64('0x74')],_0x514036['value'][_0xeb64('0x75')]);}break;case _0xeb64('0x76'):_0x514036=as[_0xeb64('0x6f')]('me',null,_0x37865d);_0x3e6a07[_0x165a92](_0x514036['text'],_0x514036['value']['start'],_0x514036[_0xeb64('0x64')][_0xeb64('0x75')]);break;}}else{var _0x514036=as[_0xeb64('0x6f')](_0x1df1f6,_0x47d570['type'],_0x37865d);_0x3e6a07[_0x165a92](_0x514036[_0xeb64('0x70')],_0x514036[_0xeb64('0x64')]['start'],_0x514036['value'][_0xeb64('0x75')]);}}}else{var _0x2c4dac=_(_0x397f6f[_0xeb64('0x41')])[_0xeb64('0x77')]()[_0xeb64('0x2e')](function(_0x3ec849){return _[_0xeb64('0x78')](_0x1e457d,['name',_0x3ec849])?_0x3ec849:undefined;})[_0xeb64('0x79')]()[_0xeb64('0x64')]();if(!_[_0xeb64('0x7a')](_0x2c4dac)){_0x2c4dac[_0xeb64('0x32')](function(_0x27ab1e){if(_0x27ab1e===_0xeb64('0x7b')){_0x3a01c1[_0xeb64('0x49')](_0xeb64('0x7c'),[]['concat'](_0x397f6f[_0xeb64('0x41')][_0x27ab1e]));}else if(_0x27ab1e===_0xeb64('0x7d')){var _0x461202=JSON[_0xeb64('0x7e')](_0x397f6f[_0xeb64('0x41')][_0x27ab1e])[_0xeb64('0x7f')];var _0x3bfb30=JSON[_0xeb64('0x7e')](_0x397f6f['query'][_0x27ab1e])[_0xeb64('0x80')];_0x3a01c1[_0xeb64('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x461202,_0x3bfb30);}else{if(_0x397f6f['query'][_0x27ab1e]===_0xeb64('0x81')){_0x3a01c1['where']('i.'+_0x27ab1e+'\x20IS\x20NULL');}else{_0x3a01c1[_0xeb64('0x49')]('i.'+_0x27ab1e+_0xeb64('0x82'),_0x397f6f['query'][_0x27ab1e]);}}});}if(_0x397f6f[_0xeb64('0x41')][_0xeb64('0x83')]){if(_0x397f6f[_0xeb64('0x41')][_0xeb64('0x83')]==0x1){_0x3a01c1[_0xeb64('0x65')]('`unreadMessages`\x20=\x200');}else{_0x3a01c1[_0xeb64('0x65')](_0xeb64('0x84'));}}if(_0x397f6f['query'][_0xeb64('0x85')]){_0x3a8f3e=_[_0xeb64('0x86')](_0x397f6f[_0xeb64('0x41')][_0xeb64('0x85')])?_0x397f6f[_0xeb64('0x41')]['tag']:new Array(_0x397f6f[_0xeb64('0x41')]['tag']);_0x3a8f3e[_0xeb64('0x32')](function(_0x133aa4){_0x32c1e0['or'](_0xeb64('0x71'),'%,'+_0x133aa4+',%');});}if(_0x397f6f[_0xeb64('0x41')]['filter']){var _0x34d088=_0x397f6f[_0xeb64('0x41')]['filter']['replace']('\x5c','\x5c\x5c')[_0xeb64('0x87')](/'/g,'\x27\x27');if(qs[_0xeb64('0x88')](_0x34d088)){_0x3e6a07['or']('i.id\x20LIKE\x20?',_0x34d088+'%')['or'](_0xeb64('0x89'),_0x34d088+'%');}else{_0x3e6a07['or'](_0xeb64('0x8a'),qs[_0xeb64('0x6b')](_0x34d088))['or'](_0xeb64('0x8b'),_0x34d088+'%');}}}_0x3a01c1['where'](_0x3e6a07);_0x3a01c1[_0xeb64('0x8c')](_0xeb64('0x8d'));var _0x15fc31={'type':db[_0xeb64('0x8e')]['QueryTypes'][_0xeb64('0x8f')],'raw':!![]};var _0x4324e5=_0x3a01c1[_0xeb64('0x90')]();_0x4324e5['field'](_0xeb64('0x8d'));_0x4324e5[_0xeb64('0x4c')](_0xeb64('0x91'),'unreadMessages');if(_0x999376[_0xeb64('0x47')]){_0x999376[_0xeb64('0x47')][_0xeb64('0x32')](function(_0x4c0912){var _0x2738f7=_0x4c0912[0x0]===_0xeb64('0x92')?_0x4c0912[0x0]:'i.'+_0x4c0912[0x0];_0x3a01c1[_0xeb64('0x47')](_0x2738f7,_0x4c0912[0x1]===_0xeb64('0x93')?![]:!![]);});}if(!_[_0xeb64('0x7a')](_0x3a8f3e)){_0x3a01c1[_0xeb64('0x65')](_0x32c1e0);_0x4324e5['where'](_0xeb64('0x94'),_0x3a8f3e);}BPromise[_0xeb64('0x95')]()[_0xeb64('0x2b')](function(){if(!_0x59c5c0){if(_0x397f6f[_0xeb64('0x41')][_0xeb64('0x7b')])return;_0x4324e5[_0xeb64('0x49')](_0xeb64('0x96'));_0x3a01c1['where'](_0xeb64('0x96'));return;}if(_0x397f6f[_0xeb64('0x97')][_0xeb64('0x98')]!==_0xeb64('0x99'))return;return _0x397f6f['user'][_0xeb64('0x9a')]({'attributes':['id'],'raw':!![]})[_0xeb64('0x2b')](function(_0x544660){if(_[_0xeb64('0x7a')](_0x544660)){_0x4324e5[_0xeb64('0x49')]('i.SmsAccountId\x20IS\x20NULL');_0x3a01c1['where'](_0xeb64('0x9b'));}else{_0x4324e5[_0xeb64('0x49')](_0xeb64('0x7c'),_[_0xeb64('0x2e')](_0x544660,'id'));_0x3a01c1['where'](_0xeb64('0x7c'),_[_0xeb64('0x2e')](_0x544660,'id'));}});})[_0xeb64('0x2b')](function(){if(_0x397f6f[_0xeb64('0x97')][_0xeb64('0x98')]===_0xeb64('0x99')&&!_0x59c5c0&&!_0x397f6f[_0xeb64('0x41')]['SmsAccountId'])return[];return db[_0xeb64('0x9c')]['query'](_0x4324e5[_0xeb64('0x9d')](),_0x15fc31);})[_0xeb64('0x2b')](function(_0x4d4c8a){_0xe46122[_0xeb64('0x25')]=_0x4d4c8a['length'];if(_0xe46122['count']===0x0)return[];return db[_0xeb64('0x9c')][_0xeb64('0x41')](_0x25ebc3['toString'](),_0x15fc31)[_0xeb64('0x2b')](function(_0x44c3b4){_0x5735ad=_['keyBy'](_0x44c3b4,'id');_0x15fc31=_[_0xeb64('0x9e')](_0x15fc31,{'model':db[_0xeb64('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x397f6f[_0xeb64('0x41')][_0xeb64('0x45')]){_0x999376[_0xeb64('0x44')][_0xeb64('0x32')](function(_0xa007a4){_0x3a01c1[_0xeb64('0x4c')]('i.'+_0xa007a4);});}else{_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0x91'),_0xeb64('0x63'));_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0x9f'),'Account.key');_0x3a01c1['field']('a.mandatoryDisposition',_0xeb64('0xa0'));_0x3a01c1[_0xeb64('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',_0xeb64('0x92'));_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0xa1'));_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0xa2'),'Contact.firstName');_0x3a01c1[_0xeb64('0x4c')]('c.lastName','Contact.lastName');_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0xa3'),_0xeb64('0xa4'));_0x3a01c1[_0xeb64('0x4c')]('c.phone',_0xeb64('0xa5'));_0x3a01c1['field'](_0xeb64('0xa6'),_0xeb64('0xa7'));_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0xa8'),_0xeb64('0xa9'));_0x3a01c1[_0xeb64('0x4c')]('o.fullname','Owner.fullname');_0x3a01c1['field'](_0xeb64('0xaa'),_0xeb64('0xab'));_0x3a01c1[_0xeb64('0x4c')](_0xeb64('0xac'),_0xeb64('0x30'));}if(_0x999376[_0xeb64('0x24')])_0x3a01c1[_0xeb64('0x24')](_0x999376[_0xeb64('0x24')]);if(_0x999376[_0xeb64('0x22')])_0x3a01c1[_0xeb64('0x22')](_0x999376[_0xeb64('0x22')]);return db[_0xeb64('0x9c')]['query'](_0x3a01c1[_0xeb64('0x9d')](),_0x15fc31);})[_0xeb64('0x2b')](function(_0x4e7471){if(_0x4e7471[_0xeb64('0x62')]>0x0)_0x4c3a0b[_0xeb64('0x49')](_0xeb64('0xad'),_['map'](_0x4e7471,'id'));return db[_0xeb64('0x9c')][_0xeb64('0x41')](_0x4c3a0b[_0xeb64('0x9d')](),_0x15fc31)[_0xeb64('0x2b')](function(_0x2c61f6){var _0x502d12=_[_0xeb64('0xae')](_0x2c61f6,_0xeb64('0xaf'));var _0x56464e=[];_0x4e7471[_0xeb64('0x32')](function(_0x360468){_0x56464e[_0xeb64('0x33')](updateSmsInteraction(_0x360468,_0x5735ad,_0x502d12));});return BPromise['all'](_0x56464e);});});})[_0xeb64('0x2b')](function(_0x3479e1){_0xe46122['rows']=_0x3479e1;return _0xe46122;})['then'](respondWithFilteredResult(_0x3a0ec1,_0x999376))['catch'](handleError(_0x3a0ec1,null));};exports[_0xeb64('0xb0')]=function(_0x54a363,_0x46e046){var _0xf0f26={'raw':![],'where':{'id':_0x54a363[_0xeb64('0xb1')]['id']}},_0x334a9a={};_0x334a9a[_0xeb64('0x43')]=_[_0xeb64('0x77')](db['SmsInteraction'][_0xeb64('0x3e')]);_0x334a9a[_0xeb64('0x41')]=_[_0xeb64('0x77')](_0x54a363[_0xeb64('0x41')]);_0x334a9a[_0xeb64('0x4b')]=_[_0xeb64('0x42')](_0x334a9a[_0xeb64('0x43')],_0x334a9a[_0xeb64('0x41')]);_0xf0f26['attributes']=_['intersection'](_0x334a9a['model'],qs[_0xeb64('0x45')](_0x54a363['query'][_0xeb64('0x45')]));_0xf0f26[_0xeb64('0x44')]=_0xf0f26[_0xeb64('0x44')][_0xeb64('0x62')]?_0xf0f26[_0xeb64('0x44')]:_0x334a9a['model'];if(_0x54a363[_0xeb64('0x41')][_0xeb64('0xb2')]){_0xf0f26['include']=[{'all':!![]}];}_0xf0f26=_[_0xeb64('0x9e')]({},_0xf0f26,_0x54a363['options']);return db[_0xeb64('0x3d')]['find'](_0xf0f26)[_0xeb64('0x2b')](handleEntityNotFound(_0x46e046,null))['then'](respondWithResult(_0x46e046,null))[_0xeb64('0x34')](handleError(_0x46e046,null));};exports[_0xeb64('0xb3')]=function(_0x5f2f4c,_0x1955ce){return db[_0xeb64('0x3d')]['create'](_0x5f2f4c[_0xeb64('0x76')],{})[_0xeb64('0x2b')](respondWithResult(_0x1955ce,0xc9))[_0xeb64('0x34')](handleError(_0x1955ce,null));};exports[_0xeb64('0x2a')]=function(_0x39c2af,_0x43b947){if(_0x39c2af[_0xeb64('0x76')]['id']){delete _0x39c2af['body']['id'];}return db['SmsInteraction'][_0xeb64('0x6d')]({'where':{'id':_0x39c2af[_0xeb64('0xb1')]['id']}})[_0xeb64('0x2b')](handleEntityNotFound(_0x43b947,null))['then'](saveUpdates(_0x39c2af[_0xeb64('0x76')],null))[_0xeb64('0x2b')](respondWithResult(_0x43b947,null))['catch'](handleError(_0x43b947,null));};exports[_0xeb64('0xb4')]=function(_0x3224d7,_0x42b771){return db[_0xeb64('0x3d')][_0xeb64('0x6d')]({'where':{'id':_0x3224d7[_0xeb64('0xb1')]['id']}})['then'](handleEntityNotFound(_0x42b771,null))['then'](removeEntity(_0x42b771,null))['catch'](handleError(_0x42b771,null));};exports[_0xeb64('0xb5')]=function(_0x6b23b9,_0x575ffb){return db[_0xeb64('0x3d')]['describe']()[_0xeb64('0x2b')](respondWithResult(_0x575ffb,null))[_0xeb64('0x34')](handleError(_0x575ffb,null));};exports[_0xeb64('0xb6')]=function(_0x4ce08b,_0x238d7e,_0x55efa3){return db['SmsMessage']['find']({'where':{'id':_0x4ce08b[_0xeb64('0xb1')]['id']}})['then'](handleEntityNotFound(_0x238d7e,null))[_0xeb64('0x2b')](function(_0x20f949){if(_0x20f949){return _0x20f949[_0xeb64('0xb6')](_0x4ce08b[_0xeb64('0x76')][_0xeb64('0xb7')],_[_0xeb64('0xb8')](_0x4ce08b[_0xeb64('0x76')],['ids','id'])||{});}})['then'](respondWithResult(_0x238d7e,null))['catch'](handleError(_0x238d7e,null));};exports[_0xeb64('0xb9')]=function(_0x288325,_0x5e916d,_0x5ca820){var _0x2af095={'raw':![],'where':{}};var _0x494e18={};var _0xfd60c3={'count':0x0,'rows':[]};return db[_0xeb64('0x3d')][_0xeb64('0xba')]({'where':{'id':_0x288325[_0xeb64('0xb1')]['id']}})[_0xeb64('0x2b')](handleEntityNotFound(_0x5e916d,null))[_0xeb64('0x2b')](function(_0xa788f8){if(_0xa788f8){_0x494e18[_0xeb64('0x43')]=_[_0xeb64('0x77')](db[_0xeb64('0xbb')][_0xeb64('0x3e')]);_0x494e18['query']=_[_0xeb64('0x77')](_0x288325[_0xeb64('0x41')]);_0x494e18[_0xeb64('0x4b')]=_[_0xeb64('0x42')](_0x494e18[_0xeb64('0x43')],_0x494e18[_0xeb64('0x41')]);_0x2af095['attributes']=_[_0xeb64('0x42')](_0x494e18[_0xeb64('0x43')],qs[_0xeb64('0x45')](_0x288325[_0xeb64('0x41')][_0xeb64('0x45')]));_0x2af095['attributes']=_0x2af095['attributes'][_0xeb64('0x62')]?_0x2af095[_0xeb64('0x44')]:_0x494e18[_0xeb64('0x43')];if(!_0x288325[_0xeb64('0x41')]['hasOwnProperty'](_0xeb64('0x46'))){_0x2af095[_0xeb64('0x24')]=qs[_0xeb64('0x24')](_0x288325[_0xeb64('0x41')][_0xeb64('0x24')]);_0x2af095[_0xeb64('0x22')]=qs[_0xeb64('0x22')](_0x288325[_0xeb64('0x41')][_0xeb64('0x22')]);}_0x2af095['order']=qs[_0xeb64('0x48')](_0x288325['query'][_0xeb64('0x48')]);_0x2af095[_0xeb64('0x49')]=qs[_0xeb64('0x4b')](_[_0xeb64('0x4a')](_0x288325[_0xeb64('0x41')],_0x494e18['filters']));_0x2af095[_0xeb64('0x49')][_0xeb64('0xaf')]=_0xa788f8['id'];if(_0x288325[_0xeb64('0x41')][_0xeb64('0xbc')]){_0x2af095[_0xeb64('0x49')]=_[_0xeb64('0x9e')](_0x2af095[_0xeb64('0x49')],{'$or':_['map'](_0x2af095['attributes'],function(_0x2c9c61){var _0x2c84e4={};_0x2c84e4[_0x2c9c61]={'$like':'%'+_0x288325['query'][_0xeb64('0xbc')]+'%'};return _0x2c84e4;})});}if(_0x288325[_0xeb64('0x41')][_0xeb64('0x7f')]){var _0x2c3d7a=_0x288325[_0xeb64('0x41')]['$gte'][_0xeb64('0x31')](',');var _0x2307ae={};_0x2307ae[_0x2c3d7a[0x0]]={'$gte':moment(_0x2c3d7a[0x1])[_0xeb64('0xbd')](_0xeb64('0xbe'))};_0x2af095[_0xeb64('0x49')]=_[_0xeb64('0x9e')](_0x2af095[_0xeb64('0x49')],_0x2307ae);}_0x2af095=_['merge']({},_0x2af095,_0x288325[_0xeb64('0xbf')]);return db[_0xeb64('0xbb')][_0xeb64('0x25')]({'where':_0x2af095['where']})[_0xeb64('0x2b')](function(_0x55e0){_0xfd60c3[_0xeb64('0x25')]=_0x55e0;if(_0x288325[_0xeb64('0x41')]['includeAll']){_0x2af095[_0xeb64('0xc0')]=[{'all':!![]}];}return db[_0xeb64('0xbb')][_0xeb64('0xc1')](_0x2af095);})[_0xeb64('0x2b')](function(_0x2ae4c3){_0xfd60c3[_0xeb64('0xc2')]=_0x2ae4c3;return _0xfd60c3;});}})['then'](respondWithFilteredResult(_0x5e916d,_0x2af095))[_0xeb64('0x34')](handleError(_0x5e916d,null));};exports[_0xeb64('0xc3')]=function(_0x4c217f,_0x132f59,_0x280fc0){return db['SmsInteraction']['find']({'where':{'id':_0x4c217f[_0xeb64('0xb1')]['id']}})[_0xeb64('0x2b')](handleEntityNotFound(_0x132f59,null))[_0xeb64('0x2b')](function(_0x57f775){if(_0x57f775){return _0x57f775[_0xeb64('0xc4')](_0x4c217f[_0xeb64('0x76')][_0xeb64('0xb7')],_[_0xeb64('0xb8')](_0x4c217f[_0xeb64('0x76')],[_0xeb64('0xb7'),'id'])||{})[_0xeb64('0xc5')](function(){return db[_0xeb64('0xc6')][_0xeb64('0xc1')]({'attributes':['id',_0xeb64('0x2c'),_0xeb64('0x4d')],'where':{'id':_0x4c217f[_0xeb64('0x76')][_0xeb64('0xb7')]}});})[_0xeb64('0x2b')](function(_0x55786d){socket['emit'](_0xeb64('0xc7'),{'id':Number(_0x4c217f[_0xeb64('0xb1')]['id']),'tags':_0x55786d||[]});return{'id':Number(_0x4c217f[_0xeb64('0xb1')]['id']),'tags':_0x55786d||[]};});}})['then'](respondWithResult(_0x132f59,null))[_0xeb64('0x34')](handleError(_0x132f59,null));};exports[_0xeb64('0xc8')]=function(_0x17b0ca,_0x5049bf,_0xf70160){return db[_0xeb64('0x3d')][_0xeb64('0x6d')]({'where':{'id':_0x17b0ca[_0xeb64('0xb1')]['id']}})[_0xeb64('0x2b')](handleEntityNotFound(_0x5049bf,null))[_0xeb64('0x2b')](function(_0x451820){if(_0x451820){return _0x451820[_0xeb64('0xc8')](_0x17b0ca[_0xeb64('0x41')]['ids']);}})[_0xeb64('0x2b')](respondWithStatusCode(_0x5049bf,null))[_0xeb64('0x34')](handleError(_0x5049bf,null));};exports[_0xeb64('0xc9')]=function(_0x5eae65,_0x25fe29){var _0x1a6c35=moment()[_0xeb64('0xca')]()['toString']();var _0x2e5144=path[_0xeb64('0xcb')](config[_0xeb64('0xcc')],_0xeb64('0xcd'),_0xeb64('0xce'),_0xeb64('0xcf'));var _0x33fcb7=path[_0xeb64('0xcb')](config[_0xeb64('0xcc')],_0xeb64('0xcd'),_0xeb64('0xce'),'attachments');var _0x10a931=path[_0xeb64('0xcb')](_0x2e5144,_0x1a6c35);var _0x4d1776=util['format'](_0xeb64('0xd0'),_0x5eae65[_0xeb64('0xb1')]['id'],_0x1a6c35);var _0x97c82d=path['join'](_0x2e5144,_0x4d1776);var _0xeaeb59=[];_0xeaeb59['push']({'model':db[_0xeb64('0xd1')],'as':_0xeb64('0xd1'),'attributes':['id',_0xeb64('0x2f')],'raw':!![]});_0xeaeb59[_0xeb64('0x33')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xeb64('0xd2'),'lastName'],'raw':!![]});var _0x40310b=[{'model':db[_0xeb64('0xbb')],'as':_0xeb64('0xd3'),'attributes':['id','body','createdAt',_0xeb64('0xd4'),_0xeb64('0xd5'),'read'],'include':_0xeaeb59}];_0x40310b[_0xeb64('0x33')]({'model':db[_0xeb64('0xd6')],'as':_0xeb64('0xd7'),'attributes':['id',_0xeb64('0x2c')]});_0x40310b[_0xeb64('0x33')]({'model':db[_0xeb64('0xd1')],'as':_0xeb64('0xd8'),'attributes':['id',_0xeb64('0x2f')]});return db[_0xeb64('0x3d')][_0xeb64('0x6d')]({'where':{'id':_0x5eae65[_0xeb64('0xb1')]['id']},'include':_0x40310b})[_0xeb64('0x2b')](handleEntityNotFound(_0x25fe29,null))[_0xeb64('0x2b')](function(_0x2561c6){if(_0x2561c6){var _0xfa2b6f=_0x2561c6[_0xeb64('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x10a931);var _0x5814b9={'channel':_0xeb64('0xda'),'account':_0xfa2b6f[_0xeb64('0xd7')][_0xeb64('0x2c')],'agent':_0xfa2b6f[_0xeb64('0xd8')]?_0xfa2b6f[_0xeb64('0xd8')][_0xeb64('0x2f')]:_0xeb64('0xdb'),'createdAt':moment(_0xfa2b6f[_0xeb64('0x7d')])[_0xeb64('0xbd')](_0xeb64('0xbe'))[_0xeb64('0x9d')](),'closedAt':_0xfa2b6f['closed']?moment(_0xfa2b6f[_0xeb64('0xdc')])[_0xeb64('0xbd')](_0xeb64('0xbe'))[_0xeb64('0x9d')]():'','disposition':_0xfa2b6f[_0xeb64('0xdd')],'messages':_(_0xfa2b6f[_0xeb64('0xd3')])[_0xeb64('0xbc')]({'secret':![]})[_0xeb64('0x2e')](function(_0xbc8e77){return{'date':moment(_0xbc8e77[_0xeb64('0x7d')])['format'](_0xeb64('0xbe'))[_0xeb64('0x9d')](),'sender':_0xbc8e77[_0xeb64('0xd4')]==='out'?_0xbc8e77[_0xeb64('0xd1')]?_0xbc8e77[_0xeb64('0xd1')][_0xeb64('0x2f')]:_0xeb64('0xde'):_0xbc8e77[_0xeb64('0xdf')]['firstName']+(_0xbc8e77[_0xeb64('0xdf')][_0xeb64('0xe0')]?'\x20'+_0xbc8e77['Contact'][_0xeb64('0xe0')]:''),'body':_0xbc8e77[_0xeb64('0x76')],'direction':_0xbc8e77[_0xeb64('0xd4')]===_0xeb64('0xe1')?'A':'C','secret':_0xbc8e77['secret'],'read':_0xbc8e77[_0xeb64('0x83')]};})[_0xeb64('0x64')]()};return ejs[_0xeb64('0xe2')](path[_0xeb64('0xcb')](config[_0xeb64('0xcc')],'server','views',_0xeb64('0xe3')),{'interaction':_0x5814b9})[_0xeb64('0x2b')](function(_0x430f56){var _0x21ba01=path[_0xeb64('0xcb')](_0x10a931,_0xeb64('0xe4')+_0xfa2b6f['id']+'-'+_0x1a6c35+_0xeb64('0xe5'));var _0x59219a={'path':_0x21ba01,'channel':_0xeb64('0xda'),'interactionId':_0xfa2b6f['id']};return pdf[_0xeb64('0xe6')](_0x430f56,_0x59219a);})[_0xeb64('0x2b')](function(){return new BPromise(function(_0x43ce15,_0x2a86f1){zipdir(_0x10a931,{'saveTo':_0x97c82d},function(_0x538c75,_0x5b4c8d){if(_0x538c75)return _0x2a86f1(_0x538c75);return _0x43ce15(_0x5b4c8d);});})[_0xeb64('0x2b')](function(){return new BPromise(function(_0x4581cc,_0x5b11e8){rimraf(_0x10a931,function(_0x33f562){if(_0x33f562)_0x5b11e8(_0x33f562);return _0x4581cc();});});})[_0xeb64('0x2b')](function(){return _0x25fe29[_0xeb64('0xc9')](_0x97c82d,_0x4d1776,function(_0x44085e){if(_0x44085e){console['log'](_0xeb64('0xe7'),_0x44085e);}else{fs[_0xeb64('0xe8')](_0x97c82d);}});});});}else{return _0x25fe29[_0xeb64('0x1f')](0xc8);}})[_0xeb64('0x34')](handleError(_0x25fe29,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4b30e4e..28a1a10 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 _0x056b=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x1bed29,_0x13d3be){var _0x19681e=function(_0x32c83d){while(--_0x32c83d){_0x1bed29['push'](_0x1bed29['shift']());}};_0x19681e(++_0x13d3be);}(_0x056b,0xb6));var _0xb056=function(_0x1ad8df,_0x2e1a1f){_0x1ad8df=_0x1ad8df-0x0;var _0x42d8b2=_0x056b[_0x1ad8df];return _0x42d8b2;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xb056('0x0'))['db'][_0xb056('0x1')];var SmsMessage=require(_0xb056('0x0'))['db'][_0xb056('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xb056('0x3')](0x0);var events={'afterCreate':_0xb056('0x4'),'afterUpdate':_0xb056('0x5'),'afterDestroy':_0xb056('0x6')};function emitEvent(_0x343d88){return function(_0x2ff09d,_0x15a545,_0x515612){_0x2ff09d[_0xb056('0x7')]({'attributes':['id'],'raw':!![]})[_0xb056('0x8')](function(_0x3eae69){_0x2ff09d[_0xb056('0x9')](_0xb056('0xa'),_0x3eae69[_0xb056('0xb')](function(_0x539126){return{'id':_0x539126['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x2ff09d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb056('0x8')](function(_0x160c2a){_0x2ff09d[_0xb056('0x9')](_0xb056('0xc'),_0x160c2a['length']);SmsInteractionEvents[_0xb056('0xd')](_0x343d88+':'+_0x2ff09d['id'],_0x2ff09d);SmsInteractionEvents['emit'](_0x343d88,_0x2ff09d);_0x515612(null);})[_0xb056('0xe')](_0x515612(null));};}for(var e in events){if(events[_0xb056('0xf')](e)){var event=events[e];SmsInteraction[_0xb056('0x10')](e,emitEvent(event));}}module[_0xb056('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x4b17=['SmsInteraction','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x127f17,_0x5cabf1){var _0x44874e=function(_0x26a716){while(--_0x26a716){_0x127f17['push'](_0x127f17['shift']());}};_0x44874e(++_0x5cabf1);}(_0x4b17,0x10f));var _0x74b1=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x4b17[_0x5538d5];return _0x323b1a;};'use strict';var EventEmitter=require(_0x74b1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x74b1('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x74b1('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x74b1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x74b1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fdea2){return function(_0x7b3c36,_0x30d910,_0x379dcc){_0x7b3c36[_0x74b1('0x5')]({'attributes':['id'],'raw':!![]})[_0x74b1('0x6')](function(_0x191d2b){_0x7b3c36[_0x74b1('0x7')]('Users',_0x191d2b[_0x74b1('0x8')](function(_0x98bb33){return{'id':_0x98bb33['id']};}));return SmsMessage[_0x74b1('0x9')]({'where':{'SmsInteractionId':_0x7b3c36['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74b1('0x6')](function(_0xc1952){_0x7b3c36['setDataValue'](_0x74b1('0xa'),_0xc1952[_0x74b1('0xb')]);SmsInteractionEvents['emit'](_0x4fdea2+':'+_0x7b3c36['id'],_0x7b3c36);SmsInteractionEvents[_0x74b1('0xc')](_0x4fdea2,_0x7b3c36);_0x379dcc(null);})[_0x74b1('0xd')](_0x379dcc(null));};}for(var e in events){if(events[_0x74b1('0xe')](e)){var event=events[e];SmsInteraction[_0x74b1('0xf')](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 3084f62..5809ab5 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 _0x031a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0x031a,0x192));var _0xa031=function(_0xa52a9a,_0x3a9b85){_0xa52a9a=_0xa52a9a-0x0;var _0x589854=_0x031a[_0xa52a9a];return _0x589854;};'use strict';var _=require(_0xa031('0x0'));var util=require(_0xa031('0x1'));var logger=require(_0xa031('0x2'))(_0xa031('0x3'));var moment=require(_0xa031('0x4'));var BPromise=require(_0xa031('0x5'));var rp=require(_0xa031('0x6'));var fs=require('fs');var path=require(_0xa031('0x7'));var rimraf=require(_0xa031('0x8'));var config=require('../../config/environment');var attributes=require(_0xa031('0x9'));module[_0xa031('0xa')]=function(_0x3aeeb5,_0x5a338c){return _0x3aeeb5[_0xa031('0xb')](_0xa031('0xc'),attributes,{'tableName':_0xa031('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30f10b,_0x2460fa,_0x54b9cc){if(_0x30f10b[_0xa031('0xe')](_0xa031('0xf'))){_0x30f10b[_0xa031('0x10')]=moment()[_0xa031('0x11')](_0xa031('0x12'));}_0x54b9cc(null,_0x30f10b);}}});}; \ No newline at end of file +var _0x6f21=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x549ac2,_0x54ba05){var _0x14adb3=function(_0x307be3){while(--_0x307be3){_0x549ac2['push'](_0x549ac2['shift']());}};_0x14adb3(++_0x54ba05);}(_0x6f21,0x16a));var _0x16f2=function(_0x154afb,_0x1fbda5){_0x154afb=_0x154afb-0x0;var _0x2cfb15=_0x6f21[_0x154afb];return _0x2cfb15;};'use strict';var _=require('lodash');var util=require(_0x16f2('0x0'));var logger=require(_0x16f2('0x1'))(_0x16f2('0x2'));var moment=require(_0x16f2('0x3'));var BPromise=require(_0x16f2('0x4'));var rp=require(_0x16f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x16f2('0x6'));var attributes=require(_0x16f2('0x7'));module[_0x16f2('0x8')]=function(_0x357c4e,_0x3d89f4){return _0x357c4e[_0x16f2('0x9')](_0x16f2('0xa'),attributes,{'tableName':_0x16f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x285ca8,_0x2582b7,_0x21eb1c){if(_0x285ca8['changed'](_0x16f2('0xc'))){_0x285ca8[_0x16f2('0xd')]=moment()[_0x16f2('0xe')](_0x16f2('0xf'));}_0x21eb1c(null,_0x285ca8);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e84a00a..c6fe076 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 _0x2db5=['redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2db5,0x15f));var _0x52db=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x2db5[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x52db('0x0'));var moment=require(_0x52db('0x1'));var BPromise=require('bluebird');var rs=require(_0x52db('0x2'));var fs=require('fs');var Redis=require(_0x52db('0x3'));var db=require(_0x52db('0x4'))['db'];var utils=require(_0x52db('0x5'));var logger=require(_0x52db('0x6'))(_0x52db('0x7'));var config=require('../../config/environment');var jayson=require(_0x52db('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x52db('0x9')]=_[_0x52db('0xa')](config['redis'],{'host':_0x52db('0xb'),'port':0x18eb});var socket=require(_0x52db('0xc'))(new Redis(config[_0x52db('0x9')]));require(_0x52db('0xd'))[_0x52db('0xe')](socket);function respondWithRpcPromise(_0x328079,_0x477469,_0x11ba7d){return new BPromise(function(_0x4264b3,_0x16ab72){return client[_0x52db('0xf')](_0x328079,_0x11ba7d)[_0x52db('0x10')](function(_0x54c95f){logger[_0x52db('0x11')](_0x52db('0x12'),_0x477469,_0x52db('0x13'));logger[_0x52db('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x477469,'request\x20sent',JSON['stringify'](_0x54c95f));if(_0x54c95f[_0x52db('0x15')]){if(_0x54c95f[_0x52db('0x15')]['code']===0x1f4){logger[_0x52db('0x15')](_0x52db('0x12'),_0x477469,_0x54c95f[_0x52db('0x15')][_0x52db('0x16')]);return _0x16ab72(_0x54c95f[_0x52db('0x15')][_0x52db('0x16')]);}logger['error'](_0x52db('0x12'),_0x477469,_0x54c95f['error']['message']);return _0x4264b3(_0x54c95f[_0x52db('0x15')][_0x52db('0x16')]);}else{logger['info'](_0x52db('0x12'),_0x477469,_0x52db('0x13'));_0x4264b3(_0x54c95f[_0x52db('0x17')][_0x52db('0x16')]);}})[_0x52db('0x18')](function(_0x356129){logger[_0x52db('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x477469,_0x356129);_0x16ab72(_0x356129);});});}exports[_0x52db('0x19')]=function(_0x506989){var _0x4154da=this;return new Promise(function(_0x519534,_0x1e145b){return db[_0x52db('0x1a')][_0x52db('0x1b')](_0x506989[_0x52db('0x1c')],{'raw':_0x506989[_0x52db('0x1d')]?_0x506989['options'][_0x52db('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506989[_0x52db('0x1d')]?_0x506989[_0x52db('0x1d')][_0x52db('0x1f')]||null:null,'attributes':_0x506989['options']?_0x506989[_0x52db('0x1d')][_0x52db('0x20')]||null:null,'limit':_0x506989['options']?_0x506989[_0x52db('0x1d')][_0x52db('0x21')]||null:null})[_0x52db('0x10')](function(_0x233f69){logger[_0x52db('0x11')]('UpdateSmsInteraction',_0x506989);logger['debug']('UpdateSmsInteraction',_0x506989,JSON[_0x52db('0x22')](_0x233f69));_0x519534(_0x233f69);})[_0x52db('0x18')](function(_0x3d13b4){logger[_0x52db('0x15')](_0x52db('0x19'),_0x3d13b4[_0x52db('0x16')],_0x506989);_0x1e145b(_0x4154da[_0x52db('0x15')](0x1f4,_0x3d13b4['message']));});});};exports[_0x52db('0x23')]=function(_0x5efe98){return new Promise(function(_0x112917,_0xeb6ec3){return db['SmsInteraction']['find']({'where':_0x5efe98[_0x52db('0x1d')]?_0x5efe98[_0x52db('0x1d')][_0x52db('0x1f')]||null:null})['then'](function(_0x145c59){if(_0x145c59){return _0x145c59[_0x52db('0x24')](_0x5efe98[_0x52db('0x1c')][_0x52db('0x25')],_['omit'](_0x5efe98['body'],[_0x52db('0x25'),'id'])||{});}})[_0x52db('0x26')](function(_0x12e089){logger[_0x52db('0x11')](_0x52db('0x27'),_0x5efe98);logger[_0x52db('0x14')](_0x52db('0x27'),_0x5efe98,JSON['stringify'](_0x12e089));_0x112917(_0x12e089);})[_0x52db('0x18')](function(_0x40fec3){logger[_0x52db('0x15')](_0x52db('0x27'),_0x40fec3['message'],_0x5efe98);_0xeb6ec3(_this[_0x52db('0x15')](0x1f4,_0x40fec3[_0x52db('0x16')]));});});}; \ No newline at end of file +var _0xdc57=['http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','ids','spread','AddTags','stringify','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdc57,0x17f));var _0x7dc5=function(_0xdeb29d,_0x60a3fe){_0xdeb29d=_0xdeb29d-0x0;var _0x334614=_0xdc57[_0xdeb29d];return _0x334614;};'use strict';var _=require(_0x7dc5('0x0'));var util=require(_0x7dc5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dc5('0x2'));var db=require(_0x7dc5('0x3'))['db'];var utils=require(_0x7dc5('0x4'));var logger=require('../../config/logger')(_0x7dc5('0x5'));var config=require('../../config/environment');var jayson=require(_0x7dc5('0x6'));var client=jayson['client'][_0x7dc5('0x7')]({'port':0x232a});config[_0x7dc5('0x8')]=_[_0x7dc5('0x9')](config[_0x7dc5('0x8')],{'host':_0x7dc5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7dc5('0x8')]));require(_0x7dc5('0xb'))[_0x7dc5('0xc')](socket);function respondWithRpcPromise(_0x12c120,_0x1ab557,_0x4762ea){return new BPromise(function(_0x3c49c1,_0x5af7f5){return client[_0x7dc5('0xd')](_0x12c120,_0x4762ea)[_0x7dc5('0xe')](function(_0x4bbc45){logger[_0x7dc5('0xf')](_0x7dc5('0x10'),_0x1ab557,'request\x20sent');logger[_0x7dc5('0x11')](_0x7dc5('0x12'),_0x1ab557,_0x7dc5('0x13'),JSON['stringify'](_0x4bbc45));if(_0x4bbc45[_0x7dc5('0x14')]){if(_0x4bbc45[_0x7dc5('0x14')][_0x7dc5('0x15')]===0x1f4){logger[_0x7dc5('0x14')](_0x7dc5('0x10'),_0x1ab557,_0x4bbc45['error'][_0x7dc5('0x16')]);return _0x5af7f5(_0x4bbc45[_0x7dc5('0x14')][_0x7dc5('0x16')]);}logger[_0x7dc5('0x14')](_0x7dc5('0x10'),_0x1ab557,_0x4bbc45[_0x7dc5('0x14')][_0x7dc5('0x16')]);return _0x3c49c1(_0x4bbc45[_0x7dc5('0x14')][_0x7dc5('0x16')]);}else{logger['info'](_0x7dc5('0x10'),_0x1ab557,_0x7dc5('0x13'));_0x3c49c1(_0x4bbc45[_0x7dc5('0x17')]['message']);}})['catch'](function(_0x761f63){logger['error'](_0x7dc5('0x10'),_0x1ab557,_0x761f63);_0x5af7f5(_0x761f63);});});}exports['UpdateSmsInteraction']=function(_0x5a2295){var _0x5d3fbe=this;return new Promise(function(_0x512cae,_0x3cc28a){return db['SmsInteraction']['update'](_0x5a2295[_0x7dc5('0x18')],{'raw':_0x5a2295[_0x7dc5('0x19')]?_0x5a2295['options'][_0x7dc5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2295['options']?_0x5a2295[_0x7dc5('0x19')][_0x7dc5('0x1b')]||null:null,'attributes':_0x5a2295[_0x7dc5('0x19')]?_0x5a2295[_0x7dc5('0x19')][_0x7dc5('0x1c')]||null:null,'limit':_0x5a2295[_0x7dc5('0x19')]?_0x5a2295[_0x7dc5('0x19')][_0x7dc5('0x1d')]||null:null})[_0x7dc5('0xe')](function(_0x454949){logger['info'](_0x7dc5('0x1e'),_0x5a2295);logger[_0x7dc5('0x11')](_0x7dc5('0x1e'),_0x5a2295,JSON['stringify'](_0x454949));_0x512cae(_0x454949);})['catch'](function(_0x55925a){logger[_0x7dc5('0x14')](_0x7dc5('0x1e'),_0x55925a[_0x7dc5('0x16')],_0x5a2295);_0x3cc28a(_0x5d3fbe['error'](0x1f4,_0x55925a[_0x7dc5('0x16')]));});});};exports[_0x7dc5('0x1f')]=function(_0x1c050a){return new Promise(function(_0x50e925,_0x23acb0){return db[_0x7dc5('0x20')][_0x7dc5('0x21')]({'where':_0x1c050a['options']?_0x1c050a['options']['where']||null:null})['then'](function(_0x46d08b){if(_0x46d08b){return _0x46d08b['addTags'](_0x1c050a[_0x7dc5('0x18')][_0x7dc5('0x22')],_['omit'](_0x1c050a[_0x7dc5('0x18')],[_0x7dc5('0x22'),'id'])||{});}})[_0x7dc5('0x23')](function(_0x2f1e01){logger[_0x7dc5('0xf')](_0x7dc5('0x24'),_0x1c050a);logger[_0x7dc5('0x11')](_0x7dc5('0x24'),_0x1c050a,JSON[_0x7dc5('0x25')](_0x2f1e01));_0x50e925(_0x2f1e01);})[_0x7dc5('0x26')](function(_0x7b8f3c){logger[_0x7dc5('0x14')](_0x7dc5('0x24'),_0x7b8f3c[_0x7dc5('0x16')],_0x1c050a);_0x23acb0(_this[_0x7dc5('0x14')](0x1f4,_0x7b8f3c[_0x7dc5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c1b0c90..26f2aca 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 _0xb94c=['length','smsInteraction:','./smsInteraction.events','remove','removeListener'];(function(_0x56031c,_0x2fcdde){var _0x35e6e7=function(_0x230532){while(--_0x230532){_0x56031c['push'](_0x56031c['shift']());}};_0x35e6e7(++_0x2fcdde);}(_0xb94c,0x70));var _0xcb94=function(_0x355545,_0x5d97fe){_0x355545=_0x355545-0x0;var _0x1c2031=_0xb94c[_0x355545];return _0x1c2031;};'use strict';var SmsInteractionEvents=require(_0xcb94('0x0'));var events=['save',_0xcb94('0x1'),'update'];function createListener(_0x1c8f2b,_0x4c8136){return function(_0x414183){_0x4c8136['emit'](_0x1c8f2b,_0x414183);};}function removeListener(_0x4f66fa,_0x2b2281){return function(){SmsInteractionEvents[_0xcb94('0x2')](_0x4f66fa,_0x2b2281);};}exports['register']=function(_0x353447){for(var _0x361e63=0x0,_0x5c7882=events[_0xcb94('0x3')];_0x361e63<_0x5c7882;_0x361e63++){var _0x5a01b4=events[_0x361e63];var _0x106927=createListener(_0xcb94('0x4')+_0x5a01b4,_0x353447);SmsInteractionEvents['on'](_0x5a01b4,_0x106927);}}; \ No newline at end of file +var _0x94a0=['removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x2706fc,_0x32b54e){var _0x522162=function(_0x53d620){while(--_0x53d620){_0x2706fc['push'](_0x2706fc['shift']());}};_0x522162(++_0x32b54e);}(_0x94a0,0x8d));var _0x094a=function(_0x487f47,_0x32b30b){_0x487f47=_0x487f47-0x0;var _0x35988b=_0x94a0[_0x487f47];return _0x35988b;};'use strict';var SmsInteractionEvents=require(_0x094a('0x0'));var events=['save',_0x094a('0x1'),_0x094a('0x2')];function createListener(_0x4c9b62,_0x320bad){return function(_0x3a7700){_0x320bad['emit'](_0x4c9b62,_0x3a7700);};}function removeListener(_0x305a94,_0x3521ae){return function(){SmsInteractionEvents[_0x094a('0x3')](_0x305a94,_0x3521ae);};}exports[_0x094a('0x4')]=function(_0x13549c){for(var _0x12ea2a=0x0,_0x202132=events['length'];_0x12ea2a<_0x202132;_0x12ea2a++){var _0x50957a=events[_0x12ea2a];var _0x360abd=createListener(_0x094a('0x5')+_0x50957a,_0x13549c);SmsInteractionEvents['on'](_0x50957a,_0x360abd);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5a7d385..623e289 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 _0xb67b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','/:id/accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xb67b,0x1f3));var _0xbb67=function(_0x598408,_0x5e6f74){_0x598408=_0x598408-0x0;var _0x560720=_0xb67b[_0x598408];return _0x560720;};'use strict';var multer=require(_0xbb67('0x0'));var util=require('util');var path=require(_0xbb67('0x1'));var timeout=require(_0xbb67('0x2'));var express=require(_0xbb67('0x3'));var router=express[_0xbb67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb67('0x5'));var interaction=require(_0xbb67('0x6'));var config=require(_0xbb67('0x7'));var controller=require(_0xbb67('0x8'));router[_0xbb67('0x9')]('/',auth[_0xbb67('0xa')](),controller[_0xbb67('0xb')]);router['get'](_0xbb67('0xc'),auth[_0xbb67('0xa')](),controller['describe']);router['get'](_0xbb67('0xd'),auth[_0xbb67('0xa')](),controller[_0xbb67('0xe')]);router[_0xbb67('0xf')]('/',auth[_0xbb67('0xa')](),interaction[_0xbb67('0x10')](_0xbb67('0x11'),_0xbb67('0x12')),controller[_0xbb67('0x13')]);router[_0xbb67('0xf')]('/:id/status',controller[_0xbb67('0x14')]);router[_0xbb67('0x15')](_0xbb67('0xd'),auth[_0xbb67('0xa')](),controller[_0xbb67('0x16')]);router[_0xbb67('0x15')](_0xbb67('0x17'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xbb67('0x18'),auth['isAuthenticated'](),controller[_0xbb67('0x19')]);router[_0xbb67('0x1a')](_0xbb67('0xd'),auth[_0xbb67('0xa')](),controller['destroy']);module[_0xbb67('0x1b')]=router; \ No newline at end of file +var _0x1e39=['put','update','/:id/accept','reject','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status'];(function(_0x4a457d,_0x436b25){var _0x42ccd1=function(_0x3cf40d){while(--_0x3cf40d){_0x4a457d['push'](_0x4a457d['shift']());}};_0x42ccd1(++_0x436b25);}(_0x1e39,0xc2));var _0x91e3=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0x1e39[_0x1fcf1b];return _0x5d2952;};'use strict';var multer=require('multer');var util=require(_0x91e3('0x0'));var path=require(_0x91e3('0x1'));var timeout=require(_0x91e3('0x2'));var express=require(_0x91e3('0x3'));var router=express['Router']();var fs_extra=require(_0x91e3('0x4'));var auth=require(_0x91e3('0x5'));var interaction=require(_0x91e3('0x6'));var config=require('../../config/environment');var controller=require(_0x91e3('0x7'));router[_0x91e3('0x8')]('/',auth[_0x91e3('0x9')](),controller[_0x91e3('0xa')]);router[_0x91e3('0x8')](_0x91e3('0xb'),auth[_0x91e3('0x9')](),controller[_0x91e3('0xc')]);router[_0x91e3('0x8')](_0x91e3('0xd'),auth[_0x91e3('0x9')](),controller[_0x91e3('0xe')]);router[_0x91e3('0xf')]('/',auth[_0x91e3('0x9')](),interaction[_0x91e3('0x10')](_0x91e3('0x11'),_0x91e3('0x12')),controller[_0x91e3('0x13')]);router[_0x91e3('0xf')](_0x91e3('0x14'),controller[_0x91e3('0x15')]);router[_0x91e3('0x16')](_0x91e3('0xd'),auth[_0x91e3('0x9')](),controller[_0x91e3('0x17')]);router[_0x91e3('0x16')](_0x91e3('0x18'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0x91e3('0x9')](),controller[_0x91e3('0x19')]);router[_0x91e3('0x1a')](_0x91e3('0xd'),auth['isAuthenticated'](),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 3fa0988..7769fde 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 _0x4105=['DATE','TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0x4105,0x10a));var _0x5410=function(_0x3ca689,_0x1be8c5){_0x3ca689=_0x3ca689-0x0;var _0x3323ee=_0x4105[_0x3ca689];return _0x3323ee;};'use strict';var Sequelize=require(_0x5410('0x0'));module[_0x5410('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5410('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5410('0x3')]('in',_0x5410('0x4')),'defaultValue':_0x5410('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5410('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5410('0x5')]},'readAt':{'type':Sequelize[_0x5410('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5410('0x5')]},'providerResponse':{'type':Sequelize[_0x5410('0x7')]}}; \ No newline at end of file +var _0xfd4c=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x58d5a3,_0x1a2f5a){var _0x597721=function(_0x433027){while(--_0x433027){_0x58d5a3['push'](_0x58d5a3['shift']());}};_0x597721(++_0x1a2f5a);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x4f00d5,_0x1213c7){_0x4f00d5=_0x4f00d5-0x0;var _0xafcdc=_0xfd4c[_0x4f00d5];return _0xafcdc;};'use strict';var Sequelize=require(_0xcfd4('0x0'));module[_0xcfd4('0x1')]={'body':{'type':Sequelize['TEXT'](_0xcfd4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcfd4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcfd4('0x4')]('in',_0xcfd4('0x5')),'defaultValue':_0xcfd4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xcfd4('0x6')]},'readAt':{'type':Sequelize[_0xcfd4('0x7')]},'secret':{'type':Sequelize[_0xcfd4('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcfd4('0x6')]},'providerResponse':{'type':Sequelize[_0xcfd4('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 65a5216..a999a7c 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 _0x2041=['request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','find','create','body','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2041,0x10d));var _0x1204=function(_0x8cebb5,_0x571998){_0x8cebb5=_0x8cebb5-0x0;var _0x2860e6=_0x2041[_0x8cebb5];return _0x2860e6;};'use strict';var emlformat=require(_0x1204('0x0'));var rimraf=require(_0x1204('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1204('0x2'));var rp=require(_0x1204('0x3'));var moment=require(_0x1204('0x4'));var BPromise=require(_0x1204('0x5'));var Mustache=require('mustache');var util=require(_0x1204('0x6'));var path=require(_0x1204('0x7'));var sox=require(_0x1204('0x8'));var csv=require(_0x1204('0x9'));var ejs=require(_0x1204('0xa'));var fs=require('fs');var fs_extra=require(_0x1204('0xb'));var _=require(_0x1204('0xc'));var squel=require(_0x1204('0xd'));var crypto=require(_0x1204('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1204('0xf'));var toCsv=require(_0x1204('0x9'));var querystring=require(_0x1204('0x10'));var Papa=require(_0x1204('0x11'));var Redis=require(_0x1204('0x12'));var authService=require(_0x1204('0x13'));var qs=require(_0x1204('0x14'));var as=require(_0x1204('0x15'));var hardwareService=require(_0x1204('0x16'));var logger=require(_0x1204('0x17'))(_0x1204('0x18'));var utils=require(_0x1204('0x19'));var config=require(_0x1204('0x1a'));var licenseUtil=require(_0x1204('0x1b'));var db=require(_0x1204('0x1c'))['db'];config['redis']=_[_0x1204('0x1d')](config[_0x1204('0x1e')],{'host':_0x1204('0x1f'),'port':0x18eb});var socket=require(_0x1204('0x20'))(new Redis(config[_0x1204('0x1e')]));require('./smsMessage.socket')[_0x1204('0x21')](socket);var jayson=require(_0x1204('0x22'));var client=jayson[_0x1204('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x1204('0x23')][_0x1204('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x340f04,_0x353bbd,_0x32b798,_0x25ac0f){return new BPromise(function(_0x313e46,_0x5d801f){var _0x5f5dfc=_0x25ac0f||client;return _0x5f5dfc[_0x1204('0x25')](_0x340f04,_0x32b798)['then'](function(_0x268341){logger[_0x1204('0x26')](_0x1204('0x27'),_0x353bbd,'request\x20sent');logger[_0x1204('0x28')](_0x1204('0x29'),_0x353bbd,'request\x20sent',JSON[_0x1204('0x2a')](_0x268341));if(_0x268341[_0x1204('0x2b')]){if(_0x268341[_0x1204('0x2b')]['code']===0x1f4){logger[_0x1204('0x2b')](_0x1204('0x27'),_0x353bbd,_0x268341[_0x1204('0x2b')]['message']);return _0x5d801f(_0x268341['error'][_0x1204('0x2c')]);}logger['error'](_0x1204('0x27'),_0x353bbd,_0x268341[_0x1204('0x2b')]['message']);return _0x313e46(_0x268341[_0x1204('0x2b')]['message']);}else{logger['info'](_0x1204('0x27'),_0x353bbd,_0x1204('0x2d'));_0x313e46(_0x268341[_0x1204('0x2e')][_0x1204('0x2c')]);}})[_0x1204('0x2f')](function(_0x15a345){logger['error'](_0x1204('0x27'),_0x353bbd,_0x15a345);_0x5d801f(_0x15a345);});});}function respondWithStatusCode(_0x4560ca,_0x212119){_0x212119=_0x212119||0xcc;return function(_0x14ae21){if(_0x14ae21){return _0x4560ca[_0x1204('0x30')](_0x212119);}return _0x4560ca[_0x1204('0x31')](_0x212119)[_0x1204('0x32')]();};}function respondWithResult(_0x489ee1,_0x4e86f9){_0x4e86f9=_0x4e86f9||0xc8;return function(_0x217be6){if(_0x217be6){return _0x489ee1[_0x1204('0x31')](_0x4e86f9)['json'](_0x217be6);}};}function respondWithFilteredResult(_0xa26f89,_0xc013af){return function(_0x102ba7){if(_0x102ba7){var _0xbf433b=typeof _0xc013af[_0x1204('0x33')]===_0x1204('0x34')&&typeof _0xc013af[_0x1204('0x35')]==='undefined';var _0xfdc63d=_0x102ba7[_0x1204('0x36')];var _0x328f25=_0xbf433b?0x0:_0xc013af[_0x1204('0x33')];var _0x38dc9a=_0xbf433b?_0x102ba7[_0x1204('0x36')]:_0xc013af[_0x1204('0x33')]+_0xc013af[_0x1204('0x35')];var _0x58a32f;if(_0x38dc9a>=_0xfdc63d){_0x38dc9a=_0xfdc63d;_0x58a32f=0xc8;}else{_0x58a32f=0xce;}_0xa26f89[_0x1204('0x31')](_0x58a32f);return _0xa26f89['set'](_0x1204('0x37'),_0x328f25+'-'+_0x38dc9a+'/'+_0xfdc63d)[_0x1204('0x38')](_0x102ba7);}return null;};}function patchUpdates(_0x56b69c){return function(_0x1be217){try{jsonpatch[_0x1204('0x39')](_0x1be217,_0x56b69c,!![]);}catch(_0x1c9c52){return BPromise[_0x1204('0x3a')](_0x1c9c52);}return _0x1be217['save']();};}function saveUpdates(_0x3aec29,_0x54a283){return function(_0x57c349){if(_0x57c349){return _0x57c349[_0x1204('0x3b')](_0x3aec29)[_0x1204('0x3c')](function(_0x4ab95e){return _0x4ab95e;});}return null;};}function removeEntity(_0x3be9da,_0x4e7dac){return function(_0x3d3bd4){if(_0x3d3bd4){return _0x3d3bd4[_0x1204('0x3d')]()[_0x1204('0x3c')](function(){_0x3be9da[_0x1204('0x31')](0xcc)[_0x1204('0x32')]();});}};}function handleEntityNotFound(_0x337370,_0x225dca){return function(_0x1c86b4){if(!_0x1c86b4){_0x337370[_0x1204('0x30')](0x194);}return _0x1c86b4;};}function handleError(_0x46873d,_0x20d655){_0x20d655=_0x20d655||0x1f4;return function(_0x462ae8){logger[_0x1204('0x2b')](_0x462ae8[_0x1204('0x3e')]);if(_0x462ae8[_0x1204('0x3f')]){delete _0x462ae8[_0x1204('0x3f')];}_0x46873d[_0x1204('0x31')](_0x20d655)[_0x1204('0x40')](_0x462ae8);};}exports['index']=function(_0x32abb0,_0xfda2a7){var _0x2bb83a={},_0x44c4be={},_0x4f4997={'count':0x0,'rows':[]};var _0xf3e1f3=_['map'](db[_0x1204('0x41')][_0x1204('0x42')],function(_0x321d32){return{'name':_0x321d32[_0x1204('0x43')],'type':_0x321d32[_0x1204('0x44')][_0x1204('0x45')]};});_0x44c4be[_0x1204('0x46')]=_[_0x1204('0x47')](_0xf3e1f3,_0x1204('0x3f'));_0x44c4be[_0x1204('0x48')]=_[_0x1204('0x49')](_0x32abb0[_0x1204('0x48')]);_0x44c4be['filters']=_[_0x1204('0x4a')](_0x44c4be[_0x1204('0x46')],_0x44c4be[_0x1204('0x48')]);_0x2bb83a['attributes']=_[_0x1204('0x4a')](_0x44c4be['model'],qs[_0x1204('0x4b')](_0x32abb0[_0x1204('0x48')]['fields']));_0x2bb83a[_0x1204('0x4c')]=_0x2bb83a['attributes']['length']?_0x2bb83a[_0x1204('0x4c')]:_0x44c4be[_0x1204('0x46')];if(!_0x32abb0[_0x1204('0x48')][_0x1204('0x4d')]('nolimit')){_0x2bb83a[_0x1204('0x35')]=qs['limit'](_0x32abb0[_0x1204('0x48')][_0x1204('0x35')]);_0x2bb83a[_0x1204('0x33')]=qs['offset'](_0x32abb0[_0x1204('0x48')][_0x1204('0x33')]);}_0x2bb83a[_0x1204('0x4e')]=qs['sort'](_0x32abb0[_0x1204('0x48')]['sort']);_0x2bb83a['where']=qs[_0x1204('0x4f')](_[_0x1204('0x50')](_0x32abb0[_0x1204('0x48')],_0x44c4be[_0x1204('0x4f')]),_0xf3e1f3);if(_0x32abb0['query'][_0x1204('0x51')]){_0x2bb83a[_0x1204('0x52')]=_[_0x1204('0x53')](_0x2bb83a[_0x1204('0x52')],{'$or':_[_0x1204('0x47')](_0xf3e1f3,function(_0x59ebec){if(_0x59ebec[_0x1204('0x44')]!==_0x1204('0x54')){var _0x1fc406={};_0x1fc406[_0x59ebec[_0x1204('0x3f')]]={'$like':'%'+_0x32abb0[_0x1204('0x48')][_0x1204('0x51')]+'%'};return _0x1fc406;}})});}_0x2bb83a=_[_0x1204('0x53')]({},_0x2bb83a,_0x32abb0['options']);var _0x3c2848={'where':_0x2bb83a['where']};return db[_0x1204('0x41')][_0x1204('0x36')](_0x3c2848)[_0x1204('0x3c')](function(_0x490185){_0x4f4997[_0x1204('0x36')]=_0x490185;if(_0x32abb0[_0x1204('0x48')][_0x1204('0x55')]){_0x2bb83a['include']=[{'all':!![]}];}return db[_0x1204('0x41')][_0x1204('0x56')](_0x2bb83a);})['then'](function(_0x5814c0){_0x4f4997[_0x1204('0x57')]=_0x5814c0;return _0x4f4997;})[_0x1204('0x3c')](respondWithFilteredResult(_0xfda2a7,_0x2bb83a))[_0x1204('0x2f')](handleError(_0xfda2a7,null));};exports[_0x1204('0x58')]=function(_0x38072d,_0x1b3583){var _0x24a05a={'raw':!![],'where':{'id':_0x38072d[_0x1204('0x59')]['id']}},_0x485ee8={};_0x485ee8[_0x1204('0x46')]=_[_0x1204('0x49')](db[_0x1204('0x41')][_0x1204('0x42')]);_0x485ee8['query']=_[_0x1204('0x49')](_0x38072d[_0x1204('0x48')]);_0x485ee8[_0x1204('0x4f')]=_[_0x1204('0x4a')](_0x485ee8[_0x1204('0x46')],_0x485ee8[_0x1204('0x48')]);_0x24a05a['attributes']=_[_0x1204('0x4a')](_0x485ee8[_0x1204('0x46')],qs[_0x1204('0x4b')](_0x38072d[_0x1204('0x48')][_0x1204('0x4b')]));_0x24a05a[_0x1204('0x4c')]=_0x24a05a[_0x1204('0x4c')]['length']?_0x24a05a['attributes']:_0x485ee8['model'];if(_0x38072d['query']['includeAll']){_0x24a05a[_0x1204('0x5a')]=[{'all':!![]}];}_0x24a05a=_[_0x1204('0x53')]({},_0x24a05a,_0x38072d['options']);return db[_0x1204('0x41')][_0x1204('0x5b')](_0x24a05a)[_0x1204('0x3c')](handleEntityNotFound(_0x1b3583,null))[_0x1204('0x3c')](respondWithResult(_0x1b3583,null))[_0x1204('0x2f')](handleError(_0x1b3583,null));};exports[_0x1204('0x5c')]=function(_0x50cdbd,_0x5b78b2){return db['SmsMessage']['create'](_0x50cdbd[_0x1204('0x5d')],{})[_0x1204('0x3c')](respondWithResult(_0x5b78b2,0xc9))['catch'](handleError(_0x5b78b2,null));};exports[_0x1204('0x3b')]=function(_0x343864,_0x29db89){if(_0x343864[_0x1204('0x5d')]['id']){delete _0x343864['body']['id'];}return db['SmsMessage'][_0x1204('0x5b')]({'where':{'id':_0x343864[_0x1204('0x59')]['id']}})[_0x1204('0x3c')](handleEntityNotFound(_0x29db89,null))[_0x1204('0x3c')](saveUpdates(_0x343864[_0x1204('0x5d')],null))[_0x1204('0x3c')](respondWithResult(_0x29db89,null))[_0x1204('0x2f')](handleError(_0x29db89,null));};exports[_0x1204('0x3d')]=function(_0x527bc2,_0x371cf5){return db[_0x1204('0x41')]['find']({'where':{'id':_0x527bc2[_0x1204('0x59')]['id']}})[_0x1204('0x3c')](handleEntityNotFound(_0x371cf5,null))[_0x1204('0x3c')](removeEntity(_0x371cf5,null))[_0x1204('0x2f')](handleError(_0x371cf5,null));};exports['describe']=function(_0x4442d0,_0x14507f){return db['SmsMessage'][_0x1204('0x5e')]()[_0x1204('0x3c')](respondWithResult(_0x14507f,null))[_0x1204('0x2f')](handleError(_0x14507f,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x1204('0x5f')]=function(_0xc5548a,_0x154dfc,_0x443755){var _0x4e6df3={'agent':{},'channel':_0x1204('0x60')};if(_0xc5548a[_0x1204('0x5d')]['id']){delete _0xc5548a['body']['id'];}_0xc5548a['body'][_0x1204('0x61')]=!![];_0xc5548a[_0x1204('0x5d')][_0x1204('0x62')]=moment()[_0x1204('0x63')](_0x1204('0x64'));_0xc5548a[_0x1204('0x5d')][_0x1204('0x65')]=_0xc5548a['body']['UserId']||_0xc5548a[_0x1204('0x66')]['id'];_0x4e6df3[_0x1204('0x67')]['id']=_0xc5548a[_0x1204('0x5d')][_0x1204('0x65')];return db[_0x1204('0x41')][_0x1204('0x5b')]({'where':{'id':_0xc5548a[_0x1204('0x59')]['id'],'UserId':null}})[_0x1204('0x3c')](handleEntityNotFound(_0x154dfc,null))[_0x1204('0x3c')](saveUpdates(_0xc5548a[_0x1204('0x5d')],null))[_0x1204('0x3c')](function(_0x3afad0){if(_0x3afad0){_0x4e6df3[_0x1204('0x2c')]=_0x3afad0['get']({'plain':!![]});return db[_0x1204('0x68')][_0x1204('0x5b')]({'where':{'id':_0x3afad0[_0x1204('0x69')]}});}return null;})[_0x1204('0x3c')](handleEntityNotFound(_0x154dfc,null))[_0x1204('0x3c')](function(_0x3c55d8){if(_0x3c55d8){return _0x3c55d8['update']({'UserId':_0xc5548a['body'][_0x1204('0x65')],'read1stAt':_[_0x1204('0x6a')](_0x3c55d8[_0x1204('0x6b')])?moment()[_0x1204('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1204('0x3c')](function(_0x1c830c){if(_0x1c830c){_0x4e6df3[_0x1204('0x6c')]=_0x1c830c[_0x1204('0x6d')]({'plain':!![]});interaction_log['info'](_0x1204('0x6e'),_0xc5548a[_0x1204('0x66')]['id'],_0xc5548a[_0x1204('0x66')][_0x1204('0x3f')],_0xc5548a['user']['role'],_0x4e6df3[_0x1204('0x6c')]['id'],_0xc5548a[_0x1204('0x5d')]?JSON['stringify'](_0xc5548a['body']):_0x1204('0x6f'));return respondWithRpcPromise(_0x1204('0x70'),'acceptMessage',_0x4e6df3);}return null;})[_0x1204('0x3c')](function(_0x218706){var _0x519a8c=_0x1204('0x71')+_0x218706[_0x1204('0x2c')]['ContactId'];return db[_0x1204('0x72')][_0x1204('0x48')](_0x519a8c,{'type':db[_0x1204('0x73')][_0x1204('0x74')][_0x1204('0x75')],'raw':!![]})[_0x1204('0x3c')](function(_0x37b3e5){return _0x37b3e5;});})['then'](function(_0x1e6da5){if(_0x1e6da5){_0x4e6df3[_0x1204('0x2c')][_0x1204('0x76')]=_0x1e6da5[0x0];if(!_0xc5548a[_0x1204('0x5d')]['UserId'])return;return db[_0x1204('0x77')][_0x1204('0x5b')]({'where':{'id':_0xc5548a[_0x1204('0x5d')][_0x1204('0x65')],'role':_0x1204('0x67')},'attributes':['id',_0x1204('0x3f'),_0x1204('0x78'),_0x1204('0x79'),_0x1204('0x7a')],'raw':!![]});}return null;})[_0x1204('0x3c')](function(_0x3c43da){if(!_0x3c43da)return null;_0x4e6df3[_0x1204('0x2c')][_0x1204('0x67')]=_0x3c43da;return _0x4e6df3;})[_0x1204('0x3c')](function(_0x53175c){if(_0x53175c){if(_0xc5548a[_0x1204('0x5d')][_0x1204('0x7b')]){_0x4e6df3['message'][_0x1204('0x7c')]=util[_0x1204('0x63')]('SIP/%s',_0xc5548a[_0x1204('0x66')][_0x1204('0x3f')]);_0x4e6df3['message'][_0x1204('0x7d')]=_0x4e6df3[_0x1204('0x7d')];_0x4e6df3[_0x1204('0x2c')]['motionChannel']=_0x4e6df3['channel'];_0x4e6df3[_0x1204('0x2c')]['event']=_0x1204('0x5f');return respondWithRpcPromise('EventManager',_0x1204('0x7e'),{'event':_0x1204('0x7f'),'message':_0x4e6df3['message']},client9002)['then'](function(){return _0x4e6df3;});}return _0x4e6df3;}return null;})[_0x1204('0x3c')](respondWithResult(_0x154dfc,null))[_0x1204('0x2f')](handleError(_0x154dfc,null));};var interaction_log=require(_0x1204('0x17'))(_0x1204('0x80'));exports[_0x1204('0x3a')]=function(_0x48fbe2,_0x22361a,_0x1d8bc3){var _0x43ae64={'agent':{},'channel':'sms'};if(_0x48fbe2[_0x1204('0x5d')]['id']){delete _0x48fbe2['body']['id'];}_0x48fbe2['body'][_0x1204('0x65')]=_0x48fbe2['body']['UserId']||_0x48fbe2['user']['id'];_0x43ae64[_0x1204('0x67')]['id']=_0x48fbe2['body'][_0x1204('0x65')];return db[_0x1204('0x41')]['find']({'where':{'id':_0x48fbe2[_0x1204('0x59')]['id'],'UserId':null}})[_0x1204('0x3c')](handleEntityNotFound(_0x22361a,null))['then'](function(_0x115c92){if(_0x115c92){_0x43ae64[_0x1204('0x2c')]=_0x115c92[_0x1204('0x6d')]({'plain':!![]});return db['SmsInteraction'][_0x1204('0x5b')]({'where':{'id':_0x115c92[_0x1204('0x69')]}});}return null;})[_0x1204('0x3c')](handleEntityNotFound(_0x22361a,null))[_0x1204('0x3c')](function(_0x45b37d){if(_0x45b37d){_0x43ae64[_0x1204('0x6c')]=_0x45b37d['get']({'plain':!![]});interaction_log[_0x1204('0x26')](_0x1204('0x81'),_0x48fbe2['user']['id'],_0x48fbe2['user'][_0x1204('0x3f')],_0x48fbe2[_0x1204('0x66')][_0x1204('0x82')],_0x43ae64[_0x1204('0x6c')]['id'],_0x48fbe2[_0x1204('0x5d')]?JSON[_0x1204('0x2a')](_0x48fbe2['body']):'null');return respondWithRpcPromise(_0x1204('0x83'),'rejectMessage',_0x43ae64);}return null;})[_0x1204('0x3c')](function(_0xce47dc){var _0x2f539c=_0x1204('0x71')+_0xce47dc[_0x1204('0x2c')][_0x1204('0x84')];return db[_0x1204('0x72')]['query'](_0x2f539c,{'type':db['Sequelize'][_0x1204('0x74')][_0x1204('0x75')],'raw':!![]})[_0x1204('0x3c')](function(_0x1e584e){return _0x1e584e;});})['then'](function(_0x15b05f){if(_0x15b05f){_0x43ae64[_0x1204('0x2c')][_0x1204('0x76')]=_0x15b05f[0x0];if(!_0x48fbe2[_0x1204('0x5d')][_0x1204('0x65')])return;return db['User']['find']({'where':{'id':_0x48fbe2['body'][_0x1204('0x65')],'role':_0x1204('0x67')},'attributes':['id','name',_0x1204('0x78'),'email',_0x1204('0x7a')],'raw':!![]});}return null;})['then'](function(_0x48fb9a){if(!_0x48fb9a)return null;_0x43ae64[_0x1204('0x2c')]['agent']=_0x48fb9a;return _0x43ae64;})[_0x1204('0x3c')](function(_0x2ca8f0){if(_0x2ca8f0){_0x2ca8f0['message'][_0x1204('0x7c')]=util[_0x1204('0x63')](_0x1204('0x85'),_0x48fbe2[_0x1204('0x66')][_0x1204('0x3f')]);_0x2ca8f0[_0x1204('0x2c')][_0x1204('0x7d')]=_0x43ae64[_0x1204('0x7d')];_0x2ca8f0['message']['motionChannel']=_0x43ae64[_0x1204('0x7d')];_0x2ca8f0[_0x1204('0x2c')]['event']=_0x1204('0x3a');respondWithRpcPromise(_0x1204('0x7e'),_0x1204('0x7e'),{'event':_0x1204('0x86'),'message':_0x2ca8f0['message']},client9002);return _0x43ae64;}return null;})[_0x1204('0x3c')](respondWithResult(_0x22361a,null))['catch'](handleError(_0x22361a,null));};exports[_0x1204('0x31')]=function(_0x526e22,_0x40d122,_0x14a372){if(_0x526e22[_0x1204('0x5d')]['id']){delete _0x526e22['body']['id'];}var _0x2605f3;return db['SmsMessage'][_0x1204('0x5b')]({'where':{'id':_0x526e22['params']['id']}})[_0x1204('0x3c')](handleEntityNotFound(_0x40d122,null))['then'](function(_0x5c5c77){if(_0x5c5c77){_0x2605f3=_0x5c5c77;return db[_0x1204('0x87')][_0x1204('0x5b')]({'where':{'id':_0x5c5c77[_0x1204('0x88')]}});}})[_0x1204('0x3c')](handleEntityNotFound(_0x40d122,null))[_0x1204('0x3c')](function(_0x34a275){if(_0x34a275){logger['debug'](_0x1204('0x29'),_0x1204('0x31'),_0x1204('0x89'),_0x34a275[_0x1204('0x44')],util[_0x1204('0x8a')](_0x526e22[_0x1204('0x5d')],{'showHidden':![],'depth':null}));switch(_0x34a275[_0x1204('0x44')]){case'twilio':if(_0x526e22[_0x1204('0x5d')][_0x1204('0x8b')]&&_0x526e22['body'][_0x1204('0x8b')]===_0x2605f3[_0x1204('0x8c')]){return _0x2605f3[_0x1204('0x3b')]({'read':!![]});}else{logger[_0x1204('0x2b')](_0x1204('0x8d'),_0x1204('0x31'),_0x1204('0x8e'),util[_0x1204('0x8a')](_0x526e22['body'],{'showHidden':![],'depth':null}));}break;case _0x1204('0x8f'):if(_0x526e22[_0x1204('0x5d')][_0x1204('0x90')]&&_0x526e22['body'][_0x1204('0x90')]===_0x2605f3[_0x1204('0x8c')]&&_[_0x1204('0x91')]([_0x1204('0x92'),_0x1204('0x93')],_0x526e22[_0x1204('0x5d')][_0x1204('0x94')])>=0x0){return _0x2605f3[_0x1204('0x3b')]({'read':!![]});}else{logger[_0x1204('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1204('0x31'),_0x1204('0x95'),util['inspect'](_0x526e22[_0x1204('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1204('0x96'):var _0x156325=_0x526e22[_0x1204('0x5d')]['results'][0x0];if(_0x156325[_0x1204('0x31')][_0x1204('0x97')]===_0x1204('0x98')){return _0x2605f3['update']({'read':!![]});}else{logger[_0x1204('0x2b')](_0x1204('0x8d'),_0x1204('0x31'),_0x1204('0x96'),util[_0x1204('0x8a')](_0x526e22['body'],{'showHidden':![],'depth':null}));}break;}return _0x2605f3;}})[_0x1204('0x3c')](respondWithResult(_0x40d122,null))[_0x1204('0x2f')](handleError(_0x40d122,null));}; \ No newline at end of file +var _0x26b0=['rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','name','index','map','SmsMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','QueryTypes','contact','email'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x26b0,0x138));var _0x026b=function(_0x32ca62,_0x18fe6a){_0x32ca62=_0x32ca62-0x0;var _0x175d88=_0x26b0[_0x32ca62];return _0x175d88;};'use strict';var emlformat=require(_0x026b('0x0'));var rimraf=require(_0x026b('0x1'));var zipdir=require(_0x026b('0x2'));var jsonpatch=require(_0x026b('0x3'));var rp=require(_0x026b('0x4'));var moment=require(_0x026b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x026b('0x6'));var util=require(_0x026b('0x7'));var path=require(_0x026b('0x8'));var sox=require(_0x026b('0x9'));var csv=require(_0x026b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x026b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x026b('0xc'));var deskjs=require(_0x026b('0xd'));var toCsv=require(_0x026b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x026b('0xe'));var authService=require(_0x026b('0xf'));var qs=require(_0x026b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x026b('0x11'));var logger=require(_0x026b('0x12'))(_0x026b('0x13'));var utils=require(_0x026b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x026b('0x15'));var db=require(_0x026b('0x16'))['db'];config[_0x026b('0x17')]=_[_0x026b('0x18')](config[_0x026b('0x17')],{'host':_0x026b('0x19'),'port':0x18eb});var socket=require(_0x026b('0x1a'))(new Redis(config['redis']));require(_0x026b('0x1b'))['register'](socket);var jayson=require(_0x026b('0x1c'));var client=jayson[_0x026b('0x1d')][_0x026b('0x1e')]({'port':0x232c});var client9002=jayson[_0x026b('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250697,_0x1956a4,_0xe8d12,_0x4c0fca){return new BPromise(function(_0x5117f3,_0x4bd1ff){var _0x43b1a8=_0x4c0fca||client;return _0x43b1a8['request'](_0x250697,_0xe8d12)['then'](function(_0xbb0e24){logger['info'](_0x026b('0x1f'),_0x1956a4,_0x026b('0x20'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1956a4,_0x026b('0x20'),JSON[_0x026b('0x21')](_0xbb0e24));if(_0xbb0e24[_0x026b('0x22')]){if(_0xbb0e24[_0x026b('0x22')][_0x026b('0x23')]===0x1f4){logger['error'](_0x026b('0x1f'),_0x1956a4,_0xbb0e24[_0x026b('0x22')][_0x026b('0x24')]);return _0x4bd1ff(_0xbb0e24['error'][_0x026b('0x24')]);}logger[_0x026b('0x22')](_0x026b('0x1f'),_0x1956a4,_0xbb0e24[_0x026b('0x22')][_0x026b('0x24')]);return _0x5117f3(_0xbb0e24['error'][_0x026b('0x24')]);}else{logger[_0x026b('0x25')](_0x026b('0x1f'),_0x1956a4,_0x026b('0x20'));_0x5117f3(_0xbb0e24[_0x026b('0x26')][_0x026b('0x24')]);}})['catch'](function(_0x4b42b9){logger[_0x026b('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1956a4,_0x4b42b9);_0x4bd1ff(_0x4b42b9);});});}function respondWithStatusCode(_0x27cb59,_0x19b1dc){_0x19b1dc=_0x19b1dc||0xcc;return function(_0x39f344){if(_0x39f344){return _0x27cb59['sendStatus'](_0x19b1dc);}return _0x27cb59['status'](_0x19b1dc)[_0x026b('0x27')]();};}function respondWithResult(_0x3f3999,_0x472191){_0x472191=_0x472191||0xc8;return function(_0x382e51){if(_0x382e51){return _0x3f3999[_0x026b('0x28')](_0x472191)['json'](_0x382e51);}};}function respondWithFilteredResult(_0x2ab365,_0x335463){return function(_0x464667){if(_0x464667){var _0x2bb89f=typeof _0x335463['offset']===_0x026b('0x29')&&typeof _0x335463[_0x026b('0x2a')]==='undefined';var _0x59e9b2=_0x464667[_0x026b('0x2b')];var _0x34fbba=_0x2bb89f?0x0:_0x335463['offset'];var _0x5b9edf=_0x2bb89f?_0x464667['count']:_0x335463[_0x026b('0x2c')]+_0x335463['limit'];var _0x33590f;if(_0x5b9edf>=_0x59e9b2){_0x5b9edf=_0x59e9b2;_0x33590f=0xc8;}else{_0x33590f=0xce;}_0x2ab365[_0x026b('0x28')](_0x33590f);return _0x2ab365[_0x026b('0x2d')](_0x026b('0x2e'),_0x34fbba+'-'+_0x5b9edf+'/'+_0x59e9b2)[_0x026b('0x2f')](_0x464667);}return null;};}function patchUpdates(_0x17bc65){return function(_0x421f43){try{jsonpatch['apply'](_0x421f43,_0x17bc65,!![]);}catch(_0x2d8002){return BPromise[_0x026b('0x30')](_0x2d8002);}return _0x421f43[_0x026b('0x31')]();};}function saveUpdates(_0x5a3781,_0x54df5a){return function(_0x283a18){if(_0x283a18){return _0x283a18[_0x026b('0x32')](_0x5a3781)[_0x026b('0x33')](function(_0x25e02c){return _0x25e02c;});}return null;};}function removeEntity(_0x48fe1c,_0x22d5c6){return function(_0x3ee3dd){if(_0x3ee3dd){return _0x3ee3dd[_0x026b('0x34')]()[_0x026b('0x33')](function(){_0x48fe1c['status'](0xcc)[_0x026b('0x27')]();});}};}function handleEntityNotFound(_0xa3adae,_0x685abe){return function(_0x163dff){if(!_0x163dff){_0xa3adae[_0x026b('0x35')](0x194);}return _0x163dff;};}function handleError(_0xab6df2,_0x862d33){_0x862d33=_0x862d33||0x1f4;return function(_0x339b59){logger[_0x026b('0x22')](_0x339b59['stack']);if(_0x339b59[_0x026b('0x36')]){delete _0x339b59[_0x026b('0x36')];}_0xab6df2[_0x026b('0x28')](_0x862d33)['send'](_0x339b59);};}exports[_0x026b('0x37')]=function(_0x1105cf,_0x3c8d55){var _0x30e072={},_0x27e29d={},_0x400c6f={'count':0x0,'rows':[]};var _0x5bb124=_[_0x026b('0x38')](db[_0x026b('0x39')][_0x026b('0x3a')],function(_0x5811e7){return{'name':_0x5811e7['fieldName'],'type':_0x5811e7[_0x026b('0x3b')]['key']};});_0x27e29d[_0x026b('0x3c')]=_['map'](_0x5bb124,_0x026b('0x36'));_0x27e29d[_0x026b('0x3d')]=_[_0x026b('0x3e')](_0x1105cf[_0x026b('0x3d')]);_0x27e29d['filters']=_[_0x026b('0x3f')](_0x27e29d[_0x026b('0x3c')],_0x27e29d[_0x026b('0x3d')]);_0x30e072[_0x026b('0x40')]=_['intersection'](_0x27e29d[_0x026b('0x3c')],qs[_0x026b('0x41')](_0x1105cf[_0x026b('0x3d')]['fields']));_0x30e072[_0x026b('0x40')]=_0x30e072[_0x026b('0x40')][_0x026b('0x42')]?_0x30e072[_0x026b('0x40')]:_0x27e29d[_0x026b('0x3c')];if(!_0x1105cf[_0x026b('0x3d')][_0x026b('0x43')]('nolimit')){_0x30e072[_0x026b('0x2a')]=qs[_0x026b('0x2a')](_0x1105cf[_0x026b('0x3d')][_0x026b('0x2a')]);_0x30e072[_0x026b('0x2c')]=qs[_0x026b('0x2c')](_0x1105cf[_0x026b('0x3d')]['offset']);}_0x30e072['order']=qs[_0x026b('0x44')](_0x1105cf['query'][_0x026b('0x44')]);_0x30e072['where']=qs[_0x026b('0x45')](_[_0x026b('0x46')](_0x1105cf[_0x026b('0x3d')],_0x27e29d[_0x026b('0x45')]),_0x5bb124);if(_0x1105cf[_0x026b('0x3d')][_0x026b('0x47')]){_0x30e072['where']=_['merge'](_0x30e072[_0x026b('0x48')],{'$or':_[_0x026b('0x38')](_0x5bb124,function(_0x300660){if(_0x300660[_0x026b('0x3b')]!==_0x026b('0x49')){var _0x197847={};_0x197847[_0x300660['name']]={'$like':'%'+_0x1105cf[_0x026b('0x3d')][_0x026b('0x47')]+'%'};return _0x197847;}})});}_0x30e072=_[_0x026b('0x4a')]({},_0x30e072,_0x1105cf[_0x026b('0x4b')]);var _0x4eb458={'where':_0x30e072[_0x026b('0x48')]};return db[_0x026b('0x39')]['count'](_0x4eb458)[_0x026b('0x33')](function(_0x1773eb){_0x400c6f[_0x026b('0x2b')]=_0x1773eb;if(_0x1105cf['query'][_0x026b('0x4c')]){_0x30e072[_0x026b('0x4d')]=[{'all':!![]}];}return db[_0x026b('0x39')][_0x026b('0x4e')](_0x30e072);})[_0x026b('0x33')](function(_0x50ef6f){_0x400c6f[_0x026b('0x4f')]=_0x50ef6f;return _0x400c6f;})[_0x026b('0x33')](respondWithFilteredResult(_0x3c8d55,_0x30e072))[_0x026b('0x50')](handleError(_0x3c8d55,null));};exports['show']=function(_0x43b296,_0x4a3028){var _0x40d424={'raw':!![],'where':{'id':_0x43b296[_0x026b('0x51')]['id']}},_0x2ccc79={};_0x2ccc79[_0x026b('0x3c')]=_[_0x026b('0x3e')](db[_0x026b('0x39')][_0x026b('0x3a')]);_0x2ccc79[_0x026b('0x3d')]=_[_0x026b('0x3e')](_0x43b296[_0x026b('0x3d')]);_0x2ccc79['filters']=_[_0x026b('0x3f')](_0x2ccc79[_0x026b('0x3c')],_0x2ccc79[_0x026b('0x3d')]);_0x40d424['attributes']=_[_0x026b('0x3f')](_0x2ccc79[_0x026b('0x3c')],qs[_0x026b('0x41')](_0x43b296[_0x026b('0x3d')][_0x026b('0x41')]));_0x40d424['attributes']=_0x40d424[_0x026b('0x40')][_0x026b('0x42')]?_0x40d424[_0x026b('0x40')]:_0x2ccc79[_0x026b('0x3c')];if(_0x43b296[_0x026b('0x3d')][_0x026b('0x4c')]){_0x40d424[_0x026b('0x4d')]=[{'all':!![]}];}_0x40d424=_[_0x026b('0x4a')]({},_0x40d424,_0x43b296[_0x026b('0x4b')]);return db[_0x026b('0x39')][_0x026b('0x52')](_0x40d424)['then'](handleEntityNotFound(_0x4a3028,null))[_0x026b('0x33')](respondWithResult(_0x4a3028,null))[_0x026b('0x50')](handleError(_0x4a3028,null));};exports[_0x026b('0x53')]=function(_0x5bb329,_0x495425){return db[_0x026b('0x39')][_0x026b('0x53')](_0x5bb329[_0x026b('0x54')],{})['then'](respondWithResult(_0x495425,0xc9))['catch'](handleError(_0x495425,null));};exports[_0x026b('0x32')]=function(_0x3f8b13,_0xc3bcd0){if(_0x3f8b13[_0x026b('0x54')]['id']){delete _0x3f8b13['body']['id'];}return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x3f8b13['params']['id']}})[_0x026b('0x33')](handleEntityNotFound(_0xc3bcd0,null))[_0x026b('0x33')](saveUpdates(_0x3f8b13[_0x026b('0x54')],null))['then'](respondWithResult(_0xc3bcd0,null))[_0x026b('0x50')](handleError(_0xc3bcd0,null));};exports['destroy']=function(_0x3334e6,_0x416475){return db['SmsMessage'][_0x026b('0x52')]({'where':{'id':_0x3334e6[_0x026b('0x51')]['id']}})['then'](handleEntityNotFound(_0x416475,null))[_0x026b('0x33')](removeEntity(_0x416475,null))[_0x026b('0x50')](handleError(_0x416475,null));};exports['describe']=function(_0x422e38,_0x813477){return db[_0x026b('0x39')]['describe']()[_0x026b('0x33')](respondWithResult(_0x813477,null))[_0x026b('0x50')](handleError(_0x813477,null));};var interaction_log=require(_0x026b('0x12'))(_0x026b('0x55'));exports[_0x026b('0x56')]=function(_0x45b74f,_0x424588,_0x2b64ce){var _0x30a887={'agent':{},'channel':_0x026b('0x57')};if(_0x45b74f[_0x026b('0x54')]['id']){delete _0x45b74f[_0x026b('0x54')]['id'];}_0x45b74f[_0x026b('0x54')][_0x026b('0x58')]=!![];_0x45b74f[_0x026b('0x54')][_0x026b('0x59')]=moment()[_0x026b('0x5a')](_0x026b('0x5b'));_0x45b74f['body']['UserId']=_0x45b74f[_0x026b('0x54')][_0x026b('0x5c')]||_0x45b74f[_0x026b('0x5d')]['id'];_0x30a887[_0x026b('0x5e')]['id']=_0x45b74f[_0x026b('0x54')][_0x026b('0x5c')];return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x45b74f[_0x026b('0x51')]['id'],'UserId':null}})[_0x026b('0x33')](handleEntityNotFound(_0x424588,null))[_0x026b('0x33')](saveUpdates(_0x45b74f['body'],null))[_0x026b('0x33')](function(_0x5e32a1){if(_0x5e32a1){_0x30a887[_0x026b('0x24')]=_0x5e32a1['get']({'plain':!![]});return db[_0x026b('0x5f')][_0x026b('0x52')]({'where':{'id':_0x5e32a1[_0x026b('0x60')]}});}return null;})[_0x026b('0x33')](handleEntityNotFound(_0x424588,null))[_0x026b('0x33')](function(_0x2e8e42){if(_0x2e8e42){return _0x2e8e42[_0x026b('0x32')]({'UserId':_0x45b74f[_0x026b('0x54')][_0x026b('0x5c')],'read1stAt':_[_0x026b('0x61')](_0x2e8e42['read1stAt'])?moment()[_0x026b('0x5a')](_0x026b('0x5b')):undefined});}return null;})['then'](function(_0x391a69){if(_0x391a69){_0x30a887[_0x026b('0x62')]=_0x391a69[_0x026b('0x63')]({'plain':!![]});interaction_log[_0x026b('0x25')](_0x026b('0x64'),_0x45b74f['user']['id'],_0x45b74f[_0x026b('0x5d')]['name'],_0x45b74f[_0x026b('0x5d')]['role'],_0x30a887[_0x026b('0x62')]['id'],_0x45b74f[_0x026b('0x54')]?JSON['stringify'](_0x45b74f[_0x026b('0x54')]):'null');return respondWithRpcPromise(_0x026b('0x65'),_0x026b('0x66'),_0x30a887);}return null;})[_0x026b('0x33')](function(_0x453445){var _0x5c5023=_0x026b('0x67')+_0x453445[_0x026b('0x24')][_0x026b('0x68')];return db[_0x026b('0x69')][_0x026b('0x3d')](_0x5c5023,{'type':db[_0x026b('0x6a')]['QueryTypes'][_0x026b('0x6b')],'raw':!![]})[_0x026b('0x33')](function(_0x119483){return _0x119483;});})[_0x026b('0x33')](function(_0x35baf2){if(_0x35baf2){_0x30a887[_0x026b('0x24')]['contact']=_0x35baf2[0x0];if(!_0x45b74f[_0x026b('0x54')]['UserId'])return;return db[_0x026b('0x6c')][_0x026b('0x52')]({'where':{'id':_0x45b74f['body']['UserId'],'role':_0x026b('0x5e')},'attributes':['id',_0x026b('0x36'),_0x026b('0x6d'),'email',_0x026b('0x6e')],'raw':!![]});}return null;})['then'](function(_0x5b5875){if(!_0x5b5875)return null;_0x30a887['message'][_0x026b('0x5e')]=_0x5b5875;return _0x30a887;})[_0x026b('0x33')](function(_0xd798ac){if(_0xd798ac){if(_0x45b74f[_0x026b('0x54')]['manual']){_0x30a887[_0x026b('0x24')][_0x026b('0x6f')]=util[_0x026b('0x5a')](_0x026b('0x70'),_0x45b74f[_0x026b('0x5d')][_0x026b('0x36')]);_0x30a887['message']['channel']=_0x30a887[_0x026b('0x71')];_0x30a887[_0x026b('0x24')][_0x026b('0x72')]=_0x30a887[_0x026b('0x71')];_0x30a887['message'][_0x026b('0x73')]=_0x026b('0x56');return respondWithRpcPromise(_0x026b('0x74'),_0x026b('0x74'),{'event':_0x026b('0x75'),'message':_0x30a887[_0x026b('0x24')]},client9002)[_0x026b('0x33')](function(){return _0x30a887;});}return _0x30a887;}return null;})[_0x026b('0x33')](respondWithResult(_0x424588,null))[_0x026b('0x50')](handleError(_0x424588,null));};var interaction_log=require('../../config/logger')(_0x026b('0x55'));exports[_0x026b('0x30')]=function(_0x525ea8,_0x52cb12,_0x30d002){var _0x5a5ee3={'agent':{},'channel':'sms'};if(_0x525ea8[_0x026b('0x54')]['id']){delete _0x525ea8[_0x026b('0x54')]['id'];}_0x525ea8[_0x026b('0x54')][_0x026b('0x5c')]=_0x525ea8[_0x026b('0x54')]['UserId']||_0x525ea8['user']['id'];_0x5a5ee3[_0x026b('0x5e')]['id']=_0x525ea8[_0x026b('0x54')]['UserId'];return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x525ea8[_0x026b('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52cb12,null))[_0x026b('0x33')](function(_0x1c61f2){if(_0x1c61f2){_0x5a5ee3['message']=_0x1c61f2[_0x026b('0x63')]({'plain':!![]});return db[_0x026b('0x5f')][_0x026b('0x52')]({'where':{'id':_0x1c61f2[_0x026b('0x60')]}});}return null;})[_0x026b('0x33')](handleEntityNotFound(_0x52cb12,null))['then'](function(_0x5ec571){if(_0x5ec571){_0x5a5ee3[_0x026b('0x62')]=_0x5ec571[_0x026b('0x63')]({'plain':!![]});interaction_log[_0x026b('0x25')](_0x026b('0x76'),_0x525ea8[_0x026b('0x5d')]['id'],_0x525ea8['user']['name'],_0x525ea8[_0x026b('0x5d')][_0x026b('0x77')],_0x5a5ee3['interaction']['id'],_0x525ea8[_0x026b('0x54')]?JSON['stringify'](_0x525ea8[_0x026b('0x54')]):_0x026b('0x78'));return respondWithRpcPromise(_0x026b('0x79'),_0x026b('0x7a'),_0x5a5ee3);}return null;})[_0x026b('0x33')](function(_0x13883a){var _0x349ff8=_0x026b('0x67')+_0x13883a[_0x026b('0x24')][_0x026b('0x68')];return db[_0x026b('0x69')][_0x026b('0x3d')](_0x349ff8,{'type':db[_0x026b('0x6a')][_0x026b('0x7b')][_0x026b('0x6b')],'raw':!![]})[_0x026b('0x33')](function(_0x14272a){return _0x14272a;});})['then'](function(_0x31a8e8){if(_0x31a8e8){_0x5a5ee3[_0x026b('0x24')][_0x026b('0x7c')]=_0x31a8e8[0x0];if(!_0x525ea8[_0x026b('0x54')][_0x026b('0x5c')])return;return db['User']['find']({'where':{'id':_0x525ea8['body']['UserId'],'role':_0x026b('0x5e')},'attributes':['id',_0x026b('0x36'),_0x026b('0x6d'),_0x026b('0x7d'),_0x026b('0x6e')],'raw':!![]});}return null;})[_0x026b('0x33')](function(_0x31f6f3){if(!_0x31f6f3)return null;_0x5a5ee3[_0x026b('0x24')]['agent']=_0x31f6f3;return _0x5a5ee3;})[_0x026b('0x33')](function(_0x287e03){if(_0x287e03){_0x287e03['message'][_0x026b('0x6f')]=util[_0x026b('0x5a')](_0x026b('0x70'),_0x525ea8['user'][_0x026b('0x36')]);_0x287e03[_0x026b('0x24')][_0x026b('0x71')]=_0x5a5ee3[_0x026b('0x71')];_0x287e03[_0x026b('0x24')][_0x026b('0x72')]=_0x5a5ee3['channel'];_0x287e03[_0x026b('0x24')][_0x026b('0x73')]=_0x026b('0x30');respondWithRpcPromise(_0x026b('0x74'),_0x026b('0x74'),{'event':_0x026b('0x7e'),'message':_0x287e03[_0x026b('0x24')]},client9002);return _0x5a5ee3;}return null;})[_0x026b('0x33')](respondWithResult(_0x52cb12,null))[_0x026b('0x50')](handleError(_0x52cb12,null));};exports[_0x026b('0x28')]=function(_0x578af5,_0x32f151,_0x5a779e){if(_0x578af5[_0x026b('0x54')]['id']){delete _0x578af5[_0x026b('0x54')]['id'];}var _0x269f9c;return db[_0x026b('0x39')][_0x026b('0x52')]({'where':{'id':_0x578af5[_0x026b('0x51')]['id']}})[_0x026b('0x33')](handleEntityNotFound(_0x32f151,null))[_0x026b('0x33')](function(_0x4928eb){if(_0x4928eb){_0x269f9c=_0x4928eb;return db[_0x026b('0x7f')][_0x026b('0x52')]({'where':{'id':_0x4928eb[_0x026b('0x80')]}});}})[_0x026b('0x33')](handleEntityNotFound(_0x32f151,null))[_0x026b('0x33')](function(_0x41722c){if(_0x41722c){logger[_0x026b('0x81')](_0x026b('0x82'),_0x026b('0x28'),'received\x20delivery\x20report\x20from',_0x41722c[_0x026b('0x3b')],util['inspect'](_0x578af5[_0x026b('0x54')],{'showHidden':![],'depth':null}));switch(_0x41722c[_0x026b('0x3b')]){case _0x026b('0x83'):if(_0x578af5['body'][_0x026b('0x84')]&&_0x578af5[_0x026b('0x54')]['MessageSid']===_0x269f9c['messageId']){return _0x269f9c['update']({'read':!![]});}else{logger['error'](_0x026b('0x85'),_0x026b('0x28'),'twilio',util[_0x026b('0x86')](_0x578af5[_0x026b('0x54')],{'showHidden':![],'depth':null}));}break;case _0x026b('0x87'):if(_0x578af5[_0x026b('0x54')][_0x026b('0x88')]&&_0x578af5[_0x026b('0x54')][_0x026b('0x88')]===_0x269f9c[_0x026b('0x89')]&&_[_0x026b('0x8a')]([_0x026b('0x8b'),_0x026b('0x8c')],_0x578af5[_0x026b('0x54')][_0x026b('0x8d')])>=0x0){return _0x269f9c[_0x026b('0x32')]({'read':!![]});}else{logger['error'](_0x026b('0x85'),_0x026b('0x28'),_0x026b('0x8e'),util[_0x026b('0x86')](_0x578af5['body'],{'showHidden':![],'depth':null}));}break;case _0x026b('0x8f'):var _0x6d4d2a=_0x578af5[_0x026b('0x54')][_0x026b('0x90')][0x0];if(_0x6d4d2a[_0x026b('0x28')][_0x026b('0x91')]==='DELIVERED'){return _0x269f9c[_0x026b('0x32')]({'read':!![]});}else{logger[_0x026b('0x22')](_0x026b('0x85'),_0x026b('0x28'),_0x026b('0x8f'),util[_0x026b('0x86')](_0x578af5[_0x026b('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x269f9c;}})['then'](respondWithResult(_0x32f151,null))[_0x026b('0x50')](handleError(_0x32f151,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0e21415..6402519 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 _0xf3c5=['save','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x524689,_0x1c24e3){var _0x4e2ec4=function(_0x203820){while(--_0x203820){_0x524689['push'](_0x524689['shift']());}};_0x4e2ec4(++_0x1c24e3);}(_0xf3c5,0x115));var _0x5f3c=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xf3c5[_0x1caf6a];return _0x1bf493;};'use strict';var EventEmitter=require(_0x5f3c('0x0'));var SmsMessage=require(_0x5f3c('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5f3c('0x2')](0x0);var events={'afterCreate':_0x5f3c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x55cb53){return function(_0x63e6e6,_0x38627e,_0x4f001e){SmsMessageEvents[_0x5f3c('0x4')](_0x55cb53+':'+_0x63e6e6['id'],_0x63e6e6);SmsMessageEvents[_0x5f3c('0x4')](_0x55cb53,_0x63e6e6);_0x4f001e(null);};}for(var e in events){if(events[_0x5f3c('0x5')](e)){var event=events[e];SmsMessage[_0x5f3c('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x5c17=['emit','exports','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x118b7f,_0xecc7e9){var _0x3bc1b4=function(_0x16bdcf){while(--_0x16bdcf){_0x118b7f['push'](_0x118b7f['shift']());}};_0x3bc1b4(++_0xecc7e9);}(_0x5c17,0x1a6));var _0x75c1=function(_0xb644f5,_0x290e9b){_0xb644f5=_0xb644f5-0x0;var _0x3a23b8=_0x5c17[_0xb644f5];return _0x3a23b8;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x75c1('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x75c1('0x1')](0x0);var events={'afterCreate':_0x75c1('0x2'),'afterUpdate':_0x75c1('0x3'),'afterDestroy':_0x75c1('0x4')};function emitEvent(_0x573bce){return function(_0x2d9d43,_0x3cc3ba,_0x17ffb0){SmsMessageEvents[_0x75c1('0x5')](_0x573bce+':'+_0x2d9d43['id'],_0x2d9d43);SmsMessageEvents[_0x75c1('0x5')](_0x573bce,_0x2d9d43);_0x17ffb0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x75c1('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 92e087c..4d16716 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 _0x6d93=['login?username=','password','split','sms','POST','session_key','deliveryReport','read','connectel','senderString','requestid','clicksend','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','remote','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','crypto','login','text','timestamp','keys','length','apiKey','createHash','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','accountId','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','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','error','SmsAccount','type','twilio','accountSid','authToken','messages','create','phone','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender'];(function(_0x583483,_0x6fddd9){var _0x1e4891=function(_0x3b0f0f){while(--_0x3b0f0f){_0x583483['push'](_0x583483['shift']());}};_0x1e4891(++_0x6fddd9);}(_0x6d93,0xbf));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36d9('0x0'));var util=require(_0x36d9('0x1'));var logger=require(_0x36d9('0x2'))(_0x36d9('0x3'));var moment=require(_0x36d9('0x4'));var BPromise=require(_0x36d9('0x5'));var rp=require(_0x36d9('0x6'));var fs=require('fs');var path=require(_0x36d9('0x7'));var rimraf=require(_0x36d9('0x8'));var config=require(_0x36d9('0x9'));var attributes=require(_0x36d9('0xa'));module[_0x36d9('0xb')]=function(_0x139a2b,_0x16e985){return _0x139a2b[_0x36d9('0xc')](_0x36d9('0xd'),attributes,{'tableName':_0x36d9('0xe'),'paranoid':![],'indexes':[{'name':_0x36d9('0xf'),'fields':[_0x36d9('0xf')]},{'name':'fti_sms_messages','fields':[_0x36d9('0x10')],'type':_0x36d9('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bbccd,_0x4c7811,_0x43bd3e){var _0x513edb=_0x139a2b[_0x36d9('0x12')];var _0x1e6d68=_0x4bbccd[_0x36d9('0x13')]({'plain':!![]});if(_0x1e6d68[_0x36d9('0x14')]['toLowerCase']()==='in'||_0x1e6d68[_0x36d9('0x14')][_0x36d9('0x15')]()===_0x36d9('0x16')&&!_0x1e6d68[_0x36d9('0x17')]&&!_[_0x36d9('0x18')](_0x1e6d68['UserId'])&&!_[_0x36d9('0x18')](_0x1e6d68[_0x36d9('0x19')])){_0x513edb[_0x36d9('0x1a')][_0x36d9('0x1b')]({'where':{'id':_0x1e6d68[_0x36d9('0x19')]}})[_0x36d9('0x1c')](function(_0x2f900c){if(_0x2f900c){_0x2f900c[_0x36d9('0x1d')]({'lastMsgAt':_0x1e6d68[_0x36d9('0x1e')],'lastMsgDirection':_0x1e6d68[_0x36d9('0x14')][_0x36d9('0x15')]()});}})['catch'](function(_0x3228c7){console[_0x36d9('0x1f')](_0x3228c7);});}if(_0x1e6d68[_0x36d9('0x14')]===_0x36d9('0x16')&&!_0x1e6d68['secret']){var _0x1f5b14;_0x513edb[_0x36d9('0x20')]['find']({'where':{'id':_0x1e6d68['SmsAccountId']},'raw':!![]})[_0x36d9('0x1c')](function(_0x5e004f){_0x1f5b14=_0x5e004f;if(_0x1f5b14&&_0x1f5b14[_0x36d9('0x21')]){switch(_0x1f5b14[_0x36d9('0x21')]){case'twilio':var _0xcf3cd=require(_0x36d9('0x22'));if(_0x1f5b14[_0x36d9('0x23')]&&_0x1f5b14[_0x36d9('0x24')]&&_0x1f5b14['phone']){var _0x1ae757=new _0xcf3cd(_0x1f5b14[_0x36d9('0x23')],_0x1f5b14['authToken']);_0x1ae757[_0x36d9('0x25')][_0x36d9('0x26')]({'body':_0x1e6d68['body'],'to':_0x1e6d68['phone'],'from':_0x1f5b14[_0x36d9('0x27')],'statusCallback':_0x1f5b14['remote']+_0x36d9('0x28')+_0x1e6d68['id']+'/status?token='+_0x1f5b14[_0x36d9('0x29')]})[_0x36d9('0x1c')](function(_0x2c3f99){if(_0x2c3f99['sid']){return _0x4bbccd[_0x36d9('0x1d')]({'messageId':_0x2c3f99[_0x36d9('0x2a')]});}})[_0x36d9('0x2b')](function(_0x477b63){logger[_0x36d9('0x1f')](_0x36d9('0x2c'),'afterCreate',_0x36d9('0x22'),util[_0x36d9('0x2d')](_0x477b63,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x22'),_0x36d9('0x2f'));}break;case _0x36d9('0x30'):var _0x59a8c9=_0x36d9('0x31');if(_0x1f5b14[_0x36d9('0x32')]&&_0x1f5b14['password']){var _0x30e6d9={'recipient':[_0x1e6d68['phone']],'message':_0x1e6d68[_0x36d9('0x10')],'message_type':_0x1f5b14[_0x36d9('0x33')]};if(_0x1f5b14['smsMethod']&&_0x1f5b14[_0x36d9('0x33')]!=='SI'){_0x30e6d9[_0x36d9('0x34')]=_0x1f5b14[_0x36d9('0x27')];}var _0x2e27af={'url':_0x59a8c9+_0x36d9('0x35')+_0x1f5b14['username']+'&password='+_0x1f5b14[_0x36d9('0x36')],'method':'GET'};rp(_0x2e27af)['then'](function(_0x1e8dde){var _0x7de589=_0x1e8dde[_0x36d9('0x37')](';');var _0x5b5fcb={'user_key':_0x7de589[0x0],'session_key':_0x7de589[0x1]};_0x2e27af={'url':_0x59a8c9+_0x36d9('0x38'),'method':_0x36d9('0x39'),'headers':{'user_key':_0x5b5fcb['user_key'],'Session_key':_0x5b5fcb[_0x36d9('0x3a')]},'json':!![],'body':_0x30e6d9};return rp(_0x2e27af);})[_0x36d9('0x1c')](function(_0x2bbd1a){if(_0x2bbd1a['total_sent']>=0x1){var _0xb56585={'messageId':_0x2bbd1a['internal_order_id']};if(_0x1f5b14[_0x36d9('0x33')]!=='GP'||!_0x1f5b14[_0x36d9('0x3b')]){_0xb56585[_0x36d9('0x3c')]=!![];}return _0x4bbccd[_0x36d9('0x1d')](_0xb56585);}else{return logger[_0x36d9('0x1f')](_0x36d9('0x2c'),'afterCreate',_0x36d9('0x30'),util[_0x36d9('0x2d')](_0x2bbd1a,{'showHidden':![],'depth':null}));}})[_0x36d9('0x2b')](function(_0x1115ed){return logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x30'),util[_0x36d9('0x2d')](_0x1115ed,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x36d9('0x3d'):if(_0x1f5b14[_0x36d9('0x24')]){var _0x36f0e6={'recipient':_0x1e6d68[_0x36d9('0x27')],'message':_0x1e6d68['body'],'sender':_0x1f5b14[_0x36d9('0x3e')]||_0x1f5b14['phone'],'authorization':_0x1f5b14['authToken']};var _0x4c7811={'method':_0x36d9('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x36f0e6,'json':!![]};rp(_0x4c7811)['then'](function(_0x58309b){var _0x9d988f={'messageId':_0x58309b[_0x36d9('0x3f')]};if(!_0x1f5b14['deliveryReport']){_0x9d988f[_0x36d9('0x3c')]=!![];}return _0x4bbccd['update'](_0x9d988f);})[_0x36d9('0x2b')](function(_0x288761){logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x3d'),util['inspect'](_0x288761,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0x36d9('0x40'):if(_0x1f5b14[_0x36d9('0x32')]&&_0x1f5b14[_0x36d9('0x36')]){var _0x36f0e6={'messages':[{'source':'xCALLY\x20Motion','to':_0x1e6d68[_0x36d9('0x27')],'body':_0x1e6d68[_0x36d9('0x10')],'from':_0x1f5b14[_0x36d9('0x3e')]||_0x1f5b14[_0x36d9('0x27')]}]};var _0x1468ca=util[_0x36d9('0x41')]('%s:%s',_0x1f5b14[_0x36d9('0x32')],_0x1f5b14['password']);var _0x4c7811={'method':_0x36d9('0x39'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x36f0e6,'headers':{'Authorization':util[_0x36d9('0x41')]('Basic\x20%s',new Buffer(_0x1468ca)[_0x36d9('0x42')](_0x36d9('0x43')))},'json':!![]};rp(_0x4c7811)[_0x36d9('0x1c')](function(_0x2c0059){if(_0x2c0059[_0x36d9('0x44')]>=0xc8&&_0x2c0059[_0x36d9('0x44')]<=0xce){if(_0x2c0059[_0x36d9('0x45')]&&_0x2c0059['data'][_0x36d9('0x46')]>0x0){var _0xb3f897=_[_0x36d9('0x47')](_0x2c0059[_0x36d9('0x45')][_0x36d9('0x25')]);var _0x4dba4={'messageId':_0xb3f897[_0x36d9('0x48')]};if(!_0x1f5b14['deliveryReport']){_0x4dba4[_0x36d9('0x3c')]=!![];}return _0x4bbccd['update'](_0x4dba4);}else{logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x49'),util[_0x36d9('0x2d')](_0x2c0059,{'showHidden':![],'depth':null}));}}else{logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x49'),util[_0x36d9('0x2d')](_0x2c0059,{'showHidden':![],'depth':null}));}})[_0x36d9('0x2b')](function(_0x461c43){logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x49'),util[_0x36d9('0x2d')](_0x461c43,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x36d9('0x2c'),'afterCreate',_0x36d9('0x49'),_0x36d9('0x4a'));}break;case'plivo':if(_0x1f5b14[_0x36d9('0x4b')]&&_0x1f5b14[_0x36d9('0x24')]){var _0x36f0e6={'dst':_0x1e6d68['phone'],'text':_0x1e6d68['body'],'src':_0x1f5b14['senderString']||_0x1f5b14[_0x36d9('0x27')],'url':_0x1f5b14[_0x36d9('0x4c')]+_0x36d9('0x28')+_0x1e6d68['id']+_0x36d9('0x4d')+_0x1f5b14[_0x36d9('0x29')]};var _0x1468ca=util['format'](_0x36d9('0x4e'),_0x1f5b14[_0x36d9('0x4b')],_0x1f5b14[_0x36d9('0x24')]);var _0x4c7811={'method':'POST','uri':util[_0x36d9('0x41')](_0x36d9('0x4f'),_0x1f5b14[_0x36d9('0x4b')]),'body':_0x36f0e6,'headers':{'Authorization':util[_0x36d9('0x41')]('Basic\x20%s',new Buffer(_0x1468ca)[_0x36d9('0x42')](_0x36d9('0x43')))},'json':!![]};rp(_0x4c7811)[_0x36d9('0x1c')](function(_0x8c4805){var _0x397939={'messageId':_0x8c4805[_0x36d9('0x50')][0x0]};return _0x4bbccd['update'](_0x397939);})['catch'](function(_0x592481){logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x51'),util[_0x36d9('0x2d')](_0x592481,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x51'),_0x36d9('0x52'));}break;case'infobip':if(_0x1f5b14[_0x36d9('0x32')]&&_0x1f5b14[_0x36d9('0x36')]){if(_0x1f5b14[_0x36d9('0x53')]){var _0x561e65={'method':_0x36d9('0x39'),'uri':_0x1f5b14[_0x36d9('0x53')]+_0x36d9('0x54'),'body':{'username':_0x1f5b14[_0x36d9('0x32')],'password':_0x1f5b14[_0x36d9('0x36')]},'json':!![]};return rp(_0x561e65)[_0x36d9('0x1c')](function(_0x2748d9){var _0x29fd17={'method':_0x36d9('0x39'),'uri':_0x1f5b14['baseUrl']+_0x36d9('0x55'),'body':{'messages':[{'from':_0x1f5b14[_0x36d9('0x27')],'destinations':[{'to':_0x1e6d68[_0x36d9('0x27')]}],'text':_0x1e6d68[_0x36d9('0x10')],'notifyUrl':_0x1f5b14[_0x36d9('0x4c')]+_0x36d9('0x28')+_0x1e6d68['id']+_0x36d9('0x4d')+_0x1f5b14[_0x36d9('0x29')],'notifyContentType':'application/json','callbackData':_0x1f5b14[_0x36d9('0x27')]+';'+_0x1e6d68[_0x36d9('0x10')]}]},'headers':{'Authorization':_0x36d9('0x56')+_0x2748d9[_0x36d9('0x29')]},'json':!![]};return rp(_0x29fd17)[_0x36d9('0x1c')](function(_0x5dec99){if(_0x5dec99[_0x36d9('0x25')]){var _0x594c54={'messageId':_0x5dec99[_0x36d9('0x25')][0x0]['messageId']};if(!_0x1f5b14['deliveryReport']){_0x594c54[_0x36d9('0x3c')]=!![];}return _0x4bbccd[_0x36d9('0x1d')](_0x594c54);}else{return logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x57'),util[_0x36d9('0x2d')](_0x5dec99,{'showHidden':![],'depth':null}));}});})[_0x36d9('0x2b')](function(_0xbe7220){return logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),'infobip',util[_0x36d9('0x2d')](_0xbe7220,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x57'),_0x36d9('0x4a'));}break;case'csc':var _0x500371=require(_0x36d9('0x58'));if(_0x1f5b14['apiKey']){var _0x4aa777={};_0x4aa777[_0x36d9('0x59')]=_0x1f5b14['username'];_0x4aa777[_0x36d9('0x27')]=_0x1e6d68[_0x36d9('0x27')];_0x4aa777[_0x36d9('0x34')]=_0x1f5b14[_0x36d9('0x27')];_0x4aa777[_0x36d9('0x5a')]=_0x1e6d68[_0x36d9('0x10')];_0x4aa777[_0x36d9('0x5b')]=+new Date();var _0x4eca5b='';var _0x5d200f='';var _0x6e9b2=Object[_0x36d9('0x5c')](_0x4aa777);_0x6e9b2['sort']();for(var _0x2451a6=0x0;_0x2451a6<_0x6e9b2[_0x36d9('0x5d')];_0x2451a6++){if(_0x4eca5b!=''){_0x4eca5b+='&';}_0x4eca5b+=_0x6e9b2[_0x2451a6]+'='+encodeURIComponent(_0x4aa777[_0x6e9b2[_0x2451a6]]);_0x5d200f+=_0x4aa777[_0x6e9b2[_0x2451a6]];}_0x5d200f+=_0x1f5b14[_0x36d9('0x5e')];_0x5d200f=_0x500371[_0x36d9('0x5f')]('md5')['update'](_0x5d200f)['digest'](_0x36d9('0x60'));if(_0x4eca5b!==''){_0x4eca5b+='&';}_0x4eca5b+=_0x36d9('0x61')+_0x5d200f;var _0x2e27af={'method':_0x36d9('0x62'),'uri':_0x1f5b14[_0x36d9('0x53')]+_0x36d9('0x63')+_0x4eca5b,'json':!![]};return rp(_0x2e27af)[_0x36d9('0x1c')](function(_0x220e23){var _0x997f32=Object[_0x36d9('0x5c')](_0x220e23);if(_0x220e23[_0x997f32[0x0]][_0x36d9('0x1f')]&&parseInt(_0x220e23[_0x997f32[0x0]]['error'])===0x0){var _0x2b9bc3={'messageId':_0x220e23[_0x997f32[0x0]][_0x36d9('0x64')]};if(!_0x1f5b14[_0x36d9('0x3b')]){_0x2b9bc3[_0x36d9('0x3c')]=!![];}return _0x4bbccd[_0x36d9('0x1d')](_0x2b9bc3);}else{return logger['error'](_0x36d9('0x2c'),'afterCreate','csc',util[_0x36d9('0x2d')](_0x220e23[_0x36d9('0x1f')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d5468){return logger['error'](_0x36d9('0x2c'),_0x36d9('0x2e'),'csc',util[_0x36d9('0x2d')](_0x1d5468,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),'csc',_0x36d9('0x65'));}break;case _0x36d9('0x66'):if(_0x1f5b14['apiKey']){var _0x43d25f={'method':'POST','uri':_0x36d9('0x67'),'headers':{'Authorization':_0x1f5b14[_0x36d9('0x5e')]},'body':{'content':_0x1e6d68[_0x36d9('0x10')],'to':[_0x1e6d68[_0x36d9('0x27')]],'from':_0x1f5b14[_0x36d9('0x27')],'binary':![],'clientMessageId':'uuid','charset':_0x36d9('0x68')},'json':!![]};rp(_0x43d25f)[_0x36d9('0x1c')](function(_0x3415a1){if(!_0x3415a1[_0x36d9('0x1f')]){var _0x3b44c4={'messageId':_0x3415a1['messages'][0x0][_0x36d9('0x69')]};if(!_0x1f5b14[_0x36d9('0x3b')]){_0x3b44c4[_0x36d9('0x3c')]=!![];}return _0x4bbccd[_0x36d9('0x1d')](_0x3b44c4);}else{return logger['error'](_0x36d9('0x2c'),'afterCreate',_0x36d9('0x66'),util[_0x36d9('0x2d')](_0x3415a1[_0x36d9('0x1f')],{'showHidden':![],'depth':null}));}})[_0x36d9('0x2b')](function(_0x5db3a0){return logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),'clickatell',util[_0x36d9('0x2d')](_0x5db3a0,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x36d9('0x66'),_0x36d9('0x65'));}break;case _0x36d9('0x6a'):if(_0x1f5b14[_0x36d9('0x32')]&&_0x1f5b14['password']){var _0x1468ca=util['format'](_0x36d9('0x4e'),_0x1f5b14[_0x36d9('0x32')],_0x1f5b14[_0x36d9('0x36')]);var _0x4c7811={'method':_0x36d9('0x39'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1f5b14[_0x36d9('0x6b')]+'/messages','body':{'to':[_0x1e6d68[_0x36d9('0x27')]],'text':_0x1e6d68[_0x36d9('0x10')],'from':_0x1f5b14['phone'],'applicationId':_0x1f5b14[_0x36d9('0x6c')]},'headers':{'Authorization':util[_0x36d9('0x41')](_0x36d9('0x6d'),new Buffer(_0x1468ca)['toString'](_0x36d9('0x43')))},'json':!![]};rp(_0x4c7811)[_0x36d9('0x1c')](function(_0x4343d5){if(_0x4343d5['id']){var _0x30db39={'messageId':_0x4343d5['id']};return _0x4bbccd['update'](_0x30db39);}else{logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x6a'),util[_0x36d9('0x2d')](_0x4343d5,{'showHidden':![],'depth':null}));}})[_0x36d9('0x2b')](function(_0x3a0dd6){logger['error'](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x6a'),util[_0x36d9('0x2d')](_0x3a0dd6,{'showHidden':![],'depth':null}));});}else{logger[_0x36d9('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x36d9('0x2e'),_0x36d9('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x1f5b14[_0x36d9('0x5e')]){var _0x1656ba={};var _0x2e27af={'method':_0x36d9('0x39'),'uri':_0x36d9('0x6e'),'headers':{'Authorization':_0x36d9('0x6f')+_0x1f5b14[_0x36d9('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x1f5b14['phone'],'to':_0x1e6d68[_0x36d9('0x27')],'text':_0x1e6d68[_0x36d9('0x10')]},'json':!![]};return rp(_0x2e27af)[_0x36d9('0x1c')](function(_0x28af3f){if(_0x28af3f[_0x36d9('0x70')]==0xca){_0x1656ba[_0x36d9('0x71')]=_0x28af3f;var _0x1f3468={'method':_0x36d9('0x39'),'uri':_0x36d9('0x72'),'headers':{'Authorization':_0x36d9('0x6f')+_0x1f5b14[_0x36d9('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x1656ba[_0x36d9('0x71')][_0x36d9('0x73')]},'json':!![]};return rp(_0x1f3468)[_0x36d9('0x1c')](function(_0x571712){_0x1656ba[_0x36d9('0x74')]=_0x571712;var _0x133933={'messageId':_0x1656ba['message'][_0x36d9('0x73')],'read':!![]};return _0x4bbccd[_0x36d9('0x1d')](_0x133933);});}else{return logger['error'](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x75'),util[_0x36d9('0x2d')](_0x28af3f,{'showHidden':![],'depth':null}));}})[_0x36d9('0x2b')](function(_0x8ab791){return logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),'intelepeer',util[_0x36d9('0x2d')](_0x8ab791,{'showHidden':![],'depth':null}));});}else{return logger[_0x36d9('0x1f')](_0x36d9('0x2c'),_0x36d9('0x2e'),_0x36d9('0x75'),_0x36d9('0x76'));}break;}}})[_0x36d9('0x77')](function(){_0x43bd3e();});}else{_0x43bd3e();}}},'charset':_0x36d9('0x78'),'collate':_0x36d9('0x79')});}; \ No newline at end of file +var _0xc893=['phone','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','update','skebby','Missing\x20parameters:\x20username,\x20password','senderString','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','data','queued_count','messages','clickSend','plivo','authId','remote','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define','sms_messages','messageId','body','models','direction','toLowerCase','isNil','UserId','SmsInteractionId','SmsInteraction','then','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken'];(function(_0x2d2d5f,_0x15c02c){var _0x3d76b7=function(_0x40442c){while(--_0x40442c){_0x2d2d5f['push'](_0x2d2d5f['shift']());}};_0x3d76b7(++_0x15c02c);}(_0xc893,0x143));var _0x3c89=function(_0x53f707,_0x2f59c0){_0x53f707=_0x53f707-0x0;var _0x8104a5=_0xc893[_0x53f707];return _0x8104a5;};'use strict';var _=require(_0x3c89('0x0'));var util=require(_0x3c89('0x1'));var logger=require(_0x3c89('0x2'))('api');var moment=require(_0x3c89('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c89('0x4'));var fs=require('fs');var path=require(_0x3c89('0x5'));var rimraf=require(_0x3c89('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x3c89('0x7')]=function(_0x4664e6,_0x58b7d8){return _0x4664e6[_0x3c89('0x8')]('SmsMessage',attributes,{'tableName':_0x3c89('0x9'),'paranoid':![],'indexes':[{'name':_0x3c89('0xa'),'fields':[_0x3c89('0xa')]},{'name':'fti_sms_messages','fields':[_0x3c89('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33c060,_0xf94c21,_0x13c3c5){var _0x893d72=_0x4664e6[_0x3c89('0xc')];var _0x5c1c35=_0x33c060['get']({'plain':!![]});if(_0x5c1c35[_0x3c89('0xd')][_0x3c89('0xe')]()==='in'||_0x5c1c35['direction'][_0x3c89('0xe')]()==='out'&&!_0x5c1c35['secret']&&!_[_0x3c89('0xf')](_0x5c1c35[_0x3c89('0x10')])&&!_[_0x3c89('0xf')](_0x5c1c35[_0x3c89('0x11')])){_0x893d72[_0x3c89('0x12')]['findOne']({'where':{'id':_0x5c1c35[_0x3c89('0x11')]}})[_0x3c89('0x13')](function(_0x167c27){if(_0x167c27){_0x167c27['update']({'lastMsgAt':_0x5c1c35[_0x3c89('0x14')],'lastMsgDirection':_0x5c1c35[_0x3c89('0xd')][_0x3c89('0xe')]()});}})[_0x3c89('0x15')](function(_0x1c2927){console[_0x3c89('0x16')](_0x1c2927);});}if(_0x5c1c35[_0x3c89('0xd')]===_0x3c89('0x17')&&!_0x5c1c35['secret']){var _0x2e8934;_0x893d72[_0x3c89('0x18')][_0x3c89('0x19')]({'where':{'id':_0x5c1c35[_0x3c89('0x1a')]},'raw':!![]})[_0x3c89('0x13')](function(_0x45488f){_0x2e8934=_0x45488f;if(_0x2e8934&&_0x2e8934[_0x3c89('0x1b')]){switch(_0x2e8934[_0x3c89('0x1b')]){case'twilio':var _0x49a0de=require(_0x3c89('0x1c'));if(_0x2e8934[_0x3c89('0x1d')]&&_0x2e8934[_0x3c89('0x1e')]&&_0x2e8934['phone']){var _0x3c1f90=new _0x49a0de(_0x2e8934[_0x3c89('0x1d')],_0x2e8934['authToken']);_0x3c1f90['messages']['create']({'body':_0x5c1c35[_0x3c89('0xb')],'to':_0x5c1c35[_0x3c89('0x1f')],'from':_0x2e8934[_0x3c89('0x1f')],'statusCallback':_0x2e8934['remote']+_0x3c89('0x20')+_0x5c1c35['id']+_0x3c89('0x21')+_0x2e8934[_0x3c89('0x22')]})[_0x3c89('0x13')](function(_0x43d9a4){if(_0x43d9a4[_0x3c89('0x23')]){return _0x33c060['update']({'messageId':_0x43d9a4[_0x3c89('0x23')]});}})[_0x3c89('0x15')](function(_0xc4417a){logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x1c'),util[_0x3c89('0x26')](_0xc4417a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x1c'),_0x3c89('0x27'));}break;case'skebby':var _0x23e0cf=_0x3c89('0x28');if(_0x2e8934['username']&&_0x2e8934[_0x3c89('0x29')]){var _0xd38282={'recipient':[_0x5c1c35[_0x3c89('0x1f')]],'message':_0x5c1c35[_0x3c89('0xb')],'message_type':_0x2e8934[_0x3c89('0x2a')]};if(_0x2e8934[_0x3c89('0x2a')]&&_0x2e8934[_0x3c89('0x2a')]!=='SI'){_0xd38282[_0x3c89('0x2b')]=_0x2e8934[_0x3c89('0x1f')];}var _0xa05c01={'url':_0x23e0cf+_0x3c89('0x2c')+_0x2e8934[_0x3c89('0x2d')]+_0x3c89('0x2e')+_0x2e8934[_0x3c89('0x29')],'method':_0x3c89('0x2f')};rp(_0xa05c01)[_0x3c89('0x13')](function(_0x202f84){var _0x250aba=_0x202f84[_0x3c89('0x30')](';');var _0x5963a5={'user_key':_0x250aba[0x0],'session_key':_0x250aba[0x1]};_0xa05c01={'url':_0x23e0cf+_0x3c89('0x31'),'method':_0x3c89('0x32'),'headers':{'user_key':_0x5963a5[_0x3c89('0x33')],'Session_key':_0x5963a5[_0x3c89('0x34')]},'json':!![],'body':_0xd38282};return rp(_0xa05c01);})[_0x3c89('0x13')](function(_0x738e63){if(_0x738e63['total_sent']>=0x1){var _0x1b4957={'messageId':_0x738e63[_0x3c89('0x35')]};if(_0x2e8934[_0x3c89('0x2a')]!=='GP'||!_0x2e8934[_0x3c89('0x36')]){_0x1b4957['read']=!![];}return _0x33c060[_0x3c89('0x37')](_0x1b4957);}else{return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x38'),util['inspect'](_0x738e63,{'showHidden':![],'depth':null}));}})[_0x3c89('0x15')](function(_0x425020){return logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x38'),util['inspect'](_0x425020,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x38'),_0x3c89('0x39'));}break;case'connectel':if(_0x2e8934[_0x3c89('0x1e')]){var _0x1fd317={'recipient':_0x5c1c35['phone'],'message':_0x5c1c35['body'],'sender':_0x2e8934[_0x3c89('0x3a')]||_0x2e8934[_0x3c89('0x1f')],'authorization':_0x2e8934[_0x3c89('0x1e')]};var _0xf94c21={'method':_0x3c89('0x32'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1fd317,'json':!![]};rp(_0xf94c21)[_0x3c89('0x13')](function(_0x878724){var _0x1e5f09={'messageId':_0x878724[_0x3c89('0x3b')]};if(!_0x2e8934[_0x3c89('0x36')]){_0x1e5f09[_0x3c89('0x3c')]=!![];}return _0x33c060[_0x3c89('0x37')](_0x1e5f09);})[_0x3c89('0x15')](function(_0x29ef6f){logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x3d'),util['inspect'](_0x29ef6f,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),'connectel',_0x3c89('0x3e'));}break;case _0x3c89('0x3f'):if(_0x2e8934[_0x3c89('0x2d')]&&_0x2e8934['password']){var _0x1fd317={'messages':[{'source':_0x3c89('0x40'),'to':_0x5c1c35[_0x3c89('0x1f')],'body':_0x5c1c35[_0x3c89('0xb')],'from':_0x2e8934[_0x3c89('0x3a')]||_0x2e8934[_0x3c89('0x1f')]}]};var _0x82a849=util['format'](_0x3c89('0x41'),_0x2e8934[_0x3c89('0x2d')],_0x2e8934['password']);var _0xf94c21={'method':_0x3c89('0x32'),'uri':_0x3c89('0x42'),'body':_0x1fd317,'headers':{'Authorization':util[_0x3c89('0x43')]('Basic\x20%s',new Buffer(_0x82a849)['toString'](_0x3c89('0x44')))},'json':!![]};rp(_0xf94c21)[_0x3c89('0x13')](function(_0x5607cb){if(_0x5607cb['http_code']>=0xc8&&_0x5607cb['http_code']<=0xce){if(_0x5607cb[_0x3c89('0x45')]&&_0x5607cb[_0x3c89('0x45')][_0x3c89('0x46')]>0x0){var _0x4729e0=_['head'](_0x5607cb[_0x3c89('0x45')][_0x3c89('0x47')]);var _0x582235={'messageId':_0x4729e0['message_id']};if(!_0x2e8934['deliveryReport']){_0x582235[_0x3c89('0x3c')]=!![];}return _0x33c060[_0x3c89('0x37')](_0x582235);}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x48'),util[_0x3c89('0x26')](_0x5607cb,{'showHidden':![],'depth':null}));}}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),'clickSend',util[_0x3c89('0x26')](_0x5607cb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x233005){logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x48'),util[_0x3c89('0x26')](_0x233005,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),'afterCreate',_0x3c89('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3c89('0x49'):if(_0x2e8934[_0x3c89('0x4a')]&&_0x2e8934[_0x3c89('0x1e')]){var _0x1fd317={'dst':_0x5c1c35['phone'],'text':_0x5c1c35[_0x3c89('0xb')],'src':_0x2e8934[_0x3c89('0x3a')]||_0x2e8934[_0x3c89('0x1f')],'url':_0x2e8934[_0x3c89('0x4b')]+'/api/sms/messages/'+_0x5c1c35['id']+_0x3c89('0x21')+_0x2e8934[_0x3c89('0x22')]};var _0x82a849=util[_0x3c89('0x43')](_0x3c89('0x41'),_0x2e8934['authId'],_0x2e8934[_0x3c89('0x1e')]);var _0xf94c21={'method':_0x3c89('0x32'),'uri':util[_0x3c89('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2e8934[_0x3c89('0x4a')]),'body':_0x1fd317,'headers':{'Authorization':util['format'](_0x3c89('0x4c'),new Buffer(_0x82a849)[_0x3c89('0x4d')](_0x3c89('0x44')))},'json':!![]};rp(_0xf94c21)['then'](function(_0x590398){var _0x1b1c96={'messageId':_0x590398[_0x3c89('0x4e')][0x0]};return _0x33c060[_0x3c89('0x37')](_0x1b1c96);})[_0x3c89('0x15')](function(_0x515a1f){logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x49'),util[_0x3c89('0x26')](_0x515a1f,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x49'),_0x3c89('0x4f'));}break;case'infobip':if(_0x2e8934[_0x3c89('0x2d')]&&_0x2e8934[_0x3c89('0x29')]){if(_0x2e8934[_0x3c89('0x50')]){var _0xc2731={'method':_0x3c89('0x32'),'uri':_0x2e8934[_0x3c89('0x50')]+'/auth/1/session','body':{'username':_0x2e8934[_0x3c89('0x2d')],'password':_0x2e8934[_0x3c89('0x29')]},'json':!![]};return rp(_0xc2731)[_0x3c89('0x13')](function(_0x33d53a){var _0x2c38e4={'method':_0x3c89('0x32'),'uri':_0x2e8934[_0x3c89('0x50')]+_0x3c89('0x51'),'body':{'messages':[{'from':_0x2e8934[_0x3c89('0x1f')],'destinations':[{'to':_0x5c1c35[_0x3c89('0x1f')]}],'text':_0x5c1c35[_0x3c89('0xb')],'notifyUrl':_0x2e8934[_0x3c89('0x4b')]+_0x3c89('0x20')+_0x5c1c35['id']+_0x3c89('0x21')+_0x2e8934['token'],'notifyContentType':_0x3c89('0x52'),'callbackData':_0x2e8934['phone']+';'+_0x5c1c35[_0x3c89('0xb')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x33d53a[_0x3c89('0x22')]},'json':!![]};return rp(_0x2c38e4)['then'](function(_0x5693bc){if(_0x5693bc[_0x3c89('0x47')]){var _0x13a50e={'messageId':_0x5693bc['messages'][0x0][_0x3c89('0xa')]};if(!_0x2e8934[_0x3c89('0x36')]){_0x13a50e[_0x3c89('0x3c')]=!![];}return _0x33c060['update'](_0x13a50e);}else{return logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x53'),util[_0x3c89('0x26')](_0x5693bc,{'showHidden':![],'depth':null}));}});})[_0x3c89('0x15')](function(_0x3e575e){return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),'infobip',util[_0x3c89('0x26')](_0x3e575e,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x53'),_0x3c89('0x54'));}}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),'afterCreate',_0x3c89('0x53'),_0x3c89('0x39'));}break;case _0x3c89('0x55'):var _0x3bd7b7=require(_0x3c89('0x56'));if(_0x2e8934['apiKey']){var _0x14b8bd={};_0x14b8bd[_0x3c89('0x57')]=_0x2e8934[_0x3c89('0x2d')];_0x14b8bd[_0x3c89('0x1f')]=_0x5c1c35['phone'];_0x14b8bd[_0x3c89('0x2b')]=_0x2e8934[_0x3c89('0x1f')];_0x14b8bd[_0x3c89('0x58')]=_0x5c1c35[_0x3c89('0xb')];_0x14b8bd[_0x3c89('0x59')]=+new Date();var _0x38a6df='';var _0x463c4e='';var _0x3dcceb=Object[_0x3c89('0x5a')](_0x14b8bd);_0x3dcceb[_0x3c89('0x5b')]();for(var _0x253d67=0x0;_0x253d67<_0x3dcceb[_0x3c89('0x5c')];_0x253d67++){if(_0x38a6df!=''){_0x38a6df+='&';}_0x38a6df+=_0x3dcceb[_0x253d67]+'='+encodeURIComponent(_0x14b8bd[_0x3dcceb[_0x253d67]]);_0x463c4e+=_0x14b8bd[_0x3dcceb[_0x253d67]];}_0x463c4e+=_0x2e8934[_0x3c89('0x5d')];_0x463c4e=_0x3bd7b7[_0x3c89('0x5e')](_0x3c89('0x5f'))['update'](_0x463c4e)[_0x3c89('0x60')](_0x3c89('0x61'));if(_0x38a6df!==''){_0x38a6df+='&';}_0x38a6df+='signature='+_0x463c4e;var _0xa05c01={'method':_0x3c89('0x2f'),'uri':_0x2e8934['baseUrl']+_0x3c89('0x62')+_0x38a6df,'json':!![]};return rp(_0xa05c01)['then'](function(_0x45228d){var _0x59ddea=Object['keys'](_0x45228d);if(_0x45228d[_0x59ddea[0x0]][_0x3c89('0x16')]&&parseInt(_0x45228d[_0x59ddea[0x0]]['error'])===0x0){var _0x4ebfc5={'messageId':_0x45228d[_0x59ddea[0x0]][_0x3c89('0x63')]};if(!_0x2e8934[_0x3c89('0x36')]){_0x4ebfc5['read']=!![];}return _0x33c060[_0x3c89('0x37')](_0x4ebfc5);}else{return logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),'csc',util['inspect'](_0x45228d[_0x3c89('0x16')],{'showHidden':![],'depth':null}));}})[_0x3c89('0x15')](function(_0x123795){return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x55'),util[_0x3c89('0x26')](_0x123795,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c89('0x25'),'csc',_0x3c89('0x64'));}break;case'clickatell':if(_0x2e8934[_0x3c89('0x5d')]){var _0x1ac414={'method':_0x3c89('0x32'),'uri':_0x3c89('0x65'),'headers':{'Authorization':_0x2e8934[_0x3c89('0x5d')]},'body':{'content':_0x5c1c35[_0x3c89('0xb')],'to':[_0x5c1c35[_0x3c89('0x1f')]],'from':_0x2e8934[_0x3c89('0x1f')],'binary':![],'clientMessageId':_0x3c89('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x1ac414)[_0x3c89('0x13')](function(_0x99e512){if(!_0x99e512[_0x3c89('0x16')]){var _0x2a51f0={'messageId':_0x99e512[_0x3c89('0x47')][0x0]['apiMessageId']};if(!_0x2e8934[_0x3c89('0x36')]){_0x2a51f0[_0x3c89('0x3c')]=!![];}return _0x33c060['update'](_0x2a51f0);}else{return logger[_0x3c89('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c89('0x25'),'clickatell',util['inspect'](_0x99e512['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x37bf8d){return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),'clickatell',util[_0x3c89('0x26')](_0x37bf8d,{'showHidden':![],'depth':null}));});}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x67'),'Missing\x20parameters:\x20apiKey');}break;case _0x3c89('0x68'):if(_0x2e8934['username']&&_0x2e8934['password']){var _0x82a849=util[_0x3c89('0x43')]('%s:%s',_0x2e8934['username'],_0x2e8934[_0x3c89('0x29')]);var _0xf94c21={'method':_0x3c89('0x32'),'uri':_0x3c89('0x69')+_0x2e8934[_0x3c89('0x6a')]+_0x3c89('0x6b'),'body':{'to':[_0x5c1c35[_0x3c89('0x1f')]],'text':_0x5c1c35[_0x3c89('0xb')],'from':_0x2e8934[_0x3c89('0x1f')],'applicationId':_0x2e8934[_0x3c89('0x6c')]},'headers':{'Authorization':util[_0x3c89('0x43')](_0x3c89('0x4c'),new Buffer(_0x82a849)['toString'](_0x3c89('0x44')))},'json':!![]};rp(_0xf94c21)[_0x3c89('0x13')](function(_0x190322){if(_0x190322['id']){var _0xef3fbb={'messageId':_0x190322['id']};return _0x33c060[_0x3c89('0x37')](_0xef3fbb);}else{logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),'bandwidth',util[_0x3c89('0x26')](_0x190322,{'showHidden':![],'depth':null}));}})['catch'](function(_0x31377f){logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x68'),util['inspect'](_0x31377f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x68'),_0x3c89('0x39'));}break;case _0x3c89('0x6d'):if(_0x2e8934[_0x3c89('0x5d')]){var _0x54868e={};var _0xa05c01={'method':_0x3c89('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2e8934[_0x3c89('0x5d')],'Content-Type':_0x3c89('0x52')},'body':{'from':_0x2e8934[_0x3c89('0x1f')],'to':_0x5c1c35[_0x3c89('0x1f')],'text':_0x5c1c35[_0x3c89('0xb')]},'json':!![]};return rp(_0xa05c01)[_0x3c89('0x13')](function(_0x1f0b26){if(_0x1f0b26[_0x3c89('0x6e')]==0xca){_0x54868e['message']=_0x1f0b26;var _0x9f060f={'method':'POST','uri':_0x3c89('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x2e8934[_0x3c89('0x5d')],'Content-Type':_0x3c89('0x52')},'body':{'refid':_0x54868e[_0x3c89('0x70')][_0x3c89('0x71')]},'json':!![]};return rp(_0x9f060f)['then'](function(_0x4c10e3){_0x54868e[_0x3c89('0x72')]=_0x4c10e3;var _0x38ee97={'messageId':_0x54868e['message']['refid'],'read':!![]};return _0x33c060[_0x3c89('0x37')](_0x38ee97);});}else{return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x6d'),util['inspect'](_0x1f0b26,{'showHidden':![],'depth':null}));}})[_0x3c89('0x15')](function(_0x2e4edf){return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),'intelepeer',util[_0x3c89('0x26')](_0x2e4edf,{'showHidden':![],'depth':null}));});}else{return logger[_0x3c89('0x16')](_0x3c89('0x24'),_0x3c89('0x25'),_0x3c89('0x6d'),_0x3c89('0x73'));}break;}}})['finally'](function(){_0x13c3c5();});}else{_0x13c3c5();}}},'charset':_0x3c89('0x74'),'collate':_0x3c89('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 104c837..f2328db 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 _0xb2d1=['request\x20sent','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','SmsMessage,\x20%s,\x20%s'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xb2d1,0x6a));var _0x1b2d=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xb2d1[_0x454018];return _0x24697d;};'use strict';var _=require(_0x1b2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1b2d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b2d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b2d('0x3'));var logger=require(_0x1b2d('0x4'))(_0x1b2d('0x5'));var config=require('../../config/environment');var jayson=require(_0x1b2d('0x6'));var client=jayson[_0x1b2d('0x7')][_0x1b2d('0x8')]({'port':0x232a});config[_0x1b2d('0x9')]=_[_0x1b2d('0xa')](config[_0x1b2d('0x9')],{'host':_0x1b2d('0xb'),'port':0x18eb});var socket=require(_0x1b2d('0xc'))(new Redis(config[_0x1b2d('0x9')]));require('./smsMessage.socket')[_0x1b2d('0xd')](socket);function respondWithRpcPromise(_0xaa7857,_0x367d01,_0xe2ef6f){return new BPromise(function(_0x4e9efa,_0xe1c593){return client[_0x1b2d('0xe')](_0xaa7857,_0xe2ef6f)[_0x1b2d('0xf')](function(_0x35d79e){logger[_0x1b2d('0x10')]('SmsMessage,\x20%s,\x20%s',_0x367d01,'request\x20sent');logger[_0x1b2d('0x11')](_0x1b2d('0x12'),_0x367d01,'request\x20sent',JSON['stringify'](_0x35d79e));if(_0x35d79e[_0x1b2d('0x13')]){if(_0x35d79e[_0x1b2d('0x13')]['code']===0x1f4){logger[_0x1b2d('0x13')]('SmsMessage,\x20%s,\x20%s',_0x367d01,_0x35d79e[_0x1b2d('0x13')][_0x1b2d('0x14')]);return _0xe1c593(_0x35d79e[_0x1b2d('0x13')][_0x1b2d('0x14')]);}logger[_0x1b2d('0x13')](_0x1b2d('0x15'),_0x367d01,_0x35d79e['error'][_0x1b2d('0x14')]);return _0x4e9efa(_0x35d79e[_0x1b2d('0x13')][_0x1b2d('0x14')]);}else{logger[_0x1b2d('0x10')](_0x1b2d('0x15'),_0x367d01,_0x1b2d('0x16'));_0x4e9efa(_0x35d79e[_0x1b2d('0x17')][_0x1b2d('0x14')]);}})[_0x1b2d('0x18')](function(_0x1c1897){logger[_0x1b2d('0x13')](_0x1b2d('0x15'),_0x367d01,_0x1c1897);_0xe1c593(_0x1c1897);});});}exports[_0x1b2d('0x19')]=function(_0x242c79){var _0x2e1350=this;return new Promise(function(_0x39b975,_0x44b79c){return db[_0x1b2d('0x1a')][_0x1b2d('0x1b')](_0x242c79[_0x1b2d('0x1c')],{'raw':_0x242c79[_0x1b2d('0x1d')]?_0x242c79[_0x1b2d('0x1d')][_0x1b2d('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x32b3d2){logger[_0x1b2d('0x10')]('CreateSmsMessage',_0x242c79);logger[_0x1b2d('0x11')](_0x1b2d('0x19'),_0x242c79,JSON[_0x1b2d('0x1f')](_0x32b3d2));_0x39b975(_0x32b3d2);})[_0x1b2d('0x18')](function(_0x2d18cd){logger['error'](_0x1b2d('0x19'),_0x2d18cd['message'],_0x242c79);_0x44b79c(_0x2e1350[_0x1b2d('0x13')](0x1f4,_0x2d18cd[_0x1b2d('0x14')]));});});}; \ No newline at end of file +var _0x3bdc=['request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2b432e,_0x24d800){var _0x22854d=function(_0x4a9138){while(--_0x4a9138){_0x2b432e['push'](_0x2b432e['shift']());}};_0x22854d(++_0x24d800);}(_0x3bdc,0x1b1));var _0xc3bd=function(_0x153d61,_0x5eb94d){_0x153d61=_0x153d61-0x0;var _0x1eb866=_0x3bdc[_0x153d61];return _0x1eb866;};'use strict';var _=require(_0xc3bd('0x0'));var util=require('util');var moment=require(_0xc3bd('0x1'));var BPromise=require(_0xc3bd('0x2'));var rs=require(_0xc3bd('0x3'));var fs=require('fs');var Redis=require(_0xc3bd('0x4'));var db=require(_0xc3bd('0x5'))['db'];var utils=require(_0xc3bd('0x6'));var logger=require(_0xc3bd('0x7'))(_0xc3bd('0x8'));var config=require(_0xc3bd('0x9'));var jayson=require(_0xc3bd('0xa'));var client=jayson[_0xc3bd('0xb')][_0xc3bd('0xc')]({'port':0x232a});config[_0xc3bd('0xd')]=_[_0xc3bd('0xe')](config[_0xc3bd('0xd')],{'host':_0xc3bd('0xf'),'port':0x18eb});var socket=require(_0xc3bd('0x10'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x50b603,_0x533cc4,_0x51f3a0){return new BPromise(function(_0x5806a9,_0x2638a6){return client[_0xc3bd('0x11')](_0x50b603,_0x51f3a0)[_0xc3bd('0x12')](function(_0x2ba92a){logger[_0xc3bd('0x13')]('SmsMessage,\x20%s,\x20%s',_0x533cc4,'request\x20sent');logger[_0xc3bd('0x14')](_0xc3bd('0x15'),_0x533cc4,_0xc3bd('0x16'),JSON[_0xc3bd('0x17')](_0x2ba92a));if(_0x2ba92a[_0xc3bd('0x18')]){if(_0x2ba92a['error'][_0xc3bd('0x19')]===0x1f4){logger[_0xc3bd('0x18')]('SmsMessage,\x20%s,\x20%s',_0x533cc4,_0x2ba92a['error'][_0xc3bd('0x1a')]);return _0x2638a6(_0x2ba92a[_0xc3bd('0x18')][_0xc3bd('0x1a')]);}logger[_0xc3bd('0x18')](_0xc3bd('0x1b'),_0x533cc4,_0x2ba92a[_0xc3bd('0x18')][_0xc3bd('0x1a')]);return _0x5806a9(_0x2ba92a[_0xc3bd('0x18')][_0xc3bd('0x1a')]);}else{logger[_0xc3bd('0x13')](_0xc3bd('0x1b'),_0x533cc4,_0xc3bd('0x16'));_0x5806a9(_0x2ba92a['result'][_0xc3bd('0x1a')]);}})[_0xc3bd('0x1c')](function(_0x2d76ac){logger['error'](_0xc3bd('0x1b'),_0x533cc4,_0x2d76ac);_0x2638a6(_0x2d76ac);});});}exports[_0xc3bd('0x1d')]=function(_0x432613){var _0x13ed2c=this;return new Promise(function(_0x1037d3,_0xf61d3c){return db[_0xc3bd('0x1e')][_0xc3bd('0x1f')](_0x432613[_0xc3bd('0x20')],{'raw':_0x432613[_0xc3bd('0x21')]?_0x432613[_0xc3bd('0x21')][_0xc3bd('0x22')]===undefined?!![]:![]:!![]})[_0xc3bd('0x12')](function(_0x368275){logger[_0xc3bd('0x13')](_0xc3bd('0x1d'),_0x432613);logger[_0xc3bd('0x14')](_0xc3bd('0x1d'),_0x432613,JSON[_0xc3bd('0x17')](_0x368275));_0x1037d3(_0x368275);})[_0xc3bd('0x1c')](function(_0xe7a254){logger[_0xc3bd('0x18')](_0xc3bd('0x1d'),_0xe7a254[_0xc3bd('0x1a')],_0x432613);_0xf61d3c(_0x13ed2c[_0xc3bd('0x18')](0x1f4,_0xe7a254[_0xc3bd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ca92d78..abe4754 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 _0xab19=['smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x39175a,_0x4905a1){var _0x26e594=function(_0x4fb0dd){while(--_0x4fb0dd){_0x39175a['push'](_0x39175a['shift']());}};_0x26e594(++_0x4905a1);}(_0xab19,0x184));var _0x9ab1=function(_0x5380af,_0x30917d){_0x5380af=_0x5380af-0x0;var _0x132542=_0xab19[_0x5380af];return _0x132542;};'use strict';var SmsMessageEvents=require(_0x9ab1('0x0'));var events=[_0x9ab1('0x1'),_0x9ab1('0x2'),_0x9ab1('0x3')];function createListener(_0x29d100,_0x28d4e1){return function(_0x540289){_0x28d4e1[_0x9ab1('0x4')](_0x29d100,_0x540289);};}function removeListener(_0x4f6d35,_0x560587){return function(){SmsMessageEvents[_0x9ab1('0x5')](_0x4f6d35,_0x560587);};}exports[_0x9ab1('0x6')]=function(_0x4d71f3){for(var _0x45c665=0x0,_0x589b44=events[_0x9ab1('0x7')];_0x45c665<_0x589b44;_0x45c665++){var _0x3a673b=events[_0x45c665];var _0x151181=createListener(_0x9ab1('0x8')+_0x3a673b,_0x4d71f3);SmsMessageEvents['on'](_0x3a673b,_0x151181);}}; \ No newline at end of file +var _0xb47b=['smsMessage:','./smsMessage.events','remove','update','emit','removeListener','register'];(function(_0xdfa8d2,_0x53e754){var _0x49c233=function(_0x404a10){while(--_0x404a10){_0xdfa8d2['push'](_0xdfa8d2['shift']());}};_0x49c233(++_0x53e754);}(_0xb47b,0x1b3));var _0xbb47=function(_0x5b37cb,_0x450e53){_0x5b37cb=_0x5b37cb-0x0;var _0x3864aa=_0xb47b[_0x5b37cb];return _0x3864aa;};'use strict';var SmsMessageEvents=require(_0xbb47('0x0'));var events=['save',_0xbb47('0x1'),_0xbb47('0x2')];function createListener(_0x435b11,_0x51544f){return function(_0x490d77){_0x51544f[_0xbb47('0x3')](_0x435b11,_0x490d77);};}function removeListener(_0x2117e1,_0x13db23){return function(){SmsMessageEvents[_0xbb47('0x4')](_0x2117e1,_0x13db23);};}exports[_0xbb47('0x5')]=function(_0x15167e){for(var _0x1706c8=0x0,_0x575c9f=events['length'];_0x1706c8<_0x575c9f;_0x1706c8++){var _0x4fbfb1=events[_0x1706c8];var _0x24505d=createListener(_0xbb47('0x6')+_0x4fbfb1,_0x15167e);SmsMessageEvents['on'](_0x4fbfb1,_0x24505d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 47e6380..3af9102 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 _0xfd24=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','destroy','removeTeams','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','/describe'];(function(_0xfecdec,_0x18f179){var _0x17fb66=function(_0x3b4bcc){while(--_0x3b4bcc){_0xfecdec['push'](_0xfecdec['shift']());}};_0x17fb66(++_0x18f179);}(_0xfd24,0x1e3));var _0x4fd2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfd24[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0x4fd2('0x0'));var path=require(_0x4fd2('0x1'));var timeout=require(_0x4fd2('0x2'));var express=require(_0x4fd2('0x3'));var router=express[_0x4fd2('0x4')]();var fs_extra=require(_0x4fd2('0x5'));var auth=require(_0x4fd2('0x6'));var interaction=require(_0x4fd2('0x7'));var config=require('../../config/environment');var controller=require(_0x4fd2('0x8'));router['get']('/',auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xa')]);router[_0x4fd2('0xb')](_0x4fd2('0xc'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xd')]);router['get'](_0x4fd2('0xe'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xf')]);router[_0x4fd2('0xb')](_0x4fd2('0x10'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x11')]);router[_0x4fd2('0xb')](_0x4fd2('0x12'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x13')]);router[_0x4fd2('0xb')](_0x4fd2('0x14'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x15')]);router['post']('/',auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x16')]);router[_0x4fd2('0x17')](_0x4fd2('0x12'),auth[_0x4fd2('0x9')](),controller['addTeams']);router[_0x4fd2('0x17')]('/:id/users',auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x18')]);router[_0x4fd2('0x19')](_0x4fd2('0xe'),auth[_0x4fd2('0x9')](),controller['update']);router['delete'](_0x4fd2('0xe'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x1a')]);router['delete'](_0x4fd2('0x12'),auth['isAuthenticated'](),controller[_0x4fd2('0x1b')]);router[_0x4fd2('0x1c')](_0x4fd2('0x14'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x1d')]);module[_0x4fd2('0x1e')]=router; \ No newline at end of file +var _0xa128=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id/teams','removeAgents','exports','multer','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa128,0x1ab));var _0x8a12=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa128[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x8a12('0x0'));var util=require(_0x8a12('0x1'));var path=require(_0x8a12('0x2'));var timeout=require(_0x8a12('0x3'));var express=require(_0x8a12('0x4'));var router=express[_0x8a12('0x5')]();var fs_extra=require(_0x8a12('0x6'));var auth=require(_0x8a12('0x7'));var interaction=require(_0x8a12('0x8'));var config=require(_0x8a12('0x9'));var controller=require(_0x8a12('0xa'));router[_0x8a12('0xb')]('/',auth[_0x8a12('0xc')](),controller[_0x8a12('0xd')]);router['get'](_0x8a12('0xe'),auth['isAuthenticated'](),controller[_0x8a12('0xf')]);router[_0x8a12('0xb')](_0x8a12('0x10'),auth[_0x8a12('0xc')](),controller[_0x8a12('0x11')]);router[_0x8a12('0xb')](_0x8a12('0x12'),auth[_0x8a12('0xc')](),controller[_0x8a12('0x13')]);router['get']('/:id/teams',auth[_0x8a12('0xc')](),controller[_0x8a12('0x14')]);router[_0x8a12('0xb')](_0x8a12('0x15'),auth[_0x8a12('0xc')](),controller[_0x8a12('0x16')]);router[_0x8a12('0x17')]('/',auth[_0x8a12('0xc')](),controller[_0x8a12('0x18')]);router[_0x8a12('0x17')]('/:id/teams',auth[_0x8a12('0xc')](),controller[_0x8a12('0x19')]);router['post'](_0x8a12('0x15'),auth[_0x8a12('0xc')](),controller[_0x8a12('0x1a')]);router[_0x8a12('0x1b')](_0x8a12('0x10'),auth['isAuthenticated'](),controller[_0x8a12('0x1c')]);router[_0x8a12('0x1d')](_0x8a12('0x10'),auth[_0x8a12('0xc')](),controller['destroy']);router[_0x8a12('0x1d')](_0x8a12('0x1e'),auth[_0x8a12('0xc')](),controller['removeTeams']);router[_0x8a12('0x1d')](_0x8a12('0x15'),auth[_0x8a12('0xc')](),controller[_0x8a12('0x1f')]);module[_0x8a12('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c3a020e..214b72d 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 _0xd497=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x11ade8,_0x19bfe8){var _0x4a874d=function(_0x5e0de1){while(--_0x5e0de1){_0x11ade8['push'](_0x11ade8['shift']());}};_0x4a874d(++_0x19bfe8);}(_0xd497,0x17d));var _0x7d49=function(_0x598075,_0x385476){_0x598075=_0x598075-0x0;var _0x54f0ad=_0xd497[_0x598075];return _0x54f0ad;};'use strict';var Sequelize=require(_0x7d49('0x0'));module[_0x7d49('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d49('0x2')]},'timeout':{'type':Sequelize[_0x7d49('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d49('0x4')](_0x7d49('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xf25e=['exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x100602,_0x1cdc2d){var _0x81cf74=function(_0x1563b9){while(--_0x1563b9){_0x100602['push'](_0x100602['shift']());}};_0x81cf74(++_0x1cdc2d);}(_0xf25e,0x162));var _0xef25=function(_0x1bf98b,_0x5943cf){_0x1bf98b=_0x1bf98b-0x0;var _0x1b1f70=_0xf25e[_0x1bf98b];return _0x1b1f70;};'use strict';var Sequelize=require('sequelize');module[_0xef25('0x0')]={'name':{'type':Sequelize[_0xef25('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xef25('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xef25('0x2')](_0xef25('0x3'),_0xef25('0x4'),_0xef25('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d012c7d..0cb8e95 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 _0x06a9=['each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','format','SIP','createdAt','getTeams','hasOwnProperty','ids','Team','online','voicePause','interface','flatMap','transaction','addTeams'];(function(_0xe72d67,_0x35212c){var _0x1b98f9=function(_0x21ccd6){while(--_0x21ccd6){_0xe72d67['push'](_0xe72d67['shift']());}};_0x1b98f9(++_0x35212c);}(_0x06a9,0xb7));var _0x906a=function(_0x33c797,_0x430c30){_0x33c797=_0x33c797-0x0;var _0x514ff7=_0x06a9[_0x33c797];return _0x514ff7;};'use strict';var emlformat=require(_0x906a('0x0'));var rimraf=require(_0x906a('0x1'));var zipdir=require(_0x906a('0x2'));var jsonpatch=require(_0x906a('0x3'));var rp=require('request-promise');var moment=require(_0x906a('0x4'));var BPromise=require(_0x906a('0x5'));var Mustache=require(_0x906a('0x6'));var util=require(_0x906a('0x7'));var path=require(_0x906a('0x8'));var sox=require(_0x906a('0x9'));var csv=require(_0x906a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x906a('0xb'));var _=require(_0x906a('0xc'));var squel=require(_0x906a('0xd'));var crypto=require('crypto');var jsforce=require(_0x906a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x906a('0xa'));var querystring=require(_0x906a('0xf'));var Papa=require(_0x906a('0x10'));var Redis=require(_0x906a('0x11'));var authService=require(_0x906a('0x12'));var qs=require(_0x906a('0x13'));var as=require(_0x906a('0x14'));var hardwareService=require(_0x906a('0x15'));var logger=require(_0x906a('0x16'))(_0x906a('0x17'));var utils=require('../../config/utils');var config=require(_0x906a('0x18'));var licenseUtil=require(_0x906a('0x19'));var db=require(_0x906a('0x1a'))['db'];config['redis']=_['defaults'](config[_0x906a('0x1b')],{'host':_0x906a('0x1c'),'port':0x18eb});var socket=require(_0x906a('0x1d'))(new Redis(config[_0x906a('0x1b')]));require('./smsQueue.socket')[_0x906a('0x1e')](socket);function respondWithStatusCode(_0x5b8fcc,_0x1120fb){_0x1120fb=_0x1120fb||0xcc;return function(_0x39e728){if(_0x39e728){return _0x5b8fcc[_0x906a('0x1f')](_0x1120fb);}return _0x5b8fcc[_0x906a('0x20')](_0x1120fb)[_0x906a('0x21')]();};}function respondWithResult(_0x217971,_0xcc107a){_0xcc107a=_0xcc107a||0xc8;return function(_0x1bca09){if(_0x1bca09){return _0x217971[_0x906a('0x20')](_0xcc107a)['json'](_0x1bca09);}};}function respondWithFilteredResult(_0x971b1a,_0x571d01){return function(_0x2a6e96){if(_0x2a6e96){var _0x26e687=typeof _0x571d01['offset']===_0x906a('0x22')&&typeof _0x571d01[_0x906a('0x23')]===_0x906a('0x22');var _0x49db8d=_0x2a6e96[_0x906a('0x24')];var _0x1fa8f7=_0x26e687?0x0:_0x571d01[_0x906a('0x25')];var _0x10eb66=_0x26e687?_0x2a6e96[_0x906a('0x24')]:_0x571d01[_0x906a('0x25')]+_0x571d01[_0x906a('0x23')];var _0x3c96bc;if(_0x10eb66>=_0x49db8d){_0x10eb66=_0x49db8d;_0x3c96bc=0xc8;}else{_0x3c96bc=0xce;}_0x971b1a[_0x906a('0x20')](_0x3c96bc);return _0x971b1a[_0x906a('0x26')](_0x906a('0x27'),_0x1fa8f7+'-'+_0x10eb66+'/'+_0x49db8d)[_0x906a('0x28')](_0x2a6e96);}return null;};}function patchUpdates(_0x5d8fc0){return function(_0x5d4593){try{jsonpatch[_0x906a('0x29')](_0x5d4593,_0x5d8fc0,!![]);}catch(_0x324df2){return BPromise[_0x906a('0x2a')](_0x324df2);}return _0x5d4593[_0x906a('0x2b')]();};}function saveUpdates(_0x1cbc3c,_0x17d026){return function(_0x46edc6){if(_0x46edc6){return _0x46edc6['update'](_0x1cbc3c)['then'](function(_0x2ffec2){return _0x2ffec2;});}return null;};}function removeEntity(_0xda31cc,_0x36dc19){return function(_0xf7c0b){if(_0xf7c0b){return _0xf7c0b[_0x906a('0x2c')]()[_0x906a('0x2d')](function(){var _0x2ea49c=_0xf7c0b['get']({'plain':!![]});var _0x5ec45c=_0x906a('0x2e');return db[_0x906a('0x2f')][_0x906a('0x2c')]({'where':{'type':_0x5ec45c,'resourceId':_0x2ea49c['id']}})[_0x906a('0x2d')](function(){return _0xf7c0b;});})[_0x906a('0x2d')](function(){_0xda31cc[_0x906a('0x20')](0xcc)[_0x906a('0x21')]();});}};}function handleEntityNotFound(_0x28a647,_0x40618e){return function(_0x555a45){if(!_0x555a45){_0x28a647['sendStatus'](0x194);}return _0x555a45;};}function handleError(_0x5b30f8,_0x40e23c){_0x40e23c=_0x40e23c||0x1f4;return function(_0x65f70e){logger[_0x906a('0x30')](_0x65f70e[_0x906a('0x31')]);if(_0x65f70e['name']){delete _0x65f70e[_0x906a('0x32')];}_0x5b30f8[_0x906a('0x20')](_0x40e23c)[_0x906a('0x33')](_0x65f70e);};}exports[_0x906a('0x34')]=function(_0x1a47aa,_0x1a5816){var _0x519faf={},_0x3fe59c={},_0x1deb16={'count':0x0,'rows':[]};var _0x5d5c7e=_['map'](db[_0x906a('0x35')][_0x906a('0x36')],function(_0x177413){return{'name':_0x177413[_0x906a('0x37')],'type':_0x177413[_0x906a('0x38')]['key']};});_0x3fe59c[_0x906a('0x39')]=_[_0x906a('0x3a')](_0x5d5c7e,_0x906a('0x32'));_0x3fe59c['query']=_[_0x906a('0x3b')](_0x1a47aa[_0x906a('0x3c')]);_0x3fe59c[_0x906a('0x3d')]=_[_0x906a('0x3e')](_0x3fe59c[_0x906a('0x39')],_0x3fe59c[_0x906a('0x3c')]);_0x519faf['attributes']=_[_0x906a('0x3e')](_0x3fe59c[_0x906a('0x39')],qs[_0x906a('0x3f')](_0x1a47aa['query'][_0x906a('0x3f')]));_0x519faf[_0x906a('0x40')]=_0x519faf[_0x906a('0x40')][_0x906a('0x41')]?_0x519faf['attributes']:_0x3fe59c[_0x906a('0x39')];if(!_0x1a47aa[_0x906a('0x3c')]['hasOwnProperty'](_0x906a('0x42'))){_0x519faf['limit']=qs[_0x906a('0x23')](_0x1a47aa['query'][_0x906a('0x23')]);_0x519faf[_0x906a('0x25')]=qs[_0x906a('0x25')](_0x1a47aa[_0x906a('0x3c')][_0x906a('0x25')]);}_0x519faf[_0x906a('0x43')]=qs[_0x906a('0x44')](_0x1a47aa[_0x906a('0x3c')][_0x906a('0x44')]);_0x519faf[_0x906a('0x45')]=qs[_0x906a('0x3d')](_[_0x906a('0x46')](_0x1a47aa['query'],_0x3fe59c[_0x906a('0x3d')]),_0x5d5c7e);if(_0x1a47aa[_0x906a('0x3c')][_0x906a('0x47')]){_0x519faf[_0x906a('0x45')]=_[_0x906a('0x48')](_0x519faf[_0x906a('0x45')],{'$or':_['map'](_0x5d5c7e,function(_0x41573f){if(_0x41573f[_0x906a('0x38')]!==_0x906a('0x49')){var _0x4eb235={};_0x4eb235[_0x41573f[_0x906a('0x32')]]={'$like':'%'+_0x1a47aa[_0x906a('0x3c')]['filter']+'%'};return _0x4eb235;}})});}_0x519faf=_['merge']({},_0x519faf,_0x1a47aa['options']);var _0x4b711f={'where':_0x519faf[_0x906a('0x45')]};return db['SmsQueue'][_0x906a('0x24')](_0x4b711f)[_0x906a('0x2d')](function(_0x2637c7){_0x1deb16[_0x906a('0x24')]=_0x2637c7;if(_0x1a47aa[_0x906a('0x3c')][_0x906a('0x4a')]){_0x519faf[_0x906a('0x4b')]=[{'all':!![]}];}return db['SmsQueue'][_0x906a('0x4c')](_0x519faf);})['then'](function(_0x1c2027){_0x1deb16[_0x906a('0x4d')]=_0x1c2027;return _0x1deb16;})[_0x906a('0x2d')](respondWithFilteredResult(_0x1a5816,_0x519faf))[_0x906a('0x4e')](handleError(_0x1a5816,null));};exports[_0x906a('0x4f')]=function(_0x460d56,_0x40bf33){var _0x3bbeac={'raw':!![],'where':{'id':_0x460d56[_0x906a('0x50')]['id']}},_0x4c6b05={};_0x4c6b05[_0x906a('0x39')]=_[_0x906a('0x3b')](db[_0x906a('0x35')][_0x906a('0x36')]);_0x4c6b05[_0x906a('0x3c')]=_[_0x906a('0x3b')](_0x460d56[_0x906a('0x3c')]);_0x4c6b05[_0x906a('0x3d')]=_['intersection'](_0x4c6b05[_0x906a('0x39')],_0x4c6b05[_0x906a('0x3c')]);_0x3bbeac['attributes']=_[_0x906a('0x3e')](_0x4c6b05[_0x906a('0x39')],qs['fields'](_0x460d56[_0x906a('0x3c')]['fields']));_0x3bbeac[_0x906a('0x40')]=_0x3bbeac[_0x906a('0x40')][_0x906a('0x41')]?_0x3bbeac[_0x906a('0x40')]:_0x4c6b05['model'];if(_0x460d56['query'][_0x906a('0x4a')]){_0x3bbeac[_0x906a('0x4b')]=[{'all':!![]}];}_0x3bbeac=_[_0x906a('0x48')]({},_0x3bbeac,_0x460d56[_0x906a('0x51')]);return db[_0x906a('0x35')][_0x906a('0x52')](_0x3bbeac)[_0x906a('0x2d')](handleEntityNotFound(_0x40bf33,null))[_0x906a('0x2d')](respondWithResult(_0x40bf33,null))[_0x906a('0x4e')](handleError(_0x40bf33,null));};exports['create']=function(_0x10c022,_0xeadc7d){return db[_0x906a('0x35')][_0x906a('0x53')](_0x10c022[_0x906a('0x54')],{})[_0x906a('0x2d')](function(_0x5dc1f1){var _0x6117fa=_0x10c022[_0x906a('0x55')][_0x906a('0x56')]({'plain':!![]});if(!_0x6117fa)throw new Error(_0x906a('0x57'));if(_0x6117fa[_0x906a('0x58')]===_0x906a('0x55')){var _0xa028d4=_0x5dc1f1[_0x906a('0x56')]({'plain':!![]});var _0x506f1c=_0x906a('0x2e');return db['UserProfileSection'][_0x906a('0x52')]({'where':{'name':_0x506f1c,'userProfileId':_0x6117fa[_0x906a('0x59')]},'raw':!![]})[_0x906a('0x2d')](function(_0x18a348){if(_0x18a348&&_0x18a348['autoAssociation']===0x0){return db[_0x906a('0x2f')][_0x906a('0x53')]({'name':_0xa028d4[_0x906a('0x32')],'resourceId':_0xa028d4['id'],'type':_0x18a348[_0x906a('0x32')],'sectionId':_0x18a348['id']},{})[_0x906a('0x2d')](function(){return _0x5dc1f1;});}else{return _0x5dc1f1;}})['catch'](function(_0x88ab21){logger['error'](_0x906a('0x5a'),_0x88ab21);throw _0x88ab21;});}return _0x5dc1f1;})['then'](respondWithResult(_0xeadc7d,0xc9))['catch'](handleError(_0xeadc7d,null));};exports[_0x906a('0x5b')]=function(_0x306758,_0x61fed4){if(_0x306758[_0x906a('0x54')]['id']){delete _0x306758[_0x906a('0x54')]['id'];}return db[_0x906a('0x35')][_0x906a('0x52')]({'where':{'id':_0x306758[_0x906a('0x50')]['id']}})[_0x906a('0x2d')](handleEntityNotFound(_0x61fed4,null))[_0x906a('0x2d')](saveUpdates(_0x306758[_0x906a('0x54')],null))['then'](respondWithResult(_0x61fed4,null))[_0x906a('0x4e')](handleError(_0x61fed4,null));};exports['destroy']=function(_0x10ea6e,_0x39f085){return db[_0x906a('0x35')][_0x906a('0x52')]({'where':{'id':_0x10ea6e[_0x906a('0x50')]['id']}})['then'](handleEntityNotFound(_0x39f085,null))[_0x906a('0x2d')](removeEntity(_0x39f085,null))[_0x906a('0x4e')](handleError(_0x39f085,null));};exports[_0x906a('0x5c')]=function(_0xbc50dd,_0x4d4c22){return db[_0x906a('0x35')][_0x906a('0x5c')]()['then'](respondWithResult(_0x4d4c22,null))[_0x906a('0x4e')](handleError(_0x4d4c22,null));};exports[_0x906a('0x5d')]=function(_0x4c6dd3,_0x36c377,_0x6b269e){var _0x3fdef5={'raw':!![],'where':{}},_0x1debca={},_0x1db31c;return db[_0x906a('0x35')][_0x906a('0x5e')]({'where':{'id':_0x4c6dd3['params']['id']}})[_0x906a('0x2d')](handleEntityNotFound(_0x36c377,null))[_0x906a('0x2d')](function(_0x50ded7){if(_0x50ded7){_0x1db31c=_0x50ded7[_0x906a('0x56')]({'plain':!![]});_0x1debca['model']=_[_0x906a('0x3b')](db[_0x906a('0x5f')][_0x906a('0x36')]);_0x1debca[_0x906a('0x3c')]=_[_0x906a('0x3b')](_0x4c6dd3[_0x906a('0x3c')]);_0x1debca[_0x906a('0x3d')]=_[_0x906a('0x3e')](_0x1debca[_0x906a('0x39')],_0x1debca['query']);_0x3fdef5[_0x906a('0x40')]=_[_0x906a('0x3e')](_0x1debca['model'],qs[_0x906a('0x3f')](_0x4c6dd3[_0x906a('0x3c')][_0x906a('0x3f')]));_0x3fdef5[_0x906a('0x40')]=_0x3fdef5[_0x906a('0x40')][_0x906a('0x41')]?_0x3fdef5['attributes']:_0x1debca[_0x906a('0x39')];if(!_0x4c6dd3[_0x906a('0x3c')]['hasOwnProperty'](_0x906a('0x42'))){_0x3fdef5['limit']=qs['limit'](_0x4c6dd3['query']['limit']);_0x3fdef5[_0x906a('0x25')]=qs[_0x906a('0x25')](_0x4c6dd3['query'][_0x906a('0x25')]);}_0x3fdef5['order']=qs[_0x906a('0x44')](_0x4c6dd3[_0x906a('0x3c')]['sort']);_0x3fdef5['where']=qs[_0x906a('0x3d')](_[_0x906a('0x46')](_0x4c6dd3[_0x906a('0x3c')],_0x1debca[_0x906a('0x3d')]));_0x3fdef5[_0x906a('0x45')][_0x906a('0x60')]=_0x50ded7['id'];if(_0x4c6dd3[_0x906a('0x3c')][_0x906a('0x47')]){_0x3fdef5[_0x906a('0x45')]=_[_0x906a('0x48')](_0x3fdef5[_0x906a('0x45')],{'$or':_[_0x906a('0x3a')](_0x3fdef5[_0x906a('0x40')],function(_0x3799fe){var _0x48f782={};_0x48f782[_0x3799fe]={'$like':'%'+_0x4c6dd3['query'][_0x906a('0x47')]+'%'};return _0x48f782;})});}_0x3fdef5=_[_0x906a('0x48')]({},_0x3fdef5,_0x4c6dd3['options']);return db['UserSmsQueue'][_0x906a('0x4c')](_0x3fdef5);}})['then'](function(_0x47b686){if(_0x47b686){return db[_0x906a('0x61')][_0x906a('0x62')]({'where':{'id':_[_0x906a('0x3a')](_0x47b686,_0x906a('0x63')),'role':_0x906a('0x64')},'attributes':['id','name',_0x906a('0x65'),'updatedAt','createdAt']});}})[_0x906a('0x2d')](function(_0xebabfa){if(_0xebabfa){return{'count':_0xebabfa['count'],'rows':_[_0x906a('0x3a')](_0xebabfa[_0x906a('0x4d')],function(_0x3b1a84){return{'membername':_0x3b1a84['name'],'UserId':_0x3b1a84['id'],'queue_name':_0x1db31c[_0x906a('0x32')],'SmsQueueId':_0x1db31c['id'],'interface':util[_0x906a('0x66')]('%s/%s',_0x906a('0x67'),_0x3b1a84['name']),'penalty':0x0,'paused':_0x3b1a84['smsPause'],'createdAt':_0x3b1a84[_0x906a('0x68')],'updatedAt':_0x3b1a84['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x906a('0x2d')](respondWithFilteredResult(_0x36c377,_0x3fdef5))[_0x906a('0x4e')](handleError(_0x36c377,null));};exports['getTeams']=function(_0x1bf210,_0x3e2a7c,_0x20f94b){var _0x95595={};var _0x242876={};var _0x11a9d3;var _0x53f13e;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf210[_0x906a('0x50')]['id']}})[_0x906a('0x2d')](handleEntityNotFound(_0x3e2a7c,null))[_0x906a('0x2d')](function(_0x4ed5e4){if(_0x4ed5e4){_0x11a9d3=_0x4ed5e4;_0x242876[_0x906a('0x39')]=_[_0x906a('0x3b')](db['Team'][_0x906a('0x36')]);_0x242876['query']=_[_0x906a('0x3b')](_0x1bf210['query']);_0x242876[_0x906a('0x3d')]=_[_0x906a('0x3e')](_0x242876['model'],_0x242876[_0x906a('0x3c')]);_0x95595[_0x906a('0x40')]=_['intersection'](_0x242876[_0x906a('0x39')],qs[_0x906a('0x3f')](_0x1bf210[_0x906a('0x3c')][_0x906a('0x3f')]));_0x95595['attributes']=_0x95595['attributes'][_0x906a('0x41')]?_0x95595[_0x906a('0x40')]:_0x242876[_0x906a('0x39')];_0x95595[_0x906a('0x43')]=qs['sort'](_0x1bf210[_0x906a('0x3c')][_0x906a('0x44')]);_0x95595[_0x906a('0x45')]=qs[_0x906a('0x3d')](_['pick'](_0x1bf210['query'],_0x242876['filters']));if(_0x1bf210[_0x906a('0x3c')][_0x906a('0x47')]){_0x95595[_0x906a('0x45')]=_[_0x906a('0x48')](_0x95595['where'],{'$or':_[_0x906a('0x3a')](_0x95595[_0x906a('0x40')],function(_0x58637c){var _0x3b9157={};_0x3b9157[_0x58637c]={'$like':'%'+_0x1bf210['query'][_0x906a('0x47')]+'%'};return _0x3b9157;})});}_0x95595=_['merge']({},_0x95595,_0x1bf210[_0x906a('0x51')]);return _0x11a9d3[_0x906a('0x69')](_0x95595);}})[_0x906a('0x2d')](function(_0x3307ce){if(_0x3307ce){_0x53f13e=_0x3307ce['length'];if(!_0x1bf210[_0x906a('0x3c')][_0x906a('0x6a')]('nolimit')){_0x95595['limit']=qs[_0x906a('0x23')](_0x1bf210[_0x906a('0x3c')][_0x906a('0x23')]);_0x95595[_0x906a('0x25')]=qs[_0x906a('0x25')](_0x1bf210['query'][_0x906a('0x25')]);}return _0x11a9d3[_0x906a('0x69')](_0x95595);}})[_0x906a('0x2d')](function(_0x3e5a83){if(_0x3e5a83){return _0x3e5a83?{'count':_0x53f13e,'rows':_0x3e5a83}:null;}})[_0x906a('0x2d')](respondWithResult(_0x3e2a7c,null))[_0x906a('0x4e')](handleError(_0x3e2a7c,null));};exports['addTeams']=function(_0x426de5,_0x4e7eee,_0x26e5c5){var _0x14a7f2=_0x426de5[_0x906a('0x54')][_0x906a('0x6b')];return db[_0x906a('0x6c')]['findAll']({'where':{'id':_0x14a7f2},'attributes':['id'],'include':[{'model':db[_0x906a('0x61')],'as':'Agents','attributes':['id',_0x906a('0x32'),_0x906a('0x6d'),_0x906a('0x6e'),_0x906a('0x6f')],'raw':!![]}]})[_0x906a('0x2d')](function(_0x59b970){if(_0x59b970){var _0x52aeb4=_[_0x906a('0x70')](_0x59b970,function(_0x3caec2){var _0x110a31=_0x3caec2[_0x906a('0x56')]({'plain':!![]});return _0x110a31['Agents'];});return db[_0x906a('0x35')][_0x906a('0x52')]({'where':{'id':_0x426de5['params']['id']}})[_0x906a('0x2d')](function(_0x3e8f19){return db['sequelize'][_0x906a('0x71')](function(_0x1e35d0){return _0x3e8f19[_0x906a('0x72')](_0x14a7f2,{'transaction':_0x1e35d0})['then'](function(){return BPromise[_0x906a('0x73')](_0x52aeb4,function(_0x308f52){return db[_0x906a('0x5f')][_0x906a('0x74')]({'where':{'UserId':_0x308f52['id'],'SmsQueueId':_0x426de5[_0x906a('0x50')]['id']},'transaction':_0x1e35d0});});})[_0x906a('0x2d')](function(){_0x52aeb4[_0x906a('0x75')](function(_0x4b86e8){socket[_0x906a('0x76')](_0x906a('0x77'),{'UserId':_0x4b86e8['id'],'SmsQueueId':_0x3e8f19['id']});});});});});}})[_0x906a('0x2d')](respondWithStatusCode(_0x4e7eee,null))[_0x906a('0x4e')](handleError(_0x4e7eee,null));};exports[_0x906a('0x78')]=function(_0x532734,_0x27cf31,_0x1e4f3d){return db[_0x906a('0x6c')][_0x906a('0x4c')]({'where':{'id':_0x532734[_0x906a('0x3c')][_0x906a('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x906a('0x61')],'as':_0x906a('0x79'),'attributes':['id'],'raw':!![]}]})[_0x906a('0x2d')](handleEntityNotFound(_0x27cf31,null))[_0x906a('0x2d')](function(_0x521665){var _0x1ebe0f=_[_0x906a('0x3a')](_0x521665,'id');var _0x362ca9=[];var _0x5bb808=[];var _0x15720a=squel[_0x906a('0x7a')]();_0x15720a[_0x906a('0x7b')](_0x906a('0x7c'))[_0x906a('0x7d')]('team_has_sms_queues','tq')[_0x906a('0x7e')](_0x906a('0x7f'),'ut',_0x906a('0x80'))[_0x906a('0x45')](_0x906a('0x81'),_0x532734[_0x906a('0x50')]['id']);for(var _0x1a5873=0x0;_0x1a5873<_0x521665[_0x906a('0x41')];_0x1a5873+=0x1){let _0x306b1b=_0x521665[_0x1a5873];for(var _0x1fac6b=0x0;_0x1fac6b<_0x306b1b['Agents']['length'];_0x1fac6b+=0x1){let _0x17849e=_0x306b1b[_0x906a('0x79')][_0x1fac6b];var _0x3dcc74=_0x15720a[_0x906a('0x82')]();_0x3dcc74[_0x906a('0x45')](_0x906a('0x83'),_0x17849e['id']);_0x5bb808[_0x906a('0x84')](db['sequelize']['query'](_0x3dcc74['toString'](),{'type':db[_0x906a('0x85')][_0x906a('0x86')][_0x906a('0x87')]})[_0x906a('0x2d')](function(_0x20eb09){if(_0x20eb09['length']===0x1){return _0x17849e['id'];}else{var _0x28689b=_[_0x906a('0x88')](_[_0x906a('0x3a')](_0x20eb09,'TeamId'),function(_0x206206){return _[_0x906a('0x89')](_0x1ebe0f,_0x206206);});if(_0x28689b){return _0x17849e['id'];}}}));}}return BPromise[_0x906a('0x8a')](_0x5bb808)[_0x906a('0x2d')](function(_0x4d98cf){_0x362ca9=_(_0x362ca9)[_0x906a('0x8b')](_0x4d98cf)[_0x906a('0x8c')]()[_0x906a('0x8d')]();return db[_0x906a('0x35')]['find']({'where':{'id':_0x532734['params']['id']}})[_0x906a('0x2d')](function(_0xc8cc2e){return db[_0x906a('0x85')][_0x906a('0x71')](function(_0x3b9143){return _0xc8cc2e[_0x906a('0x78')](_0x532734['query']['ids'],{'transaction':_0x3b9143})[_0x906a('0x2d')](function(){if(!_[_0x906a('0x8e')](_0x362ca9)){return _0xc8cc2e['removeAgents'](_0x362ca9,{'transaction':_0x3b9143});}})[_0x906a('0x2d')](function(){_0x362ca9[_0x906a('0x75')](function(_0x3a831f){socket[_0x906a('0x76')](_0x906a('0x8f'),{'UserId':_0x3a831f,'SmsQueueId':_0xc8cc2e['id']});});});});});});})[_0x906a('0x2d')](respondWithStatusCode(_0x27cf31,null))['catch'](handleError(_0x27cf31,null));};exports[_0x906a('0x90')]=function(_0x1ba268,_0x34c488,_0x44717c){return db['SmsQueue'][_0x906a('0x52')]({'where':{'id':_0x1ba268[_0x906a('0x50')]['id']}})[_0x906a('0x2d')](handleEntityNotFound(_0x34c488,null))[_0x906a('0x2d')](function(_0x4d860a){if(_0x4d860a){return _0x4d860a[_0x906a('0x90')](_0x1ba268[_0x906a('0x54')][_0x906a('0x6b')],_['omit'](_0x1ba268[_0x906a('0x54')],[_0x906a('0x6b'),'id'])||{})[_0x906a('0x91')](function(_0x4e0b5d){for(var _0x3976fd=0x0;_0x3976fd<_0x1ba268['body'][_0x906a('0x6b')][_0x906a('0x41')];_0x3976fd+=0x1){socket[_0x906a('0x76')]('userSmsQueue:save',{'UserId':Number(_0x1ba268['body'][_0x906a('0x6b')][_0x3976fd]),'SmsQueueId':Number(_0x1ba268['params']['id'])});}return _0x4e0b5d;});}})['then'](respondWithResult(_0x34c488,null))[_0x906a('0x4e')](handleError(_0x34c488,null));};exports[_0x906a('0x92')]=function(_0x44f3a9,_0x529d65,_0x6fe016){return db[_0x906a('0x35')][_0x906a('0x52')]({'where':{'id':_0x44f3a9[_0x906a('0x50')]['id']}})[_0x906a('0x2d')](handleEntityNotFound(_0x529d65,null))[_0x906a('0x2d')](function(_0x23f3ea){if(_0x23f3ea){return _0x23f3ea[_0x906a('0x92')](_0x44f3a9[_0x906a('0x3c')][_0x906a('0x6b')])['then'](function(){if(_[_0x906a('0x93')](_0x44f3a9[_0x906a('0x3c')][_0x906a('0x6b')])){for(var _0x326db6=0x0;_0x326db6<_0x44f3a9[_0x906a('0x3c')]['ids'][_0x906a('0x41')];_0x326db6+=0x1){socket[_0x906a('0x76')](_0x906a('0x8f'),{'UserId':Number(_0x44f3a9['query']['ids'][_0x326db6]),'SmsQueueId':Number(_0x44f3a9[_0x906a('0x50')]['id'])});}}else{socket[_0x906a('0x76')](_0x906a('0x8f'),{'UserId':Number(_0x44f3a9[_0x906a('0x3c')][_0x906a('0x6b')]),'SmsQueueId':Number(_0x44f3a9[_0x906a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x529d65,null))['catch'](handleError(_0x529d65,null));};exports[_0x906a('0x94')]=function(_0x51ca55,_0x3cf5ad,_0x238ff1){var _0x48136b={};var _0x959d65={};var _0x2561c5;var _0x4ba481;return db[_0x906a('0x35')][_0x906a('0x5e')]({'where':{'id':_0x51ca55[_0x906a('0x50')]['id']}})[_0x906a('0x2d')](handleEntityNotFound(_0x3cf5ad,null))[_0x906a('0x2d')](function(_0x199536){if(_0x199536){_0x2561c5=_0x199536;_0x959d65[_0x906a('0x39')]=_[_0x906a('0x3b')](db[_0x906a('0x61')][_0x906a('0x36')]);_0x959d65['query']=_['keys'](_0x51ca55[_0x906a('0x3c')]);_0x959d65['filters']=_[_0x906a('0x3e')](_0x959d65['model'],_0x959d65[_0x906a('0x3c')]);_0x48136b[_0x906a('0x40')]=_[_0x906a('0x3e')](_0x959d65[_0x906a('0x39')],qs[_0x906a('0x3f')](_0x51ca55[_0x906a('0x3c')][_0x906a('0x3f')]));_0x48136b[_0x906a('0x40')]=_0x48136b[_0x906a('0x40')][_0x906a('0x41')]?_0x48136b[_0x906a('0x40')]:_0x959d65['model'];_0x48136b['order']=qs[_0x906a('0x44')](_0x51ca55['query'][_0x906a('0x44')]);_0x48136b[_0x906a('0x45')]=qs[_0x906a('0x3d')](_[_0x906a('0x46')](_0x51ca55[_0x906a('0x3c')],_0x959d65[_0x906a('0x3d')]));if(_0x51ca55[_0x906a('0x3c')][_0x906a('0x47')]){_0x48136b[_0x906a('0x45')]=_[_0x906a('0x48')](_0x48136b[_0x906a('0x45')],{'$or':_[_0x906a('0x3a')](_0x48136b[_0x906a('0x40')],function(_0x390ac0){var _0x4effdc={};_0x4effdc[_0x390ac0]={'$like':'%'+_0x51ca55[_0x906a('0x3c')]['filter']+'%'};return _0x4effdc;})});}_0x48136b=_[_0x906a('0x48')]({},_0x48136b,_0x51ca55['options']);return _0x2561c5[_0x906a('0x94')](_0x48136b);}})[_0x906a('0x2d')](function(_0x3d61d1){if(_0x3d61d1){_0x4ba481=_0x3d61d1[_0x906a('0x41')];if(!_0x51ca55[_0x906a('0x3c')][_0x906a('0x6a')]('nolimit')){_0x48136b[_0x906a('0x23')]=qs[_0x906a('0x23')](_0x51ca55[_0x906a('0x3c')][_0x906a('0x23')]);_0x48136b[_0x906a('0x25')]=qs[_0x906a('0x25')](_0x51ca55['query'][_0x906a('0x25')]);}return _0x2561c5[_0x906a('0x94')](_0x48136b);}})[_0x906a('0x2d')](function(_0x546c75){if(_0x546c75){return _0x546c75?{'count':_0x4ba481,'rows':_0x546c75}:null;}})[_0x906a('0x2d')](respondWithResult(_0x3cf5ad,null))[_0x906a('0x4e')](handleError(_0x3cf5ad,null));}; \ No newline at end of file +var _0x0298=['SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','emit','userSmsQueue:save','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x20a278,_0x50c587){var _0x457db=function(_0x5c6322){while(--_0x5c6322){_0x20a278['push'](_0x20a278['shift']());}};_0x457db(++_0x50c587);}(_0x0298,0x1bb));var _0x8029=function(_0x4afe48,_0x3bf8fb){_0x4afe48=_0x4afe48-0x0;var _0x34f37d=_0x0298[_0x4afe48];return _0x34f37d;};'use strict';var emlformat=require(_0x8029('0x0'));var rimraf=require(_0x8029('0x1'));var zipdir=require(_0x8029('0x2'));var jsonpatch=require(_0x8029('0x3'));var rp=require(_0x8029('0x4'));var moment=require(_0x8029('0x5'));var BPromise=require(_0x8029('0x6'));var Mustache=require('mustache');var util=require(_0x8029('0x7'));var path=require(_0x8029('0x8'));var sox=require(_0x8029('0x9'));var csv=require(_0x8029('0xa'));var ejs=require(_0x8029('0xb'));var fs=require('fs');var fs_extra=require(_0x8029('0xc'));var _=require(_0x8029('0xd'));var squel=require(_0x8029('0xe'));var crypto=require('crypto');var jsforce=require(_0x8029('0xf'));var deskjs=require(_0x8029('0x10'));var toCsv=require(_0x8029('0xa'));var querystring=require(_0x8029('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8029('0x12'));var qs=require(_0x8029('0x13'));var as=require(_0x8029('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8029('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8029('0x16'));var licenseUtil=require(_0x8029('0x17'));var db=require(_0x8029('0x18'))['db'];config[_0x8029('0x19')]=_[_0x8029('0x1a')](config['redis'],{'host':_0x8029('0x1b'),'port':0x18eb});var socket=require(_0x8029('0x1c'))(new Redis(config[_0x8029('0x19')]));require(_0x8029('0x1d'))['register'](socket);function respondWithStatusCode(_0x371f6f,_0x627009){_0x627009=_0x627009||0xcc;return function(_0x35ec16){if(_0x35ec16){return _0x371f6f[_0x8029('0x1e')](_0x627009);}return _0x371f6f[_0x8029('0x1f')](_0x627009)[_0x8029('0x20')]();};}function respondWithResult(_0xf9d011,_0x4e1c8b){_0x4e1c8b=_0x4e1c8b||0xc8;return function(_0x2fbd70){if(_0x2fbd70){return _0xf9d011[_0x8029('0x1f')](_0x4e1c8b)[_0x8029('0x21')](_0x2fbd70);}};}function respondWithFilteredResult(_0x190474,_0x4baa97){return function(_0x5048f0){if(_0x5048f0){var _0x113dad=typeof _0x4baa97[_0x8029('0x22')]===_0x8029('0x23')&&typeof _0x4baa97[_0x8029('0x24')]===_0x8029('0x23');var _0x41b8d2=_0x5048f0['count'];var _0xbe7231=_0x113dad?0x0:_0x4baa97[_0x8029('0x22')];var _0x49cd02=_0x113dad?_0x5048f0[_0x8029('0x25')]:_0x4baa97['offset']+_0x4baa97[_0x8029('0x24')];var _0x7788c7;if(_0x49cd02>=_0x41b8d2){_0x49cd02=_0x41b8d2;_0x7788c7=0xc8;}else{_0x7788c7=0xce;}_0x190474[_0x8029('0x1f')](_0x7788c7);return _0x190474[_0x8029('0x26')]('Content-Range',_0xbe7231+'-'+_0x49cd02+'/'+_0x41b8d2)[_0x8029('0x21')](_0x5048f0);}return null;};}function patchUpdates(_0x335ece){return function(_0x39c67c){try{jsonpatch['apply'](_0x39c67c,_0x335ece,!![]);}catch(_0x161bcd){return BPromise[_0x8029('0x27')](_0x161bcd);}return _0x39c67c[_0x8029('0x28')]();};}function saveUpdates(_0x187ff7,_0x4a1d68){return function(_0x4481a6){if(_0x4481a6){return _0x4481a6[_0x8029('0x29')](_0x187ff7)[_0x8029('0x2a')](function(_0x51f287){return _0x51f287;});}return null;};}function removeEntity(_0x5e9594,_0x1a1cb8){return function(_0xa1de5e){if(_0xa1de5e){return _0xa1de5e[_0x8029('0x2b')]()['then'](function(){var _0x4072f5=_0xa1de5e[_0x8029('0x2c')]({'plain':!![]});var _0x5acb0b=_0x8029('0x2d');return db[_0x8029('0x2e')]['destroy']({'where':{'type':_0x5acb0b,'resourceId':_0x4072f5['id']}})['then'](function(){return _0xa1de5e;});})[_0x8029('0x2a')](function(){_0x5e9594[_0x8029('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fa2b,_0xdf5f75){return function(_0x1248ce){if(!_0x1248ce){_0x49fa2b['sendStatus'](0x194);}return _0x1248ce;};}function handleError(_0x44ce94,_0x20a34f){_0x20a34f=_0x20a34f||0x1f4;return function(_0x18262b){logger[_0x8029('0x2f')](_0x18262b[_0x8029('0x30')]);if(_0x18262b[_0x8029('0x31')]){delete _0x18262b['name'];}_0x44ce94['status'](_0x20a34f)['send'](_0x18262b);};}exports[_0x8029('0x32')]=function(_0x33718e,_0x45a643){var _0x47315b={},_0x4eee71={},_0x2af695={'count':0x0,'rows':[]};var _0x40cd9c=_[_0x8029('0x33')](db[_0x8029('0x34')][_0x8029('0x35')],function(_0x4d203e){return{'name':_0x4d203e[_0x8029('0x36')],'type':_0x4d203e[_0x8029('0x37')][_0x8029('0x38')]};});_0x4eee71[_0x8029('0x39')]=_[_0x8029('0x33')](_0x40cd9c,_0x8029('0x31'));_0x4eee71[_0x8029('0x3a')]=_[_0x8029('0x3b')](_0x33718e[_0x8029('0x3a')]);_0x4eee71['filters']=_[_0x8029('0x3c')](_0x4eee71['model'],_0x4eee71[_0x8029('0x3a')]);_0x47315b[_0x8029('0x3d')]=_[_0x8029('0x3c')](_0x4eee71[_0x8029('0x39')],qs[_0x8029('0x3e')](_0x33718e[_0x8029('0x3a')][_0x8029('0x3e')]));_0x47315b[_0x8029('0x3d')]=_0x47315b[_0x8029('0x3d')][_0x8029('0x3f')]?_0x47315b[_0x8029('0x3d')]:_0x4eee71[_0x8029('0x39')];if(!_0x33718e[_0x8029('0x3a')][_0x8029('0x40')](_0x8029('0x41'))){_0x47315b['limit']=qs[_0x8029('0x24')](_0x33718e[_0x8029('0x3a')][_0x8029('0x24')]);_0x47315b[_0x8029('0x22')]=qs[_0x8029('0x22')](_0x33718e[_0x8029('0x3a')]['offset']);}_0x47315b['order']=qs[_0x8029('0x42')](_0x33718e['query'][_0x8029('0x42')]);_0x47315b[_0x8029('0x43')]=qs[_0x8029('0x44')](_[_0x8029('0x45')](_0x33718e[_0x8029('0x3a')],_0x4eee71['filters']),_0x40cd9c);if(_0x33718e[_0x8029('0x3a')][_0x8029('0x46')]){_0x47315b[_0x8029('0x43')]=_[_0x8029('0x47')](_0x47315b[_0x8029('0x43')],{'$or':_['map'](_0x40cd9c,function(_0x33b7ca){if(_0x33b7ca[_0x8029('0x37')]!==_0x8029('0x48')){var _0x5b8945={};_0x5b8945[_0x33b7ca[_0x8029('0x31')]]={'$like':'%'+_0x33718e[_0x8029('0x3a')][_0x8029('0x46')]+'%'};return _0x5b8945;}})});}_0x47315b=_[_0x8029('0x47')]({},_0x47315b,_0x33718e[_0x8029('0x49')]);var _0x1c37fe={'where':_0x47315b[_0x8029('0x43')]};return db[_0x8029('0x34')]['count'](_0x1c37fe)[_0x8029('0x2a')](function(_0x51150a){_0x2af695[_0x8029('0x25')]=_0x51150a;if(_0x33718e[_0x8029('0x3a')][_0x8029('0x4a')]){_0x47315b[_0x8029('0x4b')]=[{'all':!![]}];}return db[_0x8029('0x34')][_0x8029('0x4c')](_0x47315b);})[_0x8029('0x2a')](function(_0xd871b3){_0x2af695[_0x8029('0x4d')]=_0xd871b3;return _0x2af695;})[_0x8029('0x2a')](respondWithFilteredResult(_0x45a643,_0x47315b))['catch'](handleError(_0x45a643,null));};exports['show']=function(_0x31bb3f,_0x9ebb7e){var _0x527327={'raw':!![],'where':{'id':_0x31bb3f['params']['id']}},_0x2a9aa9={};_0x2a9aa9[_0x8029('0x39')]=_[_0x8029('0x3b')](db['SmsQueue'][_0x8029('0x35')]);_0x2a9aa9['query']=_[_0x8029('0x3b')](_0x31bb3f[_0x8029('0x3a')]);_0x2a9aa9[_0x8029('0x44')]=_[_0x8029('0x3c')](_0x2a9aa9['model'],_0x2a9aa9[_0x8029('0x3a')]);_0x527327[_0x8029('0x3d')]=_[_0x8029('0x3c')](_0x2a9aa9[_0x8029('0x39')],qs[_0x8029('0x3e')](_0x31bb3f[_0x8029('0x3a')]['fields']));_0x527327['attributes']=_0x527327[_0x8029('0x3d')]['length']?_0x527327[_0x8029('0x3d')]:_0x2a9aa9['model'];if(_0x31bb3f[_0x8029('0x3a')][_0x8029('0x4a')]){_0x527327['include']=[{'all':!![]}];}_0x527327=_['merge']({},_0x527327,_0x31bb3f[_0x8029('0x49')]);return db[_0x8029('0x34')][_0x8029('0x4e')](_0x527327)['then'](handleEntityNotFound(_0x9ebb7e,null))[_0x8029('0x2a')](respondWithResult(_0x9ebb7e,null))[_0x8029('0x4f')](handleError(_0x9ebb7e,null));};exports[_0x8029('0x50')]=function(_0x28db11,_0x486aba){return db['SmsQueue']['create'](_0x28db11[_0x8029('0x51')],{})[_0x8029('0x2a')](function(_0xde6cc6){var _0xda7b2f=_0x28db11['user']['get']({'plain':!![]});if(!_0xda7b2f)throw new Error(_0x8029('0x52'));if(_0xda7b2f['role']===_0x8029('0x53')){var _0x1e790f=_0xde6cc6[_0x8029('0x2c')]({'plain':!![]});var _0x549714=_0x8029('0x2d');return db[_0x8029('0x54')][_0x8029('0x4e')]({'where':{'name':_0x549714,'userProfileId':_0xda7b2f['userProfileId']},'raw':!![]})['then'](function(_0x286835){if(_0x286835&&_0x286835[_0x8029('0x55')]===0x0){return db[_0x8029('0x2e')][_0x8029('0x50')]({'name':_0x1e790f['name'],'resourceId':_0x1e790f['id'],'type':_0x286835[_0x8029('0x31')],'sectionId':_0x286835['id']},{})['then'](function(){return _0xde6cc6;});}else{return _0xde6cc6;}})[_0x8029('0x4f')](function(_0x59157e){logger[_0x8029('0x2f')](_0x8029('0x56'),_0x59157e);throw _0x59157e;});}return _0xde6cc6;})[_0x8029('0x2a')](respondWithResult(_0x486aba,0xc9))[_0x8029('0x4f')](handleError(_0x486aba,null));};exports[_0x8029('0x29')]=function(_0x2b5ac6,_0x67d9e){if(_0x2b5ac6['body']['id']){delete _0x2b5ac6[_0x8029('0x51')]['id'];}return db[_0x8029('0x34')][_0x8029('0x4e')]({'where':{'id':_0x2b5ac6[_0x8029('0x57')]['id']}})[_0x8029('0x2a')](handleEntityNotFound(_0x67d9e,null))['then'](saveUpdates(_0x2b5ac6[_0x8029('0x51')],null))[_0x8029('0x2a')](respondWithResult(_0x67d9e,null))[_0x8029('0x4f')](handleError(_0x67d9e,null));};exports[_0x8029('0x2b')]=function(_0x2da032,_0x3feed4){return db[_0x8029('0x34')][_0x8029('0x4e')]({'where':{'id':_0x2da032[_0x8029('0x57')]['id']}})[_0x8029('0x2a')](handleEntityNotFound(_0x3feed4,null))[_0x8029('0x2a')](removeEntity(_0x3feed4,null))[_0x8029('0x4f')](handleError(_0x3feed4,null));};exports[_0x8029('0x58')]=function(_0x37097e,_0xf976f0){return db[_0x8029('0x34')]['describe']()['then'](respondWithResult(_0xf976f0,null))['catch'](handleError(_0xf976f0,null));};exports[_0x8029('0x59')]=function(_0x19b17f,_0x18448d,_0x2ea227){var _0x28cad1={'raw':!![],'where':{}},_0x4f5249={},_0x4b2c05;return db[_0x8029('0x34')][_0x8029('0x5a')]({'where':{'id':_0x19b17f[_0x8029('0x57')]['id']}})[_0x8029('0x2a')](handleEntityNotFound(_0x18448d,null))[_0x8029('0x2a')](function(_0x35ddd0){if(_0x35ddd0){_0x4b2c05=_0x35ddd0['get']({'plain':!![]});_0x4f5249[_0x8029('0x39')]=_['keys'](db[_0x8029('0x5b')][_0x8029('0x35')]);_0x4f5249['query']=_[_0x8029('0x3b')](_0x19b17f[_0x8029('0x3a')]);_0x4f5249[_0x8029('0x44')]=_[_0x8029('0x3c')](_0x4f5249['model'],_0x4f5249[_0x8029('0x3a')]);_0x28cad1[_0x8029('0x3d')]=_[_0x8029('0x3c')](_0x4f5249[_0x8029('0x39')],qs[_0x8029('0x3e')](_0x19b17f['query'][_0x8029('0x3e')]));_0x28cad1['attributes']=_0x28cad1['attributes']['length']?_0x28cad1['attributes']:_0x4f5249[_0x8029('0x39')];if(!_0x19b17f[_0x8029('0x3a')]['hasOwnProperty'](_0x8029('0x41'))){_0x28cad1[_0x8029('0x24')]=qs[_0x8029('0x24')](_0x19b17f[_0x8029('0x3a')][_0x8029('0x24')]);_0x28cad1['offset']=qs[_0x8029('0x22')](_0x19b17f[_0x8029('0x3a')]['offset']);}_0x28cad1[_0x8029('0x5c')]=qs[_0x8029('0x42')](_0x19b17f[_0x8029('0x3a')][_0x8029('0x42')]);_0x28cad1[_0x8029('0x43')]=qs[_0x8029('0x44')](_[_0x8029('0x45')](_0x19b17f['query'],_0x4f5249[_0x8029('0x44')]));_0x28cad1[_0x8029('0x43')][_0x8029('0x5d')]=_0x35ddd0['id'];if(_0x19b17f['query'][_0x8029('0x46')]){_0x28cad1[_0x8029('0x43')]=_[_0x8029('0x47')](_0x28cad1['where'],{'$or':_[_0x8029('0x33')](_0x28cad1[_0x8029('0x3d')],function(_0x4dbc9e){var _0x101b0b={};_0x101b0b[_0x4dbc9e]={'$like':'%'+_0x19b17f[_0x8029('0x3a')][_0x8029('0x46')]+'%'};return _0x101b0b;})});}_0x28cad1=_[_0x8029('0x47')]({},_0x28cad1,_0x19b17f[_0x8029('0x49')]);return db[_0x8029('0x5b')]['findAll'](_0x28cad1);}})[_0x8029('0x2a')](function(_0x3674cc){if(_0x3674cc){return db[_0x8029('0x5e')][_0x8029('0x5f')]({'where':{'id':_[_0x8029('0x33')](_0x3674cc,_0x8029('0x60')),'role':'agent'},'attributes':['id',_0x8029('0x31'),_0x8029('0x61'),_0x8029('0x62'),_0x8029('0x63')]});}})[_0x8029('0x2a')](function(_0x4789e1){if(_0x4789e1){return{'count':_0x4789e1[_0x8029('0x25')],'rows':_[_0x8029('0x33')](_0x4789e1['rows'],function(_0x2e1988){return{'membername':_0x2e1988[_0x8029('0x31')],'UserId':_0x2e1988['id'],'queue_name':_0x4b2c05['name'],'SmsQueueId':_0x4b2c05['id'],'interface':util['format']('%s/%s',_0x8029('0x64'),_0x2e1988[_0x8029('0x31')]),'penalty':0x0,'paused':_0x2e1988['smsPause'],'createdAt':_0x2e1988['createdAt'],'updatedAt':_0x2e1988[_0x8029('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8029('0x2a')](respondWithFilteredResult(_0x18448d,_0x28cad1))[_0x8029('0x4f')](handleError(_0x18448d,null));};exports[_0x8029('0x65')]=function(_0x58ccdb,_0xaf1c69,_0x42f53e){var _0x50d83a={};var _0x4d505a={};var _0x2cf543;var _0x429425;return db[_0x8029('0x34')][_0x8029('0x5a')]({'where':{'id':_0x58ccdb[_0x8029('0x57')]['id']}})[_0x8029('0x2a')](handleEntityNotFound(_0xaf1c69,null))[_0x8029('0x2a')](function(_0x1d4663){if(_0x1d4663){_0x2cf543=_0x1d4663;_0x4d505a[_0x8029('0x39')]=_[_0x8029('0x3b')](db[_0x8029('0x66')][_0x8029('0x35')]);_0x4d505a[_0x8029('0x3a')]=_[_0x8029('0x3b')](_0x58ccdb[_0x8029('0x3a')]);_0x4d505a[_0x8029('0x44')]=_[_0x8029('0x3c')](_0x4d505a[_0x8029('0x39')],_0x4d505a[_0x8029('0x3a')]);_0x50d83a[_0x8029('0x3d')]=_[_0x8029('0x3c')](_0x4d505a[_0x8029('0x39')],qs['fields'](_0x58ccdb[_0x8029('0x3a')][_0x8029('0x3e')]));_0x50d83a['attributes']=_0x50d83a[_0x8029('0x3d')][_0x8029('0x3f')]?_0x50d83a[_0x8029('0x3d')]:_0x4d505a[_0x8029('0x39')];_0x50d83a[_0x8029('0x5c')]=qs[_0x8029('0x42')](_0x58ccdb[_0x8029('0x3a')][_0x8029('0x42')]);_0x50d83a[_0x8029('0x43')]=qs[_0x8029('0x44')](_['pick'](_0x58ccdb['query'],_0x4d505a[_0x8029('0x44')]));if(_0x58ccdb['query'][_0x8029('0x46')]){_0x50d83a['where']=_[_0x8029('0x47')](_0x50d83a[_0x8029('0x43')],{'$or':_[_0x8029('0x33')](_0x50d83a[_0x8029('0x3d')],function(_0x3271e4){var _0x4ab076={};_0x4ab076[_0x3271e4]={'$like':'%'+_0x58ccdb['query']['filter']+'%'};return _0x4ab076;})});}_0x50d83a=_[_0x8029('0x47')]({},_0x50d83a,_0x58ccdb[_0x8029('0x49')]);return _0x2cf543[_0x8029('0x65')](_0x50d83a);}})[_0x8029('0x2a')](function(_0x58c4ba){if(_0x58c4ba){_0x429425=_0x58c4ba[_0x8029('0x3f')];if(!_0x58ccdb[_0x8029('0x3a')]['hasOwnProperty'](_0x8029('0x41'))){_0x50d83a[_0x8029('0x24')]=qs[_0x8029('0x24')](_0x58ccdb[_0x8029('0x3a')][_0x8029('0x24')]);_0x50d83a[_0x8029('0x22')]=qs[_0x8029('0x22')](_0x58ccdb[_0x8029('0x3a')][_0x8029('0x22')]);}return _0x2cf543[_0x8029('0x65')](_0x50d83a);}})['then'](function(_0x3a16e1){if(_0x3a16e1){return _0x3a16e1?{'count':_0x429425,'rows':_0x3a16e1}:null;}})[_0x8029('0x2a')](respondWithResult(_0xaf1c69,null))[_0x8029('0x4f')](handleError(_0xaf1c69,null));};exports[_0x8029('0x67')]=function(_0x2b2cc5,_0x343a00,_0x45fd04){var _0xbb3d00=_0x2b2cc5[_0x8029('0x51')][_0x8029('0x68')];return db['Team'][_0x8029('0x4c')]({'where':{'id':_0xbb3d00},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8029('0x69'),'attributes':['id',_0x8029('0x31'),_0x8029('0x6a'),_0x8029('0x6b'),'interface'],'raw':!![]}]})[_0x8029('0x2a')](function(_0x35e698){if(_0x35e698){var _0x3771b3=_[_0x8029('0x6c')](_0x35e698,function(_0x2a0ea5){var _0x2c34b7=_0x2a0ea5['get']({'plain':!![]});return _0x2c34b7[_0x8029('0x69')];});return db[_0x8029('0x34')]['find']({'where':{'id':_0x2b2cc5['params']['id']}})[_0x8029('0x2a')](function(_0x1e8bbd){return db['sequelize'][_0x8029('0x6d')](function(_0x59c4c4){return _0x1e8bbd[_0x8029('0x67')](_0xbb3d00,{'transaction':_0x59c4c4})[_0x8029('0x2a')](function(){return BPromise['each'](_0x3771b3,function(_0x3c3ed6){return db[_0x8029('0x5b')]['findOrCreate']({'where':{'UserId':_0x3c3ed6['id'],'SmsQueueId':_0x2b2cc5[_0x8029('0x57')]['id']},'transaction':_0x59c4c4});});})[_0x8029('0x2a')](function(){_0x3771b3['forEach'](function(_0x11e4a8){socket[_0x8029('0x6e')](_0x8029('0x6f'),{'UserId':_0x11e4a8['id'],'SmsQueueId':_0x1e8bbd['id']});});});});});}})[_0x8029('0x2a')](respondWithStatusCode(_0x343a00,null))[_0x8029('0x4f')](handleError(_0x343a00,null));};exports['removeTeams']=function(_0x14a909,_0xe474f1,_0x2b1845){return db[_0x8029('0x66')][_0x8029('0x4c')]({'where':{'id':_0x14a909[_0x8029('0x3a')][_0x8029('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8029('0x5e')],'as':_0x8029('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe474f1,null))[_0x8029('0x2a')](function(_0x217537){var _0x234a2f=_[_0x8029('0x33')](_0x217537,'id');var _0x40f27c=[];var _0x1ee0e3=[];var _0x386598=squel['select']();_0x386598[_0x8029('0x70')](_0x8029('0x71'))[_0x8029('0x72')]('team_has_sms_queues','tq')[_0x8029('0x73')]('user_has_teams','ut',_0x8029('0x74'))['where'](_0x8029('0x75'),_0x14a909[_0x8029('0x57')]['id']);for(var _0x3c6d21=0x0;_0x3c6d21<_0x217537['length'];_0x3c6d21+=0x1){let _0x5ef55b=_0x217537[_0x3c6d21];for(var _0x1b41e7=0x0;_0x1b41e7<_0x5ef55b[_0x8029('0x69')][_0x8029('0x3f')];_0x1b41e7+=0x1){let _0x30980f=_0x5ef55b[_0x8029('0x69')][_0x1b41e7];var _0x4dcc86=_0x386598[_0x8029('0x76')]();_0x4dcc86[_0x8029('0x43')](_0x8029('0x77'),_0x30980f['id']);_0x1ee0e3[_0x8029('0x78')](db[_0x8029('0x79')][_0x8029('0x3a')](_0x4dcc86[_0x8029('0x7a')](),{'type':db['sequelize'][_0x8029('0x7b')][_0x8029('0x7c')]})[_0x8029('0x2a')](function(_0x4e9dc6){if(_0x4e9dc6[_0x8029('0x3f')]===0x1){return _0x30980f['id'];}else{var _0x3fc0f4=_['every'](_[_0x8029('0x33')](_0x4e9dc6,_0x8029('0x7d')),function(_0x6b88e6){return _[_0x8029('0x7e')](_0x234a2f,_0x6b88e6);});if(_0x3fc0f4){return _0x30980f['id'];}}}));}}return BPromise[_0x8029('0x7f')](_0x1ee0e3)[_0x8029('0x2a')](function(_0x54ec94){_0x40f27c=_(_0x40f27c)[_0x8029('0x80')](_0x54ec94)[_0x8029('0x81')]()[_0x8029('0x82')]();return db['SmsQueue'][_0x8029('0x4e')]({'where':{'id':_0x14a909[_0x8029('0x57')]['id']}})[_0x8029('0x2a')](function(_0x3c2ae5){return db[_0x8029('0x79')]['transaction'](function(_0xcb410f){return _0x3c2ae5[_0x8029('0x83')](_0x14a909[_0x8029('0x3a')]['ids'],{'transaction':_0xcb410f})[_0x8029('0x2a')](function(){if(!_[_0x8029('0x84')](_0x40f27c)){return _0x3c2ae5[_0x8029('0x85')](_0x40f27c,{'transaction':_0xcb410f});}})[_0x8029('0x2a')](function(){_0x40f27c['forEach'](function(_0x72bfee){socket[_0x8029('0x6e')](_0x8029('0x86'),{'UserId':_0x72bfee,'SmsQueueId':_0x3c2ae5['id']});});});});});});})[_0x8029('0x2a')](respondWithStatusCode(_0xe474f1,null))[_0x8029('0x4f')](handleError(_0xe474f1,null));};exports['addAgents']=function(_0x5c1f3d,_0x555648,_0xb5dd2e){return db['SmsQueue'][_0x8029('0x4e')]({'where':{'id':_0x5c1f3d[_0x8029('0x57')]['id']}})[_0x8029('0x2a')](handleEntityNotFound(_0x555648,null))[_0x8029('0x2a')](function(_0x49938d){if(_0x49938d){return _0x49938d[_0x8029('0x87')](_0x5c1f3d['body']['ids'],_[_0x8029('0x88')](_0x5c1f3d[_0x8029('0x51')],['ids','id'])||{})[_0x8029('0x89')](function(_0x20456f){for(var _0x27fa48=0x0;_0x27fa48<_0x5c1f3d['body'][_0x8029('0x68')][_0x8029('0x3f')];_0x27fa48+=0x1){socket[_0x8029('0x6e')](_0x8029('0x6f'),{'UserId':Number(_0x5c1f3d[_0x8029('0x51')][_0x8029('0x68')][_0x27fa48]),'SmsQueueId':Number(_0x5c1f3d[_0x8029('0x57')]['id'])});}return _0x20456f;});}})[_0x8029('0x2a')](respondWithResult(_0x555648,null))['catch'](handleError(_0x555648,null));};exports[_0x8029('0x85')]=function(_0x44c1a5,_0x3b2abe,_0x5eddf7){return db[_0x8029('0x34')][_0x8029('0x4e')]({'where':{'id':_0x44c1a5['params']['id']}})[_0x8029('0x2a')](handleEntityNotFound(_0x3b2abe,null))['then'](function(_0x263947){if(_0x263947){return _0x263947[_0x8029('0x85')](_0x44c1a5[_0x8029('0x3a')][_0x8029('0x68')])[_0x8029('0x2a')](function(){if(_[_0x8029('0x8a')](_0x44c1a5[_0x8029('0x3a')]['ids'])){for(var _0x5dfe5d=0x0;_0x5dfe5d<_0x44c1a5['query'][_0x8029('0x68')][_0x8029('0x3f')];_0x5dfe5d+=0x1){socket[_0x8029('0x6e')](_0x8029('0x86'),{'UserId':Number(_0x44c1a5[_0x8029('0x3a')][_0x8029('0x68')][_0x5dfe5d]),'SmsQueueId':Number(_0x44c1a5[_0x8029('0x57')]['id'])});}}else{socket[_0x8029('0x6e')](_0x8029('0x86'),{'UserId':Number(_0x44c1a5[_0x8029('0x3a')][_0x8029('0x68')]),'SmsQueueId':Number(_0x44c1a5[_0x8029('0x57')]['id'])});}});}})[_0x8029('0x2a')](respondWithStatusCode(_0x3b2abe,null))[_0x8029('0x4f')](handleError(_0x3b2abe,null));};exports[_0x8029('0x8b')]=function(_0x5e6a26,_0x4af9d1,_0x5a2907){var _0x2eba33={};var _0x232680={};var _0x46e55d;var _0x650ea;return db[_0x8029('0x34')][_0x8029('0x5a')]({'where':{'id':_0x5e6a26[_0x8029('0x57')]['id']}})['then'](handleEntityNotFound(_0x4af9d1,null))[_0x8029('0x2a')](function(_0x170c57){if(_0x170c57){_0x46e55d=_0x170c57;_0x232680['model']=_[_0x8029('0x3b')](db[_0x8029('0x5e')][_0x8029('0x35')]);_0x232680['query']=_[_0x8029('0x3b')](_0x5e6a26['query']);_0x232680['filters']=_['intersection'](_0x232680[_0x8029('0x39')],_0x232680[_0x8029('0x3a')]);_0x2eba33[_0x8029('0x3d')]=_[_0x8029('0x3c')](_0x232680[_0x8029('0x39')],qs[_0x8029('0x3e')](_0x5e6a26['query'][_0x8029('0x3e')]));_0x2eba33[_0x8029('0x3d')]=_0x2eba33['attributes']['length']?_0x2eba33[_0x8029('0x3d')]:_0x232680['model'];_0x2eba33[_0x8029('0x5c')]=qs[_0x8029('0x42')](_0x5e6a26[_0x8029('0x3a')][_0x8029('0x42')]);_0x2eba33[_0x8029('0x43')]=qs[_0x8029('0x44')](_['pick'](_0x5e6a26[_0x8029('0x3a')],_0x232680['filters']));if(_0x5e6a26[_0x8029('0x3a')][_0x8029('0x46')]){_0x2eba33[_0x8029('0x43')]=_[_0x8029('0x47')](_0x2eba33[_0x8029('0x43')],{'$or':_[_0x8029('0x33')](_0x2eba33[_0x8029('0x3d')],function(_0x539cc1){var _0x14509f={};_0x14509f[_0x539cc1]={'$like':'%'+_0x5e6a26[_0x8029('0x3a')][_0x8029('0x46')]+'%'};return _0x14509f;})});}_0x2eba33=_['merge']({},_0x2eba33,_0x5e6a26[_0x8029('0x49')]);return _0x46e55d[_0x8029('0x8b')](_0x2eba33);}})[_0x8029('0x2a')](function(_0xa0efd7){if(_0xa0efd7){_0x650ea=_0xa0efd7[_0x8029('0x3f')];if(!_0x5e6a26[_0x8029('0x3a')][_0x8029('0x40')](_0x8029('0x41'))){_0x2eba33[_0x8029('0x24')]=qs[_0x8029('0x24')](_0x5e6a26[_0x8029('0x3a')][_0x8029('0x24')]);_0x2eba33['offset']=qs[_0x8029('0x22')](_0x5e6a26['query'][_0x8029('0x22')]);}return _0x46e55d[_0x8029('0x8b')](_0x2eba33);}})[_0x8029('0x2a')](function(_0x31116a){if(_0x31116a){return _0x31116a?{'count':_0x650ea,'rows':_0x31116a}:null;}})[_0x8029('0x2a')](respondWithResult(_0x4af9d1,null))['catch'](handleError(_0x4af9d1,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f5ecff4..9a9dad0 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 _0x245b=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2d5399,_0x5e854d){var _0xc0709d=function(_0x1d1ad9){while(--_0x1d1ad9){_0x2d5399['push'](_0x2d5399['shift']());}};_0xc0709d(++_0x5e854d);}(_0x245b,0x1d3));var _0xb245=function(_0x3d6d4d,_0x2c65a2){_0x3d6d4d=_0x3d6d4d-0x0;var _0x4b0b35=_0x245b[_0x3d6d4d];return _0x4b0b35;};'use strict';var EventEmitter=require(_0xb245('0x0'));var SmsQueue=require(_0xb245('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb245('0x2')](0x0);var events={'afterCreate':_0xb245('0x3'),'afterUpdate':_0xb245('0x4'),'afterDestroy':_0xb245('0x5')};function emitEvent(_0x1810a0){return function(_0x541951,_0x541f75,_0xb846ee){SmsQueueEvents[_0xb245('0x6')](_0x1810a0+':'+_0x541951['id'],_0x541951);SmsQueueEvents[_0xb245('0x6')](_0x1810a0,_0x541951);_0xb846ee(null);};}for(var e in events){if(events[_0xb245('0x7')](e)){var event=events[e];SmsQueue[_0xb245('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x857b=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue','save','update'];(function(_0x4aa83b,_0xa90f1b){var _0xedff0b=function(_0x14bc57){while(--_0x14bc57){_0x4aa83b['push'](_0x4aa83b['shift']());}};_0xedff0b(++_0xa90f1b);}(_0x857b,0x184));var _0xb857=function(_0x1b2956,_0x5ade9a){_0x1b2956=_0x1b2956-0x0;var _0x2367e2=_0x857b[_0x1b2956];return _0x2367e2;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb857('0x0'))['db'][_0xb857('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb857('0x2'),'afterUpdate':_0xb857('0x3'),'afterDestroy':_0xb857('0x4')};function emitEvent(_0x2ff226){return function(_0x2be245,_0x2bdcb4,_0x2b47a2){SmsQueueEvents[_0xb857('0x5')](_0x2ff226+':'+_0x2be245['id'],_0x2be245);SmsQueueEvents['emit'](_0x2ff226,_0x2be245);_0x2b47a2(null);};}for(var e in events){if(events[_0xb857('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb857('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index daf4362..cc8e218 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 _0xf51d=['define','sms_queues','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0xf4a734,_0x1a4fe7){var _0x10ee33=function(_0x365a59){while(--_0x365a59){_0xf4a734['push'](_0xf4a734['shift']());}};_0x10ee33(++_0x1a4fe7);}(_0xf51d,0xca));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdf51('0x0'));var logger=require(_0xdf51('0x1'))(_0xdf51('0x2'));var moment=require(_0xdf51('0x3'));var BPromise=require(_0xdf51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf51('0x5'));var rimraf=require('rimraf');var config=require(_0xdf51('0x6'));var attributes=require('./smsQueue.attributes');module[_0xdf51('0x7')]=function(_0xfb25a7,_0x474c3f){return _0xfb25a7[_0xdf51('0x8')]('SmsQueue',attributes,{'tableName':_0xdf51('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x795a=['rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','bluebird','request-promise'];(function(_0x1f1039,_0x402bc3){var _0x29cad7=function(_0x4a07fc){while(--_0x4a07fc){_0x1f1039['push'](_0x1f1039['shift']());}};_0x29cad7(++_0x402bc3);}(_0x795a,0x6a));var _0xa795=function(_0x277ef4,_0x42da65){_0x277ef4=_0x277ef4-0x0;var _0x4e535c=_0x795a[_0x277ef4];return _0x4e535c;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var logger=require(_0xa795('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa795('0x2'));var rp=require(_0xa795('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa795('0x4'));var config=require(_0xa795('0x5'));var attributes=require(_0xa795('0x6'));module[_0xa795('0x7')]=function(_0x4d2c89,_0x3f52eb){return _0x4d2c89[_0xa795('0x8')](_0xa795('0x9'),attributes,{'tableName':_0xa795('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index a64d68e..53a037e 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 _0xaa71=['request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSmsQueue','findAll','options','where','attributes','include','map','model','info','stringify','catch','SmsQueue','find','raw','ShowSmsQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','register'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0xaa71,0x151));var _0x1aa7=function(_0x4ea092,_0x3fc32f){_0x4ea092=_0x4ea092-0x0;var _0x502383=_0xaa71[_0x4ea092];return _0x502383;};'use strict';var _=require(_0x1aa7('0x0'));var util=require(_0x1aa7('0x1'));var moment=require('moment');var BPromise=require(_0x1aa7('0x2'));var rs=require(_0x1aa7('0x3'));var fs=require('fs');var Redis=require(_0x1aa7('0x4'));var db=require(_0x1aa7('0x5'))['db'];var utils=require(_0x1aa7('0x6'));var logger=require(_0x1aa7('0x7'))(_0x1aa7('0x8'));var config=require(_0x1aa7('0x9'));var jayson=require(_0x1aa7('0xa'));var client=jayson['client'][_0x1aa7('0xb')]({'port':0x232a});config[_0x1aa7('0xc')]=_['defaults'](config[_0x1aa7('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x1aa7('0xd')](socket);function respondWithRpcPromise(_0x19ad98,_0x207f7c,_0x347231){return new BPromise(function(_0x2a1a1d,_0x23dcf7){return client[_0x1aa7('0xe')](_0x19ad98,_0x347231)[_0x1aa7('0xf')](function(_0x34b6eb){logger['info'](_0x1aa7('0x10'),_0x207f7c,_0x1aa7('0x11'));logger[_0x1aa7('0x12')](_0x1aa7('0x13'),_0x207f7c,_0x1aa7('0x11'),JSON['stringify'](_0x34b6eb));if(_0x34b6eb[_0x1aa7('0x14')]){if(_0x34b6eb[_0x1aa7('0x14')][_0x1aa7('0x15')]===0x1f4){logger[_0x1aa7('0x14')](_0x1aa7('0x10'),_0x207f7c,_0x34b6eb[_0x1aa7('0x14')][_0x1aa7('0x16')]);return _0x23dcf7(_0x34b6eb['error'][_0x1aa7('0x16')]);}logger[_0x1aa7('0x14')]('SmsQueue,\x20%s,\x20%s',_0x207f7c,_0x34b6eb['error']['message']);return _0x2a1a1d(_0x34b6eb[_0x1aa7('0x14')][_0x1aa7('0x16')]);}else{logger['info'](_0x1aa7('0x10'),_0x207f7c,'request\x20sent');_0x2a1a1d(_0x34b6eb[_0x1aa7('0x17')][_0x1aa7('0x16')]);}})['catch'](function(_0x2d04fb){logger[_0x1aa7('0x14')](_0x1aa7('0x10'),_0x207f7c,_0x2d04fb);_0x23dcf7(_0x2d04fb);});});}exports[_0x1aa7('0x18')]=function(_0x499d25){var _0x48a02b=this;return new Promise(function(_0x3d63a5,_0x580bfd){return db['SmsQueue'][_0x1aa7('0x19')]({'raw':_0x499d25[_0x1aa7('0x1a')]?_0x499d25[_0x1aa7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x499d25[_0x1aa7('0x1a')]?_0x499d25[_0x1aa7('0x1a')][_0x1aa7('0x1b')]||null:null,'attributes':_0x499d25['options']?_0x499d25[_0x1aa7('0x1a')][_0x1aa7('0x1c')]||null:null,'limit':_0x499d25[_0x1aa7('0x1a')]?_0x499d25[_0x1aa7('0x1a')]['limit']||null:null,'include':_0x499d25['options']?_0x499d25[_0x1aa7('0x1a')][_0x1aa7('0x1d')]?_[_0x1aa7('0x1e')](_0x499d25['options'][_0x1aa7('0x1d')],function(_0x16bf43){return{'model':db[_0x16bf43[_0x1aa7('0x1f')]],'as':_0x16bf43['as'],'attributes':_0x16bf43['attributes'],'include':_0x16bf43[_0x1aa7('0x1d')]?_[_0x1aa7('0x1e')](_0x16bf43[_0x1aa7('0x1d')],function(_0x52e0e9){return{'model':db[_0x52e0e9[_0x1aa7('0x1f')]],'as':_0x52e0e9['as'],'attributes':_0x52e0e9[_0x1aa7('0x1c')],'include':_0x52e0e9[_0x1aa7('0x1d')]?_[_0x1aa7('0x1e')](_0x52e0e9['include'],function(_0x46ad1f){return{'model':db[_0x46ad1f[_0x1aa7('0x1f')]],'as':_0x46ad1f['as'],'attributes':_0x46ad1f[_0x1aa7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1aa7('0xf')](function(_0x5620ab){logger[_0x1aa7('0x20')]('GetSmsQueue',_0x499d25);logger[_0x1aa7('0x12')](_0x1aa7('0x18'),_0x499d25,JSON[_0x1aa7('0x21')](_0x5620ab));_0x3d63a5(_0x5620ab);})[_0x1aa7('0x22')](function(_0xbb6df5){logger[_0x1aa7('0x14')](_0x1aa7('0x18'),_0xbb6df5['message'],_0x499d25);_0x580bfd(_0x48a02b[_0x1aa7('0x14')](0x1f4,_0xbb6df5[_0x1aa7('0x16')]));});});};exports['ShowSmsQueue']=function(_0x49e24c){var _0x2594b8=this;return new Promise(function(_0x5f2d51,_0xec448d){return db[_0x1aa7('0x23')][_0x1aa7('0x24')]({'raw':_0x49e24c['options']?_0x49e24c[_0x1aa7('0x1a')][_0x1aa7('0x25')]===undefined?!![]:![]:!![],'where':_0x49e24c[_0x1aa7('0x1a')]?_0x49e24c[_0x1aa7('0x1a')][_0x1aa7('0x1b')]||null:null,'attributes':_0x49e24c[_0x1aa7('0x1a')]?_0x49e24c[_0x1aa7('0x1a')][_0x1aa7('0x1c')]||null:null,'include':_0x49e24c[_0x1aa7('0x1a')]?_0x49e24c[_0x1aa7('0x1a')][_0x1aa7('0x1d')]?_['map'](_0x49e24c[_0x1aa7('0x1a')][_0x1aa7('0x1d')],function(_0x31ffd7){return{'model':db[_0x31ffd7[_0x1aa7('0x1f')]],'as':_0x31ffd7['as'],'attributes':_0x31ffd7[_0x1aa7('0x1c')],'include':_0x31ffd7[_0x1aa7('0x1d')]?_['map'](_0x31ffd7['include'],function(_0x3bd1f1){return{'model':db[_0x3bd1f1[_0x1aa7('0x1f')]],'as':_0x3bd1f1['as'],'attributes':_0x3bd1f1[_0x1aa7('0x1c')],'include':_0x3bd1f1[_0x1aa7('0x1d')]?_[_0x1aa7('0x1e')](_0x3bd1f1[_0x1aa7('0x1d')],function(_0x26f630){return{'model':db[_0x26f630[_0x1aa7('0x1f')]],'as':_0x26f630['as'],'attributes':_0x26f630[_0x1aa7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1aa7('0xf')](function(_0x436e13){logger[_0x1aa7('0x20')](_0x1aa7('0x26'),_0x49e24c);logger[_0x1aa7('0x12')]('ShowSmsQueue',_0x49e24c,JSON[_0x1aa7('0x21')](_0x436e13));_0x5f2d51(_0x436e13);})[_0x1aa7('0x22')](function(_0x37e6f8){logger[_0x1aa7('0x14')](_0x1aa7('0x26'),_0x37e6f8[_0x1aa7('0x16')],_0x49e24c);_0xec448d(_0x2594b8[_0x1aa7('0x14')](0x1f4,_0x37e6f8[_0x1aa7('0x16')]));});});}; \ No newline at end of file +var _0xd23c=['where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options'];(function(_0x141ec8,_0x28638e){var _0x74cdff=function(_0x42bc9d){while(--_0x42bc9d){_0x141ec8['push'](_0x141ec8['shift']());}};_0x74cdff(++_0x28638e);}(_0xd23c,0x153));var _0xcd23=function(_0x18a1a1,_0x8c1d2){_0x18a1a1=_0x18a1a1-0x0;var _0x5a9931=_0xd23c[_0x18a1a1];return _0x5a9931;};'use strict';var _=require(_0xcd23('0x0'));var util=require(_0xcd23('0x1'));var moment=require('moment');var BPromise=require(_0xcd23('0x2'));var rs=require(_0xcd23('0x3'));var fs=require('fs');var Redis=require(_0xcd23('0x4'));var db=require(_0xcd23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd23('0x6'))(_0xcd23('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcd23('0x8')][_0xcd23('0x9')]({'port':0x232a});config[_0xcd23('0xa')]=_[_0xcd23('0xb')](config[_0xcd23('0xa')],{'host':_0xcd23('0xc'),'port':0x18eb});var socket=require(_0xcd23('0xd'))(new Redis(config[_0xcd23('0xa')]));require(_0xcd23('0xe'))[_0xcd23('0xf')](socket);function respondWithRpcPromise(_0x2857bd,_0x824f12,_0x42abd4){return new BPromise(function(_0x32b932,_0x2da3fa){return client['request'](_0x2857bd,_0x42abd4)[_0xcd23('0x10')](function(_0x3b9f5){logger[_0xcd23('0x11')](_0xcd23('0x12'),_0x824f12,_0xcd23('0x13'));logger['debug'](_0xcd23('0x14'),_0x824f12,_0xcd23('0x13'),JSON[_0xcd23('0x15')](_0x3b9f5));if(_0x3b9f5[_0xcd23('0x16')]){if(_0x3b9f5['error'][_0xcd23('0x17')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x824f12,_0x3b9f5[_0xcd23('0x16')][_0xcd23('0x18')]);return _0x2da3fa(_0x3b9f5[_0xcd23('0x16')][_0xcd23('0x18')]);}logger[_0xcd23('0x16')](_0xcd23('0x12'),_0x824f12,_0x3b9f5[_0xcd23('0x16')][_0xcd23('0x18')]);return _0x32b932(_0x3b9f5[_0xcd23('0x16')]['message']);}else{logger['info'](_0xcd23('0x12'),_0x824f12,_0xcd23('0x13'));_0x32b932(_0x3b9f5[_0xcd23('0x19')][_0xcd23('0x18')]);}})[_0xcd23('0x1a')](function(_0x1f1775){logger[_0xcd23('0x16')](_0xcd23('0x12'),_0x824f12,_0x1f1775);_0x2da3fa(_0x1f1775);});});}exports['GetSmsQueue']=function(_0x598105){var _0x2d0eac=this;return new Promise(function(_0x5773e9,_0x416aac){return db[_0xcd23('0x1b')][_0xcd23('0x1c')]({'raw':_0x598105[_0xcd23('0x1d')]?_0x598105[_0xcd23('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x598105[_0xcd23('0x1d')]?_0x598105[_0xcd23('0x1d')][_0xcd23('0x1e')]||null:null,'attributes':_0x598105[_0xcd23('0x1d')]?_0x598105[_0xcd23('0x1d')][_0xcd23('0x1f')]||null:null,'limit':_0x598105[_0xcd23('0x1d')]?_0x598105[_0xcd23('0x1d')][_0xcd23('0x20')]||null:null,'include':_0x598105[_0xcd23('0x1d')]?_0x598105[_0xcd23('0x1d')][_0xcd23('0x21')]?_[_0xcd23('0x22')](_0x598105[_0xcd23('0x1d')][_0xcd23('0x21')],function(_0x19f4d0){return{'model':db[_0x19f4d0[_0xcd23('0x23')]],'as':_0x19f4d0['as'],'attributes':_0x19f4d0[_0xcd23('0x1f')],'include':_0x19f4d0[_0xcd23('0x21')]?_[_0xcd23('0x22')](_0x19f4d0[_0xcd23('0x21')],function(_0x227da5){return{'model':db[_0x227da5[_0xcd23('0x23')]],'as':_0x227da5['as'],'attributes':_0x227da5['attributes'],'include':_0x227da5[_0xcd23('0x21')]?_['map'](_0x227da5[_0xcd23('0x21')],function(_0x6e4c95){return{'model':db[_0x6e4c95['model']],'as':_0x6e4c95['as'],'attributes':_0x6e4c95[_0xcd23('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd23('0x10')](function(_0x3467ee){logger['info']('GetSmsQueue',_0x598105);logger['debug'](_0xcd23('0x24'),_0x598105,JSON[_0xcd23('0x15')](_0x3467ee));_0x5773e9(_0x3467ee);})[_0xcd23('0x1a')](function(_0x59d0e7){logger['error']('GetSmsQueue',_0x59d0e7[_0xcd23('0x18')],_0x598105);_0x416aac(_0x2d0eac[_0xcd23('0x16')](0x1f4,_0x59d0e7[_0xcd23('0x18')]));});});};exports[_0xcd23('0x25')]=function(_0x4cb9e7){var _0x36eb82=this;return new Promise(function(_0x423738,_0x5a60d7){return db['SmsQueue'][_0xcd23('0x26')]({'raw':_0x4cb9e7[_0xcd23('0x1d')]?_0x4cb9e7[_0xcd23('0x1d')][_0xcd23('0x27')]===undefined?!![]:![]:!![],'where':_0x4cb9e7[_0xcd23('0x1d')]?_0x4cb9e7[_0xcd23('0x1d')]['where']||null:null,'attributes':_0x4cb9e7[_0xcd23('0x1d')]?_0x4cb9e7[_0xcd23('0x1d')]['attributes']||null:null,'include':_0x4cb9e7['options']?_0x4cb9e7[_0xcd23('0x1d')][_0xcd23('0x21')]?_[_0xcd23('0x22')](_0x4cb9e7[_0xcd23('0x1d')][_0xcd23('0x21')],function(_0x16b73d){return{'model':db[_0x16b73d[_0xcd23('0x23')]],'as':_0x16b73d['as'],'attributes':_0x16b73d['attributes'],'include':_0x16b73d[_0xcd23('0x21')]?_[_0xcd23('0x22')](_0x16b73d[_0xcd23('0x21')],function(_0x28e68c){return{'model':db[_0x28e68c[_0xcd23('0x23')]],'as':_0x28e68c['as'],'attributes':_0x28e68c[_0xcd23('0x1f')],'include':_0x28e68c[_0xcd23('0x21')]?_['map'](_0x28e68c[_0xcd23('0x21')],function(_0x198528){return{'model':db[_0x198528['model']],'as':_0x198528['as'],'attributes':_0x198528[_0xcd23('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd23('0x10')](function(_0x537326){logger[_0xcd23('0x11')]('ShowSmsQueue',_0x4cb9e7);logger[_0xcd23('0x28')]('ShowSmsQueue',_0x4cb9e7,JSON['stringify'](_0x537326));_0x423738(_0x537326);})[_0xcd23('0x1a')](function(_0x2ce1de){logger[_0xcd23('0x16')](_0xcd23('0x25'),_0x2ce1de[_0xcd23('0x18')],_0x4cb9e7);_0x5a60d7(_0x36eb82[_0xcd23('0x16')](0x1f4,_0x2ce1de[_0xcd23('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 1e695dc..2b5ea11 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 _0x8702=['remove','update','removeListener','length','smsQueue:','./smsQueue.events','save'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x8702,0x1e1));var _0x2870=function(_0x262856,_0x4ae3e2){_0x262856=_0x262856-0x0;var _0x4acd6e=_0x8702[_0x262856];return _0x4acd6e;};'use strict';var SmsQueueEvents=require(_0x2870('0x0'));var events=[_0x2870('0x1'),_0x2870('0x2'),_0x2870('0x3')];function createListener(_0x2b553f,_0x13bf52){return function(_0x548bc4){_0x13bf52['emit'](_0x2b553f,_0x548bc4);};}function removeListener(_0x5a6a3d,_0x547d68){return function(){SmsQueueEvents[_0x2870('0x4')](_0x5a6a3d,_0x547d68);};}exports['register']=function(_0x48298e){for(var _0x207b7e=0x0,_0x3308f5=events[_0x2870('0x5')];_0x207b7e<_0x3308f5;_0x207b7e++){var _0x20bbb5=events[_0x207b7e];var _0x31cce7=createListener(_0x2870('0x6')+_0x20bbb5,_0x48298e);SmsQueueEvents['on'](_0x20bbb5,_0x31cce7);}}; \ No newline at end of file +var _0xb618=['register','length','./smsQueue.events','save','remove','update','removeListener'];(function(_0x55d006,_0x41e94c){var _0x5778c8=function(_0x51f95e){while(--_0x51f95e){_0x55d006['push'](_0x55d006['shift']());}};_0x5778c8(++_0x41e94c);}(_0xb618,0x87));var _0x8b61=function(_0x5c2bcf,_0x50fe61){_0x5c2bcf=_0x5c2bcf-0x0;var _0x3819d0=_0xb618[_0x5c2bcf];return _0x3819d0;};'use strict';var SmsQueueEvents=require(_0x8b61('0x0'));var events=[_0x8b61('0x1'),_0x8b61('0x2'),_0x8b61('0x3')];function createListener(_0x5c57f,_0x53de94){return function(_0x335705){_0x53de94['emit'](_0x5c57f,_0x335705);};}function removeListener(_0xd93c46,_0x39766b){return function(){SmsQueueEvents[_0x8b61('0x4')](_0xd93c46,_0x39766b);};}exports[_0x8b61('0x5')]=function(_0x4b4424){for(var _0x20cdd8=0x0,_0x5c57f9=events[_0x8b61('0x6')];_0x20cdd8<_0x5c57f9;_0x20cdd8++){var _0xe2b7aa=events[_0x20cdd8];var _0x366732=createListener('smsQueue:'+_0xe2b7aa,_0x4b4424);SmsQueueEvents['on'](_0xe2b7aa,_0x366732);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 7cd5832..35bc8ab 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 _0x2c40=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c40,0xfd));var _0x02c4=function(_0x53b304,_0x1efbab){_0x53b304=_0x53b304-0x0;var _0x471654=_0x2c40[_0x53b304];return _0x471654;};'use strict';var multer=require('multer');var util=require(_0x02c4('0x0'));var path=require(_0x02c4('0x1'));var timeout=require(_0x02c4('0x2'));var express=require(_0x02c4('0x3'));var router=express[_0x02c4('0x4')]();var fs_extra=require(_0x02c4('0x5'));var auth=require(_0x02c4('0x6'));var interaction=require(_0x02c4('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x02c4('0x8')]('/',auth[_0x02c4('0x9')](),controller['index']);router[_0x02c4('0x8')](_0x02c4('0xa'),auth[_0x02c4('0x9')](),controller[_0x02c4('0xb')]);router['get'](_0x02c4('0xc'),auth['isAuthenticated'](),controller[_0x02c4('0xd')]);router['post']('/',auth[_0x02c4('0x9')](),controller[_0x02c4('0xe')]);router[_0x02c4('0xf')](_0x02c4('0xc'),auth[_0x02c4('0x9')](),controller['update']);router[_0x02c4('0x10')]('/:id',auth[_0x02c4('0x9')](),controller['destroy']);module[_0x02c4('0x11')]=router; \ No newline at end of file +var _0x691a=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3326ec,_0x4b3d33){var _0x1427a0=function(_0x27fb7d){while(--_0x27fb7d){_0x3326ec['push'](_0x3326ec['shift']());}};_0x1427a0(++_0x4b3d33);}(_0x691a,0x1df));var _0xa691=function(_0x566a26,_0x3be69f){_0x566a26=_0x566a26-0x0;var _0x2469cb=_0x691a[_0x566a26];return _0x2469cb;};'use strict';var multer=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var path=require(_0xa691('0x2'));var timeout=require(_0xa691('0x3'));var express=require(_0xa691('0x4'));var router=express[_0xa691('0x5')]();var fs_extra=require(_0xa691('0x6'));var auth=require(_0xa691('0x7'));var interaction=require(_0xa691('0x8'));var config=require(_0xa691('0x9'));var controller=require('./smsQueueReport.controller');router[_0xa691('0xa')]('/',auth[_0xa691('0xb')](),controller['index']);router[_0xa691('0xa')]('/describe',auth[_0xa691('0xb')](),controller[_0xa691('0xc')]);router[_0xa691('0xa')](_0xa691('0xd'),auth['isAuthenticated'](),controller[_0xa691('0xe')]);router[_0xa691('0xf')]('/',auth[_0xa691('0xb')](),controller['create']);router[_0xa691('0x10')](_0xa691('0xd'),auth[_0xa691('0xb')](),controller['update']);router[_0xa691('0x11')]('/:id',auth[_0xa691('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 18ee9de..45c475c 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 _0xbfcf=['moment','STRING','DATE'];(function(_0x402e99,_0xd901c3){var _0x5cb479=function(_0x175570){while(--_0x175570){_0x402e99['push'](_0x402e99['shift']());}};_0x5cb479(++_0xd901c3);}(_0xbfcf,0x183));var _0xfbfc=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xbfcf[_0x2e8418];return _0x548fe6;};'use strict';var moment=require(_0xfbfc('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfbfc('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfbfc('0x2')]},'acceptAt':{'type':Sequelize[_0xfbfc('0x2')]},'exitAt':{'type':Sequelize[_0xfbfc('0x2')]},'reason':{'type':Sequelize[_0xfbfc('0x1')]}}; \ No newline at end of file +var _0xb613=['STRING','DATE','sequelize','exports'];(function(_0x2655ec,_0x424b9){var _0x43e3e2=function(_0x31bfa5){while(--_0x31bfa5){_0x2655ec['push'](_0x2655ec['shift']());}};_0x43e3e2(++_0x424b9);}(_0xb613,0x152));var _0x3b61=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xb613[_0x550d12];return _0x12103d;};'use strict';var moment=require('moment');var Sequelize=require(_0x3b61('0x0'));module[_0x3b61('0x1')]={'uniqueid':{'type':Sequelize[_0x3b61('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3b61('0x2')]},'joinAt':{'type':Sequelize[_0x3b61('0x3')]},'leaveAt':{'type':Sequelize[_0x3b61('0x3')]},'acceptAt':{'type':Sequelize[_0x3b61('0x3')]},'exitAt':{'type':Sequelize[_0x3b61('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7f78fbd..7fd3bd3 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 _0x5444=['end','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','map','filter','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy'];(function(_0x346645,_0x3e9d9c){var _0x32f590=function(_0x5b1bb5){while(--_0x5b1bb5){_0x346645['push'](_0x346645['shift']());}};_0x32f590(++_0x3e9d9c);}(_0x5444,0xff));var _0x4544=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5444[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4544('0x0'));var rimraf=require(_0x4544('0x1'));var zipdir=require(_0x4544('0x2'));var jsonpatch=require(_0x4544('0x3'));var rp=require(_0x4544('0x4'));var moment=require(_0x4544('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4544('0x6'));var path=require('path');var sox=require(_0x4544('0x7'));var csv=require('to-csv');var ejs=require(_0x4544('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4544('0x9'));var squel=require(_0x4544('0xa'));var crypto=require(_0x4544('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4544('0xc'));var toCsv=require(_0x4544('0xd'));var querystring=require(_0x4544('0xe'));var Papa=require(_0x4544('0xf'));var Redis=require(_0x4544('0x10'));var authService=require(_0x4544('0x11'));var qs=require(_0x4544('0x12'));var as=require(_0x4544('0x13'));var hardwareService=require(_0x4544('0x14'));var logger=require(_0x4544('0x15'))(_0x4544('0x16'));var utils=require('../../config/utils');var config=require(_0x4544('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x652fe5,_0x46196c){_0x46196c=_0x46196c||0xcc;return function(_0x2492d4){if(_0x2492d4){return _0x652fe5[_0x4544('0x18')](_0x46196c);}return _0x652fe5[_0x4544('0x19')](_0x46196c)['end']();};}function respondWithResult(_0x207a03,_0x25f934){_0x25f934=_0x25f934||0xc8;return function(_0x14819f){if(_0x14819f){return _0x207a03[_0x4544('0x19')](_0x25f934)['json'](_0x14819f);}};}function respondWithFilteredResult(_0x16521a,_0x47e317){return function(_0xa11399){if(_0xa11399){var _0x40de7f=typeof _0x47e317['offset']===_0x4544('0x1a')&&typeof _0x47e317[_0x4544('0x1b')]==='undefined';var _0x19dc36=_0xa11399[_0x4544('0x1c')];var _0x3cf260=_0x40de7f?0x0:_0x47e317[_0x4544('0x1d')];var _0xc44ec0=_0x40de7f?_0xa11399[_0x4544('0x1c')]:_0x47e317[_0x4544('0x1d')]+_0x47e317[_0x4544('0x1b')];var _0x4f48d9;if(_0xc44ec0>=_0x19dc36){_0xc44ec0=_0x19dc36;_0x4f48d9=0xc8;}else{_0x4f48d9=0xce;}_0x16521a[_0x4544('0x19')](_0x4f48d9);return _0x16521a[_0x4544('0x1e')](_0x4544('0x1f'),_0x3cf260+'-'+_0xc44ec0+'/'+_0x19dc36)[_0x4544('0x20')](_0xa11399);}return null;};}function patchUpdates(_0x29b4af){return function(_0x344896){try{jsonpatch['apply'](_0x344896,_0x29b4af,!![]);}catch(_0x5c0cfb){return BPromise['reject'](_0x5c0cfb);}return _0x344896[_0x4544('0x21')]();};}function saveUpdates(_0x4da0ad,_0x3bb881){return function(_0x44f49c){if(_0x44f49c){return _0x44f49c[_0x4544('0x22')](_0x4da0ad)[_0x4544('0x23')](function(_0x613c10){return _0x613c10;});}return null;};}function removeEntity(_0x5d280c,_0x33cda9){return function(_0x5e142c){if(_0x5e142c){return _0x5e142c[_0x4544('0x24')]()[_0x4544('0x23')](function(){_0x5d280c[_0x4544('0x19')](0xcc)[_0x4544('0x25')]();});}};}function handleEntityNotFound(_0x3b11c5,_0x24a23f){return function(_0x458ca1){if(!_0x458ca1){_0x3b11c5[_0x4544('0x18')](0x194);}return _0x458ca1;};}function handleError(_0x1b93f9,_0x28ec71){_0x28ec71=_0x28ec71||0x1f4;return function(_0xc0fb68){logger[_0x4544('0x26')](_0xc0fb68[_0x4544('0x27')]);if(_0xc0fb68[_0x4544('0x28')]){delete _0xc0fb68[_0x4544('0x28')];}_0x1b93f9[_0x4544('0x19')](_0x28ec71)[_0x4544('0x29')](_0xc0fb68);};}exports[_0x4544('0x2a')]=function(_0x3d72a9,_0x26c9ef){var _0x1a86ee={},_0x3ad759={},_0x52c67a={'count':0x0,'rows':[]};var _0x4d00e1=_['map'](db[_0x4544('0x2b')][_0x4544('0x2c')],function(_0x2dc41e){return{'name':_0x2dc41e[_0x4544('0x2d')],'type':_0x2dc41e[_0x4544('0x2e')][_0x4544('0x2f')]};});_0x3ad759['model']=_['map'](_0x4d00e1,_0x4544('0x28'));_0x3ad759['query']=_['keys'](_0x3d72a9[_0x4544('0x30')]);_0x3ad759[_0x4544('0x31')]=_[_0x4544('0x32')](_0x3ad759[_0x4544('0x33')],_0x3ad759['query']);_0x1a86ee[_0x4544('0x34')]=_[_0x4544('0x32')](_0x3ad759[_0x4544('0x33')],qs[_0x4544('0x35')](_0x3d72a9['query'][_0x4544('0x35')]));_0x1a86ee[_0x4544('0x34')]=_0x1a86ee[_0x4544('0x34')][_0x4544('0x36')]?_0x1a86ee[_0x4544('0x34')]:_0x3ad759[_0x4544('0x33')];if(!_0x3d72a9[_0x4544('0x30')]['hasOwnProperty'](_0x4544('0x37'))){_0x1a86ee['limit']=qs[_0x4544('0x1b')](_0x3d72a9['query'][_0x4544('0x1b')]);_0x1a86ee[_0x4544('0x1d')]=qs[_0x4544('0x1d')](_0x3d72a9[_0x4544('0x30')][_0x4544('0x1d')]);}_0x1a86ee[_0x4544('0x38')]=qs[_0x4544('0x39')](_0x3d72a9[_0x4544('0x30')][_0x4544('0x39')]);_0x1a86ee[_0x4544('0x3a')]=qs['filters'](_['pick'](_0x3d72a9[_0x4544('0x30')],_0x3ad759[_0x4544('0x31')]),_0x4d00e1);if(_0x3d72a9['query']['filter']){_0x1a86ee[_0x4544('0x3a')]=_[_0x4544('0x3b')](_0x1a86ee[_0x4544('0x3a')],{'$or':_[_0x4544('0x3c')](_0x4d00e1,function(_0x8b5e79){if(_0x8b5e79[_0x4544('0x2e')]!=='VIRTUAL'){var _0x269b55={};_0x269b55[_0x8b5e79[_0x4544('0x28')]]={'$like':'%'+_0x3d72a9['query'][_0x4544('0x3d')]+'%'};return _0x269b55;}})});}_0x1a86ee=_[_0x4544('0x3b')]({},_0x1a86ee,_0x3d72a9[_0x4544('0x3e')]);var _0x310862={'where':_0x1a86ee[_0x4544('0x3a')]};return db['SmsQueueReport'][_0x4544('0x1c')](_0x310862)[_0x4544('0x23')](function(_0x3827cf){_0x52c67a['count']=_0x3827cf;if(_0x3d72a9[_0x4544('0x30')][_0x4544('0x3f')]){_0x1a86ee['include']=[{'all':!![]}];}return db[_0x4544('0x2b')]['findAll'](_0x1a86ee);})[_0x4544('0x23')](function(_0x1223ff){_0x52c67a['rows']=_0x1223ff;return _0x52c67a;})[_0x4544('0x23')](respondWithFilteredResult(_0x26c9ef,_0x1a86ee))[_0x4544('0x40')](handleError(_0x26c9ef,null));};exports[_0x4544('0x41')]=function(_0x5edadf,_0x2e64d1){var _0xbbf0a5={'raw':!![],'where':{'id':_0x5edadf[_0x4544('0x42')]['id']}},_0x41cc0d={};_0x41cc0d[_0x4544('0x33')]=_[_0x4544('0x43')](db[_0x4544('0x2b')]['rawAttributes']);_0x41cc0d[_0x4544('0x30')]=_[_0x4544('0x43')](_0x5edadf[_0x4544('0x30')]);_0x41cc0d[_0x4544('0x31')]=_['intersection'](_0x41cc0d['model'],_0x41cc0d[_0x4544('0x30')]);_0xbbf0a5['attributes']=_[_0x4544('0x32')](_0x41cc0d['model'],qs[_0x4544('0x35')](_0x5edadf[_0x4544('0x30')]['fields']));_0xbbf0a5[_0x4544('0x34')]=_0xbbf0a5[_0x4544('0x34')]['length']?_0xbbf0a5[_0x4544('0x34')]:_0x41cc0d[_0x4544('0x33')];if(_0x5edadf[_0x4544('0x30')][_0x4544('0x3f')]){_0xbbf0a5[_0x4544('0x44')]=[{'all':!![]}];}_0xbbf0a5=_[_0x4544('0x3b')]({},_0xbbf0a5,_0x5edadf[_0x4544('0x3e')]);return db[_0x4544('0x2b')][_0x4544('0x45')](_0xbbf0a5)[_0x4544('0x23')](handleEntityNotFound(_0x2e64d1,null))['then'](respondWithResult(_0x2e64d1,null))['catch'](handleError(_0x2e64d1,null));};exports[_0x4544('0x46')]=function(_0x3be2e1,_0x4cebda){return db[_0x4544('0x2b')][_0x4544('0x46')](_0x3be2e1['body'],{})[_0x4544('0x23')](respondWithResult(_0x4cebda,0xc9))[_0x4544('0x40')](handleError(_0x4cebda,null));};exports['update']=function(_0x80d46b,_0xf68ab1){if(_0x80d46b['body']['id']){delete _0x80d46b[_0x4544('0x47')]['id'];}return db['SmsQueueReport'][_0x4544('0x45')]({'where':{'id':_0x80d46b[_0x4544('0x42')]['id']}})[_0x4544('0x23')](handleEntityNotFound(_0xf68ab1,null))[_0x4544('0x23')](saveUpdates(_0x80d46b[_0x4544('0x47')],null))[_0x4544('0x23')](respondWithResult(_0xf68ab1,null))['catch'](handleError(_0xf68ab1,null));};exports[_0x4544('0x24')]=function(_0x1d2684,_0x4317db){return db[_0x4544('0x2b')][_0x4544('0x45')]({'where':{'id':_0x1d2684[_0x4544('0x42')]['id']}})[_0x4544('0x23')](handleEntityNotFound(_0x4317db,null))['then'](removeEntity(_0x4317db,null))[_0x4544('0x40')](handleError(_0x4317db,null));};exports[_0x4544('0x48')]=function(_0x3a73a0,_0x344fdf){return db[_0x4544('0x2b')][_0x4544('0x48')]()[_0x4544('0x23')](respondWithResult(_0x344fdf,null))[_0x4544('0x40')](handleError(_0x344fdf,null));}; \ No newline at end of file +var _0xf89c=['create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','includeAll','include','options','find'];(function(_0x45670d,_0x1313c0){var _0x23e0d3=function(_0x163559){while(--_0x163559){_0x45670d['push'](_0x45670d['shift']());}};_0x23e0d3(++_0x1313c0);}(_0xf89c,0x9b));var _0xcf89=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf89c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcf89('0x0'));var rimraf=require(_0xcf89('0x1'));var zipdir=require(_0xcf89('0x2'));var jsonpatch=require(_0xcf89('0x3'));var rp=require(_0xcf89('0x4'));var moment=require('moment');var BPromise=require(_0xcf89('0x5'));var Mustache=require(_0xcf89('0x6'));var util=require(_0xcf89('0x7'));var path=require('path');var sox=require(_0xcf89('0x8'));var csv=require(_0xcf89('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf89('0xa'));var _=require(_0xcf89('0xb'));var squel=require(_0xcf89('0xc'));var crypto=require(_0xcf89('0xd'));var jsforce=require(_0xcf89('0xe'));var deskjs=require(_0xcf89('0xf'));var toCsv=require(_0xcf89('0x9'));var querystring=require('querystring');var Papa=require(_0xcf89('0x10'));var Redis=require('ioredis');var authService=require(_0xcf89('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcf89('0x12'));var hardwareService=require(_0xcf89('0x13'));var logger=require(_0xcf89('0x14'))('api');var utils=require(_0xcf89('0x15'));var config=require(_0xcf89('0x16'));var licenseUtil=require(_0xcf89('0x17'));var db=require(_0xcf89('0x18'))['db'];function respondWithStatusCode(_0x52081c,_0x3be674){_0x3be674=_0x3be674||0xcc;return function(_0x34dec5){if(_0x34dec5){return _0x52081c[_0xcf89('0x19')](_0x3be674);}return _0x52081c[_0xcf89('0x1a')](_0x3be674)[_0xcf89('0x1b')]();};}function respondWithResult(_0x23e292,_0x44d29d){_0x44d29d=_0x44d29d||0xc8;return function(_0xd51f0d){if(_0xd51f0d){return _0x23e292['status'](_0x44d29d)[_0xcf89('0x1c')](_0xd51f0d);}};}function respondWithFilteredResult(_0xa5817f,_0x48aead){return function(_0x5df011){if(_0x5df011){var _0x39aa68=typeof _0x48aead[_0xcf89('0x1d')]===_0xcf89('0x1e')&&typeof _0x48aead['limit']===_0xcf89('0x1e');var _0x557ce9=_0x5df011[_0xcf89('0x1f')];var _0x1395bc=_0x39aa68?0x0:_0x48aead[_0xcf89('0x1d')];var _0x10c316=_0x39aa68?_0x5df011[_0xcf89('0x1f')]:_0x48aead[_0xcf89('0x1d')]+_0x48aead[_0xcf89('0x20')];var _0x1d0171;if(_0x10c316>=_0x557ce9){_0x10c316=_0x557ce9;_0x1d0171=0xc8;}else{_0x1d0171=0xce;}_0xa5817f[_0xcf89('0x1a')](_0x1d0171);return _0xa5817f[_0xcf89('0x21')]('Content-Range',_0x1395bc+'-'+_0x10c316+'/'+_0x557ce9)[_0xcf89('0x1c')](_0x5df011);}return null;};}function patchUpdates(_0x117b05){return function(_0x2cc632){try{jsonpatch[_0xcf89('0x22')](_0x2cc632,_0x117b05,!![]);}catch(_0x29bc08){return BPromise[_0xcf89('0x23')](_0x29bc08);}return _0x2cc632[_0xcf89('0x24')]();};}function saveUpdates(_0x5cd621,_0x282928){return function(_0x12cdae){if(_0x12cdae){return _0x12cdae['update'](_0x5cd621)[_0xcf89('0x25')](function(_0x987c73){return _0x987c73;});}return null;};}function removeEntity(_0x230bdd,_0x3448ab){return function(_0x2288f6){if(_0x2288f6){return _0x2288f6[_0xcf89('0x26')]()[_0xcf89('0x25')](function(){_0x230bdd[_0xcf89('0x1a')](0xcc)[_0xcf89('0x1b')]();});}};}function handleEntityNotFound(_0x9f0171,_0x4ab905){return function(_0x1cc9c5){if(!_0x1cc9c5){_0x9f0171[_0xcf89('0x19')](0x194);}return _0x1cc9c5;};}function handleError(_0x3fa609,_0x434baf){_0x434baf=_0x434baf||0x1f4;return function(_0x19a805){logger[_0xcf89('0x27')](_0x19a805[_0xcf89('0x28')]);if(_0x19a805[_0xcf89('0x29')]){delete _0x19a805['name'];}_0x3fa609[_0xcf89('0x1a')](_0x434baf)[_0xcf89('0x2a')](_0x19a805);};}exports[_0xcf89('0x2b')]=function(_0x29597b,_0x1184a3){var _0x4a658f={},_0x481569={},_0x330602={'count':0x0,'rows':[]};var _0x2d5293=_['map'](db[_0xcf89('0x2c')][_0xcf89('0x2d')],function(_0x35eaa2){return{'name':_0x35eaa2[_0xcf89('0x2e')],'type':_0x35eaa2[_0xcf89('0x2f')][_0xcf89('0x30')]};});_0x481569[_0xcf89('0x31')]=_[_0xcf89('0x32')](_0x2d5293,_0xcf89('0x29'));_0x481569[_0xcf89('0x33')]=_[_0xcf89('0x34')](_0x29597b[_0xcf89('0x33')]);_0x481569[_0xcf89('0x35')]=_['intersection'](_0x481569[_0xcf89('0x31')],_0x481569[_0xcf89('0x33')]);_0x4a658f[_0xcf89('0x36')]=_[_0xcf89('0x37')](_0x481569['model'],qs[_0xcf89('0x38')](_0x29597b[_0xcf89('0x33')][_0xcf89('0x38')]));_0x4a658f[_0xcf89('0x36')]=_0x4a658f['attributes'][_0xcf89('0x39')]?_0x4a658f[_0xcf89('0x36')]:_0x481569[_0xcf89('0x31')];if(!_0x29597b[_0xcf89('0x33')][_0xcf89('0x3a')](_0xcf89('0x3b'))){_0x4a658f[_0xcf89('0x20')]=qs['limit'](_0x29597b['query']['limit']);_0x4a658f[_0xcf89('0x1d')]=qs[_0xcf89('0x1d')](_0x29597b[_0xcf89('0x33')][_0xcf89('0x1d')]);}_0x4a658f['order']=qs['sort'](_0x29597b[_0xcf89('0x33')][_0xcf89('0x3c')]);_0x4a658f[_0xcf89('0x3d')]=qs[_0xcf89('0x35')](_['pick'](_0x29597b['query'],_0x481569[_0xcf89('0x35')]),_0x2d5293);if(_0x29597b[_0xcf89('0x33')][_0xcf89('0x3e')]){_0x4a658f['where']=_[_0xcf89('0x3f')](_0x4a658f[_0xcf89('0x3d')],{'$or':_[_0xcf89('0x32')](_0x2d5293,function(_0x44833f){if(_0x44833f[_0xcf89('0x2f')]!==_0xcf89('0x40')){var _0x56e72e={};_0x56e72e[_0x44833f[_0xcf89('0x29')]]={'$like':'%'+_0x29597b[_0xcf89('0x33')][_0xcf89('0x3e')]+'%'};return _0x56e72e;}})});}_0x4a658f=_['merge']({},_0x4a658f,_0x29597b['options']);var _0x2ac99c={'where':_0x4a658f[_0xcf89('0x3d')]};return db['SmsQueueReport'][_0xcf89('0x1f')](_0x2ac99c)[_0xcf89('0x25')](function(_0x21ce3e){_0x330602[_0xcf89('0x1f')]=_0x21ce3e;if(_0x29597b[_0xcf89('0x33')]['includeAll']){_0x4a658f['include']=[{'all':!![]}];}return db[_0xcf89('0x2c')][_0xcf89('0x41')](_0x4a658f);})[_0xcf89('0x25')](function(_0x263708){_0x330602[_0xcf89('0x42')]=_0x263708;return _0x330602;})['then'](respondWithFilteredResult(_0x1184a3,_0x4a658f))[_0xcf89('0x43')](handleError(_0x1184a3,null));};exports[_0xcf89('0x44')]=function(_0x5895e6,_0x2d9c56){var _0xb7ec68={'raw':!![],'where':{'id':_0x5895e6['params']['id']}},_0x37f24a={};_0x37f24a['model']=_['keys'](db[_0xcf89('0x2c')][_0xcf89('0x2d')]);_0x37f24a['query']=_['keys'](_0x5895e6[_0xcf89('0x33')]);_0x37f24a[_0xcf89('0x35')]=_[_0xcf89('0x37')](_0x37f24a[_0xcf89('0x31')],_0x37f24a['query']);_0xb7ec68['attributes']=_[_0xcf89('0x37')](_0x37f24a[_0xcf89('0x31')],qs[_0xcf89('0x38')](_0x5895e6[_0xcf89('0x33')][_0xcf89('0x38')]));_0xb7ec68[_0xcf89('0x36')]=_0xb7ec68[_0xcf89('0x36')][_0xcf89('0x39')]?_0xb7ec68[_0xcf89('0x36')]:_0x37f24a[_0xcf89('0x31')];if(_0x5895e6[_0xcf89('0x33')][_0xcf89('0x45')]){_0xb7ec68[_0xcf89('0x46')]=[{'all':!![]}];}_0xb7ec68=_[_0xcf89('0x3f')]({},_0xb7ec68,_0x5895e6[_0xcf89('0x47')]);return db[_0xcf89('0x2c')][_0xcf89('0x48')](_0xb7ec68)['then'](handleEntityNotFound(_0x2d9c56,null))['then'](respondWithResult(_0x2d9c56,null))[_0xcf89('0x43')](handleError(_0x2d9c56,null));};exports[_0xcf89('0x49')]=function(_0x5048ea,_0x4ebc85){return db['SmsQueueReport'][_0xcf89('0x49')](_0x5048ea[_0xcf89('0x4a')],{})['then'](respondWithResult(_0x4ebc85,0xc9))[_0xcf89('0x43')](handleError(_0x4ebc85,null));};exports['update']=function(_0x432363,_0x2baace){if(_0x432363[_0xcf89('0x4a')]['id']){delete _0x432363[_0xcf89('0x4a')]['id'];}return db[_0xcf89('0x2c')]['find']({'where':{'id':_0x432363[_0xcf89('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2baace,null))[_0xcf89('0x25')](saveUpdates(_0x432363[_0xcf89('0x4a')],null))[_0xcf89('0x25')](respondWithResult(_0x2baace,null))[_0xcf89('0x43')](handleError(_0x2baace,null));};exports['destroy']=function(_0x14db97,_0x42c626){return db['SmsQueueReport']['find']({'where':{'id':_0x14db97[_0xcf89('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42c626,null))[_0xcf89('0x25')](removeEntity(_0x42c626,null))[_0xcf89('0x43')](handleError(_0x42c626,null));};exports['describe']=function(_0x7ef5b,_0x23716f){return db[_0xcf89('0x2c')]['describe']()[_0xcf89('0x25')](respondWithResult(_0x23716f,null))[_0xcf89('0x43')](handleError(_0x23716f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ad0ea1e..7604fc2 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x498043,_0x487a5e){var _0x330e91=function(_0x42a724){while(--_0x42a724){_0x498043['push'](_0x498043['shift']());}};_0x330e91(++_0x487a5e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x434870,_0x36c627){var _0x57387b=function(_0x3d831b){while(--_0x3d831b){_0x434870['push'](_0x434870['shift']());}};_0x57387b(++_0x36c627);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0cc2d46..acb7298 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 _0xb498=['update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb498,0x1b1));var _0x8b49=function(_0x268b9d,_0x3725be){_0x268b9d=_0x268b9d-0x0;var _0x2907bf=_0xb498[_0x268b9d];return _0x2907bf;};'use strict';var _=require(_0x8b49('0x0'));var util=require(_0x8b49('0x1'));var moment=require(_0x8b49('0x2'));var BPromise=require(_0x8b49('0x3'));var rs=require(_0x8b49('0x4'));var fs=require('fs');var Redis=require(_0x8b49('0x5'));var db=require(_0x8b49('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b49('0x7'));var jayson=require(_0x8b49('0x8'));var client=jayson[_0x8b49('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182eb6,_0x3b4201,_0x16f3b9){return new BPromise(function(_0x2397f1,_0x33ca49){return client['request'](_0x182eb6,_0x16f3b9)[_0x8b49('0xa')](function(_0x3aa68a){logger[_0x8b49('0xb')](_0x8b49('0xc'),_0x3b4201,_0x8b49('0xd'));logger[_0x8b49('0xe')](_0x8b49('0xf'),_0x3b4201,_0x8b49('0xd'),JSON[_0x8b49('0x10')](_0x3aa68a));if(_0x3aa68a[_0x8b49('0x11')]){if(_0x3aa68a['error'][_0x8b49('0x12')]===0x1f4){logger[_0x8b49('0x11')](_0x8b49('0xc'),_0x3b4201,_0x3aa68a[_0x8b49('0x11')][_0x8b49('0x13')]);return _0x33ca49(_0x3aa68a[_0x8b49('0x11')][_0x8b49('0x13')]);}logger[_0x8b49('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x3b4201,_0x3aa68a['error'][_0x8b49('0x13')]);return _0x2397f1(_0x3aa68a[_0x8b49('0x11')][_0x8b49('0x13')]);}else{logger['info'](_0x8b49('0xc'),_0x3b4201,'request\x20sent');_0x2397f1(_0x3aa68a[_0x8b49('0x14')]['message']);}})[_0x8b49('0x15')](function(_0x1794e0){logger[_0x8b49('0x11')](_0x8b49('0xc'),_0x3b4201,_0x1794e0);_0x33ca49(_0x1794e0);});});}exports[_0x8b49('0x16')]=function(_0x7854e2){var _0x1ae685=this;return new Promise(function(_0x439c36,_0x58932f){return db[_0x8b49('0x17')][_0x8b49('0x18')](_0x7854e2[_0x8b49('0x19')],{'raw':_0x7854e2[_0x8b49('0x1a')]?_0x7854e2[_0x8b49('0x1a')][_0x8b49('0x1b')]===undefined?!![]:![]:!![]})[_0x8b49('0xa')](function(_0x1b04f3){logger[_0x8b49('0xb')]('CreateSmsQueueReport',_0x7854e2);logger[_0x8b49('0xe')](_0x8b49('0x16'),_0x7854e2,JSON['stringify'](_0x1b04f3));_0x439c36(_0x1b04f3);})['catch'](function(_0x16faa4){logger[_0x8b49('0x11')](_0x8b49('0x16'),_0x16faa4[_0x8b49('0x13')],_0x7854e2);_0x58932f(_0x1ae685[_0x8b49('0x11')](0x1f4,_0x16faa4[_0x8b49('0x13')]));});});};exports[_0x8b49('0x1c')]=function(_0x31500b){var _0x2caace=this;return new Promise(function(_0x18b921,_0x5b89a3){return db[_0x8b49('0x17')][_0x8b49('0x1d')](_0x31500b[_0x8b49('0x19')],{'raw':_0x31500b[_0x8b49('0x1a')]?_0x31500b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31500b[_0x8b49('0x1a')]?_0x31500b[_0x8b49('0x1a')][_0x8b49('0x1e')]||null:null,'attributes':_0x31500b[_0x8b49('0x1a')]?_0x31500b[_0x8b49('0x1a')][_0x8b49('0x1f')]||null:null,'limit':_0x31500b['options']?_0x31500b[_0x8b49('0x1a')][_0x8b49('0x20')]||null:null})[_0x8b49('0xa')](function(_0x3e6ae9){logger['info'](_0x8b49('0x1c'),_0x31500b);logger[_0x8b49('0xe')](_0x8b49('0x1c'),_0x31500b,JSON['stringify'](_0x3e6ae9));_0x18b921(_0x3e6ae9);})[_0x8b49('0x15')](function(_0x153e96){logger[_0x8b49('0x11')](_0x8b49('0x1c'),_0x153e96[_0x8b49('0x13')],_0x31500b);_0x5b89a3(_0x2caace[_0x8b49('0x11')](0x1f4,_0x153e96[_0x8b49('0x13')]));});});}; \ No newline at end of file +var _0x1763=['../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x1763,0xcb));var _0x3176=function(_0xa1de8d,_0x1399a8){_0xa1de8d=_0xa1de8d-0x0;var _0x478b44=_0x1763[_0xa1de8d];return _0x478b44;};'use strict';var _=require(_0x3176('0x0'));var util=require(_0x3176('0x1'));var moment=require('moment');var BPromise=require(_0x3176('0x2'));var rs=require(_0x3176('0x3'));var fs=require('fs');var Redis=require(_0x3176('0x4'));var db=require(_0x3176('0x5'))['db'];var utils=require(_0x3176('0x6'));var logger=require(_0x3176('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3176('0x8'));var client=jayson[_0x3176('0x9')][_0x3176('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x105ec9,_0x34d222,_0x21c13a){return new BPromise(function(_0x150196,_0x52026b){return client['request'](_0x105ec9,_0x21c13a)[_0x3176('0xb')](function(_0x294298){logger[_0x3176('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x34d222,_0x3176('0xd'));logger[_0x3176('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x34d222,_0x3176('0xd'),JSON[_0x3176('0xf')](_0x294298));if(_0x294298['error']){if(_0x294298[_0x3176('0x10')][_0x3176('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x34d222,_0x294298[_0x3176('0x10')][_0x3176('0x12')]);return _0x52026b(_0x294298[_0x3176('0x10')][_0x3176('0x12')]);}logger[_0x3176('0x10')](_0x3176('0x13'),_0x34d222,_0x294298[_0x3176('0x10')]['message']);return _0x150196(_0x294298[_0x3176('0x10')][_0x3176('0x12')]);}else{logger['info'](_0x3176('0x13'),_0x34d222,_0x3176('0xd'));_0x150196(_0x294298[_0x3176('0x14')][_0x3176('0x12')]);}})[_0x3176('0x15')](function(_0xf938b3){logger[_0x3176('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x34d222,_0xf938b3);_0x52026b(_0xf938b3);});});}exports['CreateSmsQueueReport']=function(_0x3b9fe1){var _0xa3147b=this;return new Promise(function(_0x32781c,_0x471050){return db[_0x3176('0x16')][_0x3176('0x17')](_0x3b9fe1['body'],{'raw':_0x3b9fe1[_0x3176('0x18')]?_0x3b9fe1['options'][_0x3176('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x63d21){logger[_0x3176('0xc')](_0x3176('0x1a'),_0x3b9fe1);logger[_0x3176('0xe')](_0x3176('0x1a'),_0x3b9fe1,JSON[_0x3176('0xf')](_0x63d21));_0x32781c(_0x63d21);})['catch'](function(_0x1c7ec3){logger[_0x3176('0x10')](_0x3176('0x1a'),_0x1c7ec3[_0x3176('0x12')],_0x3b9fe1);_0x471050(_0xa3147b[_0x3176('0x10')](0x1f4,_0x1c7ec3[_0x3176('0x12')]));});});};exports[_0x3176('0x1b')]=function(_0x122324){var _0x5b3c2a=this;return new Promise(function(_0x25c394,_0x42c64e){return db[_0x3176('0x16')][_0x3176('0x1c')](_0x122324['body'],{'raw':_0x122324['options']?_0x122324['options'][_0x3176('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122324[_0x3176('0x18')]?_0x122324['options'][_0x3176('0x1d')]||null:null,'attributes':_0x122324[_0x3176('0x18')]?_0x122324[_0x3176('0x18')]['attributes']||null:null,'limit':_0x122324[_0x3176('0x18')]?_0x122324['options']['limit']||null:null})[_0x3176('0xb')](function(_0x378f01){logger[_0x3176('0xc')]('UpdateSmsQueueReport',_0x122324);logger[_0x3176('0xe')](_0x3176('0x1b'),_0x122324,JSON[_0x3176('0xf')](_0x378f01));_0x25c394(_0x378f01);})[_0x3176('0x15')](function(_0x554b6e){logger[_0x3176('0x10')](_0x3176('0x1b'),_0x554b6e[_0x3176('0x12')],_0x122324);_0x42c64e(_0x5b3c2a[_0x3176('0x10')](0x1f4,_0x554b6e[_0x3176('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c3bf586..e64b5ea 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 _0x79a8=['fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','destroy','exports','multer','path','connect-timeout','express'];(function(_0x10fc1d,_0x1966e4){var _0x19cc91=function(_0x11dea4){while(--_0x11dea4){_0x10fc1d['push'](_0x10fc1d['shift']());}};_0x19cc91(++_0x1966e4);}(_0x79a8,0x1d0));var _0x879a=function(_0x5d3276,_0xd38063){_0x5d3276=_0x5d3276-0x0;var _0x3562f5=_0x79a8[_0x5d3276];return _0x3562f5;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['get'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['show']);router[_0x879a('0xe')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xf')]);router['put'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller['update']);router['delete'](_0x879a('0xd'),auth[_0x879a('0x9')](),controller[_0x879a('0x10')]);module[_0x879a('0x11')]=router; \ No newline at end of file +var _0x00bb=['express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x5231c2,_0x4f781d){var _0x199729=function(_0x15d64f){while(--_0x15d64f){_0x5231c2['push'](_0x5231c2['shift']());}};_0x199729(++_0x4f781d);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xf')](_0xb00b('0xc'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);module[_0xb00b('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 78a13cc..a677d54 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4f9673,_0x4313bd){var _0x337e5e=function(_0x5677cf){while(--_0x5677cf){_0x4f9673['push'](_0x4f9673['shift']());}};_0x337e5e(++_0x4313bd);}(_0x54ef,0x112));var _0xf54e=function(_0x4fd149,_0x17e536){_0x4fd149=_0x4fd149-0x0;var _0x39a960=_0x54ef[_0x4fd149];return _0x39a960;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2a6732,_0xab0429){var _0x16698c=function(_0x200659){while(--_0x200659){_0x2a6732['push'](_0x2a6732['shift']());}};_0x16698c(++_0xab0429);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 488eae2..2155bfb 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 _0xdb8b=['apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','catch','show','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x38c903,_0x2aa516){var _0x5bfe96=function(_0xacf153){while(--_0xacf153){_0x38c903['push'](_0x38c903['shift']());}};_0x5bfe96(++_0x2aa516);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x1d1359,_0x3a67e2){_0x1d1359=_0x1d1359-0x0;var _0x232e34=_0xdb8b[_0x1d1359];return _0x232e34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdb8('0x0'));var zipdir=require(_0xbdb8('0x1'));var jsonpatch=require(_0xbdb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdb8('0x3'));var Mustache=require('mustache');var util=require(_0xbdb8('0x4'));var path=require(_0xbdb8('0x5'));var sox=require(_0xbdb8('0x6'));var csv=require(_0xbdb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdb8('0x8'));var _=require('lodash');var squel=require(_0xbdb8('0x9'));var crypto=require(_0xbdb8('0xa'));var jsforce=require(_0xbdb8('0xb'));var deskjs=require(_0xbdb8('0xc'));var toCsv=require(_0xbdb8('0x7'));var querystring=require(_0xbdb8('0xd'));var Papa=require('papaparse');var Redis=require(_0xbdb8('0xe'));var authService=require(_0xbdb8('0xf'));var qs=require(_0xbdb8('0x10'));var as=require(_0xbdb8('0x11'));var hardwareService=require(_0xbdb8('0x12'));var logger=require(_0xbdb8('0x13'))(_0xbdb8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbdb8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x74d1a,_0x5ad84f){_0x5ad84f=_0x5ad84f||0xcc;return function(_0x3c520b){if(_0x3c520b){return _0x74d1a['sendStatus'](_0x5ad84f);}return _0x74d1a[_0xbdb8('0x16')](_0x5ad84f)[_0xbdb8('0x17')]();};}function respondWithResult(_0x1e8888,_0x407bd0){_0x407bd0=_0x407bd0||0xc8;return function(_0x20984d){if(_0x20984d){return _0x1e8888[_0xbdb8('0x16')](_0x407bd0)[_0xbdb8('0x18')](_0x20984d);}};}function respondWithFilteredResult(_0x207187,_0x149568){return function(_0xcf6e71){if(_0xcf6e71){var _0x3d583b=typeof _0x149568[_0xbdb8('0x19')]===_0xbdb8('0x1a')&&typeof _0x149568['limit']===_0xbdb8('0x1a');var _0x3fc32f=_0xcf6e71[_0xbdb8('0x1b')];var _0x5e5330=_0x3d583b?0x0:_0x149568['offset'];var _0x133800=_0x3d583b?_0xcf6e71['count']:_0x149568[_0xbdb8('0x19')]+_0x149568[_0xbdb8('0x1c')];var _0xb496f8;if(_0x133800>=_0x3fc32f){_0x133800=_0x3fc32f;_0xb496f8=0xc8;}else{_0xb496f8=0xce;}_0x207187[_0xbdb8('0x16')](_0xb496f8);return _0x207187[_0xbdb8('0x1d')](_0xbdb8('0x1e'),_0x5e5330+'-'+_0x133800+'/'+_0x3fc32f)[_0xbdb8('0x18')](_0xcf6e71);}return null;};}function patchUpdates(_0x437095){return function(_0x3cc214){try{jsonpatch[_0xbdb8('0x1f')](_0x3cc214,_0x437095,!![]);}catch(_0x39cfb9){return BPromise[_0xbdb8('0x20')](_0x39cfb9);}return _0x3cc214[_0xbdb8('0x21')]();};}function saveUpdates(_0x25b131,_0x2074e0){return function(_0x3588ee){if(_0x3588ee){return _0x3588ee[_0xbdb8('0x22')](_0x25b131)[_0xbdb8('0x23')](function(_0x1e9398){return _0x1e9398;});}return null;};}function removeEntity(_0x9c0aa0,_0x2a31e6){return function(_0x50c6db){if(_0x50c6db){return _0x50c6db[_0xbdb8('0x24')]()['then'](function(){_0x9c0aa0[_0xbdb8('0x16')](0xcc)[_0xbdb8('0x17')]();});}};}function handleEntityNotFound(_0x4e9e42,_0x1da624){return function(_0x38709a){if(!_0x38709a){_0x4e9e42['sendStatus'](0x194);}return _0x38709a;};}function handleError(_0x6bff1b,_0x453dbb){_0x453dbb=_0x453dbb||0x1f4;return function(_0x1985d1){logger[_0xbdb8('0x25')](_0x1985d1[_0xbdb8('0x26')]);if(_0x1985d1[_0xbdb8('0x27')]){delete _0x1985d1[_0xbdb8('0x27')];}_0x6bff1b['status'](_0x453dbb)[_0xbdb8('0x28')](_0x1985d1);};}exports['index']=function(_0x4d2103,_0x369aed){var _0xdb9223={},_0x459231={},_0x321139={'count':0x0,'rows':[]};var _0x4bc79c=_[_0xbdb8('0x29')](db[_0xbdb8('0x2a')][_0xbdb8('0x2b')],function(_0x477c83){return{'name':_0x477c83['fieldName'],'type':_0x477c83[_0xbdb8('0x2c')][_0xbdb8('0x2d')]};});_0x459231[_0xbdb8('0x2e')]=_[_0xbdb8('0x29')](_0x4bc79c,_0xbdb8('0x27'));_0x459231[_0xbdb8('0x2f')]=_[_0xbdb8('0x30')](_0x4d2103['query']);_0x459231[_0xbdb8('0x31')]=_[_0xbdb8('0x32')](_0x459231['model'],_0x459231['query']);_0xdb9223[_0xbdb8('0x33')]=_[_0xbdb8('0x32')](_0x459231[_0xbdb8('0x2e')],qs['fields'](_0x4d2103[_0xbdb8('0x2f')][_0xbdb8('0x34')]));_0xdb9223[_0xbdb8('0x33')]=_0xdb9223[_0xbdb8('0x33')]['length']?_0xdb9223[_0xbdb8('0x33')]:_0x459231['model'];if(!_0x4d2103['query'][_0xbdb8('0x35')](_0xbdb8('0x36'))){_0xdb9223['limit']=qs[_0xbdb8('0x1c')](_0x4d2103['query'][_0xbdb8('0x1c')]);_0xdb9223[_0xbdb8('0x19')]=qs['offset'](_0x4d2103[_0xbdb8('0x2f')][_0xbdb8('0x19')]);}_0xdb9223[_0xbdb8('0x37')]=qs[_0xbdb8('0x38')](_0x4d2103['query'][_0xbdb8('0x38')]);_0xdb9223[_0xbdb8('0x39')]=qs[_0xbdb8('0x31')](_['pick'](_0x4d2103['query'],_0x459231[_0xbdb8('0x31')]),_0x4bc79c);if(_0x4d2103[_0xbdb8('0x2f')]['filter']){_0xdb9223['where']=_['merge'](_0xdb9223[_0xbdb8('0x39')],{'$or':_[_0xbdb8('0x29')](_0x4bc79c,function(_0x2f1c00){if(_0x2f1c00['type']!==_0xbdb8('0x3a')){var _0x89b5cf={};_0x89b5cf[_0x2f1c00['name']]={'$like':'%'+_0x4d2103['query'][_0xbdb8('0x3b')]+'%'};return _0x89b5cf;}})});}_0xdb9223=_[_0xbdb8('0x3c')]({},_0xdb9223,_0x4d2103[_0xbdb8('0x3d')]);var _0x32d38c={'where':_0xdb9223['where']};return db[_0xbdb8('0x2a')]['count'](_0x32d38c)[_0xbdb8('0x23')](function(_0x531338){_0x321139[_0xbdb8('0x1b')]=_0x531338;if(_0x4d2103[_0xbdb8('0x2f')]['includeAll']){_0xdb9223['include']=[{'all':!![]}];}return db[_0xbdb8('0x2a')]['findAll'](_0xdb9223);})[_0xbdb8('0x23')](function(_0x3006a1){_0x321139['rows']=_0x3006a1;return _0x321139;})[_0xbdb8('0x23')](respondWithFilteredResult(_0x369aed,_0xdb9223))[_0xbdb8('0x3e')](handleError(_0x369aed,null));};exports[_0xbdb8('0x3f')]=function(_0x43f480,_0x3a51db){var _0x3d9c75={'raw':!![],'where':{'id':_0x43f480['params']['id']}},_0x1b1500={};_0x1b1500['model']=_[_0xbdb8('0x30')](db[_0xbdb8('0x2a')][_0xbdb8('0x2b')]);_0x1b1500['query']=_[_0xbdb8('0x30')](_0x43f480[_0xbdb8('0x2f')]);_0x1b1500[_0xbdb8('0x31')]=_[_0xbdb8('0x32')](_0x1b1500[_0xbdb8('0x2e')],_0x1b1500[_0xbdb8('0x2f')]);_0x3d9c75[_0xbdb8('0x33')]=_[_0xbdb8('0x32')](_0x1b1500['model'],qs[_0xbdb8('0x34')](_0x43f480[_0xbdb8('0x2f')][_0xbdb8('0x34')]));_0x3d9c75[_0xbdb8('0x33')]=_0x3d9c75[_0xbdb8('0x33')]['length']?_0x3d9c75[_0xbdb8('0x33')]:_0x1b1500[_0xbdb8('0x2e')];if(_0x43f480[_0xbdb8('0x2f')]['includeAll']){_0x3d9c75[_0xbdb8('0x40')]=[{'all':!![]}];}_0x3d9c75=_[_0xbdb8('0x3c')]({},_0x3d9c75,_0x43f480[_0xbdb8('0x3d')]);return db['SmsTransferReport'][_0xbdb8('0x41')](_0x3d9c75)[_0xbdb8('0x23')](handleEntityNotFound(_0x3a51db,null))[_0xbdb8('0x23')](respondWithResult(_0x3a51db,null))[_0xbdb8('0x3e')](handleError(_0x3a51db,null));};exports['create']=function(_0x3c43c8,_0x537395){return db[_0xbdb8('0x2a')]['create'](_0x3c43c8[_0xbdb8('0x42')],{})[_0xbdb8('0x23')](respondWithResult(_0x537395,0xc9))[_0xbdb8('0x3e')](handleError(_0x537395,null));};exports[_0xbdb8('0x22')]=function(_0x5cbe97,_0x8cef64){if(_0x5cbe97[_0xbdb8('0x42')]['id']){delete _0x5cbe97[_0xbdb8('0x42')]['id'];}return db[_0xbdb8('0x2a')][_0xbdb8('0x41')]({'where':{'id':_0x5cbe97['params']['id']}})[_0xbdb8('0x23')](handleEntityNotFound(_0x8cef64,null))[_0xbdb8('0x23')](saveUpdates(_0x5cbe97['body'],null))[_0xbdb8('0x23')](respondWithResult(_0x8cef64,null))[_0xbdb8('0x3e')](handleError(_0x8cef64,null));};exports[_0xbdb8('0x24')]=function(_0x527bb8,_0x543d3c){return db[_0xbdb8('0x2a')][_0xbdb8('0x41')]({'where':{'id':_0x527bb8[_0xbdb8('0x43')]['id']}})[_0xbdb8('0x23')](handleEntityNotFound(_0x543d3c,null))[_0xbdb8('0x23')](removeEntity(_0x543d3c,null))['catch'](handleError(_0x543d3c,null));};exports[_0xbdb8('0x44')]=function(_0x3944cf,_0x2b1e0f){return db[_0xbdb8('0x2a')][_0xbdb8('0x44')]()[_0xbdb8('0x23')](respondWithResult(_0x2b1e0f,null))[_0xbdb8('0x3e')](handleError(_0x2b1e0f,null));}; \ No newline at end of file +var _0xc64b=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','destroy','then','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','options','includeAll','include','findAll','rows','catch','keys','create','body','update','find','params','describe'];(function(_0x23e5f8,_0x21f851){var _0x27792a=function(_0x1c8997){while(--_0x1c8997){_0x23e5f8['push'](_0x23e5f8['shift']());}};_0x27792a(++_0x21f851);}(_0xc64b,0x16d));var _0xbc64=function(_0x11b534,_0x2d587c){_0x11b534=_0x11b534-0x0;var _0x2604f2=_0xc64b[_0x11b534];return _0x2604f2;};'use strict';var emlformat=require(_0xbc64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc64('0x1'));var jsonpatch=require(_0xbc64('0x2'));var rp=require(_0xbc64('0x3'));var moment=require(_0xbc64('0x4'));var BPromise=require(_0xbc64('0x5'));var Mustache=require(_0xbc64('0x6'));var util=require('util');var path=require(_0xbc64('0x7'));var sox=require(_0xbc64('0x8'));var csv=require(_0xbc64('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc64('0xa'));var _=require(_0xbc64('0xb'));var squel=require('squel');var crypto=require(_0xbc64('0xc'));var jsforce=require(_0xbc64('0xd'));var deskjs=require(_0xbc64('0xe'));var toCsv=require(_0xbc64('0x9'));var querystring=require(_0xbc64('0xf'));var Papa=require(_0xbc64('0x10'));var Redis=require(_0xbc64('0x11'));var authService=require(_0xbc64('0x12'));var qs=require(_0xbc64('0x13'));var as=require(_0xbc64('0x14'));var hardwareService=require(_0xbc64('0x15'));var logger=require(_0xbc64('0x16'))('api');var utils=require(_0xbc64('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbc64('0x18'));var db=require(_0xbc64('0x19'))['db'];function respondWithStatusCode(_0x294d1a,_0x2cb0d6){_0x2cb0d6=_0x2cb0d6||0xcc;return function(_0x2c4a53){if(_0x2c4a53){return _0x294d1a[_0xbc64('0x1a')](_0x2cb0d6);}return _0x294d1a[_0xbc64('0x1b')](_0x2cb0d6)[_0xbc64('0x1c')]();};}function respondWithResult(_0x242a31,_0xe297b6){_0xe297b6=_0xe297b6||0xc8;return function(_0x53a609){if(_0x53a609){return _0x242a31[_0xbc64('0x1b')](_0xe297b6)['json'](_0x53a609);}};}function respondWithFilteredResult(_0x574251,_0x3aaa45){return function(_0x2a72ab){if(_0x2a72ab){var _0x394a39=typeof _0x3aaa45[_0xbc64('0x1d')]===_0xbc64('0x1e')&&typeof _0x3aaa45['limit']==='undefined';var _0x2799cc=_0x2a72ab['count'];var _0x2b846a=_0x394a39?0x0:_0x3aaa45['offset'];var _0x18a25e=_0x394a39?_0x2a72ab[_0xbc64('0x1f')]:_0x3aaa45[_0xbc64('0x1d')]+_0x3aaa45[_0xbc64('0x20')];var _0x5669b5;if(_0x18a25e>=_0x2799cc){_0x18a25e=_0x2799cc;_0x5669b5=0xc8;}else{_0x5669b5=0xce;}_0x574251[_0xbc64('0x1b')](_0x5669b5);return _0x574251['set']('Content-Range',_0x2b846a+'-'+_0x18a25e+'/'+_0x2799cc)[_0xbc64('0x21')](_0x2a72ab);}return null;};}function patchUpdates(_0x51ffb4){return function(_0x184684){try{jsonpatch[_0xbc64('0x22')](_0x184684,_0x51ffb4,!![]);}catch(_0x2bc2e7){return BPromise[_0xbc64('0x23')](_0x2bc2e7);}return _0x184684['save']();};}function saveUpdates(_0x18ab52,_0x18bfb4){return function(_0x582f06){if(_0x582f06){return _0x582f06['update'](_0x18ab52)['then'](function(_0x419490){return _0x419490;});}return null;};}function removeEntity(_0x32fd70,_0x40d16c){return function(_0x563323){if(_0x563323){return _0x563323[_0xbc64('0x24')]()[_0xbc64('0x25')](function(){_0x32fd70[_0xbc64('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec106,_0x4f0022){return function(_0xaaa21d){if(!_0xaaa21d){_0x3ec106[_0xbc64('0x1a')](0x194);}return _0xaaa21d;};}function handleError(_0xce70ae,_0x30594f){_0x30594f=_0x30594f||0x1f4;return function(_0x1f1590){logger['error'](_0x1f1590[_0xbc64('0x26')]);if(_0x1f1590[_0xbc64('0x27')]){delete _0x1f1590[_0xbc64('0x27')];}_0xce70ae[_0xbc64('0x1b')](_0x30594f)[_0xbc64('0x28')](_0x1f1590);};}exports[_0xbc64('0x29')]=function(_0x18ba9a,_0x35b821){var _0x183b2b={},_0xcf22ca={},_0x503058={'count':0x0,'rows':[]};var _0x142a92=_[_0xbc64('0x2a')](db[_0xbc64('0x2b')][_0xbc64('0x2c')],function(_0x60f2d0){return{'name':_0x60f2d0['fieldName'],'type':_0x60f2d0[_0xbc64('0x2d')][_0xbc64('0x2e')]};});_0xcf22ca[_0xbc64('0x2f')]=_['map'](_0x142a92,_0xbc64('0x27'));_0xcf22ca[_0xbc64('0x30')]=_['keys'](_0x18ba9a[_0xbc64('0x30')]);_0xcf22ca[_0xbc64('0x31')]=_[_0xbc64('0x32')](_0xcf22ca[_0xbc64('0x2f')],_0xcf22ca[_0xbc64('0x30')]);_0x183b2b['attributes']=_[_0xbc64('0x32')](_0xcf22ca[_0xbc64('0x2f')],qs[_0xbc64('0x33')](_0x18ba9a[_0xbc64('0x30')]['fields']));_0x183b2b[_0xbc64('0x34')]=_0x183b2b[_0xbc64('0x34')][_0xbc64('0x35')]?_0x183b2b['attributes']:_0xcf22ca[_0xbc64('0x2f')];if(!_0x18ba9a['query']['hasOwnProperty'](_0xbc64('0x36'))){_0x183b2b[_0xbc64('0x20')]=qs[_0xbc64('0x20')](_0x18ba9a[_0xbc64('0x30')][_0xbc64('0x20')]);_0x183b2b[_0xbc64('0x1d')]=qs['offset'](_0x18ba9a['query'][_0xbc64('0x1d')]);}_0x183b2b[_0xbc64('0x37')]=qs[_0xbc64('0x38')](_0x18ba9a['query'][_0xbc64('0x38')]);_0x183b2b['where']=qs['filters'](_[_0xbc64('0x39')](_0x18ba9a[_0xbc64('0x30')],_0xcf22ca[_0xbc64('0x31')]),_0x142a92);if(_0x18ba9a[_0xbc64('0x30')]['filter']){_0x183b2b[_0xbc64('0x3a')]=_[_0xbc64('0x3b')](_0x183b2b[_0xbc64('0x3a')],{'$or':_[_0xbc64('0x2a')](_0x142a92,function(_0x11a630){if(_0x11a630[_0xbc64('0x2d')]!=='VIRTUAL'){var _0x3a2080={};_0x3a2080[_0x11a630[_0xbc64('0x27')]]={'$like':'%'+_0x18ba9a[_0xbc64('0x30')]['filter']+'%'};return _0x3a2080;}})});}_0x183b2b=_['merge']({},_0x183b2b,_0x18ba9a[_0xbc64('0x3c')]);var _0x1c70a0={'where':_0x183b2b[_0xbc64('0x3a')]};return db[_0xbc64('0x2b')][_0xbc64('0x1f')](_0x1c70a0)[_0xbc64('0x25')](function(_0x41b6fa){_0x503058[_0xbc64('0x1f')]=_0x41b6fa;if(_0x18ba9a[_0xbc64('0x30')][_0xbc64('0x3d')]){_0x183b2b[_0xbc64('0x3e')]=[{'all':!![]}];}return db[_0xbc64('0x2b')][_0xbc64('0x3f')](_0x183b2b);})[_0xbc64('0x25')](function(_0x2b2fbb){_0x503058[_0xbc64('0x40')]=_0x2b2fbb;return _0x503058;})[_0xbc64('0x25')](respondWithFilteredResult(_0x35b821,_0x183b2b))[_0xbc64('0x41')](handleError(_0x35b821,null));};exports['show']=function(_0xd3514f,_0x3e5a4a){var _0x48d504={'raw':!![],'where':{'id':_0xd3514f['params']['id']}},_0x43368d={};_0x43368d['model']=_[_0xbc64('0x42')](db[_0xbc64('0x2b')][_0xbc64('0x2c')]);_0x43368d['query']=_[_0xbc64('0x42')](_0xd3514f['query']);_0x43368d[_0xbc64('0x31')]=_['intersection'](_0x43368d[_0xbc64('0x2f')],_0x43368d[_0xbc64('0x30')]);_0x48d504['attributes']=_['intersection'](_0x43368d['model'],qs['fields'](_0xd3514f[_0xbc64('0x30')][_0xbc64('0x33')]));_0x48d504['attributes']=_0x48d504[_0xbc64('0x34')][_0xbc64('0x35')]?_0x48d504[_0xbc64('0x34')]:_0x43368d[_0xbc64('0x2f')];if(_0xd3514f['query'][_0xbc64('0x3d')]){_0x48d504[_0xbc64('0x3e')]=[{'all':!![]}];}_0x48d504=_[_0xbc64('0x3b')]({},_0x48d504,_0xd3514f['options']);return db[_0xbc64('0x2b')]['find'](_0x48d504)[_0xbc64('0x25')](handleEntityNotFound(_0x3e5a4a,null))[_0xbc64('0x25')](respondWithResult(_0x3e5a4a,null))[_0xbc64('0x41')](handleError(_0x3e5a4a,null));};exports[_0xbc64('0x43')]=function(_0x10c0d4,_0x229b9a){return db[_0xbc64('0x2b')]['create'](_0x10c0d4[_0xbc64('0x44')],{})[_0xbc64('0x25')](respondWithResult(_0x229b9a,0xc9))[_0xbc64('0x41')](handleError(_0x229b9a,null));};exports[_0xbc64('0x45')]=function(_0x4c40f2,_0x320479){if(_0x4c40f2['body']['id']){delete _0x4c40f2[_0xbc64('0x44')]['id'];}return db['SmsTransferReport'][_0xbc64('0x46')]({'where':{'id':_0x4c40f2[_0xbc64('0x47')]['id']}})[_0xbc64('0x25')](handleEntityNotFound(_0x320479,null))[_0xbc64('0x25')](saveUpdates(_0x4c40f2[_0xbc64('0x44')],null))[_0xbc64('0x25')](respondWithResult(_0x320479,null))['catch'](handleError(_0x320479,null));};exports['destroy']=function(_0x885a9e,_0x1b8b84){return db[_0xbc64('0x2b')][_0xbc64('0x46')]({'where':{'id':_0x885a9e[_0xbc64('0x47')]['id']}})[_0xbc64('0x25')](handleEntityNotFound(_0x1b8b84,null))[_0xbc64('0x25')](removeEntity(_0x1b8b84,null))[_0xbc64('0x41')](handleError(_0x1b8b84,null));};exports[_0xbc64('0x48')]=function(_0x391490,_0x2f6217){return db[_0xbc64('0x2b')][_0xbc64('0x48')]()['then'](respondWithResult(_0x2f6217,null))[_0xbc64('0x41')](handleError(_0x2f6217,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index bfd7629..c6b80b7 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 _0xa37e=['uniqueid','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x42a8a2,_0x37ba4d){var _0xeac1a1=function(_0x72695b){while(--_0x72695b){_0x42a8a2['push'](_0x42a8a2['shift']());}};_0xeac1a1(++_0x37ba4d);}(_0xa37e,0x97));var _0xea37=function(_0x4642d8,_0x96e78b){_0x4642d8=_0x4642d8-0x0;var _0x214e41=_0xa37e[_0x4642d8];return _0x214e41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xea37('0x9'),'fields':[_0xea37('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4337=['./smsTransferReport.attributes','define','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x511933,_0x1d9966){var _0x3e063d=function(_0x1bb414){while(--_0x1bb414){_0x511933['push'](_0x511933['shift']());}};_0x3e063d(++_0x1d9966);}(_0x4337,0x16e));var _0x7433=function(_0x280745,_0x927cb4){_0x280745=_0x280745-0x0;var _0x39452b=_0x4337[_0x280745];return _0x39452b;};'use strict';var _=require('lodash');var util=require(_0x7433('0x0'));var logger=require('../../config/logger')(_0x7433('0x1'));var moment=require(_0x7433('0x2'));var BPromise=require(_0x7433('0x3'));var rp=require(_0x7433('0x4'));var fs=require('fs');var path=require(_0x7433('0x5'));var rimraf=require(_0x7433('0x6'));var config=require(_0x7433('0x7'));var attributes=require(_0x7433('0x8'));module['exports']=function(_0x48987d,_0x5b2902){return _0x48987d[_0x7433('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7433('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b609e97..b332e1a 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 _0x7118=['info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4bca52,_0x4c5608){var _0x4a3aa0=function(_0x3ec42f){while(--_0x3ec42f){_0x4bca52['push'](_0x4bca52['shift']());}};_0x4a3aa0(++_0x4c5608);}(_0x7118,0x159));var _0x8711=function(_0xe7a781,_0x842a3e){_0xe7a781=_0xe7a781-0x0;var _0x568679=_0x7118[_0xe7a781];return _0x568679;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8711('0x0'));var BPromise=require(_0x8711('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8711('0x2'));var db=require(_0x8711('0x3'))['db'];var utils=require(_0x8711('0x4'));var logger=require(_0x8711('0x5'))(_0x8711('0x6'));var config=require(_0x8711('0x7'));var jayson=require(_0x8711('0x8'));var client=jayson['client'][_0x8711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2244c2,_0x1f23a9,_0x3d82f2){return new BPromise(function(_0x189349,_0xa46f29){return client[_0x8711('0xa')](_0x2244c2,_0x3d82f2)[_0x8711('0xb')](function(_0x32a826){logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,'request\x20sent');logger['debug'](_0x8711('0xe'),_0x1f23a9,_0x8711('0xf'),JSON[_0x8711('0x10')](_0x32a826));if(_0x32a826['error']){if(_0x32a826['error'][_0x8711('0x11')]===0x1f4){logger[_0x8711('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x1f23a9,_0x32a826['error'][_0x8711('0x13')]);return _0xa46f29(_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);}logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);return _0x189349(_0x32a826['error'][_0x8711('0x13')]);}else{logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,_0x8711('0xf'));_0x189349(_0x32a826[_0x8711('0x14')][_0x8711('0x13')]);}})['catch'](function(_0x2f96a0){logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x2f96a0);_0xa46f29(_0x2f96a0);});});} \ No newline at end of file +var _0x13fe=['error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x6608b4,_0x21189e){var _0x485c0a=function(_0x4a5412){while(--_0x4a5412){_0x6608b4['push'](_0x6608b4['shift']());}};_0x485c0a(++_0x21189e);}(_0x13fe,0x138));var _0xe13f=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x13fe[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xe13f('0x0'));var util=require(_0xe13f('0x1'));var moment=require(_0xe13f('0x2'));var BPromise=require(_0xe13f('0x3'));var rs=require(_0xe13f('0x4'));var fs=require('fs');var Redis=require(_0xe13f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe13f('0x6'));var logger=require(_0xe13f('0x7'))(_0xe13f('0x8'));var config=require(_0xe13f('0x9'));var jayson=require(_0xe13f('0xa'));var client=jayson[_0xe13f('0xb')][_0xe13f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594e3b,_0x5c9bee,_0x1b237d){return new BPromise(function(_0x39a413,_0x4e209c){return client['request'](_0x594e3b,_0x1b237d)[_0xe13f('0xd')](function(_0x470c1e){logger['info'](_0xe13f('0xe'),_0x5c9bee,_0xe13f('0xf'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5c9bee,_0xe13f('0xf'),JSON[_0xe13f('0x10')](_0x470c1e));if(_0x470c1e['error']){if(_0x470c1e['error'][_0xe13f('0x11')]===0x1f4){logger[_0xe13f('0x12')](_0xe13f('0xe'),_0x5c9bee,_0x470c1e[_0xe13f('0x12')][_0xe13f('0x13')]);return _0x4e209c(_0x470c1e['error'][_0xe13f('0x13')]);}logger[_0xe13f('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x5c9bee,_0x470c1e[_0xe13f('0x12')][_0xe13f('0x13')]);return _0x39a413(_0x470c1e['error'][_0xe13f('0x13')]);}else{logger[_0xe13f('0x14')](_0xe13f('0xe'),_0x5c9bee,_0xe13f('0xf'));_0x39a413(_0x470c1e[_0xe13f('0x15')][_0xe13f('0x13')]);}})['catch'](function(_0x1ae44a){logger['error'](_0xe13f('0xe'),_0x5c9bee,_0x1ae44a);_0x4e209c(_0x1ae44a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3b87405..1244fa4 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 _0x4b26=['create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x4b26,0x7d));var _0x64b2=function(_0x2defe0,_0x57cf7b){_0x2defe0=_0x2defe0-0x0;var _0x28210e=_0x4b26[_0x2defe0];return _0x28210e;};'use strict';var multer=require('multer');var util=require(_0x64b2('0x0'));var path=require(_0x64b2('0x1'));var timeout=require(_0x64b2('0x2'));var express=require(_0x64b2('0x3'));var router=express[_0x64b2('0x4')]();var fs_extra=require(_0x64b2('0x5'));var auth=require(_0x64b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64b2('0x7'));var controller=require(_0x64b2('0x8'));router[_0x64b2('0x9')]('/',auth[_0x64b2('0xa')](),controller['index']);router['get'](_0x64b2('0xb'),auth[_0x64b2('0xa')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x64b2('0xc')]);var upload=multer({'storage':multer[_0x64b2('0xd')]({'destination':function(_0x1e7c58,_0x9692d1,_0x1836ee){_0x1836ee(null,path['join'](config[_0x64b2('0xe')],_0x64b2('0xf')));},'filename':function(_0x91915d,_0x3cde26,_0x3c2a43){_0x3cde26[_0x64b2('0x10')]=_0x3cde26[_0x64b2('0x10')][_0x64b2('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c2a43(null,util[_0x64b2('0x12')](_0x64b2('0x13'),path[_0x64b2('0x14')](_0x3cde26[_0x64b2('0x10')],path['extname'](_0x3cde26['originalname'])),Date[_0x64b2('0x15')](),path[_0x64b2('0x16')](_0x3cde26['originalname'])));}})});router[_0x64b2('0x17')]('/',upload[_0x64b2('0x18')]('file'),controller[_0x64b2('0x19')]);router[_0x64b2('0x1a')](_0x64b2('0xb'),auth['isAuthenticated'](),controller[_0x64b2('0x1b')]);router[_0x64b2('0x1c')](_0x64b2('0xb'),auth[_0x64b2('0xa')](),controller[_0x64b2('0x1c')]);module[_0x64b2('0x1d')]=router; \ No newline at end of file +var _0x0cbf=['delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','single','file','put','update'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x0cbf,0x12b));var _0xf0cb=function(_0x1f0e58,_0x4ae52d){_0x1f0e58=_0x1f0e58-0x0;var _0x503060=_0x0cbf[_0x1f0e58];return _0x503060;};'use strict';var multer=require(_0xf0cb('0x0'));var util=require(_0xf0cb('0x1'));var path=require('path');var timeout=require(_0xf0cb('0x2'));var express=require(_0xf0cb('0x3'));var router=express[_0xf0cb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0cb('0x5'));var config=require(_0xf0cb('0x6'));var controller=require('./sound.controller');router[_0xf0cb('0x7')]('/',auth[_0xf0cb('0x8')](),controller[_0xf0cb('0x9')]);router['get'](_0xf0cb('0xa'),auth[_0xf0cb('0x8')](),controller[_0xf0cb('0xb')]);router[_0xf0cb('0x7')]('/:id/download',auth[_0xf0cb('0x8')](),controller[_0xf0cb('0xc')]);var upload=multer({'storage':multer[_0xf0cb('0xd')]({'destination':function(_0x8af48e,_0x1c64ae,_0x3d25bf){_0x3d25bf(null,path['join'](config[_0xf0cb('0xe')],_0xf0cb('0xf')));},'filename':function(_0x27c57a,_0x13aa60,_0x3bb8b6){_0x13aa60[_0xf0cb('0x10')]=_0x13aa60[_0xf0cb('0x10')][_0xf0cb('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3bb8b6(null,util[_0xf0cb('0x12')](_0xf0cb('0x13'),path['basename'](_0x13aa60[_0xf0cb('0x10')],path[_0xf0cb('0x14')](_0x13aa60[_0xf0cb('0x10')])),Date['now'](),path[_0xf0cb('0x14')](_0x13aa60['originalname'])));}})});router['post']('/',upload[_0xf0cb('0x15')](_0xf0cb('0x16')),controller['create']);router[_0xf0cb('0x17')]('/:id',auth[_0xf0cb('0x8')](),controller[_0xf0cb('0x18')]);router['delete'](_0xf0cb('0xa'),auth[_0xf0cb('0x8')](),controller[_0xf0cb('0x19')]);module[_0xf0cb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 8ea38d9..3ea73fa 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 _0xa077=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x56a61c,_0x2bdadb){var _0x3e7112=function(_0x5cc912){while(--_0x5cc912){_0x56a61c['push'](_0x56a61c['shift']());}};_0x3e7112(++_0x2bdadb);}(_0xa077,0xb8));var _0x7a07=function(_0x5dc00e,_0x392c80){_0x5dc00e=_0x5dc00e-0x0;var _0x555646=_0xa077[_0x5dc00e];return _0x555646;};'use strict';var Sequelize=require(_0x7a07('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a07('0x1')],'unique':_0x7a07('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7a07('0x1')]},'display_name':{'type':Sequelize[_0x7a07('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7a07('0x1')]},'original_format':{'type':Sequelize[_0x7a07('0x1')]},'original_duration':{'type':Sequelize[_0x7a07('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x7a07('0x4')]},'original_sampleRate':{'type':Sequelize[_0x7a07('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7a07('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x7a07('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7a07('0x5')]},'converted_bitRate':{'type':Sequelize[_0x7a07('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7a07('0x5')]}}; \ No newline at end of file +var _0xfeb7=['BIGINT','INTEGER','sequelize','name','STRING','FLOAT'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xfeb7,0x1d6));var _0x7feb=function(_0x4470c2,_0x2e5170){_0x4470c2=_0x4470c2-0x0;var _0x2064ca=_0xfeb7[_0x4470c2];return _0x2064ca;};'use strict';var Sequelize=require(_0x7feb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7feb('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7feb('0x2')]},'display_name':{'type':Sequelize[_0x7feb('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x7feb('0x2')]},'original_format':{'type':Sequelize[_0x7feb('0x2')]},'original_duration':{'type':Sequelize[_0x7feb('0x3')]},'original_sampleCount':{'type':Sequelize[_0x7feb('0x4')]},'original_channelCount':{'type':Sequelize[_0x7feb('0x5')]},'original_bitRate':{'type':Sequelize[_0x7feb('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7feb('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x7feb('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7feb('0x5')]},'converted_bitRate':{'type':Sequelize[_0x7feb('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7feb('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d119673..8ee31de 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 _0xeb58=['index','map','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','fields','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sound\x20not\x20found','format','%s.%s','create','file','originalname','filename','extname','wav','server/files/sounds/original','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','get','Sounds','UserProfileResource','error','stack','name'];(function(_0x28089e,_0x530f8a){var _0x46a73c=function(_0x461513){while(--_0x461513){_0x28089e['push'](_0x28089e['shift']());}};_0x46a73c(++_0x530f8a);}(_0xeb58,0x1c5));var _0x8eb5=function(_0xb98824,_0x509418){_0xb98824=_0xb98824-0x0;var _0x49d592=_0xeb58[_0xb98824];return _0x49d592;};'use strict';var emlformat=require(_0x8eb5('0x0'));var rimraf=require(_0x8eb5('0x1'));var zipdir=require(_0x8eb5('0x2'));var jsonpatch=require(_0x8eb5('0x3'));var rp=require(_0x8eb5('0x4'));var moment=require(_0x8eb5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8eb5('0x6'));var util=require(_0x8eb5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8eb5('0x8'));var ejs=require(_0x8eb5('0x9'));var fs=require('fs');var fs_extra=require(_0x8eb5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8eb5('0xb'));var jsforce=require(_0x8eb5('0xc'));var deskjs=require(_0x8eb5('0xd'));var toCsv=require(_0x8eb5('0x8'));var querystring=require(_0x8eb5('0xe'));var Papa=require(_0x8eb5('0xf'));var Redis=require(_0x8eb5('0x10'));var authService=require(_0x8eb5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8eb5('0x12'));var hardwareService=require(_0x8eb5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8eb5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8eb5('0x15'));var db=require(_0x8eb5('0x16'))['db'];function respondWithStatusCode(_0x3a2cd3,_0x5b3a1b){_0x5b3a1b=_0x5b3a1b||0xcc;return function(_0x552964){if(_0x552964){return _0x3a2cd3[_0x8eb5('0x17')](_0x5b3a1b);}return _0x3a2cd3[_0x8eb5('0x18')](_0x5b3a1b)[_0x8eb5('0x19')]();};}function respondWithResult(_0x674dcb,_0x3b09c5){_0x3b09c5=_0x3b09c5||0xc8;return function(_0x239741){if(_0x239741){return _0x674dcb[_0x8eb5('0x18')](_0x3b09c5)[_0x8eb5('0x1a')](_0x239741);}};}function respondWithFilteredResult(_0x10bee7,_0x225659){return function(_0x16ae67){if(_0x16ae67){var _0x5e3c52=typeof _0x225659[_0x8eb5('0x1b')]===_0x8eb5('0x1c')&&typeof _0x225659['limit']===_0x8eb5('0x1c');var _0x3f0552=_0x16ae67[_0x8eb5('0x1d')];var _0x2cfee6=_0x5e3c52?0x0:_0x225659[_0x8eb5('0x1b')];var _0x784652=_0x5e3c52?_0x16ae67['count']:_0x225659['offset']+_0x225659[_0x8eb5('0x1e')];var _0x41a673;if(_0x784652>=_0x3f0552){_0x784652=_0x3f0552;_0x41a673=0xc8;}else{_0x41a673=0xce;}_0x10bee7[_0x8eb5('0x18')](_0x41a673);return _0x10bee7[_0x8eb5('0x1f')](_0x8eb5('0x20'),_0x2cfee6+'-'+_0x784652+'/'+_0x3f0552)['json'](_0x16ae67);}return null;};}function patchUpdates(_0x40cd77){return function(_0x48258f){try{jsonpatch['apply'](_0x48258f,_0x40cd77,!![]);}catch(_0x51656d){return BPromise[_0x8eb5('0x21')](_0x51656d);}return _0x48258f[_0x8eb5('0x22')]();};}function saveUpdates(_0x3aee54,_0x598cd1){return function(_0x3e0885){if(_0x3e0885){return _0x3e0885['update'](_0x3aee54)['then'](function(_0x2eaf19){return _0x2eaf19;});}return null;};}function removeEntity(_0x554cf0,_0x278ab6){return function(_0x192177){if(_0x192177){return _0x192177[_0x8eb5('0x23')]()[_0x8eb5('0x24')](function(){var _0x2159d9=_0x192177[_0x8eb5('0x25')]({'plain':!![]});var _0x34df48=_0x8eb5('0x26');return db[_0x8eb5('0x27')][_0x8eb5('0x23')]({'where':{'type':_0x34df48,'resourceId':_0x2159d9['id']}})[_0x8eb5('0x24')](function(){return _0x192177;});})[_0x8eb5('0x24')](function(){_0x554cf0[_0x8eb5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59ecd3,_0x408e34){return function(_0x5f0bc3){if(!_0x5f0bc3){_0x59ecd3[_0x8eb5('0x17')](0x194);}return _0x5f0bc3;};}function handleError(_0x108509,_0xc9d4cc){_0xc9d4cc=_0xc9d4cc||0x1f4;return function(_0x1a1a0f){logger[_0x8eb5('0x28')](_0x1a1a0f[_0x8eb5('0x29')]);if(_0x1a1a0f[_0x8eb5('0x2a')]){delete _0x1a1a0f[_0x8eb5('0x2a')];}_0x108509[_0x8eb5('0x18')](_0xc9d4cc)['send'](_0x1a1a0f);};}exports[_0x8eb5('0x2b')]=function(_0x8a4492,_0x66707c){var _0x5b8836={},_0xc38340={},_0x3f5ef8={'count':0x0,'rows':[]};var _0x49bab7=_[_0x8eb5('0x2c')](db['Sound']['rawAttributes'],function(_0x465603){return{'name':_0x465603[_0x8eb5('0x2d')],'type':_0x465603[_0x8eb5('0x2e')][_0x8eb5('0x2f')]};});_0xc38340[_0x8eb5('0x30')]=_[_0x8eb5('0x2c')](_0x49bab7,_0x8eb5('0x2a'));_0xc38340[_0x8eb5('0x31')]=_[_0x8eb5('0x32')](_0x8a4492[_0x8eb5('0x31')]);_0xc38340['filters']=_['intersection'](_0xc38340[_0x8eb5('0x30')],_0xc38340['query']);_0x5b8836[_0x8eb5('0x33')]=_['intersection'](_0xc38340[_0x8eb5('0x30')],qs['fields'](_0x8a4492[_0x8eb5('0x31')]['fields']));_0x5b8836[_0x8eb5('0x33')]=_0x5b8836['attributes'][_0x8eb5('0x34')]?_0x5b8836[_0x8eb5('0x33')]:_0xc38340['model'];if(!_0x8a4492[_0x8eb5('0x31')][_0x8eb5('0x35')](_0x8eb5('0x36'))){_0x5b8836[_0x8eb5('0x1e')]=qs[_0x8eb5('0x1e')](_0x8a4492[_0x8eb5('0x31')][_0x8eb5('0x1e')]);_0x5b8836[_0x8eb5('0x1b')]=qs[_0x8eb5('0x1b')](_0x8a4492[_0x8eb5('0x31')]['offset']);}_0x5b8836[_0x8eb5('0x37')]=qs[_0x8eb5('0x38')](_0x8a4492[_0x8eb5('0x31')][_0x8eb5('0x38')]);_0x5b8836[_0x8eb5('0x39')]=qs[_0x8eb5('0x3a')](_[_0x8eb5('0x3b')](_0x8a4492[_0x8eb5('0x31')],_0xc38340[_0x8eb5('0x3a')]),_0x49bab7);if(_0x8a4492[_0x8eb5('0x31')][_0x8eb5('0x3c')]){_0x5b8836[_0x8eb5('0x39')]=_[_0x8eb5('0x3d')](_0x5b8836[_0x8eb5('0x39')],{'$or':_[_0x8eb5('0x2c')](_0x49bab7,function(_0x53d66d){if(_0x53d66d[_0x8eb5('0x2e')]!==_0x8eb5('0x3e')){var _0x5abbd9={};_0x5abbd9[_0x53d66d[_0x8eb5('0x2a')]]={'$like':'%'+_0x8a4492['query'][_0x8eb5('0x3c')]+'%'};return _0x5abbd9;}})});}_0x5b8836=_[_0x8eb5('0x3d')]({},_0x5b8836,_0x8a4492[_0x8eb5('0x3f')]);var _0x4646e8={'where':_0x5b8836[_0x8eb5('0x39')]};return db[_0x8eb5('0x40')][_0x8eb5('0x1d')](_0x4646e8)['then'](function(_0xcaf06f){_0x3f5ef8[_0x8eb5('0x1d')]=_0xcaf06f;if(_0x8a4492[_0x8eb5('0x31')][_0x8eb5('0x41')]){_0x5b8836[_0x8eb5('0x42')]=[{'all':!![]}];}return db[_0x8eb5('0x40')][_0x8eb5('0x43')](_0x5b8836);})[_0x8eb5('0x24')](function(_0xac6fa6){_0x3f5ef8[_0x8eb5('0x44')]=_0xac6fa6;return _0x3f5ef8;})[_0x8eb5('0x24')](respondWithFilteredResult(_0x66707c,_0x5b8836))[_0x8eb5('0x45')](handleError(_0x66707c,null));};exports['show']=function(_0x12c8b1,_0x50b204){var _0x948798={'raw':!![],'where':{'id':_0x12c8b1[_0x8eb5('0x46')]['id']}},_0x3453bf={};_0x3453bf[_0x8eb5('0x30')]=_[_0x8eb5('0x32')](db[_0x8eb5('0x40')][_0x8eb5('0x47')]);_0x3453bf[_0x8eb5('0x31')]=_[_0x8eb5('0x32')](_0x12c8b1[_0x8eb5('0x31')]);_0x3453bf[_0x8eb5('0x3a')]=_['intersection'](_0x3453bf[_0x8eb5('0x30')],_0x3453bf[_0x8eb5('0x31')]);_0x948798[_0x8eb5('0x33')]=_[_0x8eb5('0x48')](_0x3453bf[_0x8eb5('0x30')],qs['fields'](_0x12c8b1['query'][_0x8eb5('0x49')]));_0x948798[_0x8eb5('0x33')]=_0x948798[_0x8eb5('0x33')]['length']?_0x948798[_0x8eb5('0x33')]:_0x3453bf[_0x8eb5('0x30')];if(_0x12c8b1[_0x8eb5('0x31')]['includeAll']){_0x948798[_0x8eb5('0x42')]=[{'all':!![]}];}_0x948798=_[_0x8eb5('0x3d')]({},_0x948798,_0x12c8b1[_0x8eb5('0x3f')]);return db[_0x8eb5('0x40')][_0x8eb5('0x4a')](_0x948798)[_0x8eb5('0x24')](handleEntityNotFound(_0x50b204,null))['then'](respondWithResult(_0x50b204,null))[_0x8eb5('0x45')](handleError(_0x50b204,null));};exports[_0x8eb5('0x4b')]=function(_0x2394fe,_0x15d48f,_0x328bef){return db[_0x8eb5('0x40')]['find']({'where':{'id':_0x2394fe[_0x8eb5('0x46')]['id']},'attributes':['name','save_name',_0x8eb5('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x15d48f,null))[_0x8eb5('0x24')](function(_0x3c9362){if(_0x3c9362){if(!fs[_0x8eb5('0x4d')](path[_0x8eb5('0x4e')](config[_0x8eb5('0x4f')],_0x8eb5('0x50'),_0x3c9362[_0x8eb5('0x51')]+'.'+_0x3c9362[_0x8eb5('0x4c')]))){throw new db['Sequelize']['ValidationError'](_0x8eb5('0x52'));}return _0x15d48f[_0x8eb5('0x4b')](path['join'](config['root'],_0x8eb5('0x50'),util[_0x8eb5('0x53')]('%s.%s',_0x3c9362['save_name'],_0x3c9362[_0x8eb5('0x4c')])),util['format'](_0x8eb5('0x54'),_0x3c9362[_0x8eb5('0x2a')],_0x3c9362[_0x8eb5('0x4c')]));}return null;})[_0x8eb5('0x45')](handleError(_0x15d48f,null));};exports[_0x8eb5('0x55')]=function(_0x55294b,_0x3da8c4,_0x4a31aa){var _0x5c9b01={'name':path['basename'](_0x55294b[_0x8eb5('0x56')]['originalname'],path['extname'](_0x55294b[_0x8eb5('0x56')][_0x8eb5('0x57')])),'save_name':path['basename'](_0x55294b[_0x8eb5('0x56')][_0x8eb5('0x58')],path['extname'](_0x55294b[_0x8eb5('0x56')][_0x8eb5('0x58')])),'original_format':path[_0x8eb5('0x59')](_0x55294b[_0x8eb5('0x56')]['originalname'])['substring'](0x1),'converted_format':_0x8eb5('0x5a')};var _0x2e82a4=path[_0x8eb5('0x4e')](config[_0x8eb5('0x4f')],_0x8eb5('0x5b'),_0x55294b['file'][_0x8eb5('0x58')]);var _0x42d92e=path['join'](config[_0x8eb5('0x4f')],_0x8eb5('0x50'),util[_0x8eb5('0x53')](_0x8eb5('0x54'),path[_0x8eb5('0x5c')](_0x55294b[_0x8eb5('0x56')]['filename'],path[_0x8eb5('0x59')](_0x55294b[_0x8eb5('0x56')][_0x8eb5('0x58')])),_0x5c9b01['converted_format']));logger[_0x8eb5('0x5d')](_0x8eb5('0x5e'),_0x2e82a4);logger[_0x8eb5('0x5d')](_0x8eb5('0x5f'),_0x42d92e);try{fs[_0x8eb5('0x60')](_0x2e82a4,parseInt(_0x8eb5('0x61'),0x8));var _0xfa5138=sox[_0x8eb5('0x62')](_0x2e82a4,_0x42d92e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xfa5138['on'](_0x8eb5('0x28'),function(_0xc8793e){fs['unlinkSync'](_0x2e82a4);_0x3da8c4['status'](0x1f4)['send'](_0xc8793e);});_0xfa5138['on'](_0x8eb5('0x63'),function(_0x2d4d0f){_0x5c9b01[_0x8eb5('0x64')]=isNaN(_0x2d4d0f[_0x8eb5('0x65')])?null:_0x2d4d0f[_0x8eb5('0x65')]*0x3e8;_0x5c9b01['original_sampleCount']=isNaN(_0x2d4d0f[_0x8eb5('0x66')])?null:_0x2d4d0f[_0x8eb5('0x66')];_0x5c9b01['original_channelCount']=isNaN(_0x2d4d0f[_0x8eb5('0x67')])?null:_0x2d4d0f[_0x8eb5('0x67')];_0x5c9b01[_0x8eb5('0x68')]=isNaN(_0x2d4d0f[_0x8eb5('0x69')])?null:_0x2d4d0f['bitRate'];_0x5c9b01['original_sampleRate']=isNaN(_0x2d4d0f['sampleRate'])?null:_0x2d4d0f[_0x8eb5('0x6a')];});_0xfa5138['on'](_0x8eb5('0x6b'),function(_0x2f84bd){_0x5c9b01['converted_duration']=isNaN(_0x2f84bd[_0x8eb5('0x65')])?null:_0x2f84bd[_0x8eb5('0x65')]*0x3e8;_0x5c9b01[_0x8eb5('0x6c')]=isNaN(_0x2f84bd[_0x8eb5('0x66')])?null:_0x2f84bd[_0x8eb5('0x66')];_0x5c9b01[_0x8eb5('0x6d')]=isNaN(_0x2f84bd['channelCount'])?null:_0x2f84bd[_0x8eb5('0x67')];_0x5c9b01[_0x8eb5('0x6e')]=isNaN(_0x2f84bd[_0x8eb5('0x69')])?null:_0x2f84bd[_0x8eb5('0x69')];_0x5c9b01[_0x8eb5('0x6f')]=isNaN(_0x2f84bd['sampleRate'])?null:_0x2f84bd[_0x8eb5('0x6a')];});_0xfa5138['on'](_0x8eb5('0x19'),function(){fs[_0x8eb5('0x60')](_0x42d92e,parseInt(_0x8eb5('0x61'),0x8));return db[_0x8eb5('0x40')][_0x8eb5('0x55')](_0x5c9b01)[_0x8eb5('0x24')](function(_0x1f254e){var _0x54b5c5={'role':_0x55294b[_0x8eb5('0x70')][_0x8eb5('0x71')],'userProfileId':_0x55294b[_0x8eb5('0x70')][_0x8eb5('0x72')]};if(!_0x54b5c5)throw new Error(_0x8eb5('0x73'));if(_0x54b5c5[_0x8eb5('0x71')]===_0x8eb5('0x74')){var _0x8a5720=_0x1f254e[_0x8eb5('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x8eb5('0x4a')]({'where':{'name':_0x8eb5('0x26'),'userProfileId':_0x54b5c5[_0x8eb5('0x72')]},'raw':!![]})['then'](function(_0x29749f){if(_0x29749f&&_0x29749f[_0x8eb5('0x75')]===0x0){return db[_0x8eb5('0x27')][_0x8eb5('0x55')]({'name':_0x8a5720['name'],'resourceId':_0x8a5720['id'],'type':_0x29749f['name'],'sectionId':_0x29749f['id']},{})[_0x8eb5('0x24')](function(){return _0x1f254e;});}else{return _0x1f254e;}})[_0x8eb5('0x45')](function(_0x17ee6b){logger[_0x8eb5('0x28')](_0x8eb5('0x76'),_0x17ee6b);throw _0x17ee6b;});}return _0x1f254e;})[_0x8eb5('0x24')](respondWithResult(_0x3da8c4,null))['catch'](handleError(_0x3da8c4,null));});_0xfa5138[_0x8eb5('0x77')]();}catch(_0x3a2582){_0x3da8c4[_0x8eb5('0x18')](0x1f4)[_0x8eb5('0x78')](_0x3a2582);}};exports['update']=function(_0x1c6d1d,_0x16acf2,_0x1c2d96){return db[_0x8eb5('0x40')]['find']({'where':{'id':_0x1c6d1d[_0x8eb5('0x46')]['id']}})[_0x8eb5('0x24')](handleEntityNotFound(_0x16acf2,null))['then'](saveUpdates(_[_0x8eb5('0x3b')](_0x1c6d1d[_0x8eb5('0x70')],['name','description']),null))['then'](respondWithResult(_0x16acf2,null))[_0x8eb5('0x45')](handleError(_0x16acf2,null));};exports[_0x8eb5('0x79')]=function(_0x2e0ade,_0xafe86,_0x232754){return db[_0x8eb5('0x40')][_0x8eb5('0x4a')]({'where':{'id':_0x2e0ade[_0x8eb5('0x46')]['id']}})['then'](function(_0x2ad2a9){if(_0x2ad2a9){return _0x2ad2a9[_0x8eb5('0x23')]();}})['then'](function(_0x451b33){var _0x15b83f=path[_0x8eb5('0x4e')](config[_0x8eb5('0x4f')],_0x8eb5('0x5b'),util['format']('%s.%s',_0x451b33['save_name'],_0x451b33[_0x8eb5('0x7a')]));var _0x29d5a5=path[_0x8eb5('0x4e')](config[_0x8eb5('0x4f')],_0x8eb5('0x50'),util['format']('%s.%s',_0x451b33[_0x8eb5('0x51')],_0x451b33[_0x8eb5('0x4c')]));fs['unlinkSync'](_0x15b83f);fs[_0x8eb5('0x7b')](_0x29d5a5);return _0x451b33;})['then'](function(_0x3e9548){if(_0x3e9548){return _0xafe86[_0x8eb5('0x18')](0xcc)[_0x8eb5('0x19')]();}})[_0x8eb5('0x24')](handleEntityNotFound(_0xafe86,null))[_0x8eb5('0x45')](handleError(_0xafe86,null));}; \ No newline at end of file +var _0xf71d=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','download','save_name','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','extname','substring','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','chmodSync','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','Sounds','error','stack','name','send','index','map','Sound','rawAttributes','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters'];(function(_0x203bf7,_0x1a9d57){var _0x2a7508=function(_0x167aa7){while(--_0x167aa7){_0x203bf7['push'](_0x203bf7['shift']());}};_0x2a7508(++_0x1a9d57);}(_0xf71d,0x148));var _0xdf71=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xf71d[_0x38b14f];return _0x22a324;};'use strict';var emlformat=require(_0xdf71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf71('0x1'));var jsonpatch=require(_0xdf71('0x2'));var rp=require(_0xdf71('0x3'));var moment=require(_0xdf71('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf71('0x5'));var path=require(_0xdf71('0x6'));var sox=require(_0xdf71('0x7'));var csv=require(_0xdf71('0x8'));var ejs=require(_0xdf71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf71('0xa'));var squel=require(_0xdf71('0xb'));var crypto=require(_0xdf71('0xc'));var jsforce=require(_0xdf71('0xd'));var deskjs=require(_0xdf71('0xe'));var toCsv=require(_0xdf71('0x8'));var querystring=require(_0xdf71('0xf'));var Papa=require(_0xdf71('0x10'));var Redis=require(_0xdf71('0x11'));var authService=require(_0xdf71('0x12'));var qs=require(_0xdf71('0x13'));var as=require(_0xdf71('0x14'));var hardwareService=require(_0xdf71('0x15'));var logger=require(_0xdf71('0x16'))(_0xdf71('0x17'));var utils=require(_0xdf71('0x18'));var config=require(_0xdf71('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf71('0x1a'))['db'];function respondWithStatusCode(_0x32b13d,_0x1adf99){_0x1adf99=_0x1adf99||0xcc;return function(_0x1d1af8){if(_0x1d1af8){return _0x32b13d[_0xdf71('0x1b')](_0x1adf99);}return _0x32b13d[_0xdf71('0x1c')](_0x1adf99)[_0xdf71('0x1d')]();};}function respondWithResult(_0x4e7551,_0x43a3bc){_0x43a3bc=_0x43a3bc||0xc8;return function(_0x2eb877){if(_0x2eb877){return _0x4e7551[_0xdf71('0x1c')](_0x43a3bc)[_0xdf71('0x1e')](_0x2eb877);}};}function respondWithFilteredResult(_0x3ad4b0,_0x23f00a){return function(_0x52834e){if(_0x52834e){var _0x23e87b=typeof _0x23f00a[_0xdf71('0x1f')]===_0xdf71('0x20')&&typeof _0x23f00a[_0xdf71('0x21')]===_0xdf71('0x20');var _0xc2b21a=_0x52834e[_0xdf71('0x22')];var _0x45fc0f=_0x23e87b?0x0:_0x23f00a[_0xdf71('0x1f')];var _0x4578f6=_0x23e87b?_0x52834e['count']:_0x23f00a[_0xdf71('0x1f')]+_0x23f00a[_0xdf71('0x21')];var _0x3d0bbd;if(_0x4578f6>=_0xc2b21a){_0x4578f6=_0xc2b21a;_0x3d0bbd=0xc8;}else{_0x3d0bbd=0xce;}_0x3ad4b0[_0xdf71('0x1c')](_0x3d0bbd);return _0x3ad4b0[_0xdf71('0x23')](_0xdf71('0x24'),_0x45fc0f+'-'+_0x4578f6+'/'+_0xc2b21a)[_0xdf71('0x1e')](_0x52834e);}return null;};}function patchUpdates(_0x1e08ce){return function(_0x5d7f4e){try{jsonpatch[_0xdf71('0x25')](_0x5d7f4e,_0x1e08ce,!![]);}catch(_0x26ee6b){return BPromise['reject'](_0x26ee6b);}return _0x5d7f4e['save']();};}function saveUpdates(_0x387629,_0x9ac396){return function(_0x105e77){if(_0x105e77){return _0x105e77[_0xdf71('0x26')](_0x387629)[_0xdf71('0x27')](function(_0x5c3208){return _0x5c3208;});}return null;};}function removeEntity(_0x1f5ade,_0x5ef73a){return function(_0x3538d5){if(_0x3538d5){return _0x3538d5[_0xdf71('0x28')]()[_0xdf71('0x27')](function(){var _0x3ef19c=_0x3538d5['get']({'plain':!![]});var _0xa9208d=_0xdf71('0x29');return db['UserProfileResource'][_0xdf71('0x28')]({'where':{'type':_0xa9208d,'resourceId':_0x3ef19c['id']}})[_0xdf71('0x27')](function(){return _0x3538d5;});})[_0xdf71('0x27')](function(){_0x1f5ade['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x544e5c,_0x966741){return function(_0x15abab){if(!_0x15abab){_0x544e5c[_0xdf71('0x1b')](0x194);}return _0x15abab;};}function handleError(_0x50b18d,_0x411682){_0x411682=_0x411682||0x1f4;return function(_0x2d7dbf){logger[_0xdf71('0x2a')](_0x2d7dbf[_0xdf71('0x2b')]);if(_0x2d7dbf['name']){delete _0x2d7dbf[_0xdf71('0x2c')];}_0x50b18d[_0xdf71('0x1c')](_0x411682)[_0xdf71('0x2d')](_0x2d7dbf);};}exports[_0xdf71('0x2e')]=function(_0x4c63d4,_0x1939e9){var _0x36a236={},_0x52be76={},_0x335cd4={'count':0x0,'rows':[]};var _0x51c787=_[_0xdf71('0x2f')](db[_0xdf71('0x30')][_0xdf71('0x31')],function(_0x11558c){return{'name':_0x11558c['fieldName'],'type':_0x11558c['type'][_0xdf71('0x32')]};});_0x52be76['model']=_['map'](_0x51c787,_0xdf71('0x2c'));_0x52be76[_0xdf71('0x33')]=_[_0xdf71('0x34')](_0x4c63d4[_0xdf71('0x33')]);_0x52be76['filters']=_[_0xdf71('0x35')](_0x52be76[_0xdf71('0x36')],_0x52be76['query']);_0x36a236[_0xdf71('0x37')]=_[_0xdf71('0x35')](_0x52be76[_0xdf71('0x36')],qs['fields'](_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x38')]));_0x36a236[_0xdf71('0x37')]=_0x36a236[_0xdf71('0x37')]['length']?_0x36a236[_0xdf71('0x37')]:_0x52be76[_0xdf71('0x36')];if(!_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x39')]('nolimit')){_0x36a236[_0xdf71('0x21')]=qs['limit'](_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x21')]);_0x36a236[_0xdf71('0x1f')]=qs[_0xdf71('0x1f')](_0x4c63d4['query'][_0xdf71('0x1f')]);}_0x36a236[_0xdf71('0x3a')]=qs[_0xdf71('0x3b')](_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x3b')]);_0x36a236[_0xdf71('0x3c')]=qs[_0xdf71('0x3d')](_[_0xdf71('0x3e')](_0x4c63d4['query'],_0x52be76[_0xdf71('0x3d')]),_0x51c787);if(_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x3f')]){_0x36a236[_0xdf71('0x3c')]=_[_0xdf71('0x40')](_0x36a236[_0xdf71('0x3c')],{'$or':_[_0xdf71('0x2f')](_0x51c787,function(_0x575640){if(_0x575640[_0xdf71('0x41')]!==_0xdf71('0x42')){var _0xfa92b5={};_0xfa92b5[_0x575640[_0xdf71('0x2c')]]={'$like':'%'+_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x3f')]+'%'};return _0xfa92b5;}})});}_0x36a236=_[_0xdf71('0x40')]({},_0x36a236,_0x4c63d4[_0xdf71('0x43')]);var _0x49ca83={'where':_0x36a236['where']};return db[_0xdf71('0x30')][_0xdf71('0x22')](_0x49ca83)[_0xdf71('0x27')](function(_0x822220){_0x335cd4[_0xdf71('0x22')]=_0x822220;if(_0x4c63d4[_0xdf71('0x33')][_0xdf71('0x44')]){_0x36a236[_0xdf71('0x45')]=[{'all':!![]}];}return db['Sound'][_0xdf71('0x46')](_0x36a236);})['then'](function(_0x397cb1){_0x335cd4[_0xdf71('0x47')]=_0x397cb1;return _0x335cd4;})[_0xdf71('0x27')](respondWithFilteredResult(_0x1939e9,_0x36a236))['catch'](handleError(_0x1939e9,null));};exports[_0xdf71('0x48')]=function(_0x5267e6,_0x1079a3){var _0x4e11d6={'raw':!![],'where':{'id':_0x5267e6[_0xdf71('0x49')]['id']}},_0x329717={};_0x329717[_0xdf71('0x36')]=_[_0xdf71('0x34')](db[_0xdf71('0x30')][_0xdf71('0x31')]);_0x329717['query']=_[_0xdf71('0x34')](_0x5267e6['query']);_0x329717['filters']=_['intersection'](_0x329717['model'],_0x329717[_0xdf71('0x33')]);_0x4e11d6[_0xdf71('0x37')]=_['intersection'](_0x329717[_0xdf71('0x36')],qs[_0xdf71('0x38')](_0x5267e6[_0xdf71('0x33')]['fields']));_0x4e11d6['attributes']=_0x4e11d6[_0xdf71('0x37')][_0xdf71('0x4a')]?_0x4e11d6[_0xdf71('0x37')]:_0x329717[_0xdf71('0x36')];if(_0x5267e6[_0xdf71('0x33')][_0xdf71('0x44')]){_0x4e11d6[_0xdf71('0x45')]=[{'all':!![]}];}_0x4e11d6=_[_0xdf71('0x40')]({},_0x4e11d6,_0x5267e6['options']);return db[_0xdf71('0x30')][_0xdf71('0x4b')](_0x4e11d6)['then'](handleEntityNotFound(_0x1079a3,null))['then'](respondWithResult(_0x1079a3,null))[_0xdf71('0x4c')](handleError(_0x1079a3,null));};exports[_0xdf71('0x4d')]=function(_0x48999f,_0xe3605d,_0x595d92){return db[_0xdf71('0x30')][_0xdf71('0x4b')]({'where':{'id':_0x48999f['params']['id']},'attributes':[_0xdf71('0x2c'),_0xdf71('0x4e'),'converted_format'],'raw':!![]})[_0xdf71('0x27')](handleEntityNotFound(_0xe3605d,null))[_0xdf71('0x27')](function(_0x4affe6){if(_0x4affe6){if(!fs['existsSync'](path[_0xdf71('0x4f')](config[_0xdf71('0x50')],_0xdf71('0x51'),_0x4affe6[_0xdf71('0x4e')]+'.'+_0x4affe6[_0xdf71('0x52')]))){throw new db[(_0xdf71('0x53'))][(_0xdf71('0x54'))](_0xdf71('0x55'));}return _0xe3605d[_0xdf71('0x4d')](path[_0xdf71('0x4f')](config['root'],_0xdf71('0x51'),util[_0xdf71('0x56')]('%s.%s',_0x4affe6[_0xdf71('0x4e')],_0x4affe6['converted_format'])),util[_0xdf71('0x56')](_0xdf71('0x57'),_0x4affe6[_0xdf71('0x2c')],_0x4affe6[_0xdf71('0x52')]));}return null;})[_0xdf71('0x4c')](handleError(_0xe3605d,null));};exports[_0xdf71('0x58')]=function(_0x522814,_0x51af66,_0x349949){var _0x247ab3={'name':path[_0xdf71('0x59')](_0x522814[_0xdf71('0x5a')][_0xdf71('0x5b')],path['extname'](_0x522814['file'][_0xdf71('0x5b')])),'save_name':path[_0xdf71('0x59')](_0x522814['file'][_0xdf71('0x5c')],path[_0xdf71('0x5d')](_0x522814[_0xdf71('0x5a')][_0xdf71('0x5c')])),'original_format':path[_0xdf71('0x5d')](_0x522814[_0xdf71('0x5a')][_0xdf71('0x5b')])[_0xdf71('0x5e')](0x1),'converted_format':'wav'};var _0x5e420c=path[_0xdf71('0x4f')](config['root'],'server/files/sounds/original',_0x522814[_0xdf71('0x5a')][_0xdf71('0x5c')]);var _0x45ea1f=path[_0xdf71('0x4f')](config[_0xdf71('0x50')],_0xdf71('0x51'),util[_0xdf71('0x56')]('%s.%s',path['basename'](_0x522814['file'][_0xdf71('0x5c')],path[_0xdf71('0x5d')](_0x522814[_0xdf71('0x5a')][_0xdf71('0x5c')])),_0x247ab3[_0xdf71('0x52')]));logger['info'](_0xdf71('0x5f'),_0x5e420c);logger[_0xdf71('0x60')](_0xdf71('0x61'),_0x45ea1f);try{fs['chmodSync'](_0x5e420c,parseInt('0777',0x8));var _0x4583c2=sox[_0xdf71('0x62')](_0x5e420c,_0x45ea1f,{'sampleRate':0x1f40,'format':_0xdf71('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4583c2['on'](_0xdf71('0x2a'),function(_0x2f4c1a){fs[_0xdf71('0x64')](_0x5e420c);_0x51af66['status'](0x1f4)[_0xdf71('0x2d')](_0x2f4c1a);});_0x4583c2['on'](_0xdf71('0x65'),function(_0x2005f0){_0x247ab3[_0xdf71('0x66')]=isNaN(_0x2005f0['duration'])?null:_0x2005f0[_0xdf71('0x67')]*0x3e8;_0x247ab3[_0xdf71('0x68')]=isNaN(_0x2005f0[_0xdf71('0x69')])?null:_0x2005f0['sampleCount'];_0x247ab3[_0xdf71('0x6a')]=isNaN(_0x2005f0[_0xdf71('0x6b')])?null:_0x2005f0['channelCount'];_0x247ab3[_0xdf71('0x6c')]=isNaN(_0x2005f0[_0xdf71('0x6d')])?null:_0x2005f0[_0xdf71('0x6d')];_0x247ab3['original_sampleRate']=isNaN(_0x2005f0[_0xdf71('0x6e')])?null:_0x2005f0[_0xdf71('0x6e')];});_0x4583c2['on'](_0xdf71('0x6f'),function(_0x2b5423){_0x247ab3[_0xdf71('0x70')]=isNaN(_0x2b5423['duration'])?null:_0x2b5423[_0xdf71('0x67')]*0x3e8;_0x247ab3[_0xdf71('0x71')]=isNaN(_0x2b5423[_0xdf71('0x69')])?null:_0x2b5423['sampleCount'];_0x247ab3[_0xdf71('0x72')]=isNaN(_0x2b5423[_0xdf71('0x6b')])?null:_0x2b5423[_0xdf71('0x6b')];_0x247ab3['converted_bitRate']=isNaN(_0x2b5423[_0xdf71('0x6d')])?null:_0x2b5423['bitRate'];_0x247ab3[_0xdf71('0x73')]=isNaN(_0x2b5423['sampleRate'])?null:_0x2b5423[_0xdf71('0x6e')];});_0x4583c2['on'](_0xdf71('0x1d'),function(){fs[_0xdf71('0x74')](_0x45ea1f,parseInt(_0xdf71('0x75'),0x8));return db[_0xdf71('0x30')][_0xdf71('0x58')](_0x247ab3)['then'](function(_0x2eb4b0){var _0xa893fe={'role':_0x522814[_0xdf71('0x76')]['role'],'userProfileId':_0x522814[_0xdf71('0x76')][_0xdf71('0x77')]};if(!_0xa893fe)throw new Error(_0xdf71('0x78'));if(_0xa893fe[_0xdf71('0x79')]===_0xdf71('0x7a')){var _0x89ea83=_0x2eb4b0[_0xdf71('0x7b')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xdf71('0x29'),'userProfileId':_0xa893fe[_0xdf71('0x77')]},'raw':!![]})['then'](function(_0x3c0092){if(_0x3c0092&&_0x3c0092[_0xdf71('0x7c')]===0x0){return db[_0xdf71('0x7d')]['create']({'name':_0x89ea83[_0xdf71('0x2c')],'resourceId':_0x89ea83['id'],'type':_0x3c0092[_0xdf71('0x2c')],'sectionId':_0x3c0092['id']},{})[_0xdf71('0x27')](function(){return _0x2eb4b0;});}else{return _0x2eb4b0;}})[_0xdf71('0x4c')](function(_0x554aa9){logger[_0xdf71('0x2a')](_0xdf71('0x7e'),_0x554aa9);throw _0x554aa9;});}return _0x2eb4b0;})[_0xdf71('0x27')](respondWithResult(_0x51af66,null))[_0xdf71('0x4c')](handleError(_0x51af66,null));});_0x4583c2[_0xdf71('0x7f')]();}catch(_0x4faf47){_0x51af66[_0xdf71('0x1c')](0x1f4)[_0xdf71('0x2d')](_0x4faf47);}};exports[_0xdf71('0x26')]=function(_0x2af2dd,_0x2c2f17,_0x377b75){return db[_0xdf71('0x30')][_0xdf71('0x4b')]({'where':{'id':_0x2af2dd[_0xdf71('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c2f17,null))[_0xdf71('0x27')](saveUpdates(_[_0xdf71('0x3e')](_0x2af2dd['body'],['name','description']),null))[_0xdf71('0x27')](respondWithResult(_0x2c2f17,null))[_0xdf71('0x4c')](handleError(_0x2c2f17,null));};exports[_0xdf71('0x80')]=function(_0x1a755d,_0x46051d,_0x34cbb0){return db[_0xdf71('0x30')][_0xdf71('0x4b')]({'where':{'id':_0x1a755d[_0xdf71('0x49')]['id']}})['then'](function(_0x569442){if(_0x569442){return _0x569442[_0xdf71('0x28')]();}})[_0xdf71('0x27')](function(_0x2cde60){var _0x544ded=path[_0xdf71('0x4f')](config['root'],'server/files/sounds/original',util[_0xdf71('0x56')]('%s.%s',_0x2cde60[_0xdf71('0x4e')],_0x2cde60[_0xdf71('0x81')]));var _0x996a26=path[_0xdf71('0x4f')](config[_0xdf71('0x50')],'server/files/sounds/converted',util[_0xdf71('0x56')]('%s.%s',_0x2cde60['save_name'],_0x2cde60[_0xdf71('0x52')]));fs[_0xdf71('0x64')](_0x544ded);fs[_0xdf71('0x64')](_0x996a26);return _0x2cde60;})[_0xdf71('0x27')](function(_0x4bb5b9){if(_0x4bb5b9){return _0x46051d[_0xdf71('0x1c')](0xcc)['end']();}})[_0xdf71('0x27')](handleEntityNotFound(_0x46051d,null))['catch'](handleError(_0x46051d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 88b16fc..75141e1 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 _0xf2ac=['moment','request-promise','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x2a0378,_0x5dfda7){var _0x3eecae=function(_0x5cccc8){while(--_0x5cccc8){_0x2a0378['push'](_0x2a0378['shift']());}};_0x3eecae(++_0x5dfda7);}(_0xf2ac,0x135));var _0xcf2a=function(_0x12ae2c,_0x55f97d){_0x12ae2c=_0x12ae2c-0x0;var _0x7d11a7=_0xf2ac[_0x12ae2c];return _0x7d11a7;};'use strict';var _=require(_0xcf2a('0x0'));var util=require(_0xcf2a('0x1'));var logger=require(_0xcf2a('0x2'))('api');var moment=require(_0xcf2a('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf2a('0x4'));var fs=require('fs');var path=require(_0xcf2a('0x5'));var rimraf=require(_0xcf2a('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf2a('0x7'));module[_0xcf2a('0x8')]=function(_0x6503a2,_0x5a81d5){return _0x6503a2[_0xcf2a('0x9')](_0xcf2a('0xa'),attributes,{'tableName':_0xcf2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3162=['exports','define','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','./sound.attributes'];(function(_0xd0891e,_0x50a341){var _0x4bea1e=function(_0x46f3a0){while(--_0x46f3a0){_0xd0891e['push'](_0xd0891e['shift']());}};_0x4bea1e(++_0x50a341);}(_0x3162,0xc1));var _0x2316=function(_0x4a5195,_0x20603e){_0x4a5195=_0x4a5195-0x0;var _0x30908e=_0x3162[_0x4a5195];return _0x30908e;};'use strict';var _=require('lodash');var util=require(_0x2316('0x0'));var logger=require(_0x2316('0x1'))(_0x2316('0x2'));var moment=require(_0x2316('0x3'));var BPromise=require(_0x2316('0x4'));var rp=require(_0x2316('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2316('0x6'));module[_0x2316('0x7')]=function(_0x4e4c06,_0x2f1470){return _0x4e4c06[_0x2316('0x8')]('Sound',attributes,{'tableName':_0x2316('0x9'),'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 9e410e1..2f3450f 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 _0x0742=['client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0742,0x14b));var _0x2074=function(_0x5b360e,_0x494136){_0x5b360e=_0x5b360e-0x0;var _0x1bf752=_0x0742[_0x5b360e];return _0x1bf752;};'use strict';var _=require('lodash');var util=require(_0x2074('0x0'));var moment=require(_0x2074('0x1'));var BPromise=require(_0x2074('0x2'));var rs=require(_0x2074('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2074('0x4'))['db'];var utils=require(_0x2074('0x5'));var logger=require(_0x2074('0x6'))('rpc');var config=require(_0x2074('0x7'));var jayson=require(_0x2074('0x8'));var client=jayson[_0x2074('0x9')][_0x2074('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1571f2,_0x207c33,_0x51b50c){return new BPromise(function(_0x259b9d,_0x2dd047){return client[_0x2074('0xb')](_0x1571f2,_0x51b50c)[_0x2074('0xc')](function(_0x23c9e0){logger[_0x2074('0xd')]('Sound,\x20%s,\x20%s',_0x207c33,_0x2074('0xe'));logger[_0x2074('0xf')](_0x2074('0x10'),_0x207c33,'request\x20sent',JSON[_0x2074('0x11')](_0x23c9e0));if(_0x23c9e0[_0x2074('0x12')]){if(_0x23c9e0[_0x2074('0x12')][_0x2074('0x13')]===0x1f4){logger[_0x2074('0x12')]('Sound,\x20%s,\x20%s',_0x207c33,_0x23c9e0[_0x2074('0x12')][_0x2074('0x14')]);return _0x2dd047(_0x23c9e0[_0x2074('0x12')][_0x2074('0x14')]);}logger[_0x2074('0x12')](_0x2074('0x15'),_0x207c33,_0x23c9e0['error'][_0x2074('0x14')]);return _0x259b9d(_0x23c9e0[_0x2074('0x12')][_0x2074('0x14')]);}else{logger['info'](_0x2074('0x15'),_0x207c33,'request\x20sent');_0x259b9d(_0x23c9e0[_0x2074('0x16')][_0x2074('0x14')]);}})['catch'](function(_0x4e2509){logger[_0x2074('0x12')](_0x2074('0x15'),_0x207c33,_0x4e2509);_0x2dd047(_0x4e2509);});});}exports[_0x2074('0x17')]=function(_0x50d656){var _0x546a85=this;return new Promise(function(_0x25dbe9,_0x2a4506){return db[_0x2074('0x18')][_0x2074('0x19')]({'raw':_0x50d656[_0x2074('0x1a')]?_0x50d656[_0x2074('0x1a')][_0x2074('0x1b')]===undefined?!![]:![]:!![],'where':_0x50d656[_0x2074('0x1a')]?_0x50d656['options'][_0x2074('0x1c')]||null:null,'attributes':_0x50d656[_0x2074('0x1a')]?_0x50d656['options'][_0x2074('0x1d')]||null:null,'include':_0x50d656[_0x2074('0x1a')]?_0x50d656[_0x2074('0x1a')][_0x2074('0x1e')]?_[_0x2074('0x1f')](_0x50d656[_0x2074('0x1a')][_0x2074('0x1e')],function(_0x12bd01){return{'model':db[_0x12bd01[_0x2074('0x20')]],'as':_0x12bd01['as'],'attributes':_0x12bd01[_0x2074('0x1d')],'include':_0x12bd01[_0x2074('0x1e')]?_[_0x2074('0x1f')](_0x12bd01[_0x2074('0x1e')],function(_0x237329){return{'model':db[_0x237329[_0x2074('0x20')]],'as':_0x237329['as'],'attributes':_0x237329[_0x2074('0x1d')],'include':_0x237329[_0x2074('0x1e')]?_[_0x2074('0x1f')](_0x237329[_0x2074('0x1e')],function(_0x504b4a){return{'model':db[_0x504b4a['model']],'as':_0x504b4a['as'],'attributes':_0x504b4a[_0x2074('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2074('0xc')](function(_0x359800){logger[_0x2074('0xd')](_0x2074('0x17'),_0x50d656);logger['debug'](_0x2074('0x17'),_0x50d656,JSON[_0x2074('0x11')](_0x359800));_0x25dbe9(_0x359800);})[_0x2074('0x21')](function(_0x3de4bc){logger[_0x2074('0x12')](_0x2074('0x17'),_0x3de4bc['message'],_0x50d656);_0x2a4506(_0x546a85[_0x2074('0x12')](0x1f4,_0x3de4bc[_0x2074('0x14')]));});});}; \ No newline at end of file +var _0x20ad=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','randomstring'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x20ad,0xc8));var _0xd20a=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x20ad[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xd20a('0x0'));var util=require(_0xd20a('0x1'));var moment=require(_0xd20a('0x2'));var BPromise=require('bluebird');var rs=require(_0xd20a('0x3'));var fs=require('fs');var Redis=require(_0xd20a('0x4'));var db=require(_0xd20a('0x5'))['db'];var utils=require(_0xd20a('0x6'));var logger=require(_0xd20a('0x7'))(_0xd20a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd20a('0x9')][_0xd20a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211a63,_0xc6953e,_0x563d69){return new BPromise(function(_0x3af64a,_0x3682b7){return client[_0xd20a('0xb')](_0x211a63,_0x563d69)[_0xd20a('0xc')](function(_0x196306){logger[_0xd20a('0xd')]('Sound,\x20%s,\x20%s',_0xc6953e,_0xd20a('0xe'));logger[_0xd20a('0xf')](_0xd20a('0x10'),_0xc6953e,_0xd20a('0xe'),JSON[_0xd20a('0x11')](_0x196306));if(_0x196306[_0xd20a('0x12')]){if(_0x196306['error'][_0xd20a('0x13')]===0x1f4){logger[_0xd20a('0x12')](_0xd20a('0x14'),_0xc6953e,_0x196306[_0xd20a('0x12')]['message']);return _0x3682b7(_0x196306[_0xd20a('0x12')][_0xd20a('0x15')]);}logger[_0xd20a('0x12')]('Sound,\x20%s,\x20%s',_0xc6953e,_0x196306[_0xd20a('0x12')][_0xd20a('0x15')]);return _0x3af64a(_0x196306[_0xd20a('0x12')][_0xd20a('0x15')]);}else{logger['info'](_0xd20a('0x14'),_0xc6953e,_0xd20a('0xe'));_0x3af64a(_0x196306[_0xd20a('0x16')][_0xd20a('0x15')]);}})[_0xd20a('0x17')](function(_0xde0645){logger[_0xd20a('0x12')]('Sound,\x20%s,\x20%s',_0xc6953e,_0xde0645);_0x3682b7(_0xde0645);});});}exports['ShowSound']=function(_0x6e5d88){var _0x2ecfc8=this;return new Promise(function(_0x143c8d,_0x4981f3){return db[_0xd20a('0x18')][_0xd20a('0x19')]({'raw':_0x6e5d88[_0xd20a('0x1a')]?_0x6e5d88[_0xd20a('0x1a')][_0xd20a('0x1b')]===undefined?!![]:![]:!![],'where':_0x6e5d88[_0xd20a('0x1a')]?_0x6e5d88[_0xd20a('0x1a')][_0xd20a('0x1c')]||null:null,'attributes':_0x6e5d88[_0xd20a('0x1a')]?_0x6e5d88['options'][_0xd20a('0x1d')]||null:null,'include':_0x6e5d88['options']?_0x6e5d88[_0xd20a('0x1a')][_0xd20a('0x1e')]?_[_0xd20a('0x1f')](_0x6e5d88[_0xd20a('0x1a')]['include'],function(_0xd6f928){return{'model':db[_0xd6f928['model']],'as':_0xd6f928['as'],'attributes':_0xd6f928[_0xd20a('0x1d')],'include':_0xd6f928['include']?_['map'](_0xd6f928[_0xd20a('0x1e')],function(_0x5f20d6){return{'model':db[_0x5f20d6[_0xd20a('0x20')]],'as':_0x5f20d6['as'],'attributes':_0x5f20d6['attributes'],'include':_0x5f20d6['include']?_[_0xd20a('0x1f')](_0x5f20d6['include'],function(_0x15c3eb){return{'model':db[_0x15c3eb[_0xd20a('0x20')]],'as':_0x15c3eb['as'],'attributes':_0x15c3eb[_0xd20a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd20a('0xc')](function(_0x19d1ed){logger[_0xd20a('0xd')]('ShowSound',_0x6e5d88);logger[_0xd20a('0xf')](_0xd20a('0x21'),_0x6e5d88,JSON[_0xd20a('0x11')](_0x19d1ed));_0x143c8d(_0x19d1ed);})[_0xd20a('0x17')](function(_0x5af652){logger[_0xd20a('0x12')](_0xd20a('0x21'),_0x5af652[_0xd20a('0x15')],_0x6e5d88);_0x4981f3(_0x2ecfc8['error'](0x1f4,_0x5af652[_0xd20a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 415dbe2..063ab38 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7ee493,_0x2cc2cb){var _0x1f2c25=function(_0x243745){while(--_0x243745){_0x7ee493['push'](_0x7ee493['shift']());}};_0x1f2c25(++_0x2cc2cb);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x0b0e[_0x2d61ac];return _0x3f7d3c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +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(_0x527397,_0x53d5c0){var _0x3cc6b2=function(_0xd35442){while(--_0xd35442){_0x527397['push'](_0x527397['shift']());}};_0x3cc6b2(++_0x53d5c0);}(_0xac4a,0x13f));var _0xaac4=function(_0x4e7f7d,_0x4076ac){_0x4e7f7d=_0x4e7f7d-0x0;var _0x18bab8=_0xac4a[_0x4e7f7d];return _0x18bab8;};'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 8445632..fbc31c2 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 _0xf811=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x33f1bc,_0x3335db){var _0x274fbd=function(_0x47b20c){while(--_0x47b20c){_0x33f1bc['push'](_0x33f1bc['shift']());}};_0x274fbd(++_0x3335db);}(_0xf811,0x17a));var _0x1f81=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xf811[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x1f81('0x0'));module[_0x1f81('0x1')]={'uniqueid':{'type':Sequelize[_0x1f81('0x2')]},'body':{'type':Sequelize[_0x1f81('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x1f81('0x4')]('in',_0x1f81('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x1f81('0x2')]},'providerResponse':{'type':Sequelize[_0x1f81('0x3')]}}; \ No newline at end of file +var _0x7878=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x5a73bb,_0x718d3b){var _0x1918c8=function(_0x4d4d0b){while(--_0x4d4d0b){_0x5a73bb['push'](_0x5a73bb['shift']());}};_0x1918c8(++_0x718d3b);}(_0x7878,0x19f));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8787('0x0'));module[_0x8787('0x1')]={'uniqueid':{'type':Sequelize[_0x8787('0x2')]},'body':{'type':Sequelize[_0x8787('0x3')](_0x8787('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x8787('0x5')]('in',_0x8787('0x6')),'defaultValue':_0x8787('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x8787('0x2')]},'providerResponse':{'type':Sequelize[_0x8787('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 92bea9c..1868ae7 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 _0x1902=['desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','set','apply','update','then','destroy','end','error','stack','name','send','index','SquareMessage','rawAttributes','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x1902,0x83));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2190('0x0'));var rimraf=require(_0x2190('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2190('0x2'));var rp=require(_0x2190('0x3'));var moment=require(_0x2190('0x4'));var BPromise=require(_0x2190('0x5'));var Mustache=require(_0x2190('0x6'));var util=require(_0x2190('0x7'));var path=require(_0x2190('0x8'));var sox=require('sox');var csv=require(_0x2190('0x9'));var ejs=require(_0x2190('0xa'));var fs=require('fs');var fs_extra=require(_0x2190('0xb'));var _=require(_0x2190('0xc'));var squel=require(_0x2190('0xd'));var crypto=require('crypto');var jsforce=require(_0x2190('0xe'));var deskjs=require(_0x2190('0xf'));var toCsv=require(_0x2190('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2190('0x10'));var authService=require(_0x2190('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2190('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2190('0x13'))('api');var utils=require(_0x2190('0x14'));var config=require(_0x2190('0x15'));var licenseUtil=require(_0x2190('0x16'));var db=require(_0x2190('0x17'))['db'];function respondWithStatusCode(_0x2275da,_0x2b7f02){_0x2b7f02=_0x2b7f02||0xcc;return function(_0x17505b){if(_0x17505b){return _0x2275da[_0x2190('0x18')](_0x2b7f02);}return _0x2275da['status'](_0x2b7f02)['end']();};}function respondWithResult(_0x4ccd65,_0x40aa73){_0x40aa73=_0x40aa73||0xc8;return function(_0x3083e6){if(_0x3083e6){return _0x4ccd65[_0x2190('0x19')](_0x40aa73)[_0x2190('0x1a')](_0x3083e6);}};}function respondWithFilteredResult(_0x5c6880,_0x22519f){return function(_0x340cf3){if(_0x340cf3){var _0x2dc7ce=typeof _0x22519f[_0x2190('0x1b')]===_0x2190('0x1c')&&typeof _0x22519f['limit']===_0x2190('0x1c');var _0x1b539b=_0x340cf3['count'];var _0x44cc71=_0x2dc7ce?0x0:_0x22519f[_0x2190('0x1b')];var _0x5a20f9=_0x2dc7ce?_0x340cf3['count']:_0x22519f[_0x2190('0x1b')]+_0x22519f['limit'];var _0x3b070b;if(_0x5a20f9>=_0x1b539b){_0x5a20f9=_0x1b539b;_0x3b070b=0xc8;}else{_0x3b070b=0xce;}_0x5c6880['status'](_0x3b070b);return _0x5c6880[_0x2190('0x1d')]('Content-Range',_0x44cc71+'-'+_0x5a20f9+'/'+_0x1b539b)['json'](_0x340cf3);}return null;};}function patchUpdates(_0x303714){return function(_0xaa5b92){try{jsonpatch[_0x2190('0x1e')](_0xaa5b92,_0x303714,!![]);}catch(_0x661953){return BPromise['reject'](_0x661953);}return _0xaa5b92['save']();};}function saveUpdates(_0x4e981c,_0x217098){return function(_0x3c5f0c){if(_0x3c5f0c){return _0x3c5f0c[_0x2190('0x1f')](_0x4e981c)[_0x2190('0x20')](function(_0xf51d5d){return _0xf51d5d;});}return null;};}function removeEntity(_0x13e2e9,_0x24e446){return function(_0x16398c){if(_0x16398c){return _0x16398c[_0x2190('0x21')]()[_0x2190('0x20')](function(){_0x13e2e9[_0x2190('0x19')](0xcc)[_0x2190('0x22')]();});}};}function handleEntityNotFound(_0x4260c3,_0x1e3e00){return function(_0x40ae20){if(!_0x40ae20){_0x4260c3[_0x2190('0x18')](0x194);}return _0x40ae20;};}function handleError(_0x220e7d,_0x4fbb96){_0x4fbb96=_0x4fbb96||0x1f4;return function(_0x5e42e2){logger[_0x2190('0x23')](_0x5e42e2[_0x2190('0x24')]);if(_0x5e42e2['name']){delete _0x5e42e2[_0x2190('0x25')];}_0x220e7d[_0x2190('0x19')](_0x4fbb96)[_0x2190('0x26')](_0x5e42e2);};}exports[_0x2190('0x27')]=function(_0x11259e,_0x1cafd0){var _0x5514f7={},_0x44dc9a={},_0x1f34e8={'count':0x0,'rows':[]};var _0x25b4a4=_['map'](db[_0x2190('0x28')][_0x2190('0x29')],function(_0x1356b6){return{'name':_0x1356b6['fieldName'],'type':_0x1356b6[_0x2190('0x2a')]['key']};});_0x44dc9a['model']=_[_0x2190('0x2b')](_0x25b4a4,_0x2190('0x25'));_0x44dc9a['query']=_['keys'](_0x11259e[_0x2190('0x2c')]);_0x44dc9a[_0x2190('0x2d')]=_[_0x2190('0x2e')](_0x44dc9a[_0x2190('0x2f')],_0x44dc9a['query']);_0x5514f7[_0x2190('0x30')]=_[_0x2190('0x2e')](_0x44dc9a[_0x2190('0x2f')],qs['fields'](_0x11259e[_0x2190('0x2c')][_0x2190('0x31')]));_0x5514f7[_0x2190('0x30')]=_0x5514f7[_0x2190('0x30')][_0x2190('0x32')]?_0x5514f7[_0x2190('0x30')]:_0x44dc9a[_0x2190('0x2f')];if(!_0x11259e[_0x2190('0x2c')][_0x2190('0x33')](_0x2190('0x34'))){_0x5514f7[_0x2190('0x35')]=qs[_0x2190('0x35')](_0x11259e[_0x2190('0x2c')][_0x2190('0x35')]);_0x5514f7[_0x2190('0x1b')]=qs['offset'](_0x11259e['query']['offset']);}_0x5514f7[_0x2190('0x36')]=qs['sort'](_0x11259e[_0x2190('0x2c')][_0x2190('0x37')]);_0x5514f7[_0x2190('0x38')]=qs[_0x2190('0x2d')](_[_0x2190('0x39')](_0x11259e[_0x2190('0x2c')],_0x44dc9a[_0x2190('0x2d')]),_0x25b4a4);if(_0x11259e[_0x2190('0x2c')][_0x2190('0x3a')]){_0x5514f7[_0x2190('0x38')]=_[_0x2190('0x3b')](_0x5514f7[_0x2190('0x38')],{'$or':_['map'](_0x25b4a4,function(_0x5bb9b9){if(_0x5bb9b9['type']!==_0x2190('0x3c')){var _0x286ea4={};_0x286ea4[_0x5bb9b9['name']]={'$like':'%'+_0x11259e[_0x2190('0x2c')][_0x2190('0x3a')]+'%'};return _0x286ea4;}})});}_0x5514f7=_[_0x2190('0x3b')]({},_0x5514f7,_0x11259e[_0x2190('0x3d')]);var _0x405bd7={'where':_0x5514f7[_0x2190('0x38')]};return db[_0x2190('0x28')]['count'](_0x405bd7)[_0x2190('0x20')](function(_0x1af519){_0x1f34e8[_0x2190('0x3e')]=_0x1af519;if(_0x11259e[_0x2190('0x2c')]['includeAll']){_0x5514f7[_0x2190('0x3f')]=[{'all':!![]}];}return db[_0x2190('0x28')][_0x2190('0x40')](_0x5514f7);})['then'](function(_0x1c6be8){_0x1f34e8['rows']=_0x1c6be8;return _0x1f34e8;})[_0x2190('0x20')](respondWithFilteredResult(_0x1cafd0,_0x5514f7))['catch'](handleError(_0x1cafd0,null));};exports[_0x2190('0x41')]=function(_0x26e9f2,_0x415e89){var _0x494510={'raw':!![],'where':{'id':_0x26e9f2[_0x2190('0x42')]['id']}},_0x25511f={};_0x25511f[_0x2190('0x2f')]=_['keys'](db[_0x2190('0x28')]['rawAttributes']);_0x25511f[_0x2190('0x2c')]=_[_0x2190('0x43')](_0x26e9f2[_0x2190('0x2c')]);_0x25511f[_0x2190('0x2d')]=_[_0x2190('0x2e')](_0x25511f[_0x2190('0x2f')],_0x25511f['query']);_0x494510['attributes']=_[_0x2190('0x2e')](_0x25511f[_0x2190('0x2f')],qs[_0x2190('0x31')](_0x26e9f2[_0x2190('0x2c')][_0x2190('0x31')]));_0x494510[_0x2190('0x30')]=_0x494510[_0x2190('0x30')]['length']?_0x494510[_0x2190('0x30')]:_0x25511f['model'];if(_0x26e9f2[_0x2190('0x2c')][_0x2190('0x44')]){_0x494510[_0x2190('0x3f')]=[{'all':!![]}];}_0x494510=_[_0x2190('0x3b')]({},_0x494510,_0x26e9f2[_0x2190('0x3d')]);return db[_0x2190('0x28')][_0x2190('0x45')](_0x494510)[_0x2190('0x20')](handleEntityNotFound(_0x415e89,null))[_0x2190('0x20')](respondWithResult(_0x415e89,null))[_0x2190('0x46')](handleError(_0x415e89,null));};exports[_0x2190('0x47')]=function(_0x42de21,_0x560a97){return db[_0x2190('0x28')]['create'](_0x42de21[_0x2190('0x48')],{})['then'](respondWithResult(_0x560a97,0xc9))[_0x2190('0x46')](handleError(_0x560a97,null));};exports['update']=function(_0x5b8614,_0x58cfcc){if(_0x5b8614[_0x2190('0x48')]['id']){delete _0x5b8614['body']['id'];}return db[_0x2190('0x28')]['find']({'where':{'id':_0x5b8614[_0x2190('0x42')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x58cfcc,null))[_0x2190('0x20')](saveUpdates(_0x5b8614[_0x2190('0x48')],null))[_0x2190('0x20')](respondWithResult(_0x58cfcc,null))['catch'](handleError(_0x58cfcc,null));};exports['destroy']=function(_0x368273,_0x502b6d){return db[_0x2190('0x28')][_0x2190('0x45')]({'where':{'id':_0x368273[_0x2190('0x42')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x502b6d,null))['then'](removeEntity(_0x502b6d,null))[_0x2190('0x46')](handleError(_0x502b6d,null));}; \ No newline at end of file +var _0xdcde=['body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','SquareMessage','findAll','rows','catch','show','params','include','find'];(function(_0x549ed3,_0x2f93b6){var _0x430546=function(_0xd31d34){while(--_0xd31d34){_0x549ed3['push'](_0x549ed3['shift']());}};_0x430546(++_0x2f93b6);}(_0xdcde,0x1d0));var _0xedcd=function(_0x258c9f,_0x205c3d){_0x258c9f=_0x258c9f-0x0;var _0x51eeac=_0xdcde[_0x258c9f];return _0x51eeac;};'use strict';var emlformat=require(_0xedcd('0x0'));var rimraf=require(_0xedcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedcd('0x2'));var rp=require(_0xedcd('0x3'));var moment=require(_0xedcd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xedcd('0x5'));var sox=require(_0xedcd('0x6'));var csv=require(_0xedcd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedcd('0x8'));var _=require(_0xedcd('0x9'));var squel=require(_0xedcd('0xa'));var crypto=require(_0xedcd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xedcd('0xc'));var toCsv=require(_0xedcd('0x7'));var querystring=require(_0xedcd('0xd'));var Papa=require(_0xedcd('0xe'));var Redis=require(_0xedcd('0xf'));var authService=require(_0xedcd('0x10'));var qs=require(_0xedcd('0x11'));var as=require(_0xedcd('0x12'));var hardwareService=require(_0xedcd('0x13'));var logger=require(_0xedcd('0x14'))(_0xedcd('0x15'));var utils=require(_0xedcd('0x16'));var config=require(_0xedcd('0x17'));var licenseUtil=require(_0xedcd('0x18'));var db=require(_0xedcd('0x19'))['db'];function respondWithStatusCode(_0x7f32be,_0x552035){_0x552035=_0x552035||0xcc;return function(_0x219b4a){if(_0x219b4a){return _0x7f32be[_0xedcd('0x1a')](_0x552035);}return _0x7f32be['status'](_0x552035)[_0xedcd('0x1b')]();};}function respondWithResult(_0x38bd7b,_0x4e9a38){_0x4e9a38=_0x4e9a38||0xc8;return function(_0x4a9390){if(_0x4a9390){return _0x38bd7b[_0xedcd('0x1c')](_0x4e9a38)['json'](_0x4a9390);}};}function respondWithFilteredResult(_0x546af9,_0x4091b3){return function(_0x39a87a){if(_0x39a87a){var _0x48a5f7=typeof _0x4091b3['offset']===_0xedcd('0x1d')&&typeof _0x4091b3[_0xedcd('0x1e')]==='undefined';var _0x4243a4=_0x39a87a[_0xedcd('0x1f')];var _0x2e0095=_0x48a5f7?0x0:_0x4091b3[_0xedcd('0x20')];var _0x4b7365=_0x48a5f7?_0x39a87a['count']:_0x4091b3[_0xedcd('0x20')]+_0x4091b3[_0xedcd('0x1e')];var _0x4151ac;if(_0x4b7365>=_0x4243a4){_0x4b7365=_0x4243a4;_0x4151ac=0xc8;}else{_0x4151ac=0xce;}_0x546af9[_0xedcd('0x1c')](_0x4151ac);return _0x546af9['set'](_0xedcd('0x21'),_0x2e0095+'-'+_0x4b7365+'/'+_0x4243a4)[_0xedcd('0x22')](_0x39a87a);}return null;};}function patchUpdates(_0x3059c9){return function(_0x4c2928){try{jsonpatch[_0xedcd('0x23')](_0x4c2928,_0x3059c9,!![]);}catch(_0x506c11){return BPromise[_0xedcd('0x24')](_0x506c11);}return _0x4c2928[_0xedcd('0x25')]();};}function saveUpdates(_0x3f14d2,_0x133323){return function(_0x3267ba){if(_0x3267ba){return _0x3267ba['update'](_0x3f14d2)['then'](function(_0x41e13d){return _0x41e13d;});}return null;};}function removeEntity(_0xed7aed,_0x1b51d9){return function(_0x4b3e3d){if(_0x4b3e3d){return _0x4b3e3d[_0xedcd('0x26')]()['then'](function(){_0xed7aed[_0xedcd('0x1c')](0xcc)[_0xedcd('0x1b')]();});}};}function handleEntityNotFound(_0xa7558e,_0x373a7c){return function(_0xdbd925){if(!_0xdbd925){_0xa7558e['sendStatus'](0x194);}return _0xdbd925;};}function handleError(_0x3436e8,_0x58d3b8){_0x58d3b8=_0x58d3b8||0x1f4;return function(_0x246c41){logger[_0xedcd('0x27')](_0x246c41[_0xedcd('0x28')]);if(_0x246c41[_0xedcd('0x29')]){delete _0x246c41[_0xedcd('0x29')];}_0x3436e8[_0xedcd('0x1c')](_0x58d3b8)[_0xedcd('0x2a')](_0x246c41);};}exports[_0xedcd('0x2b')]=function(_0x46110e,_0x359e1b){var _0x7d81f8={},_0x561b14={},_0xd1ec62={'count':0x0,'rows':[]};var _0x217d2a=_[_0xedcd('0x2c')](db['SquareMessage'][_0xedcd('0x2d')],function(_0x399213){return{'name':_0x399213[_0xedcd('0x2e')],'type':_0x399213['type'][_0xedcd('0x2f')]};});_0x561b14['model']=_[_0xedcd('0x2c')](_0x217d2a,_0xedcd('0x29'));_0x561b14[_0xedcd('0x30')]=_[_0xedcd('0x31')](_0x46110e[_0xedcd('0x30')]);_0x561b14[_0xedcd('0x32')]=_['intersection'](_0x561b14[_0xedcd('0x33')],_0x561b14[_0xedcd('0x30')]);_0x7d81f8[_0xedcd('0x34')]=_[_0xedcd('0x35')](_0x561b14[_0xedcd('0x33')],qs['fields'](_0x46110e['query'][_0xedcd('0x36')]));_0x7d81f8[_0xedcd('0x34')]=_0x7d81f8[_0xedcd('0x34')][_0xedcd('0x37')]?_0x7d81f8[_0xedcd('0x34')]:_0x561b14[_0xedcd('0x33')];if(!_0x46110e[_0xedcd('0x30')]['hasOwnProperty'](_0xedcd('0x38'))){_0x7d81f8[_0xedcd('0x1e')]=qs['limit'](_0x46110e[_0xedcd('0x30')][_0xedcd('0x1e')]);_0x7d81f8[_0xedcd('0x20')]=qs[_0xedcd('0x20')](_0x46110e[_0xedcd('0x30')][_0xedcd('0x20')]);}_0x7d81f8[_0xedcd('0x39')]=qs[_0xedcd('0x3a')](_0x46110e['query']['sort']);_0x7d81f8[_0xedcd('0x3b')]=qs[_0xedcd('0x32')](_[_0xedcd('0x3c')](_0x46110e['query'],_0x561b14[_0xedcd('0x32')]),_0x217d2a);if(_0x46110e['query'][_0xedcd('0x3d')]){_0x7d81f8[_0xedcd('0x3b')]=_[_0xedcd('0x3e')](_0x7d81f8['where'],{'$or':_[_0xedcd('0x2c')](_0x217d2a,function(_0xd12f11){if(_0xd12f11[_0xedcd('0x3f')]!==_0xedcd('0x40')){var _0x3f3d31={};_0x3f3d31[_0xd12f11[_0xedcd('0x29')]]={'$like':'%'+_0x46110e[_0xedcd('0x30')][_0xedcd('0x3d')]+'%'};return _0x3f3d31;}})});}_0x7d81f8=_['merge']({},_0x7d81f8,_0x46110e[_0xedcd('0x41')]);var _0xb64f76={'where':_0x7d81f8[_0xedcd('0x3b')]};return db['SquareMessage']['count'](_0xb64f76)[_0xedcd('0x42')](function(_0x5a03fe){_0xd1ec62[_0xedcd('0x1f')]=_0x5a03fe;if(_0x46110e[_0xedcd('0x30')]['includeAll']){_0x7d81f8['include']=[{'all':!![]}];}return db[_0xedcd('0x43')][_0xedcd('0x44')](_0x7d81f8);})[_0xedcd('0x42')](function(_0x46b484){_0xd1ec62[_0xedcd('0x45')]=_0x46b484;return _0xd1ec62;})[_0xedcd('0x42')](respondWithFilteredResult(_0x359e1b,_0x7d81f8))[_0xedcd('0x46')](handleError(_0x359e1b,null));};exports[_0xedcd('0x47')]=function(_0x4d4175,_0x43ec65){var _0x572d32={'raw':!![],'where':{'id':_0x4d4175[_0xedcd('0x48')]['id']}},_0x2f4207={};_0x2f4207[_0xedcd('0x33')]=_['keys'](db[_0xedcd('0x43')]['rawAttributes']);_0x2f4207['query']=_[_0xedcd('0x31')](_0x4d4175['query']);_0x2f4207['filters']=_['intersection'](_0x2f4207[_0xedcd('0x33')],_0x2f4207['query']);_0x572d32['attributes']=_[_0xedcd('0x35')](_0x2f4207[_0xedcd('0x33')],qs[_0xedcd('0x36')](_0x4d4175['query'][_0xedcd('0x36')]));_0x572d32[_0xedcd('0x34')]=_0x572d32[_0xedcd('0x34')][_0xedcd('0x37')]?_0x572d32['attributes']:_0x2f4207[_0xedcd('0x33')];if(_0x4d4175[_0xedcd('0x30')]['includeAll']){_0x572d32[_0xedcd('0x49')]=[{'all':!![]}];}_0x572d32=_[_0xedcd('0x3e')]({},_0x572d32,_0x4d4175[_0xedcd('0x41')]);return db[_0xedcd('0x43')][_0xedcd('0x4a')](_0x572d32)[_0xedcd('0x42')](handleEntityNotFound(_0x43ec65,null))[_0xedcd('0x42')](respondWithResult(_0x43ec65,null))[_0xedcd('0x46')](handleError(_0x43ec65,null));};exports['create']=function(_0x403f9b,_0x4e93e9){return db['SquareMessage']['create'](_0x403f9b[_0xedcd('0x4b')],{})[_0xedcd('0x42')](respondWithResult(_0x4e93e9,0xc9))[_0xedcd('0x46')](handleError(_0x4e93e9,null));};exports[_0xedcd('0x4c')]=function(_0x428532,_0x142787){if(_0x428532['body']['id']){delete _0x428532[_0xedcd('0x4b')]['id'];}return db[_0xedcd('0x43')][_0xedcd('0x4a')]({'where':{'id':_0x428532[_0xedcd('0x48')]['id']}})[_0xedcd('0x42')](handleEntityNotFound(_0x142787,null))[_0xedcd('0x42')](saveUpdates(_0x428532[_0xedcd('0x4b')],null))[_0xedcd('0x42')](respondWithResult(_0x142787,null))[_0xedcd('0x46')](handleError(_0x142787,null));};exports['destroy']=function(_0x31cdc0,_0x43ca02){return db[_0xedcd('0x43')][_0xedcd('0x4a')]({'where':{'id':_0x31cdc0[_0xedcd('0x48')]['id']}})['then'](handleEntityNotFound(_0x43ca02,null))[_0xedcd('0x42')](removeEntity(_0x43ca02,null))[_0xedcd('0x46')](handleError(_0x43ca02,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1a7a96a..e662909 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 _0x0775=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','SquareMessage','lodash','util'];(function(_0x553c2a,_0x567b97){var _0x2fce8f=function(_0x5af290){while(--_0x5af290){_0x553c2a['push'](_0x553c2a['shift']());}};_0x2fce8f(++_0x567b97);}(_0x0775,0x1f2));var _0x5077=function(_0x37b855,_0x3dc778){_0x37b855=_0x37b855-0x0;var _0x26ed5e=_0x0775[_0x37b855];return _0x26ed5e;};'use strict';var _=require(_0x5077('0x0'));var util=require(_0x5077('0x1'));var logger=require(_0x5077('0x2'))(_0x5077('0x3'));var moment=require(_0x5077('0x4'));var BPromise=require('bluebird');var rp=require(_0x5077('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5077('0x6'));var config=require(_0x5077('0x7'));var attributes=require('./squareMessage.attributes');module[_0x5077('0x8')]=function(_0x570bae,_0xc712b2){return _0x570bae['define'](_0x5077('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5343=['api','request-promise','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x38ffd7,_0x1791db){var _0x52731e=function(_0x76c12){while(--_0x76c12){_0x38ffd7['push'](_0x38ffd7['shift']());}};_0x52731e(++_0x1791db);}(_0x5343,0x105));var _0x3534=function(_0x17c195,_0x41ee45){_0x17c195=_0x17c195-0x0;var _0x1528d5=_0x5343[_0x17c195];return _0x1528d5;};'use strict';var _=require(_0x3534('0x0'));var util=require(_0x3534('0x1'));var logger=require(_0x3534('0x2'))(_0x3534('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3534('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3534('0x5'));var attributes=require(_0x3534('0x6'));module[_0x3534('0x7')]=function(_0x43dbdf,_0xd40f39){return _0x43dbdf[_0x3534('0x8')](_0x3534('0x9'),attributes,{'tableName':_0x3534('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 7789701..940dd27 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 _0x1c84=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x592918,_0x477b2f){var _0x5aa4c8=function(_0x2f644f){while(--_0x2f644f){_0x592918['push'](_0x592918['shift']());}};_0x5aa4c8(++_0x477b2f);}(_0x1c84,0x199));var _0x41c8=function(_0x266b0c,_0x4fb269){_0x266b0c=_0x266b0c-0x0;var _0xd1bfa7=_0x1c84[_0x266b0c];return _0xd1bfa7;};'use strict';var _=require('lodash');var util=require(_0x41c8('0x0'));var moment=require(_0x41c8('0x1'));var BPromise=require(_0x41c8('0x2'));var rs=require(_0x41c8('0x3'));var fs=require('fs');var Redis=require(_0x41c8('0x4'));var db=require(_0x41c8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41c8('0x6'))(_0x41c8('0x7'));var config=require('../../config/environment');var jayson=require(_0x41c8('0x8'));var client=jayson[_0x41c8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bbe8e,_0x1c4dbc,_0x4e6861){return new BPromise(function(_0x4ef0b1,_0x13dcfe){return client[_0x41c8('0xa')](_0x2bbe8e,_0x4e6861)['then'](function(_0x43d252){logger[_0x41c8('0xb')](_0x41c8('0xc'),_0x1c4dbc,_0x41c8('0xd'));logger[_0x41c8('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1c4dbc,'request\x20sent',JSON[_0x41c8('0xf')](_0x43d252));if(_0x43d252['error']){if(_0x43d252[_0x41c8('0x10')][_0x41c8('0x11')]===0x1f4){logger[_0x41c8('0x10')](_0x41c8('0xc'),_0x1c4dbc,_0x43d252[_0x41c8('0x10')]['message']);return _0x13dcfe(_0x43d252[_0x41c8('0x10')]['message']);}logger[_0x41c8('0x10')](_0x41c8('0xc'),_0x1c4dbc,_0x43d252[_0x41c8('0x10')]['message']);return _0x4ef0b1(_0x43d252[_0x41c8('0x10')][_0x41c8('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x1c4dbc,_0x41c8('0xd'));_0x4ef0b1(_0x43d252[_0x41c8('0x13')]['message']);}})[_0x41c8('0x14')](function(_0x2f82b5){logger[_0x41c8('0x10')]('SquareMessage,\x20%s,\x20%s',_0x1c4dbc,_0x2f82b5);_0x13dcfe(_0x2f82b5);});});}exports[_0x41c8('0x15')]=function(_0x21ba69){var _0xc427f2=this;return new Promise(function(_0x1e1bfd,_0xea410c){return db[_0x41c8('0x16')][_0x41c8('0x17')](_0x21ba69[_0x41c8('0x18')],{'raw':_0x21ba69[_0x41c8('0x19')]?_0x21ba69['options'][_0x41c8('0x1a')]===undefined?!![]:![]:!![]})[_0x41c8('0x1b')](function(_0x1f8cd3){logger[_0x41c8('0xb')](_0x41c8('0x15'),_0x21ba69);logger[_0x41c8('0xe')](_0x41c8('0x15'),_0x21ba69,JSON[_0x41c8('0xf')](_0x1f8cd3));_0x1e1bfd(_0x1f8cd3);})[_0x41c8('0x14')](function(_0xe1fdd8){logger[_0x41c8('0x10')](_0x41c8('0x15'),_0xe1fdd8[_0x41c8('0x12')],_0x21ba69);_0xea410c(_0xc427f2[_0x41c8('0x10')](0x1f4,_0xe1fdd8['message']));});});}; \ No newline at end of file +var _0x8a59=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','util','moment'];(function(_0x4ef970,_0x59f40f){var _0x4d82d7=function(_0x43dcca){while(--_0x43dcca){_0x4ef970['push'](_0x4ef970['shift']());}};_0x4d82d7(++_0x59f40f);}(_0x8a59,0x76));var _0x98a5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8a59[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x98a5('0x0'));var moment=require(_0x98a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x98a5('0x2'));var fs=require('fs');var Redis=require(_0x98a5('0x3'));var db=require(_0x98a5('0x4'))['db'];var utils=require(_0x98a5('0x5'));var logger=require(_0x98a5('0x6'))(_0x98a5('0x7'));var config=require(_0x98a5('0x8'));var jayson=require(_0x98a5('0x9'));var client=jayson[_0x98a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c168e,_0x2e437d,_0x42977a){return new BPromise(function(_0x23e4e7,_0x57e8dc){return client[_0x98a5('0xb')](_0x1c168e,_0x42977a)['then'](function(_0x4ac922){logger['info'](_0x98a5('0xc'),_0x2e437d,_0x98a5('0xd'));logger[_0x98a5('0xe')](_0x98a5('0xf'),_0x2e437d,_0x98a5('0xd'),JSON[_0x98a5('0x10')](_0x4ac922));if(_0x4ac922[_0x98a5('0x11')]){if(_0x4ac922['error'][_0x98a5('0x12')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x2e437d,_0x4ac922[_0x98a5('0x11')][_0x98a5('0x13')]);return _0x57e8dc(_0x4ac922[_0x98a5('0x11')][_0x98a5('0x13')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x2e437d,_0x4ac922['error'][_0x98a5('0x13')]);return _0x23e4e7(_0x4ac922[_0x98a5('0x11')][_0x98a5('0x13')]);}else{logger[_0x98a5('0x14')](_0x98a5('0xc'),_0x2e437d,_0x98a5('0xd'));_0x23e4e7(_0x4ac922[_0x98a5('0x15')][_0x98a5('0x13')]);}})[_0x98a5('0x16')](function(_0x5003c6){logger[_0x98a5('0x11')](_0x98a5('0xc'),_0x2e437d,_0x5003c6);_0x57e8dc(_0x5003c6);});});}exports[_0x98a5('0x17')]=function(_0x356986){var _0x23cd6e=this;return new Promise(function(_0x26569f,_0x2eb545){return db[_0x98a5('0x18')][_0x98a5('0x19')](_0x356986[_0x98a5('0x1a')],{'raw':_0x356986[_0x98a5('0x1b')]?_0x356986[_0x98a5('0x1b')][_0x98a5('0x1c')]===undefined?!![]:![]:!![]})[_0x98a5('0x1d')](function(_0xf5c0f3){logger[_0x98a5('0x14')](_0x98a5('0x17'),_0x356986);logger[_0x98a5('0xe')]('CreateSquareMessage',_0x356986,JSON[_0x98a5('0x10')](_0xf5c0f3));_0x26569f(_0xf5c0f3);})[_0x98a5('0x16')](function(_0x459816){logger[_0x98a5('0x11')](_0x98a5('0x17'),_0x459816['message'],_0x356986);_0x2eb545(_0x23cd6e[_0x98a5('0x11')](0x1f4,_0x459816[_0x98a5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7503a16..25a2b8a 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 _0xec0d=['index','/:id','15s','test','create','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2c4d15,_0x326822){var _0x430794=function(_0x1f40bb){while(--_0x1f40bb){_0x2c4d15['push'](_0x2c4d15['shift']());}};_0x430794(++_0x326822);}(_0xec0d,0xd2));var _0xdec0=function(_0x4d8536,_0x2acb73){_0x4d8536=_0x4d8536-0x0;var _0x496b14=_0xec0d[_0x4d8536];return _0x496b14;};'use strict';var multer=require(_0xdec0('0x0'));var util=require(_0xdec0('0x1'));var path=require(_0xdec0('0x2'));var timeout=require(_0xdec0('0x3'));var express=require(_0xdec0('0x4'));var router=express[_0xdec0('0x5')]();var fs_extra=require(_0xdec0('0x6'));var auth=require(_0xdec0('0x7'));var interaction=require(_0xdec0('0x8'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0xdec0('0x9')]('/',auth[_0xdec0('0xa')](),controller[_0xdec0('0xb')]);router[_0xdec0('0x9')](_0xdec0('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/test',auth[_0xdec0('0xa')](),timeout(_0xdec0('0xd')),controller[_0xdec0('0xe')]);router['post']('/',auth[_0xdec0('0xa')](),controller[_0xdec0('0xf')]);router['put'](_0xdec0('0xc'),auth[_0xdec0('0xa')](),controller['update']);router[_0xdec0('0x10')]('/:id',auth[_0xdec0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0245=['15s','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','index','isAuthenticated','/:id/test'];(function(_0x33bb21,_0x234f4f){var _0x5a4079=function(_0x5df4a5){while(--_0x5df4a5){_0x33bb21['push'](_0x33bb21['shift']());}};_0x5a4079(++_0x234f4f);}(_0x0245,0x115));var _0x5024=function(_0x461924,_0x848512){_0x461924=_0x461924-0x0;var _0x159356=_0x0245[_0x461924];return _0x159356;};'use strict';var multer=require(_0x5024('0x0'));var util=require(_0x5024('0x1'));var path=require(_0x5024('0x2'));var timeout=require(_0x5024('0x3'));var express=require(_0x5024('0x4'));var router=express['Router']();var fs_extra=require(_0x5024('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5024('0x6'));var controller=require('./squareOdbc.controller');router[_0x5024('0x7')]('/',auth['isAuthenticated'](),controller[_0x5024('0x8')]);router[_0x5024('0x7')]('/:id',auth[_0x5024('0x9')](),controller['show']);router[_0x5024('0x7')](_0x5024('0xa'),auth[_0x5024('0x9')](),timeout(_0x5024('0xb')),controller['test']);router[_0x5024('0xc')]('/',auth[_0x5024('0x9')](),controller[_0x5024('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5024('0xe')]);router[_0x5024('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5024('0x10')]);module[_0x5024('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 4afeac0..ba5512b 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 _0x4dbb=['STRING','name','exports'];(function(_0x1774ac,_0x535738){var _0x331bc1=function(_0x26e473){while(--_0x26e473){_0x1774ac['push'](_0x1774ac['shift']());}};_0x331bc1(++_0x535738);}(_0x4dbb,0xe0));var _0xb4db=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x4dbb[_0x5756c6];return _0x4b5806;};'use strict';var Sequelize=require('sequelize');module[_0xb4db('0x0')]={'name':{'type':Sequelize[_0xb4db('0x1')],'unique':_0xb4db('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb4db('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4cd3=['name','STRING','sequelize'];(function(_0x56b276,_0x10641a){var _0x581eed=function(_0x22186b){while(--_0x22186b){_0x56b276['push'](_0x56b276['shift']());}};_0x581eed(++_0x10641a);}(_0x4cd3,0x19d));var _0x34cd=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x4cd3[_0x5c6244];return _0x5800ce;};'use strict';var Sequelize=require(_0x34cd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x34cd('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x34cd('0x2')]},'description':{'type':Sequelize[_0x34cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 26353b4..8e5f0a0 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 _0xefa1=['type','keys','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','filters','merge','filter','options','SquareOdbc','include','findAll','rows','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','ODBC','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xefa1,0x1cb));var _0x1efa=function(_0x2fdbfe,_0x3053e3){_0x2fdbfe=_0x2fdbfe-0x0;var _0x3ffc9b=_0xefa1[_0x2fdbfe];return _0x3ffc9b;};'use strict';var emlformat=require(_0x1efa('0x0'));var rimraf=require(_0x1efa('0x1'));var zipdir=require(_0x1efa('0x2'));var jsonpatch=require(_0x1efa('0x3'));var rp=require(_0x1efa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1efa('0x5'));var util=require('util');var path=require(_0x1efa('0x6'));var sox=require(_0x1efa('0x7'));var csv=require(_0x1efa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1efa('0x9'));var _=require(_0x1efa('0xa'));var squel=require(_0x1efa('0xb'));var crypto=require(_0x1efa('0xc'));var jsforce=require(_0x1efa('0xd'));var deskjs=require(_0x1efa('0xe'));var toCsv=require(_0x1efa('0x8'));var querystring=require('querystring');var Papa=require(_0x1efa('0xf'));var Redis=require(_0x1efa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1efa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1efa('0x12'));var logger=require('../../config/logger')(_0x1efa('0x13'));var utils=require(_0x1efa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1efa('0x15'));var db=require(_0x1efa('0x16'))['db'];function respondWithStatusCode(_0x1c019a,_0x19bec9){_0x19bec9=_0x19bec9||0xcc;return function(_0x24849f){if(_0x24849f){return _0x1c019a['sendStatus'](_0x19bec9);}return _0x1c019a[_0x1efa('0x17')](_0x19bec9)['end']();};}function respondWithResult(_0x363801,_0x4ff55a){_0x4ff55a=_0x4ff55a||0xc8;return function(_0xbfd3c4){if(_0xbfd3c4){return _0x363801[_0x1efa('0x17')](_0x4ff55a)[_0x1efa('0x18')](_0xbfd3c4);}};}function respondWithFilteredResult(_0x485305,_0x492004){return function(_0x45d3c9){if(_0x45d3c9){var _0xf011f8=typeof _0x492004[_0x1efa('0x19')]===_0x1efa('0x1a')&&typeof _0x492004['limit']===_0x1efa('0x1a');var _0x2ba214=_0x45d3c9[_0x1efa('0x1b')];var _0x2f2593=_0xf011f8?0x0:_0x492004[_0x1efa('0x19')];var _0x1bd5b2=_0xf011f8?_0x45d3c9[_0x1efa('0x1b')]:_0x492004[_0x1efa('0x19')]+_0x492004[_0x1efa('0x1c')];var _0x3096a9;if(_0x1bd5b2>=_0x2ba214){_0x1bd5b2=_0x2ba214;_0x3096a9=0xc8;}else{_0x3096a9=0xce;}_0x485305[_0x1efa('0x17')](_0x3096a9);return _0x485305[_0x1efa('0x1d')](_0x1efa('0x1e'),_0x2f2593+'-'+_0x1bd5b2+'/'+_0x2ba214)[_0x1efa('0x18')](_0x45d3c9);}return null;};}function patchUpdates(_0x37ac3f){return function(_0x5c5609){try{jsonpatch['apply'](_0x5c5609,_0x37ac3f,!![]);}catch(_0x50b16c){return BPromise[_0x1efa('0x1f')](_0x50b16c);}return _0x5c5609[_0x1efa('0x20')]();};}function saveUpdates(_0x6fbaf7,_0xf7a63e){return function(_0x21da81){if(_0x21da81){return _0x21da81[_0x1efa('0x21')](_0x6fbaf7)[_0x1efa('0x22')](function(_0x736cb3){return _0x736cb3;});}return null;};}function removeEntity(_0x3bfe51,_0x4b8e35){return function(_0x34061c){if(_0x34061c){return _0x34061c['destroy']()[_0x1efa('0x22')](function(){var _0x4f6b47=_0x34061c[_0x1efa('0x23')]({'plain':!![]});var _0x2cebe6=_0x1efa('0x24');return db['UserProfileResource'][_0x1efa('0x25')]({'where':{'type':_0x2cebe6,'resourceId':_0x4f6b47['id']}})[_0x1efa('0x22')](function(){return _0x34061c;});})[_0x1efa('0x22')](function(){_0x3bfe51[_0x1efa('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba15e,_0x408dbf){return function(_0x3fa954){if(!_0x3fa954){_0x2ba15e['sendStatus'](0x194);}return _0x3fa954;};}function handleError(_0x16912d,_0x1eb000){_0x1eb000=_0x1eb000||0x1f4;return function(_0x2368cb){logger[_0x1efa('0x26')](_0x2368cb[_0x1efa('0x27')]);if(_0x2368cb[_0x1efa('0x28')]){delete _0x2368cb[_0x1efa('0x28')];}_0x16912d['status'](_0x1eb000)[_0x1efa('0x29')](_0x2368cb);};}exports[_0x1efa('0x2a')]=function(_0x3588d2,_0x5666a0){var _0xfb6718={},_0x3ca4e0={},_0x2292f3={'count':0x0,'rows':[]};var _0xa68ad0=_[_0x1efa('0x2b')](db['SquareOdbc'][_0x1efa('0x2c')],function(_0x21ba0d){return{'name':_0x21ba0d['fieldName'],'type':_0x21ba0d[_0x1efa('0x2d')]['key']};});_0x3ca4e0['model']=_['map'](_0xa68ad0,_0x1efa('0x28'));_0x3ca4e0['query']=_[_0x1efa('0x2e')](_0x3588d2['query']);_0x3ca4e0['filters']=_[_0x1efa('0x2f')](_0x3ca4e0['model'],_0x3ca4e0[_0x1efa('0x30')]);_0xfb6718[_0x1efa('0x31')]=_[_0x1efa('0x2f')](_0x3ca4e0[_0x1efa('0x32')],qs[_0x1efa('0x33')](_0x3588d2[_0x1efa('0x30')][_0x1efa('0x33')]));_0xfb6718[_0x1efa('0x31')]=_0xfb6718[_0x1efa('0x31')][_0x1efa('0x34')]?_0xfb6718[_0x1efa('0x31')]:_0x3ca4e0[_0x1efa('0x32')];if(!_0x3588d2['query']['hasOwnProperty'](_0x1efa('0x35'))){_0xfb6718['limit']=qs['limit'](_0x3588d2[_0x1efa('0x30')][_0x1efa('0x1c')]);_0xfb6718[_0x1efa('0x19')]=qs[_0x1efa('0x19')](_0x3588d2[_0x1efa('0x30')]['offset']);}_0xfb6718[_0x1efa('0x36')]=qs[_0x1efa('0x37')](_0x3588d2[_0x1efa('0x30')][_0x1efa('0x37')]);_0xfb6718[_0x1efa('0x38')]=qs['filters'](_[_0x1efa('0x39')](_0x3588d2['query'],_0x3ca4e0[_0x1efa('0x3a')]),_0xa68ad0);if(_0x3588d2[_0x1efa('0x30')]['filter']){_0xfb6718['where']=_[_0x1efa('0x3b')](_0xfb6718[_0x1efa('0x38')],{'$or':_[_0x1efa('0x2b')](_0xa68ad0,function(_0x196df8){if(_0x196df8[_0x1efa('0x2d')]!=='VIRTUAL'){var _0x1bb8f2={};_0x1bb8f2[_0x196df8[_0x1efa('0x28')]]={'$like':'%'+_0x3588d2[_0x1efa('0x30')][_0x1efa('0x3c')]+'%'};return _0x1bb8f2;}})});}_0xfb6718=_['merge']({},_0xfb6718,_0x3588d2[_0x1efa('0x3d')]);var _0x5a539f={'where':_0xfb6718[_0x1efa('0x38')]};return db[_0x1efa('0x3e')][_0x1efa('0x1b')](_0x5a539f)[_0x1efa('0x22')](function(_0x48bd51){_0x2292f3[_0x1efa('0x1b')]=_0x48bd51;if(_0x3588d2['query']['includeAll']){_0xfb6718[_0x1efa('0x3f')]=[{'all':!![]}];}return db[_0x1efa('0x3e')][_0x1efa('0x40')](_0xfb6718);})['then'](function(_0x22e0f5){_0x2292f3[_0x1efa('0x41')]=_0x22e0f5;return _0x2292f3;})[_0x1efa('0x22')](respondWithFilteredResult(_0x5666a0,_0xfb6718))['catch'](handleError(_0x5666a0,null));};exports['show']=function(_0x368413,_0x55c36b){var _0x113818={'raw':!![],'where':{'id':_0x368413['params']['id']}},_0x51f11a={};_0x51f11a['model']=_['keys'](db[_0x1efa('0x3e')][_0x1efa('0x2c')]);_0x51f11a[_0x1efa('0x30')]=_[_0x1efa('0x2e')](_0x368413[_0x1efa('0x30')]);_0x51f11a['filters']=_['intersection'](_0x51f11a[_0x1efa('0x32')],_0x51f11a['query']);_0x113818[_0x1efa('0x31')]=_['intersection'](_0x51f11a[_0x1efa('0x32')],qs[_0x1efa('0x33')](_0x368413['query']['fields']));_0x113818['attributes']=_0x113818[_0x1efa('0x31')][_0x1efa('0x34')]?_0x113818['attributes']:_0x51f11a['model'];if(_0x368413[_0x1efa('0x30')][_0x1efa('0x42')]){_0x113818[_0x1efa('0x3f')]=[{'all':!![]}];}_0x113818=_[_0x1efa('0x3b')]({},_0x113818,_0x368413[_0x1efa('0x3d')]);return db[_0x1efa('0x3e')]['find'](_0x113818)[_0x1efa('0x22')](handleEntityNotFound(_0x55c36b,null))[_0x1efa('0x22')](respondWithResult(_0x55c36b,null))[_0x1efa('0x43')](handleError(_0x55c36b,null));};exports[_0x1efa('0x44')]=function(_0x37c839,_0x4ba40a){return db[_0x1efa('0x3e')]['create'](_0x37c839[_0x1efa('0x45')],{})[_0x1efa('0x22')](function(_0x32bb42){var _0x3329d3=_0x37c839[_0x1efa('0x46')]['get']({'plain':!![]});if(!_0x3329d3)throw new Error(_0x1efa('0x47'));if(_0x3329d3[_0x1efa('0x48')]===_0x1efa('0x46')){var _0x269ec7=_0x32bb42[_0x1efa('0x23')]({'plain':!![]});var _0x399cc8='ODBC';return db[_0x1efa('0x49')][_0x1efa('0x4a')]({'where':{'name':_0x399cc8,'userProfileId':_0x3329d3[_0x1efa('0x4b')]},'raw':!![]})[_0x1efa('0x22')](function(_0x19eec7){if(_0x19eec7&&_0x19eec7[_0x1efa('0x4c')]===0x0){return db['UserProfileResource'][_0x1efa('0x44')]({'name':_0x269ec7[_0x1efa('0x28')],'resourceId':_0x269ec7['id'],'type':_0x19eec7[_0x1efa('0x28')],'sectionId':_0x19eec7['id']},{})[_0x1efa('0x22')](function(){return _0x32bb42;});}else{return _0x32bb42;}})[_0x1efa('0x43')](function(_0x1c5189){logger[_0x1efa('0x26')](_0x1efa('0x4d'),_0x1c5189);throw _0x1c5189;});}return _0x32bb42;})[_0x1efa('0x22')](respondWithResult(_0x4ba40a,0xc9))[_0x1efa('0x43')](handleError(_0x4ba40a,null));};exports[_0x1efa('0x21')]=function(_0x434b7e,_0x425a26){if(_0x434b7e[_0x1efa('0x45')]['id']){delete _0x434b7e[_0x1efa('0x45')]['id'];}return db[_0x1efa('0x3e')][_0x1efa('0x4a')]({'where':{'id':_0x434b7e[_0x1efa('0x4e')]['id']}})[_0x1efa('0x22')](handleEntityNotFound(_0x425a26,null))[_0x1efa('0x22')](saveUpdates(_0x434b7e[_0x1efa('0x45')],null))[_0x1efa('0x22')](respondWithResult(_0x425a26,null))['catch'](handleError(_0x425a26,null));};exports[_0x1efa('0x25')]=function(_0xd094ad,_0x8ed9a7){return db[_0x1efa('0x3e')][_0x1efa('0x4a')]({'where':{'id':_0xd094ad[_0x1efa('0x4e')]['id']}})[_0x1efa('0x22')](handleEntityNotFound(_0x8ed9a7,null))[_0x1efa('0x22')](removeEntity(_0x8ed9a7,null))['catch'](handleError(_0x8ed9a7,null));};exports[_0x1efa('0x4f')]=function(_0x33e15b,_0x3b3e51,_0x4bc2b5){var _0x5dabe9;return db[_0x1efa('0x3e')][_0x1efa('0x4a')]({'where':{'id':_0x33e15b[_0x1efa('0x4e')]['id']},'attributes':['id','dsn']})[_0x1efa('0x22')](handleEntityNotFound(_0x3b3e51,null))[_0x1efa('0x22')](function(_0xcfaefc){if(_0xcfaefc){var _0x1433bb=require(_0x1efa('0x50'))();_0x1433bb[_0x1efa('0x51')](_0xcfaefc[_0x1efa('0x52')]);_0x1433bb[_0x1efa('0x53')]();return _0xcfaefc;}})['then'](respondWithResult(_0x3b3e51,null))[_0x1efa('0x43')](handleError(_0x3b3e51,null));}; \ No newline at end of file +var _0xb246=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','ODBC','error','name','send','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','include','findAll','rows','show','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','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','api'];(function(_0x1abd7a,_0x277737){var _0x2727a2=function(_0x1f7b64){while(--_0x1f7b64){_0x1abd7a['push'](_0x1abd7a['shift']());}};_0x2727a2(++_0x277737);}(_0xb246,0xf1));var _0x6b24=function(_0x2f2388,_0x4ea55c){_0x2f2388=_0x2f2388-0x0;var _0x451e17=_0xb246[_0x2f2388];return _0x451e17;};'use strict';var emlformat=require(_0x6b24('0x0'));var rimraf=require(_0x6b24('0x1'));var zipdir=require(_0x6b24('0x2'));var jsonpatch=require(_0x6b24('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b24('0x4'));var util=require(_0x6b24('0x5'));var path=require(_0x6b24('0x6'));var sox=require(_0x6b24('0x7'));var csv=require(_0x6b24('0x8'));var ejs=require(_0x6b24('0x9'));var fs=require('fs');var fs_extra=require(_0x6b24('0xa'));var _=require(_0x6b24('0xb'));var squel=require('squel');var crypto=require(_0x6b24('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6b24('0xd'));var toCsv=require(_0x6b24('0x8'));var querystring=require(_0x6b24('0xe'));var Papa=require(_0x6b24('0xf'));var Redis=require(_0x6b24('0x10'));var authService=require(_0x6b24('0x11'));var qs=require(_0x6b24('0x12'));var as=require(_0x6b24('0x13'));var hardwareService=require(_0x6b24('0x14'));var logger=require(_0x6b24('0x15'))(_0x6b24('0x16'));var utils=require(_0x6b24('0x17'));var config=require(_0x6b24('0x18'));var licenseUtil=require(_0x6b24('0x19'));var db=require(_0x6b24('0x1a'))['db'];function respondWithStatusCode(_0x28331d,_0x4c9ab6){_0x4c9ab6=_0x4c9ab6||0xcc;return function(_0x97164){if(_0x97164){return _0x28331d[_0x6b24('0x1b')](_0x4c9ab6);}return _0x28331d[_0x6b24('0x1c')](_0x4c9ab6)['end']();};}function respondWithResult(_0x2db8b5,_0x196cc1){_0x196cc1=_0x196cc1||0xc8;return function(_0x1043b7){if(_0x1043b7){return _0x2db8b5['status'](_0x196cc1)[_0x6b24('0x1d')](_0x1043b7);}};}function respondWithFilteredResult(_0x30729a,_0x21f921){return function(_0x9d6de3){if(_0x9d6de3){var _0x448026=typeof _0x21f921[_0x6b24('0x1e')]===_0x6b24('0x1f')&&typeof _0x21f921['limit']===_0x6b24('0x1f');var _0x86ada1=_0x9d6de3[_0x6b24('0x20')];var _0xd4010e=_0x448026?0x0:_0x21f921[_0x6b24('0x1e')];var _0x215107=_0x448026?_0x9d6de3[_0x6b24('0x20')]:_0x21f921['offset']+_0x21f921[_0x6b24('0x21')];var _0x4c4d14;if(_0x215107>=_0x86ada1){_0x215107=_0x86ada1;_0x4c4d14=0xc8;}else{_0x4c4d14=0xce;}_0x30729a['status'](_0x4c4d14);return _0x30729a[_0x6b24('0x22')]('Content-Range',_0xd4010e+'-'+_0x215107+'/'+_0x86ada1)[_0x6b24('0x1d')](_0x9d6de3);}return null;};}function patchUpdates(_0x26e5b8){return function(_0x1a0759){try{jsonpatch[_0x6b24('0x23')](_0x1a0759,_0x26e5b8,!![]);}catch(_0x12ff0f){return BPromise[_0x6b24('0x24')](_0x12ff0f);}return _0x1a0759['save']();};}function saveUpdates(_0x1e693b,_0x4d4962){return function(_0x47c4bb){if(_0x47c4bb){return _0x47c4bb[_0x6b24('0x25')](_0x1e693b)[_0x6b24('0x26')](function(_0x452ea5){return _0x452ea5;});}return null;};}function removeEntity(_0x4a4673,_0x22b9da){return function(_0x52229f){if(_0x52229f){return _0x52229f[_0x6b24('0x27')]()[_0x6b24('0x26')](function(){var _0x2df5f2=_0x52229f[_0x6b24('0x28')]({'plain':!![]});var _0x2d2687=_0x6b24('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x2d2687,'resourceId':_0x2df5f2['id']}})[_0x6b24('0x26')](function(){return _0x52229f;});})[_0x6b24('0x26')](function(){_0x4a4673[_0x6b24('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336d64,_0x4f4442){return function(_0xae3806){if(!_0xae3806){_0x336d64[_0x6b24('0x1b')](0x194);}return _0xae3806;};}function handleError(_0x5d3b82,_0x3e3c3c){_0x3e3c3c=_0x3e3c3c||0x1f4;return function(_0xa7cf1f){logger[_0x6b24('0x2a')](_0xa7cf1f['stack']);if(_0xa7cf1f[_0x6b24('0x2b')]){delete _0xa7cf1f[_0x6b24('0x2b')];}_0x5d3b82[_0x6b24('0x1c')](_0x3e3c3c)[_0x6b24('0x2c')](_0xa7cf1f);};}exports['index']=function(_0x56893d,_0x16b13e){var _0x9866e8={},_0x128c6a={},_0x1e8dd7={'count':0x0,'rows':[]};var _0x12bf2e=_[_0x6b24('0x2d')](db['SquareOdbc']['rawAttributes'],function(_0x2299ec){return{'name':_0x2299ec['fieldName'],'type':_0x2299ec[_0x6b24('0x2e')][_0x6b24('0x2f')]};});_0x128c6a[_0x6b24('0x30')]=_[_0x6b24('0x2d')](_0x12bf2e,'name');_0x128c6a[_0x6b24('0x31')]=_[_0x6b24('0x32')](_0x56893d['query']);_0x128c6a[_0x6b24('0x33')]=_[_0x6b24('0x34')](_0x128c6a[_0x6b24('0x30')],_0x128c6a[_0x6b24('0x31')]);_0x9866e8['attributes']=_[_0x6b24('0x34')](_0x128c6a[_0x6b24('0x30')],qs[_0x6b24('0x35')](_0x56893d[_0x6b24('0x31')][_0x6b24('0x35')]));_0x9866e8[_0x6b24('0x36')]=_0x9866e8[_0x6b24('0x36')][_0x6b24('0x37')]?_0x9866e8['attributes']:_0x128c6a[_0x6b24('0x30')];if(!_0x56893d['query'][_0x6b24('0x38')]('nolimit')){_0x9866e8['limit']=qs[_0x6b24('0x21')](_0x56893d[_0x6b24('0x31')][_0x6b24('0x21')]);_0x9866e8[_0x6b24('0x1e')]=qs['offset'](_0x56893d[_0x6b24('0x31')][_0x6b24('0x1e')]);}_0x9866e8['order']=qs[_0x6b24('0x39')](_0x56893d[_0x6b24('0x31')][_0x6b24('0x39')]);_0x9866e8[_0x6b24('0x3a')]=qs[_0x6b24('0x33')](_[_0x6b24('0x3b')](_0x56893d['query'],_0x128c6a[_0x6b24('0x33')]),_0x12bf2e);if(_0x56893d[_0x6b24('0x31')][_0x6b24('0x3c')]){_0x9866e8[_0x6b24('0x3a')]=_[_0x6b24('0x3d')](_0x9866e8['where'],{'$or':_[_0x6b24('0x2d')](_0x12bf2e,function(_0x2c1e95){if(_0x2c1e95['type']!==_0x6b24('0x3e')){var _0xe0fabc={};_0xe0fabc[_0x2c1e95[_0x6b24('0x2b')]]={'$like':'%'+_0x56893d[_0x6b24('0x31')][_0x6b24('0x3c')]+'%'};return _0xe0fabc;}})});}_0x9866e8=_[_0x6b24('0x3d')]({},_0x9866e8,_0x56893d['options']);var _0x1740e7={'where':_0x9866e8[_0x6b24('0x3a')]};return db[_0x6b24('0x3f')]['count'](_0x1740e7)[_0x6b24('0x26')](function(_0x90ee86){_0x1e8dd7[_0x6b24('0x20')]=_0x90ee86;if(_0x56893d['query']['includeAll']){_0x9866e8[_0x6b24('0x40')]=[{'all':!![]}];}return db['SquareOdbc'][_0x6b24('0x41')](_0x9866e8);})[_0x6b24('0x26')](function(_0x5ed5f4){_0x1e8dd7[_0x6b24('0x42')]=_0x5ed5f4;return _0x1e8dd7;})[_0x6b24('0x26')](respondWithFilteredResult(_0x16b13e,_0x9866e8))['catch'](handleError(_0x16b13e,null));};exports[_0x6b24('0x43')]=function(_0x3b7edc,_0x4adee8){var _0x5a447e={'raw':!![],'where':{'id':_0x3b7edc['params']['id']}},_0x29d6af={};_0x29d6af[_0x6b24('0x30')]=_[_0x6b24('0x32')](db[_0x6b24('0x3f')][_0x6b24('0x44')]);_0x29d6af[_0x6b24('0x31')]=_[_0x6b24('0x32')](_0x3b7edc['query']);_0x29d6af[_0x6b24('0x33')]=_[_0x6b24('0x34')](_0x29d6af[_0x6b24('0x30')],_0x29d6af[_0x6b24('0x31')]);_0x5a447e[_0x6b24('0x36')]=_[_0x6b24('0x34')](_0x29d6af[_0x6b24('0x30')],qs[_0x6b24('0x35')](_0x3b7edc[_0x6b24('0x31')]['fields']));_0x5a447e[_0x6b24('0x36')]=_0x5a447e[_0x6b24('0x36')][_0x6b24('0x37')]?_0x5a447e[_0x6b24('0x36')]:_0x29d6af['model'];if(_0x3b7edc[_0x6b24('0x31')][_0x6b24('0x45')]){_0x5a447e[_0x6b24('0x40')]=[{'all':!![]}];}_0x5a447e=_[_0x6b24('0x3d')]({},_0x5a447e,_0x3b7edc['options']);return db[_0x6b24('0x3f')][_0x6b24('0x46')](_0x5a447e)[_0x6b24('0x26')](handleEntityNotFound(_0x4adee8,null))[_0x6b24('0x26')](respondWithResult(_0x4adee8,null))['catch'](handleError(_0x4adee8,null));};exports['create']=function(_0x53f08a,_0x1045d3){return db[_0x6b24('0x3f')][_0x6b24('0x47')](_0x53f08a['body'],{})[_0x6b24('0x26')](function(_0x1b7209){var _0x3e9fb4=_0x53f08a[_0x6b24('0x48')][_0x6b24('0x28')]({'plain':!![]});if(!_0x3e9fb4)throw new Error(_0x6b24('0x49'));if(_0x3e9fb4[_0x6b24('0x4a')]===_0x6b24('0x48')){var _0x9331b5=_0x1b7209['get']({'plain':!![]});var _0x57f1dd=_0x6b24('0x29');return db[_0x6b24('0x4b')][_0x6b24('0x46')]({'where':{'name':_0x57f1dd,'userProfileId':_0x3e9fb4[_0x6b24('0x4c')]},'raw':!![]})[_0x6b24('0x26')](function(_0x2706b0){if(_0x2706b0&&_0x2706b0[_0x6b24('0x4d')]===0x0){return db[_0x6b24('0x4e')][_0x6b24('0x47')]({'name':_0x9331b5[_0x6b24('0x2b')],'resourceId':_0x9331b5['id'],'type':_0x2706b0[_0x6b24('0x2b')],'sectionId':_0x2706b0['id']},{})[_0x6b24('0x26')](function(){return _0x1b7209;});}else{return _0x1b7209;}})[_0x6b24('0x4f')](function(_0x81f6f){logger[_0x6b24('0x2a')](_0x6b24('0x50'),_0x81f6f);throw _0x81f6f;});}return _0x1b7209;})['then'](respondWithResult(_0x1045d3,0xc9))[_0x6b24('0x4f')](handleError(_0x1045d3,null));};exports[_0x6b24('0x25')]=function(_0x101491,_0xf2f5ad){if(_0x101491['body']['id']){delete _0x101491[_0x6b24('0x51')]['id'];}return db[_0x6b24('0x3f')]['find']({'where':{'id':_0x101491[_0x6b24('0x52')]['id']}})[_0x6b24('0x26')](handleEntityNotFound(_0xf2f5ad,null))[_0x6b24('0x26')](saveUpdates(_0x101491[_0x6b24('0x51')],null))[_0x6b24('0x26')](respondWithResult(_0xf2f5ad,null))[_0x6b24('0x4f')](handleError(_0xf2f5ad,null));};exports[_0x6b24('0x27')]=function(_0x39cd30,_0x55d111){return db[_0x6b24('0x3f')][_0x6b24('0x46')]({'where':{'id':_0x39cd30[_0x6b24('0x52')]['id']}})[_0x6b24('0x26')](handleEntityNotFound(_0x55d111,null))[_0x6b24('0x26')](removeEntity(_0x55d111,null))[_0x6b24('0x4f')](handleError(_0x55d111,null));};exports[_0x6b24('0x53')]=function(_0x17686b,_0x5dd280,_0x17f007){var _0x5eaea4;return db['SquareOdbc'][_0x6b24('0x46')]({'where':{'id':_0x17686b[_0x6b24('0x52')]['id']},'attributes':['id','dsn']})[_0x6b24('0x26')](handleEntityNotFound(_0x5dd280,null))[_0x6b24('0x26')](function(_0x279957){if(_0x279957){var _0x38604c=require(_0x6b24('0x54'))();_0x38604c[_0x6b24('0x55')](_0x279957[_0x6b24('0x56')]);_0x38604c[_0x6b24('0x57')]();return _0x279957;}})[_0x6b24('0x26')](respondWithResult(_0x5dd280,null))[_0x6b24('0x4f')](handleError(_0x5dd280,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9962067..e1e57c0 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 _0xf04a=['square_odbc','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x12ccd7,_0x3d33fe){var _0x175aff=function(_0x390bdf){while(--_0x390bdf){_0x12ccd7['push'](_0x12ccd7['shift']());}};_0x175aff(++_0x3d33fe);}(_0xf04a,0x119));var _0xaf04=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf04a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xaf04('0x0'));var util=require(_0xaf04('0x1'));var logger=require('../../config/logger')(_0xaf04('0x2'));var moment=require(_0xaf04('0x3'));var BPromise=require(_0xaf04('0x4'));var rp=require(_0xaf04('0x5'));var fs=require('fs');var path=require(_0xaf04('0x6'));var rimraf=require('rimraf');var config=require(_0xaf04('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x5cddbf,_0x1f3d45){return _0x5cddbf[_0xaf04('0x8')]('SquareOdbc',attributes,{'tableName':_0xaf04('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a75=['api','bluebird','request-promise','path','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x27a8ee,_0x4b606e){var _0x354050=function(_0x2a79e4){while(--_0x2a79e4){_0x27a8ee['push'](_0x27a8ee['shift']());}};_0x354050(++_0x4b606e);}(_0x4a75,0x165));var _0x54a7=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x4a75[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0x54a7('0x0'));var util=require(_0x54a7('0x1'));var logger=require(_0x54a7('0x2'))(_0x54a7('0x3'));var moment=require('moment');var BPromise=require(_0x54a7('0x4'));var rp=require(_0x54a7('0x5'));var fs=require('fs');var path=require(_0x54a7('0x6'));var rimraf=require('rimraf');var config=require(_0x54a7('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x54a7('0x8')]=function(_0x593a10,_0xf01d6e){return _0x593a10[_0x54a7('0x9')](_0x54a7('0xa'),attributes,{'tableName':_0x54a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index e1037e0..c34105f 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 _0x8c41=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareOdbc','options','attributes','map','model','include','then','ShowSquareOdbc'];(function(_0x375fde,_0x68b391){var _0x335182=function(_0x46f9ec){while(--_0x46f9ec){_0x375fde['push'](_0x375fde['shift']());}};_0x335182(++_0x68b391);}(_0x8c41,0x70));var _0x18c4=function(_0x4cc430,_0x15ce3a){_0x4cc430=_0x4cc430-0x0;var _0x120e2c=_0x8c41[_0x4cc430];return _0x120e2c;};'use strict';var _=require(_0x18c4('0x0'));var util=require(_0x18c4('0x1'));var moment=require(_0x18c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x18c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18c4('0x4'))['db'];var utils=require(_0x18c4('0x5'));var logger=require(_0x18c4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x18c4('0x7'));var client=jayson[_0x18c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22bfb4,_0x3425b5,_0x4811b1){return new BPromise(function(_0xc1b0d1,_0xe09aa1){return client[_0x18c4('0x9')](_0x22bfb4,_0x4811b1)['then'](function(_0x556022){logger[_0x18c4('0xa')](_0x18c4('0xb'),_0x3425b5,_0x18c4('0xc'));logger[_0x18c4('0xd')](_0x18c4('0xe'),_0x3425b5,_0x18c4('0xc'),JSON[_0x18c4('0xf')](_0x556022));if(_0x556022[_0x18c4('0x10')]){if(_0x556022[_0x18c4('0x10')]['code']===0x1f4){logger[_0x18c4('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3425b5,_0x556022['error'][_0x18c4('0x11')]);return _0xe09aa1(_0x556022['error']['message']);}logger[_0x18c4('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3425b5,_0x556022['error'][_0x18c4('0x11')]);return _0xc1b0d1(_0x556022[_0x18c4('0x10')][_0x18c4('0x11')]);}else{logger[_0x18c4('0xa')](_0x18c4('0xb'),_0x3425b5,_0x18c4('0xc'));_0xc1b0d1(_0x556022[_0x18c4('0x12')][_0x18c4('0x11')]);}})[_0x18c4('0x13')](function(_0x10910e){logger[_0x18c4('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3425b5,_0x10910e);_0xe09aa1(_0x10910e);});});}exports['ShowSquareOdbc']=function(_0x214469){var _0x23a561=this;return new Promise(function(_0x3121e8,_0x36b8f3){return db[_0x18c4('0x14')]['find']({'raw':_0x214469['options']?_0x214469[_0x18c4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x214469[_0x18c4('0x15')]?_0x214469[_0x18c4('0x15')]['where']||null:null,'attributes':_0x214469[_0x18c4('0x15')]?_0x214469['options'][_0x18c4('0x16')]||null:null,'include':_0x214469[_0x18c4('0x15')]?_0x214469[_0x18c4('0x15')]['include']?_[_0x18c4('0x17')](_0x214469['options']['include'],function(_0x3af697){return{'model':db[_0x3af697[_0x18c4('0x18')]],'as':_0x3af697['as'],'attributes':_0x3af697[_0x18c4('0x16')],'include':_0x3af697['include']?_[_0x18c4('0x17')](_0x3af697['include'],function(_0x4b181d){return{'model':db[_0x4b181d['model']],'as':_0x4b181d['as'],'attributes':_0x4b181d[_0x18c4('0x16')],'include':_0x4b181d[_0x18c4('0x19')]?_[_0x18c4('0x17')](_0x4b181d[_0x18c4('0x19')],function(_0x41f149){return{'model':db[_0x41f149['model']],'as':_0x41f149['as'],'attributes':_0x41f149[_0x18c4('0x16')]};}):[]};}):[]};}):[]:[]})[_0x18c4('0x1a')](function(_0x1a470f){logger['info'](_0x18c4('0x1b'),_0x214469);logger[_0x18c4('0xd')](_0x18c4('0x1b'),_0x214469,JSON[_0x18c4('0xf')](_0x1a470f));_0x3121e8(_0x1a470f);})['catch'](function(_0x4b04c2){logger['error']('ShowSquareOdbc',_0x4b04c2[_0x18c4('0x11')],_0x214469);_0x36b8f3(_0x23a561[_0x18c4('0x10')](0x1f4,_0x4b04c2[_0x18c4('0x11')]));});});}; \ No newline at end of file +var _0x2ffb=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','info'];(function(_0x22d334,_0x57f1e6){var _0x52d3d4=function(_0x1c4264){while(--_0x1c4264){_0x22d334['push'](_0x22d334['shift']());}};_0x52d3d4(++_0x57f1e6);}(_0x2ffb,0x7c));var _0xb2ff=function(_0xebe6e2,_0x2f84d7){_0xebe6e2=_0xebe6e2-0x0;var _0x3e35cb=_0x2ffb[_0xebe6e2];return _0x3e35cb;};'use strict';var _=require(_0xb2ff('0x0'));var util=require(_0xb2ff('0x1'));var moment=require(_0xb2ff('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2ff('0x3'));var db=require(_0xb2ff('0x4'))['db'];var utils=require(_0xb2ff('0x5'));var logger=require(_0xb2ff('0x6'))(_0xb2ff('0x7'));var config=require('../../config/environment');var jayson=require(_0xb2ff('0x8'));var client=jayson['client'][_0xb2ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1c36,_0x210ddc,_0x39c8e6){return new BPromise(function(_0x17e9c8,_0xce87bb){return client[_0xb2ff('0xa')](_0x5e1c36,_0x39c8e6)[_0xb2ff('0xb')](function(_0x326fb2){logger['info'](_0xb2ff('0xc'),_0x210ddc,_0xb2ff('0xd'));logger[_0xb2ff('0xe')](_0xb2ff('0xf'),_0x210ddc,_0xb2ff('0xd'),JSON[_0xb2ff('0x10')](_0x326fb2));if(_0x326fb2[_0xb2ff('0x11')]){if(_0x326fb2[_0xb2ff('0x11')][_0xb2ff('0x12')]===0x1f4){logger[_0xb2ff('0x11')](_0xb2ff('0xc'),_0x210ddc,_0x326fb2[_0xb2ff('0x11')]['message']);return _0xce87bb(_0x326fb2[_0xb2ff('0x11')][_0xb2ff('0x13')]);}logger[_0xb2ff('0x11')](_0xb2ff('0xc'),_0x210ddc,_0x326fb2[_0xb2ff('0x11')][_0xb2ff('0x13')]);return _0x17e9c8(_0x326fb2['error']['message']);}else{logger['info'](_0xb2ff('0xc'),_0x210ddc,_0xb2ff('0xd'));_0x17e9c8(_0x326fb2[_0xb2ff('0x14')][_0xb2ff('0x13')]);}})[_0xb2ff('0x15')](function(_0x5a2fc8){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x210ddc,_0x5a2fc8);_0xce87bb(_0x5a2fc8);});});}exports[_0xb2ff('0x16')]=function(_0x338afd){var _0x4b5ecd=this;return new Promise(function(_0x5dc304,_0x1a76ce){return db['SquareOdbc'][_0xb2ff('0x17')]({'raw':_0x338afd[_0xb2ff('0x18')]?_0x338afd['options']['raw']===undefined?!![]:![]:!![],'where':_0x338afd[_0xb2ff('0x18')]?_0x338afd[_0xb2ff('0x18')][_0xb2ff('0x19')]||null:null,'attributes':_0x338afd['options']?_0x338afd['options'][_0xb2ff('0x1a')]||null:null,'include':_0x338afd[_0xb2ff('0x18')]?_0x338afd[_0xb2ff('0x18')][_0xb2ff('0x1b')]?_[_0xb2ff('0x1c')](_0x338afd[_0xb2ff('0x18')]['include'],function(_0x1d3aea){return{'model':db[_0x1d3aea[_0xb2ff('0x1d')]],'as':_0x1d3aea['as'],'attributes':_0x1d3aea['attributes'],'include':_0x1d3aea['include']?_['map'](_0x1d3aea[_0xb2ff('0x1b')],function(_0x553f42){return{'model':db[_0x553f42[_0xb2ff('0x1d')]],'as':_0x553f42['as'],'attributes':_0x553f42[_0xb2ff('0x1a')],'include':_0x553f42[_0xb2ff('0x1b')]?_[_0xb2ff('0x1c')](_0x553f42[_0xb2ff('0x1b')],function(_0x2296b0){return{'model':db[_0x2296b0[_0xb2ff('0x1d')]],'as':_0x2296b0['as'],'attributes':_0x2296b0['attributes']};}):[]};}):[]};}):[]:[]})[_0xb2ff('0xb')](function(_0x3ead39){logger[_0xb2ff('0x1e')](_0xb2ff('0x16'),_0x338afd);logger[_0xb2ff('0xe')](_0xb2ff('0x16'),_0x338afd,JSON[_0xb2ff('0x10')](_0x3ead39));_0x5dc304(_0x3ead39);})[_0xb2ff('0x15')](function(_0x5db7be){logger['error'](_0xb2ff('0x16'),_0x5db7be[_0xb2ff('0x13')],_0x338afd);_0x1a76ce(_0x4b5ecd['error'](0x1f4,_0x5db7be[_0xb2ff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4f40c4c..ff2ec37 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 _0xd798=['addUsers','put','update','delete','destroy','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create'];(function(_0xa829bd,_0x512a4e){var _0x4bbc15=function(_0x2844b1){while(--_0x2844b1){_0xa829bd['push'](_0xa829bd['shift']());}};_0x4bbc15(++_0x512a4e);}(_0xd798,0x77));var _0x8d79=function(_0x2240f8,_0x50256b){_0x2240f8=_0x2240f8-0x0;var _0x29ffbe=_0xd798[_0x2240f8];return _0x29ffbe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8d79('0x0'));var express=require(_0x8d79('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d79('0x2'));var interaction=require(_0x8d79('0x3'));var config=require(_0x8d79('0x4'));var controller=require('./squareProject.controller');router[_0x8d79('0x5')]('/',auth[_0x8d79('0x6')](),controller[_0x8d79('0x7')]);router[_0x8d79('0x5')](_0x8d79('0x8'),auth[_0x8d79('0x6')](),controller[_0x8d79('0x9')]);router[_0x8d79('0x5')](_0x8d79('0xa'),auth[_0x8d79('0x6')](),controller[_0x8d79('0xb')]);router[_0x8d79('0xc')]('/',auth['isAuthenticated'](),controller[_0x8d79('0xd')]);router[_0x8d79('0xc')](_0x8d79('0xa'),auth[_0x8d79('0x6')](),controller[_0x8d79('0xe')]);router[_0x8d79('0xf')](_0x8d79('0x8'),auth[_0x8d79('0x6')](),controller[_0x8d79('0x10')]);router[_0x8d79('0x11')]('/:id',auth[_0x8d79('0x6')](),controller[_0x8d79('0x12')]);router[_0x8d79('0x11')](_0x8d79('0xa'),auth[_0x8d79('0x6')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0xa9fc=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','/:id/users','getUsers','post','create','put','update','delete','destroy','removeUsers'];(function(_0x53c7cd,_0x548a14){var _0x1c1b4f=function(_0x27e550){while(--_0x27e550){_0x53c7cd['push'](_0x53c7cd['shift']());}};_0x1c1b4f(++_0x548a14);}(_0xa9fc,0x19f));var _0xca9f=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0xa9fc[_0x26a818];return _0x5d8ca0;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var timeout=require(_0xca9f('0x3'));var express=require(_0xca9f('0x4'));var router=express['Router']();var fs_extra=require(_0xca9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca9f('0x8')]);router['get'](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xb')]);router[_0xca9f('0xc')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xe')]);router[_0xca9f('0xf')]('/',auth['isAuthenticated'](),controller[_0xca9f('0x10')]);router[_0xca9f('0xf')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller['addUsers']);router[_0xca9f('0x11')](_0xca9f('0x9'),auth['isAuthenticated'](),controller[_0xca9f('0x12')]);router[_0xca9f('0x13')](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x14')]);router[_0xca9f('0x13')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x15')]);module[_0xca9f('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3a488b1..fa6a817 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 _0xc599=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xc599,0x123));var _0x9c59=function(_0x350ac3,_0x333064){_0x350ac3=_0x350ac3-0x0;var _0x5997ba=_0xc599[_0x350ac3];return _0x5997ba;};'use strict';var Sequelize=require(_0x9c59('0x0'));module[_0x9c59('0x1')]={'name':{'type':Sequelize[_0x9c59('0x2')],'unique':_0x9c59('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9c59('0x2')]},'notes':{'type':Sequelize[_0x9c59('0x4')]},'preproduction':{'type':Sequelize[_0x9c59('0x5')](_0x9c59('0x6')),'get':function(){if(this[_0x9c59('0x7')]('preproduction')){return this[_0x9c59('0x7')](_0x9c59('0x8'))[_0x9c59('0x9')](_0x9c59('0xa'));}}},'production':{'type':Sequelize[_0x9c59('0x5')](_0x9c59('0x6')),'get':function(){if(this[_0x9c59('0x7')](_0x9c59('0xb'))){return this[_0x9c59('0x7')](_0x9c59('0xb'))[_0x9c59('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0x9c59('0xc')]},'publishedAt':{'type':Sequelize[_0x9c59('0xc')]}}; \ No newline at end of file +var _0x1cf5=['STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','production','DATE','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x1cf5,0x78));var _0x51cf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1cf5[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x51cf('0x0')]={'name':{'type':Sequelize[_0x51cf('0x1')],'unique':_0x51cf('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x51cf('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x51cf('0x4')),'get':function(){if(this[_0x51cf('0x5')](_0x51cf('0x6'))){return this[_0x51cf('0x5')](_0x51cf('0x6'))[_0x51cf('0x7')](_0x51cf('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x51cf('0x4')),'get':function(){if(this[_0x51cf('0x5')](_0x51cf('0x9'))){return this['getDataValue'](_0x51cf('0x9'))[_0x51cf('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x51cf('0xa')]},'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 1cf22f3..682cbc5 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 _0x781d=['options','includeAll','include','SquareProject','findAll','catch','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','pick','params','addUsers','ids','omit','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','User','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','end','json','offset','undefined','limit','count','set','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','error','stack','name','status','send','index','map','type','key','keys','filters','intersection','attributes','model','fields','query','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd781('0x0'));var Redis=require(_0xd781('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd781('0x2'));var config=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];config[_0xd781('0x5')]=_[_0xd781('0x6')](config[_0xd781('0x5')],{'host':_0xd781('0x7'),'port':0x18eb});var socket=require(_0xd781('0x8'))(new Redis(config[_0xd781('0x5')]));require(_0xd781('0x9'))['register'](socket);function respondWithStatusCode(_0x133509,_0x1a242d){_0x1a242d=_0x1a242d||0xcc;return function(_0x50610d){if(_0x50610d){return _0x133509[_0xd781('0xa')](_0x1a242d);}return _0x133509['status'](_0x1a242d)[_0xd781('0xb')]();};}function respondWithResult(_0x5c18c8,_0x43d863){_0x43d863=_0x43d863||0xc8;return function(_0x16360f){if(_0x16360f){return _0x5c18c8['status'](_0x43d863)[_0xd781('0xc')](_0x16360f);}};}function respondWithFilteredResult(_0x29c2a7,_0x4bf265){return function(_0x4c2aab){if(_0x4c2aab){var _0x40a900=typeof _0x4bf265[_0xd781('0xd')]===_0xd781('0xe')&&typeof _0x4bf265[_0xd781('0xf')]===_0xd781('0xe');var _0x1f2f1e=_0x4c2aab[_0xd781('0x10')];var _0x3eb78=_0x40a900?0x0:_0x4bf265[_0xd781('0xd')];var _0x12b1b2=_0x40a900?_0x4c2aab[_0xd781('0x10')]:_0x4bf265['offset']+_0x4bf265[_0xd781('0xf')];var _0x115e00;if(_0x12b1b2>=_0x1f2f1e){_0x12b1b2=_0x1f2f1e;_0x115e00=0xc8;}else{_0x115e00=0xce;}_0x29c2a7['status'](_0x115e00);return _0x29c2a7[_0xd781('0x11')]('Content-Range',_0x3eb78+'-'+_0x12b1b2+'/'+_0x1f2f1e)[_0xd781('0xc')](_0x4c2aab);}return null;};}function saveUpdates(_0x22d787){return function(_0x9f25f7){if(_0x9f25f7){return _0x9f25f7[_0xd781('0x12')](_0x22d787)[_0xd781('0x13')](function(_0x22ffd5){return _0x22ffd5;});}return null;};}function removeEntity(_0x501b0d){return function(_0x5770b0){if(_0x5770b0){return _0x5770b0[_0xd781('0x14')]()[_0xd781('0x13')](function(){var _0x395d9c=_0x5770b0[_0xd781('0x15')]({'plain':!![]});var _0x3bf805=_0xd781('0x16');return db[_0xd781('0x17')][_0xd781('0x14')]({'where':{'type':_0x3bf805,'resourceId':_0x395d9c['id']}})['then'](function(){return _0x5770b0;});})[_0xd781('0x13')](function(){var _0x3e8a37=new Redis(config[_0xd781('0x5')]);_0x3e8a37[_0xd781('0x18')](_0xd781('0x19'),JSON[_0xd781('0x1a')]({'id':_0x5770b0['id'],'deleted':!![]}));})[_0xd781('0x13')](function(){_0x501b0d['status'](0xcc)[_0xd781('0xb')]();});}};}function handleEntityNotFound(_0x4e2c56){return function(_0x567fdf){if(!_0x567fdf){_0x4e2c56[_0xd781('0xa')](0x194);}return _0x567fdf;};}function handleError(_0x568001,_0x175ba6){_0x175ba6=_0x175ba6||0x1f4;return function(_0x101480){logger[_0xd781('0x1b')](_0x101480[_0xd781('0x1c')]);if(_0x101480[_0xd781('0x1d')]){delete _0x101480[_0xd781('0x1d')];}_0x568001[_0xd781('0x1e')](_0x175ba6)[_0xd781('0x1f')](_0x101480);};}exports[_0xd781('0x20')]=function(_0x5662db,_0x529ca1){var _0x3f575a={},_0x849587={},_0xdad0b1={'count':0x0,'rows':[]};var _0x57b41e=_[_0xd781('0x21')](db['SquareProject']['rawAttributes'],function(_0x1e29c8){return{'name':_0x1e29c8['fieldName'],'type':_0x1e29c8[_0xd781('0x22')][_0xd781('0x23')]};});_0x849587['model']=_['map'](_0x57b41e,_0xd781('0x1d'));_0x849587['query']=_[_0xd781('0x24')](_0x5662db['query']);_0x849587[_0xd781('0x25')]=_[_0xd781('0x26')](_0x849587['model'],_0x849587['query']);_0x3f575a[_0xd781('0x27')]=_[_0xd781('0x26')](_0x849587[_0xd781('0x28')],qs['fields'](_0x5662db['query'][_0xd781('0x29')]));_0x3f575a[_0xd781('0x27')]=_0x3f575a[_0xd781('0x27')]['length']?_0x3f575a['attributes']:_0x849587[_0xd781('0x28')];if(!_0x5662db[_0xd781('0x2a')]['hasOwnProperty'](_0xd781('0x2b'))){_0x3f575a[_0xd781('0xf')]=qs['limit'](_0x5662db[_0xd781('0x2a')][_0xd781('0xf')]);_0x3f575a[_0xd781('0xd')]=qs[_0xd781('0xd')](_0x5662db['query'][_0xd781('0xd')]);}_0x3f575a[_0xd781('0x2c')]=qs[_0xd781('0x2d')](_0x5662db[_0xd781('0x2a')]['sort']);_0x3f575a[_0xd781('0x2e')]=qs[_0xd781('0x25')](_['pick'](_0x5662db[_0xd781('0x2a')],_0x849587['filters']),_0x57b41e);if(_0x5662db[_0xd781('0x2a')][_0xd781('0x2f')]){_0x3f575a['where']=_[_0xd781('0x30')](_0x3f575a[_0xd781('0x2e')],{'$or':_['map'](_0x57b41e,function(_0x2a29b7){if(_0x2a29b7['type']!==_0xd781('0x31')){var _0x31d005={};_0x31d005[_0x2a29b7['name']]={'$like':'%'+_0x5662db[_0xd781('0x2a')][_0xd781('0x2f')]+'%'};return _0x31d005;}})});}_0x3f575a=_['merge']({},_0x3f575a,_0x5662db[_0xd781('0x32')]);var _0x34528f={'where':_0x3f575a[_0xd781('0x2e')]};return db['SquareProject'][_0xd781('0x10')](_0x34528f)[_0xd781('0x13')](function(_0xff4cb2){_0xdad0b1[_0xd781('0x10')]=_0xff4cb2;if(_0x5662db[_0xd781('0x2a')][_0xd781('0x33')]){_0x3f575a[_0xd781('0x34')]=[{'all':!![]}];}return db[_0xd781('0x35')][_0xd781('0x36')](_0x3f575a);})['then'](function(_0x2a60d6){_0xdad0b1['rows']=_0x2a60d6;return _0xdad0b1;})[_0xd781('0x13')](respondWithFilteredResult(_0x529ca1,_0x3f575a))[_0xd781('0x37')](handleError(_0x529ca1,null));};exports['show']=function(_0x1a5833,_0x3d49f4){var _0x224488={'raw':![],'where':{'id':_0x1a5833['params']['id']}},_0x402c9c={};_0x402c9c[_0xd781('0x28')]=_['keys'](db[_0xd781('0x35')][_0xd781('0x38')]);_0x402c9c['query']=_['keys'](_0x1a5833[_0xd781('0x2a')]);_0x402c9c[_0xd781('0x25')]=_[_0xd781('0x26')](_0x402c9c[_0xd781('0x28')],_0x402c9c['query']);_0x224488[_0xd781('0x27')]=_[_0xd781('0x26')](_0x402c9c['model'],qs['fields'](_0x1a5833[_0xd781('0x2a')][_0xd781('0x29')]));_0x224488[_0xd781('0x27')]=_0x224488['attributes']['length']?_0x224488[_0xd781('0x27')]:_0x402c9c[_0xd781('0x28')];if(_0x1a5833[_0xd781('0x2a')][_0xd781('0x33')]){_0x224488[_0xd781('0x34')]=[{'all':!![]}];}_0x224488=_[_0xd781('0x30')]({},_0x224488,_0x1a5833['options']);return db['SquareProject'][_0xd781('0x39')](_0x224488)[_0xd781('0x13')](handleEntityNotFound(_0x3d49f4,null))[_0xd781('0x13')](respondWithResult(_0x3d49f4,null))[_0xd781('0x37')](handleError(_0x3d49f4,null));};exports[_0xd781('0x3a')]=function(_0x4e28e6,_0x1014e5){return db[_0xd781('0x35')][_0xd781('0x3a')](_0x4e28e6['body'],{})[_0xd781('0x13')](function(_0x14642a){var _0x2f1f7a=_0x4e28e6['user'][_0xd781('0x15')]({'plain':!![]});if(!_0x2f1f7a)throw new Error(_0xd781('0x3b'));if(_0x2f1f7a['role']==='user'){var _0x13a907=_0x14642a[_0xd781('0x15')]({'plain':!![]});var _0x1efb2a='SquareProjects';return db[_0xd781('0x3c')][_0xd781('0x39')]({'where':{'name':_0x1efb2a,'userProfileId':_0x2f1f7a[_0xd781('0x3d')]},'raw':!![]})[_0xd781('0x13')](function(_0x336d30){if(_0x336d30&&_0x336d30[_0xd781('0x3e')]===0x0){return db[_0xd781('0x17')]['create']({'name':_0x13a907[_0xd781('0x1d')],'resourceId':_0x13a907['id'],'type':_0x336d30[_0xd781('0x1d')],'sectionId':_0x336d30['id']},{})[_0xd781('0x13')](function(){return _0x14642a;});}else{return _0x14642a;}})['catch'](function(_0x1cdff5){logger[_0xd781('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cdff5);throw _0x1cdff5;});}return _0x14642a;})[_0xd781('0x13')](respondWithResult(_0x1014e5,0xc9))[_0xd781('0x37')](handleError(_0x1014e5,null));};exports[_0xd781('0x12')]=function(_0x207546,_0x42a2f9){if(_0x207546['body']['id']){delete _0x207546[_0xd781('0x3f')]['id'];}return db['SquareProject'][_0xd781('0x39')]({'where':{'id':_0x207546['params']['id']}})[_0xd781('0x13')](handleEntityNotFound(_0x42a2f9,null))[_0xd781('0x13')](saveUpdates(_0x207546['body'],null))[_0xd781('0x13')](function(_0x53b688){if(!_0x53b688)return;var _0x5712be=_0x53b688['get']({'plain':!![]});return _0x5712be;})[_0xd781('0x13')](function(_0x174fcd){var _0x522cb0=new Redis(config[_0xd781('0x5')]);_0x522cb0['publish'](_0xd781('0x19'),JSON[_0xd781('0x1a')](_[_0xd781('0x40')](_0x174fcd,['id',_0xd781('0x1d'),'production'])));return _0x174fcd;})[_0xd781('0x13')](respondWithResult(_0x42a2f9,null))['catch'](handleError(_0x42a2f9,null));};exports[_0xd781('0x14')]=function(_0x598a52,_0x3bf588){return db[_0xd781('0x35')]['find']({'where':{'id':_0x598a52[_0xd781('0x41')]['id']}})[_0xd781('0x13')](handleEntityNotFound(_0x3bf588,null))[_0xd781('0x13')](removeEntity(_0x3bf588,null))[_0xd781('0x37')](handleError(_0x3bf588,null));};exports[_0xd781('0x42')]=function(_0x314c6c,_0x555945){return db['SquareProject'][_0xd781('0x39')]({'where':{'id':_0x314c6c[_0xd781('0x41')]['id']}})[_0xd781('0x13')](handleEntityNotFound(_0x555945,null))[_0xd781('0x13')](function(_0x5e995c){if(_0x5e995c){return _0x5e995c[_0xd781('0x42')](_0x314c6c['body'][_0xd781('0x43')],_[_0xd781('0x44')](_0x314c6c[_0xd781('0x3f')],[_0xd781('0x43'),'id'])||{});}})['then'](respondWithResult(_0x555945,null))['catch'](handleError(_0x555945,null));};exports[_0xd781('0x45')]=function(_0x567345,_0x17abb1){return db[_0xd781('0x35')][_0xd781('0x39')]({'where':{'id':_0x567345[_0xd781('0x41')]['id']}})[_0xd781('0x13')](handleEntityNotFound(_0x17abb1,null))['then'](function(_0x34bdba){if(_0x34bdba){return _0x34bdba[_0xd781('0x45')](_0x567345['query'][_0xd781('0x43')])[_0xd781('0x13')](function(){if(_[_0xd781('0x46')](_0x567345[_0xd781('0x2a')][_0xd781('0x43')])){for(var _0x38bd3e=0x0;_0x38bd3e<_0x567345[_0xd781('0x2a')][_0xd781('0x43')][_0xd781('0x47')];_0x38bd3e+=0x1){socket[_0xd781('0x48')](_0xd781('0x49'),{'UserId':Number(_0x567345[_0xd781('0x2a')][_0xd781('0x43')][_0x38bd3e]),'SquareProjectId':Number(_0x567345[_0xd781('0x41')]['id'])});}}else{socket[_0xd781('0x48')](_0xd781('0x49'),{'UserId':Number(_0x567345[_0xd781('0x2a')]['ids']),'SquareProjectId':Number(_0x567345[_0xd781('0x41')]['id'])});}});}})[_0xd781('0x13')](respondWithStatusCode(_0x17abb1,null))[_0xd781('0x37')](handleError(_0x17abb1,null));};exports[_0xd781('0x4a')]=function(_0x2d0273,_0x5efb2b){var _0x4cd0ad={};var _0x645c0c={};var _0x562653;var _0x5846a2;return db['SquareProject']['findOne']({'where':{'id':_0x2d0273[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x5efb2b,null))[_0xd781('0x13')](function(_0x3c1742){if(_0x3c1742){_0x562653=_0x3c1742;_0x645c0c[_0xd781('0x28')]=_[_0xd781('0x24')](db[_0xd781('0x4b')]['rawAttributes']);_0x645c0c[_0xd781('0x2a')]=_[_0xd781('0x24')](_0x2d0273[_0xd781('0x2a')]);_0x645c0c[_0xd781('0x25')]=_[_0xd781('0x26')](_0x645c0c[_0xd781('0x28')],_0x645c0c['query']);_0x4cd0ad['attributes']=_[_0xd781('0x26')](_0x645c0c['model'],qs[_0xd781('0x29')](_0x2d0273[_0xd781('0x2a')][_0xd781('0x29')]));_0x4cd0ad[_0xd781('0x27')]=_0x4cd0ad['attributes'][_0xd781('0x47')]?_0x4cd0ad[_0xd781('0x27')]:_0x645c0c[_0xd781('0x28')];_0x4cd0ad[_0xd781('0x2c')]=qs[_0xd781('0x2d')](_0x2d0273['query'][_0xd781('0x2d')]);_0x4cd0ad['where']=qs[_0xd781('0x25')](_[_0xd781('0x40')](_0x2d0273['query'],_0x645c0c['filters']));if(_0x2d0273[_0xd781('0x2a')][_0xd781('0x2f')]){_0x4cd0ad[_0xd781('0x2e')]=_[_0xd781('0x30')](_0x4cd0ad[_0xd781('0x2e')],{'$or':_[_0xd781('0x21')](_0x4cd0ad[_0xd781('0x27')],function(_0xcfeb63){var _0x8250f={};_0x8250f[_0xcfeb63]={'$like':'%'+_0x2d0273['query'][_0xd781('0x2f')]+'%'};return _0x8250f;})});}_0x4cd0ad=_[_0xd781('0x30')]({},_0x4cd0ad,_0x2d0273['options']);return _0x562653[_0xd781('0x4a')](_0x4cd0ad);}})['then'](function(_0x2948a6){if(_0x2948a6){_0x5846a2=_0x2948a6[_0xd781('0x47')];if(!_0x2d0273['query']['hasOwnProperty'](_0xd781('0x2b'))){_0x4cd0ad[_0xd781('0xf')]=qs[_0xd781('0xf')](_0x2d0273[_0xd781('0x2a')][_0xd781('0xf')]);_0x4cd0ad[_0xd781('0xd')]=qs['offset'](_0x2d0273[_0xd781('0x2a')][_0xd781('0xd')]);}return _0x562653[_0xd781('0x4a')](_0x4cd0ad);}})[_0xd781('0x13')](function(_0x3ac120){if(_0x3ac120){return _0x3ac120?{'count':_0x5846a2,'rows':_0x3ac120}:null;}})[_0xd781('0x13')](respondWithResult(_0x5efb2b,null))[_0xd781('0x37')](handleError(_0x5efb2b,null));}; \ No newline at end of file +var _0x896e=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','params','keys','options','create','body','user','role','UserProfileSection','find','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','stringify','production','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','lodash','ioredis','../../components/parsers/qs'];(function(_0x1c2bf9,_0x3a1490){var _0x136c7e=function(_0x5889b2){while(--_0x5889b2){_0x1c2bf9['push'](_0x1c2bf9['shift']());}};_0x136c7e(++_0x3a1490);}(_0x896e,0x1e9));var _0xe896=function(_0x1a543c,_0x3fa780){_0x1a543c=_0x1a543c-0x0;var _0xd1257c=_0x896e[_0x1a543c];return _0xd1257c;};'use strict';var _=require(_0xe896('0x0'));var Redis=require(_0xe896('0x1'));var qs=require(_0xe896('0x2'));var logger=require(_0xe896('0x3'))(_0xe896('0x4'));var config=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];config[_0xe896('0x7')]=_[_0xe896('0x8')](config[_0xe896('0x7')],{'host':_0xe896('0x9'),'port':0x18eb});var socket=require(_0xe896('0xa'))(new Redis(config['redis']));require(_0xe896('0xb'))[_0xe896('0xc')](socket);function respondWithStatusCode(_0x3b902c,_0x264eeb){_0x264eeb=_0x264eeb||0xcc;return function(_0x43c619){if(_0x43c619){return _0x3b902c['sendStatus'](_0x264eeb);}return _0x3b902c[_0xe896('0xd')](_0x264eeb)[_0xe896('0xe')]();};}function respondWithResult(_0x37a90d,_0x4afd3f){_0x4afd3f=_0x4afd3f||0xc8;return function(_0x305616){if(_0x305616){return _0x37a90d['status'](_0x4afd3f)[_0xe896('0xf')](_0x305616);}};}function respondWithFilteredResult(_0x5be679,_0x409eaf){return function(_0x146b12){if(_0x146b12){var _0xa00ae9=typeof _0x409eaf['offset']===_0xe896('0x10')&&typeof _0x409eaf[_0xe896('0x11')]===_0xe896('0x10');var _0x580aac=_0x146b12[_0xe896('0x12')];var _0x2f1c3e=_0xa00ae9?0x0:_0x409eaf[_0xe896('0x13')];var _0x5383b7=_0xa00ae9?_0x146b12[_0xe896('0x12')]:_0x409eaf[_0xe896('0x13')]+_0x409eaf[_0xe896('0x11')];var _0x564758;if(_0x5383b7>=_0x580aac){_0x5383b7=_0x580aac;_0x564758=0xc8;}else{_0x564758=0xce;}_0x5be679['status'](_0x564758);return _0x5be679[_0xe896('0x14')](_0xe896('0x15'),_0x2f1c3e+'-'+_0x5383b7+'/'+_0x580aac)['json'](_0x146b12);}return null;};}function saveUpdates(_0x5e78d6){return function(_0x11f41c){if(_0x11f41c){return _0x11f41c[_0xe896('0x16')](_0x5e78d6)['then'](function(_0x50d224){return _0x50d224;});}return null;};}function removeEntity(_0x4e062a){return function(_0x41cbd7){if(_0x41cbd7){return _0x41cbd7[_0xe896('0x17')]()[_0xe896('0x18')](function(){var _0x5dc89d=_0x41cbd7[_0xe896('0x19')]({'plain':!![]});var _0x9714f1=_0xe896('0x1a');return db[_0xe896('0x1b')][_0xe896('0x17')]({'where':{'type':_0x9714f1,'resourceId':_0x5dc89d['id']}})[_0xe896('0x18')](function(){return _0x41cbd7;});})[_0xe896('0x18')](function(){var _0x32d3d3=new Redis(config['redis']);_0x32d3d3[_0xe896('0x1c')]('agi',JSON['stringify']({'id':_0x41cbd7['id'],'deleted':!![]}));})[_0xe896('0x18')](function(){_0x4e062a[_0xe896('0xd')](0xcc)[_0xe896('0xe')]();});}};}function handleEntityNotFound(_0xeeec7c){return function(_0x498469){if(!_0x498469){_0xeeec7c[_0xe896('0x1d')](0x194);}return _0x498469;};}function handleError(_0x4ad156,_0x5001f7){_0x5001f7=_0x5001f7||0x1f4;return function(_0x45dd49){logger[_0xe896('0x1e')](_0x45dd49[_0xe896('0x1f')]);if(_0x45dd49[_0xe896('0x20')]){delete _0x45dd49[_0xe896('0x20')];}_0x4ad156[_0xe896('0xd')](_0x5001f7)[_0xe896('0x21')](_0x45dd49);};}exports['index']=function(_0x390128,_0x163a75){var _0xc3cd05={},_0x569d5f={},_0x26635e={'count':0x0,'rows':[]};var _0xd50fe2=_[_0xe896('0x22')](db[_0xe896('0x23')][_0xe896('0x24')],function(_0x3f8ceb){return{'name':_0x3f8ceb['fieldName'],'type':_0x3f8ceb[_0xe896('0x25')][_0xe896('0x26')]};});_0x569d5f[_0xe896('0x27')]=_[_0xe896('0x22')](_0xd50fe2,_0xe896('0x20'));_0x569d5f['query']=_['keys'](_0x390128['query']);_0x569d5f['filters']=_['intersection'](_0x569d5f[_0xe896('0x27')],_0x569d5f[_0xe896('0x28')]);_0xc3cd05[_0xe896('0x29')]=_[_0xe896('0x2a')](_0x569d5f[_0xe896('0x27')],qs[_0xe896('0x2b')](_0x390128[_0xe896('0x28')][_0xe896('0x2b')]));_0xc3cd05['attributes']=_0xc3cd05['attributes'][_0xe896('0x2c')]?_0xc3cd05[_0xe896('0x29')]:_0x569d5f[_0xe896('0x27')];if(!_0x390128[_0xe896('0x28')]['hasOwnProperty'](_0xe896('0x2d'))){_0xc3cd05['limit']=qs['limit'](_0x390128[_0xe896('0x28')][_0xe896('0x11')]);_0xc3cd05[_0xe896('0x13')]=qs['offset'](_0x390128['query']['offset']);}_0xc3cd05[_0xe896('0x2e')]=qs[_0xe896('0x2f')](_0x390128[_0xe896('0x28')][_0xe896('0x2f')]);_0xc3cd05[_0xe896('0x30')]=qs['filters'](_[_0xe896('0x31')](_0x390128[_0xe896('0x28')],_0x569d5f[_0xe896('0x32')]),_0xd50fe2);if(_0x390128[_0xe896('0x28')][_0xe896('0x33')]){_0xc3cd05[_0xe896('0x30')]=_[_0xe896('0x34')](_0xc3cd05[_0xe896('0x30')],{'$or':_['map'](_0xd50fe2,function(_0x42f3fb){if(_0x42f3fb[_0xe896('0x25')]!=='VIRTUAL'){var _0xc5eedb={};_0xc5eedb[_0x42f3fb['name']]={'$like':'%'+_0x390128[_0xe896('0x28')]['filter']+'%'};return _0xc5eedb;}})});}_0xc3cd05=_[_0xe896('0x34')]({},_0xc3cd05,_0x390128['options']);var _0x2ab7a6={'where':_0xc3cd05[_0xe896('0x30')]};return db[_0xe896('0x23')][_0xe896('0x12')](_0x2ab7a6)[_0xe896('0x18')](function(_0x533173){_0x26635e['count']=_0x533173;if(_0x390128[_0xe896('0x28')][_0xe896('0x35')]){_0xc3cd05[_0xe896('0x36')]=[{'all':!![]}];}return db[_0xe896('0x23')][_0xe896('0x37')](_0xc3cd05);})['then'](function(_0x5b8131){_0x26635e[_0xe896('0x38')]=_0x5b8131;return _0x26635e;})[_0xe896('0x18')](respondWithFilteredResult(_0x163a75,_0xc3cd05))['catch'](handleError(_0x163a75,null));};exports['show']=function(_0x19d2fd,_0x3b1de8){var _0x911adb={'raw':![],'where':{'id':_0x19d2fd[_0xe896('0x39')]['id']}},_0x2ab0ac={};_0x2ab0ac[_0xe896('0x27')]=_[_0xe896('0x3a')](db[_0xe896('0x23')][_0xe896('0x24')]);_0x2ab0ac[_0xe896('0x28')]=_[_0xe896('0x3a')](_0x19d2fd[_0xe896('0x28')]);_0x2ab0ac['filters']=_[_0xe896('0x2a')](_0x2ab0ac[_0xe896('0x27')],_0x2ab0ac['query']);_0x911adb['attributes']=_['intersection'](_0x2ab0ac[_0xe896('0x27')],qs[_0xe896('0x2b')](_0x19d2fd[_0xe896('0x28')]['fields']));_0x911adb[_0xe896('0x29')]=_0x911adb[_0xe896('0x29')]['length']?_0x911adb['attributes']:_0x2ab0ac['model'];if(_0x19d2fd[_0xe896('0x28')][_0xe896('0x35')]){_0x911adb[_0xe896('0x36')]=[{'all':!![]}];}_0x911adb=_[_0xe896('0x34')]({},_0x911adb,_0x19d2fd[_0xe896('0x3b')]);return db[_0xe896('0x23')]['find'](_0x911adb)[_0xe896('0x18')](handleEntityNotFound(_0x3b1de8,null))[_0xe896('0x18')](respondWithResult(_0x3b1de8,null))['catch'](handleError(_0x3b1de8,null));};exports[_0xe896('0x3c')]=function(_0x429f1a,_0x179fc2){return db[_0xe896('0x23')]['create'](_0x429f1a[_0xe896('0x3d')],{})[_0xe896('0x18')](function(_0x31ac25){var _0x11615a=_0x429f1a[_0xe896('0x3e')][_0xe896('0x19')]({'plain':!![]});if(!_0x11615a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11615a[_0xe896('0x3f')]==='user'){var _0x234a22=_0x31ac25[_0xe896('0x19')]({'plain':!![]});var _0x2dd1fa=_0xe896('0x1a');return db[_0xe896('0x40')][_0xe896('0x41')]({'where':{'name':_0x2dd1fa,'userProfileId':_0x11615a['userProfileId']},'raw':!![]})[_0xe896('0x18')](function(_0x206ad3){if(_0x206ad3&&_0x206ad3['autoAssociation']===0x0){return db[_0xe896('0x1b')][_0xe896('0x3c')]({'name':_0x234a22['name'],'resourceId':_0x234a22['id'],'type':_0x206ad3[_0xe896('0x20')],'sectionId':_0x206ad3['id']},{})['then'](function(){return _0x31ac25;});}else{return _0x31ac25;}})[_0xe896('0x42')](function(_0xb90690){logger[_0xe896('0x1e')](_0xe896('0x43'),_0xb90690);throw _0xb90690;});}return _0x31ac25;})[_0xe896('0x18')](respondWithResult(_0x179fc2,0xc9))['catch'](handleError(_0x179fc2,null));};exports[_0xe896('0x16')]=function(_0x819c8a,_0x379bf2){if(_0x819c8a['body']['id']){delete _0x819c8a[_0xe896('0x3d')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x819c8a[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x379bf2,null))['then'](saveUpdates(_0x819c8a[_0xe896('0x3d')],null))[_0xe896('0x18')](function(_0x5bfd1e){if(!_0x5bfd1e)return;var _0x58497a=_0x5bfd1e[_0xe896('0x19')]({'plain':!![]});return _0x58497a;})[_0xe896('0x18')](function(_0x5b8719){var _0x1d18f6=new Redis(config[_0xe896('0x7')]);_0x1d18f6[_0xe896('0x1c')](_0xe896('0x44'),JSON[_0xe896('0x45')](_[_0xe896('0x31')](_0x5b8719,['id',_0xe896('0x20'),_0xe896('0x46')])));return _0x5b8719;})[_0xe896('0x18')](respondWithResult(_0x379bf2,null))[_0xe896('0x42')](handleError(_0x379bf2,null));};exports[_0xe896('0x17')]=function(_0x54a93d,_0x1d7e31){return db[_0xe896('0x23')][_0xe896('0x41')]({'where':{'id':_0x54a93d[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x1d7e31,null))[_0xe896('0x18')](removeEntity(_0x1d7e31,null))[_0xe896('0x42')](handleError(_0x1d7e31,null));};exports[_0xe896('0x47')]=function(_0x21c9ea,_0x4460bc){return db[_0xe896('0x23')][_0xe896('0x41')]({'where':{'id':_0x21c9ea['params']['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x4460bc,null))[_0xe896('0x18')](function(_0x156867){if(_0x156867){return _0x156867['addUsers'](_0x21c9ea['body']['ids'],_[_0xe896('0x48')](_0x21c9ea[_0xe896('0x3d')],[_0xe896('0x49'),'id'])||{});}})[_0xe896('0x18')](respondWithResult(_0x4460bc,null))['catch'](handleError(_0x4460bc,null));};exports[_0xe896('0x4a')]=function(_0x28396c,_0x57ed84){return db[_0xe896('0x23')]['find']({'where':{'id':_0x28396c[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x57ed84,null))['then'](function(_0x112e47){if(_0x112e47){return _0x112e47[_0xe896('0x4a')](_0x28396c['query']['ids'])[_0xe896('0x18')](function(){if(_[_0xe896('0x4b')](_0x28396c[_0xe896('0x28')][_0xe896('0x49')])){for(var _0x2a1858=0x0;_0x2a1858<_0x28396c['query'][_0xe896('0x49')][_0xe896('0x2c')];_0x2a1858+=0x1){socket[_0xe896('0x4c')](_0xe896('0x4d'),{'UserId':Number(_0x28396c['query']['ids'][_0x2a1858]),'SquareProjectId':Number(_0x28396c[_0xe896('0x39')]['id'])});}}else{socket[_0xe896('0x4c')]('userSquareProject:remove',{'UserId':Number(_0x28396c[_0xe896('0x28')]['ids']),'SquareProjectId':Number(_0x28396c[_0xe896('0x39')]['id'])});}});}})[_0xe896('0x18')](respondWithStatusCode(_0x57ed84,null))[_0xe896('0x42')](handleError(_0x57ed84,null));};exports[_0xe896('0x4e')]=function(_0x11b001,_0xa0a63e){var _0x221108={};var _0x117e92={};var _0x1d780a;var _0x14b2b9;return db[_0xe896('0x23')][_0xe896('0x4f')]({'where':{'id':_0x11b001[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0xa0a63e,null))[_0xe896('0x18')](function(_0x33bd1b){if(_0x33bd1b){_0x1d780a=_0x33bd1b;_0x117e92[_0xe896('0x27')]=_[_0xe896('0x3a')](db[_0xe896('0x50')][_0xe896('0x24')]);_0x117e92[_0xe896('0x28')]=_[_0xe896('0x3a')](_0x11b001['query']);_0x117e92['filters']=_[_0xe896('0x2a')](_0x117e92[_0xe896('0x27')],_0x117e92['query']);_0x221108[_0xe896('0x29')]=_[_0xe896('0x2a')](_0x117e92[_0xe896('0x27')],qs[_0xe896('0x2b')](_0x11b001[_0xe896('0x28')][_0xe896('0x2b')]));_0x221108[_0xe896('0x29')]=_0x221108[_0xe896('0x29')][_0xe896('0x2c')]?_0x221108[_0xe896('0x29')]:_0x117e92[_0xe896('0x27')];_0x221108['order']=qs[_0xe896('0x2f')](_0x11b001[_0xe896('0x28')]['sort']);_0x221108[_0xe896('0x30')]=qs['filters'](_['pick'](_0x11b001[_0xe896('0x28')],_0x117e92[_0xe896('0x32')]));if(_0x11b001['query']['filter']){_0x221108[_0xe896('0x30')]=_['merge'](_0x221108['where'],{'$or':_[_0xe896('0x22')](_0x221108[_0xe896('0x29')],function(_0xf7e014){var _0x539f6d={};_0x539f6d[_0xf7e014]={'$like':'%'+_0x11b001[_0xe896('0x28')][_0xe896('0x33')]+'%'};return _0x539f6d;})});}_0x221108=_[_0xe896('0x34')]({},_0x221108,_0x11b001['options']);return _0x1d780a[_0xe896('0x4e')](_0x221108);}})[_0xe896('0x18')](function(_0x362bd1){if(_0x362bd1){_0x14b2b9=_0x362bd1[_0xe896('0x2c')];if(!_0x11b001['query'][_0xe896('0x51')](_0xe896('0x2d'))){_0x221108[_0xe896('0x11')]=qs[_0xe896('0x11')](_0x11b001['query'][_0xe896('0x11')]);_0x221108[_0xe896('0x13')]=qs['offset'](_0x11b001[_0xe896('0x28')][_0xe896('0x13')]);}return _0x1d780a[_0xe896('0x4e')](_0x221108);}})[_0xe896('0x18')](function(_0x59afad){if(_0x59afad){return _0x59afad?{'count':_0x14b2b9,'rows':_0x59afad}:null;}})[_0xe896('0x18')](respondWithResult(_0xa0a63e,null))[_0xe896('0x42')](handleError(_0xa0a63e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 254633d..c25571e 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 _0x60dd=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x60dd,0x75));var _0xd60d=function(_0x57e0dc,_0x7cd803){_0x57e0dc=_0x57e0dc-0x0;var _0x529f5c=_0x60dd[_0x57e0dc];return _0x529f5c;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xd60d('0x0'))['db'][_0xd60d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd60d('0x2')](0x0);var events={'afterCreate':_0xd60d('0x3'),'afterUpdate':_0xd60d('0x4'),'afterDestroy':_0xd60d('0x5')};function emitEvent(_0x58c840){return function(_0x5650d2,_0x383de4,_0x1d0aeb){SquareProjectEvents[_0xd60d('0x6')](_0x58c840+':'+_0x5650d2['id'],_0x5650d2);SquareProjectEvents[_0xd60d('0x6')](_0x58c840,_0x5650d2);_0x1d0aeb(null);};}for(var e in events){if(events[_0xd60d('0x7')](e)){var event=events[e];SquareProject[_0xd60d('0x8')](e,emitEvent(event));}}module[_0xd60d('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xe321=['hasOwnProperty','exports','events','setMaxListeners','update','remove','emit'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xe321,0xb8));var _0x1e32=function(_0x33541d,_0xaee09e){_0x33541d=_0x33541d-0x0;var _0x52d9a5=_0xe321[_0x33541d];return _0x52d9a5;};'use strict';var EventEmitter=require(_0x1e32('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1e32('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e32('0x2'),'afterDestroy':_0x1e32('0x3')};function emitEvent(_0x498f99){return function(_0x13b793,_0x5b3e9b,_0x150af0){SquareProjectEvents[_0x1e32('0x4')](_0x498f99+':'+_0x13b793['id'],_0x13b793);SquareProjectEvents['emit'](_0x498f99,_0x13b793);_0x150af0(null);};}for(var e in events){if(events[_0x1e32('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x1e32('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 6c0bd30..3f56f0b 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 _0x7298=['publishedAt','format','lodash','api','request-promise','path','../../config/environment','./squareProject.attributes','exports','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','changed','production'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x7298,0x11a));var _0x8729=function(_0x1907a9,_0x254085){_0x1907a9=_0x1907a9-0x0;var _0x59917f=_0x7298[_0x1907a9];return _0x59917f;};'use strict';var _=require(_0x8729('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8729('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8729('0x2'));var fs=require('fs');var path=require(_0x8729('0x3'));var rimraf=require('rimraf');var config=require(_0x8729('0x4'));var attributes=require(_0x8729('0x5'));module[_0x8729('0x6')]=function(_0x4c33ec,_0x26e295){return _0x4c33ec['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5011e2,_0x1b98d4,_0x4d56c5){if(_0x5011e2['changed'](_0x8729('0x7'))){_0x5011e2[_0x8729('0x8')]=moment()['format'](_0x8729('0x9'));}if(_0x5011e2[_0x8729('0xa')](_0x8729('0xb'))){_0x5011e2[_0x8729('0xc')]=moment()[_0x8729('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4d56c5(null,_0x5011e2);}}});}; \ No newline at end of file +var _0xb504=['define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x5b8d3a,_0x427276){var _0xe0ecb3=function(_0x3d7b11){while(--_0x3d7b11){_0x5b8d3a['push'](_0x5b8d3a['shift']());}};_0xe0ecb3(++_0x427276);}(_0xb504,0x14a));var _0x4b50=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb504[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x4b50('0x0'));var logger=require(_0x4b50('0x1'))(_0x4b50('0x2'));var moment=require(_0x4b50('0x3'));var BPromise=require(_0x4b50('0x4'));var rp=require(_0x4b50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b50('0x6'));var config=require(_0x4b50('0x7'));var attributes=require(_0x4b50('0x8'));module[_0x4b50('0x9')]=function(_0x38ad19,_0x7325b4){return _0x38ad19[_0x4b50('0xa')]('SquareProject',attributes,{'tableName':_0x4b50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55a068,_0x4b81ab,_0x4f32de){if(_0x55a068['changed'](_0x4b50('0xc'))){_0x55a068[_0x4b50('0xd')]=moment()[_0x4b50('0xe')](_0x4b50('0xf'));}if(_0x55a068[_0x4b50('0x10')]('production')){_0x55a068['publishedAt']=moment()[_0x4b50('0xe')](_0x4b50('0xf'));}_0x4f32de(null,_0x55a068);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 671d763..84622bd 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 _0x2400=['find','then','ShowSquareProject','catch','lodash','../../mysqldb','../../config/logger','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','SquareProject','options','raw','where','attributes','limit','include','map','model','info','GetSquareProjects','debug','stringify','error','message'];(function(_0x1bc77a,_0x2f0207){var _0x3103c1=function(_0x320dfb){while(--_0x320dfb){_0x1bc77a['push'](_0x1bc77a['shift']());}};_0x3103c1(++_0x2f0207);}(_0x2400,0x199));var _0x0240=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x2400[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x0240('0x0'));var Redis=require('ioredis');var db=require(_0x0240('0x1'))['db'];var logger=require(_0x0240('0x2'))('rpc');var config=require(_0x0240('0x3'));config[_0x0240('0x4')]=_['defaults'](config[_0x0240('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x0240('0x5'))(new Redis(config[_0x0240('0x4')]));require(_0x0240('0x6'))[_0x0240('0x7')](socket);exports['GetSquareProjects']=function(_0x4cd213){var _0x5d7d0b=this;return new Promise(function(_0x364776,_0x322e9a){return db[_0x0240('0x8')]['findAll']({'raw':_0x4cd213[_0x0240('0x9')]?_0x4cd213[_0x0240('0x9')][_0x0240('0xa')]===undefined?!![]:![]:!![],'where':_0x4cd213[_0x0240('0x9')]?_0x4cd213[_0x0240('0x9')][_0x0240('0xb')]||null:null,'attributes':_0x4cd213['options']?_0x4cd213[_0x0240('0x9')][_0x0240('0xc')]||null:null,'limit':_0x4cd213[_0x0240('0x9')]?_0x4cd213[_0x0240('0x9')][_0x0240('0xd')]||null:null,'include':_0x4cd213[_0x0240('0x9')]?_0x4cd213[_0x0240('0x9')][_0x0240('0xe')]?_[_0x0240('0xf')](_0x4cd213[_0x0240('0x9')][_0x0240('0xe')],function(_0x5091f0){return{'model':db[_0x5091f0[_0x0240('0x10')]],'as':_0x5091f0['as'],'attributes':_0x5091f0[_0x0240('0xc')],'include':_0x5091f0['include']?_[_0x0240('0xf')](_0x5091f0[_0x0240('0xe')],function(_0x5f0028){return{'model':db[_0x5f0028[_0x0240('0x10')]],'as':_0x5f0028['as'],'attributes':_0x5f0028[_0x0240('0xc')],'include':_0x5f0028[_0x0240('0xe')]?_[_0x0240('0xf')](_0x5f0028['include'],function(_0x26751e){return{'model':db[_0x26751e[_0x0240('0x10')]],'as':_0x26751e['as'],'attributes':_0x26751e[_0x0240('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2c4e){logger[_0x0240('0x11')](_0x0240('0x12'),_0x4cd213);logger[_0x0240('0x13')]('GetSquareProjects',_0x4cd213,JSON[_0x0240('0x14')](_0x3c2c4e));_0x364776(_0x3c2c4e);})['catch'](function(_0x37e380){logger[_0x0240('0x15')](_0x0240('0x12'),_0x37e380[_0x0240('0x16')],_0x4cd213);_0x322e9a(_0x5d7d0b[_0x0240('0x15')](0x1f4,_0x37e380[_0x0240('0x16')]));});});};exports['ShowSquareProject']=function(_0x57a722){var _0x2c6902=this;return new Promise(function(_0x3b4165,_0x771ba1){return db[_0x0240('0x8')][_0x0240('0x17')]({'raw':_0x57a722[_0x0240('0x9')]?_0x57a722['options']['raw']===undefined?!![]:![]:!![],'where':_0x57a722[_0x0240('0x9')]?_0x57a722[_0x0240('0x9')][_0x0240('0xb')]||null:null,'attributes':_0x57a722[_0x0240('0x9')]?_0x57a722['options'][_0x0240('0xc')]||null:null,'include':_0x57a722[_0x0240('0x9')]?_0x57a722[_0x0240('0x9')][_0x0240('0xe')]?_['map'](_0x57a722['options']['include'],function(_0x2e1b3b){return{'model':db[_0x2e1b3b['model']],'as':_0x2e1b3b['as'],'attributes':_0x2e1b3b['attributes'],'include':_0x2e1b3b['include']?_[_0x0240('0xf')](_0x2e1b3b['include'],function(_0x276894){return{'model':db[_0x276894[_0x0240('0x10')]],'as':_0x276894['as'],'attributes':_0x276894[_0x0240('0xc')],'include':_0x276894[_0x0240('0xe')]?_[_0x0240('0xf')](_0x276894[_0x0240('0xe')],function(_0x584e74){return{'model':db[_0x584e74[_0x0240('0x10')]],'as':_0x584e74['as'],'attributes':_0x584e74[_0x0240('0xc')]};}):[]};}):[]};}):[]:[]})[_0x0240('0x18')](function(_0x2cbe94){logger[_0x0240('0x11')](_0x0240('0x19'),_0x57a722);logger['debug']('ShowSquareProject',_0x57a722,JSON[_0x0240('0x14')](_0x2cbe94));_0x3b4165(_0x2cbe94);})[_0x0240('0x1a')](function(_0x39b6f0){logger[_0x0240('0x15')](_0x0240('0x19'),_0x39b6f0['message'],_0x57a722);_0x771ba1(_0x2c6902['error'](0x1f4,_0x39b6f0[_0x0240('0x16')]));});});}; \ No newline at end of file +var _0xee07=['catch','message','error','ShowSquareProject','find','where','ioredis','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','SquareProject','findAll','options','raw','attributes','include','map','model','info','GetSquareProjects','debug','stringify'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0xee07,0x1e1));var _0x7ee0=function(_0x177e71,_0x4158be){_0x177e71=_0x177e71-0x0;var _0x20143d=_0xee07[_0x177e71];return _0x20143d;};'use strict';var _=require('lodash');var Redis=require(_0x7ee0('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x7ee0('0x1'));var config=require(_0x7ee0('0x2'));config['redis']=_[_0x7ee0('0x3')](config[_0x7ee0('0x4')],{'host':_0x7ee0('0x5'),'port':0x18eb});var socket=require(_0x7ee0('0x6'))(new Redis(config[_0x7ee0('0x4')]));require('./squareProject.socket')['register'](socket);exports['GetSquareProjects']=function(_0x1db4ff){var _0x13dcf6=this;return new Promise(function(_0x195435,_0x34726f){return db[_0x7ee0('0x7')][_0x7ee0('0x8')]({'raw':_0x1db4ff[_0x7ee0('0x9')]?_0x1db4ff[_0x7ee0('0x9')][_0x7ee0('0xa')]===undefined?!![]:![]:!![],'where':_0x1db4ff['options']?_0x1db4ff[_0x7ee0('0x9')]['where']||null:null,'attributes':_0x1db4ff['options']?_0x1db4ff['options'][_0x7ee0('0xb')]||null:null,'limit':_0x1db4ff[_0x7ee0('0x9')]?_0x1db4ff[_0x7ee0('0x9')]['limit']||null:null,'include':_0x1db4ff[_0x7ee0('0x9')]?_0x1db4ff[_0x7ee0('0x9')][_0x7ee0('0xc')]?_[_0x7ee0('0xd')](_0x1db4ff[_0x7ee0('0x9')]['include'],function(_0x3a757b){return{'model':db[_0x3a757b[_0x7ee0('0xe')]],'as':_0x3a757b['as'],'attributes':_0x3a757b[_0x7ee0('0xb')],'include':_0x3a757b['include']?_[_0x7ee0('0xd')](_0x3a757b[_0x7ee0('0xc')],function(_0xa40868){return{'model':db[_0xa40868[_0x7ee0('0xe')]],'as':_0xa40868['as'],'attributes':_0xa40868[_0x7ee0('0xb')],'include':_0xa40868[_0x7ee0('0xc')]?_[_0x7ee0('0xd')](_0xa40868[_0x7ee0('0xc')],function(_0x3e2bf9){return{'model':db[_0x3e2bf9['model']],'as':_0x3e2bf9['as'],'attributes':_0x3e2bf9[_0x7ee0('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aee0d){logger[_0x7ee0('0xf')](_0x7ee0('0x10'),_0x1db4ff);logger[_0x7ee0('0x11')](_0x7ee0('0x10'),_0x1db4ff,JSON[_0x7ee0('0x12')](_0x2aee0d));_0x195435(_0x2aee0d);})[_0x7ee0('0x13')](function(_0x27b949){logger['error'](_0x7ee0('0x10'),_0x27b949[_0x7ee0('0x14')],_0x1db4ff);_0x34726f(_0x13dcf6[_0x7ee0('0x15')](0x1f4,_0x27b949[_0x7ee0('0x14')]));});});};exports[_0x7ee0('0x16')]=function(_0x1e9818){var _0x5d82c6=this;return new Promise(function(_0x463f2d,_0x318baa){return db[_0x7ee0('0x7')][_0x7ee0('0x17')]({'raw':_0x1e9818[_0x7ee0('0x9')]?_0x1e9818['options'][_0x7ee0('0xa')]===undefined?!![]:![]:!![],'where':_0x1e9818['options']?_0x1e9818[_0x7ee0('0x9')][_0x7ee0('0x18')]||null:null,'attributes':_0x1e9818['options']?_0x1e9818[_0x7ee0('0x9')]['attributes']||null:null,'include':_0x1e9818[_0x7ee0('0x9')]?_0x1e9818[_0x7ee0('0x9')][_0x7ee0('0xc')]?_[_0x7ee0('0xd')](_0x1e9818[_0x7ee0('0x9')]['include'],function(_0x1cb6f7){return{'model':db[_0x1cb6f7[_0x7ee0('0xe')]],'as':_0x1cb6f7['as'],'attributes':_0x1cb6f7['attributes'],'include':_0x1cb6f7[_0x7ee0('0xc')]?_[_0x7ee0('0xd')](_0x1cb6f7[_0x7ee0('0xc')],function(_0x25296d){return{'model':db[_0x25296d[_0x7ee0('0xe')]],'as':_0x25296d['as'],'attributes':_0x25296d[_0x7ee0('0xb')],'include':_0x25296d[_0x7ee0('0xc')]?_[_0x7ee0('0xd')](_0x25296d[_0x7ee0('0xc')],function(_0x49c539){return{'model':db[_0x49c539[_0x7ee0('0xe')]],'as':_0x49c539['as'],'attributes':_0x49c539[_0x7ee0('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c793b){logger['info'](_0x7ee0('0x16'),_0x1e9818);logger[_0x7ee0('0x11')](_0x7ee0('0x16'),_0x1e9818,JSON[_0x7ee0('0x12')](_0x4c793b));_0x463f2d(_0x4c793b);})[_0x7ee0('0x13')](function(_0x29f167){logger['error'](_0x7ee0('0x16'),_0x29f167[_0x7ee0('0x14')],_0x1e9818);_0x318baa(_0x5d82c6[_0x7ee0('0x15')](0x1f4,_0x29f167[_0x7ee0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index cf00984..2d750ea 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 _0xf7b9=['remove','update','removeListener','register','squareProject:','./squareProject.events'];(function(_0x3852d8,_0x29b107){var _0x4f16fc=function(_0x161c01){while(--_0x161c01){_0x3852d8['push'](_0x3852d8['shift']());}};_0x4f16fc(++_0x29b107);}(_0xf7b9,0x1e5));var _0x9f7b=function(_0x36ac5f,_0x4e085a){_0x36ac5f=_0x36ac5f-0x0;var _0x2e3ee1=_0xf7b9[_0x36ac5f];return _0x2e3ee1;};'use strict';var SquareProjectEvents=require(_0x9f7b('0x0'));var events=['save',_0x9f7b('0x1'),_0x9f7b('0x2')];function createListener(_0x1973b3,_0x14056e){return function(_0x33045c){_0x14056e['emit'](_0x1973b3,_0x33045c);};}function removeListener(_0x1cbc7c,_0xf7d629){return function(){SquareProjectEvents[_0x9f7b('0x3')](_0x1cbc7c,_0xf7d629);};}exports[_0x9f7b('0x4')]=function(_0x2b29ef){for(var _0x455f18=0x0,_0x32f8bf=events['length'];_0x455f18<_0x32f8bf;_0x455f18++){var _0x361ab1=events[_0x455f18];var _0x5dc578=createListener(_0x9f7b('0x5')+_0x361ab1,_0x2b29ef);SquareProjectEvents['on'](_0x361ab1,_0x5dc578);}}; \ No newline at end of file +var _0x0222=['./squareProject.events','save','remove','update','emit','register','length','squareProject:'];(function(_0x294f17,_0x55a970){var _0x42603e=function(_0x578d1c){while(--_0x578d1c){_0x294f17['push'](_0x294f17['shift']());}};_0x42603e(++_0x55a970);}(_0x0222,0x110));var _0x2022=function(_0x55c603,_0x327bf6){_0x55c603=_0x55c603-0x0;var _0x2d0244=_0x0222[_0x55c603];return _0x2d0244;};'use strict';var SquareProjectEvents=require(_0x2022('0x0'));var events=[_0x2022('0x1'),_0x2022('0x2'),_0x2022('0x3')];function createListener(_0x51872d,_0x1f2596){return function(_0x2988f7){_0x1f2596[_0x2022('0x4')](_0x51872d,_0x2988f7);};}function removeListener(_0x24cc3b,_0x55addf){return function(){SquareProjectEvents['removeListener'](_0x24cc3b,_0x55addf);};}exports[_0x2022('0x5')]=function(_0x3edfd7){for(var _0xd4535d=0x0,_0x4a619e=events[_0x2022('0x6')];_0xd4535d<_0x4a619e;_0xd4535d++){var _0x485437=events[_0xd4535d];var _0x298b68=createListener(_0x2022('0x7')+_0x485437,_0x3edfd7);SquareProjectEvents['on'](_0x485437,_0x298b68);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6f8183c..0b6f0b1 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x4403b3,_0x3e2628){var _0x415fb9=function(_0x2fb805){while(--_0x2fb805){_0x4403b3['push'](_0x4403b3['shift']());}};_0x415fb9(++_0x3e2628);}(_0x814b,0x1a2));var _0xb814=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x814b[_0x73b1cd];return _0x243426;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x324516,_0x13fa77){var _0x10aaf3=function(_0x5ab0ed){while(--_0x5ab0ed){_0x324516['push'](_0x324516['shift']());}};_0x10aaf3(++_0x13fa77);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('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 96ded72..5084c2b 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 _0x5075=['savePath','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0x5075,0x73));var _0x5507=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0x5075[_0x2c602e];return _0x1a2650;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'callerid':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'extension':{'type':Sequelize[_0x5507('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'dnid':{'type':Sequelize[_0x5507('0x2')]},'projectName':{'type':Sequelize[_0x5507('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x5507('0x2')]},'format':{'type':Sequelize[_0x5507('0x3')],'get':function(){var _0x4c2d6d='';var _0x42c232=this[_0x5507('0x4')](_0x5507('0x5'));if(_0x42c232){_0x4c2d6d=_0x42c232['substring'](_0x42c232['lastIndexOf']('.'));}return _0x4c2d6d;}}}; \ No newline at end of file +var _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x2eb2,0x19f));var _0x22eb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x2eb2[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'callerid':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'extension':{'type':Sequelize[_0x22eb('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x22eb('0x1')]},'filename':{'type':Sequelize[_0x22eb('0x1')]},'savePath':{'type':Sequelize[_0x22eb('0x1')]},'format':{'type':Sequelize[_0x22eb('0x2')],'get':function(){var _0x4539d0='';var _0x396806=this[_0x22eb('0x3')](_0x22eb('0x4'));if(_0x396806){_0x4539d0=_0x396806[_0x22eb('0x5')](_0x396806[_0x22eb('0x6')]('.'));}return _0x4539d0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5246959..b6703fa 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 _0xdaf1=['includeAll','include','findAll','rows','show','params','find','catch','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','File:\x20\x22','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','send','index','map','SquareRecording','rawAttributes','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options'];(function(_0x1c6a76,_0x5087e2){var _0x44933c=function(_0x2802b2){while(--_0x2802b2){_0x1c6a76['push'](_0x1c6a76['shift']());}};_0x44933c(++_0x5087e2);}(_0xdaf1,0xe5));var _0x1daf=function(_0x52d11a,_0xe11774){_0x52d11a=_0x52d11a-0x0;var _0x278a48=_0xdaf1[_0x52d11a];return _0x278a48;};'use strict';var emlformat=require(_0x1daf('0x0'));var rimraf=require(_0x1daf('0x1'));var zipdir=require(_0x1daf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1daf('0x3'));var BPromise=require(_0x1daf('0x4'));var Mustache=require(_0x1daf('0x5'));var util=require('util');var path=require(_0x1daf('0x6'));var sox=require('sox');var csv=require(_0x1daf('0x7'));var ejs=require(_0x1daf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1daf('0x9'));var squel=require(_0x1daf('0xa'));var crypto=require(_0x1daf('0xb'));var jsforce=require(_0x1daf('0xc'));var deskjs=require(_0x1daf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1daf('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1daf('0xf'));var qs=require(_0x1daf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1daf('0x11'));var logger=require('../../config/logger')(_0x1daf('0x12'));var utils=require('../../config/utils');var config=require(_0x1daf('0x13'));var licenseUtil=require(_0x1daf('0x14'));var db=require(_0x1daf('0x15'))['db'];function respondWithStatusCode(_0x579fd8,_0x4b88cb){_0x4b88cb=_0x4b88cb||0xcc;return function(_0x973771){if(_0x973771){return _0x579fd8[_0x1daf('0x16')](_0x4b88cb);}return _0x579fd8[_0x1daf('0x17')](_0x4b88cb)[_0x1daf('0x18')]();};}function respondWithResult(_0x197d2f,_0x5d369e){_0x5d369e=_0x5d369e||0xc8;return function(_0x17c322){if(_0x17c322){return _0x197d2f[_0x1daf('0x17')](_0x5d369e)['json'](_0x17c322);}};}function respondWithFilteredResult(_0x1a161f,_0x50f9d1){return function(_0x4826fb){if(_0x4826fb){var _0x34bd88=typeof _0x50f9d1[_0x1daf('0x19')]==='undefined'&&typeof _0x50f9d1[_0x1daf('0x1a')]==='undefined';var _0x3b5941=_0x4826fb[_0x1daf('0x1b')];var _0x1a50f5=_0x34bd88?0x0:_0x50f9d1[_0x1daf('0x19')];var _0x4194e5=_0x34bd88?_0x4826fb[_0x1daf('0x1b')]:_0x50f9d1[_0x1daf('0x19')]+_0x50f9d1['limit'];var _0x1c3bca;if(_0x4194e5>=_0x3b5941){_0x4194e5=_0x3b5941;_0x1c3bca=0xc8;}else{_0x1c3bca=0xce;}_0x1a161f[_0x1daf('0x17')](_0x1c3bca);return _0x1a161f[_0x1daf('0x1c')](_0x1daf('0x1d'),_0x1a50f5+'-'+_0x4194e5+'/'+_0x3b5941)['json'](_0x4826fb);}return null;};}function patchUpdates(_0x38c8f3){return function(_0x56e9db){try{jsonpatch[_0x1daf('0x1e')](_0x56e9db,_0x38c8f3,!![]);}catch(_0x370916){return BPromise['reject'](_0x370916);}return _0x56e9db[_0x1daf('0x1f')]();};}function saveUpdates(_0xc4f0c3,_0x21cd80){return function(_0x607be0){if(_0x607be0){return _0x607be0[_0x1daf('0x20')](_0xc4f0c3)['then'](function(_0x1c5e8a){return _0x1c5e8a;});}return null;};}function removeEntity(_0x2c86ef,_0x29a399){return function(_0x2c1588){if(_0x2c1588){return _0x2c1588[_0x1daf('0x21')]()[_0x1daf('0x22')](function(){_0x2c86ef['status'](0xcc)[_0x1daf('0x18')]();});}};}function handleEntityNotFound(_0xec9bcf,_0x2cb507){return function(_0x4a7a02){if(!_0x4a7a02){_0xec9bcf[_0x1daf('0x16')](0x194);}return _0x4a7a02;};}function handleError(_0x52477d,_0x1b3b11){_0x1b3b11=_0x1b3b11||0x1f4;return function(_0x3dc80e){logger[_0x1daf('0x23')](_0x3dc80e[_0x1daf('0x24')]);if(_0x3dc80e['name']){delete _0x3dc80e['name'];}_0x52477d[_0x1daf('0x17')](_0x1b3b11)[_0x1daf('0x25')](_0x3dc80e);};}exports[_0x1daf('0x26')]=function(_0x1b5082,_0x2ef36c){var _0xc06589={},_0x2c3ffa={},_0x91ae7b={'count':0x0,'rows':[]};var _0x128c9b=_[_0x1daf('0x27')](db[_0x1daf('0x28')][_0x1daf('0x29')],function(_0x4fccee){return{'name':_0x4fccee['fieldName'],'type':_0x4fccee['type']['key']};});_0x2c3ffa[_0x1daf('0x2a')]=_[_0x1daf('0x27')](_0x128c9b,_0x1daf('0x2b'));_0x2c3ffa['query']=_[_0x1daf('0x2c')](_0x1b5082[_0x1daf('0x2d')]);_0x2c3ffa[_0x1daf('0x2e')]=_['intersection'](_0x2c3ffa[_0x1daf('0x2a')],_0x2c3ffa['query']);_0xc06589[_0x1daf('0x2f')]=_[_0x1daf('0x30')](_0x2c3ffa[_0x1daf('0x2a')],qs[_0x1daf('0x31')](_0x1b5082[_0x1daf('0x2d')][_0x1daf('0x31')]));_0xc06589['attributes']=_0xc06589[_0x1daf('0x2f')][_0x1daf('0x32')]?_0xc06589[_0x1daf('0x2f')]:_0x2c3ffa[_0x1daf('0x2a')];if(!_0x1b5082[_0x1daf('0x2d')][_0x1daf('0x33')]('nolimit')){_0xc06589['limit']=qs[_0x1daf('0x1a')](_0x1b5082[_0x1daf('0x2d')][_0x1daf('0x1a')]);_0xc06589[_0x1daf('0x19')]=qs['offset'](_0x1b5082['query'][_0x1daf('0x19')]);}_0xc06589[_0x1daf('0x34')]=qs[_0x1daf('0x35')](_0x1b5082[_0x1daf('0x2d')]['sort']);_0xc06589[_0x1daf('0x36')]=qs[_0x1daf('0x2e')](_[_0x1daf('0x37')](_0x1b5082['query'],_0x2c3ffa['filters']),_0x128c9b);if(_0x1b5082[_0x1daf('0x2d')][_0x1daf('0x38')]){_0xc06589[_0x1daf('0x36')]=_[_0x1daf('0x39')](_0xc06589[_0x1daf('0x36')],{'$or':_[_0x1daf('0x27')](_0x128c9b,function(_0x1cbee6){if(_0x1cbee6['type']!=='VIRTUAL'){var _0x25609d={};_0x25609d[_0x1cbee6[_0x1daf('0x2b')]]={'$like':'%'+_0x1b5082[_0x1daf('0x2d')][_0x1daf('0x38')]+'%'};return _0x25609d;}})});}_0xc06589=_[_0x1daf('0x39')]({},_0xc06589,_0x1b5082[_0x1daf('0x3a')]);var _0x3d3b16={'where':_0xc06589[_0x1daf('0x36')]};return db[_0x1daf('0x28')][_0x1daf('0x1b')](_0x3d3b16)[_0x1daf('0x22')](function(_0x223eeb){_0x91ae7b[_0x1daf('0x1b')]=_0x223eeb;if(_0x1b5082['query'][_0x1daf('0x3b')]){_0xc06589[_0x1daf('0x3c')]=[{'all':!![]}];}return db['SquareRecording'][_0x1daf('0x3d')](_0xc06589);})['then'](function(_0x2ad263){_0x91ae7b[_0x1daf('0x3e')]=_0x2ad263;return _0x91ae7b;})['then'](respondWithFilteredResult(_0x2ef36c,_0xc06589))['catch'](handleError(_0x2ef36c,null));};exports[_0x1daf('0x3f')]=function(_0x54c6f7,_0xf7e43d){var _0x23e712={'raw':!![],'where':{'id':_0x54c6f7[_0x1daf('0x40')]['id']}},_0x534fef={};_0x534fef['model']=_[_0x1daf('0x2c')](db['SquareRecording'][_0x1daf('0x29')]);_0x534fef[_0x1daf('0x2d')]=_['keys'](_0x54c6f7['query']);_0x534fef[_0x1daf('0x2e')]=_[_0x1daf('0x30')](_0x534fef[_0x1daf('0x2a')],_0x534fef[_0x1daf('0x2d')]);_0x23e712[_0x1daf('0x2f')]=_[_0x1daf('0x30')](_0x534fef[_0x1daf('0x2a')],qs['fields'](_0x54c6f7['query'][_0x1daf('0x31')]));_0x23e712[_0x1daf('0x2f')]=_0x23e712[_0x1daf('0x2f')][_0x1daf('0x32')]?_0x23e712[_0x1daf('0x2f')]:_0x534fef[_0x1daf('0x2a')];if(_0x54c6f7[_0x1daf('0x2d')][_0x1daf('0x3b')]){_0x23e712['include']=[{'all':!![]}];}_0x23e712=_[_0x1daf('0x39')]({},_0x23e712,_0x54c6f7[_0x1daf('0x3a')]);return db[_0x1daf('0x28')][_0x1daf('0x41')](_0x23e712)[_0x1daf('0x22')](handleEntityNotFound(_0xf7e43d,null))[_0x1daf('0x22')](respondWithResult(_0xf7e43d,null))[_0x1daf('0x42')](handleError(_0xf7e43d,null));};exports[_0x1daf('0x43')]=function(_0x5df9f1,_0x56f2c0){return db[_0x1daf('0x28')][_0x1daf('0x43')](_0x5df9f1[_0x1daf('0x44')],{})[_0x1daf('0x22')](respondWithResult(_0x56f2c0,0xc9))[_0x1daf('0x42')](handleError(_0x56f2c0,null));};exports['update']=function(_0x591545,_0x26c3b8){if(_0x591545['body']['id']){delete _0x591545[_0x1daf('0x44')]['id'];}return db[_0x1daf('0x28')]['find']({'where':{'id':_0x591545['params']['id']}})[_0x1daf('0x22')](handleEntityNotFound(_0x26c3b8,null))[_0x1daf('0x22')](saveUpdates(_0x591545[_0x1daf('0x44')],null))['then'](respondWithResult(_0x26c3b8,null))[_0x1daf('0x42')](handleError(_0x26c3b8,null));};exports[_0x1daf('0x45')]=function(_0x3af6ba,_0x5c1888,_0x59169b){var _0x5e4ae1=require(_0x1daf('0x46'));var _0x2e601f=![];var _0x41dc1d={};if(_0x3af6ba[_0x1daf('0x2d')][_0x1daf('0x47')]&&_0x3af6ba[_0x1daf('0x2d')]['type']===_0x1daf('0x48')){_0x41dc1d[_0x1daf('0x48')]=_0x3af6ba[_0x1daf('0x40')]['id'];}else{_0x41dc1d['id']=_0x3af6ba[_0x1daf('0x40')]['id'];}return db[_0x1daf('0x28')][_0x1daf('0x41')]({'where':_0x41dc1d,'attributes':['id',_0x1daf('0x49'),_0x1daf('0x4a')],'raw':!![]})[_0x1daf('0x22')](handleEntityNotFound(_0x5c1888,null))['then'](function(_0x53ae46){if(_0x53ae46){var _0xc7548e=_0x53ae46[_0x1daf('0x49')];var _0x315d84=util[_0x1daf('0x4b')](_0x1daf('0x4c'),_0xc7548e);if(fs[_0x1daf('0x4d')](_0x315d84)){_0x2e601f=!![];return _0x5e4ae1[_0x1daf('0x4e')](_0x315d84,_0xc7548e,config[_0x1daf('0x4f')][_0x1daf('0x50')])[_0x1daf('0x22')](function(){return _0x53ae46;});}return _0x53ae46;}})['then'](function(_0x1a3a77){if(_0x1a3a77){var _0x3ec1bf=_0x1a3a77[_0x1daf('0x49')];if(!fs[_0x1daf('0x4d')](_0x3ec1bf)){throw new db[(_0x1daf('0x51'))][(_0x1daf('0x52'))]('SquareRecording\x20not\x20found');}if(_0x1a3a77['filename']){return _0x5c1888[_0x1daf('0x45')](_0x3ec1bf,_0x1a3a77[_0x1daf('0x4a')]+path[_0x1daf('0x53')](_0x3ec1bf),function(){if(_0x2e601f){fs['unlink'](_0x3ec1bf);}});}else{return _0x5c1888[_0x1daf('0x45')](_0x3ec1bf,function(_0x3aab82){if(_0x2e601f){fs[_0x1daf('0x54')](_0x3ec1bf);}});}}})[_0x1daf('0x42')](function(_0x25fe50){if(_0x25fe50[_0x1daf('0x55')]===_0x1daf('0x56')){_0x5c1888[_0x1daf('0x17')](0x194)[_0x1daf('0x25')](_0x1daf('0x57'));}else{return handleError(_0x5c1888,null);}});};exports[_0x1daf('0x21')]=function(_0x41fc38,_0x4ee3fc){return db['SquareRecording'][_0x1daf('0x41')]({'where':{'id':_0x41fc38['params']['id']}})[_0x1daf('0x22')](function(_0x2c4bec){if(_['isNil'](_0x2c4bec)){throw new ReferenceError(_0x1daf('0x58'));}return _0x2c4bec;})[_0x1daf('0x22')](function(_0x427bbc){var _0x1226b9=_0x427bbc[_0x1daf('0x49')];logger['info'](_0x1daf('0x59'),_0x1226b9);if(!_[_0x1daf('0x5a')](_0x427bbc[_0x1daf('0x49')])&&fs['existsSync'](_0x1226b9)){logger['info']('File:\x20\x22'+_0x1226b9+_0x1daf('0x5b'));fs[_0x1daf('0x5c')](_0x1226b9);}_0x1226b9=_0x1226b9+_0x1daf('0x5d');if(!_[_0x1daf('0x5a')](_0x427bbc['savePath'])&&fs['existsSync'](_0x1226b9)){logger[_0x1daf('0x5e')](_0x1daf('0x5f')+_0x1226b9+_0x1daf('0x5b'));fs[_0x1daf('0x5c')](_0x1226b9);}return _0x427bbc;})[_0x1daf('0x22')](function(_0x24c3be){if(!_0x24c3be)throw new InternalError();return _0x24c3be[_0x1daf('0x21')]();})[_0x1daf('0x22')](function(){_0x4ee3fc[_0x1daf('0x17')](0xcc)[_0x1daf('0x18')]();})[_0x1daf('0x42')](handleError(_0x4ee3fc,null));}; \ No newline at end of file +var _0xc582=['reject','save','then','destroy','error','stack','name','send','index','map','SquareRecording','fieldName','key','model','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','intersection','create','body','find','download','../../components/encryptor','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xc582,0x164));var _0x2c58=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc582[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x2c58('0x0'));var rimraf=require(_0x2c58('0x1'));var zipdir=require(_0x2c58('0x2'));var jsonpatch=require(_0x2c58('0x3'));var rp=require(_0x2c58('0x4'));var moment=require(_0x2c58('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c58('0x6'));var util=require(_0x2c58('0x7'));var path=require(_0x2c58('0x8'));var sox=require('sox');var csv=require(_0x2c58('0x9'));var ejs=require(_0x2c58('0xa'));var fs=require('fs');var fs_extra=require(_0x2c58('0xb'));var _=require(_0x2c58('0xc'));var squel=require(_0x2c58('0xd'));var crypto=require(_0x2c58('0xe'));var jsforce=require(_0x2c58('0xf'));var deskjs=require(_0x2c58('0x10'));var toCsv=require(_0x2c58('0x9'));var querystring=require(_0x2c58('0x11'));var Papa=require(_0x2c58('0x12'));var Redis=require(_0x2c58('0x13'));var authService=require(_0x2c58('0x14'));var qs=require(_0x2c58('0x15'));var as=require(_0x2c58('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c58('0x17'))(_0x2c58('0x18'));var utils=require(_0x2c58('0x19'));var config=require(_0x2c58('0x1a'));var licenseUtil=require(_0x2c58('0x1b'));var db=require(_0x2c58('0x1c'))['db'];function respondWithStatusCode(_0x4a5537,_0x2abf49){_0x2abf49=_0x2abf49||0xcc;return function(_0x5d4955){if(_0x5d4955){return _0x4a5537[_0x2c58('0x1d')](_0x2abf49);}return _0x4a5537['status'](_0x2abf49)[_0x2c58('0x1e')]();};}function respondWithResult(_0x432fc7,_0x10937f){_0x10937f=_0x10937f||0xc8;return function(_0x2c925e){if(_0x2c925e){return _0x432fc7[_0x2c58('0x1f')](_0x10937f)[_0x2c58('0x20')](_0x2c925e);}};}function respondWithFilteredResult(_0xd7509e,_0xbea484){return function(_0xea2cf8){if(_0xea2cf8){var _0x39ad7e=typeof _0xbea484[_0x2c58('0x21')]===_0x2c58('0x22')&&typeof _0xbea484[_0x2c58('0x23')]===_0x2c58('0x22');var _0x1b583c=_0xea2cf8[_0x2c58('0x24')];var _0x477ac8=_0x39ad7e?0x0:_0xbea484[_0x2c58('0x21')];var _0x480b1e=_0x39ad7e?_0xea2cf8['count']:_0xbea484[_0x2c58('0x21')]+_0xbea484[_0x2c58('0x23')];var _0x38adaa;if(_0x480b1e>=_0x1b583c){_0x480b1e=_0x1b583c;_0x38adaa=0xc8;}else{_0x38adaa=0xce;}_0xd7509e[_0x2c58('0x1f')](_0x38adaa);return _0xd7509e[_0x2c58('0x25')](_0x2c58('0x26'),_0x477ac8+'-'+_0x480b1e+'/'+_0x1b583c)['json'](_0xea2cf8);}return null;};}function patchUpdates(_0x5e0364){return function(_0x2c70f9){try{jsonpatch[_0x2c58('0x27')](_0x2c70f9,_0x5e0364,!![]);}catch(_0x2a1ed9){return BPromise[_0x2c58('0x28')](_0x2a1ed9);}return _0x2c70f9[_0x2c58('0x29')]();};}function saveUpdates(_0x3b39d6,_0x1f96fa){return function(_0x43fce0){if(_0x43fce0){return _0x43fce0['update'](_0x3b39d6)[_0x2c58('0x2a')](function(_0x4b0cf0){return _0x4b0cf0;});}return null;};}function removeEntity(_0x515604,_0x5c1a65){return function(_0x4c9c49){if(_0x4c9c49){return _0x4c9c49[_0x2c58('0x2b')]()[_0x2c58('0x2a')](function(){_0x515604['status'](0xcc)[_0x2c58('0x1e')]();});}};}function handleEntityNotFound(_0x374b4d,_0x1fff13){return function(_0x432a6b){if(!_0x432a6b){_0x374b4d[_0x2c58('0x1d')](0x194);}return _0x432a6b;};}function handleError(_0xb68481,_0x241cdb){_0x241cdb=_0x241cdb||0x1f4;return function(_0x502497){logger[_0x2c58('0x2c')](_0x502497[_0x2c58('0x2d')]);if(_0x502497['name']){delete _0x502497[_0x2c58('0x2e')];}_0xb68481[_0x2c58('0x1f')](_0x241cdb)[_0x2c58('0x2f')](_0x502497);};}exports[_0x2c58('0x30')]=function(_0x5dd490,_0x1bb47c){var _0x41fa9b={},_0x6f05dd={},_0xba1148={'count':0x0,'rows':[]};var _0x2c2dd9=_[_0x2c58('0x31')](db[_0x2c58('0x32')]['rawAttributes'],function(_0x2f871b){return{'name':_0x2f871b[_0x2c58('0x33')],'type':_0x2f871b['type'][_0x2c58('0x34')]};});_0x6f05dd[_0x2c58('0x35')]=_[_0x2c58('0x31')](_0x2c2dd9,_0x2c58('0x2e'));_0x6f05dd[_0x2c58('0x36')]=_['keys'](_0x5dd490[_0x2c58('0x36')]);_0x6f05dd[_0x2c58('0x37')]=_['intersection'](_0x6f05dd['model'],_0x6f05dd['query']);_0x41fa9b[_0x2c58('0x38')]=_['intersection'](_0x6f05dd[_0x2c58('0x35')],qs[_0x2c58('0x39')](_0x5dd490[_0x2c58('0x36')][_0x2c58('0x39')]));_0x41fa9b[_0x2c58('0x38')]=_0x41fa9b[_0x2c58('0x38')][_0x2c58('0x3a')]?_0x41fa9b[_0x2c58('0x38')]:_0x6f05dd[_0x2c58('0x35')];if(!_0x5dd490[_0x2c58('0x36')]['hasOwnProperty'](_0x2c58('0x3b'))){_0x41fa9b['limit']=qs[_0x2c58('0x23')](_0x5dd490['query']['limit']);_0x41fa9b[_0x2c58('0x21')]=qs[_0x2c58('0x21')](_0x5dd490[_0x2c58('0x36')][_0x2c58('0x21')]);}_0x41fa9b['order']=qs[_0x2c58('0x3c')](_0x5dd490[_0x2c58('0x36')][_0x2c58('0x3c')]);_0x41fa9b[_0x2c58('0x3d')]=qs[_0x2c58('0x37')](_['pick'](_0x5dd490[_0x2c58('0x36')],_0x6f05dd['filters']),_0x2c2dd9);if(_0x5dd490['query'][_0x2c58('0x3e')]){_0x41fa9b[_0x2c58('0x3d')]=_[_0x2c58('0x3f')](_0x41fa9b[_0x2c58('0x3d')],{'$or':_['map'](_0x2c2dd9,function(_0x51e5a5){if(_0x51e5a5[_0x2c58('0x40')]!==_0x2c58('0x41')){var _0x170924={};_0x170924[_0x51e5a5[_0x2c58('0x2e')]]={'$like':'%'+_0x5dd490['query'][_0x2c58('0x3e')]+'%'};return _0x170924;}})});}_0x41fa9b=_['merge']({},_0x41fa9b,_0x5dd490[_0x2c58('0x42')]);var _0x507346={'where':_0x41fa9b[_0x2c58('0x3d')]};return db[_0x2c58('0x32')]['count'](_0x507346)[_0x2c58('0x2a')](function(_0x1f5666){_0xba1148[_0x2c58('0x24')]=_0x1f5666;if(_0x5dd490['query'][_0x2c58('0x43')]){_0x41fa9b[_0x2c58('0x44')]=[{'all':!![]}];}return db['SquareRecording'][_0x2c58('0x45')](_0x41fa9b);})[_0x2c58('0x2a')](function(_0x3c68ed){_0xba1148[_0x2c58('0x46')]=_0x3c68ed;return _0xba1148;})[_0x2c58('0x2a')](respondWithFilteredResult(_0x1bb47c,_0x41fa9b))[_0x2c58('0x47')](handleError(_0x1bb47c,null));};exports['show']=function(_0x996c5a,_0x2aa550){var _0x3500dd={'raw':!![],'where':{'id':_0x996c5a[_0x2c58('0x48')]['id']}},_0x532aec={};_0x532aec['model']=_[_0x2c58('0x49')](db[_0x2c58('0x32')][_0x2c58('0x4a')]);_0x532aec['query']=_['keys'](_0x996c5a[_0x2c58('0x36')]);_0x532aec['filters']=_[_0x2c58('0x4b')](_0x532aec['model'],_0x532aec[_0x2c58('0x36')]);_0x3500dd[_0x2c58('0x38')]=_['intersection'](_0x532aec['model'],qs[_0x2c58('0x39')](_0x996c5a['query'][_0x2c58('0x39')]));_0x3500dd['attributes']=_0x3500dd[_0x2c58('0x38')][_0x2c58('0x3a')]?_0x3500dd[_0x2c58('0x38')]:_0x532aec['model'];if(_0x996c5a[_0x2c58('0x36')]['includeAll']){_0x3500dd[_0x2c58('0x44')]=[{'all':!![]}];}_0x3500dd=_['merge']({},_0x3500dd,_0x996c5a['options']);return db[_0x2c58('0x32')]['find'](_0x3500dd)[_0x2c58('0x2a')](handleEntityNotFound(_0x2aa550,null))[_0x2c58('0x2a')](respondWithResult(_0x2aa550,null))[_0x2c58('0x47')](handleError(_0x2aa550,null));};exports[_0x2c58('0x4c')]=function(_0x5debfd,_0x4fbe66){return db[_0x2c58('0x32')]['create'](_0x5debfd[_0x2c58('0x4d')],{})[_0x2c58('0x2a')](respondWithResult(_0x4fbe66,0xc9))[_0x2c58('0x47')](handleError(_0x4fbe66,null));};exports['update']=function(_0x5357d9,_0x2e4802){if(_0x5357d9['body']['id']){delete _0x5357d9[_0x2c58('0x4d')]['id'];}return db['SquareRecording'][_0x2c58('0x4e')]({'where':{'id':_0x5357d9[_0x2c58('0x48')]['id']}})[_0x2c58('0x2a')](handleEntityNotFound(_0x2e4802,null))[_0x2c58('0x2a')](saveUpdates(_0x5357d9[_0x2c58('0x4d')],null))[_0x2c58('0x2a')](respondWithResult(_0x2e4802,null))[_0x2c58('0x47')](handleError(_0x2e4802,null));};exports[_0x2c58('0x4f')]=function(_0x3adc78,_0x4ab498,_0x5b7972){var _0x267910=require(_0x2c58('0x50'));var _0x1a70d9=![];var _0x2ffbd2={};if(_0x3adc78[_0x2c58('0x36')][_0x2c58('0x40')]&&_0x3adc78['query']['type']==='uniqueid'){_0x2ffbd2['uniqueid']=_0x3adc78[_0x2c58('0x48')]['id'];}else{_0x2ffbd2['id']=_0x3adc78['params']['id'];}return db[_0x2c58('0x32')][_0x2c58('0x4e')]({'where':_0x2ffbd2,'attributes':['id',_0x2c58('0x51'),_0x2c58('0x52')],'raw':!![]})[_0x2c58('0x2a')](handleEntityNotFound(_0x4ab498,null))[_0x2c58('0x2a')](function(_0x83b0b1){if(_0x83b0b1){var _0xbaed67=_0x83b0b1[_0x2c58('0x51')];var _0x3d6a96=util['format'](_0x2c58('0x53'),_0xbaed67);if(fs[_0x2c58('0x54')](_0x3d6a96)){_0x1a70d9=!![];return _0x267910[_0x2c58('0x55')](_0x3d6a96,_0xbaed67,config[_0x2c58('0x56')]['recording'])['then'](function(){return _0x83b0b1;});}return _0x83b0b1;}})[_0x2c58('0x2a')](function(_0x2c2863){if(_0x2c2863){var _0x3b414d=_0x2c2863[_0x2c58('0x51')];if(!fs['existsSync'](_0x3b414d)){throw new db[(_0x2c58('0x57'))][(_0x2c58('0x58'))](_0x2c58('0x59'));}if(_0x2c2863[_0x2c58('0x52')]){return _0x4ab498[_0x2c58('0x4f')](_0x3b414d,_0x2c2863[_0x2c58('0x52')]+path[_0x2c58('0x5a')](_0x3b414d),function(){if(_0x1a70d9){fs['unlink'](_0x3b414d);}});}else{return _0x4ab498[_0x2c58('0x4f')](_0x3b414d,function(_0x2958ac){if(_0x1a70d9){fs[_0x2c58('0x5b')](_0x3b414d);}});}}})[_0x2c58('0x47')](function(_0x19f9f0){if(_0x19f9f0[_0x2c58('0x5c')]===_0x2c58('0x59')){_0x4ab498['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x4ab498,null);}});};exports['destroy']=function(_0x2742a3,_0xc0bd91){return db[_0x2c58('0x32')][_0x2c58('0x4e')]({'where':{'id':_0x2742a3[_0x2c58('0x48')]['id']}})[_0x2c58('0x2a')](function(_0x49ea44){if(_['isNil'](_0x49ea44)){throw new ReferenceError(_0x2c58('0x5d'));}return _0x49ea44;})[_0x2c58('0x2a')](function(_0x405560){var _0x4e2007=_0x405560[_0x2c58('0x51')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x4e2007);if(!_[_0x2c58('0x5e')](_0x405560[_0x2c58('0x51')])&&fs[_0x2c58('0x54')](_0x4e2007)){logger[_0x2c58('0x5f')]('File:\x20\x22'+_0x4e2007+_0x2c58('0x60'));fs['unlinkSync'](_0x4e2007);}_0x4e2007=_0x4e2007+_0x2c58('0x61');if(!_[_0x2c58('0x5e')](_0x405560[_0x2c58('0x51')])&&fs['existsSync'](_0x4e2007)){logger[_0x2c58('0x5f')]('File:\x20\x22'+_0x4e2007+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2c58('0x62')](_0x4e2007);}return _0x405560;})[_0x2c58('0x2a')](function(_0x56e672){if(!_0x56e672)throw new InternalError();return _0x56e672['destroy']();})[_0x2c58('0x2a')](function(){_0xc0bd91['status'](0xcc)[_0x2c58('0x1e')]();})[_0x2c58('0x47')](handleError(_0xc0bd91,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f8b688c..c62c041 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 _0x6d11=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','request-promise','path','./squareRecording.attributes'];(function(_0x50af6f,_0x450c1e){var _0xd19e78=function(_0x48cf64){while(--_0x48cf64){_0x50af6f['push'](_0x50af6f['shift']());}};_0xd19e78(++_0x450c1e);}(_0x6d11,0xbf));var _0x16d1=function(_0xcce014,_0x307d00){_0xcce014=_0xcce014-0x0;var _0x4c3ed0=_0x6d11[_0xcce014];return _0x4c3ed0;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9120=['exports','define','SquareRecording','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x4c9487,_0x146095){var _0x3e74f4=function(_0x47a587){while(--_0x47a587){_0x4c9487['push'](_0x4c9487['shift']());}};_0x3e74f4(++_0x146095);}(_0x9120,0x1b3));var _0x0912=function(_0x216fc3,_0x37551e){_0x216fc3=_0x216fc3-0x0;var _0x20afd2=_0x9120[_0x216fc3];return _0x20afd2;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var logger=require(_0x0912('0x2'))(_0x0912('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0912('0x4'));var fs=require('fs');var path=require(_0x0912('0x5'));var rimraf=require(_0x0912('0x6'));var config=require(_0x0912('0x7'));var attributes=require(_0x0912('0x8'));module[_0x0912('0x9')]=function(_0x4e7ddb,_0x42cb02){return _0x4e7ddb[_0x0912('0xa')](_0x0912('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index b26f98d..adaa3b8 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 _0x3290=['stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x56c198,_0x472668){var _0x45fbf8=function(_0x2a2c00){while(--_0x2a2c00){_0x56c198['push'](_0x56c198['shift']());}};_0x45fbf8(++_0x472668);}(_0x3290,0x1af));var _0x0329=function(_0x36cb9d,_0x224986){_0x36cb9d=_0x36cb9d-0x0;var _0x5e4baf=_0x3290[_0x36cb9d];return _0x5e4baf;};'use strict';var _=require(_0x0329('0x0'));var util=require(_0x0329('0x1'));var moment=require(_0x0329('0x2'));var BPromise=require('bluebird');var rs=require(_0x0329('0x3'));var fs=require('fs');var Redis=require(_0x0329('0x4'));var db=require(_0x0329('0x5'))['db'];var utils=require(_0x0329('0x6'));var logger=require(_0x0329('0x7'))(_0x0329('0x8'));var config=require(_0x0329('0x9'));var jayson=require(_0x0329('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb47f26,_0x4d1858,_0x1631f5){return new BPromise(function(_0x4bd0e9,_0x4fdb6e){return client[_0x0329('0xb')](_0xb47f26,_0x1631f5)[_0x0329('0xc')](function(_0x2fa689){logger[_0x0329('0xd')]('SquareRecording,\x20%s,\x20%s',_0x4d1858,'request\x20sent');logger[_0x0329('0xe')](_0x0329('0xf'),_0x4d1858,_0x0329('0x10'),JSON[_0x0329('0x11')](_0x2fa689));if(_0x2fa689[_0x0329('0x12')]){if(_0x2fa689[_0x0329('0x12')][_0x0329('0x13')]===0x1f4){logger[_0x0329('0x12')](_0x0329('0x14'),_0x4d1858,_0x2fa689[_0x0329('0x12')][_0x0329('0x15')]);return _0x4fdb6e(_0x2fa689[_0x0329('0x12')][_0x0329('0x15')]);}logger[_0x0329('0x12')](_0x0329('0x14'),_0x4d1858,_0x2fa689[_0x0329('0x12')]['message']);return _0x4bd0e9(_0x2fa689[_0x0329('0x12')][_0x0329('0x15')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x4d1858,'request\x20sent');_0x4bd0e9(_0x2fa689[_0x0329('0x16')][_0x0329('0x15')]);}})[_0x0329('0x17')](function(_0x38bb68){logger[_0x0329('0x12')](_0x0329('0x14'),_0x4d1858,_0x38bb68);_0x4fdb6e(_0x38bb68);});});}exports[_0x0329('0x18')]=function(_0x3f17c7){var _0x52f245=this;return new Promise(function(_0x1fef0a,_0x24848b){return db[_0x0329('0x19')][_0x0329('0x1a')](_0x3f17c7['body'],{'raw':_0x3f17c7[_0x0329('0x1b')]?_0x3f17c7[_0x0329('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1f1c88){logger[_0x0329('0xd')](_0x0329('0x18'),_0x3f17c7);logger[_0x0329('0xe')]('CreateSquareRecording',_0x3f17c7,JSON[_0x0329('0x11')](_0x1f1c88));_0x1fef0a(_0x1f1c88);})[_0x0329('0x17')](function(_0x286082){logger['error'](_0x0329('0x18'),_0x286082[_0x0329('0x15')],_0x3f17c7);_0x24848b(_0x52f245[_0x0329('0x12')](0x1f4,_0x286082['message']));});});}; \ No newline at end of file +var _0xdffb=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1b3756,_0x27137a){var _0x17d0cd=function(_0x285f54){while(--_0x285f54){_0x1b3756['push'](_0x1b3756['shift']());}};_0x17d0cd(++_0x27137a);}(_0xdffb,0xa9));var _0xbdff=function(_0x55462e,_0x565080){_0x55462e=_0x55462e-0x0;var _0x14ba48=_0xdffb[_0x55462e];return _0x14ba48;};'use strict';var _=require(_0xbdff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbdff('0x1'));var rs=require(_0xbdff('0x2'));var fs=require('fs');var Redis=require(_0xbdff('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbdff('0x4'));var config=require(_0xbdff('0x5'));var jayson=require(_0xbdff('0x6'));var client=jayson[_0xbdff('0x7')][_0xbdff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2654,_0x39edb5,_0x8e93cc){return new BPromise(function(_0x4d7898,_0x3c9910){return client[_0xbdff('0x9')](_0x1e2654,_0x8e93cc)[_0xbdff('0xa')](function(_0x223097){logger[_0xbdff('0xb')]('SquareRecording,\x20%s,\x20%s',_0x39edb5,_0xbdff('0xc'));logger[_0xbdff('0xd')](_0xbdff('0xe'),_0x39edb5,_0xbdff('0xc'),JSON[_0xbdff('0xf')](_0x223097));if(_0x223097[_0xbdff('0x10')]){if(_0x223097[_0xbdff('0x10')]['code']===0x1f4){logger[_0xbdff('0x10')](_0xbdff('0x11'),_0x39edb5,_0x223097[_0xbdff('0x10')][_0xbdff('0x12')]);return _0x3c9910(_0x223097[_0xbdff('0x10')][_0xbdff('0x12')]);}logger[_0xbdff('0x10')](_0xbdff('0x11'),_0x39edb5,_0x223097[_0xbdff('0x10')]['message']);return _0x4d7898(_0x223097[_0xbdff('0x10')]['message']);}else{logger[_0xbdff('0xb')]('SquareRecording,\x20%s,\x20%s',_0x39edb5,_0xbdff('0xc'));_0x4d7898(_0x223097[_0xbdff('0x13')]['message']);}})[_0xbdff('0x14')](function(_0x5b24a8){logger[_0xbdff('0x10')](_0xbdff('0x11'),_0x39edb5,_0x5b24a8);_0x3c9910(_0x5b24a8);});});}exports[_0xbdff('0x15')]=function(_0x286ff6){var _0x3723c7=this;return new Promise(function(_0x5d8d06,_0x23c54a){return db[_0xbdff('0x16')]['create'](_0x286ff6[_0xbdff('0x17')],{'raw':_0x286ff6['options']?_0x286ff6[_0xbdff('0x18')][_0xbdff('0x19')]===undefined?!![]:![]:!![]})[_0xbdff('0xa')](function(_0x56c439){logger[_0xbdff('0xb')](_0xbdff('0x15'),_0x286ff6);logger['debug']('CreateSquareRecording',_0x286ff6,JSON[_0xbdff('0xf')](_0x56c439));_0x5d8d06(_0x56c439);})[_0xbdff('0x14')](function(_0x3e2815){logger[_0xbdff('0x10')](_0xbdff('0x15'),_0x3e2815['message'],_0x286ff6);_0x23c54a(_0x3723c7['error'](0x1f4,_0x3e2815[_0xbdff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 601dd75..9f70c8c 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x59eb53,_0x2e3a50){var _0x743be6=function(_0x3b8c4f){while(--_0x3b8c4f){_0x59eb53['push'](_0x59eb53['shift']());}};_0x743be6(++_0x2e3a50);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=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(_0x5f36cd,_0x37d4c9){var _0x49832a=function(_0xa82985){while(--_0xa82985){_0x5f36cd['push'](_0x5f36cd['shift']());}};_0x49832a(++_0x37d4c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f6a9ea5..0826640 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 _0xd636=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1622fd,_0xf8101b){var _0xc3b5c2=function(_0x1ab584){while(--_0x1ab584){_0x1622fd['push'](_0x1622fd['shift']());}};_0xc3b5c2(++_0xf8101b);}(_0xd636,0xdc));var _0x6d63=function(_0x1c5924,_0x43b7ab){_0x1c5924=_0x1c5924-0x0;var _0x305f76=_0xd636[_0x1c5924];return _0x305f76;};'use strict';var Sequelize=require(_0x6d63('0x0'));module[_0x6d63('0x1')]={'network':{'type':Sequelize[_0x6d63('0x2')]},'network_script':{'type':Sequelize[_0x6d63('0x2')]},'request':{'type':Sequelize[_0x6d63('0x2')]},'channel':{'type':Sequelize[_0x6d63('0x2')]},'language':{'type':Sequelize[_0x6d63('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6d63('0x2')]},'version':{'type':Sequelize[_0x6d63('0x2')]},'callerid':{'type':Sequelize[_0x6d63('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x6d63('0x2')]},'dnid':{'type':Sequelize[_0x6d63('0x2')]},'rdnis':{'type':Sequelize[_0x6d63('0x2')]},'context':{'type':Sequelize[_0x6d63('0x2')]},'extension':{'type':Sequelize[_0x6d63('0x2')]},'priority':{'type':Sequelize[_0x6d63('0x2')]},'enhanced':{'type':Sequelize[_0x6d63('0x2')]},'accountcode':{'type':Sequelize[_0x6d63('0x2')]},'threadid':{'type':Sequelize[_0x6d63('0x2')]},'project_name':{'type':Sequelize[_0x6d63('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6d63('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd1f7=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0xd1f7,0xc0));var _0x7d1f=function(_0x39b7d8,_0xa44989){_0x39b7d8=_0x39b7d8-0x0;var _0x42d6dd=_0xd1f7[_0x39b7d8];return _0x42d6dd;};'use strict';var Sequelize=require(_0x7d1f('0x0'));module[_0x7d1f('0x1')]={'network':{'type':Sequelize[_0x7d1f('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x7d1f('0x2')]},'channel':{'type':Sequelize[_0x7d1f('0x2')]},'language':{'type':Sequelize[_0x7d1f('0x2')]},'type':{'type':Sequelize[_0x7d1f('0x2')]},'uniqueid':{'type':Sequelize[_0x7d1f('0x2')]},'version':{'type':Sequelize[_0x7d1f('0x2')]},'callerid':{'type':Sequelize[_0x7d1f('0x2')]},'calleridname':{'type':Sequelize[_0x7d1f('0x2')]},'callingpres':{'type':Sequelize[_0x7d1f('0x2')]},'callingani2':{'type':Sequelize[_0x7d1f('0x2')]},'callington':{'type':Sequelize[_0x7d1f('0x2')]},'callingtns':{'type':Sequelize[_0x7d1f('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x7d1f('0x2')]},'context':{'type':Sequelize[_0x7d1f('0x2')]},'extension':{'type':Sequelize[_0x7d1f('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x7d1f('0x2')]},'accountcode':{'type':Sequelize[_0x7d1f('0x2')]},'threadid':{'type':Sequelize[_0x7d1f('0x2')]},'project_name':{'type':Sequelize[_0x7d1f('0x2')]},'joinAt':{'type':Sequelize[_0x7d1f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x7d1f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 4dfccbb..a95d912 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 _0xd334=['fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes'];(function(_0x32d759,_0x1f234e){var _0x4e33b1=function(_0x476261){while(--_0x476261){_0x32d759['push'](_0x32d759['shift']());}};_0x4e33b1(++_0x1f234e);}(_0xd334,0x1a3));var _0x4d33=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xd334[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require(_0x4d33('0x0'));var rimraf=require(_0x4d33('0x1'));var zipdir=require(_0x4d33('0x2'));var jsonpatch=require(_0x4d33('0x3'));var rp=require(_0x4d33('0x4'));var moment=require(_0x4d33('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4d33('0x6'));var util=require(_0x4d33('0x7'));var path=require(_0x4d33('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d33('0x9'));var fs=require('fs');var fs_extra=require(_0x4d33('0xa'));var _=require(_0x4d33('0xb'));var squel=require(_0x4d33('0xc'));var crypto=require(_0x4d33('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d33('0xe'));var querystring=require(_0x4d33('0xf'));var Papa=require(_0x4d33('0x10'));var Redis=require(_0x4d33('0x11'));var authService=require(_0x4d33('0x12'));var qs=require(_0x4d33('0x13'));var as=require(_0x4d33('0x14'));var hardwareService=require(_0x4d33('0x15'));var logger=require(_0x4d33('0x16'))(_0x4d33('0x17'));var utils=require(_0x4d33('0x18'));var config=require(_0x4d33('0x19'));var licenseUtil=require(_0x4d33('0x1a'));var db=require(_0x4d33('0x1b'))['db'];function respondWithStatusCode(_0x2a549a,_0x57d94f){_0x57d94f=_0x57d94f||0xcc;return function(_0x3d1ec2){if(_0x3d1ec2){return _0x2a549a[_0x4d33('0x1c')](_0x57d94f);}return _0x2a549a[_0x4d33('0x1d')](_0x57d94f)[_0x4d33('0x1e')]();};}function respondWithResult(_0x553f3d,_0x8d455e){_0x8d455e=_0x8d455e||0xc8;return function(_0x4417f1){if(_0x4417f1){return _0x553f3d[_0x4d33('0x1d')](_0x8d455e)['json'](_0x4417f1);}};}function respondWithFilteredResult(_0x5fef95,_0x325899){return function(_0x15977b){if(_0x15977b){var _0x3b9323=typeof _0x325899[_0x4d33('0x1f')]===_0x4d33('0x20')&&typeof _0x325899[_0x4d33('0x21')]===_0x4d33('0x20');var _0x5e8a33=_0x15977b['count'];var _0x1dbfc3=_0x3b9323?0x0:_0x325899[_0x4d33('0x1f')];var _0x233262=_0x3b9323?_0x15977b[_0x4d33('0x22')]:_0x325899[_0x4d33('0x1f')]+_0x325899['limit'];var _0x32186b;if(_0x233262>=_0x5e8a33){_0x233262=_0x5e8a33;_0x32186b=0xc8;}else{_0x32186b=0xce;}_0x5fef95['status'](_0x32186b);return _0x5fef95[_0x4d33('0x23')]('Content-Range',_0x1dbfc3+'-'+_0x233262+'/'+_0x5e8a33)[_0x4d33('0x24')](_0x15977b);}return null;};}function patchUpdates(_0x4a85ef){return function(_0x95f5f0){try{jsonpatch['apply'](_0x95f5f0,_0x4a85ef,!![]);}catch(_0x3c1b62){return BPromise[_0x4d33('0x25')](_0x3c1b62);}return _0x95f5f0[_0x4d33('0x26')]();};}function saveUpdates(_0x31add3,_0x273a12){return function(_0x1aecb6){if(_0x1aecb6){return _0x1aecb6['update'](_0x31add3)[_0x4d33('0x27')](function(_0x35f35e){return _0x35f35e;});}return null;};}function removeEntity(_0x64a8af,_0xa5505d){return function(_0x41026c){if(_0x41026c){return _0x41026c[_0x4d33('0x28')]()[_0x4d33('0x27')](function(){_0x64a8af['status'](0xcc)[_0x4d33('0x1e')]();});}};}function handleEntityNotFound(_0x5d66cc,_0x587594){return function(_0x23e82a){if(!_0x23e82a){_0x5d66cc[_0x4d33('0x1c')](0x194);}return _0x23e82a;};}function handleError(_0x1bfe0f,_0x947b9b){_0x947b9b=_0x947b9b||0x1f4;return function(_0x569566){logger[_0x4d33('0x29')](_0x569566[_0x4d33('0x2a')]);if(_0x569566[_0x4d33('0x2b')]){delete _0x569566[_0x4d33('0x2b')];}_0x1bfe0f['status'](_0x947b9b)[_0x4d33('0x2c')](_0x569566);};}exports[_0x4d33('0x2d')]=function(_0x4c2c0c,_0x3ffa43){var _0xc2b19={},_0x30eb1f={},_0x299f71={'count':0x0,'rows':[]};var _0x26d39d=_[_0x4d33('0x2e')](db[_0x4d33('0x2f')][_0x4d33('0x30')],function(_0x40df1e){return{'name':_0x40df1e[_0x4d33('0x31')],'type':_0x40df1e[_0x4d33('0x32')][_0x4d33('0x33')]};});_0x30eb1f[_0x4d33('0x34')]=_['map'](_0x26d39d,_0x4d33('0x2b'));_0x30eb1f[_0x4d33('0x35')]=_[_0x4d33('0x36')](_0x4c2c0c[_0x4d33('0x35')]);_0x30eb1f[_0x4d33('0x37')]=_[_0x4d33('0x38')](_0x30eb1f[_0x4d33('0x34')],_0x30eb1f[_0x4d33('0x35')]);_0xc2b19[_0x4d33('0x39')]=_['intersection'](_0x30eb1f[_0x4d33('0x34')],qs['fields'](_0x4c2c0c[_0x4d33('0x35')]['fields']));_0xc2b19[_0x4d33('0x39')]=_0xc2b19[_0x4d33('0x39')]['length']?_0xc2b19[_0x4d33('0x39')]:_0x30eb1f[_0x4d33('0x34')];if(!_0x4c2c0c[_0x4d33('0x35')]['hasOwnProperty'](_0x4d33('0x3a'))){_0xc2b19[_0x4d33('0x21')]=qs[_0x4d33('0x21')](_0x4c2c0c['query'][_0x4d33('0x21')]);_0xc2b19[_0x4d33('0x1f')]=qs[_0x4d33('0x1f')](_0x4c2c0c[_0x4d33('0x35')]['offset']);}_0xc2b19[_0x4d33('0x3b')]=qs[_0x4d33('0x3c')](_0x4c2c0c[_0x4d33('0x35')]['sort']);_0xc2b19[_0x4d33('0x3d')]=qs[_0x4d33('0x37')](_['pick'](_0x4c2c0c[_0x4d33('0x35')],_0x30eb1f[_0x4d33('0x37')]),_0x26d39d);if(_0x4c2c0c[_0x4d33('0x35')][_0x4d33('0x3e')]){_0xc2b19['where']=_['merge'](_0xc2b19['where'],{'$or':_[_0x4d33('0x2e')](_0x26d39d,function(_0x236cc6){if(_0x236cc6[_0x4d33('0x32')]!==_0x4d33('0x3f')){var _0x3681c8={};_0x3681c8[_0x236cc6[_0x4d33('0x2b')]]={'$like':'%'+_0x4c2c0c[_0x4d33('0x35')]['filter']+'%'};return _0x3681c8;}})});}_0xc2b19=_[_0x4d33('0x40')]({},_0xc2b19,_0x4c2c0c[_0x4d33('0x41')]);var _0x451c02={'where':_0xc2b19['where']};return db[_0x4d33('0x2f')][_0x4d33('0x22')](_0x451c02)['then'](function(_0x13ed90){_0x299f71[_0x4d33('0x22')]=_0x13ed90;if(_0x4c2c0c['query'][_0x4d33('0x42')]){_0xc2b19[_0x4d33('0x43')]=[{'all':!![]}];}return db[_0x4d33('0x2f')][_0x4d33('0x44')](_0xc2b19);})['then'](function(_0x193213){_0x299f71[_0x4d33('0x45')]=_0x193213;return _0x299f71;})[_0x4d33('0x27')](respondWithFilteredResult(_0x3ffa43,_0xc2b19))[_0x4d33('0x46')](handleError(_0x3ffa43,null));};exports['show']=function(_0x367b90,_0x2ec248){var _0x7f8a79={'raw':!![],'where':{'id':_0x367b90[_0x4d33('0x47')]['id']}},_0xc24237={};_0xc24237[_0x4d33('0x34')]=_['keys'](db[_0x4d33('0x2f')][_0x4d33('0x30')]);_0xc24237['query']=_[_0x4d33('0x36')](_0x367b90[_0x4d33('0x35')]);_0xc24237[_0x4d33('0x37')]=_[_0x4d33('0x38')](_0xc24237[_0x4d33('0x34')],_0xc24237[_0x4d33('0x35')]);_0x7f8a79['attributes']=_['intersection'](_0xc24237[_0x4d33('0x34')],qs['fields'](_0x367b90[_0x4d33('0x35')][_0x4d33('0x48')]));_0x7f8a79['attributes']=_0x7f8a79['attributes']['length']?_0x7f8a79[_0x4d33('0x39')]:_0xc24237[_0x4d33('0x34')];if(_0x367b90['query'][_0x4d33('0x42')]){_0x7f8a79[_0x4d33('0x43')]=[{'all':!![]}];}_0x7f8a79=_['merge']({},_0x7f8a79,_0x367b90['options']);return db[_0x4d33('0x2f')][_0x4d33('0x49')](_0x7f8a79)[_0x4d33('0x27')](handleEntityNotFound(_0x2ec248,null))[_0x4d33('0x27')](respondWithResult(_0x2ec248,null))[_0x4d33('0x46')](handleError(_0x2ec248,null));};exports['create']=function(_0x430b7f,_0x43305b){return db[_0x4d33('0x2f')][_0x4d33('0x4a')](_0x430b7f[_0x4d33('0x4b')],{})[_0x4d33('0x27')](respondWithResult(_0x43305b,0xc9))['catch'](handleError(_0x43305b,null));};exports[_0x4d33('0x4c')]=function(_0x3e2426,_0x269eba){if(_0x3e2426['body']['id']){delete _0x3e2426[_0x4d33('0x4b')]['id'];}return db[_0x4d33('0x2f')][_0x4d33('0x49')]({'where':{'id':_0x3e2426[_0x4d33('0x47')]['id']}})['then'](handleEntityNotFound(_0x269eba,null))['then'](saveUpdates(_0x3e2426[_0x4d33('0x4b')],null))['then'](respondWithResult(_0x269eba,null))[_0x4d33('0x46')](handleError(_0x269eba,null));};exports[_0x4d33('0x28')]=function(_0x56fc58,_0x5eadb3){return db[_0x4d33('0x2f')]['find']({'where':{'id':_0x56fc58[_0x4d33('0x47')]['id']}})[_0x4d33('0x27')](handleEntityNotFound(_0x5eadb3,null))[_0x4d33('0x27')](removeEntity(_0x5eadb3,null))[_0x4d33('0x46')](handleError(_0x5eadb3,null));};exports[_0x4d33('0x4d')]=function(_0x4defd3,_0x611441){return db['SquareReport'][_0x4d33('0x4d')]()[_0x4d33('0x27')](respondWithResult(_0x611441,null))[_0x4d33('0x46')](handleError(_0x611441,null));}; \ No newline at end of file +var _0x6951=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','apply','reject','update','then','destroy','send','SquareReport','rawAttributes','fieldName','type','key','map','name','keys','query','filters','intersection','attributes','model','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','fields','length','includeAll','find','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x56f228,_0x1478f3){var _0x371854=function(_0x2e6336){while(--_0x2e6336){_0x56f228['push'](_0x56f228['shift']());}};_0x371854(++_0x1478f3);}(_0x6951,0x10e));var _0x1695=function(_0x3d8e8b,_0x123038){_0x3d8e8b=_0x3d8e8b-0x0;var _0x3c7a95=_0x6951[_0x3d8e8b];return _0x3c7a95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1695('0x0'));var zipdir=require(_0x1695('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1695('0x2'));var moment=require(_0x1695('0x3'));var BPromise=require(_0x1695('0x4'));var Mustache=require('mustache');var util=require(_0x1695('0x5'));var path=require(_0x1695('0x6'));var sox=require(_0x1695('0x7'));var csv=require(_0x1695('0x8'));var ejs=require(_0x1695('0x9'));var fs=require('fs');var fs_extra=require(_0x1695('0xa'));var _=require(_0x1695('0xb'));var squel=require(_0x1695('0xc'));var crypto=require('crypto');var jsforce=require(_0x1695('0xd'));var deskjs=require(_0x1695('0xe'));var toCsv=require(_0x1695('0x8'));var querystring=require(_0x1695('0xf'));var Papa=require(_0x1695('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1695('0x11'));var as=require(_0x1695('0x12'));var hardwareService=require(_0x1695('0x13'));var logger=require(_0x1695('0x14'))(_0x1695('0x15'));var utils=require(_0x1695('0x16'));var config=require(_0x1695('0x17'));var licenseUtil=require(_0x1695('0x18'));var db=require(_0x1695('0x19'))['db'];function respondWithStatusCode(_0x1240ca,_0x1bbea2){_0x1bbea2=_0x1bbea2||0xcc;return function(_0x384e87){if(_0x384e87){return _0x1240ca[_0x1695('0x1a')](_0x1bbea2);}return _0x1240ca[_0x1695('0x1b')](_0x1bbea2)['end']();};}function respondWithResult(_0x3c2094,_0x289962){_0x289962=_0x289962||0xc8;return function(_0x11efcc){if(_0x11efcc){return _0x3c2094[_0x1695('0x1b')](_0x289962)[_0x1695('0x1c')](_0x11efcc);}};}function respondWithFilteredResult(_0x4d25b1,_0x1c12e7){return function(_0xee15b4){if(_0xee15b4){var _0x420b17=typeof _0x1c12e7['offset']==='undefined'&&typeof _0x1c12e7['limit']===_0x1695('0x1d');var _0x596573=_0xee15b4['count'];var _0x30d099=_0x420b17?0x0:_0x1c12e7[_0x1695('0x1e')];var _0x305ceb=_0x420b17?_0xee15b4['count']:_0x1c12e7[_0x1695('0x1e')]+_0x1c12e7['limit'];var _0x544a09;if(_0x305ceb>=_0x596573){_0x305ceb=_0x596573;_0x544a09=0xc8;}else{_0x544a09=0xce;}_0x4d25b1[_0x1695('0x1b')](_0x544a09);return _0x4d25b1['set']('Content-Range',_0x30d099+'-'+_0x305ceb+'/'+_0x596573)['json'](_0xee15b4);}return null;};}function patchUpdates(_0x5a2c21){return function(_0x5eac79){try{jsonpatch[_0x1695('0x1f')](_0x5eac79,_0x5a2c21,!![]);}catch(_0x209101){return BPromise[_0x1695('0x20')](_0x209101);}return _0x5eac79['save']();};}function saveUpdates(_0x6842c7,_0x84a6aa){return function(_0x4a6153){if(_0x4a6153){return _0x4a6153[_0x1695('0x21')](_0x6842c7)[_0x1695('0x22')](function(_0x4cf8b1){return _0x4cf8b1;});}return null;};}function removeEntity(_0x28e4c3,_0x3bab32){return function(_0x51b479){if(_0x51b479){return _0x51b479[_0x1695('0x23')]()['then'](function(){_0x28e4c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f00c,_0x47eba4){return function(_0x4f9c22){if(!_0x4f9c22){_0x18f00c['sendStatus'](0x194);}return _0x4f9c22;};}function handleError(_0x28e05b,_0x64cc40){_0x64cc40=_0x64cc40||0x1f4;return function(_0x9963c7){logger['error'](_0x9963c7['stack']);if(_0x9963c7['name']){delete _0x9963c7['name'];}_0x28e05b[_0x1695('0x1b')](_0x64cc40)[_0x1695('0x24')](_0x9963c7);};}exports['index']=function(_0x16e7cc,_0x441d5e){var _0x57100c={},_0x569592={},_0x579156={'count':0x0,'rows':[]};var _0x17071=_['map'](db[_0x1695('0x25')][_0x1695('0x26')],function(_0x47f195){return{'name':_0x47f195[_0x1695('0x27')],'type':_0x47f195[_0x1695('0x28')][_0x1695('0x29')]};});_0x569592['model']=_[_0x1695('0x2a')](_0x17071,_0x1695('0x2b'));_0x569592['query']=_[_0x1695('0x2c')](_0x16e7cc[_0x1695('0x2d')]);_0x569592[_0x1695('0x2e')]=_[_0x1695('0x2f')](_0x569592['model'],_0x569592[_0x1695('0x2d')]);_0x57100c[_0x1695('0x30')]=_[_0x1695('0x2f')](_0x569592[_0x1695('0x31')],qs['fields'](_0x16e7cc[_0x1695('0x2d')]['fields']));_0x57100c[_0x1695('0x30')]=_0x57100c[_0x1695('0x30')]['length']?_0x57100c[_0x1695('0x30')]:_0x569592[_0x1695('0x31')];if(!_0x16e7cc[_0x1695('0x2d')][_0x1695('0x32')](_0x1695('0x33'))){_0x57100c[_0x1695('0x34')]=qs['limit'](_0x16e7cc[_0x1695('0x2d')][_0x1695('0x34')]);_0x57100c['offset']=qs[_0x1695('0x1e')](_0x16e7cc[_0x1695('0x2d')][_0x1695('0x1e')]);}_0x57100c['order']=qs[_0x1695('0x35')](_0x16e7cc[_0x1695('0x2d')][_0x1695('0x35')]);_0x57100c['where']=qs[_0x1695('0x2e')](_[_0x1695('0x36')](_0x16e7cc[_0x1695('0x2d')],_0x569592[_0x1695('0x2e')]),_0x17071);if(_0x16e7cc['query'][_0x1695('0x37')]){_0x57100c[_0x1695('0x38')]=_[_0x1695('0x39')](_0x57100c[_0x1695('0x38')],{'$or':_[_0x1695('0x2a')](_0x17071,function(_0xe794a0){if(_0xe794a0[_0x1695('0x28')]!==_0x1695('0x3a')){var _0x3805a5={};_0x3805a5[_0xe794a0[_0x1695('0x2b')]]={'$like':'%'+_0x16e7cc[_0x1695('0x2d')]['filter']+'%'};return _0x3805a5;}})});}_0x57100c=_['merge']({},_0x57100c,_0x16e7cc[_0x1695('0x3b')]);var _0x459c08={'where':_0x57100c[_0x1695('0x38')]};return db['SquareReport']['count'](_0x459c08)[_0x1695('0x22')](function(_0xf5dccf){_0x579156[_0x1695('0x3c')]=_0xf5dccf;if(_0x16e7cc[_0x1695('0x2d')]['includeAll']){_0x57100c[_0x1695('0x3d')]=[{'all':!![]}];}return db[_0x1695('0x25')][_0x1695('0x3e')](_0x57100c);})[_0x1695('0x22')](function(_0x4d81f2){_0x579156[_0x1695('0x3f')]=_0x4d81f2;return _0x579156;})[_0x1695('0x22')](respondWithFilteredResult(_0x441d5e,_0x57100c))[_0x1695('0x40')](handleError(_0x441d5e,null));};exports[_0x1695('0x41')]=function(_0x241251,_0x1c301b){var _0x5a9b46={'raw':!![],'where':{'id':_0x241251[_0x1695('0x42')]['id']}},_0x1c73a0={};_0x1c73a0[_0x1695('0x31')]=_['keys'](db['SquareReport'][_0x1695('0x26')]);_0x1c73a0['query']=_[_0x1695('0x2c')](_0x241251[_0x1695('0x2d')]);_0x1c73a0[_0x1695('0x2e')]=_['intersection'](_0x1c73a0['model'],_0x1c73a0['query']);_0x5a9b46[_0x1695('0x30')]=_[_0x1695('0x2f')](_0x1c73a0['model'],qs[_0x1695('0x43')](_0x241251[_0x1695('0x2d')][_0x1695('0x43')]));_0x5a9b46[_0x1695('0x30')]=_0x5a9b46['attributes'][_0x1695('0x44')]?_0x5a9b46[_0x1695('0x30')]:_0x1c73a0[_0x1695('0x31')];if(_0x241251[_0x1695('0x2d')][_0x1695('0x45')]){_0x5a9b46['include']=[{'all':!![]}];}_0x5a9b46=_[_0x1695('0x39')]({},_0x5a9b46,_0x241251[_0x1695('0x3b')]);return db[_0x1695('0x25')][_0x1695('0x46')](_0x5a9b46)['then'](handleEntityNotFound(_0x1c301b,null))['then'](respondWithResult(_0x1c301b,null))[_0x1695('0x40')](handleError(_0x1c301b,null));};exports['create']=function(_0xd1c454,_0x590ac2){return db[_0x1695('0x25')]['create'](_0xd1c454[_0x1695('0x47')],{})[_0x1695('0x22')](respondWithResult(_0x590ac2,0xc9))[_0x1695('0x40')](handleError(_0x590ac2,null));};exports[_0x1695('0x21')]=function(_0x2855b4,_0x983364){if(_0x2855b4['body']['id']){delete _0x2855b4[_0x1695('0x47')]['id'];}return db[_0x1695('0x25')]['find']({'where':{'id':_0x2855b4[_0x1695('0x42')]['id']}})[_0x1695('0x22')](handleEntityNotFound(_0x983364,null))[_0x1695('0x22')](saveUpdates(_0x2855b4[_0x1695('0x47')],null))[_0x1695('0x22')](respondWithResult(_0x983364,null))[_0x1695('0x40')](handleError(_0x983364,null));};exports[_0x1695('0x23')]=function(_0x4b615f,_0x46be34){return db[_0x1695('0x25')][_0x1695('0x46')]({'where':{'id':_0x4b615f[_0x1695('0x42')]['id']}})[_0x1695('0x22')](handleEntityNotFound(_0x46be34,null))[_0x1695('0x22')](removeEntity(_0x46be34,null))[_0x1695('0x40')](handleError(_0x46be34,null));};exports[_0x1695('0x48')]=function(_0x14379a,_0x2162dd){return db[_0x1695('0x25')]['describe']()['then'](respondWithResult(_0x2162dd,null))['catch'](handleError(_0x2162dd,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e30fbc4..35ea1a3 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 _0x48d9=['path','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29076d,_0x237877){var _0x27c0d6=function(_0x5bad7d){while(--_0x5bad7d){_0x29076d['push'](_0x29076d['shift']());}};_0x27c0d6(++_0x237877);}(_0x48d9,0x165));var _0x948d=function(_0x4a453a,_0x498fa6){_0x4a453a=_0x4a453a-0x0;var _0x23be87=_0x48d9[_0x4a453a];return _0x23be87;};'use strict';var _=require(_0x948d('0x0'));var util=require(_0x948d('0x1'));var logger=require(_0x948d('0x2'))(_0x948d('0x3'));var moment=require(_0x948d('0x4'));var BPromise=require(_0x948d('0x5'));var rp=require(_0x948d('0x6'));var fs=require('fs');var path=require(_0x948d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x948d('0x8')]=function(_0x20f648,_0x1a945f){return _0x20f648['define'](_0x948d('0x9'),attributes,{'tableName':_0x948d('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x948d('0xb'),_0x948d('0xc')]},{'name':_0x948d('0xd'),'fields':[_0x948d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c67=['uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x1ea6a0,_0x2c04c8){var _0x1e4278=function(_0x13906f){while(--_0x13906f){_0x1ea6a0['push'](_0x1ea6a0['shift']());}};_0x1e4278(++_0x2c04c8);}(_0x8c67,0x178));var _0x78c6=function(_0x44ed9d,_0x293914){_0x44ed9d=_0x44ed9d-0x0;var _0x5f7446=_0x8c67[_0x44ed9d];return _0x5f7446;};'use strict';var _=require(_0x78c6('0x0'));var util=require(_0x78c6('0x1'));var logger=require(_0x78c6('0x2'))(_0x78c6('0x3'));var moment=require(_0x78c6('0x4'));var BPromise=require(_0x78c6('0x5'));var rp=require(_0x78c6('0x6'));var fs=require('fs');var path=require(_0x78c6('0x7'));var rimraf=require(_0x78c6('0x8'));var config=require('../../config/environment');var attributes=require(_0x78c6('0x9'));module[_0x78c6('0xa')]=function(_0x1f1187,_0x40ee17){return _0x1f1187[_0x78c6('0xb')](_0x78c6('0xc'),attributes,{'tableName':_0x78c6('0xd'),'paranoid':![],'indexes':[{'name':_0x78c6('0xe'),'fields':[_0x78c6('0xf'),'project_name']},{'name':_0x78c6('0x10'),'fields':[_0x78c6('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index fbc3709..a46c819 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 _0xb37c=['CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x30e176,_0x2ad448){var _0x56f9d1=function(_0x3062e9){while(--_0x3062e9){_0x30e176['push'](_0x30e176['shift']());}};_0x56f9d1(++_0x2ad448);}(_0xb37c,0xb6));var _0xcb37=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xb37c[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xcb37('0x0'));var util=require(_0xcb37('0x1'));var moment=require(_0xcb37('0x2'));var BPromise=require(_0xcb37('0x3'));var rs=require(_0xcb37('0x4'));var fs=require('fs');var Redis=require(_0xcb37('0x5'));var db=require(_0xcb37('0x6'))['db'];var utils=require(_0xcb37('0x7'));var logger=require(_0xcb37('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb37('0x9'));var client=jayson[_0xcb37('0xa')][_0xcb37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b15fb,_0xc6c5e3,_0x78d709){return new BPromise(function(_0xea6053,_0x3649ed){return client[_0xcb37('0xc')](_0x2b15fb,_0x78d709)[_0xcb37('0xd')](function(_0x5e04c2){logger[_0xcb37('0xe')](_0xcb37('0xf'),_0xc6c5e3,'request\x20sent');logger[_0xcb37('0x10')](_0xcb37('0x11'),_0xc6c5e3,_0xcb37('0x12'),JSON[_0xcb37('0x13')](_0x5e04c2));if(_0x5e04c2[_0xcb37('0x14')]){if(_0x5e04c2['error']['code']===0x1f4){logger[_0xcb37('0x14')]('SquareReport,\x20%s,\x20%s',_0xc6c5e3,_0x5e04c2[_0xcb37('0x14')][_0xcb37('0x15')]);return _0x3649ed(_0x5e04c2['error']['message']);}logger[_0xcb37('0x14')](_0xcb37('0xf'),_0xc6c5e3,_0x5e04c2['error'][_0xcb37('0x15')]);return _0xea6053(_0x5e04c2[_0xcb37('0x14')][_0xcb37('0x15')]);}else{logger['info'](_0xcb37('0xf'),_0xc6c5e3,'request\x20sent');_0xea6053(_0x5e04c2['result']['message']);}})['catch'](function(_0x4eb17e){logger[_0xcb37('0x14')](_0xcb37('0xf'),_0xc6c5e3,_0x4eb17e);_0x3649ed(_0x4eb17e);});});}exports[_0xcb37('0x16')]=function(_0x1e952d){var _0xbd81b5=this;return new Promise(function(_0x24c55b,_0x43c1a3){return db[_0xcb37('0x17')][_0xcb37('0x18')](_0x1e952d[_0xcb37('0x19')],{'raw':_0x1e952d['options']?_0x1e952d[_0xcb37('0x1a')][_0xcb37('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xe24294){logger['info'](_0xcb37('0x16'),_0x1e952d);logger['debug']('CreateSquareReport',_0x1e952d,JSON[_0xcb37('0x13')](_0xe24294));_0x24c55b(_0xe24294);})[_0xcb37('0x1c')](function(_0x3e9da5){logger[_0xcb37('0x14')](_0xcb37('0x16'),_0x3e9da5['message'],_0x1e952d);_0x43c1a3(_0xbd81b5[_0xcb37('0x14')](0x1f4,_0x3e9da5[_0xcb37('0x15')]));});});};exports[_0xcb37('0x1d')]=function(_0xed4308){var _0x414f90=this;return new Promise(function(_0x3e09a3,_0x372b51){return db[_0xcb37('0x17')][_0xcb37('0x1e')](_0xed4308[_0xcb37('0x19')],{'raw':_0xed4308[_0xcb37('0x1a')]?_0xed4308[_0xcb37('0x1a')][_0xcb37('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xed4308[_0xcb37('0x1a')]?_0xed4308['options'][_0xcb37('0x1f')]||null:null,'attributes':_0xed4308[_0xcb37('0x1a')]?_0xed4308[_0xcb37('0x1a')][_0xcb37('0x20')]||null:null,'limit':_0xed4308[_0xcb37('0x1a')]?_0xed4308[_0xcb37('0x1a')][_0xcb37('0x21')]||null:null})[_0xcb37('0xd')](function(_0x38f08e){logger[_0xcb37('0xe')]('UpdateSquareReport',_0xed4308);logger[_0xcb37('0x10')](_0xcb37('0x1d'),_0xed4308,JSON['stringify'](_0x38f08e));_0x3e09a3(_0x38f08e);})['catch'](function(_0x4f2fe9){logger[_0xcb37('0x14')](_0xcb37('0x1d'),_0x4f2fe9[_0xcb37('0x15')],_0xed4308);_0x372b51(_0x414f90[_0xcb37('0x14')](0x1f4,_0x4f2fe9[_0xcb37('0x15')]));});});}; \ No newline at end of file +var _0xb525=['info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','body','options','then','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','moment','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1bf752,_0x143efc){var _0x4dfcfc=function(_0x192ee9){while(--_0x192ee9){_0x1bf752['push'](_0x1bf752['shift']());}};_0x4dfcfc(++_0x143efc);}(_0xb525,0x17d));var _0x5b52=function(_0x13d9ef,_0x16905f){_0x13d9ef=_0x13d9ef-0x0;var _0x288182=_0xb525[_0x13d9ef];return _0x288182;};'use strict';var _=require(_0x5b52('0x0'));var util=require(_0x5b52('0x1'));var moment=require(_0x5b52('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b52('0x3'))(_0x5b52('0x4'));var config=require(_0x5b52('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5b52('0x6')][_0x5b52('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x559faa,_0x2ece05,_0x3acb33){return new BPromise(function(_0x2bc56c,_0x442483){return client[_0x5b52('0x8')](_0x559faa,_0x3acb33)['then'](function(_0x33c6b7){logger[_0x5b52('0x9')]('SquareReport,\x20%s,\x20%s',_0x2ece05,_0x5b52('0xa'));logger[_0x5b52('0xb')](_0x5b52('0xc'),_0x2ece05,_0x5b52('0xa'),JSON[_0x5b52('0xd')](_0x33c6b7));if(_0x33c6b7['error']){if(_0x33c6b7['error'][_0x5b52('0xe')]===0x1f4){logger[_0x5b52('0xf')]('SquareReport,\x20%s,\x20%s',_0x2ece05,_0x33c6b7[_0x5b52('0xf')]['message']);return _0x442483(_0x33c6b7['error'][_0x5b52('0x10')]);}logger[_0x5b52('0xf')](_0x5b52('0x11'),_0x2ece05,_0x33c6b7[_0x5b52('0xf')]['message']);return _0x2bc56c(_0x33c6b7[_0x5b52('0xf')][_0x5b52('0x10')]);}else{logger[_0x5b52('0x9')](_0x5b52('0x11'),_0x2ece05,_0x5b52('0xa'));_0x2bc56c(_0x33c6b7[_0x5b52('0x12')]['message']);}})[_0x5b52('0x13')](function(_0xe6c367){logger[_0x5b52('0xf')](_0x5b52('0x11'),_0x2ece05,_0xe6c367);_0x442483(_0xe6c367);});});}exports[_0x5b52('0x14')]=function(_0x49cf35){var _0x5995d3=this;return new Promise(function(_0x57958b,_0x24a213){return db['SquareReport']['create'](_0x49cf35[_0x5b52('0x15')],{'raw':_0x49cf35[_0x5b52('0x16')]?_0x49cf35['options']['raw']===undefined?!![]:![]:!![]})[_0x5b52('0x17')](function(_0x10ae37){logger[_0x5b52('0x9')]('CreateSquareReport',_0x49cf35);logger[_0x5b52('0xb')]('CreateSquareReport',_0x49cf35,JSON['stringify'](_0x10ae37));_0x57958b(_0x10ae37);})['catch'](function(_0x3da3c9){logger[_0x5b52('0xf')](_0x5b52('0x14'),_0x3da3c9[_0x5b52('0x10')],_0x49cf35);_0x24a213(_0x5995d3[_0x5b52('0xf')](0x1f4,_0x3da3c9[_0x5b52('0x10')]));});});};exports[_0x5b52('0x18')]=function(_0x215496){var _0x12295f=this;return new Promise(function(_0x28c439,_0x4bb5ef){return db['SquareReport'][_0x5b52('0x19')](_0x215496['body'],{'raw':_0x215496[_0x5b52('0x16')]?_0x215496[_0x5b52('0x16')][_0x5b52('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x215496[_0x5b52('0x16')]?_0x215496[_0x5b52('0x16')][_0x5b52('0x1b')]||null:null,'attributes':_0x215496['options']?_0x215496[_0x5b52('0x16')][_0x5b52('0x1c')]||null:null,'limit':_0x215496[_0x5b52('0x16')]?_0x215496['options'][_0x5b52('0x1d')]||null:null})[_0x5b52('0x17')](function(_0x45eb51){logger[_0x5b52('0x9')]('UpdateSquareReport',_0x215496);logger[_0x5b52('0xb')](_0x5b52('0x18'),_0x215496,JSON[_0x5b52('0xd')](_0x45eb51));_0x28c439(_0x45eb51);})['catch'](function(_0x5cd12c){logger['error'](_0x5b52('0x18'),_0x5cd12c[_0x5b52('0x10')],_0x215496);_0x4bb5ef(_0x12295f['error'](0x1f4,_0x5cd12c[_0x5b52('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index aadbb6d..c2546b5 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 _0x4747=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x4747,0x161));var _0x7474=function(_0x5e3396,_0x205213){_0x5e3396=_0x5e3396-0x0;var _0x3c418a=_0x4747[_0x5e3396];return _0x3c418a;};'use strict';var multer=require(_0x7474('0x0'));var util=require(_0x7474('0x1'));var path=require('path');var timeout=require(_0x7474('0x2'));var express=require(_0x7474('0x3'));var router=express['Router']();var fs_extra=require(_0x7474('0x4'));var auth=require(_0x7474('0x5'));var interaction=require(_0x7474('0x6'));var config=require(_0x7474('0x7'));var controller=require(_0x7474('0x8'));router[_0x7474('0x9')]('/',auth[_0x7474('0xa')](),controller[_0x7474('0xb')]);router[_0x7474('0x9')](_0x7474('0xc'),auth[_0x7474('0xa')](),controller[_0x7474('0xd')]);router['get']('/:id',auth[_0x7474('0xa')](),controller[_0x7474('0xe')]);router['post']('/',auth[_0x7474('0xa')](),controller[_0x7474('0xf')]);router[_0x7474('0x10')](_0x7474('0x11'),auth[_0x7474('0xa')](),controller[_0x7474('0x12')]);router[_0x7474('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7474('0x14')]);module[_0x7474('0x15')]=router; \ No newline at end of file +var _0x3c6b=['express','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','exports','path','connect-timeout'];(function(_0x319e5a,_0x26266b){var _0x92cb0b=function(_0x5aff7d){while(--_0x5aff7d){_0x319e5a['push'](_0x319e5a['shift']());}};_0x92cb0b(++_0x26266b);}(_0x3c6b,0xe8));var _0xb3c6=function(_0x4f47c9,_0x238f1a){_0x4f47c9=_0x4f47c9-0x0;var _0x334286=_0x3c6b[_0x4f47c9];return _0x334286;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3c6('0x0'));var timeout=require(_0xb3c6('0x1'));var express=require(_0xb3c6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb3c6('0x3'));var config=require(_0xb3c6('0x4'));var controller=require(_0xb3c6('0x5'));router['get']('/',auth[_0xb3c6('0x6')](),controller[_0xb3c6('0x7')]);router[_0xb3c6('0x8')](_0xb3c6('0x9'),auth[_0xb3c6('0x6')](),controller[_0xb3c6('0xa')]);router[_0xb3c6('0x8')](_0xb3c6('0xb'),auth[_0xb3c6('0x6')](),controller['show']);router[_0xb3c6('0xc')]('/',auth[_0xb3c6('0x6')](),controller[_0xb3c6('0xd')]);router[_0xb3c6('0xe')]('/:id',auth[_0xb3c6('0x6')](),controller[_0xb3c6('0xf')]);router[_0xb3c6('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb3c6('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 66528f9..362b0b7 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 _0x426b=['sequelize','exports','STRING','TEXT'];(function(_0x158a03,_0x1f4dd8){var _0x141efe=function(_0x13cf36){while(--_0x13cf36){_0x158a03['push'](_0x158a03['shift']());}};_0x141efe(++_0x1f4dd8);}(_0x426b,0x1d8));var _0xb426=function(_0x49eb06,_0x47d2b6){_0x49eb06=_0x49eb06-0x0;var _0x4b8d67=_0x426b[_0x49eb06];return _0x4b8d67;};'use strict';var Sequelize=require(_0xb426('0x0'));module[_0xb426('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xb426('0x2')]},'application':{'type':Sequelize[_0xb426('0x2')]},'data':{'type':Sequelize[_0xb426('0x3')]},'project_name':{'type':Sequelize[_0xb426('0x2')]},'callerid':{'type':Sequelize[_0xb426('0x2')]}}; \ No newline at end of file +var _0x2fc0=['TEXT','sequelize','STRING'];(function(_0x18928c,_0x575f3e){var _0x1de44c=function(_0x42bcd4){while(--_0x42bcd4){_0x18928c['push'](_0x18928c['shift']());}};_0x1de44c(++_0x575f3e);}(_0x2fc0,0x1b1));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x02fc('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x02fc('0x1')]},'application':{'type':Sequelize[_0x02fc('0x1')]},'data':{'type':Sequelize[_0x02fc('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1e13bf3..59d8bd0 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 _0x4bdc=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bdc,0x199));var _0xc4bd=function(_0x249959,_0x349d8a){_0x249959=_0x249959-0x0;var _0x327adb=_0x4bdc[_0x249959];return _0x327adb;};'use strict';var emlformat=require(_0xc4bd('0x0'));var rimraf=require(_0xc4bd('0x1'));var zipdir=require(_0xc4bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4bd('0x3'));var moment=require(_0xc4bd('0x4'));var BPromise=require(_0xc4bd('0x5'));var Mustache=require('mustache');var util=require(_0xc4bd('0x6'));var path=require(_0xc4bd('0x7'));var sox=require(_0xc4bd('0x8'));var csv=require(_0xc4bd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4bd('0xa'));var squel=require(_0xc4bd('0xb'));var crypto=require(_0xc4bd('0xc'));var jsforce=require(_0xc4bd('0xd'));var deskjs=require(_0xc4bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc4bd('0xf'));var Papa=require(_0xc4bd('0x10'));var Redis=require(_0xc4bd('0x11'));var authService=require(_0xc4bd('0x12'));var qs=require(_0xc4bd('0x13'));var as=require(_0xc4bd('0x14'));var hardwareService=require(_0xc4bd('0x15'));var logger=require('../../config/logger')(_0xc4bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4bd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeeea9f,_0x3f8678){_0x3f8678=_0x3f8678||0xcc;return function(_0x197dd7){if(_0x197dd7){return _0xeeea9f['sendStatus'](_0x3f8678);}return _0xeeea9f[_0xc4bd('0x18')](_0x3f8678)[_0xc4bd('0x19')]();};}function respondWithResult(_0x4c3722,_0x2f9145){_0x2f9145=_0x2f9145||0xc8;return function(_0x24a947){if(_0x24a947){return _0x4c3722[_0xc4bd('0x18')](_0x2f9145)[_0xc4bd('0x1a')](_0x24a947);}};}function respondWithFilteredResult(_0x5cf57d,_0x2f8406){return function(_0xd6514a){if(_0xd6514a){var _0x409f68=typeof _0x2f8406[_0xc4bd('0x1b')]===_0xc4bd('0x1c')&&typeof _0x2f8406[_0xc4bd('0x1d')]==='undefined';var _0x51705c=_0xd6514a[_0xc4bd('0x1e')];var _0x358e39=_0x409f68?0x0:_0x2f8406['offset'];var _0x3139d4=_0x409f68?_0xd6514a['count']:_0x2f8406[_0xc4bd('0x1b')]+_0x2f8406[_0xc4bd('0x1d')];var _0x1c382c;if(_0x3139d4>=_0x51705c){_0x3139d4=_0x51705c;_0x1c382c=0xc8;}else{_0x1c382c=0xce;}_0x5cf57d['status'](_0x1c382c);return _0x5cf57d[_0xc4bd('0x1f')]('Content-Range',_0x358e39+'-'+_0x3139d4+'/'+_0x51705c)[_0xc4bd('0x1a')](_0xd6514a);}return null;};}function patchUpdates(_0xc41902){return function(_0x3766ed){try{jsonpatch[_0xc4bd('0x20')](_0x3766ed,_0xc41902,!![]);}catch(_0xf48b77){return BPromise[_0xc4bd('0x21')](_0xf48b77);}return _0x3766ed[_0xc4bd('0x22')]();};}function saveUpdates(_0x23e68a,_0x4e3d09){return function(_0x3eb2cf){if(_0x3eb2cf){return _0x3eb2cf[_0xc4bd('0x23')](_0x23e68a)[_0xc4bd('0x24')](function(_0x3d8028){return _0x3d8028;});}return null;};}function removeEntity(_0x58d9c2,_0x3fc653){return function(_0x88ca0b){if(_0x88ca0b){return _0x88ca0b[_0xc4bd('0x25')]()[_0xc4bd('0x24')](function(){_0x58d9c2[_0xc4bd('0x18')](0xcc)[_0xc4bd('0x19')]();});}};}function handleEntityNotFound(_0x15453e,_0x178d61){return function(_0x22190a){if(!_0x22190a){_0x15453e[_0xc4bd('0x26')](0x194);}return _0x22190a;};}function handleError(_0x57084d,_0x2957f2){_0x2957f2=_0x2957f2||0x1f4;return function(_0x50018e){logger['error'](_0x50018e[_0xc4bd('0x27')]);if(_0x50018e[_0xc4bd('0x28')]){delete _0x50018e[_0xc4bd('0x28')];}_0x57084d[_0xc4bd('0x18')](_0x2957f2)[_0xc4bd('0x29')](_0x50018e);};}exports[_0xc4bd('0x2a')]=function(_0x176e1e,_0x45c41f){var _0x127672={},_0x4b3b3d={},_0x5be23c={'count':0x0,'rows':[]};var _0x36f9d0=_[_0xc4bd('0x2b')](db[_0xc4bd('0x2c')][_0xc4bd('0x2d')],function(_0x5a4f6f){return{'name':_0x5a4f6f[_0xc4bd('0x2e')],'type':_0x5a4f6f[_0xc4bd('0x2f')][_0xc4bd('0x30')]};});_0x4b3b3d['model']=_[_0xc4bd('0x2b')](_0x36f9d0,_0xc4bd('0x28'));_0x4b3b3d['query']=_[_0xc4bd('0x31')](_0x176e1e[_0xc4bd('0x32')]);_0x4b3b3d[_0xc4bd('0x33')]=_[_0xc4bd('0x34')](_0x4b3b3d[_0xc4bd('0x35')],_0x4b3b3d[_0xc4bd('0x32')]);_0x127672[_0xc4bd('0x36')]=_[_0xc4bd('0x34')](_0x4b3b3d[_0xc4bd('0x35')],qs[_0xc4bd('0x37')](_0x176e1e[_0xc4bd('0x32')]['fields']));_0x127672[_0xc4bd('0x36')]=_0x127672[_0xc4bd('0x36')]['length']?_0x127672[_0xc4bd('0x36')]:_0x4b3b3d['model'];if(!_0x176e1e[_0xc4bd('0x32')][_0xc4bd('0x38')](_0xc4bd('0x39'))){_0x127672[_0xc4bd('0x1d')]=qs['limit'](_0x176e1e[_0xc4bd('0x32')][_0xc4bd('0x1d')]);_0x127672[_0xc4bd('0x1b')]=qs[_0xc4bd('0x1b')](_0x176e1e[_0xc4bd('0x32')][_0xc4bd('0x1b')]);}_0x127672[_0xc4bd('0x3a')]=qs[_0xc4bd('0x3b')](_0x176e1e[_0xc4bd('0x32')][_0xc4bd('0x3b')]);_0x127672[_0xc4bd('0x3c')]=qs[_0xc4bd('0x33')](_['pick'](_0x176e1e[_0xc4bd('0x32')],_0x4b3b3d[_0xc4bd('0x33')]),_0x36f9d0);if(_0x176e1e['query'][_0xc4bd('0x3d')]){_0x127672[_0xc4bd('0x3c')]=_['merge'](_0x127672['where'],{'$or':_[_0xc4bd('0x2b')](_0x36f9d0,function(_0x5d22e9){if(_0x5d22e9[_0xc4bd('0x2f')]!==_0xc4bd('0x3e')){var _0x58b52a={};_0x58b52a[_0x5d22e9['name']]={'$like':'%'+_0x176e1e['query']['filter']+'%'};return _0x58b52a;}})});}_0x127672=_['merge']({},_0x127672,_0x176e1e['options']);var _0xa82743={'where':_0x127672[_0xc4bd('0x3c')]};return db[_0xc4bd('0x2c')]['count'](_0xa82743)[_0xc4bd('0x24')](function(_0x11ef36){_0x5be23c[_0xc4bd('0x1e')]=_0x11ef36;if(_0x176e1e[_0xc4bd('0x32')][_0xc4bd('0x3f')]){_0x127672[_0xc4bd('0x40')]=[{'all':!![]}];}return db[_0xc4bd('0x2c')][_0xc4bd('0x41')](_0x127672);})[_0xc4bd('0x24')](function(_0x21bed2){_0x5be23c[_0xc4bd('0x42')]=_0x21bed2;return _0x5be23c;})[_0xc4bd('0x24')](respondWithFilteredResult(_0x45c41f,_0x127672))[_0xc4bd('0x43')](handleError(_0x45c41f,null));};exports[_0xc4bd('0x44')]=function(_0x2a3905,_0x1bbe41){var _0x3ea886={'raw':!![],'where':{'id':_0x2a3905[_0xc4bd('0x45')]['id']}},_0x35c60e={};_0x35c60e[_0xc4bd('0x35')]=_[_0xc4bd('0x31')](db[_0xc4bd('0x2c')][_0xc4bd('0x2d')]);_0x35c60e['query']=_[_0xc4bd('0x31')](_0x2a3905[_0xc4bd('0x32')]);_0x35c60e[_0xc4bd('0x33')]=_[_0xc4bd('0x34')](_0x35c60e['model'],_0x35c60e[_0xc4bd('0x32')]);_0x3ea886[_0xc4bd('0x36')]=_['intersection'](_0x35c60e[_0xc4bd('0x35')],qs[_0xc4bd('0x37')](_0x2a3905[_0xc4bd('0x32')][_0xc4bd('0x37')]));_0x3ea886[_0xc4bd('0x36')]=_0x3ea886[_0xc4bd('0x36')][_0xc4bd('0x46')]?_0x3ea886['attributes']:_0x35c60e[_0xc4bd('0x35')];if(_0x2a3905[_0xc4bd('0x32')][_0xc4bd('0x3f')]){_0x3ea886[_0xc4bd('0x40')]=[{'all':!![]}];}_0x3ea886=_[_0xc4bd('0x47')]({},_0x3ea886,_0x2a3905[_0xc4bd('0x48')]);return db[_0xc4bd('0x2c')][_0xc4bd('0x49')](_0x3ea886)['then'](handleEntityNotFound(_0x1bbe41,null))[_0xc4bd('0x24')](respondWithResult(_0x1bbe41,null))[_0xc4bd('0x43')](handleError(_0x1bbe41,null));};exports[_0xc4bd('0x4a')]=function(_0x4822a1,_0x230702){return db[_0xc4bd('0x2c')][_0xc4bd('0x4a')](_0x4822a1[_0xc4bd('0x4b')],{})[_0xc4bd('0x24')](respondWithResult(_0x230702,0xc9))[_0xc4bd('0x43')](handleError(_0x230702,null));};exports[_0xc4bd('0x23')]=function(_0x542d00,_0x17efd0){if(_0x542d00['body']['id']){delete _0x542d00[_0xc4bd('0x4b')]['id'];}return db[_0xc4bd('0x2c')][_0xc4bd('0x49')]({'where':{'id':_0x542d00[_0xc4bd('0x45')]['id']}})[_0xc4bd('0x24')](handleEntityNotFound(_0x17efd0,null))[_0xc4bd('0x24')](saveUpdates(_0x542d00[_0xc4bd('0x4b')],null))[_0xc4bd('0x24')](respondWithResult(_0x17efd0,null))[_0xc4bd('0x43')](handleError(_0x17efd0,null));};exports['destroy']=function(_0x99ec4f,_0x586ca6){return db[_0xc4bd('0x2c')]['find']({'where':{'id':_0x99ec4f[_0xc4bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x586ca6,null))[_0xc4bd('0x24')](removeEntity(_0x586ca6,null))[_0xc4bd('0x43')](handleError(_0x586ca6,null));};exports['describe']=function(_0x24c9a6,_0x1c961e){return db['SquareDetailsReport'][_0xc4bd('0x4c')]()[_0xc4bd('0x24')](respondWithResult(_0x1c961e,null))['catch'](handleError(_0x1c961e,null));}; \ No newline at end of file +var _0x2386=['util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','update','then','end','stack','name','send','map','SquareDetailsReport','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','show','includeAll','find','catch','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2386,0x161));var _0x6238=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x2386[_0x4eec9b];return _0x2e3849;};'use strict';var emlformat=require(_0x6238('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6238('0x1'));var jsonpatch=require(_0x6238('0x2'));var rp=require(_0x6238('0x3'));var moment=require(_0x6238('0x4'));var BPromise=require(_0x6238('0x5'));var Mustache=require(_0x6238('0x6'));var util=require(_0x6238('0x7'));var path=require(_0x6238('0x8'));var sox=require('sox');var csv=require(_0x6238('0x9'));var ejs=require(_0x6238('0xa'));var fs=require('fs');var fs_extra=require(_0x6238('0xb'));var _=require(_0x6238('0xc'));var squel=require(_0x6238('0xd'));var crypto=require('crypto');var jsforce=require(_0x6238('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6238('0xf'));var Papa=require(_0x6238('0x10'));var Redis=require(_0x6238('0x11'));var authService=require(_0x6238('0x12'));var qs=require(_0x6238('0x13'));var as=require(_0x6238('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6238('0x15'))('api');var utils=require(_0x6238('0x16'));var config=require(_0x6238('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6238('0x18'))['db'];function respondWithStatusCode(_0x34dd1d,_0x12cd6f){_0x12cd6f=_0x12cd6f||0xcc;return function(_0x2dafcb){if(_0x2dafcb){return _0x34dd1d[_0x6238('0x19')](_0x12cd6f);}return _0x34dd1d[_0x6238('0x1a')](_0x12cd6f)['end']();};}function respondWithResult(_0x4eafbd,_0x4ab9eb){_0x4ab9eb=_0x4ab9eb||0xc8;return function(_0x3c3e13){if(_0x3c3e13){return _0x4eafbd[_0x6238('0x1a')](_0x4ab9eb)['json'](_0x3c3e13);}};}function respondWithFilteredResult(_0x5df5fa,_0x53c7af){return function(_0x423e2a){if(_0x423e2a){var _0x29117d=typeof _0x53c7af['offset']==='undefined'&&typeof _0x53c7af['limit']==='undefined';var _0x5c29db=_0x423e2a[_0x6238('0x1b')];var _0x14c52b=_0x29117d?0x0:_0x53c7af[_0x6238('0x1c')];var _0x2c9cb0=_0x29117d?_0x423e2a[_0x6238('0x1b')]:_0x53c7af[_0x6238('0x1c')]+_0x53c7af[_0x6238('0x1d')];var _0x474704;if(_0x2c9cb0>=_0x5c29db){_0x2c9cb0=_0x5c29db;_0x474704=0xc8;}else{_0x474704=0xce;}_0x5df5fa[_0x6238('0x1a')](_0x474704);return _0x5df5fa[_0x6238('0x1e')](_0x6238('0x1f'),_0x14c52b+'-'+_0x2c9cb0+'/'+_0x5c29db)['json'](_0x423e2a);}return null;};}function patchUpdates(_0x33d4ed){return function(_0x2475a8){try{jsonpatch[_0x6238('0x20')](_0x2475a8,_0x33d4ed,!![]);}catch(_0x31b711){return BPromise[_0x6238('0x21')](_0x31b711);}return _0x2475a8['save']();};}function saveUpdates(_0x3109a3,_0x1f85d3){return function(_0x3544c3){if(_0x3544c3){return _0x3544c3[_0x6238('0x22')](_0x3109a3)[_0x6238('0x23')](function(_0x4a6f4d){return _0x4a6f4d;});}return null;};}function removeEntity(_0x7a3ca5,_0x58a928){return function(_0x3cd00b){if(_0x3cd00b){return _0x3cd00b['destroy']()[_0x6238('0x23')](function(){_0x7a3ca5['status'](0xcc)[_0x6238('0x24')]();});}};}function handleEntityNotFound(_0x4df2e4,_0x19a951){return function(_0x28c7ec){if(!_0x28c7ec){_0x4df2e4[_0x6238('0x19')](0x194);}return _0x28c7ec;};}function handleError(_0x49d3fe,_0x50e9bf){_0x50e9bf=_0x50e9bf||0x1f4;return function(_0x5e71d8){logger['error'](_0x5e71d8[_0x6238('0x25')]);if(_0x5e71d8['name']){delete _0x5e71d8[_0x6238('0x26')];}_0x49d3fe[_0x6238('0x1a')](_0x50e9bf)[_0x6238('0x27')](_0x5e71d8);};}exports['index']=function(_0x2d2f02,_0x29dd8a){var _0x1b5381={},_0x21f083={},_0x2abdf9={'count':0x0,'rows':[]};var _0xd8c697=_[_0x6238('0x28')](db[_0x6238('0x29')]['rawAttributes'],function(_0x2485bb){return{'name':_0x2485bb['fieldName'],'type':_0x2485bb[_0x6238('0x2a')][_0x6238('0x2b')]};});_0x21f083['model']=_['map'](_0xd8c697,'name');_0x21f083[_0x6238('0x2c')]=_[_0x6238('0x2d')](_0x2d2f02['query']);_0x21f083[_0x6238('0x2e')]=_[_0x6238('0x2f')](_0x21f083['model'],_0x21f083['query']);_0x1b5381[_0x6238('0x30')]=_[_0x6238('0x2f')](_0x21f083[_0x6238('0x31')],qs[_0x6238('0x32')](_0x2d2f02[_0x6238('0x2c')][_0x6238('0x32')]));_0x1b5381['attributes']=_0x1b5381['attributes'][_0x6238('0x33')]?_0x1b5381[_0x6238('0x30')]:_0x21f083['model'];if(!_0x2d2f02[_0x6238('0x2c')][_0x6238('0x34')](_0x6238('0x35'))){_0x1b5381[_0x6238('0x1d')]=qs[_0x6238('0x1d')](_0x2d2f02[_0x6238('0x2c')][_0x6238('0x1d')]);_0x1b5381[_0x6238('0x1c')]=qs[_0x6238('0x1c')](_0x2d2f02[_0x6238('0x2c')]['offset']);}_0x1b5381[_0x6238('0x36')]=qs[_0x6238('0x37')](_0x2d2f02[_0x6238('0x2c')][_0x6238('0x37')]);_0x1b5381[_0x6238('0x38')]=qs[_0x6238('0x2e')](_['pick'](_0x2d2f02[_0x6238('0x2c')],_0x21f083[_0x6238('0x2e')]),_0xd8c697);if(_0x2d2f02[_0x6238('0x2c')]['filter']){_0x1b5381[_0x6238('0x38')]=_[_0x6238('0x39')](_0x1b5381[_0x6238('0x38')],{'$or':_[_0x6238('0x28')](_0xd8c697,function(_0x205d72){if(_0x205d72[_0x6238('0x2a')]!==_0x6238('0x3a')){var _0x431d4c={};_0x431d4c[_0x205d72[_0x6238('0x26')]]={'$like':'%'+_0x2d2f02[_0x6238('0x2c')][_0x6238('0x3b')]+'%'};return _0x431d4c;}})});}_0x1b5381=_[_0x6238('0x39')]({},_0x1b5381,_0x2d2f02['options']);var _0x105f94={'where':_0x1b5381[_0x6238('0x38')]};return db[_0x6238('0x29')]['count'](_0x105f94)[_0x6238('0x23')](function(_0x916e23){_0x2abdf9['count']=_0x916e23;if(_0x2d2f02[_0x6238('0x2c')]['includeAll']){_0x1b5381[_0x6238('0x3c')]=[{'all':!![]}];}return db[_0x6238('0x29')][_0x6238('0x3d')](_0x1b5381);})[_0x6238('0x23')](function(_0x3f5fd1){_0x2abdf9[_0x6238('0x3e')]=_0x3f5fd1;return _0x2abdf9;})[_0x6238('0x23')](respondWithFilteredResult(_0x29dd8a,_0x1b5381))['catch'](handleError(_0x29dd8a,null));};exports[_0x6238('0x3f')]=function(_0x81c82f,_0x559d1b){var _0x48eea2={'raw':!![],'where':{'id':_0x81c82f['params']['id']}},_0x54b91e={};_0x54b91e['model']=_['keys'](db['SquareDetailsReport']['rawAttributes']);_0x54b91e[_0x6238('0x2c')]=_[_0x6238('0x2d')](_0x81c82f['query']);_0x54b91e[_0x6238('0x2e')]=_['intersection'](_0x54b91e[_0x6238('0x31')],_0x54b91e[_0x6238('0x2c')]);_0x48eea2[_0x6238('0x30')]=_[_0x6238('0x2f')](_0x54b91e[_0x6238('0x31')],qs[_0x6238('0x32')](_0x81c82f[_0x6238('0x2c')][_0x6238('0x32')]));_0x48eea2[_0x6238('0x30')]=_0x48eea2['attributes']['length']?_0x48eea2[_0x6238('0x30')]:_0x54b91e[_0x6238('0x31')];if(_0x81c82f['query'][_0x6238('0x40')]){_0x48eea2['include']=[{'all':!![]}];}_0x48eea2=_['merge']({},_0x48eea2,_0x81c82f['options']);return db['SquareDetailsReport'][_0x6238('0x41')](_0x48eea2)[_0x6238('0x23')](handleEntityNotFound(_0x559d1b,null))[_0x6238('0x23')](respondWithResult(_0x559d1b,null))[_0x6238('0x42')](handleError(_0x559d1b,null));};exports[_0x6238('0x43')]=function(_0x51a423,_0x6111bc){return db[_0x6238('0x29')][_0x6238('0x43')](_0x51a423[_0x6238('0x44')],{})[_0x6238('0x23')](respondWithResult(_0x6111bc,0xc9))[_0x6238('0x42')](handleError(_0x6111bc,null));};exports[_0x6238('0x22')]=function(_0x5ebab0,_0x32faa7){if(_0x5ebab0['body']['id']){delete _0x5ebab0[_0x6238('0x44')]['id'];}return db[_0x6238('0x29')][_0x6238('0x41')]({'where':{'id':_0x5ebab0['params']['id']}})[_0x6238('0x23')](handleEntityNotFound(_0x32faa7,null))[_0x6238('0x23')](saveUpdates(_0x5ebab0['body'],null))[_0x6238('0x23')](respondWithResult(_0x32faa7,null))[_0x6238('0x42')](handleError(_0x32faa7,null));};exports[_0x6238('0x45')]=function(_0xb9d02b,_0x1b762b){return db['SquareDetailsReport'][_0x6238('0x41')]({'where':{'id':_0xb9d02b[_0x6238('0x46')]['id']}})[_0x6238('0x23')](handleEntityNotFound(_0x1b762b,null))[_0x6238('0x23')](removeEntity(_0x1b762b,null))[_0x6238('0x42')](handleError(_0x1b762b,null));};exports[_0x6238('0x47')]=function(_0x35889c,_0x2f0fcb){return db[_0x6238('0x29')][_0x6238('0x47')]()[_0x6238('0x23')](respondWithResult(_0x2f0fcb,null))[_0x6238('0x42')](handleError(_0x2f0fcb,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 44c9373..c1804d8 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 _0x9404=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x9ff33a,_0x337edb){var _0x5d6bda=function(_0x523361){while(--_0x523361){_0x9ff33a['push'](_0x9ff33a['shift']());}};_0x5d6bda(++_0x337edb);}(_0x9404,0x1e3));var _0x4940=function(_0x244c71,_0xa2f8df){_0x244c71=_0x244c71-0x0;var _0x163553=_0x9404[_0x244c71];return _0x163553;};'use strict';var _=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var logger=require('../../config/logger')(_0x4940('0x2'));var moment=require(_0x4940('0x3'));var BPromise=require(_0x4940('0x4'));var rp=require(_0x4940('0x5'));var fs=require('fs');var path=require(_0x4940('0x6'));var rimraf=require('rimraf');var config=require(_0x4940('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x4940('0x8')]=function(_0x3d4c0c,_0x561d42){return _0x3d4c0c['define'](_0x4940('0x9'),attributes,{'tableName':_0x4940('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2802=['rimraf','../../config/environment','./squareReportDetail.attributes','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8ed9ee,_0x1a6626){var _0x4403c7=function(_0x176935){while(--_0x176935){_0x8ed9ee['push'](_0x8ed9ee['shift']());}};_0x4403c7(++_0x1a6626);}(_0x2802,0xa5));var _0x2280=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x2802[_0x631a3c];return _0x2bdfa3;};'use strict';var _=require(_0x2280('0x0'));var util=require('util');var logger=require(_0x2280('0x1'))(_0x2280('0x2'));var moment=require(_0x2280('0x3'));var BPromise=require(_0x2280('0x4'));var rp=require(_0x2280('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2280('0x6'));var config=require(_0x2280('0x7'));var attributes=require(_0x2280('0x8'));module['exports']=function(_0x4d0675,_0x10653b){return _0x4d0675['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 026551a..1c2000f 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 _0x8d05=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch'];(function(_0xc8cb5c,_0x38355d){var _0x1fff99=function(_0x155746){while(--_0x155746){_0xc8cb5c['push'](_0xc8cb5c['shift']());}};_0x1fff99(++_0x38355d);}(_0x8d05,0xe8));var _0x58d0=function(_0xc20dc1,_0x1d4333){_0xc20dc1=_0xc20dc1-0x0;var _0x5c9d08=_0x8d05[_0xc20dc1];return _0x5c9d08;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58d0('0x5'));var logger=require(_0x58d0('0x6'))(_0x58d0('0x7'));var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58d0('0x9')][_0x58d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528303,_0x66aef1,_0x4e44e2){return new BPromise(function(_0xe744f4,_0x34ab60){return client[_0x58d0('0xb')](_0x528303,_0x4e44e2)[_0x58d0('0xc')](function(_0x1d070a){logger['info'](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));logger['debug'](_0x58d0('0xf'),_0x66aef1,_0x58d0('0xe'),JSON['stringify'](_0x1d070a));if(_0x1d070a['error']){if(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0x34ab60(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0xe744f4(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}else{logger[_0x58d0('0x13')](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));_0xe744f4(_0x1d070a[_0x58d0('0x14')][_0x58d0('0x12')]);}})['catch'](function(_0x10874e){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x10874e);_0x34ab60(_0x10874e);});});}exports[_0x58d0('0x15')]=function(_0xb8dd5f){var _0x2c7db6=this;return new Promise(function(_0x23dcfb,_0x41d221){return db[_0x58d0('0x16')][_0x58d0('0x17')](_0xb8dd5f[_0x58d0('0x18')],{'raw':_0xb8dd5f[_0x58d0('0x19')]?_0xb8dd5f[_0x58d0('0x19')][_0x58d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3072f9){logger[_0x58d0('0x13')](_0x58d0('0x15'),_0xb8dd5f);logger['debug'](_0x58d0('0x15'),_0xb8dd5f,JSON[_0x58d0('0x1b')](_0x3072f9));_0x23dcfb(_0x3072f9);})[_0x58d0('0x1c')](function(_0x575b34){logger[_0x58d0('0x10')]('CreateSquareDetailsReport',_0x575b34['message'],_0xb8dd5f);_0x41d221(_0x2c7db6[_0x58d0('0x10')](0x1f4,_0x575b34[_0x58d0('0x12')]));});});}; \ No newline at end of file +var _0x536f=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateSquareDetailsReport','SquareDetailsReport','create','options','debug','catch','lodash','ioredis','../../mysqldb'];(function(_0x4cdbae,_0x5769cb){var _0x19ccd5=function(_0xf87e61){while(--_0xf87e61){_0x4cdbae['push'](_0x4cdbae['shift']());}};_0x19ccd5(++_0x5769cb);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 69313fa..1d293b0 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 _0x3770=['isAuthenticated','killProcess','express'];(function(_0x208705,_0x1ee99d){var _0x101594=function(_0x2c9f2f){while(--_0x2c9f2f){_0x208705['push'](_0x208705['shift']());}};_0x101594(++_0x1ee99d);}(_0x3770,0xcb));var _0x0377=function(_0x16f367,_0x245f3f){_0x16f367=_0x16f367-0x0;var _0x33e1d6=_0x3770[_0x16f367];return _0x33e1d6;};'use strict';var express=require(_0x0377('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x0377('0x1')](),controller['index']);router['get']('/process/:pid/kill',auth[_0x0377('0x1')](),controller[_0x0377('0x2')]);module['exports']=router; \ No newline at end of file +var _0xc4e2=['../../components/auth/service','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xc4e2,0x139));var _0x2c4e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc4e2[_0x40ac5e];return _0x2839d6;};'use strict';var express=require(_0x2c4e('0x0'));var router=express[_0x2c4e('0x1')]();var auth=require(_0x2c4e('0x2'));var controller=require('./system.controller');router[_0x2c4e('0x3')]('/',auth['isAuthenticated'](),controller[_0x2c4e('0x4')]);router[_0x2c4e('0x3')](_0x2c4e('0x5'),auth[_0x2c4e('0x6')](),controller[_0x2c4e('0x7')]);module[_0x2c4e('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 57002d6..125c432 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 _0xa2bc=['util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','systeminformation','exec','../../config/logger','api'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa2bc,0x128));var _0xca2b=function(_0x26bafe,_0x13e506){_0x26bafe=_0x26bafe-0x0;var _0x307879=_0xa2bc[_0x26bafe];return _0x307879;};'use strict';var info=require(_0xca2b('0x0'));var exec=require('child_process')[_0xca2b('0x1')];var logger=require(_0xca2b('0x2'))(_0xca2b('0x3'));var util=require(_0xca2b('0x4'));var BPromise=require(_0xca2b('0x5'));var _=require(_0xca2b('0x6'));function handleError(_0x3d93ec,_0x492a36,_0x818ed6){_0x492a36=_0x492a36||0x1f4;return function(_0x41bd34){logger[_0xca2b('0x7')](_0xca2b('0x8'),_0x818ed6,_0x492a36,util[_0xca2b('0x9')](_0x41bd34,{'showHidden':![],'depth':null}));delete _0x41bd34[_0xca2b('0xa')];_0x3d93ec[_0xca2b('0xb')](_0x492a36)[_0xca2b('0xc')](_0x41bd34);};}exports[_0xca2b('0xd')]=function(_0x1fb3d9,_0x2ba0ed){return info['getAllData']()[_0xca2b('0xe')](function(_0x4e7452){return _0x2ba0ed[_0xca2b('0xb')](0xc8)[_0xca2b('0xf')](_0x4e7452);})[_0xca2b('0x10')](function(_0x153706){return _0x2ba0ed[_0xca2b('0xb')](0x1f4)[_0xca2b('0xf')](_0x153706);});};exports[_0xca2b('0x11')]=function(_0x1ba3be,_0x1ad4d8){var _0x3dda13=['components/import/cm'];return new BPromise(function(_0x46cf8c,_0x3c9d39){return exec(util[_0xca2b('0x12')](_0xca2b('0x13'),_0x1ba3be[_0xca2b('0x14')]['pid']),function(_0x52b4c0,_0x4a687e,_0x3fca25){if(_0x52b4c0){return _0x3c9d39(_0x52b4c0);}return _0x46cf8c(_0x4a687e);});})[_0xca2b('0xe')](function(_0x45f707){var _0x4a11e2=![];var _0x40f070=_0x45f707['split'](/\n/);for(var _0x31f7ab=0x0,_0x37e58f=_0x3dda13[_0xca2b('0x15')];_0x31f7ab<_0x37e58f,_0x4a11e2===![];_0x31f7ab+=0x1){if(_0x45f707['indexOf'](_0x3dda13[_0x31f7ab])>=0x0){_0x4a11e2=!![];}}if(!_0x4a11e2){throw new Error(util['format'](_0xca2b('0x16'),_0x1ba3be[_0xca2b('0x14')]['pid']));}process[_0xca2b('0x17')](_0x1ba3be[_0xca2b('0x14')][_0xca2b('0x18')],'SIGINT');return _0x1ad4d8[_0xca2b('0xb')](0xc8)[_0xca2b('0xf')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1ba3be[_0xca2b('0x14')][_0xca2b('0x18')])});})['catch'](handleError(_0x1ad4d8,null,'killProcess'));}; \ No newline at end of file +var _0x9318=['../../config/logger','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec'];(function(_0x3fc732,_0x510463){var _0x2ea6df=function(_0x2211b9){while(--_0x2211b9){_0x3fc732['push'](_0x3fc732['shift']());}};_0x2ea6df(++_0x510463);}(_0x9318,0xe5));var _0x8931=function(_0x3fa518,_0x431cbe){_0x3fa518=_0x3fa518-0x0;var _0x269c91=_0x9318[_0x3fa518];return _0x269c91;};'use strict';var info=require(_0x8931('0x0'));var exec=require(_0x8931('0x1'))[_0x8931('0x2')];var logger=require(_0x8931('0x3'))(_0x8931('0x4'));var util=require('util');var BPromise=require(_0x8931('0x5'));var _=require(_0x8931('0x6'));function handleError(_0x30b661,_0x2590fd,_0x4bf87b){_0x2590fd=_0x2590fd||0x1f4;return function(_0x132a4d){logger['error'](_0x8931('0x7'),_0x4bf87b,_0x2590fd,util[_0x8931('0x8')](_0x132a4d,{'showHidden':![],'depth':null}));delete _0x132a4d[_0x8931('0x9')];_0x30b661[_0x8931('0xa')](_0x2590fd)[_0x8931('0xb')](_0x132a4d);};}exports[_0x8931('0xc')]=function(_0x5367e9,_0x3dcaa8){return info[_0x8931('0xd')]()[_0x8931('0xe')](function(_0x290d46){return _0x3dcaa8['status'](0xc8)[_0x8931('0xf')](_0x290d46);})[_0x8931('0x10')](function(_0x67c42c){return _0x3dcaa8[_0x8931('0xa')](0x1f4)['json'](_0x67c42c);});};exports[_0x8931('0x11')]=function(_0x3991b4,_0x3459db){var _0x443599=[_0x8931('0x12')];return new BPromise(function(_0x27f540,_0x26397a){return exec(util[_0x8931('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3991b4[_0x8931('0x14')][_0x8931('0x15')]),function(_0x46424e,_0x3e3e6e,_0x273fe7){if(_0x46424e){return _0x26397a(_0x46424e);}return _0x27f540(_0x3e3e6e);});})[_0x8931('0xe')](function(_0x27eb58){var _0x2dff6f=![];var _0x71f53c=_0x27eb58[_0x8931('0x16')](/\n/);for(var _0x5a4e95=0x0,_0x5e481b=_0x443599[_0x8931('0x17')];_0x5a4e95<_0x5e481b,_0x2dff6f===![];_0x5a4e95+=0x1){if(_0x27eb58[_0x8931('0x18')](_0x443599[_0x5a4e95])>=0x0){_0x2dff6f=!![];}}if(!_0x2dff6f){throw new Error(util[_0x8931('0x13')](_0x8931('0x19'),_0x3991b4['params'][_0x8931('0x15')]));}process[_0x8931('0x1a')](_0x3991b4[_0x8931('0x14')][_0x8931('0x15')],_0x8931('0x1b'));return _0x3459db['status'](0xc8)['json']({'message':util[_0x8931('0x13')](_0x8931('0x1c'),_0x3991b4[_0x8931('0x14')]['pid'])});})[_0x8931('0x10')](handleError(_0x3459db,null,_0x8931('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3a34c94..2783282 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 _0xd9f4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0x13921e,_0x5dcfb8){var _0x2f41ae=function(_0x307cb1){while(--_0x307cb1){_0x13921e['push'](_0x13921e['shift']());}};_0x2f41ae(++_0x5dcfb8);}(_0xd9f4,0x7b));var _0x4d9f=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xd9f4[_0x28669c];return _0x4a3af6;};'use strict';var multer=require(_0x4d9f('0x0'));var util=require(_0x4d9f('0x1'));var path=require(_0x4d9f('0x2'));var timeout=require(_0x4d9f('0x3'));var express=require(_0x4d9f('0x4'));var router=express[_0x4d9f('0x5')]();var fs_extra=require(_0x4d9f('0x6'));var auth=require(_0x4d9f('0x7'));var interaction=require(_0x4d9f('0x8'));var config=require(_0x4d9f('0x9'));var controller=require(_0x4d9f('0xa'));router[_0x4d9f('0xb')]('/',auth[_0x4d9f('0xc')](),controller[_0x4d9f('0xd')]);router[_0x4d9f('0xb')](_0x4d9f('0xe'),auth[_0x4d9f('0xc')](),controller[_0x4d9f('0xf')]);router[_0x4d9f('0x10')]('/',auth[_0x4d9f('0xc')](),controller['create']);router[_0x4d9f('0x11')](_0x4d9f('0xe'),auth[_0x4d9f('0xc')](),controller['update']);router[_0x4d9f('0x12')]('/:id',auth[_0x4d9f('0xc')](),controller[_0x4d9f('0x13')]);module[_0x4d9f('0x14')]=router; \ No newline at end of file +var _0xcebd=['../../config/environment','get','index','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x60004,_0x1a53fd){var _0x1b4b52=function(_0x59cb0d){while(--_0x59cb0d){_0x60004['push'](_0x60004['shift']());}};_0x1b4b52(++_0x1a53fd);}(_0xcebd,0xae));var _0xdceb=function(_0x30b9af,_0xdb1884){_0x30b9af=_0x30b9af-0x0;var _0x1ff14f=_0xcebd[_0x30b9af];return _0x1ff14f;};'use strict';var multer=require(_0xdceb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdceb('0x1'));var express=require(_0xdceb('0x2'));var router=express[_0xdceb('0x3')]();var fs_extra=require(_0xdceb('0x4'));var auth=require(_0xdceb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdceb('0x6'));var controller=require('./tag.controller');router[_0xdceb('0x7')]('/',auth['isAuthenticated'](),controller[_0xdceb('0x8')]);router[_0xdceb('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdceb('0x9')]);router['post']('/',auth[_0xdceb('0xa')](),controller[_0xdceb('0xb')]);router[_0xdceb('0xc')](_0xdceb('0xd'),auth['isAuthenticated'](),controller[_0xdceb('0xe')]);router[_0xdceb('0xf')](_0xdceb('0xd'),auth[_0xdceb('0xa')](),controller[_0xdceb('0x10')]);module[_0xdceb('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 3fee3b5..828c052 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 _0x105b=['STRING','name','#0091EA','sequelize','exports'];(function(_0x3b2707,_0x3213e5){var _0x5c015c=function(_0x170197){while(--_0x170197){_0x3b2707['push'](_0x3b2707['shift']());}};_0x5c015c(++_0x3213e5);}(_0x105b,0x1a7));var _0xb105=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x105b[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xb105('0x0'));module[_0xb105('0x1')]={'name':{'type':Sequelize[_0xb105('0x2')],'unique':_0xb105('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb105('0x2')],'defaultValue':_0xb105('0x4')},'description':{'type':Sequelize[_0xb105('0x2')]}}; \ No newline at end of file +var _0x90db=['name','exports','STRING'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x90db,0x1c0));var _0xb90d=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x90db[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require('sequelize');module[_0xb90d('0x0')]={'name':{'type':Sequelize[_0xb90d('0x1')],'unique':_0xb90d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 16191cc..a122a90 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 _0x76dc=['where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','Tag','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x33f7b6,_0x8ce322){var _0x2cec9f=function(_0x3a8e0d){while(--_0x3a8e0d){_0x33f7b6['push'](_0x33f7b6['shift']());}};_0x2cec9f(++_0x8ce322);}(_0x76dc,0x1f2));var _0xc76d=function(_0x1f3b3f,_0x15c9f9){_0x1f3b3f=_0x1f3b3f-0x0;var _0x2c8036=_0x76dc[_0x1f3b3f];return _0x2c8036;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){var _0x637d68=_0x11b42f[_0xc76d('0x26')]({'plain':!![]});var _0x55ca79=_0xc76d('0x27');return db[_0xc76d('0x28')][_0xc76d('0x25')]({'where':{'type':_0x55ca79,'resourceId':_0x637d68['id']}})[_0xc76d('0x24')](function(){return _0x11b42f;});})[_0xc76d('0x24')](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x59ebd1,_0x59dabf){return function(_0x285430){if(!_0x285430){_0x59ebd1[_0xc76d('0x17')](0x194);}return _0x285430;};}function handleError(_0x5069ea,_0x31501a){_0x31501a=_0x31501a||0x1f4;return function(_0x52a79a){logger[_0xc76d('0x29')](_0x52a79a['stack']);if(_0x52a79a[_0xc76d('0x2a')]){delete _0x52a79a['name'];}_0x5069ea[_0xc76d('0x18')](_0x31501a)[_0xc76d('0x2b')](_0x52a79a);};}exports['index']=function(_0x3d4076,_0x1c68f3){var _0x9ab96c={},_0x2cf501={},_0x4feeda={'count':0x0,'rows':[]};var _0x283e16=_['map'](db[_0xc76d('0x2c')]['rawAttributes'],function(_0x30769f){return{'name':_0x30769f[_0xc76d('0x2d')],'type':_0x30769f['type']['key']};});_0x2cf501['model']=_['map'](_0x283e16,_0xc76d('0x2a'));_0x2cf501[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x3d4076[_0xc76d('0x2e')]);_0x2cf501[_0xc76d('0x30')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],_0x2cf501['query']);_0x9ab96c[_0xc76d('0x32')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x9ab96c[_0xc76d('0x32')]=_0x9ab96c['attributes'][_0xc76d('0x34')]?_0x9ab96c[_0xc76d('0x32')]:_0x2cf501[_0xc76d('0x31')];if(!_0x3d4076['query'][_0xc76d('0x35')](_0xc76d('0x36'))){_0x9ab96c[_0xc76d('0x1d')]=qs['limit'](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1d')]);_0x9ab96c[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x9ab96c['order']=qs['sort'](_0x3d4076[_0xc76d('0x2e')]['sort']);_0x9ab96c[_0xc76d('0x37')]=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x3d4076[_0xc76d('0x2e')],_0x2cf501['filters']),_0x283e16);if(_0x3d4076['query'][_0xc76d('0x39')]){_0x9ab96c[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x9ab96c[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x283e16,function(_0x58c724){if(_0x58c724[_0xc76d('0x3c')]!==_0xc76d('0x3d')){var _0x321989={};_0x321989[_0x58c724[_0xc76d('0x2a')]]={'$like':'%'+_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x321989;}})});}_0x9ab96c=_[_0xc76d('0x3a')]({},_0x9ab96c,_0x3d4076[_0xc76d('0x3e')]);var _0x305f7d={'where':_0x9ab96c[_0xc76d('0x37')]};return db['Tag']['count'](_0x305f7d)[_0xc76d('0x24')](function(_0x2a0759){_0x4feeda[_0xc76d('0x1b')]=_0x2a0759;if(_0x3d4076[_0xc76d('0x2e')]['includeAll']){_0x9ab96c['include']=[{'all':!![]}];}return db[_0xc76d('0x2c')][_0xc76d('0x3f')](_0x9ab96c);})[_0xc76d('0x24')](function(_0x15eb42){_0x4feeda[_0xc76d('0x40')]=_0x15eb42;return _0x4feeda;})[_0xc76d('0x24')](respondWithFilteredResult(_0x1c68f3,_0x9ab96c))[_0xc76d('0x41')](handleError(_0x1c68f3,null));};exports[_0xc76d('0x42')]=function(_0x50e922,_0x7bf0){var _0x95193f={'raw':!![],'where':{'id':_0x50e922[_0xc76d('0x43')]['id']}},_0x1bf8a0={};_0x1bf8a0['model']=_['keys'](db['Tag']['rawAttributes']);_0x1bf8a0['query']=_['keys'](_0x50e922['query']);_0x1bf8a0[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],_0x1bf8a0[_0xc76d('0x2e')]);_0x95193f[_0xc76d('0x32')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x50e922['query'][_0xc76d('0x33')]));_0x95193f[_0xc76d('0x32')]=_0x95193f[_0xc76d('0x32')][_0xc76d('0x34')]?_0x95193f[_0xc76d('0x32')]:_0x1bf8a0[_0xc76d('0x31')];if(_0x50e922[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x95193f[_0xc76d('0x46')]=[{'all':!![]}];}_0x95193f=_['merge']({},_0x95193f,_0x50e922['options']);return db[_0xc76d('0x2c')][_0xc76d('0x47')](_0x95193f)[_0xc76d('0x24')](handleEntityNotFound(_0x7bf0,null))[_0xc76d('0x24')](respondWithResult(_0x7bf0,null))[_0xc76d('0x41')](handleError(_0x7bf0,null));};exports['create']=function(_0x25fc9d,_0x1ede13){return db['Tag']['create'](_0x25fc9d[_0xc76d('0x48')],{})[_0xc76d('0x24')](function(_0x48cad0){var _0xe44a25=_0x25fc9d[_0xc76d('0x49')][_0xc76d('0x26')]({'plain':!![]});if(!_0xe44a25)throw new Error(_0xc76d('0x4a'));if(_0xe44a25[_0xc76d('0x4b')]===_0xc76d('0x49')){var _0x25a549=_0x48cad0[_0xc76d('0x26')]({'plain':!![]});var _0x4452a8=_0xc76d('0x27');return db['UserProfileSection'][_0xc76d('0x47')]({'where':{'name':_0x4452a8,'userProfileId':_0xe44a25[_0xc76d('0x4c')]},'raw':!![]})[_0xc76d('0x24')](function(_0x55e3af){if(_0x55e3af&&_0x55e3af[_0xc76d('0x4d')]===0x0){return db[_0xc76d('0x28')]['create']({'name':_0x25a549[_0xc76d('0x2a')],'resourceId':_0x25a549['id'],'type':_0x55e3af['name'],'sectionId':_0x55e3af['id']},{})[_0xc76d('0x24')](function(){return _0x48cad0;});}else{return _0x48cad0;}})[_0xc76d('0x41')](function(_0x316978){logger[_0xc76d('0x29')](_0xc76d('0x4e'),_0x316978);throw _0x316978;});}return _0x48cad0;})['then'](respondWithResult(_0x1ede13,0xc9))['catch'](handleError(_0x1ede13,null));};exports['update']=function(_0x320483,_0x746759){if(_0x320483[_0xc76d('0x48')]['id']){delete _0x320483[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x320483['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x746759,null))[_0xc76d('0x24')](saveUpdates(_0x320483[_0xc76d('0x48')],null))[_0xc76d('0x24')](respondWithResult(_0x746759,null))[_0xc76d('0x41')](handleError(_0x746759,null));};exports['destroy']=function(_0x275dfd,_0x463cbe){return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x275dfd[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x463cbe,null))['then'](removeEntity(_0x463cbe,null))[_0xc76d('0x41')](handleError(_0x463cbe,null));}; \ No newline at end of file +var _0xb469=['to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x399db7,_0x3e9146){var _0x4061cb=function(_0x31fec0){while(--_0x31fec0){_0x399db7['push'](_0x399db7['shift']());}};_0x4061cb(++_0x3e9146);}(_0xb469,0x13b));var _0x9b46=function(_0x21777b,_0x4fd735){_0x21777b=_0x21777b-0x0;var _0x153b9e=_0xb469[_0x21777b];return _0x153b9e;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];function respondWithStatusCode(_0x417df5,_0x5b65c2){_0x5b65c2=_0x5b65c2||0xcc;return function(_0x14362a){if(_0x14362a){return _0x417df5[_0x9b46('0x15')](_0x5b65c2);}return _0x417df5[_0x9b46('0x16')](_0x5b65c2)[_0x9b46('0x17')]();};}function respondWithResult(_0xa8f4ac,_0x35c5c1){_0x35c5c1=_0x35c5c1||0xc8;return function(_0x2136bc){if(_0x2136bc){return _0xa8f4ac[_0x9b46('0x16')](_0x35c5c1)[_0x9b46('0x18')](_0x2136bc);}};}function respondWithFilteredResult(_0x178293,_0xbc1ba6){return function(_0x135cc2){if(_0x135cc2){var _0x1e6911=typeof _0xbc1ba6['offset']==='undefined'&&typeof _0xbc1ba6['limit']===_0x9b46('0x19');var _0x5a380c=_0x135cc2[_0x9b46('0x1a')];var _0x5c5cc9=_0x1e6911?0x0:_0xbc1ba6['offset'];var _0x3d9efa=_0x1e6911?_0x135cc2['count']:_0xbc1ba6['offset']+_0xbc1ba6[_0x9b46('0x1b')];var _0x3a15cc;if(_0x3d9efa>=_0x5a380c){_0x3d9efa=_0x5a380c;_0x3a15cc=0xc8;}else{_0x3a15cc=0xce;}_0x178293['status'](_0x3a15cc);return _0x178293[_0x9b46('0x1c')](_0x9b46('0x1d'),_0x5c5cc9+'-'+_0x3d9efa+'/'+_0x5a380c)['json'](_0x135cc2);}return null;};}function patchUpdates(_0x55aece){return function(_0xbec2ea){try{jsonpatch[_0x9b46('0x1e')](_0xbec2ea,_0x55aece,!![]);}catch(_0x204098){return BPromise['reject'](_0x204098);}return _0xbec2ea['save']();};}function saveUpdates(_0x2b3440,_0x51d2ca){return function(_0x21dacb){if(_0x21dacb){return _0x21dacb[_0x9b46('0x1f')](_0x2b3440)['then'](function(_0xadff19){return _0xadff19;});}return null;};}function removeEntity(_0x5182b1,_0x141cb6){return function(_0x2b6f72){if(_0x2b6f72){return _0x2b6f72['destroy']()[_0x9b46('0x20')](function(){var _0x31ca63=_0x2b6f72[_0x9b46('0x21')]({'plain':!![]});var _0x319930=_0x9b46('0x22');return db[_0x9b46('0x23')][_0x9b46('0x24')]({'where':{'type':_0x319930,'resourceId':_0x31ca63['id']}})['then'](function(){return _0x2b6f72;});})[_0x9b46('0x20')](function(){_0x5182b1[_0x9b46('0x16')](0xcc)[_0x9b46('0x17')]();});}};}function handleEntityNotFound(_0x268821,_0x2468be){return function(_0x2a79a5){if(!_0x2a79a5){_0x268821[_0x9b46('0x15')](0x194);}return _0x2a79a5;};}function handleError(_0x50fb4a,_0x3bf5b9){_0x3bf5b9=_0x3bf5b9||0x1f4;return function(_0xee519e){logger[_0x9b46('0x25')](_0xee519e[_0x9b46('0x26')]);if(_0xee519e[_0x9b46('0x27')]){delete _0xee519e[_0x9b46('0x27')];}_0x50fb4a[_0x9b46('0x16')](_0x3bf5b9)[_0x9b46('0x28')](_0xee519e);};}exports[_0x9b46('0x29')]=function(_0x20090a,_0x2e1c51){var _0x5ab8b7={},_0x1f722d={},_0x27f326={'count':0x0,'rows':[]};var _0x807f2=_[_0x9b46('0x2a')](db[_0x9b46('0x2b')][_0x9b46('0x2c')],function(_0xbf8bc5){return{'name':_0xbf8bc5[_0x9b46('0x2d')],'type':_0xbf8bc5[_0x9b46('0x2e')][_0x9b46('0x2f')]};});_0x1f722d[_0x9b46('0x30')]=_['map'](_0x807f2,_0x9b46('0x27'));_0x1f722d['query']=_[_0x9b46('0x31')](_0x20090a[_0x9b46('0x32')]);_0x1f722d[_0x9b46('0x33')]=_['intersection'](_0x1f722d[_0x9b46('0x30')],_0x1f722d[_0x9b46('0x32')]);_0x5ab8b7[_0x9b46('0x34')]=_[_0x9b46('0x35')](_0x1f722d[_0x9b46('0x30')],qs['fields'](_0x20090a['query'][_0x9b46('0x36')]));_0x5ab8b7[_0x9b46('0x34')]=_0x5ab8b7[_0x9b46('0x34')][_0x9b46('0x37')]?_0x5ab8b7['attributes']:_0x1f722d[_0x9b46('0x30')];if(!_0x20090a['query'][_0x9b46('0x38')](_0x9b46('0x39'))){_0x5ab8b7[_0x9b46('0x1b')]=qs[_0x9b46('0x1b')](_0x20090a['query'][_0x9b46('0x1b')]);_0x5ab8b7['offset']=qs[_0x9b46('0x3a')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3a')]);}_0x5ab8b7[_0x9b46('0x3b')]=qs[_0x9b46('0x3c')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3c')]);_0x5ab8b7[_0x9b46('0x3d')]=qs[_0x9b46('0x33')](_[_0x9b46('0x3e')](_0x20090a[_0x9b46('0x32')],_0x1f722d['filters']),_0x807f2);if(_0x20090a[_0x9b46('0x32')]['filter']){_0x5ab8b7[_0x9b46('0x3d')]=_[_0x9b46('0x3f')](_0x5ab8b7['where'],{'$or':_[_0x9b46('0x2a')](_0x807f2,function(_0x4f953e){if(_0x4f953e[_0x9b46('0x2e')]!=='VIRTUAL'){var _0x443226={};_0x443226[_0x4f953e[_0x9b46('0x27')]]={'$like':'%'+_0x20090a[_0x9b46('0x32')][_0x9b46('0x40')]+'%'};return _0x443226;}})});}_0x5ab8b7=_[_0x9b46('0x3f')]({},_0x5ab8b7,_0x20090a['options']);var _0x4e268c={'where':_0x5ab8b7[_0x9b46('0x3d')]};return db['Tag']['count'](_0x4e268c)['then'](function(_0x4e1911){_0x27f326[_0x9b46('0x1a')]=_0x4e1911;if(_0x20090a['query'][_0x9b46('0x41')]){_0x5ab8b7['include']=[{'all':!![]}];}return db[_0x9b46('0x2b')][_0x9b46('0x42')](_0x5ab8b7);})[_0x9b46('0x20')](function(_0xa14b){_0x27f326[_0x9b46('0x43')]=_0xa14b;return _0x27f326;})[_0x9b46('0x20')](respondWithFilteredResult(_0x2e1c51,_0x5ab8b7))[_0x9b46('0x44')](handleError(_0x2e1c51,null));};exports[_0x9b46('0x45')]=function(_0x148d86,_0x5602a9){var _0x447302={'raw':!![],'where':{'id':_0x148d86[_0x9b46('0x46')]['id']}},_0xe7d0fc={};_0xe7d0fc[_0x9b46('0x30')]=_[_0x9b46('0x31')](db[_0x9b46('0x2b')][_0x9b46('0x2c')]);_0xe7d0fc[_0x9b46('0x32')]=_[_0x9b46('0x31')](_0x148d86[_0x9b46('0x32')]);_0xe7d0fc[_0x9b46('0x33')]=_[_0x9b46('0x35')](_0xe7d0fc[_0x9b46('0x30')],_0xe7d0fc[_0x9b46('0x32')]);_0x447302['attributes']=_['intersection'](_0xe7d0fc[_0x9b46('0x30')],qs[_0x9b46('0x36')](_0x148d86[_0x9b46('0x32')]['fields']));_0x447302['attributes']=_0x447302[_0x9b46('0x34')][_0x9b46('0x37')]?_0x447302[_0x9b46('0x34')]:_0xe7d0fc[_0x9b46('0x30')];if(_0x148d86[_0x9b46('0x32')][_0x9b46('0x41')]){_0x447302['include']=[{'all':!![]}];}_0x447302=_[_0x9b46('0x3f')]({},_0x447302,_0x148d86[_0x9b46('0x47')]);return db[_0x9b46('0x2b')]['find'](_0x447302)[_0x9b46('0x20')](handleEntityNotFound(_0x5602a9,null))['then'](respondWithResult(_0x5602a9,null))[_0x9b46('0x44')](handleError(_0x5602a9,null));};exports[_0x9b46('0x48')]=function(_0x16e6d8,_0x566bad){return db[_0x9b46('0x2b')][_0x9b46('0x48')](_0x16e6d8[_0x9b46('0x49')],{})[_0x9b46('0x20')](function(_0x3d4c13){var _0x373ffd=_0x16e6d8['user'][_0x9b46('0x21')]({'plain':!![]});if(!_0x373ffd)throw new Error(_0x9b46('0x4a'));if(_0x373ffd[_0x9b46('0x4b')]===_0x9b46('0x4c')){var _0x362311=_0x3d4c13[_0x9b46('0x21')]({'plain':!![]});var _0x4a1df0=_0x9b46('0x22');return db['UserProfileSection'][_0x9b46('0x4d')]({'where':{'name':_0x4a1df0,'userProfileId':_0x373ffd[_0x9b46('0x4e')]},'raw':!![]})[_0x9b46('0x20')](function(_0x33d9ac){if(_0x33d9ac&&_0x33d9ac[_0x9b46('0x4f')]===0x0){return db['UserProfileResource'][_0x9b46('0x48')]({'name':_0x362311[_0x9b46('0x27')],'resourceId':_0x362311['id'],'type':_0x33d9ac[_0x9b46('0x27')],'sectionId':_0x33d9ac['id']},{})[_0x9b46('0x20')](function(){return _0x3d4c13;});}else{return _0x3d4c13;}})[_0x9b46('0x44')](function(_0x14080e){logger[_0x9b46('0x25')](_0x9b46('0x50'),_0x14080e);throw _0x14080e;});}return _0x3d4c13;})[_0x9b46('0x20')](respondWithResult(_0x566bad,0xc9))[_0x9b46('0x44')](handleError(_0x566bad,null));};exports[_0x9b46('0x1f')]=function(_0x4d473f,_0x551a64){if(_0x4d473f['body']['id']){delete _0x4d473f[_0x9b46('0x49')]['id'];}return db['Tag'][_0x9b46('0x4d')]({'where':{'id':_0x4d473f['params']['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x551a64,null))['then'](saveUpdates(_0x4d473f[_0x9b46('0x49')],null))[_0x9b46('0x20')](respondWithResult(_0x551a64,null))[_0x9b46('0x44')](handleError(_0x551a64,null));};exports[_0x9b46('0x24')]=function(_0x35f71d,_0x5bcaad){return db[_0x9b46('0x2b')][_0x9b46('0x4d')]({'where':{'id':_0x35f71d[_0x9b46('0x46')]['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x5bcaad,null))[_0x9b46('0x20')](removeEntity(_0x5bcaad,null))['catch'](handleError(_0x5bcaad,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d11bfa1..5f52248 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 _0xd388=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x38c885,_0x186421){var _0x4c5fd6=function(_0x44d71a){while(--_0x44d71a){_0x38c885['push'](_0x38c885['shift']());}};_0x4c5fd6(++_0x186421);}(_0xd388,0x1ee));var _0x8d38=function(_0x3faf3a,_0x537495){_0x3faf3a=_0x3faf3a-0x0;var _0x28cc78=_0xd388[_0x3faf3a];return _0x28cc78;};'use strict';var _=require(_0x8d38('0x0'));var util=require(_0x8d38('0x1'));var logger=require('../../config/logger')(_0x8d38('0x2'));var moment=require(_0x8d38('0x3'));var BPromise=require(_0x8d38('0x4'));var rp=require(_0x8d38('0x5'));var fs=require('fs');var path=require(_0x8d38('0x6'));var rimraf=require(_0x8d38('0x7'));var config=require('../../config/environment');var attributes=require(_0x8d38('0x8'));module[_0x8d38('0x9')]=function(_0x18ef11,_0x365a5e){return _0x18ef11[_0x8d38('0xa')](_0x8d38('0xb'),attributes,{'tableName':_0x8d38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6e1=['Tag','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','define'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xa6e1,0x12d));var _0x1a6e=function(_0x293450,_0x419960){_0x293450=_0x293450-0x0;var _0x37655e=_0xa6e1[_0x293450];return _0x37655e;};'use strict';var _=require(_0x1a6e('0x0'));var util=require(_0x1a6e('0x1'));var logger=require(_0x1a6e('0x2'))(_0x1a6e('0x3'));var moment=require(_0x1a6e('0x4'));var BPromise=require('bluebird');var rp=require(_0x1a6e('0x5'));var fs=require('fs');var path=require(_0x1a6e('0x6'));var rimraf=require(_0x1a6e('0x7'));var config=require(_0x1a6e('0x8'));var attributes=require(_0x1a6e('0x9'));module['exports']=function(_0xd57160,_0x456e34){return _0xd57160[_0x1a6e('0xa')](_0x1a6e('0xb'),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 cd986b6..ed4fc4a 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 _0xf120=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0x7d9758,_0xf4d2eb){var _0x9e9815=function(_0x22255e){while(--_0x22255e){_0x7d9758['push'](_0x7d9758['shift']());}};_0x9e9815(++_0xf4d2eb);}(_0xf120,0x179));var _0x0f12=function(_0x3e131a,_0x564765){_0x3e131a=_0x3e131a-0x0;var _0x11df54=_0xf120[_0x3e131a];return _0x11df54;};'use strict';var _=require('lodash');var util=require(_0x0f12('0x0'));var moment=require(_0x0f12('0x1'));var BPromise=require(_0x0f12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f12('0x3'));var db=require(_0x0f12('0x4'))['db'];var utils=require(_0x0f12('0x5'));var logger=require('../../config/logger')(_0x0f12('0x6'));var config=require(_0x0f12('0x7'));var jayson=require(_0x0f12('0x8'));var client=jayson[_0x0f12('0x9')][_0x0f12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341516,_0x1f32b7,_0x457122){return new BPromise(function(_0x5bb901,_0x3e240d){return client['request'](_0x341516,_0x457122)[_0x0f12('0xb')](function(_0x147f3b){logger[_0x0f12('0xc')]('Tag,\x20%s,\x20%s',_0x1f32b7,'request\x20sent');logger[_0x0f12('0xd')](_0x0f12('0xe'),_0x1f32b7,_0x0f12('0xf'),JSON[_0x0f12('0x10')](_0x147f3b));if(_0x147f3b[_0x0f12('0x11')]){if(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x12')]===0x1f4){logger['error'](_0x0f12('0x13'),_0x1f32b7,_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);return _0x3e240d(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);}logger[_0x0f12('0x11')](_0x0f12('0x13'),_0x1f32b7,_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);return _0x5bb901(_0x147f3b[_0x0f12('0x11')][_0x0f12('0x14')]);}else{logger[_0x0f12('0xc')](_0x0f12('0x13'),_0x1f32b7,_0x0f12('0xf'));_0x5bb901(_0x147f3b[_0x0f12('0x15')]['message']);}})[_0x0f12('0x16')](function(_0x4d9613){logger[_0x0f12('0x11')](_0x0f12('0x13'),_0x1f32b7,_0x4d9613);_0x3e240d(_0x4d9613);});});} \ No newline at end of file +var _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xce0665,_0x10df3a){var _0x57197b=function(_0x5aaf8){while(--_0x5aaf8){_0xce0665['push'](_0xce0665['shift']());}};_0x57197b(++_0x10df3a);}(_0x032e,0x124));var _0xe032=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x032e[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('Tag,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('Tag,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0b8b131..970684b 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 1832b24..a527a8c 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 _0xd8b0=['exports','sequelize'];(function(_0x5ced83,_0x16d41d){var _0x3cbc91=function(_0x4035d6){while(--_0x4035d6){_0x5ced83['push'](_0x5ced83['shift']());}};_0x3cbc91(++_0x16d41d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x7f31e7,_0x4b88d8){var _0x407e2d=function(_0x5a306a){while(--_0x5a306a){_0x7f31e7['push'](_0x7f31e7['shift']());}};_0x407e2d(++_0x4b88d8);}(_0x2032,0xd9));var _0x2203=function(_0x5ed2ff,_0x2e102a){_0x5ed2ff=_0x5ed2ff-0x0;var _0x38d0b7=_0x2032[_0x5ed2ff];return _0x38d0b7;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 795d371..c8217d2 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 _0x7d8d=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','index','map','Team','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','UserMailQueue','UserSmsQueue','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','pick','Queues','findOne','add','ids','removeQueues','remove','addAgents','Sms','Fax','Openchannel','Whatsapp','Voice','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','online','voicePause','UserVoiceQueueRt','isNil','interface','SIP/%s','all','upsert','spread','Chat','Mail','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x7d8d,0x12a));var _0xd7d8=function(_0x10dc74,_0x2a0c4c){_0x10dc74=_0x10dc74-0x0;var _0x15821c=_0x7d8d[_0x10dc74];return _0x15821c;};'use strict';var emlformat=require(_0xd7d8('0x0'));var rimraf=require(_0xd7d8('0x1'));var zipdir=require(_0xd7d8('0x2'));var jsonpatch=require(_0xd7d8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd7d8('0x4'));var Mustache=require(_0xd7d8('0x5'));var util=require('util');var path=require(_0xd7d8('0x6'));var sox=require(_0xd7d8('0x7'));var csv=require(_0xd7d8('0x8'));var ejs=require(_0xd7d8('0x9'));var fs=require('fs');var fs_extra=require(_0xd7d8('0xa'));var _=require(_0xd7d8('0xb'));var squel=require('squel');var crypto=require(_0xd7d8('0xc'));var jsforce=require(_0xd7d8('0xd'));var deskjs=require(_0xd7d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd7d8('0xf'));var Papa=require(_0xd7d8('0x10'));var Redis=require(_0xd7d8('0x11'));var authService=require(_0xd7d8('0x12'));var qs=require(_0xd7d8('0x13'));var as=require(_0xd7d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7d8('0x15'))(_0xd7d8('0x16'));var utils=require(_0xd7d8('0x17'));var config=require(_0xd7d8('0x18'));var licenseUtil=require(_0xd7d8('0x19'));var db=require(_0xd7d8('0x1a'))['db'];config[_0xd7d8('0x1b')]=_[_0xd7d8('0x1c')](config[_0xd7d8('0x1b')],{'host':_0xd7d8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7d8('0x1b')]));require(_0xd7d8('0x1e'))['register'](socket);function respondWithStatusCode(_0x141a5e,_0x1b87bb){_0x1b87bb=_0x1b87bb||0xcc;return function(_0x10483d){if(_0x10483d){return _0x141a5e[_0xd7d8('0x1f')](_0x1b87bb);}return _0x141a5e[_0xd7d8('0x20')](_0x1b87bb)[_0xd7d8('0x21')]();};}function respondWithResult(_0x3611ed,_0x3d73c0){_0x3d73c0=_0x3d73c0||0xc8;return function(_0x4e4ff3){if(_0x4e4ff3){return _0x3611ed[_0xd7d8('0x20')](_0x3d73c0)['json'](_0x4e4ff3);}};}function respondWithFilteredResult(_0x3bf999,_0x240518){return function(_0x20dd8c){if(_0x20dd8c){var _0x49921a=typeof _0x240518[_0xd7d8('0x22')]===_0xd7d8('0x23')&&typeof _0x240518[_0xd7d8('0x24')]==='undefined';var _0x567de3=_0x20dd8c['count'];var _0x5885b9=_0x49921a?0x0:_0x240518[_0xd7d8('0x22')];var _0x3fd4b6=_0x49921a?_0x20dd8c[_0xd7d8('0x25')]:_0x240518[_0xd7d8('0x22')]+_0x240518[_0xd7d8('0x24')];var _0x8e1d25;if(_0x3fd4b6>=_0x567de3){_0x3fd4b6=_0x567de3;_0x8e1d25=0xc8;}else{_0x8e1d25=0xce;}_0x3bf999[_0xd7d8('0x20')](_0x8e1d25);return _0x3bf999[_0xd7d8('0x26')](_0xd7d8('0x27'),_0x5885b9+'-'+_0x3fd4b6+'/'+_0x567de3)[_0xd7d8('0x28')](_0x20dd8c);}return null;};}function patchUpdates(_0x55fe2f){return function(_0x20f77b){try{jsonpatch[_0xd7d8('0x29')](_0x20f77b,_0x55fe2f,!![]);}catch(_0x16523e){return BPromise['reject'](_0x16523e);}return _0x20f77b[_0xd7d8('0x2a')]();};}function saveUpdates(_0x362f56,_0x28af13){return function(_0x10fc30){if(_0x10fc30){return _0x10fc30[_0xd7d8('0x2b')](_0x362f56)[_0xd7d8('0x2c')](function(_0x46bfc8){return _0x46bfc8;});}return null;};}function handleEntityNotFound(_0x442386,_0x5c5b3f){return function(_0x23155e){if(!_0x23155e){_0x442386[_0xd7d8('0x1f')](0x194);}return _0x23155e;};}function handleError(_0x25cd2a,_0x497219){_0x497219=_0x497219||0x1f4;return function(_0x457a5e){logger[_0xd7d8('0x2d')](_0x457a5e[_0xd7d8('0x2e')]);if(_0x457a5e[_0xd7d8('0x2f')]){delete _0x457a5e['name'];}_0x25cd2a[_0xd7d8('0x20')](_0x497219)['send'](_0x457a5e);};}exports[_0xd7d8('0x30')]=function(_0x56f9af,_0x131f9a){var _0xd26ca8={},_0x3a75e6={},_0x53acf6={'count':0x0,'rows':[]};var _0x107f57=_[_0xd7d8('0x31')](db[_0xd7d8('0x32')]['rawAttributes'],function(_0x15408b){return{'name':_0x15408b[_0xd7d8('0x33')],'type':_0x15408b['type'][_0xd7d8('0x34')]};});_0x3a75e6[_0xd7d8('0x35')]=_[_0xd7d8('0x31')](_0x107f57,'name');_0x3a75e6[_0xd7d8('0x36')]=_['keys'](_0x56f9af['query']);_0x3a75e6['filters']=_['intersection'](_0x3a75e6[_0xd7d8('0x35')],_0x3a75e6['query']);_0xd26ca8[_0xd7d8('0x37')]=_[_0xd7d8('0x38')](_0x3a75e6[_0xd7d8('0x35')],qs[_0xd7d8('0x39')](_0x56f9af['query'][_0xd7d8('0x39')]));_0xd26ca8[_0xd7d8('0x37')]=_0xd26ca8['attributes'][_0xd7d8('0x3a')]?_0xd26ca8[_0xd7d8('0x37')]:_0x3a75e6['model'];if(!_0x56f9af[_0xd7d8('0x36')]['hasOwnProperty'](_0xd7d8('0x3b'))){_0xd26ca8[_0xd7d8('0x24')]=qs[_0xd7d8('0x24')](_0x56f9af['query'][_0xd7d8('0x24')]);_0xd26ca8[_0xd7d8('0x22')]=qs['offset'](_0x56f9af['query'][_0xd7d8('0x22')]);}_0xd26ca8[_0xd7d8('0x3c')]=qs[_0xd7d8('0x3d')](_0x56f9af[_0xd7d8('0x36')][_0xd7d8('0x3d')]);_0xd26ca8['where']=qs[_0xd7d8('0x3e')](_['pick'](_0x56f9af[_0xd7d8('0x36')],_0x3a75e6[_0xd7d8('0x3e')]),_0x107f57);if(_0x56f9af[_0xd7d8('0x36')][_0xd7d8('0x3f')]){_0xd26ca8[_0xd7d8('0x40')]=_[_0xd7d8('0x41')](_0xd26ca8[_0xd7d8('0x40')],{'$or':_[_0xd7d8('0x31')](_0x107f57,function(_0x2dbee5){if(_0x2dbee5[_0xd7d8('0x42')]!==_0xd7d8('0x43')){var _0x10fd9d={};_0x10fd9d[_0x2dbee5[_0xd7d8('0x2f')]]={'$like':'%'+_0x56f9af[_0xd7d8('0x36')][_0xd7d8('0x3f')]+'%'};return _0x10fd9d;}})});}_0xd26ca8=_[_0xd7d8('0x41')]({},_0xd26ca8,_0x56f9af[_0xd7d8('0x44')]);var _0x5772b3={'where':_0xd26ca8[_0xd7d8('0x40')]};return db[_0xd7d8('0x32')][_0xd7d8('0x25')](_0x5772b3)[_0xd7d8('0x2c')](function(_0x692a13){_0x53acf6['count']=_0x692a13;if(_0x56f9af['query']['includeAll']){_0xd26ca8['include']=[{'all':!![]}];}return db['Team'][_0xd7d8('0x45')](_0xd26ca8);})[_0xd7d8('0x2c')](function(_0x87269a){_0x53acf6[_0xd7d8('0x46')]=_0x87269a;return _0x53acf6;})[_0xd7d8('0x2c')](respondWithFilteredResult(_0x131f9a,_0xd26ca8))[_0xd7d8('0x47')](handleError(_0x131f9a,null));};exports[_0xd7d8('0x48')]=function(_0x866566,_0x5d3ec4){var _0x4b9491={'raw':![],'where':{'id':_0x866566[_0xd7d8('0x49')]['id']}},_0x51501a={};_0x51501a[_0xd7d8('0x35')]=_['keys'](db[_0xd7d8('0x32')][_0xd7d8('0x4a')]);_0x51501a[_0xd7d8('0x36')]=_[_0xd7d8('0x4b')](_0x866566[_0xd7d8('0x36')]);_0x51501a[_0xd7d8('0x3e')]=_[_0xd7d8('0x38')](_0x51501a['model'],_0x51501a[_0xd7d8('0x36')]);_0x4b9491[_0xd7d8('0x37')]=_['intersection'](_0x51501a['model'],qs[_0xd7d8('0x39')](_0x866566[_0xd7d8('0x36')][_0xd7d8('0x39')]));_0x4b9491[_0xd7d8('0x37')]=_0x4b9491[_0xd7d8('0x37')]['length']?_0x4b9491[_0xd7d8('0x37')]:_0x51501a[_0xd7d8('0x35')];if(_0x866566['query']['includeAll']){_0x4b9491[_0xd7d8('0x4c')]=[{'all':!![]}];}_0x4b9491=_[_0xd7d8('0x41')]({},_0x4b9491,_0x866566[_0xd7d8('0x44')]);return db[_0xd7d8('0x32')][_0xd7d8('0x4d')](_0x4b9491)[_0xd7d8('0x2c')](handleEntityNotFound(_0x5d3ec4,null))[_0xd7d8('0x2c')](respondWithResult(_0x5d3ec4,null))[_0xd7d8('0x47')](handleError(_0x5d3ec4,null));};exports['create']=function(_0x2528cf,_0x343ad1){return db['Team'][_0xd7d8('0x4e')](_0x2528cf[_0xd7d8('0x4f')],{})['then'](function(_0x5ab9fd){var _0x361fec=_0x2528cf['user'][_0xd7d8('0x50')]({'plain':!![]});if(!_0x361fec)throw new Error(_0xd7d8('0x51'));if(_0x361fec[_0xd7d8('0x52')]===_0xd7d8('0x53')){var _0x5f2ddc=_0x5ab9fd[_0xd7d8('0x50')]({'plain':!![]});var _0x169c40=_0xd7d8('0x54');return db[_0xd7d8('0x55')][_0xd7d8('0x4d')]({'where':{'name':_0x169c40,'userProfileId':_0x361fec[_0xd7d8('0x56')]},'raw':!![]})['then'](function(_0x1f7979){if(_0x1f7979&&_0x1f7979[_0xd7d8('0x57')]===0x0){return db[_0xd7d8('0x58')][_0xd7d8('0x4e')]({'name':_0x5f2ddc[_0xd7d8('0x2f')],'resourceId':_0x5f2ddc['id'],'type':_0x1f7979['name'],'sectionId':_0x1f7979['id']},{})['then'](function(){return _0x5ab9fd;});}else{return _0x5ab9fd;}})['catch'](function(_0x2fde92){logger[_0xd7d8('0x2d')](_0xd7d8('0x59'),_0x2fde92);throw _0x2fde92;});}return _0x5ab9fd;})[_0xd7d8('0x2c')](respondWithResult(_0x343ad1,0xc9))[_0xd7d8('0x47')](handleError(_0x343ad1,null));};exports['update']=function(_0x5f893f,_0x47531d){if(_0x5f893f['body']['id']){delete _0x5f893f[_0xd7d8('0x4f')]['id'];}return db['Team'][_0xd7d8('0x4d')]({'where':{'id':_0x5f893f[_0xd7d8('0x49')]['id']}})[_0xd7d8('0x2c')](handleEntityNotFound(_0x47531d,null))[_0xd7d8('0x2c')](saveUpdates(_0x5f893f['body'],null))[_0xd7d8('0x2c')](respondWithResult(_0x47531d,null))[_0xd7d8('0x47')](handleError(_0x47531d,null));};exports[_0xd7d8('0x5a')]=function(_0x8e04b0,_0x3396b6){var _0x5ee368=_0x8e04b0['params']['id'];var _0x238a1b=[];return db[_0xd7d8('0x5b')][_0xd7d8('0x5c')](function(_0x2925cf){var _0x221cfd='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5ee368;return db[_0xd7d8('0x5b')][_0xd7d8('0x36')](_0x221cfd,{'type':db[_0xd7d8('0x5d')][_0xd7d8('0x5e')]['SELECT'],'raw':!![],'transaction':_0x2925cf})[_0xd7d8('0x2c')](function(_0xb0accc){_0x238a1b=_['map'](_0xb0accc,function(_0x13de0f){return Number(_0x13de0f['UserId']);});})[_0xd7d8('0x2c')](function(){var _0x54819f='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ee368;return db[_0xd7d8('0x5b')][_0xd7d8('0x36')](_0x54819f,{'type':db[_0xd7d8('0x5d')][_0xd7d8('0x5e')][_0xd7d8('0x5f')],'raw':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x8438d8){var _0x59a87e=_[_0xd7d8('0x31')](_0x8438d8,function(_0x2ff40d){return Number(_0x2ff40d[_0xd7d8('0x60')]);});return db[_0xd7d8('0x61')][_0xd7d8('0x5a')]({'where':{'UserId':{'$in':_0x238a1b},'VoiceQueueId':{'$in':_0x59a87e}},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){var _0xe07e20='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ee368;return db[_0xd7d8('0x5b')][_0xd7d8('0x36')](_0xe07e20,{'type':db[_0xd7d8('0x5d')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2925cf});})['then'](function(_0x474ac0){var _0x3bb674=_[_0xd7d8('0x31')](_0x474ac0,function(_0x275ccb){return Number(_0x275ccb['MailQueueId']);});return db[_0xd7d8('0x62')]['destroy']({'where':{'UserId':{'$in':_0x238a1b},'MailQueueId':{'$in':_0x3bb674}},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){var _0x50cd93='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ee368;return db[_0xd7d8('0x5b')][_0xd7d8('0x36')](_0x50cd93,{'type':db[_0xd7d8('0x5d')][_0xd7d8('0x5e')][_0xd7d8('0x5f')],'raw':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x275173){var _0x125990=_[_0xd7d8('0x31')](_0x275173,function(_0x7dfd10){return Number(_0x7dfd10['SmsQueueId']);});return db[_0xd7d8('0x63')][_0xd7d8('0x5a')]({'where':{'UserId':{'$in':_0x238a1b},'SmsQueueId':{'$in':_0x125990}},'transaction':_0x2925cf});})['then'](function(){var _0x38de22='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ee368;return db[_0xd7d8('0x5b')]['query'](_0x38de22,{'type':db[_0xd7d8('0x5d')]['QueryTypes'][_0xd7d8('0x5f')],'raw':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x5d3760){var _0xf0de1c=_[_0xd7d8('0x31')](_0x5d3760,function(_0x2a66be){return Number(_0x2a66be[_0xd7d8('0x64')]);});return db[_0xd7d8('0x65')]['destroy']({'where':{'UserId':{'$in':_0x238a1b},'ChatQueueId':{'$in':_0xf0de1c}},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){var _0x3f1242='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5ee368;return db[_0xd7d8('0x5b')][_0xd7d8('0x36')](_0x3f1242,{'type':db['Sequelize']['QueryTypes'][_0xd7d8('0x5f')],'raw':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x5559ad){var _0x146ecd=_[_0xd7d8('0x31')](_0x5559ad,function(_0x11dc7b){return Number(_0x11dc7b[_0xd7d8('0x66')]);});return db[_0xd7d8('0x67')][_0xd7d8('0x5a')]({'where':{'UserId':{'$in':_0x238a1b},'FaxQueueId':{'$in':_0x146ecd}},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){var _0x1499c0=_0xd7d8('0x68')+_0x5ee368;return db[_0xd7d8('0x5b')][_0xd7d8('0x36')](_0x1499c0,{'type':db['Sequelize'][_0xd7d8('0x5e')]['SELECT'],'raw':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x52136f){var _0x338de5=_[_0xd7d8('0x31')](_0x52136f,function(_0x4c5436){return Number(_0x4c5436[_0xd7d8('0x69')]);});return db[_0xd7d8('0x6a')][_0xd7d8('0x5a')]({'where':{'UserId':{'$in':_0x238a1b},'OpenchannelQueueId':{'$in':_0x338de5}},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){var _0x538730=_0xd7d8('0x6b')+_0x5ee368;return db[_0xd7d8('0x5b')]['query'](_0x538730,{'type':db[_0xd7d8('0x5d')][_0xd7d8('0x5e')][_0xd7d8('0x5f')],'raw':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x1a0692){var _0x4e0a40=_[_0xd7d8('0x31')](_0x1a0692,function(_0x464270){return Number(_0x464270[_0xd7d8('0x6c')]);});return db[_0xd7d8('0x6d')][_0xd7d8('0x5a')]({'where':{'UserId':{'$in':_0x238a1b},'WhatsappQueueId':{'$in':_0x4e0a40}},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){return db[_0xd7d8('0x6e')]['find']({'where':{'TeamId':_0x5ee368}});})[_0xd7d8('0x2c')](function(_0x24edae){if(_0x24edae===null){return;}return db[_0xd7d8('0x6f')][_0xd7d8('0x5a')]({'where':{'UserId':{'$in':_0x238a1b},'VoicePrefixId':_0x24edae[_0xd7d8('0x70')]},'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(){return db[_0xd7d8('0x32')][_0xd7d8('0x5a')]({'where':{'id':_0x5ee368},'cascade':!![],'transaction':_0x2925cf});})[_0xd7d8('0x2c')](function(_0x42bd54){if(_0x42bd54===0x0){_0x3396b6['sendStatus'](0x194);}else{return db[_0xd7d8('0x58')]['destroy']({'where':{'type':_0xd7d8('0x54'),'resourceId':_0x5ee368},'cascade':!![],'transaction':_0x2925cf})[_0xd7d8('0x2c')](function(){_0x3396b6[_0xd7d8('0x20')](0xcc)[_0xd7d8('0x21')]();});}})['catch'](function(_0x29c34f){_0x3396b6['status'](0x1f4)[_0xd7d8('0x71')](_0x29c34f);});});};exports[_0xd7d8('0x72')]=function(_0x29c759,_0x571ee2,_0x499be9){return db['Team']['findOne']({'where':{'id':_0x29c759[_0xd7d8('0x49')]['id']}})[_0xd7d8('0x2c')](handleEntityNotFound(_0x571ee2,null))['then'](function(_0x33e634){if(!_0x29c759['query'][_0xd7d8('0x73')]||!utils[_0xd7d8('0x74')](_0x29c759[_0xd7d8('0x36')][_0xd7d8('0x73')])){throw new db[(_0xd7d8('0x5d'))][(_0xd7d8('0x75'))](_0xd7d8('0x76'));}var _0x320b1e={};var _0xaed403={};_0xaed403[_0xd7d8('0x35')]=_[_0xd7d8('0x4b')](db[_[_0xd7d8('0x77')](_0x29c759[_0xd7d8('0x36')]['channel'][_0xd7d8('0x78')]())+'Queue'][_0xd7d8('0x4a')]);_0xaed403[_0xd7d8('0x36')]=_[_0xd7d8('0x4b')](_0x29c759[_0xd7d8('0x36')]);_0xaed403[_0xd7d8('0x3e')]=_[_0xd7d8('0x38')](_0xaed403[_0xd7d8('0x35')],_0xaed403[_0xd7d8('0x36')]);_0x320b1e[_0xd7d8('0x37')]=_[_0xd7d8('0x38')](_0xaed403['model'],qs[_0xd7d8('0x39')](_0x29c759[_0xd7d8('0x36')][_0xd7d8('0x39')]));_0x320b1e[_0xd7d8('0x37')]=_0x320b1e['attributes'][_0xd7d8('0x3a')]?_0x320b1e[_0xd7d8('0x37')]:_0xaed403[_0xd7d8('0x35')];_0x320b1e['limit']=qs[_0xd7d8('0x24')](_0x29c759['query'][_0xd7d8('0x24')]);_0x320b1e[_0xd7d8('0x22')]=qs['offset'](_0x29c759['query'][_0xd7d8('0x22')]);_0x320b1e[_0xd7d8('0x3c')]=qs[_0xd7d8('0x3d')](_0x29c759[_0xd7d8('0x36')][_0xd7d8('0x3d')]);_0x320b1e[_0xd7d8('0x40')]=qs[_0xd7d8('0x3e')](_[_0xd7d8('0x79')](_0x29c759[_0xd7d8('0x36')],_0xaed403[_0xd7d8('0x3e')]));_0x320b1e=_[_0xd7d8('0x41')]({},_0x320b1e,_0x29c759[_0xd7d8('0x44')]);return _0x33e634[_0xd7d8('0x50')+_[_0xd7d8('0x77')](_0x29c759[_0xd7d8('0x36')][_0xd7d8('0x73')][_0xd7d8('0x78')]())+_0xd7d8('0x7a')](_0x320b1e);})[_0xd7d8('0x2c')](respondWithResult(_0x571ee2,null))[_0xd7d8('0x47')](handleError(_0x571ee2,null));};exports['addQueues']=function(_0x50981a,_0x251562,_0x459023){return db[_0xd7d8('0x32')][_0xd7d8('0x7b')]({'where':{'id':_0x50981a[_0xd7d8('0x49')]['id']}})['then'](function(_0x3813a1){if(_0x3813a1){if(!_0x50981a[_0xd7d8('0x4f')][_0xd7d8('0x73')]||!utils[_0xd7d8('0x74')](_0x50981a['body'][_0xd7d8('0x73')])){throw new db[(_0xd7d8('0x5d'))][(_0xd7d8('0x75'))](_0xd7d8('0x76'));}return _0x3813a1[_0xd7d8('0x7c')+_[_0xd7d8('0x77')](_0x50981a[_0xd7d8('0x4f')]['channel'][_0xd7d8('0x78')]())+_0xd7d8('0x7a')](_0x50981a['body'][_0xd7d8('0x7d')]);}return null;})[_0xd7d8('0x2c')](handleEntityNotFound(_0x251562,null))['then'](respondWithStatusCode(_0x251562,null))[_0xd7d8('0x47')](handleError(_0x251562,null));};exports[_0xd7d8('0x7e')]=function(_0x30da6b,_0x48c9cf,_0x840c47){return db[_0xd7d8('0x32')][_0xd7d8('0x7b')]({'where':{'id':_0x30da6b[_0xd7d8('0x49')]['id']}})[_0xd7d8('0x2c')](function(_0x4c9624){if(_0x4c9624){if(!_0x30da6b[_0xd7d8('0x36')][_0xd7d8('0x73')]||!utils[_0xd7d8('0x74')](_0x30da6b['query'][_0xd7d8('0x73')])){throw new db[(_0xd7d8('0x5d'))][(_0xd7d8('0x75'))](_0xd7d8('0x76'));}return _0x4c9624[_0xd7d8('0x7f')+_[_0xd7d8('0x77')](_0x30da6b[_0xd7d8('0x36')][_0xd7d8('0x73')]['toLowerCase']())+_0xd7d8('0x7a')](_0x30da6b[_0xd7d8('0x36')][_0xd7d8('0x7d')]);}return null;})[_0xd7d8('0x2c')](handleEntityNotFound(_0x48c9cf,null))[_0xd7d8('0x2c')](respondWithStatusCode(_0x48c9cf,null))[_0xd7d8('0x47')](handleError(_0x48c9cf,null));};exports[_0xd7d8('0x80')]=function(_0x5b7782,_0x355509){var _0x2eea22=_['isArray'](_0x5b7782[_0xd7d8('0x4f')][_0xd7d8('0x7d')])?_0x5b7782[_0xd7d8('0x4f')][_0xd7d8('0x7d')]:[_0x5b7782[_0xd7d8('0x4f')]['ids']];var _0x3e88bc=_0x5b7782[_0xd7d8('0x49')]['id'];return db[_0xd7d8('0x32')][_0xd7d8('0x4d')]({'where':{'id':_0x3e88bc}})['then'](handleEntityNotFound(_0x355509,null))[_0xd7d8('0x2c')](function(_0x5923e4){if(_0x5923e4){var _0x384aaa=['Voice','Chat','Mail',_0xd7d8('0x81'),_0xd7d8('0x82'),_0xd7d8('0x83'),_0xd7d8('0x84')];return db[_0xd7d8('0x5b')][_0xd7d8('0x5c')](function(_0x3c0dc0){var _0x98f850=_[_0xd7d8('0x31')](_0x384aaa,function(_0x575d6a){var _0x4fcf43={'attributes':['id',_0xd7d8('0x2f')]};if(_0x575d6a===_0xd7d8('0x85')){_0x4fcf43[_0xd7d8('0x86')]={'attributes':['penalty']};}return _0x5923e4[_0xd7d8('0x50')+_0x575d6a+'Queues'](_0x4fcf43)[_0xd7d8('0x2c')](function(_0x4b29f3){var _0x40d061=_['map'](_0x4b29f3,function(_0xdac5b8){var _0x4ff99f=_[_0xd7d8('0x31')](_0x2eea22,function(_0xbc9d84){var _0x3be387={'where':{'UserId':_0xbc9d84,[_0x575d6a+_0xd7d8('0x87')]:_0xdac5b8['id']},'transaction':_0x3c0dc0};if(_0x575d6a==='Voice'){_0x3be387[_0xd7d8('0x1c')]={'penalty':_0xdac5b8[_0xd7d8('0x88')][_0xd7d8('0x89')]};}return db[_0xd7d8('0x8a')+_0x575d6a+'Queue'][_0xd7d8('0x8b')](_0x3be387)[_0xd7d8('0x2c')](function(){socket[_0xd7d8('0x8c')](_0xd7d8('0x53')+_0x575d6a+'Queue:save',{'UserId':_0xbc9d84,[_0x575d6a+'QueueId']:_0xdac5b8['id']});if(_0x575d6a!=='Voice'){return;}return db[_0xd7d8('0x8a')][_0xd7d8('0x45')]({'where':{'id':_0x2eea22,'online':0x1},'attributes':['id','name',_0xd7d8('0x8d'),_0xd7d8('0x8e'),'interface'],'raw':!![]})[_0xd7d8('0x2c')](function(_0x568277){var _0x47227c=_[_0xd7d8('0x31')](_0x568277,function(_0x3cfa84){return db[_0xd7d8('0x8f')]['upsert']({'membername':_0x3cfa84[_0xd7d8('0x2f')],'UserId':_0x3cfa84['id'],'queue_name':_0xdac5b8[_0xd7d8('0x2f')],'VoiceQueueId':_0xdac5b8['id'],'interface':_[_0xd7d8('0x90')](_0x3cfa84[_0xd7d8('0x91')])?util['format'](_0xd7d8('0x92'),_0x3cfa84[_0xd7d8('0x2f')]):_0x3cfa84[_0xd7d8('0x91')],'paused':_0x3cfa84[_0xd7d8('0x8e')]||![],'penalty':_0xdac5b8[_0xd7d8('0x88')]['penalty']},{'transaction':_0x3c0dc0});});return Promise[_0xd7d8('0x93')](_0x47227c);});});});return Promise['all'](_0x4ff99f);});return Promise[_0xd7d8('0x93')](_0x40d061);})['then'](function(){return db[_0xd7d8('0x6e')][_0xd7d8('0x7b')]({'where':{'teamId':_0x3e88bc}})[_0xd7d8('0x2c')](function(_0x45f953){if(_0x45f953){var _0x3c43c5=_[_0xd7d8('0x31')](_0x2eea22,function(_0x35799a){db[_0xd7d8('0x6f')][_0xd7d8('0x94')]({'UserId':_0x35799a,'VoicePrefixId':_0x45f953[_0xd7d8('0x70')]});});return Promise[_0xd7d8('0x93')](_0x3c43c5);}});});});return Promise[_0xd7d8('0x93')](_0x98f850)[_0xd7d8('0x2c')](function(){return _0x5923e4[_0xd7d8('0x80')](_0x2eea22,{'transaction':_0x3c0dc0})[_0xd7d8('0x95')](function(_0x19a3db){return _0x19a3db;});});});}})[_0xd7d8('0x2c')](respondWithResult(_0x355509,null))[_0xd7d8('0x47')](handleError(_0x355509,null));};exports['removeAgents']=function(_0x55c2e3,_0x48b737){var _0x2fda64=_['isArray'](_0x55c2e3[_0xd7d8('0x36')]['ids'])?_0x55c2e3[_0xd7d8('0x36')][_0xd7d8('0x7d')]:[_0x55c2e3[_0xd7d8('0x36')]['ids']];var _0x28be17=_0x55c2e3[_0xd7d8('0x49')]['id'];return db[_0xd7d8('0x32')][_0xd7d8('0x4d')]({'where':{'id':_0x28be17}})['then'](handleEntityNotFound(_0x48b737,null))[_0xd7d8('0x2c')](function(_0x188e42){if(_0x188e42){var _0x4dc5b6=[_0xd7d8('0x85'),_0xd7d8('0x96'),_0xd7d8('0x97'),_0xd7d8('0x81'),_0xd7d8('0x82'),_0xd7d8('0x83'),'Whatsapp'];return db['sequelize'][_0xd7d8('0x5c')](function(_0x2f4b3e){var _0x4c3888=_[_0xd7d8('0x31')](_0x4dc5b6,function(_0x2b5656){var _0x239d3a={'attributes':['id',_0xd7d8('0x2f')]};return _0x188e42[_0xd7d8('0x50')+_0x2b5656+_0xd7d8('0x7a')](_0x239d3a)['then'](function(_0x31c30a){var _0x2c128c=_[_0xd7d8('0x31')](_0x31c30a,function(_0x5db38d){return _0x5db38d[_0xd7d8('0x98')](_0x2fda64,{'transaction':_0x2f4b3e})['then'](function(){var _0x46e2f3=_[_0xd7d8('0x31')](_0x2fda64,function(_0x1c13ef){socket[_0xd7d8('0x8c')]('user'+_0x2b5656+_0xd7d8('0x99'),{'UserId':Number(_0x1c13ef),[_0x2b5656+_0xd7d8('0x87')]:_0x5db38d['id']});if(_0x2b5656!=='Voice'){return;}return db[_0xd7d8('0x8f')][_0xd7d8('0x5a')]({'where':{'VoiceQueueId':_0x5db38d['id'],'UserId':_0x1c13ef},'transaction':_0x2f4b3e});});return Promise[_0xd7d8('0x93')](_0x46e2f3);});});return Promise['all'](_0x2c128c);});});return Promise[_0xd7d8('0x93')](_0x4c3888)[_0xd7d8('0x2c')](function(){return _0x188e42[_0xd7d8('0x98')](_0x2fda64,{'transaction':_0x2f4b3e});})[_0xd7d8('0x2c')](function(){return db[_0xd7d8('0x6e')][_0xd7d8('0x7b')]({'where':{'teamId':_0x28be17}})[_0xd7d8('0x2c')](function(_0x3f2c0c){if(_0x3f2c0c){var _0x45dc2c=_[_0xd7d8('0x31')](_0x2fda64,function(_0x4e9838){db[_0xd7d8('0x6f')][_0xd7d8('0x5a')]({'where':{'UserId':_0x4e9838,'VoicePrefixId':_0x3f2c0c['VoicePrefixId']}});});return Promise[_0xd7d8('0x93')](_0x45dc2c);}});});});}})[_0xd7d8('0x2c')](respondWithStatusCode(_0x48b737,null))['catch'](handleError(_0x48b737,null));};exports[_0xd7d8('0x9a')]=function(_0x4a24bf,_0x415a7a,_0x2c4f0d){var _0x47bd45={};var _0x1ada4b={};var _0x3b46e3;var _0x540857;return db[_0xd7d8('0x32')]['findOne']({'where':{'id':_0x4a24bf[_0xd7d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x415a7a,null))['then'](function(_0x1bbe32){if(_0x1bbe32){_0x3b46e3=_0x1bbe32;_0x1ada4b[_0xd7d8('0x35')]=_[_0xd7d8('0x4b')](db[_0xd7d8('0x8a')][_0xd7d8('0x4a')]);_0x1ada4b['query']=_[_0xd7d8('0x4b')](_0x4a24bf[_0xd7d8('0x36')]);_0x1ada4b[_0xd7d8('0x3e')]=_[_0xd7d8('0x38')](_0x1ada4b[_0xd7d8('0x35')],_0x1ada4b['query']);_0x47bd45[_0xd7d8('0x37')]=_[_0xd7d8('0x38')](_0x1ada4b[_0xd7d8('0x35')],qs[_0xd7d8('0x39')](_0x4a24bf['query'][_0xd7d8('0x39')]));_0x47bd45[_0xd7d8('0x37')]=_0x47bd45[_0xd7d8('0x37')][_0xd7d8('0x3a')]?_0x47bd45['attributes']:_0x1ada4b[_0xd7d8('0x35')];_0x47bd45[_0xd7d8('0x3c')]=qs[_0xd7d8('0x3d')](_0x4a24bf['query']['sort']);_0x47bd45[_0xd7d8('0x40')]=qs[_0xd7d8('0x3e')](_['pick'](_0x4a24bf[_0xd7d8('0x36')],_0x1ada4b['filters']));if(_0x4a24bf['query']['filter']){_0x47bd45['where']=_[_0xd7d8('0x41')](_0x47bd45[_0xd7d8('0x40')],{'$or':_[_0xd7d8('0x31')](_0x47bd45['attributes'],function(_0x940ae9){var _0x2ad039={};_0x2ad039[_0x940ae9]={'$like':'%'+_0x4a24bf[_0xd7d8('0x36')]['filter']+'%'};return _0x2ad039;})});}_0x47bd45=_['merge']({},_0x47bd45,_0x4a24bf[_0xd7d8('0x44')]);return _0x3b46e3[_0xd7d8('0x9a')](_0x47bd45);}})[_0xd7d8('0x2c')](function(_0x591825){if(_0x591825){_0x540857=_0x591825[_0xd7d8('0x3a')];if(!_0x4a24bf[_0xd7d8('0x36')][_0xd7d8('0x9b')](_0xd7d8('0x3b'))){_0x47bd45[_0xd7d8('0x24')]=qs[_0xd7d8('0x24')](_0x4a24bf[_0xd7d8('0x36')][_0xd7d8('0x24')]);_0x47bd45['offset']=qs[_0xd7d8('0x22')](_0x4a24bf['query']['offset']);}return _0x3b46e3[_0xd7d8('0x9a')](_0x47bd45);}})[_0xd7d8('0x2c')](function(_0x39f03c){if(_0x39f03c){return _0x39f03c?{'count':_0x540857,'rows':_0x39f03c}:null;}})[_0xd7d8('0x2c')](respondWithResult(_0x415a7a,null))[_0xd7d8('0x47')](handleError(_0x415a7a,null));}; \ No newline at end of file +var _0x5946=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','send','map','Team','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','sendStatus','Teams','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','isValidChannel','Queues','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Openchannel','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','VoicePrefixId','spread','isArray','Fax','Whatsapp','removeAgents','Queue:remove','TeamVoicePrefix','getAgents','eml-format'];(function(_0x55207a,_0x50d9e8){var _0x311988=function(_0x133c26){while(--_0x133c26){_0x55207a['push'](_0x55207a['shift']());}};_0x311988(++_0x50d9e8);}(_0x5946,0x1dc));var _0x6594=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x5946[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0x6594('0x0'));var rimraf=require(_0x6594('0x1'));var zipdir=require(_0x6594('0x2'));var jsonpatch=require(_0x6594('0x3'));var rp=require(_0x6594('0x4'));var moment=require(_0x6594('0x5'));var BPromise=require(_0x6594('0x6'));var Mustache=require('mustache');var util=require(_0x6594('0x7'));var path=require(_0x6594('0x8'));var sox=require(_0x6594('0x9'));var csv=require(_0x6594('0xa'));var ejs=require(_0x6594('0xb'));var fs=require('fs');var fs_extra=require(_0x6594('0xc'));var _=require(_0x6594('0xd'));var squel=require(_0x6594('0xe'));var crypto=require(_0x6594('0xf'));var jsforce=require(_0x6594('0x10'));var deskjs=require(_0x6594('0x11'));var toCsv=require(_0x6594('0xa'));var querystring=require(_0x6594('0x12'));var Papa=require('papaparse');var Redis=require(_0x6594('0x13'));var authService=require(_0x6594('0x14'));var qs=require(_0x6594('0x15'));var as=require(_0x6594('0x16'));var hardwareService=require(_0x6594('0x17'));var logger=require(_0x6594('0x18'))(_0x6594('0x19'));var utils=require('../../config/utils');var config=require(_0x6594('0x1a'));var licenseUtil=require(_0x6594('0x1b'));var db=require(_0x6594('0x1c'))['db'];config['redis']=_[_0x6594('0x1d')](config[_0x6594('0x1e')],{'host':_0x6594('0x1f'),'port':0x18eb});var socket=require(_0x6594('0x20'))(new Redis(config[_0x6594('0x1e')]));require(_0x6594('0x21'))['register'](socket);function respondWithStatusCode(_0x11c57a,_0x5c94f7){_0x5c94f7=_0x5c94f7||0xcc;return function(_0x4eb2e0){if(_0x4eb2e0){return _0x11c57a['sendStatus'](_0x5c94f7);}return _0x11c57a[_0x6594('0x22')](_0x5c94f7)[_0x6594('0x23')]();};}function respondWithResult(_0x312a1d,_0x2e235f){_0x2e235f=_0x2e235f||0xc8;return function(_0x2828f4){if(_0x2828f4){return _0x312a1d['status'](_0x2e235f)['json'](_0x2828f4);}};}function respondWithFilteredResult(_0x38e028,_0x1d1bd0){return function(_0x3f4c99){if(_0x3f4c99){var _0x1e2f1d=typeof _0x1d1bd0['offset']===_0x6594('0x24')&&typeof _0x1d1bd0[_0x6594('0x25')]===_0x6594('0x24');var _0x437384=_0x3f4c99[_0x6594('0x26')];var _0x5bafd2=_0x1e2f1d?0x0:_0x1d1bd0[_0x6594('0x27')];var _0x44f373=_0x1e2f1d?_0x3f4c99[_0x6594('0x26')]:_0x1d1bd0['offset']+_0x1d1bd0[_0x6594('0x25')];var _0x22569c;if(_0x44f373>=_0x437384){_0x44f373=_0x437384;_0x22569c=0xc8;}else{_0x22569c=0xce;}_0x38e028[_0x6594('0x22')](_0x22569c);return _0x38e028[_0x6594('0x28')]('Content-Range',_0x5bafd2+'-'+_0x44f373+'/'+_0x437384)[_0x6594('0x29')](_0x3f4c99);}return null;};}function patchUpdates(_0x21d977){return function(_0x1c4a01){try{jsonpatch[_0x6594('0x2a')](_0x1c4a01,_0x21d977,!![]);}catch(_0x43ff4c){return BPromise['reject'](_0x43ff4c);}return _0x1c4a01[_0x6594('0x2b')]();};}function saveUpdates(_0x476155,_0xa1bc48){return function(_0x499ed4){if(_0x499ed4){return _0x499ed4[_0x6594('0x2c')](_0x476155)[_0x6594('0x2d')](function(_0xe8b371){return _0xe8b371;});}return null;};}function handleEntityNotFound(_0x386406,_0x33f271){return function(_0x886a52){if(!_0x886a52){_0x386406['sendStatus'](0x194);}return _0x886a52;};}function handleError(_0x2e9f28,_0xce6377){_0xce6377=_0xce6377||0x1f4;return function(_0x4bf5f2){logger[_0x6594('0x2e')](_0x4bf5f2['stack']);if(_0x4bf5f2['name']){delete _0x4bf5f2['name'];}_0x2e9f28[_0x6594('0x22')](_0xce6377)[_0x6594('0x2f')](_0x4bf5f2);};}exports['index']=function(_0x5a5230,_0x352637){var _0xeaa498={},_0x530241={},_0x31b960={'count':0x0,'rows':[]};var _0x124a07=_[_0x6594('0x30')](db[_0x6594('0x31')][_0x6594('0x32')],function(_0x57c27c){return{'name':_0x57c27c[_0x6594('0x33')],'type':_0x57c27c[_0x6594('0x34')][_0x6594('0x35')]};});_0x530241[_0x6594('0x36')]=_[_0x6594('0x30')](_0x124a07,_0x6594('0x37'));_0x530241[_0x6594('0x38')]=_[_0x6594('0x39')](_0x5a5230[_0x6594('0x38')]);_0x530241[_0x6594('0x3a')]=_[_0x6594('0x3b')](_0x530241[_0x6594('0x36')],_0x530241['query']);_0xeaa498[_0x6594('0x3c')]=_['intersection'](_0x530241[_0x6594('0x36')],qs['fields'](_0x5a5230['query'][_0x6594('0x3d')]));_0xeaa498[_0x6594('0x3c')]=_0xeaa498[_0x6594('0x3c')][_0x6594('0x3e')]?_0xeaa498[_0x6594('0x3c')]:_0x530241[_0x6594('0x36')];if(!_0x5a5230[_0x6594('0x38')]['hasOwnProperty'](_0x6594('0x3f'))){_0xeaa498['limit']=qs[_0x6594('0x25')](_0x5a5230['query']['limit']);_0xeaa498[_0x6594('0x27')]=qs['offset'](_0x5a5230[_0x6594('0x38')][_0x6594('0x27')]);}_0xeaa498[_0x6594('0x40')]=qs[_0x6594('0x41')](_0x5a5230[_0x6594('0x38')][_0x6594('0x41')]);_0xeaa498[_0x6594('0x42')]=qs[_0x6594('0x3a')](_[_0x6594('0x43')](_0x5a5230[_0x6594('0x38')],_0x530241[_0x6594('0x3a')]),_0x124a07);if(_0x5a5230['query'][_0x6594('0x44')]){_0xeaa498[_0x6594('0x42')]=_[_0x6594('0x45')](_0xeaa498[_0x6594('0x42')],{'$or':_[_0x6594('0x30')](_0x124a07,function(_0x3b9686){if(_0x3b9686['type']!==_0x6594('0x46')){var _0x170a70={};_0x170a70[_0x3b9686[_0x6594('0x37')]]={'$like':'%'+_0x5a5230[_0x6594('0x38')]['filter']+'%'};return _0x170a70;}})});}_0xeaa498=_[_0x6594('0x45')]({},_0xeaa498,_0x5a5230[_0x6594('0x47')]);var _0x346a05={'where':_0xeaa498[_0x6594('0x42')]};return db[_0x6594('0x31')][_0x6594('0x26')](_0x346a05)[_0x6594('0x2d')](function(_0x53893d){_0x31b960['count']=_0x53893d;if(_0x5a5230[_0x6594('0x38')][_0x6594('0x48')]){_0xeaa498[_0x6594('0x49')]=[{'all':!![]}];}return db['Team'][_0x6594('0x4a')](_0xeaa498);})['then'](function(_0x5b80e6){_0x31b960[_0x6594('0x4b')]=_0x5b80e6;return _0x31b960;})['then'](respondWithFilteredResult(_0x352637,_0xeaa498))[_0x6594('0x4c')](handleError(_0x352637,null));};exports[_0x6594('0x4d')]=function(_0x2cdc8d,_0x3ec793){var _0x24e815={'raw':![],'where':{'id':_0x2cdc8d[_0x6594('0x4e')]['id']}},_0x3db9ad={};_0x3db9ad['model']=_[_0x6594('0x39')](db[_0x6594('0x31')]['rawAttributes']);_0x3db9ad['query']=_[_0x6594('0x39')](_0x2cdc8d[_0x6594('0x38')]);_0x3db9ad[_0x6594('0x3a')]=_['intersection'](_0x3db9ad[_0x6594('0x36')],_0x3db9ad['query']);_0x24e815['attributes']=_['intersection'](_0x3db9ad[_0x6594('0x36')],qs[_0x6594('0x3d')](_0x2cdc8d[_0x6594('0x38')][_0x6594('0x3d')]));_0x24e815[_0x6594('0x3c')]=_0x24e815[_0x6594('0x3c')]['length']?_0x24e815[_0x6594('0x3c')]:_0x3db9ad['model'];if(_0x2cdc8d['query'][_0x6594('0x48')]){_0x24e815[_0x6594('0x49')]=[{'all':!![]}];}_0x24e815=_['merge']({},_0x24e815,_0x2cdc8d[_0x6594('0x47')]);return db['Team'][_0x6594('0x4f')](_0x24e815)[_0x6594('0x2d')](handleEntityNotFound(_0x3ec793,null))[_0x6594('0x2d')](respondWithResult(_0x3ec793,null))['catch'](handleError(_0x3ec793,null));};exports[_0x6594('0x50')]=function(_0x3fc7bd,_0x57d7cf){return db[_0x6594('0x31')][_0x6594('0x50')](_0x3fc7bd['body'],{})[_0x6594('0x2d')](function(_0x3b27cb){var _0xfc1469=_0x3fc7bd[_0x6594('0x51')][_0x6594('0x52')]({'plain':!![]});if(!_0xfc1469)throw new Error(_0x6594('0x53'));if(_0xfc1469[_0x6594('0x54')]==='user'){var _0x1189ab=_0x3b27cb[_0x6594('0x52')]({'plain':!![]});var _0x453d09='Teams';return db[_0x6594('0x55')]['find']({'where':{'name':_0x453d09,'userProfileId':_0xfc1469['userProfileId']},'raw':!![]})['then'](function(_0x57cb49){if(_0x57cb49&&_0x57cb49[_0x6594('0x56')]===0x0){return db[_0x6594('0x57')]['create']({'name':_0x1189ab[_0x6594('0x37')],'resourceId':_0x1189ab['id'],'type':_0x57cb49[_0x6594('0x37')],'sectionId':_0x57cb49['id']},{})[_0x6594('0x2d')](function(){return _0x3b27cb;});}else{return _0x3b27cb;}})[_0x6594('0x4c')](function(_0x393fd9){logger[_0x6594('0x2e')](_0x6594('0x58'),_0x393fd9);throw _0x393fd9;});}return _0x3b27cb;})[_0x6594('0x2d')](respondWithResult(_0x57d7cf,0xc9))[_0x6594('0x4c')](handleError(_0x57d7cf,null));};exports['update']=function(_0x223c40,_0x2fec58){if(_0x223c40['body']['id']){delete _0x223c40[_0x6594('0x59')]['id'];}return db[_0x6594('0x31')][_0x6594('0x4f')]({'where':{'id':_0x223c40[_0x6594('0x4e')]['id']}})[_0x6594('0x2d')](handleEntityNotFound(_0x2fec58,null))[_0x6594('0x2d')](saveUpdates(_0x223c40[_0x6594('0x59')],null))[_0x6594('0x2d')](respondWithResult(_0x2fec58,null))[_0x6594('0x4c')](handleError(_0x2fec58,null));};exports[_0x6594('0x5a')]=function(_0x279a21,_0x514b5e){var _0x13d603=_0x279a21['params']['id'];var _0x3579b7=[];return db['sequelize']['transaction'](function(_0x3352a5){var _0x2e6c0d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x13d603;return db[_0x6594('0x5b')][_0x6594('0x38')](_0x2e6c0d,{'type':db[_0x6594('0x5c')][_0x6594('0x5d')][_0x6594('0x5e')],'raw':!![],'transaction':_0x3352a5})[_0x6594('0x2d')](function(_0x5edcfb){_0x3579b7=_[_0x6594('0x30')](_0x5edcfb,function(_0x46ee15){return Number(_0x46ee15[_0x6594('0x5f')]);});})[_0x6594('0x2d')](function(){var _0x43e639=_0x6594('0x60')+_0x13d603;return db[_0x6594('0x5b')][_0x6594('0x38')](_0x43e639,{'type':db[_0x6594('0x5c')][_0x6594('0x5d')][_0x6594('0x5e')],'raw':!![],'transaction':_0x3352a5});})[_0x6594('0x2d')](function(_0xcfae54){var _0x20ceb8=_['map'](_0xcfae54,function(_0x155d75){return Number(_0x155d75[_0x6594('0x61')]);});return db[_0x6594('0x62')][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'VoiceQueueId':{'$in':_0x20ceb8}},'transaction':_0x3352a5});})['then'](function(){var _0x19dd81=_0x6594('0x63')+_0x13d603;return db[_0x6594('0x5b')][_0x6594('0x38')](_0x19dd81,{'type':db[_0x6594('0x5c')][_0x6594('0x5d')][_0x6594('0x5e')],'raw':!![],'transaction':_0x3352a5});})['then'](function(_0x1f640f){var _0x4d9d45=_[_0x6594('0x30')](_0x1f640f,function(_0x24c083){return Number(_0x24c083['MailQueueId']);});return db[_0x6594('0x64')][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'MailQueueId':{'$in':_0x4d9d45}},'transaction':_0x3352a5});})[_0x6594('0x2d')](function(){var _0x11a359=_0x6594('0x65')+_0x13d603;return db[_0x6594('0x5b')][_0x6594('0x38')](_0x11a359,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3352a5});})[_0x6594('0x2d')](function(_0x20ded6){var _0x10fd22=_[_0x6594('0x30')](_0x20ded6,function(_0xbc34af){return Number(_0xbc34af[_0x6594('0x66')]);});return db[_0x6594('0x67')][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'SmsQueueId':{'$in':_0x10fd22}},'transaction':_0x3352a5});})['then'](function(){var _0x3e26bf=_0x6594('0x68')+_0x13d603;return db['sequelize'][_0x6594('0x38')](_0x3e26bf,{'type':db[_0x6594('0x5c')][_0x6594('0x5d')][_0x6594('0x5e')],'raw':!![],'transaction':_0x3352a5});})[_0x6594('0x2d')](function(_0x1d9604){var _0x28df76=_['map'](_0x1d9604,function(_0x13cd00){return Number(_0x13cd00[_0x6594('0x69')]);});return db['UserChatQueue'][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'ChatQueueId':{'$in':_0x28df76}},'transaction':_0x3352a5});})[_0x6594('0x2d')](function(){var _0x27e912=_0x6594('0x6a')+_0x13d603;return db['sequelize'][_0x6594('0x38')](_0x27e912,{'type':db[_0x6594('0x5c')][_0x6594('0x5d')][_0x6594('0x5e')],'raw':!![],'transaction':_0x3352a5});})['then'](function(_0x3a5661){var _0x12101d=_['map'](_0x3a5661,function(_0x4695e1){return Number(_0x4695e1[_0x6594('0x6b')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x3579b7},'FaxQueueId':{'$in':_0x12101d}},'transaction':_0x3352a5});})[_0x6594('0x2d')](function(){var _0x3d7451=_0x6594('0x6c')+_0x13d603;return db[_0x6594('0x5b')][_0x6594('0x38')](_0x3d7451,{'type':db[_0x6594('0x5c')][_0x6594('0x5d')][_0x6594('0x5e')],'raw':!![],'transaction':_0x3352a5});})[_0x6594('0x2d')](function(_0x2fbbe2){var _0xfe111a=_[_0x6594('0x30')](_0x2fbbe2,function(_0x314163){return Number(_0x314163['OpenchannelQueueId']);});return db[_0x6594('0x6d')][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'OpenchannelQueueId':{'$in':_0xfe111a}},'transaction':_0x3352a5});})['then'](function(){var _0x126f3a=_0x6594('0x6e')+_0x13d603;return db[_0x6594('0x5b')][_0x6594('0x38')](_0x126f3a,{'type':db[_0x6594('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3352a5});})[_0x6594('0x2d')](function(_0x227d33){var _0x41dc58=_[_0x6594('0x30')](_0x227d33,function(_0x39a533){return Number(_0x39a533[_0x6594('0x6f')]);});return db['UserWhatsappQueue'][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'WhatsappQueueId':{'$in':_0x41dc58}},'transaction':_0x3352a5});})[_0x6594('0x2d')](function(){return db['TeamVoicePrefix'][_0x6594('0x4f')]({'where':{'TeamId':_0x13d603}});})[_0x6594('0x2d')](function(_0x2b8947){if(_0x2b8947===null){return;}return db[_0x6594('0x70')][_0x6594('0x5a')]({'where':{'UserId':{'$in':_0x3579b7},'VoicePrefixId':_0x2b8947['VoicePrefixId']},'transaction':_0x3352a5});})[_0x6594('0x2d')](function(){return db[_0x6594('0x31')]['destroy']({'where':{'id':_0x13d603},'cascade':!![],'transaction':_0x3352a5});})['then'](function(_0x4ce277){if(_0x4ce277===0x0){_0x514b5e[_0x6594('0x71')](0x194);}else{return db[_0x6594('0x57')]['destroy']({'where':{'type':_0x6594('0x72'),'resourceId':_0x13d603},'cascade':!![],'transaction':_0x3352a5})[_0x6594('0x2d')](function(){_0x514b5e[_0x6594('0x22')](0xcc)['end']();});}})[_0x6594('0x4c')](function(_0x4ebe81){_0x514b5e[_0x6594('0x22')](0x1f4)[_0x6594('0x2f')](_0x4ebe81);});});};exports[_0x6594('0x73')]=function(_0x466a40,_0x562798,_0x1c8680){return db[_0x6594('0x31')][_0x6594('0x74')]({'where':{'id':_0x466a40[_0x6594('0x4e')]['id']}})[_0x6594('0x2d')](handleEntityNotFound(_0x562798,null))[_0x6594('0x2d')](function(_0x2964fb){if(!_0x466a40[_0x6594('0x38')][_0x6594('0x75')]||!utils['isValidChannel'](_0x466a40[_0x6594('0x38')][_0x6594('0x75')])){throw new db[(_0x6594('0x5c'))][(_0x6594('0x76'))](_0x6594('0x77'));}var _0x34941f={};var _0x1d293e={};_0x1d293e[_0x6594('0x36')]=_[_0x6594('0x39')](db[_[_0x6594('0x78')](_0x466a40[_0x6594('0x38')][_0x6594('0x75')][_0x6594('0x79')]())+_0x6594('0x7a')][_0x6594('0x32')]);_0x1d293e[_0x6594('0x38')]=_[_0x6594('0x39')](_0x466a40[_0x6594('0x38')]);_0x1d293e[_0x6594('0x3a')]=_[_0x6594('0x3b')](_0x1d293e['model'],_0x1d293e[_0x6594('0x38')]);_0x34941f['attributes']=_[_0x6594('0x3b')](_0x1d293e[_0x6594('0x36')],qs[_0x6594('0x3d')](_0x466a40[_0x6594('0x38')][_0x6594('0x3d')]));_0x34941f['attributes']=_0x34941f['attributes'][_0x6594('0x3e')]?_0x34941f[_0x6594('0x3c')]:_0x1d293e[_0x6594('0x36')];_0x34941f[_0x6594('0x25')]=qs[_0x6594('0x25')](_0x466a40[_0x6594('0x38')][_0x6594('0x25')]);_0x34941f[_0x6594('0x27')]=qs[_0x6594('0x27')](_0x466a40[_0x6594('0x38')][_0x6594('0x27')]);_0x34941f[_0x6594('0x40')]=qs[_0x6594('0x41')](_0x466a40['query'][_0x6594('0x41')]);_0x34941f[_0x6594('0x42')]=qs[_0x6594('0x3a')](_[_0x6594('0x43')](_0x466a40['query'],_0x1d293e['filters']));_0x34941f=_[_0x6594('0x45')]({},_0x34941f,_0x466a40[_0x6594('0x47')]);return _0x2964fb[_0x6594('0x52')+_['capitalize'](_0x466a40[_0x6594('0x38')]['channel'][_0x6594('0x79')]())+'Queues'](_0x34941f);})['then'](respondWithResult(_0x562798,null))[_0x6594('0x4c')](handleError(_0x562798,null));};exports[_0x6594('0x7b')]=function(_0x1a76a3,_0x3516e3,_0x1b4817){return db[_0x6594('0x31')][_0x6594('0x74')]({'where':{'id':_0x1a76a3[_0x6594('0x4e')]['id']}})[_0x6594('0x2d')](function(_0x25a2d0){if(_0x25a2d0){if(!_0x1a76a3[_0x6594('0x59')][_0x6594('0x75')]||!utils[_0x6594('0x7c')](_0x1a76a3['body'][_0x6594('0x75')])){throw new db[(_0x6594('0x5c'))]['ValidationError'](_0x6594('0x77'));}return _0x25a2d0['add'+_['capitalize'](_0x1a76a3[_0x6594('0x59')][_0x6594('0x75')]['toLowerCase']())+_0x6594('0x7d')](_0x1a76a3[_0x6594('0x59')][_0x6594('0x7e')]);}return null;})[_0x6594('0x2d')](handleEntityNotFound(_0x3516e3,null))['then'](respondWithStatusCode(_0x3516e3,null))[_0x6594('0x4c')](handleError(_0x3516e3,null));};exports[_0x6594('0x7f')]=function(_0x39c203,_0xf373e2,_0x725b18){return db['Team'][_0x6594('0x74')]({'where':{'id':_0x39c203['params']['id']}})[_0x6594('0x2d')](function(_0x6fb55b){if(_0x6fb55b){if(!_0x39c203[_0x6594('0x38')][_0x6594('0x75')]||!utils['isValidChannel'](_0x39c203[_0x6594('0x38')][_0x6594('0x75')])){throw new db['Sequelize']['ValidationError'](_0x6594('0x77'));}return _0x6fb55b['remove'+_[_0x6594('0x78')](_0x39c203[_0x6594('0x38')][_0x6594('0x75')][_0x6594('0x79')]())+_0x6594('0x7d')](_0x39c203[_0x6594('0x38')][_0x6594('0x7e')]);}return null;})[_0x6594('0x2d')](handleEntityNotFound(_0xf373e2,null))[_0x6594('0x2d')](respondWithStatusCode(_0xf373e2,null))[_0x6594('0x4c')](handleError(_0xf373e2,null));};exports[_0x6594('0x80')]=function(_0x4b3587,_0x4bf957){var _0x3e63e2=_['isArray'](_0x4b3587[_0x6594('0x59')]['ids'])?_0x4b3587[_0x6594('0x59')][_0x6594('0x7e')]:[_0x4b3587[_0x6594('0x59')]['ids']];var _0x12b342=_0x4b3587[_0x6594('0x4e')]['id'];return db['Team'][_0x6594('0x4f')]({'where':{'id':_0x12b342}})[_0x6594('0x2d')](handleEntityNotFound(_0x4bf957,null))['then'](function(_0x1c1c47){if(_0x1c1c47){var _0x329d4f=[_0x6594('0x81'),_0x6594('0x82'),_0x6594('0x83'),_0x6594('0x84'),'Fax',_0x6594('0x85'),'Whatsapp'];return db[_0x6594('0x5b')]['transaction'](function(_0x5ac12e){var _0x377b2e=_[_0x6594('0x30')](_0x329d4f,function(_0xf4b761){var _0x5e1d13={'attributes':['id',_0x6594('0x37')]};if(_0xf4b761===_0x6594('0x81')){_0x5e1d13[_0x6594('0x86')]={'attributes':['penalty']};}return _0x1c1c47[_0x6594('0x52')+_0xf4b761+_0x6594('0x7d')](_0x5e1d13)['then'](function(_0x4994a5){var _0xcc6fc1=_[_0x6594('0x30')](_0x4994a5,function(_0x546502){var _0x558f12=_['map'](_0x3e63e2,function(_0x3b6f86){var _0x4e0323={'where':{'UserId':_0x3b6f86,[_0xf4b761+_0x6594('0x87')]:_0x546502['id']},'transaction':_0x5ac12e};if(_0xf4b761===_0x6594('0x81')){_0x4e0323[_0x6594('0x1d')]={'penalty':_0x546502[_0x6594('0x88')][_0x6594('0x89')]};}return db[_0x6594('0x8a')+_0xf4b761+_0x6594('0x7a')][_0x6594('0x8b')](_0x4e0323)['then'](function(){socket[_0x6594('0x8c')]('user'+_0xf4b761+_0x6594('0x8d'),{'UserId':_0x3b6f86,[_0xf4b761+_0x6594('0x87')]:_0x546502['id']});if(_0xf4b761!=='Voice'){return;}return db[_0x6594('0x8a')][_0x6594('0x4a')]({'where':{'id':_0x3e63e2,'online':0x1},'attributes':['id','name',_0x6594('0x8e'),'voicePause',_0x6594('0x8f')],'raw':!![]})['then'](function(_0x334ea7){var _0x5001c5=_[_0x6594('0x30')](_0x334ea7,function(_0x37a8e2){return db[_0x6594('0x90')][_0x6594('0x91')]({'membername':_0x37a8e2[_0x6594('0x37')],'UserId':_0x37a8e2['id'],'queue_name':_0x546502['name'],'VoiceQueueId':_0x546502['id'],'interface':_['isNil'](_0x37a8e2['interface'])?util[_0x6594('0x92')](_0x6594('0x93'),_0x37a8e2[_0x6594('0x37')]):_0x37a8e2[_0x6594('0x8f')],'paused':_0x37a8e2[_0x6594('0x94')]||![],'penalty':_0x546502[_0x6594('0x88')][_0x6594('0x89')]},{'transaction':_0x5ac12e});});return Promise[_0x6594('0x95')](_0x5001c5);});});});return Promise[_0x6594('0x95')](_0x558f12);});return Promise[_0x6594('0x95')](_0xcc6fc1);})[_0x6594('0x2d')](function(){return db['TeamVoicePrefix'][_0x6594('0x74')]({'where':{'teamId':_0x12b342}})['then'](function(_0x7279ba){if(_0x7279ba){var _0x47e0c2=_[_0x6594('0x30')](_0x3e63e2,function(_0x2d5381){db[_0x6594('0x70')]['upsert']({'UserId':_0x2d5381,'VoicePrefixId':_0x7279ba[_0x6594('0x96')]});});return Promise['all'](_0x47e0c2);}});});});return Promise[_0x6594('0x95')](_0x377b2e)[_0x6594('0x2d')](function(){return _0x1c1c47[_0x6594('0x80')](_0x3e63e2,{'transaction':_0x5ac12e})[_0x6594('0x97')](function(_0x2695e0){return _0x2695e0;});});});}})[_0x6594('0x2d')](respondWithResult(_0x4bf957,null))[_0x6594('0x4c')](handleError(_0x4bf957,null));};exports['removeAgents']=function(_0x24ba7f,_0x389a2d){var _0x3a2b43=_[_0x6594('0x98')](_0x24ba7f[_0x6594('0x38')][_0x6594('0x7e')])?_0x24ba7f['query'][_0x6594('0x7e')]:[_0x24ba7f[_0x6594('0x38')][_0x6594('0x7e')]];var _0x1f3039=_0x24ba7f[_0x6594('0x4e')]['id'];return db[_0x6594('0x31')][_0x6594('0x4f')]({'where':{'id':_0x1f3039}})['then'](handleEntityNotFound(_0x389a2d,null))[_0x6594('0x2d')](function(_0x4847e1){if(_0x4847e1){var _0x5c496f=['Voice',_0x6594('0x82'),_0x6594('0x83'),'Sms',_0x6594('0x99'),_0x6594('0x85'),_0x6594('0x9a')];return db[_0x6594('0x5b')]['transaction'](function(_0x11ccc4){var _0x225e43=_[_0x6594('0x30')](_0x5c496f,function(_0x5b051b){var _0x2640d7={'attributes':['id',_0x6594('0x37')]};return _0x4847e1[_0x6594('0x52')+_0x5b051b+_0x6594('0x7d')](_0x2640d7)['then'](function(_0x122c2f){var _0x15b95e=_[_0x6594('0x30')](_0x122c2f,function(_0x34dd55){return _0x34dd55[_0x6594('0x9b')](_0x3a2b43,{'transaction':_0x11ccc4})[_0x6594('0x2d')](function(){var _0x2d40ce=_[_0x6594('0x30')](_0x3a2b43,function(_0xf5eb36){socket['emit'](_0x6594('0x51')+_0x5b051b+_0x6594('0x9c'),{'UserId':Number(_0xf5eb36),[_0x5b051b+_0x6594('0x87')]:_0x34dd55['id']});if(_0x5b051b!==_0x6594('0x81')){return;}return db[_0x6594('0x90')][_0x6594('0x5a')]({'where':{'VoiceQueueId':_0x34dd55['id'],'UserId':_0xf5eb36},'transaction':_0x11ccc4});});return Promise[_0x6594('0x95')](_0x2d40ce);});});return Promise[_0x6594('0x95')](_0x15b95e);});});return Promise[_0x6594('0x95')](_0x225e43)[_0x6594('0x2d')](function(){return _0x4847e1[_0x6594('0x9b')](_0x3a2b43,{'transaction':_0x11ccc4});})[_0x6594('0x2d')](function(){return db[_0x6594('0x9d')][_0x6594('0x74')]({'where':{'teamId':_0x1f3039}})[_0x6594('0x2d')](function(_0x30f39b){if(_0x30f39b){var _0x157b52=_[_0x6594('0x30')](_0x3a2b43,function(_0xfeb4f6){db[_0x6594('0x70')]['destroy']({'where':{'UserId':_0xfeb4f6,'VoicePrefixId':_0x30f39b['VoicePrefixId']}});});return Promise[_0x6594('0x95')](_0x157b52);}});});});}})['then'](respondWithStatusCode(_0x389a2d,null))[_0x6594('0x4c')](handleError(_0x389a2d,null));};exports['getAgents']=function(_0x34d57d,_0x3d6093,_0x22cf92){var _0x33fe65={};var _0x285bd4={};var _0x26beca;var _0x79add0;return db['Team']['findOne']({'where':{'id':_0x34d57d[_0x6594('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d6093,null))[_0x6594('0x2d')](function(_0x3449d5){if(_0x3449d5){_0x26beca=_0x3449d5;_0x285bd4[_0x6594('0x36')]=_['keys'](db[_0x6594('0x8a')][_0x6594('0x32')]);_0x285bd4[_0x6594('0x38')]=_['keys'](_0x34d57d[_0x6594('0x38')]);_0x285bd4['filters']=_[_0x6594('0x3b')](_0x285bd4['model'],_0x285bd4['query']);_0x33fe65[_0x6594('0x3c')]=_[_0x6594('0x3b')](_0x285bd4[_0x6594('0x36')],qs['fields'](_0x34d57d[_0x6594('0x38')][_0x6594('0x3d')]));_0x33fe65[_0x6594('0x3c')]=_0x33fe65[_0x6594('0x3c')][_0x6594('0x3e')]?_0x33fe65[_0x6594('0x3c')]:_0x285bd4['model'];_0x33fe65[_0x6594('0x40')]=qs['sort'](_0x34d57d['query'][_0x6594('0x41')]);_0x33fe65[_0x6594('0x42')]=qs['filters'](_[_0x6594('0x43')](_0x34d57d[_0x6594('0x38')],_0x285bd4[_0x6594('0x3a')]));if(_0x34d57d[_0x6594('0x38')]['filter']){_0x33fe65[_0x6594('0x42')]=_['merge'](_0x33fe65[_0x6594('0x42')],{'$or':_[_0x6594('0x30')](_0x33fe65[_0x6594('0x3c')],function(_0x1bd383){var _0x4483c6={};_0x4483c6[_0x1bd383]={'$like':'%'+_0x34d57d[_0x6594('0x38')]['filter']+'%'};return _0x4483c6;})});}_0x33fe65=_[_0x6594('0x45')]({},_0x33fe65,_0x34d57d[_0x6594('0x47')]);return _0x26beca[_0x6594('0x9e')](_0x33fe65);}})['then'](function(_0x226586){if(_0x226586){_0x79add0=_0x226586['length'];if(!_0x34d57d['query']['hasOwnProperty']('nolimit')){_0x33fe65['limit']=qs[_0x6594('0x25')](_0x34d57d[_0x6594('0x38')][_0x6594('0x25')]);_0x33fe65['offset']=qs[_0x6594('0x27')](_0x34d57d[_0x6594('0x38')][_0x6594('0x27')]);}return _0x26beca[_0x6594('0x9e')](_0x33fe65);}})[_0x6594('0x2d')](function(_0x2eb1e9){if(_0x2eb1e9){return _0x2eb1e9?{'count':_0x79add0,'rows':_0x2eb1e9}:null;}})[_0x6594('0x2d')](respondWithResult(_0x3d6093,null))[_0x6594('0x4c')](handleError(_0x3d6093,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index be5fca5..09c97d9 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 _0xf08f=['emit','hasOwnProperty','hook','Team','setMaxListeners','save','update','remove'];(function(_0xa077db,_0x51b86f){var _0x37483f=function(_0x57f55a){while(--_0x57f55a){_0xa077db['push'](_0xa077db['shift']());}};_0x37483f(++_0x51b86f);}(_0xf08f,0x1c3));var _0xff08=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0xf08f[_0x590b63];return _0x3c9380;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xff08('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0xff08('0x1')](0x0);var events={'afterCreate':_0xff08('0x2'),'afterUpdate':_0xff08('0x3'),'afterDestroy':_0xff08('0x4')};function emitEvent(_0x545908){return function(_0x27e7e3,_0xc0ffd,_0x53f1f5){TeamEvents['emit'](_0x545908+':'+_0x27e7e3['id'],_0x27e7e3);TeamEvents[_0xff08('0x5')](_0x545908,_0x27e7e3);_0x53f1f5(null);};}for(var e in events){if(events[_0xff08('0x6')](e)){var event=events[e];Team[_0xff08('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xa1a1=['save','emit','hook','exports','events','setMaxListeners'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xa1a1,0xf4));var _0x1a1a=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0xa1a1[_0x58c851];return _0x534d8a;};'use strict';var EventEmitter=require(_0x1a1a('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1a1a('0x1')](0x0);var events={'afterCreate':_0x1a1a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38fa90){return function(_0x1c2b4f,_0x29d4e3,_0x28c589){TeamEvents[_0x1a1a('0x3')](_0x38fa90+':'+_0x1c2b4f['id'],_0x1c2b4f);TeamEvents[_0x1a1a('0x3')](_0x38fa90,_0x1c2b4f);_0x28c589(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x1a1a('0x4')](e,emitEvent(event));}}module[_0x1a1a('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 30f0fd2..b48659d 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 _0x072f=['catch','exports','define','Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','all','lodash','Queues','then','map','setDataValue','channel'];(function(_0x34d6a9,_0x1cff59){var _0x48e122=function(_0x2473ff){while(--_0x2473ff){_0x34d6a9['push'](_0x34d6a9['shift']());}};_0x48e122(++_0x1cff59);}(_0x072f,0xae));var _0xf072=function(_0x5e38ae,_0x26c023){_0x5e38ae=_0x5e38ae-0x0;var _0x33e20d=_0x072f[_0x5e38ae];return _0x33e20d;};'use strict';var _=require(_0xf072('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x2c9243,_0x1778fc){var _0x406a4f='get'+_0x1778fc+_0xf072('0x1');return _0x2c9243[_0x406a4f]()[_0xf072('0x2')](function(_0x188fd0){return _[_0xf072('0x3')](_0x188fd0,function(_0x2dd1fe){_0x2dd1fe[_0xf072('0x4')](_0xf072('0x5'),_0x1778fc);return _0x2dd1fe;});})[_0xf072('0x6')](function(_0x3ac36d){throw _0x3ac36d;});}module[_0xf072('0x7')]=function(_0x4ab123){return _0x4ab123[_0xf072('0x8')](_0xf072('0x9'),attributes,{'tableName':_0xf072('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1ebd89=this;var _0x1f4afa=[_0xf072('0xb'),_0xf072('0xc'),_0xf072('0xd'),'Openchannel',_0xf072('0xe'),_0xf072('0xf'),_0xf072('0x10')];return Promise['resolve']()['then'](function(){var _0x3d2fbf=_['map'](_0x1f4afa,function(_0x183e5d){return getQueuesByChannel(_0x1ebd89,_0x183e5d);});return Promise[_0xf072('0x11')](_0x3d2fbf);})['catch'](function(_0x657638){throw _0x657638;});}}});}; \ No newline at end of file +var _0x8df5=['define','Team','teams','Chat','Openchannel','Voice','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch'];(function(_0x10fb67,_0x259d63){var _0x52b124=function(_0x48cf84){while(--_0x48cf84){_0x10fb67['push'](_0x10fb67['shift']());}};_0x52b124(++_0x259d63);}(_0x8df5,0x88));var _0x58df=function(_0x368e02,_0x11f3aa){_0x368e02=_0x368e02-0x0;var _0x5ce649=_0x8df5[_0x368e02];return _0x5ce649;};'use strict';var _=require(_0x58df('0x0'));var attributes=require(_0x58df('0x1'));function getQueuesByChannel(_0x487588,_0x5386aa){var _0x3782ad=_0x58df('0x2')+_0x5386aa+_0x58df('0x3');return _0x487588[_0x3782ad]()[_0x58df('0x4')](function(_0x17a58b){return _[_0x58df('0x5')](_0x17a58b,function(_0x48b054){_0x48b054[_0x58df('0x6')]('channel',_0x5386aa);return _0x48b054;});})[_0x58df('0x7')](function(_0x4becf1){throw _0x4becf1;});}module['exports']=function(_0x725304){return _0x725304[_0x58df('0x8')](_0x58df('0x9'),attributes,{'tableName':_0x58df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x13f69f=this;var _0x542767=[_0x58df('0xb'),'Fax','Mail',_0x58df('0xc'),'Sms',_0x58df('0xd'),'Whatsapp'];return Promise[_0x58df('0xe')]()[_0x58df('0x4')](function(){var _0x4ea996=_[_0x58df('0x5')](_0x542767,function(_0x593b2a){return getQueuesByChannel(_0x13f69f,_0x593b2a);});return Promise[_0x58df('0xf')](_0x4ea996);})[_0x58df('0x7')](function(_0x9552a2){throw _0x9552a2;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 58daa65..6598d52 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 _0x99c7=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x48a75f,_0x332f49){var _0x51c1f9=function(_0x204cff){while(--_0x204cff){_0x48a75f['push'](_0x48a75f['shift']());}};_0x51c1f9(++_0x332f49);}(_0x99c7,0xc5));var _0x799c=function(_0x3205e3,_0x5eade7){_0x3205e3=_0x3205e3-0x0;var _0x2d2781=_0x99c7[_0x3205e3];return _0x2d2781;};'use strict';var _=require(_0x799c('0x0'));var util=require(_0x799c('0x1'));var moment=require(_0x799c('0x2'));var BPromise=require('bluebird');var rs=require(_0x799c('0x3'));var fs=require('fs');var Redis=require(_0x799c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x799c('0x5'));var logger=require(_0x799c('0x6'))(_0x799c('0x7'));var config=require(_0x799c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x799c('0x9')][_0x799c('0xa')]({'port':0x232a});config[_0x799c('0xb')]=_[_0x799c('0xc')](config[_0x799c('0xb')],{'host':_0x799c('0xd'),'port':0x18eb});var socket=require(_0x799c('0xe'))(new Redis(config[_0x799c('0xb')]));require(_0x799c('0xf'))['register'](socket);function respondWithRpcPromise(_0xe0240,_0x34aec5,_0x1e307e){return new BPromise(function(_0x5ec5c6,_0x227bbb){return client[_0x799c('0x10')](_0xe0240,_0x1e307e)[_0x799c('0x11')](function(_0x3f1c64){logger['info'](_0x799c('0x12'),_0x34aec5,'request\x20sent');logger[_0x799c('0x13')](_0x799c('0x14'),_0x34aec5,'request\x20sent',JSON[_0x799c('0x15')](_0x3f1c64));if(_0x3f1c64['error']){if(_0x3f1c64[_0x799c('0x16')][_0x799c('0x17')]===0x1f4){logger[_0x799c('0x16')](_0x799c('0x12'),_0x34aec5,_0x3f1c64[_0x799c('0x16')][_0x799c('0x18')]);return _0x227bbb(_0x3f1c64[_0x799c('0x16')][_0x799c('0x18')]);}logger[_0x799c('0x16')](_0x799c('0x12'),_0x34aec5,_0x3f1c64[_0x799c('0x16')][_0x799c('0x18')]);return _0x5ec5c6(_0x3f1c64[_0x799c('0x16')][_0x799c('0x18')]);}else{logger[_0x799c('0x19')](_0x799c('0x12'),_0x34aec5,_0x799c('0x1a'));_0x5ec5c6(_0x3f1c64['result']['message']);}})[_0x799c('0x1b')](function(_0x3d01ad){logger['error'](_0x799c('0x12'),_0x34aec5,_0x3d01ad);_0x227bbb(_0x3d01ad);});});} \ No newline at end of file +var _0x1e23=['socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1e23,0x15d));var _0x31e2=function(_0x3937df,_0x48baf9){_0x3937df=_0x3937df-0x0;var _0x4aae23=_0x1e23[_0x3937df];return _0x4aae23;};'use strict';var _=require('lodash');var util=require(_0x31e2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31e2('0x1'));var db=require(_0x31e2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x31e2('0x3'))(_0x31e2('0x4'));var config=require(_0x31e2('0x5'));var jayson=require(_0x31e2('0x6'));var client=jayson[_0x31e2('0x7')][_0x31e2('0x8')]({'port':0x232a});config[_0x31e2('0x9')]=_['defaults'](config[_0x31e2('0x9')],{'host':_0x31e2('0xa'),'port':0x18eb});var socket=require(_0x31e2('0xb'))(new Redis(config[_0x31e2('0x9')]));require(_0x31e2('0xc'))[_0x31e2('0xd')](socket);function respondWithRpcPromise(_0x194c4b,_0x13134b,_0x396c77){return new BPromise(function(_0x307f5e,_0x377d09){return client['request'](_0x194c4b,_0x396c77)[_0x31e2('0xe')](function(_0x4cbfc6){logger[_0x31e2('0xf')](_0x31e2('0x10'),_0x13134b,_0x31e2('0x11'));logger['debug'](_0x31e2('0x12'),_0x13134b,_0x31e2('0x11'),JSON[_0x31e2('0x13')](_0x4cbfc6));if(_0x4cbfc6[_0x31e2('0x14')]){if(_0x4cbfc6[_0x31e2('0x14')][_0x31e2('0x15')]===0x1f4){logger['error'](_0x31e2('0x10'),_0x13134b,_0x4cbfc6['error'][_0x31e2('0x16')]);return _0x377d09(_0x4cbfc6['error'][_0x31e2('0x16')]);}logger[_0x31e2('0x14')](_0x31e2('0x10'),_0x13134b,_0x4cbfc6[_0x31e2('0x14')]['message']);return _0x307f5e(_0x4cbfc6['error'][_0x31e2('0x16')]);}else{logger['info'](_0x31e2('0x10'),_0x13134b,_0x31e2('0x11'));_0x307f5e(_0x4cbfc6['result'][_0x31e2('0x16')]);}})[_0x31e2('0x17')](function(_0x4e73cc){logger[_0x31e2('0x14')](_0x31e2('0x10'),_0x13134b,_0x4e73cc);_0x377d09(_0x4e73cc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 7d24c1f..c4e53cb 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 _0x0036=['removeListener','register','team:','./team.events','save','remove','update','emit'];(function(_0x1839a0,_0x2f93a8){var _0x1b86e0=function(_0x240fa8){while(--_0x240fa8){_0x1839a0['push'](_0x1839a0['shift']());}};_0x1b86e0(++_0x2f93a8);}(_0x0036,0x73));var _0x6003=function(_0x23fc12,_0xbbff7f){_0x23fc12=_0x23fc12-0x0;var _0x5df008=_0x0036[_0x23fc12];return _0x5df008;};'use strict';var TeamEvents=require(_0x6003('0x0'));var events=[_0x6003('0x1'),_0x6003('0x2'),_0x6003('0x3')];function createListener(_0x31bb7e,_0x41a61d){return function(_0x3aa11b){_0x41a61d[_0x6003('0x4')](_0x31bb7e,_0x3aa11b);};}function removeListener(_0x45bed1,_0x46cd97){return function(){TeamEvents[_0x6003('0x5')](_0x45bed1,_0x46cd97);};}exports[_0x6003('0x6')]=function(_0x159d55){for(var _0x23976c=0x0,_0x3ddcff=events['length'];_0x23976c<_0x3ddcff;_0x23976c++){var _0x1674ba=events[_0x23976c];var _0x1b6954=createListener(_0x6003('0x7')+_0x1674ba,_0x159d55);TeamEvents['on'](_0x1674ba,_0x1b6954);}}; \ No newline at end of file +var _0x74ba=['team:','./team.events','update','emit','removeListener','register','length'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x74ba,0x174));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var TeamEvents=require(_0xa74b('0x0'));var events=['save','remove',_0xa74b('0x1')];function createListener(_0x5da435,_0x57ee8f){return function(_0x2eccf0){_0x57ee8f[_0xa74b('0x2')](_0x5da435,_0x2eccf0);};}function removeListener(_0xdc6b34,_0x4ed61a){return function(){TeamEvents[_0xa74b('0x3')](_0xdc6b34,_0x4ed61a);};}exports[_0xa74b('0x4')]=function(_0x594e0e){for(var _0x39ef56=0x0,_0x27fa7d=events[_0xa74b('0x5')];_0x39ef56<_0x27fa7d;_0x39ef56++){var _0x3dc16e=events[_0x39ef56];var _0x1712e6=createListener(_0xa74b('0x6')+_0x3dc16e,_0x594e0e);TeamEvents['on'](_0x3dc16e,_0x1712e6);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 37acf80..042ac41 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 _0xd8eb=['sequelize','exports','INTEGER'];(function(_0x5a52b5,_0x3a5b7f){var _0x2ce806=function(_0x34ea70){while(--_0x34ea70){_0x5a52b5['push'](_0x5a52b5['shift']());}};_0x2ce806(++_0x3a5b7f);}(_0xd8eb,0x66));var _0xbd8e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xd8eb[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require(_0xbd8e('0x0'));module[_0xbd8e('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xbd8e('0x2')]}}; \ No newline at end of file +var _0xfe57=['exports','sequelize'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0xfe57,0x195));var _0x7fe5=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xfe57[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x7fe5('0x0'));module[_0x7fe5('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'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 bff3c4f..5510e3e 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 _0x4f2f=['request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','../../config/logger','api','bluebird'];(function(_0x45dbe3,_0xd2bf96){var _0x1e71cf=function(_0x47d46d){while(--_0x47d46d){_0x45dbe3['push'](_0x45dbe3['shift']());}};_0x1e71cf(++_0xd2bf96);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4f2f[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c50=['path','rimraf','./teamVoicePrefix.attributes','define','team_has_voice_prefixes','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2c4570,_0x21871d){var _0x26f4b0=function(_0x56b0dc){while(--_0x56b0dc){_0x2c4570['push'](_0x2c4570['shift']());}};_0x26f4b0(++_0x21871d);}(_0x8c50,0xcd));var _0x08c5=function(_0x4b53ec,_0x23f893){_0x4b53ec=_0x4b53ec-0x0;var _0x150baf=_0x8c50[_0x4b53ec];return _0x150baf;};'use strict';var _=require('lodash');var util=require(_0x08c5('0x0'));var logger=require(_0x08c5('0x1'))('api');var moment=require(_0x08c5('0x2'));var BPromise=require(_0x08c5('0x3'));var rp=require(_0x08c5('0x4'));var fs=require('fs');var path=require(_0x08c5('0x5'));var rimraf=require(_0x08c5('0x6'));var config=require('../../config/environment');var attributes=require(_0x08c5('0x7'));module['exports']=function(_0x55e14a,_0xa09f74){return _0x55e14a[_0x08c5('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x08c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d3569d3..a777b8c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x91b55d,_0x2d6a4f){var _0x111535=function(_0x3fb900){while(--_0x3fb900){_0x91b55d['push'](_0x91b55d['shift']());}};_0x111535(++_0x2d6a4f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xcb91[_0x576266];return _0x18234f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x354bbf,_0x4fdbfc){var _0x3d7b08=function(_0xf5a025){while(--_0xf5a025){_0x354bbf['push'](_0x354bbf['shift']());}};_0x3d7b08(++_0x4fdbfc);}(_0x70e0,0x17b));var _0x070e=function(_0x1d29be,_0xc3756){_0x1d29be=_0x1d29be-0x0;var _0x53f996=_0x70e0[_0x1d29be];return _0x53f996;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 4d167d7..27cc394 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 _0xf8d5=['sequelize','exports','INTEGER'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf8d5,0xcc));var _0x5f8d=function(_0x10af6a,_0x28cec2){_0x10af6a=_0x10af6a-0x0;var _0x55397b=_0xf8d5[_0x10af6a];return _0x55397b;};'use strict';var Sequelize=require(_0x5f8d('0x0'));module[_0x5f8d('0x1')]={'penalty':{'type':Sequelize[_0x5f8d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e5b=['exports','INTEGER','sequelize'];(function(_0x27a611,_0xe00621){var _0x39c5de=function(_0x1bdcfc){while(--_0x1bdcfc){_0x27a611['push'](_0x27a611['shift']());}};_0x39c5de(++_0xe00621);}(_0x0e5b,0x170));var _0xb0e5=function(_0x37fc96,_0x219273){_0x37fc96=_0x37fc96-0x0;var _0x4ece99=_0x0e5b[_0x37fc96];return _0x4ece99;};'use strict';var Sequelize=require(_0xb0e5('0x0'));module[_0xb0e5('0x1')]={'penalty':{'type':Sequelize[_0xb0e5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a1145bf..d06a903 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 _0xaf9b=['define','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x569231,_0x293c14){var _0x32c8ee=function(_0x58c135){while(--_0x58c135){_0x569231['push'](_0x569231['shift']());}};_0x32c8ee(++_0x293c14);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x448aaa,_0x16b4f9){_0x448aaa=_0x448aaa-0x0;var _0x5511dd=_0xaf9b[_0x448aaa];return _0x5511dd;};'use strict';var _=require(_0xbaf9('0x0'));var util=require('util');var logger=require(_0xbaf9('0x1'))('api');var moment=require(_0xbaf9('0x2'));var BPromise=require(_0xbaf9('0x3'));var rp=require(_0xbaf9('0x4'));var fs=require('fs');var path=require(_0xbaf9('0x5'));var rimraf=require('rimraf');var config=require(_0xbaf9('0x6'));var attributes=require(_0xbaf9('0x7'));module[_0xbaf9('0x8')]=function(_0x4b443e,_0x40b949){return _0x4b443e[_0xbaf9('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57d4=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x57d4,0x78));var _0x457d=function(_0x89f4f5,_0x1c8937){_0x89f4f5=_0x89f4f5-0x0;var _0x1c9c51=_0x57d4[_0x89f4f5];return _0x1c9c51;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));module[_0x457d('0xa')]=function(_0x247ec7,_0x3fd867){return _0x247ec7['define'](_0x457d('0xb'),attributes,{'tableName':_0x457d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 04d54a3..1443132 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 _0x79c6=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79c6,0x81));var _0x679c=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x79c6[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x679c('0x0'));var util=require('util');var moment=require(_0x679c('0x1'));var BPromise=require(_0x679c('0x2'));var rs=require(_0x679c('0x3'));var fs=require('fs');var Redis=require(_0x679c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x679c('0x5'))(_0x679c('0x6'));var config=require(_0x679c('0x7'));var jayson=require(_0x679c('0x8'));var client=jayson[_0x679c('0x9')][_0x679c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43655d,_0x481173,_0x57b604){return new BPromise(function(_0x2898c2,_0x1f2ec3){return client[_0x679c('0xb')](_0x43655d,_0x57b604)[_0x679c('0xc')](function(_0xac3b1a){logger[_0x679c('0xd')](_0x679c('0xe'),_0x481173,'request\x20sent');logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x481173,_0x679c('0xf'),JSON[_0x679c('0x10')](_0xac3b1a));if(_0xac3b1a['error']){if(_0xac3b1a['error'][_0x679c('0x11')]===0x1f4){logger[_0x679c('0x12')](_0x679c('0xe'),_0x481173,_0xac3b1a['error'][_0x679c('0x13')]);return _0x1f2ec3(_0xac3b1a[_0x679c('0x12')]['message']);}logger[_0x679c('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x481173,_0xac3b1a['error'][_0x679c('0x13')]);return _0x2898c2(_0xac3b1a[_0x679c('0x12')][_0x679c('0x13')]);}else{logger[_0x679c('0xd')](_0x679c('0xe'),_0x481173,_0x679c('0xf'));_0x2898c2(_0xac3b1a['result'][_0x679c('0x13')]);}})[_0x679c('0x14')](function(_0x18117f){logger[_0x679c('0x12')](_0x679c('0xe'),_0x481173,_0x18117f);_0x1f2ec3(_0x18117f);});});} \ No newline at end of file +var _0xb358=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x55a26f,_0x16f9bd){var _0x32590e=function(_0x52c912){while(--_0x52c912){_0x55a26f['push'](_0x55a26f['shift']());}};_0x32590e(++_0x16f9bd);}(_0xb358,0x1b5));var _0x8b35=function(_0x18a695,_0x6d9f9f){_0x18a695=_0x18a695-0x0;var _0x238069=_0xb358[_0x18a695];return _0x238069;};'use strict';var _=require('lodash');var util=require(_0x8b35('0x0'));var moment=require(_0x8b35('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b35('0x2'));var db=require(_0x8b35('0x3'))['db'];var utils=require(_0x8b35('0x4'));var logger=require(_0x8b35('0x5'))(_0x8b35('0x6'));var config=require(_0x8b35('0x7'));var jayson=require(_0x8b35('0x8'));var client=jayson[_0x8b35('0x9')][_0x8b35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536309,_0x1af4a5,_0x78bc6a){return new BPromise(function(_0x13d163,_0x58506f){return client[_0x8b35('0xb')](_0x536309,_0x78bc6a)[_0x8b35('0xc')](function(_0x2013e3){logger[_0x8b35('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1af4a5,_0x8b35('0xe'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1af4a5,'request\x20sent',JSON['stringify'](_0x2013e3));if(_0x2013e3[_0x8b35('0xf')]){if(_0x2013e3[_0x8b35('0xf')][_0x8b35('0x10')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1af4a5,_0x2013e3[_0x8b35('0xf')][_0x8b35('0x11')]);return _0x58506f(_0x2013e3[_0x8b35('0xf')][_0x8b35('0x11')]);}logger['error'](_0x8b35('0x12'),_0x1af4a5,_0x2013e3[_0x8b35('0xf')][_0x8b35('0x11')]);return _0x13d163(_0x2013e3[_0x8b35('0xf')][_0x8b35('0x11')]);}else{logger[_0x8b35('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1af4a5,'request\x20sent');_0x13d163(_0x2013e3['result'][_0x8b35('0x11')]);}})['catch'](function(_0x5398b3){logger[_0x8b35('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1af4a5,_0x5398b3);_0x58506f(_0x5398b3);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4c71c12..e188339 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 _0x1e82=['Router','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x1e82,0x8b));var _0x21e8=function(_0x1419d4,_0x1f4feb){_0x1419d4=_0x1419d4-0x0;var _0x51bc70=_0x1e82[_0x1419d4];return _0x51bc70;};'use strict';var multer=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var path=require(_0x21e8('0x2'));var timeout=require(_0x21e8('0x3'));var express=require(_0x21e8('0x4'));var router=express[_0x21e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x21e8('0x6'));var interaction=require(_0x21e8('0x7'));var config=require('../../config/environment');var controller=require(_0x21e8('0x8'));router['get']('/',auth[_0x21e8('0x9')](),controller[_0x21e8('0xa')]);router[_0x21e8('0xb')](_0x21e8('0xc'),auth['isAuthenticated'](),controller[_0x21e8('0xd')]);router[_0x21e8('0xe')]('/',auth[_0x21e8('0x9')](),controller['create']);router[_0x21e8('0xf')](_0x21e8('0xc'),auth[_0x21e8('0x9')](),controller[_0x21e8('0x10')]);router['delete']('/:id',auth[_0x21e8('0x9')](),controller['destroy']);module[_0x21e8('0x11')]=router; \ No newline at end of file +var _0x2015=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3d1257,_0x182816){var _0x2dd9bb=function(_0x154115){while(--_0x154115){_0x3d1257['push'](_0x3d1257['shift']());}};_0x2dd9bb(++_0x182816);}(_0x2015,0x193));var _0x5201=function(_0x528cfd,_0x476e59){_0x528cfd=_0x528cfd-0x0;var _0x52659=_0x2015[_0x528cfd];return _0x52659;};'use strict';var multer=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var path=require(_0x5201('0x2'));var timeout=require(_0x5201('0x3'));var express=require(_0x5201('0x4'));var router=express[_0x5201('0x5')]();var fs_extra=require(_0x5201('0x6'));var auth=require(_0x5201('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5201('0x8'));var controller=require(_0x5201('0x9'));router[_0x5201('0xa')]('/',auth[_0x5201('0xb')](),controller[_0x5201('0xc')]);router[_0x5201('0xa')](_0x5201('0xd'),auth[_0x5201('0xb')](),controller[_0x5201('0xe')]);router[_0x5201('0xf')]('/',auth['isAuthenticated'](),controller[_0x5201('0x10')]);router[_0x5201('0x11')]('/:id',auth[_0x5201('0xb')](),controller[_0x5201('0x12')]);router[_0x5201('0x13')]('/:id',auth[_0x5201('0xb')](),controller[_0x5201('0x14')]);module[_0x5201('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 788d382..086df81 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 _0xf282=['STRING','TEXT','sequelize','exports'];(function(_0x17d3a1,_0x12c913){var _0x579ca9=function(_0x19883e){while(--_0x19883e){_0x17d3a1['push'](_0x17d3a1['shift']());}};_0x579ca9(++_0x12c913);}(_0xf282,0x16e));var _0x2f28=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf282[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x2f28('0x0'));module[_0x2f28('0x1')]={'name':{'type':Sequelize[_0x2f28('0x2')]},'description':{'type':Sequelize[_0x2f28('0x2')]},'html':{'type':Sequelize[_0x2f28('0x3')]}}; \ No newline at end of file +var _0x73ef=['sequelize','exports','STRING','TEXT'];(function(_0x1cf0dd,_0x5576b9){var _0x530b37=function(_0x3e3871){while(--_0x3e3871){_0x1cf0dd['push'](_0x1cf0dd['shift']());}};_0x530b37(++_0x5576b9);}(_0x73ef,0x154));var _0xf73e=function(_0x28e9db,_0x1cf7b1){_0x28e9db=_0x28e9db-0x0;var _0x189c93=_0x73ef[_0x28e9db];return _0x189c93;};'use strict';var Sequelize=require(_0xf73e('0x0'));module[_0xf73e('0x1')]={'name':{'type':Sequelize[_0xf73e('0x2')]},'description':{'type':Sequelize[_0xf73e('0x2')]},'html':{'type':Sequelize[_0xf73e('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9270f96..fe7244f 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 _0xf3c9=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','get','Templates','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4f0196,_0x12229e){var _0xc55770=function(_0x5d73b4){while(--_0x5d73b4){_0x4f0196['push'](_0x4f0196['shift']());}};_0xc55770(++_0x12229e);}(_0xf3c9,0x1f1));var _0x9f3c=function(_0x1de5cd,_0x1a3547){_0x1de5cd=_0x1de5cd-0x0;var _0x465755=_0xf3c9[_0x1de5cd];return _0x465755;};'use strict';var emlformat=require(_0x9f3c('0x0'));var rimraf=require(_0x9f3c('0x1'));var zipdir=require(_0x9f3c('0x2'));var jsonpatch=require(_0x9f3c('0x3'));var rp=require(_0x9f3c('0x4'));var moment=require(_0x9f3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9f3c('0x6'));var util=require(_0x9f3c('0x7'));var path=require(_0x9f3c('0x8'));var sox=require(_0x9f3c('0x9'));var csv=require(_0x9f3c('0xa'));var ejs=require(_0x9f3c('0xb'));var fs=require('fs');var fs_extra=require(_0x9f3c('0xc'));var _=require(_0x9f3c('0xd'));var squel=require('squel');var crypto=require(_0x9f3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9f3c('0xf'));var toCsv=require(_0x9f3c('0xa'));var querystring=require(_0x9f3c('0x10'));var Papa=require(_0x9f3c('0x11'));var Redis=require(_0x9f3c('0x12'));var authService=require(_0x9f3c('0x13'));var qs=require(_0x9f3c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f3c('0x15'));var logger=require(_0x9f3c('0x16'))(_0x9f3c('0x17'));var utils=require(_0x9f3c('0x18'));var config=require(_0x9f3c('0x19'));var licenseUtil=require(_0x9f3c('0x1a'));var db=require(_0x9f3c('0x1b'))['db'];function respondWithStatusCode(_0x285946,_0x367001){_0x367001=_0x367001||0xcc;return function(_0x2cf737){if(_0x2cf737){return _0x285946['sendStatus'](_0x367001);}return _0x285946[_0x9f3c('0x1c')](_0x367001)[_0x9f3c('0x1d')]();};}function respondWithResult(_0xf406cd,_0x5c1a81){_0x5c1a81=_0x5c1a81||0xc8;return function(_0x59a283){if(_0x59a283){return _0xf406cd[_0x9f3c('0x1c')](_0x5c1a81)[_0x9f3c('0x1e')](_0x59a283);}};}function respondWithFilteredResult(_0x475121,_0x204c6b){return function(_0xb58e04){if(_0xb58e04){var _0x43d122=typeof _0x204c6b[_0x9f3c('0x1f')]==='undefined'&&typeof _0x204c6b[_0x9f3c('0x20')]===_0x9f3c('0x21');var _0x42dbcf=_0xb58e04['count'];var _0x21e610=_0x43d122?0x0:_0x204c6b[_0x9f3c('0x1f')];var _0x183bb4=_0x43d122?_0xb58e04[_0x9f3c('0x22')]:_0x204c6b[_0x9f3c('0x1f')]+_0x204c6b[_0x9f3c('0x20')];var _0x2aa361;if(_0x183bb4>=_0x42dbcf){_0x183bb4=_0x42dbcf;_0x2aa361=0xc8;}else{_0x2aa361=0xce;}_0x475121['status'](_0x2aa361);return _0x475121[_0x9f3c('0x23')](_0x9f3c('0x24'),_0x21e610+'-'+_0x183bb4+'/'+_0x42dbcf)[_0x9f3c('0x1e')](_0xb58e04);}return null;};}function patchUpdates(_0x1cc7c6){return function(_0x352691){try{jsonpatch[_0x9f3c('0x25')](_0x352691,_0x1cc7c6,!![]);}catch(_0x226ea2){return BPromise['reject'](_0x226ea2);}return _0x352691['save']();};}function saveUpdates(_0x5312c3,_0x385a8b){return function(_0xf17976){if(_0xf17976){return _0xf17976[_0x9f3c('0x26')](_0x5312c3)[_0x9f3c('0x27')](function(_0x21c955){return _0x21c955;});}return null;};}function removeEntity(_0x2e53a7,_0x272468){return function(_0x4015c5){if(_0x4015c5){return _0x4015c5[_0x9f3c('0x28')]()[_0x9f3c('0x27')](function(){var _0x4d2225=_0x4015c5[_0x9f3c('0x29')]({'plain':!![]});var _0xf2881b=_0x9f3c('0x2a');return db['UserProfileResource'][_0x9f3c('0x28')]({'where':{'type':_0xf2881b,'resourceId':_0x4d2225['id']}})[_0x9f3c('0x27')](function(){return _0x4015c5;});})[_0x9f3c('0x27')](function(){_0x2e53a7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b92ad,_0x3c376c){return function(_0x5191d2){if(!_0x5191d2){_0x3b92ad['sendStatus'](0x194);}return _0x5191d2;};}function handleError(_0x3446a0,_0x1e75b5){_0x1e75b5=_0x1e75b5||0x1f4;return function(_0xded2a5){logger[_0x9f3c('0x2b')](_0xded2a5[_0x9f3c('0x2c')]);if(_0xded2a5[_0x9f3c('0x2d')]){delete _0xded2a5['name'];}_0x3446a0[_0x9f3c('0x1c')](_0x1e75b5)[_0x9f3c('0x2e')](_0xded2a5);};}exports[_0x9f3c('0x2f')]=function(_0x36d0ec,_0x16451e){var _0x1f390d={},_0xcfe792={},_0x9b0b63={'count':0x0,'rows':[]};var _0x4f42fb=_['map'](db[_0x9f3c('0x30')][_0x9f3c('0x31')],function(_0x2fd461){return{'name':_0x2fd461[_0x9f3c('0x32')],'type':_0x2fd461[_0x9f3c('0x33')][_0x9f3c('0x34')]};});_0xcfe792[_0x9f3c('0x35')]=_[_0x9f3c('0x36')](_0x4f42fb,_0x9f3c('0x2d'));_0xcfe792[_0x9f3c('0x37')]=_[_0x9f3c('0x38')](_0x36d0ec[_0x9f3c('0x37')]);_0xcfe792['filters']=_[_0x9f3c('0x39')](_0xcfe792[_0x9f3c('0x35')],_0xcfe792['query']);_0x1f390d[_0x9f3c('0x3a')]=_[_0x9f3c('0x39')](_0xcfe792['model'],qs['fields'](_0x36d0ec[_0x9f3c('0x37')][_0x9f3c('0x3b')]));_0x1f390d[_0x9f3c('0x3a')]=_0x1f390d[_0x9f3c('0x3a')][_0x9f3c('0x3c')]?_0x1f390d[_0x9f3c('0x3a')]:_0xcfe792['model'];if(!_0x36d0ec[_0x9f3c('0x37')][_0x9f3c('0x3d')]('nolimit')){_0x1f390d[_0x9f3c('0x20')]=qs[_0x9f3c('0x20')](_0x36d0ec[_0x9f3c('0x37')]['limit']);_0x1f390d[_0x9f3c('0x1f')]=qs[_0x9f3c('0x1f')](_0x36d0ec[_0x9f3c('0x37')]['offset']);}_0x1f390d['order']=qs[_0x9f3c('0x3e')](_0x36d0ec[_0x9f3c('0x37')][_0x9f3c('0x3e')]);_0x1f390d[_0x9f3c('0x3f')]=qs[_0x9f3c('0x40')](_[_0x9f3c('0x41')](_0x36d0ec['query'],_0xcfe792[_0x9f3c('0x40')]),_0x4f42fb);if(_0x36d0ec[_0x9f3c('0x37')]['filter']){_0x1f390d[_0x9f3c('0x3f')]=_[_0x9f3c('0x42')](_0x1f390d['where'],{'$or':_[_0x9f3c('0x36')](_0x4f42fb,function(_0x272319){if(_0x272319['type']!==_0x9f3c('0x43')){var _0xe275bb={};_0xe275bb[_0x272319[_0x9f3c('0x2d')]]={'$like':'%'+_0x36d0ec[_0x9f3c('0x37')][_0x9f3c('0x44')]+'%'};return _0xe275bb;}})});}_0x1f390d=_[_0x9f3c('0x42')]({},_0x1f390d,_0x36d0ec[_0x9f3c('0x45')]);var _0x25c031={'where':_0x1f390d['where']};return db[_0x9f3c('0x30')][_0x9f3c('0x22')](_0x25c031)[_0x9f3c('0x27')](function(_0x5e5cbb){_0x9b0b63[_0x9f3c('0x22')]=_0x5e5cbb;if(_0x36d0ec[_0x9f3c('0x37')][_0x9f3c('0x46')]){_0x1f390d['include']=[{'all':!![]}];}return db['Template'][_0x9f3c('0x47')](_0x1f390d);})[_0x9f3c('0x27')](function(_0x1f7b16){_0x9b0b63['rows']=_0x1f7b16;return _0x9b0b63;})[_0x9f3c('0x27')](respondWithFilteredResult(_0x16451e,_0x1f390d))[_0x9f3c('0x48')](handleError(_0x16451e,null));};exports[_0x9f3c('0x49')]=function(_0x6dca24,_0x101e98){var _0x47b552={'raw':!![],'where':{'id':_0x6dca24[_0x9f3c('0x4a')]['id']}},_0x3abfd0={};_0x3abfd0['model']=_[_0x9f3c('0x38')](db[_0x9f3c('0x30')]['rawAttributes']);_0x3abfd0[_0x9f3c('0x37')]=_[_0x9f3c('0x38')](_0x6dca24[_0x9f3c('0x37')]);_0x3abfd0['filters']=_['intersection'](_0x3abfd0[_0x9f3c('0x35')],_0x3abfd0[_0x9f3c('0x37')]);_0x47b552[_0x9f3c('0x3a')]=_[_0x9f3c('0x39')](_0x3abfd0[_0x9f3c('0x35')],qs[_0x9f3c('0x3b')](_0x6dca24[_0x9f3c('0x37')]['fields']));_0x47b552[_0x9f3c('0x3a')]=_0x47b552[_0x9f3c('0x3a')][_0x9f3c('0x3c')]?_0x47b552[_0x9f3c('0x3a')]:_0x3abfd0['model'];if(_0x6dca24[_0x9f3c('0x37')][_0x9f3c('0x46')]){_0x47b552['include']=[{'all':!![]}];}_0x47b552=_[_0x9f3c('0x42')]({},_0x47b552,_0x6dca24[_0x9f3c('0x45')]);return db[_0x9f3c('0x30')][_0x9f3c('0x4b')](_0x47b552)[_0x9f3c('0x27')](handleEntityNotFound(_0x101e98,null))[_0x9f3c('0x27')](respondWithResult(_0x101e98,null))[_0x9f3c('0x48')](handleError(_0x101e98,null));};exports[_0x9f3c('0x4c')]=function(_0x3e0a41,_0x20c1c3){return db[_0x9f3c('0x30')][_0x9f3c('0x4c')](_0x3e0a41[_0x9f3c('0x4d')],{})[_0x9f3c('0x27')](function(_0x4e8365){var _0x46212d=_0x3e0a41['user'][_0x9f3c('0x29')]({'plain':!![]});if(!_0x46212d)throw new Error(_0x9f3c('0x4e'));if(_0x46212d[_0x9f3c('0x4f')]===_0x9f3c('0x50')){var _0x382575=_0x4e8365['get']({'plain':!![]});var _0x1c395c=_0x9f3c('0x2a');return db[_0x9f3c('0x51')]['find']({'where':{'name':_0x1c395c,'userProfileId':_0x46212d[_0x9f3c('0x52')]},'raw':!![]})[_0x9f3c('0x27')](function(_0x43a349){if(_0x43a349&&_0x43a349[_0x9f3c('0x53')]===0x0){return db[_0x9f3c('0x54')][_0x9f3c('0x4c')]({'name':_0x382575[_0x9f3c('0x2d')],'resourceId':_0x382575['id'],'type':_0x43a349[_0x9f3c('0x2d')],'sectionId':_0x43a349['id']},{})[_0x9f3c('0x27')](function(){return _0x4e8365;});}else{return _0x4e8365;}})[_0x9f3c('0x48')](function(_0x895a6){logger[_0x9f3c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x895a6);throw _0x895a6;});}return _0x4e8365;})[_0x9f3c('0x27')](respondWithResult(_0x20c1c3,0xc9))['catch'](handleError(_0x20c1c3,null));};exports['update']=function(_0x576c62,_0xacdc49){if(_0x576c62[_0x9f3c('0x4d')]['id']){delete _0x576c62['body']['id'];}return db['Template'][_0x9f3c('0x4b')]({'where':{'id':_0x576c62[_0x9f3c('0x4a')]['id']}})[_0x9f3c('0x27')](handleEntityNotFound(_0xacdc49,null))[_0x9f3c('0x27')](saveUpdates(_0x576c62[_0x9f3c('0x4d')],null))[_0x9f3c('0x27')](respondWithResult(_0xacdc49,null))['catch'](handleError(_0xacdc49,null));};exports['destroy']=function(_0xd8f95,_0x7edf3b){return db[_0x9f3c('0x30')][_0x9f3c('0x4b')]({'where':{'id':_0xd8f95[_0x9f3c('0x4a')]['id']}})[_0x9f3c('0x27')](handleEntityNotFound(_0x7edf3b,null))[_0x9f3c('0x27')](removeEntity(_0x7edf3b,null))[_0x9f3c('0x48')](handleError(_0x7edf3b,null));}; \ No newline at end of file +var _0x5a72=['where','pick','merge','type','filter','options','Template','includeAll','include','rows','catch','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Templates','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort'];(function(_0x38c259,_0x41925a){var _0x2d7153=function(_0x3bc3ca){while(--_0x3bc3ca){_0x38c259['push'](_0x38c259['shift']());}};_0x2d7153(++_0x41925a);}(_0x5a72,0x16d));var _0x25a7=function(_0x2d6b3e,_0xb81646){_0x2d6b3e=_0x2d6b3e-0x0;var _0x4487d1=_0x5a72[_0x2d6b3e];return _0x4487d1;};'use strict';var emlformat=require(_0x25a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25a7('0x1'));var jsonpatch=require(_0x25a7('0x2'));var rp=require('request-promise');var moment=require(_0x25a7('0x3'));var BPromise=require(_0x25a7('0x4'));var Mustache=require(_0x25a7('0x5'));var util=require(_0x25a7('0x6'));var path=require('path');var sox=require(_0x25a7('0x7'));var csv=require('to-csv');var ejs=require(_0x25a7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25a7('0x9'));var squel=require(_0x25a7('0xa'));var crypto=require(_0x25a7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x25a7('0xc'));var toCsv=require(_0x25a7('0xd'));var querystring=require(_0x25a7('0xe'));var Papa=require(_0x25a7('0xf'));var Redis=require(_0x25a7('0x10'));var authService=require(_0x25a7('0x11'));var qs=require(_0x25a7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x25a7('0x13'))(_0x25a7('0x14'));var utils=require(_0x25a7('0x15'));var config=require(_0x25a7('0x16'));var licenseUtil=require(_0x25a7('0x17'));var db=require(_0x25a7('0x18'))['db'];function respondWithStatusCode(_0x1800c8,_0x402c14){_0x402c14=_0x402c14||0xcc;return function(_0x1feac1){if(_0x1feac1){return _0x1800c8[_0x25a7('0x19')](_0x402c14);}return _0x1800c8['status'](_0x402c14)[_0x25a7('0x1a')]();};}function respondWithResult(_0x40c4ff,_0x8ce8e){_0x8ce8e=_0x8ce8e||0xc8;return function(_0x51dc72){if(_0x51dc72){return _0x40c4ff[_0x25a7('0x1b')](_0x8ce8e)['json'](_0x51dc72);}};}function respondWithFilteredResult(_0x3d7b3b,_0x5644a8){return function(_0x464e8c){if(_0x464e8c){var _0x47cdf2=typeof _0x5644a8[_0x25a7('0x1c')]===_0x25a7('0x1d')&&typeof _0x5644a8[_0x25a7('0x1e')]==='undefined';var _0x23521a=_0x464e8c[_0x25a7('0x1f')];var _0x429052=_0x47cdf2?0x0:_0x5644a8[_0x25a7('0x1c')];var _0x535ea3=_0x47cdf2?_0x464e8c[_0x25a7('0x1f')]:_0x5644a8[_0x25a7('0x1c')]+_0x5644a8[_0x25a7('0x1e')];var _0x9db20a;if(_0x535ea3>=_0x23521a){_0x535ea3=_0x23521a;_0x9db20a=0xc8;}else{_0x9db20a=0xce;}_0x3d7b3b['status'](_0x9db20a);return _0x3d7b3b[_0x25a7('0x20')](_0x25a7('0x21'),_0x429052+'-'+_0x535ea3+'/'+_0x23521a)[_0x25a7('0x22')](_0x464e8c);}return null;};}function patchUpdates(_0xdef0bb){return function(_0x47b73a){try{jsonpatch[_0x25a7('0x23')](_0x47b73a,_0xdef0bb,!![]);}catch(_0x5c52a3){return BPromise[_0x25a7('0x24')](_0x5c52a3);}return _0x47b73a[_0x25a7('0x25')]();};}function saveUpdates(_0x58d866,_0x53d57c){return function(_0x306f11){if(_0x306f11){return _0x306f11[_0x25a7('0x26')](_0x58d866)['then'](function(_0x11c1de){return _0x11c1de;});}return null;};}function removeEntity(_0x2cb7a9,_0x23ec70){return function(_0x51edb1){if(_0x51edb1){return _0x51edb1[_0x25a7('0x27')]()[_0x25a7('0x28')](function(){var _0x471492=_0x51edb1[_0x25a7('0x29')]({'plain':!![]});var _0x3636fb='Templates';return db['UserProfileResource'][_0x25a7('0x27')]({'where':{'type':_0x3636fb,'resourceId':_0x471492['id']}})['then'](function(){return _0x51edb1;});})[_0x25a7('0x28')](function(){_0x2cb7a9[_0x25a7('0x1b')](0xcc)[_0x25a7('0x1a')]();});}};}function handleEntityNotFound(_0xb6204d,_0xb0cd82){return function(_0x33ce65){if(!_0x33ce65){_0xb6204d[_0x25a7('0x19')](0x194);}return _0x33ce65;};}function handleError(_0x1f3489,_0x1f6910){_0x1f6910=_0x1f6910||0x1f4;return function(_0x25875d){logger[_0x25a7('0x2a')](_0x25875d['stack']);if(_0x25875d[_0x25a7('0x2b')]){delete _0x25875d[_0x25a7('0x2b')];}_0x1f3489[_0x25a7('0x1b')](_0x1f6910)[_0x25a7('0x2c')](_0x25875d);};}exports[_0x25a7('0x2d')]=function(_0x4343cd,_0xd4f553){var _0x1d6a44={},_0xc2582e={},_0x3bdfe9={'count':0x0,'rows':[]};var _0x4a2ddf=_[_0x25a7('0x2e')](db['Template'][_0x25a7('0x2f')],function(_0x2bea77){return{'name':_0x2bea77[_0x25a7('0x30')],'type':_0x2bea77['type'][_0x25a7('0x31')]};});_0xc2582e[_0x25a7('0x32')]=_[_0x25a7('0x2e')](_0x4a2ddf,_0x25a7('0x2b'));_0xc2582e['query']=_[_0x25a7('0x33')](_0x4343cd[_0x25a7('0x34')]);_0xc2582e[_0x25a7('0x35')]=_['intersection'](_0xc2582e[_0x25a7('0x32')],_0xc2582e['query']);_0x1d6a44[_0x25a7('0x36')]=_[_0x25a7('0x37')](_0xc2582e['model'],qs['fields'](_0x4343cd[_0x25a7('0x34')]['fields']));_0x1d6a44['attributes']=_0x1d6a44[_0x25a7('0x36')][_0x25a7('0x38')]?_0x1d6a44[_0x25a7('0x36')]:_0xc2582e[_0x25a7('0x32')];if(!_0x4343cd[_0x25a7('0x34')][_0x25a7('0x39')](_0x25a7('0x3a'))){_0x1d6a44[_0x25a7('0x1e')]=qs['limit'](_0x4343cd[_0x25a7('0x34')]['limit']);_0x1d6a44['offset']=qs[_0x25a7('0x1c')](_0x4343cd[_0x25a7('0x34')][_0x25a7('0x1c')]);}_0x1d6a44['order']=qs[_0x25a7('0x3b')](_0x4343cd[_0x25a7('0x34')][_0x25a7('0x3b')]);_0x1d6a44[_0x25a7('0x3c')]=qs[_0x25a7('0x35')](_[_0x25a7('0x3d')](_0x4343cd[_0x25a7('0x34')],_0xc2582e[_0x25a7('0x35')]),_0x4a2ddf);if(_0x4343cd[_0x25a7('0x34')]['filter']){_0x1d6a44[_0x25a7('0x3c')]=_[_0x25a7('0x3e')](_0x1d6a44[_0x25a7('0x3c')],{'$or':_[_0x25a7('0x2e')](_0x4a2ddf,function(_0x41f24e){if(_0x41f24e[_0x25a7('0x3f')]!=='VIRTUAL'){var _0x4ae0e7={};_0x4ae0e7[_0x41f24e[_0x25a7('0x2b')]]={'$like':'%'+_0x4343cd['query'][_0x25a7('0x40')]+'%'};return _0x4ae0e7;}})});}_0x1d6a44=_['merge']({},_0x1d6a44,_0x4343cd[_0x25a7('0x41')]);var _0x382038={'where':_0x1d6a44[_0x25a7('0x3c')]};return db[_0x25a7('0x42')]['count'](_0x382038)[_0x25a7('0x28')](function(_0x45a5f8){_0x3bdfe9[_0x25a7('0x1f')]=_0x45a5f8;if(_0x4343cd[_0x25a7('0x34')][_0x25a7('0x43')]){_0x1d6a44[_0x25a7('0x44')]=[{'all':!![]}];}return db[_0x25a7('0x42')]['findAll'](_0x1d6a44);})[_0x25a7('0x28')](function(_0x5bd549){_0x3bdfe9[_0x25a7('0x45')]=_0x5bd549;return _0x3bdfe9;})[_0x25a7('0x28')](respondWithFilteredResult(_0xd4f553,_0x1d6a44))[_0x25a7('0x46')](handleError(_0xd4f553,null));};exports['show']=function(_0x1620b4,_0x1b0175){var _0x7e29cc={'raw':!![],'where':{'id':_0x1620b4['params']['id']}},_0x507de6={};_0x507de6['model']=_[_0x25a7('0x33')](db[_0x25a7('0x42')]['rawAttributes']);_0x507de6['query']=_[_0x25a7('0x33')](_0x1620b4[_0x25a7('0x34')]);_0x507de6[_0x25a7('0x35')]=_[_0x25a7('0x37')](_0x507de6[_0x25a7('0x32')],_0x507de6['query']);_0x7e29cc['attributes']=_['intersection'](_0x507de6[_0x25a7('0x32')],qs['fields'](_0x1620b4[_0x25a7('0x34')][_0x25a7('0x47')]));_0x7e29cc[_0x25a7('0x36')]=_0x7e29cc['attributes']['length']?_0x7e29cc[_0x25a7('0x36')]:_0x507de6[_0x25a7('0x32')];if(_0x1620b4[_0x25a7('0x34')][_0x25a7('0x43')]){_0x7e29cc[_0x25a7('0x44')]=[{'all':!![]}];}_0x7e29cc=_['merge']({},_0x7e29cc,_0x1620b4['options']);return db['Template'][_0x25a7('0x48')](_0x7e29cc)[_0x25a7('0x28')](handleEntityNotFound(_0x1b0175,null))[_0x25a7('0x28')](respondWithResult(_0x1b0175,null))['catch'](handleError(_0x1b0175,null));};exports[_0x25a7('0x49')]=function(_0x587457,_0x20ca59){return db[_0x25a7('0x42')][_0x25a7('0x49')](_0x587457[_0x25a7('0x4a')],{})[_0x25a7('0x28')](function(_0x3592e3){var _0x5cdd16=_0x587457['user'][_0x25a7('0x29')]({'plain':!![]});if(!_0x5cdd16)throw new Error(_0x25a7('0x4b'));if(_0x5cdd16[_0x25a7('0x4c')]===_0x25a7('0x4d')){var _0x301839=_0x3592e3[_0x25a7('0x29')]({'plain':!![]});var _0x2c1ed6=_0x25a7('0x4e');return db[_0x25a7('0x4f')]['find']({'where':{'name':_0x2c1ed6,'userProfileId':_0x5cdd16[_0x25a7('0x50')]},'raw':!![]})['then'](function(_0x1ab70d){if(_0x1ab70d&&_0x1ab70d[_0x25a7('0x51')]===0x0){return db[_0x25a7('0x52')]['create']({'name':_0x301839[_0x25a7('0x2b')],'resourceId':_0x301839['id'],'type':_0x1ab70d[_0x25a7('0x2b')],'sectionId':_0x1ab70d['id']},{})[_0x25a7('0x28')](function(){return _0x3592e3;});}else{return _0x3592e3;}})['catch'](function(_0x3fd008){logger['error'](_0x25a7('0x53'),_0x3fd008);throw _0x3fd008;});}return _0x3592e3;})[_0x25a7('0x28')](respondWithResult(_0x20ca59,0xc9))[_0x25a7('0x46')](handleError(_0x20ca59,null));};exports[_0x25a7('0x26')]=function(_0x410f4f,_0x59c415){if(_0x410f4f['body']['id']){delete _0x410f4f[_0x25a7('0x4a')]['id'];}return db[_0x25a7('0x42')][_0x25a7('0x48')]({'where':{'id':_0x410f4f[_0x25a7('0x54')]['id']}})[_0x25a7('0x28')](handleEntityNotFound(_0x59c415,null))[_0x25a7('0x28')](saveUpdates(_0x410f4f[_0x25a7('0x4a')],null))['then'](respondWithResult(_0x59c415,null))[_0x25a7('0x46')](handleError(_0x59c415,null));};exports[_0x25a7('0x27')]=function(_0x39fbeb,_0x4050aa){return db[_0x25a7('0x42')][_0x25a7('0x48')]({'where':{'id':_0x39fbeb['params']['id']}})[_0x25a7('0x28')](handleEntityNotFound(_0x4050aa,null))[_0x25a7('0x28')](removeEntity(_0x4050aa,null))['catch'](handleError(_0x4050aa,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d3e3e8a..d33387b 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 _0x6bee=['bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','lodash','util','api'];(function(_0x40b8e7,_0x4cf441){var _0x571a2f=function(_0x5aa692){while(--_0x5aa692){_0x40b8e7['push'](_0x40b8e7['shift']());}};_0x571a2f(++_0x4cf441);}(_0x6bee,0xf7));var _0xe6be=function(_0x414b86,_0x1c1f53){_0x414b86=_0x414b86-0x0;var _0x319198=_0x6bee[_0x414b86];return _0x319198;};'use strict';var _=require(_0xe6be('0x0'));var util=require(_0xe6be('0x1'));var logger=require('../../config/logger')(_0xe6be('0x2'));var moment=require('moment');var BPromise=require(_0xe6be('0x3'));var rp=require(_0xe6be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6be('0x5'));var config=require(_0xe6be('0x6'));var attributes=require(_0xe6be('0x7'));module[_0xe6be('0x8')]=function(_0x5cb1f8,_0x48757c){return _0x5cb1f8[_0xe6be('0x9')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae59=['../../config/environment','exports','tools_templates','lodash','util','api','moment','path'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xae59,0x1db));var _0x9ae5=function(_0x41d1e8,_0x112fa0){_0x41d1e8=_0x41d1e8-0x0;var _0x33c7bb=_0xae59[_0x41d1e8];return _0x33c7bb;};'use strict';var _=require(_0x9ae5('0x0'));var util=require(_0x9ae5('0x1'));var logger=require('../../config/logger')(_0x9ae5('0x2'));var moment=require(_0x9ae5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ae5('0x4'));var rimraf=require('rimraf');var config=require(_0x9ae5('0x5'));var attributes=require('./template.attributes');module[_0x9ae5('0x6')]=function(_0xc45bda,_0x52a073){return _0xc45bda['define']('Template',attributes,{'tableName':_0x9ae5('0x7'),'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 c87033c..b155b12 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 _0x9d7b=['jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','attributes','limit','include','map','model','debug','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5be42d,_0x1648c3){var _0x3b9c67=function(_0x25b20b){while(--_0x25b20b){_0x5be42d['push'](_0x5be42d['shift']());}};_0x3b9c67(++_0x1648c3);}(_0x9d7b,0xc5));var _0xb9d7=function(_0x45730c,_0x5aa7a1){_0x45730c=_0x45730c-0x0;var _0xf66e31=_0x9d7b[_0x45730c];return _0xf66e31;};'use strict';var _=require('lodash');var util=require(_0xb9d7('0x0'));var moment=require('moment');var BPromise=require(_0xb9d7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d7('0x2'))['db'];var utils=require(_0xb9d7('0x3'));var logger=require(_0xb9d7('0x4'))(_0xb9d7('0x5'));var config=require('../../config/environment');var jayson=require(_0xb9d7('0x6'));var client=jayson[_0xb9d7('0x7')][_0xb9d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25e462,_0x30446e,_0x2cd44f){return new BPromise(function(_0x1c11d5,_0x4eaf7d){return client[_0xb9d7('0x9')](_0x25e462,_0x2cd44f)[_0xb9d7('0xa')](function(_0x2ab9c3){logger[_0xb9d7('0xb')](_0xb9d7('0xc'),_0x30446e,_0xb9d7('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x30446e,_0xb9d7('0xd'),JSON[_0xb9d7('0xe')](_0x2ab9c3));if(_0x2ab9c3[_0xb9d7('0xf')]){if(_0x2ab9c3[_0xb9d7('0xf')]['code']===0x1f4){logger[_0xb9d7('0xf')](_0xb9d7('0xc'),_0x30446e,_0x2ab9c3[_0xb9d7('0xf')][_0xb9d7('0x10')]);return _0x4eaf7d(_0x2ab9c3[_0xb9d7('0xf')]['message']);}logger['error'](_0xb9d7('0xc'),_0x30446e,_0x2ab9c3[_0xb9d7('0xf')][_0xb9d7('0x10')]);return _0x1c11d5(_0x2ab9c3['error']['message']);}else{logger[_0xb9d7('0xb')]('Template,\x20%s,\x20%s',_0x30446e,'request\x20sent');_0x1c11d5(_0x2ab9c3[_0xb9d7('0x11')][_0xb9d7('0x10')]);}})[_0xb9d7('0x12')](function(_0x2d646a){logger['error'](_0xb9d7('0xc'),_0x30446e,_0x2d646a);_0x4eaf7d(_0x2d646a);});});}exports[_0xb9d7('0x13')]=function(_0x5f027b){var _0xdd14a6=this;return new Promise(function(_0x1c78ba,_0x2b1097){return db[_0xb9d7('0x14')][_0xb9d7('0x15')]({'raw':_0x5f027b[_0xb9d7('0x16')]?_0x5f027b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5f027b['options']?_0x5f027b['options']['where']||null:null,'attributes':_0x5f027b[_0xb9d7('0x16')]?_0x5f027b[_0xb9d7('0x16')][_0xb9d7('0x17')]||null:null,'limit':_0x5f027b[_0xb9d7('0x16')]?_0x5f027b[_0xb9d7('0x16')][_0xb9d7('0x18')]||null:null,'include':_0x5f027b[_0xb9d7('0x16')]?_0x5f027b[_0xb9d7('0x16')][_0xb9d7('0x19')]?_[_0xb9d7('0x1a')](_0x5f027b['options'][_0xb9d7('0x19')],function(_0xfd747f){return{'model':db[_0xfd747f['model']],'as':_0xfd747f['as'],'attributes':_0xfd747f['attributes'],'include':_0xfd747f['include']?_[_0xb9d7('0x1a')](_0xfd747f[_0xb9d7('0x19')],function(_0x178087){return{'model':db[_0x178087[_0xb9d7('0x1b')]],'as':_0x178087['as'],'attributes':_0x178087[_0xb9d7('0x17')],'include':_0x178087[_0xb9d7('0x19')]?_[_0xb9d7('0x1a')](_0x178087[_0xb9d7('0x19')],function(_0xa3d219){return{'model':db[_0xa3d219[_0xb9d7('0x1b')]],'as':_0xa3d219['as'],'attributes':_0xa3d219[_0xb9d7('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb9d7('0xa')](function(_0x19faea){logger['info'](_0xb9d7('0x13'),_0x5f027b);logger[_0xb9d7('0x1c')](_0xb9d7('0x13'),_0x5f027b,JSON[_0xb9d7('0xe')](_0x19faea));_0x1c78ba(_0x19faea);})['catch'](function(_0x34c9fc){logger[_0xb9d7('0xf')](_0xb9d7('0x13'),_0x34c9fc[_0xb9d7('0x10')],_0x5f027b);_0x2b1097(_0xdd14a6[_0xb9d7('0xf')](0x1f4,_0x34c9fc[_0xb9d7('0x10')]));});});}; \ No newline at end of file +var _0xe5d6=['catch','GetTemplate','Template','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x270465,_0xb4462c){var _0x5c4c43=function(_0x551f78){while(--_0x551f78){_0x270465['push'](_0x270465['shift']());}};_0x5c4c43(++_0xb4462c);}(_0xe5d6,0xba));var _0x6e5d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xe5d6[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x6e5d('0x0'));var util=require(_0x6e5d('0x1'));var moment=require(_0x6e5d('0x2'));var BPromise=require(_0x6e5d('0x3'));var rs=require(_0x6e5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e5d('0x5'))['db'];var utils=require(_0x6e5d('0x6'));var logger=require(_0x6e5d('0x7'))(_0x6e5d('0x8'));var config=require(_0x6e5d('0x9'));var jayson=require(_0x6e5d('0xa'));var client=jayson[_0x6e5d('0xb')][_0x6e5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18f7b4,_0x25152b,_0x264e29){return new BPromise(function(_0x52387b,_0x5b8f3c){return client[_0x6e5d('0xd')](_0x18f7b4,_0x264e29)['then'](function(_0x28ac0a){logger['info'](_0x6e5d('0xe'),_0x25152b,_0x6e5d('0xf'));logger[_0x6e5d('0x10')](_0x6e5d('0x11'),_0x25152b,_0x6e5d('0xf'),JSON[_0x6e5d('0x12')](_0x28ac0a));if(_0x28ac0a['error']){if(_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x14')]===0x1f4){logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x25152b,_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x15')]);return _0x5b8f3c(_0x28ac0a[_0x6e5d('0x13')]['message']);}logger[_0x6e5d('0x13')](_0x6e5d('0xe'),_0x25152b,_0x28ac0a[_0x6e5d('0x13')]['message']);return _0x52387b(_0x28ac0a[_0x6e5d('0x13')][_0x6e5d('0x15')]);}else{logger[_0x6e5d('0x16')](_0x6e5d('0xe'),_0x25152b,'request\x20sent');_0x52387b(_0x28ac0a[_0x6e5d('0x17')][_0x6e5d('0x15')]);}})[_0x6e5d('0x18')](function(_0x3e4745){logger['error'](_0x6e5d('0xe'),_0x25152b,_0x3e4745);_0x5b8f3c(_0x3e4745);});});}exports[_0x6e5d('0x19')]=function(_0x3b11ad){var _0x1a8b08=this;return new Promise(function(_0x71f6be,_0x4606f3){return db[_0x6e5d('0x1a')]['findAll']({'raw':_0x3b11ad[_0x6e5d('0x1b')]?_0x3b11ad['options'][_0x6e5d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b11ad[_0x6e5d('0x1b')]?_0x3b11ad['options'][_0x6e5d('0x1d')]||null:null,'attributes':_0x3b11ad[_0x6e5d('0x1b')]?_0x3b11ad['options'][_0x6e5d('0x1e')]||null:null,'limit':_0x3b11ad[_0x6e5d('0x1b')]?_0x3b11ad['options'][_0x6e5d('0x1f')]||null:null,'include':_0x3b11ad[_0x6e5d('0x1b')]?_0x3b11ad['options']['include']?_['map'](_0x3b11ad[_0x6e5d('0x1b')][_0x6e5d('0x20')],function(_0x156177){return{'model':db[_0x156177[_0x6e5d('0x21')]],'as':_0x156177['as'],'attributes':_0x156177[_0x6e5d('0x1e')],'include':_0x156177[_0x6e5d('0x20')]?_[_0x6e5d('0x22')](_0x156177['include'],function(_0x3a29a3){return{'model':db[_0x3a29a3[_0x6e5d('0x21')]],'as':_0x3a29a3['as'],'attributes':_0x3a29a3[_0x6e5d('0x1e')],'include':_0x3a29a3[_0x6e5d('0x20')]?_[_0x6e5d('0x22')](_0x3a29a3[_0x6e5d('0x20')],function(_0x7af4d4){return{'model':db[_0x7af4d4[_0x6e5d('0x21')]],'as':_0x7af4d4['as'],'attributes':_0x7af4d4[_0x6e5d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8c092f){logger[_0x6e5d('0x16')](_0x6e5d('0x19'),_0x3b11ad);logger['debug'](_0x6e5d('0x19'),_0x3b11ad,JSON['stringify'](_0x8c092f));_0x71f6be(_0x8c092f);})[_0x6e5d('0x18')](function(_0x172ac6){logger['error'](_0x6e5d('0x19'),_0x172ac6[_0x6e5d('0x15')],_0x3b11ad);_0x4606f3(_0x1a8b08[_0x6e5d('0x13')](0x1f4,_0x172ac6[_0x6e5d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 70a617c..d8a9df6 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 _0x7382=['../../config/environment','./trigger.controller','get','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','isAuthenticated','create','addAllCondition','addAnyCondition','put','delete','destroy','exports','util','../../components/auth/service','../../components/interaction/service'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7382,0x111));var _0x2738=function(_0x20318a,_0x108fc2){_0x20318a=_0x20318a-0x0;var _0x3f2688=_0x7382[_0x20318a];return _0x3f2688;};'use strict';var multer=require('multer');var util=require(_0x2738('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(_0x2738('0x1'));var interaction=require(_0x2738('0x2'));var config=require(_0x2738('0x3'));var controller=require(_0x2738('0x4'));router[_0x2738('0x5')]('/',auth['isAuthenticated'](),controller[_0x2738('0x6')]);router[_0x2738('0x5')](_0x2738('0x7'),auth['isAuthenticated'](),controller[_0x2738('0x8')]);router[_0x2738('0x5')](_0x2738('0x9'),auth['isAuthenticated'](),controller[_0x2738('0xa')]);router[_0x2738('0x5')](_0x2738('0xb'),auth['isAuthenticated'](),controller[_0x2738('0xc')]);router[_0x2738('0x5')](_0x2738('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x2738('0xe')]('/',auth[_0x2738('0xf')](),controller[_0x2738('0x10')]);router[_0x2738('0xe')](_0x2738('0x9'),auth[_0x2738('0xf')](),controller[_0x2738('0x11')]);router[_0x2738('0xe')](_0x2738('0xb'),auth[_0x2738('0xf')](),controller[_0x2738('0x12')]);router['post'](_0x2738('0xd'),auth[_0x2738('0xf')](),controller['addAction']);router[_0x2738('0x13')]('/:id',auth[_0x2738('0xf')](),controller['update']);router[_0x2738('0x14')]('/:id',auth[_0x2738('0xf')](),controller[_0x2738('0x15')]);module[_0x2738('0x16')]=router; \ No newline at end of file +var _0xbd48=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','index','/:id','isAuthenticated','show','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x31865c,_0x1f2090){var _0x388d36=function(_0x4efde5){while(--_0x4efde5){_0x31865c['push'](_0x31865c['shift']());}};_0x388d36(++_0x1f2090);}(_0xbd48,0x191));var _0x8bd4=function(_0x64db63,_0x2e054d){_0x64db63=_0x64db63-0x0;var _0x5d7384=_0xbd48[_0x64db63];return _0x5d7384;};'use strict';var multer=require(_0x8bd4('0x0'));var util=require(_0x8bd4('0x1'));var path=require(_0x8bd4('0x2'));var timeout=require(_0x8bd4('0x3'));var express=require('express');var router=express[_0x8bd4('0x4')]();var fs_extra=require(_0x8bd4('0x5'));var auth=require(_0x8bd4('0x6'));var interaction=require(_0x8bd4('0x7'));var config=require('../../config/environment');var controller=require(_0x8bd4('0x8'));router[_0x8bd4('0x9')]('/',auth['isAuthenticated'](),controller[_0x8bd4('0xa')]);router['get'](_0x8bd4('0xb'),auth[_0x8bd4('0xc')](),controller[_0x8bd4('0xd')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router[_0x8bd4('0x9')]('/:id/any_conditions',auth[_0x8bd4('0xc')](),controller[_0x8bd4('0xe')]);router['get'](_0x8bd4('0xf'),auth[_0x8bd4('0xc')](),controller[_0x8bd4('0x10')]);router[_0x8bd4('0x11')]('/',auth[_0x8bd4('0xc')](),controller[_0x8bd4('0x12')]);router['post'](_0x8bd4('0x13'),auth[_0x8bd4('0xc')](),controller[_0x8bd4('0x14')]);router['post'](_0x8bd4('0x15'),auth['isAuthenticated'](),controller[_0x8bd4('0x16')]);router[_0x8bd4('0x11')]('/:id/actions',auth[_0x8bd4('0xc')](),controller[_0x8bd4('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8bd4('0x18')]);router[_0x8bd4('0x19')](_0x8bd4('0xb'),auth[_0x8bd4('0xc')](),controller[_0x8bd4('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3126a5b..52c85f9 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 _0x0a90=['exports','STRING','BOOLEAN'];(function(_0x573db1,_0x166769){var _0x2561d5=function(_0x5ab1ce){while(--_0x5ab1ce){_0x573db1['push'](_0x573db1['shift']());}};_0x2561d5(++_0x166769);}(_0x0a90,0xd2));var _0x00a9=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x0a90[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require('sequelize');module[_0x00a9('0x0')]={'name':{'type':Sequelize[_0x00a9('0x1')]},'channel':{'type':Sequelize[_0x00a9('0x1')]},'description':{'type':Sequelize[_0x00a9('0x1')]},'status':{'type':Sequelize[_0x00a9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x71a4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x71a4,0x1be));var _0x471a=function(_0x4c91a4,_0x52be8e){_0x4c91a4=_0x4c91a4-0x0;var _0x4c5594=_0x71a4[_0x4c91a4];return _0x4c5594;};'use strict';var Sequelize=require(_0x471a('0x0'));module[_0x471a('0x1')]={'name':{'type':Sequelize[_0x471a('0x2')]},'channel':{'type':Sequelize[_0x471a('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x471a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 290453d..d642d33 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 _0xd57e=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Trigger','catch','show','keys','length','includeAll','include','find','create','body','user','role','Triggers','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','TriggerAllId','addAnyCondition','getAllConditions','findOne','Condition','getAnyConditions','pick','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x430f53,_0x47ec74){var _0x179ebd=function(_0x330cbe){while(--_0x330cbe){_0x430f53['push'](_0x430f53['shift']());}};_0x179ebd(++_0x47ec74);}(_0xd57e,0xaf));var _0xed57=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xd57e[_0x173113];return _0x3bea89;};'use strict';var emlformat=require(_0xed57('0x0'));var rimraf=require(_0xed57('0x1'));var zipdir=require(_0xed57('0x2'));var jsonpatch=require(_0xed57('0x3'));var rp=require(_0xed57('0x4'));var moment=require(_0xed57('0x5'));var BPromise=require(_0xed57('0x6'));var Mustache=require(_0xed57('0x7'));var util=require(_0xed57('0x8'));var path=require(_0xed57('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed57('0xa'));var fs=require('fs');var fs_extra=require(_0xed57('0xb'));var _=require(_0xed57('0xc'));var squel=require(_0xed57('0xd'));var crypto=require('crypto');var jsforce=require(_0xed57('0xe'));var deskjs=require(_0xed57('0xf'));var toCsv=require('to-csv');var querystring=require(_0xed57('0x10'));var Papa=require(_0xed57('0x11'));var Redis=require(_0xed57('0x12'));var authService=require(_0xed57('0x13'));var qs=require(_0xed57('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed57('0x15'));var logger=require('../../config/logger')(_0xed57('0x16'));var utils=require(_0xed57('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xed57('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1447,_0x1cfc78){_0x1cfc78=_0x1cfc78||0xcc;return function(_0x3ee4e9){if(_0x3ee4e9){return _0x3c1447[_0xed57('0x19')](_0x1cfc78);}return _0x3c1447['status'](_0x1cfc78)['end']();};}function respondWithResult(_0x5b7a5a,_0x3dba9e){_0x3dba9e=_0x3dba9e||0xc8;return function(_0x5d1430){if(_0x5d1430){return _0x5b7a5a[_0xed57('0x1a')](_0x3dba9e)[_0xed57('0x1b')](_0x5d1430);}};}function respondWithFilteredResult(_0x45c843,_0x414ec2){return function(_0x3ef263){if(_0x3ef263){var _0x539655=typeof _0x414ec2['offset']==='undefined'&&typeof _0x414ec2['limit']===_0xed57('0x1c');var _0x4c2b8a=_0x3ef263[_0xed57('0x1d')];var _0xab6d6=_0x539655?0x0:_0x414ec2[_0xed57('0x1e')];var _0x1d7211=_0x539655?_0x3ef263[_0xed57('0x1d')]:_0x414ec2[_0xed57('0x1e')]+_0x414ec2[_0xed57('0x1f')];var _0x1a1316;if(_0x1d7211>=_0x4c2b8a){_0x1d7211=_0x4c2b8a;_0x1a1316=0xc8;}else{_0x1a1316=0xce;}_0x45c843[_0xed57('0x1a')](_0x1a1316);return _0x45c843[_0xed57('0x20')](_0xed57('0x21'),_0xab6d6+'-'+_0x1d7211+'/'+_0x4c2b8a)[_0xed57('0x1b')](_0x3ef263);}return null;};}function patchUpdates(_0xf12a05){return function(_0x182dbe){try{jsonpatch[_0xed57('0x22')](_0x182dbe,_0xf12a05,!![]);}catch(_0x16d3d4){return BPromise[_0xed57('0x23')](_0x16d3d4);}return _0x182dbe[_0xed57('0x24')]();};}function saveUpdates(_0x2f3321,_0x5d026e){return function(_0x261fe9){if(_0x261fe9){return _0x261fe9['update'](_0x2f3321)[_0xed57('0x25')](function(_0x324dc5){return _0x324dc5;});}return null;};}function removeEntity(_0x234a07,_0x316be7){return function(_0x4d4790){if(_0x4d4790){return _0x4d4790['destroy']()['then'](function(){var _0x2c3439=_0x4d4790[_0xed57('0x26')]({'plain':!![]});var _0x409228='Triggers';return db[_0xed57('0x27')][_0xed57('0x28')]({'where':{'type':_0x409228,'resourceId':_0x2c3439['id']}})[_0xed57('0x25')](function(){return _0x4d4790;});})['then'](function(){_0x234a07[_0xed57('0x1a')](0xcc)[_0xed57('0x29')]();});}};}function handleEntityNotFound(_0x47f809,_0x2ee36b){return function(_0x1b0090){if(!_0x1b0090){_0x47f809[_0xed57('0x19')](0x194);}return _0x1b0090;};}function handleError(_0x10c0b0,_0xc7d778){_0xc7d778=_0xc7d778||0x1f4;return function(_0x372d88){logger['error'](_0x372d88[_0xed57('0x2a')]);if(_0x372d88[_0xed57('0x2b')]){delete _0x372d88[_0xed57('0x2b')];}_0x10c0b0[_0xed57('0x1a')](_0xc7d778)[_0xed57('0x2c')](_0x372d88);};}exports[_0xed57('0x2d')]=function(_0x4b8f04,_0x25b2c7){var _0x25906a={},_0x53ff0a={},_0x3122df={'count':0x0,'rows':[]};var _0x42c110=_[_0xed57('0x2e')](db['Trigger'][_0xed57('0x2f')],function(_0x371de1){return{'name':_0x371de1[_0xed57('0x30')],'type':_0x371de1[_0xed57('0x31')]['key']};});_0x53ff0a[_0xed57('0x32')]=_[_0xed57('0x2e')](_0x42c110,'name');_0x53ff0a[_0xed57('0x33')]=_['keys'](_0x4b8f04[_0xed57('0x33')]);_0x53ff0a[_0xed57('0x34')]=_[_0xed57('0x35')](_0x53ff0a['model'],_0x53ff0a['query']);_0x25906a[_0xed57('0x36')]=_[_0xed57('0x35')](_0x53ff0a[_0xed57('0x32')],qs[_0xed57('0x37')](_0x4b8f04[_0xed57('0x33')][_0xed57('0x37')]));_0x25906a[_0xed57('0x36')]=_0x25906a[_0xed57('0x36')]['length']?_0x25906a['attributes']:_0x53ff0a[_0xed57('0x32')];if(!_0x4b8f04[_0xed57('0x33')][_0xed57('0x38')](_0xed57('0x39'))){_0x25906a[_0xed57('0x1f')]=qs[_0xed57('0x1f')](_0x4b8f04[_0xed57('0x33')][_0xed57('0x1f')]);_0x25906a[_0xed57('0x1e')]=qs[_0xed57('0x1e')](_0x4b8f04[_0xed57('0x33')][_0xed57('0x1e')]);}_0x25906a[_0xed57('0x3a')]=qs[_0xed57('0x3b')](_0x4b8f04[_0xed57('0x33')]['sort']);_0x25906a[_0xed57('0x3c')]=qs[_0xed57('0x34')](_['pick'](_0x4b8f04[_0xed57('0x33')],_0x53ff0a['filters']),_0x42c110);if(_0x4b8f04[_0xed57('0x33')][_0xed57('0x3d')]){_0x25906a[_0xed57('0x3c')]=_[_0xed57('0x3e')](_0x25906a['where'],{'$or':_[_0xed57('0x2e')](_0x42c110,function(_0x5012c4){if(_0x5012c4[_0xed57('0x31')]!=='VIRTUAL'){var _0x22a34a={};_0x22a34a[_0x5012c4[_0xed57('0x2b')]]={'$like':'%'+_0x4b8f04[_0xed57('0x33')][_0xed57('0x3d')]+'%'};return _0x22a34a;}})});}_0x25906a=_[_0xed57('0x3e')]({},_0x25906a,_0x4b8f04[_0xed57('0x3f')]);var _0x50f521={'where':_0x25906a['where']};return db[_0xed57('0x40')][_0xed57('0x1d')](_0x50f521)[_0xed57('0x25')](function(_0x17c4a6){_0x3122df['count']=_0x17c4a6;if(_0x4b8f04[_0xed57('0x33')]['includeAll']){_0x25906a['include']=[{'all':!![]}];}return db[_0xed57('0x40')]['findAll'](_0x25906a);})[_0xed57('0x25')](function(_0x1b6203){_0x3122df['rows']=_0x1b6203;return _0x3122df;})['then'](respondWithFilteredResult(_0x25b2c7,_0x25906a))[_0xed57('0x41')](handleError(_0x25b2c7,null));};exports[_0xed57('0x42')]=function(_0x2bab8f,_0x343a39){var _0x34b34c={'raw':![],'where':{'id':_0x2bab8f['params']['id']}},_0x3af7cd={};_0x3af7cd[_0xed57('0x32')]=_[_0xed57('0x43')](db[_0xed57('0x40')][_0xed57('0x2f')]);_0x3af7cd[_0xed57('0x33')]=_[_0xed57('0x43')](_0x2bab8f[_0xed57('0x33')]);_0x3af7cd[_0xed57('0x34')]=_[_0xed57('0x35')](_0x3af7cd[_0xed57('0x32')],_0x3af7cd[_0xed57('0x33')]);_0x34b34c[_0xed57('0x36')]=_[_0xed57('0x35')](_0x3af7cd[_0xed57('0x32')],qs['fields'](_0x2bab8f[_0xed57('0x33')][_0xed57('0x37')]));_0x34b34c[_0xed57('0x36')]=_0x34b34c[_0xed57('0x36')][_0xed57('0x44')]?_0x34b34c[_0xed57('0x36')]:_0x3af7cd[_0xed57('0x32')];if(_0x2bab8f[_0xed57('0x33')][_0xed57('0x45')]){_0x34b34c[_0xed57('0x46')]=[{'all':!![]}];}_0x34b34c=_[_0xed57('0x3e')]({},_0x34b34c,_0x2bab8f[_0xed57('0x3f')]);return db[_0xed57('0x40')][_0xed57('0x47')](_0x34b34c)[_0xed57('0x25')](handleEntityNotFound(_0x343a39,null))['then'](respondWithResult(_0x343a39,null))[_0xed57('0x41')](handleError(_0x343a39,null));};exports[_0xed57('0x48')]=function(_0x1fd261,_0xd4c48a){return db['Trigger']['create'](_0x1fd261[_0xed57('0x49')],{})['then'](function(_0x58688a){var _0x474732=_0x1fd261[_0xed57('0x4a')]['get']({'plain':!![]});if(!_0x474732)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x474732[_0xed57('0x4b')]===_0xed57('0x4a')){var _0x13079e=_0x58688a[_0xed57('0x26')]({'plain':!![]});var _0x29c1fa=_0xed57('0x4c');return db[_0xed57('0x4d')]['find']({'where':{'name':_0x29c1fa,'userProfileId':_0x474732['userProfileId']},'raw':!![]})['then'](function(_0x5e0c15){if(_0x5e0c15&&_0x5e0c15[_0xed57('0x4e')]===0x0){return db[_0xed57('0x27')][_0xed57('0x48')]({'name':_0x13079e['name'],'resourceId':_0x13079e['id'],'type':_0x5e0c15[_0xed57('0x2b')],'sectionId':_0x5e0c15['id']},{})['then'](function(){return _0x58688a;});}else{return _0x58688a;}})[_0xed57('0x41')](function(_0x49d793){logger['error'](_0xed57('0x4f'),_0x49d793);throw _0x49d793;});}return _0x58688a;})[_0xed57('0x25')](respondWithResult(_0xd4c48a,0xc9))[_0xed57('0x41')](handleError(_0xd4c48a,null));};exports[_0xed57('0x50')]=function(_0x1b1c0d,_0x4c7da3){if(_0x1b1c0d['body']['id']){delete _0x1b1c0d[_0xed57('0x49')]['id'];}return db[_0xed57('0x40')][_0xed57('0x47')]({'where':{'id':_0x1b1c0d['params']['id']}})['then'](handleEntityNotFound(_0x4c7da3,null))[_0xed57('0x25')](saveUpdates(_0x1b1c0d[_0xed57('0x49')],null))[_0xed57('0x25')](respondWithResult(_0x4c7da3,null))[_0xed57('0x41')](handleError(_0x4c7da3,null));};exports[_0xed57('0x28')]=function(_0x1bbb8b,_0x276412){return db[_0xed57('0x40')][_0xed57('0x47')]({'where':{'id':_0x1bbb8b[_0xed57('0x51')]['id']}})[_0xed57('0x25')](handleEntityNotFound(_0x276412,null))[_0xed57('0x25')](removeEntity(_0x276412,null))[_0xed57('0x41')](handleError(_0x276412,null));};exports['addAllCondition']=function(_0x3c15b5,_0xc56545,_0xbb3c5d){if(_0x3c15b5[_0xed57('0x49')]['id']){delete _0x3c15b5[_0xed57('0x49')]['id'];}return db[_0xed57('0x40')][_0xed57('0x47')]({'where':{'id':_0x3c15b5[_0xed57('0x51')]['id']}})['then'](handleEntityNotFound(_0xc56545,null))['then'](function(_0x1aea12){if(_0x1aea12){_0x3c15b5[_0xed57('0x49')][_0xed57('0x52')]=_0x1aea12['id'];return db['Condition']['create'](_0x3c15b5[_0xed57('0x49')]);}})[_0xed57('0x25')](respondWithResult(_0xc56545,null))[_0xed57('0x41')](handleError(_0xc56545,null));};exports[_0xed57('0x53')]=function(_0x4ca317,_0x2b9e11,_0x2816ae){if(_0x4ca317['body']['id']){delete _0x4ca317[_0xed57('0x49')]['id'];}return db[_0xed57('0x40')]['find']({'where':{'id':_0x4ca317[_0xed57('0x51')]['id']}})[_0xed57('0x25')](handleEntityNotFound(_0x2b9e11,null))['then'](function(_0x373f3e){if(_0x373f3e){_0x4ca317['body']['TriggerAnyId']=_0x373f3e['id'];return db['Condition'][_0xed57('0x48')](_0x4ca317[_0xed57('0x49')]);}})['then'](respondWithResult(_0x2b9e11,null))['catch'](handleError(_0x2b9e11,null));};exports[_0xed57('0x54')]=function(_0x5aeb04,_0x2e3349,_0x311079){var _0x1fba75={};var _0x750c77={};var _0x46ad0b;var _0x110c68;return db[_0xed57('0x40')][_0xed57('0x55')]({'where':{'id':_0x5aeb04[_0xed57('0x51')]['id']}})[_0xed57('0x25')](handleEntityNotFound(_0x2e3349,null))['then'](function(_0x5b6062){if(_0x5b6062){_0x46ad0b=_0x5b6062;_0x750c77[_0xed57('0x32')]=_[_0xed57('0x43')](db[_0xed57('0x56')][_0xed57('0x2f')]);_0x750c77[_0xed57('0x33')]=_[_0xed57('0x43')](_0x5aeb04[_0xed57('0x33')]);_0x750c77[_0xed57('0x34')]=_[_0xed57('0x35')](_0x750c77['model'],_0x750c77[_0xed57('0x33')]);_0x1fba75['attributes']=_[_0xed57('0x35')](_0x750c77[_0xed57('0x32')],qs[_0xed57('0x37')](_0x5aeb04['query'][_0xed57('0x37')]));_0x1fba75[_0xed57('0x36')]=_0x1fba75[_0xed57('0x36')][_0xed57('0x44')]?_0x1fba75[_0xed57('0x36')]:_0x750c77['model'];_0x1fba75[_0xed57('0x3a')]=qs['sort'](_0x5aeb04['query'][_0xed57('0x3b')]);_0x1fba75[_0xed57('0x3c')]=qs['filters'](_['pick'](_0x5aeb04[_0xed57('0x33')],_0x750c77[_0xed57('0x34')]));if(_0x5aeb04[_0xed57('0x33')][_0xed57('0x3d')]){_0x1fba75['where']=_[_0xed57('0x3e')](_0x1fba75[_0xed57('0x3c')],{'$or':_['map'](_0x1fba75['attributes'],function(_0x292aad){var _0x3b3bbf={};_0x3b3bbf[_0x292aad]={'$like':'%'+_0x5aeb04['query'][_0xed57('0x3d')]+'%'};return _0x3b3bbf;})});}_0x1fba75=_['merge']({},_0x1fba75,_0x5aeb04[_0xed57('0x3f')]);return _0x46ad0b[_0xed57('0x54')](_0x1fba75);}})[_0xed57('0x25')](function(_0x336fab){if(_0x336fab){_0x110c68=_0x336fab[_0xed57('0x44')];if(!_0x5aeb04[_0xed57('0x33')][_0xed57('0x38')](_0xed57('0x39'))){_0x1fba75[_0xed57('0x1f')]=qs[_0xed57('0x1f')](_0x5aeb04[_0xed57('0x33')][_0xed57('0x1f')]);_0x1fba75['offset']=qs['offset'](_0x5aeb04[_0xed57('0x33')][_0xed57('0x1e')]);}return _0x46ad0b[_0xed57('0x54')](_0x1fba75);}})['then'](function(_0x448524){if(_0x448524){return _0x448524?{'count':_0x110c68,'rows':_0x448524}:null;}})[_0xed57('0x25')](respondWithResult(_0x2e3349,null))[_0xed57('0x41')](handleError(_0x2e3349,null));};exports[_0xed57('0x57')]=function(_0x4615d4,_0x1d6f8b,_0x33a4c9){var _0x3b359a={};var _0xa0e5c={};var _0x2cccb8;var _0x2d991b;return db['Trigger'][_0xed57('0x55')]({'where':{'id':_0x4615d4[_0xed57('0x51')]['id']}})['then'](handleEntityNotFound(_0x1d6f8b,null))[_0xed57('0x25')](function(_0x3d26af){if(_0x3d26af){_0x2cccb8=_0x3d26af;_0xa0e5c[_0xed57('0x32')]=_['keys'](db[_0xed57('0x56')][_0xed57('0x2f')]);_0xa0e5c['query']=_[_0xed57('0x43')](_0x4615d4[_0xed57('0x33')]);_0xa0e5c[_0xed57('0x34')]=_[_0xed57('0x35')](_0xa0e5c[_0xed57('0x32')],_0xa0e5c[_0xed57('0x33')]);_0x3b359a['attributes']=_[_0xed57('0x35')](_0xa0e5c[_0xed57('0x32')],qs[_0xed57('0x37')](_0x4615d4['query'][_0xed57('0x37')]));_0x3b359a['attributes']=_0x3b359a['attributes'][_0xed57('0x44')]?_0x3b359a[_0xed57('0x36')]:_0xa0e5c['model'];_0x3b359a[_0xed57('0x3a')]=qs['sort'](_0x4615d4[_0xed57('0x33')][_0xed57('0x3b')]);_0x3b359a['where']=qs[_0xed57('0x34')](_[_0xed57('0x58')](_0x4615d4[_0xed57('0x33')],_0xa0e5c[_0xed57('0x34')]));if(_0x4615d4[_0xed57('0x33')]['filter']){_0x3b359a[_0xed57('0x3c')]=_['merge'](_0x3b359a[_0xed57('0x3c')],{'$or':_[_0xed57('0x2e')](_0x3b359a[_0xed57('0x36')],function(_0x20fe5d){var _0x537be6={};_0x537be6[_0x20fe5d]={'$like':'%'+_0x4615d4[_0xed57('0x33')]['filter']+'%'};return _0x537be6;})});}_0x3b359a=_[_0xed57('0x3e')]({},_0x3b359a,_0x4615d4[_0xed57('0x3f')]);return _0x2cccb8[_0xed57('0x57')](_0x3b359a);}})[_0xed57('0x25')](function(_0x4a6073){if(_0x4a6073){_0x2d991b=_0x4a6073['length'];if(!_0x4615d4[_0xed57('0x33')][_0xed57('0x38')](_0xed57('0x39'))){_0x3b359a[_0xed57('0x1f')]=qs[_0xed57('0x1f')](_0x4615d4['query'][_0xed57('0x1f')]);_0x3b359a[_0xed57('0x1e')]=qs[_0xed57('0x1e')](_0x4615d4[_0xed57('0x33')][_0xed57('0x1e')]);}return _0x2cccb8[_0xed57('0x57')](_0x3b359a);}})[_0xed57('0x25')](function(_0x14a9b2){if(_0x14a9b2){return _0x14a9b2?{'count':_0x2d991b,'rows':_0x14a9b2}:null;}})['then'](respondWithResult(_0x1d6f8b,null))['catch'](handleError(_0x1d6f8b,null));};exports[_0xed57('0x59')]=function(_0x581551,_0x4185b5,_0x177e0c){if(_0x581551['body']['id']){delete _0x581551[_0xed57('0x49')]['id'];}return db['Trigger'][_0xed57('0x47')]({'where':{'id':_0x581551[_0xed57('0x51')]['id']}})['then'](handleEntityNotFound(_0x4185b5,null))[_0xed57('0x25')](function(_0x3ced31){if(_0x3ced31){_0x581551['body'][_0xed57('0x5a')]=_0x3ced31['id'];return db[_0xed57('0x5b')][_0xed57('0x48')](_0x581551['body']);}})['then'](respondWithResult(_0x4185b5,null))[_0xed57('0x41')](handleError(_0x4185b5,null));};exports['getActions']=function(_0x3515fe,_0x31682a,_0x148961){var _0x3c627a={};var _0x5a1ea5={};var _0x593da5;var _0x5519e3;return db[_0xed57('0x40')]['findOne']({'where':{'id':_0x3515fe[_0xed57('0x51')]['id']}})['then'](handleEntityNotFound(_0x31682a,null))['then'](function(_0x582d34){if(_0x582d34){_0x593da5=_0x582d34;_0x5a1ea5[_0xed57('0x32')]=_[_0xed57('0x43')](db[_0xed57('0x5b')][_0xed57('0x2f')]);_0x5a1ea5[_0xed57('0x33')]=_['keys'](_0x3515fe['query']);_0x5a1ea5['filters']=_['intersection'](_0x5a1ea5[_0xed57('0x32')],_0x5a1ea5[_0xed57('0x33')]);_0x3c627a[_0xed57('0x36')]=_[_0xed57('0x35')](_0x5a1ea5[_0xed57('0x32')],qs[_0xed57('0x37')](_0x3515fe['query'][_0xed57('0x37')]));_0x3c627a[_0xed57('0x36')]=_0x3c627a[_0xed57('0x36')][_0xed57('0x44')]?_0x3c627a[_0xed57('0x36')]:_0x5a1ea5['model'];_0x3c627a[_0xed57('0x3a')]=qs['sort'](_0x3515fe[_0xed57('0x33')]['sort']);_0x3c627a['where']=qs[_0xed57('0x34')](_['pick'](_0x3515fe[_0xed57('0x33')],_0x5a1ea5['filters']));if(_0x3515fe[_0xed57('0x33')][_0xed57('0x3d')]){_0x3c627a[_0xed57('0x3c')]=_[_0xed57('0x3e')](_0x3c627a[_0xed57('0x3c')],{'$or':_[_0xed57('0x2e')](_0x3c627a[_0xed57('0x36')],function(_0x380c8d){var _0x2040b8={};_0x2040b8[_0x380c8d]={'$like':'%'+_0x3515fe[_0xed57('0x33')][_0xed57('0x3d')]+'%'};return _0x2040b8;})});}_0x3c627a=_[_0xed57('0x3e')]({},_0x3c627a,_0x3515fe['options']);return _0x593da5[_0xed57('0x5c')](_0x3c627a);}})['then'](function(_0x22dae5){if(_0x22dae5){_0x5519e3=_0x22dae5['length'];if(!_0x3515fe[_0xed57('0x33')][_0xed57('0x38')](_0xed57('0x39'))){_0x3c627a[_0xed57('0x1f')]=qs[_0xed57('0x1f')](_0x3515fe[_0xed57('0x33')][_0xed57('0x1f')]);_0x3c627a[_0xed57('0x1e')]=qs['offset'](_0x3515fe[_0xed57('0x33')][_0xed57('0x1e')]);}return _0x593da5[_0xed57('0x5c')](_0x3c627a);}})[_0xed57('0x25')](function(_0x269711){if(_0x269711){return _0x269711?{'count':_0x5519e3,'rows':_0x269711}:null;}})[_0xed57('0x25')](respondWithResult(_0x31682a,null))[_0xed57('0x41')](handleError(_0x31682a,null));}; \ No newline at end of file +var _0x6894=['options','findAll','rows','catch','params','includeAll','include','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','findOne','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','Triggers','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x1c0d3d,_0x2a8172){var _0xb39a2d=function(_0x5a45ef){while(--_0x5a45ef){_0x1c0d3d['push'](_0x1c0d3d['shift']());}};_0xb39a2d(++_0x2a8172);}(_0x6894,0x7b));var _0x4689=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x6894[_0x342700];return _0x53406f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4689('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4689('0x1'));var rp=require(_0x4689('0x2'));var moment=require('moment');var BPromise=require(_0x4689('0x3'));var Mustache=require(_0x4689('0x4'));var util=require(_0x4689('0x5'));var path=require(_0x4689('0x6'));var sox=require(_0x4689('0x7'));var csv=require(_0x4689('0x8'));var ejs=require(_0x4689('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4689('0xa'));var squel=require('squel');var crypto=require(_0x4689('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4689('0xc'));var toCsv=require(_0x4689('0x8'));var querystring=require('querystring');var Papa=require(_0x4689('0xd'));var Redis=require(_0x4689('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4689('0xf'));var hardwareService=require(_0x4689('0x10'));var logger=require(_0x4689('0x11'))(_0x4689('0x12'));var utils=require(_0x4689('0x13'));var config=require(_0x4689('0x14'));var licenseUtil=require(_0x4689('0x15'));var db=require(_0x4689('0x16'))['db'];function respondWithStatusCode(_0x5f1775,_0x227292){_0x227292=_0x227292||0xcc;return function(_0x397259){if(_0x397259){return _0x5f1775[_0x4689('0x17')](_0x227292);}return _0x5f1775[_0x4689('0x18')](_0x227292)[_0x4689('0x19')]();};}function respondWithResult(_0x39bcec,_0x11729b){_0x11729b=_0x11729b||0xc8;return function(_0x6e8198){if(_0x6e8198){return _0x39bcec[_0x4689('0x18')](_0x11729b)[_0x4689('0x1a')](_0x6e8198);}};}function respondWithFilteredResult(_0x1a8ba9,_0x36fcb5){return function(_0x3905ac){if(_0x3905ac){var _0x36f3fc=typeof _0x36fcb5[_0x4689('0x1b')]===_0x4689('0x1c')&&typeof _0x36fcb5[_0x4689('0x1d')]===_0x4689('0x1c');var _0x2e981e=_0x3905ac[_0x4689('0x1e')];var _0x174058=_0x36f3fc?0x0:_0x36fcb5[_0x4689('0x1b')];var _0x4d4c48=_0x36f3fc?_0x3905ac[_0x4689('0x1e')]:_0x36fcb5[_0x4689('0x1b')]+_0x36fcb5[_0x4689('0x1d')];var _0x263829;if(_0x4d4c48>=_0x2e981e){_0x4d4c48=_0x2e981e;_0x263829=0xc8;}else{_0x263829=0xce;}_0x1a8ba9['status'](_0x263829);return _0x1a8ba9[_0x4689('0x1f')](_0x4689('0x20'),_0x174058+'-'+_0x4d4c48+'/'+_0x2e981e)[_0x4689('0x1a')](_0x3905ac);}return null;};}function patchUpdates(_0xe6a6fc){return function(_0x52ca96){try{jsonpatch[_0x4689('0x21')](_0x52ca96,_0xe6a6fc,!![]);}catch(_0x52a412){return BPromise[_0x4689('0x22')](_0x52a412);}return _0x52ca96['save']();};}function saveUpdates(_0x222631,_0x5e73e4){return function(_0x197aa4){if(_0x197aa4){return _0x197aa4[_0x4689('0x23')](_0x222631)['then'](function(_0x9bbeb3){return _0x9bbeb3;});}return null;};}function removeEntity(_0x2298cc,_0x3323a3){return function(_0x154138){if(_0x154138){return _0x154138[_0x4689('0x24')]()[_0x4689('0x25')](function(){var _0xd05bce=_0x154138['get']({'plain':!![]});var _0x513988=_0x4689('0x26');return db['UserProfileResource'][_0x4689('0x24')]({'where':{'type':_0x513988,'resourceId':_0xd05bce['id']}})[_0x4689('0x25')](function(){return _0x154138;});})[_0x4689('0x25')](function(){_0x2298cc['status'](0xcc)[_0x4689('0x19')]();});}};}function handleEntityNotFound(_0xe14c56,_0x561962){return function(_0x568233){if(!_0x568233){_0xe14c56[_0x4689('0x17')](0x194);}return _0x568233;};}function handleError(_0x1f21fc,_0x37ae8d){_0x37ae8d=_0x37ae8d||0x1f4;return function(_0x5c1f06){logger[_0x4689('0x27')](_0x5c1f06[_0x4689('0x28')]);if(_0x5c1f06['name']){delete _0x5c1f06[_0x4689('0x29')];}_0x1f21fc['status'](_0x37ae8d)['send'](_0x5c1f06);};}exports[_0x4689('0x2a')]=function(_0x3ff993,_0x374171){var _0xda1f0e={},_0x330972={},_0x5778b8={'count':0x0,'rows':[]};var _0x2dc18c=_[_0x4689('0x2b')](db[_0x4689('0x2c')][_0x4689('0x2d')],function(_0x487ce9){return{'name':_0x487ce9[_0x4689('0x2e')],'type':_0x487ce9[_0x4689('0x2f')][_0x4689('0x30')]};});_0x330972[_0x4689('0x31')]=_[_0x4689('0x2b')](_0x2dc18c,_0x4689('0x29'));_0x330972[_0x4689('0x32')]=_[_0x4689('0x33')](_0x3ff993[_0x4689('0x32')]);_0x330972[_0x4689('0x34')]=_[_0x4689('0x35')](_0x330972['model'],_0x330972[_0x4689('0x32')]);_0xda1f0e[_0x4689('0x36')]=_[_0x4689('0x35')](_0x330972['model'],qs[_0x4689('0x37')](_0x3ff993[_0x4689('0x32')][_0x4689('0x37')]));_0xda1f0e[_0x4689('0x36')]=_0xda1f0e[_0x4689('0x36')][_0x4689('0x38')]?_0xda1f0e[_0x4689('0x36')]:_0x330972[_0x4689('0x31')];if(!_0x3ff993[_0x4689('0x32')]['hasOwnProperty'](_0x4689('0x39'))){_0xda1f0e[_0x4689('0x1d')]=qs[_0x4689('0x1d')](_0x3ff993[_0x4689('0x32')][_0x4689('0x1d')]);_0xda1f0e[_0x4689('0x1b')]=qs[_0x4689('0x1b')](_0x3ff993[_0x4689('0x32')][_0x4689('0x1b')]);}_0xda1f0e[_0x4689('0x3a')]=qs[_0x4689('0x3b')](_0x3ff993['query'][_0x4689('0x3b')]);_0xda1f0e[_0x4689('0x3c')]=qs['filters'](_[_0x4689('0x3d')](_0x3ff993['query'],_0x330972[_0x4689('0x34')]),_0x2dc18c);if(_0x3ff993[_0x4689('0x32')]['filter']){_0xda1f0e[_0x4689('0x3c')]=_['merge'](_0xda1f0e[_0x4689('0x3c')],{'$or':_[_0x4689('0x2b')](_0x2dc18c,function(_0x2f25af){if(_0x2f25af['type']!==_0x4689('0x3e')){var _0x2b2672={};_0x2b2672[_0x2f25af[_0x4689('0x29')]]={'$like':'%'+_0x3ff993[_0x4689('0x32')][_0x4689('0x3f')]+'%'};return _0x2b2672;}})});}_0xda1f0e=_[_0x4689('0x40')]({},_0xda1f0e,_0x3ff993[_0x4689('0x41')]);var _0x3d64db={'where':_0xda1f0e[_0x4689('0x3c')]};return db[_0x4689('0x2c')][_0x4689('0x1e')](_0x3d64db)[_0x4689('0x25')](function(_0x2ca33e){_0x5778b8[_0x4689('0x1e')]=_0x2ca33e;if(_0x3ff993['query']['includeAll']){_0xda1f0e['include']=[{'all':!![]}];}return db[_0x4689('0x2c')][_0x4689('0x42')](_0xda1f0e);})[_0x4689('0x25')](function(_0x544221){_0x5778b8[_0x4689('0x43')]=_0x544221;return _0x5778b8;})[_0x4689('0x25')](respondWithFilteredResult(_0x374171,_0xda1f0e))[_0x4689('0x44')](handleError(_0x374171,null));};exports['show']=function(_0x1756d8,_0x246c74){var _0x6d6671={'raw':![],'where':{'id':_0x1756d8[_0x4689('0x45')]['id']}},_0x4a5c35={};_0x4a5c35[_0x4689('0x31')]=_[_0x4689('0x33')](db['Trigger'][_0x4689('0x2d')]);_0x4a5c35[_0x4689('0x32')]=_[_0x4689('0x33')](_0x1756d8[_0x4689('0x32')]);_0x4a5c35[_0x4689('0x34')]=_[_0x4689('0x35')](_0x4a5c35[_0x4689('0x31')],_0x4a5c35[_0x4689('0x32')]);_0x6d6671[_0x4689('0x36')]=_[_0x4689('0x35')](_0x4a5c35[_0x4689('0x31')],qs[_0x4689('0x37')](_0x1756d8[_0x4689('0x32')]['fields']));_0x6d6671['attributes']=_0x6d6671[_0x4689('0x36')][_0x4689('0x38')]?_0x6d6671[_0x4689('0x36')]:_0x4a5c35[_0x4689('0x31')];if(_0x1756d8['query'][_0x4689('0x46')]){_0x6d6671[_0x4689('0x47')]=[{'all':!![]}];}_0x6d6671=_[_0x4689('0x40')]({},_0x6d6671,_0x1756d8[_0x4689('0x41')]);return db['Trigger'][_0x4689('0x48')](_0x6d6671)['then'](handleEntityNotFound(_0x246c74,null))['then'](respondWithResult(_0x246c74,null))[_0x4689('0x44')](handleError(_0x246c74,null));};exports[_0x4689('0x49')]=function(_0x4463a9,_0x29b6bf){return db[_0x4689('0x2c')][_0x4689('0x49')](_0x4463a9[_0x4689('0x4a')],{})[_0x4689('0x25')](function(_0x285d52){var _0x565db2=_0x4463a9['user'][_0x4689('0x4b')]({'plain':!![]});if(!_0x565db2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x565db2[_0x4689('0x4c')]===_0x4689('0x4d')){var _0x5af142=_0x285d52[_0x4689('0x4b')]({'plain':!![]});var _0x32a8d5=_0x4689('0x26');return db[_0x4689('0x4e')]['find']({'where':{'name':_0x32a8d5,'userProfileId':_0x565db2[_0x4689('0x4f')]},'raw':!![]})[_0x4689('0x25')](function(_0x195c51){if(_0x195c51&&_0x195c51[_0x4689('0x50')]===0x0){return db[_0x4689('0x51')][_0x4689('0x49')]({'name':_0x5af142['name'],'resourceId':_0x5af142['id'],'type':_0x195c51[_0x4689('0x29')],'sectionId':_0x195c51['id']},{})['then'](function(){return _0x285d52;});}else{return _0x285d52;}})[_0x4689('0x44')](function(_0x86ca19){logger[_0x4689('0x27')](_0x4689('0x52'),_0x86ca19);throw _0x86ca19;});}return _0x285d52;})[_0x4689('0x25')](respondWithResult(_0x29b6bf,0xc9))[_0x4689('0x44')](handleError(_0x29b6bf,null));};exports[_0x4689('0x23')]=function(_0x3480db,_0x3f8a5f){if(_0x3480db[_0x4689('0x4a')]['id']){delete _0x3480db[_0x4689('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3480db['params']['id']}})['then'](handleEntityNotFound(_0x3f8a5f,null))[_0x4689('0x25')](saveUpdates(_0x3480db[_0x4689('0x4a')],null))[_0x4689('0x25')](respondWithResult(_0x3f8a5f,null))[_0x4689('0x44')](handleError(_0x3f8a5f,null));};exports[_0x4689('0x24')]=function(_0x2f9ffd,_0x334286){return db[_0x4689('0x2c')][_0x4689('0x48')]({'where':{'id':_0x2f9ffd[_0x4689('0x45')]['id']}})[_0x4689('0x25')](handleEntityNotFound(_0x334286,null))[_0x4689('0x25')](removeEntity(_0x334286,null))['catch'](handleError(_0x334286,null));};exports[_0x4689('0x53')]=function(_0xc60284,_0x13e367,_0x27439c){if(_0xc60284[_0x4689('0x4a')]['id']){delete _0xc60284[_0x4689('0x4a')]['id'];}return db[_0x4689('0x2c')][_0x4689('0x48')]({'where':{'id':_0xc60284['params']['id']}})[_0x4689('0x25')](handleEntityNotFound(_0x13e367,null))['then'](function(_0x1309c9){if(_0x1309c9){_0xc60284[_0x4689('0x4a')][_0x4689('0x54')]=_0x1309c9['id'];return db[_0x4689('0x55')][_0x4689('0x49')](_0xc60284[_0x4689('0x4a')]);}})['then'](respondWithResult(_0x13e367,null))[_0x4689('0x44')](handleError(_0x13e367,null));};exports[_0x4689('0x56')]=function(_0x5bac26,_0x824cdc,_0x110aef){if(_0x5bac26[_0x4689('0x4a')]['id']){delete _0x5bac26['body']['id'];}return db[_0x4689('0x2c')]['find']({'where':{'id':_0x5bac26['params']['id']}})[_0x4689('0x25')](handleEntityNotFound(_0x824cdc,null))[_0x4689('0x25')](function(_0x1e2eed){if(_0x1e2eed){_0x5bac26[_0x4689('0x4a')]['TriggerAnyId']=_0x1e2eed['id'];return db[_0x4689('0x55')]['create'](_0x5bac26[_0x4689('0x4a')]);}})[_0x4689('0x25')](respondWithResult(_0x824cdc,null))['catch'](handleError(_0x824cdc,null));};exports['getAllConditions']=function(_0x3d0d39,_0x4466c4,_0x209434){var _0x580d59={};var _0x19e73c={};var _0x4a2e4e;var _0x5ce222;return db[_0x4689('0x2c')][_0x4689('0x57')]({'where':{'id':_0x3d0d39['params']['id']}})[_0x4689('0x25')](handleEntityNotFound(_0x4466c4,null))[_0x4689('0x25')](function(_0x34b6cf){if(_0x34b6cf){_0x4a2e4e=_0x34b6cf;_0x19e73c[_0x4689('0x31')]=_[_0x4689('0x33')](db[_0x4689('0x55')]['rawAttributes']);_0x19e73c['query']=_[_0x4689('0x33')](_0x3d0d39[_0x4689('0x32')]);_0x19e73c['filters']=_[_0x4689('0x35')](_0x19e73c['model'],_0x19e73c['query']);_0x580d59[_0x4689('0x36')]=_[_0x4689('0x35')](_0x19e73c[_0x4689('0x31')],qs[_0x4689('0x37')](_0x3d0d39[_0x4689('0x32')][_0x4689('0x37')]));_0x580d59[_0x4689('0x36')]=_0x580d59[_0x4689('0x36')][_0x4689('0x38')]?_0x580d59[_0x4689('0x36')]:_0x19e73c[_0x4689('0x31')];_0x580d59[_0x4689('0x3a')]=qs[_0x4689('0x3b')](_0x3d0d39[_0x4689('0x32')]['sort']);_0x580d59['where']=qs[_0x4689('0x34')](_[_0x4689('0x3d')](_0x3d0d39[_0x4689('0x32')],_0x19e73c['filters']));if(_0x3d0d39[_0x4689('0x32')][_0x4689('0x3f')]){_0x580d59['where']=_[_0x4689('0x40')](_0x580d59[_0x4689('0x3c')],{'$or':_['map'](_0x580d59[_0x4689('0x36')],function(_0x1e49a5){var _0x4d7294={};_0x4d7294[_0x1e49a5]={'$like':'%'+_0x3d0d39[_0x4689('0x32')]['filter']+'%'};return _0x4d7294;})});}_0x580d59=_[_0x4689('0x40')]({},_0x580d59,_0x3d0d39[_0x4689('0x41')]);return _0x4a2e4e[_0x4689('0x58')](_0x580d59);}})[_0x4689('0x25')](function(_0x4d7c5b){if(_0x4d7c5b){_0x5ce222=_0x4d7c5b[_0x4689('0x38')];if(!_0x3d0d39[_0x4689('0x32')][_0x4689('0x59')](_0x4689('0x39'))){_0x580d59[_0x4689('0x1d')]=qs[_0x4689('0x1d')](_0x3d0d39['query'][_0x4689('0x1d')]);_0x580d59[_0x4689('0x1b')]=qs[_0x4689('0x1b')](_0x3d0d39[_0x4689('0x32')][_0x4689('0x1b')]);}return _0x4a2e4e[_0x4689('0x58')](_0x580d59);}})[_0x4689('0x25')](function(_0x2f07b3){if(_0x2f07b3){return _0x2f07b3?{'count':_0x5ce222,'rows':_0x2f07b3}:null;}})[_0x4689('0x25')](respondWithResult(_0x4466c4,null))['catch'](handleError(_0x4466c4,null));};exports['getAnyConditions']=function(_0x5decc9,_0x3c4396,_0x27e84c){var _0x297195={};var _0x515ac1={};var _0x4fa4dc;var _0x4968bd;return db[_0x4689('0x2c')][_0x4689('0x57')]({'where':{'id':_0x5decc9[_0x4689('0x45')]['id']}})[_0x4689('0x25')](handleEntityNotFound(_0x3c4396,null))[_0x4689('0x25')](function(_0x34a3ca){if(_0x34a3ca){_0x4fa4dc=_0x34a3ca;_0x515ac1[_0x4689('0x31')]=_['keys'](db[_0x4689('0x55')]['rawAttributes']);_0x515ac1['query']=_['keys'](_0x5decc9[_0x4689('0x32')]);_0x515ac1[_0x4689('0x34')]=_[_0x4689('0x35')](_0x515ac1[_0x4689('0x31')],_0x515ac1['query']);_0x297195[_0x4689('0x36')]=_[_0x4689('0x35')](_0x515ac1['model'],qs[_0x4689('0x37')](_0x5decc9[_0x4689('0x32')][_0x4689('0x37')]));_0x297195['attributes']=_0x297195[_0x4689('0x36')]['length']?_0x297195[_0x4689('0x36')]:_0x515ac1[_0x4689('0x31')];_0x297195[_0x4689('0x3a')]=qs['sort'](_0x5decc9['query']['sort']);_0x297195[_0x4689('0x3c')]=qs[_0x4689('0x34')](_[_0x4689('0x3d')](_0x5decc9['query'],_0x515ac1['filters']));if(_0x5decc9[_0x4689('0x32')][_0x4689('0x3f')]){_0x297195[_0x4689('0x3c')]=_['merge'](_0x297195[_0x4689('0x3c')],{'$or':_[_0x4689('0x2b')](_0x297195[_0x4689('0x36')],function(_0x31f087){var _0x4e2ff1={};_0x4e2ff1[_0x31f087]={'$like':'%'+_0x5decc9[_0x4689('0x32')][_0x4689('0x3f')]+'%'};return _0x4e2ff1;})});}_0x297195=_[_0x4689('0x40')]({},_0x297195,_0x5decc9[_0x4689('0x41')]);return _0x4fa4dc[_0x4689('0x5a')](_0x297195);}})[_0x4689('0x25')](function(_0x3b3693){if(_0x3b3693){_0x4968bd=_0x3b3693[_0x4689('0x38')];if(!_0x5decc9[_0x4689('0x32')]['hasOwnProperty'](_0x4689('0x39'))){_0x297195['limit']=qs[_0x4689('0x1d')](_0x5decc9[_0x4689('0x32')][_0x4689('0x1d')]);_0x297195[_0x4689('0x1b')]=qs[_0x4689('0x1b')](_0x5decc9[_0x4689('0x32')][_0x4689('0x1b')]);}return _0x4fa4dc['getAnyConditions'](_0x297195);}})['then'](function(_0x1338be){if(_0x1338be){return _0x1338be?{'count':_0x4968bd,'rows':_0x1338be}:null;}})['then'](respondWithResult(_0x3c4396,null))[_0x4689('0x44')](handleError(_0x3c4396,null));};exports[_0x4689('0x5b')]=function(_0xebae01,_0x1c3b7d,_0x2bfe78){if(_0xebae01[_0x4689('0x4a')]['id']){delete _0xebae01[_0x4689('0x4a')]['id'];}return db[_0x4689('0x2c')][_0x4689('0x48')]({'where':{'id':_0xebae01[_0x4689('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c3b7d,null))[_0x4689('0x25')](function(_0x14e42c){if(_0x14e42c){_0xebae01[_0x4689('0x4a')][_0x4689('0x5c')]=_0x14e42c['id'];return db[_0x4689('0x5d')][_0x4689('0x49')](_0xebae01[_0x4689('0x4a')]);}})[_0x4689('0x25')](respondWithResult(_0x1c3b7d,null))[_0x4689('0x44')](handleError(_0x1c3b7d,null));};exports['getActions']=function(_0x114bd5,_0x389e07,_0x580b77){var _0x1cb354={};var _0xc4a617={};var _0x47f6e1;var _0x1cf3f3;return db[_0x4689('0x2c')]['findOne']({'where':{'id':_0x114bd5[_0x4689('0x45')]['id']}})[_0x4689('0x25')](handleEntityNotFound(_0x389e07,null))[_0x4689('0x25')](function(_0x3b4d3d){if(_0x3b4d3d){_0x47f6e1=_0x3b4d3d;_0xc4a617[_0x4689('0x31')]=_[_0x4689('0x33')](db['Action'][_0x4689('0x2d')]);_0xc4a617[_0x4689('0x32')]=_[_0x4689('0x33')](_0x114bd5[_0x4689('0x32')]);_0xc4a617[_0x4689('0x34')]=_['intersection'](_0xc4a617[_0x4689('0x31')],_0xc4a617[_0x4689('0x32')]);_0x1cb354[_0x4689('0x36')]=_[_0x4689('0x35')](_0xc4a617[_0x4689('0x31')],qs[_0x4689('0x37')](_0x114bd5[_0x4689('0x32')][_0x4689('0x37')]));_0x1cb354[_0x4689('0x36')]=_0x1cb354['attributes'][_0x4689('0x38')]?_0x1cb354[_0x4689('0x36')]:_0xc4a617[_0x4689('0x31')];_0x1cb354[_0x4689('0x3a')]=qs['sort'](_0x114bd5[_0x4689('0x32')][_0x4689('0x3b')]);_0x1cb354[_0x4689('0x3c')]=qs[_0x4689('0x34')](_[_0x4689('0x3d')](_0x114bd5[_0x4689('0x32')],_0xc4a617[_0x4689('0x34')]));if(_0x114bd5[_0x4689('0x32')]['filter']){_0x1cb354[_0x4689('0x3c')]=_[_0x4689('0x40')](_0x1cb354[_0x4689('0x3c')],{'$or':_[_0x4689('0x2b')](_0x1cb354[_0x4689('0x36')],function(_0x59da27){var _0x4eae31={};_0x4eae31[_0x59da27]={'$like':'%'+_0x114bd5[_0x4689('0x32')][_0x4689('0x3f')]+'%'};return _0x4eae31;})});}_0x1cb354=_[_0x4689('0x40')]({},_0x1cb354,_0x114bd5['options']);return _0x47f6e1['getActions'](_0x1cb354);}})[_0x4689('0x25')](function(_0x449a1c){if(_0x449a1c){_0x1cf3f3=_0x449a1c[_0x4689('0x38')];if(!_0x114bd5[_0x4689('0x32')][_0x4689('0x59')]('nolimit')){_0x1cb354[_0x4689('0x1d')]=qs[_0x4689('0x1d')](_0x114bd5[_0x4689('0x32')][_0x4689('0x1d')]);_0x1cb354['offset']=qs[_0x4689('0x1b')](_0x114bd5[_0x4689('0x32')]['offset']);}return _0x47f6e1['getActions'](_0x1cb354);}})['then'](function(_0x453930){if(_0x453930){return _0x453930?{'count':_0x1cf3f3,'rows':_0x453930}:null;}})[_0x4689('0x25')](respondWithResult(_0x389e07,null))['catch'](handleError(_0x389e07,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index bf06f60..2d8ae6b 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 _0xaa7c=['../../config/environment','./trigger.attributes','exports','define','lodash','bluebird','request-promise','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x1a241e,_0x2660ec){_0x1a241e=_0x1a241e-0x0;var _0x103ed5=_0xaa7c[_0x1a241e];return _0x103ed5;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaa7('0x1'));var rp=require(_0xcaa7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa7('0x3'));var config=require(_0xcaa7('0x4'));var attributes=require(_0xcaa7('0x5'));module[_0xcaa7('0x6')]=function(_0x27e610,_0x5a3674){return _0x27e610[_0xcaa7('0x7')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aaf=['./trigger.attributes','exports','Trigger','lodash','../../config/logger','api','request-promise','rimraf'];(function(_0x7bde7d,_0x1efa55){var _0x1e398c=function(_0x29eba4){while(--_0x29eba4){_0x7bde7d['push'](_0x7bde7d['shift']());}};_0x1e398c(++_0x1efa55);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x1e61ce,_0x352622){_0x1e61ce=_0x1e61ce-0x0;var _0x2e0952=_0x7aaf[_0x1e61ce];return _0x2e0952;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var logger=require(_0xf7aa('0x1'))(_0xf7aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7aa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7aa('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7aa('0x5'));module[_0xf7aa('0x6')]=function(_0x1babcd,_0xf02ed5){return _0x1babcd['define'](_0xf7aa('0x7'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 7e28016..060e269 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 _0x7e34=['client','http','then','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','debug','ShowTrigger','find','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x40e94f,_0x2d9aaf){var _0x547908=function(_0x235502){while(--_0x235502){_0x40e94f['push'](_0x40e94f['shift']());}};_0x547908(++_0x2d9aaf);}(_0x7e34,0x1bd));var _0x47e3=function(_0x4176c4,_0x225b0a){_0x4176c4=_0x4176c4-0x0;var _0x1680b2=_0x7e34[_0x4176c4];return _0x1680b2;};'use strict';var _=require(_0x47e3('0x0'));var util=require(_0x47e3('0x1'));var moment=require('moment');var BPromise=require(_0x47e3('0x2'));var rs=require(_0x47e3('0x3'));var fs=require('fs');var Redis=require(_0x47e3('0x4'));var db=require(_0x47e3('0x5'))['db'];var utils=require(_0x47e3('0x6'));var logger=require('../../config/logger')(_0x47e3('0x7'));var config=require(_0x47e3('0x8'));var jayson=require(_0x47e3('0x9'));var client=jayson[_0x47e3('0xa')][_0x47e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10d56a,_0x2cafdc,_0x3dfba4){return new BPromise(function(_0x1b1237,_0x232c57){return client['request'](_0x10d56a,_0x3dfba4)[_0x47e3('0xc')](function(_0x38a4e8){logger[_0x47e3('0xd')]('Trigger,\x20%s,\x20%s',_0x2cafdc,_0x47e3('0xe'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x2cafdc,_0x47e3('0xe'),JSON[_0x47e3('0xf')](_0x38a4e8));if(_0x38a4e8[_0x47e3('0x10')]){if(_0x38a4e8['error'][_0x47e3('0x11')]===0x1f4){logger['error'](_0x47e3('0x12'),_0x2cafdc,_0x38a4e8['error'][_0x47e3('0x13')]);return _0x232c57(_0x38a4e8['error'][_0x47e3('0x13')]);}logger[_0x47e3('0x10')](_0x47e3('0x12'),_0x2cafdc,_0x38a4e8['error']['message']);return _0x1b1237(_0x38a4e8[_0x47e3('0x10')][_0x47e3('0x13')]);}else{logger[_0x47e3('0xd')]('Trigger,\x20%s,\x20%s',_0x2cafdc,_0x47e3('0xe'));_0x1b1237(_0x38a4e8['result'][_0x47e3('0x13')]);}})[_0x47e3('0x14')](function(_0x57e73b){logger[_0x47e3('0x10')](_0x47e3('0x12'),_0x2cafdc,_0x57e73b);_0x232c57(_0x57e73b);});});}exports[_0x47e3('0x15')]=function(_0x3414d1){var _0x3d769b=this;return new Promise(function(_0x49d56c,_0x146f74){return db[_0x47e3('0x16')][_0x47e3('0x17')]({'raw':_0x3414d1[_0x47e3('0x18')]?_0x3414d1['options'][_0x47e3('0x19')]===undefined?!![]:![]:!![],'where':_0x3414d1[_0x47e3('0x18')]?_0x3414d1[_0x47e3('0x18')][_0x47e3('0x1a')]||null:null,'attributes':_0x3414d1[_0x47e3('0x18')]?_0x3414d1[_0x47e3('0x18')][_0x47e3('0x1b')]||null:null,'limit':_0x3414d1[_0x47e3('0x18')]?_0x3414d1[_0x47e3('0x18')][_0x47e3('0x1c')]||null:null,'include':_0x3414d1[_0x47e3('0x18')]?_0x3414d1[_0x47e3('0x18')][_0x47e3('0x1d')]?_[_0x47e3('0x1e')](_0x3414d1[_0x47e3('0x18')]['include'],function(_0x5d89d3){return{'model':db[_0x5d89d3['model']],'as':_0x5d89d3['as'],'attributes':_0x5d89d3['attributes'],'include':_0x5d89d3[_0x47e3('0x1d')]?_[_0x47e3('0x1e')](_0x5d89d3['include'],function(_0x2043d2){return{'model':db[_0x2043d2['model']],'as':_0x2043d2['as'],'attributes':_0x2043d2[_0x47e3('0x1b')],'include':_0x2043d2[_0x47e3('0x1d')]?_[_0x47e3('0x1e')](_0x2043d2[_0x47e3('0x1d')],function(_0x4862a5){return{'model':db[_0x4862a5['model']],'as':_0x4862a5['as'],'attributes':_0x4862a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x47e3('0xc')](function(_0x2d670e){logger[_0x47e3('0xd')](_0x47e3('0x15'),_0x3414d1);logger[_0x47e3('0x1f')](_0x47e3('0x15'),_0x3414d1,JSON[_0x47e3('0xf')](_0x2d670e));_0x49d56c(_0x2d670e);})[_0x47e3('0x14')](function(_0x12449b){logger[_0x47e3('0x10')](_0x47e3('0x15'),_0x12449b[_0x47e3('0x13')],_0x3414d1);_0x146f74(_0x3d769b[_0x47e3('0x10')](0x1f4,_0x12449b[_0x47e3('0x13')]));});});};exports[_0x47e3('0x20')]=function(_0x47dfb3){var _0x13082a=this;return new Promise(function(_0x3012bb,_0x581f43){return db[_0x47e3('0x16')][_0x47e3('0x21')]({'raw':_0x47dfb3[_0x47e3('0x18')]?_0x47dfb3[_0x47e3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x47dfb3[_0x47e3('0x18')]?_0x47dfb3[_0x47e3('0x18')]['where']||null:null,'attributes':_0x47dfb3[_0x47e3('0x18')]?_0x47dfb3['options'][_0x47e3('0x1b')]||null:null,'include':_0x47dfb3['options']?_0x47dfb3[_0x47e3('0x18')][_0x47e3('0x1d')]?_[_0x47e3('0x1e')](_0x47dfb3[_0x47e3('0x18')][_0x47e3('0x1d')],function(_0x3ce94a){return{'model':db[_0x3ce94a[_0x47e3('0x22')]],'as':_0x3ce94a['as'],'attributes':_0x3ce94a['attributes'],'include':_0x3ce94a[_0x47e3('0x1d')]?_['map'](_0x3ce94a[_0x47e3('0x1d')],function(_0x414d56){return{'model':db[_0x414d56[_0x47e3('0x22')]],'as':_0x414d56['as'],'attributes':_0x414d56[_0x47e3('0x1b')],'include':_0x414d56[_0x47e3('0x1d')]?_[_0x47e3('0x1e')](_0x414d56['include'],function(_0x247571){return{'model':db[_0x247571[_0x47e3('0x22')]],'as':_0x247571['as'],'attributes':_0x247571[_0x47e3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x47e3('0xc')](function(_0x5c3c26){logger['info'](_0x47e3('0x20'),_0x47dfb3);logger[_0x47e3('0x1f')](_0x47e3('0x20'),_0x47dfb3,JSON[_0x47e3('0xf')](_0x5c3c26));_0x3012bb(_0x5c3c26);})[_0x47e3('0x14')](function(_0x32fc58){logger[_0x47e3('0x10')](_0x47e3('0x20'),_0x32fc58[_0x47e3('0x13')],_0x47dfb3);_0x581f43(_0x13082a[_0x47e3('0x10')](0x1f4,_0x32fc58[_0x47e3('0x13')]));});});}; \ No newline at end of file +var _0x4d3f=['../../config/logger','rpc','jayson/promise','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','attributes','limit','include','map','model','find','ShowTrigger','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3e6478,_0x58d025){var _0x3f821a=function(_0x3daeae){while(--_0x3daeae){_0x3e6478['push'](_0x3e6478['shift']());}};_0x3f821a(++_0x58d025);}(_0x4d3f,0x17b));var _0xf4d3=function(_0x187644,_0x115c74){_0x187644=_0x187644-0x0;var _0x110f61=_0x4d3f[_0x187644];return _0x110f61;};'use strict';var _=require('lodash');var util=require(_0xf4d3('0x0'));var moment=require(_0xf4d3('0x1'));var BPromise=require(_0xf4d3('0x2'));var rs=require(_0xf4d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4d3('0x4'))['db'];var utils=require(_0xf4d3('0x5'));var logger=require(_0xf4d3('0x6'))(_0xf4d3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf4d3('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a26ee,_0x34b6d4,_0x4f1ff0){return new BPromise(function(_0x30d36e,_0x3eff37){return client[_0xf4d3('0x9')](_0x1a26ee,_0x4f1ff0)[_0xf4d3('0xa')](function(_0x1b8917){logger[_0xf4d3('0xb')]('Trigger,\x20%s,\x20%s',_0x34b6d4,_0xf4d3('0xc'));logger[_0xf4d3('0xd')](_0xf4d3('0xe'),_0x34b6d4,_0xf4d3('0xc'),JSON[_0xf4d3('0xf')](_0x1b8917));if(_0x1b8917[_0xf4d3('0x10')]){if(_0x1b8917[_0xf4d3('0x10')][_0xf4d3('0x11')]===0x1f4){logger['error'](_0xf4d3('0x12'),_0x34b6d4,_0x1b8917[_0xf4d3('0x10')][_0xf4d3('0x13')]);return _0x3eff37(_0x1b8917[_0xf4d3('0x10')][_0xf4d3('0x13')]);}logger[_0xf4d3('0x10')](_0xf4d3('0x12'),_0x34b6d4,_0x1b8917[_0xf4d3('0x10')]['message']);return _0x30d36e(_0x1b8917[_0xf4d3('0x10')][_0xf4d3('0x13')]);}else{logger['info'](_0xf4d3('0x12'),_0x34b6d4,_0xf4d3('0xc'));_0x30d36e(_0x1b8917[_0xf4d3('0x14')][_0xf4d3('0x13')]);}})[_0xf4d3('0x15')](function(_0x5ec61f){logger['error'](_0xf4d3('0x12'),_0x34b6d4,_0x5ec61f);_0x3eff37(_0x5ec61f);});});}exports[_0xf4d3('0x16')]=function(_0xafbfbc){var _0x3b37d0=this;return new Promise(function(_0x51d582,_0x3860b1){return db[_0xf4d3('0x17')][_0xf4d3('0x18')]({'raw':_0xafbfbc[_0xf4d3('0x19')]?_0xafbfbc[_0xf4d3('0x19')][_0xf4d3('0x1a')]===undefined?!![]:![]:!![],'where':_0xafbfbc[_0xf4d3('0x19')]?_0xafbfbc[_0xf4d3('0x19')][_0xf4d3('0x1b')]||null:null,'attributes':_0xafbfbc[_0xf4d3('0x19')]?_0xafbfbc[_0xf4d3('0x19')][_0xf4d3('0x1c')]||null:null,'limit':_0xafbfbc[_0xf4d3('0x19')]?_0xafbfbc[_0xf4d3('0x19')][_0xf4d3('0x1d')]||null:null,'include':_0xafbfbc[_0xf4d3('0x19')]?_0xafbfbc[_0xf4d3('0x19')][_0xf4d3('0x1e')]?_[_0xf4d3('0x1f')](_0xafbfbc[_0xf4d3('0x19')][_0xf4d3('0x1e')],function(_0x122a3a){return{'model':db[_0x122a3a[_0xf4d3('0x20')]],'as':_0x122a3a['as'],'attributes':_0x122a3a[_0xf4d3('0x1c')],'include':_0x122a3a[_0xf4d3('0x1e')]?_[_0xf4d3('0x1f')](_0x122a3a[_0xf4d3('0x1e')],function(_0x192a44){return{'model':db[_0x192a44[_0xf4d3('0x20')]],'as':_0x192a44['as'],'attributes':_0x192a44[_0xf4d3('0x1c')],'include':_0x192a44['include']?_[_0xf4d3('0x1f')](_0x192a44[_0xf4d3('0x1e')],function(_0x2210e1){return{'model':db[_0x2210e1['model']],'as':_0x2210e1['as'],'attributes':_0x2210e1[_0xf4d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4d3('0xa')](function(_0x1b1fa8){logger[_0xf4d3('0xb')](_0xf4d3('0x16'),_0xafbfbc);logger[_0xf4d3('0xd')](_0xf4d3('0x16'),_0xafbfbc,JSON[_0xf4d3('0xf')](_0x1b1fa8));_0x51d582(_0x1b1fa8);})[_0xf4d3('0x15')](function(_0x425fa9){logger[_0xf4d3('0x10')]('GetTrigger',_0x425fa9['message'],_0xafbfbc);_0x3860b1(_0x3b37d0[_0xf4d3('0x10')](0x1f4,_0x425fa9[_0xf4d3('0x13')]));});});};exports['ShowTrigger']=function(_0x44fd01){var _0x521fe=this;return new Promise(function(_0xa3a144,_0x200581){return db[_0xf4d3('0x17')][_0xf4d3('0x21')]({'raw':_0x44fd01[_0xf4d3('0x19')]?_0x44fd01[_0xf4d3('0x19')][_0xf4d3('0x1a')]===undefined?!![]:![]:!![],'where':_0x44fd01[_0xf4d3('0x19')]?_0x44fd01[_0xf4d3('0x19')][_0xf4d3('0x1b')]||null:null,'attributes':_0x44fd01[_0xf4d3('0x19')]?_0x44fd01[_0xf4d3('0x19')][_0xf4d3('0x1c')]||null:null,'include':_0x44fd01[_0xf4d3('0x19')]?_0x44fd01[_0xf4d3('0x19')][_0xf4d3('0x1e')]?_[_0xf4d3('0x1f')](_0x44fd01['options'][_0xf4d3('0x1e')],function(_0x389855){return{'model':db[_0x389855[_0xf4d3('0x20')]],'as':_0x389855['as'],'attributes':_0x389855[_0xf4d3('0x1c')],'include':_0x389855[_0xf4d3('0x1e')]?_[_0xf4d3('0x1f')](_0x389855['include'],function(_0x2ed736){return{'model':db[_0x2ed736[_0xf4d3('0x20')]],'as':_0x2ed736['as'],'attributes':_0x2ed736[_0xf4d3('0x1c')],'include':_0x2ed736[_0xf4d3('0x1e')]?_['map'](_0x2ed736[_0xf4d3('0x1e')],function(_0x74abf2){return{'model':db[_0x74abf2[_0xf4d3('0x20')]],'as':_0x74abf2['as'],'attributes':_0x74abf2[_0xf4d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4d3('0xa')](function(_0x394457){logger['info']('ShowTrigger',_0x44fd01);logger[_0xf4d3('0xd')](_0xf4d3('0x22'),_0x44fd01,JSON['stringify'](_0x394457));_0xa3a144(_0x394457);})[_0xf4d3('0x15')](function(_0x5016ba){logger['error'](_0xf4d3('0x22'),_0x5016ba[_0xf4d3('0x13')],_0x44fd01);_0x200581(_0x521fe[_0xf4d3('0x10')](0x1f4,_0x5016ba['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0c31076..3aaf150 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 _0x5a35=['index','/:id','show','/:id/clone','clone','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0xe43b49,_0x2d4f58){var _0x46bd3c=function(_0x160472){while(--_0x160472){_0xe43b49['push'](_0xe43b49['shift']());}};_0x46bd3c(++_0x2d4f58);}(_0x5a35,0x134));var _0x55a3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a35[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x55a3('0x0'));var util=require(_0x55a3('0x1'));var path=require(_0x55a3('0x2'));var timeout=require(_0x55a3('0x3'));var express=require(_0x55a3('0x4'));var router=express[_0x55a3('0x5')]();var fs_extra=require(_0x55a3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x55a3('0x7'));var config=require(_0x55a3('0x8'));var controller=require(_0x55a3('0x9'));router[_0x55a3('0xa')]('/',auth[_0x55a3('0xb')](),controller[_0x55a3('0xc')]);router['get'](_0x55a3('0xd'),auth[_0x55a3('0xb')](),controller[_0x55a3('0xe')]);router['post'](_0x55a3('0xf'),auth[_0x55a3('0xb')](),controller[_0x55a3('0x10')]);router['post']('/',auth[_0x55a3('0xb')](),controller['create']);router[_0x55a3('0x11')]('/:id',auth[_0x55a3('0xb')](),controller[_0x55a3('0x12')]);router['delete'](_0x55a3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x55a3('0x13')]=router; \ No newline at end of file +var _0xb5f0=['isAuthenticated','/:id','show','post','/:id/clone','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x56727c,_0x3a4af4){var _0x1de7ba=function(_0x35a853){while(--_0x35a853){_0x56727c['push'](_0x56727c['shift']());}};_0x1de7ba(++_0x3a4af4);}(_0xb5f0,0x106));var _0x0b5f=function(_0x1fb3a7,_0x41fe14){_0x1fb3a7=_0x1fb3a7-0x0;var _0x117e62=_0xb5f0[_0x1fb3a7];return _0x117e62;};'use strict';var multer=require(_0x0b5f('0x0'));var util=require(_0x0b5f('0x1'));var path=require(_0x0b5f('0x2'));var timeout=require(_0x0b5f('0x3'));var express=require(_0x0b5f('0x4'));var router=express[_0x0b5f('0x5')]();var fs_extra=require(_0x0b5f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0b5f('0x7'));var config=require(_0x0b5f('0x8'));var controller=require(_0x0b5f('0x9'));router[_0x0b5f('0xa')]('/',auth[_0x0b5f('0xb')](),controller['index']);router['get'](_0x0b5f('0xc'),auth['isAuthenticated'](),controller[_0x0b5f('0xd')]);router[_0x0b5f('0xe')](_0x0b5f('0xf'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x0b5f('0xb')](),controller[_0x0b5f('0x10')]);router[_0x0b5f('0x11')](_0x0b5f('0xc'),auth[_0x0b5f('0xb')](),controller[_0x0b5f('0x12')]);router[_0x0b5f('0x13')](_0x0b5f('0xc'),auth[_0x0b5f('0xb')](),controller[_0x0b5f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 13696bc..470d7ba 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 _0x82a2=['actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','peer','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','yes','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','pai','fingerprint','active','passive'];(function(_0x2614ef,_0x5774bc){var _0x36fea9=function(_0x25482c){while(--_0x25482c){_0x2614ef['push'](_0x2614ef['shift']());}};_0x36fea9(++_0x5774bc);}(_0x82a2,0x1a5));var _0x282a=function(_0x55569d,_0x3fb11c){_0x55569d=_0x55569d-0x0;var _0x3f91fa=_0x82a2[_0x55569d];return _0x3f91fa;};'use strict';var Sequelize=require(_0x282a('0x0'));module[_0x282a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x282a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x282a('0x3')]('friend','user',_0x282a('0x4')),'allowNull':![],'defaultValue':_0x282a('0x5')},'context':{'type':Sequelize[_0x282a('0x6')],'allowNull':![],'defaultValue':_0x282a('0x7')},'callingpres':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x8'),_0x282a('0x9'),_0x282a('0xa'),_0x282a('0xb'),_0x282a('0xc'),_0x282a('0xd'),_0x282a('0xe'),_0x282a('0xf'))},'deny':{'type':Sequelize[_0x282a('0x6')]},'permit':{'type':Sequelize[_0x282a('0x6')]},'secret':{'type':Sequelize[_0x282a('0x6')]},'md5secret':{'type':Sequelize[_0x282a('0x6')]},'remotesecret':{'type':Sequelize[_0x282a('0x6')]},'transport':{'type':Sequelize[_0x282a('0x6')],'defaultValue':_0x282a('0x10'),'set':function(_0x296050){this[_0x282a('0x11')](_0x282a('0x12'),_0x296050?_0x296050[_0x282a('0x13')](','):null);},'get':function(){return this['getDataValue'](_0x282a('0x12'))?this[_0x282a('0x14')](_0x282a('0x12'))[_0x282a('0x15')](','):null;},'comment':_0x282a('0x16')},'dtmfmode':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x17'),'info','shortinfo','inband',_0x282a('0x18')),'defaultValue':_0x282a('0x17')},'directmedia':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no','nonat',_0x282a('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x282a('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x282a('0x6')]},'directmediadeny':{'type':Sequelize[_0x282a('0x6')]},'nat':{'type':Sequelize[_0x282a('0x6')],'defaultValue':_0x282a('0x1b'),'set':function(_0x3a524d){this[_0x282a('0x11')](_0x282a('0x1c'),_0x3a524d?_0x3a524d[_0x282a('0x13')](','):null);},'get':function(){return this[_0x282a('0x14')](_0x282a('0x1c'))?this[_0x282a('0x14')](_0x282a('0x1c'))[_0x282a('0x15')](','):null;},'comment':_0x282a('0x1d')},'callgroup':{'type':Sequelize[_0x282a('0x6')]},'namedcallgroup':{'type':Sequelize[_0x282a('0x6')]},'pickupgroup':{'type':Sequelize[_0x282a('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x282a('0x6')]},'language':{'type':Sequelize[_0x282a('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x282a('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x282a('0x6')],'defaultValue':_0x282a('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x282a('0x1f'),'set':function(_0xfeab88){this[_0x282a('0x11')](_0x282a('0x20'),_0xfeab88?_0xfeab88[_0x282a('0x13')](';'):_0x282a('0x1f'));},'get':function(){return this[_0x282a('0x14')]('allow')?this['getDataValue'](_0x282a('0x20'))[_0x282a('0x15')](';'):null;},'comment':_0x282a('0x21')},'autoframing':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x9d2c26){this[_0x282a('0x11')]('insecure',_0x9d2c26?_0x9d2c26['join'](','):null);},'get':function(){return this['getDataValue'](_0x282a('0x22'))?this['getDataValue'](_0x282a('0x22'))[_0x282a('0x15')](','):null;},'comment':_0x282a('0x23')},'trustrpid':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x282a('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x282a('0x3')]('yes','no',_0x282a('0x24'))},'promiscredir':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x282a('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x282a('0x25')](0xb)},'setvar':{'type':Sequelize[_0x282a('0x6')]},'callerid':{'type':Sequelize[_0x282a('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x282a('0x6')]},'callcounter':{'type':Sequelize['ENUM'](_0x282a('0x19'),'no'),'defaultValue':_0x282a('0x19')},'busylevel':{'type':Sequelize[_0x282a('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x282a('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x282a('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x282a('0x6')]},'videosupport':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no',_0x282a('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x282a('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x282a('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x282a('0x6')]},'session_timers':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x27'),_0x282a('0x28'),_0x282a('0x29'))},'session_expires':{'type':Sequelize[_0x282a('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x282a('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x282a('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x282a('0x6')]},'fromuser':{'type':Sequelize[_0x282a('0x6')]},'port':{'type':Sequelize[_0x282a('0x25')](0x5)},'qualify':{'type':Sequelize[_0x282a('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x282a('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x282a('0x6')]},'defaultuser':{'type':Sequelize[_0x282a('0x6')]},'rtptimeout':{'type':Sequelize[_0x282a('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x282a('0x3')]('yes','no',_0x282a('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x282a('0x6')]},'callbackextension':{'type':Sequelize[_0x282a('0x6')]},'timert1':{'type':Sequelize[_0x282a('0x25')](0xb)},'timerb':{'type':Sequelize[_0x282a('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x282a('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x282a('0x6')]},'contactdeny':{'type':Sequelize[_0x282a('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x282a('0x6')]},'maxforwards':{'type':Sequelize[_0x282a('0x25')](0xb)},'encryption':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'force_avp':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'icesupport':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x282a('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x282a('0x3')]('yes','no',_0x282a('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x282a('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x282a('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x282a('0x6')]},'dtlscipher':{'type':Sequelize[_0x282a('0x6')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x2d'),_0x282a('0x2e'),_0x282a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x282a('0x6')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x282a('0x6')]},'recordofffeature':{'type':Sequelize[_0x282a('0x6')]},'call_limit':{'type':Sequelize[_0x282a('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no')},'vmexten':{'type':Sequelize[_0x282a('0x6')]},'mohinterpret':{'type':Sequelize[_0x282a('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x282a('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x282a('0x6')],'defaultValue':_0x282a('0x30')},'canreinvite':{'type':Sequelize[_0x282a('0x3')](_0x282a('0x19'),'no',_0x282a('0x31'),_0x282a('0x1a'),_0x282a('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x282a('0x6')]},'otherFields':{'type':Sequelize[_0x282a('0x6')]},'active':{'type':Sequelize[_0x282a('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xc02f=['uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','BOOLEAN','exports','STRING','friend','peer','ENUM','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','update','force_rport,comedia','setDataValue','nat','all','allow','ulaw;alaw;gsm','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac'];(function(_0xafbd50,_0x2d19a9){var _0x128388=function(_0x41317){while(--_0x41317){_0xafbd50['push'](_0xafbd50['shift']());}};_0x128388(++_0x2d19a9);}(_0xc02f,0x152));var _0xfc02=function(_0x384182,_0x38f9b5){_0x384182=_0x384182-0x0;var _0x588dd7=_0xc02f[_0x384182];return _0x588dd7;};'use strict';var Sequelize=require('sequelize');module[_0xfc02('0x0')]={'name':{'type':Sequelize[_0xfc02('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xfc02('0x2'),'user',_0xfc02('0x3')),'allowNull':![],'defaultValue':_0xfc02('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xfc02('0x4')]('ALLOWED_NOT_SCREENED',_0xfc02('0x5'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xfc02('0x6'),_0xfc02('0x7'),_0xfc02('0x8'),_0xfc02('0x9'))},'deny':{'type':Sequelize[_0xfc02('0x1')]},'permit':{'type':Sequelize[_0xfc02('0x1')]},'secret':{'type':Sequelize[_0xfc02('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xfc02('0x1')]},'transport':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':_0xfc02('0xa'),'set':function(_0x194374){this['setDataValue']('transport',_0x194374?_0x194374[_0xfc02('0xb')](','):null);},'get':function(){return this[_0xfc02('0xc')](_0xfc02('0xd'))?this[_0xfc02('0xc')]('transport')['split'](','):null;},'comment':_0xfc02('0xe')},'dtmfmode':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0xf'),_0xfc02('0x10'),'shortinfo','inband',_0xfc02('0x11')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no','nonat',_0xfc02('0x13'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xfc02('0x1')]},'nat':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':_0xfc02('0x14'),'set':function(_0x20df77){this[_0xfc02('0x15')]('nat',_0x20df77?_0x20df77[_0xfc02('0xb')](','):null);},'get':function(){return this[_0xfc02('0xc')](_0xfc02('0x16'))?this['getDataValue'](_0xfc02('0x16'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xfc02('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xfc02('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xfc02('0x1')]},'language':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfc02('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':_0xfc02('0x17')},'allow':{'type':Sequelize[_0xfc02('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x24b259){this[_0xfc02('0x15')](_0xfc02('0x18'),_0x24b259?_0x24b259[_0xfc02('0xb')](';'):_0xfc02('0x19'));},'get':function(){return this[_0xfc02('0xc')]('allow')?this[_0xfc02('0xc')](_0xfc02('0x18'))[_0xfc02('0x1a')](';'):null;},'comment':_0xfc02('0x1b')},'autoframing':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no')},'insecure':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':_0xfc02('0x1c'),'set':function(_0xd2219f){this['setDataValue'](_0xfc02('0x1d'),_0xd2219f?_0xd2219f['join'](','):null);},'get':function(){return this[_0xfc02('0xc')](_0xfc02('0x1d'))?this[_0xfc02('0xc')](_0xfc02('0x1d'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no',_0xfc02('0x1e'))},'promiscredir':{'type':Sequelize[_0xfc02('0x4')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no')},'accountcode':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'setvar':{'type':Sequelize[_0xfc02('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xfc02('0x20')},'amaflags':{'type':Sequelize[_0xfc02('0x1')]},'callcounter':{'type':Sequelize[_0xfc02('0x4')]('yes','no'),'defaultValue':_0xfc02('0x12')},'busylevel':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no')},'allowsubscribe':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no')},'allowtransfer':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no')},'subscribecontext':{'type':Sequelize[_0xfc02('0x1')]},'template':{'type':Sequelize[_0xfc02('0x1')]},'videosupport':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no',_0xfc02('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no')},'mailbox':{'type':Sequelize[_0xfc02('0x1')]},'session_timers':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x22'),_0xfc02('0x23'),_0xfc02('0x24'))},'session_expires':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'session_refresher':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x25'),'uas'),'defaultValue':_0xfc02('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xfc02('0x1')]},'regexten':{'type':Sequelize[_0xfc02('0x1')]},'fromdomain':{'type':Sequelize[_0xfc02('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfc02('0x1f')](0x5)},'qualify':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xfc02('0x1')]},'rtptimeout':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no',_0xfc02('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfc02('0x1')]},'callbackextension':{'type':Sequelize[_0xfc02('0x1')]},'timert1':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xfc02('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xfc02('0x1')]},'use_q850_reason':{'type':Sequelize[_0xfc02('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xfc02('0x12'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no')},'force_avp':{'type':Sequelize[_0xfc02('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no')},'dtlsenable':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no')},'dtlsverify':{'type':Sequelize[_0xfc02('0x4')](_0xfc02('0x12'),'no',_0xfc02('0x28'),_0xfc02('0x29'))},'dtlsrekey':{'type':Sequelize[_0xfc02('0x1f')](0xb)},'dtlscertfile':{'type':Sequelize[_0xfc02('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xfc02('0x1')]},'dtlscipher':{'type':Sequelize[_0xfc02('0x1')]},'dtlscafile':{'type':Sequelize[_0xfc02('0x1')]},'dtlscapath':{'type':Sequelize[_0xfc02('0x1')]},'dtlssetup':{'type':Sequelize[_0xfc02('0x4')]('active',_0xfc02('0x2a'),_0xfc02('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfc02('0x1')]},'usereqphone':{'type':Sequelize[_0xfc02('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfc02('0x1')]},'recordofffeature':{'type':Sequelize[_0xfc02('0x1')]},'call_limit':{'type':Sequelize[_0xfc02('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xfc02('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xfc02('0x1')]},'mohinterpret':{'type':Sequelize[_0xfc02('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xfc02('0x1')]},'description':{'type':Sequelize[_0xfc02('0x1')]},'host':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':_0xfc02('0x2c')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xfc02('0x2d'),_0xfc02('0x13'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfc02('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xfc02('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 508f13a..a66be46 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x272a93,_0x4fb0fd){var _0x47cfa1=function(_0x1e7f7a){while(--_0x1e7f7a){_0x272a93['push'](_0x272a93['shift']());}};_0x47cfa1(++_0x4fb0fd);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3238e9,_0x3e6fde){_0x3238e9=_0x3238e9-0x0;var _0x59f0fc=_0x8ef6[_0x3238e9];return _0x59f0fc;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x81bd,0x7c));var _0xd81b=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0x81bd[_0x31cc0e];return _0x144862;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4a96fcb..b09494c 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 _0x3dff=['api','moment','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x3dff,0x1d7));var _0xf3df=function(_0x5b57fb,_0x4a4957){_0x5b57fb=_0x5b57fb-0x0;var _0x1bce4a=_0x3dff[_0x5b57fb];return _0x1bce4a;};'use strict';var _=require(_0xf3df('0x0'));var util=require(_0xf3df('0x1'));var logger=require('../../config/logger')(_0xf3df('0x2'));var moment=require(_0xf3df('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3df('0x4'));var config=require(_0xf3df('0x5'));var attributes=require(_0xf3df('0x6'));module[_0xf3df('0x7')]=function(_0x322ef1,_0x5dfe3c){return _0x322ef1[_0xf3df('0x8')](_0xf3df('0x9'),attributes,{'tableName':_0xf3df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa762=['bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','define','tools_trunks','util','../../config/logger','api','moment'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa762,0xf8));var _0x2a76=function(_0x3c969f,_0x23b669){_0x3c969f=_0x3c969f-0x0;var _0x5b3d19=_0xa762[_0x3c969f];return _0x5b3d19;};'use strict';var _=require('lodash');var util=require(_0x2a76('0x0'));var logger=require(_0x2a76('0x1'))(_0x2a76('0x2'));var moment=require(_0x2a76('0x3'));var BPromise=require(_0x2a76('0x4'));var rp=require(_0x2a76('0x5'));var fs=require('fs');var path=require(_0x2a76('0x6'));var rimraf=require('rimraf');var config=require(_0x2a76('0x7'));var attributes=require(_0x2a76('0x8'));module[_0x2a76('0x9')]=function(_0x1694d0,_0x58a1d6){return _0x1694d0[_0x2a76('0xa')]('Trunk',attributes,{'tableName':_0x2a76('0xb'),'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 cf44673..e6ed874 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 _0xdc0f=['include','map','model','ShowTrunk','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit'];(function(_0x41f4ed,_0x1f646d){var _0x25c457=function(_0x2a9012){while(--_0x2a9012){_0x41f4ed['push'](_0x41f4ed['shift']());}};_0x25c457(++_0x1f646d);}(_0xdc0f,0x116));var _0xfdc0=function(_0x4b9e48,_0x3e80f9){_0x4b9e48=_0x4b9e48-0x0;var _0x26fdc4=_0xdc0f[_0x4b9e48];return _0x26fdc4;};'use strict';var _=require(_0xfdc0('0x0'));var util=require(_0xfdc0('0x1'));var moment=require(_0xfdc0('0x2'));var BPromise=require(_0xfdc0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdc0('0x4'));var db=require(_0xfdc0('0x5'))['db'];var utils=require(_0xfdc0('0x6'));var logger=require(_0xfdc0('0x7'))(_0xfdc0('0x8'));var config=require(_0xfdc0('0x9'));var jayson=require(_0xfdc0('0xa'));var client=jayson['client'][_0xfdc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b6f4,_0x12e913,_0xa1642f){return new BPromise(function(_0x2c6988,_0x226e95){return client['request'](_0x52b6f4,_0xa1642f)['then'](function(_0x1f252c){logger[_0xfdc0('0xc')](_0xfdc0('0xd'),_0x12e913,_0xfdc0('0xe'));logger[_0xfdc0('0xf')](_0xfdc0('0x10'),_0x12e913,_0xfdc0('0xe'),JSON['stringify'](_0x1f252c));if(_0x1f252c[_0xfdc0('0x11')]){if(_0x1f252c[_0xfdc0('0x11')][_0xfdc0('0x12')]===0x1f4){logger['error'](_0xfdc0('0xd'),_0x12e913,_0x1f252c[_0xfdc0('0x11')][_0xfdc0('0x13')]);return _0x226e95(_0x1f252c[_0xfdc0('0x11')]['message']);}logger[_0xfdc0('0x11')]('Trunk,\x20%s,\x20%s',_0x12e913,_0x1f252c[_0xfdc0('0x11')][_0xfdc0('0x13')]);return _0x2c6988(_0x1f252c[_0xfdc0('0x11')][_0xfdc0('0x13')]);}else{logger[_0xfdc0('0xc')](_0xfdc0('0xd'),_0x12e913,_0xfdc0('0xe'));_0x2c6988(_0x1f252c['result'][_0xfdc0('0x13')]);}})[_0xfdc0('0x14')](function(_0xadcde7){logger[_0xfdc0('0x11')](_0xfdc0('0xd'),_0x12e913,_0xadcde7);_0x226e95(_0xadcde7);});});}exports[_0xfdc0('0x15')]=function(_0x5aca92){var _0x29680a=this;return new Promise(function(_0x3ca6ae,_0x26f81b){return db[_0xfdc0('0x16')][_0xfdc0('0x17')]({'raw':_0x5aca92['options']?_0x5aca92[_0xfdc0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5aca92[_0xfdc0('0x18')]?_0x5aca92[_0xfdc0('0x18')][_0xfdc0('0x19')]||null:null,'attributes':_0x5aca92[_0xfdc0('0x18')]?_0x5aca92[_0xfdc0('0x18')][_0xfdc0('0x1a')]||null:null,'limit':_0x5aca92[_0xfdc0('0x18')]?_0x5aca92[_0xfdc0('0x18')][_0xfdc0('0x1b')]||null:null,'include':_0x5aca92[_0xfdc0('0x18')]?_0x5aca92['options'][_0xfdc0('0x1c')]?_[_0xfdc0('0x1d')](_0x5aca92['options'][_0xfdc0('0x1c')],function(_0x3921a7){return{'model':db[_0x3921a7[_0xfdc0('0x1e')]],'as':_0x3921a7['as'],'attributes':_0x3921a7['attributes'],'include':_0x3921a7[_0xfdc0('0x1c')]?_[_0xfdc0('0x1d')](_0x3921a7[_0xfdc0('0x1c')],function(_0x57e0bb){return{'model':db[_0x57e0bb['model']],'as':_0x57e0bb['as'],'attributes':_0x57e0bb[_0xfdc0('0x1a')],'include':_0x57e0bb[_0xfdc0('0x1c')]?_['map'](_0x57e0bb[_0xfdc0('0x1c')],function(_0x856369){return{'model':db[_0x856369[_0xfdc0('0x1e')]],'as':_0x856369['as'],'attributes':_0x856369['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3df310){logger['info']('GetTrunk',_0x5aca92);logger[_0xfdc0('0xf')](_0xfdc0('0x15'),_0x5aca92,JSON['stringify'](_0x3df310));_0x3ca6ae(_0x3df310);})[_0xfdc0('0x14')](function(_0x1f4305){logger[_0xfdc0('0x11')](_0xfdc0('0x15'),_0x1f4305[_0xfdc0('0x13')],_0x5aca92);_0x26f81b(_0x29680a[_0xfdc0('0x11')](0x1f4,_0x1f4305[_0xfdc0('0x13')]));});});};exports[_0xfdc0('0x1f')]=function(_0x188185){var _0x17a7b8=this;return new Promise(function(_0x5299fa,_0x2b8a45){return db[_0xfdc0('0x16')]['find']({'raw':_0x188185['options']?_0x188185['options'][_0xfdc0('0x20')]===undefined?!![]:![]:!![],'where':_0x188185[_0xfdc0('0x18')]?_0x188185[_0xfdc0('0x18')]['where']||null:null,'attributes':_0x188185['options']?_0x188185['options'][_0xfdc0('0x1a')]||null:null,'include':_0x188185[_0xfdc0('0x18')]?_0x188185[_0xfdc0('0x18')]['include']?_[_0xfdc0('0x1d')](_0x188185['options'][_0xfdc0('0x1c')],function(_0x543f68){return{'model':db[_0x543f68[_0xfdc0('0x1e')]],'as':_0x543f68['as'],'attributes':_0x543f68['attributes'],'include':_0x543f68[_0xfdc0('0x1c')]?_[_0xfdc0('0x1d')](_0x543f68['include'],function(_0x51e6d6){return{'model':db[_0x51e6d6['model']],'as':_0x51e6d6['as'],'attributes':_0x51e6d6['attributes'],'include':_0x51e6d6[_0xfdc0('0x1c')]?_[_0xfdc0('0x1d')](_0x51e6d6[_0xfdc0('0x1c')],function(_0x285151){return{'model':db[_0x285151[_0xfdc0('0x1e')]],'as':_0x285151['as'],'attributes':_0x285151['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdc0('0x21')](function(_0x4b255f){logger[_0xfdc0('0xc')](_0xfdc0('0x1f'),_0x188185);logger[_0xfdc0('0xf')](_0xfdc0('0x1f'),_0x188185,JSON['stringify'](_0x4b255f));_0x5299fa(_0x4b255f);})[_0xfdc0('0x14')](function(_0x5141ca){logger['error']('ShowTrunk',_0x5141ca[_0xfdc0('0x13')],_0x188185);_0x2b8a45(_0x17a7b8[_0xfdc0('0x11')](0x1f4,_0x5141ca[_0xfdc0('0x13')]));});});}; \ No newline at end of file +var _0x06bf=['limit','include','map','model','attributes','ShowTrunk','Trunk','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','findAll','options','raw','where'];(function(_0x45505a,_0x59368a){var _0x36a1f6=function(_0x2f4542){while(--_0x2f4542){_0x45505a['push'](_0x45505a['shift']());}};_0x36a1f6(++_0x59368a);}(_0x06bf,0x105));var _0xf06b=function(_0x49514b,_0x3087ca){_0x49514b=_0x49514b-0x0;var _0x37c809=_0x06bf[_0x49514b];return _0x37c809;};'use strict';var _=require(_0xf06b('0x0'));var util=require(_0xf06b('0x1'));var moment=require(_0xf06b('0x2'));var BPromise=require(_0xf06b('0x3'));var rs=require(_0xf06b('0x4'));var fs=require('fs');var Redis=require(_0xf06b('0x5'));var db=require(_0xf06b('0x6'))['db'];var utils=require(_0xf06b('0x7'));var logger=require('../../config/logger')(_0xf06b('0x8'));var config=require(_0xf06b('0x9'));var jayson=require(_0xf06b('0xa'));var client=jayson['client'][_0xf06b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb69d30,_0x2458d6,_0x7a4950){return new BPromise(function(_0x5196ed,_0x158086){return client[_0xf06b('0xc')](_0xb69d30,_0x7a4950)['then'](function(_0x531593){logger[_0xf06b('0xd')](_0xf06b('0xe'),_0x2458d6,_0xf06b('0xf'));logger[_0xf06b('0x10')](_0xf06b('0x11'),_0x2458d6,_0xf06b('0xf'),JSON[_0xf06b('0x12')](_0x531593));if(_0x531593[_0xf06b('0x13')]){if(_0x531593['error']['code']===0x1f4){logger['error'](_0xf06b('0xe'),_0x2458d6,_0x531593[_0xf06b('0x13')]['message']);return _0x158086(_0x531593['error'][_0xf06b('0x14')]);}logger[_0xf06b('0x13')]('Trunk,\x20%s,\x20%s',_0x2458d6,_0x531593[_0xf06b('0x13')][_0xf06b('0x14')]);return _0x5196ed(_0x531593[_0xf06b('0x13')]['message']);}else{logger[_0xf06b('0xd')](_0xf06b('0xe'),_0x2458d6,_0xf06b('0xf'));_0x5196ed(_0x531593['result'][_0xf06b('0x14')]);}})[_0xf06b('0x15')](function(_0x1559ef){logger[_0xf06b('0x13')](_0xf06b('0xe'),_0x2458d6,_0x1559ef);_0x158086(_0x1559ef);});});}exports[_0xf06b('0x16')]=function(_0x5f5878){var _0x889159=this;return new Promise(function(_0x373870,_0x105e3d){return db['Trunk'][_0xf06b('0x17')]({'raw':_0x5f5878[_0xf06b('0x18')]?_0x5f5878[_0xf06b('0x18')][_0xf06b('0x19')]===undefined?!![]:![]:!![],'where':_0x5f5878[_0xf06b('0x18')]?_0x5f5878[_0xf06b('0x18')][_0xf06b('0x1a')]||null:null,'attributes':_0x5f5878[_0xf06b('0x18')]?_0x5f5878[_0xf06b('0x18')]['attributes']||null:null,'limit':_0x5f5878['options']?_0x5f5878[_0xf06b('0x18')][_0xf06b('0x1b')]||null:null,'include':_0x5f5878['options']?_0x5f5878[_0xf06b('0x18')][_0xf06b('0x1c')]?_[_0xf06b('0x1d')](_0x5f5878[_0xf06b('0x18')][_0xf06b('0x1c')],function(_0x5de9aa){return{'model':db[_0x5de9aa[_0xf06b('0x1e')]],'as':_0x5de9aa['as'],'attributes':_0x5de9aa['attributes'],'include':_0x5de9aa[_0xf06b('0x1c')]?_[_0xf06b('0x1d')](_0x5de9aa['include'],function(_0x8717a6){return{'model':db[_0x8717a6['model']],'as':_0x8717a6['as'],'attributes':_0x8717a6[_0xf06b('0x1f')],'include':_0x8717a6[_0xf06b('0x1c')]?_['map'](_0x8717a6['include'],function(_0xaae58a){return{'model':db[_0xaae58a[_0xf06b('0x1e')]],'as':_0xaae58a['as'],'attributes':_0xaae58a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x54a0b0){logger['info'](_0xf06b('0x16'),_0x5f5878);logger[_0xf06b('0x10')]('GetTrunk',_0x5f5878,JSON[_0xf06b('0x12')](_0x54a0b0));_0x373870(_0x54a0b0);})[_0xf06b('0x15')](function(_0x2c0ade){logger[_0xf06b('0x13')](_0xf06b('0x16'),_0x2c0ade[_0xf06b('0x14')],_0x5f5878);_0x105e3d(_0x889159['error'](0x1f4,_0x2c0ade[_0xf06b('0x14')]));});});};exports[_0xf06b('0x20')]=function(_0x561b5f){var _0x57cae3=this;return new Promise(function(_0x1da835,_0x5725d9){return db[_0xf06b('0x21')][_0xf06b('0x22')]({'raw':_0x561b5f[_0xf06b('0x18')]?_0x561b5f['options']['raw']===undefined?!![]:![]:!![],'where':_0x561b5f[_0xf06b('0x18')]?_0x561b5f[_0xf06b('0x18')][_0xf06b('0x1a')]||null:null,'attributes':_0x561b5f[_0xf06b('0x18')]?_0x561b5f[_0xf06b('0x18')][_0xf06b('0x1f')]||null:null,'include':_0x561b5f['options']?_0x561b5f[_0xf06b('0x18')][_0xf06b('0x1c')]?_[_0xf06b('0x1d')](_0x561b5f[_0xf06b('0x18')][_0xf06b('0x1c')],function(_0x3f3fe3){return{'model':db[_0x3f3fe3[_0xf06b('0x1e')]],'as':_0x3f3fe3['as'],'attributes':_0x3f3fe3['attributes'],'include':_0x3f3fe3[_0xf06b('0x1c')]?_[_0xf06b('0x1d')](_0x3f3fe3[_0xf06b('0x1c')],function(_0x110934){return{'model':db[_0x110934['model']],'as':_0x110934['as'],'attributes':_0x110934[_0xf06b('0x1f')],'include':_0x110934[_0xf06b('0x1c')]?_[_0xf06b('0x1d')](_0x110934[_0xf06b('0x1c')],function(_0x4b621b){return{'model':db[_0x4b621b[_0xf06b('0x1e')]],'as':_0x4b621b['as'],'attributes':_0x4b621b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf06b('0x23')](function(_0x50c181){logger[_0xf06b('0xd')](_0xf06b('0x20'),_0x561b5f);logger['debug'](_0xf06b('0x20'),_0x561b5f,JSON[_0xf06b('0x12')](_0x50c181));_0x1da835(_0x50c181);})[_0xf06b('0x15')](function(_0x4b0411){logger[_0xf06b('0x13')](_0xf06b('0x20'),_0x4b0411[_0xf06b('0x14')],_0x561b5f);_0x5725d9(_0x57cae3[_0xf06b('0x13')](0x1f4,_0x4b0411['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 5bc2ad2..1a213d1 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d89=['../../components/auth/service','put','/:id','isAuthenticated','Router'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x4d89,0x117));var _0x94d8=function(_0x3499b4,_0x203bf){_0x3499b4=_0x3499b4-0x0;var _0x124762=_0x4d89[_0x3499b4];return _0x124762;};'use strict';var express=require('express');var router=express[_0x94d8('0x0')]();var auth=require(_0x94d8('0x1'));var controller=require('./user-setting.controller');router[_0x94d8('0x2')](_0x94d8('0x3'),auth[_0x94d8('0x4')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xacd8=['/:id','update','exports','../../components/auth/service','./user-setting.controller','put'];(function(_0x233e31,_0x4f1e4a){var _0x11c108=function(_0x18a4f4){while(--_0x18a4f4){_0x233e31['push'](_0x233e31['shift']());}};_0x11c108(++_0x4f1e4a);}(_0xacd8,0x1e9));var _0x8acd=function(_0x81a51,_0x1d14dc){_0x81a51=_0x81a51-0x0;var _0x2f002=_0xacd8[_0x81a51];return _0x2f002;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8acd('0x0'));var controller=require(_0x8acd('0x1'));router[_0x8acd('0x2')](_0x8acd('0x3'),auth['isAuthenticated'](),controller[_0x8acd('0x4')]);module[_0x8acd('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index f683e27..7921206 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e43=['info','debug','ENUM','error','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x3c3b01,_0xbaa847){var _0xda6617=function(_0x38649a){while(--_0x38649a){_0x3c3b01['push'](_0x3c3b01['shift']());}};_0xda6617(++_0xbaa847);}(_0x2e43,0xe0));var _0x32e4=function(_0x43c63e,_0x38c0c7){_0x43c63e=_0x43c63e-0x0;var _0x51abc0=_0x2e43[_0x43c63e];return _0x51abc0;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x32e4('0x0'),_0x32e4('0x1')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x32e4('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x32e4('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x32e4('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x32e4('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x32e4('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x32e4('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0x9c11=['warning','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','error'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9c11,0x1d3));var _0x19c1=function(_0x4f1662,_0x2a864b){_0x4f1662=_0x4f1662-0x0;var _0x2e07e4=_0x9c11[_0x4f1662];return _0x2e07e4;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x19c1('0x0'),_0x19c1('0x1'),'info','debug'];module[_0x19c1('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0x19c1('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x19c1('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x19c1('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x19c1('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x19c1('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x19c1('0x7')],'unique':_0x19c1('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 76c1f01..bcf5989 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ebe=['send','user','role','Unauthorized','params','UserSetting','then','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','update','error','stack','name','status'];(function(_0x2d0050,_0x32e1d3){var _0x27e21a=function(_0x472059){while(--_0x472059){_0x2d0050['push'](_0x2d0050['shift']());}};_0x27e21a(++_0x32e1d3);}(_0x5ebe,0x69));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var Redis=require(_0xe5eb('0x0'));var logger=require(_0xe5eb('0x1'))(_0xe5eb('0x2'));var config=require(_0xe5eb('0x3'));var db=require(_0xe5eb('0x4'))['db'];var socket=require(_0xe5eb('0x5'))(new Redis(config['redis']));require('./user-setting.socket')[_0xe5eb('0x6')](socket);config[_0xe5eb('0x7')]=_[_0xe5eb('0x8')](config[_0xe5eb('0x7')],{'host':_0xe5eb('0x9'),'port':0x18eb});function respondWithResult(_0x3ae8d2,_0x1465d8){_0x1465d8=_0x1465d8||0xc8;return function(_0x1acd9d){if(_0x1acd9d){return _0x3ae8d2['status'](_0x1465d8)['json'](_0x1acd9d);}};}function saveUpdates(_0x5447e5){return function(_0x4a085e){if(_0x4a085e){return _0x4a085e[_0xe5eb('0xa')](_0x5447e5)['then'](function(_0x256ed7){return _0x256ed7;});}return null;};}function handleEntityNotFound(_0x3a388b){return function(_0x14395a){if(!_0x14395a){_0x3a388b['sendStatus'](0x194);}return _0x14395a;};}function handleError(_0x58ee1e,_0xd194f8){_0xd194f8=_0xd194f8||0x1f4;return function(_0x474816){logger[_0xe5eb('0xb')](_0x474816[_0xe5eb('0xc')]);if(_0x474816['name']){delete _0x474816[_0xe5eb('0xd')];}_0x58ee1e[_0xe5eb('0xe')](_0xd194f8)[_0xe5eb('0xf')](_0x474816);};}exports['update']=function(_0x4c32d1,_0x28e90c){if(_0x4c32d1[_0xe5eb('0x10')][_0xe5eb('0x11')]!=='admin')throw new Error(_0xe5eb('0x12'));if(isNaN(Number(_0x4c32d1[_0xe5eb('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xe5eb('0x14')]['find']({'where':{'id':_0x4c32d1['params']['id']}})['then'](handleEntityNotFound(_0x28e90c,null))[_0xe5eb('0x15')](saveUpdates(_0x4c32d1[_0xe5eb('0x16')],null))['then'](respondWithResult(_0x28e90c,null))[_0xe5eb('0x17')](handleError(_0x28e90c,null));}; \ No newline at end of file +var _0xedd9=['ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','json','then','error','stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch'];(function(_0x468fa2,_0x157040){var _0x14f849=function(_0x816c0a){while(--_0x816c0a){_0x468fa2['push'](_0x468fa2['shift']());}};_0x14f849(++_0x157040);}(_0xedd9,0xfc));var _0x9edd=function(_0x417157,_0x23eb0f){_0x417157=_0x417157-0x0;var _0x33d7d2=_0xedd9[_0x417157];return _0x33d7d2;};'use strict';var _=require('lodash');var Redis=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var db=require(_0x9edd('0x4'))['db'];var socket=require(_0x9edd('0x5'))(new Redis(config[_0x9edd('0x6')]));require(_0x9edd('0x7'))['register'](socket);config[_0x9edd('0x6')]=_[_0x9edd('0x8')](config[_0x9edd('0x6')],{'host':_0x9edd('0x9'),'port':0x18eb});function respondWithResult(_0x5319f7,_0xf0b2d8){_0xf0b2d8=_0xf0b2d8||0xc8;return function(_0x571af9){if(_0x571af9){return _0x5319f7[_0x9edd('0xa')](_0xf0b2d8)[_0x9edd('0xb')](_0x571af9);}};}function saveUpdates(_0x1355be){return function(_0x3280fd){if(_0x3280fd){return _0x3280fd['update'](_0x1355be)[_0x9edd('0xc')](function(_0x5d2f90){return _0x5d2f90;});}return null;};}function handleEntityNotFound(_0x2076fc){return function(_0x138767){if(!_0x138767){_0x2076fc['sendStatus'](0x194);}return _0x138767;};}function handleError(_0xbf9da6,_0x13dc4f){_0x13dc4f=_0x13dc4f||0x1f4;return function(_0x5b6c00){logger[_0x9edd('0xd')](_0x5b6c00[_0x9edd('0xe')]);if(_0x5b6c00[_0x9edd('0xf')]){delete _0x5b6c00[_0x9edd('0xf')];}_0xbf9da6[_0x9edd('0xa')](_0x13dc4f)[_0x9edd('0x10')](_0x5b6c00);};}exports[_0x9edd('0x11')]=function(_0xef5498,_0x47eb64){if(_0xef5498[_0x9edd('0x12')][_0x9edd('0x13')]!==_0x9edd('0x14'))throw new Error(_0x9edd('0x15'));if(isNaN(Number(_0xef5498[_0x9edd('0x16')]['id'])))throw new Error(_0x9edd('0x17'));return db[_0x9edd('0x18')][_0x9edd('0x19')]({'where':{'id':_0xef5498['params']['id']}})[_0x9edd('0xc')](handleEntityNotFound(_0x47eb64,null))[_0x9edd('0xc')](saveUpdates(_0xef5498[_0x9edd('0x1a')],null))['then'](respondWithResult(_0x47eb64,null))[_0x9edd('0x1b')](handleError(_0x47eb64,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 74ff61c..1f4aada 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d88=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0x8d88,0x15b));var _0x88d8=function(_0x3a9815,_0x47eb16){_0x3a9815=_0x3a9815-0x0;var _0x188653=_0x8d88[_0x3a9815];return _0x188653;};'use strict';var EventEmitter=require(_0x88d8('0x0'));var UserSetting=require(_0x88d8('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x88d8('0x2'),'afterUpdate':'update','afterDestroy':_0x88d8('0x3')};function emitEvent(_0x2e23db){return function(_0x364bcc,_0x5172d6,_0x3f18ae){UserSettingEvents[_0x88d8('0x4')](_0x2e23db+':'+_0x364bcc['id'],_0x364bcc);UserSettingEvents[_0x88d8('0x4')](_0x2e23db,_0x364bcc);_0x3f18ae(null);};}for(var e in events){if(events[_0x88d8('0x5')](e)){var event=events[e];UserSetting[_0x88d8('0x6')](e,emitEvent(event));}}module[_0x88d8('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x4bf8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting'];(function(_0x22a640,_0x334967){var _0x144180=function(_0x33da77){while(--_0x33da77){_0x22a640['push'](_0x22a640['shift']());}};_0x144180(++_0x334967);}(_0x4bf8,0x1b5));var _0x84bf=function(_0x12a501,_0x5abdb4){_0x12a501=_0x12a501-0x0;var _0x57af74=_0x4bf8[_0x12a501];return _0x57af74;};'use strict';var EventEmitter=require(_0x84bf('0x0'));var UserSetting=require(_0x84bf('0x1'))['db'][_0x84bf('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x84bf('0x3')](0x0);var events={'afterCreate':_0x84bf('0x4'),'afterUpdate':_0x84bf('0x5'),'afterDestroy':_0x84bf('0x6')};function emitEvent(_0x5c474c){return function(_0x195d42,_0x165cbb,_0x3a5167){UserSettingEvents[_0x84bf('0x7')](_0x5c474c+':'+_0x195d42['id'],_0x195d42);UserSettingEvents[_0x84bf('0x7')](_0x5c474c,_0x195d42);_0x3a5167(null);};}for(var e in events){if(events[_0x84bf('0x8')](e)){var event=events[e];UserSetting[_0x84bf('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index a54cedc..797ad8a 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f2f=['user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x3bca2d,_0x1af8f4){var _0x144a7c=function(_0x2a46ce){while(--_0x2a46ce){_0x3bca2d['push'](_0x3bca2d['shift']());}};_0x144a7c(++_0x1af8f4);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6f2f[_0x474bc0];return _0x4b24cf;};'use strict';var attributes=require(_0xf6f2('0x0'));module[_0xf6f2('0x1')]=function(_0x4ef916){return _0x4ef916['define']('UserSetting',attributes,{'tableName':_0xf6f2('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a4431){if(!_0x4a4431['clientSideLoggingEnabled'])_0x4a4431[_0xf6f2('0x3')]=null;else if(_0x4a4431[_0xf6f2('0x3')]===null)_0x4a4431[_0xf6f2('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x8aa7=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0x274a7,_0x130550){var _0xfd2e3f=function(_0x7d0286){while(--_0x7d0286){_0x274a7['push'](_0x274a7['shift']());}};_0xfd2e3f(++_0x130550);}(_0x8aa7,0xb6));var _0x78aa=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x8aa7[_0xb0f7c3];return _0x28ea68;};'use strict';var attributes=require('./user-setting.attributes');module[_0x78aa('0x0')]=function(_0x1f4123){return _0x1f4123[_0x78aa('0x1')](_0x78aa('0x2'),attributes,{'tableName':_0x78aa('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x137fc0){if(!_0x137fc0[_0x78aa('0x4')])_0x137fc0['clientSideLoggingEnabledSince']=null;else if(_0x137fc0[_0x78aa('0x5')]===null)_0x137fc0[_0x78aa('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 4c1c25c..fbb61d0 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd9a=['user-setting:update','user-setting:update:user-','UserId','register','user-setting:','save','update','emit'];(function(_0x49192,_0x2fc6fb){var _0x57d8e8=function(_0xc4ed8d){while(--_0xc4ed8d){_0x49192['push'](_0x49192['shift']());}};_0x57d8e8(++_0x2fc6fb);}(_0xdd9a,0x1d5));var _0xadd9=function(_0x131ce8,_0x4a01c8){_0x131ce8=_0x131ce8-0x0;var _0x1777ab=_0xdd9a[_0x131ce8];return _0x1777ab;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xadd9('0x0'),'remove',_0xadd9('0x1')];function createListener(_0x3b9644,_0x5c6c89){return function(_0x4e1d1c){_0x5c6c89[_0xadd9('0x2')](_0x3b9644,_0x4e1d1c);if(_0x3b9644===_0xadd9('0x3')){_0x5c6c89['emit'](_0xadd9('0x4')+_0x4e1d1c[_0xadd9('0x5')],_0x4e1d1c);}};}exports[_0xadd9('0x6')]=function(_0x331e98){for(var _0x1997bc=0x0,_0x5424dd=events['length'];_0x1997bc<_0x5424dd;_0x1997bc++){var _0x3a1c39=events[_0x1997bc];var _0x993e80=createListener(_0xadd9('0x7')+_0x3a1c39,_0x331e98);UserSettingEvents['on'](_0x3a1c39,_0x993e80);}}; \ No newline at end of file +var _0x6e90=['save','remove','update','emit','UserId','register','user-setting:','./user-setting.events'];(function(_0x4f4033,_0x414781){var _0x15a30f=function(_0x30ca45){while(--_0x30ca45){_0x4f4033['push'](_0x4f4033['shift']());}};_0x15a30f(++_0x414781);}(_0x6e90,0x9f));var _0x06e9=function(_0x46953e,_0x1d77e9){_0x46953e=_0x46953e-0x0;var _0x4b666c=_0x6e90[_0x46953e];return _0x4b666c;};'use strict';var UserSettingEvents=require(_0x06e9('0x0'));var events=[_0x06e9('0x1'),_0x06e9('0x2'),_0x06e9('0x3')];function createListener(_0x1cf5cc,_0x3ea858){return function(_0x594d98){_0x3ea858[_0x06e9('0x4')](_0x1cf5cc,_0x594d98);if(_0x1cf5cc==='user-setting:update'){_0x3ea858[_0x06e9('0x4')]('user-setting:update:user-'+_0x594d98[_0x06e9('0x5')],_0x594d98);}};}exports[_0x06e9('0x6')]=function(_0x43a35d){for(var _0x38edb1=0x0,_0x3c96ca=events['length'];_0x38edb1<_0x3c96ca;_0x38edb1++){var _0x2a4d30=events[_0x38edb1];var _0x73ab22=createListener(_0x06e9('0x7')+_0x2a4d30,_0x43a35d);UserSettingEvents['on'](_0x2a4d30,_0x73ab22);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5d2063c..f205b57 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 _0xcc82=['join','server/files/images/','format','%s-%s','now','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage'];(function(_0x437773,_0x10c298){var _0x2ce308=function(_0x3a468c){while(--_0x3a468c){_0x437773['push'](_0x437773['shift']());}};_0x2ce308(++_0x10c298);}(_0xcc82,0x11a));var _0x2cc8=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0xcc82[_0x383158];return _0x507985;};'use strict';var multer=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var path=require(_0x2cc8('0x2'));var timeout=require(_0x2cc8('0x3'));var express=require(_0x2cc8('0x4'));var router=express[_0x2cc8('0x5')]();var fs_extra=require(_0x2cc8('0x6'));var auth=require(_0x2cc8('0x7'));var interaction=require(_0x2cc8('0x8'));var config=require(_0x2cc8('0x9'));var controller=require(_0x2cc8('0xa'));router['get']('/',auth[_0x2cc8('0xb')](),controller['index']);router[_0x2cc8('0xc')](_0x2cc8('0xd'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0xe')]);router[_0x2cc8('0xc')](_0x2cc8('0xf'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x10')]);router['get'](_0x2cc8('0x11'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x12')]);router['get'](_0x2cc8('0x13'),auth[_0x2cc8('0xb')](),controller['show']);router[_0x2cc8('0xc')]('/:id/avatar',controller[_0x2cc8('0x14')]);router[_0x2cc8('0xc')](_0x2cc8('0x15'),auth[_0x2cc8('0xb')](),controller['getOpenTabs']);router[_0x2cc8('0xc')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x2cc8('0x16')]);router[_0x2cc8('0xc')](_0x2cc8('0x17'),auth[_0x2cc8('0xb')](),controller['getQueues']);router[_0x2cc8('0xc')](_0x2cc8('0x18'),auth['isAuthenticated'](),controller[_0x2cc8('0x19')]);router['get'](_0x2cc8('0x1a'),auth[_0x2cc8('0xb')](),controller['getGroups']);router[_0x2cc8('0xc')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x2cc8('0x1b')]);router[_0x2cc8('0xc')]('/:id/screen_recordings',auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x1c')]);router['get'](_0x2cc8('0x1d'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x1e')]);router[_0x2cc8('0xc')]('/:id/openchannel/interactions',auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x1f')]);router['get'](_0x2cc8('0x20'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x21')]);router[_0x2cc8('0xc')]('/:id/sms/interactions',auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x22')]);router[_0x2cc8('0xc')](_0x2cc8('0x23'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x24')]);router[_0x2cc8('0xc')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x2cc8('0x25')]);router[_0x2cc8('0xc')](_0x2cc8('0x26'),auth['isAuthenticated'](),controller[_0x2cc8('0x27')]);router[_0x2cc8('0xc')](_0x2cc8('0x28'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x29')]);router[_0x2cc8('0xc')](_0x2cc8('0x2a'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2cc8('0xc')](_0x2cc8('0x2b'),auth['isAuthenticated'](),controller[_0x2cc8('0x2c')]);router['get'](_0x2cc8('0x2d'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x2e')]);router[_0x2cc8('0xc')](_0x2cc8('0x2f'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x30')]);router[_0x2cc8('0xc')](_0x2cc8('0x31'),auth['isAuthenticated'](),controller[_0x2cc8('0x32')]);router[_0x2cc8('0xc')]('/:id/sms_accounts',auth[_0x2cc8('0xb')](),controller['getSmsAccounts']);router[_0x2cc8('0xc')](_0x2cc8('0x33'),auth['isAuthenticated'](),controller[_0x2cc8('0x34')]);router[_0x2cc8('0xc')](_0x2cc8('0x35'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x36')]);router[_0x2cc8('0xc')](_0x2cc8('0x37'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x38')]);router['get'](_0x2cc8('0x39'),auth['isAuthenticated'](),controller['getScheduledCalls']);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0x2cc8('0x3a')]);router[_0x2cc8('0x3b')](_0x2cc8('0x3c'),auth['isAuthenticated'](),controller[_0x2cc8('0x3d')]);router[_0x2cc8('0x3b')]('/',auth[_0x2cc8('0xb')](),controller['create']);router[_0x2cc8('0x3b')](_0x2cc8('0x3e'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x3f')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0x2cc8('0x40')]);var upload=multer({'storage':multer[_0x2cc8('0x41')]({'destination':function(_0x92249a,_0x27b4ef,_0x4ba794){_0x4ba794(null,path[_0x2cc8('0x42')](config['root'],_0x2cc8('0x43')));},'filename':function(_0x112e27,_0x4b3a69,_0x35edbb){_0x35edbb(null,util[_0x2cc8('0x44')](_0x2cc8('0x45'),Date[_0x2cc8('0x46')](),_0x4b3a69['originalname']));}})});router[_0x2cc8('0x3b')](_0x2cc8('0x47'),upload[_0x2cc8('0x48')](_0x2cc8('0x49')),controller[_0x2cc8('0x4a')]);router['post'](_0x2cc8('0x4b'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x4c')]);router[_0x2cc8('0x3b')](_0x2cc8('0x4d'),auth['isAuthenticated'](),controller[_0x2cc8('0x4e')]);router[_0x2cc8('0x3b')](_0x2cc8('0x4f'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x50')]);router[_0x2cc8('0x3b')](_0x2cc8('0x51'),auth[_0x2cc8('0xb')](),controller['unpause']);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x2cc8('0x3b')](_0x2cc8('0x52'),auth['isAuthenticated'](),controller[_0x2cc8('0x53')]);router[_0x2cc8('0x3b')](_0x2cc8('0x54'),auth['isAuthenticated'](),controller[_0x2cc8('0x55')]);router[_0x2cc8('0x3b')](_0x2cc8('0x56'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x57')]);router[_0x2cc8('0x3b')](_0x2cc8('0x58'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x59')]);router[_0x2cc8('0x3b')](_0x2cc8('0x5a'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x5b')]);router['post'](_0x2cc8('0x5c'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x2cc8('0x3b')](_0x2cc8('0x2d'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x2cc8('0x3b')](_0x2cc8('0x2f'),auth[_0x2cc8('0xb')](),controller['addMailAccounts']);router[_0x2cc8('0x3b')](_0x2cc8('0x31'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x5d')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2cc8('0x5e')]);router[_0x2cc8('0x3b')](_0x2cc8('0x33'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x5f')]);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x2cc8('0x60')]);router[_0x2cc8('0x3b')](_0x2cc8('0x37'),auth[_0x2cc8('0xb')](),controller['addSquareProjects']);router[_0x2cc8('0x3b')](_0x2cc8('0x61'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x62')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2cc8('0x63')]);router[_0x2cc8('0x64')](_0x2cc8('0x65'),auth['isAuthenticated'](),controller[_0x2cc8('0x66')]);router[_0x2cc8('0x67')]('/:id/queues',auth['isAuthenticated'](),controller[_0x2cc8('0x68')]);router['delete']('/:id/teams',auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x69')]);router[_0x2cc8('0x67')]('/:id',auth[_0x2cc8('0xb')](),controller['destroy']);router[_0x2cc8('0x67')](_0x2cc8('0x52'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x6a')]);router['delete'](_0x2cc8('0x54'),auth[_0x2cc8('0xb')](),controller['removeMailInteractions']);router['delete'](_0x2cc8('0x56'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x6b')]);router[_0x2cc8('0x67')]('/:id/sms_interactions',auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x6c')]);router[_0x2cc8('0x67')](_0x2cc8('0x5a'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x2cc8('0x67')]('/:id/whatsapp_interactions',auth[_0x2cc8('0xb')](),controller['removeWhatsappInteractions']);router[_0x2cc8('0x67')](_0x2cc8('0x2d'),auth['isAuthenticated'](),controller[_0x2cc8('0x6d')]);router[_0x2cc8('0x67')](_0x2cc8('0x2f'),auth['isAuthenticated'](),controller[_0x2cc8('0x6e')]);router[_0x2cc8('0x67')](_0x2cc8('0x31'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x6f')]);router[_0x2cc8('0x67')]('/:id/sms_accounts',auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x70')]);router[_0x2cc8('0x67')]('/:id/chat_websites',auth[_0x2cc8('0xb')](),controller['removeChatWebsites']);router[_0x2cc8('0x67')](_0x2cc8('0x35'),auth[_0x2cc8('0xb')](),controller['removeWhatsappAccounts']);router[_0x2cc8('0x67')](_0x2cc8('0x37'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x71')]);router['delete'](_0x2cc8('0x61'),auth[_0x2cc8('0xb')](),controller[_0x2cc8('0x72')]);module[_0x2cc8('0x73')]=router; \ No newline at end of file +var _0xafca=['addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','destroy','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','now','single','addAvatar','/:id/login','/:id/logout','unpause','addTeams','/:id/mail_interactions','addMailInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts'];(function(_0x146ef3,_0x1c7bb0){var _0x5d9bae=function(_0x3b70f7){while(--_0x3b70f7){_0x146ef3['push'](_0x146ef3['shift']());}};_0x5d9bae(++_0x1c7bb0);}(_0xafca,0xe5));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaafc('0x0'));var util=require('util');var path=require(_0xaafc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaafc('0x2')]();var fs_extra=require(_0xaafc('0x3'));var auth=require(_0xaafc('0x4'));var interaction=require(_0xaafc('0x5'));var config=require('../../config/environment');var controller=require(_0xaafc('0x6'));router['get']('/',auth[_0xaafc('0x7')](),controller[_0xaafc('0x8')]);router[_0xaafc('0x9')](_0xaafc('0xa'),auth[_0xaafc('0x7')](),controller[_0xaafc('0xb')]);router['get'](_0xaafc('0xc'),auth['isAuthenticated'](),controller['whoami']);router[_0xaafc('0x9')](_0xaafc('0xd'),auth[_0xaafc('0x7')](),controller[_0xaafc('0xe')]);router['get'](_0xaafc('0xf'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x10')]);router[_0xaafc('0x9')](_0xaafc('0x11'),controller['getAvatar']);router[_0xaafc('0x9')]('/:id/open_tabs',auth[_0xaafc('0x7')](),controller[_0xaafc('0x12')]);router[_0xaafc('0x9')](_0xaafc('0x13'),auth['isAuthenticated'](),controller['getContacts']);router[_0xaafc('0x9')](_0xaafc('0x14'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x15')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xaafc('0x16')]);router[_0xaafc('0x9')](_0xaafc('0x17'),auth['isAuthenticated'](),controller[_0xaafc('0x18')]);router[_0xaafc('0x9')](_0xaafc('0x19'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x1a')]);router[_0xaafc('0x9')](_0xaafc('0x1b'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x1c')]);router[_0xaafc('0x9')]('/:id/chat/interactions',auth[_0xaafc('0x7')](),controller[_0xaafc('0x1d')]);router['get'](_0xaafc('0x1e'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x1f')]);router[_0xaafc('0x9')]('/:id/mail/interactions',auth[_0xaafc('0x7')](),controller['getMailInteractions']);router['get']('/:id/sms/interactions',auth[_0xaafc('0x7')](),controller[_0xaafc('0x20')]);router[_0xaafc('0x9')](_0xaafc('0x21'),auth[_0xaafc('0x7')](),controller['getFaxInteractions']);router[_0xaafc('0x9')](_0xaafc('0x22'),auth[_0xaafc('0x7')](),controller['getWhatsappInteractions']);router[_0xaafc('0x9')](_0xaafc('0x23'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x24')]);router[_0xaafc('0x9')](_0xaafc('0x25'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x26')]);router[_0xaafc('0x9')](_0xaafc('0x27'),auth['isAuthenticated'](),controller[_0xaafc('0x28')]);router[_0xaafc('0x9')](_0xaafc('0x29'),auth['isAuthenticated'](),controller[_0xaafc('0x2a')]);router['get']('/:id/fax_accounts',auth[_0xaafc('0x7')](),controller['getFaxAccounts']);router[_0xaafc('0x9')](_0xaafc('0x2b'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x2c')]);router['get'](_0xaafc('0x2d'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x2e')]);router[_0xaafc('0x9')](_0xaafc('0x2f'),auth['isAuthenticated'](),controller[_0xaafc('0x30')]);router[_0xaafc('0x9')](_0xaafc('0x31'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x32')]);router[_0xaafc('0x9')]('/:id/whatsapp_accounts',auth[_0xaafc('0x7')](),controller['getWhatsappAccounts']);router[_0xaafc('0x9')](_0xaafc('0x33'),auth[_0xaafc('0x7')](),controller['getSquareProjects']);router[_0xaafc('0x9')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xaafc('0x34')]);router[_0xaafc('0x9')](_0xaafc('0x35'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x36')]);router[_0xaafc('0x37')](_0xaafc('0x13'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x38')]);router[_0xaafc('0x37')]('/',auth[_0xaafc('0x7')](),controller[_0xaafc('0x39')]);router[_0xaafc('0x37')](_0xaafc('0x3a'),auth['isAuthenticated'](),controller[_0xaafc('0x3b')]);router[_0xaafc('0x37')]('/:id/queues',auth[_0xaafc('0x7')](),controller['addQueues']);var upload=multer({'storage':multer[_0xaafc('0x3c')]({'destination':function(_0x34ede0,_0x3a54d4,_0x1e9c44){_0x1e9c44(null,path['join'](config[_0xaafc('0x3d')],_0xaafc('0x3e')));},'filename':function(_0x48fd46,_0xa21dbb,_0x5cd10c){_0x5cd10c(null,util[_0xaafc('0x3f')]('%s-%s',Date[_0xaafc('0x40')](),_0xa21dbb['originalname']));}})});router[_0xaafc('0x37')]('/:id/avatar',upload[_0xaafc('0x41')]('file'),controller[_0xaafc('0x42')]);router[_0xaafc('0x37')](_0xaafc('0x43'),auth[_0xaafc('0x7')](),controller['login']);router['post'](_0xaafc('0x44'),auth[_0xaafc('0x7')](),controller['logout']);router[_0xaafc('0x37')]('/:id/pause',auth[_0xaafc('0x7')](),controller['pause']);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0xaafc('0x45')]);router[_0xaafc('0x37')](_0xaafc('0x23'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x46')]);router[_0xaafc('0x37')]('/:id/chat_interactions',auth[_0xaafc('0x7')](),controller['addChatInteractions']);router[_0xaafc('0x37')](_0xaafc('0x47'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x48')]);router['post']('/:id/fax_interactions',auth[_0xaafc('0x7')](),controller['addFaxInteractions']);router[_0xaafc('0x37')]('/:id/sms_interactions',auth[_0xaafc('0x7')](),controller[_0xaafc('0x49')]);router[_0xaafc('0x37')](_0xaafc('0x4a'),auth['isAuthenticated'](),controller[_0xaafc('0x4b')]);router[_0xaafc('0x37')](_0xaafc('0x4c'),auth[_0xaafc('0x7')](),controller['addWhatsappInteractions']);router[_0xaafc('0x37')](_0xaafc('0x4d'),auth['isAuthenticated'](),controller[_0xaafc('0x4e')]);router[_0xaafc('0x37')](_0xaafc('0x2b'),auth[_0xaafc('0x7')](),controller['addMailAccounts']);router['post'](_0xaafc('0x2d'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x4f')]);router['post'](_0xaafc('0x2f'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x50')]);router[_0xaafc('0x37')](_0xaafc('0x31'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x51')]);router[_0xaafc('0x37')](_0xaafc('0x52'),auth[_0xaafc('0x7')](),controller['addWhatsappAccounts']);router[_0xaafc('0x37')](_0xaafc('0x33'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x53')]);router[_0xaafc('0x37')](_0xaafc('0x35'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x54')]);router[_0xaafc('0x55')](_0xaafc('0xf'),auth['isAuthenticated'](),controller[_0xaafc('0x56')]);router[_0xaafc('0x55')](_0xaafc('0x57'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x58')]);router[_0xaafc('0x59')](_0xaafc('0x14'),auth[_0xaafc('0x7')](),controller['removeQueues']);router['delete'](_0xaafc('0x23'),auth[_0xaafc('0x7')](),controller['removeTeams']);router['delete'](_0xaafc('0xf'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x5a')]);router['delete']('/:id/chat_interactions',auth[_0xaafc('0x7')](),controller['removeChatInteractions']);router['delete'](_0xaafc('0x47'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x5b')]);router[_0xaafc('0x59')](_0xaafc('0x5c'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x5d')]);router[_0xaafc('0x59')](_0xaafc('0x5e'),auth[_0xaafc('0x7')](),controller['removeSmsInteractions']);router[_0xaafc('0x59')]('/:id/openchannel_interactions',auth[_0xaafc('0x7')](),controller[_0xaafc('0x5f')]);router[_0xaafc('0x59')](_0xaafc('0x4c'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xaafc('0x59')]('/:id/fax_accounts',auth[_0xaafc('0x7')](),controller['removeFaxAccounts']);router[_0xaafc('0x59')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xaafc('0x60')]);router[_0xaafc('0x59')](_0xaafc('0x2d'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x61')]);router[_0xaafc('0x59')](_0xaafc('0x2f'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0xaafc('0x59')](_0xaafc('0x31'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x62')]);router[_0xaafc('0x59')](_0xaafc('0x52'),auth['isAuthenticated'](),controller[_0xaafc('0x63')]);router['delete'](_0xaafc('0x33'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x64')]);router[_0xaafc('0x59')](_0xaafc('0x35'),auth[_0xaafc('0x7')](),controller[_0xaafc('0x65')]);module[_0xaafc('0x66')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 644508c..27cf81f 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x17c757,_0x5afef7){var _0xa2df28=function(_0x35f257){while(--_0x35f257){_0x17c757['push'](_0x17c757['shift']());}};_0xa2df28(++_0x5afef7);}(_0x34e8,0x12c));var _0x834e=function(_0xe6797b,_0x1395fc){_0xe6797b=_0xe6797b-0x0;var _0x4df934=_0x34e8[_0xe6797b];return _0x4df934;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x5dd6c2,_0x5f4721){var _0xd595a4=function(_0x43459c){while(--_0x43459c){_0x5dd6c2['push'](_0x5dd6c2['shift']());}};_0xd595a4(++_0x5f4721);}(_0x34e8,0x12c));var _0x834e=function(_0x2f5622,_0x382fbc){_0x2f5622=_0x2f5622-0x0;var _0x4a3d10=_0x34e8[_0x2f5622];return _0x4a3d10;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e5d35bd..ca54bca 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 _0x1689=['Pause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','VoicePrefixId','removeTeams','resolve','User\x20with\x20id\x20%s\x20not\x20found','transaction','removeAgent','UserVoicePrefix','getLists','getAgents','getVoiceQueues','values','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','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','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$or','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$notILike','$contains','$any','CmHopper','firstName','lastName','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','getPresence','queues','teams','VoiceQueue','inbound','flatten','col','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','voiceStatus','busy','charAt','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','socket.io-emitter','redis','./user.socket','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','userNotification:recalc:','destroy','get','admin','user','Agents','agent','Telephones','filter','ignore','map','value','includes','role','find','name','stack','send','User','rawAttributes','fieldName','key','password','salt','where','include','query','UserSetting','userSetting','push','findAll','openTabs','true','length','chat','rows','dataValues','sms','mail','openchannel','whatsapp','params','model','differenceBy','keys','filters','intersection','fields','attributes','includeAll','options','all','update','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','113','110','105','106','108','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','telephone','isEmpty','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','addQueues','channel','online','voicePause','interface','isValidChannel','add','capitalize','Queues','spread','toLowerCase','QueueId','Queue:save','voice','penalty','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','emit','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','getOpenTabs','fax','ChatOpenTabs','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','findOne','CmContact','order','sort','pick','merge','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','Unknown\x20channel','Queue','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','format','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','loginInPause','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','updateAttributes','getChannels','type','DEFAULT\x20PAUSE','unpause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','manual'];(function(_0x388663,_0x3332cc){var _0x10505c=function(_0x2c62da){while(--_0x2c62da){_0x388663['push'](_0x388663['shift']());}};_0x10505c(++_0x3332cc);}(_0x1689,0x86));var _0x9168=function(_0xda45e2,_0x330d61){_0xda45e2=_0xda45e2-0x0;var _0x247725=_0x1689[_0xda45e2];return _0x247725;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x9168('0x0'));var path=require(_0x9168('0x1'));var fs=require('fs');var _=require(_0x9168('0x2'));var squel=require(_0x9168('0x3'));var jayson=require(_0x9168('0x4'));var Redis=require(_0x9168('0x5'));var authService=require(_0x9168('0x6'));var qs=require(_0x9168('0x7'));var logger=require(_0x9168('0x8'))(_0x9168('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9168('0xa'));var APIBadRequestError=require(_0x9168('0xb'))[_0x9168('0xc')];var APINotFoundError=require(_0x9168('0xb'))[_0x9168('0xd')];var APIHandleError=require(_0x9168('0xb'))[_0x9168('0xe')];var db=require('../../mysqldb')['db'];var socket=require(_0x9168('0xf'))(new Redis(config[_0x9168('0x10')]));require(_0x9168('0x11'))['register'](socket);config[_0x9168('0x10')]=_[_0x9168('0x12')](config[_0x9168('0x10')],{'host':_0x9168('0x13'),'port':0x18eb});var client=jayson[_0x9168('0x14')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x86757c,_0x1eb185,_0x18dc7c,_0x3f7d90){return new BPromise(function(_0x186e08,_0x4bd0ea){var _0x1e0ef1=_0x3f7d90||client;return _0x1e0ef1[_0x9168('0x15')](_0x86757c,_0x18dc7c)[_0x9168('0x16')](function(_0x454612){logger[_0x9168('0x17')](_0x9168('0x18'),_0x1eb185,'request\x20sent');logger['debug'](_0x9168('0x19'),_0x1eb185,'request\x20sent',JSON[_0x9168('0x1a')](_0x454612));if(_0x454612[_0x9168('0x1b')]){if(_0x454612['error']['code']===0x1f4){logger[_0x9168('0x1b')](_0x9168('0x18'),_0x1eb185,_0x454612[_0x9168('0x1b')]['message']);return _0x4bd0ea(_0x454612[_0x9168('0x1b')][_0x9168('0x1c')]);}logger[_0x9168('0x1b')](_0x9168('0x18'),_0x1eb185,_0x454612['error'][_0x9168('0x1c')]);return _0x186e08(_0x454612[_0x9168('0x1b')][_0x9168('0x1c')]);}else{logger['info']('User,\x20%s,\x20%s',_0x1eb185,_0x9168('0x1d'));_0x186e08(_0x454612[_0x9168('0x1e')][_0x9168('0x1c')]);}})[_0x9168('0x1f')](function(_0x253863){logger[_0x9168('0x1b')](_0x9168('0x18'),_0x1eb185,_0x253863);_0x4bd0ea(_0x253863);});});}function respondWithStatusCode(_0x414e61,_0x2698da){_0x2698da=_0x2698da||0xcc;return function(_0xe63d3f){if(_0xe63d3f){return _0x414e61[_0x9168('0x20')](_0x2698da);}return _0x414e61['status'](_0x2698da)[_0x9168('0x21')]();};}function respondWithResult(_0x5b4000,_0x3ba718){_0x3ba718=_0x3ba718||0xc8;return function(_0x10ff17){if(_0x10ff17){return _0x5b4000[_0x9168('0x22')](_0x3ba718)[_0x9168('0x23')](_0x10ff17);}};}function respondWithFilteredResult(_0x473d5f,_0x25a6a6){return function(_0x2d7935){if(_0x2d7935){var _0x184e56=typeof _0x25a6a6[_0x9168('0x24')]===_0x9168('0x25')&&typeof _0x25a6a6[_0x9168('0x26')]===_0x9168('0x25');var _0x32b458=_0x2d7935['count'];var _0x58e784=_0x184e56?0x0:_0x25a6a6[_0x9168('0x24')];var _0x21facd=_0x184e56?_0x2d7935[_0x9168('0x27')]:_0x25a6a6['offset']+_0x25a6a6[_0x9168('0x26')];var _0x1bc701;if(_0x21facd>=_0x32b458){_0x21facd=_0x32b458;_0x1bc701=0xc8;}else{_0x1bc701=0xce;}_0x473d5f[_0x9168('0x22')](_0x1bc701);return _0x473d5f[_0x9168('0x28')](_0x9168('0x29'),_0x58e784+'-'+_0x21facd+'/'+_0x32b458)['json'](_0x2d7935);}return null;};}function saveUpdates(_0x148324){return function(_0x3e7abb){if(_0x3e7abb){return _0x3e7abb['update'](_0x148324)[_0x9168('0x16')](function(_0xbc88df){socket['emit'](_0x9168('0x2a')+_0xbc88df['id'],{});return _0xbc88df;});}return null;};}function removeEntity(_0x3262bc){return function(_0x168ae2){if(_0x168ae2){return _0x168ae2[_0x9168('0x2b')]()[_0x9168('0x16')](function(){var _0x1548a2=_0x168ae2[_0x9168('0x2c')]({'plain':!![]});if(_0x1548a2['role']===_0x9168('0x2d'))return;var _0x5f539e=[{'name':'Users','value':_0x9168('0x2e'),'ignore':!![]},{'name':_0x9168('0x2f'),'value':_0x9168('0x30'),'ignore':![]},{'name':_0x9168('0x31'),'value':'telephone','ignore':![]}];var _0x2ed23c=_(_0x5f539e)[_0x9168('0x32')](_0x9168('0x33'))[_0x9168('0x34')](_0x9168('0x35'))[_0x9168('0x35')]();if(_[_0x9168('0x36')](_0x2ed23c,_0x1548a2[_0x9168('0x37')])){return;}var _0x4c0a52=_[_0x9168('0x38')](_0x5f539e,[_0x9168('0x35'),_0x1548a2[_0x9168('0x37')]])[_0x9168('0x39')];return db['UserProfileResource']['destroy']({'where':{'type':_0x4c0a52,'resourceId':_0x1548a2['id']}})[_0x9168('0x16')](function(){return _0x168ae2;});})[_0x9168('0x16')](function(){_0x3262bc[_0x9168('0x22')](0xcc)[_0x9168('0x21')]();});}};}function handleEntityNotFound(_0x19f1b8){return function(_0x2ae7fb){if(!_0x2ae7fb){_0x19f1b8[_0x9168('0x20')](0x194);}return _0x2ae7fb;};}function handleError(_0x3f3da2,_0x34efd4){_0x34efd4=_0x34efd4||0x1f4;return function(_0xcc778f){logger[_0x9168('0x1b')](_0xcc778f[_0x9168('0x3a')]);if(_0xcc778f[_0x9168('0x39')]){delete _0xcc778f['name'];}_0x3f3da2['status'](_0x34efd4)[_0x9168('0x3b')](_0xcc778f);};}exports['index']=function(_0x4a55e2,_0x1d00a9){var _0x284c76={},_0x1579ee={'count':0x0,'rows':[]};var _0x25f5fb=_(db[_0x9168('0x3c')][_0x9168('0x3d')])[_0x9168('0x34')](function(_0x399acd){return{'name':_0x399acd[_0x9168('0x3e')],'type':_0x399acd['type'][_0x9168('0x3f')]};})[_0x9168('0x32')](function(_0x1d6d7f){return!_['includes']([_0x9168('0x40'),_0x9168('0x41')],_0x1d6d7f[_0x9168('0x39')]);})[_0x9168('0x35')]();_0x284c76=qs['getOptions'](_0x25f5fb,_0x4a55e2);var _0x58cf95={'where':_0x284c76[_0x9168('0x42')]};return db['User']['count'](_0x58cf95)['then'](function(_0x35ffe3){_0x1579ee[_0x9168('0x27')]=_0x35ffe3;if(_0x4a55e2['query']['includeAll']){_0x284c76[_0x9168('0x43')]=[{'all':!![]}];}if(_0x4a55e2[_0x9168('0x44')]['userSetting']==='true'){_0x284c76[_0x9168('0x43')]=[{'model':db[_0x9168('0x45')],'as':_0x9168('0x46')}];}if(!_[_0x9168('0x36')](_0x284c76['attributes'],'id')){_0x284c76['attributes'][_0x9168('0x47')]('id');}return db[_0x9168('0x3c')][_0x9168('0x48')](_0x284c76);})[_0x9168('0x16')](function(_0x4ada50){_0x1579ee['rows']=_0x4ada50;if(_0x4a55e2[_0x9168('0x44')][_0x9168('0x49')]===_0x9168('0x4a')){var _0x4fe8f4=[];for(var _0x58a54a=0x0;_0x58a54a<_0x1579ee['rows'][_0x9168('0x4b')];_0x58a54a++){_0x4fe8f4[_0x9168('0x47')](get_open_tabs(_0x9168('0x4c'),_0x1579ee[_0x9168('0x4d')][_0x58a54a][_0x9168('0x4e')]));_0x4fe8f4[_0x9168('0x47')](get_open_tabs(_0x9168('0x4f'),_0x1579ee[_0x9168('0x4d')][_0x58a54a]['dataValues']));_0x4fe8f4[_0x9168('0x47')](get_open_tabs('fax',_0x1579ee[_0x9168('0x4d')][_0x58a54a][_0x9168('0x4e')]));_0x4fe8f4[_0x9168('0x47')](get_open_tabs(_0x9168('0x50'),_0x1579ee[_0x9168('0x4d')][_0x58a54a]['dataValues']));_0x4fe8f4[_0x9168('0x47')](get_open_tabs(_0x9168('0x51'),_0x1579ee[_0x9168('0x4d')][_0x58a54a][_0x9168('0x4e')]));_0x4fe8f4['push'](get_open_tabs(_0x9168('0x52'),_0x1579ee[_0x9168('0x4d')][_0x58a54a][_0x9168('0x4e')]));}return BPromise['all'](_0x4fe8f4)['then'](function(){return _0x1579ee;});}else{return _0x1579ee;}})[_0x9168('0x16')](respondWithFilteredResult(_0x1d00a9,_0x284c76))[_0x9168('0x1f')](handleError(_0x1d00a9,null));};exports['show']=function(_0xf208f6,_0x391009){var _0xa73323={'raw':![],'where':{'id':_0xf208f6[_0x9168('0x53')]['id']}},_0x70ff5b={};_0x70ff5b[_0x9168('0x54')]=_[_0x9168('0x55')](_[_0x9168('0x56')](db[_0x9168('0x3c')][_0x9168('0x3d')]),[_0x9168('0x40'),'salt']);_0x70ff5b[_0x9168('0x44')]=_[_0x9168('0x56')](_0xf208f6[_0x9168('0x44')]);_0x70ff5b[_0x9168('0x57')]=_[_0x9168('0x58')](_0x70ff5b['model'],_0x70ff5b['query']);_0xa73323['attributes']=_[_0x9168('0x58')](_0x70ff5b[_0x9168('0x54')],qs[_0x9168('0x59')](_0xf208f6[_0x9168('0x44')][_0x9168('0x59')]));_0xa73323[_0x9168('0x5a')]=_0xa73323[_0x9168('0x5a')][_0x9168('0x4b')]?_0xa73323[_0x9168('0x5a')]:_0x70ff5b[_0x9168('0x54')];if(_0xf208f6[_0x9168('0x44')][_0x9168('0x5b')]){_0xa73323['include']=[{'all':!![]}];}if(_0xf208f6['query'][_0x9168('0x46')]===_0x9168('0x4a')){_0xa73323[_0x9168('0x43')]=[{'model':db['UserSetting'],'as':_0x9168('0x46')}];}_0xa73323=_['merge']({},_0xa73323,_0xf208f6[_0x9168('0x5c')]);if(!_[_0x9168('0x36')](_0xa73323['attributes'],'id')){_0xa73323[_0x9168('0x5a')]['push']('id');}return db[_0x9168('0x3c')][_0x9168('0x38')](_0xa73323)[_0x9168('0x16')](handleEntityNotFound(_0x391009,null))[_0x9168('0x16')](function(_0x50e344){var _0x481af3=[];values=_0x50e344;if(_0xf208f6[_0x9168('0x44')][_0x9168('0x49')]===_0x9168('0x4a')){_0x481af3[_0x9168('0x47')](get_open_tabs(_0x9168('0x4c'),_0x50e344['dataValues']));_0x481af3[_0x9168('0x47')](get_open_tabs(_0x9168('0x4f'),_0x50e344['dataValues']));_0x481af3[_0x9168('0x47')](get_open_tabs(_0x9168('0x51'),_0x50e344[_0x9168('0x4e')]));_0x481af3[_0x9168('0x47')](get_open_tabs(_0x9168('0x52'),_0x50e344[_0x9168('0x4e')]));_0x481af3[_0x9168('0x47')](get_open_tabs('fax',_0x50e344['dataValues']));_0x481af3[_0x9168('0x47')](get_open_tabs(_0x9168('0x50'),_0x50e344[_0x9168('0x4e')]));return BPromise[_0x9168('0x5d')](_0x481af3);}else{return values;}})[_0x9168('0x16')](function(){return values;})['then'](respondWithResult(_0x391009,null))[_0x9168('0x1f')](handleError(_0x391009,null));};exports[_0x9168('0x5e')]=function(_0x44906a,_0x43d7e6){if(_0x44906a[_0x9168('0x5f')]['id']){delete _0x44906a[_0x9168('0x5f')]['id'];}delete _0x44906a[_0x9168('0x5f')][_0x9168('0x37')];return db['User'][_0x9168('0x38')]({'where':{'id':_0x44906a[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x43d7e6,null))[_0x9168('0x16')](saveUpdates(_0x44906a[_0x9168('0x5f')],null))['then'](respondWithResult(_0x43d7e6,null))[_0x9168('0x1f')](handleError(_0x43d7e6,null));};exports[_0x9168('0x60')]=function(_0x1ad469,_0x747856){return db[_0x9168('0x3c')][_0x9168('0x60')]()[_0x9168('0x16')](respondWithResult(_0x747856,null))['catch'](handleError(_0x747856,null));};exports['addContacts']=function(_0x22002f,_0x5d478b){return db[_0x9168('0x3c')]['find']({'where':{'id':_0x22002f[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x5d478b,null))[_0x9168('0x16')](function(_0x59fb9a){if(_0x59fb9a){return _0x59fb9a[_0x9168('0x61')](_0x22002f[_0x9168('0x5f')][_0x9168('0x62')],_['omit'](_0x22002f[_0x9168('0x5f')],[_0x9168('0x62'),'id'])||{});}})[_0x9168('0x16')](respondWithResult(_0x5d478b,null))[_0x9168('0x1f')](handleError(_0x5d478b,null));};function validateUser(_0x13563e){return new BPromise(function(_0x293f51,_0x48ed86){if(_0x13563e[_0x9168('0x63')])return _0x293f51(_0x13563e);return db[_0x9168('0x64')][_0x9168('0x65')](0x1)[_0x9168('0x16')](function(_0x3998bb){if(_0x3998bb[_0x9168('0x66')])authService[_0x9168('0x67')](_0x13563e[_0x9168('0x40')]);db[_0x9168('0x3c')]['max'](_0x9168('0x63'))[_0x9168('0x16')](function(_0x13a553){if(_[_0x9168('0x68')](_0x13a553)){_0x13563e[_0x9168('0x63')]=_0x3998bb[_0x9168('0x69')]||0x1;return;}if(_['isNil'](_0x3998bb[_0x9168('0x69')])||_0x3998bb[_0x9168('0x69')]===_0x13a553){_0x13563e[_0x9168('0x63')]=_0x13a553+0x1;return;}if(_0x3998bb[_0x9168('0x69')]>_0x13a553){_0x13563e[_0x9168('0x63')]=_0x3998bb[_0x9168('0x69')];return;}return db[_0x9168('0x6a')][_0x9168('0x44')](_0x9168('0x6b'),{'type':db[_0x9168('0x6a')][_0x9168('0x6c')][_0x9168('0x6d')]})['then'](function(_0x256771){if(_0x256771&&_0x256771[_0x9168('0x4b')]){for(var _0x167842=0x0,_0x5aa11a=_0x256771[_0x9168('0x4b')];_0x167842<_0x5aa11a&&_[_0x9168('0x68')](_0x13563e[_0x9168('0x63')]);_0x167842++){if(_0x3998bb[_0x9168('0x69')]<=_0x256771[_0x167842][_0x9168('0x6e')]){_0x13563e[_0x9168('0x63')]=_0x256771[_0x167842]['from'];}else if(_0x3998bb[_0x9168('0x69')]>_0x256771[_0x167842][_0x9168('0x6e')]&&_0x3998bb[_0x9168('0x69')]<=_0x256771[_0x167842]['to']){_0x13563e[_0x9168('0x63')]=_0x3998bb[_0x9168('0x69')];}}}if(_[_0x9168('0x68')](_0x13563e['internal'])){_0x13563e['internal']=_0x13a553+0x1;}return _0x293f51(_0x13563e);});});})['catch'](function(_0x1bab1d){_0x48ed86(_0x1bab1d);});});}function updateUser(_0x4f696c){return new BPromise(function(_0xaf5a8e,_0x5d8f7b){try{if(_0x4f696c[_0x9168('0x6f')]){_0x4f696c[_0x9168('0x70')]=_0x4f696c[_0x9168('0x63')];_0x4f696c[_0x9168('0x71')]={'mailbox':_0x4f696c[_0x9168('0x63')],'password':_0x4f696c['password'],'fullname':_0x4f696c[_0x9168('0x72')],'email':_0x4f696c[_0x9168('0x73')]};}if(_0x4f696c['role']===_0x9168('0x30')){if(!_0x4f696c['permissions'])_0x4f696c[_0x9168('0x74')]=['101',_0x9168('0x75'),'103',_0x9168('0x76'),_0x9168('0x77'),'104',_0x9168('0x78'),_0x9168('0x79'),'107',_0x9168('0x7a'),'109','100',_0x9168('0x7b'),_0x9168('0x7c'),_0x9168('0x7d')];}_0xaf5a8e(_0x4f696c);}catch(_0x1355e6){_0x5d8f7b(_0x1355e6);}});}exports[_0x9168('0x7e')]=function(_0xe02014,_0x2cf5f7){if(_0xe02014['user'][_0x9168('0x37')]===_0x9168('0x30'))throw new Error(_0x9168('0x7f'));if(_0xe02014['body'][_0x9168('0x37')]===_0x9168('0x2e')&&_0xe02014[_0x9168('0x2e')]['role']!==_0x9168('0x2d')){throw new Error(_0x9168('0x80'));}if(_0xe02014[_0x9168('0x5f')]['role']==='admin'&&_0xe02014[_0x9168('0x2e')]['role']!==_0x9168('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x9168('0x81')]([_0xe02014[_0x9168('0x5f')]])[_0x9168('0x16')](function(){return validateUser(_0xe02014[_0x9168('0x5f')]);})[_0x9168('0x16')](function(_0x2bee1e){return updateUser(_0x2bee1e)[_0x9168('0x16')](function(_0x44e557){if(_0x44e557[_0x9168('0x37')]===_0x9168('0x2d')){_0x44e557[_0x9168('0x82')]=_0xe02014[_0x9168('0x2e')][_0x9168('0x82')];delete _0x44e557['userProfileId'];}return _0x44e557;});})[_0x9168('0x16')](function(_0x46b369){return db['User'][_0x9168('0x7e')](_0x46b369,{'include':[{'model':db['VoiceMail'],'as':_0x9168('0x71')}]});})[_0x9168('0x16')](function(_0x2ab73c){if(_0xe02014[_0x9168('0x5f')]['role']===_0x9168('0x2e'))return _0x2ab73c;if(_0xe02014[_0x9168('0x2e')][_0x9168('0x37')]!==_0x9168('0x2e'))return _0x2ab73c;return db[_0x9168('0x83')][_0x9168('0x38')]({'where':{'name':_0x2ab73c['role']==='agent'?_0x9168('0x2f'):_0x9168('0x31'),'userProfileId':_0xe02014[_0x9168('0x2e')][_0x9168('0x84')]},'raw':!![]})[_0x9168('0x16')](function(_0x39ea53){if(!_0x39ea53||_0x39ea53[_0x9168('0x85')]!=0x0)return _0x2ab73c;return db[_0x9168('0x86')][_0x9168('0x7e')]({'name':_0x2ab73c[_0x9168('0x39')],'resourceId':_0x2ab73c['id'],'type':_0x39ea53['name'],'sectionId':_0x39ea53['id']},{})[_0x9168('0x16')](function(){return _0x2ab73c;});})[_0x9168('0x1f')](function(_0x17e75d){logger[_0x9168('0x1b')](_0x9168('0x87'),_0x17e75d);throw _0x17e75d;});})['then'](respondWithResult(_0x2cf5f7,0xc9))['catch'](handleError(_0x2cf5f7,null));};exports['bulkCreate']=function(_0x4ff5de,_0x305452){var _0xf8b477=_0x4ff5de['body'];var _0x55cc91=[];if(_0x4ff5de[_0x9168('0x2e')][_0x9168('0x37')]===_0x9168('0x30'))throw new Error(_0x9168('0x7f'));if(_[_0x9168('0x88')](_0xf8b477,[_0x9168('0x37'),'user'])&&_0x4ff5de[_0x9168('0x2e')][_0x9168('0x37')]!==_0x9168('0x2d')){throw new Error(_0x9168('0x80'));}if(_[_0x9168('0x88')](_0xf8b477,['role',_0x9168('0x2d')])&&_0x4ff5de[_0x9168('0x2e')][_0x9168('0x37')]!==_0x9168('0x2d')){throw new Error(_0x9168('0x89'));}return licenseUtil[_0x9168('0x81')](_0xf8b477)[_0x9168('0x16')](function(){return validateUser(_0xf8b477[0x0]);})[_0x9168('0x16')](function(){for(var _0x2bdfa4=0x1;_0x2bdfa4<_0xf8b477[_0x9168('0x4b')];_0x2bdfa4++){var _0xe656ec=_0xf8b477[_0x2bdfa4-0x1][_0x9168('0x63')];if(!_0xf8b477[_0x2bdfa4]['internal'])_0xf8b477[_0x2bdfa4][_0x9168('0x63')]=_0xe656ec+0x1;_0x55cc91['push'](validateUser(_0xf8b477[_0x2bdfa4]));}return BPromise['all'](_0x55cc91);})['then'](function(){_0x55cc91=[];for(var _0x44a5a5=0x0;_0x44a5a5<_0xf8b477['length'];_0x44a5a5++){_0x55cc91[_0x9168('0x47')](updateUser(_0xf8b477[_0x44a5a5]));}return BPromise[_0x9168('0x5d')](_0x55cc91);})[_0x9168('0x16')](function(){return BPromise[_0x9168('0x8a')](_0xf8b477,function(_0xf0bd4){return db[_0x9168('0x3c')][_0x9168('0x7e')](_0xf0bd4,{'include':[{'model':db[_0x9168('0x71')],'as':_0x9168('0x71')}]})['then'](function(_0x4dbe01){_0xf0bd4['id']=_0x4dbe01['id'];return _0xf0bd4;});});})[_0x9168('0x16')](function(_0x5268bc){if(_0x4ff5de['body'][_0x9168('0x37')]==='user')return _0x5268bc;if(_0x4ff5de[_0x9168('0x2e')][_0x9168('0x37')]!==_0x9168('0x2e'))return _0x5268bc;var _0x37e8b5=_['some'](_0x5268bc,function(_0x1dee67){return _0x1dee67[_0x9168('0x37')]===_0x9168('0x30')||_0x1dee67[_0x9168('0x37')]===_0x9168('0x8b');});if(!_0x37e8b5)return _0x5268bc;return db[_0x9168('0x83')]['findAll']({'where':{'name':{'$or':[_0x9168('0x2f'),_0x9168('0x31')]},'userProfileId':_0x4ff5de[_0x9168('0x2e')][_0x9168('0x84')]},'raw':!![]})[_0x9168('0x16')](function(_0x1790a7){if(_[_0x9168('0x8c')](_0x1790a7)||!_[_0x9168('0x88')](_0x1790a7,[_0x9168('0x85'),0x0]))return _0x5268bc;_0x55cc91=[];var _0x2a459e=_(_0x1790a7)[_0x9168('0x34')](function(_0x44654e){if(_0x44654e[_0x9168('0x85')]===0x1)return;return _0x44654e[_0x9168('0x39')]===_0x9168('0x2f')?_0x9168('0x30'):_0x9168('0x8b');})['compact']()['value']();for(var _0x94166c=0x0;_0x94166c<_0x5268bc[_0x9168('0x4b')];_0x94166c++){if(!_[_0x9168('0x36')](_0x2a459e,_0x5268bc[_0x94166c]['role']))return;var _0x1f36bc=_0x5268bc[_0x94166c][_0x9168('0x37')]===_0x9168('0x30')?'Agents':_0x9168('0x31');_0x55cc91[_0x9168('0x47')](db['UserProfileResource'][_0x9168('0x7e')]({'name':_0x5268bc[_0x94166c][_0x9168('0x39')],'resourceId':_0x5268bc[_0x94166c]['id'],'type':_0x1f36bc,'sectionId':_[_0x9168('0x38')](_0x1790a7,[_0x9168('0x39'),_0x1f36bc])['id']},{}));}return BPromise[_0x9168('0x5d')](_0x55cc91);});})[_0x9168('0x16')](respondWithResult(_0x305452,0xc9))[_0x9168('0x1f')](handleError(_0x305452,null));};exports[_0x9168('0x8d')]=function(_0x4ca8e0,_0x1af2f8){if(_0x4ca8e0[_0x9168('0x5f')]['id']){delete _0x4ca8e0['body']['id'];}return db['User'][_0x9168('0x38')]({'where':{'id':_0x4ca8e0[_0x9168('0x53')]['id']}})['then'](function(_0x25f110){if(!_0x25f110)return null;if(_0x25f110['id']===_0x4ca8e0[_0x9168('0x2e')]['id']){if(!_0x4ca8e0['body'][_0x9168('0x8e')]||!_0x4ca8e0[_0x9168('0x5f')][_0x9168('0x8f')]){throw new db[(_0x9168('0x90'))]['ValidationError'](_0x9168('0x91'));}if(!_0x25f110[_0x9168('0x92')](_0x4ca8e0['body'][_0x9168('0x8e')])){throw new db['Sequelize'][(_0x9168('0x93'))](_0x9168('0x94'));}if(_0x4ca8e0[_0x9168('0x5f')]['oldPassword']===_0x4ca8e0[_0x9168('0x5f')]['newPassword']){throw new db['Sequelize'][(_0x9168('0x93'))](_0x9168('0x95'));}}else if(_0x4ca8e0['user'][_0x9168('0x37')]===_0x9168('0x2d')){if(!_0x4ca8e0['body'][_0x9168('0x8f')]){throw new db[(_0x9168('0x90'))][(_0x9168('0x93'))](_0x9168('0x96'));}}else if(_0x4ca8e0[_0x9168('0x2e')][_0x9168('0x37')]===_0x9168('0x2e')){if(!_0x4ca8e0[_0x9168('0x5f')][_0x9168('0x8f')]){throw new db[(_0x9168('0x90'))][(_0x9168('0x93'))](_0x9168('0x96'));}if(_0x25f110[_0x9168('0x37')]!==_0x9168('0x30')){throw new db['Sequelize'][(_0x9168('0x93'))](_0x9168('0x7f'));}}else{throw new db[(_0x9168('0x90'))][(_0x9168('0x93'))](_0x9168('0x7f'));}return _0x25f110;})[_0x9168('0x16')](handleEntityNotFound(_0x1af2f8,null))[_0x9168('0x16')](function(_0x12c881){return db[_0x9168('0x64')]['findOne']({'attributes':['id',_0x9168('0x66'),_0x9168('0x97'),_0x9168('0x98')]})[_0x9168('0x16')](function(_0x4af912){if(_0x4af912[_0x9168('0x66')])authService[_0x9168('0x67')](_0x4ca8e0['body'][_0x9168('0x8f')]);if(!_0x4af912['enforcePasswordHistory']||!_0x12c881[_0x9168('0x99')])return _0x12c881;authService['validatePasswordHistory'](_0x4ca8e0[_0x9168('0x5f')][_0x9168('0x8f')],_0x12c881[_0x9168('0x99')],_0x4af912[_0x9168('0x98')]);return _0x12c881;})['then'](saveUpdates({'password':_0x4ca8e0[_0x9168('0x5f')][_0x9168('0x8f')],'passwordResetAt':_0x4ca8e0[_0x9168('0x2e')]['id']==_0x4ca8e0[_0x9168('0x53')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4ca8e0['body'][_0x9168('0x8f')],_0x12c881[_0x9168('0x99')])},null));})[_0x9168('0x16')](respondWithResult(_0x1af2f8,null))['catch'](handleError(_0x1af2f8,null));};exports[_0x9168('0x9a')]=function(_0x4f4a0b,_0xb5144d){var _0x2ae6d9=_0x4f4a0b[_0x9168('0x5f')][_0x9168('0x9b')];return db['User'][_0x9168('0x38')]({'where':{'id':_0x4f4a0b[_0x9168('0x53')]['id']},'attributes':['id',_0x9168('0x39'),_0x9168('0x37'),_0x9168('0x9c'),'loginInPause',_0x9168('0x9d'),_0x9168('0x9e')]})[_0x9168('0x16')](handleEntityNotFound(_0xb5144d,null))[_0x9168('0x16')](function(_0x4c02bb){if(_0x4c02bb){if(!utils[_0x9168('0x9f')](_0x2ae6d9)){throw new db[(_0x9168('0x90'))][(_0x9168('0x93'))]('Unknown\x20channel');}return _0x4c02bb[_0x9168('0xa0')+_[_0x9168('0xa1')](_0x2ae6d9['toLowerCase']())+_0x9168('0xa2')](_0x4f4a0b['body'][_0x9168('0x62')],{'penalty':_0x4f4a0b[_0x9168('0x5f')]['penalty']||0x0})[_0x9168('0xa3')](function(_0x31aabf){for(var _0x59fc27=0x0;_0x59fc27<_0x4f4a0b[_0x9168('0x5f')][_0x9168('0x62')][_0x9168('0x4b')];_0x59fc27+=0x1){var _0x339507={'UserId':Number(_0x4f4a0b['params']['id'])};_0x339507[_[_0x9168('0xa1')](_0x2ae6d9[_0x9168('0xa4')]())+_0x9168('0xa5')]=Number(_0x4f4a0b['body'][_0x9168('0x62')][_0x59fc27]);socket['emit'](_0x9168('0x2e')+_[_0x9168('0xa1')](_0x2ae6d9[_0x9168('0xa4')]())+_0x9168('0xa6'),_0x339507);}return _0x31aabf;})['then'](function(){if(_0x2ae6d9===_0x9168('0xa7')){return db['VoiceQueue'][_0x9168('0x48')]({'where':{'id':_0x4f4a0b[_0x9168('0x5f')][_0x9168('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x9168('0x16')](function(_0x2cc5ef){var _0x40f3e4=_0x4c02bb[_0x9168('0x2c')]({'plain':!![]});var _0x178c88=[];if(_0x2ae6d9===_0x9168('0xa7')&&_0x40f3e4[_0x9168('0x37')]===_0x9168('0x30')&&_0x40f3e4[_0x9168('0x9c')]){for(var _0x13fffe=0x0;_0x13fffe<_0x2cc5ef[_0x9168('0x4b')];_0x13fffe+=0x1){_0x178c88[_0x9168('0x47')]({'membername':_0x40f3e4[_0x9168('0x39')],'UserId':_0x40f3e4['id'],'queue_name':_0x2cc5ef[_0x13fffe]['name'],'VoiceQueueId':_0x2cc5ef[_0x13fffe]['id'],'interface':_[_0x9168('0x68')](_0x40f3e4['interface'])?util['format']('SIP/%s',_0x40f3e4[_0x9168('0x39')]):_0x40f3e4[_0x9168('0x9e')],'paused':_0x40f3e4['voicePause']||![],'penalty':_0x4f4a0b['body'][_0x9168('0xa8')]||0x0});}return BPromise['each'](_0x178c88,function(_0x21734c){return db[_0x9168('0xa9')][_0x9168('0xaa')](_0x21734c);});}return _0x4c02bb;});}})['then'](respondWithStatusCode(_0xb5144d,null))['catch'](handleError(_0xb5144d,null));};exports[_0x9168('0xab')]=function(_0x357f8f,_0xeab1c7){var _0x284d42,_0x27afbc;return db['User'][_0x9168('0x38')]({'where':{'id':_0x357f8f[_0x9168('0x53')]['id']},'attributes':['id',_0x9168('0x39'),_0x9168('0x37')]})[_0x9168('0x16')](handleEntityNotFound(_0xeab1c7,null))['then'](function(_0x13a719){if(_0x13a719){_0x284d42=_0x13a719;if(!_0x357f8f[_0x9168('0x44')][_0x9168('0x9b')]||!utils['isValidChannel'](_0x357f8f[_0x9168('0x44')][_0x9168('0x9b')])){throw new db['Sequelize'][(_0x9168('0x93'))]('Unknown\x20channel');}return _0x13a719[_0x9168('0xac')+_[_0x9168('0xa1')](_0x357f8f[_0x9168('0x44')][_0x9168('0x9b')]['toLowerCase']())+'Queues'](_0x357f8f[_0x9168('0x44')][_0x9168('0x62')]);}})[_0x9168('0x16')](function(_0x5dd793){if(_[_0x9168('0xad')](_0x357f8f['query'][_0x9168('0x62')])){for(var _0x1f877f=0x0;_0x1f877f<_0x357f8f[_0x9168('0x44')][_0x9168('0x62')]['length'];_0x1f877f+=0x1){_0x27afbc={'UserId':Number(_0x357f8f[_0x9168('0x53')]['id'])};_0x27afbc[_[_0x9168('0xa1')](_0x357f8f[_0x9168('0x44')]['channel'][_0x9168('0xa4')]())+_0x9168('0xa5')]=Number(_0x357f8f[_0x9168('0x44')][_0x9168('0x62')][_0x1f877f]);socket[_0x9168('0xae')]('user'+_[_0x9168('0xa1')](_0x357f8f[_0x9168('0x44')][_0x9168('0x9b')][_0x9168('0xa4')]())+'Queue:remove',_0x27afbc);}}else{_0x27afbc={'UserId':Number(_0x357f8f[_0x9168('0x53')]['id'])};_0x27afbc[_[_0x9168('0xa1')](_0x357f8f[_0x9168('0x44')][_0x9168('0x9b')][_0x9168('0xa4')]())+'QueueId']=Number(_0x357f8f[_0x9168('0x44')][_0x9168('0x62')]);socket[_0x9168('0xae')]('user'+_['capitalize'](_0x357f8f[_0x9168('0x44')]['channel'][_0x9168('0xa4')]())+'Queue:remove',_0x27afbc);}return _0x5dd793;})['then'](function(){if(_0x357f8f[_0x9168('0x44')][_0x9168('0x9b')]==='voice'){return db[_0x9168('0xa9')][_0x9168('0x2b')]({'where':{'UserId':_0x357f8f[_0x9168('0x53')]['id'],'VoiceQueueId':_0x357f8f[_0x9168('0x44')][_0x9168('0x62')]},'individualHooks':!![]})[_0x9168('0x16')](function(){return _0x284d42;});}return _0x284d42;})['then'](respondWithStatusCode(_0xeab1c7,null))['catch'](handleError(_0xeab1c7,null));};exports['addAvatar']=function(_0x141aa1,_0x1b1711){_0x141aa1['body'][_0x9168('0xaf')]=_0x141aa1[_0x9168('0xb0')]['filename'];return db['User']['find']({'where':{'id':_0x141aa1[_0x9168('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b1711,null))[_0x9168('0x16')](saveUpdates(_0x141aa1[_0x9168('0x5f')],null))[_0x9168('0x16')](respondWithResult(_0x1b1711,null))['catch'](handleError(_0x1b1711,null));};exports[_0x9168('0xb1')]=function(_0xf2d37d,_0x2c0551){var _0x484b82=path[_0x9168('0xb2')](config[_0x9168('0xb3')],_0x9168('0xb4'));return db[_0x9168('0x3c')][_0x9168('0x38')]({'where':{'id':_0xf2d37d[_0x9168('0x53')]['id']},'attributes':['id',_0x9168('0xaf')],'raw':!![]})['then'](handleEntityNotFound(_0x2c0551,null))[_0x9168('0x16')](function(_0x1112f9){if(_0x1112f9){if(_[_0x9168('0x68')](_0x1112f9[_0x9168('0xaf')])){return _0x2c0551['download'](_0x484b82);}else{if(!fs[_0x9168('0xb5')](path[_0x9168('0xb2')](config['root'],_0x9168('0xb6'),_0x1112f9[_0x9168('0xaf')]))){return _0x2c0551[_0x9168('0xb7')](_0x484b82);}return _0x2c0551[_0x9168('0xb7')](path[_0x9168('0xb2')](config[_0x9168('0xb3')],_0x9168('0xb6'),_0x1112f9[_0x9168('0xaf')]));}}})['catch'](handleError(_0x2c0551,null));};exports[_0x9168('0xb8')]=function(_0xb099f8,_0x44c587){return db[_0x9168('0x3c')][_0x9168('0x38')]({'where':{'id':_0xb099f8[_0x9168('0x53')]['id']},'attributes':['id']})[_0x9168('0x16')](handleEntityNotFound(_0x44c587,null))[_0x9168('0x16')](function(_0x4468cb){var _0xb9b52c=[];values=_0x4468cb[_0x9168('0x4e')];_0xb9b52c['push'](get_open_tabs('chat',_0x4468cb[_0x9168('0x4e')]));_0xb9b52c[_0x9168('0x47')](get_open_tabs(_0x9168('0x4f'),_0x4468cb['dataValues']));_0xb9b52c[_0x9168('0x47')](get_open_tabs(_0x9168('0x51'),_0x4468cb[_0x9168('0x4e')]));_0xb9b52c['push'](get_open_tabs(_0x9168('0x52'),_0x4468cb[_0x9168('0x4e')]));_0xb9b52c['push'](get_open_tabs(_0x9168('0xb9'),_0x4468cb[_0x9168('0x4e')]));_0xb9b52c[_0x9168('0x47')](get_open_tabs(_0x9168('0x50'),_0x4468cb[_0x9168('0x4e')]));return BPromise['all'](_0xb9b52c);})[_0x9168('0x16')](function(_0x98851d){if(_0x98851d){var _0x485111=_[_0x9168('0x34')](values[_0x9168('0xba')],function(_0x29cafb){return{'channel':'CHAT','id':_0x29cafb['id'],'createdAt':_0x29cafb[_0x9168('0xbb')]};});var _0x1ef4df=_[_0x9168('0x34')](values['FaxOpenTabs'],function(_0xf90956){return{'channel':_0x9168('0xbc'),'id':_0xf90956['id'],'createdAt':_0xf90956[_0x9168('0xbb')]};});var _0x511fac=_[_0x9168('0x34')](values[_0x9168('0xbd')],function(_0xc9a5d3){return{'channel':_0x9168('0xbe'),'id':_0xc9a5d3['id'],'createdAt':_0xc9a5d3['createdAt']};});var _0x529b84=_[_0x9168('0x34')](values['MailOpenTabs'],function(_0x33a6d3){return{'channel':'MAIL','id':_0x33a6d3['id'],'createdAt':_0x33a6d3['createdAt']};});var _0x5f4541=_[_0x9168('0x34')](values[_0x9168('0xbf')],function(_0x480176){return{'channel':'SMS','id':_0x480176['id'],'createdAt':_0x480176[_0x9168('0xbb')]};});var _0x2522f7=_[_0x9168('0x34')](values[_0x9168('0xc0')],function(_0x55e62d){return{'channel':_0x9168('0xc1'),'id':_0x55e62d['id'],'createdAt':_0x55e62d['createdAt']};});var _0x2631b9=_[_0x9168('0xc2')](_0x485111,_0x1ef4df,_0x511fac,_0x529b84,_0x5f4541,_0x2522f7);var _0x184747={'count':_0x2631b9[_0x9168('0x4b')],'rows':_0x2631b9};return _0x184747;}else return null;})[_0x9168('0x16')](respondWithResult(_0x44c587,null))[_0x9168('0x1f')](handleError(_0x44c587,null));};exports['getContacts']=function(_0x53e2f3,_0x517940){var _0x311c59={};var _0x4b8040={};var _0x35464f;var _0xacb1b5;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x53e2f3[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x517940,null))[_0x9168('0x16')](function(_0x3c957e){if(_0x3c957e){_0x35464f=_0x3c957e;_0x4b8040['model']=_[_0x9168('0x56')](db[_0x9168('0xc4')][_0x9168('0x3d')]);_0x4b8040['query']=_[_0x9168('0x56')](_0x53e2f3['query']);_0x4b8040[_0x9168('0x57')]=_[_0x9168('0x58')](_0x4b8040[_0x9168('0x54')],_0x4b8040[_0x9168('0x44')]);_0x311c59[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x4b8040[_0x9168('0x54')],qs[_0x9168('0x59')](_0x53e2f3[_0x9168('0x44')][_0x9168('0x59')]));_0x311c59['attributes']=_0x311c59[_0x9168('0x5a')]['length']?_0x311c59['attributes']:_0x4b8040['model'];_0x311c59[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x53e2f3[_0x9168('0x44')][_0x9168('0xc6')]);_0x311c59[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x53e2f3[_0x9168('0x44')],_0x4b8040['filters']));if(_0x53e2f3['query'][_0x9168('0x32')]){_0x311c59[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x311c59['where'],{'$or':_[_0x9168('0x34')](_0x311c59[_0x9168('0x5a')],function(_0x565ff9){var _0x541a46={};_0x541a46[_0x565ff9]={'$like':'%'+_0x53e2f3[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0x541a46;})});}_0x311c59=_[_0x9168('0xc8')]({},_0x311c59,_0x53e2f3[_0x9168('0x5c')]);return _0x35464f[_0x9168('0xc9')](_0x311c59);}})[_0x9168('0x16')](function(_0x3662b9){if(_0x3662b9){_0xacb1b5=_0x3662b9[_0x9168('0x4b')];if(_0x53e2f3['query'][_0x9168('0xca')](_0x9168('0x5b'))){_0x311c59[_0x9168('0x43')]=[{'model':db[_0x9168('0xcb')],'as':_0x9168('0xcc'),'required':![]},{'model':db[_0x9168('0xcd')],'as':_0x9168('0xce'),'attributes':['id',_0x9168('0x39'),_0x9168('0xcf')],'where':_0x53e2f3['query'][_0x9168('0xd0')]?{'id':_0x53e2f3['query']['tag']}:undefined,'required':_0x53e2f3[_0x9168('0x44')][_0x9168('0xd0')]?!![]:![]}];}if(!_0x53e2f3[_0x9168('0x44')]['hasOwnProperty']('nolimit')){_0x311c59[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x53e2f3[_0x9168('0x44')][_0x9168('0x26')]);_0x311c59[_0x9168('0x24')]=qs['offset'](_0x53e2f3[_0x9168('0x44')][_0x9168('0x24')]);}return _0x35464f[_0x9168('0xc9')](_0x311c59);}})[_0x9168('0x16')](function(_0x1de506){if(_0x1de506){return _0x1de506?{'count':_0xacb1b5,'rows':_0x1de506}:null;}})['then'](respondWithResult(_0x517940,null))['catch'](handleError(_0x517940,null));};exports[_0x9168('0xd1')]=function(_0x551a31,_0x2f36d1){var _0x369d10;var _0x22d2d5={};var _0x1fcd5e;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x551a31[_0x9168('0x53')]['id']},'attributes':['id',_0x9168('0x39'),'role']})['then'](handleEntityNotFound(_0x2f36d1,null))[_0x9168('0x16')](function(_0x55a957){if(!utils[_0x9168('0x9f')](_0x551a31['query'][_0x9168('0x9b')])){throw new db[(_0x9168('0x90'))][(_0x9168('0x93'))](_0x9168('0xd2'));}_0x369d10=_0x55a957;var _0x338a9f={};_0x338a9f['model']=_['keys'](db[_[_0x9168('0xa1')](_0x551a31[_0x9168('0x44')]['channel'])+_0x9168('0xd3')][_0x9168('0x3d')]);_0x338a9f['query']=_['keys'](_0x551a31[_0x9168('0x44')]);_0x338a9f['filters']=_[_0x9168('0x58')](_0x338a9f[_0x9168('0x54')],_0x338a9f[_0x9168('0x44')]);_0x22d2d5[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x338a9f[_0x9168('0x54')],qs[_0x9168('0x59')](_0x551a31[_0x9168('0x44')]['fields']));_0x22d2d5[_0x9168('0x5a')]=_0x22d2d5[_0x9168('0x5a')][_0x9168('0x4b')]?_0x22d2d5['attributes']:_0x338a9f[_0x9168('0x54')];_0x22d2d5['order']=qs['sort'](_0x551a31[_0x9168('0x44')][_0x9168('0xc6')]);_0x22d2d5[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x551a31[_0x9168('0x44')],_0x338a9f[_0x9168('0x57')]));if(_0x551a31[_0x9168('0x44')]['filter']){_0x22d2d5[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x22d2d5[_0x9168('0x42')],{'$or':_[_0x9168('0x34')](_0x22d2d5['attributes'],function(_0x4ffa58){var _0xd86b3c={};_0xd86b3c[_0x4ffa58]={'$like':'%'+_0x551a31[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0xd86b3c;})});}_0x22d2d5=_[_0x9168('0xc8')]({},_0x22d2d5,_0x551a31[_0x9168('0x5c')]);switch(_0x369d10['role']){case _0x9168('0x2d'):return db[_[_0x9168('0xa1')](_0x551a31[_0x9168('0x44')][_0x9168('0x9b')])+'Queue'][_0x9168('0x48')](_0x22d2d5);case _0x9168('0x2e'):case'agent':return _0x369d10[_0x9168('0x2c')+_[_0x9168('0xa1')](_0x551a31['query'][_0x9168('0x9b')])+_0x9168('0xa2')](_0x22d2d5);default:throw new db['Sequelize'][(_0x9168('0x93'))]('Unknown\x20role');}})['then'](function(_0xf9fc10){_0x1fcd5e=_0xf9fc10[_0x9168('0x4b')];if(!_0x551a31[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0x22d2d5[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x551a31[_0x9168('0x44')]['limit']);_0x22d2d5[_0x9168('0x24')]=qs[_0x9168('0x24')](_0x551a31[_0x9168('0x44')][_0x9168('0x24')]);}switch(_0x369d10[_0x9168('0x37')]){case'admin':return db[_[_0x9168('0xa1')](_0x551a31['query'][_0x9168('0x9b')])+_0x9168('0xd3')][_0x9168('0x48')](_0x22d2d5);case _0x9168('0x2e'):case _0x9168('0x30'):return _0x369d10['get'+_['capitalize'](_0x551a31[_0x9168('0x44')][_0x9168('0x9b')])+_0x9168('0xa2')](_0x22d2d5);}})['then'](function(_0x2b3cf7){return{'count':_0x1fcd5e,'rows':_0x2b3cf7};})['then'](respondWithResult(_0x2f36d1,null))[_0x9168('0x1f')](handleError(_0x2f36d1,null));};exports[_0x9168('0xd5')]=function(_0x1ed742,_0x36adec){var _0x16aa7d={};var _0x50a717={};var _0x191d8e;var _0x333a0a;return db[_0x9168('0x3c')]['findOne']({'where':{'id':_0x1ed742['params']['id']}})['then'](handleEntityNotFound(_0x36adec,null))[_0x9168('0x16')](function(_0x51cdda){if(_0x51cdda){_0x191d8e=_0x51cdda;_0x50a717[_0x9168('0x54')]=_[_0x9168('0x56')](db[_0x9168('0xa9')][_0x9168('0x3d')]);_0x50a717[_0x9168('0x44')]=_[_0x9168('0x56')](_0x1ed742[_0x9168('0x44')]);_0x50a717[_0x9168('0x57')]=_[_0x9168('0x58')](_0x50a717[_0x9168('0x54')],_0x50a717[_0x9168('0x44')]);_0x16aa7d[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x50a717[_0x9168('0x54')],qs[_0x9168('0x59')](_0x1ed742[_0x9168('0x44')][_0x9168('0x59')]));_0x16aa7d['attributes']=_0x16aa7d[_0x9168('0x5a')]['length']?_0x16aa7d[_0x9168('0x5a')]:_0x50a717['model'];_0x16aa7d[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x1ed742[_0x9168('0x44')][_0x9168('0xc6')]);_0x16aa7d[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x1ed742[_0x9168('0x44')],_0x50a717[_0x9168('0x57')]));if(_0x1ed742[_0x9168('0x44')][_0x9168('0x32')]){_0x16aa7d['where']=_[_0x9168('0xc8')](_0x16aa7d[_0x9168('0x42')],{'$or':_['map'](_0x16aa7d['attributes'],function(_0x1e53f4){var _0x59bfe8={};_0x59bfe8[_0x1e53f4]={'$like':'%'+_0x1ed742[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0x59bfe8;})});}_0x16aa7d=_[_0x9168('0xc8')]({},_0x16aa7d,_0x1ed742[_0x9168('0x5c')]);return _0x191d8e[_0x9168('0xd5')](_0x16aa7d);}})['then'](function(_0x8b0d72){if(_0x8b0d72){_0x333a0a=_0x8b0d72[_0x9168('0x4b')];if(!_0x1ed742[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0x16aa7d['limit']=qs[_0x9168('0x26')](_0x1ed742[_0x9168('0x44')][_0x9168('0x26')]);_0x16aa7d[_0x9168('0x24')]=qs[_0x9168('0x24')](_0x1ed742[_0x9168('0x44')][_0x9168('0x24')]);}return _0x191d8e[_0x9168('0xd5')](_0x16aa7d);}})['then'](function(_0x41c1e5){if(_0x41c1e5){return _0x41c1e5?{'count':_0x333a0a,'rows':_0x41c1e5}:null;}})[_0x9168('0x16')](respondWithResult(_0x36adec,null))[_0x9168('0x1f')](handleError(_0x36adec,null));};exports[_0x9168('0xd6')]=function(_0x471331,_0x5b9255){var _0xf99be7={};var _0x4110a8={};var _0x5079a7;var _0x91d4df;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x471331[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x5b9255,null))[_0x9168('0x16')](function(_0x4c5f2d){if(_0x4c5f2d){_0x5079a7=_0x4c5f2d;_0x4110a8[_0x9168('0x54')]=_['keys'](db['ChatGroup'][_0x9168('0x3d')]);_0x4110a8['query']=_[_0x9168('0x56')](_0x471331[_0x9168('0x44')]);_0x4110a8[_0x9168('0x57')]=_['intersection'](_0x4110a8[_0x9168('0x54')],_0x4110a8['query']);_0xf99be7[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x4110a8[_0x9168('0x54')],qs[_0x9168('0x59')](_0x471331[_0x9168('0x44')][_0x9168('0x59')]));_0xf99be7['attributes']=_0xf99be7[_0x9168('0x5a')][_0x9168('0x4b')]?_0xf99be7[_0x9168('0x5a')]:_0x4110a8[_0x9168('0x54')];_0xf99be7[_0x9168('0xc5')]=qs['sort'](_0x471331[_0x9168('0x44')][_0x9168('0xc6')]);_0xf99be7['where']=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x471331[_0x9168('0x44')],_0x4110a8[_0x9168('0x57')]));if(_0x471331[_0x9168('0x44')]['filter']){_0xf99be7['where']=_[_0x9168('0xc8')](_0xf99be7[_0x9168('0x42')],{'$or':_['map'](_0xf99be7[_0x9168('0x5a')],function(_0xaecf49){var _0x25c61d={};_0x25c61d[_0xaecf49]={'$like':'%'+_0x471331[_0x9168('0x44')]['filter']+'%'};return _0x25c61d;})});}_0xf99be7=_[_0x9168('0xc8')]({},_0xf99be7,_0x471331['options']);return _0x5079a7[_0x9168('0xd6')](_0xf99be7);}})[_0x9168('0x16')](function(_0x34cdd3){if(_0x34cdd3){_0x91d4df=_0x34cdd3[_0x9168('0x4b')];if(!_0x471331[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0xf99be7[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x471331[_0x9168('0x44')][_0x9168('0x26')]);_0xf99be7[_0x9168('0x24')]=qs[_0x9168('0x24')](_0x471331['query']['offset']);}return _0x5079a7[_0x9168('0xd6')](_0xf99be7);}})[_0x9168('0x16')](function(_0x405b31){if(_0x405b31){return _0x405b31?{'count':_0x91d4df,'rows':_0x405b31}:null;}})[_0x9168('0x16')](respondWithResult(_0x5b9255,null))['catch'](handleError(_0x5b9255,null));};exports[_0x9168('0xd7')]=function(_0x2e0a15,_0x1dfd83){var _0x35dba1={'raw':!![],'where':{}};var _0x4801e0={};var _0x2c762c={'count':0x0,'rows':[]};return db[_0x9168('0x3c')]['findOne']({'where':{'id':_0x2e0a15[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x1dfd83,null))[_0x9168('0x16')](function(_0x3060d8){if(_0x3060d8){_0x4801e0[_0x9168('0x54')]=_[_0x9168('0x56')](db['VoiceRecording'][_0x9168('0x3d')]);_0x4801e0['query']=_[_0x9168('0x56')](_0x2e0a15[_0x9168('0x44')]);_0x4801e0[_0x9168('0x57')]=_[_0x9168('0x58')](_0x4801e0[_0x9168('0x54')],_0x4801e0[_0x9168('0x44')]);_0x35dba1[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x4801e0[_0x9168('0x54')],qs['fields'](_0x2e0a15['query'][_0x9168('0x59')]));_0x35dba1[_0x9168('0x5a')]=_0x35dba1[_0x9168('0x5a')][_0x9168('0x4b')]?_0x35dba1[_0x9168('0x5a')]:_0x4801e0[_0x9168('0x54')];if(!_0x2e0a15[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0x35dba1[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x2e0a15['query'][_0x9168('0x26')]);_0x35dba1[_0x9168('0x24')]=qs[_0x9168('0x24')](_0x2e0a15[_0x9168('0x44')]['offset']);}_0x35dba1[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x2e0a15['query']['sort']);_0x35dba1[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x2e0a15['query'],_0x4801e0[_0x9168('0x57')]));_0x35dba1[_0x9168('0x42')]['UserId']=_0x3060d8['id'];if(_0x2e0a15[_0x9168('0x44')][_0x9168('0x32')]){_0x35dba1[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x35dba1['where'],{'$or':_['map'](_0x35dba1[_0x9168('0x5a')],function(_0x5b92e7){var _0x284898={};_0x284898[_0x5b92e7]={'$like':'%'+_0x2e0a15[_0x9168('0x44')]['filter']+'%'};return _0x284898;})});}_0x35dba1=_[_0x9168('0xc8')]({},_0x35dba1,_0x2e0a15['options']);return db[_0x9168('0xd8')][_0x9168('0x27')]({'where':_0x35dba1[_0x9168('0x42')]})[_0x9168('0x16')](function(_0x3787de){_0x2c762c[_0x9168('0x27')]=_0x3787de;if(_0x2e0a15[_0x9168('0x44')]['includeAll']){_0x35dba1[_0x9168('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x9168('0x48')](_0x35dba1);})['then'](function(_0x1a44f6){_0x2c762c[_0x9168('0x4d')]=_0x1a44f6;return _0x2c762c;});}})[_0x9168('0x16')](respondWithFilteredResult(_0x1dfd83,_0x35dba1))[_0x9168('0x1f')](handleError(_0x1dfd83,null));};exports[_0x9168('0xd9')]=function(_0x1b8f59,_0x5e81ae){var _0x1deb29={'raw':!![],'where':{}};var _0x64426d={};var _0x143d96={'count':0x0,'rows':[]};return db['User'][_0x9168('0xc3')]({'where':{'id':_0x1b8f59[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x5e81ae,null))[_0x9168('0x16')](function(_0x531563){if(_0x531563){_0x64426d[_0x9168('0x54')]=_[_0x9168('0x56')](db[_0x9168('0xda')][_0x9168('0x3d')]);_0x64426d['query']=_[_0x9168('0x56')](_0x1b8f59[_0x9168('0x44')]);_0x64426d[_0x9168('0x57')]=_[_0x9168('0x58')](_0x64426d[_0x9168('0x54')],_0x64426d[_0x9168('0x44')]);_0x1deb29[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x64426d[_0x9168('0x54')],qs['fields'](_0x1b8f59[_0x9168('0x44')][_0x9168('0x59')]));_0x1deb29['attributes']=_0x1deb29[_0x9168('0x5a')][_0x9168('0x4b')]?_0x1deb29[_0x9168('0x5a')]:_0x64426d['model'];if(!_0x1b8f59[_0x9168('0x44')]['hasOwnProperty'](_0x9168('0xd4'))){_0x1deb29[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x1b8f59['query']['limit']);_0x1deb29['offset']=qs['offset'](_0x1b8f59['query'][_0x9168('0x24')]);}_0x1deb29[_0x9168('0xc5')]=qs['sort'](_0x1b8f59[_0x9168('0x44')][_0x9168('0xc6')]);_0x1deb29[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x1b8f59[_0x9168('0x44')],_0x64426d['filters']));_0x1deb29[_0x9168('0x42')][_0x9168('0xdb')]=_0x531563['id'];if(_0x1b8f59['query'][_0x9168('0x32')]){_0x1deb29[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x1deb29['where'],{'$or':_[_0x9168('0x34')](_0x1deb29[_0x9168('0x5a')],function(_0x49762){var _0x31f147={};_0x31f147[_0x49762]={'$like':'%'+_0x1b8f59[_0x9168('0x44')]['filter']+'%'};return _0x31f147;})});}_0x1deb29=_[_0x9168('0xc8')]({},_0x1deb29,_0x1b8f59['options']);return db[_0x9168('0xda')][_0x9168('0x27')]({'where':_0x1deb29[_0x9168('0x42')]})['then'](function(_0x493040){_0x143d96['count']=_0x493040;if(_0x1b8f59[_0x9168('0x44')][_0x9168('0x5b')]){_0x1deb29[_0x9168('0x43')]=[{'all':!![]}];}return db[_0x9168('0xda')][_0x9168('0x48')](_0x1deb29);})[_0x9168('0x16')](function(_0x33d56f){_0x143d96[_0x9168('0x4d')]=_0x33d56f;return _0x143d96;});}})[_0x9168('0x16')](respondWithFilteredResult(_0x5e81ae,_0x1deb29))[_0x9168('0x1f')](handleError(_0x5e81ae,null));};exports[_0x9168('0xdc')]=function(_0x32ac02,_0x3e6791){var _0x3723de={};var _0x30fb5b={};var _0x3e0087;var _0x34f783;return db[_0x9168('0x3c')]['findOne']({'where':{'id':_0x32ac02[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x3e6791,null))['then'](function(_0x5c801b){if(_0x5c801b){_0x3e0087=_0x5c801b;_0x30fb5b[_0x9168('0x54')]=_[_0x9168('0x56')](db[_0x9168('0xdd')][_0x9168('0x3d')]);_0x30fb5b[_0x9168('0x44')]=_[_0x9168('0x56')](_0x32ac02[_0x9168('0x44')]);_0x30fb5b[_0x9168('0x57')]=_[_0x9168('0x58')](_0x30fb5b[_0x9168('0x54')],_0x30fb5b[_0x9168('0x44')]);_0x3723de[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x30fb5b['model'],qs[_0x9168('0x59')](_0x32ac02['query']['fields']));_0x3723de[_0x9168('0x5a')]=_0x3723de[_0x9168('0x5a')]['length']?_0x3723de['attributes']:_0x30fb5b['model'];_0x3723de[_0x9168('0xc5')]=qs['sort'](_0x32ac02[_0x9168('0x44')][_0x9168('0xc6')]);_0x3723de[_0x9168('0x42')]=qs['filters'](_[_0x9168('0xc7')](_0x32ac02['query'],_0x30fb5b[_0x9168('0x57')]));if(_0x32ac02['query'][_0x9168('0x32')]){_0x3723de[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x3723de[_0x9168('0x42')],{'$or':_['map'](_0x3723de['attributes'],function(_0x163814){var _0x2279e0={};_0x2279e0[_0x163814]={'$like':'%'+_0x32ac02[_0x9168('0x44')]['filter']+'%'};return _0x2279e0;})});}_0x3723de=_[_0x9168('0xc8')]({},_0x3723de,_0x32ac02[_0x9168('0x5c')]);return _0x3e0087[_0x9168('0xdc')](_0x3723de);}})[_0x9168('0x16')](function(_0x584534){if(_0x584534){_0x34f783=_0x584534[_0x9168('0x4b')];if(!_0x32ac02[_0x9168('0x44')][_0x9168('0xca')]('nolimit')){_0x3723de[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x32ac02[_0x9168('0x44')][_0x9168('0x26')]);_0x3723de[_0x9168('0x24')]=qs[_0x9168('0x24')](_0x32ac02[_0x9168('0x44')][_0x9168('0x24')]);}return _0x3e0087[_0x9168('0xdc')](_0x3723de);}})[_0x9168('0x16')](function(_0x84c339){if(_0x84c339){return _0x84c339?{'count':_0x34f783,'rows':_0x84c339}:null;}})['then'](respondWithResult(_0x3e6791,null))[_0x9168('0x1f')](handleError(_0x3e6791,null));};exports[_0x9168('0xde')]=function(_0x10194e,_0x4634f2){var _0x2ffcee={};var _0x251b41={};var _0x4676a9;var _0x35e7ce;return db[_0x9168('0x3c')]['findOne']({'where':{'id':_0x10194e[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x4634f2,null))[_0x9168('0x16')](function(_0x13e421){if(_0x13e421){_0x4676a9=_0x13e421;_0x251b41[_0x9168('0x54')]=_[_0x9168('0x56')](db[_0x9168('0xdf')]['rawAttributes']);_0x251b41[_0x9168('0x44')]=_[_0x9168('0x56')](_0x10194e[_0x9168('0x44')]);_0x251b41['filters']=_['intersection'](_0x251b41[_0x9168('0x54')],_0x251b41[_0x9168('0x44')]);_0x2ffcee[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x251b41[_0x9168('0x54')],qs[_0x9168('0x59')](_0x10194e[_0x9168('0x44')][_0x9168('0x59')]));_0x2ffcee[_0x9168('0x5a')]=_0x2ffcee[_0x9168('0x5a')][_0x9168('0x4b')]?_0x2ffcee[_0x9168('0x5a')]:_0x251b41['model'];_0x2ffcee['order']=qs[_0x9168('0xc6')](_0x10194e[_0x9168('0x44')][_0x9168('0xc6')]);_0x2ffcee[_0x9168('0x42')]=qs['filters'](_[_0x9168('0xc7')](_0x10194e[_0x9168('0x44')],_0x251b41[_0x9168('0x57')]));if(_0x10194e[_0x9168('0x44')]['filter']){_0x2ffcee[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x2ffcee['where'],{'$or':_[_0x9168('0x34')](_0x2ffcee[_0x9168('0x5a')],function(_0x176252){var _0x411b16={};_0x411b16[_0x176252]={'$like':'%'+_0x10194e[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0x411b16;})});}_0x2ffcee=_[_0x9168('0xc8')]({},_0x2ffcee,_0x10194e['options']);return _0x4676a9[_0x9168('0xde')](_0x2ffcee);}})[_0x9168('0x16')](function(_0x562946){if(_0x562946){_0x35e7ce=_0x562946[_0x9168('0x4b')];if(!_0x10194e[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0x2ffcee[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x10194e[_0x9168('0x44')][_0x9168('0x26')]);_0x2ffcee[_0x9168('0x24')]=qs['offset'](_0x10194e[_0x9168('0x44')]['offset']);}return _0x4676a9[_0x9168('0xde')](_0x2ffcee);}})[_0x9168('0x16')](function(_0x4f5aab){if(_0x4f5aab){return _0x4f5aab?{'count':_0x35e7ce,'rows':_0x4f5aab}:null;}})[_0x9168('0x16')](respondWithResult(_0x4634f2,null))[_0x9168('0x1f')](handleError(_0x4634f2,null));};exports[_0x9168('0xe0')]=function(_0x5f44db,_0xd36691){var _0x21f687={'raw':!![],'where':{}};var _0x49db8d={};var _0x5d5df0={'count':0x0,'rows':[]};return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x5f44db[_0x9168('0x53')]['id']}})['then'](handleEntityNotFound(_0xd36691,null))[_0x9168('0x16')](function(_0x40bf0e){if(_0x40bf0e){_0x49db8d[_0x9168('0x54')]=_[_0x9168('0x56')](db['MailInteraction'][_0x9168('0x3d')]);_0x49db8d[_0x9168('0x44')]=_[_0x9168('0x56')](_0x5f44db['query']);_0x49db8d[_0x9168('0x57')]=_['intersection'](_0x49db8d[_0x9168('0x54')],_0x49db8d[_0x9168('0x44')]);_0x21f687[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x49db8d[_0x9168('0x54')],qs['fields'](_0x5f44db[_0x9168('0x44')][_0x9168('0x59')]));_0x21f687[_0x9168('0x5a')]=_0x21f687[_0x9168('0x5a')][_0x9168('0x4b')]?_0x21f687[_0x9168('0x5a')]:_0x49db8d['model'];if(!_0x5f44db[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0x21f687['limit']=qs[_0x9168('0x26')](_0x5f44db[_0x9168('0x44')][_0x9168('0x26')]);_0x21f687[_0x9168('0x24')]=qs[_0x9168('0x24')](_0x5f44db['query'][_0x9168('0x24')]);}_0x21f687[_0x9168('0xc5')]=qs['sort'](_0x5f44db[_0x9168('0x44')]['sort']);_0x21f687['where']=qs['filters'](_[_0x9168('0xc7')](_0x5f44db[_0x9168('0x44')],_0x49db8d[_0x9168('0x57')]));_0x21f687[_0x9168('0x42')][_0x9168('0xdb')]=_0x40bf0e['id'];if(_0x5f44db[_0x9168('0x44')]['filter']){_0x21f687[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x21f687[_0x9168('0x42')],{'$or':_['map'](_0x21f687[_0x9168('0x5a')],function(_0x4363ba){var _0x53c24d={};_0x53c24d[_0x4363ba]={'$like':'%'+_0x5f44db['query']['filter']+'%'};return _0x53c24d;})});}_0x21f687=_['merge']({},_0x21f687,_0x5f44db[_0x9168('0x5c')]);return db[_0x9168('0xe1')][_0x9168('0x27')]({'where':_0x21f687[_0x9168('0x42')]})[_0x9168('0x16')](function(_0x4861f9){_0x5d5df0[_0x9168('0x27')]=_0x4861f9;if(_0x5f44db[_0x9168('0x44')][_0x9168('0x5b')]){_0x21f687[_0x9168('0x43')]=[{'all':!![]}];}return db[_0x9168('0xe1')][_0x9168('0x48')](_0x21f687);})['then'](function(_0xa9d853){_0x5d5df0['rows']=_0xa9d853;return _0x5d5df0;});}})['then'](respondWithFilteredResult(_0xd36691,_0x21f687))['catch'](handleError(_0xd36691,null));};exports[_0x9168('0xe2')]=function(_0x4de292,_0x20efd2){var _0x14fba1={};var _0x379eb7={};var _0x20237b;var _0xbb6fef;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x4de292[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x20efd2,null))['then'](function(_0x507cd3){if(_0x507cd3){_0x20237b=_0x507cd3;_0x379eb7[_0x9168('0x54')]=_[_0x9168('0x56')](db['SmsInteraction'][_0x9168('0x3d')]);_0x379eb7[_0x9168('0x44')]=_[_0x9168('0x56')](_0x4de292[_0x9168('0x44')]);_0x379eb7[_0x9168('0x57')]=_['intersection'](_0x379eb7['model'],_0x379eb7['query']);_0x14fba1[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x379eb7[_0x9168('0x54')],qs['fields'](_0x4de292[_0x9168('0x44')]['fields']));_0x14fba1[_0x9168('0x5a')]=_0x14fba1[_0x9168('0x5a')][_0x9168('0x4b')]?_0x14fba1[_0x9168('0x5a')]:_0x379eb7[_0x9168('0x54')];_0x14fba1['order']=qs[_0x9168('0xc6')](_0x4de292['query'][_0x9168('0xc6')]);_0x14fba1['where']=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x4de292['query'],_0x379eb7['filters']));if(_0x4de292['query']['filter']){_0x14fba1[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x14fba1[_0x9168('0x42')],{'$or':_[_0x9168('0x34')](_0x14fba1[_0x9168('0x5a')],function(_0x50a596){var _0xbd8b1f={};_0xbd8b1f[_0x50a596]={'$like':'%'+_0x4de292[_0x9168('0x44')]['filter']+'%'};return _0xbd8b1f;})});}_0x14fba1=_[_0x9168('0xc8')]({},_0x14fba1,_0x4de292[_0x9168('0x5c')]);return _0x20237b[_0x9168('0xe2')](_0x14fba1);}})[_0x9168('0x16')](function(_0x287115){if(_0x287115){_0xbb6fef=_0x287115['length'];if(!_0x4de292['query'][_0x9168('0xca')]('nolimit')){_0x14fba1[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x4de292[_0x9168('0x44')][_0x9168('0x26')]);_0x14fba1['offset']=qs['offset'](_0x4de292['query'][_0x9168('0x24')]);}return _0x20237b['getSmsInteractions'](_0x14fba1);}})[_0x9168('0x16')](function(_0x376630){if(_0x376630){return _0x376630?{'count':_0xbb6fef,'rows':_0x376630}:null;}})['then'](respondWithResult(_0x20efd2,null))[_0x9168('0x1f')](handleError(_0x20efd2,null));};exports['getFaxInteractions']=function(_0x3d4fac,_0x2fd97c){var _0x22651e={};var _0x4d2318={};var _0xbe78e7;var _0x2c77c9;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x3d4fac[_0x9168('0x53')]['id']}})['then'](handleEntityNotFound(_0x2fd97c,null))[_0x9168('0x16')](function(_0x171815){if(_0x171815){_0xbe78e7=_0x171815;_0x4d2318['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0x4d2318[_0x9168('0x44')]=_[_0x9168('0x56')](_0x3d4fac[_0x9168('0x44')]);_0x4d2318[_0x9168('0x57')]=_[_0x9168('0x58')](_0x4d2318[_0x9168('0x54')],_0x4d2318[_0x9168('0x44')]);_0x22651e[_0x9168('0x5a')]=_['intersection'](_0x4d2318[_0x9168('0x54')],qs[_0x9168('0x59')](_0x3d4fac[_0x9168('0x44')]['fields']));_0x22651e[_0x9168('0x5a')]=_0x22651e['attributes'][_0x9168('0x4b')]?_0x22651e[_0x9168('0x5a')]:_0x4d2318[_0x9168('0x54')];_0x22651e[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x3d4fac['query'][_0x9168('0xc6')]);_0x22651e[_0x9168('0x42')]=qs[_0x9168('0x57')](_['pick'](_0x3d4fac[_0x9168('0x44')],_0x4d2318[_0x9168('0x57')]));if(_0x3d4fac['query'][_0x9168('0x32')]){_0x22651e[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x22651e[_0x9168('0x42')],{'$or':_[_0x9168('0x34')](_0x22651e[_0x9168('0x5a')],function(_0x478a1b){var _0x8251bd={};_0x8251bd[_0x478a1b]={'$like':'%'+_0x3d4fac['query'][_0x9168('0x32')]+'%'};return _0x8251bd;})});}_0x22651e=_[_0x9168('0xc8')]({},_0x22651e,_0x3d4fac[_0x9168('0x5c')]);return _0xbe78e7[_0x9168('0xe3')](_0x22651e);}})[_0x9168('0x16')](function(_0x1eafa5){if(_0x1eafa5){_0x2c77c9=_0x1eafa5[_0x9168('0x4b')];if(!_0x3d4fac[_0x9168('0x44')][_0x9168('0xca')]('nolimit')){_0x22651e['limit']=qs[_0x9168('0x26')](_0x3d4fac['query']['limit']);_0x22651e[_0x9168('0x24')]=qs['offset'](_0x3d4fac[_0x9168('0x44')][_0x9168('0x24')]);}return _0xbe78e7[_0x9168('0xe3')](_0x22651e);}})[_0x9168('0x16')](function(_0x21a0df){if(_0x21a0df){return _0x21a0df?{'count':_0x2c77c9,'rows':_0x21a0df}:null;}})[_0x9168('0x16')](respondWithResult(_0x2fd97c,null))[_0x9168('0x1f')](handleError(_0x2fd97c,null));};exports[_0x9168('0xe4')]=function(_0x57d184,_0x53c03c){var _0x34b2d3={};var _0x41de59={};var _0x3b082a;var _0x363dbf;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x57d184[_0x9168('0x53')]['id']}})['then'](handleEntityNotFound(_0x53c03c,null))[_0x9168('0x16')](function(_0x437e19){if(_0x437e19){_0x3b082a=_0x437e19;_0x41de59[_0x9168('0x54')]=_[_0x9168('0x56')](db['WhatsappInteraction']['rawAttributes']);_0x41de59[_0x9168('0x44')]=_[_0x9168('0x56')](_0x57d184[_0x9168('0x44')]);_0x41de59[_0x9168('0x57')]=_[_0x9168('0x58')](_0x41de59[_0x9168('0x54')],_0x41de59[_0x9168('0x44')]);_0x34b2d3[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x41de59[_0x9168('0x54')],qs['fields'](_0x57d184['query'][_0x9168('0x59')]));_0x34b2d3['attributes']=_0x34b2d3[_0x9168('0x5a')][_0x9168('0x4b')]?_0x34b2d3['attributes']:_0x41de59[_0x9168('0x54')];_0x34b2d3[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x57d184[_0x9168('0x44')][_0x9168('0xc6')]);_0x34b2d3['where']=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x57d184[_0x9168('0x44')],_0x41de59[_0x9168('0x57')]));if(_0x57d184[_0x9168('0x44')][_0x9168('0x32')]){_0x34b2d3[_0x9168('0x42')]=_[_0x9168('0xc8')](_0x34b2d3[_0x9168('0x42')],{'$or':_[_0x9168('0x34')](_0x34b2d3[_0x9168('0x5a')],function(_0x34fddd){var _0x363d13={};_0x363d13[_0x34fddd]={'$like':'%'+_0x57d184[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0x363d13;})});}_0x34b2d3=_[_0x9168('0xc8')]({},_0x34b2d3,_0x57d184['options']);return _0x3b082a[_0x9168('0xe4')](_0x34b2d3);}})[_0x9168('0x16')](function(_0x200b58){if(_0x200b58){_0x363dbf=_0x200b58[_0x9168('0x4b')];if(!_0x57d184[_0x9168('0x44')][_0x9168('0xca')](_0x9168('0xd4'))){_0x34b2d3['limit']=qs['limit'](_0x57d184[_0x9168('0x44')][_0x9168('0x26')]);_0x34b2d3[_0x9168('0x24')]=qs['offset'](_0x57d184[_0x9168('0x44')][_0x9168('0x24')]);}return _0x3b082a[_0x9168('0xe4')](_0x34b2d3);}})['then'](function(_0x1fc758){if(_0x1fc758){return _0x1fc758?{'count':_0x363dbf,'rows':_0x1fc758}:null;}})[_0x9168('0x16')](respondWithResult(_0x53c03c,null))[_0x9168('0x1f')](handleError(_0x53c03c,null));};exports[_0x9168('0xe5')]=function(_0x1f36a8,_0x153186,_0x1e0519){var _0x5056bc;var _0x3db269;var _0x121769;var _0x438199=!_[_0x9168('0x68')](_0x1f36a8[_0x9168('0x53')]['id'])?_0x1f36a8[_0x9168('0x53')]['id']:!_[_0x9168('0x68')](_0x1f36a8['user']['id'])?_0x1f36a8['user']['id']:null;return db[_0x9168('0x3c')][_0x9168('0x38')]({'where':{'id':_0x438199,'role':{'$or':['admin','user','agent']}},'attributes':['id',_0x9168('0x39'),_0x9168('0xe6'),_0x9168('0xe7'),_0x9168('0x37'),'internal','loginInPause']})['then'](function(_0x3b966a){if(_0x3b966a){if(_0x3b966a[_0x9168('0x37')]===_0x9168('0x30')){_0x5056bc=_0x3b966a;if(_0x1f36a8[_0x9168('0x5f')][_0x9168('0x9e')]){_0x121769=util[_0x9168('0xe8')](_0x9168('0xe9'),_0x5056bc[_0x1f36a8[_0x9168('0x5f')][_0x9168('0x9e')]]);}else if(_0x1f36a8['body']['intrf']){_0x121769=util['format'](_0x9168('0xea'),_0x1f36a8[_0x9168('0x5f')][_0x9168('0xeb')]);}else{_0x121769=util[_0x9168('0xe8')](_0x9168('0xea'),_0x5056bc[_0x9168('0x39')]);}socket['to'](util[_0x9168('0xe8')](_0x9168('0xec'),_0x5056bc[_0x9168('0x39')]))[_0x9168('0xae')](_0x9168('0xed'),{'user':{'id':_0x5056bc['id'],'name':_0x5056bc[_0x9168('0x39')]},'ip':_0x1f36a8['headers'][_0x9168('0xee')]||_0x1f36a8[_0x9168('0xef')]['remoteAddress']||_0x1f36a8['socket'][_0x9168('0xf0')]||_0x1f36a8[_0x9168('0xef')][_0x9168('0xf1')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x9168('0x2b')]({'where':{'membername':_0x5056bc[_0x9168('0x39')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x9168('0x93'))](_0x9168('0xf2'));}})[_0x9168('0x16')](function(){if(_0x5056bc){return _0x5056bc['getVoiceQueues']({'raw':!![]});}})[_0x9168('0x16')](function(_0x3e8427){if(_0x5056bc){var _0x1484f8=[];if(_0x3e8427){_0x3db269=_0x3e8427;if(_0x3db269[_0x9168('0x4b')]){for(var _0x57457b=0x0;_0x57457b<_0x3db269['length'];_0x57457b++){_0x1484f8[_0x9168('0x47')]({'membername':_0x5056bc[_0x9168('0x39')],'UserId':_0x5056bc['id'],'queue_name':_0x3db269[_0x57457b][_0x9168('0x39')],'VoiceQueueId':_0x3db269[_0x57457b]['id'],'interface':_0x121769,'paused':_0x5056bc[_0x9168('0xf3')]||![],'penalty':_0x3db269[_0x57457b][_0x9168('0xf4')]||0x0});}return BPromise[_0x9168('0x8a')](_0x1484f8,function(_0xba70a9){return db[_0x9168('0xa9')]['upsert'](_0xba70a9);});}}}})['then'](function(){if(_0x5056bc){return db[_0x9168('0xf5')][_0x9168('0x48')]({'where':{'membername':_0x5056bc[_0x9168('0x39')],'exitAt':null}});}})[_0x9168('0x16')](function(_0x578c27){if(_0x5056bc){var _0x4fd0a0=[];_0x578c27[_0x9168('0xf6')](function(_0xe37350){_0x4fd0a0[_0x9168('0x47')](_0xe37350[_0x9168('0x5e')]({'exitAt':moment()[_0x9168('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9168('0x5d')](_0x4fd0a0);}})[_0x9168('0x16')](function(){if(_0x5056bc){var _0x1e2d5a=[];var _0x18df4e=[];var _0x3ec4ff=utils['getChannels']();var _0x7c3ef4={'membername':_0x5056bc[_0x9168('0x39')],'interface':_0x121769,'enterAt':moment()[_0x9168('0xe8')](_0x9168('0xf7')),'role':_0x5056bc[_0x9168('0x37')],'internal':_0x5056bc[_0x9168('0x63')]};_0x3ec4ff[_0x9168('0xf6')](function(_0x5a4927){_0x1e2d5a[_0x9168('0x47')](_[_0x9168('0xc8')]({'channel':_0x5a4927,'type':_0x9168('0xf8'),'data1':_0x1f36a8[_0x9168('0x5f')][_0x9168('0xf9')],'data2':_0x121769},_0x7c3ef4));if(_0x5056bc[_0x9168('0xf3')]){_0x18df4e[_0x9168('0x47')](_['merge']({'channel':_0x5a4927,'type':_0x9168('0xfa'),'data1':_0x9168('0xfb')},_0x7c3ef4));}});return db[_0x9168('0xf5')]['bulkCreate'](_0x1e2d5a[_0x9168('0xc2')](_0x18df4e),{'individualHooks':!![]});}})[_0x9168('0x16')](function(){if(_0x5056bc){return _0x5056bc[_0x9168('0x5e')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5056bc[_0x9168('0xf3')]||![],'mailPause':_0x5056bc['loginInPause']||![],'chatPause':_0x5056bc[_0x9168('0xf3')]||![],'faxPause':_0x5056bc[_0x9168('0xf3')]||![],'smsPause':_0x5056bc[_0x9168('0xf3')]||![],'openchannelPause':_0x5056bc['loginInPause']||![],'whatsappPause':_0x5056bc['loginInPause']||![],'pauseType':_0x5056bc[_0x9168('0xf3')]?_0x9168('0xfb'):null,'interface':_0x121769,'lastPauseAt':moment()['format'](_0x9168('0xf7'))});}})['then'](function(_0xa885be){if(_0x1f36a8[_0x9168('0xfc')]){return _0x1e0519();}else{return BPromise['resolve'](_0xa885be)[_0x9168('0x16')](respondWithResult(_0x153186,null));}})[_0x9168('0x1f')](handleError(_0x153186,null));};exports[_0x9168('0xfd')]=function(_0x5d64f7,_0x1c74f2){var _0xa65773;return db[_0x9168('0x3c')][_0x9168('0x38')]({'where':{'id':_0x5d64f7[_0x9168('0x53')]['id'],'role':_0x9168('0x30')},'attributes':['id',_0x9168('0x39'),_0x9168('0x37')]})[_0x9168('0x16')](handleEntityNotFound(_0x1c74f2,null))['then'](function(_0x44c510){if(_0x44c510){_0xa65773=_0x44c510;return db[_0x9168('0xa9')][_0x9168('0x2b')]({'where':{'membername':_0xa65773['name']},'individualHooks':!![]});}})[_0x9168('0x16')](function(){return db['MemberReport'][_0x9168('0x48')]({'where':{'membername':_0xa65773[_0x9168('0x39')],'exitAt':null}});})['then'](function(_0x3e15b0){var _0x2d7250=[];_0x3e15b0[_0x9168('0xf6')](function(_0x256d89){_0x2d7250[_0x9168('0x47')](_0x256d89[_0x9168('0x5e')]({'exitAt':moment()[_0x9168('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9168('0x5d')](_0x2d7250);})[_0x9168('0x16')](function(){return _0xa65773['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9168('0x16')](respondWithResult(_0x1c74f2,null))[_0x9168('0x1f')](handleError(_0x1c74f2,null));};exports[_0x9168('0xfe')]=function(_0x34c7dc,_0x57afb8){var _0x379041;return db[_0x9168('0xa9')][_0x9168('0x5e')]({'paused':0x1},{'where':{'UserId':_0x34c7dc['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x9168('0x3c')][_0x9168('0x38')]({'where':{'id':_0x34c7dc[_0x9168('0x53')]['id'],'role':_0x9168('0x30')},'attributes':['id',_0x9168('0x39'),'role',_0x9168('0x63'),_0x9168('0x9e')]});})[_0x9168('0x16')](handleEntityNotFound(_0x57afb8,null))[_0x9168('0x16')](function(_0x52b3e3){if(_0x52b3e3){_0x379041=_0x52b3e3;return respondWithRpcPromise(_0x9168('0xff'),'pause',{'id':_0x379041['id'],'name':_0x379041[_0x9168('0x39')],'pause':!![]});}})['then'](function(){if(_0x379041){return db[_0x9168('0xf5')]['findAll']({'where':{'membername':_0x379041[_0x9168('0x39')],'type':'PAUSE','exitAt':null}});}})[_0x9168('0x16')](function(_0x627781){if(_0x627781[_0x9168('0x4b')]){var _0x4817a9=moment()[_0x9168('0xe8')](_0x9168('0xf7'));for(var _0x40d0f9=0x0,_0x4bf35e=_0x627781['length'];_0x40d0f9<_0x4bf35e;_0x40d0f9++){_0x627781[_0x40d0f9][_0x9168('0x100')]({'exitAt':_0x4817a9});}}})[_0x9168('0x16')](function(){var _0x357d40=[];var _0x134a13=utils[_0x9168('0x101')]();_0x134a13[_0x9168('0xf6')](function(_0x15a819){_0x357d40[_0x9168('0x47')]({'channel':_0x15a819,'membername':_0x379041[_0x9168('0x39')],'interface':_[_0x9168('0x68')](_0x379041[_0x9168('0x9e')])?util[_0x9168('0xe8')]('SIP/%s',_0x379041[_0x9168('0x39')]):_0x379041[_0x9168('0x9e')],'type':_0x9168('0xfa'),'enterAt':moment()[_0x9168('0xe8')](_0x9168('0xf7')),'data1':_0x34c7dc[_0x9168('0x5f')][_0x9168('0x102')]||_0x9168('0x103'),'role':_0x379041[_0x9168('0x37')],'internal':_0x379041[_0x9168('0x63')]});});return db[_0x9168('0xf5')]['bulkCreate'](_0x357d40,{'individualHooks':!![]});})[_0x9168('0x16')](function(){return _0x379041[_0x9168('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x34c7dc[_0x9168('0x5f')][_0x9168('0x102')]||_0x9168('0x103'),'lastPauseAt':moment()[_0x9168('0xe8')](_0x9168('0xf7'))});})[_0x9168('0x16')](respondWithResult(_0x57afb8,null))[_0x9168('0x1f')](handleError(_0x57afb8,null));};exports[_0x9168('0x104')]=function(_0x4afe87,_0x425e0e){var _0x3cba47;return db['User'][_0x9168('0x38')]({'where':{'id':_0x4afe87['params']['id']},'attributes':['id',_0x9168('0x39'),'role',_0x9168('0x9d'),'mailPause','chatPause',_0x9168('0x105'),_0x9168('0x106'),'smsPause',_0x9168('0x107'),_0x9168('0x108'),_0x9168('0x109')]})[_0x9168('0x16')](handleEntityNotFound(_0x425e0e,null))[_0x9168('0x16')](function(_0x3e6129){if(_0x3e6129){_0x3cba47=_0x3e6129;if(_0x4afe87[_0x9168('0x5f')][_0x9168('0x9b')]&&!utils[_0x9168('0x9f')](_0x4afe87[_0x9168('0x5f')][_0x9168('0x9b')])){throw new db[(_0x9168('0x90'))][(_0x9168('0x93'))](_0x9168('0xd2'));}switch(_0x4afe87['body'][_0x9168('0x9b')]){case _0x9168('0xa7'):return respondWithRpcPromise('QueuePause',_0x9168('0x104'),{'id':_0x3cba47['id'],'name':_0x3cba47[_0x9168('0x39')],'pause':![]})[_0x9168('0x16')](function(){return db['UserVoiceQueueRt'][_0x9168('0x5e')]({'paused':0x0},{'where':{'UserId':_0x3cba47['id']},'individualHooks':!![]});})[_0x9168('0x16')](function(){return db[_0x9168('0xf5')][_0x9168('0x38')]({'where':{'channel':_0x4afe87['body'][_0x9168('0x9b')],'membername':_0x3cba47[_0x9168('0x39')],'type':_0x9168('0xfa'),'exitAt':null}});})[_0x9168('0x16')](function(_0x3166df){if(_0x3166df){return _0x3166df[_0x9168('0x5e')]({'exitAt':moment()[_0x9168('0xe8')](_0x9168('0xf7')),'data2':_0x9168('0x10a')},{'individualHooks':!![]});}return null;})[_0x9168('0x16')](function(){return _0x3cba47['update']({'voicePause':![]});});case'mail':case _0x9168('0x4c'):case _0x9168('0xb9'):case _0x9168('0x4f'):case _0x9168('0x52'):case _0x9168('0x51'):return db[_0x9168('0xf5')][_0x9168('0x38')]({'where':{'channel':_0x4afe87[_0x9168('0x5f')]['channel'],'membername':_0x3cba47[_0x9168('0x39')],'type':_0x9168('0xfa'),'exitAt':null}})['then'](function(_0x21907c){if(_0x21907c){return _0x21907c[_0x9168('0x5e')]({'exitAt':moment()[_0x9168('0xe8')](_0x9168('0xf7')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9168('0x16')](function(){var _0x5db56e={};_[_0x9168('0x28')](_0x5db56e,util['format']('%s%s',_0x4afe87[_0x9168('0x5f')][_0x9168('0x9b')],_0x9168('0x10b')),![]);return _0x3cba47['update'](_0x5db56e);});default:return respondWithRpcPromise(_0x9168('0xff'),_0x9168('0x104'),{'id':_0x3cba47['id'],'name':_0x3cba47['name'],'pause':![]})[_0x9168('0x16')](function(){return db[_0x9168('0xa9')][_0x9168('0x5e')]({'paused':0x0},{'where':{'UserId':_0x3cba47['id']}});})[_0x9168('0x16')](function(){return db[_0x9168('0xf5')][_0x9168('0x48')]({'where':{'membername':_0x3cba47[_0x9168('0x39')],'type':_0x9168('0xfa'),'exitAt':null}});})[_0x9168('0x16')](function(_0x27eae1){var _0x47ad0b=[];_0x27eae1[_0x9168('0xf6')](function(_0xe33ebe){_0x47ad0b[_0x9168('0x47')](_0xe33ebe['update']({'exitAt':moment()[_0x9168('0xe8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9168('0x10a')}));});return BPromise[_0x9168('0x5d')](_0x47ad0b);})[_0x9168('0x16')](function(){return _0x3cba47[_0x9168('0x5e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9168('0x16')](respondWithResult(_0x425e0e,null))[_0x9168('0x1f')](handleError(_0x425e0e,null));};exports[_0x9168('0x10c')]=function(_0x3ef9b8,_0x236a5f){var _0x2f3d6e={};var _0x592d61={};var _0x2cb025;var _0x4c6c98;return db[_0x9168('0x3c')]['findOne']({'where':{'id':_0x3ef9b8[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x236a5f,null))['then'](function(_0x56f711){if(_0x56f711){_0x2cb025=_0x56f711;_0x592d61['model']=_[_0x9168('0x56')](db[_0x9168('0x10d')][_0x9168('0x3d')]);_0x592d61['query']=_[_0x9168('0x56')](_0x3ef9b8[_0x9168('0x44')]);_0x592d61[_0x9168('0x57')]=_['intersection'](_0x592d61[_0x9168('0x54')],_0x592d61[_0x9168('0x44')]);_0x2f3d6e[_0x9168('0x5a')]=_[_0x9168('0x58')](_0x592d61[_0x9168('0x54')],qs['fields'](_0x3ef9b8[_0x9168('0x44')]['fields']));_0x2f3d6e['attributes']=_0x2f3d6e['attributes'][_0x9168('0x4b')]?_0x2f3d6e[_0x9168('0x5a')]:_0x592d61[_0x9168('0x54')];_0x2f3d6e[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x3ef9b8[_0x9168('0x44')]['sort']);_0x2f3d6e[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x3ef9b8[_0x9168('0x44')],_0x592d61[_0x9168('0x57')]));if(_0x3ef9b8[_0x9168('0x44')][_0x9168('0x32')]){_0x2f3d6e[_0x9168('0x42')]=_['merge'](_0x2f3d6e['where'],{'$or':_[_0x9168('0x34')](_0x2f3d6e[_0x9168('0x5a')],function(_0x346703){var _0x4d0765={};_0x4d0765[_0x346703]={'$like':'%'+_0x3ef9b8[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0x4d0765;})});}_0x2f3d6e=_[_0x9168('0xc8')]({},_0x2f3d6e,_0x3ef9b8[_0x9168('0x5c')]);return _0x2cb025['getTeams'](_0x2f3d6e);}})[_0x9168('0x16')](function(_0x34bd95){if(_0x34bd95){_0x4c6c98=_0x34bd95[_0x9168('0x4b')];if(!_0x3ef9b8[_0x9168('0x44')][_0x9168('0xca')]('nolimit')){_0x2f3d6e['limit']=qs[_0x9168('0x26')](_0x3ef9b8[_0x9168('0x44')][_0x9168('0x26')]);_0x2f3d6e['offset']=qs[_0x9168('0x24')](_0x3ef9b8[_0x9168('0x44')][_0x9168('0x24')]);}return _0x2cb025[_0x9168('0x10c')](_0x2f3d6e);}})[_0x9168('0x16')](function(_0xdeaeb){if(_0xdeaeb){return _0xdeaeb?{'count':_0x4c6c98,'rows':_0xdeaeb}:null;}})[_0x9168('0x16')](respondWithResult(_0x236a5f,null))['catch'](handleError(_0x236a5f,null));};exports[_0x9168('0x10e')]=function(_0xe13eff,_0x36d04f){var _0x26a7b2=_0xe13eff['params']['id'];var _0xefca47=_0xe13eff['body']?_0xe13eff[_0x9168('0x5f')][_0x9168('0x62')]:null;var _0x5bae45=[];return Promise['resolve']()['then'](function(){if(!_0xefca47)throw new APIBadRequestError(_0x9168('0x10f'));})[_0x9168('0x16')](function(){return db['User'][_0x9168('0xc3')]({'where':{'id':_0x26a7b2}});})[_0x9168('0x16')](function(_0x4140aa){if(!_0x4140aa)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xe13eff[_0x9168('0x53')]['id']));return db[_0x9168('0x6a')]['transaction'](function(_0x3742b9){return _0x4140aa['addTeams'](_0xefca47,{'transaction':_0x3742b9})[_0x9168('0x16')](function(){return db[_0x9168('0x10d')][_0x9168('0x48')]({'where':{'id':{'$in':_0xefca47}}});})[_0x9168('0x16')](function(_0x2471cf){var _0x2c68a6=_['map'](_0x2471cf,function(_0x564eb6){return _0x564eb6[_0x9168('0x110')]();});return Promise[_0x9168('0x5d')](_0x2c68a6);})['then'](function(_0x414b70){_0x5bae45=_[_0x9168('0x111')](_0x414b70);var _0x6a9437=_[_0x9168('0x34')](_0x5bae45,function(_0x308881){return _0x308881[_0x9168('0x112')](_0x4140aa['id'],{'transaction':_0x3742b9});});return Promise['all'](_0x6a9437);})['then'](function(){if(!_0x4140aa[_0x9168('0x9c')])return;var _0x5a9c71=_[_0x9168('0x32')](_0x5bae45,function(_0x2c4633){return _0x2c4633[_0x9168('0x113')](_0x9168('0x9b'))===_0x9168('0x114');});var _0x27c8ff=_[_0x9168('0x34')](_0x5a9c71,function(_0x5d1a85){return db[_0x9168('0xa9')][_0x9168('0xaa')]({'membername':_0x4140aa[_0x9168('0x39')],'UserId':_0x4140aa['id'],'queue_name':_0x5d1a85['name'],'VoiceQueueId':_0x5d1a85['id'],'interface':_[_0x9168('0x68')](_0x4140aa[_0x9168('0x9e')])?util[_0x9168('0xe8')](_0x9168('0xea'),_0x4140aa[_0x9168('0x39')]):_0x4140aa[_0x9168('0x9e')],'paused':_0x4140aa[_0x9168('0x9d')]||![],'penalty':_0x4140aa[_0x9168('0xa8')]},{'transaction':_0x3742b9});});return Promise[_0x9168('0x5d')](_0x27c8ff);})[_0x9168('0x16')](function(){return db['TeamVoicePrefix'][_0x9168('0x48')]({'where':{'teamId':{'$in':_0xefca47}}});})['then'](function(_0x36b3e7){var _0x1c451d=_['map'](_0x36b3e7,function(_0x47c667){return db['UserVoicePrefix'][_0x9168('0x7e')]({'UserId':_0x4140aa['id'],'VoicePrefixId':_0x47c667[_0x9168('0x115')]},{'transaction':_0x3742b9});});return Promise[_0x9168('0x5d')](_0x1c451d);});});})['then'](function(){for(var _0x5ccf51=0x0;_0x5ccf51<_0x5bae45[_0x9168('0x4b')];_0x5ccf51++){var _0x451077=_0x5bae45[_0x5ccf51][_0x9168('0x113')](_0x9168('0x9b'));var _0x3837a1=_0x451077+_0x9168('0xa5');socket['emit']('user'+_0x451077+_0x9168('0xa6'),{'UserId':_0x26a7b2,['queueField']:_0x5bae45[_0x5ccf51]['id']});}})[_0x9168('0x16')](respondWithStatusCode(_0x36d04f,null))[_0x9168('0x1f')](APIHandleError(_0x36d04f));};exports[_0x9168('0x116')]=function(_0x32dfdf,_0x4fed3d){var _0x107b57=_0x32dfdf[_0x9168('0x53')]['id'];var _0x28c7de=null;if(_0x32dfdf[_0x9168('0x44')]['ids']){_0x28c7de=_[_0x9168('0xad')](_0x32dfdf['query']['ids'])?_0x32dfdf[_0x9168('0x44')][_0x9168('0x62')]:[_0x32dfdf[_0x9168('0x44')]['ids']];}var _0x3c9876=[];return Promise[_0x9168('0x117')]()[_0x9168('0x16')](function(){if(!_0x28c7de)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x107b57}});})[_0x9168('0x16')](function(_0x333aee){if(!_0x333aee)throw new APINotFoundError(util[_0x9168('0xe8')](_0x9168('0x118'),_0x32dfdf['params']['id']));return db[_0x9168('0x6a')][_0x9168('0x119')](function(_0x5292b6){return _0x333aee[_0x9168('0x116')](_0x28c7de,{'transaction':_0x5292b6})[_0x9168('0x16')](function(){return db[_0x9168('0x10d')][_0x9168('0x48')]({'where':{'id':{'$in':_0x28c7de}}});})['then'](function(_0x2ae59c){var _0xe494ab=_[_0x9168('0x34')](_0x2ae59c,function(_0x1f622e){return _0x1f622e[_0x9168('0x110')]();});return Promise[_0x9168('0x5d')](_0xe494ab);})[_0x9168('0x16')](function(_0x436c39){_0x3c9876=_[_0x9168('0x111')](_0x436c39);var _0x53fc3d=_[_0x9168('0x34')](_0x3c9876,function(_0x7f8b0c){return _0x7f8b0c[_0x9168('0x11a')](_0x333aee['id'],{'transaction':_0x5292b6});});return Promise[_0x9168('0x5d')](_0x53fc3d);})['then'](function(){if(!_0x333aee[_0x9168('0x9c')])return;var _0x38164e=_[_0x9168('0x32')](_0x3c9876,function(_0x4ded9d){return _0x4ded9d[_0x9168('0x113')](_0x9168('0x9b'))===_0x9168('0x114');});var _0x20cbe5=_['map'](_0x38164e,function(_0x11b7b8){return db['UserVoiceQueueRt'][_0x9168('0x2b')]({'where':{'VoiceQueueId':_0x11b7b8['id'],'UserId':_0x333aee['id']},'transaction':_0x5292b6});});return Promise[_0x9168('0x5d')](_0x20cbe5);})[_0x9168('0x16')](function(){return db['TeamVoicePrefix'][_0x9168('0x48')]({'where':{'teamId':{'$in':_0x28c7de}}});})[_0x9168('0x16')](function(_0x33a83d){var _0x1a610c=_[_0x9168('0x34')](_0x33a83d,function(_0x4845f6){return db[_0x9168('0x11b')][_0x9168('0x2b')]({'where':{'UserId':_0x333aee['id'],'VoicePrefixId':_0x4845f6['VoicePrefixId']}},{'transaction':_0x5292b6});});return Promise[_0x9168('0x5d')](_0x1a610c);});});})[_0x9168('0x16')](function(){for(var _0x1189f2=0x0;_0x1189f2<_0x3c9876['length'];_0x1189f2++){var _0x2857ec=_0x3c9876[_0x1189f2][_0x9168('0x113')](_0x9168('0x9b'));var _0x5dc36c=_0x2857ec+'QueueId';socket['emit'](_0x9168('0x2e')+_0x2857ec+'Queue:remove',{'UserId':_0x107b57,['queueField']:_0x3c9876[_0x1189f2]['id']});}})['then'](respondWithStatusCode(_0x4fed3d,null))[_0x9168('0x1f')](APIHandleError(_0x4fed3d));};exports[_0x9168('0x11c')]=function(_0x215050,_0x13f2e5){var _0x143203={};var _0x118942={};var _0x4fae0b;var _0x18563a;return db[_0x9168('0x3c')]['findOne']({'where':{'id':_0x215050[_0x9168('0x53')]['id']}})[_0x9168('0x16')](handleEntityNotFound(_0x13f2e5,null))[_0x9168('0x16')](function(_0x5008a0){if(_0x5008a0){_0x4fae0b=_0x5008a0;_0x118942[_0x9168('0x54')]=_[_0x9168('0x56')](db['CmList'][_0x9168('0x3d')]);_0x118942['query']=_['keys'](_0x215050[_0x9168('0x44')]);_0x118942['filters']=_['intersection'](_0x118942[_0x9168('0x54')],_0x118942[_0x9168('0x44')]);_0x143203['attributes']=_['intersection'](_0x118942[_0x9168('0x54')],qs[_0x9168('0x59')](_0x215050[_0x9168('0x44')][_0x9168('0x59')]));_0x143203[_0x9168('0x5a')]=_0x143203[_0x9168('0x5a')][_0x9168('0x4b')]?_0x143203['attributes']:_0x118942[_0x9168('0x54')];_0x143203[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x215050[_0x9168('0x44')][_0x9168('0xc6')]);_0x143203[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x215050[_0x9168('0x44')],_0x118942[_0x9168('0x57')]));if(_0x215050['query'][_0x9168('0x32')]){_0x143203['where']=_[_0x9168('0xc8')](_0x143203[_0x9168('0x42')],{'$or':_['map'](_0x143203[_0x9168('0x5a')],function(_0x1e0a83){var _0x1f24ac={};_0x1f24ac[_0x1e0a83]={'$like':'%'+_0x215050['query'][_0x9168('0x32')]+'%'};return _0x1f24ac;})});}_0x143203=_['merge']({},_0x143203,_0x215050[_0x9168('0x5c')]);return _0x4fae0b[_0x9168('0x11c')](_0x143203);}})[_0x9168('0x16')](function(_0x218187){if(_0x218187){_0x18563a=_0x218187[_0x9168('0x4b')];if(!_0x215050[_0x9168('0x44')]['hasOwnProperty'](_0x9168('0xd4'))){_0x143203[_0x9168('0x26')]=qs[_0x9168('0x26')](_0x215050['query'][_0x9168('0x26')]);_0x143203['offset']=qs[_0x9168('0x24')](_0x215050[_0x9168('0x44')][_0x9168('0x24')]);}return _0x4fae0b['getLists'](_0x143203);}})[_0x9168('0x16')](function(_0x4d3433){if(_0x4d3433){return _0x4d3433?{'count':_0x18563a,'rows':_0x4d3433}:null;}})[_0x9168('0x16')](respondWithResult(_0x13f2e5,null))[_0x9168('0x1f')](handleError(_0x13f2e5,null));};exports[_0x9168('0x11d')]=function(_0x2cbeec,_0x2fd0d8){var _0x38f45a={};var _0x11d62e={};var _0x33d284;return db[_0x9168('0x3c')][_0x9168('0xc3')]({'where':{'id':_0x2cbeec[_0x9168('0x53')]['id']}})['then'](handleEntityNotFound(_0x2fd0d8,null))['then'](function(_0x253aa2){if(_0x253aa2){_0x33d284=_0x253aa2;_0x11d62e['model']=_[_0x9168('0x56')](db[_0x9168('0x3c')][_0x9168('0x3d')]);_0x11d62e['query']=_[_0x9168('0x56')](_0x2cbeec[_0x9168('0x44')]);_0x11d62e['filters']=_[_0x9168('0x58')](_0x11d62e[_0x9168('0x54')],_0x11d62e[_0x9168('0x44')]);_0x38f45a[_0x9168('0x5a')]=_['intersection'](_0x11d62e['model'],qs[_0x9168('0x59')](_0x2cbeec[_0x9168('0x44')][_0x9168('0x59')]));_0x38f45a[_0x9168('0x5a')]=_0x38f45a[_0x9168('0x5a')][_0x9168('0x4b')]?_0x38f45a[_0x9168('0x5a')]:_0x11d62e['model'];_0x38f45a[_0x9168('0xc5')]=qs[_0x9168('0xc6')](_0x2cbeec[_0x9168('0x44')]['sort']);_0x38f45a[_0x9168('0x42')]=qs[_0x9168('0x57')](_[_0x9168('0xc7')](_0x2cbeec[_0x9168('0x44')],_0x11d62e['filters']));if(_0x2cbeec['query'][_0x9168('0x32')]){_0x38f45a['where']=_['merge'](_0x38f45a[_0x9168('0x42')],{'$or':_[_0x9168('0x34')](_0x38f45a[_0x9168('0x5a')],function(_0x5015fa){var _0x30b670={};_0x30b670[_0x5015fa]={'$like':'%'+_0x2cbeec[_0x9168('0x44')][_0x9168('0x32')]+'%'};return _0x30b670;})});}_0x38f45a[_0x9168('0x54')]=db[_0x9168('0x3c')];_0x38f45a['as']=_0x9168('0x2f');_0x38f45a=_[_0x9168('0xc8')]({},_0x38f45a,_0x2cbeec['options']);return _0x33d284[_0x9168('0x11e')]({'include':[_0x38f45a]});}})[_0x9168('0x16')](function(_0x417a29){if(_0x417a29){var _0x2a1d66={},_0x4c5e68=[];for(var _0x216c2=0x0;_0x216c2<_0x417a29[_0x9168('0x4b')];_0x216c2+=0x1){for(var _0x47dc24=0x0,_0x2d88ec;_0x47dc24<_0x417a29[_0x216c2][_0x9168('0x2f')][_0x9168('0x4b')];_0x47dc24+=0x1){_0x2d88ec=_0x417a29[_0x216c2][_0x9168('0x2f')][_0x47dc24][_0x9168('0x2c')]({'plain':!![]});_0x2a1d66[_0x2d88ec['id']]=_0x2d88ec;}}_0x2a1d66=_[_0x9168('0x11f')](_0x2a1d66);for(var _0x5dfe87=qs[_0x9168('0x24')](_0x2cbeec[_0x9168('0x44')][_0x9168('0x24')]);_0x5dfe87<_0x2a1d66['length']&&_0x4c5e68[_0x9168('0x4b')]=_0x3ccbd9){_0x3ebc0e=_0x3ccbd9;_0x459911=0xc8;}else{_0x459911=0xce;}_0x25eac2[_0x7644('0x24')](_0x459911);return _0x25eac2[_0x7644('0x29')]('Content-Range',_0xd10033+'-'+_0x3ebc0e+'/'+_0x3ccbd9)[_0x7644('0x25')](_0x164389);}return null;};}function saveUpdates(_0x383cd6){return function(_0x29eb6e){if(_0x29eb6e){return _0x29eb6e[_0x7644('0x2a')](_0x383cd6)[_0x7644('0x16')](function(_0x4fbd51){socket[_0x7644('0x2b')](_0x7644('0x2c')+_0x4fbd51['id'],{});return _0x4fbd51;});}return null;};}function removeEntity(_0xc07595){return function(_0x511b11){if(_0x511b11){return _0x511b11[_0x7644('0x2d')]()[_0x7644('0x16')](function(){var _0x9f8b02=_0x511b11[_0x7644('0x2e')]({'plain':!![]});if(_0x9f8b02[_0x7644('0x2f')]===_0x7644('0x30'))return;var _0x1c7c91=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x7644('0x31'),'value':_0x7644('0x32'),'ignore':![]},{'name':_0x7644('0x33'),'value':_0x7644('0x34'),'ignore':![]}];var _0x765a6a=_(_0x1c7c91)[_0x7644('0x35')](_0x7644('0x36'))[_0x7644('0x37')](_0x7644('0x38'))['value']();if(_[_0x7644('0x39')](_0x765a6a,_0x9f8b02[_0x7644('0x2f')])){return;}var _0x22e127=_[_0x7644('0x3a')](_0x1c7c91,[_0x7644('0x38'),_0x9f8b02[_0x7644('0x2f')]])[_0x7644('0x3b')];return db['UserProfileResource'][_0x7644('0x2d')]({'where':{'type':_0x22e127,'resourceId':_0x9f8b02['id']}})[_0x7644('0x16')](function(){return _0x511b11;});})['then'](function(){_0xc07595[_0x7644('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1519ad){return function(_0x3e565a){if(!_0x3e565a){_0x1519ad[_0x7644('0x22')](0x194);}return _0x3e565a;};}function handleError(_0x2de531,_0x498622){_0x498622=_0x498622||0x1f4;return function(_0x18ca57){logger[_0x7644('0x1e')](_0x18ca57['stack']);if(_0x18ca57[_0x7644('0x3b')]){delete _0x18ca57[_0x7644('0x3b')];}_0x2de531[_0x7644('0x24')](_0x498622)[_0x7644('0x3c')](_0x18ca57);};}exports[_0x7644('0x3d')]=function(_0x54b82b,_0xe1601a){var _0x157382={},_0x2c8b50={'count':0x0,'rows':[]};var _0xb470a8=_(db[_0x7644('0x3e')][_0x7644('0x3f')])[_0x7644('0x37')](function(_0x3ab875){return{'name':_0x3ab875[_0x7644('0x40')],'type':_0x3ab875[_0x7644('0x41')]['key']};})[_0x7644('0x35')](function(_0x2e1799){return!_[_0x7644('0x39')](['password',_0x7644('0x42')],_0x2e1799[_0x7644('0x3b')]);})[_0x7644('0x38')]();_0x157382=qs[_0x7644('0x43')](_0xb470a8,_0x54b82b);var _0xf3be85={'where':_0x157382[_0x7644('0x44')]};return db['User'][_0x7644('0x28')](_0xf3be85)[_0x7644('0x16')](function(_0x1d5923){_0x2c8b50[_0x7644('0x28')]=_0x1d5923;if(_0x54b82b[_0x7644('0x45')][_0x7644('0x46')]){_0x157382[_0x7644('0x47')]=[{'all':!![]}];}if(_0x54b82b[_0x7644('0x45')][_0x7644('0x48')]==='true'){_0x157382['include']=[{'model':db[_0x7644('0x49')],'as':_0x7644('0x48')}];}if(!_['includes'](_0x157382[_0x7644('0x4a')],'id')){_0x157382[_0x7644('0x4a')][_0x7644('0x4b')]('id');}return db[_0x7644('0x3e')][_0x7644('0x4c')](_0x157382);})[_0x7644('0x16')](function(_0x1e8247){_0x2c8b50[_0x7644('0x4d')]=_0x1e8247;if(_0x54b82b[_0x7644('0x45')][_0x7644('0x4e')]===_0x7644('0x4f')){var _0x5ba7b8=[];for(var _0x5be2e3=0x0;_0x5be2e3<_0x2c8b50['rows']['length'];_0x5be2e3++){_0x5ba7b8[_0x7644('0x4b')](get_open_tabs(_0x7644('0x50'),_0x2c8b50[_0x7644('0x4d')][_0x5be2e3][_0x7644('0x51')]));_0x5ba7b8[_0x7644('0x4b')](get_open_tabs(_0x7644('0x52'),_0x2c8b50[_0x7644('0x4d')][_0x5be2e3][_0x7644('0x51')]));_0x5ba7b8[_0x7644('0x4b')](get_open_tabs(_0x7644('0x53'),_0x2c8b50[_0x7644('0x4d')][_0x5be2e3][_0x7644('0x51')]));_0x5ba7b8[_0x7644('0x4b')](get_open_tabs(_0x7644('0x54'),_0x2c8b50[_0x7644('0x4d')][_0x5be2e3][_0x7644('0x51')]));_0x5ba7b8[_0x7644('0x4b')](get_open_tabs('openchannel',_0x2c8b50[_0x7644('0x4d')][_0x5be2e3][_0x7644('0x51')]));_0x5ba7b8[_0x7644('0x4b')](get_open_tabs(_0x7644('0x55'),_0x2c8b50['rows'][_0x5be2e3][_0x7644('0x51')]));}return BPromise['all'](_0x5ba7b8)['then'](function(){return _0x2c8b50;});}else{return _0x2c8b50;}})[_0x7644('0x16')](respondWithFilteredResult(_0xe1601a,_0x157382))['catch'](handleError(_0xe1601a,null));};exports['show']=function(_0x254a47,_0x531a06){var _0x50103b={'raw':![],'where':{'id':_0x254a47[_0x7644('0x56')]['id']}},_0x2763e1={};_0x2763e1[_0x7644('0x57')]=_['differenceBy'](_[_0x7644('0x58')](db[_0x7644('0x3e')][_0x7644('0x3f')]),[_0x7644('0x59'),_0x7644('0x42')]);_0x2763e1['query']=_[_0x7644('0x58')](_0x254a47['query']);_0x2763e1['filters']=_[_0x7644('0x5a')](_0x2763e1['model'],_0x2763e1[_0x7644('0x45')]);_0x50103b[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x2763e1['model'],qs[_0x7644('0x5b')](_0x254a47['query'][_0x7644('0x5b')]));_0x50103b[_0x7644('0x4a')]=_0x50103b[_0x7644('0x4a')]['length']?_0x50103b['attributes']:_0x2763e1[_0x7644('0x57')];if(_0x254a47[_0x7644('0x45')][_0x7644('0x46')]){_0x50103b[_0x7644('0x47')]=[{'all':!![]}];}if(_0x254a47[_0x7644('0x45')][_0x7644('0x48')]==='true'){_0x50103b[_0x7644('0x47')]=[{'model':db[_0x7644('0x49')],'as':_0x7644('0x48')}];}_0x50103b=_[_0x7644('0x5c')]({},_0x50103b,_0x254a47[_0x7644('0x5d')]);if(!_[_0x7644('0x39')](_0x50103b[_0x7644('0x4a')],'id')){_0x50103b[_0x7644('0x4a')][_0x7644('0x4b')]('id');}return db[_0x7644('0x3e')]['find'](_0x50103b)[_0x7644('0x16')](handleEntityNotFound(_0x531a06,null))[_0x7644('0x16')](function(_0x198ed5){var _0x6bd53f=[];values=_0x198ed5;if(_0x254a47[_0x7644('0x45')][_0x7644('0x4e')]===_0x7644('0x4f')){_0x6bd53f[_0x7644('0x4b')](get_open_tabs(_0x7644('0x50'),_0x198ed5[_0x7644('0x51')]));_0x6bd53f[_0x7644('0x4b')](get_open_tabs(_0x7644('0x52'),_0x198ed5['dataValues']));_0x6bd53f['push'](get_open_tabs(_0x7644('0x5e'),_0x198ed5[_0x7644('0x51')]));_0x6bd53f[_0x7644('0x4b')](get_open_tabs('whatsapp',_0x198ed5[_0x7644('0x51')]));_0x6bd53f[_0x7644('0x4b')](get_open_tabs(_0x7644('0x53'),_0x198ed5[_0x7644('0x51')]));_0x6bd53f[_0x7644('0x4b')](get_open_tabs(_0x7644('0x54'),_0x198ed5['dataValues']));return BPromise['all'](_0x6bd53f);}else{return values;}})[_0x7644('0x16')](function(){return values;})[_0x7644('0x16')](respondWithResult(_0x531a06,null))[_0x7644('0x21')](handleError(_0x531a06,null));};exports['update']=function(_0x281b12,_0x145201){if(_0x281b12[_0x7644('0x5f')]['id']){delete _0x281b12[_0x7644('0x5f')]['id'];}delete _0x281b12[_0x7644('0x5f')][_0x7644('0x2f')];return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x281b12[_0x7644('0x56')]['id']}})['then'](handleEntityNotFound(_0x145201,null))[_0x7644('0x16')](saveUpdates(_0x281b12[_0x7644('0x5f')],null))[_0x7644('0x16')](respondWithResult(_0x145201,null))[_0x7644('0x21')](handleError(_0x145201,null));};exports[_0x7644('0x60')]=function(_0x464771,_0x2524d7){return db[_0x7644('0x3e')][_0x7644('0x60')]()[_0x7644('0x16')](respondWithResult(_0x2524d7,null))[_0x7644('0x21')](handleError(_0x2524d7,null));};exports[_0x7644('0x61')]=function(_0x30df34,_0x14c035){return db[_0x7644('0x3e')]['find']({'where':{'id':_0x30df34[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x14c035,null))[_0x7644('0x16')](function(_0x5e64a4){if(_0x5e64a4){return _0x5e64a4[_0x7644('0x61')](_0x30df34[_0x7644('0x5f')][_0x7644('0x62')],_[_0x7644('0x63')](_0x30df34['body'],[_0x7644('0x62'),'id'])||{});}})[_0x7644('0x16')](respondWithResult(_0x14c035,null))[_0x7644('0x21')](handleError(_0x14c035,null));};function validateUser(_0x22060b){return new BPromise(function(_0x2eb045,_0x181f25){if(_0x22060b['internal'])return _0x2eb045(_0x22060b);return db[_0x7644('0x64')][_0x7644('0x65')](0x1)[_0x7644('0x16')](function(_0x2fb135){if(_0x2fb135['securePassword'])authService[_0x7644('0x66')](_0x22060b[_0x7644('0x59')]);db['User']['max'](_0x7644('0x67'))[_0x7644('0x16')](function(_0x17513e){if(_[_0x7644('0x68')](_0x17513e)){_0x22060b[_0x7644('0x67')]=_0x2fb135[_0x7644('0x69')]||0x1;return;}if(_['isNil'](_0x2fb135[_0x7644('0x69')])||_0x2fb135[_0x7644('0x69')]===_0x17513e){_0x22060b[_0x7644('0x67')]=_0x17513e+0x1;return;}if(_0x2fb135[_0x7644('0x69')]>_0x17513e){_0x22060b[_0x7644('0x67')]=_0x2fb135[_0x7644('0x69')];return;}return db[_0x7644('0x6a')][_0x7644('0x45')]('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[_0x7644('0x6a')][_0x7644('0x6b')]['SELECT']})[_0x7644('0x16')](function(_0x220898){if(_0x220898&&_0x220898[_0x7644('0x6c')]){for(var _0x2ec9bf=0x0,_0x1c32d5=_0x220898[_0x7644('0x6c')];_0x2ec9bf<_0x1c32d5&&_[_0x7644('0x68')](_0x22060b[_0x7644('0x67')]);_0x2ec9bf++){if(_0x2fb135[_0x7644('0x69')]<=_0x220898[_0x2ec9bf][_0x7644('0x6d')]){_0x22060b[_0x7644('0x67')]=_0x220898[_0x2ec9bf][_0x7644('0x6d')];}else if(_0x2fb135['min_internal']>_0x220898[_0x2ec9bf][_0x7644('0x6d')]&&_0x2fb135[_0x7644('0x69')]<=_0x220898[_0x2ec9bf]['to']){_0x22060b[_0x7644('0x67')]=_0x2fb135['min_internal'];}}}if(_[_0x7644('0x68')](_0x22060b[_0x7644('0x67')])){_0x22060b[_0x7644('0x67')]=_0x17513e+0x1;}return _0x2eb045(_0x22060b);});});})[_0x7644('0x21')](function(_0x4e65c3){_0x181f25(_0x4e65c3);});});}function updateUser(_0x36c521){return new BPromise(function(_0x407108,_0x265e6e){try{if(_0x36c521[_0x7644('0x6e')]){_0x36c521[_0x7644('0x6f')]=_0x36c521[_0x7644('0x67')];_0x36c521['VoiceMail']={'mailbox':_0x36c521['internal'],'password':_0x36c521[_0x7644('0x59')],'fullname':_0x36c521[_0x7644('0x70')],'email':_0x36c521[_0x7644('0x71')]};}if(_0x36c521[_0x7644('0x2f')]===_0x7644('0x32')){if(!_0x36c521[_0x7644('0x72')])_0x36c521[_0x7644('0x72')]=[_0x7644('0x73'),'102',_0x7644('0x74'),'113',_0x7644('0x75'),_0x7644('0x76'),_0x7644('0x77'),'106',_0x7644('0x78'),_0x7644('0x79'),_0x7644('0x7a'),'100',_0x7644('0x7b'),_0x7644('0x7c'),_0x7644('0x7d')];}_0x407108(_0x36c521);}catch(_0x155835){_0x265e6e(_0x155835);}});}exports['create']=function(_0x5f09b6,_0x3598b2){if(_0x5f09b6[_0x7644('0x7e')]['role']===_0x7644('0x32'))throw new Error(_0x7644('0x7f'));if(_0x5f09b6[_0x7644('0x5f')][_0x7644('0x2f')]==='user'&&_0x5f09b6[_0x7644('0x7e')][_0x7644('0x2f')]!==_0x7644('0x30')){throw new Error(_0x7644('0x80'));}if(_0x5f09b6['body']['role']===_0x7644('0x30')&&_0x5f09b6[_0x7644('0x7e')]['role']!==_0x7644('0x30')){throw new Error(_0x7644('0x81'));}return licenseUtil[_0x7644('0x82')]([_0x5f09b6[_0x7644('0x5f')]])[_0x7644('0x16')](function(){return validateUser(_0x5f09b6[_0x7644('0x5f')]);})[_0x7644('0x16')](function(_0x4d6051){return updateUser(_0x4d6051)[_0x7644('0x16')](function(_0x3c8662){if(_0x3c8662[_0x7644('0x2f')]===_0x7644('0x30')){_0x3c8662[_0x7644('0x83')]=_0x5f09b6['user']['settingsEnabled'];delete _0x3c8662[_0x7644('0x84')];}return _0x3c8662;});})[_0x7644('0x16')](function(_0x42f1a2){return db[_0x7644('0x3e')]['create'](_0x42f1a2,{'include':[{'model':db[_0x7644('0x85')],'as':_0x7644('0x85')}]});})['then'](function(_0x508ba1){if(_0x5f09b6[_0x7644('0x5f')]['role']===_0x7644('0x7e'))return _0x508ba1;if(_0x5f09b6[_0x7644('0x7e')]['role']!==_0x7644('0x7e'))return _0x508ba1;return db[_0x7644('0x86')][_0x7644('0x3a')]({'where':{'name':_0x508ba1[_0x7644('0x2f')]==='agent'?_0x7644('0x31'):'Telephones','userProfileId':_0x5f09b6[_0x7644('0x7e')][_0x7644('0x84')]},'raw':!![]})[_0x7644('0x16')](function(_0x138b23){if(!_0x138b23||_0x138b23[_0x7644('0x87')]!=0x0)return _0x508ba1;return db['UserProfileResource'][_0x7644('0x88')]({'name':_0x508ba1[_0x7644('0x3b')],'resourceId':_0x508ba1['id'],'type':_0x138b23['name'],'sectionId':_0x138b23['id']},{})[_0x7644('0x16')](function(){return _0x508ba1;});})[_0x7644('0x21')](function(_0x47772e){logger['error'](_0x7644('0x89'),_0x47772e);throw _0x47772e;});})[_0x7644('0x16')](respondWithResult(_0x3598b2,0xc9))[_0x7644('0x21')](handleError(_0x3598b2,null));};exports[_0x7644('0x8a')]=function(_0x1dbb3a,_0x44ff46){var _0x1d8788=_0x1dbb3a[_0x7644('0x5f')];var _0x461447=[];if(_0x1dbb3a[_0x7644('0x7e')]['role']===_0x7644('0x32'))throw new Error(_0x7644('0x7f'));if(_[_0x7644('0x8b')](_0x1d8788,[_0x7644('0x2f'),_0x7644('0x7e')])&&_0x1dbb3a['user'][_0x7644('0x2f')]!==_0x7644('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x7644('0x8b')](_0x1d8788,[_0x7644('0x2f'),_0x7644('0x30')])&&_0x1dbb3a['user'][_0x7644('0x2f')]!=='admin'){throw new Error(_0x7644('0x8c'));}return licenseUtil['checkUserLimits'](_0x1d8788)[_0x7644('0x16')](function(){return validateUser(_0x1d8788[0x0]);})[_0x7644('0x16')](function(){for(var _0x2a8703=0x1;_0x2a8703<_0x1d8788['length'];_0x2a8703++){var _0x307c1b=_0x1d8788[_0x2a8703-0x1][_0x7644('0x67')];if(!_0x1d8788[_0x2a8703]['internal'])_0x1d8788[_0x2a8703][_0x7644('0x67')]=_0x307c1b+0x1;_0x461447['push'](validateUser(_0x1d8788[_0x2a8703]));}return BPromise[_0x7644('0x8d')](_0x461447);})[_0x7644('0x16')](function(){_0x461447=[];for(var _0x4c9910=0x0;_0x4c9910<_0x1d8788['length'];_0x4c9910++){_0x461447['push'](updateUser(_0x1d8788[_0x4c9910]));}return BPromise['all'](_0x461447);})[_0x7644('0x16')](function(){return BPromise[_0x7644('0x8e')](_0x1d8788,function(_0x584c8b){return db[_0x7644('0x3e')][_0x7644('0x88')](_0x584c8b,{'include':[{'model':db[_0x7644('0x85')],'as':_0x7644('0x85')}]})[_0x7644('0x16')](function(_0xa4ea89){_0x584c8b['id']=_0xa4ea89['id'];return _0x584c8b;});});})[_0x7644('0x16')](function(_0xcfebab){if(_0x1dbb3a[_0x7644('0x5f')][_0x7644('0x2f')]==='user')return _0xcfebab;if(_0x1dbb3a['user'][_0x7644('0x2f')]!==_0x7644('0x7e'))return _0xcfebab;var _0x47b026=_['some'](_0xcfebab,function(_0x2959a1){return _0x2959a1[_0x7644('0x2f')]==='agent'||_0x2959a1['role']===_0x7644('0x34');});if(!_0x47b026)return _0xcfebab;return db[_0x7644('0x86')][_0x7644('0x4c')]({'where':{'name':{'$or':[_0x7644('0x31'),'Telephones']},'userProfileId':_0x1dbb3a[_0x7644('0x7e')][_0x7644('0x84')]},'raw':!![]})['then'](function(_0x15ed72){if(_[_0x7644('0x8f')](_0x15ed72)||!_[_0x7644('0x8b')](_0x15ed72,['autoAssociation',0x0]))return _0xcfebab;_0x461447=[];var _0x54cbd0=_(_0x15ed72)[_0x7644('0x37')](function(_0x23a5e5){if(_0x23a5e5['autoAssociation']===0x1)return;return _0x23a5e5[_0x7644('0x3b')]===_0x7644('0x31')?'agent':_0x7644('0x34');})[_0x7644('0x90')]()[_0x7644('0x38')]();for(var _0xab5408=0x0;_0xab5408<_0xcfebab[_0x7644('0x6c')];_0xab5408++){if(!_[_0x7644('0x39')](_0x54cbd0,_0xcfebab[_0xab5408][_0x7644('0x2f')]))return;var _0x49bc81=_0xcfebab[_0xab5408][_0x7644('0x2f')]===_0x7644('0x32')?_0x7644('0x31'):'Telephones';_0x461447['push'](db['UserProfileResource'][_0x7644('0x88')]({'name':_0xcfebab[_0xab5408][_0x7644('0x3b')],'resourceId':_0xcfebab[_0xab5408]['id'],'type':_0x49bc81,'sectionId':_[_0x7644('0x3a')](_0x15ed72,[_0x7644('0x3b'),_0x49bc81])['id']},{}));}return BPromise['all'](_0x461447);});})['then'](respondWithResult(_0x44ff46,0xc9))[_0x7644('0x21')](handleError(_0x44ff46,null));};exports[_0x7644('0x91')]=function(_0x5ef19e,_0x217eec){if(_0x5ef19e[_0x7644('0x5f')]['id']){delete _0x5ef19e[_0x7644('0x5f')]['id'];}return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x5ef19e[_0x7644('0x56')]['id']}})['then'](function(_0x29f174){if(!_0x29f174)return null;if(_0x29f174['id']===_0x5ef19e[_0x7644('0x7e')]['id']){if(!_0x5ef19e[_0x7644('0x5f')][_0x7644('0x92')]||!_0x5ef19e['body']['newPassword']){throw new db['Sequelize'][(_0x7644('0x93'))](_0x7644('0x94'));}if(!_0x29f174[_0x7644('0x95')](_0x5ef19e[_0x7644('0x5f')]['oldPassword'])){throw new db['Sequelize'][(_0x7644('0x93'))]('Wrong\x20credentials');}if(_0x5ef19e[_0x7644('0x5f')][_0x7644('0x92')]===_0x5ef19e[_0x7644('0x5f')][_0x7644('0x96')]){throw new db['Sequelize'][(_0x7644('0x93'))](_0x7644('0x97'));}}else if(_0x5ef19e[_0x7644('0x7e')][_0x7644('0x2f')]===_0x7644('0x30')){if(!_0x5ef19e['body']['newPassword']){throw new db['Sequelize'][(_0x7644('0x93'))](_0x7644('0x98'));}}else if(_0x5ef19e['user'][_0x7644('0x2f')]==='user'){if(!_0x5ef19e[_0x7644('0x5f')][_0x7644('0x96')]){throw new db[(_0x7644('0x99'))][(_0x7644('0x93'))](_0x7644('0x98'));}if(_0x29f174[_0x7644('0x2f')]!=='agent'){throw new db[(_0x7644('0x99'))][(_0x7644('0x93'))](_0x7644('0x7f'));}}else{throw new db['Sequelize'][(_0x7644('0x93'))]('Unauthorized');}return _0x29f174;})[_0x7644('0x16')](handleEntityNotFound(_0x217eec,null))[_0x7644('0x16')](function(_0x33e755){return db[_0x7644('0x64')][_0x7644('0x9a')]({'attributes':['id',_0x7644('0x9b'),_0x7644('0x9c'),_0x7644('0x9d')]})[_0x7644('0x16')](function(_0x2b3465){if(_0x2b3465['securePassword'])authService['validatePasswordPattern'](_0x5ef19e[_0x7644('0x5f')]['newPassword']);if(!_0x2b3465[_0x7644('0x9c')]||!_0x33e755['previousPasswords'])return _0x33e755;authService['validatePasswordHistory'](_0x5ef19e['body'][_0x7644('0x96')],_0x33e755[_0x7644('0x9e')],_0x2b3465[_0x7644('0x9d')]);return _0x33e755;})[_0x7644('0x16')](saveUpdates({'password':_0x5ef19e['body'][_0x7644('0x96')],'passwordResetAt':_0x5ef19e['user']['id']==_0x5ef19e[_0x7644('0x56')]['id']?moment():null,'previousPasswords':authService[_0x7644('0x9f')](_0x5ef19e[_0x7644('0x5f')][_0x7644('0x96')],_0x33e755['previousPasswords'])},null));})[_0x7644('0x16')](respondWithResult(_0x217eec,null))[_0x7644('0x21')](handleError(_0x217eec,null));};exports[_0x7644('0xa0')]=function(_0x41f947,_0x3b4604){var _0x373e1d=_0x41f947[_0x7644('0x5f')][_0x7644('0xa1')];return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x41f947[_0x7644('0x56')]['id']},'attributes':['id',_0x7644('0x3b'),_0x7644('0x2f'),'online',_0x7644('0xa2'),_0x7644('0xa3'),_0x7644('0xa4')]})['then'](handleEntityNotFound(_0x3b4604,null))[_0x7644('0x16')](function(_0x567017){if(_0x567017){if(!utils['isValidChannel'](_0x373e1d)){throw new db[(_0x7644('0x99'))][(_0x7644('0x93'))](_0x7644('0xa5'));}return _0x567017['add'+_[_0x7644('0xa6')](_0x373e1d[_0x7644('0xa7')]())+_0x7644('0xa8')](_0x41f947[_0x7644('0x5f')]['ids'],{'penalty':_0x41f947['body'][_0x7644('0xa9')]||0x0})[_0x7644('0xaa')](function(_0x493b2f){for(var _0x5a57d7=0x0;_0x5a57d7<_0x41f947['body'][_0x7644('0x62')]['length'];_0x5a57d7+=0x1){var _0x45d849={'UserId':Number(_0x41f947['params']['id'])};_0x45d849[_['capitalize'](_0x373e1d[_0x7644('0xa7')]())+_0x7644('0xab')]=Number(_0x41f947['body'][_0x7644('0x62')][_0x5a57d7]);socket[_0x7644('0x2b')]('user'+_['capitalize'](_0x373e1d[_0x7644('0xa7')]())+_0x7644('0xac'),_0x45d849);}return _0x493b2f;})[_0x7644('0x16')](function(){if(_0x373e1d===_0x7644('0xad')){return db[_0x7644('0xae')][_0x7644('0x4c')]({'where':{'id':_0x41f947[_0x7644('0x5f')][_0x7644('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x7644('0x16')](function(_0x387477){var _0x24e5e8=_0x567017[_0x7644('0x2e')]({'plain':!![]});var _0x395b1a=[];if(_0x373e1d==='voice'&&_0x24e5e8['role']===_0x7644('0x32')&&_0x24e5e8[_0x7644('0xaf')]){for(var _0x4ec413=0x0;_0x4ec413<_0x387477['length'];_0x4ec413+=0x1){_0x395b1a[_0x7644('0x4b')]({'membername':_0x24e5e8[_0x7644('0x3b')],'UserId':_0x24e5e8['id'],'queue_name':_0x387477[_0x4ec413][_0x7644('0x3b')],'VoiceQueueId':_0x387477[_0x4ec413]['id'],'interface':_['isNil'](_0x24e5e8[_0x7644('0xa4')])?util['format'](_0x7644('0xb0'),_0x24e5e8[_0x7644('0x3b')]):_0x24e5e8[_0x7644('0xa4')],'paused':_0x24e5e8['voicePause']||![],'penalty':_0x41f947[_0x7644('0x5f')][_0x7644('0xa9')]||0x0});}return BPromise['each'](_0x395b1a,function(_0x4060e8){return db['UserVoiceQueueRt'][_0x7644('0xb1')](_0x4060e8);});}return _0x567017;});}})['then'](respondWithStatusCode(_0x3b4604,null))[_0x7644('0x21')](handleError(_0x3b4604,null));};exports['removeQueues']=function(_0x1c6666,_0x1cdc31){var _0x242184,_0x279524;return db['User'][_0x7644('0x3a')]({'where':{'id':_0x1c6666['params']['id']},'attributes':['id','name',_0x7644('0x2f')]})[_0x7644('0x16')](handleEntityNotFound(_0x1cdc31,null))['then'](function(_0x31f09b){if(_0x31f09b){_0x242184=_0x31f09b;if(!_0x1c6666['query'][_0x7644('0xa1')]||!utils['isValidChannel'](_0x1c6666['query'][_0x7644('0xa1')])){throw new db[(_0x7644('0x99'))]['ValidationError'](_0x7644('0xa5'));}return _0x31f09b[_0x7644('0xb2')+_[_0x7644('0xa6')](_0x1c6666['query'][_0x7644('0xa1')][_0x7644('0xa7')]())+_0x7644('0xa8')](_0x1c6666['query'][_0x7644('0x62')]);}})[_0x7644('0x16')](function(_0x5f2e6c){if(_[_0x7644('0xb3')](_0x1c6666[_0x7644('0x45')]['ids'])){for(var _0x50ed02=0x0;_0x50ed02<_0x1c6666[_0x7644('0x45')]['ids']['length'];_0x50ed02+=0x1){_0x279524={'UserId':Number(_0x1c6666[_0x7644('0x56')]['id'])};_0x279524[_[_0x7644('0xa6')](_0x1c6666[_0x7644('0x45')][_0x7644('0xa1')]['toLowerCase']())+_0x7644('0xab')]=Number(_0x1c6666[_0x7644('0x45')][_0x7644('0x62')][_0x50ed02]);socket[_0x7644('0x2b')](_0x7644('0x7e')+_[_0x7644('0xa6')](_0x1c6666[_0x7644('0x45')][_0x7644('0xa1')][_0x7644('0xa7')]())+_0x7644('0xb4'),_0x279524);}}else{_0x279524={'UserId':Number(_0x1c6666[_0x7644('0x56')]['id'])};_0x279524[_['capitalize'](_0x1c6666[_0x7644('0x45')][_0x7644('0xa1')][_0x7644('0xa7')]())+_0x7644('0xab')]=Number(_0x1c6666[_0x7644('0x45')]['ids']);socket[_0x7644('0x2b')](_0x7644('0x7e')+_['capitalize'](_0x1c6666[_0x7644('0x45')][_0x7644('0xa1')][_0x7644('0xa7')]())+'Queue:remove',_0x279524);}return _0x5f2e6c;})[_0x7644('0x16')](function(){if(_0x1c6666['query'][_0x7644('0xa1')]===_0x7644('0xad')){return db[_0x7644('0xb5')][_0x7644('0x2d')]({'where':{'UserId':_0x1c6666[_0x7644('0x56')]['id'],'VoiceQueueId':_0x1c6666[_0x7644('0x45')][_0x7644('0x62')]},'individualHooks':!![]})[_0x7644('0x16')](function(){return _0x242184;});}return _0x242184;})[_0x7644('0x16')](respondWithStatusCode(_0x1cdc31,null))[_0x7644('0x21')](handleError(_0x1cdc31,null));};exports[_0x7644('0xb6')]=function(_0x368ea2,_0x37b83c){_0x368ea2['body'][_0x7644('0xb7')]=_0x368ea2[_0x7644('0xb8')][_0x7644('0xb9')];return db['User'][_0x7644('0x3a')]({'where':{'id':_0x368ea2[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x37b83c,null))[_0x7644('0x16')](saveUpdates(_0x368ea2['body'],null))['then'](respondWithResult(_0x37b83c,null))[_0x7644('0x21')](handleError(_0x37b83c,null));};exports[_0x7644('0xba')]=function(_0x29d1ed,_0x4c1ae8){var _0x13515f=path[_0x7644('0xbb')](config[_0x7644('0xbc')],_0x7644('0xbd'));return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x29d1ed[_0x7644('0x56')]['id']},'attributes':['id',_0x7644('0xb7')],'raw':!![]})[_0x7644('0x16')](handleEntityNotFound(_0x4c1ae8,null))[_0x7644('0x16')](function(_0x195a9b){if(_0x195a9b){if(_[_0x7644('0x68')](_0x195a9b['userpic'])){return _0x4c1ae8[_0x7644('0xbe')](_0x13515f);}else{if(!fs['existsSync'](path[_0x7644('0xbb')](config[_0x7644('0xbc')],'server/files/images/',_0x195a9b['userpic']))){return _0x4c1ae8[_0x7644('0xbe')](_0x13515f);}return _0x4c1ae8['download'](path['join'](config[_0x7644('0xbc')],_0x7644('0xbf'),_0x195a9b[_0x7644('0xb7')]));}}})[_0x7644('0x21')](handleError(_0x4c1ae8,null));};exports[_0x7644('0xc0')]=function(_0x3ab887,_0x187121){return db['User'][_0x7644('0x3a')]({'where':{'id':_0x3ab887[_0x7644('0x56')]['id']},'attributes':['id']})[_0x7644('0x16')](handleEntityNotFound(_0x187121,null))[_0x7644('0x16')](function(_0x5225e4){var _0x38bf53=[];values=_0x5225e4[_0x7644('0x51')];_0x38bf53[_0x7644('0x4b')](get_open_tabs(_0x7644('0x50'),_0x5225e4[_0x7644('0x51')]));_0x38bf53[_0x7644('0x4b')](get_open_tabs(_0x7644('0x52'),_0x5225e4[_0x7644('0x51')]));_0x38bf53['push'](get_open_tabs('openchannel',_0x5225e4[_0x7644('0x51')]));_0x38bf53['push'](get_open_tabs(_0x7644('0x55'),_0x5225e4[_0x7644('0x51')]));_0x38bf53[_0x7644('0x4b')](get_open_tabs(_0x7644('0x53'),_0x5225e4[_0x7644('0x51')]));_0x38bf53['push'](get_open_tabs('mail',_0x5225e4[_0x7644('0x51')]));return BPromise[_0x7644('0x8d')](_0x38bf53);})[_0x7644('0x16')](function(_0x4d352f){if(_0x4d352f){var _0x2fccf4=_[_0x7644('0x37')](values['ChatOpenTabs'],function(_0x1c4588){return{'channel':_0x7644('0xc1'),'id':_0x1c4588['id'],'createdAt':_0x1c4588[_0x7644('0xc2')]};});var _0x5d32f1=_[_0x7644('0x37')](values[_0x7644('0xc3')],function(_0x4fce32){return{'channel':_0x7644('0xc4'),'id':_0x4fce32['id'],'createdAt':_0x4fce32[_0x7644('0xc2')]};});var _0x1ce965=_['map'](values[_0x7644('0xc5')],function(_0x9acf84){return{'channel':_0x7644('0xc6'),'id':_0x9acf84['id'],'createdAt':_0x9acf84[_0x7644('0xc2')]};});var _0x329576=_['map'](values[_0x7644('0xc7')],function(_0x4664a4){return{'channel':_0x7644('0xc8'),'id':_0x4664a4['id'],'createdAt':_0x4664a4['createdAt']};});var _0x546313=_['map'](values['SmsOpenTabs'],function(_0x47b0ea){return{'channel':_0x7644('0xc9'),'id':_0x47b0ea['id'],'createdAt':_0x47b0ea[_0x7644('0xc2')]};});var _0xcb296b=_[_0x7644('0x37')](values[_0x7644('0xca')],function(_0x51542a){return{'channel':_0x7644('0xcb'),'id':_0x51542a['id'],'createdAt':_0x51542a[_0x7644('0xc2')]};});var _0x3ce058=_[_0x7644('0xcc')](_0x2fccf4,_0x5d32f1,_0x1ce965,_0x329576,_0x546313,_0xcb296b);var _0x3ff8b0={'count':_0x3ce058[_0x7644('0x6c')],'rows':_0x3ce058};return _0x3ff8b0;}else return null;})[_0x7644('0x16')](respondWithResult(_0x187121,null))[_0x7644('0x21')](handleError(_0x187121,null));};exports[_0x7644('0xcd')]=function(_0xaf1a4a,_0xe09726){var _0x1e0e7d={};var _0x1fc272={};var _0xb51528;var _0x9f8ff3;return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0xaf1a4a[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0xe09726,null))[_0x7644('0x16')](function(_0x2dc44f){if(_0x2dc44f){_0xb51528=_0x2dc44f;_0x1fc272[_0x7644('0x57')]=_['keys'](db[_0x7644('0xce')]['rawAttributes']);_0x1fc272[_0x7644('0x45')]=_[_0x7644('0x58')](_0xaf1a4a[_0x7644('0x45')]);_0x1fc272[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x1fc272[_0x7644('0x57')],_0x1fc272[_0x7644('0x45')]);_0x1e0e7d[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x1fc272['model'],qs['fields'](_0xaf1a4a[_0x7644('0x45')][_0x7644('0x5b')]));_0x1e0e7d[_0x7644('0x4a')]=_0x1e0e7d[_0x7644('0x4a')]['length']?_0x1e0e7d[_0x7644('0x4a')]:_0x1fc272[_0x7644('0x57')];_0x1e0e7d[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0xaf1a4a[_0x7644('0x45')]['sort']);_0x1e0e7d['where']=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0xaf1a4a[_0x7644('0x45')],_0x1fc272[_0x7644('0xcf')]));if(_0xaf1a4a[_0x7644('0x45')]['filter']){_0x1e0e7d[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x1e0e7d[_0x7644('0x44')],{'$or':_['map'](_0x1e0e7d[_0x7644('0x4a')],function(_0x2a3200){var _0x55d004={};_0x55d004[_0x2a3200]={'$like':'%'+_0xaf1a4a[_0x7644('0x45')]['filter']+'%'};return _0x55d004;})});}_0x1e0e7d=_['merge']({},_0x1e0e7d,_0xaf1a4a['options']);return _0xb51528[_0x7644('0xcd')](_0x1e0e7d);}})[_0x7644('0x16')](function(_0x2f2947){if(_0x2f2947){_0x9f8ff3=_0x2f2947['length'];if(_0xaf1a4a[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0x46'))){_0x1e0e7d['include']=[{'model':db[_0x7644('0xd4')],'as':_0x7644('0xd5'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7644('0x3b'),_0x7644('0xd6')],'where':_0xaf1a4a[_0x7644('0x45')][_0x7644('0xd7')]?{'id':_0xaf1a4a['query'][_0x7644('0xd7')]}:undefined,'required':_0xaf1a4a[_0x7644('0x45')][_0x7644('0xd7')]?!![]:![]}];}if(!_0xaf1a4a['query'][_0x7644('0xd3')](_0x7644('0xd8'))){_0x1e0e7d[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0xaf1a4a[_0x7644('0x45')]['limit']);_0x1e0e7d[_0x7644('0x26')]=qs[_0x7644('0x26')](_0xaf1a4a[_0x7644('0x45')][_0x7644('0x26')]);}return _0xb51528[_0x7644('0xcd')](_0x1e0e7d);}})[_0x7644('0x16')](function(_0x41fb4f){if(_0x41fb4f){return _0x41fb4f?{'count':_0x9f8ff3,'rows':_0x41fb4f}:null;}})[_0x7644('0x16')](respondWithResult(_0xe09726,null))['catch'](handleError(_0xe09726,null));};exports['getQueues']=function(_0xce86c4,_0x5c905e){var _0x40cee8;var _0x4a6615={};var _0x44f4ae;return db[_0x7644('0x3e')]['findOne']({'where':{'id':_0xce86c4[_0x7644('0x56')]['id']},'attributes':['id',_0x7644('0x3b'),_0x7644('0x2f')]})[_0x7644('0x16')](handleEntityNotFound(_0x5c905e,null))['then'](function(_0x22c968){if(!utils[_0x7644('0xda')](_0xce86c4[_0x7644('0x45')][_0x7644('0xa1')])){throw new db[(_0x7644('0x99'))][(_0x7644('0x93'))]('Unknown\x20channel');}_0x40cee8=_0x22c968;var _0x43c068={};_0x43c068[_0x7644('0x57')]=_[_0x7644('0x58')](db[_[_0x7644('0xa6')](_0xce86c4[_0x7644('0x45')][_0x7644('0xa1')])+_0x7644('0xdb')]['rawAttributes']);_0x43c068[_0x7644('0x45')]=_[_0x7644('0x58')](_0xce86c4[_0x7644('0x45')]);_0x43c068[_0x7644('0xcf')]=_['intersection'](_0x43c068[_0x7644('0x57')],_0x43c068['query']);_0x4a6615[_0x7644('0x4a')]=_['intersection'](_0x43c068[_0x7644('0x57')],qs['fields'](_0xce86c4[_0x7644('0x45')][_0x7644('0x5b')]));_0x4a6615[_0x7644('0x4a')]=_0x4a6615[_0x7644('0x4a')][_0x7644('0x6c')]?_0x4a6615[_0x7644('0x4a')]:_0x43c068[_0x7644('0x57')];_0x4a6615['order']=qs[_0x7644('0xd1')](_0xce86c4[_0x7644('0x45')][_0x7644('0xd1')]);_0x4a6615[_0x7644('0x44')]=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0xce86c4[_0x7644('0x45')],_0x43c068[_0x7644('0xcf')]));if(_0xce86c4[_0x7644('0x45')][_0x7644('0x35')]){_0x4a6615[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x4a6615['where'],{'$or':_[_0x7644('0x37')](_0x4a6615[_0x7644('0x4a')],function(_0x5e6afb){var _0x380a38={};_0x380a38[_0x5e6afb]={'$like':'%'+_0xce86c4[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x380a38;})});}_0x4a6615=_[_0x7644('0x5c')]({},_0x4a6615,_0xce86c4[_0x7644('0x5d')]);switch(_0x40cee8[_0x7644('0x2f')]){case _0x7644('0x30'):return db[_['capitalize'](_0xce86c4[_0x7644('0x45')][_0x7644('0xa1')])+_0x7644('0xdb')]['findAll'](_0x4a6615);case _0x7644('0x7e'):case _0x7644('0x32'):return _0x40cee8[_0x7644('0x2e')+_['capitalize'](_0xce86c4[_0x7644('0x45')][_0x7644('0xa1')])+_0x7644('0xa8')](_0x4a6615);default:throw new db[(_0x7644('0x99'))][(_0x7644('0x93'))]('Unknown\x20role');}})[_0x7644('0x16')](function(_0x4b0f18){_0x44f4ae=_0x4b0f18[_0x7644('0x6c')];if(!_0xce86c4[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0xd8'))){_0x4a6615[_0x7644('0xd9')]=qs['limit'](_0xce86c4[_0x7644('0x45')]['limit']);_0x4a6615[_0x7644('0x26')]=qs[_0x7644('0x26')](_0xce86c4[_0x7644('0x45')][_0x7644('0x26')]);}switch(_0x40cee8[_0x7644('0x2f')]){case _0x7644('0x30'):return db[_[_0x7644('0xa6')](_0xce86c4[_0x7644('0x45')][_0x7644('0xa1')])+_0x7644('0xdb')][_0x7644('0x4c')](_0x4a6615);case _0x7644('0x7e'):case _0x7644('0x32'):return _0x40cee8[_0x7644('0x2e')+_[_0x7644('0xa6')](_0xce86c4[_0x7644('0x45')]['channel'])+_0x7644('0xa8')](_0x4a6615);}})[_0x7644('0x16')](function(_0x15455f){return{'count':_0x44f4ae,'rows':_0x15455f};})[_0x7644('0x16')](respondWithResult(_0x5c905e,null))[_0x7644('0x21')](handleError(_0x5c905e,null));};exports[_0x7644('0xdc')]=function(_0x34e8ed,_0x5820a2){var _0x4cc1c6={};var _0x5957f5={};var _0x1d45cf;var _0x2f6802;return db['User']['findOne']({'where':{'id':_0x34e8ed['params']['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x5820a2,null))[_0x7644('0x16')](function(_0x249d68){if(_0x249d68){_0x1d45cf=_0x249d68;_0x5957f5[_0x7644('0x57')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x5957f5[_0x7644('0x45')]=_['keys'](_0x34e8ed[_0x7644('0x45')]);_0x5957f5[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x5957f5[_0x7644('0x57')],_0x5957f5[_0x7644('0x45')]);_0x4cc1c6[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x5957f5[_0x7644('0x57')],qs[_0x7644('0x5b')](_0x34e8ed[_0x7644('0x45')][_0x7644('0x5b')]));_0x4cc1c6[_0x7644('0x4a')]=_0x4cc1c6[_0x7644('0x4a')][_0x7644('0x6c')]?_0x4cc1c6['attributes']:_0x5957f5[_0x7644('0x57')];_0x4cc1c6[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x34e8ed[_0x7644('0x45')]['sort']);_0x4cc1c6['where']=qs['filters'](_[_0x7644('0xd2')](_0x34e8ed['query'],_0x5957f5[_0x7644('0xcf')]));if(_0x34e8ed[_0x7644('0x45')][_0x7644('0x35')]){_0x4cc1c6['where']=_['merge'](_0x4cc1c6[_0x7644('0x44')],{'$or':_[_0x7644('0x37')](_0x4cc1c6['attributes'],function(_0x18d709){var _0x1cd684={};_0x1cd684[_0x18d709]={'$like':'%'+_0x34e8ed[_0x7644('0x45')]['filter']+'%'};return _0x1cd684;})});}_0x4cc1c6=_[_0x7644('0x5c')]({},_0x4cc1c6,_0x34e8ed[_0x7644('0x5d')]);return _0x1d45cf[_0x7644('0xdc')](_0x4cc1c6);}})[_0x7644('0x16')](function(_0xa3c69f){if(_0xa3c69f){_0x2f6802=_0xa3c69f['length'];if(!_0x34e8ed[_0x7644('0x45')]['hasOwnProperty'](_0x7644('0xd8'))){_0x4cc1c6[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0x34e8ed['query']['limit']);_0x4cc1c6['offset']=qs[_0x7644('0x26')](_0x34e8ed[_0x7644('0x45')][_0x7644('0x26')]);}return _0x1d45cf['getVoiceQueuesRt'](_0x4cc1c6);}})[_0x7644('0x16')](function(_0x428256){if(_0x428256){return _0x428256?{'count':_0x2f6802,'rows':_0x428256}:null;}})[_0x7644('0x16')](respondWithResult(_0x5820a2,null))[_0x7644('0x21')](handleError(_0x5820a2,null));};exports['getGroups']=function(_0x3a1402,_0x1d8cf4){var _0x2cd74b={};var _0x165d13={};var _0x133873;var _0x32955c;return db[_0x7644('0x3e')]['findOne']({'where':{'id':_0x3a1402[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x1d8cf4,null))[_0x7644('0x16')](function(_0xd1052a){if(_0xd1052a){_0x133873=_0xd1052a;_0x165d13['model']=_['keys'](db['ChatGroup'][_0x7644('0x3f')]);_0x165d13[_0x7644('0x45')]=_['keys'](_0x3a1402[_0x7644('0x45')]);_0x165d13[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x165d13[_0x7644('0x57')],_0x165d13[_0x7644('0x45')]);_0x2cd74b[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x165d13[_0x7644('0x57')],qs['fields'](_0x3a1402[_0x7644('0x45')][_0x7644('0x5b')]));_0x2cd74b[_0x7644('0x4a')]=_0x2cd74b[_0x7644('0x4a')][_0x7644('0x6c')]?_0x2cd74b[_0x7644('0x4a')]:_0x165d13[_0x7644('0x57')];_0x2cd74b['order']=qs[_0x7644('0xd1')](_0x3a1402[_0x7644('0x45')]['sort']);_0x2cd74b[_0x7644('0x44')]=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0x3a1402[_0x7644('0x45')],_0x165d13[_0x7644('0xcf')]));if(_0x3a1402['query'][_0x7644('0x35')]){_0x2cd74b[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x2cd74b[_0x7644('0x44')],{'$or':_['map'](_0x2cd74b[_0x7644('0x4a')],function(_0x1a4192){var _0x415435={};_0x415435[_0x1a4192]={'$like':'%'+_0x3a1402[_0x7644('0x45')]['filter']+'%'};return _0x415435;})});}_0x2cd74b=_[_0x7644('0x5c')]({},_0x2cd74b,_0x3a1402[_0x7644('0x5d')]);return _0x133873['getGroups'](_0x2cd74b);}})[_0x7644('0x16')](function(_0x30de58){if(_0x30de58){_0x32955c=_0x30de58[_0x7644('0x6c')];if(!_0x3a1402[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0xd8'))){_0x2cd74b[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0x3a1402[_0x7644('0x45')][_0x7644('0xd9')]);_0x2cd74b[_0x7644('0x26')]=qs[_0x7644('0x26')](_0x3a1402[_0x7644('0x45')][_0x7644('0x26')]);}return _0x133873[_0x7644('0xdd')](_0x2cd74b);}})[_0x7644('0x16')](function(_0x5eb2d3){if(_0x5eb2d3){return _0x5eb2d3?{'count':_0x32955c,'rows':_0x5eb2d3}:null;}})['then'](respondWithResult(_0x1d8cf4,null))[_0x7644('0x21')](handleError(_0x1d8cf4,null));};exports['getRecordings']=function(_0x3f946e,_0x3477c8){var _0x44430e={'raw':!![],'where':{}};var _0x28ad92={};var _0x17ffa3={'count':0x0,'rows':[]};return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x3f946e[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x3477c8,null))['then'](function(_0x3de8e3){if(_0x3de8e3){_0x28ad92[_0x7644('0x57')]=_[_0x7644('0x58')](db[_0x7644('0xde')][_0x7644('0x3f')]);_0x28ad92['query']=_[_0x7644('0x58')](_0x3f946e[_0x7644('0x45')]);_0x28ad92[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x28ad92[_0x7644('0x57')],_0x28ad92[_0x7644('0x45')]);_0x44430e[_0x7644('0x4a')]=_['intersection'](_0x28ad92[_0x7644('0x57')],qs[_0x7644('0x5b')](_0x3f946e[_0x7644('0x45')][_0x7644('0x5b')]));_0x44430e['attributes']=_0x44430e[_0x7644('0x4a')][_0x7644('0x6c')]?_0x44430e['attributes']:_0x28ad92[_0x7644('0x57')];if(!_0x3f946e[_0x7644('0x45')]['hasOwnProperty']('nolimit')){_0x44430e[_0x7644('0xd9')]=qs['limit'](_0x3f946e[_0x7644('0x45')]['limit']);_0x44430e[_0x7644('0x26')]=qs[_0x7644('0x26')](_0x3f946e[_0x7644('0x45')][_0x7644('0x26')]);}_0x44430e[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x3f946e[_0x7644('0x45')][_0x7644('0xd1')]);_0x44430e['where']=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0x3f946e['query'],_0x28ad92['filters']));_0x44430e[_0x7644('0x44')][_0x7644('0xdf')]=_0x3de8e3['id'];if(_0x3f946e['query'][_0x7644('0x35')]){_0x44430e[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x44430e[_0x7644('0x44')],{'$or':_['map'](_0x44430e[_0x7644('0x4a')],function(_0x5255a8){var _0x5d9e3f={};_0x5d9e3f[_0x5255a8]={'$like':'%'+_0x3f946e[_0x7644('0x45')]['filter']+'%'};return _0x5d9e3f;})});}_0x44430e=_['merge']({},_0x44430e,_0x3f946e['options']);return db[_0x7644('0xde')][_0x7644('0x28')]({'where':_0x44430e[_0x7644('0x44')]})['then'](function(_0x3b00cc){_0x17ffa3[_0x7644('0x28')]=_0x3b00cc;if(_0x3f946e[_0x7644('0x45')][_0x7644('0x46')]){_0x44430e[_0x7644('0x47')]=[{'all':!![]}];}return db[_0x7644('0xde')]['findAll'](_0x44430e);})[_0x7644('0x16')](function(_0x3a0335){_0x17ffa3[_0x7644('0x4d')]=_0x3a0335;return _0x17ffa3;});}})[_0x7644('0x16')](respondWithFilteredResult(_0x3477c8,_0x44430e))[_0x7644('0x21')](handleError(_0x3477c8,null));};exports[_0x7644('0xe0')]=function(_0x2d8f2e,_0x4dcb8a){var _0x2caeb8={'raw':!![],'where':{}};var _0xef1a70={};var _0x3e3611={'count':0x0,'rows':[]};return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x2d8f2e[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x4dcb8a,null))[_0x7644('0x16')](function(_0x3d2df){if(_0x3d2df){_0xef1a70[_0x7644('0x57')]=_[_0x7644('0x58')](db['ScreenRecording'][_0x7644('0x3f')]);_0xef1a70[_0x7644('0x45')]=_[_0x7644('0x58')](_0x2d8f2e['query']);_0xef1a70[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0xef1a70[_0x7644('0x57')],_0xef1a70[_0x7644('0x45')]);_0x2caeb8[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0xef1a70[_0x7644('0x57')],qs['fields'](_0x2d8f2e['query'][_0x7644('0x5b')]));_0x2caeb8[_0x7644('0x4a')]=_0x2caeb8[_0x7644('0x4a')][_0x7644('0x6c')]?_0x2caeb8[_0x7644('0x4a')]:_0xef1a70['model'];if(!_0x2d8f2e[_0x7644('0x45')]['hasOwnProperty'](_0x7644('0xd8'))){_0x2caeb8[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0x2d8f2e[_0x7644('0x45')][_0x7644('0xd9')]);_0x2caeb8[_0x7644('0x26')]=qs[_0x7644('0x26')](_0x2d8f2e[_0x7644('0x45')][_0x7644('0x26')]);}_0x2caeb8[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x2d8f2e['query'][_0x7644('0xd1')]);_0x2caeb8[_0x7644('0x44')]=qs['filters'](_[_0x7644('0xd2')](_0x2d8f2e[_0x7644('0x45')],_0xef1a70[_0x7644('0xcf')]));_0x2caeb8[_0x7644('0x44')][_0x7644('0xdf')]=_0x3d2df['id'];if(_0x2d8f2e['query'][_0x7644('0x35')]){_0x2caeb8['where']=_[_0x7644('0x5c')](_0x2caeb8['where'],{'$or':_['map'](_0x2caeb8[_0x7644('0x4a')],function(_0x329a6c){var _0x3ed898={};_0x3ed898[_0x329a6c]={'$like':'%'+_0x2d8f2e[_0x7644('0x45')]['filter']+'%'};return _0x3ed898;})});}_0x2caeb8=_[_0x7644('0x5c')]({},_0x2caeb8,_0x2d8f2e[_0x7644('0x5d')]);return db['ScreenRecording'][_0x7644('0x28')]({'where':_0x2caeb8[_0x7644('0x44')]})[_0x7644('0x16')](function(_0xed551c){_0x3e3611[_0x7644('0x28')]=_0xed551c;if(_0x2d8f2e[_0x7644('0x45')][_0x7644('0x46')]){_0x2caeb8[_0x7644('0x47')]=[{'all':!![]}];}return db[_0x7644('0xe1')][_0x7644('0x4c')](_0x2caeb8);})['then'](function(_0x4e32a6){_0x3e3611[_0x7644('0x4d')]=_0x4e32a6;return _0x3e3611;});}})[_0x7644('0x16')](respondWithFilteredResult(_0x4dcb8a,_0x2caeb8))[_0x7644('0x21')](handleError(_0x4dcb8a,null));};exports['getChatInteractions']=function(_0x5a6955,_0x34f870){var _0x1afc83={};var _0xf6a4e2={};var _0xa26ffa;var _0x3a23b8;return db['User'][_0x7644('0x9a')]({'where':{'id':_0x5a6955['params']['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x34f870,null))['then'](function(_0x29b8db){if(_0x29b8db){_0xa26ffa=_0x29b8db;_0xf6a4e2['model']=_[_0x7644('0x58')](db['ChatInteraction'][_0x7644('0x3f')]);_0xf6a4e2[_0x7644('0x45')]=_[_0x7644('0x58')](_0x5a6955['query']);_0xf6a4e2['filters']=_[_0x7644('0x5a')](_0xf6a4e2[_0x7644('0x57')],_0xf6a4e2['query']);_0x1afc83[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0xf6a4e2['model'],qs[_0x7644('0x5b')](_0x5a6955['query'][_0x7644('0x5b')]));_0x1afc83['attributes']=_0x1afc83['attributes'][_0x7644('0x6c')]?_0x1afc83[_0x7644('0x4a')]:_0xf6a4e2[_0x7644('0x57')];_0x1afc83[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x5a6955[_0x7644('0x45')][_0x7644('0xd1')]);_0x1afc83[_0x7644('0x44')]=qs[_0x7644('0xcf')](_['pick'](_0x5a6955[_0x7644('0x45')],_0xf6a4e2['filters']));if(_0x5a6955[_0x7644('0x45')]['filter']){_0x1afc83['where']=_[_0x7644('0x5c')](_0x1afc83[_0x7644('0x44')],{'$or':_[_0x7644('0x37')](_0x1afc83[_0x7644('0x4a')],function(_0x18d362){var _0x51e07c={};_0x51e07c[_0x18d362]={'$like':'%'+_0x5a6955[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x51e07c;})});}_0x1afc83=_[_0x7644('0x5c')]({},_0x1afc83,_0x5a6955['options']);return _0xa26ffa[_0x7644('0xe2')](_0x1afc83);}})[_0x7644('0x16')](function(_0x4f09f3){if(_0x4f09f3){_0x3a23b8=_0x4f09f3[_0x7644('0x6c')];if(!_0x5a6955[_0x7644('0x45')]['hasOwnProperty'](_0x7644('0xd8'))){_0x1afc83[_0x7644('0xd9')]=qs['limit'](_0x5a6955[_0x7644('0x45')][_0x7644('0xd9')]);_0x1afc83[_0x7644('0x26')]=qs[_0x7644('0x26')](_0x5a6955[_0x7644('0x45')]['offset']);}return _0xa26ffa[_0x7644('0xe2')](_0x1afc83);}})['then'](function(_0x13f556){if(_0x13f556){return _0x13f556?{'count':_0x3a23b8,'rows':_0x13f556}:null;}})[_0x7644('0x16')](respondWithResult(_0x34f870,null))[_0x7644('0x21')](handleError(_0x34f870,null));};exports[_0x7644('0xe3')]=function(_0x5ee205,_0x4afd4d){var _0xe2c127={};var _0x37556c={};var _0x2ba9f4;var _0x1dcda9;return db[_0x7644('0x3e')]['findOne']({'where':{'id':_0x5ee205[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x4afd4d,null))['then'](function(_0x5508ec){if(_0x5508ec){_0x2ba9f4=_0x5508ec;_0x37556c[_0x7644('0x57')]=_[_0x7644('0x58')](db['OpenchannelInteraction'][_0x7644('0x3f')]);_0x37556c['query']=_[_0x7644('0x58')](_0x5ee205[_0x7644('0x45')]);_0x37556c['filters']=_[_0x7644('0x5a')](_0x37556c['model'],_0x37556c[_0x7644('0x45')]);_0xe2c127[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x37556c[_0x7644('0x57')],qs['fields'](_0x5ee205[_0x7644('0x45')][_0x7644('0x5b')]));_0xe2c127['attributes']=_0xe2c127['attributes'][_0x7644('0x6c')]?_0xe2c127[_0x7644('0x4a')]:_0x37556c[_0x7644('0x57')];_0xe2c127[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x5ee205[_0x7644('0x45')]['sort']);_0xe2c127['where']=qs['filters'](_[_0x7644('0xd2')](_0x5ee205['query'],_0x37556c[_0x7644('0xcf')]));if(_0x5ee205[_0x7644('0x45')][_0x7644('0x35')]){_0xe2c127[_0x7644('0x44')]=_[_0x7644('0x5c')](_0xe2c127[_0x7644('0x44')],{'$or':_['map'](_0xe2c127[_0x7644('0x4a')],function(_0x5e863b){var _0x1ea682={};_0x1ea682[_0x5e863b]={'$like':'%'+_0x5ee205[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x1ea682;})});}_0xe2c127=_['merge']({},_0xe2c127,_0x5ee205['options']);return _0x2ba9f4[_0x7644('0xe3')](_0xe2c127);}})[_0x7644('0x16')](function(_0x239473){if(_0x239473){_0x1dcda9=_0x239473[_0x7644('0x6c')];if(!_0x5ee205[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0xd8'))){_0xe2c127['limit']=qs[_0x7644('0xd9')](_0x5ee205[_0x7644('0x45')][_0x7644('0xd9')]);_0xe2c127['offset']=qs[_0x7644('0x26')](_0x5ee205['query'][_0x7644('0x26')]);}return _0x2ba9f4['getOpenchannelInteractions'](_0xe2c127);}})[_0x7644('0x16')](function(_0x43b006){if(_0x43b006){return _0x43b006?{'count':_0x1dcda9,'rows':_0x43b006}:null;}})['then'](respondWithResult(_0x4afd4d,null))['catch'](handleError(_0x4afd4d,null));};exports[_0x7644('0xe4')]=function(_0x14f037,_0x5c46fd){var _0x4516de={'raw':!![],'where':{}};var _0x1882ab={};var _0x305870={'count':0x0,'rows':[]};return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x14f037[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x5c46fd,null))['then'](function(_0x59a79f){if(_0x59a79f){_0x1882ab[_0x7644('0x57')]=_[_0x7644('0x58')](db[_0x7644('0xe5')][_0x7644('0x3f')]);_0x1882ab[_0x7644('0x45')]=_[_0x7644('0x58')](_0x14f037[_0x7644('0x45')]);_0x1882ab[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x1882ab['model'],_0x1882ab[_0x7644('0x45')]);_0x4516de[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x1882ab[_0x7644('0x57')],qs['fields'](_0x14f037[_0x7644('0x45')][_0x7644('0x5b')]));_0x4516de[_0x7644('0x4a')]=_0x4516de[_0x7644('0x4a')]['length']?_0x4516de['attributes']:_0x1882ab[_0x7644('0x57')];if(!_0x14f037[_0x7644('0x45')]['hasOwnProperty'](_0x7644('0xd8'))){_0x4516de[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0x14f037[_0x7644('0x45')][_0x7644('0xd9')]);_0x4516de['offset']=qs[_0x7644('0x26')](_0x14f037[_0x7644('0x45')]['offset']);}_0x4516de[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x14f037['query'][_0x7644('0xd1')]);_0x4516de[_0x7644('0x44')]=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0x14f037[_0x7644('0x45')],_0x1882ab[_0x7644('0xcf')]));_0x4516de['where'][_0x7644('0xdf')]=_0x59a79f['id'];if(_0x14f037[_0x7644('0x45')][_0x7644('0x35')]){_0x4516de[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x4516de[_0x7644('0x44')],{'$or':_[_0x7644('0x37')](_0x4516de['attributes'],function(_0x207224){var _0x5ecc56={};_0x5ecc56[_0x207224]={'$like':'%'+_0x14f037[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x5ecc56;})});}_0x4516de=_[_0x7644('0x5c')]({},_0x4516de,_0x14f037[_0x7644('0x5d')]);return db[_0x7644('0xe5')][_0x7644('0x28')]({'where':_0x4516de[_0x7644('0x44')]})[_0x7644('0x16')](function(_0x350766){_0x305870[_0x7644('0x28')]=_0x350766;if(_0x14f037[_0x7644('0x45')]['includeAll']){_0x4516de[_0x7644('0x47')]=[{'all':!![]}];}return db[_0x7644('0xe5')][_0x7644('0x4c')](_0x4516de);})['then'](function(_0x3a1104){_0x305870['rows']=_0x3a1104;return _0x305870;});}})[_0x7644('0x16')](respondWithFilteredResult(_0x5c46fd,_0x4516de))[_0x7644('0x21')](handleError(_0x5c46fd,null));};exports['getSmsInteractions']=function(_0x4c3576,_0x4e98dd){var _0x502b55={};var _0x3df889={};var _0x3855ea;var _0x4a4909;return db[_0x7644('0x3e')]['findOne']({'where':{'id':_0x4c3576[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x4e98dd,null))[_0x7644('0x16')](function(_0x3656e5){if(_0x3656e5){_0x3855ea=_0x3656e5;_0x3df889[_0x7644('0x57')]=_[_0x7644('0x58')](db[_0x7644('0xe6')][_0x7644('0x3f')]);_0x3df889[_0x7644('0x45')]=_[_0x7644('0x58')](_0x4c3576[_0x7644('0x45')]);_0x3df889[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x3df889[_0x7644('0x57')],_0x3df889[_0x7644('0x45')]);_0x502b55[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x3df889['model'],qs[_0x7644('0x5b')](_0x4c3576[_0x7644('0x45')]['fields']));_0x502b55[_0x7644('0x4a')]=_0x502b55[_0x7644('0x4a')]['length']?_0x502b55[_0x7644('0x4a')]:_0x3df889[_0x7644('0x57')];_0x502b55[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x4c3576['query'][_0x7644('0xd1')]);_0x502b55[_0x7644('0x44')]=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0x4c3576['query'],_0x3df889[_0x7644('0xcf')]));if(_0x4c3576[_0x7644('0x45')][_0x7644('0x35')]){_0x502b55[_0x7644('0x44')]=_['merge'](_0x502b55[_0x7644('0x44')],{'$or':_[_0x7644('0x37')](_0x502b55[_0x7644('0x4a')],function(_0x3647cc){var _0x390cd3={};_0x390cd3[_0x3647cc]={'$like':'%'+_0x4c3576[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x390cd3;})});}_0x502b55=_[_0x7644('0x5c')]({},_0x502b55,_0x4c3576[_0x7644('0x5d')]);return _0x3855ea[_0x7644('0xe7')](_0x502b55);}})[_0x7644('0x16')](function(_0x431019){if(_0x431019){_0x4a4909=_0x431019[_0x7644('0x6c')];if(!_0x4c3576[_0x7644('0x45')][_0x7644('0xd3')]('nolimit')){_0x502b55[_0x7644('0xd9')]=qs['limit'](_0x4c3576['query'][_0x7644('0xd9')]);_0x502b55['offset']=qs[_0x7644('0x26')](_0x4c3576[_0x7644('0x45')][_0x7644('0x26')]);}return _0x3855ea[_0x7644('0xe7')](_0x502b55);}})[_0x7644('0x16')](function(_0x1dfae0){if(_0x1dfae0){return _0x1dfae0?{'count':_0x4a4909,'rows':_0x1dfae0}:null;}})['then'](respondWithResult(_0x4e98dd,null))['catch'](handleError(_0x4e98dd,null));};exports[_0x7644('0xe8')]=function(_0x36e3f5,_0x74db9d){var _0x59d2fe={};var _0xcf92a8={};var _0x37b929;var _0x400847;return db['User'][_0x7644('0x9a')]({'where':{'id':_0x36e3f5[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x74db9d,null))[_0x7644('0x16')](function(_0x127d78){if(_0x127d78){_0x37b929=_0x127d78;_0xcf92a8[_0x7644('0x57')]=_[_0x7644('0x58')](db[_0x7644('0xe9')][_0x7644('0x3f')]);_0xcf92a8[_0x7644('0x45')]=_[_0x7644('0x58')](_0x36e3f5[_0x7644('0x45')]);_0xcf92a8[_0x7644('0xcf')]=_['intersection'](_0xcf92a8[_0x7644('0x57')],_0xcf92a8[_0x7644('0x45')]);_0x59d2fe[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0xcf92a8['model'],qs[_0x7644('0x5b')](_0x36e3f5[_0x7644('0x45')][_0x7644('0x5b')]));_0x59d2fe[_0x7644('0x4a')]=_0x59d2fe[_0x7644('0x4a')][_0x7644('0x6c')]?_0x59d2fe[_0x7644('0x4a')]:_0xcf92a8['model'];_0x59d2fe['order']=qs['sort'](_0x36e3f5[_0x7644('0x45')][_0x7644('0xd1')]);_0x59d2fe[_0x7644('0x44')]=qs[_0x7644('0xcf')](_[_0x7644('0xd2')](_0x36e3f5['query'],_0xcf92a8[_0x7644('0xcf')]));if(_0x36e3f5[_0x7644('0x45')][_0x7644('0x35')]){_0x59d2fe[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x59d2fe[_0x7644('0x44')],{'$or':_[_0x7644('0x37')](_0x59d2fe[_0x7644('0x4a')],function(_0x5f04aa){var _0x3ae8fb={};_0x3ae8fb[_0x5f04aa]={'$like':'%'+_0x36e3f5[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x3ae8fb;})});}_0x59d2fe=_[_0x7644('0x5c')]({},_0x59d2fe,_0x36e3f5[_0x7644('0x5d')]);return _0x37b929['getFaxInteractions'](_0x59d2fe);}})[_0x7644('0x16')](function(_0x42baf3){if(_0x42baf3){_0x400847=_0x42baf3['length'];if(!_0x36e3f5[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0xd8'))){_0x59d2fe[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0x36e3f5[_0x7644('0x45')]['limit']);_0x59d2fe[_0x7644('0x26')]=qs['offset'](_0x36e3f5[_0x7644('0x45')][_0x7644('0x26')]);}return _0x37b929[_0x7644('0xe8')](_0x59d2fe);}})['then'](function(_0x27f320){if(_0x27f320){return _0x27f320?{'count':_0x400847,'rows':_0x27f320}:null;}})[_0x7644('0x16')](respondWithResult(_0x74db9d,null))['catch'](handleError(_0x74db9d,null));};exports[_0x7644('0xea')]=function(_0x2cf03b,_0x5b75ec){var _0x54b5ec={};var _0x2da2f8={};var _0x37abb2;var _0x4853ee;return db[_0x7644('0x3e')]['findOne']({'where':{'id':_0x2cf03b[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x5b75ec,null))[_0x7644('0x16')](function(_0xad1103){if(_0xad1103){_0x37abb2=_0xad1103;_0x2da2f8['model']=_[_0x7644('0x58')](db[_0x7644('0xeb')][_0x7644('0x3f')]);_0x2da2f8[_0x7644('0x45')]=_['keys'](_0x2cf03b[_0x7644('0x45')]);_0x2da2f8['filters']=_['intersection'](_0x2da2f8[_0x7644('0x57')],_0x2da2f8[_0x7644('0x45')]);_0x54b5ec[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x2da2f8[_0x7644('0x57')],qs[_0x7644('0x5b')](_0x2cf03b[_0x7644('0x45')][_0x7644('0x5b')]));_0x54b5ec[_0x7644('0x4a')]=_0x54b5ec[_0x7644('0x4a')][_0x7644('0x6c')]?_0x54b5ec[_0x7644('0x4a')]:_0x2da2f8[_0x7644('0x57')];_0x54b5ec[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x2cf03b['query'][_0x7644('0xd1')]);_0x54b5ec[_0x7644('0x44')]=qs[_0x7644('0xcf')](_['pick'](_0x2cf03b['query'],_0x2da2f8[_0x7644('0xcf')]));if(_0x2cf03b['query']['filter']){_0x54b5ec[_0x7644('0x44')]=_[_0x7644('0x5c')](_0x54b5ec[_0x7644('0x44')],{'$or':_[_0x7644('0x37')](_0x54b5ec[_0x7644('0x4a')],function(_0x1cbbbe){var _0x3d37b0={};_0x3d37b0[_0x1cbbbe]={'$like':'%'+_0x2cf03b[_0x7644('0x45')][_0x7644('0x35')]+'%'};return _0x3d37b0;})});}_0x54b5ec=_[_0x7644('0x5c')]({},_0x54b5ec,_0x2cf03b[_0x7644('0x5d')]);return _0x37abb2[_0x7644('0xea')](_0x54b5ec);}})['then'](function(_0x536b83){if(_0x536b83){_0x4853ee=_0x536b83[_0x7644('0x6c')];if(!_0x2cf03b[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0xd8'))){_0x54b5ec['limit']=qs['limit'](_0x2cf03b['query']['limit']);_0x54b5ec[_0x7644('0x26')]=qs[_0x7644('0x26')](_0x2cf03b[_0x7644('0x45')][_0x7644('0x26')]);}return _0x37abb2[_0x7644('0xea')](_0x54b5ec);}})[_0x7644('0x16')](function(_0x428930){if(_0x428930){return _0x428930?{'count':_0x4853ee,'rows':_0x428930}:null;}})[_0x7644('0x16')](respondWithResult(_0x5b75ec,null))[_0x7644('0x21')](handleError(_0x5b75ec,null));};exports[_0x7644('0xec')]=function(_0x2a2694,_0xb8824f,_0x254371){var _0x193ac6;var _0x54dd7e;var _0x2baee3;var _0x5561fe=!_[_0x7644('0x68')](_0x2a2694[_0x7644('0x56')]['id'])?_0x2a2694['params']['id']:!_['isNil'](_0x2a2694[_0x7644('0x7e')]['id'])?_0x2a2694[_0x7644('0x7e')]['id']:null;return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x5561fe,'role':{'$or':[_0x7644('0x30'),_0x7644('0x7e'),_0x7644('0x32')]}},'attributes':['id','name','phone',_0x7644('0xed'),_0x7644('0x2f'),_0x7644('0x67'),'loginInPause']})['then'](function(_0x538db4){if(_0x538db4){if(_0x538db4[_0x7644('0x2f')]==='agent'){_0x193ac6=_0x538db4;if(_0x2a2694[_0x7644('0x5f')][_0x7644('0xa4')]){_0x2baee3=util['format'](_0x7644('0xee'),_0x193ac6[_0x2a2694[_0x7644('0x5f')][_0x7644('0xa4')]]);}else if(_0x2a2694[_0x7644('0x5f')][_0x7644('0xef')]){_0x2baee3=util['format'](_0x7644('0xb0'),_0x2a2694[_0x7644('0x5f')]['intrf']);}else{_0x2baee3=util[_0x7644('0xf0')]('SIP/%s',_0x193ac6['name']);}socket['to'](util[_0x7644('0xf0')](_0x7644('0xf1'),_0x193ac6['name']))[_0x7644('0x2b')](_0x7644('0xf2'),{'user':{'id':_0x193ac6['id'],'name':_0x193ac6[_0x7644('0x3b')]},'ip':_0x2a2694[_0x7644('0xf3')][_0x7644('0xf4')]||_0x2a2694[_0x7644('0xf5')]['remoteAddress']||_0x2a2694['socket'][_0x7644('0xf6')]||_0x2a2694[_0x7644('0xf5')][_0x7644('0xf7')][_0x7644('0xf6')]});return db[_0x7644('0xb5')][_0x7644('0x2d')]({'where':{'membername':_0x193ac6[_0x7644('0x3b')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7644('0x93'))](_0x7644('0xf8'));}})[_0x7644('0x16')](function(){if(_0x193ac6){return _0x193ac6[_0x7644('0xf9')]({'raw':!![]});}})[_0x7644('0x16')](function(_0x53abc5){if(_0x193ac6){var _0x3167e8=[];if(_0x53abc5){_0x54dd7e=_0x53abc5;if(_0x54dd7e[_0x7644('0x6c')]){for(var _0x2e66f2=0x0;_0x2e66f2<_0x54dd7e[_0x7644('0x6c')];_0x2e66f2++){_0x3167e8[_0x7644('0x4b')]({'membername':_0x193ac6[_0x7644('0x3b')],'UserId':_0x193ac6['id'],'queue_name':_0x54dd7e[_0x2e66f2][_0x7644('0x3b')],'VoiceQueueId':_0x54dd7e[_0x2e66f2]['id'],'interface':_0x2baee3,'paused':_0x193ac6[_0x7644('0xa2')]||![],'penalty':_0x54dd7e[_0x2e66f2]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x7644('0x8e')](_0x3167e8,function(_0x57a008){return db[_0x7644('0xb5')][_0x7644('0xb1')](_0x57a008);});}}}})[_0x7644('0x16')](function(){if(_0x193ac6){return db['MemberReport'][_0x7644('0x4c')]({'where':{'membername':_0x193ac6[_0x7644('0x3b')],'exitAt':null}});}})[_0x7644('0x16')](function(_0x5bd146){if(_0x193ac6){var _0x3d7150=[];_0x5bd146[_0x7644('0xfa')](function(_0x581592){_0x3d7150[_0x7644('0x4b')](_0x581592[_0x7644('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x3d7150);}})['then'](function(){if(_0x193ac6){var _0x5995ae=[];var _0x26decb=[];var _0x45a994=utils[_0x7644('0xfb')]();var _0x423f8e={'membername':_0x193ac6['name'],'interface':_0x2baee3,'enterAt':moment()[_0x7644('0xf0')](_0x7644('0xfc')),'role':_0x193ac6[_0x7644('0x2f')],'internal':_0x193ac6[_0x7644('0x67')]};_0x45a994[_0x7644('0xfa')](function(_0x4dd6a2){_0x5995ae[_0x7644('0x4b')](_[_0x7644('0x5c')]({'channel':_0x4dd6a2,'type':'LOGIN','data1':_0x2a2694['body'][_0x7644('0xfd')],'data2':_0x2baee3},_0x423f8e));if(_0x193ac6[_0x7644('0xa2')]){_0x26decb[_0x7644('0x4b')](_[_0x7644('0x5c')]({'channel':_0x4dd6a2,'type':'PAUSE','data1':_0x7644('0xfe')},_0x423f8e));}});return db[_0x7644('0xff')][_0x7644('0x8a')](_0x5995ae[_0x7644('0xcc')](_0x26decb),{'individualHooks':!![]});}})[_0x7644('0x16')](function(){if(_0x193ac6){return _0x193ac6[_0x7644('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x7644('0xfc')),'voicePause':_0x193ac6[_0x7644('0xa2')]||![],'mailPause':_0x193ac6[_0x7644('0xa2')]||![],'chatPause':_0x193ac6[_0x7644('0xa2')]||![],'faxPause':_0x193ac6[_0x7644('0xa2')]||![],'smsPause':_0x193ac6[_0x7644('0xa2')]||![],'openchannelPause':_0x193ac6['loginInPause']||![],'whatsappPause':_0x193ac6[_0x7644('0xa2')]||![],'pauseType':_0x193ac6['loginInPause']?'LOGININPAUSE':null,'interface':_0x2baee3,'lastPauseAt':moment()[_0x7644('0xf0')](_0x7644('0xfc'))});}})['then'](function(_0x595f85){if(_0x2a2694[_0x7644('0x100')]){return _0x254371();}else{return BPromise[_0x7644('0x101')](_0x595f85)['then'](respondWithResult(_0xb8824f,null));}})[_0x7644('0x21')](handleError(_0xb8824f,null));};exports[_0x7644('0x102')]=function(_0x2c3e50,_0x272907){var _0x14cc30;return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x2c3e50[_0x7644('0x56')]['id'],'role':_0x7644('0x32')},'attributes':['id',_0x7644('0x3b'),_0x7644('0x2f')]})[_0x7644('0x16')](handleEntityNotFound(_0x272907,null))['then'](function(_0xa8aaab){if(_0xa8aaab){_0x14cc30=_0xa8aaab;return db[_0x7644('0xb5')]['destroy']({'where':{'membername':_0x14cc30['name']},'individualHooks':!![]});}})[_0x7644('0x16')](function(){return db[_0x7644('0xff')]['findAll']({'where':{'membername':_0x14cc30[_0x7644('0x3b')],'exitAt':null}});})['then'](function(_0x44bfde){var _0x50ab85=[];_0x44bfde[_0x7644('0xfa')](function(_0x2afe7b){_0x50ab85[_0x7644('0x4b')](_0x2afe7b[_0x7644('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7644('0x8d')](_0x50ab85);})[_0x7644('0x16')](function(){return _0x14cc30[_0x7644('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x272907,null))[_0x7644('0x21')](handleError(_0x272907,null));};exports['pause']=function(_0x38b1a6,_0x23de22){var _0x3611c2;return db[_0x7644('0xb5')][_0x7644('0x2a')]({'paused':0x1},{'where':{'UserId':_0x38b1a6[_0x7644('0x56')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x7644('0x3e')]['find']({'where':{'id':_0x38b1a6[_0x7644('0x56')]['id'],'role':_0x7644('0x32')},'attributes':['id',_0x7644('0x3b'),'role',_0x7644('0x67'),_0x7644('0xa4')]});})[_0x7644('0x16')](handleEntityNotFound(_0x23de22,null))[_0x7644('0x16')](function(_0x4df9d2){if(_0x4df9d2){_0x3611c2=_0x4df9d2;return respondWithRpcPromise(_0x7644('0x103'),'pause',{'id':_0x3611c2['id'],'name':_0x3611c2[_0x7644('0x3b')],'pause':!![]});}})[_0x7644('0x16')](function(){if(_0x3611c2){return db[_0x7644('0xff')]['findAll']({'where':{'membername':_0x3611c2[_0x7644('0x3b')],'type':_0x7644('0x104'),'exitAt':null}});}})[_0x7644('0x16')](function(_0x1dc110){if(_0x1dc110[_0x7644('0x6c')]){var _0x20a3b5=moment()[_0x7644('0xf0')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x48700a=0x0,_0xb48464=_0x1dc110['length'];_0x48700a<_0xb48464;_0x48700a++){_0x1dc110[_0x48700a][_0x7644('0x105')]({'exitAt':_0x20a3b5});}}})[_0x7644('0x16')](function(){var _0x2b6217=[];var _0x156950=utils['getChannels']();_0x156950['forEach'](function(_0x57f31c){_0x2b6217[_0x7644('0x4b')]({'channel':_0x57f31c,'membername':_0x3611c2[_0x7644('0x3b')],'interface':_[_0x7644('0x68')](_0x3611c2[_0x7644('0xa4')])?util['format']('SIP/%s',_0x3611c2[_0x7644('0x3b')]):_0x3611c2[_0x7644('0xa4')],'type':'PAUSE','enterAt':moment()['format'](_0x7644('0xfc')),'data1':_0x38b1a6[_0x7644('0x5f')]['type']||'DEFAULT\x20PAUSE','role':_0x3611c2['role'],'internal':_0x3611c2[_0x7644('0x67')]});});return db['MemberReport']['bulkCreate'](_0x2b6217,{'individualHooks':!![]});})[_0x7644('0x16')](function(){return _0x3611c2[_0x7644('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x38b1a6[_0x7644('0x5f')]['type']||_0x7644('0x106'),'lastPauseAt':moment()[_0x7644('0xf0')](_0x7644('0xfc'))});})[_0x7644('0x16')](respondWithResult(_0x23de22,null))[_0x7644('0x21')](handleError(_0x23de22,null));};exports[_0x7644('0x107')]=function(_0x94e0ba,_0x214b73){var _0xdc51e3;return db[_0x7644('0x3e')][_0x7644('0x3a')]({'where':{'id':_0x94e0ba[_0x7644('0x56')]['id']},'attributes':['id',_0x7644('0x3b'),'role',_0x7644('0xa3'),_0x7644('0x108'),'chatPause',_0x7644('0x109'),_0x7644('0x10a'),'smsPause',_0x7644('0x10b'),_0x7644('0x10c'),_0x7644('0x10d')]})[_0x7644('0x16')](handleEntityNotFound(_0x214b73,null))[_0x7644('0x16')](function(_0x3705b0){if(_0x3705b0){_0xdc51e3=_0x3705b0;if(_0x94e0ba['body'][_0x7644('0xa1')]&&!utils[_0x7644('0xda')](_0x94e0ba[_0x7644('0x5f')][_0x7644('0xa1')])){throw new db['Sequelize'][(_0x7644('0x93'))]('Unknown\x20channel');}switch(_0x94e0ba[_0x7644('0x5f')]['channel']){case'voice':return respondWithRpcPromise('QueuePause',_0x7644('0x107'),{'id':_0xdc51e3['id'],'name':_0xdc51e3[_0x7644('0x3b')],'pause':![]})[_0x7644('0x16')](function(){return db['UserVoiceQueueRt'][_0x7644('0x2a')]({'paused':0x0},{'where':{'UserId':_0xdc51e3['id']},'individualHooks':!![]});})[_0x7644('0x16')](function(){return db[_0x7644('0xff')]['find']({'where':{'channel':_0x94e0ba[_0x7644('0x5f')][_0x7644('0xa1')],'membername':_0xdc51e3[_0x7644('0x3b')],'type':_0x7644('0x104'),'exitAt':null}});})[_0x7644('0x16')](function(_0x1ce7a9){if(_0x1ce7a9){return _0x1ce7a9[_0x7644('0x2a')]({'exitAt':moment()[_0x7644('0xf0')](_0x7644('0xfc')),'data2':_0x7644('0x10e')},{'individualHooks':!![]});}return null;})['then'](function(){return _0xdc51e3[_0x7644('0x2a')]({'voicePause':![]});});case _0x7644('0x54'):case _0x7644('0x50'):case _0x7644('0x53'):case _0x7644('0x52'):case'whatsapp':case _0x7644('0x5e'):return db[_0x7644('0xff')][_0x7644('0x3a')]({'where':{'channel':_0x94e0ba[_0x7644('0x5f')][_0x7644('0xa1')],'membername':_0xdc51e3[_0x7644('0x3b')],'type':'PAUSE','exitAt':null}})[_0x7644('0x16')](function(_0x418c43){if(_0x418c43){return _0x418c43[_0x7644('0x2a')]({'exitAt':moment()[_0x7644('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x7644('0x10e')},{'individualHooks':!![]});}return null;})[_0x7644('0x16')](function(){var _0x2ddc25={};_[_0x7644('0x29')](_0x2ddc25,util[_0x7644('0xf0')]('%s%s',_0x94e0ba[_0x7644('0x5f')]['channel'],_0x7644('0x10f')),![]);return _0xdc51e3['update'](_0x2ddc25);});default:return respondWithRpcPromise(_0x7644('0x103'),'unpause',{'id':_0xdc51e3['id'],'name':_0xdc51e3[_0x7644('0x3b')],'pause':![]})[_0x7644('0x16')](function(){return db[_0x7644('0xb5')][_0x7644('0x2a')]({'paused':0x0},{'where':{'UserId':_0xdc51e3['id']}});})['then'](function(){return db[_0x7644('0xff')][_0x7644('0x4c')]({'where':{'membername':_0xdc51e3[_0x7644('0x3b')],'type':_0x7644('0x104'),'exitAt':null}});})[_0x7644('0x16')](function(_0x21b76f){var _0x5359a9=[];_0x21b76f[_0x7644('0xfa')](function(_0x1d06fe){_0x5359a9[_0x7644('0x4b')](_0x1d06fe['update']({'exitAt':moment()[_0x7644('0xf0')](_0x7644('0xfc')),'data2':_0x7644('0x10e')}));});return BPromise['all'](_0x5359a9);})['then'](function(){return _0xdc51e3[_0x7644('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x7644('0x16')](respondWithResult(_0x214b73,null))['catch'](handleError(_0x214b73,null));};exports[_0x7644('0x110')]=function(_0x31eff9,_0x2b01eb){var _0xd17290={};var _0x25d008={};var _0x419787;var _0x23fd67;return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x31eff9['params']['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x2b01eb,null))[_0x7644('0x16')](function(_0x24b7ea){if(_0x24b7ea){_0x419787=_0x24b7ea;_0x25d008[_0x7644('0x57')]=_[_0x7644('0x58')](db[_0x7644('0x111')][_0x7644('0x3f')]);_0x25d008[_0x7644('0x45')]=_[_0x7644('0x58')](_0x31eff9[_0x7644('0x45')]);_0x25d008[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0x25d008[_0x7644('0x57')],_0x25d008[_0x7644('0x45')]);_0xd17290[_0x7644('0x4a')]=_['intersection'](_0x25d008[_0x7644('0x57')],qs[_0x7644('0x5b')](_0x31eff9[_0x7644('0x45')][_0x7644('0x5b')]));_0xd17290[_0x7644('0x4a')]=_0xd17290[_0x7644('0x4a')]['length']?_0xd17290['attributes']:_0x25d008[_0x7644('0x57')];_0xd17290['order']=qs[_0x7644('0xd1')](_0x31eff9[_0x7644('0x45')]['sort']);_0xd17290[_0x7644('0x44')]=qs[_0x7644('0xcf')](_['pick'](_0x31eff9['query'],_0x25d008[_0x7644('0xcf')]));if(_0x31eff9[_0x7644('0x45')]['filter']){_0xd17290[_0x7644('0x44')]=_['merge'](_0xd17290['where'],{'$or':_[_0x7644('0x37')](_0xd17290[_0x7644('0x4a')],function(_0x588e0f){var _0x134d8b={};_0x134d8b[_0x588e0f]={'$like':'%'+_0x31eff9[_0x7644('0x45')]['filter']+'%'};return _0x134d8b;})});}_0xd17290=_[_0x7644('0x5c')]({},_0xd17290,_0x31eff9[_0x7644('0x5d')]);return _0x419787[_0x7644('0x110')](_0xd17290);}})[_0x7644('0x16')](function(_0x118330){if(_0x118330){_0x23fd67=_0x118330[_0x7644('0x6c')];if(!_0x31eff9[_0x7644('0x45')]['hasOwnProperty'](_0x7644('0xd8'))){_0xd17290[_0x7644('0xd9')]=qs['limit'](_0x31eff9[_0x7644('0x45')]['limit']);_0xd17290['offset']=qs[_0x7644('0x26')](_0x31eff9[_0x7644('0x45')][_0x7644('0x26')]);}return _0x419787[_0x7644('0x110')](_0xd17290);}})['then'](function(_0x4c0f25){if(_0x4c0f25){return _0x4c0f25?{'count':_0x23fd67,'rows':_0x4c0f25}:null;}})[_0x7644('0x16')](respondWithResult(_0x2b01eb,null))[_0x7644('0x21')](handleError(_0x2b01eb,null));};exports[_0x7644('0x112')]=function(_0x3ebfad,_0x51f0aa){var _0xa7d08=_0x3ebfad[_0x7644('0x56')]['id'];var _0x2391a9=_0x3ebfad[_0x7644('0x5f')]?_0x3ebfad[_0x7644('0x5f')][_0x7644('0x62')]:null;var _0x41fd07=[];return Promise['resolve']()['then'](function(){if(!_0x2391a9)throw new APIBadRequestError(_0x7644('0x113'));})['then'](function(){return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0xa7d08}});})[_0x7644('0x16')](function(_0x2edadb){if(!_0x2edadb)throw new APINotFoundError(util[_0x7644('0xf0')](_0x7644('0x114'),_0x3ebfad[_0x7644('0x56')]['id']));return db[_0x7644('0x6a')][_0x7644('0x115')](function(_0x5c0ba7){return _0x2edadb['addTeams'](_0x2391a9,{'transaction':_0x5c0ba7})['then'](function(){return db['Team'][_0x7644('0x4c')]({'where':{'id':{'$in':_0x2391a9}}});})[_0x7644('0x16')](function(_0x425ebd){var _0xa2a8f5=_[_0x7644('0x37')](_0x425ebd,function(_0x14f6c6){return _0x14f6c6['getAssociatedQueues']();});return Promise[_0x7644('0x8d')](_0xa2a8f5);})[_0x7644('0x16')](function(_0x4dc0ec){_0x41fd07=_['flattenDeep'](_0x4dc0ec);var _0x26c23e=_['map'](_0x41fd07,function(_0x6d3fdb){return _0x6d3fdb[_0x7644('0x116')](_0x2edadb['id'],{'transaction':_0x5c0ba7});});return Promise['all'](_0x26c23e);})['then'](function(){if(!_0x2edadb[_0x7644('0xaf')])return;var _0x22f497=_[_0x7644('0x35')](_0x41fd07,function(_0x41c9bd){return _0x41c9bd[_0x7644('0x117')](_0x7644('0xa1'))==='Voice';});var _0x349c36=_['map'](_0x22f497,function(_0xff1f9a){return db['UserVoiceQueueRt'][_0x7644('0xb1')]({'membername':_0x2edadb[_0x7644('0x3b')],'UserId':_0x2edadb['id'],'queue_name':_0xff1f9a[_0x7644('0x3b')],'VoiceQueueId':_0xff1f9a['id'],'interface':_['isNil'](_0x2edadb[_0x7644('0xa4')])?util[_0x7644('0xf0')](_0x7644('0xb0'),_0x2edadb[_0x7644('0x3b')]):_0x2edadb[_0x7644('0xa4')],'paused':_0x2edadb[_0x7644('0xa3')]||![],'penalty':_0x2edadb[_0x7644('0xa9')]},{'transaction':_0x5c0ba7});});return Promise['all'](_0x349c36);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x2391a9}}});})[_0x7644('0x16')](function(_0x20f73d){var _0x52d8f2=_['map'](_0x20f73d,function(_0x2451cb){return db[_0x7644('0x118')][_0x7644('0x88')]({'UserId':_0x2edadb['id'],'VoicePrefixId':_0x2451cb[_0x7644('0x119')]},{'transaction':_0x5c0ba7});});return Promise[_0x7644('0x8d')](_0x52d8f2);});});})[_0x7644('0x16')](function(){for(var _0x4a15d=0x0;_0x4a15d<_0x41fd07['length'];_0x4a15d++){var _0x41e128=_0x41fd07[_0x4a15d]['getDataValue']('channel');var _0x163f1b=_0x41e128+_0x7644('0xab');socket[_0x7644('0x2b')](_0x7644('0x7e')+_0x41e128+_0x7644('0xac'),{'UserId':_0xa7d08,['queueField']:_0x41fd07[_0x4a15d]['id']});}})[_0x7644('0x16')](respondWithStatusCode(_0x51f0aa,null))[_0x7644('0x21')](APIHandleError(_0x51f0aa));};exports[_0x7644('0x11a')]=function(_0x3eb97c,_0x4cff6f){var _0x32f262=_0x3eb97c['params']['id'];var _0x3fee32=null;if(_0x3eb97c[_0x7644('0x45')]['ids']){_0x3fee32=_[_0x7644('0xb3')](_0x3eb97c['query'][_0x7644('0x62')])?_0x3eb97c['query']['ids']:[_0x3eb97c['query'][_0x7644('0x62')]];}var _0x39cd56=[];return Promise[_0x7644('0x101')]()[_0x7644('0x16')](function(){if(!_0x3fee32)throw new APIBadRequestError(_0x7644('0x11b'));})['then'](function(){return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x32f262}});})[_0x7644('0x16')](function(_0xe6e9f3){if(!_0xe6e9f3)throw new APINotFoundError(util[_0x7644('0xf0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3eb97c[_0x7644('0x56')]['id']));return db[_0x7644('0x6a')]['transaction'](function(_0x4c3d5d){return _0xe6e9f3['removeTeams'](_0x3fee32,{'transaction':_0x4c3d5d})[_0x7644('0x16')](function(){return db['Team'][_0x7644('0x4c')]({'where':{'id':{'$in':_0x3fee32}}});})['then'](function(_0x313ed7){var _0x54fb6b=_['map'](_0x313ed7,function(_0x239161){return _0x239161[_0x7644('0x11c')]();});return Promise[_0x7644('0x8d')](_0x54fb6b);})['then'](function(_0xfa3e22){_0x39cd56=_['flattenDeep'](_0xfa3e22);var _0xefce31=_['map'](_0x39cd56,function(_0x5b1d6a){return _0x5b1d6a[_0x7644('0x11d')](_0xe6e9f3['id'],{'transaction':_0x4c3d5d});});return Promise[_0x7644('0x8d')](_0xefce31);})[_0x7644('0x16')](function(){if(!_0xe6e9f3[_0x7644('0xaf')])return;var _0x16690f=_['filter'](_0x39cd56,function(_0x1cc116){return _0x1cc116[_0x7644('0x117')](_0x7644('0xa1'))===_0x7644('0x11e');});var _0xc00146=_[_0x7644('0x37')](_0x16690f,function(_0x58ceba){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x58ceba['id'],'UserId':_0xe6e9f3['id']},'transaction':_0x4c3d5d});});return Promise[_0x7644('0x8d')](_0xc00146);})['then'](function(){return db[_0x7644('0x11f')]['findAll']({'where':{'teamId':{'$in':_0x3fee32}}});})[_0x7644('0x16')](function(_0x2d51a5){var _0x371434=_[_0x7644('0x37')](_0x2d51a5,function(_0x5e23dc){return db[_0x7644('0x118')][_0x7644('0x2d')]({'where':{'UserId':_0xe6e9f3['id'],'VoicePrefixId':_0x5e23dc['VoicePrefixId']}},{'transaction':_0x4c3d5d});});return Promise['all'](_0x371434);});});})['then'](function(){for(var _0x2f866c=0x0;_0x2f866c<_0x39cd56[_0x7644('0x6c')];_0x2f866c++){var _0x3e5cbc=_0x39cd56[_0x2f866c]['getDataValue'](_0x7644('0xa1'));var _0x920e97=_0x3e5cbc+_0x7644('0xab');socket['emit'](_0x7644('0x7e')+_0x3e5cbc+_0x7644('0xb4'),{'UserId':_0x32f262,['queueField']:_0x39cd56[_0x2f866c]['id']});}})[_0x7644('0x16')](respondWithStatusCode(_0x4cff6f,null))[_0x7644('0x21')](APIHandleError(_0x4cff6f));};exports[_0x7644('0x120')]=function(_0x455dd3,_0xf0dc3e){var _0x2062ea={};var _0xffbe2c={};var _0x3df448;var _0x5488a0;return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x455dd3[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0xf0dc3e,null))['then'](function(_0x562ddc){if(_0x562ddc){_0x3df448=_0x562ddc;_0xffbe2c['model']=_[_0x7644('0x58')](db[_0x7644('0xd4')][_0x7644('0x3f')]);_0xffbe2c['query']=_[_0x7644('0x58')](_0x455dd3[_0x7644('0x45')]);_0xffbe2c[_0x7644('0xcf')]=_[_0x7644('0x5a')](_0xffbe2c[_0x7644('0x57')],_0xffbe2c['query']);_0x2062ea[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0xffbe2c['model'],qs[_0x7644('0x5b')](_0x455dd3[_0x7644('0x45')][_0x7644('0x5b')]));_0x2062ea['attributes']=_0x2062ea['attributes'][_0x7644('0x6c')]?_0x2062ea['attributes']:_0xffbe2c[_0x7644('0x57')];_0x2062ea[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x455dd3[_0x7644('0x45')][_0x7644('0xd1')]);_0x2062ea[_0x7644('0x44')]=qs[_0x7644('0xcf')](_['pick'](_0x455dd3['query'],_0xffbe2c[_0x7644('0xcf')]));if(_0x455dd3['query'][_0x7644('0x35')]){_0x2062ea['where']=_['merge'](_0x2062ea['where'],{'$or':_[_0x7644('0x37')](_0x2062ea[_0x7644('0x4a')],function(_0xea2b97){var _0x15108a={};_0x15108a[_0xea2b97]={'$like':'%'+_0x455dd3[_0x7644('0x45')]['filter']+'%'};return _0x15108a;})});}_0x2062ea=_['merge']({},_0x2062ea,_0x455dd3[_0x7644('0x5d')]);return _0x3df448[_0x7644('0x120')](_0x2062ea);}})['then'](function(_0x26a62c){if(_0x26a62c){_0x5488a0=_0x26a62c[_0x7644('0x6c')];if(!_0x455dd3[_0x7644('0x45')][_0x7644('0xd3')](_0x7644('0xd8'))){_0x2062ea[_0x7644('0xd9')]=qs[_0x7644('0xd9')](_0x455dd3[_0x7644('0x45')][_0x7644('0xd9')]);_0x2062ea[_0x7644('0x26')]=qs[_0x7644('0x26')](_0x455dd3['query'][_0x7644('0x26')]);}return _0x3df448[_0x7644('0x120')](_0x2062ea);}})['then'](function(_0x1815db){if(_0x1815db){return _0x1815db?{'count':_0x5488a0,'rows':_0x1815db}:null;}})[_0x7644('0x16')](respondWithResult(_0xf0dc3e,null))['catch'](handleError(_0xf0dc3e,null));};exports['getAgents']=function(_0x5ca03c,_0x1d3e86){var _0x5a455b={};var _0x2d7177={};var _0x36fd25;return db[_0x7644('0x3e')][_0x7644('0x9a')]({'where':{'id':_0x5ca03c[_0x7644('0x56')]['id']}})[_0x7644('0x16')](handleEntityNotFound(_0x1d3e86,null))[_0x7644('0x16')](function(_0x5a84bd){if(_0x5a84bd){_0x36fd25=_0x5a84bd;_0x2d7177[_0x7644('0x57')]=_[_0x7644('0x58')](db[_0x7644('0x3e')][_0x7644('0x3f')]);_0x2d7177[_0x7644('0x45')]=_['keys'](_0x5ca03c[_0x7644('0x45')]);_0x2d7177['filters']=_[_0x7644('0x5a')](_0x2d7177[_0x7644('0x57')],_0x2d7177[_0x7644('0x45')]);_0x5a455b[_0x7644('0x4a')]=_[_0x7644('0x5a')](_0x2d7177['model'],qs['fields'](_0x5ca03c[_0x7644('0x45')][_0x7644('0x5b')]));_0x5a455b[_0x7644('0x4a')]=_0x5a455b['attributes'][_0x7644('0x6c')]?_0x5a455b[_0x7644('0x4a')]:_0x2d7177[_0x7644('0x57')];_0x5a455b[_0x7644('0xd0')]=qs[_0x7644('0xd1')](_0x5ca03c[_0x7644('0x45')][_0x7644('0xd1')]);_0x5a455b[_0x7644('0x44')]=qs['filters'](_[_0x7644('0xd2')](_0x5ca03c[_0x7644('0x45')],_0x2d7177['filters']));if(_0x5ca03c['query'][_0x7644('0x35')]){_0x5a455b['where']=_[_0x7644('0x5c')](_0x5a455b[_0x7644('0x44')],{'$or':_['map'](_0x5a455b[_0x7644('0x4a')],function(_0x5594e3){var _0x269d13={};_0x269d13[_0x5594e3]={'$like':'%'+_0x5ca03c['query'][_0x7644('0x35')]+'%'};return _0x269d13;})});}_0x5a455b['model']=db[_0x7644('0x3e')];_0x5a455b['as']='Agents';_0x5a455b=_[_0x7644('0x5c')]({},_0x5a455b,_0x5ca03c[_0x7644('0x5d')]);return _0x36fd25[_0x7644('0xf9')]({'include':[_0x5a455b]});}})[_0x7644('0x16')](function(_0x46a111){if(_0x46a111){var _0x932f6f={},_0x244b0b=[];for(var _0x1b8b2d=0x0;_0x1b8b2d<_0x46a111['length'];_0x1b8b2d+=0x1){for(var _0x5b2641=0x0,_0x7ff814;_0x5b2641<_0x46a111[_0x1b8b2d][_0x7644('0x31')][_0x7644('0x6c')];_0x5b2641+=0x1){_0x7ff814=_0x46a111[_0x1b8b2d][_0x7644('0x31')][_0x5b2641]['get']({'plain':!![]});_0x932f6f[_0x7ff814['id']]=_0x7ff814;}}_0x932f6f=_[_0x7644('0x121')](_0x932f6f);for(var _0x4071eb=qs[_0x7644('0x26')](_0x5ca03c[_0x7644('0x45')]['offset']);_0x4071eb<_0x932f6f[_0x7644('0x6c')]&&_0x244b0b['length']=_0x4dd415[_0x93f5('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x93f5('0x10')](function(){if(_0x351b21){return db[_0x93f5('0x40')][_0x93f5('0x51')]({'where':{'membername':_0x351b21[_0x93f5('0x2d')]},'individualHooks':!![]});}})['then'](function(){if(_0x351b21){return _0x351b21['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2f4a97){if(_0x351b21){if(_0x2f4a97){var _0x4ecd42=[];_0x1acb81=_0x2f4a97;if(_0x1acb81[_0x93f5('0x2f')]){for(var _0x2a8c69=0x0;_0x2a8c69<_0x1acb81[_0x93f5('0x2f')];_0x2a8c69++){_0x4ecd42[_0x93f5('0x34')](db[_0x93f5('0x40')][_0x93f5('0x52')]({'membername':_0x351b21['name'],'UserId':_0x351b21['id'],'queue_name':_0x1acb81[_0x2a8c69]['name'],'VoiceQueueId':_0x1acb81[_0x2a8c69]['id'],'interface':_0x536062,'paused':_0x351b21[_0x93f5('0x4b')]||![],'penalty':_0x1acb81[_0x2a8c69]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x4ecd42);}}}})[_0x93f5('0x10')](function(){if(_0x351b21){return db['MemberReport'][_0x93f5('0x1b')]({'where':{'membername':_0x351b21[_0x93f5('0x2d')],'exitAt':null}});}})['then'](function(_0x56f31e){if(_0x351b21){if(_0x56f31e&&_0x56f31e['length']){var _0x3008bd=[];_0x56f31e['forEach'](function(_0xb659d6){_0x3008bd['push'](_0xb659d6[_0x93f5('0x2b')]({'exitAt':moment()['format'](_0x93f5('0x31'))}));});return BPromise[_0x93f5('0x47')](_0x3008bd);}}})[_0x93f5('0x10')](function(_0x31f4d1){if(_0x351b21){var _0x300696=[];var _0x4d4bf3=[];var _0x4be9f0=utils['getChannels']();var _0x38eba7={'membername':_0x351b21[_0x93f5('0x2d')],'interface':_0x536062,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x351b21[_0x93f5('0x28')],'internal':_0x351b21['internal']};_0x4be9f0[_0x93f5('0x33')](function(_0x1ca298){_0x300696[_0x93f5('0x34')](_[_0x93f5('0x53')]({'channel':_0x1ca298,'type':'LOGIN','data1':_0x93f5('0x54'),'data2':_0x536062},_0x38eba7));if(_0x351b21[_0x93f5('0x4b')]){_0x4d4bf3[_0x93f5('0x34')](_['merge']({'channel':_0x1ca298,'type':_0x93f5('0x2e'),'data1':_0x93f5('0x55')},_0x38eba7));}});return db[_0x93f5('0x2c')][_0x93f5('0x39')](_0x300696['concat'](_0x4d4bf3),{'individualHooks':!![]});}})[_0x93f5('0x10')](function(){if(_0x351b21){return _0x351b21[_0x93f5('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x93f5('0x30')](_0x93f5('0x31')),'voicePause':_0x351b21['loginInPause']||![],'mailPause':_0x351b21['loginInPause']||![],'chatPause':_0x351b21[_0x93f5('0x4b')]||![],'faxPause':_0x351b21[_0x93f5('0x4b')]||![],'smsPause':_0x351b21[_0x93f5('0x4b')]||![],'openchannelPause':_0x351b21[_0x93f5('0x4b')]||![],'pauseType':_0x351b21[_0x93f5('0x4b')]?_0x93f5('0x55'):null,'lastPauseAt':moment()[_0x93f5('0x30')](_0x93f5('0x31')),'interface':_0x536062});}})[_0x93f5('0x10')](function(_0x2e94bf){_0x352a2c(_0x2e94bf);})[_0x93f5('0x26')](function(_0x2f4fcd){_0x51fa93(_0x134e46[_0x93f5('0x16')](0x1f4,_0x2f4fcd['message']));});});}; \ No newline at end of file +var _0xe1d6=['updateAttributes','getChannels','forEach','push','SIP/%s','type','body','uniqueid','MemberReport','bulkCreate','DEFAULT\x20PAUSE','findOne','isValidChannel','Unknown\x20channel','channel','voice','system','fax','openchannel','whatsapp','%s%s','Pause','UserVoiceQueueRt','LogoutUser','destroy','length','all','phone','count','agent','../../config/license/util','getLicense','agents','upsert','loginInPause','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./user.socket','register','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetUser','User','findAll','options','raw','attributes','map','include','model','then','ShowUser','find','where','PauseUser','name','role','internal','interface','update','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23d96f,_0x1153b7){var _0x2db681=function(_0x14167c){while(--_0x14167c){_0x23d96f['push'](_0x23d96f['shift']());}};_0x2db681(++_0x1153b7);}(_0xe1d6,0x180));var _0x6e1d=function(_0x63638a,_0x23e8cc){_0x63638a=_0x63638a-0x0;var _0x147568=_0xe1d6[_0x63638a];return _0x147568;};'use strict';var _=require(_0x6e1d('0x0'));var util=require(_0x6e1d('0x1'));var moment=require(_0x6e1d('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e1d('0x3'));var fs=require('fs');var Redis=require(_0x6e1d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e1d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e1d('0x6'));var jayson=require(_0x6e1d('0x7'));var client=jayson['client'][_0x6e1d('0x8')]({'port':0x232a});config['redis']=_[_0x6e1d('0x9')](config['redis'],{'host':_0x6e1d('0xa'),'port':0x18eb});var socket=require(_0x6e1d('0xb'))(new Redis(config['redis']));require(_0x6e1d('0xc'))[_0x6e1d('0xd')](socket);function respondWithRpcPromise(_0x3fd67c,_0x3dd52c,_0x199a5e){return new BPromise(function(_0xf9854d,_0x55f2da){return client['request'](_0x3fd67c,_0x199a5e)['then'](function(_0x234bdf){logger[_0x6e1d('0xe')](_0x6e1d('0xf'),_0x3dd52c,_0x6e1d('0x10'));logger[_0x6e1d('0x11')](_0x6e1d('0x12'),_0x3dd52c,_0x6e1d('0x10'),JSON[_0x6e1d('0x13')](_0x234bdf));if(_0x234bdf[_0x6e1d('0x14')]){if(_0x234bdf[_0x6e1d('0x14')]['code']===0x1f4){logger['error'](_0x6e1d('0xf'),_0x3dd52c,_0x234bdf[_0x6e1d('0x14')][_0x6e1d('0x15')]);return _0x55f2da(_0x234bdf[_0x6e1d('0x14')][_0x6e1d('0x15')]);}logger[_0x6e1d('0x14')](_0x6e1d('0xf'),_0x3dd52c,_0x234bdf['error'][_0x6e1d('0x15')]);return _0xf9854d(_0x234bdf[_0x6e1d('0x14')][_0x6e1d('0x15')]);}else{logger['info'](_0x6e1d('0xf'),_0x3dd52c,_0x6e1d('0x10'));_0xf9854d(_0x234bdf[_0x6e1d('0x16')][_0x6e1d('0x15')]);}})[_0x6e1d('0x17')](function(_0x5e9709){logger[_0x6e1d('0x14')](_0x6e1d('0xf'),_0x3dd52c,_0x5e9709);_0x55f2da(_0x5e9709);});});}exports[_0x6e1d('0x18')]=function(_0x59b9bd){var _0x3f6ec4=this;return new Promise(function(_0x2b685b,_0x2648fb){return db[_0x6e1d('0x19')][_0x6e1d('0x1a')]({'raw':_0x59b9bd['options']?_0x59b9bd[_0x6e1d('0x1b')][_0x6e1d('0x1c')]===undefined?!![]:![]:!![],'where':_0x59b9bd[_0x6e1d('0x1b')]?_0x59b9bd[_0x6e1d('0x1b')]['where']||null:null,'attributes':_0x59b9bd[_0x6e1d('0x1b')]?_0x59b9bd['options'][_0x6e1d('0x1d')]||null:null,'limit':_0x59b9bd['options']?_0x59b9bd[_0x6e1d('0x1b')]['limit']||null:null,'include':_0x59b9bd[_0x6e1d('0x1b')]?_0x59b9bd[_0x6e1d('0x1b')]['include']?_[_0x6e1d('0x1e')](_0x59b9bd[_0x6e1d('0x1b')][_0x6e1d('0x1f')],function(_0x32766f){return{'model':db[_0x32766f[_0x6e1d('0x20')]],'as':_0x32766f['as'],'attributes':_0x32766f['attributes'],'include':_0x32766f[_0x6e1d('0x1f')]?_[_0x6e1d('0x1e')](_0x32766f['include'],function(_0x2233cf){return{'model':db[_0x2233cf[_0x6e1d('0x20')]],'as':_0x2233cf['as'],'attributes':_0x2233cf['attributes'],'include':_0x2233cf[_0x6e1d('0x1f')]?_[_0x6e1d('0x1e')](_0x2233cf[_0x6e1d('0x1f')],function(_0x4ec945){return{'model':db[_0x4ec945[_0x6e1d('0x20')]],'as':_0x4ec945['as'],'attributes':_0x4ec945['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e1d('0x21')](function(_0x5b306d){logger['info'](_0x6e1d('0x18'),_0x59b9bd);logger[_0x6e1d('0x11')](_0x6e1d('0x18'),_0x59b9bd,JSON[_0x6e1d('0x13')](_0x5b306d));_0x2b685b(_0x5b306d);})[_0x6e1d('0x17')](function(_0x575e9f){logger[_0x6e1d('0x14')](_0x6e1d('0x18'),_0x575e9f[_0x6e1d('0x15')],_0x59b9bd);_0x2648fb(_0x3f6ec4[_0x6e1d('0x14')](0x1f4,_0x575e9f[_0x6e1d('0x15')]));});});};exports[_0x6e1d('0x22')]=function(_0x1e9dd9){var _0x5067c3=this;return new Promise(function(_0x544e8d,_0xf5d892){return db[_0x6e1d('0x19')][_0x6e1d('0x23')]({'raw':_0x1e9dd9[_0x6e1d('0x1b')]?_0x1e9dd9[_0x6e1d('0x1b')][_0x6e1d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e9dd9[_0x6e1d('0x1b')]?_0x1e9dd9[_0x6e1d('0x1b')][_0x6e1d('0x24')]||null:null,'attributes':_0x1e9dd9[_0x6e1d('0x1b')]?_0x1e9dd9[_0x6e1d('0x1b')][_0x6e1d('0x1d')]||null:null,'include':_0x1e9dd9[_0x6e1d('0x1b')]?_0x1e9dd9['options'][_0x6e1d('0x1f')]?_[_0x6e1d('0x1e')](_0x1e9dd9['options'][_0x6e1d('0x1f')],function(_0x392e15){return{'model':db[_0x392e15[_0x6e1d('0x20')]],'as':_0x392e15['as'],'attributes':_0x392e15['attributes'],'include':_0x392e15[_0x6e1d('0x1f')]?_['map'](_0x392e15[_0x6e1d('0x1f')],function(_0x181601){return{'model':db[_0x181601[_0x6e1d('0x20')]],'as':_0x181601['as'],'attributes':_0x181601['attributes'],'include':_0x181601[_0x6e1d('0x1f')]?_['map'](_0x181601[_0x6e1d('0x1f')],function(_0x4cb451){return{'model':db[_0x4cb451[_0x6e1d('0x20')]],'as':_0x4cb451['as'],'attributes':_0x4cb451[_0x6e1d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50377e){logger[_0x6e1d('0xe')](_0x6e1d('0x22'),_0x1e9dd9);logger['debug'](_0x6e1d('0x22'),_0x1e9dd9,JSON[_0x6e1d('0x13')](_0x50377e));_0x544e8d(_0x50377e);})[_0x6e1d('0x17')](function(_0x34283b){logger['error'](_0x6e1d('0x22'),_0x34283b[_0x6e1d('0x15')],_0x1e9dd9);_0xf5d892(_0x5067c3[_0x6e1d('0x14')](0x1f4,_0x34283b['message']));});});};exports[_0x6e1d('0x25')]=function(_0x40142c){var _0x5517c9=this;return new Promise(function(_0x2e6fec,_0x52f29e){var _0x20f08f;return db['User'][_0x6e1d('0x23')]({'where':_0x40142c[_0x6e1d('0x1b')][_0x6e1d('0x24')]||{},'attributes':['id',_0x6e1d('0x26'),_0x6e1d('0x27'),_0x6e1d('0x28'),_0x6e1d('0x29')]})[_0x6e1d('0x21')](function(_0x2d1b20){if(_0x2d1b20){_0x20f08f=_0x2d1b20;return db['UserVoiceQueueRt'][_0x6e1d('0x2a')]({'paused':0x1},{'where':{'UserId':_0x20f08f['id']},'individualHooks':!![]});}})[_0x6e1d('0x21')](function(){if(_0x20f08f){return db['MemberReport'][_0x6e1d('0x1a')]({'where':{'membername':_0x20f08f[_0x6e1d('0x26')],'type':_0x6e1d('0x2b'),'exitAt':null}});}})[_0x6e1d('0x21')](function(_0x457494){if(_0x20f08f){if(_0x457494&&_0x457494['length']){var _0x332f32=moment()[_0x6e1d('0x2c')](_0x6e1d('0x2d'));for(var _0x2707ab=0x0,_0x2ff77a=_0x457494['length'];_0x2707ab<_0x2ff77a;_0x2707ab++){_0x457494[_0x2707ab][_0x6e1d('0x2e')]({'exitAt':_0x332f32});}}}})['then'](function(){if(_0x20f08f){var _0x126971=[];var _0x401abc=utils[_0x6e1d('0x2f')]();_0x401abc[_0x6e1d('0x30')](function(_0x4c230c){_0x126971[_0x6e1d('0x31')]({'channel':_0x4c230c,'membername':_0x20f08f[_0x6e1d('0x26')],'interface':_['isNil'](_0x20f08f['interface'])?util[_0x6e1d('0x2c')](_0x6e1d('0x32'),_0x20f08f[_0x6e1d('0x26')]):_0x20f08f['interface'],'type':'PAUSE','enterAt':moment()[_0x6e1d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x40142c['body'][_0x6e1d('0x33')]||'DEFAULT\x20PAUSE','role':_0x20f08f[_0x6e1d('0x27')],'internal':_0x20f08f[_0x6e1d('0x28')],'uniqueid':_0x40142c[_0x6e1d('0x34')][_0x6e1d('0x35')]||null});});return db[_0x6e1d('0x36')][_0x6e1d('0x37')](_0x126971,{'individualHooks':!![]});}})['then'](function(){if(_0x20f08f){return _0x20f08f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x40142c['body'][_0x6e1d('0x33')]||_0x6e1d('0x38'),'lastPauseAt':moment()[_0x6e1d('0x2c')](_0x6e1d('0x2d'))});}})['then'](function(_0x411d12){_0x2e6fec(_0x411d12);})[_0x6e1d('0x17')](function(_0x3a058b){_0x52f29e(_0x5517c9[_0x6e1d('0x14')](0x1f4,_0x3a058b[_0x6e1d('0x15')]));});});};exports['UnpauseUser']=function(_0x2a0125){var _0x5265e2=this;return new Promise(function(_0x4de962,_0xe02c1b){var _0x214812;return db[_0x6e1d('0x19')][_0x6e1d('0x39')]({'where':_0x2a0125[_0x6e1d('0x1b')][_0x6e1d('0x24')]||{},'attributes':['id',_0x6e1d('0x26')]})['then'](function(_0x546af3){if(_0x546af3){_0x214812=_0x546af3;if(_0x2a0125[_0x6e1d('0x34')]['channel']&&!utils[_0x6e1d('0x3a')](_0x2a0125['body']['channel'])){throw new Error(_0x6e1d('0x3b'));}switch(_0x2a0125[_0x6e1d('0x34')][_0x6e1d('0x3c')]){case _0x6e1d('0x3d'):return db['UserVoiceQueueRt'][_0x6e1d('0x2a')]({'paused':0x0},{'where':{'UserId':_0x214812['id']}})['then'](function(){return db[_0x6e1d('0x36')][_0x6e1d('0x23')]({'where':{'channel':_0x2a0125[_0x6e1d('0x34')][_0x6e1d('0x3c')],'membername':_0x214812[_0x6e1d('0x26')],'type':_0x6e1d('0x2b'),'exitAt':null}});})[_0x6e1d('0x21')](function(_0x5f09ff){if(_0x5f09ff){return _0x5f09ff['update']({'exitAt':moment()[_0x6e1d('0x2c')](_0x6e1d('0x2d')),'data2':_0x6e1d('0x3e')},{'individualHooks':!![]});}return null;})[_0x6e1d('0x21')](function(){return _0x214812[_0x6e1d('0x2a')]({'voicePause':![]});});case'mail':case'chat':case _0x6e1d('0x3f'):case'sms':case _0x6e1d('0x40'):case _0x6e1d('0x41'):return db['MemberReport'][_0x6e1d('0x23')]({'where':{'channel':_0x2a0125['body'][_0x6e1d('0x3c')],'membername':_0x214812[_0x6e1d('0x26')],'type':_0x6e1d('0x2b'),'exitAt':null}})[_0x6e1d('0x21')](function(_0x575678){return _0x575678[_0x6e1d('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6e1d('0x3e')},{'individualHooks':!![]});})['then'](function(){var _0x309682={};_['set'](_0x309682,util[_0x6e1d('0x2c')](_0x6e1d('0x42'),_0x2a0125[_0x6e1d('0x34')][_0x6e1d('0x3c')],_0x6e1d('0x43')),![]);return _0x214812[_0x6e1d('0x2a')](_0x309682);});default:return db[_0x6e1d('0x44')][_0x6e1d('0x2a')]({'paused':0x0},{'where':{'UserId':_0x214812['id']}})[_0x6e1d('0x21')](function(){return db['MemberReport'][_0x6e1d('0x1a')]({'where':{'membername':_0x214812[_0x6e1d('0x26')],'type':_0x6e1d('0x2b'),'exitAt':null}});})['then'](function(_0x45d88c){var _0x32ffe8=[];_0x45d88c['forEach'](function(_0x65233e){_0x32ffe8[_0x6e1d('0x31')](_0x65233e['update']({'exitAt':moment()['format'](_0x6e1d('0x2d')),'data2':'system'}));});return BPromise['all'](_0x32ffe8);})[_0x6e1d('0x21')](function(){return _0x214812[_0x6e1d('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x2a74f2){_0x4de962(_0x2a74f2);})[_0x6e1d('0x17')](function(_0x388a17){_0xe02c1b(_0x5265e2['error'](0x1f4,_0x388a17[_0x6e1d('0x15')]));});});};exports[_0x6e1d('0x45')]=function(_0x41ecad){var _0x168c1=this;return new Promise(function(_0x3e2bfc,_0x3c50d6){var _0x58f4ba;return db['User'][_0x6e1d('0x39')]({'where':_0x41ecad[_0x6e1d('0x1b')][_0x6e1d('0x24')]||{},'attributes':['id',_0x6e1d('0x26')]})[_0x6e1d('0x21')](function(_0x4f3dc6){if(_0x4f3dc6){_0x58f4ba=_0x4f3dc6;return db['UserVoiceQueueRt'][_0x6e1d('0x46')]({'where':{'membername':_0x58f4ba[_0x6e1d('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x58f4ba){return db['MemberReport']['findAll']({'where':{'membername':_0x58f4ba['name'],'exitAt':null}});}})[_0x6e1d('0x21')](function(_0x34f954){if(_0x58f4ba){if(_0x34f954&&_0x34f954[_0x6e1d('0x47')]){var _0x1fc923=[];_0x34f954['forEach'](function(_0x273265){_0x1fc923[_0x6e1d('0x31')](_0x273265[_0x6e1d('0x2a')]({'exitAt':moment()[_0x6e1d('0x2c')](_0x6e1d('0x2d'))}));});return BPromise[_0x6e1d('0x48')](_0x1fc923);}}})[_0x6e1d('0x21')](function(){if(_0x58f4ba){return _0x58f4ba[_0x6e1d('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6e1d('0x21')](function(_0x403902){_0x3e2bfc(_0x403902);})[_0x6e1d('0x17')](function(_0x5e8a8d){_0x3c50d6(_0x168c1[_0x6e1d('0x14')](0x1f4,_0x5e8a8d['message']));});});};exports['LoginUser']=function(_0x407b20){var _0x19938e=this;return new Promise(function(_0x2151b8,_0x1893b6){var _0x32b738;var _0x40f7df;var _0x2ef3f2;var _0x13729c;return db[_0x6e1d('0x19')][_0x6e1d('0x39')]({'where':_0x407b20[_0x6e1d('0x1b')][_0x6e1d('0x24')]||{},'attributes':['id',_0x6e1d('0x26'),'role','mobile',_0x6e1d('0x49'),_0x6e1d('0x28'),'loginInPause',_0x6e1d('0x29')]})[_0x6e1d('0x21')](function(_0x5b8387){if(_0x5b8387){_0x32b738=_0x5b8387;_0x13729c=_0x407b20[_0x6e1d('0x34')][_0x6e1d('0x29')]?_0x407b20[_0x6e1d('0x34')][_0x6e1d('0x29')]:util[_0x6e1d('0x2c')](_0x6e1d('0x32'),_0x32b738[_0x6e1d('0x26')]);return db[_0x6e1d('0x19')][_0x6e1d('0x4a')]({'where':{'role':_0x6e1d('0x4b'),'online':!![],'id':{'$ne':_0x32b738['id']}}});}})[_0x6e1d('0x21')](function(_0x2238b9){if(_0x2238b9){_0x2ef3f2=_0x2238b9;return require(_0x6e1d('0x4c'))[_0x6e1d('0x4d')]();}})[_0x6e1d('0x21')](function(_0x119bcf){if(_0x119bcf&&_0x119bcf[_0x6e1d('0x4e')]&&_0x2ef3f2>=_0x119bcf[_0x6e1d('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x32b738){return db['UserVoiceQueueRt'][_0x6e1d('0x46')]({'where':{'membername':_0x32b738[_0x6e1d('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x32b738){return _0x32b738['getVoiceQueues']({'raw':!![]});}})[_0x6e1d('0x21')](function(_0x4072d6){if(_0x32b738){if(_0x4072d6){var _0x1b91e0=[];_0x40f7df=_0x4072d6;if(_0x40f7df[_0x6e1d('0x47')]){for(var _0x424912=0x0;_0x424912<_0x40f7df[_0x6e1d('0x47')];_0x424912++){_0x1b91e0[_0x6e1d('0x31')](db['UserVoiceQueueRt'][_0x6e1d('0x4f')]({'membername':_0x32b738[_0x6e1d('0x26')],'UserId':_0x32b738['id'],'queue_name':_0x40f7df[_0x424912]['name'],'VoiceQueueId':_0x40f7df[_0x424912]['id'],'interface':_0x13729c,'paused':_0x32b738[_0x6e1d('0x50')]||![],'penalty':_0x40f7df[_0x424912]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6e1d('0x48')](_0x1b91e0);}}}})[_0x6e1d('0x21')](function(){if(_0x32b738){return db['MemberReport'][_0x6e1d('0x1a')]({'where':{'membername':_0x32b738[_0x6e1d('0x26')],'exitAt':null}});}})['then'](function(_0x2c3285){if(_0x32b738){if(_0x2c3285&&_0x2c3285[_0x6e1d('0x47')]){var _0xbfda8f=[];_0x2c3285[_0x6e1d('0x30')](function(_0x235d22){_0xbfda8f[_0x6e1d('0x31')](_0x235d22[_0x6e1d('0x2a')]({'exitAt':moment()[_0x6e1d('0x2c')](_0x6e1d('0x2d'))}));});return BPromise[_0x6e1d('0x48')](_0xbfda8f);}}})['then'](function(_0xaee491){if(_0x32b738){var _0x2f7058=[];var _0x4fa58d=[];var _0x14727a=utils[_0x6e1d('0x2f')]();var _0x29eea8={'membername':_0x32b738[_0x6e1d('0x26')],'interface':_0x13729c,'enterAt':moment()[_0x6e1d('0x2c')](_0x6e1d('0x2d')),'role':_0x32b738[_0x6e1d('0x27')],'internal':_0x32b738[_0x6e1d('0x28')]};_0x14727a[_0x6e1d('0x30')](function(_0xa6b59d){_0x2f7058[_0x6e1d('0x31')](_[_0x6e1d('0x51')]({'channel':_0xa6b59d,'type':_0x6e1d('0x52'),'data1':_0x6e1d('0x53'),'data2':_0x13729c},_0x29eea8));if(_0x32b738[_0x6e1d('0x50')]){_0x4fa58d['push'](_[_0x6e1d('0x51')]({'channel':_0xa6b59d,'type':'PAUSE','data1':_0x6e1d('0x54')},_0x29eea8));}});return db['MemberReport'][_0x6e1d('0x37')](_0x2f7058[_0x6e1d('0x55')](_0x4fa58d),{'individualHooks':!![]});}})['then'](function(){if(_0x32b738){return _0x32b738[_0x6e1d('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x6e1d('0x2d')),'voicePause':_0x32b738['loginInPause']||![],'mailPause':_0x32b738['loginInPause']||![],'chatPause':_0x32b738[_0x6e1d('0x50')]||![],'faxPause':_0x32b738[_0x6e1d('0x50')]||![],'smsPause':_0x32b738[_0x6e1d('0x50')]||![],'openchannelPause':_0x32b738[_0x6e1d('0x50')]||![],'pauseType':_0x32b738['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x6e1d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x13729c});}})[_0x6e1d('0x21')](function(_0xea4e77){_0x2151b8(_0xea4e77);})[_0x6e1d('0x17')](function(_0x496d0c){_0x1893b6(_0x19938e[_0x6e1d('0x14')](0x1f4,_0x496d0c[_0x6e1d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 16859a0..6fbcf13 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 _0x1249=['update','length','user:','./user.events','remove'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0x1249,0x1b1));var _0x9124=function(_0x2e80a3,_0x21d556){_0x2e80a3=_0x2e80a3-0x0;var _0x5a75da=_0x1249[_0x2e80a3];return _0x5a75da;};'use strict';var UserEvents=require(_0x9124('0x0'));var events=['save',_0x9124('0x1'),_0x9124('0x2')];function createListener(_0x229e4d,_0x4c0cb3){return function(_0x4ac035){_0x4c0cb3['emit'](_0x229e4d,_0x4ac035);};}function removeListener(_0x3a9d23,_0x272ef0){return function(){UserEvents['removeListener'](_0x3a9d23,_0x272ef0);};}exports['register']=function(_0x20d791){for(var _0x409fd9=0x0,_0x32383e=events[_0x9124('0x3')];_0x409fd9<_0x32383e;_0x409fd9++){var _0x576e92=events[_0x409fd9];var _0x4835dc=createListener(_0x9124('0x4')+_0x576e92,_0x20d791);UserEvents['on'](_0x576e92,_0x4835dc);}}; \ No newline at end of file +var _0x5790=['remove','emit','removeListener','register','save'];(function(_0x4911c7,_0x204b4d){var _0x20233a=function(_0x280232){while(--_0x280232){_0x4911c7['push'](_0x4911c7['shift']());}};_0x20233a(++_0x204b4d);}(_0x5790,0xa9));var _0x0579=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5790[_0xfae23b];return _0x200640;};'use strict';var UserEvents=require('./user.events');var events=[_0x0579('0x0'),_0x0579('0x1'),'update'];function createListener(_0x5b80da,_0x53a59a){return function(_0x5d9d5e){_0x53a59a[_0x0579('0x2')](_0x5b80da,_0x5d9d5e);};}function removeListener(_0x466983,_0xecf063){return function(){UserEvents[_0x0579('0x3')](_0x466983,_0xecf063);};}exports[_0x0579('0x4')]=function(_0x144492){for(var _0x3ebe9c=0x0,_0x16f0e8=events['length'];_0x3ebe9c<_0x16f0e8;_0x3ebe9c++){var _0x49b93f=events[_0x3ebe9c];var _0x1dddc6=createListener('user:'+_0x49b93f,_0x144492);UserEvents['on'](_0x49b93f,_0x1dddc6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0b3a475..119bca0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x185a67,_0x151e0c){var _0x3794d1=function(_0x29abf3){while(--_0x29abf3){_0x185a67['push'](_0x185a67['shift']());}};_0x3794d1(++_0x151e0c);}(_0x70e0,0x17b));var _0x070e=function(_0x79ef32,_0x4b72e2){_0x79ef32=_0x79ef32-0x0;var _0x421ec5=_0x70e0[_0x79ef32];return _0x421ec5;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4dca38,_0x5dfae1){var _0x44656c=function(_0x538a62){while(--_0x538a62){_0x4dca38['push'](_0x4dca38['shift']());}};_0x44656c(++_0x5dfae1);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 49930f8..aa1fa35 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 _0x3b2e=['exports','INTEGER'];(function(_0x5717ba,_0x319c47){var _0x2d5b47=function(_0x42a4a1){while(--_0x42a4a1){_0x5717ba['push'](_0x5717ba['shift']());}};_0x2d5b47(++_0x319c47);}(_0x3b2e,0x10a));var _0xe3b2=function(_0x1d8305,_0x1e63c6){_0x1d8305=_0x1d8305-0x0;var _0x183f62=_0x3b2e[_0x1d8305];return _0x183f62;};'use strict';var Sequelize=require('sequelize');module[_0xe3b2('0x0')]={'penalty':{'type':Sequelize[_0xe3b2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2a96=['sequelize','exports'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x2a96,0xd2));var _0x62a9=function(_0x908418,_0x2ef8d7){_0x908418=_0x908418-0x0;var _0x225095=_0x2a96[_0x908418];return _0x225095;};'use strict';var Sequelize=require(_0x62a9('0x0'));module[_0x62a9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3480323..c8a8885 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 _0x5f41=['request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x44fd33,_0x455658){var _0x486d1a=function(_0x50c7da){while(--_0x50c7da){_0x44fd33['push'](_0x44fd33['shift']());}};_0x486d1a(++_0x455658);}(_0x5f41,0x190));var _0x15f4=function(_0x38bd43,_0x425421){_0x38bd43=_0x38bd43-0x0;var _0x36c0e8=_0x5f41[_0x38bd43];return _0x36c0e8;};'use strict';var _=require(_0x15f4('0x0'));var util=require(_0x15f4('0x1'));var logger=require(_0x15f4('0x2'))(_0x15f4('0x3'));var moment=require(_0x15f4('0x4'));var BPromise=require(_0x15f4('0x5'));var rp=require(_0x15f4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15f4('0x7'));var config=require(_0x15f4('0x8'));var attributes=require(_0x15f4('0x9'));module[_0x15f4('0xa')]=function(_0x1f6411,_0xc57a12){return _0x1f6411[_0x15f4('0xb')](_0x15f4('0xc'),attributes,{'tableName':_0x15f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb9=['./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x3d5fdc,_0x10d8f9){var _0x4edf8d=function(_0x33088b){while(--_0x33088b){_0x3d5fdc['push'](_0x3d5fdc['shift']());}};_0x4edf8d(++_0x10d8f9);}(_0x5bb9,0xb4));var _0x95bb=function(_0x1cb553,_0x4ec6c2){_0x1cb553=_0x1cb553-0x0;var _0xa9c515=_0x5bb9[_0x1cb553];return _0xa9c515;};'use strict';var _=require(_0x95bb('0x0'));var util=require(_0x95bb('0x1'));var logger=require(_0x95bb('0x2'))(_0x95bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95bb('0x5'));var config=require(_0x95bb('0x6'));var attributes=require(_0x95bb('0x7'));module['exports']=function(_0x509ae8,_0x5d994f){return _0x509ae8[_0x95bb('0x8')](_0x95bb('0x9'),attributes,{'tableName':_0x95bb('0xa'),'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 90530b3..cae51ab 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 _0x822c=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util'];(function(_0x37820d,_0x5ed3e5){var _0x527a6e=function(_0x1a7f7f){while(--_0x1a7f7f){_0x37820d['push'](_0x37820d['shift']());}};_0x527a6e(++_0x5ed3e5);}(_0x822c,0x1ec));var _0xc822=function(_0x25dbf7,_0x3854b0){_0x25dbf7=_0x25dbf7-0x0;var _0x6bec7c=_0x822c[_0x25dbf7];return _0x6bec7c;};'use strict';var _=require(_0xc822('0x0'));var util=require(_0xc822('0x1'));var moment=require('moment');var BPromise=require(_0xc822('0x2'));var rs=require(_0xc822('0x3'));var fs=require('fs');var Redis=require(_0xc822('0x4'));var db=require(_0xc822('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc822('0x6'));var config=require(_0xc822('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc822('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cc44b,_0x161cde,_0x3d7b09){return new BPromise(function(_0x3e8984,_0x5a9afc){return client[_0xc822('0x9')](_0x4cc44b,_0x3d7b09)[_0xc822('0xa')](function(_0x17b49d){logger['info'](_0xc822('0xb'),_0x161cde,_0xc822('0xc'));logger[_0xc822('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x161cde,'request\x20sent',JSON[_0xc822('0xe')](_0x17b49d));if(_0x17b49d['error']){if(_0x17b49d[_0xc822('0xf')][_0xc822('0x10')]===0x1f4){logger[_0xc822('0xf')](_0xc822('0xb'),_0x161cde,_0x17b49d[_0xc822('0xf')][_0xc822('0x11')]);return _0x5a9afc(_0x17b49d[_0xc822('0xf')][_0xc822('0x11')]);}logger['error'](_0xc822('0xb'),_0x161cde,_0x17b49d[_0xc822('0xf')][_0xc822('0x11')]);return _0x3e8984(_0x17b49d[_0xc822('0xf')][_0xc822('0x11')]);}else{logger[_0xc822('0x12')](_0xc822('0xb'),_0x161cde,_0xc822('0xc'));_0x3e8984(_0x17b49d['result'][_0xc822('0x11')]);}})['catch'](function(_0x1555a9){logger[_0xc822('0xf')](_0xc822('0xb'),_0x161cde,_0x1555a9);_0x5a9afc(_0x1555a9);});});} \ No newline at end of file +var _0x4021=['stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4021,0x185));var _0x1402=function(_0x31ead7,_0x2e9a7c){_0x31ead7=_0x31ead7-0x0;var _0x3516f0=_0x4021[_0x31ead7];return _0x3516f0;};'use strict';var _=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var moment=require(_0x1402('0x2'));var BPromise=require(_0x1402('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1402('0x4'));var db=require(_0x1402('0x5'))['db'];var utils=require(_0x1402('0x6'));var logger=require(_0x1402('0x7'))(_0x1402('0x8'));var config=require(_0x1402('0x9'));var jayson=require(_0x1402('0xa'));var client=jayson[_0x1402('0xb')][_0x1402('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d3dbd,_0x17e8ff,_0x4dbc9e){return new BPromise(function(_0x1aa4d2,_0x3aada5){return client[_0x1402('0xd')](_0x4d3dbd,_0x4dbc9e)[_0x1402('0xe')](function(_0x54c836){logger['info'](_0x1402('0xf'),_0x17e8ff,'request\x20sent');logger[_0x1402('0x10')](_0x1402('0x11'),_0x17e8ff,_0x1402('0x12'),JSON[_0x1402('0x13')](_0x54c836));if(_0x54c836[_0x1402('0x14')]){if(_0x54c836[_0x1402('0x14')]['code']===0x1f4){logger[_0x1402('0x14')](_0x1402('0xf'),_0x17e8ff,_0x54c836['error'][_0x1402('0x15')]);return _0x3aada5(_0x54c836[_0x1402('0x14')][_0x1402('0x15')]);}logger[_0x1402('0x14')](_0x1402('0xf'),_0x17e8ff,_0x54c836[_0x1402('0x14')][_0x1402('0x15')]);return _0x1aa4d2(_0x54c836[_0x1402('0x14')]['message']);}else{logger[_0x1402('0x16')](_0x1402('0xf'),_0x17e8ff,'request\x20sent');_0x1aa4d2(_0x54c836['result']['message']);}})[_0x1402('0x17')](function(_0x8d7884){logger[_0x1402('0x14')](_0x1402('0xf'),_0x17e8ff,_0x8d7884);_0x3aada5(_0x8d7884);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f052683..50ff1a0 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56db28,_0x95952b){var _0x255efc=function(_0x11c095){while(--_0x11c095){_0x56db28['push'](_0x56db28['shift']());}};_0x255efc(++_0x95952b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x161df9,_0x13b198){var _0x3bdbf1=function(_0x2ce1a0){while(--_0x2ce1a0){_0x161df9['push'](_0x161df9['shift']());}};_0x3bdbf1(++_0x13b198);}(_0x70e0,0x17b));var _0x070e=function(_0xb1cc26,_0x367f10){_0xb1cc26=_0xb1cc26-0x0;var _0x447e47=_0x70e0[_0xb1cc26];return _0x447e47;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a7143da..20bea3d 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 _0x22b7=['INTEGER','STRING'];(function(_0x1bba3b,_0x13ed66){var _0x524ddd=function(_0x29c506){while(--_0x29c506){_0x1bba3b['push'](_0x1bba3b['shift']());}};_0x524ddd(++_0x13ed66);}(_0x22b7,0x142));var _0x722b=function(_0x4fab3f,_0x5b0e8a){_0x4fab3f=_0x4fab3f-0x0;var _0x27364e=_0x22b7[_0x4fab3f];return _0x27364e;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x722b('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x722b('0x1')]}}; \ No newline at end of file +var _0x249f=['STRING','sequelize','INTEGER'];(function(_0x6f677d,_0x51e129){var _0x424bb3=function(_0x448cb0){while(--_0x448cb0){_0x6f677d['push'](_0x6f677d['shift']());}};_0x424bb3(++_0x51e129);}(_0x249f,0x1ae));var _0xf249=function(_0x16f46f,_0x830ca7){_0x16f46f=_0x16f46f-0x0;var _0x4e7457=_0x249f[_0x16f46f];return _0x4e7457;};'use strict';var Sequelize=require(_0xf249('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf249('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf249('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf249('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1a0f59f..e769a84 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 _0x9a5f=['api','request-promise','path','rimraf','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','util','../../config/logger'];(function(_0x3ed996,_0x10993e){var _0x2cf231=function(_0xfd08b5){while(--_0xfd08b5){_0x3ed996['push'](_0x3ed996['shift']());}};_0x2cf231(++_0x10993e);}(_0x9a5f,0x18e));var _0xf9a5=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x9a5f[_0x1f71d8];return _0x10b045;};'use strict';var _=require('lodash');var util=require(_0xf9a5('0x0'));var logger=require(_0xf9a5('0x1'))(_0xf9a5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9a5('0x3'));var fs=require('fs');var path=require(_0xf9a5('0x4'));var rimraf=require(_0xf9a5('0x5'));var config=require(_0xf9a5('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xf9a5('0x7')]=function(_0x48be64,_0x3e4923){return _0x48be64['define'](_0xf9a5('0x8'),attributes,{'tableName':_0xf9a5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x347a=['util','../../config/logger','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x347a,0x121));var _0xa347=function(_0x14f30b,_0x4ac7ca){_0x14f30b=_0x14f30b-0x0;var _0x248b2e=_0x347a[_0x14f30b];return _0x248b2e;};'use strict';var _=require(_0xa347('0x0'));var util=require(_0xa347('0x1'));var logger=require(_0xa347('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa347('0x3'));var rp=require(_0xa347('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa347('0x5'));var attributes=require(_0xa347('0x6'));module[_0xa347('0x7')]=function(_0x43581d,_0x43837b){return _0x43581d['define'](_0xa347('0x8'),attributes,{'tableName':_0xa347('0x9'),'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 5bc044e..d71c2c3 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 _0x63c3=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4465f3,_0x5da015){var _0x133376=function(_0x4baf3b){while(--_0x4baf3b){_0x4465f3['push'](_0x4465f3['shift']());}};_0x133376(++_0x5da015);}(_0x63c3,0x9b));var _0x363c=function(_0x5799e1,_0x789913){_0x5799e1=_0x5799e1-0x0;var _0x271eb3=_0x63c3[_0x5799e1];return _0x271eb3;};'use strict';var _=require(_0x363c('0x0'));var util=require(_0x363c('0x1'));var moment=require(_0x363c('0x2'));var BPromise=require('bluebird');var rs=require(_0x363c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x363c('0x4'))['db'];var utils=require(_0x363c('0x5'));var logger=require(_0x363c('0x6'))(_0x363c('0x7'));var config=require(_0x363c('0x8'));var jayson=require(_0x363c('0x9'));var client=jayson[_0x363c('0xa')][_0x363c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2a85,_0x15da4e,_0x15f5e5){return new BPromise(function(_0x28221f,_0x3e8850){return client[_0x363c('0xc')](_0x5d2a85,_0x15f5e5)[_0x363c('0xd')](function(_0xaeb2de){logger[_0x363c('0xe')](_0x363c('0xf'),_0x15da4e,_0x363c('0x10'));logger[_0x363c('0x11')](_0x363c('0x12'),_0x15da4e,'request\x20sent',JSON[_0x363c('0x13')](_0xaeb2de));if(_0xaeb2de[_0x363c('0x14')]){if(_0xaeb2de[_0x363c('0x14')][_0x363c('0x15')]===0x1f4){logger['error'](_0x363c('0xf'),_0x15da4e,_0xaeb2de['error'][_0x363c('0x16')]);return _0x3e8850(_0xaeb2de[_0x363c('0x14')][_0x363c('0x16')]);}logger['error'](_0x363c('0xf'),_0x15da4e,_0xaeb2de[_0x363c('0x14')][_0x363c('0x16')]);return _0x28221f(_0xaeb2de['error'][_0x363c('0x16')]);}else{logger[_0x363c('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x15da4e,_0x363c('0x10'));_0x28221f(_0xaeb2de[_0x363c('0x17')]['message']);}})[_0x363c('0x18')](function(_0xfad365){logger[_0x363c('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x15da4e,_0xfad365);_0x3e8850(_0xfad365);});});} \ No newline at end of file +var _0x76fd=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x2799d6,_0x2fe3b1){var _0x124b89=function(_0x987361){while(--_0x987361){_0x2799d6['push'](_0x2799d6['shift']());}};_0x124b89(++_0x2fe3b1);}(_0x76fd,0x17c));var _0xd76f=function(_0x517a2d,_0x21e839){_0x517a2d=_0x517a2d-0x0;var _0x42498c=_0x76fd[_0x517a2d];return _0x42498c;};'use strict';var _=require(_0xd76f('0x0'));var util=require(_0xd76f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd76f('0x2'));var fs=require('fs');var Redis=require(_0xd76f('0x3'));var db=require(_0xd76f('0x4'))['db'];var utils=require(_0xd76f('0x5'));var logger=require('../../config/logger')(_0xd76f('0x6'));var config=require(_0xd76f('0x7'));var jayson=require(_0xd76f('0x8'));var client=jayson[_0xd76f('0x9')][_0xd76f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3deed7,_0x3eaed5,_0x8f0616){return new BPromise(function(_0x333d4c,_0x190b5e){return client['request'](_0x3deed7,_0x8f0616)['then'](function(_0x5eab0b){logger[_0xd76f('0xb')](_0xd76f('0xc'),_0x3eaed5,'request\x20sent');logger[_0xd76f('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3eaed5,_0xd76f('0xe'),JSON[_0xd76f('0xf')](_0x5eab0b));if(_0x5eab0b[_0xd76f('0x10')]){if(_0x5eab0b[_0xd76f('0x10')][_0xd76f('0x11')]===0x1f4){logger[_0xd76f('0x10')](_0xd76f('0xc'),_0x3eaed5,_0x5eab0b[_0xd76f('0x10')][_0xd76f('0x12')]);return _0x190b5e(_0x5eab0b[_0xd76f('0x10')][_0xd76f('0x12')]);}logger[_0xd76f('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x3eaed5,_0x5eab0b[_0xd76f('0x10')][_0xd76f('0x12')]);return _0x333d4c(_0x5eab0b[_0xd76f('0x10')][_0xd76f('0x12')]);}else{logger[_0xd76f('0xb')](_0xd76f('0xc'),_0x3eaed5,_0xd76f('0xe'));_0x333d4c(_0x5eab0b['result'][_0xd76f('0x12')]);}})['catch'](function(_0x1f997c){logger[_0xd76f('0x10')](_0xd76f('0xc'),_0x3eaed5,_0x1f997c);_0x190b5e(_0x1f997c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 750b2e2..1d984a5 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1a505c,_0x201776){var _0x12b988=function(_0x501a83){while(--_0x501a83){_0x1a505c['push'](_0x1a505c['shift']());}};_0x12b988(++_0x201776);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24502f,_0x134350){var _0x402fd9=function(_0x5e90b2){while(--_0x5e90b2){_0x24502f['push'](_0x24502f['shift']());}};_0x402fd9(++_0x134350);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index b89de03..35c1907 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 _0x058f=['exports','INTEGER'];(function(_0x4d218c,_0x59142a){var _0x351694=function(_0x27a73a){while(--_0x27a73a){_0x4d218c['push'](_0x4d218c['shift']());}};_0x351694(++_0x59142a);}(_0x058f,0x166));var _0xf058=function(_0x22801a,_0x22d4cd){_0x22801a=_0x22801a-0x0;var _0x1e6ff4=_0x058f[_0x22801a];return _0x1e6ff4;};'use strict';var Sequelize=require('sequelize');module[_0xf058('0x0')]={'penalty':{'type':Sequelize[_0xf058('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ccc=['INTEGER','sequelize'];(function(_0x234244,_0x2a514c){var _0x3c4576=function(_0x1677bd){while(--_0x1677bd){_0x234244['push'](_0x234244['shift']());}};_0x3c4576(++_0x2a514c);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x3fe966,_0x552df7){_0x3fe966=_0x3fe966-0x0;var _0x139983=_0x3ccc[_0x3fe966];return _0x139983;};'use strict';var Sequelize=require(_0xc3cc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc3cc('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 1b910f0..f3ee700 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 _0x594c=['util','api','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','lodash'];(function(_0x58cfd9,_0x404d5d){var _0xe167f3=function(_0x4a36bb){while(--_0x4a36bb){_0x58cfd9['push'](_0x58cfd9['shift']());}};_0xe167f3(++_0x404d5d);}(_0x594c,0x121));var _0xc594=function(_0x2044ed,_0x46e2a1){_0x2044ed=_0x2044ed-0x0;var _0x229959=_0x594c[_0x2044ed];return _0x229959;};'use strict';var _=require(_0xc594('0x0'));var util=require(_0xc594('0x1'));var logger=require('../../config/logger')(_0xc594('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc594('0x3'));var fs=require('fs');var path=require(_0xc594('0x4'));var rimraf=require(_0xc594('0x5'));var config=require('../../config/environment');var attributes=require(_0xc594('0x6'));module[_0xc594('0x7')]=function(_0x31d11c,_0x21e6c7){return _0x31d11c[_0xc594('0x8')](_0xc594('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f31=['../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4b471f,_0x1071df){var _0x447c17=function(_0x3ced87){while(--_0x3ced87){_0x4b471f['push'](_0x4b471f['shift']());}};_0x447c17(++_0x1071df);}(_0x8f31,0x125));var _0x18f3=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x8f31[_0x77d286];return _0x5446a5;};'use strict';var _=require(_0x18f3('0x0'));var util=require(_0x18f3('0x1'));var logger=require(_0x18f3('0x2'))('api');var moment=require(_0x18f3('0x3'));var BPromise=require(_0x18f3('0x4'));var rp=require(_0x18f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18f3('0x6'));var config=require(_0x18f3('0x7'));var attributes=require(_0x18f3('0x8'));module[_0x18f3('0x9')]=function(_0x3eba84,_0x282a1d){return _0x3eba84[_0x18f3('0xa')]('UserMailQueue',attributes,{'tableName':_0x18f3('0xb'),'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 cf9df30..09d6544 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x396648,_0x12a076){var _0x2c15a6=function(_0x5335fb){while(--_0x5335fb){_0x396648['push'](_0x396648['shift']());}};_0x2c15a6(++_0x12a076);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x4c157c,_0x492e9c){var _0x2dd2bf=function(_0x158793){while(--_0x158793){_0x4c157c['push'](_0x4c157c['shift']());}};_0x2dd2bf(++_0x492e9c);}(_0xe14b,0x93));var _0xbe14=function(_0x61dcc8,_0x16393d){_0x61dcc8=_0x61dcc8-0x0;var _0x3ed136=_0xe14b[_0x61dcc8];return _0x3ed136;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 8e58c52..88604c3 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 _0x6d8e=['path','connect-timeout','Router','../../config/environment','./userNotification.controller','sendUserNotification','multer','util'];(function(_0x1d74ed,_0x2c628d){var _0x476d8d=function(_0x11c5bd){while(--_0x11c5bd){_0x1d74ed['push'](_0x1d74ed['shift']());}};_0x476d8d(++_0x2c628d);}(_0x6d8e,0x1e6));var _0xe6d8=function(_0x393bf5,_0x43e83d){_0x393bf5=_0x393bf5-0x0;var _0x22b135=_0x6d8e[_0x393bf5];return _0x22b135;};'use strict';var multer=require(_0xe6d8('0x0'));var util=require(_0xe6d8('0x1'));var path=require(_0xe6d8('0x2'));var timeout=require(_0xe6d8('0x3'));var express=require('express');var router=express[_0xe6d8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe6d8('0x5'));var controller=require(_0xe6d8('0x6'));router['post']('/',auth['isAuthenticated'](),controller[_0xe6d8('0x7')]);module['exports']=router; \ No newline at end of file +var _0xd3e0=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x4cbfdd,_0x2e60ce){var _0x7170c0=function(_0x336826){while(--_0x336826){_0x4cbfdd['push'](_0x4cbfdd['shift']());}};_0x7170c0(++_0x2e60ce);}(_0xd3e0,0x169));var _0x0d3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3e0[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0d3e('0x0'));var util=require(_0x0d3e('0x1'));var path=require(_0x0d3e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0d3e('0x3'));var auth=require(_0x0d3e('0x4'));var interaction=require(_0x0d3e('0x5'));var config=require(_0x0d3e('0x6'));var controller=require(_0x0d3e('0x7'));router['post']('/',auth[_0x0d3e('0x8')](),controller[_0x0d3e('0x9')]);module[_0x0d3e('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index ab89f24..c48bb74 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 _0x7d07=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x16aebc,_0x473426){var _0x5141f7=function(_0x282f4c){while(--_0x282f4c){_0x16aebc['push'](_0x16aebc['shift']());}};_0x5141f7(++_0x473426);}(_0x7d07,0x103));var _0x77d0=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x7d07[_0x506172];return _0x2723c0;};'use strict';var Sequelize=require(_0x77d0('0x0'));module['exports']={'body':{'type':Sequelize[_0x77d0('0x1')]},'senderName':{'type':Sequelize[_0x77d0('0x2')]},'recipientsId':{'type':Sequelize[_0x77d0('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x77d0('0x3')]}}; \ No newline at end of file +var _0x54dc=['TEXT','STRING','BOOLEAN','exports'];(function(_0x393b41,_0x7973a3){var _0x5d738a=function(_0x3b4078){while(--_0x3b4078){_0x393b41['push'](_0x393b41['shift']());}};_0x5d738a(++_0x7973a3);}(_0x54dc,0x12f));var _0xc54d=function(_0x20522a,_0x11bb0){_0x20522a=_0x20522a-0x0;var _0x3105e0=_0x54dc[_0x20522a];return _0x3105e0;};'use strict';var Sequelize=require('sequelize');module[_0xc54d('0x0')]={'body':{'type':Sequelize[_0xc54d('0x1')]},'senderName':{'type':Sequelize[_0xc54d('0x2')]},'recipientsId':{'type':Sequelize[_0xc54d('0x1')]},'recipientsDescription':{'type':Sequelize[_0xc54d('0x2')]},'beep':{'type':Sequelize[_0xc54d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8ff2882..f8142e0 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 _0xdfa5=['html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','recipient','userNotification:send','catch','findOne'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0xdfa5,0x193));var _0x5dfa=function(_0x5ef97a,_0x5aabb8){_0x5ef97a=_0x5ef97a-0x0;var _0x44c72d=_0xdfa5[_0x5ef97a];return _0x44c72d;};'use strict';var emlformat=require(_0x5dfa('0x0'));var rimraf=require(_0x5dfa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dfa('0x2'));var moment=require(_0x5dfa('0x3'));var BPromise=require(_0x5dfa('0x4'));var Mustache=require(_0x5dfa('0x5'));var util=require('util');var path=require(_0x5dfa('0x6'));var sox=require(_0x5dfa('0x7'));var csv=require(_0x5dfa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5dfa('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5dfa('0xa'));var deskjs=require(_0x5dfa('0xb'));var toCsv=require(_0x5dfa('0x8'));var querystring=require(_0x5dfa('0xc'));var Papa=require(_0x5dfa('0xd'));var Redis=require(_0x5dfa('0xe'));var authService=require(_0x5dfa('0xf'));var qs=require(_0x5dfa('0x10'));var as=require(_0x5dfa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dfa('0x12'))(_0x5dfa('0x13'));var utils=require(_0x5dfa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5dfa('0x15'));var db=require(_0x5dfa('0x16'))['db'];config[_0x5dfa('0x17')]=_[_0x5dfa('0x18')](config[_0x5dfa('0x17')],{'host':_0x5dfa('0x19'),'port':0x18eb});var socket=require(_0x5dfa('0x1a'))(new Redis(config[_0x5dfa('0x17')]));require(_0x5dfa('0x1b'))[_0x5dfa('0x1c')](socket);function respondWithStatusCode(_0x3ea78f,_0x294788){_0x294788=_0x294788||0xcc;return function(_0x55e74e){if(_0x55e74e){return _0x3ea78f['sendStatus'](_0x294788);}return _0x3ea78f[_0x5dfa('0x1d')](_0x294788)[_0x5dfa('0x1e')]();};}function respondWithResult(_0x2186fb,_0x2eab6b){_0x2eab6b=_0x2eab6b||0xc8;return function(_0x5c1d80){if(_0x5c1d80){return _0x2186fb[_0x5dfa('0x1d')](_0x2eab6b)[_0x5dfa('0x1f')](_0x5c1d80);}};}function respondWithFilteredResult(_0x313fd7,_0xcc5d81){return function(_0x1cf008){if(_0x1cf008){var _0x51c255=typeof _0xcc5d81[_0x5dfa('0x20')]===_0x5dfa('0x21')&&typeof _0xcc5d81[_0x5dfa('0x22')]===_0x5dfa('0x21');var _0x10f0fc=_0x1cf008[_0x5dfa('0x23')];var _0x200b50=_0x51c255?0x0:_0xcc5d81[_0x5dfa('0x20')];var _0x263478=_0x51c255?_0x1cf008[_0x5dfa('0x23')]:_0xcc5d81[_0x5dfa('0x20')]+_0xcc5d81['limit'];var _0x222a26;if(_0x263478>=_0x10f0fc){_0x263478=_0x10f0fc;_0x222a26=0xc8;}else{_0x222a26=0xce;}_0x313fd7[_0x5dfa('0x1d')](_0x222a26);return _0x313fd7[_0x5dfa('0x24')](_0x5dfa('0x25'),_0x200b50+'-'+_0x263478+'/'+_0x10f0fc)[_0x5dfa('0x1f')](_0x1cf008);}return null;};}function patchUpdates(_0x2a4922){return function(_0x1ac624){try{jsonpatch[_0x5dfa('0x26')](_0x1ac624,_0x2a4922,!![]);}catch(_0x118407){return BPromise['reject'](_0x118407);}return _0x1ac624[_0x5dfa('0x27')]();};}function saveUpdates(_0x562ad1,_0xb73376){return function(_0x54e085){if(_0x54e085){return _0x54e085['update'](_0x562ad1)[_0x5dfa('0x28')](function(_0x15f33f){return _0x15f33f;});}return null;};}function removeEntity(_0xb67f96,_0x35040d){return function(_0xc56421){if(_0xc56421){return _0xc56421[_0x5dfa('0x29')]()[_0x5dfa('0x28')](function(){_0xb67f96[_0x5dfa('0x1d')](0xcc)[_0x5dfa('0x1e')]();});}};}function handleEntityNotFound(_0x132d91,_0xbc9bb7){return function(_0x319263){if(!_0x319263){_0x132d91['sendStatus'](0x194);}return _0x319263;};}function handleError(_0x31ae1b,_0x24e8f2){_0x24e8f2=_0x24e8f2||0x1f4;return function(_0x4f0c74){logger[_0x5dfa('0x2a')](_0x4f0c74['stack']);if(_0x4f0c74['name']){delete _0x4f0c74['name'];}_0x31ae1b[_0x5dfa('0x1d')](_0x24e8f2)[_0x5dfa('0x2b')](_0x4f0c74);};}exports[_0x5dfa('0x2c')]=function(_0x1865db,_0x41c4bd,_0x4e63bd){if(!_0x1865db['body'][_0x5dfa('0x2d')](_0x5dfa('0x2e'))&&!_0x1865db[_0x5dfa('0x2f')][_0x5dfa('0x2d')](_0x5dfa('0x30'))){throw new db['Sequelize'][(_0x5dfa('0x31'))](_0x5dfa('0x32'));}else{if(_0x1865db['body']['hasOwnProperty'](_0x5dfa('0x30'))&&!_0x1865db['body'][_0x5dfa('0x2d')](_0x5dfa('0x33'))){throw new db[(_0x5dfa('0x34'))][(_0x5dfa('0x31'))](_0x5dfa('0x35'));}if(!_0x1865db[_0x5dfa('0x2f')][_0x5dfa('0x2d')](_0x5dfa('0x36'))){throw new db[(_0x5dfa('0x34'))][(_0x5dfa('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2fc70d=JSON[_0x5dfa('0x37')](_0x1865db[_0x5dfa('0x2f')]['recipients']);}catch(_0x4365ad){logger[_0x5dfa('0x2a')](_0x4365ad);throw new db[(_0x5dfa('0x34'))][(_0x5dfa('0x31'))](_0x5dfa('0x38'));}var _0x4dc216=[_0x5dfa('0x39'),_0x5dfa('0x3a'),'mailqueue',_0x5dfa('0x3b'),_0x5dfa('0x3c'),_0x5dfa('0x3d'),_0x5dfa('0x3e'),_0x5dfa('0x3f'),_0x5dfa('0x40')];if(_[_0x5dfa('0x41')](_0x2fc70d,function(_0x17f137){return!_[_0x5dfa('0x42')](_0x4dc216,_0x17f137[_0x5dfa('0x43')]['toLowerCase']());})){throw new db['Sequelize'][(_0x5dfa('0x31'))](_0x5dfa('0x44'));}}}var _0xeb1be9={};_0xeb1be9['senderName']=_0x1865db[_0x5dfa('0x2f')][_0x5dfa('0x2d')](_0x5dfa('0x45'))?_0x1865db['body'][_0x5dfa('0x45')]:_0x1865db[_0x5dfa('0x40')][_0x5dfa('0x46')];_0xeb1be9[_0x5dfa('0x47')]=_[_0x5dfa('0x48')](_0x1865db[_0x5dfa('0x2f')][_0x5dfa('0x47')])?null:_0x1865db['body']['recipientsDescription'];_0xeb1be9[_0x5dfa('0x49')]=_0x1865db[_0x5dfa('0x2f')]['beep']||![];_0xeb1be9[_0x5dfa('0x4a')]=_0x1865db[_0x5dfa('0x40')]['id'];return getContent(_0x1865db[_0x5dfa('0x2f')])[_0x5dfa('0x28')](function(_0x351e12){_0xeb1be9[_0x5dfa('0x2f')]=_0x351e12;return getRecipients(_0x2fc70d);})[_0x5dfa('0x28')](function(_0x307ec9){_0xeb1be9[_0x5dfa('0x4b')]=_[_0x5dfa('0x4c')](_0x307ec9)[_0x5dfa('0x4d')](',');return db['sequelize']['transaction'](function(_0x49c84c){return db['UserNotification']['create'](_0xeb1be9,{'raw':!![],'transaction':_0x49c84c})['then'](function(_0x25b22d){var _0x352e8c={'sender':_0xeb1be9['senderName'],'description':_0xeb1be9['recipientsDescription'],'content':_0xeb1be9[_0x5dfa('0x2f')],'beep':_0xeb1be9[_0x5dfa('0x49')]};_0x307ec9['forEach'](function(_0x4604dc){_0x352e8c[_0x5dfa('0x4e')]=_0x4604dc;socket['emit'](_0x5dfa('0x4f'),_0x352e8c);});return _0x25b22d;});});})[_0x5dfa('0x28')](respondWithResult(_0x41c4bd,0xc9))[_0x5dfa('0x50')](handleError(_0x41c4bd,null));};function getContent(_0x5bd177){return new BPromise(function(_0x3c7b59,_0x1c6511){if(_0x5bd177['text']){_0x3c7b59(_0x5bd177[_0x5dfa('0x2e')]);return;}return db['Template'][_0x5dfa('0x51')]({'attributes':[_0x5dfa('0x52')],'where':{'id':_0x5bd177['TemplateId']},'raw':!![]})[_0x5dfa('0x28')](function(_0x8a7fa1){if(!_0x8a7fa1)throw new db[(_0x5dfa('0x34'))][(_0x5dfa('0x31'))](_0x5dfa('0x53'));var _0x5cf91a=Mustache[_0x5dfa('0x54')](_0x8a7fa1[_0x5dfa('0x52')],_0x5bd177['view']);_0x3c7b59(_0x5cf91a);})[_0x5dfa('0x50')](function(_0xc0172e){_0x1c6511(_0xc0172e);});});}function getRecipients(_0x206ff8){return new BPromise(function(_0x55829f,_0x4cedc1){var _0x5b86fb=[];var _0x4dd8dd=[];_0x206ff8[_0x5dfa('0x55')](function(_0x3081e1){var _0x33b64e=_['startCase'](_0x3081e1[_0x5dfa('0x43')]['toLowerCase']());if(_0x33b64e===_0x5dfa('0x56')){_0x5b86fb=_[_0x5dfa('0x57')](_0x5b86fb,_0x3081e1[_0x5dfa('0x58')]);}else{if(_['includes'](_0x33b64e,_0x5dfa('0x59')))_0x33b64e=_0x33b64e[_0x5dfa('0x5a')](_0x5dfa('0x59'),_0x5dfa('0x5b'));_0x3081e1[_0x5dfa('0x58')][_0x5dfa('0x55')](function(_0xd0b73c){_0x4dd8dd[_0x5dfa('0x5c')](getAgents(_0x33b64e,_0xd0b73c));});}});return BPromise[_0x5dfa('0x5d')](_0x4dd8dd)[_0x5dfa('0x28')](function(_0x3bbd69){_0x5b86fb=_[_0x5dfa('0x57')](_0x5b86fb,_[_0x5dfa('0x5e')](_0x3bbd69));_0x55829f(_0x5b86fb);})[_0x5dfa('0x50')](function(_0x3e9c2b){_0x4cedc1(_0x3e9c2b);});});}function getAgents(_0x5e016c,_0xedd72f){return new BPromise(function(_0x39e4a8,_0x510fb4){return db[_0x5e016c]['findOne']({'where':{'id':_0xedd72f}})[_0x5dfa('0x28')](function(_0x5a1709){return _0x5a1709[_0x5dfa('0x5f')]({'attributes':['id'],'raw':!![]})[_0x5dfa('0x28')](function(_0x3d349a){var _0x5eaa36=_[_0x5dfa('0x60')](_0x3d349a,'id');_0x39e4a8(_0x5eaa36);});})[_0x5dfa('0x50')](function(_0x2a11ff){_0x510fb4(_0x2a11ff);});});} \ No newline at end of file +var _0xeae6=['limit','undefined','count','apply','save','update','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','union','ids','queue','replace','all','getAgents','map','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xeae6,0x1a0));var _0x6eae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeae6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6eae('0x0'));var jsonpatch=require(_0x6eae('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6eae('0x2'));var util=require(_0x6eae('0x3'));var path=require(_0x6eae('0x4'));var sox=require(_0x6eae('0x5'));var csv=require('to-csv');var ejs=require(_0x6eae('0x6'));var fs=require('fs');var fs_extra=require(_0x6eae('0x7'));var _=require(_0x6eae('0x8'));var squel=require(_0x6eae('0x9'));var crypto=require(_0x6eae('0xa'));var jsforce=require(_0x6eae('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6eae('0xc'));var querystring=require(_0x6eae('0xd'));var Papa=require(_0x6eae('0xe'));var Redis=require(_0x6eae('0xf'));var authService=require(_0x6eae('0x10'));var qs=require(_0x6eae('0x11'));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('../../config/environment');var licenseUtil=require(_0x6eae('0x12'));var db=require('../../mysqldb')['db'];config[_0x6eae('0x13')]=_[_0x6eae('0x14')](config[_0x6eae('0x13')],{'host':_0x6eae('0x15'),'port':0x18eb});var socket=require(_0x6eae('0x16'))(new Redis(config['redis']));require('./userNotification.socket')[_0x6eae('0x17')](socket);function respondWithStatusCode(_0x1cd388,_0x3c78c4){_0x3c78c4=_0x3c78c4||0xcc;return function(_0x2a2d7b){if(_0x2a2d7b){return _0x1cd388[_0x6eae('0x18')](_0x3c78c4);}return _0x1cd388['status'](_0x3c78c4)[_0x6eae('0x19')]();};}function respondWithResult(_0x2bca4e,_0x5bfda4){_0x5bfda4=_0x5bfda4||0xc8;return function(_0x5a2fd3){if(_0x5a2fd3){return _0x2bca4e[_0x6eae('0x1a')](_0x5bfda4)[_0x6eae('0x1b')](_0x5a2fd3);}};}function respondWithFilteredResult(_0x1a82e1,_0x5d9520){return function(_0x3ef332){if(_0x3ef332){var _0x18fe98=typeof _0x5d9520[_0x6eae('0x1c')]==='undefined'&&typeof _0x5d9520[_0x6eae('0x1d')]===_0x6eae('0x1e');var _0x22068b=_0x3ef332[_0x6eae('0x1f')];var _0x1dbacc=_0x18fe98?0x0:_0x5d9520[_0x6eae('0x1c')];var _0x53c7c8=_0x18fe98?_0x3ef332[_0x6eae('0x1f')]:_0x5d9520[_0x6eae('0x1c')]+_0x5d9520[_0x6eae('0x1d')];var _0xf3631d;if(_0x53c7c8>=_0x22068b){_0x53c7c8=_0x22068b;_0xf3631d=0xc8;}else{_0xf3631d=0xce;}_0x1a82e1[_0x6eae('0x1a')](_0xf3631d);return _0x1a82e1['set']('Content-Range',_0x1dbacc+'-'+_0x53c7c8+'/'+_0x22068b)[_0x6eae('0x1b')](_0x3ef332);}return null;};}function patchUpdates(_0x570fb0){return function(_0x5ee1b1){try{jsonpatch[_0x6eae('0x20')](_0x5ee1b1,_0x570fb0,!![]);}catch(_0x53c006){return BPromise['reject'](_0x53c006);}return _0x5ee1b1[_0x6eae('0x21')]();};}function saveUpdates(_0x40c79d,_0x3d5c5d){return function(_0x275402){if(_0x275402){return _0x275402[_0x6eae('0x22')](_0x40c79d)[_0x6eae('0x23')](function(_0xe1303e){return _0xe1303e;});}return null;};}function removeEntity(_0x51e41c,_0x53b27a){return function(_0x5b3cf8){if(_0x5b3cf8){return _0x5b3cf8[_0x6eae('0x24')]()['then'](function(){_0x51e41c[_0x6eae('0x1a')](0xcc)[_0x6eae('0x19')]();});}};}function handleEntityNotFound(_0x3c40f4,_0x940fed){return function(_0x593525){if(!_0x593525){_0x3c40f4[_0x6eae('0x18')](0x194);}return _0x593525;};}function handleError(_0x23cc88,_0x1d5878){_0x1d5878=_0x1d5878||0x1f4;return function(_0x3d824f){logger[_0x6eae('0x25')](_0x3d824f[_0x6eae('0x26')]);if(_0x3d824f[_0x6eae('0x27')]){delete _0x3d824f[_0x6eae('0x27')];}_0x23cc88[_0x6eae('0x1a')](_0x1d5878)['send'](_0x3d824f);};}exports[_0x6eae('0x28')]=function(_0x54b4ac,_0x402aa7,_0x740e4b){if(!_0x54b4ac['body'][_0x6eae('0x29')](_0x6eae('0x2a'))&&!_0x54b4ac['body'][_0x6eae('0x29')](_0x6eae('0x2b'))){throw new db['Sequelize'][(_0x6eae('0x2c'))](_0x6eae('0x2d'));}else{if(_0x54b4ac[_0x6eae('0x2e')][_0x6eae('0x29')](_0x6eae('0x2b'))&&!_0x54b4ac[_0x6eae('0x2e')][_0x6eae('0x29')](_0x6eae('0x2f'))){throw new db[(_0x6eae('0x30'))][(_0x6eae('0x2c'))](_0x6eae('0x31'));}if(!_0x54b4ac['body'][_0x6eae('0x29')]('recipients')){throw new db[(_0x6eae('0x30'))][(_0x6eae('0x2c'))](_0x6eae('0x32'));}else{try{var _0x38424c=JSON[_0x6eae('0x33')](_0x54b4ac[_0x6eae('0x2e')][_0x6eae('0x34')]);}catch(_0x1b5082){logger['error'](_0x1b5082);throw new db[(_0x6eae('0x30'))]['ValidationError'](_0x6eae('0x35'));}var _0x5b73f6=['chatqueue','faxqueue','mailqueue','openchannelqueue',_0x6eae('0x36'),_0x6eae('0x37'),_0x6eae('0x38'),_0x6eae('0x39'),_0x6eae('0x3a')];if(_[_0x6eae('0x3b')](_0x38424c,function(_0x307efc){return!_[_0x6eae('0x3c')](_0x5b73f6,_0x307efc[_0x6eae('0x3d')][_0x6eae('0x3e')]());})){throw new db[(_0x6eae('0x30'))][(_0x6eae('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x47032b={};_0x47032b[_0x6eae('0x3f')]=_0x54b4ac['body'][_0x6eae('0x29')](_0x6eae('0x3f'))?_0x54b4ac['body'][_0x6eae('0x3f')]:_0x54b4ac[_0x6eae('0x3a')][_0x6eae('0x40')];_0x47032b[_0x6eae('0x41')]=_['isEmpty'](_0x54b4ac[_0x6eae('0x2e')]['recipientsDescription'])?null:_0x54b4ac['body'][_0x6eae('0x41')];_0x47032b[_0x6eae('0x42')]=_0x54b4ac[_0x6eae('0x2e')][_0x6eae('0x42')]||![];_0x47032b['SenderId']=_0x54b4ac[_0x6eae('0x3a')]['id'];return getContent(_0x54b4ac[_0x6eae('0x2e')])['then'](function(_0x145191){_0x47032b['body']=_0x145191;return getRecipients(_0x38424c);})[_0x6eae('0x23')](function(_0x33bb12){_0x47032b[_0x6eae('0x43')]=_[_0x6eae('0x44')](_0x33bb12)[_0x6eae('0x45')](',');return db[_0x6eae('0x46')][_0x6eae('0x47')](function(_0x1f66c2){return db[_0x6eae('0x48')][_0x6eae('0x49')](_0x47032b,{'raw':!![],'transaction':_0x1f66c2})[_0x6eae('0x23')](function(_0x321809){var _0x23a3bf={'sender':_0x47032b[_0x6eae('0x3f')],'description':_0x47032b['recipientsDescription'],'content':_0x47032b['body'],'beep':_0x47032b['beep']};_0x33bb12[_0x6eae('0x4a')](function(_0x702fe2){_0x23a3bf[_0x6eae('0x4b')]=_0x702fe2;socket['emit'](_0x6eae('0x4c'),_0x23a3bf);});return _0x321809;});});})[_0x6eae('0x23')](respondWithResult(_0x402aa7,0xc9))['catch'](handleError(_0x402aa7,null));};function getContent(_0x14b4e9){return new BPromise(function(_0x137713,_0x191e52){if(_0x14b4e9['text']){_0x137713(_0x14b4e9[_0x6eae('0x2a')]);return;}return db['Template'][_0x6eae('0x4d')]({'attributes':[_0x6eae('0x4e')],'where':{'id':_0x14b4e9[_0x6eae('0x2b')]},'raw':!![]})[_0x6eae('0x23')](function(_0x4ed037){if(!_0x4ed037)throw new db[(_0x6eae('0x30'))][(_0x6eae('0x2c'))](_0x6eae('0x4f'));var _0x2bd052=Mustache[_0x6eae('0x50')](_0x4ed037[_0x6eae('0x4e')],_0x14b4e9['view']);_0x137713(_0x2bd052);})['catch'](function(_0x350e70){_0x191e52(_0x350e70);});});}function getRecipients(_0x34b824){return new BPromise(function(_0x20fb33,_0xa8e0fe){var _0x5e2349=[];var _0x3f6d8d=[];_0x34b824[_0x6eae('0x4a')](function(_0x5cfe1c){var _0x4519a8=_['startCase'](_0x5cfe1c['model'][_0x6eae('0x3e')]());if(_0x4519a8===_0x6eae('0x51')){_0x5e2349=_[_0x6eae('0x52')](_0x5e2349,_0x5cfe1c[_0x6eae('0x53')]);}else{if(_[_0x6eae('0x3c')](_0x4519a8,_0x6eae('0x54')))_0x4519a8=_0x4519a8[_0x6eae('0x55')]('queue','Queue');_0x5cfe1c[_0x6eae('0x53')][_0x6eae('0x4a')](function(_0x2f2a40){_0x3f6d8d['push'](getAgents(_0x4519a8,_0x2f2a40));});}});return BPromise[_0x6eae('0x56')](_0x3f6d8d)[_0x6eae('0x23')](function(_0xeb7df5){_0x5e2349=_[_0x6eae('0x52')](_0x5e2349,_['flatten'](_0xeb7df5));_0x20fb33(_0x5e2349);})['catch'](function(_0x304dd1){_0xa8e0fe(_0x304dd1);});});}function getAgents(_0x22c4d3,_0x2a216e){return new BPromise(function(_0x3b0cfd,_0x564a9d){return db[_0x22c4d3][_0x6eae('0x4d')]({'where':{'id':_0x2a216e}})[_0x6eae('0x23')](function(_0x44f8e7){return _0x44f8e7[_0x6eae('0x57')]({'attributes':['id'],'raw':!![]})[_0x6eae('0x23')](function(_0x149ac6){var _0x2ee90c=_[_0x6eae('0x58')](_0x149ac6,'id');_0x3b0cfd(_0x2ee90c);});})['catch'](function(_0x45c876){_0x564a9d(_0x45c876);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 156e214..62b51a3 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 _0xdd2f=['../../mysqldb','UserNotification','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x390190,_0x45a89e){var _0x30a1ec=function(_0x1b4bca){while(--_0x1b4bca){_0x390190['push'](_0x390190['shift']());}};_0x30a1ec(++_0x45a89e);}(_0xdd2f,0xaf));var _0xfdd2=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xdd2f[_0x1e7b16];return _0x37fadc;};'use strict';var EventEmitter=require(_0xfdd2('0x0'));var UserNotification=require(_0xfdd2('0x1'))['db'][_0xfdd2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd2('0x3'),'afterDestroy':_0xfdd2('0x4')};function emitEvent(_0xed322c){return function(_0x203781,_0x6db842,_0x5e67fd){UserNotificationEvents[_0xfdd2('0x5')](_0xed322c+':'+_0x203781['id'],_0x203781);UserNotificationEvents['emit'](_0xed322c,_0x203781);_0x5e67fd(null);};}for(var e in events){if(events[_0xfdd2('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xfdd2('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xcb87=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update'];(function(_0x1ac767,_0xbb465a){var _0x1d570b=function(_0x3b045d){while(--_0x3b045d){_0x1ac767['push'](_0x1ac767['shift']());}};_0x1d570b(++_0xbb465a);}(_0xcb87,0x1cb));var _0x7cb8=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xcb87[_0x1ee62e];return _0x27c6c8;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x7cb8('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7cb8('0x1'),'afterUpdate':_0x7cb8('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3e8d0a){return function(_0x21a20d,_0x1f9247,_0x2eb5ee){UserNotificationEvents[_0x7cb8('0x3')](_0x3e8d0a+':'+_0x21a20d['id'],_0x21a20d);UserNotificationEvents['emit'](_0x3e8d0a,_0x21a20d);_0x2eb5ee(null);};}for(var e in events){if(events[_0x7cb8('0x4')](e)){var event=events[e];UserNotification[_0x7cb8('0x5')](e,emitEvent(event));}}module[_0x7cb8('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 0a34c95..d6db0a5 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 _0x4e55=['./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42f6e6,_0x3e73d0){var _0x486fdb=function(_0x203417){while(--_0x203417){_0x42f6e6['push'](_0x42f6e6['shift']());}};_0x486fdb(++_0x3e73d0);}(_0x4e55,0x12b));var _0x54e5=function(_0x187bb2,_0x2f59bf){_0x187bb2=_0x187bb2-0x0;var _0x4af854=_0x4e55[_0x187bb2];return _0x4af854;};'use strict';var _=require('lodash');var util=require(_0x54e5('0x0'));var logger=require(_0x54e5('0x1'))(_0x54e5('0x2'));var moment=require(_0x54e5('0x3'));var BPromise=require(_0x54e5('0x4'));var rp=require(_0x54e5('0x5'));var fs=require('fs');var path=require(_0x54e5('0x6'));var rimraf=require(_0x54e5('0x7'));var config=require(_0x54e5('0x8'));var attributes=require(_0x54e5('0x9'));module[_0x54e5('0xa')]=function(_0x976b36,_0x1a56af){return _0x976b36['define'](_0x54e5('0xb'),attributes,{'tableName':_0x54e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x54e5('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9458=['../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2f0939,_0x1bd6fe){var _0x317e69=function(_0x2ca863){while(--_0x2ca863){_0x2f0939['push'](_0x2f0939['shift']());}};_0x317e69(++_0x1bd6fe);}(_0x9458,0x1e8));var _0x8945=function(_0x1b9068,_0x192878){_0x1b9068=_0x1b9068-0x0;var _0x202d6d=_0x9458[_0x1b9068];return _0x202d6d;};'use strict';var _=require(_0x8945('0x0'));var util=require(_0x8945('0x1'));var logger=require(_0x8945('0x2'))(_0x8945('0x3'));var moment=require('moment');var BPromise=require(_0x8945('0x4'));var rp=require(_0x8945('0x5'));var fs=require('fs');var path=require(_0x8945('0x6'));var rimraf=require('rimraf');var config=require(_0x8945('0x7'));var attributes=require(_0x8945('0x8'));module[_0x8945('0x9')]=function(_0x587cb7,_0xe9f8da){return _0x587cb7[_0x8945('0xa')](_0x8945('0xb'),attributes,{'tableName':_0x8945('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8945('0xd'),'collate':_0x8945('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 46eebb5..8f84ed9 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 _0x22f7=['error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x144d5b,_0x582ed3){var _0x1ed218=function(_0x247692){while(--_0x247692){_0x144d5b['push'](_0x144d5b['shift']());}};_0x1ed218(++_0x582ed3);}(_0x22f7,0x146));var _0x722f=function(_0x28ba34,_0x5958b0){_0x28ba34=_0x28ba34-0x0;var _0x3ba495=_0x22f7[_0x28ba34];return _0x3ba495;};'use strict';var _=require(_0x722f('0x0'));var util=require(_0x722f('0x1'));var moment=require('moment');var BPromise=require(_0x722f('0x2'));var rs=require(_0x722f('0x3'));var fs=require('fs');var Redis=require(_0x722f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x722f('0x5'));var logger=require(_0x722f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x722f('0x7'));var client=jayson[_0x722f('0x8')]['http']({'port':0x232a});config[_0x722f('0x9')]=_[_0x722f('0xa')](config[_0x722f('0x9')],{'host':_0x722f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x722f('0x9')]));require(_0x722f('0xc'))['register'](socket);function respondWithRpcPromise(_0x1bb54f,_0x948be2,_0x55b0a5){return new BPromise(function(_0x22ef61,_0x493143){return client[_0x722f('0xd')](_0x1bb54f,_0x55b0a5)[_0x722f('0xe')](function(_0x51e8ab){logger[_0x722f('0xf')](_0x722f('0x10'),_0x948be2,_0x722f('0x11'));logger[_0x722f('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x948be2,_0x722f('0x11'),JSON['stringify'](_0x51e8ab));if(_0x51e8ab['error']){if(_0x51e8ab[_0x722f('0x13')][_0x722f('0x14')]===0x1f4){logger[_0x722f('0x13')](_0x722f('0x10'),_0x948be2,_0x51e8ab[_0x722f('0x13')][_0x722f('0x15')]);return _0x493143(_0x51e8ab[_0x722f('0x13')][_0x722f('0x15')]);}logger[_0x722f('0x13')](_0x722f('0x10'),_0x948be2,_0x51e8ab['error'][_0x722f('0x15')]);return _0x22ef61(_0x51e8ab['error'][_0x722f('0x15')]);}else{logger[_0x722f('0xf')](_0x722f('0x10'),_0x948be2,_0x722f('0x11'));_0x22ef61(_0x51e8ab[_0x722f('0x16')][_0x722f('0x15')]);}})['catch'](function(_0xf13209){logger[_0x722f('0x13')](_0x722f('0x10'),_0x948be2,_0xf13209);_0x493143(_0xf13209);});});} \ No newline at end of file +var _0x49a4=['then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x49a4,0x167));var _0x449a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x49a4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x449a('0x0'));var util=require(_0x449a('0x1'));var moment=require('moment');var BPromise=require(_0x449a('0x2'));var rs=require(_0x449a('0x3'));var fs=require('fs');var Redis=require(_0x449a('0x4'));var db=require(_0x449a('0x5'))['db'];var utils=require(_0x449a('0x6'));var logger=require(_0x449a('0x7'))('rpc');var config=require(_0x449a('0x8'));var jayson=require(_0x449a('0x9'));var client=jayson[_0x449a('0xa')]['http']({'port':0x232a});config[_0x449a('0xb')]=_[_0x449a('0xc')](config[_0x449a('0xb')],{'host':_0x449a('0xd'),'port':0x18eb});var socket=require(_0x449a('0xe'))(new Redis(config['redis']));require(_0x449a('0xf'))[_0x449a('0x10')](socket);function respondWithRpcPromise(_0x34f03d,_0x2d64f1,_0xfcd668){return new BPromise(function(_0x180b26,_0x448079){return client[_0x449a('0x11')](_0x34f03d,_0xfcd668)[_0x449a('0x12')](function(_0xf05e86){logger['info'](_0x449a('0x13'),_0x2d64f1,_0x449a('0x14'));logger[_0x449a('0x15')](_0x449a('0x16'),_0x2d64f1,_0x449a('0x14'),JSON[_0x449a('0x17')](_0xf05e86));if(_0xf05e86[_0x449a('0x18')]){if(_0xf05e86[_0x449a('0x18')]['code']===0x1f4){logger[_0x449a('0x18')]('UserNotification,\x20%s,\x20%s',_0x2d64f1,_0xf05e86['error'][_0x449a('0x19')]);return _0x448079(_0xf05e86[_0x449a('0x18')][_0x449a('0x19')]);}logger[_0x449a('0x18')](_0x449a('0x13'),_0x2d64f1,_0xf05e86[_0x449a('0x18')][_0x449a('0x19')]);return _0x180b26(_0xf05e86[_0x449a('0x18')][_0x449a('0x19')]);}else{logger[_0x449a('0x1a')](_0x449a('0x13'),_0x2d64f1,'request\x20sent');_0x180b26(_0xf05e86[_0x449a('0x1b')]['message']);}})[_0x449a('0x1c')](function(_0x4b8431){logger[_0x449a('0x18')](_0x449a('0x13'),_0x2d64f1,_0x4b8431);_0x448079(_0x4b8431);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6d0472d..ed549dd 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 _0xf2ef=['length','userNotification:','save','remove','update','emit','removeListener','register'];(function(_0x463007,_0x29be8b){var _0x4b731f=function(_0x2def50){while(--_0x2def50){_0x463007['push'](_0x463007['shift']());}};_0x4b731f(++_0x29be8b);}(_0xf2ef,0x92));var _0xff2e=function(_0xc9414a,_0x4e4c8b){_0xc9414a=_0xc9414a-0x0;var _0x34a507=_0xf2ef[_0xc9414a];return _0x34a507;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xff2e('0x0'),_0xff2e('0x1'),_0xff2e('0x2')];function createListener(_0x26caef,_0x205a64){return function(_0x2c3639){_0x205a64[_0xff2e('0x3')](_0x26caef,_0x2c3639);};}function removeListener(_0x484ef9,_0x4153c9){return function(){UserNotificationEvents[_0xff2e('0x4')](_0x484ef9,_0x4153c9);};}exports[_0xff2e('0x5')]=function(_0x5d5420){for(var _0x2f885c=0x0,_0x264070=events[_0xff2e('0x6')];_0x2f885c<_0x264070;_0x2f885c++){var _0x350569=events[_0x2f885c];var _0x2cdf39=createListener(_0xff2e('0x7')+_0x350569,_0x5d5420);UserNotificationEvents['on'](_0x350569,_0x2cdf39);}}; \ No newline at end of file +var _0x0064=['removeListener','length','userNotification:','./userNotification.events','update'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x0064,0x1ca));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x4006('0x0'));var events=['save','remove',_0x4006('0x1')];function createListener(_0x48de84,_0x400efd){return function(_0x258ebe){_0x400efd['emit'](_0x48de84,_0x258ebe);};}function removeListener(_0x39cf02,_0xb16957){return function(){UserNotificationEvents[_0x4006('0x2')](_0x39cf02,_0xb16957);};}exports['register']=function(_0x1d2581){for(var _0x168070=0x0,_0x4ac170=events[_0x4006('0x3')];_0x168070<_0x4ac170;_0x168070++){var _0x30dfdb=events[_0x168070];var _0x5fb9ad=createListener(_0x4006('0x4')+_0x30dfdb,_0x1d2581);UserNotificationEvents['on'](_0x30dfdb,_0x5fb9ad);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 030f92d..d39ff52 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2b3cad,_0x573629){var _0x2175c4=function(_0x2f5a4f){while(--_0x2f5a4f){_0x2b3cad['push'](_0x2b3cad['shift']());}};_0x2175c4(++_0x573629);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4d0729,_0x107590){var _0xe3c29f=function(_0x2774a0){while(--_0x2774a0){_0x4d0729['push'](_0x4d0729['shift']());}};_0xe3c29f(++_0x107590);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 63071e8..98ae980 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 _0x8477=['sequelize'];(function(_0x427041,_0x14c305){var _0xfd0908=function(_0x3ff9b1){while(--_0x3ff9b1){_0x427041['push'](_0x427041['shift']());}};_0xfd0908(++_0x14c305);}(_0x8477,0xea));var _0x7847=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x8477[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0x7847('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8bb2=['exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8bb2,0x1b1));var _0x28bb=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x8bb2[_0x2c96f6];return _0x6d4808;};'use strict';var Sequelize=require('sequelize');module[_0x28bb('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4b2e802..e07d656 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 _0x59a9=['define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','path','rimraf','../../config/environment','exports'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x59a9,0x159));var _0x959a=function(_0x4253f9,_0x4a5071){_0x4253f9=_0x4253f9-0x0;var _0x2fb91e=_0x59a9[_0x4253f9];return _0x2fb91e;};'use strict';var _=require('lodash');var util=require(_0x959a('0x0'));var logger=require(_0x959a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x959a('0x2'));var rimraf=require(_0x959a('0x3'));var config=require(_0x959a('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x959a('0x5')]=function(_0x27357d,_0x2b4ddd){return _0x27357d[_0x959a('0x6')](_0x959a('0x7'),attributes,{'tableName':_0x959a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf396=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash'];(function(_0x49d610,_0x3b14e2){var _0x4c6a73=function(_0x2f3215){while(--_0x2f3215){_0x49d610['push'](_0x49d610['shift']());}};_0x4c6a73(++_0x3b14e2);}(_0xf396,0x8e));var _0x6f39=function(_0x4651ae,_0x3d2bc0){_0x4651ae=_0x4651ae-0x0;var _0x29a97c=_0xf396[_0x4651ae];return _0x29a97c;};'use strict';var _=require(_0x6f39('0x0'));var util=require(_0x6f39('0x1'));var logger=require(_0x6f39('0x2'))(_0x6f39('0x3'));var moment=require(_0x6f39('0x4'));var BPromise=require(_0x6f39('0x5'));var rp=require(_0x6f39('0x6'));var fs=require('fs');var path=require(_0x6f39('0x7'));var rimraf=require(_0x6f39('0x8'));var config=require(_0x6f39('0x9'));var attributes=require(_0x6f39('0xa'));module['exports']=function(_0x4445ed,_0x3e65b5){return _0x4445ed[_0x6f39('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0x6f39('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 1d42347..a1a3b77 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 _0xb5bb=['lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb5bb,0x72));var _0xbb5b=function(_0x5c4249,_0x294bfd){_0x5c4249=_0x5c4249-0x0;var _0x559edb=_0xb5bb[_0x5c4249];return _0x559edb;};'use strict';var _=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var moment=require(_0xbb5b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbb5b('0x3'));var logger=require(_0xbb5b('0x4'))(_0xbb5b('0x5'));var config=require(_0xbb5b('0x6'));var jayson=require(_0xbb5b('0x7'));var client=jayson[_0xbb5b('0x8')][_0xbb5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16f8af,_0x181027,_0x11c35e){return new BPromise(function(_0x1a2eff,_0xd45e96){return client['request'](_0x16f8af,_0x11c35e)[_0xbb5b('0xa')](function(_0x44580c){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x181027,_0xbb5b('0xb'));logger['debug'](_0xbb5b('0xc'),_0x181027,_0xbb5b('0xb'),JSON['stringify'](_0x44580c));if(_0x44580c[_0xbb5b('0xd')]){if(_0x44580c['error']['code']===0x1f4){logger[_0xbb5b('0xd')](_0xbb5b('0xe'),_0x181027,_0x44580c['error'][_0xbb5b('0xf')]);return _0xd45e96(_0x44580c['error'][_0xbb5b('0xf')]);}logger['error'](_0xbb5b('0xe'),_0x181027,_0x44580c[_0xbb5b('0xd')][_0xbb5b('0xf')]);return _0x1a2eff(_0x44580c[_0xbb5b('0xd')][_0xbb5b('0xf')]);}else{logger[_0xbb5b('0x10')](_0xbb5b('0xe'),_0x181027,'request\x20sent');_0x1a2eff(_0x44580c[_0xbb5b('0x11')]['message']);}})[_0xbb5b('0x12')](function(_0x14df0d){logger[_0xbb5b('0xd')](_0xbb5b('0xe'),_0x181027,_0x14df0d);_0xd45e96(_0x14df0d);});});} \ No newline at end of file +var _0xf840=['jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xf840,0xff));var _0x0f84=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0xf840[_0x58b44a];return _0xd6779d;};'use strict';var _=require('lodash');var util=require(_0x0f84('0x0'));var moment=require(_0x0f84('0x1'));var BPromise=require(_0x0f84('0x2'));var rs=require(_0x0f84('0x3'));var fs=require('fs');var Redis=require(_0x0f84('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f84('0x5'));var logger=require(_0x0f84('0x6'))(_0x0f84('0x7'));var config=require(_0x0f84('0x8'));var jayson=require(_0x0f84('0x9'));var client=jayson[_0x0f84('0xa')][_0x0f84('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290e21,_0x1673bc,_0x5dd438){return new BPromise(function(_0x319360,_0x190c6f){return client[_0x0f84('0xc')](_0x290e21,_0x5dd438)['then'](function(_0x4a7f05){logger[_0x0f84('0xd')](_0x0f84('0xe'),_0x1673bc,'request\x20sent');logger['debug'](_0x0f84('0xf'),_0x1673bc,_0x0f84('0x10'),JSON['stringify'](_0x4a7f05));if(_0x4a7f05['error']){if(_0x4a7f05[_0x0f84('0x11')][_0x0f84('0x12')]===0x1f4){logger[_0x0f84('0x11')](_0x0f84('0xe'),_0x1673bc,_0x4a7f05['error'][_0x0f84('0x13')]);return _0x190c6f(_0x4a7f05[_0x0f84('0x11')][_0x0f84('0x13')]);}logger[_0x0f84('0x11')](_0x0f84('0xe'),_0x1673bc,_0x4a7f05[_0x0f84('0x11')]['message']);return _0x319360(_0x4a7f05[_0x0f84('0x11')][_0x0f84('0x13')]);}else{logger[_0x0f84('0xd')](_0x0f84('0xe'),_0x1673bc,'request\x20sent');_0x319360(_0x4a7f05[_0x0f84('0x14')][_0x0f84('0x13')]);}})[_0x0f84('0x15')](function(_0x11e49b){logger[_0x0f84('0x11')](_0x0f84('0xe'),_0x1673bc,_0x11e49b);_0x190c6f(_0x11e49b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 64cdd6b..ab06b34 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 _0xf0c0=['../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','addResources','update','delete','removeSections','removeResources','exports','util','path','express','fs-extra'];(function(_0x29335c,_0x466d4c){var _0xd4380c=function(_0x137c8c){while(--_0x137c8c){_0x29335c['push'](_0x29335c['shift']());}};_0xd4380c(++_0x466d4c);}(_0xf0c0,0x15a));var _0x0f0c=function(_0x56d644,_0x1de01a){_0x56d644=_0x56d644-0x0;var _0x21f5a3=_0xf0c0[_0x56d644];return _0x21f5a3;};'use strict';var multer=require('multer');var util=require(_0x0f0c('0x0'));var path=require(_0x0f0c('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f0c('0x2'));var router=express['Router']();var fs_extra=require(_0x0f0c('0x3'));var auth=require(_0x0f0c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0f0c('0x5'));var controller=require(_0x0f0c('0x6'));router[_0x0f0c('0x7')]('/',auth[_0x0f0c('0x8')](),controller[_0x0f0c('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0f0c('0xa')]);router[_0x0f0c('0x7')](_0x0f0c('0xb'),auth[_0x0f0c('0x8')](),controller[_0x0f0c('0xc')]);router[_0x0f0c('0x7')](_0x0f0c('0xd'),auth[_0x0f0c('0x8')](),controller[_0x0f0c('0xe')]);router[_0x0f0c('0x7')](_0x0f0c('0xf'),auth['isAuthenticated'](),controller['getResources']);router[_0x0f0c('0x10')]('/',auth[_0x0f0c('0x8')](),controller[_0x0f0c('0x11')]);router[_0x0f0c('0x10')](_0x0f0c('0x12'),auth[_0x0f0c('0x8')](),controller['clone']);router['post'](_0x0f0c('0xd'),auth[_0x0f0c('0x8')](),controller['addSections']);router[_0x0f0c('0x10')](_0x0f0c('0xf'),auth[_0x0f0c('0x8')](),controller[_0x0f0c('0x13')]);router['put'](_0x0f0c('0xb'),auth[_0x0f0c('0x8')](),controller[_0x0f0c('0x14')]);router[_0x0f0c('0x15')]('/:id',auth[_0x0f0c('0x8')](),controller['destroy']);router[_0x0f0c('0x15')](_0x0f0c('0xd'),auth['isAuthenticated'](),controller[_0x0f0c('0x16')]);router[_0x0f0c('0x15')](_0x0f0c('0xf'),auth[_0x0f0c('0x8')](),controller[_0x0f0c('0x17')]);module[_0x0f0c('0x18')]=router; \ No newline at end of file +var _0x1eb6=['connect-timeout','Router','fs-extra','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addResources','put','update','destroy','delete','removeSections','exports','multer','util','path'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x1eb6,0xcd));var _0x61eb=function(_0xa62ef2,_0x2617e9){_0xa62ef2=_0xa62ef2-0x0;var _0x1d0d2e=_0x1eb6[_0xa62ef2];return _0x1d0d2e;};'use strict';var multer=require(_0x61eb('0x0'));var util=require(_0x61eb('0x1'));var path=require(_0x61eb('0x2'));var timeout=require(_0x61eb('0x3'));var express=require('express');var router=express[_0x61eb('0x4')]();var fs_extra=require(_0x61eb('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x61eb('0x6')]('/',auth[_0x61eb('0x7')](),controller[_0x61eb('0x8')]);router[_0x61eb('0x6')](_0x61eb('0x9'),auth['isAuthenticated'](),controller[_0x61eb('0xa')]);router[_0x61eb('0x6')](_0x61eb('0xb'),auth[_0x61eb('0x7')](),controller['show']);router[_0x61eb('0x6')](_0x61eb('0xc'),auth[_0x61eb('0x7')](),controller[_0x61eb('0xd')]);router[_0x61eb('0x6')](_0x61eb('0xe'),auth[_0x61eb('0x7')](),controller[_0x61eb('0xf')]);router[_0x61eb('0x10')]('/',auth[_0x61eb('0x7')](),controller['create']);router[_0x61eb('0x10')](_0x61eb('0x11'),auth[_0x61eb('0x7')](),controller[_0x61eb('0x12')]);router[_0x61eb('0x10')](_0x61eb('0xc'),auth[_0x61eb('0x7')](),controller['addSections']);router[_0x61eb('0x10')]('/:id/resources',auth[_0x61eb('0x7')](),controller[_0x61eb('0x13')]);router[_0x61eb('0x14')](_0x61eb('0xb'),auth[_0x61eb('0x7')](),controller[_0x61eb('0x15')]);router['delete'](_0x61eb('0xb'),auth[_0x61eb('0x7')](),controller[_0x61eb('0x16')]);router[_0x61eb('0x17')]('/:id/sections',auth[_0x61eb('0x7')](),controller[_0x61eb('0x18')]);router['delete'](_0x61eb('0xe'),auth[_0x61eb('0x7')](),controller['removeResources']);module[_0x61eb('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0ca94a9..bd4975e 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 _0xec45=['split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x374325,_0x36b5ba){var _0xc6402f=function(_0x3c281c){while(--_0x3c281c){_0x374325['push'](_0x374325['shift']());}};_0xc6402f(++_0x36b5ba);}(_0xec45,0xc0));var _0x5ec4=function(_0x1f37d8,_0x2c9bea){_0x1f37d8=_0x1f37d8-0x0;var _0x3a7520=_0xec45[_0x1f37d8];return _0x3a7520;};'use strict';var Sequelize=require(_0x5ec4('0x0'));module[_0x5ec4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5ec4('0x2')},'crudPermissions':{'type':Sequelize[_0x5ec4('0x3')],'set':function(_0x206773){this[_0x5ec4('0x4')](_0x5ec4('0x5'),_0x206773?_0x206773[_0x5ec4('0x6')](''):[]);},'get':function(){return this[_0x5ec4('0x7')](_0x5ec4('0x5'))?this[_0x5ec4('0x7')](_0x5ec4('0x5'))[_0x5ec4('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5ec4('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5ec4('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc8e3=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0xac3b20,_0x48e68c){var _0x580caf=function(_0xa07fcd){while(--_0xa07fcd){_0xac3b20['push'](_0xac3b20['shift']());}};_0x580caf(++_0x48e68c);}(_0xc8e3,0x17f));var _0x3c8e=function(_0x2c231b,_0x7f391){_0x2c231b=_0x2c231b-0x0;var _0x38d518=_0xc8e3[_0x2c231b];return _0x38d518;};'use strict';var Sequelize=require(_0x3c8e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3c8e('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1d2995){this[_0x3c8e('0x2')](_0x3c8e('0x3'),_0x1d2995?_0x1d2995[_0x3c8e('0x4')](''):[]);},'get':function(){return this[_0x3c8e('0x5')](_0x3c8e('0x3'))?this[_0x3c8e('0x5')](_0x3c8e('0x3'))[_0x3c8e('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3c8e('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x3c8e('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3c8e('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3c8e('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3b232e3..1e250d8 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 _0x2884=['findAll','rows','catch','params','keys','find','create','body','clone','length','omit','createdAt','updatedAt','crudPermissions','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','describe','addSections','sequelize','transaction','userProfileId','Resources','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x907883,_0x3ccec1){var _0x150e9d=function(_0x8cdfd0){while(--_0x8cdfd0){_0x907883['push'](_0x907883['shift']());}};_0x150e9d(++_0x3ccec1);}(_0x2884,0x1eb));var _0x4288=function(_0xf2acc0,_0x33a85a){_0xf2acc0=_0xf2acc0-0x0;var _0x383a9f=_0x2884[_0xf2acc0];return _0x383a9f;};'use strict';var emlformat=require(_0x4288('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4288('0x1'));var jsonpatch=require(_0x4288('0x2'));var rp=require(_0x4288('0x3'));var moment=require('moment');var BPromise=require(_0x4288('0x4'));var Mustache=require(_0x4288('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4288('0x6'));var csv=require(_0x4288('0x7'));var ejs=require(_0x4288('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4288('0x9'));var crypto=require('crypto');var jsforce=require(_0x4288('0xa'));var deskjs=require(_0x4288('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4288('0xc'));var Papa=require(_0x4288('0xd'));var Redis=require(_0x4288('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4288('0xf'));var hardwareService=require(_0x4288('0x10'));var logger=require(_0x4288('0x11'))(_0x4288('0x12'));var utils=require(_0x4288('0x13'));var config=require(_0x4288('0x14'));var licenseUtil=require(_0x4288('0x15'));var db=require('../../mysqldb')['db'];config[_0x4288('0x16')]=_[_0x4288('0x17')](config[_0x4288('0x16')],{'host':_0x4288('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4288('0x16')]));require(_0x4288('0x19'))['register'](socket);function respondWithStatusCode(_0x1782d2,_0x50a473){_0x50a473=_0x50a473||0xcc;return function(_0x1939b0){if(_0x1939b0){return _0x1782d2['sendStatus'](_0x50a473);}return _0x1782d2[_0x4288('0x1a')](_0x50a473)[_0x4288('0x1b')]();};}function respondWithResult(_0x183c70,_0x17afda){_0x17afda=_0x17afda||0xc8;return function(_0xe24ccb){if(_0xe24ccb){return _0x183c70[_0x4288('0x1a')](_0x17afda)[_0x4288('0x1c')](_0xe24ccb);}};}function respondWithFilteredResult(_0x4b4b0c,_0x47f4a3){return function(_0x53fb81){if(_0x53fb81){var _0x199919=typeof _0x47f4a3[_0x4288('0x1d')]==='undefined'&&typeof _0x47f4a3['limit']==='undefined';var _0x417d89=_0x53fb81[_0x4288('0x1e')];var _0x5e891c=_0x199919?0x0:_0x47f4a3[_0x4288('0x1d')];var _0x51d472=_0x199919?_0x53fb81[_0x4288('0x1e')]:_0x47f4a3[_0x4288('0x1d')]+_0x47f4a3[_0x4288('0x1f')];var _0x496058;if(_0x51d472>=_0x417d89){_0x51d472=_0x417d89;_0x496058=0xc8;}else{_0x496058=0xce;}_0x4b4b0c[_0x4288('0x1a')](_0x496058);return _0x4b4b0c[_0x4288('0x20')](_0x4288('0x21'),_0x5e891c+'-'+_0x51d472+'/'+_0x417d89)['json'](_0x53fb81);}return null;};}function patchUpdates(_0x4fc547){return function(_0x5bd114){try{jsonpatch[_0x4288('0x22')](_0x5bd114,_0x4fc547,!![]);}catch(_0x181acc){return BPromise[_0x4288('0x23')](_0x181acc);}return _0x5bd114[_0x4288('0x24')]();};}function saveUpdates(_0x292e74,_0x500c1e){return function(_0x5f0c29){if(_0x5f0c29){return _0x5f0c29[_0x4288('0x25')](_0x292e74)[_0x4288('0x26')](function(_0x576af9){return _0x576af9;});}return null;};}function removeEntity(_0x43b76c,_0x54e6a8){return function(_0x501fcb){if(_0x501fcb){return _0x501fcb[_0x4288('0x27')]()[_0x4288('0x26')](function(){_0x43b76c[_0x4288('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd16d3,_0x1bba92){return function(_0xec0001){if(!_0xec0001){_0xcd16d3[_0x4288('0x28')](0x194);}return _0xec0001;};}function handleError(_0x29e9ad,_0xf7f6d6){_0xf7f6d6=_0xf7f6d6||0x1f4;return function(_0x4cc8bd){logger[_0x4288('0x29')](_0x4cc8bd[_0x4288('0x2a')]);if(_0x4cc8bd[_0x4288('0x2b')]){delete _0x4cc8bd[_0x4288('0x2b')];}_0x29e9ad[_0x4288('0x1a')](_0xf7f6d6)[_0x4288('0x2c')](_0x4cc8bd);};}exports[_0x4288('0x2d')]=function(_0x5bca41,_0x393d0){var _0x396cca={},_0x375efa={},_0x2881ef={'count':0x0,'rows':[]};var _0x1b668f=_['map'](db[_0x4288('0x2e')][_0x4288('0x2f')],function(_0x362b7d){return{'name':_0x362b7d[_0x4288('0x30')],'type':_0x362b7d[_0x4288('0x31')]['key']};});_0x375efa[_0x4288('0x32')]=_[_0x4288('0x33')](_0x1b668f,_0x4288('0x2b'));_0x375efa[_0x4288('0x34')]=_['keys'](_0x5bca41[_0x4288('0x34')]);_0x375efa[_0x4288('0x35')]=_[_0x4288('0x36')](_0x375efa[_0x4288('0x32')],_0x375efa['query']);_0x396cca[_0x4288('0x37')]=_[_0x4288('0x36')](_0x375efa[_0x4288('0x32')],qs[_0x4288('0x38')](_0x5bca41[_0x4288('0x34')][_0x4288('0x38')]));_0x396cca['attributes']=_0x396cca[_0x4288('0x37')]['length']?_0x396cca[_0x4288('0x37')]:_0x375efa['model'];if(!_0x5bca41['query'][_0x4288('0x39')](_0x4288('0x3a'))){_0x396cca[_0x4288('0x1f')]=qs[_0x4288('0x1f')](_0x5bca41[_0x4288('0x34')][_0x4288('0x1f')]);_0x396cca['offset']=qs[_0x4288('0x1d')](_0x5bca41[_0x4288('0x34')][_0x4288('0x1d')]);}_0x396cca[_0x4288('0x3b')]=qs[_0x4288('0x3c')](_0x5bca41[_0x4288('0x34')][_0x4288('0x3c')]);_0x396cca[_0x4288('0x3d')]=qs[_0x4288('0x35')](_[_0x4288('0x3e')](_0x5bca41[_0x4288('0x34')],_0x375efa[_0x4288('0x35')]),_0x1b668f);if(_0x5bca41[_0x4288('0x34')][_0x4288('0x3f')]){_0x396cca[_0x4288('0x3d')]=_[_0x4288('0x40')](_0x396cca[_0x4288('0x3d')],{'$or':_['map'](_0x1b668f,function(_0x36bd21){if(_0x36bd21[_0x4288('0x31')]!==_0x4288('0x41')){var _0x478920={};_0x478920[_0x36bd21[_0x4288('0x2b')]]={'$like':'%'+_0x5bca41[_0x4288('0x34')][_0x4288('0x3f')]+'%'};return _0x478920;}})});}_0x396cca=_['merge']({},_0x396cca,_0x5bca41[_0x4288('0x42')]);var _0x352cc6={'where':_0x396cca[_0x4288('0x3d')]};return db[_0x4288('0x2e')][_0x4288('0x1e')](_0x352cc6)[_0x4288('0x26')](function(_0x4453ee){_0x2881ef[_0x4288('0x1e')]=_0x4453ee;if(_0x5bca41[_0x4288('0x34')][_0x4288('0x43')]){_0x396cca[_0x4288('0x44')]=[{'all':!![]}];}return db[_0x4288('0x2e')][_0x4288('0x45')](_0x396cca);})[_0x4288('0x26')](function(_0x26ddea){_0x2881ef[_0x4288('0x46')]=_0x26ddea;return _0x2881ef;})[_0x4288('0x26')](respondWithFilteredResult(_0x393d0,_0x396cca))[_0x4288('0x47')](handleError(_0x393d0,null));};exports['show']=function(_0x3f0f8f,_0x5a1456){var _0x30c374={'raw':![],'where':{'id':_0x3f0f8f[_0x4288('0x48')]['id']}},_0x2254dc={};_0x2254dc[_0x4288('0x32')]=_[_0x4288('0x49')](db[_0x4288('0x2e')][_0x4288('0x2f')]);_0x2254dc[_0x4288('0x34')]=_[_0x4288('0x49')](_0x3f0f8f[_0x4288('0x34')]);_0x2254dc[_0x4288('0x35')]=_[_0x4288('0x36')](_0x2254dc[_0x4288('0x32')],_0x2254dc[_0x4288('0x34')]);_0x30c374[_0x4288('0x37')]=_[_0x4288('0x36')](_0x2254dc[_0x4288('0x32')],qs[_0x4288('0x38')](_0x3f0f8f[_0x4288('0x34')][_0x4288('0x38')]));_0x30c374[_0x4288('0x37')]=_0x30c374[_0x4288('0x37')]['length']?_0x30c374[_0x4288('0x37')]:_0x2254dc[_0x4288('0x32')];if(_0x3f0f8f['query'][_0x4288('0x43')]){_0x30c374[_0x4288('0x44')]=[{'all':!![]}];}_0x30c374=_['merge']({},_0x30c374,_0x3f0f8f[_0x4288('0x42')]);return db[_0x4288('0x2e')][_0x4288('0x4a')](_0x30c374)[_0x4288('0x26')](handleEntityNotFound(_0x5a1456,null))[_0x4288('0x26')](respondWithResult(_0x5a1456,null))[_0x4288('0x47')](handleError(_0x5a1456,null));};exports[_0x4288('0x4b')]=function(_0x4a71b6,_0x6138a8){return db[_0x4288('0x2e')][_0x4288('0x4b')](_0x4a71b6[_0x4288('0x4c')],{})[_0x4288('0x26')](respondWithResult(_0x6138a8,0xc9))[_0x4288('0x47')](handleError(_0x6138a8,null));};exports[_0x4288('0x4d')]=function(_0x472c82,_0x324b58){var _0x564d72={'where':{'id':_0x472c82['params']['id']}},_0x1813cd={};_0x1813cd[_0x4288('0x32')]=_['keys'](db['UserProfile'][_0x4288('0x2f')]);_0x564d72[_0x4288('0x37')]=_[_0x4288('0x36')](_0x1813cd[_0x4288('0x32')],qs[_0x4288('0x38')](_0x472c82[_0x4288('0x34')]['fields']));_0x564d72['attributes']=_0x564d72['attributes'][_0x4288('0x4e')]?_0x564d72['attributes']:_0x1813cd[_0x4288('0x32')];if(_0x472c82[_0x4288('0x34')][_0x4288('0x43')]){_0x564d72[_0x4288('0x44')]=[{'all':!![]}];}_0x564d72=_[_0x4288('0x40')]({},_0x564d72,_0x472c82[_0x4288('0x42')]);return db[_0x4288('0x2e')][_0x4288('0x4a')](_0x564d72)['then'](handleEntityNotFound(_0x324b58,null))[_0x4288('0x26')](function(_0x323957){if(_0x323957){var _0x3bbd30=_0x323957['get']({'plain':!![]});_0x3bbd30=qs[_0x4288('0x4f')](_0x3bbd30,['id',_0x4288('0x50'),_0x4288('0x51'),_0x4288('0x52')]);_0x472c82[_0x4288('0x4c')]=_['omit'](_0x472c82[_0x4288('0x4c')],['id','createdAt','updatedAt']);return db['sequelize']['transaction'](function(_0x167d25){return db[_0x4288('0x2e')]['create'](_[_0x4288('0x40')](_0x3bbd30,_0x472c82['body']),{'include':_0x472c82['query'][_0x4288('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x167d25})[_0x4288('0x26')](function(_0x1be0b7){var _0x5e9c75=_0x1be0b7[_0x4288('0x53')]({'plain':!![]});return db[_0x4288('0x54')][_0x4288('0x45')]({'where':{'userProfileId':_0x472c82[_0x4288('0x48')]['id']},'raw':!![]})[_0x4288('0x26')](function(_0x2cb988){if(_0x2cb988){return BPromise[_0x4288('0x55')](_0x2cb988,function(_0x1251e2){return new BPromise(function(_0x1f516f,_0x48ece6){if(_0x1251e2[_0x4288('0x56')]===null||_0x1251e2[_0x4288('0x56')]===0x1)_0x1f516f(null);return db[_0x4288('0x57')][_0x4288('0x45')]({'where':{'sectionId':_0x1251e2['id']},'raw':!![]})[_0x4288('0x26')](function(_0x2d7555){var _0x58a60c=_[_0x4288('0x33')](_0x2d7555,function(_0x3de87b){return qs[_0x4288('0x4f')](_0x3de87b,['id',_0x4288('0x50'),_0x4288('0x51'),_0x4288('0x58')]);});_0x1f516f(_0x58a60c);})[_0x4288('0x47')](function(_0x2c8161){_0x48ece6(_0x2c8161);});})[_0x4288('0x26')](function(_0x2e8f25){var _0x185289=qs[_0x4288('0x4f')](_0x1251e2,['id',_0x4288('0x50'),'updatedAt']);_0x185289['userProfileId']=_0x5e9c75['id'];if(_0x2e8f25)_0x185289['Resources']=_0x2e8f25;return _0x185289;})[_0x4288('0x26')](function(_0x2c1135){return db['UserProfileSection'][_0x4288('0x4b')](_0x2c1135,{'include':[{'model':db[_0x4288('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x167d25});});})[_0x4288('0x26')](function(){return _0x5e9c75;});}});});});}})[_0x4288('0x26')](respondWithResult(_0x324b58,0xc9))['catch'](handleError(_0x324b58,null));};exports[_0x4288('0x25')]=function(_0x4adb4e,_0x282c01){if(_0x4adb4e['body']['id']){delete _0x4adb4e[_0x4288('0x4c')]['id'];}return db[_0x4288('0x2e')][_0x4288('0x4a')]({'where':{'id':_0x4adb4e['params']['id']}})[_0x4288('0x26')](handleEntityNotFound(_0x282c01,null))[_0x4288('0x26')](saveUpdates(_0x4adb4e[_0x4288('0x4c')],null))['then'](respondWithResult(_0x282c01,null))[_0x4288('0x47')](handleError(_0x282c01,null));};exports[_0x4288('0x27')]=function(_0x5dd204,_0x392713){return db['UserProfile'][_0x4288('0x4a')]({'where':{'id':_0x5dd204[_0x4288('0x48')]['id']}})[_0x4288('0x26')](handleEntityNotFound(_0x392713,null))[_0x4288('0x26')](removeEntity(_0x392713,null))[_0x4288('0x47')](handleError(_0x392713,null));};exports[_0x4288('0x59')]=function(_0x2a3a71,_0xdc6458){return db[_0x4288('0x2e')][_0x4288('0x59')]()['then'](respondWithResult(_0xdc6458,null))[_0x4288('0x47')](handleError(_0xdc6458,null));};exports[_0x4288('0x5a')]=function(_0x533fcd,_0x40faca){var _0x1be5b1=_0x533fcd[_0x4288('0x4c')];return db[_0x4288('0x2e')][_0x4288('0x4a')]({'where':{'id':_0x533fcd[_0x4288('0x48')]['id']}})[_0x4288('0x26')](handleEntityNotFound(_0x40faca,null))['then'](function(_0x3873ca){if(_0x3873ca){return db[_0x4288('0x5b')][_0x4288('0x5c')](function(_0x337722){return db[_0x4288('0x54')][_0x4288('0x27')]({'where':{'userProfileId':_0x533fcd[_0x4288('0x48')]['id'],'sectionId':_['map'](_0x1be5b1,function(_0x18d95b){return _0x18d95b[_0x4288('0x58')];})},'transaction':_0x337722})[_0x4288('0x26')](function(){var _0x328730=_['map'](_0x1be5b1,function(_0x12ee2d){_0x12ee2d[_0x4288('0x5d')]=_0x533fcd[_0x4288('0x48')]['id'];return _0x12ee2d;});var _0x431844=[];return BPromise['each'](_0x328730,function(_0x2c4089){return db[_0x4288('0x54')][_0x4288('0x4b')](_0x2c4089,{'include':[{'model':db[_0x4288('0x57')],'as':_0x4288('0x5e')}],'raw':!![],'transaction':_0x337722})[_0x4288('0x26')](function(_0x24d568){_0x431844[_0x4288('0x5f')](_0x24d568['get']({'plain':!![]}));});})[_0x4288('0x26')](function(){return _0x431844;});});});}})[_0x4288('0x26')](function(_0xfc65b7){return _0xfc65b7;})[_0x4288('0x26')](respondWithResult(_0x40faca,null))[_0x4288('0x47')](handleError(_0x40faca,null));};exports[_0x4288('0x60')]=function(_0x344e93,_0x2181fd){var _0x1305d4;return db[_0x4288('0x2e')][_0x4288('0x4a')]({'where':{'id':_0x344e93[_0x4288('0x48')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x2181fd,null))[_0x4288('0x26')](function(_0x1c844a){if(_0x1c844a){_0x1305d4=_0x1c844a;return db['UserProfileSection'][_0x4288('0x27')]({'where':{'userProfileId':_0x344e93['params']['id'],'sectionId':_0x344e93[_0x4288('0x34')][_0x4288('0x61')]}});}})[_0x4288('0x26')](function(){return _0x1305d4;})['then'](respondWithStatusCode(_0x2181fd,null))[_0x4288('0x47')](handleError(_0x2181fd,null));};exports[_0x4288('0x62')]=function(_0x35c7b3,_0x3c6932){var _0x2b9f0b=[];var _0x113a70=[];return db[_0x4288('0x54')][_0x4288('0x45')]({'where':{'userProfileId':_0x35c7b3['params']['id']},'raw':!![]})[_0x4288('0x26')](function(_0x5d588b){_0x2b9f0b=_['filter'](_0x5d588b,function(_0x2e957a){return _0x2e957a[_0x4288('0x63')]===0x1||_[_0x4288('0x64')]([0x3eb,0x709],_0x2e957a[_0x4288('0x58')]);});if(!_[_0x4288('0x65')](_0x2b9f0b)){return _[_0x4288('0x33')](_0x2b9f0b,function(_0x2cf267){return _0x2cf267[_0x4288('0x58')];});}else{return;}})[_0x4288('0x26')](function(_0x4160db){if(_0x4160db)_0x113a70=_0x4160db;if(_[_0x4288('0x64')](_0x113a70,0x64)){var _0x29943a=_['find'](_0x2b9f0b,{'sectionId':0x64});return hasDefaultDashboard(_0x29943a)[_0x4288('0x26')](function(_0x4e31ba){return _[_0x4288('0x33')](_0x2b9f0b,function(_0x144f62){if(_0x144f62['sectionId']===0x64){_0x144f62[_0x4288('0x66')]=_0x4e31ba;}return _0x144f62;});});}else{return;}})[_0x4288('0x26')](function(_0x3ac077){if(_0x3ac077)_0x2b9f0b=_0x3ac077;if(_['includes'](_0x113a70,0x3eb)){var _0x13e40e=_[_0x4288('0x4a')](_0x2b9f0b,{'sectionId':0x3eb});return getCustomDashboards(_0x13e40e)['then'](function(_0x4a4127){return _['map'](_0x2b9f0b,function(_0x39f2f3){if(_0x13e40e[_0x4288('0x63')]){if(_0x39f2f3['sectionId']===0x3eb){_0x39f2f3[_0x4288('0x66')]=_0x4a4127;}}else{if(_0x39f2f3[_0x4288('0x58')]===0x64){_0x39f2f3['subsections']=_0x4a4127;}}return _0x39f2f3;});});}else{return;}})[_0x4288('0x26')](function(_0x3c0a3d){if(_0x3c0a3d)_0x2b9f0b=_0x3c0a3d;if(_['includes'](_0x113a70,0x709)){var _0x155150=_[_0x4288('0x4a')](_0x2b9f0b,{'sectionId':0x709});return getPlugins(_0x155150)[_0x4288('0x26')](function(_0xc24703){if(_0x155150[_0x4288('0x63')]){return _[_0x4288('0x33')](_0x2b9f0b,function(_0x31955d){if(_0x31955d[_0x4288('0x58')]===0x709){_0x31955d[_0x4288('0x66')]=_0xc24703;}return _0x31955d;});}else{var _0x5063c3={'sectionId':0x76c,'enabled':0x1,'subsections':_0xc24703};var _0x43f1e5=_[_0x4288('0x33')](_0x2b9f0b);_0x43f1e5[_0x4288('0x5f')](_0x5063c3);return _0x43f1e5;}});}else{return;}})[_0x4288('0x26')](function(_0x35902e){if(_0x35902e)_0x2b9f0b=_0x35902e;return _[_0x4288('0x3f')](_0x2b9f0b,[_0x4288('0x63'),0x1]);})[_0x4288('0x26')](respondWithResult(_0x3c6932,null))['catch'](handleError(_0x3c6932,null));};function hasDefaultDashboard(_0xdaa7c3){var _0x5a75d6=[0x65];return new BPromise(function(_0x5b93d1,_0x3c80){try{if(_0xdaa7c3['autoAssociation']){_0x5b93d1(_0x5a75d6);}else{return db['UserProfileResource'][_0x4288('0x67')]({'where':{'sectionId':_0xdaa7c3['id']},'raw':!![]})[_0x4288('0x26')](function(_0x51a5da){_0x51a5da?_0x5b93d1(_0x5a75d6):_0x5b93d1();});}}catch(_0x587a36){_0x3c80(_0x587a36);}});}function getCustomDashboards(_0x5382ee){var _0x48a257=[];return new BPromise(function(_0x43eaa0,_0x276f2d){try{if(_0x5382ee[_0x4288('0x56')]){return db['Dashboard'][_0x4288('0x45')]({'raw':!![]})[_0x4288('0x26')](function(_0xf07ec6){_0xf07ec6[_0x4288('0x68')](function(_0x1be884){_0x48a257[_0x4288('0x5f')](_0x1be884['id']+0x1869f);});_0x43eaa0(_0x48a257);});}else{return db[_0x4288('0x57')][_0x4288('0x45')]({'where':{'sectionId':_0x5382ee['id']},'raw':!![]})[_0x4288('0x26')](function(_0x1b6d95){_0x1b6d95[_0x4288('0x68')](function(_0x142059){_0x48a257[_0x4288('0x5f')](_0x142059['resourceId']+0x1869f);});_0x43eaa0(_0x48a257);});}}catch(_0x30e0b0){_0x276f2d(_0x30e0b0);}});}function getPlugins(_0x5bbde6){var _0x33df17=[];return new BPromise(function(_0x883e46,_0x210b7a){try{if(_0x5bbde6[_0x4288('0x56')]){return db[_0x4288('0x69')][_0x4288('0x45')]({'raw':!![]})[_0x4288('0x26')](function(_0x1b90d5){_0x1b90d5[_0x4288('0x68')](function(_0x1b538d){_0x33df17['push'](_0x1b538d['id']+0x15b38);});_0x883e46(_0x33df17);});}else{return db[_0x4288('0x57')][_0x4288('0x45')]({'where':{'sectionId':_0x5bbde6['id']},'raw':!![]})[_0x4288('0x26')](function(_0x155a48){_0x155a48[_0x4288('0x68')](function(_0x499c99){_0x33df17[_0x4288('0x5f')](_0x499c99['resourceId']+0x15b38);});_0x883e46(_0x33df17);});}}catch(_0x17b3b0){_0x210b7a(_0x17b3b0);}});}exports['addResources']=function(_0x2235a6,_0x3ee1f4){return db[_0x4288('0x2e')][_0x4288('0x4a')]({'where':{'id':_0x2235a6[_0x4288('0x48')]['id']}})[_0x4288('0x26')](handleEntityNotFound(_0x3ee1f4,null))[_0x4288('0x26')](function(_0x44fc05){if(_0x44fc05){return db[_0x4288('0x5b')][_0x4288('0x5c')](function(_0x5653c4){return db['UserProfileSection'][_0x4288('0x45')]({'where':{'userProfileId':_0x2235a6['params']['id']},'attributes':['id'],'raw':!![]})[_0x4288('0x26')](function(_0x4c7a84){if(_0x4c7a84){return db['UserProfileSection'][_0x4288('0x27')]({'where':{'userProfileId':_0x2235a6[_0x4288('0x48')]['id'],'id':_['map'](_0x4c7a84,function(_0x1ebcba){return _0x1ebcba['id'];})},'transaction':_0x5653c4});}})['then'](function(_0x3a4d73){var _0x137e33=_[_0x4288('0x33')](_0x2235a6['body'],function(_0x3a8523){_0x3a8523[_0x4288('0x5d')]=_0x2235a6['params']['id'];return _0x3a8523;});return db[_0x4288('0x54')][_0x4288('0x6a')](_0x137e33,{'raw':!![],'transaction':_0x5653c4});})[_0x4288('0x26')](function(_0x18ebcc){var _0x4b9aaf=_[_0x4288('0x3f')](_[_0x4288('0x33')](_0x18ebcc,function(_0x2afbe4){return _0x2afbe4[_0x4288('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b9aaf){return db[_0x4288('0x54')]['findAll']({'where':{'userProfileId':_0x2235a6[_0x4288('0x48')]['id'],'sectionId':_[_0x4288('0x33')](_0x4b9aaf,function(_0x5cbbe0){return _0x5cbbe0[_0x4288('0x58')];})},'attributes':['id',_0x4288('0x58')],'raw':!![]})[_0x4288('0x26')](function(_0x5b3860){var _0x16076f=_[_0x4288('0x33')](_0x2235a6[_0x4288('0x4c')],function(_0x46c205){_0x46c205['userProfileId']=_0x2235a6[_0x4288('0x48')]['id'];return _0x46c205;});return db[_0x4288('0x57')][_0x4288('0x6a')](_0x16076f,{'raw':!![],'transaction':_0x5653c4});});}})[_0x4288('0x47')](handleError(_0x3ee1f4,null));});}})[_0x4288('0x26')](function(_0x57f709){var _0x44b3e9=_[_0x4288('0x33')](_0x57f709,function(_0x5480a9){return _0x5480a9[_0x4288('0x53')]({'plain':!![]});});})[_0x4288('0x26')](respondWithResult(_0x3ee1f4,null))[_0x4288('0x47')](handleError(_0x3ee1f4,null));};exports[_0x4288('0x6b')]=function(_0x229d4a,_0x236b1a,_0x32e490){return db[_0x4288('0x2e')][_0x4288('0x4a')]({'where':{'id':_0x229d4a[_0x4288('0x48')]['id']}})[_0x4288('0x26')](handleEntityNotFound(_0x236b1a,null))[_0x4288('0x26')](function(_0x4b9d70){if(_0x4b9d70){return _0x4b9d70['removeResources'](_0x229d4a[_0x4288('0x34')][_0x4288('0x61')]);}})[_0x4288('0x26')](respondWithStatusCode(_0x236b1a,null))[_0x4288('0x47')](handleError(_0x236b1a,null));};exports[_0x4288('0x6c')]=function(_0x474dd4,_0x3b251d){var _0x5f502d={};if(!_0x474dd4[_0x4288('0x34')][_0x4288('0x6d')])throw new Error(_0x4288('0x6e'));if(!_0x474dd4[_0x4288('0x34')][_0x4288('0x39')](_0x4288('0x3a'))){_0x5f502d[_0x4288('0x1f')]=qs[_0x4288('0x1f')](_0x474dd4[_0x4288('0x34')][_0x4288('0x1f')]);_0x5f502d[_0x4288('0x1d')]=qs[_0x4288('0x1d')](_0x474dd4[_0x4288('0x34')][_0x4288('0x1d')]);}return db[_0x4288('0x2e')][_0x4288('0x4a')]({'where':{'id':_0x474dd4[_0x4288('0x48')]['id']}})[_0x4288('0x26')](function(_0xe929f8){if(!_0xe929f8)throw new Error(_0x4288('0x6f')+_0x474dd4[_0x4288('0x48')]['id']);return db['UserProfile'][_0x4288('0x6c')](_0x474dd4);})[_0x4288('0x26')](respondWithFilteredResult(_0x3b251d,_0x5f502d))['catch'](handleError(_0x3b251d,null));}; \ No newline at end of file +var _0x81cb=['length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','UserProfile','include','findAll','rows','catch','params','includeAll','options','find','body','clone','get','omit','createdAt','crudPermissions','updatedAt','create','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','transaction','each','push','removeSections','getSections','includes','isEmpty','enabled','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','end','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x32c27c,_0x144716){var _0x4a94ba=function(_0xfb1412){while(--_0xfb1412){_0x32c27c['push'](_0x32c27c['shift']());}};_0x4a94ba(++_0x144716);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb81c('0x0'));var rimraf=require(_0xb81c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb81c('0x2'));var rp=require(_0xb81c('0x3'));var moment=require('moment');var BPromise=require(_0xb81c('0x4'));var Mustache=require(_0xb81c('0x5'));var util=require(_0xb81c('0x6'));var path=require(_0xb81c('0x7'));var sox=require('sox');var csv=require(_0xb81c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb81c('0x9'));var squel=require(_0xb81c('0xa'));var crypto=require(_0xb81c('0xb'));var jsforce=require(_0xb81c('0xc'));var deskjs=require(_0xb81c('0xd'));var toCsv=require(_0xb81c('0x8'));var querystring=require(_0xb81c('0xe'));var Papa=require(_0xb81c('0xf'));var Redis=require(_0xb81c('0x10'));var authService=require(_0xb81c('0x11'));var qs=require(_0xb81c('0x12'));var as=require(_0xb81c('0x13'));var hardwareService=require(_0xb81c('0x14'));var logger=require(_0xb81c('0x15'))('api');var utils=require(_0xb81c('0x16'));var config=require(_0xb81c('0x17'));var licenseUtil=require(_0xb81c('0x18'));var db=require(_0xb81c('0x19'))['db'];config[_0xb81c('0x1a')]=_['defaults'](config[_0xb81c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb81c('0x1b'))(new Redis(config[_0xb81c('0x1a')]));require('./userProfile.socket')[_0xb81c('0x1c')](socket);function respondWithStatusCode(_0x2f50d3,_0x50574c){_0x50574c=_0x50574c||0xcc;return function(_0x21f5c8){if(_0x21f5c8){return _0x2f50d3[_0xb81c('0x1d')](_0x50574c);}return _0x2f50d3[_0xb81c('0x1e')](_0x50574c)['end']();};}function respondWithResult(_0x393e11,_0x112ad5){_0x112ad5=_0x112ad5||0xc8;return function(_0x4d95cd){if(_0x4d95cd){return _0x393e11[_0xb81c('0x1e')](_0x112ad5)[_0xb81c('0x1f')](_0x4d95cd);}};}function respondWithFilteredResult(_0x32916b,_0x4cbc9d){return function(_0x37341d){if(_0x37341d){var _0x31e686=typeof _0x4cbc9d[_0xb81c('0x20')]==='undefined'&&typeof _0x4cbc9d[_0xb81c('0x21')]===_0xb81c('0x22');var _0xfab47b=_0x37341d[_0xb81c('0x23')];var _0x3ca373=_0x31e686?0x0:_0x4cbc9d[_0xb81c('0x20')];var _0x445222=_0x31e686?_0x37341d['count']:_0x4cbc9d[_0xb81c('0x20')]+_0x4cbc9d[_0xb81c('0x21')];var _0x1aa39a;if(_0x445222>=_0xfab47b){_0x445222=_0xfab47b;_0x1aa39a=0xc8;}else{_0x1aa39a=0xce;}_0x32916b[_0xb81c('0x1e')](_0x1aa39a);return _0x32916b['set'](_0xb81c('0x24'),_0x3ca373+'-'+_0x445222+'/'+_0xfab47b)['json'](_0x37341d);}return null;};}function patchUpdates(_0x449ad7){return function(_0xed6e3b){try{jsonpatch[_0xb81c('0x25')](_0xed6e3b,_0x449ad7,!![]);}catch(_0x14650e){return BPromise['reject'](_0x14650e);}return _0xed6e3b['save']();};}function saveUpdates(_0x12798b,_0xff4c94){return function(_0x101e04){if(_0x101e04){return _0x101e04[_0xb81c('0x26')](_0x12798b)[_0xb81c('0x27')](function(_0x17d176){return _0x17d176;});}return null;};}function removeEntity(_0x45dbe5,_0xc1fadb){return function(_0x1db33d){if(_0x1db33d){return _0x1db33d[_0xb81c('0x28')]()[_0xb81c('0x27')](function(){_0x45dbe5[_0xb81c('0x1e')](0xcc)[_0xb81c('0x29')]();});}};}function handleEntityNotFound(_0x20b7ea,_0x183779){return function(_0x201051){if(!_0x201051){_0x20b7ea[_0xb81c('0x1d')](0x194);}return _0x201051;};}function handleError(_0x4ca99e,_0x5c07c0){_0x5c07c0=_0x5c07c0||0x1f4;return function(_0x15f86e){logger[_0xb81c('0x2a')](_0x15f86e['stack']);if(_0x15f86e[_0xb81c('0x2b')]){delete _0x15f86e[_0xb81c('0x2b')];}_0x4ca99e['status'](_0x5c07c0)[_0xb81c('0x2c')](_0x15f86e);};}exports['index']=function(_0xdff705,_0x5df2df){var _0x375fa3={},_0x2c98ed={},_0x2616b4={'count':0x0,'rows':[]};var _0x548fe2=_[_0xb81c('0x2d')](db['UserProfile'][_0xb81c('0x2e')],function(_0x317ed5){return{'name':_0x317ed5['fieldName'],'type':_0x317ed5[_0xb81c('0x2f')][_0xb81c('0x30')]};});_0x2c98ed[_0xb81c('0x31')]=_['map'](_0x548fe2,_0xb81c('0x2b'));_0x2c98ed[_0xb81c('0x32')]=_[_0xb81c('0x33')](_0xdff705[_0xb81c('0x32')]);_0x2c98ed[_0xb81c('0x34')]=_[_0xb81c('0x35')](_0x2c98ed[_0xb81c('0x31')],_0x2c98ed[_0xb81c('0x32')]);_0x375fa3[_0xb81c('0x36')]=_[_0xb81c('0x35')](_0x2c98ed['model'],qs[_0xb81c('0x37')](_0xdff705['query']['fields']));_0x375fa3[_0xb81c('0x36')]=_0x375fa3['attributes'][_0xb81c('0x38')]?_0x375fa3['attributes']:_0x2c98ed[_0xb81c('0x31')];if(!_0xdff705[_0xb81c('0x32')]['hasOwnProperty'](_0xb81c('0x39'))){_0x375fa3[_0xb81c('0x21')]=qs[_0xb81c('0x21')](_0xdff705['query'][_0xb81c('0x21')]);_0x375fa3[_0xb81c('0x20')]=qs[_0xb81c('0x20')](_0xdff705[_0xb81c('0x32')]['offset']);}_0x375fa3[_0xb81c('0x3a')]=qs[_0xb81c('0x3b')](_0xdff705[_0xb81c('0x32')][_0xb81c('0x3b')]);_0x375fa3[_0xb81c('0x3c')]=qs[_0xb81c('0x34')](_[_0xb81c('0x3d')](_0xdff705[_0xb81c('0x32')],_0x2c98ed['filters']),_0x548fe2);if(_0xdff705['query']['filter']){_0x375fa3['where']=_['merge'](_0x375fa3[_0xb81c('0x3c')],{'$or':_['map'](_0x548fe2,function(_0x38fc63){if(_0x38fc63[_0xb81c('0x2f')]!==_0xb81c('0x3e')){var _0x3cefd4={};_0x3cefd4[_0x38fc63[_0xb81c('0x2b')]]={'$like':'%'+_0xdff705['query'][_0xb81c('0x3f')]+'%'};return _0x3cefd4;}})});}_0x375fa3=_[_0xb81c('0x40')]({},_0x375fa3,_0xdff705['options']);var _0x597ff9={'where':_0x375fa3['where']};return db[_0xb81c('0x41')][_0xb81c('0x23')](_0x597ff9)[_0xb81c('0x27')](function(_0x1dff58){_0x2616b4[_0xb81c('0x23')]=_0x1dff58;if(_0xdff705[_0xb81c('0x32')]['includeAll']){_0x375fa3[_0xb81c('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0xb81c('0x43')](_0x375fa3);})[_0xb81c('0x27')](function(_0x19b752){_0x2616b4[_0xb81c('0x44')]=_0x19b752;return _0x2616b4;})['then'](respondWithFilteredResult(_0x5df2df,_0x375fa3))[_0xb81c('0x45')](handleError(_0x5df2df,null));};exports['show']=function(_0x5c664f,_0x48fe30){var _0x28e76b={'raw':![],'where':{'id':_0x5c664f[_0xb81c('0x46')]['id']}},_0x82e80f={};_0x82e80f['model']=_[_0xb81c('0x33')](db['UserProfile'][_0xb81c('0x2e')]);_0x82e80f[_0xb81c('0x32')]=_[_0xb81c('0x33')](_0x5c664f['query']);_0x82e80f[_0xb81c('0x34')]=_[_0xb81c('0x35')](_0x82e80f[_0xb81c('0x31')],_0x82e80f[_0xb81c('0x32')]);_0x28e76b[_0xb81c('0x36')]=_[_0xb81c('0x35')](_0x82e80f[_0xb81c('0x31')],qs[_0xb81c('0x37')](_0x5c664f[_0xb81c('0x32')]['fields']));_0x28e76b[_0xb81c('0x36')]=_0x28e76b[_0xb81c('0x36')][_0xb81c('0x38')]?_0x28e76b[_0xb81c('0x36')]:_0x82e80f[_0xb81c('0x31')];if(_0x5c664f['query'][_0xb81c('0x47')]){_0x28e76b['include']=[{'all':!![]}];}_0x28e76b=_[_0xb81c('0x40')]({},_0x28e76b,_0x5c664f[_0xb81c('0x48')]);return db[_0xb81c('0x41')][_0xb81c('0x49')](_0x28e76b)[_0xb81c('0x27')](handleEntityNotFound(_0x48fe30,null))[_0xb81c('0x27')](respondWithResult(_0x48fe30,null))[_0xb81c('0x45')](handleError(_0x48fe30,null));};exports['create']=function(_0x40fbf6,_0x200464){return db['UserProfile']['create'](_0x40fbf6[_0xb81c('0x4a')],{})[_0xb81c('0x27')](respondWithResult(_0x200464,0xc9))[_0xb81c('0x45')](handleError(_0x200464,null));};exports[_0xb81c('0x4b')]=function(_0x2f7956,_0x455f0a){var _0x33872f={'where':{'id':_0x2f7956[_0xb81c('0x46')]['id']}},_0x2a1da4={};_0x2a1da4[_0xb81c('0x31')]=_['keys'](db['UserProfile'][_0xb81c('0x2e')]);_0x33872f['attributes']=_[_0xb81c('0x35')](_0x2a1da4[_0xb81c('0x31')],qs[_0xb81c('0x37')](_0x2f7956[_0xb81c('0x32')][_0xb81c('0x37')]));_0x33872f[_0xb81c('0x36')]=_0x33872f[_0xb81c('0x36')][_0xb81c('0x38')]?_0x33872f[_0xb81c('0x36')]:_0x2a1da4['model'];if(_0x2f7956[_0xb81c('0x32')][_0xb81c('0x47')]){_0x33872f['include']=[{'all':!![]}];}_0x33872f=_[_0xb81c('0x40')]({},_0x33872f,_0x2f7956[_0xb81c('0x48')]);return db[_0xb81c('0x41')]['find'](_0x33872f)[_0xb81c('0x27')](handleEntityNotFound(_0x455f0a,null))[_0xb81c('0x27')](function(_0x205f04){if(_0x205f04){var _0x5a6566=_0x205f04[_0xb81c('0x4c')]({'plain':!![]});_0x5a6566=qs[_0xb81c('0x4d')](_0x5a6566,['id',_0xb81c('0x4e'),'updatedAt',_0xb81c('0x4f')]);_0x2f7956[_0xb81c('0x4a')]=_['omit'](_0x2f7956[_0xb81c('0x4a')],['id',_0xb81c('0x4e'),_0xb81c('0x50')]);return db['sequelize']['transaction'](function(_0x32fd85){return db['UserProfile'][_0xb81c('0x51')](_[_0xb81c('0x40')](_0x5a6566,_0x2f7956[_0xb81c('0x4a')]),{'include':_0x2f7956[_0xb81c('0x32')][_0xb81c('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x32fd85})[_0xb81c('0x27')](function(_0x23abc6){var _0x50d521=_0x23abc6[_0xb81c('0x4c')]({'plain':!![]});return db[_0xb81c('0x52')][_0xb81c('0x43')]({'where':{'userProfileId':_0x2f7956[_0xb81c('0x46')]['id']},'raw':!![]})[_0xb81c('0x27')](function(_0x32e670){if(_0x32e670){return BPromise['each'](_0x32e670,function(_0xd05144){return new BPromise(function(_0x2b4222,_0x2b84a7){if(_0xd05144[_0xb81c('0x53')]===null||_0xd05144['autoAssociation']===0x1)_0x2b4222(null);return db[_0xb81c('0x54')][_0xb81c('0x43')]({'where':{'sectionId':_0xd05144['id']},'raw':!![]})[_0xb81c('0x27')](function(_0x1059bd){var _0x124bd7=_[_0xb81c('0x2d')](_0x1059bd,function(_0x58d6f6){return qs[_0xb81c('0x4d')](_0x58d6f6,['id',_0xb81c('0x4e'),_0xb81c('0x50'),_0xb81c('0x55')]);});_0x2b4222(_0x124bd7);})[_0xb81c('0x45')](function(_0x5de184){_0x2b84a7(_0x5de184);});})[_0xb81c('0x27')](function(_0x211229){var _0x1c1d9d=qs[_0xb81c('0x4d')](_0xd05144,['id',_0xb81c('0x4e'),_0xb81c('0x50')]);_0x1c1d9d[_0xb81c('0x56')]=_0x50d521['id'];if(_0x211229)_0x1c1d9d[_0xb81c('0x57')]=_0x211229;return _0x1c1d9d;})['then'](function(_0xacc3e9){return db['UserProfileSection'][_0xb81c('0x51')](_0xacc3e9,{'include':[{'model':db[_0xb81c('0x54')],'as':_0xb81c('0x57')}],'raw':!![],'transaction':_0x32fd85});});})[_0xb81c('0x27')](function(){return _0x50d521;});}});});});}})[_0xb81c('0x27')](respondWithResult(_0x455f0a,0xc9))[_0xb81c('0x45')](handleError(_0x455f0a,null));};exports[_0xb81c('0x26')]=function(_0x5c79ce,_0x43b493){if(_0x5c79ce[_0xb81c('0x4a')]['id']){delete _0x5c79ce[_0xb81c('0x4a')]['id'];}return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x5c79ce['params']['id']}})['then'](handleEntityNotFound(_0x43b493,null))['then'](saveUpdates(_0x5c79ce[_0xb81c('0x4a')],null))[_0xb81c('0x27')](respondWithResult(_0x43b493,null))[_0xb81c('0x45')](handleError(_0x43b493,null));};exports[_0xb81c('0x28')]=function(_0x15010f,_0x110d2e){return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x15010f['params']['id']}})[_0xb81c('0x27')](handleEntityNotFound(_0x110d2e,null))['then'](removeEntity(_0x110d2e,null))[_0xb81c('0x45')](handleError(_0x110d2e,null));};exports[_0xb81c('0x58')]=function(_0x367cce,_0xb147b7){return db['UserProfile'][_0xb81c('0x58')]()['then'](respondWithResult(_0xb147b7,null))[_0xb81c('0x45')](handleError(_0xb147b7,null));};exports[_0xb81c('0x59')]=function(_0x46d9fb,_0x20fe72){var _0x54c318=_0x46d9fb[_0xb81c('0x4a')];return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x46d9fb['params']['id']}})[_0xb81c('0x27')](handleEntityNotFound(_0x20fe72,null))[_0xb81c('0x27')](function(_0x257345){if(_0x257345){return db[_0xb81c('0x5a')][_0xb81c('0x5b')](function(_0x3e8c08){return db['UserProfileSection'][_0xb81c('0x28')]({'where':{'userProfileId':_0x46d9fb['params']['id'],'sectionId':_['map'](_0x54c318,function(_0x37fc0b){return _0x37fc0b[_0xb81c('0x55')];})},'transaction':_0x3e8c08})[_0xb81c('0x27')](function(){var _0x3320e2=_[_0xb81c('0x2d')](_0x54c318,function(_0x382fa3){_0x382fa3[_0xb81c('0x56')]=_0x46d9fb[_0xb81c('0x46')]['id'];return _0x382fa3;});var _0x4b484e=[];return BPromise[_0xb81c('0x5c')](_0x3320e2,function(_0x450aff){return db[_0xb81c('0x52')]['create'](_0x450aff,{'include':[{'model':db[_0xb81c('0x54')],'as':_0xb81c('0x57')}],'raw':!![],'transaction':_0x3e8c08})['then'](function(_0x54493d){_0x4b484e[_0xb81c('0x5d')](_0x54493d[_0xb81c('0x4c')]({'plain':!![]}));});})[_0xb81c('0x27')](function(){return _0x4b484e;});});});}})[_0xb81c('0x27')](function(_0x46193c){return _0x46193c;})[_0xb81c('0x27')](respondWithResult(_0x20fe72,null))['catch'](handleError(_0x20fe72,null));};exports[_0xb81c('0x5e')]=function(_0x45a430,_0x5f5202){var _0x49e4a0;return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x45a430['params']['id']},'attributes':['id',_0xb81c('0x2b')]})[_0xb81c('0x27')](handleEntityNotFound(_0x5f5202,null))[_0xb81c('0x27')](function(_0x1a7372){if(_0x1a7372){_0x49e4a0=_0x1a7372;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x45a430[_0xb81c('0x46')]['id'],'sectionId':_0x45a430[_0xb81c('0x32')]['ids']}});}})[_0xb81c('0x27')](function(){return _0x49e4a0;})[_0xb81c('0x27')](respondWithStatusCode(_0x5f5202,null))[_0xb81c('0x45')](handleError(_0x5f5202,null));};exports[_0xb81c('0x5f')]=function(_0x1c4f0b,_0x5b4f51){var _0x42a71c=[];var _0x3784df=[];return db[_0xb81c('0x52')][_0xb81c('0x43')]({'where':{'userProfileId':_0x1c4f0b['params']['id']},'raw':!![]})['then'](function(_0x594bc4){_0x42a71c=_[_0xb81c('0x3f')](_0x594bc4,function(_0x18f6e9){return _0x18f6e9['enabled']===0x1||_[_0xb81c('0x60')]([0x3eb,0x709],_0x18f6e9[_0xb81c('0x55')]);});if(!_[_0xb81c('0x61')](_0x42a71c)){return _[_0xb81c('0x2d')](_0x42a71c,function(_0x11d300){return _0x11d300['sectionId'];});}else{return;}})[_0xb81c('0x27')](function(_0xe72ab5){if(_0xe72ab5)_0x3784df=_0xe72ab5;if(_[_0xb81c('0x60')](_0x3784df,0x64)){var _0x1fce10=_[_0xb81c('0x49')](_0x42a71c,{'sectionId':0x64});return hasDefaultDashboard(_0x1fce10)[_0xb81c('0x27')](function(_0x949707){return _[_0xb81c('0x2d')](_0x42a71c,function(_0x4989c9){if(_0x4989c9['sectionId']===0x64){_0x4989c9['subsections']=_0x949707;}return _0x4989c9;});});}else{return;}})[_0xb81c('0x27')](function(_0x9bf76a){if(_0x9bf76a)_0x42a71c=_0x9bf76a;if(_[_0xb81c('0x60')](_0x3784df,0x3eb)){var _0x145adc=_[_0xb81c('0x49')](_0x42a71c,{'sectionId':0x3eb});return getCustomDashboards(_0x145adc)[_0xb81c('0x27')](function(_0x1eae2b){return _['map'](_0x42a71c,function(_0x5f4d27){if(_0x145adc[_0xb81c('0x62')]){if(_0x5f4d27['sectionId']===0x3eb){_0x5f4d27[_0xb81c('0x63')]=_0x1eae2b;}}else{if(_0x5f4d27[_0xb81c('0x55')]===0x64){_0x5f4d27[_0xb81c('0x63')]=_0x1eae2b;}}return _0x5f4d27;});});}else{return;}})[_0xb81c('0x27')](function(_0x29af9e){if(_0x29af9e)_0x42a71c=_0x29af9e;if(_['includes'](_0x3784df,0x709)){var _0x2c6a93=_[_0xb81c('0x49')](_0x42a71c,{'sectionId':0x709});return getPlugins(_0x2c6a93)[_0xb81c('0x27')](function(_0x47472e){if(_0x2c6a93[_0xb81c('0x62')]){return _['map'](_0x42a71c,function(_0x1dbc7a){if(_0x1dbc7a[_0xb81c('0x55')]===0x709){_0x1dbc7a[_0xb81c('0x63')]=_0x47472e;}return _0x1dbc7a;});}else{var _0x2c4733={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47472e};var _0x4ce6d8=_[_0xb81c('0x2d')](_0x42a71c);_0x4ce6d8[_0xb81c('0x5d')](_0x2c4733);return _0x4ce6d8;}});}else{return;}})[_0xb81c('0x27')](function(_0x17fd05){if(_0x17fd05)_0x42a71c=_0x17fd05;return _[_0xb81c('0x3f')](_0x42a71c,[_0xb81c('0x62'),0x1]);})[_0xb81c('0x27')](respondWithResult(_0x5b4f51,null))[_0xb81c('0x45')](handleError(_0x5b4f51,null));};function hasDefaultDashboard(_0x43212d){var _0x10f855=[0x65];return new BPromise(function(_0x3e0fc5,_0x38d009){try{if(_0x43212d[_0xb81c('0x53')]){_0x3e0fc5(_0x10f855);}else{return db[_0xb81c('0x54')][_0xb81c('0x64')]({'where':{'sectionId':_0x43212d['id']},'raw':!![]})['then'](function(_0x5268e1){_0x5268e1?_0x3e0fc5(_0x10f855):_0x3e0fc5();});}}catch(_0x41fca8){_0x38d009(_0x41fca8);}});}function getCustomDashboards(_0x52f964){var _0x333469=[];return new BPromise(function(_0x46b9bf,_0x38c56e){try{if(_0x52f964[_0xb81c('0x53')]){return db[_0xb81c('0x65')][_0xb81c('0x43')]({'raw':!![]})[_0xb81c('0x27')](function(_0x5bc805){_0x5bc805[_0xb81c('0x66')](function(_0xef84a5){_0x333469[_0xb81c('0x5d')](_0xef84a5['id']+0x1869f);});_0x46b9bf(_0x333469);});}else{return db[_0xb81c('0x54')]['findAll']({'where':{'sectionId':_0x52f964['id']},'raw':!![]})['then'](function(_0xdcfc64){_0xdcfc64[_0xb81c('0x66')](function(_0x1c8ef2){_0x333469[_0xb81c('0x5d')](_0x1c8ef2[_0xb81c('0x67')]+0x1869f);});_0x46b9bf(_0x333469);});}}catch(_0x5a918a){_0x38c56e(_0x5a918a);}});}function getPlugins(_0x2d9f6b){var _0x487835=[];return new BPromise(function(_0x535ba4,_0x1ea6d3){try{if(_0x2d9f6b['autoAssociation']){return db[_0xb81c('0x68')][_0xb81c('0x43')]({'raw':!![]})[_0xb81c('0x27')](function(_0x429e00){_0x429e00[_0xb81c('0x66')](function(_0x2a1583){_0x487835['push'](_0x2a1583['id']+0x15b38);});_0x535ba4(_0x487835);});}else{return db['UserProfileResource'][_0xb81c('0x43')]({'where':{'sectionId':_0x2d9f6b['id']},'raw':!![]})[_0xb81c('0x27')](function(_0x755f85){_0x755f85[_0xb81c('0x66')](function(_0x2d96ae){_0x487835[_0xb81c('0x5d')](_0x2d96ae[_0xb81c('0x67')]+0x15b38);});_0x535ba4(_0x487835);});}}catch(_0x45b3ad){_0x1ea6d3(_0x45b3ad);}});}exports[_0xb81c('0x69')]=function(_0x55dc87,_0x3d4d14){return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x55dc87[_0xb81c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d4d14,null))[_0xb81c('0x27')](function(_0x3b2c94){if(_0x3b2c94){return db['sequelize']['transaction'](function(_0x366862){return db[_0xb81c('0x52')][_0xb81c('0x43')]({'where':{'userProfileId':_0x55dc87[_0xb81c('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xb81c('0x27')](function(_0x143dec){if(_0x143dec){return db[_0xb81c('0x52')][_0xb81c('0x28')]({'where':{'userProfileId':_0x55dc87[_0xb81c('0x46')]['id'],'id':_[_0xb81c('0x2d')](_0x143dec,function(_0x3fdf25){return _0x3fdf25['id'];})},'transaction':_0x366862});}})[_0xb81c('0x27')](function(_0x5895c9){var _0x3e95b1=_[_0xb81c('0x2d')](_0x55dc87[_0xb81c('0x4a')],function(_0x75ba0c){_0x75ba0c[_0xb81c('0x56')]=_0x55dc87[_0xb81c('0x46')]['id'];return _0x75ba0c;});return db[_0xb81c('0x52')][_0xb81c('0x6a')](_0x3e95b1,{'raw':!![],'transaction':_0x366862});})['then'](function(_0x48c745){var _0x256632=_['filter'](_[_0xb81c('0x2d')](_0x48c745,function(_0x17c8ff){return _0x17c8ff['get']({'plain':!![]});}),{'includeAll':![]});if(_0x256632){return db['UserProfileSection'][_0xb81c('0x43')]({'where':{'userProfileId':_0x55dc87[_0xb81c('0x46')]['id'],'sectionId':_[_0xb81c('0x2d')](_0x256632,function(_0xd6b0b3){return _0xd6b0b3[_0xb81c('0x55')];})},'attributes':['id',_0xb81c('0x55')],'raw':!![]})['then'](function(_0x562a0f){var _0x5a6e98=_[_0xb81c('0x2d')](_0x55dc87[_0xb81c('0x4a')],function(_0x56954f){_0x56954f[_0xb81c('0x56')]=_0x55dc87[_0xb81c('0x46')]['id'];return _0x56954f;});return db[_0xb81c('0x54')][_0xb81c('0x6a')](_0x5a6e98,{'raw':!![],'transaction':_0x366862});});}})[_0xb81c('0x45')](handleError(_0x3d4d14,null));});}})[_0xb81c('0x27')](function(_0x21cf64){var _0x1a3a3c=_[_0xb81c('0x2d')](_0x21cf64,function(_0x21ca83){return _0x21ca83[_0xb81c('0x4c')]({'plain':!![]});});})[_0xb81c('0x27')](respondWithResult(_0x3d4d14,null))['catch'](handleError(_0x3d4d14,null));};exports[_0xb81c('0x6b')]=function(_0x1c3509,_0x5ae3c9,_0x2db6bd){return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x1c3509[_0xb81c('0x46')]['id']}})[_0xb81c('0x27')](handleEntityNotFound(_0x5ae3c9,null))[_0xb81c('0x27')](function(_0x90401d){if(_0x90401d){return _0x90401d[_0xb81c('0x6b')](_0x1c3509[_0xb81c('0x32')]['ids']);}})[_0xb81c('0x27')](respondWithStatusCode(_0x5ae3c9,null))[_0xb81c('0x45')](handleError(_0x5ae3c9,null));};exports[_0xb81c('0x6c')]=function(_0x3f1195,_0x4af3d5){var _0x2c2281={};if(!_0x3f1195['query'][_0xb81c('0x6d')])throw new Error(_0xb81c('0x6e'));if(!_0x3f1195[_0xb81c('0x32')][_0xb81c('0x6f')](_0xb81c('0x39'))){_0x2c2281[_0xb81c('0x21')]=qs[_0xb81c('0x21')](_0x3f1195['query'][_0xb81c('0x21')]);_0x2c2281[_0xb81c('0x20')]=qs[_0xb81c('0x20')](_0x3f1195[_0xb81c('0x32')]['offset']);}return db[_0xb81c('0x41')][_0xb81c('0x49')]({'where':{'id':_0x3f1195[_0xb81c('0x46')]['id']}})['then'](function(_0x456b23){if(!_0x456b23)throw new Error(_0xb81c('0x70')+_0x3f1195[_0xb81c('0x46')]['id']);return db[_0xb81c('0x41')][_0xb81c('0x6c')](_0x3f1195);})['then'](respondWithFilteredResult(_0x4af3d5,_0x2c2281))['catch'](handleError(_0x4af3d5,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 719a9fe..c68ff9f 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 _0xcde7=['setMaxListeners','save','emit','hasOwnProperty','hook','UserProfile'];(function(_0x1c6c7b,_0x5df995){var _0x51ab42=function(_0x310df4){while(--_0x310df4){_0x1c6c7b['push'](_0x1c6c7b['shift']());}};_0x51ab42(++_0x5df995);}(_0xcde7,0x65));var _0x7cde=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcde7[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x7cde('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7cde('0x1')](0x0);var events={'afterCreate':_0x7cde('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11004a){return function(_0x47962e,_0x23ec50,_0x5824bf){UserProfileEvents[_0x7cde('0x3')](_0x11004a+':'+_0x47962e['id'],_0x47962e);UserProfileEvents[_0x7cde('0x3')](_0x11004a,_0x47962e);_0x5824bf(null);};}for(var e in events){if(events[_0x7cde('0x4')](e)){var event=events[e];UserProfile[_0x7cde('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x80c3=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x236800,_0x27091c){var _0x20a08a=function(_0x5e3404){while(--_0x5e3404){_0x236800['push'](_0x236800['shift']());}};_0x20a08a(++_0x27091c);}(_0x80c3,0x18f));var _0x380c=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x80c3[_0x39e164];return _0x13fa6b;};'use strict';var EventEmitter=require(_0x380c('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x380c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x2'),'afterDestroy':_0x380c('0x3')};function emitEvent(_0x24728a){return function(_0x52fd7e,_0x565a08,_0x553158){UserProfileEvents[_0x380c('0x4')](_0x24728a+':'+_0x52fd7e['id'],_0x52fd7e);UserProfileEvents['emit'](_0x24728a,_0x52fd7e);_0x553158(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x380c('0x5')](e,emitEvent(event));}}module[_0x380c('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9f701ff..e6eea3c 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 _0x0b0e=['sort','filters','pick','key','foreignKey','merge','options','forEach','CustomReports','count','rows','ids','CmContact','include','Tags','tag','color','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','field','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','odbc','SquareOdbc','parentSections','SquareProjects','projectName','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','Agents','zendeskaccounts','salesforceaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','ignore','union','autoAssociation','model','push','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x0b0e[_0x3efe9b];return _0x132073;};'use strict';var _=require(_0xe0b0('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xe0b0('0x1'));var squel=require('squel');module[_0xe0b0('0x2')]=function(_0xdf715e){var _0x3b5e2b=_0xdf715e[_0xe0b0('0x3')];function _0x28040c(_0x38a058,_0x399e67){return new Promise(function(_0x185efa,_0x30e20d){if(!_0x399e67)return _0x185efa(null);var _0x28e40f=_0x399e67[_0xe0b0('0x4')]?{[_0x399e67['filter']['field']]:_0x399e67[_0xe0b0('0x4')][_0xe0b0('0x5')]}:undefined;return _0x3b5e2b[_0x38a058][_0xe0b0('0x6')]({'where':_0x28e40f,'raw':!![]})[_0xe0b0('0x7')](function(_0x4c24f9){_0x399e67[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](_0x4c24f9,'id');_0x185efa(_0x399e67);})['catch'](function(_0x1fef28){_0x30e20d(_0x1fef28);});});}function _0x2f32b6(_0x574d96,_0x399320){return new Promise(function(_0x2cdad2,_0x39b1c2){var _0x585615=_0x574d96[_0xe0b0('0x4')]?{[_0x574d96[_0xe0b0('0x4')][_0xe0b0('0xa')]]:_0x574d96[_0xe0b0('0x4')][_0xe0b0('0x5')]}:undefined;return _0x3b5e2b[_0x574d96['model']][_0xe0b0('0x6')]({'where':_0x585615,'raw':!![]})[_0xe0b0('0x7')](function(_0x743318){_0x399320[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](_0x743318,function(_0x55d884){return _0x55d884[_0xe0b0('0xb')];});_0x2cdad2(_0x399320);})['catch'](function(_0x35cb40){_0x39b1c2(_0x35cb40);});});}function _0xadee6e(_0x519ae8,_0x11fdca,_0x4a4cc0){if(!_0x11fdca)return Promise[_0xe0b0('0xc')](null);return new Promise(function(_0x100204,_0x56bcc7){return _0x3b5e2b['UserProfileResource'][_0xe0b0('0x6')]({'where':{'sectionId':_0x11fdca['id']},'raw':!![]})['then'](function(_0x4df8da){if(_0x519ae8['field']&&_0x519ae8[_0xe0b0('0xa')]!=='id'){_0x11fdca['associatedResources']=_['map'](_0x4df8da,function(_0x10cde1){return _0x10cde1[_0x519ae8['field']];});}else{if(_0x4a4cc0===_0xe0b0('0xd')){_0x11fdca['associatedResources']=_[_0xe0b0('0x9')](_0x4df8da,function(_0x1cd7c4){return{'id':_0x1cd7c4[_0xe0b0('0xe')],'type':_0x1cd7c4[_0xe0b0('0xf')]};});}else{_0x11fdca[_0xe0b0('0x8')]=_['map'](_0x4df8da,function(_0x4cae54){return _0x4cae54[_0xe0b0('0xe')];});}}_0x100204(_0x11fdca);})['catch'](function(_0x12b260){_0x56bcc7(_0x12b260);});});}function _0x31b5f8(_0x513e63,_0x170ad8){var _0x503883={'parentSections':[]};switch(_0x513e63[_0xe0b0('0x10')]()){case'squareprojects':_0x503883[_0xe0b0('0x11')]='SquareProject';break;case _0xe0b0('0x12'):_0x503883['childModel']=_0xe0b0('0x13');break;case'squarerecordings':_0x503883[_0xe0b0('0x11')]='SquareRecording';_0x503883[_0xe0b0('0x14')]=[{'name':_0xe0b0('0x15'),'field':_0xe0b0('0xb'),'foreignKey':_0xe0b0('0x16')}];break;case _0xe0b0('0x17'):_0x503883[_0xe0b0('0x11')]='JscriptyProject';break;case _0xe0b0('0x18'):_0x503883[_0xe0b0('0x11')]='CmContact';_0x503883[_0xe0b0('0x14')]=[{'name':_0xe0b0('0x19'),'field':'id','foreignKey':_0xe0b0('0x1a')}];break;case _0xe0b0('0x1b'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x1c');break;case _0xe0b0('0x1d'):_0x503883['childModel']=_0xe0b0('0x1e');break;case _0xe0b0('0x1f'):_0x503883['childModel']='CmCustomField';break;case _0xe0b0('0x20'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x21');break;case _0xe0b0('0x22'):_0x503883[_0xe0b0('0x11')]='ChatWebsite';break;case _0xe0b0('0x23'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x24');break;case _0xe0b0('0x25'):_0x503883[_0xe0b0('0x11')]='FaxAccount';break;case _0xe0b0('0x26'):case _0xe0b0('0x27'):case _0xe0b0('0x28'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x29');break;case _0xe0b0('0x2a'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x2b');break;case _0xe0b0('0x2c'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x2d');break;case _0xe0b0('0x2e'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x2f');_0x503883[_0xe0b0('0x14')]=[{'name':'Agents','field':_0xe0b0('0xb'),'foreignKey':_0xe0b0('0x30'),'model':_0xe0b0('0x31'),'filter':{'field':_0xe0b0('0x32'),'value':[_0xe0b0('0x33')]}},{'name':_0xe0b0('0x34'),'field':_0xe0b0('0xb'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':['telephone']}},{'name':_0xe0b0('0x35'),'field':_0xe0b0('0xb'),'foreignKey':_0xe0b0('0x36'),'model':'VoiceQueue','filter':{'field':_0xe0b0('0xf'),'value':[_0xe0b0('0x37')]}},{'name':_0xe0b0('0x38'),'field':_0xe0b0('0xb'),'foreignKey':'queue','model':_0xe0b0('0x39'),'filter':{'field':_0xe0b0('0xf'),'value':[_0xe0b0('0x3a')]}}];break;case _0xe0b0('0x3b'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x3c');break;case _0xe0b0('0x3d'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x3e');break;case'voiceprefixes':_0x503883[_0xe0b0('0x11')]='VoicePrefix';break;case _0xe0b0('0x3f'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x40');break;case _0xe0b0('0x41'):_0x503883['childModel']=_0xe0b0('0x42');break;case _0xe0b0('0x43'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x44');break;case _0xe0b0('0x45'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x46');break;case _0xe0b0('0x47'):_0x503883['childModel']=_0xe0b0('0x48');break;case _0xe0b0('0x49'):_0x503883['childModel']='OpenchannelAccount';break;case _0xe0b0('0x4a'):_0x503883[_0xe0b0('0x11')]='SmsQueue';break;case _0xe0b0('0x4b'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x4c');break;case _0xe0b0('0x4d'):_0x503883[_0xe0b0('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x503883['childModel']=_0xe0b0('0x4e');break;case _0xe0b0('0x4f'):_0x503883['childModel']=_0xe0b0('0x50');break;case _0xe0b0('0x51'):case _0xe0b0('0x52'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x39');if(_0x170ad8){_0x503883['parentSections']=[{'name':'VoiceQueues'},{'name':_0xe0b0('0x38')}];}break;case _0xe0b0('0x53'):case _0xe0b0('0x54'):case _0xe0b0('0x55'):_0x503883[_0xe0b0('0x11')]='User';if(_0x170ad8){_0x503883[_0xe0b0('0x14')]=[{'name':_0xe0b0('0x56'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':_0xe0b0('0x57')},{'name':_0xe0b0('0x34')}];}break;case _0xe0b0('0x58'):_0x503883[_0xe0b0('0x11')]='ZendeskAccount';break;case _0xe0b0('0x59'):_0x503883[_0xe0b0('0x11')]='SalesforceAccount';break;case'freshdeskaccounts':_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x5a');break;case'sugarcrmaccounts':_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x5b');break;case'deskaccounts':_0x503883['childModel']=_0xe0b0('0x5c');break;case'zohoaccounts':_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x5d');break;case _0xe0b0('0x5e'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x31');break;case _0xe0b0('0x5f'):_0x503883['childModel']='CannedAnswer';break;case _0xe0b0('0x60'):_0x503883['childModel']='Disposition';break;case _0xe0b0('0x61'):_0x503883[_0xe0b0('0x11')]='Dashboard';break;case'intervals':_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x62');break;case _0xe0b0('0x63'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x64');break;case _0xe0b0('0x65'):_0x503883[_0xe0b0('0x11')]='Schedule';break;case _0xe0b0('0x66'):_0x503883['childModel']=_0xe0b0('0x67');break;case'tags':_0x503883['childModel']=_0xe0b0('0x68');break;case _0xe0b0('0x69'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x6a');break;case _0xe0b0('0x6b'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x6c');break;case _0xe0b0('0x6d'):_0x503883[_0xe0b0('0x11')]='Trunk';break;case _0xe0b0('0x6e'):_0x503883['childModel']=_0xe0b0('0x6f');break;case _0xe0b0('0x70'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x71');break;case _0xe0b0('0x72'):_0x503883[_0xe0b0('0x11')]='AnalyticExtractedReport';_0x503883[_0xe0b0('0x14')]=[{'name':_0xe0b0('0x73'),'field':'id','foreignKey':_0xe0b0('0x74')}];break;case _0xe0b0('0x75'):_0x503883[_0xe0b0('0x11')]=_0xe0b0('0x76');break;}return _0x503883;}function _0x234cb7(_0x1a60d2,_0x85824c){var _0xf331df=_0x1a60d2[_0xe0b0('0x77')](0x0)[_0xe0b0('0x78')]()+_0x1a60d2[_0xe0b0('0x79')](0x1);var _0x10eb99={'type':_0x3b5e2b[_0xe0b0('0x7a')][_0xe0b0('0x7b')][_0xe0b0('0x7c')],'raw':!![]};return new Promise(function(_0x155738,_0x5aa79b){var _0x46627e=squel[_0xe0b0('0x7d')]()[_0xe0b0('0xa')](_0xe0b0('0x7e')+_0xf331df+_0xe0b0('0x7f'),'id')[_0xe0b0('0xa')](_0xe0b0('0x80'))['from']('user_has_'+_0x1a60d2+_0xe0b0('0x81'),'ui')[_0xe0b0('0x82')](_0xe0b0('0x83'),_0x85824c['id']);return _0x3b5e2b['sequelize'][_0xe0b0('0x84')](_0x46627e[_0xe0b0('0x85')](),_0x10eb99)[_0xe0b0('0x7')](function(_0x3d820c){_0x85824c[_0xf331df+_0xe0b0('0x86')]=_0x3d820c;_0x155738(_0x3d820c);})['catch'](function(_0x370f8c){_0x5aa79b(_0x370f8c);});});}return _0xdf715e[_0xe0b0('0x87')](_0xe0b0('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3604e6){var _0x30b3ae={'raw':_0x3604e6['query'][_0xe0b0('0x89')],'where':{}};var _0x4c5478={};var _0x5bb697={'count':0x0,'rows':[]};var _0x4474ac=_0x3604e6['query']['section'];var _0x416e0c=_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0x8a')]||![];var _0x1a4fad=_0x31b5f8(_0x4474ac,_0x416e0c);if(!_0x1a4fad['childModel'])throw new Error(_0xe0b0('0x8b')+_0x4474ac+'\x27');var _0x2287a5=[{'name':_0x4474ac}];if(!_[_0xe0b0('0x8c')](_0x1a4fad[_0xe0b0('0x14')]))_0x2287a5=_0x1a4fad[_0xe0b0('0x14')];var _0xce497c=[];for(var _0xc5e88c=0x0;_0xc5e88c<_0x2287a5[_0xe0b0('0x8d')];_0xc5e88c++){_0xce497c['push'](_0x3b5e2b['UserProfileSection'][_0xe0b0('0x8e')]({'where':{'userProfileId':_0x3604e6[_0xe0b0('0x8f')]['id'],'name':_0x2287a5[_0xc5e88c][_0xe0b0('0xb')]},'raw':!![]}));}return Promise['all'](_0xce497c)['then'](function(_0x2eb16f){var _0x26f36f=_['filter'](_0x2eb16f,function(_0x5eca3d){return _0x5eca3d?_0x5eca3d:undefined;});var _0x691136=_[_0xe0b0('0x4')](_0x2287a5,[_0xe0b0('0x90'),!![]]);var _0x29175a=_[_0xe0b0('0x8c')](_0x26f36f)&&_[_0xe0b0('0x8c')](_0x691136)?null:_[_0xe0b0('0x91')](_0x691136,_0x26f36f);if(!_0x29175a)return null;var _0x1b997d=[];for(var _0x51f209=0x0;_0x51f209<_0x29175a[_0xe0b0('0x8d')];_0x51f209++){var _0x12e245=_[_0xe0b0('0x8e')](_0x2287a5,function(_0x494420){return _0x29175a[_0x51f209]?_0x494420['name']===_0x29175a[_0x51f209]['name']:null;});if(_0x12e245){if(_0x29175a[_0x51f209]['ignore']){_0x1b997d['push'](_0x28040c(_0x1a4fad['childModel'],_0x29175a[_0x51f209]));}else{if(!_0x29175a[_0x51f209][_0xe0b0('0x92')]){_0x1b997d['push'](_0xadee6e(_0x12e245,_0x29175a[_0x51f209],_0x1a4fad['childModel']));}else{if(_0x12e245[_0xe0b0('0x93')]){_0x1b997d[_0xe0b0('0x94')](_0x2f32b6(_0x12e245,_0x29175a[_0x51f209]));}}}}}return Promise[_0xe0b0('0x95')](_0x1b997d);})[_0xe0b0('0x7')](function(_0x3e7c9b){var _0xd0629e=_0x3e7c9b;var _0xdc56c2=null;if(_0xd0629e){_0xdc56c2=_0xd0629e[_0xe0b0('0x8d')]===0x1?_0xd0629e[0x0]:null;}if(!_0xdc56c2&&!_0xd0629e)return _0x5bb697;var _0x599332=_0x3b5e2b[_0x1a4fad[_0xe0b0('0x11')]][_0xe0b0('0x96')];_0x4c5478[_0xe0b0('0x93')]=_[_0xe0b0('0x97')](_0x599332);_0x4c5478[_0xe0b0('0x84')]=_[_0xe0b0('0x97')](_0x3604e6[_0xe0b0('0x84')]);_0x4c5478['filters']=_[_0xe0b0('0x98')](_0x4c5478['model'],_0x4c5478[_0xe0b0('0x84')]);_0x30b3ae[_0xe0b0('0x99')]=_[_0xe0b0('0x98')](_0x4c5478[_0xe0b0('0x93')],qs['fields'](_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0x9a')]));_0x30b3ae['attributes']=_0x30b3ae['attributes'][_0xe0b0('0x8d')]?_0x30b3ae[_0xe0b0('0x99')]:_0x4c5478[_0xe0b0('0x93')];if(!_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0x9b')](_0xe0b0('0x9c'))){_0x30b3ae[_0xe0b0('0x9d')]=qs[_0xe0b0('0x9d')](_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0x9d')]);_0x30b3ae['offset']=qs['offset'](_0x3604e6[_0xe0b0('0x84')]['offset']);}_0x30b3ae['order']=qs['sort'](_0x3604e6['query'][_0xe0b0('0x9e')]);_0x30b3ae['where']=qs[_0xe0b0('0x9f')](_[_0xe0b0('0xa0')](_0x3604e6[_0xe0b0('0x84')],_0x4c5478[_0xe0b0('0x9f')]));if(_0x3604e6['query'][_0xe0b0('0x4')]){_0x30b3ae[_0xe0b0('0x82')]=_['merge'](_0x30b3ae[_0xe0b0('0x82')],{'$or':_[_0xe0b0('0x9')](_0x599332,function(_0x1ac31f){if(_0x1ac31f[_0xe0b0('0xf')][_0xe0b0('0xa1')]!=='VIRTUAL'){var _0x55d3f8={};_0x55d3f8[_0x1ac31f['field']]={'$like':'%'+_0x3604e6['query']['filter']+'%'};return _0x55d3f8;}})});}var _0xfbe16d=[];var _0x567e1a=null;var _0x3c09af={};if(_0xdc56c2){_0x567e1a=_['find'](_0x2287a5,[_0xe0b0('0xb'),_0xdc56c2[_0xe0b0('0xb')]]);if(_0x567e1a[_0xe0b0('0xa')]){_0x3c09af={};if(_0x1a4fad[_0xe0b0('0x11')]===_0xe0b0('0xd')){_0x3c09af[_0x567e1a[_0xe0b0('0xa2')]]=_['map'](_0xdc56c2['associatedResources'],'id');}else{_0x3c09af[_0x567e1a['foreignKey']]=_0xdc56c2['associatedResources'];}_0xfbe16d[_0xe0b0('0x94')](_0x3c09af);}else{_0x30b3ae[_0xe0b0('0x82')]['id']=_0xdc56c2[_0xe0b0('0x8')];}}else{for(var _0x4377f7=0x0;_0x4377f7<_0xd0629e[_0xe0b0('0x8d')];_0x4377f7++){_0x567e1a=_['find'](_0x2287a5,[_0xe0b0('0xb'),_0xd0629e[_0x4377f7][_0xe0b0('0xb')]]);if(_0x567e1a[_0xe0b0('0xa')]){_0x3c09af={};_0x3c09af[_0x567e1a[_0xe0b0('0xa2')]]=_0xd0629e[_0x4377f7][_0xe0b0('0x8')];_0xfbe16d[_0xe0b0('0x94')](_0x3c09af);}else{if(!_0x30b3ae[_0xe0b0('0x82')]['id'])_0x30b3ae[_0xe0b0('0x82')]['id']=[];_0xd0629e[_0x4377f7][_0xe0b0('0x8')]['forEach'](function(_0x589c47){_0x30b3ae[_0xe0b0('0x82')]['id'][_0xe0b0('0x94')](_0x589c47);});}}}if(!_['isEmpty'](_0xfbe16d)){_0x30b3ae[_0xe0b0('0x82')]=_[_0xe0b0('0xa3')](_0x30b3ae[_0xe0b0('0x82')],{'$and':{'$or':_0xfbe16d}});}_0x30b3ae=_[_0xe0b0('0xa3')]({},_0x30b3ae,_0x3604e6[_0xe0b0('0xa4')]);if(_0xdc56c2&&!_0xdc56c2[_0xe0b0('0x92')]&&_0x1a4fad[_0xe0b0('0x11')]===_0xe0b0('0xd')){if(_0x3604e6['query']['includeAll']){_0x30b3ae['include']=[{'all':!![]}];}return _0x3b5e2b[_0x1a4fad[_0xe0b0('0x11')]][_0xe0b0('0x6')](_0x30b3ae)['then'](function(_0x36b67c){var _0x448694=[];_0x36b67c[_0xe0b0('0xa5')](function(_0x328832){var _0x5c45ae;switch(_0x328832['reportType']){case'default':_0x5c45ae=_[_0xe0b0('0x8e')](_0xdc56c2[_0xe0b0('0x8')],function(_0x57535b){return _0x57535b['id']===_0x328832[_0xe0b0('0x74')]&&_0x57535b[_0xe0b0('0xf')]==='DefaultReports';});break;case'custom':_0x5c45ae=_[_0xe0b0('0x8e')](_0xdc56c2['associatedResources'],function(_0x251195){return _0x251195['id']===_0x328832['reportId']&&_0x251195[_0xe0b0('0xf')]===_0xe0b0('0xa6');});break;}if(_0x5c45ae)_0x448694[_0xe0b0('0x94')](_0x328832);});_0x5bb697[_0xe0b0('0xa7')]=_0x448694[_0xe0b0('0x8d')];_0x5bb697[_0xe0b0('0xa8')]=_0x448694;return _0x5bb697;});}else{if(!_[_0xe0b0('0x8c')](_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0xa9')])){_0x30b3ae['where']['id']=_0x30b3ae[_0xe0b0('0x82')]['id']?_[_0xe0b0('0x98')](_0x30b3ae[_0xe0b0('0x82')]['id'],_0x3604e6['query'][_0xe0b0('0xa9')]):_0x3604e6['query'][_0xe0b0('0xa9')];}return _0x3b5e2b[_0x1a4fad[_0xe0b0('0x11')]]['count']({'where':_0x30b3ae[_0xe0b0('0x82')]})['then'](function(_0x528932){_0x5bb697[_0xe0b0('0xa7')]=_0x528932;if(_0x3604e6['query']['includeAll']){if(_0x1a4fad[_0xe0b0('0x11')]===_0xe0b0('0xaa')){_0x30b3ae[_0xe0b0('0xab')]=[{'model':_0x3b5e2b[_0xe0b0('0x68')],'as':_0xe0b0('0xac'),'attributes':['id',_0xe0b0('0xb'),'color'],'required':_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0xad')]?!![]:![]},{'model':_0x3b5e2b[_0xe0b0('0x68')],'as':'ThroughTags','attributes':['id',_0xe0b0('0xb'),_0xe0b0('0xae')],'through':_0x3604e6['query']['tag']?{'attributes':[],'where':{'TagId':_0x3604e6[_0xe0b0('0x84')]['tag']||undefined}}:{},'required':_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0xad')]?!![]:![]}];}else{_0x30b3ae[_0xe0b0('0xab')]=[{'all':!![]}];}}return _0x3b5e2b[_0x1a4fad[_0xe0b0('0x11')]][_0xe0b0('0x6')](_0x30b3ae);})[_0xe0b0('0x7')](function(_0x3d70d7){_0x5bb697['rows']=_0x3d70d7;if(_0x4474ac===_0xe0b0('0x57')&&_0x3604e6[_0xe0b0('0x84')][_0xe0b0('0xaf')]===_0xe0b0('0xb0')){var _0x2b087b=[];for(var _0x545dfd=0x0;_0x545dfd<_0x5bb697['rows'][_0xe0b0('0x8d')];_0x545dfd++){_0x2b087b[_0xe0b0('0x94')](_0x234cb7(_0xe0b0('0xb1'),_0x5bb697[_0xe0b0('0xa8')][_0x545dfd][_0xe0b0('0xb2')]));_0x2b087b[_0xe0b0('0x94')](_0x234cb7(_0xe0b0('0xb3'),_0x5bb697[_0xe0b0('0xa8')][_0x545dfd][_0xe0b0('0xb2')]));_0x2b087b[_0xe0b0('0x94')](_0x234cb7('fax',_0x5bb697[_0xe0b0('0xa8')][_0x545dfd][_0xe0b0('0xb2')]));_0x2b087b[_0xe0b0('0x94')](_0x234cb7(_0xe0b0('0xb4'),_0x5bb697['rows'][_0x545dfd][_0xe0b0('0xb2')]));_0x2b087b[_0xe0b0('0x94')](_0x234cb7(_0xe0b0('0xb5'),_0x5bb697[_0xe0b0('0xa8')][_0x545dfd][_0xe0b0('0xb2')]));_0x2b087b['push'](_0x234cb7(_0xe0b0('0xb6'),_0x5bb697['rows'][_0x545dfd][_0xe0b0('0xb2')]));}return Promise[_0xe0b0('0x95')](_0x2b087b)[_0xe0b0('0x7')](function(){return _0x5bb697;});}return _0x5bb697;});}});}}});}; \ No newline at end of file +var _0x8f4c=['zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','tags','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','reportId','AnalyticMetric','charAt','Sequelize','QueryTypes','SELECT','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','merge','key','VIRTUAL','forEach','options','includeAll','include','reportType','default','CustomReports','count','rows','ids','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','map','catch','field','model','associatedResources','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','odbc','squarerecordings','SquareRecording','parentSections','projectName','JscriptyProject','contacts','CmContact','ListId','lists','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','users','agents','telephones','Users'];(function(_0x31511b,_0x29ccca){var _0x383634=function(_0x12d59b){while(--_0x12d59b){_0x31511b['push'](_0x31511b['shift']());}};_0x383634(++_0x29ccca);}(_0x8f4c,0x113));var _0xc8f4=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0x8f4c[_0x163977];return _0x28bf3a;};'use strict';var _=require(_0xc8f4('0x0'));var attributes=require(_0xc8f4('0x1'));var qs=require(_0xc8f4('0x2'));var squel=require(_0xc8f4('0x3'));module[_0xc8f4('0x4')]=function(_0x134d73){var _0x580083=_0x134d73[_0xc8f4('0x5')];function _0x47350d(_0x133764,_0x56c9b1){return new Promise(function(_0x32cd80,_0x5208da){if(!_0x56c9b1)return _0x32cd80(null);var _0x4c86f8=_0x56c9b1['filter']?{[_0x56c9b1[_0xc8f4('0x6')]['field']]:_0x56c9b1[_0xc8f4('0x6')][_0xc8f4('0x7')]}:undefined;return _0x580083[_0x133764][_0xc8f4('0x8')]({'where':_0x4c86f8,'raw':!![]})[_0xc8f4('0x9')](function(_0x34f05f){_0x56c9b1['associatedResources']=_[_0xc8f4('0xa')](_0x34f05f,'id');_0x32cd80(_0x56c9b1);})[_0xc8f4('0xb')](function(_0x2fba62){_0x5208da(_0x2fba62);});});}function _0x3a2f8a(_0x4fd453,_0x26f83){return new Promise(function(_0x52c699,_0x430009){var _0xf07a92=_0x4fd453[_0xc8f4('0x6')]?{[_0x4fd453[_0xc8f4('0x6')][_0xc8f4('0xc')]]:_0x4fd453['filter'][_0xc8f4('0x7')]}:undefined;return _0x580083[_0x4fd453[_0xc8f4('0xd')]][_0xc8f4('0x8')]({'where':_0xf07a92,'raw':!![]})[_0xc8f4('0x9')](function(_0x1dcee5){_0x26f83[_0xc8f4('0xe')]=_['map'](_0x1dcee5,function(_0x2bce00){return _0x2bce00[_0xc8f4('0xf')];});_0x52c699(_0x26f83);})[_0xc8f4('0xb')](function(_0x46ac15){_0x430009(_0x46ac15);});});}function _0x22c08a(_0x56a25d,_0xac45d5,_0x4d2b77){if(!_0xac45d5)return Promise['resolve'](null);return new Promise(function(_0x14bc02,_0x225b76){return _0x580083[_0xc8f4('0x10')][_0xc8f4('0x8')]({'where':{'sectionId':_0xac45d5['id']},'raw':!![]})[_0xc8f4('0x9')](function(_0x374761){if(_0x56a25d[_0xc8f4('0xc')]&&_0x56a25d[_0xc8f4('0xc')]!=='id'){_0xac45d5[_0xc8f4('0xe')]=_[_0xc8f4('0xa')](_0x374761,function(_0x3cd90c){return _0x3cd90c[_0x56a25d[_0xc8f4('0xc')]];});}else{if(_0x4d2b77===_0xc8f4('0x11')){_0xac45d5['associatedResources']=_[_0xc8f4('0xa')](_0x374761,function(_0x5c520){return{'id':_0x5c520[_0xc8f4('0x12')],'type':_0x5c520[_0xc8f4('0x13')]};});}else{_0xac45d5[_0xc8f4('0xe')]=_[_0xc8f4('0xa')](_0x374761,function(_0xaeee7d){return _0xaeee7d[_0xc8f4('0x12')];});}}_0x14bc02(_0xac45d5);})['catch'](function(_0x4463aa){_0x225b76(_0x4463aa);});});}function _0x205c41(_0x3195ff,_0x1d159e){var _0x5d54a9={'parentSections':[]};switch(_0x3195ff[_0xc8f4('0x14')]()){case'squareprojects':_0x5d54a9[_0xc8f4('0x15')]='SquareProject';break;case _0xc8f4('0x16'):_0x5d54a9[_0xc8f4('0x15')]='SquareOdbc';break;case _0xc8f4('0x17'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x18');_0x5d54a9[_0xc8f4('0x19')]=[{'name':'SquareProjects','field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x1a')}];break;case'projects':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x1b');break;case _0xc8f4('0x1c'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x1d');_0x5d54a9[_0xc8f4('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0xc8f4('0x1e')}];break;case _0xc8f4('0x1f'):_0x5d54a9[_0xc8f4('0x15')]='CmList';break;case _0xc8f4('0x20'):_0x5d54a9[_0xc8f4('0x15')]='CmCompany';break;case'globalcustomfields':_0x5d54a9['childModel']=_0xc8f4('0x21');break;case _0xc8f4('0x22'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x23');break;case _0xc8f4('0x24'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x25');break;case _0xc8f4('0x26'):_0x5d54a9['childModel']=_0xc8f4('0x27');break;case _0xc8f4('0x28'):_0x5d54a9[_0xc8f4('0x15')]='FaxAccount';break;case _0xc8f4('0x29'):case _0xc8f4('0x2a'):case'outboundroutes':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x2b');break;case _0xc8f4('0x2c'):_0x5d54a9['childModel']=_0xc8f4('0x2d');break;case _0xc8f4('0x2e'):_0x5d54a9[_0xc8f4('0x15')]='VoiceMail';break;case _0xc8f4('0x2f'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x30');_0x5d54a9[_0xc8f4('0x19')]=[{'name':_0xc8f4('0x31'),'field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x32'),'model':_0xc8f4('0x33'),'filter':{'field':_0xc8f4('0x34'),'value':[_0xc8f4('0x35')]}},{'name':_0xc8f4('0x36'),'field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x32'),'model':_0xc8f4('0x33'),'filter':{'field':_0xc8f4('0x34'),'value':[_0xc8f4('0x37')]}},{'name':'VoiceQueues','field':_0xc8f4('0xf'),'foreignKey':'queue','model':_0xc8f4('0x38'),'filter':{'field':'type','value':[_0xc8f4('0x39')]}},{'name':_0xc8f4('0x3a'),'field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x3b'),'model':_0xc8f4('0x38'),'filter':{'field':_0xc8f4('0x13'),'value':[_0xc8f4('0x3c')]}}];break;case'musiconholds':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x3d');break;case _0xc8f4('0x3e'):_0x5d54a9[_0xc8f4('0x15')]='VoiceChanSpy';break;case _0xc8f4('0x3f'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x40');break;case _0xc8f4('0x41'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x42');break;case _0xc8f4('0x43'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x44');break;case _0xc8f4('0x45'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x46');break;case'mailsubstatuses':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x47');break;case _0xc8f4('0x48'):_0x5d54a9[_0xc8f4('0x15')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x49');break;case'smsqueues':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x4a');break;case'smsaccounts':_0x5d54a9['childModel']=_0xc8f4('0x4b');break;case _0xc8f4('0x4c'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x4d');break;case _0xc8f4('0x4e'):_0x5d54a9[_0xc8f4('0x15')]='WhatsappAccount';break;case'teams':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x4f');break;case _0xc8f4('0x50'):case'queuecampaigns':_0x5d54a9['childModel']='VoiceQueue';if(_0x1d159e){_0x5d54a9['parentSections']=[{'name':'VoiceQueues'},{'name':_0xc8f4('0x3a')}];}break;case _0xc8f4('0x51'):case _0xc8f4('0x52'):case _0xc8f4('0x53'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x33');if(_0x1d159e){_0x5d54a9['parentSections']=[{'name':_0xc8f4('0x54'),'filter':{'field':_0xc8f4('0x34'),'value':['admin','user']},'ignore':!![]},{'name':_0xc8f4('0x31')},{'name':_0xc8f4('0x36')}];}break;case _0xc8f4('0x55'):_0x5d54a9[_0xc8f4('0x15')]='ZendeskAccount';break;case'salesforceaccounts':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x56');break;case _0xc8f4('0x57'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x58');break;case _0xc8f4('0x59'):_0x5d54a9['childModel']='SugarcrmAccount';break;case _0xc8f4('0x5a'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x5b');break;case _0xc8f4('0x5c'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x5d');break;case _0xc8f4('0x5e'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x33');break;case'cannedanswers':_0x5d54a9['childModel']=_0xc8f4('0x5f');break;case _0xc8f4('0x60'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x61');break;case _0xc8f4('0x62'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x63');break;case _0xc8f4('0x64'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x65');break;case _0xc8f4('0x66'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x67');break;case'scheduler':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x68');break;case _0xc8f4('0x69'):_0x5d54a9[_0xc8f4('0x15')]='Sound';break;case _0xc8f4('0x6a'):_0x5d54a9[_0xc8f4('0x15')]='Tag';break;case'templates':_0x5d54a9[_0xc8f4('0x15')]='Template';break;case _0xc8f4('0x6b'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x6c');break;case _0xc8f4('0x6d'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x6e');break;case _0xc8f4('0x6f'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x70');break;case _0xc8f4('0x71'):_0x5d54a9[_0xc8f4('0x15')]='Plugin';break;case _0xc8f4('0x72'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x11');_0x5d54a9[_0xc8f4('0x19')]=[{'name':'Reports','field':'id','foreignKey':_0xc8f4('0x73')}];break;case'metrics':_0x5d54a9['childModel']=_0xc8f4('0x74');break;}return _0x5d54a9;}function _0x451a3e(_0x192bbc,_0x39cb77){var _0x2bfb92=_0x192bbc[_0xc8f4('0x75')](0x0)['toUpperCase']()+_0x192bbc['slice'](0x1);var _0x45fb1a={'type':_0x580083[_0xc8f4('0x76')][_0xc8f4('0x77')][_0xc8f4('0x78')],'raw':!![]};return new Promise(function(_0x25369e,_0x19a024){var _0x443148=squel['select']()[_0xc8f4('0xc')](_0xc8f4('0x79')+_0x2bfb92+'InteractionId','id')[_0xc8f4('0xc')](_0xc8f4('0x7a'))[_0xc8f4('0x7b')](_0xc8f4('0x7c')+_0x192bbc+_0xc8f4('0x7d'),'ui')[_0xc8f4('0x7e')](_0xc8f4('0x7f'),_0x39cb77['id']);return _0x580083['sequelize'][_0xc8f4('0x80')](_0x443148[_0xc8f4('0x81')](),_0x45fb1a)['then'](function(_0x52e295){_0x39cb77[_0x2bfb92+_0xc8f4('0x82')]=_0x52e295;_0x25369e(_0x52e295);})['catch'](function(_0x281b3a){_0x19a024(_0x281b3a);});});}return _0x134d73[_0xc8f4('0x83')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x57ad51){var _0x490b8b={'raw':_0x57ad51['query']['raw'],'where':{}};var _0x32665c={};var _0x51612f={'count':0x0,'rows':[]};var _0x17e9d1=_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x84')];var _0x29231d=_0x57ad51['query'][_0xc8f4('0x85')]||![];var _0x329c26=_0x205c41(_0x17e9d1,_0x29231d);if(!_0x329c26[_0xc8f4('0x15')])throw new Error(_0xc8f4('0x86')+_0x17e9d1+'\x27');var _0x4ae72e=[{'name':_0x17e9d1}];if(!_[_0xc8f4('0x87')](_0x329c26[_0xc8f4('0x19')]))_0x4ae72e=_0x329c26[_0xc8f4('0x19')];var _0x3761cc=[];for(var _0x4dc1e5=0x0;_0x4dc1e5<_0x4ae72e[_0xc8f4('0x88')];_0x4dc1e5++){_0x3761cc[_0xc8f4('0x89')](_0x580083['UserProfileSection'][_0xc8f4('0x8a')]({'where':{'userProfileId':_0x57ad51[_0xc8f4('0x8b')]['id'],'name':_0x4ae72e[_0x4dc1e5][_0xc8f4('0xf')]},'raw':!![]}));}return Promise[_0xc8f4('0x8c')](_0x3761cc)[_0xc8f4('0x9')](function(_0x239e4d){var _0x5362c8=_[_0xc8f4('0x6')](_0x239e4d,function(_0x269766){return _0x269766?_0x269766:undefined;});var _0x3d493c=_['filter'](_0x4ae72e,[_0xc8f4('0x8d'),!![]]);var _0x2b6510=_[_0xc8f4('0x87')](_0x5362c8)&&_['isEmpty'](_0x3d493c)?null:_[_0xc8f4('0x8e')](_0x3d493c,_0x5362c8);if(!_0x2b6510)return null;var _0x38a486=[];for(var _0x482cfd=0x0;_0x482cfd<_0x2b6510[_0xc8f4('0x88')];_0x482cfd++){var _0x5bf089=_[_0xc8f4('0x8a')](_0x4ae72e,function(_0x9996da){return _0x2b6510[_0x482cfd]?_0x9996da['name']===_0x2b6510[_0x482cfd][_0xc8f4('0xf')]:null;});if(_0x5bf089){if(_0x2b6510[_0x482cfd][_0xc8f4('0x8d')]){_0x38a486['push'](_0x47350d(_0x329c26[_0xc8f4('0x15')],_0x2b6510[_0x482cfd]));}else{if(!_0x2b6510[_0x482cfd][_0xc8f4('0x8f')]){_0x38a486[_0xc8f4('0x89')](_0x22c08a(_0x5bf089,_0x2b6510[_0x482cfd],_0x329c26[_0xc8f4('0x15')]));}else{if(_0x5bf089[_0xc8f4('0xd')]){_0x38a486[_0xc8f4('0x89')](_0x3a2f8a(_0x5bf089,_0x2b6510[_0x482cfd]));}}}}}return Promise[_0xc8f4('0x8c')](_0x38a486);})[_0xc8f4('0x9')](function(_0x5a6cfe){var _0x2d363c=_0x5a6cfe;var _0x3adcdb=null;if(_0x2d363c){_0x3adcdb=_0x2d363c[_0xc8f4('0x88')]===0x1?_0x2d363c[0x0]:null;}if(!_0x3adcdb&&!_0x2d363c)return _0x51612f;var _0xd85d11=_0x580083[_0x329c26[_0xc8f4('0x15')]]['rawAttributes'];_0x32665c[_0xc8f4('0xd')]=_['keys'](_0xd85d11);_0x32665c[_0xc8f4('0x80')]=_[_0xc8f4('0x90')](_0x57ad51[_0xc8f4('0x80')]);_0x32665c[_0xc8f4('0x91')]=_[_0xc8f4('0x92')](_0x32665c[_0xc8f4('0xd')],_0x32665c[_0xc8f4('0x80')]);_0x490b8b[_0xc8f4('0x93')]=_[_0xc8f4('0x92')](_0x32665c[_0xc8f4('0xd')],qs[_0xc8f4('0x94')](_0x57ad51['query'][_0xc8f4('0x94')]));_0x490b8b[_0xc8f4('0x93')]=_0x490b8b[_0xc8f4('0x93')][_0xc8f4('0x88')]?_0x490b8b['attributes']:_0x32665c['model'];if(!_0x57ad51[_0xc8f4('0x80')]['hasOwnProperty'](_0xc8f4('0x95'))){_0x490b8b['limit']=qs[_0xc8f4('0x96')](_0x57ad51['query']['limit']);_0x490b8b['offset']=qs['offset'](_0x57ad51['query']['offset']);}_0x490b8b[_0xc8f4('0x97')]=qs['sort'](_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x98')]);_0x490b8b[_0xc8f4('0x7e')]=qs[_0xc8f4('0x91')](_[_0xc8f4('0x99')](_0x57ad51['query'],_0x32665c[_0xc8f4('0x91')]));if(_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x6')]){_0x490b8b['where']=_[_0xc8f4('0x9a')](_0x490b8b[_0xc8f4('0x7e')],{'$or':_[_0xc8f4('0xa')](_0xd85d11,function(_0x1b95e6){if(_0x1b95e6[_0xc8f4('0x13')][_0xc8f4('0x9b')]!==_0xc8f4('0x9c')){var _0x1401f1={};_0x1401f1[_0x1b95e6['field']]={'$like':'%'+_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x6')]+'%'};return _0x1401f1;}})});}var _0x1f419d=[];var _0x3ce754=null;var _0xf2a4d7={};if(_0x3adcdb){_0x3ce754=_[_0xc8f4('0x8a')](_0x4ae72e,[_0xc8f4('0xf'),_0x3adcdb[_0xc8f4('0xf')]]);if(_0x3ce754[_0xc8f4('0xc')]){_0xf2a4d7={};if(_0x329c26[_0xc8f4('0x15')]===_0xc8f4('0x11')){_0xf2a4d7[_0x3ce754['foreignKey']]=_[_0xc8f4('0xa')](_0x3adcdb[_0xc8f4('0xe')],'id');}else{_0xf2a4d7[_0x3ce754['foreignKey']]=_0x3adcdb[_0xc8f4('0xe')];}_0x1f419d[_0xc8f4('0x89')](_0xf2a4d7);}else{_0x490b8b['where']['id']=_0x3adcdb[_0xc8f4('0xe')];}}else{for(var _0x2bbf57=0x0;_0x2bbf57<_0x2d363c['length'];_0x2bbf57++){_0x3ce754=_['find'](_0x4ae72e,[_0xc8f4('0xf'),_0x2d363c[_0x2bbf57][_0xc8f4('0xf')]]);if(_0x3ce754[_0xc8f4('0xc')]){_0xf2a4d7={};_0xf2a4d7[_0x3ce754['foreignKey']]=_0x2d363c[_0x2bbf57][_0xc8f4('0xe')];_0x1f419d[_0xc8f4('0x89')](_0xf2a4d7);}else{if(!_0x490b8b['where']['id'])_0x490b8b['where']['id']=[];_0x2d363c[_0x2bbf57][_0xc8f4('0xe')][_0xc8f4('0x9d')](function(_0x327d9c){_0x490b8b['where']['id'][_0xc8f4('0x89')](_0x327d9c);});}}}if(!_[_0xc8f4('0x87')](_0x1f419d)){_0x490b8b[_0xc8f4('0x7e')]=_['merge'](_0x490b8b[_0xc8f4('0x7e')],{'$and':{'$or':_0x1f419d}});}_0x490b8b=_[_0xc8f4('0x9a')]({},_0x490b8b,_0x57ad51[_0xc8f4('0x9e')]);if(_0x3adcdb&&!_0x3adcdb[_0xc8f4('0x8f')]&&_0x329c26[_0xc8f4('0x15')]===_0xc8f4('0x11')){if(_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x9f')]){_0x490b8b[_0xc8f4('0xa0')]=[{'all':!![]}];}return _0x580083[_0x329c26[_0xc8f4('0x15')]][_0xc8f4('0x8')](_0x490b8b)['then'](function(_0x7ae79){var _0x51b4b7=[];_0x7ae79[_0xc8f4('0x9d')](function(_0x39896d){var _0x1b6953;switch(_0x39896d[_0xc8f4('0xa1')]){case _0xc8f4('0xa2'):_0x1b6953=_[_0xc8f4('0x8a')](_0x3adcdb[_0xc8f4('0xe')],function(_0x2594fa){return _0x2594fa['id']===_0x39896d['reportId']&&_0x2594fa[_0xc8f4('0x13')]==='DefaultReports';});break;case'custom':_0x1b6953=_[_0xc8f4('0x8a')](_0x3adcdb[_0xc8f4('0xe')],function(_0x35a3db){return _0x35a3db['id']===_0x39896d['reportId']&&_0x35a3db['type']===_0xc8f4('0xa3');});break;}if(_0x1b6953)_0x51b4b7[_0xc8f4('0x89')](_0x39896d);});_0x51612f[_0xc8f4('0xa4')]=_0x51b4b7['length'];_0x51612f[_0xc8f4('0xa5')]=_0x51b4b7;return _0x51612f;});}else{if(!_['isEmpty'](_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xa6')])){_0x490b8b[_0xc8f4('0x7e')]['id']=_0x490b8b[_0xc8f4('0x7e')]['id']?_[_0xc8f4('0x92')](_0x490b8b['where']['id'],_0x57ad51[_0xc8f4('0x80')]['ids']):_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xa6')];}return _0x580083[_0x329c26[_0xc8f4('0x15')]][_0xc8f4('0xa4')]({'where':_0x490b8b[_0xc8f4('0x7e')]})[_0xc8f4('0x9')](function(_0x3f1852){_0x51612f[_0xc8f4('0xa4')]=_0x3f1852;if(_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x9f')]){if(_0x329c26[_0xc8f4('0x15')]==='CmContact'){_0x490b8b['include']=[{'model':_0x580083[_0xc8f4('0xa7')],'as':_0xc8f4('0xa8'),'attributes':['id',_0xc8f4('0xf'),_0xc8f4('0xa9')],'required':_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xaa')]?!![]:![]},{'model':_0x580083[_0xc8f4('0xa7')],'as':_0xc8f4('0xab'),'attributes':['id',_0xc8f4('0xf'),_0xc8f4('0xa9')],'through':_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xaa')]?{'attributes':[],'where':{'TagId':_0x57ad51['query']['tag']||undefined}}:{},'required':_0x57ad51[_0xc8f4('0x80')]['tag']?!![]:![]}];}else{_0x490b8b['include']=[{'all':!![]}];}}return _0x580083[_0x329c26[_0xc8f4('0x15')]]['findAll'](_0x490b8b);})['then'](function(_0x5c607e){_0x51612f['rows']=_0x5c607e;if(_0x17e9d1==='Agents'&&_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xac')]===_0xc8f4('0xad')){var _0x3afcb4=[];for(var _0x383c8a=0x0;_0x383c8a<_0x51612f[_0xc8f4('0xa5')][_0xc8f4('0x88')];_0x383c8a++){_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xae'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb0'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb1'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb2'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4['push'](_0x451a3e('openchannel',_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb3'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));}return Promise[_0xc8f4('0x8c')](_0x3afcb4)[_0xc8f4('0x9')](function(){return _0x51612f;});}return _0x51612f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7d8439b..08cf790 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 _0xd98a=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','request\x20sent'];(function(_0xb96618,_0x531574){var _0x3ae2bc=function(_0xc96958){while(--_0xc96958){_0xb96618['push'](_0xb96618['shift']());}};_0x3ae2bc(++_0x531574);}(_0xd98a,0xfc));var _0xad98=function(_0x2085fd,_0x543210){_0x2085fd=_0x2085fd-0x0;var _0x55640c=_0xd98a[_0x2085fd];return _0x55640c;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad98('0x1'));var rs=require(_0xad98('0x2'));var fs=require('fs');var Redis=require(_0xad98('0x3'));var db=require(_0xad98('0x4'))['db'];var utils=require(_0xad98('0x5'));var logger=require(_0xad98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad98('0x7'));var client=jayson[_0xad98('0x8')][_0xad98('0x9')]({'port':0x232a});config[_0xad98('0xa')]=_[_0xad98('0xb')](config['redis'],{'host':_0xad98('0xc'),'port':0x18eb});var socket=require(_0xad98('0xd'))(new Redis(config['redis']));require(_0xad98('0xe'))['register'](socket);function respondWithRpcPromise(_0x145cbe,_0x525e32,_0x4cf45b){return new BPromise(function(_0x5d5f3b,_0x15ca48){return client[_0xad98('0xf')](_0x145cbe,_0x4cf45b)[_0xad98('0x10')](function(_0x120abe){logger['info']('UserProfile,\x20%s,\x20%s',_0x525e32,_0xad98('0x11'));logger[_0xad98('0x12')](_0xad98('0x13'),_0x525e32,_0xad98('0x11'),JSON[_0xad98('0x14')](_0x120abe));if(_0x120abe[_0xad98('0x15')]){if(_0x120abe[_0xad98('0x15')][_0xad98('0x16')]===0x1f4){logger[_0xad98('0x15')]('UserProfile,\x20%s,\x20%s',_0x525e32,_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);return _0x15ca48(_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);}logger[_0xad98('0x15')](_0xad98('0x18'),_0x525e32,_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);return _0x5d5f3b(_0x120abe[_0xad98('0x15')]['message']);}else{logger['info'](_0xad98('0x18'),_0x525e32,'request\x20sent');_0x5d5f3b(_0x120abe[_0xad98('0x19')][_0xad98('0x17')]);}})[_0xad98('0x1a')](function(_0x1b2a36){logger[_0xad98('0x15')](_0xad98('0x18'),_0x525e32,_0x1b2a36);_0x15ca48(_0x1b2a36);});});} \ No newline at end of file +var _0x5a63=['result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x5067cd,_0xb74702){var _0x59618e=function(_0x21ac8c){while(--_0x21ac8c){_0x5067cd['push'](_0x5067cd['shift']());}};_0x59618e(++_0xb74702);}(_0x5a63,0xe3));var _0x35a6=function(_0xb36012,_0x2c2d20){_0xb36012=_0xb36012-0x0;var _0x952cc3=_0x5a63[_0xb36012];return _0x952cc3;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a6('0x3'));var logger=require(_0x35a6('0x4'))(_0x35a6('0x5'));var config=require(_0x35a6('0x6'));var jayson=require(_0x35a6('0x7'));var client=jayson['client'][_0x35a6('0x8')]({'port':0x232a});config['redis']=_[_0x35a6('0x9')](config['redis'],{'host':_0x35a6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35a6('0xb')]));require(_0x35a6('0xc'))[_0x35a6('0xd')](socket);function respondWithRpcPromise(_0x44d0d5,_0x1df564,_0x4e4c93){return new BPromise(function(_0x2899a8,_0xf55896){return client[_0x35a6('0xe')](_0x44d0d5,_0x4e4c93)['then'](function(_0x24afc4){logger['info'](_0x35a6('0xf'),_0x1df564,_0x35a6('0x10'));logger[_0x35a6('0x11')](_0x35a6('0x12'),_0x1df564,_0x35a6('0x10'),JSON['stringify'](_0x24afc4));if(_0x24afc4[_0x35a6('0x13')]){if(_0x24afc4[_0x35a6('0x13')][_0x35a6('0x14')]===0x1f4){logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x24afc4[_0x35a6('0x13')]['message']);return _0xf55896(_0x24afc4[_0x35a6('0x13')][_0x35a6('0x15')]);}logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x24afc4[_0x35a6('0x13')][_0x35a6('0x15')]);return _0x2899a8(_0x24afc4['error'][_0x35a6('0x15')]);}else{logger[_0x35a6('0x16')](_0x35a6('0xf'),_0x1df564,_0x35a6('0x10'));_0x2899a8(_0x24afc4[_0x35a6('0x17')][_0x35a6('0x15')]);}})[_0x35a6('0x18')](function(_0x5818e0){logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x5818e0);_0xf55896(_0x5818e0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2b1f642..ed38526 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 _0x34d8=['./userProfile.events','save','remove','update','emit','removeListener','register','length'];(function(_0x58ba3f,_0x40b73f){var _0x3ef4f2=function(_0x73bc15){while(--_0x73bc15){_0x58ba3f['push'](_0x58ba3f['shift']());}};_0x3ef4f2(++_0x40b73f);}(_0x34d8,0x110));var _0x834d=function(_0x49c1aa,_0xdc1033){_0x49c1aa=_0x49c1aa-0x0;var _0x537ca2=_0x34d8[_0x49c1aa];return _0x537ca2;};'use strict';var UserProfileEvents=require(_0x834d('0x0'));var events=[_0x834d('0x1'),_0x834d('0x2'),_0x834d('0x3')];function createListener(_0x1cff94,_0x4a063c){return function(_0x328f78){_0x4a063c[_0x834d('0x4')](_0x1cff94,_0x328f78);};}function removeListener(_0x2d9e32,_0x4643dc){return function(){UserProfileEvents[_0x834d('0x5')](_0x2d9e32,_0x4643dc);};}exports[_0x834d('0x6')]=function(_0x269617){for(var _0xb2ed2b=0x0,_0x421343=events[_0x834d('0x7')];_0xb2ed2b<_0x421343;_0xb2ed2b++){var _0x51a877=events[_0xb2ed2b];var _0x15bf0f=createListener('userProfile:'+_0x51a877,_0x269617);UserProfileEvents['on'](_0x51a877,_0x15bf0f);}}; \ No newline at end of file +var _0x63dd=['update','emit','removeListener','register','length','userProfile:','save','remove'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x63dd,0x156));var _0xd63d=function(_0x3f23d9,_0x4f118e){_0x3f23d9=_0x3f23d9-0x0;var _0x5f15be=_0x63dd[_0x3f23d9];return _0x5f15be;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xd63d('0x0'),_0xd63d('0x1'),_0xd63d('0x2')];function createListener(_0x426e8d,_0x4ffc46){return function(_0x560d94){_0x4ffc46[_0xd63d('0x3')](_0x426e8d,_0x560d94);};}function removeListener(_0x2421b0,_0x33b32b){return function(){UserProfileEvents[_0xd63d('0x4')](_0x2421b0,_0x33b32b);};}exports[_0xd63d('0x5')]=function(_0x32ed17){for(var _0x5a0356=0x0,_0x1617eb=events[_0xd63d('0x6')];_0x5a0356<_0x1617eb;_0x5a0356++){var _0x3eb756=events[_0x5a0356];var _0x1854fb=createListener(_0xd63d('0x7')+_0x3eb756,_0x32ed17);UserProfileEvents['on'](_0x3eb756,_0x1854fb);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index cfaadb4..394e583 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 _0x5ec2=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4773b0,_0x2712af){var _0x2b3687=function(_0x33f44f){while(--_0x33f44f){_0x4773b0['push'](_0x4773b0['shift']());}};_0x2b3687(++_0x2712af);}(_0x5ec2,0x180));var _0x25ec=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x5ec2[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0x25ec('0x0'));var util=require(_0x25ec('0x1'));var path=require(_0x25ec('0x2'));var timeout=require(_0x25ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x25ec('0x4'));var config=require(_0x25ec('0x5'));var controller=require('./userProfileResource.controller');router[_0x25ec('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x25ec('0x6')](_0x25ec('0x7'),auth[_0x25ec('0x8')](),controller[_0x25ec('0x9')]);router[_0x25ec('0x6')](_0x25ec('0xa'),auth[_0x25ec('0x8')](),controller[_0x25ec('0xb')]);router['post']('/',auth[_0x25ec('0x8')](),controller[_0x25ec('0xc')]);router[_0x25ec('0xd')](_0x25ec('0xa'),auth[_0x25ec('0x8')](),controller[_0x25ec('0xe')]);router[_0x25ec('0xf')](_0x25ec('0xa'),auth[_0x25ec('0x8')](),controller[_0x25ec('0x10')]);module[_0x25ec('0x11')]=router; \ No newline at end of file +var _0x4273=['connect-timeout','express','Router','fs-extra','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','show','put','update','destroy','multer','util','path'];(function(_0x8af7f1,_0x102bf1){var _0x436f31=function(_0x17057b){while(--_0x17057b){_0x8af7f1['push'](_0x8af7f1['shift']());}};_0x436f31(++_0x102bf1);}(_0x4273,0x177));var _0x3427=function(_0x419722,_0x299a00){_0x419722=_0x419722-0x0;var _0x4463bb=_0x4273[_0x419722];return _0x4463bb;};'use strict';var multer=require(_0x3427('0x0'));var util=require(_0x3427('0x1'));var path=require(_0x3427('0x2'));var timeout=require(_0x3427('0x3'));var express=require(_0x3427('0x4'));var router=express[_0x3427('0x5')]();var fs_extra=require(_0x3427('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3427('0x7'));var controller=require(_0x3427('0x8'));router[_0x3427('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3427('0xa'),auth[_0x3427('0xb')](),controller[_0x3427('0xc')]);router[_0x3427('0x9')](_0x3427('0xd'),auth[_0x3427('0xb')](),controller[_0x3427('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3427('0xf')](_0x3427('0xd'),auth[_0x3427('0xb')](),controller[_0x3427('0x10')]);router['delete'](_0x3427('0xd'),auth[_0x3427('0xb')](),controller[_0x3427('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 786c7c6..eed5351 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 _0x1197=['exports','sequelize'];(function(_0x379e85,_0x3e2d8f){var _0x10919a=function(_0x430039){while(--_0x430039){_0x379e85['push'](_0x379e85['shift']());}};_0x10919a(++_0x3e2d8f);}(_0x1197,0xaf));var _0x7119=function(_0x4d8760,_0x4a1373){_0x4d8760=_0x4d8760-0x0;var _0x47d58b=_0x1197[_0x4d8760];return _0x47d58b;};'use strict';var Sequelize=require(_0x7119('0x0'));module[_0x7119('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x66a8=['INTEGER','sequelize','exports','STRING'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0x66a8,0x195));var _0x866a=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x66a8[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require(_0x866a('0x0'));module[_0x866a('0x1')]={'name':{'type':Sequelize[_0x866a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x866a('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d9121a8..a520296 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 _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x896e,0x1e9));var _0xe896=function(_0x4d1c8b,_0x39b8d0){_0x4d1c8b=_0x4d1c8b-0x0;var _0x5f2e4d=_0x896e[_0x4d1c8b];return _0x5f2e4d;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file +var _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4df004,_0x564e32){_0x4df004=_0x4df004-0x0;var _0x432b7d=_0x5f2f[_0x4df004];return _0x432b7d;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4269ed6..590c480 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 _0xefa3=['../../config/logger','api','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util'];(function(_0x348340,_0x41f5ac){var _0x16e9ce=function(_0x5b7856){while(--_0x5b7856){_0x348340['push'](_0x348340['shift']());}};_0x16e9ce(++_0x41f5ac);}(_0xefa3,0x11f));var _0x3efa=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xefa3[_0x3ba924];return _0x4cc1df;};'use strict';var _=require('lodash');var util=require(_0x3efa('0x0'));var logger=require(_0x3efa('0x1'))(_0x3efa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3efa('0x3'));var rimraf=require(_0x3efa('0x4'));var config=require(_0x3efa('0x5'));var attributes=require(_0x3efa('0x6'));module['exports']=function(_0x5adc6d,_0x346d54){return _0x5adc6d[_0x3efa('0x7')](_0x3efa('0x8'),attributes,{'tableName':_0x3efa('0x9'),'paranoid':![],'indexes':[{'name':_0x3efa('0xa'),'fields':['resourceId',_0x3efa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35cc=['rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4ef03a,_0x45d086){var _0x5141fd=function(_0x11d810){while(--_0x11d810){_0x4ef03a['push'](_0x4ef03a['shift']());}};_0x5141fd(++_0x45d086);}(_0x35cc,0x107));var _0xc35c=function(_0x3915ad,_0x17a70d){_0x3915ad=_0x3915ad-0x0;var _0x3ad6cc=_0x35cc[_0x3915ad];return _0x3ad6cc;};'use strict';var _=require(_0xc35c('0x0'));var util=require(_0xc35c('0x1'));var logger=require(_0xc35c('0x2'))(_0xc35c('0x3'));var moment=require(_0xc35c('0x4'));var BPromise=require(_0xc35c('0x5'));var rp=require(_0xc35c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc35c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc35c('0x8'));module[_0xc35c('0x9')]=function(_0x1bacb9,_0xf7bb15){return _0x1bacb9[_0xc35c('0xa')](_0xc35c('0xb'),attributes,{'tableName':_0xc35c('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc35c('0xd'),_0xc35c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a71a7d3..226f4ec 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 _0xfa52=['http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2766f4,_0x12fc73){var _0x435eb3=function(_0x4b8f7f){while(--_0x4b8f7f){_0x2766f4['push'](_0x2766f4['shift']());}};_0x435eb3(++_0x12fc73);}(_0xfa52,0x1f1));var _0x2fa5=function(_0x3253c3,_0x1efead){_0x3253c3=_0x3253c3-0x0;var _0x28e7ce=_0xfa52[_0x3253c3];return _0x28e7ce;};'use strict';var _=require('lodash');var util=require(_0x2fa5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2fa5('0x1'));var fs=require('fs');var Redis=require(_0x2fa5('0x2'));var db=require(_0x2fa5('0x3'))['db'];var utils=require(_0x2fa5('0x4'));var logger=require(_0x2fa5('0x5'))(_0x2fa5('0x6'));var config=require(_0x2fa5('0x7'));var jayson=require(_0x2fa5('0x8'));var client=jayson['client'][_0x2fa5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ff066,_0x447c86,_0x2a663a){return new BPromise(function(_0x3bb3c4,_0x2f2c0d){return client['request'](_0x3ff066,_0x2a663a)[_0x2fa5('0xa')](function(_0x39b91c){logger[_0x2fa5('0xb')](_0x2fa5('0xc'),_0x447c86,_0x2fa5('0xd'));logger[_0x2fa5('0xe')](_0x2fa5('0xf'),_0x447c86,'request\x20sent',JSON[_0x2fa5('0x10')](_0x39b91c));if(_0x39b91c[_0x2fa5('0x11')]){if(_0x39b91c['error'][_0x2fa5('0x12')]===0x1f4){logger[_0x2fa5('0x11')](_0x2fa5('0xc'),_0x447c86,_0x39b91c[_0x2fa5('0x11')][_0x2fa5('0x13')]);return _0x2f2c0d(_0x39b91c[_0x2fa5('0x11')][_0x2fa5('0x13')]);}logger[_0x2fa5('0x11')](_0x2fa5('0xc'),_0x447c86,_0x39b91c[_0x2fa5('0x11')][_0x2fa5('0x13')]);return _0x3bb3c4(_0x39b91c[_0x2fa5('0x11')][_0x2fa5('0x13')]);}else{logger['info'](_0x2fa5('0xc'),_0x447c86,_0x2fa5('0xd'));_0x3bb3c4(_0x39b91c[_0x2fa5('0x14')]['message']);}})[_0x2fa5('0x15')](function(_0x1cb9a7){logger[_0x2fa5('0x11')](_0x2fa5('0xc'),_0x447c86,_0x1cb9a7);_0x2f2c0d(_0x1cb9a7);});});} \ No newline at end of file +var _0x8b2d=['stringify','error','code','message','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8b2d,0x97));var _0xd8b2=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x8b2d[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require(_0xd8b2('0x0'));var moment=require(_0xd8b2('0x1'));var BPromise=require(_0xd8b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8b2('0x3'))['db'];var utils=require(_0xd8b2('0x4'));var logger=require(_0xd8b2('0x5'))('rpc');var config=require(_0xd8b2('0x6'));var jayson=require(_0xd8b2('0x7'));var client=jayson[_0xd8b2('0x8')][_0xd8b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51468e,_0x385cb4,_0x2ed7c2){return new BPromise(function(_0x1f859a,_0x2ae3e0){return client[_0xd8b2('0xa')](_0x51468e,_0x2ed7c2)[_0xd8b2('0xb')](function(_0x124cb7){logger[_0xd8b2('0xc')](_0xd8b2('0xd'),_0x385cb4,_0xd8b2('0xe'));logger[_0xd8b2('0xf')](_0xd8b2('0x10'),_0x385cb4,_0xd8b2('0xe'),JSON[_0xd8b2('0x11')](_0x124cb7));if(_0x124cb7[_0xd8b2('0x12')]){if(_0x124cb7[_0xd8b2('0x12')][_0xd8b2('0x13')]===0x1f4){logger[_0xd8b2('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x385cb4,_0x124cb7['error'][_0xd8b2('0x14')]);return _0x2ae3e0(_0x124cb7[_0xd8b2('0x12')][_0xd8b2('0x14')]);}logger[_0xd8b2('0x12')](_0xd8b2('0xd'),_0x385cb4,_0x124cb7[_0xd8b2('0x12')][_0xd8b2('0x14')]);return _0x1f859a(_0x124cb7['error']['message']);}else{logger[_0xd8b2('0xc')](_0xd8b2('0xd'),_0x385cb4,'request\x20sent');_0x1f859a(_0x124cb7['result'][_0xd8b2('0x14')]);}})['catch'](function(_0x14bf51){logger[_0xd8b2('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x385cb4,_0x14bf51);_0x2ae3e0(_0x14bf51);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 332eac8..042358b 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 _0x1c58=['util','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer'];(function(_0x51dc9f,_0x2b4c7d){var _0x5d7c61=function(_0x21860a){while(--_0x21860a){_0x51dc9f['push'](_0x51dc9f['shift']());}};_0x5d7c61(++_0x2b4c7d);}(_0x1c58,0xa1));var _0x81c5=function(_0x37b5c6,_0x74718f){_0x37b5c6=_0x37b5c6-0x0;var _0x446886=_0x1c58[_0x37b5c6];return _0x446886;};'use strict';var multer=require(_0x81c5('0x0'));var util=require(_0x81c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x81c5('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x81c5('0x3'));var config=require(_0x81c5('0x4'));var controller=require(_0x81c5('0x5'));router[_0x81c5('0x6')]('/',auth['isAuthenticated'](),controller[_0x81c5('0x7')]);router[_0x81c5('0x6')](_0x81c5('0x8'),auth[_0x81c5('0x9')](),controller[_0x81c5('0xa')]);router[_0x81c5('0x6')](_0x81c5('0xb'),auth[_0x81c5('0x9')](),controller[_0x81c5('0xc')]);router[_0x81c5('0xd')]('/',auth[_0x81c5('0x9')](),controller[_0x81c5('0xe')]);router[_0x81c5('0xf')]('/:id',auth[_0x81c5('0x9')](),controller[_0x81c5('0x10')]);router['delete'](_0x81c5('0xb'),auth[_0x81c5('0x9')](),controller[_0x81c5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2235=['create','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post'];(function(_0x168259,_0x1cae81){var _0x5d564c=function(_0x50d89b){while(--_0x50d89b){_0x168259['push'](_0x168259['shift']());}};_0x5d564c(++_0x1cae81);}(_0x2235,0xbf));var _0x5223=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x2235[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require(_0x5223('0x0'));var path=require(_0x5223('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5223('0x2')]();var fs_extra=require(_0x5223('0x3'));var auth=require(_0x5223('0x4'));var interaction=require(_0x5223('0x5'));var config=require(_0x5223('0x6'));var controller=require('./userProfileSection.controller');router[_0x5223('0x7')]('/',auth[_0x5223('0x8')](),controller['index']);router['get']('/describe',auth[_0x5223('0x8')](),controller[_0x5223('0x9')]);router['get'](_0x5223('0xa'),auth['isAuthenticated'](),controller[_0x5223('0xb')]);router[_0x5223('0xc')]('/',auth[_0x5223('0x8')](),controller[_0x5223('0xd')]);router['put'](_0x5223('0xa'),auth[_0x5223('0x8')](),controller['update']);router[_0x5223('0xe')](_0x5223('0xa'),auth[_0x5223('0x8')](),controller[_0x5223('0xf')]);module[_0x5223('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 39f680a..e933395 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 _0xf45e=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xf45e,0x115));var _0xef45=function(_0x432b47,_0x24d3b7){_0x432b47=_0x432b47-0x0;var _0xb74e85=_0xf45e[_0x432b47];return _0xb74e85;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'name':{'type':Sequelize[_0xef45('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xef45('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xef45('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xef45('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xef45('0x1')],'set':function(_0x37772f){this[_0xef45('0x4')](_0xef45('0x5'),_0x37772f?_0x37772f[_0xef45('0x6')](''):[]);},'get':function(){return this[_0xef45('0x7')](_0xef45('0x5'))?this[_0xef45('0x7')](_0xef45('0x5'))[_0xef45('0x8')](''):[];}}}; \ No newline at end of file +var _0x0fd9=['join','getDataValue','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x2381ac,_0x349ecc){var _0x2388ba=function(_0x1affcd){while(--_0x1affcd){_0x2381ac['push'](_0x2381ac['shift']());}};_0x2388ba(++_0x349ecc);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x0fd9[_0x4067ac];return _0x53d74d;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'name':{'type':Sequelize[_0x90fd('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x90fd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x90fd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x90fd('0x1')],'set':function(_0x2a5f76){this[_0x90fd('0x3')](_0x90fd('0x4'),_0x2a5f76?_0x2a5f76[_0x90fd('0x5')](''):[]);},'get':function(){return this[_0x90fd('0x6')]('crudPermissions')?this['getDataValue'](_0x90fd('0x4'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 16bd0bc..ad07c32 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 _0x06d6=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','intersection'];(function(_0x2eccd9,_0x42ec6d){var _0x5b6daa=function(_0x1e9f8e){while(--_0x1e9f8e){_0x2eccd9['push'](_0x2eccd9['shift']());}};_0x5b6daa(++_0x42ec6d);}(_0x06d6,0x1a2));var _0x606d=function(_0x10cf6e,_0x18bfef){_0x10cf6e=_0x10cf6e-0x0;var _0x47f0e7=_0x06d6[_0x10cf6e];return _0x47f0e7;};'use strict';var emlformat=require(_0x606d('0x0'));var rimraf=require(_0x606d('0x1'));var zipdir=require(_0x606d('0x2'));var jsonpatch=require(_0x606d('0x3'));var rp=require(_0x606d('0x4'));var moment=require('moment');var BPromise=require(_0x606d('0x5'));var Mustache=require(_0x606d('0x6'));var util=require(_0x606d('0x7'));var path=require(_0x606d('0x8'));var sox=require(_0x606d('0x9'));var csv=require(_0x606d('0xa'));var ejs=require(_0x606d('0xb'));var fs=require('fs');var fs_extra=require(_0x606d('0xc'));var _=require(_0x606d('0xd'));var squel=require(_0x606d('0xe'));var crypto=require(_0x606d('0xf'));var jsforce=require(_0x606d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x606d('0xa'));var querystring=require(_0x606d('0x11'));var Papa=require(_0x606d('0x12'));var Redis=require(_0x606d('0x13'));var authService=require(_0x606d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x606d('0x15'));var hardwareService=require(_0x606d('0x16'));var logger=require(_0x606d('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x606d('0x18'));var licenseUtil=require(_0x606d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c54c,_0x140e26){_0x140e26=_0x140e26||0xcc;return function(_0x22ce5d){if(_0x22ce5d){return _0x25c54c[_0x606d('0x1a')](_0x140e26);}return _0x25c54c['status'](_0x140e26)[_0x606d('0x1b')]();};}function respondWithResult(_0xb5a587,_0x344288){_0x344288=_0x344288||0xc8;return function(_0x37ec69){if(_0x37ec69){return _0xb5a587[_0x606d('0x1c')](_0x344288)[_0x606d('0x1d')](_0x37ec69);}};}function respondWithFilteredResult(_0x45a666,_0x5ae6ac){return function(_0x3a67e1){if(_0x3a67e1){var _0x16ad1d=typeof _0x5ae6ac[_0x606d('0x1e')]==='undefined'&&typeof _0x5ae6ac['limit']===_0x606d('0x1f');var _0x3348a9=_0x3a67e1[_0x606d('0x20')];var _0x44c529=_0x16ad1d?0x0:_0x5ae6ac[_0x606d('0x1e')];var _0x27b190=_0x16ad1d?_0x3a67e1[_0x606d('0x20')]:_0x5ae6ac[_0x606d('0x1e')]+_0x5ae6ac[_0x606d('0x21')];var _0x5e24a8;if(_0x27b190>=_0x3348a9){_0x27b190=_0x3348a9;_0x5e24a8=0xc8;}else{_0x5e24a8=0xce;}_0x45a666[_0x606d('0x1c')](_0x5e24a8);return _0x45a666[_0x606d('0x22')](_0x606d('0x23'),_0x44c529+'-'+_0x27b190+'/'+_0x3348a9)[_0x606d('0x1d')](_0x3a67e1);}return null;};}function patchUpdates(_0x15d232){return function(_0xa997f2){try{jsonpatch[_0x606d('0x24')](_0xa997f2,_0x15d232,!![]);}catch(_0x502762){return BPromise[_0x606d('0x25')](_0x502762);}return _0xa997f2[_0x606d('0x26')]();};}function saveUpdates(_0x198ead,_0x231d87){return function(_0x4e880d){if(_0x4e880d){return _0x4e880d[_0x606d('0x27')](_0x198ead)[_0x606d('0x28')](function(_0x39cd2d){return _0x39cd2d;});}return null;};}function removeEntity(_0x3356c7,_0xe00355){return function(_0x5701ad){if(_0x5701ad){return _0x5701ad[_0x606d('0x29')]()[_0x606d('0x28')](function(){_0x3356c7[_0x606d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121e27,_0x451f7e){return function(_0x3fd257){if(!_0x3fd257){_0x121e27[_0x606d('0x1a')](0x194);}return _0x3fd257;};}function handleError(_0x599515,_0x37309b){_0x37309b=_0x37309b||0x1f4;return function(_0x38cfb2){logger[_0x606d('0x2a')](_0x38cfb2[_0x606d('0x2b')]);if(_0x38cfb2[_0x606d('0x2c')]){delete _0x38cfb2[_0x606d('0x2c')];}_0x599515[_0x606d('0x1c')](_0x37309b)[_0x606d('0x2d')](_0x38cfb2);};}exports[_0x606d('0x2e')]=function(_0x22ef39,_0x56e0de){var _0x481993={},_0x523c05={},_0x22857e={'count':0x0,'rows':[]};var _0x455e01=_[_0x606d('0x2f')](db[_0x606d('0x30')]['rawAttributes'],function(_0x581690){return{'name':_0x581690[_0x606d('0x31')],'type':_0x581690[_0x606d('0x32')][_0x606d('0x33')]};});_0x523c05[_0x606d('0x34')]=_[_0x606d('0x2f')](_0x455e01,_0x606d('0x2c'));_0x523c05[_0x606d('0x35')]=_[_0x606d('0x36')](_0x22ef39['query']);_0x523c05['filters']=_['intersection'](_0x523c05['model'],_0x523c05['query']);_0x481993['attributes']=_[_0x606d('0x37')](_0x523c05[_0x606d('0x34')],qs[_0x606d('0x38')](_0x22ef39[_0x606d('0x35')]['fields']));_0x481993[_0x606d('0x39')]=_0x481993[_0x606d('0x39')][_0x606d('0x3a')]?_0x481993[_0x606d('0x39')]:_0x523c05[_0x606d('0x34')];if(!_0x22ef39['query'][_0x606d('0x3b')](_0x606d('0x3c'))){_0x481993[_0x606d('0x21')]=qs[_0x606d('0x21')](_0x22ef39[_0x606d('0x35')][_0x606d('0x21')]);_0x481993[_0x606d('0x1e')]=qs['offset'](_0x22ef39['query']['offset']);}_0x481993[_0x606d('0x3d')]=qs[_0x606d('0x3e')](_0x22ef39[_0x606d('0x35')][_0x606d('0x3e')]);_0x481993[_0x606d('0x3f')]=qs[_0x606d('0x40')](_[_0x606d('0x41')](_0x22ef39[_0x606d('0x35')],_0x523c05[_0x606d('0x40')]),_0x455e01);if(_0x22ef39['query'][_0x606d('0x42')]){_0x481993[_0x606d('0x3f')]=_[_0x606d('0x43')](_0x481993['where'],{'$or':_[_0x606d('0x2f')](_0x455e01,function(_0x1ea774){if(_0x1ea774[_0x606d('0x32')]!==_0x606d('0x44')){var _0x294a67={};_0x294a67[_0x1ea774[_0x606d('0x2c')]]={'$like':'%'+_0x22ef39['query'][_0x606d('0x42')]+'%'};return _0x294a67;}})});}_0x481993=_['merge']({},_0x481993,_0x22ef39[_0x606d('0x45')]);var _0x486ada={'where':_0x481993[_0x606d('0x3f')]};return db[_0x606d('0x30')][_0x606d('0x20')](_0x486ada)[_0x606d('0x28')](function(_0x2045dc){_0x22857e[_0x606d('0x20')]=_0x2045dc;if(_0x22ef39[_0x606d('0x35')][_0x606d('0x46')]){_0x481993['include']=[{'all':!![]}];}return db[_0x606d('0x30')]['findAll'](_0x481993);})[_0x606d('0x28')](function(_0x5cc711){_0x22857e[_0x606d('0x47')]=_0x5cc711;return _0x22857e;})[_0x606d('0x28')](respondWithFilteredResult(_0x56e0de,_0x481993))[_0x606d('0x48')](handleError(_0x56e0de,null));};exports[_0x606d('0x49')]=function(_0x4893fb,_0x42b6e6){var _0x522ca7={'raw':![],'where':{'id':_0x4893fb[_0x606d('0x4a')]['id']}},_0x83aeaa={};_0x83aeaa[_0x606d('0x34')]=_[_0x606d('0x36')](db[_0x606d('0x30')][_0x606d('0x4b')]);_0x83aeaa[_0x606d('0x35')]=_['keys'](_0x4893fb[_0x606d('0x35')]);_0x83aeaa[_0x606d('0x40')]=_[_0x606d('0x37')](_0x83aeaa[_0x606d('0x34')],_0x83aeaa[_0x606d('0x35')]);_0x522ca7[_0x606d('0x39')]=_['intersection'](_0x83aeaa[_0x606d('0x34')],qs[_0x606d('0x38')](_0x4893fb[_0x606d('0x35')][_0x606d('0x38')]));_0x522ca7[_0x606d('0x39')]=_0x522ca7['attributes']['length']?_0x522ca7['attributes']:_0x83aeaa[_0x606d('0x34')];if(_0x4893fb[_0x606d('0x35')][_0x606d('0x46')]){_0x522ca7['include']=[{'all':!![]}];}_0x522ca7=_[_0x606d('0x43')]({},_0x522ca7,_0x4893fb[_0x606d('0x45')]);return db[_0x606d('0x30')][_0x606d('0x4c')](_0x522ca7)[_0x606d('0x28')](handleEntityNotFound(_0x42b6e6,null))['then'](respondWithResult(_0x42b6e6,null))[_0x606d('0x48')](handleError(_0x42b6e6,null));};exports['create']=function(_0x2d379a,_0x1684ed){return db['UserProfileSection'][_0x606d('0x4d')](_0x2d379a[_0x606d('0x4e')],{})[_0x606d('0x28')](respondWithResult(_0x1684ed,0xc9))[_0x606d('0x48')](handleError(_0x1684ed,null));};exports[_0x606d('0x27')]=function(_0x3f7686,_0x55ba31){if(_0x3f7686[_0x606d('0x4e')]['id']){delete _0x3f7686[_0x606d('0x4e')]['id'];}return db[_0x606d('0x30')][_0x606d('0x4c')]({'where':{'id':_0x3f7686['params']['id']}})[_0x606d('0x28')](handleEntityNotFound(_0x55ba31,null))[_0x606d('0x28')](saveUpdates(_0x3f7686[_0x606d('0x4e')],null))['then'](respondWithResult(_0x55ba31,null))[_0x606d('0x48')](handleError(_0x55ba31,null));};exports[_0x606d('0x29')]=function(_0x148679,_0x5ddba7){return db[_0x606d('0x30')][_0x606d('0x4c')]({'where':{'id':_0x148679[_0x606d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ddba7,null))['then'](removeEntity(_0x5ddba7,null))[_0x606d('0x48')](handleError(_0x5ddba7,null));};exports['describe']=function(_0x35c723,_0x4e5851){return db['UserProfileSection']['describe']()[_0x606d('0x28')](respondWithResult(_0x4e5851,null))['catch'](handleError(_0x4e5851,null));}; \ No newline at end of file +var _0x0193=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','UserProfileSection','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','params','includeAll','find','catch'];(function(_0x4f5dfd,_0x30e254){var _0x18d25d=function(_0x2c98ad){while(--_0x2c98ad){_0x4f5dfd['push'](_0x4f5dfd['shift']());}};_0x18d25d(++_0x30e254);}(_0x0193,0x1a7));var _0x3019=function(_0x5ceb77,_0x5360f8){_0x5ceb77=_0x5ceb77-0x0;var _0x427fcb=_0x0193[_0x5ceb77];return _0x427fcb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3019('0x0'));var zipdir=require(_0x3019('0x1'));var jsonpatch=require(_0x3019('0x2'));var rp=require(_0x3019('0x3'));var moment=require('moment');var BPromise=require(_0x3019('0x4'));var Mustache=require(_0x3019('0x5'));var util=require('util');var path=require(_0x3019('0x6'));var sox=require(_0x3019('0x7'));var csv=require(_0x3019('0x8'));var ejs=require(_0x3019('0x9'));var fs=require('fs');var fs_extra=require(_0x3019('0xa'));var _=require('lodash');var squel=require(_0x3019('0xb'));var crypto=require(_0x3019('0xc'));var jsforce=require(_0x3019('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3019('0x8'));var querystring=require(_0x3019('0xe'));var Papa=require(_0x3019('0xf'));var Redis=require('ioredis');var authService=require(_0x3019('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3019('0x11'))(_0x3019('0x12'));var utils=require(_0x3019('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaeec,_0x57fb47){_0x57fb47=_0x57fb47||0xcc;return function(_0x646930){if(_0x646930){return _0xaeec['sendStatus'](_0x57fb47);}return _0xaeec[_0x3019('0x14')](_0x57fb47)[_0x3019('0x15')]();};}function respondWithResult(_0xe8bfe2,_0x338b43){_0x338b43=_0x338b43||0xc8;return function(_0x29a2a7){if(_0x29a2a7){return _0xe8bfe2[_0x3019('0x14')](_0x338b43)[_0x3019('0x16')](_0x29a2a7);}};}function respondWithFilteredResult(_0x3973bc,_0x1247e6){return function(_0x59c584){if(_0x59c584){var _0x2779a5=typeof _0x1247e6[_0x3019('0x17')]===_0x3019('0x18')&&typeof _0x1247e6[_0x3019('0x19')]===_0x3019('0x18');var _0x9ad1e7=_0x59c584['count'];var _0x51d1bb=_0x2779a5?0x0:_0x1247e6[_0x3019('0x17')];var _0xbaf366=_0x2779a5?_0x59c584[_0x3019('0x1a')]:_0x1247e6[_0x3019('0x17')]+_0x1247e6[_0x3019('0x19')];var _0x224699;if(_0xbaf366>=_0x9ad1e7){_0xbaf366=_0x9ad1e7;_0x224699=0xc8;}else{_0x224699=0xce;}_0x3973bc[_0x3019('0x14')](_0x224699);return _0x3973bc[_0x3019('0x1b')](_0x3019('0x1c'),_0x51d1bb+'-'+_0xbaf366+'/'+_0x9ad1e7)[_0x3019('0x16')](_0x59c584);}return null;};}function patchUpdates(_0x3d5837){return function(_0x32a7e8){try{jsonpatch[_0x3019('0x1d')](_0x32a7e8,_0x3d5837,!![]);}catch(_0x21b4e){return BPromise[_0x3019('0x1e')](_0x21b4e);}return _0x32a7e8[_0x3019('0x1f')]();};}function saveUpdates(_0x373a0d,_0x3018f4){return function(_0x2525c8){if(_0x2525c8){return _0x2525c8[_0x3019('0x20')](_0x373a0d)[_0x3019('0x21')](function(_0x30b249){return _0x30b249;});}return null;};}function removeEntity(_0x3b2911,_0xaa3412){return function(_0x597006){if(_0x597006){return _0x597006['destroy']()[_0x3019('0x21')](function(){_0x3b2911[_0x3019('0x14')](0xcc)[_0x3019('0x15')]();});}};}function handleEntityNotFound(_0x29d701,_0x4ed82a){return function(_0x1d89ae){if(!_0x1d89ae){_0x29d701['sendStatus'](0x194);}return _0x1d89ae;};}function handleError(_0x39bd5c,_0x1626a5){_0x1626a5=_0x1626a5||0x1f4;return function(_0x4fbf66){logger[_0x3019('0x22')](_0x4fbf66[_0x3019('0x23')]);if(_0x4fbf66[_0x3019('0x24')]){delete _0x4fbf66[_0x3019('0x24')];}_0x39bd5c[_0x3019('0x14')](_0x1626a5)[_0x3019('0x25')](_0x4fbf66);};}exports['index']=function(_0x22f69d,_0x488db1){var _0x9e85a7={},_0x2f7cdd={},_0x190839={'count':0x0,'rows':[]};var _0x1b6ea3=_[_0x3019('0x26')](db[_0x3019('0x27')]['rawAttributes'],function(_0x446f36){return{'name':_0x446f36[_0x3019('0x28')],'type':_0x446f36[_0x3019('0x29')][_0x3019('0x2a')]};});_0x2f7cdd['model']=_[_0x3019('0x26')](_0x1b6ea3,'name');_0x2f7cdd[_0x3019('0x2b')]=_[_0x3019('0x2c')](_0x22f69d[_0x3019('0x2b')]);_0x2f7cdd[_0x3019('0x2d')]=_[_0x3019('0x2e')](_0x2f7cdd['model'],_0x2f7cdd[_0x3019('0x2b')]);_0x9e85a7[_0x3019('0x2f')]=_[_0x3019('0x2e')](_0x2f7cdd['model'],qs[_0x3019('0x30')](_0x22f69d[_0x3019('0x2b')]['fields']));_0x9e85a7[_0x3019('0x2f')]=_0x9e85a7[_0x3019('0x2f')][_0x3019('0x31')]?_0x9e85a7['attributes']:_0x2f7cdd[_0x3019('0x32')];if(!_0x22f69d[_0x3019('0x2b')][_0x3019('0x33')](_0x3019('0x34'))){_0x9e85a7['limit']=qs[_0x3019('0x19')](_0x22f69d[_0x3019('0x2b')][_0x3019('0x19')]);_0x9e85a7[_0x3019('0x17')]=qs[_0x3019('0x17')](_0x22f69d[_0x3019('0x2b')][_0x3019('0x17')]);}_0x9e85a7[_0x3019('0x35')]=qs[_0x3019('0x36')](_0x22f69d[_0x3019('0x2b')][_0x3019('0x36')]);_0x9e85a7[_0x3019('0x37')]=qs['filters'](_['pick'](_0x22f69d[_0x3019('0x2b')],_0x2f7cdd[_0x3019('0x2d')]),_0x1b6ea3);if(_0x22f69d['query'][_0x3019('0x38')]){_0x9e85a7[_0x3019('0x37')]=_['merge'](_0x9e85a7['where'],{'$or':_[_0x3019('0x26')](_0x1b6ea3,function(_0x37e414){if(_0x37e414[_0x3019('0x29')]!==_0x3019('0x39')){var _0x3deec3={};_0x3deec3[_0x37e414[_0x3019('0x24')]]={'$like':'%'+_0x22f69d['query']['filter']+'%'};return _0x3deec3;}})});}_0x9e85a7=_[_0x3019('0x3a')]({},_0x9e85a7,_0x22f69d[_0x3019('0x3b')]);var _0x1c95f6={'where':_0x9e85a7['where']};return db[_0x3019('0x27')][_0x3019('0x1a')](_0x1c95f6)[_0x3019('0x21')](function(_0x353867){_0x190839[_0x3019('0x1a')]=_0x353867;if(_0x22f69d[_0x3019('0x2b')]['includeAll']){_0x9e85a7[_0x3019('0x3c')]=[{'all':!![]}];}return db[_0x3019('0x27')][_0x3019('0x3d')](_0x9e85a7);})[_0x3019('0x21')](function(_0xf7f8ed){_0x190839[_0x3019('0x3e')]=_0xf7f8ed;return _0x190839;})[_0x3019('0x21')](respondWithFilteredResult(_0x488db1,_0x9e85a7))['catch'](handleError(_0x488db1,null));};exports['show']=function(_0x16e293,_0xf373cf){var _0x17a2e1={'raw':![],'where':{'id':_0x16e293[_0x3019('0x3f')]['id']}},_0x2b66a2={};_0x2b66a2[_0x3019('0x32')]=_[_0x3019('0x2c')](db[_0x3019('0x27')]['rawAttributes']);_0x2b66a2[_0x3019('0x2b')]=_[_0x3019('0x2c')](_0x16e293[_0x3019('0x2b')]);_0x2b66a2[_0x3019('0x2d')]=_['intersection'](_0x2b66a2[_0x3019('0x32')],_0x2b66a2['query']);_0x17a2e1['attributes']=_[_0x3019('0x2e')](_0x2b66a2[_0x3019('0x32')],qs['fields'](_0x16e293[_0x3019('0x2b')][_0x3019('0x30')]));_0x17a2e1['attributes']=_0x17a2e1[_0x3019('0x2f')][_0x3019('0x31')]?_0x17a2e1['attributes']:_0x2b66a2[_0x3019('0x32')];if(_0x16e293[_0x3019('0x2b')][_0x3019('0x40')]){_0x17a2e1[_0x3019('0x3c')]=[{'all':!![]}];}_0x17a2e1=_[_0x3019('0x3a')]({},_0x17a2e1,_0x16e293[_0x3019('0x3b')]);return db[_0x3019('0x27')][_0x3019('0x41')](_0x17a2e1)[_0x3019('0x21')](handleEntityNotFound(_0xf373cf,null))[_0x3019('0x21')](respondWithResult(_0xf373cf,null))[_0x3019('0x42')](handleError(_0xf373cf,null));};exports[_0x3019('0x43')]=function(_0x4c6cf2,_0x51c6ad){return db[_0x3019('0x27')][_0x3019('0x43')](_0x4c6cf2[_0x3019('0x44')],{})[_0x3019('0x21')](respondWithResult(_0x51c6ad,0xc9))[_0x3019('0x42')](handleError(_0x51c6ad,null));};exports[_0x3019('0x20')]=function(_0x564093,_0x109d41){if(_0x564093['body']['id']){delete _0x564093[_0x3019('0x44')]['id'];}return db[_0x3019('0x27')]['find']({'where':{'id':_0x564093[_0x3019('0x3f')]['id']}})['then'](handleEntityNotFound(_0x109d41,null))['then'](saveUpdates(_0x564093[_0x3019('0x44')],null))[_0x3019('0x21')](respondWithResult(_0x109d41,null))[_0x3019('0x42')](handleError(_0x109d41,null));};exports['destroy']=function(_0x19d502,_0x10faf1){return db[_0x3019('0x27')][_0x3019('0x41')]({'where':{'id':_0x19d502['params']['id']}})[_0x3019('0x21')](handleEntityNotFound(_0x10faf1,null))[_0x3019('0x21')](removeEntity(_0x10faf1,null))[_0x3019('0x42')](handleError(_0x10faf1,null));};exports[_0x3019('0x45')]=function(_0xc04c52,_0x1b3e71){return db[_0x3019('0x27')]['describe']()[_0x3019('0x21')](respondWithResult(_0x1b3e71,null))[_0x3019('0x42')](handleError(_0x1b3e71,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index bc47549..44ac9c7 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 _0xa687=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14954d,_0xf85e65){var _0x4ac7c1=function(_0xbf1d3c){while(--_0xbf1d3c){_0x14954d['push'](_0x14954d['shift']());}};_0x4ac7c1(++_0xf85e65);}(_0xa687,0x158));var _0x7a68=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0xa687[_0x375492];return _0x18ba5b;};'use strict';var _=require('lodash');var util=require(_0x7a68('0x0'));var logger=require('../../config/logger')(_0x7a68('0x1'));var moment=require(_0x7a68('0x2'));var BPromise=require(_0x7a68('0x3'));var rp=require(_0x7a68('0x4'));var fs=require('fs');var path=require(_0x7a68('0x5'));var rimraf=require(_0x7a68('0x6'));var config=require(_0x7a68('0x7'));var attributes=require(_0x7a68('0x8'));module[_0x7a68('0x9')]=function(_0x2a2ec3,_0x332ced){return _0x2a2ec3[_0x7a68('0xa')](_0x7a68('0xb'),attributes,{'tableName':_0x7a68('0xc'),'paranoid':![],'indexes':[{'name':_0x7a68('0xd'),'fields':[_0x7a68('0xe'),_0x7a68('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a1d=['./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3a1d,0xae));var _0xd3a1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a1d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd3a1('0x0'))(_0xd3a1('0x1'));var moment=require(_0xd3a1('0x2'));var BPromise=require('bluebird');var rp=require(_0xd3a1('0x3'));var fs=require('fs');var path=require(_0xd3a1('0x4'));var rimraf=require(_0xd3a1('0x5'));var config=require('../../config/environment');var attributes=require(_0xd3a1('0x6'));module['exports']=function(_0x37adcc,_0x1e5d7f){return _0x37adcc[_0xd3a1('0x7')]('UserProfileSection',attributes,{'tableName':_0xd3a1('0x8'),'paranoid':![],'indexes':[{'name':_0xd3a1('0x9'),'fields':[_0xd3a1('0xa'),_0xd3a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0cb7a45..474032f 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 _0x5b4e=['error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a6b78,_0x3c6a20){var _0x1c284d=function(_0x146084){while(--_0x146084){_0x3a6b78['push'](_0x3a6b78['shift']());}};_0x1c284d(++_0x3c6a20);}(_0x5b4e,0xd7));var _0xe5b4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5b4e[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe5b4('0x0'));var rs=require(_0xe5b4('0x1'));var fs=require('fs');var Redis=require(_0xe5b4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5b4('0x3'));var logger=require(_0xe5b4('0x4'))(_0xe5b4('0x5'));var config=require(_0xe5b4('0x6'));var jayson=require(_0xe5b4('0x7'));var client=jayson[_0xe5b4('0x8')][_0xe5b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x787fbe,_0x2eb1a8,_0x1435ed){return new BPromise(function(_0x1b8cdc,_0xa008ac){return client['request'](_0x787fbe,_0x1435ed)[_0xe5b4('0xa')](function(_0x40a2d2){logger[_0xe5b4('0xb')](_0xe5b4('0xc'),_0x2eb1a8,_0xe5b4('0xd'));logger['debug'](_0xe5b4('0xe'),_0x2eb1a8,_0xe5b4('0xd'),JSON[_0xe5b4('0xf')](_0x40a2d2));if(_0x40a2d2[_0xe5b4('0x10')]){if(_0x40a2d2['error'][_0xe5b4('0x11')]===0x1f4){logger[_0xe5b4('0x10')](_0xe5b4('0xc'),_0x2eb1a8,_0x40a2d2[_0xe5b4('0x10')][_0xe5b4('0x12')]);return _0xa008ac(_0x40a2d2[_0xe5b4('0x10')][_0xe5b4('0x12')]);}logger[_0xe5b4('0x10')](_0xe5b4('0xc'),_0x2eb1a8,_0x40a2d2[_0xe5b4('0x10')][_0xe5b4('0x12')]);return _0x1b8cdc(_0x40a2d2[_0xe5b4('0x10')][_0xe5b4('0x12')]);}else{logger[_0xe5b4('0xb')](_0xe5b4('0xc'),_0x2eb1a8,_0xe5b4('0xd'));_0x1b8cdc(_0x40a2d2[_0xe5b4('0x13')][_0xe5b4('0x12')]);}})[_0xe5b4('0x14')](function(_0x3bfa33){logger[_0xe5b4('0x10')](_0xe5b4('0xc'),_0x2eb1a8,_0x3bfa33);_0xa008ac(_0x3bfa33);});});} \ No newline at end of file +var _0xf544=['moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xf544,0x179));var _0x4f54=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf544[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x4f54('0x0'));var util=require('util');var moment=require(_0x4f54('0x1'));var BPromise=require(_0x4f54('0x2'));var rs=require(_0x4f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f54('0x4'));var config=require(_0x4f54('0x5'));var jayson=require(_0x4f54('0x6'));var client=jayson[_0x4f54('0x7')][_0x4f54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d347,_0x80a30d,_0x29976b){return new BPromise(function(_0x396d97,_0x315c51){return client[_0x4f54('0x9')](_0x31d347,_0x29976b)[_0x4f54('0xa')](function(_0xd06d59){logger[_0x4f54('0xb')](_0x4f54('0xc'),_0x80a30d,'request\x20sent');logger[_0x4f54('0xd')](_0x4f54('0xe'),_0x80a30d,'request\x20sent',JSON['stringify'](_0xd06d59));if(_0xd06d59[_0x4f54('0xf')]){if(_0xd06d59['error'][_0x4f54('0x10')]===0x1f4){logger[_0x4f54('0xf')](_0x4f54('0xc'),_0x80a30d,_0xd06d59[_0x4f54('0xf')]['message']);return _0x315c51(_0xd06d59[_0x4f54('0xf')]['message']);}logger[_0x4f54('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x80a30d,_0xd06d59[_0x4f54('0xf')][_0x4f54('0x11')]);return _0x396d97(_0xd06d59['error'][_0x4f54('0x11')]);}else{logger[_0x4f54('0xb')](_0x4f54('0xc'),_0x80a30d,_0x4f54('0x12'));_0x396d97(_0xd06d59[_0x4f54('0x13')][_0x4f54('0x11')]);}})[_0x4f54('0x14')](function(_0x21c51e){logger[_0x4f54('0xf')](_0x4f54('0xc'),_0x80a30d,_0x21c51e);_0x315c51(_0x21c51e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e5f5a7e..8b15291 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2179e3,_0x3f7767){var _0x3a350b=function(_0x1a4975){while(--_0x1a4975){_0x2179e3['push'](_0x2179e3['shift']());}};_0x3a350b(++_0x3f7767);}(_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'));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(_0x4d3cd6,_0x4c8e7a){var _0x1a258e=function(_0xaf3667){while(--_0xaf3667){_0x4d3cd6['push'](_0x4d3cd6['shift']());}};_0x1a258e(++_0x4c8e7a);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5654b93..a8e1064 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 _0x14a9=['exports','INTEGER'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x14a9,0x164));var _0x914a=function(_0x3b9028,_0x57ac10){_0x3b9028=_0x3b9028-0x0;var _0x4106bd=_0x14a9[_0x3b9028];return _0x4106bd;};'use strict';var Sequelize=require('sequelize');module[_0x914a('0x0')]={'penalty':{'type':Sequelize[_0x914a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77aa=['exports','INTEGER','sequelize'];(function(_0x2604d1,_0x8c1971){var _0x557c24=function(_0x51a5f7){while(--_0x51a5f7){_0x2604d1['push'](_0x2604d1['shift']());}};_0x557c24(++_0x8c1971);}(_0x77aa,0x89));var _0xa77a=function(_0x484c60,_0x3e7567){_0x484c60=_0x484c60-0x0;var _0x4270cd=_0x77aa[_0x484c60];return _0x4270cd;};'use strict';var Sequelize=require(_0xa77a('0x0'));module[_0xa77a('0x1')]={'penalty':{'type':Sequelize[_0xa77a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 69fe2fc..98efd6e 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 _0x2b29=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2b29,0x163));var _0x92b2=function(_0x171c2b,_0x4c766f){_0x171c2b=_0x171c2b-0x0;var _0x2c2abd=_0x2b29[_0x171c2b];return _0x2c2abd;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var logger=require(_0x92b2('0x1'))(_0x92b2('0x2'));var moment=require(_0x92b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b2('0x4'));var fs=require('fs');var path=require(_0x92b2('0x5'));var rimraf=require(_0x92b2('0x6'));var config=require(_0x92b2('0x7'));var attributes=require(_0x92b2('0x8'));module[_0x92b2('0x9')]=function(_0x47c522,_0xb1d856){return _0x47c522['define'](_0x92b2('0xa'),attributes,{'tableName':_0x92b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x542bb6,_0x22fc25){var _0x3f84da=function(_0x23c501){while(--_0x23c501){_0x542bb6['push'](_0x542bb6['shift']());}};_0x3f84da(++_0x22fc25);}(_0x4975,0x86));var _0x5497=function(_0x35e560,_0x12b66c){_0x35e560=_0x35e560-0x0;var _0x3378ee=_0x4975[_0x35e560];return _0x3378ee;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 11abbfe..11e1b4c 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 _0x34dc=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x34dc,0x1b7));var _0xc34d=function(_0x4774b7,_0x28e941){_0x4774b7=_0x4774b7-0x0;var _0xfa0907=_0x34dc[_0x4774b7];return _0xfa0907;};'use strict';var _=require(_0xc34d('0x0'));var util=require(_0xc34d('0x1'));var moment=require('moment');var BPromise=require(_0xc34d('0x2'));var rs=require(_0xc34d('0x3'));var fs=require('fs');var Redis=require(_0xc34d('0x4'));var db=require(_0xc34d('0x5'))['db'];var utils=require(_0xc34d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc34d('0x7'));var jayson=require(_0xc34d('0x8'));var client=jayson[_0xc34d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22233a,_0x37123f,_0xa76670){return new BPromise(function(_0x30b589,_0x2a2a88){return client[_0xc34d('0xa')](_0x22233a,_0xa76670)[_0xc34d('0xb')](function(_0x1ff1cd){logger[_0xc34d('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x37123f,'request\x20sent');logger[_0xc34d('0xd')](_0xc34d('0xe'),_0x37123f,_0xc34d('0xf'),JSON[_0xc34d('0x10')](_0x1ff1cd));if(_0x1ff1cd[_0xc34d('0x11')]){if(_0x1ff1cd['error'][_0xc34d('0x12')]===0x1f4){logger['error'](_0xc34d('0x13'),_0x37123f,_0x1ff1cd[_0xc34d('0x11')][_0xc34d('0x14')]);return _0x2a2a88(_0x1ff1cd[_0xc34d('0x11')][_0xc34d('0x14')]);}logger[_0xc34d('0x11')](_0xc34d('0x13'),_0x37123f,_0x1ff1cd['error'][_0xc34d('0x14')]);return _0x30b589(_0x1ff1cd['error'][_0xc34d('0x14')]);}else{logger[_0xc34d('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x37123f,_0xc34d('0xf'));_0x30b589(_0x1ff1cd[_0xc34d('0x15')][_0xc34d('0x14')]);}})[_0xc34d('0x16')](function(_0x2ad2fb){logger[_0xc34d('0x11')](_0xc34d('0x13'),_0x37123f,_0x2ad2fb);_0x2a2a88(_0x2ad2fb);});});} \ No newline at end of file +var _0x3e76=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14c3d6,_0x3e6ba9){var _0x2d8d05=function(_0x5bc9b4){while(--_0x5bc9b4){_0x14c3d6['push'](_0x14c3d6['shift']());}};_0x2d8d05(++_0x3e6ba9);}(_0x3e76,0x125));var _0x63e7=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x3e76[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x63e7('0x0'));var util=require(_0x63e7('0x1'));var moment=require('moment');var BPromise=require(_0x63e7('0x2'));var rs=require(_0x63e7('0x3'));var fs=require('fs');var Redis=require(_0x63e7('0x4'));var db=require(_0x63e7('0x5'))['db'];var utils=require(_0x63e7('0x6'));var logger=require(_0x63e7('0x7'))(_0x63e7('0x8'));var config=require(_0x63e7('0x9'));var jayson=require(_0x63e7('0xa'));var client=jayson['client'][_0x63e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9c7e,_0x2cfdb2,_0x4c8e29){return new BPromise(function(_0x1f7592,_0x3cfd70){return client[_0x63e7('0xc')](_0x3f9c7e,_0x4c8e29)[_0x63e7('0xd')](function(_0x5472ac){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2cfdb2,_0x63e7('0xe'));logger[_0x63e7('0xf')](_0x63e7('0x10'),_0x2cfdb2,_0x63e7('0xe'),JSON[_0x63e7('0x11')](_0x5472ac));if(_0x5472ac[_0x63e7('0x12')]){if(_0x5472ac[_0x63e7('0x12')][_0x63e7('0x13')]===0x1f4){logger['error'](_0x63e7('0x14'),_0x2cfdb2,_0x5472ac[_0x63e7('0x12')][_0x63e7('0x15')]);return _0x3cfd70(_0x5472ac[_0x63e7('0x12')][_0x63e7('0x15')]);}logger[_0x63e7('0x12')](_0x63e7('0x14'),_0x2cfdb2,_0x5472ac[_0x63e7('0x12')]['message']);return _0x1f7592(_0x5472ac[_0x63e7('0x12')][_0x63e7('0x15')]);}else{logger[_0x63e7('0x16')](_0x63e7('0x14'),_0x2cfdb2,_0x63e7('0xe'));_0x1f7592(_0x5472ac[_0x63e7('0x17')][_0x63e7('0x15')]);}})[_0x63e7('0x18')](function(_0x3dac37){logger[_0x63e7('0x12')](_0x63e7('0x14'),_0x2cfdb2,_0x3dac37);_0x3cfd70(_0x3dac37);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b5ee81d..6ef2efd 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 _0x95b5=['exports','INTEGER'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x95b5,0x12c));var _0x595b=function(_0x5b474c,_0x426d87){_0x5b474c=_0x5b474c-0x0;var _0x273b2c=_0x95b5[_0x5b474c];return _0x273b2c;};'use strict';var Sequelize=require('sequelize');module[_0x595b('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x595b('0x1')]}}; \ No newline at end of file +var _0xbfec=['sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbfec,0x1b3));var _0xcbfe=function(_0x291d3c,_0xcc4c32){_0x291d3c=_0x291d3c-0x0;var _0x251675=_0xbfec[_0x291d3c];return _0x251675;};'use strict';var Sequelize=require(_0xcbfe('0x0'));module[_0xcbfe('0x1')]={'UserId':{'type':Sequelize[_0xcbfe('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xcbfe('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 68af27b..ae8ca21 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(_0x1a0012,_0x2026af){var _0x39b22f=function(_0x2bc902){while(--_0x2bc902){_0x1a0012['push'](_0x1a0012['shift']());}};_0x39b22f(++_0x2026af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x5565ba,_0x46142f){var _0x3006c7=function(_0x534124){while(--_0x534124){_0x5565ba['push'](_0x5565ba['shift']());}};_0x3006c7(++_0x46142f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 97b20ba..4355b86 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x469787,_0x5e1662){var _0x5d8ed6=function(_0x1e2752){while(--_0x1e2752){_0x469787['push'](_0x469787['shift']());}};_0x5d8ed6(++_0x5e1662);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xcb91[_0x2fdf82];return _0x2382f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x228394,_0x2bcb15){var _0x1f4a17=function(_0x555b14){while(--_0x555b14){_0x228394['push'](_0x228394['shift']());}};_0x1f4a17(++_0x2bcb15);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f5a049c..e0d60ea 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 _0x1246=['exports','sequelize'];(function(_0x542b11,_0x411be8){var _0x102eca=function(_0x443516){while(--_0x443516){_0x542b11['push'](_0x542b11['shift']());}};_0x102eca(++_0x411be8);}(_0x1246,0x10b));var _0x6124=function(_0x4de28f,_0x4e01a9){_0x4de28f=_0x4de28f-0x0;var _0x4439ad=_0x1246[_0x4de28f];return _0x4439ad;};'use strict';var Sequelize=require(_0x6124('0x0'));module[_0x6124('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1e85=['sequelize','INTEGER'];(function(_0x40f535,_0x1ff9e2){var _0x37266c=function(_0x314993){while(--_0x314993){_0x40f535['push'](_0x40f535['shift']());}};_0x37266c(++_0x1ff9e2);}(_0x1e85,0x1aa));var _0x51e8=function(_0x168f21,_0x70b14){_0x168f21=_0x168f21-0x0;var _0x66dba=_0x1e85[_0x168f21];return _0x66dba;};'use strict';var Sequelize=require(_0x51e8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x51e8('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 53e29aa..a3001a3 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 _0xeea4=['request-promise','path','rimraf','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x538f41,_0x3e3fa6){var _0xd48c02=function(_0x236dd1){while(--_0x236dd1){_0x538f41['push'](_0x538f41['shift']());}};_0xd48c02(++_0x3e3fa6);}(_0xeea4,0x19e));var _0x4eea=function(_0x163519,_0x28d83d){_0x163519=_0x163519-0x0;var _0x27592b=_0xeea4[_0x163519];return _0x27592b;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var logger=require(_0x4eea('0x2'))(_0x4eea('0x3'));var moment=require(_0x4eea('0x4'));var BPromise=require(_0x4eea('0x5'));var rp=require(_0x4eea('0x6'));var fs=require('fs');var path=require(_0x4eea('0x7'));var rimraf=require(_0x4eea('0x8'));var config=require('../../config/environment');var attributes=require(_0x4eea('0x9'));module['exports']=function(_0x2df4ae,_0x383566){return _0x2df4ae[_0x4eea('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x4eea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15cb=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','bluebird'];(function(_0x42edce,_0x3434fc){var _0x415b73=function(_0x47fb99){while(--_0x47fb99){_0x42edce['push'](_0x42edce['shift']());}};_0x415b73(++_0x3434fc);}(_0x15cb,0x1cf));var _0xb15c=function(_0x32174c,_0x1f6e82){_0x32174c=_0x32174c-0x0;var _0x32fad0=_0x15cb[_0x32174c];return _0x32fad0;};'use strict';var _=require(_0xb15c('0x0'));var util=require(_0xb15c('0x1'));var logger=require(_0xb15c('0x2'))(_0xb15c('0x3'));var moment=require('moment');var BPromise=require(_0xb15c('0x4'));var rp=require(_0xb15c('0x5'));var fs=require('fs');var path=require(_0xb15c('0x6'));var rimraf=require(_0xb15c('0x7'));var config=require(_0xb15c('0x8'));var attributes=require(_0xb15c('0x9'));module[_0xb15c('0xa')]=function(_0x96a5da,_0x2a9e7d){return _0x96a5da[_0xb15c('0xb')](_0xb15c('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 d503714..8538224 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 _0x2e1c=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x3a5e11,_0x346470){var _0x2ca2ba=function(_0x334a47){while(--_0x334a47){_0x3a5e11['push'](_0x3a5e11['shift']());}};_0x2ca2ba(++_0x346470);}(_0x2e1c,0x1e8));var _0xc2e1=function(_0x53c5ec,_0x373a8e){_0x53c5ec=_0x53c5ec-0x0;var _0xe7fcba=_0x2e1c[_0x53c5ec];return _0xe7fcba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2e1('0x0'));var BPromise=require(_0xc2e1('0x1'));var rs=require(_0xc2e1('0x2'));var fs=require('fs');var Redis=require(_0xc2e1('0x3'));var db=require(_0xc2e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2e1('0x5'))(_0xc2e1('0x6'));var config=require(_0xc2e1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc2e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa9c2ca,_0x8a2899,_0x580631){return new BPromise(function(_0xfa44af,_0x2b6f00){return client[_0xc2e1('0x9')](_0xa9c2ca,_0x580631)[_0xc2e1('0xa')](function(_0x3c34ba){logger['info'](_0xc2e1('0xb'),_0x8a2899,_0xc2e1('0xc'));logger[_0xc2e1('0xd')](_0xc2e1('0xe'),_0x8a2899,_0xc2e1('0xc'),JSON[_0xc2e1('0xf')](_0x3c34ba));if(_0x3c34ba['error']){if(_0x3c34ba[_0xc2e1('0x10')][_0xc2e1('0x11')]===0x1f4){logger[_0xc2e1('0x10')](_0xc2e1('0xb'),_0x8a2899,_0x3c34ba[_0xc2e1('0x10')][_0xc2e1('0x12')]);return _0x2b6f00(_0x3c34ba[_0xc2e1('0x10')][_0xc2e1('0x12')]);}logger['error'](_0xc2e1('0xb'),_0x8a2899,_0x3c34ba['error'][_0xc2e1('0x12')]);return _0xfa44af(_0x3c34ba[_0xc2e1('0x10')]['message']);}else{logger['info'](_0xc2e1('0xb'),_0x8a2899,'request\x20sent');_0xfa44af(_0x3c34ba['result']['message']);}})[_0xc2e1('0x13')](function(_0x21e72a){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x8a2899,_0x21e72a);_0x2b6f00(_0x21e72a);});});} \ No newline at end of file +var _0xcc7d=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0x332d89,_0x1642ba){var _0x1826e0=function(_0x2a6233){while(--_0x2a6233){_0x332d89['push'](_0x332d89['shift']());}};_0x1826e0(++_0x1642ba);}(_0xcc7d,0x7a));var _0xdcc7=function(_0x5ece00,_0x3aecb9){_0x5ece00=_0x5ece00-0x0;var _0x509d71=_0xcc7d[_0x5ece00];return _0x509d71;};'use strict';var _=require('lodash');var util=require(_0xdcc7('0x0'));var moment=require('moment');var BPromise=require(_0xdcc7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcc7('0x2'));var db=require(_0xdcc7('0x3'))['db'];var utils=require(_0xdcc7('0x4'));var logger=require(_0xdcc7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdcc7('0x6'));var client=jayson[_0xdcc7('0x7')][_0xdcc7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x521b64,_0x185cd9,_0x50647f){return new BPromise(function(_0x15ef0e,_0x30f92d){return client['request'](_0x521b64,_0x50647f)[_0xdcc7('0x9')](function(_0xb7202a){logger[_0xdcc7('0xa')](_0xdcc7('0xb'),_0x185cd9,_0xdcc7('0xc'));logger[_0xdcc7('0xd')](_0xdcc7('0xe'),_0x185cd9,_0xdcc7('0xc'),JSON[_0xdcc7('0xf')](_0xb7202a));if(_0xb7202a[_0xdcc7('0x10')]){if(_0xb7202a[_0xdcc7('0x10')][_0xdcc7('0x11')]===0x1f4){logger[_0xdcc7('0x10')](_0xdcc7('0xb'),_0x185cd9,_0xb7202a['error']['message']);return _0x30f92d(_0xb7202a['error'][_0xdcc7('0x12')]);}logger[_0xdcc7('0x10')](_0xdcc7('0xb'),_0x185cd9,_0xb7202a['error']['message']);return _0x15ef0e(_0xb7202a[_0xdcc7('0x10')]['message']);}else{logger['info'](_0xdcc7('0xb'),_0x185cd9,'request\x20sent');_0x15ef0e(_0xb7202a[_0xdcc7('0x13')]['message']);}})[_0xdcc7('0x14')](function(_0x2c5f63){logger['error'](_0xdcc7('0xb'),_0x185cd9,_0x2c5f63);_0x30f92d(_0x2c5f63);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c6140f7..a1a791b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1700b8,_0xb6c117){var _0x267559=function(_0x87ec87){while(--_0x87ec87){_0x1700b8['push'](_0x1700b8['shift']());}};_0x267559(++_0xb6c117);}(_0xe706,0xa3));var _0x6e70=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0xe706[_0x32aa68];return _0x292133;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x463fec,_0x154c0f){var _0x4bc560=function(_0x4188be){while(--_0x4188be){_0x463fec['push'](_0x463fec['shift']());}};_0x4bc560(++_0x154c0f);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9e58475..646e85a 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 _0x7f05=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x4756c2,_0x3c5da3){var _0x4a5022=function(_0x381965){while(--_0x381965){_0x4756c2['push'](_0x4756c2['shift']());}};_0x4a5022(++_0x3c5da3);}(_0x7f05,0xdc));var _0x57f0=function(_0x4ee377,_0x29ff99){_0x4ee377=_0x4ee377-0x0;var _0x284119=_0x7f05[_0x4ee377];return _0x284119;};'use strict';var Sequelize=require(_0x57f0('0x0'));module[_0x57f0('0x1')]={'uniqueid':{'type':Sequelize[_0x57f0('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x57f0('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x57f0('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x57f0('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x57f0('0x4')},'VoiceQueueId':{'type':Sequelize[_0x57f0('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x57f0('0x5'),'comment':_0x57f0('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x57f0('0x4')},'paused':{'type':Sequelize[_0x57f0('0x2')](0xb),'defaultValue':0x0,'comment':_0x57f0('0x4')}}; \ No newline at end of file +var _0x5993=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x597ab0,_0x4260c9){var _0x227e94=function(_0xf0d86c){while(--_0xf0d86c){_0x597ab0['push'](_0x597ab0['shift']());}};_0x227e94(++_0x4260c9);}(_0x5993,0x71));var _0x3599=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x5993[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x3599('0x0'));module[_0x3599('0x1')]={'uniqueid':{'type':Sequelize[_0x3599('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3599('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x3599('0x3')},'UserId':{'type':Sequelize[_0x3599('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3599('0x4')],'allowNull':![],'unique':_0x3599('0x5'),'comment':_0x3599('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3599('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x3599('0x4')],'allowNull':![],'unique':_0x3599('0x5'),'comment':_0x3599('0x3')},'penalty':{'type':Sequelize[_0x3599('0x2')](0xb),'defaultValue':0x0,'comment':_0x3599('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3599('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 93666b1..8875c99 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 _0x884c=['events','../../mysqldb','UserVoiceQueueRt','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0xcf61d6,_0x4e3019){var _0x372f12=function(_0x2e0dea){while(--_0x2e0dea){_0xcf61d6['push'](_0xcf61d6['shift']());}};_0x372f12(++_0x4e3019);}(_0x884c,0x90));var _0xc884=function(_0x31aa1f,_0x42ef34){_0x31aa1f=_0x31aa1f-0x0;var _0x2b4c46=_0x884c[_0x31aa1f];return _0x2b4c46;};'use strict';var EventEmitter=require(_0xc884('0x0'));var UserVoiceQueueRt=require(_0xc884('0x1'))['db'][_0xc884('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc884('0x3'),'afterUpdate':'update','afterDestroy':_0xc884('0x4')};function emitEvent(_0x5c383d){return function(_0xe290f8,_0x29817c,_0x54cb38){UserVoiceQueueRtEvents[_0xc884('0x5')](_0x5c383d+':'+_0xe290f8['id'],_0xe290f8);UserVoiceQueueRtEvents[_0xc884('0x5')](_0x5c383d,_0xe290f8);_0x54cb38(null);};}for(var e in events){if(events[_0xc884('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xc884('0x7')](e,emitEvent(event));}}module[_0xc884('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5c8c=['emit','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update'];(function(_0x3c58da,_0x50e809){var _0x17697e=function(_0x45a222){while(--_0x45a222){_0x3c58da['push'](_0x3c58da['shift']());}};_0x17697e(++_0x50e809);}(_0x5c8c,0x1ed));var _0xc5c8=function(_0x4235ea,_0x4173f6){_0x4235ea=_0x4235ea-0x0;var _0x41415d=_0x5c8c[_0x4235ea];return _0x41415d;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc5c8('0x0'))['db'][_0xc5c8('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc5c8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc5c8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ee2bb){return function(_0x18c87b,_0x3c078f,_0x3b4dc5){UserVoiceQueueRtEvents[_0xc5c8('0x4')](_0x2ee2bb+':'+_0x18c87b['id'],_0x18c87b);UserVoiceQueueRtEvents['emit'](_0x2ee2bb,_0x18c87b);_0x3b4dc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc5c8('0x5')](e,emitEvent(event));}}module[_0xc5c8('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 83c1130..cc91d0b 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 _0x271f=['user_has_voice_queues_rt','util','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x36b97c,_0x381e2a){var _0x7293a4=function(_0x2e5dee){while(--_0x2e5dee){_0x36b97c['push'](_0x36b97c['shift']());}};_0x7293a4(++_0x381e2a);}(_0x271f,0x1af));var _0xf271=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x271f[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xf271('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf271('0x1'));var BPromise=require('bluebird');var rp=require(_0xf271('0x2'));var fs=require('fs');var path=require(_0xf271('0x3'));var rimraf=require('rimraf');var config=require(_0xf271('0x4'));var attributes=require(_0xf271('0x5'));module[_0xf271('0x6')]=function(_0x51ec61,_0x1e2027){return _0x51ec61[_0xf271('0x7')](_0xf271('0x8'),attributes,{'tableName':_0xf271('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c25=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x44c208,_0x2e9267){var _0x35087c=function(_0x51b3e6){while(--_0x51b3e6){_0x44c208['push'](_0x44c208['shift']());}};_0x35087c(++_0x2e9267);}(_0x4c25,0x1da));var _0x54c2=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0x4c25[_0x5c811c];return _0x5df3af;};'use strict';var _=require('lodash');var util=require(_0x54c2('0x0'));var logger=require(_0x54c2('0x1'))('api');var moment=require(_0x54c2('0x2'));var BPromise=require(_0x54c2('0x3'));var rp=require(_0x54c2('0x4'));var fs=require('fs');var path=require(_0x54c2('0x5'));var rimraf=require(_0x54c2('0x6'));var config=require(_0x54c2('0x7'));var attributes=require(_0x54c2('0x8'));module[_0x54c2('0x9')]=function(_0x55b607,_0x4f2c85){return _0x55b607[_0x54c2('0xa')](_0x54c2('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 541e27a..6d3567c 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 _0x8e9a=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x33fcfe,_0x385b7c){var _0x3bc1ad=function(_0x20552d){while(--_0x20552d){_0x33fcfe['push'](_0x33fcfe['shift']());}};_0x3bc1ad(++_0x385b7c);}(_0x8e9a,0xe9));var _0xa8e9=function(_0x3378c0,_0x53e2ad){_0x3378c0=_0x3378c0-0x0;var _0x50970f=_0x8e9a[_0x3378c0];return _0x50970f;};'use strict';var _=require('lodash');var util=require(_0xa8e9('0x0'));var moment=require(_0xa8e9('0x1'));var BPromise=require(_0xa8e9('0x2'));var rs=require(_0xa8e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8e9('0x4'))['db'];var utils=require(_0xa8e9('0x5'));var logger=require('../../config/logger')(_0xa8e9('0x6'));var config=require(_0xa8e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8e9('0x8')][_0xa8e9('0x9')]({'port':0x232a});config[_0xa8e9('0xa')]=_[_0xa8e9('0xb')](config[_0xa8e9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa8e9('0xc'))(new Redis(config[_0xa8e9('0xa')]));require(_0xa8e9('0xd'))[_0xa8e9('0xe')](socket);function respondWithRpcPromise(_0xdb9781,_0x572335,_0x41a985){return new BPromise(function(_0x317e82,_0x372f72){return client[_0xa8e9('0xf')](_0xdb9781,_0x41a985)['then'](function(_0x2c592e){logger[_0xa8e9('0x10')](_0xa8e9('0x11'),_0x572335,_0xa8e9('0x12'));logger[_0xa8e9('0x13')](_0xa8e9('0x14'),_0x572335,'request\x20sent',JSON[_0xa8e9('0x15')](_0x2c592e));if(_0x2c592e['error']){if(_0x2c592e['error'][_0xa8e9('0x16')]===0x1f4){logger[_0xa8e9('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x572335,_0x2c592e['error'][_0xa8e9('0x18')]);return _0x372f72(_0x2c592e[_0xa8e9('0x17')][_0xa8e9('0x18')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x572335,_0x2c592e[_0xa8e9('0x17')][_0xa8e9('0x18')]);return _0x317e82(_0x2c592e['error'][_0xa8e9('0x18')]);}else{logger['info'](_0xa8e9('0x11'),_0x572335,_0xa8e9('0x12'));_0x317e82(_0x2c592e[_0xa8e9('0x19')][_0xa8e9('0x18')]);}})[_0xa8e9('0x1a')](function(_0x1ed000){logger[_0xa8e9('0x17')](_0xa8e9('0x11'),_0x572335,_0x1ed000);_0x372f72(_0x1ed000);});});}exports[_0xa8e9('0x1b')]=function(_0x107c52){var _0x28a37f=this;return new Promise(function(_0x102d1a,_0x3b6d05){return db[_0xa8e9('0x1c')][_0xa8e9('0x1d')]({'raw':_0x107c52[_0xa8e9('0x1e')]?_0x107c52[_0xa8e9('0x1e')][_0xa8e9('0x1f')]===undefined?!![]:![]:!![],'where':_0x107c52[_0xa8e9('0x1e')]?_0x107c52['options']['where']||null:null,'attributes':[[db[_0xa8e9('0x20')]['fn'](_0xa8e9('0x21'),db[_0xa8e9('0x20')]['fn']('IF',db[_0xa8e9('0x20')][_0xa8e9('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xa8e9('0x23')](function(_0x540e6f){logger[_0xa8e9('0x10')](_0xa8e9('0x1b'),_0x107c52);logger[_0xa8e9('0x13')](_0xa8e9('0x1b'),_0x107c52,JSON[_0xa8e9('0x15')](_0x540e6f));_0x102d1a(_0x540e6f);})[_0xa8e9('0x1a')](function(_0x3a710a){logger['error'](_0xa8e9('0x1b'),_0x3a710a[_0xa8e9('0x18')],_0x107c52);_0x3b6d05(_0x28a37f[_0xa8e9('0x17')](0x1f4,_0x3a710a[_0xa8e9('0x18')]));});});}; \ No newline at end of file +var _0x24d2=['literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT'];(function(_0x3f553a,_0x4880c7){var _0x5b5e06=function(_0x2c391f){while(--_0x2c391f){_0x3f553a['push'](_0x3f553a['shift']());}};_0x5b5e06(++_0x4880c7);}(_0x24d2,0x105));var _0x224d=function(_0x40c629,_0x10c531){_0x40c629=_0x40c629-0x0;var _0x379313=_0x24d2[_0x40c629];return _0x379313;};'use strict';var _=require(_0x224d('0x0'));var util=require(_0x224d('0x1'));var moment=require(_0x224d('0x2'));var BPromise=require(_0x224d('0x3'));var rs=require(_0x224d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x224d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x224d('0x6'))(_0x224d('0x7'));var config=require(_0x224d('0x8'));var jayson=require(_0x224d('0x9'));var client=jayson[_0x224d('0xa')][_0x224d('0xb')]({'port':0x232a});config[_0x224d('0xc')]=_['defaults'](config[_0x224d('0xc')],{'host':_0x224d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x224d('0xe')](socket);function respondWithRpcPromise(_0x30c12b,_0x3a92e5,_0x231553){return new BPromise(function(_0x363a86,_0x225dd0){return client[_0x224d('0xf')](_0x30c12b,_0x231553)[_0x224d('0x10')](function(_0x22151e){logger['info'](_0x224d('0x11'),_0x3a92e5,_0x224d('0x12'));logger[_0x224d('0x13')](_0x224d('0x14'),_0x3a92e5,_0x224d('0x12'),JSON[_0x224d('0x15')](_0x22151e));if(_0x22151e['error']){if(_0x22151e[_0x224d('0x16')][_0x224d('0x17')]===0x1f4){logger[_0x224d('0x16')](_0x224d('0x11'),_0x3a92e5,_0x22151e[_0x224d('0x16')][_0x224d('0x18')]);return _0x225dd0(_0x22151e[_0x224d('0x16')]['message']);}logger[_0x224d('0x16')](_0x224d('0x11'),_0x3a92e5,_0x22151e[_0x224d('0x16')]['message']);return _0x363a86(_0x22151e[_0x224d('0x16')][_0x224d('0x18')]);}else{logger[_0x224d('0x19')](_0x224d('0x11'),_0x3a92e5,_0x224d('0x12'));_0x363a86(_0x22151e[_0x224d('0x1a')][_0x224d('0x18')]);}})[_0x224d('0x1b')](function(_0x41b15a){logger[_0x224d('0x16')](_0x224d('0x11'),_0x3a92e5,_0x41b15a);_0x225dd0(_0x41b15a);});});}exports[_0x224d('0x1c')]=function(_0x5e9d8a){var _0x92ef36=this;return new Promise(function(_0x16ce65,_0x17e1f6){return db[_0x224d('0x1d')][_0x224d('0x1e')]({'raw':_0x5e9d8a[_0x224d('0x1f')]?_0x5e9d8a[_0x224d('0x1f')][_0x224d('0x20')]===undefined?!![]:![]:!![],'where':_0x5e9d8a[_0x224d('0x1f')]?_0x5e9d8a[_0x224d('0x1f')]['where']||null:null,'attributes':[[db[_0x224d('0x21')]['fn'](_0x224d('0x22'),db[_0x224d('0x21')]['fn']('IF',db['sequelize'][_0x224d('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x224d('0x24')]]})[_0x224d('0x10')](function(_0x1cee61){logger[_0x224d('0x19')](_0x224d('0x1c'),_0x5e9d8a);logger[_0x224d('0x13')]('GetVoiceQueueRtPauses',_0x5e9d8a,JSON[_0x224d('0x15')](_0x1cee61));_0x16ce65(_0x1cee61);})['catch'](function(_0x41e398){logger[_0x224d('0x16')](_0x224d('0x1c'),_0x41e398['message'],_0x5e9d8a);_0x17e1f6(_0x92ef36[_0x224d('0x16')](0x1f4,_0x41e398[_0x224d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 63f37e2..131628a 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 _0xc99e=['remove','update','emit','removeListener','register','./userVoiceQueueRt.events','save'];(function(_0x3c9520,_0x187f3c){var _0xbe7616=function(_0x329dbc){while(--_0x329dbc){_0x3c9520['push'](_0x3c9520['shift']());}};_0xbe7616(++_0x187f3c);}(_0xc99e,0x6e));var _0xec99=function(_0x64ac98,_0x2054e9){_0x64ac98=_0x64ac98-0x0;var _0x4b6bc3=_0xc99e[_0x64ac98];return _0x4b6bc3;};'use strict';var UserVoiceQueueRtEvents=require(_0xec99('0x0'));var events=[_0xec99('0x1'),_0xec99('0x2'),_0xec99('0x3')];function createListener(_0x22b65c,_0x41e155){return function(_0x4e3a66){_0x41e155[_0xec99('0x4')](_0x22b65c,_0x4e3a66);};}function removeListener(_0x4055ec,_0x111230){return function(){UserVoiceQueueRtEvents[_0xec99('0x5')](_0x4055ec,_0x111230);};}exports[_0xec99('0x6')]=function(_0x39821d){for(var _0x451dd4=0x0,_0x470d70=events['length'];_0x451dd4<_0x470d70;_0x451dd4++){var _0x797806=events[_0x451dd4];var _0x425a61=createListener('userVoiceQueueRt:'+_0x797806,_0x39821d);UserVoiceQueueRtEvents['on'](_0x797806,_0x425a61);}}; \ No newline at end of file +var _0x8838=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','userVoiceQueueRt:'];(function(_0x5dd8e3,_0x57116e){var _0x3377b1=function(_0x588cee){while(--_0x588cee){_0x5dd8e3['push'](_0x5dd8e3['shift']());}};_0x3377b1(++_0x57116e);}(_0x8838,0x90));var _0x8883=function(_0x5110ac,_0x275108){_0x5110ac=_0x5110ac-0x0;var _0x4802be=_0x8838[_0x5110ac];return _0x4802be;};'use strict';var UserVoiceQueueRtEvents=require(_0x8883('0x0'));var events=[_0x8883('0x1'),_0x8883('0x2'),_0x8883('0x3')];function createListener(_0x34c74f,_0x454b0b){return function(_0xddccbc){_0x454b0b[_0x8883('0x4')](_0x34c74f,_0xddccbc);};}function removeListener(_0x3df479,_0x2d7568){return function(){UserVoiceQueueRtEvents[_0x8883('0x5')](_0x3df479,_0x2d7568);};}exports[_0x8883('0x6')]=function(_0x5c894f){for(var _0x5061d6=0x0,_0x363519=events['length'];_0x5061d6<_0x363519;_0x5061d6++){var _0x458214=events[_0x5061d6];var _0x45a59c=createListener(_0x8883('0x7')+_0x458214,_0x5c894f);UserVoiceQueueRtEvents['on'](_0x458214,_0x45a59c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 37f7749..1e071ae 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x49bbf2,_0x2a082f){var _0x2b14ee=function(_0x540cf2){while(--_0x540cf2){_0x49bbf2['push'](_0x49bbf2['shift']());}};_0x2b14ee(++_0x2a082f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xcb91[_0x38b14f];return _0x22a324;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x99c2dd,_0x1d32eb){var _0x173349=function(_0x211a30){while(--_0x211a30){_0x99c2dd['push'](_0x99c2dd['shift']());}};_0x173349(++_0x1d32eb);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 253a238..7fc54de 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 _0xe142=['INTEGER'];(function(_0x1b4986,_0x27c04e){var _0x33cd0b=function(_0x468280){while(--_0x468280){_0x1b4986['push'](_0x1b4986['shift']());}};_0x33cd0b(++_0x27c04e);}(_0xe142,0xaa));var _0x2e14=function(_0x3617a3,_0x20659a){_0x3617a3=_0x3617a3-0x0;var _0x1b8f65=_0xe142[_0x3617a3];return _0x1b8f65;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x2e14('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd845=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd845,0x1e1));var _0x5d84=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xd845[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x5d84('0x0'));module[_0x5d84('0x1')]={'penalty':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b3b3be4..96c9bc9 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 _0x41ec=['moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x1a6c8b,_0x989bca){var _0x359f2d=function(_0xd80bcc){while(--_0xd80bcc){_0x1a6c8b['push'](_0x1a6c8b['shift']());}};_0x359f2d(++_0x989bca);}(_0x41ec,0x142));var _0xc41e=function(_0x1bbec8,_0x6c88dd){_0x1bbec8=_0x1bbec8-0x0;var _0x4d8b15=_0x41ec[_0x1bbec8];return _0x4d8b15;};'use strict';var _=require(_0xc41e('0x0'));var util=require(_0xc41e('0x1'));var logger=require(_0xc41e('0x2'))('api');var moment=require(_0xc41e('0x3'));var BPromise=require(_0xc41e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc41e('0x5'));var rimraf=require(_0xc41e('0x6'));var config=require(_0xc41e('0x7'));var attributes=require(_0xc41e('0x8'));module[_0xc41e('0x9')]=function(_0x41e973,_0x5b9051){return _0x41e973[_0xc41e('0xa')](_0xc41e('0xb'),attributes,{'tableName':_0xc41e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323c=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','lodash'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x323c,0x18f));var _0xc323=function(_0x370a8b,_0x490064){_0x370a8b=_0x370a8b-0x0;var _0x38277d=_0x323c[_0x370a8b];return _0x38277d;};'use strict';var _=require(_0xc323('0x0'));var util=require(_0xc323('0x1'));var logger=require(_0xc323('0x2'))(_0xc323('0x3'));var moment=require(_0xc323('0x4'));var BPromise=require('bluebird');var rp=require(_0xc323('0x5'));var fs=require('fs');var path=require(_0xc323('0x6'));var rimraf=require(_0xc323('0x7'));var config=require(_0xc323('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0xc323('0x9')]=function(_0x4026d6,_0xde4298){return _0x4026d6['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 4df27f6..6bac9f9 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 _0xdf9e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x50e242,_0x3c0f4e){var _0x321c5e=function(_0x306034){while(--_0x306034){_0x50e242['push'](_0x50e242['shift']());}};_0x321c5e(++_0x3c0f4e);}(_0xdf9e,0x72));var _0xedf9=function(_0x832e43,_0x2d09a8){_0x832e43=_0x832e43-0x0;var _0x1a846f=_0xdf9e[_0x832e43];return _0x1a846f;};'use strict';var _=require(_0xedf9('0x0'));var util=require(_0xedf9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedf9('0x2'));var fs=require('fs');var Redis=require(_0xedf9('0x3'));var db=require(_0xedf9('0x4'))['db'];var utils=require(_0xedf9('0x5'));var logger=require(_0xedf9('0x6'))(_0xedf9('0x7'));var config=require(_0xedf9('0x8'));var jayson=require(_0xedf9('0x9'));var client=jayson[_0xedf9('0xa')][_0xedf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33a167,_0xd7958d,_0x3b8b77){return new BPromise(function(_0x3ab3f9,_0x3a2562){return client[_0xedf9('0xc')](_0x33a167,_0x3b8b77)[_0xedf9('0xd')](function(_0xd5a2a){logger[_0xedf9('0xe')](_0xedf9('0xf'),_0xd7958d,'request\x20sent');logger[_0xedf9('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xd7958d,'request\x20sent',JSON[_0xedf9('0x11')](_0xd5a2a));if(_0xd5a2a[_0xedf9('0x12')]){if(_0xd5a2a['error'][_0xedf9('0x13')]===0x1f4){logger['error'](_0xedf9('0xf'),_0xd7958d,_0xd5a2a['error'][_0xedf9('0x14')]);return _0x3a2562(_0xd5a2a[_0xedf9('0x12')][_0xedf9('0x14')]);}logger[_0xedf9('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0xd7958d,_0xd5a2a[_0xedf9('0x12')][_0xedf9('0x14')]);return _0x3ab3f9(_0xd5a2a[_0xedf9('0x12')]['message']);}else{logger['info'](_0xedf9('0xf'),_0xd7958d,_0xedf9('0x15'));_0x3ab3f9(_0xd5a2a[_0xedf9('0x16')][_0xedf9('0x14')]);}})[_0xedf9('0x17')](function(_0x3037c0){logger[_0xedf9('0x12')](_0xedf9('0xf'),_0xd7958d,_0x3037c0);_0x3a2562(_0x3037c0);});});} \ No newline at end of file +var _0xaa1c=['then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x326448,_0x130b79){var _0x220aca=function(_0x381a23){while(--_0x381a23){_0x326448['push'](_0x326448['shift']());}};_0x220aca(++_0x130b79);}(_0xaa1c,0x7e));var _0xcaa1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaa1c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcaa1('0x0'));var util=require('util');var moment=require(_0xcaa1('0x1'));var BPromise=require(_0xcaa1('0x2'));var rs=require(_0xcaa1('0x3'));var fs=require('fs');var Redis=require(_0xcaa1('0x4'));var db=require(_0xcaa1('0x5'))['db'];var utils=require(_0xcaa1('0x6'));var logger=require(_0xcaa1('0x7'))(_0xcaa1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcaa1('0x9')][_0xcaa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x114141,_0x2ea109,_0xab2d7b){return new BPromise(function(_0x421088,_0x5bb55e){return client[_0xcaa1('0xb')](_0x114141,_0xab2d7b)[_0xcaa1('0xc')](function(_0x4bfdd0){logger[_0xcaa1('0xd')](_0xcaa1('0xe'),_0x2ea109,_0xcaa1('0xf'));logger[_0xcaa1('0x10')](_0xcaa1('0x11'),_0x2ea109,_0xcaa1('0xf'),JSON[_0xcaa1('0x12')](_0x4bfdd0));if(_0x4bfdd0[_0xcaa1('0x13')]){if(_0x4bfdd0[_0xcaa1('0x13')][_0xcaa1('0x14')]===0x1f4){logger[_0xcaa1('0x13')](_0xcaa1('0xe'),_0x2ea109,_0x4bfdd0[_0xcaa1('0x13')][_0xcaa1('0x15')]);return _0x5bb55e(_0x4bfdd0['error'][_0xcaa1('0x15')]);}logger[_0xcaa1('0x13')](_0xcaa1('0xe'),_0x2ea109,_0x4bfdd0[_0xcaa1('0x13')][_0xcaa1('0x15')]);return _0x421088(_0x4bfdd0['error']['message']);}else{logger['info'](_0xcaa1('0xe'),_0x2ea109,_0xcaa1('0xf'));_0x421088(_0x4bfdd0[_0xcaa1('0x16')][_0xcaa1('0x15')]);}})['catch'](function(_0xb6b7a4){logger[_0xcaa1('0x13')](_0xcaa1('0xe'),_0x2ea109,_0xb6b7a4);_0x5bb55e(_0xb6b7a4);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f905cb9..d70c8f5 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 _0xbec5=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','index'];(function(_0x1ab758,_0x3dbede){var _0x5788a0=function(_0x324d24){while(--_0x324d24){_0x1ab758['push'](_0x1ab758['shift']());}};_0x5788a0(++_0x3dbede);}(_0xbec5,0xe5));var _0x5bec=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0xbec5[_0x582f72];return _0x4cd5fe;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);module[_0x5bec('0x13')]=router; \ No newline at end of file +var _0x4aa3=['/:id','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show'];(function(_0x426d90,_0x54e8f2){var _0x47c5af=function(_0x1bf9ec){while(--_0x1bf9ec){_0x426d90['push'](_0x426d90['shift']());}};_0x47c5af(++_0x54e8f2);}(_0x4aa3,0x174));var _0x34aa=function(_0x501dc5,_0x3470c9){_0x501dc5=_0x501dc5-0x0;var _0x293b76=_0x4aa3[_0x501dc5];return _0x293b76;};'use strict';var multer=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var path=require('path');var timeout=require(_0x34aa('0x2'));var express=require(_0x34aa('0x3'));var router=express['Router']();var fs_extra=require(_0x34aa('0x4'));var auth=require(_0x34aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x34aa('0x6'));var controller=require(_0x34aa('0x7'));router[_0x34aa('0x8')]('/',auth['isAuthenticated'](),controller[_0x34aa('0x9')]);router[_0x34aa('0x8')]('/:id',auth[_0x34aa('0xa')](),controller[_0x34aa('0xb')]);router['post']('/',auth[_0x34aa('0xa')](),controller['create']);router['put'](_0x34aa('0xc'),auth[_0x34aa('0xa')](),controller[_0x34aa('0xd')]);router[_0x34aa('0xe')](_0x34aa('0xc'),auth[_0x34aa('0xa')](),controller['destroy']);module[_0x34aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6dfe7d4..8c8e8b9 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 _0x6c7b=['STRING','sequelize'];(function(_0x2f8cb2,_0x72911e){var _0x1a11f3=function(_0x57ea7b){while(--_0x57ea7b){_0x2f8cb2['push'](_0x2f8cb2['shift']());}};_0x1a11f3(++_0x72911e);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x50dc0f,_0x162cb2){_0x50dc0f=_0x50dc0f-0x0;var _0xe0166c=_0x6c7b[_0x50dc0f];return _0xe0166c;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file +var _0x320e=['sequelize','STRING'];(function(_0x26e8c8,_0x156146){var _0x2a25e7=function(_0xfde90b){while(--_0xfde90b){_0x26e8c8['push'](_0x26e8c8['shift']());}};_0x2a25e7(++_0x156146);}(_0x320e,0x8c));var _0xe320=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x320e[_0x59ef3d];return _0x585558;};'use strict';var Sequelize=require(_0xe320('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe320('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 84fa9f5..57933fc 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 _0x9ec7=['type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','Variable','includeAll','rows','catch','params','find','create','body','user','role','Variables','userProfileId','autoAssociation','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName'];(function(_0x3aa9c0,_0x242ff3){var _0x49c51d=function(_0x5b8f07){while(--_0x5b8f07){_0x3aa9c0['push'](_0x3aa9c0['shift']());}};_0x49c51d(++_0x242ff3);}(_0x9ec7,0x1b2));var _0x79ec=function(_0x426ea,_0x5b68ec){_0x426ea=_0x426ea-0x0;var _0x32abae=_0x9ec7[_0x426ea];return _0x32abae;};'use strict';var emlformat=require(_0x79ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79ec('0x1'));var jsonpatch=require(_0x79ec('0x2'));var rp=require('request-promise');var moment=require(_0x79ec('0x3'));var BPromise=require(_0x79ec('0x4'));var Mustache=require(_0x79ec('0x5'));var util=require(_0x79ec('0x6'));var path=require('path');var sox=require(_0x79ec('0x7'));var csv=require(_0x79ec('0x8'));var ejs=require(_0x79ec('0x9'));var fs=require('fs');var fs_extra=require(_0x79ec('0xa'));var _=require(_0x79ec('0xb'));var squel=require(_0x79ec('0xc'));var crypto=require(_0x79ec('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x79ec('0x8'));var querystring=require(_0x79ec('0xe'));var Papa=require(_0x79ec('0xf'));var Redis=require(_0x79ec('0x10'));var authService=require(_0x79ec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x79ec('0x12'));var hardwareService=require(_0x79ec('0x13'));var logger=require('../../config/logger')(_0x79ec('0x14'));var utils=require(_0x79ec('0x15'));var config=require(_0x79ec('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3885,_0x1ba3ce){_0x1ba3ce=_0x1ba3ce||0xcc;return function(_0x23bfc8){if(_0x23bfc8){return _0x4d3885[_0x79ec('0x17')](_0x1ba3ce);}return _0x4d3885[_0x79ec('0x18')](_0x1ba3ce)[_0x79ec('0x19')]();};}function respondWithResult(_0x3b105a,_0x26f563){_0x26f563=_0x26f563||0xc8;return function(_0x143b53){if(_0x143b53){return _0x3b105a[_0x79ec('0x18')](_0x26f563)[_0x79ec('0x1a')](_0x143b53);}};}function respondWithFilteredResult(_0x43b868,_0xbc94e){return function(_0x14ed13){if(_0x14ed13){var _0x98ae11=typeof _0xbc94e[_0x79ec('0x1b')]===_0x79ec('0x1c')&&typeof _0xbc94e[_0x79ec('0x1d')]===_0x79ec('0x1c');var _0x5479ae=_0x14ed13[_0x79ec('0x1e')];var _0x23ff16=_0x98ae11?0x0:_0xbc94e[_0x79ec('0x1b')];var _0x45d07e=_0x98ae11?_0x14ed13[_0x79ec('0x1e')]:_0xbc94e[_0x79ec('0x1b')]+_0xbc94e[_0x79ec('0x1d')];var _0x1a3347;if(_0x45d07e>=_0x5479ae){_0x45d07e=_0x5479ae;_0x1a3347=0xc8;}else{_0x1a3347=0xce;}_0x43b868[_0x79ec('0x18')](_0x1a3347);return _0x43b868['set'](_0x79ec('0x1f'),_0x23ff16+'-'+_0x45d07e+'/'+_0x5479ae)[_0x79ec('0x1a')](_0x14ed13);}return null;};}function patchUpdates(_0x1ebbce){return function(_0x4811bf){try{jsonpatch[_0x79ec('0x20')](_0x4811bf,_0x1ebbce,!![]);}catch(_0xd77cae){return BPromise[_0x79ec('0x21')](_0xd77cae);}return _0x4811bf[_0x79ec('0x22')]();};}function saveUpdates(_0x1f2015,_0x4fa335){return function(_0x13843b){if(_0x13843b){return _0x13843b[_0x79ec('0x23')](_0x1f2015)[_0x79ec('0x24')](function(_0x221781){return _0x221781;});}return null;};}function removeEntity(_0x3f8c77,_0x504525){return function(_0x10d81f){if(_0x10d81f){return _0x10d81f['destroy']()[_0x79ec('0x24')](function(){var _0x5a1d9d=_0x10d81f[_0x79ec('0x25')]({'plain':!![]});var _0x4ed59b='Variables';return db[_0x79ec('0x26')]['destroy']({'where':{'type':_0x4ed59b,'resourceId':_0x5a1d9d['id']}})['then'](function(){return _0x10d81f;});})[_0x79ec('0x24')](function(){_0x3f8c77[_0x79ec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeed5a8,_0x13aa5d){return function(_0x3f122f){if(!_0x3f122f){_0xeed5a8['sendStatus'](0x194);}return _0x3f122f;};}function handleError(_0x356cd,_0x17aaea){_0x17aaea=_0x17aaea||0x1f4;return function(_0x287eff){logger[_0x79ec('0x27')](_0x287eff[_0x79ec('0x28')]);if(_0x287eff['name']){delete _0x287eff['name'];}_0x356cd[_0x79ec('0x18')](_0x17aaea)[_0x79ec('0x29')](_0x287eff);};}exports[_0x79ec('0x2a')]=function(_0x476f2d,_0x1d9a53){var _0x36159f={},_0x1d85a8={},_0x13ae08={'count':0x0,'rows':[]};var _0x1f300c=_[_0x79ec('0x2b')](db['Variable'][_0x79ec('0x2c')],function(_0x4ca977){return{'name':_0x4ca977[_0x79ec('0x2d')],'type':_0x4ca977[_0x79ec('0x2e')]['key']};});_0x1d85a8[_0x79ec('0x2f')]=_[_0x79ec('0x2b')](_0x1f300c,'name');_0x1d85a8[_0x79ec('0x30')]=_[_0x79ec('0x31')](_0x476f2d[_0x79ec('0x30')]);_0x1d85a8[_0x79ec('0x32')]=_[_0x79ec('0x33')](_0x1d85a8[_0x79ec('0x2f')],_0x1d85a8[_0x79ec('0x30')]);_0x36159f['attributes']=_[_0x79ec('0x33')](_0x1d85a8[_0x79ec('0x2f')],qs[_0x79ec('0x34')](_0x476f2d['query'][_0x79ec('0x34')]));_0x36159f['attributes']=_0x36159f[_0x79ec('0x35')][_0x79ec('0x36')]?_0x36159f['attributes']:_0x1d85a8['model'];if(!_0x476f2d[_0x79ec('0x30')][_0x79ec('0x37')](_0x79ec('0x38'))){_0x36159f['limit']=qs[_0x79ec('0x1d')](_0x476f2d[_0x79ec('0x30')][_0x79ec('0x1d')]);_0x36159f[_0x79ec('0x1b')]=qs[_0x79ec('0x1b')](_0x476f2d[_0x79ec('0x30')][_0x79ec('0x1b')]);}_0x36159f[_0x79ec('0x39')]=qs[_0x79ec('0x3a')](_0x476f2d[_0x79ec('0x30')][_0x79ec('0x3a')]);_0x36159f[_0x79ec('0x3b')]=qs['filters'](_[_0x79ec('0x3c')](_0x476f2d[_0x79ec('0x30')],_0x1d85a8[_0x79ec('0x32')]),_0x1f300c);if(_0x476f2d[_0x79ec('0x30')]['filter']){_0x36159f[_0x79ec('0x3b')]=_[_0x79ec('0x3d')](_0x36159f[_0x79ec('0x3b')],{'$or':_[_0x79ec('0x2b')](_0x1f300c,function(_0x43e378){if(_0x43e378[_0x79ec('0x2e')]!==_0x79ec('0x3e')){var _0x33b420={};_0x33b420[_0x43e378[_0x79ec('0x3f')]]={'$like':'%'+_0x476f2d[_0x79ec('0x30')][_0x79ec('0x40')]+'%'};return _0x33b420;}})});}_0x36159f=_[_0x79ec('0x3d')]({},_0x36159f,_0x476f2d[_0x79ec('0x41')]);var _0x3f0cf6={'where':_0x36159f[_0x79ec('0x3b')]};return db[_0x79ec('0x42')][_0x79ec('0x1e')](_0x3f0cf6)[_0x79ec('0x24')](function(_0x56619f){_0x13ae08[_0x79ec('0x1e')]=_0x56619f;if(_0x476f2d[_0x79ec('0x30')][_0x79ec('0x43')]){_0x36159f['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x36159f);})[_0x79ec('0x24')](function(_0x506964){_0x13ae08[_0x79ec('0x44')]=_0x506964;return _0x13ae08;})['then'](respondWithFilteredResult(_0x1d9a53,_0x36159f))[_0x79ec('0x45')](handleError(_0x1d9a53,null));};exports['show']=function(_0x4fb995,_0x4fcfb3){var _0x543101={'raw':!![],'where':{'id':_0x4fb995[_0x79ec('0x46')]['id']}},_0x31601f={};_0x31601f[_0x79ec('0x2f')]=_[_0x79ec('0x31')](db['Variable']['rawAttributes']);_0x31601f['query']=_[_0x79ec('0x31')](_0x4fb995[_0x79ec('0x30')]);_0x31601f[_0x79ec('0x32')]=_[_0x79ec('0x33')](_0x31601f['model'],_0x31601f[_0x79ec('0x30')]);_0x543101[_0x79ec('0x35')]=_[_0x79ec('0x33')](_0x31601f['model'],qs[_0x79ec('0x34')](_0x4fb995[_0x79ec('0x30')][_0x79ec('0x34')]));_0x543101[_0x79ec('0x35')]=_0x543101[_0x79ec('0x35')]['length']?_0x543101[_0x79ec('0x35')]:_0x31601f[_0x79ec('0x2f')];if(_0x4fb995[_0x79ec('0x30')][_0x79ec('0x43')]){_0x543101['include']=[{'all':!![]}];}_0x543101=_[_0x79ec('0x3d')]({},_0x543101,_0x4fb995[_0x79ec('0x41')]);return db[_0x79ec('0x42')][_0x79ec('0x47')](_0x543101)[_0x79ec('0x24')](handleEntityNotFound(_0x4fcfb3,null))['then'](respondWithResult(_0x4fcfb3,null))[_0x79ec('0x45')](handleError(_0x4fcfb3,null));};exports[_0x79ec('0x48')]=function(_0x51e921,_0x2b61d7){return db[_0x79ec('0x42')][_0x79ec('0x48')](_0x51e921[_0x79ec('0x49')],{})[_0x79ec('0x24')](function(_0x2241da){var _0x5d2f5d=_0x51e921[_0x79ec('0x4a')][_0x79ec('0x25')]({'plain':!![]});if(!_0x5d2f5d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d2f5d[_0x79ec('0x4b')]==='user'){var _0x2f819e=_0x2241da[_0x79ec('0x25')]({'plain':!![]});var _0x1a9d54=_0x79ec('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x1a9d54,'userProfileId':_0x5d2f5d[_0x79ec('0x4d')]},'raw':!![]})[_0x79ec('0x24')](function(_0x3848ed){if(_0x3848ed&&_0x3848ed[_0x79ec('0x4e')]===0x0){return db[_0x79ec('0x26')][_0x79ec('0x48')]({'name':_0x2f819e['name'],'resourceId':_0x2f819e['id'],'type':_0x3848ed[_0x79ec('0x3f')],'sectionId':_0x3848ed['id']},{})[_0x79ec('0x24')](function(){return _0x2241da;});}else{return _0x2241da;}})[_0x79ec('0x45')](function(_0x59a471){logger[_0x79ec('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a471);throw _0x59a471;});}return _0x2241da;})[_0x79ec('0x24')](respondWithResult(_0x2b61d7,0xc9))[_0x79ec('0x45')](handleError(_0x2b61d7,null));};exports[_0x79ec('0x23')]=function(_0x45f24a,_0x16bcb0){if(_0x45f24a[_0x79ec('0x49')]['id']){delete _0x45f24a['body']['id'];}return db[_0x79ec('0x42')][_0x79ec('0x47')]({'where':{'id':_0x45f24a[_0x79ec('0x46')]['id']}})[_0x79ec('0x24')](handleEntityNotFound(_0x16bcb0,null))['then'](saveUpdates(_0x45f24a[_0x79ec('0x49')],null))[_0x79ec('0x24')](respondWithResult(_0x16bcb0,null))[_0x79ec('0x45')](handleError(_0x16bcb0,null));};exports[_0x79ec('0x4f')]=function(_0x3e7f2f,_0x39d31c){return db[_0x79ec('0x42')][_0x79ec('0x47')]({'where':{'id':_0x3e7f2f[_0x79ec('0x46')]['id']}})[_0x79ec('0x24')](handleEntityNotFound(_0x39d31c,null))[_0x79ec('0x24')](removeEntity(_0x39d31c,null))[_0x79ec('0x45')](handleError(_0x39d31c,null));}; \ No newline at end of file +var _0x77c9=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','end','error','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1e474c,_0x35e2cb){var _0x4a769f=function(_0x3cf8b5){while(--_0x3cf8b5){_0x1e474c['push'](_0x1e474c['shift']());}};_0x4a769f(++_0x35e2cb);}(_0x77c9,0x157));var _0x977c=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0x77c9[_0x13f9c3];return _0x22185a;};'use strict';var emlformat=require(_0x977c('0x0'));var rimraf=require(_0x977c('0x1'));var zipdir=require(_0x977c('0x2'));var jsonpatch=require(_0x977c('0x3'));var rp=require(_0x977c('0x4'));var moment=require(_0x977c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x977c('0x6'));var util=require(_0x977c('0x7'));var path=require(_0x977c('0x8'));var sox=require(_0x977c('0x9'));var csv=require(_0x977c('0xa'));var ejs=require(_0x977c('0xb'));var fs=require('fs');var fs_extra=require(_0x977c('0xc'));var _=require('lodash');var squel=require(_0x977c('0xd'));var crypto=require(_0x977c('0xe'));var jsforce=require(_0x977c('0xf'));var deskjs=require(_0x977c('0x10'));var toCsv=require(_0x977c('0xa'));var querystring=require(_0x977c('0x11'));var Papa=require('papaparse');var Redis=require(_0x977c('0x12'));var authService=require(_0x977c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x977c('0x14'));var hardwareService=require(_0x977c('0x15'));var logger=require(_0x977c('0x16'))('api');var utils=require(_0x977c('0x17'));var config=require(_0x977c('0x18'));var licenseUtil=require(_0x977c('0x19'));var db=require(_0x977c('0x1a'))['db'];function respondWithStatusCode(_0x5920dc,_0x8f4787){_0x8f4787=_0x8f4787||0xcc;return function(_0x436ff7){if(_0x436ff7){return _0x5920dc['sendStatus'](_0x8f4787);}return _0x5920dc[_0x977c('0x1b')](_0x8f4787)['end']();};}function respondWithResult(_0x22e1ca,_0x16fbeb){_0x16fbeb=_0x16fbeb||0xc8;return function(_0x6803dc){if(_0x6803dc){return _0x22e1ca['status'](_0x16fbeb)[_0x977c('0x1c')](_0x6803dc);}};}function respondWithFilteredResult(_0x4920f2,_0x10bb6c){return function(_0x2ca5a7){if(_0x2ca5a7){var _0x4c90a8=typeof _0x10bb6c[_0x977c('0x1d')]===_0x977c('0x1e')&&typeof _0x10bb6c['limit']==='undefined';var _0x5def89=_0x2ca5a7[_0x977c('0x1f')];var _0x37412c=_0x4c90a8?0x0:_0x10bb6c['offset'];var _0x229c25=_0x4c90a8?_0x2ca5a7[_0x977c('0x1f')]:_0x10bb6c[_0x977c('0x1d')]+_0x10bb6c['limit'];var _0x231a08;if(_0x229c25>=_0x5def89){_0x229c25=_0x5def89;_0x231a08=0xc8;}else{_0x231a08=0xce;}_0x4920f2[_0x977c('0x1b')](_0x231a08);return _0x4920f2[_0x977c('0x20')](_0x977c('0x21'),_0x37412c+'-'+_0x229c25+'/'+_0x5def89)[_0x977c('0x1c')](_0x2ca5a7);}return null;};}function patchUpdates(_0x55876b){return function(_0x15b10a){try{jsonpatch[_0x977c('0x22')](_0x15b10a,_0x55876b,!![]);}catch(_0x56b1fa){return BPromise[_0x977c('0x23')](_0x56b1fa);}return _0x15b10a[_0x977c('0x24')]();};}function saveUpdates(_0x3aa933,_0x20fc35){return function(_0x5d0fb0){if(_0x5d0fb0){return _0x5d0fb0[_0x977c('0x25')](_0x3aa933)[_0x977c('0x26')](function(_0x16a735){return _0x16a735;});}return null;};}function removeEntity(_0x49ded6,_0xe4d544){return function(_0x46af8a){if(_0x46af8a){return _0x46af8a[_0x977c('0x27')]()[_0x977c('0x26')](function(){var _0x5f3ee2=_0x46af8a[_0x977c('0x28')]({'plain':!![]});var _0x52b2b9=_0x977c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x52b2b9,'resourceId':_0x5f3ee2['id']}})['then'](function(){return _0x46af8a;});})['then'](function(){_0x49ded6[_0x977c('0x1b')](0xcc)[_0x977c('0x2a')]();});}};}function handleEntityNotFound(_0x80d899,_0x1c9263){return function(_0x1fe6e3){if(!_0x1fe6e3){_0x80d899['sendStatus'](0x194);}return _0x1fe6e3;};}function handleError(_0x206dde,_0x4449d1){_0x4449d1=_0x4449d1||0x1f4;return function(_0x2996a2){logger[_0x977c('0x2b')](_0x2996a2[_0x977c('0x2c')]);if(_0x2996a2[_0x977c('0x2d')]){delete _0x2996a2['name'];}_0x206dde['status'](_0x4449d1)[_0x977c('0x2e')](_0x2996a2);};}exports['index']=function(_0x15ef4e,_0x1f6c6a){var _0x42c310={},_0x11c582={},_0x50d677={'count':0x0,'rows':[]};var _0x10e999=_[_0x977c('0x2f')](db[_0x977c('0x30')][_0x977c('0x31')],function(_0x47b4e2){return{'name':_0x47b4e2[_0x977c('0x32')],'type':_0x47b4e2[_0x977c('0x33')][_0x977c('0x34')]};});_0x11c582[_0x977c('0x35')]=_[_0x977c('0x2f')](_0x10e999,_0x977c('0x2d'));_0x11c582[_0x977c('0x36')]=_['keys'](_0x15ef4e[_0x977c('0x36')]);_0x11c582[_0x977c('0x37')]=_[_0x977c('0x38')](_0x11c582[_0x977c('0x35')],_0x11c582[_0x977c('0x36')]);_0x42c310[_0x977c('0x39')]=_[_0x977c('0x38')](_0x11c582[_0x977c('0x35')],qs[_0x977c('0x3a')](_0x15ef4e[_0x977c('0x36')][_0x977c('0x3a')]));_0x42c310[_0x977c('0x39')]=_0x42c310[_0x977c('0x39')][_0x977c('0x3b')]?_0x42c310['attributes']:_0x11c582[_0x977c('0x35')];if(!_0x15ef4e[_0x977c('0x36')]['hasOwnProperty'](_0x977c('0x3c'))){_0x42c310['limit']=qs[_0x977c('0x3d')](_0x15ef4e[_0x977c('0x36')][_0x977c('0x3d')]);_0x42c310[_0x977c('0x1d')]=qs[_0x977c('0x1d')](_0x15ef4e[_0x977c('0x36')]['offset']);}_0x42c310[_0x977c('0x3e')]=qs[_0x977c('0x3f')](_0x15ef4e[_0x977c('0x36')][_0x977c('0x3f')]);_0x42c310[_0x977c('0x40')]=qs[_0x977c('0x37')](_[_0x977c('0x41')](_0x15ef4e[_0x977c('0x36')],_0x11c582[_0x977c('0x37')]),_0x10e999);if(_0x15ef4e[_0x977c('0x36')][_0x977c('0x42')]){_0x42c310[_0x977c('0x40')]=_[_0x977c('0x43')](_0x42c310['where'],{'$or':_['map'](_0x10e999,function(_0xc3501e){if(_0xc3501e['type']!==_0x977c('0x44')){var _0x26f38a={};_0x26f38a[_0xc3501e[_0x977c('0x2d')]]={'$like':'%'+_0x15ef4e[_0x977c('0x36')][_0x977c('0x42')]+'%'};return _0x26f38a;}})});}_0x42c310=_[_0x977c('0x43')]({},_0x42c310,_0x15ef4e[_0x977c('0x45')]);var _0x4b1968={'where':_0x42c310[_0x977c('0x40')]};return db[_0x977c('0x30')]['count'](_0x4b1968)[_0x977c('0x26')](function(_0x2d5b5a){_0x50d677[_0x977c('0x1f')]=_0x2d5b5a;if(_0x15ef4e[_0x977c('0x36')]['includeAll']){_0x42c310[_0x977c('0x46')]=[{'all':!![]}];}return db['Variable'][_0x977c('0x47')](_0x42c310);})['then'](function(_0x2684bd){_0x50d677[_0x977c('0x48')]=_0x2684bd;return _0x50d677;})[_0x977c('0x26')](respondWithFilteredResult(_0x1f6c6a,_0x42c310))['catch'](handleError(_0x1f6c6a,null));};exports[_0x977c('0x49')]=function(_0x2915d0,_0x19e90c){var _0x5a22ad={'raw':!![],'where':{'id':_0x2915d0[_0x977c('0x4a')]['id']}},_0x2b9256={};_0x2b9256[_0x977c('0x35')]=_['keys'](db[_0x977c('0x30')][_0x977c('0x31')]);_0x2b9256[_0x977c('0x36')]=_['keys'](_0x2915d0[_0x977c('0x36')]);_0x2b9256[_0x977c('0x37')]=_['intersection'](_0x2b9256[_0x977c('0x35')],_0x2b9256['query']);_0x5a22ad[_0x977c('0x39')]=_[_0x977c('0x38')](_0x2b9256[_0x977c('0x35')],qs[_0x977c('0x3a')](_0x2915d0['query'][_0x977c('0x3a')]));_0x5a22ad[_0x977c('0x39')]=_0x5a22ad[_0x977c('0x39')][_0x977c('0x3b')]?_0x5a22ad[_0x977c('0x39')]:_0x2b9256['model'];if(_0x2915d0[_0x977c('0x36')][_0x977c('0x4b')]){_0x5a22ad[_0x977c('0x46')]=[{'all':!![]}];}_0x5a22ad=_[_0x977c('0x43')]({},_0x5a22ad,_0x2915d0[_0x977c('0x45')]);return db[_0x977c('0x30')]['find'](_0x5a22ad)[_0x977c('0x26')](handleEntityNotFound(_0x19e90c,null))[_0x977c('0x26')](respondWithResult(_0x19e90c,null))[_0x977c('0x4c')](handleError(_0x19e90c,null));};exports[_0x977c('0x4d')]=function(_0x1933d7,_0x5725f1){return db[_0x977c('0x30')][_0x977c('0x4d')](_0x1933d7[_0x977c('0x4e')],{})[_0x977c('0x26')](function(_0xf2883c){var _0x7a5661=_0x1933d7[_0x977c('0x4f')]['get']({'plain':!![]});if(!_0x7a5661)throw new Error(_0x977c('0x50'));if(_0x7a5661[_0x977c('0x51')]===_0x977c('0x4f')){var _0xcf49b3=_0xf2883c[_0x977c('0x28')]({'plain':!![]});var _0x304211=_0x977c('0x29');return db[_0x977c('0x52')][_0x977c('0x53')]({'where':{'name':_0x304211,'userProfileId':_0x7a5661[_0x977c('0x54')]},'raw':!![]})[_0x977c('0x26')](function(_0x28ce83){if(_0x28ce83&&_0x28ce83[_0x977c('0x55')]===0x0){return db['UserProfileResource'][_0x977c('0x4d')]({'name':_0xcf49b3[_0x977c('0x2d')],'resourceId':_0xcf49b3['id'],'type':_0x28ce83['name'],'sectionId':_0x28ce83['id']},{})[_0x977c('0x26')](function(){return _0xf2883c;});}else{return _0xf2883c;}})[_0x977c('0x4c')](function(_0x31c60c){logger[_0x977c('0x2b')](_0x977c('0x56'),_0x31c60c);throw _0x31c60c;});}return _0xf2883c;})[_0x977c('0x26')](respondWithResult(_0x5725f1,0xc9))[_0x977c('0x4c')](handleError(_0x5725f1,null));};exports[_0x977c('0x25')]=function(_0x556738,_0x52b480){if(_0x556738['body']['id']){delete _0x556738['body']['id'];}return db[_0x977c('0x30')]['find']({'where':{'id':_0x556738[_0x977c('0x4a')]['id']}})[_0x977c('0x26')](handleEntityNotFound(_0x52b480,null))[_0x977c('0x26')](saveUpdates(_0x556738[_0x977c('0x4e')],null))[_0x977c('0x26')](respondWithResult(_0x52b480,null))[_0x977c('0x4c')](handleError(_0x52b480,null));};exports[_0x977c('0x27')]=function(_0x343f3f,_0x7e39a6){return db[_0x977c('0x30')][_0x977c('0x53')]({'where':{'id':_0x343f3f[_0x977c('0x4a')]['id']}})[_0x977c('0x26')](handleEntityNotFound(_0x7e39a6,null))[_0x977c('0x26')](removeEntity(_0x7e39a6,null))[_0x977c('0x4c')](handleError(_0x7e39a6,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8490c4a..6e1b31a 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 _0x6ec8=['moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','util','api'];(function(_0x4f9153,_0x16fd7c){var _0x8fb221=function(_0x9cadc3){while(--_0x9cadc3){_0x4f9153['push'](_0x4f9153['shift']());}};_0x8fb221(++_0x16fd7c);}(_0x6ec8,0x18a));var _0x86ec=function(_0x2383f7,_0x53e3ca){_0x2383f7=_0x2383f7-0x0;var _0x1432c6=_0x6ec8[_0x2383f7];return _0x1432c6;};'use strict';var _=require('lodash');var util=require(_0x86ec('0x0'));var logger=require('../../config/logger')(_0x86ec('0x1'));var moment=require(_0x86ec('0x2'));var BPromise=require(_0x86ec('0x3'));var rp=require(_0x86ec('0x4'));var fs=require('fs');var path=require(_0x86ec('0x5'));var rimraf=require(_0x86ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x86ec('0x7'));module[_0x86ec('0x8')]=function(_0x1091da,_0x2c4e9d){return _0x1091da['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24f5=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./variable.attributes','exports','tools_variables'];(function(_0x34ee9b,_0xdc9664){var _0x624d21=function(_0x140348){while(--_0x140348){_0x34ee9b['push'](_0x34ee9b['shift']());}};_0x624d21(++_0xdc9664);}(_0x24f5,0x118));var _0x524f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24f5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x524f('0x0'));var util=require(_0x524f('0x1'));var logger=require(_0x524f('0x2'))(_0x524f('0x3'));var moment=require(_0x524f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x524f('0x5'));var rimraf=require('rimraf');var config=require(_0x524f('0x6'));var attributes=require(_0x524f('0x7'));module[_0x524f('0x8')]=function(_0x413c0c,_0xd1f3c2){return _0x413c0c['define']('Variable',attributes,{'tableName':_0x524f('0x9'),'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 61f72d2..4453a28 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x3cf50b,_0xc1ca3){var _0x173bbb=function(_0x58f159){while(--_0x58f159){_0x3cf50b['push'](_0x3cf50b['shift']());}};_0x173bbb(++_0xc1ca3);}(_0x814b,0x1a2));var _0xb814=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x814b[_0xa8b370];return _0x643e37;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0xf6ba77,_0x18dc5f){var _0x1f8fb6=function(_0x3ffe6a){while(--_0x3ffe6a){_0xf6ba77['push'](_0xf6ba77['shift']());}};_0x1f8fb6(++_0x18dc5f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 70b5a30..aa84648 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 _0x3051=['get','/fetch','canUpdate','fetch','/reset','isAuthenticated','pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','./version.controller','index'];(function(_0x4739dd,_0x3bdde8){var _0x56d8fe=function(_0x4a6411){while(--_0x4a6411){_0x4739dd['push'](_0x4739dd['shift']());}};_0x56d8fe(++_0x3bdde8);}(_0x3051,0x191));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express[_0x1305('0x0')]();var auth=require(_0x1305('0x1'));var controller=require(_0x1305('0x2'));router['get']('/',controller[_0x1305('0x3')]);router[_0x1305('0x4')](_0x1305('0x5'),auth['isAuthenticated'](),auth[_0x1305('0x6')](),controller[_0x1305('0x7')]);router[_0x1305('0x4')](_0x1305('0x8'),auth[_0x1305('0x9')](),auth[_0x1305('0x6')](),controller['reset']);router['get']('/pull',auth[_0x1305('0x9')](),auth[_0x1305('0x6')](),controller[_0x1305('0xa')]);router[_0x1305('0x4')](_0x1305('0xb'),auth[_0x1305('0x9')](),controller[_0x1305('0xc')]);router[_0x1305('0x4')](_0x1305('0xd'),controller['migrations']);module[_0x1305('0xe')]=router; \ No newline at end of file +var _0xac00=['/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x4d137f,_0x4cf4fa){var _0x308a9e=function(_0x2944dd){while(--_0x2944dd){_0x4d137f['push'](_0x4d137f['shift']());}};_0x308a9e(++_0x4cf4fa);}(_0xac00,0x10a));var _0x0ac0=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0xac00[_0x477491];return _0xac6aec;};'use strict';var express=require(_0x0ac0('0x0'));var router=express[_0x0ac0('0x1')]();var auth=require(_0x0ac0('0x2'));var controller=require(_0x0ac0('0x3'));router[_0x0ac0('0x4')]('/',controller[_0x0ac0('0x5')]);router[_0x0ac0('0x4')](_0x0ac0('0x6'),auth[_0x0ac0('0x7')](),auth['canUpdate'](),controller[_0x0ac0('0x8')]);router['get'](_0x0ac0('0x9'),auth[_0x0ac0('0x7')](),auth[_0x0ac0('0xa')](),controller[_0x0ac0('0xb')]);router[_0x0ac0('0x4')](_0x0ac0('0xc'),auth[_0x0ac0('0x7')](),auth['canUpdate'](),controller[_0x0ac0('0xd')]);router[_0x0ac0('0x4')](_0x0ac0('0xe'),auth[_0x0ac0('0x7')](),controller['restart']);router['get'](_0x0ac0('0xf'),controller[_0x0ac0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index cb33ab4..36d7104 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 _0x3b54=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','.js','length','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.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','umzug','pkginfo','version','compare-versions','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info'];(function(_0x494460,_0x4258c7){var _0x2c153c=function(_0x3bf250){while(--_0x3bf250){_0x494460['push'](_0x494460['shift']());}};_0x2c153c(++_0x4258c7);}(_0x3b54,0x183));var _0x43b5=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x3b54[_0xfed299];return _0x4ef1f2;};'use strict';var Umzug=require(_0x43b5('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x43b5('0x1'))(module,_0x43b5('0x2'));var compareVersions=require(_0x43b5('0x3'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x43b5('0x4'));var pm2=require(_0x43b5('0x5'));var logger=require('../../config/logger')(_0x43b5('0x6'));var git=require(_0x43b5('0x7'))(config[_0x43b5('0x8')]);exports[_0x43b5('0x9')]=function(_0x571c86,_0x11a898){var _0x378263={'current':module[_0x43b5('0xa')][_0x43b5('0x2')],'phonebar':0x2};if(_0x571c86[_0x43b5('0xb')]&&_0x571c86['query'][_0x43b5('0xc')]){return git[_0x43b5('0xd')]()['tags'](function(_0x1e31b0,_0x34afcf){_0x378263['latest']=(_0x1e31b0?module[_0x43b5('0xa')][_0x43b5('0x2')]:_0x34afcf['latest'])||_0x43b5('0xe');return _0x11a898[_0x43b5('0xf')](0xc8)['json'](_0x378263);});}else{return _0x11a898[_0x43b5('0xf')](0xc8)[_0x43b5('0x10')](_0x378263);}};exports[_0x43b5('0xd')]=function(_0x2666ea,_0x866e66){return git[_0x43b5('0xd')]([_0x43b5('0x11'),_0x43b5('0x12')],function(_0x5da517){if(_0x5da517){logger[_0x43b5('0x13')](_0x5da517);return _0x866e66[_0x43b5('0xf')](0x1f4)[_0x43b5('0x10')](_0x5da517);}logger[_0x43b5('0x14')](_0x43b5('0x15'));return _0x866e66[_0x43b5('0xf')](0xc8)[_0x43b5('0x10')]({'output':_0x43b5('0x16')});});};exports[_0x43b5('0x17')]=function(_0x57516d,_0x5af3c8){return git[_0x43b5('0x17')]([_0x43b5('0x18'),_0x43b5('0x19')],function(_0x12e215){if(_0x12e215){logger['error'](_0x12e215);return _0x5af3c8[_0x43b5('0xf')](0x1f4)[_0x43b5('0x10')](_0x12e215);}logger[_0x43b5('0x14')](_0x43b5('0x1a'));return _0x5af3c8[_0x43b5('0xf')](0xc8)[_0x43b5('0x10')]({'output':_0x43b5('0x1b')});});};exports[_0x43b5('0x1c')]=function(_0x407604,_0x1caf3b){exec('npm\x20install\x20--production',function(_0x140a49,_0x3ae20c,_0x4717fc){logger[_0x43b5('0x14')](_0x3ae20c);logger[_0x43b5('0x14')](_0x4717fc);if(_0x140a49){logger[_0x43b5('0x13')](_0x140a49);return _0x1caf3b[_0x43b5('0xf')](0x1f4)[_0x43b5('0x10')](_0x140a49);}return _0x1caf3b['status'](0xc8)[_0x43b5('0x10')]({'output':_0x3ae20c});});};exports[_0x43b5('0x1d')]=function(_0x400540,_0x4d77c1){return pm2[_0x43b5('0x1d')](_0x43b5('0x1e'))[_0x43b5('0x1f')](function(_0x58b6b0){logger[_0x43b5('0x14')](_0x43b5('0x20'),_0x58b6b0);return _0x4d77c1['status'](0xc8)['json']({'output':_0x43b5('0x21')});})[_0x43b5('0x22')](function(_0x5156b3){logger[_0x43b5('0x13')](_0x5156b3);return _0x4d77c1[_0x43b5('0xf')](0x1f4)['json'](_0x5156b3);});};exports[_0x43b5('0x23')]=function(_0x539a60,_0x6b3d05){var _0x4cb8cf=fs[_0x43b5('0x24')](path[_0x43b5('0x25')](config[_0x43b5('0x8')],_0x43b5('0x26'),'migrations'));var _0x3a599c=[];for(var _0x189d41=0x0;_0x189d41<_0x4cb8cf['length'];_0x189d41++){var _0x14feff=_0x4cb8cf[_0x189d41]['replace'](_0x43b5('0x27'),'');if(compareVersions(module[_0x43b5('0xa')]['version'],_0x14feff)===-0x1){_0x3a599c['push'](_0x14feff);}}if(_0x3a599c[_0x43b5('0x28')]){var _0x57e4fe=_0x3a599c[_0x43b5('0x29')](compareVersions);var _0x35c6e2=new Umzug({'storage':_0x43b5('0x2a'),'storageOptions':{'model':db[_0x43b5('0x2b')],'modelName':_0x43b5('0x2b'),'columnName':_0x43b5('0x2')},'migrations':{'params':[db[_0x43b5('0x2a')][_0x43b5('0x2c')](),db['sequelize'][_0x43b5('0x2d')],function(){throw new Error(_0x43b5('0x2e'));}],'path':path['join'](config[_0x43b5('0x8')],'server',_0x43b5('0x23')),'pattern':/\.js$/}});_0x35c6e2['up']({'migrations':_['map'](_0x57e4fe,function(_0x4d99d0){return _0x4d99d0+_0x43b5('0x27');})})['then'](function(){return _0x6b3d05['status'](0xc8)['json']({'output':_0x43b5('0x2f')+module[_0x43b5('0xa')][_0x43b5('0x2')]+_0x43b5('0x30')+_[_0x43b5('0x31')](_0x57e4fe),'migrations':_[_0x43b5('0x25')](_0x57e4fe)});})[_0x43b5('0x22')](function(_0x2fd27f){if(_0x2fd27f instanceof db[_0x43b5('0x2a')][_0x43b5('0x32')]){return _0x6b3d05[_0x43b5('0xf')](0xc8)[_0x43b5('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x6b3d05[_0x43b5('0xf')](0x1f4)[_0x43b5('0x10')](_0x2fd27f);}});}else{return _0x6b3d05['status'](0xc8)[_0x43b5('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xdec2=['Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','push','sort','sequelize'];(function(_0x29f608,_0x2c7f0f){var _0x291680=function(_0x33d44c){while(--_0x33d44c){_0x29f608['push'](_0x29f608['shift']());}};_0x291680(++_0x2c7f0f);}(_0xdec2,0xe5));var _0x2dec=function(_0x268a1e,_0x544592){_0x268a1e=_0x268a1e-0x0;var _0x11d6a0=_0xdec2[_0x268a1e];return _0x11d6a0;};'use strict';var Umzug=require(_0x2dec('0x0'));var path=require(_0x2dec('0x1'));var fs=require('fs');var _=require(_0x2dec('0x2'));var pkginfo=require(_0x2dec('0x3'))(module,_0x2dec('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x2dec('0x5'))[_0x2dec('0x6')];var db=require(_0x2dec('0x7'))['db'];var config=require(_0x2dec('0x8'));var pm2=require(_0x2dec('0x9'));var logger=require(_0x2dec('0xa'))('update');var git=require(_0x2dec('0xb'))(config[_0x2dec('0xc')]);exports['index']=function(_0x271646,_0x375637){var _0x168bf2={'current':module['exports'][_0x2dec('0x4')],'phonebar':0x2};if(_0x271646[_0x2dec('0xd')]&&_0x271646[_0x2dec('0xd')][_0x2dec('0xe')]){return git[_0x2dec('0xf')]()[_0x2dec('0x10')](function(_0x18d9f2,_0x508502){_0x168bf2[_0x2dec('0xe')]=(_0x18d9f2?module[_0x2dec('0x11')][_0x2dec('0x4')]:_0x508502[_0x2dec('0xe')])||_0x2dec('0x12');return _0x375637[_0x2dec('0x13')](0xc8)['json'](_0x168bf2);});}else{return _0x375637[_0x2dec('0x13')](0xc8)[_0x2dec('0x14')](_0x168bf2);}};exports[_0x2dec('0xf')]=function(_0x5e503a,_0x4d6a04){return git[_0x2dec('0xf')]([_0x2dec('0x15'),_0x2dec('0x16')],function(_0x539444){if(_0x539444){logger[_0x2dec('0x17')](_0x539444);return _0x4d6a04[_0x2dec('0x13')](0x1f4)[_0x2dec('0x14')](_0x539444);}logger[_0x2dec('0x18')](_0x2dec('0x19'));return _0x4d6a04[_0x2dec('0x13')](0xc8)['json']({'output':_0x2dec('0x1a')});});};exports[_0x2dec('0x1b')]=function(_0x47ff39,_0x6a53cf){return git[_0x2dec('0x1b')]([_0x2dec('0x1c'),_0x2dec('0x1d')],function(_0x2e08a9){if(_0x2e08a9){logger[_0x2dec('0x17')](_0x2e08a9);return _0x6a53cf['status'](0x1f4)[_0x2dec('0x14')](_0x2e08a9);}logger[_0x2dec('0x18')](_0x2dec('0x1e'));return _0x6a53cf[_0x2dec('0x13')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x2dec('0x1f')]=function(_0xbee04f,_0x389a12){exec(_0x2dec('0x20'),function(_0x2b476b,_0x45326c,_0x1356a3){logger[_0x2dec('0x18')](_0x45326c);logger['info'](_0x1356a3);if(_0x2b476b){logger[_0x2dec('0x17')](_0x2b476b);return _0x389a12['status'](0x1f4)[_0x2dec('0x14')](_0x2b476b);}return _0x389a12[_0x2dec('0x13')](0xc8)['json']({'output':_0x45326c});});};exports[_0x2dec('0x21')]=function(_0x212f73,_0x69609c){return pm2['restart'](_0x2dec('0x22'))['then'](function(_0x44f64f){logger['info'](_0x2dec('0x23'),_0x44f64f);return _0x69609c['status'](0xc8)['json']({'output':_0x2dec('0x24')});})[_0x2dec('0x25')](function(_0x1ace2a){logger[_0x2dec('0x17')](_0x1ace2a);return _0x69609c[_0x2dec('0x13')](0x1f4)[_0x2dec('0x14')](_0x1ace2a);});};exports[_0x2dec('0x26')]=function(_0x1417e6,_0xbeb615){var _0x5d3ab5=fs['readdirSync'](path[_0x2dec('0x27')](config[_0x2dec('0xc')],'server',_0x2dec('0x26')));var _0x30303a=[];for(var _0x509e4b=0x0;_0x509e4b<_0x5d3ab5[_0x2dec('0x28')];_0x509e4b++){var _0x3e41af=_0x5d3ab5[_0x509e4b][_0x2dec('0x29')](_0x2dec('0x2a'),'');if(compareVersions(module['exports']['version'],_0x3e41af)===-0x1){_0x30303a[_0x2dec('0x2b')](_0x3e41af);}}if(_0x30303a[_0x2dec('0x28')]){var _0x5f2a34=_0x30303a[_0x2dec('0x2c')](compareVersions);var _0x39062e=new Umzug({'storage':_0x2dec('0x2d'),'storageOptions':{'model':db[_0x2dec('0x2e')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db['sequelize'][_0x2dec('0x2f')](),db[_0x2dec('0x2d')][_0x2dec('0x30')],function(){throw new Error(_0x2dec('0x31'));}],'path':path[_0x2dec('0x27')](config[_0x2dec('0xc')],_0x2dec('0x32'),_0x2dec('0x26')),'pattern':/\.js$/}});_0x39062e['up']({'migrations':_[_0x2dec('0x33')](_0x5f2a34,function(_0x180af5){return _0x180af5+_0x2dec('0x2a');})})['then'](function(){return _0xbeb615['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x2dec('0x4')]+_0x2dec('0x34')+_['last'](_0x5f2a34),'migrations':_[_0x2dec('0x27')](_0x5f2a34)});})[_0x2dec('0x25')](function(_0x32087a){if(_0x32087a instanceof db[_0x2dec('0x2d')][_0x2dec('0x35')]){return _0xbeb615[_0x2dec('0x13')](0xc8)[_0x2dec('0x14')]({'output':_0x2dec('0x36')});}else{return _0xbeb615[_0x2dec('0x13')](0x1f4)[_0x2dec('0x14')](_0x32087a);}});}else{return _0xbeb615[_0x2dec('0x13')](0xc8)[_0x2dec('0x14')]({'output':_0x2dec('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 8188c10..8e38d4d 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 _0x1af6=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x4f53a6,_0x582ff5){var _0x30e4b7=function(_0x1aaf04){while(--_0x1aaf04){_0x4f53a6['push'](_0x4f53a6['shift']());}};_0x30e4b7(++_0x582ff5);}(_0x1af6,0x199));var _0x61af=function(_0x435d55,_0x31b5ad){_0x435d55=_0x435d55-0x0;var _0x160bf5=_0x1af6[_0x435d55];return _0x160bf5;};'use strict';var multer=require(_0x61af('0x0'));var util=require(_0x61af('0x1'));var path=require('path');var timeout=require(_0x61af('0x2'));var express=require(_0x61af('0x3'));var router=express[_0x61af('0x4')]();var fs_extra=require(_0x61af('0x5'));var auth=require(_0x61af('0x6'));var interaction=require(_0x61af('0x7'));var config=require(_0x61af('0x8'));var controller=require(_0x61af('0x9'));router[_0x61af('0xa')]('/',auth[_0x61af('0xb')](),controller[_0x61af('0xc')]);router['get']('/describe',auth[_0x61af('0xb')](),controller['describe']);router[_0x61af('0xa')](_0x61af('0xd'),auth[_0x61af('0xb')](),controller[_0x61af('0xe')]);router[_0x61af('0xf')]('/',auth[_0x61af('0xb')](),controller[_0x61af('0x10')]);router[_0x61af('0x11')](_0x61af('0xd'),auth[_0x61af('0xb')](),controller[_0x61af('0x12')]);router[_0x61af('0x13')](_0x61af('0xd'),auth[_0x61af('0xb')](),controller['destroy']);module[_0x61af('0x14')]=router; \ No newline at end of file +var _0xa752=['Router','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xa752,0x13f));var _0x2a75=function(_0x1aa47f,_0x7b6850){_0x1aa47f=_0x1aa47f-0x0;var _0xbf1070=_0xa752[_0x1aa47f];return _0xbf1070;};'use strict';var multer=require(_0x2a75('0x0'));var util=require(_0x2a75('0x1'));var path=require('path');var timeout=require(_0x2a75('0x2'));var express=require(_0x2a75('0x3'));var router=express[_0x2a75('0x4')]();var fs_extra=require(_0x2a75('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2a75('0x6'));var config=require('../../config/environment');var controller=require(_0x2a75('0x7'));router['get']('/',auth[_0x2a75('0x8')](),controller['index']);router[_0x2a75('0x9')](_0x2a75('0xa'),auth[_0x2a75('0x8')](),controller[_0x2a75('0xb')]);router[_0x2a75('0x9')](_0x2a75('0xc'),auth[_0x2a75('0x8')](),controller[_0x2a75('0xd')]);router[_0x2a75('0xe')]('/',auth[_0x2a75('0x8')](),controller['create']);router[_0x2a75('0xf')](_0x2a75('0xc'),auth[_0x2a75('0x8')](),controller[_0x2a75('0x10')]);router['delete']('/:id',auth[_0x2a75('0x8')](),controller[_0x2a75('0x11')]);module[_0x2a75('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 213163c..f162bb7 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 _0x9f0e=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x2e7724,_0x150f28){var _0x3d541e=function(_0x4b27fe){while(--_0x4b27fe){_0x2e7724['push'](_0x2e7724['shift']());}};_0x3d541e(++_0x150f28);}(_0x9f0e,0x116));var _0xe9f0=function(_0x24e324,_0x39268a){_0x24e324=_0x24e324-0x0;var _0xd62511=_0x9f0e[_0x24e324];return _0xd62511;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'type':{'type':Sequelize[_0xe9f0('0x2')]},'uniqueid':{'type':Sequelize[_0xe9f0('0x2')]},'calleridnum':{'type':Sequelize[_0xe9f0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe9f0('0x2')]},'membername':{'type':Sequelize[_0xe9f0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe9f0('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe9f0('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe9f0('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xe9f0('0x4')]},'agentcomplete':{'type':Sequelize[_0xe9f0('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe9f0('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe9f0('0x4')]},'agentacw':{'type':Sequelize[_0xe9f0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe9f0('0x4')]},'reason':{'type':Sequelize[_0xe9f0('0x2')]},'lastevent':{'type':Sequelize[_0xe9f0('0x2')]},'channel':{'type':Sequelize[_0xe9f0('0x2')]},'channelstate':{'type':Sequelize[_0xe9f0('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe9f0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe9f0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe9f0('0x2')]},'accountcode':{'type':Sequelize[_0xe9f0('0x2')]},'context':{'type':Sequelize[_0xe9f0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe9f0('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe9f0('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xe9f0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe9f0('0x2')]},'destcalleridname':{'type':Sequelize[_0xe9f0('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe9f0('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9f0('0x2')]},'destcontext':{'type':Sequelize[_0xe9f0('0x2')]},'destexten':{'type':Sequelize[_0xe9f0('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe9f0('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe9f0('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe9f0('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe9f0('0x2')],'comment':_0xe9f0('0x6')},'transferexten':{'type':Sequelize[_0xe9f0('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe9f0('0x2')]},'agententerreason':{'type':Sequelize[_0xe9f0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0cfa=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x0cfa,0x73));var _0xa0cf=function(_0x2215ba,_0x3f9d59){_0x2215ba=_0x2215ba-0x0;var _0x2bfbe9=_0x0cfa[_0x2215ba];return _0x2bfbe9;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'type':{'type':Sequelize[_0xa0cf('0x2')]},'uniqueid':{'type':Sequelize[_0xa0cf('0x2')]},'calleridnum':{'type':Sequelize[_0xa0cf('0x2')]},'calleridname':{'type':Sequelize[_0xa0cf('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xa0cf('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xa0cf('0x3')]},'agentconnectAt':{'type':Sequelize[_0xa0cf('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa0cf('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xa0cf('0x3')]},'agentdumpAt':{'type':Sequelize[_0xa0cf('0x3')]},'holdtime':{'type':Sequelize[_0xa0cf('0x4')]},'agentcomplete':{'type':Sequelize[_0xa0cf('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa0cf('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa0cf('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa0cf('0x4')]},'agentacw':{'type':Sequelize[_0xa0cf('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa0cf('0x4')]},'reason':{'type':Sequelize[_0xa0cf('0x2')]},'lastevent':{'type':Sequelize[_0xa0cf('0x2')]},'channel':{'type':Sequelize[_0xa0cf('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa0cf('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa0cf('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa0cf('0x2')]},'accountcode':{'type':Sequelize[_0xa0cf('0x2')]},'context':{'type':Sequelize[_0xa0cf('0x2')]},'exten':{'type':Sequelize[_0xa0cf('0x2')]},'priority':{'type':Sequelize[_0xa0cf('0x2')]},'destchannel':{'type':Sequelize[_0xa0cf('0x2')]},'destchannelstate':{'type':Sequelize[_0xa0cf('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa0cf('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa0cf('0x2')]},'destcalleridname':{'type':Sequelize[_0xa0cf('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa0cf('0x2')]},'destaccountcode':{'type':Sequelize[_0xa0cf('0x2')]},'destcontext':{'type':Sequelize[_0xa0cf('0x2')]},'destexten':{'type':Sequelize[_0xa0cf('0x2')]},'destpriority':{'type':Sequelize[_0xa0cf('0x2')]},'destuniqueid':{'type':Sequelize[_0xa0cf('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa0cf('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa0cf('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa0cf('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xa0cf('0x2')]},'agententerreason':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 255e960..5740e35 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(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 8558e67..c869841 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 _0x4b19=['uniqueid','destuniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent'];(function(_0x45dd0e,_0x28e603){var _0x50e5ca=function(_0x46a412){while(--_0x46a412){_0x45dd0e['push'](_0x45dd0e['shift']());}};_0x50e5ca(++_0x28e603);}(_0x4b19,0x195));var _0x94b1=function(_0xcde973,_0x12a51b){_0xcde973=_0xcde973-0x0;var _0x3ba809=_0x4b19[_0xcde973];return _0x3ba809;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x94b1('0xb'),_0x94b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x23b463,_0x3983cd){var _0x40d519=function(_0x93ce43){while(--_0x93ce43){_0x23b463['push'](_0x23b463['shift']());}};_0x40d519(++_0x3983cd);}(_0x8ce1,0x183));var _0x18ce=function(_0x52f29a,_0x2e90a6){_0x52f29a=_0x52f29a-0x0;var _0x266786=_0x8ce1[_0x52f29a];return _0x266786;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require(_0x18ce('0x7'));var rimraf=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var attributes=require(_0x18ce('0xa'));module[_0x18ce('0xb')]=function(_0x13ff9d,_0x36f8db){return _0x13ff9d[_0x18ce('0xc')](_0x18ce('0xd'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x18ce('0xe'),_0x18ce('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index fab3226..5ea2bc2 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 _0xcc78=['options','raw','then','UpdateVoiceAgentReport','VoiceAgentReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body'];(function(_0x57a624,_0x4cfa46){var _0x303d2f=function(_0xe77c48){while(--_0xe77c48){_0x57a624['push'](_0x57a624['shift']());}};_0x303d2f(++_0x4cfa46);}(_0xcc78,0xb2));var _0x8cc7=function(_0x40cbd7,_0x35ee47){_0x40cbd7=_0x40cbd7-0x0;var _0x3caf4f=_0xcc78[_0x40cbd7];return _0x3caf4f;};'use strict';var _=require(_0x8cc7('0x0'));var util=require(_0x8cc7('0x1'));var moment=require('moment');var BPromise=require(_0x8cc7('0x2'));var rs=require(_0x8cc7('0x3'));var fs=require('fs');var Redis=require(_0x8cc7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cc7('0x5'));var logger=require(_0x8cc7('0x6'))(_0x8cc7('0x7'));var config=require(_0x8cc7('0x8'));var jayson=require(_0x8cc7('0x9'));var client=jayson[_0x8cc7('0xa')][_0x8cc7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52198c,_0x4721ff,_0x5cc83f){return new BPromise(function(_0x21eabe,_0x270672){return client['request'](_0x52198c,_0x5cc83f)['then'](function(_0x555fbd){logger[_0x8cc7('0xc')](_0x8cc7('0xd'),_0x4721ff,_0x8cc7('0xe'));logger[_0x8cc7('0xf')](_0x8cc7('0x10'),_0x4721ff,'request\x20sent',JSON[_0x8cc7('0x11')](_0x555fbd));if(_0x555fbd[_0x8cc7('0x12')]){if(_0x555fbd['error'][_0x8cc7('0x13')]===0x1f4){logger[_0x8cc7('0x12')](_0x8cc7('0xd'),_0x4721ff,_0x555fbd[_0x8cc7('0x12')][_0x8cc7('0x14')]);return _0x270672(_0x555fbd['error'][_0x8cc7('0x14')]);}logger['error'](_0x8cc7('0xd'),_0x4721ff,_0x555fbd['error'][_0x8cc7('0x14')]);return _0x21eabe(_0x555fbd[_0x8cc7('0x12')][_0x8cc7('0x14')]);}else{logger[_0x8cc7('0xc')](_0x8cc7('0xd'),_0x4721ff,'request\x20sent');_0x21eabe(_0x555fbd[_0x8cc7('0x15')][_0x8cc7('0x14')]);}})[_0x8cc7('0x16')](function(_0x9a76e){logger[_0x8cc7('0x12')](_0x8cc7('0xd'),_0x4721ff,_0x9a76e);_0x270672(_0x9a76e);});});}exports[_0x8cc7('0x17')]=function(_0x382d80){var _0x4ecfa2=this;return new Promise(function(_0x3eb224,_0x457778){return db['VoiceAgentReport'][_0x8cc7('0x18')](_0x382d80[_0x8cc7('0x19')],{'raw':_0x382d80['options']?_0x382d80[_0x8cc7('0x1a')][_0x8cc7('0x1b')]===undefined?!![]:![]:!![]})[_0x8cc7('0x1c')](function(_0x198089){logger['info'](_0x8cc7('0x17'),_0x382d80);logger[_0x8cc7('0xf')]('CreateVoiceAgentReport',_0x382d80,JSON['stringify'](_0x198089));_0x3eb224(_0x198089);})['catch'](function(_0x3cd662){logger[_0x8cc7('0x12')](_0x8cc7('0x17'),_0x3cd662[_0x8cc7('0x14')],_0x382d80);_0x457778(_0x4ecfa2[_0x8cc7('0x12')](0x1f4,_0x3cd662['message']));});});};exports[_0x8cc7('0x1d')]=function(_0x18fb88){var _0x2bbd24=this;return new Promise(function(_0x56816a,_0x59ec62){return db[_0x8cc7('0x1e')][_0x8cc7('0x1f')](_0x18fb88['body'],{'raw':_0x18fb88[_0x8cc7('0x1a')]?_0x18fb88[_0x8cc7('0x1a')][_0x8cc7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18fb88[_0x8cc7('0x1a')]?_0x18fb88['options']['where']||null:null,'attributes':_0x18fb88[_0x8cc7('0x1a')]?_0x18fb88[_0x8cc7('0x1a')][_0x8cc7('0x20')]||null:null,'limit':_0x18fb88[_0x8cc7('0x1a')]?_0x18fb88[_0x8cc7('0x1a')][_0x8cc7('0x21')]||null:null})['then'](function(_0x161965){logger[_0x8cc7('0xc')](_0x8cc7('0x1d'),_0x18fb88);logger[_0x8cc7('0xf')]('UpdateVoiceAgentReport',_0x18fb88,JSON[_0x8cc7('0x11')](_0x161965));_0x56816a(_0x161965);})['catch'](function(_0xe39255){logger[_0x8cc7('0x12')](_0x8cc7('0x1d'),_0xe39255['message'],_0x18fb88);_0x59ec62(_0x2bbd24[_0x8cc7('0x12')](0x1f4,_0xe39255['message']));});});}; \ No newline at end of file +var _0xdabe=['request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x21f425,_0x16f48f){var _0x261f03=function(_0x5616d0){while(--_0x5616d0){_0x21f425['push'](_0x21f425['shift']());}};_0x261f03(++_0x16f48f);}(_0xdabe,0x1d4));var _0xedab=function(_0xc65af5,_0x32778c){_0xc65af5=_0xc65af5-0x0;var _0x5579b6=_0xdabe[_0xc65af5];return _0x5579b6;};'use strict';var _=require(_0xedab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedab('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xedab('0x2'));var logger=require(_0xedab('0x3'))(_0xedab('0x4'));var config=require(_0xedab('0x5'));var jayson=require(_0xedab('0x6'));var client=jayson[_0xedab('0x7')][_0xedab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x395b3c,_0x5abf57,_0x4ccc8e){return new BPromise(function(_0x30479a,_0x28c206){return client[_0xedab('0x9')](_0x395b3c,_0x4ccc8e)[_0xedab('0xa')](function(_0x3d6255){logger[_0xedab('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x5abf57,_0xedab('0xc'));logger[_0xedab('0xd')](_0xedab('0xe'),_0x5abf57,_0xedab('0xc'),JSON[_0xedab('0xf')](_0x3d6255));if(_0x3d6255['error']){if(_0x3d6255[_0xedab('0x10')][_0xedab('0x11')]===0x1f4){logger[_0xedab('0x10')](_0xedab('0x12'),_0x5abf57,_0x3d6255['error'][_0xedab('0x13')]);return _0x28c206(_0x3d6255[_0xedab('0x10')]['message']);}logger[_0xedab('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x5abf57,_0x3d6255[_0xedab('0x10')]['message']);return _0x30479a(_0x3d6255[_0xedab('0x10')]['message']);}else{logger[_0xedab('0xb')](_0xedab('0x12'),_0x5abf57,_0xedab('0xc'));_0x30479a(_0x3d6255[_0xedab('0x14')][_0xedab('0x13')]);}})['catch'](function(_0x3a1158){logger['error'](_0xedab('0x12'),_0x5abf57,_0x3a1158);_0x28c206(_0x3a1158);});});}exports[_0xedab('0x15')]=function(_0x3a8eef){var _0x3f56fb=this;return new Promise(function(_0x1d1138,_0x196c8b){return db['VoiceAgentReport'][_0xedab('0x16')](_0x3a8eef[_0xedab('0x17')],{'raw':_0x3a8eef[_0xedab('0x18')]?_0x3a8eef[_0xedab('0x18')][_0xedab('0x19')]===undefined?!![]:![]:!![]})[_0xedab('0xa')](function(_0x1b247e){logger[_0xedab('0xb')](_0xedab('0x15'),_0x3a8eef);logger['debug']('CreateVoiceAgentReport',_0x3a8eef,JSON[_0xedab('0xf')](_0x1b247e));_0x1d1138(_0x1b247e);})['catch'](function(_0x13a567){logger['error'](_0xedab('0x15'),_0x13a567['message'],_0x3a8eef);_0x196c8b(_0x3f56fb[_0xedab('0x10')](0x1f4,_0x13a567['message']));});});};exports[_0xedab('0x1a')]=function(_0x17c0bf){var _0x1f8d54=this;return new Promise(function(_0x1e3c70,_0x5bb9c3){return db[_0xedab('0x1b')][_0xedab('0x1c')](_0x17c0bf[_0xedab('0x17')],{'raw':_0x17c0bf[_0xedab('0x18')]?_0x17c0bf[_0xedab('0x18')][_0xedab('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17c0bf[_0xedab('0x18')]?_0x17c0bf['options'][_0xedab('0x1d')]||null:null,'attributes':_0x17c0bf[_0xedab('0x18')]?_0x17c0bf[_0xedab('0x18')][_0xedab('0x1e')]||null:null,'limit':_0x17c0bf[_0xedab('0x18')]?_0x17c0bf[_0xedab('0x18')][_0xedab('0x1f')]||null:null})['then'](function(_0x42184b){logger['info'](_0xedab('0x1a'),_0x17c0bf);logger[_0xedab('0xd')]('UpdateVoiceAgentReport',_0x17c0bf,JSON[_0xedab('0xf')](_0x42184b));_0x1e3c70(_0x42184b);})['catch'](function(_0x258393){logger[_0xedab('0x10')](_0xedab('0x1a'),_0x258393[_0xedab('0x13')],_0x17c0bf);_0x5bb9c3(_0x1f8d54[_0xedab('0x10')](0x1f4,_0x258393[_0xedab('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4debc6d..2fc4f62 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 _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','delete','destroy'];(function(_0x1ec0ee,_0x1bbf02){var _0x4516a1=function(_0x31478d){while(--_0x31478d){_0x1ec0ee['push'](_0x1ec0ee['shift']());}};_0x4516a1(++_0x1bbf02);}(_0x2bd8,0x130));var _0x82bd=function(_0x467cec,_0x759b62){_0x467cec=_0x467cec-0x0;var _0x59b4ac=_0x2bd8[_0x467cec];return _0x59b4ac;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['put'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x82bd('0xe')](_0x82bd('0xd'),auth['isAuthenticated'](),controller[_0x82bd('0xf')]);module['exports']=router; \ No newline at end of file +var _0x80d9=['get','/:id','show','post','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe'];(function(_0x187b45,_0x414510){var _0x1b7d56=function(_0x1e0e4d){while(--_0x1e0e4d){_0x187b45['push'](_0x187b45['shift']());}};_0x1b7d56(++_0x414510);}(_0x80d9,0x15c));var _0x980d=function(_0x3219fa,_0xcf1109){_0x3219fa=_0x3219fa-0x0;var _0x5eafe7=_0x80d9[_0x3219fa];return _0x5eafe7;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['update']);router[_0x980d('0x10')]('/:id',auth[_0x980d('0xa')](),controller['destroy']);module[_0x980d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b2166ec..14305cd 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 _0x2b84=['ENUM','inbound','internal','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0x2b84,0x1ed));var _0x42b8=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2b84[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x42b8('0x0'));module[_0x42b8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x42b8('0x2')](_0x42b8('0x3'),_0x42b8('0x4'),'outbound',_0x42b8('0x5'),'outbound-fax',_0x42b8('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x42b8('0x7')]},'source':{'type':Sequelize[_0x42b8('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x42b8('0x7')]},'channel':{'type':Sequelize[_0x42b8('0x7')]},'destinationchannel':{'type':Sequelize[_0x42b8('0x7')]},'lastapplication':{'type':Sequelize[_0x42b8('0x7')]},'lastdata':{'type':Sequelize[_0x42b8('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x42b8('0x9')]},'answertime':{'type':Sequelize[_0x42b8('0x9')]},'endtime':{'type':Sequelize[_0x42b8('0x9')]},'duration':{'type':Sequelize[_0x42b8('0xa')]},'billableseconds':{'type':Sequelize[_0x42b8('0xa')]},'mohtime':{'type':Sequelize[_0x42b8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x42b8('0x7')]},'amaflags':{'type':Sequelize[_0x42b8('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x42b8('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x42b8('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x42b8('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7c8=['outbound-fax','dialer','DATE','INTEGER','sequelize','STRING','ENUM','inbound','outbound'];(function(_0x556836,_0x33a52b){var _0x1dc0f3=function(_0x4e5b99){while(--_0x4e5b99){_0x556836['push'](_0x556836['shift']());}};_0x1dc0f3(++_0x33a52b);}(_0xa7c8,0x82));var _0x8a7c=function(_0x1f31ff,_0x275fec){_0x1f31ff=_0x1f31ff-0x0;var _0x4d95d7=_0xa7c8[_0x1f31ff];return _0x4d95d7;};'use strict';var Sequelize=require(_0x8a7c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8a7c('0x1')]},'type':{'type':Sequelize[_0x8a7c('0x2')](_0x8a7c('0x3'),'internal',_0x8a7c('0x4'),'inbound-fax',_0x8a7c('0x5'),_0x8a7c('0x6'))},'tag':{'type':Sequelize[_0x8a7c('0x1')]},'accountcode':{'type':Sequelize[_0x8a7c('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x8a7c('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8a7c('0x1')]},'channel':{'type':Sequelize[_0x8a7c('0x1')]},'destinationchannel':{'type':Sequelize[_0x8a7c('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x8a7c('0x7')]},'systemanswertime':{'type':Sequelize[_0x8a7c('0x7')]},'answertime':{'type':Sequelize[_0x8a7c('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x8a7c('0x8')]},'mohtime':{'type':Sequelize[_0x8a7c('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8a7c('0x1')]},'amaflags':{'type':Sequelize[_0x8a7c('0x1')]},'userfield':{'type':Sequelize[_0x8a7c('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x8a7c('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8a7c('0x1')]},'prefix':{'type':Sequelize[_0x8a7c('0x1')]},'routeid':{'type':Sequelize[_0x8a7c('0x8')]},'sipcallid':{'type':Sequelize[_0x8a7c('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6b7057e..d8a3596 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(_0x55b4d3,_0x1c3b48){var _0x324c2b=function(_0x4bae32){while(--_0x4bae32){_0x55b4d3['push'](_0x55b4d3['shift']());}};_0x324c2b(++_0x1c3b48);}(_0xdb28,0x106));var _0x8db2=function(_0x375cfe,_0x4f3df2){_0x375cfe=_0x375cfe-0x0;var _0x50c8ea=_0xdb28[_0x375cfe];return _0x50c8ea;};'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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x4b5733,_0x345f7a){var _0x511d04=function(_0x756712){while(--_0x756712){_0x4b5733['push'](_0x4b5733['shift']());}};_0x511d04(++_0x345f7a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x0b0e[_0x176d14];return _0x89522c;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 280c7eb..cb2d34f 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 _0xde5d=['rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','lodash','../../config/logger','api','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xde5d,0xd7));var _0xdde5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xde5d[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xdde5('0x0'));var util=require('util');var logger=require(_0xdde5('0x1'))(_0xdde5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdde5('0x3'));var fs=require('fs');var path=require(_0xdde5('0x4'));var rimraf=require(_0xdde5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdde5('0x6'));module[_0xdde5('0x7')]=function(_0x409af0,_0x28df99){return _0x409af0['define'](_0xdde5('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xdde5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd24a=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x134699,_0x13f36e){var _0x5b8b0d=function(_0x3413a8){while(--_0x3413a8){_0x134699['push'](_0x134699['shift']());}};_0x5b8b0d(++_0x13f36e);}(_0xd24a,0x185));var _0xad24=function(_0x449e43,_0x88f364){_0x449e43=_0x449e43-0x0;var _0x473c1e=_0xd24a[_0x449e43];return _0x473c1e;};'use strict';var _=require(_0xad24('0x0'));var util=require(_0xad24('0x1'));var logger=require(_0xad24('0x2'))(_0xad24('0x3'));var moment=require(_0xad24('0x4'));var BPromise=require(_0xad24('0x5'));var rp=require(_0xad24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xad24('0x7'));var attributes=require(_0xad24('0x8'));module['exports']=function(_0x414900,_0x3c00ee){return _0x414900[_0xad24('0x9')](_0xad24('0xa'),attributes,{'tableName':_0xad24('0xb'),'paranoid':![],'indexes':[{'fields':[_0xad24('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 84f2c46..f685cdd 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 _0xa4ad=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','map','include','model','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then'];(function(_0x27c4bd,_0x214ea9){var _0x1c20ef=function(_0x4e453e){while(--_0x4e453e){_0x27c4bd['push'](_0x27c4bd['shift']());}};_0x1c20ef(++_0x214ea9);}(_0xa4ad,0xf0));var _0xda4a=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xa4ad[_0x3b632f];return _0x10e788;};'use strict';var _=require('lodash');var util=require(_0xda4a('0x0'));var moment=require(_0xda4a('0x1'));var BPromise=require(_0xda4a('0x2'));var rs=require(_0xda4a('0x3'));var fs=require('fs');var Redis=require(_0xda4a('0x4'));var db=require(_0xda4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda4a('0x6'))(_0xda4a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xda4a('0x8')][_0xda4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3183af,_0x3e1433,_0x21ffd1){return new BPromise(function(_0x1d2ac8,_0x218af3){return client[_0xda4a('0xa')](_0x3183af,_0x21ffd1)[_0xda4a('0xb')](function(_0x57ee26){logger[_0xda4a('0xc')](_0xda4a('0xd'),_0x3e1433,_0xda4a('0xe'));logger[_0xda4a('0xf')](_0xda4a('0x10'),_0x3e1433,_0xda4a('0xe'),JSON[_0xda4a('0x11')](_0x57ee26));if(_0x57ee26[_0xda4a('0x12')]){if(_0x57ee26[_0xda4a('0x12')][_0xda4a('0x13')]===0x1f4){logger[_0xda4a('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x3e1433,_0x57ee26[_0xda4a('0x12')][_0xda4a('0x14')]);return _0x218af3(_0x57ee26['error'][_0xda4a('0x14')]);}logger[_0xda4a('0x12')](_0xda4a('0xd'),_0x3e1433,_0x57ee26[_0xda4a('0x12')]['message']);return _0x1d2ac8(_0x57ee26[_0xda4a('0x12')][_0xda4a('0x14')]);}else{logger[_0xda4a('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3e1433,_0xda4a('0xe'));_0x1d2ac8(_0x57ee26[_0xda4a('0x15')]['message']);}})[_0xda4a('0x16')](function(_0x4ef3cf){logger['error'](_0xda4a('0xd'),_0x3e1433,_0x4ef3cf);_0x218af3(_0x4ef3cf);});});}exports[_0xda4a('0x17')]=function(_0x38dd92){var _0xc92a79=this;return new Promise(function(_0xec5c96,_0x2c8ffe){return db[_0xda4a('0x18')]['findAll']({'raw':_0x38dd92['options']?_0x38dd92[_0xda4a('0x19')][_0xda4a('0x1a')]===undefined?!![]:![]:!![],'where':_0x38dd92[_0xda4a('0x19')]?_0x38dd92[_0xda4a('0x19')][_0xda4a('0x1b')]||null:null,'attributes':_0x38dd92[_0xda4a('0x19')]?_0x38dd92[_0xda4a('0x19')][_0xda4a('0x1c')]||null:null,'limit':_0x38dd92['options']?_0x38dd92[_0xda4a('0x19')]['limit']||null:null,'include':_0x38dd92['options']?_0x38dd92['options']['include']?_[_0xda4a('0x1d')](_0x38dd92[_0xda4a('0x19')][_0xda4a('0x1e')],function(_0x971b0b){return{'model':db[_0x971b0b[_0xda4a('0x1f')]],'as':_0x971b0b['as'],'attributes':_0x971b0b[_0xda4a('0x1c')],'include':_0x971b0b[_0xda4a('0x1e')]?_[_0xda4a('0x1d')](_0x971b0b[_0xda4a('0x1e')],function(_0x204cc7){return{'model':db[_0x204cc7['model']],'as':_0x204cc7['as'],'attributes':_0x204cc7[_0xda4a('0x1c')],'include':_0x204cc7[_0xda4a('0x1e')]?_['map'](_0x204cc7[_0xda4a('0x1e')],function(_0x42fbcf){return{'model':db[_0x42fbcf[_0xda4a('0x1f')]],'as':_0x42fbcf['as'],'attributes':_0x42fbcf[_0xda4a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xda4a('0xb')](function(_0xb3069f){logger[_0xda4a('0xc')](_0xda4a('0x17'),_0x38dd92);logger[_0xda4a('0xf')](_0xda4a('0x17'),_0x38dd92,JSON['stringify'](_0xb3069f));_0xec5c96(_0xb3069f);})[_0xda4a('0x16')](function(_0x567442){logger[_0xda4a('0x12')]('GetVoiceCallReport',_0x567442[_0xda4a('0x14')],_0x38dd92);_0x2c8ffe(_0xc92a79[_0xda4a('0x12')](0x1f4,_0x567442[_0xda4a('0x14')]));});});};exports[_0xda4a('0x20')]=function(_0x460df5){var _0x5ee0e5=this;return new Promise(function(_0x47c508,_0x46cfb5){return db[_0xda4a('0x18')]['create'](_0x460df5[_0xda4a('0x21')],{'raw':_0x460df5[_0xda4a('0x19')]?_0x460df5['options'][_0xda4a('0x1a')]===undefined?!![]:![]:!![]})[_0xda4a('0xb')](function(_0x3a4bfd){logger[_0xda4a('0xc')]('CreateVoiceCallReport',_0x460df5);logger[_0xda4a('0xf')]('CreateVoiceCallReport',_0x460df5,JSON[_0xda4a('0x11')](_0x3a4bfd));_0x47c508(_0x3a4bfd);})[_0xda4a('0x16')](function(_0x19ab21){logger[_0xda4a('0x12')](_0xda4a('0x20'),_0x19ab21[_0xda4a('0x14')],_0x460df5);_0x46cfb5(_0x5ee0e5[_0xda4a('0x12')](0x1f4,_0x19ab21[_0xda4a('0x14')]));});});};exports[_0xda4a('0x22')]=function(_0x5cef7d){var _0x553052=this;return new Promise(function(_0x1b6e28,_0x4c13cd){return db[_0xda4a('0x18')][_0xda4a('0x23')](_0x5cef7d[_0xda4a('0x21')],{'raw':_0x5cef7d[_0xda4a('0x19')]?_0x5cef7d[_0xda4a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cef7d[_0xda4a('0x19')]?_0x5cef7d[_0xda4a('0x19')][_0xda4a('0x1b')]||null:null,'attributes':_0x5cef7d[_0xda4a('0x19')]?_0x5cef7d[_0xda4a('0x19')][_0xda4a('0x1c')]||null:null,'limit':_0x5cef7d[_0xda4a('0x19')]?_0x5cef7d[_0xda4a('0x19')]['limit']||null:null})[_0xda4a('0xb')](function(_0x1ead2f){logger['info'](_0xda4a('0x22'),_0x5cef7d);logger['debug']('UpdateVoiceCallReport',_0x5cef7d,JSON[_0xda4a('0x11')](_0x1ead2f));_0x1b6e28(_0x1ead2f);})[_0xda4a('0x16')](function(_0x574e8){logger[_0xda4a('0x12')](_0xda4a('0x22'),_0x574e8[_0xda4a('0x14')],_0x5cef7d);_0x4c13cd(_0x553052[_0xda4a('0x12')](0x1f4,_0x574e8[_0xda4a('0x14')]));});});}; \ No newline at end of file +var _0x8c74=['update','body','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','findAll','options','raw','where','attributes','limit','include','map','model','catch','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport'];(function(_0x3366c5,_0x597f9a){var _0x18500d=function(_0x59418e){while(--_0x59418e){_0x3366c5['push'](_0x3366c5['shift']());}};_0x18500d(++_0x597f9a);}(_0x8c74,0x7a));var _0x48c7=function(_0x1ae975,_0x70b40e){_0x1ae975=_0x1ae975-0x0;var _0x2576ca=_0x8c74[_0x1ae975];return _0x2576ca;};'use strict';var _=require(_0x48c7('0x0'));var util=require(_0x48c7('0x1'));var moment=require(_0x48c7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48c7('0x3'));var db=require(_0x48c7('0x4'))['db'];var utils=require(_0x48c7('0x5'));var logger=require(_0x48c7('0x6'))(_0x48c7('0x7'));var config=require(_0x48c7('0x8'));var jayson=require(_0x48c7('0x9'));var client=jayson[_0x48c7('0xa')][_0x48c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17c03c,_0x505784,_0x3e7d42){return new BPromise(function(_0x2ab5ce,_0x2778d0){return client[_0x48c7('0xc')](_0x17c03c,_0x3e7d42)[_0x48c7('0xd')](function(_0x289135){logger[_0x48c7('0xe')](_0x48c7('0xf'),_0x505784,_0x48c7('0x10'));logger[_0x48c7('0x11')](_0x48c7('0x12'),_0x505784,_0x48c7('0x10'),JSON[_0x48c7('0x13')](_0x289135));if(_0x289135[_0x48c7('0x14')]){if(_0x289135['error']['code']===0x1f4){logger[_0x48c7('0x14')](_0x48c7('0xf'),_0x505784,_0x289135[_0x48c7('0x14')][_0x48c7('0x15')]);return _0x2778d0(_0x289135[_0x48c7('0x14')][_0x48c7('0x15')]);}logger[_0x48c7('0x14')](_0x48c7('0xf'),_0x505784,_0x289135[_0x48c7('0x14')]['message']);return _0x2ab5ce(_0x289135[_0x48c7('0x14')]['message']);}else{logger[_0x48c7('0xe')](_0x48c7('0xf'),_0x505784,'request\x20sent');_0x2ab5ce(_0x289135[_0x48c7('0x16')][_0x48c7('0x15')]);}})['catch'](function(_0x6f8a5e){logger[_0x48c7('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x505784,_0x6f8a5e);_0x2778d0(_0x6f8a5e);});});}exports['GetVoiceCallReport']=function(_0x402eb8){var _0x4de6a0=this;return new Promise(function(_0xf31415,_0x595678){return db['VoiceCallReport'][_0x48c7('0x17')]({'raw':_0x402eb8[_0x48c7('0x18')]?_0x402eb8['options'][_0x48c7('0x19')]===undefined?!![]:![]:!![],'where':_0x402eb8['options']?_0x402eb8[_0x48c7('0x18')][_0x48c7('0x1a')]||null:null,'attributes':_0x402eb8[_0x48c7('0x18')]?_0x402eb8['options'][_0x48c7('0x1b')]||null:null,'limit':_0x402eb8[_0x48c7('0x18')]?_0x402eb8[_0x48c7('0x18')][_0x48c7('0x1c')]||null:null,'include':_0x402eb8['options']?_0x402eb8[_0x48c7('0x18')][_0x48c7('0x1d')]?_[_0x48c7('0x1e')](_0x402eb8['options'][_0x48c7('0x1d')],function(_0x201407){return{'model':db[_0x201407[_0x48c7('0x1f')]],'as':_0x201407['as'],'attributes':_0x201407[_0x48c7('0x1b')],'include':_0x201407[_0x48c7('0x1d')]?_[_0x48c7('0x1e')](_0x201407[_0x48c7('0x1d')],function(_0x3fe26e){return{'model':db[_0x3fe26e['model']],'as':_0x3fe26e['as'],'attributes':_0x3fe26e[_0x48c7('0x1b')],'include':_0x3fe26e[_0x48c7('0x1d')]?_[_0x48c7('0x1e')](_0x3fe26e[_0x48c7('0x1d')],function(_0xb46eed){return{'model':db[_0xb46eed[_0x48c7('0x1f')]],'as':_0xb46eed['as'],'attributes':_0xb46eed[_0x48c7('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10c58d){logger['info']('GetVoiceCallReport',_0x402eb8);logger[_0x48c7('0x11')]('GetVoiceCallReport',_0x402eb8,JSON['stringify'](_0x10c58d));_0xf31415(_0x10c58d);})[_0x48c7('0x20')](function(_0x365173){logger[_0x48c7('0x14')](_0x48c7('0x21'),_0x365173['message'],_0x402eb8);_0x595678(_0x4de6a0[_0x48c7('0x14')](0x1f4,_0x365173[_0x48c7('0x15')]));});});};exports[_0x48c7('0x22')]=function(_0x8b001d){var _0x57afc5=this;return new Promise(function(_0x113a62,_0x42c463){return db[_0x48c7('0x23')][_0x48c7('0x24')](_0x8b001d['body'],{'raw':_0x8b001d[_0x48c7('0x18')]?_0x8b001d[_0x48c7('0x18')][_0x48c7('0x19')]===undefined?!![]:![]:!![]})[_0x48c7('0xd')](function(_0xd334df){logger[_0x48c7('0xe')](_0x48c7('0x22'),_0x8b001d);logger[_0x48c7('0x11')](_0x48c7('0x22'),_0x8b001d,JSON[_0x48c7('0x13')](_0xd334df));_0x113a62(_0xd334df);})['catch'](function(_0x37f2d7){logger[_0x48c7('0x14')](_0x48c7('0x22'),_0x37f2d7[_0x48c7('0x15')],_0x8b001d);_0x42c463(_0x57afc5[_0x48c7('0x14')](0x1f4,_0x37f2d7[_0x48c7('0x15')]));});});};exports[_0x48c7('0x25')]=function(_0x25a664){var _0x2ab34f=this;return new Promise(function(_0x2ff6dc,_0x1e53ce){return db[_0x48c7('0x23')][_0x48c7('0x26')](_0x25a664[_0x48c7('0x27')],{'raw':_0x25a664[_0x48c7('0x18')]?_0x25a664['options'][_0x48c7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25a664[_0x48c7('0x18')]?_0x25a664[_0x48c7('0x18')][_0x48c7('0x1a')]||null:null,'attributes':_0x25a664['options']?_0x25a664[_0x48c7('0x18')][_0x48c7('0x1b')]||null:null,'limit':_0x25a664[_0x48c7('0x18')]?_0x25a664['options']['limit']||null:null})[_0x48c7('0xd')](function(_0xc0e8e8){logger[_0x48c7('0xe')]('UpdateVoiceCallReport',_0x25a664);logger[_0x48c7('0x11')](_0x48c7('0x25'),_0x25a664,JSON[_0x48c7('0x13')](_0xc0e8e8));_0x2ff6dc(_0xc0e8e8);})[_0x48c7('0x20')](function(_0x49eeb2){logger[_0x48c7('0x14')]('UpdateVoiceCallReport',_0x49eeb2[_0x48c7('0x15')],_0x25a664);_0x1e53ce(_0x2ab34f['error'](0x1f4,_0x49eeb2[_0x48c7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 49317be..1996813 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 _0x0a3d=['update','delete','/:id','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','index','get','isAuthenticated','post','create','put'];(function(_0x46941b,_0xc3e071){var _0x3308b6=function(_0x2725f8){while(--_0x2725f8){_0x46941b['push'](_0x46941b['shift']());}};_0x3308b6(++_0xc3e071);}(_0x0a3d,0xae));var _0xd0a3=function(_0x787ca1,_0xaffe6b){_0x787ca1=_0x787ca1-0x0;var _0x40d226=_0x0a3d[_0x787ca1];return _0x40d226;};'use strict';var multer=require(_0xd0a3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd0a3('0x1'));var express=require(_0xd0a3('0x2'));var router=express[_0xd0a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd0a3('0x4'));var interaction=require(_0xd0a3('0x5'));var config=require('../../config/environment');var controller=require(_0xd0a3('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd0a3('0x7')]);router[_0xd0a3('0x8')]('/:id',auth[_0xd0a3('0x9')](),controller['show']);router[_0xd0a3('0xa')]('/',auth[_0xd0a3('0x9')](),controller[_0xd0a3('0xb')]);router[_0xd0a3('0xc')]('/:id',auth[_0xd0a3('0x9')](),controller[_0xd0a3('0xd')]);router[_0xd0a3('0xe')](_0xd0a3('0xf'),auth[_0xd0a3('0x9')](),controller[_0xd0a3('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdd70=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x51c33e,_0x5f070f){var _0x4bdfb8=function(_0x3b771f){while(--_0x3b771f){_0x51c33e['push'](_0x51c33e['shift']());}};_0x4bdfb8(++_0x5f070f);}(_0xdd70,0xb3));var _0x0dd7=function(_0x30414b,_0x3d7fab){_0x30414b=_0x30414b-0x0;var _0x5df517=_0xdd70[_0x30414b];return _0x5df517;};'use strict';var multer=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var path=require(_0x0dd7('0x2'));var timeout=require(_0x0dd7('0x3'));var express=require(_0x0dd7('0x4'));var router=express[_0x0dd7('0x5')]();var fs_extra=require(_0x0dd7('0x6'));var auth=require(_0x0dd7('0x7'));var interaction=require(_0x0dd7('0x8'));var config=require(_0x0dd7('0x9'));var controller=require(_0x0dd7('0xa'));router[_0x0dd7('0xb')]('/',auth[_0x0dd7('0xc')](),controller[_0x0dd7('0xd')]);router[_0x0dd7('0xb')](_0x0dd7('0xe'),auth[_0x0dd7('0xc')](),controller[_0x0dd7('0xf')]);router[_0x0dd7('0x10')]('/',auth[_0x0dd7('0xc')](),controller[_0x0dd7('0x11')]);router[_0x0dd7('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0dd7('0x13')]('/:id',auth[_0x0dd7('0xc')](),controller[_0x0dd7('0x14')]);module[_0x0dd7('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index de73fd4..aa458fd 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 _0xf8c9=['sequelize','exports','STRING','name','options','getDataValue','split','BOOLEAN'];(function(_0x4cde0d,_0x53f8a5){var _0x4ee3f7=function(_0x5e19b){while(--_0x5e19b){_0x4cde0d['push'](_0x4cde0d['shift']());}};_0x4ee3f7(++_0x53f8a5);}(_0xf8c9,0x170));var _0x9f8c=function(_0x41d03d,_0x103a04){_0x41d03d=_0x41d03d-0x0;var _0x287513=_0xf8c9[_0x41d03d];return _0x287513;};'use strict';var Sequelize=require(_0x9f8c('0x0'));module[_0x9f8c('0x1')]={'name':{'type':Sequelize[_0x9f8c('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x9f8c('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9f8c('0x2')],'set':function(_0x3128a7){this['setDataValue'](_0x9f8c('0x4'),_0x3128a7?_0x3128a7['join'](''):[]);},'get':function(){return this[_0x9f8c('0x5')](_0x9f8c('0x4'))?this[_0x9f8c('0x5')](_0x9f8c('0x4'))[_0x9f8c('0x6')](''):[];}},'auth':{'type':Sequelize[_0x9f8c('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x9f8c('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9f8c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4aeb=['split','BOOLEAN','STRING','setDataValue','options','join','getDataValue'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4aeb,0xbf));var _0xb4ae=function(_0x53d5ec,_0x9b7594){_0x53d5ec=_0x53d5ec-0x0;var _0x45ef11=_0x4aeb[_0x53d5ec];return _0x45ef11;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb4ae('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xb4ae('0x0')],'set':function(_0x411b85){this[_0xb4ae('0x1')](_0xb4ae('0x2'),_0x411b85?_0x411b85[_0xb4ae('0x3')](''):[]);},'get':function(){return this[_0xb4ae('0x4')](_0xb4ae('0x2'))?this[_0xb4ae('0x4')](_0xb4ae('0x2'))[_0xb4ae('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xb4ae('0x0')]},'record':{'type':Sequelize[_0xb4ae('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4ae('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ea6a35a..39e7f71 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 _0xd73a=['update','then','destroy','get','ChanSpies','UserProfileResource','name','send','map','VoiceChanSpy','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x4c8218,_0x1d70f0){var _0x218d2a=function(_0x15d1a9){while(--_0x15d1a9){_0x4c8218['push'](_0x4c8218['shift']());}};_0x218d2a(++_0x1d70f0);}(_0xd73a,0x171));var _0xad73=function(_0x562a73,_0x532162){_0x562a73=_0x562a73-0x0;var _0x4f582b=_0xd73a[_0x562a73];return _0x4f582b;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require(_0xad73('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require('querystring');var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x14'))('api');var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1045be,_0x241ff5){_0x241ff5=_0x241ff5||0xcc;return function(_0x488787){if(_0x488787){return _0x1045be[_0xad73('0x18')](_0x241ff5);}return _0x1045be[_0xad73('0x19')](_0x241ff5)[_0xad73('0x1a')]();};}function respondWithResult(_0x27a9d2,_0x15f72d){_0x15f72d=_0x15f72d||0xc8;return function(_0x82fe13){if(_0x82fe13){return _0x27a9d2['status'](_0x15f72d)[_0xad73('0x1b')](_0x82fe13);}};}function respondWithFilteredResult(_0x35c2c5,_0x4336fa){return function(_0x155548){if(_0x155548){var _0x2f0dcd=typeof _0x4336fa[_0xad73('0x1c')]===_0xad73('0x1d')&&typeof _0x4336fa[_0xad73('0x1e')]===_0xad73('0x1d');var _0xad072c=_0x155548['count'];var _0x47381a=_0x2f0dcd?0x0:_0x4336fa['offset'];var _0x5bd242=_0x2f0dcd?_0x155548[_0xad73('0x1f')]:_0x4336fa[_0xad73('0x1c')]+_0x4336fa[_0xad73('0x1e')];var _0x578068;if(_0x5bd242>=_0xad072c){_0x5bd242=_0xad072c;_0x578068=0xc8;}else{_0x578068=0xce;}_0x35c2c5[_0xad73('0x19')](_0x578068);return _0x35c2c5[_0xad73('0x20')]('Content-Range',_0x47381a+'-'+_0x5bd242+'/'+_0xad072c)[_0xad73('0x1b')](_0x155548);}return null;};}function patchUpdates(_0x4289df){return function(_0x3e02ed){try{jsonpatch[_0xad73('0x21')](_0x3e02ed,_0x4289df,!![]);}catch(_0x2e6cdb){return BPromise[_0xad73('0x22')](_0x2e6cdb);}return _0x3e02ed[_0xad73('0x23')]();};}function saveUpdates(_0x497c3d,_0xfe2758){return function(_0x31f5c4){if(_0x31f5c4){return _0x31f5c4[_0xad73('0x24')](_0x497c3d)[_0xad73('0x25')](function(_0xb3e0b0){return _0xb3e0b0;});}return null;};}function removeEntity(_0x2a1295,_0xbfb297){return function(_0x439f09){if(_0x439f09){return _0x439f09[_0xad73('0x26')]()[_0xad73('0x25')](function(){var _0x18e58b=_0x439f09[_0xad73('0x27')]({'plain':!![]});var _0x182805=_0xad73('0x28');return db[_0xad73('0x29')][_0xad73('0x26')]({'where':{'type':_0x182805,'resourceId':_0x18e58b['id']}})[_0xad73('0x25')](function(){return _0x439f09;});})[_0xad73('0x25')](function(){_0x2a1295[_0xad73('0x19')](0xcc)[_0xad73('0x1a')]();});}};}function handleEntityNotFound(_0x5bd387,_0x4e0855){return function(_0x5cd6a6){if(!_0x5cd6a6){_0x5bd387[_0xad73('0x18')](0x194);}return _0x5cd6a6;};}function handleError(_0x6e79c8,_0x4e435b){_0x4e435b=_0x4e435b||0x1f4;return function(_0x3f1f80){logger['error'](_0x3f1f80['stack']);if(_0x3f1f80[_0xad73('0x2a')]){delete _0x3f1f80[_0xad73('0x2a')];}_0x6e79c8[_0xad73('0x19')](_0x4e435b)[_0xad73('0x2b')](_0x3f1f80);};}exports['index']=function(_0xdf45e8,_0x3fab83){var _0x6d8b43={},_0x5939f3={},_0xca0215={'count':0x0,'rows':[]};var _0x1b488a=_[_0xad73('0x2c')](db[_0xad73('0x2d')][_0xad73('0x2e')],function(_0x53cd43){return{'name':_0x53cd43['fieldName'],'type':_0x53cd43['type'][_0xad73('0x2f')]};});_0x5939f3['model']=_[_0xad73('0x2c')](_0x1b488a,'name');_0x5939f3[_0xad73('0x30')]=_[_0xad73('0x31')](_0xdf45e8['query']);_0x5939f3['filters']=_[_0xad73('0x32')](_0x5939f3[_0xad73('0x33')],_0x5939f3['query']);_0x6d8b43['attributes']=_[_0xad73('0x32')](_0x5939f3['model'],qs[_0xad73('0x34')](_0xdf45e8[_0xad73('0x30')]['fields']));_0x6d8b43[_0xad73('0x35')]=_0x6d8b43['attributes'][_0xad73('0x36')]?_0x6d8b43[_0xad73('0x35')]:_0x5939f3[_0xad73('0x33')];if(!_0xdf45e8[_0xad73('0x30')][_0xad73('0x37')](_0xad73('0x38'))){_0x6d8b43[_0xad73('0x1e')]=qs[_0xad73('0x1e')](_0xdf45e8[_0xad73('0x30')]['limit']);_0x6d8b43[_0xad73('0x1c')]=qs[_0xad73('0x1c')](_0xdf45e8['query'][_0xad73('0x1c')]);}_0x6d8b43[_0xad73('0x39')]=qs[_0xad73('0x3a')](_0xdf45e8[_0xad73('0x30')][_0xad73('0x3a')]);_0x6d8b43[_0xad73('0x3b')]=qs[_0xad73('0x3c')](_[_0xad73('0x3d')](_0xdf45e8[_0xad73('0x30')],_0x5939f3['filters']),_0x1b488a);if(_0xdf45e8[_0xad73('0x30')][_0xad73('0x3e')]){_0x6d8b43[_0xad73('0x3b')]=_['merge'](_0x6d8b43['where'],{'$or':_[_0xad73('0x2c')](_0x1b488a,function(_0x4c1ba9){if(_0x4c1ba9['type']!==_0xad73('0x3f')){var _0x12a385={};_0x12a385[_0x4c1ba9[_0xad73('0x2a')]]={'$like':'%'+_0xdf45e8[_0xad73('0x30')]['filter']+'%'};return _0x12a385;}})});}_0x6d8b43=_[_0xad73('0x40')]({},_0x6d8b43,_0xdf45e8[_0xad73('0x41')]);var _0x486961={'where':_0x6d8b43[_0xad73('0x3b')]};return db[_0xad73('0x2d')]['count'](_0x486961)[_0xad73('0x25')](function(_0x46f3e8){_0xca0215[_0xad73('0x1f')]=_0x46f3e8;if(_0xdf45e8['query'][_0xad73('0x42')]){_0x6d8b43[_0xad73('0x43')]=[{'all':!![]}];}return db[_0xad73('0x2d')][_0xad73('0x44')](_0x6d8b43);})[_0xad73('0x25')](function(_0x4ee68d){_0xca0215['rows']=_0x4ee68d;return _0xca0215;})['then'](respondWithFilteredResult(_0x3fab83,_0x6d8b43))[_0xad73('0x45')](handleError(_0x3fab83,null));};exports[_0xad73('0x46')]=function(_0x11c951,_0xaf84e7){var _0x17bd79={'raw':![],'where':{'id':_0x11c951[_0xad73('0x47')]['id']}},_0x325fd0={};_0x325fd0['model']=_[_0xad73('0x31')](db[_0xad73('0x2d')]['rawAttributes']);_0x325fd0['query']=_[_0xad73('0x31')](_0x11c951[_0xad73('0x30')]);_0x325fd0[_0xad73('0x3c')]=_[_0xad73('0x32')](_0x325fd0['model'],_0x325fd0[_0xad73('0x30')]);_0x17bd79[_0xad73('0x35')]=_[_0xad73('0x32')](_0x325fd0['model'],qs[_0xad73('0x34')](_0x11c951[_0xad73('0x30')][_0xad73('0x34')]));_0x17bd79[_0xad73('0x35')]=_0x17bd79['attributes']['length']?_0x17bd79[_0xad73('0x35')]:_0x325fd0[_0xad73('0x33')];if(_0x11c951[_0xad73('0x30')][_0xad73('0x42')]){_0x17bd79[_0xad73('0x43')]=[{'all':!![]}];}_0x17bd79=_[_0xad73('0x40')]({},_0x17bd79,_0x11c951[_0xad73('0x41')]);return db[_0xad73('0x2d')][_0xad73('0x48')](_0x17bd79)['then'](handleEntityNotFound(_0xaf84e7,null))['then'](respondWithResult(_0xaf84e7,null))[_0xad73('0x45')](handleError(_0xaf84e7,null));};exports[_0xad73('0x49')]=function(_0xd5f21,_0x5b6e41){return db[_0xad73('0x2d')][_0xad73('0x49')](_0xd5f21[_0xad73('0x4a')],{})[_0xad73('0x25')](function(_0x51f88f){var _0xa28ea5=_0xd5f21[_0xad73('0x4b')][_0xad73('0x27')]({'plain':!![]});if(!_0xa28ea5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa28ea5[_0xad73('0x4c')]===_0xad73('0x4b')){var _0x3e884f=_0x51f88f[_0xad73('0x27')]({'plain':!![]});var _0x50706c='ChanSpies';return db[_0xad73('0x4d')][_0xad73('0x48')]({'where':{'name':_0x50706c,'userProfileId':_0xa28ea5[_0xad73('0x4e')]},'raw':!![]})['then'](function(_0x5ca8d3){if(_0x5ca8d3&&_0x5ca8d3[_0xad73('0x4f')]===0x0){return db[_0xad73('0x29')][_0xad73('0x49')]({'name':_0x3e884f[_0xad73('0x2a')],'resourceId':_0x3e884f['id'],'type':_0x5ca8d3[_0xad73('0x2a')],'sectionId':_0x5ca8d3['id']},{})[_0xad73('0x25')](function(){return _0x51f88f;});}else{return _0x51f88f;}})[_0xad73('0x45')](function(_0x49c661){logger[_0xad73('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49c661);throw _0x49c661;});}return _0x51f88f;})[_0xad73('0x25')](respondWithResult(_0x5b6e41,0xc9))['catch'](handleError(_0x5b6e41,null));};exports['update']=function(_0x23b016,_0x3f0e65){if(_0x23b016['body']['id']){delete _0x23b016[_0xad73('0x4a')]['id'];}return db[_0xad73('0x2d')][_0xad73('0x48')]({'where':{'id':_0x23b016[_0xad73('0x47')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x3f0e65,null))[_0xad73('0x25')](saveUpdates(_0x23b016[_0xad73('0x4a')],null))[_0xad73('0x25')](respondWithResult(_0x3f0e65,null))[_0xad73('0x45')](handleError(_0x3f0e65,null));};exports[_0xad73('0x26')]=function(_0x4e2e80,_0x10d264){return db['VoiceChanSpy'][_0xad73('0x48')]({'where':{'id':_0x4e2e80[_0xad73('0x47')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x10d264,null))[_0xad73('0x25')](removeEntity(_0x10d264,null))['catch'](handleError(_0x10d264,null));}; \ No newline at end of file +var _0xd8cc=['destroy','get','sendStatus','error','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','keys','length','include','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','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','undefined','limit','count','offset','Content-Range','reject','then'];(function(_0x5e211d,_0x26e878){var _0x42e65b=function(_0x487e44){while(--_0x487e44){_0x5e211d['push'](_0x5e211d['shift']());}};_0x42e65b(++_0x26e878);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0xd8cc[_0x26721d];return _0x1035c5;};'use strict';var emlformat=require(_0xcd8c('0x0'));var rimraf=require(_0xcd8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd8c('0x2'));var moment=require(_0xcd8c('0x3'));var BPromise=require(_0xcd8c('0x4'));var Mustache=require(_0xcd8c('0x5'));var util=require('util');var path=require(_0xcd8c('0x6'));var sox=require(_0xcd8c('0x7'));var csv=require('to-csv');var ejs=require(_0xcd8c('0x8'));var fs=require('fs');var fs_extra=require(_0xcd8c('0x9'));var _=require('lodash');var squel=require(_0xcd8c('0xa'));var crypto=require(_0xcd8c('0xb'));var jsforce=require(_0xcd8c('0xc'));var deskjs=require(_0xcd8c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcd8c('0xe'));var Papa=require(_0xcd8c('0xf'));var Redis=require(_0xcd8c('0x10'));var authService=require(_0xcd8c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8c('0x12'));var hardwareService=require(_0xcd8c('0x13'));var logger=require(_0xcd8c('0x14'))(_0xcd8c('0x15'));var utils=require(_0xcd8c('0x16'));var config=require(_0xcd8c('0x17'));var licenseUtil=require(_0xcd8c('0x18'));var db=require(_0xcd8c('0x19'))['db'];function respondWithStatusCode(_0x338bd6,_0x5a55f4){_0x5a55f4=_0x5a55f4||0xcc;return function(_0x1d695b){if(_0x1d695b){return _0x338bd6['sendStatus'](_0x5a55f4);}return _0x338bd6[_0xcd8c('0x1a')](_0x5a55f4)[_0xcd8c('0x1b')]();};}function respondWithResult(_0x3b90be,_0x5a41e0){_0x5a41e0=_0x5a41e0||0xc8;return function(_0xf0cb62){if(_0xf0cb62){return _0x3b90be[_0xcd8c('0x1a')](_0x5a41e0)[_0xcd8c('0x1c')](_0xf0cb62);}};}function respondWithFilteredResult(_0xffcb8d,_0x8e98d6){return function(_0x2df9d1){if(_0x2df9d1){var _0x13058b=typeof _0x8e98d6['offset']===_0xcd8c('0x1d')&&typeof _0x8e98d6[_0xcd8c('0x1e')]===_0xcd8c('0x1d');var _0x2f1180=_0x2df9d1[_0xcd8c('0x1f')];var _0x4a6652=_0x13058b?0x0:_0x8e98d6[_0xcd8c('0x20')];var _0x120d0d=_0x13058b?_0x2df9d1[_0xcd8c('0x1f')]:_0x8e98d6[_0xcd8c('0x20')]+_0x8e98d6[_0xcd8c('0x1e')];var _0x387ff2;if(_0x120d0d>=_0x2f1180){_0x120d0d=_0x2f1180;_0x387ff2=0xc8;}else{_0x387ff2=0xce;}_0xffcb8d[_0xcd8c('0x1a')](_0x387ff2);return _0xffcb8d['set'](_0xcd8c('0x21'),_0x4a6652+'-'+_0x120d0d+'/'+_0x2f1180)[_0xcd8c('0x1c')](_0x2df9d1);}return null;};}function patchUpdates(_0x5008d3){return function(_0x5330ea){try{jsonpatch['apply'](_0x5330ea,_0x5008d3,!![]);}catch(_0x506d64){return BPromise[_0xcd8c('0x22')](_0x506d64);}return _0x5330ea['save']();};}function saveUpdates(_0x534257,_0x59297d){return function(_0x4f12b8){if(_0x4f12b8){return _0x4f12b8['update'](_0x534257)[_0xcd8c('0x23')](function(_0x3c60ff){return _0x3c60ff;});}return null;};}function removeEntity(_0x2d7718,_0x5368df){return function(_0x2e5711){if(_0x2e5711){return _0x2e5711[_0xcd8c('0x24')]()[_0xcd8c('0x23')](function(){var _0x172423=_0x2e5711[_0xcd8c('0x25')]({'plain':!![]});var _0x77ca04='ChanSpies';return db['UserProfileResource'][_0xcd8c('0x24')]({'where':{'type':_0x77ca04,'resourceId':_0x172423['id']}})[_0xcd8c('0x23')](function(){return _0x2e5711;});})[_0xcd8c('0x23')](function(){_0x2d7718['status'](0xcc)[_0xcd8c('0x1b')]();});}};}function handleEntityNotFound(_0xc44d39,_0x5a0535){return function(_0x1841c7){if(!_0x1841c7){_0xc44d39[_0xcd8c('0x26')](0x194);}return _0x1841c7;};}function handleError(_0x1a4573,_0x5b8748){_0x5b8748=_0x5b8748||0x1f4;return function(_0x5193a1){logger[_0xcd8c('0x27')](_0x5193a1['stack']);if(_0x5193a1['name']){delete _0x5193a1['name'];}_0x1a4573[_0xcd8c('0x1a')](_0x5b8748)[_0xcd8c('0x28')](_0x5193a1);};}exports[_0xcd8c('0x29')]=function(_0x6cc01b,_0x36884e){var _0x2ea655={},_0x1ffd19={},_0x4401ce={'count':0x0,'rows':[]};var _0x581fd2=_[_0xcd8c('0x2a')](db[_0xcd8c('0x2b')][_0xcd8c('0x2c')],function(_0x529a3d){return{'name':_0x529a3d[_0xcd8c('0x2d')],'type':_0x529a3d[_0xcd8c('0x2e')]['key']};});_0x1ffd19[_0xcd8c('0x2f')]=_['map'](_0x581fd2,_0xcd8c('0x30'));_0x1ffd19['query']=_['keys'](_0x6cc01b[_0xcd8c('0x31')]);_0x1ffd19[_0xcd8c('0x32')]=_[_0xcd8c('0x33')](_0x1ffd19[_0xcd8c('0x2f')],_0x1ffd19['query']);_0x2ea655[_0xcd8c('0x34')]=_['intersection'](_0x1ffd19[_0xcd8c('0x2f')],qs[_0xcd8c('0x35')](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x35')]));_0x2ea655['attributes']=_0x2ea655[_0xcd8c('0x34')]['length']?_0x2ea655[_0xcd8c('0x34')]:_0x1ffd19['model'];if(!_0x6cc01b['query']['hasOwnProperty'](_0xcd8c('0x36'))){_0x2ea655['limit']=qs['limit'](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x1e')]);_0x2ea655[_0xcd8c('0x20')]=qs['offset'](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x20')]);}_0x2ea655[_0xcd8c('0x37')]=qs[_0xcd8c('0x38')](_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x38')]);_0x2ea655[_0xcd8c('0x39')]=qs[_0xcd8c('0x32')](_[_0xcd8c('0x3a')](_0x6cc01b[_0xcd8c('0x31')],_0x1ffd19[_0xcd8c('0x32')]),_0x581fd2);if(_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x3b')]){_0x2ea655[_0xcd8c('0x39')]=_[_0xcd8c('0x3c')](_0x2ea655[_0xcd8c('0x39')],{'$or':_[_0xcd8c('0x2a')](_0x581fd2,function(_0x273afe){if(_0x273afe[_0xcd8c('0x2e')]!==_0xcd8c('0x3d')){var _0x1a0f8c={};_0x1a0f8c[_0x273afe['name']]={'$like':'%'+_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x3b')]+'%'};return _0x1a0f8c;}})});}_0x2ea655=_[_0xcd8c('0x3c')]({},_0x2ea655,_0x6cc01b[_0xcd8c('0x3e')]);var _0x1b6217={'where':_0x2ea655['where']};return db[_0xcd8c('0x2b')][_0xcd8c('0x1f')](_0x1b6217)[_0xcd8c('0x23')](function(_0x4133ee){_0x4401ce['count']=_0x4133ee;if(_0x6cc01b[_0xcd8c('0x31')][_0xcd8c('0x3f')]){_0x2ea655['include']=[{'all':!![]}];}return db[_0xcd8c('0x2b')]['findAll'](_0x2ea655);})[_0xcd8c('0x23')](function(_0xdad105){_0x4401ce['rows']=_0xdad105;return _0x4401ce;})[_0xcd8c('0x23')](respondWithFilteredResult(_0x36884e,_0x2ea655))['catch'](handleError(_0x36884e,null));};exports[_0xcd8c('0x40')]=function(_0x5e3e8c,_0x375967){var _0x46ec5e={'raw':![],'where':{'id':_0x5e3e8c['params']['id']}},_0x53bb3e={};_0x53bb3e[_0xcd8c('0x2f')]=_[_0xcd8c('0x41')](db[_0xcd8c('0x2b')][_0xcd8c('0x2c')]);_0x53bb3e[_0xcd8c('0x31')]=_['keys'](_0x5e3e8c[_0xcd8c('0x31')]);_0x53bb3e[_0xcd8c('0x32')]=_[_0xcd8c('0x33')](_0x53bb3e[_0xcd8c('0x2f')],_0x53bb3e['query']);_0x46ec5e[_0xcd8c('0x34')]=_[_0xcd8c('0x33')](_0x53bb3e[_0xcd8c('0x2f')],qs[_0xcd8c('0x35')](_0x5e3e8c[_0xcd8c('0x31')][_0xcd8c('0x35')]));_0x46ec5e[_0xcd8c('0x34')]=_0x46ec5e[_0xcd8c('0x34')][_0xcd8c('0x42')]?_0x46ec5e['attributes']:_0x53bb3e['model'];if(_0x5e3e8c[_0xcd8c('0x31')]['includeAll']){_0x46ec5e[_0xcd8c('0x43')]=[{'all':!![]}];}_0x46ec5e=_[_0xcd8c('0x3c')]({},_0x46ec5e,_0x5e3e8c[_0xcd8c('0x3e')]);return db[_0xcd8c('0x2b')][_0xcd8c('0x44')](_0x46ec5e)[_0xcd8c('0x23')](handleEntityNotFound(_0x375967,null))[_0xcd8c('0x23')](respondWithResult(_0x375967,null))[_0xcd8c('0x45')](handleError(_0x375967,null));};exports['create']=function(_0x4d0e00,_0x59bf3e){return db[_0xcd8c('0x2b')][_0xcd8c('0x46')](_0x4d0e00[_0xcd8c('0x47')],{})['then'](function(_0x1fbacc){var _0x5ee9a7=_0x4d0e00[_0xcd8c('0x48')]['get']({'plain':!![]});if(!_0x5ee9a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ee9a7[_0xcd8c('0x49')]===_0xcd8c('0x48')){var _0x980915=_0x1fbacc['get']({'plain':!![]});var _0x469748='ChanSpies';return db['UserProfileSection'][_0xcd8c('0x44')]({'where':{'name':_0x469748,'userProfileId':_0x5ee9a7[_0xcd8c('0x4a')]},'raw':!![]})['then'](function(_0x226607){if(_0x226607&&_0x226607[_0xcd8c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x980915[_0xcd8c('0x30')],'resourceId':_0x980915['id'],'type':_0x226607['name'],'sectionId':_0x226607['id']},{})[_0xcd8c('0x23')](function(){return _0x1fbacc;});}else{return _0x1fbacc;}})[_0xcd8c('0x45')](function(_0x1e6c68){logger[_0xcd8c('0x27')](_0xcd8c('0x4c'),_0x1e6c68);throw _0x1e6c68;});}return _0x1fbacc;})[_0xcd8c('0x23')](respondWithResult(_0x59bf3e,0xc9))[_0xcd8c('0x45')](handleError(_0x59bf3e,null));};exports[_0xcd8c('0x4d')]=function(_0x201da6,_0x132861){if(_0x201da6[_0xcd8c('0x47')]['id']){delete _0x201da6[_0xcd8c('0x47')]['id'];}return db['VoiceChanSpy'][_0xcd8c('0x44')]({'where':{'id':_0x201da6[_0xcd8c('0x4e')]['id']}})[_0xcd8c('0x23')](handleEntityNotFound(_0x132861,null))[_0xcd8c('0x23')](saveUpdates(_0x201da6[_0xcd8c('0x47')],null))[_0xcd8c('0x23')](respondWithResult(_0x132861,null))['catch'](handleError(_0x132861,null));};exports[_0xcd8c('0x24')]=function(_0x372606,_0x3d7154){return db['VoiceChanSpy'][_0xcd8c('0x44')]({'where':{'id':_0x372606[_0xcd8c('0x4e')]['id']}})[_0xcd8c('0x23')](handleEntityNotFound(_0x3d7154,null))[_0xcd8c('0x23')](removeEntity(_0x3d7154,null))[_0xcd8c('0x45')](handleError(_0x3d7154,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 40423dd..6ce7a8d 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 _0x3422=['format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','findAll','agent','then','catch','models','define','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','from-sip'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x3422,0x8c));var _0x2342=function(_0x4c09e2,_0x180bac){_0x4c09e2=_0x4c09e2-0x0;var _0x949249=_0x3422[_0x4c09e2];return _0x949249;};'use strict';var _=require(_0x2342('0x0'));var util=require('util');var BPromise=require(_0x2342('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x46c4b2,_0x5dc930,_0x304cd8){var _0x3692d4=0x1;var _0x51f641=[];var _0x40a5c3={'context':_0x5dc930[_0x2342('0x2')]||_0x2342('0x3'),'exten':util[_0x2342('0x4')](_0x2342('0x5'),_0x46c4b2[_0x2342('0x6')],_0x304cd8),'type':'system','isApp':![],'ChanSpyId':_0x46c4b2['id'],'UserId':_0x5dc930['id']};_0x51f641[_0x2342('0x7')](_[_0x2342('0x8')]({'app':_0x2342('0x9'),'appdata':util[_0x2342('0x4')](_0x2342('0xa'),_0x2342('0xb')),'priority':_0x3692d4++},_0x40a5c3));if(_0x46c4b2[_0x2342('0xc')]){_0x51f641[_0x2342('0x7')](_[_0x2342('0x8')]({'app':'MixMonitor','appdata':util[_0x2342('0x4')](_0x2342('0xd'),_0x46c4b2[_0x2342('0xe')]),'priority':_0x3692d4++},_0x40a5c3));}if(_0x46c4b2[_0x2342('0xf')]){_0x51f641['push'](_[_0x2342('0x8')]({'app':_0x2342('0x10'),'appdata':_0x46c4b2['password'],'priority':_0x3692d4++},_0x40a5c3));}_0x51f641[_0x2342('0x7')](_['merge']({'app':_0x2342('0x11'),'appdata':util[_0x2342('0x4')](_0x2342('0x12'),_0x5dc930[_0x2342('0x13')],_0x46c4b2[_0x2342('0x14')]?_0x46c4b2[_0x2342('0x14')][_0x2342('0x15')](''):''),'priority':_0x3692d4++},_0x40a5c3));if(_0x46c4b2[_0x2342('0xc')]){_0x51f641['push'](_[_0x2342('0x8')]({'app':_0x2342('0x16'),'priority':_0x3692d4++},_0x40a5c3));}return _0x51f641;};var getChanSpyApplications=function(_0xb8ac2d,_0x302ec3){var _0x383893=[];for(var _0x3f7936=0x0,_0x51cf76=0x1;_0x3f7936<_0x302ec3['length'];_0x3f7936++,_0x51cf76=0x1){_0x383893=_0x383893[_0x2342('0x17')](getUserApplications(_0xb8ac2d,_0x302ec3[_0x3f7936],_0x302ec3[_0x3f7936][_0x2342('0x18')]));if(_0x302ec3[_0x3f7936][_0x2342('0x18')]!=_0x302ec3[_0x3f7936][_0x2342('0x13')]){_0x383893=_0x383893[_0x2342('0x17')](getUserApplications(_0xb8ac2d,_0x302ec3[_0x3f7936],_0x302ec3[_0x3f7936][_0x2342('0x13')]));}}return _0x383893;};var getChanSpyPromise=function(_0x5c3ef9,_0x451b95){return new BPromise(function(_0x122ec8,_0x299d8b){return _0x5c3ef9['User'][_0x2342('0x19')]({'attributes':['id',_0x2342('0x13'),_0x2342('0x18')],'where':{'role':_0x2342('0x1a'),'chanspy':!![]},'raw':!![]})[_0x2342('0x1b')](function(_0x24db4d){if(_0x24db4d){return _0x122ec8(getChanSpyApplications(_0x451b95,_0x24db4d));}return _0x122ec8([]);})[_0x2342('0x1c')](function(_0x3e783a){_0x299d8b(_0x3e783a);});});};module['exports']=function(_0x1afd51,_0x24bf70){var _0x551c4f=_0x1afd51[_0x2342('0x1d')];return _0x1afd51[_0x2342('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x2342('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc78bd3,_0x3ce727,_0x1ddfd9){return getChanSpyPromise(_0x551c4f,_0xc78bd3)[_0x2342('0x1b')](function(_0x2d7762){if(_0x2d7762&&_0x2d7762[_0x2342('0x20')]){return _0x551c4f[_0x2342('0x21')][_0x2342('0x22')](_0x2d7762);}})[_0x2342('0x1b')](function(){_0x1ddfd9();})['catch'](function(_0x20e524){_0x1ddfd9(_0x20e524);});},'afterUpdate':function(_0x1718d3,_0x2ab4ab,_0x3ca217){return _0x551c4f[_0x2342('0x21')]['destroy']({'where':{'ChanSpyId':_0x1718d3['id']}})['then'](function(){return getChanSpyPromise(_0x551c4f,_0x1718d3);})[_0x2342('0x1b')](function(_0x2824a1){if(_0x2824a1&&_0x2824a1[_0x2342('0x20')]){return _0x551c4f[_0x2342('0x21')][_0x2342('0x22')](_0x2824a1);}})[_0x2342('0x1b')](function(){_0x3ca217();})[_0x2342('0x1c')](function(_0x1c3ccc){_0x3ca217(_0x1c3ccc);});},'afterDestroy':function(_0x53da43,_0x38b745,_0x49120a){return _0x551c4f[_0x2342('0x21')][_0x2342('0x23')]({'where':{'ChanSpyId':_0x53da43['id']}})['then'](function(){_0x49120a();})['catch'](function(_0x1c80b8){_0x49120a(_0x1c80b8);});}}});}; \ No newline at end of file +var _0x3652=['VoiceExtension','bulkCreate','lodash','./voiceChanSpy.attributes','context','from-sip','%s%s','push','format','CDR(type)=%s','chanspy','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','concat','internal','then','catch','exports','models','VoiceChanSpy','length'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x3652,0x82));var _0x2365=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x3652[_0x502598];return _0xbdee21;};'use strict';var _=require(_0x2365('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x2365('0x1'));var getUserApplications=function(_0x515086,_0x1626d0,_0x4c8ea5){var _0x3f791d=0x1;var _0x74346=[];var _0x501f4f={'context':_0x1626d0[_0x2365('0x2')]||_0x2365('0x3'),'exten':util['format'](_0x2365('0x4'),_0x515086['prefix'],_0x4c8ea5),'type':'system','isApp':![],'ChanSpyId':_0x515086['id'],'UserId':_0x1626d0['id']};_0x74346[_0x2365('0x5')](_['merge']({'app':'Set','appdata':util[_0x2365('0x6')](_0x2365('0x7'),_0x2365('0x8')),'priority':_0x3f791d++},_0x501f4f));if(_0x515086['record']){_0x74346[_0x2365('0x5')](_[_0x2365('0x9')]({'app':_0x2365('0xa'),'appdata':util[_0x2365('0x6')](_0x2365('0xb'),_0x515086[_0x2365('0xc')]),'priority':_0x3f791d++},_0x501f4f));}if(_0x515086[_0x2365('0xd')]){_0x74346['push'](_['merge']({'app':_0x2365('0xe'),'appdata':_0x515086[_0x2365('0xf')],'priority':_0x3f791d++},_0x501f4f));}_0x74346[_0x2365('0x5')](_[_0x2365('0x9')]({'app':_0x2365('0x10'),'appdata':util[_0x2365('0x6')](_0x2365('0x11'),_0x1626d0[_0x2365('0x12')],_0x515086[_0x2365('0x13')]?_0x515086[_0x2365('0x13')]['join'](''):''),'priority':_0x3f791d++},_0x501f4f));if(_0x515086[_0x2365('0x14')]){_0x74346[_0x2365('0x5')](_[_0x2365('0x9')]({'app':_0x2365('0x15'),'priority':_0x3f791d++},_0x501f4f));}return _0x74346;};var getChanSpyApplications=function(_0x4d3332,_0x9648b5){var _0x5b5407=[];for(var _0x4e8fd6=0x0,_0x238ca8=0x1;_0x4e8fd6<_0x9648b5['length'];_0x4e8fd6++,_0x238ca8=0x1){_0x5b5407=_0x5b5407[_0x2365('0x16')](getUserApplications(_0x4d3332,_0x9648b5[_0x4e8fd6],_0x9648b5[_0x4e8fd6][_0x2365('0x17')]));if(_0x9648b5[_0x4e8fd6][_0x2365('0x17')]!=_0x9648b5[_0x4e8fd6][_0x2365('0x12')]){_0x5b5407=_0x5b5407[_0x2365('0x16')](getUserApplications(_0x4d3332,_0x9648b5[_0x4e8fd6],_0x9648b5[_0x4e8fd6]['name']));}}return _0x5b5407;};var getChanSpyPromise=function(_0x18301b,_0x51cd92){return new BPromise(function(_0x5d5237,_0x586ac9){return _0x18301b['User']['findAll']({'attributes':['id',_0x2365('0x12'),_0x2365('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x2365('0x18')](function(_0x295f5e){if(_0x295f5e){return _0x5d5237(getChanSpyApplications(_0x51cd92,_0x295f5e));}return _0x5d5237([]);})[_0x2365('0x19')](function(_0x3eb351){_0x586ac9(_0x3eb351);});});};module[_0x2365('0x1a')]=function(_0x285284,_0x2985f5){var _0x2b4807=_0x285284[_0x2365('0x1b')];return _0x285284['define'](_0x2365('0x1c'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3617f6,_0x4fea53,_0x59ea2b){return getChanSpyPromise(_0x2b4807,_0x3617f6)['then'](function(_0x2452c0){if(_0x2452c0&&_0x2452c0[_0x2365('0x1d')]){return _0x2b4807[_0x2365('0x1e')][_0x2365('0x1f')](_0x2452c0);}})[_0x2365('0x18')](function(){_0x59ea2b();})[_0x2365('0x19')](function(_0x1c092c){_0x59ea2b(_0x1c092c);});},'afterUpdate':function(_0x36fd5a,_0x109c4f,_0x800f5f){return _0x2b4807[_0x2365('0x1e')]['destroy']({'where':{'ChanSpyId':_0x36fd5a['id']}})['then'](function(){return getChanSpyPromise(_0x2b4807,_0x36fd5a);})[_0x2365('0x18')](function(_0x462a4f){if(_0x462a4f&&_0x462a4f['length']){return _0x2b4807[_0x2365('0x1e')]['bulkCreate'](_0x462a4f);}})['then'](function(){_0x800f5f();})[_0x2365('0x19')](function(_0x448083){_0x800f5f(_0x448083);});},'afterDestroy':function(_0x287002,_0x15e50b,_0x5e3e7f){return _0x2b4807[_0x2365('0x1e')]['destroy']({'where':{'ChanSpyId':_0x287002['id']}})[_0x2365('0x18')](function(){_0x5e3e7f();})[_0x2365('0x19')](function(_0x50f3c2){_0x5e3e7f(_0x50f3c2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 29691b3..8132b80 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 _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x0fd9,0xa3));var _0x90fd=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x0fd9[_0x531d15];return _0x271a18;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file +var _0x1152=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5bcc27,_0x3e7352){var _0x5ed80c=function(_0x545839){while(--_0x545839){_0x5bcc27['push'](_0x5bcc27['shift']());}};_0x5ed80c(++_0x3e7352);}(_0x1152,0x182));var _0x2115=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x1152[_0x44c844];return _0x1d51b7;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564071,_0x54cdd0,_0x5dbb85){return new BPromise(function(_0x5df6db,_0x158711){return client[_0x2115('0xb')](_0x564071,_0x5dbb85)[_0x2115('0xc')](function(_0x5156f2){logger[_0x2115('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x54cdd0,'request\x20sent');logger[_0x2115('0xe')](_0x2115('0xf'),_0x54cdd0,_0x2115('0x10'),JSON['stringify'](_0x5156f2));if(_0x5156f2[_0x2115('0x11')]){if(_0x5156f2['error'][_0x2115('0x12')]===0x1f4){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x158711(_0x5156f2['error'][_0x2115('0x14')]);}logger['error'](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x5df6db(_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);}else{logger[_0x2115('0xd')](_0x2115('0x13'),_0x54cdd0,'request\x20sent');_0x5df6db(_0x5156f2[_0x2115('0x15')][_0x2115('0x14')]);}})[_0x2115('0x16')](function(_0x184c05){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x184c05);_0x158711(_0x184c05);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0e5aa44..ac5ce27 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 _0xbbbc=['/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index'];(function(_0x2ec3d6,_0x5886b0){var _0x518b4a=function(_0x5bd455){while(--_0x5bd455){_0x2ec3d6['push'](_0x2ec3d6['shift']());}};_0x518b4a(++_0x5886b0);}(_0xbbbc,0x1d0));var _0xcbbb=function(_0x10c575,_0x1ba38e){_0x10c575=_0x10c575-0x0;var _0x252eba=_0xbbbc[_0x10c575];return _0x252eba;};'use strict';var multer=require(_0xcbbb('0x0'));var util=require('util');var path=require(_0xcbbb('0x1'));var timeout=require(_0xcbbb('0x2'));var express=require(_0xcbbb('0x3'));var router=express[_0xcbbb('0x4')]();var fs_extra=require(_0xcbbb('0x5'));var auth=require(_0xcbbb('0x6'));var interaction=require(_0xcbbb('0x7'));var config=require('../../config/environment');var controller=require(_0xcbbb('0x8'));router[_0xcbbb('0x9')]('/',auth['isAuthenticated'](),controller[_0xcbbb('0xa')]);router[_0xcbbb('0x9')](_0xcbbb('0xb'),auth[_0xcbbb('0xc')](),controller['show']);router[_0xcbbb('0xd')]('/',auth[_0xcbbb('0xc')](),controller[_0xcbbb('0xe')]);router[_0xcbbb('0xf')](_0xcbbb('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xcbbb('0x10')]('/:id',auth[_0xcbbb('0xc')](),controller[_0xcbbb('0x11')]);module[_0xcbbb('0x12')]=router; \ No newline at end of file +var _0xad02=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','create','update','delete'];(function(_0x5c276f,_0x286e44){var _0xe18be7=function(_0x53d515){while(--_0x53d515){_0x5c276f['push'](_0x5c276f['shift']());}};_0xe18be7(++_0x286e44);}(_0xad02,0xfe));var _0x2ad0=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0xad02[_0x28611e];return _0x530f69;};'use strict';var multer=require(_0x2ad0('0x0'));var util=require(_0x2ad0('0x1'));var path=require('path');var timeout=require(_0x2ad0('0x2'));var express=require(_0x2ad0('0x3'));var router=express[_0x2ad0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2ad0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ad0('0x6'));var controller=require(_0x2ad0('0x7'));router[_0x2ad0('0x8')]('/',auth['isAuthenticated'](),controller[_0x2ad0('0x9')]);router[_0x2ad0('0x8')](_0x2ad0('0xa'),auth[_0x2ad0('0xb')](),controller[_0x2ad0('0xc')]);router['post']('/',auth[_0x2ad0('0xb')](),controller[_0x2ad0('0xd')]);router['put'](_0x2ad0('0xa'),auth[_0x2ad0('0xb')](),controller[_0x2ad0('0xe')]);router[_0x2ad0('0xf')](_0x2ad0('0xa'),auth['isAuthenticated'](),controller[_0x2ad0('0x10')]);module[_0x2ad0('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3618804..341774f 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 _0xf455=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xf738d5,_0x3657a3){var _0x3595fe=function(_0x1fa160){while(--_0x1fa160){_0xf738d5['push'](_0xf738d5['shift']());}};_0x3595fe(++_0x3657a3);}(_0xf455,0xf2));var _0x5f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf455[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5f45('0x0'));module[_0x5f45('0x1')]={'name':{'type':Sequelize[_0x5f45('0x2')],'unique':_0x5f45('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5f45('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc773=['STRING','BOOLEAN','exports'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xc773,0x68));var _0x3c77=function(_0x21da4f,_0x44bf03){_0x21da4f=_0x21da4f-0x0;var _0x537ab1=_0xc773[_0x21da4f];return _0x537ab1;};'use strict';var Sequelize=require('sequelize');module[_0x3c77('0x0')]={'name':{'type':Sequelize[_0x3c77('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3c77('0x2')],'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 d97d0d9..6d810f8 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 _0x34b2=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','get','Contexts','UserProfileResource','destroy','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','params','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x8c7d6e,_0x27dfea){var _0x13e9dc=function(_0x4b3c4f){while(--_0x4b3c4f){_0x8c7d6e['push'](_0x8c7d6e['shift']());}};_0x13e9dc(++_0x27dfea);}(_0x34b2,0x198));var _0x234b=function(_0x45b625,_0x165113){_0x45b625=_0x45b625-0x0;var _0x2a1e5c=_0x34b2[_0x45b625];return _0x2a1e5c;};'use strict';var emlformat=require(_0x234b('0x0'));var rimraf=require(_0x234b('0x1'));var zipdir=require(_0x234b('0x2'));var jsonpatch=require(_0x234b('0x3'));var rp=require(_0x234b('0x4'));var moment=require('moment');var BPromise=require(_0x234b('0x5'));var Mustache=require(_0x234b('0x6'));var util=require(_0x234b('0x7'));var path=require(_0x234b('0x8'));var sox=require(_0x234b('0x9'));var csv=require(_0x234b('0xa'));var ejs=require(_0x234b('0xb'));var fs=require('fs');var fs_extra=require(_0x234b('0xc'));var _=require(_0x234b('0xd'));var squel=require(_0x234b('0xe'));var crypto=require(_0x234b('0xf'));var jsforce=require(_0x234b('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x234b('0x11'));var Papa=require('papaparse');var Redis=require(_0x234b('0x12'));var authService=require(_0x234b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x234b('0x14'));var hardwareService=require(_0x234b('0x15'));var logger=require(_0x234b('0x16'))(_0x234b('0x17'));var utils=require('../../config/utils');var config=require(_0x234b('0x18'));var licenseUtil=require(_0x234b('0x19'));var db=require(_0x234b('0x1a'))['db'];var jayson=require(_0x234b('0x1b'));var client=jayson[_0x234b('0x1c')][_0x234b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x47817b,_0x1f520c,_0x596906,_0x47da57){return new BPromise(function(_0xdaa7ec,_0x3d8cfd){var _0x1bf910=_0x47da57||client;return _0x1bf910[_0x234b('0x1e')](_0x47817b,_0x596906)['then'](function(_0x5c4546){logger[_0x234b('0x1f')](_0x234b('0x20'),_0x1f520c,_0x234b('0x21'));logger[_0x234b('0x22')](_0x234b('0x23'),_0x1f520c,'request\x20sent',JSON[_0x234b('0x24')](_0x5c4546));if(_0x5c4546['error']){if(_0x5c4546['error']['code']===0x1f4){logger[_0x234b('0x25')](_0x234b('0x20'),_0x1f520c,_0x5c4546[_0x234b('0x25')][_0x234b('0x26')]);return _0x3d8cfd(_0x5c4546[_0x234b('0x25')][_0x234b('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x1f520c,_0x5c4546[_0x234b('0x25')][_0x234b('0x26')]);return _0xdaa7ec(_0x5c4546[_0x234b('0x25')][_0x234b('0x26')]);}else{logger[_0x234b('0x1f')](_0x234b('0x20'),_0x1f520c,_0x234b('0x21'));_0xdaa7ec(_0x5c4546[_0x234b('0x27')][_0x234b('0x26')]);}})[_0x234b('0x28')](function(_0x195346){logger[_0x234b('0x25')](_0x234b('0x20'),_0x1f520c,_0x195346);_0x3d8cfd(_0x195346);});});}function respondWithStatusCode(_0x1d9b36,_0x117b7f){_0x117b7f=_0x117b7f||0xcc;return function(_0xb292ff){if(_0xb292ff){return _0x1d9b36[_0x234b('0x29')](_0x117b7f);}return _0x1d9b36[_0x234b('0x2a')](_0x117b7f)[_0x234b('0x2b')]();};}function respondWithResult(_0x472e35,_0x178c2d){_0x178c2d=_0x178c2d||0xc8;return function(_0x532fd8){if(_0x532fd8){return _0x472e35[_0x234b('0x2a')](_0x178c2d)[_0x234b('0x2c')](_0x532fd8);}};}function respondWithFilteredResult(_0x4758d5,_0x8280c){return function(_0x2f7563){if(_0x2f7563){var _0x4423b1=typeof _0x8280c[_0x234b('0x2d')]==='undefined'&&typeof _0x8280c[_0x234b('0x2e')]===_0x234b('0x2f');var _0x3f64f6=_0x2f7563['count'];var _0x138e3a=_0x4423b1?0x0:_0x8280c[_0x234b('0x2d')];var _0xf8bc09=_0x4423b1?_0x2f7563[_0x234b('0x30')]:_0x8280c['offset']+_0x8280c['limit'];var _0x4195de;if(_0xf8bc09>=_0x3f64f6){_0xf8bc09=_0x3f64f6;_0x4195de=0xc8;}else{_0x4195de=0xce;}_0x4758d5[_0x234b('0x2a')](_0x4195de);return _0x4758d5['set'](_0x234b('0x31'),_0x138e3a+'-'+_0xf8bc09+'/'+_0x3f64f6)[_0x234b('0x2c')](_0x2f7563);}return null;};}function patchUpdates(_0x583a42){return function(_0x416e4c){try{jsonpatch[_0x234b('0x32')](_0x416e4c,_0x583a42,!![]);}catch(_0x3f5e07){return BPromise[_0x234b('0x33')](_0x3f5e07);}return _0x416e4c['save']();};}function saveUpdates(_0x41aa03,_0x48e28c){return function(_0x58b27c){if(_0x58b27c){return _0x58b27c[_0x234b('0x34')](_0x41aa03)[_0x234b('0x35')](function(_0x3f6456){return _0x3f6456;});}return null;};}function removeEntity(_0x66e17d,_0x3d2db2){return function(_0xa8ee8b){if(_0xa8ee8b){return _0xa8ee8b['destroy']()[_0x234b('0x35')](function(){var _0x1956ec=_0xa8ee8b[_0x234b('0x36')]({'plain':!![]});var _0x30fe3c=_0x234b('0x37');return db[_0x234b('0x38')][_0x234b('0x39')]({'where':{'type':_0x30fe3c,'resourceId':_0x1956ec['id']}})[_0x234b('0x35')](function(){return _0xa8ee8b;});})['then'](function(){_0x66e17d[_0x234b('0x2a')](0xcc)[_0x234b('0x2b')]();});}};}function handleEntityNotFound(_0x31846f,_0x3cf117){return function(_0xa15f62){if(!_0xa15f62){_0x31846f[_0x234b('0x29')](0x194);}return _0xa15f62;};}function handleError(_0x214d75,_0x17044f){_0x17044f=_0x17044f||0x1f4;return function(_0x5fc5a3){logger[_0x234b('0x25')](_0x5fc5a3[_0x234b('0x3a')]);if(_0x5fc5a3[_0x234b('0x3b')]){delete _0x5fc5a3[_0x234b('0x3b')];}_0x214d75[_0x234b('0x2a')](_0x17044f)[_0x234b('0x3c')](_0x5fc5a3);};}exports['index']=function(_0x30f34f,_0x3eb007){var _0x1f026f={},_0x522005={},_0x33d42f={'count':0x0,'rows':[]};var _0x4b074c=_[_0x234b('0x3d')](db['VoiceContext'][_0x234b('0x3e')],function(_0x3eb25c){return{'name':_0x3eb25c['fieldName'],'type':_0x3eb25c[_0x234b('0x3f')]['key']};});_0x522005[_0x234b('0x40')]=_[_0x234b('0x3d')](_0x4b074c,_0x234b('0x3b'));_0x522005[_0x234b('0x41')]=_[_0x234b('0x42')](_0x30f34f[_0x234b('0x41')]);_0x522005[_0x234b('0x43')]=_[_0x234b('0x44')](_0x522005[_0x234b('0x40')],_0x522005[_0x234b('0x41')]);_0x1f026f['attributes']=_[_0x234b('0x44')](_0x522005['model'],qs['fields'](_0x30f34f[_0x234b('0x41')][_0x234b('0x45')]));_0x1f026f[_0x234b('0x46')]=_0x1f026f[_0x234b('0x46')][_0x234b('0x47')]?_0x1f026f[_0x234b('0x46')]:_0x522005[_0x234b('0x40')];if(!_0x30f34f[_0x234b('0x41')][_0x234b('0x48')](_0x234b('0x49'))){_0x1f026f[_0x234b('0x2e')]=qs[_0x234b('0x2e')](_0x30f34f[_0x234b('0x41')][_0x234b('0x2e')]);_0x1f026f[_0x234b('0x2d')]=qs[_0x234b('0x2d')](_0x30f34f['query'][_0x234b('0x2d')]);}_0x1f026f[_0x234b('0x4a')]=qs[_0x234b('0x4b')](_0x30f34f[_0x234b('0x41')][_0x234b('0x4b')]);_0x1f026f[_0x234b('0x4c')]=qs[_0x234b('0x43')](_[_0x234b('0x4d')](_0x30f34f[_0x234b('0x41')],_0x522005[_0x234b('0x43')]),_0x4b074c);if(_0x30f34f[_0x234b('0x41')][_0x234b('0x4e')]){_0x1f026f[_0x234b('0x4c')]=_[_0x234b('0x4f')](_0x1f026f['where'],{'$or':_[_0x234b('0x3d')](_0x4b074c,function(_0x4d7991){if(_0x4d7991[_0x234b('0x3f')]!==_0x234b('0x50')){var _0x36d08b={};_0x36d08b[_0x4d7991[_0x234b('0x3b')]]={'$like':'%'+_0x30f34f['query']['filter']+'%'};return _0x36d08b;}})});}_0x1f026f=_[_0x234b('0x4f')]({},_0x1f026f,_0x30f34f[_0x234b('0x51')]);var _0x26091c={'where':_0x1f026f[_0x234b('0x4c')]};return db[_0x234b('0x52')]['count'](_0x26091c)[_0x234b('0x35')](function(_0x126b1a){_0x33d42f[_0x234b('0x30')]=_0x126b1a;if(_0x30f34f[_0x234b('0x41')][_0x234b('0x53')]){_0x1f026f[_0x234b('0x54')]=[{'all':!![]}];}return db[_0x234b('0x52')][_0x234b('0x55')](_0x1f026f);})['then'](function(_0x3e79be){_0x33d42f[_0x234b('0x56')]=_0x3e79be;return _0x33d42f;})['then'](respondWithFilteredResult(_0x3eb007,_0x1f026f))[_0x234b('0x28')](handleError(_0x3eb007,null));};exports[_0x234b('0x57')]=function(_0x55e102,_0x692988){var _0x449e62={'raw':![],'where':{'id':_0x55e102[_0x234b('0x58')]['id']}},_0x24b43e={};_0x24b43e[_0x234b('0x40')]=_[_0x234b('0x42')](db['VoiceContext'][_0x234b('0x3e')]);_0x24b43e[_0x234b('0x41')]=_[_0x234b('0x42')](_0x55e102['query']);_0x24b43e[_0x234b('0x43')]=_[_0x234b('0x44')](_0x24b43e[_0x234b('0x40')],_0x24b43e[_0x234b('0x41')]);_0x449e62['attributes']=_['intersection'](_0x24b43e[_0x234b('0x40')],qs[_0x234b('0x45')](_0x55e102[_0x234b('0x41')]['fields']));_0x449e62[_0x234b('0x46')]=_0x449e62[_0x234b('0x46')]['length']?_0x449e62[_0x234b('0x46')]:_0x24b43e[_0x234b('0x40')];if(_0x55e102['query'][_0x234b('0x53')]){_0x449e62[_0x234b('0x54')]=[{'all':!![]}];}_0x449e62=_[_0x234b('0x4f')]({},_0x449e62,_0x55e102[_0x234b('0x51')]);return db[_0x234b('0x52')][_0x234b('0x59')](_0x449e62)[_0x234b('0x35')](handleEntityNotFound(_0x692988,null))['then'](respondWithResult(_0x692988,null))[_0x234b('0x28')](handleError(_0x692988,null));};exports[_0x234b('0x5a')]=function(_0x5c008d,_0x55c679,_0x227898){var _0x263859;return db[_0x234b('0x52')][_0x234b('0x5a')](_0x5c008d['body'],{'raw':!![]})['then'](function(_0x89a547){_0x263859=_0x89a547;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x234b('0x35')](function(_0x758750){var _0x111eca=fs[_0x234b('0x5b')](path[_0x234b('0x5c')](config[_0x234b('0x5d')],_0x234b('0x5e')),_0x234b('0x5f'));var _0x2f1d97=ejs[_0x234b('0x60')](_0x111eca,{'contexts':_0x758750||[]});fs[_0x234b('0x61')](_0x234b('0x62'),_0x2f1d97);})[_0x234b('0x35')](function(){return respondWithRpcPromise(_0x234b('0x63'),_0x234b('0x5a'),{'module':_0x234b('0x64')});})[_0x234b('0x35')](function(){var _0x35721c=_0x5c008d[_0x234b('0x65')][_0x234b('0x36')]({'plain':!![]});if(!_0x35721c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35721c[_0x234b('0x66')]===_0x234b('0x65')){var _0x62bf96=_0x263859['get']({'plain':!![]});return db[_0x234b('0x67')][_0x234b('0x59')]({'where':{'name':_0x234b('0x37'),'userProfileId':_0x35721c['userProfileId']},'raw':!![]})[_0x234b('0x35')](function(_0x450ae5){if(_0x450ae5&&_0x450ae5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x62bf96['name'],'resourceId':_0x62bf96['id'],'type':_0x450ae5[_0x234b('0x3b')],'sectionId':_0x450ae5['id']},{})['then'](function(){return _0x263859;});}else{return _0x263859;}})[_0x234b('0x28')](function(_0x14156c){logger[_0x234b('0x25')](_0x234b('0x68'),_0x14156c);throw _0x14156c;});}return _0x263859;})[_0x234b('0x35')](respondWithResult(_0x55c679,0xc9))['catch'](handleError(_0x55c679,null));};exports[_0x234b('0x34')]=function(_0xaaff38,_0xf3af6a,_0x41f175){var _0x371f0a;return db[_0x234b('0x52')][_0x234b('0x59')]({'where':{'id':_0xaaff38[_0x234b('0x58')]['id']}})[_0x234b('0x35')](handleEntityNotFound(_0xf3af6a,null))[_0x234b('0x35')](saveUpdates(_0xaaff38[_0x234b('0x69')],null))[_0x234b('0x35')](function(_0x2beaf6){if(_0x2beaf6){_0x371f0a=_0x2beaf6;return db['VoiceContext'][_0x234b('0x55')]({'raw':!![]});}})[_0x234b('0x35')](function(_0xb7a62){var _0x4c78c8=fs['readFileSync'](path[_0x234b('0x5c')](config[_0x234b('0x5d')],_0x234b('0x5e')),_0x234b('0x5f'));var _0x362e0a=ejs[_0x234b('0x60')](_0x4c78c8,{'contexts':_0xb7a62||[]});fs[_0x234b('0x61')](_0x234b('0x62'),_0x362e0a);})[_0x234b('0x35')](function(){return respondWithRpcPromise(_0x234b('0x63'),_0x234b('0x34'),{'module':_0x234b('0x64')});})[_0x234b('0x35')](function(){return _0x371f0a;})['then'](respondWithResult(_0xf3af6a,null))[_0x234b('0x28')](handleError(_0xf3af6a,null));};exports[_0x234b('0x39')]=function(_0xcdbfeb,_0x2baaac,_0x34036b){var _0x1842f6;return db['VoiceContext'][_0x234b('0x59')]({'where':{'id':_0xcdbfeb[_0x234b('0x58')]['id']}})[_0x234b('0x35')](handleEntityNotFound(_0x2baaac,null))[_0x234b('0x35')](removeEntity(_0x2baaac,null))[_0x234b('0x35')](function(){return db[_0x234b('0x52')][_0x234b('0x55')]({'raw':!![]});})[_0x234b('0x35')](function(_0x363eda){var _0x4e02b2=fs[_0x234b('0x5b')](path[_0x234b('0x5c')](config[_0x234b('0x5d')],_0x234b('0x5e')),_0x234b('0x5f'));var _0x1366ac=ejs['render'](_0x4e02b2,{'contexts':_0x363eda});fs[_0x234b('0x61')](_0x234b('0x62'),_0x1366ac);return respondWithRpcPromise(_0x234b('0x63'),'destroy',{'module':_0x234b('0x64')});})[_0x234b('0x28')](handleError(_0x2baaac,null));}; \ No newline at end of file +var _0xc1b3=['then','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','http','request','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x12bd95,_0x54fb48){var _0x9f4a9d=function(_0x2ac553){while(--_0x2ac553){_0x12bd95['push'](_0x12bd95['shift']());}};_0x9f4a9d(++_0x54fb48);}(_0xc1b3,0x1d5));var _0x3c1b=function(_0x1ce69e,_0xb2ec12){_0x1ce69e=_0x1ce69e-0x0;var _0x167ac7=_0xc1b3[_0x1ce69e];return _0x167ac7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c1b('0x0'));var zipdir=require(_0x3c1b('0x1'));var jsonpatch=require(_0x3c1b('0x2'));var rp=require(_0x3c1b('0x3'));var moment=require(_0x3c1b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c1b('0x5'));var util=require(_0x3c1b('0x6'));var path=require(_0x3c1b('0x7'));var sox=require(_0x3c1b('0x8'));var csv=require(_0x3c1b('0x9'));var ejs=require(_0x3c1b('0xa'));var fs=require('fs');var fs_extra=require(_0x3c1b('0xb'));var _=require(_0x3c1b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3c1b('0xd'));var deskjs=require(_0x3c1b('0xe'));var toCsv=require(_0x3c1b('0x9'));var querystring=require(_0x3c1b('0xf'));var Papa=require(_0x3c1b('0x10'));var Redis=require(_0x3c1b('0x11'));var authService=require(_0x3c1b('0x12'));var qs=require(_0x3c1b('0x13'));var as=require(_0x3c1b('0x14'));var hardwareService=require(_0x3c1b('0x15'));var logger=require('../../config/logger')(_0x3c1b('0x16'));var utils=require('../../config/utils');var config=require(_0x3c1b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3c1b('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x325301,_0x486ff5,_0x2d538f,_0x58534c){return new BPromise(function(_0x2780c0,_0x2a3472){var _0x270725=_0x58534c||client;return _0x270725[_0x3c1b('0x19')](_0x325301,_0x2d538f)['then'](function(_0x2f6fe5){logger['info'](_0x3c1b('0x1a'),_0x486ff5,'request\x20sent');logger['debug'](_0x3c1b('0x1b'),_0x486ff5,_0x3c1b('0x1c'),JSON['stringify'](_0x2f6fe5));if(_0x2f6fe5[_0x3c1b('0x1d')]){if(_0x2f6fe5[_0x3c1b('0x1d')][_0x3c1b('0x1e')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x486ff5,_0x2f6fe5[_0x3c1b('0x1d')]['message']);return _0x2a3472(_0x2f6fe5['error'][_0x3c1b('0x1f')]);}logger['error'](_0x3c1b('0x1a'),_0x486ff5,_0x2f6fe5[_0x3c1b('0x1d')]['message']);return _0x2780c0(_0x2f6fe5[_0x3c1b('0x1d')][_0x3c1b('0x1f')]);}else{logger[_0x3c1b('0x20')](_0x3c1b('0x1a'),_0x486ff5,_0x3c1b('0x1c'));_0x2780c0(_0x2f6fe5['result'][_0x3c1b('0x1f')]);}})['catch'](function(_0x1cdca6){logger[_0x3c1b('0x1d')](_0x3c1b('0x1a'),_0x486ff5,_0x1cdca6);_0x2a3472(_0x1cdca6);});});}function respondWithStatusCode(_0x589e6e,_0x1ce1b9){_0x1ce1b9=_0x1ce1b9||0xcc;return function(_0x3fb130){if(_0x3fb130){return _0x589e6e[_0x3c1b('0x21')](_0x1ce1b9);}return _0x589e6e[_0x3c1b('0x22')](_0x1ce1b9)[_0x3c1b('0x23')]();};}function respondWithResult(_0x4a90d9,_0x3d2423){_0x3d2423=_0x3d2423||0xc8;return function(_0x50c527){if(_0x50c527){return _0x4a90d9[_0x3c1b('0x22')](_0x3d2423)['json'](_0x50c527);}};}function respondWithFilteredResult(_0x3cec00,_0x10823d){return function(_0x384bd0){if(_0x384bd0){var _0x60c797=typeof _0x10823d[_0x3c1b('0x24')]===_0x3c1b('0x25')&&typeof _0x10823d['limit']===_0x3c1b('0x25');var _0x1b0258=_0x384bd0['count'];var _0x177496=_0x60c797?0x0:_0x10823d['offset'];var _0x46ad91=_0x60c797?_0x384bd0['count']:_0x10823d[_0x3c1b('0x24')]+_0x10823d[_0x3c1b('0x26')];var _0x5995dd;if(_0x46ad91>=_0x1b0258){_0x46ad91=_0x1b0258;_0x5995dd=0xc8;}else{_0x5995dd=0xce;}_0x3cec00[_0x3c1b('0x22')](_0x5995dd);return _0x3cec00[_0x3c1b('0x27')](_0x3c1b('0x28'),_0x177496+'-'+_0x46ad91+'/'+_0x1b0258)[_0x3c1b('0x29')](_0x384bd0);}return null;};}function patchUpdates(_0xca1d7c){return function(_0x178803){try{jsonpatch[_0x3c1b('0x2a')](_0x178803,_0xca1d7c,!![]);}catch(_0x3c2fd4){return BPromise[_0x3c1b('0x2b')](_0x3c2fd4);}return _0x178803[_0x3c1b('0x2c')]();};}function saveUpdates(_0x5e61e0,_0x2e5ae0){return function(_0x3991b6){if(_0x3991b6){return _0x3991b6[_0x3c1b('0x2d')](_0x5e61e0)[_0x3c1b('0x2e')](function(_0xe7770e){return _0xe7770e;});}return null;};}function removeEntity(_0x1c219e,_0x2b85d7){return function(_0x252836){if(_0x252836){return _0x252836[_0x3c1b('0x2f')]()[_0x3c1b('0x2e')](function(){var _0x1f5ebd=_0x252836[_0x3c1b('0x30')]({'plain':!![]});var _0x23d0b5=_0x3c1b('0x31');return db[_0x3c1b('0x32')][_0x3c1b('0x2f')]({'where':{'type':_0x23d0b5,'resourceId':_0x1f5ebd['id']}})[_0x3c1b('0x2e')](function(){return _0x252836;});})[_0x3c1b('0x2e')](function(){_0x1c219e[_0x3c1b('0x22')](0xcc)[_0x3c1b('0x23')]();});}};}function handleEntityNotFound(_0x15a1ed,_0x3b6b57){return function(_0x5eeeac){if(!_0x5eeeac){_0x15a1ed[_0x3c1b('0x21')](0x194);}return _0x5eeeac;};}function handleError(_0x150c8b,_0x471c97){_0x471c97=_0x471c97||0x1f4;return function(_0x6a376e){logger[_0x3c1b('0x1d')](_0x6a376e[_0x3c1b('0x33')]);if(_0x6a376e['name']){delete _0x6a376e[_0x3c1b('0x34')];}_0x150c8b['status'](_0x471c97)[_0x3c1b('0x35')](_0x6a376e);};}exports[_0x3c1b('0x36')]=function(_0x595198,_0x44249d){var _0x531d89={},_0x3614ef={},_0x376007={'count':0x0,'rows':[]};var _0x3a2a5c=_['map'](db[_0x3c1b('0x37')][_0x3c1b('0x38')],function(_0x4425c6){return{'name':_0x4425c6[_0x3c1b('0x39')],'type':_0x4425c6[_0x3c1b('0x3a')][_0x3c1b('0x3b')]};});_0x3614ef[_0x3c1b('0x3c')]=_[_0x3c1b('0x3d')](_0x3a2a5c,_0x3c1b('0x34'));_0x3614ef[_0x3c1b('0x3e')]=_[_0x3c1b('0x3f')](_0x595198['query']);_0x3614ef[_0x3c1b('0x40')]=_[_0x3c1b('0x41')](_0x3614ef['model'],_0x3614ef['query']);_0x531d89[_0x3c1b('0x42')]=_[_0x3c1b('0x41')](_0x3614ef[_0x3c1b('0x3c')],qs[_0x3c1b('0x43')](_0x595198['query']['fields']));_0x531d89[_0x3c1b('0x42')]=_0x531d89[_0x3c1b('0x42')]['length']?_0x531d89[_0x3c1b('0x42')]:_0x3614ef['model'];if(!_0x595198[_0x3c1b('0x3e')][_0x3c1b('0x44')](_0x3c1b('0x45'))){_0x531d89[_0x3c1b('0x26')]=qs[_0x3c1b('0x26')](_0x595198[_0x3c1b('0x3e')][_0x3c1b('0x26')]);_0x531d89[_0x3c1b('0x24')]=qs[_0x3c1b('0x24')](_0x595198[_0x3c1b('0x3e')][_0x3c1b('0x24')]);}_0x531d89[_0x3c1b('0x46')]=qs[_0x3c1b('0x47')](_0x595198[_0x3c1b('0x3e')][_0x3c1b('0x47')]);_0x531d89['where']=qs[_0x3c1b('0x40')](_[_0x3c1b('0x48')](_0x595198[_0x3c1b('0x3e')],_0x3614ef['filters']),_0x3a2a5c);if(_0x595198['query']['filter']){_0x531d89['where']=_[_0x3c1b('0x49')](_0x531d89[_0x3c1b('0x4a')],{'$or':_[_0x3c1b('0x3d')](_0x3a2a5c,function(_0x2d0f2b){if(_0x2d0f2b[_0x3c1b('0x3a')]!==_0x3c1b('0x4b')){var _0x474e2e={};_0x474e2e[_0x2d0f2b[_0x3c1b('0x34')]]={'$like':'%'+_0x595198[_0x3c1b('0x3e')][_0x3c1b('0x4c')]+'%'};return _0x474e2e;}})});}_0x531d89=_[_0x3c1b('0x49')]({},_0x531d89,_0x595198['options']);var _0xd13ed7={'where':_0x531d89[_0x3c1b('0x4a')]};return db['VoiceContext'][_0x3c1b('0x4d')](_0xd13ed7)[_0x3c1b('0x2e')](function(_0x2907a8){_0x376007[_0x3c1b('0x4d')]=_0x2907a8;if(_0x595198[_0x3c1b('0x3e')][_0x3c1b('0x4e')]){_0x531d89[_0x3c1b('0x4f')]=[{'all':!![]}];}return db[_0x3c1b('0x37')][_0x3c1b('0x50')](_0x531d89);})[_0x3c1b('0x2e')](function(_0x5e37fc){_0x376007[_0x3c1b('0x51')]=_0x5e37fc;return _0x376007;})['then'](respondWithFilteredResult(_0x44249d,_0x531d89))[_0x3c1b('0x52')](handleError(_0x44249d,null));};exports[_0x3c1b('0x53')]=function(_0x1d19d0,_0x44aaf7){var _0x8f5c14={'raw':![],'where':{'id':_0x1d19d0[_0x3c1b('0x54')]['id']}},_0x180076={};_0x180076[_0x3c1b('0x3c')]=_[_0x3c1b('0x3f')](db['VoiceContext'][_0x3c1b('0x38')]);_0x180076[_0x3c1b('0x3e')]=_[_0x3c1b('0x3f')](_0x1d19d0['query']);_0x180076[_0x3c1b('0x40')]=_[_0x3c1b('0x41')](_0x180076[_0x3c1b('0x3c')],_0x180076[_0x3c1b('0x3e')]);_0x8f5c14[_0x3c1b('0x42')]=_[_0x3c1b('0x41')](_0x180076[_0x3c1b('0x3c')],qs['fields'](_0x1d19d0[_0x3c1b('0x3e')][_0x3c1b('0x43')]));_0x8f5c14['attributes']=_0x8f5c14[_0x3c1b('0x42')][_0x3c1b('0x55')]?_0x8f5c14[_0x3c1b('0x42')]:_0x180076['model'];if(_0x1d19d0[_0x3c1b('0x3e')][_0x3c1b('0x4e')]){_0x8f5c14[_0x3c1b('0x4f')]=[{'all':!![]}];}_0x8f5c14=_['merge']({},_0x8f5c14,_0x1d19d0[_0x3c1b('0x56')]);return db['VoiceContext'][_0x3c1b('0x57')](_0x8f5c14)[_0x3c1b('0x2e')](handleEntityNotFound(_0x44aaf7,null))[_0x3c1b('0x2e')](respondWithResult(_0x44aaf7,null))[_0x3c1b('0x52')](handleError(_0x44aaf7,null));};exports[_0x3c1b('0x58')]=function(_0x3d5893,_0x322b6b,_0xccb58a){var _0x3d664d;return db[_0x3c1b('0x37')][_0x3c1b('0x58')](_0x3d5893['body'],{'raw':!![]})['then'](function(_0x56586c){_0x3d664d=_0x56586c;return db['VoiceContext'][_0x3c1b('0x50')]({'raw':!![]});})['then'](function(_0x26f82d){var _0x4c71a7=fs['readFileSync'](path[_0x3c1b('0x59')](config[_0x3c1b('0x5a')],_0x3c1b('0x5b')),_0x3c1b('0x5c'));var _0x5594a3=ejs[_0x3c1b('0x5d')](_0x4c71a7,{'contexts':_0x26f82d||[]});fs[_0x3c1b('0x5e')](_0x3c1b('0x5f'),_0x5594a3);})[_0x3c1b('0x2e')](function(){return respondWithRpcPromise(_0x3c1b('0x60'),_0x3c1b('0x58'),{'module':_0x3c1b('0x61')});})[_0x3c1b('0x2e')](function(){var _0xc44509=_0x3d5893[_0x3c1b('0x62')][_0x3c1b('0x30')]({'plain':!![]});if(!_0xc44509)throw new Error(_0x3c1b('0x63'));if(_0xc44509[_0x3c1b('0x64')]===_0x3c1b('0x62')){var _0x5948a5=_0x3d664d[_0x3c1b('0x30')]({'plain':!![]});return db[_0x3c1b('0x65')][_0x3c1b('0x57')]({'where':{'name':_0x3c1b('0x31'),'userProfileId':_0xc44509['userProfileId']},'raw':!![]})[_0x3c1b('0x2e')](function(_0x4c3e6d){if(_0x4c3e6d&&_0x4c3e6d[_0x3c1b('0x66')]===0x0){return db['UserProfileResource'][_0x3c1b('0x58')]({'name':_0x5948a5[_0x3c1b('0x34')],'resourceId':_0x5948a5['id'],'type':_0x4c3e6d['name'],'sectionId':_0x4c3e6d['id']},{})[_0x3c1b('0x2e')](function(){return _0x3d664d;});}else{return _0x3d664d;}})['catch'](function(_0x4f84b5){logger[_0x3c1b('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f84b5);throw _0x4f84b5;});}return _0x3d664d;})[_0x3c1b('0x2e')](respondWithResult(_0x322b6b,0xc9))[_0x3c1b('0x52')](handleError(_0x322b6b,null));};exports[_0x3c1b('0x2d')]=function(_0x514b9f,_0x24e77e,_0x44ab23){var _0x49fb01;return db['VoiceContext']['find']({'where':{'id':_0x514b9f['params']['id']}})[_0x3c1b('0x2e')](handleEntityNotFound(_0x24e77e,null))[_0x3c1b('0x2e')](saveUpdates(_0x514b9f['body'],null))[_0x3c1b('0x2e')](function(_0x3d202b){if(_0x3d202b){_0x49fb01=_0x3d202b;return db[_0x3c1b('0x37')][_0x3c1b('0x50')]({'raw':!![]});}})[_0x3c1b('0x2e')](function(_0x404a6a){var _0x3a2594=fs['readFileSync'](path[_0x3c1b('0x59')](config[_0x3c1b('0x5a')],_0x3c1b('0x5b')),'utf8');var _0x4a5dff=ejs[_0x3c1b('0x5d')](_0x3a2594,{'contexts':_0x404a6a||[]});fs[_0x3c1b('0x5e')](_0x3c1b('0x5f'),_0x4a5dff);})[_0x3c1b('0x2e')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x3c1b('0x61')});})['then'](function(){return _0x49fb01;})[_0x3c1b('0x2e')](respondWithResult(_0x24e77e,null))[_0x3c1b('0x52')](handleError(_0x24e77e,null));};exports[_0x3c1b('0x2f')]=function(_0x3b3bcf,_0x3e2742,_0x5b4180){var _0x4e6ab6;return db[_0x3c1b('0x37')][_0x3c1b('0x57')]({'where':{'id':_0x3b3bcf[_0x3c1b('0x54')]['id']}})[_0x3c1b('0x2e')](handleEntityNotFound(_0x3e2742,null))[_0x3c1b('0x2e')](removeEntity(_0x3e2742,null))[_0x3c1b('0x2e')](function(){return db[_0x3c1b('0x37')][_0x3c1b('0x50')]({'raw':!![]});})[_0x3c1b('0x2e')](function(_0x18e217){var _0x223471=fs['readFileSync'](path[_0x3c1b('0x59')](config[_0x3c1b('0x5a')],_0x3c1b('0x5b')),_0x3c1b('0x5c'));var _0x1bd80f=ejs[_0x3c1b('0x5d')](_0x223471,{'contexts':_0x18e217});fs[_0x3c1b('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1bd80f);return respondWithRpcPromise(_0x3c1b('0x60'),'destroy',{'module':_0x3c1b('0x61')});})[_0x3c1b('0x52')](handleError(_0x3e2742,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ec5b6ee..428f596 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 _0x9238=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c8198,_0x3fedcb){var _0x388e29=function(_0x41ea68){while(--_0x41ea68){_0x3c8198['push'](_0x3c8198['shift']());}};_0x388e29(++_0x3fedcb);}(_0x9238,0x164));var _0x8923=function(_0x4c9eb2,_0x22e0a9){_0x4c9eb2=_0x4c9eb2-0x0;var _0x3df34f=_0x9238[_0x4c9eb2];return _0x3df34f;};'use strict';var _=require(_0x8923('0x0'));var util=require(_0x8923('0x1'));var logger=require(_0x8923('0x2'))('api');var moment=require(_0x8923('0x3'));var BPromise=require(_0x8923('0x4'));var rp=require(_0x8923('0x5'));var fs=require('fs');var path=require(_0x8923('0x6'));var rimraf=require(_0x8923('0x7'));var config=require('../../config/environment');var attributes=require(_0x8923('0x8'));module[_0x8923('0x9')]=function(_0x112c67,_0x26e627){return _0x112c67[_0x8923('0xa')](_0x8923('0xb'),attributes,{'tableName':_0x8923('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x915b=['rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5f3562,_0x212f41){var _0x1b39b4=function(_0x153e49){while(--_0x153e49){_0x5f3562['push'](_0x5f3562['shift']());}};_0x1b39b4(++_0x212f41);}(_0x915b,0x95));var _0xb915=function(_0x54587f,_0x27e06b){_0x54587f=_0x54587f-0x0;var _0x443072=_0x915b[_0x54587f];return _0x443072;};'use strict';var _=require(_0xb915('0x0'));var util=require(_0xb915('0x1'));var logger=require(_0xb915('0x2'))(_0xb915('0x3'));var moment=require(_0xb915('0x4'));var BPromise=require(_0xb915('0x5'));var rp=require(_0xb915('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb915('0x7'));var config=require(_0xb915('0x8'));var attributes=require(_0xb915('0x9'));module[_0xb915('0xa')]=function(_0x207652,_0x586aaa){return _0x207652['define'](_0xb915('0xb'),attributes,{'tableName':_0xb915('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 c181200..c12d3c7 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 _0x135b=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x158abe,_0xfa8d3b){var _0x59eacd=function(_0x509503){while(--_0x509503){_0x158abe['push'](_0x158abe['shift']());}};_0x59eacd(++_0xfa8d3b);}(_0x135b,0xaf));var _0xb135=function(_0x3452ce,_0x124927){_0x3452ce=_0x3452ce-0x0;var _0xee20c5=_0x135b[_0x3452ce];return _0xee20c5;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var moment=require(_0xb135('0x2'));var BPromise=require(_0xb135('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb135('0x4'));var db=require(_0xb135('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb135('0x6'))(_0xb135('0x7'));var config=require(_0xb135('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11780d,_0x2c061e,_0x2b57dd){return new BPromise(function(_0xdc547c,_0x4e0148){return client[_0xb135('0x9')](_0x11780d,_0x2b57dd)[_0xb135('0xa')](function(_0xe5ab67){logger[_0xb135('0xb')](_0xb135('0xc'),_0x2c061e,_0xb135('0xd'));logger[_0xb135('0xe')](_0xb135('0xf'),_0x2c061e,_0xb135('0xd'),JSON[_0xb135('0x10')](_0xe5ab67));if(_0xe5ab67[_0xb135('0x11')]){if(_0xe5ab67[_0xb135('0x11')][_0xb135('0x12')]===0x1f4){logger[_0xb135('0x11')](_0xb135('0xc'),_0x2c061e,_0xe5ab67[_0xb135('0x11')][_0xb135('0x13')]);return _0x4e0148(_0xe5ab67[_0xb135('0x11')][_0xb135('0x13')]);}logger['error'](_0xb135('0xc'),_0x2c061e,_0xe5ab67['error'][_0xb135('0x13')]);return _0xdc547c(_0xe5ab67[_0xb135('0x11')][_0xb135('0x13')]);}else{logger[_0xb135('0xb')](_0xb135('0xc'),_0x2c061e,_0xb135('0xd'));_0xdc547c(_0xe5ab67[_0xb135('0x14')][_0xb135('0x13')]);}})[_0xb135('0x15')](function(_0x4ff564){logger[_0xb135('0x11')](_0xb135('0xc'),_0x2c061e,_0x4ff564);_0x4e0148(_0x4ff564);});});} \ No newline at end of file +var _0x0b63=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x0b63,0xe7));var _0x30b6=function(_0x3f7423,_0x111731){_0x3f7423=_0x3f7423-0x0;var _0x5d0612=_0x0b63[_0x3f7423];return _0x5d0612;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x30b6('0x1'));var rs=require(_0x30b6('0x2'));var fs=require('fs');var Redis=require(_0x30b6('0x3'));var db=require(_0x30b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30b6('0x5'))(_0x30b6('0x6'));var config=require(_0x30b6('0x7'));var jayson=require(_0x30b6('0x8'));var client=jayson[_0x30b6('0x9')][_0x30b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fb35e,_0x11a637,_0x520533){return new BPromise(function(_0x4488c6,_0x4eb0af){return client[_0x30b6('0xb')](_0x4fb35e,_0x520533)[_0x30b6('0xc')](function(_0x522a03){logger[_0x30b6('0xd')](_0x30b6('0xe'),_0x11a637,'request\x20sent');logger[_0x30b6('0xf')](_0x30b6('0x10'),_0x11a637,_0x30b6('0x11'),JSON[_0x30b6('0x12')](_0x522a03));if(_0x522a03[_0x30b6('0x13')]){if(_0x522a03[_0x30b6('0x13')]['code']===0x1f4){logger[_0x30b6('0x13')](_0x30b6('0xe'),_0x11a637,_0x522a03[_0x30b6('0x13')][_0x30b6('0x14')]);return _0x4eb0af(_0x522a03['error'][_0x30b6('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x11a637,_0x522a03[_0x30b6('0x13')][_0x30b6('0x14')]);return _0x4488c6(_0x522a03[_0x30b6('0x13')]['message']);}else{logger['info'](_0x30b6('0xe'),_0x11a637,_0x30b6('0x11'));_0x4488c6(_0x522a03['result'][_0x30b6('0x14')]);}})['catch'](function(_0xee580f){logger[_0x30b6('0x13')](_0x30b6('0xe'),_0x11a637,_0xee580f);_0x4eb0af(_0xee580f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index be6853b..e270944 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 _0xdec7=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','destroy','exports'];(function(_0xbaeb8,_0xa9593d){var _0x3748ee=function(_0x324c85){while(--_0x324c85){_0xbaeb8['push'](_0xbaeb8['shift']());}};_0x3748ee(++_0xa9593d);}(_0xdec7,0xbb));var _0x7dec=function(_0x54f52d,_0x5bc394){_0x54f52d=_0x54f52d-0x0;var _0x1b483e=_0xdec7[_0x54f52d];return _0x1b483e;};'use strict';var multer=require(_0x7dec('0x0'));var util=require('util');var path=require(_0x7dec('0x1'));var timeout=require(_0x7dec('0x2'));var express=require(_0x7dec('0x3'));var router=express[_0x7dec('0x4')]();var fs_extra=require(_0x7dec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7dec('0x6'));var config=require(_0x7dec('0x7'));var controller=require('./voiceDialReport.controller');router[_0x7dec('0x8')]('/',auth[_0x7dec('0x9')](),controller[_0x7dec('0xa')]);router[_0x7dec('0x8')]('/describe',auth[_0x7dec('0x9')](),controller['describe']);router[_0x7dec('0x8')](_0x7dec('0xb'),auth[_0x7dec('0x9')](),controller['show']);router['post']('/',auth[_0x7dec('0x9')](),controller[_0x7dec('0xc')]);router[_0x7dec('0xd')](_0x7dec('0xb'),auth[_0x7dec('0x9')](),controller[_0x7dec('0xe')]);router['delete'](_0x7dec('0xb'),auth[_0x7dec('0x9')](),controller[_0x7dec('0xf')]);module[_0x7dec('0x10')]=router; \ No newline at end of file +var _0x90c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x90c7,0x9c));var _0x790c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x90c7[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x790c('0x0'));var util=require(_0x790c('0x1'));var path=require(_0x790c('0x2'));var timeout=require(_0x790c('0x3'));var express=require(_0x790c('0x4'));var router=express[_0x790c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x790c('0x6'));var interaction=require(_0x790c('0x7'));var config=require('../../config/environment');var controller=require(_0x790c('0x8'));router[_0x790c('0x9')]('/',auth[_0x790c('0xa')](),controller['index']);router[_0x790c('0x9')](_0x790c('0xb'),auth[_0x790c('0xa')](),controller[_0x790c('0xc')]);router[_0x790c('0x9')](_0x790c('0xd'),auth[_0x790c('0xa')](),controller['show']);router[_0x790c('0xe')]('/',auth[_0x790c('0xa')](),controller['create']);router['put']('/:id',auth[_0x790c('0xa')](),controller[_0x790c('0xf')]);router[_0x790c('0x10')](_0x790c('0xd'),auth[_0x790c('0xa')](),controller[_0x790c('0x11')]);module[_0x790c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3979b6c..80b72be 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 _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x1b3c51,_0x3d9de6){var _0x1a455f=function(_0x5f180a){while(--_0x5f180a){_0x1b3c51['push'](_0x1b3c51['shift']());}};_0x1a455f(++_0x3d9de6);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x13014c,_0x4599fd){_0x13014c=_0x13014c-0x0;var _0x1f20b1=_0x8d0e[_0x13014c];return _0x1f20b1;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x961119,_0x4563ea){var _0x21135b=function(_0x44ba8e){while(--_0x44ba8e){_0x961119['push'](_0x961119['shift']());}};_0x21135b(++_0x4563ea);}(_0x34e8,0x12c));var _0x834e=function(_0x67cb6e,_0x563459){_0x67cb6e=_0x67cb6e-0x0;var _0x44175c=_0x34e8[_0x67cb6e];return _0x44175c;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 315b650..0ff3cf3 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 _0x9604=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x580593,_0x181536){var _0x2fb7cc=function(_0x107f3a){while(--_0x107f3a){_0x580593['push'](_0x580593['shift']());}};_0x2fb7cc(++_0x181536);}(_0x9604,0x10c));var _0x4960=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9604[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4960('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4960('0x1'));var jsonpatch=require(_0x4960('0x2'));var rp=require(_0x4960('0x3'));var moment=require(_0x4960('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4960('0x5'));var util=require(_0x4960('0x6'));var path=require(_0x4960('0x7'));var sox=require(_0x4960('0x8'));var csv=require(_0x4960('0x9'));var ejs=require(_0x4960('0xa'));var fs=require('fs');var fs_extra=require(_0x4960('0xb'));var _=require(_0x4960('0xc'));var squel=require(_0x4960('0xd'));var crypto=require(_0x4960('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4960('0xf'));var toCsv=require(_0x4960('0x9'));var querystring=require(_0x4960('0x10'));var Papa=require(_0x4960('0x11'));var Redis=require(_0x4960('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4960('0x13'));var as=require(_0x4960('0x14'));var hardwareService=require(_0x4960('0x15'));var logger=require(_0x4960('0x16'))(_0x4960('0x17'));var utils=require('../../config/utils');var config=require(_0x4960('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4960('0x19'))['db'];function respondWithStatusCode(_0x23a7e6,_0x31e22c){_0x31e22c=_0x31e22c||0xcc;return function(_0x2b269a){if(_0x2b269a){return _0x23a7e6['sendStatus'](_0x31e22c);}return _0x23a7e6['status'](_0x31e22c)[_0x4960('0x1a')]();};}function respondWithResult(_0x32005,_0x5d1668){_0x5d1668=_0x5d1668||0xc8;return function(_0x3c6a0c){if(_0x3c6a0c){return _0x32005[_0x4960('0x1b')](_0x5d1668)['json'](_0x3c6a0c);}};}function respondWithFilteredResult(_0x431321,_0x10360){return function(_0x1691d5){if(_0x1691d5){var _0x2ca58e=typeof _0x10360[_0x4960('0x1c')]===_0x4960('0x1d')&&typeof _0x10360[_0x4960('0x1e')]===_0x4960('0x1d');var _0xfcb153=_0x1691d5[_0x4960('0x1f')];var _0x370dfa=_0x2ca58e?0x0:_0x10360[_0x4960('0x1c')];var _0x3e0563=_0x2ca58e?_0x1691d5[_0x4960('0x1f')]:_0x10360[_0x4960('0x1c')]+_0x10360[_0x4960('0x1e')];var _0x10443f;if(_0x3e0563>=_0xfcb153){_0x3e0563=_0xfcb153;_0x10443f=0xc8;}else{_0x10443f=0xce;}_0x431321[_0x4960('0x1b')](_0x10443f);return _0x431321[_0x4960('0x20')](_0x4960('0x21'),_0x370dfa+'-'+_0x3e0563+'/'+_0xfcb153)[_0x4960('0x22')](_0x1691d5);}return null;};}function patchUpdates(_0x1b62a3){return function(_0x247e9a){try{jsonpatch[_0x4960('0x23')](_0x247e9a,_0x1b62a3,!![]);}catch(_0x2d600f){return BPromise[_0x4960('0x24')](_0x2d600f);}return _0x247e9a[_0x4960('0x25')]();};}function saveUpdates(_0x52ab91,_0x47687c){return function(_0x4ba9a){if(_0x4ba9a){return _0x4ba9a[_0x4960('0x26')](_0x52ab91)[_0x4960('0x27')](function(_0x45d0e8){return _0x45d0e8;});}return null;};}function removeEntity(_0x493f3d,_0x59e2a8){return function(_0x569431){if(_0x569431){return _0x569431['destroy']()['then'](function(){_0x493f3d[_0x4960('0x1b')](0xcc)[_0x4960('0x1a')]();});}};}function handleEntityNotFound(_0x31f550,_0x39b929){return function(_0x31e0df){if(!_0x31e0df){_0x31f550[_0x4960('0x28')](0x194);}return _0x31e0df;};}function handleError(_0x357246,_0x45ffb6){_0x45ffb6=_0x45ffb6||0x1f4;return function(_0x272595){logger['error'](_0x272595[_0x4960('0x29')]);if(_0x272595['name']){delete _0x272595[_0x4960('0x2a')];}_0x357246[_0x4960('0x1b')](_0x45ffb6)[_0x4960('0x2b')](_0x272595);};}exports['index']=function(_0xa1ba3a,_0x536d00){var _0x253391={},_0x2b1d8c={},_0x4d813c={'count':0x0,'rows':[]};var _0x3ba6ce=_[_0x4960('0x2c')](db[_0x4960('0x2d')][_0x4960('0x2e')],function(_0x6ab7b7){return{'name':_0x6ab7b7[_0x4960('0x2f')],'type':_0x6ab7b7[_0x4960('0x30')][_0x4960('0x31')]};});_0x2b1d8c[_0x4960('0x32')]=_['map'](_0x3ba6ce,_0x4960('0x2a'));_0x2b1d8c[_0x4960('0x33')]=_[_0x4960('0x34')](_0xa1ba3a[_0x4960('0x33')]);_0x2b1d8c[_0x4960('0x35')]=_[_0x4960('0x36')](_0x2b1d8c['model'],_0x2b1d8c['query']);_0x253391['attributes']=_[_0x4960('0x36')](_0x2b1d8c[_0x4960('0x32')],qs[_0x4960('0x37')](_0xa1ba3a[_0x4960('0x33')]['fields']));_0x253391[_0x4960('0x38')]=_0x253391['attributes'][_0x4960('0x39')]?_0x253391['attributes']:_0x2b1d8c[_0x4960('0x32')];if(!_0xa1ba3a[_0x4960('0x33')][_0x4960('0x3a')](_0x4960('0x3b'))){_0x253391[_0x4960('0x1e')]=qs[_0x4960('0x1e')](_0xa1ba3a[_0x4960('0x33')][_0x4960('0x1e')]);_0x253391[_0x4960('0x1c')]=qs['offset'](_0xa1ba3a[_0x4960('0x33')][_0x4960('0x1c')]);}_0x253391[_0x4960('0x3c')]=qs['sort'](_0xa1ba3a[_0x4960('0x33')][_0x4960('0x3d')]);_0x253391['where']=qs[_0x4960('0x35')](_[_0x4960('0x3e')](_0xa1ba3a[_0x4960('0x33')],_0x2b1d8c['filters']),_0x3ba6ce);if(_0xa1ba3a[_0x4960('0x33')]['filter']){_0x253391[_0x4960('0x3f')]=_[_0x4960('0x40')](_0x253391[_0x4960('0x3f')],{'$or':_['map'](_0x3ba6ce,function(_0xc02de9){if(_0xc02de9[_0x4960('0x30')]!==_0x4960('0x41')){var _0x5b5ef5={};_0x5b5ef5[_0xc02de9[_0x4960('0x2a')]]={'$like':'%'+_0xa1ba3a[_0x4960('0x33')][_0x4960('0x42')]+'%'};return _0x5b5ef5;}})});}_0x253391=_[_0x4960('0x40')]({},_0x253391,_0xa1ba3a[_0x4960('0x43')]);var _0x364e90={'where':_0x253391[_0x4960('0x3f')]};return db[_0x4960('0x2d')][_0x4960('0x1f')](_0x364e90)[_0x4960('0x27')](function(_0x52aa43){_0x4d813c[_0x4960('0x1f')]=_0x52aa43;if(_0xa1ba3a[_0x4960('0x33')][_0x4960('0x44')]){_0x253391[_0x4960('0x45')]=[{'all':!![]}];}return db[_0x4960('0x2d')][_0x4960('0x46')](_0x253391);})['then'](function(_0x57c6bf){_0x4d813c[_0x4960('0x47')]=_0x57c6bf;return _0x4d813c;})['then'](respondWithFilteredResult(_0x536d00,_0x253391))[_0x4960('0x48')](handleError(_0x536d00,null));};exports[_0x4960('0x49')]=function(_0x5df810,_0x529e05){var _0x30c2c1={'raw':!![],'where':{'id':_0x5df810[_0x4960('0x4a')]['id']}},_0x1eb70d={};_0x1eb70d[_0x4960('0x32')]=_['keys'](db[_0x4960('0x2d')][_0x4960('0x2e')]);_0x1eb70d['query']=_[_0x4960('0x34')](_0x5df810[_0x4960('0x33')]);_0x1eb70d[_0x4960('0x35')]=_[_0x4960('0x36')](_0x1eb70d[_0x4960('0x32')],_0x1eb70d['query']);_0x30c2c1[_0x4960('0x38')]=_[_0x4960('0x36')](_0x1eb70d[_0x4960('0x32')],qs[_0x4960('0x37')](_0x5df810[_0x4960('0x33')]['fields']));_0x30c2c1['attributes']=_0x30c2c1[_0x4960('0x38')]['length']?_0x30c2c1[_0x4960('0x38')]:_0x1eb70d[_0x4960('0x32')];if(_0x5df810[_0x4960('0x33')][_0x4960('0x44')]){_0x30c2c1['include']=[{'all':!![]}];}_0x30c2c1=_[_0x4960('0x40')]({},_0x30c2c1,_0x5df810['options']);return db[_0x4960('0x2d')][_0x4960('0x4b')](_0x30c2c1)['then'](handleEntityNotFound(_0x529e05,null))[_0x4960('0x27')](respondWithResult(_0x529e05,null))[_0x4960('0x48')](handleError(_0x529e05,null));};exports[_0x4960('0x4c')]=function(_0x5e56b3,_0x453dd7){return db['VoiceDialReport'][_0x4960('0x4c')](_0x5e56b3[_0x4960('0x4d')],{})[_0x4960('0x27')](respondWithResult(_0x453dd7,0xc9))[_0x4960('0x48')](handleError(_0x453dd7,null));};exports[_0x4960('0x26')]=function(_0xe7b508,_0x4556ff){if(_0xe7b508[_0x4960('0x4d')]['id']){delete _0xe7b508[_0x4960('0x4d')]['id'];}return db[_0x4960('0x2d')][_0x4960('0x4b')]({'where':{'id':_0xe7b508['params']['id']}})[_0x4960('0x27')](handleEntityNotFound(_0x4556ff,null))[_0x4960('0x27')](saveUpdates(_0xe7b508[_0x4960('0x4d')],null))[_0x4960('0x27')](respondWithResult(_0x4556ff,null))[_0x4960('0x48')](handleError(_0x4556ff,null));};exports[_0x4960('0x4e')]=function(_0x90428f,_0x3972cc){return db[_0x4960('0x2d')][_0x4960('0x4b')]({'where':{'id':_0x90428f[_0x4960('0x4a')]['id']}})[_0x4960('0x27')](handleEntityNotFound(_0x3972cc,null))[_0x4960('0x27')](removeEntity(_0x3972cc,null))['catch'](handleError(_0x3972cc,null));};exports[_0x4960('0x4f')]=function(_0xdb3cdf,_0x5a2081){return db['VoiceDialReport']['describe']()[_0x4960('0x27')](respondWithResult(_0x5a2081,null))[_0x4960('0x48')](handleError(_0x5a2081,null));}; \ No newline at end of file +var _0xf7ac=['fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0x4e1d2d,_0x46de1e){var _0x10b5cc=function(_0x25846a){while(--_0x25846a){_0x4e1d2d['push'](_0x4e1d2d['shift']());}};_0x10b5cc(++_0x46de1e);}(_0xf7ac,0xfa));var _0xcf7a=function(_0x59a7da,_0x24a045){_0x59a7da=_0x59a7da-0x0;var _0x579329=_0xf7ac[_0x59a7da];return _0x579329;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcf7a('0x0'));var jsonpatch=require(_0xcf7a('0x1'));var rp=require(_0xcf7a('0x2'));var moment=require(_0xcf7a('0x3'));var BPromise=require(_0xcf7a('0x4'));var Mustache=require(_0xcf7a('0x5'));var util=require(_0xcf7a('0x6'));var path=require(_0xcf7a('0x7'));var sox=require(_0xcf7a('0x8'));var csv=require(_0xcf7a('0x9'));var ejs=require(_0xcf7a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf7a('0xb'));var squel=require(_0xcf7a('0xc'));var crypto=require('crypto');var jsforce=require(_0xcf7a('0xd'));var deskjs=require(_0xcf7a('0xe'));var toCsv=require(_0xcf7a('0x9'));var querystring=require(_0xcf7a('0xf'));var Papa=require(_0xcf7a('0x10'));var Redis=require(_0xcf7a('0x11'));var authService=require(_0xcf7a('0x12'));var qs=require(_0xcf7a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf7a('0x14'));var logger=require('../../config/logger')(_0xcf7a('0x15'));var utils=require(_0xcf7a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcf7a('0x17'));var db=require(_0xcf7a('0x18'))['db'];function respondWithStatusCode(_0x149315,_0x1c39e5){_0x1c39e5=_0x1c39e5||0xcc;return function(_0x1c01c0){if(_0x1c01c0){return _0x149315[_0xcf7a('0x19')](_0x1c39e5);}return _0x149315[_0xcf7a('0x1a')](_0x1c39e5)[_0xcf7a('0x1b')]();};}function respondWithResult(_0x4ed6e9,_0x35361a){_0x35361a=_0x35361a||0xc8;return function(_0x161f1f){if(_0x161f1f){return _0x4ed6e9[_0xcf7a('0x1a')](_0x35361a)[_0xcf7a('0x1c')](_0x161f1f);}};}function respondWithFilteredResult(_0x50c125,_0x236fcd){return function(_0x210c35){if(_0x210c35){var _0x462e99=typeof _0x236fcd[_0xcf7a('0x1d')]==='undefined'&&typeof _0x236fcd[_0xcf7a('0x1e')]===_0xcf7a('0x1f');var _0x37fe79=_0x210c35[_0xcf7a('0x20')];var _0x304941=_0x462e99?0x0:_0x236fcd['offset'];var _0x59e038=_0x462e99?_0x210c35[_0xcf7a('0x20')]:_0x236fcd['offset']+_0x236fcd['limit'];var _0x32876b;if(_0x59e038>=_0x37fe79){_0x59e038=_0x37fe79;_0x32876b=0xc8;}else{_0x32876b=0xce;}_0x50c125[_0xcf7a('0x1a')](_0x32876b);return _0x50c125[_0xcf7a('0x21')](_0xcf7a('0x22'),_0x304941+'-'+_0x59e038+'/'+_0x37fe79)[_0xcf7a('0x1c')](_0x210c35);}return null;};}function patchUpdates(_0x151352){return function(_0x530dfb){try{jsonpatch[_0xcf7a('0x23')](_0x530dfb,_0x151352,!![]);}catch(_0x2b6165){return BPromise[_0xcf7a('0x24')](_0x2b6165);}return _0x530dfb[_0xcf7a('0x25')]();};}function saveUpdates(_0x134767,_0x28917e){return function(_0x1648d5){if(_0x1648d5){return _0x1648d5[_0xcf7a('0x26')](_0x134767)[_0xcf7a('0x27')](function(_0x1ba329){return _0x1ba329;});}return null;};}function removeEntity(_0xb62258,_0x3ca91a){return function(_0x112ea6){if(_0x112ea6){return _0x112ea6[_0xcf7a('0x28')]()[_0xcf7a('0x27')](function(){_0xb62258[_0xcf7a('0x1a')](0xcc)[_0xcf7a('0x1b')]();});}};}function handleEntityNotFound(_0x17941d,_0xf430b4){return function(_0x2d99aa){if(!_0x2d99aa){_0x17941d['sendStatus'](0x194);}return _0x2d99aa;};}function handleError(_0x1b9b72,_0xb34f19){_0xb34f19=_0xb34f19||0x1f4;return function(_0x5139a0){logger[_0xcf7a('0x29')](_0x5139a0[_0xcf7a('0x2a')]);if(_0x5139a0[_0xcf7a('0x2b')]){delete _0x5139a0[_0xcf7a('0x2b')];}_0x1b9b72[_0xcf7a('0x1a')](_0xb34f19)[_0xcf7a('0x2c')](_0x5139a0);};}exports['index']=function(_0x5dc34c,_0x3b9d06){var _0x692d2a={},_0x43b646={},_0x37b803={'count':0x0,'rows':[]};var _0x225838=_[_0xcf7a('0x2d')](db['VoiceDialReport'][_0xcf7a('0x2e')],function(_0x1f3656){return{'name':_0x1f3656['fieldName'],'type':_0x1f3656[_0xcf7a('0x2f')][_0xcf7a('0x30')]};});_0x43b646[_0xcf7a('0x31')]=_['map'](_0x225838,_0xcf7a('0x2b'));_0x43b646[_0xcf7a('0x32')]=_['keys'](_0x5dc34c['query']);_0x43b646[_0xcf7a('0x33')]=_[_0xcf7a('0x34')](_0x43b646['model'],_0x43b646['query']);_0x692d2a[_0xcf7a('0x35')]=_[_0xcf7a('0x34')](_0x43b646[_0xcf7a('0x31')],qs[_0xcf7a('0x36')](_0x5dc34c[_0xcf7a('0x32')][_0xcf7a('0x36')]));_0x692d2a[_0xcf7a('0x35')]=_0x692d2a[_0xcf7a('0x35')][_0xcf7a('0x37')]?_0x692d2a[_0xcf7a('0x35')]:_0x43b646[_0xcf7a('0x31')];if(!_0x5dc34c[_0xcf7a('0x32')][_0xcf7a('0x38')]('nolimit')){_0x692d2a[_0xcf7a('0x1e')]=qs[_0xcf7a('0x1e')](_0x5dc34c[_0xcf7a('0x32')][_0xcf7a('0x1e')]);_0x692d2a['offset']=qs[_0xcf7a('0x1d')](_0x5dc34c[_0xcf7a('0x32')][_0xcf7a('0x1d')]);}_0x692d2a[_0xcf7a('0x39')]=qs[_0xcf7a('0x3a')](_0x5dc34c[_0xcf7a('0x32')][_0xcf7a('0x3a')]);_0x692d2a[_0xcf7a('0x3b')]=qs['filters'](_['pick'](_0x5dc34c[_0xcf7a('0x32')],_0x43b646[_0xcf7a('0x33')]),_0x225838);if(_0x5dc34c[_0xcf7a('0x32')][_0xcf7a('0x3c')]){_0x692d2a[_0xcf7a('0x3b')]=_[_0xcf7a('0x3d')](_0x692d2a[_0xcf7a('0x3b')],{'$or':_[_0xcf7a('0x2d')](_0x225838,function(_0x4fcf76){if(_0x4fcf76[_0xcf7a('0x2f')]!==_0xcf7a('0x3e')){var _0x3ef055={};_0x3ef055[_0x4fcf76[_0xcf7a('0x2b')]]={'$like':'%'+_0x5dc34c['query']['filter']+'%'};return _0x3ef055;}})});}_0x692d2a=_[_0xcf7a('0x3d')]({},_0x692d2a,_0x5dc34c[_0xcf7a('0x3f')]);var _0x1d748a={'where':_0x692d2a[_0xcf7a('0x3b')]};return db[_0xcf7a('0x40')][_0xcf7a('0x20')](_0x1d748a)[_0xcf7a('0x27')](function(_0x4c5324){_0x37b803[_0xcf7a('0x20')]=_0x4c5324;if(_0x5dc34c['query'][_0xcf7a('0x41')]){_0x692d2a[_0xcf7a('0x42')]=[{'all':!![]}];}return db[_0xcf7a('0x40')][_0xcf7a('0x43')](_0x692d2a);})[_0xcf7a('0x27')](function(_0x96822e){_0x37b803['rows']=_0x96822e;return _0x37b803;})['then'](respondWithFilteredResult(_0x3b9d06,_0x692d2a))[_0xcf7a('0x44')](handleError(_0x3b9d06,null));};exports[_0xcf7a('0x45')]=function(_0x1ead0d,_0x2014a9){var _0x49c1bb={'raw':!![],'where':{'id':_0x1ead0d[_0xcf7a('0x46')]['id']}},_0x47a932={};_0x47a932[_0xcf7a('0x31')]=_[_0xcf7a('0x47')](db[_0xcf7a('0x40')][_0xcf7a('0x2e')]);_0x47a932[_0xcf7a('0x32')]=_[_0xcf7a('0x47')](_0x1ead0d[_0xcf7a('0x32')]);_0x47a932['filters']=_[_0xcf7a('0x34')](_0x47a932[_0xcf7a('0x31')],_0x47a932['query']);_0x49c1bb[_0xcf7a('0x35')]=_[_0xcf7a('0x34')](_0x47a932[_0xcf7a('0x31')],qs[_0xcf7a('0x36')](_0x1ead0d[_0xcf7a('0x32')][_0xcf7a('0x36')]));_0x49c1bb[_0xcf7a('0x35')]=_0x49c1bb[_0xcf7a('0x35')][_0xcf7a('0x37')]?_0x49c1bb['attributes']:_0x47a932[_0xcf7a('0x31')];if(_0x1ead0d[_0xcf7a('0x32')]['includeAll']){_0x49c1bb[_0xcf7a('0x42')]=[{'all':!![]}];}_0x49c1bb=_['merge']({},_0x49c1bb,_0x1ead0d[_0xcf7a('0x3f')]);return db['VoiceDialReport']['find'](_0x49c1bb)[_0xcf7a('0x27')](handleEntityNotFound(_0x2014a9,null))[_0xcf7a('0x27')](respondWithResult(_0x2014a9,null))['catch'](handleError(_0x2014a9,null));};exports[_0xcf7a('0x48')]=function(_0x3b256c,_0x594b84){return db['VoiceDialReport'][_0xcf7a('0x48')](_0x3b256c[_0xcf7a('0x49')],{})[_0xcf7a('0x27')](respondWithResult(_0x594b84,0xc9))[_0xcf7a('0x44')](handleError(_0x594b84,null));};exports[_0xcf7a('0x26')]=function(_0x20f686,_0x53bdcb){if(_0x20f686[_0xcf7a('0x49')]['id']){delete _0x20f686['body']['id'];}return db[_0xcf7a('0x40')][_0xcf7a('0x4a')]({'where':{'id':_0x20f686[_0xcf7a('0x46')]['id']}})[_0xcf7a('0x27')](handleEntityNotFound(_0x53bdcb,null))[_0xcf7a('0x27')](saveUpdates(_0x20f686[_0xcf7a('0x49')],null))[_0xcf7a('0x27')](respondWithResult(_0x53bdcb,null))[_0xcf7a('0x44')](handleError(_0x53bdcb,null));};exports['destroy']=function(_0x39d2e7,_0x3e4894){return db[_0xcf7a('0x40')][_0xcf7a('0x4a')]({'where':{'id':_0x39d2e7['params']['id']}})[_0xcf7a('0x27')](handleEntityNotFound(_0x3e4894,null))['then'](removeEntity(_0x3e4894,null))[_0xcf7a('0x44')](handleError(_0x3e4894,null));};exports[_0xcf7a('0x4b')]=function(_0x544421,_0x5e629d){return db[_0xcf7a('0x40')][_0xcf7a('0x4b')]()[_0xcf7a('0x27')](respondWithResult(_0x5e629d,null))[_0xcf7a('0x44')](handleError(_0x5e629d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2048c6a..670094e 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 _0x6386=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x1fde64,_0x39769a){var _0x53b5bb=function(_0x565852){while(--_0x565852){_0x1fde64['push'](_0x1fde64['shift']());}};_0x53b5bb(++_0x39769a);}(_0x6386,0x1cf));var _0x6638=function(_0x873080,_0x2a3550){_0x873080=_0x873080-0x0;var _0x566e00=_0x6386[_0x873080];return _0x566e00;};'use strict';var _=require(_0x6638('0x0'));var util=require(_0x6638('0x1'));var logger=require(_0x6638('0x2'))(_0x6638('0x3'));var moment=require(_0x6638('0x4'));var BPromise=require(_0x6638('0x5'));var rp=require(_0x6638('0x6'));var fs=require('fs');var path=require(_0x6638('0x7'));var rimraf=require(_0x6638('0x8'));var config=require(_0x6638('0x9'));var attributes=require(_0x6638('0xa'));module[_0x6638('0xb')]=function(_0x45de5a,_0x3b6cba){return _0x45de5a[_0x6638('0xc')](_0x6638('0xd'),attributes,{'tableName':_0x6638('0xe'),'paranoid':![],'indexes':[{'fields':[_0x6638('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84cb=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment','request-promise'];(function(_0x4b00de,_0x2c4ff7){var _0x4c8fad=function(_0x3ce5f1){while(--_0x3ce5f1){_0x4b00de['push'](_0x4b00de['shift']());}};_0x4c8fad(++_0x2c4ff7);}(_0x84cb,0xf8));var _0xb84c=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x84cb[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0xb84c('0x0'));var util=require('util');var logger=require(_0xb84c('0x1'))('api');var moment=require(_0xb84c('0x2'));var BPromise=require('bluebird');var rp=require(_0xb84c('0x3'));var fs=require('fs');var path=require(_0xb84c('0x4'));var rimraf=require(_0xb84c('0x5'));var config=require(_0xb84c('0x6'));var attributes=require(_0xb84c('0x7'));module[_0xb84c('0x8')]=function(_0x1afb9f,_0x20fa18){return _0x1afb9f['define'](_0xb84c('0x9'),attributes,{'tableName':_0xb84c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb84c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 5e6ac1a..43c61c4 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 _0xa9c9=['VoiceDialReport','body','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceDialReport'];(function(_0x588fba,_0x5b36c7){var _0x3a53dc=function(_0x1b5deb){while(--_0x1b5deb){_0x588fba['push'](_0x588fba['shift']());}};_0x3a53dc(++_0x5b36c7);}(_0xa9c9,0x1ae));var _0x9a9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa9c9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9a9c('0x0'));var util=require('util');var moment=require(_0x9a9c('0x1'));var BPromise=require(_0x9a9c('0x2'));var rs=require(_0x9a9c('0x3'));var fs=require('fs');var Redis=require(_0x9a9c('0x4'));var db=require(_0x9a9c('0x5'))['db'];var utils=require(_0x9a9c('0x6'));var logger=require(_0x9a9c('0x7'))(_0x9a9c('0x8'));var config=require(_0x9a9c('0x9'));var jayson=require(_0x9a9c('0xa'));var client=jayson[_0x9a9c('0xb')][_0x9a9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1498da,_0x28527f,_0x309235){return new BPromise(function(_0xf54e6c,_0x35a336){return client['request'](_0x1498da,_0x309235)[_0x9a9c('0xd')](function(_0x5296fa){logger[_0x9a9c('0xe')](_0x9a9c('0xf'),_0x28527f,'request\x20sent');logger[_0x9a9c('0x10')](_0x9a9c('0x11'),_0x28527f,_0x9a9c('0x12'),JSON['stringify'](_0x5296fa));if(_0x5296fa[_0x9a9c('0x13')]){if(_0x5296fa[_0x9a9c('0x13')][_0x9a9c('0x14')]===0x1f4){logger[_0x9a9c('0x13')](_0x9a9c('0xf'),_0x28527f,_0x5296fa[_0x9a9c('0x13')][_0x9a9c('0x15')]);return _0x35a336(_0x5296fa[_0x9a9c('0x13')][_0x9a9c('0x15')]);}logger[_0x9a9c('0x13')](_0x9a9c('0xf'),_0x28527f,_0x5296fa[_0x9a9c('0x13')]['message']);return _0xf54e6c(_0x5296fa[_0x9a9c('0x13')][_0x9a9c('0x15')]);}else{logger[_0x9a9c('0xe')](_0x9a9c('0xf'),_0x28527f,_0x9a9c('0x12'));_0xf54e6c(_0x5296fa[_0x9a9c('0x16')][_0x9a9c('0x15')]);}})[_0x9a9c('0x17')](function(_0x5e08e1){logger[_0x9a9c('0x13')](_0x9a9c('0xf'),_0x28527f,_0x5e08e1);_0x35a336(_0x5e08e1);});});}exports[_0x9a9c('0x18')]=function(_0xdd2270){var _0x3d6aeb=this;return new Promise(function(_0x8e6b20,_0x1bf6d7){return db[_0x9a9c('0x19')]['create'](_0xdd2270[_0x9a9c('0x1a')],{'raw':_0xdd2270[_0x9a9c('0x1b')]?_0xdd2270[_0x9a9c('0x1b')][_0x9a9c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4dffb2){logger[_0x9a9c('0xe')](_0x9a9c('0x18'),_0xdd2270);logger['debug'](_0x9a9c('0x18'),_0xdd2270,JSON[_0x9a9c('0x1d')](_0x4dffb2));_0x8e6b20(_0x4dffb2);})['catch'](function(_0x7b67dc){logger[_0x9a9c('0x13')](_0x9a9c('0x18'),_0x7b67dc[_0x9a9c('0x15')],_0xdd2270);_0x1bf6d7(_0x3d6aeb['error'](0x1f4,_0x7b67dc[_0x9a9c('0x15')]));});});};exports[_0x9a9c('0x1e')]=function(_0x41de24){var _0x5d1061=this;return new Promise(function(_0x12d740,_0xe366ee){return db[_0x9a9c('0x19')][_0x9a9c('0x1f')](_0x41de24[_0x9a9c('0x1a')],{'raw':_0x41de24[_0x9a9c('0x1b')]?_0x41de24[_0x9a9c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41de24[_0x9a9c('0x1b')]?_0x41de24[_0x9a9c('0x1b')][_0x9a9c('0x20')]||null:null,'attributes':_0x41de24[_0x9a9c('0x1b')]?_0x41de24['options'][_0x9a9c('0x21')]||null:null,'limit':_0x41de24['options']?_0x41de24[_0x9a9c('0x1b')][_0x9a9c('0x22')]||null:null})['then'](function(_0x56b702){logger[_0x9a9c('0xe')](_0x9a9c('0x1e'),_0x41de24);logger[_0x9a9c('0x10')](_0x9a9c('0x1e'),_0x41de24,JSON[_0x9a9c('0x1d')](_0x56b702));_0x12d740(_0x56b702);})[_0x9a9c('0x17')](function(_0x17a145){logger[_0x9a9c('0x13')](_0x9a9c('0x1e'),_0x17a145[_0x9a9c('0x15')],_0x41de24);_0xe366ee(_0x5d1061[_0x9a9c('0x13')](0x1f4,_0x17a145[_0x9a9c('0x15')]));});});}; \ No newline at end of file +var _0x53fa=['message','result','catch','CreateVoiceDialReport','options','raw','UpdateVoiceDialReport','VoiceDialReport','body','where','attributes','limit','util','moment','bluebird','randomstring','jayson/promise','client','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x53fa,0xd0));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa53f('0x0'));var moment=require(_0xa53f('0x1'));var BPromise=require(_0xa53f('0x2'));var rs=require(_0xa53f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa53f('0x4'));var client=jayson[_0xa53f('0x5')][_0xa53f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3fbc6d,_0x3007f7,_0x5a9a00){return new BPromise(function(_0xfb8194,_0x52c3ca){return client[_0xa53f('0x7')](_0x3fbc6d,_0x5a9a00)[_0xa53f('0x8')](function(_0x20d57f){logger[_0xa53f('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x3007f7,'request\x20sent');logger[_0xa53f('0xa')](_0xa53f('0xb'),_0x3007f7,'request\x20sent',JSON[_0xa53f('0xc')](_0x20d57f));if(_0x20d57f['error']){if(_0x20d57f[_0xa53f('0xd')][_0xa53f('0xe')]===0x1f4){logger[_0xa53f('0xd')](_0xa53f('0xf'),_0x3007f7,_0x20d57f[_0xa53f('0xd')][_0xa53f('0x10')]);return _0x52c3ca(_0x20d57f[_0xa53f('0xd')][_0xa53f('0x10')]);}logger[_0xa53f('0xd')](_0xa53f('0xf'),_0x3007f7,_0x20d57f[_0xa53f('0xd')][_0xa53f('0x10')]);return _0xfb8194(_0x20d57f[_0xa53f('0xd')][_0xa53f('0x10')]);}else{logger[_0xa53f('0x9')](_0xa53f('0xf'),_0x3007f7,'request\x20sent');_0xfb8194(_0x20d57f[_0xa53f('0x11')][_0xa53f('0x10')]);}})[_0xa53f('0x12')](function(_0x381229){logger[_0xa53f('0xd')](_0xa53f('0xf'),_0x3007f7,_0x381229);_0x52c3ca(_0x381229);});});}exports[_0xa53f('0x13')]=function(_0x5c6f68){var _0x4e151d=this;return new Promise(function(_0x51d9fd,_0x39f340){return db['VoiceDialReport']['create'](_0x5c6f68['body'],{'raw':_0x5c6f68[_0xa53f('0x14')]?_0x5c6f68['options'][_0xa53f('0x15')]===undefined?!![]:![]:!![]})[_0xa53f('0x8')](function(_0xd5e155){logger[_0xa53f('0x9')]('CreateVoiceDialReport',_0x5c6f68);logger[_0xa53f('0xa')]('CreateVoiceDialReport',_0x5c6f68,JSON[_0xa53f('0xc')](_0xd5e155));_0x51d9fd(_0xd5e155);})[_0xa53f('0x12')](function(_0x8994c7){logger['error']('CreateVoiceDialReport',_0x8994c7[_0xa53f('0x10')],_0x5c6f68);_0x39f340(_0x4e151d[_0xa53f('0xd')](0x1f4,_0x8994c7[_0xa53f('0x10')]));});});};exports[_0xa53f('0x16')]=function(_0x480f21){var _0x3d891a=this;return new Promise(function(_0x244134,_0x19c74e){return db[_0xa53f('0x17')]['update'](_0x480f21[_0xa53f('0x18')],{'raw':_0x480f21['options']?_0x480f21[_0xa53f('0x14')][_0xa53f('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480f21[_0xa53f('0x14')]?_0x480f21[_0xa53f('0x14')][_0xa53f('0x19')]||null:null,'attributes':_0x480f21['options']?_0x480f21[_0xa53f('0x14')][_0xa53f('0x1a')]||null:null,'limit':_0x480f21[_0xa53f('0x14')]?_0x480f21['options'][_0xa53f('0x1b')]||null:null})[_0xa53f('0x8')](function(_0x3f4b83){logger[_0xa53f('0x9')](_0xa53f('0x16'),_0x480f21);logger[_0xa53f('0xa')](_0xa53f('0x16'),_0x480f21,JSON[_0xa53f('0xc')](_0x3f4b83));_0x244134(_0x3f4b83);})[_0xa53f('0x12')](function(_0x1b2fe7){logger['error'](_0xa53f('0x16'),_0x1b2fe7[_0xa53f('0x10')],_0x480f21);_0x19c74e(_0x3d891a[_0xa53f('0xd')](0x1f4,_0x1b2fe7['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d28f56f..aa34611 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 _0x62dc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4fd36a,_0x2224ff){var _0x92d0e8=function(_0x4b7fbf){while(--_0x4b7fbf){_0x4fd36a['push'](_0x4fd36a['shift']());}};_0x92d0e8(++_0x2224ff);}(_0x62dc,0x86));var _0xc62d=function(_0x270b2a,_0x3d2ac8){_0x270b2a=_0x270b2a-0x0;var _0x459940=_0x62dc[_0x270b2a];return _0x459940;};'use strict';var multer=require(_0xc62d('0x0'));var util=require(_0xc62d('0x1'));var path=require(_0xc62d('0x2'));var timeout=require(_0xc62d('0x3'));var express=require(_0xc62d('0x4'));var router=express[_0xc62d('0x5')]();var fs_extra=require(_0xc62d('0x6'));var auth=require(_0xc62d('0x7'));var interaction=require(_0xc62d('0x8'));var config=require(_0xc62d('0x9'));var controller=require(_0xc62d('0xa'));router[_0xc62d('0xb')]('/',auth[_0xc62d('0xc')](),controller['index']);router[_0xc62d('0xb')](_0xc62d('0xd'),auth[_0xc62d('0xc')](),controller[_0xc62d('0xe')]);router[_0xc62d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc62d('0xf')](_0xc62d('0x10'),auth[_0xc62d('0xc')](),controller[_0xc62d('0x11')]);router[_0xc62d('0x12')](_0xc62d('0xd'),auth[_0xc62d('0xc')](),controller[_0xc62d('0x13')]);router[_0xc62d('0x14')](_0xc62d('0xd'),auth[_0xc62d('0xc')](),controller[_0xc62d('0x15')]);module[_0xc62d('0x16')]=router; \ No newline at end of file +var _0xa5c6=['/:id/applications','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa5c6,0xba));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x6a5c('0x0'));var path=require(_0x6a5c('0x1'));var timeout=require(_0x6a5c('0x2'));var express=require(_0x6a5c('0x3'));var router=express[_0x6a5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a5c('0x5'));var interaction=require(_0x6a5c('0x6'));var config=require('../../config/environment');var controller=require(_0x6a5c('0x7'));router[_0x6a5c('0x8')]('/',auth[_0x6a5c('0x9')](),controller[_0x6a5c('0xa')]);router['get'](_0x6a5c('0xb'),auth[_0x6a5c('0x9')](),controller['show']);router['post']('/',auth[_0x6a5c('0x9')](),controller['create']);router['post'](_0x6a5c('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6a5c('0xd')](_0x6a5c('0xb'),auth[_0x6a5c('0x9')](),controller[_0x6a5c('0xe')]);router[_0x6a5c('0xf')](_0x6a5c('0xb'),auth[_0x6a5c('0x9')](),controller[_0x6a5c('0x10')]);module[_0x6a5c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index fad1a47..5ca98a0 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 _0x73ab=['wav','VIRTUAL','exten','exports','STRING','compositeIndex','ENUM','internal','inbound-fax','outbound-fax','*,*,*,*','BOOLEAN','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x73ab,0x121));var _0xb73a=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0x73ab[_0x3e0dc4];return _0x586111;};'use strict';var Sequelize=require('sequelize');module[_0xb73a('0x0')]={'context':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'unique':_0xb73a('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb73a('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb73a('0x3')]('inbound','outbound',_0xb73a('0x4'),_0xb73a('0x5'),_0xb73a('0x6'),'system','any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb73a('0x7')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb73a('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb73a('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xb73a('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb73a('0x9')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb73a('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xb73a('0xb')],'get':function(_0x16128f){return this['getDataValue'](_0xb73a('0xc'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8742=['sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','wav','getDataValue','exten'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x8742,0x121));var _0x2874=function(_0xabc84b,_0x1c1fad){_0xabc84b=_0xabc84b-0x0;var _0x4b57a5=_0x8742[_0xabc84b];return _0x4b57a5;};'use strict';var Sequelize=require(_0x2874('0x0'));module[_0x2874('0x1')]={'context':{'type':Sequelize[_0x2874('0x2')],'allowNull':![],'unique':_0x2874('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2874('0x3')},'priority':{'type':Sequelize[_0x2874('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x2874('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2874('0x2')],'allowNull':![],'defaultValue':_0x2874('0x4')},'appdata':{'type':Sequelize[_0x2874('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2874('0x5')](_0x2874('0x6'),_0x2874('0x7'),_0x2874('0x8'),_0x2874('0x9'),_0x2874('0xa'),'system',_0x2874('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x2874('0x2')]},'interval':{'type':Sequelize[_0x2874('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x2874('0xc')]},'isApp':{'type':Sequelize[_0x2874('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x2874('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x2874('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2874('0xc')]},'recordingFormat':{'type':Sequelize[_0x2874('0x2')],'defaultValue':_0x2874('0xe')},'answer':{'type':Sequelize[_0x2874('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x18a31f){return this[_0x2874('0xf')](_0x2874('0x10'));}},'alias':{'type':Sequelize[_0x2874('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 92e5c20..83e020c 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 _0x653e=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','VoiceExtension','show','params','keys','catch','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','internal','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type','find','name','then','error','send','index','rawAttributes','fieldName','key','model','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x653e,0xef));var _0xe653=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x653e[_0x2181b1];return _0x530548;};'use strict';var _=require(_0xe653('0x0'));var Redis=require(_0xe653('0x1'));var qs=require(_0xe653('0x2'));var logger=require(_0xe653('0x3'))(_0xe653('0x4'));var config=require(_0xe653('0x5'));var db=require(_0xe653('0x6'))['db'];config[_0xe653('0x7')]=_[_0xe653('0x8')](config[_0xe653('0x7')],{'host':_0xe653('0x9'),'port':0x18eb});var socket=require(_0xe653('0xa'))(new Redis(config[_0xe653('0x7')]));require('./voiceExtension.socket')[_0xe653('0xb')](socket);function respondWithStatusCode(_0x16e1c4,_0x2ec063){_0x2ec063=_0x2ec063||0xcc;return function(_0x444bac){if(_0x444bac){return _0x16e1c4[_0xe653('0xc')](_0x2ec063);}return _0x16e1c4['status'](_0x2ec063)[_0xe653('0xd')]();};}function respondWithResult(_0x5b9443,_0x39a7fa){_0x39a7fa=_0x39a7fa||0xc8;return function(_0x49e11f){if(_0x49e11f){return _0x5b9443[_0xe653('0xe')](_0x39a7fa)['json'](_0x49e11f);}};}function respondWithFilteredResult(_0x254aa5,_0x1587aa){return function(_0x2c9553){if(_0x2c9553){var _0x2cb0c5=typeof _0x1587aa[_0xe653('0xf')]===_0xe653('0x10')&&typeof _0x1587aa[_0xe653('0x11')]===_0xe653('0x10');var _0x3ad8a6=_0x2c9553[_0xe653('0x12')];var _0x3757a2=_0x2cb0c5?0x0:_0x1587aa['offset'];var _0x1e2a0b=_0x2cb0c5?_0x2c9553[_0xe653('0x12')]:_0x1587aa[_0xe653('0xf')]+_0x1587aa[_0xe653('0x11')];var _0x2e74f8;if(_0x1e2a0b>=_0x3ad8a6){_0x1e2a0b=_0x3ad8a6;_0x2e74f8=0xc8;}else{_0x2e74f8=0xce;}_0x254aa5[_0xe653('0xe')](_0x2e74f8);return _0x254aa5[_0xe653('0x13')](_0xe653('0x14'),_0x3757a2+'-'+_0x1e2a0b+'/'+_0x3ad8a6)[_0xe653('0x15')](_0x2c9553);}return null;};}function removeEntity(_0x5c306e){return function(_0x496a44){if(_0x496a44){return _0x496a44[_0xe653('0x16')]()['then'](function(){var _0x5482e6=_0x496a44[_0xe653('0x17')]({'plain':!![]});var _0x2842ad=[{'name':_0xe653('0x18'),'value':_0xe653('0x19'),'ignore':![]},{'name':_0xe653('0x1a'),'value':'outbound','ignore':![]},{'name':_0xe653('0x1b'),'value':'internal','ignore':![]}];var _0x2af604=_(_0x2842ad)[_0xe653('0x1c')](_0xe653('0x1d'))[_0xe653('0x1e')]('value')[_0xe653('0x1f')]();if(_[_0xe653('0x20')](_0x2af604,_0x5482e6[_0xe653('0x21')])){return;}var _0x435a63=_[_0xe653('0x22')](_0x2842ad,[_0xe653('0x1f'),_0x5482e6[_0xe653('0x21')]])[_0xe653('0x23')];return db['UserProfileResource'][_0xe653('0x16')]({'where':{'type':_0x435a63,'resourceId':_0x5482e6['id']}})[_0xe653('0x24')](function(){return _0x496a44;});})['then'](function(){_0x5c306e[_0xe653('0xe')](0xcc)[_0xe653('0xd')]();});}};}function handleEntityNotFound(_0x1167fa){return function(_0x39304c){if(!_0x39304c){_0x1167fa[_0xe653('0xc')](0x194);}return _0x39304c;};}function handleError(_0xba590d,_0x30cea4){_0x30cea4=_0x30cea4||0x1f4;return function(_0x1b93b3){logger[_0xe653('0x25')](_0x1b93b3['stack']);if(_0x1b93b3[_0xe653('0x23')]){delete _0x1b93b3[_0xe653('0x23')];}_0xba590d[_0xe653('0xe')](_0x30cea4)[_0xe653('0x26')](_0x1b93b3);};}exports[_0xe653('0x27')]=function(_0x366b29,_0xc4e550){var _0x3d521e={},_0x3d193f={},_0x43e185={'count':0x0,'rows':[]};var _0x38449f=_[_0xe653('0x1e')](db['VoiceExtension'][_0xe653('0x28')],function(_0x35c7ba){return{'name':_0x35c7ba[_0xe653('0x29')],'type':_0x35c7ba[_0xe653('0x21')][_0xe653('0x2a')]};});_0x3d193f[_0xe653('0x2b')]=_[_0xe653('0x1e')](_0x38449f,_0xe653('0x23'));_0x3d193f[_0xe653('0x2c')]=_['keys'](_0x366b29[_0xe653('0x2c')]);_0x3d193f[_0xe653('0x2d')]=_['intersection'](_0x3d193f[_0xe653('0x2b')],_0x3d193f[_0xe653('0x2c')]);_0x3d521e[_0xe653('0x2e')]=_[_0xe653('0x2f')](_0x3d193f['model'],qs[_0xe653('0x30')](_0x366b29[_0xe653('0x2c')][_0xe653('0x30')]));_0x3d521e[_0xe653('0x2e')]=_0x3d521e['attributes'][_0xe653('0x31')]?_0x3d521e[_0xe653('0x2e')]:_0x3d193f[_0xe653('0x2b')];if(!_0x366b29[_0xe653('0x2c')][_0xe653('0x32')](_0xe653('0x33'))){_0x3d521e[_0xe653('0x11')]=qs[_0xe653('0x11')](_0x366b29[_0xe653('0x2c')][_0xe653('0x11')]);_0x3d521e[_0xe653('0xf')]=qs[_0xe653('0xf')](_0x366b29[_0xe653('0x2c')][_0xe653('0xf')]);}_0x3d521e['order']=qs[_0xe653('0x34')](_0x366b29['query'][_0xe653('0x34')]);_0x3d521e[_0xe653('0x35')]=qs[_0xe653('0x2d')](_['pick'](_0x366b29[_0xe653('0x2c')],_0x3d193f[_0xe653('0x2d')]),_0x38449f);if(_0x366b29[_0xe653('0x2c')]['filter']){_0x3d521e[_0xe653('0x35')]=_[_0xe653('0x36')](_0x3d521e['where'],{'$or':_[_0xe653('0x1e')](_0x38449f,function(_0xc80c5b){if(_0xc80c5b['type']!==_0xe653('0x37')){var _0x49e22f={};_0x49e22f[_0xc80c5b['name']]={'$like':'%'+_0x366b29['query'][_0xe653('0x1c')]+'%'};return _0x49e22f;}})});}_0x3d521e=_[_0xe653('0x36')]({},_0x3d521e,_0x366b29[_0xe653('0x38')]);var _0x57590d={'where':_0x3d521e[_0xe653('0x35')]};return db['VoiceExtension'][_0xe653('0x12')](_0x57590d)[_0xe653('0x24')](function(_0x17e51a){_0x43e185[_0xe653('0x12')]=_0x17e51a;if(_0x366b29['query'][_0xe653('0x39')]){_0x3d521e[_0xe653('0x3a')]=[{'all':!![]}];}return db[_0xe653('0x3b')]['findAll'](_0x3d521e);})[_0xe653('0x24')](function(_0x4a1278){_0x43e185['rows']=_0x4a1278;return _0x43e185;})['then'](respondWithFilteredResult(_0xc4e550,_0x3d521e))['catch'](handleError(_0xc4e550,null));};exports[_0xe653('0x3c')]=function(_0x2c3269,_0x219637){var _0x2e3004={'raw':![],'where':{'id':_0x2c3269[_0xe653('0x3d')]['id']}},_0xe6ad5e={};_0xe6ad5e[_0xe653('0x2b')]=_[_0xe653('0x3e')](db['VoiceExtension'][_0xe653('0x28')]);_0xe6ad5e[_0xe653('0x2c')]=_[_0xe653('0x3e')](_0x2c3269[_0xe653('0x2c')]);_0xe6ad5e['filters']=_['intersection'](_0xe6ad5e[_0xe653('0x2b')],_0xe6ad5e[_0xe653('0x2c')]);_0x2e3004[_0xe653('0x2e')]=_['intersection'](_0xe6ad5e[_0xe653('0x2b')],qs['fields'](_0x2c3269[_0xe653('0x2c')][_0xe653('0x30')]));_0x2e3004['attributes']=_0x2e3004[_0xe653('0x2e')][_0xe653('0x31')]?_0x2e3004['attributes']:_0xe6ad5e[_0xe653('0x2b')];if(_0x2c3269[_0xe653('0x2c')]['includeAll']){_0x2e3004[_0xe653('0x3a')]=[{'all':!![]}];}_0x2e3004=_[_0xe653('0x36')]({},_0x2e3004,_0x2c3269[_0xe653('0x38')]);return db['VoiceExtension']['find'](_0x2e3004)[_0xe653('0x24')](handleEntityNotFound(_0x219637,null))[_0xe653('0x24')](respondWithResult(_0x219637,null))['catch'](handleError(_0x219637,null));};exports[_0xe653('0x16')]=function(_0x3ac983,_0x3ae827){return db[_0xe653('0x3b')][_0xe653('0x22')]({'where':{'id':_0x3ac983[_0xe653('0x3d')]['id']}})[_0xe653('0x24')](handleEntityNotFound(_0x3ae827,null))['then'](removeEntity(_0x3ae827,null))[_0xe653('0x3f')](handleError(_0x3ae827,null));};exports[_0xe653('0x40')]=function(_0xc3ba11,_0x401346){if(_0xc3ba11[_0xe653('0x41')][_0xe653('0x21')]==='outbound'&&!_['startsWith'](_0xc3ba11['body'][_0xe653('0x42')],'_')){_0xc3ba11[_0xe653('0x41')][_0xe653('0x42')]='_'[_0xe653('0x43')](_0xc3ba11[_0xe653('0x41')][_0xe653('0x42')]);}return db['VoiceExtension']['create'](_0xc3ba11[_0xe653('0x41')],{'raw':![]})[_0xe653('0x24')](function(_0x29000f){var _0x8fb097=_0xc3ba11[_0xe653('0x44')]['get']({'plain':!![]});if(!_0x8fb097)throw new Error(_0xe653('0x45'));if(_0x8fb097['role']===_0xe653('0x44')){var _0x395c32=_0x29000f['get']({'plain':!![]});var _0x56ae59=[{'name':_0xe653('0x18'),'value':_0xe653('0x19')},{'name':_0xe653('0x1a'),'value':'outbound'},{'name':_0xe653('0x1b'),'value':_0xe653('0x46')}];var _0xddb7e7=_[_0xe653('0x22')](_0x56ae59,[_0xe653('0x1f'),_0x395c32[_0xe653('0x21')]])['name'];return db[_0xe653('0x47')][_0xe653('0x22')]({'where':{'name':_0xddb7e7,'userProfileId':_0x8fb097['userProfileId']},'raw':!![]})[_0xe653('0x24')](function(_0x4da6b4){if(_0x4da6b4&&_0x4da6b4[_0xe653('0x48')]===0x0){return db[_0xe653('0x49')][_0xe653('0x40')]({'name':_0x395c32[_0xe653('0x23')],'resourceId':_0x395c32['id'],'type':_0x4da6b4[_0xe653('0x23')],'sectionId':_0x4da6b4['id']},{})['then'](function(){return _0x29000f;});}else{return _0x29000f;}})['catch'](function(_0x3d6d10){logger[_0xe653('0x25')](_0xe653('0x4a'),_0x3d6d10);throw _0x3d6d10;});}return _0x29000f;})['then'](respondWithResult(_0x401346,0xc9))[_0xe653('0x3f')](handleError(_0x401346,null));};exports[_0xe653('0x4b')]=function(_0x3726a8,_0x53de4d){if(_0x3726a8[_0xe653('0x41')]['id']){delete _0x3726a8[_0xe653('0x41')]['id'];}return db['VoiceExtension'][_0xe653('0x22')]({'where':{'id':_0x3726a8[_0xe653('0x3d')]['id']}})['then'](handleEntityNotFound(_0x53de4d,null))[_0xe653('0x24')](function(_0xdbe5af){if(_0xdbe5af){return db[_0xe653('0x3b')][_0xe653('0x4b')](_[_0xe653('0x4c')](_0x3726a8[_0xe653('0x41')],['exten',_0xe653('0x4d'),_0xe653('0x4e'),'recordingFormat',_0xe653('0x4f'),_0xe653('0x50'),_0xe653('0x51')]),{'where':{'context':_0xdbe5af[_0xe653('0x4d')],'exten':_0xdbe5af[_0xe653('0x42')]},'individualHooks':!![]})[_0xe653('0x24')](function(_0x5a173c){return _0x5a173c;});}return null;})[_0xe653('0x24')](respondWithStatusCode(_0x53de4d,null))[_0xe653('0x3f')](handleError(_0x53de4d,null));};exports[_0xe653('0x52')]=function(_0x2ddd46,_0x38516b){var _0x148c9b=_0x2ddd46[_0xe653('0x3d')]['id'];var _0x2f732e=_0x2ddd46[_0xe653('0x41')];var _0x245385=0xc8;var _0x4911d8=null;return db[_0xe653('0x53')][_0xe653('0x54')]({'isolationLevel':db[_0xe653('0x53')][_0xe653('0x55')]['ISOLATION_LEVELS'][_0xe653('0x56')]},function(_0x153e12){return db[_0xe653('0x3b')][_0xe653('0x57')]({'where':{'id':_0x148c9b},'transaction':_0x153e12})[_0xe653('0x24')](function(_0x3c5ac7){if(_0x3c5ac7){return db[_0xe653('0x3b')][_0xe653('0x16')]({'where':{'VoiceExtensionId':_0x148c9b},'transaction':_0x153e12})[_0xe653('0x24')](function(){var _0x5414d0=_['map'](_0x2f732e,function(_0x4e2d00){_0x4e2d00[_0xe653('0x58')]=_0x148c9b;_0x4e2d00['isApp']=!![];return _0x4e2d00;});return _0x3c5ac7[_0xe653('0x59')](_0x5414d0);})['then'](function(_0x1d008a){return db[_0xe653('0x3b')][_0xe653('0x5a')](_0x1d008a,{'transaction':_0x153e12});});}else{_0x245385=0x194;_0x4911d8=[];}});})[_0xe653('0x24')](function(){if(_0x245385!==0x194){return db[_0xe653('0x3b')][_0xe653('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x148c9b},'order':_0xe653('0x5c')})[_0xe653('0x24')](function(_0x45694a){_0x4911d8=_0x45694a;});}})[_0xe653('0x3f')](function(_0x554e61){_0x245385=0x1f4;logger[_0xe653('0x25')](_0x554e61[_0xe653('0x5d')]);if(_0x554e61['name']){delete _0x554e61[_0xe653('0x23')];}_0x4911d8=_0x554e61;})[_0xe653('0x5e')](function(){if(_0x4911d8===null){_0x38516b[_0xe653('0xc')](_0x245385);}else{if(_0x245385===0x1f4){_0x38516b['status'](_0x245385)[_0xe653('0x26')](_0x4911d8);}else{_0x38516b[_0xe653('0xe')](_0x245385)[_0xe653('0x15')](_0x4911d8);}}});}; \ No newline at end of file +var _0xbdf3=['redis','localhost','./voiceExtension.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','map','value','includes','type','find','name','UserProfileResource','end','error','stack','index','VoiceExtension','rawAttributes','fieldName','model','query','filters','fields','attributes','length','nolimit','sort','where','pick','merge','options','findAll','rows','catch','keys','intersection','include','create','body','exten','concat','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','params','sequelize','transaction','Transaction','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdf3,0x155));var _0x3bdf=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0xbdf3[_0x43941d];return _0x27b82a;};'use strict';var _=require(_0x3bdf('0x0'));var Redis=require(_0x3bdf('0x1'));var qs=require(_0x3bdf('0x2'));var logger=require(_0x3bdf('0x3'))(_0x3bdf('0x4'));var config=require(_0x3bdf('0x5'));var db=require(_0x3bdf('0x6'))['db'];config[_0x3bdf('0x7')]=_['defaults'](config[_0x3bdf('0x7')],{'host':_0x3bdf('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bdf('0x7')]));require(_0x3bdf('0x9'))[_0x3bdf('0xa')](socket);function respondWithStatusCode(_0x361d18,_0x10b306){_0x10b306=_0x10b306||0xcc;return function(_0x12b04d){if(_0x12b04d){return _0x361d18[_0x3bdf('0xb')](_0x10b306);}return _0x361d18['status'](_0x10b306)['end']();};}function respondWithResult(_0x1090b6,_0x38183d){_0x38183d=_0x38183d||0xc8;return function(_0x544acd){if(_0x544acd){return _0x1090b6[_0x3bdf('0xc')](_0x38183d)['json'](_0x544acd);}};}function respondWithFilteredResult(_0x389b09,_0x28a1fc){return function(_0x196a14){if(_0x196a14){var _0x588891=typeof _0x28a1fc[_0x3bdf('0xd')]===_0x3bdf('0xe')&&typeof _0x28a1fc[_0x3bdf('0xf')]===_0x3bdf('0xe');var _0x19989f=_0x196a14[_0x3bdf('0x10')];var _0x500cd1=_0x588891?0x0:_0x28a1fc[_0x3bdf('0xd')];var _0x3a2929=_0x588891?_0x196a14[_0x3bdf('0x10')]:_0x28a1fc[_0x3bdf('0xd')]+_0x28a1fc['limit'];var _0x80013a;if(_0x3a2929>=_0x19989f){_0x3a2929=_0x19989f;_0x80013a=0xc8;}else{_0x80013a=0xce;}_0x389b09[_0x3bdf('0xc')](_0x80013a);return _0x389b09[_0x3bdf('0x11')](_0x3bdf('0x12'),_0x500cd1+'-'+_0x3a2929+'/'+_0x19989f)[_0x3bdf('0x13')](_0x196a14);}return null;};}function removeEntity(_0xe49760){return function(_0x56d8ed){if(_0x56d8ed){return _0x56d8ed[_0x3bdf('0x14')]()[_0x3bdf('0x15')](function(){var _0x5cfecc=_0x56d8ed['get']({'plain':!![]});var _0xde05e9=[{'name':_0x3bdf('0x16'),'value':_0x3bdf('0x17'),'ignore':![]},{'name':_0x3bdf('0x18'),'value':_0x3bdf('0x19'),'ignore':![]},{'name':_0x3bdf('0x1a'),'value':_0x3bdf('0x1b'),'ignore':![]}];var _0x416122=_(_0xde05e9)['filter']('ignore')[_0x3bdf('0x1c')](_0x3bdf('0x1d'))['value']();if(_[_0x3bdf('0x1e')](_0x416122,_0x5cfecc[_0x3bdf('0x1f')])){return;}var _0x2c6af4=_[_0x3bdf('0x20')](_0xde05e9,[_0x3bdf('0x1d'),_0x5cfecc[_0x3bdf('0x1f')]])[_0x3bdf('0x21')];return db[_0x3bdf('0x22')][_0x3bdf('0x14')]({'where':{'type':_0x2c6af4,'resourceId':_0x5cfecc['id']}})[_0x3bdf('0x15')](function(){return _0x56d8ed;});})[_0x3bdf('0x15')](function(){_0xe49760[_0x3bdf('0xc')](0xcc)[_0x3bdf('0x23')]();});}};}function handleEntityNotFound(_0x32e3d4){return function(_0x7c0fbf){if(!_0x7c0fbf){_0x32e3d4[_0x3bdf('0xb')](0x194);}return _0x7c0fbf;};}function handleError(_0x48a20f,_0x4a6980){_0x4a6980=_0x4a6980||0x1f4;return function(_0x1e46f1){logger[_0x3bdf('0x24')](_0x1e46f1[_0x3bdf('0x25')]);if(_0x1e46f1[_0x3bdf('0x21')]){delete _0x1e46f1[_0x3bdf('0x21')];}_0x48a20f[_0x3bdf('0xc')](_0x4a6980)['send'](_0x1e46f1);};}exports[_0x3bdf('0x26')]=function(_0x4d167b,_0x170916){var _0x122bef={},_0x1a60de={},_0x4eaddf={'count':0x0,'rows':[]};var _0x9d6650=_[_0x3bdf('0x1c')](db[_0x3bdf('0x27')][_0x3bdf('0x28')],function(_0xabc6df){return{'name':_0xabc6df[_0x3bdf('0x29')],'type':_0xabc6df[_0x3bdf('0x1f')]['key']};});_0x1a60de[_0x3bdf('0x2a')]=_[_0x3bdf('0x1c')](_0x9d6650,_0x3bdf('0x21'));_0x1a60de[_0x3bdf('0x2b')]=_['keys'](_0x4d167b['query']);_0x1a60de[_0x3bdf('0x2c')]=_['intersection'](_0x1a60de[_0x3bdf('0x2a')],_0x1a60de[_0x3bdf('0x2b')]);_0x122bef['attributes']=_['intersection'](_0x1a60de[_0x3bdf('0x2a')],qs['fields'](_0x4d167b['query'][_0x3bdf('0x2d')]));_0x122bef[_0x3bdf('0x2e')]=_0x122bef[_0x3bdf('0x2e')][_0x3bdf('0x2f')]?_0x122bef['attributes']:_0x1a60de[_0x3bdf('0x2a')];if(!_0x4d167b[_0x3bdf('0x2b')]['hasOwnProperty'](_0x3bdf('0x30'))){_0x122bef[_0x3bdf('0xf')]=qs[_0x3bdf('0xf')](_0x4d167b['query']['limit']);_0x122bef['offset']=qs[_0x3bdf('0xd')](_0x4d167b[_0x3bdf('0x2b')][_0x3bdf('0xd')]);}_0x122bef['order']=qs[_0x3bdf('0x31')](_0x4d167b[_0x3bdf('0x2b')][_0x3bdf('0x31')]);_0x122bef[_0x3bdf('0x32')]=qs['filters'](_[_0x3bdf('0x33')](_0x4d167b[_0x3bdf('0x2b')],_0x1a60de['filters']),_0x9d6650);if(_0x4d167b['query']['filter']){_0x122bef[_0x3bdf('0x32')]=_['merge'](_0x122bef[_0x3bdf('0x32')],{'$or':_[_0x3bdf('0x1c')](_0x9d6650,function(_0x5450a2){if(_0x5450a2[_0x3bdf('0x1f')]!=='VIRTUAL'){var _0x2ee3fc={};_0x2ee3fc[_0x5450a2['name']]={'$like':'%'+_0x4d167b[_0x3bdf('0x2b')]['filter']+'%'};return _0x2ee3fc;}})});}_0x122bef=_[_0x3bdf('0x34')]({},_0x122bef,_0x4d167b[_0x3bdf('0x35')]);var _0x5b62ce={'where':_0x122bef[_0x3bdf('0x32')]};return db[_0x3bdf('0x27')]['count'](_0x5b62ce)[_0x3bdf('0x15')](function(_0x44d781){_0x4eaddf[_0x3bdf('0x10')]=_0x44d781;if(_0x4d167b[_0x3bdf('0x2b')]['includeAll']){_0x122bef['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x3bdf('0x36')](_0x122bef);})[_0x3bdf('0x15')](function(_0x88220c){_0x4eaddf[_0x3bdf('0x37')]=_0x88220c;return _0x4eaddf;})[_0x3bdf('0x15')](respondWithFilteredResult(_0x170916,_0x122bef))[_0x3bdf('0x38')](handleError(_0x170916,null));};exports['show']=function(_0xf5ae74,_0x35188e){var _0x40d269={'raw':![],'where':{'id':_0xf5ae74['params']['id']}},_0x4c9010={};_0x4c9010['model']=_[_0x3bdf('0x39')](db[_0x3bdf('0x27')]['rawAttributes']);_0x4c9010[_0x3bdf('0x2b')]=_[_0x3bdf('0x39')](_0xf5ae74['query']);_0x4c9010[_0x3bdf('0x2c')]=_[_0x3bdf('0x3a')](_0x4c9010[_0x3bdf('0x2a')],_0x4c9010[_0x3bdf('0x2b')]);_0x40d269[_0x3bdf('0x2e')]=_[_0x3bdf('0x3a')](_0x4c9010[_0x3bdf('0x2a')],qs[_0x3bdf('0x2d')](_0xf5ae74[_0x3bdf('0x2b')][_0x3bdf('0x2d')]));_0x40d269[_0x3bdf('0x2e')]=_0x40d269[_0x3bdf('0x2e')][_0x3bdf('0x2f')]?_0x40d269[_0x3bdf('0x2e')]:_0x4c9010[_0x3bdf('0x2a')];if(_0xf5ae74[_0x3bdf('0x2b')]['includeAll']){_0x40d269[_0x3bdf('0x3b')]=[{'all':!![]}];}_0x40d269=_['merge']({},_0x40d269,_0xf5ae74[_0x3bdf('0x35')]);return db[_0x3bdf('0x27')][_0x3bdf('0x20')](_0x40d269)[_0x3bdf('0x15')](handleEntityNotFound(_0x35188e,null))[_0x3bdf('0x15')](respondWithResult(_0x35188e,null))['catch'](handleError(_0x35188e,null));};exports['destroy']=function(_0x578dd2,_0x3dc790){return db[_0x3bdf('0x27')][_0x3bdf('0x20')]({'where':{'id':_0x578dd2['params']['id']}})['then'](handleEntityNotFound(_0x3dc790,null))[_0x3bdf('0x15')](removeEntity(_0x3dc790,null))[_0x3bdf('0x38')](handleError(_0x3dc790,null));};exports[_0x3bdf('0x3c')]=function(_0x5f529d,_0x1f3ca0){if(_0x5f529d['body'][_0x3bdf('0x1f')]===_0x3bdf('0x19')&&!_['startsWith'](_0x5f529d[_0x3bdf('0x3d')][_0x3bdf('0x3e')],'_')){_0x5f529d[_0x3bdf('0x3d')][_0x3bdf('0x3e')]='_'[_0x3bdf('0x3f')](_0x5f529d[_0x3bdf('0x3d')][_0x3bdf('0x3e')]);}return db[_0x3bdf('0x27')][_0x3bdf('0x3c')](_0x5f529d[_0x3bdf('0x3d')],{'raw':![]})[_0x3bdf('0x15')](function(_0x549e18){var _0x5ba392=_0x5f529d[_0x3bdf('0x40')]['get']({'plain':!![]});if(!_0x5ba392)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ba392[_0x3bdf('0x41')]===_0x3bdf('0x40')){var _0x2ce0d5=_0x549e18[_0x3bdf('0x42')]({'plain':!![]});var _0x5881d1=[{'name':_0x3bdf('0x16'),'value':_0x3bdf('0x17')},{'name':_0x3bdf('0x18'),'value':_0x3bdf('0x19')},{'name':_0x3bdf('0x1a'),'value':_0x3bdf('0x1b')}];var _0x290dd0=_[_0x3bdf('0x20')](_0x5881d1,['value',_0x2ce0d5[_0x3bdf('0x1f')]])[_0x3bdf('0x21')];return db[_0x3bdf('0x43')][_0x3bdf('0x20')]({'where':{'name':_0x290dd0,'userProfileId':_0x5ba392[_0x3bdf('0x44')]},'raw':!![]})[_0x3bdf('0x15')](function(_0x75f2d0){if(_0x75f2d0&&_0x75f2d0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ce0d5[_0x3bdf('0x21')],'resourceId':_0x2ce0d5['id'],'type':_0x75f2d0[_0x3bdf('0x21')],'sectionId':_0x75f2d0['id']},{})[_0x3bdf('0x15')](function(){return _0x549e18;});}else{return _0x549e18;}})[_0x3bdf('0x38')](function(_0x56b342){logger[_0x3bdf('0x24')](_0x3bdf('0x45'),_0x56b342);throw _0x56b342;});}return _0x549e18;})['then'](respondWithResult(_0x1f3ca0,0xc9))[_0x3bdf('0x38')](handleError(_0x1f3ca0,null));};exports[_0x3bdf('0x46')]=function(_0xbf1f52,_0x1e1c70){if(_0xbf1f52[_0x3bdf('0x3d')]['id']){delete _0xbf1f52[_0x3bdf('0x3d')]['id'];}return db[_0x3bdf('0x27')][_0x3bdf('0x20')]({'where':{'id':_0xbf1f52['params']['id']}})[_0x3bdf('0x15')](handleEntityNotFound(_0x1e1c70,null))[_0x3bdf('0x15')](function(_0x3af373){if(_0x3af373){return db[_0x3bdf('0x27')]['update'](_[_0x3bdf('0x33')](_0xbf1f52[_0x3bdf('0x3d')],[_0x3bdf('0x3e'),_0x3bdf('0x47'),_0x3bdf('0x48'),_0x3bdf('0x49'),_0x3bdf('0x4a'),_0x3bdf('0x4b'),_0x3bdf('0x4c')]),{'where':{'context':_0x3af373[_0x3bdf('0x47')],'exten':_0x3af373[_0x3bdf('0x3e')]},'individualHooks':!![]})['then'](function(_0x3a4675){return _0x3a4675;});}return null;})['then'](respondWithStatusCode(_0x1e1c70,null))[_0x3bdf('0x38')](handleError(_0x1e1c70,null));};exports[_0x3bdf('0x4d')]=function(_0x191ae2,_0x5891eb){var _0x4fe75f=_0x191ae2[_0x3bdf('0x4e')]['id'];var _0x58b20b=_0x191ae2[_0x3bdf('0x3d')];var _0x326581=0xc8;var _0x395497=null;return db[_0x3bdf('0x4f')][_0x3bdf('0x50')]({'isolationLevel':db[_0x3bdf('0x4f')][_0x3bdf('0x51')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xa14c27){return db[_0x3bdf('0x27')]['findOne']({'where':{'id':_0x4fe75f},'transaction':_0xa14c27})[_0x3bdf('0x15')](function(_0x1bd2c7){if(_0x1bd2c7){return db[_0x3bdf('0x27')][_0x3bdf('0x14')]({'where':{'VoiceExtensionId':_0x4fe75f},'transaction':_0xa14c27})[_0x3bdf('0x15')](function(){var _0x3f1be4=_[_0x3bdf('0x1c')](_0x58b20b,function(_0x421029){_0x421029[_0x3bdf('0x52')]=_0x4fe75f;_0x421029['isApp']=!![];return _0x421029;});return _0x1bd2c7[_0x3bdf('0x53')](_0x3f1be4);})[_0x3bdf('0x15')](function(_0x2ec69b){return db[_0x3bdf('0x27')][_0x3bdf('0x54')](_0x2ec69b,{'transaction':_0xa14c27});});}else{_0x326581=0x194;_0x395497=[];}});})['then'](function(){if(_0x326581!==0x194){return db[_0x3bdf('0x27')][_0x3bdf('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4fe75f},'order':'cast(priority\x20as\x20unsigned)'})[_0x3bdf('0x15')](function(_0x5469ea){_0x395497=_0x5469ea;});}})['catch'](function(_0xbdada0){_0x326581=0x1f4;logger[_0x3bdf('0x24')](_0xbdada0[_0x3bdf('0x25')]);if(_0xbdada0[_0x3bdf('0x21')]){delete _0xbdada0[_0x3bdf('0x21')];}_0x395497=_0xbdada0;})['finally'](function(){if(_0x395497===null){_0x5891eb['sendStatus'](_0x326581);}else{if(_0x326581===0x1f4){_0x5891eb[_0x3bdf('0xc')](_0x326581)[_0x3bdf('0x56')](_0x395497);}else{_0x5891eb[_0x3bdf('0xc')](_0x326581)[_0x3bdf('0x13')](_0x395497);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e36f604..b0b6049 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 _0xfa7c=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x187677,_0x74da57){var _0x1a9a8f=function(_0x22b817){while(--_0x22b817){_0x187677['push'](_0x187677['shift']());}};_0x1a9a8f(++_0x74da57);}(_0xfa7c,0xc2));var _0xcfa7=function(_0xbcee05,_0x34a1f8){_0xbcee05=_0xbcee05-0x0;var _0x1c69d4=_0xfa7c[_0xbcee05];return _0x1c69d4;};'use strict';var EventEmitter=require(_0xcfa7('0x0'));var VoiceExtension=require(_0xcfa7('0x1'))['db'][_0xcfa7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcfa7('0x3')](0x0);var events={'afterCreate':_0xcfa7('0x4'),'afterUpdate':_0xcfa7('0x5'),'afterDestroy':_0xcfa7('0x6')};function emitEvent(_0x20156b){return function(_0xa48641,_0x2aba5,_0x173aa8){VoiceExtensionEvents[_0xcfa7('0x7')](_0x20156b+':'+_0xa48641['id'],_0xa48641);VoiceExtensionEvents[_0xcfa7('0x7')](_0x20156b,_0xa48641);_0x173aa8(null);};}for(var e in events){if(events[_0xcfa7('0x8')](e)){var event=events[e];VoiceExtension[_0xcfa7('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xc0e1=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x2ba699,_0x4373cb){var _0xadec4f=function(_0x4df2fe){while(--_0x4df2fe){_0x2ba699['push'](_0x2ba699['shift']());}};_0xadec4f(++_0x4373cb);}(_0xc0e1,0xcc));var _0x1c0e=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0xc0e1[_0x6eb833];return _0xdfc38c;};'use strict';var EventEmitter=require(_0x1c0e('0x0'));var VoiceExtension=require(_0x1c0e('0x1'))['db'][_0x1c0e('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1c0e('0x3')](0x0);var events={'afterCreate':_0x1c0e('0x4'),'afterUpdate':_0x1c0e('0x5'),'afterDestroy':_0x1c0e('0x6')};function emitEvent(_0x203f84){return function(_0x1b939a,_0x40f8d7,_0x2d31cc){VoiceExtensionEvents['emit'](_0x203f84+':'+_0x1b939a['id'],_0x1b939a);VoiceExtensionEvents['emit'](_0x203f84,_0x1b939a);_0x2d31cc(null);};}for(var e in events){if(events[_0x1c0e('0x7')](e)){var event=events[e];VoiceExtension[_0x1c0e('0x8')](e,emitEvent(event));}}module[_0x1c0e('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index bc324d7..02e3239 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 _0xc0a4=['get','then','Hangup','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','intervals','map','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch'];(function(_0x298b27,_0x47ab26){var _0x2074bb=function(_0x33dcbd){while(--_0x33dcbd){_0x298b27['push'](_0x298b27['shift']());}};_0x2074bb(++_0x47ab26);}(_0xc0a4,0x147));var _0x4c0a=function(_0x463111,_0x349886){_0x463111=_0x463111-0x0;var _0x1bd845=_0xc0a4[_0x463111];return _0x1bd845;};'use strict';var _=require('lodash');var attributes=require(_0x4c0a('0x0'));module[_0x4c0a('0x1')]=function(_0x39107c){var _0x489d78=_0x39107c[_0x4c0a('0x2')];function _0x4727a9(_0x4540ae){var _0x23a18d=0x2;var _0x44b0e7=[{'type':_0x4540ae['type'],'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0x4')+_0x4540ae[_0x4c0a('0x5')],'context':_0x4540ae[_0x4c0a('0x6')],'exten':_0x4540ae[_0x4c0a('0x7')],'priority':_0x23a18d++,'VoiceExtensionId':_0x4540ae['id']},{'type':_0x4540ae[_0x4c0a('0x5')],'app':_0x4540ae[_0x4c0a('0x8')]?_0x4c0a('0x3'):_0x4c0a('0x9'),'appdata':_0x4540ae['alias']?_0x4c0a('0xa')+_0x4540ae[_0x4c0a('0x8')]:_0x4c0a('0xb'),'context':_0x4540ae[_0x4c0a('0x6')],'exten':_0x4540ae[_0x4c0a('0x7')],'priority':_0x23a18d++,'VoiceExtensionId':_0x4540ae['id']}];if(_0x4540ae[_0x4c0a('0x5')]===_0x4c0a('0xc')){_0x44b0e7[_0x4c0a('0xd')]({'type':_0x4c0a('0xc'),'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0xe')+_0x4540ae['id'],'context':_0x4540ae[_0x4c0a('0x6')],'exten':_0x4540ae['exten'],'priority':_0x23a18d++,'VoiceExtensionId':_0x4540ae['id']});}_0x44b0e7[_0x4c0a('0xd')]({'type':_0x4540ae[_0x4c0a('0x5')],'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0xf'),'context':_0x4540ae['context'],'exten':_0x4540ae[_0x4c0a('0x7')],'priority':_0x23a18d++,'VoiceExtensionId':_0x4540ae['id']},{'type':_0x4540ae[_0x4c0a('0x5')],'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0x10'),'context':_0x4540ae[_0x4c0a('0x6')],'exten':_0x4540ae[_0x4c0a('0x7')],'priority':_0x23a18d++,'VoiceExtensionId':_0x4540ae['id']},{'type':_0x4540ae[_0x4c0a('0x5')],'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0x11'),'context':_0x4540ae[_0x4c0a('0x6')],'exten':_0x4540ae[_0x4c0a('0x7')],'priority':_0x23a18d++,'VoiceExtensionId':_0x4540ae['id']});return _0x44b0e7;}function _0x4637a8(_0x27b812){var _0x1ebf5e=0x2;var _0x46a3c1=[{'type':_0x4c0a('0x12'),'app':'Set','appdata':_0x4c0a('0x13'),'context':_0x27b812['context'],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':_0x27b812[_0x4c0a('0x8')]?_0x4c0a('0x3'):_0x4c0a('0x9'),'appdata':_0x27b812['alias']?_0x4c0a('0xa')+_0x27b812['alias']:_0x4c0a('0xb'),'context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':'Set','appdata':_0x4c0a('0x14')+(_0x27b812[_0x4c0a('0x15')]?_0x4c0a('0x16')+_0x27b812[_0x4c0a('0x15')]+'}':_0x4c0a('0x17')),'context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':'outbound','app':'Set','appdata':_0x4c0a('0xe')+_0x27b812['id'],'context':_0x27b812['context'],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':_0x4c0a('0x18'),'appdata':_0x4c0a('0x19')+(_0x1ebf5e+0x2)+_0x4c0a('0x1a')+(_0x1ebf5e+0x1)+')','context':_0x27b812['context'],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':'Set','appdata':_0x27b812['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x27b812[_0x4c0a('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x27b812['context'],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':'outbound','app':_0x4c0a('0x3'),'appdata':_0x4c0a('0xf'),'context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812['exten'],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':_0x4c0a('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':_0x4c0a('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':'outbound','app':_0x4c0a('0x3'),'appdata':_0x4c0a('0x1b')+_0x27b812['id'],'context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']}];if(_0x27b812[_0x4c0a('0x1c')](_0x4c0a('0x1d'))&&_0x27b812[_0x4c0a('0x1d')]!=='none'){_0x46a3c1[_0x4c0a('0xd')]({'type':_0x4c0a('0x12'),'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0x1e'),'context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812[_0x4c0a('0x7')],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']},{'type':_0x4c0a('0x12'),'app':_0x4c0a('0x3'),'appdata':_0x4c0a('0x1f')+_0x27b812['recordingFormat']||_0x4c0a('0x20'),'context':_0x27b812[_0x4c0a('0x6')],'exten':_0x27b812['exten'],'priority':_0x1ebf5e++,'VoiceExtensionId':_0x27b812['id']});}return _0x46a3c1;}function _0x56b1dc(_0xd5d550,_0x48ed41){var _0x484d0a=[{'name':_0x4c0a('0x21'),'param':0x0},{'name':_0x4c0a('0x22'),'param':0x1},{'name':_0x4c0a('0x23'),'param':0x2},{'name':_0x4c0a('0x24'),'param':0x3}];var _0x216acd={};var _0x547fce=_0x48ed41[_0x4c0a('0x25')](',');var _0x44887f=[];for(var _0x43a696=0x0;_0x43a696<_0x484d0a[_0x4c0a('0x26')];_0x43a696++){switch(_0x484d0a[_0x43a696][_0x4c0a('0x27')]){case'trunk':_0x216acd[_0x4c0a('0x21')]=_0x547fce[_0x484d0a[_0x43a696][_0x4c0a('0x28')]]['split']('/')[0x1];_0x216acd[_0x4c0a('0x29')]=_0x547fce[_0x484d0a[_0x43a696][_0x4c0a('0x28')]][_0x4c0a('0x25')]('/')[0x2];_0x216acd[_0x4c0a('0x2a')]=_0x216acd[_0x4c0a('0x29')]?_0x216acd['phone'][_0x4c0a('0x25')]('$')[0x0]:undefined;_0x216acd[_0x4c0a('0x29')]=_0xd5d550[_0x4c0a('0x15')]?(_0x216acd[_0x4c0a('0x2a')]||'')+'${EXTEN:'+_0xd5d550[_0x4c0a('0x15')]+'}':(_0x216acd[_0x4c0a('0x2a')]||'')+_0x4c0a('0x17');_0x44887f[_0x484d0a[_0x43a696][_0x4c0a('0x28')]]=['SIP',_0x216acd[_0x4c0a('0x21')],_0x216acd[_0x4c0a('0x29')]][_0x4c0a('0x2b')]('/');break;case _0x4c0a('0x23'):_0x216acd[_0x4c0a('0x23')]=_0x547fce[_0x484d0a[_0x43a696][_0x4c0a('0x28')]];if(_0xd5d550[_0x4c0a('0x1d')]!=='none'){if(_0x216acd[_0x4c0a('0x23')][_0x4c0a('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x216acd['options']+=_0x4c0a('0x2d');}}else{_0x216acd[_0x4c0a('0x23')]=_0x216acd[_0x4c0a('0x23')][_0x4c0a('0x2e')](_0x4c0a('0x2d'),'');}_0x44887f[_0x484d0a[_0x43a696][_0x4c0a('0x28')]]=_0x216acd['options'];break;default:_0x44887f[_0x484d0a[_0x43a696][_0x4c0a('0x28')]]=_0x547fce[_0x484d0a[_0x43a696][_0x4c0a('0x28')]];}}return _0x44887f['join'](',');}function _0x41c101(_0x288ca1,_0x154ba7,_0x477347){return new Promise(function(_0x1c0e57,_0x323906){var _0x29818d=[];if(_[_0x4c0a('0x2f')](_0x154ba7))return _0x1c0e57(_0x29818d);_0x489d78['Interval'][_0x4c0a('0x30')]({'attributes':['id',_0x4c0a('0x31'),_0x4c0a('0x32')],'raw':!![]})['then'](function(_0x3f9a95){for(var _0x524dc5=0x0,_0x580345=0x0;_0x524dc5<_0x154ba7['length'];_0x524dc5++,_0x580345=0x0){var _0x2bf5ab=_0x154ba7[_0x524dc5];var _0x466cef=[];var _0x3ebfa4=[];delete _0x2bf5ab['id'];if(_0x2bf5ab[_0x4c0a('0x31')]!=='*,*,*,*'){_0x2bf5ab['intervals']=[_0x2bf5ab[_0x4c0a('0x31')]];}else{_0x2bf5ab[_0x4c0a('0x33')]=_0x2bf5ab[_0x4c0a('0x32')]?_[_0x4c0a('0x34')](_['filter'](_0x3f9a95,{'IntervalId':_0x2bf5ab['IntervalId']}),_0x4c0a('0x31')):[];}_0x2bf5ab[_0x4c0a('0x6')]=_0x288ca1[_0x4c0a('0x6')];_0x2bf5ab['exten']=_0x288ca1[_0x4c0a('0x7')];if(_0x2bf5ab['type'])_0x2bf5ab['type']=_0x2bf5ab[_0x4c0a('0x5')]['toLowerCase']();if(_0x288ca1[_0x4c0a('0x5')]===_0x4c0a('0x12')){if(_0x2bf5ab[_0x4c0a('0x1c')](_0x4c0a('0x35'))&&_0x2bf5ab['tag']&&_0x2bf5ab['tag']!=='--'){_0x466cef[_0x4c0a('0xd')]({'type':_0x2bf5ab[_0x4c0a('0x5')]['toLowerCase'](),'app':_0x4c0a('0x3'),'appdata':'CDR(tag)='+_0x2bf5ab[_0x4c0a('0x35')],'context':_0x288ca1[_0x4c0a('0x6')],'exten':_0x288ca1[_0x4c0a('0x7')],'priority':_0x2bf5ab[_0x4c0a('0x33')]['length']+_0x477347+_0x580345++,'VoiceExtensionId':_0x288ca1['id']});}_0x466cef[_0x4c0a('0xd')]({'type':_0x2bf5ab['type'][_0x4c0a('0x36')](),'app':'ExecIf','appdata':_0x4c0a('0x37')+(_0x2bf5ab[_0x4c0a('0x38')]?_0x4c0a('0x39')+_0x2bf5ab[_0x4c0a('0x38')]+')':_0x4c0a('0x3a')),'context':_0x288ca1[_0x4c0a('0x6')],'exten':_0x288ca1['exten'],'priority':_0x2bf5ab[_0x4c0a('0x33')][_0x4c0a('0x26')]+_0x477347+_0x580345++,'VoiceExtensionId':_0x288ca1['id']});}else{if(_0x2bf5ab[_0x4c0a('0x1c')](_0x4c0a('0x3b'))){if([_0x4c0a('0x3c'),_0x4c0a('0x3d')][_0x4c0a('0x3e')](_0x2bf5ab[_0x4c0a('0x3f')][_0x4c0a('0x36')]())&&_0x2bf5ab[_0x4c0a('0x40')]!==_0x4c0a('0x41')){if(_0x2bf5ab[_0x4c0a('0x3b')]){_0x466cef['push']({'type':_0x2bf5ab['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x4c0a('0x42'),'context':_0x288ca1[_0x4c0a('0x6')],'exten':_0x288ca1[_0x4c0a('0x7')],'priority':_0x2bf5ab[_0x4c0a('0x33')][_0x4c0a('0x26')]+_0x477347+_0x580345++,'VoiceExtensionId':_0x288ca1['id']});_0x466cef[_0x4c0a('0xd')]({'type':_0x2bf5ab['type']['toLowerCase'](),'app':'Set','appdata':_0x4c0a('0x43'),'context':_0x288ca1[_0x4c0a('0x6')],'exten':_0x288ca1['exten'],'priority':_0x2bf5ab[_0x4c0a('0x33')][_0x4c0a('0x26')]+_0x477347+_0x580345++,'VoiceExtensionId':_0x288ca1['id']});}else{_0x466cef['push']({'type':_0x2bf5ab[_0x4c0a('0x5')][_0x4c0a('0x36')](),'app':'ExecIf','appdata':_0x4c0a('0x44'),'context':_0x288ca1[_0x4c0a('0x6')],'exten':_0x288ca1[_0x4c0a('0x7')],'priority':_0x2bf5ab[_0x4c0a('0x33')]['length']+_0x477347+_0x580345++,'VoiceExtensionId':_0x288ca1['id']});_0x466cef[_0x4c0a('0xd')]({'type':_0x2bf5ab[_0x4c0a('0x5')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x288ca1[_0x4c0a('0x6')],'exten':_0x288ca1[_0x4c0a('0x7')],'priority':_0x2bf5ab[_0x4c0a('0x33')]['length']+_0x477347+_0x580345++,'VoiceExtensionId':_0x288ca1['id']});}}}}for(var _0x55df34=0x0;_0x55df34<_0x2bf5ab[_0x4c0a('0x33')][_0x4c0a('0x26')];_0x55df34++){var _0x11a8a8=_0x477347+_0x2bf5ab['intervals'][_0x4c0a('0x26')];var _0x331508=_0x55df34===_0x2bf5ab['intervals'][_0x4c0a('0x26')]-0x1?_0x477347+_0x466cef[_0x4c0a('0x26')]+_0x3ebfa4['length']+0x2:_0x477347+_0x55df34+0x1;_0x466cef[_0x4c0a('0x45')](_0x55df34,0x0,{'type':_0x288ca1['type'],'app':_0x4c0a('0x46'),'appdata':_0x2bf5ab['intervals'][_0x55df34]+'?'+_0x288ca1[_0x4c0a('0x6')]+',${EXTEN},'+_0x11a8a8+':'+_0x288ca1[_0x4c0a('0x6')]+_0x4c0a('0x47')+_0x331508,'exten':_0x288ca1[_0x4c0a('0x7')],'context':_0x288ca1[_0x4c0a('0x6')],'priority':_0x477347+_0x55df34,'VoiceExtensionId':_0x288ca1['id']});}if(_0x2bf5ab[_0x4c0a('0x40')]===_0x4c0a('0x48'))_0x2bf5ab[_0x4c0a('0x49')]=_0x56b1dc(_0x288ca1,_0x2bf5ab[_0x4c0a('0x49')]);_0x2bf5ab[_0x4c0a('0x4a')]=_0x466cef[_0x4c0a('0x26')]?_[_0x4c0a('0x4b')](_0x466cef)[_0x4c0a('0x4a')]+0x1:_0x477347;_0x29818d=_[_0x4c0a('0x4c')](_0x29818d,_0x466cef,[_0x2bf5ab],_0x3ebfa4);_0x477347=_[_0x4c0a('0x4b')](_0x29818d)[_0x4c0a('0x4a')]+0x1;}return _0x1c0e57(_0x29818d);})[_0x4c0a('0x4d')](function(_0x56d885){_0x323906(_0x56d885);});});}return _0x39107c['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x312543){var _0x2bed24=this[_0x4c0a('0x4e')]({'plain':!![]});var _0x45c958=_0x2bed24[_0x4c0a('0x5')]===_0x4c0a('0x12')?_0x4637a8(_0x2bed24):_0x4727a9(_0x2bed24);return _0x41c101(_0x2bed24,_0x312543,_[_0x4c0a('0x4b')](_0x45c958)[_0x4c0a('0x4a')]+0x1)[_0x4c0a('0x4f')](function(_0x5ab650){var _0x43de78=_[_0x4c0a('0x4c')](_0x45c958,_0x5ab650);_0x43de78[_0x4c0a('0xd')]({'type':_0x2bed24[_0x4c0a('0x5')],'app':_0x4c0a('0x50'),'exten':_0x2bed24[_0x4c0a('0x7')],'context':_0x2bed24['context'],'priority':_['last'](_0x43de78)[_0x4c0a('0x4a')]+0x1,'VoiceExtensionId':_0x2bed24['id']});return _0x43de78;});}}});}; \ No newline at end of file +var _0x42f0=['CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','wav','trunk','timeout','options','url','name','split','phone','param','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','interval','IntervalId','then','length','*,*,*,*','intervals','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','priority','concat','define','VoiceExtension','voice_extensions','get','last','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound'];(function(_0x1b3c62,_0x4122d2){var _0x238f32=function(_0x24e55a){while(--_0x24e55a){_0x1b3c62['push'](_0x1b3c62['shift']());}};_0x238f32(++_0x4122d2);}(_0x42f0,0x1b4));var _0x042f=function(_0x4af541,_0x2aedf7){_0x4af541=_0x4af541-0x0;var _0x1c2550=_0x42f0[_0x4af541];return _0x1c2550;};'use strict';var _=require(_0x042f('0x0'));var attributes=require(_0x042f('0x1'));module[_0x042f('0x2')]=function(_0x3903d5){var _0x3f5f7d=_0x3903d5[_0x042f('0x3')];function _0x1856c1(_0x9b5bde){var _0x49e418=0x2;var _0x339e9c=[{'type':_0x9b5bde[_0x042f('0x4')],'app':_0x042f('0x5'),'appdata':_0x042f('0x6')+_0x9b5bde[_0x042f('0x4')],'context':_0x9b5bde[_0x042f('0x7')],'exten':_0x9b5bde[_0x042f('0x8')],'priority':_0x49e418++,'VoiceExtensionId':_0x9b5bde['id']},{'type':_0x9b5bde['type'],'app':_0x9b5bde[_0x042f('0x9')]?_0x042f('0x5'):'NoOp','appdata':_0x9b5bde['alias']?_0x042f('0xa')+_0x9b5bde['alias']:_0x042f('0xb'),'context':_0x9b5bde['context'],'exten':_0x9b5bde['exten'],'priority':_0x49e418++,'VoiceExtensionId':_0x9b5bde['id']}];if(_0x9b5bde[_0x042f('0x4')]===_0x042f('0xc')){_0x339e9c[_0x042f('0xd')]({'type':'inbound','app':'Set','appdata':_0x042f('0xe')+_0x9b5bde['id'],'context':_0x9b5bde['context'],'exten':_0x9b5bde['exten'],'priority':_0x49e418++,'VoiceExtensionId':_0x9b5bde['id']});}_0x339e9c[_0x042f('0xd')]({'type':_0x9b5bde[_0x042f('0x4')],'app':_0x042f('0x5'),'appdata':_0x042f('0xf'),'context':_0x9b5bde[_0x042f('0x7')],'exten':_0x9b5bde['exten'],'priority':_0x49e418++,'VoiceExtensionId':_0x9b5bde['id']},{'type':_0x9b5bde[_0x042f('0x4')],'app':_0x042f('0x5'),'appdata':_0x042f('0x10'),'context':_0x9b5bde['context'],'exten':_0x9b5bde[_0x042f('0x8')],'priority':_0x49e418++,'VoiceExtensionId':_0x9b5bde['id']},{'type':_0x9b5bde['type'],'app':_0x042f('0x5'),'appdata':_0x042f('0x11'),'context':_0x9b5bde[_0x042f('0x7')],'exten':_0x9b5bde['exten'],'priority':_0x49e418++,'VoiceExtensionId':_0x9b5bde['id']});return _0x339e9c;}function _0x562bd4(_0x4bf3f5){var _0x4db10c=0x2;var _0x2424ba=[{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':_0x042f('0x13'),'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x4bf3f5[_0x042f('0x9')]?_0x042f('0x5'):'NoOp','appdata':_0x4bf3f5['alias']?_0x042f('0xa')+_0x4bf3f5['alias']:_0x042f('0xb'),'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':_0x042f('0x14')+(_0x4bf3f5[_0x042f('0x15')]?'${EXTEN:'+_0x4bf3f5[_0x042f('0x15')]+'}':_0x042f('0x16')),'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':'outbound','app':_0x042f('0x5'),'appdata':_0x042f('0xe')+_0x4bf3f5['id'],'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':'outbound','app':_0x042f('0x17'),'appdata':_0x042f('0x18')+(_0x4db10c+0x2)+'):Goto('+(_0x4db10c+0x1)+')','context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5['exten'],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':'Set','appdata':_0x4bf3f5['cutdigits']?_0x042f('0x19')+_0x4bf3f5[_0x042f('0x15')]+'}':_0x042f('0x1a'),'context':_0x4bf3f5['context'],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':_0x042f('0x10'),'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5['exten'],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':_0x042f('0x11'),'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5['exten'],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':'outboundrouteid='+_0x4bf3f5['id'],'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']}];if(_0x4bf3f5[_0x042f('0x1b')](_0x042f('0x1c'))&&_0x4bf3f5[_0x042f('0x1c')]!==_0x042f('0x1d')){_0x2424ba[_0x042f('0xd')]({'type':'outbound','app':_0x042f('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']},{'type':_0x042f('0x12'),'app':_0x042f('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4bf3f5[_0x042f('0x1c')]||_0x042f('0x1e'),'context':_0x4bf3f5[_0x042f('0x7')],'exten':_0x4bf3f5[_0x042f('0x8')],'priority':_0x4db10c++,'VoiceExtensionId':_0x4bf3f5['id']});}return _0x2424ba;}function _0x55752e(_0x17bb9c,_0x1a8c35){var _0x33c47a=[{'name':_0x042f('0x1f'),'param':0x0},{'name':_0x042f('0x20'),'param':0x1},{'name':_0x042f('0x21'),'param':0x2},{'name':_0x042f('0x22'),'param':0x3}];var _0x3bb90c={};var _0x326153=_0x1a8c35['split'](',');var _0x5656e4=[];for(var _0x2a9bce=0x0;_0x2a9bce<_0x33c47a['length'];_0x2a9bce++){switch(_0x33c47a[_0x2a9bce][_0x042f('0x23')]){case'trunk':_0x3bb90c[_0x042f('0x1f')]=_0x326153[_0x33c47a[_0x2a9bce]['param']][_0x042f('0x24')]('/')[0x1];_0x3bb90c[_0x042f('0x25')]=_0x326153[_0x33c47a[_0x2a9bce][_0x042f('0x26')]][_0x042f('0x24')]('/')[0x2];_0x3bb90c['prefix']=_0x3bb90c['phone']?_0x3bb90c[_0x042f('0x25')][_0x042f('0x24')]('$')[0x0]:undefined;_0x3bb90c[_0x042f('0x25')]=_0x17bb9c[_0x042f('0x15')]?(_0x3bb90c[_0x042f('0x27')]||'')+_0x042f('0x28')+_0x17bb9c[_0x042f('0x15')]+'}':(_0x3bb90c[_0x042f('0x27')]||'')+_0x042f('0x16');_0x5656e4[_0x33c47a[_0x2a9bce]['param']]=[_0x042f('0x29'),_0x3bb90c[_0x042f('0x1f')],_0x3bb90c['phone']][_0x042f('0x2a')]('/');break;case _0x042f('0x21'):_0x3bb90c['options']=_0x326153[_0x33c47a[_0x2a9bce][_0x042f('0x26')]];if(_0x17bb9c[_0x042f('0x1c')]!==_0x042f('0x1d')){if(_0x3bb90c[_0x042f('0x21')][_0x042f('0x2b')](_0x042f('0x2c'))<0x0){_0x3bb90c['options']+=_0x042f('0x2c');}}else{_0x3bb90c[_0x042f('0x21')]=_0x3bb90c[_0x042f('0x21')][_0x042f('0x2d')](_0x042f('0x2c'),'');}_0x5656e4[_0x33c47a[_0x2a9bce]['param']]=_0x3bb90c[_0x042f('0x21')];break;default:_0x5656e4[_0x33c47a[_0x2a9bce][_0x042f('0x26')]]=_0x326153[_0x33c47a[_0x2a9bce][_0x042f('0x26')]];}}return _0x5656e4[_0x042f('0x2a')](',');}function _0x1ae4d3(_0x264155,_0x25b51f,_0x1b1d77){return new Promise(function(_0x50a59f,_0x401493){var _0x3addfc=[];if(_['isEmpty'](_0x25b51f))return _0x50a59f(_0x3addfc);_0x3f5f7d[_0x042f('0x2e')]['findAll']({'attributes':['id',_0x042f('0x2f'),_0x042f('0x30')],'raw':!![]})[_0x042f('0x31')](function(_0x3c87e7){for(var _0x577ca4=0x0,_0xbed3cb=0x0;_0x577ca4<_0x25b51f[_0x042f('0x32')];_0x577ca4++,_0xbed3cb=0x0){var _0x40bef3=_0x25b51f[_0x577ca4];var _0x51b38c=[];var _0x5d1009=[];delete _0x40bef3['id'];if(_0x40bef3[_0x042f('0x2f')]!==_0x042f('0x33')){_0x40bef3[_0x042f('0x34')]=[_0x40bef3[_0x042f('0x2f')]];}else{_0x40bef3[_0x042f('0x34')]=_0x40bef3[_0x042f('0x30')]?_['map'](_['filter'](_0x3c87e7,{'IntervalId':_0x40bef3[_0x042f('0x30')]}),_0x042f('0x2f')):[];}_0x40bef3[_0x042f('0x7')]=_0x264155[_0x042f('0x7')];_0x40bef3[_0x042f('0x8')]=_0x264155[_0x042f('0x8')];if(_0x40bef3['type'])_0x40bef3[_0x042f('0x4')]=_0x40bef3[_0x042f('0x4')]['toLowerCase']();if(_0x264155[_0x042f('0x4')]===_0x042f('0x12')){if(_0x40bef3['hasOwnProperty'](_0x042f('0x35'))&&_0x40bef3[_0x042f('0x35')]&&_0x40bef3['tag']!=='--'){_0x51b38c['push']({'type':_0x40bef3[_0x042f('0x4')][_0x042f('0x36')](),'app':'Set','appdata':'CDR(tag)='+_0x40bef3['tag'],'context':_0x264155['context'],'exten':_0x264155[_0x042f('0x8')],'priority':_0x40bef3[_0x042f('0x34')]['length']+_0x1b1d77+_0xbed3cb++,'VoiceExtensionId':_0x264155['id']});}_0x51b38c['push']({'type':_0x40bef3[_0x042f('0x4')]['toLowerCase'](),'app':_0x042f('0x17'),'appdata':_0x042f('0x37')+(_0x40bef3[_0x042f('0x38')]?'Set(CALLERID(all)='+_0x40bef3['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x264155[_0x042f('0x7')],'exten':_0x264155[_0x042f('0x8')],'priority':_0x40bef3[_0x042f('0x34')][_0x042f('0x32')]+_0x1b1d77+_0xbed3cb++,'VoiceExtensionId':_0x264155['id']});}else{if(_0x40bef3['hasOwnProperty'](_0x042f('0x39'))){if(['queue','playback'][_0x042f('0x3a')](_0x40bef3[_0x042f('0x3b')][_0x042f('0x36')]())&&_0x40bef3[_0x042f('0x3c')]!==_0x042f('0x3d')){if(_0x40bef3[_0x042f('0x39')]){_0x51b38c[_0x042f('0xd')]({'type':_0x40bef3[_0x042f('0x4')][_0x042f('0x36')](),'app':_0x042f('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x264155[_0x042f('0x7')],'exten':_0x264155['exten'],'priority':_0x40bef3['intervals']['length']+_0x1b1d77+_0xbed3cb++,'VoiceExtensionId':_0x264155['id']});_0x51b38c[_0x042f('0xd')]({'type':_0x40bef3['type']['toLowerCase'](),'app':_0x042f('0x5'),'appdata':_0x042f('0x3e'),'context':_0x264155[_0x042f('0x7')],'exten':_0x264155[_0x042f('0x8')],'priority':_0x40bef3[_0x042f('0x34')][_0x042f('0x32')]+_0x1b1d77+_0xbed3cb++,'VoiceExtensionId':_0x264155['id']});}else{_0x51b38c[_0x042f('0xd')]({'type':_0x40bef3[_0x042f('0x4')][_0x042f('0x36')](),'app':_0x042f('0x17'),'appdata':_0x042f('0x3f'),'context':_0x264155[_0x042f('0x7')],'exten':_0x264155[_0x042f('0x8')],'priority':_0x40bef3[_0x042f('0x34')][_0x042f('0x32')]+_0x1b1d77+_0xbed3cb++,'VoiceExtensionId':_0x264155['id']});_0x51b38c['push']({'type':_0x40bef3[_0x042f('0x4')][_0x042f('0x36')](),'app':_0x042f('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x264155[_0x042f('0x7')],'exten':_0x264155['exten'],'priority':_0x40bef3[_0x042f('0x34')]['length']+_0x1b1d77+_0xbed3cb++,'VoiceExtensionId':_0x264155['id']});}}}}for(var _0x450f98=0x0;_0x450f98<_0x40bef3[_0x042f('0x34')][_0x042f('0x32')];_0x450f98++){var _0x10d6ca=_0x1b1d77+_0x40bef3[_0x042f('0x34')][_0x042f('0x32')];var _0x43e8e2=_0x450f98===_0x40bef3[_0x042f('0x34')][_0x042f('0x32')]-0x1?_0x1b1d77+_0x51b38c[_0x042f('0x32')]+_0x5d1009[_0x042f('0x32')]+0x2:_0x1b1d77+_0x450f98+0x1;_0x51b38c[_0x042f('0x40')](_0x450f98,0x0,{'type':_0x264155['type'],'app':'GotoIfTime','appdata':_0x40bef3[_0x042f('0x34')][_0x450f98]+'?'+_0x264155['context']+_0x042f('0x41')+_0x10d6ca+':'+_0x264155[_0x042f('0x7')]+_0x042f('0x41')+_0x43e8e2,'exten':_0x264155[_0x042f('0x8')],'context':_0x264155[_0x042f('0x7')],'priority':_0x1b1d77+_0x450f98,'VoiceExtensionId':_0x264155['id']});}if(_0x40bef3[_0x042f('0x3c')]===_0x042f('0x42'))_0x40bef3[_0x042f('0x43')]=_0x55752e(_0x264155,_0x40bef3[_0x042f('0x43')]);_0x40bef3[_0x042f('0x44')]=_0x51b38c[_0x042f('0x32')]?_['last'](_0x51b38c)[_0x042f('0x44')]+0x1:_0x1b1d77;_0x3addfc=_[_0x042f('0x45')](_0x3addfc,_0x51b38c,[_0x40bef3],_0x5d1009);_0x1b1d77=_['last'](_0x3addfc)['priority']+0x1;}return _0x50a59f(_0x3addfc);})['catch'](function(_0x3bb77d){_0x401493(_0x3bb77d);});});}return _0x3903d5[_0x042f('0x46')](_0x042f('0x47'),attributes,{'tableName':_0x042f('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3c81c9){var _0x4b8079=this[_0x042f('0x49')]({'plain':!![]});var _0x44fcdf=_0x4b8079['type']===_0x042f('0x12')?_0x562bd4(_0x4b8079):_0x1856c1(_0x4b8079);return _0x1ae4d3(_0x4b8079,_0x3c81c9,_[_0x042f('0x4a')](_0x44fcdf)[_0x042f('0x44')]+0x1)[_0x042f('0x31')](function(_0x30408b){var _0x25cfd0=_[_0x042f('0x45')](_0x44fcdf,_0x30408b);_0x25cfd0[_0x042f('0xd')]({'type':_0x4b8079['type'],'app':_0x042f('0x4b'),'exten':_0x4b8079[_0x042f('0x8')],'context':_0x4b8079[_0x042f('0x7')],'priority':_[_0x042f('0x4a')](_0x25cfd0)[_0x042f('0x44')]+0x1,'VoiceExtensionId':_0x4b8079['id']});return _0x25cfd0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index aa7c1c5..156f60f 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 _0x3dd6=['redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x7c0a,_0x10342c){var _0x56d1dc=function(_0x16f988){while(--_0x16f988){_0x7c0a['push'](_0x7c0a['shift']());}};_0x56d1dc(++_0x10342c);}(_0x3dd6,0xcf));var _0x63dd=function(_0xd92e0f,_0x4c28de){_0xd92e0f=_0xd92e0f-0x0;var _0x408a33=_0x3dd6[_0xd92e0f];return _0x408a33;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63dd('0x0'));var rs=require(_0x63dd('0x1'));var fs=require('fs');var Redis=require(_0x63dd('0x2'));var db=require(_0x63dd('0x3'))['db'];var utils=require(_0x63dd('0x4'));var logger=require(_0x63dd('0x5'))('rpc');var config=require(_0x63dd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x63dd('0x7')][_0x63dd('0x8')]({'port':0x232a});config[_0x63dd('0x9')]=_[_0x63dd('0xa')](config[_0x63dd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x63dd('0xb'))(new Redis(config[_0x63dd('0x9')]));require(_0x63dd('0xc'))[_0x63dd('0xd')](socket);function respondWithRpcPromise(_0x5b9c34,_0x5b7d81,_0x374f8e){return new BPromise(function(_0x1508c4,_0x165462){return client[_0x63dd('0xe')](_0x5b9c34,_0x374f8e)[_0x63dd('0xf')](function(_0x4f4230){logger[_0x63dd('0x10')](_0x63dd('0x11'),_0x5b7d81,_0x63dd('0x12'));logger[_0x63dd('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5b7d81,_0x63dd('0x12'),JSON[_0x63dd('0x14')](_0x4f4230));if(_0x4f4230[_0x63dd('0x15')]){if(_0x4f4230[_0x63dd('0x15')][_0x63dd('0x16')]===0x1f4){logger[_0x63dd('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x5b7d81,_0x4f4230['error'][_0x63dd('0x17')]);return _0x165462(_0x4f4230[_0x63dd('0x15')][_0x63dd('0x17')]);}logger['error'](_0x63dd('0x11'),_0x5b7d81,_0x4f4230[_0x63dd('0x15')][_0x63dd('0x17')]);return _0x1508c4(_0x4f4230['error'][_0x63dd('0x17')]);}else{logger[_0x63dd('0x10')](_0x63dd('0x11'),_0x5b7d81,_0x63dd('0x12'));_0x1508c4(_0x4f4230[_0x63dd('0x18')][_0x63dd('0x17')]);}})[_0x63dd('0x19')](function(_0x460980){logger[_0x63dd('0x15')](_0x63dd('0x11'),_0x5b7d81,_0x460980);_0x165462(_0x460980);});});}exports[_0x63dd('0x1a')]=function(_0x1e09a5){var _0x4f9e9d=this;return new Promise(function(_0x2e1305,_0x596046){return db[_0x63dd('0x1b')][_0x63dd('0x1c')]({'raw':_0x1e09a5[_0x63dd('0x1d')]?_0x1e09a5['options'][_0x63dd('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e09a5[_0x63dd('0x1d')]?_0x1e09a5[_0x63dd('0x1d')][_0x63dd('0x1f')]||null:null,'attributes':_0x1e09a5[_0x63dd('0x1d')]?_0x1e09a5[_0x63dd('0x1d')][_0x63dd('0x20')]||null:null,'limit':_0x1e09a5[_0x63dd('0x1d')]?_0x1e09a5[_0x63dd('0x1d')]['limit']||null:null,'include':_0x1e09a5['options']?_0x1e09a5['options'][_0x63dd('0x21')]?_[_0x63dd('0x22')](_0x1e09a5['options'][_0x63dd('0x21')],function(_0x222e13){return{'model':db[_0x222e13['model']],'as':_0x222e13['as'],'attributes':_0x222e13[_0x63dd('0x20')],'include':_0x222e13[_0x63dd('0x21')]?_['map'](_0x222e13['include'],function(_0x2417f0){return{'model':db[_0x2417f0[_0x63dd('0x23')]],'as':_0x2417f0['as'],'attributes':_0x2417f0[_0x63dd('0x20')],'include':_0x2417f0[_0x63dd('0x21')]?_[_0x63dd('0x22')](_0x2417f0['include'],function(_0x7ca662){return{'model':db[_0x7ca662['model']],'as':_0x7ca662['as'],'attributes':_0x7ca662[_0x63dd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c23d9){logger[_0x63dd('0x10')](_0x63dd('0x1a'),_0x1e09a5);logger[_0x63dd('0x13')](_0x63dd('0x1a'),_0x1e09a5,JSON[_0x63dd('0x14')](_0x5c23d9));_0x2e1305(_0x5c23d9);})[_0x63dd('0x19')](function(_0x5525fd){logger[_0x63dd('0x15')](_0x63dd('0x1a'),_0x5525fd[_0x63dd('0x17')],_0x1e09a5);_0x596046(_0x4f9e9d[_0x63dd('0x15')](0x1f4,_0x5525fd['message']));});});}; \ No newline at end of file +var _0x4489=['ioredis','../../mysqldb','client','redis','localhost','socket.io-emitter','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','limit','include','model','attributes','stringify','lodash','util','bluebird','randomstring'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9448('0x0'));var util=require(_0x9448('0x1'));var moment=require('moment');var BPromise=require(_0x9448('0x2'));var rs=require(_0x9448('0x3'));var fs=require('fs');var Redis=require(_0x9448('0x4'));var db=require(_0x9448('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9448('0x6')]['http']({'port':0x232a});config[_0x9448('0x7')]=_['defaults'](config[_0x9448('0x7')],{'host':_0x9448('0x8'),'port':0x18eb});var socket=require(_0x9448('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x301bf5,_0x3e272d,_0x4640c3){return new BPromise(function(_0x5d20e2,_0x20b436){return client['request'](_0x301bf5,_0x4640c3)[_0x9448('0xa')](function(_0x444830){logger[_0x9448('0xb')](_0x9448('0xc'),_0x3e272d,_0x9448('0xd'));logger[_0x9448('0xe')](_0x9448('0xf'),_0x3e272d,_0x9448('0xd'),JSON['stringify'](_0x444830));if(_0x444830[_0x9448('0x10')]){if(_0x444830['error'][_0x9448('0x11')]===0x1f4){logger[_0x9448('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x3e272d,_0x444830[_0x9448('0x10')][_0x9448('0x12')]);return _0x20b436(_0x444830[_0x9448('0x10')][_0x9448('0x12')]);}logger[_0x9448('0x10')](_0x9448('0xc'),_0x3e272d,_0x444830[_0x9448('0x10')][_0x9448('0x12')]);return _0x5d20e2(_0x444830['error'][_0x9448('0x12')]);}else{logger['info'](_0x9448('0xc'),_0x3e272d,_0x9448('0xd'));_0x5d20e2(_0x444830[_0x9448('0x13')][_0x9448('0x12')]);}})[_0x9448('0x14')](function(_0x194e0e){logger[_0x9448('0x10')](_0x9448('0xc'),_0x3e272d,_0x194e0e);_0x20b436(_0x194e0e);});});}exports[_0x9448('0x15')]=function(_0x18e92c){var _0x5c64b8=this;return new Promise(function(_0x1cef11,_0x4fd323){return db['VoiceExtension'][_0x9448('0x16')]({'raw':_0x18e92c['options']?_0x18e92c['options']['raw']===undefined?!![]:![]:!![],'where':_0x18e92c[_0x9448('0x17')]?_0x18e92c['options'][_0x9448('0x18')]||null:null,'attributes':_0x18e92c[_0x9448('0x17')]?_0x18e92c[_0x9448('0x17')]['attributes']||null:null,'limit':_0x18e92c[_0x9448('0x17')]?_0x18e92c[_0x9448('0x17')][_0x9448('0x19')]||null:null,'include':_0x18e92c[_0x9448('0x17')]?_0x18e92c[_0x9448('0x17')][_0x9448('0x1a')]?_['map'](_0x18e92c['options'][_0x9448('0x1a')],function(_0x124892){return{'model':db[_0x124892[_0x9448('0x1b')]],'as':_0x124892['as'],'attributes':_0x124892[_0x9448('0x1c')],'include':_0x124892[_0x9448('0x1a')]?_['map'](_0x124892[_0x9448('0x1a')],function(_0x4e4134){return{'model':db[_0x4e4134[_0x9448('0x1b')]],'as':_0x4e4134['as'],'attributes':_0x4e4134[_0x9448('0x1c')],'include':_0x4e4134[_0x9448('0x1a')]?_['map'](_0x4e4134[_0x9448('0x1a')],function(_0x3bf608){return{'model':db[_0x3bf608[_0x9448('0x1b')]],'as':_0x3bf608['as'],'attributes':_0x3bf608[_0x9448('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9448('0xa')](function(_0x442a15){logger['info'](_0x9448('0x15'),_0x18e92c);logger[_0x9448('0xe')]('GetVoiceExtension',_0x18e92c,JSON[_0x9448('0x1d')](_0x442a15));_0x1cef11(_0x442a15);})[_0x9448('0x14')](function(_0x224b3c){logger[_0x9448('0x10')](_0x9448('0x15'),_0x224b3c[_0x9448('0x12')],_0x18e92c);_0x4fd323(_0x5c64b8['error'](0x1f4,_0x224b3c[_0x9448('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index db53b4e..53a0e67 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x22afc0,_0x231412){var _0x4fff38=function(_0x4b4406){while(--_0x4b4406){_0x22afc0['push'](_0x22afc0['shift']());}};_0x4fff38(++_0x231412);}(_0x326f,0xd1));var _0xf326=function(_0x1a6a8e,_0x272f31){_0x1a6a8e=_0x1a6a8e-0x0;var _0x2aa1d6=_0x326f[_0x1a6a8e];return _0x2aa1d6;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x508a35,_0x245a00){_0x508a35=_0x508a35-0x0;var _0xee577e=_0x1cb9[_0x508a35];return _0xee577e;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index bdb68fa..37f5282 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 _0x1a37=['../../config/environment','get','index','/:id','isAuthenticated','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x113915,_0x1f4ad1){var _0x54b052=function(_0x287e28){while(--_0x287e28){_0x113915['push'](_0x113915['shift']());}};_0x54b052(++_0x1f4ad1);}(_0x1a37,0xb4));var _0x71a3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1a37[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./voiceMail.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xf')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0x11')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0x13')]);module[_0x71a3('0x14')]=router; \ No newline at end of file +var _0x4c60=['exports','multer','util','path','connect-timeout','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','put','update','destroy'];(function(_0x5ac855,_0x3c6246){var _0x4c99c4=function(_0x1bfb3e){while(--_0x1bfb3e){_0x5ac855['push'](_0x5ac855['shift']());}};_0x4c99c4(++_0x3c6246);}(_0x4c60,0xc1));var _0x04c6=function(_0x5b93c0,_0x404611){_0x5b93c0=_0x5b93c0-0x0;var _0x831c30=_0x4c60[_0x5b93c0];return _0x831c30;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['show']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04c6('0xc')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['delete'](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);module[_0x04c6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 05c82f9..a6eed25 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 _0xd106=['from-voicemail','contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xd106,0x14d));var _0x6d10=function(_0x3a653c,_0x23ab3f){_0x3a653c=_0x3a653c-0x0;var _0x175cd5=_0xd106[_0x3a653c];return _0x175cd5;};'use strict';var Sequelize=require(_0x6d10('0x0'));module[_0x6d10('0x1')]={'customer_id':{'type':Sequelize[_0x6d10('0x2')]},'context':{'type':Sequelize[_0x6d10('0x2')],'defaultValue':_0x6d10('0x3'),'unique':_0x6d10('0x4')},'mailbox':{'type':Sequelize[_0x6d10('0x2')],'defaultValue':'','allowNull':![],'unique':_0x6d10('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x59b174){this[_0x6d10('0x5')]('email',typeof _0x59b174===_0x6d10('0x6')&&_0x59b174[_0x6d10('0x7')]()?_0x59b174[_0x6d10('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x6d10('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':_0x6d10('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':_0x6d10('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x6d10('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x6d10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x6d10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6d10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6d10('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6d10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':_0x6d10('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6d10('0x8')](_0x6d10('0x9'),'no'),'defaultValue':_0x6d10('0x9'),'allowNull':![]},'stamp':{'type':_0x6d10('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x6d10('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6d10('0xd')](_0x6d10('0xe'))+_0x6d10('0xf')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0xc54f=['setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x366e51,_0x3a0178){var _0x4e23e3=function(_0x7ecebe){while(--_0x7ecebe){_0x366e51['push'](_0x366e51['shift']());}};_0x4e23e3(++_0x3a0178);}(_0xc54f,0x72));var _0xfc54=function(_0x47e744,_0x3a9240){_0x47e744=_0x47e744-0x0;var _0x5e793f=_0xc54f[_0x47e744];return _0x5e793f;};'use strict';var Sequelize=require(_0xfc54('0x0'));module[_0xfc54('0x1')]={'customer_id':{'type':Sequelize[_0xfc54('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xfc54('0x3'),'unique':_0xfc54('0x4')},'mailbox':{'type':Sequelize[_0xfc54('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfc54('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x1aa009){this[_0xfc54('0x5')]('email',typeof _0x1aa009===_0xfc54('0x6')&&_0x1aa009['trim']()?_0x1aa009[_0xfc54('0x7')]():null);}},'pager':{'type':Sequelize[_0xfc54('0x2')]},'tz':{'type':Sequelize[_0xfc54('0x2')],'defaultValue':_0xfc54('0x8')},'attach':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':_0xfc54('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfc54('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xfc54('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfc54('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xfc54('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfc54('0x9')](_0xfc54('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfc54('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xfc54('0x2')]},'maxsecs':{'type':Sequelize[_0xfc54('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfc54('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfc54('0xd')],'get':function(){return this[_0xfc54('0xe')](_0xfc54('0xf'))+_0xfc54('0x10')+this[_0xfc54('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 6fc6abb..6fa0873 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 _0xf45e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','send','map','VoiceMail','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir'];(function(_0xedaa3,_0x4517f5){var _0x3c8965=function(_0xfb6644){while(--_0xfb6644){_0xedaa3['push'](_0xedaa3['shift']());}};_0x3c8965(++_0x4517f5);}(_0xf45e,0x115));var _0xef45=function(_0x4e38b1,_0x1716d9){_0x4e38b1=_0x4e38b1-0x0;var _0x161054=_0xf45e[_0x4e38b1];return _0x161054;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){var _0x315777=_0x7817d0['get']({'plain':!![]});var _0x208b35='Voicemails';return db[_0xef45('0x2a')][_0xef45('0x28')]({'where':{'type':_0x208b35,'resourceId':_0x315777['id']}})['then'](function(){return _0x7817d0;});})[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1096af,_0x4f8c9b){return function(_0x550e18){if(!_0x550e18){_0x1096af['sendStatus'](0x194);}return _0x550e18;};}function handleError(_0x53690e,_0x1f636f){_0x1f636f=_0x1f636f||0x1f4;return function(_0x2f72ef){logger[_0xef45('0x2b')](_0x2f72ef[_0xef45('0x2c')]);if(_0x2f72ef['name']){delete _0x2f72ef[_0xef45('0x2d')];}_0x53690e['status'](_0x1f636f)[_0xef45('0x2e')](_0x2f72ef);};}exports['index']=function(_0x3e6922,_0x5bfd2d){var _0x575734={},_0x14ce5a={},_0x3e45de={'count':0x0,'rows':[]};var _0x390a7a=_[_0xef45('0x2f')](db[_0xef45('0x30')]['rawAttributes'],function(_0x5551ce){return{'name':_0x5551ce['fieldName'],'type':_0x5551ce[_0xef45('0x31')][_0xef45('0x32')]};});_0x14ce5a[_0xef45('0x33')]=_[_0xef45('0x2f')](_0x390a7a,_0xef45('0x2d'));_0x14ce5a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x3e6922['query']);_0x14ce5a['filters']=_[_0xef45('0x36')](_0x14ce5a['model'],_0x14ce5a[_0xef45('0x34')]);_0x575734['attributes']=_[_0xef45('0x36')](_0x14ce5a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x3e6922[_0xef45('0x34')][_0xef45('0x37')]));_0x575734['attributes']=_0x575734[_0xef45('0x38')][_0xef45('0x39')]?_0x575734[_0xef45('0x38')]:_0x14ce5a['model'];if(!_0x3e6922['query'][_0xef45('0x3a')](_0xef45('0x3b'))){_0x575734['limit']=qs[_0xef45('0x20')](_0x3e6922['query']['limit']);_0x575734[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x3e6922[_0xef45('0x34')]['offset']);}_0x575734[_0xef45('0x3c')]=qs[_0xef45('0x3d')](_0x3e6922[_0xef45('0x34')][_0xef45('0x3d')]);_0x575734['where']=qs['filters'](_[_0xef45('0x3e')](_0x3e6922[_0xef45('0x34')],_0x14ce5a[_0xef45('0x3f')]),_0x390a7a);if(_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]){_0x575734[_0xef45('0x41')]=_[_0xef45('0x42')](_0x575734[_0xef45('0x41')],{'$or':_['map'](_0x390a7a,function(_0x4f5877){if(_0x4f5877[_0xef45('0x31')]!==_0xef45('0x43')){var _0x154e72={};_0x154e72[_0x4f5877[_0xef45('0x2d')]]={'$like':'%'+_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]+'%'};return _0x154e72;}})});}_0x575734=_[_0xef45('0x42')]({},_0x575734,_0x3e6922[_0xef45('0x44')]);var _0x3a5082={'where':_0x575734[_0xef45('0x41')]};return db[_0xef45('0x30')][_0xef45('0x21')](_0x3a5082)[_0xef45('0x29')](function(_0xd7d217){_0x3e45de[_0xef45('0x21')]=_0xd7d217;if(_0x3e6922[_0xef45('0x34')]['includeAll']){_0x575734[_0xef45('0x45')]=[{'all':!![]}];}return db[_0xef45('0x30')][_0xef45('0x46')](_0x575734);})[_0xef45('0x29')](function(_0x54ccb8){_0x3e45de[_0xef45('0x47')]=_0x54ccb8;return _0x3e45de;})['then'](respondWithFilteredResult(_0x5bfd2d,_0x575734))[_0xef45('0x48')](handleError(_0x5bfd2d,null));};exports['show']=function(_0x5faf67,_0x2d086f){var _0x2236d9={'raw':!![],'where':{'id':_0x5faf67[_0xef45('0x49')]['id']}},_0x36e81a={};_0x36e81a[_0xef45('0x33')]=_[_0xef45('0x35')](db['VoiceMail'][_0xef45('0x4a')]);_0x36e81a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5faf67[_0xef45('0x34')]);_0x36e81a[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],_0x36e81a[_0xef45('0x34')]);_0x2236d9[_0xef45('0x38')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x5faf67[_0xef45('0x34')][_0xef45('0x37')]));_0x2236d9[_0xef45('0x38')]=_0x2236d9['attributes'][_0xef45('0x39')]?_0x2236d9[_0xef45('0x38')]:_0x36e81a[_0xef45('0x33')];if(_0x5faf67['query']['includeAll']){_0x2236d9['include']=[{'all':!![]}];}_0x2236d9=_[_0xef45('0x42')]({},_0x2236d9,_0x5faf67[_0xef45('0x44')]);return db[_0xef45('0x30')][_0xef45('0x4b')](_0x2236d9)[_0xef45('0x29')](handleEntityNotFound(_0x2d086f,null))[_0xef45('0x29')](respondWithResult(_0x2d086f,null))['catch'](handleError(_0x2d086f,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){return db['VoiceMail']['create'](_0x463796[_0xef45('0x4d')],{})[_0xef45('0x29')](function(_0x4feeb1){var _0x1a56ae=_0x463796[_0xef45('0x4e')][_0xef45('0x4f')]({'plain':!![]});if(!_0x1a56ae)throw new Error(_0xef45('0x50'));if(_0x1a56ae[_0xef45('0x51')]===_0xef45('0x4e')){var _0x23581f=_0x4feeb1[_0xef45('0x4f')]({'plain':!![]});var _0x1961b4=_0xef45('0x52');return db[_0xef45('0x53')][_0xef45('0x4b')]({'where':{'name':_0x1961b4,'userProfileId':_0x1a56ae[_0xef45('0x54')]},'raw':!![]})[_0xef45('0x29')](function(_0x48a391){if(_0x48a391&&_0x48a391[_0xef45('0x55')]===0x0){return db[_0xef45('0x2a')][_0xef45('0x4c')]({'name':_0x23581f['name'],'resourceId':_0x23581f['id'],'type':_0x48a391[_0xef45('0x2d')],'sectionId':_0x48a391['id']},{})[_0xef45('0x29')](function(){return _0x4feeb1;});}else{return _0x4feeb1;}})[_0xef45('0x48')](function(_0x1531ea){logger['error'](_0xef45('0x56'),_0x1531ea);throw _0x1531ea;});}return _0x4feeb1;})[_0xef45('0x29')](respondWithResult(_0x2b2419,0xc9))[_0xef45('0x48')](handleError(_0x2b2419,null));};exports[_0xef45('0x57')]=function(_0x67d57b,_0x41f575){if(_0x67d57b[_0xef45('0x4d')]['id']){delete _0x67d57b[_0xef45('0x4d')]['id'];}return db[_0xef45('0x30')][_0xef45('0x4b')]({'where':{'id':_0x67d57b[_0xef45('0x49')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x41f575,null))['then'](saveUpdates(_0x67d57b[_0xef45('0x4d')],null))[_0xef45('0x29')](respondWithResult(_0x41f575,null))[_0xef45('0x48')](handleError(_0x41f575,null));};exports[_0xef45('0x28')]=function(_0x2fe9cf,_0x32232f){return db['VoiceMail']['find']({'where':{'id':_0x2fe9cf[_0xef45('0x49')]['id']}})['then'](handleEntityNotFound(_0x32232f,null))[_0xef45('0x29')](removeEntity(_0x32232f,null))[_0xef45('0x48')](handleError(_0x32232f,null));};exports[_0xef45('0x58')]=function(_0x5676fb,_0x16b04e,_0x398dc0){return db['VoiceMail'][_0xef45('0x59')]({'where':{'id':_0x5676fb['params']['id']}})['then'](handleEntityNotFound(_0x16b04e,null))[_0xef45('0x29')](function(_0x4f78ac){var _0x189f22;var _0x3fbc26={},_0x22fd64={};_0x22fd64['model']=_[_0xef45('0x35')](db[_0xef45('0x5a')]['rawAttributes']);_0x22fd64[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5676fb[_0xef45('0x34')]);_0x22fd64[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x22fd64[_0xef45('0x33')],_0x22fd64[_0xef45('0x34')]);_0x3fbc26[_0xef45('0x38')]=_['intersection'](_0x22fd64[_0xef45('0x33')],qs['fields'](_0x5676fb['query'][_0xef45('0x37')]));_0x3fbc26['attributes']=_0x3fbc26[_0xef45('0x38')][_0xef45('0x39')]?_0x3fbc26['attributes']:_0x22fd64[_0xef45('0x33')];if(!_0x5676fb[_0xef45('0x34')][_0xef45('0x3a')](_0xef45('0x3b'))){_0x3fbc26[_0xef45('0x20')]=qs[_0xef45('0x20')](_0x5676fb['query'][_0xef45('0x20')]);_0x3fbc26[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x5676fb[_0xef45('0x34')][_0xef45('0x1e')]);}_0x3fbc26['order']=qs[_0xef45('0x3d')](_0x5676fb['query'][_0xef45('0x3d')]);_0x3fbc26[_0xef45('0x41')]=qs['filters'](_[_0xef45('0x3e')](_0x5676fb[_0xef45('0x34')],_0x22fd64[_0xef45('0x3f')]));if(_0x5676fb['query']['filter']){_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'$or':_['map'](_0x3fbc26[_0xef45('0x38')],function(_0x3956b0){var _0x49131e={};_0x49131e[_0x3956b0]={'$like':'%'+_0x5676fb[_0xef45('0x34')]['filter']+'%'};return _0x49131e;})});}_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'mailboxuser':_0x4f78ac[_0xef45('0x5b')]});_0x3fbc26=_[_0xef45('0x42')]({},_0x3fbc26,_0x5676fb[_0xef45('0x44')]);return db[_0xef45('0x5a')][_0xef45('0x5c')](_0x3fbc26)['then'](respondWithFilteredResult(_0x16b04e,_0x3fbc26));})[_0xef45('0x48')](handleError(_0x16b04e,null));}; \ No newline at end of file +var _0xde2c=['query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','find','findOne','VoiceMailMessage','mailbox','findAndCountAll','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','destroy','get','Voicemails','UserProfileResource','then','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key'];(function(_0xd2811e,_0x168a67){var _0x9a2a53=function(_0x14d24b){while(--_0x14d24b){_0xd2811e['push'](_0xd2811e['shift']());}};_0x9a2a53(++_0x168a67);}(_0xde2c,0x7f));var _0xcde2=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xde2c[_0x1d9aa0];return _0x226868;};'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(){var _0x593aa4=_0xb2123c[_0xcde2('0x26')]({'plain':!![]});var _0x207a12=_0xcde2('0x27');return db[_0xcde2('0x28')][_0xcde2('0x25')]({'where':{'type':_0x207a12,'resourceId':_0x593aa4['id']}})['then'](function(){return _0xb2123c;});})[_0xcde2('0x29')](function(){_0x52368b[_0xcde2('0x1c')](0xcc)[_0xcde2('0x1b')]();});}};}function handleEntityNotFound(_0x513965,_0x2487eb){return function(_0x348ca1){if(!_0x348ca1){_0x513965[_0xcde2('0x1a')](0x194);}return _0x348ca1;};}function handleError(_0x40309d,_0xd7019){_0xd7019=_0xd7019||0x1f4;return function(_0x5b2b7){logger[_0xcde2('0x2a')](_0x5b2b7[_0xcde2('0x2b')]);if(_0x5b2b7['name']){delete _0x5b2b7[_0xcde2('0x2c')];}_0x40309d['status'](_0xd7019)[_0xcde2('0x2d')](_0x5b2b7);};}exports[_0xcde2('0x2e')]=function(_0x43706c,_0x49cb58){var _0xae46dc={},_0x28fedd={},_0x58afb1={'count':0x0,'rows':[]};var _0x26ec42=_[_0xcde2('0x2f')](db[_0xcde2('0x30')][_0xcde2('0x31')],function(_0x14f784){return{'name':_0x14f784[_0xcde2('0x32')],'type':_0x14f784[_0xcde2('0x33')][_0xcde2('0x34')]};});_0x28fedd['model']=_[_0xcde2('0x2f')](_0x26ec42,_0xcde2('0x2c'));_0x28fedd[_0xcde2('0x35')]=_[_0xcde2('0x36')](_0x43706c['query']);_0x28fedd[_0xcde2('0x37')]=_[_0xcde2('0x38')](_0x28fedd[_0xcde2('0x39')],_0x28fedd[_0xcde2('0x35')]);_0xae46dc['attributes']=_[_0xcde2('0x38')](_0x28fedd[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x43706c[_0xcde2('0x35')]['fields']));_0xae46dc[_0xcde2('0x3b')]=_0xae46dc[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0xae46dc[_0xcde2('0x3b')]:_0x28fedd[_0xcde2('0x39')];if(!_0x43706c['query'][_0xcde2('0x3d')](_0xcde2('0x3e'))){_0xae46dc[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x43706c['query']['limit']);_0xae46dc[_0xcde2('0x20')]=qs[_0xcde2('0x20')](_0x43706c[_0xcde2('0x35')][_0xcde2('0x20')]);}_0xae46dc[_0xcde2('0x3f')]=qs[_0xcde2('0x40')](_0x43706c[_0xcde2('0x35')][_0xcde2('0x40')]);_0xae46dc[_0xcde2('0x41')]=qs['filters'](_[_0xcde2('0x42')](_0x43706c[_0xcde2('0x35')],_0x28fedd[_0xcde2('0x37')]),_0x26ec42);if(_0x43706c[_0xcde2('0x35')][_0xcde2('0x43')]){_0xae46dc['where']=_['merge'](_0xae46dc[_0xcde2('0x41')],{'$or':_[_0xcde2('0x2f')](_0x26ec42,function(_0x20dfad){if(_0x20dfad[_0xcde2('0x33')]!==_0xcde2('0x44')){var _0x1939a0={};_0x1939a0[_0x20dfad['name']]={'$like':'%'+_0x43706c['query']['filter']+'%'};return _0x1939a0;}})});}_0xae46dc=_[_0xcde2('0x45')]({},_0xae46dc,_0x43706c[_0xcde2('0x46')]);var _0x1cfe20={'where':_0xae46dc[_0xcde2('0x41')]};return db[_0xcde2('0x30')][_0xcde2('0x47')](_0x1cfe20)[_0xcde2('0x29')](function(_0x49b862){_0x58afb1['count']=_0x49b862;if(_0x43706c[_0xcde2('0x35')]['includeAll']){_0xae46dc[_0xcde2('0x48')]=[{'all':!![]}];}return db['VoiceMail'][_0xcde2('0x49')](_0xae46dc);})[_0xcde2('0x29')](function(_0x2cf372){_0x58afb1['rows']=_0x2cf372;return _0x58afb1;})[_0xcde2('0x29')](respondWithFilteredResult(_0x49cb58,_0xae46dc))['catch'](handleError(_0x49cb58,null));};exports[_0xcde2('0x4a')]=function(_0x24a46a,_0x1e661f){var _0x79e073={'raw':!![],'where':{'id':_0x24a46a[_0xcde2('0x4b')]['id']}},_0xcafd7={};_0xcafd7['model']=_['keys'](db[_0xcde2('0x30')]['rawAttributes']);_0xcafd7['query']=_[_0xcde2('0x36')](_0x24a46a['query']);_0xcafd7[_0xcde2('0x37')]=_[_0xcde2('0x38')](_0xcafd7['model'],_0xcafd7[_0xcde2('0x35')]);_0x79e073['attributes']=_['intersection'](_0xcafd7[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x24a46a['query'][_0xcde2('0x3a')]));_0x79e073['attributes']=_0x79e073[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0x79e073[_0xcde2('0x3b')]:_0xcafd7[_0xcde2('0x39')];if(_0x24a46a[_0xcde2('0x35')]['includeAll']){_0x79e073[_0xcde2('0x48')]=[{'all':!![]}];}_0x79e073=_[_0xcde2('0x45')]({},_0x79e073,_0x24a46a[_0xcde2('0x46')]);return db[_0xcde2('0x30')]['find'](_0x79e073)['then'](handleEntityNotFound(_0x1e661f,null))[_0xcde2('0x29')](respondWithResult(_0x1e661f,null))['catch'](handleError(_0x1e661f,null));};exports[_0xcde2('0x4c')]=function(_0x3e9e79,_0x381bd4){return db[_0xcde2('0x30')][_0xcde2('0x4c')](_0x3e9e79[_0xcde2('0x4d')],{})['then'](function(_0x1ce5fe){var _0x5b996d=_0x3e9e79[_0xcde2('0x4e')]['get']({'plain':!![]});if(!_0x5b996d)throw new Error(_0xcde2('0x4f'));if(_0x5b996d[_0xcde2('0x50')]===_0xcde2('0x4e')){var _0x16cddb=_0x1ce5fe[_0xcde2('0x26')]({'plain':!![]});var _0x5071ce='Voicemails';return db[_0xcde2('0x51')]['find']({'where':{'name':_0x5071ce,'userProfileId':_0x5b996d[_0xcde2('0x52')]},'raw':!![]})[_0xcde2('0x29')](function(_0x3d2ce7){if(_0x3d2ce7&&_0x3d2ce7[_0xcde2('0x53')]===0x0){return db[_0xcde2('0x28')][_0xcde2('0x4c')]({'name':_0x16cddb[_0xcde2('0x2c')],'resourceId':_0x16cddb['id'],'type':_0x3d2ce7[_0xcde2('0x2c')],'sectionId':_0x3d2ce7['id']},{})[_0xcde2('0x29')](function(){return _0x1ce5fe;});}else{return _0x1ce5fe;}})[_0xcde2('0x54')](function(_0x3c5a17){logger[_0xcde2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c5a17);throw _0x3c5a17;});}return _0x1ce5fe;})['then'](respondWithResult(_0x381bd4,0xc9))['catch'](handleError(_0x381bd4,null));};exports[_0xcde2('0x24')]=function(_0x59a64d,_0x1751dd){if(_0x59a64d[_0xcde2('0x4d')]['id']){delete _0x59a64d[_0xcde2('0x4d')]['id'];}return db['VoiceMail'][_0xcde2('0x55')]({'where':{'id':_0x59a64d['params']['id']}})[_0xcde2('0x29')](handleEntityNotFound(_0x1751dd,null))['then'](saveUpdates(_0x59a64d[_0xcde2('0x4d')],null))[_0xcde2('0x29')](respondWithResult(_0x1751dd,null))['catch'](handleError(_0x1751dd,null));};exports[_0xcde2('0x25')]=function(_0x4dfabb,_0x5e6fd3){return db[_0xcde2('0x30')][_0xcde2('0x55')]({'where':{'id':_0x4dfabb[_0xcde2('0x4b')]['id']}})[_0xcde2('0x29')](handleEntityNotFound(_0x5e6fd3,null))[_0xcde2('0x29')](removeEntity(_0x5e6fd3,null))[_0xcde2('0x54')](handleError(_0x5e6fd3,null));};exports['getMessages']=function(_0x47329f,_0x44b3fb,_0x21b4e6){return db[_0xcde2('0x30')][_0xcde2('0x56')]({'where':{'id':_0x47329f[_0xcde2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x44b3fb,null))['then'](function(_0x30dee3){var _0x35c6e5;var _0x6a9fa4={},_0x109472={};_0x109472['model']=_[_0xcde2('0x36')](db[_0xcde2('0x57')][_0xcde2('0x31')]);_0x109472[_0xcde2('0x35')]=_[_0xcde2('0x36')](_0x47329f[_0xcde2('0x35')]);_0x109472['filters']=_[_0xcde2('0x38')](_0x109472[_0xcde2('0x39')],_0x109472['query']);_0x6a9fa4[_0xcde2('0x3b')]=_[_0xcde2('0x38')](_0x109472[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x47329f[_0xcde2('0x35')][_0xcde2('0x3a')]));_0x6a9fa4[_0xcde2('0x3b')]=_0x6a9fa4[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0x6a9fa4[_0xcde2('0x3b')]:_0x109472['model'];if(!_0x47329f[_0xcde2('0x35')][_0xcde2('0x3d')]('nolimit')){_0x6a9fa4[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x47329f[_0xcde2('0x35')]['limit']);_0x6a9fa4[_0xcde2('0x20')]=qs[_0xcde2('0x20')](_0x47329f[_0xcde2('0x35')][_0xcde2('0x20')]);}_0x6a9fa4[_0xcde2('0x3f')]=qs[_0xcde2('0x40')](_0x47329f[_0xcde2('0x35')][_0xcde2('0x40')]);_0x6a9fa4[_0xcde2('0x41')]=qs[_0xcde2('0x37')](_[_0xcde2('0x42')](_0x47329f['query'],_0x109472['filters']));if(_0x47329f[_0xcde2('0x35')][_0xcde2('0x43')]){_0x6a9fa4[_0xcde2('0x41')]=_['merge'](_0x6a9fa4['where'],{'$or':_['map'](_0x6a9fa4[_0xcde2('0x3b')],function(_0x367bad){var _0x161a8b={};_0x161a8b[_0x367bad]={'$like':'%'+_0x47329f[_0xcde2('0x35')][_0xcde2('0x43')]+'%'};return _0x161a8b;})});}_0x6a9fa4[_0xcde2('0x41')]=_['merge'](_0x6a9fa4['where'],{'mailboxuser':_0x30dee3[_0xcde2('0x58')]});_0x6a9fa4=_[_0xcde2('0x45')]({},_0x6a9fa4,_0x47329f[_0xcde2('0x46')]);return db[_0xcde2('0x57')][_0xcde2('0x59')](_0x6a9fa4)[_0xcde2('0x29')](respondWithFilteredResult(_0x44b3fb,_0x6a9fa4));})[_0xcde2('0x54')](handleError(_0x44b3fb,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4c45ace..774aaca 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 _0xfe35=['path','rimraf','../../config/environment','./voiceMail.attributes','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfe35,0xf1));var _0x5fe3=function(_0xf20da4,_0x4bf74f){_0xf20da4=_0xf20da4-0x0;var _0x58dc92=_0xfe35[_0xf20da4];return _0x58dc92;};'use strict';var _=require(_0x5fe3('0x0'));var util=require(_0x5fe3('0x1'));var logger=require(_0x5fe3('0x2'))(_0x5fe3('0x3'));var moment=require(_0x5fe3('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fe3('0x5'));var fs=require('fs');var path=require(_0x5fe3('0x6'));var rimraf=require(_0x5fe3('0x7'));var config=require(_0x5fe3('0x8'));var attributes=require(_0x5fe3('0x9'));module['exports']=function(_0xbea366,_0x53e54b){return _0xbea366['define']('VoiceMail',attributes,{'tableName':_0x5fe3('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x5fe3('0xb'),_0x5fe3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2297=['VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','define'];(function(_0x2fc191,_0x1e0358){var _0x3a323e=function(_0x4492d3){while(--_0x4492d3){_0x2fc191['push'](_0x2fc191['shift']());}};_0x3a323e(++_0x1e0358);}(_0x2297,0x82));var _0x7229=function(_0x3346dc,_0x513346){_0x3346dc=_0x3346dc-0x0;var _0x4424f2=_0x2297[_0x3346dc];return _0x4424f2;};'use strict';var _=require(_0x7229('0x0'));var util=require('util');var logger=require(_0x7229('0x1'))(_0x7229('0x2'));var moment=require('moment');var BPromise=require(_0x7229('0x3'));var rp=require(_0x7229('0x4'));var fs=require('fs');var path=require(_0x7229('0x5'));var rimraf=require(_0x7229('0x6'));var config=require(_0x7229('0x7'));var attributes=require(_0x7229('0x8'));module['exports']=function(_0x260d15,_0x1a1547){return _0x260d15[_0x7229('0x9')](_0x7229('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x7229('0xb'),'fields':[_0x7229('0xc'),_0x7229('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5bff014..fde4f0d 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 _0xaaa5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x5b0fde,_0x1185e1){var _0x5f5132=function(_0xb432bb){while(--_0xb432bb){_0x5b0fde['push'](_0x5b0fde['shift']());}};_0x5f5132(++_0x1185e1);}(_0xaaa5,0x16e));var _0x5aaa=function(_0x56e4d9,_0x2bf800){_0x56e4d9=_0x56e4d9-0x0;var _0x5b7c98=_0xaaa5[_0x56e4d9];return _0x5b7c98;};'use strict';var _=require(_0x5aaa('0x0'));var util=require('util');var moment=require(_0x5aaa('0x1'));var BPromise=require(_0x5aaa('0x2'));var rs=require(_0x5aaa('0x3'));var fs=require('fs');var Redis=require(_0x5aaa('0x4'));var db=require(_0x5aaa('0x5'))['db'];var utils=require(_0x5aaa('0x6'));var logger=require(_0x5aaa('0x7'))('rpc');var config=require(_0x5aaa('0x8'));var jayson=require(_0x5aaa('0x9'));var client=jayson[_0x5aaa('0xa')][_0x5aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb3364a,_0x5c6b2d,_0x5d6ab9){return new BPromise(function(_0x193b7e,_0x3d66ef){return client[_0x5aaa('0xc')](_0xb3364a,_0x5d6ab9)['then'](function(_0xa2ff6b){logger['info'](_0x5aaa('0xd'),_0x5c6b2d,_0x5aaa('0xe'));logger[_0x5aaa('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5c6b2d,_0x5aaa('0xe'),JSON[_0x5aaa('0x10')](_0xa2ff6b));if(_0xa2ff6b['error']){if(_0xa2ff6b[_0x5aaa('0x11')][_0x5aaa('0x12')]===0x1f4){logger[_0x5aaa('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5c6b2d,_0xa2ff6b[_0x5aaa('0x11')][_0x5aaa('0x13')]);return _0x3d66ef(_0xa2ff6b[_0x5aaa('0x11')][_0x5aaa('0x13')]);}logger['error'](_0x5aaa('0xd'),_0x5c6b2d,_0xa2ff6b[_0x5aaa('0x11')][_0x5aaa('0x13')]);return _0x193b7e(_0xa2ff6b[_0x5aaa('0x11')]['message']);}else{logger[_0x5aaa('0x14')](_0x5aaa('0xd'),_0x5c6b2d,_0x5aaa('0xe'));_0x193b7e(_0xa2ff6b[_0x5aaa('0x15')][_0x5aaa('0x13')]);}})[_0x5aaa('0x16')](function(_0x1d5827){logger[_0x5aaa('0x11')](_0x5aaa('0xd'),_0x5c6b2d,_0x1d5827);_0x3d66ef(_0x1d5827);});});} \ No newline at end of file +var _0x1fe6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4dfbd1,_0x399344){var _0x31d1e1=function(_0xa688d5){while(--_0xa688d5){_0x4dfbd1['push'](_0x4dfbd1['shift']());}};_0x31d1e1(++_0x399344);}(_0x1fe6,0x120));var _0x61fe=function(_0x16b7e7,_0x22ec85){_0x16b7e7=_0x16b7e7-0x0;var _0x4157c4=_0x1fe6[_0x16b7e7];return _0x4157c4;};'use strict';var _=require(_0x61fe('0x0'));var util=require(_0x61fe('0x1'));var moment=require(_0x61fe('0x2'));var BPromise=require(_0x61fe('0x3'));var rs=require(_0x61fe('0x4'));var fs=require('fs');var Redis=require(_0x61fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61fe('0x6'));var logger=require(_0x61fe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x61fe('0x8'));var client=jayson[_0x61fe('0x9')][_0x61fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29a52c,_0x455798,_0x90386c){return new BPromise(function(_0xef944a,_0x36b04e){return client[_0x61fe('0xb')](_0x29a52c,_0x90386c)[_0x61fe('0xc')](function(_0x4f3cf1){logger[_0x61fe('0xd')](_0x61fe('0xe'),_0x455798,_0x61fe('0xf'));logger[_0x61fe('0x10')](_0x61fe('0x11'),_0x455798,_0x61fe('0xf'),JSON[_0x61fe('0x12')](_0x4f3cf1));if(_0x4f3cf1[_0x61fe('0x13')]){if(_0x4f3cf1[_0x61fe('0x13')][_0x61fe('0x14')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x455798,_0x4f3cf1[_0x61fe('0x13')][_0x61fe('0x15')]);return _0x36b04e(_0x4f3cf1['error'][_0x61fe('0x15')]);}logger[_0x61fe('0x13')](_0x61fe('0xe'),_0x455798,_0x4f3cf1[_0x61fe('0x13')][_0x61fe('0x15')]);return _0xef944a(_0x4f3cf1[_0x61fe('0x13')][_0x61fe('0x15')]);}else{logger[_0x61fe('0xd')](_0x61fe('0xe'),_0x455798,_0x61fe('0xf'));_0xef944a(_0x4f3cf1[_0x61fe('0x16')][_0x61fe('0x15')]);}})[_0x61fe('0x17')](function(_0x3b213b){logger[_0x61fe('0x13')]('VoiceMail,\x20%s,\x20%s',_0x455798,_0x3b213b);_0x36b04e(_0x3b213b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4e2f275..cfb4a09 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 _0x9ef7=['index','get','/:id/download','download','post','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x9ef7,0x8e));var _0x79ef=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9ef7[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x79ef('0x0'));var util=require('util');var path=require(_0x79ef('0x1'));var timeout=require(_0x79ef('0x2'));var express=require('express');var router=express[_0x79ef('0x3')]();var fs_extra=require(_0x79ef('0x4'));var auth=require(_0x79ef('0x5'));var interaction=require(_0x79ef('0x6'));var config=require(_0x79ef('0x7'));var controller=require(_0x79ef('0x8'));router['get']('/',auth[_0x79ef('0x9')](),controller[_0x79ef('0xa')]);router['get']('/:id',auth[_0x79ef('0x9')](),controller['show']);router[_0x79ef('0xb')](_0x79ef('0xc'),auth[_0x79ef('0x9')](),controller[_0x79ef('0xd')]);router[_0x79ef('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x79ef('0xf'),auth[_0x79ef('0x9')](),controller[_0x79ef('0x10')]);router[_0x79ef('0x11')](_0x79ef('0xf'),auth[_0x79ef('0x9')](),controller[_0x79ef('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf8b6=['download','post','put','update','/:id','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download'];(function(_0x4e6fe7,_0x5f07f4){var _0x3f3df7=function(_0x248ac4){while(--_0x248ac4){_0x4e6fe7['push'](_0x4e6fe7['shift']());}};_0x3f3df7(++_0x5f07f4);}(_0xf8b6,0x1e2));var _0x6f8b=function(_0x2cdea2,_0x2e0891){_0x2cdea2=_0x2cdea2-0x0;var _0x10f23b=_0xf8b6[_0x2cdea2];return _0x10f23b;};'use strict';var multer=require('multer');var util=require(_0x6f8b('0x0'));var path=require(_0x6f8b('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f8b('0x2'));var router=express[_0x6f8b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f8b('0x4'));var config=require(_0x6f8b('0x5'));var controller=require(_0x6f8b('0x6'));router[_0x6f8b('0x7')]('/',auth[_0x6f8b('0x8')](),controller[_0x6f8b('0x9')]);router[_0x6f8b('0x7')]('/:id',auth[_0x6f8b('0x8')](),controller[_0x6f8b('0xa')]);router['get'](_0x6f8b('0xb'),auth[_0x6f8b('0x8')](),controller[_0x6f8b('0xc')]);router[_0x6f8b('0xd')]('/',auth[_0x6f8b('0x8')](),controller['create']);router[_0x6f8b('0xe')]('/:id',auth[_0x6f8b('0x8')](),controller[_0x6f8b('0xf')]);router['delete'](_0x6f8b('0x10'),auth[_0x6f8b('0x8')](),controller[_0x6f8b('0x11')]);module[_0x6f8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f330df9..65a7ca4 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 _0xf03d=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x297602,_0x298368){var _0x2e9392=function(_0x72165c){while(--_0x72165c){_0x297602['push'](_0x297602['shift']());}};_0x2e9392(++_0x298368);}(_0xf03d,0x156));var _0xdf03=function(_0x249643,_0x4ea653){_0x249643=_0x249643-0x0;var _0x30cb98=_0xf03d[_0x249643];return _0x30cb98;};'use strict';var Sequelize=require(_0xdf03('0x0'));module[_0xdf03('0x1')]={'name':{'type':Sequelize[_0xdf03('0x2')],'get':function(_0x2df1f0){return this[_0xdf03('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xdf03('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xdf03('0x6')](_0xdf03('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdf03('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xdf03('0x8')](_0xdf03('0x9'))}}; \ No newline at end of file +var _0x9c7b=['getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL'];(function(_0x43b8b0,_0xbd4d40){var _0x51767a=function(_0x3269a7){while(--_0x3269a7){_0x43b8b0['push'](_0x43b8b0['shift']());}};_0x51767a(++_0xbd4d40);}(_0x9c7b,0xdf));var _0xb9c7=function(_0x2ce5e9,_0x18e7da){_0x2ce5e9=_0x2ce5e9-0x0;var _0x2c56df=_0x9c7b[_0x2ce5e9];return _0x2c56df;};'use strict';var Sequelize=require('sequelize');module[_0xb9c7('0x0')]={'name':{'type':Sequelize[_0xb9c7('0x1')],'get':function(_0xbf3536){return this[_0xb9c7('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb9c7('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb9c7('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb9c7('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb9c7('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb9c7('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xb9c7('0x4')](_0xb9c7('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xb9c7('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xb9c7('0x6'),'defaultValue':Sequelize[_0xb9c7('0x7')](_0xb9c7('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7ded9a0..0dd6755 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 _0x916f=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','body','find','params','download','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','sendStatus','error','stack','name','send','map','VoiceMailMessage','rawAttributes','type','key','differenceBy','query','keys'];(function(_0x31687e,_0x42b91a){var _0x10fbb4=function(_0x489546){while(--_0x489546){_0x31687e['push'](_0x31687e['shift']());}};_0x10fbb4(++_0x42b91a);}(_0x916f,0x1ed));var _0xf916=function(_0x5ce6b5,_0x5a80e6){_0x5ce6b5=_0x5ce6b5-0x0;var _0x3f50b2=_0x916f[_0x5ce6b5];return _0x3f50b2;};'use strict';var emlformat=require(_0xf916('0x0'));var rimraf=require(_0xf916('0x1'));var zipdir=require(_0xf916('0x2'));var jsonpatch=require(_0xf916('0x3'));var rp=require('request-promise');var moment=require(_0xf916('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf916('0x5'));var path=require(_0xf916('0x6'));var sox=require('sox');var csv=require(_0xf916('0x7'));var ejs=require(_0xf916('0x8'));var fs=require('fs');var fs_extra=require(_0xf916('0x9'));var _=require(_0xf916('0xa'));var squel=require(_0xf916('0xb'));var crypto=require(_0xf916('0xc'));var jsforce=require(_0xf916('0xd'));var deskjs=require(_0xf916('0xe'));var toCsv=require(_0xf916('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf916('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf916('0x10'));var logger=require(_0xf916('0x11'))(_0xf916('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf916('0x13'));var db=require(_0xf916('0x14'))['db'];function respondWithStatusCode(_0xc956f7,_0x203c7f){_0x203c7f=_0x203c7f||0xcc;return function(_0x8cd7eb){if(_0x8cd7eb){return _0xc956f7['sendStatus'](_0x203c7f);}return _0xc956f7[_0xf916('0x15')](_0x203c7f)[_0xf916('0x16')]();};}function respondWithResult(_0x54233d,_0x1a4c2a){_0x1a4c2a=_0x1a4c2a||0xc8;return function(_0x352559){if(_0x352559){return _0x54233d[_0xf916('0x15')](_0x1a4c2a)[_0xf916('0x17')](_0x352559);}};}function respondWithFilteredResult(_0x4d71ca,_0x5a33bd){return function(_0x5de23d){if(_0x5de23d){var _0x4dd72b=typeof _0x5a33bd[_0xf916('0x18')]===_0xf916('0x19')&&typeof _0x5a33bd[_0xf916('0x1a')]==='undefined';var _0x3a629a=_0x5de23d['count'];var _0x4f609b=_0x4dd72b?0x0:_0x5a33bd[_0xf916('0x18')];var _0x371149=_0x4dd72b?_0x5de23d[_0xf916('0x1b')]:_0x5a33bd[_0xf916('0x18')]+_0x5a33bd[_0xf916('0x1a')];var _0x414267;if(_0x371149>=_0x3a629a){_0x371149=_0x3a629a;_0x414267=0xc8;}else{_0x414267=0xce;}_0x4d71ca['status'](_0x414267);return _0x4d71ca[_0xf916('0x1c')]('Content-Range',_0x4f609b+'-'+_0x371149+'/'+_0x3a629a)[_0xf916('0x17')](_0x5de23d);}return null;};}function patchUpdates(_0x3dc15c){return function(_0x21997){try{jsonpatch[_0xf916('0x1d')](_0x21997,_0x3dc15c,!![]);}catch(_0x2fdf70){return BPromise['reject'](_0x2fdf70);}return _0x21997['save']();};}function saveUpdates(_0x3d5a45,_0x22e4ca){return function(_0x3f03eb){if(_0x3f03eb){return _0x3f03eb[_0xf916('0x1e')](_0x3d5a45)[_0xf916('0x1f')](function(_0xc66381){return _0xc66381;});}return null;};}function removeEntity(_0xd179db,_0x201936){return function(_0x586469){if(_0x586469){return _0x586469[_0xf916('0x20')]()[_0xf916('0x1f')](function(){_0xd179db['status'](0xcc)[_0xf916('0x16')]();});}};}function handleEntityNotFound(_0xf36e77,_0x47a362){return function(_0xab41c1){if(!_0xab41c1){_0xf36e77[_0xf916('0x21')](0x194);}return _0xab41c1;};}function handleError(_0x3b0635,_0x397587){_0x397587=_0x397587||0x1f4;return function(_0x5e2ec2){logger[_0xf916('0x22')](_0x5e2ec2[_0xf916('0x23')]);if(_0x5e2ec2[_0xf916('0x24')]){delete _0x5e2ec2[_0xf916('0x24')];}_0x3b0635[_0xf916('0x15')](_0x397587)[_0xf916('0x25')](_0x5e2ec2);};}exports['index']=function(_0x44f5f1,_0x15c8c8){var _0x834242={},_0x59cdd6={},_0x14e2a0={'count':0x0,'rows':[]};var _0x48712e=_[_0xf916('0x26')](db[_0xf916('0x27')][_0xf916('0x28')],function(_0xdb5542){return{'name':_0xdb5542['fieldName'],'type':_0xdb5542[_0xf916('0x29')][_0xf916('0x2a')]};});_0x59cdd6['model']=_[_0xf916('0x2b')](_['map'](_0x48712e,_0xf916('0x24')),[_0xf916('0x24')]);_0x59cdd6[_0xf916('0x2c')]=_[_0xf916('0x2d')](_0x44f5f1['query']);_0x59cdd6[_0xf916('0x2e')]=_[_0xf916('0x2f')](_0x59cdd6[_0xf916('0x30')],_0x59cdd6['query']);_0x834242[_0xf916('0x31')]=_['intersection'](_0x59cdd6[_0xf916('0x30')],qs[_0xf916('0x32')](_0x44f5f1['query'][_0xf916('0x32')]));_0x834242[_0xf916('0x31')]=_0x834242[_0xf916('0x31')][_0xf916('0x33')]?_0x834242[_0xf916('0x31')]:_0x59cdd6['model'];if(!_0x44f5f1[_0xf916('0x2c')][_0xf916('0x34')](_0xf916('0x35'))){_0x834242['limit']=qs[_0xf916('0x1a')](_0x44f5f1[_0xf916('0x2c')][_0xf916('0x1a')]);_0x834242[_0xf916('0x18')]=qs[_0xf916('0x18')](_0x44f5f1['query']['offset']);}_0x834242[_0xf916('0x36')]=qs['sort'](_0x44f5f1[_0xf916('0x2c')][_0xf916('0x37')]);_0x834242[_0xf916('0x38')]=qs[_0xf916('0x2e')](_[_0xf916('0x39')](_0x44f5f1[_0xf916('0x2c')],_0x59cdd6['filters']),_0x48712e);if(_0x44f5f1[_0xf916('0x2c')][_0xf916('0x3a')]){_0x834242[_0xf916('0x38')]=_[_0xf916('0x3b')](_0x834242[_0xf916('0x38')],{'$or':_['map'](_0x48712e,function(_0x3455ac){if(_0x3455ac[_0xf916('0x29')]!==_0xf916('0x3c')){var _0xbeb312={};_0xbeb312[_0x3455ac[_0xf916('0x24')]]={'$like':'%'+_0x44f5f1['query'][_0xf916('0x3a')]+'%'};return _0xbeb312;}})});}_0x834242=_[_0xf916('0x3b')]({},_0x834242,_0x44f5f1[_0xf916('0x3d')]);var _0x5c073d={'where':_0x834242['where']};return db[_0xf916('0x27')][_0xf916('0x1b')](_0x5c073d)[_0xf916('0x1f')](function(_0x499119){_0x14e2a0[_0xf916('0x1b')]=_0x499119;if(_0x44f5f1[_0xf916('0x2c')][_0xf916('0x3e')]){_0x834242[_0xf916('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x834242);})[_0xf916('0x1f')](function(_0x3462a6){_0x14e2a0[_0xf916('0x40')]=_0x3462a6;return _0x14e2a0;})[_0xf916('0x1f')](respondWithFilteredResult(_0x15c8c8,_0x834242))['catch'](handleError(_0x15c8c8,null));};exports['show']=function(_0xaf2bac,_0x442460){var _0xa5653={'raw':!![],'where':{'id':_0xaf2bac['params']['id']}},_0x28a59c={};_0x28a59c['model']=_[_0xf916('0x2d')](db[_0xf916('0x27')][_0xf916('0x28')]);_0x28a59c[_0xf916('0x2c')]=_['keys'](_0xaf2bac[_0xf916('0x2c')]);_0x28a59c[_0xf916('0x2e')]=_[_0xf916('0x2f')](_0x28a59c['model'],_0x28a59c[_0xf916('0x2c')]);_0xa5653[_0xf916('0x31')]=_[_0xf916('0x2f')](_0x28a59c[_0xf916('0x30')],qs[_0xf916('0x32')](_0xaf2bac[_0xf916('0x2c')][_0xf916('0x32')]));_0xa5653['attributes']=_0xa5653[_0xf916('0x31')][_0xf916('0x33')]?_0xa5653[_0xf916('0x31')]:_0x28a59c[_0xf916('0x30')];if(_0xaf2bac['query']['includeAll']){_0xa5653[_0xf916('0x3f')]=[{'all':!![]}];}_0xa5653=_[_0xf916('0x3b')]({},_0xa5653,_0xaf2bac[_0xf916('0x3d')]);return db[_0xf916('0x27')]['find'](_0xa5653)[_0xf916('0x1f')](handleEntityNotFound(_0x442460,null))[_0xf916('0x1f')](respondWithResult(_0x442460,null))[_0xf916('0x41')](handleError(_0x442460,null));};exports['create']=function(_0xb6351c,_0x516ad4){return db[_0xf916('0x27')]['create'](_0xb6351c[_0xf916('0x42')],{})[_0xf916('0x1f')](respondWithResult(_0x516ad4,0xc9))[_0xf916('0x41')](handleError(_0x516ad4,null));};exports['update']=function(_0x40341c,_0x62db65){if(_0x40341c[_0xf916('0x42')]['id']){delete _0x40341c[_0xf916('0x42')]['id'];}return db['VoiceMailMessage'][_0xf916('0x43')]({'where':{'id':_0x40341c[_0xf916('0x44')]['id']}})[_0xf916('0x1f')](handleEntityNotFound(_0x62db65,null))['then'](saveUpdates(_0x40341c[_0xf916('0x42')],null))['then'](respondWithResult(_0x62db65,null))['catch'](handleError(_0x62db65,null));};exports[_0xf916('0x20')]=function(_0x48313f,_0x4ccc82){return db[_0xf916('0x27')]['find']({'where':{'id':_0x48313f[_0xf916('0x44')]['id']}})[_0xf916('0x1f')](handleEntityNotFound(_0x4ccc82,null))[_0xf916('0x1f')](removeEntity(_0x4ccc82,null))['catch'](handleError(_0x4ccc82,null));};exports[_0xf916('0x45')]=function(_0x3a4211,_0xf0d3a7,_0x3beb11){return db['VoiceMailMessage'][_0xf916('0x43')]({'where':{'id':_0x3a4211[_0xf916('0x44')]['id']},'attributes':['id',_0xf916('0x46'),_0xf916('0x47')]})['then'](handleEntityNotFound(_0xf0d3a7,null))[_0xf916('0x1f')](function(_0x35fba1){if(_0x35fba1){if(!_0x35fba1[_0xf916('0x46')]){throw new db['Sequelize'][(_0xf916('0x48'))]('VoiceMailMessage\x20not\x20found');}var _0x4f6892={'Content-Type':_0xf916('0x49'),'Content-Disposition':_0xf916('0x4a')};if(_0x35fba1[_0xf916('0x47')]){_0x4f6892[_0xf916('0x4b')]='attachment;\x20filename=\x22'+_0x35fba1[_0xf916('0x47')]+_0xf916('0x4c');}_0xf0d3a7['set'](_0x4f6892);return _0xf0d3a7['send'](new Buffer(_0x35fba1[_0xf916('0x46')]));}})[_0xf916('0x41')](handleError(_0xf0d3a7,null));}; \ No newline at end of file +var _0x8d83=['attachment','Content-Disposition','msg_id','.wav\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','create','body','catch','find','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav'];(function(_0x4a2022,_0x21e462){var _0x1c63ff=function(_0x554eda){while(--_0x554eda){_0x4a2022['push'](_0x4a2022['shift']());}};_0x1c63ff(++_0x21e462);}(_0x8d83,0x150));var _0x38d8=function(_0x5f4d75,_0x3793c4){_0x5f4d75=_0x5f4d75-0x0;var _0xe539e6=_0x8d83[_0x5f4d75];return _0xe539e6;};'use strict';var emlformat=require(_0x38d8('0x0'));var rimraf=require(_0x38d8('0x1'));var zipdir=require(_0x38d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38d8('0x3'));var moment=require('moment');var BPromise=require(_0x38d8('0x4'));var Mustache=require(_0x38d8('0x5'));var util=require(_0x38d8('0x6'));var path=require(_0x38d8('0x7'));var sox=require('sox');var csv=require(_0x38d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38d8('0x9'));var _=require(_0x38d8('0xa'));var squel=require(_0x38d8('0xb'));var crypto=require(_0x38d8('0xc'));var jsforce=require(_0x38d8('0xd'));var deskjs=require(_0x38d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x38d8('0xf'));var Papa=require(_0x38d8('0x10'));var Redis=require(_0x38d8('0x11'));var authService=require(_0x38d8('0x12'));var qs=require(_0x38d8('0x13'));var as=require(_0x38d8('0x14'));var hardwareService=require(_0x38d8('0x15'));var logger=require(_0x38d8('0x16'))(_0x38d8('0x17'));var utils=require('../../config/utils');var config=require(_0x38d8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x38d8('0x19'))['db'];function respondWithStatusCode(_0x4979ff,_0x5c7818){_0x5c7818=_0x5c7818||0xcc;return function(_0x57f51d){if(_0x57f51d){return _0x4979ff[_0x38d8('0x1a')](_0x5c7818);}return _0x4979ff[_0x38d8('0x1b')](_0x5c7818)[_0x38d8('0x1c')]();};}function respondWithResult(_0x3c9ec1,_0x434614){_0x434614=_0x434614||0xc8;return function(_0x1927d5){if(_0x1927d5){return _0x3c9ec1[_0x38d8('0x1b')](_0x434614)[_0x38d8('0x1d')](_0x1927d5);}};}function respondWithFilteredResult(_0x1c5055,_0x23452f){return function(_0x20e027){if(_0x20e027){var _0x1e56af=typeof _0x23452f[_0x38d8('0x1e')]===_0x38d8('0x1f')&&typeof _0x23452f[_0x38d8('0x20')]===_0x38d8('0x1f');var _0x10d28f=_0x20e027[_0x38d8('0x21')];var _0x2b797a=_0x1e56af?0x0:_0x23452f[_0x38d8('0x1e')];var _0x16cbfa=_0x1e56af?_0x20e027[_0x38d8('0x21')]:_0x23452f[_0x38d8('0x1e')]+_0x23452f['limit'];var _0x2997a0;if(_0x16cbfa>=_0x10d28f){_0x16cbfa=_0x10d28f;_0x2997a0=0xc8;}else{_0x2997a0=0xce;}_0x1c5055[_0x38d8('0x1b')](_0x2997a0);return _0x1c5055[_0x38d8('0x22')]('Content-Range',_0x2b797a+'-'+_0x16cbfa+'/'+_0x10d28f)['json'](_0x20e027);}return null;};}function patchUpdates(_0x1975bc){return function(_0x3194cf){try{jsonpatch[_0x38d8('0x23')](_0x3194cf,_0x1975bc,!![]);}catch(_0x59dfda){return BPromise[_0x38d8('0x24')](_0x59dfda);}return _0x3194cf['save']();};}function saveUpdates(_0x45a1ef,_0x42d7c0){return function(_0x3ad0d2){if(_0x3ad0d2){return _0x3ad0d2[_0x38d8('0x25')](_0x45a1ef)[_0x38d8('0x26')](function(_0x5b9057){return _0x5b9057;});}return null;};}function removeEntity(_0xe98350,_0x465fe1){return function(_0x27ea2b){if(_0x27ea2b){return _0x27ea2b[_0x38d8('0x27')]()[_0x38d8('0x26')](function(){_0xe98350[_0x38d8('0x1b')](0xcc)[_0x38d8('0x1c')]();});}};}function handleEntityNotFound(_0x4ccc1c,_0x285d73){return function(_0xdc2a1b){if(!_0xdc2a1b){_0x4ccc1c[_0x38d8('0x1a')](0x194);}return _0xdc2a1b;};}function handleError(_0x5dd744,_0x552793){_0x552793=_0x552793||0x1f4;return function(_0x50bedf){logger[_0x38d8('0x28')](_0x50bedf[_0x38d8('0x29')]);if(_0x50bedf[_0x38d8('0x2a')]){delete _0x50bedf['name'];}_0x5dd744['status'](_0x552793)[_0x38d8('0x2b')](_0x50bedf);};}exports['index']=function(_0x131076,_0x363d39){var _0x499549={},_0x43725a={},_0x3d5989={'count':0x0,'rows':[]};var _0x524a60=_[_0x38d8('0x2c')](db[_0x38d8('0x2d')]['rawAttributes'],function(_0x3561c){return{'name':_0x3561c[_0x38d8('0x2e')],'type':_0x3561c[_0x38d8('0x2f')]['key']};});_0x43725a[_0x38d8('0x30')]=_[_0x38d8('0x31')](_[_0x38d8('0x2c')](_0x524a60,_0x38d8('0x2a')),['name']);_0x43725a['query']=_[_0x38d8('0x32')](_0x131076[_0x38d8('0x33')]);_0x43725a[_0x38d8('0x34')]=_[_0x38d8('0x35')](_0x43725a['model'],_0x43725a[_0x38d8('0x33')]);_0x499549[_0x38d8('0x36')]=_[_0x38d8('0x35')](_0x43725a[_0x38d8('0x30')],qs[_0x38d8('0x37')](_0x131076[_0x38d8('0x33')][_0x38d8('0x37')]));_0x499549[_0x38d8('0x36')]=_0x499549[_0x38d8('0x36')][_0x38d8('0x38')]?_0x499549[_0x38d8('0x36')]:_0x43725a[_0x38d8('0x30')];if(!_0x131076[_0x38d8('0x33')][_0x38d8('0x39')](_0x38d8('0x3a'))){_0x499549[_0x38d8('0x20')]=qs['limit'](_0x131076['query'][_0x38d8('0x20')]);_0x499549[_0x38d8('0x1e')]=qs[_0x38d8('0x1e')](_0x131076[_0x38d8('0x33')][_0x38d8('0x1e')]);}_0x499549[_0x38d8('0x3b')]=qs['sort'](_0x131076[_0x38d8('0x33')]['sort']);_0x499549['where']=qs['filters'](_['pick'](_0x131076['query'],_0x43725a[_0x38d8('0x34')]),_0x524a60);if(_0x131076['query'][_0x38d8('0x3c')]){_0x499549[_0x38d8('0x3d')]=_[_0x38d8('0x3e')](_0x499549[_0x38d8('0x3d')],{'$or':_[_0x38d8('0x2c')](_0x524a60,function(_0x178ec9){if(_0x178ec9[_0x38d8('0x2f')]!==_0x38d8('0x3f')){var _0xd68036={};_0xd68036[_0x178ec9[_0x38d8('0x2a')]]={'$like':'%'+_0x131076[_0x38d8('0x33')][_0x38d8('0x3c')]+'%'};return _0xd68036;}})});}_0x499549=_['merge']({},_0x499549,_0x131076[_0x38d8('0x40')]);var _0x538a03={'where':_0x499549[_0x38d8('0x3d')]};return db[_0x38d8('0x2d')][_0x38d8('0x21')](_0x538a03)['then'](function(_0x2dd024){_0x3d5989[_0x38d8('0x21')]=_0x2dd024;if(_0x131076[_0x38d8('0x33')][_0x38d8('0x41')]){_0x499549['include']=[{'all':!![]}];}return db[_0x38d8('0x2d')][_0x38d8('0x42')](_0x499549);})[_0x38d8('0x26')](function(_0x3875bf){_0x3d5989[_0x38d8('0x43')]=_0x3875bf;return _0x3d5989;})[_0x38d8('0x26')](respondWithFilteredResult(_0x363d39,_0x499549))['catch'](handleError(_0x363d39,null));};exports['show']=function(_0x173dbe,_0x14ec86){var _0x290e17={'raw':!![],'where':{'id':_0x173dbe[_0x38d8('0x44')]['id']}},_0x3c717e={};_0x3c717e[_0x38d8('0x30')]=_[_0x38d8('0x32')](db['VoiceMailMessage'][_0x38d8('0x45')]);_0x3c717e[_0x38d8('0x33')]=_[_0x38d8('0x32')](_0x173dbe[_0x38d8('0x33')]);_0x3c717e['filters']=_[_0x38d8('0x35')](_0x3c717e[_0x38d8('0x30')],_0x3c717e['query']);_0x290e17['attributes']=_[_0x38d8('0x35')](_0x3c717e[_0x38d8('0x30')],qs[_0x38d8('0x37')](_0x173dbe[_0x38d8('0x33')][_0x38d8('0x37')]));_0x290e17[_0x38d8('0x36')]=_0x290e17[_0x38d8('0x36')][_0x38d8('0x38')]?_0x290e17[_0x38d8('0x36')]:_0x3c717e[_0x38d8('0x30')];if(_0x173dbe[_0x38d8('0x33')]['includeAll']){_0x290e17[_0x38d8('0x46')]=[{'all':!![]}];}_0x290e17=_['merge']({},_0x290e17,_0x173dbe[_0x38d8('0x40')]);return db[_0x38d8('0x2d')]['find'](_0x290e17)[_0x38d8('0x26')](handleEntityNotFound(_0x14ec86,null))[_0x38d8('0x26')](respondWithResult(_0x14ec86,null))['catch'](handleError(_0x14ec86,null));};exports[_0x38d8('0x47')]=function(_0x251b6a,_0x32a2e1){return db[_0x38d8('0x2d')]['create'](_0x251b6a[_0x38d8('0x48')],{})[_0x38d8('0x26')](respondWithResult(_0x32a2e1,0xc9))['catch'](handleError(_0x32a2e1,null));};exports['update']=function(_0x2cf166,_0x2cdf48){if(_0x2cf166[_0x38d8('0x48')]['id']){delete _0x2cf166[_0x38d8('0x48')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x2cf166[_0x38d8('0x44')]['id']}})[_0x38d8('0x26')](handleEntityNotFound(_0x2cdf48,null))['then'](saveUpdates(_0x2cf166['body'],null))[_0x38d8('0x26')](respondWithResult(_0x2cdf48,null))[_0x38d8('0x49')](handleError(_0x2cdf48,null));};exports['destroy']=function(_0x485ec9,_0x2eb7f4){return db['VoiceMailMessage'][_0x38d8('0x4a')]({'where':{'id':_0x485ec9[_0x38d8('0x44')]['id']}})[_0x38d8('0x26')](handleEntityNotFound(_0x2eb7f4,null))[_0x38d8('0x26')](removeEntity(_0x2eb7f4,null))['catch'](handleError(_0x2eb7f4,null));};exports['download']=function(_0x57c362,_0x22d535,_0x5e019a){return db['VoiceMailMessage']['find']({'where':{'id':_0x57c362['params']['id']},'attributes':['id','recording','msg_id']})['then'](handleEntityNotFound(_0x22d535,null))[_0x38d8('0x26')](function(_0x5d1a36){if(_0x5d1a36){if(!_0x5d1a36[_0x38d8('0x4b')]){throw new db[(_0x38d8('0x4c'))]['ValidationError'](_0x38d8('0x4d'));}var _0x33687d={'Content-Type':_0x38d8('0x4e'),'Content-Disposition':_0x38d8('0x4f')};if(_0x5d1a36['msg_id']){_0x33687d[_0x38d8('0x50')]='attachment;\x20filename=\x22'+_0x5d1a36[_0x38d8('0x51')]+_0x38d8('0x52');}_0x22d535[_0x38d8('0x22')](_0x33687d);return _0x22d535['send'](new Buffer(_0x5d1a36[_0x38d8('0x4b')]));}})[_0x38d8('0x49')](handleError(_0x22d535,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 7be738a..8e0c42d 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 _0x4542=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x4542,0xae));var _0x2454=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4542[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var logger=require(_0x2454('0x2'))(_0x2454('0x3'));var moment=require('moment');var BPromise=require(_0x2454('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2454('0x5'));var rimraf=require(_0x2454('0x6'));var config=require(_0x2454('0x7'));var attributes=require(_0x2454('0x8'));module['exports']=function(_0x321e79,_0xd335eb){return _0x321e79[_0x2454('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x2454('0xa'),'paranoid':![],'indexes':[{'name':_0x2454('0xb'),'fields':[_0x2454('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x57b1=['define','dir','lodash','../../config/logger','moment','request-promise','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x57b1,0x122));var _0x157b=function(_0x2f8a6f,_0x5d968b){_0x2f8a6f=_0x2f8a6f-0x0;var _0x303e6f=_0x57b1[_0x2f8a6f];return _0x303e6f;};'use strict';var _=require(_0x157b('0x0'));var util=require('util');var logger=require(_0x157b('0x1'))('api');var moment=require(_0x157b('0x2'));var BPromise=require('bluebird');var rp=require(_0x157b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x157b('0x4'));var attributes=require(_0x157b('0x5'));module[_0x157b('0x6')]=function(_0x7be178,_0x3718f2){return _0x7be178[_0x157b('0x7')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x157b('0x8'),'fields':[_0x157b('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7428270..ed72385 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 _0x6226=['../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2e920c,_0xab83b){var _0x2a8bf4=function(_0x4c5155){while(--_0x4c5155){_0x2e920c['push'](_0x2e920c['shift']());}};_0x2a8bf4(++_0xab83b);}(_0x6226,0x185));var _0x6622=function(_0x290fc9,_0x3069fe){_0x290fc9=_0x290fc9-0x0;var _0x31c8bd=_0x6226[_0x290fc9];return _0x31c8bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6622('0x0'));var BPromise=require(_0x6622('0x1'));var rs=require(_0x6622('0x2'));var fs=require('fs');var Redis=require(_0x6622('0x3'));var db=require(_0x6622('0x4'))['db'];var utils=require(_0x6622('0x5'));var logger=require('../../config/logger')(_0x6622('0x6'));var config=require(_0x6622('0x7'));var jayson=require(_0x6622('0x8'));var client=jayson[_0x6622('0x9')][_0x6622('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x86d424,_0x44c9e8,_0x300467){return new BPromise(function(_0x156629,_0x538780){return client['request'](_0x86d424,_0x300467)[_0x6622('0xb')](function(_0x12b3eb){logger[_0x6622('0xc')](_0x6622('0xd'),_0x44c9e8,'request\x20sent');logger[_0x6622('0xe')](_0x6622('0xf'),_0x44c9e8,_0x6622('0x10'),JSON[_0x6622('0x11')](_0x12b3eb));if(_0x12b3eb[_0x6622('0x12')]){if(_0x12b3eb['error'][_0x6622('0x13')]===0x1f4){logger[_0x6622('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x44c9e8,_0x12b3eb[_0x6622('0x12')][_0x6622('0x14')]);return _0x538780(_0x12b3eb[_0x6622('0x12')][_0x6622('0x14')]);}logger[_0x6622('0x12')](_0x6622('0xd'),_0x44c9e8,_0x12b3eb['error']['message']);return _0x156629(_0x12b3eb[_0x6622('0x12')][_0x6622('0x14')]);}else{logger['info'](_0x6622('0xd'),_0x44c9e8,'request\x20sent');_0x156629(_0x12b3eb['result'][_0x6622('0x14')]);}})[_0x6622('0x15')](function(_0x463b4a){logger[_0x6622('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x44c9e8,_0x463b4a);_0x538780(_0x463b4a);});});} \ No newline at end of file +var _0x7cc0=['rpc','../../config/environment','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3a2e49,_0x508235){var _0x569a27=function(_0x3aba96){while(--_0x3aba96){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x569a27(++_0x508235);}(_0x7cc0,0x176));var _0x07cc=function(_0x1f404a,_0x5088b2){_0x1f404a=_0x1f404a-0x0;var _0x2cdcd5=_0x7cc0[_0x1f404a];return _0x2cdcd5;};'use strict';var _=require('lodash');var util=require(_0x07cc('0x0'));var moment=require(_0x07cc('0x1'));var BPromise=require(_0x07cc('0x2'));var rs=require(_0x07cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x07cc('0x4'));var logger=require(_0x07cc('0x5'))(_0x07cc('0x6'));var config=require(_0x07cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x07cc('0x8')][_0x07cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x323ff1,_0x5f0f68,_0x5b2488){return new BPromise(function(_0x191755,_0x261881){return client[_0x07cc('0xa')](_0x323ff1,_0x5b2488)['then'](function(_0x498545){logger[_0x07cc('0xb')](_0x07cc('0xc'),_0x5f0f68,_0x07cc('0xd'));logger[_0x07cc('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5f0f68,_0x07cc('0xd'),JSON[_0x07cc('0xf')](_0x498545));if(_0x498545[_0x07cc('0x10')]){if(_0x498545['error'][_0x07cc('0x11')]===0x1f4){logger[_0x07cc('0x10')](_0x07cc('0xc'),_0x5f0f68,_0x498545[_0x07cc('0x10')][_0x07cc('0x12')]);return _0x261881(_0x498545[_0x07cc('0x10')][_0x07cc('0x12')]);}logger[_0x07cc('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x5f0f68,_0x498545['error'][_0x07cc('0x12')]);return _0x191755(_0x498545['error'][_0x07cc('0x12')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x5f0f68,_0x07cc('0xd'));_0x191755(_0x498545['result'][_0x07cc('0x12')]);}})[_0x07cc('0x13')](function(_0x20721d){logger[_0x07cc('0x10')](_0x07cc('0xc'),_0x5f0f68,_0x20721d);_0x261881(_0x20721d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3e77e7f..2afe0fc 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 _0x1ba1=['/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','post','addSound','put','delete','destroy'];(function(_0x19a4ae,_0x21054a){var _0x13b6c3=function(_0x4e3294){while(--_0x4e3294){_0x19a4ae['push'](_0x19a4ae['shift']());}};_0x13b6c3(++_0x21054a);}(_0x1ba1,0x1b3));var _0x11ba=function(_0x4bf033,_0x53154c){_0x4bf033=_0x4bf033-0x0;var _0x5e2df4=_0x1ba1[_0x4bf033];return _0x5e2df4;};'use strict';var multer=require('multer');var util=require(_0x11ba('0x0'));var path=require(_0x11ba('0x1'));var timeout=require(_0x11ba('0x2'));var express=require(_0x11ba('0x3'));var router=express[_0x11ba('0x4')]();var fs_extra=require(_0x11ba('0x5'));var auth=require(_0x11ba('0x6'));var interaction=require(_0x11ba('0x7'));var config=require(_0x11ba('0x8'));var controller=require(_0x11ba('0x9'));router[_0x11ba('0xa')]('/',auth[_0x11ba('0xb')](),controller[_0x11ba('0xc')]);router['get'](_0x11ba('0xd'),auth[_0x11ba('0xb')](),controller[_0x11ba('0xe')]);router[_0x11ba('0xa')](_0x11ba('0xf'),auth[_0x11ba('0xb')](),controller['getSounds']);router[_0x11ba('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x11ba('0x10')]('/:id/sounds',auth[_0x11ba('0xb')](),controller[_0x11ba('0x11')]);router[_0x11ba('0x12')](_0x11ba('0xd'),auth[_0x11ba('0xb')](),controller['update']);router[_0x11ba('0x13')](_0x11ba('0xd'),auth[_0x11ba('0xb')](),controller[_0x11ba('0x14')]);router['delete'](_0x11ba('0x15'),auth[_0x11ba('0xb')](),controller[_0x11ba('0x16')]);module[_0x11ba('0x17')]=router; \ No newline at end of file +var _0xe429=['delete','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xe429,0x76));var _0x9e42=function(_0x1964bb,_0x455876){_0x1964bb=_0x1964bb-0x0;var _0x4833dc=_0xe429[_0x1964bb];return _0x4833dc;};'use strict';var multer=require('multer');var util=require(_0x9e42('0x0'));var path=require(_0x9e42('0x1'));var timeout=require(_0x9e42('0x2'));var express=require(_0x9e42('0x3'));var router=express[_0x9e42('0x4')]();var fs_extra=require(_0x9e42('0x5'));var auth=require(_0x9e42('0x6'));var interaction=require(_0x9e42('0x7'));var config=require(_0x9e42('0x8'));var controller=require(_0x9e42('0x9'));router[_0x9e42('0xa')]('/',auth[_0x9e42('0xb')](),controller['index']);router[_0x9e42('0xa')](_0x9e42('0xc'),auth[_0x9e42('0xb')](),controller[_0x9e42('0xd')]);router['get'](_0x9e42('0xe'),auth[_0x9e42('0xb')](),controller[_0x9e42('0xf')]);router[_0x9e42('0x10')]('/',auth['isAuthenticated'](),controller[_0x9e42('0x11')]);router[_0x9e42('0x10')]('/:id/sounds',auth[_0x9e42('0xb')](),controller[_0x9e42('0x12')]);router[_0x9e42('0x13')](_0x9e42('0xc'),auth[_0x9e42('0xb')](),controller['update']);router[_0x9e42('0x14')]('/:id',auth[_0x9e42('0xb')](),controller['destroy']);router[_0x9e42('0x14')]('/:id/sounds/:id2',auth[_0x9e42('0xb')](),controller[_0x9e42('0x15')]);module[_0x9e42('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 6437b98..bedaa2e 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 _0x04f9=['quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','files','mp3nb'];(function(_0x592610,_0x19f6fa){var _0x129d7f=function(_0x4ef9a7){while(--_0x4ef9a7){_0x592610['push'](_0x592610['shift']());}};_0x129d7f(++_0x19f6fa);}(_0x04f9,0x1e6));var _0x904f=function(_0x5a09d8,_0x5ed706){_0x5a09d8=_0x5a09d8-0x0;var _0xd9e2c7=_0x04f9[_0x5a09d8];return _0xd9e2c7;};'use strict';var Sequelize=require(_0x904f('0x0'));module[_0x904f('0x1')]={'name':{'type':Sequelize[_0x904f('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x904f('0x3')]('custom',_0x904f('0x4'),_0x904f('0x5'),_0x904f('0x6'),_0x904f('0x7'),_0x904f('0x8')),'allowNull':!![],'defaultValue':_0x904f('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x904f('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x904f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x904f('0x2')],'allowNull':!![],'defaultValue':_0x904f('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x904f('0xa')},'defaultEntry':{'type':Sequelize[_0x904f('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1624=['ENUM','custom','files','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x1624,0xc3));var _0x4162=function(_0xe2f97d,_0x5a1ce9){_0xe2f97d=_0xe2f97d-0x0;var _0x2292ea=_0x1624[_0xe2f97d];return _0x2292ea;};'use strict';var Sequelize=require(_0x4162('0x0'));module[_0x4162('0x1')]={'name':{'type':Sequelize[_0x4162('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x4162('0x3')](_0x4162('0x4'),_0x4162('0x5'),'mp3nb',_0x4162('0x6'),_0x4162('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x4162('0x5')},'directory':{'type':Sequelize[_0x4162('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x4162('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x4162('0x2')],'allowNull':!![],'defaultValue':_0x4162('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4162('0x9')},'defaultEntry':{'type':Sequelize[_0x4162('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 2380ff2..cec7946 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 _0xb4d2=['intersection','model','fields','length','attributes','order','sort','where','pick','filter','merge','includeAll','findAll','catch','show','params','include','options','find','body','create','sequelize','transaction','files','directory','join','root','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','Sequelize','removeSound','Sound','id2','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','query','keys','filters'];(function(_0x465627,_0x2554fe){var _0x2df8cc=function(_0x47fa78){while(--_0x47fa78){_0x465627['push'](_0x465627['shift']());}};_0x2df8cc(++_0x2554fe);}(_0xb4d2,0x12d));var _0x2b4d=function(_0x41739a,_0x10fa7f){_0x41739a=_0x41739a-0x0;var _0x1d393e=_0xb4d2[_0x41739a];return _0x1d393e;};'use strict';var emlformat=require(_0x2b4d('0x0'));var rimraf=require(_0x2b4d('0x1'));var zipdir=require(_0x2b4d('0x2'));var jsonpatch=require(_0x2b4d('0x3'));var rp=require('request-promise');var moment=require(_0x2b4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b4d('0x5'));var util=require(_0x2b4d('0x6'));var path=require(_0x2b4d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2b4d('0x8'));var fs=require('fs');var fs_extra=require(_0x2b4d('0x9'));var _=require(_0x2b4d('0xa'));var squel=require(_0x2b4d('0xb'));var crypto=require(_0x2b4d('0xc'));var jsforce=require(_0x2b4d('0xd'));var deskjs=require(_0x2b4d('0xe'));var toCsv=require(_0x2b4d('0xf'));var querystring=require(_0x2b4d('0x10'));var Papa=require(_0x2b4d('0x11'));var Redis=require(_0x2b4d('0x12'));var authService=require(_0x2b4d('0x13'));var qs=require(_0x2b4d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b4d('0x15'));var logger=require(_0x2b4d('0x16'))('api');var utils=require(_0x2b4d('0x17'));var config=require(_0x2b4d('0x18'));var licenseUtil=require(_0x2b4d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2d59,_0x485ac9){_0x485ac9=_0x485ac9||0xcc;return function(_0x1aead8){if(_0x1aead8){return _0x4c2d59[_0x2b4d('0x1a')](_0x485ac9);}return _0x4c2d59[_0x2b4d('0x1b')](_0x485ac9)[_0x2b4d('0x1c')]();};}function respondWithResult(_0x5df8ed,_0x5bad03){_0x5bad03=_0x5bad03||0xc8;return function(_0xbaaa4f){if(_0xbaaa4f){return _0x5df8ed[_0x2b4d('0x1b')](_0x5bad03)[_0x2b4d('0x1d')](_0xbaaa4f);}};}function respondWithFilteredResult(_0x5cb402,_0x3c48b5){return function(_0x299837){if(_0x299837){var _0x54cbf6=typeof _0x3c48b5[_0x2b4d('0x1e')]==='undefined'&&typeof _0x3c48b5[_0x2b4d('0x1f')]===_0x2b4d('0x20');var _0x2a8859=_0x299837[_0x2b4d('0x21')];var _0x13cdb7=_0x54cbf6?0x0:_0x3c48b5[_0x2b4d('0x1e')];var _0x392951=_0x54cbf6?_0x299837[_0x2b4d('0x21')]:_0x3c48b5[_0x2b4d('0x1e')]+_0x3c48b5[_0x2b4d('0x1f')];var _0x1f8b10;if(_0x392951>=_0x2a8859){_0x392951=_0x2a8859;_0x1f8b10=0xc8;}else{_0x1f8b10=0xce;}_0x5cb402[_0x2b4d('0x1b')](_0x1f8b10);return _0x5cb402['set'](_0x2b4d('0x22'),_0x13cdb7+'-'+_0x392951+'/'+_0x2a8859)[_0x2b4d('0x1d')](_0x299837);}return null;};}function patchUpdates(_0x36a10d){return function(_0x5e03b6){try{jsonpatch[_0x2b4d('0x23')](_0x5e03b6,_0x36a10d,!![]);}catch(_0x5dfe19){return BPromise[_0x2b4d('0x24')](_0x5dfe19);}return _0x5e03b6[_0x2b4d('0x25')]();};}function saveUpdates(_0xbb3d9a,_0x1e3ee8){return function(_0xe17b52){if(_0xe17b52){return _0xe17b52[_0x2b4d('0x26')](_0xbb3d9a)[_0x2b4d('0x27')](function(_0x110d3d){return _0x110d3d;});}return null;};}function removeEntity(_0x3863b4,_0x2f502b){return function(_0x4d8890){if(_0x4d8890){return _0x4d8890['destroy']()[_0x2b4d('0x27')](function(){var _0x137e9e=_0x4d8890[_0x2b4d('0x28')]({'plain':!![]});var _0x388630=_0x2b4d('0x29');return db[_0x2b4d('0x2a')]['destroy']({'where':{'type':_0x388630,'resourceId':_0x137e9e['id']}})['then'](function(){return _0x4d8890;});})[_0x2b4d('0x27')](function(){_0x3863b4[_0x2b4d('0x1b')](0xcc)[_0x2b4d('0x1c')]();});}};}function handleEntityNotFound(_0x59f67b,_0x419cbf){return function(_0x898c79){if(!_0x898c79){_0x59f67b[_0x2b4d('0x1a')](0x194);}return _0x898c79;};}function handleError(_0x385be1,_0x535cef){_0x535cef=_0x535cef||0x1f4;return function(_0x15084a){logger[_0x2b4d('0x2b')](_0x15084a[_0x2b4d('0x2c')]);if(_0x15084a[_0x2b4d('0x2d')]){delete _0x15084a[_0x2b4d('0x2d')];}_0x385be1[_0x2b4d('0x1b')](_0x535cef)[_0x2b4d('0x2e')](_0x15084a);};}exports[_0x2b4d('0x2f')]=function(_0x240378,_0x3307a2){var _0x4921d1={},_0x31df7d={},_0x40a9f3={'count':0x0,'rows':[]};var _0x327380=_[_0x2b4d('0x30')](db[_0x2b4d('0x31')][_0x2b4d('0x32')],function(_0x4d5b96){return{'name':_0x4d5b96['fieldName'],'type':_0x4d5b96[_0x2b4d('0x33')][_0x2b4d('0x34')]};});_0x31df7d['model']=_[_0x2b4d('0x30')](_0x327380,_0x2b4d('0x2d'));_0x31df7d[_0x2b4d('0x35')]=_[_0x2b4d('0x36')](_0x240378[_0x2b4d('0x35')]);_0x31df7d[_0x2b4d('0x37')]=_[_0x2b4d('0x38')](_0x31df7d[_0x2b4d('0x39')],_0x31df7d[_0x2b4d('0x35')]);_0x4921d1['attributes']=_[_0x2b4d('0x38')](_0x31df7d[_0x2b4d('0x39')],qs[_0x2b4d('0x3a')](_0x240378[_0x2b4d('0x35')][_0x2b4d('0x3a')]));_0x4921d1['attributes']=_0x4921d1['attributes'][_0x2b4d('0x3b')]?_0x4921d1[_0x2b4d('0x3c')]:_0x31df7d[_0x2b4d('0x39')];if(!_0x240378[_0x2b4d('0x35')]['hasOwnProperty']('nolimit')){_0x4921d1[_0x2b4d('0x1f')]=qs[_0x2b4d('0x1f')](_0x240378[_0x2b4d('0x35')][_0x2b4d('0x1f')]);_0x4921d1[_0x2b4d('0x1e')]=qs[_0x2b4d('0x1e')](_0x240378[_0x2b4d('0x35')][_0x2b4d('0x1e')]);}_0x4921d1[_0x2b4d('0x3d')]=qs[_0x2b4d('0x3e')](_0x240378[_0x2b4d('0x35')][_0x2b4d('0x3e')]);delete _0x240378[_0x2b4d('0x35')][_0x2b4d('0x3e')];_0x4921d1[_0x2b4d('0x3f')]=qs[_0x2b4d('0x37')](_[_0x2b4d('0x40')](_0x240378[_0x2b4d('0x35')],_0x31df7d[_0x2b4d('0x37')]),_0x327380);if(_0x240378[_0x2b4d('0x35')][_0x2b4d('0x41')]){_0x4921d1['where']=_[_0x2b4d('0x42')](_0x4921d1[_0x2b4d('0x3f')],{'$or':_[_0x2b4d('0x30')](_0x327380,function(_0x5cc6a8){if(_0x5cc6a8[_0x2b4d('0x33')]!=='VIRTUAL'){var _0x1fde49={};_0x1fde49[_0x5cc6a8[_0x2b4d('0x2d')]]={'$like':'%'+_0x240378[_0x2b4d('0x35')][_0x2b4d('0x41')]+'%'};return _0x1fde49;}})});}_0x4921d1=_[_0x2b4d('0x42')]({},_0x4921d1,_0x240378['options']);var _0x599dd7={'where':_0x4921d1[_0x2b4d('0x3f')]};return db['VoiceMusicOnHold'][_0x2b4d('0x21')](_0x599dd7)[_0x2b4d('0x27')](function(_0x129cc7){_0x40a9f3[_0x2b4d('0x21')]=_0x129cc7;if(_0x240378[_0x2b4d('0x35')][_0x2b4d('0x43')]){_0x4921d1['include']=[{'all':!![]}];}return db[_0x2b4d('0x31')][_0x2b4d('0x44')](_0x4921d1);})[_0x2b4d('0x27')](function(_0x1e97f3){_0x40a9f3['rows']=_0x1e97f3;return _0x40a9f3;})['then'](respondWithFilteredResult(_0x3307a2,_0x4921d1))[_0x2b4d('0x45')](handleError(_0x3307a2,null));};exports[_0x2b4d('0x46')]=function(_0xcb6ecf,_0x551e9e){var _0x1f67f3={'raw':![],'where':{'id':_0xcb6ecf[_0x2b4d('0x47')]['id']}},_0x5987ce={};_0x5987ce[_0x2b4d('0x39')]=_[_0x2b4d('0x36')](db[_0x2b4d('0x31')][_0x2b4d('0x32')]);_0x5987ce['query']=_[_0x2b4d('0x36')](_0xcb6ecf['query']);_0x5987ce[_0x2b4d('0x37')]=_[_0x2b4d('0x38')](_0x5987ce[_0x2b4d('0x39')],_0x5987ce[_0x2b4d('0x35')]);_0x1f67f3[_0x2b4d('0x3c')]=_[_0x2b4d('0x38')](_0x5987ce[_0x2b4d('0x39')],qs['fields'](_0xcb6ecf[_0x2b4d('0x35')][_0x2b4d('0x3a')]));_0x1f67f3[_0x2b4d('0x3c')]=_0x1f67f3['attributes'][_0x2b4d('0x3b')]?_0x1f67f3[_0x2b4d('0x3c')]:_0x5987ce['model'];if(_0xcb6ecf[_0x2b4d('0x35')][_0x2b4d('0x43')]){_0x1f67f3[_0x2b4d('0x48')]=[{'all':!![]}];}_0x1f67f3=_[_0x2b4d('0x42')]({},_0x1f67f3,_0xcb6ecf[_0x2b4d('0x49')]);return db[_0x2b4d('0x31')][_0x2b4d('0x4a')](_0x1f67f3)[_0x2b4d('0x27')](handleEntityNotFound(_0x551e9e,null))['then'](respondWithResult(_0x551e9e,null))[_0x2b4d('0x45')](handleError(_0x551e9e,null));};exports[_0x2b4d('0x26')]=function(_0x1712d2,_0x3af004){if(_0x1712d2['body']['id']){delete _0x1712d2[_0x2b4d('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x2b4d('0x4a')]({'where':{'id':_0x1712d2['params']['id']}})[_0x2b4d('0x27')](handleEntityNotFound(_0x3af004,null))[_0x2b4d('0x27')](saveUpdates(_0x1712d2[_0x2b4d('0x4b')],null))[_0x2b4d('0x27')](respondWithResult(_0x3af004,null))['catch'](handleError(_0x3af004,null));};exports[_0x2b4d('0x4c')]=function(_0x148798,_0x34ca47,_0x267883){return db[_0x2b4d('0x4d')][_0x2b4d('0x4e')](function(_0x2a4447){if(_0x148798[_0x2b4d('0x4b')]['mode']===_0x2b4d('0x4f')){_0x148798[_0x2b4d('0x4b')][_0x2b4d('0x50')]=path[_0x2b4d('0x51')](config[_0x2b4d('0x52')],'server/files/moh',_0x148798[_0x2b4d('0x4b')][_0x2b4d('0x2d')]);}return db['VoiceMusicOnHold'][_0x2b4d('0x4c')](_0x148798['body'],{'transaction':_0x2a4447})[_0x2b4d('0x27')](function(_0x2a4ccb){if(_0x148798[_0x2b4d('0x4b')][_0x2b4d('0x53')]==='files'){fs[_0x2b4d('0x54')](_0x2a4ccb[_0x2b4d('0x50')],parseInt(_0x2b4d('0x55'),0x8));}var _0x2c9f7f=_0x148798[_0x2b4d('0x56')][_0x2b4d('0x28')]({'plain':!![]});if(!_0x2c9f7f)throw new Error(_0x2b4d('0x57'));if(_0x2c9f7f[_0x2b4d('0x58')]==='user'){var _0x4e169d=_0x2a4ccb['get']({'plain':!![]});return db[_0x2b4d('0x59')]['find']({'where':{'name':_0x2b4d('0x29'),'userProfileId':_0x2c9f7f[_0x2b4d('0x5a')]},'raw':!![]})[_0x2b4d('0x27')](function(_0x57fd29){if(_0x57fd29&&_0x57fd29[_0x2b4d('0x5b')]===0x0){return db[_0x2b4d('0x2a')][_0x2b4d('0x4c')]({'name':_0x4e169d[_0x2b4d('0x2d')],'resourceId':_0x4e169d['id'],'type':_0x57fd29[_0x2b4d('0x2d')],'sectionId':_0x57fd29['id']},{})[_0x2b4d('0x27')](function(){return _0x2a4ccb;});}else{return _0x2a4ccb;}})[_0x2b4d('0x45')](function(_0x58affa){logger['error'](_0x2b4d('0x5c'),_0x58affa);});}return _0x2a4ccb;});})['then'](respondWithResult(_0x34ca47,0xc9))[_0x2b4d('0x45')](handleError(_0x34ca47,null));};exports[_0x2b4d('0x5d')]=function(_0xd0e411,_0x553252,_0x410ddd){var _0x25b2e6;return db[_0x2b4d('0x31')][_0x2b4d('0x4a')]({'where':{'id':_0xd0e411[_0x2b4d('0x47')]['id']}})[_0x2b4d('0x27')](function(_0x5efc53){if(_0x5efc53){return db[_0x2b4d('0x4d')][_0x2b4d('0x4e')](function(_0x1b100b){return _0x5efc53['destroy']({'transaction':_0x1b100b,'raw':!![]})[_0x2b4d('0x27')](function(_0x291bae){if(_0x291bae[_0x2b4d('0x50')]){fs[_0x2b4d('0x5e')](_0x291bae[_0x2b4d('0x50')])[_0x2b4d('0x5f')](function(_0x4105ec){fs[_0x2b4d('0x60')](path['join'](_0x291bae['directory'],_0x4105ec));});fs[_0x2b4d('0x61')](_0x291bae[_0x2b4d('0x50')]);}return _0x291bae;});})['catch'](function(_0x561700){throw new db['Sequelize'][(_0x2b4d('0x62'))](_0x561700[_0x2b4d('0x63')]);});}})[_0x2b4d('0x27')](handleEntityNotFound(_0x553252,null))['then'](removeEntity(_0x553252,null))[_0x2b4d('0x45')](handleError(_0x553252,null));};exports[_0x2b4d('0x64')]=function(_0x495ac3,_0x12a0bd,_0x224c74){return db[_0x2b4d('0x4d')][_0x2b4d('0x4e')](function(_0x49a43e){var _0x4b789d;return db[_0x2b4d('0x31')][_0x2b4d('0x4a')]({'where':{'id':_0x495ac3['params']['id']}})[_0x2b4d('0x27')](function(_0x42a270){if(_0x42a270){_0x4b789d=_0x42a270;return _0x42a270[_0x2b4d('0x64')](_0x495ac3['body']['id'],{'transaction':_0x49a43e});}})[_0x2b4d('0x27')](function(_0x11ee9f){if(_0x11ee9f){return db['Sound'][_0x2b4d('0x65')]({'where':{'id':_0x495ac3[_0x2b4d('0x4b')]['id']},'attributes':['id',_0x2b4d('0x2d'),_0x2b4d('0x66'),_0x2b4d('0x67'),_0x2b4d('0x68')],'raw':!![]});}})[_0x2b4d('0x27')](function(_0x5c42a5){if(_0x5c42a5){var _0x2a6597=path[_0x2b4d('0x51')](config[_0x2b4d('0x52')],_0x2b4d('0x69'),util[_0x2b4d('0x6a')](_0x2b4d('0x6b'),path[_0x2b4d('0x6c')](_0x5c42a5['save_name'],path[_0x2b4d('0x6d')](_0x5c42a5[_0x2b4d('0x66')])),_0x5c42a5[_0x2b4d('0x67')]));var _0x1fc5ea=path[_0x2b4d('0x51')](config[_0x2b4d('0x52')],_0x2b4d('0x6e'),_0x4b789d[_0x2b4d('0x2d')],util[_0x2b4d('0x6a')](_0x2b4d('0x6b'),_0x5c42a5['name'],_0x5c42a5[_0x2b4d('0x67')]));fs[_0x2b4d('0x6f')](_0x2a6597,_0x1fc5ea);return _0x5c42a5;}})[_0x2b4d('0x45')](function(_0x2a673e){throw new db[(_0x2b4d('0x70'))][(_0x2b4d('0x62'))](_0x2a673e[_0x2b4d('0x63')]);});})[_0x2b4d('0x27')](handleEntityNotFound(_0x12a0bd,null))['then'](respondWithResult(_0x12a0bd,0xc9))[_0x2b4d('0x45')](handleError(_0x12a0bd,null));};exports[_0x2b4d('0x71')]=function(_0xff3d5e,_0x1ed7f8,_0x3bcf82){return db['sequelize'][_0x2b4d('0x4e')](function(_0x524e97){var _0x1b96d0;return db[_0x2b4d('0x31')][_0x2b4d('0x65')]({'where':{'id':_0xff3d5e[_0x2b4d('0x47')]['id']}})[_0x2b4d('0x27')](handleEntityNotFound(_0x1ed7f8,null))[_0x2b4d('0x27')](function(_0x4c23e9){if(_0x4c23e9){_0x1b96d0=_0x4c23e9;return _0x4c23e9[_0x2b4d('0x71')](_0xff3d5e[_0x2b4d('0x47')]['id2']);}})[_0x2b4d('0x27')](function(_0x255249){if(_0x255249){return db[_0x2b4d('0x72')][_0x2b4d('0x65')]({'where':{'id':_0xff3d5e[_0x2b4d('0x47')][_0x2b4d('0x73')]},'attributes':['id',_0x2b4d('0x2d'),_0x2b4d('0x66'),_0x2b4d('0x67'),'createdAt'],'raw':!![]});}})[_0x2b4d('0x27')](function(_0x36af81){if(_0x36af81){fs['unlinkSync'](path[_0x2b4d('0x51')](_0x1b96d0[_0x2b4d('0x50')],util[_0x2b4d('0x6a')](_0x2b4d('0x6b'),_0x36af81[_0x2b4d('0x2d')],_0x36af81[_0x2b4d('0x67')])));return _0x36af81;}})[_0x2b4d('0x45')](function(_0x98736){throw new db[(_0x2b4d('0x70'))][(_0x2b4d('0x62'))](_0x98736[_0x2b4d('0x63')]);});})['then'](handleEntityNotFound(_0x1ed7f8,null))[_0x2b4d('0x27')](respondWithStatusCode(_0x1ed7f8,0xcc))[_0x2b4d('0x45')](handleError(_0x1ed7f8,null));};exports[_0x2b4d('0x74')]=function(_0x22e9d1,_0x6d6b6d,_0x4d2d39){var _0x17eb65={};var _0x2d3ce8={};var _0x1228f9;var _0x2dde8a;return db[_0x2b4d('0x31')][_0x2b4d('0x65')]({'where':{'id':_0x22e9d1['params']['id']}})['then'](handleEntityNotFound(_0x6d6b6d,null))[_0x2b4d('0x27')](function(_0x5ed78d){if(_0x5ed78d){_0x1228f9=_0x5ed78d;_0x2d3ce8[_0x2b4d('0x39')]=_[_0x2b4d('0x36')](db[_0x2b4d('0x72')][_0x2b4d('0x32')]);_0x2d3ce8[_0x2b4d('0x35')]=_['keys'](_0x22e9d1[_0x2b4d('0x35')]);_0x2d3ce8['filters']=_['intersection'](_0x2d3ce8[_0x2b4d('0x39')],_0x2d3ce8[_0x2b4d('0x35')]);_0x17eb65[_0x2b4d('0x3c')]=_['intersection'](_0x2d3ce8[_0x2b4d('0x39')],qs[_0x2b4d('0x3a')](_0x22e9d1[_0x2b4d('0x35')]['fields']));_0x17eb65[_0x2b4d('0x3c')]=_0x17eb65['attributes'][_0x2b4d('0x3b')]?_0x17eb65[_0x2b4d('0x3c')]:_0x2d3ce8[_0x2b4d('0x39')];_0x17eb65[_0x2b4d('0x3d')]=qs[_0x2b4d('0x3e')](_0x22e9d1[_0x2b4d('0x35')][_0x2b4d('0x3e')]);_0x17eb65[_0x2b4d('0x3f')]=qs['filters'](_['pick'](_0x22e9d1[_0x2b4d('0x35')],_0x2d3ce8[_0x2b4d('0x37')]));if(_0x22e9d1[_0x2b4d('0x35')][_0x2b4d('0x41')]){_0x17eb65[_0x2b4d('0x3f')]=_['merge'](_0x17eb65[_0x2b4d('0x3f')],{'$or':_[_0x2b4d('0x30')](_0x17eb65[_0x2b4d('0x3c')],function(_0x1861a6){var _0x1c60ad={};_0x1c60ad[_0x1861a6]={'$like':'%'+_0x22e9d1[_0x2b4d('0x35')][_0x2b4d('0x41')]+'%'};return _0x1c60ad;})});}_0x17eb65=_[_0x2b4d('0x42')]({},_0x17eb65,_0x22e9d1[_0x2b4d('0x49')]);return _0x1228f9[_0x2b4d('0x74')](_0x17eb65);}})['then'](function(_0x520bb4){if(_0x520bb4){_0x2dde8a=_0x520bb4['length'];if(!_0x22e9d1['query'][_0x2b4d('0x75')](_0x2b4d('0x76'))){_0x17eb65[_0x2b4d('0x1f')]=qs[_0x2b4d('0x1f')](_0x22e9d1[_0x2b4d('0x35')][_0x2b4d('0x1f')]);_0x17eb65['offset']=qs[_0x2b4d('0x1e')](_0x22e9d1[_0x2b4d('0x35')][_0x2b4d('0x1e')]);}return _0x1228f9['getSounds'](_0x17eb65);}})['then'](function(_0x4fb63f){if(_0x4fb63f){return _0x4fb63f?{'count':_0x2dde8a,'rows':_0x4fb63f}:null;}})[_0x2b4d('0x27')](respondWithResult(_0x6d6b6d,null))[_0x2b4d('0x45')](handleError(_0x6d6b6d,null));}; \ No newline at end of file +var _0x7a30=['user','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','catch','show','params','find','body','sequelize','transaction','mode','files','directory','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x203d8c,_0x398fe0){var _0x1f3952=function(_0x4a88fc){while(--_0x4a88fc){_0x203d8c['push'](_0x203d8c['shift']());}};_0x1f3952(++_0x398fe0);}(_0x7a30,0x186));var _0x07a3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7a30[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x07a3('0x0'));var rimraf=require(_0x07a3('0x1'));var zipdir=require(_0x07a3('0x2'));var jsonpatch=require(_0x07a3('0x3'));var rp=require(_0x07a3('0x4'));var moment=require(_0x07a3('0x5'));var BPromise=require(_0x07a3('0x6'));var Mustache=require(_0x07a3('0x7'));var util=require('util');var path=require(_0x07a3('0x8'));var sox=require(_0x07a3('0x9'));var csv=require(_0x07a3('0xa'));var ejs=require(_0x07a3('0xb'));var fs=require('fs');var fs_extra=require(_0x07a3('0xc'));var _=require(_0x07a3('0xd'));var squel=require(_0x07a3('0xe'));var crypto=require(_0x07a3('0xf'));var jsforce=require(_0x07a3('0x10'));var deskjs=require(_0x07a3('0x11'));var toCsv=require(_0x07a3('0xa'));var querystring=require(_0x07a3('0x12'));var Papa=require(_0x07a3('0x13'));var Redis=require(_0x07a3('0x14'));var authService=require(_0x07a3('0x15'));var qs=require(_0x07a3('0x16'));var as=require(_0x07a3('0x17'));var hardwareService=require(_0x07a3('0x18'));var logger=require(_0x07a3('0x19'))(_0x07a3('0x1a'));var utils=require(_0x07a3('0x1b'));var config=require(_0x07a3('0x1c'));var licenseUtil=require(_0x07a3('0x1d'));var db=require(_0x07a3('0x1e'))['db'];function respondWithStatusCode(_0x4a337f,_0x2157d7){_0x2157d7=_0x2157d7||0xcc;return function(_0x779757){if(_0x779757){return _0x4a337f[_0x07a3('0x1f')](_0x2157d7);}return _0x4a337f['status'](_0x2157d7)['end']();};}function respondWithResult(_0x3076d3,_0x49e635){_0x49e635=_0x49e635||0xc8;return function(_0x4500bf){if(_0x4500bf){return _0x3076d3['status'](_0x49e635)[_0x07a3('0x20')](_0x4500bf);}};}function respondWithFilteredResult(_0x1d1ed2,_0x104a3e){return function(_0xed9929){if(_0xed9929){var _0x241c0a=typeof _0x104a3e[_0x07a3('0x21')]===_0x07a3('0x22')&&typeof _0x104a3e['limit']===_0x07a3('0x22');var _0x79f8ad=_0xed9929[_0x07a3('0x23')];var _0x4a5c77=_0x241c0a?0x0:_0x104a3e[_0x07a3('0x21')];var _0x178b08=_0x241c0a?_0xed9929['count']:_0x104a3e[_0x07a3('0x21')]+_0x104a3e[_0x07a3('0x24')];var _0x5b3a14;if(_0x178b08>=_0x79f8ad){_0x178b08=_0x79f8ad;_0x5b3a14=0xc8;}else{_0x5b3a14=0xce;}_0x1d1ed2[_0x07a3('0x25')](_0x5b3a14);return _0x1d1ed2[_0x07a3('0x26')](_0x07a3('0x27'),_0x4a5c77+'-'+_0x178b08+'/'+_0x79f8ad)['json'](_0xed9929);}return null;};}function patchUpdates(_0x1693ab){return function(_0xc2004f){try{jsonpatch[_0x07a3('0x28')](_0xc2004f,_0x1693ab,!![]);}catch(_0x4a753a){return BPromise[_0x07a3('0x29')](_0x4a753a);}return _0xc2004f[_0x07a3('0x2a')]();};}function saveUpdates(_0x1beb01,_0x3cc343){return function(_0x32610a){if(_0x32610a){return _0x32610a[_0x07a3('0x2b')](_0x1beb01)[_0x07a3('0x2c')](function(_0x165786){return _0x165786;});}return null;};}function removeEntity(_0x2b86d7,_0x30adab){return function(_0x22872c){if(_0x22872c){return _0x22872c['destroy']()[_0x07a3('0x2c')](function(){var _0x308ea5=_0x22872c[_0x07a3('0x2d')]({'plain':!![]});var _0x8fdaab=_0x07a3('0x2e');return db[_0x07a3('0x2f')][_0x07a3('0x30')]({'where':{'type':_0x8fdaab,'resourceId':_0x308ea5['id']}})['then'](function(){return _0x22872c;});})[_0x07a3('0x2c')](function(){_0x2b86d7[_0x07a3('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a4be,_0x2bbf31){return function(_0x529462){if(!_0x529462){_0x52a4be[_0x07a3('0x1f')](0x194);}return _0x529462;};}function handleError(_0x822ca9,_0x388edc){_0x388edc=_0x388edc||0x1f4;return function(_0x1964a2){logger['error'](_0x1964a2[_0x07a3('0x31')]);if(_0x1964a2['name']){delete _0x1964a2[_0x07a3('0x32')];}_0x822ca9[_0x07a3('0x25')](_0x388edc)[_0x07a3('0x33')](_0x1964a2);};}exports[_0x07a3('0x34')]=function(_0xa7f9b9,_0x5686b9){var _0x152f19={},_0x110602={},_0x369e5c={'count':0x0,'rows':[]};var _0x2f13fc=_[_0x07a3('0x35')](db['VoiceMusicOnHold'][_0x07a3('0x36')],function(_0x31d388){return{'name':_0x31d388[_0x07a3('0x37')],'type':_0x31d388[_0x07a3('0x38')][_0x07a3('0x39')]};});_0x110602[_0x07a3('0x3a')]=_[_0x07a3('0x35')](_0x2f13fc,'name');_0x110602[_0x07a3('0x3b')]=_[_0x07a3('0x3c')](_0xa7f9b9[_0x07a3('0x3b')]);_0x110602[_0x07a3('0x3d')]=_[_0x07a3('0x3e')](_0x110602[_0x07a3('0x3a')],_0x110602[_0x07a3('0x3b')]);_0x152f19[_0x07a3('0x3f')]=_[_0x07a3('0x3e')](_0x110602[_0x07a3('0x3a')],qs[_0x07a3('0x40')](_0xa7f9b9[_0x07a3('0x3b')][_0x07a3('0x40')]));_0x152f19[_0x07a3('0x3f')]=_0x152f19[_0x07a3('0x3f')][_0x07a3('0x41')]?_0x152f19[_0x07a3('0x3f')]:_0x110602['model'];if(!_0xa7f9b9[_0x07a3('0x3b')][_0x07a3('0x42')](_0x07a3('0x43'))){_0x152f19[_0x07a3('0x24')]=qs[_0x07a3('0x24')](_0xa7f9b9[_0x07a3('0x3b')]['limit']);_0x152f19[_0x07a3('0x21')]=qs[_0x07a3('0x21')](_0xa7f9b9[_0x07a3('0x3b')][_0x07a3('0x21')]);}_0x152f19['order']=qs[_0x07a3('0x44')](_0xa7f9b9[_0x07a3('0x3b')][_0x07a3('0x44')]);delete _0xa7f9b9[_0x07a3('0x3b')][_0x07a3('0x44')];_0x152f19[_0x07a3('0x45')]=qs[_0x07a3('0x3d')](_[_0x07a3('0x46')](_0xa7f9b9['query'],_0x110602[_0x07a3('0x3d')]),_0x2f13fc);if(_0xa7f9b9['query'][_0x07a3('0x47')]){_0x152f19[_0x07a3('0x45')]=_[_0x07a3('0x48')](_0x152f19[_0x07a3('0x45')],{'$or':_[_0x07a3('0x35')](_0x2f13fc,function(_0x4f3e33){if(_0x4f3e33['type']!==_0x07a3('0x49')){var _0x5707bc={};_0x5707bc[_0x4f3e33['name']]={'$like':'%'+_0xa7f9b9[_0x07a3('0x3b')]['filter']+'%'};return _0x5707bc;}})});}_0x152f19=_[_0x07a3('0x48')]({},_0x152f19,_0xa7f9b9[_0x07a3('0x4a')]);var _0xf04215={'where':_0x152f19[_0x07a3('0x45')]};return db['VoiceMusicOnHold'][_0x07a3('0x23')](_0xf04215)['then'](function(_0x47030b){_0x369e5c[_0x07a3('0x23')]=_0x47030b;if(_0xa7f9b9[_0x07a3('0x3b')][_0x07a3('0x4b')]){_0x152f19[_0x07a3('0x4c')]=[{'all':!![]}];}return db[_0x07a3('0x4d')]['findAll'](_0x152f19);})[_0x07a3('0x2c')](function(_0x2ee6da){_0x369e5c['rows']=_0x2ee6da;return _0x369e5c;})['then'](respondWithFilteredResult(_0x5686b9,_0x152f19))[_0x07a3('0x4e')](handleError(_0x5686b9,null));};exports[_0x07a3('0x4f')]=function(_0xd72060,_0x3884ca){var _0x109134={'raw':![],'where':{'id':_0xd72060[_0x07a3('0x50')]['id']}},_0x28c2aa={};_0x28c2aa[_0x07a3('0x3a')]=_[_0x07a3('0x3c')](db[_0x07a3('0x4d')][_0x07a3('0x36')]);_0x28c2aa[_0x07a3('0x3b')]=_[_0x07a3('0x3c')](_0xd72060[_0x07a3('0x3b')]);_0x28c2aa[_0x07a3('0x3d')]=_[_0x07a3('0x3e')](_0x28c2aa['model'],_0x28c2aa[_0x07a3('0x3b')]);_0x109134[_0x07a3('0x3f')]=_['intersection'](_0x28c2aa[_0x07a3('0x3a')],qs[_0x07a3('0x40')](_0xd72060['query'][_0x07a3('0x40')]));_0x109134['attributes']=_0x109134[_0x07a3('0x3f')][_0x07a3('0x41')]?_0x109134[_0x07a3('0x3f')]:_0x28c2aa[_0x07a3('0x3a')];if(_0xd72060[_0x07a3('0x3b')][_0x07a3('0x4b')]){_0x109134[_0x07a3('0x4c')]=[{'all':!![]}];}_0x109134=_[_0x07a3('0x48')]({},_0x109134,_0xd72060['options']);return db[_0x07a3('0x4d')][_0x07a3('0x51')](_0x109134)['then'](handleEntityNotFound(_0x3884ca,null))[_0x07a3('0x2c')](respondWithResult(_0x3884ca,null))[_0x07a3('0x4e')](handleError(_0x3884ca,null));};exports[_0x07a3('0x2b')]=function(_0x2d5748,_0x18a795){if(_0x2d5748[_0x07a3('0x52')]['id']){delete _0x2d5748[_0x07a3('0x52')]['id'];}return db[_0x07a3('0x4d')]['find']({'where':{'id':_0x2d5748['params']['id']}})['then'](handleEntityNotFound(_0x18a795,null))['then'](saveUpdates(_0x2d5748['body'],null))[_0x07a3('0x2c')](respondWithResult(_0x18a795,null))[_0x07a3('0x4e')](handleError(_0x18a795,null));};exports['create']=function(_0x5ac970,_0x610d64,_0x419a36){return db[_0x07a3('0x53')][_0x07a3('0x54')](function(_0x439846){if(_0x5ac970[_0x07a3('0x52')][_0x07a3('0x55')]===_0x07a3('0x56')){_0x5ac970[_0x07a3('0x52')][_0x07a3('0x57')]=path['join'](config[_0x07a3('0x58')],_0x07a3('0x59'),_0x5ac970[_0x07a3('0x52')][_0x07a3('0x32')]);}return db[_0x07a3('0x4d')]['create'](_0x5ac970['body'],{'transaction':_0x439846})[_0x07a3('0x2c')](function(_0x3f0ff2){if(_0x5ac970[_0x07a3('0x52')][_0x07a3('0x55')]===_0x07a3('0x56')){fs[_0x07a3('0x5a')](_0x3f0ff2['directory'],parseInt(_0x07a3('0x5b'),0x8));}var _0x4891ff=_0x5ac970['user'][_0x07a3('0x2d')]({'plain':!![]});if(!_0x4891ff)throw new Error(_0x07a3('0x5c'));if(_0x4891ff[_0x07a3('0x5d')]===_0x07a3('0x5e')){var _0x44b198=_0x3f0ff2[_0x07a3('0x2d')]({'plain':!![]});return db[_0x07a3('0x5f')]['find']({'where':{'name':_0x07a3('0x2e'),'userProfileId':_0x4891ff[_0x07a3('0x60')]},'raw':!![]})['then'](function(_0x1c8aa3){if(_0x1c8aa3&&_0x1c8aa3[_0x07a3('0x61')]===0x0){return db['UserProfileResource'][_0x07a3('0x62')]({'name':_0x44b198['name'],'resourceId':_0x44b198['id'],'type':_0x1c8aa3[_0x07a3('0x32')],'sectionId':_0x1c8aa3['id']},{})['then'](function(){return _0x3f0ff2;});}else{return _0x3f0ff2;}})[_0x07a3('0x4e')](function(_0x1eade){logger[_0x07a3('0x63')](_0x07a3('0x64'),_0x1eade);});}return _0x3f0ff2;});})[_0x07a3('0x2c')](respondWithResult(_0x610d64,0xc9))[_0x07a3('0x4e')](handleError(_0x610d64,null));};exports['destroy']=function(_0x30bf68,_0xbb8826,_0x3a820b){var _0x5bba78;return db[_0x07a3('0x4d')][_0x07a3('0x51')]({'where':{'id':_0x30bf68[_0x07a3('0x50')]['id']}})[_0x07a3('0x2c')](function(_0x543b7f){if(_0x543b7f){return db[_0x07a3('0x53')][_0x07a3('0x54')](function(_0x3f6f3e){return _0x543b7f[_0x07a3('0x30')]({'transaction':_0x3f6f3e,'raw':!![]})[_0x07a3('0x2c')](function(_0xfff927){if(_0xfff927[_0x07a3('0x57')]){fs['readdirSync'](_0xfff927['directory'])['forEach'](function(_0x507bc3){fs[_0x07a3('0x65')](path['join'](_0xfff927[_0x07a3('0x57')],_0x507bc3));});fs['rmdirSync'](_0xfff927[_0x07a3('0x57')]);}return _0xfff927;});})[_0x07a3('0x4e')](function(_0x3cc8d2){throw new db[(_0x07a3('0x66'))][(_0x07a3('0x67'))](_0x3cc8d2[_0x07a3('0x68')]);});}})[_0x07a3('0x2c')](handleEntityNotFound(_0xbb8826,null))[_0x07a3('0x2c')](removeEntity(_0xbb8826,null))['catch'](handleError(_0xbb8826,null));};exports[_0x07a3('0x69')]=function(_0x5afd3b,_0x2fb931,_0x48bb10){return db[_0x07a3('0x53')][_0x07a3('0x54')](function(_0x1e072e){var _0x3dfe31;return db[_0x07a3('0x4d')][_0x07a3('0x51')]({'where':{'id':_0x5afd3b[_0x07a3('0x50')]['id']}})[_0x07a3('0x2c')](function(_0x25fc3a){if(_0x25fc3a){_0x3dfe31=_0x25fc3a;return _0x25fc3a[_0x07a3('0x69')](_0x5afd3b[_0x07a3('0x52')]['id'],{'transaction':_0x1e072e});}})[_0x07a3('0x2c')](function(_0x4e1b7c){if(_0x4e1b7c){return db[_0x07a3('0x6a')][_0x07a3('0x6b')]({'where':{'id':_0x5afd3b[_0x07a3('0x52')]['id']},'attributes':['id',_0x07a3('0x32'),_0x07a3('0x6c'),_0x07a3('0x6d'),_0x07a3('0x6e')],'raw':!![]});}})[_0x07a3('0x2c')](function(_0x7487ec){if(_0x7487ec){var _0x4e9014=path[_0x07a3('0x6f')](config[_0x07a3('0x58')],'server/files/sounds/converted',util[_0x07a3('0x70')](_0x07a3('0x71'),path[_0x07a3('0x72')](_0x7487ec['save_name'],path[_0x07a3('0x73')](_0x7487ec[_0x07a3('0x6c')])),_0x7487ec[_0x07a3('0x6d')]));var _0xb0fca=path['join'](config['root'],_0x07a3('0x59'),_0x3dfe31['name'],util[_0x07a3('0x70')](_0x07a3('0x71'),_0x7487ec[_0x07a3('0x32')],_0x7487ec[_0x07a3('0x6d')]));fs[_0x07a3('0x74')](_0x4e9014,_0xb0fca);return _0x7487ec;}})['catch'](function(_0x1784cd){throw new db[(_0x07a3('0x66'))][(_0x07a3('0x67'))](_0x1784cd[_0x07a3('0x68')]);});})[_0x07a3('0x2c')](handleEntityNotFound(_0x2fb931,null))[_0x07a3('0x2c')](respondWithResult(_0x2fb931,0xc9))[_0x07a3('0x4e')](handleError(_0x2fb931,null));};exports[_0x07a3('0x75')]=function(_0x501a2e,_0xc34866,_0x5eb368){return db['sequelize'][_0x07a3('0x54')](function(_0x57ed61){var _0x57a04f;return db['VoiceMusicOnHold'][_0x07a3('0x6b')]({'where':{'id':_0x501a2e[_0x07a3('0x50')]['id']}})[_0x07a3('0x2c')](handleEntityNotFound(_0xc34866,null))['then'](function(_0x4fab5b){if(_0x4fab5b){_0x57a04f=_0x4fab5b;return _0x4fab5b['removeSound'](_0x501a2e[_0x07a3('0x50')][_0x07a3('0x76')]);}})[_0x07a3('0x2c')](function(_0x1053aa){if(_0x1053aa){return db[_0x07a3('0x6a')][_0x07a3('0x6b')]({'where':{'id':_0x501a2e[_0x07a3('0x50')][_0x07a3('0x76')]},'attributes':['id',_0x07a3('0x32'),_0x07a3('0x6c'),'converted_format',_0x07a3('0x6e')],'raw':!![]});}})['then'](function(_0x326811){if(_0x326811){fs[_0x07a3('0x65')](path[_0x07a3('0x6f')](_0x57a04f[_0x07a3('0x57')],util['format'](_0x07a3('0x71'),_0x326811['name'],_0x326811[_0x07a3('0x6d')])));return _0x326811;}})[_0x07a3('0x4e')](function(_0x3b390c){throw new db[(_0x07a3('0x66'))][(_0x07a3('0x67'))](_0x3b390c[_0x07a3('0x68')]);});})['then'](handleEntityNotFound(_0xc34866,null))[_0x07a3('0x2c')](respondWithStatusCode(_0xc34866,0xcc))[_0x07a3('0x4e')](handleError(_0xc34866,null));};exports[_0x07a3('0x77')]=function(_0x36ef2f,_0x24dd57,_0x31833e){var _0x222e03={};var _0x4f5074={};var _0x4fbf59;var _0x18db52;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x36ef2f[_0x07a3('0x50')]['id']}})[_0x07a3('0x2c')](handleEntityNotFound(_0x24dd57,null))[_0x07a3('0x2c')](function(_0x4c5f15){if(_0x4c5f15){_0x4fbf59=_0x4c5f15;_0x4f5074[_0x07a3('0x3a')]=_[_0x07a3('0x3c')](db[_0x07a3('0x6a')][_0x07a3('0x36')]);_0x4f5074[_0x07a3('0x3b')]=_[_0x07a3('0x3c')](_0x36ef2f[_0x07a3('0x3b')]);_0x4f5074[_0x07a3('0x3d')]=_['intersection'](_0x4f5074[_0x07a3('0x3a')],_0x4f5074[_0x07a3('0x3b')]);_0x222e03[_0x07a3('0x3f')]=_[_0x07a3('0x3e')](_0x4f5074[_0x07a3('0x3a')],qs[_0x07a3('0x40')](_0x36ef2f['query'][_0x07a3('0x40')]));_0x222e03[_0x07a3('0x3f')]=_0x222e03[_0x07a3('0x3f')][_0x07a3('0x41')]?_0x222e03[_0x07a3('0x3f')]:_0x4f5074['model'];_0x222e03[_0x07a3('0x78')]=qs['sort'](_0x36ef2f[_0x07a3('0x3b')][_0x07a3('0x44')]);_0x222e03[_0x07a3('0x45')]=qs['filters'](_[_0x07a3('0x46')](_0x36ef2f[_0x07a3('0x3b')],_0x4f5074[_0x07a3('0x3d')]));if(_0x36ef2f['query'][_0x07a3('0x47')]){_0x222e03['where']=_[_0x07a3('0x48')](_0x222e03[_0x07a3('0x45')],{'$or':_[_0x07a3('0x35')](_0x222e03[_0x07a3('0x3f')],function(_0x2f3396){var _0x3cc62a={};_0x3cc62a[_0x2f3396]={'$like':'%'+_0x36ef2f[_0x07a3('0x3b')][_0x07a3('0x47')]+'%'};return _0x3cc62a;})});}_0x222e03=_[_0x07a3('0x48')]({},_0x222e03,_0x36ef2f[_0x07a3('0x4a')]);return _0x4fbf59['getSounds'](_0x222e03);}})[_0x07a3('0x2c')](function(_0x4f824e){if(_0x4f824e){_0x18db52=_0x4f824e['length'];if(!_0x36ef2f[_0x07a3('0x3b')]['hasOwnProperty'](_0x07a3('0x43'))){_0x222e03['limit']=qs[_0x07a3('0x24')](_0x36ef2f[_0x07a3('0x3b')][_0x07a3('0x24')]);_0x222e03[_0x07a3('0x21')]=qs['offset'](_0x36ef2f['query'][_0x07a3('0x21')]);}return _0x4fbf59[_0x07a3('0x77')](_0x222e03);}})[_0x07a3('0x2c')](function(_0x451e22){if(_0x451e22){return _0x451e22?{'count':_0x18db52,'rows':_0x451e22}:null;}})[_0x07a3('0x2c')](respondWithResult(_0x24dd57,null))['catch'](handleError(_0x24dd57,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d103c48..66a5fef 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 _0x4660=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x253a98,_0x183496){var _0x545534=function(_0x3a4cc6){while(--_0x3a4cc6){_0x253a98['push'](_0x253a98['shift']());}};_0x545534(++_0x183496);}(_0x4660,0x141));var _0x0466=function(_0x4e34f6,_0x2113e7){_0x4e34f6=_0x4e34f6-0x0;var _0x36cc27=_0x4660[_0x4e34f6];return _0x36cc27;};'use strict';var _=require('lodash');var util=require(_0x0466('0x0'));var logger=require(_0x0466('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0466('0x2'));var rp=require(_0x0466('0x3'));var fs=require('fs');var path=require(_0x0466('0x4'));var rimraf=require(_0x0466('0x5'));var config=require(_0x0466('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x0466('0x7')]=function(_0x40fef0,_0x5910f3){return _0x40fef0[_0x0466('0x8')](_0x0466('0x9'),attributes,{'tableName':_0x0466('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x709e=['exports','define','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x16d495,_0xe95d9b){var _0x81df60=function(_0x4cb336){while(--_0x4cb336){_0x16d495['push'](_0x16d495['shift']());}};_0x81df60(++_0xe95d9b);}(_0x709e,0xab));var _0xe709=function(_0x588372,_0x1ca124){_0x588372=_0x588372-0x0;var _0x33bad0=_0x709e[_0x588372];return _0x33bad0;};'use strict';var _=require(_0xe709('0x0'));var util=require(_0xe709('0x1'));var logger=require(_0xe709('0x2'))('api');var moment=require(_0xe709('0x3'));var BPromise=require(_0xe709('0x4'));var rp=require(_0xe709('0x5'));var fs=require('fs');var path=require(_0xe709('0x6'));var rimraf=require('rimraf');var config=require(_0xe709('0x7'));var attributes=require(_0xe709('0x8'));module[_0xe709('0x9')]=function(_0x446e04,_0x271b8f){return _0x446e04[_0xe709('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xe709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index b6e5690..657239e 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x3bf977,_0x1d16aa){var _0x177747=function(_0x109405){while(--_0x109405){_0x3bf977['push'](_0x3bf977['shift']());}};_0x177747(++_0x1d16aa);}(_0xedd9,0xfc));var _0x9edd=function(_0x23765a,_0x3972ab){_0x23765a=_0x23765a-0x0;var _0x118f8a=_0xedd9[_0x23765a];return _0x118f8a;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x2e9dc5,_0xbeaad1){var _0x505456=function(_0x1ed05f){while(--_0x1ed05f){_0x2e9dc5['push'](_0x2e9dc5['shift']());}};_0x505456(++_0xbeaad1);}(_0xedd9,0xfc));var _0x9edd=function(_0x61031e,_0xf7fb48){_0x61031e=_0x61031e-0x0;var _0x3aa192=_0xedd9[_0x61031e];return _0x3aa192;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c915ef0..a872258 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 _0x48e3=['create','addAgents','addTeams','put','delete','destroy','removeAgents','removeTeams','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0x48e3,0xe9));var _0x348e=function(_0x2f130b,_0xbb95dc){_0x2f130b=_0x2f130b-0x0;var _0x35e559=_0x48e3[_0x2f130b];return _0x35e559;};'use strict';var multer=require(_0x348e('0x0'));var util=require(_0x348e('0x1'));var path=require('path');var timeout=require(_0x348e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x348e('0x3'));var auth=require(_0x348e('0x4'));var interaction=require(_0x348e('0x5'));var config=require(_0x348e('0x6'));var controller=require('./voicePrefix.controller');router[_0x348e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x348e('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x348e('0x8')]);router['get'](_0x348e('0x9'),auth[_0x348e('0xa')](),controller[_0x348e('0xb')]);router[_0x348e('0x7')](_0x348e('0xc'),auth[_0x348e('0xa')](),controller[_0x348e('0xd')]);router[_0x348e('0x7')](_0x348e('0xe'),auth[_0x348e('0xa')](),controller[_0x348e('0xf')]);router[_0x348e('0x10')]('/',auth[_0x348e('0xa')](),controller[_0x348e('0x11')]);router['post'](_0x348e('0xc'),auth[_0x348e('0xa')](),controller[_0x348e('0x12')]);router['post'](_0x348e('0xe'),auth[_0x348e('0xa')](),controller[_0x348e('0x13')]);router[_0x348e('0x14')](_0x348e('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x348e('0x15')](_0x348e('0x9'),auth[_0x348e('0xa')](),controller[_0x348e('0x16')]);router['delete'](_0x348e('0xc'),auth['isAuthenticated'](),controller[_0x348e('0x17')]);router[_0x348e('0x15')](_0x348e('0xe'),auth['isAuthenticated'](),controller[_0x348e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x23ea=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','show','/:id/users','/:id/teams','getTeams','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x23ea,0xc3));var _0xa23e=function(_0x500e16,_0x30ec9a){_0x500e16=_0x500e16-0x0;var _0x54f1d1=_0x23ea[_0x500e16];return _0x54f1d1;};'use strict';var multer=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var path=require(_0xa23e('0x2'));var timeout=require(_0xa23e('0x3'));var express=require(_0xa23e('0x4'));var router=express[_0xa23e('0x5')]();var fs_extra=require(_0xa23e('0x6'));var auth=require(_0xa23e('0x7'));var interaction=require(_0xa23e('0x8'));var config=require(_0xa23e('0x9'));var controller=require(_0xa23e('0xa'));router['get']('/',auth[_0xa23e('0xb')](),controller[_0xa23e('0xc')]);router[_0xa23e('0xd')](_0xa23e('0xe'),auth[_0xa23e('0xb')](),controller[_0xa23e('0xf')]);router['get']('/:id',auth[_0xa23e('0xb')](),controller[_0xa23e('0x10')]);router[_0xa23e('0xd')](_0xa23e('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa23e('0xd')](_0xa23e('0x12'),auth['isAuthenticated'](),controller[_0xa23e('0x13')]);router[_0xa23e('0x14')]('/',auth['isAuthenticated'](),controller[_0xa23e('0x15')]);router[_0xa23e('0x14')](_0xa23e('0x11'),auth[_0xa23e('0xb')](),controller['addAgents']);router[_0xa23e('0x14')](_0xa23e('0x12'),auth[_0xa23e('0xb')](),controller['addTeams']);router[_0xa23e('0x16')](_0xa23e('0x17'),auth[_0xa23e('0xb')](),controller[_0xa23e('0x18')]);router[_0xa23e('0x19')](_0xa23e('0x17'),auth['isAuthenticated'](),controller[_0xa23e('0x1a')]);router['delete'](_0xa23e('0x11'),auth[_0xa23e('0xb')](),controller['removeAgents']);router[_0xa23e('0x19')](_0xa23e('0x12'),auth[_0xa23e('0xb')](),controller['removeTeams']);module[_0xa23e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 3a4aa25..c4febdd 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 _0x2373=['sequelize','exports','name','VIRTUAL','system-','STRING','INTEGER'];(function(_0x5c0fcc,_0x4ca7d7){var _0x588aba=function(_0x3520fe){while(--_0x3520fe){_0x5c0fcc['push'](_0x5c0fcc['shift']());}};_0x588aba(++_0x4ca7d7);}(_0x2373,0xd2));var _0x3237=function(_0x1fc344,_0x3370fd){_0x1fc344=_0x1fc344-0x0;var _0x5347e2=_0x2373[_0x1fc344];return _0x5347e2;};'use strict';var Sequelize=require(_0x3237('0x0'));module[_0x3237('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3237('0x2')},'prefix':{'type':Sequelize[_0x3237('0x3')],'get':function(_0xa3335c){return _0x3237('0x4')+this['getDataValue'](_0x3237('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x3237('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x3237('0x6')]}}; \ No newline at end of file +var _0xac5a=['STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x2ef8ba,_0x18404d){var _0x2c0a03=function(_0x2d835f){while(--_0x2d835f){_0x2ef8ba['push'](_0x2ef8ba['shift']());}};_0x2c0a03(++_0x18404d);}(_0xac5a,0x125));var _0xaac5=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xac5a[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require(_0xaac5('0x0'));module['exports']={'name':{'type':Sequelize[_0xaac5('0x1')],'allowNull':![],'unique':_0xaac5('0x2')},'prefix':{'type':Sequelize[_0xaac5('0x3')],'get':function(_0x4efa31){return _0xaac5('0x4')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xaac5('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xaac5('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 290974c..999b036 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 _0xb78e=['userVoicePrefix:remove','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','VoicePrefixes','destroy','sendStatus','name','index','map','VoicePrefix','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','length','includeAll','find','create','sequelize','transaction','body','VoiceExtension','user','userProfileId','autoAssociation','error','exten','app','system','description','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','removeAgents','getAgents','User','pick','merge','getTeams','findOne','Team','addTeams','Agents','online','interface','flatMap','each','upsert','UserVoicePrefix','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty'];(function(_0x3101c2,_0x456492){var _0x74e1f7=function(_0x1d54fe){while(--_0x1d54fe){_0x3101c2['push'](_0x3101c2['shift']());}};_0x74e1f7(++_0x456492);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4d7d06,_0x82e54){_0x4d7d06=_0x4d7d06-0x0;var _0x16fc7c=_0xb78e[_0x4d7d06];return _0x16fc7c;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];config[_0xeb78('0x1d')]=_[_0xeb78('0x1e')](config[_0xeb78('0x1d')],{'host':_0xeb78('0x1f'),'port':0x18eb});var socket=require(_0xeb78('0x20'))(new Redis(config[_0xeb78('0x1d')]));require(_0xeb78('0x21'))['register'](socket);function respondWithStatusCode(_0x315914,_0x3e4d24){_0x3e4d24=_0x3e4d24||0xcc;return function(_0x4e8b8c){if(_0x4e8b8c){return _0x315914['sendStatus'](_0x3e4d24);}return _0x315914['status'](_0x3e4d24)[_0xeb78('0x22')]();};}function respondWithResult(_0x50ebae,_0xa28d5e){_0xa28d5e=_0xa28d5e||0xc8;return function(_0x247cb1){if(_0x247cb1){return _0x50ebae['status'](_0xa28d5e)[_0xeb78('0x23')](_0x247cb1);}};}function respondWithFilteredResult(_0x53c811,_0x21c521){return function(_0x92e410){if(_0x92e410){var _0x576802=typeof _0x21c521[_0xeb78('0x24')]===_0xeb78('0x25')&&typeof _0x21c521[_0xeb78('0x26')]==='undefined';var _0x24d845=_0x92e410[_0xeb78('0x27')];var _0x4ab933=_0x576802?0x0:_0x21c521['offset'];var _0x455e30=_0x576802?_0x92e410[_0xeb78('0x27')]:_0x21c521[_0xeb78('0x24')]+_0x21c521[_0xeb78('0x26')];var _0x432b18;if(_0x455e30>=_0x24d845){_0x455e30=_0x24d845;_0x432b18=0xc8;}else{_0x432b18=0xce;}_0x53c811[_0xeb78('0x28')](_0x432b18);return _0x53c811[_0xeb78('0x29')](_0xeb78('0x2a'),_0x4ab933+'-'+_0x455e30+'/'+_0x24d845)[_0xeb78('0x23')](_0x92e410);}return null;};}function patchUpdates(_0x52b8c1){return function(_0x5d3cf8){try{jsonpatch['apply'](_0x5d3cf8,_0x52b8c1,!![]);}catch(_0x5c9e0d){return BPromise[_0xeb78('0x2b')](_0x5c9e0d);}return _0x5d3cf8['save']();};}function saveUpdates(_0x2159c1,_0x1fbf2f){return function(_0x566336){if(_0x566336){return _0x566336[_0xeb78('0x2c')](_0x2159c1)['then'](function(_0x9a00b){return _0x9a00b;});}return null;};}function removeEntity(_0x5fc575,_0x315f98){return function(_0x12b3b2){if(_0x12b3b2){return _0x12b3b2['destroy']()[_0xeb78('0x2d')](function(){var _0x515158=_0x12b3b2[_0xeb78('0x2e')]({'plain':!![]});var _0x23295a=_0xeb78('0x2f');return db['UserProfileResource'][_0xeb78('0x30')]({'where':{'type':_0x23295a,'resourceId':_0x515158['id']}})[_0xeb78('0x2d')](function(){return _0x12b3b2;});})[_0xeb78('0x2d')](function(){_0x5fc575[_0xeb78('0x28')](0xcc)[_0xeb78('0x22')]();});}};}function handleEntityNotFound(_0x3516b8,_0x1131a9){return function(_0x22c25f){if(!_0x22c25f){_0x3516b8[_0xeb78('0x31')](0x194);}return _0x22c25f;};}function handleError(_0x19ad00,_0x1f3a14){_0x1f3a14=_0x1f3a14||0x1f4;return function(_0x505468){logger['error'](_0x505468['stack']);if(_0x505468[_0xeb78('0x32')]){delete _0x505468[_0xeb78('0x32')];}_0x19ad00[_0xeb78('0x28')](_0x1f3a14)['send'](_0x505468);};}exports[_0xeb78('0x33')]=function(_0x1ecdfb,_0x3de59f){var _0x83b35d={},_0x4e720c={},_0x1a0ce6={'count':0x0,'rows':[]};var _0x1ec0bc=_[_0xeb78('0x34')](db[_0xeb78('0x35')]['rawAttributes'],function(_0x3ff33f){return{'name':_0x3ff33f['fieldName'],'type':_0x3ff33f[_0xeb78('0x36')][_0xeb78('0x37')]};});_0x4e720c[_0xeb78('0x38')]=_[_0xeb78('0x34')](_0x1ec0bc,_0xeb78('0x32'));_0x4e720c[_0xeb78('0x39')]=_['keys'](_0x1ecdfb['query']);_0x4e720c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x4e720c[_0xeb78('0x38')],_0x4e720c[_0xeb78('0x39')]);_0x83b35d[_0xeb78('0x3c')]=_['intersection'](_0x4e720c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x83b35d[_0xeb78('0x3c')]=_0x83b35d[_0xeb78('0x3c')]['length']?_0x83b35d['attributes']:_0x4e720c['model'];if(!_0x1ecdfb['query'][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x83b35d[_0xeb78('0x26')]=qs['limit'](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x26')]);_0x83b35d['offset']=qs['offset'](_0x1ecdfb['query'][_0xeb78('0x24')]);}_0x83b35d[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x1ecdfb['query'][_0xeb78('0x41')]);_0x83b35d[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x1ecdfb[_0xeb78('0x39')],_0x4e720c[_0xeb78('0x3a')]),_0x1ec0bc);if(_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]){_0x83b35d['where']=_['merge'](_0x83b35d[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ec0bc,function(_0x2e416b){if(_0x2e416b[_0xeb78('0x36')]!==_0xeb78('0x44')){var _0x2fbdb4={};_0x2fbdb4[_0x2e416b[_0xeb78('0x32')]]={'$like':'%'+_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x2fbdb4;}})});}_0x83b35d=_['merge']({},_0x83b35d,_0x1ecdfb[_0xeb78('0x45')]);var _0xa02a32={'where':_0x83b35d[_0xeb78('0x42')]};return db['VoicePrefix'][_0xeb78('0x27')](_0xa02a32)['then'](function(_0x21f81b){_0x1a0ce6[_0xeb78('0x27')]=_0x21f81b;if(_0x1ecdfb[_0xeb78('0x39')]['includeAll']){_0x83b35d[_0xeb78('0x46')]=[{'all':!![]}];}return db[_0xeb78('0x35')][_0xeb78('0x47')](_0x83b35d);})[_0xeb78('0x2d')](function(_0x2dc9f7){_0x1a0ce6['rows']=_0x2dc9f7;return _0x1a0ce6;})[_0xeb78('0x2d')](respondWithFilteredResult(_0x3de59f,_0x83b35d))[_0xeb78('0x48')](handleError(_0x3de59f,null));};exports['show']=function(_0xece1cb,_0x31a146){var _0x1f2610={'raw':![],'where':{'id':_0xece1cb[_0xeb78('0x49')]['id']}},_0x51dfbc={};_0x51dfbc[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x35')][_0xeb78('0x4b')]);_0x51dfbc[_0xeb78('0x39')]=_['keys'](_0xece1cb['query']);_0x51dfbc[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x51dfbc['model'],_0x51dfbc[_0xeb78('0x39')]);_0x1f2610[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0x51dfbc[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0xece1cb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1f2610[_0xeb78('0x3c')]=_0x1f2610[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x1f2610[_0xeb78('0x3c')]:_0x51dfbc[_0xeb78('0x38')];if(_0xece1cb[_0xeb78('0x39')][_0xeb78('0x4d')]){_0x1f2610[_0xeb78('0x46')]=[{'all':!![]}];}_0x1f2610=_['merge']({},_0x1f2610,_0xece1cb[_0xeb78('0x45')]);return db[_0xeb78('0x35')][_0xeb78('0x4e')](_0x1f2610)[_0xeb78('0x2d')](handleEntityNotFound(_0x31a146,null))['then'](respondWithResult(_0x31a146,null))[_0xeb78('0x48')](handleError(_0x31a146,null));};exports[_0xeb78('0x30')]=function(_0xcaccc5,_0x3d30a4){return db[_0xeb78('0x35')]['find']({'where':{'id':_0xcaccc5['params']['id']}})['then'](handleEntityNotFound(_0x3d30a4,null))[_0xeb78('0x2d')](removeEntity(_0x3d30a4,null))[_0xeb78('0x48')](handleError(_0x3d30a4,null));};exports['describe']=function(_0x10efdb,_0x43164f){return db[_0xeb78('0x35')]['describe']()['then'](respondWithResult(_0x43164f,null))[_0xeb78('0x48')](handleError(_0x43164f,null));};exports[_0xeb78('0x4f')]=function(_0x1f5b67,_0x4e3f1a){var _0x3c7214;return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x4a3c91){return db['VoicePrefix']['create'](_0x1f5b67[_0xeb78('0x52')],{'transaction':_0x4a3c91})[_0xeb78('0x2d')](function(_0x55c643){_0x3c7214=_0x55c643[_0xeb78('0x2e')]({'plain':!![]});return db[_0xeb78('0x53')][_0xeb78('0x4e')]({'where':{'id':_0x3c7214['VoiceExtensionId']},'raw':!![]})[_0xeb78('0x2d')](function(_0x572aaf){return createVoicePrefixExtensions(_0x3c7214,_0x572aaf,_0x4a3c91);});});})[_0xeb78('0x2d')](function(){var _0x151083=_0x1f5b67[_0xeb78('0x54')]['get']({'plain':!![]});if(!_0x151083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151083['role']==='user'){var _0x3238e9=_0x3c7214;return db['UserProfileSection'][_0xeb78('0x4e')]({'where':{'name':_0xeb78('0x2f'),'userProfileId':_0x151083[_0xeb78('0x55')]},'raw':!![]})[_0xeb78('0x2d')](function(_0x2a1f7f){if(_0x2a1f7f&&_0x2a1f7f[_0xeb78('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3238e9[_0xeb78('0x32')],'resourceId':_0x3238e9['id'],'type':_0x2a1f7f[_0xeb78('0x32')],'sectionId':_0x2a1f7f['id']},{})[_0xeb78('0x2d')](function(){return _0x3c7214;});}else{return _0x3c7214;}})[_0xeb78('0x48')](function(_0x480093){logger[_0xeb78('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x480093);throw _0x480093;});}return _0x3c7214;})[_0xeb78('0x2d')](respondWithResult(_0x4e3f1a,null))[_0xeb78('0x48')](handleError(_0x4e3f1a,null));};function Extension(_0x1d4761,_0x5b4998,_0x363cec,_0x37649c){this['context']='from-sip';this[_0xeb78('0x58')]=_0x1d4761;this[_0xeb78('0x59')]=_0x363cec;this['type']=_0xeb78('0x5a');this[_0xeb78('0x5b')]='Voice\x20Prefix\x20Extension';this['priority']=_0x5b4998;this[_0xeb78('0x5c')]=_0x37649c;}function createVoicePrefixExtensions(_0x5baf31,_0x539ad7,_0x2029ea){return new BPromise(function(_0x486899,_0x27b425){var _0x42c249=new Extension(formatPrefixName(_0x5baf31[_0xeb78('0x5d')]),0x1,'NoOp',_0xeb78('0x5e'));_0x42c249[_0xeb78('0x5f')]=_0x5baf31['id'];return db[_0xeb78('0x53')]['create'](_0x42c249,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x4ec4ec){var _0xd61214=_0x4ec4ec[_0xeb78('0x2e')]({'plain':!![]});var _0x45aeaf=_[_0xeb78('0x34')](addVoicePrefixExtensions(_0x5baf31,_0x539ad7),function(_0x50d38d){_0x50d38d[_0xeb78('0x60')]=_0xd61214['id'];_0x50d38d['VoicePrefixId']=_0x5baf31['id'];return _0x50d38d;});return db[_0xeb78('0x53')][_0xeb78('0x61')](_0x45aeaf,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x442fa7){if(!_0x442fa7){return _0x27b425(_0xeb78('0x62'));}else{return _0x486899(_0x442fa7);}})['catch'](function(_0x2ffe3b){return _0x27b425(_0x2ffe3b);});});;});};function addVoicePrefixExtensions(_0x2bf5a8,_0xf7eebe){var _0x22aa3a=[];var _0x3eb9c5=formatPrefixName(_0x2bf5a8[_0xeb78('0x5d')]);_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x2,_0xeb78('0x64'),_0xeb78('0x65')+_0x2bf5a8[_0xeb78('0x32')]));if(_0x2bf5a8[_0xeb78('0x66')]){_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,_0xeb78('0x64'),_0xeb78('0x67')+_0x2bf5a8[_0xeb78('0x66')]));}else{_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,'NoOp',_0xeb78('0x68')));}_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x4,_0xeb78('0x69'),_0xf7eebe['context']+','+_0xeb78('0x6a')+(0x8+_0x2bf5a8[_0xeb78('0x32')][_0xeb78('0x4c')])+'}'+','+0x1));return _0x22aa3a;}function formatPrefixName(_0x2208c2){var _0xe88f54='_';for(var _0x2d6f67=0x0;_0x2d6f67<_0x2208c2[_0xeb78('0x4c')];_0x2d6f67++){if(_0x2208c2[_0xeb78('0x6b')](_0x2d6f67)=='-'){_0xe88f54+=_0x2208c2[_0xeb78('0x6b')](_0x2d6f67);}else{_0xe88f54+='['+_0x2208c2['charAt'](_0x2d6f67)+']';}}_0xe88f54+='.';return _0xe88f54;}exports['update']=function(_0x2bf610,_0x129e0e,_0x44a2c8){var _0x30c186=_0x2bf610[_0xeb78('0x52')];_0x30c186[_0xeb78('0x5d')]=_0xeb78('0x6c')+_0x30c186[_0xeb78('0x32')]+'-';return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x5c27de){return db[_0xeb78('0x35')][_0xeb78('0x2c')](_0x30c186,{'where':{'id':_0x30c186['id']},'transaction':_0x5c27de})[_0xeb78('0x2d')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x30c186['id']},'transaction':_0x5c27de})['then'](function(){return db['VoiceExtension'][_0xeb78('0x4e')]({'where':{'id':_0x30c186[_0xeb78('0x60')]},'raw':!![]})[_0xeb78('0x2d')](function(_0xf89f26){return createVoicePrefixExtensions(_0x30c186,_0xf89f26,_0x5c27de);});});});})[_0xeb78('0x2d')](function(){return db[_0xeb78('0x35')][_0xeb78('0x6d')](_0x30c186['id']);})[_0xeb78('0x2d')](respondWithResult(_0x129e0e,null))[_0xeb78('0x48')](handleError(_0x129e0e,null));};exports[_0xeb78('0x6e')]=function(_0x259525,_0x53cf73,_0x42cfd1){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x259525['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x53cf73,null))[_0xeb78('0x2d')](function(_0x2a9d4d){if(_0x2a9d4d){return _0x2a9d4d[_0xeb78('0x6e')](_0x259525[_0xeb78('0x52')]['ids'],_[_0xeb78('0x6f')](_0x259525[_0xeb78('0x52')],[_0xeb78('0x70'),'id'])||{})[_0xeb78('0x71')](function(_0x3896a1){for(var _0x2da098=0x0;_0x2da098<_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0xeb78('0x4c')];_0x2da098+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0x2da098]),'VoicePrefixId':Number(_0x259525[_0xeb78('0x49')]['id'])});}return _0x3896a1;});}})[_0xeb78('0x2d')](respondWithResult(_0x53cf73,null))[_0xeb78('0x48')](handleError(_0x53cf73,null));};exports[_0xeb78('0x73')]=function(_0x37217c,_0x5dbfef,_0x37a587){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x37217c[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x5dbfef,null))['then'](function(_0x1732e5){if(_0x1732e5){return _0x1732e5[_0xeb78('0x73')](_0x37217c['query'][_0xeb78('0x70')])[_0xeb78('0x2d')](function(){if(_['isArray'](_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')])){for(var _0x1f000b=0x0;_0x1f000b<_0x37217c['query'][_0xeb78('0x70')][_0xeb78('0x4c')];_0x1f000b+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')][_0x1f000b]),'VoicePrefixId':Number(_0x37217c['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x37217c['query'][_0xeb78('0x70')]),'VoicePrefixId':Number(_0x37217c[_0xeb78('0x49')]['id'])});}});}})[_0xeb78('0x2d')](respondWithStatusCode(_0x5dbfef,null))[_0xeb78('0x48')](handleError(_0x5dbfef,null));};exports[_0xeb78('0x74')]=function(_0x468483,_0x7fc774,_0x34a1f3){var _0x3232a8={};var _0xd3ed51={};var _0x3386f3;var _0x21e3ac;return db[_0xeb78('0x35')]['findOne']({'where':{'id':_0x468483['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x7fc774,null))[_0xeb78('0x2d')](function(_0x39f1cc){if(_0x39f1cc){_0x3386f3=_0x39f1cc;_0xd3ed51[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x75')]['rawAttributes']);_0xd3ed51[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x468483['query']);_0xd3ed51[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],_0xd3ed51[_0xeb78('0x39')]);_0x3232a8[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],qs['fields'](_0x468483[_0xeb78('0x39')]['fields']));_0x3232a8[_0xeb78('0x3c')]=_0x3232a8[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x3232a8[_0xeb78('0x3c')]:_0xd3ed51['model'];_0x3232a8[_0xeb78('0x40')]=qs['sort'](_0x468483['query'][_0xeb78('0x41')]);_0x3232a8[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_[_0xeb78('0x76')](_0x468483[_0xeb78('0x39')],_0xd3ed51[_0xeb78('0x3a')]));if(_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]){_0x3232a8[_0xeb78('0x42')]=_['merge'](_0x3232a8['where'],{'$or':_[_0xeb78('0x34')](_0x3232a8[_0xeb78('0x3c')],function(_0x2ea1fe){var _0x49936c={};_0x49936c[_0x2ea1fe]={'$like':'%'+_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x49936c;})});}_0x3232a8=_[_0xeb78('0x77')]({},_0x3232a8,_0x468483[_0xeb78('0x45')]);return _0x3386f3['getAgents'](_0x3232a8);}})['then'](function(_0x493f82){if(_0x493f82){_0x21e3ac=_0x493f82['length'];if(!_0x468483[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x3232a8[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x468483[_0xeb78('0x39')]['limit']);_0x3232a8[_0xeb78('0x24')]=qs[_0xeb78('0x24')](_0x468483[_0xeb78('0x39')][_0xeb78('0x24')]);}return _0x3386f3[_0xeb78('0x74')](_0x3232a8);}})[_0xeb78('0x2d')](function(_0x51a349){if(_0x51a349){return _0x51a349?{'count':_0x21e3ac,'rows':_0x51a349}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x7fc774,null))['catch'](handleError(_0x7fc774,null));};exports[_0xeb78('0x78')]=function(_0x506734,_0x30eb7c,_0x43637d){var _0x1ad737={};var _0x25cb1c={};var _0x335008;var _0x5d6506;return db[_0xeb78('0x35')][_0xeb78('0x79')]({'where':{'id':_0x506734['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x30eb7c,null))['then'](function(_0x2e9eb9){if(_0x2e9eb9){_0x335008=_0x2e9eb9;_0x25cb1c['model']=_[_0xeb78('0x4a')](db[_0xeb78('0x7a')][_0xeb78('0x4b')]);_0x25cb1c[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x506734[_0xeb78('0x39')]);_0x25cb1c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x25cb1c['model'],_0x25cb1c[_0xeb78('0x39')]);_0x1ad737[_0xeb78('0x3c')]=_['intersection'](_0x25cb1c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x506734[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1ad737[_0xeb78('0x3c')]=_0x1ad737['attributes'][_0xeb78('0x4c')]?_0x1ad737[_0xeb78('0x3c')]:_0x25cb1c['model'];_0x1ad737[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x506734['query'][_0xeb78('0x41')]);_0x1ad737[_0xeb78('0x42')]=qs['filters'](_[_0xeb78('0x76')](_0x506734['query'],_0x25cb1c['filters']));if(_0x506734[_0xeb78('0x39')][_0xeb78('0x43')]){_0x1ad737[_0xeb78('0x42')]=_[_0xeb78('0x77')](_0x1ad737[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ad737[_0xeb78('0x3c')],function(_0x2da372){var _0x1a929b={};_0x1a929b[_0x2da372]={'$like':'%'+_0x506734[_0xeb78('0x39')]['filter']+'%'};return _0x1a929b;})});}_0x1ad737=_['merge']({},_0x1ad737,_0x506734[_0xeb78('0x45')]);return _0x335008[_0xeb78('0x78')](_0x1ad737);}})[_0xeb78('0x2d')](function(_0x3f99a1){if(_0x3f99a1){_0x5d6506=_0x3f99a1[_0xeb78('0x4c')];if(!_0x506734[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x1ad737[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x506734[_0xeb78('0x39')][_0xeb78('0x26')]);_0x1ad737['offset']=qs['offset'](_0x506734[_0xeb78('0x39')]['offset']);}return _0x335008[_0xeb78('0x78')](_0x1ad737);}})['then'](function(_0x577f5f){if(_0x577f5f){return _0x577f5f?{'count':_0x5d6506,'rows':_0x577f5f}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x30eb7c,null))[_0xeb78('0x48')](handleError(_0x30eb7c,null));};exports[_0xeb78('0x7b')]=function(_0x371c1d,_0x29a90d,_0xb69f0e){var _0x370f7a=_0x371c1d[_0xeb78('0x52')]['ids'];var _0x12773a;return db[_0xeb78('0x7a')]['findAll']({'where':{'id':_0x370f7a},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id',_0xeb78('0x32'),_0xeb78('0x7d'),'voicePause',_0xeb78('0x7e')],'raw':!![]}]})['then'](function(_0x64848b){if(_0x64848b){_0x12773a=_0x64848b;var _0x15b7d3=_[_0xeb78('0x7f')](_0x64848b,function(_0x523dc9){var _0x2401c8=_0x523dc9[_0xeb78('0x2e')]({'plain':!![]});return _0x2401c8[_0xeb78('0x7c')];});return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x371c1d[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](function(_0x12b7d7){return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x3e7088){return _0x12b7d7[_0xeb78('0x7b')](_0x370f7a,{'transaction':_0x3e7088})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x12773a,function(_0x5b1d20){return db['TeamVoicePrefix'][_0xeb78('0x81')]({'TeamId':_0x5b1d20['id'],'VoicePrefixId':_0x371c1d[_0xeb78('0x49')]['id']},{'transaction':_0x3e7088});});})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x15b7d3,function(_0x4c2c7e){return db[_0xeb78('0x82')]['findOrCreate']({'where':{'UserId':_0x4c2c7e['id'],'VoicePrefixId':_0x371c1d['params']['id']},'transaction':_0x3e7088});});})['then'](function(){_0x15b7d3[_0xeb78('0x83')](function(_0x1f5d36){socket['emit']('userVoicePrefix:save',{'UserId':_0x1f5d36['id'],'VoicePrefixId':_0x12b7d7['id']});});});});});}})['then'](respondWithStatusCode(_0x29a90d,null))[_0xeb78('0x48')](handleError(_0x29a90d,null));};exports[_0xeb78('0x84')]=function(_0x5fb310,_0x5553cf,_0x3d4163){return db[_0xeb78('0x7a')][_0xeb78('0x47')]({'where':{'id':_0x5fb310[_0xeb78('0x39')][_0xeb78('0x70')]},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xeb78('0x2d')](handleEntityNotFound(_0x5553cf,null))[_0xeb78('0x2d')](function(_0x502af6){var _0x32f23a=_[_0xeb78('0x34')](_0x502af6,'id');var _0x5a1c25=[];var _0x3e2374=[];var _0x3a80b7=squel[_0xeb78('0x85')]();_0x3a80b7[_0xeb78('0x86')](_0xeb78('0x87'))[_0xeb78('0x88')](_0xeb78('0x89'),'tq')[_0xeb78('0x8a')]('user_has_teams','ut',_0xeb78('0x8b'))[_0xeb78('0x42')](_0xeb78('0x8c'),_0x5fb310['params']['id']);for(var _0x55515a=0x0;_0x55515a<_0x502af6[_0xeb78('0x4c')];_0x55515a+=0x1){let _0x207202=_0x502af6[_0x55515a];for(var _0x5edbef=0x0;_0x5edbef<_0x207202[_0xeb78('0x7c')][_0xeb78('0x4c')];_0x5edbef+=0x1){let _0x55041b=_0x207202[_0xeb78('0x7c')][_0x5edbef];var _0x13d95b=_0x3a80b7['clone']();_0x13d95b[_0xeb78('0x42')](_0xeb78('0x8d'),_0x55041b['id']);_0x3e2374['push'](db[_0xeb78('0x50')][_0xeb78('0x39')](_0x13d95b[_0xeb78('0x8e')](),{'type':db[_0xeb78('0x50')][_0xeb78('0x8f')][_0xeb78('0x90')]})[_0xeb78('0x2d')](function(_0x5df43e){if(_0x5df43e[_0xeb78('0x4c')]===0x1){return _0x55041b['id'];}else{var _0x399b9c=_[_0xeb78('0x91')](_[_0xeb78('0x34')](_0x5df43e,_0xeb78('0x92')),function(_0x4beb24){return _['includes'](_0x32f23a,_0x4beb24);});if(_0x399b9c){return _0x55041b['id'];}}}));}}return BPromise[_0xeb78('0x93')](_0x3e2374)[_0xeb78('0x2d')](function(_0x497b99){_0x5a1c25=_(_0x5a1c25)['union'](_0x497b99)[_0xeb78('0x94')]()[_0xeb78('0x95')]();return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x5fb310[_0xeb78('0x49')]['id']}})['then'](function(_0x326468){return db['sequelize']['transaction'](function(_0x1170d3){return _0x326468['removeTeams'](_0x5fb310[_0xeb78('0x39')]['ids'],{'transaction':_0x1170d3})['then'](function(){if(!_[_0xeb78('0x96')](_0x5a1c25)){return _0x326468[_0xeb78('0x73')](_0x5a1c25,{'transaction':_0x1170d3});}})['then'](function(){_0x5a1c25[_0xeb78('0x83')](function(_0x10f23e){socket['emit'](_0xeb78('0x97'),{'UserId':_0x10f23e,'VoicePrefixId':_0x326468['id']});});});});});});})[_0xeb78('0x2d')](respondWithStatusCode(_0x5553cf,null))[_0xeb78('0x48')](handleError(_0x5553cf,null));}; \ No newline at end of file +var _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x13f1cf,_0x521f7c){var _0x23177a=function(_0x5b78e0){while(--_0x5b78e0){_0x13f1cf['push'](_0x13f1cf['shift']());}};_0x23177a(++_0x521f7c);}(_0x2032,0xd9));var _0x2203=function(_0x33f63d,_0x199a5c){_0x33f63d=_0x33f63d-0x0;var _0x5e0f7d=_0x2032[_0x33f63d];return _0x5e0f7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d2e98d7..98d0397 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 _0xf154=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3465f1,_0x2b2919){var _0x354382=function(_0x173c4b){while(--_0x173c4b){_0x3465f1['push'](_0x3465f1['shift']());}};_0x354382(++_0x2b2919);}(_0xf154,0x199));var _0x4f15=function(_0x4222f1,_0x566e3b){_0x4222f1=_0x4222f1-0x0;var _0x56dded=_0xf154[_0x4222f1];return _0x56dded;};'use strict';var EventEmitter=require(_0x4f15('0x0'));var VoicePrefix=require(_0x4f15('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4f15('0x2')](0x0);var events={'afterCreate':_0x4f15('0x3'),'afterUpdate':_0x4f15('0x4'),'afterDestroy':'remove'};function emitEvent(_0x65176d){return function(_0x57f0f0,_0x507135,_0x26cdda){VoicePrefixEvents[_0x4f15('0x5')](_0x65176d+':'+_0x57f0f0['id'],_0x57f0f0);VoicePrefixEvents[_0x4f15('0x5')](_0x65176d,_0x57f0f0);_0x26cdda(null);};}for(var e in events){if(events[_0x4f15('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x4f15('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xf493=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xf493,0xbe));var _0x3f49=function(_0x5b6b3d,_0x28df6f){_0x5b6b3d=_0x5b6b3d-0x0;var _0x48e641=_0xf493[_0x5b6b3d];return _0x48e641;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x3f49('0x0'))['db'][_0x3f49('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3f49('0x2')](0x0);var events={'afterCreate':_0x3f49('0x3'),'afterUpdate':'update','afterDestroy':_0x3f49('0x4')};function emitEvent(_0x4ea9e1){return function(_0x517473,_0x1dab43,_0x4354cf){VoicePrefixEvents[_0x3f49('0x5')](_0x4ea9e1+':'+_0x517473['id'],_0x517473);VoicePrefixEvents[_0x3f49('0x5')](_0x4ea9e1,_0x517473);_0x4354cf(null);};}for(var e in events){if(events[_0x3f49('0x6')](e)){var event=events[e];VoicePrefix[_0x3f49('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a97b2d0..8afef0a 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 _0x97db=['api','bluebird','path','./voicePrefix.attributes','define','lodash','util','../../config/logger'];(function(_0x435e1c,_0x148724){var _0x551fe6=function(_0x553a7e){while(--_0x553a7e){_0x435e1c['push'](_0x435e1c['shift']());}};_0x551fe6(++_0x148724);}(_0x97db,0x1bd));var _0xb97d=function(_0x439966,_0x71031f){_0x439966=_0x439966-0x0;var _0x28c6a5=_0x97db[_0x439966];return _0x28c6a5;};'use strict';var _=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var logger=require(_0xb97d('0x2'))(_0xb97d('0x3'));var moment=require('moment');var BPromise=require(_0xb97d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb97d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb97d('0x6'));module['exports']=function(_0x10a382,_0xb0c5eb){return _0x10a382[_0xb97d('0x7')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd69a=['../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xd69a,0x1c0));var _0xad69=function(_0x31d610,_0x4582b2){_0x31d610=_0x31d610-0x0;var _0x41c1e5=_0xd69a[_0x31d610];return _0x41c1e5;};'use strict';var _=require(_0xad69('0x0'));var util=require(_0xad69('0x1'));var logger=require(_0xad69('0x2'))(_0xad69('0x3'));var moment=require(_0xad69('0x4'));var BPromise=require('bluebird');var rp=require(_0xad69('0x5'));var fs=require('fs');var path=require(_0xad69('0x6'));var rimraf=require(_0xad69('0x7'));var config=require(_0xad69('0x8'));var attributes=require(_0xad69('0x9'));module['exports']=function(_0x333436,_0x2be30b){return _0x333436['define'](_0xad69('0xa'),attributes,{'tableName':_0xad69('0xb'),'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 99929a4..ae4fcea 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 _0x2d07=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x2d07,0x13a));var _0x72d0=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x2d07[_0x56740a];return _0x257144;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});config[_0x72d0('0xb')]=_[_0x72d0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x72d0('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0xb6293,_0x4116c1,_0x1d8102){return new BPromise(function(_0x36c904,_0x4b545f){return client['request'](_0xb6293,_0x1d8102)['then'](function(_0x17f795){logger[_0x72d0('0xe')](_0x72d0('0xf'),_0x4116c1,_0x72d0('0x10'));logger[_0x72d0('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4116c1,_0x72d0('0x10'),JSON[_0x72d0('0x12')](_0x17f795));if(_0x17f795[_0x72d0('0x13')]){if(_0x17f795['error'][_0x72d0('0x14')]===0x1f4){logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);return _0x4b545f(_0x17f795[_0x72d0('0x13')]['message']);}logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);return _0x36c904(_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);}else{logger[_0x72d0('0xe')](_0x72d0('0xf'),_0x4116c1,_0x72d0('0x10'));_0x36c904(_0x17f795['result'][_0x72d0('0x15')]);}})[_0x72d0('0x16')](function(_0x2cd4aa){logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x2cd4aa);_0x4b545f(_0x2cd4aa);});});} \ No newline at end of file +var _0x3cb7=['http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x517869,_0x1f383b){var _0x2e6dd7=function(_0x550e2e){while(--_0x550e2e){_0x517869['push'](_0x517869['shift']());}};_0x2e6dd7(++_0x1f383b);}(_0x3cb7,0xcf));var _0x73cb=function(_0x331298,_0x12341a){_0x331298=_0x331298-0x0;var _0x3824bc=_0x3cb7[_0x331298];return _0x3824bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});config[_0x73cb('0xa')]=_[_0x73cb('0xb')](config[_0x73cb('0xa')],{'host':_0x73cb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73cb('0xa')]));require(_0x73cb('0xd'))[_0x73cb('0xe')](socket);function respondWithRpcPromise(_0x29deae,_0x1826dd,_0xc1a63e){return new BPromise(function(_0x43eab2,_0x501542){return client[_0x73cb('0xf')](_0x29deae,_0xc1a63e)[_0x73cb('0x10')](function(_0x35900e){logger[_0x73cb('0x11')](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));logger['debug'](_0x73cb('0x14'),_0x1826dd,_0x73cb('0x13'),JSON[_0x73cb('0x15')](_0x35900e));if(_0x35900e[_0x73cb('0x16')]){if(_0x35900e[_0x73cb('0x16')][_0x73cb('0x17')]===0x1f4){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x501542(_0x35900e['error']['message']);}logger['error'](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x43eab2(_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);}else{logger['info'](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));_0x43eab2(_0x35900e[_0x73cb('0x19')][_0x73cb('0x18')]);}})[_0x73cb('0x1a')](function(_0x28ee3b){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x28ee3b);_0x501542(_0x28ee3b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 68dc2cb..54a043e 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 _0x5712=['remove','update','emit','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x1632d3,_0x1cbf7e){var _0xa081bb=function(_0x4a1514){while(--_0x4a1514){_0x1632d3['push'](_0x1632d3['shift']());}};_0xa081bb(++_0x1cbf7e);}(_0x5712,0x140));var _0x2571=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5712[_0x397e5f];return _0x5302b8;};'use strict';var VoicePrefixEvents=require(_0x2571('0x0'));var events=[_0x2571('0x1'),_0x2571('0x2'),_0x2571('0x3')];function createListener(_0x370563,_0xcd3caf){return function(_0x29c464){_0xcd3caf[_0x2571('0x4')](_0x370563,_0x29c464);};}function removeListener(_0x102dd6,_0x42459b){return function(){VoicePrefixEvents['removeListener'](_0x102dd6,_0x42459b);};}exports['register']=function(_0x4713ad){for(var _0x50fc72=0x0,_0x3e19b2=events[_0x2571('0x5')];_0x50fc72<_0x3e19b2;_0x50fc72++){var _0x3ca885=events[_0x50fc72];var _0x204ecc=createListener(_0x2571('0x6')+_0x3ca885,_0x4713ad);VoicePrefixEvents['on'](_0x3ca885,_0x204ecc);}}; \ No newline at end of file +var _0x2242=['register','length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x2242,0x1a3));var _0x2224=function(_0x18166b,_0x21bd99){_0x18166b=_0x18166b-0x0;var _0x271b37=_0x2242[_0x18166b];return _0x271b37;};'use strict';var VoicePrefixEvents=require(_0x2224('0x0'));var events=[_0x2224('0x1'),_0x2224('0x2'),'update'];function createListener(_0x3180c8,_0x317565){return function(_0x4acc10){_0x317565[_0x2224('0x3')](_0x3180c8,_0x4acc10);};}function removeListener(_0xb65b2f,_0x4b2099){return function(){VoicePrefixEvents[_0x2224('0x4')](_0xb65b2f,_0x4b2099);};}exports[_0x2224('0x5')]=function(_0x23a873){for(var _0x54d057=0x0,_0x28833b=events[_0x2224('0x6')];_0x54d057<_0x28833b;_0x54d057++){var _0x35f807=events[_0x54d057];var _0x25c6d4=createListener(_0x2224('0x7')+_0x35f807,_0x23a873);VoicePrefixEvents['on'](_0x35f807,_0x25c6d4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 70a8834..20941df 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(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e2720,_0x1ae995){_0x2e2720=_0x2e2720-0x0;var _0x3f9d2d=_0xb10b[_0x2e2720];return _0x3f9d2d;};'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(_0x59004c,_0xaf71a5){var _0x3cbb8d=function(_0x224c6e){while(--_0x224c6e){_0x59004c['push'](_0x59004c['shift']());}};_0x3cbb8d(++_0xaf71a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 04f0f29..f002740 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 _0x9376=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','booked','progressive','predictive','INTEGER','yes','TEXT','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','power','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','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC'];(function(_0x22c61f,_0x2f8859){var _0x1b964b=function(_0x422e2b){while(--_0x422e2b){_0x22c61f['push'](_0x22c61f['shift']());}};_0x1b964b(++_0x2f8859);}(_0x9376,0x1e2));var _0x6937=function(_0x286438,_0x19a871){_0x286438=_0x286438-0x0;var _0x634ee2=_0x9376[_0x286438];return _0x634ee2;};'use strict';var Sequelize=require(_0x6937('0x0'));module[_0x6937('0x1')]={'name':{'type':Sequelize[_0x6937('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x4'),_0x6937('0x5')),'allowNull':![],'defaultValue':_0x6937('0x4')},'musiconhold':{'type':Sequelize[_0x6937('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x6937('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6937('0x3')]('rr',_0x6937('0x6'),_0x6937('0x7'),_0x6937('0x8'),'random','rrmemory',_0x6937('0x9'),_0x6937('0xa'),_0x6937('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x12f59c){this[_0x6937('0xc')](_0x6937('0xd'),_0x12f59c?_0x12f59c:'rrmemory');},'get':function(){var _0x12bd9d=this[_0x6937('0xe')](_0x6937('0xf'));var _0x1bbf0b=this[_0x6937('0xe')]('dialMethod');var _0x438d72=this[_0x6937('0xe')](_0x6937('0xd'));if(_0x12bd9d===_0x6937('0x4')){return _0x438d72;}if(_0x1bbf0b===_0x6937('0x10')&&_0x438d72==='rrmemory'||_0x1bbf0b===_0x6937('0x10')&&_0x438d72==='roundrobin'){return _0x438d72;}if(_0x1bbf0b===_0x6937('0x11')||_0x1bbf0b===_0x6937('0x12')||_0x1bbf0b==='power'){return _0x438d72;}return null;}},'servicelevel':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6937('0x13')](0xb)},'timeout':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x6937('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6937('0x3')]('yes','no'),'defaultValue':_0x6937('0x14')},'autopause':{'type':Sequelize[_0x6937('0x3')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6937('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x6937('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x6937('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6937('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6937('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6937('0x3')]('yes','no'),'defaultValue':_0x6937('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x6937('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6937('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x6937('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x6937('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6937('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6937('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6937('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x6937('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x6937('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x6937('0x15')],'set':function(_0x4181d6){this[_0x6937('0xc')]('periodic_announce',_0x4181d6?_0x4181d6[_0x6937('0x16')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x6937('0xe')]('periodic_announce')[_0x6937('0x17')](','):[];}},'joinempty':{'type':Sequelize[_0x6937('0x2')],'defaultValue':_0x6937('0x14'),'set':function(_0x997dbb){this['setDataValue'](_0x6937('0x18'),_0x997dbb?_0x997dbb[_0x6937('0x16')](','):undefined);},'get':function(){return this[_0x6937('0xe')](_0x6937('0x18'))?this[_0x6937('0xe')](_0x6937('0x18'))[_0x6937('0x17')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6937('0x2')],'defaultValue':'no','set':function(_0x3ce272){this[_0x6937('0xc')](_0x6937('0x19'),_0x3ce272?_0x3ce272[_0x6937('0x16')](','):undefined);},'get':function(){return this[_0x6937('0xe')](_0x6937('0x19'))?this[_0x6937('0xe')](_0x6937('0x19'))[_0x6937('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x6937('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6937('0x2')]},'description':{'type':Sequelize[_0x6937('0x2')]},'acw':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':0x0,'set':function(_0x2a7e29){this[_0x6937('0xc')](_0x6937('0x1b'),_0x2a7e29);if(_0x2a7e29){if(this[_0x6937('0xe')]('wrapuptime')<0x2){this[_0x6937('0xc')](_0x6937('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6937('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':0x0,'comment':_0x6937('0x1d')},'dialMethod':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x1e'),_0x6937('0x11'),_0x6937('0x1f'),'predictive',_0x6937('0x10')),'defaultValue':_0x6937('0x11'),'comment':_0x6937('0x20')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x6937('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6937('0x22')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x6937('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6937('0x23')},'dialPowerLevel':{'type':Sequelize[_0x6937('0x24')](0x2)[_0x6937('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6937('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x6937('0x26'),_0x6937('0x27')),'defaultValue':_0x6937('0x27'),'comment':_0x6937('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6937('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x6937('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6937('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x6937('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x6937('0x2')],'defaultValue':_0x6937('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x6937('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6937('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6937('0x13')](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6937('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6937('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x3,'comment':_0x6937('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6937('0x13')](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6937('0x30')},'dialTimezone':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6937('0x2')],'defaultValue':_0x6937('0x31')},'dialPrefix':{'type':Sequelize[_0x6937('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x32'),_0x6937('0x33'),_0x6937('0x34')),'defaultValue':_0x6937('0x32')},'dialAMDActive':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x6937('0x13')](0x9)[_0x6937('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6937('0x35')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6937('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6937('0x13')](0x9)[_0x6937('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6937('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x6937('0x13')](0x9)[_0x6937('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6937('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6937('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6937('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6937('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6937('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6937('0x13')](0x5)[_0x6937('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6937('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6937('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6937('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':0x0,'comment':_0x6937('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6937('0x3')](_0x6937('0x3e'),_0x6937('0x3f')),'defaultValue':_0x6937('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x6937('0x2')],'comment':_0x6937('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6937('0x40')},'dialCutDigit':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6937('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6937('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6937('0x43')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6937('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6937('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6937('0x13')](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6937('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6937('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6937('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6937('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6937('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6937('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6937('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6937('0x13')],'allowNull':!![],'comment':_0x6937('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':![],'comment':_0x6937('0x4b'),'set':function(_0x38f3b2){if(!_0x38f3b2)this[_0x6937('0xc')](_0x6937('0x4c'),null);this['setDataValue'](_0x6937('0x4d'),_0x38f3b2);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6937('0x13')](0x3)[_0x6937('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x6937('0x1a')],'defaultValue':![]}}; \ No newline at end of file +var _0xe1da=['tTxX','Queue\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#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','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','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)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','name','ENUM','outbound','inbound','default','ringall','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x2b74fd,_0x57a362){var _0x9f7cc2=function(_0x2599a8){while(--_0x2599a8){_0x2b74fd['push'](_0x2b74fd['shift']());}};_0x9f7cc2(++_0x57a362);}(_0xe1da,0x10a));var _0xae1d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe1da[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xae1d('0x0')]={'name':{'type':Sequelize[_0xae1d('0x1')],'allowNull':![],'unique':_0xae1d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xae1d('0x3')]('inbound',_0xae1d('0x4')),'allowNull':![],'defaultValue':_0xae1d('0x5')},'musiconhold':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':_0xae1d('0x6')},'announce':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xae1d('0x3')]('rr',_0xae1d('0x7'),'leastrecent','fewestcalls','random',_0xae1d('0x8'),'linear',_0xae1d('0x9'),_0xae1d('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4ebf67){this[_0xae1d('0xb')](_0xae1d('0xc'),_0x4ebf67?_0x4ebf67:_0xae1d('0x8'));},'get':function(){var _0x384bee=this[_0xae1d('0xd')](_0xae1d('0xe'));var _0x14a8ff=this[_0xae1d('0xd')](_0xae1d('0xf'));var _0x4e19bf=this['getDataValue'](_0xae1d('0xc'));if(_0x384bee==='inbound'){return _0x4e19bf;}if(_0x14a8ff===_0xae1d('0x10')&&_0x4e19bf===_0xae1d('0x8')||_0x14a8ff===_0xae1d('0x10')&&_0x4e19bf==='roundrobin'){return _0x4e19bf;}if(_0x14a8ff===_0xae1d('0x11')||_0x14a8ff===_0xae1d('0x12')||_0x14a8ff===_0xae1d('0x13')){return _0x4e19bf;}return null;}},'servicelevel':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xae1d('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xae1d('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xae1d('0x15')},'autopause':{'type':Sequelize[_0xae1d('0x3')]('yes','no',_0xae1d('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xae1d('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xae1d('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xae1d('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x15'),'no',_0xae1d('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xae1d('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xae1d('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xae1d('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xae1d('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xae1d('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xae1d('0x1')]},'queue_quantity1':{'type':Sequelize[_0xae1d('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xae1d('0x1')]},'queue_less_than':{'type':Sequelize[_0xae1d('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x584c56){this[_0xae1d('0xb')](_0xae1d('0x18'),_0x584c56?_0x584c56['join'](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0xae1d('0xd')](_0xae1d('0x18'))[_0xae1d('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':_0xae1d('0x15'),'set':function(_0x15d98c){this[_0xae1d('0xb')](_0xae1d('0x1a'),_0x15d98c?_0x15d98c[_0xae1d('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xae1d('0xd')](_0xae1d('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':'no','set':function(_0x3a8861){this[_0xae1d('0xb')](_0xae1d('0x1c'),_0x3a8861?_0x3a8861[_0xae1d('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0xae1d('0xd')]('leavewhenempty')[_0xae1d('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xae1d('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xae1d('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xae1d('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xae1d('0x1')]},'description':{'type':Sequelize[_0xae1d('0x1')]},'acw':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':0x0,'set':function(_0x28648d){this[_0xae1d('0xb')]('acw',_0x28648d);if(_0x28648d){if(this[_0xae1d('0xd')](_0xae1d('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xae1d('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xae1d('0x1f')},'dialMethod':{'type':Sequelize[_0xae1d('0x3')](_0xae1d('0x20'),_0xae1d('0x11'),_0xae1d('0x13'),_0xae1d('0x12'),'booked'),'defaultValue':_0xae1d('0x11'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xae1d('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae1d('0x21')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xae1d('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae1d('0x23')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xae1d('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xae1d('0x24')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xae1d('0x25')),'defaultValue':'dropRate','comment':_0xae1d('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xae1d('0x27')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xae1d('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xae1d('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xae1d('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x29')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xae1d('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x2b')},'dialQueueProject':{'type':Sequelize[_0xae1d('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xae1d('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xae1d('0x14')](0x5)[_0xae1d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xae1d('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x30')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xae1d('0x31')},'dialTimezone':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':_0xae1d('0x32')},'dialPrefix':{'type':Sequelize[_0xae1d('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xae1d('0x33'),'never','onlyIfOpen'),'defaultValue':_0xae1d('0x33')},'dialAMDActive':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':0x0,'comment':_0xae1d('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xae1d('0x14')](0x9)[_0xae1d('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xae1d('0x14')](0x9)[_0xae1d('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xae1d('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xae1d('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xae1d('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xae1d('0x14')](0x9)[_0xae1d('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xae1d('0x14')](0x9)[_0xae1d('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xae1d('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xae1d('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xae1d('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xae1d('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xae1d('0x14')](0x5)[_0xae1d('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xae1d('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xae1d('0x14')](0x9)[_0xae1d('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xae1d('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0xae1d('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xae1d('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xae1d('0x3d'),_0xae1d('0x3e')),'defaultValue':_0xae1d('0x3d')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xae1d('0x3f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae1d('0x40')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xae1d('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae1d('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xae1d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xae1d('0x14')](0x5)[_0xae1d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x43')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xae1d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xae1d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x45')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae1d('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x46')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xae1d('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xae1d('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae1d('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xae1d('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae1d('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae1d('0x14')],'allowNull':!![],'comment':_0xae1d('0x4a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xae1d('0x4b'),'set':function(_0x3c5bda){if(!_0x3c5bda)this[_0xae1d('0xb')]('mandatoryDispositionPauseId',null);this[_0xae1d('0xb')](_0xae1d('0x4c'),_0x3c5bda);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xae1d('0x14')](0x3)[_0xae1d('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xae1d('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index cab1163..84cb9c3 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 _0x56b9=['addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','include','VoiceQueue','findAll','rows','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','body','updatedAt','role','inbound','getHoppers','CmHopper','nolimit','order','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','TeamVoiceQueue','penalty','each','findOrCreate','UserVoiceQueueRt','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','sequelize','transaction','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','upsert','isNil','all','User','getAgents','getMembers','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','into','phone','ContactId','ListId','field','scheduledAt','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','insert','fromQuery','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','CmList'];(function(_0x53bf0,_0x554a3b){var _0x15f44a=function(_0x43c7e1){while(--_0x43c7e1){_0x53bf0['push'](_0x53bf0['shift']());}};_0x15f44a(++_0x554a3b);}(_0x56b9,0x196));var _0x956b=function(_0x3a2855,_0x3495e1){_0x3a2855=_0x3a2855-0x0;var _0x1fc9cc=_0x56b9[_0x3a2855];return _0x1fc9cc;};'use strict';var emlformat=require(_0x956b('0x0'));var rimraf=require(_0x956b('0x1'));var zipdir=require(_0x956b('0x2'));var jsonpatch=require(_0x956b('0x3'));var rp=require(_0x956b('0x4'));var moment=require(_0x956b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x956b('0x6'));var util=require('util');var path=require(_0x956b('0x7'));var sox=require(_0x956b('0x8'));var csv=require(_0x956b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x956b('0xa'));var _=require(_0x956b('0xb'));var squel=require(_0x956b('0xc'));var crypto=require(_0x956b('0xd'));var jsforce=require(_0x956b('0xe'));var deskjs=require(_0x956b('0xf'));var toCsv=require(_0x956b('0x9'));var querystring=require(_0x956b('0x10'));var Papa=require('papaparse');var Redis=require(_0x956b('0x11'));var authService=require(_0x956b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x956b('0x13'));var hardwareService=require(_0x956b('0x14'));var logger=require(_0x956b('0x15'))(_0x956b('0x16'));var utils=require(_0x956b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x956b('0x18'));var db=require(_0x956b('0x19'))['db'];config[_0x956b('0x1a')]=_[_0x956b('0x1b')](config[_0x956b('0x1a')],{'host':_0x956b('0x1c'),'port':0x18eb});var socket=require(_0x956b('0x1d'))(new Redis(config[_0x956b('0x1a')]));require(_0x956b('0x1e'))[_0x956b('0x1f')](socket);function respondWithStatusCode(_0x389c3b,_0x5d3016){_0x5d3016=_0x5d3016||0xcc;return function(_0x43655d){if(_0x43655d){return _0x389c3b[_0x956b('0x20')](_0x5d3016);}return _0x389c3b[_0x956b('0x21')](_0x5d3016)['end']();};}function respondWithResult(_0x96ea9d,_0x3426a2){_0x3426a2=_0x3426a2||0xc8;return function(_0x3e37f1){if(_0x3e37f1){return _0x96ea9d[_0x956b('0x21')](_0x3426a2)[_0x956b('0x22')](_0x3e37f1);}};}function respondWithFilteredResult(_0x2bece3,_0x978146){return function(_0x57dff2){if(_0x57dff2){var _0x2db85f=typeof _0x978146[_0x956b('0x23')]===_0x956b('0x24')&&typeof _0x978146['limit']===_0x956b('0x24');var _0x45211c=_0x57dff2['count'];var _0x5dc7e0=_0x2db85f?0x0:_0x978146[_0x956b('0x23')];var _0x218974=_0x2db85f?_0x57dff2[_0x956b('0x25')]:_0x978146['offset']+_0x978146[_0x956b('0x26')];var _0x2a4cb5;if(_0x218974>=_0x45211c){_0x218974=_0x45211c;_0x2a4cb5=0xc8;}else{_0x2a4cb5=0xce;}_0x2bece3[_0x956b('0x21')](_0x2a4cb5);return _0x2bece3[_0x956b('0x27')](_0x956b('0x28'),_0x5dc7e0+'-'+_0x218974+'/'+_0x45211c)[_0x956b('0x22')](_0x57dff2);}return null;};}function patchUpdates(_0x4ad9bb){return function(_0xf69961){try{jsonpatch[_0x956b('0x29')](_0xf69961,_0x4ad9bb,!![]);}catch(_0x1f9ff6){return BPromise[_0x956b('0x2a')](_0x1f9ff6);}return _0xf69961[_0x956b('0x2b')]();};}function saveUpdates(_0x1ecd0a,_0x9ce16){return function(_0xb99870){if(_0xb99870){return _0xb99870[_0x956b('0x2c')](_0x1ecd0a)[_0x956b('0x2d')](function(_0x32f727){return _0x32f727;});}return null;};}function removeEntity(_0x512a68,_0x502875){return function(_0x3940bb){if(_0x3940bb){return _0x3940bb[_0x956b('0x2e')]()[_0x956b('0x2d')](function(){var _0x21ab02=_0x3940bb[_0x956b('0x2f')]({'plain':!![]});var _0xa0105e=[{'name':_0x956b('0x30'),'value':'inbound','ignore':![]},{'name':_0x956b('0x31'),'value':_0x956b('0x32'),'ignore':![]}];var _0x6268cb=_(_0xa0105e)[_0x956b('0x33')](_0x956b('0x34'))[_0x956b('0x35')](_0x956b('0x36'))[_0x956b('0x36')]();if(_[_0x956b('0x37')](_0x6268cb,_0x21ab02[_0x956b('0x38')])){return;}var _0x259676=_[_0x956b('0x39')](_0xa0105e,[_0x956b('0x36'),_0x21ab02[_0x956b('0x38')]])[_0x956b('0x3a')];return db[_0x956b('0x3b')][_0x956b('0x2e')]({'where':{'type':_0x259676,'resourceId':_0x21ab02['id']}})[_0x956b('0x2d')](function(){return _0x3940bb;});})[_0x956b('0x2d')](function(){_0x512a68[_0x956b('0x21')](0xcc)[_0x956b('0x3c')]();});}};}function handleEntityNotFound(_0x5cbc4e,_0xb637d9){return function(_0x128493){if(!_0x128493){_0x5cbc4e[_0x956b('0x20')](0x194);}return _0x128493;};}function handleError(_0x203ae3,_0x123e75){_0x123e75=_0x123e75||0x1f4;return function(_0x446870){logger[_0x956b('0x3d')](_0x446870[_0x956b('0x3e')]);if(_0x446870['name']){delete _0x446870['name'];}_0x203ae3[_0x956b('0x21')](_0x123e75)[_0x956b('0x3f')](_0x446870);};}exports[_0x956b('0x40')]=function(_0x255cbb,_0x3be048){var _0x1b0a65={},_0x54aa77={},_0x5e1545={'count':0x0,'rows':[]};var _0x2e00f8=_['map'](db['VoiceQueue'][_0x956b('0x41')],function(_0x276b55){return{'name':_0x276b55[_0x956b('0x42')],'type':_0x276b55[_0x956b('0x38')][_0x956b('0x43')]};});_0x54aa77[_0x956b('0x44')]=_[_0x956b('0x35')](_0x2e00f8,'name');_0x54aa77[_0x956b('0x45')]=_[_0x956b('0x46')](_0x255cbb['query']);_0x54aa77[_0x956b('0x47')]=_[_0x956b('0x48')](_0x54aa77['model'],_0x54aa77[_0x956b('0x45')]);_0x1b0a65['attributes']=_[_0x956b('0x48')](_0x54aa77[_0x956b('0x44')],qs[_0x956b('0x49')](_0x255cbb[_0x956b('0x45')]['fields']));_0x1b0a65['attributes']=_0x1b0a65[_0x956b('0x4a')][_0x956b('0x4b')]?_0x1b0a65[_0x956b('0x4a')]:_0x54aa77[_0x956b('0x44')];if(!_0x255cbb[_0x956b('0x45')][_0x956b('0x4c')]('nolimit')){_0x1b0a65[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x255cbb['query'][_0x956b('0x26')]);_0x1b0a65['offset']=qs['offset'](_0x255cbb[_0x956b('0x45')][_0x956b('0x23')]);}_0x1b0a65['order']=qs[_0x956b('0x4d')](_0x255cbb[_0x956b('0x45')]['sort']);_0x1b0a65[_0x956b('0x4e')]=qs['filters'](_['pick'](_0x255cbb[_0x956b('0x45')],_0x54aa77[_0x956b('0x47')]),_0x2e00f8);if(_0x255cbb[_0x956b('0x45')]['filter']){_0x1b0a65[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x1b0a65[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x2e00f8,function(_0xd795e2){if(_0xd795e2[_0x956b('0x38')]!==_0x956b('0x50')){var _0x165d50={};_0x165d50[_0xd795e2[_0x956b('0x3a')]]={'$like':'%'+_0x255cbb[_0x956b('0x45')][_0x956b('0x33')]+'%'};return _0x165d50;}})});}_0x1b0a65=_['merge']({},_0x1b0a65,_0x255cbb[_0x956b('0x51')]);var _0x109296={'where':_0x1b0a65[_0x956b('0x4e')]};return db['VoiceQueue'][_0x956b('0x25')](_0x109296)[_0x956b('0x2d')](function(_0x56d3b1){_0x5e1545['count']=_0x56d3b1;if(_0x255cbb['query'][_0x956b('0x52')]){_0x1b0a65[_0x956b('0x53')]=[{'all':!![]}];}return db[_0x956b('0x54')][_0x956b('0x55')](_0x1b0a65);})[_0x956b('0x2d')](function(_0x242172){_0x5e1545[_0x956b('0x56')]=_0x242172;return _0x5e1545;})[_0x956b('0x2d')](respondWithFilteredResult(_0x3be048,_0x1b0a65))[_0x956b('0x57')](handleError(_0x3be048,null));};exports[_0x956b('0x58')]=function(_0x537b16,_0x5efa71){var _0x59c92c={'raw':![],'where':{'id':_0x537b16['params']['id']}},_0x47b954={};_0x47b954[_0x956b('0x44')]=_[_0x956b('0x46')](db[_0x956b('0x54')][_0x956b('0x41')]);_0x47b954[_0x956b('0x45')]=_['keys'](_0x537b16[_0x956b('0x45')]);_0x47b954[_0x956b('0x47')]=_[_0x956b('0x48')](_0x47b954['model'],_0x47b954['query']);_0x59c92c[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x47b954['model'],qs[_0x956b('0x49')](_0x537b16[_0x956b('0x45')][_0x956b('0x49')]));_0x59c92c['attributes']=_0x59c92c[_0x956b('0x4a')]['length']?_0x59c92c[_0x956b('0x4a')]:_0x47b954[_0x956b('0x44')];if(_0x537b16[_0x956b('0x45')][_0x956b('0x52')]){_0x59c92c[_0x956b('0x53')]=[{'all':!![]}];}_0x59c92c=_[_0x956b('0x4f')]({},_0x59c92c,_0x537b16[_0x956b('0x51')]);return db[_0x956b('0x54')][_0x956b('0x39')](_0x59c92c)[_0x956b('0x2d')](handleEntityNotFound(_0x5efa71,null))[_0x956b('0x2d')](respondWithResult(_0x5efa71,null))[_0x956b('0x57')](handleError(_0x5efa71,null));};exports[_0x956b('0x59')]=function(_0x28405c,_0x15ac5e){return db['VoiceQueue'][_0x956b('0x59')](_0x28405c['body'],{})[_0x956b('0x2d')](function(_0x4f933a){var _0x26a63b=_0x28405c[_0x956b('0x5a')][_0x956b('0x2f')]({'plain':!![]});if(!_0x26a63b)throw new Error(_0x956b('0x5b'));if(_0x26a63b['role']==='user'){var _0x321573=_0x4f933a[_0x956b('0x2f')]({'plain':!![]});var _0x41c908=[{'name':_0x956b('0x30'),'value':'inbound'},{'name':_0x956b('0x31'),'value':_0x956b('0x32')}];var _0x2e4185=_[_0x956b('0x39')](_0x41c908,[_0x956b('0x36'),_0x321573[_0x956b('0x38')]])[_0x956b('0x3a')];return db[_0x956b('0x5c')][_0x956b('0x39')]({'where':{'name':_0x2e4185,'userProfileId':_0x26a63b[_0x956b('0x5d')]},'raw':!![]})[_0x956b('0x2d')](function(_0x2f3c9a){if(_0x2f3c9a&&_0x2f3c9a[_0x956b('0x5e')]===0x0){return db[_0x956b('0x3b')][_0x956b('0x59')]({'name':_0x321573[_0x956b('0x3a')],'resourceId':_0x321573['id'],'type':_0x2f3c9a[_0x956b('0x3a')],'sectionId':_0x2f3c9a['id']},{})[_0x956b('0x2d')](function(){return _0x4f933a;});}else{return _0x4f933a;}})[_0x956b('0x57')](function(_0x4b71b4){logger[_0x956b('0x3d')](_0x956b('0x5f'),_0x4b71b4);throw _0x4b71b4;});}return _0x4f933a;})[_0x956b('0x2d')](respondWithResult(_0x15ac5e,0xc9))['catch'](handleError(_0x15ac5e,null));};exports['clone']=function(_0x4ddfd5,_0x2fba6a){var _0x31bd22={'where':{'id':_0x4ddfd5[_0x956b('0x60')]['id']}},_0xb6b13={};_0xb6b13[_0x956b('0x44')]=_['keys'](db['VoiceQueue'][_0x956b('0x41')]);_0x31bd22['attributes']=_[_0x956b('0x48')](_0xb6b13['model'],qs[_0x956b('0x49')](_0x4ddfd5['query']['fields']));_0x31bd22['attributes']=_0x31bd22[_0x956b('0x4a')][_0x956b('0x4b')]?_0x31bd22[_0x956b('0x4a')]:_0xb6b13['model'];if(_0x4ddfd5[_0x956b('0x45')][_0x956b('0x52')]){_0x31bd22[_0x956b('0x53')]=[{'all':!![]}];}_0x31bd22=_[_0x956b('0x4f')]({},_0x31bd22,_0x4ddfd5['options']);return db['VoiceQueue']['find'](_0x31bd22)[_0x956b('0x2d')](handleEntityNotFound(_0x2fba6a,null))[_0x956b('0x2d')](function(_0x526301){if(_0x526301){var _0x2e8261=_0x526301[_0x956b('0x2f')]({'plain':!![]});_0x2e8261=qs['omit'](_0x2e8261,['id',_0x956b('0x61'),'updatedAt']);_0x4ddfd5[_0x956b('0x62')]=_['omit'](_0x4ddfd5[_0x956b('0x62')],['id',_0x956b('0x61'),_0x956b('0x63')]);return db[_0x956b('0x54')][_0x956b('0x59')](_['merge'](_0x2e8261,_0x4ddfd5[_0x956b('0x62')]),{'include':_0x4ddfd5[_0x956b('0x45')][_0x956b('0x52')]?[{'all':!![]}]:undefined})[_0x956b('0x2d')](function(_0x30ea78){var _0x34240d=_0x4ddfd5[_0x956b('0x5a')][_0x956b('0x2f')]({'plain':!![]});if(!_0x34240d)throw new Error(_0x956b('0x5b'));if(_0x34240d[_0x956b('0x64')]===_0x956b('0x5a')){var _0xe0f5f=_0x30ea78[_0x956b('0x2f')]({'plain':!![]});var _0x1d5eed=[{'name':_0x956b('0x30'),'value':_0x956b('0x65')},{'name':'QueueCampaigns','value':_0x956b('0x32')}];var _0x1e6a87=_[_0x956b('0x39')](_0x1d5eed,[_0x956b('0x36'),_0xe0f5f['type']])[_0x956b('0x3a')];return db['UserProfileSection'][_0x956b('0x39')]({'where':{'name':_0x1e6a87,'userProfileId':_0x34240d[_0x956b('0x5d')]},'raw':!![]})[_0x956b('0x2d')](function(_0x5d697c){if(_0x5d697c&&_0x5d697c['autoAssociation']===0x0){return db[_0x956b('0x3b')][_0x956b('0x59')]({'name':_0xe0f5f[_0x956b('0x3a')],'resourceId':_0xe0f5f['id'],'type':_0x5d697c['name'],'sectionId':_0x5d697c['id']},{})[_0x956b('0x2d')](function(){return _0x30ea78;});}else{return _0x30ea78;}})[_0x956b('0x57')](function(_0x5ee507){logger[_0x956b('0x3d')](_0x956b('0x5f'),_0x5ee507);throw _0x5ee507;});}return _0x30ea78;});}})[_0x956b('0x2d')](respondWithResult(_0x2fba6a,0xc9))[_0x956b('0x57')](handleError(_0x2fba6a,null));};exports[_0x956b('0x2c')]=function(_0x2297d4,_0x1299ef){if(_0x2297d4[_0x956b('0x62')]['id']){delete _0x2297d4[_0x956b('0x62')]['id'];}return db['VoiceQueue'][_0x956b('0x39')]({'where':{'id':_0x2297d4[_0x956b('0x60')]['id']}})['then'](handleEntityNotFound(_0x1299ef,null))['then'](saveUpdates(_0x2297d4[_0x956b('0x62')],null))[_0x956b('0x2d')](respondWithResult(_0x1299ef,null))[_0x956b('0x57')](handleError(_0x1299ef,null));};exports['destroy']=function(_0x2d7162,_0x4d7412){return db[_0x956b('0x54')][_0x956b('0x39')]({'where':{'id':_0x2d7162[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x4d7412,null))[_0x956b('0x2d')](removeEntity(_0x4d7412,null))[_0x956b('0x57')](handleError(_0x4d7412,null));};exports[_0x956b('0x66')]=function(_0x37c5cc,_0x11de20,_0x570f27){var _0x5dd704={'raw':![],'where':{}};var _0x10b0ca={};var _0x2472c8={'count':0x0,'rows':[]};return db[_0x956b('0x54')]['findOne']({'where':{'id':_0x37c5cc[_0x956b('0x60')]['id']}})['then'](handleEntityNotFound(_0x11de20,null))[_0x956b('0x2d')](function(_0x2e1a8d){if(_0x2e1a8d){_0x10b0ca[_0x956b('0x44')]=_[_0x956b('0x46')](db[_0x956b('0x67')][_0x956b('0x41')]);_0x10b0ca[_0x956b('0x45')]=_[_0x956b('0x46')](_0x37c5cc[_0x956b('0x45')]);_0x10b0ca[_0x956b('0x47')]=_[_0x956b('0x48')](_0x10b0ca[_0x956b('0x44')],_0x10b0ca['query']);_0x5dd704[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x10b0ca['model'],qs['fields'](_0x37c5cc[_0x956b('0x45')][_0x956b('0x49')]));_0x5dd704[_0x956b('0x4a')]=_0x5dd704[_0x956b('0x4a')][_0x956b('0x4b')]?_0x5dd704[_0x956b('0x4a')]:_0x10b0ca['model'];if(!_0x37c5cc[_0x956b('0x45')][_0x956b('0x4c')](_0x956b('0x68'))){_0x5dd704[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x37c5cc[_0x956b('0x45')]['limit']);_0x5dd704[_0x956b('0x23')]=qs['offset'](_0x37c5cc[_0x956b('0x45')][_0x956b('0x23')]);}_0x5dd704[_0x956b('0x69')]=qs['sort'](_0x37c5cc[_0x956b('0x45')][_0x956b('0x4d')]);_0x5dd704[_0x956b('0x4e')]=qs[_0x956b('0x47')](_[_0x956b('0x6a')](_0x37c5cc['query'],_0x10b0ca['filters']));_0x5dd704[_0x956b('0x4e')][_0x956b('0x6b')]=_0x2e1a8d['id'];if(_0x37c5cc['query']['filter']){_0x5dd704[_0x956b('0x4e')]=_['merge'](_0x5dd704['where'],{'$or':_[_0x956b('0x35')](_0x5dd704[_0x956b('0x4a')],function(_0x3fcca2){var _0x52c1bb={};_0x52c1bb[_0x3fcca2]={'$like':'%'+_0x37c5cc[_0x956b('0x45')]['filter']+'%'};return _0x52c1bb;})});}_0x5dd704=_['merge']({},_0x5dd704,_0x37c5cc['options']);return db[_0x956b('0x67')]['count']({'where':_0x5dd704[_0x956b('0x4e')]})[_0x956b('0x2d')](function(_0x4e33c2){_0x2472c8[_0x956b('0x25')]=_0x4e33c2;if(_0x37c5cc[_0x956b('0x45')]['includeAll']){_0x5dd704[_0x956b('0x53')]=[{'all':!![]}];}return db[_0x956b('0x67')][_0x956b('0x55')](_0x5dd704);})['then'](function(_0x55d215){_0x2472c8[_0x956b('0x56')]=_0x55d215;return _0x2472c8;});}})[_0x956b('0x2d')](respondWithFilteredResult(_0x11de20,_0x5dd704))[_0x956b('0x57')](handleError(_0x11de20,null));};exports[_0x956b('0x6c')]=function(_0x3974f6,_0x1f5b6f,_0x57df81){var _0x1f2a50={'raw':!![],'where':{}};var _0x57f7ec={};var _0x1903fa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x956b('0x6d')]({'where':{'id':_0x3974f6[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x1f5b6f,null))['then'](function(_0xc7e389){if(_0xc7e389){_0x57f7ec['model']=_[_0x956b('0x46')](db[_0x956b('0x6e')]['rawAttributes']);_0x57f7ec[_0x956b('0x45')]=_[_0x956b('0x46')](_0x3974f6[_0x956b('0x45')]);_0x57f7ec[_0x956b('0x47')]=_[_0x956b('0x48')](_0x57f7ec[_0x956b('0x44')],_0x57f7ec[_0x956b('0x45')]);_0x1f2a50[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x57f7ec['model'],qs[_0x956b('0x49')](_0x3974f6[_0x956b('0x45')]['fields']));_0x1f2a50['attributes']=_0x1f2a50[_0x956b('0x4a')][_0x956b('0x4b')]?_0x1f2a50[_0x956b('0x4a')]:_0x57f7ec[_0x956b('0x44')];if(!_0x3974f6['query'][_0x956b('0x4c')](_0x956b('0x68'))){_0x1f2a50[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x3974f6[_0x956b('0x45')][_0x956b('0x26')]);_0x1f2a50[_0x956b('0x23')]=qs[_0x956b('0x23')](_0x3974f6[_0x956b('0x45')]['offset']);}_0x1f2a50[_0x956b('0x69')]=qs['sort'](_0x3974f6[_0x956b('0x45')]['sort']);_0x1f2a50[_0x956b('0x4e')]=qs[_0x956b('0x47')](_[_0x956b('0x6a')](_0x3974f6['query'],_0x57f7ec['filters']));_0x1f2a50['where'][_0x956b('0x6b')]=_0xc7e389['id'];if(_0x3974f6[_0x956b('0x45')][_0x956b('0x33')]){_0x1f2a50[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x1f2a50[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x1f2a50['attributes'],function(_0x5d6ee2){var _0x4b6d88={};_0x4b6d88[_0x5d6ee2]={'$like':'%'+_0x3974f6['query'][_0x956b('0x33')]+'%'};return _0x4b6d88;})});}_0x1f2a50=_[_0x956b('0x4f')]({},_0x1f2a50,_0x3974f6[_0x956b('0x51')]);return db[_0x956b('0x6e')][_0x956b('0x25')]({'where':_0x1f2a50['where']})['then'](function(_0xda80b6){_0x1903fa[_0x956b('0x25')]=_0xda80b6;if(_0x3974f6[_0x956b('0x45')][_0x956b('0x52')]){_0x1f2a50['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x956b('0x55')](_0x1f2a50);})[_0x956b('0x2d')](function(_0x5cdfd2){_0x1903fa['rows']=_0x5cdfd2;return _0x1903fa;});}})['then'](respondWithFilteredResult(_0x1f5b6f,_0x1f2a50))['catch'](handleError(_0x1f5b6f,null));};exports['getHopperFinals']=function(_0x4b3e5d,_0x2d5563,_0x1e63e5){var _0x46965a={'raw':!![],'where':{}};var _0x596086={};var _0x23640c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x956b('0x6d')]({'where':{'id':_0x4b3e5d[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x2d5563,null))['then'](function(_0x25c874){if(_0x25c874){_0x596086[_0x956b('0x44')]=_[_0x956b('0x46')](db['CmHopperFinal']['rawAttributes']);_0x596086[_0x956b('0x45')]=_[_0x956b('0x46')](_0x4b3e5d[_0x956b('0x45')]);_0x596086[_0x956b('0x47')]=_[_0x956b('0x48')](_0x596086[_0x956b('0x44')],_0x596086[_0x956b('0x45')]);_0x46965a[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x596086[_0x956b('0x44')],qs[_0x956b('0x49')](_0x4b3e5d['query'][_0x956b('0x49')]));_0x46965a[_0x956b('0x4a')]=_0x46965a['attributes'][_0x956b('0x4b')]?_0x46965a[_0x956b('0x4a')]:_0x596086[_0x956b('0x44')];if(!_0x4b3e5d[_0x956b('0x45')][_0x956b('0x4c')](_0x956b('0x68'))){_0x46965a['limit']=qs[_0x956b('0x26')](_0x4b3e5d[_0x956b('0x45')]['limit']);_0x46965a['offset']=qs[_0x956b('0x23')](_0x4b3e5d[_0x956b('0x45')][_0x956b('0x23')]);}_0x46965a[_0x956b('0x69')]=qs[_0x956b('0x4d')](_0x4b3e5d[_0x956b('0x45')]['sort']);_0x46965a[_0x956b('0x4e')]=qs[_0x956b('0x47')](_[_0x956b('0x6a')](_0x4b3e5d[_0x956b('0x45')],_0x596086[_0x956b('0x47')]));_0x46965a[_0x956b('0x4e')][_0x956b('0x6b')]=_0x25c874['id'];if(_0x4b3e5d[_0x956b('0x45')][_0x956b('0x33')]){_0x46965a[_0x956b('0x4e')]=_['merge'](_0x46965a[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x46965a['attributes'],function(_0x53076c){var _0x5067cd={};_0x5067cd[_0x53076c]={'$like':'%'+_0x4b3e5d[_0x956b('0x45')]['filter']+'%'};return _0x5067cd;})});}_0x46965a=_[_0x956b('0x4f')]({},_0x46965a,_0x4b3e5d[_0x956b('0x51')]);return db[_0x956b('0x6f')][_0x956b('0x25')]({'where':_0x46965a[_0x956b('0x4e')]})[_0x956b('0x2d')](function(_0x7b8fc9){_0x23640c[_0x956b('0x25')]=_0x7b8fc9;if(_0x4b3e5d[_0x956b('0x45')][_0x956b('0x52')]){_0x46965a[_0x956b('0x53')]=[{'all':!![]}];}return db[_0x956b('0x6f')][_0x956b('0x55')](_0x46965a);})[_0x956b('0x2d')](function(_0x1e42f6){_0x23640c[_0x956b('0x56')]=_0x1e42f6;return _0x23640c;});}})[_0x956b('0x2d')](respondWithFilteredResult(_0x2d5563,_0x46965a))[_0x956b('0x57')](handleError(_0x2d5563,null));};exports['getHopperBlacks']=function(_0x104e46,_0x14ff9a,_0x1a880e){var _0x55a482={'raw':!![],'where':{}};var _0x11f710={};var _0xbbfb44={'count':0x0,'rows':[]};return db[_0x956b('0x54')][_0x956b('0x6d')]({'where':{'id':_0x104e46['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x14ff9a,null))[_0x956b('0x2d')](function(_0x3cd493){if(_0x3cd493){_0x11f710[_0x956b('0x44')]=_['keys'](db[_0x956b('0x70')][_0x956b('0x41')]);_0x11f710[_0x956b('0x45')]=_[_0x956b('0x46')](_0x104e46['query']);_0x11f710['filters']=_['intersection'](_0x11f710[_0x956b('0x44')],_0x11f710[_0x956b('0x45')]);_0x55a482['attributes']=_[_0x956b('0x48')](_0x11f710[_0x956b('0x44')],qs[_0x956b('0x49')](_0x104e46['query']['fields']));_0x55a482[_0x956b('0x4a')]=_0x55a482[_0x956b('0x4a')][_0x956b('0x4b')]?_0x55a482[_0x956b('0x4a')]:_0x11f710[_0x956b('0x44')];if(!_0x104e46['query'][_0x956b('0x4c')](_0x956b('0x68'))){_0x55a482['limit']=qs[_0x956b('0x26')](_0x104e46[_0x956b('0x45')][_0x956b('0x26')]);_0x55a482[_0x956b('0x23')]=qs[_0x956b('0x23')](_0x104e46[_0x956b('0x45')]['offset']);}_0x55a482[_0x956b('0x69')]=qs['sort'](_0x104e46[_0x956b('0x45')]['sort']);_0x55a482[_0x956b('0x4e')]=qs[_0x956b('0x47')](_[_0x956b('0x6a')](_0x104e46[_0x956b('0x45')],_0x11f710[_0x956b('0x47')]));_0x55a482[_0x956b('0x4e')][_0x956b('0x6b')]=_0x3cd493['id'];if(_0x104e46[_0x956b('0x45')][_0x956b('0x33')]){_0x55a482['where']=_[_0x956b('0x4f')](_0x55a482['where'],{'$or':_[_0x956b('0x35')](_0x55a482['attributes'],function(_0x16bb3c){var _0x5daa1a={};_0x5daa1a[_0x16bb3c]={'$like':'%'+_0x104e46[_0x956b('0x45')][_0x956b('0x33')]+'%'};return _0x5daa1a;})});}_0x55a482=_[_0x956b('0x4f')]({},_0x55a482,_0x104e46[_0x956b('0x51')]);return db[_0x956b('0x70')][_0x956b('0x25')]({'where':_0x55a482[_0x956b('0x4e')]})[_0x956b('0x2d')](function(_0x50da53){_0xbbfb44[_0x956b('0x25')]=_0x50da53;if(_0x104e46[_0x956b('0x45')][_0x956b('0x52')]){_0x55a482[_0x956b('0x53')]=[{'all':!![]}];}return db[_0x956b('0x70')][_0x956b('0x55')](_0x55a482);})['then'](function(_0x4beecd){_0xbbfb44[_0x956b('0x56')]=_0x4beecd;return _0xbbfb44;});}})['then'](respondWithFilteredResult(_0x14ff9a,_0x55a482))[_0x956b('0x57')](handleError(_0x14ff9a,null));};exports[_0x956b('0x71')]=function(_0x1f23b1,_0x4862c1,_0x4b0b21){var _0x5e30bd={};var _0x57a5c9={};var _0x4828cc;var _0x2d0496;return db[_0x956b('0x54')]['findOne']({'where':{'id':_0x1f23b1[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x4862c1,null))[_0x956b('0x2d')](function(_0x25eba9){if(_0x25eba9){_0x4828cc=_0x25eba9;_0x57a5c9[_0x956b('0x44')]=_[_0x956b('0x46')](db[_0x956b('0x72')][_0x956b('0x41')]);_0x57a5c9[_0x956b('0x45')]=_['keys'](_0x1f23b1['query']);_0x57a5c9['filters']=_[_0x956b('0x48')](_0x57a5c9['model'],_0x57a5c9[_0x956b('0x45')]);_0x5e30bd[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x57a5c9[_0x956b('0x44')],qs[_0x956b('0x49')](_0x1f23b1['query'][_0x956b('0x49')]));_0x5e30bd['attributes']=_0x5e30bd[_0x956b('0x4a')][_0x956b('0x4b')]?_0x5e30bd[_0x956b('0x4a')]:_0x57a5c9['model'];_0x5e30bd['order']=qs[_0x956b('0x4d')](_0x1f23b1[_0x956b('0x45')]['sort']);_0x5e30bd['where']=qs[_0x956b('0x47')](_[_0x956b('0x6a')](_0x1f23b1[_0x956b('0x45')],_0x57a5c9['filters']));if(_0x1f23b1[_0x956b('0x45')][_0x956b('0x33')]){_0x5e30bd[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x5e30bd[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x5e30bd[_0x956b('0x4a')],function(_0xfe5caf){var _0x500d16={};_0x500d16[_0xfe5caf]={'$like':'%'+_0x1f23b1[_0x956b('0x45')]['filter']+'%'};return _0x500d16;})});}_0x5e30bd=_[_0x956b('0x4f')]({},_0x5e30bd,_0x1f23b1[_0x956b('0x51')]);return _0x4828cc['getTeams'](_0x5e30bd);}})[_0x956b('0x2d')](function(_0x35df83){if(_0x35df83){_0x2d0496=_0x35df83[_0x956b('0x4b')];if(!_0x1f23b1[_0x956b('0x45')][_0x956b('0x4c')](_0x956b('0x68'))){_0x5e30bd[_0x956b('0x26')]=qs['limit'](_0x1f23b1[_0x956b('0x45')][_0x956b('0x26')]);_0x5e30bd[_0x956b('0x23')]=qs['offset'](_0x1f23b1[_0x956b('0x45')][_0x956b('0x23')]);}return _0x4828cc[_0x956b('0x71')](_0x5e30bd);}})[_0x956b('0x2d')](function(_0x429ec4){if(_0x429ec4){return _0x429ec4?{'count':_0x2d0496,'rows':_0x429ec4}:null;}})['then'](respondWithResult(_0x4862c1,null))['catch'](handleError(_0x4862c1,null));};exports[_0x956b('0x73')]=function(_0x262dda,_0x34e7c5,_0x5a3f72){var _0x579372=_0x262dda[_0x956b('0x62')][_0x956b('0x74')];var _0x3153a5=_[_0x956b('0x35')](_0x579372,'id');return db['Team'][_0x956b('0x55')]({'where':{'id':_0x3153a5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x956b('0x75'),'attributes':['id',_0x956b('0x3a'),_0x956b('0x76'),_0x956b('0x77'),_0x956b('0x78')],'raw':!![]}]})[_0x956b('0x2d')](function(_0x367b26){if(_0x367b26){var _0x317f71=_[_0x956b('0x79')](_0x367b26,function(_0x5a62db){var _0x206269=_0x5a62db['get']({'plain':!![]});_0x206269[_0x956b('0x75')]['forEach'](function(_0x5ac9ed){_0x5ac9ed['penalty']=_[_0x956b('0x39')](_0x579372,{'id':_0x206269['id']})['penalty'];});return _0x206269[_0x956b('0x75')];});return db[_0x956b('0x54')][_0x956b('0x39')]({'where':{'id':_0x262dda['params']['id']}})[_0x956b('0x2d')](function(_0x3b735a){return db['sequelize']['transaction'](function(_0x711b1){return _0x3b735a['addTeams'](_0x3153a5,{'transaction':_0x711b1})[_0x956b('0x2d')](function(){return BPromise['each'](_0x579372,function(_0x1a4b7b){return db[_0x956b('0x7a')]['upsert']({'TeamId':_0x1a4b7b['id'],'VoiceQueueId':_0x262dda['params']['id'],'penalty':_0x1a4b7b[_0x956b('0x7b')]},{'transaction':_0x711b1});});})[_0x956b('0x2d')](function(){return BPromise[_0x956b('0x7c')](_0x317f71,function(_0xf5ba4d){return db['UserVoiceQueue'][_0x956b('0x7d')]({'where':{'UserId':_0xf5ba4d['id'],'VoiceQueueId':_0x262dda[_0x956b('0x60')]['id']},'defaults':{'penalty':_0xf5ba4d['penalty']},'transaction':_0x711b1});});})['then'](function(){return BPromise[_0x956b('0x7c')](_['filter'](_0x317f71,{'online':!![]}),function(_0x53254f){return db[_0x956b('0x7e')]['upsert']({'membername':_0x53254f[_0x956b('0x3a')],'UserId':_0x53254f['id'],'queue_name':_0x3b735a['name'],'VoiceQueueId':_0x3b735a['id'],'interface':_['isNil'](_0x53254f[_0x956b('0x78')])?util['format'](_0x956b('0x7f'),_0x53254f[_0x956b('0x3a')]):_0x53254f['interface'],'paused':_0x53254f[_0x956b('0x77')]||![],'penalty':_0x53254f[_0x956b('0x7b')]},{'transaction':_0x711b1});});})[_0x956b('0x2d')](function(){_0x317f71[_0x956b('0x80')](function(_0x2fe4e2){socket[_0x956b('0x81')](_0x956b('0x82'),{'UserId':_0x2fe4e2['id'],'VoiceQueueId':_0x3b735a['id']});});});});});}})[_0x956b('0x2d')](respondWithStatusCode(_0x34e7c5,null))[_0x956b('0x57')](handleError(_0x34e7c5,null));};exports[_0x956b('0x83')]=function(_0x5d0abe,_0x26d7ee,_0xb139db){return db[_0x956b('0x72')][_0x956b('0x55')]({'where':{'id':_0x5d0abe[_0x956b('0x45')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x956b('0x75'),'attributes':['id'],'raw':!![]}]})[_0x956b('0x2d')](handleEntityNotFound(_0x26d7ee,null))[_0x956b('0x2d')](function(_0x2a27bb){var _0x3ea833=_[_0x956b('0x35')](_0x2a27bb,'id');var _0x436c1e=[];var _0x6b9264=[];var _0x3b8ef9=squel[_0x956b('0x84')]();_0x3b8ef9['field'](_0x956b('0x85'))[_0x956b('0x86')](_0x956b('0x87'),'tq')[_0x956b('0x88')]('user_has_teams','ut',_0x956b('0x89'))[_0x956b('0x4e')](_0x956b('0x8a'),_0x5d0abe[_0x956b('0x60')]['id']);for(var _0x4b9166=0x0;_0x4b9166<_0x2a27bb['length'];_0x4b9166+=0x1){let _0x270be8=_0x2a27bb[_0x4b9166];for(var _0x435905=0x0;_0x435905<_0x270be8[_0x956b('0x75')]['length'];_0x435905+=0x1){let _0x4909d3=_0x270be8[_0x956b('0x75')][_0x435905];var _0x340f5b=_0x3b8ef9[_0x956b('0x8b')]();_0x340f5b[_0x956b('0x4e')](_0x956b('0x8c'),_0x4909d3['id']);_0x6b9264[_0x956b('0x8d')](db['sequelize'][_0x956b('0x45')](_0x340f5b[_0x956b('0x8e')](),{'type':db['sequelize']['QueryTypes'][_0x956b('0x8f')]})['then'](function(_0x7aa303){if(_0x7aa303[_0x956b('0x4b')]===0x1){return _0x4909d3['id'];}else{var _0x4aa91e=_[_0x956b('0x90')](_[_0x956b('0x35')](_0x7aa303,_0x956b('0x91')),function(_0x2aa8f2){return _[_0x956b('0x37')](_0x3ea833,_0x2aa8f2);});if(_0x4aa91e){return _0x4909d3['id'];}}}));}}return BPromise['all'](_0x6b9264)[_0x956b('0x2d')](function(_0x20e4d9){_0x436c1e=_(_0x436c1e)[_0x956b('0x92')](_0x20e4d9)[_0x956b('0x93')]()[_0x956b('0x36')]();return db[_0x956b('0x54')]['find']({'where':{'id':_0x5d0abe[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](function(_0x53abcc){return db[_0x956b('0x94')][_0x956b('0x95')](function(_0x585c4c){return _0x53abcc[_0x956b('0x83')](_0x5d0abe[_0x956b('0x45')][_0x956b('0x96')],{'transaction':_0x585c4c})[_0x956b('0x2d')](function(){if(!_[_0x956b('0x97')](_0x436c1e)){return _0x53abcc[_0x956b('0x98')](_0x436c1e,{'transaction':_0x585c4c})[_0x956b('0x2d')](function(){return db[_0x956b('0x7e')][_0x956b('0x2e')]({'where':{'VoiceQueueId':_0x5d0abe[_0x956b('0x60')]['id'],'UserId':_0x436c1e},'transaction':_0x585c4c});});}})[_0x956b('0x2d')](function(){_0x436c1e[_0x956b('0x80')](function(_0x10d7be){socket[_0x956b('0x81')](_0x956b('0x99'),{'UserId':_0x10d7be,'VoiceQueueId':_0x53abcc['id']});});});});});});})['then'](respondWithStatusCode(_0x26d7ee,null))[_0x956b('0x57')](handleError(_0x26d7ee,null));};exports[_0x956b('0x9a')]=function(_0x5636f0,_0x3a73ef,_0x260897){var _0x1a6f22,_0x4b0521;return db[_0x956b('0x54')][_0x956b('0x39')]({'where':{'id':_0x5636f0[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x3a73ef,null))['then'](function(_0x5e08fa){if(_0x5e08fa){_0x4b0521=_0x5e08fa;return _0x5e08fa[_0x956b('0x9a')](_0x5636f0[_0x956b('0x62')][_0x956b('0x96')],_[_0x956b('0x9b')](_0x5636f0['body'],['ids','id'])||{})[_0x956b('0x9c')](function(_0x2d025c){for(var _0x2ff0bd=0x0;_0x2ff0bd<_0x5636f0[_0x956b('0x62')][_0x956b('0x96')][_0x956b('0x4b')];_0x2ff0bd+=0x1){socket[_0x956b('0x81')](_0x956b('0x82'),{'UserId':Number(_0x5636f0['body'][_0x956b('0x96')][_0x2ff0bd]),'VoiceQueueId':Number(_0x5636f0[_0x956b('0x60')]['id'])});}return _0x2d025c;});}})[_0x956b('0x2d')](function(_0x47673c){_0x1a6f22=_0x47673c||[];if(_0x4b0521){return db['User'][_0x956b('0x55')]({'where':{'id':_0x5636f0[_0x956b('0x62')][_0x956b('0x96')]},'attributes':['id',_0x956b('0x3a'),_0x956b('0x76'),_0x956b('0x77'),_0x956b('0x78')],'raw':!![]});}})[_0x956b('0x2d')](function(_0x1788da){if(!_[_0x956b('0x97')](_0x1788da)){var _0x15e8b8=[];for(var _0x316c13=0x0;_0x316c13<_0x1788da['length'];_0x316c13++){if(_0x1788da[_0x316c13]['online']){_0x15e8b8[_0x956b('0x8d')](db['UserVoiceQueueRt'][_0x956b('0x9d')]({'membername':_0x1788da[_0x316c13][_0x956b('0x3a')],'UserId':_0x1788da[_0x316c13]['id'],'queue_name':_0x4b0521['name'],'VoiceQueueId':_0x4b0521['id'],'interface':_[_0x956b('0x9e')](_0x1788da[_0x316c13][_0x956b('0x78')])?util['format'](_0x956b('0x7f'),_0x1788da[_0x316c13][_0x956b('0x3a')]):_0x1788da[_0x316c13][_0x956b('0x78')],'paused':_0x1788da[_0x316c13]['voicePause']||![],'penalty':_0x5636f0[_0x956b('0x62')][_0x956b('0x7b')]||0x0}));}}return BPromise[_0x956b('0x9f')](_0x15e8b8);}})['then'](function(){return _0x1a6f22;})[_0x956b('0x2d')](respondWithResult(_0x3a73ef,null))[_0x956b('0x57')](handleError(_0x3a73ef,null));};exports['removeAgents']=function(_0x28b8a0,_0x3c5007,_0x54c452){return db[_0x956b('0x54')][_0x956b('0x39')]({'where':{'id':_0x28b8a0[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x3c5007,null))[_0x956b('0x2d')](function(_0x21c121){if(_0x21c121){return _0x21c121['removeAgents'](_0x28b8a0[_0x956b('0x45')][_0x956b('0x96')])[_0x956b('0x2d')](function(){if(_['isArray'](_0x28b8a0[_0x956b('0x45')][_0x956b('0x96')])){for(var _0x17d3a8=0x0;_0x17d3a8<_0x28b8a0[_0x956b('0x45')]['ids'][_0x956b('0x4b')];_0x17d3a8+=0x1){socket[_0x956b('0x81')](_0x956b('0x99'),{'UserId':Number(_0x28b8a0[_0x956b('0x45')][_0x956b('0x96')][_0x17d3a8]),'VoiceQueueId':Number(_0x28b8a0[_0x956b('0x60')]['id'])});}}else{socket[_0x956b('0x81')](_0x956b('0x99'),{'UserId':Number(_0x28b8a0[_0x956b('0x45')][_0x956b('0x96')]),'VoiceQueueId':Number(_0x28b8a0[_0x956b('0x60')]['id'])});}});}})['then'](function(_0x3e1469){return db[_0x956b('0x7e')][_0x956b('0x2e')]({'where':{'VoiceQueueId':_0x28b8a0[_0x956b('0x60')]['id'],'UserId':_0x28b8a0['query']['ids']}})['then'](function(){return _0x3e1469;});})[_0x956b('0x2d')](respondWithStatusCode(_0x3c5007,null))['catch'](handleError(_0x3c5007,null));};exports['getAgents']=function(_0x42e600,_0x3eedaf,_0x2a49a0){var _0x1349c9={};var _0x5950e4={};var _0x48a095;var _0x39bd8d;return db[_0x956b('0x54')]['findOne']({'where':{'id':_0x42e600['params']['id']}})['then'](handleEntityNotFound(_0x3eedaf,null))['then'](function(_0x392fc2){if(_0x392fc2){_0x48a095=_0x392fc2;_0x5950e4[_0x956b('0x44')]=_[_0x956b('0x46')](db[_0x956b('0xa0')][_0x956b('0x41')]);_0x5950e4[_0x956b('0x45')]=_[_0x956b('0x46')](_0x42e600[_0x956b('0x45')]);_0x5950e4['filters']=_['intersection'](_0x5950e4[_0x956b('0x44')],_0x5950e4[_0x956b('0x45')]);_0x1349c9[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x5950e4['model'],qs[_0x956b('0x49')](_0x42e600[_0x956b('0x45')][_0x956b('0x49')]));_0x1349c9[_0x956b('0x4a')]=_0x1349c9[_0x956b('0x4a')][_0x956b('0x4b')]?_0x1349c9['attributes']:_0x5950e4[_0x956b('0x44')];_0x1349c9[_0x956b('0x69')]=qs[_0x956b('0x4d')](_0x42e600['query'][_0x956b('0x4d')]);_0x1349c9[_0x956b('0x4e')]=qs['filters'](_[_0x956b('0x6a')](_0x42e600[_0x956b('0x45')],_0x5950e4[_0x956b('0x47')]));if(_0x42e600[_0x956b('0x45')][_0x956b('0x33')]){_0x1349c9[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x1349c9[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x1349c9['attributes'],function(_0x418807){var _0x111aa5={};_0x111aa5[_0x418807]={'$like':'%'+_0x42e600[_0x956b('0x45')][_0x956b('0x33')]+'%'};return _0x111aa5;})});}_0x1349c9=_[_0x956b('0x4f')]({},_0x1349c9,_0x42e600['options']);return _0x48a095[_0x956b('0xa1')](_0x1349c9);}})[_0x956b('0x2d')](function(_0x2a5616){if(_0x2a5616){_0x39bd8d=_0x2a5616[_0x956b('0x4b')];if(!_0x42e600[_0x956b('0x45')][_0x956b('0x4c')](_0x956b('0x68'))){_0x1349c9[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x42e600[_0x956b('0x45')][_0x956b('0x26')]);_0x1349c9[_0x956b('0x23')]=qs[_0x956b('0x23')](_0x42e600[_0x956b('0x45')][_0x956b('0x23')]);}return _0x48a095[_0x956b('0xa1')](_0x1349c9);}})[_0x956b('0x2d')](function(_0x3856d6){if(_0x3856d6){return _0x3856d6?{'count':_0x39bd8d,'rows':_0x3856d6}:null;}})[_0x956b('0x2d')](respondWithResult(_0x3eedaf,null))['catch'](handleError(_0x3eedaf,null));};exports[_0x956b('0xa2')]=function(_0x184262,_0xe59984,_0x2b85ed){var _0x4554eb={};var _0x2e88de={};var _0x307e37;var _0x142931;return db['VoiceQueue'][_0x956b('0x6d')]({'where':{'id':_0x184262['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0xe59984,null))[_0x956b('0x2d')](function(_0x4f53cb){if(_0x4f53cb){_0x307e37=_0x4f53cb;_0x2e88de[_0x956b('0x44')]=_['keys'](db['UserVoiceQueueRt'][_0x956b('0x41')]);_0x2e88de['query']=_[_0x956b('0x46')](_0x184262['query']);_0x2e88de['filters']=_[_0x956b('0x48')](_0x2e88de['model'],_0x2e88de[_0x956b('0x45')]);_0x4554eb[_0x956b('0x4a')]=_[_0x956b('0x48')](_0x2e88de[_0x956b('0x44')],qs[_0x956b('0x49')](_0x184262[_0x956b('0x45')]['fields']));_0x4554eb[_0x956b('0x4a')]=_0x4554eb['attributes'][_0x956b('0x4b')]?_0x4554eb['attributes']:_0x2e88de[_0x956b('0x44')];_0x4554eb[_0x956b('0x69')]=qs['sort'](_0x184262[_0x956b('0x45')][_0x956b('0x4d')]);_0x4554eb[_0x956b('0x4e')]=qs[_0x956b('0x47')](_['pick'](_0x184262[_0x956b('0x45')],_0x2e88de[_0x956b('0x47')]));if(_0x184262[_0x956b('0x45')][_0x956b('0x33')]){_0x4554eb[_0x956b('0x4e')]=_['merge'](_0x4554eb['where'],{'$or':_[_0x956b('0x35')](_0x4554eb[_0x956b('0x4a')],function(_0x4fe0a3){var _0x4407b0={};_0x4407b0[_0x4fe0a3]={'$like':'%'+_0x184262[_0x956b('0x45')][_0x956b('0x33')]+'%'};return _0x4407b0;})});}_0x4554eb=_['merge']({},_0x4554eb,_0x184262[_0x956b('0x51')]);return _0x307e37[_0x956b('0xa2')](_0x4554eb);}})[_0x956b('0x2d')](function(_0x41a5ba){if(_0x41a5ba){_0x142931=_0x41a5ba[_0x956b('0x4b')];if(!_0x184262['query'][_0x956b('0x4c')](_0x956b('0x68'))){_0x4554eb[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x184262['query']['limit']);_0x4554eb['offset']=qs[_0x956b('0x23')](_0x184262[_0x956b('0x45')][_0x956b('0x23')]);}return _0x307e37[_0x956b('0xa2')](_0x4554eb);}})[_0x956b('0x2d')](function(_0x13e220){return _0x13e220?{'count':_0x142931,'rows':_0x13e220}:null;})[_0x956b('0x2d')](respondWithResult(_0xe59984,null))['catch'](handleError(_0xe59984,null));};exports['getLists']=function(_0x5e2995,_0x4a21c8,_0x4c5731){var _0x10ab4e={};var _0x7ccac0={};var _0x20cacc;var _0x33e2aa;return db[_0x956b('0x54')][_0x956b('0x6d')]({'where':{'id':_0x5e2995['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x4a21c8,null))[_0x956b('0x2d')](function(_0x399ea5){if(_0x399ea5){_0x20cacc=_0x399ea5;_0x7ccac0[_0x956b('0x44')]=_[_0x956b('0x46')](db['CmList'][_0x956b('0x41')]);_0x7ccac0[_0x956b('0x45')]=_[_0x956b('0x46')](_0x5e2995['query']);_0x7ccac0[_0x956b('0x47')]=_['intersection'](_0x7ccac0[_0x956b('0x44')],_0x7ccac0[_0x956b('0x45')]);_0x10ab4e['attributes']=_[_0x956b('0x48')](_0x7ccac0[_0x956b('0x44')],qs[_0x956b('0x49')](_0x5e2995[_0x956b('0x45')][_0x956b('0x49')]));_0x10ab4e[_0x956b('0x4a')]=_0x10ab4e[_0x956b('0x4a')][_0x956b('0x4b')]?_0x10ab4e[_0x956b('0x4a')]:_0x7ccac0[_0x956b('0x44')];_0x10ab4e['order']=qs[_0x956b('0x4d')](_0x5e2995['query'][_0x956b('0x4d')]);_0x10ab4e[_0x956b('0x4e')]=qs[_0x956b('0x47')](_['pick'](_0x5e2995[_0x956b('0x45')],_0x7ccac0[_0x956b('0x47')]));if(_0x5e2995[_0x956b('0x45')][_0x956b('0x33')]){_0x10ab4e[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x10ab4e[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x10ab4e['attributes'],function(_0x174fb1){var _0x24a394={};_0x24a394[_0x174fb1]={'$like':'%'+_0x5e2995[_0x956b('0x45')][_0x956b('0x33')]+'%'};return _0x24a394;})});}_0x10ab4e=_[_0x956b('0x4f')]({},_0x10ab4e,_0x5e2995['options']);return _0x20cacc[_0x956b('0xa3')](_0x10ab4e);}})[_0x956b('0x2d')](function(_0x1980f7){if(_0x1980f7){_0x33e2aa=_0x1980f7[_0x956b('0x4b')];if(!_0x5e2995[_0x956b('0x45')][_0x956b('0x4c')]('nolimit')){_0x10ab4e[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x5e2995[_0x956b('0x45')][_0x956b('0x26')]);_0x10ab4e[_0x956b('0x23')]=qs[_0x956b('0x23')](_0x5e2995[_0x956b('0x45')][_0x956b('0x23')]);}return _0x20cacc[_0x956b('0xa3')](_0x10ab4e);}})[_0x956b('0x2d')](function(_0x5c050b){if(_0x5c050b){return _0x5c050b?{'count':_0x33e2aa,'rows':_0x5c050b}:null;}})[_0x956b('0x2d')](respondWithResult(_0x4a21c8,null))['catch'](handleError(_0x4a21c8,null));};exports[_0x956b('0xa4')]=function(_0xf82025,_0x43a517,_0x251be3){var _0x53aed0=moment()[_0x956b('0xa5')](_0x956b('0xa6'));var _0x101268,_0x5d6064;return db['VoiceQueue'][_0x956b('0x39')]({'where':{'id':_0xf82025['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x43a517,null))[_0x956b('0x2d')](function(_0x793db){if(_0x793db){_0x5d6064=_0x793db;return _0x793db[_0x956b('0xa4')](_0xf82025[_0x956b('0x62')]['ids'],_[_0x956b('0x9b')](_0xf82025[_0x956b('0x62')],[_0x956b('0x96'),'id'])||{});}return null;})['spread'](function(_0x411543){var _0x3797b0;_0x101268=_0x411543||[];var _0x51a99d=[];if(_0x411543){for(var _0x31e78c=0x0;_0x31e78c<_0x411543[_0x956b('0x4b')];_0x31e78c+=0x1){var _0x5b6e60=_0x411543[_0x31e78c][_0x956b('0x2f')]({'plain':!![]});_0x5d6064[_0x956b('0xa7')]=_0xf82025[_0x956b('0x62')][_0x956b('0xa7')]?_0xf82025['body'][_0x956b('0xa7')]:_0x5d6064[_0x956b('0xa7')];switch(_0x5d6064[_0x956b('0xa7')]){case'always':_0x3797b0=squel['insert']()[_0x956b('0xa8')]('cm_hopper')['fromQuery']([_0x956b('0xa9'),'scheduledAt',_0x956b('0xaa'),_0x956b('0xab'),_0x956b('0x6b'),_0x956b('0x61'),_0x956b('0x63')],squel[_0x956b('0x84')]()[_0x956b('0xac')](_0x956b('0xa9'),_0x956b('0xa9'))['field']('\x27'+_0x53aed0+'\x27',_0x956b('0xad'))[_0x956b('0xac')]('id','ContactId')[_0x956b('0xac')](_0x5b6e60[_0x956b('0xae')][_0x956b('0x8e')](),_0x956b('0xab'))[_0x956b('0xac')](_0xf82025[_0x956b('0x60')]['id']['toString'](),_0x956b('0x6b'))[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27',_0x956b('0x61'))[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27','updatedAt')[_0x956b('0x86')](_0x956b('0xaf'))[_0x956b('0x4e')]('deletedAt\x20IS\x20NULL')['where'](_0x956b('0xb0'),_0x5b6e60[_0x956b('0xae')][_0x956b('0x8e')]())[_0x956b('0x4e')](_0x956b('0xb1'))[_0x956b('0x4e')](_0x956b('0xb2'),squel[_0x956b('0x84')]()['field'](_0x956b('0xb3'))[_0x956b('0x86')](_0x956b('0xb4'))[_0x956b('0x4e')](_0x956b('0x8a'),_0xf82025[_0x956b('0x60')]['id'][_0x956b('0x8e')]()))[_0x956b('0x4e')](_0x956b('0xb2'),squel[_0x956b('0x84')]()['field']('COALESCE(phone,\x27\x27)')[_0x956b('0x86')](_0x956b('0xb5'))[_0x956b('0x4e')](_0x956b('0x8a'),_0xf82025['params']['id'][_0x956b('0x8e')]())))['toString']();break;case _0x956b('0xb6'):_0x3797b0=squel['insert']()[_0x956b('0xa8')](_0x956b('0xb5'))['fromQuery'](['phone',_0x956b('0xad'),_0x956b('0xaa'),'ListId',_0x956b('0x6b'),_0x956b('0x61'),_0x956b('0x63')],squel[_0x956b('0x84')]()['field'](_0x956b('0xa9'),'phone')[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27',_0x956b('0xad'))['field']('id',_0x956b('0xaa'))[_0x956b('0xac')](_0x5b6e60[_0x956b('0xae')]['toString'](),_0x956b('0xab'))[_0x956b('0xac')](_0xf82025[_0x956b('0x60')]['id'][_0x956b('0x8e')](),'VoiceQueueId')[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27','createdAt')[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27',_0x956b('0x63'))[_0x956b('0x86')](_0x956b('0xaf'))['where'](_0x956b('0xb7'))['where']('ListId\x20=\x20?',_0x5b6e60[_0x956b('0xae')][_0x956b('0x8e')]())[_0x956b('0x4e')](_0x956b('0xb1'))['where'](_0x956b('0xb2'),squel[_0x956b('0x84')]()['field'](_0x956b('0xb8'))['from']('cm_hopper')[_0x956b('0x4e')](_0x956b('0x8a'),_0xf82025[_0x956b('0x60')]['id']['toString']())))[_0x956b('0x8e')]();break;default:_0x3797b0=squel[_0x956b('0xb9')]()[_0x956b('0xa8')]('cm_hopper')[_0x956b('0xba')]([_0x956b('0xa9'),'scheduledAt',_0x956b('0xaa'),_0x956b('0xab'),_0x956b('0x6b'),_0x956b('0x61'),_0x956b('0x63')],squel[_0x956b('0x84')]()[_0x956b('0xac')](_0x956b('0xa9'),_0x956b('0xa9'))[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27','scheduledAt')[_0x956b('0xac')]('id',_0x956b('0xaa'))['field'](_0x5b6e60[_0x956b('0xae')]['toString'](),_0x956b('0xab'))[_0x956b('0xac')](_0xf82025[_0x956b('0x60')]['id'][_0x956b('0x8e')](),_0x956b('0x6b'))[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27',_0x956b('0x61'))['field']('\x27'+_0x53aed0+'\x27','updatedAt')[_0x956b('0x86')](_0x956b('0xaf'))[_0x956b('0x4e')]('deletedAt\x20IS\x20NULL')['where'](_0x956b('0xb0'),_0x5b6e60[_0x956b('0xae')][_0x956b('0x8e')]())[_0x956b('0x4e')](_0x956b('0xb1')))[_0x956b('0x8e')]();}_0x51a99d[_0x956b('0x8d')](db[_0x956b('0x94')]['query'](_0x3797b0));}return BPromise[_0x956b('0x9f')](_0x51a99d);}})[_0x956b('0x2d')](function(){var _0x34c0e1=[];var _0x375a54=squel[_0x956b('0xb9')]()[_0x956b('0xa8')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x956b('0xa9'),_0x956b('0xbb'),'createdAt','updatedAt'],squel[_0x956b('0x84')]()['field'](_0x956b('0xbc'))[_0x956b('0xac')](_0x956b('0xbd'))[_0x956b('0xac')](_0x956b('0xbe'))[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27',_0x956b('0x61'))[_0x956b('0xac')]('\x27'+_0x53aed0+'\x27','updatedAt')[_0x956b('0x86')](_0x956b('0xbf'),'ci')[_0x956b('0x88')](_0x956b('0xb5'),'h','h.ContactId=ci.CmContactId')[_0x956b('0x4e')](_0x956b('0xc0'),_0x53aed0)[_0x956b('0x4e')](_0x956b('0xc1'),'PHONE'))[_0x956b('0x8e')]();_0x34c0e1[_0x956b('0x8d')](db[_0x956b('0x94')][_0x956b('0x45')](_0x375a54));return BPromise[_0x956b('0x9f')](_0x34c0e1);})[_0x956b('0x2d')](function(){return _0x101268;})['then'](respondWithResult(_0x43a517,null))['catch'](handleError(_0x43a517,null));};exports[_0x956b('0xc2')]=function(_0x32c369,_0x174f36,_0x4fc4e6){return db[_0x956b('0x54')][_0x956b('0x39')]({'where':{'id':_0x32c369['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x174f36,null))[_0x956b('0x2d')](function(_0x14fb96){if(_0x14fb96){return _0x14fb96[_0x956b('0xc2')](_0x32c369[_0x956b('0x45')][_0x956b('0x96')]);}})[_0x956b('0x2d')](function(_0x23a4c2){if(_0x23a4c2){return db['CmHopper'][_0x956b('0x2e')]({'where':{'ListId':_0x32c369[_0x956b('0x45')][_0x956b('0x96')],'VoiceQueueId':_0x32c369[_0x956b('0x60')]['id']}})['then'](function(){return _0x23a4c2;});}})['then'](respondWithStatusCode(_0x174f36,null))[_0x956b('0x57')](handleError(_0x174f36,null));};exports[_0x956b('0xc3')]=function(_0x3a1647,_0x1d4d3f,_0x3cf3c1){var _0x67dabc={};var _0x5f41fc={};var _0x15f3ed;var _0x3eb77e;return db['VoiceQueue'][_0x956b('0x6d')]({'where':{'id':_0x3a1647['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x1d4d3f,null))[_0x956b('0x2d')](function(_0x251d42){if(_0x251d42){_0x15f3ed=_0x251d42;_0x5f41fc[_0x956b('0x44')]=_[_0x956b('0x46')](db[_0x956b('0xc4')][_0x956b('0x41')]);_0x5f41fc['query']=_[_0x956b('0x46')](_0x3a1647['query']);_0x5f41fc[_0x956b('0x47')]=_['intersection'](_0x5f41fc[_0x956b('0x44')],_0x5f41fc['query']);_0x67dabc['attributes']=_[_0x956b('0x48')](_0x5f41fc[_0x956b('0x44')],qs[_0x956b('0x49')](_0x3a1647[_0x956b('0x45')][_0x956b('0x49')]));_0x67dabc['attributes']=_0x67dabc['attributes']['length']?_0x67dabc[_0x956b('0x4a')]:_0x5f41fc[_0x956b('0x44')];_0x67dabc[_0x956b('0x69')]=qs[_0x956b('0x4d')](_0x3a1647['query'][_0x956b('0x4d')]);_0x67dabc[_0x956b('0x4e')]=qs[_0x956b('0x47')](_[_0x956b('0x6a')](_0x3a1647[_0x956b('0x45')],_0x5f41fc[_0x956b('0x47')]));if(_0x3a1647['query'][_0x956b('0x33')]){_0x67dabc[_0x956b('0x4e')]=_[_0x956b('0x4f')](_0x67dabc[_0x956b('0x4e')],{'$or':_[_0x956b('0x35')](_0x67dabc['attributes'],function(_0x4aa48d){var _0x25be8d={};_0x25be8d[_0x4aa48d]={'$like':'%'+_0x3a1647[_0x956b('0x45')][_0x956b('0x33')]+'%'};return _0x25be8d;})});}_0x67dabc=_[_0x956b('0x4f')]({},_0x67dabc,_0x3a1647[_0x956b('0x51')]);return _0x15f3ed[_0x956b('0xc3')](_0x67dabc);}})[_0x956b('0x2d')](function(_0x222d0f){if(_0x222d0f){_0x3eb77e=_0x222d0f[_0x956b('0x4b')];if(!_0x3a1647[_0x956b('0x45')][_0x956b('0x4c')](_0x956b('0x68'))){_0x67dabc[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x3a1647[_0x956b('0x45')]['limit']);_0x67dabc[_0x956b('0x23')]=qs[_0x956b('0x23')](_0x3a1647[_0x956b('0x45')][_0x956b('0x23')]);}return _0x15f3ed[_0x956b('0xc3')](_0x67dabc);}})[_0x956b('0x2d')](function(_0x4c2bd4){if(_0x4c2bd4){return _0x4c2bd4?{'count':_0x3eb77e,'rows':_0x4c2bd4}:null;}})['then'](respondWithResult(_0x1d4d3f,null))['catch'](handleError(_0x1d4d3f,null));};exports[_0x956b('0xc5')]=function(_0x992cb1,_0x3eac4d,_0x151153){var _0x20f32b,_0x7ac672;return db['VoiceQueue']['find']({'where':{'id':_0x992cb1['params']['id']}})['then'](handleEntityNotFound(_0x3eac4d,null))['then'](function(_0x3a0555){if(_0x3a0555){_0x7ac672=_0x3a0555;return _0x3a0555['addBlackLists'](_0x992cb1['body'][_0x956b('0x96')],_['omit'](_0x992cb1['body'],['ids','id'])||{});}return null;})[_0x956b('0x9c')](function(_0x28364b){var _0x230fdc;_0x20f32b=_0x28364b||[];var _0x22a847=[];if(_0x28364b){for(var _0x45cc28=0x0;_0x45cc28<_0x28364b[_0x956b('0x4b')];_0x45cc28+=0x1){var _0x3eff1c=_0x28364b[_0x45cc28][_0x956b('0x2f')]({'plain':!![]});_0x230fdc=squel[_0x956b('0xb9')]()[_0x956b('0xa8')](_0x956b('0xc6'))[_0x956b('0xba')]([_0x956b('0xa9'),_0x956b('0xaa'),'ListId',_0x956b('0x6b'),_0x956b('0x61'),_0x956b('0x63')],squel['select']()[_0x956b('0xac')](_0x956b('0xa9'),'phone')[_0x956b('0xac')]('id',_0x956b('0xaa'))['field'](_0x3eff1c[_0x956b('0xae')][_0x956b('0x8e')](),'ListId')[_0x956b('0xac')](_0x992cb1['params']['id'][_0x956b('0x8e')](),_0x956b('0x6b'))[_0x956b('0xac')]('NOW()',_0x956b('0x61'))[_0x956b('0xac')](_0x956b('0xc7'),_0x956b('0x63'))['from'](_0x956b('0xaf'))[_0x956b('0x4e')]('deletedAt\x20IS\x20NULL')[_0x956b('0x4e')](_0x956b('0xb0'),_0x3eff1c[_0x956b('0xae')][_0x956b('0x8e')]())[_0x956b('0x4e')](_0x956b('0xb1')))[_0x956b('0x8e')]();_0x22a847[_0x956b('0x8d')](db[_0x956b('0x94')]['query'](_0x230fdc));}return BPromise[_0x956b('0x9f')](_0x22a847);}})[_0x956b('0x2d')](function(){return _0x20f32b;})['then'](respondWithResult(_0x3eac4d,null))[_0x956b('0x57')](handleError(_0x3eac4d,null));};exports[_0x956b('0xc8')]=function(_0x2feae5,_0xdbbb0e,_0x4916e5){return db[_0x956b('0x54')]['find']({'where':{'id':_0x2feae5[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0xdbbb0e,null))[_0x956b('0x2d')](function(_0x98802e){if(_0x98802e){return _0x98802e[_0x956b('0xc8')](_0x2feae5[_0x956b('0x45')][_0x956b('0x96')]);}})[_0x956b('0x2d')](function(_0x420925){if(_0x420925){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x2feae5[_0x956b('0x45')][_0x956b('0x96')],'VoiceQueueId':_0x2feae5[_0x956b('0x60')]['id']}})[_0x956b('0x2d')](function(){return _0x420925;});}})['then'](respondWithStatusCode(_0xdbbb0e,null))[_0x956b('0x57')](handleError(_0xdbbb0e,null));}; \ No newline at end of file +var _0x1921=['ids','spread','online','isNil','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','fromQuery','scheduledAt','ContactId','phone','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','push','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./voiceQueue.socket','register','status','end','json','offset','undefined','count','Content-Range','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','name','UserProfileResource','sendStatus','error','stack','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','UserProfileSection','update','getHoppers','findOne','nolimit','VoiceQueueId','CmHopper','findAll','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','TeamId','all','union','compact','transaction','isEmpty','removeAgents','addAgents'];(function(_0x126acb,_0x55ddec){var _0x58853a=function(_0x2c8fe1){while(--_0x2c8fe1){_0x126acb['push'](_0x126acb['shift']());}};_0x58853a(++_0x55ddec);}(_0x1921,0xf2));var _0x1192=function(_0x2c7a8,_0x432d0b){_0x2c7a8=_0x2c7a8-0x0;var _0x2a91fc=_0x1921[_0x2c7a8];return _0x2a91fc;};'use strict';var emlformat=require(_0x1192('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1192('0x1'));var jsonpatch=require(_0x1192('0x2'));var rp=require(_0x1192('0x3'));var moment=require(_0x1192('0x4'));var BPromise=require(_0x1192('0x5'));var Mustache=require(_0x1192('0x6'));var util=require(_0x1192('0x7'));var path=require(_0x1192('0x8'));var sox=require(_0x1192('0x9'));var csv=require(_0x1192('0xa'));var ejs=require(_0x1192('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1192('0xc'));var crypto=require(_0x1192('0xd'));var jsforce=require(_0x1192('0xe'));var deskjs=require(_0x1192('0xf'));var toCsv=require(_0x1192('0xa'));var querystring=require(_0x1192('0x10'));var Papa=require(_0x1192('0x11'));var Redis=require(_0x1192('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1192('0x13'));var hardwareService=require(_0x1192('0x14'));var logger=require(_0x1192('0x15'))(_0x1192('0x16'));var utils=require(_0x1192('0x17'));var config=require(_0x1192('0x18'));var licenseUtil=require(_0x1192('0x19'));var db=require('../../mysqldb')['db'];config[_0x1192('0x1a')]=_['defaults'](config[_0x1192('0x1a')],{'host':_0x1192('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1192('0x1a')]));require(_0x1192('0x1c'))[_0x1192('0x1d')](socket);function respondWithStatusCode(_0x4c17d3,_0x938cb5){_0x938cb5=_0x938cb5||0xcc;return function(_0x195c7c){if(_0x195c7c){return _0x4c17d3['sendStatus'](_0x938cb5);}return _0x4c17d3[_0x1192('0x1e')](_0x938cb5)[_0x1192('0x1f')]();};}function respondWithResult(_0x2a162b,_0x4823d0){_0x4823d0=_0x4823d0||0xc8;return function(_0x230cc3){if(_0x230cc3){return _0x2a162b['status'](_0x4823d0)[_0x1192('0x20')](_0x230cc3);}};}function respondWithFilteredResult(_0x4757bb,_0x113be1){return function(_0x13a5ca){if(_0x13a5ca){var _0x30d58f=typeof _0x113be1[_0x1192('0x21')]==='undefined'&&typeof _0x113be1['limit']===_0x1192('0x22');var _0x1b46e2=_0x13a5ca[_0x1192('0x23')];var _0xb7f4f0=_0x30d58f?0x0:_0x113be1['offset'];var _0x3c48fa=_0x30d58f?_0x13a5ca[_0x1192('0x23')]:_0x113be1[_0x1192('0x21')]+_0x113be1['limit'];var _0x1cfcd6;if(_0x3c48fa>=_0x1b46e2){_0x3c48fa=_0x1b46e2;_0x1cfcd6=0xc8;}else{_0x1cfcd6=0xce;}_0x4757bb[_0x1192('0x1e')](_0x1cfcd6);return _0x4757bb['set'](_0x1192('0x24'),_0xb7f4f0+'-'+_0x3c48fa+'/'+_0x1b46e2)[_0x1192('0x20')](_0x13a5ca);}return null;};}function patchUpdates(_0x402e64){return function(_0x2230fa){try{jsonpatch['apply'](_0x2230fa,_0x402e64,!![]);}catch(_0x4ad6b4){return BPromise[_0x1192('0x25')](_0x4ad6b4);}return _0x2230fa['save']();};}function saveUpdates(_0x3cc973,_0x4cf20c){return function(_0x1a56b2){if(_0x1a56b2){return _0x1a56b2['update'](_0x3cc973)[_0x1192('0x26')](function(_0x18e4cc){return _0x18e4cc;});}return null;};}function removeEntity(_0x572d29,_0x40bdb5){return function(_0x3f74ee){if(_0x3f74ee){return _0x3f74ee[_0x1192('0x27')]()[_0x1192('0x26')](function(){var _0x288ac6=_0x3f74ee[_0x1192('0x28')]({'plain':!![]});var _0x52967f=[{'name':_0x1192('0x29'),'value':_0x1192('0x2a'),'ignore':![]},{'name':_0x1192('0x2b'),'value':_0x1192('0x2c'),'ignore':![]}];var _0x29bd1c=_(_0x52967f)[_0x1192('0x2d')](_0x1192('0x2e'))[_0x1192('0x2f')](_0x1192('0x30'))[_0x1192('0x30')]();if(_['includes'](_0x29bd1c,_0x288ac6[_0x1192('0x31')])){return;}var _0x47d3ea=_['find'](_0x52967f,[_0x1192('0x30'),_0x288ac6[_0x1192('0x31')]])[_0x1192('0x32')];return db[_0x1192('0x33')][_0x1192('0x27')]({'where':{'type':_0x47d3ea,'resourceId':_0x288ac6['id']}})[_0x1192('0x26')](function(){return _0x3f74ee;});})[_0x1192('0x26')](function(){_0x572d29[_0x1192('0x1e')](0xcc)[_0x1192('0x1f')]();});}};}function handleEntityNotFound(_0x3076f9,_0x11a1ee){return function(_0x25be73){if(!_0x25be73){_0x3076f9[_0x1192('0x34')](0x194);}return _0x25be73;};}function handleError(_0x41b228,_0x2a6df3){_0x2a6df3=_0x2a6df3||0x1f4;return function(_0x46f7f3){logger[_0x1192('0x35')](_0x46f7f3[_0x1192('0x36')]);if(_0x46f7f3[_0x1192('0x32')]){delete _0x46f7f3[_0x1192('0x32')];}_0x41b228[_0x1192('0x1e')](_0x2a6df3)['send'](_0x46f7f3);};}exports['index']=function(_0x5ea84e,_0x16f197){var _0xd8f432={},_0x7144aa={},_0x322da7={'count':0x0,'rows':[]};var _0x5d85b6=_[_0x1192('0x2f')](db[_0x1192('0x37')][_0x1192('0x38')],function(_0xc086cf){return{'name':_0xc086cf[_0x1192('0x39')],'type':_0xc086cf[_0x1192('0x31')][_0x1192('0x3a')]};});_0x7144aa[_0x1192('0x3b')]=_['map'](_0x5d85b6,'name');_0x7144aa[_0x1192('0x3c')]=_[_0x1192('0x3d')](_0x5ea84e[_0x1192('0x3c')]);_0x7144aa[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x7144aa[_0x1192('0x3b')],_0x7144aa['query']);_0xd8f432[_0x1192('0x40')]=_[_0x1192('0x3f')](_0x7144aa[_0x1192('0x3b')],qs[_0x1192('0x41')](_0x5ea84e[_0x1192('0x3c')][_0x1192('0x41')]));_0xd8f432['attributes']=_0xd8f432[_0x1192('0x40')][_0x1192('0x42')]?_0xd8f432['attributes']:_0x7144aa[_0x1192('0x3b')];if(!_0x5ea84e[_0x1192('0x3c')][_0x1192('0x43')]('nolimit')){_0xd8f432['limit']=qs['limit'](_0x5ea84e[_0x1192('0x3c')][_0x1192('0x44')]);_0xd8f432['offset']=qs[_0x1192('0x21')](_0x5ea84e[_0x1192('0x3c')][_0x1192('0x21')]);}_0xd8f432[_0x1192('0x45')]=qs[_0x1192('0x46')](_0x5ea84e[_0x1192('0x3c')][_0x1192('0x46')]);_0xd8f432[_0x1192('0x47')]=qs[_0x1192('0x3e')](_[_0x1192('0x48')](_0x5ea84e[_0x1192('0x3c')],_0x7144aa[_0x1192('0x3e')]),_0x5d85b6);if(_0x5ea84e[_0x1192('0x3c')][_0x1192('0x2d')]){_0xd8f432[_0x1192('0x47')]=_[_0x1192('0x49')](_0xd8f432[_0x1192('0x47')],{'$or':_['map'](_0x5d85b6,function(_0x3c4ddd){if(_0x3c4ddd[_0x1192('0x31')]!==_0x1192('0x4a')){var _0x5600f6={};_0x5600f6[_0x3c4ddd[_0x1192('0x32')]]={'$like':'%'+_0x5ea84e[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x5600f6;}})});}_0xd8f432=_['merge']({},_0xd8f432,_0x5ea84e[_0x1192('0x4b')]);var _0x40eca9={'where':_0xd8f432['where']};return db[_0x1192('0x37')][_0x1192('0x23')](_0x40eca9)[_0x1192('0x26')](function(_0x5d3265){_0x322da7[_0x1192('0x23')]=_0x5d3265;if(_0x5ea84e[_0x1192('0x3c')][_0x1192('0x4c')]){_0xd8f432[_0x1192('0x4d')]=[{'all':!![]}];}return db[_0x1192('0x37')]['findAll'](_0xd8f432);})['then'](function(_0xa6ccdd){_0x322da7['rows']=_0xa6ccdd;return _0x322da7;})[_0x1192('0x26')](respondWithFilteredResult(_0x16f197,_0xd8f432))[_0x1192('0x4e')](handleError(_0x16f197,null));};exports[_0x1192('0x4f')]=function(_0x116e3a,_0x541493){var _0x44e545={'raw':![],'where':{'id':_0x116e3a[_0x1192('0x50')]['id']}},_0x2ab922={};_0x2ab922[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x37')][_0x1192('0x38')]);_0x2ab922['query']=_[_0x1192('0x3d')](_0x116e3a[_0x1192('0x3c')]);_0x2ab922['filters']=_[_0x1192('0x3f')](_0x2ab922[_0x1192('0x3b')],_0x2ab922[_0x1192('0x3c')]);_0x44e545[_0x1192('0x40')]=_[_0x1192('0x3f')](_0x2ab922[_0x1192('0x3b')],qs[_0x1192('0x41')](_0x116e3a['query'][_0x1192('0x41')]));_0x44e545[_0x1192('0x40')]=_0x44e545[_0x1192('0x40')]['length']?_0x44e545[_0x1192('0x40')]:_0x2ab922[_0x1192('0x3b')];if(_0x116e3a[_0x1192('0x3c')]['includeAll']){_0x44e545['include']=[{'all':!![]}];}_0x44e545=_['merge']({},_0x44e545,_0x116e3a[_0x1192('0x4b')]);return db[_0x1192('0x37')][_0x1192('0x51')](_0x44e545)['then'](handleEntityNotFound(_0x541493,null))['then'](respondWithResult(_0x541493,null))[_0x1192('0x4e')](handleError(_0x541493,null));};exports[_0x1192('0x52')]=function(_0x5dadf1,_0x438f48){return db[_0x1192('0x37')][_0x1192('0x52')](_0x5dadf1[_0x1192('0x53')],{})['then'](function(_0x2da8e7){var _0x1d199d=_0x5dadf1[_0x1192('0x54')]['get']({'plain':!![]});if(!_0x1d199d)throw new Error(_0x1192('0x55'));if(_0x1d199d['role']===_0x1192('0x54')){var _0x21b48d=_0x2da8e7[_0x1192('0x28')]({'plain':!![]});var _0x417ded=[{'name':_0x1192('0x29'),'value':_0x1192('0x2a')},{'name':_0x1192('0x2b'),'value':_0x1192('0x2c')}];var _0x4d69af=_[_0x1192('0x51')](_0x417ded,['value',_0x21b48d[_0x1192('0x31')]])[_0x1192('0x32')];return db['UserProfileSection'][_0x1192('0x51')]({'where':{'name':_0x4d69af,'userProfileId':_0x1d199d[_0x1192('0x56')]},'raw':!![]})[_0x1192('0x26')](function(_0x20eba0){if(_0x20eba0&&_0x20eba0[_0x1192('0x57')]===0x0){return db['UserProfileResource'][_0x1192('0x52')]({'name':_0x21b48d[_0x1192('0x32')],'resourceId':_0x21b48d['id'],'type':_0x20eba0[_0x1192('0x32')],'sectionId':_0x20eba0['id']},{})[_0x1192('0x26')](function(){return _0x2da8e7;});}else{return _0x2da8e7;}})['catch'](function(_0x5ab4b3){logger[_0x1192('0x35')](_0x1192('0x58'),_0x5ab4b3);throw _0x5ab4b3;});}return _0x2da8e7;})['then'](respondWithResult(_0x438f48,0xc9))['catch'](handleError(_0x438f48,null));};exports[_0x1192('0x59')]=function(_0x48e671,_0x45fb56){var _0x247ad1={'where':{'id':_0x48e671[_0x1192('0x50')]['id']}},_0x4f4016={};_0x4f4016[_0x1192('0x3b')]=_['keys'](db[_0x1192('0x37')][_0x1192('0x38')]);_0x247ad1[_0x1192('0x40')]=_[_0x1192('0x3f')](_0x4f4016[_0x1192('0x3b')],qs['fields'](_0x48e671[_0x1192('0x3c')][_0x1192('0x41')]));_0x247ad1[_0x1192('0x40')]=_0x247ad1['attributes'][_0x1192('0x42')]?_0x247ad1[_0x1192('0x40')]:_0x4f4016[_0x1192('0x3b')];if(_0x48e671[_0x1192('0x3c')][_0x1192('0x4c')]){_0x247ad1[_0x1192('0x4d')]=[{'all':!![]}];}_0x247ad1=_[_0x1192('0x49')]({},_0x247ad1,_0x48e671[_0x1192('0x4b')]);return db[_0x1192('0x37')]['find'](_0x247ad1)[_0x1192('0x26')](handleEntityNotFound(_0x45fb56,null))[_0x1192('0x26')](function(_0x2a8f6a){if(_0x2a8f6a){var _0x100cff=_0x2a8f6a[_0x1192('0x28')]({'plain':!![]});_0x100cff=qs[_0x1192('0x5a')](_0x100cff,['id',_0x1192('0x5b'),_0x1192('0x5c')]);_0x48e671[_0x1192('0x53')]=_[_0x1192('0x5a')](_0x48e671[_0x1192('0x53')],['id',_0x1192('0x5b'),_0x1192('0x5c')]);return db[_0x1192('0x37')][_0x1192('0x52')](_[_0x1192('0x49')](_0x100cff,_0x48e671[_0x1192('0x53')]),{'include':_0x48e671[_0x1192('0x3c')][_0x1192('0x4c')]?[{'all':!![]}]:undefined})[_0x1192('0x26')](function(_0x2ebd8c){var _0x2359c3=_0x48e671['user'][_0x1192('0x28')]({'plain':!![]});if(!_0x2359c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2359c3[_0x1192('0x5d')]===_0x1192('0x54')){var _0x5e8ff4=_0x2ebd8c['get']({'plain':!![]});var _0x44ad70=[{'name':_0x1192('0x29'),'value':_0x1192('0x2a')},{'name':_0x1192('0x2b'),'value':_0x1192('0x2c')}];var _0x240cab=_[_0x1192('0x51')](_0x44ad70,[_0x1192('0x30'),_0x5e8ff4[_0x1192('0x31')]])['name'];return db[_0x1192('0x5e')][_0x1192('0x51')]({'where':{'name':_0x240cab,'userProfileId':_0x2359c3[_0x1192('0x56')]},'raw':!![]})[_0x1192('0x26')](function(_0x539dd8){if(_0x539dd8&&_0x539dd8['autoAssociation']===0x0){return db[_0x1192('0x33')]['create']({'name':_0x5e8ff4[_0x1192('0x32')],'resourceId':_0x5e8ff4['id'],'type':_0x539dd8[_0x1192('0x32')],'sectionId':_0x539dd8['id']},{})[_0x1192('0x26')](function(){return _0x2ebd8c;});}else{return _0x2ebd8c;}})[_0x1192('0x4e')](function(_0x4f0e92){logger[_0x1192('0x35')](_0x1192('0x58'),_0x4f0e92);throw _0x4f0e92;});}return _0x2ebd8c;});}})['then'](respondWithResult(_0x45fb56,0xc9))['catch'](handleError(_0x45fb56,null));};exports[_0x1192('0x5f')]=function(_0x10181b,_0x12c960){if(_0x10181b['body']['id']){delete _0x10181b['body']['id'];}return db[_0x1192('0x37')]['find']({'where':{'id':_0x10181b['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x12c960,null))['then'](saveUpdates(_0x10181b[_0x1192('0x53')],null))[_0x1192('0x26')](respondWithResult(_0x12c960,null))['catch'](handleError(_0x12c960,null));};exports['destroy']=function(_0x52f05e,_0x414442){return db[_0x1192('0x37')][_0x1192('0x51')]({'where':{'id':_0x52f05e['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x414442,null))['then'](removeEntity(_0x414442,null))[_0x1192('0x4e')](handleError(_0x414442,null));};exports[_0x1192('0x60')]=function(_0x4b5df0,_0x1280eb,_0xbffb55){var _0x1a0672={'raw':![],'where':{}};var _0xe06b07={};var _0x5a6eff={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1192('0x61')]({'where':{'id':_0x4b5df0[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x1280eb,null))[_0x1192('0x26')](function(_0x167514){if(_0x167514){_0xe06b07['model']=_[_0x1192('0x3d')](db['CmHopper'][_0x1192('0x38')]);_0xe06b07[_0x1192('0x3c')]=_[_0x1192('0x3d')](_0x4b5df0[_0x1192('0x3c')]);_0xe06b07[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0xe06b07[_0x1192('0x3b')],_0xe06b07['query']);_0x1a0672['attributes']=_[_0x1192('0x3f')](_0xe06b07['model'],qs['fields'](_0x4b5df0[_0x1192('0x3c')][_0x1192('0x41')]));_0x1a0672['attributes']=_0x1a0672['attributes']['length']?_0x1a0672[_0x1192('0x40')]:_0xe06b07[_0x1192('0x3b')];if(!_0x4b5df0[_0x1192('0x3c')][_0x1192('0x43')](_0x1192('0x62'))){_0x1a0672[_0x1192('0x44')]=qs[_0x1192('0x44')](_0x4b5df0['query'][_0x1192('0x44')]);_0x1a0672[_0x1192('0x21')]=qs[_0x1192('0x21')](_0x4b5df0[_0x1192('0x3c')][_0x1192('0x21')]);}_0x1a0672[_0x1192('0x45')]=qs['sort'](_0x4b5df0[_0x1192('0x3c')][_0x1192('0x46')]);_0x1a0672[_0x1192('0x47')]=qs[_0x1192('0x3e')](_['pick'](_0x4b5df0['query'],_0xe06b07[_0x1192('0x3e')]));_0x1a0672[_0x1192('0x47')][_0x1192('0x63')]=_0x167514['id'];if(_0x4b5df0[_0x1192('0x3c')][_0x1192('0x2d')]){_0x1a0672[_0x1192('0x47')]=_[_0x1192('0x49')](_0x1a0672['where'],{'$or':_['map'](_0x1a0672['attributes'],function(_0x50fee0){var _0x2521d6={};_0x2521d6[_0x50fee0]={'$like':'%'+_0x4b5df0[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x2521d6;})});}_0x1a0672=_[_0x1192('0x49')]({},_0x1a0672,_0x4b5df0[_0x1192('0x4b')]);return db[_0x1192('0x64')][_0x1192('0x23')]({'where':_0x1a0672[_0x1192('0x47')]})[_0x1192('0x26')](function(_0x317ad7){_0x5a6eff[_0x1192('0x23')]=_0x317ad7;if(_0x4b5df0[_0x1192('0x3c')]['includeAll']){_0x1a0672[_0x1192('0x4d')]=[{'all':!![]}];}return db[_0x1192('0x64')][_0x1192('0x65')](_0x1a0672);})[_0x1192('0x26')](function(_0x43de83){_0x5a6eff[_0x1192('0x66')]=_0x43de83;return _0x5a6eff;});}})[_0x1192('0x26')](respondWithFilteredResult(_0x1280eb,_0x1a0672))[_0x1192('0x4e')](handleError(_0x1280eb,null));};exports['getHopperHistories']=function(_0xe36429,_0x440502,_0x3e8958){var _0x40d00a={'raw':!![],'where':{}};var _0x5e91c3={};var _0x3cb67f={'count':0x0,'rows':[]};return db[_0x1192('0x37')]['findOne']({'where':{'id':_0xe36429['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x440502,null))['then'](function(_0x969d74){if(_0x969d74){_0x5e91c3[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x67')][_0x1192('0x38')]);_0x5e91c3[_0x1192('0x3c')]=_[_0x1192('0x3d')](_0xe36429[_0x1192('0x3c')]);_0x5e91c3[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x5e91c3['model'],_0x5e91c3[_0x1192('0x3c')]);_0x40d00a[_0x1192('0x40')]=_[_0x1192('0x3f')](_0x5e91c3[_0x1192('0x3b')],qs[_0x1192('0x41')](_0xe36429[_0x1192('0x3c')]['fields']));_0x40d00a[_0x1192('0x40')]=_0x40d00a[_0x1192('0x40')][_0x1192('0x42')]?_0x40d00a['attributes']:_0x5e91c3['model'];if(!_0xe36429[_0x1192('0x3c')][_0x1192('0x43')](_0x1192('0x62'))){_0x40d00a[_0x1192('0x44')]=qs[_0x1192('0x44')](_0xe36429['query'][_0x1192('0x44')]);_0x40d00a[_0x1192('0x21')]=qs['offset'](_0xe36429['query'][_0x1192('0x21')]);}_0x40d00a[_0x1192('0x45')]=qs['sort'](_0xe36429[_0x1192('0x3c')]['sort']);_0x40d00a[_0x1192('0x47')]=qs['filters'](_[_0x1192('0x48')](_0xe36429[_0x1192('0x3c')],_0x5e91c3[_0x1192('0x3e')]));_0x40d00a[_0x1192('0x47')]['VoiceQueueId']=_0x969d74['id'];if(_0xe36429[_0x1192('0x3c')][_0x1192('0x2d')]){_0x40d00a['where']=_[_0x1192('0x49')](_0x40d00a[_0x1192('0x47')],{'$or':_[_0x1192('0x2f')](_0x40d00a['attributes'],function(_0x586a1e){var _0x3ed8d9={};_0x3ed8d9[_0x586a1e]={'$like':'%'+_0xe36429['query'][_0x1192('0x2d')]+'%'};return _0x3ed8d9;})});}_0x40d00a=_[_0x1192('0x49')]({},_0x40d00a,_0xe36429[_0x1192('0x4b')]);return db[_0x1192('0x67')][_0x1192('0x23')]({'where':_0x40d00a[_0x1192('0x47')]})[_0x1192('0x26')](function(_0x362239){_0x3cb67f[_0x1192('0x23')]=_0x362239;if(_0xe36429[_0x1192('0x3c')][_0x1192('0x4c')]){_0x40d00a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x1192('0x65')](_0x40d00a);})['then'](function(_0x519ff0){_0x3cb67f[_0x1192('0x66')]=_0x519ff0;return _0x3cb67f;});}})[_0x1192('0x26')](respondWithFilteredResult(_0x440502,_0x40d00a))[_0x1192('0x4e')](handleError(_0x440502,null));};exports[_0x1192('0x68')]=function(_0x220acb,_0x5cba9d,_0x3d6cc3){var _0x23469d={'raw':!![],'where':{}};var _0x3a4f87={};var _0x137b4e={'count':0x0,'rows':[]};return db[_0x1192('0x37')]['findOne']({'where':{'id':_0x220acb[_0x1192('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cba9d,null))[_0x1192('0x26')](function(_0x23a99b){if(_0x23a99b){_0x3a4f87[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x69')][_0x1192('0x38')]);_0x3a4f87['query']=_[_0x1192('0x3d')](_0x220acb['query']);_0x3a4f87[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x3a4f87[_0x1192('0x3b')],_0x3a4f87[_0x1192('0x3c')]);_0x23469d[_0x1192('0x40')]=_[_0x1192('0x3f')](_0x3a4f87[_0x1192('0x3b')],qs['fields'](_0x220acb[_0x1192('0x3c')][_0x1192('0x41')]));_0x23469d[_0x1192('0x40')]=_0x23469d[_0x1192('0x40')][_0x1192('0x42')]?_0x23469d[_0x1192('0x40')]:_0x3a4f87['model'];if(!_0x220acb[_0x1192('0x3c')]['hasOwnProperty'](_0x1192('0x62'))){_0x23469d[_0x1192('0x44')]=qs[_0x1192('0x44')](_0x220acb[_0x1192('0x3c')]['limit']);_0x23469d[_0x1192('0x21')]=qs['offset'](_0x220acb['query'][_0x1192('0x21')]);}_0x23469d['order']=qs[_0x1192('0x46')](_0x220acb[_0x1192('0x3c')][_0x1192('0x46')]);_0x23469d[_0x1192('0x47')]=qs[_0x1192('0x3e')](_[_0x1192('0x48')](_0x220acb[_0x1192('0x3c')],_0x3a4f87[_0x1192('0x3e')]));_0x23469d[_0x1192('0x47')][_0x1192('0x63')]=_0x23a99b['id'];if(_0x220acb['query'][_0x1192('0x2d')]){_0x23469d['where']=_[_0x1192('0x49')](_0x23469d[_0x1192('0x47')],{'$or':_[_0x1192('0x2f')](_0x23469d[_0x1192('0x40')],function(_0x105177){var _0x5baf2d={};_0x5baf2d[_0x105177]={'$like':'%'+_0x220acb[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x5baf2d;})});}_0x23469d=_[_0x1192('0x49')]({},_0x23469d,_0x220acb[_0x1192('0x4b')]);return db[_0x1192('0x69')][_0x1192('0x23')]({'where':_0x23469d['where']})[_0x1192('0x26')](function(_0xd554c3){_0x137b4e[_0x1192('0x23')]=_0xd554c3;if(_0x220acb[_0x1192('0x3c')][_0x1192('0x4c')]){_0x23469d['include']=[{'all':!![]}];}return db[_0x1192('0x69')]['findAll'](_0x23469d);})[_0x1192('0x26')](function(_0x4884cf){_0x137b4e[_0x1192('0x66')]=_0x4884cf;return _0x137b4e;});}})[_0x1192('0x26')](respondWithFilteredResult(_0x5cba9d,_0x23469d))[_0x1192('0x4e')](handleError(_0x5cba9d,null));};exports[_0x1192('0x6a')]=function(_0x11908e,_0x21186a,_0x3c89b3){var _0x15e817={'raw':!![],'where':{}};var _0x2116a3={};var _0x2c9b2d={'count':0x0,'rows':[]};return db[_0x1192('0x37')][_0x1192('0x61')]({'where':{'id':_0x11908e[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x21186a,null))['then'](function(_0x5f1cc2){if(_0x5f1cc2){_0x2116a3['model']=_[_0x1192('0x3d')](db[_0x1192('0x6b')][_0x1192('0x38')]);_0x2116a3[_0x1192('0x3c')]=_[_0x1192('0x3d')](_0x11908e[_0x1192('0x3c')]);_0x2116a3[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x2116a3[_0x1192('0x3b')],_0x2116a3[_0x1192('0x3c')]);_0x15e817[_0x1192('0x40')]=_['intersection'](_0x2116a3[_0x1192('0x3b')],qs['fields'](_0x11908e[_0x1192('0x3c')][_0x1192('0x41')]));_0x15e817[_0x1192('0x40')]=_0x15e817[_0x1192('0x40')]['length']?_0x15e817[_0x1192('0x40')]:_0x2116a3[_0x1192('0x3b')];if(!_0x11908e['query'][_0x1192('0x43')](_0x1192('0x62'))){_0x15e817[_0x1192('0x44')]=qs[_0x1192('0x44')](_0x11908e[_0x1192('0x3c')][_0x1192('0x44')]);_0x15e817['offset']=qs[_0x1192('0x21')](_0x11908e['query'][_0x1192('0x21')]);}_0x15e817[_0x1192('0x45')]=qs[_0x1192('0x46')](_0x11908e[_0x1192('0x3c')][_0x1192('0x46')]);_0x15e817[_0x1192('0x47')]=qs[_0x1192('0x3e')](_[_0x1192('0x48')](_0x11908e[_0x1192('0x3c')],_0x2116a3[_0x1192('0x3e')]));_0x15e817['where']['VoiceQueueId']=_0x5f1cc2['id'];if(_0x11908e[_0x1192('0x3c')]['filter']){_0x15e817['where']=_[_0x1192('0x49')](_0x15e817[_0x1192('0x47')],{'$or':_[_0x1192('0x2f')](_0x15e817[_0x1192('0x40')],function(_0x19eac0){var _0x56e62c={};_0x56e62c[_0x19eac0]={'$like':'%'+_0x11908e[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x56e62c;})});}_0x15e817=_['merge']({},_0x15e817,_0x11908e[_0x1192('0x4b')]);return db[_0x1192('0x6b')]['count']({'where':_0x15e817['where']})[_0x1192('0x26')](function(_0x434623){_0x2c9b2d[_0x1192('0x23')]=_0x434623;if(_0x11908e[_0x1192('0x3c')][_0x1192('0x4c')]){_0x15e817[_0x1192('0x4d')]=[{'all':!![]}];}return db[_0x1192('0x6b')]['findAll'](_0x15e817);})[_0x1192('0x26')](function(_0x29c6ca){_0x2c9b2d[_0x1192('0x66')]=_0x29c6ca;return _0x2c9b2d;});}})[_0x1192('0x26')](respondWithFilteredResult(_0x21186a,_0x15e817))[_0x1192('0x4e')](handleError(_0x21186a,null));};exports[_0x1192('0x6c')]=function(_0x28ef65,_0xa72472,_0x2ae994){var _0xd09ce9={};var _0x50bbd3={};var _0x30f476;var _0x1ea73f;return db[_0x1192('0x37')]['findOne']({'where':{'id':_0x28ef65[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0xa72472,null))[_0x1192('0x26')](function(_0x88a73){if(_0x88a73){_0x30f476=_0x88a73;_0x50bbd3[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x6d')]['rawAttributes']);_0x50bbd3[_0x1192('0x3c')]=_['keys'](_0x28ef65[_0x1192('0x3c')]);_0x50bbd3['filters']=_[_0x1192('0x3f')](_0x50bbd3[_0x1192('0x3b')],_0x50bbd3[_0x1192('0x3c')]);_0xd09ce9['attributes']=_[_0x1192('0x3f')](_0x50bbd3['model'],qs[_0x1192('0x41')](_0x28ef65['query'][_0x1192('0x41')]));_0xd09ce9[_0x1192('0x40')]=_0xd09ce9['attributes']['length']?_0xd09ce9['attributes']:_0x50bbd3[_0x1192('0x3b')];_0xd09ce9[_0x1192('0x45')]=qs[_0x1192('0x46')](_0x28ef65[_0x1192('0x3c')][_0x1192('0x46')]);_0xd09ce9[_0x1192('0x47')]=qs[_0x1192('0x3e')](_[_0x1192('0x48')](_0x28ef65[_0x1192('0x3c')],_0x50bbd3[_0x1192('0x3e')]));if(_0x28ef65[_0x1192('0x3c')][_0x1192('0x2d')]){_0xd09ce9[_0x1192('0x47')]=_[_0x1192('0x49')](_0xd09ce9[_0x1192('0x47')],{'$or':_['map'](_0xd09ce9['attributes'],function(_0x3ea5dc){var _0x1633f6={};_0x1633f6[_0x3ea5dc]={'$like':'%'+_0x28ef65[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x1633f6;})});}_0xd09ce9=_[_0x1192('0x49')]({},_0xd09ce9,_0x28ef65[_0x1192('0x4b')]);return _0x30f476[_0x1192('0x6c')](_0xd09ce9);}})[_0x1192('0x26')](function(_0x148753){if(_0x148753){_0x1ea73f=_0x148753[_0x1192('0x42')];if(!_0x28ef65['query'][_0x1192('0x43')](_0x1192('0x62'))){_0xd09ce9[_0x1192('0x44')]=qs[_0x1192('0x44')](_0x28ef65[_0x1192('0x3c')][_0x1192('0x44')]);_0xd09ce9[_0x1192('0x21')]=qs[_0x1192('0x21')](_0x28ef65['query'][_0x1192('0x21')]);}return _0x30f476[_0x1192('0x6c')](_0xd09ce9);}})[_0x1192('0x26')](function(_0x9c2af5){if(_0x9c2af5){return _0x9c2af5?{'count':_0x1ea73f,'rows':_0x9c2af5}:null;}})[_0x1192('0x26')](respondWithResult(_0xa72472,null))[_0x1192('0x4e')](handleError(_0xa72472,null));};exports[_0x1192('0x6e')]=function(_0x1482bc,_0x306f15,_0x1fcc2c){var _0x5447ae=_0x1482bc['body'][_0x1192('0x6f')];var _0x4b95a7=_[_0x1192('0x2f')](_0x5447ae,'id');return db['Team']['findAll']({'where':{'id':_0x4b95a7},'attributes':['id'],'include':[{'model':db[_0x1192('0x70')],'as':_0x1192('0x71'),'attributes':['id',_0x1192('0x32'),'online',_0x1192('0x72'),_0x1192('0x73')],'raw':!![]}]})[_0x1192('0x26')](function(_0x8ec858){if(_0x8ec858){var _0x209104=_[_0x1192('0x74')](_0x8ec858,function(_0x476ee1){var _0x26c1e6=_0x476ee1[_0x1192('0x28')]({'plain':!![]});_0x26c1e6[_0x1192('0x71')][_0x1192('0x75')](function(_0x5ef7e2){_0x5ef7e2[_0x1192('0x76')]=_[_0x1192('0x51')](_0x5447ae,{'id':_0x26c1e6['id']})[_0x1192('0x76')];});return _0x26c1e6[_0x1192('0x71')];});return db['VoiceQueue'][_0x1192('0x51')]({'where':{'id':_0x1482bc[_0x1192('0x50')]['id']}})[_0x1192('0x26')](function(_0x3462a7){return db['sequelize']['transaction'](function(_0x1b37fb){return _0x3462a7[_0x1192('0x6e')](_0x4b95a7,{'transaction':_0x1b37fb})[_0x1192('0x26')](function(){return BPromise[_0x1192('0x77')](_0x5447ae,function(_0x8cb321){return db[_0x1192('0x78')][_0x1192('0x79')]({'TeamId':_0x8cb321['id'],'VoiceQueueId':_0x1482bc[_0x1192('0x50')]['id'],'penalty':_0x8cb321[_0x1192('0x76')]},{'transaction':_0x1b37fb});});})[_0x1192('0x26')](function(){return BPromise['each'](_0x209104,function(_0x38e04b){return db[_0x1192('0x7a')][_0x1192('0x7b')]({'where':{'UserId':_0x38e04b['id'],'VoiceQueueId':_0x1482bc[_0x1192('0x50')]['id']},'defaults':{'penalty':_0x38e04b[_0x1192('0x76')]},'transaction':_0x1b37fb});});})['then'](function(){return BPromise[_0x1192('0x77')](_['filter'](_0x209104,{'online':!![]}),function(_0x37941b){return db[_0x1192('0x7c')][_0x1192('0x79')]({'membername':_0x37941b[_0x1192('0x32')],'UserId':_0x37941b['id'],'queue_name':_0x3462a7[_0x1192('0x32')],'VoiceQueueId':_0x3462a7['id'],'interface':_['isNil'](_0x37941b['interface'])?util[_0x1192('0x7d')](_0x1192('0x7e'),_0x37941b['name']):_0x37941b[_0x1192('0x73')],'paused':_0x37941b['voicePause']||![],'penalty':_0x37941b[_0x1192('0x76')]},{'transaction':_0x1b37fb});});})[_0x1192('0x26')](function(){_0x209104[_0x1192('0x75')](function(_0x4aa338){socket[_0x1192('0x7f')](_0x1192('0x80'),{'UserId':_0x4aa338['id'],'VoiceQueueId':_0x3462a7['id']});});});});});}})[_0x1192('0x26')](respondWithStatusCode(_0x306f15,null))[_0x1192('0x4e')](handleError(_0x306f15,null));};exports[_0x1192('0x81')]=function(_0x4b0ac4,_0x263190,_0x2a8562){return db[_0x1192('0x6d')][_0x1192('0x65')]({'where':{'id':_0x4b0ac4['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1192('0x70')],'as':_0x1192('0x71'),'attributes':['id'],'raw':!![]}]})[_0x1192('0x26')](handleEntityNotFound(_0x263190,null))[_0x1192('0x26')](function(_0x36dda3){var _0x2a4cb4=_[_0x1192('0x2f')](_0x36dda3,'id');var _0x40a33b=[];var _0x38b15a=[];var _0x1586ac=squel[_0x1192('0x82')]();_0x1586ac[_0x1192('0x83')](_0x1192('0x84'))['from']('team_has_voice_queues','tq')[_0x1192('0x85')](_0x1192('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1192('0x47')](_0x1192('0x87'),_0x4b0ac4['params']['id']);for(var _0xe5f96=0x0;_0xe5f96<_0x36dda3[_0x1192('0x42')];_0xe5f96+=0x1){let _0x3064ba=_0x36dda3[_0xe5f96];for(var _0x189411=0x0;_0x189411<_0x3064ba[_0x1192('0x71')][_0x1192('0x42')];_0x189411+=0x1){let _0x5afcca=_0x3064ba[_0x1192('0x71')][_0x189411];var _0x1c5cbf=_0x1586ac[_0x1192('0x59')]();_0x1c5cbf[_0x1192('0x47')](_0x1192('0x88'),_0x5afcca['id']);_0x38b15a['push'](db['sequelize']['query'](_0x1c5cbf['toString'](),{'type':db[_0x1192('0x89')][_0x1192('0x8a')][_0x1192('0x8b')]})[_0x1192('0x26')](function(_0x46139e){if(_0x46139e['length']===0x1){return _0x5afcca['id'];}else{var _0x3a3ee9=_['every'](_[_0x1192('0x2f')](_0x46139e,_0x1192('0x8c')),function(_0xcbc9c0){return _['includes'](_0x2a4cb4,_0xcbc9c0);});if(_0x3a3ee9){return _0x5afcca['id'];}}}));}}return BPromise[_0x1192('0x8d')](_0x38b15a)[_0x1192('0x26')](function(_0x16845e){_0x40a33b=_(_0x40a33b)[_0x1192('0x8e')](_0x16845e)[_0x1192('0x8f')]()['value']();return db[_0x1192('0x37')]['find']({'where':{'id':_0x4b0ac4['params']['id']}})[_0x1192('0x26')](function(_0x11fd87){return db[_0x1192('0x89')][_0x1192('0x90')](function(_0x153b81){return _0x11fd87[_0x1192('0x81')](_0x4b0ac4['query']['ids'],{'transaction':_0x153b81})[_0x1192('0x26')](function(){if(!_[_0x1192('0x91')](_0x40a33b)){return _0x11fd87[_0x1192('0x92')](_0x40a33b,{'transaction':_0x153b81})['then'](function(){return db[_0x1192('0x7c')][_0x1192('0x27')]({'where':{'VoiceQueueId':_0x4b0ac4['params']['id'],'UserId':_0x40a33b},'transaction':_0x153b81});});}})[_0x1192('0x26')](function(){_0x40a33b[_0x1192('0x75')](function(_0x595cee){socket['emit']('userVoiceQueue:remove',{'UserId':_0x595cee,'VoiceQueueId':_0x11fd87['id']});});});});});});})[_0x1192('0x26')](respondWithStatusCode(_0x263190,null))[_0x1192('0x4e')](handleError(_0x263190,null));};exports[_0x1192('0x93')]=function(_0x4a2c35,_0x52ad67,_0x56691c){var _0x3bb958,_0x3a1cc6;return db[_0x1192('0x37')]['find']({'where':{'id':_0x4a2c35[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x52ad67,null))['then'](function(_0x16abfa){if(_0x16abfa){_0x3a1cc6=_0x16abfa;return _0x16abfa[_0x1192('0x93')](_0x4a2c35['body'][_0x1192('0x94')],_[_0x1192('0x5a')](_0x4a2c35[_0x1192('0x53')],['ids','id'])||{})[_0x1192('0x95')](function(_0x1aec38){for(var _0x5bbe9a=0x0;_0x5bbe9a<_0x4a2c35[_0x1192('0x53')]['ids'][_0x1192('0x42')];_0x5bbe9a+=0x1){socket[_0x1192('0x7f')](_0x1192('0x80'),{'UserId':Number(_0x4a2c35[_0x1192('0x53')][_0x1192('0x94')][_0x5bbe9a]),'VoiceQueueId':Number(_0x4a2c35[_0x1192('0x50')]['id'])});}return _0x1aec38;});}})[_0x1192('0x26')](function(_0x107a68){_0x3bb958=_0x107a68||[];if(_0x3a1cc6){return db[_0x1192('0x70')][_0x1192('0x65')]({'where':{'id':_0x4a2c35[_0x1192('0x53')][_0x1192('0x94')]},'attributes':['id',_0x1192('0x32'),_0x1192('0x96'),_0x1192('0x72'),'interface'],'raw':!![]});}})['then'](function(_0x561f47){if(!_[_0x1192('0x91')](_0x561f47)){var _0x58c3c6=[];for(var _0x474259=0x0;_0x474259<_0x561f47[_0x1192('0x42')];_0x474259++){if(_0x561f47[_0x474259][_0x1192('0x96')]){_0x58c3c6['push'](db[_0x1192('0x7c')]['upsert']({'membername':_0x561f47[_0x474259][_0x1192('0x32')],'UserId':_0x561f47[_0x474259]['id'],'queue_name':_0x3a1cc6[_0x1192('0x32')],'VoiceQueueId':_0x3a1cc6['id'],'interface':_[_0x1192('0x97')](_0x561f47[_0x474259][_0x1192('0x73')])?util[_0x1192('0x7d')](_0x1192('0x7e'),_0x561f47[_0x474259][_0x1192('0x32')]):_0x561f47[_0x474259][_0x1192('0x73')],'paused':_0x561f47[_0x474259]['voicePause']||![],'penalty':_0x4a2c35[_0x1192('0x53')][_0x1192('0x76')]||0x0}));}}return BPromise[_0x1192('0x8d')](_0x58c3c6);}})['then'](function(){return _0x3bb958;})[_0x1192('0x26')](respondWithResult(_0x52ad67,null))[_0x1192('0x4e')](handleError(_0x52ad67,null));};exports[_0x1192('0x92')]=function(_0x15c379,_0x58931f,_0x4de445){return db['VoiceQueue']['find']({'where':{'id':_0x15c379['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x58931f,null))[_0x1192('0x26')](function(_0x56473e){if(_0x56473e){return _0x56473e[_0x1192('0x92')](_0x15c379[_0x1192('0x3c')][_0x1192('0x94')])['then'](function(){if(_['isArray'](_0x15c379[_0x1192('0x3c')][_0x1192('0x94')])){for(var _0x1d2a3d=0x0;_0x1d2a3d<_0x15c379[_0x1192('0x3c')][_0x1192('0x94')]['length'];_0x1d2a3d+=0x1){socket[_0x1192('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x15c379[_0x1192('0x3c')][_0x1192('0x94')][_0x1d2a3d]),'VoiceQueueId':Number(_0x15c379['params']['id'])});}}else{socket[_0x1192('0x7f')](_0x1192('0x98'),{'UserId':Number(_0x15c379[_0x1192('0x3c')][_0x1192('0x94')]),'VoiceQueueId':Number(_0x15c379[_0x1192('0x50')]['id'])});}});}})[_0x1192('0x26')](function(_0x58a019){return db[_0x1192('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x15c379[_0x1192('0x50')]['id'],'UserId':_0x15c379[_0x1192('0x3c')][_0x1192('0x94')]}})[_0x1192('0x26')](function(){return _0x58a019;});})[_0x1192('0x26')](respondWithStatusCode(_0x58931f,null))[_0x1192('0x4e')](handleError(_0x58931f,null));};exports[_0x1192('0x99')]=function(_0x4d312d,_0x8a3fb5,_0x157f78){var _0x41d8db={};var _0x51782b={};var _0xe47807;var _0x4270c5;return db[_0x1192('0x37')][_0x1192('0x61')]({'where':{'id':_0x4d312d[_0x1192('0x50')]['id']}})['then'](handleEntityNotFound(_0x8a3fb5,null))[_0x1192('0x26')](function(_0xdafa97){if(_0xdafa97){_0xe47807=_0xdafa97;_0x51782b['model']=_['keys'](db[_0x1192('0x70')][_0x1192('0x38')]);_0x51782b['query']=_[_0x1192('0x3d')](_0x4d312d[_0x1192('0x3c')]);_0x51782b[_0x1192('0x3e')]=_['intersection'](_0x51782b[_0x1192('0x3b')],_0x51782b[_0x1192('0x3c')]);_0x41d8db[_0x1192('0x40')]=_[_0x1192('0x3f')](_0x51782b[_0x1192('0x3b')],qs[_0x1192('0x41')](_0x4d312d[_0x1192('0x3c')]['fields']));_0x41d8db['attributes']=_0x41d8db[_0x1192('0x40')][_0x1192('0x42')]?_0x41d8db[_0x1192('0x40')]:_0x51782b[_0x1192('0x3b')];_0x41d8db[_0x1192('0x45')]=qs[_0x1192('0x46')](_0x4d312d[_0x1192('0x3c')][_0x1192('0x46')]);_0x41d8db[_0x1192('0x47')]=qs[_0x1192('0x3e')](_['pick'](_0x4d312d[_0x1192('0x3c')],_0x51782b[_0x1192('0x3e')]));if(_0x4d312d[_0x1192('0x3c')]['filter']){_0x41d8db[_0x1192('0x47')]=_[_0x1192('0x49')](_0x41d8db[_0x1192('0x47')],{'$or':_[_0x1192('0x2f')](_0x41d8db[_0x1192('0x40')],function(_0xf60cfc){var _0x23a2ab={};_0x23a2ab[_0xf60cfc]={'$like':'%'+_0x4d312d['query'][_0x1192('0x2d')]+'%'};return _0x23a2ab;})});}_0x41d8db=_[_0x1192('0x49')]({},_0x41d8db,_0x4d312d[_0x1192('0x4b')]);return _0xe47807[_0x1192('0x99')](_0x41d8db);}})[_0x1192('0x26')](function(_0x593403){if(_0x593403){_0x4270c5=_0x593403[_0x1192('0x42')];if(!_0x4d312d[_0x1192('0x3c')][_0x1192('0x43')](_0x1192('0x62'))){_0x41d8db[_0x1192('0x44')]=qs[_0x1192('0x44')](_0x4d312d[_0x1192('0x3c')]['limit']);_0x41d8db['offset']=qs['offset'](_0x4d312d[_0x1192('0x3c')][_0x1192('0x21')]);}return _0xe47807[_0x1192('0x99')](_0x41d8db);}})['then'](function(_0x12093d){if(_0x12093d){return _0x12093d?{'count':_0x4270c5,'rows':_0x12093d}:null;}})[_0x1192('0x26')](respondWithResult(_0x8a3fb5,null))['catch'](handleError(_0x8a3fb5,null));};exports['getMembers']=function(_0x2b6547,_0x1d3d00,_0x2a29a2){var _0xa123a9={};var _0x5952e0={};var _0x48cb8b;var _0x2ece40;return db[_0x1192('0x37')][_0x1192('0x61')]({'where':{'id':_0x2b6547[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x1d3d00,null))['then'](function(_0x6dd6da){if(_0x6dd6da){_0x48cb8b=_0x6dd6da;_0x5952e0[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x7c')][_0x1192('0x38')]);_0x5952e0[_0x1192('0x3c')]=_[_0x1192('0x3d')](_0x2b6547[_0x1192('0x3c')]);_0x5952e0[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x5952e0[_0x1192('0x3b')],_0x5952e0[_0x1192('0x3c')]);_0xa123a9[_0x1192('0x40')]=_['intersection'](_0x5952e0[_0x1192('0x3b')],qs[_0x1192('0x41')](_0x2b6547[_0x1192('0x3c')][_0x1192('0x41')]));_0xa123a9[_0x1192('0x40')]=_0xa123a9[_0x1192('0x40')][_0x1192('0x42')]?_0xa123a9[_0x1192('0x40')]:_0x5952e0[_0x1192('0x3b')];_0xa123a9['order']=qs[_0x1192('0x46')](_0x2b6547[_0x1192('0x3c')][_0x1192('0x46')]);_0xa123a9[_0x1192('0x47')]=qs['filters'](_[_0x1192('0x48')](_0x2b6547[_0x1192('0x3c')],_0x5952e0['filters']));if(_0x2b6547[_0x1192('0x3c')]['filter']){_0xa123a9[_0x1192('0x47')]=_[_0x1192('0x49')](_0xa123a9[_0x1192('0x47')],{'$or':_['map'](_0xa123a9[_0x1192('0x40')],function(_0x22c949){var _0x531533={};_0x531533[_0x22c949]={'$like':'%'+_0x2b6547[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x531533;})});}_0xa123a9=_[_0x1192('0x49')]({},_0xa123a9,_0x2b6547[_0x1192('0x4b')]);return _0x48cb8b['getMembers'](_0xa123a9);}})[_0x1192('0x26')](function(_0x534473){if(_0x534473){_0x2ece40=_0x534473[_0x1192('0x42')];if(!_0x2b6547[_0x1192('0x3c')][_0x1192('0x43')](_0x1192('0x62'))){_0xa123a9[_0x1192('0x44')]=qs[_0x1192('0x44')](_0x2b6547[_0x1192('0x3c')][_0x1192('0x44')]);_0xa123a9[_0x1192('0x21')]=qs[_0x1192('0x21')](_0x2b6547[_0x1192('0x3c')][_0x1192('0x21')]);}return _0x48cb8b[_0x1192('0x9a')](_0xa123a9);}})[_0x1192('0x26')](function(_0x6c5f6e){return _0x6c5f6e?{'count':_0x2ece40,'rows':_0x6c5f6e}:null;})['then'](respondWithResult(_0x1d3d00,null))['catch'](handleError(_0x1d3d00,null));};exports[_0x1192('0x9b')]=function(_0x10a96c,_0x53676e,_0x6fc517){var _0x5a5572={};var _0x3b7493={};var _0x560705;var _0x571c3e;return db[_0x1192('0x37')][_0x1192('0x61')]({'where':{'id':_0x10a96c['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x53676e,null))['then'](function(_0x4f1fdc){if(_0x4f1fdc){_0x560705=_0x4f1fdc;_0x3b7493[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x9c')][_0x1192('0x38')]);_0x3b7493[_0x1192('0x3c')]=_['keys'](_0x10a96c[_0x1192('0x3c')]);_0x3b7493[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x3b7493['model'],_0x3b7493['query']);_0x5a5572['attributes']=_[_0x1192('0x3f')](_0x3b7493[_0x1192('0x3b')],qs[_0x1192('0x41')](_0x10a96c[_0x1192('0x3c')][_0x1192('0x41')]));_0x5a5572[_0x1192('0x40')]=_0x5a5572['attributes'][_0x1192('0x42')]?_0x5a5572[_0x1192('0x40')]:_0x3b7493[_0x1192('0x3b')];_0x5a5572[_0x1192('0x45')]=qs[_0x1192('0x46')](_0x10a96c['query'][_0x1192('0x46')]);_0x5a5572[_0x1192('0x47')]=qs['filters'](_[_0x1192('0x48')](_0x10a96c[_0x1192('0x3c')],_0x3b7493[_0x1192('0x3e')]));if(_0x10a96c['query'][_0x1192('0x2d')]){_0x5a5572[_0x1192('0x47')]=_[_0x1192('0x49')](_0x5a5572[_0x1192('0x47')],{'$or':_[_0x1192('0x2f')](_0x5a5572['attributes'],function(_0x523604){var _0x11a3b8={};_0x11a3b8[_0x523604]={'$like':'%'+_0x10a96c[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x11a3b8;})});}_0x5a5572=_[_0x1192('0x49')]({},_0x5a5572,_0x10a96c[_0x1192('0x4b')]);return _0x560705[_0x1192('0x9b')](_0x5a5572);}})['then'](function(_0x32d8cf){if(_0x32d8cf){_0x571c3e=_0x32d8cf['length'];if(!_0x10a96c['query'][_0x1192('0x43')]('nolimit')){_0x5a5572['limit']=qs[_0x1192('0x44')](_0x10a96c[_0x1192('0x3c')][_0x1192('0x44')]);_0x5a5572[_0x1192('0x21')]=qs[_0x1192('0x21')](_0x10a96c[_0x1192('0x3c')][_0x1192('0x21')]);}return _0x560705[_0x1192('0x9b')](_0x5a5572);}})[_0x1192('0x26')](function(_0xb67a11){if(_0xb67a11){return _0xb67a11?{'count':_0x571c3e,'rows':_0xb67a11}:null;}})[_0x1192('0x26')](respondWithResult(_0x53676e,null))[_0x1192('0x4e')](handleError(_0x53676e,null));};exports[_0x1192('0x9d')]=function(_0x542b86,_0x21a126,_0x532fce){var _0x30bfd4=moment()[_0x1192('0x7d')](_0x1192('0x9e'));var _0x2a8e25,_0x5ca4f3;return db[_0x1192('0x37')]['find']({'where':{'id':_0x542b86['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x21a126,null))[_0x1192('0x26')](function(_0xa2d61f){if(_0xa2d61f){_0x5ca4f3=_0xa2d61f;return _0xa2d61f['addLists'](_0x542b86[_0x1192('0x53')][_0x1192('0x94')],_['omit'](_0x542b86[_0x1192('0x53')],[_0x1192('0x94'),'id'])||{});}return null;})[_0x1192('0x95')](function(_0x288ecc){var _0x2e1329;_0x2a8e25=_0x288ecc||[];var _0x53e523=[];if(_0x288ecc){for(var _0x100982=0x0;_0x100982<_0x288ecc[_0x1192('0x42')];_0x100982+=0x1){var _0x417b13=_0x288ecc[_0x100982][_0x1192('0x28')]({'plain':!![]});_0x5ca4f3[_0x1192('0x9f')]=_0x542b86[_0x1192('0x53')][_0x1192('0x9f')]?_0x542b86[_0x1192('0x53')]['dialCheckDuplicateType']:_0x5ca4f3[_0x1192('0x9f')];switch(_0x5ca4f3['dialCheckDuplicateType']){case'always':_0x2e1329=squel[_0x1192('0xa0')]()[_0x1192('0xa1')]('cm_hopper')[_0x1192('0xa2')](['phone',_0x1192('0xa3'),_0x1192('0xa4'),'ListId',_0x1192('0x63'),_0x1192('0x5b'),'updatedAt'],squel[_0x1192('0x82')]()['field'](_0x1192('0xa5'),_0x1192('0xa5'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27','scheduledAt')[_0x1192('0x83')]('id',_0x1192('0xa4'))['field'](_0x417b13[_0x1192('0xa6')][_0x1192('0xa7')](),_0x1192('0xa8'))['field'](_0x542b86[_0x1192('0x50')]['id'][_0x1192('0xa7')](),_0x1192('0x63'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27',_0x1192('0x5b'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27',_0x1192('0x5c'))[_0x1192('0xa9')]('cm_contacts')[_0x1192('0x47')](_0x1192('0xaa'))[_0x1192('0x47')](_0x1192('0xab'),_0x417b13[_0x1192('0xa6')][_0x1192('0xa7')]())[_0x1192('0x47')](_0x1192('0xac'))[_0x1192('0x47')](_0x1192('0xad'),squel[_0x1192('0x82')]()[_0x1192('0x83')](_0x1192('0xae'))[_0x1192('0xa9')](_0x1192('0xaf'))['where'](_0x1192('0x87'),_0x542b86[_0x1192('0x50')]['id']['toString']()))['where'](_0x1192('0xad'),squel[_0x1192('0x82')]()[_0x1192('0x83')](_0x1192('0xb0'))[_0x1192('0xa9')](_0x1192('0xb1'))[_0x1192('0x47')](_0x1192('0x87'),_0x542b86[_0x1192('0x50')]['id'][_0x1192('0xa7')]())))['toString']();break;case _0x1192('0xb2'):_0x2e1329=squel[_0x1192('0xa0')]()[_0x1192('0xa1')](_0x1192('0xb1'))['fromQuery']([_0x1192('0xa5'),_0x1192('0xa3'),_0x1192('0xa4'),_0x1192('0xa8'),_0x1192('0x63'),_0x1192('0x5b'),'updatedAt'],squel['select']()[_0x1192('0x83')](_0x1192('0xa5'),_0x1192('0xa5'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27','scheduledAt')[_0x1192('0x83')]('id',_0x1192('0xa4'))[_0x1192('0x83')](_0x417b13['CmListId'][_0x1192('0xa7')](),_0x1192('0xa8'))[_0x1192('0x83')](_0x542b86[_0x1192('0x50')]['id'][_0x1192('0xa7')](),_0x1192('0x63'))['field']('\x27'+_0x30bfd4+'\x27',_0x1192('0x5b'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27',_0x1192('0x5c'))[_0x1192('0xa9')]('cm_contacts')['where'](_0x1192('0xaa'))[_0x1192('0x47')]('ListId\x20=\x20?',_0x417b13[_0x1192('0xa6')][_0x1192('0xa7')]())[_0x1192('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x1192('0xad'),squel['select']()[_0x1192('0x83')](_0x1192('0xb0'))[_0x1192('0xa9')](_0x1192('0xb1'))[_0x1192('0x47')](_0x1192('0x87'),_0x542b86[_0x1192('0x50')]['id']['toString']())))['toString']();break;default:_0x2e1329=squel[_0x1192('0xa0')]()[_0x1192('0xa1')](_0x1192('0xb1'))[_0x1192('0xa2')](['phone',_0x1192('0xa3'),_0x1192('0xa4'),'ListId',_0x1192('0x63'),_0x1192('0x5b'),'updatedAt'],squel['select']()['field'](_0x1192('0xa5'),_0x1192('0xa5'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27',_0x1192('0xa3'))[_0x1192('0x83')]('id',_0x1192('0xa4'))[_0x1192('0x83')](_0x417b13[_0x1192('0xa6')][_0x1192('0xa7')](),_0x1192('0xa8'))[_0x1192('0x83')](_0x542b86['params']['id'][_0x1192('0xa7')](),_0x1192('0x63'))['field']('\x27'+_0x30bfd4+'\x27',_0x1192('0x5b'))[_0x1192('0x83')]('\x27'+_0x30bfd4+'\x27',_0x1192('0x5c'))[_0x1192('0xa9')](_0x1192('0xb3'))[_0x1192('0x47')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x417b13[_0x1192('0xa6')][_0x1192('0xa7')]())[_0x1192('0x47')](_0x1192('0xac')))[_0x1192('0xa7')]();}_0x53e523['push'](db[_0x1192('0x89')]['query'](_0x2e1329));}return BPromise['all'](_0x53e523);}})['then'](function(){var _0x570146=[];var _0x580d04=squel[_0x1192('0xa0')]()[_0x1192('0xa1')](_0x1192('0xb4'))[_0x1192('0xa2')]([_0x1192('0xb5'),_0x1192('0xa5'),_0x1192('0xb6'),_0x1192('0x5b'),_0x1192('0x5c')],squel[_0x1192('0x82')]()[_0x1192('0x83')](_0x1192('0xb7'))['field'](_0x1192('0xb8'))[_0x1192('0x83')](_0x1192('0xb9'))['field']('\x27'+_0x30bfd4+'\x27',_0x1192('0x5b'))['field']('\x27'+_0x30bfd4+'\x27','updatedAt')[_0x1192('0xa9')](_0x1192('0xba'),'ci')[_0x1192('0x85')](_0x1192('0xb1'),'h',_0x1192('0xbb'))[_0x1192('0x47')]('h.scheduledat=?',_0x30bfd4)['where'](_0x1192('0xbc'),'PHONE'))[_0x1192('0xa7')]();_0x570146[_0x1192('0xbd')](db[_0x1192('0x89')]['query'](_0x580d04));return BPromise[_0x1192('0x8d')](_0x570146);})[_0x1192('0x26')](function(){return _0x2a8e25;})[_0x1192('0x26')](respondWithResult(_0x21a126,null))[_0x1192('0x4e')](handleError(_0x21a126,null));};exports['removeLists']=function(_0x214180,_0x30cb75,_0x357c51){return db['VoiceQueue'][_0x1192('0x51')]({'where':{'id':_0x214180[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x30cb75,null))[_0x1192('0x26')](function(_0x2f6b94){if(_0x2f6b94){return _0x2f6b94[_0x1192('0xbe')](_0x214180[_0x1192('0x3c')][_0x1192('0x94')]);}})[_0x1192('0x26')](function(_0x23b100){if(_0x23b100){return db[_0x1192('0x64')]['destroy']({'where':{'ListId':_0x214180[_0x1192('0x3c')]['ids'],'VoiceQueueId':_0x214180[_0x1192('0x50')]['id']}})[_0x1192('0x26')](function(){return _0x23b100;});}})[_0x1192('0x26')](respondWithStatusCode(_0x30cb75,null))['catch'](handleError(_0x30cb75,null));};exports['getBlackLists']=function(_0x3135ac,_0x30694c,_0x11dd10){var _0xef4ade={};var _0x14ae5b={};var _0x239d6a;var _0x55f418;return db[_0x1192('0x37')][_0x1192('0x61')]({'where':{'id':_0x3135ac[_0x1192('0x50')]['id']}})['then'](handleEntityNotFound(_0x30694c,null))[_0x1192('0x26')](function(_0x16b19b){if(_0x16b19b){_0x239d6a=_0x16b19b;_0x14ae5b[_0x1192('0x3b')]=_[_0x1192('0x3d')](db[_0x1192('0x9c')][_0x1192('0x38')]);_0x14ae5b[_0x1192('0x3c')]=_[_0x1192('0x3d')](_0x3135ac[_0x1192('0x3c')]);_0x14ae5b[_0x1192('0x3e')]=_[_0x1192('0x3f')](_0x14ae5b[_0x1192('0x3b')],_0x14ae5b[_0x1192('0x3c')]);_0xef4ade['attributes']=_['intersection'](_0x14ae5b[_0x1192('0x3b')],qs[_0x1192('0x41')](_0x3135ac['query'][_0x1192('0x41')]));_0xef4ade['attributes']=_0xef4ade[_0x1192('0x40')][_0x1192('0x42')]?_0xef4ade[_0x1192('0x40')]:_0x14ae5b[_0x1192('0x3b')];_0xef4ade[_0x1192('0x45')]=qs[_0x1192('0x46')](_0x3135ac[_0x1192('0x3c')][_0x1192('0x46')]);_0xef4ade[_0x1192('0x47')]=qs[_0x1192('0x3e')](_['pick'](_0x3135ac[_0x1192('0x3c')],_0x14ae5b['filters']));if(_0x3135ac['query'][_0x1192('0x2d')]){_0xef4ade[_0x1192('0x47')]=_['merge'](_0xef4ade[_0x1192('0x47')],{'$or':_[_0x1192('0x2f')](_0xef4ade['attributes'],function(_0x1e1019){var _0x31512d={};_0x31512d[_0x1e1019]={'$like':'%'+_0x3135ac[_0x1192('0x3c')][_0x1192('0x2d')]+'%'};return _0x31512d;})});}_0xef4ade=_[_0x1192('0x49')]({},_0xef4ade,_0x3135ac[_0x1192('0x4b')]);return _0x239d6a['getBlackLists'](_0xef4ade);}})[_0x1192('0x26')](function(_0x4e1159){if(_0x4e1159){_0x55f418=_0x4e1159[_0x1192('0x42')];if(!_0x3135ac[_0x1192('0x3c')]['hasOwnProperty'](_0x1192('0x62'))){_0xef4ade[_0x1192('0x44')]=qs['limit'](_0x3135ac[_0x1192('0x3c')][_0x1192('0x44')]);_0xef4ade[_0x1192('0x21')]=qs['offset'](_0x3135ac[_0x1192('0x3c')][_0x1192('0x21')]);}return _0x239d6a[_0x1192('0xbf')](_0xef4ade);}})[_0x1192('0x26')](function(_0x41cf19){if(_0x41cf19){return _0x41cf19?{'count':_0x55f418,'rows':_0x41cf19}:null;}})[_0x1192('0x26')](respondWithResult(_0x30694c,null))[_0x1192('0x4e')](handleError(_0x30694c,null));};exports[_0x1192('0xc0')]=function(_0x3df503,_0x479fdf,_0x1e5886){var _0x5d64a4,_0x438747;return db['VoiceQueue'][_0x1192('0x51')]({'where':{'id':_0x3df503[_0x1192('0x50')]['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x479fdf,null))[_0x1192('0x26')](function(_0x2df342){if(_0x2df342){_0x438747=_0x2df342;return _0x2df342[_0x1192('0xc0')](_0x3df503['body'][_0x1192('0x94')],_[_0x1192('0x5a')](_0x3df503[_0x1192('0x53')],[_0x1192('0x94'),'id'])||{});}return null;})[_0x1192('0x95')](function(_0x1c75cc){var _0x2e1776;_0x5d64a4=_0x1c75cc||[];var _0x15d001=[];if(_0x1c75cc){for(var _0x413883=0x0;_0x413883<_0x1c75cc['length'];_0x413883+=0x1){var _0x545c06=_0x1c75cc[_0x413883][_0x1192('0x28')]({'plain':!![]});_0x2e1776=squel[_0x1192('0xa0')]()[_0x1192('0xa1')]('cm_hopper_black')[_0x1192('0xa2')]([_0x1192('0xa5'),'ContactId',_0x1192('0xa8'),_0x1192('0x63'),'createdAt',_0x1192('0x5c')],squel[_0x1192('0x82')]()[_0x1192('0x83')](_0x1192('0xa5'),_0x1192('0xa5'))[_0x1192('0x83')]('id','ContactId')['field'](_0x545c06[_0x1192('0xa6')][_0x1192('0xa7')](),'ListId')[_0x1192('0x83')](_0x3df503[_0x1192('0x50')]['id']['toString'](),'VoiceQueueId')['field'](_0x1192('0xc1'),_0x1192('0x5b'))[_0x1192('0x83')]('NOW()',_0x1192('0x5c'))['from'](_0x1192('0xb3'))[_0x1192('0x47')](_0x1192('0xaa'))[_0x1192('0x47')](_0x1192('0xab'),_0x545c06[_0x1192('0xa6')]['toString']())['where'](_0x1192('0xac')))[_0x1192('0xa7')]();_0x15d001[_0x1192('0xbd')](db[_0x1192('0x89')][_0x1192('0x3c')](_0x2e1776));}return BPromise[_0x1192('0x8d')](_0x15d001);}})['then'](function(){return _0x5d64a4;})['then'](respondWithResult(_0x479fdf,null))[_0x1192('0x4e')](handleError(_0x479fdf,null));};exports['removeBlackLists']=function(_0x38e7f6,_0x9117a6,_0x547edf){return db[_0x1192('0x37')][_0x1192('0x51')]({'where':{'id':_0x38e7f6['params']['id']}})[_0x1192('0x26')](handleEntityNotFound(_0x9117a6,null))[_0x1192('0x26')](function(_0x56ed7a){if(_0x56ed7a){return _0x56ed7a[_0x1192('0xc2')](_0x38e7f6[_0x1192('0x3c')][_0x1192('0x94')]);}})[_0x1192('0x26')](function(_0xe988c4){if(_0xe988c4){return db[_0x1192('0x6b')][_0x1192('0x27')]({'where':{'ListId':_0x38e7f6[_0x1192('0x3c')][_0x1192('0x94')],'VoiceQueueId':_0x38e7f6[_0x1192('0x50')]['id']}})[_0x1192('0x26')](function(){return _0xe988c4;});}})[_0x1192('0x26')](respondWithStatusCode(_0x9117a6,null))[_0x1192('0x4e')](handleError(_0x9117a6,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index bb1d364..864034a 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 _0xe1ae=['../../mysqldb','VoiceQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x1e2cff,_0x122a92){var _0x3c9938=function(_0x236d98){while(--_0x236d98){_0x1e2cff['push'](_0x1e2cff['shift']());}};_0x3c9938(++_0x122a92);}(_0xe1ae,0x186));var _0xee1a=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0xe1ae[_0x48bc0d];return _0x35f641;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xee1a('0x0'))['db'][_0xee1a('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xee1a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xee1a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x194489){return function(_0x402ed6,_0x184e4f,_0x2c6271){VoiceQueueEvents[_0xee1a('0x4')](_0x194489+':'+_0x402ed6['id'],_0x402ed6);VoiceQueueEvents['emit'](_0x194489,_0x402ed6);_0x2c6271(null);};}for(var e in events){if(events[_0xee1a('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x190e=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x190e,0x126));var _0xe190=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x190e[_0x1afabf];return _0x497ff1;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xe190('0x0'))['db'][_0xe190('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe190('0x2')](0x0);var events={'afterCreate':_0xe190('0x3'),'afterUpdate':_0xe190('0x4'),'afterDestroy':_0xe190('0x5')};function emitEvent(_0x3664a1){return function(_0x3be15f,_0x48eb3b,_0x3a2b9b){VoiceQueueEvents[_0xe190('0x6')](_0x3664a1+':'+_0x3be15f['id'],_0x3be15f);VoiceQueueEvents[_0xe190('0x6')](_0x3664a1,_0x3be15f);_0x3a2b9b(null);};}for(var e in events){if(events[_0xe190('0x7')](e)){var event=events[e];VoiceQueue[_0xe190('0x8')](e,emitEvent(event));}}module[_0xe190('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2d29759..802f0b8 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x294676,_0x5837ca){var _0x5b3894=function(_0x3836b5){while(--_0x3836b5){_0x294676['push'](_0x294676['shift']());}};_0x5b3894(++_0x5837ca);}(_0xedd9,0xfc));var _0x9edd=function(_0x110364,_0x4d93ff){_0x110364=_0x110364-0x0;var _0x458e88=_0xedd9[_0x110364];return _0x458e88;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','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(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x55ca,0x126));var _0xa55c=function(_0x1e79b9,_0x223ef3){_0x1e79b9=_0x1e79b9-0x0;var _0x2c2d29=_0x55ca[_0x1e79b9];return _0x2c2d29;};'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 824721d..e5c8ac3 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 _0xfc4d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xfc4d,0x16e));var _0xdfc4=function(_0x4fedd4,_0x1dbf05){_0x4fedd4=_0x4fedd4-0x0;var _0x5dce0d=_0xfc4d[_0x4fedd4];return _0x5dce0d;};'use strict';var _=require(_0xdfc4('0x0'));var util=require(_0xdfc4('0x1'));var moment=require('moment');var BPromise=require(_0xdfc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfc4('0x3'));var db=require(_0xdfc4('0x4'))['db'];var utils=require(_0xdfc4('0x5'));var logger=require(_0xdfc4('0x6'))(_0xdfc4('0x7'));var config=require(_0xdfc4('0x8'));var jayson=require(_0xdfc4('0x9'));var client=jayson[_0xdfc4('0xa')][_0xdfc4('0xb')]({'port':0x232a});config['redis']=_[_0xdfc4('0xc')](config[_0xdfc4('0xd')],{'host':_0xdfc4('0xe'),'port':0x18eb});var socket=require(_0xdfc4('0xf'))(new Redis(config[_0xdfc4('0xd')]));require(_0xdfc4('0x10'))['register'](socket);function respondWithRpcPromise(_0x5e2df9,_0x19f47,_0xf3b094){return new BPromise(function(_0x323669,_0x5722da){return client['request'](_0x5e2df9,_0xf3b094)['then'](function(_0x331850){logger[_0xdfc4('0x11')](_0xdfc4('0x12'),_0x19f47,_0xdfc4('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x19f47,_0xdfc4('0x13'),JSON['stringify'](_0x331850));if(_0x331850[_0xdfc4('0x14')]){if(_0x331850['error'][_0xdfc4('0x15')]===0x1f4){logger['error'](_0xdfc4('0x12'),_0x19f47,_0x331850['error'][_0xdfc4('0x16')]);return _0x5722da(_0x331850['error'][_0xdfc4('0x16')]);}logger['error'](_0xdfc4('0x12'),_0x19f47,_0x331850['error'][_0xdfc4('0x16')]);return _0x323669(_0x331850['error']['message']);}else{logger[_0xdfc4('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x19f47,_0xdfc4('0x13'));_0x323669(_0x331850[_0xdfc4('0x17')][_0xdfc4('0x16')]);}})['catch'](function(_0x7a15aa){logger[_0xdfc4('0x14')](_0xdfc4('0x12'),_0x19f47,_0x7a15aa);_0x5722da(_0x7a15aa);});});}exports[_0xdfc4('0x18')]=function(_0x3e434e){var _0xe8afb7=this;return new Promise(function(_0x436a97,_0x4f6b46){return db['VoiceQueue'][_0xdfc4('0x19')]({'raw':_0x3e434e[_0xdfc4('0x1a')]?_0x3e434e[_0xdfc4('0x1a')][_0xdfc4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e434e['options']?_0x3e434e[_0xdfc4('0x1a')][_0xdfc4('0x1c')]||null:null,'attributes':_0x3e434e[_0xdfc4('0x1a')]?_0x3e434e[_0xdfc4('0x1a')][_0xdfc4('0x1d')]||null:null,'limit':_0x3e434e[_0xdfc4('0x1a')]?_0x3e434e['options'][_0xdfc4('0x1e')]||null:null,'include':_0x3e434e[_0xdfc4('0x1a')]?_0x3e434e[_0xdfc4('0x1a')][_0xdfc4('0x1f')]?_['map'](_0x3e434e['options']['include'],function(_0x316457){return{'model':db[_0x316457['model']],'as':_0x316457['as'],'attributes':_0x316457[_0xdfc4('0x1d')],'include':_0x316457[_0xdfc4('0x1f')]?_[_0xdfc4('0x20')](_0x316457[_0xdfc4('0x1f')],function(_0x4cc293){return{'model':db[_0x4cc293[_0xdfc4('0x21')]],'as':_0x4cc293['as'],'attributes':_0x4cc293[_0xdfc4('0x1d')],'include':_0x4cc293['include']?_[_0xdfc4('0x20')](_0x4cc293[_0xdfc4('0x1f')],function(_0x92a694){return{'model':db[_0x92a694['model']],'as':_0x92a694['as'],'attributes':_0x92a694[_0xdfc4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdfc4('0x22')](function(_0x5481ee){logger[_0xdfc4('0x11')]('GetVoiceQueue',_0x3e434e);logger[_0xdfc4('0x23')](_0xdfc4('0x18'),_0x3e434e,JSON[_0xdfc4('0x24')](_0x5481ee));_0x436a97(_0x5481ee);})[_0xdfc4('0x25')](function(_0x441e0f){logger[_0xdfc4('0x14')](_0xdfc4('0x18'),_0x441e0f[_0xdfc4('0x16')],_0x3e434e);_0x4f6b46(_0xe8afb7[_0xdfc4('0x14')](0x1f4,_0x441e0f[_0xdfc4('0x16')]));});});};exports[_0xdfc4('0x26')]=function(_0x3c796b){var _0x4fa0bd=this;return new Promise(function(_0x5229d0,_0x15cda9){return db[_0xdfc4('0x27')][_0xdfc4('0x28')]({'raw':_0x3c796b[_0xdfc4('0x1a')]?_0x3c796b[_0xdfc4('0x1a')][_0xdfc4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c796b['options']?_0x3c796b[_0xdfc4('0x1a')][_0xdfc4('0x1c')]||null:null,'attributes':_0x3c796b[_0xdfc4('0x1a')]?_0x3c796b[_0xdfc4('0x1a')][_0xdfc4('0x1d')]||null:null,'include':_0x3c796b['options']?_0x3c796b[_0xdfc4('0x1a')][_0xdfc4('0x1f')]?_[_0xdfc4('0x20')](_0x3c796b['options'][_0xdfc4('0x1f')],function(_0x48e1e9){return{'model':db[_0x48e1e9[_0xdfc4('0x21')]],'as':_0x48e1e9['as'],'attributes':_0x48e1e9[_0xdfc4('0x1d')],'include':_0x48e1e9[_0xdfc4('0x1f')]?_[_0xdfc4('0x20')](_0x48e1e9[_0xdfc4('0x1f')],function(_0xaac5){return{'model':db[_0xaac5[_0xdfc4('0x21')]],'as':_0xaac5['as'],'attributes':_0xaac5[_0xdfc4('0x1d')],'include':_0xaac5[_0xdfc4('0x1f')]?_[_0xdfc4('0x20')](_0xaac5[_0xdfc4('0x1f')],function(_0x135b7b){return{'model':db[_0x135b7b[_0xdfc4('0x21')]],'as':_0x135b7b['as'],'attributes':_0x135b7b[_0xdfc4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdfc4('0x22')](function(_0x535042){logger['info'](_0xdfc4('0x26'),_0x3c796b);logger[_0xdfc4('0x23')](_0xdfc4('0x26'),_0x3c796b,JSON[_0xdfc4('0x24')](_0x535042));_0x5229d0(_0x535042);})[_0xdfc4('0x25')](function(_0x4ad3c8){logger[_0xdfc4('0x14')](_0xdfc4('0x26'),_0x4ad3c8[_0xdfc4('0x16')],_0x3c796b);_0x15cda9(_0x4fa0bd['error'](0x1f4,_0x4ad3c8[_0xdfc4('0x16')]));});});}; \ No newline at end of file +var _0xcfc1=['code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','attributes','include','map','model','catch','ShowVoiceQueue','find','raw','where','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x59f8c7,_0x40d086){var _0xbd5cf7=function(_0x399fa9){while(--_0x399fa9){_0x59f8c7['push'](_0x59f8c7['shift']());}};_0xbd5cf7(++_0x40d086);}(_0xcfc1,0x1b2));var _0x1cfc=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xcfc1[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0x1cfc('0x0'));var util=require(_0x1cfc('0x1'));var moment=require(_0x1cfc('0x2'));var BPromise=require('bluebird');var rs=require(_0x1cfc('0x3'));var fs=require('fs');var Redis=require(_0x1cfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1cfc('0x5'));var config=require(_0x1cfc('0x6'));var jayson=require(_0x1cfc('0x7'));var client=jayson[_0x1cfc('0x8')][_0x1cfc('0x9')]({'port':0x232a});config[_0x1cfc('0xa')]=_['defaults'](config[_0x1cfc('0xa')],{'host':_0x1cfc('0xb'),'port':0x18eb});var socket=require(_0x1cfc('0xc'))(new Redis(config[_0x1cfc('0xa')]));require(_0x1cfc('0xd'))['register'](socket);function respondWithRpcPromise(_0x5c9bf8,_0x19be60,_0x42b521){return new BPromise(function(_0x3cf275,_0x8094b7){return client[_0x1cfc('0xe')](_0x5c9bf8,_0x42b521)[_0x1cfc('0xf')](function(_0x6295f8){logger[_0x1cfc('0x10')](_0x1cfc('0x11'),_0x19be60,_0x1cfc('0x12'));logger[_0x1cfc('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x19be60,_0x1cfc('0x12'),JSON[_0x1cfc('0x14')](_0x6295f8));if(_0x6295f8[_0x1cfc('0x15')]){if(_0x6295f8['error'][_0x1cfc('0x16')]===0x1f4){logger[_0x1cfc('0x15')](_0x1cfc('0x11'),_0x19be60,_0x6295f8[_0x1cfc('0x15')][_0x1cfc('0x17')]);return _0x8094b7(_0x6295f8['error'][_0x1cfc('0x17')]);}logger[_0x1cfc('0x15')](_0x1cfc('0x11'),_0x19be60,_0x6295f8[_0x1cfc('0x15')][_0x1cfc('0x17')]);return _0x3cf275(_0x6295f8['error'][_0x1cfc('0x17')]);}else{logger[_0x1cfc('0x10')](_0x1cfc('0x11'),_0x19be60,_0x1cfc('0x12'));_0x3cf275(_0x6295f8[_0x1cfc('0x18')]['message']);}})['catch'](function(_0x7a5b6a){logger[_0x1cfc('0x15')](_0x1cfc('0x11'),_0x19be60,_0x7a5b6a);_0x8094b7(_0x7a5b6a);});});}exports[_0x1cfc('0x19')]=function(_0x4e2d6e){var _0x5d0520=this;return new Promise(function(_0x5ee033,_0x527438){return db[_0x1cfc('0x1a')][_0x1cfc('0x1b')]({'raw':_0x4e2d6e['options']?_0x4e2d6e[_0x1cfc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4e2d6e[_0x1cfc('0x1c')]?_0x4e2d6e[_0x1cfc('0x1c')]['where']||null:null,'attributes':_0x4e2d6e[_0x1cfc('0x1c')]?_0x4e2d6e[_0x1cfc('0x1c')][_0x1cfc('0x1d')]||null:null,'limit':_0x4e2d6e[_0x1cfc('0x1c')]?_0x4e2d6e['options']['limit']||null:null,'include':_0x4e2d6e[_0x1cfc('0x1c')]?_0x4e2d6e[_0x1cfc('0x1c')][_0x1cfc('0x1e')]?_[_0x1cfc('0x1f')](_0x4e2d6e[_0x1cfc('0x1c')]['include'],function(_0x524cd2){return{'model':db[_0x524cd2[_0x1cfc('0x20')]],'as':_0x524cd2['as'],'attributes':_0x524cd2[_0x1cfc('0x1d')],'include':_0x524cd2['include']?_[_0x1cfc('0x1f')](_0x524cd2['include'],function(_0x221db3){return{'model':db[_0x221db3['model']],'as':_0x221db3['as'],'attributes':_0x221db3['attributes'],'include':_0x221db3[_0x1cfc('0x1e')]?_['map'](_0x221db3[_0x1cfc('0x1e')],function(_0x57215e){return{'model':db[_0x57215e[_0x1cfc('0x20')]],'as':_0x57215e['as'],'attributes':_0x57215e[_0x1cfc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x534c0b){logger[_0x1cfc('0x10')](_0x1cfc('0x19'),_0x4e2d6e);logger['debug'](_0x1cfc('0x19'),_0x4e2d6e,JSON[_0x1cfc('0x14')](_0x534c0b));_0x5ee033(_0x534c0b);})[_0x1cfc('0x21')](function(_0x4e7b10){logger['error'](_0x1cfc('0x19'),_0x4e7b10[_0x1cfc('0x17')],_0x4e2d6e);_0x527438(_0x5d0520['error'](0x1f4,_0x4e7b10[_0x1cfc('0x17')]));});});};exports[_0x1cfc('0x22')]=function(_0x12d15a){var _0x4e1076=this;return new Promise(function(_0x4764af,_0x4f3026){return db[_0x1cfc('0x1a')][_0x1cfc('0x23')]({'raw':_0x12d15a[_0x1cfc('0x1c')]?_0x12d15a['options'][_0x1cfc('0x24')]===undefined?!![]:![]:!![],'where':_0x12d15a[_0x1cfc('0x1c')]?_0x12d15a[_0x1cfc('0x1c')][_0x1cfc('0x25')]||null:null,'attributes':_0x12d15a[_0x1cfc('0x1c')]?_0x12d15a[_0x1cfc('0x1c')][_0x1cfc('0x1d')]||null:null,'include':_0x12d15a[_0x1cfc('0x1c')]?_0x12d15a[_0x1cfc('0x1c')][_0x1cfc('0x1e')]?_[_0x1cfc('0x1f')](_0x12d15a[_0x1cfc('0x1c')][_0x1cfc('0x1e')],function(_0x183d82){return{'model':db[_0x183d82[_0x1cfc('0x20')]],'as':_0x183d82['as'],'attributes':_0x183d82['attributes'],'include':_0x183d82[_0x1cfc('0x1e')]?_[_0x1cfc('0x1f')](_0x183d82[_0x1cfc('0x1e')],function(_0x3df964){return{'model':db[_0x3df964[_0x1cfc('0x20')]],'as':_0x3df964['as'],'attributes':_0x3df964['attributes'],'include':_0x3df964[_0x1cfc('0x1e')]?_[_0x1cfc('0x1f')](_0x3df964[_0x1cfc('0x1e')],function(_0x3e98cb){return{'model':db[_0x3e98cb['model']],'as':_0x3e98cb['as'],'attributes':_0x3e98cb[_0x1cfc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1cfc('0xf')](function(_0x4aed8b){logger[_0x1cfc('0x10')](_0x1cfc('0x22'),_0x12d15a);logger['debug'](_0x1cfc('0x22'),_0x12d15a,JSON[_0x1cfc('0x14')](_0x4aed8b));_0x4764af(_0x4aed8b);})[_0x1cfc('0x21')](function(_0x1465eb){logger[_0x1cfc('0x15')](_0x1cfc('0x22'),_0x1465eb['message'],_0x12d15a);_0x4f3026(_0x4e1076[_0x1cfc('0x15')](0x1f4,_0x1465eb[_0x1cfc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c1246fd..79d805f 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 _0xd832=['voiceQueue:','save','update','removeListener','register','length'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0xd832,0x145));var _0x2d83=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xd832[_0x187ee1];return _0x388160;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x2d83('0x0'),'remove',_0x2d83('0x1')];function createListener(_0x116057,_0x203551){return function(_0x475267){_0x203551['emit'](_0x116057,_0x475267);};}function removeListener(_0x5e8564,_0x465fcc){return function(){VoiceQueueEvents[_0x2d83('0x2')](_0x5e8564,_0x465fcc);};}exports[_0x2d83('0x3')]=function(_0x2ece58){for(var _0x320d05=0x0,_0x8142c3=events[_0x2d83('0x4')];_0x320d05<_0x8142c3;_0x320d05++){var _0x128c12=events[_0x320d05];var _0x3663de=createListener(_0x2d83('0x5')+_0x128c12,_0x2ece58);VoiceQueueEvents['on'](_0x128c12,_0x3663de);}}; \ No newline at end of file +var _0x8c2b=['save','remove','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x29d74f,_0x524926){var _0x49e8f2=function(_0x3a9abd){while(--_0x3a9abd){_0x29d74f['push'](_0x29d74f['shift']());}};_0x49e8f2(++_0x524926);}(_0x8c2b,0x8b));var _0xb8c2=function(_0x2e4a7c,_0x336e11){_0x2e4a7c=_0x2e4a7c-0x0;var _0x2d067e=_0x8c2b[_0x2e4a7c];return _0x2d067e;};'use strict';var VoiceQueueEvents=require(_0xb8c2('0x0'));var events=[_0xb8c2('0x1'),_0xb8c2('0x2'),'update'];function createListener(_0x3725ba,_0x4d279d){return function(_0x218e68){_0x4d279d['emit'](_0x3725ba,_0x218e68);};}function removeListener(_0x5903cf,_0x4067bb){return function(){VoiceQueueEvents[_0xb8c2('0x3')](_0x5903cf,_0x4067bb);};}exports[_0xb8c2('0x4')]=function(_0x5b3ea1){for(var _0x435055=0x0,_0x24e8c5=events[_0xb8c2('0x5')];_0x435055<_0x24e8c5;_0x435055++){var _0x19324f=events[_0x435055];var _0x465784=createListener(_0xb8c2('0x6')+_0x19324f,_0x5b3ea1);VoiceQueueEvents['on'](_0x19324f,_0x465784);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b5c53cd..3268112 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 _0xc2c7=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc2c7,0x72));var _0x7c2c=function(_0x55b7c7,_0x48fff0){_0x55b7c7=_0x55b7c7-0x0;var _0x541363=_0xc2c7[_0x55b7c7];return _0x541363;};'use strict';var multer=require(_0x7c2c('0x0'));var util=require(_0x7c2c('0x1'));var path=require(_0x7c2c('0x2'));var timeout=require(_0x7c2c('0x3'));var express=require(_0x7c2c('0x4'));var router=express[_0x7c2c('0x5')]();var fs_extra=require(_0x7c2c('0x6'));var auth=require(_0x7c2c('0x7'));var interaction=require(_0x7c2c('0x8'));var config=require('../../config/environment');var controller=require(_0x7c2c('0x9'));router[_0x7c2c('0xa')]('/',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xc')]);router[_0x7c2c('0xa')](_0x7c2c('0xd'),auth[_0x7c2c('0xe')](),controller[_0x7c2c('0xf')]);router['get'](_0x7c2c('0x10'),auth[_0x7c2c('0xe')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x12')]('/',auth[_0x7c2c('0xe')](),controller[_0x7c2c('0x13')]);router['put'](_0x7c2c('0x10'),auth[_0x7c2c('0xe')](),controller[_0x7c2c('0x14')]);router[_0x7c2c('0x15')]('/:id',auth[_0x7c2c('0xe')](),controller[_0x7c2c('0x16')]);module[_0x7c2c('0x17')]=router; \ No newline at end of file +var _0xca73=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca73,0x1ee));var _0x3ca7=function(_0x4b4844,_0x2f0dfb){_0x4b4844=_0x4b4844-0x0;var _0x575192=_0xca73[_0x4b4844];return _0x575192;};'use strict';var multer=require(_0x3ca7('0x0'));var util=require(_0x3ca7('0x1'));var path=require('path');var timeout=require(_0x3ca7('0x2'));var express=require(_0x3ca7('0x3'));var router=express[_0x3ca7('0x4')]();var fs_extra=require(_0x3ca7('0x5'));var auth=require(_0x3ca7('0x6'));var interaction=require(_0x3ca7('0x7'));var config=require(_0x3ca7('0x8'));var controller=require(_0x3ca7('0x9'));router[_0x3ca7('0xa')]('/',auth[_0x3ca7('0xb')](),controller['index']);router[_0x3ca7('0xa')](_0x3ca7('0xc'),auth[_0x3ca7('0xb')](),controller[_0x3ca7('0xd')]);router[_0x3ca7('0xa')](_0x3ca7('0xe'),auth['isAuthenticated'](),controller[_0x3ca7('0xf')]);router[_0x3ca7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3ca7('0x10')]);router[_0x3ca7('0x11')]('/',auth[_0x3ca7('0xb')](),controller[_0x3ca7('0x12')]);router[_0x3ca7('0x13')](_0x3ca7('0x14'),auth[_0x3ca7('0xb')](),controller[_0x3ca7('0x15')]);router[_0x3ca7('0x16')](_0x3ca7('0x14'),auth[_0x3ca7('0xb')](),controller[_0x3ca7('0x17')]);module[_0x3ca7('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 79da261..c74fddc 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 _0xe614=['STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe614,0x1a2));var _0x4e61=function(_0x2ac8f0,_0x21d3df){_0x2ac8f0=_0x2ac8f0-0x0;var _0x4e9e93=_0xe614[_0x2ac8f0];return _0x4e9e93;};'use strict';var Sequelize=require(_0x4e61('0x0'));var moment=require('moment');module[_0x4e61('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4e61('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4e61('0x2')]},'queue':{'type':Sequelize[_0x4e61('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x4e61('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3309aa){var _0xf54fa7=moment(_0x3309aa);var _0x37f085=moment(this[_0x4e61('0x4')](_0x4e61('0x5')))['format'](_0x4e61('0x6'));var _0x2db070=_0xf54fa7[_0x4e61('0x7')](_0x37f085,_0x4e61('0x8'));this['setDataValue'](_0x4e61('0x9'),_0x3309aa);this['setDataValue'](_0x4e61('0xa'),_0x2db070||null);}},'position':{'type':Sequelize[_0x4e61('0xb')]},'count':{'type':Sequelize[_0x4e61('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x4e61('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x4e61('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4e61('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4e61('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x4e61('0x2')],'comment':_0x4e61('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4e61('0x2')]},'connectedlinename':{'type':Sequelize[_0x4e61('0x2')]},'accountcode':{'type':Sequelize[_0x4e61('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4e61('0x2')]},'priority':{'type':Sequelize[_0x4e61('0x2')]},'holdtime':{'type':Sequelize[_0x4e61('0xb')]},'mohtime':{'type':Sequelize[_0x4e61('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4e61('0x2')]},'transfer':{'type':Sequelize[_0x4e61('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4e61('0x2')],'comment':_0x4e61('0xe')},'transferexten':{'type':Sequelize[_0x4e61('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4e61('0x2')]},'disposition':{'type':Sequelize[_0x4e61('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x4e61('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe64=['sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3e6e53,_0x230804){var _0x138bd0=function(_0x2652e7){while(--_0x2652e7){_0x3e6e53['push'](_0x3e6e53['shift']());}};_0x138bd0(++_0x230804);}(_0xbe64,0x9c));var _0x4be6=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0xbe64[_0xbc346f];return _0x9f9260;};'use strict';var Sequelize=require(_0x4be6('0x0'));var moment=require('moment');module[_0x4be6('0x1')]={'type':{'type':Sequelize[_0x4be6('0x2')]},'uniqueid':{'type':Sequelize[_0x4be6('0x2')]},'calleridnum':{'type':Sequelize[_0x4be6('0x2')]},'calleridname':{'type':Sequelize[_0x4be6('0x2')]},'queue':{'type':Sequelize[_0x4be6('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x4be6('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x5dd90c){var _0x225499=moment(_0x5dd90c);var _0x724b2d=moment(this[_0x4be6('0x4')]('queuecallerjoinAt'))['format'](_0x4be6('0x5'));var _0x4e0195=_0x225499[_0x4be6('0x6')](_0x724b2d,_0x4be6('0x7'));this['setDataValue']('queuecallerleaveAt',_0x5dd90c);this['setDataValue'](_0x4be6('0x8'),_0x4e0195||null);}},'position':{'type':Sequelize[_0x4be6('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x4be6('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4be6('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x4be6('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x4be6('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4be6('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x4be6('0x2')],'comment':_0x4be6('0xb')},'originalposition':{'type':Sequelize[_0x4be6('0x9')]},'channel':{'type':Sequelize[_0x4be6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4be6('0x2')]},'connectedlinename':{'type':Sequelize[_0x4be6('0x2')]},'accountcode':{'type':Sequelize[_0x4be6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4be6('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4be6('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4be6('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4be6('0x2')]},'transfer':{'type':Sequelize[_0x4be6('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4be6('0x2')],'comment':_0x4be6('0xc')},'transferexten':{'type':Sequelize[_0x4be6('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4be6('0x2')]},'disposition':{'type':Sequelize[_0x4be6('0x2')]},'secondDisposition':{'type':Sequelize[_0x4be6('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x4be6('0x9')],'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 2ebde97..eff7950 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 _0x38bb=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','include','rows','show','includeAll','options','find','create','body','catch','params','describe','getVoiceQueuesReport','pick','findAll','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x38bb,0x95));var _0xb38b=function(_0x1424a7,_0x370b52){_0x1424a7=_0x1424a7-0x0;var _0x1cb452=_0x38bb[_0x1424a7];return _0x1cb452;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb38b('0x0'));var zipdir=require(_0xb38b('0x1'));var jsonpatch=require(_0xb38b('0x2'));var rp=require(_0xb38b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb38b('0x4'));var util=require(_0xb38b('0x5'));var path=require(_0xb38b('0x6'));var sox=require('sox');var csv=require(_0xb38b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb38b('0x8'));var _=require(_0xb38b('0x9'));var squel=require('squel');var crypto=require(_0xb38b('0xa'));var jsforce=require(_0xb38b('0xb'));var deskjs=require(_0xb38b('0xc'));var toCsv=require(_0xb38b('0x7'));var querystring=require(_0xb38b('0xd'));var Papa=require(_0xb38b('0xe'));var Redis=require('ioredis');var authService=require(_0xb38b('0xf'));var qs=require(_0xb38b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb38b('0x11'));var logger=require(_0xb38b('0x12'))(_0xb38b('0x13'));var utils=require(_0xb38b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb38b('0x15'));var db=require(_0xb38b('0x16'))['db'];config[_0xb38b('0x17')]=_[_0xb38b('0x18')](config[_0xb38b('0x17')],{'host':_0xb38b('0x19'),'port':0x18eb});var socket=require(_0xb38b('0x1a'))(new Redis(config[_0xb38b('0x17')]));require(_0xb38b('0x1b'))[_0xb38b('0x1c')](socket);function respondWithStatusCode(_0x53c5af,_0x5c3ae6){_0x5c3ae6=_0x5c3ae6||0xcc;return function(_0x339344){if(_0x339344){return _0x53c5af[_0xb38b('0x1d')](_0x5c3ae6);}return _0x53c5af[_0xb38b('0x1e')](_0x5c3ae6)[_0xb38b('0x1f')]();};}function respondWithResult(_0x2ed39d,_0x5e2b36){_0x5e2b36=_0x5e2b36||0xc8;return function(_0x136eab){if(_0x136eab){return _0x2ed39d[_0xb38b('0x1e')](_0x5e2b36)[_0xb38b('0x20')](_0x136eab);}};}function respondWithFilteredResult(_0x1d15a2,_0x1d322c){return function(_0x3aec5d){if(_0x3aec5d){var _0x352fc7=typeof _0x1d322c[_0xb38b('0x21')]===_0xb38b('0x22')&&typeof _0x1d322c[_0xb38b('0x23')]==='undefined';var _0x1a9475=_0x3aec5d[_0xb38b('0x24')];var _0x51d688=_0x352fc7?0x0:_0x1d322c[_0xb38b('0x21')];var _0x6e77b3=_0x352fc7?_0x3aec5d[_0xb38b('0x24')]:_0x1d322c['offset']+_0x1d322c['limit'];var _0x12ebb2;if(_0x6e77b3>=_0x1a9475){_0x6e77b3=_0x1a9475;_0x12ebb2=0xc8;}else{_0x12ebb2=0xce;}_0x1d15a2[_0xb38b('0x1e')](_0x12ebb2);return _0x1d15a2['set'](_0xb38b('0x25'),_0x51d688+'-'+_0x6e77b3+'/'+_0x1a9475)['json'](_0x3aec5d);}return null;};}function patchUpdates(_0x17a79f){return function(_0x36dd3b){try{jsonpatch[_0xb38b('0x26')](_0x36dd3b,_0x17a79f,!![]);}catch(_0x4e9145){return BPromise[_0xb38b('0x27')](_0x4e9145);}return _0x36dd3b[_0xb38b('0x28')]();};}function saveUpdates(_0x2cfad2,_0x312a03){return function(_0x1087af){if(_0x1087af){return _0x1087af[_0xb38b('0x29')](_0x2cfad2)[_0xb38b('0x2a')](function(_0x125939){return _0x125939;});}return null;};}function removeEntity(_0x170dfc,_0x25b8f4){return function(_0x286ac3){if(_0x286ac3){return _0x286ac3[_0xb38b('0x2b')]()[_0xb38b('0x2a')](function(){_0x170dfc['status'](0xcc)[_0xb38b('0x1f')]();});}};}function handleEntityNotFound(_0x48b36a,_0x55f143){return function(_0x48af6d){if(!_0x48af6d){_0x48b36a[_0xb38b('0x1d')](0x194);}return _0x48af6d;};}function handleError(_0x40f14f,_0x9ce315){_0x9ce315=_0x9ce315||0x1f4;return function(_0x3ee094){logger[_0xb38b('0x2c')](_0x3ee094[_0xb38b('0x2d')]);if(_0x3ee094[_0xb38b('0x2e')]){delete _0x3ee094[_0xb38b('0x2e')];}_0x40f14f[_0xb38b('0x1e')](_0x9ce315)[_0xb38b('0x2f')](_0x3ee094);};}exports[_0xb38b('0x30')]=function(_0x35b113,_0x57c12c){var _0x50f3f5={},_0xc4805c={},_0xe524e8={'count':0x0,'rows':[]};var _0x14ff8d=_[_0xb38b('0x31')](db[_0xb38b('0x32')][_0xb38b('0x33')],function(_0x2fe848){return{'name':_0x2fe848['fieldName'],'type':_0x2fe848[_0xb38b('0x34')][_0xb38b('0x35')]};});_0xc4805c['model']=_[_0xb38b('0x31')](_0x14ff8d,'name');_0xc4805c[_0xb38b('0x36')]=_[_0xb38b('0x37')](_0x35b113[_0xb38b('0x36')]);_0xc4805c['filters']=_['intersection'](_0xc4805c[_0xb38b('0x38')],_0xc4805c[_0xb38b('0x36')]);_0x50f3f5[_0xb38b('0x39')]=_[_0xb38b('0x3a')](_0xc4805c[_0xb38b('0x38')],qs[_0xb38b('0x3b')](_0x35b113[_0xb38b('0x36')][_0xb38b('0x3b')]));_0x50f3f5[_0xb38b('0x39')]=_0x50f3f5[_0xb38b('0x39')][_0xb38b('0x3c')]?_0x50f3f5[_0xb38b('0x39')]:_0xc4805c[_0xb38b('0x38')];if(!_0x35b113['query'][_0xb38b('0x3d')](_0xb38b('0x3e'))){_0x50f3f5[_0xb38b('0x23')]=qs[_0xb38b('0x23')](_0x35b113[_0xb38b('0x36')]['limit']);_0x50f3f5['offset']=qs[_0xb38b('0x21')](_0x35b113['query'][_0xb38b('0x21')]);}_0x50f3f5[_0xb38b('0x3f')]=qs[_0xb38b('0x40')](_0x35b113[_0xb38b('0x36')][_0xb38b('0x40')]);_0x50f3f5[_0xb38b('0x41')]=qs['filters'](_['pick'](_0x35b113['query'],_0xc4805c[_0xb38b('0x42')]),_0x14ff8d);if(_0x35b113[_0xb38b('0x36')][_0xb38b('0x43')]){_0x50f3f5[_0xb38b('0x41')]=_[_0xb38b('0x44')](_0x50f3f5['where'],{'$or':_[_0xb38b('0x31')](_0x14ff8d,function(_0x18fb25){if(_0x18fb25['type']!=='VIRTUAL'){var _0x391fb2={};_0x391fb2[_0x18fb25['name']]={'$like':'%'+_0x35b113[_0xb38b('0x36')][_0xb38b('0x43')]+'%'};return _0x391fb2;}})});}_0x50f3f5=_[_0xb38b('0x44')]({},_0x50f3f5,_0x35b113['options']);var _0x5e86ab={'where':_0x50f3f5[_0xb38b('0x41')]};return db[_0xb38b('0x32')][_0xb38b('0x24')](_0x5e86ab)['then'](function(_0x2bf49d){_0xe524e8[_0xb38b('0x24')]=_0x2bf49d;if(_0x35b113[_0xb38b('0x36')]['includeAll']){_0x50f3f5[_0xb38b('0x45')]=[{'all':!![]}];}return db[_0xb38b('0x32')]['findAll'](_0x50f3f5);})[_0xb38b('0x2a')](function(_0x34ed61){_0xe524e8[_0xb38b('0x46')]=_0x34ed61;return _0xe524e8;})[_0xb38b('0x2a')](respondWithFilteredResult(_0x57c12c,_0x50f3f5))['catch'](handleError(_0x57c12c,null));};exports[_0xb38b('0x47')]=function(_0x40c91b,_0x3db2a3){var _0x2a47e8={'raw':![],'where':{'id':_0x40c91b['params']['id']}},_0xb2468d={};_0xb2468d[_0xb38b('0x38')]=_['keys'](db['VoiceQueueReport'][_0xb38b('0x33')]);_0xb2468d[_0xb38b('0x36')]=_[_0xb38b('0x37')](_0x40c91b['query']);_0xb2468d[_0xb38b('0x42')]=_[_0xb38b('0x3a')](_0xb2468d[_0xb38b('0x38')],_0xb2468d[_0xb38b('0x36')]);_0x2a47e8[_0xb38b('0x39')]=_[_0xb38b('0x3a')](_0xb2468d[_0xb38b('0x38')],qs[_0xb38b('0x3b')](_0x40c91b['query'][_0xb38b('0x3b')]));_0x2a47e8[_0xb38b('0x39')]=_0x2a47e8[_0xb38b('0x39')][_0xb38b('0x3c')]?_0x2a47e8[_0xb38b('0x39')]:_0xb2468d['model'];if(_0x40c91b[_0xb38b('0x36')][_0xb38b('0x48')]){_0x2a47e8[_0xb38b('0x45')]=[{'all':!![]}];}_0x2a47e8=_[_0xb38b('0x44')]({},_0x2a47e8,_0x40c91b[_0xb38b('0x49')]);return db[_0xb38b('0x32')][_0xb38b('0x4a')](_0x2a47e8)[_0xb38b('0x2a')](handleEntityNotFound(_0x3db2a3,null))[_0xb38b('0x2a')](respondWithResult(_0x3db2a3,null))['catch'](handleError(_0x3db2a3,null));};exports['create']=function(_0x3d2288,_0x32963f){return db[_0xb38b('0x32')][_0xb38b('0x4b')](_0x3d2288[_0xb38b('0x4c')],{})[_0xb38b('0x2a')](respondWithResult(_0x32963f,0xc9))[_0xb38b('0x4d')](handleError(_0x32963f,null));};exports['update']=function(_0x422ee9,_0x10aaea){if(_0x422ee9[_0xb38b('0x4c')]['id']){delete _0x422ee9[_0xb38b('0x4c')]['id'];}return db[_0xb38b('0x32')][_0xb38b('0x4a')]({'where':{'id':_0x422ee9[_0xb38b('0x4e')]['id']}})[_0xb38b('0x2a')](handleEntityNotFound(_0x10aaea,null))[_0xb38b('0x2a')](saveUpdates(_0x422ee9[_0xb38b('0x4c')],null))['then'](respondWithResult(_0x10aaea,null))[_0xb38b('0x4d')](handleError(_0x10aaea,null));};exports['destroy']=function(_0x57aa6b,_0x3f42f7){return db[_0xb38b('0x32')][_0xb38b('0x4a')]({'where':{'id':_0x57aa6b[_0xb38b('0x4e')]['id']}})[_0xb38b('0x2a')](handleEntityNotFound(_0x3f42f7,null))[_0xb38b('0x2a')](removeEntity(_0x3f42f7,null))[_0xb38b('0x4d')](handleError(_0x3f42f7,null));};exports[_0xb38b('0x4f')]=function(_0x37ba47,_0xa4a4e3){return db[_0xb38b('0x32')]['describe']()[_0xb38b('0x2a')](respondWithResult(_0xa4a4e3,null))[_0xb38b('0x4d')](handleError(_0xa4a4e3,null));};exports[_0xb38b('0x50')]=function(_0x36eadc,_0x1c38f1){var _0x8c6b21={},_0x14d222={},_0x1941be={'count':0x0,'rows':[]};_0x14d222['model']=_[_0xb38b('0x37')](db[_0xb38b('0x32')][_0xb38b('0x33')]);_0x14d222[_0xb38b('0x36')]=_['keys'](_0x36eadc[_0xb38b('0x36')]);_0x14d222[_0xb38b('0x42')]=_[_0xb38b('0x3a')](_0x14d222['model'],_0x14d222[_0xb38b('0x36')]);_0x8c6b21['attributes']=_[_0xb38b('0x3a')](_0x14d222[_0xb38b('0x38')],qs[_0xb38b('0x3b')](_0x36eadc['query'][_0xb38b('0x3b')]));_0x8c6b21[_0xb38b('0x39')]=_0x8c6b21[_0xb38b('0x39')][_0xb38b('0x3c')]?_0x8c6b21['attributes']:_0x14d222[_0xb38b('0x38')];if(!_0x36eadc['query'][_0xb38b('0x3d')]('nolimit')){_0x8c6b21[_0xb38b('0x23')]=qs['limit'](_0x36eadc[_0xb38b('0x36')][_0xb38b('0x23')]);_0x8c6b21[_0xb38b('0x21')]=qs[_0xb38b('0x21')](_0x36eadc[_0xb38b('0x36')][_0xb38b('0x21')]);}_0x8c6b21[_0xb38b('0x3f')]=qs[_0xb38b('0x40')](_0x36eadc['query'][_0xb38b('0x40')]);_0x8c6b21[_0xb38b('0x41')]=qs[_0xb38b('0x42')](_[_0xb38b('0x51')](_0x36eadc[_0xb38b('0x36')],_0x14d222['filters']));if(_0x36eadc['query'][_0xb38b('0x43')]){_0x8c6b21[_0xb38b('0x41')]=_['merge'](_0x8c6b21[_0xb38b('0x41')],{'$or':_[_0xb38b('0x31')](_0x8c6b21[_0xb38b('0x39')],function(_0x5c34e9){var _0x37af6e={};_0x37af6e[_0x5c34e9]={'$like':'%'+_0x36eadc[_0xb38b('0x36')][_0xb38b('0x43')]+'%'};return _0x37af6e;})});}_0x8c6b21=_[_0xb38b('0x44')]({},_0x8c6b21,_0x36eadc['options']);var _0x34e558={'where':_0x8c6b21['where']};return db[_0xb38b('0x32')]['count'](_0x34e558)['then'](function(_0x487223){_0x1941be[_0xb38b('0x24')]=_0x487223;if(_0x36eadc[_0xb38b('0x36')][_0xb38b('0x48')]){_0x8c6b21[_0xb38b('0x45')]=[{'all':!![]}];}return db[_0xb38b('0x32')][_0xb38b('0x52')](_0x8c6b21);})['then'](function(_0x359be5){_0x1941be['rows']=_0x359be5;return _0x1941be;})['then'](respondWithFilteredResult(_0x1c38f1,_0x8c6b21,_0xb38b('0x50')))[_0xb38b('0x4d')](handleError(_0x1c38f1,null,_0xb38b('0x50')));}; \ No newline at end of file +var _0xf106=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','send','index','map','VoiceQueueReport','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','merge','VIRTUAL','include','findAll','catch','show','rawAttributes','includeAll','options','find','create','body','params','describe','getVoiceQueuesReport','sort','pick','filter','rows','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf106,0xdf));var _0x6f10=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0xf106[_0x2da357];return _0x138fdd;};'use strict';var emlformat=require(_0x6f10('0x0'));var rimraf=require(_0x6f10('0x1'));var zipdir=require(_0x6f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f10('0x3'));var moment=require(_0x6f10('0x4'));var BPromise=require(_0x6f10('0x5'));var Mustache=require(_0x6f10('0x6'));var util=require(_0x6f10('0x7'));var path=require('path');var sox=require(_0x6f10('0x8'));var csv=require('to-csv');var ejs=require(_0x6f10('0x9'));var fs=require('fs');var fs_extra=require(_0x6f10('0xa'));var _=require(_0x6f10('0xb'));var squel=require(_0x6f10('0xc'));var crypto=require(_0x6f10('0xd'));var jsforce=require(_0x6f10('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f10('0xf'));var Papa=require(_0x6f10('0x10'));var Redis=require(_0x6f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f10('0x12'));var as=require(_0x6f10('0x13'));var hardwareService=require(_0x6f10('0x14'));var logger=require(_0x6f10('0x15'))('api');var utils=require(_0x6f10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f10('0x17'));var db=require(_0x6f10('0x18'))['db'];config[_0x6f10('0x19')]=_[_0x6f10('0x1a')](config[_0x6f10('0x19')],{'host':_0x6f10('0x1b'),'port':0x18eb});var socket=require(_0x6f10('0x1c'))(new Redis(config[_0x6f10('0x19')]));require(_0x6f10('0x1d'))[_0x6f10('0x1e')](socket);function respondWithStatusCode(_0x1dfb6d,_0x1a8054){_0x1a8054=_0x1a8054||0xcc;return function(_0x3f450d){if(_0x3f450d){return _0x1dfb6d[_0x6f10('0x1f')](_0x1a8054);}return _0x1dfb6d[_0x6f10('0x20')](_0x1a8054)[_0x6f10('0x21')]();};}function respondWithResult(_0x4219d0,_0x302699){_0x302699=_0x302699||0xc8;return function(_0x19f3ee){if(_0x19f3ee){return _0x4219d0[_0x6f10('0x20')](_0x302699)[_0x6f10('0x22')](_0x19f3ee);}};}function respondWithFilteredResult(_0x2a2fae,_0x501c79){return function(_0x3ccc3b){if(_0x3ccc3b){var _0x28a4d8=typeof _0x501c79[_0x6f10('0x23')]===_0x6f10('0x24')&&typeof _0x501c79[_0x6f10('0x25')]===_0x6f10('0x24');var _0x32c813=_0x3ccc3b['count'];var _0x30f1ab=_0x28a4d8?0x0:_0x501c79[_0x6f10('0x23')];var _0x69799b=_0x28a4d8?_0x3ccc3b[_0x6f10('0x26')]:_0x501c79[_0x6f10('0x23')]+_0x501c79[_0x6f10('0x25')];var _0x36a238;if(_0x69799b>=_0x32c813){_0x69799b=_0x32c813;_0x36a238=0xc8;}else{_0x36a238=0xce;}_0x2a2fae[_0x6f10('0x20')](_0x36a238);return _0x2a2fae[_0x6f10('0x27')](_0x6f10('0x28'),_0x30f1ab+'-'+_0x69799b+'/'+_0x32c813)[_0x6f10('0x22')](_0x3ccc3b);}return null;};}function patchUpdates(_0x4d1dac){return function(_0x17ed4d){try{jsonpatch['apply'](_0x17ed4d,_0x4d1dac,!![]);}catch(_0x5a1af0){return BPromise['reject'](_0x5a1af0);}return _0x17ed4d[_0x6f10('0x29')]();};}function saveUpdates(_0x2d9788,_0x56df13){return function(_0x32ac56){if(_0x32ac56){return _0x32ac56[_0x6f10('0x2a')](_0x2d9788)[_0x6f10('0x2b')](function(_0x437a3a){return _0x437a3a;});}return null;};}function removeEntity(_0x4651b7,_0x910598){return function(_0x331572){if(_0x331572){return _0x331572[_0x6f10('0x2c')]()['then'](function(){_0x4651b7[_0x6f10('0x20')](0xcc)[_0x6f10('0x21')]();});}};}function handleEntityNotFound(_0x592523,_0x45a158){return function(_0x7ea826){if(!_0x7ea826){_0x592523[_0x6f10('0x1f')](0x194);}return _0x7ea826;};}function handleError(_0x3a07fa,_0x632908){_0x632908=_0x632908||0x1f4;return function(_0x5594d4){logger[_0x6f10('0x2d')](_0x5594d4[_0x6f10('0x2e')]);if(_0x5594d4['name']){delete _0x5594d4['name'];}_0x3a07fa[_0x6f10('0x20')](_0x632908)[_0x6f10('0x2f')](_0x5594d4);};}exports[_0x6f10('0x30')]=function(_0x3d5f7a,_0x2bef18){var _0xdf7616={},_0x1ff787={},_0x5687e1={'count':0x0,'rows':[]};var _0x3e5a88=_[_0x6f10('0x31')](db[_0x6f10('0x32')]['rawAttributes'],function(_0x26b5b2){return{'name':_0x26b5b2[_0x6f10('0x33')],'type':_0x26b5b2['type']['key']};});_0x1ff787[_0x6f10('0x34')]=_['map'](_0x3e5a88,_0x6f10('0x35'));_0x1ff787[_0x6f10('0x36')]=_[_0x6f10('0x37')](_0x3d5f7a[_0x6f10('0x36')]);_0x1ff787[_0x6f10('0x38')]=_[_0x6f10('0x39')](_0x1ff787[_0x6f10('0x34')],_0x1ff787[_0x6f10('0x36')]);_0xdf7616['attributes']=_[_0x6f10('0x39')](_0x1ff787[_0x6f10('0x34')],qs['fields'](_0x3d5f7a['query'][_0x6f10('0x3a')]));_0xdf7616[_0x6f10('0x3b')]=_0xdf7616[_0x6f10('0x3b')][_0x6f10('0x3c')]?_0xdf7616[_0x6f10('0x3b')]:_0x1ff787[_0x6f10('0x34')];if(!_0x3d5f7a[_0x6f10('0x36')][_0x6f10('0x3d')]('nolimit')){_0xdf7616['limit']=qs[_0x6f10('0x25')](_0x3d5f7a['query'][_0x6f10('0x25')]);_0xdf7616[_0x6f10('0x23')]=qs[_0x6f10('0x23')](_0x3d5f7a[_0x6f10('0x36')][_0x6f10('0x23')]);}_0xdf7616[_0x6f10('0x3e')]=qs['sort'](_0x3d5f7a[_0x6f10('0x36')]['sort']);_0xdf7616[_0x6f10('0x3f')]=qs[_0x6f10('0x38')](_['pick'](_0x3d5f7a[_0x6f10('0x36')],_0x1ff787['filters']),_0x3e5a88);if(_0x3d5f7a[_0x6f10('0x36')]['filter']){_0xdf7616[_0x6f10('0x3f')]=_[_0x6f10('0x40')](_0xdf7616[_0x6f10('0x3f')],{'$or':_['map'](_0x3e5a88,function(_0x1de0a4){if(_0x1de0a4['type']!==_0x6f10('0x41')){var _0x548e30={};_0x548e30[_0x1de0a4['name']]={'$like':'%'+_0x3d5f7a[_0x6f10('0x36')]['filter']+'%'};return _0x548e30;}})});}_0xdf7616=_[_0x6f10('0x40')]({},_0xdf7616,_0x3d5f7a['options']);var _0x1e6bb1={'where':_0xdf7616[_0x6f10('0x3f')]};return db[_0x6f10('0x32')]['count'](_0x1e6bb1)[_0x6f10('0x2b')](function(_0x3156e1){_0x5687e1[_0x6f10('0x26')]=_0x3156e1;if(_0x3d5f7a[_0x6f10('0x36')]['includeAll']){_0xdf7616[_0x6f10('0x42')]=[{'all':!![]}];}return db[_0x6f10('0x32')][_0x6f10('0x43')](_0xdf7616);})['then'](function(_0x5f27b2){_0x5687e1['rows']=_0x5f27b2;return _0x5687e1;})[_0x6f10('0x2b')](respondWithFilteredResult(_0x2bef18,_0xdf7616))[_0x6f10('0x44')](handleError(_0x2bef18,null));};exports[_0x6f10('0x45')]=function(_0x19206d,_0x118e10){var _0x39b619={'raw':![],'where':{'id':_0x19206d['params']['id']}},_0x313e42={};_0x313e42[_0x6f10('0x34')]=_[_0x6f10('0x37')](db[_0x6f10('0x32')][_0x6f10('0x46')]);_0x313e42[_0x6f10('0x36')]=_[_0x6f10('0x37')](_0x19206d[_0x6f10('0x36')]);_0x313e42[_0x6f10('0x38')]=_[_0x6f10('0x39')](_0x313e42[_0x6f10('0x34')],_0x313e42[_0x6f10('0x36')]);_0x39b619[_0x6f10('0x3b')]=_['intersection'](_0x313e42['model'],qs['fields'](_0x19206d['query'][_0x6f10('0x3a')]));_0x39b619[_0x6f10('0x3b')]=_0x39b619[_0x6f10('0x3b')][_0x6f10('0x3c')]?_0x39b619[_0x6f10('0x3b')]:_0x313e42[_0x6f10('0x34')];if(_0x19206d[_0x6f10('0x36')][_0x6f10('0x47')]){_0x39b619['include']=[{'all':!![]}];}_0x39b619=_['merge']({},_0x39b619,_0x19206d[_0x6f10('0x48')]);return db[_0x6f10('0x32')][_0x6f10('0x49')](_0x39b619)[_0x6f10('0x2b')](handleEntityNotFound(_0x118e10,null))[_0x6f10('0x2b')](respondWithResult(_0x118e10,null))[_0x6f10('0x44')](handleError(_0x118e10,null));};exports[_0x6f10('0x4a')]=function(_0x441be7,_0x3c704b){return db[_0x6f10('0x32')][_0x6f10('0x4a')](_0x441be7['body'],{})[_0x6f10('0x2b')](respondWithResult(_0x3c704b,0xc9))[_0x6f10('0x44')](handleError(_0x3c704b,null));};exports[_0x6f10('0x2a')]=function(_0x5ed303,_0x468db4){if(_0x5ed303[_0x6f10('0x4b')]['id']){delete _0x5ed303['body']['id'];}return db[_0x6f10('0x32')][_0x6f10('0x49')]({'where':{'id':_0x5ed303[_0x6f10('0x4c')]['id']}})['then'](handleEntityNotFound(_0x468db4,null))[_0x6f10('0x2b')](saveUpdates(_0x5ed303[_0x6f10('0x4b')],null))[_0x6f10('0x2b')](respondWithResult(_0x468db4,null))[_0x6f10('0x44')](handleError(_0x468db4,null));};exports[_0x6f10('0x2c')]=function(_0x4a8cba,_0x1717f8){return db[_0x6f10('0x32')]['find']({'where':{'id':_0x4a8cba[_0x6f10('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1717f8,null))[_0x6f10('0x2b')](removeEntity(_0x1717f8,null))[_0x6f10('0x44')](handleError(_0x1717f8,null));};exports[_0x6f10('0x4d')]=function(_0x1fe874,_0x222980){return db[_0x6f10('0x32')][_0x6f10('0x4d')]()['then'](respondWithResult(_0x222980,null))['catch'](handleError(_0x222980,null));};exports[_0x6f10('0x4e')]=function(_0x50fdcc,_0x55fdcb){var _0x2d5d73={},_0x3bca86={},_0x24641d={'count':0x0,'rows':[]};_0x3bca86[_0x6f10('0x34')]=_[_0x6f10('0x37')](db['VoiceQueueReport'][_0x6f10('0x46')]);_0x3bca86[_0x6f10('0x36')]=_['keys'](_0x50fdcc['query']);_0x3bca86[_0x6f10('0x38')]=_[_0x6f10('0x39')](_0x3bca86[_0x6f10('0x34')],_0x3bca86['query']);_0x2d5d73[_0x6f10('0x3b')]=_[_0x6f10('0x39')](_0x3bca86[_0x6f10('0x34')],qs[_0x6f10('0x3a')](_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x3a')]));_0x2d5d73['attributes']=_0x2d5d73['attributes'][_0x6f10('0x3c')]?_0x2d5d73['attributes']:_0x3bca86[_0x6f10('0x34')];if(!_0x50fdcc[_0x6f10('0x36')]['hasOwnProperty']('nolimit')){_0x2d5d73['limit']=qs[_0x6f10('0x25')](_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x25')]);_0x2d5d73[_0x6f10('0x23')]=qs[_0x6f10('0x23')](_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x23')]);}_0x2d5d73[_0x6f10('0x3e')]=qs['sort'](_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x4f')]);_0x2d5d73['where']=qs[_0x6f10('0x38')](_[_0x6f10('0x50')](_0x50fdcc['query'],_0x3bca86['filters']));if(_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x51')]){_0x2d5d73[_0x6f10('0x3f')]=_[_0x6f10('0x40')](_0x2d5d73[_0x6f10('0x3f')],{'$or':_[_0x6f10('0x31')](_0x2d5d73[_0x6f10('0x3b')],function(_0xd67845){var _0x1a2922={};_0x1a2922[_0xd67845]={'$like':'%'+_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x51')]+'%'};return _0x1a2922;})});}_0x2d5d73=_[_0x6f10('0x40')]({},_0x2d5d73,_0x50fdcc[_0x6f10('0x48')]);var _0x3e3782={'where':_0x2d5d73[_0x6f10('0x3f')]};return db[_0x6f10('0x32')]['count'](_0x3e3782)[_0x6f10('0x2b')](function(_0x470255){_0x24641d[_0x6f10('0x26')]=_0x470255;if(_0x50fdcc[_0x6f10('0x36')][_0x6f10('0x47')]){_0x2d5d73[_0x6f10('0x42')]=[{'all':!![]}];}return db[_0x6f10('0x32')][_0x6f10('0x43')](_0x2d5d73);})['then'](function(_0x4a3d0b){_0x24641d[_0x6f10('0x52')]=_0x4a3d0b;return _0x24641d;})['then'](respondWithFilteredResult(_0x55fdcb,_0x2d5d73,_0x6f10('0x4e')))[_0x6f10('0x44')](handleError(_0x55fdcb,null,_0x6f10('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f8314b1..331f390 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 _0x34b3=['VoiceQueueReport','update','remove','emit','hook','../../mysqldb'];(function(_0x5d5825,_0x3bd511){var _0x51953f=function(_0x51486b){while(--_0x51486b){_0x5d5825['push'](_0x5d5825['shift']());}};_0x51953f(++_0x3bd511);}(_0x34b3,0x1eb));var _0x334b=function(_0x2bd8e9,_0xfffb77){_0x2bd8e9=_0x2bd8e9-0x0;var _0x5a586f=_0x34b3[_0x2bd8e9];return _0x5a586f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x334b('0x0'))['db'][_0x334b('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x334b('0x2'),'afterDestroy':_0x334b('0x3')};function emitEvent(_0xed21a3){return function(_0x3a85c4,_0x14960b,_0x5d4a87){VoiceQueueReportEvents[_0x334b('0x4')](_0xed21a3+':'+_0x3a85c4['id'],_0x3a85c4);VoiceQueueReportEvents['emit'](_0xed21a3,_0x3a85c4);_0x5d4a87(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x334b('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xcef6=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x4ce3bf,_0x17ad19){var _0x422bbc=function(_0x345dfa){while(--_0x345dfa){_0x4ce3bf['push'](_0x4ce3bf['shift']());}};_0x422bbc(++_0x17ad19);}(_0xcef6,0x104));var _0x6cef=function(_0x16ed87,_0x1be1a2){_0x16ed87=_0x16ed87-0x0;var _0xc1a1d8=_0xcef6[_0x16ed87];return _0xc1a1d8;};'use strict';var EventEmitter=require(_0x6cef('0x0'));var VoiceQueueReport=require(_0x6cef('0x1'))['db'][_0x6cef('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6cef('0x3')](0x0);var events={'afterCreate':_0x6cef('0x4'),'afterUpdate':_0x6cef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x570303){return function(_0x360c2a,_0x54e186,_0x516c7c){VoiceQueueReportEvents[_0x6cef('0x6')](_0x570303+':'+_0x360c2a['id'],_0x360c2a);VoiceQueueReportEvents[_0x6cef('0x6')](_0x570303,_0x360c2a);_0x516c7c(null);};}for(var e in events){if(events[_0x6cef('0x7')](e)){var event=events[e];VoiceQueueReport[_0x6cef('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 1f18a7d..719d991 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 _0xf276=['request-promise','path','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x54ceed,_0x1f67d9){var _0xeaede=function(_0x53971a){while(--_0x53971a){_0x54ceed['push'](_0x54ceed['shift']());}};_0xeaede(++_0x1f67d9);}(_0xf276,0x8b));var _0x6f27=function(_0x541090,_0x982a26){_0x541090=_0x541090-0x0;var _0x21d833=_0xf276[_0x541090];return _0x21d833;};'use strict';var _=require(_0x6f27('0x0'));var util=require(_0x6f27('0x1'));var logger=require(_0x6f27('0x2'))('api');var moment=require(_0x6f27('0x3'));var BPromise=require(_0x6f27('0x4'));var rp=require(_0x6f27('0x5'));var fs=require('fs');var path=require(_0x6f27('0x6'));var rimraf=require('rimraf');var config=require(_0x6f27('0x7'));var attributes=require(_0x6f27('0x8'));module['exports']=function(_0x19ce6a,_0x360571){return _0x19ce6a['define'](_0x6f27('0x9'),attributes,{'tableName':_0x6f27('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6f27('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc97d=['define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0xc2029,_0x569647){var _0x25d5ab=function(_0x36ddf0){while(--_0x36ddf0){_0xc2029['push'](_0xc2029['shift']());}};_0x25d5ab(++_0x569647);}(_0xc97d,0x12a));var _0xdc97=function(_0x47f076,_0x5413ca){_0x47f076=_0x47f076-0x0;var _0x32836f=_0xc97d[_0x47f076];return _0x32836f;};'use strict';var _=require(_0xdc97('0x0'));var util=require(_0xdc97('0x1'));var logger=require(_0xdc97('0x2'))(_0xdc97('0x3'));var moment=require(_0xdc97('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc97('0x5'));var fs=require('fs');var path=require(_0xdc97('0x6'));var rimraf=require('rimraf');var config=require(_0xdc97('0x7'));var attributes=require(_0xdc97('0x8'));module[_0xdc97('0x9')]=function(_0x44dd93,_0x156ec7){return _0x44dd93[_0xdc97('0xa')](_0xdc97('0xb'),attributes,{'tableName':_0xdc97('0xc'),'paranoid':![],'indexes':[{'fields':[_0xdc97('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 315ee48..8164fc7 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 _0x0cfa=['redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','include','model','map','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cfa,0x1ec));var _0xa0cf=function(_0x588d74,_0x4124b5){_0x588d74=_0x588d74-0x0;var _0x5b5b6b=_0x0cfa[_0x588d74];return _0x5b5b6b;};'use strict';var _=require(_0xa0cf('0x0'));var util=require('util');var moment=require(_0xa0cf('0x1'));var BPromise=require(_0xa0cf('0x2'));var rs=require(_0xa0cf('0x3'));var fs=require('fs');var Redis=require(_0xa0cf('0x4'));var db=require(_0xa0cf('0x5'))['db'];var utils=require(_0xa0cf('0x6'));var logger=require(_0xa0cf('0x7'))(_0xa0cf('0x8'));var config=require(_0xa0cf('0x9'));var jayson=require(_0xa0cf('0xa'));var client=jayson[_0xa0cf('0xb')][_0xa0cf('0xc')]({'port':0x232a});config['redis']=_[_0xa0cf('0xd')](config[_0xa0cf('0xe')],{'host':_0xa0cf('0xf'),'port':0x18eb});var socket=require(_0xa0cf('0x10'))(new Redis(config[_0xa0cf('0xe')]));require(_0xa0cf('0x11'))[_0xa0cf('0x12')](socket);function respondWithRpcPromise(_0x4994b9,_0x44a394,_0x34d2a1){return new BPromise(function(_0x647572,_0x4f04d5){return client[_0xa0cf('0x13')](_0x4994b9,_0x34d2a1)[_0xa0cf('0x14')](function(_0x3b2de7){logger[_0xa0cf('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x44a394,_0xa0cf('0x16'));logger[_0xa0cf('0x17')](_0xa0cf('0x18'),_0x44a394,'request\x20sent',JSON['stringify'](_0x3b2de7));if(_0x3b2de7[_0xa0cf('0x19')]){if(_0x3b2de7[_0xa0cf('0x19')][_0xa0cf('0x1a')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x44a394,_0x3b2de7[_0xa0cf('0x19')][_0xa0cf('0x1b')]);return _0x4f04d5(_0x3b2de7[_0xa0cf('0x19')]['message']);}logger[_0xa0cf('0x19')](_0xa0cf('0x1c'),_0x44a394,_0x3b2de7[_0xa0cf('0x19')][_0xa0cf('0x1b')]);return _0x647572(_0x3b2de7['error'][_0xa0cf('0x1b')]);}else{logger[_0xa0cf('0x15')](_0xa0cf('0x1c'),_0x44a394,'request\x20sent');_0x647572(_0x3b2de7[_0xa0cf('0x1d')]['message']);}})[_0xa0cf('0x1e')](function(_0x183c52){logger['error'](_0xa0cf('0x1c'),_0x44a394,_0x183c52);_0x4f04d5(_0x183c52);});});}exports['GetVoiceQueueReport']=function(_0x34a863){var _0x29e988=this;return new Promise(function(_0x47e878,_0x323f1a){return db[_0xa0cf('0x1f')][_0xa0cf('0x20')]({'raw':_0x34a863[_0xa0cf('0x21')]?_0x34a863[_0xa0cf('0x21')][_0xa0cf('0x22')]===undefined?!![]:![]:!![],'where':_0x34a863['options']?_0x34a863['options'][_0xa0cf('0x23')]||null:null,'attributes':_0x34a863[_0xa0cf('0x21')]?_0x34a863['options'][_0xa0cf('0x24')]||null:null,'limit':_0x34a863[_0xa0cf('0x21')]?_0x34a863[_0xa0cf('0x21')]['limit']||null:null,'include':_0x34a863[_0xa0cf('0x21')]?_0x34a863[_0xa0cf('0x21')][_0xa0cf('0x25')]?_['map'](_0x34a863[_0xa0cf('0x21')]['include'],function(_0x2b66b2){return{'model':db[_0x2b66b2[_0xa0cf('0x26')]],'as':_0x2b66b2['as'],'attributes':_0x2b66b2[_0xa0cf('0x24')],'include':_0x2b66b2[_0xa0cf('0x25')]?_[_0xa0cf('0x27')](_0x2b66b2['include'],function(_0xf73284){return{'model':db[_0xf73284[_0xa0cf('0x26')]],'as':_0xf73284['as'],'attributes':_0xf73284[_0xa0cf('0x24')],'include':_0xf73284[_0xa0cf('0x25')]?_[_0xa0cf('0x27')](_0xf73284[_0xa0cf('0x25')],function(_0x1c339c){return{'model':db[_0x1c339c[_0xa0cf('0x26')]],'as':_0x1c339c['as'],'attributes':_0x1c339c['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0cf('0x14')](function(_0x394d29){logger[_0xa0cf('0x15')](_0xa0cf('0x28'),_0x34a863);logger['debug'](_0xa0cf('0x28'),_0x34a863,JSON[_0xa0cf('0x29')](_0x394d29));_0x47e878(_0x394d29);})['catch'](function(_0x2e00){logger[_0xa0cf('0x19')]('GetVoiceQueueReport',_0x2e00[_0xa0cf('0x1b')],_0x34a863);_0x323f1a(_0x29e988[_0xa0cf('0x19')](0x1f4,_0x2e00[_0xa0cf('0x1b')]));});});};exports[_0xa0cf('0x2a')]=function(_0x4c6271){var _0x334ab7=this;return new Promise(function(_0x1c7288,_0x357c75){return db[_0xa0cf('0x1f')][_0xa0cf('0x2b')](_0x4c6271['body'],{'raw':_0x4c6271[_0xa0cf('0x21')]?_0x4c6271[_0xa0cf('0x21')][_0xa0cf('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x556169){logger[_0xa0cf('0x15')]('CreateVoiceQueueReport',_0x4c6271);logger[_0xa0cf('0x17')](_0xa0cf('0x2a'),_0x4c6271,JSON[_0xa0cf('0x29')](_0x556169));_0x1c7288(_0x556169);})[_0xa0cf('0x1e')](function(_0x5e2c1e){logger[_0xa0cf('0x19')](_0xa0cf('0x2a'),_0x5e2c1e['message'],_0x4c6271);_0x357c75(_0x334ab7[_0xa0cf('0x19')](0x1f4,_0x5e2c1e[_0xa0cf('0x1b')]));});});};exports[_0xa0cf('0x2c')]=function(_0x4223f7){var _0x2bba47=this;return new Promise(function(_0x12debd,_0x3f6f52){return db[_0xa0cf('0x1f')]['update'](_0x4223f7[_0xa0cf('0x2d')],{'raw':_0x4223f7[_0xa0cf('0x21')]?_0x4223f7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4223f7['options']?_0x4223f7[_0xa0cf('0x21')]['where']||null:null,'attributes':_0x4223f7[_0xa0cf('0x21')]?_0x4223f7[_0xa0cf('0x21')][_0xa0cf('0x24')]||null:null,'limit':_0x4223f7[_0xa0cf('0x21')]?_0x4223f7[_0xa0cf('0x21')]['limit']||null:null})[_0xa0cf('0x14')](function(_0x313231){logger[_0xa0cf('0x15')](_0xa0cf('0x2c'),_0x4223f7);logger[_0xa0cf('0x17')]('UpdateVoiceQueueReport',_0x4223f7,JSON[_0xa0cf('0x29')](_0x313231));_0x12debd(_0x313231);})[_0xa0cf('0x1e')](function(_0x44f42c){logger['error'](_0xa0cf('0x2c'),_0x44f42c[_0xa0cf('0x1b')],_0x4223f7);_0x3f6f52(_0x2bba47['error'](0x1f4,_0x44f42c['message']));});});}; \ No newline at end of file +var _0xfe6d=['result','catch','VoiceQueueReport','findAll','options','where','attributes','include','map','model','then','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x4c1d89,_0x56afb6){var _0x14c352=function(_0xe94d37){while(--_0xe94d37){_0x4c1d89['push'](_0x4c1d89['shift']());}};_0x14c352(++_0x56afb6);}(_0xfe6d,0xbe));var _0xdfe6=function(_0x5c3ea5,_0xa9ed0c){_0x5c3ea5=_0x5c3ea5-0x0;var _0x102b61=_0xfe6d[_0x5c3ea5];return _0x102b61;};'use strict';var _=require(_0xdfe6('0x0'));var util=require(_0xdfe6('0x1'));var moment=require('moment');var BPromise=require(_0xdfe6('0x2'));var rs=require(_0xdfe6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdfe6('0x4'));var logger=require(_0xdfe6('0x5'))(_0xdfe6('0x6'));var config=require(_0xdfe6('0x7'));var jayson=require(_0xdfe6('0x8'));var client=jayson['client'][_0xdfe6('0x9')]({'port':0x232a});config[_0xdfe6('0xa')]=_[_0xdfe6('0xb')](config[_0xdfe6('0xa')],{'host':_0xdfe6('0xc'),'port':0x18eb});var socket=require(_0xdfe6('0xd'))(new Redis(config['redis']));require(_0xdfe6('0xe'))[_0xdfe6('0xf')](socket);function respondWithRpcPromise(_0x30e94c,_0x5e61e2,_0x5dcf2d){return new BPromise(function(_0xeea82,_0x597ee6){return client[_0xdfe6('0x10')](_0x30e94c,_0x5dcf2d)['then'](function(_0x1716d5){logger['info'](_0xdfe6('0x11'),_0x5e61e2,_0xdfe6('0x12'));logger[_0xdfe6('0x13')](_0xdfe6('0x14'),_0x5e61e2,_0xdfe6('0x12'),JSON['stringify'](_0x1716d5));if(_0x1716d5[_0xdfe6('0x15')]){if(_0x1716d5[_0xdfe6('0x15')][_0xdfe6('0x16')]===0x1f4){logger[_0xdfe6('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x5e61e2,_0x1716d5[_0xdfe6('0x15')][_0xdfe6('0x17')]);return _0x597ee6(_0x1716d5[_0xdfe6('0x15')][_0xdfe6('0x17')]);}logger[_0xdfe6('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x5e61e2,_0x1716d5['error'][_0xdfe6('0x17')]);return _0xeea82(_0x1716d5[_0xdfe6('0x15')]['message']);}else{logger[_0xdfe6('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x5e61e2,_0xdfe6('0x12'));_0xeea82(_0x1716d5[_0xdfe6('0x19')][_0xdfe6('0x17')]);}})[_0xdfe6('0x1a')](function(_0x505b40){logger['error'](_0xdfe6('0x11'),_0x5e61e2,_0x505b40);_0x597ee6(_0x505b40);});});}exports['GetVoiceQueueReport']=function(_0x3e1b9b){var _0x26c85b=this;return new Promise(function(_0x55f570,_0x231019){return db[_0xdfe6('0x1b')][_0xdfe6('0x1c')]({'raw':_0x3e1b9b[_0xdfe6('0x1d')]?_0x3e1b9b[_0xdfe6('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3e1b9b['options']?_0x3e1b9b['options'][_0xdfe6('0x1e')]||null:null,'attributes':_0x3e1b9b[_0xdfe6('0x1d')]?_0x3e1b9b[_0xdfe6('0x1d')][_0xdfe6('0x1f')]||null:null,'limit':_0x3e1b9b[_0xdfe6('0x1d')]?_0x3e1b9b['options']['limit']||null:null,'include':_0x3e1b9b[_0xdfe6('0x1d')]?_0x3e1b9b[_0xdfe6('0x1d')][_0xdfe6('0x20')]?_[_0xdfe6('0x21')](_0x3e1b9b[_0xdfe6('0x1d')][_0xdfe6('0x20')],function(_0x1a6b9c){return{'model':db[_0x1a6b9c[_0xdfe6('0x22')]],'as':_0x1a6b9c['as'],'attributes':_0x1a6b9c[_0xdfe6('0x1f')],'include':_0x1a6b9c[_0xdfe6('0x20')]?_[_0xdfe6('0x21')](_0x1a6b9c[_0xdfe6('0x20')],function(_0x4bbfb3){return{'model':db[_0x4bbfb3[_0xdfe6('0x22')]],'as':_0x4bbfb3['as'],'attributes':_0x4bbfb3[_0xdfe6('0x1f')],'include':_0x4bbfb3[_0xdfe6('0x20')]?_['map'](_0x4bbfb3[_0xdfe6('0x20')],function(_0x478b18){return{'model':db[_0x478b18[_0xdfe6('0x22')]],'as':_0x478b18['as'],'attributes':_0x478b18[_0xdfe6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdfe6('0x23')](function(_0x2deb58){logger[_0xdfe6('0x18')](_0xdfe6('0x24'),_0x3e1b9b);logger[_0xdfe6('0x13')]('GetVoiceQueueReport',_0x3e1b9b,JSON[_0xdfe6('0x25')](_0x2deb58));_0x55f570(_0x2deb58);})[_0xdfe6('0x1a')](function(_0x2c9931){logger[_0xdfe6('0x15')]('GetVoiceQueueReport',_0x2c9931[_0xdfe6('0x17')],_0x3e1b9b);_0x231019(_0x26c85b[_0xdfe6('0x15')](0x1f4,_0x2c9931['message']));});});};exports[_0xdfe6('0x26')]=function(_0x381eff){var _0x59bb51=this;return new Promise(function(_0x3f725b,_0x23a6d8){return db['VoiceQueueReport'][_0xdfe6('0x27')](_0x381eff[_0xdfe6('0x28')],{'raw':_0x381eff[_0xdfe6('0x1d')]?_0x381eff[_0xdfe6('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xdfe6('0x23')](function(_0x40c8b9){logger[_0xdfe6('0x18')]('CreateVoiceQueueReport',_0x381eff);logger[_0xdfe6('0x13')]('CreateVoiceQueueReport',_0x381eff,JSON[_0xdfe6('0x25')](_0x40c8b9));_0x3f725b(_0x40c8b9);})[_0xdfe6('0x1a')](function(_0xc1e2e6){logger[_0xdfe6('0x15')](_0xdfe6('0x26'),_0xc1e2e6[_0xdfe6('0x17')],_0x381eff);_0x23a6d8(_0x59bb51[_0xdfe6('0x15')](0x1f4,_0xc1e2e6[_0xdfe6('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x24ea75){var _0x25bce1=this;return new Promise(function(_0x28d4f7,_0x16e747){return db[_0xdfe6('0x1b')]['update'](_0x24ea75['body'],{'raw':_0x24ea75[_0xdfe6('0x1d')]?_0x24ea75[_0xdfe6('0x1d')][_0xdfe6('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24ea75[_0xdfe6('0x1d')]?_0x24ea75[_0xdfe6('0x1d')][_0xdfe6('0x1e')]||null:null,'attributes':_0x24ea75[_0xdfe6('0x1d')]?_0x24ea75[_0xdfe6('0x1d')][_0xdfe6('0x1f')]||null:null,'limit':_0x24ea75[_0xdfe6('0x1d')]?_0x24ea75[_0xdfe6('0x1d')]['limit']||null:null})[_0xdfe6('0x23')](function(_0x24bd3c){logger[_0xdfe6('0x18')](_0xdfe6('0x2a'),_0x24ea75);logger[_0xdfe6('0x13')]('UpdateVoiceQueueReport',_0x24ea75,JSON['stringify'](_0x24bd3c));_0x28d4f7(_0x24bd3c);})[_0xdfe6('0x1a')](function(_0x2c3530){logger[_0xdfe6('0x15')](_0xdfe6('0x2a'),_0x2c3530['message'],_0x24ea75);_0x16e747(_0x25bce1['error'](0x1f4,_0x2c3530[_0xdfe6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e36a132..8a1cd31 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 _0x5643=['save','remove','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x148e1e,_0x1694b0){var _0x43c39a=function(_0x470153){while(--_0x470153){_0x148e1e['push'](_0x148e1e['shift']());}};_0x43c39a(++_0x1694b0);}(_0x5643,0x1a3));var _0x3564=function(_0x769760,_0x5ad194){_0x769760=_0x769760-0x0;var _0x110162=_0x5643[_0x769760];return _0x110162;};'use strict';var VoiceQueueReportEvents=require(_0x3564('0x0'));var events=[_0x3564('0x1'),_0x3564('0x2'),'update'];function createListener(_0x3453d4,_0x2cdd89){return function(_0x3722a1){_0x2cdd89[_0x3564('0x3')](_0x3453d4,_0x3722a1);};}function removeListener(_0x22a27d,_0x4718d5){return function(){VoiceQueueReportEvents[_0x3564('0x4')](_0x22a27d,_0x4718d5);};}exports['register']=function(_0xdebbd8){for(var _0x2bccc1=0x0,_0x28b357=events[_0x3564('0x5')];_0x2bccc1<_0x28b357;_0x2bccc1++){var _0x390afd=events[_0x2bccc1];var _0x552d82=createListener(_0x3564('0x6')+_0x390afd,_0xdebbd8);VoiceQueueReportEvents['on'](_0x390afd,_0x552d82);}}; \ No newline at end of file +var _0x1dcc=['./voiceQueueReport.events','save','remove','update','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0xbeca2,_0x246fe6){_0xbeca2=_0xbeca2-0x0;var _0x1b6696=_0x1dcc[_0xbeca2];return _0x1b6696;};'use strict';var VoiceQueueReportEvents=require(_0xc1dc('0x0'));var events=[_0xc1dc('0x1'),_0xc1dc('0x2'),_0xc1dc('0x3')];function createListener(_0x5c9880,_0x934769){return function(_0x4dece3){_0x934769[_0xc1dc('0x4')](_0x5c9880,_0x4dece3);};}function removeListener(_0x3eb139,_0x2a8ff9){return function(){VoiceQueueReportEvents['removeListener'](_0x3eb139,_0x2a8ff9);};}exports['register']=function(_0x1e57ba){for(var _0x381ab6=0x0,_0x41b667=events['length'];_0x381ab6<_0x41b667;_0x381ab6++){var _0x3ef050=events[_0x381ab6];var _0x3deb94=createListener('voiceQueueReport:'+_0x3ef050,_0x1e57ba);VoiceQueueReportEvents['on'](_0x3ef050,_0x3deb94);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 545c3d6..d0b4c4b 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 _0x46df=['multer','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','show','post','/:id','update','destroy'];(function(_0xad421e,_0x1bf725){var _0x53fd23=function(_0x44cc41){while(--_0x44cc41){_0xad421e['push'](_0xad421e['shift']());}};_0x53fd23(++_0x1bf725);}(_0x46df,0x1e0));var _0xf46d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x46df[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xf46d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf46d('0x1'));var express=require(_0xf46d('0x2'));var router=express[_0xf46d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf46d('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf46d('0x5')]('/:id',auth[_0xf46d('0x6')](),controller[_0xf46d('0x7')]);router[_0xf46d('0x8')]('/',auth[_0xf46d('0x6')](),controller['create']);router['put'](_0xf46d('0x9'),auth['isAuthenticated'](),controller[_0xf46d('0xa')]);router['delete']('/:id',auth[_0xf46d('0x6')](),controller[_0xf46d('0xb')]);module['exports']=router; \ No newline at end of file +var _0xa8f0=['post','create','update','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show'];(function(_0x350823,_0x49ee24){var _0x37ddc8=function(_0x19336a){while(--_0x19336a){_0x350823['push'](_0x350823['shift']());}};_0x37ddc8(++_0x49ee24);}(_0xa8f0,0x123));var _0x0a8f=function(_0x2a5042,_0x307d04){_0x2a5042=_0x2a5042-0x0;var _0x4bc22f=_0xa8f0[_0x2a5042];return _0x4bc22f;};'use strict';var multer=require(_0x0a8f('0x0'));var util=require(_0x0a8f('0x1'));var path=require(_0x0a8f('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a8f('0x3'));var router=express[_0x0a8f('0x4')]();var fs_extra=require(_0x0a8f('0x5'));var auth=require(_0x0a8f('0x6'));var interaction=require(_0x0a8f('0x7'));var config=require(_0x0a8f('0x8'));var controller=require(_0x0a8f('0x9'));router[_0x0a8f('0xa')]('/',auth[_0x0a8f('0xb')](),controller['index']);router[_0x0a8f('0xa')]('/:id',auth[_0x0a8f('0xb')](),controller[_0x0a8f('0xc')]);router[_0x0a8f('0xd')]('/',auth[_0x0a8f('0xb')](),controller[_0x0a8f('0xe')]);router['put']('/:id',auth[_0x0a8f('0xb')](),controller[_0x0a8f('0xf')]);router[_0x0a8f('0x10')](_0x0a8f('0x11'),auth[_0x0a8f('0xb')](),controller['destroy']);module[_0x0a8f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 837d41a..5fddeb9 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 _0x8cf5=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x56aa11,_0x10a1b0){var _0x2485d7=function(_0x40c50c){while(--_0x40c50c){_0x56aa11['push'](_0x56aa11['shift']());}};_0x2485d7(++_0x10a1b0);}(_0x8cf5,0x1e2));var _0x58cf=function(_0x20cd8f,_0x99ebff){_0x20cd8f=_0x20cd8f-0x0;var _0x191438=_0x8cf5[_0x20cd8f];return _0x191438;};'use strict';var Sequelize=require(_0x58cf('0x0'));var moment=require('moment');module[_0x58cf('0x1')]={'time':{'type':Sequelize[_0x58cf('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x58cf('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x58cf('0x3')],'allowNull':![],'defaultValue':moment()[_0x58cf('0x4')](_0x58cf('0x5'))}}; \ No newline at end of file +var _0x9616=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x523212,_0x437cc3){var _0x38c3b2=function(_0x863e08){while(--_0x863e08){_0x523212['push'](_0x523212['shift']());}};_0x38c3b2(++_0x437cc3);}(_0x9616,0x1f4));var _0x6961=function(_0xe0f242,_0x2f4ecf){_0xe0f242=_0xe0f242-0x0;var _0x3b801a=_0x9616[_0xe0f242];return _0x3b801a;};'use strict';var Sequelize=require(_0x6961('0x0'));var moment=require('moment');module[_0x6961('0x1')]={'time':{'type':Sequelize[_0x6961('0x2')]},'callid':{'type':Sequelize[_0x6961('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6961('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6961('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6961('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6961('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6961('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6961('0x3')],'allowNull':![],'defaultValue':moment()[_0x6961('0x4')](_0x6961('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 256c8b4..4e4fe51 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 _0xf912=['desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x512078,_0x5b1fca){var _0x2f0ed6=function(_0xc1655e){while(--_0xc1655e){_0x512078['push'](_0x512078['shift']());}};_0x2f0ed6(++_0x5b1fca);}(_0xf912,0xd3));var _0x2f91=function(_0x1df45d,_0x458e2f){_0x1df45d=_0x1df45d-0x0;var _0x3fd982=_0xf912[_0x1df45d];return _0x3fd982;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f91('0x0'));var jsonpatch=require(_0x2f91('0x1'));var rp=require(_0x2f91('0x2'));var moment=require(_0x2f91('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f91('0x4'));var path=require(_0x2f91('0x5'));var sox=require(_0x2f91('0x6'));var csv=require(_0x2f91('0x7'));var ejs=require(_0x2f91('0x8'));var fs=require('fs');var fs_extra=require(_0x2f91('0x9'));var _=require(_0x2f91('0xa'));var squel=require(_0x2f91('0xb'));var crypto=require(_0x2f91('0xc'));var jsforce=require(_0x2f91('0xd'));var deskjs=require(_0x2f91('0xe'));var toCsv=require(_0x2f91('0x7'));var querystring=require('querystring');var Papa=require(_0x2f91('0xf'));var Redis=require(_0x2f91('0x10'));var authService=require(_0x2f91('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f91('0x12'));var logger=require('../../config/logger')(_0x2f91('0x13'));var utils=require('../../config/utils');var config=require(_0x2f91('0x14'));var licenseUtil=require(_0x2f91('0x15'));var db=require(_0x2f91('0x16'))['db'];function respondWithStatusCode(_0x122165,_0x558768){_0x558768=_0x558768||0xcc;return function(_0x4c6fd4){if(_0x4c6fd4){return _0x122165['sendStatus'](_0x558768);}return _0x122165[_0x2f91('0x17')](_0x558768)[_0x2f91('0x18')]();};}function respondWithResult(_0x5f13f8,_0x548e0f){_0x548e0f=_0x548e0f||0xc8;return function(_0x1fab63){if(_0x1fab63){return _0x5f13f8[_0x2f91('0x17')](_0x548e0f)[_0x2f91('0x19')](_0x1fab63);}};}function respondWithFilteredResult(_0x2179c5,_0x4f6553){return function(_0x123afc){if(_0x123afc){var _0x1325bf=typeof _0x4f6553[_0x2f91('0x1a')]==='undefined'&&typeof _0x4f6553[_0x2f91('0x1b')]===_0x2f91('0x1c');var _0x325cf2=_0x123afc[_0x2f91('0x1d')];var _0x58500d=_0x1325bf?0x0:_0x4f6553[_0x2f91('0x1a')];var _0xd0287b=_0x1325bf?_0x123afc[_0x2f91('0x1d')]:_0x4f6553[_0x2f91('0x1a')]+_0x4f6553[_0x2f91('0x1b')];var _0x4b7826;if(_0xd0287b>=_0x325cf2){_0xd0287b=_0x325cf2;_0x4b7826=0xc8;}else{_0x4b7826=0xce;}_0x2179c5['status'](_0x4b7826);return _0x2179c5[_0x2f91('0x1e')](_0x2f91('0x1f'),_0x58500d+'-'+_0xd0287b+'/'+_0x325cf2)[_0x2f91('0x19')](_0x123afc);}return null;};}function patchUpdates(_0x66367e){return function(_0x165aa9){try{jsonpatch[_0x2f91('0x20')](_0x165aa9,_0x66367e,!![]);}catch(_0x16df56){return BPromise[_0x2f91('0x21')](_0x16df56);}return _0x165aa9[_0x2f91('0x22')]();};}function saveUpdates(_0x2d3b10,_0x5df3d5){return function(_0x225496){if(_0x225496){return _0x225496['update'](_0x2d3b10)[_0x2f91('0x23')](function(_0x503c48){return _0x503c48;});}return null;};}function removeEntity(_0x344457,_0xd62d30){return function(_0x5a42be){if(_0x5a42be){return _0x5a42be[_0x2f91('0x24')]()['then'](function(){_0x344457[_0x2f91('0x17')](0xcc)[_0x2f91('0x18')]();});}};}function handleEntityNotFound(_0x2d85d4,_0x144057){return function(_0x3719c1){if(!_0x3719c1){_0x2d85d4[_0x2f91('0x25')](0x194);}return _0x3719c1;};}function handleError(_0x20cb08,_0xeb712b){_0xeb712b=_0xeb712b||0x1f4;return function(_0x345406){logger['error'](_0x345406[_0x2f91('0x26')]);if(_0x345406[_0x2f91('0x27')]){delete _0x345406['name'];}_0x20cb08[_0x2f91('0x17')](_0xeb712b)[_0x2f91('0x28')](_0x345406);};}exports['index']=function(_0x1106b2,_0x6e25a7){var _0x5cd917={},_0x1946ce={},_0x1d9dd4={'count':0x0,'rows':[]};var _0x18ec7e=_[_0x2f91('0x29')](db[_0x2f91('0x2a')][_0x2f91('0x2b')],function(_0x2b8497){return{'name':_0x2b8497['fieldName'],'type':_0x2b8497[_0x2f91('0x2c')][_0x2f91('0x2d')]};});_0x1946ce[_0x2f91('0x2e')]=_[_0x2f91('0x29')](_0x18ec7e,_0x2f91('0x27'));_0x1946ce['query']=_[_0x2f91('0x2f')](_0x1106b2['query']);_0x1946ce[_0x2f91('0x30')]=_[_0x2f91('0x31')](_0x1946ce[_0x2f91('0x2e')],_0x1946ce['query']);_0x5cd917[_0x2f91('0x32')]=_[_0x2f91('0x31')](_0x1946ce[_0x2f91('0x2e')],qs['fields'](_0x1106b2[_0x2f91('0x33')][_0x2f91('0x34')]));_0x5cd917[_0x2f91('0x32')]=_0x5cd917[_0x2f91('0x32')][_0x2f91('0x35')]?_0x5cd917[_0x2f91('0x32')]:_0x1946ce[_0x2f91('0x2e')];if(!_0x1106b2[_0x2f91('0x33')][_0x2f91('0x36')](_0x2f91('0x37'))){_0x5cd917[_0x2f91('0x1b')]=qs[_0x2f91('0x1b')](_0x1106b2[_0x2f91('0x33')][_0x2f91('0x1b')]);_0x5cd917[_0x2f91('0x1a')]=qs['offset'](_0x1106b2[_0x2f91('0x33')]['offset']);}_0x5cd917[_0x2f91('0x38')]=qs[_0x2f91('0x39')](_0x1106b2[_0x2f91('0x33')][_0x2f91('0x39')]);_0x5cd917[_0x2f91('0x3a')]=qs[_0x2f91('0x30')](_[_0x2f91('0x3b')](_0x1106b2[_0x2f91('0x33')],_0x1946ce[_0x2f91('0x30')]),_0x18ec7e);if(_0x1106b2[_0x2f91('0x33')]['filter']){_0x5cd917['where']=_[_0x2f91('0x3c')](_0x5cd917[_0x2f91('0x3a')],{'$or':_[_0x2f91('0x29')](_0x18ec7e,function(_0x2c4a1f){if(_0x2c4a1f[_0x2f91('0x2c')]!==_0x2f91('0x3d')){var _0x564efb={};_0x564efb[_0x2c4a1f[_0x2f91('0x27')]]={'$like':'%'+_0x1106b2[_0x2f91('0x33')][_0x2f91('0x3e')]+'%'};return _0x564efb;}})});}_0x5cd917=_[_0x2f91('0x3c')]({},_0x5cd917,_0x1106b2[_0x2f91('0x3f')]);var _0x277851={'where':_0x5cd917['where']};return db[_0x2f91('0x2a')][_0x2f91('0x1d')](_0x277851)['then'](function(_0x1ba9e3){_0x1d9dd4[_0x2f91('0x1d')]=_0x1ba9e3;if(_0x1106b2[_0x2f91('0x33')][_0x2f91('0x40')]){_0x5cd917[_0x2f91('0x41')]=[{'all':!![]}];}return db[_0x2f91('0x2a')][_0x2f91('0x42')](_0x5cd917);})['then'](function(_0x172001){_0x1d9dd4[_0x2f91('0x43')]=_0x172001;return _0x1d9dd4;})[_0x2f91('0x23')](respondWithFilteredResult(_0x6e25a7,_0x5cd917))[_0x2f91('0x44')](handleError(_0x6e25a7,null));};exports[_0x2f91('0x45')]=function(_0x5a86d0,_0x586974){var _0x2fd988={'raw':!![],'where':{'id':_0x5a86d0['params']['id']}},_0x3df2f2={};_0x3df2f2[_0x2f91('0x2e')]=_[_0x2f91('0x2f')](db[_0x2f91('0x2a')]['rawAttributes']);_0x3df2f2[_0x2f91('0x33')]=_['keys'](_0x5a86d0[_0x2f91('0x33')]);_0x3df2f2['filters']=_[_0x2f91('0x31')](_0x3df2f2['model'],_0x3df2f2[_0x2f91('0x33')]);_0x2fd988[_0x2f91('0x32')]=_['intersection'](_0x3df2f2['model'],qs[_0x2f91('0x34')](_0x5a86d0[_0x2f91('0x33')][_0x2f91('0x34')]));_0x2fd988[_0x2f91('0x32')]=_0x2fd988[_0x2f91('0x32')][_0x2f91('0x35')]?_0x2fd988[_0x2f91('0x32')]:_0x3df2f2[_0x2f91('0x2e')];if(_0x5a86d0[_0x2f91('0x33')][_0x2f91('0x40')]){_0x2fd988[_0x2f91('0x41')]=[{'all':!![]}];}_0x2fd988=_[_0x2f91('0x3c')]({},_0x2fd988,_0x5a86d0[_0x2f91('0x3f')]);return db[_0x2f91('0x2a')][_0x2f91('0x46')](_0x2fd988)[_0x2f91('0x23')](handleEntityNotFound(_0x586974,null))[_0x2f91('0x23')](respondWithResult(_0x586974,null))[_0x2f91('0x44')](handleError(_0x586974,null));};exports[_0x2f91('0x47')]=function(_0x2fb236,_0x2b6c88){return db[_0x2f91('0x2a')][_0x2f91('0x47')](_0x2fb236['body'],{})[_0x2f91('0x23')](respondWithResult(_0x2b6c88,0xc9))[_0x2f91('0x44')](handleError(_0x2b6c88,null));};exports[_0x2f91('0x48')]=function(_0x3b2298,_0x2e2395){if(_0x3b2298[_0x2f91('0x49')]['id']){delete _0x3b2298[_0x2f91('0x49')]['id'];}return db[_0x2f91('0x2a')]['find']({'where':{'id':_0x3b2298[_0x2f91('0x4a')]['id']}})[_0x2f91('0x23')](handleEntityNotFound(_0x2e2395,null))[_0x2f91('0x23')](saveUpdates(_0x3b2298[_0x2f91('0x49')],null))['then'](respondWithResult(_0x2e2395,null))[_0x2f91('0x44')](handleError(_0x2e2395,null));};exports[_0x2f91('0x24')]=function(_0x493764,_0x48ad75){return db['VoiceQueuesLog'][_0x2f91('0x46')]({'where':{'id':_0x493764[_0x2f91('0x4a')]['id']}})[_0x2f91('0x23')](handleEntityNotFound(_0x48ad75,null))['then'](removeEntity(_0x48ad75,null))['catch'](handleError(_0x48ad75,null));}; \ No newline at end of file +var _0xd816=['index','map','VoiceQueuesLog','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x241e1f,_0x5d351d){var _0x4fe818=function(_0x589d64){while(--_0x589d64){_0x241e1f['push'](_0x241e1f['shift']());}};_0x4fe818(++_0x5d351d);}(_0xd816,0x10c));var _0x6d81=function(_0x354101,_0x140922){_0x354101=_0x354101-0x0;var _0x54a75a=_0xd816[_0x354101];return _0x54a75a;};'use strict';var emlformat=require(_0x6d81('0x0'));var rimraf=require(_0x6d81('0x1'));var zipdir=require(_0x6d81('0x2'));var jsonpatch=require(_0x6d81('0x3'));var rp=require(_0x6d81('0x4'));var moment=require('moment');var BPromise=require(_0x6d81('0x5'));var Mustache=require(_0x6d81('0x6'));var util=require(_0x6d81('0x7'));var path=require(_0x6d81('0x8'));var sox=require(_0x6d81('0x9'));var csv=require(_0x6d81('0xa'));var ejs=require(_0x6d81('0xb'));var fs=require('fs');var fs_extra=require(_0x6d81('0xc'));var _=require(_0x6d81('0xd'));var squel=require(_0x6d81('0xe'));var crypto=require(_0x6d81('0xf'));var jsforce=require(_0x6d81('0x10'));var deskjs=require(_0x6d81('0x11'));var toCsv=require(_0x6d81('0xa'));var querystring=require(_0x6d81('0x12'));var Papa=require(_0x6d81('0x13'));var Redis=require(_0x6d81('0x14'));var authService=require(_0x6d81('0x15'));var qs=require(_0x6d81('0x16'));var as=require(_0x6d81('0x17'));var hardwareService=require(_0x6d81('0x18'));var logger=require(_0x6d81('0x19'))(_0x6d81('0x1a'));var utils=require(_0x6d81('0x1b'));var config=require(_0x6d81('0x1c'));var licenseUtil=require(_0x6d81('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21a47c,_0x2ed8ac){_0x2ed8ac=_0x2ed8ac||0xcc;return function(_0x4daa00){if(_0x4daa00){return _0x21a47c[_0x6d81('0x1e')](_0x2ed8ac);}return _0x21a47c[_0x6d81('0x1f')](_0x2ed8ac)[_0x6d81('0x20')]();};}function respondWithResult(_0xe3475d,_0x3c7cf9){_0x3c7cf9=_0x3c7cf9||0xc8;return function(_0x15fdc2){if(_0x15fdc2){return _0xe3475d['status'](_0x3c7cf9)[_0x6d81('0x21')](_0x15fdc2);}};}function respondWithFilteredResult(_0x277470,_0x3dd038){return function(_0x596b22){if(_0x596b22){var _0x1b491f=typeof _0x3dd038['offset']==='undefined'&&typeof _0x3dd038[_0x6d81('0x22')]==='undefined';var _0x3af336=_0x596b22[_0x6d81('0x23')];var _0x335892=_0x1b491f?0x0:_0x3dd038['offset'];var _0x504830=_0x1b491f?_0x596b22['count']:_0x3dd038[_0x6d81('0x24')]+_0x3dd038['limit'];var _0x231f16;if(_0x504830>=_0x3af336){_0x504830=_0x3af336;_0x231f16=0xc8;}else{_0x231f16=0xce;}_0x277470[_0x6d81('0x1f')](_0x231f16);return _0x277470[_0x6d81('0x25')](_0x6d81('0x26'),_0x335892+'-'+_0x504830+'/'+_0x3af336)[_0x6d81('0x21')](_0x596b22);}return null;};}function patchUpdates(_0x4a8e1d){return function(_0xcfe6da){try{jsonpatch['apply'](_0xcfe6da,_0x4a8e1d,!![]);}catch(_0x5eaf26){return BPromise[_0x6d81('0x27')](_0x5eaf26);}return _0xcfe6da[_0x6d81('0x28')]();};}function saveUpdates(_0x581c54,_0x3f2924){return function(_0x357876){if(_0x357876){return _0x357876[_0x6d81('0x29')](_0x581c54)[_0x6d81('0x2a')](function(_0x205563){return _0x205563;});}return null;};}function removeEntity(_0x37f38c,_0x535434){return function(_0x109503){if(_0x109503){return _0x109503[_0x6d81('0x2b')]()[_0x6d81('0x2a')](function(){_0x37f38c[_0x6d81('0x1f')](0xcc)[_0x6d81('0x20')]();});}};}function handleEntityNotFound(_0x37d813,_0x4fa872){return function(_0x196de4){if(!_0x196de4){_0x37d813[_0x6d81('0x1e')](0x194);}return _0x196de4;};}function handleError(_0x22fff3,_0x27a612){_0x27a612=_0x27a612||0x1f4;return function(_0x2ff65a){logger[_0x6d81('0x2c')](_0x2ff65a[_0x6d81('0x2d')]);if(_0x2ff65a[_0x6d81('0x2e')]){delete _0x2ff65a[_0x6d81('0x2e')];}_0x22fff3[_0x6d81('0x1f')](_0x27a612)[_0x6d81('0x2f')](_0x2ff65a);};}exports[_0x6d81('0x30')]=function(_0x589e8a,_0x23a914){var _0x19abfd={},_0x59c42f={},_0x28e121={'count':0x0,'rows':[]};var _0x2eb7ce=_[_0x6d81('0x31')](db[_0x6d81('0x32')][_0x6d81('0x33')],function(_0x23d9e0){return{'name':_0x23d9e0['fieldName'],'type':_0x23d9e0[_0x6d81('0x34')]['key']};});_0x59c42f[_0x6d81('0x35')]=_[_0x6d81('0x31')](_0x2eb7ce,_0x6d81('0x2e'));_0x59c42f[_0x6d81('0x36')]=_['keys'](_0x589e8a['query']);_0x59c42f['filters']=_[_0x6d81('0x37')](_0x59c42f[_0x6d81('0x35')],_0x59c42f[_0x6d81('0x36')]);_0x19abfd[_0x6d81('0x38')]=_[_0x6d81('0x37')](_0x59c42f[_0x6d81('0x35')],qs[_0x6d81('0x39')](_0x589e8a[_0x6d81('0x36')][_0x6d81('0x39')]));_0x19abfd[_0x6d81('0x38')]=_0x19abfd[_0x6d81('0x38')][_0x6d81('0x3a')]?_0x19abfd['attributes']:_0x59c42f[_0x6d81('0x35')];if(!_0x589e8a[_0x6d81('0x36')][_0x6d81('0x3b')](_0x6d81('0x3c'))){_0x19abfd[_0x6d81('0x22')]=qs[_0x6d81('0x22')](_0x589e8a[_0x6d81('0x36')]['limit']);_0x19abfd[_0x6d81('0x24')]=qs['offset'](_0x589e8a[_0x6d81('0x36')][_0x6d81('0x24')]);}_0x19abfd[_0x6d81('0x3d')]=qs[_0x6d81('0x3e')](_0x589e8a[_0x6d81('0x36')][_0x6d81('0x3e')]);_0x19abfd[_0x6d81('0x3f')]=qs[_0x6d81('0x40')](_[_0x6d81('0x41')](_0x589e8a[_0x6d81('0x36')],_0x59c42f[_0x6d81('0x40')]),_0x2eb7ce);if(_0x589e8a['query']['filter']){_0x19abfd[_0x6d81('0x3f')]=_['merge'](_0x19abfd['where'],{'$or':_['map'](_0x2eb7ce,function(_0x19b9e4){if(_0x19b9e4['type']!==_0x6d81('0x42')){var _0x5cd83e={};_0x5cd83e[_0x19b9e4[_0x6d81('0x2e')]]={'$like':'%'+_0x589e8a['query']['filter']+'%'};return _0x5cd83e;}})});}_0x19abfd=_[_0x6d81('0x43')]({},_0x19abfd,_0x589e8a['options']);var _0x254a57={'where':_0x19abfd[_0x6d81('0x3f')]};return db[_0x6d81('0x32')][_0x6d81('0x23')](_0x254a57)[_0x6d81('0x2a')](function(_0x897d71){_0x28e121[_0x6d81('0x23')]=_0x897d71;if(_0x589e8a[_0x6d81('0x36')][_0x6d81('0x44')]){_0x19abfd[_0x6d81('0x45')]=[{'all':!![]}];}return db[_0x6d81('0x32')][_0x6d81('0x46')](_0x19abfd);})[_0x6d81('0x2a')](function(_0x302451){_0x28e121[_0x6d81('0x47')]=_0x302451;return _0x28e121;})[_0x6d81('0x2a')](respondWithFilteredResult(_0x23a914,_0x19abfd))[_0x6d81('0x48')](handleError(_0x23a914,null));};exports[_0x6d81('0x49')]=function(_0x2c5fa8,_0x15f950){var _0x22bd97={'raw':!![],'where':{'id':_0x2c5fa8[_0x6d81('0x4a')]['id']}},_0x3bdc14={};_0x3bdc14['model']=_[_0x6d81('0x4b')](db[_0x6d81('0x32')]['rawAttributes']);_0x3bdc14[_0x6d81('0x36')]=_[_0x6d81('0x4b')](_0x2c5fa8[_0x6d81('0x36')]);_0x3bdc14[_0x6d81('0x40')]=_[_0x6d81('0x37')](_0x3bdc14['model'],_0x3bdc14[_0x6d81('0x36')]);_0x22bd97[_0x6d81('0x38')]=_[_0x6d81('0x37')](_0x3bdc14['model'],qs[_0x6d81('0x39')](_0x2c5fa8['query'][_0x6d81('0x39')]));_0x22bd97[_0x6d81('0x38')]=_0x22bd97[_0x6d81('0x38')][_0x6d81('0x3a')]?_0x22bd97[_0x6d81('0x38')]:_0x3bdc14[_0x6d81('0x35')];if(_0x2c5fa8[_0x6d81('0x36')][_0x6d81('0x44')]){_0x22bd97[_0x6d81('0x45')]=[{'all':!![]}];}_0x22bd97=_[_0x6d81('0x43')]({},_0x22bd97,_0x2c5fa8[_0x6d81('0x4c')]);return db[_0x6d81('0x32')]['find'](_0x22bd97)[_0x6d81('0x2a')](handleEntityNotFound(_0x15f950,null))['then'](respondWithResult(_0x15f950,null))['catch'](handleError(_0x15f950,null));};exports['create']=function(_0x5abef5,_0x20ebae){return db[_0x6d81('0x32')]['create'](_0x5abef5[_0x6d81('0x4d')],{})[_0x6d81('0x2a')](respondWithResult(_0x20ebae,0xc9))[_0x6d81('0x48')](handleError(_0x20ebae,null));};exports['update']=function(_0x48a33b,_0x487444){if(_0x48a33b['body']['id']){delete _0x48a33b[_0x6d81('0x4d')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x48a33b[_0x6d81('0x4a')]['id']}})['then'](handleEntityNotFound(_0x487444,null))['then'](saveUpdates(_0x48a33b['body'],null))['then'](respondWithResult(_0x487444,null))[_0x6d81('0x48')](handleError(_0x487444,null));};exports[_0x6d81('0x2b')]=function(_0x4b25e9,_0x349e15){return db['VoiceQueuesLog'][_0x6d81('0x4e')]({'where':{'id':_0x4b25e9[_0x6d81('0x4a')]['id']}})[_0x6d81('0x2a')](handleEntityNotFound(_0x349e15,null))[_0x6d81('0x2a')](removeEntity(_0x349e15,null))[_0x6d81('0x48')](handleError(_0x349e15,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 22baeab..15a111f 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 _0x0d00=['event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log'];(function(_0x214455,_0xc3a00c){var _0x5db5b6=function(_0x55d7e3){while(--_0x55d7e3){_0x214455['push'](_0x214455['shift']());}};_0x5db5b6(++_0xc3a00c);}(_0x0d00,0x189));var _0x00d0=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x0d00[_0x34eb31];return _0x254994;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var moment=require(_0x00d0('0x4'));var BPromise=require(_0x00d0('0x5'));var rp=require(_0x00d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00d0('0x7'));var config=require(_0x00d0('0x8'));var attributes=require(_0x00d0('0x9'));module['exports']=function(_0x30ebde,_0x5fe624){return _0x30ebde[_0x00d0('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x00d0('0xb'),'paranoid':![],'indexes':[{'name':_0x00d0('0xc'),'fields':[_0x00d0('0xd'),_0x00d0('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4658=['lodash','util','../../config/logger','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4658,0x1ba));var _0x8465=function(_0x2bb8f8,_0x338871){_0x2bb8f8=_0x2bb8f8-0x0;var _0x48ece1=_0x4658[_0x2bb8f8];return _0x48ece1;};'use strict';var _=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var logger=require(_0x8465('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8465('0x3'));var config=require(_0x8465('0x4'));var attributes=require(_0x8465('0x5'));module[_0x8465('0x6')]=function(_0x617517,_0xd49435){return _0x617517[_0x8465('0x7')](_0x8465('0x8'),attributes,{'tableName':_0x8465('0x9'),'paranoid':![],'indexes':[{'name':_0x8465('0xa'),'fields':[_0x8465('0xb'),_0x8465('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5170231..704e149 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 _0x7510=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x385057,_0x2c75d8){var _0x2f98c3=function(_0x4c9d23){while(--_0x4c9d23){_0x385057['push'](_0x385057['shift']());}};_0x2f98c3(++_0x2c75d8);}(_0x7510,0x18a));var _0x0751=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7510[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0751('0x0'));var moment=require(_0x0751('0x1'));var BPromise=require(_0x0751('0x2'));var rs=require(_0x0751('0x3'));var fs=require('fs');var Redis=require(_0x0751('0x4'));var db=require(_0x0751('0x5'))['db'];var utils=require(_0x0751('0x6'));var logger=require('../../config/logger')(_0x0751('0x7'));var config=require(_0x0751('0x8'));var jayson=require(_0x0751('0x9'));var client=jayson['client'][_0x0751('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ad494,_0x162368,_0x5acb1e){return new BPromise(function(_0x44c788,_0x47909a){return client[_0x0751('0xb')](_0x1ad494,_0x5acb1e)['then'](function(_0x9a07cd){logger[_0x0751('0xc')](_0x0751('0xd'),_0x162368,'request\x20sent');logger[_0x0751('0xe')](_0x0751('0xf'),_0x162368,_0x0751('0x10'),JSON[_0x0751('0x11')](_0x9a07cd));if(_0x9a07cd[_0x0751('0x12')]){if(_0x9a07cd[_0x0751('0x12')]['code']===0x1f4){logger[_0x0751('0x12')](_0x0751('0xd'),_0x162368,_0x9a07cd[_0x0751('0x12')][_0x0751('0x13')]);return _0x47909a(_0x9a07cd[_0x0751('0x12')][_0x0751('0x13')]);}logger[_0x0751('0x12')](_0x0751('0xd'),_0x162368,_0x9a07cd[_0x0751('0x12')][_0x0751('0x13')]);return _0x44c788(_0x9a07cd[_0x0751('0x12')]['message']);}else{logger[_0x0751('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x162368,_0x0751('0x10'));_0x44c788(_0x9a07cd[_0x0751('0x14')][_0x0751('0x13')]);}})['catch'](function(_0x272f6b){logger[_0x0751('0x12')](_0x0751('0xd'),_0x162368,_0x272f6b);_0x47909a(_0x272f6b);});});} \ No newline at end of file +var _0xb95d=['client','request','info','debug','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xd7254c,_0x1e9d65){var _0xd22361=function(_0xdc1ea){while(--_0xdc1ea){_0xd7254c['push'](_0xd7254c['shift']());}};_0xd22361(++_0x1e9d65);}(_0xb95d,0x1c5));var _0xdb95=function(_0x5641d9,_0x1de53b){_0x5641d9=_0x5641d9-0x0;var _0x1b1f89=_0xb95d[_0x5641d9];return _0x1b1f89;};'use strict';var _=require(_0xdb95('0x0'));var util=require('util');var moment=require(_0xdb95('0x1'));var BPromise=require(_0xdb95('0x2'));var rs=require(_0xdb95('0x3'));var fs=require('fs');var Redis=require(_0xdb95('0x4'));var db=require(_0xdb95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb95('0x6'))(_0xdb95('0x7'));var config=require(_0xdb95('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb95('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f892,_0x526075,_0x43df2c){return new BPromise(function(_0x41a17b,_0x2e0fbd){return client[_0xdb95('0xa')](_0x52f892,_0x43df2c)['then'](function(_0x255352){logger[_0xdb95('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x526075,'request\x20sent');logger[_0xdb95('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x526075,_0xdb95('0xd'),JSON[_0xdb95('0xe')](_0x255352));if(_0x255352[_0xdb95('0xf')]){if(_0x255352[_0xdb95('0xf')][_0xdb95('0x10')]===0x1f4){logger[_0xdb95('0xf')](_0xdb95('0x11'),_0x526075,_0x255352[_0xdb95('0xf')][_0xdb95('0x12')]);return _0x2e0fbd(_0x255352['error']['message']);}logger[_0xdb95('0xf')](_0xdb95('0x11'),_0x526075,_0x255352['error'][_0xdb95('0x12')]);return _0x41a17b(_0x255352[_0xdb95('0xf')][_0xdb95('0x12')]);}else{logger['info'](_0xdb95('0x11'),_0x526075,_0xdb95('0xd'));_0x41a17b(_0x255352[_0xdb95('0x13')][_0xdb95('0x12')]);}})[_0xdb95('0x14')](function(_0x2ea38f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x526075,_0x2ea38f);_0x2e0fbd(_0x2ea38f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e559aae..575bfd6 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 _0x8ebc=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1d831e,_0x2fdb11){var _0x3006c7=function(_0x518f61){while(--_0x518f61){_0x1d831e['push'](_0x1d831e['shift']());}};_0x3006c7(++_0x2fdb11);}(_0x8ebc,0xda));var _0xc8eb=function(_0x61b4c7,_0xf6eafa){_0x61b4c7=_0x61b4c7-0x0;var _0x5f57a1=_0x8ebc[_0x61b4c7];return _0x5f57a1;};'use strict';var multer=require(_0xc8eb('0x0'));var util=require(_0xc8eb('0x1'));var path=require(_0xc8eb('0x2'));var timeout=require(_0xc8eb('0x3'));var express=require(_0xc8eb('0x4'));var router=express['Router']();var fs_extra=require(_0xc8eb('0x5'));var auth=require(_0xc8eb('0x6'));var interaction=require(_0xc8eb('0x7'));var config=require(_0xc8eb('0x8'));var controller=require('./voiceRecording.controller');router[_0xc8eb('0x9')]('/',auth[_0xc8eb('0xa')](),controller[_0xc8eb('0xb')]);router[_0xc8eb('0x9')](_0xc8eb('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc8eb('0x9')]('/:id',auth[_0xc8eb('0xa')](),controller['show']);router[_0xc8eb('0x9')]('/:id/download',auth[_0xc8eb('0xa')](),controller[_0xc8eb('0xd')]);router[_0xc8eb('0x9')](_0xc8eb('0xe'),controller[_0xc8eb('0xf')]);router[_0xc8eb('0x9')](_0xc8eb('0x10'),auth['isAuthenticated'](),controller[_0xc8eb('0x11')]);router[_0xc8eb('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc8eb('0x12')](_0xc8eb('0x10'),auth['isAuthenticated'](),controller[_0xc8eb('0x13')]);router['put'](_0xc8eb('0x14'),auth[_0xc8eb('0xa')](),controller[_0xc8eb('0x15')]);router[_0xc8eb('0x16')](_0xc8eb('0x14'),auth[_0xc8eb('0xa')](),controller[_0xc8eb('0x17')]);module[_0xc8eb('0x18')]=router; \ No newline at end of file +var _0x335e=['get','isAuthenticated','describe','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','/:id/transcribe','runTranscribe','put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0xb1a81,_0x5a20b0){var _0x9c1d4a=function(_0x3dab69){while(--_0x3dab69){_0xb1a81['push'](_0xb1a81['shift']());}};_0x9c1d4a(++_0x5a20b0);}(_0x335e,0x155));var _0xe335=function(_0x4d7569,_0x14efcb){_0x4d7569=_0x4d7569-0x0;var _0x5f4499=_0x335e[_0x4d7569];return _0x5f4499;};'use strict';var multer=require(_0xe335('0x0'));var util=require(_0xe335('0x1'));var path=require(_0xe335('0x2'));var timeout=require(_0xe335('0x3'));var express=require(_0xe335('0x4'));var router=express['Router']();var fs_extra=require(_0xe335('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe335('0x6'));var config=require(_0xe335('0x7'));var controller=require(_0xe335('0x8'));router[_0xe335('0x9')]('/',auth[_0xe335('0xa')](),controller['index']);router[_0xe335('0x9')]('/describe',auth[_0xe335('0xa')](),controller[_0xe335('0xb')]);router[_0xe335('0x9')]('/:id',auth[_0xe335('0xa')](),controller[_0xe335('0xc')]);router[_0xe335('0x9')](_0xe335('0xd'),auth[_0xe335('0xa')](),controller[_0xe335('0xe')]);router[_0xe335('0x9')](_0xe335('0xf'),controller[_0xe335('0x10')]);router[_0xe335('0x9')]('/:id/transcribe',auth[_0xe335('0xa')](),controller[_0xe335('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe335('0x12')](_0xe335('0x13'),auth[_0xe335('0xa')](),controller[_0xe335('0x14')]);router[_0xe335('0x15')](_0xe335('0x16'),auth[_0xe335('0xa')](),controller[_0xe335('0x17')]);router[_0xe335('0x18')](_0xe335('0x16'),auth[_0xe335('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 3fb2470..73a8dd0 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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 c5a3480..5367100 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 _0xc692=['TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','VoiceRecording','fieldName','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','update','find','describe','download','../../components/encryptor','uniqueid','existsSync','decryptFile','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','secrets','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc692,0x156));var _0x2c69=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc692[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x2c69('0x0'));var rimraf=require(_0x2c69('0x1'));var zipdir=require(_0x2c69('0x2'));var jsonpatch=require(_0x2c69('0x3'));var rp=require(_0x2c69('0x4'));var moment=require(_0x2c69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c69('0x6'));var util=require(_0x2c69('0x7'));var path=require('path');var sox=require(_0x2c69('0x8'));var csv=require(_0x2c69('0x9'));var ejs=require(_0x2c69('0xa'));var fs=require('fs');var fs_extra=require(_0x2c69('0xb'));var _=require('lodash');var squel=require(_0x2c69('0xc'));var crypto=require('crypto');var jsforce=require(_0x2c69('0xd'));var deskjs=require(_0x2c69('0xe'));var toCsv=require(_0x2c69('0x9'));var querystring=require(_0x2c69('0xf'));var Papa=require(_0x2c69('0x10'));var AWS=require(_0x2c69('0x11'));var uuidv4=require(_0x2c69('0x12'));var Redis=require(_0x2c69('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2c69('0x14'));var as=require(_0x2c69('0x15'));var hardwareService=require(_0x2c69('0x16'));var logger=require(_0x2c69('0x17'))(_0x2c69('0x18'));var utils=require(_0x2c69('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2c69('0x1a'));var db=require(_0x2c69('0x1b'))['db'];function respondWithStatusCode(_0x4b1310,_0x3aca4a){_0x3aca4a=_0x3aca4a||0xcc;return function(_0x3d553b){if(_0x3d553b){return _0x4b1310['sendStatus'](_0x3aca4a);}return _0x4b1310[_0x2c69('0x1c')](_0x3aca4a)[_0x2c69('0x1d')]();};}function respondWithResult(_0x566ef8,_0x458153){_0x458153=_0x458153||0xc8;return function(_0x47f879){if(_0x47f879){return _0x566ef8['status'](_0x458153)[_0x2c69('0x1e')](_0x47f879);}};}function respondWithFilteredResult(_0x5cb83e,_0x1a2d32){return function(_0x25c7c3){if(_0x25c7c3){var _0x1e5de5=typeof _0x1a2d32[_0x2c69('0x1f')]===_0x2c69('0x20')&&typeof _0x1a2d32[_0x2c69('0x21')]===_0x2c69('0x20');var _0x1c7658=_0x25c7c3[_0x2c69('0x22')];var _0x338a81=_0x1e5de5?0x0:_0x1a2d32[_0x2c69('0x1f')];var _0x3a8c51=_0x1e5de5?_0x25c7c3[_0x2c69('0x22')]:_0x1a2d32['offset']+_0x1a2d32[_0x2c69('0x21')];var _0x1cced8;if(_0x3a8c51>=_0x1c7658){_0x3a8c51=_0x1c7658;_0x1cced8=0xc8;}else{_0x1cced8=0xce;}_0x5cb83e[_0x2c69('0x1c')](_0x1cced8);return _0x5cb83e['set'](_0x2c69('0x23'),_0x338a81+'-'+_0x3a8c51+'/'+_0x1c7658)[_0x2c69('0x1e')](_0x25c7c3);}return null;};}function patchUpdates(_0x121860){return function(_0x39a5ee){try{jsonpatch[_0x2c69('0x24')](_0x39a5ee,_0x121860,!![]);}catch(_0x28e9c6){return BPromise[_0x2c69('0x25')](_0x28e9c6);}return _0x39a5ee[_0x2c69('0x26')]();};}function saveUpdates(_0x45166,_0x3341be){return function(_0x347fee){if(_0x347fee){return _0x347fee['update'](_0x45166)[_0x2c69('0x27')](function(_0x1b69b6){return _0x1b69b6;});}return null;};}function removeEntity(_0x4979e2,_0x37baf4){return function(_0x99a33b){if(_0x99a33b){return _0x99a33b[_0x2c69('0x28')]()['then'](function(){_0x4979e2['status'](0xcc)[_0x2c69('0x1d')]();});}};}function handleEntityNotFound(_0x4e4f95,_0x39158d){return function(_0x39f201){if(!_0x39f201){_0x4e4f95['sendStatus'](0x194);}return _0x39f201;};}function handleError(_0x23fad0,_0x3f9814){_0x3f9814=_0x3f9814||0x1f4;return function(_0x2b7b90){logger[_0x2c69('0x29')](_0x2b7b90[_0x2c69('0x2a')]);if(_0x2b7b90[_0x2c69('0x2b')]){delete _0x2b7b90['name'];}_0x23fad0['status'](_0x3f9814)[_0x2c69('0x2c')](_0x2b7b90);};}exports['index']=function(_0x2154b4,_0x15f76a){var _0x29154d={},_0x14a01d={},_0x29faf5={'count':0x0,'rows':[]};var _0x3becc4=_[_0x2c69('0x2d')](db[_0x2c69('0x2e')]['rawAttributes'],function(_0x4bc1ef){return{'name':_0x4bc1ef[_0x2c69('0x2f')],'type':_0x4bc1ef[_0x2c69('0x30')]['key']};});_0x14a01d[_0x2c69('0x31')]=_[_0x2c69('0x32')](_[_0x2c69('0x2d')](_0x3becc4,_0x2c69('0x2b')),[_0x2c69('0x33')]);_0x14a01d[_0x2c69('0x34')]=_[_0x2c69('0x35')](_0x2154b4[_0x2c69('0x34')]);_0x14a01d['filters']=_[_0x2c69('0x36')](_0x14a01d[_0x2c69('0x31')],_0x14a01d['query']);_0x29154d[_0x2c69('0x37')]=_[_0x2c69('0x36')](_0x14a01d['model'],qs['fields'](_0x2154b4[_0x2c69('0x34')][_0x2c69('0x38')]));_0x29154d[_0x2c69('0x37')]=_0x29154d[_0x2c69('0x37')][_0x2c69('0x39')]?_0x29154d[_0x2c69('0x37')]:_0x14a01d[_0x2c69('0x31')];if(!_0x2154b4['query'][_0x2c69('0x3a')](_0x2c69('0x3b'))){_0x29154d['limit']=qs[_0x2c69('0x21')](_0x2154b4[_0x2c69('0x34')][_0x2c69('0x21')]);_0x29154d[_0x2c69('0x1f')]=qs['offset'](_0x2154b4[_0x2c69('0x34')][_0x2c69('0x1f')]);}_0x29154d[_0x2c69('0x3c')]=qs[_0x2c69('0x3d')](_0x2154b4[_0x2c69('0x34')][_0x2c69('0x3d')]);_0x29154d[_0x2c69('0x3e')]=qs[_0x2c69('0x3f')](_[_0x2c69('0x40')](_0x2154b4['query'],_0x14a01d[_0x2c69('0x3f')]),_0x3becc4);if(_0x2154b4[_0x2c69('0x34')]['filter']){_0x29154d['where']=_[_0x2c69('0x41')](_0x29154d['where'],{'$or':_[_0x2c69('0x2d')](_0x3becc4,function(_0x347ca4){if(_0x347ca4['type']!=='VIRTUAL'){var _0x21b2c0={};_0x21b2c0[_0x347ca4[_0x2c69('0x2b')]]={'$like':'%'+_0x2154b4[_0x2c69('0x34')][_0x2c69('0x42')]+'%'};return _0x21b2c0;}})});}_0x29154d=_[_0x2c69('0x41')]({},_0x29154d,_0x2154b4[_0x2c69('0x43')]);var _0x3a4797={'where':_0x29154d[_0x2c69('0x3e')]};return db[_0x2c69('0x2e')][_0x2c69('0x22')](_0x3a4797)['then'](function(_0x52a9cd){_0x29faf5[_0x2c69('0x22')]=_0x52a9cd;if(_0x2154b4['query'][_0x2c69('0x44')]){_0x29154d['include']=[{'all':!![]}];}return db[_0x2c69('0x2e')][_0x2c69('0x45')](_0x29154d);})['then'](function(_0x31a8fe){_0x29faf5['rows']=_0x31a8fe;return _0x29faf5;})[_0x2c69('0x27')](respondWithFilteredResult(_0x15f76a,_0x29154d))[_0x2c69('0x46')](handleError(_0x15f76a,null));};exports[_0x2c69('0x47')]=function(_0x21ac41,_0x598b96){var _0x76615f={'raw':![],'where':{'id':_0x21ac41[_0x2c69('0x48')]['id']}},_0x3e5c06={};_0x3e5c06[_0x2c69('0x31')]=_[_0x2c69('0x35')](db[_0x2c69('0x2e')][_0x2c69('0x49')]);_0x3e5c06['query']=_[_0x2c69('0x35')](_0x21ac41[_0x2c69('0x34')]);_0x3e5c06[_0x2c69('0x3f')]=_[_0x2c69('0x36')](_0x3e5c06[_0x2c69('0x31')],_0x3e5c06[_0x2c69('0x34')]);_0x76615f[_0x2c69('0x37')]=_[_0x2c69('0x36')](_0x3e5c06[_0x2c69('0x31')],qs[_0x2c69('0x38')](_0x21ac41['query']['fields']));_0x76615f[_0x2c69('0x37')]=_0x76615f[_0x2c69('0x37')]['length']?_0x76615f[_0x2c69('0x37')]:_0x3e5c06['model'];if(_0x21ac41[_0x2c69('0x34')][_0x2c69('0x44')]){_0x76615f[_0x2c69('0x4a')]=[{'all':!![]}];}_0x76615f=_[_0x2c69('0x41')]({},_0x76615f,_0x21ac41[_0x2c69('0x43')]);return db[_0x2c69('0x2e')]['find'](_0x76615f)['then'](handleEntityNotFound(_0x598b96,null))['then'](respondWithResult(_0x598b96,null))[_0x2c69('0x46')](handleError(_0x598b96,null));};exports['create']=function(_0x25152e,_0x43894d){return db[_0x2c69('0x2e')][_0x2c69('0x4b')](_0x25152e[_0x2c69('0x4c')],{})[_0x2c69('0x27')](respondWithResult(_0x43894d,0xc9))[_0x2c69('0x46')](handleError(_0x43894d,null));};exports[_0x2c69('0x4d')]=function(_0x315324,_0x4b8c12){if(_0x315324['body']['id']){delete _0x315324[_0x2c69('0x4c')]['id'];}return db[_0x2c69('0x2e')][_0x2c69('0x4e')]({'where':{'id':_0x315324['params']['id']}})[_0x2c69('0x27')](handleEntityNotFound(_0x4b8c12,null))[_0x2c69('0x27')](saveUpdates(_0x315324['body'],null))[_0x2c69('0x27')](respondWithResult(_0x4b8c12,null))[_0x2c69('0x46')](handleError(_0x4b8c12,null));};exports['describe']=function(_0x586db9,_0x1ca075){return db[_0x2c69('0x2e')][_0x2c69('0x4f')]()[_0x2c69('0x27')](respondWithResult(_0x1ca075,null))[_0x2c69('0x46')](handleError(_0x1ca075,null));};exports[_0x2c69('0x50')]=function(_0x331e71,_0x213b3c,_0x28994d){var _0x5a3256=require(_0x2c69('0x51'));var _0x3dcf94=![];var _0x3c6a94={};if(_0x331e71[_0x2c69('0x34')][_0x2c69('0x30')]&&_0x331e71[_0x2c69('0x34')]['type']==='uniqueid'){_0x3c6a94[_0x2c69('0x52')]=_0x331e71[_0x2c69('0x48')]['id'];}else{_0x3c6a94['id']=_0x331e71[_0x2c69('0x48')]['id'];}return db[_0x2c69('0x2e')][_0x2c69('0x4e')]({'where':_0x3c6a94,'attributes':['id','value'],'raw':!![]})[_0x2c69('0x27')](handleEntityNotFound(_0x213b3c,null))[_0x2c69('0x27')](function(_0x3a7417){if(_0x3a7417){var _0x46885a=_0x3a7417['value'];var _0x1322e4=util[_0x2c69('0x33')]('%s.cypher',_0x46885a);if(fs[_0x2c69('0x53')](_0x1322e4)){_0x3dcf94=!![];return _0x5a3256[_0x2c69('0x54')](_0x1322e4,_0x46885a,config['secrets'][_0x2c69('0x55')])[_0x2c69('0x27')](function(){return _0x3a7417;});}return _0x3a7417;}})[_0x2c69('0x27')](function(_0x3391d7){if(_0x3391d7){var _0x276cc7=_0x3391d7[_0x2c69('0x56')];if(!fs[_0x2c69('0x53')](_0x276cc7)){throw new db[(_0x2c69('0x57'))][(_0x2c69('0x58'))](_0x2c69('0x59'));}if(_0x3391d7[_0x2c69('0x5a')]){return _0x213b3c[_0x2c69('0x50')](_0x276cc7,_0x3391d7[_0x2c69('0x5a')]+path[_0x2c69('0x5b')](_0x276cc7),function(){if(_0x3dcf94){fs[_0x2c69('0x5c')](_0x276cc7);}});}else{return _0x213b3c[_0x2c69('0x50')](_0x276cc7,function(_0x3bb12b){if(_0x3dcf94){fs['unlink'](_0x276cc7);}});}}})[_0x2c69('0x46')](function(_0xd0dbd1){if(_0xd0dbd1['message']===_0x2c69('0x59')){_0x213b3c['status'](0x194)[_0x2c69('0x2c')](_0x2c69('0x5d'));}else{return handleError(_0x213b3c,null);}});};exports[_0x2c69('0x5e')]=function(_0x2ea4d9,_0x53d17e,_0x28d49a){var _0x5c6df4=require(_0x2c69('0x51'));var _0x4a3b56=![];var _0xcec0bb={'$and':[db[_0x2c69('0x5f')][_0x2c69('0x3e')](db[_0x2c69('0x5f')]['fn'](_0x2c69('0x60'),db[_0x2c69('0x5f')][_0x2c69('0x61')]('uniqueid')),_0x2ea4d9['query'][_0x2c69('0x62')])]};if(_0x2ea4d9[_0x2c69('0x34')][_0x2c69('0x30')]&&_0x2ea4d9[_0x2c69('0x34')][_0x2c69('0x30')]===_0x2c69('0x52')){_0xcec0bb[_0x2c69('0x63')][_0x2c69('0x64')]({'uniqueid':_0x2ea4d9[_0x2c69('0x48')]['id']});}else{_0xcec0bb[_0x2c69('0x63')][_0x2c69('0x64')]({'id':_0x2ea4d9[_0x2c69('0x48')]['id']});}return db[_0x2c69('0x2e')][_0x2c69('0x4e')]({'where':_0xcec0bb,'attributes':['id',_0x2c69('0x56')],'raw':!![]})[_0x2c69('0x27')](handleEntityNotFound(_0x53d17e,null))[_0x2c69('0x27')](function(_0x388341){if(_0x388341){var _0x271ac9=util['format'](_0x2c69('0x65'),_0x388341['value']);if(fs[_0x2c69('0x53')](_0x271ac9)){_0x4a3b56=!![];return _0x5c6df4['decryptFile'](_0x271ac9,_0x388341[_0x2c69('0x56')],config[_0x2c69('0x66')][_0x2c69('0x55')])[_0x2c69('0x27')](function(){return _0x388341;});}return _0x388341;}})[_0x2c69('0x27')](function(_0x3b9e91){if(_0x3b9e91){if(!fs['existsSync'](_0x3b9e91[_0x2c69('0x56')])){throw new db[(_0x2c69('0x57'))][(_0x2c69('0x58'))](_0x2c69('0x59'));}if(_0x3b9e91['filename']){return _0x53d17e[_0x2c69('0x50')](_0x3b9e91[_0x2c69('0x56')],_0x3b9e91[_0x2c69('0x5a')]+path[_0x2c69('0x5b')](_0x3b9e91[_0x2c69('0x56')]),function(){if(_0x4a3b56){fs[_0x2c69('0x5c')](_0x3b9e91[_0x2c69('0x56')]);}});}else{return _0x53d17e[_0x2c69('0x50')](_0x3b9e91[_0x2c69('0x56')],function(_0xd1da1a){if(_0x4a3b56){fs[_0x2c69('0x5c')](_0x3b9e91['value']);}});}}})['catch'](handleError(_0x53d17e,null));};exports[_0x2c69('0x28')]=function(_0x3cfd14,_0x29692b){return db['VoiceRecording'][_0x2c69('0x4e')]({'where':{'id':_0x3cfd14[_0x2c69('0x48')]['id']}})['then'](function(_0x43b037){if(_[_0x2c69('0x67')](_0x43b037)){throw new ReferenceError('Entity\x20not\x20found');}return _0x43b037;})[_0x2c69('0x27')](function(_0xceeaa7){var _0x2a6593=_0xceeaa7[_0x2c69('0x56')];logger[_0x2c69('0x68')](_0x2c69('0x69'),_0x2a6593);if(!_['isNil'](_0xceeaa7[_0x2c69('0x56')])&&fs['existsSync'](_0x2a6593)){logger[_0x2c69('0x68')]('File:\x20\x22'+_0x2a6593+_0x2c69('0x6a'));fs[_0x2c69('0x6b')](_0x2a6593);}_0x2a6593=_0x2a6593+_0x2c69('0x6c');if(!_[_0x2c69('0x67')](_0xceeaa7[_0x2c69('0x56')])&&fs['existsSync'](_0x2a6593)){logger[_0x2c69('0x68')](_0x2c69('0x6d')+_0x2a6593+_0x2c69('0x6a'));fs[_0x2c69('0x6b')](_0x2a6593);}return _0xceeaa7;})[_0x2c69('0x27')](function(_0x26e758){if(!_0x26e758)throw new InternalError();return _0x26e758[_0x2c69('0x28')]();})[_0x2c69('0x27')](function(){_0x29692b[_0x2c69('0x1c')](0xcc)[_0x2c69('0x1d')]();})[_0x2c69('0x46')](handleError(_0x29692b,null));};function getBucketslist(_0x3bf3ae,_0x27e4f0,_0x4a7ee2){return new Promise(function(_0x971dd,_0x4aec16){var _0x5cd6d0=new AWS['S3']({'accessKeyId':_0x27e4f0,'secretAccessKey':_0x3bf3ae,'region':_0x4a7ee2});_0x5cd6d0[_0x2c69('0x6e')]({},function(_0x36a940,_0x2f6039){if(_0x36a940){return _0x4aec16(_0x36a940);}else{return _0x971dd(_0x2f6039);}});});}function createBucket(_0x20446b,_0x27b1e4,_0x30e61d,_0x1b5f99){return new Promise(function(_0x1b9336,_0x3ff59b){var _0xa93e95=new AWS['S3']({'accessKeyId':_0x27b1e4,'secretAccessKey':_0x20446b,'region':_0x30e61d});_0xa93e95[_0x2c69('0x6f')]({'Bucket':_0x1b5f99},function(_0x1c2c57,_0x530ce4){if(_0x1c2c57){return _0x3ff59b(_0x1c2c57);}else{return _0x1b9336(_0x530ce4);}});});}function uploadFile(_0x4cc274,_0x3d0610,_0x46f6c0,_0xa7936a,_0x376642,_0x711a32){return new Promise(function(_0x5cf762,_0x426956){var _0x58893f=new AWS['S3']({'accessKeyId':_0x3d0610,'secretAccessKey':_0x4cc274,'region':_0x46f6c0});_0x58893f[_0x2c69('0x70')]({'Bucket':_0xa7936a,'Key':_0x376642,'Body':_0x711a32},function(_0x5c297f,_0x25e527){if(_0x5c297f){return _0x426956(_0x5c297f);}else{return _0x5cf762(_0x25e527);}});});}function startTranscribe(_0x23190b,_0x52bbcf,_0x285fb7,_0x100d3f,_0x5426a7,_0x1e1ae7){return new Promise(function(_0x2d1e89,_0x237698){var _0x3d8da5=new AWS[(_0x2c69('0x71'))]({'accessKeyId':_0x52bbcf,'secretAccessKey':_0x23190b,'region':_0x285fb7});_0x3d8da5['startTranscriptionJob']({'TranscriptionJobName':_0x100d3f,'LanguageCode':_0x5426a7,'Media':{'MediaFileUri':_0x1e1ae7}},function(_0x42eb11,_0x197ee8){if(_0x42eb11){return _0x237698(_0x42eb11);}else{return _0x2d1e89(_0x197ee8);}});});}function transcribe(_0x511dfd,_0x17996c,_0x5d5281,_0x512115,_0x3dbcdb,_0x3faa77,_0x36b453){return new Promise(function(_0x424c82,_0x528ee5){var _0x25b10e={};logger[_0x2c69('0x68')](util[_0x2c69('0x33')](_0x2c69('0x72'),_0x511dfd,_0x3dbcdb));return uploadFile(_0x17996c,_0x5d5281,_0x512115,_0x3dbcdb,path['basename'](_0x3faa77),fs[_0x2c69('0x73')](_0x3faa77))[_0x2c69('0x27')](function(_0x15ae57){logger[_0x2c69('0x68')](util[_0x2c69('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x511dfd,_0x3dbcdb,_0x15ae57['Location']));_0x25b10e[_0x2c69('0x74')]=_0x15ae57['Bucket'];_0x25b10e['location']=_0x15ae57['Location'];logger['info'](util[_0x2c69('0x33')](_0x2c69('0x75'),_0x511dfd));return startTranscribe(_0x17996c,_0x5d5281,_0x512115,uuidv4(),_0x36b453,_0x15ae57[_0x2c69('0x76')]);})[_0x2c69('0x27')](function(_0x46eefb){logger[_0x2c69('0x68')](util['format'](_0x2c69('0x77'),_0x511dfd,_0x46eefb[_0x2c69('0x78')]['TranscriptionJobName']));_0x25b10e[_0x2c69('0x79')]=_0x46eefb['TranscriptionJob'][_0x2c69('0x7a')];_0x25b10e['transcribeStatus']=_0x46eefb['TranscriptionJob'][_0x2c69('0x7b')];return _0x424c82(_0x25b10e);})[_0x2c69('0x46')](function(_0x30d847){return _0x528ee5(_0x30d847);});});}exports[_0x2c69('0x7c')]=function(_0x21ffae,_0x38a3d2,_0x4e687c){var _0x1d1d77;var _0x253f0f;var _0x3db5df;var _0x56cfc4=require(_0x2c69('0x51'));return db[_0x2c69('0x2e')][_0x2c69('0x7d')]({'where':{'id':_0x21ffae[_0x2c69('0x48')]['id']}})[_0x2c69('0x27')](function(_0xe84a7c){if(_0xe84a7c){var _0x50158b=util['format'](_0x2c69('0x65'),_0xe84a7c[_0x2c69('0x56')]);if(fs['existsSync'](_0x50158b)){cypher=!![];return _0x56cfc4['decryptFile'](_0x50158b,_0xe84a7c[_0x2c69('0x56')],config[_0x2c69('0x66')][_0x2c69('0x55')])['then'](function(){return _0xe84a7c;});}return _0xe84a7c;}})[_0x2c69('0x27')](function(_0x10a659){if(!_0x10a659){throw new db[(_0x2c69('0x57'))][(_0x2c69('0x58'))](_0x2c69('0x7e'));}_0x253f0f=_0x10a659;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x38a3d2,null))[_0x2c69('0x27')](function(_0x528919){if(_0x528919){_0x1d1d77=_0x528919;if(!_0x1d1d77[_0x2c69('0x7f')]||!_0x1d1d77[_0x2c69('0x80')]||!_0x1d1d77[_0x2c69('0x81')]||!_0x1d1d77['language']||!_0x1d1d77[_0x2c69('0x74')]){throw new db['Sequelize'][(_0x2c69('0x58'))](_0x2c69('0x82'));}if(_0x21ffae[_0x2c69('0x4c')][_0x2c69('0x83')]&&(!_0x1d1d77[_0x2c69('0x84')]||!_0x1d1d77[_0x2c69('0x85')]||!_0x1d1d77[_0x2c69('0x86')]||!_0x1d1d77['language']||!_0x1d1d77[_0x2c69('0x74')])){throw new db['Sequelize'][(_0x2c69('0x58'))](_0x2c69('0x87'));}return db[_0x2c69('0x88')][_0x2c69('0x7d')]({'where':{'id':_0x1d1d77['transcribeAccountId']}});}})['then'](function(_0x170804){if(!_0x170804){throw new db[(_0x2c69('0x57'))]['ValidationError'](_0x2c69('0x89'));}if(!_0x170804[_0x2c69('0x8a')]||!_0x170804[_0x2c69('0x8b')]){throw new db['Sequelize'][(_0x2c69('0x58'))](_0x2c69('0x8c'));}_0x3db5df=_0x170804;return getBucketslist(_0x3db5df[_0x2c69('0x8a')],_0x3db5df[_0x2c69('0x8b')],_0x1d1d77[_0x2c69('0x81')]);})[_0x2c69('0x27')](function(_0x1fcfd8){if(_0x1fcfd8&&_0x1fcfd8[_0x2c69('0x8d')]){var _0x340511=_[_0x2c69('0x4e')](_0x1fcfd8[_0x2c69('0x8d')],function(_0x10a8b4){return _0x10a8b4[_0x2c69('0x8e')]===_0x1d1d77[_0x2c69('0x74')];});if(!_0x340511){logger[_0x2c69('0x68')](util['format'](_0x2c69('0x8f'),_0x21ffae[_0x2c69('0x48')]['id'],_0x1d1d77[_0x2c69('0x74')]));return createBucket(_0x3db5df[_0x2c69('0x8a')],_0x3db5df[_0x2c69('0x8b')],_0x1d1d77[_0x2c69('0x81')],_0x1d1d77['bucket']);}logger[_0x2c69('0x68')](util['format'](_0x2c69('0x90'),_0x21ffae['params']['id'],_0x1d1d77[_0x2c69('0x74')]));return;}})[_0x2c69('0x27')](function(_0x78b025){if(_0x253f0f['transcribeStatus']===_0x2c69('0x91')){return transcribe(_0x21ffae[_0x2c69('0x48')]['id'],_0x3db5df['data1'],_0x3db5df[_0x2c69('0x8b')],_0x1d1d77[_0x2c69('0x81')],_0x1d1d77['bucket'],_0x253f0f['value'],_0x1d1d77[_0x2c69('0x92')]);}else{logger[_0x2c69('0x68')](util[_0x2c69('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x21ffae[_0x2c69('0x48')]['id']));return{'transcribeStatus':_0x2c69('0x93')};}})[_0x2c69('0x27')](function(_0x4aba7a){if(_0x4aba7a){_0x4aba7a[_0x2c69('0x94')]=_0x21ffae[_0x2c69('0x4c')]['runSentiment'];return _0x253f0f[_0x2c69('0x95')](_0x4aba7a);}})[_0x2c69('0x27')](respondWithResult(_0x38a3d2,null))[_0x2c69('0x46')](handleError(_0x38a3d2,null));};function writeFile(_0x187bad,_0x428195){return new Promise(function(_0x155db1,_0x392c8a){fs[_0x2c69('0x96')](_0x428195,_0x187bad,function(_0x38e548,_0x5e6806){if(_0x38e548){return _0x392c8a(_0x38e548);}else{return _0x155db1(_0x5e6806);}});});}exports[_0x2c69('0x97')]=function(_0xf4cbcb,_0xfd519e,_0x57f36d){return db[_0x2c69('0x2e')][_0x2c69('0x7d')]({'where':{'id':_0xf4cbcb[_0x2c69('0x48')]['id']}})[_0x2c69('0x27')](handleEntityNotFound(_0xfd519e))[_0x2c69('0x27')](function(_0x3102a1){if(_0x3102a1&&_0x3102a1[_0x2c69('0x98')]){var _0x35b91f=_0x3102a1[_0x2c69('0x98')];var _0x276bcd=config['root']+'/server/files/transcribes/transcribe_'+_0x3102a1['id']+'.txt';if(fs['existsSync'](_0x276bcd)){return _0x276bcd;}return writeFile(_0x35b91f,_0x276bcd)[_0x2c69('0x27')](function(){return _0x276bcd;});}else{throw new db['Sequelize'][(_0x2c69('0x58'))](_0x2c69('0x99'));}})['then'](function(_0x118041){return _0xfd519e[_0x2c69('0x50')](_0x118041);})['catch'](handleError(_0xfd519e));}; \ No newline at end of file +var _0xb7f6=['runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus'];(function(_0x5c502d,_0x2c1799){var _0x2da107=function(_0x4ec6eb){while(--_0x4ec6eb){_0x5c502d['push'](_0x5c502d['shift']());}};_0x2da107(++_0x2c1799);}(_0xb7f6,0x15d));var _0x6b7f=function(_0x4856f1,_0x80ec4b){_0x4856f1=_0x4856f1-0x0;var _0x5e8223=_0xb7f6[_0x4856f1];return _0x5e8223;};'use strict';var emlformat=require(_0x6b7f('0x0'));var rimraf=require(_0x6b7f('0x1'));var zipdir=require(_0x6b7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b7f('0x3'));var moment=require('moment');var BPromise=require(_0x6b7f('0x4'));var Mustache=require('mustache');var util=require(_0x6b7f('0x5'));var path=require(_0x6b7f('0x6'));var sox=require(_0x6b7f('0x7'));var csv=require(_0x6b7f('0x8'));var ejs=require(_0x6b7f('0x9'));var fs=require('fs');var fs_extra=require(_0x6b7f('0xa'));var _=require(_0x6b7f('0xb'));var squel=require(_0x6b7f('0xc'));var crypto=require(_0x6b7f('0xd'));var jsforce=require(_0x6b7f('0xe'));var deskjs=require(_0x6b7f('0xf'));var toCsv=require(_0x6b7f('0x8'));var querystring=require(_0x6b7f('0x10'));var Papa=require(_0x6b7f('0x11'));var AWS=require(_0x6b7f('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0x6b7f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6b7f('0x14'));var as=require(_0x6b7f('0x15'));var hardwareService=require(_0x6b7f('0x16'));var logger=require(_0x6b7f('0x17'))(_0x6b7f('0x18'));var utils=require(_0x6b7f('0x19'));var config=require(_0x6b7f('0x1a'));var licenseUtil=require(_0x6b7f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x485032,_0x52eb8e){_0x52eb8e=_0x52eb8e||0xcc;return function(_0x2d9572){if(_0x2d9572){return _0x485032[_0x6b7f('0x1c')](_0x52eb8e);}return _0x485032[_0x6b7f('0x1d')](_0x52eb8e)[_0x6b7f('0x1e')]();};}function respondWithResult(_0x2b9a70,_0xaffa3a){_0xaffa3a=_0xaffa3a||0xc8;return function(_0x3fc54e){if(_0x3fc54e){return _0x2b9a70[_0x6b7f('0x1d')](_0xaffa3a)[_0x6b7f('0x1f')](_0x3fc54e);}};}function respondWithFilteredResult(_0x22e1f7,_0x44719e){return function(_0x289df7){if(_0x289df7){var _0x33a8cb=typeof _0x44719e[_0x6b7f('0x20')]===_0x6b7f('0x21')&&typeof _0x44719e[_0x6b7f('0x22')]==='undefined';var _0x4b0fe4=_0x289df7[_0x6b7f('0x23')];var _0x5e6ab6=_0x33a8cb?0x0:_0x44719e[_0x6b7f('0x20')];var _0xed40e2=_0x33a8cb?_0x289df7[_0x6b7f('0x23')]:_0x44719e['offset']+_0x44719e['limit'];var _0x465518;if(_0xed40e2>=_0x4b0fe4){_0xed40e2=_0x4b0fe4;_0x465518=0xc8;}else{_0x465518=0xce;}_0x22e1f7[_0x6b7f('0x1d')](_0x465518);return _0x22e1f7[_0x6b7f('0x24')](_0x6b7f('0x25'),_0x5e6ab6+'-'+_0xed40e2+'/'+_0x4b0fe4)['json'](_0x289df7);}return null;};}function patchUpdates(_0xa766a1){return function(_0x3f1923){try{jsonpatch[_0x6b7f('0x26')](_0x3f1923,_0xa766a1,!![]);}catch(_0x4f0995){return BPromise[_0x6b7f('0x27')](_0x4f0995);}return _0x3f1923[_0x6b7f('0x28')]();};}function saveUpdates(_0x5675c5,_0x4e1cf9){return function(_0x1efe8f){if(_0x1efe8f){return _0x1efe8f[_0x6b7f('0x29')](_0x5675c5)[_0x6b7f('0x2a')](function(_0x14ff59){return _0x14ff59;});}return null;};}function removeEntity(_0x1d4306,_0xbd83f9){return function(_0x198e4a){if(_0x198e4a){return _0x198e4a[_0x6b7f('0x2b')]()[_0x6b7f('0x2a')](function(){_0x1d4306['status'](0xcc)[_0x6b7f('0x1e')]();});}};}function handleEntityNotFound(_0x31e39c,_0x5f428f){return function(_0x4d7b2b){if(!_0x4d7b2b){_0x31e39c['sendStatus'](0x194);}return _0x4d7b2b;};}function handleError(_0x11a27f,_0x35776a){_0x35776a=_0x35776a||0x1f4;return function(_0x48abe9){logger[_0x6b7f('0x2c')](_0x48abe9[_0x6b7f('0x2d')]);if(_0x48abe9[_0x6b7f('0x2e')]){delete _0x48abe9[_0x6b7f('0x2e')];}_0x11a27f[_0x6b7f('0x1d')](_0x35776a)[_0x6b7f('0x2f')](_0x48abe9);};}exports[_0x6b7f('0x30')]=function(_0x9e2da3,_0x564f67){var _0x4264cf={},_0x5e55ea={},_0x332bb2={'count':0x0,'rows':[]};var _0x2e9a35=_['map'](db[_0x6b7f('0x31')][_0x6b7f('0x32')],function(_0x50d5ed){return{'name':_0x50d5ed[_0x6b7f('0x33')],'type':_0x50d5ed['type'][_0x6b7f('0x34')]};});_0x5e55ea[_0x6b7f('0x35')]=_[_0x6b7f('0x36')](_[_0x6b7f('0x37')](_0x2e9a35,_0x6b7f('0x2e')),['format']);_0x5e55ea[_0x6b7f('0x38')]=_[_0x6b7f('0x39')](_0x9e2da3[_0x6b7f('0x38')]);_0x5e55ea['filters']=_[_0x6b7f('0x3a')](_0x5e55ea['model'],_0x5e55ea[_0x6b7f('0x38')]);_0x4264cf[_0x6b7f('0x3b')]=_[_0x6b7f('0x3a')](_0x5e55ea[_0x6b7f('0x35')],qs[_0x6b7f('0x3c')](_0x9e2da3['query'][_0x6b7f('0x3c')]));_0x4264cf[_0x6b7f('0x3b')]=_0x4264cf[_0x6b7f('0x3b')][_0x6b7f('0x3d')]?_0x4264cf['attributes']:_0x5e55ea['model'];if(!_0x9e2da3[_0x6b7f('0x38')]['hasOwnProperty'](_0x6b7f('0x3e'))){_0x4264cf[_0x6b7f('0x22')]=qs[_0x6b7f('0x22')](_0x9e2da3[_0x6b7f('0x38')][_0x6b7f('0x22')]);_0x4264cf[_0x6b7f('0x20')]=qs['offset'](_0x9e2da3[_0x6b7f('0x38')]['offset']);}_0x4264cf['order']=qs[_0x6b7f('0x3f')](_0x9e2da3['query'][_0x6b7f('0x3f')]);_0x4264cf[_0x6b7f('0x40')]=qs[_0x6b7f('0x41')](_[_0x6b7f('0x42')](_0x9e2da3[_0x6b7f('0x38')],_0x5e55ea[_0x6b7f('0x41')]),_0x2e9a35);if(_0x9e2da3[_0x6b7f('0x38')][_0x6b7f('0x43')]){_0x4264cf[_0x6b7f('0x40')]=_['merge'](_0x4264cf[_0x6b7f('0x40')],{'$or':_['map'](_0x2e9a35,function(_0x7ef305){if(_0x7ef305[_0x6b7f('0x44')]!=='VIRTUAL'){var _0x23ea70={};_0x23ea70[_0x7ef305[_0x6b7f('0x2e')]]={'$like':'%'+_0x9e2da3[_0x6b7f('0x38')][_0x6b7f('0x43')]+'%'};return _0x23ea70;}})});}_0x4264cf=_[_0x6b7f('0x45')]({},_0x4264cf,_0x9e2da3[_0x6b7f('0x46')]);var _0x8eee21={'where':_0x4264cf[_0x6b7f('0x40')]};return db['VoiceRecording'][_0x6b7f('0x23')](_0x8eee21)[_0x6b7f('0x2a')](function(_0x435dbd){_0x332bb2[_0x6b7f('0x23')]=_0x435dbd;if(_0x9e2da3[_0x6b7f('0x38')][_0x6b7f('0x47')]){_0x4264cf[_0x6b7f('0x48')]=[{'all':!![]}];}return db[_0x6b7f('0x31')][_0x6b7f('0x49')](_0x4264cf);})[_0x6b7f('0x2a')](function(_0x46312b){_0x332bb2[_0x6b7f('0x4a')]=_0x46312b;return _0x332bb2;})[_0x6b7f('0x2a')](respondWithFilteredResult(_0x564f67,_0x4264cf))[_0x6b7f('0x4b')](handleError(_0x564f67,null));};exports[_0x6b7f('0x4c')]=function(_0x2145e5,_0x456d99){var _0x1c41cc={'raw':![],'where':{'id':_0x2145e5[_0x6b7f('0x4d')]['id']}},_0x1008c6={};_0x1008c6[_0x6b7f('0x35')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x1008c6[_0x6b7f('0x38')]=_[_0x6b7f('0x39')](_0x2145e5[_0x6b7f('0x38')]);_0x1008c6['filters']=_[_0x6b7f('0x3a')](_0x1008c6[_0x6b7f('0x35')],_0x1008c6[_0x6b7f('0x38')]);_0x1c41cc[_0x6b7f('0x3b')]=_['intersection'](_0x1008c6[_0x6b7f('0x35')],qs['fields'](_0x2145e5['query']['fields']));_0x1c41cc['attributes']=_0x1c41cc[_0x6b7f('0x3b')][_0x6b7f('0x3d')]?_0x1c41cc[_0x6b7f('0x3b')]:_0x1008c6[_0x6b7f('0x35')];if(_0x2145e5[_0x6b7f('0x38')]['includeAll']){_0x1c41cc[_0x6b7f('0x48')]=[{'all':!![]}];}_0x1c41cc=_[_0x6b7f('0x45')]({},_0x1c41cc,_0x2145e5[_0x6b7f('0x46')]);return db[_0x6b7f('0x31')][_0x6b7f('0x4e')](_0x1c41cc)[_0x6b7f('0x2a')](handleEntityNotFound(_0x456d99,null))['then'](respondWithResult(_0x456d99,null))['catch'](handleError(_0x456d99,null));};exports[_0x6b7f('0x4f')]=function(_0x5b2065,_0x542d00){return db[_0x6b7f('0x31')][_0x6b7f('0x4f')](_0x5b2065[_0x6b7f('0x50')],{})['then'](respondWithResult(_0x542d00,0xc9))[_0x6b7f('0x4b')](handleError(_0x542d00,null));};exports[_0x6b7f('0x29')]=function(_0x41ef97,_0x1024ed){if(_0x41ef97[_0x6b7f('0x50')]['id']){delete _0x41ef97[_0x6b7f('0x50')]['id'];}return db[_0x6b7f('0x31')][_0x6b7f('0x4e')]({'where':{'id':_0x41ef97[_0x6b7f('0x4d')]['id']}})[_0x6b7f('0x2a')](handleEntityNotFound(_0x1024ed,null))[_0x6b7f('0x2a')](saveUpdates(_0x41ef97[_0x6b7f('0x50')],null))['then'](respondWithResult(_0x1024ed,null))['catch'](handleError(_0x1024ed,null));};exports[_0x6b7f('0x51')]=function(_0x3968c8,_0x3ad7e7){return db[_0x6b7f('0x31')][_0x6b7f('0x51')]()['then'](respondWithResult(_0x3ad7e7,null))[_0x6b7f('0x4b')](handleError(_0x3ad7e7,null));};exports[_0x6b7f('0x52')]=function(_0x3ecd9f,_0x5a12a0,_0xeddc54){var _0x48c22f=require('../../components/encryptor');var _0x5a26f7=![];var _0x322142={};if(_0x3ecd9f['query'][_0x6b7f('0x44')]&&_0x3ecd9f[_0x6b7f('0x38')][_0x6b7f('0x44')]===_0x6b7f('0x53')){_0x322142[_0x6b7f('0x53')]=_0x3ecd9f[_0x6b7f('0x4d')]['id'];}else{_0x322142['id']=_0x3ecd9f[_0x6b7f('0x4d')]['id'];}return db[_0x6b7f('0x31')][_0x6b7f('0x4e')]({'where':_0x322142,'attributes':['id',_0x6b7f('0x54')],'raw':!![]})[_0x6b7f('0x2a')](handleEntityNotFound(_0x5a12a0,null))[_0x6b7f('0x2a')](function(_0x4eb2bb){if(_0x4eb2bb){var _0x30307d=_0x4eb2bb[_0x6b7f('0x54')];var _0x13d56b=util[_0x6b7f('0x55')](_0x6b7f('0x56'),_0x30307d);if(fs[_0x6b7f('0x57')](_0x13d56b)){_0x5a26f7=!![];return _0x48c22f[_0x6b7f('0x58')](_0x13d56b,_0x30307d,config[_0x6b7f('0x59')][_0x6b7f('0x5a')])[_0x6b7f('0x2a')](function(){return _0x4eb2bb;});}return _0x4eb2bb;}})['then'](function(_0x25990b){if(_0x25990b){var _0x2b094f=_0x25990b['value'];if(!fs[_0x6b7f('0x57')](_0x2b094f)){throw new db[(_0x6b7f('0x5b'))][(_0x6b7f('0x5c'))](_0x6b7f('0x5d'));}if(_0x25990b[_0x6b7f('0x5e')]){return _0x5a12a0[_0x6b7f('0x52')](_0x2b094f,_0x25990b[_0x6b7f('0x5e')]+path['extname'](_0x2b094f),function(){if(_0x5a26f7){fs[_0x6b7f('0x5f')](_0x2b094f);}});}else{return _0x5a12a0['download'](_0x2b094f,function(_0x6964b5){if(_0x5a26f7){fs[_0x6b7f('0x5f')](_0x2b094f);}});}}})[_0x6b7f('0x4b')](function(_0x3b0534){if(_0x3b0534['message']===_0x6b7f('0x5d')){_0x5a12a0[_0x6b7f('0x1d')](0x194)[_0x6b7f('0x2f')](_0x6b7f('0x60'));}else{return handleError(_0x5a12a0,null);}});};exports[_0x6b7f('0x61')]=function(_0x38dbb8,_0x170278,_0x3697e0){var _0x4585dd=require(_0x6b7f('0x62'));var _0xeffe48=![];var _0x4d9c8b={'$and':[db[_0x6b7f('0x63')]['where'](db['sequelize']['fn'](_0x6b7f('0x64'),db[_0x6b7f('0x63')][_0x6b7f('0x65')](_0x6b7f('0x53'))),_0x38dbb8[_0x6b7f('0x38')]['token'])]};if(_0x38dbb8['query'][_0x6b7f('0x44')]&&_0x38dbb8['query'][_0x6b7f('0x44')]===_0x6b7f('0x53')){_0x4d9c8b[_0x6b7f('0x66')][_0x6b7f('0x67')]({'uniqueid':_0x38dbb8['params']['id']});}else{_0x4d9c8b['$and'][_0x6b7f('0x67')]({'id':_0x38dbb8['params']['id']});}return db[_0x6b7f('0x31')][_0x6b7f('0x4e')]({'where':_0x4d9c8b,'attributes':['id',_0x6b7f('0x54')],'raw':!![]})[_0x6b7f('0x2a')](handleEntityNotFound(_0x170278,null))[_0x6b7f('0x2a')](function(_0x1ade29){if(_0x1ade29){var _0x4cdc8f=util['format']('%s.cypher',_0x1ade29[_0x6b7f('0x54')]);if(fs[_0x6b7f('0x57')](_0x4cdc8f)){_0xeffe48=!![];return _0x4585dd[_0x6b7f('0x58')](_0x4cdc8f,_0x1ade29[_0x6b7f('0x54')],config[_0x6b7f('0x59')]['recording'])[_0x6b7f('0x2a')](function(){return _0x1ade29;});}return _0x1ade29;}})['then'](function(_0x129a1f){if(_0x129a1f){if(!fs[_0x6b7f('0x57')](_0x129a1f[_0x6b7f('0x54')])){throw new db[(_0x6b7f('0x5b'))]['ValidationError'](_0x6b7f('0x5d'));}if(_0x129a1f[_0x6b7f('0x5e')]){return _0x170278[_0x6b7f('0x52')](_0x129a1f[_0x6b7f('0x54')],_0x129a1f[_0x6b7f('0x5e')]+path[_0x6b7f('0x68')](_0x129a1f[_0x6b7f('0x54')]),function(){if(_0xeffe48){fs[_0x6b7f('0x5f')](_0x129a1f[_0x6b7f('0x54')]);}});}else{return _0x170278['download'](_0x129a1f[_0x6b7f('0x54')],function(_0x197c4f){if(_0xeffe48){fs[_0x6b7f('0x5f')](_0x129a1f['value']);}});}}})[_0x6b7f('0x4b')](handleError(_0x170278,null));};exports[_0x6b7f('0x2b')]=function(_0x4bdc6e,_0x5e62d3){return db[_0x6b7f('0x31')][_0x6b7f('0x4e')]({'where':{'id':_0x4bdc6e['params']['id']}})[_0x6b7f('0x2a')](function(_0x201271){if(_[_0x6b7f('0x69')](_0x201271)){throw new ReferenceError(_0x6b7f('0x6a'));}return _0x201271;})[_0x6b7f('0x2a')](function(_0x123d5e){var _0x5a1e50=_0x123d5e[_0x6b7f('0x54')];logger['info'](_0x6b7f('0x6b'),_0x5a1e50);if(!_[_0x6b7f('0x69')](_0x123d5e[_0x6b7f('0x54')])&&fs[_0x6b7f('0x57')](_0x5a1e50)){logger[_0x6b7f('0x6c')](_0x6b7f('0x6d')+_0x5a1e50+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6b7f('0x6e')](_0x5a1e50);}_0x5a1e50=_0x5a1e50+'.cypher';if(!_[_0x6b7f('0x69')](_0x123d5e[_0x6b7f('0x54')])&&fs[_0x6b7f('0x57')](_0x5a1e50)){logger['info'](_0x6b7f('0x6d')+_0x5a1e50+_0x6b7f('0x6f'));fs[_0x6b7f('0x6e')](_0x5a1e50);}return _0x123d5e;})[_0x6b7f('0x2a')](function(_0x4dd35f){if(!_0x4dd35f)throw new InternalError();return _0x4dd35f[_0x6b7f('0x2b')]();})[_0x6b7f('0x2a')](function(){_0x5e62d3[_0x6b7f('0x1d')](0xcc)[_0x6b7f('0x1e')]();})['catch'](handleError(_0x5e62d3,null));};function getBucketslist(_0xb3ce4,_0x2ba811,_0x1cc468){return new Promise(function(_0x339f19,_0x542e44){var _0x41db26=new AWS['S3']({'accessKeyId':_0x2ba811,'secretAccessKey':_0xb3ce4,'region':_0x1cc468});_0x41db26[_0x6b7f('0x70')]({},function(_0x1055d1,_0x18d6d4){if(_0x1055d1){return _0x542e44(_0x1055d1);}else{return _0x339f19(_0x18d6d4);}});});}function createBucket(_0x2a66c6,_0x5f1f94,_0x23e438,_0x45bec7){return new Promise(function(_0x50437d,_0x37e855){var _0x4bf8a5=new AWS['S3']({'accessKeyId':_0x5f1f94,'secretAccessKey':_0x2a66c6,'region':_0x23e438});_0x4bf8a5[_0x6b7f('0x71')]({'Bucket':_0x45bec7},function(_0x2e1b9b,_0x46674e){if(_0x2e1b9b){return _0x37e855(_0x2e1b9b);}else{return _0x50437d(_0x46674e);}});});}function uploadFile(_0x1c7713,_0x5bc5b3,_0xb857da,_0x50de79,_0x261b16,_0x5b62b6){return new Promise(function(_0x50755c,_0x4178ca){var _0x2d3bbc=new AWS['S3']({'accessKeyId':_0x5bc5b3,'secretAccessKey':_0x1c7713,'region':_0xb857da});_0x2d3bbc['upload']({'Bucket':_0x50de79,'Key':_0x261b16,'Body':_0x5b62b6},function(_0x420135,_0xb3cfae){if(_0x420135){return _0x4178ca(_0x420135);}else{return _0x50755c(_0xb3cfae);}});});}function startTranscribe(_0x359ef5,_0x559a61,_0x216e7b,_0x122a86,_0x2eff16,_0x46c056){return new Promise(function(_0x557733,_0x129f7f){var _0x388a15=new AWS['TranscribeService']({'accessKeyId':_0x559a61,'secretAccessKey':_0x359ef5,'region':_0x216e7b});_0x388a15[_0x6b7f('0x72')]({'TranscriptionJobName':_0x122a86,'LanguageCode':_0x2eff16,'Media':{'MediaFileUri':_0x46c056}},function(_0x20cb21,_0x170aa0){if(_0x20cb21){return _0x129f7f(_0x20cb21);}else{return _0x557733(_0x170aa0);}});});}function transcribe(_0x276db2,_0x2c3dca,_0x4805ed,_0x365963,_0x3b222b,_0x13e896,_0x4e0e93){return new Promise(function(_0x404398,_0x14d56c){var _0x126343={};logger[_0x6b7f('0x6c')](util[_0x6b7f('0x55')](_0x6b7f('0x73'),_0x276db2,_0x3b222b));return uploadFile(_0x2c3dca,_0x4805ed,_0x365963,_0x3b222b,path[_0x6b7f('0x74')](_0x13e896),fs[_0x6b7f('0x75')](_0x13e896))[_0x6b7f('0x2a')](function(_0x38374b){logger['info'](util['format'](_0x6b7f('0x76'),_0x276db2,_0x3b222b,_0x38374b['Location']));_0x126343[_0x6b7f('0x77')]=_0x38374b[_0x6b7f('0x78')];_0x126343[_0x6b7f('0x79')]=_0x38374b[_0x6b7f('0x7a')];logger[_0x6b7f('0x6c')](util[_0x6b7f('0x55')](_0x6b7f('0x7b'),_0x276db2));return startTranscribe(_0x2c3dca,_0x4805ed,_0x365963,uuidv4(),_0x4e0e93,_0x38374b['Location']);})[_0x6b7f('0x2a')](function(_0x81583a){logger['info'](util['format'](_0x6b7f('0x7c'),_0x276db2,_0x81583a[_0x6b7f('0x7d')][_0x6b7f('0x7e')]));_0x126343['transcribeName']=_0x81583a[_0x6b7f('0x7d')][_0x6b7f('0x7e')];_0x126343[_0x6b7f('0x7f')]=_0x81583a['TranscriptionJob']['TranscriptionJobStatus'];return _0x404398(_0x126343);})[_0x6b7f('0x4b')](function(_0x424c66){return _0x14d56c(_0x424c66);});});}exports[_0x6b7f('0x80')]=function(_0x1cf342,_0x7e97a8,_0x2c162b){var _0x3330e5;var _0x3c3dd4;var _0x18fe1b;var _0x2f89a7=require(_0x6b7f('0x62'));return db[_0x6b7f('0x31')][_0x6b7f('0x81')]({'where':{'id':_0x1cf342[_0x6b7f('0x4d')]['id']}})['then'](function(_0x24708e){if(_0x24708e){var _0xc42281=util[_0x6b7f('0x55')]('%s.cypher',_0x24708e[_0x6b7f('0x54')]);if(fs[_0x6b7f('0x57')](_0xc42281)){cypher=!![];return _0x2f89a7['decryptFile'](_0xc42281,_0x24708e['value'],config[_0x6b7f('0x59')]['recording'])['then'](function(){return _0x24708e;});}return _0x24708e;}})[_0x6b7f('0x2a')](function(_0x298476){if(!_0x298476){throw new db[(_0x6b7f('0x5b'))][(_0x6b7f('0x5c'))](_0x6b7f('0x82'));}_0x3c3dd4=_0x298476;return db[_0x6b7f('0x83')][_0x6b7f('0x81')]({'where':{'id':0x1}});})[_0x6b7f('0x2a')](handleEntityNotFound(_0x7e97a8,null))[_0x6b7f('0x2a')](function(_0x3c1b57){if(_0x3c1b57){_0x3330e5=_0x3c1b57;if(!_0x3330e5[_0x6b7f('0x84')]||!_0x3330e5[_0x6b7f('0x85')]||!_0x3330e5['transcribeRegion']||!_0x3330e5[_0x6b7f('0x86')]||!_0x3330e5['bucket']){throw new db['Sequelize']['ValidationError'](_0x6b7f('0x87'));}if(_0x1cf342[_0x6b7f('0x50')][_0x6b7f('0x88')]&&(!_0x3330e5[_0x6b7f('0x89')]||!_0x3330e5[_0x6b7f('0x8a')]||!_0x3330e5['sentimentRegion']||!_0x3330e5[_0x6b7f('0x86')]||!_0x3330e5[_0x6b7f('0x77')])){throw new db[(_0x6b7f('0x5b'))][(_0x6b7f('0x5c'))](_0x6b7f('0x8b'));}return db[_0x6b7f('0x8c')]['findOne']({'where':{'id':_0x3330e5[_0x6b7f('0x85')]}});}})[_0x6b7f('0x2a')](function(_0x337e43){if(!_0x337e43){throw new db[(_0x6b7f('0x5b'))][(_0x6b7f('0x5c'))](_0x6b7f('0x8d'));}if(!_0x337e43[_0x6b7f('0x8e')]||!_0x337e43[_0x6b7f('0x8f')]){throw new db['Sequelize'][(_0x6b7f('0x5c'))]('Cloud\x20Provider\x20not\x20configured');}_0x18fe1b=_0x337e43;return getBucketslist(_0x18fe1b[_0x6b7f('0x8e')],_0x18fe1b[_0x6b7f('0x8f')],_0x3330e5['transcribeRegion']);})[_0x6b7f('0x2a')](function(_0x783523){if(_0x783523&&_0x783523[_0x6b7f('0x90')]){var _0x27da59=_['find'](_0x783523[_0x6b7f('0x90')],function(_0x31b1e0){return _0x31b1e0[_0x6b7f('0x91')]===_0x3330e5[_0x6b7f('0x77')];});if(!_0x27da59){logger['info'](util['format'](_0x6b7f('0x92'),_0x1cf342[_0x6b7f('0x4d')]['id'],_0x3330e5['bucket']));return createBucket(_0x18fe1b['data1'],_0x18fe1b['data2'],_0x3330e5[_0x6b7f('0x93')],_0x3330e5[_0x6b7f('0x77')]);}logger['info'](util['format'](_0x6b7f('0x94'),_0x1cf342['params']['id'],_0x3330e5['bucket']));return;}})['then'](function(_0x357a92){if(_0x3c3dd4[_0x6b7f('0x7f')]===_0x6b7f('0x95')){return transcribe(_0x1cf342['params']['id'],_0x18fe1b[_0x6b7f('0x8e')],_0x18fe1b[_0x6b7f('0x8f')],_0x3330e5[_0x6b7f('0x93')],_0x3330e5['bucket'],_0x3c3dd4[_0x6b7f('0x54')],_0x3330e5['language']);}else{logger['info'](util['format'](_0x6b7f('0x96'),_0x1cf342[_0x6b7f('0x4d')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x6b7f('0x2a')](function(_0x1ea0ac){if(_0x1ea0ac){_0x1ea0ac[_0x6b7f('0x97')]=_0x1cf342[_0x6b7f('0x50')][_0x6b7f('0x88')];return _0x3c3dd4[_0x6b7f('0x98')](_0x1ea0ac);}})[_0x6b7f('0x2a')](respondWithResult(_0x7e97a8,null))[_0x6b7f('0x4b')](handleError(_0x7e97a8,null));};function writeFile(_0x5229d3,_0x1343b){return new Promise(function(_0x475b9a,_0x4760d5){fs[_0x6b7f('0x99')](_0x1343b,_0x5229d3,function(_0x41f071,_0x5eb181){if(_0x41f071){return _0x4760d5(_0x41f071);}else{return _0x475b9a(_0x5eb181);}});});}exports[_0x6b7f('0x9a')]=function(_0xfdd2fc,_0x53bea0,_0x21860e){return db[_0x6b7f('0x31')][_0x6b7f('0x81')]({'where':{'id':_0xfdd2fc[_0x6b7f('0x4d')]['id']}})[_0x6b7f('0x2a')](handleEntityNotFound(_0x53bea0))[_0x6b7f('0x2a')](function(_0x92ed4e){if(_0x92ed4e&&_0x92ed4e[_0x6b7f('0x9b')]){var _0x3ab278=_0x92ed4e[_0x6b7f('0x9b')];var _0x1c7132=config[_0x6b7f('0x9c')]+'/server/files/transcribes/transcribe_'+_0x92ed4e['id']+_0x6b7f('0x9d');if(fs[_0x6b7f('0x57')](_0x1c7132)){return _0x1c7132;}return writeFile(_0x3ab278,_0x1c7132)[_0x6b7f('0x2a')](function(){return _0x1c7132;});}else{throw new db['Sequelize'][(_0x6b7f('0x5c'))](_0x6b7f('0x9e'));}})[_0x6b7f('0x2a')](function(_0x215bc0){return _0x53bea0[_0x6b7f('0x52')](_0x215bc0);})['catch'](handleError(_0x53bea0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0100a14..0349be4 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 _0x8972=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5d1c98,_0x4bf7a2){var _0x2a2909=function(_0xe932c7){while(--_0xe932c7){_0x5d1c98['push'](_0x5d1c98['shift']());}};_0x2a2909(++_0x4bf7a2);}(_0x8972,0xd8));var _0x2897=function(_0x480885,_0xfa7991){_0x480885=_0x480885-0x0;var _0x3dc63e=_0x8972[_0x480885];return _0x3dc63e;};'use strict';var _=require(_0x2897('0x0'));var util=require(_0x2897('0x1'));var logger=require(_0x2897('0x2'))('api');var moment=require(_0x2897('0x3'));var BPromise=require(_0x2897('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2897('0x5'));var rimraf=require(_0x2897('0x6'));var config=require(_0x2897('0x7'));var attributes=require(_0x2897('0x8'));module[_0x2897('0x9')]=function(_0x468a0f,_0x3cd9a8){return _0x468a0f[_0x2897('0xa')](_0x2897('0xb'),attributes,{'tableName':_0x2897('0xc'),'paranoid':![],'indexes':[{'name':_0x2897('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe79a=['uniqueid','transcribeStatus','define','VoiceRecording','voice_recordings'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xe79a,0x70));var _0xae79=function(_0x310ee0,_0x1c5d46){_0x310ee0=_0x310ee0-0x0;var _0x2aae43=_0xe79a[_0x310ee0];return _0x2aae43;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x15325f,_0x51f320){return _0x15325f[_0xae79('0x0')](_0xae79('0x1'),attributes,{'tableName':_0xae79('0x2'),'paranoid':![],'indexes':[{'name':_0xae79('0x3'),'fields':['uniqueid']},{'name':_0xae79('0x4'),'fields':[_0xae79('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 18fd9e2..384a8a1 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 _0x81c6=['unlink','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','limit','../../components/encryptor','Setting','findOne','create','body','existsSync','value','%s.cypher','encryptFile','secrets'];(function(_0x45d9c2,_0x453fb8){var _0x1045db=function(_0x4c8ef6){while(--_0x4c8ef6){_0x45d9c2['push'](_0x45d9c2['shift']());}};_0x1045db(++_0x453fb8);}(_0x81c6,0x1d5));var _0x681c=function(_0x28c89b,_0x2510b3){_0x28c89b=_0x28c89b-0x0;var _0x176500=_0x81c6[_0x28c89b];return _0x176500;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')](_0x42f506['body'],{'raw':_0x42f506[_0x681c('0x18')]?_0x42f506['options'][_0x681c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1a')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506['options']['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]||null:null})[_0x681c('0x9')](function(_0x27b8a0){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger[_0x681c('0xb')](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x27b8a0));_0x42304f(_0x27b8a0);})[_0x681c('0x14')](function(_0x2be552){logger[_0x681c('0x10')](_0x681c('0x15'),_0x2be552[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192[_0x681c('0x10')](0x1f4,_0x2be552[_0x681c('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x11063b){var _0x5705a7=this;return new Promise(function(_0x5f8d64,_0x4bf08e){var _0x583499=require(_0x681c('0x1c'));var _0x17ea7c;return db[_0x681c('0x1d')][_0x681c('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x681c('0x9')](function(_0x39fca3){_0x17ea7c=_0x39fca3;return db[_0x681c('0x16')][_0x681c('0x1f')](_0x11063b[_0x681c('0x20')]);})[_0x681c('0x9')](function(_0x2c619f){if(_0x17ea7c['callRecordingEncryption']&&fs[_0x681c('0x21')](_0x2c619f[_0x681c('0x22')])){var _0x2e783d=util['format'](_0x681c('0x23'),_0x2c619f[_0x681c('0x22')]);return _0x583499[_0x681c('0x24')](_0x2c619f['value'],_0x2e783d,config[_0x681c('0x25')]['recording'])['then'](function(){fs[_0x681c('0x26')](_0x2c619f[_0x681c('0x22')]);logger[_0x681c('0x12')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2c619f;});}return _0x2c619f;})[_0x681c('0x9')](function(_0x508fb9){logger[_0x681c('0x12')]('CreateVoiceRecording',_0x11063b);logger['debug']('CreateVoiceRecording',_0x11063b,JSON[_0x681c('0xe')](_0x508fb9));_0x5f8d64(_0x508fb9);})[_0x681c('0x14')](function(_0x5a349a){logger[_0x681c('0x10')]('CreateVoiceRecording',_0x5a349a['message'],_0x11063b);_0x4bf08e(_0x5705a7[_0x681c('0x10')](0x1f4,_0x5a349a['message']));});});}; \ No newline at end of file +var _0x82c4=['value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','options','raw','where','attributes','CreateVoiceRecording','../../components/encryptor','findOne','create','body','callRecordingEncryption','existsSync'];(function(_0x1b3afc,_0x329380){var _0x392dbb=function(_0x3a5cb2){while(--_0x3a5cb2){_0x1b3afc['push'](_0x1b3afc['shift']());}};_0x392dbb(++_0x329380);}(_0x82c4,0x1ca));var _0x482c=function(_0x1f175e,_0x25487c){_0x1f175e=_0x1f175e-0x0;var _0x4ab74c=_0x82c4[_0x1f175e];return _0x4ab74c;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['VoiceRecording'][_0x482c('0x16')](_0x5b6f7e['body'],{'raw':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e['options'][_0x482c('0x19')]||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e['options']['limit']||null:null})[_0x482c('0xa')](function(_0x147d05){logger[_0x482c('0xb')]('UpdateVoiceRecording',_0x5b6f7e);logger[_0x482c('0xe')]('UpdateVoiceRecording',_0x5b6f7e,JSON[_0x482c('0xf')](_0x147d05));_0x258148(_0x147d05);})[_0x482c('0x14')](function(_0x4f1108){logger[_0x482c('0x10')]('UpdateVoiceRecording',_0x4f1108['message'],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x4f1108[_0x482c('0x12')]));});});};exports[_0x482c('0x1b')]=function(_0x1f4501){var _0x3bd5bb=this;return new Promise(function(_0x215826,_0x2981d2){var _0x5ad788=require(_0x482c('0x1c'));var _0x255417;return db['Setting'][_0x482c('0x1d')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x207441){_0x255417=_0x207441;return db['VoiceRecording'][_0x482c('0x1e')](_0x1f4501[_0x482c('0x1f')]);})[_0x482c('0xa')](function(_0x11fa65){if(_0x255417[_0x482c('0x20')]&&fs[_0x482c('0x21')](_0x11fa65[_0x482c('0x22')])){var _0x3e9b22=util[_0x482c('0x23')](_0x482c('0x24'),_0x11fa65[_0x482c('0x22')]);return _0x5ad788[_0x482c('0x25')](_0x11fa65[_0x482c('0x22')],_0x3e9b22,config[_0x482c('0x26')][_0x482c('0x27')])[_0x482c('0xa')](function(){fs[_0x482c('0x28')](_0x11fa65[_0x482c('0x22')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x11fa65;});}return _0x11fa65;})['then'](function(_0x2fd9d0){logger[_0x482c('0xb')](_0x482c('0x1b'),_0x1f4501);logger[_0x482c('0xe')]('CreateVoiceRecording',_0x1f4501,JSON[_0x482c('0xf')](_0x2fd9d0));_0x215826(_0x2fd9d0);})['catch'](function(_0x31428c){logger[_0x482c('0x10')](_0x482c('0x1b'),_0x31428c[_0x482c('0x12')],_0x1f4501);_0x2981d2(_0x3bd5bb[_0x482c('0x10')](0x1f4,_0x31428c[_0x482c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6d8e3d7..acbc5e9 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 _0x0597=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','index','/describe','isAuthenticated','get','/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2628b2,_0x5460f8){var _0x5e598d=function(_0xc52101){while(--_0xc52101){_0x2628b2['push'](_0x2628b2['shift']());}};_0x5e598d(++_0x5460f8);}(_0x0597,0x9c));var _0x7059=function(_0x5d5470,_0x18750f){_0x5d5470=_0x5d5470-0x0;var _0x3bc930=_0x0597[_0x5d5470];return _0x3bc930;};'use strict';var multer=require(_0x7059('0x0'));var util=require(_0x7059('0x1'));var path=require('path');var timeout=require(_0x7059('0x2'));var express=require(_0x7059('0x3'));var router=express[_0x7059('0x4')]();var fs_extra=require(_0x7059('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7059('0x6'));var config=require(_0x7059('0x7'));var controller=require(_0x7059('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7059('0x9')]);router['get'](_0x7059('0xa'),auth[_0x7059('0xb')](),controller['describe']);router[_0x7059('0xc')](_0x7059('0xd'),auth['isAuthenticated'](),controller[_0x7059('0xe')]);router['post']('/',auth[_0x7059('0xb')](),controller[_0x7059('0xf')]);router[_0x7059('0x10')](_0x7059('0xd'),auth[_0x7059('0xb')](),controller[_0x7059('0x11')]);router['delete'](_0x7059('0xd'),auth[_0x7059('0xb')](),controller[_0x7059('0x12')]);module[_0x7059('0x13')]=router; \ No newline at end of file +var _0x4ff7=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x34e055,_0x3ea9f7){var _0x5a11b2=function(_0x13aba4){while(--_0x13aba4){_0x34e055['push'](_0x34e055['shift']());}};_0x5a11b2(++_0x3ea9f7);}(_0x4ff7,0xe9));var _0x74ff=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0x4ff7[_0x2dce9f];return _0x1cd454;};'use strict';var multer=require(_0x74ff('0x0'));var util=require('util');var path=require(_0x74ff('0x1'));var timeout=require(_0x74ff('0x2'));var express=require(_0x74ff('0x3'));var router=express[_0x74ff('0x4')]();var fs_extra=require(_0x74ff('0x5'));var auth=require(_0x74ff('0x6'));var interaction=require(_0x74ff('0x7'));var config=require(_0x74ff('0x8'));var controller=require(_0x74ff('0x9'));router[_0x74ff('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x74ff('0xa')](_0x74ff('0xb'),auth['isAuthenticated'](),controller[_0x74ff('0xc')]);router['get'](_0x74ff('0xd'),auth[_0x74ff('0xe')](),controller['show']);router[_0x74ff('0xf')]('/',auth[_0x74ff('0xe')](),controller['create']);router[_0x74ff('0x10')](_0x74ff('0xd'),auth[_0x74ff('0xe')](),controller[_0x74ff('0x11')]);router['delete'](_0x74ff('0xd'),auth[_0x74ff('0xe')](),controller[_0x74ff('0x12')]);module[_0x74ff('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 83abfd2..da0d1de 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 _0xf48c=['Yes','exports','ENUM','blind','attended','STRING'];(function(_0xc30c9,_0x114e59){var _0x3d66c0=function(_0x26fb8c){while(--_0x26fb8c){_0xc30c9['push'](_0xc30c9['shift']());}};_0x3d66c0(++_0x114e59);}(_0xf48c,0xeb));var _0xcf48=function(_0x57390e,_0x5866dc){_0x57390e=_0x57390e-0x0;var _0x4d04be=_0xf48c[_0x57390e];return _0x4d04be;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xcf48('0x0')]={'type':{'type':Sequelize[_0xcf48('0x1')](_0xcf48('0x2'),_0xcf48('0x3'))},'result':{'type':Sequelize[_0xcf48('0x4')]},'transfererchannel':{'type':Sequelize[_0xcf48('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xcf48('0x4')]},'transferercalleridname':{'type':Sequelize[_0xcf48('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xcf48('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xcf48('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xcf48('0x4')]},'transferercontext':{'type':Sequelize[_0xcf48('0x4')]},'transfererexten':{'type':Sequelize[_0xcf48('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xcf48('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xcf48('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xcf48('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xcf48('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xcf48('0x4')]},'transfereeexten':{'type':Sequelize[_0xcf48('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xcf48('0x1')](_0xcf48('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xcf48('0x4')]}}; \ No newline at end of file +var _0x2962=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x2962,0x18c));var _0x2296=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2962[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x2296('0x0'));var moment=require(_0x2296('0x1'));module[_0x2296('0x2')]={'type':{'type':Sequelize[_0x2296('0x3')](_0x2296('0x4'),_0x2296('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2296('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x2296('0x6')]},'transferercalleridname':{'type':Sequelize[_0x2296('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x2296('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x2296('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2296('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x2296('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x2296('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2296('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x2296('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x2296('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x2296('0x7'),'No')},'context':{'type':Sequelize[_0x2296('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4a9a74b..7764100 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 _0x00d4=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00d4,0x8b));var _0x400d=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x00d4[_0x38537f];return _0x141e23;};'use strict';var emlformat=require(_0x400d('0x0'));var rimraf=require(_0x400d('0x1'));var zipdir=require(_0x400d('0x2'));var jsonpatch=require(_0x400d('0x3'));var rp=require(_0x400d('0x4'));var moment=require(_0x400d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x400d('0x6'));var util=require(_0x400d('0x7'));var path=require(_0x400d('0x8'));var sox=require(_0x400d('0x9'));var csv=require(_0x400d('0xa'));var ejs=require(_0x400d('0xb'));var fs=require('fs');var fs_extra=require(_0x400d('0xc'));var _=require(_0x400d('0xd'));var squel=require(_0x400d('0xe'));var crypto=require(_0x400d('0xf'));var jsforce=require(_0x400d('0x10'));var deskjs=require(_0x400d('0x11'));var toCsv=require(_0x400d('0xa'));var querystring=require(_0x400d('0x12'));var Papa=require(_0x400d('0x13'));var Redis=require('ioredis');var authService=require(_0x400d('0x14'));var qs=require(_0x400d('0x15'));var as=require(_0x400d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x400d('0x17'))(_0x400d('0x18'));var utils=require(_0x400d('0x19'));var config=require(_0x400d('0x1a'));var licenseUtil=require(_0x400d('0x1b'));var db=require(_0x400d('0x1c'))['db'];function respondWithStatusCode(_0x54f320,_0x23dc59){_0x23dc59=_0x23dc59||0xcc;return function(_0x3294f7){if(_0x3294f7){return _0x54f320[_0x400d('0x1d')](_0x23dc59);}return _0x54f320['status'](_0x23dc59)[_0x400d('0x1e')]();};}function respondWithResult(_0x1f13c1,_0x31beb0){_0x31beb0=_0x31beb0||0xc8;return function(_0x116094){if(_0x116094){return _0x1f13c1['status'](_0x31beb0)[_0x400d('0x1f')](_0x116094);}};}function respondWithFilteredResult(_0x453a23,_0x4769fa){return function(_0x499d4f){if(_0x499d4f){var _0x461f03=typeof _0x4769fa['offset']===_0x400d('0x20')&&typeof _0x4769fa[_0x400d('0x21')]===_0x400d('0x20');var _0x337371=_0x499d4f[_0x400d('0x22')];var _0xf30b52=_0x461f03?0x0:_0x4769fa[_0x400d('0x23')];var _0x5026ba=_0x461f03?_0x499d4f['count']:_0x4769fa['offset']+_0x4769fa[_0x400d('0x21')];var _0x1cd4f6;if(_0x5026ba>=_0x337371){_0x5026ba=_0x337371;_0x1cd4f6=0xc8;}else{_0x1cd4f6=0xce;}_0x453a23[_0x400d('0x24')](_0x1cd4f6);return _0x453a23[_0x400d('0x25')](_0x400d('0x26'),_0xf30b52+'-'+_0x5026ba+'/'+_0x337371)[_0x400d('0x1f')](_0x499d4f);}return null;};}function patchUpdates(_0x229b9e){return function(_0xe54ab0){try{jsonpatch[_0x400d('0x27')](_0xe54ab0,_0x229b9e,!![]);}catch(_0x5a99db){return BPromise['reject'](_0x5a99db);}return _0xe54ab0[_0x400d('0x28')]();};}function saveUpdates(_0x2ac6d3,_0x505006){return function(_0x3639e3){if(_0x3639e3){return _0x3639e3[_0x400d('0x29')](_0x2ac6d3)[_0x400d('0x2a')](function(_0x3ce20f){return _0x3ce20f;});}return null;};}function removeEntity(_0x52924c,_0x566877){return function(_0x113ff8){if(_0x113ff8){return _0x113ff8[_0x400d('0x2b')]()['then'](function(){_0x52924c['status'](0xcc)[_0x400d('0x1e')]();});}};}function handleEntityNotFound(_0x328656,_0x4019d1){return function(_0x4f92bf){if(!_0x4f92bf){_0x328656[_0x400d('0x1d')](0x194);}return _0x4f92bf;};}function handleError(_0x419ec9,_0x3e9ea9){_0x3e9ea9=_0x3e9ea9||0x1f4;return function(_0x38d508){logger['error'](_0x38d508[_0x400d('0x2c')]);if(_0x38d508[_0x400d('0x2d')]){delete _0x38d508[_0x400d('0x2d')];}_0x419ec9[_0x400d('0x24')](_0x3e9ea9)[_0x400d('0x2e')](_0x38d508);};}exports['index']=function(_0x57f995,_0x9601ab){var _0x277ce8={},_0x3b2ef7={},_0x2a277c={'count':0x0,'rows':[]};var _0x4e6b39=_[_0x400d('0x2f')](db[_0x400d('0x30')][_0x400d('0x31')],function(_0x1552c7){return{'name':_0x1552c7[_0x400d('0x32')],'type':_0x1552c7['type'][_0x400d('0x33')]};});_0x3b2ef7[_0x400d('0x34')]=_[_0x400d('0x2f')](_0x4e6b39,_0x400d('0x2d'));_0x3b2ef7[_0x400d('0x35')]=_['keys'](_0x57f995[_0x400d('0x35')]);_0x3b2ef7[_0x400d('0x36')]=_[_0x400d('0x37')](_0x3b2ef7[_0x400d('0x34')],_0x3b2ef7[_0x400d('0x35')]);_0x277ce8[_0x400d('0x38')]=_[_0x400d('0x37')](_0x3b2ef7[_0x400d('0x34')],qs[_0x400d('0x39')](_0x57f995[_0x400d('0x35')][_0x400d('0x39')]));_0x277ce8['attributes']=_0x277ce8[_0x400d('0x38')][_0x400d('0x3a')]?_0x277ce8['attributes']:_0x3b2ef7[_0x400d('0x34')];if(!_0x57f995[_0x400d('0x35')][_0x400d('0x3b')]('nolimit')){_0x277ce8[_0x400d('0x21')]=qs[_0x400d('0x21')](_0x57f995[_0x400d('0x35')][_0x400d('0x21')]);_0x277ce8['offset']=qs['offset'](_0x57f995[_0x400d('0x35')]['offset']);}_0x277ce8[_0x400d('0x3c')]=qs['sort'](_0x57f995['query'][_0x400d('0x3d')]);_0x277ce8[_0x400d('0x3e')]=qs[_0x400d('0x36')](_[_0x400d('0x3f')](_0x57f995[_0x400d('0x35')],_0x3b2ef7[_0x400d('0x36')]),_0x4e6b39);if(_0x57f995['query'][_0x400d('0x40')]){_0x277ce8[_0x400d('0x3e')]=_[_0x400d('0x41')](_0x277ce8[_0x400d('0x3e')],{'$or':_[_0x400d('0x2f')](_0x4e6b39,function(_0x1b8add){if(_0x1b8add[_0x400d('0x42')]!==_0x400d('0x43')){var _0x2ed5f7={};_0x2ed5f7[_0x1b8add[_0x400d('0x2d')]]={'$like':'%'+_0x57f995[_0x400d('0x35')][_0x400d('0x40')]+'%'};return _0x2ed5f7;}})});}_0x277ce8=_[_0x400d('0x41')]({},_0x277ce8,_0x57f995['options']);var _0x2b49e1={'where':_0x277ce8[_0x400d('0x3e')]};return db[_0x400d('0x30')][_0x400d('0x22')](_0x2b49e1)[_0x400d('0x2a')](function(_0x318890){_0x2a277c['count']=_0x318890;if(_0x57f995['query']['includeAll']){_0x277ce8[_0x400d('0x44')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x400d('0x45')](_0x277ce8);})[_0x400d('0x2a')](function(_0x3462a4){_0x2a277c['rows']=_0x3462a4;return _0x2a277c;})[_0x400d('0x2a')](respondWithFilteredResult(_0x9601ab,_0x277ce8))[_0x400d('0x46')](handleError(_0x9601ab,null));};exports['show']=function(_0x3e1cbf,_0x19c3b8){var _0x332084={'raw':!![],'where':{'id':_0x3e1cbf[_0x400d('0x47')]['id']}},_0x1c6a55={};_0x1c6a55[_0x400d('0x34')]=_[_0x400d('0x48')](db[_0x400d('0x30')][_0x400d('0x31')]);_0x1c6a55[_0x400d('0x35')]=_[_0x400d('0x48')](_0x3e1cbf[_0x400d('0x35')]);_0x1c6a55['filters']=_['intersection'](_0x1c6a55[_0x400d('0x34')],_0x1c6a55['query']);_0x332084[_0x400d('0x38')]=_[_0x400d('0x37')](_0x1c6a55['model'],qs[_0x400d('0x39')](_0x3e1cbf[_0x400d('0x35')][_0x400d('0x39')]));_0x332084['attributes']=_0x332084[_0x400d('0x38')]['length']?_0x332084[_0x400d('0x38')]:_0x1c6a55['model'];if(_0x3e1cbf[_0x400d('0x35')][_0x400d('0x49')]){_0x332084[_0x400d('0x44')]=[{'all':!![]}];}_0x332084=_[_0x400d('0x41')]({},_0x332084,_0x3e1cbf[_0x400d('0x4a')]);return db[_0x400d('0x30')][_0x400d('0x4b')](_0x332084)[_0x400d('0x2a')](handleEntityNotFound(_0x19c3b8,null))['then'](respondWithResult(_0x19c3b8,null))['catch'](handleError(_0x19c3b8,null));};exports[_0x400d('0x4c')]=function(_0x9a7e84,_0x39f010){return db[_0x400d('0x30')][_0x400d('0x4c')](_0x9a7e84['body'],{})[_0x400d('0x2a')](respondWithResult(_0x39f010,0xc9))[_0x400d('0x46')](handleError(_0x39f010,null));};exports[_0x400d('0x29')]=function(_0x1e9a13,_0x1db6dc){if(_0x1e9a13[_0x400d('0x4d')]['id']){delete _0x1e9a13[_0x400d('0x4d')]['id'];}return db[_0x400d('0x30')][_0x400d('0x4b')]({'where':{'id':_0x1e9a13['params']['id']}})[_0x400d('0x2a')](handleEntityNotFound(_0x1db6dc,null))[_0x400d('0x2a')](saveUpdates(_0x1e9a13[_0x400d('0x4d')],null))[_0x400d('0x2a')](respondWithResult(_0x1db6dc,null))[_0x400d('0x46')](handleError(_0x1db6dc,null));};exports[_0x400d('0x2b')]=function(_0x47d3ae,_0x13561d){return db[_0x400d('0x30')]['find']({'where':{'id':_0x47d3ae[_0x400d('0x47')]['id']}})[_0x400d('0x2a')](handleEntityNotFound(_0x13561d,null))[_0x400d('0x2a')](removeEntity(_0x13561d,null))[_0x400d('0x46')](handleError(_0x13561d,null));};exports['describe']=function(_0x4599b7,_0x5e40b8){return db['VoiceTransferReport'][_0x400d('0x4e')]()[_0x400d('0x2a')](respondWithResult(_0x5e40b8,null))['catch'](handleError(_0x5e40b8,null));}; \ No newline at end of file +var _0x998c=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceTransferReport','include','rows','includeAll','find','catch','create','params','body','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4eb2f5,_0x462d49){var _0x1e5a98=function(_0x26b930){while(--_0x26b930){_0x4eb2f5['push'](_0x4eb2f5['shift']());}};_0x1e5a98(++_0x462d49);}(_0x998c,0x1e7));var _0xc998=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x998c[_0xf168d3];return _0x17fb54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc998('0x0'));var zipdir=require(_0xc998('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc998('0x2'));var Mustache=require(_0xc998('0x3'));var util=require(_0xc998('0x4'));var path=require(_0xc998('0x5'));var sox=require(_0xc998('0x6'));var csv=require(_0xc998('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc998('0x8'));var _=require(_0xc998('0x9'));var squel=require(_0xc998('0xa'));var crypto=require(_0xc998('0xb'));var jsforce=require(_0xc998('0xc'));var deskjs=require(_0xc998('0xd'));var toCsv=require(_0xc998('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc998('0xe'));var authService=require(_0xc998('0xf'));var qs=require(_0xc998('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc998('0x11'));var logger=require(_0xc998('0x12'))('api');var utils=require(_0xc998('0x13'));var config=require(_0xc998('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44bd70,_0xb063c0){_0xb063c0=_0xb063c0||0xcc;return function(_0x556ae9){if(_0x556ae9){return _0x44bd70[_0xc998('0x15')](_0xb063c0);}return _0x44bd70[_0xc998('0x16')](_0xb063c0)[_0xc998('0x17')]();};}function respondWithResult(_0x37f795,_0x38690e){_0x38690e=_0x38690e||0xc8;return function(_0x5af3ef){if(_0x5af3ef){return _0x37f795['status'](_0x38690e)[_0xc998('0x18')](_0x5af3ef);}};}function respondWithFilteredResult(_0x233a5b,_0x1cb5d7){return function(_0x5c4ed5){if(_0x5c4ed5){var _0x245028=typeof _0x1cb5d7[_0xc998('0x19')]===_0xc998('0x1a')&&typeof _0x1cb5d7[_0xc998('0x1b')]===_0xc998('0x1a');var _0x4c6c08=_0x5c4ed5[_0xc998('0x1c')];var _0x46c5f4=_0x245028?0x0:_0x1cb5d7[_0xc998('0x19')];var _0x275e47=_0x245028?_0x5c4ed5['count']:_0x1cb5d7[_0xc998('0x19')]+_0x1cb5d7['limit'];var _0x60f23b;if(_0x275e47>=_0x4c6c08){_0x275e47=_0x4c6c08;_0x60f23b=0xc8;}else{_0x60f23b=0xce;}_0x233a5b['status'](_0x60f23b);return _0x233a5b[_0xc998('0x1d')](_0xc998('0x1e'),_0x46c5f4+'-'+_0x275e47+'/'+_0x4c6c08)['json'](_0x5c4ed5);}return null;};}function patchUpdates(_0x591bce){return function(_0x2c4ad5){try{jsonpatch[_0xc998('0x1f')](_0x2c4ad5,_0x591bce,!![]);}catch(_0x77d11){return BPromise['reject'](_0x77d11);}return _0x2c4ad5[_0xc998('0x20')]();};}function saveUpdates(_0xd82dcb,_0x54769c){return function(_0x7ff0fc){if(_0x7ff0fc){return _0x7ff0fc[_0xc998('0x21')](_0xd82dcb)[_0xc998('0x22')](function(_0x58eb97){return _0x58eb97;});}return null;};}function removeEntity(_0x3aacbd,_0x538651){return function(_0x9b45ff){if(_0x9b45ff){return _0x9b45ff[_0xc998('0x23')]()[_0xc998('0x22')](function(){_0x3aacbd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d806c,_0x2a7e61){return function(_0x298000){if(!_0x298000){_0x3d806c['sendStatus'](0x194);}return _0x298000;};}function handleError(_0x237583,_0x27e678){_0x27e678=_0x27e678||0x1f4;return function(_0x5298e2){logger[_0xc998('0x24')](_0x5298e2[_0xc998('0x25')]);if(_0x5298e2['name']){delete _0x5298e2[_0xc998('0x26')];}_0x237583['status'](_0x27e678)['send'](_0x5298e2);};}exports[_0xc998('0x27')]=function(_0x138afc,_0x130575){var _0xf8d64a={},_0x517359={},_0x256ebc={'count':0x0,'rows':[]};var _0x453a0a=_[_0xc998('0x28')](db['VoiceTransferReport'][_0xc998('0x29')],function(_0xef4a03){return{'name':_0xef4a03[_0xc998('0x2a')],'type':_0xef4a03[_0xc998('0x2b')][_0xc998('0x2c')]};});_0x517359['model']=_[_0xc998('0x28')](_0x453a0a,_0xc998('0x26'));_0x517359[_0xc998('0x2d')]=_[_0xc998('0x2e')](_0x138afc[_0xc998('0x2d')]);_0x517359[_0xc998('0x2f')]=_[_0xc998('0x30')](_0x517359['model'],_0x517359['query']);_0xf8d64a[_0xc998('0x31')]=_[_0xc998('0x30')](_0x517359['model'],qs[_0xc998('0x32')](_0x138afc[_0xc998('0x2d')]['fields']));_0xf8d64a['attributes']=_0xf8d64a[_0xc998('0x31')][_0xc998('0x33')]?_0xf8d64a[_0xc998('0x31')]:_0x517359[_0xc998('0x34')];if(!_0x138afc['query'][_0xc998('0x35')](_0xc998('0x36'))){_0xf8d64a['limit']=qs['limit'](_0x138afc[_0xc998('0x2d')][_0xc998('0x1b')]);_0xf8d64a[_0xc998('0x19')]=qs[_0xc998('0x19')](_0x138afc[_0xc998('0x2d')][_0xc998('0x19')]);}_0xf8d64a[_0xc998('0x37')]=qs[_0xc998('0x38')](_0x138afc[_0xc998('0x2d')][_0xc998('0x38')]);_0xf8d64a[_0xc998('0x39')]=qs[_0xc998('0x2f')](_['pick'](_0x138afc[_0xc998('0x2d')],_0x517359[_0xc998('0x2f')]),_0x453a0a);if(_0x138afc[_0xc998('0x2d')][_0xc998('0x3a')]){_0xf8d64a['where']=_[_0xc998('0x3b')](_0xf8d64a[_0xc998('0x39')],{'$or':_[_0xc998('0x28')](_0x453a0a,function(_0xe04d4f){if(_0xe04d4f['type']!==_0xc998('0x3c')){var _0x1a47f5={};_0x1a47f5[_0xe04d4f[_0xc998('0x26')]]={'$like':'%'+_0x138afc['query']['filter']+'%'};return _0x1a47f5;}})});}_0xf8d64a=_[_0xc998('0x3b')]({},_0xf8d64a,_0x138afc[_0xc998('0x3d')]);var _0x167efa={'where':_0xf8d64a[_0xc998('0x39')]};return db[_0xc998('0x3e')][_0xc998('0x1c')](_0x167efa)[_0xc998('0x22')](function(_0x37db7f){_0x256ebc[_0xc998('0x1c')]=_0x37db7f;if(_0x138afc[_0xc998('0x2d')]['includeAll']){_0xf8d64a[_0xc998('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0xf8d64a);})[_0xc998('0x22')](function(_0x24b86e){_0x256ebc[_0xc998('0x40')]=_0x24b86e;return _0x256ebc;})[_0xc998('0x22')](respondWithFilteredResult(_0x130575,_0xf8d64a))['catch'](handleError(_0x130575,null));};exports['show']=function(_0x543cd0,_0x1c90f7){var _0x48087a={'raw':!![],'where':{'id':_0x543cd0['params']['id']}},_0x5cb047={};_0x5cb047[_0xc998('0x34')]=_[_0xc998('0x2e')](db['VoiceTransferReport'][_0xc998('0x29')]);_0x5cb047['query']=_['keys'](_0x543cd0['query']);_0x5cb047[_0xc998('0x2f')]=_[_0xc998('0x30')](_0x5cb047[_0xc998('0x34')],_0x5cb047[_0xc998('0x2d')]);_0x48087a[_0xc998('0x31')]=_[_0xc998('0x30')](_0x5cb047[_0xc998('0x34')],qs[_0xc998('0x32')](_0x543cd0[_0xc998('0x2d')][_0xc998('0x32')]));_0x48087a[_0xc998('0x31')]=_0x48087a[_0xc998('0x31')][_0xc998('0x33')]?_0x48087a['attributes']:_0x5cb047[_0xc998('0x34')];if(_0x543cd0['query'][_0xc998('0x41')]){_0x48087a['include']=[{'all':!![]}];}_0x48087a=_[_0xc998('0x3b')]({},_0x48087a,_0x543cd0['options']);return db[_0xc998('0x3e')][_0xc998('0x42')](_0x48087a)[_0xc998('0x22')](handleEntityNotFound(_0x1c90f7,null))[_0xc998('0x22')](respondWithResult(_0x1c90f7,null))[_0xc998('0x43')](handleError(_0x1c90f7,null));};exports['create']=function(_0x3e7dda,_0x349aed){return db['VoiceTransferReport'][_0xc998('0x44')](_0x3e7dda['body'],{})[_0xc998('0x22')](respondWithResult(_0x349aed,0xc9))['catch'](handleError(_0x349aed,null));};exports[_0xc998('0x21')]=function(_0xd1b322,_0x3fa3e1){if(_0xd1b322['body']['id']){delete _0xd1b322['body']['id'];}return db[_0xc998('0x3e')][_0xc998('0x42')]({'where':{'id':_0xd1b322[_0xc998('0x45')]['id']}})[_0xc998('0x22')](handleEntityNotFound(_0x3fa3e1,null))[_0xc998('0x22')](saveUpdates(_0xd1b322[_0xc998('0x46')],null))[_0xc998('0x22')](respondWithResult(_0x3fa3e1,null))[_0xc998('0x43')](handleError(_0x3fa3e1,null));};exports[_0xc998('0x23')]=function(_0xd456c0,_0x140586){return db['VoiceTransferReport'][_0xc998('0x42')]({'where':{'id':_0xd456c0[_0xc998('0x45')]['id']}})[_0xc998('0x22')](handleEntityNotFound(_0x140586,null))[_0xc998('0x22')](removeEntity(_0x140586,null))['catch'](handleError(_0x140586,null));};exports[_0xc998('0x47')]=function(_0x242d7e,_0x1e111a){return db['VoiceTransferReport'][_0xc998('0x47')]()['then'](respondWithResult(_0x1e111a,null))[_0xc998('0x43')](handleError(_0x1e111a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6835bf3..aec1c0a 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 _0x14f5=['VoiceTransferReport','report_call_transfer','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x4dbc5d,_0x2d0a51){var _0x45b461=function(_0x3e73ab){while(--_0x3e73ab){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x45b461(++_0x2d0a51);}(_0x14f5,0x122));var _0x514f=function(_0x404dc4,_0x13cc13){_0x404dc4=_0x404dc4-0x0;var _0x574739=_0x14f5[_0x404dc4];return _0x574739;};'use strict';var _=require(_0x514f('0x0'));var util=require(_0x514f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x514f('0x2'));var BPromise=require(_0x514f('0x3'));var rp=require(_0x514f('0x4'));var fs=require('fs');var path=require(_0x514f('0x5'));var rimraf=require(_0x514f('0x6'));var config=require(_0x514f('0x7'));var attributes=require(_0x514f('0x8'));module[_0x514f('0x9')]=function(_0xa04b5e,_0x18cef9){return _0xa04b5e['define'](_0x514f('0xa'),attributes,{'tableName':_0x514f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b8=['rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd2b8,0xad));var _0x8d2b=function(_0x5a4b41,_0x184977){_0x5a4b41=_0x5a4b41-0x0;var _0xcfaf1b=_0xd2b8[_0x5a4b41];return _0xcfaf1b;};'use strict';var _=require(_0x8d2b('0x0'));var util=require(_0x8d2b('0x1'));var logger=require(_0x8d2b('0x2'))(_0x8d2b('0x3'));var moment=require(_0x8d2b('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d2b('0x5'));var fs=require('fs');var path=require(_0x8d2b('0x6'));var rimraf=require(_0x8d2b('0x7'));var config=require('../../config/environment');var attributes=require(_0x8d2b('0x8'));module[_0x8d2b('0x9')]=function(_0x3381ce,_0x2d2a6f){return _0x3381ce[_0x8d2b('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x8d2b('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 1fc1ef0..6b8a562 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 _0xaba5=['then','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaba5,0x106));var _0x5aba=function(_0x382f22,_0x865aa8){_0x382f22=_0x382f22-0x0;var _0x59f66b=_0xaba5[_0x382f22];return _0x59f66b;};'use strict';var _=require(_0x5aba('0x0'));var util=require(_0x5aba('0x1'));var moment=require('moment');var BPromise=require(_0x5aba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5aba('0x3'))['db'];var utils=require(_0x5aba('0x4'));var logger=require(_0x5aba('0x5'))(_0x5aba('0x6'));var config=require('../../config/environment');var jayson=require(_0x5aba('0x7'));var client=jayson['client'][_0x5aba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12f761,_0x20241c,_0x3290ce){return new BPromise(function(_0x51e5b9,_0x5b9d39){return client[_0x5aba('0x9')](_0x12f761,_0x3290ce)['then'](function(_0x364ccf){logger[_0x5aba('0xa')](_0x5aba('0xb'),_0x20241c,_0x5aba('0xc'));logger[_0x5aba('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x20241c,_0x5aba('0xc'),JSON['stringify'](_0x364ccf));if(_0x364ccf[_0x5aba('0xe')]){if(_0x364ccf['error'][_0x5aba('0xf')]===0x1f4){logger[_0x5aba('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x20241c,_0x364ccf[_0x5aba('0xe')]['message']);return _0x5b9d39(_0x364ccf['error']['message']);}logger[_0x5aba('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x20241c,_0x364ccf[_0x5aba('0xe')][_0x5aba('0x10')]);return _0x51e5b9(_0x364ccf[_0x5aba('0xe')][_0x5aba('0x10')]);}else{logger[_0x5aba('0xa')](_0x5aba('0xb'),_0x20241c,_0x5aba('0xc'));_0x51e5b9(_0x364ccf[_0x5aba('0x11')][_0x5aba('0x10')]);}})['catch'](function(_0xf1e481){logger['error'](_0x5aba('0xb'),_0x20241c,_0xf1e481);_0x5b9d39(_0xf1e481);});});}exports[_0x5aba('0x12')]=function(_0x8d00d2){var _0xd458e5=this;return new Promise(function(_0xfb8087,_0xd132b7){return db[_0x5aba('0x13')][_0x5aba('0x14')](_0x8d00d2[_0x5aba('0x15')],{'raw':_0x8d00d2[_0x5aba('0x16')]?_0x8d00d2['options'][_0x5aba('0x17')]===undefined?!![]:![]:!![]})[_0x5aba('0x18')](function(_0x2a7253){logger[_0x5aba('0xa')](_0x5aba('0x12'),_0x8d00d2);logger['debug'](_0x5aba('0x12'),_0x8d00d2,JSON[_0x5aba('0x19')](_0x2a7253));_0xfb8087(_0x2a7253);})['catch'](function(_0x4fef5f){logger[_0x5aba('0xe')](_0x5aba('0x12'),_0x4fef5f[_0x5aba('0x10')],_0x8d00d2);_0xd132b7(_0xd458e5['error'](0x1f4,_0x4fef5f[_0x5aba('0x10')]));});});}; \ No newline at end of file +var _0x871a=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x28af2f,_0x2ed3fe){var _0x1ace46=function(_0x35ee05){while(--_0x35ee05){_0x28af2f['push'](_0x28af2f['shift']());}};_0x1ace46(++_0x2ed3fe);}(_0x871a,0xda));var _0xa871=function(_0x6a27db,_0x2731a7){_0x6a27db=_0x6a27db-0x0;var _0xd814f5=_0x871a[_0x6a27db];return _0xd814f5;};'use strict';var _=require(_0xa871('0x0'));var util=require(_0xa871('0x1'));var moment=require('moment');var BPromise=require(_0xa871('0x2'));var rs=require(_0xa871('0x3'));var fs=require('fs');var Redis=require(_0xa871('0x4'));var db=require(_0xa871('0x5'))['db'];var utils=require(_0xa871('0x6'));var logger=require(_0xa871('0x7'))(_0xa871('0x8'));var config=require(_0xa871('0x9'));var jayson=require(_0xa871('0xa'));var client=jayson['client'][_0xa871('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x453ed0,_0x3ffee9,_0x42feda){return new BPromise(function(_0x38cb6a,_0x30738e){return client[_0xa871('0xc')](_0x453ed0,_0x42feda)[_0xa871('0xd')](function(_0x4d4907){logger['info'](_0xa871('0xe'),_0x3ffee9,_0xa871('0xf'));logger[_0xa871('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3ffee9,_0xa871('0xf'),JSON[_0xa871('0x11')](_0x4d4907));if(_0x4d4907[_0xa871('0x12')]){if(_0x4d4907[_0xa871('0x12')][_0xa871('0x13')]===0x1f4){logger[_0xa871('0x12')](_0xa871('0xe'),_0x3ffee9,_0x4d4907[_0xa871('0x12')][_0xa871('0x14')]);return _0x30738e(_0x4d4907[_0xa871('0x12')]['message']);}logger[_0xa871('0x12')](_0xa871('0xe'),_0x3ffee9,_0x4d4907[_0xa871('0x12')][_0xa871('0x14')]);return _0x38cb6a(_0x4d4907['error']['message']);}else{logger[_0xa871('0x15')](_0xa871('0xe'),_0x3ffee9,_0xa871('0xf'));_0x38cb6a(_0x4d4907[_0xa871('0x16')]['message']);}})[_0xa871('0x17')](function(_0x27c6c1){logger[_0xa871('0x12')](_0xa871('0xe'),_0x3ffee9,_0x27c6c1);_0x30738e(_0x27c6c1);});});}exports[_0xa871('0x18')]=function(_0x329b84){var _0xae940d=this;return new Promise(function(_0x5ec347,_0x49efe8){return db[_0xa871('0x19')]['create'](_0x329b84[_0xa871('0x1a')],{'raw':_0x329b84[_0xa871('0x1b')]?_0x329b84[_0xa871('0x1b')][_0xa871('0x1c')]===undefined?!![]:![]:!![]})[_0xa871('0xd')](function(_0x1db4bc){logger[_0xa871('0x15')]('CreateVoiceTransferReport',_0x329b84);logger[_0xa871('0x10')](_0xa871('0x18'),_0x329b84,JSON[_0xa871('0x11')](_0x1db4bc));_0x5ec347(_0x1db4bc);})[_0xa871('0x17')](function(_0x5169d6){logger[_0xa871('0x12')]('CreateVoiceTransferReport',_0x5169d6[_0xa871('0x14')],_0x329b84);_0x49efe8(_0xae940d[_0xa871('0x12')](0x1f4,_0x5169d6[_0xa871('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index efb66bb..68f5ca4 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x232e55,_0x413fc2){var _0x544c75=function(_0x5cb041){while(--_0x5cb041){_0x232e55['push'](_0x232e55['shift']());}};_0x544c75(++_0x413fc2);}(_0x9f62,0x154));var _0x29f6=function(_0x3314d0,_0x35fcf4){_0x3314d0=_0x3314d0-0x0;var _0x420caf=_0x9f62[_0x3314d0];return _0x420caf;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x104767,_0x3f27c8){var _0x80d678=function(_0xdf1695){while(--_0xdf1695){_0x104767['push'](_0x104767['shift']());}};_0x80d678(++_0x3f27c8);}(_0xedd9,0xfc));var _0x9edd=function(_0x2dc786,_0x49378d){_0x2dc786=_0x2dc786-0x0;var _0x5f0e7e=_0xedd9[_0x2dc786];return _0x5f0e7e;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1b859e1..6915cff 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 _0x984b=['transfer\x20executed!','../../config/environment','util','bluebird','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x984b,0xee));var _0xb984=function(_0x3bd761,_0x4271ee){_0x3bd761=_0x3bd761-0x0;var _0x59c713=_0x984b[_0x3bd761];return _0x59c713;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xb984('0x0'));var util=require(_0xb984('0x1'));var BPromise=require(_0xb984('0x2'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xb984('0x3')]({'port':0x232a});var logger=require(_0xb984('0x4'))('webbarapi');var Redis=require('ioredis');config[_0xb984('0x5')]=_[_0xb984('0x6')](config['redis'],{'host':_0xb984('0x7'),'port':0x18eb});var io=require(_0xb984('0x8'))(new Redis(config['redis']));var Schema=require(_0xb984('0x9'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'callNumber':{'type':_0xb984('0xb'),'required':[!![],_0xb984('0xc')]},'callerId':{'type':_0xb984('0xb')},'callbackUrl':{'type':_0xb984('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb984('0xb'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb984('0xb'),'required':[!![],_0xb984('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]},'sessionId':{'type':_0xb984('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb984('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb984('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x6fae41,_0x5cd1aa,_0x3b8241){logger[_0xb984('0xf')](_0x6fae41,_0x5cd1aa,JSON[_0xb984('0x10')](_0x3b8241));io['to'](_0x6fae41)[_0xb984('0x11')](_0x5cd1aa,_0x3b8241);}function handleError(_0x59dcb7){return function(_0x396c36){console[_0xb984('0x12')](_0xb984('0x13'),_0x396c36,_0x396c36 instanceof RangeError);logger[_0xb984('0x14')](_0x396c36[_0xb984('0x15')]);if(_0x396c36 instanceof RangeError){if(_0x396c36[_0xb984('0x16')]){delete _0x396c36['name'];}_0x59dcb7[_0xb984('0x17')](0x194)[_0xb984('0x18')](_0x396c36);}else{if(_0x396c36[_0xb984('0x16')]){delete _0x396c36[_0xb984('0x16')];}_0x59dcb7[_0xb984('0x17')](0x1f4)[_0xb984('0x18')](_0x396c36);}};}function checkError(){return function(_0x54dd81){if(!_0x54dd81){throw new RangeError(_0xb984('0x19'));}return _0x54dd81;};}function respondWithRpcPromise(_0xc16561,_0x551ad4){return new BPromise(function(_0x44b570,_0x97af5c){var _0x14734a=amiClient;return _0x14734a[_0xb984('0x1a')](_0xc16561,_0x551ad4)[_0xb984('0x1b')](function(_0x286033){if(_0x286033[_0xb984('0x14')]){if(_0x286033['error'][_0xb984('0x1c')]===0x1f4){return _0x97af5c(_0x286033[_0xb984('0x14')][_0xb984('0x1d')]);}return _0x44b570(_0x286033['error'][_0xb984('0x1d')]);}else{_0x44b570(_0x286033[_0xb984('0x1e')]);}})[_0xb984('0x1f')](function(_0x2d0450){_0x97af5c(_0x2d0450);});});}function getAgent(_0x1f7b62){return db[_0xb984('0x20')][_0xb984('0x21')]({'where':{'id':_0x1f7b62,'role':_0xb984('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x249d47,_0x469af6){return new BPromise(function(_0x3e254b,_0x2bd0f2){var _0x4fb896=respondWithRpcPromise(_0xb984('0x23'));var _0x67e4d3=getAgent(_0x249d47);Promise[_0xb984('0x24')]([_0x4fb896,_0x67e4d3])['then'](function(_0x363e33){var _0x311e22=_0x363e33[0x0];var _0x2012ca=_0x363e33[0x1];var _0x3d2757=_['filter'](_0x311e22['rows'],function(_0x4dcf73){return _0x4dcf73[_0xb984('0x25')]==_0x2012ca['id']&&_0x4dcf73[_0xb984('0x26')]==_0x469af6;});if(_0x3d2757['length']==0x1){_0x3e254b(_0x2012ca);}else{_0x2bd0f2(new RangeError(_0xb984('0x27')+_0x469af6+_0xb984('0x28')));}});});}exports[_0xb984('0x29')]=function(_0x2c5a99,_0x518bef){logger['info'](_0xb984('0x2a'),_0x2c5a99[_0xb984('0x2b')]);var _0x2c0562=originateValidation[_0xb984('0x9')](_0x2c5a99['body']);if(_0x2c0562[_0xb984('0x2c')]>0x0){return _0x518bef[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x2c0562);}var _0x3c4687=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x2e')];var _0x5f4426=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x2f')];var _0x523784=_0x2c5a99[_0xb984('0x2b')][_0xb984('0x30')];var _0x30891c=_0x2c5a99['body'][_0xb984('0x31')];return getAgent(_0x3c4687)[_0xb984('0x1b')](function(_0x4edaf1){logger['info'](_0xb984('0x32'),_0x4edaf1['name']);emit(util[_0xb984('0x33')](_0xb984('0x34'),_0x4edaf1['name']),_0xb984('0x35'),{'callNumber':_0x5f4426,'callerId':_0x523784,'callbackUrl':_0x30891c});return _0x518bef['status'](0xc8)[_0xb984('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0xb984('0x1f')](handleError(_0x518bef));};exports['hangup']=function(_0x52f872,_0xf6d925){logger[_0xb984('0xf')]('hangup\x20fired:',_0x52f872[_0xb984('0x2b')]);var _0x1fd248=hangupValidation['validate'](_0x52f872[_0xb984('0x2b')]);if(_0x1fd248[_0xb984('0x2c')]>0x0){return _0xf6d925[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x1fd248);}var _0x4837d5=_0x52f872[_0xb984('0x2b')][_0xb984('0x2e')];var _0x383c87=_0x52f872[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x4837d5)[_0xb984('0x1b')](function(_0xc257ee){logger[_0xb984('0xf')](_0xb984('0x32'),_0xc257ee[_0xb984('0x16')]);emit(util['format'](_0xb984('0x34'),_0xc257ee[_0xb984('0x16')]),_0xb984('0x36'),{'sessionId':_0x383c87});return _0xf6d925[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x37')});})[_0xb984('0x1f')](handleError(_0xf6d925));};exports[_0xb984('0x38')]=function(_0x52181e,_0x5d4be9){logger[_0xb984('0xf')]('answer\x20fired:',_0x52181e[_0xb984('0x2b')]);var _0x2326c6=answerValidation[_0xb984('0x9')](_0x52181e[_0xb984('0x2b')]);if(_0x2326c6['length']>0x0){return _0x5d4be9[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x2326c6);}var _0x5d5e85=_0x52181e[_0xb984('0x2b')][_0xb984('0x2e')];var _0x38a025=_0x52181e[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x5d5e85)[_0xb984('0x1b')](function(_0x2f2f02){logger['info'](_0xb984('0x32'),_0x2f2f02[_0xb984('0x16')]);emit(util['format']('user:%s',_0x2f2f02[_0xb984('0x16')]),_0xb984('0x39'),{'sessionId':_0x38a025});return _0x5d4be9[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x3a')});})['catch'](handleError(_0x5d4be9));};exports[_0xb984('0x3b')]=function(_0x40666f,_0x424f65){logger[_0xb984('0xf')](_0xb984('0x3c'),_0x40666f[_0xb984('0x2b')]);var _0x2097e6=holdValidation[_0xb984('0x9')](_0x40666f[_0xb984('0x2b')]);if(_0x2097e6[_0xb984('0x2c')]>0x0){return _0x424f65['status'](0x190)[_0xb984('0x2d')](_0x2097e6);}var _0x71880c=_0x40666f['body'][_0xb984('0x2e')];var _0x436597=_0x40666f[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x71880c)[_0xb984('0x1b')](function(_0x49dde7){logger[_0xb984('0xf')](_0xb984('0x32'),_0x49dde7[_0xb984('0x16')]);emit(util[_0xb984('0x33')]('user:%s',_0x49dde7[_0xb984('0x16')]),_0xb984('0x3d'),{'sessionId':_0x436597});return _0x424f65[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x3e')});})[_0xb984('0x1f')](handleError(_0x424f65));};exports[_0xb984('0x3f')]=function(_0x445f90,_0xc6389d){logger['info'](_0xb984('0x40'),_0x445f90[_0xb984('0x2b')]);var _0x3a7cbb=unholdValidation['validate'](_0x445f90[_0xb984('0x2b')]);if(_0x3a7cbb[_0xb984('0x2c')]>0x0){return _0xc6389d['status'](0x190)[_0xb984('0x2d')](_0x3a7cbb);}var _0x481eac=_0x445f90[_0xb984('0x2b')][_0xb984('0x2e')];var _0x5a1a34=_0x445f90[_0xb984('0x2b')][_0xb984('0x26')];return getAgent(_0x481eac)[_0xb984('0x1b')](function(_0x3ddeb5){logger[_0xb984('0xf')](_0xb984('0x32'),_0x3ddeb5['name']);emit(util[_0xb984('0x33')]('user:%s',_0x3ddeb5[_0xb984('0x16')]),_0xb984('0x41'),{'sessionId':_0x5a1a34});return _0xc6389d[_0xb984('0x17')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xb984('0x1f')](handleError(_0xc6389d));};exports[_0xb984('0x42')]=function(_0x56ad15,_0x493a8b){logger[_0xb984('0xf')](_0xb984('0x43'),_0x493a8b[_0xb984('0x2b')]);var _0x3daaa0=callsValidation[_0xb984('0x9')](_0x56ad15[_0xb984('0x2b')]);if(_0x3daaa0['length']>0x0){return _0x493a8b['status'](0x190)[_0xb984('0x2d')](_0x3daaa0);}var _0x22ddf=_0x56ad15['body'][_0xb984('0x2e')];var _0x159835=respondWithRpcPromise(_0xb984('0x23'));var _0x317cd8=getAgent(_0x22ddf);return Promise['all']([_0x159835,_0x317cd8])['then'](function(_0x226db2){var _0x36a9eb=_0x226db2[0x0];var _0x2fc1f7=_0x226db2[0x1];var _0x29c79d=_[_0xb984('0x44')](_0x36a9eb[_0xb984('0x45')],function(_0x49ecfd){return _0x49ecfd[_0xb984('0x25')]==_0x2fc1f7['id'];});return _0x493a8b[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'count':_0x29c79d[_0xb984('0x2c')],'rows':_0x29c79d});})[_0xb984('0x1f')](handleError(_0x493a8b));};exports[_0xb984('0x46')]=function(_0x575503,_0x55852d){logger['info'](_0xb984('0x47'),_0x575503[_0xb984('0x2b')]);var _0x36ca94=conferenceValidation[_0xb984('0x9')](_0x575503[_0xb984('0x2b')]);if(_0x36ca94['length']>0x0){return _0x55852d[_0xb984('0x17')](0x190)[_0xb984('0x2d')](_0x36ca94);}var _0x356442=_0x575503['body'][_0xb984('0x2e')];return getAgent(_0x356442)[_0xb984('0x1b')](function(_0x529e28){logger['info'](_0xb984('0x32'),_0x529e28['name']);emit(util['format'](_0xb984('0x34'),_0x529e28['name']),_0xb984('0x48'));return _0x55852d[_0xb984('0x17')](0xc8)[_0xb984('0x2d')]({'error':![],'message':_0xb984('0x49')});})[_0xb984('0x1f')](handleError(_0x55852d));};exports[_0xb984('0x4a')]=function(_0x145052,_0x1a81c3){logger[_0xb984('0xf')](_0xb984('0x4b'),_0x145052[_0xb984('0x2b')]);var _0x1d9213=transferValidation['validate'](_0x145052[_0xb984('0x2b')]);if(_0x1d9213[_0xb984('0x2c')]>0x0){return _0x1a81c3[_0xb984('0x17')](0x190)['json'](_0x1d9213);}var _0x54abb4=_0x145052[_0xb984('0x2b')][_0xb984('0x2e')];var _0x74fc95=_0x145052['body'][_0xb984('0x26')];var _0x35132b=_0x145052[_0xb984('0x2b')][_0xb984('0x4c')];return getAgent(_0x54abb4)[_0xb984('0x1b')](function(_0x1793e2){logger[_0xb984('0xf')](_0xb984('0x32'),_0x1793e2[_0xb984('0x16')]);emit(util[_0xb984('0x33')](_0xb984('0x34'),_0x1793e2[_0xb984('0x16')]),_0xb984('0x4d'),{'sessionId':_0x74fc95,'transferNumber':_0x35132b});return _0x1a81c3[_0xb984('0x17')](0xc8)['json']({'error':![],'message':_0xb984('0x4e')});})['catch'](handleError(_0x1a81c3));}; \ No newline at end of file +var _0x0f9f=['hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','name','status','send','NotFound','then','code','message','result','catch','User','agent','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','validate','webbar:answer','answer\x20executed!'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x3d1621,_0xb5ea42){_0x3d1621=_0x3d1621-0x0;var _0x384d79=_0x0f9f[_0x3d1621];return _0x384d79;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var config=require(_0xf0f9('0x2'));var util=require('util');var BPromise=require(_0xf0f9('0x3'));var jayson=require(_0xf0f9('0x4'));var amiClient=jayson[_0xf0f9('0x5')][_0xf0f9('0x6')]({'port':0x232a});var logger=require(_0xf0f9('0x7'))(_0xf0f9('0x8'));var Redis=require(_0xf0f9('0x9'));config[_0xf0f9('0xa')]=_[_0xf0f9('0xb')](config[_0xf0f9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf0f9('0xc'))(new Redis(config[_0xf0f9('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'callNumber':{'type':_0xf0f9('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xf0f9('0xf')},'callbackUrl':{'type':_0xf0f9('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':[!![],_0xf0f9('0x10')]},'transferNumber':{'type':'string','required':[!![],_0xf0f9('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});function emit(_0x2f5bec,_0x2f75da,_0x16a928){logger[_0xf0f9('0x12')](_0x2f5bec,_0x2f75da,JSON[_0xf0f9('0x13')](_0x16a928));io['to'](_0x2f5bec)['emit'](_0x2f75da,_0x16a928);}function handleError(_0x526fff){return function(_0x350a48){console[_0xf0f9('0x14')]('handleError:',_0x350a48,_0x350a48 instanceof RangeError);logger[_0xf0f9('0x15')](_0x350a48['stack']);if(_0x350a48 instanceof RangeError){if(_0x350a48['name']){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff[_0xf0f9('0x17')](0x194)[_0xf0f9('0x18')](_0x350a48);}else{if(_0x350a48[_0xf0f9('0x16')]){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff['status'](0x1f4)['send'](_0x350a48);}};}function checkError(){return function(_0x5294ac){if(!_0x5294ac){throw new RangeError(_0xf0f9('0x19'));}return _0x5294ac;};}function respondWithRpcPromise(_0x1c8c39,_0x126ba7){return new BPromise(function(_0x5d87a9,_0x4a8726){var _0x209cd4=amiClient;return _0x209cd4['request'](_0x1c8c39,_0x126ba7)[_0xf0f9('0x1a')](function(_0x414f87){if(_0x414f87[_0xf0f9('0x15')]){if(_0x414f87['error'][_0xf0f9('0x1b')]===0x1f4){return _0x4a8726(_0x414f87[_0xf0f9('0x15')][_0xf0f9('0x1c')]);}return _0x5d87a9(_0x414f87['error'][_0xf0f9('0x1c')]);}else{_0x5d87a9(_0x414f87[_0xf0f9('0x1d')]);}})[_0xf0f9('0x1e')](function(_0x185e1e){_0x4a8726(_0x185e1e);});});}function getAgent(_0x16f639){return db[_0xf0f9('0x1f')]['findOne']({'where':{'id':_0x16f639,'role':_0xf0f9('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x1288e0,_0x30e85c){return new BPromise(function(_0x519a46,_0x4b75b2){var _0x119793=respondWithRpcPromise('VoiceChannels');var _0x2121b8=getAgent(_0x1288e0);Promise[_0xf0f9('0x21')]([_0x119793,_0x2121b8])[_0xf0f9('0x1a')](function(_0x353502){var _0x3ec658=_0x353502[0x0];var _0x39cd34=_0x353502[0x1];var _0x1377ed=_[_0xf0f9('0x22')](_0x3ec658[_0xf0f9('0x23')],function(_0x4e4e08){return _0x4e4e08[_0xf0f9('0x24')]==_0x39cd34['id']&&_0x4e4e08[_0xf0f9('0x25')]==_0x30e85c;});if(_0x1377ed['length']==0x1){_0x519a46(_0x39cd34);}else{_0x4b75b2(new RangeError('sessionId\x20'+_0x30e85c+_0xf0f9('0x26')));}});});}exports['originate']=function(_0x483a8c,_0x14f3cb){logger['info'](_0xf0f9('0x27'),_0x483a8c[_0xf0f9('0x28')]);var _0x5305e0=originateValidation['validate'](_0x483a8c[_0xf0f9('0x28')]);if(_0x5305e0[_0xf0f9('0x29')]>0x0){return _0x14f3cb[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x5305e0);}var _0x278192=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x30bc8e=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2c')];var _0x2a7648=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2d')];var _0x5a8b35=_0x483a8c[_0xf0f9('0x28')]['callbackUrl'];return getAgent(_0x278192)[_0xf0f9('0x1a')](function(_0x44c9ed){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x44c9ed[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x44c9ed['name']),'webbar:originate',{'callNumber':_0x30bc8e,'callerId':_0x2a7648,'callbackUrl':_0x5a8b35});return _0x14f3cb[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x31')});})[_0xf0f9('0x1e')](handleError(_0x14f3cb));};exports[_0xf0f9('0x32')]=function(_0x4ac1d2,_0x2b9d56){logger[_0xf0f9('0x12')](_0xf0f9('0x33'),_0x4ac1d2[_0xf0f9('0x28')]);var _0x32a248=hangupValidation['validate'](_0x4ac1d2[_0xf0f9('0x28')]);if(_0x32a248[_0xf0f9('0x29')]>0x0){return _0x2b9d56[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x32a248);}var _0x7cf75a=_0x4ac1d2[_0xf0f9('0x28')]['userId'];var _0x3a0f27=_0x4ac1d2[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x7cf75a)['then'](function(_0x3b52e3){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x3b52e3[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x3b52e3[_0xf0f9('0x16')]),_0xf0f9('0x34'),{'sessionId':_0x3a0f27});return _0x2b9d56[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x35')});})[_0xf0f9('0x1e')](handleError(_0x2b9d56));};exports[_0xf0f9('0x36')]=function(_0x5153b5,_0x4ff1f0){logger[_0xf0f9('0x12')]('answer\x20fired:',_0x5153b5['body']);var _0x4e8234=answerValidation[_0xf0f9('0x37')](_0x5153b5[_0xf0f9('0x28')]);if(_0x4e8234[_0xf0f9('0x29')]>0x0){return _0x4ff1f0[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x4e8234);}var _0xfef8ad=_0x5153b5[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x1a3a6b=_0x5153b5['body'][_0xf0f9('0x25')];return getAgent(_0xfef8ad)[_0xf0f9('0x1a')](function(_0x434fc1){logger['info'](_0xf0f9('0x2e'),_0x434fc1[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')]('user:%s',_0x434fc1[_0xf0f9('0x16')]),_0xf0f9('0x38'),{'sessionId':_0x1a3a6b});return _0x4ff1f0['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x39')});})[_0xf0f9('0x1e')](handleError(_0x4ff1f0));};exports[_0xf0f9('0x3a')]=function(_0x4be16e,_0x35bcf8){logger[_0xf0f9('0x12')](_0xf0f9('0x3b'),_0x4be16e[_0xf0f9('0x28')]);var _0x226bda=holdValidation[_0xf0f9('0x37')](_0x4be16e['body']);if(_0x226bda[_0xf0f9('0x29')]>0x0){return _0x35bcf8['status'](0x190)[_0xf0f9('0x2a')](_0x226bda);}var _0x38956b=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x44b00d=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x38956b)[_0xf0f9('0x1a')](function(_0x1f47fa){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x1f47fa[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x1f47fa[_0xf0f9('0x16')]),_0xf0f9('0x3c'),{'sessionId':_0x44b00d});return _0x35bcf8[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x3d')});})[_0xf0f9('0x1e')](handleError(_0x35bcf8));};exports[_0xf0f9('0x3e')]=function(_0x40711c,_0x3db0b2){logger[_0xf0f9('0x12')]('unhold\x20fired:',_0x40711c['body']);var _0x2eb8b4=unholdValidation['validate'](_0x40711c[_0xf0f9('0x28')]);if(_0x2eb8b4[_0xf0f9('0x29')]>0x0){return _0x3db0b2[_0xf0f9('0x17')](0x190)['json'](_0x2eb8b4);}var _0x2b2604=_0x40711c['body'][_0xf0f9('0x2b')];var _0x603804=_0x40711c[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x2b2604)[_0xf0f9('0x1a')](function(_0x593b54){logger[_0xf0f9('0x12')]('entityFound:',_0x593b54[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x593b54[_0xf0f9('0x16')]),_0xf0f9('0x3f'),{'sessionId':_0x603804});return _0x3db0b2['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x40')});})[_0xf0f9('0x1e')](handleError(_0x3db0b2));};exports[_0xf0f9('0x41')]=function(_0x1dbc9d,_0x2a8aae){logger[_0xf0f9('0x12')](_0xf0f9('0x42'),_0x2a8aae[_0xf0f9('0x28')]);var _0x406b45=callsValidation[_0xf0f9('0x37')](_0x1dbc9d[_0xf0f9('0x28')]);if(_0x406b45[_0xf0f9('0x29')]>0x0){return _0x2a8aae[_0xf0f9('0x17')](0x190)['json'](_0x406b45);}var _0x329b59=_0x1dbc9d[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x59d7bd=respondWithRpcPromise(_0xf0f9('0x43'));var _0x32f641=getAgent(_0x329b59);return Promise[_0xf0f9('0x21')]([_0x59d7bd,_0x32f641])[_0xf0f9('0x1a')](function(_0x6979f){var _0x586022=_0x6979f[0x0];var _0x3b1d45=_0x6979f[0x1];var _0x838550=_[_0xf0f9('0x22')](_0x586022[_0xf0f9('0x23')],function(_0x2807f9){return _0x2807f9[_0xf0f9('0x24')]==_0x3b1d45['id'];});return _0x2a8aae[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'count':_0x838550[_0xf0f9('0x29')],'rows':_0x838550});})[_0xf0f9('0x1e')](handleError(_0x2a8aae));};exports['conference']=function(_0x3777ae,_0x3fa078){logger['info'](_0xf0f9('0x44'),_0x3777ae['body']);var _0x3ac206=conferenceValidation[_0xf0f9('0x37')](_0x3777ae[_0xf0f9('0x28')]);if(_0x3ac206['length']>0x0){return _0x3fa078[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x3ac206);}var _0x28879c=_0x3777ae[_0xf0f9('0x28')][_0xf0f9('0x2b')];return getAgent(_0x28879c)[_0xf0f9('0x1a')](function(_0xdb0e6c){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0xdb0e6c[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0xdb0e6c['name']),_0xf0f9('0x45'));return _0x3fa078[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x46')});})['catch'](handleError(_0x3fa078));};exports[_0xf0f9('0x47')]=function(_0xb29b92,_0xb47567){logger['info'](_0xf0f9('0x48'),_0xb29b92[_0xf0f9('0x28')]);var _0x56e467=transferValidation[_0xf0f9('0x37')](_0xb29b92[_0xf0f9('0x28')]);if(_0x56e467['length']>0x0){return _0xb47567[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x56e467);}var _0x3d1542=_0xb29b92[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x16564d=_0xb29b92[_0xf0f9('0x28')]['sessionId'];var _0x392ffa=_0xb29b92[_0xf0f9('0x28')]['transferNumber'];return getAgent(_0x3d1542)[_0xf0f9('0x1a')](function(_0x539ac6){logger['info'](_0xf0f9('0x2e'),_0x539ac6[_0xf0f9('0x16')]);emit(util['format'](_0xf0f9('0x30'),_0x539ac6['name']),_0xf0f9('0x49'),{'sessionId':_0x16564d,'transferNumber':_0x392ffa});return _0xb47567[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0xf0f9('0x1e')](handleError(_0xb47567));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bd3d38a..6965edf 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x46d5b9,_0x4d7d3f){var _0x2c24aa=function(_0x20f3a6){while(--_0x20f3a6){_0x46d5b9['push'](_0x46d5b9['shift']());}};_0x2c24aa(++_0x4d7d3f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./whatsappAccount.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x12')](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x14')]);router['post'](_0x65f6('0x15'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x65f6('0x12')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x16')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router['post']('/:id/notify',controller[_0x65f6('0x18')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x65f6('0x19')]);router[_0x65f6('0x1a')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x1c')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1d')]);router['delete'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65f6('0x1c')](_0x65f6('0x15'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1c')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller['removeAgents']);module[_0x65f6('0x1f')]=router; \ No newline at end of file +var _0x1967=['addAnswer','addAgents','/:id/notify','notify','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create'];(function(_0x5c5815,_0x304ceb){var _0x18aeb2=function(_0x32792f){while(--_0x32792f){_0x5c5815['push'](_0x5c5815['shift']());}};_0x18aeb2(++_0x304ceb);}(_0x1967,0x173));var _0x7196=function(_0x5eb628,_0x54ebd1){_0x5eb628=_0x5eb628-0x0;var _0xba020b=_0x1967[_0x5eb628];return _0xba020b;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0xc')](_0x7196('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x7196('0xc')](_0x7196('0x12'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);router[_0x7196('0xc')](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x15')]);router[_0x7196('0xc')](_0x7196('0x16'),auth[_0x7196('0xa')](),controller['getApplications']);router[_0x7196('0x17')]('/',auth[_0x7196('0xa')](),controller[_0x7196('0x18')]);router[_0x7196('0x17')]('/:id/dispositions',auth[_0x7196('0xa')](),controller['addDisposition']);router[_0x7196('0x17')](_0x7196('0x12'),auth[_0x7196('0xa')](),controller[_0x7196('0x19')]);router[_0x7196('0x17')](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x1a')]);router[_0x7196('0x17')](_0x7196('0x16'),auth[_0x7196('0xa')](),controller['addApplications']);router['post'](_0x7196('0x1b'),controller[_0x7196('0x1c')]);router[_0x7196('0x17')]('/:id/send',auth[_0x7196('0xa')](),controller['send']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x1d')]);router['delete']('/:id',auth[_0x7196('0xa')](),controller[_0x7196('0x1e')]);router['delete'](_0x7196('0x11'),auth[_0x7196('0xa')](),controller[_0x7196('0x1f')]);router[_0x7196('0x20')](_0x7196('0x12'),auth['isAuthenticated'](),controller[_0x7196('0x21')]);router['delete'](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x22')]);module[_0x7196('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 83cd4f7..f2b2a30 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 _0x15ea=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x15ea,0xbf));var _0xa15e=function(_0x131a67,_0x5efe9f){_0x131a67=_0x131a67-0x0;var _0x2cc02c=_0x15ea[_0x131a67];return _0x2cc02c;};'use strict';var Sequelize=require(_0xa15e('0x0'));var rs=require(_0xa15e('0x1'));module[_0xa15e('0x2')]={'name':{'type':Sequelize[_0xa15e('0x3')],'unique':_0xa15e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa15e('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa15e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa15e('0x3')],'defaultValue':function(){return rs[_0xa15e('0x5')]();}},'phone':{'type':Sequelize[_0xa15e('0x3')]},'type':{'type':Sequelize[_0xa15e('0x6')](_0xa15e('0x7'),_0xa15e('0x8'))},'accountSid':{'type':Sequelize[_0xa15e('0x3')]},'baseUrl':{'type':Sequelize[_0xa15e('0x3')]},'authToken':{'type':Sequelize[_0xa15e('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa15e('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa15e('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa15e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa15e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa15e('0xb')],'comment':_0xa15e('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa15e('0xd'),'set':function(_0x351a60){if(!_0x351a60){this['setDataValue'](_0xa15e('0xe'),null);}this[_0xa15e('0xf')](_0xa15e('0x10'),_0x351a60);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeaf8=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','generate','ENUM'];(function(_0x175d9f,_0x5b642d){var _0x3a6cbb=function(_0x27a8fd){while(--_0x27a8fd){_0x175d9f['push'](_0x175d9f['shift']());}};_0x3a6cbb(++_0x5b642d);}(_0xeaf8,0x118));var _0x8eaf=function(_0xa2f8ad,_0xbbbd85){_0xa2f8ad=_0xa2f8ad-0x0;var _0x3ae7b4=_0xeaf8[_0xa2f8ad];return _0x3ae7b4;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x8eaf('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8eaf('0x1'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x8eaf('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8eaf('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8eaf('0x4')]('twilio',_0x8eaf('0x5'))},'accountSid':{'type':Sequelize[_0x8eaf('0x2')]},'baseUrl':{'type':Sequelize[_0x8eaf('0x2')]},'authToken':{'type':Sequelize[_0x8eaf('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8eaf('0x6')],'defaultValue':function(){return _0x8eaf('0x7');}},'notificationSound':{'type':Sequelize[_0x8eaf('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8eaf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8eaf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8eaf('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x8eaf('0x8')],'defaultValue':![],'comment':_0x8eaf('0xb'),'set':function(_0x5cba99){if(!_0x5cba99){this[_0x8eaf('0xc')](_0x8eaf('0xd'),null);}this[_0x8eaf('0xc')](_0x8eaf('0xe'),_0x5cba99);}},'description':{'type':Sequelize[_0x8eaf('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5a2e8f1..9a7a5aa 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 _0x558a=['MessageSid','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./whatsappAccount.socket','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','params','WhatsappAccountId','Disposition','getDispositions','findOne','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','stack','getApplications','notify','whatsapp','Applications','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','from','From','replace','whatsapp:','messageId'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x558a,0xec));var _0xa558=function(_0x3132a3,_0x2db29f){_0x3132a3=_0x3132a3-0x0;var _0x5a0e4e=_0x558a[_0x3132a3];return _0x5a0e4e;};'use strict';var emlformat=require(_0xa558('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa558('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa558('0x2'));var BPromise=require(_0xa558('0x3'));var Mustache=require(_0xa558('0x4'));var util=require(_0xa558('0x5'));var path=require('path');var sox=require(_0xa558('0x6'));var csv=require(_0xa558('0x7'));var ejs=require(_0xa558('0x8'));var fs=require('fs');var fs_extra=require(_0xa558('0x9'));var _=require(_0xa558('0xa'));var squel=require(_0xa558('0xb'));var crypto=require(_0xa558('0xc'));var jsforce=require(_0xa558('0xd'));var deskjs=require(_0xa558('0xe'));var toCsv=require(_0xa558('0x7'));var querystring=require(_0xa558('0xf'));var Papa=require('papaparse');var Redis=require(_0xa558('0x10'));var authService=require(_0xa558('0x11'));var qs=require(_0xa558('0x12'));var as=require(_0xa558('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa558('0x14'))(_0xa558('0x15'));var utils=require(_0xa558('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa558('0x17'));var db=require(_0xa558('0x18'))['db'];config[_0xa558('0x19')]=_[_0xa558('0x1a')](config[_0xa558('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa558('0x19')]));require(_0xa558('0x1b'))['register'](socket);var jayson=require(_0xa558('0x1c'));var client=jayson[_0xa558('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x449c5a,_0x57da72,_0x2e0089,_0x163221){return new BPromise(function(_0x25dbf4,_0x20586b){var _0x4d455b=_0x163221||client;return _0x4d455b[_0xa558('0x1e')](_0x449c5a,_0x2e0089)[_0xa558('0x1f')](function(_0x567335){logger[_0xa558('0x20')](_0xa558('0x21'),_0x57da72,_0xa558('0x22'));logger[_0xa558('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x57da72,_0xa558('0x22'),JSON[_0xa558('0x24')](_0x567335));if(_0x567335[_0xa558('0x25')]){if(_0x567335[_0xa558('0x25')]['code']===0x1f4){logger[_0xa558('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x57da72,_0x567335['error'][_0xa558('0x26')]);return _0x20586b(_0x567335[_0xa558('0x25')]['message']);}logger[_0xa558('0x25')](_0xa558('0x21'),_0x57da72,_0x567335[_0xa558('0x25')]['message']);return _0x25dbf4(_0x567335[_0xa558('0x25')][_0xa558('0x26')]);}else{logger[_0xa558('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x57da72,_0xa558('0x22'));_0x25dbf4(_0x567335[_0xa558('0x27')][_0xa558('0x26')]);}})['catch'](function(_0x7c68af){logger[_0xa558('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x57da72,_0x7c68af);_0x20586b(_0x7c68af);});});}function respondWithStatusCode(_0x13021e,_0x566848){_0x566848=_0x566848||0xcc;return function(_0x29e997){if(_0x29e997){return _0x13021e[_0xa558('0x28')](_0x566848);}return _0x13021e[_0xa558('0x29')](_0x566848)['end']();};}function respondWithResult(_0x30d632,_0xbc62e5){_0xbc62e5=_0xbc62e5||0xc8;return function(_0x31b587){if(_0x31b587){return _0x30d632['status'](_0xbc62e5)[_0xa558('0x2a')](_0x31b587);}};}function respondWithFilteredResult(_0x6c68bd,_0x26062d){return function(_0x4585a6){if(_0x4585a6){var _0x3ce50f=typeof _0x26062d['offset']===_0xa558('0x2b')&&typeof _0x26062d[_0xa558('0x2c')]==='undefined';var _0x47d485=_0x4585a6[_0xa558('0x2d')];var _0x1e61de=_0x3ce50f?0x0:_0x26062d[_0xa558('0x2e')];var _0x3ccd19=_0x3ce50f?_0x4585a6[_0xa558('0x2d')]:_0x26062d[_0xa558('0x2e')]+_0x26062d['limit'];var _0x4768a2;if(_0x3ccd19>=_0x47d485){_0x3ccd19=_0x47d485;_0x4768a2=0xc8;}else{_0x4768a2=0xce;}_0x6c68bd[_0xa558('0x29')](_0x4768a2);return _0x6c68bd[_0xa558('0x2f')](_0xa558('0x30'),_0x1e61de+'-'+_0x3ccd19+'/'+_0x47d485)['json'](_0x4585a6);}return null;};}function patchUpdates(_0x2a54d5){return function(_0x40294a){try{jsonpatch[_0xa558('0x31')](_0x40294a,_0x2a54d5,!![]);}catch(_0x319364){return BPromise[_0xa558('0x32')](_0x319364);}return _0x40294a[_0xa558('0x33')]();};}function saveUpdates(_0x28c73d,_0x2908d3){return function(_0x5032f6){if(_0x5032f6){return _0x5032f6['update'](_0x28c73d)[_0xa558('0x1f')](function(_0xd2d34b){return _0xd2d34b;});}return null;};}function removeEntity(_0x3dcad1,_0xfa5440){return function(_0x227146){if(_0x227146){return _0x227146[_0xa558('0x34')]()[_0xa558('0x1f')](function(){var _0x97b048=_0x227146[_0xa558('0x35')]({'plain':!![]});var _0x18604a=_0xa558('0x36');return db[_0xa558('0x37')][_0xa558('0x34')]({'where':{'type':_0x18604a,'resourceId':_0x97b048['id']}})[_0xa558('0x1f')](function(){return _0x227146;});})[_0xa558('0x1f')](function(){_0x3dcad1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162061,_0x4a3088){return function(_0x5c0a9e){if(!_0x5c0a9e){_0x162061[_0xa558('0x28')](0x194);}return _0x5c0a9e;};}function handleError(_0x16746a,_0x26e119){_0x26e119=_0x26e119||0x1f4;return function(_0x3e5764){logger[_0xa558('0x25')](_0x3e5764['stack']);if(_0x3e5764[_0xa558('0x38')]){delete _0x3e5764[_0xa558('0x38')];}_0x16746a[_0xa558('0x29')](_0x26e119)[_0xa558('0x39')](_0x3e5764);};}exports[_0xa558('0x3a')]=function(_0x2bb65b,_0x35e6c9){var _0x553532={'include':[{'model':db[_0xa558('0x3b')],'as':_0xa558('0x3c')}]},_0x36d360={},_0x5dae02={'count':0x0,'rows':[]};var _0x16eef3=_['map'](db[_0xa558('0x3d')][_0xa558('0x3e')],function(_0x4267e5){return{'name':_0x4267e5['fieldName'],'type':_0x4267e5[_0xa558('0x3f')][_0xa558('0x40')]};});_0x36d360[_0xa558('0x41')]=_[_0xa558('0x42')](_0x16eef3,_0xa558('0x38'));_0x36d360[_0xa558('0x43')]=_[_0xa558('0x44')](_0x2bb65b['query']);_0x36d360[_0xa558('0x45')]=_[_0xa558('0x46')](_0x36d360[_0xa558('0x41')],_0x36d360[_0xa558('0x43')]);_0x553532[_0xa558('0x47')]=_[_0xa558('0x46')](_0x36d360[_0xa558('0x41')],qs['fields'](_0x2bb65b[_0xa558('0x43')][_0xa558('0x48')]));_0x553532[_0xa558('0x47')]=_0x553532[_0xa558('0x47')][_0xa558('0x49')]?_0x553532['attributes']:_0x36d360[_0xa558('0x41')];if(!_0x2bb65b[_0xa558('0x43')][_0xa558('0x4a')](_0xa558('0x4b'))){_0x553532[_0xa558('0x2c')]=qs[_0xa558('0x2c')](_0x2bb65b[_0xa558('0x43')][_0xa558('0x2c')]);_0x553532[_0xa558('0x2e')]=qs[_0xa558('0x2e')](_0x2bb65b[_0xa558('0x43')][_0xa558('0x2e')]);}_0x553532[_0xa558('0x4c')]=qs['sort'](_0x2bb65b[_0xa558('0x43')][_0xa558('0x4d')]);_0x553532[_0xa558('0x4e')]=qs[_0xa558('0x45')](_[_0xa558('0x4f')](_0x2bb65b[_0xa558('0x43')],_0x36d360[_0xa558('0x45')]),_0x16eef3);if(_0x2bb65b[_0xa558('0x43')][_0xa558('0x50')]){_0x553532[_0xa558('0x4e')]=_[_0xa558('0x51')](_0x553532['where'],{'$or':_[_0xa558('0x42')](_0x16eef3,function(_0x650b56){if(_0x650b56[_0xa558('0x3f')]!==_0xa558('0x52')){var _0x4c442b={};_0x4c442b[_0x650b56[_0xa558('0x38')]]={'$like':'%'+_0x2bb65b[_0xa558('0x43')][_0xa558('0x50')]+'%'};return _0x4c442b;}})});}_0x553532=_[_0xa558('0x51')]({},_0x553532,_0x2bb65b[_0xa558('0x53')]);var _0x27e171={'where':_0x553532['where']};return db[_0xa558('0x3d')][_0xa558('0x2d')](_0x27e171)[_0xa558('0x1f')](function(_0x446b47){_0x5dae02[_0xa558('0x2d')]=_0x446b47;if(_0x2bb65b[_0xa558('0x43')][_0xa558('0x54')]){_0x553532[_0xa558('0x55')]=[{'all':!![]}];}return db[_0xa558('0x3d')][_0xa558('0x56')](_0x553532);})[_0xa558('0x1f')](function(_0x554bb1){_0x5dae02[_0xa558('0x57')]=_0x554bb1;return _0x5dae02;})[_0xa558('0x1f')](respondWithFilteredResult(_0x35e6c9,_0x553532))[_0xa558('0x58')](handleError(_0x35e6c9,null));};exports['show']=function(_0x2a6840,_0x3719b1){var _0x37bd09={'raw':![],'where':{'id':_0x2a6840['params']['id']},'include':[{'model':db[_0xa558('0x3b')],'as':_0xa558('0x3c')}]},_0x3d38e3={};_0x3d38e3['model']=_['keys'](db[_0xa558('0x3d')][_0xa558('0x3e')]);_0x3d38e3['query']=_['keys'](_0x2a6840[_0xa558('0x43')]);_0x3d38e3[_0xa558('0x45')]=_[_0xa558('0x46')](_0x3d38e3[_0xa558('0x41')],_0x3d38e3[_0xa558('0x43')]);_0x37bd09['attributes']=_[_0xa558('0x46')](_0x3d38e3['model'],qs[_0xa558('0x48')](_0x2a6840[_0xa558('0x43')][_0xa558('0x48')]));_0x37bd09[_0xa558('0x47')]=_0x37bd09[_0xa558('0x47')][_0xa558('0x49')]?_0x37bd09[_0xa558('0x47')]:_0x3d38e3[_0xa558('0x41')];if(_0x2a6840[_0xa558('0x43')][_0xa558('0x54')]){_0x37bd09[_0xa558('0x55')]=[{'all':!![]}];}_0x37bd09=_[_0xa558('0x51')]({},_0x37bd09,_0x2a6840[_0xa558('0x53')]);return db[_0xa558('0x3d')][_0xa558('0x59')](_0x37bd09)[_0xa558('0x1f')](handleEntityNotFound(_0x3719b1,null))[_0xa558('0x1f')](respondWithResult(_0x3719b1,null))['catch'](handleError(_0x3719b1,null));};exports[_0xa558('0x5a')]=function(_0x4528ff,_0x479de7){return db[_0xa558('0x3d')][_0xa558('0x5a')](_0x4528ff[_0xa558('0x5b')],{})['then'](function(_0x4c5826){var _0x2fc2c7=_0x4528ff[_0xa558('0x5c')][_0xa558('0x35')]({'plain':!![]});if(!_0x2fc2c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fc2c7[_0xa558('0x5d')]==='user'){var _0x1a755a=_0x4c5826[_0xa558('0x35')]({'plain':!![]});var _0x240880=_0xa558('0x36');return db[_0xa558('0x5e')][_0xa558('0x59')]({'where':{'name':_0x240880,'userProfileId':_0x2fc2c7[_0xa558('0x5f')]},'raw':!![]})[_0xa558('0x1f')](function(_0x5b0101){if(_0x5b0101&&_0x5b0101[_0xa558('0x60')]===0x0){return db[_0xa558('0x37')][_0xa558('0x5a')]({'name':_0x1a755a['name'],'resourceId':_0x1a755a['id'],'type':_0x5b0101['name'],'sectionId':_0x5b0101['id']},{})[_0xa558('0x1f')](function(){return _0x4c5826;});}else{return _0x4c5826;}})[_0xa558('0x58')](function(_0x1f1940){logger[_0xa558('0x25')](_0xa558('0x61'),_0x1f1940);throw _0x1f1940;});}return _0x4c5826;})[_0xa558('0x1f')](respondWithResult(_0x479de7,0xc9))['catch'](handleError(_0x479de7,null));};exports[_0xa558('0x62')]=function(_0x50dc67,_0x3a13d0){if(_0x50dc67['body']['id']){delete _0x50dc67[_0xa558('0x5b')]['id'];}return db[_0xa558('0x3d')][_0xa558('0x59')]({'where':{'id':_0x50dc67['params']['id']},'include':[{'model':db[_0xa558('0x3b')],'as':_0xa558('0x3c')}]})[_0xa558('0x1f')](handleEntityNotFound(_0x3a13d0,null))[_0xa558('0x1f')](saveUpdates(_0x50dc67[_0xa558('0x5b')],null))['then'](respondWithResult(_0x3a13d0,null))[_0xa558('0x58')](handleError(_0x3a13d0,null));};exports[_0xa558('0x34')]=function(_0x144ab3,_0x31d5fe){return db[_0xa558('0x3d')][_0xa558('0x59')]({'where':{'id':_0x144ab3['params']['id']}})['then'](handleEntityNotFound(_0x31d5fe,null))['then'](removeEntity(_0x31d5fe,null))[_0xa558('0x58')](handleError(_0x31d5fe,null));};exports[_0xa558('0x63')]=function(_0x3c8d73,_0x4d8ee4){return db[_0xa558('0x3d')][_0xa558('0x63')]()[_0xa558('0x1f')](respondWithResult(_0x4d8ee4,null))[_0xa558('0x58')](handleError(_0x4d8ee4,null));};exports[_0xa558('0x64')]=function(_0x47a0db,_0x25b484,_0x51a8cd){if(_0x47a0db[_0xa558('0x5b')]['id']){delete _0x47a0db[_0xa558('0x5b')]['id'];}return db[_0xa558('0x3d')][_0xa558('0x59')]({'where':{'id':_0x47a0db[_0xa558('0x65')]['id']}})['then'](handleEntityNotFound(_0x25b484,null))[_0xa558('0x1f')](function(_0x1a9b32){if(_0x1a9b32){_0x47a0db['body'][_0xa558('0x66')]=_0x1a9b32['id'];return db[_0xa558('0x67')]['create'](_0x47a0db['body']);}})[_0xa558('0x1f')](respondWithResult(_0x25b484,null))[_0xa558('0x58')](handleError(_0x25b484,null));};exports[_0xa558('0x68')]=function(_0x2aaef5,_0x17dd79,_0x39027f){var _0xdfc202={'raw':![],'where':{}};var _0x4c3425={};var _0xe049b9={'count':0x0,'rows':[]};return db[_0xa558('0x3d')][_0xa558('0x69')]({'where':{'id':_0x2aaef5[_0xa558('0x65')]['id']}})['then'](handleEntityNotFound(_0x17dd79,null))['then'](function(_0x5ba10a){if(_0x5ba10a){_0x4c3425[_0xa558('0x41')]=_['keys'](db['Disposition'][_0xa558('0x3e')]);_0x4c3425[_0xa558('0x43')]=_[_0xa558('0x44')](_0x2aaef5[_0xa558('0x43')]);_0x4c3425['filters']=_[_0xa558('0x46')](_0x4c3425['model'],_0x4c3425[_0xa558('0x43')]);_0xdfc202[_0xa558('0x47')]=_['intersection'](_0x4c3425[_0xa558('0x41')],qs[_0xa558('0x48')](_0x2aaef5[_0xa558('0x43')][_0xa558('0x48')]));_0xdfc202[_0xa558('0x47')]=_0xdfc202[_0xa558('0x47')][_0xa558('0x49')]?_0xdfc202[_0xa558('0x47')]:_0x4c3425[_0xa558('0x41')];if(!_0x2aaef5['query'][_0xa558('0x4a')]('nolimit')){_0xdfc202[_0xa558('0x2c')]=qs[_0xa558('0x2c')](_0x2aaef5['query']['limit']);_0xdfc202[_0xa558('0x2e')]=qs['offset'](_0x2aaef5[_0xa558('0x43')]['offset']);}_0xdfc202['order']=qs[_0xa558('0x4d')](_0x2aaef5['query'][_0xa558('0x4d')]);_0xdfc202[_0xa558('0x4e')]=qs[_0xa558('0x45')](_['pick'](_0x2aaef5['query'],_0x4c3425[_0xa558('0x45')]));_0xdfc202[_0xa558('0x4e')][_0xa558('0x66')]=_0x5ba10a['id'];if(_0x2aaef5['query'][_0xa558('0x50')]){_0xdfc202[_0xa558('0x4e')]=_[_0xa558('0x51')](_0xdfc202[_0xa558('0x4e')],{'$or':_['map'](_0xdfc202[_0xa558('0x47')],function(_0x4bcb21){var _0x5b4574={};_0x5b4574[_0x4bcb21]={'$like':'%'+_0x2aaef5[_0xa558('0x43')]['filter']+'%'};return _0x5b4574;})});}_0xdfc202=_[_0xa558('0x51')]({},_0xdfc202,_0x2aaef5[_0xa558('0x53')]);return db[_0xa558('0x67')][_0xa558('0x2d')]({'where':_0xdfc202[_0xa558('0x4e')]})['then'](function(_0x570661){_0xe049b9[_0xa558('0x2d')]=_0x570661;if(_0x2aaef5['query'][_0xa558('0x54')]){_0xdfc202['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0xdfc202);})[_0xa558('0x1f')](function(_0x327771){_0xe049b9[_0xa558('0x57')]=_0x327771;return _0xe049b9;});}})['then'](respondWithFilteredResult(_0x17dd79,_0xdfc202))[_0xa558('0x58')](handleError(_0x17dd79,null));};exports['removeDispositions']=function(_0x5aab9f,_0x45ced2,_0xbdd6a4){return db[_0xa558('0x3d')]['find']({'where':{'id':_0x5aab9f['params']['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x45ced2,null))['then'](function(_0x49217e){if(_0x49217e){return _0x49217e['removeDispositions'](_0x5aab9f[_0xa558('0x43')][_0xa558('0x6a')]);}})[_0xa558('0x1f')](respondWithStatusCode(_0x45ced2,null))['catch'](handleError(_0x45ced2,null));};exports[_0xa558('0x6b')]=function(_0x5ec498,_0x599736,_0x2c40ee){if(_0x5ec498['body']['id']){delete _0x5ec498[_0xa558('0x5b')]['id'];}return db[_0xa558('0x3d')]['find']({'where':{'id':_0x5ec498[_0xa558('0x65')]['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x599736,null))[_0xa558('0x1f')](function(_0xe9692c){if(_0xe9692c){_0x5ec498[_0xa558('0x5b')][_0xa558('0x66')]=_0xe9692c['id'];return db[_0xa558('0x6c')][_0xa558('0x5a')](_0x5ec498[_0xa558('0x5b')]);}})[_0xa558('0x1f')](respondWithResult(_0x599736,null))[_0xa558('0x58')](handleError(_0x599736,null));};exports[_0xa558('0x6d')]=function(_0x7af5fc,_0x3cecfa,_0xb945f9){var _0x21d0fd={'raw':![],'where':{}};var _0x7c5dfb={};var _0x166f4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xa558('0x69')]({'where':{'id':_0x7af5fc[_0xa558('0x65')]['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x3cecfa,null))[_0xa558('0x1f')](function(_0x1a9ff1){if(_0x1a9ff1){_0x7c5dfb[_0xa558('0x41')]=_[_0xa558('0x44')](db[_0xa558('0x6c')]['rawAttributes']);_0x7c5dfb[_0xa558('0x43')]=_[_0xa558('0x44')](_0x7af5fc[_0xa558('0x43')]);_0x7c5dfb[_0xa558('0x45')]=_[_0xa558('0x46')](_0x7c5dfb[_0xa558('0x41')],_0x7c5dfb['query']);_0x21d0fd['attributes']=_[_0xa558('0x46')](_0x7c5dfb['model'],qs['fields'](_0x7af5fc[_0xa558('0x43')][_0xa558('0x48')]));_0x21d0fd['attributes']=_0x21d0fd[_0xa558('0x47')][_0xa558('0x49')]?_0x21d0fd[_0xa558('0x47')]:_0x7c5dfb[_0xa558('0x41')];if(!_0x7af5fc[_0xa558('0x43')][_0xa558('0x4a')](_0xa558('0x4b'))){_0x21d0fd[_0xa558('0x2c')]=qs[_0xa558('0x2c')](_0x7af5fc[_0xa558('0x43')]['limit']);_0x21d0fd[_0xa558('0x2e')]=qs[_0xa558('0x2e')](_0x7af5fc[_0xa558('0x43')][_0xa558('0x2e')]);}_0x21d0fd['order']=qs[_0xa558('0x4d')](_0x7af5fc[_0xa558('0x43')][_0xa558('0x4d')]);_0x21d0fd[_0xa558('0x4e')]=qs[_0xa558('0x45')](_[_0xa558('0x4f')](_0x7af5fc[_0xa558('0x43')],_0x7c5dfb[_0xa558('0x45')]));_0x21d0fd[_0xa558('0x4e')][_0xa558('0x66')]=_0x1a9ff1['id'];if(_0x7af5fc[_0xa558('0x43')][_0xa558('0x50')]){_0x21d0fd[_0xa558('0x4e')]=_['merge'](_0x21d0fd[_0xa558('0x4e')],{'$or':_[_0xa558('0x42')](_0x21d0fd[_0xa558('0x47')],function(_0x54cf7c){var _0x33e627={};_0x33e627[_0x54cf7c]={'$like':'%'+_0x7af5fc['query'][_0xa558('0x50')]+'%'};return _0x33e627;})});}_0x21d0fd=_[_0xa558('0x51')]({},_0x21d0fd,_0x7af5fc[_0xa558('0x53')]);return db[_0xa558('0x6c')]['count']({'where':_0x21d0fd['where']})[_0xa558('0x1f')](function(_0x683f40){_0x166f4['count']=_0x683f40;if(_0x7af5fc[_0xa558('0x43')]['includeAll']){_0x21d0fd[_0xa558('0x55')]=[{'all':!![]}];}return db[_0xa558('0x6c')][_0xa558('0x56')](_0x21d0fd);})[_0xa558('0x1f')](function(_0x4d7361){_0x166f4[_0xa558('0x57')]=_0x4d7361;return _0x166f4;});}})[_0xa558('0x1f')](respondWithFilteredResult(_0x3cecfa,_0x21d0fd))[_0xa558('0x58')](handleError(_0x3cecfa,null));};exports['removeAnswers']=function(_0x4a43b5,_0x4acdc9,_0x538509){return db[_0xa558('0x3d')][_0xa558('0x59')]({'where':{'id':_0x4a43b5[_0xa558('0x65')]['id']}})['then'](handleEntityNotFound(_0x4acdc9,null))['then'](function(_0x5d2af9){if(_0x5d2af9){return _0x5d2af9[_0xa558('0x6e')](_0x4a43b5[_0xa558('0x43')][_0xa558('0x6a')]);}})[_0xa558('0x1f')](respondWithStatusCode(_0x4acdc9,null))[_0xa558('0x58')](handleError(_0x4acdc9,null));};exports[_0xa558('0x6f')]=function(_0x2293c0,_0x12b3cd,_0x336712){return db['WhatsappAccount'][_0xa558('0x59')]({'where':{'id':_0x2293c0[_0xa558('0x65')]['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x12b3cd,null))[_0xa558('0x1f')](function(_0x19fa9a){if(_0x19fa9a){return _0x19fa9a[_0xa558('0x6f')](_0x2293c0[_0xa558('0x5b')][_0xa558('0x6a')],_[_0xa558('0x70')](_0x2293c0[_0xa558('0x5b')],['ids','id'])||{})['spread'](function(_0x58a7fa){for(var _0x4c37f2=0x0;_0x4c37f2<_0x2293c0['body'][_0xa558('0x6a')]['length'];_0x4c37f2+=0x1){socket[_0xa558('0x71')](_0xa558('0x72'),{'UserId':Number(_0x2293c0[_0xa558('0x5b')][_0xa558('0x6a')][_0x4c37f2]),'WhatsappAccountId':Number(_0x2293c0[_0xa558('0x65')]['id'])});}return _0x58a7fa;});}})[_0xa558('0x1f')](respondWithResult(_0x12b3cd,null))['catch'](handleError(_0x12b3cd,null));};exports[_0xa558('0x73')]=function(_0x47efc6,_0x5957a1,_0x33e47e){return db[_0xa558('0x3d')][_0xa558('0x59')]({'where':{'id':_0x47efc6[_0xa558('0x65')]['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x5957a1,null))[_0xa558('0x1f')](function(_0x120acf){if(_0x120acf){return _0x120acf[_0xa558('0x73')](_0x47efc6[_0xa558('0x43')][_0xa558('0x6a')])['then'](function(){if(_[_0xa558('0x74')](_0x47efc6[_0xa558('0x43')][_0xa558('0x6a')])){for(var _0x2c5bdb=0x0;_0x2c5bdb<_0x47efc6[_0xa558('0x43')][_0xa558('0x6a')]['length'];_0x2c5bdb+=0x1){socket[_0xa558('0x71')](_0xa558('0x75'),{'UserId':Number(_0x47efc6[_0xa558('0x43')]['ids'][_0x2c5bdb]),'WhatsappAccountId':Number(_0x47efc6['params']['id'])});}}else{socket[_0xa558('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x47efc6[_0xa558('0x43')][_0xa558('0x6a')]),'WhatsappAccountId':Number(_0x47efc6[_0xa558('0x65')]['id'])});}});}})[_0xa558('0x1f')](respondWithStatusCode(_0x5957a1,null))[_0xa558('0x58')](handleError(_0x5957a1,null));};exports[_0xa558('0x76')]=function(_0x2a2a29,_0x120d81,_0x11efcf){var _0x409aea={};var _0x38a8c0={};var _0x2d6b35;var _0x3dea0f;return db['WhatsappAccount'][_0xa558('0x69')]({'where':{'id':_0x2a2a29[_0xa558('0x65')]['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x120d81,null))[_0xa558('0x1f')](function(_0x498094){if(_0x498094){_0x2d6b35=_0x498094;_0x38a8c0[_0xa558('0x41')]=_[_0xa558('0x44')](db[_0xa558('0x77')][_0xa558('0x3e')]);_0x38a8c0[_0xa558('0x43')]=_[_0xa558('0x44')](_0x2a2a29[_0xa558('0x43')]);_0x38a8c0[_0xa558('0x45')]=_[_0xa558('0x46')](_0x38a8c0[_0xa558('0x41')],_0x38a8c0['query']);_0x409aea['attributes']=_[_0xa558('0x46')](_0x38a8c0[_0xa558('0x41')],qs['fields'](_0x2a2a29[_0xa558('0x43')]['fields']));_0x409aea[_0xa558('0x47')]=_0x409aea[_0xa558('0x47')][_0xa558('0x49')]?_0x409aea[_0xa558('0x47')]:_0x38a8c0[_0xa558('0x41')];_0x409aea[_0xa558('0x4c')]=qs[_0xa558('0x4d')](_0x2a2a29['query']['sort']);_0x409aea[_0xa558('0x4e')]=qs[_0xa558('0x45')](_[_0xa558('0x4f')](_0x2a2a29['query'],_0x38a8c0['filters']));if(_0x2a2a29[_0xa558('0x43')][_0xa558('0x50')]){_0x409aea[_0xa558('0x4e')]=_[_0xa558('0x51')](_0x409aea[_0xa558('0x4e')],{'$or':_[_0xa558('0x42')](_0x409aea[_0xa558('0x47')],function(_0x25b309){var _0x1b9810={};_0x1b9810[_0x25b309]={'$like':'%'+_0x2a2a29[_0xa558('0x43')][_0xa558('0x50')]+'%'};return _0x1b9810;})});}_0x409aea=_['merge']({},_0x409aea,_0x2a2a29[_0xa558('0x53')]);return _0x2d6b35[_0xa558('0x76')](_0x409aea);}})[_0xa558('0x1f')](function(_0x501c80){if(_0x501c80){_0x3dea0f=_0x501c80['length'];if(!_0x2a2a29['query'][_0xa558('0x4a')](_0xa558('0x4b'))){_0x409aea['limit']=qs[_0xa558('0x2c')](_0x2a2a29[_0xa558('0x43')][_0xa558('0x2c')]);_0x409aea['offset']=qs[_0xa558('0x2e')](_0x2a2a29[_0xa558('0x43')][_0xa558('0x2e')]);}return _0x2d6b35[_0xa558('0x76')](_0x409aea);}})[_0xa558('0x1f')](function(_0x364142){if(_0x364142){return _0x364142?{'count':_0x3dea0f,'rows':_0x364142}:null;}})[_0xa558('0x1f')](respondWithResult(_0x120d81,null))[_0xa558('0x58')](handleError(_0x120d81,null));};exports[_0xa558('0x78')]=function(_0x4af5d1,_0x489be9){var _0x38e6df=_0x4af5d1[_0xa558('0x65')]['id'];var _0x415706=_0x4af5d1[_0xa558('0x5b')];var _0x4f85ef=0xc8;var _0x138f2d=null;return db['sequelize'][_0xa558('0x79')]({'isolationLevel':db[_0xa558('0x7a')][_0xa558('0x7b')]['ISOLATION_LEVELS'][_0xa558('0x7c')]},function(_0x11a92e){return db['WhatsappAccount'][_0xa558('0x69')]({'where':{'id':_0x38e6df},'transaction':_0x11a92e})[_0xa558('0x1f')](function(_0x305d31){if(_0x305d31){return db['WhatsappApplication'][_0xa558('0x34')]({'where':{'WhatsappAccountId':_0x38e6df},'transaction':_0x11a92e})[_0xa558('0x1f')](function(){var _0x10ff8c=_[_0xa558('0x42')](_0x415706,function(_0x3853c3){_0x3853c3[_0xa558('0x66')]=_0x38e6df;return _0x3853c3;});return db[_0xa558('0x7d')][_0xa558('0x7e')](_0x10ff8c,{'transaction':_0x11a92e});});}else{_0x4f85ef=0x194;_0x138f2d=[];}});})[_0xa558('0x1f')](function(){if(_0x4f85ef!==0x194){return db[_0xa558('0x7d')][_0xa558('0x7f')]({'where':{'WhatsappAccountId':_0x38e6df},'order':'priority'})[_0xa558('0x1f')](function(_0x3a0711){_0x138f2d=_0x3a0711;});}})[_0xa558('0x58')](function(_0x5a32c0){_0x4f85ef=0x1f4;logger[_0xa558('0x25')](_0x5a32c0[_0xa558('0x80')]);if(_0x5a32c0[_0xa558('0x38')]){delete _0x5a32c0[_0xa558('0x38')];}_0x138f2d=_0x5a32c0;})['finally'](function(){if(_0x138f2d===null){_0x489be9[_0xa558('0x28')](_0x4f85ef);}else{if(_0x4f85ef===0x1f4){_0x489be9[_0xa558('0x29')](_0x4f85ef)['send'](_0x138f2d);}else{_0x489be9['status'](_0x4f85ef)[_0xa558('0x2a')](_0x138f2d);}}});};exports[_0xa558('0x81')]=function(_0x4701ce,_0x474b99,_0x49bd5c){var _0x1de590={};var _0x2fee17={};var _0x510829;var _0x3128ca;return db[_0xa558('0x3d')][_0xa558('0x69')]({'where':{'id':_0x4701ce[_0xa558('0x65')]['id']}})[_0xa558('0x1f')](handleEntityNotFound(_0x474b99,null))[_0xa558('0x1f')](function(_0x134aa6){if(_0x134aa6){_0x510829=_0x134aa6;_0x2fee17[_0xa558('0x41')]=_[_0xa558('0x44')](db[_0xa558('0x7d')]['rawAttributes']);_0x2fee17['query']=_['keys'](_0x4701ce[_0xa558('0x43')]);_0x2fee17[_0xa558('0x45')]=_[_0xa558('0x46')](_0x2fee17[_0xa558('0x41')],_0x2fee17['query']);_0x1de590['attributes']=_[_0xa558('0x46')](_0x2fee17[_0xa558('0x41')],qs[_0xa558('0x48')](_0x4701ce['query'][_0xa558('0x48')]));_0x1de590[_0xa558('0x47')]=_0x1de590[_0xa558('0x47')]['length']?_0x1de590[_0xa558('0x47')]:_0x2fee17['model'];_0x1de590[_0xa558('0x4c')]=qs[_0xa558('0x4d')](_0x4701ce[_0xa558('0x43')]['sort']);_0x1de590[_0xa558('0x4e')]=qs[_0xa558('0x45')](_[_0xa558('0x4f')](_0x4701ce['query'],_0x2fee17[_0xa558('0x45')]));if(_0x4701ce[_0xa558('0x43')][_0xa558('0x50')]){_0x1de590[_0xa558('0x4e')]=_[_0xa558('0x51')](_0x1de590['where'],{'$or':_[_0xa558('0x42')](_0x1de590['attributes'],function(_0x38d4d3){var _0x34e286={};_0x34e286[_0x38d4d3]={'$like':'%'+_0x4701ce['query']['filter']+'%'};return _0x34e286;})});}_0x1de590=_[_0xa558('0x51')]({},_0x1de590,_0x4701ce['options']);return _0x510829[_0xa558('0x81')](_0x1de590);}})[_0xa558('0x1f')](function(_0x106b67){if(_0x106b67){_0x3128ca=_0x106b67[_0xa558('0x49')];if(!_0x4701ce[_0xa558('0x43')]['hasOwnProperty'](_0xa558('0x4b'))){_0x1de590[_0xa558('0x2c')]=qs['limit'](_0x4701ce[_0xa558('0x43')][_0xa558('0x2c')]);_0x1de590['offset']=qs[_0xa558('0x2e')](_0x4701ce[_0xa558('0x43')][_0xa558('0x2e')]);}return _0x510829[_0xa558('0x81')](_0x1de590);}})[_0xa558('0x1f')](function(_0x11e7df){if(_0x11e7df){return _0x11e7df?{'count':_0x3128ca,'rows':_0x11e7df}:null;}})[_0xa558('0x1f')](respondWithResult(_0x474b99,null))[_0xa558('0x58')](handleError(_0x474b99,null));};exports[_0xa558('0x82')]=function(_0x5074f9,_0xa13eca,_0x413bc8){var _0x52dca3={'channel':_0xa558('0x83')};var _0x4c8e97=[];var _0x3c0037=[];var _0x1c3d02={};return db[_0xa558('0x3d')]['find']({'where':{'id':_0x5074f9[_0xa558('0x65')]['id']},'include':[{'model':db[_0xa558('0x7d')],'as':_0xa558('0x84')}]})[_0xa558('0x1f')](handleEntityNotFound(_0xa13eca,null))[_0xa558('0x1f')](function(_0x4cb101){_0x52dca3['account']=_0x4cb101;if(_0x52dca3['account']&&_0x52dca3['account']['type']===_0xa558('0x85')&&_0x5074f9[_0xa558('0x5b')][_0xa558('0x86')]){if(_0x5074f9[_0xa558('0x5b')]['statuses']['length']===0x0)return;if(_0x5074f9[_0xa558('0x5b')][_0xa558('0x86')][0x0][_0xa558('0x87')]!==_0xa558('0x88'))return;return db[_0xa558('0x89')]['update']({'read':!![],'readAt':_0x5074f9[_0xa558('0x5b')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x5074f9[_0xa558('0x5b')][_0xa558('0x86')][0x0][_0xa558('0x8a')]},'individualHooks':!![]})[_0xa558('0x1f')](function(_0x46f3c9){return _0xa13eca[_0xa558('0x29')](0xc8)[_0xa558('0x2a')](_0x46f3c9);});}_0x52dca3[_0xa558('0x8b')]=_[_0xa558('0x8c')](_0x4cb101[_0xa558('0x84')],[_0xa558('0x8d')],[_0xa558('0x8e')]);if(_0x52dca3['account'][_0xa558('0x84')]){delete _0x52dca3[_0xa558('0x8f')]['Applications'];}return db[_0xa558('0x90')][_0xa558('0x63')]()[_0xa558('0x1f')](function(_0x1a9b48){if(!_0x1a9b48){throw new db[(_0xa558('0x91'))][(_0xa558('0x92'))](_0xa558('0x93'));}_0x4c8e97=_[_0xa558('0x94')](_[_0xa558('0x44')](_0x1a9b48),['createdAt',_0xa558('0x95')]);_0x3c0037=_[_0xa558('0x94')](_[_0xa558('0x44')](_0x1a9b48),['createdAt',_0xa558('0x95'),_0xa558('0x96'),'ListId']);_0x52dca3[_0xa558('0x5b')]={'mapKey':'mobile'};if(_0x52dca3[_0xa558('0x8f')]&&_0x52dca3[_0xa558('0x8f')][_0xa558('0x3f')]==='twilio'){_0x52dca3[_0xa558('0x5b')][_0xa558('0x97')]=_0x5074f9[_0xa558('0x5b')][_0xa558('0x98')][_0xa558('0x99')](_0xa558('0x9a'),'');_0x52dca3[_0xa558('0x5b')][_0xa558('0x5b')]=_0x5074f9[_0xa558('0x5b')]['Body'];_0x52dca3[_0xa558('0x5b')][_0xa558('0x9b')]=_0x5074f9[_0xa558('0x5b')][_0xa558('0x9c')];}if(_0x52dca3[_0xa558('0x8f')]&&_0x52dca3[_0xa558('0x8f')][_0xa558('0x3f')]===_0xa558('0x85')){_0x52dca3[_0xa558('0x5b')][_0xa558('0x97')]=_0x5074f9[_0xa558('0x5b')][_0xa558('0x9d')][0x0]['from'];_0x52dca3[_0xa558('0x5b')]['body']=_0x5074f9['body']['notifications'][0x0][_0xa558('0x26')][_0xa558('0x5b')];_0x52dca3['body'][_0xa558('0x9b')]=_0x5074f9[_0xa558('0x5b')][_0xa558('0x9d')][0x0][_0xa558('0x8a')];}if(_0x52dca3[_0xa558('0x5b')]['id']){delete _0x52dca3[_0xa558('0x5b')]['id'];}if(_[_0xa558('0x9e')](_0x52dca3[_0xa558('0x5b')][_0xa558('0x97')])){throw new db[(_0xa558('0x91'))][(_0xa558('0x92'))](_0xa558('0x9f'));}if(_[_0xa558('0x9e')](_0x52dca3['body'][_0xa558('0x5b')])||_0x52dca3[_0xa558('0x5b')][_0xa558('0x5b')]===''){throw new db['Sequelize'][(_0xa558('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa558('0x9e')](_0x52dca3[_0xa558('0x5b')][_0xa558('0xa0')])){throw new db[(_0xa558('0x91'))][(_0xa558('0x92'))](_0xa558('0xa1')+_0x3c0037);}if(!_[_0xa558('0xa2')](_0x3c0037,_0x52dca3[_0xa558('0x5b')][_0xa558('0xa0')])){throw new db[(_0xa558('0x91'))][(_0xa558('0x92'))](_0xa558('0xa3')+_0x3c0037);}_0x1c3d02[_0x52dca3[_0xa558('0x5b')][_0xa558('0xa0')]]=_0x52dca3[_0xa558('0x5b')][_0xa558('0x97')];return db['CmList']['find']({'where':{'id':_0x52dca3[_0xa558('0x8f')][_0xa558('0xa4')]},'include':[{'model':db[_0xa558('0x90')],'as':_0xa558('0xa5'),'where':_0x1c3d02,'limit':0x1,'order':[[_0xa558('0x95'),_0xa558('0xa6')]]}]});})[_0xa558('0x1f')](handleEntityNotFound(_0xa13eca,null))[_0xa558('0x1f')](function(_0x51b113){if(_0x51b113){_0x52dca3[_0xa558('0xa7')]=_[_0xa558('0x70')](_0x51b113,[_0xa558('0xa5')]);if(_0x51b113[_0xa558('0xa5')][_0xa558('0x49')]){return _0x51b113[_0xa558('0xa5')][0x0];}var _0x4b0073=_[_0xa558('0x1a')](_0x52dca3[_0xa558('0x5b')],{'firstName':_0x52dca3['body'][_0xa558('0x97')],'ListId':_0x51b113['id']});_0x4b0073[_0x52dca3[_0xa558('0x5b')]['mapKey']]=_0x52dca3[_0xa558('0x5b')][_0xa558('0x97')];return db[_0xa558('0x90')][_0xa558('0x5a')](_0x4b0073,{'fields':_0x4c8e97,'raw':!![]});}})[_0xa558('0x1f')](handleEntityNotFound(_0xa13eca,null))[_0xa558('0x1f')](function(_0x4ed5aa){if(_0x4ed5aa){_0x52dca3['contact']=_0x4ed5aa;var _0x108c0a={'ContactId':_0x4ed5aa['id'],'phone':_0x52dca3[_0xa558('0x5b')][_0xa558('0x97')],'WhatsappAccountId':_0x5074f9[_0xa558('0x65')]['id']};var _0x491bbf={'ContactId':_0x4ed5aa['id'],'WhatsappAccountId':_0x5074f9[_0xa558('0x65')]['id'],'closed':![]};return db[_0xa558('0xa8')]['find']({'where':_0x491bbf})['then'](function(_0x1d57e6){if(_0x1d57e6){return[_0x1d57e6,![]];}return db[_0xa558('0xa8')][_0xa558('0x5a')](_0x108c0a)[_0xa558('0x1f')](function(_0x270a2b){return[_0x270a2b,!![]];});});}})['spread'](function(_0x5ba050,_0x3eda35){_0x52dca3['interaction']=_0x5ba050['get']({'plain':!![]});_0x52dca3[_0xa558('0xa9')][_0xa558('0xaa')]=![];if(_0x3eda35){if(_0x52dca3[_0xa558('0x8f')][_0xa558('0xab')]){_0x52dca3[_0xa558('0x8b')][_0xa558('0xac')]({'id':0x0,'priority':_0x52dca3['applications']['length']+0x1,'app':'close','appdata':_0xa558('0xad'),'interval':_0xa558('0xae')});}_0x52dca3[_0xa558('0xa9')][_0xa558('0xaa')]=!![];}return db['WhatsappMessage'][_0xa558('0x5a')]({'phone':_0x52dca3[_0xa558('0x5b')]['from'],'messageId':_0x52dca3[_0xa558('0x5b')][_0xa558('0x9b')],'body':_0x52dca3[_0xa558('0x5b')][_0xa558('0x5b')],'WhatsappAccountId':_0x5074f9[_0xa558('0x65')]['id'],'WhatsappInteractionId':_0x5ba050['id'],'direction':'in','ContactId':_0x5ba050[_0xa558('0xaf')],'AttachmentId':_0x52dca3[_0xa558('0x5b')]['AttachmentId']});})[_0xa558('0x1f')](function(_0x5cbbf6){_0x52dca3[_0xa558('0x26')]=_0x5cbbf6;if(_0x52dca3[_0xa558('0xa9')][_0xa558('0xb0')]){return db[_0xa558('0x77')][_0xa558('0x59')]({'attributes':['id',_0xa558('0x38')],'where':{'id':_0x52dca3[_0xa558('0xa9')][_0xa558('0xb0')]}})[_0xa558('0x1f')](function(_0x1c9f6c){if(_0x1c9f6c){_0x52dca3[_0xa558('0x8b')][_0xa558('0xb1')]({'id':0x0,'priority':0x0,'app':_0xa558('0xb2'),'appdata':_0x1c9f6c['name']+','+(_0x52dca3[_0xa558('0x8f')][_0xa558('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa558('0xb4'),_0xa558('0xb5'),_0x52dca3);});}return respondWithRpcPromise(_0xa558('0xb4'),_0xa558('0xb5'),_0x52dca3);})[_0xa558('0x1f')](function(_0x596dfe){if(_0x596dfe){var _0x48e423=0xc8;var _0x4143e7=_0xa558('0xb6');logger[_0xa558('0x20')](_0xa558('0xb7'),_0x4143e7,_0x48e423,_0xa558('0xb8'));logger[_0xa558('0x23')](_0xa558('0xb9'),_0x4143e7,_0x48e423,_0xa558('0xb8'),JSON[_0xa558('0x24')](_0x596dfe));if(_0x52dca3['account'][_0xa558('0x3f')]===_0xa558('0xba')){return _0xa13eca[_0xa558('0x29')](_0x48e423)['set'](_0xa558('0xbb'),'text/xml')[_0xa558('0x39')](_0xa558('0xbc'));}else{return _0xa13eca['status'](_0x48e423)[_0xa558('0x2a')](_0x596dfe);}}});})[_0xa558('0x58')](handleError(_0xa13eca,null));};exports[_0xa558('0x39')]=function(_0x54ebc4,_0xd72af7,_0x2907c2){var _0x59ff41,_0x5f0db4,_0x23ddaa;if(_[_0xa558('0x9e')](_0x54ebc4[_0xa558('0x5b')][_0xa558('0x5b')])||_0x54ebc4['body'][_0xa558('0x5b')]===''){throw new db[(_0xa558('0x91'))][(_0xa558('0x92'))](_0xa558('0xbd'));}if(_['isNil'](_0x54ebc4[_0xa558('0x5b')]['to'])){throw new db[(_0xa558('0x91'))]['ValidationError'](_0xa558('0xbe'));}_0x59ff41=_0x54ebc4['body']['to'];return db['WhatsappAccount'][_0xa558('0x59')]({'where':{'id':_0x54ebc4['params']['id']},'include':[{'model':db[_0xa558('0xbf')],'as':_0xa558('0xc0'),'include':[{'model':db[_0xa558('0x90')],'as':_0xa558('0xa5'),'where':{'mobile':_0x59ff41},'limit':0x1,'order':[[_0xa558('0x95'),'DESC']]}]}]})[_0xa558('0x1f')](handleEntityNotFound(_0xd72af7,null))[_0xa558('0x1f')](function(_0x1adc28){if(_0x1adc28&&_0x1adc28[_0xa558('0xc0')]){_0x5f0db4=_0x1adc28[_0xa558('0x35')]({'plain':!![]});if(_0x5f0db4[_0xa558('0xc0')]&&_0x5f0db4[_0xa558('0xc0')][_0xa558('0xa5')][_0xa558('0x49')]){return _0x5f0db4[_0xa558('0xc0')][_0xa558('0xa5')][0x0];}return db[_0xa558('0x90')][_0xa558('0x5a')](_[_0xa558('0x1a')](_0x54ebc4[_0xa558('0x5b')],{'firstName':_0x59ff41,'mobile':_0x59ff41,'phone':_0x59ff41,'ListId':_0x5f0db4[_0xa558('0xa4')]}));}})[_0xa558('0x1f')](handleEntityNotFound(_0xd72af7,null))['then'](function(_0x537254){if(_0x537254){_0x23ddaa=_0x537254;return db[_0xa558('0xa8')][_0xa558('0x59')]({'where':{'ContactId':_0x23ddaa['id'],'closed':![],'WhatsappAccountId':_0x5f0db4['id']}})['then'](function(_0x187c15){if(_0x187c15){return[_0x187c15,![]];}return db[_0xa558('0xa8')]['create']({'UserId':_0x54ebc4['user']['id'],'ContactId':_0x23ddaa['id'],'WhatsappAccountId':_0x5f0db4['id'],'phone':_0x59ff41,'firstMsgDirection':_0xa558('0xc1'),'Messages':[_[_0xa558('0x51')](_0x54ebc4['body'],{'read':![],'body':_0x54ebc4[_0xa558('0x5b')][_0xa558('0x5b')],'phone':_0x59ff41,'WhatsappAccountId':_0x5f0db4['id'],'UserId':_0x54ebc4[_0xa558('0x5c')]['id'],'ContactId':_0x23ddaa['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xa558('0xc2')}]})['then'](function(_0x388970){return[_0x388970,!![]];});});}})['spread'](function(_0x175c28,_0x7adfe2){if(_0x7adfe2){return _0x175c28;}return db[_0xa558('0x89')][_0xa558('0x5a')](_[_0xa558('0x51')](_0x54ebc4['body'],{'read':![],'body':_0x54ebc4[_0xa558('0x5b')][_0xa558('0x5b')],'phone':_0x59ff41,'WhatsappAccountId':_0x5f0db4['id'],'WhatsappInteractionId':_0x175c28['id'],'UserId':_0x54ebc4[_0xa558('0x5c')]['id'],'ContactId':_0x23ddaa['id']}))[_0xa558('0x1f')](function(_0x12e76b){_0x175c28['dataValues'][_0xa558('0xc2')]=[];_0x175c28['dataValues'][_0xa558('0xc2')][_0xa558('0xac')](_0x12e76b[_0xa558('0xc3')]);return _0x175c28;});})[_0xa558('0x1f')](respondWithResult(_0xd72af7,null))[_0xa558('0x58')](handleError(_0xd72af7,null));}; \ No newline at end of file +var _0xec07=['UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','end','offset','undefined','status','set','Content-Range','json','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','describe','Disposition','getDispositions','WhatsappAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority','finally','getApplications','notify','whatsapp','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','WhatsappInteraction','interaction','created','autoclose','unmanaged','ContactId'];(function(_0x4def80,_0x30f984){var _0x31bb70=function(_0x18daea){while(--_0x18daea){_0x4def80['push'](_0x4def80['shift']());}};_0x31bb70(++_0x30f984);}(_0xec07,0xd6));var _0x7ec0=function(_0x47abf7,_0x46b9ab){_0x47abf7=_0x47abf7-0x0;var _0x54b7e8=_0xec07[_0x47abf7];return _0x54b7e8;};'use strict';var emlformat=require(_0x7ec0('0x0'));var rimraf=require(_0x7ec0('0x1'));var zipdir=require(_0x7ec0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ec0('0x3'));var moment=require('moment');var BPromise=require(_0x7ec0('0x4'));var Mustache=require(_0x7ec0('0x5'));var util=require('util');var path=require(_0x7ec0('0x6'));var sox=require(_0x7ec0('0x7'));var csv=require(_0x7ec0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ec0('0x9'));var _=require(_0x7ec0('0xa'));var squel=require('squel');var crypto=require(_0x7ec0('0xb'));var jsforce=require(_0x7ec0('0xc'));var deskjs=require(_0x7ec0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ec0('0xe'));var Papa=require('papaparse');var Redis=require(_0x7ec0('0xf'));var authService=require(_0x7ec0('0x10'));var qs=require(_0x7ec0('0x11'));var as=require(_0x7ec0('0x12'));var hardwareService=require(_0x7ec0('0x13'));var logger=require(_0x7ec0('0x14'))(_0x7ec0('0x15'));var utils=require(_0x7ec0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7ec0('0x17')]=_[_0x7ec0('0x18')](config[_0x7ec0('0x17')],{'host':_0x7ec0('0x19'),'port':0x18eb});var socket=require(_0x7ec0('0x1a'))(new Redis(config[_0x7ec0('0x17')]));require('./whatsappAccount.socket')[_0x7ec0('0x1b')](socket);var jayson=require(_0x7ec0('0x1c'));var client=jayson['client'][_0x7ec0('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x215290,_0x419cd9,_0x5a0e41,_0x3d9ee8){return new BPromise(function(_0x1904bb,_0x4e592d){var _0x359849=_0x3d9ee8||client;return _0x359849[_0x7ec0('0x1e')](_0x215290,_0x5a0e41)[_0x7ec0('0x1f')](function(_0x199fee){logger[_0x7ec0('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x419cd9,'request\x20sent');logger[_0x7ec0('0x21')](_0x7ec0('0x22'),_0x419cd9,_0x7ec0('0x23'),JSON[_0x7ec0('0x24')](_0x199fee));if(_0x199fee[_0x7ec0('0x25')]){if(_0x199fee['error'][_0x7ec0('0x26')]===0x1f4){logger[_0x7ec0('0x25')](_0x7ec0('0x27'),_0x419cd9,_0x199fee[_0x7ec0('0x25')][_0x7ec0('0x28')]);return _0x4e592d(_0x199fee[_0x7ec0('0x25')][_0x7ec0('0x28')]);}logger[_0x7ec0('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x419cd9,_0x199fee[_0x7ec0('0x25')][_0x7ec0('0x28')]);return _0x1904bb(_0x199fee[_0x7ec0('0x25')]['message']);}else{logger[_0x7ec0('0x20')](_0x7ec0('0x27'),_0x419cd9,_0x7ec0('0x23'));_0x1904bb(_0x199fee['result'][_0x7ec0('0x28')]);}})[_0x7ec0('0x29')](function(_0x264867){logger[_0x7ec0('0x25')](_0x7ec0('0x27'),_0x419cd9,_0x264867);_0x4e592d(_0x264867);});});}function respondWithStatusCode(_0x391a83,_0x45ce95){_0x45ce95=_0x45ce95||0xcc;return function(_0x10e655){if(_0x10e655){return _0x391a83[_0x7ec0('0x2a')](_0x45ce95);}return _0x391a83['status'](_0x45ce95)[_0x7ec0('0x2b')]();};}function respondWithResult(_0x53c824,_0x179fe2){_0x179fe2=_0x179fe2||0xc8;return function(_0x43be02){if(_0x43be02){return _0x53c824['status'](_0x179fe2)['json'](_0x43be02);}};}function respondWithFilteredResult(_0x5c0280,_0x21b52a){return function(_0x3a6618){if(_0x3a6618){var _0x173470=typeof _0x21b52a[_0x7ec0('0x2c')]===_0x7ec0('0x2d')&&typeof _0x21b52a['limit']===_0x7ec0('0x2d');var _0x406897=_0x3a6618['count'];var _0x1810de=_0x173470?0x0:_0x21b52a[_0x7ec0('0x2c')];var _0xc7b226=_0x173470?_0x3a6618['count']:_0x21b52a[_0x7ec0('0x2c')]+_0x21b52a['limit'];var _0x163d71;if(_0xc7b226>=_0x406897){_0xc7b226=_0x406897;_0x163d71=0xc8;}else{_0x163d71=0xce;}_0x5c0280[_0x7ec0('0x2e')](_0x163d71);return _0x5c0280[_0x7ec0('0x2f')](_0x7ec0('0x30'),_0x1810de+'-'+_0xc7b226+'/'+_0x406897)[_0x7ec0('0x31')](_0x3a6618);}return null;};}function patchUpdates(_0xa8994a){return function(_0x3be5cc){try{jsonpatch['apply'](_0x3be5cc,_0xa8994a,!![]);}catch(_0x55fa1a){return BPromise[_0x7ec0('0x32')](_0x55fa1a);}return _0x3be5cc[_0x7ec0('0x33')]();};}function saveUpdates(_0x5b9265,_0x3561ef){return function(_0x197e26){if(_0x197e26){return _0x197e26[_0x7ec0('0x34')](_0x5b9265)[_0x7ec0('0x1f')](function(_0x437be5){return _0x437be5;});}return null;};}function removeEntity(_0x37dfea,_0x33dff2){return function(_0x17a191){if(_0x17a191){return _0x17a191[_0x7ec0('0x35')]()[_0x7ec0('0x1f')](function(){var _0x487e04=_0x17a191[_0x7ec0('0x36')]({'plain':!![]});var _0x4c6b7e=_0x7ec0('0x37');return db[_0x7ec0('0x38')][_0x7ec0('0x35')]({'where':{'type':_0x4c6b7e,'resourceId':_0x487e04['id']}})['then'](function(){return _0x17a191;});})[_0x7ec0('0x1f')](function(){_0x37dfea[_0x7ec0('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f4c8,_0x41c208){return function(_0x37cf77){if(!_0x37cf77){_0x41f4c8[_0x7ec0('0x2a')](0x194);}return _0x37cf77;};}function handleError(_0x31dc7c,_0x57cd6b){_0x57cd6b=_0x57cd6b||0x1f4;return function(_0x2d0e75){logger[_0x7ec0('0x25')](_0x2d0e75[_0x7ec0('0x39')]);if(_0x2d0e75[_0x7ec0('0x3a')]){delete _0x2d0e75['name'];}_0x31dc7c['status'](_0x57cd6b)[_0x7ec0('0x3b')](_0x2d0e75);};}exports[_0x7ec0('0x3c')]=function(_0x4b7a08,_0x14be43){var _0x307718={'include':[{'model':db[_0x7ec0('0x3d')],'as':_0x7ec0('0x3e')}]},_0x26c212={},_0x17e6a0={'count':0x0,'rows':[]};var _0x4dbaa9=_['map'](db[_0x7ec0('0x3f')]['rawAttributes'],function(_0x5c5b28){return{'name':_0x5c5b28['fieldName'],'type':_0x5c5b28[_0x7ec0('0x40')][_0x7ec0('0x41')]};});_0x26c212[_0x7ec0('0x42')]=_[_0x7ec0('0x43')](_0x4dbaa9,_0x7ec0('0x3a'));_0x26c212['query']=_['keys'](_0x4b7a08[_0x7ec0('0x44')]);_0x26c212['filters']=_[_0x7ec0('0x45')](_0x26c212['model'],_0x26c212[_0x7ec0('0x44')]);_0x307718[_0x7ec0('0x46')]=_[_0x7ec0('0x45')](_0x26c212['model'],qs[_0x7ec0('0x47')](_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x47')]));_0x307718[_0x7ec0('0x46')]=_0x307718[_0x7ec0('0x46')][_0x7ec0('0x48')]?_0x307718['attributes']:_0x26c212[_0x7ec0('0x42')];if(!_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x49')](_0x7ec0('0x4a'))){_0x307718[_0x7ec0('0x4b')]=qs[_0x7ec0('0x4b')](_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x4b')]);_0x307718[_0x7ec0('0x2c')]=qs['offset'](_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x2c')]);}_0x307718[_0x7ec0('0x4c')]=qs['sort'](_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x4d')]);_0x307718[_0x7ec0('0x4e')]=qs[_0x7ec0('0x4f')](_[_0x7ec0('0x50')](_0x4b7a08['query'],_0x26c212['filters']),_0x4dbaa9);if(_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x51')]){_0x307718[_0x7ec0('0x4e')]=_[_0x7ec0('0x52')](_0x307718[_0x7ec0('0x4e')],{'$or':_[_0x7ec0('0x43')](_0x4dbaa9,function(_0x1a30bc){if(_0x1a30bc[_0x7ec0('0x40')]!==_0x7ec0('0x53')){var _0x2d3f49={};_0x2d3f49[_0x1a30bc[_0x7ec0('0x3a')]]={'$like':'%'+_0x4b7a08[_0x7ec0('0x44')][_0x7ec0('0x51')]+'%'};return _0x2d3f49;}})});}_0x307718=_['merge']({},_0x307718,_0x4b7a08[_0x7ec0('0x54')]);var _0xb2b82f={'where':_0x307718[_0x7ec0('0x4e')]};return db[_0x7ec0('0x3f')][_0x7ec0('0x55')](_0xb2b82f)['then'](function(_0x4b6615){_0x17e6a0[_0x7ec0('0x55')]=_0x4b6615;if(_0x4b7a08['query'][_0x7ec0('0x56')]){_0x307718[_0x7ec0('0x57')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x7ec0('0x58')](_0x307718);})[_0x7ec0('0x1f')](function(_0x5b3f0e){_0x17e6a0['rows']=_0x5b3f0e;return _0x17e6a0;})['then'](respondWithFilteredResult(_0x14be43,_0x307718))['catch'](handleError(_0x14be43,null));};exports[_0x7ec0('0x59')]=function(_0x56f9b5,_0x26e49c){var _0x36dc20={'raw':![],'where':{'id':_0x56f9b5[_0x7ec0('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x7ec0('0x3e')}]},_0x3d5a2d={};_0x3d5a2d[_0x7ec0('0x42')]=_[_0x7ec0('0x5b')](db[_0x7ec0('0x3f')][_0x7ec0('0x5c')]);_0x3d5a2d[_0x7ec0('0x44')]=_[_0x7ec0('0x5b')](_0x56f9b5['query']);_0x3d5a2d[_0x7ec0('0x4f')]=_[_0x7ec0('0x45')](_0x3d5a2d[_0x7ec0('0x42')],_0x3d5a2d[_0x7ec0('0x44')]);_0x36dc20[_0x7ec0('0x46')]=_[_0x7ec0('0x45')](_0x3d5a2d[_0x7ec0('0x42')],qs[_0x7ec0('0x47')](_0x56f9b5['query'][_0x7ec0('0x47')]));_0x36dc20[_0x7ec0('0x46')]=_0x36dc20[_0x7ec0('0x46')]['length']?_0x36dc20[_0x7ec0('0x46')]:_0x3d5a2d['model'];if(_0x56f9b5[_0x7ec0('0x44')][_0x7ec0('0x56')]){_0x36dc20[_0x7ec0('0x57')]=[{'all':!![]}];}_0x36dc20=_['merge']({},_0x36dc20,_0x56f9b5['options']);return db[_0x7ec0('0x3f')][_0x7ec0('0x5d')](_0x36dc20)[_0x7ec0('0x1f')](handleEntityNotFound(_0x26e49c,null))[_0x7ec0('0x1f')](respondWithResult(_0x26e49c,null))[_0x7ec0('0x29')](handleError(_0x26e49c,null));};exports[_0x7ec0('0x5e')]=function(_0x3e9b38,_0x3e60ca){return db[_0x7ec0('0x3f')][_0x7ec0('0x5e')](_0x3e9b38[_0x7ec0('0x5f')],{})[_0x7ec0('0x1f')](function(_0x321e5a){var _0x12b8f8=_0x3e9b38[_0x7ec0('0x60')][_0x7ec0('0x36')]({'plain':!![]});if(!_0x12b8f8)throw new Error(_0x7ec0('0x61'));if(_0x12b8f8['role']===_0x7ec0('0x60')){var _0x3b3dd2=_0x321e5a[_0x7ec0('0x36')]({'plain':!![]});var _0x55ab61='WhatsappAccounts';return db[_0x7ec0('0x62')][_0x7ec0('0x5d')]({'where':{'name':_0x55ab61,'userProfileId':_0x12b8f8['userProfileId']},'raw':!![]})[_0x7ec0('0x1f')](function(_0x57023c){if(_0x57023c&&_0x57023c[_0x7ec0('0x63')]===0x0){return db['UserProfileResource'][_0x7ec0('0x5e')]({'name':_0x3b3dd2['name'],'resourceId':_0x3b3dd2['id'],'type':_0x57023c[_0x7ec0('0x3a')],'sectionId':_0x57023c['id']},{})[_0x7ec0('0x1f')](function(){return _0x321e5a;});}else{return _0x321e5a;}})[_0x7ec0('0x29')](function(_0x52eb86){logger[_0x7ec0('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52eb86);throw _0x52eb86;});}return _0x321e5a;})[_0x7ec0('0x1f')](respondWithResult(_0x3e60ca,0xc9))[_0x7ec0('0x29')](handleError(_0x3e60ca,null));};exports[_0x7ec0('0x34')]=function(_0x512143,_0x516d22){if(_0x512143[_0x7ec0('0x5f')]['id']){delete _0x512143[_0x7ec0('0x5f')]['id'];}return db[_0x7ec0('0x3f')][_0x7ec0('0x5d')]({'where':{'id':_0x512143[_0x7ec0('0x5a')]['id']},'include':[{'model':db[_0x7ec0('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x7ec0('0x1f')](handleEntityNotFound(_0x516d22,null))[_0x7ec0('0x1f')](saveUpdates(_0x512143[_0x7ec0('0x5f')],null))[_0x7ec0('0x1f')](respondWithResult(_0x516d22,null))[_0x7ec0('0x29')](handleError(_0x516d22,null));};exports['destroy']=function(_0x372620,_0x291133){return db[_0x7ec0('0x3f')]['find']({'where':{'id':_0x372620[_0x7ec0('0x5a')]['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x291133,null))[_0x7ec0('0x1f')](removeEntity(_0x291133,null))[_0x7ec0('0x29')](handleError(_0x291133,null));};exports[_0x7ec0('0x64')]=function(_0x5d640b,_0x83d87e){return db['WhatsappAccount'][_0x7ec0('0x64')]()[_0x7ec0('0x1f')](respondWithResult(_0x83d87e,null))['catch'](handleError(_0x83d87e,null));};exports['addDisposition']=function(_0x3e9213,_0x2e7ae1,_0x55ac8a){if(_0x3e9213[_0x7ec0('0x5f')]['id']){delete _0x3e9213[_0x7ec0('0x5f')]['id'];}return db[_0x7ec0('0x3f')][_0x7ec0('0x5d')]({'where':{'id':_0x3e9213[_0x7ec0('0x5a')]['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x2e7ae1,null))['then'](function(_0x4a28d6){if(_0x4a28d6){_0x3e9213[_0x7ec0('0x5f')]['WhatsappAccountId']=_0x4a28d6['id'];return db[_0x7ec0('0x65')][_0x7ec0('0x5e')](_0x3e9213[_0x7ec0('0x5f')]);}})[_0x7ec0('0x1f')](respondWithResult(_0x2e7ae1,null))[_0x7ec0('0x29')](handleError(_0x2e7ae1,null));};exports[_0x7ec0('0x66')]=function(_0x399685,_0x3e76e4,_0x3056f9){var _0x5ee5f4={'raw':![],'where':{}};var _0x239821={};var _0x28a37d={'count':0x0,'rows':[]};return db[_0x7ec0('0x3f')]['findOne']({'where':{'id':_0x399685['params']['id']}})['then'](handleEntityNotFound(_0x3e76e4,null))[_0x7ec0('0x1f')](function(_0x2d00ab){if(_0x2d00ab){_0x239821[_0x7ec0('0x42')]=_[_0x7ec0('0x5b')](db[_0x7ec0('0x65')][_0x7ec0('0x5c')]);_0x239821[_0x7ec0('0x44')]=_[_0x7ec0('0x5b')](_0x399685[_0x7ec0('0x44')]);_0x239821['filters']=_[_0x7ec0('0x45')](_0x239821[_0x7ec0('0x42')],_0x239821[_0x7ec0('0x44')]);_0x5ee5f4[_0x7ec0('0x46')]=_['intersection'](_0x239821[_0x7ec0('0x42')],qs[_0x7ec0('0x47')](_0x399685['query']['fields']));_0x5ee5f4[_0x7ec0('0x46')]=_0x5ee5f4['attributes']['length']?_0x5ee5f4[_0x7ec0('0x46')]:_0x239821['model'];if(!_0x399685[_0x7ec0('0x44')][_0x7ec0('0x49')](_0x7ec0('0x4a'))){_0x5ee5f4[_0x7ec0('0x4b')]=qs['limit'](_0x399685[_0x7ec0('0x44')]['limit']);_0x5ee5f4['offset']=qs['offset'](_0x399685[_0x7ec0('0x44')][_0x7ec0('0x2c')]);}_0x5ee5f4[_0x7ec0('0x4c')]=qs['sort'](_0x399685[_0x7ec0('0x44')][_0x7ec0('0x4d')]);_0x5ee5f4[_0x7ec0('0x4e')]=qs[_0x7ec0('0x4f')](_[_0x7ec0('0x50')](_0x399685[_0x7ec0('0x44')],_0x239821[_0x7ec0('0x4f')]));_0x5ee5f4[_0x7ec0('0x4e')][_0x7ec0('0x67')]=_0x2d00ab['id'];if(_0x399685[_0x7ec0('0x44')]['filter']){_0x5ee5f4[_0x7ec0('0x4e')]=_[_0x7ec0('0x52')](_0x5ee5f4[_0x7ec0('0x4e')],{'$or':_[_0x7ec0('0x43')](_0x5ee5f4['attributes'],function(_0x26f6cb){var _0x5cb5fc={};_0x5cb5fc[_0x26f6cb]={'$like':'%'+_0x399685[_0x7ec0('0x44')][_0x7ec0('0x51')]+'%'};return _0x5cb5fc;})});}_0x5ee5f4=_[_0x7ec0('0x52')]({},_0x5ee5f4,_0x399685[_0x7ec0('0x54')]);return db[_0x7ec0('0x65')][_0x7ec0('0x55')]({'where':_0x5ee5f4['where']})[_0x7ec0('0x1f')](function(_0x5b862c){_0x28a37d[_0x7ec0('0x55')]=_0x5b862c;if(_0x399685[_0x7ec0('0x44')]['includeAll']){_0x5ee5f4[_0x7ec0('0x57')]=[{'all':!![]}];}return db[_0x7ec0('0x65')][_0x7ec0('0x58')](_0x5ee5f4);})[_0x7ec0('0x1f')](function(_0x2432ff){_0x28a37d[_0x7ec0('0x68')]=_0x2432ff;return _0x28a37d;});}})[_0x7ec0('0x1f')](respondWithFilteredResult(_0x3e76e4,_0x5ee5f4))[_0x7ec0('0x29')](handleError(_0x3e76e4,null));};exports['removeDispositions']=function(_0x4b500b,_0x10b000,_0x193ebf){return db[_0x7ec0('0x3f')][_0x7ec0('0x5d')]({'where':{'id':_0x4b500b[_0x7ec0('0x5a')]['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x10b000,null))['then'](function(_0x2c5303){if(_0x2c5303){return _0x2c5303[_0x7ec0('0x69')](_0x4b500b[_0x7ec0('0x44')][_0x7ec0('0x6a')]);}})[_0x7ec0('0x1f')](respondWithStatusCode(_0x10b000,null))[_0x7ec0('0x29')](handleError(_0x10b000,null));};exports[_0x7ec0('0x6b')]=function(_0x342f13,_0x486920,_0x106055){if(_0x342f13[_0x7ec0('0x5f')]['id']){delete _0x342f13[_0x7ec0('0x5f')]['id'];}return db[_0x7ec0('0x3f')][_0x7ec0('0x5d')]({'where':{'id':_0x342f13[_0x7ec0('0x5a')]['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x486920,null))[_0x7ec0('0x1f')](function(_0x117626){if(_0x117626){_0x342f13[_0x7ec0('0x5f')]['WhatsappAccountId']=_0x117626['id'];return db[_0x7ec0('0x6c')][_0x7ec0('0x5e')](_0x342f13[_0x7ec0('0x5f')]);}})[_0x7ec0('0x1f')](respondWithResult(_0x486920,null))[_0x7ec0('0x29')](handleError(_0x486920,null));};exports['getAnswers']=function(_0x29033a,_0x2375ae,_0x230a9f){var _0x4d5964={'raw':![],'where':{}};var _0x360eb4={};var _0x24fba6={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7ec0('0x6d')]({'where':{'id':_0x29033a[_0x7ec0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2375ae,null))[_0x7ec0('0x1f')](function(_0x51393d){if(_0x51393d){_0x360eb4['model']=_[_0x7ec0('0x5b')](db[_0x7ec0('0x6c')][_0x7ec0('0x5c')]);_0x360eb4[_0x7ec0('0x44')]=_[_0x7ec0('0x5b')](_0x29033a[_0x7ec0('0x44')]);_0x360eb4['filters']=_[_0x7ec0('0x45')](_0x360eb4[_0x7ec0('0x42')],_0x360eb4[_0x7ec0('0x44')]);_0x4d5964[_0x7ec0('0x46')]=_[_0x7ec0('0x45')](_0x360eb4[_0x7ec0('0x42')],qs['fields'](_0x29033a[_0x7ec0('0x44')][_0x7ec0('0x47')]));_0x4d5964['attributes']=_0x4d5964['attributes'][_0x7ec0('0x48')]?_0x4d5964['attributes']:_0x360eb4[_0x7ec0('0x42')];if(!_0x29033a[_0x7ec0('0x44')][_0x7ec0('0x49')](_0x7ec0('0x4a'))){_0x4d5964[_0x7ec0('0x4b')]=qs[_0x7ec0('0x4b')](_0x29033a[_0x7ec0('0x44')][_0x7ec0('0x4b')]);_0x4d5964[_0x7ec0('0x2c')]=qs['offset'](_0x29033a[_0x7ec0('0x44')]['offset']);}_0x4d5964[_0x7ec0('0x4c')]=qs[_0x7ec0('0x4d')](_0x29033a[_0x7ec0('0x44')][_0x7ec0('0x4d')]);_0x4d5964['where']=qs[_0x7ec0('0x4f')](_['pick'](_0x29033a[_0x7ec0('0x44')],_0x360eb4['filters']));_0x4d5964['where'][_0x7ec0('0x67')]=_0x51393d['id'];if(_0x29033a[_0x7ec0('0x44')]['filter']){_0x4d5964[_0x7ec0('0x4e')]=_[_0x7ec0('0x52')](_0x4d5964[_0x7ec0('0x4e')],{'$or':_[_0x7ec0('0x43')](_0x4d5964[_0x7ec0('0x46')],function(_0x508b7e){var _0x2ece5e={};_0x2ece5e[_0x508b7e]={'$like':'%'+_0x29033a[_0x7ec0('0x44')][_0x7ec0('0x51')]+'%'};return _0x2ece5e;})});}_0x4d5964=_[_0x7ec0('0x52')]({},_0x4d5964,_0x29033a[_0x7ec0('0x54')]);return db[_0x7ec0('0x6c')][_0x7ec0('0x55')]({'where':_0x4d5964['where']})['then'](function(_0x194830){_0x24fba6[_0x7ec0('0x55')]=_0x194830;if(_0x29033a[_0x7ec0('0x44')][_0x7ec0('0x56')]){_0x4d5964[_0x7ec0('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7ec0('0x58')](_0x4d5964);})[_0x7ec0('0x1f')](function(_0x4db340){_0x24fba6[_0x7ec0('0x68')]=_0x4db340;return _0x24fba6;});}})[_0x7ec0('0x1f')](respondWithFilteredResult(_0x2375ae,_0x4d5964))[_0x7ec0('0x29')](handleError(_0x2375ae,null));};exports['removeAnswers']=function(_0x4a22c8,_0x5244d5,_0x36faa8){return db['WhatsappAccount'][_0x7ec0('0x5d')]({'where':{'id':_0x4a22c8[_0x7ec0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5244d5,null))['then'](function(_0x7946e0){if(_0x7946e0){return _0x7946e0['removeAnswers'](_0x4a22c8['query'][_0x7ec0('0x6a')]);}})[_0x7ec0('0x1f')](respondWithStatusCode(_0x5244d5,null))[_0x7ec0('0x29')](handleError(_0x5244d5,null));};exports[_0x7ec0('0x6e')]=function(_0x3c8039,_0x7f4279,_0x34aa3b){return db[_0x7ec0('0x3f')]['find']({'where':{'id':_0x3c8039[_0x7ec0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x7f4279,null))[_0x7ec0('0x1f')](function(_0x11c29c){if(_0x11c29c){return _0x11c29c[_0x7ec0('0x6e')](_0x3c8039[_0x7ec0('0x5f')][_0x7ec0('0x6a')],_[_0x7ec0('0x6f')](_0x3c8039[_0x7ec0('0x5f')],['ids','id'])||{})[_0x7ec0('0x70')](function(_0x299969){for(var _0x4f7aa8=0x0;_0x4f7aa8<_0x3c8039[_0x7ec0('0x5f')][_0x7ec0('0x6a')]['length'];_0x4f7aa8+=0x1){socket[_0x7ec0('0x71')](_0x7ec0('0x72'),{'UserId':Number(_0x3c8039[_0x7ec0('0x5f')][_0x7ec0('0x6a')][_0x4f7aa8]),'WhatsappAccountId':Number(_0x3c8039['params']['id'])});}return _0x299969;});}})[_0x7ec0('0x1f')](respondWithResult(_0x7f4279,null))[_0x7ec0('0x29')](handleError(_0x7f4279,null));};exports[_0x7ec0('0x73')]=function(_0x2aa354,_0x171e49,_0x83582b){return db['WhatsappAccount']['find']({'where':{'id':_0x2aa354['params']['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x171e49,null))[_0x7ec0('0x1f')](function(_0x4a8aea){if(_0x4a8aea){return _0x4a8aea[_0x7ec0('0x73')](_0x2aa354['query'][_0x7ec0('0x6a')])[_0x7ec0('0x1f')](function(){if(_[_0x7ec0('0x74')](_0x2aa354[_0x7ec0('0x44')][_0x7ec0('0x6a')])){for(var _0x12efb8=0x0;_0x12efb8<_0x2aa354[_0x7ec0('0x44')]['ids'][_0x7ec0('0x48')];_0x12efb8+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x2aa354[_0x7ec0('0x44')][_0x7ec0('0x6a')][_0x12efb8]),'WhatsappAccountId':Number(_0x2aa354[_0x7ec0('0x5a')]['id'])});}}else{socket[_0x7ec0('0x71')](_0x7ec0('0x75'),{'UserId':Number(_0x2aa354[_0x7ec0('0x44')]['ids']),'WhatsappAccountId':Number(_0x2aa354['params']['id'])});}});}})[_0x7ec0('0x1f')](respondWithStatusCode(_0x171e49,null))[_0x7ec0('0x29')](handleError(_0x171e49,null));};exports[_0x7ec0('0x76')]=function(_0x12d07e,_0x42ce1f,_0x3440d0){var _0x28aab4={};var _0x3abaf7={};var _0x4b180f;var _0xf49614;return db['WhatsappAccount'][_0x7ec0('0x6d')]({'where':{'id':_0x12d07e[_0x7ec0('0x5a')]['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x42ce1f,null))['then'](function(_0x416322){if(_0x416322){_0x4b180f=_0x416322;_0x3abaf7[_0x7ec0('0x42')]=_['keys'](db['User']['rawAttributes']);_0x3abaf7['query']=_[_0x7ec0('0x5b')](_0x12d07e['query']);_0x3abaf7['filters']=_[_0x7ec0('0x45')](_0x3abaf7['model'],_0x3abaf7[_0x7ec0('0x44')]);_0x28aab4[_0x7ec0('0x46')]=_[_0x7ec0('0x45')](_0x3abaf7['model'],qs[_0x7ec0('0x47')](_0x12d07e['query'][_0x7ec0('0x47')]));_0x28aab4[_0x7ec0('0x46')]=_0x28aab4[_0x7ec0('0x46')][_0x7ec0('0x48')]?_0x28aab4[_0x7ec0('0x46')]:_0x3abaf7[_0x7ec0('0x42')];_0x28aab4[_0x7ec0('0x4c')]=qs[_0x7ec0('0x4d')](_0x12d07e[_0x7ec0('0x44')][_0x7ec0('0x4d')]);_0x28aab4[_0x7ec0('0x4e')]=qs[_0x7ec0('0x4f')](_[_0x7ec0('0x50')](_0x12d07e[_0x7ec0('0x44')],_0x3abaf7['filters']));if(_0x12d07e['query'][_0x7ec0('0x51')]){_0x28aab4[_0x7ec0('0x4e')]=_[_0x7ec0('0x52')](_0x28aab4[_0x7ec0('0x4e')],{'$or':_[_0x7ec0('0x43')](_0x28aab4[_0x7ec0('0x46')],function(_0x188655){var _0x327320={};_0x327320[_0x188655]={'$like':'%'+_0x12d07e[_0x7ec0('0x44')]['filter']+'%'};return _0x327320;})});}_0x28aab4=_[_0x7ec0('0x52')]({},_0x28aab4,_0x12d07e[_0x7ec0('0x54')]);return _0x4b180f['getAgents'](_0x28aab4);}})['then'](function(_0x5e3360){if(_0x5e3360){_0xf49614=_0x5e3360[_0x7ec0('0x48')];if(!_0x12d07e[_0x7ec0('0x44')][_0x7ec0('0x49')](_0x7ec0('0x4a'))){_0x28aab4[_0x7ec0('0x4b')]=qs[_0x7ec0('0x4b')](_0x12d07e[_0x7ec0('0x44')][_0x7ec0('0x4b')]);_0x28aab4[_0x7ec0('0x2c')]=qs[_0x7ec0('0x2c')](_0x12d07e[_0x7ec0('0x44')][_0x7ec0('0x2c')]);}return _0x4b180f['getAgents'](_0x28aab4);}})[_0x7ec0('0x1f')](function(_0x3a72ef){if(_0x3a72ef){return _0x3a72ef?{'count':_0xf49614,'rows':_0x3a72ef}:null;}})['then'](respondWithResult(_0x42ce1f,null))['catch'](handleError(_0x42ce1f,null));};exports[_0x7ec0('0x77')]=function(_0xa3c32b,_0x189f0f){var _0x371583=_0xa3c32b[_0x7ec0('0x5a')]['id'];var _0xbf56c3=_0xa3c32b[_0x7ec0('0x5f')];var _0x1f2f69=0xc8;var _0x2a6fb9=null;return db['sequelize'][_0x7ec0('0x78')]({'isolationLevel':db[_0x7ec0('0x79')][_0x7ec0('0x7a')][_0x7ec0('0x7b')][_0x7ec0('0x7c')]},function(_0x3421fd){return db[_0x7ec0('0x3f')][_0x7ec0('0x6d')]({'where':{'id':_0x371583},'transaction':_0x3421fd})['then'](function(_0x51c666){if(_0x51c666){return db[_0x7ec0('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x371583},'transaction':_0x3421fd})[_0x7ec0('0x1f')](function(){var _0x41d08d=_['map'](_0xbf56c3,function(_0x3d1c55){_0x3d1c55['WhatsappAccountId']=_0x371583;return _0x3d1c55;});return db['WhatsappApplication']['bulkCreate'](_0x41d08d,{'transaction':_0x3421fd});});}else{_0x1f2f69=0x194;_0x2a6fb9=[];}});})[_0x7ec0('0x1f')](function(){if(_0x1f2f69!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x371583},'order':_0x7ec0('0x7e')})[_0x7ec0('0x1f')](function(_0x14a7c6){_0x2a6fb9=_0x14a7c6;});}})['catch'](function(_0x56f190){_0x1f2f69=0x1f4;logger[_0x7ec0('0x25')](_0x56f190[_0x7ec0('0x39')]);if(_0x56f190[_0x7ec0('0x3a')]){delete _0x56f190['name'];}_0x2a6fb9=_0x56f190;})[_0x7ec0('0x7f')](function(){if(_0x2a6fb9===null){_0x189f0f['sendStatus'](_0x1f2f69);}else{if(_0x1f2f69===0x1f4){_0x189f0f['status'](_0x1f2f69)['send'](_0x2a6fb9);}else{_0x189f0f[_0x7ec0('0x2e')](_0x1f2f69)[_0x7ec0('0x31')](_0x2a6fb9);}}});};exports[_0x7ec0('0x80')]=function(_0x5d429f,_0xe6a566,_0x759e0a){var _0x55e59e={};var _0x8bc4ef={};var _0x7f6926;var _0x39274a;return db['WhatsappAccount'][_0x7ec0('0x6d')]({'where':{'id':_0x5d429f[_0x7ec0('0x5a')]['id']}})[_0x7ec0('0x1f')](handleEntityNotFound(_0xe6a566,null))[_0x7ec0('0x1f')](function(_0x31f917){if(_0x31f917){_0x7f6926=_0x31f917;_0x8bc4ef[_0x7ec0('0x42')]=_[_0x7ec0('0x5b')](db[_0x7ec0('0x7d')]['rawAttributes']);_0x8bc4ef['query']=_[_0x7ec0('0x5b')](_0x5d429f[_0x7ec0('0x44')]);_0x8bc4ef['filters']=_[_0x7ec0('0x45')](_0x8bc4ef[_0x7ec0('0x42')],_0x8bc4ef[_0x7ec0('0x44')]);_0x55e59e[_0x7ec0('0x46')]=_['intersection'](_0x8bc4ef[_0x7ec0('0x42')],qs['fields'](_0x5d429f['query'][_0x7ec0('0x47')]));_0x55e59e[_0x7ec0('0x46')]=_0x55e59e[_0x7ec0('0x46')]['length']?_0x55e59e[_0x7ec0('0x46')]:_0x8bc4ef['model'];_0x55e59e[_0x7ec0('0x4c')]=qs[_0x7ec0('0x4d')](_0x5d429f['query'][_0x7ec0('0x4d')]);_0x55e59e[_0x7ec0('0x4e')]=qs[_0x7ec0('0x4f')](_[_0x7ec0('0x50')](_0x5d429f[_0x7ec0('0x44')],_0x8bc4ef[_0x7ec0('0x4f')]));if(_0x5d429f[_0x7ec0('0x44')][_0x7ec0('0x51')]){_0x55e59e[_0x7ec0('0x4e')]=_[_0x7ec0('0x52')](_0x55e59e[_0x7ec0('0x4e')],{'$or':_[_0x7ec0('0x43')](_0x55e59e[_0x7ec0('0x46')],function(_0x3be5ac){var _0xc340d2={};_0xc340d2[_0x3be5ac]={'$like':'%'+_0x5d429f['query'][_0x7ec0('0x51')]+'%'};return _0xc340d2;})});}_0x55e59e=_[_0x7ec0('0x52')]({},_0x55e59e,_0x5d429f[_0x7ec0('0x54')]);return _0x7f6926[_0x7ec0('0x80')](_0x55e59e);}})[_0x7ec0('0x1f')](function(_0x46fadb){if(_0x46fadb){_0x39274a=_0x46fadb[_0x7ec0('0x48')];if(!_0x5d429f[_0x7ec0('0x44')][_0x7ec0('0x49')](_0x7ec0('0x4a'))){_0x55e59e[_0x7ec0('0x4b')]=qs['limit'](_0x5d429f[_0x7ec0('0x44')][_0x7ec0('0x4b')]);_0x55e59e['offset']=qs['offset'](_0x5d429f[_0x7ec0('0x44')][_0x7ec0('0x2c')]);}return _0x7f6926['getApplications'](_0x55e59e);}})[_0x7ec0('0x1f')](function(_0x57c79e){if(_0x57c79e){return _0x57c79e?{'count':_0x39274a,'rows':_0x57c79e}:null;}})[_0x7ec0('0x1f')](respondWithResult(_0xe6a566,null))[_0x7ec0('0x29')](handleError(_0xe6a566,null));};exports[_0x7ec0('0x81')]=function(_0x78b02,_0x27497f,_0x3b30f5){var _0x42d688={'channel':_0x7ec0('0x82')};var _0x2218ab=[];var _0x14a316=[];var _0x4c7304={};return db[_0x7ec0('0x3f')][_0x7ec0('0x5d')]({'where':{'id':_0x78b02[_0x7ec0('0x5a')]['id']},'include':[{'model':db[_0x7ec0('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x27497f,null))[_0x7ec0('0x1f')](function(_0x45a462){_0x42d688['account']=_0x45a462;if(_0x42d688['account']&&_0x42d688[_0x7ec0('0x83')][_0x7ec0('0x40')]==='sinch'&&_0x78b02[_0x7ec0('0x5f')][_0x7ec0('0x84')]){if(_0x78b02[_0x7ec0('0x5f')][_0x7ec0('0x84')]['length']===0x0)return;if(_0x78b02['body'][_0x7ec0('0x84')][0x0][_0x7ec0('0x85')]!==_0x7ec0('0x86'))return;return db[_0x7ec0('0x87')]['update']({'read':!![],'readAt':_0x78b02['body'][_0x7ec0('0x84')][0x0][_0x7ec0('0x88')]},{'where':{'messageId':_0x78b02['body'][_0x7ec0('0x84')][0x0][_0x7ec0('0x89')]},'individualHooks':!![]})['then'](function(_0x4ca8ed){return _0x27497f[_0x7ec0('0x2e')](0xc8)['json'](_0x4ca8ed);});}_0x42d688[_0x7ec0('0x8a')]=_[_0x7ec0('0x8b')](_0x45a462[_0x7ec0('0x8c')],[_0x7ec0('0x7e')],[_0x7ec0('0x8d')]);if(_0x42d688[_0x7ec0('0x83')]['Applications']){delete _0x42d688[_0x7ec0('0x83')]['Applications'];}return db[_0x7ec0('0x8e')][_0x7ec0('0x64')]()[_0x7ec0('0x1f')](function(_0x5ccb77){if(!_0x5ccb77){throw new db[(_0x7ec0('0x8f'))][(_0x7ec0('0x90'))]('no\x20available\x20attributes');}_0x2218ab=_[_0x7ec0('0x91')](_[_0x7ec0('0x5b')](_0x5ccb77),[_0x7ec0('0x92'),_0x7ec0('0x93')]);_0x14a316=_[_0x7ec0('0x91')](_['keys'](_0x5ccb77),[_0x7ec0('0x92'),_0x7ec0('0x93'),_0x7ec0('0x94'),_0x7ec0('0x95')]);_0x42d688[_0x7ec0('0x5f')]={'mapKey':'mobile'};if(_0x42d688[_0x7ec0('0x83')]&&_0x42d688[_0x7ec0('0x83')]['type']===_0x7ec0('0x96')){_0x42d688['body'][_0x7ec0('0x97')]=_0x78b02[_0x7ec0('0x5f')][_0x7ec0('0x98')][_0x7ec0('0x99')](_0x7ec0('0x9a'),'');_0x42d688[_0x7ec0('0x5f')]['body']=_0x78b02[_0x7ec0('0x5f')][_0x7ec0('0x9b')];_0x42d688[_0x7ec0('0x5f')]['messageId']=_0x78b02[_0x7ec0('0x5f')][_0x7ec0('0x9c')];}if(_0x42d688['account']&&_0x42d688[_0x7ec0('0x83')]['type']===_0x7ec0('0x9d')){_0x42d688[_0x7ec0('0x5f')]['from']=_0x78b02['body'][_0x7ec0('0x9e')][0x0][_0x7ec0('0x97')];_0x42d688[_0x7ec0('0x5f')]['body']=_0x78b02[_0x7ec0('0x5f')][_0x7ec0('0x9e')][0x0][_0x7ec0('0x28')][_0x7ec0('0x5f')];_0x42d688['body'][_0x7ec0('0x9f')]=_0x78b02[_0x7ec0('0x5f')]['notifications'][0x0][_0x7ec0('0x89')];}if(_0x42d688[_0x7ec0('0x5f')]['id']){delete _0x42d688['body']['id'];}if(_['isNil'](_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x97')])){throw new db[(_0x7ec0('0x8f'))][(_0x7ec0('0x90'))](_0x7ec0('0xa0'));}if(_[_0x7ec0('0xa1')](_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x5f')])||_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x5f')]===''){throw new db[(_0x7ec0('0x8f'))][(_0x7ec0('0x90'))](_0x7ec0('0xa2'));}if(_[_0x7ec0('0xa1')](_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0xa3')])){throw new db['Sequelize'][(_0x7ec0('0x90'))](_0x7ec0('0xa4')+_0x14a316);}if(!_[_0x7ec0('0xa5')](_0x14a316,_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0xa3')])){throw new db[(_0x7ec0('0x8f'))][(_0x7ec0('0x90'))](_0x7ec0('0xa6')+_0x14a316);}_0x4c7304[_0x42d688['body'][_0x7ec0('0xa3')]]=_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x97')];return db[_0x7ec0('0xa7')][_0x7ec0('0x5d')]({'where':{'id':_0x42d688[_0x7ec0('0x83')][_0x7ec0('0x95')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4c7304,'limit':0x1,'order':[[_0x7ec0('0x93'),'DESC']]}]});})['then'](handleEntityNotFound(_0x27497f,null))[_0x7ec0('0x1f')](function(_0x495e85){if(_0x495e85){_0x42d688[_0x7ec0('0xa8')]=_['omit'](_0x495e85,['Contacts']);if(_0x495e85[_0x7ec0('0xa9')][_0x7ec0('0x48')]){return _0x495e85[_0x7ec0('0xa9')][0x0];}var _0x277a81=_[_0x7ec0('0x18')](_0x42d688[_0x7ec0('0x5f')],{'firstName':_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x97')],'ListId':_0x495e85['id']});_0x277a81[_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0xa3')]]=_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x97')];return db[_0x7ec0('0x8e')]['create'](_0x277a81,{'fields':_0x2218ab,'raw':!![]});}})['then'](handleEntityNotFound(_0x27497f,null))['then'](function(_0x2078a6){if(_0x2078a6){_0x42d688['contact']=_0x2078a6;var _0x35a307={'ContactId':_0x2078a6['id'],'phone':_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x97')],'WhatsappAccountId':_0x78b02[_0x7ec0('0x5a')]['id']};var _0x425215={'ContactId':_0x2078a6['id'],'WhatsappAccountId':_0x78b02[_0x7ec0('0x5a')]['id'],'closed':![]};return db[_0x7ec0('0xaa')][_0x7ec0('0x5d')]({'where':_0x425215})[_0x7ec0('0x1f')](function(_0x14d595){if(_0x14d595){return[_0x14d595,![]];}return db['WhatsappInteraction'][_0x7ec0('0x5e')](_0x35a307)[_0x7ec0('0x1f')](function(_0x21ee84){return[_0x21ee84,!![]];});});}})['spread'](function(_0x34ac6c,_0x238c07){_0x42d688[_0x7ec0('0xab')]=_0x34ac6c[_0x7ec0('0x36')]({'plain':!![]});_0x42d688[_0x7ec0('0xab')][_0x7ec0('0xac')]=![];if(_0x238c07){if(_0x42d688[_0x7ec0('0x83')][_0x7ec0('0xad')]){_0x42d688[_0x7ec0('0x8a')]['push']({'id':0x0,'priority':_0x42d688[_0x7ec0('0x8a')][_0x7ec0('0x48')]+0x1,'app':'close','appdata':_0x7ec0('0xae'),'interval':'*,*,*,*'});}_0x42d688[_0x7ec0('0xab')][_0x7ec0('0xac')]=!![];}return db[_0x7ec0('0x87')]['create']({'phone':_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x97')],'messageId':_0x42d688[_0x7ec0('0x5f')][_0x7ec0('0x9f')],'body':_0x42d688['body'][_0x7ec0('0x5f')],'WhatsappAccountId':_0x78b02['params']['id'],'WhatsappInteractionId':_0x34ac6c['id'],'direction':'in','ContactId':_0x34ac6c[_0x7ec0('0xaf')],'AttachmentId':_0x42d688[_0x7ec0('0x5f')]['AttachmentId']});})[_0x7ec0('0x1f')](function(_0x209325){_0x42d688[_0x7ec0('0x28')]=_0x209325;if(_0x42d688[_0x7ec0('0xab')][_0x7ec0('0xb0')]){return db[_0x7ec0('0xb1')][_0x7ec0('0x5d')]({'attributes':['id','name'],'where':{'id':_0x42d688['interaction'][_0x7ec0('0xb0')]}})['then'](function(_0x5911c0){if(_0x5911c0){_0x42d688[_0x7ec0('0x8a')][_0x7ec0('0xb2')]({'id':0x0,'priority':0x0,'app':_0x7ec0('0xb3'),'appdata':_0x5911c0[_0x7ec0('0x3a')]+','+(_0x42d688['account'][_0x7ec0('0xb4')]||0xa),'interval':_0x7ec0('0xb5')});}return respondWithRpcPromise(_0x7ec0('0xb6'),_0x7ec0('0xb7'),_0x42d688);});}return respondWithRpcPromise(_0x7ec0('0xb6'),_0x7ec0('0xb7'),_0x42d688);})[_0x7ec0('0x1f')](function(_0xb4d16a){if(_0xb4d16a){var _0x13eabe=0xc8;var _0x1df521='receiveMessage';logger[_0x7ec0('0x20')](_0x7ec0('0x22'),_0x1df521,_0x13eabe,'entity\x20found');logger[_0x7ec0('0x21')](_0x7ec0('0xb8'),_0x1df521,_0x13eabe,_0x7ec0('0xb9'),JSON[_0x7ec0('0x24')](_0xb4d16a));if(_0x42d688[_0x7ec0('0x83')][_0x7ec0('0x40')]===_0x7ec0('0x96')){return _0x27497f[_0x7ec0('0x2e')](_0x13eabe)[_0x7ec0('0x2f')]('Content-Type',_0x7ec0('0xba'))['send'](_0x7ec0('0xbb'));}else{return _0x27497f[_0x7ec0('0x2e')](_0x13eabe)[_0x7ec0('0x31')](_0xb4d16a);}}});})[_0x7ec0('0x29')](handleError(_0x27497f,null));};exports['send']=function(_0x5a0e81,_0x19af34,_0x22b23d){var _0x58a956,_0x592f75,_0x4c5d04;if(_[_0x7ec0('0xa1')](_0x5a0e81[_0x7ec0('0x5f')][_0x7ec0('0x5f')])||_0x5a0e81[_0x7ec0('0x5f')]['body']===''){throw new db[(_0x7ec0('0x8f'))][(_0x7ec0('0x90'))](_0x7ec0('0xa2'));}if(_[_0x7ec0('0xa1')](_0x5a0e81[_0x7ec0('0x5f')]['to'])){throw new db['Sequelize'][(_0x7ec0('0x90'))](_0x7ec0('0xbc'));}_0x58a956=_0x5a0e81['body']['to'];return db[_0x7ec0('0x3f')]['find']({'where':{'id':_0x5a0e81['params']['id']},'include':[{'model':db[_0x7ec0('0xa7')],'as':_0x7ec0('0xbd'),'include':[{'model':db[_0x7ec0('0x8e')],'as':'Contacts','where':{'mobile':_0x58a956},'limit':0x1,'order':[[_0x7ec0('0x93'),_0x7ec0('0xbe')]]}]}]})[_0x7ec0('0x1f')](handleEntityNotFound(_0x19af34,null))[_0x7ec0('0x1f')](function(_0xd5c9ef){if(_0xd5c9ef&&_0xd5c9ef[_0x7ec0('0xbd')]){_0x592f75=_0xd5c9ef[_0x7ec0('0x36')]({'plain':!![]});if(_0x592f75[_0x7ec0('0xbd')]&&_0x592f75[_0x7ec0('0xbd')]['Contacts'][_0x7ec0('0x48')]){return _0x592f75['List'][_0x7ec0('0xa9')][0x0];}return db[_0x7ec0('0x8e')][_0x7ec0('0x5e')](_[_0x7ec0('0x18')](_0x5a0e81['body'],{'firstName':_0x58a956,'mobile':_0x58a956,'phone':_0x58a956,'ListId':_0x592f75['ListId']}));}})[_0x7ec0('0x1f')](handleEntityNotFound(_0x19af34,null))[_0x7ec0('0x1f')](function(_0x1a72e4){if(_0x1a72e4){_0x4c5d04=_0x1a72e4;return db[_0x7ec0('0xaa')][_0x7ec0('0x5d')]({'where':{'ContactId':_0x4c5d04['id'],'closed':![],'WhatsappAccountId':_0x592f75['id']}})[_0x7ec0('0x1f')](function(_0x2b96a9){if(_0x2b96a9){return[_0x2b96a9,![]];}return db['WhatsappInteraction'][_0x7ec0('0x5e')]({'UserId':_0x5a0e81[_0x7ec0('0x60')]['id'],'ContactId':_0x4c5d04['id'],'WhatsappAccountId':_0x592f75['id'],'phone':_0x58a956,'firstMsgDirection':_0x7ec0('0xbf'),'Messages':[_[_0x7ec0('0x52')](_0x5a0e81[_0x7ec0('0x5f')],{'read':![],'body':_0x5a0e81[_0x7ec0('0x5f')][_0x7ec0('0x5f')],'phone':_0x58a956,'WhatsappAccountId':_0x592f75['id'],'UserId':_0x5a0e81[_0x7ec0('0x60')]['id'],'ContactId':_0x4c5d04['id']})]},{'include':[{'model':db[_0x7ec0('0x87')],'as':_0x7ec0('0xc0')}]})[_0x7ec0('0x1f')](function(_0x2a8cd1){return[_0x2a8cd1,!![]];});});}})[_0x7ec0('0x70')](function(_0x21bdcd,_0x395999){if(_0x395999){return _0x21bdcd;}return db[_0x7ec0('0x87')][_0x7ec0('0x5e')](_[_0x7ec0('0x52')](_0x5a0e81[_0x7ec0('0x5f')],{'read':![],'body':_0x5a0e81[_0x7ec0('0x5f')]['body'],'phone':_0x58a956,'WhatsappAccountId':_0x592f75['id'],'WhatsappInteractionId':_0x21bdcd['id'],'UserId':_0x5a0e81['user']['id'],'ContactId':_0x4c5d04['id']}))[_0x7ec0('0x1f')](function(_0x4809cc){_0x21bdcd[_0x7ec0('0xc1')][_0x7ec0('0xc0')]=[];_0x21bdcd[_0x7ec0('0xc1')][_0x7ec0('0xc0')][_0x7ec0('0xc2')](_0x4809cc[_0x7ec0('0xc1')]);return _0x21bdcd;});})[_0x7ec0('0x1f')](respondWithResult(_0x19af34,null))[_0x7ec0('0x29')](handleError(_0x19af34,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d884102..3df8707 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 _0x83cd=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83cd,0x183));var _0xd83c=function(_0x594440,_0x24731c){_0x594440=_0x594440-0x0;var _0x5e4209=_0x83cd[_0x594440];return _0x5e4209;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xd83c('0x0'))['db'][_0xd83c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd83c('0x2')](0x0);var events={'afterCreate':_0xd83c('0x3'),'afterUpdate':_0xd83c('0x4'),'afterDestroy':_0xd83c('0x5')};function emitEvent(_0x409e42){return function(_0x8cf22e,_0x2b4d23,_0x1148ed){WhatsappAccountEvents[_0xd83c('0x6')](_0x409e42+':'+_0x8cf22e['id'],_0x8cf22e);WhatsappAccountEvents[_0xd83c('0x6')](_0x409e42,_0x8cf22e);_0x1148ed(null);};}for(var e in events){if(events[_0xd83c('0x7')](e)){var event=events[e];WhatsappAccount[_0xd83c('0x8')](e,emitEvent(event));}}module[_0xd83c('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5ed4=['emit','hasOwnProperty','hook','exports','events','WhatsappAccount','save','update','remove'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0x5ed4,0x190));var _0x45ed=function(_0x4bf0ae,_0x52d91f){_0x4bf0ae=_0x4bf0ae-0x0;var _0x28c86f=_0x5ed4[_0x4bf0ae];return _0x28c86f;};'use strict';var EventEmitter=require(_0x45ed('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x45ed('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x45ed('0x2'),'afterUpdate':_0x45ed('0x3'),'afterDestroy':_0x45ed('0x4')};function emitEvent(_0x522e9a){return function(_0x137aaf,_0x4d6397,_0x4b1c2f){WhatsappAccountEvents[_0x45ed('0x5')](_0x522e9a+':'+_0x137aaf['id'],_0x137aaf);WhatsappAccountEvents[_0x45ed('0x5')](_0x522e9a,_0x137aaf);_0x4b1c2f(null);};}for(var e in events){if(events[_0x45ed('0x6')](e)){var event=events[e];WhatsappAccount[_0x45ed('0x7')](e,emitEvent(event));}}module[_0x45ed('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 36fb3b5..376b39a 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 _0x3c1c=['exports','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0xb89eab,_0x905eba){var _0x1706ba=function(_0x411ad4){while(--_0x411ad4){_0xb89eab['push'](_0xb89eab['shift']());}};_0x1706ba(++_0x905eba);}(_0x3c1c,0xad));var _0xc3c1=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x3c1c[_0x3cae69];return _0x3128eb;};'use strict';var _=require('lodash');var util=require(_0xc3c1('0x0'));var logger=require(_0xc3c1('0x1'))(_0xc3c1('0x2'));var moment=require(_0xc3c1('0x3'));var BPromise=require(_0xc3c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3c1('0x5'));var rimraf=require(_0xc3c1('0x6'));var config=require(_0xc3c1('0x7'));var attributes=require(_0xc3c1('0x8'));module[_0xc3c1('0x9')]=function(_0xffae98,_0x4e0e69){return _0xffae98[_0xc3c1('0xa')](_0xc3c1('0xb'),attributes,{'tableName':_0xc3c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9605=['../../config/environment','./whatsappAccount.attributes','exports','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2dc7df,_0x21a1ad){var _0x5bc185=function(_0x4604ae){while(--_0x4604ae){_0x2dc7df['push'](_0x2dc7df['shift']());}};_0x5bc185(++_0x21a1ad);}(_0x9605,0x12f));var _0x5960=function(_0x2ff0e7,_0x4b5589){_0x2ff0e7=_0x2ff0e7-0x0;var _0x5b186a=_0x9605[_0x2ff0e7];return _0x5b186a;};'use strict';var _=require('lodash');var util=require(_0x5960('0x0'));var logger=require(_0x5960('0x1'))(_0x5960('0x2'));var moment=require(_0x5960('0x3'));var BPromise=require('bluebird');var rp=require(_0x5960('0x4'));var fs=require('fs');var path=require(_0x5960('0x5'));var rimraf=require(_0x5960('0x6'));var config=require(_0x5960('0x7'));var attributes=require(_0x5960('0x8'));module[_0x5960('0x9')]=function(_0x16e04d,_0x31bacf){return _0x16e04d['define']('WhatsappAccount',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 2911c76..eb9c0a1 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 _0xd125=['lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','error','code','message','result','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','stringify'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd125,0x176));var _0x5d12=function(_0x75af2,_0x542033){_0x75af2=_0x75af2-0x0;var _0x3858cd=_0xd125[_0x75af2];return _0x3858cd;};'use strict';var _=require(_0x5d12('0x0'));var util=require(_0x5d12('0x1'));var moment=require('moment');var BPromise=require(_0x5d12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5d12('0x3'));var logger=require(_0x5d12('0x4'))(_0x5d12('0x5'));var config=require('../../config/environment');var jayson=require(_0x5d12('0x6'));var client=jayson[_0x5d12('0x7')][_0x5d12('0x8')]({'port':0x232a});config[_0x5d12('0x9')]=_[_0x5d12('0xa')](config['redis'],{'host':_0x5d12('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d12('0x9')]));require(_0x5d12('0xc'))[_0x5d12('0xd')](socket);function respondWithRpcPromise(_0x427059,_0x22d25b,_0x27c089){return new BPromise(function(_0x5bc536,_0x4beda4){return client['request'](_0x427059,_0x27c089)[_0x5d12('0xe')](function(_0x1bcb13){logger[_0x5d12('0xf')](_0x5d12('0x10'),_0x22d25b,'request\x20sent');logger[_0x5d12('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x22d25b,'request\x20sent',JSON['stringify'](_0x1bcb13));if(_0x1bcb13['error']){if(_0x1bcb13[_0x5d12('0x12')][_0x5d12('0x13')]===0x1f4){logger[_0x5d12('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x22d25b,_0x1bcb13[_0x5d12('0x12')][_0x5d12('0x14')]);return _0x4beda4(_0x1bcb13['error'][_0x5d12('0x14')]);}logger[_0x5d12('0x12')](_0x5d12('0x10'),_0x22d25b,_0x1bcb13[_0x5d12('0x12')][_0x5d12('0x14')]);return _0x5bc536(_0x1bcb13[_0x5d12('0x12')][_0x5d12('0x14')]);}else{logger[_0x5d12('0xf')](_0x5d12('0x10'),_0x22d25b,'request\x20sent');_0x5bc536(_0x1bcb13[_0x5d12('0x15')][_0x5d12('0x14')]);}})[_0x5d12('0x16')](function(_0x19590d){logger[_0x5d12('0x12')](_0x5d12('0x10'),_0x22d25b,_0x19590d);_0x4beda4(_0x19590d);});});}exports['ShowWhatsappAccount']=function(_0x2ec368){var _0x2b2a7d=this;return new Promise(function(_0x1d3658,_0x1d3e33){return db[_0x5d12('0x17')][_0x5d12('0x18')]({'raw':_0x2ec368['options']?_0x2ec368[_0x5d12('0x19')][_0x5d12('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ec368[_0x5d12('0x19')]?_0x2ec368[_0x5d12('0x19')][_0x5d12('0x1b')]||null:null,'attributes':_0x2ec368['options']?_0x2ec368[_0x5d12('0x19')][_0x5d12('0x1c')]||null:null,'include':_0x2ec368[_0x5d12('0x19')]?_0x2ec368['options'][_0x5d12('0x1d')]?_[_0x5d12('0x1e')](_0x2ec368['options']['include'],function(_0x18b4e6){return{'model':db[_0x18b4e6[_0x5d12('0x1f')]],'as':_0x18b4e6['as'],'attributes':_0x18b4e6[_0x5d12('0x1c')],'include':_0x18b4e6['include']?_[_0x5d12('0x1e')](_0x18b4e6[_0x5d12('0x1d')],function(_0x1018d3){return{'model':db[_0x1018d3['model']],'as':_0x1018d3['as'],'attributes':_0x1018d3[_0x5d12('0x1c')],'include':_0x1018d3[_0x5d12('0x1d')]?_[_0x5d12('0x1e')](_0x1018d3[_0x5d12('0x1d')],function(_0x97fbc2){return{'model':db[_0x97fbc2[_0x5d12('0x1f')]],'as':_0x97fbc2['as'],'attributes':_0x97fbc2[_0x5d12('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5d12('0xe')](function(_0xed0097){logger['info'](_0x5d12('0x20'),_0x2ec368);logger[_0x5d12('0x11')](_0x5d12('0x20'),_0x2ec368,JSON[_0x5d12('0x21')](_0xed0097));_0x1d3658(_0xed0097);})[_0x5d12('0x16')](function(_0x107eb7){logger[_0x5d12('0x12')]('ShowWhatsappAccount',_0x107eb7['message'],_0x2ec368);_0x1d3e33(_0x2b2a7d[_0x5d12('0x12')](0x1f4,_0x107eb7[_0x5d12('0x14')]));});});}; \ No newline at end of file +var _0x2e98=['message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s'];(function(_0x47dfdc,_0x15d78){var _0x4e99f9=function(_0x2cc0bd){while(--_0x2cc0bd){_0x47dfdc['push'](_0x47dfdc['shift']());}};_0x4e99f9(++_0x15d78);}(_0x2e98,0x110));var _0x82e9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2e98[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x82e9('0x0'));var util=require(_0x82e9('0x1'));var moment=require(_0x82e9('0x2'));var BPromise=require(_0x82e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82e9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82e9('0x5'))(_0x82e9('0x6'));var config=require(_0x82e9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x82e9('0x8')]({'port':0x232a});config[_0x82e9('0x9')]=_[_0x82e9('0xa')](config[_0x82e9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x82e9('0xb'))(new Redis(config['redis']));require(_0x82e9('0xc'))[_0x82e9('0xd')](socket);function respondWithRpcPromise(_0x3239fe,_0x3724a5,_0x2242f4){return new BPromise(function(_0x2ece60,_0x379829){return client[_0x82e9('0xe')](_0x3239fe,_0x2242f4)[_0x82e9('0xf')](function(_0x465e1c){logger[_0x82e9('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3724a5,_0x82e9('0x11'));logger[_0x82e9('0x12')](_0x82e9('0x13'),_0x3724a5,_0x82e9('0x11'),JSON[_0x82e9('0x14')](_0x465e1c));if(_0x465e1c[_0x82e9('0x15')]){if(_0x465e1c['error'][_0x82e9('0x16')]===0x1f4){logger[_0x82e9('0x15')](_0x82e9('0x17'),_0x3724a5,_0x465e1c['error']['message']);return _0x379829(_0x465e1c[_0x82e9('0x15')]['message']);}logger[_0x82e9('0x15')](_0x82e9('0x17'),_0x3724a5,_0x465e1c[_0x82e9('0x15')][_0x82e9('0x18')]);return _0x2ece60(_0x465e1c['error'][_0x82e9('0x18')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3724a5,_0x82e9('0x11'));_0x2ece60(_0x465e1c[_0x82e9('0x19')]['message']);}})[_0x82e9('0x1a')](function(_0x51f85a){logger[_0x82e9('0x15')](_0x82e9('0x17'),_0x3724a5,_0x51f85a);_0x379829(_0x51f85a);});});}exports[_0x82e9('0x1b')]=function(_0x4de7e5){var _0x522b19=this;return new Promise(function(_0x4a6fbc,_0x4efa9e){return db[_0x82e9('0x1c')][_0x82e9('0x1d')]({'raw':_0x4de7e5['options']?_0x4de7e5[_0x82e9('0x1e')][_0x82e9('0x1f')]===undefined?!![]:![]:!![],'where':_0x4de7e5[_0x82e9('0x1e')]?_0x4de7e5[_0x82e9('0x1e')][_0x82e9('0x20')]||null:null,'attributes':_0x4de7e5[_0x82e9('0x1e')]?_0x4de7e5['options'][_0x82e9('0x21')]||null:null,'include':_0x4de7e5['options']?_0x4de7e5[_0x82e9('0x1e')][_0x82e9('0x22')]?_[_0x82e9('0x23')](_0x4de7e5[_0x82e9('0x1e')][_0x82e9('0x22')],function(_0x3d6e50){return{'model':db[_0x3d6e50[_0x82e9('0x24')]],'as':_0x3d6e50['as'],'attributes':_0x3d6e50['attributes'],'include':_0x3d6e50[_0x82e9('0x22')]?_['map'](_0x3d6e50[_0x82e9('0x22')],function(_0x44036f){return{'model':db[_0x44036f[_0x82e9('0x24')]],'as':_0x44036f['as'],'attributes':_0x44036f[_0x82e9('0x21')],'include':_0x44036f['include']?_[_0x82e9('0x23')](_0x44036f[_0x82e9('0x22')],function(_0x584bfa){return{'model':db[_0x584bfa[_0x82e9('0x24')]],'as':_0x584bfa['as'],'attributes':_0x584bfa[_0x82e9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x82e9('0xf')](function(_0x2e8fc4){logger['info'](_0x82e9('0x1b'),_0x4de7e5);logger[_0x82e9('0x12')](_0x82e9('0x1b'),_0x4de7e5,JSON[_0x82e9('0x14')](_0x2e8fc4));_0x4a6fbc(_0x2e8fc4);})[_0x82e9('0x1a')](function(_0x1e61a4){logger[_0x82e9('0x15')](_0x82e9('0x1b'),_0x1e61a4[_0x82e9('0x18')],_0x4de7e5);_0x4efa9e(_0x522b19['error'](0x1f4,_0x1e61a4[_0x82e9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e4b5a98..965a1e7 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 _0x47e6=['save','remove','update','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x2dd7a9,_0x442223){var _0x194020=function(_0x2b31d1){while(--_0x2b31d1){_0x2dd7a9['push'](_0x2dd7a9['shift']());}};_0x194020(++_0x442223);}(_0x47e6,0x77));var _0x647e=function(_0x3c26b3,_0x23af33){_0x3c26b3=_0x3c26b3-0x0;var _0x64b5a0=_0x47e6[_0x3c26b3];return _0x64b5a0;};'use strict';var WhatsappAccountEvents=require(_0x647e('0x0'));var events=[_0x647e('0x1'),_0x647e('0x2'),_0x647e('0x3')];function createListener(_0x2dd56e,_0xb70911){return function(_0x4c78e7){_0xb70911['emit'](_0x2dd56e,_0x4c78e7);};}function removeListener(_0x4f87bb,_0x1554b1){return function(){WhatsappAccountEvents['removeListener'](_0x4f87bb,_0x1554b1);};}exports[_0x647e('0x4')]=function(_0x5d6a6b){for(var _0x16056a=0x0,_0x218b3d=events['length'];_0x16056a<_0x218b3d;_0x16056a++){var _0x35931d=events[_0x16056a];var _0x459688=createListener(_0x647e('0x5')+_0x35931d,_0x5d6a6b);WhatsappAccountEvents['on'](_0x35931d,_0x459688);}}; \ No newline at end of file +var _0x5647=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','emit'];(function(_0x854c84,_0x3edd0e){var _0xad7eab=function(_0x301f88){while(--_0x301f88){_0x854c84['push'](_0x854c84['shift']());}};_0xad7eab(++_0x3edd0e);}(_0x5647,0x100));var _0x7564=function(_0xafeb27,_0x4177d6){_0xafeb27=_0xafeb27-0x0;var _0x4686b=_0x5647[_0xafeb27];return _0x4686b;};'use strict';var WhatsappAccountEvents=require(_0x7564('0x0'));var events=[_0x7564('0x1'),'remove','update'];function createListener(_0x296ff9,_0x4bfb0b){return function(_0x76b4bc){_0x4bfb0b[_0x7564('0x2')](_0x296ff9,_0x76b4bc);};}function removeListener(_0x222cb8,_0x30394f){return function(){WhatsappAccountEvents[_0x7564('0x3')](_0x222cb8,_0x30394f);};}exports[_0x7564('0x4')]=function(_0x22c3bf){for(var _0x52ada6=0x0,_0x1d5492=events[_0x7564('0x5')];_0x52ada6<_0x1d5492;_0x52ada6++){var _0x29c033=events[_0x52ada6];var _0x3234b6=createListener(_0x7564('0x6')+_0x29c033,_0x22c3bf);WhatsappAccountEvents['on'](_0x29c033,_0x3234b6);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 229b14a..bc3b822 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 _0x3c93=['/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2e89b8,_0x4213a9){var _0x405721=function(_0x214447){while(--_0x214447){_0x2e89b8['push'](_0x2e89b8['shift']());}};_0x405721(++_0x4213a9);}(_0x3c93,0x14c));var _0x33c9=function(_0x261f23,_0x28a2de){_0x261f23=_0x261f23-0x0;var _0xa99760=_0x3c93[_0x261f23];return _0xa99760;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x33c9('0x0'));var timeout=require(_0x33c9('0x1'));var express=require(_0x33c9('0x2'));var router=express[_0x33c9('0x3')]();var fs_extra=require(_0x33c9('0x4'));var auth=require(_0x33c9('0x5'));var interaction=require(_0x33c9('0x6'));var config=require(_0x33c9('0x7'));var controller=require('./whatsappApplication.controller');router[_0x33c9('0x8')]('/',auth[_0x33c9('0x9')](),controller['index']);router[_0x33c9('0x8')](_0x33c9('0xa'),auth['isAuthenticated'](),controller[_0x33c9('0xb')]);router[_0x33c9('0xc')]('/',auth[_0x33c9('0x9')](),controller[_0x33c9('0xd')]);router['put']('/:id',auth[_0x33c9('0x9')](),controller[_0x33c9('0xe')]);router[_0x33c9('0xf')]('/:id',auth[_0x33c9('0x9')](),controller[_0x33c9('0x10')]);module[_0x33c9('0x11')]=router; \ No newline at end of file +var _0xf4e7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','post','create','put','delete','exports','util','path'];(function(_0x528db,_0x31f893){var _0x5365aa=function(_0x485e5a){while(--_0x485e5a){_0x528db['push'](_0x528db['shift']());}};_0x5365aa(++_0x31f893);}(_0xf4e7,0x1d2));var _0x7f4e=function(_0x2577f7,_0x4e4781){_0x2577f7=_0x2577f7-0x0;var _0x55d372=_0xf4e7[_0x2577f7];return _0x55d372;};'use strict';var multer=require('multer');var util=require(_0x7f4e('0x0'));var path=require(_0x7f4e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7f4e('0x2'));var router=express[_0x7f4e('0x3')]();var fs_extra=require(_0x7f4e('0x4'));var auth=require(_0x7f4e('0x5'));var interaction=require(_0x7f4e('0x6'));var config=require(_0x7f4e('0x7'));var controller=require(_0x7f4e('0x8'));router[_0x7f4e('0x9')]('/',auth['isAuthenticated'](),controller[_0x7f4e('0xa')]);router[_0x7f4e('0x9')](_0x7f4e('0xb'),auth[_0x7f4e('0xc')](),controller['show']);router[_0x7f4e('0xd')]('/',auth['isAuthenticated'](),controller[_0x7f4e('0xe')]);router[_0x7f4e('0xf')](_0x7f4e('0xb'),auth[_0x7f4e('0xc')](),controller['update']);router[_0x7f4e('0x10')](_0x7f4e('0xb'),auth[_0x7f4e('0xc')](),controller['destroy']);module[_0x7f4e('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index c0451ac..4627348 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 _0x6797=['exports','INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x4255f0,_0x27d022){var _0x324bf9=function(_0xcdb49e){while(--_0xcdb49e){_0x4255f0['push'](_0x4255f0['shift']());}};_0x324bf9(++_0x27d022);}(_0x6797,0x1bb));var _0x7679=function(_0x37d0c0,_0x5094f4){_0x37d0c0=_0x37d0c0-0x0;var _0x4f85f4=_0x6797[_0x37d0c0];return _0x4f85f4;};'use strict';var Sequelize=require(_0x7679('0x0'));module[_0x7679('0x1')]={'priority':{'type':Sequelize[_0x7679('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7679('0x3')]()},'description':{'type':Sequelize[_0x7679('0x4')]},'interval':{'type':Sequelize[_0x7679('0x4')],'defaultValue':_0x7679('0x5')}}; \ No newline at end of file +var _0x456c=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3d4793,_0x37a97f){var _0x4a88cb=function(_0x4f9a29){while(--_0x4f9a29){_0x3d4793['push'](_0x3d4793['shift']());}};_0x4a88cb(++_0x37a97f);}(_0x456c,0x17a));var _0xc456=function(_0x3b407d,_0x19cbdb){_0x3b407d=_0x3b407d-0x0;var _0x1fec09=_0x456c[_0x3b407d];return _0x1fec09;};'use strict';var Sequelize=require(_0xc456('0x0'));module[_0xc456('0x1')]={'priority':{'type':Sequelize[_0xc456('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc456('0x3')],'allowNull':![],'defaultValue':_0xc456('0x4')},'appdata':{'type':Sequelize[_0xc456('0x5')]()},'description':{'type':Sequelize[_0xc456('0x3')]},'interval':{'type':Sequelize[_0xc456('0x3')],'defaultValue':_0xc456('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9b44f1a..346fca4 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 _0x65cb=['findAll','rows','show','params','fields','includeAll','catch','create','body','find','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','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','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','options','WhatsappApplication','include'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x65cb,0xa4));var _0xb65c=function(_0x28ee25,_0x1e93c6){_0x28ee25=_0x28ee25-0x0;var _0x4df86c=_0x65cb[_0x28ee25];return _0x4df86c;};'use strict';var emlformat=require(_0xb65c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb65c('0x1'));var jsonpatch=require(_0xb65c('0x2'));var rp=require(_0xb65c('0x3'));var moment=require('moment');var BPromise=require(_0xb65c('0x4'));var Mustache=require(_0xb65c('0x5'));var util=require(_0xb65c('0x6'));var path=require(_0xb65c('0x7'));var sox=require(_0xb65c('0x8'));var csv=require('to-csv');var ejs=require(_0xb65c('0x9'));var fs=require('fs');var fs_extra=require(_0xb65c('0xa'));var _=require(_0xb65c('0xb'));var squel=require(_0xb65c('0xc'));var crypto=require(_0xb65c('0xd'));var jsforce=require(_0xb65c('0xe'));var deskjs=require(_0xb65c('0xf'));var toCsv=require(_0xb65c('0x10'));var querystring=require('querystring');var Papa=require(_0xb65c('0x11'));var Redis=require(_0xb65c('0x12'));var authService=require(_0xb65c('0x13'));var qs=require(_0xb65c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb65c('0x15'));var logger=require('../../config/logger')(_0xb65c('0x16'));var utils=require(_0xb65c('0x17'));var config=require(_0xb65c('0x18'));var licenseUtil=require(_0xb65c('0x19'));var db=require(_0xb65c('0x1a'))['db'];function respondWithStatusCode(_0xbab2df,_0x4eb271){_0x4eb271=_0x4eb271||0xcc;return function(_0x340e60){if(_0x340e60){return _0xbab2df[_0xb65c('0x1b')](_0x4eb271);}return _0xbab2df[_0xb65c('0x1c')](_0x4eb271)[_0xb65c('0x1d')]();};}function respondWithResult(_0x3f1e8b,_0x11ebca){_0x11ebca=_0x11ebca||0xc8;return function(_0x2821e2){if(_0x2821e2){return _0x3f1e8b['status'](_0x11ebca)[_0xb65c('0x1e')](_0x2821e2);}};}function respondWithFilteredResult(_0x22eb85,_0x5a4354){return function(_0x288314){if(_0x288314){var _0x5c6d66=typeof _0x5a4354[_0xb65c('0x1f')]===_0xb65c('0x20')&&typeof _0x5a4354[_0xb65c('0x21')]===_0xb65c('0x20');var _0x24c1e2=_0x288314[_0xb65c('0x22')];var _0x1bca9d=_0x5c6d66?0x0:_0x5a4354[_0xb65c('0x1f')];var _0x199b13=_0x5c6d66?_0x288314[_0xb65c('0x22')]:_0x5a4354[_0xb65c('0x1f')]+_0x5a4354[_0xb65c('0x21')];var _0x2fe603;if(_0x199b13>=_0x24c1e2){_0x199b13=_0x24c1e2;_0x2fe603=0xc8;}else{_0x2fe603=0xce;}_0x22eb85[_0xb65c('0x1c')](_0x2fe603);return _0x22eb85[_0xb65c('0x23')]('Content-Range',_0x1bca9d+'-'+_0x199b13+'/'+_0x24c1e2)[_0xb65c('0x1e')](_0x288314);}return null;};}function patchUpdates(_0x2733c6){return function(_0x45b7e9){try{jsonpatch[_0xb65c('0x24')](_0x45b7e9,_0x2733c6,!![]);}catch(_0x37b944){return BPromise[_0xb65c('0x25')](_0x37b944);}return _0x45b7e9[_0xb65c('0x26')]();};}function saveUpdates(_0x2727cc,_0x248364){return function(_0x33fa4c){if(_0x33fa4c){return _0x33fa4c[_0xb65c('0x27')](_0x2727cc)[_0xb65c('0x28')](function(_0xd04d5){return _0xd04d5;});}return null;};}function removeEntity(_0x33961d,_0xe16c8f){return function(_0x5ed03){if(_0x5ed03){return _0x5ed03[_0xb65c('0x29')]()['then'](function(){_0x33961d[_0xb65c('0x1c')](0xcc)[_0xb65c('0x1d')]();});}};}function handleEntityNotFound(_0x29c0c0,_0x585f93){return function(_0x1b7e00){if(!_0x1b7e00){_0x29c0c0[_0xb65c('0x1b')](0x194);}return _0x1b7e00;};}function handleError(_0x49035e,_0x5a34c7){_0x5a34c7=_0x5a34c7||0x1f4;return function(_0x4033bd){logger[_0xb65c('0x2a')](_0x4033bd[_0xb65c('0x2b')]);if(_0x4033bd[_0xb65c('0x2c')]){delete _0x4033bd['name'];}_0x49035e[_0xb65c('0x1c')](_0x5a34c7)[_0xb65c('0x2d')](_0x4033bd);};}exports[_0xb65c('0x2e')]=function(_0x21cb9c,_0x1ffc77){var _0x11b562={},_0x5158d9={},_0x2e06df={'count':0x0,'rows':[]};var _0x2c83aa=_[_0xb65c('0x2f')](db['WhatsappApplication'][_0xb65c('0x30')],function(_0x5f5ca7){return{'name':_0x5f5ca7[_0xb65c('0x31')],'type':_0x5f5ca7[_0xb65c('0x32')]['key']};});_0x5158d9[_0xb65c('0x33')]=_[_0xb65c('0x2f')](_0x2c83aa,_0xb65c('0x2c'));_0x5158d9[_0xb65c('0x34')]=_[_0xb65c('0x35')](_0x21cb9c[_0xb65c('0x34')]);_0x5158d9[_0xb65c('0x36')]=_[_0xb65c('0x37')](_0x5158d9['model'],_0x5158d9[_0xb65c('0x34')]);_0x11b562[_0xb65c('0x38')]=_[_0xb65c('0x37')](_0x5158d9['model'],qs['fields'](_0x21cb9c[_0xb65c('0x34')]['fields']));_0x11b562[_0xb65c('0x38')]=_0x11b562['attributes'][_0xb65c('0x39')]?_0x11b562[_0xb65c('0x38')]:_0x5158d9[_0xb65c('0x33')];if(!_0x21cb9c[_0xb65c('0x34')]['hasOwnProperty'](_0xb65c('0x3a'))){_0x11b562['limit']=qs[_0xb65c('0x21')](_0x21cb9c['query'][_0xb65c('0x21')]);_0x11b562[_0xb65c('0x1f')]=qs[_0xb65c('0x1f')](_0x21cb9c[_0xb65c('0x34')]['offset']);}_0x11b562[_0xb65c('0x3b')]=qs[_0xb65c('0x3c')](_0x21cb9c[_0xb65c('0x34')]['sort']);_0x11b562[_0xb65c('0x3d')]=qs[_0xb65c('0x36')](_['pick'](_0x21cb9c['query'],_0x5158d9[_0xb65c('0x36')]),_0x2c83aa);if(_0x21cb9c[_0xb65c('0x34')][_0xb65c('0x3e')]){_0x11b562[_0xb65c('0x3d')]=_['merge'](_0x11b562[_0xb65c('0x3d')],{'$or':_[_0xb65c('0x2f')](_0x2c83aa,function(_0x2f3125){if(_0x2f3125[_0xb65c('0x32')]!=='VIRTUAL'){var _0x12c685={};_0x12c685[_0x2f3125[_0xb65c('0x2c')]]={'$like':'%'+_0x21cb9c[_0xb65c('0x34')][_0xb65c('0x3e')]+'%'};return _0x12c685;}})});}_0x11b562=_[_0xb65c('0x3f')]({},_0x11b562,_0x21cb9c[_0xb65c('0x40')]);var _0x2c11ae={'where':_0x11b562[_0xb65c('0x3d')]};return db[_0xb65c('0x41')][_0xb65c('0x22')](_0x2c11ae)[_0xb65c('0x28')](function(_0x16c859){_0x2e06df[_0xb65c('0x22')]=_0x16c859;if(_0x21cb9c['query']['includeAll']){_0x11b562[_0xb65c('0x42')]=[{'all':!![]}];}return db[_0xb65c('0x41')][_0xb65c('0x43')](_0x11b562);})['then'](function(_0x42acd6){_0x2e06df[_0xb65c('0x44')]=_0x42acd6;return _0x2e06df;})['then'](respondWithFilteredResult(_0x1ffc77,_0x11b562))['catch'](handleError(_0x1ffc77,null));};exports[_0xb65c('0x45')]=function(_0x18a4da,_0x150ffb){var _0x215e62={'raw':!![],'where':{'id':_0x18a4da[_0xb65c('0x46')]['id']}},_0x199625={};_0x199625['model']=_[_0xb65c('0x35')](db[_0xb65c('0x41')][_0xb65c('0x30')]);_0x199625[_0xb65c('0x34')]=_[_0xb65c('0x35')](_0x18a4da[_0xb65c('0x34')]);_0x199625['filters']=_[_0xb65c('0x37')](_0x199625[_0xb65c('0x33')],_0x199625[_0xb65c('0x34')]);_0x215e62[_0xb65c('0x38')]=_[_0xb65c('0x37')](_0x199625['model'],qs[_0xb65c('0x47')](_0x18a4da[_0xb65c('0x34')][_0xb65c('0x47')]));_0x215e62[_0xb65c('0x38')]=_0x215e62[_0xb65c('0x38')]['length']?_0x215e62['attributes']:_0x199625[_0xb65c('0x33')];if(_0x18a4da[_0xb65c('0x34')][_0xb65c('0x48')]){_0x215e62[_0xb65c('0x42')]=[{'all':!![]}];}_0x215e62=_['merge']({},_0x215e62,_0x18a4da[_0xb65c('0x40')]);return db[_0xb65c('0x41')]['find'](_0x215e62)[_0xb65c('0x28')](handleEntityNotFound(_0x150ffb,null))['then'](respondWithResult(_0x150ffb,null))[_0xb65c('0x49')](handleError(_0x150ffb,null));};exports[_0xb65c('0x4a')]=function(_0x2ad35c,_0x1af087){return db['WhatsappApplication'][_0xb65c('0x4a')](_0x2ad35c[_0xb65c('0x4b')],{})[_0xb65c('0x28')](respondWithResult(_0x1af087,0xc9))[_0xb65c('0x49')](handleError(_0x1af087,null));};exports[_0xb65c('0x27')]=function(_0x5e81e2,_0x481d4d){if(_0x5e81e2[_0xb65c('0x4b')]['id']){delete _0x5e81e2[_0xb65c('0x4b')]['id'];}return db[_0xb65c('0x41')]['find']({'where':{'id':_0x5e81e2[_0xb65c('0x46')]['id']}})['then'](handleEntityNotFound(_0x481d4d,null))[_0xb65c('0x28')](saveUpdates(_0x5e81e2['body'],null))['then'](respondWithResult(_0x481d4d,null))['catch'](handleError(_0x481d4d,null));};exports[_0xb65c('0x29')]=function(_0x5b374c,_0x5e74a8){return db[_0xb65c('0x41')][_0xb65c('0x4c')]({'where':{'id':_0x5b374c[_0xb65c('0x46')]['id']}})[_0xb65c('0x28')](handleEntityNotFound(_0x5e74a8,null))[_0xb65c('0x28')](removeEntity(_0x5e74a8,null))[_0xb65c('0x49')](handleError(_0x5e74a8,null));}; \ No newline at end of file +var _0x3ef7=['hasOwnProperty','order','sort','where','filters','filter','type','merge','options','includeAll','include','findAll','rows','catch','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','name','send','map','WhatsappApplication','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x73ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73ef('0x1'));var jsonpatch=require(_0x73ef('0x2'));var rp=require(_0x73ef('0x3'));var moment=require(_0x73ef('0x4'));var BPromise=require(_0x73ef('0x5'));var Mustache=require('mustache');var util=require(_0x73ef('0x6'));var path=require(_0x73ef('0x7'));var sox=require(_0x73ef('0x8'));var csv=require(_0x73ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73ef('0xa'));var _=require(_0x73ef('0xb'));var squel=require(_0x73ef('0xc'));var crypto=require(_0x73ef('0xd'));var jsforce=require(_0x73ef('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x73ef('0x9'));var querystring=require(_0x73ef('0xf'));var Papa=require('papaparse');var Redis=require(_0x73ef('0x10'));var authService=require(_0x73ef('0x11'));var qs=require(_0x73ef('0x12'));var as=require(_0x73ef('0x13'));var hardwareService=require(_0x73ef('0x14'));var logger=require('../../config/logger')(_0x73ef('0x15'));var utils=require(_0x73ef('0x16'));var config=require(_0x73ef('0x17'));var licenseUtil=require(_0x73ef('0x18'));var db=require(_0x73ef('0x19'))['db'];function respondWithStatusCode(_0x21ee99,_0x3430ee){_0x3430ee=_0x3430ee||0xcc;return function(_0x134c09){if(_0x134c09){return _0x21ee99[_0x73ef('0x1a')](_0x3430ee);}return _0x21ee99[_0x73ef('0x1b')](_0x3430ee)[_0x73ef('0x1c')]();};}function respondWithResult(_0x361ab6,_0x221a81){_0x221a81=_0x221a81||0xc8;return function(_0x5c52a4){if(_0x5c52a4){return _0x361ab6[_0x73ef('0x1b')](_0x221a81)['json'](_0x5c52a4);}};}function respondWithFilteredResult(_0x2d836c,_0x2faa63){return function(_0x3c0c3b){if(_0x3c0c3b){var _0x5f3fae=typeof _0x2faa63[_0x73ef('0x1d')]===_0x73ef('0x1e')&&typeof _0x2faa63['limit']===_0x73ef('0x1e');var _0x164a67=_0x3c0c3b[_0x73ef('0x1f')];var _0x8cf07c=_0x5f3fae?0x0:_0x2faa63[_0x73ef('0x1d')];var _0x4d691e=_0x5f3fae?_0x3c0c3b[_0x73ef('0x1f')]:_0x2faa63['offset']+_0x2faa63[_0x73ef('0x20')];var _0x4d1a9a;if(_0x4d691e>=_0x164a67){_0x4d691e=_0x164a67;_0x4d1a9a=0xc8;}else{_0x4d1a9a=0xce;}_0x2d836c[_0x73ef('0x1b')](_0x4d1a9a);return _0x2d836c[_0x73ef('0x21')](_0x73ef('0x22'),_0x8cf07c+'-'+_0x4d691e+'/'+_0x164a67)[_0x73ef('0x23')](_0x3c0c3b);}return null;};}function patchUpdates(_0x35d733){return function(_0x462250){try{jsonpatch[_0x73ef('0x24')](_0x462250,_0x35d733,!![]);}catch(_0x1d5e1f){return BPromise['reject'](_0x1d5e1f);}return _0x462250[_0x73ef('0x25')]();};}function saveUpdates(_0x2623c7,_0x10bb3a){return function(_0x309dff){if(_0x309dff){return _0x309dff['update'](_0x2623c7)[_0x73ef('0x26')](function(_0x28406c){return _0x28406c;});}return null;};}function removeEntity(_0x40907a,_0x1519f9){return function(_0x2849ed){if(_0x2849ed){return _0x2849ed[_0x73ef('0x27')]()[_0x73ef('0x26')](function(){_0x40907a[_0x73ef('0x1b')](0xcc)[_0x73ef('0x1c')]();});}};}function handleEntityNotFound(_0x2c1dce,_0x5545de){return function(_0x2f9cae){if(!_0x2f9cae){_0x2c1dce[_0x73ef('0x1a')](0x194);}return _0x2f9cae;};}function handleError(_0x5a2d12,_0x5ad215){_0x5ad215=_0x5ad215||0x1f4;return function(_0x460686){logger['error'](_0x460686['stack']);if(_0x460686[_0x73ef('0x28')]){delete _0x460686[_0x73ef('0x28')];}_0x5a2d12[_0x73ef('0x1b')](_0x5ad215)[_0x73ef('0x29')](_0x460686);};}exports['index']=function(_0x35462d,_0x4fa6e2){var _0x35411f={},_0x517e70={},_0x946100={'count':0x0,'rows':[]};var _0x1b802f=_[_0x73ef('0x2a')](db[_0x73ef('0x2b')][_0x73ef('0x2c')],function(_0x34920f){return{'name':_0x34920f[_0x73ef('0x2d')],'type':_0x34920f['type'][_0x73ef('0x2e')]};});_0x517e70[_0x73ef('0x2f')]=_[_0x73ef('0x2a')](_0x1b802f,'name');_0x517e70['query']=_[_0x73ef('0x30')](_0x35462d[_0x73ef('0x31')]);_0x517e70['filters']=_[_0x73ef('0x32')](_0x517e70['model'],_0x517e70[_0x73ef('0x31')]);_0x35411f[_0x73ef('0x33')]=_[_0x73ef('0x32')](_0x517e70['model'],qs[_0x73ef('0x34')](_0x35462d[_0x73ef('0x31')]['fields']));_0x35411f[_0x73ef('0x33')]=_0x35411f[_0x73ef('0x33')][_0x73ef('0x35')]?_0x35411f['attributes']:_0x517e70[_0x73ef('0x2f')];if(!_0x35462d[_0x73ef('0x31')][_0x73ef('0x36')]('nolimit')){_0x35411f[_0x73ef('0x20')]=qs[_0x73ef('0x20')](_0x35462d[_0x73ef('0x31')][_0x73ef('0x20')]);_0x35411f[_0x73ef('0x1d')]=qs[_0x73ef('0x1d')](_0x35462d[_0x73ef('0x31')][_0x73ef('0x1d')]);}_0x35411f[_0x73ef('0x37')]=qs[_0x73ef('0x38')](_0x35462d['query'][_0x73ef('0x38')]);_0x35411f[_0x73ef('0x39')]=qs[_0x73ef('0x3a')](_['pick'](_0x35462d[_0x73ef('0x31')],_0x517e70[_0x73ef('0x3a')]),_0x1b802f);if(_0x35462d[_0x73ef('0x31')][_0x73ef('0x3b')]){_0x35411f[_0x73ef('0x39')]=_['merge'](_0x35411f['where'],{'$or':_['map'](_0x1b802f,function(_0x15e2fe){if(_0x15e2fe[_0x73ef('0x3c')]!=='VIRTUAL'){var _0x3351f0={};_0x3351f0[_0x15e2fe[_0x73ef('0x28')]]={'$like':'%'+_0x35462d[_0x73ef('0x31')]['filter']+'%'};return _0x3351f0;}})});}_0x35411f=_[_0x73ef('0x3d')]({},_0x35411f,_0x35462d[_0x73ef('0x3e')]);var _0x376791={'where':_0x35411f[_0x73ef('0x39')]};return db['WhatsappApplication'][_0x73ef('0x1f')](_0x376791)[_0x73ef('0x26')](function(_0x428154){_0x946100[_0x73ef('0x1f')]=_0x428154;if(_0x35462d[_0x73ef('0x31')][_0x73ef('0x3f')]){_0x35411f[_0x73ef('0x40')]=[{'all':!![]}];}return db[_0x73ef('0x2b')][_0x73ef('0x41')](_0x35411f);})['then'](function(_0x5b3bd9){_0x946100[_0x73ef('0x42')]=_0x5b3bd9;return _0x946100;})[_0x73ef('0x26')](respondWithFilteredResult(_0x4fa6e2,_0x35411f))['catch'](handleError(_0x4fa6e2,null));};exports['show']=function(_0x631f2b,_0x2193d2){var _0x5e304e={'raw':!![],'where':{'id':_0x631f2b['params']['id']}},_0x48035f={};_0x48035f['model']=_[_0x73ef('0x30')](db[_0x73ef('0x2b')][_0x73ef('0x2c')]);_0x48035f[_0x73ef('0x31')]=_[_0x73ef('0x30')](_0x631f2b[_0x73ef('0x31')]);_0x48035f[_0x73ef('0x3a')]=_['intersection'](_0x48035f[_0x73ef('0x2f')],_0x48035f[_0x73ef('0x31')]);_0x5e304e['attributes']=_[_0x73ef('0x32')](_0x48035f['model'],qs[_0x73ef('0x34')](_0x631f2b['query']['fields']));_0x5e304e[_0x73ef('0x33')]=_0x5e304e[_0x73ef('0x33')]['length']?_0x5e304e[_0x73ef('0x33')]:_0x48035f[_0x73ef('0x2f')];if(_0x631f2b[_0x73ef('0x31')]['includeAll']){_0x5e304e[_0x73ef('0x40')]=[{'all':!![]}];}_0x5e304e=_[_0x73ef('0x3d')]({},_0x5e304e,_0x631f2b['options']);return db[_0x73ef('0x2b')]['find'](_0x5e304e)[_0x73ef('0x26')](handleEntityNotFound(_0x2193d2,null))[_0x73ef('0x26')](respondWithResult(_0x2193d2,null))[_0x73ef('0x43')](handleError(_0x2193d2,null));};exports[_0x73ef('0x44')]=function(_0x1f2430,_0x325d45){return db['WhatsappApplication']['create'](_0x1f2430['body'],{})[_0x73ef('0x26')](respondWithResult(_0x325d45,0xc9))['catch'](handleError(_0x325d45,null));};exports['update']=function(_0x1d47ec,_0x16b838){if(_0x1d47ec[_0x73ef('0x45')]['id']){delete _0x1d47ec[_0x73ef('0x45')]['id'];}return db['WhatsappApplication'][_0x73ef('0x46')]({'where':{'id':_0x1d47ec[_0x73ef('0x47')]['id']}})[_0x73ef('0x26')](handleEntityNotFound(_0x16b838,null))['then'](saveUpdates(_0x1d47ec[_0x73ef('0x45')],null))[_0x73ef('0x26')](respondWithResult(_0x16b838,null))[_0x73ef('0x43')](handleError(_0x16b838,null));};exports['destroy']=function(_0x88078b,_0x15fd18){return db[_0x73ef('0x2b')]['find']({'where':{'id':_0x88078b[_0x73ef('0x47')]['id']}})[_0x73ef('0x26')](handleEntityNotFound(_0x15fd18,null))['then'](removeEntity(_0x15fd18,null))[_0x73ef('0x43')](handleError(_0x15fd18,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e24811b..c269077 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 _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4'];(function(_0x4deb8d,_0xff4fee){var _0x355cc0=function(_0x5d0bab){while(--_0x5d0bab){_0x4deb8d['push'](_0x4deb8d['shift']());}};_0x355cc0(++_0xff4fee);}(_0xfd2f,0x14a));var _0xffd2=function(_0x440df0,_0x4242fb){_0x440df0=_0x440df0-0x0;var _0x32adf6=_0xfd2f[_0x440df0];return _0x32adf6;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffd2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcca7=['../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1b48eb,_0x120627){_0x1b48eb=_0x1b48eb-0x0;var _0x3b7e5c=_0xcca7[_0x1b48eb];return _0x3b7e5c;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('WhatsappApplication',attributes,{'tableName':_0x7cca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cca('0xa'),'collate':_0x7cca('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index fd117e8..26acd0d 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x114321,_0x1ce445){_0x114321=_0x114321-0x0;var _0x3f070f=_0x008c[_0x114321];return _0x3f070f;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x4b69c3,_0x265e74){var _0x5f23b4=function(_0x3527dc){while(--_0x3527dc){_0x4b69c3['push'](_0x4b69c3['shift']());}};_0x5f23b4(++_0x265e74);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x4b84[_0x2c1114];return _0x2b877c;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index cd3c585..d27a903 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 _0xc03e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','whatsapp','whatsappinteraction:update','delete','removeTags','multer','connect-timeout'];(function(_0x10c90e,_0x2a0672){var _0x2fbfee=function(_0x5a8c27){while(--_0x5a8c27){_0x10c90e['push'](_0x10c90e['shift']());}};_0x2fbfee(++_0x2a0672);}(_0xc03e,0x15a));var _0xec03=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xc03e[_0x1762b4];return _0x29beda;};'use strict';var multer=require(_0xec03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec03('0x1'));var express=require('express');var router=express[_0xec03('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xec03('0x3'));var interaction=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var controller=require(_0xec03('0x6'));router[_0xec03('0x7')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0x9')]);router[_0xec03('0x7')](_0xec03('0xa'),auth['isAuthenticated'](),controller[_0xec03('0xb')]);router[_0xec03('0x7')](_0xec03('0xc'),auth[_0xec03('0x8')](),controller['show']);router[_0xec03('0x7')](_0xec03('0xd'),auth[_0xec03('0x8')](),controller[_0xec03('0xe')]);router[_0xec03('0x7')](_0xec03('0xf'),auth[_0xec03('0x8')](),controller[_0xec03('0x10')]);router['post']('/',auth[_0xec03('0x8')](),controller[_0xec03('0x11')]);router[_0xec03('0x12')](_0xec03('0xd'),auth[_0xec03('0x8')](),controller[_0xec03('0x13')]);router[_0xec03('0x12')](_0xec03('0x14'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xec03('0x15')),controller[_0xec03('0x16')]);router[_0xec03('0x17')](_0xec03('0xc'),auth[_0xec03('0x8')](),interaction[_0xec03('0x18')](_0xec03('0x19'),_0xec03('0x1a')),controller['update']);router[_0xec03('0x1b')]('/:id',auth[_0xec03('0x8')](),interaction['tracked'](_0xec03('0x19'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xec03('0x1b')](_0xec03('0x14'),auth[_0xec03('0x8')](),controller[_0xec03('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x06f4=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','destroy','delete','multer','util'];(function(_0x63c9b4,_0x1dd867){var _0x20dbb2=function(_0x5c54f6){while(--_0x5c54f6){_0x63c9b4['push'](_0x63c9b4['shift']());}};_0x20dbb2(++_0x1dd867);}(_0x06f4,0x136));var _0x406f=function(_0x58224b,_0x1cbe5c){_0x58224b=_0x58224b-0x0;var _0x2aabb0=_0x06f4[_0x58224b];return _0x2aabb0;};'use strict';var multer=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var path=require('path');var timeout=require(_0x406f('0x2'));var express=require(_0x406f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x406f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x406f('0x5'));var controller=require(_0x406f('0x6'));router[_0x406f('0x7')]('/',auth[_0x406f('0x8')](),controller['index']);router[_0x406f('0x7')]('/describe',auth[_0x406f('0x8')](),controller[_0x406f('0x9')]);router[_0x406f('0x7')]('/:id',auth[_0x406f('0x8')](),controller['show']);router['get'](_0x406f('0xa'),auth['isAuthenticated'](),controller[_0x406f('0xb')]);router['get'](_0x406f('0xc'),auth['isAuthenticated'](),controller[_0x406f('0xd')]);router[_0x406f('0xe')]('/',auth['isAuthenticated'](),controller[_0x406f('0xf')]);router[_0x406f('0xe')](_0x406f('0xa'),auth[_0x406f('0x8')](),controller[_0x406f('0x10')]);router[_0x406f('0xe')](_0x406f('0x11'),auth[_0x406f('0x8')](),interaction[_0x406f('0x12')](_0x406f('0x13'),_0x406f('0x14')),controller['addTags']);router[_0x406f('0x15')](_0x406f('0x16'),auth[_0x406f('0x8')](),interaction['tracked'](_0x406f('0x13'),_0x406f('0x17')),controller['update']);router['delete'](_0x406f('0x16'),auth[_0x406f('0x8')](),interaction['tracked'](_0x406f('0x13'),'whatsappinteraction:destroy'),controller[_0x406f('0x18')]);router[_0x406f('0x19')](_0x406f('0x11'),auth[_0x406f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4f9a191..397d46e 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 _0x83d0=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x616684,_0x1c4bd7){var _0xa3b939=function(_0x5751d4){while(--_0x5751d4){_0x616684['push'](_0x616684['shift']());}};_0xa3b939(++_0x1c4bd7);}(_0x83d0,0xb7));var _0x083d=function(_0x574aa8,_0x5d4559){_0x574aa8=_0x574aa8-0x0;var _0x3f9db7=_0x83d0[_0x574aa8];return _0x3f9db7;};'use strict';var Sequelize=require(_0x083d('0x0'));var moment=require(_0x083d('0x1'));module[_0x083d('0x2')]={'closed':{'type':Sequelize[_0x083d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x083d('0x4')]},'disposition':{'type':Sequelize[_0x083d('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x083d('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x083d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x083d('0x6')]('in',_0x083d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x083d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x083d('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa63f=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x47bc4f,_0x19463b){var _0x4ffde9=function(_0x5c493f){while(--_0x5c493f){_0x47bc4f['push'](_0x47bc4f['shift']());}};_0x4ffde9(++_0x19463b);}(_0xa63f,0x1b6));var _0xfa63=function(_0x324d77,_0x307ef7){_0x324d77=_0x324d77-0x0;var _0x2a77a7=_0xa63f[_0x324d77];return _0x2a77a7;};'use strict';var Sequelize=require(_0xfa63('0x0'));var moment=require(_0xfa63('0x1'));module[_0xfa63('0x2')]={'closed':{'type':Sequelize[_0xfa63('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfa63('0x4')]},'disposition':{'type':Sequelize[_0xfa63('0x5')]},'secondDisposition':{'type':Sequelize[_0xfa63('0x5')]},'thirdDisposition':{'type':Sequelize[_0xfa63('0x5')]},'note':{'type':Sequelize[_0xfa63('0x5')]},'phone':{'type':Sequelize[_0xfa63('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfa63('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfa63('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfa63('0x7')]('in',_0xfa63('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f84ca49..9bac2f9 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 _0x09d2=['limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','TagIds','Tags','forEach','push','catch','waiting','talking','unmanaged','closed','UserId','answered','total','index','WhatsappInteraction','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','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','find','ContactId','text','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','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','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','toString','sequelize','keyBy','merge','a.key','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','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','show','params','keys','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','join','root','tmp','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','basename','existsSync','createReadStream','createWriteStream','System','out','renderFile','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json'];(function(_0x4b77c2,_0x54a464){var _0x1f27c4=function(_0x4d97cd){while(--_0x4d97cd){_0x4b77c2['push'](_0x4b77c2['shift']());}};_0x1f27c4(++_0x54a464);}(_0x09d2,0x1d2));var _0x209d=function(_0x5bd511,_0x2381ce){_0x5bd511=_0x5bd511-0x0;var _0x3b7f26=_0x09d2[_0x5bd511];return _0x3b7f26;};'use strict';var emlformat=require(_0x209d('0x0'));var rimraf=require(_0x209d('0x1'));var zipdir=require(_0x209d('0x2'));var jsonpatch=require(_0x209d('0x3'));var rp=require(_0x209d('0x4'));var moment=require(_0x209d('0x5'));var BPromise=require(_0x209d('0x6'));var Mustache=require(_0x209d('0x7'));var util=require(_0x209d('0x8'));var path=require(_0x209d('0x9'));var sox=require('sox');var csv=require(_0x209d('0xa'));var ejs=require(_0x209d('0xb'));var fs=require('fs');var fs_extra=require(_0x209d('0xc'));var _=require(_0x209d('0xd'));var squel=require(_0x209d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x209d('0xf'));var toCsv=require(_0x209d('0xa'));var querystring=require(_0x209d('0x10'));var Papa=require('papaparse');var Redis=require(_0x209d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x209d('0x12'));var as=require(_0x209d('0x13'));var pdf=require(_0x209d('0x14'));var hardwareService=require(_0x209d('0x15'));var logger=require(_0x209d('0x16'))(_0x209d('0x17'));var utils=require(_0x209d('0x18'));var config=require(_0x209d('0x19'));var licenseUtil=require(_0x209d('0x1a'));var db=require(_0x209d('0x1b'))['db'];config[_0x209d('0x1c')]=_[_0x209d('0x1d')](config['redis'],{'host':_0x209d('0x1e'),'port':0x18eb});var socket=require(_0x209d('0x1f'))(new Redis(config[_0x209d('0x1c')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3f24fd,_0x5267d3){_0x5267d3=_0x5267d3||0xcc;return function(_0x5bbe90){if(_0x5bbe90){return _0x3f24fd[_0x209d('0x20')](_0x5267d3);}return _0x3f24fd[_0x209d('0x21')](_0x5267d3)[_0x209d('0x22')]();};}function respondWithResult(_0x546766,_0x129797){_0x129797=_0x129797||0xc8;return function(_0xe0721){if(_0xe0721){return _0x546766[_0x209d('0x21')](_0x129797)[_0x209d('0x23')](_0xe0721);}};}function respondWithFilteredResult(_0x59d750,_0x2cdf73){return function(_0x437f76){if(_0x437f76){var _0x38aa09=typeof _0x2cdf73['offset']==='undefined'&&typeof _0x2cdf73[_0x209d('0x24')]==='undefined';var _0x113cc0=_0x437f76[_0x209d('0x25')];var _0xa72210=_0x38aa09?0x0:_0x2cdf73[_0x209d('0x26')];var _0x3d8854=_0x38aa09?_0x437f76[_0x209d('0x25')]:_0x2cdf73[_0x209d('0x26')]+_0x2cdf73[_0x209d('0x24')];var _0x178584;if(_0x3d8854>=_0x113cc0){_0x3d8854=_0x113cc0;_0x178584=0xc8;}else{_0x178584=0xce;}_0x59d750[_0x209d('0x21')](_0x178584);return _0x59d750[_0x209d('0x27')](_0x209d('0x28'),_0xa72210+'-'+_0x3d8854+'/'+_0x113cc0)[_0x209d('0x23')](_0x437f76);}return null;};}function patchUpdates(_0x183932){return function(_0xe15e8d){try{jsonpatch[_0x209d('0x29')](_0xe15e8d,_0x183932,!![]);}catch(_0x436379){return BPromise[_0x209d('0x2a')](_0x436379);}return _0xe15e8d[_0x209d('0x2b')]();};}function saveUpdates(_0x183767,_0x262cd5){return function(_0x4d1579){if(_0x4d1579){return _0x4d1579[_0x209d('0x2c')](_0x183767)[_0x209d('0x2d')](function(_0x59eda7){return _0x59eda7;});}return null;};}function removeEntity(_0x77e57e,_0x561ad6){return function(_0x396500){if(_0x396500){return _0x396500[_0x209d('0x2e')]()[_0x209d('0x2d')](function(){_0x77e57e[_0x209d('0x21')](0xcc)[_0x209d('0x22')]();});}};}function handleEntityNotFound(_0x819a15,_0x5399e3){return function(_0x182d8b){if(!_0x182d8b){_0x819a15[_0x209d('0x20')](0x194);}return _0x182d8b;};}function handleError(_0x5d8622,_0x2f1b01){_0x2f1b01=_0x2f1b01||0x1f4;return function(_0x14dc18){logger[_0x209d('0x2f')](_0x14dc18[_0x209d('0x30')]);if(_0x14dc18[_0x209d('0x31')]){delete _0x14dc18[_0x209d('0x31')];}_0x5d8622['status'](_0x2f1b01)['send'](_0x14dc18);};}function getInteractionUsers(_0x46b3ef,_0x57d9ad){return new BPromise(function(_0x3a69da,_0x5d590b){try{if(_0x57d9ad[_0x46b3ef['id']]){_0x46b3ef[_0x209d('0x32')]=_[_0x209d('0x33')](_0x57d9ad[_0x46b3ef['id']],function(_0x5d6145){return{'id':_0x5d6145['id'],'fullname':_0x5d6145['fullname']};});}}catch(_0x48e200){_0x5d590b(_0x48e200);}_0x3a69da(_0x46b3ef);});}function getInteractionTags(_0x57b589,_0x2dba5b){return new BPromise(function(_0x19c3fc,_0x4a8409){try{if(_0x57b589[_0x209d('0x34')]){_0x57b589[_0x209d('0x35')]=[];_0x57b589['TagIds']['split'](',')[_0x209d('0x36')](function(_0x52f71c){_0x57b589[_0x209d('0x35')][_0x209d('0x37')](_0x2dba5b[_0x52f71c]);});}delete _0x57b589[_0x209d('0x34')];}catch(_0x1a64b9){_0x4a8409(_0x1a64b9);}_0x19c3fc(_0x57b589);});}function updateWhatsappInteraction(_0x431c62,_0x4471c1,_0x2953aa){return new BPromise(function(_0x4d8542,_0x3546b0){return getInteractionUsers(_0x431c62,_0x2953aa)[_0x209d('0x2d')](function(_0xc6318e){return getInteractionTags(_0xc6318e,_0x4471c1);})[_0x209d('0x2d')](function(_0x3e39d5){return getStateInteraction(_0x3e39d5);})[_0x209d('0x2d')](function(_0x200c6b){_0x4d8542(_0x200c6b);})[_0x209d('0x38')](function(_0x3ad4cb){_0x3546b0(_0x3ad4cb);});});}function getStateInteraction(_0x454003){return new BPromise(function(_0x130008){_0x454003[_0x209d('0x39')]=0x0;_0x454003[_0x209d('0x3a')]=0x0;_0x454003['answered']=0x0;_0x454003[_0x209d('0x3b')]=0x0;_0x454003['total']=0x0;if(!_0x454003[_0x209d('0x3c')]&&!_0x454003[_0x209d('0x3d')]){_0x454003[_0x209d('0x39')]+=0x1;}if(!_0x454003['closed']&&_0x454003['UserId']){_0x454003[_0x209d('0x3a')]+=0x1;if(_0x454003[_0x209d('0x39')]){_0x454003[_0x209d('0x39')]-=0x1;}}if(_0x454003[_0x209d('0x3c')]&&_0x454003[_0x209d('0x3d')]){_0x454003[_0x209d('0x3e')]+=0x1;if(_0x454003[_0x209d('0x3a')]){_0x454003[_0x209d('0x3a')]-=0x1;}}if(_0x454003[_0x209d('0x3c')]&&!_0x454003['UserId']){_0x454003[_0x209d('0x3b')]+=0x1;if(_0x454003[_0x209d('0x39')]){_0x454003[_0x209d('0x39')]-=0x1;}}_0x454003[_0x209d('0x3f')]+=0x1;_0x130008(_0x454003);});}exports[_0x209d('0x40')]=function(_0x456536,_0x44c12f){var _0x38353e={},_0xccbea0={},_0x452939={'count':0x0,'rows':[]};var _0x5501ed=_[_0x209d('0x33')](db[_0x209d('0x41')][_0x209d('0x42')],function(_0xf984e1){return{'name':_0xf984e1['fieldName'],'type':_0xf984e1[_0x209d('0x43')][_0x209d('0x44')]};});_0xccbea0['model']=_[_0x209d('0x33')](_0x5501ed,_0x209d('0x31'));_0xccbea0[_0x209d('0x45')]=_['keys'](_0x456536['query']);_0xccbea0[_0x209d('0x46')]=_[_0x209d('0x47')](_0xccbea0[_0x209d('0x48')],_0xccbea0[_0x209d('0x45')]);_0x38353e[_0x209d('0x49')]=_['intersection'](_0xccbea0[_0x209d('0x48')],qs['fields'](_0x456536['query'][_0x209d('0x4a')]));_0x38353e[_0x209d('0x49')]=_0x38353e[_0x209d('0x49')][_0x209d('0x4b')]?_0x38353e[_0x209d('0x49')]:_0xccbea0[_0x209d('0x48')];if(!_0x456536[_0x209d('0x45')][_0x209d('0x4c')](_0x209d('0x4d'))){_0x38353e['limit']=qs[_0x209d('0x24')](_0x456536[_0x209d('0x45')][_0x209d('0x24')]);_0x38353e[_0x209d('0x26')]=qs[_0x209d('0x26')](_0x456536[_0x209d('0x45')]['offset']);}_0x38353e[_0x209d('0x4e')]=qs[_0x209d('0x4f')](_0x456536['query'][_0x209d('0x4f')]);_0x38353e[_0x209d('0x50')]=qs[_0x209d('0x46')](_['pick'](_0x456536[_0x209d('0x45')],_0xccbea0[_0x209d('0x46')]),_0x5501ed);var _0x15aef8=[];var _0x2e83f1=squel[_0x209d('0x51')]()[_0x209d('0x52')]('id')['field']('name')[_0x209d('0x52')]('color')[_0x209d('0x53')](_0x209d('0x54'));var _0x2d7c11=squel[_0x209d('0x51')]()['field'](_0x209d('0x55'))['field'](_0x209d('0x56'))[_0x209d('0x52')]('ui.WhatsappInteractionId')[_0x209d('0x53')](_0x209d('0x57'),'ui')['left_join'](_0x209d('0x58'),'u',_0x209d('0x59'));var _0x4d6653=squel[_0x209d('0x51')]()[_0x209d('0x53')](_0x209d('0x5a'),'i')[_0x209d('0x5b')](_0x209d('0x5c'),'c',_0x209d('0x5d'))['left_join'](_0x209d('0x58'),'o',_0x209d('0x5e'))['left_join'](_0x209d('0x5f'),'a',_0x209d('0x60'))[_0x209d('0x5b')](_0x209d('0x61'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x209d('0x62'),'it',_0x209d('0x63'))['left_join'](_0x209d('0x54'),'t',_0x209d('0x64'));var _0x1889e1=squel[_0x209d('0x65')]();var _0x235dff=[];var _0x1fa535=squel['expr']();var _0x293b7e;if(_0x456536[_0x209d('0x45')][_0x209d('0x66')]){_0x293b7e=as[_0x209d('0x67')](_0x456536[_0x209d('0x45')]['search']);var _0x52fe60=_0x293b7e[_0x209d('0x68')];for(var _0x43a1fa=0x0;_0x43a1fa<_0x293b7e['conditions'][_0x209d('0x4b')];_0x43a1fa++){var _0x34989e=_0x293b7e[_0x209d('0x69')][_0x43a1fa];var _0x25eb7b='i';var _0x3c8573=_['find'](_0x5501ed,['name',_0x34989e[_0x209d('0x52')]]);if(!_0x3c8573){switch(_0x34989e['field']){case _0x209d('0x6a'):if(_0x34989e[_0x209d('0x6b')]==0x1){_0x4d6653[_0x209d('0x6c')]('`'+_0x34989e[_0x209d('0x52')]+_0x209d('0x6d'));}else{_0x4d6653[_0x209d('0x6c')]('`'+_0x34989e['field']+_0x209d('0x6e'));}break;case _0x209d('0x6f'):if(_0x34989e[_0x209d('0x70')]===_0x209d('0x71')){if(_0x34989e['value']['split']('\x20')[_0x209d('0x4b')]>0x1){_0x1889e1[_0x52fe60](_0x209d('0x72'),qs[_0x209d('0x73')](_0x34989e[_0x209d('0x6b')]),null);}else{var _0x4e09e3='%'+_0x34989e['value']+'%';_0x1889e1[_0x52fe60]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4e09e3,_0x4e09e3,_0x4e09e3);}}else{_0x3c8573=_[_0x209d('0x74')](_0x5501ed,[_0x209d('0x31'),_0x209d('0x75')]);_0x34989e[_0x209d('0x52')]=_0x209d('0x75');_0x2a4c62=as['buildExpression'](_0x25eb7b,_0x3c8573['type'],_0x34989e);_0x1889e1[_0x52fe60](_0x2a4c62[_0x209d('0x76')],_0x2a4c62['value']['start'],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x22')]);}break;case'Tag':var _0xf4da8e=_0x34989e[_0x209d('0x6b')][_0x209d('0x77')](',')[_0x209d('0x33')](function(_0x3e388a){return Number(_0x3e388a);});_0xf4da8e['forEach'](function(_0x5a7db3){_0x1fa535['or'](_0x209d('0x78'),'%,'+_0x5a7db3+',%');});_0x235dff=_[_0x209d('0x79')](_0x235dff,_0xf4da8e);break;case _0x209d('0x7a'):if(_0x34989e[_0x209d('0x70')]==='$substring'){_0x1889e1[_0x52fe60](_0x209d('0x7b'),'%'+_0x34989e[_0x209d('0x6b')]+'%',null);}else{_0x3c8573=_[_0x209d('0x74')](_0x5501ed,['name','UserId']);_0x34989e[_0x209d('0x52')]=_0x209d('0x3d');_0x2a4c62=as[_0x209d('0x7c')](_0x25eb7b,_0x3c8573[_0x209d('0x43')],_0x34989e);_0x1889e1[_0x52fe60](_0x2a4c62[_0x209d('0x76')],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x7d')],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x22')]);}break;case _0x209d('0x7e'):_0x2a4c62=as[_0x209d('0x7c')]('me',null,_0x34989e);_0x1889e1[_0x52fe60](_0x2a4c62[_0x209d('0x76')],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x7d')],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x22')]);break;}}else{var _0x2a4c62=as[_0x209d('0x7c')](_0x25eb7b,_0x3c8573[_0x209d('0x43')],_0x34989e);_0x1889e1[_0x52fe60](_0x2a4c62[_0x209d('0x76')],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x7d')],_0x2a4c62[_0x209d('0x6b')][_0x209d('0x22')]);}}}else{var _0x2a4272=_(_0x456536['query'])['keys']()[_0x209d('0x33')](function(_0x1aab95){return _[_0x209d('0x7f')](_0x5501ed,[_0x209d('0x31'),_0x1aab95])?_0x1aab95:undefined;})[_0x209d('0x80')]()[_0x209d('0x6b')]();if(!_['isEmpty'](_0x2a4272)){_0x2a4272[_0x209d('0x36')](function(_0xcb33fb){if(_0xcb33fb===_0x209d('0x81')){_0x4d6653[_0x209d('0x50')](_0x209d('0x82'),[][_0x209d('0x83')](_0x456536[_0x209d('0x45')][_0xcb33fb]));}else if(_0xcb33fb===_0x209d('0x84')){var _0x2006e1=JSON[_0x209d('0x85')](_0x456536[_0x209d('0x45')][_0xcb33fb])['$gte'];var _0x2162ad=JSON['parse'](_0x456536['query'][_0xcb33fb])[_0x209d('0x86')];_0x4d6653[_0x209d('0x50')](_0x209d('0x87'),_0x2006e1,_0x2162ad);}else{if(_0x456536[_0x209d('0x45')][_0xcb33fb]===_0x209d('0x88')){_0x4d6653[_0x209d('0x50')]('i.'+_0xcb33fb+_0x209d('0x89'));}else{_0x4d6653[_0x209d('0x50')]('i.'+_0xcb33fb+'\x20=\x20?',_0x456536[_0x209d('0x45')][_0xcb33fb]);}}});}if(_0x456536[_0x209d('0x45')]['read']){if(_0x456536[_0x209d('0x45')][_0x209d('0x8a')]==0x1){_0x4d6653[_0x209d('0x6c')](_0x209d('0x8b'));}else{_0x4d6653['having']('`unreadMessages`\x20>\x200');}}if(_0x456536['query'][_0x209d('0x8c')]){_0x235dff=_[_0x209d('0x8d')](_0x456536[_0x209d('0x45')][_0x209d('0x8c')])?_0x456536[_0x209d('0x45')][_0x209d('0x8c')]:new Array(_0x456536['query'][_0x209d('0x8c')]);_0x235dff[_0x209d('0x36')](function(_0x33b383){_0x1fa535['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x33b383+',%');});}if(_0x456536['query'][_0x209d('0x8e')]){var _0x50b672=_0x456536['query']['filter'][_0x209d('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x209d('0x90')](_0x50b672)){_0x1889e1['or']('i.id\x20LIKE\x20?',_0x50b672+'%')['or'](_0x209d('0x91'),_0x50b672+'%');}else{_0x1889e1['or'](_0x209d('0x92'),qs[_0x209d('0x73')](_0x50b672))['or'](_0x209d('0x93'),_0x50b672+'%');}}}_0x4d6653['where'](_0x1889e1);_0x4d6653[_0x209d('0x94')](_0x209d('0x95'));var _0x53b749={'type':db[_0x209d('0x96')][_0x209d('0x97')][_0x209d('0x98')],'raw':!![]};var _0x1fa82e=_0x4d6653[_0x209d('0x99')]();_0x1fa82e[_0x209d('0x52')]('i.id');_0x1fa82e[_0x209d('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x209d('0x6a'));if(_0x38353e[_0x209d('0x4e')]){_0x38353e[_0x209d('0x4e')]['forEach'](function(_0x3e1e48){var _0x1ac6d2=_0x3e1e48[0x0]===_0x209d('0x9a')?_0x3e1e48[0x0]:'i.'+_0x3e1e48[0x0];_0x4d6653['order'](_0x1ac6d2,_0x3e1e48[0x1]===_0x209d('0x9b')?![]:!![]);});}if(!_[_0x209d('0x9c')](_0x235dff)){_0x4d6653[_0x209d('0x6c')](_0x1fa535);_0x1fa82e[_0x209d('0x50')](_0x209d('0x9d'),_0x235dff);}BPromise[_0x209d('0x9e')]()[_0x209d('0x2d')](function(){if(!_0x293b7e){if(_0x456536[_0x209d('0x45')][_0x209d('0x81')])return;_0x1fa82e['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x4d6653['where'](_0x209d('0x9f'));return;}if(_0x456536[_0x209d('0xa0')]['role']!==_0x209d('0xa1'))return;return _0x456536[_0x209d('0xa0')][_0x209d('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5dfa59){if(_[_0x209d('0x9c')](_0x5dfa59)){_0x1fa82e['where'](_0x209d('0xa3'));_0x4d6653['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1fa82e[_0x209d('0x50')](_0x209d('0x82'),_[_0x209d('0x33')](_0x5dfa59,'id'));_0x4d6653[_0x209d('0x50')](_0x209d('0x82'),_['map'](_0x5dfa59,'id'));}});})['then'](function(){if(_0x456536[_0x209d('0xa0')][_0x209d('0xa4')]==='agent'&&!_0x293b7e&&!_0x456536[_0x209d('0x45')]['WhatsappAccountId'])return[];return db['sequelize'][_0x209d('0x45')](_0x1fa82e[_0x209d('0xa5')](),_0x53b749);})[_0x209d('0x2d')](function(_0x42f5e5){_0x452939[_0x209d('0x25')]=_0x42f5e5[_0x209d('0x4b')];if(_0x452939[_0x209d('0x25')]===0x0)return[];return db[_0x209d('0xa6')]['query'](_0x2e83f1[_0x209d('0xa5')](),_0x53b749)[_0x209d('0x2d')](function(_0x198868){_0x15aef8=_[_0x209d('0xa7')](_0x198868,'id');_0x53b749=_[_0x209d('0xa8')](_0x53b749,{'model':db[_0x209d('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x456536['query'][_0x209d('0x4a')]){_0x38353e[_0x209d('0x49')][_0x209d('0x36')](function(_0x5033f1){_0x4d6653[_0x209d('0x52')]('i.'+_0x5033f1);});}else{_0x4d6653['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x209d('0x6a'));_0x4d6653[_0x209d('0x52')](_0x209d('0xa9'),_0x209d('0xaa'));_0x4d6653[_0x209d('0x52')](_0x209d('0xab'),_0x209d('0xac'));_0x4d6653['field'](_0x209d('0xad'),_0x209d('0x9a'));_0x4d6653[_0x209d('0x52')](_0x209d('0xae'));_0x4d6653[_0x209d('0x52')]('c.firstName','Contact.firstName');_0x4d6653[_0x209d('0x52')](_0x209d('0xaf'),_0x209d('0xb0'));_0x4d6653[_0x209d('0x52')](_0x209d('0xb1'),_0x209d('0xb2'));_0x4d6653[_0x209d('0x52')](_0x209d('0xb3'),_0x209d('0xb4'));_0x4d6653[_0x209d('0x52')](_0x209d('0xb5'),_0x209d('0xb6'));_0x4d6653[_0x209d('0x52')](_0x209d('0xb7'),_0x209d('0xb8'));_0x4d6653[_0x209d('0x52')](_0x209d('0xb9'),_0x209d('0xba'));_0x4d6653[_0x209d('0x52')](_0x209d('0xbb'),_0x209d('0xbc'));_0x4d6653[_0x209d('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x209d('0x34'));}if(_0x38353e['limit'])_0x4d6653[_0x209d('0x24')](_0x38353e['limit']);if(_0x38353e[_0x209d('0x26')])_0x4d6653['offset'](_0x38353e[_0x209d('0x26')]);return db[_0x209d('0xa6')][_0x209d('0x45')](_0x4d6653[_0x209d('0xa5')](),_0x53b749);})[_0x209d('0x2d')](function(_0x2bdb4a){if(_0x2bdb4a['length']>0x0)_0x2d7c11[_0x209d('0x50')](_0x209d('0xbd'),_[_0x209d('0x33')](_0x2bdb4a,'id'));return db['sequelize'][_0x209d('0x45')](_0x2d7c11['toString'](),_0x53b749)['then'](function(_0x3010f7){var _0x15df43=_[_0x209d('0xbe')](_0x3010f7,_0x209d('0xbf'));var _0x3ae00f=[];_0x2bdb4a[_0x209d('0x36')](function(_0x61ab3){_0x3ae00f['push'](updateWhatsappInteraction(_0x61ab3,_0x15aef8,_0x15df43));});return BPromise[_0x209d('0xc0')](_0x3ae00f);});});})[_0x209d('0x2d')](function(_0x5bddd5){_0x452939['rows']=_0x5bddd5;return _0x452939;})[_0x209d('0x2d')](respondWithFilteredResult(_0x44c12f,_0x38353e))[_0x209d('0x38')](handleError(_0x44c12f,null));};exports[_0x209d('0xc1')]=function(_0x4b924d,_0x45b062){var _0x504820={'raw':![],'where':{'id':_0x4b924d[_0x209d('0xc2')]['id']}},_0x3d7444={};_0x3d7444[_0x209d('0x48')]=_[_0x209d('0xc3')](db[_0x209d('0x41')][_0x209d('0x42')]);_0x3d7444[_0x209d('0x45')]=_['keys'](_0x4b924d[_0x209d('0x45')]);_0x3d7444[_0x209d('0x46')]=_[_0x209d('0x47')](_0x3d7444[_0x209d('0x48')],_0x3d7444[_0x209d('0x45')]);_0x504820[_0x209d('0x49')]=_['intersection'](_0x3d7444['model'],qs[_0x209d('0x4a')](_0x4b924d['query'][_0x209d('0x4a')]));_0x504820[_0x209d('0x49')]=_0x504820[_0x209d('0x49')][_0x209d('0x4b')]?_0x504820['attributes']:_0x3d7444[_0x209d('0x48')];if(_0x4b924d['query']['includeAll']){_0x504820[_0x209d('0xc4')]=[{'all':!![]}];}_0x504820=_['merge']({},_0x504820,_0x4b924d[_0x209d('0xc5')]);return db[_0x209d('0x41')]['find'](_0x504820)[_0x209d('0x2d')](handleEntityNotFound(_0x45b062,null))[_0x209d('0x2d')](respondWithResult(_0x45b062,null))['catch'](handleError(_0x45b062,null));};exports[_0x209d('0xc6')]=function(_0x4f01c6,_0x2463b1){return db['WhatsappInteraction'][_0x209d('0xc6')](_0x4f01c6[_0x209d('0x7e')],{})[_0x209d('0x2d')](respondWithResult(_0x2463b1,0xc9))[_0x209d('0x38')](handleError(_0x2463b1,null));};exports[_0x209d('0x2c')]=function(_0x2ccfda,_0x4dd58a){if(_0x2ccfda[_0x209d('0x7e')]['id']){delete _0x2ccfda['body']['id'];}return db[_0x209d('0x41')][_0x209d('0x74')]({'where':{'id':_0x2ccfda[_0x209d('0xc2')]['id']}})[_0x209d('0x2d')](handleEntityNotFound(_0x4dd58a,null))['then'](saveUpdates(_0x2ccfda[_0x209d('0x7e')],null))['then'](respondWithResult(_0x4dd58a,null))[_0x209d('0x38')](handleError(_0x4dd58a,null));};exports[_0x209d('0x2e')]=function(_0x467755,_0x3939f8){return db[_0x209d('0x41')][_0x209d('0x74')]({'where':{'id':_0x467755[_0x209d('0xc2')]['id']}})[_0x209d('0x2d')](handleEntityNotFound(_0x3939f8,null))['then'](removeEntity(_0x3939f8,null))[_0x209d('0x38')](handleError(_0x3939f8,null));};exports[_0x209d('0xc7')]=function(_0x428371,_0x3eecf7){return db['WhatsappInteraction'][_0x209d('0xc7')]()['then'](respondWithResult(_0x3eecf7,null))[_0x209d('0x38')](handleError(_0x3eecf7,null));};exports[_0x209d('0xc8')]=function(_0x1ec0ce,_0x56ef4f,_0x52e315){return db[_0x209d('0xc9')][_0x209d('0x74')]({'where':{'id':_0x1ec0ce[_0x209d('0xc2')]['id']}})['then'](handleEntityNotFound(_0x56ef4f,null))[_0x209d('0x2d')](function(_0x15d3f2){if(_0x15d3f2){return _0x15d3f2[_0x209d('0xc8')](_0x1ec0ce[_0x209d('0x7e')][_0x209d('0xca')],_[_0x209d('0xcb')](_0x1ec0ce['body'],[_0x209d('0xca'),'id'])||{});}})['then'](respondWithResult(_0x56ef4f,null))[_0x209d('0x38')](handleError(_0x56ef4f,null));};exports[_0x209d('0xcc')]=function(_0x3e12c3,_0x19d718,_0x2e82b4){var _0x516de7={'raw':![],'where':{}};var _0x4cd67f={};var _0x222679={'count':0x0,'rows':[]};return db[_0x209d('0x41')]['findOne']({'where':{'id':_0x3e12c3[_0x209d('0xc2')]['id']}})[_0x209d('0x2d')](handleEntityNotFound(_0x19d718,null))[_0x209d('0x2d')](function(_0x203d8f){if(_0x203d8f){_0x4cd67f[_0x209d('0x48')]=_[_0x209d('0xc3')](db[_0x209d('0xc9')][_0x209d('0x42')]);_0x4cd67f[_0x209d('0x45')]=_['keys'](_0x3e12c3[_0x209d('0x45')]);_0x4cd67f[_0x209d('0x46')]=_[_0x209d('0x47')](_0x4cd67f[_0x209d('0x48')],_0x4cd67f[_0x209d('0x45')]);_0x516de7[_0x209d('0x49')]=_['intersection'](_0x4cd67f['model'],qs['fields'](_0x3e12c3[_0x209d('0x45')][_0x209d('0x4a')]));_0x516de7[_0x209d('0x49')]=_0x516de7['attributes']['length']?_0x516de7[_0x209d('0x49')]:_0x4cd67f['model'];if(!_0x3e12c3[_0x209d('0x45')]['hasOwnProperty'](_0x209d('0x4d'))){_0x516de7[_0x209d('0x24')]=qs['limit'](_0x3e12c3['query'][_0x209d('0x24')]);_0x516de7['offset']=qs['offset'](_0x3e12c3[_0x209d('0x45')][_0x209d('0x26')]);}_0x516de7[_0x209d('0x4e')]=qs[_0x209d('0x4f')](_0x3e12c3[_0x209d('0x45')][_0x209d('0x4f')]);_0x516de7[_0x209d('0x50')]=qs[_0x209d('0x46')](_[_0x209d('0xcd')](_0x3e12c3['query'],_0x4cd67f[_0x209d('0x46')]));_0x516de7['where'][_0x209d('0xbf')]=_0x203d8f['id'];if(_0x3e12c3['query']['filter']){_0x516de7[_0x209d('0x50')]=_['merge'](_0x516de7[_0x209d('0x50')],{'$or':_[_0x209d('0x33')](_0x516de7[_0x209d('0x49')],function(_0x1669d7){var _0x12252e={};_0x12252e[_0x1669d7]={'$like':'%'+_0x3e12c3[_0x209d('0x45')][_0x209d('0x8e')]+'%'};return _0x12252e;})});}if(_0x3e12c3[_0x209d('0x45')][_0x209d('0xce')]){var _0x1d01c1=_0x3e12c3[_0x209d('0x45')][_0x209d('0xce')][_0x209d('0x77')](',');var _0x4e2e49={};_0x4e2e49[_0x1d01c1[0x0]]={'$gte':moment(_0x1d01c1[0x1])[_0x209d('0xcf')](_0x209d('0xd0'))};_0x516de7['where']=_[_0x209d('0xa8')](_0x516de7[_0x209d('0x50')],_0x4e2e49);}_0x516de7=_[_0x209d('0xa8')]({},_0x516de7,_0x3e12c3['options']);return db[_0x209d('0xc9')]['count']({'where':_0x516de7[_0x209d('0x50')]})['then'](function(_0x129b3d){_0x222679['count']=_0x129b3d;if(_0x3e12c3[_0x209d('0x45')]['includeAll']){_0x516de7[_0x209d('0xc4')]=[{'all':!![]}];}return db[_0x209d('0xc9')][_0x209d('0xd1')](_0x516de7);})[_0x209d('0x2d')](function(_0x2fff01){_0x222679[_0x209d('0xd2')]=_0x2fff01;return _0x222679;});}})['then'](respondWithFilteredResult(_0x19d718,_0x516de7))['catch'](handleError(_0x19d718,null));};exports['addTags']=function(_0x649259,_0xbe5f53,_0x32b7e5){return db['WhatsappInteraction'][_0x209d('0x74')]({'where':{'id':_0x649259[_0x209d('0xc2')]['id']}})[_0x209d('0x2d')](handleEntityNotFound(_0xbe5f53,null))[_0x209d('0x2d')](function(_0x3fee0c){if(_0x3fee0c){return _0x3fee0c['setTags'](_0x649259[_0x209d('0x7e')][_0x209d('0xca')],_[_0x209d('0xcb')](_0x649259[_0x209d('0x7e')],[_0x209d('0xca'),'id'])||{})[_0x209d('0xd3')](function(){return db[_0x209d('0xd4')]['findAll']({'attributes':['id','name',_0x209d('0xd5')],'where':{'id':_0x649259[_0x209d('0x7e')][_0x209d('0xca')]}});})['then'](function(_0x16b61a){socket[_0x209d('0xd6')](_0x209d('0xd7'),{'id':Number(_0x649259[_0x209d('0xc2')]['id']),'tags':_0x16b61a||[]});return{'id':Number(_0x649259[_0x209d('0xc2')]['id']),'tags':_0x16b61a||[]};});}})[_0x209d('0x2d')](respondWithResult(_0xbe5f53,null))[_0x209d('0x38')](handleError(_0xbe5f53,null));};exports[_0x209d('0xd8')]=function(_0x4fdcb0,_0x7fec75,_0x2db5c9){return db[_0x209d('0x41')][_0x209d('0x74')]({'where':{'id':_0x4fdcb0['params']['id']}})[_0x209d('0x2d')](handleEntityNotFound(_0x7fec75,null))[_0x209d('0x2d')](function(_0x297e00){if(_0x297e00){return _0x297e00[_0x209d('0xd8')](_0x4fdcb0[_0x209d('0x45')][_0x209d('0xca')]);}})[_0x209d('0x2d')](respondWithStatusCode(_0x7fec75,null))[_0x209d('0x38')](handleError(_0x7fec75,null));};exports[_0x209d('0xd9')]=function(_0xf24f42,_0x254a70){var _0x1bc029=moment()['unix']()[_0x209d('0xa5')]();var _0x1d9802=path[_0x209d('0xda')](config[_0x209d('0xdb')],'server','files',_0x209d('0xdc'));var _0x410ca4=path[_0x209d('0xda')](config[_0x209d('0xdb')],_0x209d('0xdd'),'files',_0x209d('0xde'));var _0x3d8a5f=path[_0x209d('0xda')](_0x1d9802,_0x1bc029);var _0x58e3f0=util[_0x209d('0xcf')](_0x209d('0xdf'),_0xf24f42[_0x209d('0xc2')]['id'],_0x1bc029);var _0x307be5=path['join'](_0x1d9802,_0x58e3f0);var _0x44c4f8=[];_0x44c4f8[_0x209d('0x37')]({'model':db[_0x209d('0x7a')],'as':'User','attributes':['id',_0x209d('0xe0')],'raw':!![]});_0x44c4f8['push']({'model':db[_0x209d('0xe1')],'as':_0x209d('0x6f'),'attributes':['id',_0x209d('0xe2'),_0x209d('0xe3')],'raw':!![]});if(_0xf24f42[_0x209d('0x45')][_0x209d('0xde')]){_0x44c4f8[_0x209d('0x37')]({'model':db[_0x209d('0xe4')],'as':_0x209d('0xe4'),'raw':!![]});}var _0x59c7dd=[{'model':db[_0x209d('0xc9')],'as':_0x209d('0xe5'),'attributes':['id','body','createdAt',_0x209d('0xe6'),_0x209d('0xe7'),_0x209d('0x8a')],'include':_0x44c4f8}];_0x59c7dd[_0x209d('0x37')]({'model':db[_0x209d('0xe8')],'as':_0x209d('0xe9'),'attributes':['id',_0x209d('0x31')]});_0x59c7dd[_0x209d('0x37')]({'model':db[_0x209d('0x7a')],'as':_0x209d('0xea'),'attributes':['id',_0x209d('0xe0')]});return db[_0x209d('0x41')][_0x209d('0x74')]({'where':{'id':_0xf24f42['params']['id']},'include':_0x59c7dd})[_0x209d('0x2d')](handleEntityNotFound(_0x254a70,null))[_0x209d('0x2d')](function(_0x190998){if(_0x190998){var _0x210e11=_0x190998[_0x209d('0xeb')]({'plain':!![]});fs[_0x209d('0xec')](_0x3d8a5f);var _0x1fb787={'channel':_0x209d('0xed'),'account':_0x210e11[_0x209d('0xe9')][_0x209d('0x31')],'agent':_0x210e11[_0x209d('0xea')]?_0x210e11[_0x209d('0xea')][_0x209d('0xe0')]:_0x209d('0xee'),'createdAt':moment(_0x210e11['createdAt'])[_0x209d('0xcf')](_0x209d('0xd0'))[_0x209d('0xa5')](),'closedAt':_0x210e11[_0x209d('0x3c')]?moment(_0x210e11[_0x209d('0xef')])[_0x209d('0xcf')](_0x209d('0xd0'))[_0x209d('0xa5')]():'','disposition':_0x210e11['disposition'],'messages':_(_0x210e11[_0x209d('0xe5')])[_0x209d('0x8e')]({'secret':![]})[_0x209d('0x33')](function(_0x1f42af){if(_0x1f42af[_0x209d('0xe4')]){var _0x5bd418=path[_0x209d('0xda')](_0x410ca4,_0x1f42af[_0x209d('0xe4')][_0x209d('0xf0')]);if(fs[_0x209d('0xf1')](_0x5bd418)){fs[_0x209d('0xf2')](_0x5bd418)['pipe'](fs[_0x209d('0xf3')](path[_0x209d('0xda')](_0x3d8a5f,_0x1f42af['Attachment'][_0x209d('0xf0')])));}}return{'date':moment(_0x1f42af[_0x209d('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x209d('0xa5')](),'sender':_0x1f42af[_0x209d('0xe6')]==='out'?_0x1f42af[_0x209d('0x7a')]?_0x1f42af['User']['fullname']:_0x209d('0xf4'):_0x1f42af['Contact'][_0x209d('0xe2')]+(_0x1f42af[_0x209d('0x6f')]['lastName']?'\x20'+_0x1f42af[_0x209d('0x6f')]['lastName']:''),'body':_0x1f42af[_0x209d('0xe4')]?_0x1f42af['Attachment'][_0x209d('0xf0')]:_0x1f42af[_0x209d('0x7e')],'direction':_0x1f42af[_0x209d('0xe6')]===_0x209d('0xf5')?'A':'C','secret':_0x1f42af['secret'],'read':_0x1f42af[_0x209d('0x8a')],'attachment':_0x1f42af[_0x209d('0xe4')]};})[_0x209d('0x6b')]()};return ejs[_0x209d('0xf6')](path[_0x209d('0xda')](config[_0x209d('0xdb')],_0x209d('0xdd'),'views','downloadInteraction.ejs'),{'interaction':_0x1fb787})[_0x209d('0x2d')](function(_0x31efaf){var _0x7cd0ec=path[_0x209d('0xda')](_0x3d8a5f,_0x209d('0xf7')+_0x210e11['id']+'-'+_0x1bc029+_0x209d('0xf8'));var _0x1da1b7={'path':_0x7cd0ec,'channel':_0x209d('0xed'),'interactionId':_0x210e11['id']};return pdf[_0x209d('0xf9')](_0x31efaf,_0x1da1b7);})['then'](function(){return new BPromise(function(_0x1e4cbb,_0x1d2678){zipdir(_0x3d8a5f,{'saveTo':_0x307be5},function(_0x4f3a09,_0x5026c1){if(_0x4f3a09)return _0x1d2678(_0x4f3a09);return _0x1e4cbb(_0x5026c1);});})[_0x209d('0x2d')](function(){return new BPromise(function(_0xcfa6e5,_0x58637d){rimraf(_0x3d8a5f,function(_0x19c857){if(_0x19c857)_0x58637d(_0x19c857);return _0xcfa6e5();});});})[_0x209d('0x2d')](function(){return _0x254a70[_0x209d('0xd9')](_0x307be5,_0x58e3f0,function(_0x45628c){if(_0x45628c){console['log']('err',_0x45628c);}else{fs[_0x209d('0xfa')](_0x307be5);}});});});}else{return _0x254a70['sendStatus'](0xc8);}})[_0x209d('0x38')](handleError(_0x254a70,null));}; \ No newline at end of file +var _0xf9e5=['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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','text','compact','isEmpty','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`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)','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)','order','contactName','DESC','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','includeAll','options','find','create','params','describe','addMessage','ids','omit','findOne','WhatsappMessage','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','addTags','Tag','findAll','removeTags','download','unix','join','server','files','tmp','root','attachments','CmContact','firstName','Attachment','direction','WhatsappAccount','Owner','mkdirSync','Account','N.A.','closedAt','disposition','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','lastName','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','Users','fullname','TagIds','split','forEach','Tags','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','map','WhatsappInteraction','rawAttributes','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','unreadMessages','value'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xf9e5,0x89));var _0x5f9e=function(_0x1c8e90,_0x285715){_0x1c8e90=_0x1c8e90-0x0;var _0x41b3ef=_0xf9e5[_0x1c8e90];return _0x41b3ef;};'use strict';var emlformat=require(_0x5f9e('0x0'));var rimraf=require(_0x5f9e('0x1'));var zipdir=require(_0x5f9e('0x2'));var jsonpatch=require(_0x5f9e('0x3'));var rp=require(_0x5f9e('0x4'));var moment=require(_0x5f9e('0x5'));var BPromise=require(_0x5f9e('0x6'));var Mustache=require('mustache');var util=require(_0x5f9e('0x7'));var path=require(_0x5f9e('0x8'));var sox=require('sox');var csv=require(_0x5f9e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9e('0xa'));var squel=require(_0x5f9e('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9e('0xc'));var deskjs=require(_0x5f9e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f9e('0xe'));var authService=require(_0x5f9e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5f9e('0x10'));var pdf=require(_0x5f9e('0x11'));var hardwareService=require(_0x5f9e('0x12'));var logger=require(_0x5f9e('0x13'))(_0x5f9e('0x14'));var utils=require('../../config/utils');var config=require(_0x5f9e('0x15'));var licenseUtil=require(_0x5f9e('0x16'));var db=require(_0x5f9e('0x17'))['db'];config[_0x5f9e('0x18')]=_['defaults'](config[_0x5f9e('0x18')],{'host':_0x5f9e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5f9e('0x1a'))[_0x5f9e('0x1b')](socket);function respondWithStatusCode(_0x1668eb,_0x490a62){_0x490a62=_0x490a62||0xcc;return function(_0x44efdd){if(_0x44efdd){return _0x1668eb[_0x5f9e('0x1c')](_0x490a62);}return _0x1668eb[_0x5f9e('0x1d')](_0x490a62)[_0x5f9e('0x1e')]();};}function respondWithResult(_0x5e3898,_0x449b52){_0x449b52=_0x449b52||0xc8;return function(_0x293fe2){if(_0x293fe2){return _0x5e3898['status'](_0x449b52)['json'](_0x293fe2);}};}function respondWithFilteredResult(_0x2c342b,_0x5891a2){return function(_0x5d3588){if(_0x5d3588){var _0x1a81c0=typeof _0x5891a2[_0x5f9e('0x1f')]==='undefined'&&typeof _0x5891a2[_0x5f9e('0x20')]==='undefined';var _0x26a26d=_0x5d3588[_0x5f9e('0x21')];var _0x53a2f2=_0x1a81c0?0x0:_0x5891a2[_0x5f9e('0x1f')];var _0x357f8c=_0x1a81c0?_0x5d3588[_0x5f9e('0x21')]:_0x5891a2[_0x5f9e('0x1f')]+_0x5891a2[_0x5f9e('0x20')];var _0x2b445c;if(_0x357f8c>=_0x26a26d){_0x357f8c=_0x26a26d;_0x2b445c=0xc8;}else{_0x2b445c=0xce;}_0x2c342b[_0x5f9e('0x1d')](_0x2b445c);return _0x2c342b['set'](_0x5f9e('0x22'),_0x53a2f2+'-'+_0x357f8c+'/'+_0x26a26d)[_0x5f9e('0x23')](_0x5d3588);}return null;};}function patchUpdates(_0x5c3ca1){return function(_0x54c375){try{jsonpatch[_0x5f9e('0x24')](_0x54c375,_0x5c3ca1,!![]);}catch(_0x573dbe){return BPromise[_0x5f9e('0x25')](_0x573dbe);}return _0x54c375[_0x5f9e('0x26')]();};}function saveUpdates(_0x4c91cf,_0x5abc1a){return function(_0x549392){if(_0x549392){return _0x549392['update'](_0x4c91cf)[_0x5f9e('0x27')](function(_0x3b14a9){return _0x3b14a9;});}return null;};}function removeEntity(_0x5b1509,_0x53557e){return function(_0x4102a5){if(_0x4102a5){return _0x4102a5[_0x5f9e('0x28')]()[_0x5f9e('0x27')](function(){_0x5b1509[_0x5f9e('0x1d')](0xcc)[_0x5f9e('0x1e')]();});}};}function handleEntityNotFound(_0x1c459f,_0xfde2d4){return function(_0x5e53bd){if(!_0x5e53bd){_0x1c459f[_0x5f9e('0x1c')](0x194);}return _0x5e53bd;};}function handleError(_0xee41d1,_0x342ac2){_0x342ac2=_0x342ac2||0x1f4;return function(_0x10e8bf){logger[_0x5f9e('0x29')](_0x10e8bf[_0x5f9e('0x2a')]);if(_0x10e8bf['name']){delete _0x10e8bf['name'];}_0xee41d1[_0x5f9e('0x1d')](_0x342ac2)['send'](_0x10e8bf);};}function getInteractionUsers(_0x546274,_0x44ed1f){return new BPromise(function(_0x5a7594,_0x3325ea){try{if(_0x44ed1f[_0x546274['id']]){_0x546274[_0x5f9e('0x2b')]=_['map'](_0x44ed1f[_0x546274['id']],function(_0x1dd402){return{'id':_0x1dd402['id'],'fullname':_0x1dd402[_0x5f9e('0x2c')]};});}}catch(_0x1bfa91){_0x3325ea(_0x1bfa91);}_0x5a7594(_0x546274);});}function getInteractionTags(_0x4acb8a,_0x12d043){return new BPromise(function(_0x51155c,_0x32ccd9){try{if(_0x4acb8a[_0x5f9e('0x2d')]){_0x4acb8a['Tags']=[];_0x4acb8a[_0x5f9e('0x2d')][_0x5f9e('0x2e')](',')[_0x5f9e('0x2f')](function(_0x3277db){_0x4acb8a[_0x5f9e('0x30')][_0x5f9e('0x31')](_0x12d043[_0x3277db]);});}delete _0x4acb8a['TagIds'];}catch(_0x35e978){_0x32ccd9(_0x35e978);}_0x51155c(_0x4acb8a);});}function updateWhatsappInteraction(_0x3bab2e,_0x45afdb,_0x429eff){return new BPromise(function(_0x2e5887,_0x4c7221){return getInteractionUsers(_0x3bab2e,_0x429eff)[_0x5f9e('0x27')](function(_0x3de596){return getInteractionTags(_0x3de596,_0x45afdb);})['then'](function(_0x99afda){return getStateInteraction(_0x99afda);})[_0x5f9e('0x27')](function(_0x425217){_0x2e5887(_0x425217);})[_0x5f9e('0x32')](function(_0xf36fe5){_0x4c7221(_0xf36fe5);});});}function getStateInteraction(_0x12c697){return new BPromise(function(_0x4968ec){_0x12c697[_0x5f9e('0x33')]=0x0;_0x12c697[_0x5f9e('0x34')]=0x0;_0x12c697['answered']=0x0;_0x12c697[_0x5f9e('0x35')]=0x0;_0x12c697[_0x5f9e('0x36')]=0x0;if(!_0x12c697[_0x5f9e('0x37')]&&!_0x12c697[_0x5f9e('0x38')]){_0x12c697[_0x5f9e('0x33')]+=0x1;}if(!_0x12c697['closed']&&_0x12c697[_0x5f9e('0x38')]){_0x12c697[_0x5f9e('0x34')]+=0x1;if(_0x12c697[_0x5f9e('0x33')]){_0x12c697['waiting']-=0x1;}}if(_0x12c697[_0x5f9e('0x37')]&&_0x12c697['UserId']){_0x12c697[_0x5f9e('0x39')]+=0x1;if(_0x12c697['talking']){_0x12c697[_0x5f9e('0x34')]-=0x1;}}if(_0x12c697[_0x5f9e('0x37')]&&!_0x12c697[_0x5f9e('0x38')]){_0x12c697[_0x5f9e('0x35')]+=0x1;if(_0x12c697[_0x5f9e('0x33')]){_0x12c697[_0x5f9e('0x33')]-=0x1;}}_0x12c697[_0x5f9e('0x36')]+=0x1;_0x4968ec(_0x12c697);});}exports[_0x5f9e('0x3a')]=function(_0x3d0a92,_0x590ed8){var _0xaffb65={},_0x385936={},_0x35c452={'count':0x0,'rows':[]};var _0x2d83fe=_[_0x5f9e('0x3b')](db[_0x5f9e('0x3c')][_0x5f9e('0x3d')],function(_0x7881b3){return{'name':_0x7881b3['fieldName'],'type':_0x7881b3[_0x5f9e('0x3e')][_0x5f9e('0x3f')]};});_0x385936[_0x5f9e('0x40')]=_['map'](_0x2d83fe,_0x5f9e('0x41'));_0x385936[_0x5f9e('0x42')]=_[_0x5f9e('0x43')](_0x3d0a92['query']);_0x385936['filters']=_[_0x5f9e('0x44')](_0x385936['model'],_0x385936[_0x5f9e('0x42')]);_0xaffb65[_0x5f9e('0x45')]=_[_0x5f9e('0x44')](_0x385936[_0x5f9e('0x40')],qs['fields'](_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x46')]));_0xaffb65['attributes']=_0xaffb65[_0x5f9e('0x45')][_0x5f9e('0x47')]?_0xaffb65[_0x5f9e('0x45')]:_0x385936['model'];if(!_0x3d0a92[_0x5f9e('0x42')]['hasOwnProperty'](_0x5f9e('0x48'))){_0xaffb65['limit']=qs[_0x5f9e('0x20')](_0x3d0a92[_0x5f9e('0x42')]['limit']);_0xaffb65[_0x5f9e('0x1f')]=qs[_0x5f9e('0x1f')](_0x3d0a92[_0x5f9e('0x42')]['offset']);}_0xaffb65['order']=qs[_0x5f9e('0x49')](_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x49')]);_0xaffb65[_0x5f9e('0x4a')]=qs[_0x5f9e('0x4b')](_[_0x5f9e('0x4c')](_0x3d0a92[_0x5f9e('0x42')],_0x385936[_0x5f9e('0x4b')]),_0x2d83fe);var _0x2098bd=[];var _0x1069bd=squel['select']()['field']('id')['field']('name')[_0x5f9e('0x4d')](_0x5f9e('0x4e'))[_0x5f9e('0x4f')](_0x5f9e('0x50'));var _0x162b23=squel[_0x5f9e('0x51')]()[_0x5f9e('0x4d')](_0x5f9e('0x52'))[_0x5f9e('0x4d')](_0x5f9e('0x53'))[_0x5f9e('0x4d')]('ui.WhatsappInteractionId')['from'](_0x5f9e('0x54'),'ui')[_0x5f9e('0x55')](_0x5f9e('0x56'),'u',_0x5f9e('0x57'));var _0x59d7ca=squel[_0x5f9e('0x51')]()[_0x5f9e('0x4f')](_0x5f9e('0x58'),'i')[_0x5f9e('0x55')](_0x5f9e('0x59'),'c',_0x5f9e('0x5a'))[_0x5f9e('0x55')](_0x5f9e('0x56'),'o','o.id\x20=\x20i.UserId')[_0x5f9e('0x55')](_0x5f9e('0x5b'),'a',_0x5f9e('0x5c'))[_0x5f9e('0x55')](_0x5f9e('0x5d'),'me',_0x5f9e('0x5e'))[_0x5f9e('0x55')](_0x5f9e('0x5f'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x5f9e('0x50'),'t',_0x5f9e('0x60'));var _0x402a1c=squel[_0x5f9e('0x61')]();var _0x6537f5=[];var _0x183677=squel['expr']();var _0x8c969;if(_0x3d0a92[_0x5f9e('0x42')]['search']){_0x8c969=as[_0x5f9e('0x62')](_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x63')]);var _0x4e3427=_0x8c969['sqlOperator'];for(var _0x52afb9=0x0;_0x52afb9<_0x8c969[_0x5f9e('0x64')][_0x5f9e('0x47')];_0x52afb9++){var _0x38b44a=_0x8c969[_0x5f9e('0x64')][_0x52afb9];var _0x1a2da3='i';var _0xa30097=_['find'](_0x2d83fe,[_0x5f9e('0x41'),_0x38b44a[_0x5f9e('0x4d')]]);if(!_0xa30097){switch(_0x38b44a[_0x5f9e('0x4d')]){case _0x5f9e('0x65'):if(_0x38b44a[_0x5f9e('0x66')]==0x1){_0x59d7ca[_0x5f9e('0x67')]('`'+_0x38b44a[_0x5f9e('0x4d')]+_0x5f9e('0x68'));}else{_0x59d7ca[_0x5f9e('0x67')]('`'+_0x38b44a[_0x5f9e('0x4d')]+_0x5f9e('0x69'));}break;case _0x5f9e('0x6a'):if(_0x38b44a['operator']===_0x5f9e('0x6b')){if(_0x38b44a[_0x5f9e('0x66')]['split']('\x20')['length']>0x1){_0x402a1c[_0x4e3427](_0x5f9e('0x6c'),qs['getFullTextValue'](_0x38b44a[_0x5f9e('0x66')]),null);}else{var _0x3891ce='%'+_0x38b44a['value']+'%';_0x402a1c[_0x4e3427](_0x5f9e('0x6d'),_0x3891ce,_0x3891ce,_0x3891ce);}}else{_0xa30097=_['find'](_0x2d83fe,[_0x5f9e('0x41'),_0x5f9e('0x6e')]);_0x38b44a[_0x5f9e('0x4d')]=_0x5f9e('0x6e');_0x425bf9=as[_0x5f9e('0x6f')](_0x1a2da3,_0xa30097[_0x5f9e('0x3e')],_0x38b44a);_0x402a1c[_0x4e3427](_0x425bf9['text'],_0x425bf9[_0x5f9e('0x66')]['start'],_0x425bf9[_0x5f9e('0x66')][_0x5f9e('0x1e')]);}break;case'Tag':var _0x167beb=_0x38b44a['value'][_0x5f9e('0x2e')](',')[_0x5f9e('0x3b')](function(_0x1bf184){return Number(_0x1bf184);});_0x167beb[_0x5f9e('0x2f')](function(_0x4abeca){_0x183677['or'](_0x5f9e('0x70'),'%,'+_0x4abeca+',%');});_0x6537f5=_[_0x5f9e('0x71')](_0x6537f5,_0x167beb);break;case _0x5f9e('0x72'):if(_0x38b44a['operator']==='$substring'){_0x402a1c[_0x4e3427](_0x5f9e('0x73'),'%'+_0x38b44a[_0x5f9e('0x66')]+'%',null);}else{_0xa30097=_['find'](_0x2d83fe,[_0x5f9e('0x41'),_0x5f9e('0x38')]);_0x38b44a[_0x5f9e('0x4d')]=_0x5f9e('0x38');_0x425bf9=as['buildExpression'](_0x1a2da3,_0xa30097[_0x5f9e('0x3e')],_0x38b44a);_0x402a1c[_0x4e3427](_0x425bf9['text'],_0x425bf9['value'][_0x5f9e('0x74')],_0x425bf9[_0x5f9e('0x66')][_0x5f9e('0x1e')]);}break;case _0x5f9e('0x75'):_0x425bf9=as[_0x5f9e('0x6f')]('me',null,_0x38b44a);_0x402a1c[_0x4e3427](_0x425bf9[_0x5f9e('0x76')],_0x425bf9[_0x5f9e('0x66')][_0x5f9e('0x74')],_0x425bf9[_0x5f9e('0x66')][_0x5f9e('0x1e')]);break;}}else{var _0x425bf9=as['buildExpression'](_0x1a2da3,_0xa30097[_0x5f9e('0x3e')],_0x38b44a);_0x402a1c[_0x4e3427](_0x425bf9[_0x5f9e('0x76')],_0x425bf9[_0x5f9e('0x66')]['start'],_0x425bf9['value'][_0x5f9e('0x1e')]);}}}else{var _0x497a7c=_(_0x3d0a92[_0x5f9e('0x42')])['keys']()['map'](function(_0x8188a1){return _['some'](_0x2d83fe,['name',_0x8188a1])?_0x8188a1:undefined;})[_0x5f9e('0x77')]()[_0x5f9e('0x66')]();if(!_[_0x5f9e('0x78')](_0x497a7c)){_0x497a7c[_0x5f9e('0x2f')](function(_0x574ad7){if(_0x574ad7==='WhatsappAccountId'){_0x59d7ca['where']('i.WhatsappAccountId\x20IN\x20?',[][_0x5f9e('0x79')](_0x3d0a92[_0x5f9e('0x42')][_0x574ad7]));}else if(_0x574ad7===_0x5f9e('0x7a')){var _0x3527c9=JSON['parse'](_0x3d0a92['query'][_0x574ad7])[_0x5f9e('0x7b')];var _0x4344bf=JSON[_0x5f9e('0x7c')](_0x3d0a92[_0x5f9e('0x42')][_0x574ad7])['$lte'];_0x59d7ca[_0x5f9e('0x4a')](_0x5f9e('0x7d'),_0x3527c9,_0x4344bf);}else{if(_0x3d0a92[_0x5f9e('0x42')][_0x574ad7]==='null'){_0x59d7ca['where']('i.'+_0x574ad7+_0x5f9e('0x7e'));}else{_0x59d7ca[_0x5f9e('0x4a')]('i.'+_0x574ad7+_0x5f9e('0x7f'),_0x3d0a92[_0x5f9e('0x42')][_0x574ad7]);}}});}if(_0x3d0a92['query'][_0x5f9e('0x80')]){if(_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x80')]==0x1){_0x59d7ca[_0x5f9e('0x67')](_0x5f9e('0x81'));}else{_0x59d7ca['having'](_0x5f9e('0x82'));}}if(_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x83')]){_0x6537f5=_[_0x5f9e('0x84')](_0x3d0a92['query'][_0x5f9e('0x83')])?_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x83')]:new Array(_0x3d0a92['query'][_0x5f9e('0x83')]);_0x6537f5['forEach'](function(_0x2211ad){_0x183677['or'](_0x5f9e('0x70'),'%,'+_0x2211ad+',%');});}if(_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x85')]){var _0x106527=_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x85')][_0x5f9e('0x86')]('\x5c','\x5c\x5c')[_0x5f9e('0x86')](/'/g,'\x27\x27');if(qs[_0x5f9e('0x87')](_0x106527)){_0x402a1c['or'](_0x5f9e('0x88'),_0x106527+'%')['or'](_0x5f9e('0x89'),_0x106527+'%');}else{_0x402a1c['or'](_0x5f9e('0x8a'),qs[_0x5f9e('0x8b')](_0x106527))['or'](_0x5f9e('0x8c'),_0x106527+'%');}}}_0x59d7ca[_0x5f9e('0x4a')](_0x402a1c);_0x59d7ca[_0x5f9e('0x8d')]('i.id');var _0x587e95={'type':db[_0x5f9e('0x8e')]['QueryTypes'][_0x5f9e('0x8f')],'raw':!![]};var _0x3d114d=_0x59d7ca[_0x5f9e('0x90')]();_0x3d114d[_0x5f9e('0x4d')](_0x5f9e('0x91'));_0x3d114d['field'](_0x5f9e('0x92'),_0x5f9e('0x65'));if(_0xaffb65[_0x5f9e('0x93')]){_0xaffb65[_0x5f9e('0x93')]['forEach'](function(_0x2afef5){var _0x2da9dd=_0x2afef5[0x0]===_0x5f9e('0x94')?_0x2afef5[0x0]:'i.'+_0x2afef5[0x0];_0x59d7ca[_0x5f9e('0x93')](_0x2da9dd,_0x2afef5[0x1]===_0x5f9e('0x95')?![]:!![]);});}if(!_[_0x5f9e('0x78')](_0x6537f5)){_0x59d7ca[_0x5f9e('0x67')](_0x183677);_0x3d114d[_0x5f9e('0x4a')]('t.id\x20IN\x20?',_0x6537f5);}BPromise[_0x5f9e('0x96')]()['then'](function(){if(!_0x8c969){if(_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x97')])return;_0x3d114d[_0x5f9e('0x4a')](_0x5f9e('0x98'));_0x59d7ca[_0x5f9e('0x4a')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3d0a92[_0x5f9e('0x99')][_0x5f9e('0x9a')]!=='agent')return;return _0x3d0a92[_0x5f9e('0x99')][_0x5f9e('0x9b')]({'attributes':['id'],'raw':!![]})[_0x5f9e('0x27')](function(_0x54389f){if(_[_0x5f9e('0x78')](_0x54389f)){_0x3d114d['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x59d7ca[_0x5f9e('0x4a')](_0x5f9e('0x9c'));}else{_0x3d114d[_0x5f9e('0x4a')](_0x5f9e('0x9d'),_[_0x5f9e('0x3b')](_0x54389f,'id'));_0x59d7ca['where'](_0x5f9e('0x9d'),_[_0x5f9e('0x3b')](_0x54389f,'id'));}});})[_0x5f9e('0x27')](function(){if(_0x3d0a92[_0x5f9e('0x99')][_0x5f9e('0x9a')]===_0x5f9e('0x9e')&&!_0x8c969&&!_0x3d0a92[_0x5f9e('0x42')][_0x5f9e('0x97')])return[];return db[_0x5f9e('0x9f')][_0x5f9e('0x42')](_0x3d114d[_0x5f9e('0xa0')](),_0x587e95);})[_0x5f9e('0x27')](function(_0x1e8d40){_0x35c452[_0x5f9e('0x21')]=_0x1e8d40[_0x5f9e('0x47')];if(_0x35c452[_0x5f9e('0x21')]===0x0)return[];return db[_0x5f9e('0x9f')]['query'](_0x1069bd[_0x5f9e('0xa0')](),_0x587e95)['then'](function(_0x588479){_0x2098bd=_[_0x5f9e('0xa1')](_0x588479,'id');_0x587e95=_[_0x5f9e('0xa2')](_0x587e95,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d0a92['query']['fields']){_0xaffb65[_0x5f9e('0x45')]['forEach'](function(_0x1eb33a){_0x59d7ca[_0x5f9e('0x4d')]('i.'+_0x1eb33a);});}else{_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0x92'),_0x5f9e('0x65'));_0x59d7ca[_0x5f9e('0x4d')]('a.key',_0x5f9e('0xa3'));_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xa4'),_0x5f9e('0xa5'));_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xa6'),_0x5f9e('0x94'));_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xa7'));_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xa8'),_0x5f9e('0xa9'));_0x59d7ca[_0x5f9e('0x4d')]('c.lastName',_0x5f9e('0xaa'));_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xab'),_0x5f9e('0xac'));_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xad'),_0x5f9e('0xae'));_0x59d7ca['field'](_0x5f9e('0xaf'),_0x5f9e('0xb0'));_0x59d7ca['field'](_0x5f9e('0xb1'),_0x5f9e('0xb2'));_0x59d7ca['field']('o.fullname','Owner.fullname');_0x59d7ca[_0x5f9e('0x4d')](_0x5f9e('0xb3'),_0x5f9e('0xb4'));_0x59d7ca['field'](_0x5f9e('0xb5'),_0x5f9e('0x2d'));}if(_0xaffb65[_0x5f9e('0x20')])_0x59d7ca['limit'](_0xaffb65[_0x5f9e('0x20')]);if(_0xaffb65[_0x5f9e('0x1f')])_0x59d7ca[_0x5f9e('0x1f')](_0xaffb65[_0x5f9e('0x1f')]);return db['sequelize'][_0x5f9e('0x42')](_0x59d7ca[_0x5f9e('0xa0')](),_0x587e95);})[_0x5f9e('0x27')](function(_0x35b6fe){if(_0x35b6fe[_0x5f9e('0x47')]>0x0)_0x162b23['where'](_0x5f9e('0xb6'),_[_0x5f9e('0x3b')](_0x35b6fe,'id'));return db[_0x5f9e('0x9f')][_0x5f9e('0x42')](_0x162b23['toString'](),_0x587e95)[_0x5f9e('0x27')](function(_0x3761fd){var _0x1b510b=_[_0x5f9e('0xb7')](_0x3761fd,_0x5f9e('0xb8'));var _0x27691a=[];_0x35b6fe['forEach'](function(_0x2dec8c){_0x27691a[_0x5f9e('0x31')](updateWhatsappInteraction(_0x2dec8c,_0x2098bd,_0x1b510b));});return BPromise['all'](_0x27691a);});});})['then'](function(_0x1e9022){_0x35c452['rows']=_0x1e9022;return _0x35c452;})[_0x5f9e('0x27')](respondWithFilteredResult(_0x590ed8,_0xaffb65))[_0x5f9e('0x32')](handleError(_0x590ed8,null));};exports['show']=function(_0x3d901e,_0x2381da){var _0x4fdb14={'raw':![],'where':{'id':_0x3d901e['params']['id']}},_0x7f9f89={};_0x7f9f89[_0x5f9e('0x40')]=_[_0x5f9e('0x43')](db[_0x5f9e('0x3c')]['rawAttributes']);_0x7f9f89[_0x5f9e('0x42')]=_[_0x5f9e('0x43')](_0x3d901e[_0x5f9e('0x42')]);_0x7f9f89[_0x5f9e('0x4b')]=_[_0x5f9e('0x44')](_0x7f9f89[_0x5f9e('0x40')],_0x7f9f89[_0x5f9e('0x42')]);_0x4fdb14[_0x5f9e('0x45')]=_[_0x5f9e('0x44')](_0x7f9f89['model'],qs['fields'](_0x3d901e[_0x5f9e('0x42')][_0x5f9e('0x46')]));_0x4fdb14['attributes']=_0x4fdb14[_0x5f9e('0x45')][_0x5f9e('0x47')]?_0x4fdb14[_0x5f9e('0x45')]:_0x7f9f89[_0x5f9e('0x40')];if(_0x3d901e['query'][_0x5f9e('0xb9')]){_0x4fdb14['include']=[{'all':!![]}];}_0x4fdb14=_[_0x5f9e('0xa2')]({},_0x4fdb14,_0x3d901e[_0x5f9e('0xba')]);return db[_0x5f9e('0x3c')][_0x5f9e('0xbb')](_0x4fdb14)[_0x5f9e('0x27')](handleEntityNotFound(_0x2381da,null))[_0x5f9e('0x27')](respondWithResult(_0x2381da,null))[_0x5f9e('0x32')](handleError(_0x2381da,null));};exports[_0x5f9e('0xbc')]=function(_0xdf88a1,_0xa7aea5){return db[_0x5f9e('0x3c')]['create'](_0xdf88a1[_0x5f9e('0x75')],{})[_0x5f9e('0x27')](respondWithResult(_0xa7aea5,0xc9))[_0x5f9e('0x32')](handleError(_0xa7aea5,null));};exports['update']=function(_0xfdcab0,_0x183ab3){if(_0xfdcab0[_0x5f9e('0x75')]['id']){delete _0xfdcab0[_0x5f9e('0x75')]['id'];}return db[_0x5f9e('0x3c')]['find']({'where':{'id':_0xfdcab0[_0x5f9e('0xbd')]['id']}})['then'](handleEntityNotFound(_0x183ab3,null))[_0x5f9e('0x27')](saveUpdates(_0xfdcab0[_0x5f9e('0x75')],null))[_0x5f9e('0x27')](respondWithResult(_0x183ab3,null))[_0x5f9e('0x32')](handleError(_0x183ab3,null));};exports[_0x5f9e('0x28')]=function(_0x2dfe1b,_0x53e1a2){return db[_0x5f9e('0x3c')][_0x5f9e('0xbb')]({'where':{'id':_0x2dfe1b[_0x5f9e('0xbd')]['id']}})[_0x5f9e('0x27')](handleEntityNotFound(_0x53e1a2,null))['then'](removeEntity(_0x53e1a2,null))[_0x5f9e('0x32')](handleError(_0x53e1a2,null));};exports[_0x5f9e('0xbe')]=function(_0x3d22de,_0x8caf02){return db[_0x5f9e('0x3c')][_0x5f9e('0xbe')]()[_0x5f9e('0x27')](respondWithResult(_0x8caf02,null))[_0x5f9e('0x32')](handleError(_0x8caf02,null));};exports[_0x5f9e('0xbf')]=function(_0x23997a,_0x245633,_0x456d7d){return db['WhatsappMessage']['find']({'where':{'id':_0x23997a['params']['id']}})[_0x5f9e('0x27')](handleEntityNotFound(_0x245633,null))['then'](function(_0xf3bae4){if(_0xf3bae4){return _0xf3bae4[_0x5f9e('0xbf')](_0x23997a[_0x5f9e('0x75')][_0x5f9e('0xc0')],_[_0x5f9e('0xc1')](_0x23997a[_0x5f9e('0x75')],[_0x5f9e('0xc0'),'id'])||{});}})[_0x5f9e('0x27')](respondWithResult(_0x245633,null))[_0x5f9e('0x32')](handleError(_0x245633,null));};exports['getMessages']=function(_0x124014,_0x1428b8,_0xbe7de6){var _0x356c7b={'raw':![],'where':{}};var _0x44c1c9={};var _0x55815d={'count':0x0,'rows':[]};return db[_0x5f9e('0x3c')][_0x5f9e('0xc2')]({'where':{'id':_0x124014[_0x5f9e('0xbd')]['id']}})[_0x5f9e('0x27')](handleEntityNotFound(_0x1428b8,null))[_0x5f9e('0x27')](function(_0x5a632e){if(_0x5a632e){_0x44c1c9[_0x5f9e('0x40')]=_[_0x5f9e('0x43')](db[_0x5f9e('0xc3')][_0x5f9e('0x3d')]);_0x44c1c9[_0x5f9e('0x42')]=_[_0x5f9e('0x43')](_0x124014[_0x5f9e('0x42')]);_0x44c1c9[_0x5f9e('0x4b')]=_['intersection'](_0x44c1c9[_0x5f9e('0x40')],_0x44c1c9[_0x5f9e('0x42')]);_0x356c7b[_0x5f9e('0x45')]=_[_0x5f9e('0x44')](_0x44c1c9[_0x5f9e('0x40')],qs[_0x5f9e('0x46')](_0x124014[_0x5f9e('0x42')][_0x5f9e('0x46')]));_0x356c7b[_0x5f9e('0x45')]=_0x356c7b[_0x5f9e('0x45')][_0x5f9e('0x47')]?_0x356c7b[_0x5f9e('0x45')]:_0x44c1c9[_0x5f9e('0x40')];if(!_0x124014['query'][_0x5f9e('0xc4')](_0x5f9e('0x48'))){_0x356c7b[_0x5f9e('0x20')]=qs[_0x5f9e('0x20')](_0x124014[_0x5f9e('0x42')][_0x5f9e('0x20')]);_0x356c7b['offset']=qs['offset'](_0x124014[_0x5f9e('0x42')][_0x5f9e('0x1f')]);}_0x356c7b[_0x5f9e('0x93')]=qs[_0x5f9e('0x49')](_0x124014[_0x5f9e('0x42')][_0x5f9e('0x49')]);_0x356c7b[_0x5f9e('0x4a')]=qs[_0x5f9e('0x4b')](_[_0x5f9e('0x4c')](_0x124014[_0x5f9e('0x42')],_0x44c1c9['filters']));_0x356c7b['where']['WhatsappInteractionId']=_0x5a632e['id'];if(_0x124014[_0x5f9e('0x42')][_0x5f9e('0x85')]){_0x356c7b[_0x5f9e('0x4a')]=_['merge'](_0x356c7b[_0x5f9e('0x4a')],{'$or':_[_0x5f9e('0x3b')](_0x356c7b[_0x5f9e('0x45')],function(_0x4b930e){var _0x45282c={};_0x45282c[_0x4b930e]={'$like':'%'+_0x124014['query'][_0x5f9e('0x85')]+'%'};return _0x45282c;})});}if(_0x124014[_0x5f9e('0x42')]['$gte']){var _0x2ca84f=_0x124014['query'][_0x5f9e('0x7b')][_0x5f9e('0x2e')](',');var _0x529997={};_0x529997[_0x2ca84f[0x0]]={'$gte':moment(_0x2ca84f[0x1])[_0x5f9e('0xc5')](_0x5f9e('0xc6'))};_0x356c7b[_0x5f9e('0x4a')]=_[_0x5f9e('0xa2')](_0x356c7b[_0x5f9e('0x4a')],_0x529997);}_0x356c7b=_['merge']({},_0x356c7b,_0x124014[_0x5f9e('0xba')]);return db['WhatsappMessage'][_0x5f9e('0x21')]({'where':_0x356c7b[_0x5f9e('0x4a')]})['then'](function(_0xce9a7c){_0x55815d['count']=_0xce9a7c;if(_0x124014[_0x5f9e('0x42')][_0x5f9e('0xb9')]){_0x356c7b['include']=[{'all':!![]}];}return db[_0x5f9e('0xc3')]['findAll'](_0x356c7b);})[_0x5f9e('0x27')](function(_0x3dc344){_0x55815d['rows']=_0x3dc344;return _0x55815d;});}})['then'](respondWithFilteredResult(_0x1428b8,_0x356c7b))[_0x5f9e('0x32')](handleError(_0x1428b8,null));};exports[_0x5f9e('0xc7')]=function(_0xb051ca,_0x244551,_0x1d4b16){return db['WhatsappInteraction'][_0x5f9e('0xbb')]({'where':{'id':_0xb051ca[_0x5f9e('0xbd')]['id']}})['then'](handleEntityNotFound(_0x244551,null))[_0x5f9e('0x27')](function(_0x14d965){if(_0x14d965){return _0x14d965['setTags'](_0xb051ca[_0x5f9e('0x75')][_0x5f9e('0xc0')],_[_0x5f9e('0xc1')](_0xb051ca[_0x5f9e('0x75')],[_0x5f9e('0xc0'),'id'])||{})['spread'](function(){return db[_0x5f9e('0xc8')][_0x5f9e('0xc9')]({'attributes':['id','name',_0x5f9e('0x4e')],'where':{'id':_0xb051ca[_0x5f9e('0x75')][_0x5f9e('0xc0')]}});})[_0x5f9e('0x27')](function(_0x40ba8d){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0xb051ca[_0x5f9e('0xbd')]['id']),'tags':_0x40ba8d||[]});return{'id':Number(_0xb051ca[_0x5f9e('0xbd')]['id']),'tags':_0x40ba8d||[]};});}})[_0x5f9e('0x27')](respondWithResult(_0x244551,null))[_0x5f9e('0x32')](handleError(_0x244551,null));};exports['removeTags']=function(_0x3a9daa,_0x1d8a46,_0x2c181d){return db[_0x5f9e('0x3c')][_0x5f9e('0xbb')]({'where':{'id':_0x3a9daa[_0x5f9e('0xbd')]['id']}})[_0x5f9e('0x27')](handleEntityNotFound(_0x1d8a46,null))[_0x5f9e('0x27')](function(_0x4b9831){if(_0x4b9831){return _0x4b9831[_0x5f9e('0xca')](_0x3a9daa['query'][_0x5f9e('0xc0')]);}})['then'](respondWithStatusCode(_0x1d8a46,null))[_0x5f9e('0x32')](handleError(_0x1d8a46,null));};exports[_0x5f9e('0xcb')]=function(_0x4b8400,_0x224169){var _0xee6d79=moment()[_0x5f9e('0xcc')]()[_0x5f9e('0xa0')]();var _0x38a75a=path[_0x5f9e('0xcd')](config['root'],_0x5f9e('0xce'),_0x5f9e('0xcf'),_0x5f9e('0xd0'));var _0x15d2cd=path[_0x5f9e('0xcd')](config[_0x5f9e('0xd1')],_0x5f9e('0xce'),_0x5f9e('0xcf'),_0x5f9e('0xd2'));var _0x579ee7=path['join'](_0x38a75a,_0xee6d79);var _0x29802a=util[_0x5f9e('0xc5')]('transcript-%d-%s.zip',_0x4b8400['params']['id'],_0xee6d79);var _0x3d656b=path[_0x5f9e('0xcd')](_0x38a75a,_0x29802a);var _0x2d678b=[];_0x2d678b[_0x5f9e('0x31')]({'model':db[_0x5f9e('0x72')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2d678b['push']({'model':db[_0x5f9e('0xd3')],'as':'Contact','attributes':['id',_0x5f9e('0xd4'),'lastName'],'raw':!![]});if(_0x4b8400[_0x5f9e('0x42')][_0x5f9e('0xd2')]){_0x2d678b[_0x5f9e('0x31')]({'model':db['Attachment'],'as':_0x5f9e('0xd5'),'raw':!![]});}var _0x57e948=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body','createdAt',_0x5f9e('0xd6'),'secret',_0x5f9e('0x80')],'include':_0x2d678b}];_0x57e948['push']({'model':db[_0x5f9e('0xd7')],'as':'Account','attributes':['id','name']});_0x57e948['push']({'model':db[_0x5f9e('0x72')],'as':_0x5f9e('0xd8'),'attributes':['id','fullname']});return db[_0x5f9e('0x3c')][_0x5f9e('0xbb')]({'where':{'id':_0x4b8400['params']['id']},'include':_0x57e948})[_0x5f9e('0x27')](handleEntityNotFound(_0x224169,null))[_0x5f9e('0x27')](function(_0x6297c){if(_0x6297c){var _0x131155=_0x6297c['get']({'plain':!![]});fs[_0x5f9e('0xd9')](_0x579ee7);var _0x524dae={'channel':'Whatsapp','account':_0x131155[_0x5f9e('0xda')][_0x5f9e('0x41')],'agent':_0x131155[_0x5f9e('0xd8')]?_0x131155[_0x5f9e('0xd8')][_0x5f9e('0x2c')]:_0x5f9e('0xdb'),'createdAt':moment(_0x131155['createdAt'])['format'](_0x5f9e('0xc6'))[_0x5f9e('0xa0')](),'closedAt':_0x131155[_0x5f9e('0x37')]?moment(_0x131155[_0x5f9e('0xdc')])[_0x5f9e('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x131155[_0x5f9e('0xdd')],'messages':_(_0x131155[_0x5f9e('0xde')])[_0x5f9e('0x85')]({'secret':![]})[_0x5f9e('0x3b')](function(_0xbbf6e2){if(_0xbbf6e2[_0x5f9e('0xd5')]){var _0x5ef98d=path['join'](_0x15d2cd,_0xbbf6e2[_0x5f9e('0xd5')]['basename']);if(fs[_0x5f9e('0xdf')](_0x5ef98d)){fs[_0x5f9e('0xe0')](_0x5ef98d)[_0x5f9e('0xe1')](fs[_0x5f9e('0xe2')](path[_0x5f9e('0xcd')](_0x579ee7,_0xbbf6e2[_0x5f9e('0xd5')][_0x5f9e('0xe3')])));}}return{'date':moment(_0xbbf6e2[_0x5f9e('0x7a')])[_0x5f9e('0xc5')](_0x5f9e('0xc6'))['toString'](),'sender':_0xbbf6e2[_0x5f9e('0xd6')]===_0x5f9e('0xe4')?_0xbbf6e2[_0x5f9e('0x72')]?_0xbbf6e2['User'][_0x5f9e('0x2c')]:_0x5f9e('0xe5'):_0xbbf6e2[_0x5f9e('0x6a')][_0x5f9e('0xd4')]+(_0xbbf6e2[_0x5f9e('0x6a')][_0x5f9e('0xe6')]?'\x20'+_0xbbf6e2[_0x5f9e('0x6a')]['lastName']:''),'body':_0xbbf6e2[_0x5f9e('0xd5')]?_0xbbf6e2[_0x5f9e('0xd5')]['basename']:_0xbbf6e2[_0x5f9e('0x75')],'direction':_0xbbf6e2[_0x5f9e('0xd6')]===_0x5f9e('0xe4')?'A':'C','secret':_0xbbf6e2[_0x5f9e('0xe7')],'read':_0xbbf6e2[_0x5f9e('0x80')],'attachment':_0xbbf6e2['Attachment']};})['value']()};return ejs[_0x5f9e('0xe8')](path['join'](config[_0x5f9e('0xd1')],'server',_0x5f9e('0xe9'),_0x5f9e('0xea')),{'interaction':_0x524dae})[_0x5f9e('0x27')](function(_0x12ba4d){var _0x29ece1=path[_0x5f9e('0xcd')](_0x579ee7,_0x5f9e('0xeb')+_0x131155['id']+'-'+_0xee6d79+_0x5f9e('0xec'));var _0x5a5473={'path':_0x29ece1,'channel':'Whatsapp','interactionId':_0x131155['id']};return pdf[_0x5f9e('0xed')](_0x12ba4d,_0x5a5473);})[_0x5f9e('0x27')](function(){return new BPromise(function(_0x484fe3,_0x78e0e5){zipdir(_0x579ee7,{'saveTo':_0x3d656b},function(_0x1266e0,_0x49a561){if(_0x1266e0)return _0x78e0e5(_0x1266e0);return _0x484fe3(_0x49a561);});})[_0x5f9e('0x27')](function(){return new BPromise(function(_0x1c8da8,_0x12e8c5){rimraf(_0x579ee7,function(_0x40e5a6){if(_0x40e5a6)_0x12e8c5(_0x40e5a6);return _0x1c8da8();});});})[_0x5f9e('0x27')](function(){return _0x224169['download'](_0x3d656b,_0x29802a,function(_0xa5a257){if(_0xa5a257){console[_0x5f9e('0xee')](_0x5f9e('0xef'),_0xa5a257);}else{fs['unlinkSync'](_0x3d656b);}});});});}else{return _0x224169[_0x5f9e('0x1c')](0xc8);}})[_0x5f9e('0x32')](handleError(_0x224169,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 1e25e77..8231b07 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 _0x98b8=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x12bc95,_0x4306ed){var _0x4a5f1a=function(_0x164641){while(--_0x164641){_0x12bc95['push'](_0x12bc95['shift']());}};_0x4a5f1a(++_0x4306ed);}(_0x98b8,0x93));var _0x898b=function(_0xde4cc7,_0x267522){_0xde4cc7=_0xde4cc7-0x0;var _0x60cc4a=_0x98b8[_0xde4cc7];return _0x60cc4a;};'use strict';var EventEmitter=require(_0x898b('0x0'));var WhatsappInteraction=require(_0x898b('0x1'))['db'][_0x898b('0x2')];var WhatsappMessage=require(_0x898b('0x1'))['db'][_0x898b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x898b('0x4')](0x0);var events={'afterCreate':_0x898b('0x5'),'afterUpdate':_0x898b('0x6'),'afterDestroy':_0x898b('0x7')};function emitEvent(_0x7aea2f){return function(_0x43ac29,_0x4631b9,_0x1ddef6){_0x43ac29[_0x898b('0x8')]({'attributes':['id'],'raw':!![]})[_0x898b('0x9')](function(_0x4e9410){_0x43ac29[_0x898b('0xa')](_0x898b('0xb'),_0x4e9410[_0x898b('0xc')](function(_0x287c54){return{'id':_0x287c54['id']};}));return WhatsappMessage[_0x898b('0xd')]({'where':{'WhatsappInteractionId':_0x43ac29['id'],'direction':'in','read':![]},'raw':!![]});})[_0x898b('0x9')](function(_0x27eda7){_0x43ac29[_0x898b('0xa')]('unreadMessages',_0x27eda7[_0x898b('0xe')]);WhatsappInteractionEvents['emit'](_0x7aea2f+':'+_0x43ac29['id'],_0x43ac29);WhatsappInteractionEvents['emit'](_0x7aea2f,_0x43ac29);_0x1ddef6(null);})[_0x898b('0xf')](_0x1ddef6(null));};}for(var e in events){if(events[_0x898b('0x10')](e)){var event=events[e];WhatsappInteraction[_0x898b('0x11')](e,emitEvent(event));}}module[_0x898b('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc36d=['map','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x1d8a36,_0x2043e3){var _0x4e3947=function(_0x539781){while(--_0x539781){_0x1d8a36['push'](_0x1d8a36['shift']());}};_0x4e3947(++_0x2043e3);}(_0xc36d,0x7d));var _0xdc36=function(_0x25b439,_0xb20872){_0x25b439=_0x25b439-0x0;var _0xbf2210=_0xc36d[_0x25b439];return _0xbf2210;};'use strict';var EventEmitter=require(_0xdc36('0x0'));var WhatsappInteraction=require(_0xdc36('0x1'))['db'][_0xdc36('0x2')];var WhatsappMessage=require(_0xdc36('0x1'))['db'][_0xdc36('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdc36('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc36('0x5'),'afterDestroy':_0xdc36('0x6')};function emitEvent(_0x53ac17){return function(_0x18c8fe,_0xbc5223,_0x186c58){_0x18c8fe[_0xdc36('0x7')]({'attributes':['id'],'raw':!![]})[_0xdc36('0x8')](function(_0x571311){_0x18c8fe[_0xdc36('0x9')](_0xdc36('0xa'),_0x571311[_0xdc36('0xb')](function(_0xdca7f7){return{'id':_0xdca7f7['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x18c8fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc36('0x8')](function(_0x23956b){_0x18c8fe['setDataValue'](_0xdc36('0xc'),_0x23956b[_0xdc36('0xd')]);WhatsappInteractionEvents[_0xdc36('0xe')](_0x53ac17+':'+_0x18c8fe['id'],_0x18c8fe);WhatsappInteractionEvents['emit'](_0x53ac17,_0x18c8fe);_0x186c58(null);})[_0xdc36('0xf')](_0x186c58(null));};}for(var e in events){if(events[_0xdc36('0x10')](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 a2acb9d..429f8ae 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 _0xdb12=['closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xdb12,0xd2));var _0x2db1=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0xdb12[_0x3c7d53];return _0x2c8387;};'use strict';var _=require('lodash');var util=require(_0x2db1('0x0'));var logger=require('../../config/logger')(_0x2db1('0x1'));var moment=require('moment');var BPromise=require(_0x2db1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2db1('0x3'));var config=require(_0x2db1('0x4'));var attributes=require(_0x2db1('0x5'));module[_0x2db1('0x6')]=function(_0x4198f0,_0xcb2068){return _0x4198f0[_0x2db1('0x7')](_0x2db1('0x8'),attributes,{'tableName':_0x2db1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c2b8c,_0x1dbf1c,_0xf75a24){if(_0x4c2b8c['changed'](_0x2db1('0xa'))){_0x4c2b8c[_0x2db1('0xb')]=moment()['format'](_0x2db1('0xc'));}_0xf75a24(null,_0x4c2b8c);}}});}; \ No newline at end of file +var _0xb725=['WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','../../config/logger','api','moment','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0x585662,_0x678b5a){var _0x4974cd=function(_0x2b8a3d){while(--_0x2b8a3d){_0x585662['push'](_0x585662['shift']());}};_0x4974cd(++_0x678b5a);}(_0xb725,0xa1));var _0x5b72=function(_0x5b5641,_0x439102){_0x5b5641=_0x5b5641-0x0;var _0xb51db1=_0xb725[_0x5b5641];return _0xb51db1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5b72('0x0'))(_0x5b72('0x1'));var moment=require(_0x5b72('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b72('0x3'));var config=require(_0x5b72('0x4'));var attributes=require(_0x5b72('0x5'));module[_0x5b72('0x6')]=function(_0x4877b7,_0x1ab712){return _0x4877b7[_0x5b72('0x7')](_0x5b72('0x8'),attributes,{'tableName':_0x5b72('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cbaf2,_0x3e9c0f,_0x2b5fa6){if(_0x3cbaf2['changed'](_0x5b72('0xa'))){_0x3cbaf2[_0x5b72('0xb')]=moment()[_0x5b72('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2b5fa6(null,_0x3cbaf2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4919804..be8df27 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 _0xc12c=['result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent'];(function(_0x51666f,_0x5c6d0b){var _0x1dc745=function(_0x414b6c){while(--_0x414b6c){_0x51666f['push'](_0x51666f['shift']());}};_0x1dc745(++_0x5c6d0b);}(_0xc12c,0xdf));var _0xcc12=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xc12c[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xcc12('0x0'));var util=require(_0xcc12('0x1'));var moment=require(_0xcc12('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc12('0x3'));var fs=require('fs');var Redis=require(_0xcc12('0x4'));var db=require(_0xcc12('0x5'))['db'];var utils=require(_0xcc12('0x6'));var logger=require('../../config/logger')(_0xcc12('0x7'));var config=require(_0xcc12('0x8'));var jayson=require(_0xcc12('0x9'));var client=jayson[_0xcc12('0xa')][_0xcc12('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcc12('0xc')],{'host':_0xcc12('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xcc12('0xe')](socket);function respondWithRpcPromise(_0x507292,_0xda71a3,_0x3c1155){return new BPromise(function(_0x49a985,_0x53e390){return client['request'](_0x507292,_0x3c1155)[_0xcc12('0xf')](function(_0x5c6787){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xda71a3,'request\x20sent');logger[_0xcc12('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xda71a3,'request\x20sent',JSON[_0xcc12('0x11')](_0x5c6787));if(_0x5c6787[_0xcc12('0x12')]){if(_0x5c6787['error'][_0xcc12('0x13')]===0x1f4){logger[_0xcc12('0x12')](_0xcc12('0x14'),_0xda71a3,_0x5c6787['error'][_0xcc12('0x15')]);return _0x53e390(_0x5c6787[_0xcc12('0x12')][_0xcc12('0x15')]);}logger['error'](_0xcc12('0x14'),_0xda71a3,_0x5c6787[_0xcc12('0x12')]['message']);return _0x49a985(_0x5c6787[_0xcc12('0x12')]['message']);}else{logger['info'](_0xcc12('0x14'),_0xda71a3,_0xcc12('0x16'));_0x49a985(_0x5c6787[_0xcc12('0x17')]['message']);}})[_0xcc12('0x18')](function(_0xe9f90){logger[_0xcc12('0x12')](_0xcc12('0x14'),_0xda71a3,_0xe9f90);_0x53e390(_0xe9f90);});});}exports[_0xcc12('0x19')]=function(_0x1496fa){var _0x4fccad=this;return new Promise(function(_0x4227ff,_0x10cf6b){return db['WhatsappInteraction'][_0xcc12('0x1a')](_0x1496fa[_0xcc12('0x1b')],{'raw':_0x1496fa[_0xcc12('0x1c')]?_0x1496fa[_0xcc12('0x1c')][_0xcc12('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1496fa[_0xcc12('0x1c')]?_0x1496fa[_0xcc12('0x1c')][_0xcc12('0x1e')]||null:null,'attributes':_0x1496fa[_0xcc12('0x1c')]?_0x1496fa[_0xcc12('0x1c')][_0xcc12('0x1f')]||null:null,'limit':_0x1496fa[_0xcc12('0x1c')]?_0x1496fa['options'][_0xcc12('0x20')]||null:null})[_0xcc12('0xf')](function(_0x1b8b8d){logger['info']('UpdateWhatsappInteraction',_0x1496fa);logger[_0xcc12('0x10')]('UpdateWhatsappInteraction',_0x1496fa,JSON['stringify'](_0x1b8b8d));_0x4227ff(_0x1b8b8d);})[_0xcc12('0x18')](function(_0x10e651){logger['error'](_0xcc12('0x19'),_0x10e651[_0xcc12('0x15')],_0x1496fa);_0x10cf6b(_0x4fccad[_0xcc12('0x12')](0x1f4,_0x10e651[_0xcc12('0x15')]));});});};exports[_0xcc12('0x21')]=function(_0x53b532){return new Promise(function(_0x14ef6b,_0x4493db){return db[_0xcc12('0x22')][_0xcc12('0x23')]({'where':_0x53b532[_0xcc12('0x1c')]?_0x53b532[_0xcc12('0x1c')][_0xcc12('0x1e')]||null:null})[_0xcc12('0xf')](function(_0x30cffa){if(_0x30cffa){return _0x30cffa[_0xcc12('0x24')](_0x53b532[_0xcc12('0x1b')][_0xcc12('0x25')],_[_0xcc12('0x26')](_0x53b532['body'],[_0xcc12('0x25'),'id'])||{});}})[_0xcc12('0x27')](function(_0x5cbfff){logger['info']('AddTags',_0x53b532);logger[_0xcc12('0x10')](_0xcc12('0x28'),_0x53b532,JSON[_0xcc12('0x11')](_0x5cbfff));_0x14ef6b(_0x5cbfff);})[_0xcc12('0x18')](function(_0xf1c228){logger['error'](_0xcc12('0x28'),_0xf1c228['message'],_0x53b532);_0x4493db(_this['error'](0x1f4,_0xf1c228[_0xcc12('0x15')]));});});}; \ No newline at end of file +var _0xf8e3=['then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','stringify','catch','AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','register','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf8e3,0xd7));var _0x3f8e=function(_0x27e9b3,_0x1b17af){_0x27e9b3=_0x27e9b3-0x0;var _0x553cac=_0xf8e3[_0x27e9b3];return _0x553cac;};'use strict';var _=require(_0x3f8e('0x0'));var util=require(_0x3f8e('0x1'));var moment=require(_0x3f8e('0x2'));var BPromise=require(_0x3f8e('0x3'));var rs=require(_0x3f8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f8e('0x5'));var config=require(_0x3f8e('0x6'));var jayson=require(_0x3f8e('0x7'));var client=jayson[_0x3f8e('0x8')][_0x3f8e('0x9')]({'port':0x232a});config[_0x3f8e('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f8e('0xa')]));require('./whatsappInteraction.socket')[_0x3f8e('0xb')](socket);function respondWithRpcPromise(_0x3a07e5,_0x53ef2a,_0x6d08ba){return new BPromise(function(_0x14be67,_0x532dce){return client[_0x3f8e('0xc')](_0x3a07e5,_0x6d08ba)[_0x3f8e('0xd')](function(_0x1704fb){logger[_0x3f8e('0xe')](_0x3f8e('0xf'),_0x53ef2a,'request\x20sent');logger[_0x3f8e('0x10')](_0x3f8e('0x11'),_0x53ef2a,_0x3f8e('0x12'),JSON['stringify'](_0x1704fb));if(_0x1704fb[_0x3f8e('0x13')]){if(_0x1704fb[_0x3f8e('0x13')][_0x3f8e('0x14')]===0x1f4){logger[_0x3f8e('0x13')](_0x3f8e('0xf'),_0x53ef2a,_0x1704fb[_0x3f8e('0x13')][_0x3f8e('0x15')]);return _0x532dce(_0x1704fb[_0x3f8e('0x13')][_0x3f8e('0x15')]);}logger['error'](_0x3f8e('0xf'),_0x53ef2a,_0x1704fb[_0x3f8e('0x13')][_0x3f8e('0x15')]);return _0x14be67(_0x1704fb[_0x3f8e('0x13')]['message']);}else{logger[_0x3f8e('0xe')](_0x3f8e('0xf'),_0x53ef2a,_0x3f8e('0x12'));_0x14be67(_0x1704fb[_0x3f8e('0x16')][_0x3f8e('0x15')]);}})['catch'](function(_0x605567){logger[_0x3f8e('0x13')](_0x3f8e('0xf'),_0x53ef2a,_0x605567);_0x532dce(_0x605567);});});}exports[_0x3f8e('0x17')]=function(_0x2c6db7){var _0x3bc75e=this;return new Promise(function(_0x45c35a,_0x3fa919){return db[_0x3f8e('0x18')][_0x3f8e('0x19')](_0x2c6db7['body'],{'raw':_0x2c6db7[_0x3f8e('0x1a')]?_0x2c6db7['options'][_0x3f8e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6db7['options']?_0x2c6db7['options'][_0x3f8e('0x1c')]||null:null,'attributes':_0x2c6db7[_0x3f8e('0x1a')]?_0x2c6db7[_0x3f8e('0x1a')]['attributes']||null:null,'limit':_0x2c6db7['options']?_0x2c6db7[_0x3f8e('0x1a')]['limit']||null:null})[_0x3f8e('0xd')](function(_0xd1f7d6){logger[_0x3f8e('0xe')](_0x3f8e('0x17'),_0x2c6db7);logger[_0x3f8e('0x10')](_0x3f8e('0x17'),_0x2c6db7,JSON[_0x3f8e('0x1d')](_0xd1f7d6));_0x45c35a(_0xd1f7d6);})[_0x3f8e('0x1e')](function(_0x1ac2cc){logger[_0x3f8e('0x13')](_0x3f8e('0x17'),_0x1ac2cc[_0x3f8e('0x15')],_0x2c6db7);_0x3fa919(_0x3bc75e['error'](0x1f4,_0x1ac2cc[_0x3f8e('0x15')]));});});};exports[_0x3f8e('0x1f')]=function(_0x15b1a9){return new Promise(function(_0x4a73f9,_0x4f6664){return db[_0x3f8e('0x18')][_0x3f8e('0x20')]({'where':_0x15b1a9[_0x3f8e('0x1a')]?_0x15b1a9['options'][_0x3f8e('0x1c')]||null:null})[_0x3f8e('0xd')](function(_0x4ac381){if(_0x4ac381){return _0x4ac381['addTags'](_0x15b1a9[_0x3f8e('0x21')][_0x3f8e('0x22')],_[_0x3f8e('0x23')](_0x15b1a9['body'],['ids','id'])||{});}})[_0x3f8e('0x24')](function(_0x2c2b8a){logger[_0x3f8e('0xe')](_0x3f8e('0x25'),_0x15b1a9);logger['debug'](_0x3f8e('0x25'),_0x15b1a9,JSON[_0x3f8e('0x1d')](_0x2c2b8a));_0x4a73f9(_0x2c2b8a);})['catch'](function(_0x15e05){logger[_0x3f8e('0x13')](_0x3f8e('0x25'),_0x15e05['message'],_0x15b1a9);_0x4f6664(_this[_0x3f8e('0x13')](0x1f4,_0x15e05[_0x3f8e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 17d9fa5..9726627 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 _0x62d4=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','register','length'];(function(_0x3c2ca6,_0x8276d8){var _0x933117=function(_0x2ac037){while(--_0x2ac037){_0x3c2ca6['push'](_0x3c2ca6['shift']());}};_0x933117(++_0x8276d8);}(_0x62d4,0x189));var _0x462d=function(_0x189a71,_0x32a7a1){_0x189a71=_0x189a71-0x0;var _0xdb225e=_0x62d4[_0x189a71];return _0xdb225e;};'use strict';var WhatsappInteractionEvents=require(_0x462d('0x0'));var events=[_0x462d('0x1'),_0x462d('0x2'),_0x462d('0x3')];function createListener(_0x235a2c,_0x55b87d){return function(_0x230364){_0x55b87d[_0x462d('0x4')](_0x235a2c,_0x230364);};}function removeListener(_0x515ce6,_0x218d29){return function(){WhatsappInteractionEvents['removeListener'](_0x515ce6,_0x218d29);};}exports[_0x462d('0x5')]=function(_0x56b3e7){for(var _0x20ea95=0x0,_0x57ff98=events[_0x462d('0x6')];_0x20ea95<_0x57ff98;_0x20ea95++){var _0x549b94=events[_0x20ea95];var _0x1b7719=createListener(_0x462d('0x7')+_0x549b94,_0x56b3e7);WhatsappInteractionEvents['on'](_0x549b94,_0x1b7719);}}; \ No newline at end of file +var _0x0b73=['remove','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x523d8e,_0x3a108e){var _0x56d93b=function(_0x585347){while(--_0x585347){_0x523d8e['push'](_0x523d8e['shift']());}};_0x56d93b(++_0x3a108e);}(_0x0b73,0x1c6));var _0x30b7=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0b73[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappInteractionEvents=require(_0x30b7('0x0'));var events=[_0x30b7('0x1'),_0x30b7('0x2'),_0x30b7('0x3')];function createListener(_0x3b4518,_0x5a5b68){return function(_0x5ab51a){_0x5a5b68['emit'](_0x3b4518,_0x5ab51a);};}function removeListener(_0x4e568e,_0x163a00){return function(){WhatsappInteractionEvents[_0x30b7('0x4')](_0x4e568e,_0x163a00);};}exports[_0x30b7('0x5')]=function(_0xacabbc){for(var _0xdfb8f2=0x0,_0xdf3a0d=events[_0x30b7('0x6')];_0xdfb8f2<_0xdf3a0d;_0xdfb8f2++){var _0x21d333=events[_0xdfb8f2];var _0x439e41=createListener(_0x30b7('0x7')+_0x21d333,_0xacabbc);WhatsappInteractionEvents['on'](_0x21d333,_0x439e41);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5e614d0..e0c3dc5 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 _0x0763=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','whatsappmessage:create','create','/:id/status','put','/:id','/:id/accept','/:id/reject','reject','destroy','exports','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0763,0x112));var _0x3076=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0x0763[_0x1c7f48];return _0x274c31;};'use strict';var multer=require(_0x3076('0x0'));var util=require(_0x3076('0x1'));var path=require('path');var timeout=require(_0x3076('0x2'));var express=require(_0x3076('0x3'));var router=express[_0x3076('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3076('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3076('0x6'));var controller=require(_0x3076('0x7'));router[_0x3076('0x8')]('/',auth[_0x3076('0x9')](),controller[_0x3076('0xa')]);router[_0x3076('0x8')](_0x3076('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3076('0x8')]('/:id',auth[_0x3076('0x9')](),controller[_0x3076('0xc')]);router[_0x3076('0xd')]('/',auth[_0x3076('0x9')](),interaction[_0x3076('0xe')]('whatsapp',_0x3076('0xf')),controller[_0x3076('0x10')]);router['post'](_0x3076('0x11'),controller['status']);router[_0x3076('0x12')](_0x3076('0x13'),auth[_0x3076('0x9')](),controller['update']);router[_0x3076('0x12')](_0x3076('0x14'),auth[_0x3076('0x9')](),controller['accept']);router[_0x3076('0x12')](_0x3076('0x15'),auth['isAuthenticated'](),controller[_0x3076('0x16')]);router['delete'](_0x3076('0x13'),auth[_0x3076('0x9')](),controller[_0x3076('0x17')]);module[_0x3076('0x18')]=router; \ No newline at end of file +var _0xec6a=['whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','whatsapp'];(function(_0x3bb859,_0x589816){var _0x3bf534=function(_0xa586c){while(--_0xa586c){_0x3bb859['push'](_0x3bb859['shift']());}};_0x3bf534(++_0x589816);}(_0xec6a,0x181));var _0xaec6=function(_0x442975,_0x3372ba){_0x442975=_0x442975-0x0;var _0x1f7599=_0xec6a[_0x442975];return _0x1f7599;};'use strict';var multer=require(_0xaec6('0x0'));var util=require('util');var path=require(_0xaec6('0x1'));var timeout=require(_0xaec6('0x2'));var express=require('express');var router=express[_0xaec6('0x3')]();var fs_extra=require(_0xaec6('0x4'));var auth=require(_0xaec6('0x5'));var interaction=require(_0xaec6('0x6'));var config=require(_0xaec6('0x7'));var controller=require(_0xaec6('0x8'));router[_0xaec6('0x9')]('/',auth['isAuthenticated'](),controller[_0xaec6('0xa')]);router[_0xaec6('0x9')]('/describe',auth[_0xaec6('0xb')](),controller[_0xaec6('0xc')]);router[_0xaec6('0x9')](_0xaec6('0xd'),auth['isAuthenticated'](),controller[_0xaec6('0xe')]);router[_0xaec6('0xf')]('/',auth[_0xaec6('0xb')](),interaction[_0xaec6('0x10')](_0xaec6('0x11'),_0xaec6('0x12')),controller[_0xaec6('0x13')]);router['post'](_0xaec6('0x14'),controller[_0xaec6('0x15')]);router[_0xaec6('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xaec6('0x17')]);router[_0xaec6('0x16')](_0xaec6('0x18'),auth[_0xaec6('0xb')](),controller[_0xaec6('0x19')]);router[_0xaec6('0x16')](_0xaec6('0x1a'),auth[_0xaec6('0xb')](),controller[_0xaec6('0x1b')]);router[_0xaec6('0x1c')](_0xaec6('0xd'),auth['isAuthenticated'](),controller[_0xaec6('0x1d')]);module[_0xaec6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index bbe1cc6..ca23716 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 _0xc47b=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x25bff7,_0xdfc210){var _0x59101b=function(_0x4291fd){while(--_0x4291fd){_0x25bff7['push'](_0x25bff7['shift']());}};_0x59101b(++_0xdfc210);}(_0xc47b,0x14c));var _0xbc47=function(_0x4bc4b1,_0x588612){_0x4bc4b1=_0x4bc4b1-0x0;var _0x2784d5=_0xc47b[_0x4bc4b1];return _0x2784d5;};'use strict';var Sequelize=require(_0xbc47('0x0'));module[_0xbc47('0x1')]={'body':{'type':Sequelize[_0xbc47('0x2')](_0xbc47('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbc47('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbc47('0x5')]('in',_0xbc47('0x6')),'defaultValue':_0xbc47('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbc47('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xbc47('0x8')]},'secret':{'type':Sequelize[_0xbc47('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbc47('0x7')]},'providerResponse':{'type':Sequelize[_0xbc47('0x2')]}}; \ No newline at end of file +var _0x65b4=['ENUM','out','STRING','DATE','BOOLEAN','TEXT','sequelize','medium'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x65b4,0x96));var _0x465b=function(_0x3884ec,_0x3dd7fa){_0x3884ec=_0x3884ec-0x0;var _0x207daa=_0x65b4[_0x3884ec];return _0x207daa;};'use strict';var Sequelize=require(_0x465b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x465b('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x465b('0x2')]('in',_0x465b('0x3')),'defaultValue':_0x465b('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x465b('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x465b('0x5')]},'secret':{'type':Sequelize[_0x465b('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x465b('0x4')]},'providerResponse':{'type':Sequelize[_0x465b('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b74e3fa..f3635f5 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 _0x118a=['fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','keys','length','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','name','send','index','WhatsappMessage'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x118a,0x15c));var _0xa118=function(_0x45d23b,_0x54c212){_0x45d23b=_0x45d23b-0x0;var _0x33811a=_0x118a[_0x45d23b];return _0x33811a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa118('0x0'));var zipdir=require(_0xa118('0x1'));var jsonpatch=require(_0xa118('0x2'));var rp=require(_0xa118('0x3'));var moment=require(_0xa118('0x4'));var BPromise=require(_0xa118('0x5'));var Mustache=require('mustache');var util=require(_0xa118('0x6'));var path=require(_0xa118('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa118('0x8'));var _=require('lodash');var squel=require(_0xa118('0x9'));var crypto=require(_0xa118('0xa'));var jsforce=require(_0xa118('0xb'));var deskjs=require(_0xa118('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa118('0xd'));var Redis=require(_0xa118('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa118('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa118('0x10'));var config=require(_0xa118('0x11'));var licenseUtil=require(_0xa118('0x12'));var db=require(_0xa118('0x13'))['db'];config[_0xa118('0x14')]=_[_0xa118('0x15')](config[_0xa118('0x14')],{'host':_0xa118('0x16'),'port':0x18eb});var socket=require(_0xa118('0x17'))(new Redis(config[_0xa118('0x14')]));require(_0xa118('0x18'))[_0xa118('0x19')](socket);var jayson=require(_0xa118('0x1a'));var client=jayson['client'][_0xa118('0x1b')]({'port':0x232c});var client9002=jayson[_0xa118('0x1c')][_0xa118('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2158fd,_0x4a6856,_0x2c46c0,_0x35990c){return new BPromise(function(_0xa5620,_0x81586f){var _0x2359e1=_0x35990c||client;return _0x2359e1['request'](_0x2158fd,_0x2c46c0)[_0xa118('0x1d')](function(_0x49b414){logger[_0xa118('0x1e')](_0xa118('0x1f'),_0x4a6856,'request\x20sent');logger[_0xa118('0x20')](_0xa118('0x21'),_0x4a6856,'request\x20sent',JSON[_0xa118('0x22')](_0x49b414));if(_0x49b414[_0xa118('0x23')]){if(_0x49b414[_0xa118('0x23')][_0xa118('0x24')]===0x1f4){logger[_0xa118('0x23')](_0xa118('0x1f'),_0x4a6856,_0x49b414['error'][_0xa118('0x25')]);return _0x81586f(_0x49b414['error']['message']);}logger[_0xa118('0x23')](_0xa118('0x1f'),_0x4a6856,_0x49b414[_0xa118('0x23')][_0xa118('0x25')]);return _0xa5620(_0x49b414[_0xa118('0x23')][_0xa118('0x25')]);}else{logger[_0xa118('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x4a6856,_0xa118('0x26'));_0xa5620(_0x49b414[_0xa118('0x27')][_0xa118('0x25')]);}})[_0xa118('0x28')](function(_0x47a80e){logger['error'](_0xa118('0x1f'),_0x4a6856,_0x47a80e);_0x81586f(_0x47a80e);});});}function respondWithStatusCode(_0x10c5df,_0x59a92f){_0x59a92f=_0x59a92f||0xcc;return function(_0x36eb7b){if(_0x36eb7b){return _0x10c5df[_0xa118('0x29')](_0x59a92f);}return _0x10c5df[_0xa118('0x2a')](_0x59a92f)['end']();};}function respondWithResult(_0x39275d,_0x1dac75){_0x1dac75=_0x1dac75||0xc8;return function(_0x519c61){if(_0x519c61){return _0x39275d[_0xa118('0x2a')](_0x1dac75)[_0xa118('0x2b')](_0x519c61);}};}function respondWithFilteredResult(_0x3f4539,_0x1867d8){return function(_0x3b4282){if(_0x3b4282){var _0x1003f2=typeof _0x1867d8[_0xa118('0x2c')]===_0xa118('0x2d')&&typeof _0x1867d8[_0xa118('0x2e')]==='undefined';var _0x2b0527=_0x3b4282[_0xa118('0x2f')];var _0xa1637c=_0x1003f2?0x0:_0x1867d8[_0xa118('0x2c')];var _0x1c3c58=_0x1003f2?_0x3b4282['count']:_0x1867d8['offset']+_0x1867d8['limit'];var _0x54c27b;if(_0x1c3c58>=_0x2b0527){_0x1c3c58=_0x2b0527;_0x54c27b=0xc8;}else{_0x54c27b=0xce;}_0x3f4539['status'](_0x54c27b);return _0x3f4539['set'](_0xa118('0x30'),_0xa1637c+'-'+_0x1c3c58+'/'+_0x2b0527)[_0xa118('0x2b')](_0x3b4282);}return null;};}function patchUpdates(_0x356830){return function(_0x34217b){try{jsonpatch[_0xa118('0x31')](_0x34217b,_0x356830,!![]);}catch(_0x2bfec5){return BPromise[_0xa118('0x32')](_0x2bfec5);}return _0x34217b[_0xa118('0x33')]();};}function saveUpdates(_0x3006a7,_0x23dd2b){return function(_0xb2fad8){if(_0xb2fad8){return _0xb2fad8['update'](_0x3006a7)[_0xa118('0x1d')](function(_0xf0b38e){return _0xf0b38e;});}return null;};}function removeEntity(_0x479217,_0x129a3c){return function(_0x5ecf95){if(_0x5ecf95){return _0x5ecf95[_0xa118('0x34')]()[_0xa118('0x1d')](function(){_0x479217[_0xa118('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34eb37,_0x3daa8b){return function(_0x27ef74){if(!_0x27ef74){_0x34eb37['sendStatus'](0x194);}return _0x27ef74;};}function handleError(_0x159c11,_0x3fc047){_0x3fc047=_0x3fc047||0x1f4;return function(_0x200edc){logger[_0xa118('0x23')](_0x200edc['stack']);if(_0x200edc[_0xa118('0x35')]){delete _0x200edc[_0xa118('0x35')];}_0x159c11[_0xa118('0x2a')](_0x3fc047)[_0xa118('0x36')](_0x200edc);};}exports[_0xa118('0x37')]=function(_0x748a0d,_0x3971e2){var _0x1245fd={},_0x50fd37={},_0x12e6aa={'count':0x0,'rows':[]};var _0x90e8b2=_['map'](db[_0xa118('0x38')]['rawAttributes'],function(_0x5440e9){return{'name':_0x5440e9[_0xa118('0x39')],'type':_0x5440e9[_0xa118('0x3a')][_0xa118('0x3b')]};});_0x50fd37['model']=_[_0xa118('0x3c')](_0x90e8b2,_0xa118('0x35'));_0x50fd37['query']=_['keys'](_0x748a0d[_0xa118('0x3d')]);_0x50fd37['filters']=_[_0xa118('0x3e')](_0x50fd37[_0xa118('0x3f')],_0x50fd37[_0xa118('0x3d')]);_0x1245fd[_0xa118('0x40')]=_[_0xa118('0x3e')](_0x50fd37[_0xa118('0x3f')],qs[_0xa118('0x41')](_0x748a0d[_0xa118('0x3d')][_0xa118('0x41')]));_0x1245fd[_0xa118('0x40')]=_0x1245fd[_0xa118('0x40')]['length']?_0x1245fd['attributes']:_0x50fd37['model'];if(!_0x748a0d['query'][_0xa118('0x42')]('nolimit')){_0x1245fd['limit']=qs[_0xa118('0x2e')](_0x748a0d[_0xa118('0x3d')]['limit']);_0x1245fd[_0xa118('0x2c')]=qs['offset'](_0x748a0d[_0xa118('0x3d')]['offset']);}_0x1245fd[_0xa118('0x43')]=qs['sort'](_0x748a0d[_0xa118('0x3d')][_0xa118('0x44')]);_0x1245fd[_0xa118('0x45')]=qs[_0xa118('0x46')](_[_0xa118('0x47')](_0x748a0d[_0xa118('0x3d')],_0x50fd37[_0xa118('0x46')]),_0x90e8b2);if(_0x748a0d[_0xa118('0x3d')]['filter']){_0x1245fd[_0xa118('0x45')]=_[_0xa118('0x48')](_0x1245fd['where'],{'$or':_[_0xa118('0x3c')](_0x90e8b2,function(_0xd2708a){if(_0xd2708a[_0xa118('0x3a')]!==_0xa118('0x49')){var _0x4502c7={};_0x4502c7[_0xd2708a[_0xa118('0x35')]]={'$like':'%'+_0x748a0d['query'][_0xa118('0x4a')]+'%'};return _0x4502c7;}})});}_0x1245fd=_[_0xa118('0x48')]({},_0x1245fd,_0x748a0d['options']);var _0x3803f4={'where':_0x1245fd[_0xa118('0x45')]};return db[_0xa118('0x38')]['count'](_0x3803f4)['then'](function(_0x1ebd63){_0x12e6aa[_0xa118('0x2f')]=_0x1ebd63;if(_0x748a0d['query']['includeAll']){_0x1245fd[_0xa118('0x4b')]=[{'all':!![]}];}return db[_0xa118('0x38')][_0xa118('0x4c')](_0x1245fd);})[_0xa118('0x1d')](function(_0x44353c){_0x12e6aa[_0xa118('0x4d')]=_0x44353c;return _0x12e6aa;})['then'](respondWithFilteredResult(_0x3971e2,_0x1245fd))['catch'](handleError(_0x3971e2,null));};exports[_0xa118('0x4e')]=function(_0x589107,_0x465f8e){var _0x65c09a={'raw':!![],'where':{'id':_0x589107[_0xa118('0x4f')]['id']}},_0xd18d29={};_0xd18d29[_0xa118('0x3f')]=_[_0xa118('0x50')](db[_0xa118('0x38')]['rawAttributes']);_0xd18d29[_0xa118('0x3d')]=_[_0xa118('0x50')](_0x589107[_0xa118('0x3d')]);_0xd18d29[_0xa118('0x46')]=_[_0xa118('0x3e')](_0xd18d29[_0xa118('0x3f')],_0xd18d29[_0xa118('0x3d')]);_0x65c09a[_0xa118('0x40')]=_[_0xa118('0x3e')](_0xd18d29['model'],qs[_0xa118('0x41')](_0x589107['query']['fields']));_0x65c09a[_0xa118('0x40')]=_0x65c09a['attributes'][_0xa118('0x51')]?_0x65c09a[_0xa118('0x40')]:_0xd18d29[_0xa118('0x3f')];if(_0x589107[_0xa118('0x3d')]['includeAll']){_0x65c09a[_0xa118('0x4b')]=[{'all':!![]}];}_0x65c09a=_[_0xa118('0x48')]({},_0x65c09a,_0x589107['options']);return db[_0xa118('0x38')][_0xa118('0x52')](_0x65c09a)[_0xa118('0x1d')](handleEntityNotFound(_0x465f8e,null))[_0xa118('0x1d')](respondWithResult(_0x465f8e,null))[_0xa118('0x28')](handleError(_0x465f8e,null));};exports['create']=function(_0x3c6382,_0x2c8ae5){return db[_0xa118('0x38')][_0xa118('0x53')](_0x3c6382[_0xa118('0x54')],{})[_0xa118('0x1d')](respondWithResult(_0x2c8ae5,0xc9))[_0xa118('0x28')](handleError(_0x2c8ae5,null));};exports['update']=function(_0x4ab5f7,_0x5a6fb5){if(_0x4ab5f7[_0xa118('0x54')]['id']){delete _0x4ab5f7[_0xa118('0x54')]['id'];}return db[_0xa118('0x38')][_0xa118('0x52')]({'where':{'id':_0x4ab5f7[_0xa118('0x4f')]['id']}})[_0xa118('0x1d')](handleEntityNotFound(_0x5a6fb5,null))['then'](saveUpdates(_0x4ab5f7[_0xa118('0x54')],null))[_0xa118('0x1d')](respondWithResult(_0x5a6fb5,null))['catch'](handleError(_0x5a6fb5,null));};exports[_0xa118('0x34')]=function(_0x4a714e,_0x1758fc){return db[_0xa118('0x38')]['find']({'where':{'id':_0x4a714e[_0xa118('0x4f')]['id']}})[_0xa118('0x1d')](handleEntityNotFound(_0x1758fc,null))[_0xa118('0x1d')](removeEntity(_0x1758fc,null))[_0xa118('0x28')](handleError(_0x1758fc,null));};exports['describe']=function(_0x2e99a2,_0x187de8){return db[_0xa118('0x38')][_0xa118('0x55')]()['then'](respondWithResult(_0x187de8,null))[_0xa118('0x28')](handleError(_0x187de8,null));};var interaction_log=require(_0xa118('0x56'))(_0xa118('0x57'));exports[_0xa118('0x58')]=function(_0x2b3246,_0x5f17bb,_0x22a4a8){var _0x5a26a2={'agent':{},'channel':_0xa118('0x59')};if(_0x2b3246[_0xa118('0x54')]['id']){delete _0x2b3246[_0xa118('0x54')]['id'];}_0x2b3246[_0xa118('0x54')][_0xa118('0x5a')]=!![];_0x2b3246['body']['readAt']=moment()[_0xa118('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b3246[_0xa118('0x54')][_0xa118('0x5c')]=_0x2b3246[_0xa118('0x54')]['UserId']||_0x2b3246[_0xa118('0x5d')]['id'];_0x5a26a2[_0xa118('0x5e')]['id']=_0x2b3246[_0xa118('0x54')][_0xa118('0x5c')];return db[_0xa118('0x38')][_0xa118('0x52')]({'where':{'id':_0x2b3246['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f17bb,null))[_0xa118('0x1d')](saveUpdates(_0x2b3246[_0xa118('0x54')],null))['then'](function(_0x5e51a1){if(_0x5e51a1){_0x5a26a2[_0xa118('0x25')]=_0x5e51a1[_0xa118('0x5f')]({'plain':!![]});return db[_0xa118('0x60')][_0xa118('0x52')]({'where':{'id':_0x5e51a1['WhatsappInteractionId']}});}return null;})[_0xa118('0x1d')](handleEntityNotFound(_0x5f17bb,null))[_0xa118('0x1d')](function(_0x555e54){if(_0x555e54){return _0x555e54[_0xa118('0x61')]({'UserId':_0x2b3246[_0xa118('0x54')][_0xa118('0x5c')],'read1stAt':_[_0xa118('0x62')](_0x555e54[_0xa118('0x63')])?moment()[_0xa118('0x5b')](_0xa118('0x64')):undefined});}return null;})[_0xa118('0x1d')](function(_0x225145){if(_0x225145){_0x5a26a2['interaction']=_0x225145[_0xa118('0x5f')]({'plain':!![]});interaction_log['info'](_0xa118('0x65'),_0x2b3246[_0xa118('0x5d')]['id'],_0x2b3246[_0xa118('0x5d')]['name'],_0x2b3246[_0xa118('0x5d')][_0xa118('0x66')],_0x5a26a2[_0xa118('0x67')]['id'],_0x2b3246[_0xa118('0x54')]?JSON[_0xa118('0x22')](_0x2b3246[_0xa118('0x54')]):_0xa118('0x68'));return respondWithRpcPromise('AcceptMessage',_0xa118('0x69'),_0x5a26a2);}return null;})[_0xa118('0x1d')](function(_0xafdaea){var _0x59d437=_0xa118('0x6a')+_0xafdaea[_0xa118('0x25')][_0xa118('0x6b')];return db['sequelize'][_0xa118('0x3d')](_0x59d437,{'type':db[_0xa118('0x6c')]['QueryTypes'][_0xa118('0x6d')],'raw':!![]})[_0xa118('0x1d')](function(_0x8a2a44){return _0x8a2a44;});})[_0xa118('0x1d')](function(_0x4a5e25){if(_0x4a5e25){_0x5a26a2[_0xa118('0x25')][_0xa118('0x6e')]=_0x4a5e25[0x0];if(!_0x2b3246[_0xa118('0x54')][_0xa118('0x5c')])return;return db[_0xa118('0x6f')][_0xa118('0x52')]({'where':{'id':_0x2b3246[_0xa118('0x54')][_0xa118('0x5c')],'role':_0xa118('0x5e')},'attributes':['id',_0xa118('0x35'),_0xa118('0x70'),_0xa118('0x71'),'internal'],'raw':!![]});}return null;})[_0xa118('0x1d')](function(_0x329d80){if(!_0x329d80)return null;_0x5a26a2['message'][_0xa118('0x5e')]=_0x329d80;return _0x5a26a2;})[_0xa118('0x1d')](function(_0x1bd7cf){if(_0x1bd7cf){if(_0x2b3246[_0xa118('0x54')][_0xa118('0x72')]){_0x5a26a2[_0xa118('0x25')][_0xa118('0x73')]=util[_0xa118('0x5b')](_0xa118('0x74'),_0x2b3246[_0xa118('0x5d')][_0xa118('0x35')]);_0x5a26a2['message'][_0xa118('0x75')]=_0x5a26a2[_0xa118('0x75')];_0x5a26a2[_0xa118('0x25')][_0xa118('0x76')]=_0x5a26a2[_0xa118('0x75')];_0x5a26a2[_0xa118('0x25')]['event']=_0xa118('0x58');return respondWithRpcPromise(_0xa118('0x77'),'EventManager',{'event':'acceptmessage','message':_0x5a26a2[_0xa118('0x25')]},client9002)[_0xa118('0x1d')](function(){return _0x5a26a2;});}return _0x5a26a2;}return null;})[_0xa118('0x1d')](respondWithResult(_0x5f17bb,null))[_0xa118('0x28')](handleError(_0x5f17bb,null));};var interaction_log=require(_0xa118('0x56'))(_0xa118('0x57'));exports[_0xa118('0x32')]=function(_0x583ddb,_0x3a55f5,_0x4fe85d){var _0xe73253={'agent':{},'channel':_0xa118('0x59')};if(_0x583ddb[_0xa118('0x54')]['id']){delete _0x583ddb[_0xa118('0x54')]['id'];}_0x583ddb['body'][_0xa118('0x5c')]=_0x583ddb[_0xa118('0x54')][_0xa118('0x5c')]||_0x583ddb['user']['id'];_0xe73253[_0xa118('0x5e')]['id']=_0x583ddb[_0xa118('0x54')][_0xa118('0x5c')];return db[_0xa118('0x38')][_0xa118('0x52')]({'where':{'id':_0x583ddb['params']['id'],'UserId':null}})[_0xa118('0x1d')](handleEntityNotFound(_0x3a55f5,null))[_0xa118('0x1d')](function(_0x4530da){if(_0x4530da){_0xe73253[_0xa118('0x25')]=_0x4530da[_0xa118('0x5f')]({'plain':!![]});return db[_0xa118('0x60')]['find']({'where':{'id':_0x4530da[_0xa118('0x78')]}});}return null;})[_0xa118('0x1d')](handleEntityNotFound(_0x3a55f5,null))['then'](function(_0x56db3d){if(_0x56db3d){_0xe73253['interaction']=_0x56db3d[_0xa118('0x5f')]({'plain':!![]});interaction_log[_0xa118('0x1e')](_0xa118('0x79'),_0x583ddb[_0xa118('0x5d')]['id'],_0x583ddb[_0xa118('0x5d')][_0xa118('0x35')],_0x583ddb[_0xa118('0x5d')]['role'],_0xe73253[_0xa118('0x67')]['id'],_0x583ddb[_0xa118('0x54')]?JSON['stringify'](_0x583ddb[_0xa118('0x54')]):_0xa118('0x68'));return respondWithRpcPromise(_0xa118('0x7a'),'rejectMessage',_0xe73253);}return null;})['then'](function(_0x405847){var _0x51920b=_0xa118('0x6a')+_0x405847[_0xa118('0x25')][_0xa118('0x6b')];return db['sequelize'][_0xa118('0x3d')](_0x51920b,{'type':db[_0xa118('0x6c')]['QueryTypes'][_0xa118('0x6d')],'raw':!![]})[_0xa118('0x1d')](function(_0x1c57e1){return _0x1c57e1;});})[_0xa118('0x1d')](function(_0x27758d){if(_0x27758d){_0xe73253[_0xa118('0x25')][_0xa118('0x6e')]=_0x27758d[0x0];if(!_0x583ddb[_0xa118('0x54')][_0xa118('0x5c')])return;return db['User'][_0xa118('0x52')]({'where':{'id':_0x583ddb[_0xa118('0x54')][_0xa118('0x5c')],'role':_0xa118('0x5e')},'attributes':['id',_0xa118('0x35'),_0xa118('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xa118('0x1d')](function(_0x49c443){if(!_0x49c443)return null;_0xe73253[_0xa118('0x25')][_0xa118('0x5e')]=_0x49c443;return _0xe73253;})[_0xa118('0x1d')](function(_0x27bb6d){if(_0x27bb6d){_0x27bb6d[_0xa118('0x25')]['interface']=util[_0xa118('0x5b')](_0xa118('0x74'),_0x583ddb[_0xa118('0x5d')][_0xa118('0x35')]);_0x27bb6d[_0xa118('0x25')][_0xa118('0x75')]=_0xe73253['channel'];_0x27bb6d['message'][_0xa118('0x76')]=_0xe73253[_0xa118('0x75')];_0x27bb6d[_0xa118('0x25')][_0xa118('0x7b')]=_0xa118('0x32');respondWithRpcPromise(_0xa118('0x77'),_0xa118('0x77'),{'event':_0xa118('0x7c'),'message':_0x27bb6d['message']},client9002);return _0xe73253;}return null;})[_0xa118('0x1d')](respondWithResult(_0x3a55f5,null))[_0xa118('0x28')](handleError(_0x3a55f5,null));};exports['status']=function(_0x51e24e,_0x4881a0,_0x35b08a){if(_0x51e24e[_0xa118('0x54')]['id']){delete _0x51e24e[_0xa118('0x54')]['id'];}var _0x1e8889;return db[_0xa118('0x38')][_0xa118('0x52')]({'where':{'id':_0x51e24e[_0xa118('0x4f')]['id']}})[_0xa118('0x1d')](handleEntityNotFound(_0x4881a0,null))[_0xa118('0x1d')](function(_0x12ad51){if(_0x12ad51){_0x1e8889=_0x12ad51;return db[_0xa118('0x7d')][_0xa118('0x52')]({'where':{'id':_0x12ad51[_0xa118('0x7e')]}});}})[_0xa118('0x1d')](handleEntityNotFound(_0x4881a0,null))[_0xa118('0x1d')](function(_0x2445bf){if(_0x2445bf){logger[_0xa118('0x20')](_0xa118('0x7f'),_0xa118('0x2a'),_0xa118('0x80'),_0x2445bf['type'],util[_0xa118('0x81')](_0x51e24e[_0xa118('0x54')],{'showHidden':![],'depth':null}));switch(_0x2445bf['type']){case _0xa118('0x82'):if(_0x51e24e['body'][_0xa118('0x83')]&&_0x51e24e[_0xa118('0x54')]['MessageSid']===_0x1e8889[_0xa118('0x84')]&&_0x51e24e[_0xa118('0x54')][_0xa118('0x85')]&&_0x51e24e[_0xa118('0x54')][_0xa118('0x85')]===_0xa118('0x5a')){return _0x1e8889[_0xa118('0x61')]({'read':!![]});}else{logger['error'](_0xa118('0x86'),_0xa118('0x2a'),_0xa118('0x82'),util['inspect'](_0x51e24e[_0xa118('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1e8889;}})[_0xa118('0x1d')](respondWithResult(_0x4881a0,null))[_0xa118('0x28')](handleError(_0x4881a0,null));}; \ No newline at end of file +var _0xe2de=['sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','limit','offset','count','Content-Range','apply','sendStatus','name','index','map','WhatsappMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','rows','show','params','keys','include','find','create','body','update','destroy','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','format','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','contact','interface','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x15c6fa,_0x500c83){var _0x573aaa=function(_0x3d89cc){while(--_0x3d89cc){_0x15c6fa['push'](_0x15c6fa['shift']());}};_0x573aaa(++_0x500c83);}(_0xe2de,0xfb));var _0xee2d=function(_0x484c6b,_0x45e0f4){_0x484c6b=_0x484c6b-0x0;var _0x55884f=_0xe2de[_0x484c6b];return _0x55884f;};'use strict';var emlformat=require(_0xee2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee2d('0x1'));var jsonpatch=require(_0xee2d('0x2'));var rp=require(_0xee2d('0x3'));var moment=require(_0xee2d('0x4'));var BPromise=require(_0xee2d('0x5'));var Mustache=require(_0xee2d('0x6'));var util=require(_0xee2d('0x7'));var path=require(_0xee2d('0x8'));var sox=require(_0xee2d('0x9'));var csv=require(_0xee2d('0xa'));var ejs=require(_0xee2d('0xb'));var fs=require('fs');var fs_extra=require(_0xee2d('0xc'));var _=require(_0xee2d('0xd'));var squel=require(_0xee2d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee2d('0xf'));var toCsv=require(_0xee2d('0xa'));var querystring=require(_0xee2d('0x10'));var Papa=require(_0xee2d('0x11'));var Redis=require('ioredis');var authService=require(_0xee2d('0x12'));var qs=require(_0xee2d('0x13'));var as=require(_0xee2d('0x14'));var hardwareService=require(_0xee2d('0x15'));var logger=require(_0xee2d('0x16'))(_0xee2d('0x17'));var utils=require('../../config/utils');var config=require(_0xee2d('0x18'));var licenseUtil=require(_0xee2d('0x19'));var db=require(_0xee2d('0x1a'))['db'];config['redis']=_['defaults'](config[_0xee2d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xee2d('0x1c'))(new Redis(config[_0xee2d('0x1b')]));require(_0xee2d('0x1d'))['register'](socket);var jayson=require(_0xee2d('0x1e'));var client=jayson['client'][_0xee2d('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xee2d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xfee80a,_0x5ce7bb,_0x2ae481,_0x22b5c7){return new BPromise(function(_0x558a1e,_0x7e6a09){var _0x3eae5a=_0x22b5c7||client;return _0x3eae5a[_0xee2d('0x20')](_0xfee80a,_0x2ae481)[_0xee2d('0x21')](function(_0x1aeec0){logger['info'](_0xee2d('0x22'),_0x5ce7bb,_0xee2d('0x23'));logger[_0xee2d('0x24')](_0xee2d('0x25'),_0x5ce7bb,_0xee2d('0x23'),JSON[_0xee2d('0x26')](_0x1aeec0));if(_0x1aeec0[_0xee2d('0x27')]){if(_0x1aeec0[_0xee2d('0x27')][_0xee2d('0x28')]===0x1f4){logger[_0xee2d('0x27')](_0xee2d('0x22'),_0x5ce7bb,_0x1aeec0[_0xee2d('0x27')]['message']);return _0x7e6a09(_0x1aeec0[_0xee2d('0x27')][_0xee2d('0x29')]);}logger[_0xee2d('0x27')](_0xee2d('0x22'),_0x5ce7bb,_0x1aeec0['error'][_0xee2d('0x29')]);return _0x558a1e(_0x1aeec0[_0xee2d('0x27')][_0xee2d('0x29')]);}else{logger[_0xee2d('0x2a')](_0xee2d('0x22'),_0x5ce7bb,_0xee2d('0x23'));_0x558a1e(_0x1aeec0[_0xee2d('0x2b')][_0xee2d('0x29')]);}})[_0xee2d('0x2c')](function(_0x4669f3){logger[_0xee2d('0x27')](_0xee2d('0x22'),_0x5ce7bb,_0x4669f3);_0x7e6a09(_0x4669f3);});});}function respondWithStatusCode(_0x36f18b,_0x5ae1dc){_0x5ae1dc=_0x5ae1dc||0xcc;return function(_0x7f32b1){if(_0x7f32b1){return _0x36f18b['sendStatus'](_0x5ae1dc);}return _0x36f18b[_0xee2d('0x2d')](_0x5ae1dc)[_0xee2d('0x2e')]();};}function respondWithResult(_0x1ca63e,_0x475ccd){_0x475ccd=_0x475ccd||0xc8;return function(_0x2f34ea){if(_0x2f34ea){return _0x1ca63e[_0xee2d('0x2d')](_0x475ccd)[_0xee2d('0x2f')](_0x2f34ea);}};}function respondWithFilteredResult(_0x37c9ef,_0x2893f6){return function(_0x3c059c){if(_0x3c059c){var _0x558ec0=typeof _0x2893f6['offset']==='undefined'&&typeof _0x2893f6[_0xee2d('0x30')]==='undefined';var _0x5ea40b=_0x3c059c['count'];var _0x33251d=_0x558ec0?0x0:_0x2893f6[_0xee2d('0x31')];var _0x19339d=_0x558ec0?_0x3c059c[_0xee2d('0x32')]:_0x2893f6[_0xee2d('0x31')]+_0x2893f6[_0xee2d('0x30')];var _0x1f5540;if(_0x19339d>=_0x5ea40b){_0x19339d=_0x5ea40b;_0x1f5540=0xc8;}else{_0x1f5540=0xce;}_0x37c9ef[_0xee2d('0x2d')](_0x1f5540);return _0x37c9ef['set'](_0xee2d('0x33'),_0x33251d+'-'+_0x19339d+'/'+_0x5ea40b)[_0xee2d('0x2f')](_0x3c059c);}return null;};}function patchUpdates(_0x3d7d36){return function(_0x11f6cc){try{jsonpatch[_0xee2d('0x34')](_0x11f6cc,_0x3d7d36,!![]);}catch(_0x1854ae){return BPromise['reject'](_0x1854ae);}return _0x11f6cc['save']();};}function saveUpdates(_0x1c33ea,_0x5e95d2){return function(_0x57bc64){if(_0x57bc64){return _0x57bc64['update'](_0x1c33ea)[_0xee2d('0x21')](function(_0x530ffa){return _0x530ffa;});}return null;};}function removeEntity(_0x2d529b,_0x28c3f1){return function(_0x33eab4){if(_0x33eab4){return _0x33eab4['destroy']()[_0xee2d('0x21')](function(){_0x2d529b[_0xee2d('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0e1b,_0x1e6b41){return function(_0x3c1ddc){if(!_0x3c1ddc){_0x5b0e1b[_0xee2d('0x35')](0x194);}return _0x3c1ddc;};}function handleError(_0x2acece,_0x1ef3b4){_0x1ef3b4=_0x1ef3b4||0x1f4;return function(_0x2b6534){logger[_0xee2d('0x27')](_0x2b6534['stack']);if(_0x2b6534[_0xee2d('0x36')]){delete _0x2b6534[_0xee2d('0x36')];}_0x2acece[_0xee2d('0x2d')](_0x1ef3b4)['send'](_0x2b6534);};}exports[_0xee2d('0x37')]=function(_0x541557,_0x4ee171){var _0x21c530={},_0x159849={},_0x26ed34={'count':0x0,'rows':[]};var _0x1079cf=_[_0xee2d('0x38')](db[_0xee2d('0x39')]['rawAttributes'],function(_0x4f1338){return{'name':_0x4f1338[_0xee2d('0x3a')],'type':_0x4f1338['type'][_0xee2d('0x3b')]};});_0x159849[_0xee2d('0x3c')]=_[_0xee2d('0x38')](_0x1079cf,'name');_0x159849[_0xee2d('0x3d')]=_['keys'](_0x541557[_0xee2d('0x3d')]);_0x159849[_0xee2d('0x3e')]=_[_0xee2d('0x3f')](_0x159849[_0xee2d('0x3c')],_0x159849[_0xee2d('0x3d')]);_0x21c530[_0xee2d('0x40')]=_[_0xee2d('0x3f')](_0x159849[_0xee2d('0x3c')],qs[_0xee2d('0x41')](_0x541557[_0xee2d('0x3d')][_0xee2d('0x41')]));_0x21c530[_0xee2d('0x40')]=_0x21c530[_0xee2d('0x40')][_0xee2d('0x42')]?_0x21c530[_0xee2d('0x40')]:_0x159849['model'];if(!_0x541557[_0xee2d('0x3d')]['hasOwnProperty'](_0xee2d('0x43'))){_0x21c530[_0xee2d('0x30')]=qs[_0xee2d('0x30')](_0x541557[_0xee2d('0x3d')][_0xee2d('0x30')]);_0x21c530['offset']=qs[_0xee2d('0x31')](_0x541557[_0xee2d('0x3d')]['offset']);}_0x21c530[_0xee2d('0x44')]=qs[_0xee2d('0x45')](_0x541557[_0xee2d('0x3d')][_0xee2d('0x45')]);_0x21c530['where']=qs[_0xee2d('0x3e')](_[_0xee2d('0x46')](_0x541557[_0xee2d('0x3d')],_0x159849['filters']),_0x1079cf);if(_0x541557[_0xee2d('0x3d')][_0xee2d('0x47')]){_0x21c530[_0xee2d('0x48')]=_[_0xee2d('0x49')](_0x21c530[_0xee2d('0x48')],{'$or':_[_0xee2d('0x38')](_0x1079cf,function(_0xb9f5c5){if(_0xb9f5c5[_0xee2d('0x4a')]!=='VIRTUAL'){var _0x2e5626={};_0x2e5626[_0xb9f5c5['name']]={'$like':'%'+_0x541557[_0xee2d('0x3d')][_0xee2d('0x47')]+'%'};return _0x2e5626;}})});}_0x21c530=_[_0xee2d('0x49')]({},_0x21c530,_0x541557[_0xee2d('0x4b')]);var _0xb2a1d5={'where':_0x21c530[_0xee2d('0x48')]};return db[_0xee2d('0x39')][_0xee2d('0x32')](_0xb2a1d5)[_0xee2d('0x21')](function(_0xd2b20c){_0x26ed34['count']=_0xd2b20c;if(_0x541557['query']['includeAll']){_0x21c530['include']=[{'all':!![]}];}return db[_0xee2d('0x39')]['findAll'](_0x21c530);})[_0xee2d('0x21')](function(_0x5ce4aa){_0x26ed34[_0xee2d('0x4c')]=_0x5ce4aa;return _0x26ed34;})[_0xee2d('0x21')](respondWithFilteredResult(_0x4ee171,_0x21c530))[_0xee2d('0x2c')](handleError(_0x4ee171,null));};exports[_0xee2d('0x4d')]=function(_0x3b01f4,_0xa29698){var _0x18119e={'raw':!![],'where':{'id':_0x3b01f4[_0xee2d('0x4e')]['id']}},_0x465dfd={};_0x465dfd[_0xee2d('0x3c')]=_[_0xee2d('0x4f')](db[_0xee2d('0x39')]['rawAttributes']);_0x465dfd[_0xee2d('0x3d')]=_['keys'](_0x3b01f4[_0xee2d('0x3d')]);_0x465dfd[_0xee2d('0x3e')]=_['intersection'](_0x465dfd[_0xee2d('0x3c')],_0x465dfd[_0xee2d('0x3d')]);_0x18119e[_0xee2d('0x40')]=_[_0xee2d('0x3f')](_0x465dfd[_0xee2d('0x3c')],qs[_0xee2d('0x41')](_0x3b01f4[_0xee2d('0x3d')][_0xee2d('0x41')]));_0x18119e[_0xee2d('0x40')]=_0x18119e[_0xee2d('0x40')]['length']?_0x18119e[_0xee2d('0x40')]:_0x465dfd[_0xee2d('0x3c')];if(_0x3b01f4[_0xee2d('0x3d')]['includeAll']){_0x18119e[_0xee2d('0x50')]=[{'all':!![]}];}_0x18119e=_['merge']({},_0x18119e,_0x3b01f4[_0xee2d('0x4b')]);return db['WhatsappMessage'][_0xee2d('0x51')](_0x18119e)['then'](handleEntityNotFound(_0xa29698,null))[_0xee2d('0x21')](respondWithResult(_0xa29698,null))[_0xee2d('0x2c')](handleError(_0xa29698,null));};exports['create']=function(_0x2cfb0e,_0x53b91e){return db['WhatsappMessage'][_0xee2d('0x52')](_0x2cfb0e[_0xee2d('0x53')],{})[_0xee2d('0x21')](respondWithResult(_0x53b91e,0xc9))[_0xee2d('0x2c')](handleError(_0x53b91e,null));};exports[_0xee2d('0x54')]=function(_0x47595a,_0xe6a428){if(_0x47595a[_0xee2d('0x53')]['id']){delete _0x47595a[_0xee2d('0x53')]['id'];}return db[_0xee2d('0x39')][_0xee2d('0x51')]({'where':{'id':_0x47595a[_0xee2d('0x4e')]['id']}})[_0xee2d('0x21')](handleEntityNotFound(_0xe6a428,null))[_0xee2d('0x21')](saveUpdates(_0x47595a[_0xee2d('0x53')],null))[_0xee2d('0x21')](respondWithResult(_0xe6a428,null))[_0xee2d('0x2c')](handleError(_0xe6a428,null));};exports[_0xee2d('0x55')]=function(_0x2efa74,_0x2eafc9){return db['WhatsappMessage']['find']({'where':{'id':_0x2efa74['params']['id']}})[_0xee2d('0x21')](handleEntityNotFound(_0x2eafc9,null))[_0xee2d('0x21')](removeEntity(_0x2eafc9,null))[_0xee2d('0x2c')](handleError(_0x2eafc9,null));};exports[_0xee2d('0x56')]=function(_0xe16c16,_0x514759){return db['WhatsappMessage'][_0xee2d('0x56')]()[_0xee2d('0x21')](respondWithResult(_0x514759,null))['catch'](handleError(_0x514759,null));};var interaction_log=require('../../config/logger')(_0xee2d('0x57'));exports[_0xee2d('0x58')]=function(_0x5433ed,_0x461980,_0x479813){var _0x99ec5f={'agent':{},'channel':'whatsapp'};if(_0x5433ed[_0xee2d('0x53')]['id']){delete _0x5433ed[_0xee2d('0x53')]['id'];}_0x5433ed['body'][_0xee2d('0x59')]=!![];_0x5433ed[_0xee2d('0x53')][_0xee2d('0x5a')]=moment()['format'](_0xee2d('0x5b'));_0x5433ed[_0xee2d('0x53')][_0xee2d('0x5c')]=_0x5433ed[_0xee2d('0x53')][_0xee2d('0x5c')]||_0x5433ed[_0xee2d('0x5d')]['id'];_0x99ec5f['agent']['id']=_0x5433ed[_0xee2d('0x53')]['UserId'];return db[_0xee2d('0x39')][_0xee2d('0x51')]({'where':{'id':_0x5433ed[_0xee2d('0x4e')]['id'],'UserId':null}})[_0xee2d('0x21')](handleEntityNotFound(_0x461980,null))[_0xee2d('0x21')](saveUpdates(_0x5433ed['body'],null))[_0xee2d('0x21')](function(_0x1b6533){if(_0x1b6533){_0x99ec5f['message']=_0x1b6533[_0xee2d('0x5e')]({'plain':!![]});return db[_0xee2d('0x5f')]['find']({'where':{'id':_0x1b6533[_0xee2d('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x461980,null))[_0xee2d('0x21')](function(_0x443181){if(_0x443181){return _0x443181[_0xee2d('0x54')]({'UserId':_0x5433ed['body'][_0xee2d('0x5c')],'read1stAt':_['isNil'](_0x443181[_0xee2d('0x61')])?moment()[_0xee2d('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4c6102){if(_0x4c6102){_0x99ec5f[_0xee2d('0x63')]=_0x4c6102[_0xee2d('0x5e')]({'plain':!![]});interaction_log[_0xee2d('0x2a')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5433ed['user']['id'],_0x5433ed[_0xee2d('0x5d')]['name'],_0x5433ed['user']['role'],_0x99ec5f[_0xee2d('0x63')]['id'],_0x5433ed[_0xee2d('0x53')]?JSON[_0xee2d('0x26')](_0x5433ed[_0xee2d('0x53')]):_0xee2d('0x64'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x99ec5f);}return null;})['then'](function(_0x195bc3){var _0x5fa4c=_0xee2d('0x65')+_0x195bc3[_0xee2d('0x29')][_0xee2d('0x66')];return db[_0xee2d('0x67')][_0xee2d('0x3d')](_0x5fa4c,{'type':db[_0xee2d('0x68')]['QueryTypes'][_0xee2d('0x69')],'raw':!![]})[_0xee2d('0x21')](function(_0x49dcd3){return _0x49dcd3;});})['then'](function(_0x4b04c9){if(_0x4b04c9){_0x99ec5f[_0xee2d('0x29')]['contact']=_0x4b04c9[0x0];if(!_0x5433ed[_0xee2d('0x53')][_0xee2d('0x5c')])return;return db[_0xee2d('0x6a')][_0xee2d('0x51')]({'where':{'id':_0x5433ed[_0xee2d('0x53')][_0xee2d('0x5c')],'role':_0xee2d('0x6b')},'attributes':['id','name',_0xee2d('0x6c'),_0xee2d('0x6d'),_0xee2d('0x6e')],'raw':!![]});}return null;})[_0xee2d('0x21')](function(_0x1f3b08){if(!_0x1f3b08)return null;_0x99ec5f['message'][_0xee2d('0x6b')]=_0x1f3b08;return _0x99ec5f;})[_0xee2d('0x21')](function(_0x1fa73d){if(_0x1fa73d){if(_0x5433ed[_0xee2d('0x53')][_0xee2d('0x6f')]){_0x99ec5f[_0xee2d('0x29')]['interface']=util[_0xee2d('0x62')](_0xee2d('0x70'),_0x5433ed[_0xee2d('0x5d')][_0xee2d('0x36')]);_0x99ec5f['message'][_0xee2d('0x71')]=_0x99ec5f['channel'];_0x99ec5f[_0xee2d('0x29')][_0xee2d('0x72')]=_0x99ec5f[_0xee2d('0x71')];_0x99ec5f[_0xee2d('0x29')]['event']=_0xee2d('0x58');return respondWithRpcPromise(_0xee2d('0x73'),'EventManager',{'event':'acceptmessage','message':_0x99ec5f[_0xee2d('0x29')]},client9002)['then'](function(){return _0x99ec5f;});}return _0x99ec5f;}return null;})['then'](respondWithResult(_0x461980,null))[_0xee2d('0x2c')](handleError(_0x461980,null));};var interaction_log=require(_0xee2d('0x16'))(_0xee2d('0x57'));exports['reject']=function(_0x35d771,_0x47f38d,_0x29fafb){var _0xca4ead={'agent':{},'channel':'whatsapp'};if(_0x35d771[_0xee2d('0x53')]['id']){delete _0x35d771[_0xee2d('0x53')]['id'];}_0x35d771[_0xee2d('0x53')][_0xee2d('0x5c')]=_0x35d771[_0xee2d('0x53')]['UserId']||_0x35d771[_0xee2d('0x5d')]['id'];_0xca4ead[_0xee2d('0x6b')]['id']=_0x35d771[_0xee2d('0x53')][_0xee2d('0x5c')];return db[_0xee2d('0x39')][_0xee2d('0x51')]({'where':{'id':_0x35d771['params']['id'],'UserId':null}})[_0xee2d('0x21')](handleEntityNotFound(_0x47f38d,null))[_0xee2d('0x21')](function(_0x35dd02){if(_0x35dd02){_0xca4ead[_0xee2d('0x29')]=_0x35dd02[_0xee2d('0x5e')]({'plain':!![]});return db[_0xee2d('0x5f')][_0xee2d('0x51')]({'where':{'id':_0x35dd02[_0xee2d('0x60')]}});}return null;})[_0xee2d('0x21')](handleEntityNotFound(_0x47f38d,null))['then'](function(_0x4478c4){if(_0x4478c4){_0xca4ead['interaction']=_0x4478c4['get']({'plain':!![]});interaction_log[_0xee2d('0x2a')](_0xee2d('0x74'),_0x35d771[_0xee2d('0x5d')]['id'],_0x35d771[_0xee2d('0x5d')][_0xee2d('0x36')],_0x35d771[_0xee2d('0x5d')]['role'],_0xca4ead[_0xee2d('0x63')]['id'],_0x35d771[_0xee2d('0x53')]?JSON[_0xee2d('0x26')](_0x35d771[_0xee2d('0x53')]):_0xee2d('0x64'));return respondWithRpcPromise(_0xee2d('0x75'),'rejectMessage',_0xca4ead);}return null;})[_0xee2d('0x21')](function(_0x11062a){var _0x5ae776=_0xee2d('0x65')+_0x11062a['message'][_0xee2d('0x66')];return db[_0xee2d('0x67')]['query'](_0x5ae776,{'type':db[_0xee2d('0x68')][_0xee2d('0x76')][_0xee2d('0x69')],'raw':!![]})[_0xee2d('0x21')](function(_0x57efc9){return _0x57efc9;});})[_0xee2d('0x21')](function(_0x33189d){if(_0x33189d){_0xca4ead[_0xee2d('0x29')][_0xee2d('0x77')]=_0x33189d[0x0];if(!_0x35d771[_0xee2d('0x53')][_0xee2d('0x5c')])return;return db['User']['find']({'where':{'id':_0x35d771[_0xee2d('0x53')][_0xee2d('0x5c')],'role':_0xee2d('0x6b')},'attributes':['id',_0xee2d('0x36'),_0xee2d('0x6c'),_0xee2d('0x6d'),_0xee2d('0x6e')],'raw':!![]});}return null;})[_0xee2d('0x21')](function(_0x4c4a4a){if(!_0x4c4a4a)return null;_0xca4ead[_0xee2d('0x29')]['agent']=_0x4c4a4a;return _0xca4ead;})[_0xee2d('0x21')](function(_0xbec10d){if(_0xbec10d){_0xbec10d[_0xee2d('0x29')][_0xee2d('0x78')]=util[_0xee2d('0x62')](_0xee2d('0x70'),_0x35d771['user'][_0xee2d('0x36')]);_0xbec10d[_0xee2d('0x29')][_0xee2d('0x71')]=_0xca4ead[_0xee2d('0x71')];_0xbec10d['message'][_0xee2d('0x72')]=_0xca4ead[_0xee2d('0x71')];_0xbec10d[_0xee2d('0x29')]['event']='reject';respondWithRpcPromise('EventManager',_0xee2d('0x73'),{'event':_0xee2d('0x79'),'message':_0xbec10d['message']},client9002);return _0xca4ead;}return null;})[_0xee2d('0x21')](respondWithResult(_0x47f38d,null))[_0xee2d('0x2c')](handleError(_0x47f38d,null));};exports[_0xee2d('0x2d')]=function(_0x53c754,_0x3db7d7,_0x456776){if(_0x53c754['body']['id']){delete _0x53c754[_0xee2d('0x53')]['id'];}var _0x4ced8e;return db['WhatsappMessage']['find']({'where':{'id':_0x53c754[_0xee2d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3db7d7,null))[_0xee2d('0x21')](function(_0x4edb3c){if(_0x4edb3c){_0x4ced8e=_0x4edb3c;return db['WhatsappAccount'][_0xee2d('0x51')]({'where':{'id':_0x4edb3c[_0xee2d('0x7a')]}});}})[_0xee2d('0x21')](handleEntityNotFound(_0x3db7d7,null))[_0xee2d('0x21')](function(_0x1b0585){if(_0x1b0585){logger[_0xee2d('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xee2d('0x7b'),_0x1b0585[_0xee2d('0x4a')],util[_0xee2d('0x7c')](_0x53c754[_0xee2d('0x53')],{'showHidden':![],'depth':null}));switch(_0x1b0585[_0xee2d('0x4a')]){case'twilio':if(_0x53c754['body'][_0xee2d('0x7d')]&&_0x53c754[_0xee2d('0x53')][_0xee2d('0x7d')]===_0x4ced8e[_0xee2d('0x7e')]&&_0x53c754[_0xee2d('0x53')]['MessageStatus']&&_0x53c754[_0xee2d('0x53')][_0xee2d('0x7f')]===_0xee2d('0x59')){return _0x4ced8e[_0xee2d('0x54')]({'read':!![]});}else{logger[_0xee2d('0x27')](_0xee2d('0x80'),'status',_0xee2d('0x81'),util[_0xee2d('0x7c')](_0x53c754[_0xee2d('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x4ced8e;}})[_0xee2d('0x21')](respondWithResult(_0x3db7d7,null))['catch'](handleError(_0x3db7d7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 47f7d92..cad85d2 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 _0xb9a7=['emit','hasOwnProperty','hook','exports','../../mysqldb','update'];(function(_0x4ff295,_0x2431b4){var _0x5577ed=function(_0x1f5130){while(--_0x1f5130){_0x4ff295['push'](_0x4ff295['shift']());}};_0x5577ed(++_0x2431b4);}(_0xb9a7,0x112));var _0x7b9a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb9a7[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x7b9a('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b9a('0x1'),'afterDestroy':'remove'};function emitEvent(_0x1396ec){return function(_0x40ef7d,_0x37b25b,_0x24cae3){WhatsappMessageEvents[_0x7b9a('0x2')](_0x1396ec+':'+_0x40ef7d['id'],_0x40ef7d);WhatsappMessageEvents[_0x7b9a('0x2')](_0x1396ec,_0x40ef7d);_0x24cae3(null);};}for(var e in events){if(events[_0x7b9a('0x3')](e)){var event=events[e];WhatsappMessage[_0x7b9a('0x4')](e,emitEvent(event));}}module[_0x7b9a('0x5')]=WhatsappMessageEvents; \ No newline at end of file +var _0x94d2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','WhatsappMessage'];(function(_0x2847ec,_0x40ce19){var _0x507988=function(_0x3545a1){while(--_0x3545a1){_0x2847ec['push'](_0x2847ec['shift']());}};_0x507988(++_0x40ce19);}(_0x94d2,0x1cd));var _0x294d=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x94d2[_0xd2f4ac];return _0x9757b2;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x294d('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x294d('0x1')](0x0);var events={'afterCreate':_0x294d('0x2'),'afterUpdate':_0x294d('0x3'),'afterDestroy':_0x294d('0x4')};function emitEvent(_0x5c1993){return function(_0x541332,_0x2f2fc8,_0x393430){WhatsappMessageEvents[_0x294d('0x5')](_0x5c1993+':'+_0x541332['id'],_0x541332);WhatsappMessageEvents[_0x294d('0x5')](_0x5c1993,_0x541332);_0x393430(null);};}for(var e in events){if(events[_0x294d('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3646f78..c9b1f70 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 _0x8938=['./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x5766cf,_0x55a1c4){var _0x2c0996=function(_0xcf705e){while(--_0xcf705e){_0x5766cf['push'](_0x5766cf['shift']());}};_0x2c0996(++_0x55a1c4);}(_0x8938,0xb2));var _0x8893=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x8938[_0x834bb6];return _0xa35d00;};'use strict';var _=require(_0x8893('0x0'));var util=require(_0x8893('0x1'));var logger=require(_0x8893('0x2'))(_0x8893('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8893('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x8893('0x5'));var rimraf=require(_0x8893('0x6'));var config=require(_0x8893('0x7'));var attributes=require(_0x8893('0x8'));module[_0x8893('0x9')]=function(_0x18a1ab,_0xe58394){return _0x18a1ab[_0x8893('0xa')](_0x8893('0xb'),attributes,{'tableName':_0x8893('0xc'),'paranoid':![],'indexes':[{'name':_0x8893('0xd'),'fields':[_0x8893('0xd')]},{'name':_0x8893('0xe'),'fields':[_0x8893('0xf')],'type':_0x8893('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x127ed4,_0x5af8e0,_0x564ea2){var _0x556974=_0x18a1ab['models'];var _0x50387b=_0x127ed4[_0x8893('0x11')]({'plain':!![]});if(_0x50387b[_0x8893('0x12')][_0x8893('0x13')]()==='in'||_0x50387b[_0x8893('0x12')][_0x8893('0x13')]()===_0x8893('0x14')&&!_0x50387b[_0x8893('0x15')]&&!_[_0x8893('0x16')](_0x50387b[_0x8893('0x17')])){_0x556974[_0x8893('0x18')][_0x8893('0x19')]({'where':{'id':_0x50387b[_0x8893('0x1a')]}})['then'](function(_0x543fcf){if(_0x543fcf){_0x543fcf[_0x8893('0x1b')]({'lastMsgAt':_0x50387b[_0x8893('0x1c')],'lastMsgDirection':_0x50387b[_0x8893('0x12')][_0x8893('0x13')]()});}})[_0x8893('0x1d')](function(_0x3ff16e){console[_0x8893('0x1e')](_0x3ff16e);});}if(_0x50387b[_0x8893('0x12')]===_0x8893('0x14')&&!_0x50387b[_0x8893('0x15')]){var _0x48d3e3;_0x556974[_0x8893('0x1f')][_0x8893('0x20')]({'where':{'id':_0x50387b[_0x8893('0x21')]},'raw':!![]})[_0x8893('0x22')](function(_0x16f5b3){_0x48d3e3=_0x16f5b3;if(_0x48d3e3&&_0x48d3e3[_0x8893('0x23')]){switch(_0x48d3e3[_0x8893('0x23')]){case _0x8893('0x24'):var _0x5eca99=require(_0x8893('0x24'));if(_0x48d3e3['accountSid']&&_0x48d3e3[_0x8893('0x25')]&&_0x48d3e3[_0x8893('0x26')]){var _0x428dbc=new _0x5eca99(_0x48d3e3[_0x8893('0x27')],_0x48d3e3[_0x8893('0x25')]);_0x428dbc[_0x8893('0x28')][_0x8893('0x29')]({'body':_0x50387b[_0x8893('0xf')],'to':_0x8893('0x2a')+_0x50387b[_0x8893('0x26')],'from':_0x8893('0x2a')+_0x48d3e3['phone'],'statusCallback':_0x48d3e3[_0x8893('0x2b')]+'/api/whatsapp/messages/'+_0x50387b['id']+_0x8893('0x2c')+_0x48d3e3[_0x8893('0x2d')]})[_0x8893('0x22')](function(_0x374806){if(_0x374806['sid']){return _0x127ed4['update']({'messageId':_0x374806['sid']});}})[_0x8893('0x1d')](function(_0x547e66){logger['error'](_0x8893('0x2e'),_0x8893('0x2f'),_0x8893('0x24'),util['inspect'](_0x547e66,{'showHidden':![],'depth':null}));});}else{logger[_0x8893('0x1e')](_0x8893('0x2e'),_0x8893('0x2f'),'twilio',_0x8893('0x30'));}break;case _0x8893('0x31'):var _0x54d577=_0x48d3e3['accountSid'];var _0x375109=_0x48d3e3[_0x8893('0x25')];var _0x54ab4a=_0x48d3e3[_0x8893('0x32')]+_0x8893('0x33')+_0x54d577+_0x8893('0x34');var _0x677ee7={'to':[_0x50387b[_0x8893('0x26')]],'message':{'type':_0x8893('0x35'),'text':_0x50387b[_0x8893('0xf')]}};var _0x553513={'method':_0x8893('0x36'),'uri':_0x54ab4a,'headers':{'Authorization':_0x8893('0x37')+_0x375109,'Content-Type':_0x8893('0x38')},'body':_0x677ee7,'json':!![]};rp(_0x553513)[_0x8893('0x22')](function(_0x22136f){if(_0x22136f[_0x8893('0x39')][0x0][_0x8893('0x3a')]){return _0x127ed4['update']({'messageId':_0x22136f[_0x8893('0x39')][0x0][_0x8893('0x3a')]});}})[_0x8893('0x1d')](function(_0x5049c2){logger[_0x8893('0x3b')](_0x8893('0x3c'),_0x5049c2);});break;}}})[_0x8893('0x3d')](function(){_0x564ea2();});}else{_0x564ea2();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x11ce=['node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','then','twilio','accountSid','authToken','messages','whatsapp:','phone','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','api','moment','request-promise'];(function(_0x5501b3,_0x5b133a){var _0x54dcd1=function(_0x2b7a21){while(--_0x2b7a21){_0x5501b3['push'](_0x5501b3['shift']());}};_0x54dcd1(++_0x5b133a);}(_0x11ce,0xd3));var _0xe11c=function(_0x357c5e,_0x3561d3){_0x357c5e=_0x357c5e-0x0;var _0x4b943f=_0x11ce[_0x357c5e];return _0x4b943f;};'use strict';var _=require(_0xe11c('0x0'));var util=require(_0xe11c('0x1'));var logger=require('../../config/logger')(_0xe11c('0x2'));var moment=require(_0xe11c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe11c('0x4'));var fetch=require(_0xe11c('0x5'));var fs=require('fs');var path=require(_0xe11c('0x6'));var rimraf=require(_0xe11c('0x7'));var config=require(_0xe11c('0x8'));var attributes=require(_0xe11c('0x9'));module['exports']=function(_0x380eb9,_0x2ef784){return _0x380eb9['define'](_0xe11c('0xa'),attributes,{'tableName':_0xe11c('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xe11c('0xc'),'fields':[_0xe11c('0xd')],'type':_0xe11c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58033f,_0x290ff3,_0x27ee17){var _0x45799c=_0x380eb9['models'];var _0x242a76=_0x58033f[_0xe11c('0xf')]({'plain':!![]});if(_0x242a76[_0xe11c('0x10')][_0xe11c('0x11')]()==='in'||_0x242a76[_0xe11c('0x10')][_0xe11c('0x11')]()===_0xe11c('0x12')&&!_0x242a76['secret']&&!_[_0xe11c('0x13')](_0x242a76['UserId'])){_0x45799c['WhatsappInteraction'][_0xe11c('0x14')]({'where':{'id':_0x242a76[_0xe11c('0x15')]}})['then'](function(_0x214dd7){if(_0x214dd7){_0x214dd7[_0xe11c('0x16')]({'lastMsgAt':_0x242a76[_0xe11c('0x17')],'lastMsgDirection':_0x242a76[_0xe11c('0x10')][_0xe11c('0x11')]()});}})[_0xe11c('0x18')](function(_0x5b6e1c){console[_0xe11c('0x19')](_0x5b6e1c);});}if(_0x242a76[_0xe11c('0x10')]===_0xe11c('0x12')&&!_0x242a76['secret']){var _0x54095a;_0x45799c[_0xe11c('0x1a')][_0xe11c('0x1b')]({'where':{'id':_0x242a76['WhatsappAccountId']},'raw':!![]})[_0xe11c('0x1c')](function(_0x1fc1bd){_0x54095a=_0x1fc1bd;if(_0x54095a&&_0x54095a['type']){switch(_0x54095a['type']){case _0xe11c('0x1d'):var _0x5dba28=require(_0xe11c('0x1d'));if(_0x54095a[_0xe11c('0x1e')]&&_0x54095a['authToken']&&_0x54095a['phone']){var _0x4b72ca=new _0x5dba28(_0x54095a[_0xe11c('0x1e')],_0x54095a[_0xe11c('0x1f')]);_0x4b72ca[_0xe11c('0x20')]['create']({'body':_0x242a76[_0xe11c('0xd')],'to':_0xe11c('0x21')+_0x242a76[_0xe11c('0x22')],'from':_0xe11c('0x21')+_0x54095a[_0xe11c('0x22')],'statusCallback':_0x54095a[_0xe11c('0x23')]+'/api/whatsapp/messages/'+_0x242a76['id']+_0xe11c('0x24')+_0x54095a[_0xe11c('0x25')]})[_0xe11c('0x1c')](function(_0x3b428e){if(_0x3b428e['sid']){return _0x58033f['update']({'messageId':_0x3b428e[_0xe11c('0x26')]});}})['catch'](function(_0x1b745d){logger[_0xe11c('0x19')](_0xe11c('0x27'),_0xe11c('0x28'),'twilio',util[_0xe11c('0x29')](_0x1b745d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe11c('0x27'),_0xe11c('0x28'),'twilio',_0xe11c('0x2a'));}break;case _0xe11c('0x2b'):var _0x14caa9=_0x54095a[_0xe11c('0x1e')];var _0xe63bbf=_0x54095a[_0xe11c('0x1f')];var _0x2264e5=_0x54095a[_0xe11c('0x2c')]+'/whatsapp/v1/'+_0x14caa9+_0xe11c('0x2d');var _0x18a48b={'to':[_0x242a76[_0xe11c('0x22')]],'message':{'type':_0xe11c('0x2e'),'text':_0x242a76[_0xe11c('0xd')]}};var _0x46612c={'method':_0xe11c('0x2f'),'uri':_0x2264e5,'headers':{'Authorization':_0xe11c('0x30')+_0xe63bbf,'Content-Type':_0xe11c('0x31')},'body':_0x18a48b,'json':!![]};rp(_0x46612c)[_0xe11c('0x1c')](function(_0x5628e3){if(_0x5628e3['statuses'][0x0][_0xe11c('0x32')]){return _0x58033f[_0xe11c('0x16')]({'messageId':_0x5628e3['statuses'][0x0][_0xe11c('0x32')]});}})[_0xe11c('0x18')](function(_0x2f3e2b){logger['err'](_0xe11c('0x33'),_0x2f3e2b);});break;}}})[_0xe11c('0x34')](function(){_0x27ee17();});}else{_0x27ee17();}}},'charset':_0xe11c('0x35'),'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 461875e..9d5aee4 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 _0xcd45=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','util','moment','bluebird'];(function(_0x58600d,_0x4856fd){var _0x2caf7f=function(_0x32f99a){while(--_0x32f99a){_0x58600d['push'](_0x58600d['shift']());}};_0x2caf7f(++_0x4856fd);}(_0xcd45,0x115));var _0x5cd4=function(_0x1b1fb8,_0x2eb49e){_0x1b1fb8=_0x1b1fb8-0x0;var _0x4b299e=_0xcd45[_0x1b1fb8];return _0x4b299e;};'use strict';var _=require('lodash');var util=require(_0x5cd4('0x0'));var moment=require(_0x5cd4('0x1'));var BPromise=require(_0x5cd4('0x2'));var rs=require(_0x5cd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cd4('0x4'))['db'];var utils=require(_0x5cd4('0x5'));var logger=require(_0x5cd4('0x6'))(_0x5cd4('0x7'));var config=require(_0x5cd4('0x8'));var jayson=require(_0x5cd4('0x9'));var client=jayson[_0x5cd4('0xa')][_0x5cd4('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5cd4('0xc'),'port':0x18eb});var socket=require(_0x5cd4('0xd'))(new Redis(config[_0x5cd4('0xe')]));require(_0x5cd4('0xf'))[_0x5cd4('0x10')](socket);function respondWithRpcPromise(_0x1a250f,_0x72d936,_0xc419eb){return new BPromise(function(_0x459189,_0x42613b){return client[_0x5cd4('0x11')](_0x1a250f,_0xc419eb)[_0x5cd4('0x12')](function(_0x4f614c){logger[_0x5cd4('0x13')](_0x5cd4('0x14'),_0x72d936,_0x5cd4('0x15'));logger[_0x5cd4('0x16')](_0x5cd4('0x17'),_0x72d936,_0x5cd4('0x15'),JSON[_0x5cd4('0x18')](_0x4f614c));if(_0x4f614c[_0x5cd4('0x19')]){if(_0x4f614c[_0x5cd4('0x19')][_0x5cd4('0x1a')]===0x1f4){logger['error'](_0x5cd4('0x14'),_0x72d936,_0x4f614c[_0x5cd4('0x19')][_0x5cd4('0x1b')]);return _0x42613b(_0x4f614c[_0x5cd4('0x19')][_0x5cd4('0x1b')]);}logger['error'](_0x5cd4('0x14'),_0x72d936,_0x4f614c[_0x5cd4('0x19')]['message']);return _0x459189(_0x4f614c[_0x5cd4('0x19')][_0x5cd4('0x1b')]);}else{logger[_0x5cd4('0x13')](_0x5cd4('0x14'),_0x72d936,_0x5cd4('0x15'));_0x459189(_0x4f614c[_0x5cd4('0x1c')][_0x5cd4('0x1b')]);}})[_0x5cd4('0x1d')](function(_0x2d0574){logger[_0x5cd4('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x72d936,_0x2d0574);_0x42613b(_0x2d0574);});});}exports['CreateWhatsappMessage']=function(_0x1ce830){var _0x2c09c2=this;return new Promise(function(_0x44c884,_0x59d0c1){return db['WhatsappMessage'][_0x5cd4('0x1e')](_0x1ce830[_0x5cd4('0x1f')],{'raw':_0x1ce830[_0x5cd4('0x20')]?_0x1ce830[_0x5cd4('0x20')][_0x5cd4('0x21')]===undefined?!![]:![]:!![]})[_0x5cd4('0x12')](function(_0x20cdfe){logger[_0x5cd4('0x13')]('CreateWhatsappMessage',_0x1ce830);logger[_0x5cd4('0x16')](_0x5cd4('0x22'),_0x1ce830,JSON[_0x5cd4('0x18')](_0x20cdfe));_0x44c884(_0x20cdfe);})['catch'](function(_0x12752b){logger['error'](_0x5cd4('0x22'),_0x12752b[_0x5cd4('0x1b')],_0x1ce830);_0x59d0c1(_0x2c09c2['error'](0x1f4,_0x12752b[_0x5cd4('0x1b')]));});});}; \ No newline at end of file +var _0x3da4=['result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x552c21,_0x32abe6){var _0x312606=function(_0x3bafee){while(--_0x3bafee){_0x552c21['push'](_0x552c21['shift']());}};_0x312606(++_0x32abe6);}(_0x3da4,0xee));var _0x43da=function(_0x30c75e,_0x42bfe4){_0x30c75e=_0x30c75e-0x0;var _0x1bebaf=_0x3da4[_0x30c75e];return _0x1bebaf;};'use strict';var _=require(_0x43da('0x0'));var util=require(_0x43da('0x1'));var moment=require('moment');var BPromise=require(_0x43da('0x2'));var rs=require(_0x43da('0x3'));var fs=require('fs');var Redis=require(_0x43da('0x4'));var db=require(_0x43da('0x5'))['db'];var utils=require(_0x43da('0x6'));var logger=require(_0x43da('0x7'))(_0x43da('0x8'));var config=require(_0x43da('0x9'));var jayson=require(_0x43da('0xa'));var client=jayson[_0x43da('0xb')][_0x43da('0xc')]({'port':0x232a});config[_0x43da('0xd')]=_[_0x43da('0xe')](config[_0x43da('0xd')],{'host':_0x43da('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43da('0xd')]));require('./whatsappMessage.socket')[_0x43da('0x10')](socket);function respondWithRpcPromise(_0x241224,_0x5e5eda,_0xe32026){return new BPromise(function(_0x3a74bf,_0x2c9f64){return client[_0x43da('0x11')](_0x241224,_0xe32026)[_0x43da('0x12')](function(_0x472d3a){logger[_0x43da('0x13')](_0x43da('0x14'),_0x5e5eda,_0x43da('0x15'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5e5eda,_0x43da('0x15'),JSON[_0x43da('0x16')](_0x472d3a));if(_0x472d3a[_0x43da('0x17')]){if(_0x472d3a[_0x43da('0x17')][_0x43da('0x18')]===0x1f4){logger['error'](_0x43da('0x14'),_0x5e5eda,_0x472d3a[_0x43da('0x17')][_0x43da('0x19')]);return _0x2c9f64(_0x472d3a['error'][_0x43da('0x19')]);}logger[_0x43da('0x17')](_0x43da('0x14'),_0x5e5eda,_0x472d3a[_0x43da('0x17')]['message']);return _0x3a74bf(_0x472d3a[_0x43da('0x17')][_0x43da('0x19')]);}else{logger[_0x43da('0x13')](_0x43da('0x14'),_0x5e5eda,_0x43da('0x15'));_0x3a74bf(_0x472d3a[_0x43da('0x1a')][_0x43da('0x19')]);}})[_0x43da('0x1b')](function(_0x5556d0){logger[_0x43da('0x17')](_0x43da('0x14'),_0x5e5eda,_0x5556d0);_0x2c9f64(_0x5556d0);});});}exports[_0x43da('0x1c')]=function(_0x46de38){var _0x15502b=this;return new Promise(function(_0x339f28,_0x52ac0e){return db[_0x43da('0x1d')][_0x43da('0x1e')](_0x46de38['body'],{'raw':_0x46de38[_0x43da('0x1f')]?_0x46de38[_0x43da('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x237d98){logger[_0x43da('0x13')](_0x43da('0x1c'),_0x46de38);logger[_0x43da('0x20')](_0x43da('0x1c'),_0x46de38,JSON['stringify'](_0x237d98));_0x339f28(_0x237d98);})[_0x43da('0x1b')](function(_0x35df62){logger[_0x43da('0x17')](_0x43da('0x1c'),_0x35df62[_0x43da('0x19')],_0x46de38);_0x52ac0e(_0x15502b[_0x43da('0x17')](0x1f4,_0x35df62['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 21532ff..99427bf 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 _0x883d=['remove','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x221b76,_0x3ecddd){var _0x37d2eb=function(_0x8fb42b){while(--_0x8fb42b){_0x221b76['push'](_0x221b76['shift']());}};_0x37d2eb(++_0x3ecddd);}(_0x883d,0x89));var _0xd883=function(_0x4b9392,_0x45c6d9){_0x4b9392=_0x4b9392-0x0;var _0x5d6494=_0x883d[_0x4b9392];return _0x5d6494;};'use strict';var WhatsappMessageEvents=require(_0xd883('0x0'));var events=['save',_0xd883('0x1'),'update'];function createListener(_0x1b33b6,_0x300880){return function(_0x3cb21b){_0x300880[_0xd883('0x2')](_0x1b33b6,_0x3cb21b);};}function removeListener(_0x487737,_0x61de2){return function(){WhatsappMessageEvents[_0xd883('0x3')](_0x487737,_0x61de2);};}exports[_0xd883('0x4')]=function(_0x4ecdfd){for(var _0x1ab63a=0x0,_0xaacd6c=events['length'];_0x1ab63a<_0xaacd6c;_0x1ab63a++){var _0x1c6aa0=events[_0x1ab63a];var _0x23476d=createListener(_0xd883('0x5')+_0x1c6aa0,_0x4ecdfd);WhatsappMessageEvents['on'](_0x1c6aa0,_0x23476d);}}; \ No newline at end of file +var _0x8852=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0xa32ebf,_0x23d8c2){var _0x3cdca2=function(_0x42ed79){while(--_0x42ed79){_0xa32ebf['push'](_0xa32ebf['shift']());}};_0x3cdca2(++_0x23d8c2);}(_0x8852,0xba));var _0x2885=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8852[_0x122096];return _0x3d1966;};'use strict';var WhatsappMessageEvents=require(_0x2885('0x0'));var events=[_0x2885('0x1'),_0x2885('0x2'),_0x2885('0x3')];function createListener(_0x277a55,_0x1541a4){return function(_0xdee94){_0x1541a4[_0x2885('0x4')](_0x277a55,_0xdee94);};}function removeListener(_0x3c9657,_0x21f6e0){return function(){WhatsappMessageEvents[_0x2885('0x5')](_0x3c9657,_0x21f6e0);};}exports['register']=function(_0x2d113d){for(var _0x31198f=0x0,_0x22cd7b=events[_0x2885('0x6')];_0x31198f<_0x22cd7b;_0x31198f++){var _0x1f19d5=events[_0x31198f];var _0x5886c2=createListener(_0x2885('0x7')+_0x1f19d5,_0x2d113d);WhatsappMessageEvents['on'](_0x1f19d5,_0x5886c2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 66bca59..459fd50 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 _0x3ce4=['get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams','/:id/users','addAgents','put','/:id','delete','destroy','removeTeams','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index'];(function(_0x4305d6,_0x4abe30){var _0x56265a=function(_0x21640d){while(--_0x21640d){_0x4305d6['push'](_0x4305d6['shift']());}};_0x56265a(++_0x4abe30);}(_0x3ce4,0x17b));var _0x43ce=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x3ce4[_0x340380];return _0x49ce1c;};'use strict';var multer=require(_0x43ce('0x0'));var util=require(_0x43ce('0x1'));var path=require('path');var timeout=require(_0x43ce('0x2'));var express=require('express');var router=express[_0x43ce('0x3')]();var fs_extra=require(_0x43ce('0x4'));var auth=require(_0x43ce('0x5'));var interaction=require(_0x43ce('0x6'));var config=require(_0x43ce('0x7'));var controller=require(_0x43ce('0x8'));router['get']('/',auth[_0x43ce('0x9')](),controller[_0x43ce('0xa')]);router[_0x43ce('0xb')](_0x43ce('0xc'),auth[_0x43ce('0x9')](),controller[_0x43ce('0xd')]);router[_0x43ce('0xb')]('/:id',auth[_0x43ce('0x9')](),controller[_0x43ce('0xe')]);router['get'](_0x43ce('0xf'),auth[_0x43ce('0x9')](),controller[_0x43ce('0x10')]);router[_0x43ce('0xb')](_0x43ce('0x11'),auth['isAuthenticated'](),controller[_0x43ce('0x12')]);router[_0x43ce('0xb')]('/:id/users',auth[_0x43ce('0x9')](),controller['getAgents']);router['post']('/',auth[_0x43ce('0x9')](),controller[_0x43ce('0x13')]);router[_0x43ce('0x14')](_0x43ce('0x11'),auth[_0x43ce('0x9')](),controller[_0x43ce('0x15')]);router[_0x43ce('0x14')](_0x43ce('0x16'),auth[_0x43ce('0x9')](),controller[_0x43ce('0x17')]);router[_0x43ce('0x18')](_0x43ce('0x19'),auth[_0x43ce('0x9')](),controller['update']);router[_0x43ce('0x1a')](_0x43ce('0x19'),auth[_0x43ce('0x9')](),controller[_0x43ce('0x1b')]);router[_0x43ce('0x1a')](_0x43ce('0x11'),auth[_0x43ce('0x9')](),controller[_0x43ce('0x1c')]);router[_0x43ce('0x1a')](_0x43ce('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x43ce('0x1d')]=router; \ No newline at end of file +var _0x5dfd=['isAuthenticated','index','/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','post','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get'];(function(_0x2cf077,_0x5aa683){var _0x430718=function(_0x5c632b){while(--_0x5c632b){_0x2cf077['push'](_0x2cf077['shift']());}};_0x430718(++_0x5aa683);}(_0x5dfd,0x1c1));var _0xd5df=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x5dfd[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0xd5df('0x0'));var util=require(_0xd5df('0x1'));var path=require('path');var timeout=require(_0xd5df('0x2'));var express=require(_0xd5df('0x3'));var router=express[_0xd5df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5df('0x5'));var interaction=require(_0xd5df('0x6'));var config=require(_0xd5df('0x7'));var controller=require(_0xd5df('0x8'));router[_0xd5df('0x9')]('/',auth[_0xd5df('0xa')](),controller[_0xd5df('0xb')]);router[_0xd5df('0x9')](_0xd5df('0xc'),auth[_0xd5df('0xa')](),controller['describe']);router[_0xd5df('0x9')]('/:id',auth[_0xd5df('0xa')](),controller[_0xd5df('0xd')]);router[_0xd5df('0x9')](_0xd5df('0xe'),auth[_0xd5df('0xa')](),controller['getMembers']);router[_0xd5df('0x9')](_0xd5df('0xf'),auth[_0xd5df('0xa')](),controller[_0xd5df('0x10')]);router[_0xd5df('0x9')](_0xd5df('0x11'),auth[_0xd5df('0xa')](),controller['getAgents']);router[_0xd5df('0x12')]('/',auth[_0xd5df('0xa')](),controller['create']);router['post'](_0xd5df('0xf'),auth[_0xd5df('0xa')](),controller['addTeams']);router[_0xd5df('0x12')](_0xd5df('0x11'),auth[_0xd5df('0xa')](),controller['addAgents']);router[_0xd5df('0x13')]('/:id',auth[_0xd5df('0xa')](),controller[_0xd5df('0x14')]);router[_0xd5df('0x15')](_0xd5df('0x16'),auth[_0xd5df('0xa')](),controller[_0xd5df('0x17')]);router[_0xd5df('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd5df('0x18')]);router[_0xd5df('0x15')](_0xd5df('0x11'),auth[_0xd5df('0xa')](),controller[_0xd5df('0x19')]);module[_0xd5df('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5a298dc..22cde1d 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 _0x983c=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x390290,_0x570ded){var _0x572562=function(_0x1580f9){while(--_0x1580f9){_0x390290['push'](_0x390290['shift']());}};_0x572562(++_0x570ded);}(_0x983c,0xf3));var _0xc983=function(_0xb42ec7,_0x4a0132){_0xb42ec7=_0xb42ec7-0x0;var _0x5824d5=_0x983c[_0xb42ec7];return _0x5824d5;};'use strict';var Sequelize=require(_0xc983('0x0'));module[_0xc983('0x1')]={'name':{'type':Sequelize[_0xc983('0x2')],'unique':_0xc983('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc983('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc983('0x5'),_0xc983('0x6'),_0xc983('0x7'))},'description':{'type':Sequelize[_0xc983('0x2')]}}; \ No newline at end of file +var _0xc423=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x4a925f,_0x21866b){var _0xd2d47c=function(_0x153a66){while(--_0x153a66){_0x4a925f['push'](_0x4a925f['shift']());}};_0xd2d47c(++_0x21866b);}(_0xc423,0x159));var _0x3c42=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc423[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x3c42('0x0'));module[_0x3c42('0x1')]={'name':{'type':Sequelize[_0x3c42('0x2')],'unique':_0x3c42('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3c42('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3c42('0x5'),_0x3c42('0x6'),_0x3c42('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8776bfb..82b5868 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 _0xb1db=['each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','compact','value','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','WhatsappQueueId','filter','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','findAll','User','Agents','online','flatMap','transaction'];(function(_0x109d91,_0x37b324){var _0x4fd53d=function(_0xf74bd6){while(--_0xf74bd6){_0x109d91['push'](_0x109d91['shift']());}};_0x4fd53d(++_0x37b324);}(_0xb1db,0x13c));var _0xbb1d=function(_0x1bad26,_0xf6f79f){_0x1bad26=_0x1bad26-0x0;var _0x23b581=_0xb1db[_0x1bad26];return _0x23b581;};'use strict';var emlformat=require(_0xbb1d('0x0'));var rimraf=require(_0xbb1d('0x1'));var zipdir=require(_0xbb1d('0x2'));var jsonpatch=require(_0xbb1d('0x3'));var rp=require(_0xbb1d('0x4'));var moment=require(_0xbb1d('0x5'));var BPromise=require(_0xbb1d('0x6'));var Mustache=require(_0xbb1d('0x7'));var util=require(_0xbb1d('0x8'));var path=require(_0xbb1d('0x9'));var sox=require('sox');var csv=require(_0xbb1d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb1d('0xb'));var _=require(_0xbb1d('0xc'));var squel=require(_0xbb1d('0xd'));var crypto=require(_0xbb1d('0xe'));var jsforce=require(_0xbb1d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbb1d('0xa'));var querystring=require(_0xbb1d('0x10'));var Papa=require(_0xbb1d('0x11'));var Redis=require(_0xbb1d('0x12'));var authService=require(_0xbb1d('0x13'));var qs=require(_0xbb1d('0x14'));var as=require(_0xbb1d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb1d('0x16'))('api');var utils=require(_0xbb1d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xbb1d('0x18')],{'host':_0xbb1d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbb1d('0x1a'))[_0xbb1d('0x1b')](socket);function respondWithStatusCode(_0x1e0d09,_0x333039){_0x333039=_0x333039||0xcc;return function(_0x58abc1){if(_0x58abc1){return _0x1e0d09[_0xbb1d('0x1c')](_0x333039);}return _0x1e0d09['status'](_0x333039)['end']();};}function respondWithResult(_0x5aab73,_0x321d76){_0x321d76=_0x321d76||0xc8;return function(_0x181a78){if(_0x181a78){return _0x5aab73[_0xbb1d('0x1d')](_0x321d76)[_0xbb1d('0x1e')](_0x181a78);}};}function respondWithFilteredResult(_0x18b57d,_0x24fd9f){return function(_0x5d1f6b){if(_0x5d1f6b){var _0x56bf0f=typeof _0x24fd9f[_0xbb1d('0x1f')]==='undefined'&&typeof _0x24fd9f['limit']===_0xbb1d('0x20');var _0x164185=_0x5d1f6b[_0xbb1d('0x21')];var _0x1cd27f=_0x56bf0f?0x0:_0x24fd9f[_0xbb1d('0x1f')];var _0x4d7a07=_0x56bf0f?_0x5d1f6b[_0xbb1d('0x21')]:_0x24fd9f[_0xbb1d('0x1f')]+_0x24fd9f[_0xbb1d('0x22')];var _0xc0dec2;if(_0x4d7a07>=_0x164185){_0x4d7a07=_0x164185;_0xc0dec2=0xc8;}else{_0xc0dec2=0xce;}_0x18b57d[_0xbb1d('0x1d')](_0xc0dec2);return _0x18b57d[_0xbb1d('0x23')]('Content-Range',_0x1cd27f+'-'+_0x4d7a07+'/'+_0x164185)[_0xbb1d('0x1e')](_0x5d1f6b);}return null;};}function patchUpdates(_0x2bab06){return function(_0x487213){try{jsonpatch[_0xbb1d('0x24')](_0x487213,_0x2bab06,!![]);}catch(_0x4c8467){return BPromise[_0xbb1d('0x25')](_0x4c8467);}return _0x487213[_0xbb1d('0x26')]();};}function saveUpdates(_0x519fd1,_0x601d2b){return function(_0x145b18){if(_0x145b18){return _0x145b18[_0xbb1d('0x27')](_0x519fd1)[_0xbb1d('0x28')](function(_0x259160){return _0x259160;});}return null;};}function removeEntity(_0x317ec2,_0x524072){return function(_0x18bdb5){if(_0x18bdb5){return _0x18bdb5['destroy']()[_0xbb1d('0x28')](function(){var _0x466501=_0x18bdb5[_0xbb1d('0x29')]({'plain':!![]});var _0xa86471='WhatsappQueues';return db[_0xbb1d('0x2a')][_0xbb1d('0x2b')]({'where':{'type':_0xa86471,'resourceId':_0x466501['id']}})[_0xbb1d('0x28')](function(){return _0x18bdb5;});})[_0xbb1d('0x28')](function(){_0x317ec2[_0xbb1d('0x1d')](0xcc)[_0xbb1d('0x2c')]();});}};}function handleEntityNotFound(_0x49813c,_0x2ab05b){return function(_0x139b5e){if(!_0x139b5e){_0x49813c[_0xbb1d('0x1c')](0x194);}return _0x139b5e;};}function handleError(_0x1e45c4,_0x2ccf65){_0x2ccf65=_0x2ccf65||0x1f4;return function(_0x594e89){logger[_0xbb1d('0x2d')](_0x594e89[_0xbb1d('0x2e')]);if(_0x594e89[_0xbb1d('0x2f')]){delete _0x594e89['name'];}_0x1e45c4[_0xbb1d('0x1d')](_0x2ccf65)[_0xbb1d('0x30')](_0x594e89);};}exports[_0xbb1d('0x31')]=function(_0x1bda58,_0x341960){var _0x16d439={},_0x20cf3a={},_0x225fd3={'count':0x0,'rows':[]};var _0x1ed5f7=_['map'](db[_0xbb1d('0x32')][_0xbb1d('0x33')],function(_0x318c37){return{'name':_0x318c37[_0xbb1d('0x34')],'type':_0x318c37[_0xbb1d('0x35')][_0xbb1d('0x36')]};});_0x20cf3a[_0xbb1d('0x37')]=_[_0xbb1d('0x38')](_0x1ed5f7,_0xbb1d('0x2f'));_0x20cf3a['query']=_[_0xbb1d('0x39')](_0x1bda58[_0xbb1d('0x3a')]);_0x20cf3a[_0xbb1d('0x3b')]=_[_0xbb1d('0x3c')](_0x20cf3a[_0xbb1d('0x37')],_0x20cf3a['query']);_0x16d439[_0xbb1d('0x3d')]=_[_0xbb1d('0x3c')](_0x20cf3a['model'],qs[_0xbb1d('0x3e')](_0x1bda58[_0xbb1d('0x3a')][_0xbb1d('0x3e')]));_0x16d439[_0xbb1d('0x3d')]=_0x16d439[_0xbb1d('0x3d')][_0xbb1d('0x3f')]?_0x16d439[_0xbb1d('0x3d')]:_0x20cf3a[_0xbb1d('0x37')];if(!_0x1bda58[_0xbb1d('0x3a')][_0xbb1d('0x40')](_0xbb1d('0x41'))){_0x16d439[_0xbb1d('0x22')]=qs[_0xbb1d('0x22')](_0x1bda58['query'][_0xbb1d('0x22')]);_0x16d439['offset']=qs[_0xbb1d('0x1f')](_0x1bda58[_0xbb1d('0x3a')][_0xbb1d('0x1f')]);}_0x16d439[_0xbb1d('0x42')]=qs[_0xbb1d('0x43')](_0x1bda58['query']['sort']);_0x16d439[_0xbb1d('0x44')]=qs[_0xbb1d('0x3b')](_[_0xbb1d('0x45')](_0x1bda58[_0xbb1d('0x3a')],_0x20cf3a[_0xbb1d('0x3b')]),_0x1ed5f7);if(_0x1bda58['query']['filter']){_0x16d439[_0xbb1d('0x44')]=_[_0xbb1d('0x46')](_0x16d439[_0xbb1d('0x44')],{'$or':_[_0xbb1d('0x38')](_0x1ed5f7,function(_0x4fb729){if(_0x4fb729[_0xbb1d('0x35')]!==_0xbb1d('0x47')){var _0xa99fe5={};_0xa99fe5[_0x4fb729['name']]={'$like':'%'+_0x1bda58[_0xbb1d('0x3a')]['filter']+'%'};return _0xa99fe5;}})});}_0x16d439=_[_0xbb1d('0x46')]({},_0x16d439,_0x1bda58[_0xbb1d('0x48')]);var _0x21099d={'where':_0x16d439['where']};return db['WhatsappQueue'][_0xbb1d('0x21')](_0x21099d)[_0xbb1d('0x28')](function(_0x37e1d0){_0x225fd3[_0xbb1d('0x21')]=_0x37e1d0;if(_0x1bda58['query'][_0xbb1d('0x49')]){_0x16d439[_0xbb1d('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x16d439);})['then'](function(_0xbe69f8){_0x225fd3[_0xbb1d('0x4b')]=_0xbe69f8;return _0x225fd3;})[_0xbb1d('0x28')](respondWithFilteredResult(_0x341960,_0x16d439))[_0xbb1d('0x4c')](handleError(_0x341960,null));};exports[_0xbb1d('0x4d')]=function(_0x4d7c07,_0x429931){var _0xd5490={'raw':!![],'where':{'id':_0x4d7c07[_0xbb1d('0x4e')]['id']}},_0x24cde0={};_0x24cde0[_0xbb1d('0x37')]=_['keys'](db[_0xbb1d('0x32')][_0xbb1d('0x33')]);_0x24cde0['query']=_[_0xbb1d('0x39')](_0x4d7c07[_0xbb1d('0x3a')]);_0x24cde0[_0xbb1d('0x3b')]=_['intersection'](_0x24cde0[_0xbb1d('0x37')],_0x24cde0[_0xbb1d('0x3a')]);_0xd5490[_0xbb1d('0x3d')]=_[_0xbb1d('0x3c')](_0x24cde0['model'],qs['fields'](_0x4d7c07[_0xbb1d('0x3a')][_0xbb1d('0x3e')]));_0xd5490[_0xbb1d('0x3d')]=_0xd5490[_0xbb1d('0x3d')][_0xbb1d('0x3f')]?_0xd5490[_0xbb1d('0x3d')]:_0x24cde0['model'];if(_0x4d7c07['query'][_0xbb1d('0x49')]){_0xd5490[_0xbb1d('0x4a')]=[{'all':!![]}];}_0xd5490=_[_0xbb1d('0x46')]({},_0xd5490,_0x4d7c07['options']);return db[_0xbb1d('0x32')]['find'](_0xd5490)['then'](handleEntityNotFound(_0x429931,null))['then'](respondWithResult(_0x429931,null))[_0xbb1d('0x4c')](handleError(_0x429931,null));};exports[_0xbb1d('0x4f')]=function(_0x7c280d,_0x5ab673){return db[_0xbb1d('0x32')]['create'](_0x7c280d[_0xbb1d('0x50')],{})[_0xbb1d('0x28')](function(_0x45df92){var _0x522f04=_0x7c280d[_0xbb1d('0x51')][_0xbb1d('0x29')]({'plain':!![]});if(!_0x522f04)throw new Error(_0xbb1d('0x52'));if(_0x522f04['role']===_0xbb1d('0x51')){var _0x229fdd=_0x45df92[_0xbb1d('0x29')]({'plain':!![]});var _0x573978=_0xbb1d('0x53');return db[_0xbb1d('0x54')][_0xbb1d('0x55')]({'where':{'name':_0x573978,'userProfileId':_0x522f04[_0xbb1d('0x56')]},'raw':!![]})[_0xbb1d('0x28')](function(_0x2ed5c4){if(_0x2ed5c4&&_0x2ed5c4[_0xbb1d('0x57')]===0x0){return db[_0xbb1d('0x2a')][_0xbb1d('0x4f')]({'name':_0x229fdd[_0xbb1d('0x2f')],'resourceId':_0x229fdd['id'],'type':_0x2ed5c4[_0xbb1d('0x2f')],'sectionId':_0x2ed5c4['id']},{})[_0xbb1d('0x28')](function(){return _0x45df92;});}else{return _0x45df92;}})[_0xbb1d('0x4c')](function(_0x38db0b){logger['error'](_0xbb1d('0x58'),_0x38db0b);throw _0x38db0b;});}return _0x45df92;})[_0xbb1d('0x28')](respondWithResult(_0x5ab673,0xc9))[_0xbb1d('0x4c')](handleError(_0x5ab673,null));};exports[_0xbb1d('0x27')]=function(_0x896afc,_0x3a2702){if(_0x896afc[_0xbb1d('0x50')]['id']){delete _0x896afc[_0xbb1d('0x50')]['id'];}return db[_0xbb1d('0x32')][_0xbb1d('0x55')]({'where':{'id':_0x896afc['params']['id']}})[_0xbb1d('0x28')](handleEntityNotFound(_0x3a2702,null))[_0xbb1d('0x28')](saveUpdates(_0x896afc[_0xbb1d('0x50')],null))[_0xbb1d('0x28')](respondWithResult(_0x3a2702,null))['catch'](handleError(_0x3a2702,null));};exports[_0xbb1d('0x2b')]=function(_0x282a49,_0x3ce3bf){return db[_0xbb1d('0x32')]['find']({'where':{'id':_0x282a49[_0xbb1d('0x4e')]['id']}})[_0xbb1d('0x28')](handleEntityNotFound(_0x3ce3bf,null))[_0xbb1d('0x28')](removeEntity(_0x3ce3bf,null))[_0xbb1d('0x4c')](handleError(_0x3ce3bf,null));};exports[_0xbb1d('0x59')]=function(_0x31b9e8,_0x430e3f){return db[_0xbb1d('0x32')][_0xbb1d('0x59')]()['then'](respondWithResult(_0x430e3f,null))[_0xbb1d('0x4c')](handleError(_0x430e3f,null));};exports['getMembers']=function(_0x3ffc3d,_0x52e02a,_0x1b6851){var _0x14b613={'raw':!![],'where':{}},_0x1da64b={},_0x15a819;return db[_0xbb1d('0x32')][_0xbb1d('0x5a')]({'where':{'id':_0x3ffc3d[_0xbb1d('0x4e')]['id']}})[_0xbb1d('0x28')](handleEntityNotFound(_0x52e02a,null))[_0xbb1d('0x28')](function(_0x3a9cd8){if(_0x3a9cd8){_0x15a819=_0x3a9cd8['get']({'plain':!![]});_0x1da64b[_0xbb1d('0x37')]=_[_0xbb1d('0x39')](db[_0xbb1d('0x5b')][_0xbb1d('0x33')]);_0x1da64b[_0xbb1d('0x3a')]=_['keys'](_0x3ffc3d[_0xbb1d('0x3a')]);_0x1da64b['filters']=_[_0xbb1d('0x3c')](_0x1da64b[_0xbb1d('0x37')],_0x1da64b[_0xbb1d('0x3a')]);_0x14b613[_0xbb1d('0x3d')]=_[_0xbb1d('0x3c')](_0x1da64b[_0xbb1d('0x37')],qs[_0xbb1d('0x3e')](_0x3ffc3d[_0xbb1d('0x3a')]['fields']));_0x14b613[_0xbb1d('0x3d')]=_0x14b613[_0xbb1d('0x3d')][_0xbb1d('0x3f')]?_0x14b613[_0xbb1d('0x3d')]:_0x1da64b['model'];if(!_0x3ffc3d['query']['hasOwnProperty']('nolimit')){_0x14b613[_0xbb1d('0x22')]=qs[_0xbb1d('0x22')](_0x3ffc3d[_0xbb1d('0x3a')]['limit']);_0x14b613[_0xbb1d('0x1f')]=qs[_0xbb1d('0x1f')](_0x3ffc3d[_0xbb1d('0x3a')]['offset']);}_0x14b613[_0xbb1d('0x42')]=qs['sort'](_0x3ffc3d[_0xbb1d('0x3a')]['sort']);_0x14b613['where']=qs[_0xbb1d('0x3b')](_[_0xbb1d('0x45')](_0x3ffc3d[_0xbb1d('0x3a')],_0x1da64b[_0xbb1d('0x3b')]));_0x14b613[_0xbb1d('0x44')][_0xbb1d('0x5c')]=_0x3a9cd8['id'];if(_0x3ffc3d['query'][_0xbb1d('0x5d')]){_0x14b613[_0xbb1d('0x44')]=_[_0xbb1d('0x46')](_0x14b613[_0xbb1d('0x44')],{'$or':_[_0xbb1d('0x38')](_0x14b613[_0xbb1d('0x3d')],function(_0x48b83f){var _0x3f0c64={};_0x3f0c64[_0x48b83f]={'$like':'%'+_0x3ffc3d[_0xbb1d('0x3a')][_0xbb1d('0x5d')]+'%'};return _0x3f0c64;})});}_0x14b613=_[_0xbb1d('0x46')]({},_0x14b613,_0x3ffc3d[_0xbb1d('0x48')]);return db['UserWhatsappQueue']['findAll'](_0x14b613);}})[_0xbb1d('0x28')](function(_0x30cc01){if(_0x30cc01){return db['User'][_0xbb1d('0x5e')]({'where':{'id':_['map'](_0x30cc01,_0xbb1d('0x5f')),'role':_0xbb1d('0x60')},'attributes':['id',_0xbb1d('0x2f'),_0xbb1d('0x61'),_0xbb1d('0x62'),_0xbb1d('0x63')]});}})['then'](function(_0xd0918a){if(_0xd0918a){return{'count':_0xd0918a[_0xbb1d('0x21')],'rows':_[_0xbb1d('0x38')](_0xd0918a[_0xbb1d('0x4b')],function(_0x57c52f){return{'membername':_0x57c52f[_0xbb1d('0x2f')],'UserId':_0x57c52f['id'],'queue_name':_0x15a819['name'],'WhatsappQueueId':_0x15a819['id'],'interface':util[_0xbb1d('0x64')](_0xbb1d('0x65'),_0xbb1d('0x66'),_0x57c52f['name']),'penalty':0x0,'paused':_0x57c52f[_0xbb1d('0x61')],'createdAt':_0x57c52f['createdAt'],'updatedAt':_0x57c52f[_0xbb1d('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x52e02a,_0x14b613))[_0xbb1d('0x4c')](handleError(_0x52e02a,null));};exports['getTeams']=function(_0x466f41,_0x4cefbd,_0x181529){var _0x48ddb0={};var _0x48b232={};var _0x5a9818;var _0x5e16fa;return db[_0xbb1d('0x32')][_0xbb1d('0x5a')]({'where':{'id':_0x466f41['params']['id']}})['then'](handleEntityNotFound(_0x4cefbd,null))[_0xbb1d('0x28')](function(_0x20d497){if(_0x20d497){_0x5a9818=_0x20d497;_0x48b232['model']=_[_0xbb1d('0x39')](db[_0xbb1d('0x67')][_0xbb1d('0x33')]);_0x48b232['query']=_[_0xbb1d('0x39')](_0x466f41[_0xbb1d('0x3a')]);_0x48b232[_0xbb1d('0x3b')]=_[_0xbb1d('0x3c')](_0x48b232[_0xbb1d('0x37')],_0x48b232['query']);_0x48ddb0[_0xbb1d('0x3d')]=_[_0xbb1d('0x3c')](_0x48b232['model'],qs['fields'](_0x466f41[_0xbb1d('0x3a')][_0xbb1d('0x3e')]));_0x48ddb0['attributes']=_0x48ddb0[_0xbb1d('0x3d')][_0xbb1d('0x3f')]?_0x48ddb0[_0xbb1d('0x3d')]:_0x48b232[_0xbb1d('0x37')];_0x48ddb0[_0xbb1d('0x42')]=qs['sort'](_0x466f41[_0xbb1d('0x3a')]['sort']);_0x48ddb0[_0xbb1d('0x44')]=qs[_0xbb1d('0x3b')](_[_0xbb1d('0x45')](_0x466f41['query'],_0x48b232[_0xbb1d('0x3b')]));if(_0x466f41[_0xbb1d('0x3a')]['filter']){_0x48ddb0[_0xbb1d('0x44')]=_[_0xbb1d('0x46')](_0x48ddb0[_0xbb1d('0x44')],{'$or':_[_0xbb1d('0x38')](_0x48ddb0['attributes'],function(_0x1e2451){var _0xade9fe={};_0xade9fe[_0x1e2451]={'$like':'%'+_0x466f41[_0xbb1d('0x3a')][_0xbb1d('0x5d')]+'%'};return _0xade9fe;})});}_0x48ddb0=_[_0xbb1d('0x46')]({},_0x48ddb0,_0x466f41['options']);return _0x5a9818[_0xbb1d('0x68')](_0x48ddb0);}})[_0xbb1d('0x28')](function(_0x58b51f){if(_0x58b51f){_0x5e16fa=_0x58b51f[_0xbb1d('0x3f')];if(!_0x466f41[_0xbb1d('0x3a')]['hasOwnProperty'](_0xbb1d('0x41'))){_0x48ddb0['limit']=qs['limit'](_0x466f41[_0xbb1d('0x3a')][_0xbb1d('0x22')]);_0x48ddb0[_0xbb1d('0x1f')]=qs['offset'](_0x466f41[_0xbb1d('0x3a')][_0xbb1d('0x1f')]);}return _0x5a9818['getTeams'](_0x48ddb0);}})[_0xbb1d('0x28')](function(_0x41554e){if(_0x41554e){return _0x41554e?{'count':_0x5e16fa,'rows':_0x41554e}:null;}})[_0xbb1d('0x28')](respondWithResult(_0x4cefbd,null))[_0xbb1d('0x4c')](handleError(_0x4cefbd,null));};exports[_0xbb1d('0x69')]=function(_0x19adba,_0x57a3fe,_0x1dc6ea){var _0x469bc0=_0x19adba[_0xbb1d('0x50')][_0xbb1d('0x6a')];return db[_0xbb1d('0x67')][_0xbb1d('0x6b')]({'where':{'id':_0x469bc0},'attributes':['id'],'include':[{'model':db[_0xbb1d('0x6c')],'as':_0xbb1d('0x6d'),'attributes':['id','name',_0xbb1d('0x6e'),'voicePause','interface'],'raw':!![]}]})[_0xbb1d('0x28')](function(_0x3eb05e){if(_0x3eb05e){var _0x5de011=_[_0xbb1d('0x6f')](_0x3eb05e,function(_0x2bedf2){var _0x4ef090=_0x2bedf2[_0xbb1d('0x29')]({'plain':!![]});return _0x4ef090[_0xbb1d('0x6d')];});return db[_0xbb1d('0x32')][_0xbb1d('0x55')]({'where':{'id':_0x19adba['params']['id']}})['then'](function(_0x57822e){return db['sequelize'][_0xbb1d('0x70')](function(_0x579b9a){return _0x57822e['addTeams'](_0x469bc0,{'transaction':_0x579b9a})['then'](function(){return BPromise[_0xbb1d('0x71')](_0x5de011,function(_0x2c0401){return db[_0xbb1d('0x5b')]['findOrCreate']({'where':{'UserId':_0x2c0401['id'],'WhatsappQueueId':_0x19adba[_0xbb1d('0x4e')]['id']},'transaction':_0x579b9a});});})[_0xbb1d('0x28')](function(){_0x5de011[_0xbb1d('0x72')](function(_0x42d479){socket[_0xbb1d('0x73')](_0xbb1d('0x74'),{'UserId':_0x42d479['id'],'WhatsappQueueId':_0x57822e['id']});});});});});}})[_0xbb1d('0x28')](respondWithStatusCode(_0x57a3fe,null))[_0xbb1d('0x4c')](handleError(_0x57a3fe,null));};exports[_0xbb1d('0x75')]=function(_0x3c69cf,_0x3e5c90,_0x26fb61){return db[_0xbb1d('0x67')][_0xbb1d('0x6b')]({'where':{'id':_0x3c69cf['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xbb1d('0x6c')],'as':_0xbb1d('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xbb1d('0x28')](handleEntityNotFound(_0x3e5c90,null))[_0xbb1d('0x28')](function(_0x15229d){var _0x45634d=_[_0xbb1d('0x38')](_0x15229d,'id');var _0x593c72=[];var _0x50fb8a=[];var _0x880e72=squel[_0xbb1d('0x76')]();_0x880e72[_0xbb1d('0x77')](_0xbb1d('0x78'))[_0xbb1d('0x79')](_0xbb1d('0x7a'),'tq')[_0xbb1d('0x7b')](_0xbb1d('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbb1d('0x44')]('WhatsappQueueId\x20=\x20?',_0x3c69cf['params']['id']);for(var _0x5c0b5f=0x0;_0x5c0b5f<_0x15229d[_0xbb1d('0x3f')];_0x5c0b5f+=0x1){let _0x28dab9=_0x15229d[_0x5c0b5f];for(var _0x384f7c=0x0;_0x384f7c<_0x28dab9[_0xbb1d('0x6d')]['length'];_0x384f7c+=0x1){let _0x488c8d=_0x28dab9[_0xbb1d('0x6d')][_0x384f7c];var _0x417d4c=_0x880e72[_0xbb1d('0x7d')]();_0x417d4c[_0xbb1d('0x44')](_0xbb1d('0x7e'),_0x488c8d['id']);_0x50fb8a['push'](db['sequelize']['query'](_0x417d4c[_0xbb1d('0x7f')](),{'type':db[_0xbb1d('0x80')][_0xbb1d('0x81')][_0xbb1d('0x82')]})[_0xbb1d('0x28')](function(_0x1bd0dd){if(_0x1bd0dd[_0xbb1d('0x3f')]===0x1){return _0x488c8d['id'];}else{var _0x52caec=_['every'](_[_0xbb1d('0x38')](_0x1bd0dd,_0xbb1d('0x83')),function(_0x5ef142){return _[_0xbb1d('0x84')](_0x45634d,_0x5ef142);});if(_0x52caec){return _0x488c8d['id'];}}}));}}return BPromise[_0xbb1d('0x85')](_0x50fb8a)['then'](function(_0x5e340f){_0x593c72=_(_0x593c72)['union'](_0x5e340f)[_0xbb1d('0x86')]()[_0xbb1d('0x87')]();return db[_0xbb1d('0x32')]['find']({'where':{'id':_0x3c69cf['params']['id']}})[_0xbb1d('0x28')](function(_0x593115){return db[_0xbb1d('0x80')][_0xbb1d('0x70')](function(_0x1df9bb){return _0x593115[_0xbb1d('0x75')](_0x3c69cf['query'][_0xbb1d('0x6a')],{'transaction':_0x1df9bb})[_0xbb1d('0x28')](function(){if(!_['isEmpty'](_0x593c72)){return _0x593115[_0xbb1d('0x88')](_0x593c72,{'transaction':_0x1df9bb});}})[_0xbb1d('0x28')](function(){_0x593c72[_0xbb1d('0x72')](function(_0x21a4c4){socket[_0xbb1d('0x73')]('userWhatsappQueue:remove',{'UserId':_0x21a4c4,'WhatsappQueueId':_0x593115['id']});});});});});});})[_0xbb1d('0x28')](respondWithStatusCode(_0x3e5c90,null))[_0xbb1d('0x4c')](handleError(_0x3e5c90,null));};exports[_0xbb1d('0x89')]=function(_0x47ff24,_0x3c110c,_0x5ceba9){return db['WhatsappQueue'][_0xbb1d('0x55')]({'where':{'id':_0x47ff24[_0xbb1d('0x4e')]['id']}})[_0xbb1d('0x28')](handleEntityNotFound(_0x3c110c,null))[_0xbb1d('0x28')](function(_0x1d7261){if(_0x1d7261){return _0x1d7261['addAgents'](_0x47ff24[_0xbb1d('0x50')][_0xbb1d('0x6a')],_[_0xbb1d('0x8a')](_0x47ff24['body'],['ids','id'])||{})[_0xbb1d('0x8b')](function(_0x18676d){for(var _0x24948a=0x0;_0x24948a<_0x47ff24['body'][_0xbb1d('0x6a')]['length'];_0x24948a+=0x1){socket[_0xbb1d('0x73')](_0xbb1d('0x74'),{'UserId':Number(_0x47ff24[_0xbb1d('0x50')][_0xbb1d('0x6a')][_0x24948a]),'WhatsappQueueId':Number(_0x47ff24[_0xbb1d('0x4e')]['id'])});}return _0x18676d;});}})['then'](respondWithResult(_0x3c110c,null))[_0xbb1d('0x4c')](handleError(_0x3c110c,null));};exports[_0xbb1d('0x88')]=function(_0x447084,_0x4fe3b7,_0x2a78ec){return db['WhatsappQueue'][_0xbb1d('0x55')]({'where':{'id':_0x447084[_0xbb1d('0x4e')]['id']}})[_0xbb1d('0x28')](handleEntityNotFound(_0x4fe3b7,null))[_0xbb1d('0x28')](function(_0x31819e){if(_0x31819e){return _0x31819e['removeAgents'](_0x447084['query'][_0xbb1d('0x6a')])['then'](function(){if(_[_0xbb1d('0x8c')](_0x447084[_0xbb1d('0x3a')][_0xbb1d('0x6a')])){for(var _0x3ed2be=0x0;_0x3ed2be<_0x447084['query'][_0xbb1d('0x6a')]['length'];_0x3ed2be+=0x1){socket[_0xbb1d('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x447084[_0xbb1d('0x3a')]['ids'][_0x3ed2be]),'WhatsappQueueId':Number(_0x447084[_0xbb1d('0x4e')]['id'])});}}else{socket['emit'](_0xbb1d('0x8d'),{'UserId':Number(_0x447084[_0xbb1d('0x3a')]['ids']),'WhatsappQueueId':Number(_0x447084[_0xbb1d('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x4fe3b7,null))['catch'](handleError(_0x4fe3b7,null));};exports[_0xbb1d('0x8e')]=function(_0x3d5cf8,_0x1a8135,_0x59ddb7){var _0x1c7088={};var _0x44552e={};var _0x38f8c3;var _0x1c51f0;return db[_0xbb1d('0x32')][_0xbb1d('0x5a')]({'where':{'id':_0x3d5cf8['params']['id']}})[_0xbb1d('0x28')](handleEntityNotFound(_0x1a8135,null))[_0xbb1d('0x28')](function(_0x21456a){if(_0x21456a){_0x38f8c3=_0x21456a;_0x44552e[_0xbb1d('0x37')]=_[_0xbb1d('0x39')](db[_0xbb1d('0x6c')][_0xbb1d('0x33')]);_0x44552e[_0xbb1d('0x3a')]=_[_0xbb1d('0x39')](_0x3d5cf8[_0xbb1d('0x3a')]);_0x44552e[_0xbb1d('0x3b')]=_[_0xbb1d('0x3c')](_0x44552e[_0xbb1d('0x37')],_0x44552e[_0xbb1d('0x3a')]);_0x1c7088['attributes']=_[_0xbb1d('0x3c')](_0x44552e[_0xbb1d('0x37')],qs[_0xbb1d('0x3e')](_0x3d5cf8[_0xbb1d('0x3a')][_0xbb1d('0x3e')]));_0x1c7088[_0xbb1d('0x3d')]=_0x1c7088['attributes']['length']?_0x1c7088['attributes']:_0x44552e['model'];_0x1c7088[_0xbb1d('0x42')]=qs[_0xbb1d('0x43')](_0x3d5cf8[_0xbb1d('0x3a')][_0xbb1d('0x43')]);_0x1c7088[_0xbb1d('0x44')]=qs[_0xbb1d('0x3b')](_[_0xbb1d('0x45')](_0x3d5cf8['query'],_0x44552e[_0xbb1d('0x3b')]));if(_0x3d5cf8['query'][_0xbb1d('0x5d')]){_0x1c7088[_0xbb1d('0x44')]=_['merge'](_0x1c7088['where'],{'$or':_['map'](_0x1c7088['attributes'],function(_0x2b5db4){var _0x3abf5f={};_0x3abf5f[_0x2b5db4]={'$like':'%'+_0x3d5cf8[_0xbb1d('0x3a')][_0xbb1d('0x5d')]+'%'};return _0x3abf5f;})});}_0x1c7088=_[_0xbb1d('0x46')]({},_0x1c7088,_0x3d5cf8[_0xbb1d('0x48')]);return _0x38f8c3[_0xbb1d('0x8e')](_0x1c7088);}})['then'](function(_0xc46ee1){if(_0xc46ee1){_0x1c51f0=_0xc46ee1['length'];if(!_0x3d5cf8[_0xbb1d('0x3a')][_0xbb1d('0x40')]('nolimit')){_0x1c7088[_0xbb1d('0x22')]=qs['limit'](_0x3d5cf8[_0xbb1d('0x3a')][_0xbb1d('0x22')]);_0x1c7088[_0xbb1d('0x1f')]=qs[_0xbb1d('0x1f')](_0x3d5cf8[_0xbb1d('0x3a')]['offset']);}return _0x38f8c3[_0xbb1d('0x8e')](_0x1c7088);}})['then'](function(_0x5abcf4){if(_0x5abcf4){return _0x5abcf4?{'count':_0x1c51f0,'rows':_0x5abcf4}:null;}})[_0xbb1d('0x28')](respondWithResult(_0x1a8135,null))[_0xbb1d('0x4c')](handleError(_0x1a8135,null));}; \ No newline at end of file +var _0x982d=['emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','WhatsappQueues','destroy','sendStatus','stack','name','send','WhatsappQueue','rawAttributes','fieldName','type','key','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','show','includeAll','include','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','whatsappPause','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','findAll','Agents','voicePause','interface','flatMap','sequelize','transaction','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','WhatsappQueueId\x20=\x20?','clone','push','toString','all','union','compact','isEmpty','removeAgents'];(function(_0x262227,_0x786294){var _0x12bc3d=function(_0x5ab30a){while(--_0x5ab30a){_0x262227['push'](_0x262227['shift']());}};_0x12bc3d(++_0x786294);}(_0x982d,0x92));var _0xd982=function(_0x126994,_0x5aa895){_0x126994=_0x126994-0x0;var _0x3e435e=_0x982d[_0x126994];return _0x3e435e;};'use strict';var emlformat=require(_0xd982('0x0'));var rimraf=require(_0xd982('0x1'));var zipdir=require(_0xd982('0x2'));var jsonpatch=require(_0xd982('0x3'));var rp=require(_0xd982('0x4'));var moment=require(_0xd982('0x5'));var BPromise=require(_0xd982('0x6'));var Mustache=require('mustache');var util=require(_0xd982('0x7'));var path=require(_0xd982('0x8'));var sox=require('sox');var csv=require(_0xd982('0x9'));var ejs=require(_0xd982('0xa'));var fs=require('fs');var fs_extra=require(_0xd982('0xb'));var _=require(_0xd982('0xc'));var squel=require('squel');var crypto=require(_0xd982('0xd'));var jsforce=require(_0xd982('0xe'));var deskjs=require(_0xd982('0xf'));var toCsv=require(_0xd982('0x9'));var querystring=require(_0xd982('0x10'));var Papa=require(_0xd982('0x11'));var Redis=require(_0xd982('0x12'));var authService=require(_0xd982('0x13'));var qs=require(_0xd982('0x14'));var as=require(_0xd982('0x15'));var hardwareService=require(_0xd982('0x16'));var logger=require(_0xd982('0x17'))('api');var utils=require(_0xd982('0x18'));var config=require(_0xd982('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd982('0x1a'))['db'];config[_0xd982('0x1b')]=_[_0xd982('0x1c')](config[_0xd982('0x1b')],{'host':_0xd982('0x1d'),'port':0x18eb});var socket=require(_0xd982('0x1e'))(new Redis(config[_0xd982('0x1b')]));require(_0xd982('0x1f'))[_0xd982('0x20')](socket);function respondWithStatusCode(_0x5acaae,_0x438c71){_0x438c71=_0x438c71||0xcc;return function(_0x5cd59c){if(_0x5cd59c){return _0x5acaae['sendStatus'](_0x438c71);}return _0x5acaae[_0xd982('0x21')](_0x438c71)[_0xd982('0x22')]();};}function respondWithResult(_0x5f1cc5,_0x347f94){_0x347f94=_0x347f94||0xc8;return function(_0x3f6b46){if(_0x3f6b46){return _0x5f1cc5['status'](_0x347f94)[_0xd982('0x23')](_0x3f6b46);}};}function respondWithFilteredResult(_0x402616,_0x5c27c8){return function(_0x406b35){if(_0x406b35){var _0x5cab20=typeof _0x5c27c8[_0xd982('0x24')]===_0xd982('0x25')&&typeof _0x5c27c8['limit']==='undefined';var _0x35c2fb=_0x406b35[_0xd982('0x26')];var _0x388a72=_0x5cab20?0x0:_0x5c27c8['offset'];var _0x213a4e=_0x5cab20?_0x406b35[_0xd982('0x26')]:_0x5c27c8[_0xd982('0x24')]+_0x5c27c8[_0xd982('0x27')];var _0x4217d2;if(_0x213a4e>=_0x35c2fb){_0x213a4e=_0x35c2fb;_0x4217d2=0xc8;}else{_0x4217d2=0xce;}_0x402616[_0xd982('0x21')](_0x4217d2);return _0x402616[_0xd982('0x28')](_0xd982('0x29'),_0x388a72+'-'+_0x213a4e+'/'+_0x35c2fb)['json'](_0x406b35);}return null;};}function patchUpdates(_0x191ba5){return function(_0x1d54d8){try{jsonpatch[_0xd982('0x2a')](_0x1d54d8,_0x191ba5,!![]);}catch(_0x496c70){return BPromise[_0xd982('0x2b')](_0x496c70);}return _0x1d54d8[_0xd982('0x2c')]();};}function saveUpdates(_0x400600,_0x4d0258){return function(_0x2f2d09){if(_0x2f2d09){return _0x2f2d09[_0xd982('0x2d')](_0x400600)['then'](function(_0x41981a){return _0x41981a;});}return null;};}function removeEntity(_0x346aac,_0x14db05){return function(_0x10cb44){if(_0x10cb44){return _0x10cb44['destroy']()[_0xd982('0x2e')](function(){var _0x1532c2=_0x10cb44['get']({'plain':!![]});var _0x28230c=_0xd982('0x2f');return db['UserProfileResource'][_0xd982('0x30')]({'where':{'type':_0x28230c,'resourceId':_0x1532c2['id']}})[_0xd982('0x2e')](function(){return _0x10cb44;});})[_0xd982('0x2e')](function(){_0x346aac[_0xd982('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409fcd,_0x108a07){return function(_0x1bdcbf){if(!_0x1bdcbf){_0x409fcd[_0xd982('0x31')](0x194);}return _0x1bdcbf;};}function handleError(_0x3ac1cb,_0xcdc989){_0xcdc989=_0xcdc989||0x1f4;return function(_0x3c86a8){logger['error'](_0x3c86a8[_0xd982('0x32')]);if(_0x3c86a8[_0xd982('0x33')]){delete _0x3c86a8[_0xd982('0x33')];}_0x3ac1cb['status'](_0xcdc989)[_0xd982('0x34')](_0x3c86a8);};}exports['index']=function(_0x4922af,_0x1c4820){var _0x36c7a7={},_0x36e276={},_0xf5a12b={'count':0x0,'rows':[]};var _0x2e7857=_['map'](db[_0xd982('0x35')][_0xd982('0x36')],function(_0x40f021){return{'name':_0x40f021[_0xd982('0x37')],'type':_0x40f021[_0xd982('0x38')][_0xd982('0x39')]};});_0x36e276['model']=_[_0xd982('0x3a')](_0x2e7857,_0xd982('0x33'));_0x36e276['query']=_[_0xd982('0x3b')](_0x4922af[_0xd982('0x3c')]);_0x36e276[_0xd982('0x3d')]=_['intersection'](_0x36e276[_0xd982('0x3e')],_0x36e276[_0xd982('0x3c')]);_0x36c7a7['attributes']=_[_0xd982('0x3f')](_0x36e276[_0xd982('0x3e')],qs[_0xd982('0x40')](_0x4922af[_0xd982('0x3c')][_0xd982('0x40')]));_0x36c7a7[_0xd982('0x41')]=_0x36c7a7['attributes'][_0xd982('0x42')]?_0x36c7a7['attributes']:_0x36e276[_0xd982('0x3e')];if(!_0x4922af[_0xd982('0x3c')][_0xd982('0x43')](_0xd982('0x44'))){_0x36c7a7[_0xd982('0x27')]=qs[_0xd982('0x27')](_0x4922af[_0xd982('0x3c')]['limit']);_0x36c7a7[_0xd982('0x24')]=qs[_0xd982('0x24')](_0x4922af[_0xd982('0x3c')][_0xd982('0x24')]);}_0x36c7a7[_0xd982('0x45')]=qs[_0xd982('0x46')](_0x4922af[_0xd982('0x3c')]['sort']);_0x36c7a7[_0xd982('0x47')]=qs['filters'](_[_0xd982('0x48')](_0x4922af['query'],_0x36e276[_0xd982('0x3d')]),_0x2e7857);if(_0x4922af[_0xd982('0x3c')][_0xd982('0x49')]){_0x36c7a7[_0xd982('0x47')]=_[_0xd982('0x4a')](_0x36c7a7[_0xd982('0x47')],{'$or':_['map'](_0x2e7857,function(_0x48dfbf){if(_0x48dfbf[_0xd982('0x38')]!=='VIRTUAL'){var _0x41590f={};_0x41590f[_0x48dfbf[_0xd982('0x33')]]={'$like':'%'+_0x4922af[_0xd982('0x3c')][_0xd982('0x49')]+'%'};return _0x41590f;}})});}_0x36c7a7=_[_0xd982('0x4a')]({},_0x36c7a7,_0x4922af[_0xd982('0x4b')]);var _0x23d318={'where':_0x36c7a7[_0xd982('0x47')]};return db['WhatsappQueue'][_0xd982('0x26')](_0x23d318)[_0xd982('0x2e')](function(_0x481cf6){_0xf5a12b[_0xd982('0x26')]=_0x481cf6;if(_0x4922af[_0xd982('0x3c')]['includeAll']){_0x36c7a7['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x36c7a7);})[_0xd982('0x2e')](function(_0x57de43){_0xf5a12b['rows']=_0x57de43;return _0xf5a12b;})['then'](respondWithFilteredResult(_0x1c4820,_0x36c7a7))['catch'](handleError(_0x1c4820,null));};exports[_0xd982('0x4c')]=function(_0x2a3db3,_0x32e8c8){var _0x42cea6={'raw':!![],'where':{'id':_0x2a3db3['params']['id']}},_0x4039b8={};_0x4039b8[_0xd982('0x3e')]=_[_0xd982('0x3b')](db[_0xd982('0x35')][_0xd982('0x36')]);_0x4039b8['query']=_[_0xd982('0x3b')](_0x2a3db3[_0xd982('0x3c')]);_0x4039b8[_0xd982('0x3d')]=_[_0xd982('0x3f')](_0x4039b8['model'],_0x4039b8[_0xd982('0x3c')]);_0x42cea6['attributes']=_['intersection'](_0x4039b8['model'],qs[_0xd982('0x40')](_0x2a3db3[_0xd982('0x3c')][_0xd982('0x40')]));_0x42cea6[_0xd982('0x41')]=_0x42cea6[_0xd982('0x41')][_0xd982('0x42')]?_0x42cea6[_0xd982('0x41')]:_0x4039b8[_0xd982('0x3e')];if(_0x2a3db3['query'][_0xd982('0x4d')]){_0x42cea6[_0xd982('0x4e')]=[{'all':!![]}];}_0x42cea6=_[_0xd982('0x4a')]({},_0x42cea6,_0x2a3db3[_0xd982('0x4b')]);return db[_0xd982('0x35')]['find'](_0x42cea6)[_0xd982('0x2e')](handleEntityNotFound(_0x32e8c8,null))[_0xd982('0x2e')](respondWithResult(_0x32e8c8,null))[_0xd982('0x4f')](handleError(_0x32e8c8,null));};exports[_0xd982('0x50')]=function(_0x54b515,_0x142cb7){return db[_0xd982('0x35')][_0xd982('0x50')](_0x54b515[_0xd982('0x51')],{})[_0xd982('0x2e')](function(_0x5dc51b){var _0x119fc9=_0x54b515['user'][_0xd982('0x52')]({'plain':!![]});if(!_0x119fc9)throw new Error(_0xd982('0x53'));if(_0x119fc9['role']===_0xd982('0x54')){var _0x14ef7b=_0x5dc51b[_0xd982('0x52')]({'plain':!![]});var _0x4dba5c=_0xd982('0x2f');return db[_0xd982('0x55')]['find']({'where':{'name':_0x4dba5c,'userProfileId':_0x119fc9['userProfileId']},'raw':!![]})[_0xd982('0x2e')](function(_0x4fa862){if(_0x4fa862&&_0x4fa862[_0xd982('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x14ef7b[_0xd982('0x33')],'resourceId':_0x14ef7b['id'],'type':_0x4fa862[_0xd982('0x33')],'sectionId':_0x4fa862['id']},{})['then'](function(){return _0x5dc51b;});}else{return _0x5dc51b;}})['catch'](function(_0x36cd8e){logger[_0xd982('0x57')](_0xd982('0x58'),_0x36cd8e);throw _0x36cd8e;});}return _0x5dc51b;})[_0xd982('0x2e')](respondWithResult(_0x142cb7,0xc9))[_0xd982('0x4f')](handleError(_0x142cb7,null));};exports[_0xd982('0x2d')]=function(_0x41f17b,_0x32a219){if(_0x41f17b['body']['id']){delete _0x41f17b[_0xd982('0x51')]['id'];}return db[_0xd982('0x35')][_0xd982('0x59')]({'where':{'id':_0x41f17b['params']['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x32a219,null))['then'](saveUpdates(_0x41f17b['body'],null))['then'](respondWithResult(_0x32a219,null))[_0xd982('0x4f')](handleError(_0x32a219,null));};exports[_0xd982('0x30')]=function(_0x5224f7,_0x4e6222){return db[_0xd982('0x35')][_0xd982('0x59')]({'where':{'id':_0x5224f7[_0xd982('0x5a')]['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x4e6222,null))[_0xd982('0x2e')](removeEntity(_0x4e6222,null))['catch'](handleError(_0x4e6222,null));};exports[_0xd982('0x5b')]=function(_0x7231b1,_0xb3c585){return db[_0xd982('0x35')][_0xd982('0x5b')]()[_0xd982('0x2e')](respondWithResult(_0xb3c585,null))[_0xd982('0x4f')](handleError(_0xb3c585,null));};exports[_0xd982('0x5c')]=function(_0x3f21b3,_0x74c1b1,_0x3f4c){var _0x37afcc={'raw':!![],'where':{}},_0x2e8c96={},_0x532404;return db[_0xd982('0x35')][_0xd982('0x5d')]({'where':{'id':_0x3f21b3[_0xd982('0x5a')]['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x74c1b1,null))[_0xd982('0x2e')](function(_0x573587){if(_0x573587){_0x532404=_0x573587[_0xd982('0x52')]({'plain':!![]});_0x2e8c96[_0xd982('0x3e')]=_['keys'](db['UserWhatsappQueue'][_0xd982('0x36')]);_0x2e8c96['query']=_['keys'](_0x3f21b3['query']);_0x2e8c96[_0xd982('0x3d')]=_[_0xd982('0x3f')](_0x2e8c96[_0xd982('0x3e')],_0x2e8c96[_0xd982('0x3c')]);_0x37afcc[_0xd982('0x41')]=_['intersection'](_0x2e8c96[_0xd982('0x3e')],qs[_0xd982('0x40')](_0x3f21b3[_0xd982('0x3c')]['fields']));_0x37afcc[_0xd982('0x41')]=_0x37afcc[_0xd982('0x41')]['length']?_0x37afcc[_0xd982('0x41')]:_0x2e8c96[_0xd982('0x3e')];if(!_0x3f21b3[_0xd982('0x3c')][_0xd982('0x43')](_0xd982('0x44'))){_0x37afcc[_0xd982('0x27')]=qs['limit'](_0x3f21b3[_0xd982('0x3c')][_0xd982('0x27')]);_0x37afcc[_0xd982('0x24')]=qs[_0xd982('0x24')](_0x3f21b3[_0xd982('0x3c')][_0xd982('0x24')]);}_0x37afcc[_0xd982('0x45')]=qs[_0xd982('0x46')](_0x3f21b3[_0xd982('0x3c')][_0xd982('0x46')]);_0x37afcc[_0xd982('0x47')]=qs[_0xd982('0x3d')](_[_0xd982('0x48')](_0x3f21b3['query'],_0x2e8c96[_0xd982('0x3d')]));_0x37afcc[_0xd982('0x47')][_0xd982('0x5e')]=_0x573587['id'];if(_0x3f21b3[_0xd982('0x3c')]['filter']){_0x37afcc[_0xd982('0x47')]=_[_0xd982('0x4a')](_0x37afcc[_0xd982('0x47')],{'$or':_[_0xd982('0x3a')](_0x37afcc['attributes'],function(_0xa6b662){var _0x5107b9={};_0x5107b9[_0xa6b662]={'$like':'%'+_0x3f21b3['query'][_0xd982('0x49')]+'%'};return _0x5107b9;})});}_0x37afcc=_['merge']({},_0x37afcc,_0x3f21b3[_0xd982('0x4b')]);return db[_0xd982('0x5f')]['findAll'](_0x37afcc);}})[_0xd982('0x2e')](function(_0x48e587){if(_0x48e587){return db[_0xd982('0x60')][_0xd982('0x61')]({'where':{'id':_[_0xd982('0x3a')](_0x48e587,'UserId'),'role':'agent'},'attributes':['id',_0xd982('0x33'),_0xd982('0x62'),'updatedAt',_0xd982('0x63')]});}})[_0xd982('0x2e')](function(_0x1a71e0){if(_0x1a71e0){return{'count':_0x1a71e0[_0xd982('0x26')],'rows':_[_0xd982('0x3a')](_0x1a71e0[_0xd982('0x64')],function(_0x29d841){return{'membername':_0x29d841[_0xd982('0x33')],'UserId':_0x29d841['id'],'queue_name':_0x532404[_0xd982('0x33')],'WhatsappQueueId':_0x532404['id'],'interface':util[_0xd982('0x65')](_0xd982('0x66'),_0xd982('0x67'),_0x29d841[_0xd982('0x33')]),'penalty':0x0,'paused':_0x29d841[_0xd982('0x62')],'createdAt':_0x29d841[_0xd982('0x63')],'updatedAt':_0x29d841['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd982('0x2e')](respondWithFilteredResult(_0x74c1b1,_0x37afcc))[_0xd982('0x4f')](handleError(_0x74c1b1,null));};exports[_0xd982('0x68')]=function(_0x5203d6,_0x10300c,_0x5a3d87){var _0x67f4b0={};var _0x2246a={};var _0x3612f3;var _0x37a9d4;return db[_0xd982('0x35')][_0xd982('0x5d')]({'where':{'id':_0x5203d6[_0xd982('0x5a')]['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x10300c,null))['then'](function(_0x4e312c){if(_0x4e312c){_0x3612f3=_0x4e312c;_0x2246a['model']=_[_0xd982('0x3b')](db[_0xd982('0x69')][_0xd982('0x36')]);_0x2246a[_0xd982('0x3c')]=_[_0xd982('0x3b')](_0x5203d6[_0xd982('0x3c')]);_0x2246a[_0xd982('0x3d')]=_[_0xd982('0x3f')](_0x2246a[_0xd982('0x3e')],_0x2246a[_0xd982('0x3c')]);_0x67f4b0[_0xd982('0x41')]=_[_0xd982('0x3f')](_0x2246a[_0xd982('0x3e')],qs[_0xd982('0x40')](_0x5203d6[_0xd982('0x3c')]['fields']));_0x67f4b0[_0xd982('0x41')]=_0x67f4b0[_0xd982('0x41')][_0xd982('0x42')]?_0x67f4b0[_0xd982('0x41')]:_0x2246a[_0xd982('0x3e')];_0x67f4b0['order']=qs['sort'](_0x5203d6[_0xd982('0x3c')][_0xd982('0x46')]);_0x67f4b0[_0xd982('0x47')]=qs[_0xd982('0x3d')](_[_0xd982('0x48')](_0x5203d6[_0xd982('0x3c')],_0x2246a['filters']));if(_0x5203d6[_0xd982('0x3c')][_0xd982('0x49')]){_0x67f4b0['where']=_[_0xd982('0x4a')](_0x67f4b0[_0xd982('0x47')],{'$or':_[_0xd982('0x3a')](_0x67f4b0[_0xd982('0x41')],function(_0x55c99b){var _0x45e8ad={};_0x45e8ad[_0x55c99b]={'$like':'%'+_0x5203d6[_0xd982('0x3c')][_0xd982('0x49')]+'%'};return _0x45e8ad;})});}_0x67f4b0=_[_0xd982('0x4a')]({},_0x67f4b0,_0x5203d6['options']);return _0x3612f3['getTeams'](_0x67f4b0);}})[_0xd982('0x2e')](function(_0x1d78f0){if(_0x1d78f0){_0x37a9d4=_0x1d78f0[_0xd982('0x42')];if(!_0x5203d6[_0xd982('0x3c')][_0xd982('0x43')](_0xd982('0x44'))){_0x67f4b0[_0xd982('0x27')]=qs[_0xd982('0x27')](_0x5203d6[_0xd982('0x3c')]['limit']);_0x67f4b0[_0xd982('0x24')]=qs['offset'](_0x5203d6[_0xd982('0x3c')][_0xd982('0x24')]);}return _0x3612f3[_0xd982('0x68')](_0x67f4b0);}})['then'](function(_0x2af505){if(_0x2af505){return _0x2af505?{'count':_0x37a9d4,'rows':_0x2af505}:null;}})[_0xd982('0x2e')](respondWithResult(_0x10300c,null))[_0xd982('0x4f')](handleError(_0x10300c,null));};exports[_0xd982('0x6a')]=function(_0x38e910,_0x32c4d3,_0x2a60f2){var _0x2ad219=_0x38e910['body'][_0xd982('0x6b')];return db[_0xd982('0x69')][_0xd982('0x6c')]({'where':{'id':_0x2ad219},'attributes':['id'],'include':[{'model':db[_0xd982('0x60')],'as':_0xd982('0x6d'),'attributes':['id',_0xd982('0x33'),'online',_0xd982('0x6e'),_0xd982('0x6f')],'raw':!![]}]})[_0xd982('0x2e')](function(_0x2eaa2a){if(_0x2eaa2a){var _0x61b338=_[_0xd982('0x70')](_0x2eaa2a,function(_0x977edc){var _0x6e825a=_0x977edc[_0xd982('0x52')]({'plain':!![]});return _0x6e825a[_0xd982('0x6d')];});return db['WhatsappQueue'][_0xd982('0x59')]({'where':{'id':_0x38e910[_0xd982('0x5a')]['id']}})['then'](function(_0x438de0){return db[_0xd982('0x71')][_0xd982('0x72')](function(_0x4c8ea0){return _0x438de0[_0xd982('0x6a')](_0x2ad219,{'transaction':_0x4c8ea0})[_0xd982('0x2e')](function(){return BPromise['each'](_0x61b338,function(_0x20707b){return db[_0xd982('0x5f')]['findOrCreate']({'where':{'UserId':_0x20707b['id'],'WhatsappQueueId':_0x38e910['params']['id']},'transaction':_0x4c8ea0});});})[_0xd982('0x2e')](function(){_0x61b338[_0xd982('0x73')](function(_0x56d9d9){socket['emit'](_0xd982('0x74'),{'UserId':_0x56d9d9['id'],'WhatsappQueueId':_0x438de0['id']});});});});});}})[_0xd982('0x2e')](respondWithStatusCode(_0x32c4d3,null))['catch'](handleError(_0x32c4d3,null));};exports[_0xd982('0x75')]=function(_0x4e702b,_0x42f822,_0x32d349){return db[_0xd982('0x69')]['findAll']({'where':{'id':_0x4e702b[_0xd982('0x3c')][_0xd982('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd982('0x60')],'as':_0xd982('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x42f822,null))[_0xd982('0x2e')](function(_0x276837){var _0x51e34d=_[_0xd982('0x3a')](_0x276837,'id');var _0x2fd500=[];var _0xf34e5=[];var _0x1418dc=squel[_0xd982('0x76')]();_0x1418dc[_0xd982('0x77')](_0xd982('0x78'))[_0xd982('0x79')](_0xd982('0x7a'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd982('0x47')](_0xd982('0x7b'),_0x4e702b[_0xd982('0x5a')]['id']);for(var _0x285926=0x0;_0x285926<_0x276837['length'];_0x285926+=0x1){let _0x17afb9=_0x276837[_0x285926];for(var _0x5411ce=0x0;_0x5411ce<_0x17afb9[_0xd982('0x6d')][_0xd982('0x42')];_0x5411ce+=0x1){let _0x12b778=_0x17afb9[_0xd982('0x6d')][_0x5411ce];var _0x4d2db3=_0x1418dc[_0xd982('0x7c')]();_0x4d2db3['where']('ut.UserId\x20=\x20?',_0x12b778['id']);_0xf34e5[_0xd982('0x7d')](db['sequelize'][_0xd982('0x3c')](_0x4d2db3[_0xd982('0x7e')](),{'type':db[_0xd982('0x71')]['QueryTypes']['SELECT']})[_0xd982('0x2e')](function(_0x3a7cb9){if(_0x3a7cb9[_0xd982('0x42')]===0x1){return _0x12b778['id'];}else{var _0x48d405=_['every'](_[_0xd982('0x3a')](_0x3a7cb9,'TeamId'),function(_0x22581d){return _['includes'](_0x51e34d,_0x22581d);});if(_0x48d405){return _0x12b778['id'];}}}));}}return BPromise[_0xd982('0x7f')](_0xf34e5)[_0xd982('0x2e')](function(_0x2beabd){_0x2fd500=_(_0x2fd500)[_0xd982('0x80')](_0x2beabd)[_0xd982('0x81')]()['value']();return db[_0xd982('0x35')][_0xd982('0x59')]({'where':{'id':_0x4e702b[_0xd982('0x5a')]['id']}})['then'](function(_0x310131){return db[_0xd982('0x71')][_0xd982('0x72')](function(_0xce836b){return _0x310131['removeTeams'](_0x4e702b[_0xd982('0x3c')][_0xd982('0x6b')],{'transaction':_0xce836b})['then'](function(){if(!_[_0xd982('0x82')](_0x2fd500)){return _0x310131[_0xd982('0x83')](_0x2fd500,{'transaction':_0xce836b});}})['then'](function(){_0x2fd500[_0xd982('0x73')](function(_0x2d0fee){socket[_0xd982('0x84')](_0xd982('0x85'),{'UserId':_0x2d0fee,'WhatsappQueueId':_0x310131['id']});});});});});});})[_0xd982('0x2e')](respondWithStatusCode(_0x42f822,null))[_0xd982('0x4f')](handleError(_0x42f822,null));};exports[_0xd982('0x86')]=function(_0x34292b,_0x2503a6,_0x4a1f1f){return db[_0xd982('0x35')][_0xd982('0x59')]({'where':{'id':_0x34292b[_0xd982('0x5a')]['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x2503a6,null))[_0xd982('0x2e')](function(_0x17480e){if(_0x17480e){return _0x17480e[_0xd982('0x86')](_0x34292b[_0xd982('0x51')][_0xd982('0x6b')],_[_0xd982('0x87')](_0x34292b[_0xd982('0x51')],[_0xd982('0x6b'),'id'])||{})[_0xd982('0x88')](function(_0x2b3721){for(var _0x44ecfb=0x0;_0x44ecfb<_0x34292b[_0xd982('0x51')][_0xd982('0x6b')][_0xd982('0x42')];_0x44ecfb+=0x1){socket['emit'](_0xd982('0x74'),{'UserId':Number(_0x34292b[_0xd982('0x51')][_0xd982('0x6b')][_0x44ecfb]),'WhatsappQueueId':Number(_0x34292b[_0xd982('0x5a')]['id'])});}return _0x2b3721;});}})[_0xd982('0x2e')](respondWithResult(_0x2503a6,null))[_0xd982('0x4f')](handleError(_0x2503a6,null));};exports[_0xd982('0x83')]=function(_0x20ddda,_0x132108,_0x36a581){return db[_0xd982('0x35')]['find']({'where':{'id':_0x20ddda[_0xd982('0x5a')]['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x132108,null))[_0xd982('0x2e')](function(_0x383e78){if(_0x383e78){return _0x383e78[_0xd982('0x83')](_0x20ddda['query'][_0xd982('0x6b')])[_0xd982('0x2e')](function(){if(_[_0xd982('0x89')](_0x20ddda[_0xd982('0x3c')]['ids'])){for(var _0x6d114d=0x0;_0x6d114d<_0x20ddda['query'][_0xd982('0x6b')][_0xd982('0x42')];_0x6d114d+=0x1){socket['emit'](_0xd982('0x85'),{'UserId':Number(_0x20ddda[_0xd982('0x3c')][_0xd982('0x6b')][_0x6d114d]),'WhatsappQueueId':Number(_0x20ddda[_0xd982('0x5a')]['id'])});}}else{socket[_0xd982('0x84')]('userWhatsappQueue:remove',{'UserId':Number(_0x20ddda[_0xd982('0x3c')][_0xd982('0x6b')]),'WhatsappQueueId':Number(_0x20ddda[_0xd982('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x132108,null))[_0xd982('0x4f')](handleError(_0x132108,null));};exports[_0xd982('0x8a')]=function(_0x322597,_0x3c7d85,_0x526f54){var _0x11ae3a={};var _0x54c93e={};var _0x259991;var _0x2bf5d9;return db['WhatsappQueue'][_0xd982('0x5d')]({'where':{'id':_0x322597[_0xd982('0x5a')]['id']}})[_0xd982('0x2e')](handleEntityNotFound(_0x3c7d85,null))['then'](function(_0x415ed6){if(_0x415ed6){_0x259991=_0x415ed6;_0x54c93e['model']=_['keys'](db[_0xd982('0x60')][_0xd982('0x36')]);_0x54c93e[_0xd982('0x3c')]=_[_0xd982('0x3b')](_0x322597['query']);_0x54c93e[_0xd982('0x3d')]=_[_0xd982('0x3f')](_0x54c93e[_0xd982('0x3e')],_0x54c93e['query']);_0x11ae3a['attributes']=_[_0xd982('0x3f')](_0x54c93e['model'],qs['fields'](_0x322597[_0xd982('0x3c')]['fields']));_0x11ae3a[_0xd982('0x41')]=_0x11ae3a[_0xd982('0x41')][_0xd982('0x42')]?_0x11ae3a['attributes']:_0x54c93e['model'];_0x11ae3a[_0xd982('0x45')]=qs[_0xd982('0x46')](_0x322597[_0xd982('0x3c')]['sort']);_0x11ae3a['where']=qs['filters'](_['pick'](_0x322597[_0xd982('0x3c')],_0x54c93e['filters']));if(_0x322597['query']['filter']){_0x11ae3a['where']=_['merge'](_0x11ae3a['where'],{'$or':_['map'](_0x11ae3a[_0xd982('0x41')],function(_0x1ef91c){var _0x18356e={};_0x18356e[_0x1ef91c]={'$like':'%'+_0x322597['query'][_0xd982('0x49')]+'%'};return _0x18356e;})});}_0x11ae3a=_['merge']({},_0x11ae3a,_0x322597[_0xd982('0x4b')]);return _0x259991[_0xd982('0x8a')](_0x11ae3a);}})['then'](function(_0x32713a){if(_0x32713a){_0x2bf5d9=_0x32713a[_0xd982('0x42')];if(!_0x322597[_0xd982('0x3c')][_0xd982('0x43')](_0xd982('0x44'))){_0x11ae3a[_0xd982('0x27')]=qs[_0xd982('0x27')](_0x322597['query'][_0xd982('0x27')]);_0x11ae3a[_0xd982('0x24')]=qs[_0xd982('0x24')](_0x322597['query'][_0xd982('0x24')]);}return _0x259991[_0xd982('0x8a')](_0x11ae3a);}})[_0xd982('0x2e')](function(_0x428105){if(_0x428105){return _0x428105?{'count':_0x2bf5d9,'rows':_0x428105}:null;}})[_0xd982('0x2e')](respondWithResult(_0x3c7d85,null))[_0xd982('0x4f')](handleError(_0x3c7d85,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 45d09ee..81b93f8 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 _0x0ed0=['hasOwnProperty','exports','events','../../mysqldb','update'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0ed0,0x1b5));var _0x00ed=function(_0x4f6859,_0x13a8ad){_0x4f6859=_0x4f6859-0x0;var _0x27b50d=_0x0ed0[_0x4f6859];return _0x27b50d;};'use strict';var EventEmitter=require(_0x00ed('0x0'));var WhatsappQueue=require(_0x00ed('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x00ed('0x2'),'afterDestroy':'remove'};function emitEvent(_0x556162){return function(_0x117f2f,_0x127b2b,_0x5c80e7){WhatsappQueueEvents['emit'](_0x556162+':'+_0x117f2f['id'],_0x117f2f);WhatsappQueueEvents['emit'](_0x556162,_0x117f2f);_0x5c80e7(null);};}for(var e in events){if(events[_0x00ed('0x3')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x00ed('0x4')]=WhatsappQueueEvents; \ No newline at end of file +var _0x64a4=['save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3bb2a9,_0x16e5d1){var _0x298b0c=function(_0x8a3aea){while(--_0x8a3aea){_0x3bb2a9['push'](_0x3bb2a9['shift']());}};_0x298b0c(++_0x16e5d1);}(_0x64a4,0x167));var _0x464a=function(_0x362cf3,_0x355fe3){_0x362cf3=_0x362cf3-0x0;var _0x539116=_0x64a4[_0x362cf3];return _0x539116;};'use strict';var EventEmitter=require(_0x464a('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x464a('0x1'),'afterUpdate':_0x464a('0x2'),'afterDestroy':_0x464a('0x3')};function emitEvent(_0xb69c8f){return function(_0x1b7566,_0x144876,_0x5c3106){WhatsappQueueEvents[_0x464a('0x4')](_0xb69c8f+':'+_0x1b7566['id'],_0x1b7566);WhatsappQueueEvents[_0x464a('0x4')](_0xb69c8f,_0x1b7566);_0x5c3106(null);};}for(var e in events){if(events[_0x464a('0x5')](e)){var event=events[e];WhatsappQueue[_0x464a('0x6')](e,emitEvent(event));}}module[_0x464a('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a1fa821..c7da13e 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 _0x1761=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x1761,0x199));var _0x1176=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1761[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1176('0x0'));var util=require(_0x1176('0x1'));var logger=require(_0x1176('0x2'))(_0x1176('0x3'));var moment=require(_0x1176('0x4'));var BPromise=require('bluebird');var rp=require(_0x1176('0x5'));var fs=require('fs');var path=require(_0x1176('0x6'));var rimraf=require(_0x1176('0x7'));var config=require(_0x1176('0x8'));var attributes=require(_0x1176('0x9'));module[_0x1176('0xa')]=function(_0xc6d042,_0x43d955){return _0xc6d042[_0x1176('0xb')]('WhatsappQueue',attributes,{'tableName':_0x1176('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04d2=['api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x04d2,0x107));var _0x204d=function(_0x29f78f,_0x29f78c){_0x29f78f=_0x29f78f-0x0;var _0x2ec768=_0x04d2[_0x29f78f];return _0x2ec768;};'use strict';var _=require(_0x204d('0x0'));var util=require(_0x204d('0x1'));var logger=require(_0x204d('0x2'))(_0x204d('0x3'));var moment=require(_0x204d('0x4'));var BPromise=require(_0x204d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x204d('0x6'));var rimraf=require(_0x204d('0x7'));var config=require(_0x204d('0x8'));var attributes=require(_0x204d('0x9'));module[_0x204d('0xa')]=function(_0x5a5ade,_0x20ab73){return _0x5a5ade[_0x204d('0xb')](_0x204d('0xc'),attributes,{'tableName':_0x204d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 1f9b679..e80ab05 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 _0x66b1=['raw','where','attributes','limit','include','model','map','then','ShowWhatsappQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x11bd67,_0x34201e){var _0x236091=function(_0x144887){while(--_0x144887){_0x11bd67['push'](_0x11bd67['shift']());}};_0x236091(++_0x34201e);}(_0x66b1,0x169));var _0x166b=function(_0x1db07e,_0x45547a){_0x1db07e=_0x1db07e-0x0;var _0x3edfc7=_0x66b1[_0x1db07e];return _0x3edfc7;};'use strict';var _=require(_0x166b('0x0'));var util=require(_0x166b('0x1'));var moment=require(_0x166b('0x2'));var BPromise=require(_0x166b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x166b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x166b('0x5'));var jayson=require(_0x166b('0x6'));var client=jayson[_0x166b('0x7')][_0x166b('0x8')]({'port':0x232a});config[_0x166b('0x9')]=_[_0x166b('0xa')](config[_0x166b('0x9')],{'host':_0x166b('0xb'),'port':0x18eb});var socket=require(_0x166b('0xc'))(new Redis(config[_0x166b('0x9')]));require(_0x166b('0xd'))[_0x166b('0xe')](socket);function respondWithRpcPromise(_0xf8cbb2,_0x488fbc,_0x48f877){return new BPromise(function(_0x306a01,_0x1cc1eb){return client['request'](_0xf8cbb2,_0x48f877)['then'](function(_0x898971){logger['info'](_0x166b('0xf'),_0x488fbc,_0x166b('0x10'));logger[_0x166b('0x11')](_0x166b('0x12'),_0x488fbc,'request\x20sent',JSON[_0x166b('0x13')](_0x898971));if(_0x898971[_0x166b('0x14')]){if(_0x898971[_0x166b('0x14')]['code']===0x1f4){logger[_0x166b('0x14')](_0x166b('0xf'),_0x488fbc,_0x898971['error'][_0x166b('0x15')]);return _0x1cc1eb(_0x898971[_0x166b('0x14')][_0x166b('0x15')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x488fbc,_0x898971[_0x166b('0x14')][_0x166b('0x15')]);return _0x306a01(_0x898971[_0x166b('0x14')]['message']);}else{logger[_0x166b('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x488fbc,_0x166b('0x10'));_0x306a01(_0x898971[_0x166b('0x17')][_0x166b('0x15')]);}})[_0x166b('0x18')](function(_0x250010){logger[_0x166b('0x14')](_0x166b('0xf'),_0x488fbc,_0x250010);_0x1cc1eb(_0x250010);});});}exports[_0x166b('0x19')]=function(_0x52733b){var _0x540121=this;return new Promise(function(_0x234e6c,_0x5e436c){return db[_0x166b('0x1a')][_0x166b('0x1b')]({'raw':_0x52733b[_0x166b('0x1c')]?_0x52733b[_0x166b('0x1c')][_0x166b('0x1d')]===undefined?!![]:![]:!![],'where':_0x52733b[_0x166b('0x1c')]?_0x52733b['options'][_0x166b('0x1e')]||null:null,'attributes':_0x52733b[_0x166b('0x1c')]?_0x52733b[_0x166b('0x1c')][_0x166b('0x1f')]||null:null,'limit':_0x52733b[_0x166b('0x1c')]?_0x52733b[_0x166b('0x1c')][_0x166b('0x20')]||null:null,'include':_0x52733b[_0x166b('0x1c')]?_0x52733b[_0x166b('0x1c')]['include']?_['map'](_0x52733b['options'][_0x166b('0x21')],function(_0x22d516){return{'model':db[_0x22d516[_0x166b('0x22')]],'as':_0x22d516['as'],'attributes':_0x22d516[_0x166b('0x1f')],'include':_0x22d516[_0x166b('0x21')]?_[_0x166b('0x23')](_0x22d516[_0x166b('0x21')],function(_0x533200){return{'model':db[_0x533200[_0x166b('0x22')]],'as':_0x533200['as'],'attributes':_0x533200[_0x166b('0x1f')],'include':_0x533200[_0x166b('0x21')]?_[_0x166b('0x23')](_0x533200[_0x166b('0x21')],function(_0x1e3e5f){return{'model':db[_0x1e3e5f[_0x166b('0x22')]],'as':_0x1e3e5f['as'],'attributes':_0x1e3e5f[_0x166b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x166b('0x24')](function(_0x44174b){logger[_0x166b('0x16')](_0x166b('0x19'),_0x52733b);logger['debug'](_0x166b('0x19'),_0x52733b,JSON[_0x166b('0x13')](_0x44174b));_0x234e6c(_0x44174b);})['catch'](function(_0x364e6b){logger[_0x166b('0x14')](_0x166b('0x19'),_0x364e6b[_0x166b('0x15')],_0x52733b);_0x5e436c(_0x540121[_0x166b('0x14')](0x1f4,_0x364e6b[_0x166b('0x15')]));});});};exports[_0x166b('0x25')]=function(_0x37a429){var _0x2cf7ff=this;return new Promise(function(_0x2c9b25,_0x468e41){return db['WhatsappQueue'][_0x166b('0x26')]({'raw':_0x37a429[_0x166b('0x1c')]?_0x37a429[_0x166b('0x1c')][_0x166b('0x1d')]===undefined?!![]:![]:!![],'where':_0x37a429[_0x166b('0x1c')]?_0x37a429[_0x166b('0x1c')]['where']||null:null,'attributes':_0x37a429[_0x166b('0x1c')]?_0x37a429[_0x166b('0x1c')][_0x166b('0x1f')]||null:null,'include':_0x37a429['options']?_0x37a429['options'][_0x166b('0x21')]?_['map'](_0x37a429[_0x166b('0x1c')][_0x166b('0x21')],function(_0x1b42e5){return{'model':db[_0x1b42e5[_0x166b('0x22')]],'as':_0x1b42e5['as'],'attributes':_0x1b42e5['attributes'],'include':_0x1b42e5[_0x166b('0x21')]?_[_0x166b('0x23')](_0x1b42e5[_0x166b('0x21')],function(_0x15daed){return{'model':db[_0x15daed[_0x166b('0x22')]],'as':_0x15daed['as'],'attributes':_0x15daed['attributes'],'include':_0x15daed[_0x166b('0x21')]?_[_0x166b('0x23')](_0x15daed[_0x166b('0x21')],function(_0x2184e9){return{'model':db[_0x2184e9[_0x166b('0x22')]],'as':_0x2184e9['as'],'attributes':_0x2184e9[_0x166b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x166b('0x24')](function(_0x2315ae){logger['info'](_0x166b('0x25'),_0x37a429);logger['debug'](_0x166b('0x25'),_0x37a429,JSON[_0x166b('0x13')](_0x2315ae));_0x2c9b25(_0x2315ae);})['catch'](function(_0x1cf493){logger['error'](_0x166b('0x25'),_0x1cf493[_0x166b('0x15')],_0x37a429);_0x468e41(_0x2cf7ff['error'](0x1f4,_0x1cf493[_0x166b('0x15')]));});});}; \ No newline at end of file +var _0x575b=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./whatsappQueue.socket','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','include','map','model','attributes','debug','ShowWhatsappQueue','find','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x575b,0x1c8));var _0xb575=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x575b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb575('0x0'));var util=require(_0xb575('0x1'));var moment=require(_0xb575('0x2'));var BPromise=require('bluebird');var rs=require(_0xb575('0x3'));var fs=require('fs');var Redis=require(_0xb575('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb575('0x5'));var logger=require(_0xb575('0x6'))('rpc');var config=require(_0xb575('0x7'));var jayson=require(_0xb575('0x8'));var client=jayson[_0xb575('0x9')][_0xb575('0xa')]({'port':0x232a});config['redis']=_[_0xb575('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb575('0xc'))(new Redis(config['redis']));require(_0xb575('0xd'))['register'](socket);function respondWithRpcPromise(_0xde32bd,_0x24ffc8,_0x3e88e0){return new BPromise(function(_0x3e2608,_0x5c47ba){return client['request'](_0xde32bd,_0x3e88e0)[_0xb575('0xe')](function(_0x1b947f){logger['info'](_0xb575('0xf'),_0x24ffc8,_0xb575('0x10'));logger['debug'](_0xb575('0x11'),_0x24ffc8,_0xb575('0x10'),JSON[_0xb575('0x12')](_0x1b947f));if(_0x1b947f['error']){if(_0x1b947f[_0xb575('0x13')][_0xb575('0x14')]===0x1f4){logger[_0xb575('0x13')](_0xb575('0xf'),_0x24ffc8,_0x1b947f[_0xb575('0x13')]['message']);return _0x5c47ba(_0x1b947f[_0xb575('0x13')][_0xb575('0x15')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x24ffc8,_0x1b947f[_0xb575('0x13')][_0xb575('0x15')]);return _0x3e2608(_0x1b947f['error'][_0xb575('0x15')]);}else{logger[_0xb575('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x24ffc8,_0xb575('0x10'));_0x3e2608(_0x1b947f[_0xb575('0x17')]['message']);}})[_0xb575('0x18')](function(_0x23140a){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x24ffc8,_0x23140a);_0x5c47ba(_0x23140a);});});}exports[_0xb575('0x19')]=function(_0x161a1a){var _0x304558=this;return new Promise(function(_0x1892a4,_0x131bd3){return db[_0xb575('0x1a')][_0xb575('0x1b')]({'raw':_0x161a1a['options']?_0x161a1a[_0xb575('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x161a1a['options']?_0x161a1a[_0xb575('0x1c')]['where']||null:null,'attributes':_0x161a1a[_0xb575('0x1c')]?_0x161a1a['options']['attributes']||null:null,'limit':_0x161a1a[_0xb575('0x1c')]?_0x161a1a[_0xb575('0x1c')]['limit']||null:null,'include':_0x161a1a[_0xb575('0x1c')]?_0x161a1a[_0xb575('0x1c')][_0xb575('0x1d')]?_[_0xb575('0x1e')](_0x161a1a['options']['include'],function(_0x145c56){return{'model':db[_0x145c56[_0xb575('0x1f')]],'as':_0x145c56['as'],'attributes':_0x145c56[_0xb575('0x20')],'include':_0x145c56['include']?_[_0xb575('0x1e')](_0x145c56[_0xb575('0x1d')],function(_0x3aa243){return{'model':db[_0x3aa243[_0xb575('0x1f')]],'as':_0x3aa243['as'],'attributes':_0x3aa243[_0xb575('0x20')],'include':_0x3aa243[_0xb575('0x1d')]?_['map'](_0x3aa243[_0xb575('0x1d')],function(_0x59c8fb){return{'model':db[_0x59c8fb[_0xb575('0x1f')]],'as':_0x59c8fb['as'],'attributes':_0x59c8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb575('0xe')](function(_0x2bf57c){logger[_0xb575('0x16')](_0xb575('0x19'),_0x161a1a);logger[_0xb575('0x21')]('GetWhatsappQueue',_0x161a1a,JSON[_0xb575('0x12')](_0x2bf57c));_0x1892a4(_0x2bf57c);})[_0xb575('0x18')](function(_0x1d8b2e){logger['error'](_0xb575('0x19'),_0x1d8b2e['message'],_0x161a1a);_0x131bd3(_0x304558[_0xb575('0x13')](0x1f4,_0x1d8b2e[_0xb575('0x15')]));});});};exports[_0xb575('0x22')]=function(_0x5f049f){var _0x23b710=this;return new Promise(function(_0x21d19e,_0x185dee){return db[_0xb575('0x1a')][_0xb575('0x23')]({'raw':_0x5f049f[_0xb575('0x1c')]?_0x5f049f[_0xb575('0x1c')][_0xb575('0x24')]===undefined?!![]:![]:!![],'where':_0x5f049f[_0xb575('0x1c')]?_0x5f049f[_0xb575('0x1c')][_0xb575('0x25')]||null:null,'attributes':_0x5f049f[_0xb575('0x1c')]?_0x5f049f[_0xb575('0x1c')]['attributes']||null:null,'include':_0x5f049f[_0xb575('0x1c')]?_0x5f049f['options']['include']?_[_0xb575('0x1e')](_0x5f049f[_0xb575('0x1c')]['include'],function(_0x124ba0){return{'model':db[_0x124ba0[_0xb575('0x1f')]],'as':_0x124ba0['as'],'attributes':_0x124ba0[_0xb575('0x20')],'include':_0x124ba0[_0xb575('0x1d')]?_[_0xb575('0x1e')](_0x124ba0[_0xb575('0x1d')],function(_0x3a28a0){return{'model':db[_0x3a28a0[_0xb575('0x1f')]],'as':_0x3a28a0['as'],'attributes':_0x3a28a0[_0xb575('0x20')],'include':_0x3a28a0[_0xb575('0x1d')]?_[_0xb575('0x1e')](_0x3a28a0[_0xb575('0x1d')],function(_0x15ee9e){return{'model':db[_0x15ee9e[_0xb575('0x1f')]],'as':_0x15ee9e['as'],'attributes':_0x15ee9e[_0xb575('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54f47b){logger[_0xb575('0x16')]('ShowWhatsappQueue',_0x5f049f);logger[_0xb575('0x21')](_0xb575('0x22'),_0x5f049f,JSON[_0xb575('0x12')](_0x54f47b));_0x21d19e(_0x54f47b);})[_0xb575('0x18')](function(_0x5aa285){logger[_0xb575('0x13')](_0xb575('0x22'),_0x5aa285['message'],_0x5f049f);_0x185dee(_0x23b710[_0xb575('0x13')](0x1f4,_0x5aa285[_0xb575('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index dbe4925..012d94c 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 _0x9c91=['./whatsappQueue.events','update','emit','removeListener','register','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c91,0x108));var _0x19c9=function(_0x2e54fd,_0xa4ed7d){_0x2e54fd=_0x2e54fd-0x0;var _0x105126=_0x9c91[_0x2e54fd];return _0x105126;};'use strict';var WhatsappQueueEvents=require(_0x19c9('0x0'));var events=['save','remove',_0x19c9('0x1')];function createListener(_0x9e300f,_0x4f63f5){return function(_0x24f7ed){_0x4f63f5[_0x19c9('0x2')](_0x9e300f,_0x24f7ed);};}function removeListener(_0x877e25,_0x1b82f2){return function(){WhatsappQueueEvents[_0x19c9('0x3')](_0x877e25,_0x1b82f2);};}exports[_0x19c9('0x4')]=function(_0x41fecb){for(var _0x561d1c=0x0,_0x44a96b=events[_0x19c9('0x5')];_0x561d1c<_0x44a96b;_0x561d1c++){var _0x12c3bf=events[_0x561d1c];var _0x2b164a=createListener('whatsappQueue:'+_0x12c3bf,_0x41fecb);WhatsappQueueEvents['on'](_0x12c3bf,_0x2b164a);}}; \ No newline at end of file +var _0xab55=['remove','update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x1d33e9,_0x3bf7f9){var _0x278038=function(_0x353204){while(--_0x353204){_0x1d33e9['push'](_0x1d33e9['shift']());}};_0x278038(++_0x3bf7f9);}(_0xab55,0xb7));var _0x5ab5=function(_0x27b64c,_0x507b9d){_0x27b64c=_0x27b64c-0x0;var _0x5538f0=_0xab55[_0x27b64c];return _0x5538f0;};'use strict';var WhatsappQueueEvents=require(_0x5ab5('0x0'));var events=['save',_0x5ab5('0x1'),_0x5ab5('0x2')];function createListener(_0x8b7201,_0x16c55c){return function(_0x510a0e){_0x16c55c[_0x5ab5('0x3')](_0x8b7201,_0x510a0e);};}function removeListener(_0x3bfa53,_0x35a160){return function(){WhatsappQueueEvents[_0x5ab5('0x4')](_0x3bfa53,_0x35a160);};}exports[_0x5ab5('0x5')]=function(_0x2fb72f){for(var _0x1dc4e6=0x0,_0xdbf89e=events[_0x5ab5('0x6')];_0x1dc4e6<_0xdbf89e;_0x1dc4e6++){var _0x13a64f=events[_0x1dc4e6];var _0x2e0bcf=createListener(_0x5ab5('0x7')+_0x13a64f,_0x2fb72f);WhatsappQueueEvents['on'](_0x13a64f,_0x2e0bcf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 92e0b80..02387bd 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 _0x7304=['describe','/:id','create','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x33dbd2,_0x26f879){var _0x3fb720=function(_0x3476ef){while(--_0x3476ef){_0x33dbd2['push'](_0x33dbd2['shift']());}};_0x3fb720(++_0x26f879);}(_0x7304,0x169));var _0x4730=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x7304[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require(_0x4730('0x0'));var util=require('util');var path=require(_0x4730('0x1'));var timeout=require(_0x4730('0x2'));var express=require(_0x4730('0x3'));var router=express[_0x4730('0x4')]();var fs_extra=require(_0x4730('0x5'));var auth=require(_0x4730('0x6'));var interaction=require(_0x4730('0x7'));var config=require(_0x4730('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x4730('0x9')]('/',auth[_0x4730('0xa')](),controller[_0x4730('0xb')]);router[_0x4730('0x9')](_0x4730('0xc'),auth['isAuthenticated'](),controller[_0x4730('0xd')]);router['get'](_0x4730('0xe'),auth[_0x4730('0xa')](),controller['show']);router['post']('/',auth[_0x4730('0xa')](),controller[_0x4730('0xf')]);router['put'](_0x4730('0xe'),auth[_0x4730('0xa')](),controller['update']);router['delete'](_0x4730('0xe'),auth[_0x4730('0xa')](),controller[_0x4730('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd921=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','multer','util','path'];(function(_0x2c42b2,_0x2e8620){var _0x1fce29=function(_0x418b4a){while(--_0x418b4a){_0x2c42b2['push'](_0x2c42b2['shift']());}};_0x1fce29(++_0x2e8620);}(_0xd921,0x19f));var _0x1d92=function(_0xc00a54,_0x42f6dc){_0xc00a54=_0xc00a54-0x0;var _0x20de86=_0xd921[_0xc00a54];return _0x20de86;};'use strict';var multer=require(_0x1d92('0x0'));var util=require(_0x1d92('0x1'));var path=require(_0x1d92('0x2'));var timeout=require(_0x1d92('0x3'));var express=require(_0x1d92('0x4'));var router=express[_0x1d92('0x5')]();var fs_extra=require(_0x1d92('0x6'));var auth=require(_0x1d92('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1d92('0x8'));router[_0x1d92('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d92('0xa')]);router[_0x1d92('0x9')](_0x1d92('0xb'),auth[_0x1d92('0xc')](),controller[_0x1d92('0xd')]);router[_0x1d92('0x9')](_0x1d92('0xe'),auth[_0x1d92('0xc')](),controller[_0x1d92('0xf')]);router['post']('/',auth[_0x1d92('0xc')](),controller['create']);router['put'](_0x1d92('0xe'),auth[_0x1d92('0xc')](),controller[_0x1d92('0x10')]);router[_0x1d92('0x11')](_0x1d92('0xe'),auth['isAuthenticated'](),controller[_0x1d92('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 161c2c1..b66bac8 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x2060e5,_0xa041a7){var _0xd3fa07=function(_0x3ca169){while(--_0x3ca169){_0x2060e5['push'](_0x2060e5['shift']());}};_0xd3fa07(++_0xa041a7);}(_0x7a54,0x106));var _0x47a5=function(_0x20d481,_0x3ec31f){_0x20d481=_0x20d481-0x0;var _0x4d8068=_0x7a54[_0x20d481];return _0x4d8068;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x615c18,_0x5742a6){var _0xd37c93=function(_0x526e8a){while(--_0x526e8a){_0x615c18['push'](_0x615c18['shift']());}};_0xd37c93(++_0x5742a6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index ab3c8d4..7fa34ee 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 _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(_0x470e9e,_0x3abbbe){var _0x1380ec=function(_0x223cc9){while(--_0x223cc9){_0x470e9e['push'](_0x470e9e['shift']());}};_0x1380ec(++_0x3abbbe);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5f1e43,_0x31692a){_0x5f1e43=_0x5f1e43-0x0;var _0x4c489c=_0x1d2d[_0x5f1e43];return _0x4c489c;};'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 +var _0xd914=['util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x364fc9,_0x436162){var _0x3a018f=function(_0x1f2992){while(--_0x1f2992){_0x364fc9['push'](_0x364fc9['shift']());}};_0x3a018f(++_0x436162);}(_0xd914,0x17f));var _0x4d91=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0xd914[_0x539533];return _0x3942f3;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){_0x9cb864['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee6b3,_0x112923){return function(_0x3bed98){if(!_0x3bed98){_0x1ee6b3[_0x4d91('0x28')](0x194);}return _0x3bed98;};}function handleError(_0x472f3a,_0x2c7d7a){_0x2c7d7a=_0x2c7d7a||0x1f4;return function(_0x14bdb4){logger['error'](_0x14bdb4[_0x4d91('0x29')]);if(_0x14bdb4[_0x4d91('0x2a')]){delete _0x14bdb4[_0x4d91('0x2a')];}_0x472f3a['status'](_0x2c7d7a)['send'](_0x14bdb4);};}exports[_0x4d91('0x2b')]=function(_0x470079,_0x5ed948){var _0x50fe76={},_0x42d5a0={},_0x2d6981={'count':0x0,'rows':[]};var _0x43371e=_[_0x4d91('0x2c')](db['WhatsappQueueReport'][_0x4d91('0x2d')],function(_0x31bbf8){return{'name':_0x31bbf8[_0x4d91('0x2e')],'type':_0x31bbf8[_0x4d91('0x2f')][_0x4d91('0x30')]};});_0x42d5a0[_0x4d91('0x31')]=_[_0x4d91('0x2c')](_0x43371e,'name');_0x42d5a0[_0x4d91('0x32')]=_['keys'](_0x470079['query']);_0x42d5a0[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x42d5a0['model'],_0x42d5a0[_0x4d91('0x32')]);_0x50fe76[_0x4d91('0x35')]=_[_0x4d91('0x34')](_0x42d5a0[_0x4d91('0x31')],qs[_0x4d91('0x36')](_0x470079['query'][_0x4d91('0x36')]));_0x50fe76[_0x4d91('0x35')]=_0x50fe76[_0x4d91('0x35')][_0x4d91('0x37')]?_0x50fe76[_0x4d91('0x35')]:_0x42d5a0[_0x4d91('0x31')];if(!_0x470079['query'][_0x4d91('0x38')](_0x4d91('0x39'))){_0x50fe76['limit']=qs[_0x4d91('0x3a')](_0x470079[_0x4d91('0x32')][_0x4d91('0x3a')]);_0x50fe76['offset']=qs[_0x4d91('0x1e')](_0x470079[_0x4d91('0x32')][_0x4d91('0x1e')]);}_0x50fe76[_0x4d91('0x3b')]=qs['sort'](_0x470079[_0x4d91('0x32')][_0x4d91('0x3c')]);_0x50fe76[_0x4d91('0x3d')]=qs[_0x4d91('0x33')](_['pick'](_0x470079['query'],_0x42d5a0[_0x4d91('0x33')]),_0x43371e);if(_0x470079[_0x4d91('0x32')]['filter']){_0x50fe76[_0x4d91('0x3d')]=_[_0x4d91('0x3e')](_0x50fe76[_0x4d91('0x3d')],{'$or':_[_0x4d91('0x2c')](_0x43371e,function(_0x5d93c1){if(_0x5d93c1[_0x4d91('0x2f')]!==_0x4d91('0x3f')){var _0x571a0c={};_0x571a0c[_0x5d93c1[_0x4d91('0x2a')]]={'$like':'%'+_0x470079['query'][_0x4d91('0x40')]+'%'};return _0x571a0c;}})});}_0x50fe76=_['merge']({},_0x50fe76,_0x470079[_0x4d91('0x41')]);var _0x49742b={'where':_0x50fe76[_0x4d91('0x3d')]};return db[_0x4d91('0x42')][_0x4d91('0x20')](_0x49742b)[_0x4d91('0x26')](function(_0x4f6576){_0x2d6981['count']=_0x4f6576;if(_0x470079[_0x4d91('0x32')]['includeAll']){_0x50fe76[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x42')]['findAll'](_0x50fe76);})[_0x4d91('0x26')](function(_0x2ae356){_0x2d6981[_0x4d91('0x44')]=_0x2ae356;return _0x2d6981;})[_0x4d91('0x26')](respondWithFilteredResult(_0x5ed948,_0x50fe76))[_0x4d91('0x45')](handleError(_0x5ed948,null));};exports[_0x4d91('0x46')]=function(_0x23902f,_0x4f6254){var _0x1e4c6d={'raw':!![],'where':{'id':_0x23902f[_0x4d91('0x47')]['id']}},_0x4c70af={};_0x4c70af[_0x4d91('0x31')]=_[_0x4d91('0x48')](db[_0x4d91('0x42')][_0x4d91('0x2d')]);_0x4c70af[_0x4d91('0x32')]=_['keys'](_0x23902f['query']);_0x4c70af[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x4c70af['model'],_0x4c70af[_0x4d91('0x32')]);_0x1e4c6d[_0x4d91('0x35')]=_[_0x4d91('0x34')](_0x4c70af[_0x4d91('0x31')],qs[_0x4d91('0x36')](_0x23902f[_0x4d91('0x32')][_0x4d91('0x36')]));_0x1e4c6d[_0x4d91('0x35')]=_0x1e4c6d[_0x4d91('0x35')]['length']?_0x1e4c6d['attributes']:_0x4c70af[_0x4d91('0x31')];if(_0x23902f['query'][_0x4d91('0x49')]){_0x1e4c6d[_0x4d91('0x43')]=[{'all':!![]}];}_0x1e4c6d=_[_0x4d91('0x3e')]({},_0x1e4c6d,_0x23902f[_0x4d91('0x41')]);return db['WhatsappQueueReport'][_0x4d91('0x4a')](_0x1e4c6d)['then'](handleEntityNotFound(_0x4f6254,null))['then'](respondWithResult(_0x4f6254,null))[_0x4d91('0x45')](handleError(_0x4f6254,null));};exports[_0x4d91('0x4b')]=function(_0x18073d,_0xa03d75){return db[_0x4d91('0x42')][_0x4d91('0x4b')](_0x18073d['body'],{})[_0x4d91('0x26')](respondWithResult(_0xa03d75,0xc9))[_0x4d91('0x45')](handleError(_0xa03d75,null));};exports[_0x4d91('0x25')]=function(_0x449dd8,_0x106e5b){if(_0x449dd8[_0x4d91('0x4c')]['id']){delete _0x449dd8[_0x4d91('0x4c')]['id'];}return db[_0x4d91('0x42')][_0x4d91('0x4a')]({'where':{'id':_0x449dd8[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x106e5b,null))['then'](saveUpdates(_0x449dd8[_0x4d91('0x4c')],null))['then'](respondWithResult(_0x106e5b,null))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x27')]=function(_0x195e65,_0x386935){return db[_0x4d91('0x42')][_0x4d91('0x4a')]({'where':{'id':_0x195e65[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x386935,null))['then'](removeEntity(_0x386935,null))[_0x4d91('0x45')](handleError(_0x386935,null));};exports[_0x4d91('0x4d')]=function(_0x3fe9ee,_0x2bba43){return db[_0x4d91('0x42')][_0x4d91('0x4d')]()[_0x4d91('0x26')](respondWithResult(_0x2bba43,null))['catch'](handleError(_0x2bba43,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a8a2341..81351a8 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 _0x0607=['path','../../config/environment','define','uniqueid','util','api','request-promise'];(function(_0x4f7edd,_0x5dbed9){var _0x3a0eaa=function(_0x5a7521){while(--_0x5a7521){_0x4f7edd['push'](_0x4f7edd['shift']());}};_0x3a0eaa(++_0x5dbed9);}(_0x0607,0x115));var _0x7060=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0607[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x7060('0x0'));var logger=require('../../config/logger')(_0x7060('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7060('0x2'));var fs=require('fs');var path=require(_0x7060('0x3'));var rimraf=require('rimraf');var config=require(_0x7060('0x4'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x2998aa,_0x28072f){return _0x2998aa[_0x7060('0x5')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7060('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x93c5=['request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x93c5,0x1ba));var _0x593c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x93c5[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x593c('0x0'));var util=require(_0x593c('0x1'));var logger=require(_0x593c('0x2'))(_0x593c('0x3'));var moment=require(_0x593c('0x4'));var BPromise=require(_0x593c('0x5'));var rp=require(_0x593c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x593c('0x7'));var config=require(_0x593c('0x8'));var attributes=require(_0x593c('0x9'));module[_0x593c('0xa')]=function(_0x1a2d51,_0x5067e5){return _0x1a2d51[_0x593c('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x593c('0xc'),'paranoid':![],'indexes':[{'name':_0x593c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 8cc33c2..4558a00 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 _0xba32=['debug','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0xc9a898,_0x3756e2){var _0x563def=function(_0xe6d8e4){while(--_0xe6d8e4){_0xc9a898['push'](_0xc9a898['shift']());}};_0x563def(++_0x3756e2);}(_0xba32,0x19e));var _0x2ba3=function(_0x40be1a,_0x13b843){_0x40be1a=_0x40be1a-0x0;var _0x4e6f36=_0xba32[_0x40be1a];return _0x4e6f36;};'use strict';var _=require('lodash');var util=require(_0x2ba3('0x0'));var moment=require(_0x2ba3('0x1'));var BPromise=require(_0x2ba3('0x2'));var rs=require(_0x2ba3('0x3'));var fs=require('fs');var Redis=require(_0x2ba3('0x4'));var db=require(_0x2ba3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ba3('0x6'))(_0x2ba3('0x7'));var config=require(_0x2ba3('0x8'));var jayson=require(_0x2ba3('0x9'));var client=jayson[_0x2ba3('0xa')][_0x2ba3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13d96c,_0x42916d,_0x26fce7){return new BPromise(function(_0x46e2b4,_0x2c39cf){return client['request'](_0x13d96c,_0x26fce7)['then'](function(_0x1d81a5){logger[_0x2ba3('0xc')](_0x2ba3('0xd'),_0x42916d,_0x2ba3('0xe'));logger[_0x2ba3('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x42916d,'request\x20sent',JSON[_0x2ba3('0x10')](_0x1d81a5));if(_0x1d81a5[_0x2ba3('0x11')]){if(_0x1d81a5[_0x2ba3('0x11')][_0x2ba3('0x12')]===0x1f4){logger[_0x2ba3('0x11')](_0x2ba3('0xd'),_0x42916d,_0x1d81a5['error'][_0x2ba3('0x13')]);return _0x2c39cf(_0x1d81a5['error']['message']);}logger[_0x2ba3('0x11')](_0x2ba3('0xd'),_0x42916d,_0x1d81a5[_0x2ba3('0x11')][_0x2ba3('0x13')]);return _0x46e2b4(_0x1d81a5[_0x2ba3('0x11')][_0x2ba3('0x13')]);}else{logger[_0x2ba3('0xc')](_0x2ba3('0xd'),_0x42916d,_0x2ba3('0xe'));_0x46e2b4(_0x1d81a5[_0x2ba3('0x14')][_0x2ba3('0x13')]);}})[_0x2ba3('0x15')](function(_0x37dced){logger[_0x2ba3('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x42916d,_0x37dced);_0x2c39cf(_0x37dced);});});}exports['CreateWhatsappQueueReport']=function(_0x1ac0e9){var _0x17106e=this;return new Promise(function(_0x1d901f,_0x49e4cc){return db[_0x2ba3('0x16')][_0x2ba3('0x17')](_0x1ac0e9[_0x2ba3('0x18')],{'raw':_0x1ac0e9[_0x2ba3('0x19')]?_0x1ac0e9[_0x2ba3('0x19')][_0x2ba3('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1d5557){logger[_0x2ba3('0xc')](_0x2ba3('0x1b'),_0x1ac0e9);logger[_0x2ba3('0xf')](_0x2ba3('0x1b'),_0x1ac0e9,JSON[_0x2ba3('0x10')](_0x1d5557));_0x1d901f(_0x1d5557);})['catch'](function(_0x5c8d62){logger[_0x2ba3('0x11')](_0x2ba3('0x1b'),_0x5c8d62[_0x2ba3('0x13')],_0x1ac0e9);_0x49e4cc(_0x17106e[_0x2ba3('0x11')](0x1f4,_0x5c8d62[_0x2ba3('0x13')]));});});};exports[_0x2ba3('0x1c')]=function(_0x463ab2){var _0x352066=this;return new Promise(function(_0x10910a,_0x2ff5eb){return db[_0x2ba3('0x16')][_0x2ba3('0x1d')](_0x463ab2[_0x2ba3('0x18')],{'raw':_0x463ab2[_0x2ba3('0x19')]?_0x463ab2[_0x2ba3('0x19')][_0x2ba3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463ab2[_0x2ba3('0x19')]?_0x463ab2['options'][_0x2ba3('0x1e')]||null:null,'attributes':_0x463ab2[_0x2ba3('0x19')]?_0x463ab2[_0x2ba3('0x19')]['attributes']||null:null,'limit':_0x463ab2[_0x2ba3('0x19')]?_0x463ab2[_0x2ba3('0x19')][_0x2ba3('0x1f')]||null:null})[_0x2ba3('0x20')](function(_0x2b53d5){logger[_0x2ba3('0xc')](_0x2ba3('0x1c'),_0x463ab2);logger[_0x2ba3('0xf')](_0x2ba3('0x1c'),_0x463ab2,JSON[_0x2ba3('0x10')](_0x2b53d5));_0x10910a(_0x2b53d5);})[_0x2ba3('0x15')](function(_0x12776c){logger[_0x2ba3('0x11')](_0x2ba3('0x1c'),_0x12776c['message'],_0x463ab2);_0x2ff5eb(_0x352066[_0x2ba3('0x11')](0x1f4,_0x12776c[_0x2ba3('0x13')]));});});}; \ No newline at end of file +var _0x5ac2=['stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x13225b,_0x2f1e95){var _0x16c39a=function(_0x397d19){while(--_0x397d19){_0x13225b['push'](_0x13225b['shift']());}};_0x16c39a(++_0x2f1e95);}(_0x5ac2,0x1b5));var _0x25ac=function(_0x165aba,_0x3e37f6){_0x165aba=_0x165aba-0x0;var _0x50ebb7=_0x5ac2[_0x165aba];return _0x50ebb7;};'use strict';var _=require(_0x25ac('0x0'));var util=require(_0x25ac('0x1'));var moment=require(_0x25ac('0x2'));var BPromise=require(_0x25ac('0x3'));var rs=require(_0x25ac('0x4'));var fs=require('fs');var Redis=require(_0x25ac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x25ac('0x6'));var logger=require('../../config/logger')(_0x25ac('0x7'));var config=require(_0x25ac('0x8'));var jayson=require(_0x25ac('0x9'));var client=jayson[_0x25ac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1c00,_0x143d6e,_0x424b39){return new BPromise(function(_0x16a863,_0x115394){return client[_0x25ac('0xb')](_0x3a1c00,_0x424b39)[_0x25ac('0xc')](function(_0x2c1f20){logger[_0x25ac('0xd')](_0x25ac('0xe'),_0x143d6e,_0x25ac('0xf'));logger[_0x25ac('0x10')](_0x25ac('0x11'),_0x143d6e,_0x25ac('0xf'),JSON[_0x25ac('0x12')](_0x2c1f20));if(_0x2c1f20['error']){if(_0x2c1f20[_0x25ac('0x13')][_0x25ac('0x14')]===0x1f4){logger[_0x25ac('0x13')](_0x25ac('0xe'),_0x143d6e,_0x2c1f20['error'][_0x25ac('0x15')]);return _0x115394(_0x2c1f20[_0x25ac('0x13')]['message']);}logger[_0x25ac('0x13')](_0x25ac('0xe'),_0x143d6e,_0x2c1f20['error'][_0x25ac('0x15')]);return _0x16a863(_0x2c1f20['error']['message']);}else{logger['info'](_0x25ac('0xe'),_0x143d6e,'request\x20sent');_0x16a863(_0x2c1f20[_0x25ac('0x16')]['message']);}})['catch'](function(_0x160832){logger[_0x25ac('0x13')](_0x25ac('0xe'),_0x143d6e,_0x160832);_0x115394(_0x160832);});});}exports[_0x25ac('0x17')]=function(_0x5bcf6f){var _0x362f37=this;return new Promise(function(_0x571a99,_0x40b8db){return db[_0x25ac('0x18')][_0x25ac('0x19')](_0x5bcf6f[_0x25ac('0x1a')],{'raw':_0x5bcf6f[_0x25ac('0x1b')]?_0x5bcf6f['options'][_0x25ac('0x1c')]===undefined?!![]:![]:!![]})[_0x25ac('0xc')](function(_0xf42e37){logger[_0x25ac('0xd')]('CreateWhatsappQueueReport',_0x5bcf6f);logger[_0x25ac('0x10')](_0x25ac('0x17'),_0x5bcf6f,JSON['stringify'](_0xf42e37));_0x571a99(_0xf42e37);})['catch'](function(_0x191e28){logger[_0x25ac('0x13')](_0x25ac('0x17'),_0x191e28[_0x25ac('0x15')],_0x5bcf6f);_0x40b8db(_0x362f37[_0x25ac('0x13')](0x1f4,_0x191e28[_0x25ac('0x15')]));});});};exports[_0x25ac('0x1d')]=function(_0x58befe){var _0x4e4f8a=this;return new Promise(function(_0x146e44,_0x3694c5){return db['WhatsappQueueReport'][_0x25ac('0x1e')](_0x58befe[_0x25ac('0x1a')],{'raw':_0x58befe[_0x25ac('0x1b')]?_0x58befe['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58befe[_0x25ac('0x1b')]?_0x58befe[_0x25ac('0x1b')][_0x25ac('0x1f')]||null:null,'attributes':_0x58befe['options']?_0x58befe[_0x25ac('0x1b')][_0x25ac('0x20')]||null:null,'limit':_0x58befe[_0x25ac('0x1b')]?_0x58befe[_0x25ac('0x1b')][_0x25ac('0x21')]||null:null})[_0x25ac('0xc')](function(_0x1f0882){logger[_0x25ac('0xd')](_0x25ac('0x1d'),_0x58befe);logger[_0x25ac('0x10')](_0x25ac('0x1d'),_0x58befe,JSON[_0x25ac('0x12')](_0x1f0882));_0x146e44(_0x1f0882);})[_0x25ac('0x22')](function(_0x6ad5d5){logger['error']('UpdateWhatsappQueueReport',_0x6ad5d5['message'],_0x58befe);_0x3694c5(_0x4e4f8a[_0x25ac('0x13')](0x1f4,_0x6ad5d5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f7281ac..795df29 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 _0x06fa=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','post','create','update','exports','multer','path','fs-extra'];(function(_0x14f6db,_0x4d9f26){var _0x45344d=function(_0x44cace){while(--_0x44cace){_0x14f6db['push'](_0x14f6db['shift']());}};_0x45344d(++_0x4d9f26);}(_0x06fa,0x10d));var _0xa06f=function(_0x1f5e7d,_0x129826){_0x1f5e7d=_0x1f5e7d-0x0;var _0x4a8833=_0x06fa[_0x1f5e7d];return _0x4a8833;};'use strict';var multer=require(_0xa06f('0x0'));var util=require('util');var path=require(_0xa06f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa06f('0x2'));var auth=require(_0xa06f('0x3'));var interaction=require(_0xa06f('0x4'));var config=require(_0xa06f('0x5'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xa06f('0x6')](),controller[_0xa06f('0x7')]);router['get'](_0xa06f('0x8'),auth[_0xa06f('0x6')](),controller[_0xa06f('0x9')]);router[_0xa06f('0xa')](_0xa06f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa06f('0xc')]('/',auth[_0xa06f('0x6')](),controller[_0xa06f('0xd')]);router['put'](_0xa06f('0xb'),auth[_0xa06f('0x6')](),controller[_0xa06f('0xe')]);router['delete'](_0xa06f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa06f('0xf')]=router; \ No newline at end of file +var _0xf548=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','destroy','multer'];(function(_0x133f82,_0x372df6){var _0xb499fc=function(_0x49477a){while(--_0x49477a){_0x133f82['push'](_0x133f82['shift']());}};_0xb499fc(++_0x372df6);}(_0xf548,0x65));var _0x8f54=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xf548[_0x1344d6];return _0xf45b24;};'use strict';var multer=require(_0x8f54('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8f54('0x1'));var express=require(_0x8f54('0x2'));var router=express['Router']();var fs_extra=require(_0x8f54('0x3'));var auth=require(_0x8f54('0x4'));var interaction=require(_0x8f54('0x5'));var config=require('../../config/environment');var controller=require(_0x8f54('0x6'));router['get']('/',auth[_0x8f54('0x7')](),controller[_0x8f54('0x8')]);router[_0x8f54('0x9')]('/describe',auth[_0x8f54('0x7')](),controller[_0x8f54('0xa')]);router[_0x8f54('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8f54('0xb')]);router[_0x8f54('0xc')]('/',auth['isAuthenticated'](),controller[_0x8f54('0xd')]);router[_0x8f54('0xe')](_0x8f54('0xf'),auth[_0x8f54('0x7')](),controller['update']);router['delete']('/:id',auth[_0x8f54('0x7')](),controller[_0x8f54('0x10')]);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 be5928a..db80957 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 _0x23db=['ENUM','account','agent','sequelize','exports','STRING'];(function(_0x551066,_0x1dcb3e){var _0x26e7c7=function(_0xae6a8e){while(--_0xae6a8e){_0x551066['push'](_0x551066['shift']());}};_0x26e7c7(++_0x1dcb3e);}(_0x23db,0x141));var _0xb23d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x23db[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xb23d('0x0'));module[_0xb23d('0x1')]={'uniqueid':{'type':Sequelize[_0xb23d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb23d('0x3')](_0xb23d('0x4'),_0xb23d('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xa413=['agent','sequelize','STRING','account'];(function(_0x5b4aa1,_0x57cd05){var _0x103a7a=function(_0x1fa14f){while(--_0x1fa14f){_0x5b4aa1['push'](_0x5b4aa1['shift']());}};_0x103a7a(++_0x57cd05);}(_0xa413,0x1e5));var _0x3a41=function(_0x2c9bc9,_0x1424f8){_0x2c9bc9=_0x2c9bc9-0x0;var _0x7674d1=_0xa413[_0x2c9bc9];return _0x7674d1;};'use strict';var Sequelize=require(_0x3a41('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3a41('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3a41('0x2'),_0x3a41('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index aab842e..f7f519f 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 _0x09d6=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','WhatsappTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','update','find','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5ab40d,_0x24fac4){var _0x50863d=function(_0x4a747c){while(--_0x4a747c){_0x5ab40d['push'](_0x5ab40d['shift']());}};_0x50863d(++_0x24fac4);}(_0x09d6,0x159));var _0x609d=function(_0x5293d4,_0x3f8004){_0x5293d4=_0x5293d4-0x0;var _0x3dcc1d=_0x09d6[_0x5293d4];return _0x3dcc1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x609d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x609d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x609d('0x2'));var Mustache=require(_0x609d('0x3'));var util=require(_0x609d('0x4'));var path=require(_0x609d('0x5'));var sox=require(_0x609d('0x6'));var csv=require('to-csv');var ejs=require(_0x609d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x609d('0x8'));var squel=require(_0x609d('0x9'));var crypto=require(_0x609d('0xa'));var jsforce=require(_0x609d('0xb'));var deskjs=require(_0x609d('0xc'));var toCsv=require(_0x609d('0xd'));var querystring=require('querystring');var Papa=require(_0x609d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x609d('0xf'));var as=require(_0x609d('0x10'));var hardwareService=require(_0x609d('0x11'));var logger=require(_0x609d('0x12'))(_0x609d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x609d('0x14'));var db=require(_0x609d('0x15'))['db'];function respondWithStatusCode(_0x997b24,_0x47e0a5){_0x47e0a5=_0x47e0a5||0xcc;return function(_0x20339c){if(_0x20339c){return _0x997b24[_0x609d('0x16')](_0x47e0a5);}return _0x997b24[_0x609d('0x17')](_0x47e0a5)['end']();};}function respondWithResult(_0x37b357,_0x13d48a){_0x13d48a=_0x13d48a||0xc8;return function(_0x43383f){if(_0x43383f){return _0x37b357[_0x609d('0x17')](_0x13d48a)[_0x609d('0x18')](_0x43383f);}};}function respondWithFilteredResult(_0x28cc9c,_0x26f386){return function(_0x420d13){if(_0x420d13){var _0x2c7d5a=typeof _0x26f386[_0x609d('0x19')]===_0x609d('0x1a')&&typeof _0x26f386[_0x609d('0x1b')]===_0x609d('0x1a');var _0x3c3ebc=_0x420d13[_0x609d('0x1c')];var _0x4d0bc5=_0x2c7d5a?0x0:_0x26f386[_0x609d('0x19')];var _0x1b174f=_0x2c7d5a?_0x420d13[_0x609d('0x1c')]:_0x26f386['offset']+_0x26f386[_0x609d('0x1b')];var _0x3ec5ea;if(_0x1b174f>=_0x3c3ebc){_0x1b174f=_0x3c3ebc;_0x3ec5ea=0xc8;}else{_0x3ec5ea=0xce;}_0x28cc9c[_0x609d('0x17')](_0x3ec5ea);return _0x28cc9c[_0x609d('0x1d')](_0x609d('0x1e'),_0x4d0bc5+'-'+_0x1b174f+'/'+_0x3c3ebc)[_0x609d('0x18')](_0x420d13);}return null;};}function patchUpdates(_0xf9a7e8){return function(_0x162d68){try{jsonpatch[_0x609d('0x1f')](_0x162d68,_0xf9a7e8,!![]);}catch(_0x123b2b){return BPromise[_0x609d('0x20')](_0x123b2b);}return _0x162d68[_0x609d('0x21')]();};}function saveUpdates(_0x154e31,_0x490f92){return function(_0x51eeb8){if(_0x51eeb8){return _0x51eeb8['update'](_0x154e31)[_0x609d('0x22')](function(_0x202077){return _0x202077;});}return null;};}function removeEntity(_0x470e9c,_0x398d0d){return function(_0xef0c53){if(_0xef0c53){return _0xef0c53[_0x609d('0x23')]()[_0x609d('0x22')](function(){_0x470e9c[_0x609d('0x17')](0xcc)[_0x609d('0x24')]();});}};}function handleEntityNotFound(_0x4ae7a3,_0x4a0a30){return function(_0x28cc0b){if(!_0x28cc0b){_0x4ae7a3[_0x609d('0x16')](0x194);}return _0x28cc0b;};}function handleError(_0x359c6b,_0x471703){_0x471703=_0x471703||0x1f4;return function(_0x22376b){logger[_0x609d('0x25')](_0x22376b['stack']);if(_0x22376b[_0x609d('0x26')]){delete _0x22376b[_0x609d('0x26')];}_0x359c6b[_0x609d('0x17')](_0x471703)[_0x609d('0x27')](_0x22376b);};}exports[_0x609d('0x28')]=function(_0x16b591,_0xc5fafc){var _0x2c8fdd={},_0x4971c2={},_0x229d9e={'count':0x0,'rows':[]};var _0x7d3092=_[_0x609d('0x29')](db[_0x609d('0x2a')]['rawAttributes'],function(_0x4082ba){return{'name':_0x4082ba[_0x609d('0x2b')],'type':_0x4082ba['type'][_0x609d('0x2c')]};});_0x4971c2[_0x609d('0x2d')]=_[_0x609d('0x29')](_0x7d3092,'name');_0x4971c2[_0x609d('0x2e')]=_[_0x609d('0x2f')](_0x16b591[_0x609d('0x2e')]);_0x4971c2[_0x609d('0x30')]=_[_0x609d('0x31')](_0x4971c2[_0x609d('0x2d')],_0x4971c2[_0x609d('0x2e')]);_0x2c8fdd[_0x609d('0x32')]=_[_0x609d('0x31')](_0x4971c2[_0x609d('0x2d')],qs[_0x609d('0x33')](_0x16b591[_0x609d('0x2e')][_0x609d('0x33')]));_0x2c8fdd[_0x609d('0x32')]=_0x2c8fdd[_0x609d('0x32')][_0x609d('0x34')]?_0x2c8fdd[_0x609d('0x32')]:_0x4971c2[_0x609d('0x2d')];if(!_0x16b591[_0x609d('0x2e')]['hasOwnProperty'](_0x609d('0x35'))){_0x2c8fdd[_0x609d('0x1b')]=qs[_0x609d('0x1b')](_0x16b591[_0x609d('0x2e')][_0x609d('0x1b')]);_0x2c8fdd[_0x609d('0x19')]=qs['offset'](_0x16b591['query'][_0x609d('0x19')]);}_0x2c8fdd['order']=qs[_0x609d('0x36')](_0x16b591[_0x609d('0x2e')][_0x609d('0x36')]);_0x2c8fdd[_0x609d('0x37')]=qs['filters'](_[_0x609d('0x38')](_0x16b591[_0x609d('0x2e')],_0x4971c2[_0x609d('0x30')]),_0x7d3092);if(_0x16b591[_0x609d('0x2e')][_0x609d('0x39')]){_0x2c8fdd[_0x609d('0x37')]=_['merge'](_0x2c8fdd[_0x609d('0x37')],{'$or':_[_0x609d('0x29')](_0x7d3092,function(_0x134718){if(_0x134718['type']!==_0x609d('0x3a')){var _0x4fdd88={};_0x4fdd88[_0x134718[_0x609d('0x26')]]={'$like':'%'+_0x16b591[_0x609d('0x2e')][_0x609d('0x39')]+'%'};return _0x4fdd88;}})});}_0x2c8fdd=_[_0x609d('0x3b')]({},_0x2c8fdd,_0x16b591[_0x609d('0x3c')]);var _0x232c71={'where':_0x2c8fdd[_0x609d('0x37')]};return db['WhatsappTransferReport'][_0x609d('0x1c')](_0x232c71)[_0x609d('0x22')](function(_0x134d62){_0x229d9e['count']=_0x134d62;if(_0x16b591[_0x609d('0x2e')][_0x609d('0x3d')]){_0x2c8fdd[_0x609d('0x3e')]=[{'all':!![]}];}return db[_0x609d('0x2a')][_0x609d('0x3f')](_0x2c8fdd);})[_0x609d('0x22')](function(_0x245623){_0x229d9e[_0x609d('0x40')]=_0x245623;return _0x229d9e;})[_0x609d('0x22')](respondWithFilteredResult(_0xc5fafc,_0x2c8fdd))[_0x609d('0x41')](handleError(_0xc5fafc,null));};exports[_0x609d('0x42')]=function(_0x1dfd5a,_0x37008e){var _0x295899={'raw':!![],'where':{'id':_0x1dfd5a[_0x609d('0x43')]['id']}},_0x384806={};_0x384806[_0x609d('0x2d')]=_[_0x609d('0x2f')](db['WhatsappTransferReport'][_0x609d('0x44')]);_0x384806[_0x609d('0x2e')]=_[_0x609d('0x2f')](_0x1dfd5a[_0x609d('0x2e')]);_0x384806[_0x609d('0x30')]=_[_0x609d('0x31')](_0x384806[_0x609d('0x2d')],_0x384806[_0x609d('0x2e')]);_0x295899[_0x609d('0x32')]=_[_0x609d('0x31')](_0x384806[_0x609d('0x2d')],qs[_0x609d('0x33')](_0x1dfd5a[_0x609d('0x2e')][_0x609d('0x33')]));_0x295899[_0x609d('0x32')]=_0x295899[_0x609d('0x32')]['length']?_0x295899[_0x609d('0x32')]:_0x384806[_0x609d('0x2d')];if(_0x1dfd5a['query'][_0x609d('0x3d')]){_0x295899[_0x609d('0x3e')]=[{'all':!![]}];}_0x295899=_[_0x609d('0x3b')]({},_0x295899,_0x1dfd5a[_0x609d('0x3c')]);return db[_0x609d('0x2a')]['find'](_0x295899)['then'](handleEntityNotFound(_0x37008e,null))[_0x609d('0x22')](respondWithResult(_0x37008e,null))[_0x609d('0x41')](handleError(_0x37008e,null));};exports['create']=function(_0xb01df1,_0x202cec){return db[_0x609d('0x2a')]['create'](_0xb01df1[_0x609d('0x45')],{})[_0x609d('0x22')](respondWithResult(_0x202cec,0xc9))['catch'](handleError(_0x202cec,null));};exports[_0x609d('0x46')]=function(_0x320879,_0x4b1a5b){if(_0x320879[_0x609d('0x45')]['id']){delete _0x320879[_0x609d('0x45')]['id'];}return db[_0x609d('0x2a')][_0x609d('0x47')]({'where':{'id':_0x320879[_0x609d('0x43')]['id']}})[_0x609d('0x22')](handleEntityNotFound(_0x4b1a5b,null))['then'](saveUpdates(_0x320879[_0x609d('0x45')],null))[_0x609d('0x22')](respondWithResult(_0x4b1a5b,null))['catch'](handleError(_0x4b1a5b,null));};exports[_0x609d('0x23')]=function(_0x50fa7d,_0x32de02){return db[_0x609d('0x2a')][_0x609d('0x47')]({'where':{'id':_0x50fa7d['params']['id']}})[_0x609d('0x22')](handleEntityNotFound(_0x32de02,null))[_0x609d('0x22')](removeEntity(_0x32de02,null))[_0x609d('0x41')](handleError(_0x32de02,null));};exports[_0x609d('0x48')]=function(_0x244573,_0x5ab8dc){return db[_0x609d('0x2a')][_0x609d('0x48')]()[_0x609d('0x22')](respondWithResult(_0x5ab8dc,null))[_0x609d('0x41')](handleError(_0x5ab8dc,null));}; \ No newline at end of file +var _0x7b5d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x4b17a7,_0x34de8c){var _0x39d3a8=function(_0x40fbbb){while(--_0x40fbbb){_0x4b17a7['push'](_0x4b17a7['shift']());}};_0x39d3a8(++_0x34de8c);}(_0x7b5d,0x1bd));var _0xd7b5=function(_0x427193,_0x2d1a74){_0x427193=_0x427193-0x0;var _0xac0d5a=_0x7b5d[_0x427193];return _0xac0d5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7b5('0x0'));var zipdir=require(_0xd7b5('0x1'));var jsonpatch=require(_0xd7b5('0x2'));var rp=require(_0xd7b5('0x3'));var moment=require(_0xd7b5('0x4'));var BPromise=require(_0xd7b5('0x5'));var Mustache=require(_0xd7b5('0x6'));var util=require(_0xd7b5('0x7'));var path=require('path');var sox=require(_0xd7b5('0x8'));var csv=require(_0xd7b5('0x9'));var ejs=require(_0xd7b5('0xa'));var fs=require('fs');var fs_extra=require(_0xd7b5('0xb'));var _=require(_0xd7b5('0xc'));var squel=require('squel');var crypto=require(_0xd7b5('0xd'));var jsforce=require(_0xd7b5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd7b5('0x9'));var querystring=require(_0xd7b5('0xf'));var Papa=require(_0xd7b5('0x10'));var Redis=require(_0xd7b5('0x11'));var authService=require(_0xd7b5('0x12'));var qs=require(_0xd7b5('0x13'));var as=require(_0xd7b5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7b5('0x15'))(_0xd7b5('0x16'));var utils=require('../../config/utils');var config=require(_0xd7b5('0x17'));var licenseUtil=require(_0xd7b5('0x18'));var db=require(_0xd7b5('0x19'))['db'];function respondWithStatusCode(_0xbe0e,_0x5602d0){_0x5602d0=_0x5602d0||0xcc;return function(_0x2e09f7){if(_0x2e09f7){return _0xbe0e[_0xd7b5('0x1a')](_0x5602d0);}return _0xbe0e['status'](_0x5602d0)[_0xd7b5('0x1b')]();};}function respondWithResult(_0x20a53f,_0x41b149){_0x41b149=_0x41b149||0xc8;return function(_0x27bad9){if(_0x27bad9){return _0x20a53f[_0xd7b5('0x1c')](_0x41b149)[_0xd7b5('0x1d')](_0x27bad9);}};}function respondWithFilteredResult(_0x270391,_0x402a15){return function(_0xf04d9c){if(_0xf04d9c){var _0x328dab=typeof _0x402a15['offset']==='undefined'&&typeof _0x402a15[_0xd7b5('0x1e')]===_0xd7b5('0x1f');var _0x518957=_0xf04d9c[_0xd7b5('0x20')];var _0x518947=_0x328dab?0x0:_0x402a15[_0xd7b5('0x21')];var _0x232655=_0x328dab?_0xf04d9c[_0xd7b5('0x20')]:_0x402a15[_0xd7b5('0x21')]+_0x402a15[_0xd7b5('0x1e')];var _0x4c8c70;if(_0x232655>=_0x518957){_0x232655=_0x518957;_0x4c8c70=0xc8;}else{_0x4c8c70=0xce;}_0x270391[_0xd7b5('0x1c')](_0x4c8c70);return _0x270391[_0xd7b5('0x22')]('Content-Range',_0x518947+'-'+_0x232655+'/'+_0x518957)['json'](_0xf04d9c);}return null;};}function patchUpdates(_0x25e9d6){return function(_0x4aa197){try{jsonpatch[_0xd7b5('0x23')](_0x4aa197,_0x25e9d6,!![]);}catch(_0x2d4019){return BPromise[_0xd7b5('0x24')](_0x2d4019);}return _0x4aa197[_0xd7b5('0x25')]();};}function saveUpdates(_0x5ab569,_0x271b4d){return function(_0x468d80){if(_0x468d80){return _0x468d80[_0xd7b5('0x26')](_0x5ab569)['then'](function(_0x4585fa){return _0x4585fa;});}return null;};}function removeEntity(_0x65584f,_0x122da4){return function(_0x36b9f0){if(_0x36b9f0){return _0x36b9f0['destroy']()[_0xd7b5('0x27')](function(){_0x65584f[_0xd7b5('0x1c')](0xcc)[_0xd7b5('0x1b')]();});}};}function handleEntityNotFound(_0x14a26b,_0x30d4be){return function(_0x188c9c){if(!_0x188c9c){_0x14a26b['sendStatus'](0x194);}return _0x188c9c;};}function handleError(_0x470535,_0x43d438){_0x43d438=_0x43d438||0x1f4;return function(_0xf3bd46){logger[_0xd7b5('0x28')](_0xf3bd46[_0xd7b5('0x29')]);if(_0xf3bd46[_0xd7b5('0x2a')]){delete _0xf3bd46[_0xd7b5('0x2a')];}_0x470535['status'](_0x43d438)[_0xd7b5('0x2b')](_0xf3bd46);};}exports[_0xd7b5('0x2c')]=function(_0x2bff40,_0xc23a64){var _0xc2451c={},_0x3110f8={},_0xc1e218={'count':0x0,'rows':[]};var _0x4e9188=_[_0xd7b5('0x2d')](db[_0xd7b5('0x2e')][_0xd7b5('0x2f')],function(_0x16dc75){return{'name':_0x16dc75['fieldName'],'type':_0x16dc75['type'][_0xd7b5('0x30')]};});_0x3110f8[_0xd7b5('0x31')]=_[_0xd7b5('0x2d')](_0x4e9188,_0xd7b5('0x2a'));_0x3110f8[_0xd7b5('0x32')]=_[_0xd7b5('0x33')](_0x2bff40[_0xd7b5('0x32')]);_0x3110f8[_0xd7b5('0x34')]=_['intersection'](_0x3110f8[_0xd7b5('0x31')],_0x3110f8['query']);_0xc2451c['attributes']=_[_0xd7b5('0x35')](_0x3110f8[_0xd7b5('0x31')],qs[_0xd7b5('0x36')](_0x2bff40['query'][_0xd7b5('0x36')]));_0xc2451c[_0xd7b5('0x37')]=_0xc2451c[_0xd7b5('0x37')][_0xd7b5('0x38')]?_0xc2451c['attributes']:_0x3110f8[_0xd7b5('0x31')];if(!_0x2bff40[_0xd7b5('0x32')]['hasOwnProperty'](_0xd7b5('0x39'))){_0xc2451c[_0xd7b5('0x1e')]=qs[_0xd7b5('0x1e')](_0x2bff40[_0xd7b5('0x32')][_0xd7b5('0x1e')]);_0xc2451c[_0xd7b5('0x21')]=qs['offset'](_0x2bff40[_0xd7b5('0x32')][_0xd7b5('0x21')]);}_0xc2451c[_0xd7b5('0x3a')]=qs[_0xd7b5('0x3b')](_0x2bff40['query'][_0xd7b5('0x3b')]);_0xc2451c[_0xd7b5('0x3c')]=qs[_0xd7b5('0x34')](_[_0xd7b5('0x3d')](_0x2bff40[_0xd7b5('0x32')],_0x3110f8[_0xd7b5('0x34')]),_0x4e9188);if(_0x2bff40[_0xd7b5('0x32')][_0xd7b5('0x3e')]){_0xc2451c[_0xd7b5('0x3c')]=_[_0xd7b5('0x3f')](_0xc2451c[_0xd7b5('0x3c')],{'$or':_[_0xd7b5('0x2d')](_0x4e9188,function(_0x439533){if(_0x439533['type']!==_0xd7b5('0x40')){var _0x3baa2b={};_0x3baa2b[_0x439533[_0xd7b5('0x2a')]]={'$like':'%'+_0x2bff40['query']['filter']+'%'};return _0x3baa2b;}})});}_0xc2451c=_[_0xd7b5('0x3f')]({},_0xc2451c,_0x2bff40[_0xd7b5('0x41')]);var _0x5720e5={'where':_0xc2451c[_0xd7b5('0x3c')]};return db['WhatsappTransferReport'][_0xd7b5('0x20')](_0x5720e5)[_0xd7b5('0x27')](function(_0x2b9866){_0xc1e218[_0xd7b5('0x20')]=_0x2b9866;if(_0x2bff40[_0xd7b5('0x32')]['includeAll']){_0xc2451c[_0xd7b5('0x42')]=[{'all':!![]}];}return db[_0xd7b5('0x2e')]['findAll'](_0xc2451c);})[_0xd7b5('0x27')](function(_0x967f60){_0xc1e218[_0xd7b5('0x43')]=_0x967f60;return _0xc1e218;})[_0xd7b5('0x27')](respondWithFilteredResult(_0xc23a64,_0xc2451c))[_0xd7b5('0x44')](handleError(_0xc23a64,null));};exports[_0xd7b5('0x45')]=function(_0x33389c,_0x3626fb){var _0x5b1103={'raw':!![],'where':{'id':_0x33389c['params']['id']}},_0x3b8516={};_0x3b8516['model']=_[_0xd7b5('0x33')](db['WhatsappTransferReport'][_0xd7b5('0x2f')]);_0x3b8516[_0xd7b5('0x32')]=_[_0xd7b5('0x33')](_0x33389c['query']);_0x3b8516['filters']=_[_0xd7b5('0x35')](_0x3b8516['model'],_0x3b8516['query']);_0x5b1103[_0xd7b5('0x37')]=_[_0xd7b5('0x35')](_0x3b8516[_0xd7b5('0x31')],qs['fields'](_0x33389c[_0xd7b5('0x32')][_0xd7b5('0x36')]));_0x5b1103['attributes']=_0x5b1103[_0xd7b5('0x37')][_0xd7b5('0x38')]?_0x5b1103[_0xd7b5('0x37')]:_0x3b8516['model'];if(_0x33389c[_0xd7b5('0x32')][_0xd7b5('0x46')]){_0x5b1103[_0xd7b5('0x42')]=[{'all':!![]}];}_0x5b1103=_['merge']({},_0x5b1103,_0x33389c['options']);return db[_0xd7b5('0x2e')]['find'](_0x5b1103)[_0xd7b5('0x27')](handleEntityNotFound(_0x3626fb,null))[_0xd7b5('0x27')](respondWithResult(_0x3626fb,null))[_0xd7b5('0x44')](handleError(_0x3626fb,null));};exports['create']=function(_0x447d23,_0x5418e5){return db['WhatsappTransferReport'][_0xd7b5('0x47')](_0x447d23[_0xd7b5('0x48')],{})[_0xd7b5('0x27')](respondWithResult(_0x5418e5,0xc9))['catch'](handleError(_0x5418e5,null));};exports['update']=function(_0x27d0b1,_0x337c0a){if(_0x27d0b1[_0xd7b5('0x48')]['id']){delete _0x27d0b1[_0xd7b5('0x48')]['id'];}return db[_0xd7b5('0x2e')][_0xd7b5('0x49')]({'where':{'id':_0x27d0b1[_0xd7b5('0x4a')]['id']}})[_0xd7b5('0x27')](handleEntityNotFound(_0x337c0a,null))[_0xd7b5('0x27')](saveUpdates(_0x27d0b1[_0xd7b5('0x48')],null))[_0xd7b5('0x27')](respondWithResult(_0x337c0a,null))[_0xd7b5('0x44')](handleError(_0x337c0a,null));};exports[_0xd7b5('0x4b')]=function(_0x6ea6de,_0xc9fc3e){return db['WhatsappTransferReport'][_0xd7b5('0x49')]({'where':{'id':_0x6ea6de[_0xd7b5('0x4a')]['id']}})[_0xd7b5('0x27')](handleEntityNotFound(_0xc9fc3e,null))[_0xd7b5('0x27')](removeEntity(_0xc9fc3e,null))[_0xd7b5('0x44')](handleError(_0xc9fc3e,null));};exports[_0xd7b5('0x4c')]=function(_0x238f4f,_0x561560){return db['WhatsappTransferReport'][_0xd7b5('0x4c')]()[_0xd7b5('0x27')](respondWithResult(_0x561560,null))[_0xd7b5('0x44')](handleError(_0x561560,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4186cc4..40d9f01 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 _0x03fd=['moment','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','util','../../config/logger'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x03fd,0xf8));var _0xd03f=function(_0x4361d4,_0x98006d){_0x4361d4=_0x4361d4-0x0;var _0x5ccf06=_0x03fd[_0x4361d4];return _0x5ccf06;};'use strict';var _=require('lodash');var util=require(_0xd03f('0x0'));var logger=require(_0xd03f('0x1'))('api');var moment=require(_0xd03f('0x2'));var BPromise=require('bluebird');var rp=require(_0xd03f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd03f('0x4'));var config=require('../../config/environment');var attributes=require(_0xd03f('0x5'));module[_0xd03f('0x6')]=function(_0x28c21d,_0x372f89){return _0x28c21d[_0xd03f('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0xd03f('0x8'),'paranoid':![],'indexes':[{'name':_0xd03f('0x9'),'fields':[_0xd03f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b53=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0b53,0x1e0));var _0x30b5=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x0b53[_0x874cf1];return _0x233579;};'use strict';var _=require('lodash');var util=require(_0x30b5('0x0'));var logger=require(_0x30b5('0x1'))('api');var moment=require(_0x30b5('0x2'));var BPromise=require(_0x30b5('0x3'));var rp=require(_0x30b5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x30b5('0x5'));var attributes=require(_0x30b5('0x6'));module[_0x30b5('0x7')]=function(_0x5dd405,_0x54f736){return _0x5dd405[_0x30b5('0x8')](_0x30b5('0x9'),attributes,{'tableName':_0x30b5('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x30b5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1d4ef3b..0a01c0b 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 _0x981c=['request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x183bce,_0x22929b){var _0x250364=function(_0x52fda8){while(--_0x52fda8){_0x183bce['push'](_0x183bce['shift']());}};_0x250364(++_0x22929b);}(_0x981c,0x11f));var _0xc981=function(_0x5479c5,_0x2df82d){_0x5479c5=_0x5479c5-0x0;var _0xae27a6=_0x981c[_0x5479c5];return _0xae27a6;};'use strict';var _=require(_0xc981('0x0'));var util=require(_0xc981('0x1'));var moment=require(_0xc981('0x2'));var BPromise=require(_0xc981('0x3'));var rs=require(_0xc981('0x4'));var fs=require('fs');var Redis=require(_0xc981('0x5'));var db=require(_0xc981('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc981('0x7'));var client=jayson[_0xc981('0x8')][_0xc981('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9e5600,_0x471f44,_0x1dac07){return new BPromise(function(_0x5316dd,_0x1a3e64){return client[_0xc981('0xa')](_0x9e5600,_0x1dac07)[_0xc981('0xb')](function(_0x2224ed){logger['info'](_0xc981('0xc'),_0x471f44,_0xc981('0xd'));logger['debug'](_0xc981('0xe'),_0x471f44,_0xc981('0xd'),JSON['stringify'](_0x2224ed));if(_0x2224ed['error']){if(_0x2224ed[_0xc981('0xf')][_0xc981('0x10')]===0x1f4){logger[_0xc981('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x471f44,_0x2224ed[_0xc981('0xf')][_0xc981('0x11')]);return _0x1a3e64(_0x2224ed[_0xc981('0xf')][_0xc981('0x11')]);}logger[_0xc981('0xf')](_0xc981('0xc'),_0x471f44,_0x2224ed[_0xc981('0xf')][_0xc981('0x11')]);return _0x5316dd(_0x2224ed['error'][_0xc981('0x11')]);}else{logger['info'](_0xc981('0xc'),_0x471f44,'request\x20sent');_0x5316dd(_0x2224ed[_0xc981('0x12')]['message']);}})[_0xc981('0x13')](function(_0x5d4841){logger[_0xc981('0xf')](_0xc981('0xc'),_0x471f44,_0x5d4841);_0x1a3e64(_0x5d4841);});});} \ No newline at end of file +var _0x3fa8=['WhatsappTransferReport,\x20%s,\x20%s','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3cff61,_0x59132c){var _0x18cd71=function(_0x2e7266){while(--_0x2e7266){_0x3cff61['push'](_0x3cff61['shift']());}};_0x18cd71(++_0x59132c);}(_0x3fa8,0x145));var _0x83fa=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x3fa8[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x83fa('0x0'));var moment=require(_0x83fa('0x1'));var BPromise=require(_0x83fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83fa('0x3'));var db=require(_0x83fa('0x4'))['db'];var utils=require(_0x83fa('0x5'));var logger=require(_0x83fa('0x6'))(_0x83fa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x83fa('0x8')][_0x83fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x440426,_0x3218f7,_0xe2273){return new BPromise(function(_0x384c16,_0x581dfb){return client[_0x83fa('0xa')](_0x440426,_0xe2273)['then'](function(_0x2fdfe5){logger[_0x83fa('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3218f7,_0x83fa('0xc'));logger['debug'](_0x83fa('0xd'),_0x3218f7,_0x83fa('0xc'),JSON[_0x83fa('0xe')](_0x2fdfe5));if(_0x2fdfe5['error']){if(_0x2fdfe5[_0x83fa('0xf')]['code']===0x1f4){logger[_0x83fa('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3218f7,_0x2fdfe5[_0x83fa('0xf')][_0x83fa('0x10')]);return _0x581dfb(_0x2fdfe5[_0x83fa('0xf')][_0x83fa('0x10')]);}logger['error'](_0x83fa('0x11'),_0x3218f7,_0x2fdfe5['error'][_0x83fa('0x10')]);return _0x384c16(_0x2fdfe5[_0x83fa('0xf')][_0x83fa('0x10')]);}else{logger[_0x83fa('0xb')](_0x83fa('0x11'),_0x3218f7,_0x83fa('0xc'));_0x384c16(_0x2fdfe5[_0x83fa('0x12')][_0x83fa('0x10')]);}})['catch'](function(_0x2551ff){logger[_0x83fa('0xf')](_0x83fa('0x11'),_0x3218f7,_0x2551ff);_0x581dfb(_0x2551ff);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index f8c8e18..3fc96b4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd072=['error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0xbed58e,_0x3a1272){var _0x295e44=function(_0x45755a){while(--_0x45755a){_0xbed58e['push'](_0xbed58e['shift']());}};_0x295e44(++_0x3a1272);}(_0xd072,0x132));var _0x2d07=function(_0x344e8e,_0x1b418c){_0x344e8e=_0x344e8e-0x0;var _0x31fe6e=_0xd072[_0x344e8e];return _0x31fe6e;};'use strict';var _=require(_0x2d07('0x0'));var db=require(_0x2d07('0x1'))['db'];var seedDb=require(_0x2d07('0x2'));var checkLicense=require(_0x2d07('0x3'));var rpc=require(_0x2d07('0x4'));var config=require(_0x2d07('0x5'));var logger=require(_0x2d07('0x6'))('app');var pm2=require(_0x2d07('0x7'));var pm2Config=require(_0x2d07('0x8'));var schedule=require(_0x2d07('0x9'));var chat=require(_0x2d07('0xa'));var whatsapp=require(_0x2d07('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x2d07('0xc'));function main(){return db[_0x2d07('0xd')][_0x2d07('0xe')]()[_0x2d07('0xf')](function(){if(config[_0x2d07('0x10')]){return seedDb[_0x2d07('0x11')]();}})[_0x2d07('0xf')](function(){return checkLicense['default']();})[_0x2d07('0xf')](function(){return rpc[_0x2d07('0x12')]();})[_0x2d07('0xf')](function(_0x46ddb1){logger[_0x2d07('0x13')](_0x46ddb1);return chat[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return whatsapp[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return schedule[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return transcribe[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(){return provider[_0x2d07('0x14')]();})[_0x2d07('0xf')](function(_0x380fd4){logger[_0x2d07('0x13')](_0x380fd4);return pm2[_0x2d07('0x14')](pm2Config);})[_0x2d07('0xf')](function(_0x3fbab2){var _0x28cbb3=_0x3fbab2[_0x2d07('0x15')](function(_0x2daa2b){return typeof _0x2daa2b[_0x2d07('0x16')]===_0x2d07('0x17')&&_0x2daa2b['exitCode']>=0x0;});if(_0x28cbb3[_0x2d07('0x18')]>0x0){throw new Error(_0x28cbb3[_0x2d07('0x18')]+_0x2d07('0x19')+_[_0x2d07('0x1a')](_0x28cbb3,function(_0x2b8884){return'\x22'+_0x2b8884[_0x2d07('0x1b')][_0x2d07('0x1c')]+'\x22';}));}logger[_0x2d07('0x13')]('Online\x20apps:',_[_0x2d07('0x1a')](_[_0x2d07('0x15')](_0x3fbab2,{'status':_0x2d07('0x1d')}),_0x2d07('0x1c'))['join']());logger[_0x2d07('0x13')](_0x2d07('0x1e'),_[_0x2d07('0x1a')](_[_0x2d07('0x15')](_0x3fbab2,function(_0x165d7f){return _0x165d7f[_0x2d07('0x1f')]!==_0x2d07('0x1d');}),_0x2d07('0x1c'))['join']()||_0x2d07('0x20'));console[_0x2d07('0x21')](_0x2d07('0x22'));})['catch'](function(_0x7a489){console['log'](_0x2d07('0x23'),_0x7a489);logger[_0x2d07('0x24')](_0x2d07('0x25'),_0x7a489);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x5e0c=['filter','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','seedDB','default','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:'];(function(_0x780407,_0x400a54){var _0x35b309=function(_0x6011b0){while(--_0x6011b0){_0x780407['push'](_0x780407['shift']());}};_0x35b309(++_0x400a54);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x5335ea,_0x2a612d){_0x5335ea=_0x5335ea-0x0;var _0x40a7da=_0x5e0c[_0x5335ea];return _0x40a7da;};'use strict';var _=require('lodash');var db=require(_0xc5e0('0x0'))['db'];var seedDb=require(_0xc5e0('0x1'));var checkLicense=require(_0xc5e0('0x2'));var rpc=require(_0xc5e0('0x3'));var config=require(_0xc5e0('0x4'));var logger=require(_0xc5e0('0x5'))('app');var pm2=require(_0xc5e0('0x6'));var pm2Config=require(_0xc5e0('0x7'));var schedule=require(_0xc5e0('0x8'));var chat=require(_0xc5e0('0x9'));var whatsapp=require(_0xc5e0('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc5e0('0xb')]['sync']()[_0xc5e0('0xc')](function(){if(config[_0xc5e0('0xd')]){return seedDb[_0xc5e0('0xe')]();}})[_0xc5e0('0xc')](function(){return checkLicense['default']();})[_0xc5e0('0xc')](function(){return rpc['listen']();})[_0xc5e0('0xc')](function(_0x33d821){logger[_0xc5e0('0xf')](_0x33d821);return chat[_0xc5e0('0x10')]();})[_0xc5e0('0xc')](function(){return whatsapp[_0xc5e0('0x10')]();})['then'](function(){return schedule[_0xc5e0('0x10')]();})[_0xc5e0('0xc')](function(){return transcribe[_0xc5e0('0x10')]();})[_0xc5e0('0xc')](function(){return provider[_0xc5e0('0x10')]();})['then'](function(_0x3d0503){logger[_0xc5e0('0xf')](_0x3d0503);return pm2['start'](pm2Config);})['then'](function(_0x2fa026){var _0x481453=_0x2fa026['filter'](function(_0xcf0eba){return typeof _0xcf0eba[_0xc5e0('0x11')]===_0xc5e0('0x12')&&_0xcf0eba[_0xc5e0('0x11')]>=0x0;});if(_0x481453[_0xc5e0('0x13')]>0x0){throw new Error(_0x481453[_0xc5e0('0x13')]+_0xc5e0('0x14')+_[_0xc5e0('0x15')](_0x481453,function(_0x21bb3e){return'\x22'+_0x21bb3e[_0xc5e0('0x16')][_0xc5e0('0x17')]+'\x22';}));}logger[_0xc5e0('0xf')](_0xc5e0('0x18'),_[_0xc5e0('0x15')](_['filter'](_0x2fa026,{'status':'online'}),_0xc5e0('0x17'))[_0xc5e0('0x19')]());logger[_0xc5e0('0xf')](_0xc5e0('0x1a'),_[_0xc5e0('0x15')](_[_0xc5e0('0x1b')](_0x2fa026,function(_0x4a07e8){return _0x4a07e8['status']!=='online';}),_0xc5e0('0x17'))['join']()||_0xc5e0('0x1c'));console[_0xc5e0('0x1d')](_0xc5e0('0x1e'));})[_0xc5e0('0x1f')](function(_0x3edaea){console[_0xc5e0('0x1d')](_0xc5e0('0x20'),_0x3edaea);logger['error'](_0xc5e0('0x21'),_0x3edaea);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 5f18522..43648ac 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x6b0d54,_0x4e6b1e){var _0x5b31ae=function(_0x91b3c0){while(--_0x91b3c0){_0x6b0d54['push'](_0x6b0d54['shift']());}};_0x5b31ae(++_0x4e6b1e);}(_0x55ca,0x126));var _0xa55c=function(_0x5aada8,_0x460a35){_0x5aada8=_0x5aada8-0x0;var _0xf5247e=_0x55ca[_0x5aada8];return _0xf5247e;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0x5d71c2,_0x166413){var _0x44d4b1=function(_0x37c07b){while(--_0x37c07b){_0x5d71c2['push'](_0x5d71c2['shift']());}};_0x44d4b1(++_0x166413);}(_0x3e74,0x175));var _0x43e7=function(_0x31b808,_0x55a6aa){_0x31b808=_0x31b808-0x0;var _0x4d4ba7=_0x3e74[_0x31b808];return _0x4d4ba7;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4ab480b..088b9d3 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 _0x2300=['createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','write','end','final','binary','close','unlink','decryptFile','createReadStream'];(function(_0x3198fd,_0x3729d8){var _0x2dd0b=function(_0x94b525){while(--_0x94b525){_0x3198fd['push'](_0x3198fd['shift']());}};_0x2dd0b(++_0x3729d8);}(_0x2300,0x102));var _0x0230=function(_0xc7ba1a,_0xd7c660){_0xc7ba1a=_0xc7ba1a-0x0;var _0x3d262b=_0x2300[_0xc7ba1a];return _0x3d262b;};'use strict';var crypto=require(_0x0230('0x0'));var fs=require('fs');var BPromise=require(_0x0230('0x1'));var _=require(_0x0230('0x2'));var config=require(_0x0230('0x3'));var logger=require(_0x0230('0x4'))(_0x0230('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0230('0x6')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x0230('0x7')};if(config[_0x0230('0x8')]&&config[_0x0230('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x0230('0x8')][_0x0230('0x9')]);if(isSupported){fileOptions[_0x0230('0x9')]=config[_0x0230('0x8')][_0x0230('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0230('0xa')](',\x20');logger[_0x0230('0xb')](config['encrypt']['algorithm'],_0x0230('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3a78){return AES_SUPPORTED_RX['test'](_0x3a78);}function getSupportedCiphers(){return crypto[_0x0230('0xd')]()[_0x0230('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x3966db){return getSupportedCiphers()[_0x0230('0xf')](_0x3966db)>-0x1;}function combineOptions(_0x48b230){var _0x25f196={};for(var _0x4e7d88 in fileOptions){if(fileOptions[_0x0230('0x10')](_0x4e7d88)){_0x25f196[_0x4e7d88]=fileOptions[_0x4e7d88];}}if(_0x48b230){for(var _0x1d5f59 in _0x48b230){if(_0x48b230[_0x0230('0x10')](_0x1d5f59)){_0x25f196[_0x1d5f59]=_0x48b230[_0x1d5f59];}}}return _0x25f196;}exports[_0x0230('0x11')]=function(_0x3f6cb3,_0x2e6b3a,_0x19c694,_0x49569c){return new BPromise(function(_0x4114af,_0xe81176){_0x49569c=combineOptions(_0x49569c);var _0x5b0fd3=new Buffer(_0x19c694);var _0x23c512=fs['createReadStream'](_0x3f6cb3);var _0x2ea292=fs[_0x0230('0x12')](_0x2e6b3a);var _0x9ad352=crypto[_0x0230('0x13')](_0x49569c[_0x0230('0x9')],_0x5b0fd3);_0x23c512['on'](_0x0230('0x14'),function(_0x3b4b1a){var _0x227049=new Buffer(_0x9ad352[_0x0230('0x15')](_0x3b4b1a),'binary');_0x2ea292[_0x0230('0x16')](_0x227049);});_0x23c512['on'](_0x0230('0x17'),function(){try{var _0x19a153=new Buffer(_0x9ad352[_0x0230('0x18')](_0x0230('0x19')),_0x0230('0x19'));_0x2ea292[_0x0230('0x16')](_0x19a153);_0x2ea292[_0x0230('0x17')]();_0x2ea292['on'](_0x0230('0x1a'),function(){return _0x4114af(_0x2e6b3a);});}catch(_0x1d504e){fs[_0x0230('0x1b')](_0x2e6b3a);return _0xe81176(_0x1d504e);}});});};exports[_0x0230('0x1c')]=function(_0x4a36f9,_0x197cf8,_0x2d50e9,_0x17b923){return new BPromise(function(_0x31b3f5,_0x1d197c){_0x17b923=combineOptions(_0x17b923);var _0x48194a=new Buffer(_0x2d50e9);var _0x363164=fs[_0x0230('0x1d')](_0x4a36f9);var _0x7e0fa7=fs['createWriteStream'](_0x197cf8);var _0x5e8245=crypto[_0x0230('0x1e')](_0x17b923[_0x0230('0x9')],_0x48194a);_0x363164['on'](_0x0230('0x14'),function(_0x3d4dc6){var _0x20f4cf=new Buffer(_0x5e8245[_0x0230('0x15')](_0x3d4dc6),'binary');_0x7e0fa7['write'](_0x20f4cf);});_0x363164['on'](_0x0230('0x17'),function(){try{var _0xffe9e5=new Buffer(_0x5e8245[_0x0230('0x18')]('binary'),_0x0230('0x19'));_0x7e0fa7[_0x0230('0x16')](_0xffe9e5);_0x7e0fa7['end']();_0x7e0fa7['on'](_0x0230('0x1a'),function(){return _0x31b3f5(_0x197cf8);});}catch(_0x10951e){fs[_0x0230('0x1b')](_0x197cf8);return _0x1d197c(_0x10951e);}});});};exports[_0x0230('0x1f')]=function(_0x6ba124,_0x49efeb,_0x361dca){var _0x33b2a4=_0x361dca||stringOptions['algorithm'];var _0x1c2760=_0x49efeb||stringOptions[_0x0230('0x20')];var _0x111635=crypto[_0x0230('0x13')](_0x33b2a4,_0x1c2760);var _0x444aaa=_0x111635[_0x0230('0x15')](_0x6ba124,_0x0230('0x21'),_0x0230('0x22'));_0x444aaa+=_0x111635['final'](_0x0230('0x22'));return _0x444aaa;};exports[_0x0230('0x23')]=function(_0x4fd7a4,_0x4ece50,_0x14653f){var _0x38153c=_0x14653f||stringOptions[_0x0230('0x9')];var _0x4c6560=_0x4ece50||stringOptions[_0x0230('0x20')];var _0x3853a2=crypto[_0x0230('0x1e')](_0x38153c,_0x4c6560);var _0x1222e7=_0x3853a2[_0x0230('0x15')](_0x4fd7a4,'base64',_0x0230('0x21'));_0x1222e7+=_0x3853a2[_0x0230('0x18')]('utf8');return _0x1222e7;}; \ No newline at end of file +var _0xd758=['indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','write','end','final','close','decryptFile','createReadStream','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers'];(function(_0x3e67b4,_0x32a4d3){var _0x30aa12=function(_0x24e9f7){while(--_0x24e9f7){_0x3e67b4['push'](_0x3e67b4['shift']());}};_0x30aa12(++_0x32a4d3);}(_0xd758,0x1ce));var _0x8d75=function(_0x2ac790,_0x1efa9f){_0x2ac790=_0x2ac790-0x0;var _0x147c97=_0xd758[_0x2ac790];return _0x147c97;};'use strict';var crypto=require(_0x8d75('0x0'));var fs=require('fs');var BPromise=require(_0x8d75('0x1'));var _=require(_0x8d75('0x2'));var config=require(_0x8d75('0x3'));var logger=require(_0x8d75('0x4'))(_0x8d75('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8d75('0x6')]['session'],'algorithm':_0x8d75('0x7')};const fileOptions={'algorithm':_0x8d75('0x8')};if(config[_0x8d75('0x9')]&&config[_0x8d75('0x9')][_0x8d75('0xa')]){var isSupported=isAlgorithmSupported(config[_0x8d75('0x9')][_0x8d75('0xa')]);if(isSupported){fileOptions[_0x8d75('0xa')]=config['encrypt'][_0x8d75('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt'][_0x8d75('0xa')],_0x8d75('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x324291){return AES_SUPPORTED_RX[_0x8d75('0xc')](_0x324291);}function getSupportedCiphers(){return crypto[_0x8d75('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2569d2){return getSupportedCiphers()[_0x8d75('0xe')](_0x2569d2)>-0x1;}function combineOptions(_0x34f241){var _0x31e4ff={};for(var _0x481941 in fileOptions){if(fileOptions[_0x8d75('0xf')](_0x481941)){_0x31e4ff[_0x481941]=fileOptions[_0x481941];}}if(_0x34f241){for(var _0x2e7cb3 in _0x34f241){if(_0x34f241[_0x8d75('0xf')](_0x2e7cb3)){_0x31e4ff[_0x2e7cb3]=_0x34f241[_0x2e7cb3];}}}return _0x31e4ff;}exports[_0x8d75('0x10')]=function(_0x2ca5cb,_0x468bfb,_0x56b28c,_0x12481b){return new BPromise(function(_0x30b1f9,_0x3e5f1b){_0x12481b=combineOptions(_0x12481b);var _0x110e4b=new Buffer(_0x56b28c);var _0x32a6c1=fs['createReadStream'](_0x2ca5cb);var _0x5c5f43=fs[_0x8d75('0x11')](_0x468bfb);var _0x1ce6ee=crypto[_0x8d75('0x12')](_0x12481b[_0x8d75('0xa')],_0x110e4b);_0x32a6c1['on']('data',function(_0x3024c8){var _0x152ebd=new Buffer(_0x1ce6ee[_0x8d75('0x13')](_0x3024c8),_0x8d75('0x14'));_0x5c5f43[_0x8d75('0x15')](_0x152ebd);});_0x32a6c1['on'](_0x8d75('0x16'),function(){try{var _0x3d555c=new Buffer(_0x1ce6ee[_0x8d75('0x17')]('binary'),_0x8d75('0x14'));_0x5c5f43[_0x8d75('0x15')](_0x3d555c);_0x5c5f43[_0x8d75('0x16')]();_0x5c5f43['on'](_0x8d75('0x18'),function(){return _0x30b1f9(_0x468bfb);});}catch(_0xbc473b){fs['unlink'](_0x468bfb);return _0x3e5f1b(_0xbc473b);}});});};exports[_0x8d75('0x19')]=function(_0x28e310,_0x2494e1,_0x1b7230,_0x5e32e7){return new BPromise(function(_0x1895d0,_0x5f015a){_0x5e32e7=combineOptions(_0x5e32e7);var _0x2b7497=new Buffer(_0x1b7230);var _0x5aac21=fs[_0x8d75('0x1a')](_0x28e310);var _0xbdec17=fs[_0x8d75('0x11')](_0x2494e1);var _0x233112=crypto[_0x8d75('0x1b')](_0x5e32e7['algorithm'],_0x2b7497);_0x5aac21['on'](_0x8d75('0x1c'),function(_0x4b0a3a){var _0x89c8c3=new Buffer(_0x233112[_0x8d75('0x13')](_0x4b0a3a),'binary');_0xbdec17[_0x8d75('0x15')](_0x89c8c3);});_0x5aac21['on'](_0x8d75('0x16'),function(){try{var _0x17df6e=new Buffer(_0x233112[_0x8d75('0x17')]('binary'),_0x8d75('0x14'));_0xbdec17[_0x8d75('0x15')](_0x17df6e);_0xbdec17[_0x8d75('0x16')]();_0xbdec17['on']('close',function(){return _0x1895d0(_0x2494e1);});}catch(_0x125afd){fs['unlink'](_0x2494e1);return _0x5f015a(_0x125afd);}});});};exports[_0x8d75('0x1d')]=function(_0x48af43,_0x1d6667,_0x60841){var _0x12fd9a=_0x60841||stringOptions[_0x8d75('0xa')];var _0x5cc19b=_0x1d6667||stringOptions[_0x8d75('0x1e')];var _0xe1cf61=crypto['createCipher'](_0x12fd9a,_0x5cc19b);var _0xc2c8a4=_0xe1cf61[_0x8d75('0x13')](_0x48af43,_0x8d75('0x1f'),_0x8d75('0x20'));_0xc2c8a4+=_0xe1cf61[_0x8d75('0x17')](_0x8d75('0x20'));return _0xc2c8a4;};exports[_0x8d75('0x21')]=function(_0xa13f3a,_0x5604c4,_0x4dd13e){var _0x16d47c=_0x4dd13e||stringOptions[_0x8d75('0xa')];var _0xbf516f=_0x5604c4||stringOptions[_0x8d75('0x1e')];var _0x1823e5=crypto[_0x8d75('0x1b')](_0x16d47c,_0xbf516f);var _0x2f4c8d=_0x1823e5[_0x8d75('0x13')](_0xa13f3a,_0x8d75('0x20'),_0x8d75('0x1f'));_0x2f4c8d+=_0x1823e5['final']('utf8');return _0x2f4c8d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a2550d4..55dc193 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 _0x2487=['Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0xaf9b2b,_0xfd7645){var _0x476479=function(_0x1c2150){while(--_0x1c2150){_0xaf9b2b['push'](_0xaf9b2b['shift']());}};_0x476479(++_0xfd7645);}(_0x2487,0x102));var _0x7248=function(_0x342fb3,_0x5add0e){_0x342fb3=_0x342fb3-0x0;var _0x25453b=_0x2487[_0x342fb3];return _0x25453b;};'use strict';var util=require('util');var path=require(_0x7248('0x0'));var _=require(_0x7248('0x1'));var csv=require(_0x7248('0x2'));var fs=require('fs');var BPromise=require(_0x7248('0x3'));var zipdir=require(_0x7248('0x4'));var rimraf=require(_0x7248('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7248('0x6'))[_0x7248('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7248('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc522d,_0x3fb57b){var _0x586cf3={'status':_0xc522d};var _0x845532={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3fb57b){_0x586cf3[_0x7248('0x9')]=_0x3fb57b;}return db[_0x7248('0xa')][_0x7248('0xb')](_0x586cf3,_0x845532);}function main(){var _0x1ab3a8=0x1388;var _0x38fe4e;logger[_0x7248('0xc')](util[_0x7248('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7248('0xe')));return db[_0x7248('0xf')][_0x7248('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x7248('0x11')]})[_0x7248('0x12')](function(_0xaede03){if(_0xaede03){_0x38fe4e=_0xaede03;_0x1ab3a8=_0x38fe4e['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x7248('0x13')][_0x7248('0x14')](util[_0x7248('0xd')](_0x7248('0x15'),QUERY),{'type':dbH['sequelize'][_0x7248('0x16')]['SELECT']});})[_0x7248('0x12')](function(_0x3f1723){if(!_0x3f1723[0x0][_0x7248('0x17')]){return analyticExtractedReport(_0x7248('0x18'));}var _0x36c950=[];var _0x325a20=0x0;if(_0x38fe4e[_0x7248('0x19')]){if(_0x3f1723&&_0x3f1723[_0x7248('0x1a')]){var _0x2f863c=_[_0x7248('0x1b')](_0x3f1723[0x0][_0x7248('0x17')]/_0x1ab3a8);var _0x10b593=Number[_0x7248('0x1c')](_0x3f1723[0x0]['num']/_0x1ab3a8)?_0x3f1723[0x0][_0x7248('0x17')]%_0x1ab3a8:0x0;_0x2f863c['forEach'](function(_0x257dd3){if(_0x257dd3>0x0){_0x325a20+=_0x1ab3a8;}_0x36c950['push'](dbH['sequelize'][_0x7248('0x14')](util[_0x7248('0xd')](_0x7248('0x1d'),QUERY,_0x1ab3a8,_0x325a20),{'type':dbH[_0x7248('0x13')][_0x7248('0x16')][_0x7248('0x1e')]}));});if(_0x10b593>0x0){_0x325a20+=_0x1ab3a8;_0x36c950[_0x7248('0x1f')](dbH[_0x7248('0x13')]['query'](util['format'](_0x7248('0x1d'),QUERY,_0x10b593,_0x325a20),{'type':dbH[_0x7248('0x13')][_0x7248('0x16')][_0x7248('0x1e')]}));}}}else{_0x36c950[_0x7248('0x1f')](dbH[_0x7248('0x13')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x7248('0x1e')]}));}var _0x2cbdc3=path[_0x7248('0x20')](PATH);var _0x349b5e=path[_0x7248('0x21')](PATH,_0x7248('0x22'));var _0x2beb19=_0x38fe4e[_0x7248('0x19')]&&_0x36c950[_0x7248('0x1a')]>0x1;var _0xada82d=[];if(!fs[_0x7248('0x23')](path[_0x7248('0x24')](_0x2cbdc3,_0x349b5e))&&_0x2beb19){fs[_0x7248('0x25')](path[_0x7248('0x24')](_0x2cbdc3,_0x349b5e));}return BPromise['each'](_0x36c950,function(_0x21cc14){_0xada82d['push'](_0x21cc14);})[_0x7248('0x12')](function(){for(var _0x1260d5=0x0;_0x1260d5<_0xada82d[_0x7248('0x1a')];_0x1260d5+=0x1){var _0x52c73e;var _0x23eb13=_0xada82d[_0x1260d5];if(_0x2beb19){_0x52c73e=path[_0x7248('0x24')](_0x2cbdc3,_0x349b5e,util[_0x7248('0xd')](_0x7248('0x26'),_0x349b5e,_0x1260d5,'csv'));}else{_0x52c73e=path['join'](_0x2cbdc3,util['format'](_0x7248('0x27'),_0x349b5e,'csv'));}fs[_0x7248('0x28')](_0x52c73e,csv(_0x23eb13));}})[_0x7248('0x12')](function(){if(_0x2beb19){return new Promise(function(_0x48fd41){zipdir(path[_0x7248('0x24')](_0x2cbdc3,_0x349b5e),{'saveTo':path[_0x7248('0x24')](_0x2cbdc3,util[_0x7248('0xd')](_0x7248('0x27'),_0x349b5e,_0x7248('0x29')))},function(_0x4d7813,_0x1ea658){rimraf(path[_0x7248('0x24')](_0x2cbdc3,_0x349b5e),function(){});_0x48fd41(_0x7248('0x2a'));});});}})[_0x7248('0x12')](function(){logger[_0x7248('0xc')](util[_0x7248('0xd')](_0x7248('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x7248('0x2c'),_0x2beb19?util[_0x7248('0xd')](_0x7248('0x27'),_0x349b5e,_0x2beb19?_0x7248('0x29'):_0x7248('0x2d')):null);});})['catch'](function(_0x505b3c){logger[_0x7248('0xc')](util['format'](_0x7248('0x2e'),EXTRACTED_REPORT_ID,_0x7248('0xe')),util[_0x7248('0x2f')](_0x505b3c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7248('0x30'));})[_0x7248('0x31')](function(){process[_0x7248('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9725=['length','range','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.csv','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9725,0x11b));var _0x5972=function(_0x2baf63,_0x507b96){_0x2baf63=_0x2baf63-0x0;var _0x2de877=_0x9725[_0x2baf63];return _0x2de877;};'use strict';var util=require('util');var path=require(_0x5972('0x0'));var _=require(_0x5972('0x1'));var csv=require(_0x5972('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x5972('0x3'));var rimraf=require(_0x5972('0x4'));var db=require(_0x5972('0x5'))['db'];var dbH=require('../../mysqldb')[_0x5972('0x6')];var logger=require(_0x5972('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5972('0x8')][0x2]);var QUERY=process[_0x5972('0x8')][0x3];var PATH=process[_0x5972('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4213af,_0x244549){var _0x26e3d2={'status':_0x4213af};var _0x403b84={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x244549){_0x26e3d2[_0x5972('0x9')]=_0x244549;}return db['AnalyticExtractedReport'][_0x5972('0xa')](_0x26e3d2,_0x403b84);}function main(){var _0xc76daa=0x1388;var _0x2d0541;logger[_0x5972('0xb')](util[_0x5972('0xc')](_0x5972('0xd'),EXTRACTED_REPORT_ID,_0x5972('0xe')));return db[_0x5972('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5972('0x10'),_0x5972('0x11')]})[_0x5972('0x12')](function(_0x3cdb42){if(_0x3cdb42){_0x2d0541=_0x3cdb42;_0xc76daa=_0x2d0541[_0x5972('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x5972('0x13')](util[_0x5972('0xc')](_0x5972('0x14'),QUERY),{'type':dbH[_0x5972('0x15')][_0x5972('0x16')][_0x5972('0x17')]});})[_0x5972('0x12')](function(_0x380404){if(!_0x380404[0x0][_0x5972('0x18')]){return analyticExtractedReport('Empty');}var _0x1934e2=[];var _0x29f4f3=0x0;if(_0x2d0541['split']){if(_0x380404&&_0x380404[_0x5972('0x19')]){var _0x1d1658=_[_0x5972('0x1a')](_0x380404[0x0][_0x5972('0x18')]/_0xc76daa);var _0x19d9a1=Number['isInteger'](_0x380404[0x0][_0x5972('0x18')]/_0xc76daa)?_0x380404[0x0][_0x5972('0x18')]%_0xc76daa:0x0;_0x1d1658['forEach'](function(_0x1faa66){if(_0x1faa66>0x0){_0x29f4f3+=_0xc76daa;}_0x1934e2['push'](dbH[_0x5972('0x15')]['query'](util[_0x5972('0xc')](_0x5972('0x1b'),QUERY,_0xc76daa,_0x29f4f3),{'type':dbH['sequelize'][_0x5972('0x16')]['SELECT']}));});if(_0x19d9a1>0x0){_0x29f4f3+=_0xc76daa;_0x1934e2[_0x5972('0x1c')](dbH[_0x5972('0x15')][_0x5972('0x13')](util[_0x5972('0xc')](_0x5972('0x1b'),QUERY,_0x19d9a1,_0x29f4f3),{'type':dbH[_0x5972('0x15')][_0x5972('0x16')][_0x5972('0x17')]}));}}}else{_0x1934e2[_0x5972('0x1c')](dbH[_0x5972('0x15')]['query'](QUERY,{'type':dbH[_0x5972('0x15')][_0x5972('0x16')][_0x5972('0x17')]}));}var _0x493f2e=path['dirname'](PATH);var _0x28b70b=path[_0x5972('0x1d')](PATH,_0x5972('0x1e'));var _0x166661=_0x2d0541[_0x5972('0x10')]&&_0x1934e2['length']>0x1;var _0x39e3e6=[];if(!fs['existsSync'](path[_0x5972('0x1f')](_0x493f2e,_0x28b70b))&&_0x166661){fs[_0x5972('0x20')](path[_0x5972('0x1f')](_0x493f2e,_0x28b70b));}return BPromise[_0x5972('0x21')](_0x1934e2,function(_0xc5003a){_0x39e3e6[_0x5972('0x1c')](_0xc5003a);})[_0x5972('0x12')](function(){for(var _0xf0dbce=0x0;_0xf0dbce<_0x39e3e6[_0x5972('0x19')];_0xf0dbce+=0x1){var _0x1921a8;var _0x20ccff=_0x39e3e6[_0xf0dbce];if(_0x166661){_0x1921a8=path['join'](_0x493f2e,_0x28b70b,util['format']('%s%d.%s',_0x28b70b,_0xf0dbce,_0x5972('0x22')));}else{_0x1921a8=path[_0x5972('0x1f')](_0x493f2e,util[_0x5972('0xc')](_0x5972('0x23'),_0x28b70b,'csv'));}fs[_0x5972('0x24')](_0x1921a8,csv(_0x20ccff));}})[_0x5972('0x12')](function(){if(_0x166661){return new Promise(function(_0x27f35f){zipdir(path[_0x5972('0x1f')](_0x493f2e,_0x28b70b),{'saveTo':path['join'](_0x493f2e,util[_0x5972('0xc')](_0x5972('0x23'),_0x28b70b,_0x5972('0x25')))},function(_0x576f92,_0x13e6b7){rimraf(path['join'](_0x493f2e,_0x28b70b),function(){});_0x27f35f(_0x5972('0x26'));});});}})['then'](function(){logger[_0x5972('0xb')](util[_0x5972('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5972('0xe')));return analyticExtractedReport(_0x5972('0x27'),_0x166661?util['format']('%s.%s',_0x28b70b,_0x166661?_0x5972('0x25'):_0x5972('0x22')):null);});})[_0x5972('0x28')](function(_0x597480){logger[_0x5972('0xb')](util[_0x5972('0xc')](_0x5972('0x29'),EXTRACTED_REPORT_ID,_0x5972('0xe')),util[_0x5972('0x2a')](_0x597480,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5972('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 04d2103..289957b 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 _0x8c84=['join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','all','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','pdf','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','pick','map','toString','fill','length','auto','body','push','concat','forEach','format','name','startDate','endDate','header','pageBreak','before','margin','landscape','footer','Arial','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.pdf','existsSync'];(function(_0xb8ea08,_0x1a0e35){var _0x1230c5=function(_0x115686){while(--_0x115686){_0xb8ea08['push'](_0xb8ea08['shift']());}};_0x1230c5(++_0x1a0e35);}(_0x8c84,0x1e5));var _0x48c8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x8c84[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x48c8('0x0'));var path=require(_0x48c8('0x1'));var moment=require(_0x48c8('0x2'));var htmlToPdfmake=require(_0x48c8('0x3'));var PdfPrinter=require(_0x48c8('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x48c8('0x5'));var JSDOM=require('jsdom')[_0x48c8('0x6')];var window=new JSDOM('')[_0x48c8('0x7')];var BPromise=require('bluebird');var db=require(_0x48c8('0x8'))['db'];var dbH=require(_0x48c8('0x8'))['dbH'];var logger=require(_0x48c8('0x9'))(_0x48c8('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x48c8('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x48c8('0xb')][0x4];var NAME=process[_0x48c8('0xb')][0x5];var FORMAT=_0x48c8('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5bbb9a,_0x20fceb){var _0x34eb7b={'status':_0x5bbb9a};var _0x2f0b90={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20fceb){_0x34eb7b['savename']=_0x20fceb;}return db[_0x48c8('0xd')][_0x48c8('0xe')](_0x34eb7b,_0x2f0b90);}function getHeaders(_0x3605df){return _['map'](_0x3605df,function(_0x37a468){return{'text':_0x37a468,'style':_0x48c8('0xf')};});}function getRows(_0x578737,_0x53cdcf){return _['map'](_0x53cdcf,function(_0x3a8a69){return _(_0x3a8a69)[_0x48c8('0x10')](_0x578737)[_0x48c8('0x11')](function(_0x205bf4){return _0x205bf4?_[_0x48c8('0x12')](_0x205bf4):'';})['value']();});}function createTable(_0x242a78,_0x4162c7){var _0x3ea08a={'widths':_[_0x48c8('0x13')](Array(_0x242a78[_0x48c8('0x14')]),0x91),'heights':function(_0x2dc0fc){return _0x2dc0fc===0x0?_0x48c8('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x10a85f=getHeaders(_0x242a78);_0x3ea08a[_0x48c8('0x16')][_0x48c8('0x17')](_0x10a85f);var _0x3e167e=getRows(_0x242a78,_0x4162c7);_0x3ea08a[_0x48c8('0x16')]=_0x3ea08a[_0x48c8('0x16')][_0x48c8('0x18')](_0x3e167e);return _0x3ea08a;}function createTables(_0x204ecf){var _0x374d4c=[];var _0x224a4e=_['chunk'](Object['keys'](_0x204ecf[0x0]),0x5);_0x224a4e[_0x48c8('0x19')](function(_0x391200){_0x374d4c['push'](createTable(_0x391200,_0x204ecf));});return _0x374d4c;}function getPDFDocDefinition(_0x2f5280){var _0x353aa5=util[_0x48c8('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x48c8('0x1b')],moment(EXTRACTED_REPORT[_0x48c8('0x1c')])[_0x48c8('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x48c8('0x1d')])[_0x48c8('0x1a')](FORMAT));var _0x5eaea3=[];for(var _0x589858=0x0;_0x589858<_0x2f5280['length'];_0x589858++){var _0x4d168b=[];if(_0x589858===0x0){_0x4d168b[_0x48c8('0x17')]({'text':_0x353aa5,'style':_0x48c8('0x1e')});}var _0x1c132e={'table':_0x2f5280[_0x589858]};if(_0x589858>0x0){_0x1c132e[_0x48c8('0x1f')]=_0x48c8('0x20');_0x1c132e[_0x48c8('0x21')]=[0x0,0x46,0x0,0x0];}_0x4d168b[_0x48c8('0x17')](_0x1c132e);_0x5eaea3[_0x48c8('0x17')](_0x4d168b);}return{'pageSize':'A4','pageOrientation':_0x48c8('0x22'),'content':_0x5eaea3,'footer':function(_0x1cc904,_0x237885){return{'text':_0x1cc904[_0x48c8('0x12')]()+'\x20/\x20'+_0x237885,'style':_0x48c8('0x23')};},'defaultStyle':{'font':_0x48c8('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x48c8('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xa19eef){var _0xf1188=0x1388;var _0xf0c5cd;if(!_0xa19eef[0x0][_0x48c8('0x26')]){return analyticExtractedReport(_0x48c8('0x27'));}return db[_0x48c8('0x28')][_0x48c8('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x48c8('0x2a'),_0x48c8('0x2b')]})[_0x48c8('0x2c')](function(_0x2ba589){if(_0x2ba589){_0xf0c5cd=_0x2ba589;_0xf1188=_0xf0c5cd[_0x48c8('0x2b')]||0x3e8;}})[_0x48c8('0x2c')](function(){var _0x52e27b=[];var _0x1e9774=0x0;if(_0xf0c5cd['split']){if(_0xa19eef&&_0xa19eef[_0x48c8('0x14')]){var _0x3b3609=_[_0x48c8('0x2d')](_0xa19eef[0x0][_0x48c8('0x26')]/_0xf1188);var _0x4b73e7=Number[_0x48c8('0x2e')](_0xa19eef[0x0][_0x48c8('0x26')]/_0xf1188)?_0xa19eef[0x0][_0x48c8('0x26')]%_0xf1188:0x0;_0x3b3609[_0x48c8('0x19')](function(_0x5f2b03){if(_0x5f2b03>0x0){_0x1e9774+=_0xf1188;}_0x52e27b[_0x48c8('0x17')](dbH[_0x48c8('0x2f')][_0x48c8('0x30')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf1188,_0x1e9774),{'type':dbH[_0x48c8('0x2f')]['QueryTypes'][_0x48c8('0x31')]}));});if(_0x4b73e7>0x0){_0x1e9774+=_0xf1188;_0x52e27b[_0x48c8('0x17')](dbH[_0x48c8('0x2f')][_0x48c8('0x30')](util[_0x48c8('0x1a')](_0x48c8('0x32'),QUERY,_0x4b73e7,_0x1e9774),{'type':dbH[_0x48c8('0x2f')][_0x48c8('0x33')][_0x48c8('0x31')]}));}}}else{_0x52e27b[_0x48c8('0x17')](dbH[_0x48c8('0x2f')]['query'](QUERY,{'type':dbH['sequelize'][_0x48c8('0x33')][_0x48c8('0x31')]}));}var _0x8ab683=path[_0x48c8('0x34')](PATH);var _0x20b51b=path['basename'](PATH,_0x48c8('0x35'));var _0x38f53e=_0xf0c5cd[_0x48c8('0x2a')]&&_0x52e27b[_0x48c8('0x14')]>0x1;var _0x4a7c30=[];if(!fs[_0x48c8('0x36')](path[_0x48c8('0x37')](_0x8ab683,_0x20b51b))&&_0x38f53e){fs['mkdirSync'](path[_0x48c8('0x37')](_0x8ab683,_0x20b51b));}return BPromise[_0x48c8('0x38')](_0x52e27b,function(_0x177906){_0x4a7c30['push'](_0x177906);})[_0x48c8('0x2c')](function(){var _0x3f5ed5=[];for(var _0x23f887=0x0;_0x23f887<_0x4a7c30['length'];_0x23f887+=0x1){var _0x575cc8=_0x4a7c30[_0x23f887];var _0x3e79c7=createTables(_[_0x48c8('0x39')](_0x575cc8));var _0x179701;var _0x1f2969=getPDFDocDefinition(_0x3e79c7);var _0x549476=getPDFPrinter();var _0x5e368f=_0x549476[_0x48c8('0x3a')](_0x1f2969);if(_0x38f53e){_0x179701=path[_0x48c8('0x37')](_0x8ab683,_0x20b51b,util[_0x48c8('0x1a')](_0x48c8('0x3b'),_0x20b51b,_0x23f887,'pdf'));}else{_0x179701=path[_0x48c8('0x37')](_0x8ab683,util[_0x48c8('0x1a')](_0x48c8('0x3c'),_0x20b51b,'pdf'));}_0x3f5ed5['push'](writePDFDocument(_0x5e368f,_0x179701));}return Promise[_0x48c8('0x3d')](_0x3f5ed5);})[_0x48c8('0x2c')](function(){if(_0x38f53e){return new Promise(function(_0xbc0e55){zipdir(path['join'](_0x8ab683,_0x20b51b),{'saveTo':path['join'](_0x8ab683,util[_0x48c8('0x1a')]('%s.%s',_0x20b51b,'zip'))},function(){rimraf(path['join'](_0x8ab683,_0x20b51b),function(){});_0xbc0e55(_0x48c8('0x3e'));});});}})[_0x48c8('0x2c')](function(){if(!_0x38f53e)return;rimraf(path[_0x48c8('0x37')](_0x8ab683,_0x20b51b),function(){});})[_0x48c8('0x2c')](function(){logger['info'](util[_0x48c8('0x1a')](_0x48c8('0x3f'),EXTRACTED_REPORT_ID,_0x48c8('0x40')));return analyticExtractedReport(_0x48c8('0x41'),_0x38f53e?util[_0x48c8('0x1a')](_0x48c8('0x3c'),_0x20b51b,_0x38f53e?_0x48c8('0x42'):_0x48c8('0x43')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x48c8('0x44')](util[_0x48c8('0x1a')](_0x48c8('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x48c8('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xf7b371){EXTRACTED_REPORT=_0xf7b371;return dbH[_0x48c8('0x2f')][_0x48c8('0x30')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x48c8('0x2f')][_0x48c8('0x33')][_0x48c8('0x31')]});})[_0x48c8('0x2c')](extractReport)['catch'](function(_0x3a5666){logger[_0x48c8('0x44')](util['format'](_0x48c8('0x47'),EXTRACTED_REPORT_ID,_0x48c8('0x40')),util[_0x48c8('0x48')](_0x3a5666,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x48c8('0x49'));})[_0x48c8('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3f20f1=new PdfPrinter({'Arial':{'normal':__dirname+_0x48c8('0x4b'),'bold':__dirname+_0x48c8('0x4c'),'italics':__dirname+_0x48c8('0x4d'),'bolditalics':__dirname+_0x48c8('0x4e')}});return _0x3f20f1;}function getPDFDocDefinitionFromHTML(_0x1705e7,_0x4ff672){var _0x1396a8=util[_0x48c8('0x1a')]('%s\x20#%d',_0x4ff672[_0x48c8('0x4f')],_0x4ff672[_0x48c8('0x50')]);var _0x1fb20d=moment()['format'](_0x48c8('0x51'))['toString']();var _0x7b6812=htmlToPdfmake(_0x1705e7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x7b6812],'defaultStyle':{'font':_0x48c8('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x48c8('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x48c8('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x48c8('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x48c8('0x1e')}];},'footer':function(_0x58ddbb,_0x4d6048){return[{'text':util[_0x48c8('0x1a')](_0x48c8('0x53'),_0x1396a8,_0x58ddbb,_0x4d6048,_0x1fb20d),'style':_0x48c8('0x23')}];}};}function writePDFDocument(_0x1f0a89,_0x12fc9e){return new Promise(function(_0x34ce65,_0x54e8f1){var _0xf17031=_0x1f0a89[_0x48c8('0x54')](fs[_0x48c8('0x55')](_0x12fc9e));_0xf17031['on'](_0x48c8('0x56'),function(){_0x34ce65(_0x48c8('0x56'));});_0xf17031['on'](_0x48c8('0x57'),function(_0x42d0e7){_0x54e8f1(_0x42d0e7);});_0x1f0a89[_0x48c8('0x58')]();});}exports[_0x48c8('0x59')]=function(_0x3cd8fa,_0x2b9497){var _0x59dba9=getPDFPrinter();var _0x41d228=getPDFDocDefinitionFromHTML(_0x3cd8fa,_0x2b9497);var _0x7032ec=_0x59dba9[_0x48c8('0x3a')](_0x41d228);return writePDFDocument(_0x7032ec,_0x2b9497[_0x48c8('0x1')])['catch'](function(_0x17ce82){throw _0x17ce82;});}; \ No newline at end of file +var _0x3a23=['then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','finish','error','createPdfFromHTML','createPdfKitDocument','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','push','body','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','find','splitSizePdf'];(function(_0x352479,_0x533271){var _0x175d3b=function(_0x41e80e){while(--_0x41e80e){_0x352479['push'](_0x352479['shift']());}};_0x175d3b(++_0x533271);}(_0x3a23,0x13f));var _0x33a2=function(_0x261be4,_0x4c07b5){_0x261be4=_0x261be4-0x0;var _0x813f2e=_0x3a23[_0x261be4];return _0x813f2e;};'use strict';var _=require(_0x33a2('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x33a2('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x33a2('0x2'));var PdfPrinter=require(_0x33a2('0x3'));var zipdir=require(_0x33a2('0x4'));var rimraf=require(_0x33a2('0x5'));var JSDOM=require(_0x33a2('0x6'))[_0x33a2('0x7')];var window=new JSDOM('')[_0x33a2('0x8')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x33a2('0x9'))['dbH'];var logger=require('../../config/logger')(_0x33a2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x33a2('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x33a2('0xb')][0x4];var NAME=process[_0x33a2('0xb')][0x5];var FORMAT=_0x33a2('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x55a1b4,_0x232fbb){var _0xd40ddb={'status':_0x55a1b4};var _0x416fd7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x232fbb){_0xd40ddb[_0x33a2('0xd')]=_0x232fbb;}return db[_0x33a2('0xe')][_0x33a2('0xf')](_0xd40ddb,_0x416fd7);}function getHeaders(_0x40963c){return _[_0x33a2('0x10')](_0x40963c,function(_0x1f5e86){return{'text':_0x1f5e86,'style':_0x33a2('0x11')};});}function getRows(_0x298b7a,_0x29f92f){return _[_0x33a2('0x10')](_0x29f92f,function(_0x4e036c){return _(_0x4e036c)[_0x33a2('0x12')](_0x298b7a)[_0x33a2('0x10')](function(_0x2ca66c){return _0x2ca66c?_[_0x33a2('0x13')](_0x2ca66c):'';})[_0x33a2('0x14')]();});}function createTable(_0x53edd0,_0x36cda9){var _0xe3cea={'widths':_['fill'](Array(_0x53edd0[_0x33a2('0x15')]),0x91),'heights':function(_0x225e81){return _0x225e81===0x0?_0x33a2('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1e9b3a=getHeaders(_0x53edd0);_0xe3cea['body'][_0x33a2('0x17')](_0x1e9b3a);var _0x59ac17=getRows(_0x53edd0,_0x36cda9);_0xe3cea['body']=_0xe3cea[_0x33a2('0x18')][_0x33a2('0x19')](_0x59ac17);return _0xe3cea;}function createTables(_0x170671){var _0x5f0a20=[];var _0x2b025d=_[_0x33a2('0x1a')](Object['keys'](_0x170671[0x0]),0x5);_0x2b025d[_0x33a2('0x1b')](function(_0x4739e2){_0x5f0a20['push'](createTable(_0x4739e2,_0x170671));});return _0x5f0a20;}function getPDFDocDefinition(_0x9579a9){var _0x27351a=util['format'](_0x33a2('0x1c'),NAME,EXTRACTED_REPORT[_0x33a2('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0x33a2('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x33a2('0x1f')])[_0x33a2('0x1e')](FORMAT));var _0xa5d4f9=[];for(var _0x3e5e8e=0x0;_0x3e5e8e<_0x9579a9[_0x33a2('0x15')];_0x3e5e8e++){var _0x153dfd=[];if(_0x3e5e8e===0x0){_0x153dfd[_0x33a2('0x17')]({'text':_0x27351a,'style':'header'});}var _0x5f4051={'table':_0x9579a9[_0x3e5e8e]};if(_0x3e5e8e>0x0){_0x5f4051[_0x33a2('0x20')]=_0x33a2('0x21');_0x5f4051[_0x33a2('0x22')]=[0x0,0x46,0x0,0x0];}_0x153dfd[_0x33a2('0x17')](_0x5f4051);_0xa5d4f9[_0x33a2('0x17')](_0x153dfd);}return{'pageSize':'A4','pageOrientation':_0x33a2('0x23'),'content':_0xa5d4f9,'footer':function(_0x6fd54e,_0x35f5e7){return{'text':_0x6fd54e[_0x33a2('0x13')]()+_0x33a2('0x24')+_0x35f5e7,'style':_0x33a2('0x25')};},'defaultStyle':{'font':_0x33a2('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x33a2('0x27')},'footer':{'alignment':_0x33a2('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x55750f){var _0x4ec4ff=0x1388;var _0x22be01;if(!_0x55750f[0x0][_0x33a2('0x29')]){return analyticExtractedReport(_0x33a2('0x2a'));}return db['Setting'][_0x33a2('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x37abfd){if(_0x37abfd){_0x22be01=_0x37abfd;_0x4ec4ff=_0x22be01[_0x33a2('0x2c')]||0x3e8;}})[_0x33a2('0x2d')](function(){var _0x47b795=[];var _0x184c0d=0x0;if(_0x22be01[_0x33a2('0x2e')]){if(_0x55750f&&_0x55750f[_0x33a2('0x15')]){var _0x5ea7a1=_[_0x33a2('0x2f')](_0x55750f[0x0][_0x33a2('0x29')]/_0x4ec4ff);var _0x1f5008=Number[_0x33a2('0x30')](_0x55750f[0x0]['num']/_0x4ec4ff)?_0x55750f[0x0][_0x33a2('0x29')]%_0x4ec4ff:0x0;_0x5ea7a1[_0x33a2('0x1b')](function(_0x445760){if(_0x445760>0x0){_0x184c0d+=_0x4ec4ff;}_0x47b795[_0x33a2('0x17')](dbH[_0x33a2('0x31')][_0x33a2('0x32')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4ec4ff,_0x184c0d),{'type':dbH[_0x33a2('0x31')]['QueryTypes']['SELECT']}));});if(_0x1f5008>0x0){_0x184c0d+=_0x4ec4ff;_0x47b795['push'](dbH[_0x33a2('0x31')][_0x33a2('0x32')](util[_0x33a2('0x1e')](_0x33a2('0x33'),QUERY,_0x1f5008,_0x184c0d),{'type':dbH['sequelize'][_0x33a2('0x34')][_0x33a2('0x35')]}));}}}else{_0x47b795[_0x33a2('0x17')](dbH['sequelize'][_0x33a2('0x32')](QUERY,{'type':dbH[_0x33a2('0x31')][_0x33a2('0x34')][_0x33a2('0x35')]}));}var _0x51aa95=path[_0x33a2('0x36')](PATH);var _0x452695=path[_0x33a2('0x37')](PATH,_0x33a2('0x38'));var _0x39674f=_0x22be01['split']&&_0x47b795[_0x33a2('0x15')]>0x1;var _0xe2c3a5=[];if(!fs[_0x33a2('0x39')](path['join'](_0x51aa95,_0x452695))&&_0x39674f){fs['mkdirSync'](path[_0x33a2('0x3a')](_0x51aa95,_0x452695));}return BPromise[_0x33a2('0x3b')](_0x47b795,function(_0x51eb42){_0xe2c3a5['push'](_0x51eb42);})[_0x33a2('0x2d')](function(){var _0x2a17db=[];for(var _0x3cbfe8=0x0;_0x3cbfe8<_0xe2c3a5[_0x33a2('0x15')];_0x3cbfe8+=0x1){var _0xcf7e0e=_0xe2c3a5[_0x3cbfe8];var _0x5c119f=createTables(_[_0x33a2('0x3c')](_0xcf7e0e));var _0x1f5c68;var _0x5c5915=getPDFDocDefinition(_0x5c119f);var _0x2eee3b=getPDFPrinter();var _0x4d3db9=_0x2eee3b['createPdfKitDocument'](_0x5c5915);if(_0x39674f){_0x1f5c68=path[_0x33a2('0x3a')](_0x51aa95,_0x452695,util[_0x33a2('0x1e')](_0x33a2('0x3d'),_0x452695,_0x3cbfe8,_0x33a2('0x3e')));}else{_0x1f5c68=path['join'](_0x51aa95,util[_0x33a2('0x1e')]('%s.%s',_0x452695,_0x33a2('0x3e')));}_0x2a17db[_0x33a2('0x17')](writePDFDocument(_0x4d3db9,_0x1f5c68));}return Promise['all'](_0x2a17db);})[_0x33a2('0x2d')](function(){if(_0x39674f){return new Promise(function(_0x7f03c){zipdir(path[_0x33a2('0x3a')](_0x51aa95,_0x452695),{'saveTo':path[_0x33a2('0x3a')](_0x51aa95,util['format'](_0x33a2('0x3f'),_0x452695,_0x33a2('0x40')))},function(){rimraf(path[_0x33a2('0x3a')](_0x51aa95,_0x452695),function(){});_0x7f03c(_0x33a2('0x41'));});});}})[_0x33a2('0x2d')](function(){if(!_0x39674f)return;rimraf(path[_0x33a2('0x3a')](_0x51aa95,_0x452695),function(){});})['then'](function(){logger[_0x33a2('0x42')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x33a2('0x43')));return analyticExtractedReport(_0x33a2('0x44'),_0x39674f?util[_0x33a2('0x1e')]('%s.%s',_0x452695,_0x39674f?_0x33a2('0x40'):_0x33a2('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x33a2('0x42')](util[_0x33a2('0x1e')](_0x33a2('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x33a2('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x34add9){EXTRACTED_REPORT=_0x34add9;return dbH[_0x33a2('0x31')][_0x33a2('0x32')](util[_0x33a2('0x1e')](_0x33a2('0x47'),QUERY),{'type':dbH[_0x33a2('0x31')][_0x33a2('0x34')]['SELECT']});})[_0x33a2('0x2d')](extractReport)[_0x33a2('0x48')](function(_0x5cfe9a){logger[_0x33a2('0x42')](util[_0x33a2('0x1e')](_0x33a2('0x49'),EXTRACTED_REPORT_ID,_0x33a2('0x43')),util[_0x33a2('0x4a')](_0x5cfe9a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x33a2('0x4b')](function(){process[_0x33a2('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1ea8bf=new PdfPrinter({'Arial':{'normal':__dirname+_0x33a2('0x4d'),'bold':__dirname+_0x33a2('0x4e'),'italics':__dirname+_0x33a2('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1ea8bf;}function getPDFDocDefinitionFromHTML(_0x217fcb,_0x40999a){var _0x317881=util['format'](_0x33a2('0x50'),_0x40999a[_0x33a2('0x51')],_0x40999a[_0x33a2('0x52')]);var _0x2db7f4=moment()[_0x33a2('0x1e')](_0x33a2('0x53'))[_0x33a2('0x13')]();var _0x476619=htmlToPdfmake(_0x217fcb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x476619],'defaultStyle':{'font':_0x33a2('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x33a2('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x33a2('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x33a2('0x54')}},'header':function(){return[{'text':_0x33a2('0x55'),'style':'header'}];},'footer':function(_0x27ee8e,_0x5490f5){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x317881,_0x27ee8e,_0x5490f5,_0x2db7f4),'style':'footer'}];}};}function writePDFDocument(_0x4ad7c8,_0x2de85b){return new Promise(function(_0x132d55,_0x59d235){var _0x5e2c3f=_0x4ad7c8[_0x33a2('0x56')](fs['createWriteStream'](_0x2de85b));_0x5e2c3f['on']('finish',function(){_0x132d55(_0x33a2('0x57'));});_0x5e2c3f['on'](_0x33a2('0x58'),function(_0x2eb76e){_0x59d235(_0x2eb76e);});_0x4ad7c8['end']();});}exports[_0x33a2('0x59')]=function(_0xec58ae,_0x96c460){var _0x3c8dd7=getPDFPrinter();var _0x284552=getPDFDocDefinitionFromHTML(_0xec58ae,_0x96c460);var _0x2cd281=_0x3c8dd7[_0x33a2('0x5a')](_0x284552);return writePDFDocument(_0x2cd281,_0x96c460[_0x33a2('0x1')])[_0x33a2('0x48')](function(_0x4e605e){throw _0x4e605e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e8609c1..068aa1e 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 _0x53d9=['existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','finally','exit','util','path','json2xls','rimraf','../../mysqldb','dbH','argv','savename','update','info','format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx'];(function(_0x3335a6,_0x5b6fb9){var _0x547e44=function(_0x102e57){while(--_0x102e57){_0x3335a6['push'](_0x3335a6['shift']());}};_0x547e44(++_0x5b6fb9);}(_0x53d9,0x102));var _0x953d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d9[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x953d('0x0'));var path=require(_0x953d('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x953d('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x953d('0x3'));var db=require(_0x953d('0x4'))['db'];var dbH=require(_0x953d('0x4'))[_0x953d('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x953d('0x6')][0x2]);var QUERY=process[_0x953d('0x6')][0x3];var PATH=process[_0x953d('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b79e6,_0x2f6f69){var _0x195cc6={'status':_0x2b79e6};var _0x385f9b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f6f69){_0x195cc6[_0x953d('0x7')]=_0x2f6f69;}return db['AnalyticExtractedReport'][_0x953d('0x8')](_0x195cc6,_0x385f9b);}function main(){var _0x10d72f=0x1388;var _0x4da7e5;logger[_0x953d('0x9')](util[_0x953d('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x953d('0xb')][_0x953d('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x953d('0xd'),_0x953d('0xe')]})[_0x953d('0xf')](function(_0x4e5bd4){if(_0x4e5bd4){_0x4da7e5=_0x4e5bd4;_0x10d72f=_0x4da7e5[_0x953d('0xe')]||0x1388;}})[_0x953d('0xf')](function(){return dbH[_0x953d('0x10')][_0x953d('0x11')](util[_0x953d('0xa')](_0x953d('0x12'),QUERY),{'type':dbH['sequelize'][_0x953d('0x13')][_0x953d('0x14')]});})[_0x953d('0xf')](function(_0x10f2cd){if(!_0x10f2cd[0x0][_0x953d('0x15')]){return analyticExtractedReport('Empty');}var _0x178fa6=[];var _0x84d964=0x0;if(_0x4da7e5[_0x953d('0xd')]){if(_0x10f2cd&&_0x10f2cd[_0x953d('0x16')]){var _0x126631=_[_0x953d('0x17')](_0x10f2cd[0x0][_0x953d('0x15')]/_0x10d72f);var _0x3d83d7=Number[_0x953d('0x18')](_0x10f2cd[0x0][_0x953d('0x15')]/_0x10d72f)?_0x10f2cd[0x0][_0x953d('0x15')]%_0x10d72f:0x0;_0x126631[_0x953d('0x19')](function(_0x2e141f){if(_0x2e141f>0x0){_0x84d964+=_0x10d72f;}_0x178fa6[_0x953d('0x1a')](dbH[_0x953d('0x10')][_0x953d('0x11')](util[_0x953d('0xa')](_0x953d('0x1b'),QUERY,_0x10d72f,_0x84d964),{'type':dbH[_0x953d('0x10')][_0x953d('0x13')][_0x953d('0x14')]}));});if(_0x3d83d7>0x0){_0x84d964+=_0x10d72f;_0x178fa6[_0x953d('0x1a')](dbH[_0x953d('0x10')][_0x953d('0x11')](util[_0x953d('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d83d7,_0x84d964),{'type':dbH[_0x953d('0x10')][_0x953d('0x13')][_0x953d('0x14')]}));}}}else{_0x178fa6['push'](dbH['sequelize'][_0x953d('0x11')](QUERY,{'type':dbH['sequelize'][_0x953d('0x13')][_0x953d('0x14')]}));}var _0x45a73a=path['dirname'](PATH);var _0x4eeddf=path[_0x953d('0x1c')](PATH,_0x953d('0x1d'));var _0x139193=_0x4da7e5[_0x953d('0xd')]&&_0x178fa6[_0x953d('0x16')]>0x1;var _0x15ebb3=[];if(!fs[_0x953d('0x1e')](path[_0x953d('0x1f')](_0x45a73a,_0x4eeddf))&&_0x139193){fs[_0x953d('0x20')](path[_0x953d('0x1f')](_0x45a73a,_0x4eeddf));}return BPromise[_0x953d('0x21')](_0x178fa6,function(_0x56c1b8){_0x15ebb3[_0x953d('0x1a')](_0x56c1b8);})[_0x953d('0xf')](function(){for(var _0x2795d7=0x0;_0x2795d7<_0x15ebb3[_0x953d('0x16')];_0x2795d7+=0x1){var _0x49137c;var _0x34c162=_0x15ebb3[_0x2795d7];if(_0x139193){_0x49137c=path['join'](_0x45a73a,_0x4eeddf,util['format'](_0x953d('0x22'),_0x4eeddf,_0x2795d7,_0x953d('0x23')));}else{_0x49137c=path['join'](_0x45a73a,util[_0x953d('0xa')](_0x953d('0x24'),_0x4eeddf,_0x953d('0x23')));}fs['writeFileSync'](_0x49137c,json2xls(_0x34c162),_0x953d('0x25'));}})[_0x953d('0xf')](function(){if(_0x139193){return new Promise(function(_0x3cca73){zipdir(path[_0x953d('0x1f')](_0x45a73a,_0x4eeddf),{'saveTo':path['join'](_0x45a73a,util['format'](_0x953d('0x24'),_0x4eeddf,_0x953d('0x26')))},function(_0x250425,_0x2dc641){rimraf(path[_0x953d('0x1f')](_0x45a73a,_0x4eeddf),function(){});_0x3cca73(_0x953d('0x27'));});});}})['then'](function(){logger[_0x953d('0x9')](util['format'](_0x953d('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x953d('0x29'),_0x139193?util[_0x953d('0xa')](_0x953d('0x24'),_0x4eeddf,_0x139193?_0x953d('0x26'):'xlsx'):null);});})[_0x953d('0x2a')](function(_0xb8806c){logger['info'](util['format'](_0x953d('0x2b'),EXTRACTED_REPORT_ID,_0x953d('0x2c')),util[_0x953d('0x2d')](_0xb8806c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x953d('0x2e')](function(){process[_0x953d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd2f0=['argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xd2f0,0x13f));var _0x0d2f=function(_0x22ac4c,_0x8d8398){_0x22ac4c=_0x22ac4c-0x0;var _0x2020dd=_0xd2f0[_0x22ac4c];return _0x2020dd;};'use strict';var util=require(_0x0d2f('0x0'));var path=require(_0x0d2f('0x1'));var _=require(_0x0d2f('0x2'));var fs=require('fs');var json2xls=require(_0x0d2f('0x3'));var BPromise=require(_0x0d2f('0x4'));var zipdir=require(_0x0d2f('0x5'));var rimraf=require(_0x0d2f('0x6'));var db=require(_0x0d2f('0x7'))['db'];var dbH=require(_0x0d2f('0x7'))[_0x0d2f('0x8')];var logger=require(_0x0d2f('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0d2f('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0d2f('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x11eb7b,_0x477293){var _0x53840f={'status':_0x11eb7b};var _0x56aeb1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x477293){_0x53840f[_0x0d2f('0xb')]=_0x477293;}return db['AnalyticExtractedReport']['update'](_0x53840f,_0x56aeb1);}function main(){var _0x16ae17=0x1388;var _0x56409e;logger[_0x0d2f('0xc')](util[_0x0d2f('0xd')](_0x0d2f('0xe'),EXTRACTED_REPORT_ID,_0x0d2f('0xf')));return db[_0x0d2f('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d2f('0x11'),'splitSizeXlsx']})[_0x0d2f('0x12')](function(_0x516b4e){if(_0x516b4e){_0x56409e=_0x516b4e;_0x16ae17=_0x56409e[_0x0d2f('0x13')]||0x1388;}})[_0x0d2f('0x12')](function(){return dbH[_0x0d2f('0x14')][_0x0d2f('0x15')](util[_0x0d2f('0xd')](_0x0d2f('0x16'),QUERY),{'type':dbH['sequelize'][_0x0d2f('0x17')][_0x0d2f('0x18')]});})['then'](function(_0x7deef5){if(!_0x7deef5[0x0][_0x0d2f('0x19')]){return analyticExtractedReport('Empty');}var _0x2a7db7=[];var _0x118ccd=0x0;if(_0x56409e[_0x0d2f('0x11')]){if(_0x7deef5&&_0x7deef5[_0x0d2f('0x1a')]){var _0x53f3ea=_['range'](_0x7deef5[0x0][_0x0d2f('0x19')]/_0x16ae17);var _0x4224b8=Number['isInteger'](_0x7deef5[0x0][_0x0d2f('0x19')]/_0x16ae17)?_0x7deef5[0x0][_0x0d2f('0x19')]%_0x16ae17:0x0;_0x53f3ea[_0x0d2f('0x1b')](function(_0x542b4b){if(_0x542b4b>0x0){_0x118ccd+=_0x16ae17;}_0x2a7db7['push'](dbH['sequelize'][_0x0d2f('0x15')](util[_0x0d2f('0xd')](_0x0d2f('0x1c'),QUERY,_0x16ae17,_0x118ccd),{'type':dbH[_0x0d2f('0x14')][_0x0d2f('0x17')]['SELECT']}));});if(_0x4224b8>0x0){_0x118ccd+=_0x16ae17;_0x2a7db7[_0x0d2f('0x1d')](dbH[_0x0d2f('0x14')][_0x0d2f('0x15')](util['format'](_0x0d2f('0x1c'),QUERY,_0x4224b8,_0x118ccd),{'type':dbH[_0x0d2f('0x14')][_0x0d2f('0x17')][_0x0d2f('0x18')]}));}}}else{_0x2a7db7[_0x0d2f('0x1d')](dbH[_0x0d2f('0x14')][_0x0d2f('0x15')](QUERY,{'type':dbH['sequelize'][_0x0d2f('0x17')][_0x0d2f('0x18')]}));}var _0x4d7c86=path[_0x0d2f('0x1e')](PATH);var _0x5a3603=path[_0x0d2f('0x1f')](PATH,_0x0d2f('0x20'));var _0xe247d6=_0x56409e[_0x0d2f('0x11')]&&_0x2a7db7[_0x0d2f('0x1a')]>0x1;var _0x14450c=[];if(!fs[_0x0d2f('0x21')](path[_0x0d2f('0x22')](_0x4d7c86,_0x5a3603))&&_0xe247d6){fs['mkdirSync'](path['join'](_0x4d7c86,_0x5a3603));}return BPromise['each'](_0x2a7db7,function(_0x5b2ad1){_0x14450c['push'](_0x5b2ad1);})[_0x0d2f('0x12')](function(){for(var _0x2ed18d=0x0;_0x2ed18d<_0x14450c[_0x0d2f('0x1a')];_0x2ed18d+=0x1){var _0x1aafb7;var _0x51c935=_0x14450c[_0x2ed18d];if(_0xe247d6){_0x1aafb7=path[_0x0d2f('0x22')](_0x4d7c86,_0x5a3603,util[_0x0d2f('0xd')](_0x0d2f('0x23'),_0x5a3603,_0x2ed18d,_0x0d2f('0x24')));}else{_0x1aafb7=path[_0x0d2f('0x22')](_0x4d7c86,util[_0x0d2f('0xd')](_0x0d2f('0x25'),_0x5a3603,_0x0d2f('0x24')));}fs[_0x0d2f('0x26')](_0x1aafb7,json2xls(_0x51c935),_0x0d2f('0x27'));}})[_0x0d2f('0x12')](function(){if(_0xe247d6){return new Promise(function(_0x1037dc){zipdir(path['join'](_0x4d7c86,_0x5a3603),{'saveTo':path[_0x0d2f('0x22')](_0x4d7c86,util['format'](_0x0d2f('0x25'),_0x5a3603,_0x0d2f('0x28')))},function(_0x3bf602,_0x45bff4){rimraf(path[_0x0d2f('0x22')](_0x4d7c86,_0x5a3603),function(){});_0x1037dc(_0x0d2f('0x29'));});});}})['then'](function(){logger[_0x0d2f('0xc')](util[_0x0d2f('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0d2f('0xf')));return analyticExtractedReport(_0x0d2f('0x2a'),_0xe247d6?util[_0x0d2f('0xd')]('%s.%s',_0x5a3603,_0xe247d6?'zip':_0x0d2f('0x24')):null);});})['catch'](function(_0x1b03e7){logger[_0x0d2f('0xc')](util[_0x0d2f('0xd')](_0x0d2f('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x0d2f('0x2c')](_0x1b03e7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0d2f('0x2d'));})['finally'](function(){process[_0x0d2f('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 80cf8e1..fcd7a9d 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 _0xa315=['catch','error','rewrite','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(prefix)=${EXTEN:0:','cutdigits','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','ExecIf','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xa315,0x8d));var _0x5a31=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa315[_0x18a79d];return _0x4f8848;};'use strict';var _=require('lodash');var util=require(_0x5a31('0x0'));function rewrite(_0x42d3f1,_0x1bc280){var _0x5838bc=this;return _0x42d3f1[_0x5a31('0x1')][_0x5a31('0x2')][_0x5a31('0x3')]({'raw':!![]})[_0x5a31('0x4')](function(_0x5b3478){_0x5838bc['intervals']=_0x5b3478;return _0x42d3f1['models'][_0x5a31('0x5')][_0x5a31('0x3')]({'where':{'IntervalId':_0x1bc280[_0x5a31('0x6')]},'raw':!![]});})['then'](function(_0x4b1fab){return _0x42d3f1['models']['VoiceExtension'][_0x5a31('0x3')]({'where':{'exten':{'$in':_[_0x5a31('0x7')](_[_0x5a31('0x8')](_0x4b1fab,_0x5a31('0x9')))}},'order':[{'raw':_0x5a31('0xa')}],'raw':!![]});})[_0x5a31('0x4')](function(_0x2d7096){var _0x471766=_['filter'](_0x2d7096,{'priority':'1'});var _0x14ea02=_[_0x5a31('0xb')](_0x2d7096,{'isApp':0x1});var _0x3adf2e=_[_0x5a31('0xc')](_0x14ea02,'exten');var _0x6bb600=[_0x5a31('0xd'),_0x5a31('0xe')];var _0x22da32=[];var _0x11356c=[];for(var _0x2e23b9 in _0x3adf2e){if(_0x3adf2e[_0x5a31('0xf')](_0x2e23b9)){_0x5838bc[_0x5a31('0x10')]=0x2;_0x5838bc[_0x5a31('0x11')]=[];_0x5838bc[_0x5a31('0x12')]=_[_0x5a31('0x13')](_0x471766,{'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')]});_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0]['type'],'app':_0x5a31('0x15'),'appdata':util[_0x5a31('0x16')](_0x5a31('0x17'),_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')]),'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0]['exten'],'priority':_0x5838bc['priority']++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});if(_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')]===_0x5a31('0x1b')){_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':'Set','appdata':_0x5a31('0x1c')+_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')],'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0]['exten'],'priority':_0x5838bc['priority']++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});}else if(_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')]==='outbound'){if(_0x5838bc[_0x5a31('0x12')]){_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x1d')+(_0x5838bc[_0x5a31('0x12')]['cutdigits']?_0x5a31('0x1e')+_0x5838bc[_0x5a31('0x12')]['cutdigits']+'}':_0x5a31('0x1f')),'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});}_0x5838bc['extensions'][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x1c')+_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')],'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0]['exten'],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0]['VoiceExtensionId']});var _0x3f50b9=_0x5838bc[_0x5a31('0x10')]++;_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3f50b9+0x2)+'):Goto('+(_0x3f50b9+0x1)+')','context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'priority':_0x3f50b9,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0]['VoiceExtensionId']});if(_0x5838bc[_0x5a31('0x12')]){_0x5838bc['extensions']['push']({'type':_0x3adf2e[_0x2e23b9][0x0]['type'],'app':'Set','appdata':_0x5838bc[_0x5a31('0x12')]['cutdigits']?_0x5a31('0x20')+_0x5838bc['extension'][_0x5a31('0x21')]+'}':'CDR(prefix)=noprefix','context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0]['exten'],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});}_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':_0x5a31('0x15'),'appdata':'outboundrouteid='+_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')],'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0]['VoiceExtensionId']});if(_0x5838bc[_0x5a31('0x12')]&&_0x5838bc['extension'][_0x5a31('0xf')](_0x5a31('0x22'))&&_0x5838bc[_0x5a31('0x12')][_0x5a31('0x22')]!==_0x5a31('0x23')){_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':_0x5a31('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3adf2e[_0x2e23b9][0x0]['context'],'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5838bc[_0x5a31('0x12')][_0x5a31('0x22')]||_0x5a31('0x24'),'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});}}_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':'Set','appdata':_0x5a31('0x25'),'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'exten':_0x3adf2e[_0x2e23b9][0x0]['exten'],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});_0x5838bc[_0x5a31('0x11')]['push']({'type':_0x3adf2e[_0x2e23b9][0x0]['type'],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x26'),'context':_0x3adf2e[_0x2e23b9][0x0]['context'],'exten':_0x3adf2e[_0x2e23b9][0x0]['exten'],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});_0x5838bc[_0x5a31('0x11')][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0]['type'],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x27'),'context':_0x3adf2e[_0x2e23b9][0x0]['context'],'exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'priority':_0x5838bc[_0x5a31('0x10')]++,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0]['VoiceExtensionId']});for(var _0x1ac2fb=0x0,_0x2fc964=0x0;_0x1ac2fb<_0x3adf2e[_0x2e23b9][_0x5a31('0x28')];_0x1ac2fb+=0x1,_0x2fc964=0x0){var _0x30b139=_0x3adf2e[_0x2e23b9][_0x1ac2fb];if(_0x30b139[_0x5a31('0x18')]){_0x30b139[_0x5a31('0x18')]=_0x30b139['type']['toLowerCase']();}var _0x239ce2=[];var _0x5bdd07=[];delete _0x30b139['id'];delete _0x30b139[_0x5a31('0x29')];delete _0x30b139['updatedAt'];var _0x1c4cec=_0x30b139[_0x5a31('0x2a')]!==_0x5a31('0x2b')?[_0x30b139[_0x5a31('0x2a')]]:_0x30b139[_0x5a31('0x6')]?_[_0x5a31('0x8')](_[_0x5a31('0xb')](_0x5838bc['intervals'],{'IntervalId':_0x30b139['IntervalId']}),_0x5a31('0x2a')):[];if(_0x30b139['hasOwnProperty'](_0x5a31('0x2c'))){if(_0x30b139[_0x5a31('0x2c')]&&_0x30b139['tag']!=='--'){_0x239ce2[_0x5a31('0x14')]({'type':_0x30b139[_0x5a31('0x18')],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x2d')+_0x30b139[_0x5a31('0x2c')],'context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139['exten'],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc['priority']+_0x2fc964++,'VoiceExtensionId':_0x30b139['VoiceExtensionId']});}}if(_0x30b139['type']===_0x5a31('0x2e')&&_0x30b139['hasOwnProperty']('callerID')){if(_0x30b139['callerID']){_0x239ce2['push']({'type':_0x30b139[_0x5a31('0x18')],'app':_0x5a31('0x2f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x30b139[_0x5a31('0x30')]+')','context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139['exten'],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc['priority']+_0x2fc964++,'VoiceExtensionId':_0x30b139[_0x5a31('0x1a')]});}else{_0x239ce2[_0x5a31('0x14')]({'type':_0x30b139[_0x5a31('0x18')],'app':_0x5a31('0x2f'),'appdata':_0x5a31('0x31'),'context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139[_0x5a31('0x9')],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc[_0x5a31('0x10')]+_0x2fc964++,'VoiceExtensionId':_0x30b139[_0x5a31('0x1a')]});}}if(_0x30b139[_0x5a31('0xf')](_0x5a31('0x32'))){if(_0x6bb600[_0x5a31('0x33')](_0x30b139['app'][_0x5a31('0x34')]())>=0x0&&_0x30b139[_0x5a31('0x35')]!==_0x5a31('0x36')){if(_0x30b139[_0x5a31('0x32')]){_0x239ce2['push']({'type':_0x30b139[_0x5a31('0x18')],'app':_0x5a31('0x2f'),'appdata':_0x5a31('0x37'),'context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139[_0x5a31('0x9')],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc['priority']+_0x2fc964++,'VoiceExtensionId':_0x30b139[_0x5a31('0x1a')]});_0x239ce2[_0x5a31('0x14')]({'type':_0x30b139['type'],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x38'),'context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139[_0x5a31('0x9')],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc[_0x5a31('0x10')]+_0x2fc964++,'VoiceExtensionId':_0x30b139[_0x5a31('0x1a')]});}else{_0x239ce2[_0x5a31('0x14')]({'type':_0x30b139['type'],'app':_0x5a31('0x2f'),'appdata':_0x5a31('0x39'),'context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139[_0x5a31('0x9')],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc[_0x5a31('0x10')]+_0x2fc964++,'VoiceExtensionId':_0x30b139['VoiceExtensionId']});_0x239ce2[_0x5a31('0x14')]({'type':_0x30b139['type'],'app':_0x5a31('0x15'),'appdata':_0x5a31('0x3a'),'context':_0x30b139[_0x5a31('0x19')],'exten':_0x30b139[_0x5a31('0x9')],'priority':_0x1c4cec[_0x5a31('0x28')]+_0x5838bc['priority']+_0x2fc964++,'VoiceExtensionId':_0x30b139[_0x5a31('0x1a')]});}}}for(var _0x5312d8=0x0;_0x5312d8<_0x1c4cec[_0x5a31('0x28')];_0x5312d8+=0x1){var _0x3dd128=_0x5838bc[_0x5a31('0x10')]+_0x1c4cec[_0x5a31('0x28')];var _0x30d5f1=_0x5312d8===_0x1c4cec[_0x5a31('0x28')]-0x1?_0x5838bc['priority']+_0x239ce2[_0x5a31('0x28')]+_0x5bdd07[_0x5a31('0x28')]+0x2:_0x5838bc['priority']+_0x5312d8+0x1;_0x239ce2['splice'](_0x5312d8,0x0,{'type':_0x30b139['type'],'app':'GotoIfTime','appdata':_0x1c4cec[_0x5312d8]+'?'+_0x30b139[_0x5a31('0x19')]+_0x5a31('0x3b')+_0x3dd128+':'+_0x30b139['context']+_0x5a31('0x3b')+_0x30d5f1,'exten':_0x30b139['exten'],'context':_0x30b139[_0x5a31('0x19')],'priority':_0x5838bc[_0x5a31('0x10')]+_0x5312d8,'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});}_0x30b139[_0x5a31('0x10')]=_0x239ce2[_0x5a31('0x28')]?_['last'](_0x239ce2)[_0x5a31('0x10')]+0x1:_0x5838bc[_0x5a31('0x10')];_0x5838bc[_0x5a31('0x10')]=(_0x5bdd07[_0x5a31('0x28')]?_[_0x5a31('0x3c')](_0x5bdd07)['priority']:_0x30b139[_0x5a31('0x10')])+0x1;_0x5838bc[_0x5a31('0x11')]=_[_0x5a31('0x3d')](_0x5838bc[_0x5a31('0x11')],_0x239ce2,[_0x30b139],_0x5bdd07);}_0x5838bc['extensions'][_0x5a31('0x14')]({'type':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x18')],'app':'Hangup','exten':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x9')],'context':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x19')],'priority':_0x5838bc[_0x5a31('0x10')],'VoiceExtensionId':_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]});_0x22da32[_0x5a31('0x14')](_0x3adf2e[_0x2e23b9][0x0][_0x5a31('0x1a')]);_0x11356c=_[_0x5a31('0x3d')](_0x11356c,_0x5838bc['extensions']);}}return _0x42d3f1[_0x5a31('0x3e')](function(_0x2438f2){return _0x42d3f1[_0x5a31('0x1')]['VoiceExtension'][_0x5a31('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x22da32}},'transaction':_0x2438f2})['then'](function(_0x5784d5){return _0x42d3f1['models']['VoiceExtension'][_0x5a31('0x40')](_[_0x5a31('0x41')](_0x11356c,_0x5a31('0x10')),{'transaction':_0x2438f2});});});})[_0x5a31('0x42')](function(_0x3a29f1){console[_0x5a31('0x43')](_0x3a29f1);});}exports[_0x5a31('0x44')]=rewrite; \ No newline at end of file +var _0x2128=['lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','playback','hasOwnProperty','extensions','extension','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','filter','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${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','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','catch','rewrite'];(function(_0x3e9561,_0x3e202b){var _0x4b89b0=function(_0xdb2315){while(--_0xdb2315){_0x3e9561['push'](_0x3e9561['shift']());}};_0x4b89b0(++_0x3e202b);}(_0x2128,0x1bc));var _0x8212=function(_0x143739,_0x1d570f){_0x143739=_0x143739-0x0;var _0x2857e1=_0x2128[_0x143739];return _0x2857e1;};'use strict';var _=require(_0x8212('0x0'));var util=require(_0x8212('0x1'));function rewrite(_0x5557f8,_0xefeeb4){var _0x13371d=this;return _0x5557f8[_0x8212('0x2')][_0x8212('0x3')][_0x8212('0x4')]({'raw':!![]})[_0x8212('0x5')](function(_0x3e3cb0){_0x13371d[_0x8212('0x6')]=_0x3e3cb0;return _0x5557f8['models'][_0x8212('0x7')][_0x8212('0x4')]({'where':{'IntervalId':_0xefeeb4[_0x8212('0x8')]},'raw':!![]});})[_0x8212('0x5')](function(_0x168be9){return _0x5557f8['models']['VoiceExtension'][_0x8212('0x4')]({'where':{'exten':{'$in':_[_0x8212('0x9')](_['map'](_0x168be9,_0x8212('0xa')))}},'order':[{'raw':_0x8212('0xb')}],'raw':!![]});})[_0x8212('0x5')](function(_0x49fcfe){var _0x1fd713=_['filter'](_0x49fcfe,{'priority':'1'});var _0x2ab697=_['filter'](_0x49fcfe,{'isApp':0x1});var _0x27656c=_[_0x8212('0xc')](_0x2ab697,'exten');var _0x8ef589=['queue',_0x8212('0xd')];var _0x16799d=[];var _0x50b9d4=[];for(var _0x575251 in _0x27656c){if(_0x27656c[_0x8212('0xe')](_0x575251)){_0x13371d['priority']=0x2;_0x13371d[_0x8212('0xf')]=[];_0x13371d[_0x8212('0x10')]=_['find'](_0x1fd713,{'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')]});_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':util[_0x8212('0x14')](_0x8212('0x15'),_0x27656c[_0x575251][0x0][_0x8212('0x12')]),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});if(_0x27656c[_0x575251][0x0]['type']===_0x8212('0x19')){_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':'Set','appdata':_0x8212('0x1a')+_0x27656c[_0x575251][0x0][_0x8212('0x18')],'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});}else if(_0x27656c[_0x575251][0x0]['type']==='outbound'){if(_0x13371d[_0x8212('0x10')]){_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x1b')+(_0x13371d['extension'][_0x8212('0x1c')]?_0x8212('0x1d')+_0x13371d['extension']['cutdigits']+'}':_0x8212('0x1e')),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0]['exten'],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0]['VoiceExtensionId']});}_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x1a')+_0x27656c[_0x575251][0x0][_0x8212('0x18')],'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0]['exten'],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0]['VoiceExtensionId']});var _0x53050b=_0x13371d[_0x8212('0x17')]++;_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':'ExecIf','appdata':_0x8212('0x1f')+(_0x53050b+0x2)+_0x8212('0x20')+(_0x53050b+0x1)+')','context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x53050b,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});if(_0x13371d[_0x8212('0x10')]){_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0]['type'],'app':_0x8212('0x13'),'appdata':_0x13371d[_0x8212('0x10')]['cutdigits']?_0x8212('0x21')+_0x13371d[_0x8212('0x10')][_0x8212('0x1c')]+'}':_0x8212('0x22'),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x13371d['priority']++,'VoiceExtensionId':_0x27656c[_0x575251][0x0]['VoiceExtensionId']});}_0x13371d['extensions'][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x23')+_0x27656c[_0x575251][0x0]['VoiceExtensionId'],'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0]['exten'],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});if(_0x13371d['extension']&&_0x13371d['extension'][_0x8212('0xe')](_0x8212('0x24'))&&_0x13371d[_0x8212('0x10')][_0x8212('0x24')]!==_0x8212('0x25')){_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x26'),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x13371d['priority']++,'VoiceExtensionId':_0x27656c[_0x575251][0x0]['VoiceExtensionId']});_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0]['type'],'app':_0x8212('0x13'),'appdata':_0x8212('0x27')+_0x13371d[_0x8212('0x10')][_0x8212('0x24')]||'wav','context':_0x27656c[_0x575251][0x0]['context'],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});}}_0x13371d[_0x8212('0xf')]['push']({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':'Set','appdata':_0x8212('0x28'),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0]['exten'],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x29'),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0]['VoiceExtensionId']});_0x13371d[_0x8212('0xf')]['push']({'type':_0x27656c[_0x575251][0x0]['type'],'app':_0x8212('0x13'),'appdata':_0x8212('0x2a'),'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'exten':_0x27656c[_0x575251][0x0]['exten'],'priority':_0x13371d[_0x8212('0x17')]++,'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});for(var _0x317087=0x0,_0x38c261=0x0;_0x317087<_0x27656c[_0x575251][_0x8212('0x2b')];_0x317087+=0x1,_0x38c261=0x0){var _0x395d51=_0x27656c[_0x575251][_0x317087];if(_0x395d51[_0x8212('0x12')]){_0x395d51[_0x8212('0x12')]=_0x395d51['type'][_0x8212('0x2c')]();}var _0xaecb17=[];var _0x4852d7=[];delete _0x395d51['id'];delete _0x395d51[_0x8212('0x2d')];delete _0x395d51[_0x8212('0x2e')];var _0xafe142=_0x395d51['interval']!==_0x8212('0x2f')?[_0x395d51[_0x8212('0x30')]]:_0x395d51[_0x8212('0x8')]?_[_0x8212('0x31')](_[_0x8212('0x32')](_0x13371d[_0x8212('0x6')],{'IntervalId':_0x395d51['IntervalId']}),_0x8212('0x30')):[];if(_0x395d51[_0x8212('0xe')]('tag')){if(_0x395d51[_0x8212('0x33')]&&_0x395d51[_0x8212('0x33')]!=='--'){_0xaecb17[_0x8212('0x11')]({'type':_0x395d51[_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x34')+_0x395d51[_0x8212('0x33')],'context':_0x395d51[_0x8212('0x16')],'exten':_0x395d51[_0x8212('0xa')],'priority':_0xafe142[_0x8212('0x2b')]+_0x13371d[_0x8212('0x17')]+_0x38c261++,'VoiceExtensionId':_0x395d51[_0x8212('0x18')]});}}if(_0x395d51[_0x8212('0x12')]===_0x8212('0x35')&&_0x395d51[_0x8212('0xe')]('callerID')){if(_0x395d51[_0x8212('0x36')]){_0xaecb17[_0x8212('0x11')]({'type':_0x395d51[_0x8212('0x12')],'app':_0x8212('0x37'),'appdata':_0x8212('0x38')+_0x395d51[_0x8212('0x36')]+')','context':_0x395d51[_0x8212('0x16')],'exten':_0x395d51['exten'],'priority':_0xafe142[_0x8212('0x2b')]+_0x13371d[_0x8212('0x17')]+_0x38c261++,'VoiceExtensionId':_0x395d51[_0x8212('0x18')]});}else{_0xaecb17['push']({'type':_0x395d51[_0x8212('0x12')],'app':'ExecIf','appdata':_0x8212('0x39'),'context':_0x395d51[_0x8212('0x16')],'exten':_0x395d51[_0x8212('0xa')],'priority':_0xafe142[_0x8212('0x2b')]+_0x13371d[_0x8212('0x17')]+_0x38c261++,'VoiceExtensionId':_0x395d51[_0x8212('0x18')]});}}if(_0x395d51[_0x8212('0xe')](_0x8212('0x3a'))){if(_0x8ef589[_0x8212('0x3b')](_0x395d51[_0x8212('0x3c')][_0x8212('0x2c')]())>=0x0&&_0x395d51['appType']!==_0x8212('0x3d')){if(_0x395d51[_0x8212('0x3a')]){_0xaecb17[_0x8212('0x11')]({'type':_0x395d51[_0x8212('0x12')],'app':_0x8212('0x37'),'appdata':_0x8212('0x3e'),'context':_0x395d51[_0x8212('0x16')],'exten':_0x395d51[_0x8212('0xa')],'priority':_0xafe142['length']+_0x13371d[_0x8212('0x17')]+_0x38c261++,'VoiceExtensionId':_0x395d51['VoiceExtensionId']});_0xaecb17[_0x8212('0x11')]({'type':_0x395d51[_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':_0x8212('0x3f'),'context':_0x395d51[_0x8212('0x16')],'exten':_0x395d51[_0x8212('0xa')],'priority':_0xafe142[_0x8212('0x2b')]+_0x13371d[_0x8212('0x17')]+_0x38c261++,'VoiceExtensionId':_0x395d51[_0x8212('0x18')]});}else{_0xaecb17['push']({'type':_0x395d51[_0x8212('0x12')],'app':_0x8212('0x37'),'appdata':_0x8212('0x40'),'context':_0x395d51[_0x8212('0x16')],'exten':_0x395d51['exten'],'priority':_0xafe142[_0x8212('0x2b')]+_0x13371d['priority']+_0x38c261++,'VoiceExtensionId':_0x395d51[_0x8212('0x18')]});_0xaecb17[_0x8212('0x11')]({'type':_0x395d51[_0x8212('0x12')],'app':_0x8212('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x395d51['context'],'exten':_0x395d51[_0x8212('0xa')],'priority':_0xafe142[_0x8212('0x2b')]+_0x13371d[_0x8212('0x17')]+_0x38c261++,'VoiceExtensionId':_0x395d51[_0x8212('0x18')]});}}}for(var _0x362652=0x0;_0x362652<_0xafe142[_0x8212('0x2b')];_0x362652+=0x1){var _0x426891=_0x13371d['priority']+_0xafe142[_0x8212('0x2b')];var _0x3a9196=_0x362652===_0xafe142[_0x8212('0x2b')]-0x1?_0x13371d[_0x8212('0x17')]+_0xaecb17[_0x8212('0x2b')]+_0x4852d7['length']+0x2:_0x13371d['priority']+_0x362652+0x1;_0xaecb17[_0x8212('0x41')](_0x362652,0x0,{'type':_0x395d51['type'],'app':'GotoIfTime','appdata':_0xafe142[_0x362652]+'?'+_0x395d51[_0x8212('0x16')]+_0x8212('0x42')+_0x426891+':'+_0x395d51[_0x8212('0x16')]+_0x8212('0x42')+_0x3a9196,'exten':_0x395d51[_0x8212('0xa')],'context':_0x395d51['context'],'priority':_0x13371d[_0x8212('0x17')]+_0x362652,'VoiceExtensionId':_0x27656c[_0x575251][0x0]['VoiceExtensionId']});}_0x395d51[_0x8212('0x17')]=_0xaecb17[_0x8212('0x2b')]?_[_0x8212('0x43')](_0xaecb17)['priority']+0x1:_0x13371d[_0x8212('0x17')];_0x13371d[_0x8212('0x17')]=(_0x4852d7[_0x8212('0x2b')]?_['last'](_0x4852d7)[_0x8212('0x17')]:_0x395d51[_0x8212('0x17')])+0x1;_0x13371d[_0x8212('0xf')]=_[_0x8212('0x44')](_0x13371d[_0x8212('0xf')],_0xaecb17,[_0x395d51],_0x4852d7);}_0x13371d[_0x8212('0xf')][_0x8212('0x11')]({'type':_0x27656c[_0x575251][0x0][_0x8212('0x12')],'app':_0x8212('0x45'),'exten':_0x27656c[_0x575251][0x0][_0x8212('0xa')],'context':_0x27656c[_0x575251][0x0][_0x8212('0x16')],'priority':_0x13371d[_0x8212('0x17')],'VoiceExtensionId':_0x27656c[_0x575251][0x0][_0x8212('0x18')]});_0x16799d[_0x8212('0x11')](_0x27656c[_0x575251][0x0][_0x8212('0x18')]);_0x50b9d4=_['concat'](_0x50b9d4,_0x13371d[_0x8212('0xf')]);}}return _0x5557f8[_0x8212('0x46')](function(_0x3ad1fb){return _0x5557f8[_0x8212('0x2')][_0x8212('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x16799d}},'transaction':_0x3ad1fb})['then'](function(_0x517afe){return _0x5557f8[_0x8212('0x2')]['VoiceExtension'][_0x8212('0x47')](_['sortBy'](_0x50b9d4,_0x8212('0x17')),{'transaction':_0x3ad1fb});});});})[_0x8212('0x48')](function(_0x24bbb5){console['error'](_0x24bbb5);});}exports[_0x8212('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 775bdec..bb71376 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 _0xe68e=['find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','all','outbound','BlackLists','Campaign','CampaignId','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','emit','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe68e,0x123));var _0xee68=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xe68e[_0x565ed7];return _0x183ad7;};'use strict';var BPromise=require(_0xee68('0x0'));var util=require('util');var _=require(_0xee68('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xee68('0x2'));var Redis=require(_0xee68('0x3'));var db=require(_0xee68('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xee68('0x5'))(_0xee68('0x6'));config[_0xee68('0x7')]=_['defaults'](config[_0xee68('0x7')],{'host':_0xee68('0x8'),'port':0x18eb});var socket=require(_0xee68('0x9'))(new Redis(config[_0xee68('0x7')]));require(_0xee68('0xa'))[_0xee68('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xee68('0xc')][0x2]===_0xee68('0xd')||process[_0xee68('0xc')][0x2]===_0xee68('0xe')){throw new Error(_0xee68('0xf'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xee68('0xc')][0x3]===_0xee68('0xd')||process[_0xee68('0xc')][0x3]===_0xee68('0xe')||!process['argv'][0x4]||process[_0xee68('0xc')][0x4]===_0xee68('0xd')||process[_0xee68('0xc')][0x4]===_0xee68('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xee68('0x10')](process[_0xee68('0xc')][0x3][_0xee68('0x11')](','),process[_0xee68('0xc')][0x4][_0xee68('0x11')](','));if(!process[_0xee68('0xc')][0x5]||process[_0xee68('0xc')][0x5]==='undefined'||process[_0xee68('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xee68('0xc')][0x5];var COMPANYID=process[_0xee68('0xc')][0x6]&&process[_0xee68('0xc')][0x6]!==_0xee68('0xd')&&process[_0xee68('0xc')][0x6]!=='null'?process[_0xee68('0xc')][0x6]:null;var DUPLICATES=process[_0xee68('0xc')][0x7]&&process[_0xee68('0xc')][0x7]!==_0xee68('0xd')&&process[_0xee68('0xc')][0x7]!==_0xee68('0xe')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xee68('0xc')][0x8]===_0xee68('0xd')||process[_0xee68('0xc')][0x8]==='null'){throw new Error(_0xee68('0x12'));}var SOCKET_TIMESTAMP=process[_0xee68('0xc')][0x8];}catch(_0x40c050){logger[_0xee68('0x13')](_0x40c050);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(_0x3406a9,_0x487151,_0x336a45,_0x11303a){var _0xe7351c={'message':_0x487151};_0xe7351c[_0x3406a9]=!![];if(_0x336a45){_0xe7351c[_0xee68('0x14')]=_0x336a45;}if(_0x11303a){_0xe7351c['index']=_0x11303a;}return _0xe7351c;}function isEmail(_0x2d4835){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))*$/[_0xee68('0x15')](_0x2d4835);}function checkRow(_0x57594f,_0x494225,_0xfc4941){return new BPromise(function(_0x1b861b,_0x472c76){if(_[_0xee68('0x16')](_0x57594f)){return _0x472c76(handleCheckRowError(_0xee68('0x13'),_0xee68('0x17'),null,_0xfc4941));}if(_0x57594f['errors']&&_0x57594f[_0xee68('0x18')]['length']){var _0x37ed51=_[_0xee68('0x19')](_0x57594f['errors'],_0xee68('0x1a'))[_0xee68('0x1b')](';');return _0x472c76(handleCheckRowError(_0xee68('0x13'),_0x37ed51,null,_0xfc4941));}var _0x1878a9={};for(var _0x5479c4 in FIELDS){if(FIELDS[_0xee68('0x1c')](_0x5479c4)&&FIELDS[_0x5479c4]){_0x1878a9[_0x5479c4]=_0x57594f[_0xee68('0x1d')][0x0][FIELDS[_0x5479c4]]||_0x57594f[_0xee68('0x1d')][0x0]['\ufeff'+FIELDS[_0x5479c4]];}}if(!_0x1878a9[_0xee68('0x1e')]){return _0x472c76(handleCheckRowError(_0xee68('0x13'),_0xee68('0x1f'),null,_0xfc4941));}if(!_0x1878a9[_0xee68('0x20')]){return _0x472c76(handleCheckRowError(_0xee68('0x13'),'phone\x20not\x20specified!',null,_0xfc4941));}if(_0x1878a9['birthDate']){var _0x989e37=moment(_0x1878a9[_0xee68('0x21')],_0xee68('0x22'));if(!_0x989e37[_0xee68('0x23')]()){return _0x472c76(handleCheckRowError(_0xee68('0x13'),_0xee68('0x24'),null,_0xfc4941));}}if(_0x1878a9[_0xee68('0x25')]){if(!isEmail(_0x1878a9['email'])){return _0x472c76(handleCheckRowError('error',_0xee68('0x26'),null,_0xfc4941));}}_0x1878a9[_0xee68('0x27')]=LISTID;_0x1878a9[_0xee68('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xee68('0x29')]&&_0x494225){var _0x54246a={};for(var _0x1f0712=0x0,_0x554c8d=DUPLICATES[_0xee68('0x29')];_0x1f0712<_0x554c8d;_0x1f0712+=0x1){_0x54246a[DUPLICATES[_0x1f0712]]=_0x1878a9[DUPLICATES[_0x1f0712]];}var _0xfeff80=_[_0xee68('0x2a')](_0x494225,_0x54246a);if(_0xfeff80){return _0x472c76(handleCheckRowError(_0xee68('0x2b'),_0xee68('0x2c'),_0xfeff80,_0xfc4941));}}return db[_0xee68('0x2d')][_0xee68('0x2e')](_0x1878a9,{'raw':!![],'hooks':![],'fields':_[_0xee68('0x2f')](_0x1878a9)})[_0xee68('0x30')](function(_0xc97207){if(DUPLICATES&&DUPLICATES[_0xee68('0x29')]&&_0x494225){_0x494225[_0xee68('0x31')](_[_0xee68('0x32')](_0x1878a9,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc97207['id'];return _0x1b861b();})[_0xee68('0x33')](function(_0x215aed){return _0x472c76(handleCheckRowError(_0xee68('0x13'),_0xee68('0x34')+(_0x215aed['message']||JSON[_0xee68('0x35')](_0x215aed)),null,_0xfc4941));});});}function checkHopper(){function _0x186224(){return function(_0x4ec3e3){logger[_0xee68('0x13')](_0xee68('0x36'),'checkHopper',util[_0xee68('0x37')](_0x4ec3e3,{'showHidden':![],'depth':null}));};}var _0x34ef02=function(_0x2f51be,_0x30ce13){var _0xcfa098=squel[_0xee68('0x38')]()[_0xee68('0x39')](_0xee68('0x3a'))[_0xee68('0x3b')]([_0xee68('0x20'),'scheduledAt',_0xee68('0x3c'),_0xee68('0x27'),_0x30ce13,_0xee68('0x3d'),_0xee68('0x3e')],squel[_0xee68('0x3f')]()[_0xee68('0x40')](_0xee68('0x20'),'phone')[_0xee68('0x40')](_0xee68('0x41'),'scheduledAt')[_0xee68('0x40')]('id',_0xee68('0x3c'))[_0xee68('0x40')](LISTID[_0xee68('0x42')](),_0xee68('0x27'))[_0xee68('0x40')](_0x2f51be['id'][_0xee68('0x42')](),_0x30ce13)['field']('NOW()',_0xee68('0x3d'))[_0xee68('0x40')](_0xee68('0x41'),_0xee68('0x3e'))[_0xee68('0x43')](_0xee68('0x44'))[_0xee68('0x45')]('deletedAt\x20IS\x20NULL')[_0xee68('0x45')](_0xee68('0x46'),LISTID[_0xee68('0x42')]())[_0xee68('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xee68('0x47'),squel['select']()[_0xee68('0x40')](_0xee68('0x20'))[_0xee68('0x43')]('cm_hopper')['where'](_0x30ce13+_0xee68('0x48'),_0x2f51be['id'][_0xee68('0x42')]())))[_0xee68('0x42')]();return _0xcfa098;};var _0x4ef5e7=function(_0x1e0800,_0x5d150c){var _0x4dd2cb=squel[_0xee68('0x38')]()[_0xee68('0x39')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0xee68('0x3c'),'ListId',_0x5d150c,_0xee68('0x3d'),_0xee68('0x3e')],squel[_0xee68('0x3f')]()[_0xee68('0x40')](_0xee68('0x20'),_0xee68('0x20'))[_0xee68('0x40')](_0xee68('0x41'),_0xee68('0x49'))[_0xee68('0x40')]('id','ContactId')[_0xee68('0x40')](LISTID[_0xee68('0x42')](),_0xee68('0x27'))[_0xee68('0x40')](_0x1e0800['id'][_0xee68('0x42')](),_0x5d150c)['field'](_0xee68('0x41'),_0xee68('0x3d'))[_0xee68('0x40')]('NOW()',_0xee68('0x3e'))[_0xee68('0x43')](_0xee68('0x44'))[_0xee68('0x45')](_0xee68('0x4a'))[_0xee68('0x45')](_0xee68('0x46'),LISTID[_0xee68('0x42')]())[_0xee68('0x45')](_0xee68('0x4b'),squel[_0xee68('0x4c')](hopperContacts))[_0xee68('0x45')](_0xee68('0x4d'))[_0xee68('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xee68('0x3f')]()[_0xee68('0x40')](_0xee68('0x4e'))[_0xee68('0x43')](_0xee68('0x4f'))[_0xee68('0x45')](_0x5d150c+_0xee68('0x48'),_0x1e0800['id'][_0xee68('0x42')]()))['where'](_0xee68('0x47'),squel[_0xee68('0x3f')]()[_0xee68('0x40')](_0xee68('0x20'))[_0xee68('0x43')](_0xee68('0x3a'))[_0xee68('0x45')](_0x5d150c+'\x20=\x20?',_0x1e0800['id'][_0xee68('0x42')]())))[_0xee68('0x42')]();return _0x4dd2cb;};function _0x2aa0e8(_0x14fe7d,_0x28c11d){var _0x3a545c=squel[_0xee68('0x38')]()['into']('cm_hopper')[_0xee68('0x3b')]([_0xee68('0x20'),_0xee68('0x49'),_0xee68('0x3c'),_0xee68('0x27'),_0x28c11d,_0xee68('0x3d'),_0xee68('0x3e')],squel[_0xee68('0x3f')]()[_0xee68('0x40')](_0xee68('0x20'),_0xee68('0x20'))[_0xee68('0x40')](_0xee68('0x41'),'scheduledAt')['field']('id',_0xee68('0x3c'))['field'](LISTID[_0xee68('0x42')](),_0xee68('0x27'))[_0xee68('0x40')](_0x14fe7d['id']['toString'](),_0x28c11d)[_0xee68('0x40')](_0xee68('0x41'),_0xee68('0x3d'))['field'](_0xee68('0x41'),'updatedAt')[_0xee68('0x43')](_0xee68('0x44'))[_0xee68('0x45')]('deletedAt\x20IS\x20NULL')[_0xee68('0x45')](_0xee68('0x46'),LISTID['toString']())[_0xee68('0x45')](_0xee68('0x4b'),squel[_0xee68('0x4c')](hopperContacts))[_0xee68('0x45')](_0xee68('0x4d')))[_0xee68('0x42')]();return _0x3a545c;}function _0x43038d(_0x418ddc,_0x17e51e){var _0x72c5c7=squel[_0xee68('0x38')]()[_0xee68('0x39')]('cm_hopper_black')[_0xee68('0x3b')]([_0xee68('0x20'),_0xee68('0x3c'),'ListId',_0x17e51e,_0xee68('0x3d'),'updatedAt'],squel['select']()['field']('phone','phone')[_0xee68('0x40')]('id',_0xee68('0x3c'))[_0xee68('0x40')](LISTID[_0xee68('0x42')](),_0xee68('0x27'))[_0xee68('0x40')](_0x418ddc['id'][_0xee68('0x42')](),_0x17e51e)[_0xee68('0x40')](_0xee68('0x41'),_0xee68('0x3d'))[_0xee68('0x40')](_0xee68('0x41'),_0xee68('0x3e'))['from'](_0xee68('0x44'))[_0xee68('0x45')](_0xee68('0x4a'))[_0xee68('0x45')](_0xee68('0x46'),LISTID[_0xee68('0x42')]())[_0xee68('0x45')]('id\x20IN\x20?',squel[_0xee68('0x4c')](hopperContacts))['where'](_0xee68('0x4d')))[_0xee68('0x42')]();return _0x72c5c7;}return db[_0xee68('0x50')][_0xee68('0x51')]({'where':{'type':'outbound'},'attributes':['id',_0xee68('0x52')],'include':[{'model':db[_0xee68('0x53')],'as':_0xee68('0x54'),'where':{'id':LISTID}}]})[_0xee68('0x30')](function(_0x196b0b){var _0x14e78b=[];if(_0x196b0b){var _0x6df046;for(var _0x292309=0x0,_0x40f92b;_0x292309<_0x196b0b[_0xee68('0x29')];_0x292309+=0x1){_0x40f92b=_0x196b0b[_0x292309][_0xee68('0x55')]({'plain':!![]});switch(_0x40f92b[_0xee68('0x52')]){case _0xee68('0x56'):_0x14e78b[_0xee68('0x31')](db[_0xee68('0x57')][_0xee68('0x58')](_0x4ef5e7(_0x40f92b,_0xee68('0x59')))['then'](function(){})[_0xee68('0x33')](_0x186224()));break;case'onlyIfOpen':_0x14e78b[_0xee68('0x31')](db[_0xee68('0x57')][_0xee68('0x58')](_0x34ef02(_0x40f92b,_0xee68('0x59')))[_0xee68('0x30')](function(){})[_0xee68('0x33')](_0x186224()));break;default:_0x14e78b[_0xee68('0x31')](db[_0xee68('0x57')][_0xee68('0x58')](_0x2aa0e8(_0x40f92b,'VoiceQueueId'))['then'](function(){})[_0xee68('0x33')](_0x186224()));}}}return _0x14e78b;})[_0xee68('0x5a')]()['then'](function(){return db['VoiceQueue'][_0xee68('0x51')]({'where':{'type':_0xee68('0x5b')},'attributes':['id'],'include':[{'model':db[_0xee68('0x53')],'as':_0xee68('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x3729d6){var _0x4389e4=[];if(_0x3729d6){var _0x18b2f6;for(var _0x293d94=0x0,_0x5ef9c0;_0x293d94<_0x3729d6['length'];_0x293d94+=0x1){_0x5ef9c0=_0x3729d6[_0x293d94][_0xee68('0x55')]({'plain':!![]});_0x4389e4[_0xee68('0x31')](db[_0xee68('0x57')][_0xee68('0x58')](_0x43038d(_0x5ef9c0,_0xee68('0x59')))[_0xee68('0x30')](function(){})[_0xee68('0x33')](_0x186224()));}}return _0x4389e4;})['all']();})[_0xee68('0x30')](function(){return db[_0xee68('0x5d')][_0xee68('0x51')]({'attributes':['id',_0xee68('0x52')],'include':[{'model':db[_0xee68('0x53')],'as':_0xee68('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x3a5811){var _0x17d7cc=[];if(_0x3a5811){for(var _0x453140=0x0,_0x658122;_0x453140<_0x3a5811[_0xee68('0x29')];_0x453140+=0x1){_0x658122=_0x3a5811[_0x453140][_0xee68('0x55')]({'plain':!![]});switch(_0x658122[_0xee68('0x52')]){case _0xee68('0x56'):_0x17d7cc[_0xee68('0x31')](db[_0xee68('0x57')][_0xee68('0x58')](_0x4ef5e7(_0x658122,_0xee68('0x5e')))[_0xee68('0x30')](function(){})[_0xee68('0x33')](_0x186224()));break;case'onlyIfOpen':_0x17d7cc['push'](db[_0xee68('0x57')][_0xee68('0x58')](_0x34ef02(_0x658122,_0xee68('0x5e')))[_0xee68('0x30')](function(){})[_0xee68('0x33')](_0x186224()));break;default:_0x17d7cc[_0xee68('0x31')](db[_0xee68('0x57')]['query'](_0x2aa0e8(_0x658122,_0xee68('0x5e')))[_0xee68('0x30')](function(){})[_0xee68('0x33')](_0x186224()));}}}return _0x17d7cc;})['all']();})['then'](function(){return db[_0xee68('0x5d')][_0xee68('0x51')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xee68('0x5c'),'where':{'id':LISTID}}]})[_0xee68('0x30')](function(_0x572381){var _0x102490=[];if(_0x572381){for(var _0xebb88a=0x0,_0x5dad3d;_0xebb88a<_0x572381['length'];_0xebb88a+=0x1){_0x5dad3d=_0x572381[_0xebb88a][_0xee68('0x55')]({'plain':!![]});_0x102490[_0xee68('0x31')](db[_0xee68('0x57')][_0xee68('0x58')](_0x43038d(_0x5dad3d,_0xee68('0x5e')))['then'](function(){})[_0xee68('0x33')](_0x186224()));}}return _0x102490;})[_0xee68('0x5a')]();})['catch'](function(_0x4bc8c6){logger[_0xee68('0x13')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4bc8c6[_0xee68('0x1a')]);});}var processPromises=function(_0x4b99c4){return BPromise['all'](promises)[_0xee68('0x30')](function(_0x23109f){})[_0xee68('0x33')](function(_0x27ea88){logger[_0xee68('0x13')](_0xee68('0x5f'),JSON['stringify'](_0x27ea88));})[_0xee68('0x60')](function(){socket['emit'](_0xee68('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4b99c4){return _0x4b99c4[_0xee68('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xee68('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0xee68('0x30')](function(){socket[_0xee68('0x63')](_0xee68('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xee68('0x64')](FILEPATH);}catch(_0x35a81b){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xee68('0x35')](_0x35a81b));}finally{process[_0xee68('0x65')](0x0);}});};process['on'](_0xee68('0x66'),function(){logger[_0xee68('0x67')](_0xee68('0x68'));endCsv();});function main(){return BPromise[_0xee68('0x69')]()[_0xee68('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xee68('0x2d')][_0xee68('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x33658f){var _0x5a6b64=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xee68('0x6a')](_0x5a6b64,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3532e1,_0xb47483){total+=0x1;var _0x406dd3=total;promises[_0xee68('0x31')](checkRow(_0x3532e1,_0x33658f,_0x406dd3)[_0xee68('0x30')](function(){success+=0x1;})['catch'](function(_0xeb292a){if(_0xeb292a[_0xee68('0x13')]){errors+=0x1;delete _0xeb292a[_0xee68('0x13')];}else if(_0xeb292a[_0xee68('0x2b')]){duplicates+=0x1;delete _0xeb292a[_0xee68('0x2b')];}rows[_0xee68('0x31')](_0xeb292a);}));if(total%0xc8===0x0){_0xb47483[_0xee68('0x6b')]();return processPromises(_0xb47483);}},'complete':function(){return processPromises()[_0xee68('0x30')](function(){logger[_0xee68('0x67')](_0xee68('0x6c'));endCsv();});},'error':function(_0x153358,_0x20223f){logger[_0xee68('0x67')](_0xee68('0x6d'),JSON[_0xee68('0x35')](_0x153358));endCsv();}});})['catch'](function(_0x1727f4){logger[_0xee68('0x13')](_0xee68('0x6e'),JSON[_0xee68('0x35')](_0x1727f4));});}main(); \ No newline at end of file +var _0xf9f4=['findAll','dialCheckDuplicateType','CmList','always','push','query','VoiceQueueId','then','onlyIfOpen','sequelize','all','outbound','Campaign','Lists','CampaignId','BlackLists','get','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','pick','catch','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue'];(function(_0x22a6f6,_0x5d6ea9){var _0x464440=function(_0x147c88){while(--_0x147c88){_0x22a6f6['push'](_0x22a6f6['shift']());}};_0x464440(++_0x5d6ea9);}(_0xf9f4,0x95));var _0x4f9f=function(_0x155c2f,_0x14a8a4){_0x155c2f=_0x155c2f-0x0;var _0x1a2a98=_0xf9f4[_0x155c2f];return _0x1a2a98;};'use strict';var BPromise=require(_0x4f9f('0x0'));var util=require(_0x4f9f('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x4f9f('0x2'));var Papa=require(_0x4f9f('0x3'));var Redis=require(_0x4f9f('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x4f9f('0x5'));var logger=require(_0x4f9f('0x6'))(_0x4f9f('0x7'));config[_0x4f9f('0x8')]=_[_0x4f9f('0x9')](config[_0x4f9f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f9f('0xa'))(new Redis(config[_0x4f9f('0x8')]));require(_0x4f9f('0xb'))['register'](socket);try{if(!process[_0x4f9f('0xc')][0x2]||process['argv'][0x2]==='undefined'||process[_0x4f9f('0xc')][0x2]===_0x4f9f('0xd')){throw new Error(_0x4f9f('0xe'));}var FILEPATH=process[_0x4f9f('0xc')][0x2];if(!process[_0x4f9f('0xc')][0x3]||process[_0x4f9f('0xc')][0x3]===_0x4f9f('0xf')||process[_0x4f9f('0xc')][0x3]===_0x4f9f('0xd')||!process[_0x4f9f('0xc')][0x4]||process[_0x4f9f('0xc')][0x4]===_0x4f9f('0xf')||process[_0x4f9f('0xc')][0x4]==='null'){throw new Error(_0x4f9f('0x10'));}var FIELDS=_[_0x4f9f('0x11')](process[_0x4f9f('0xc')][0x3][_0x4f9f('0x12')](','),process[_0x4f9f('0xc')][0x4][_0x4f9f('0x12')](','));if(!process['argv'][0x5]||process[_0x4f9f('0xc')][0x5]===_0x4f9f('0xf')||process[_0x4f9f('0xc')][0x5]===_0x4f9f('0xd')){throw new Error(_0x4f9f('0x13'));}var LISTID=process[_0x4f9f('0xc')][0x5];var COMPANYID=process[_0x4f9f('0xc')][0x6]&&process[_0x4f9f('0xc')][0x6]!==_0x4f9f('0xf')&&process['argv'][0x6]!=='null'?process[_0x4f9f('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4f9f('0xc')][0x7]!==_0x4f9f('0xf')&&process[_0x4f9f('0xc')][0x7]!==_0x4f9f('0xd')?process['argv'][0x7]:null;if(!process[_0x4f9f('0xc')][0x8]||process[_0x4f9f('0xc')][0x8]===_0x4f9f('0xf')||process[_0x4f9f('0xc')][0x8]===_0x4f9f('0xd')){throw new Error(_0x4f9f('0x14'));}var SOCKET_TIMESTAMP=process[_0x4f9f('0xc')][0x8];}catch(_0x506c40){logger[_0x4f9f('0x15')](_0x506c40);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(_0x346b17,_0x384d99,_0x28ff58,_0x4f335c){var _0x4882f3={'message':_0x384d99};_0x4882f3[_0x346b17]=!![];if(_0x28ff58){_0x4882f3['contact']=_0x28ff58;}if(_0x4f335c){_0x4882f3[_0x4f9f('0x16')]=_0x4f335c;}return _0x4882f3;}function isEmail(_0x415ffb){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))*$/[_0x4f9f('0x17')](_0x415ffb);}function checkRow(_0xe46780,_0x21040d,_0x3c5425){return new BPromise(function(_0xa1943f,_0x42f756){if(_[_0x4f9f('0x18')](_0xe46780)){return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),_0x4f9f('0x19'),null,_0x3c5425));}if(_0xe46780[_0x4f9f('0x1a')]&&_0xe46780['errors'][_0x4f9f('0x1b')]){var _0x42687e=_['map'](_0xe46780[_0x4f9f('0x1a')],_0x4f9f('0x1c'))[_0x4f9f('0x1d')](';');return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),_0x42687e,null,_0x3c5425));}var _0x481d9f={};for(var _0x3ada88 in FIELDS){if(FIELDS[_0x4f9f('0x1e')](_0x3ada88)&&FIELDS[_0x3ada88]){_0x481d9f[_0x3ada88]=_0xe46780[_0x4f9f('0x1f')][0x0][FIELDS[_0x3ada88]]||_0xe46780['data'][0x0]['\ufeff'+FIELDS[_0x3ada88]];}}if(!_0x481d9f[_0x4f9f('0x20')]){return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),'firstName\x20not\x20specified!',null,_0x3c5425));}if(!_0x481d9f[_0x4f9f('0x21')]){return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),_0x4f9f('0x22'),null,_0x3c5425));}if(_0x481d9f[_0x4f9f('0x23')]){var _0xe9e466=moment(_0x481d9f[_0x4f9f('0x23')],_0x4f9f('0x24'));if(!_0xe9e466[_0x4f9f('0x25')]()){return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3c5425));}}if(_0x481d9f[_0x4f9f('0x26')]){if(!isEmail(_0x481d9f[_0x4f9f('0x26')])){return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x3c5425));}}_0x481d9f['ListId']=LISTID;_0x481d9f[_0x4f9f('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x21040d){var _0x3295e2={};for(var _0x23a67d=0x0,_0x240a9d=DUPLICATES['length'];_0x23a67d<_0x240a9d;_0x23a67d+=0x1){_0x3295e2[DUPLICATES[_0x23a67d]]=_0x481d9f[DUPLICATES[_0x23a67d]];}var _0xc7501b=_[_0x4f9f('0x28')](_0x21040d,_0x3295e2);if(_0xc7501b){return _0x42f756(handleCheckRowError('duplicate',_0x4f9f('0x29'),_0xc7501b,_0x3c5425));}}return db[_0x4f9f('0x2a')][_0x4f9f('0x2b')](_0x481d9f,{'raw':!![],'hooks':![],'fields':_[_0x4f9f('0x2c')](_0x481d9f)})['then'](function(_0x501947){if(DUPLICATES&&DUPLICATES[_0x4f9f('0x1b')]&&_0x21040d){_0x21040d['push'](_[_0x4f9f('0x2d')](_0x481d9f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x501947['id'];return _0xa1943f();})[_0x4f9f('0x2e')](function(_0x1af9dd){return _0x42f756(handleCheckRowError(_0x4f9f('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1af9dd[_0x4f9f('0x1c')]||JSON['stringify'](_0x1af9dd)),null,_0x3c5425));});});}function checkHopper(){function _0x10ef98(){return function(_0x48c25a){logger[_0x4f9f('0x15')](_0x4f9f('0x2f'),_0x4f9f('0x30'),util[_0x4f9f('0x31')](_0x48c25a,{'showHidden':![],'depth':null}));};}var _0x2c8be1=function(_0x4068cd,_0x1bd934){var _0x6e47fb=squel[_0x4f9f('0x32')]()[_0x4f9f('0x33')](_0x4f9f('0x34'))[_0x4f9f('0x35')]([_0x4f9f('0x21'),_0x4f9f('0x36'),_0x4f9f('0x37'),_0x4f9f('0x38'),_0x1bd934,'createdAt',_0x4f9f('0x39')],squel[_0x4f9f('0x3a')]()[_0x4f9f('0x3b')](_0x4f9f('0x21'),_0x4f9f('0x21'))[_0x4f9f('0x3b')](_0x4f9f('0x3c'),'scheduledAt')[_0x4f9f('0x3b')]('id','ContactId')[_0x4f9f('0x3b')](LISTID['toString'](),'ListId')[_0x4f9f('0x3b')](_0x4068cd['id'][_0x4f9f('0x3d')](),_0x1bd934)['field'](_0x4f9f('0x3c'),_0x4f9f('0x3e'))['field'](_0x4f9f('0x3c'),_0x4f9f('0x39'))[_0x4f9f('0x3f')](_0x4f9f('0x40'))[_0x4f9f('0x41')](_0x4f9f('0x42'))[_0x4f9f('0x41')](_0x4f9f('0x43'),LISTID[_0x4f9f('0x3d')]())[_0x4f9f('0x41')](_0x4f9f('0x44'))[_0x4f9f('0x41')](_0x4f9f('0x45'),squel[_0x4f9f('0x3a')]()[_0x4f9f('0x3b')](_0x4f9f('0x21'))[_0x4f9f('0x3f')](_0x4f9f('0x34'))[_0x4f9f('0x41')](_0x1bd934+_0x4f9f('0x46'),_0x4068cd['id'][_0x4f9f('0x3d')]())))[_0x4f9f('0x3d')]();return _0x6e47fb;};var _0x3868fd=function(_0xd44023,_0x3280bb){var _0x38b0b9=squel[_0x4f9f('0x32')]()[_0x4f9f('0x33')](_0x4f9f('0x34'))[_0x4f9f('0x35')]([_0x4f9f('0x21'),_0x4f9f('0x36'),_0x4f9f('0x37'),_0x4f9f('0x38'),_0x3280bb,_0x4f9f('0x3e'),_0x4f9f('0x39')],squel[_0x4f9f('0x3a')]()[_0x4f9f('0x3b')](_0x4f9f('0x21'),'phone')[_0x4f9f('0x3b')](_0x4f9f('0x3c'),_0x4f9f('0x36'))['field']('id','ContactId')[_0x4f9f('0x3b')](LISTID['toString'](),'ListId')[_0x4f9f('0x3b')](_0xd44023['id'][_0x4f9f('0x3d')](),_0x3280bb)[_0x4f9f('0x3b')](_0x4f9f('0x3c'),'createdAt')[_0x4f9f('0x3b')]('NOW()',_0x4f9f('0x39'))['from'](_0x4f9f('0x40'))[_0x4f9f('0x41')]('deletedAt\x20IS\x20NULL')[_0x4f9f('0x41')]('ListId\x20=\x20?',LISTID[_0x4f9f('0x3d')]())[_0x4f9f('0x41')](_0x4f9f('0x47'),squel[_0x4f9f('0x48')](hopperContacts))['where'](_0x4f9f('0x44'))[_0x4f9f('0x41')](_0x4f9f('0x45'),squel[_0x4f9f('0x3a')]()[_0x4f9f('0x3b')](_0x4f9f('0x49'))[_0x4f9f('0x3f')](_0x4f9f('0x4a'))[_0x4f9f('0x41')](_0x3280bb+_0x4f9f('0x46'),_0xd44023['id'][_0x4f9f('0x3d')]()))[_0x4f9f('0x41')](_0x4f9f('0x45'),squel['select']()[_0x4f9f('0x3b')](_0x4f9f('0x21'))[_0x4f9f('0x3f')](_0x4f9f('0x34'))[_0x4f9f('0x41')](_0x3280bb+'\x20=\x20?',_0xd44023['id']['toString']())))[_0x4f9f('0x3d')]();return _0x38b0b9;};function _0x26314f(_0x45f933,_0x14a611){var _0x113ad1=squel[_0x4f9f('0x32')]()['into']('cm_hopper')['fromQuery']([_0x4f9f('0x21'),_0x4f9f('0x36'),'ContactId',_0x4f9f('0x38'),_0x14a611,'createdAt',_0x4f9f('0x39')],squel['select']()['field'](_0x4f9f('0x21'),_0x4f9f('0x21'))['field'](_0x4f9f('0x3c'),_0x4f9f('0x36'))[_0x4f9f('0x3b')]('id',_0x4f9f('0x37'))['field'](LISTID[_0x4f9f('0x3d')](),'ListId')[_0x4f9f('0x3b')](_0x45f933['id'][_0x4f9f('0x3d')](),_0x14a611)[_0x4f9f('0x3b')](_0x4f9f('0x3c'),_0x4f9f('0x3e'))[_0x4f9f('0x3b')]('NOW()',_0x4f9f('0x39'))[_0x4f9f('0x3f')](_0x4f9f('0x40'))[_0x4f9f('0x41')]('deletedAt\x20IS\x20NULL')[_0x4f9f('0x41')]('ListId\x20=\x20?',LISTID[_0x4f9f('0x3d')]())[_0x4f9f('0x41')](_0x4f9f('0x47'),squel[_0x4f9f('0x48')](hopperContacts))[_0x4f9f('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x4f9f('0x3d')]();return _0x113ad1;}function _0x3f7b6a(_0x483dce,_0x2d4021){var _0x1e2c45=squel['insert']()[_0x4f9f('0x33')](_0x4f9f('0x4b'))['fromQuery'](['phone',_0x4f9f('0x37'),_0x4f9f('0x38'),_0x2d4021,_0x4f9f('0x3e'),_0x4f9f('0x39')],squel['select']()[_0x4f9f('0x3b')](_0x4f9f('0x21'),_0x4f9f('0x21'))[_0x4f9f('0x3b')]('id',_0x4f9f('0x37'))[_0x4f9f('0x3b')](LISTID[_0x4f9f('0x3d')](),'ListId')['field'](_0x483dce['id'][_0x4f9f('0x3d')](),_0x2d4021)['field'](_0x4f9f('0x3c'),'createdAt')[_0x4f9f('0x3b')](_0x4f9f('0x3c'),_0x4f9f('0x39'))[_0x4f9f('0x3f')]('cm_contacts')[_0x4f9f('0x41')](_0x4f9f('0x42'))[_0x4f9f('0x41')](_0x4f9f('0x43'),LISTID[_0x4f9f('0x3d')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x1e2c45;}return db[_0x4f9f('0x4c')][_0x4f9f('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x4f9f('0x4e')],'include':[{'model':db[_0x4f9f('0x4f')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x4d34fe){var _0x19092f=[];if(_0x4d34fe){var _0x5b5930;for(var _0x615aa1=0x0,_0x3066ab;_0x615aa1<_0x4d34fe[_0x4f9f('0x1b')];_0x615aa1+=0x1){_0x3066ab=_0x4d34fe[_0x615aa1]['get']({'plain':!![]});switch(_0x3066ab[_0x4f9f('0x4e')]){case _0x4f9f('0x50'):_0x19092f[_0x4f9f('0x51')](db['sequelize'][_0x4f9f('0x52')](_0x3868fd(_0x3066ab,_0x4f9f('0x53')))[_0x4f9f('0x54')](function(){})['catch'](_0x10ef98()));break;case _0x4f9f('0x55'):_0x19092f[_0x4f9f('0x51')](db[_0x4f9f('0x56')][_0x4f9f('0x52')](_0x2c8be1(_0x3066ab,_0x4f9f('0x53')))[_0x4f9f('0x54')](function(){})['catch'](_0x10ef98()));break;default:_0x19092f[_0x4f9f('0x51')](db['sequelize'][_0x4f9f('0x52')](_0x26314f(_0x3066ab,_0x4f9f('0x53')))[_0x4f9f('0x54')](function(){})['catch'](_0x10ef98()));}}}return _0x19092f;})[_0x4f9f('0x57')]()[_0x4f9f('0x54')](function(){return db[_0x4f9f('0x4c')][_0x4f9f('0x4d')]({'where':{'type':_0x4f9f('0x58')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x52cae1){var _0x26eb70=[];if(_0x52cae1){var _0x22a578;for(var _0x3a4c48=0x0,_0x1e769e;_0x3a4c48<_0x52cae1[_0x4f9f('0x1b')];_0x3a4c48+=0x1){_0x1e769e=_0x52cae1[_0x3a4c48]['get']({'plain':!![]});_0x26eb70[_0x4f9f('0x51')](db[_0x4f9f('0x56')][_0x4f9f('0x52')](_0x3f7b6a(_0x1e769e,_0x4f9f('0x53')))['then'](function(){})[_0x4f9f('0x2e')](_0x10ef98()));}}return _0x26eb70;})['all']();})[_0x4f9f('0x54')](function(){return db[_0x4f9f('0x59')]['findAll']({'attributes':['id',_0x4f9f('0x4e')],'include':[{'model':db[_0x4f9f('0x4f')],'as':_0x4f9f('0x5a'),'where':{'id':LISTID}}]})[_0x4f9f('0x54')](function(_0x4f0530){var _0x59cb33=[];if(_0x4f0530){for(var _0x5a3a6d=0x0,_0x53a055;_0x5a3a6d<_0x4f0530[_0x4f9f('0x1b')];_0x5a3a6d+=0x1){_0x53a055=_0x4f0530[_0x5a3a6d]['get']({'plain':!![]});switch(_0x53a055[_0x4f9f('0x4e')]){case _0x4f9f('0x50'):_0x59cb33[_0x4f9f('0x51')](db[_0x4f9f('0x56')][_0x4f9f('0x52')](_0x3868fd(_0x53a055,_0x4f9f('0x5b')))[_0x4f9f('0x54')](function(){})[_0x4f9f('0x2e')](_0x10ef98()));break;case _0x4f9f('0x55'):_0x59cb33[_0x4f9f('0x51')](db[_0x4f9f('0x56')][_0x4f9f('0x52')](_0x2c8be1(_0x53a055,'CampaignId'))[_0x4f9f('0x54')](function(){})[_0x4f9f('0x2e')](_0x10ef98()));break;default:_0x59cb33[_0x4f9f('0x51')](db['sequelize'][_0x4f9f('0x52')](_0x26314f(_0x53a055,_0x4f9f('0x5b')))[_0x4f9f('0x54')](function(){})['catch'](_0x10ef98()));}}}return _0x59cb33;})[_0x4f9f('0x57')]();})[_0x4f9f('0x54')](function(){return db[_0x4f9f('0x59')][_0x4f9f('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x4f9f('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x3babcd){var _0x29bf88=[];if(_0x3babcd){for(var _0x3192e8=0x0,_0x2d7d26;_0x3192e8<_0x3babcd[_0x4f9f('0x1b')];_0x3192e8+=0x1){_0x2d7d26=_0x3babcd[_0x3192e8][_0x4f9f('0x5d')]({'plain':!![]});_0x29bf88['push'](db[_0x4f9f('0x56')][_0x4f9f('0x52')](_0x3f7b6a(_0x2d7d26,_0x4f9f('0x5b')))[_0x4f9f('0x54')](function(){})[_0x4f9f('0x2e')](_0x10ef98()));}}return _0x29bf88;})['all']();})[_0x4f9f('0x2e')](function(_0x41e756){logger[_0x4f9f('0x15')](_0x4f9f('0x5e'),_0x4f9f('0x5f'),_0x41e756[_0x4f9f('0x1c')]);});}var processPromises=function(_0x451298){return BPromise[_0x4f9f('0x57')](promises)[_0x4f9f('0x54')](function(_0x47b25f){})[_0x4f9f('0x2e')](function(_0x1de571){logger['error'](_0x4f9f('0x60'),JSON[_0x4f9f('0x61')](_0x1de571));})[_0x4f9f('0x62')](function(){socket['emit'](_0x4f9f('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x451298){return _0x451298[_0x4f9f('0x64')]();}});};var endCsv=function(){return BPromise[_0x4f9f('0x65')]()[_0x4f9f('0x54')](function(){if(hopperContacts){return checkHopper();}})[_0x4f9f('0x54')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4f9f('0x66')](FILEPATH);}catch(_0x2a963f){logger['error'](_0x4f9f('0x67'),JSON[_0x4f9f('0x61')](_0x2a963f));}finally{process[_0x4f9f('0x68')](0x0);}});};process['on'](_0x4f9f('0x69'),function(){logger[_0x4f9f('0x6a')](_0x4f9f('0x6b'));endCsv();});function main(){return BPromise[_0x4f9f('0x65')]()[_0x4f9f('0x54')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4f9f('0x12')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x3efb5e){var _0x22a79f=fs[_0x4f9f('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x22a79f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x395c1f,_0x1b66b2){total+=0x1;var _0x3b5104=total;promises[_0x4f9f('0x51')](checkRow(_0x395c1f,_0x3efb5e,_0x3b5104)[_0x4f9f('0x54')](function(){success+=0x1;})[_0x4f9f('0x2e')](function(_0xeb67c9){if(_0xeb67c9[_0x4f9f('0x15')]){errors+=0x1;delete _0xeb67c9[_0x4f9f('0x15')];}else if(_0xeb67c9[_0x4f9f('0x6d')]){duplicates+=0x1;delete _0xeb67c9[_0x4f9f('0x6d')];}rows['push'](_0xeb67c9);}));if(total%0xc8===0x0){_0x1b66b2[_0x4f9f('0x6e')]();return processPromises(_0x1b66b2);}},'complete':function(){return processPromises()[_0x4f9f('0x54')](function(){logger['info'](_0x4f9f('0x6f'));endCsv();});},'error':function(_0x3e8acc,_0x42380f){logger[_0x4f9f('0x6a')](_0x4f9f('0x70'),JSON[_0x4f9f('0x61')](_0x3e8acc));endCsv();}});})[_0x4f9f('0x2e')](function(_0x8dcd5b){logger[_0x4f9f('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x8dcd5b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index dc80229..f2f61d4 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 _0x344b=['voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','campaigns_has_cm_lists','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','then','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','ListId','cm_contacts','field','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.ListId','recallme','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists.CmListId=','timezones','isNil','utcOffset','set','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','hasOwnProperty','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId'];(function(_0x3e082b,_0x548a5e){var _0x2da06c=function(_0x31e166){while(--_0x31e166){_0x3e082b['push'](_0x3e082b['shift']());}};_0x2da06c(++_0x548a5e);}(_0x344b,0x190));var _0xb344=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x344b[_0x2ec461];return _0x28603d;};'use strict';var fs=require('fs');var path=require(_0xb344('0x0'));var _=require(_0xb344('0x1'));var Papa=require('papaparse');var util=require(_0xb344('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0xb344('0x3'));var db=require(_0xb344('0x4'))['db'];var config=require(_0xb344('0x5'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xb344('0x6'));config[_0xb344('0x7')]=_[_0xb344('0x8')](config['redis'],{'host':_0xb344('0x9'),'port':0x18eb});var socket=require(_0xb344('0xa'))(new Redis(config[_0xb344('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb344('0xb')](_0xb344('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb344('0xb')](_0xb344('0xc'));function isEmail(_0x3974b7){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))*$/[_0xb344('0xd')](_0x3974b7);}function selectNotIn(_0x360567,_0x3b9497,_0x53ff14,_0x4aba96,_0x2c8988){return squel[_0xb344('0xe')]()['field'](_0xb344('0xf'))['from'](_0x4aba96)[_0xb344('0x10')](_0x3b9497,null,_0x3b9497+_0xb344('0x11')+_0x4aba96+'.'+_0x53ff14)['where'](_0x4aba96+'.'+_0x53ff14+_0xb344('0x12')+_0x360567+'.'+_0x53ff14)[_0xb344('0x13')](_0x3b9497+_0xb344('0x14')+_0x2c8988['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x394177,_0x309ccc){promisesAdditionalPhones=[];return db[_0xb344('0x15')][_0xb344('0x16')]({'raw':!![],'attributes':['id',_0xb344('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x30512a){if(_0x30512a!==null){var _0x2d74a3=[];for(var _0x388e34=0x0;_0x388e34<_0x30512a[_0xb344('0x18')];_0x388e34++){var _0x5021d5=_0x30512a[_0x388e34];_0x2d74a3[_0xb344('0x19')](insertAdditionalPhones(_0x5021d5));}}Promise[_0xb344('0x1a')](_0x2d74a3)[_0xb344('0x1b')](function(){_0x394177({'val':0x1});});});});}function insertAdditionalPhones(_0x3dbc7d){return new Promise(function(_0x4d8e7f,_0x167bf4){var _0x18700c=_0x3dbc7d[_0xb344('0x17')];var _0x7c3f44=_0x18700c['split'](';');var _0x38ea68=[];orderBy=0x0;for(var _0x50f1f2=0x0;_0x50f1f2<_0x7c3f44[_0xb344('0x18')];_0x50f1f2++){_0x38ea68[_0xb344('0x19')](splitAdditionalPhone(_0x3dbc7d['id'],_0x7c3f44[_0x50f1f2]));}Promise[_0xb344('0x1a')](_0x38ea68)['then'](function(){_0x4d8e7f({'val':_0x7c3f44[_0xb344('0x18')]});});});}function splitAdditionalPhone(_0x2fc252,_0xf0f667){return new Promise(function(_0x5aed6f,_0x464736){var _0x1c2e2c=_0xf0f667[_0xb344('0x1c')](':');var _0x34cde6=_0x1c2e2c[0x0];var _0x485927=_0x1c2e2c[0x1];if(!_['isNil'](_0x485927)){var _0x7baee4=_0x485927[_0xb344('0x1c')]('|');var _0x68d6c1=[];for(var _0x344d24=0x0;_0x344d24<_0x7baee4[_0xb344('0x18')];_0x344d24++){if(_0x7baee4[_0x344d24]!==''){var _0x1f7d6e=_['filter'](promisesAdditionalPhones,{'contactId':_0x2fc252,'phone':_0x7baee4[_0x344d24]});if(_0x1f7d6e['length']==0x0){orderBy++;promisesAdditionalPhones[_0xb344('0x19')]({'contactId':_0x2fc252,'contactTypeId':_0x34cde6,'phone':_0x7baee4[_0x344d24],'orderBy':orderBy});}}}_0x5aed6f({'ok':0x1});}else _0x5aed6f({'res':0x0});});}function createAdditionalPhone(_0x74b385,_0x29c7d3,_0xaaf326,_0x3265f6){var _0xd683da='';var _0x188194='';var _0x3b76ce=_0xaaf326[_0xb344('0x1c')]('§');_0xd683da=_0x3b76ce[0x0];if(_0x3b76ce['length']==0x2)_0x188194=_0x3b76ce[0x1];return new Promise(function(_0x845031,_0x232bfa){return db[_0xb344('0x1d')][_0xb344('0x1e')]({'where':{'CmContactId':_0x74b385,'item':_0xd683da}})[_0xb344('0x1b')](function(_0x595c57){if(_0x595c57){return db[_0xb344('0x1d')][_0xb344('0x1f')]({'ItemTypeId':_0x29c7d3,'description':_0x188194,'OrderBy':_0x3265f6},{'where':{'CmContactId':_0x74b385,'item':_0xd683da}})[_0xb344('0x1b')](function(_0x503e63){_0x845031({'res':_0xb344('0x20')});});}else{return db['CmContactHasItem'][_0xb344('0x21')]({'CmContactId':_0x74b385,'item':_0xd683da,'description':_0x188194,'ItemTypeId':_0x29c7d3,'OrderBy':_0x3265f6,'ItemClass':_0xb344('0x22')})['then'](function(_0x5caf56){_0x845031({'res':_0xb344('0x23')});});}});});}function insertCmHopper(_0x2406d9,_0x50fef9,_0x3164ae,_0x49581c,_0x3d7aa0){var _0x11fdc6=[_0xb344('0x24'),_0xb344('0x25'),_0xb344('0x26'),'cm_contacts.ListId',_0x50fef9+'.'+_0x49581c,_0xb344('0x27'),_0xb344('0x28'),_0xb344('0x29'),'cm_contacts.UserId','\x22'+_0x3d7aa0+'\x22'];return squel['insert']()[_0xb344('0x2a')](_0xb344('0x2b'))[_0xb344('0x2c')]([_0xb344('0xf'),_0xb344('0x2d'),_0xb344('0x2e'),'ListId',_0x49581c,_0xb344('0x2f'),_0xb344('0x30'),_0xb344('0x31'),_0xb344('0x32'),'recallme'],squel['select']()[_0xb344('0x33')](_0x11fdc6)[_0xb344('0x34')](_0x50fef9)['join']('cm_contacts',null,_0xb344('0x35')+_0x50fef9+_0xb344('0x36'))[_0xb344('0x10')](_0x3164ae,null,_0x3164ae+_0xb344('0x11')+_0x50fef9+'.'+_0x49581c)[_0xb344('0x13')](_0x50fef9+_0xb344('0x37'),_0x2406d9)['where'](_0xb344('0x38'),NOW)['where'](_0xb344('0x39'),selectNotIn(_0x50fef9,_0x3164ae,_0x49581c,_0xb344('0x2b'),[_0xb344('0x3a'),_0xb344('0x3b')]))[_0xb344('0x13')](_0xb344('0x39'),selectNotIn(_0x50fef9,_0x3164ae,_0x49581c,'cm_hopper',['\x22always\x22'])))[_0xb344('0x3c')]();}function insertCmHopperBlack(_0x44d602,_0x185545,_0x2f1d5c,_0x2160b1){var _0x45099=[_0xb344('0x24'),_0xb344('0x26'),'cm_contacts.ListId',_0x185545+'.'+_0x2160b1,_0xb344('0x27'),_0xb344('0x28')];return squel[_0xb344('0x3d')]()['into'](_0xb344('0x3e'))[_0xb344('0x2c')]([_0xb344('0xf'),_0xb344('0x2e'),_0xb344('0x3f'),_0x2160b1,_0xb344('0x2f'),_0xb344('0x30')],squel[_0xb344('0xe')]()[_0xb344('0x33')](_0x45099)['from'](_0x185545)[_0xb344('0x10')](_0xb344('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x185545+_0xb344('0x36'))[_0xb344('0x10')](_0x2f1d5c,null,_0x2f1d5c+_0xb344('0x11')+_0x185545+'.'+_0x2160b1)[_0xb344('0x13')](_0x185545+_0xb344('0x37'),_0x44d602)['where'](_0xb344('0x38'),NOW)[_0xb344('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb344('0xe')]()[_0xb344('0x41')](_0xb344('0xf'))[_0xb344('0x34')](_0xb344('0x3e'))[_0xb344('0x13')]('ListId\x20=\x20?',_0x44d602)[_0xb344('0x13')](_0x2160b1+_0xb344('0x12')+_0x185545+'.'+_0x2160b1)))[_0xb344('0x3c')]();}function insertTzCmHopper(_0x2e91fc,_0xfeea29,_0x48633e,_0x2f86a2,_0x2e860a,_0x502f1e){var _0x235f8a=[_0xb344('0x24'),_0xb344('0x42')+_0x502f1e+'.offset-cm_contacts.utcOffset\x20minute)',_0xb344('0x26'),_0xb344('0x43'),_0xfeea29+'.'+_0x2f86a2,_0xb344('0x27'),_0xb344('0x28'),_0xb344('0x29'),'cm_contacts.UserId','\x22'+_0x2e860a+'\x22'];var _0x4bdfd5=squel['insert']()[_0xb344('0x2a')](_0xb344('0x2b'))['fromQuery']([_0xb344('0xf'),_0xb344('0x2d'),'ContactId',_0xb344('0x3f'),_0x2f86a2,_0xb344('0x2f'),_0xb344('0x30'),'priority',_0xb344('0x32'),_0xb344('0x44')],squel['select']()[_0xb344('0x33')](_0x235f8a)[_0xb344('0x34')](_0xfeea29)['join'](_0xb344('0x40'),null,_0xb344('0x35')+_0xfeea29+_0xb344('0x36'))['join'](_0x48633e,null,_0x48633e+_0xb344('0x11')+_0xfeea29+'.'+_0x2f86a2)[_0xb344('0x10')](_0x502f1e,null,_0x502f1e+_0xb344('0x11')+_0xfeea29+'.'+_0x2f86a2)['where'](_0xfeea29+_0xb344('0x37'),_0x2e91fc)[_0xb344('0x13')](_0xb344('0x38'),NOW)[_0xb344('0x13')](_0xb344('0x39'),selectNotIn(_0xfeea29,_0x48633e,_0x2f86a2,'cm_hopper',[_0xb344('0x3a'),'\x22onlyIfOpen\x22']))[_0xb344('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xfeea29,_0x48633e,_0x2f86a2,_0xb344('0x2b'),[_0xb344('0x3a')])))[_0xb344('0x3c')]();return _0x4bdfd5;}function insertTzCmHopperBlack(_0xf43bd6,_0x2862fc,_0x42022c,_0x5d4472){var _0x23d6cd=['cm_contacts.phone',_0xb344('0x26'),_0xb344('0x43'),_0x2862fc+'.'+_0x5d4472,_0xb344('0x27'),_0xb344('0x28')];return squel['insert']()['into']('cm_hopper_black')[_0xb344('0x2c')]([_0xb344('0xf'),_0xb344('0x2e'),_0xb344('0x3f'),_0x5d4472,_0xb344('0x2f'),_0xb344('0x30')],squel[_0xb344('0xe')]()['fields'](_0x23d6cd)[_0xb344('0x34')](_0x2862fc)[_0xb344('0x10')](_0xb344('0x40'),null,_0xb344('0x35')+_0x2862fc+_0xb344('0x36'))[_0xb344('0x10')](_0x42022c,null,_0x42022c+_0xb344('0x11')+_0x2862fc+'.'+_0x5d4472)[_0xb344('0x13')](_0x2862fc+_0xb344('0x37'),_0xf43bd6)['where'](_0xb344('0x38'),NOW)[_0xb344('0x13')](_0xb344('0x39'),squel[_0xb344('0xe')]()['field'](_0xb344('0xf'))[_0xb344('0x34')](_0xb344('0x3e'))['where'](_0xb344('0x45'),_0xf43bd6)[_0xb344('0x13')](_0x5d4472+'\x20=\x20'+_0x2862fc+'.'+_0x5d4472)))[_0xb344('0x3c')]();}function insertCmHopperAdditionalPhones(_0x32815b){var _0x1893ab=[_0xb344('0x46'),_0xb344('0x47'),'cm_contact_has_items.OrderBy',_0xb344('0x48'),_0xb344('0x49')];return squel['insert']()[_0xb344('0x2a')]('cm_hopper_additional_phones')[_0xb344('0x2c')]([_0xb344('0x4a'),_0xb344('0xf'),_0xb344('0x4b'),_0xb344('0x2f'),_0xb344('0x30')],squel['select']()[_0xb344('0x33')](_0x1893ab)[_0xb344('0x34')](_0xb344('0x2b'))[_0xb344('0x10')](_0xb344('0x40'),null,_0xb344('0x4c'))[_0xb344('0x10')](_0xb344('0x4d'),null,_0xb344('0x4e'))[_0xb344('0x13')](_0xb344('0x4f'),_0x32815b)[_0xb344('0x13')](_0xb344('0x38'),NOW))[_0xb344('0x3c')]();}function insertCmContact(_0x56367f,_0x10029e,_0x188f9c,_0x1259d6){var _0x140821=_[_0xb344('0x50')](_[_0xb344('0x51')](_0x1259d6),[_0xb344('0x3f'),_0xb344('0x52'),_0xb344('0x2f'),_0xb344('0x30')]);return squel[_0xb344('0x3d')]()['into'](_0xb344('0x40'))[_0xb344('0x2c')](_0x140821,squel['select']()[_0xb344('0x33')](_0x140821)[_0xb344('0x34')](_0x10029e)[_0xb344('0x13')]('('+_0x188f9c[_0xb344('0x10')](',')+_0xb344('0x53'),squel[_0xb344('0xe')]()[_0xb344('0x33')](_0x188f9c)[_0xb344('0x34')](_0xb344('0x40'))[_0xb344('0x13')](_0xb344('0x45'),_0x56367f)[_0xb344('0x13')](_0xb344('0x54')))[_0xb344('0x13')]('id\x20IN\x20?',squel[_0xb344('0xe')]()['field'](_0xb344('0x55'),'min_id')[_0xb344('0x34')](_0x10029e)[_0xb344('0x56')](_0x188f9c['join'](','))))[_0xb344('0x3c')]();}function handleStop(){logger['info'](_0xb344('0x57'));stopped=!![];}function handleUncaughtException(_0x522cfc){logger[_0xb344('0x58')](_0x522cfc[_0xb344('0x59')]);process[_0xb344('0x5a')](0x1);}function handleError(_0x564501,_0x1a3cb7){stats[_0xb344('0x5b')][_0xb344('0x19')]({'name':_0x1a3cb7[_0xb344('0x5c')],'message':_0x1a3cb7[_0xb344('0x59')],'row':_0x564501});}function handleQuery(_0x287949){logger[_0xb344('0x5d')](_0x287949);return db[_0xb344('0x5e')][_0xb344('0x5f')](_0x287949)['spread'](function(_0xe8d987){results[_0xb344('0x19')](_0xe8d987);})[_0xb344('0x60')](function(_0x63fc3d){logger[_0xb344('0x58')](_0x63fc3d['message']);});}function updateTzCampaigns(_0x1d3f9a){return new Promise(function(_0x324678,_0x102cba){var _0x2a0861=squel[_0xb344('0xe')]()['fields']([_0xb344('0x61'),'campaigns.dialTimezone'])['from'](_0xb344('0x62'))[_0xb344('0x10')]('campaigns_has_cm_lists',null,_0xb344('0x63'))[_0xb344('0x13')](_0xb344('0x64')+_0x1d3f9a);db[_0xb344('0x5e')][_0xb344('0x5f')](_0x2a0861[_0xb344('0x3c')]())[_0xb344('0x65')](function(_0x3d7e1c){var _0x2faf08=[];for(var _0x209963=0x0;_0x209963<_0x3d7e1c[_0xb344('0x18')];_0x209963++){_0x2faf08[_0xb344('0x19')](getTimezoneData(_0x3d7e1c[_0x209963],tmp_campaigns));}BPromise[_0xb344('0x1a')](_0x2faf08)['then'](function(){_0x324678({'val':0x1});});})['catch'](function(_0x1b32df){logger['error'](_0x1b32df[_0xb344('0x59')]);_0x324678({'val':0x0});});});}function updateTzVoiceQueues(_0x40b5cc){return new Promise(function(_0x19392f,_0x1f593f){var _0x1aa22b=squel['select']()[_0xb344('0x33')]([_0xb344('0x66'),_0xb344('0x67')])[_0xb344('0x34')](_0xb344('0x68'))['join']('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xb344('0x69')+_0x40b5cc);db[_0xb344('0x5e')]['query'](_0x1aa22b['toString']())['spread'](function(_0x2b75b5){var _0x1f50c4=[];for(var _0xeba021=0x0;_0xeba021<_0x2b75b5[_0xb344('0x18')];_0xeba021++){_0x1f50c4[_0xb344('0x19')](getTimezoneData(_0x2b75b5[_0xeba021],tmp_voice_queues));}BPromise['all'](_0x1f50c4)['then'](function(){_0x19392f({'val':0x1});});})['catch'](function(_0x2d88c4){logger[_0xb344('0x58')](_0x2d88c4[_0xb344('0x59')]);_0x19392f({'val':0x0});});});}function getTimezoneData(_0xa673d9,_0x4a8563){return new Promise(function(_0xe33b51,_0x341fe8){var _0x1e80eb=shared[_0xb344('0x6a')];var _0x37781a=_0x1e80eb[_0xa673d9['dialTimezone']];if(_[_0xb344('0x6b')](_0x37781a)){_0xe33b51({'ret':0x1});}else{var _0x5a4a87=_0x37781a[_0xb344('0x6c')];var _0x247a6d=squel[_0xb344('0x3d')]()['into'](_0x4a8563)['set']('id',_0xa673d9['id'])[_0xb344('0x6d')]('offset',_0x5a4a87)['set'](_0xb344('0x6e'),_0xa673d9[_0xb344('0x6e')])[_0xb344('0x3c')]();return db[_0xb344('0x5e')][_0xb344('0x5f')](_0x247a6d)['spread'](function(_0xbcf911){_0xe33b51({'ret':0x1});})[_0xb344('0x60')](function(_0x3734dc){logger[_0xb344('0x58')](_0x3734dc['message']);_0x341fe8({'ret':0x1});});}});}function handleTZQuery(_0xda06b1){logger['info'](_0xda06b1);return db['sequelize'][_0xb344('0x5f')](_0xda06b1)[_0xb344('0x65')](function(_0x86772e){})[_0xb344('0x60')](function(_0x38c30d){logger['error'](_0x38c30d[_0xb344('0x59')]);});}function main(_0x55d748,_0x2545a5,_0xe09c44,_0xc0fe9){logger[_0xb344('0x5d')](_0xb344('0x6f'),_0x55d748,JSON[_0xb344('0x70')](_0x2545a5));process[_0xb344('0x71')](_0xb344('0x72'));var _0x5b6f2e=_0x2545a5[_0xb344('0x73')];var _0x52e3c9=_[_0xb344('0x74')](_0x5b6f2e);var _0x3aaa6e=_0x2545a5[_0xb344('0x75')];var _0x1fd610=path[_0xb344('0x10')](config[_0xb344('0x76')],_0xb344('0x77'),_0x3aaa6e+_0xb344('0x78'));hasTZ=_[_0xb344('0x51')](_0x5b6f2e)[_0xb344('0x79')](_0xb344('0x6e'));var _0x203241=_[_0xb344('0x51')](_0x5b6f2e)[_0xb344('0x10')]();logger['info'](_0xb344('0x7a'),_0x203241);db[_0xb344('0x7b')]['findAll']({'raw':!![],'attributes':['id',_0xb344('0x7c')]})[_0xb344('0x1b')](function(_0x425088){for(var _0x3a6725=0x0;_0x3a6725<_0x425088[_0xb344('0x18')];_0x3a6725++){if(_0x425088[_0x3a6725]['name']in _0x5b6f2e){contactItemTypes['push'](_0x425088[_0x3a6725]);delete _0x52e3c9[_0x425088[_0x3a6725]['name']];hasAdditionalPhones=!![];}for(var _0x337224 in _0x5b6f2e){if(_0x425088[_0x3a6725][_0xb344('0x7c')]+'_description'===_0x337224){phoneDescriptions[_0xb344('0x19')]({'itemTypeId':_0x425088[_0x3a6725]['id'],'description':_0x337224});delete _0x52e3c9[_0x337224];}}}if(hasAdditionalPhones)_0x52e3c9['AdditionalPhones']='';var _0x1dc9ad=_[_0xb344('0x51')](_0x52e3c9)[_0xb344('0x10')]();logger[_0xb344('0x5d')](_0xb344('0x7a'),_0x1dc9ad);fs[_0xb344('0x7d')](_0x1fd610,_0x1dc9ad+'\x0a');Papa[_0xb344('0x7e')](fs[_0xb344('0x7f')](_0x55d748),{'header':!![],'skipEmptyLines':!![],'step':function(_0x17cc7a,_0x2849bc){try{for(var _0x3a1aeb=0x0,_0xe7a62=[];_0x3a1aeb<_0x17cc7a[_0xb344('0x80')][_0xb344('0x18')];_0x3a1aeb++){stats[_0xb344('0x81')]+=0x1;if(_0x17cc7a[_0xb344('0x5b')][_0x3a1aeb]){handleError(_0x17cc7a[_0xb344('0x80')][_0x3a1aeb],_0x17cc7a['errors'][_0x3a1aeb]);}else{var _0x5ed8c9=[];var _0xed3320=[];var _0x22b975={};for(var _0x2acea5 in _0x5b6f2e){let _0x171398=contactItemTypes[_0xb344('0x82')](_0x49228c=>_0x49228c['name']===_0x2acea5);let _0x16ce9c=contactItemTypes[_0xb344('0x82')](_0x40ba08=>_0x40ba08[_0xb344('0x7c')]+_0xb344('0x83')===_0x2acea5);if(_[_0xb344('0x6b')](_0x171398)&&_['isNil'](_0x16ce9c)){if(_0x5b6f2e[_0xb344('0x84')](_0x2acea5)){if(_0x17cc7a[_0xb344('0x80')][_0x3a1aeb][_0x5b6f2e[_0x2acea5]]){var _0x4db197=_['trim'](_0x17cc7a[_0xb344('0x80')][_0x3a1aeb][_0x5b6f2e[_0x2acea5]][_0xb344('0x85')](/"/g,'\x27'));switch(_0x2acea5){case'scheduledat':var _0xb07b3b=moment(_0x4db197,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xb07b3b[_0xb344('0x86')]()){_0xe7a62[_0xb344('0x19')]('\x22'+_0x4db197+'\x22');}else{_0x5ed8c9[_0xb344('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb344('0x31'):var _0x22acb8=parseInt(_0x4db197);_0x4db197=_[_0xb344('0x87')](_0x22acb8)||_0x22acb8<0x0||_0x22acb8>0x4?_0xc0fe9?0x3:0x2:_0x22acb8;_0xe7a62[_0xb344('0x19')]('\x22'+_0x4db197+'\x22');break;case _0xb344('0x32'):var _0x1fd205=parseInt(_0x4db197);if(_[_0xb344('0x88')](_0x1fd205)&&_[_0xb344('0x79')](_0xe09c44,_0x1fd205)){_0xe7a62[_0xb344('0x19')]('\x22'+_0x1fd205+'\x22');}else{_0x5ed8c9[_0xb344('0x19')](_0xb344('0x89'));}break;case _0xb344('0x8a'):if(isEmail(_0x4db197)){_0xe7a62[_0xb344('0x19')]('\x22'+_0x4db197+'\x22');}else{_0x5ed8c9['push'](_0xb344('0x8b'));}break;case _0xb344('0x8c'):var _0x9830c4=moment(_0x4db197,_0xb344('0x8d'),!![]);if(_0x9830c4[_0xb344('0x86')]()){_0xe7a62['push']('\x22'+_0x4db197+'\x22');}else{_0x5ed8c9[_0xb344('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xb344('0x6e'):var _0x2d590c=shared[_0xb344('0x6a')];var _0x5600f9=_0x2d590c[_0x4db197];if(!_['isNil'](_0x5600f9)){var _0x7d6107=_0x5600f9[_0xb344('0x6c')];_0xe7a62[_0xb344('0x19')]('\x22'+_0x4db197+'\x22');_0xe7a62[_0xb344('0x19')]('\x22'+_0x7d6107+'\x22');}break;default:_0xe7a62[_0xb344('0x19')]('\x22'+_0x4db197+'\x22');}}else{switch(_0x2acea5){case _0xb344('0x8e'):case'phone':_0x5ed8c9[_0xb344('0x19')](_0x2acea5+'\x20not\x20specified');break;default:_0xe7a62[_0xb344('0x19')]('\x22\x22');}}}}else{var _0x4c5634='';if(!_[_0xb344('0x6b')](_0x171398)){if(!_0x22b975[_0xb344('0x84')](_0x171398['id'])){if(!_[_0xb344('0x6b')](_0x17cc7a[_0xb344('0x80')][_0x3a1aeb][_0x5b6f2e[_0x2acea5]])){var _0x4db197=_[_0xb344('0x8f')](_0x17cc7a['data'][_0x3a1aeb][_0x5b6f2e[_0x2acea5]][_0xb344('0x85')](/"/g,'\x27'));var _0x23fb5b=phoneDescriptions[_0xb344('0x82')](_0x3fcf14=>_0x3fcf14[_0xb344('0x90')]===_0x171398['id']);if(!_[_0xb344('0x6b')](_0x23fb5b)){var _0x3840cf=_[_0xb344('0x8f')](_0x17cc7a[_0xb344('0x80')][_0x3a1aeb][_0x5b6f2e[_0x23fb5b[_0xb344('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0xb344('0x6b')](_0x3840cf))_0x4db197=_0x4db197+'§'+_0x3840cf;}if(_0x4c5634=='')_0x4c5634=_0x4db197;else _0x4c5634+='|'+_0x4db197;}_0xed3320[_0xb344('0x19')](_0x171398['id']+':'+_0x4c5634);_0x22b975[_0x171398['id']]=0x1;}}}}if(hasAdditionalPhones){_0xe7a62[_0xb344('0x19')]('\x22'+_0xed3320[_0xb344('0x10')](';')+'\x22');}if(_0x5ed8c9['length']){handleError(_0x17cc7a[_0xb344('0x80')][_0x3a1aeb],{'code':_0xb344('0x92'),'message':_0x5ed8c9[_0xb344('0x10')]()});}else{fs[_0xb344('0x93')](_0x1fd610,_0xe7a62['join']()+'\x0a');}_0xe7a62=[];}if(!(stats['rows']%0xc8)){socket[_0xb344('0x94')](_0xb344('0x95')+_0x3aaa6e,stats);stats[_0xb344('0x5b')]=[];}}if(stopped){logger[_0xb344('0x5d')](_0xb344('0x96'));_0x2849bc[_0xb344('0x97')]();}}catch(_0x29a6ea){handleError(_0x17cc7a[_0xb344('0x80')][_0x3a1aeb],{'code':'SystemError','message':_0x29a6ea[_0xb344('0x59')]});logger[_0xb344('0x58')](_0xb344('0x98'),_0x29a6ea[_0xb344('0x59')]);}},'complete':function(){try{var _0x1f7127=[];var _0x5f4a2a=[];var _0xe8a6ce=_0xb344('0x40');if(_0x2545a5[_0xb344('0x99')]&&_0x2545a5[_0xb344('0x99')][_0xb344('0x18')]){_0xe8a6ce=_0xb344('0x9a')+_0x3aaa6e;_0x1f7127[_0xb344('0x19')](_0xb344('0x9b')+_0xe8a6ce+_0xb344('0x9c'));}tmp_campaigns=_0xb344('0x9d')+_0x3aaa6e;tmp_voice_queues=_0xb344('0x9e')+_0x3aaa6e;_0x5f4a2a['push'](_0xb344('0x9b')+tmp_campaigns+_0xb344('0x9f'));_0x5f4a2a[_0xb344('0x19')](_0xb344('0x9b')+tmp_voice_queues+_0xb344('0x9f'));BPromise[_0xb344('0xa0')](_0x5f4a2a,handleTZQuery)['then'](function(_0x24a918){updateTzCampaigns(_0x2545a5[_0xb344('0x3f')])['then'](function(_0x232e2b){updateTzVoiceQueues(_0x2545a5[_0xb344('0x3f')])[_0xb344('0x1b')](function(_0x9743d6){if(hasTZ)_0x1dc9ad=_0x1dc9ad[_0xb344('0x85')](_0xb344('0x6e'),_0xb344('0xa1'));var _0x4862ec=util[_0xb344('0xb')](_0xb344('0xa2'),_0x1fd610,_0xe8a6ce,_0x1dc9ad,_0x2545a5[_0xb344('0x3f')],_0x2545a5[_0xb344('0x52')]||null,NOW,NOW);if(_[_0xb344('0x6b')](_0x5b6f2e[_0xb344('0x2d')])){_0x4862ec+=_0xb344('0xa3');}_0x1f7127[_0xb344('0x19')](_0x4862ec);if(_0x2545a5[_0xb344('0x99')]&&_0x2545a5[_0xb344('0x99')][_0xb344('0x18')]){_0x1f7127[_0xb344('0x19')](insertCmContact(_0x2545a5[_0xb344('0x3f')],_0xe8a6ce,_0x2545a5['duplicates'],_0x5b6f2e));_0x1f7127[_0xb344('0x19')](_0xb344('0xa4')+_0xe8a6ce+';');}BPromise[_0xb344('0xa0')](_0x1f7127,handleQuery)['then'](function(_0xc654de){BPromise[_0xb344('0x1a')]([handleAdditionalPhones()])[_0xb344('0x1b')](function(){_0x1f7127=[];for(var _0x263ba0=0x0;_0x263ba0\x20\x20');}var _0x2cf97b=path[_0xb344('0x10')](config['root'],_0xb344('0x77'),process[_0xb344('0xb1')][0x2]);if(!fs[_0xb344('0xb2')](_0x2cf97b)){throw new Error(_0xb344('0xb3'));}var _0x563dc3={};try{_0x563dc3=JSON[_0xb344('0x7e')](process['argv'][0x3]);if(!_0x563dc3['binding']){throw new Error(_0xb344('0xb4'));}if(!_0x563dc3['binding'][_0xb344('0xf')]){throw new Error(_0xb344('0xb5'));}if(!_0x563dc3[_0xb344('0x73')]['firstName']){throw new Error(_0xb344('0xb6'));}var _0x701f38=0x0;if(_0x563dc3[_0xb344('0x73')][_0xb344('0x32')]){_0x701f38=0x1;}if(!_0x563dc3[_0xb344('0x3f')]){throw new Error(_0xb344('0xb7'));}}catch(_0x19f0ea){throw new Error(_0xb344('0xb8'));}var _0x1fca97=[];try{_0x1fca97=_[_0xb344('0xb9')](JSON['parse'](process[_0xb344('0xb1')][0x4]),'id');}catch(_0x2e198f){logger[_0xb344('0x5d')](_0xb344('0xba'));}main(_0x2cf97b,_0x563dc3,_0x1fca97,_0x701f38);}validate();process['on'](_0xb344('0xbb'),handleStop);process['on'](_0xb344('0xbc'),handleUncaughtException); \ No newline at end of file +var _0xc8fa=['fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','insert','updatedAt','cm_hopper_black','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','field','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','code','message','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','spread','timezones','dialTimezone','utcOffset','set','offset','main','stringify','binding','clone','root','server/files/tmp','.csv','includes','header','ContactItemType','findAll','name','writeFileSync','parse','data','rows','errors','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','campaigns_has_cm_blacklists','CampaignId','VoiceQueueId','finish','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','all','split','push','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme'];(function(_0x36c201,_0x46d047){var _0x4e6648=function(_0x3b48c8){while(--_0x3b48c8){_0x36c201['push'](_0x36c201['shift']());}};_0x4e6648(++_0x46d047);}(_0xc8fa,0x7f));var _0xac8f=function(_0x34355f,_0x16f4d0){_0x34355f=_0x34355f-0x0;var _0xb313a1=_0xc8fa[_0x34355f];return _0xb313a1;};'use strict';var fs=require('fs');var path=require(_0xac8f('0x0'));var _=require(_0xac8f('0x1'));var Papa=require(_0xac8f('0x2'));var util=require(_0xac8f('0x3'));var BPromise=require(_0xac8f('0x4'));var moment=require(_0xac8f('0x5'));var squel=require(_0xac8f('0x6'));var Redis=require('ioredis');var db=require(_0xac8f('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0xac8f('0x8'));var logger=require(_0xac8f('0x9'))(_0xac8f('0xa'));config['redis']=_['defaults'](config[_0xac8f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac8f('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xac8f('0xc')](_0xac8f('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xac8f('0xc')](_0xac8f('0xd'));function isEmail(_0x28574b){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))*$/[_0xac8f('0xe')](_0x28574b);}function selectNotIn(_0x3e522a,_0xc35335,_0x51ec05,_0x518595,_0x168c84){return squel[_0xac8f('0xf')]()['field'](_0xac8f('0x10'))[_0xac8f('0x11')](_0x518595)[_0xac8f('0x12')](_0xc35335,null,_0xc35335+_0xac8f('0x13')+_0x518595+'.'+_0x51ec05)[_0xac8f('0x14')](_0x518595+'.'+_0x51ec05+_0xac8f('0x15')+_0x3e522a+'.'+_0x51ec05)[_0xac8f('0x14')](_0xc35335+_0xac8f('0x16')+_0x168c84[_0xac8f('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3fcd28,_0x4d3ebf){promisesAdditionalPhones=[];return db[_0xac8f('0x17')]['findAll']({'raw':!![],'attributes':['id',_0xac8f('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xac8f('0x19')](function(_0x2baec8){if(_0x2baec8!==null){var _0x17fe26=[];for(var _0x3444c2=0x0;_0x3444c2<_0x2baec8[_0xac8f('0x1a')];_0x3444c2++){var _0x2fdf99=_0x2baec8[_0x3444c2];_0x17fe26['push'](insertAdditionalPhones(_0x2fdf99));}}Promise[_0xac8f('0x1b')](_0x17fe26)['then'](function(){_0x3fcd28({'val':0x1});});});});}function insertAdditionalPhones(_0x5a1a3f){return new Promise(function(_0x2da357,_0x33f6c7){var _0x239c63=_0x5a1a3f[_0xac8f('0x18')];var _0x56ad35=_0x239c63[_0xac8f('0x1c')](';');var _0x2d2488=[];orderBy=0x0;for(var _0x21fa1b=0x0;_0x21fa1b<_0x56ad35[_0xac8f('0x1a')];_0x21fa1b++){_0x2d2488[_0xac8f('0x1d')](splitAdditionalPhone(_0x5a1a3f['id'],_0x56ad35[_0x21fa1b]));}Promise[_0xac8f('0x1b')](_0x2d2488)[_0xac8f('0x19')](function(){_0x2da357({'val':_0x56ad35[_0xac8f('0x1a')]});});});}function splitAdditionalPhone(_0xf87da7,_0x3ccd0a){return new Promise(function(_0x5dc955,_0x3db76b){var _0x4858b7=_0x3ccd0a[_0xac8f('0x1c')](':');var _0x125240=_0x4858b7[0x0];var _0x194af9=_0x4858b7[0x1];if(!_[_0xac8f('0x1e')](_0x194af9)){var _0x2d4cee=_0x194af9['split']('|');var _0x41306d=[];for(var _0x5b0dfb=0x0;_0x5b0dfb<_0x2d4cee['length'];_0x5b0dfb++){if(_0x2d4cee[_0x5b0dfb]!==''){var _0x109185=_[_0xac8f('0x1f')](promisesAdditionalPhones,{'contactId':_0xf87da7,'phone':_0x2d4cee[_0x5b0dfb]});if(_0x109185[_0xac8f('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xac8f('0x1d')]({'contactId':_0xf87da7,'contactTypeId':_0x125240,'phone':_0x2d4cee[_0x5b0dfb],'orderBy':orderBy});}}}_0x5dc955({'ok':0x1});}else _0x5dc955({'res':0x0});});}function createAdditionalPhone(_0x5d6670,_0x176bd4,_0x1dd55b,_0x3e126c){var _0x424ba7='';var _0x54bebc='';var _0x17dd5a=_0x1dd55b[_0xac8f('0x1c')]('§');_0x424ba7=_0x17dd5a[0x0];if(_0x17dd5a[_0xac8f('0x1a')]==0x2)_0x54bebc=_0x17dd5a[0x1];return new Promise(function(_0x44ed2b,_0x249b32){return db[_0xac8f('0x20')][_0xac8f('0x21')]({'where':{'CmContactId':_0x5d6670,'item':_0x424ba7}})['then'](function(_0x30670e){if(_0x30670e){return db[_0xac8f('0x20')][_0xac8f('0x22')]({'ItemTypeId':_0x176bd4,'description':_0x54bebc,'OrderBy':_0x3e126c},{'where':{'CmContactId':_0x5d6670,'item':_0x424ba7}})[_0xac8f('0x19')](function(_0x4f3053){_0x44ed2b({'res':_0xac8f('0x23')});});}else{return db[_0xac8f('0x20')][_0xac8f('0x24')]({'CmContactId':_0x5d6670,'item':_0x424ba7,'description':_0x54bebc,'ItemTypeId':_0x176bd4,'OrderBy':_0x3e126c,'ItemClass':_0xac8f('0x25')})[_0xac8f('0x19')](function(_0x476ec2){_0x44ed2b({'res':_0xac8f('0x26')});});}});});}function insertCmHopper(_0x2339c4,_0x409d53,_0x225825,_0x729fe2,_0x18f123){var _0x557d2b=['cm_contacts.phone',_0xac8f('0x27'),_0xac8f('0x28'),_0xac8f('0x29'),_0x409d53+'.'+_0x729fe2,_0xac8f('0x2a'),_0xac8f('0x2b'),_0xac8f('0x2c'),'cm_contacts.UserId','\x22'+_0x18f123+'\x22'];return squel['insert']()[_0xac8f('0x2d')]('cm_hopper')[_0xac8f('0x2e')]([_0xac8f('0x10'),_0xac8f('0x2f'),_0xac8f('0x30'),_0xac8f('0x31'),_0x729fe2,_0xac8f('0x32'),'updatedAt',_0xac8f('0x33'),_0xac8f('0x34'),_0xac8f('0x35')],squel[_0xac8f('0xf')]()[_0xac8f('0x36')](_0x557d2b)[_0xac8f('0x11')](_0x409d53)[_0xac8f('0x12')](_0xac8f('0x37'),null,_0xac8f('0x38')+_0x409d53+_0xac8f('0x39'))[_0xac8f('0x12')](_0x225825,null,_0x225825+_0xac8f('0x13')+_0x409d53+'.'+_0x729fe2)[_0xac8f('0x14')](_0x409d53+_0xac8f('0x3a'),_0x2339c4)[_0xac8f('0x14')](_0xac8f('0x3b'),NOW)[_0xac8f('0x14')](_0xac8f('0x3c'),selectNotIn(_0x409d53,_0x225825,_0x729fe2,_0xac8f('0x3d'),[_0xac8f('0x3e'),_0xac8f('0x3f')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x409d53,_0x225825,_0x729fe2,'cm_hopper',[_0xac8f('0x3e')])))[_0xac8f('0x40')]();}function insertCmHopperBlack(_0x2d2d1b,_0x12fb92,_0x37a180,_0xbf2d73){var _0x3d0703=[_0xac8f('0x41'),_0xac8f('0x28'),_0xac8f('0x29'),_0x12fb92+'.'+_0xbf2d73,'cm_contacts.createdAt',_0xac8f('0x2b')];return squel[_0xac8f('0x42')]()[_0xac8f('0x2d')]('cm_hopper_black')[_0xac8f('0x2e')](['phone',_0xac8f('0x30'),_0xac8f('0x31'),_0xbf2d73,_0xac8f('0x32'),_0xac8f('0x43')],squel[_0xac8f('0xf')]()[_0xac8f('0x36')](_0x3d0703)[_0xac8f('0x11')](_0x12fb92)[_0xac8f('0x12')]('cm_contacts',null,_0xac8f('0x38')+_0x12fb92+_0xac8f('0x39'))['join'](_0x37a180,null,_0x37a180+'.id\x20=\x20'+_0x12fb92+'.'+_0xbf2d73)[_0xac8f('0x14')](_0x12fb92+_0xac8f('0x3a'),_0x2d2d1b)[_0xac8f('0x14')](_0xac8f('0x3b'),NOW)['where'](_0xac8f('0x3c'),squel[_0xac8f('0xf')]()['field'](_0xac8f('0x10'))[_0xac8f('0x11')](_0xac8f('0x44'))[_0xac8f('0x14')](_0xac8f('0x45'),_0x2d2d1b)['where'](_0xbf2d73+_0xac8f('0x15')+_0x12fb92+'.'+_0xbf2d73)))[_0xac8f('0x40')]();}function insertTzCmHopper(_0x3dc88b,_0x6986e2,_0x155b56,_0x47a19f,_0x133ffd,_0x355d4f){var _0x3f979e=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x355d4f+_0xac8f('0x46'),_0xac8f('0x28'),_0xac8f('0x29'),_0x6986e2+'.'+_0x47a19f,'cm_contacts.createdAt',_0xac8f('0x2b'),'cm_contacts.priority',_0xac8f('0x47'),'\x22'+_0x133ffd+'\x22'];var _0x1e3e1a=squel[_0xac8f('0x42')]()[_0xac8f('0x2d')](_0xac8f('0x3d'))[_0xac8f('0x2e')]([_0xac8f('0x10'),_0xac8f('0x2f'),_0xac8f('0x30'),_0xac8f('0x31'),_0x47a19f,_0xac8f('0x32'),_0xac8f('0x43'),_0xac8f('0x33'),_0xac8f('0x34'),_0xac8f('0x35')],squel[_0xac8f('0xf')]()[_0xac8f('0x36')](_0x3f979e)['from'](_0x6986e2)[_0xac8f('0x12')](_0xac8f('0x37'),null,_0xac8f('0x38')+_0x6986e2+_0xac8f('0x39'))[_0xac8f('0x12')](_0x155b56,null,_0x155b56+_0xac8f('0x13')+_0x6986e2+'.'+_0x47a19f)['join'](_0x355d4f,null,_0x355d4f+_0xac8f('0x13')+_0x6986e2+'.'+_0x47a19f)[_0xac8f('0x14')](_0x6986e2+'.CmListId\x20=\x20?',_0x3dc88b)[_0xac8f('0x14')](_0xac8f('0x3b'),NOW)[_0xac8f('0x14')](_0xac8f('0x3c'),selectNotIn(_0x6986e2,_0x155b56,_0x47a19f,_0xac8f('0x3d'),[_0xac8f('0x3e'),'\x22onlyIfOpen\x22']))[_0xac8f('0x14')](_0xac8f('0x3c'),selectNotIn(_0x6986e2,_0x155b56,_0x47a19f,_0xac8f('0x3d'),[_0xac8f('0x3e')])))[_0xac8f('0x40')]();return _0x1e3e1a;}function insertTzCmHopperBlack(_0x32d7a7,_0x331774,_0x596716,_0x4908d0){var _0x1742db=[_0xac8f('0x41'),'cm_contacts.id','cm_contacts.ListId',_0x331774+'.'+_0x4908d0,_0xac8f('0x2a'),'cm_contacts.updatedAt'];return squel[_0xac8f('0x42')]()[_0xac8f('0x2d')](_0xac8f('0x44'))[_0xac8f('0x2e')]([_0xac8f('0x10'),_0xac8f('0x30'),_0xac8f('0x31'),_0x4908d0,'createdAt',_0xac8f('0x43')],squel['select']()[_0xac8f('0x36')](_0x1742db)[_0xac8f('0x11')](_0x331774)[_0xac8f('0x12')](_0xac8f('0x37'),null,_0xac8f('0x38')+_0x331774+'.CmListId')['join'](_0x596716,null,_0x596716+_0xac8f('0x13')+_0x331774+'.'+_0x4908d0)[_0xac8f('0x14')](_0x331774+_0xac8f('0x3a'),_0x32d7a7)['where'](_0xac8f('0x3b'),NOW)[_0xac8f('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xac8f('0xf')]()[_0xac8f('0x48')](_0xac8f('0x10'))[_0xac8f('0x11')](_0xac8f('0x44'))[_0xac8f('0x14')](_0xac8f('0x45'),_0x32d7a7)[_0xac8f('0x14')](_0x4908d0+'\x20=\x20'+_0x331774+'.'+_0x4908d0)))[_0xac8f('0x40')]();}function insertCmHopperAdditionalPhones(_0x1e6f9b){var _0x32c72e=['cm_hopper.id',_0xac8f('0x49'),'cm_contact_has_items.OrderBy',_0xac8f('0x4a'),'cm_contact_has_items.updatedAt'];return squel[_0xac8f('0x42')]()[_0xac8f('0x2d')](_0xac8f('0x4b'))[_0xac8f('0x2e')]([_0xac8f('0x4c'),'phone',_0xac8f('0x4d'),_0xac8f('0x32'),_0xac8f('0x43')],squel[_0xac8f('0xf')]()[_0xac8f('0x36')](_0x32c72e)[_0xac8f('0x11')](_0xac8f('0x3d'))[_0xac8f('0x12')](_0xac8f('0x37'),null,_0xac8f('0x4e'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xac8f('0x14')](_0xac8f('0x4f'),_0x1e6f9b)[_0xac8f('0x14')](_0xac8f('0x3b'),NOW))[_0xac8f('0x40')]();}function insertCmContact(_0x2d1181,_0x51ef9f,_0x138826,_0x4ba8fa){var _0x5eac11=_[_0xac8f('0x50')](_[_0xac8f('0x51')](_0x4ba8fa),['ListId','CompanyId',_0xac8f('0x32'),_0xac8f('0x43')]);return squel[_0xac8f('0x42')]()[_0xac8f('0x2d')](_0xac8f('0x37'))[_0xac8f('0x2e')](_0x5eac11,squel[_0xac8f('0xf')]()[_0xac8f('0x36')](_0x5eac11)[_0xac8f('0x11')](_0x51ef9f)[_0xac8f('0x14')]('('+_0x138826[_0xac8f('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0xac8f('0xf')]()[_0xac8f('0x36')](_0x138826)[_0xac8f('0x11')](_0xac8f('0x37'))[_0xac8f('0x14')](_0xac8f('0x45'),_0x2d1181)['where'](_0xac8f('0x52')))[_0xac8f('0x14')](_0xac8f('0x53'),squel[_0xac8f('0xf')]()[_0xac8f('0x48')](_0xac8f('0x54'),_0xac8f('0x55'))[_0xac8f('0x11')](_0x51ef9f)[_0xac8f('0x56')](_0x138826[_0xac8f('0x12')](','))))[_0xac8f('0x40')]();}function handleStop(){logger[_0xac8f('0x57')](_0xac8f('0x58'));stopped=!![];}function handleUncaughtException(_0x56eba2){logger[_0xac8f('0x59')](_0x56eba2['message']);process['exit'](0x1);}function handleError(_0x344e8a,_0x2ac9d3){stats['errors'][_0xac8f('0x1d')]({'name':_0x2ac9d3[_0xac8f('0x5a')],'message':_0x2ac9d3[_0xac8f('0x5b')],'row':_0x344e8a});}function handleQuery(_0x30040e){logger[_0xac8f('0x57')](_0x30040e);return db[_0xac8f('0x5c')][_0xac8f('0x5d')](_0x30040e)['spread'](function(_0x3e1ad1){results['push'](_0x3e1ad1);})[_0xac8f('0x5e')](function(_0xef38d9){logger[_0xac8f('0x59')](_0xef38d9[_0xac8f('0x5b')]);});}function updateTzCampaigns(_0x26ba4d){return new Promise(function(_0x1e54c1,_0x1da905){var _0x20a062=squel[_0xac8f('0xf')]()[_0xac8f('0x36')]([_0xac8f('0x5f'),_0xac8f('0x60')])[_0xac8f('0x11')](_0xac8f('0x61'))['join'](_0xac8f('0x62'),null,_0xac8f('0x63'))['where'](_0xac8f('0x64')+_0x26ba4d);db[_0xac8f('0x5c')][_0xac8f('0x5d')](_0x20a062[_0xac8f('0x40')]())['spread'](function(_0x25fbe2){var _0x1ac32d=[];for(var _0x2d791c=0x0;_0x2d791c<_0x25fbe2[_0xac8f('0x1a')];_0x2d791c++){_0x1ac32d[_0xac8f('0x1d')](getTimezoneData(_0x25fbe2[_0x2d791c],tmp_campaigns));}BPromise[_0xac8f('0x1b')](_0x1ac32d)[_0xac8f('0x19')](function(){_0x1e54c1({'val':0x1});});})[_0xac8f('0x5e')](function(_0x3cbc15){logger[_0xac8f('0x59')](_0x3cbc15[_0xac8f('0x5b')]);_0x1e54c1({'val':0x0});});});}function updateTzVoiceQueues(_0x1f66c2){return new Promise(function(_0x159ce6,_0x5b8045){var _0x30bd51=squel[_0xac8f('0xf')]()['fields']([_0xac8f('0x65'),_0xac8f('0x66')])[_0xac8f('0x11')](_0xac8f('0x67'))[_0xac8f('0x12')](_0xac8f('0x68'),null,_0xac8f('0x69'))['where'](_0xac8f('0x6a')+_0x1f66c2);db[_0xac8f('0x5c')]['query'](_0x30bd51[_0xac8f('0x40')]())[_0xac8f('0x6b')](function(_0x3a6db4){var _0x349358=[];for(var _0x5f010b=0x0;_0x5f010b<_0x3a6db4[_0xac8f('0x1a')];_0x5f010b++){_0x349358['push'](getTimezoneData(_0x3a6db4[_0x5f010b],tmp_voice_queues));}BPromise[_0xac8f('0x1b')](_0x349358)['then'](function(){_0x159ce6({'val':0x1});});})['catch'](function(_0x1a6adb){logger['error'](_0x1a6adb[_0xac8f('0x5b')]);_0x159ce6({'val':0x0});});});}function getTimezoneData(_0x220116,_0x5c8bb3){return new Promise(function(_0x42f341,_0x2fc1b3){var _0x4f152c=shared[_0xac8f('0x6c')];var _0x121539=_0x4f152c[_0x220116[_0xac8f('0x6d')]];if(_[_0xac8f('0x1e')](_0x121539)){_0x42f341({'ret':0x1});}else{var _0x55f1af=_0x121539[_0xac8f('0x6e')];var _0x452da2=squel[_0xac8f('0x42')]()[_0xac8f('0x2d')](_0x5c8bb3)[_0xac8f('0x6f')]('id',_0x220116['id'])['set'](_0xac8f('0x70'),_0x55f1af)[_0xac8f('0x6f')](_0xac8f('0x6d'),_0x220116[_0xac8f('0x6d')])[_0xac8f('0x40')]();return db[_0xac8f('0x5c')][_0xac8f('0x5d')](_0x452da2)[_0xac8f('0x6b')](function(_0x3e91ae){_0x42f341({'ret':0x1});})[_0xac8f('0x5e')](function(_0x33a134){logger[_0xac8f('0x59')](_0x33a134[_0xac8f('0x5b')]);_0x2fc1b3({'ret':0x1});});}});}function handleTZQuery(_0x4ba3e6){logger[_0xac8f('0x57')](_0x4ba3e6);return db[_0xac8f('0x5c')]['query'](_0x4ba3e6)[_0xac8f('0x6b')](function(_0x2ed8a1){})['catch'](function(_0x598cba){logger[_0xac8f('0x59')](_0x598cba['message']);});}function main(_0x5da39f,_0x2206e5,_0x6ea1be,_0xfa8e2e){logger[_0xac8f('0x57')](_0xac8f('0x71'),_0x5da39f,JSON[_0xac8f('0x72')](_0x2206e5));process['send']('start');var _0x2124cc=_0x2206e5[_0xac8f('0x73')];var _0x4ac131=_[_0xac8f('0x74')](_0x2124cc);var _0x28e497=_0x2206e5['socket_timestamp'];var _0x42af96=path[_0xac8f('0x12')](config[_0xac8f('0x75')],_0xac8f('0x76'),_0x28e497+_0xac8f('0x77'));hasTZ=_['keys'](_0x2124cc)[_0xac8f('0x78')](_0xac8f('0x6d'));var _0x19ea2e=_['keys'](_0x2124cc)[_0xac8f('0x12')]();logger[_0xac8f('0x57')](_0xac8f('0x79'),_0x19ea2e);db[_0xac8f('0x7a')][_0xac8f('0x7b')]({'raw':!![],'attributes':['id',_0xac8f('0x7c')]})[_0xac8f('0x19')](function(_0xac2ca4){for(var _0x52fe1d=0x0;_0x52fe1d<_0xac2ca4[_0xac8f('0x1a')];_0x52fe1d++){if(_0xac2ca4[_0x52fe1d]['name']in _0x2124cc){contactItemTypes[_0xac8f('0x1d')](_0xac2ca4[_0x52fe1d]);delete _0x4ac131[_0xac2ca4[_0x52fe1d][_0xac8f('0x7c')]];hasAdditionalPhones=!![];}for(var _0x4a3503 in _0x2124cc){if(_0xac2ca4[_0x52fe1d][_0xac8f('0x7c')]+'_description'===_0x4a3503){phoneDescriptions[_0xac8f('0x1d')]({'itemTypeId':_0xac2ca4[_0x52fe1d]['id'],'description':_0x4a3503});delete _0x4ac131[_0x4a3503];}}}if(hasAdditionalPhones)_0x4ac131[_0xac8f('0x18')]='';var _0x2f216f=_['keys'](_0x4ac131)[_0xac8f('0x12')]();logger[_0xac8f('0x57')](_0xac8f('0x79'),_0x2f216f);fs[_0xac8f('0x7d')](_0x42af96,_0x2f216f+'\x0a');Papa[_0xac8f('0x7e')](fs['createReadStream'](_0x5da39f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2952c5,_0x872019){try{for(var _0x337951=0x0,_0x2eb786=[];_0x337951<_0x2952c5[_0xac8f('0x7f')][_0xac8f('0x1a')];_0x337951++){stats[_0xac8f('0x80')]+=0x1;if(_0x2952c5[_0xac8f('0x81')][_0x337951]){handleError(_0x2952c5[_0xac8f('0x7f')][_0x337951],_0x2952c5[_0xac8f('0x81')][_0x337951]);}else{var _0x35f22c=[];var _0xa2b3b2=[];var _0x225efd={};for(var _0x3627a7 in _0x2124cc){let _0x567c3a=contactItemTypes['find'](_0x30f07c=>_0x30f07c[_0xac8f('0x7c')]===_0x3627a7);let _0x3d93f7=contactItemTypes[_0xac8f('0x82')](_0x1fe973=>_0x1fe973[_0xac8f('0x7c')]+'_description'===_0x3627a7);if(_[_0xac8f('0x1e')](_0x567c3a)&&_[_0xac8f('0x1e')](_0x3d93f7)){if(_0x2124cc[_0xac8f('0x83')](_0x3627a7)){if(_0x2952c5[_0xac8f('0x7f')][_0x337951][_0x2124cc[_0x3627a7]]){var _0x590ab8=_[_0xac8f('0x84')](_0x2952c5[_0xac8f('0x7f')][_0x337951][_0x2124cc[_0x3627a7]][_0xac8f('0x85')](/"/g,'\x27'));switch(_0x3627a7){case _0xac8f('0x2f'):var _0x37bf56=moment(_0x590ab8,_0xac8f('0xd'),!![]);if(_0x37bf56['isValid']()){_0x2eb786['push']('\x22'+_0x590ab8+'\x22');}else{_0x35f22c[_0xac8f('0x1d')](_0xac8f('0x86'));}break;case'priority':var _0x48c440=parseInt(_0x590ab8);_0x590ab8=_[_0xac8f('0x87')](_0x48c440)||_0x48c440<0x0||_0x48c440>0x4?_0xfa8e2e?0x3:0x2:_0x48c440;_0x2eb786[_0xac8f('0x1d')]('\x22'+_0x590ab8+'\x22');break;case _0xac8f('0x34'):var _0x3b98cc=parseInt(_0x590ab8);if(_[_0xac8f('0x88')](_0x3b98cc)&&_[_0xac8f('0x78')](_0x6ea1be,_0x3b98cc)){_0x2eb786[_0xac8f('0x1d')]('\x22'+_0x3b98cc+'\x22');}else{_0x35f22c[_0xac8f('0x1d')]('agent\x20not\x20exists');}break;case _0xac8f('0x89'):if(isEmail(_0x590ab8)){_0x2eb786[_0xac8f('0x1d')]('\x22'+_0x590ab8+'\x22');}else{_0x35f22c['push'](_0xac8f('0x8a'));}break;case _0xac8f('0x8b'):var _0x5114e9=moment(_0x590ab8,'YYYY-MM-DD',!![]);if(_0x5114e9[_0xac8f('0x8c')]()){_0x2eb786[_0xac8f('0x1d')]('\x22'+_0x590ab8+'\x22');}else{_0x35f22c[_0xac8f('0x1d')](_0xac8f('0x8d'));}break;case'dialTimezone':var _0x74c2d2=shared['timezones'];var _0x1d2069=_0x74c2d2[_0x590ab8];if(!_[_0xac8f('0x1e')](_0x1d2069)){var _0x34b723=_0x1d2069[_0xac8f('0x6e')];_0x2eb786[_0xac8f('0x1d')]('\x22'+_0x590ab8+'\x22');_0x2eb786['push']('\x22'+_0x34b723+'\x22');}break;default:_0x2eb786[_0xac8f('0x1d')]('\x22'+_0x590ab8+'\x22');}}else{switch(_0x3627a7){case _0xac8f('0x8e'):case _0xac8f('0x10'):_0x35f22c[_0xac8f('0x1d')](_0x3627a7+_0xac8f('0x8f'));break;default:_0x2eb786[_0xac8f('0x1d')]('\x22\x22');}}}}else{var _0x3b4d6c='';if(!_[_0xac8f('0x1e')](_0x567c3a)){if(!_0x225efd[_0xac8f('0x83')](_0x567c3a['id'])){if(!_[_0xac8f('0x1e')](_0x2952c5['data'][_0x337951][_0x2124cc[_0x3627a7]])){var _0x590ab8=_['trim'](_0x2952c5[_0xac8f('0x7f')][_0x337951][_0x2124cc[_0x3627a7]][_0xac8f('0x85')](/"/g,'\x27'));var _0x4c6100=phoneDescriptions[_0xac8f('0x82')](_0x154ba2=>_0x154ba2['itemTypeId']===_0x567c3a['id']);if(!_[_0xac8f('0x1e')](_0x4c6100)){var _0x1389b8=_[_0xac8f('0x84')](_0x2952c5[_0xac8f('0x7f')][_0x337951][_0x2124cc[_0x4c6100[_0xac8f('0x90')]]][_0xac8f('0x85')](/"/g,'\x27'));if(!_[_0xac8f('0x1e')](_0x1389b8))_0x590ab8=_0x590ab8+'§'+_0x1389b8;}if(_0x3b4d6c=='')_0x3b4d6c=_0x590ab8;else _0x3b4d6c+='|'+_0x590ab8;}_0xa2b3b2[_0xac8f('0x1d')](_0x567c3a['id']+':'+_0x3b4d6c);_0x225efd[_0x567c3a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2eb786[_0xac8f('0x1d')]('\x22'+_0xa2b3b2[_0xac8f('0x12')](';')+'\x22');}if(_0x35f22c[_0xac8f('0x1a')]){handleError(_0x2952c5[_0xac8f('0x7f')][_0x337951],{'code':_0xac8f('0x91'),'message':_0x35f22c[_0xac8f('0x12')]()});}else{fs[_0xac8f('0x92')](_0x42af96,_0x2eb786[_0xac8f('0x12')]()+'\x0a');}_0x2eb786=[];}if(!(stats[_0xac8f('0x80')]%0xc8)){socket['emit'](_0xac8f('0x93')+_0x28e497,stats);stats[_0xac8f('0x81')]=[];}}if(stopped){logger['info'](_0xac8f('0x94'));_0x872019[_0xac8f('0x95')]();}}catch(_0x3c6ce2){handleError(_0x2952c5[_0xac8f('0x7f')][_0x337951],{'code':'SystemError','message':_0x3c6ce2['message']});logger['error'](_0xac8f('0x96'),_0x3c6ce2[_0xac8f('0x5b')]);}},'complete':function(){try{var _0x4d5e64=[];var _0x9b8604=[];var _0x15e416=_0xac8f('0x37');if(_0x2206e5['duplicates']&&_0x2206e5[_0xac8f('0x97')][_0xac8f('0x1a')]){_0x15e416=_0xac8f('0x98')+_0x28e497;_0x4d5e64['push'](_0xac8f('0x99')+_0x15e416+_0xac8f('0x9a'));}tmp_campaigns=_0xac8f('0x9b')+_0x28e497;tmp_voice_queues=_0xac8f('0x9c')+_0x28e497;_0x9b8604[_0xac8f('0x1d')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x9b8604[_0xac8f('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xac8f('0x9d'));BPromise[_0xac8f('0x9e')](_0x9b8604,handleTZQuery)['then'](function(_0x4ce7cb){updateTzCampaigns(_0x2206e5['ListId'])[_0xac8f('0x19')](function(_0x304e47){updateTzVoiceQueues(_0x2206e5['ListId'])[_0xac8f('0x19')](function(_0x19210c){if(hasTZ)_0x2f216f=_0x2f216f[_0xac8f('0x85')]('dialTimezone',_0xac8f('0x9f'));var _0x4c4708=util[_0xac8f('0xc')]('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',_0x42af96,_0x15e416,_0x2f216f,_0x2206e5['ListId'],_0x2206e5[_0xac8f('0xa0')]||null,NOW,NOW);if(_[_0xac8f('0x1e')](_0x2124cc['scheduledat'])){_0x4c4708+=_0xac8f('0xa1');}_0x4d5e64[_0xac8f('0x1d')](_0x4c4708);if(_0x2206e5[_0xac8f('0x97')]&&_0x2206e5[_0xac8f('0x97')]['length']){_0x4d5e64[_0xac8f('0x1d')](insertCmContact(_0x2206e5[_0xac8f('0x31')],_0x15e416,_0x2206e5['duplicates'],_0x2124cc));_0x4d5e64[_0xac8f('0x1d')](_0xac8f('0xa2')+_0x15e416+';');}BPromise['each'](_0x4d5e64,handleQuery)['then'](function(_0x13ee9b){BPromise[_0xac8f('0x1b')]([handleAdditionalPhones()])[_0xac8f('0x19')](function(){_0x4d5e64=[];for(var _0x35a987=0x0;_0x35a987\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','select'];(function(_0x2cdce3,_0x53c6b6){var _0x4eefbb=function(_0x390f6a){while(--_0x390f6a){_0x2cdce3['push'](_0x2cdce3['shift']());}};_0x4eefbb(++_0x53c6b6);}(_0x9fda,0x8c));var _0xa9fd=function(_0x3b8cd4,_0xd18933){_0x3b8cd4=_0x3b8cd4-0x0;var _0x4514d6=_0x9fda[_0x3b8cd4];return _0x4514d6;};'use strict';var fs=require('fs');var path=require(_0xa9fd('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xa9fd('0x1'));var BPromise=require(_0xa9fd('0x2'));var moment=require(_0xa9fd('0x3'));var squel=require(_0xa9fd('0x4'));var Redis=require('ioredis');var db=require(_0xa9fd('0x5'))['db'];var config=require(_0xa9fd('0x6'));var logger=require('../../../config/logger')(_0xa9fd('0x7'));config[_0xa9fd('0x8')]=_['defaults'](config['redis'],{'host':_0xa9fd('0x9'),'port':0x18eb});var socket=require(_0xa9fd('0xa'))(new Redis(config[_0xa9fd('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xa9fd('0xb')](_0xa9fd('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0xa9fd('0xb')](_0xa9fd('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x32c4d2){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x32c4d2);}function selectNotIn(_0xe1b24b,_0x4a850d,_0x54846b,_0x4507f8,_0xa68009){return squel[_0xa9fd('0xe')]()['field'](_0xa9fd('0xf'))[_0xa9fd('0x10')](_0x4507f8)[_0xa9fd('0x11')](_0x4a850d,null,_0x4a850d+_0xa9fd('0x12')+_0x4507f8+'.'+_0x54846b)['where'](_0x4507f8+'.'+_0x54846b+_0xa9fd('0x13')+_0xe1b24b+'.'+_0x54846b)[_0xa9fd('0x14')](_0x4a850d+_0xa9fd('0x15')+_0xa68009[_0xa9fd('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x917449,_0x7e6347){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa9fd('0x16')][_0xa9fd('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0xa9fd('0x18')](function(_0x11221b){if(_0x11221b!==null){var _0x519060=[];for(var _0x5e581f=0x0;_0x5e581f<_0x11221b[_0xa9fd('0x19')];_0x5e581f++){var _0x1ec277=_0x11221b[_0x5e581f];if(!_[_0xa9fd('0x1a')](_0x1ec277[_0xa9fd('0xf')])){if(!_[_0xa9fd('0x1a')](_0x1ec277[_0xa9fd('0x1b')]))_0x519060[_0xa9fd('0x1c')](insertAdditionalPhones(_0x1ec277));promisesContact['push']({'contact':_0x1ec277});}}}Promise['all'](_0x519060)[_0xa9fd('0x1d')](function(){_0x917449({'val':0x1});});})[_0xa9fd('0x1e')](function(_0x31f75b){logger[_0xa9fd('0x1f')](_0x31f75b[_0xa9fd('0x20')]);});});}function insertAdditionalPhones(_0x3560b6){return new Promise(function(_0x7c1572,_0x56b4ad){var _0xa06c4b=_0x3560b6['AdditionalPhones'];if(_['isNil'](_0xa06c4b))_0x56b4ad({'val':0x0});else{var _0x53a26d=_0xa06c4b['split'](';');var _0x257cc0=[];orderBy=0x0;for(var _0x25ac35=0x0;_0x25ac35<_0x53a26d[_0xa9fd('0x19')];_0x25ac35++){_0x257cc0[_0xa9fd('0x1c')](splitAdditionalPhone(_0x3560b6['id'],_0x53a26d[_0x25ac35]));}Promise[_0xa9fd('0x21')](_0x257cc0)['then'](function(){_0x7c1572({'val':_0x53a26d[_0xa9fd('0x19')]});});}});}function splitAdditionalPhone(_0x134216,_0x5a59fe){return new Promise(function(_0x1575f9,_0x3787c7){var _0x3a370f=_0x5a59fe[_0xa9fd('0x22')](':');var _0xff7926=_0x3a370f[0x0];var _0x177eba=_0x3a370f[0x1];if(_0x177eba!==''){var _0x44a525=_0x177eba[_0xa9fd('0x22')]('|');var _0xddf48d=[];for(var _0x249484=0x0;_0x249484<_0x44a525[_0xa9fd('0x19')];_0x249484++){if(_0x44a525[_0x249484]!==''){var _0x31c216=_[_0xa9fd('0x23')](promisesAdditionalPhones,{'contactId':_0x134216,'phone':_0x44a525[_0x249484]});if(_0x31c216[_0xa9fd('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xa9fd('0x1c')]({'contactId':_0x134216,'contactTypeId':_0xff7926,'phone':_0x44a525[_0x249484],'orderBy':orderBy});}}}_0x1575f9({'ok':0x1});}else _0x1575f9({'res':0x0});});}function createAdditionalPhone(_0x31c3ec,_0x38f86c,_0x517a16,_0x10c696){var _0x1a4e69='';var _0x308ee7='';var _0x5cb7b4=_0x517a16[_0xa9fd('0x22')]('§');_0x1a4e69=_0x5cb7b4[0x0];if(_0x5cb7b4[_0xa9fd('0x19')]==0x2)_0x308ee7=_0x5cb7b4[0x1];return new Promise(function(_0x1b9852,_0x3381e1){return db[_0xa9fd('0x24')][_0xa9fd('0x25')]({'where':{'CmContactId':_0x31c3ec,'item':_0x1a4e69}})[_0xa9fd('0x1d')](function(_0x5f1cda){if(_0x5f1cda){return db[_0xa9fd('0x24')][_0xa9fd('0x26')]({'ItemTypeId':_0x38f86c,'description':_0x308ee7,'OrderBy':_0x10c696},{'where':{'CmContactId':_0x31c3ec,'item':_0x1a4e69}})[_0xa9fd('0x1d')](function(_0x5604d8){_0x1b9852({'res':_0xa9fd('0x27')});});}else{return db[_0xa9fd('0x24')][_0xa9fd('0x28')]({'CmContactId':_0x31c3ec,'item':_0x1a4e69,'ItemTypeId':_0x38f86c,'description':_0x308ee7,'OrderBy':_0x10c696,'ItemClass':_0xa9fd('0x29')})['then'](function(_0x689dba){_0x1b9852({'res':_0xa9fd('0x2a')});});}});});}function updateContact(_0xe679f8){return new Promise(function(_0x38199f,_0x2ffe4f){var _0xa17848=_0xe679f8['id'];delete _0xe679f8['id'];return db['CmContact']['update'](_0xe679f8,{'where':{'id':_0xa17848}})[_0xa9fd('0x1d')](function(_0x4582d9){updatedRows+=0x1;return db[_0xa9fd('0x2b')][_0xa9fd('0x26')]({'phone':_0xe679f8['phone']},{'where':{'ContactId':_0xa17848}})[_0xa9fd('0x1d')](function(_0x50a15b){_0x38199f({'ret':'OK'});});});});}function insertCmHopper(_0x5e6997,_0x55281f,_0x1c8989,_0x18af45,_0x5f5d65){var _0x3be234=[_0xa9fd('0x2c'),_0xa9fd('0x2d'),_0xa9fd('0x2e'),_0xa9fd('0x2f'),_0x55281f+'.'+_0x18af45,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0xa9fd('0x30'),'\x22'+_0x5f5d65+'\x22'];return squel[_0xa9fd('0x31')]()['into']('cm_hopper')[_0xa9fd('0x32')]([_0xa9fd('0xf'),_0xa9fd('0x33'),_0xa9fd('0x34'),_0xa9fd('0x35'),_0x18af45,_0xa9fd('0x36'),_0xa9fd('0x37'),_0xa9fd('0x38'),_0xa9fd('0x39'),_0xa9fd('0x3a')],squel[_0xa9fd('0xe')]()[_0xa9fd('0x3b')](_0x3be234)['from'](_0x55281f)[_0xa9fd('0x11')](_0xa9fd('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x55281f+_0xa9fd('0x3d'))[_0xa9fd('0x11')](_0x1c8989,null,_0x1c8989+_0xa9fd('0x12')+_0x55281f+'.'+_0x18af45)[_0xa9fd('0x14')](_0x55281f+_0xa9fd('0x3e'),_0x5e6997)['where'](_0xa9fd('0x3f'),NOW)[_0xa9fd('0x14')](_0xa9fd('0x40'),selectNotIn(_0x55281f,_0x1c8989,_0x18af45,_0xa9fd('0x41'),['\x22always\x22',_0xa9fd('0x42')]))[_0xa9fd('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x55281f,_0x1c8989,_0x18af45,_0xa9fd('0x41'),[_0xa9fd('0x43')])))[_0xa9fd('0x44')]();}function insertCmHopperBlack(_0x23f1de,_0x5c31a7,_0x2caf82,_0x209266){var _0x1803b0=[_0xa9fd('0x2c'),'cm_contacts.id','cm_contacts.ListId',_0x5c31a7+'.'+_0x209266,_0xa9fd('0x45'),_0xa9fd('0x46')];return squel[_0xa9fd('0x31')]()[_0xa9fd('0x47')](_0xa9fd('0x48'))[_0xa9fd('0x32')]([_0xa9fd('0xf'),'ContactId',_0xa9fd('0x35'),_0x209266,_0xa9fd('0x36'),_0xa9fd('0x37')],squel[_0xa9fd('0xe')]()[_0xa9fd('0x3b')](_0x1803b0)['from'](_0x5c31a7)['join'](_0xa9fd('0x3c'),null,_0xa9fd('0x49')+_0x5c31a7+_0xa9fd('0x3d'))['join'](_0x2caf82,null,_0x2caf82+_0xa9fd('0x12')+_0x5c31a7+'.'+_0x209266)[_0xa9fd('0x14')](_0x5c31a7+'.CmListId\x20=\x20?',_0x23f1de)[_0xa9fd('0x14')](_0xa9fd('0x3f'),NOW)[_0xa9fd('0x14')](_0xa9fd('0x40'),squel['select']()[_0xa9fd('0x4a')](_0xa9fd('0xf'))['from'](_0xa9fd('0x48'))[_0xa9fd('0x14')](_0xa9fd('0x4b'),_0x23f1de)[_0xa9fd('0x14')](_0x209266+_0xa9fd('0x4c'),_0x5c31a7+'.'+_0x209266)))[_0xa9fd('0x44')]();}function insertCmHopperAdditionalPhones(_0xea660){var _0x43f6e6=['cm_hopper.id',_0xa9fd('0x4d'),_0xa9fd('0x4e'),_0xa9fd('0x4f'),_0xa9fd('0x50')];return squel[_0xa9fd('0x31')]()[_0xa9fd('0x47')](_0xa9fd('0x51'))['fromQuery']([_0xa9fd('0x52'),_0xa9fd('0xf'),'OrderBy',_0xa9fd('0x36'),_0xa9fd('0x37')],squel['select']()[_0xa9fd('0x3b')](_0x43f6e6)[_0xa9fd('0x10')](_0xa9fd('0x41'))[_0xa9fd('0x11')](_0xa9fd('0x3c'),null,_0xa9fd('0x53'))[_0xa9fd('0x11')](_0xa9fd('0x54'),null,_0xa9fd('0x55'))[_0xa9fd('0x14')](_0xa9fd('0x56'),_0xea660)[_0xa9fd('0x14')](_0xa9fd('0x3f'),NOW))['toString']();}function insertCmContact(_0x29283d,_0x4a34e9,_0x1b42f5,_0x248651){var _0x512933=_[_0xa9fd('0x57')](_[_0xa9fd('0x58')](_0x248651),[_0xa9fd('0x35'),_0xa9fd('0x59'),_0xa9fd('0x36'),'updatedAt']);return squel[_0xa9fd('0x31')]()[_0xa9fd('0x47')](_0xa9fd('0x3c'))[_0xa9fd('0x32')](_0x512933,squel[_0xa9fd('0xe')]()[_0xa9fd('0x3b')](_0x512933)['from'](_0x4a34e9)[_0xa9fd('0x14')]('('+_0x1b42f5[_0xa9fd('0x11')](',')+_0xa9fd('0x5a'),squel['select']()[_0xa9fd('0x3b')](_0x1b42f5)[_0xa9fd('0x10')](_0xa9fd('0x3c'))[_0xa9fd('0x14')](_0xa9fd('0x4b'),_0x29283d))[_0xa9fd('0x14')](_0xa9fd('0x5b'),squel[_0xa9fd('0xe')]()[_0xa9fd('0x4a')](_0xa9fd('0x5c'),'min_id')[_0xa9fd('0x10')](_0x4a34e9)['group'](_0x1b42f5[_0xa9fd('0x11')](','))))[_0xa9fd('0x44')]();}function handleStop(){logger[_0xa9fd('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x195925){logger['error'](_0x195925['message']);process[_0xa9fd('0x5e')](0x1);}function handleError(_0x9d73fa,_0x4ed1ed){stats[_0xa9fd('0x5f')][_0xa9fd('0x1c')]({'name':_0x4ed1ed[_0xa9fd('0x60')],'message':_0x4ed1ed[_0xa9fd('0x20')],'row':_0x9d73fa});}function handleQuery(_0x5f992){logger[_0xa9fd('0x5d')](_0x5f992);return db[_0xa9fd('0x16')][_0xa9fd('0x17')](_0x5f992)[_0xa9fd('0x18')](function(_0x157e8f){results[_0xa9fd('0x1c')](_0x157e8f);})[_0xa9fd('0x1e')](function(_0x2916df){logger[_0xa9fd('0x1f')](_0x2916df['message']);});}function main(_0x594752,_0x2da898,_0xa9d11a,_0x2c9c6d){logger['info'](_0xa9fd('0x61'),_0x594752,JSON[_0xa9fd('0x62')](_0x2da898));process['send']('start');var _0x290d5e=_0x2da898[_0xa9fd('0x63')];var _0x1aa0c2=_[_0xa9fd('0x64')](_0x290d5e);var _0x2a30b9=_0x2da898[_0xa9fd('0x65')];var _0x5b8851=path['join'](config[_0xa9fd('0x66')],_0xa9fd('0x67'),_0x2a30b9+'.csv');logger[_0xa9fd('0x5d')]('body',_0x2da898);db[_0xa9fd('0x68')][_0xa9fd('0x69')]({'raw':!![],'attributes':['id',_0xa9fd('0x6a')]})[_0xa9fd('0x1d')](function(_0xcfd8f){for(var _0x4f97c1=0x0;_0x4f97c1<_0xcfd8f['length'];_0x4f97c1++){if(_0xcfd8f[_0x4f97c1]['name']in _0x290d5e){contactItemTypes[_0xa9fd('0x1c')](_0xcfd8f[_0x4f97c1]);delete _0x1aa0c2[_0xcfd8f[_0x4f97c1][_0xa9fd('0x6a')]];hasAdditionalPhones=!![];}for(var _0x17ec41 in _0x290d5e){if(_0xcfd8f[_0x4f97c1][_0xa9fd('0x6a')]+'_description'===_0x17ec41){phoneDescriptions[_0xa9fd('0x1c')]({'itemTypeId':_0xcfd8f[_0x4f97c1]['id'],'description':_0x17ec41});delete _0x1aa0c2[_0x17ec41];}}}if(hasAdditionalPhones)_0x1aa0c2[_0xa9fd('0x1b')]='';var _0x36ed7d=_[_0xa9fd('0x58')](_0x1aa0c2)['join']();logger['info'](_0xa9fd('0x6b'),_0x36ed7d);fs[_0xa9fd('0x6c')](_0x5b8851,_0x36ed7d+'\x0a');Papa['parse'](fs[_0xa9fd('0x6d')](_0x594752),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e8bef,_0x38b1e1){try{for(var _0x123ffb=0x0,_0x45086e=[];_0x123ffb<_0x3e8bef[_0xa9fd('0x6e')][_0xa9fd('0x19')];_0x123ffb++){stats['rows']+=0x1;if(_0x3e8bef[_0xa9fd('0x5f')][_0x123ffb]){handleError(_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb],_0x3e8bef[_0xa9fd('0x5f')][_0x123ffb]);}else{var _0x1a0eaf=[];var _0x18b971=[];var _0x4eac05={};for(var _0x1ff8f8 in _0x290d5e){let _0x1b14b1=contactItemTypes[_0xa9fd('0x6f')](_0x113ac=>_0x113ac[_0xa9fd('0x6a')]===_0x1ff8f8);let _0x93e829=contactItemTypes[_0xa9fd('0x6f')](_0x12910a=>_0x12910a[_0xa9fd('0x6a')]+'_description'===_0x1ff8f8);if(_[_0xa9fd('0x1a')](_0x1b14b1)&&_['isNil'](_0x93e829)){if(_0x290d5e[_0xa9fd('0x70')](_0x1ff8f8)){if(_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb][_0x290d5e[_0x1ff8f8]]){var _0x58fbc9=_[_0xa9fd('0x71')](_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb][_0x290d5e[_0x1ff8f8]][_0xa9fd('0x72')](/"/g,'\x27'));switch(_0x1ff8f8){case'scheduledat':var _0x14f3c3=moment(_0x58fbc9,_0xa9fd('0xc'),!![]);if(_0x14f3c3[_0xa9fd('0x73')]()){_0x45086e['push']('\x22'+_0x58fbc9+'\x22');}else{_0x1a0eaf['push'](_0xa9fd('0x74'));}break;case'priority':var _0x4a2f96=parseInt(_0x58fbc9);_0x58fbc9=_[_0xa9fd('0x75')](_0x4a2f96)||_0x4a2f96<0x0||_0x4a2f96>0x4?_0x2c9c6d?0x3:0x2:_0x4a2f96;_0x45086e['push']('\x22'+_0x58fbc9+'\x22');break;case'UserId':var _0x437edb=parseInt(_0x58fbc9);if(_[_0xa9fd('0x76')](_0x437edb)&&_[_0xa9fd('0x77')](_0xa9d11a,_0x437edb)){_0x45086e[_0xa9fd('0x1c')]('\x22'+_0x437edb+'\x22');}else{_0x1a0eaf[_0xa9fd('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x58fbc9)){_0x45086e[_0xa9fd('0x1c')]('\x22'+_0x58fbc9+'\x22');}else{_0x1a0eaf[_0xa9fd('0x1c')](_0xa9fd('0x78'));}break;case'dateOfBirth':var _0x35a583=moment(_0x58fbc9,_0xa9fd('0x79'),!![]);if(_0x35a583[_0xa9fd('0x73')]()){_0x45086e[_0xa9fd('0x1c')]('\x22'+_0x58fbc9+'\x22');}else{_0x1a0eaf['push'](_0xa9fd('0x7a'));}break;default:_0x45086e[_0xa9fd('0x1c')]('\x22'+_0x58fbc9+'\x22');}}else{switch(_0x1ff8f8){case _0xa9fd('0x7b'):case _0xa9fd('0xf'):_0x1a0eaf[_0xa9fd('0x1c')](_0x1ff8f8+_0xa9fd('0x7c'));break;default:_0x45086e[_0xa9fd('0x1c')]('\x22\x22');}}}}else{var _0x3147df='';if(!_[_0xa9fd('0x1a')](_0x1b14b1)){if(!_0x4eac05['hasOwnProperty'](_0x1b14b1['id'])){for(var _0x54f3ea=0x0;_0x54f3ea<_0x290d5e[_0x1ff8f8][_0xa9fd('0x19')];_0x54f3ea++){var _0x58fbc9=_['trim'](_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb][_0x290d5e[_0x1ff8f8][_0x54f3ea]][_0xa9fd('0x72')](/"/g,'\x27'));var _0x1fffeb=phoneDescriptions[_0xa9fd('0x6f')](_0x4bc35b=>_0x4bc35b['itemTypeId']===_0x1b14b1['id']);if(!_['isNil'](_0x1fffeb)){var _0x4ca7e8=_[_0xa9fd('0x71')](_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb][_0x290d5e[_0x1fffeb[_0xa9fd('0x7d')]][0x0]][_0xa9fd('0x72')](/"/g,'\x27'));if(!_['isNil'](_0x4ca7e8))_0x58fbc9=_0x58fbc9+'§'+_0x4ca7e8;}if(_0x3147df=='')_0x3147df=_0x58fbc9;else _0x3147df+='|'+_0x58fbc9;}_0x18b971[_0xa9fd('0x1c')](_0x1b14b1['id']+':'+_0x3147df);_0x4eac05[_0x1b14b1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45086e[_0xa9fd('0x1c')]('\x22'+_0x18b971[_0xa9fd('0x11')](';')+'\x22');}if(_0x1a0eaf['length']){handleError(_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb],{'code':_0xa9fd('0x7e'),'message':_0x1a0eaf[_0xa9fd('0x11')]()});}else{fs[_0xa9fd('0x7f')](_0x5b8851,_0x45086e[_0xa9fd('0x11')]()+'\x0a');}_0x45086e=[];}if(!(stats['rows']%0xc8)){socket[_0xa9fd('0x80')]('contact:import:'+_0x2a30b9,stats);stats[_0xa9fd('0x5f')]=[];}}if(stopped){logger[_0xa9fd('0x5d')]('Abort\x20parser');_0x38b1e1[_0xa9fd('0x81')]();}}catch(_0x5d9da2){handleError(_0x3e8bef[_0xa9fd('0x6e')][_0x123ffb],{'code':_0xa9fd('0x82'),'message':_0x5d9da2[_0xa9fd('0x20')]});logger[_0xa9fd('0x1f')](_0xa9fd('0x83'),_0x5d9da2['message']);}},'complete':function(){try{var _0x1cbff7=[];var _0x49d4c0=tempTableName;_0x1cbff7['push'](_0xa9fd('0x84')+_0x49d4c0+_0xa9fd('0x85'));logger[_0xa9fd('0x5d')](_0xa9fd('0x86'),contactItemTypes[_0xa9fd('0x19')]);var _0x446e3c=util[_0xa9fd('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x5b8851,_0x49d4c0,_0x36ed7d,_0x2da898[_0xa9fd('0x35')],_0x2da898[_0xa9fd('0x59')]||null,NOW,NOW);if(_[_0xa9fd('0x1a')](_0x290d5e[_0xa9fd('0x33')])){_0x446e3c+=_0xa9fd('0x87');}_0x1cbff7[_0xa9fd('0x1c')](_0x446e3c);BPromise['each'](_0x1cbff7,handleQuery)[_0xa9fd('0x1d')](function(_0x480338){BPromise['all']([handleAdditionalPhones()])[_0xa9fd('0x1d')](function(){_0x1cbff7=[];for(var _0x5959c7=0x0;_0x5959c7\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','create','PHONE','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','insert','into','cm_hopper_black','ListId','cm_contacts','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt'];(function(_0x4da59d,_0x31454e){var _0x433e8f=function(_0x92a117){while(--_0x92a117){_0x4da59d['push'](_0x4da59d['shift']());}};_0x433e8f(++_0x31454e);}(_0xe5e8,0xe7));var _0x8e5e=function(_0x560965,_0x4e2dd4){_0x560965=_0x560965-0x0;var _0x4eec6e=_0xe5e8[_0x560965];return _0x4eec6e;};'use strict';var fs=require('fs');var path=require(_0x8e5e('0x0'));var _=require(_0x8e5e('0x1'));var Papa=require(_0x8e5e('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x8e5e('0x3'));var Redis=require(_0x8e5e('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x8e5e('0x5'));var logger=require(_0x8e5e('0x6'))(_0x8e5e('0x7'));config[_0x8e5e('0x8')]=_[_0x8e5e('0x9')](config['redis'],{'host':_0x8e5e('0xa'),'port':0x18eb});var socket=require(_0x8e5e('0xb'))(new Redis(config[_0x8e5e('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x8e5e('0xc'));var tempTableName=_0x8e5e('0xd')+moment()[_0x8e5e('0xe')](_0x8e5e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x25fb2e){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))*$/[_0x8e5e('0x10')](_0x25fb2e);}function selectNotIn(_0x5f4ec4,_0xdd8381,_0x2c6e40,_0x11f9a8,_0x237395){return squel[_0x8e5e('0x11')]()[_0x8e5e('0x12')](_0x8e5e('0x13'))[_0x8e5e('0x14')](_0x11f9a8)[_0x8e5e('0x15')](_0xdd8381,null,_0xdd8381+_0x8e5e('0x16')+_0x11f9a8+'.'+_0x2c6e40)[_0x8e5e('0x17')](_0x11f9a8+'.'+_0x2c6e40+'\x20=\x20'+_0x5f4ec4+'.'+_0x2c6e40)[_0x8e5e('0x17')](_0xdd8381+_0x8e5e('0x18')+_0x237395[_0x8e5e('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x129127,_0x1ca34e){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x8e5e('0x19')](_0x8e5e('0x1a')+tempTableName)[_0x8e5e('0x1b')](function(_0x432e80){if(_0x432e80!==null){var _0x53f5f2=[];for(var _0x59a2c6=0x0;_0x59a2c6<_0x432e80[_0x8e5e('0x1c')];_0x59a2c6++){var _0x3f0184=_0x432e80[_0x59a2c6];if(!_[_0x8e5e('0x1d')](_0x3f0184[_0x8e5e('0x13')])){if(!_[_0x8e5e('0x1d')](_0x3f0184[_0x8e5e('0x1e')]))_0x53f5f2[_0x8e5e('0x1f')](insertAdditionalPhones(_0x3f0184));promisesContact['push']({'contact':_0x3f0184});}}}Promise[_0x8e5e('0x20')](_0x53f5f2)[_0x8e5e('0x21')](function(){_0x129127({'val':0x1});});})[_0x8e5e('0x22')](function(_0x2ee13a){logger[_0x8e5e('0x23')](_0x2ee13a['message']);});});}function insertAdditionalPhones(_0x501517){return new Promise(function(_0x4be73a,_0x172898){var _0x3eeec7=_0x501517[_0x8e5e('0x1e')];if(_['isNil'](_0x3eeec7))_0x172898({'val':0x0});else{var _0x169764=_0x3eeec7[_0x8e5e('0x24')](';');var _0x2b61e1=[];orderBy=0x0;for(var _0x342420=0x0;_0x342420<_0x169764[_0x8e5e('0x1c')];_0x342420++){_0x2b61e1[_0x8e5e('0x1f')](splitAdditionalPhone(_0x501517['id'],_0x169764[_0x342420]));}Promise[_0x8e5e('0x20')](_0x2b61e1)['then'](function(){_0x4be73a({'val':_0x169764['length']});});}});}function splitAdditionalPhone(_0xa37c0,_0x2553b5){return new Promise(function(_0x13680c,_0x28823a){var _0x31b29b=_0x2553b5[_0x8e5e('0x24')](':');var _0x171d42=_0x31b29b[0x0];var _0x4ec8d1=_0x31b29b[0x1];if(_0x4ec8d1!==''){var _0xda31ef=_0x4ec8d1[_0x8e5e('0x24')]('|');var _0x12c0c6=[];for(var _0x199d55=0x0;_0x199d55<_0xda31ef[_0x8e5e('0x1c')];_0x199d55++){if(_0xda31ef[_0x199d55]!==''){var _0x305c30=_[_0x8e5e('0x25')](promisesAdditionalPhones,{'contactId':_0xa37c0,'phone':_0xda31ef[_0x199d55]});if(_0x305c30[_0x8e5e('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x8e5e('0x1f')]({'contactId':_0xa37c0,'contactTypeId':_0x171d42,'phone':_0xda31ef[_0x199d55],'orderBy':orderBy});}}}_0x13680c({'ok':0x1});}else _0x13680c({'res':0x0});});}function createAdditionalPhone(_0x4a9d64,_0x4eead5,_0x45b7e9,_0x5c4417){var _0x32a812='';var _0x39c0e5='';var _0x4037ff=_0x45b7e9[_0x8e5e('0x24')]('§');_0x32a812=_0x4037ff[0x0];if(_0x4037ff['length']==0x2)_0x39c0e5=_0x4037ff[0x1];return new Promise(function(_0x34cb66,_0x533c56){return db[_0x8e5e('0x26')][_0x8e5e('0x27')]({'where':{'CmContactId':_0x4a9d64,'item':_0x32a812}})[_0x8e5e('0x21')](function(_0x97a968){if(_0x97a968){return db[_0x8e5e('0x26')]['update']({'ItemTypeId':_0x4eead5,'description':_0x39c0e5,'OrderBy':_0x5c4417},{'where':{'CmContactId':_0x4a9d64,'item':_0x32a812}})[_0x8e5e('0x21')](function(_0x2caefe){_0x34cb66({'res':'updated'});});}else{return db[_0x8e5e('0x26')][_0x8e5e('0x28')]({'CmContactId':_0x4a9d64,'item':_0x32a812,'ItemTypeId':_0x4eead5,'description':_0x39c0e5,'OrderBy':_0x5c4417,'ItemClass':_0x8e5e('0x29')})[_0x8e5e('0x21')](function(_0x4f0ee6){_0x34cb66({'res':_0x8e5e('0x2a')});});}});});}function updateContact(_0xbe41ff){return new Promise(function(_0x3c06cd,_0x3ac355){var _0x3bf3a5=_0xbe41ff['id'];delete _0xbe41ff['id'];return db['CmContact'][_0x8e5e('0x2b')](_0xbe41ff,{'where':{'id':_0x3bf3a5}})[_0x8e5e('0x21')](function(_0x39cdf5){updatedRows+=0x1;return db[_0x8e5e('0x2c')][_0x8e5e('0x2b')]({'phone':_0xbe41ff[_0x8e5e('0x13')]},{'where':{'ContactId':_0x3bf3a5}})[_0x8e5e('0x21')](function(_0x30aa3e){_0x3c06cd({'ret':'OK'});});});});}function insertCmHopper(_0x93e9db,_0x22ba3a,_0x33388c,_0x13147a,_0x25e7b5){var _0x4eef96=[_0x8e5e('0x2d'),_0x8e5e('0x2e'),'cm_contacts.id',_0x8e5e('0x2f'),_0x22ba3a+'.'+_0x13147a,_0x8e5e('0x30'),_0x8e5e('0x31'),_0x8e5e('0x32'),_0x8e5e('0x33'),'\x22'+_0x25e7b5+'\x22'];return squel['insert']()['into'](_0x8e5e('0x34'))[_0x8e5e('0x35')](['phone',_0x8e5e('0x36'),_0x8e5e('0x37'),'ListId',_0x13147a,_0x8e5e('0x38'),_0x8e5e('0x39'),_0x8e5e('0x3a'),_0x8e5e('0x3b'),_0x8e5e('0x3c')],squel['select']()[_0x8e5e('0x3d')](_0x4eef96)[_0x8e5e('0x14')](_0x22ba3a)['join']('cm_contacts',null,_0x8e5e('0x3e')+_0x22ba3a+_0x8e5e('0x3f'))[_0x8e5e('0x15')](_0x33388c,null,_0x33388c+'.id\x20=\x20'+_0x22ba3a+'.'+_0x13147a)[_0x8e5e('0x17')](_0x22ba3a+_0x8e5e('0x40'),_0x93e9db)[_0x8e5e('0x17')](_0x8e5e('0x41'),NOW)[_0x8e5e('0x17')](_0x8e5e('0x42'),selectNotIn(_0x22ba3a,_0x33388c,_0x13147a,'cm_hopper',[_0x8e5e('0x43'),_0x8e5e('0x44')]))[_0x8e5e('0x17')](_0x8e5e('0x42'),selectNotIn(_0x22ba3a,_0x33388c,_0x13147a,'cm_hopper',[_0x8e5e('0x43')])))[_0x8e5e('0x45')]();}function insertCmHopperBlack(_0x40de98,_0x546736,_0x11f27d,_0x4bc85e){var _0x59d37e=[_0x8e5e('0x2d'),_0x8e5e('0x46'),_0x8e5e('0x2f'),_0x546736+'.'+_0x4bc85e,'cm_contacts.createdAt',_0x8e5e('0x31')];return squel[_0x8e5e('0x47')]()[_0x8e5e('0x48')](_0x8e5e('0x49'))[_0x8e5e('0x35')]([_0x8e5e('0x13'),_0x8e5e('0x37'),_0x8e5e('0x4a'),_0x4bc85e,_0x8e5e('0x38'),_0x8e5e('0x39')],squel[_0x8e5e('0x11')]()[_0x8e5e('0x3d')](_0x59d37e)[_0x8e5e('0x14')](_0x546736)[_0x8e5e('0x15')](_0x8e5e('0x4b'),null,'cm_contacts.ListId\x20=\x20'+_0x546736+_0x8e5e('0x3f'))[_0x8e5e('0x15')](_0x11f27d,null,_0x11f27d+'.id\x20=\x20'+_0x546736+'.'+_0x4bc85e)[_0x8e5e('0x17')](_0x546736+_0x8e5e('0x40'),_0x40de98)[_0x8e5e('0x17')](_0x8e5e('0x41'),NOW)[_0x8e5e('0x17')](_0x8e5e('0x42'),squel[_0x8e5e('0x11')]()['field'](_0x8e5e('0x13'))[_0x8e5e('0x14')](_0x8e5e('0x49'))[_0x8e5e('0x17')](_0x8e5e('0x4c'),_0x40de98)['where'](_0x4bc85e+_0x8e5e('0x4d'),_0x546736+'.'+_0x4bc85e)))['toString']();}function insertCmHopperAdditionalPhones(_0x370889){var _0x2d5c39=['cm_hopper.id',_0x8e5e('0x4e'),_0x8e5e('0x4f'),'cm_contact_has_items.createdAt',_0x8e5e('0x50')];return squel[_0x8e5e('0x47')]()['into'](_0x8e5e('0x51'))[_0x8e5e('0x35')](['CmHopperId',_0x8e5e('0x13'),'OrderBy',_0x8e5e('0x38'),_0x8e5e('0x39')],squel[_0x8e5e('0x11')]()[_0x8e5e('0x3d')](_0x2d5c39)[_0x8e5e('0x14')]('cm_hopper')[_0x8e5e('0x15')](_0x8e5e('0x4b'),null,_0x8e5e('0x52'))['join']('cm_contact_has_items',null,_0x8e5e('0x53'))[_0x8e5e('0x17')](_0x8e5e('0x54'),_0x370889)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x8e5e('0x45')]();}function insertCmContact(_0x4f9938,_0x371645,_0x15dc09,_0x3ca92e){var _0x17f35a=_['concat'](_[_0x8e5e('0x55')](_0x3ca92e),[_0x8e5e('0x4a'),'CompanyId',_0x8e5e('0x38'),_0x8e5e('0x39')]);return squel[_0x8e5e('0x47')]()['into']('cm_contacts')[_0x8e5e('0x35')](_0x17f35a,squel[_0x8e5e('0x11')]()[_0x8e5e('0x3d')](_0x17f35a)['from'](_0x371645)[_0x8e5e('0x17')]('('+_0x15dc09[_0x8e5e('0x15')](',')+_0x8e5e('0x56'),squel[_0x8e5e('0x11')]()[_0x8e5e('0x3d')](_0x15dc09)[_0x8e5e('0x14')]('cm_contacts')[_0x8e5e('0x17')](_0x8e5e('0x4c'),_0x4f9938))[_0x8e5e('0x17')]('id\x20IN\x20?',squel[_0x8e5e('0x11')]()['field'](_0x8e5e('0x57'),_0x8e5e('0x58'))['from'](_0x371645)['group'](_0x15dc09[_0x8e5e('0x15')](','))))[_0x8e5e('0x45')]();}function handleStop(){logger[_0x8e5e('0x59')](_0x8e5e('0x5a'));stopped=!![];}function handleUncaughtException(_0x561414){logger['error'](_0x561414['message']);process[_0x8e5e('0x5b')](0x1);}function handleError(_0xb9eb35,_0x58172d){stats[_0x8e5e('0x5c')][_0x8e5e('0x1f')]({'name':_0x58172d[_0x8e5e('0x5d')],'message':_0x58172d[_0x8e5e('0x5e')],'row':_0xb9eb35});}function handleQuery(_0x313556){logger[_0x8e5e('0x59')](_0x313556);return db['sequelize']['query'](_0x313556)[_0x8e5e('0x1b')](function(_0xbe13e){results[_0x8e5e('0x1f')](_0xbe13e);})[_0x8e5e('0x22')](function(_0x4a0f29){logger[_0x8e5e('0x23')](_0x4a0f29[_0x8e5e('0x5e')]);});}function main(_0x4f400f,_0x49808f,_0x1dbeaf,_0x3f9b15){logger[_0x8e5e('0x59')]('main',_0x4f400f,JSON[_0x8e5e('0x5f')](_0x49808f));process[_0x8e5e('0x60')](_0x8e5e('0x61'));var _0x3a7761=_0x49808f[_0x8e5e('0x62')];var _0x27bda5=_[_0x8e5e('0x63')](_0x3a7761);var _0xea0aec=_0x49808f['socket_timestamp'];var _0x5cd338=path[_0x8e5e('0x15')](config[_0x8e5e('0x64')],_0x8e5e('0x65'),_0xea0aec+'.csv');logger['info'](_0x8e5e('0x66'),_0x49808f);db[_0x8e5e('0x67')][_0x8e5e('0x68')]({'raw':!![],'attributes':['id',_0x8e5e('0x69')]})[_0x8e5e('0x21')](function(_0x21599e){for(var _0x1cad52=0x0;_0x1cad52<_0x21599e[_0x8e5e('0x1c')];_0x1cad52++){if(_0x21599e[_0x1cad52]['name']in _0x3a7761){contactItemTypes[_0x8e5e('0x1f')](_0x21599e[_0x1cad52]);delete _0x27bda5[_0x21599e[_0x1cad52][_0x8e5e('0x69')]];hasAdditionalPhones=!![];}for(var _0x5696ed in _0x3a7761){if(_0x21599e[_0x1cad52][_0x8e5e('0x69')]+'_description'===_0x5696ed){phoneDescriptions[_0x8e5e('0x1f')]({'itemTypeId':_0x21599e[_0x1cad52]['id'],'description':_0x5696ed});delete _0x27bda5[_0x5696ed];}}}if(hasAdditionalPhones)_0x27bda5[_0x8e5e('0x1e')]='';var _0x473509=_[_0x8e5e('0x55')](_0x27bda5)[_0x8e5e('0x15')]();logger[_0x8e5e('0x59')](_0x8e5e('0x6a'),_0x473509);fs[_0x8e5e('0x6b')](_0x5cd338,_0x473509+'\x0a');Papa[_0x8e5e('0x6c')](fs[_0x8e5e('0x6d')](_0x4f400f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x892df9,_0x128ba2){try{for(var _0x52c1a5=0x0,_0x2f504b=[];_0x52c1a5<_0x892df9[_0x8e5e('0x6e')]['length'];_0x52c1a5++){stats[_0x8e5e('0x6f')]+=0x1;if(_0x892df9['errors'][_0x52c1a5]){handleError(_0x892df9[_0x8e5e('0x6e')][_0x52c1a5],_0x892df9[_0x8e5e('0x5c')][_0x52c1a5]);}else{var _0x404cf9=[];var _0x5ea98f=[];var _0x178ddd={};for(var _0x171f7d in _0x3a7761){let _0x714523=contactItemTypes['find'](_0x2fc325=>_0x2fc325['name']===_0x171f7d);let _0x48d6ac=contactItemTypes[_0x8e5e('0x70')](_0x19b0d5=>_0x19b0d5[_0x8e5e('0x69')]+_0x8e5e('0x71')===_0x171f7d);if(_[_0x8e5e('0x1d')](_0x714523)&&_[_0x8e5e('0x1d')](_0x48d6ac)){if(_0x3a7761[_0x8e5e('0x72')](_0x171f7d)){if(_0x892df9['data'][_0x52c1a5][_0x3a7761[_0x171f7d]]){var _0x15edda=_[_0x8e5e('0x73')](_0x892df9[_0x8e5e('0x6e')][_0x52c1a5][_0x3a7761[_0x171f7d]]['replace'](/"/g,'\x27'));switch(_0x171f7d){case _0x8e5e('0x36'):var _0x294328=moment(_0x15edda,_0x8e5e('0xc'),!![]);if(_0x294328[_0x8e5e('0x74')]()){_0x2f504b[_0x8e5e('0x1f')]('\x22'+_0x15edda+'\x22');}else{_0x404cf9[_0x8e5e('0x1f')](_0x8e5e('0x75'));}break;case'priority':var _0x51eca7=parseInt(_0x15edda);_0x15edda=_[_0x8e5e('0x76')](_0x51eca7)||_0x51eca7<0x0||_0x51eca7>0x4?_0x3f9b15?0x3:0x2:_0x51eca7;_0x2f504b[_0x8e5e('0x1f')]('\x22'+_0x15edda+'\x22');break;case _0x8e5e('0x3b'):var _0x3bd026=parseInt(_0x15edda);if(_[_0x8e5e('0x77')](_0x3bd026)&&_['includes'](_0x1dbeaf,_0x3bd026)){_0x2f504b[_0x8e5e('0x1f')]('\x22'+_0x3bd026+'\x22');}else{_0x404cf9[_0x8e5e('0x1f')](_0x8e5e('0x78'));}break;case _0x8e5e('0x79'):if(isEmail(_0x15edda)){_0x2f504b[_0x8e5e('0x1f')]('\x22'+_0x15edda+'\x22');}else{_0x404cf9[_0x8e5e('0x1f')](_0x8e5e('0x7a'));}break;case _0x8e5e('0x7b'):var _0x523396=moment(_0x15edda,'YYYY-MM-DD',!![]);if(_0x523396[_0x8e5e('0x74')]()){_0x2f504b['push']('\x22'+_0x15edda+'\x22');}else{_0x404cf9['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2f504b[_0x8e5e('0x1f')]('\x22'+_0x15edda+'\x22');}}else{switch(_0x171f7d){case _0x8e5e('0x7c'):case _0x8e5e('0x13'):_0x404cf9['push'](_0x171f7d+_0x8e5e('0x7d'));break;default:_0x2f504b['push']('\x22\x22');}}}}else{var _0x2ffde0='';if(!_['isNil'](_0x714523)){if(!_0x178ddd[_0x8e5e('0x72')](_0x714523['id'])){for(var _0x1e8b48=0x0;_0x1e8b48<_0x3a7761[_0x171f7d][_0x8e5e('0x1c')];_0x1e8b48++){var _0x15edda=_[_0x8e5e('0x73')](_0x892df9[_0x8e5e('0x6e')][_0x52c1a5][_0x3a7761[_0x171f7d][_0x1e8b48]][_0x8e5e('0x7e')](/"/g,'\x27'));var _0x1da1bf=phoneDescriptions[_0x8e5e('0x70')](_0x4794fa=>_0x4794fa[_0x8e5e('0x7f')]===_0x714523['id']);if(!_[_0x8e5e('0x1d')](_0x1da1bf)){var _0x32906a=_[_0x8e5e('0x73')](_0x892df9[_0x8e5e('0x6e')][_0x52c1a5][_0x3a7761[_0x1da1bf['description']][0x0]][_0x8e5e('0x7e')](/"/g,'\x27'));if(!_['isNil'](_0x32906a))_0x15edda=_0x15edda+'§'+_0x32906a;}if(_0x2ffde0=='')_0x2ffde0=_0x15edda;else _0x2ffde0+='|'+_0x15edda;}_0x5ea98f[_0x8e5e('0x1f')](_0x714523['id']+':'+_0x2ffde0);_0x178ddd[_0x714523['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2f504b[_0x8e5e('0x1f')]('\x22'+_0x5ea98f[_0x8e5e('0x15')](';')+'\x22');}if(_0x404cf9[_0x8e5e('0x1c')]){handleError(_0x892df9[_0x8e5e('0x6e')][_0x52c1a5],{'code':_0x8e5e('0x80'),'message':_0x404cf9['join']()});}else{fs[_0x8e5e('0x81')](_0x5cd338,_0x2f504b[_0x8e5e('0x15')]()+'\x0a');}_0x2f504b=[];}if(!(stats[_0x8e5e('0x6f')]%0xc8)){socket['emit'](_0x8e5e('0x82')+_0xea0aec,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x8e5e('0x83'));_0x128ba2[_0x8e5e('0x84')]();}}catch(_0xcd5720){handleError(_0x892df9['data'][_0x52c1a5],{'code':_0x8e5e('0x85'),'message':_0xcd5720[_0x8e5e('0x5e')]});logger[_0x8e5e('0x23')](_0x8e5e('0x86'),_0xcd5720[_0x8e5e('0x5e')]);}},'complete':function(){try{var _0x1247c2=[];var _0x41bf7d=tempTableName;_0x1247c2['push'](_0x8e5e('0x87')+_0x41bf7d+'\x20LIKE\x20cm_contacts;');logger[_0x8e5e('0x59')](_0x8e5e('0x88'),contactItemTypes[_0x8e5e('0x1c')]);var _0x232a48=util[_0x8e5e('0xe')](_0x8e5e('0x89'),_0x5cd338,_0x41bf7d,_0x473509,_0x49808f[_0x8e5e('0x4a')],_0x49808f[_0x8e5e('0x8a')]||null,NOW,NOW);if(_['isNil'](_0x3a7761[_0x8e5e('0x36')])){_0x232a48+=',\x20scheduledAt\x20=\x20NOW()';}_0x1247c2[_0x8e5e('0x1f')](_0x232a48);BPromise[_0x8e5e('0x8b')](_0x1247c2,handleQuery)['then'](function(_0x590bc9){BPromise[_0x8e5e('0x20')]([handleAdditionalPhones()])['then'](function(){_0x1247c2=[];for(var _0x276c4d=0x0;_0x276c4d=_0x499aea){return _0x3ff180['status'](0x193)[_0xe38f('0x11')]({'message':util['format'](_0xe38f('0x12'),_0x516aeb)});}_0x155466();})[_0xe38f('0x13')](function(_0xcf1693){_0x155466(_0xcf1693);});});}function isUserLimit(){return isLimit(_0xe38f('0x14'),0x1,db[_0xe38f('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0xe38f('0x16')}]}});}exports[_0xe38f('0x17')]=isUserLimit; \ No newline at end of file +var _0x0d1c=['catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d1c,0x1d0));var _0xc0d1=function(_0x3292e9,_0x13819c){_0x3292e9=_0x3292e9-0x0;var _0x57ba96=_0x0d1c[_0x3292e9];return _0x57ba96;};'use strict';var crypto=require(_0xc0d1('0x0'));var util=require(_0xc0d1('0x1'));var compose=require(_0xc0d1('0x2'));var db=require(_0xc0d1('0x3'))['db'];var config=require(_0xc0d1('0x4'));function getValueFromLicense(_0x351f0d,_0x41ad20){if(_0x351f0d&&_0x41ad20){if(_0x41ad20[_0xc0d1('0x5')]&&_0x41ad20[_0xc0d1('0x6')]){var _0x4c068d=_0x41ad20[_0xc0d1('0x5')];var _0x2a78c0=_0x41ad20[_0xc0d1('0x6')];var _0xc8fef7=_0x4c068d[_0xc0d1('0x7')]('-')[0x4];var _0x4ebc1d=_0x4c068d[_0xc0d1('0x7')]('-')[0x0];var _0x9989a7=crypto['createDecipher'](_0xc0d1('0x8'),util[_0xc0d1('0x9')](_0xc0d1('0xa'),_0xc8fef7,_0x4c068d,_0x4ebc1d));var _0x3d84b9=_0x9989a7['update'](_0x2a78c0,_0xc0d1('0xb'),_0xc0d1('0xc'));_0x3d84b9+=_0x9989a7[_0xc0d1('0xd')](_0xc0d1('0xc'));var _0x245cb6=JSON[_0xc0d1('0xe')](_0x3d84b9);return _0x245cb6[_0xc0d1('0xf')](_0x351f0d)?_0x245cb6[_0x351f0d]:null;}}return null;}function isLimit(_0xed9277,_0x502d4e,_0x49d9ca,_0x137a56){var _0xbf2256=_0x502d4e;return compose()[_0xc0d1('0x10')](function(_0x121803,_0x5a16e3,_0x41507d){return db[_0xc0d1('0x11')][_0xc0d1('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xc0d1('0x13')](function(_0x472d87){var _0x26b289=getValueFromLicense(_0xed9277,_0x472d87);return _0x26b289?_0x26b289:_0xbf2256;})[_0xc0d1('0x13')](function(_0x32ebc7){_0xbf2256=_0x32ebc7;return _0x49d9ca[_0xc0d1('0x14')](_0x137a56);})['then'](function(_0x4e9950){if(_0x4e9950>=_0xbf2256){return _0x5a16e3['status'](0x193)[_0xc0d1('0x15')]({'message':util[_0xc0d1('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xed9277)});}_0x41507d();})[_0xc0d1('0x16')](function(_0x9c09ee){_0x41507d(_0x9c09ee);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xc0d1('0x17')],{'where':{'$or':[{'role':_0xc0d1('0x18')},{'role':_0xc0d1('0x19')}]}});}exports[_0xc0d1('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 429a226..4f5389e 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 _0x1032=['$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','pop','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','split','length','slice','forEach','shift','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt'];(function(_0x5c4859,_0xd04b9e){var _0x2cd927=function(_0x3b9ff9){while(--_0x3b9ff9){_0x5c4859['push'](_0x5c4859['shift']());}};_0x2cd927(++_0xd04b9e);}(_0x1032,0xf6));var _0x2103=function(_0x3bbeb0,_0x3b46d2){_0x3bbeb0=_0x3bbeb0-0x0;var _0x1713b5=_0x1032[_0x3bbeb0];return _0x1713b5;};'use strict';var _=require(_0x2103('0x0'));var moment=require(_0x2103('0x1'));exports[_0x2103('0x2')]=function(_0x4f500a){var _0x473473={'conditions':[]};_0x473473[_0x2103('0x3')]=_[_0x2103('0x4')](_0x4f500a,'[$or]')?'or':_0x2103('0x5');var _0x32a2ea=_0x4f500a[_0x2103('0x6')](_0x2103('0x7'),'')[_0x2103('0x6')]('[$or]','')[_0x2103('0x8')]('||');for(var _0x5e5376=0x0;_0x5e5376<_0x32a2ea[_0x2103('0x9')];_0x5e5376++){var _0x2dfa4f=_0x32a2ea[_0x5e5376][_0x2103('0x8')](':=');var _0xa01845=_0x2dfa4f[0x0];var _0x59a89f=_0x2dfa4f[_0x2103('0xa')](0x1);_0x59a89f[_0x2103('0xb')](function(_0x3fcc8d){var _0x224137=_0x3fcc8d[_0x2103('0x8')]('[')[_0x2103('0xc')]();var _0xd0128c=_0x3fcc8d['match'](/\[(.*?)\]/g);_0xd0128c[_0x2103('0xb')](function(_0x2065a0){var _0x34cbc9=_0x2065a0[_0x2103('0x8')]('[')['filter'](function(_0x1d5eca){return _0x1d5eca[_0x2103('0xd')](']')>-0x1;})[_0x2103('0xe')](function(_0x4d9fbc){return _0x4d9fbc[_0x2103('0x8')](']')[0x0];})[0x0];_0x473473[_0x2103('0xf')][_0x2103('0x10')]({'field':_0xa01845,'operator':_0x224137,'value':_0x34cbc9});});});}return _0x473473;};exports[_0x2103('0x11')]=function(_0x526673,_0x26773f,_0x3fbdf8){var _0xca3b08={};if(_0x26773f===_0x2103('0x12')){if(_0x3fbdf8[_0x2103('0x13')]===_0x2103('0x14')){_0x3fbdf8[_0x2103('0x13')]=_0x2103('0x15');_0x3fbdf8[_0x2103('0x16')]+=','+_0x3fbdf8['value'];}else if(_['includes']([_0x2103('0x17'),_0x2103('0x18')],_0x3fbdf8[_0x2103('0x13')])){_0x3fbdf8[_0x2103('0x16')]=moment(_0x3fbdf8[_0x2103('0x16')])[_0x2103('0x19')](0x1,'days')[_0x2103('0x1a')](_0x2103('0x1b'));}}if(_0x3fbdf8[_0x2103('0x1c')]){_0x26773f=_0x3fbdf8[_0x2103('0x1c')];_0xca3b08[_0x2103('0x1d')]=_0x2103('0x1e')+_0x526673+'.'+_0x3fbdf8['field']+_0x2103('0x1f')+_0x3fbdf8[_0x2103('0x1c')]+')\x20'+parseOperator(_0x3fbdf8[_0x2103('0x13')]);}else{_0xca3b08['text']=_0x526673+'.'+_0x3fbdf8[_0x2103('0x20')]+'\x20'+parseOperator(_0x3fbdf8['operator']);}if(_['includes']([_0x2103('0x21'),_0x2103('0x22')],_0x3fbdf8[_0x2103('0x13')]))_0xca3b08[_0x2103('0x1d')]='('+_0xca3b08['text']+_0x2103('0x23')+_0x526673+'.'+_0x3fbdf8[_0x2103('0x20')]+_0x2103('0x24');_0xca3b08[_0x2103('0x16')]=parseValue(_0x26773f,_0x3fbdf8[_0x2103('0x13')],_0x3fbdf8['value']);return _0xca3b08;};function parseOperator(_0xc1b272){var _0x440482;switch(_0xc1b272){case'$in':_0x440482=_0x2103('0x25');break;case _0x2103('0x22'):_0x440482=_0x2103('0x26');break;case _0x2103('0x14'):_0x440482=_0x2103('0x27');break;case _0x2103('0x21'):_0x440482=_0x2103('0x28');break;case'$substring':case'$startsWith':case'$endsWith':_0x440482=_0x2103('0x29');break;case _0x2103('0x2a'):_0x440482=_0x2103('0x2b');break;case _0x2103('0x17'):_0x440482=_0x2103('0x2c');break;case _0x2103('0x18'):_0x440482=_0x2103('0x2d');break;case'$gte':_0x440482='>=\x20?';break;case _0x2103('0x15'):_0x440482=_0x2103('0x2e');break;}return _0x440482;}function parseValue(_0x3bf0bf,_0x298b6b,_0x583139){var _0x68a570={'start':undefined,'end':undefined};switch(_0x298b6b){case'$in':case _0x2103('0x22'):_0x68a570[_0x2103('0x2f')]=_0x583139['split'](',');break;case _0x2103('0x30'):_0x68a570[_0x2103('0x2f')]='%'+_0x583139+'%';break;case _0x2103('0x31'):_0x68a570[_0x2103('0x2f')]=_0x583139+'%';break;case'$endsWith':_0x68a570[_0x2103('0x2f')]='%'+_0x583139;break;case _0x2103('0x15'):var _0x212a31=_0x583139[_0x2103('0x8')](',');var _0x583139=_0x212a31[_0x2103('0xc')]();var _0x169955=_0x212a31[_0x2103('0x32')]();if(_0x3bf0bf===_0x2103('0x12')){_0x583139=moment(_0x583139)['utcOffset'](0x0,!![])[_0x2103('0x1a')]();_0x169955=moment(_0x169955)['utcOffset'](0x0,!![])[_0x2103('0x19')](0x17,_0x2103('0x33'))[_0x2103('0x19')](0x3b,_0x2103('0x34'))[_0x2103('0x19')](0x3b,_0x2103('0x35'))[_0x2103('0x1a')]();}_0x68a570={'start':_0x583139,'end':_0x169955};break;default:_0x68a570['start']=_0x583139;break;}return _0x68a570;} \ No newline at end of file +var _0x537e=['$in','start','pop','utcOffset','add','seconds','format','parseSearch','sqlOperator','startsWith','[$or]','[$and]','split','length','slice','forEach','shift','match','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','$gt','$lte','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$notIn','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?'];(function(_0x1244b6,_0x4cb0bf){var _0x3f833b=function(_0x276eab){while(--_0x276eab){_0x1244b6['push'](_0x1244b6['shift']());}};_0x3f833b(++_0x4cb0bf);}(_0x537e,0xfc));var _0xe537=function(_0xc8b451,_0x2a8eef){_0xc8b451=_0xc8b451-0x0;var _0x59ff97=_0x537e[_0xc8b451];return _0x59ff97;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xe537('0x0')]=function(_0x1acc74){var _0x16242a={'conditions':[]};_0x16242a[_0xe537('0x1')]=_[_0xe537('0x2')](_0x1acc74,_0xe537('0x3'))?'or':'and';var _0x3c1765=_0x1acc74['replace'](_0xe537('0x4'),'')['replace'](_0xe537('0x3'),'')[_0xe537('0x5')]('||');for(var _0x427d81=0x0;_0x427d81<_0x3c1765[_0xe537('0x6')];_0x427d81++){var _0x3d6370=_0x3c1765[_0x427d81][_0xe537('0x5')](':=');var _0xb770d9=_0x3d6370[0x0];var _0x228f4e=_0x3d6370[_0xe537('0x7')](0x1);_0x228f4e[_0xe537('0x8')](function(_0x433a5a){var _0x5f57f5=_0x433a5a[_0xe537('0x5')]('[')[_0xe537('0x9')]();var _0x360d89=_0x433a5a[_0xe537('0xa')](/\[(.*?)\]/g);_0x360d89['forEach'](function(_0x449c64){var _0x56f36e=_0x449c64[_0xe537('0x5')]('[')['filter'](function(_0x25696e){return _0x25696e[_0xe537('0xb')](']')>-0x1;})[_0xe537('0xc')](function(_0x11da1d){return _0x11da1d[_0xe537('0x5')](']')[0x0];})[0x0];_0x16242a[_0xe537('0xd')]['push']({'field':_0xb770d9,'operator':_0x5f57f5,'value':_0x56f36e});});});}return _0x16242a;};exports[_0xe537('0xe')]=function(_0x1530f9,_0x144dab,_0x4ef3af){var _0x58feae={};if(_0x144dab===_0xe537('0xf')){if(_0x4ef3af['operator']==='$eq'){_0x4ef3af[_0xe537('0x10')]=_0xe537('0x11');_0x4ef3af[_0xe537('0x12')]+=','+_0x4ef3af[_0xe537('0x12')];}else if(_['includes']([_0xe537('0x13'),_0xe537('0x14')],_0x4ef3af['operator'])){_0x4ef3af['value']=moment(_0x4ef3af[_0xe537('0x12')])['add'](0x1,'days')['format'](_0xe537('0x15'));}}if(_0x4ef3af[_0xe537('0x16')]){_0x144dab=_0x4ef3af['castTo'];_0x58feae[_0xe537('0x17')]=_0xe537('0x18')+_0x1530f9+'.'+_0x4ef3af[_0xe537('0x19')]+_0xe537('0x1a')+_0x4ef3af['castTo']+')\x20'+parseOperator(_0x4ef3af[_0xe537('0x10')]);}else{_0x58feae[_0xe537('0x17')]=_0x1530f9+'.'+_0x4ef3af[_0xe537('0x19')]+'\x20'+parseOperator(_0x4ef3af[_0xe537('0x10')]);}if(_[_0xe537('0x1b')](['$ne',_0xe537('0x1c')],_0x4ef3af[_0xe537('0x10')]))_0x58feae[_0xe537('0x17')]='('+_0x58feae[_0xe537('0x17')]+'\x20OR\x20'+_0x1530f9+'.'+_0x4ef3af[_0xe537('0x19')]+'\x20IS\x20NULL)';_0x58feae[_0xe537('0x12')]=parseValue(_0x144dab,_0x4ef3af[_0xe537('0x10')],_0x4ef3af[_0xe537('0x12')]);return _0x58feae;};function parseOperator(_0x1d25b1){var _0x1e897c;switch(_0x1d25b1){case'$in':_0x1e897c=_0xe537('0x1d');break;case _0xe537('0x1c'):_0x1e897c=_0xe537('0x1e');break;case'$eq':_0x1e897c=_0xe537('0x1f');break;case _0xe537('0x20'):_0x1e897c='<>\x20?';break;case _0xe537('0x21'):case _0xe537('0x22'):case _0xe537('0x23'):_0x1e897c='LIKE\x20?';break;case _0xe537('0x24'):_0x1e897c=_0xe537('0x25');break;case'$gt':_0x1e897c=_0xe537('0x26');break;case _0xe537('0x14'):_0x1e897c='<=\x20?';break;case _0xe537('0x27'):_0x1e897c=_0xe537('0x28');break;case _0xe537('0x11'):_0x1e897c=_0xe537('0x29');break;}return _0x1e897c;}function parseValue(_0x3fd6e3,_0x155ff0,_0x108252){var _0x4c639c={'start':undefined,'end':undefined};switch(_0x155ff0){case _0xe537('0x2a'):case _0xe537('0x1c'):_0x4c639c[_0xe537('0x2b')]=_0x108252[_0xe537('0x5')](',');break;case'$substring':_0x4c639c[_0xe537('0x2b')]='%'+_0x108252+'%';break;case _0xe537('0x22'):_0x4c639c[_0xe537('0x2b')]=_0x108252+'%';break;case _0xe537('0x23'):_0x4c639c['start']='%'+_0x108252;break;case'$between':var _0x1f5ea0=_0x108252[_0xe537('0x5')](',');var _0x108252=_0x1f5ea0[_0xe537('0x9')]();var _0x180c77=_0x1f5ea0[_0xe537('0x2c')]();if(_0x3fd6e3==='DATE'){_0x108252=moment(_0x108252)['utcOffset'](0x0,!![])['format']();_0x180c77=moment(_0x180c77)[_0xe537('0x2d')](0x0,!![])[_0xe537('0x2e')](0x17,'hours')[_0xe537('0x2e')](0x3b,'minutes')['add'](0x3b,_0xe537('0x2f'))[_0xe537('0x30')]();}_0x4c639c={'start':_0x108252,'end':_0x180c77};break;default:_0x4c639c[_0xe537('0x2b')]=_0x108252;break;}return _0x4c639c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9840fe5..8cd84cf 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 _0x84e7=['cast','col','substr','DESC','priority','ASC','omit','length','isObject','isString','unset','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','$id','query','model','intersection','attributes','hasOwnProperty','nolimit','order','where','object','filter','columns','name','value','map','VIRTUAL','lower','merge','sequelize','moment','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','limit','offset','sort','indexOf'];(function(_0x43417d,_0x3c502d){var _0xed8f0c=function(_0x469065){while(--_0x469065){_0x43417d['push'](_0x43417d['shift']());}};_0xed8f0c(++_0x3c502d);}(_0x84e7,0x122));var _0x784e=function(_0x51dca6,_0x2b86e2){_0x51dca6=_0x51dca6-0x0;var _0x43b9e9=_0x84e7[_0x51dca6];return _0x43b9e9;};'use strict';var _=require('lodash');var sequelize=require(_0x784e('0x0'));var moment=require(_0x784e('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5861e2){var _0x3548d2=['ne'];try{var _0x2c1d96=JSON['parse'](_0x5861e2);var _0x45e3ad=Object[_0x784e('0x2')](_0x2c1d96)[0x0];return _0x3548d2[_0x784e('0x3')](_0x45e3ad);}catch(_0xdc7692){return![];}}function getOperatorValue(_0x42993b){var _0x133296=JSON['parse'](_0x42993b);var _0x3cbdd1=Object['keys'](_0x133296)[0x0];var _0xfaa170=_0x133296[_0x3cbdd1];return{['$'+_0x3cbdd1]:_0xfaa170};}exports[_0x784e('0x4')]=function(_0x59a97d){var _0x18be55=null;if(_0x59a97d){_0x18be55=_0x59a97d[_0x784e('0x5')](',');}return _0x18be55;};exports[_0x784e('0x6')]=function(_0x3ddd55,_0x4ac061){var _0x4ae056={};if(!_[_0x784e('0x7')](_0x3ddd55)){_[_0x784e('0x8')](_0x3ddd55,function(_0x17b71f,_0x2fd1b5){try{if(_0x4ac061){var _0x5389cd=_[_0x784e('0x9')](_0x4ac061,{'name':_0x2fd1b5})||{};if(hasSequelizeOperator(_0x17b71f)){_0x4ae056[_0x2fd1b5]=getOperatorValue(_0x17b71f);}else if(_0x5389cd[_0x784e('0xa')]===_0x784e('0xb')&&_[_0x784e('0xc')](_0x17b71f)){var _0x40e0d1=JSON[_0x784e('0xd')](_0x17b71f);var _0x59e179={'$gte':moment(moment(_0x40e0d1[_0x784e('0xe')])['format'](_0x784e('0xf')))[_0x784e('0x10')]()[_0x784e('0x11')](),'$lte':moment(moment(_0x40e0d1[_0x784e('0x12')])[_0x784e('0x11')](_0x784e('0xf')))[_0x784e('0x10')]()[_0x784e('0x13')](0x1,'s')[_0x784e('0x11')]()};_0x4ae056[_0x2fd1b5]=_0x59e179;}else if(_0x5389cd['name']==='uniqueid'){_0x4ae056[_0x2fd1b5]=_0x17b71f;}else{_0x4ae056[_0x2fd1b5]=_[_0x784e('0x14')](_0x17b71f)?_0x17b71f:JSON[_0x784e('0xd')](_0x17b71f);}}else{_0x4ae056[_0x2fd1b5]=_[_0x784e('0x14')](_0x17b71f)?_0x17b71f:JSON[_0x784e('0xd')](_0x17b71f);}}catch(_0x3ac83){_0x4ae056[_0x2fd1b5]=_0x17b71f[_0x784e('0x5')](',');}});}return _0x4ae056;};exports[_0x784e('0x15')]=function(_0x504ebf){_0x504ebf=parseInt(_0x504ebf,0xa);if(!_0x504ebf||_0x504ebf<0x0){_0x504ebf=LIMIT_VALUE;}return _0x504ebf;};exports[_0x784e('0x16')]=function(_0x285ddd){_0x285ddd=parseInt(_0x285ddd,0xa);if(!_0x285ddd||_0x285ddd<0x0){_0x285ddd=0x0;}return _0x285ddd;};exports[_0x784e('0x17')]=function(_0xa417c2){var _0x440cd6,_0x42f894=null;if(_0xa417c2){_0x440cd6=_0xa417c2[_0x784e('0x5')](',');_0x42f894=_['map'](_0x440cd6,function(_0x5add8f){if(_0x5add8f[_0x784e('0x18')]('-')===0x0){return[_0x5add8f==='priority'?sequelize[_0x784e('0x19')](sequelize[_0x784e('0x1a')]('priority'),'unsigned'):_0x5add8f[_0x784e('0x1b')](0x1),_0x784e('0x1c')];}else{return[_0x5add8f===_0x784e('0x1d')?sequelize[_0x784e('0x19')](sequelize['col']('priority'),'unsigned'):_0x5add8f,_0x784e('0x1e')];}});}return _0x42f894;};exports[_0x784e('0x1f')]=function(_0x47f5c2,_0xc225cf){if(_['isEmpty'](_0x47f5c2)){return _0x47f5c2;}if(_[_0x784e('0x14')](_0x47f5c2)){for(var _0x59f315=0x0;_0x59f315<_0x47f5c2[_0x784e('0x20')];_0x59f315+=0x1){_0x47f5c2[_0x59f315]=this[_0x784e('0x1f')](_0x47f5c2[_0x59f315],_0xc225cf);}return _0x47f5c2;}if(!_[_0x784e('0x21')](_0x47f5c2)){return _0x47f5c2;}if(_[_0x784e('0x22')](_0xc225cf)){_0xc225cf=[_0xc225cf];}if(!_['isArray'](_0xc225cf)){return _0x47f5c2;}for(var _0x3668ed=0x0;_0x3668ed<_0xc225cf[_0x784e('0x20')];_0x3668ed+=0x1){_[_0x784e('0x23')](_0x47f5c2,_0xc225cf[_0x3668ed]);}for(var _0x2def08 in _0x47f5c2){if(_0x47f5c2['hasOwnProperty'](_0x2def08)){_0x47f5c2[_0x2def08]=this[_0x784e('0x1f')](_0x47f5c2[_0x2def08],_0xc225cf);}}return _0x47f5c2;};exports[_0x784e('0x24')]=function(_0x5f3da2){return _0x5f3da2['match'](RegExp(_0x784e('0x25')))?!![]:![];};exports[_0x784e('0x26')]=function(_0x17a278){return _0x17a278[_0x784e('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x784e('0x28')]=function(_0x294a75){var _0x150757=[];_0x294a75[_0x784e('0x5')](/[ ,]+/)[_0x784e('0x29')](function(_0x2e18d6){_0x2e18d6=_0x2e18d6[_0x784e('0x2a')](/([^:]")"+/g,'$1');_0x2e18d6='+'+_0x2e18d6+'*';var _0x8ccdae=/[ `!@#$%^&*()_\-?~]/;if(_0x2e18d6[_0x784e('0x27')](_0x8ccdae))_0x2e18d6='\x22'+_0x2e18d6+'\x22';_0x150757[_0x784e('0x2b')](_0x2e18d6);});return _0x150757[_0x784e('0x2c')]('\x20');};exports['getOptions']=function(_0x32e399,_0x4ea50b,_0xc66635){var _0x14bb3b={},_0x14547a={};if(_0x4ea50b['query'][_0x784e('0x2d')]){_0x4ea50b['query']['id']=_0x4ea50b[_0x784e('0x2e')][_0x784e('0x2d')];delete _0x4ea50b['query'][_0x784e('0x2d')];}_0x14bb3b[_0x784e('0x2f')]=_['map'](_0x32e399,'name');_0x14bb3b[_0x784e('0x2e')]=_[_0x784e('0x2')](_0x4ea50b[_0x784e('0x2e')]);_0x14bb3b[_0x784e('0x6')]=_[_0x784e('0x30')](_0x14bb3b['model'],_0x14bb3b[_0x784e('0x2e')]);_0x14547a[_0x784e('0x31')]=_['intersection'](_0x14bb3b[_0x784e('0x2f')],this['fields'](_0x4ea50b['query']['fields']));_0x14547a[_0x784e('0x31')]=_0x14547a[_0x784e('0x31')]['length']?_0x14547a[_0x784e('0x31')]:_0x14bb3b[_0x784e('0x2f')];if(!_0x4ea50b[_0x784e('0x2e')][_0x784e('0x32')](_0x784e('0x33'))){_0x14547a[_0x784e('0x15')]=this['limit'](_0x4ea50b['query'][_0x784e('0x15')]);_0x14547a[_0x784e('0x16')]=this['offset'](_0x4ea50b['query']['offset']);}_0x14547a[_0x784e('0x34')]=this[_0x784e('0x17')](_0x4ea50b['query'][_0x784e('0x17')]);_0x14547a[_0x784e('0x35')]=this[_0x784e('0x6')](_['pick'](_0x4ea50b[_0x784e('0x2e')],_0x14bb3b['filters']),_0x32e399);if(_0x4ea50b[_0x784e('0x2e')]['filter']){var _0x412ef4=_0x32e399;var _0x14c36b=_0x4ea50b['query']['filter'];if(typeof _0x14c36b===_0x784e('0x36')){_0x412ef4=_[_0x784e('0x37')](_0x32e399,function(_0xa2ed54){return _['includes'](_0x14c36b[_0x784e('0x38')],_0xa2ed54[_0x784e('0x39')]);});_0x14c36b=_0x14c36b[_0x784e('0x3a')];}_0x14547a[_0x784e('0x35')]=_['merge'](_0x14547a[_0x784e('0x35')],{'$or':_[_0x784e('0x3b')](_0x412ef4,function(_0x48d0f0){if(_0x48d0f0['type']!==_0x784e('0x3c')){if(_0xc66635){return sequelize[_0x784e('0x35')](sequelize['fn'](_0x784e('0x3d'),sequelize[_0x784e('0x1a')](_0x48d0f0[_0x784e('0x39')])),{'$like':sequelize['fn']('lower','%'+_0x4ea50b['query']['filter']+'%')});}else{var _0x1c824a={};_0x1c824a[_0x48d0f0[_0x784e('0x39')]]={'$like':'%'+_0x4ea50b[_0x784e('0x2e')][_0x784e('0x37')]+'%'};return _0x1c824a;}}})});}_0x14547a=_[_0x784e('0x3e')]({},_0x14547a,_0x4ea50b['options']);return _0x14547a;}; \ No newline at end of file +var _0x0e85=['type','VIRTUAL','lower','options','lodash','sequelize','keys','parse','fields','split','isEmpty','forOwn','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','col','substr','DESC','cast','omit','isObject','length','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','filters','filter','object','includes','columns','value','merge'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0e85,0x7c));var _0x50e8=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x0e85[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x50e8('0x0'));var sequelize=require(_0x50e8('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x11a13a){var _0x682d10=['ne'];try{var _0x55e515=JSON['parse'](_0x11a13a);var _0x4ce6cd=Object[_0x50e8('0x2')](_0x55e515)[0x0];return _0x682d10['includes'](_0x4ce6cd);}catch(_0x3048e3){return![];}}function getOperatorValue(_0x2401b2){var _0xe3151e=JSON[_0x50e8('0x3')](_0x2401b2);var _0x5e8b01=Object[_0x50e8('0x2')](_0xe3151e)[0x0];var _0x108edc=_0xe3151e[_0x5e8b01];return{['$'+_0x5e8b01]:_0x108edc};}exports[_0x50e8('0x4')]=function(_0x988da0){var _0x1fafb0=null;if(_0x988da0){_0x1fafb0=_0x988da0[_0x50e8('0x5')](',');}return _0x1fafb0;};exports['filters']=function(_0x11717c,_0x228ed1){var _0x19d1bc={};if(!_[_0x50e8('0x6')](_0x11717c)){_[_0x50e8('0x7')](_0x11717c,function(_0x194a89,_0x45dc6f){try{if(_0x228ed1){var _0x3d25ea=_['find'](_0x228ed1,{'name':_0x45dc6f})||{};if(hasSequelizeOperator(_0x194a89)){_0x19d1bc[_0x45dc6f]=getOperatorValue(_0x194a89);}else if(_0x3d25ea['type']===_0x50e8('0x8')&&_[_0x50e8('0x9')](_0x194a89)){var _0x508377=JSON['parse'](_0x194a89);var _0x3cb45c={'$gte':moment(moment(_0x508377[_0x50e8('0xa')])[_0x50e8('0xb')](_0x50e8('0xc')))['utc']()[_0x50e8('0xb')](),'$lte':moment(moment(_0x508377[_0x50e8('0xd')])[_0x50e8('0xb')]('YYYY-MM-DD'))['utc']()[_0x50e8('0xe')](0x1,'s')[_0x50e8('0xb')]()};_0x19d1bc[_0x45dc6f]=_0x3cb45c;}else if(_0x3d25ea[_0x50e8('0xf')]===_0x50e8('0x10')){_0x19d1bc[_0x45dc6f]=_0x194a89;}else{_0x19d1bc[_0x45dc6f]=_[_0x50e8('0x11')](_0x194a89)?_0x194a89:JSON[_0x50e8('0x3')](_0x194a89);}}else{_0x19d1bc[_0x45dc6f]=_['isArray'](_0x194a89)?_0x194a89:JSON['parse'](_0x194a89);}}catch(_0x441f25){_0x19d1bc[_0x45dc6f]=_0x194a89[_0x50e8('0x5')](',');}});}return _0x19d1bc;};exports[_0x50e8('0x12')]=function(_0x45ce11){_0x45ce11=parseInt(_0x45ce11,0xa);if(!_0x45ce11||_0x45ce11<0x0){_0x45ce11=LIMIT_VALUE;}return _0x45ce11;};exports[_0x50e8('0x13')]=function(_0x90c54c){_0x90c54c=parseInt(_0x90c54c,0xa);if(!_0x90c54c||_0x90c54c<0x0){_0x90c54c=0x0;}return _0x90c54c;};exports[_0x50e8('0x14')]=function(_0x53e0a1){var _0x415596,_0x55997c=null;if(_0x53e0a1){_0x415596=_0x53e0a1[_0x50e8('0x5')](',');_0x55997c=_[_0x50e8('0x15')](_0x415596,function(_0xd263d){if(_0xd263d[_0x50e8('0x16')]('-')===0x0){return[_0xd263d===_0x50e8('0x17')?sequelize['cast'](sequelize[_0x50e8('0x18')](_0x50e8('0x17')),'unsigned'):_0xd263d[_0x50e8('0x19')](0x1),_0x50e8('0x1a')];}else{return[_0xd263d==='priority'?sequelize[_0x50e8('0x1b')](sequelize[_0x50e8('0x18')]('priority'),'unsigned'):_0xd263d,'ASC'];}});}return _0x55997c;};exports[_0x50e8('0x1c')]=function(_0x160372,_0x124402){if(_[_0x50e8('0x6')](_0x160372)){return _0x160372;}if(_[_0x50e8('0x11')](_0x160372)){for(var _0x13b6e9=0x0;_0x13b6e9<_0x160372['length'];_0x13b6e9+=0x1){_0x160372[_0x13b6e9]=this[_0x50e8('0x1c')](_0x160372[_0x13b6e9],_0x124402);}return _0x160372;}if(!_[_0x50e8('0x1d')](_0x160372)){return _0x160372;}if(_['isString'](_0x124402)){_0x124402=[_0x124402];}if(!_[_0x50e8('0x11')](_0x124402)){return _0x160372;}for(var _0x2bc8d8=0x0;_0x2bc8d8<_0x124402[_0x50e8('0x1e')];_0x2bc8d8+=0x1){_[_0x50e8('0x1f')](_0x160372,_0x124402[_0x2bc8d8]);}for(var _0x4fbf41 in _0x160372){if(_0x160372[_0x50e8('0x20')](_0x4fbf41)){_0x160372[_0x4fbf41]=this['omit'](_0x160372[_0x4fbf41],_0x124402);}}return _0x160372;};exports[_0x50e8('0x21')]=function(_0x39c0c6){return _0x39c0c6[_0x50e8('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x50e8('0x23')]=function(_0x126c99){return _0x126c99[_0x50e8('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x50e8('0x24')]=function(_0x1d77d0){var _0x18aa31=[];_0x1d77d0[_0x50e8('0x5')](/[ ,]+/)['forEach'](function(_0x290fd2){_0x290fd2=_0x290fd2[_0x50e8('0x25')](/([^:]")"+/g,'$1');_0x290fd2='+'+_0x290fd2+'*';var _0x535c24=/[ `!@#$%^&*()_\-?~]/;if(_0x290fd2['match'](_0x535c24))_0x290fd2='\x22'+_0x290fd2+'\x22';_0x18aa31[_0x50e8('0x26')](_0x290fd2);});return _0x18aa31[_0x50e8('0x27')]('\x20');};exports[_0x50e8('0x28')]=function(_0x47ace2,_0x594187,_0x3e58a9){var _0x19e3cc={},_0x5c2e04={};if(_0x594187[_0x50e8('0x29')][_0x50e8('0x2a')]){_0x594187[_0x50e8('0x29')]['id']=_0x594187[_0x50e8('0x29')]['$id'];delete _0x594187[_0x50e8('0x29')]['$id'];}_0x19e3cc[_0x50e8('0x2b')]=_[_0x50e8('0x15')](_0x47ace2,_0x50e8('0xf'));_0x19e3cc['query']=_[_0x50e8('0x2')](_0x594187[_0x50e8('0x29')]);_0x19e3cc['filters']=_[_0x50e8('0x2c')](_0x19e3cc[_0x50e8('0x2b')],_0x19e3cc[_0x50e8('0x29')]);_0x5c2e04[_0x50e8('0x2d')]=_['intersection'](_0x19e3cc[_0x50e8('0x2b')],this[_0x50e8('0x4')](_0x594187[_0x50e8('0x29')][_0x50e8('0x4')]));_0x5c2e04['attributes']=_0x5c2e04[_0x50e8('0x2d')][_0x50e8('0x1e')]?_0x5c2e04[_0x50e8('0x2d')]:_0x19e3cc['model'];if(!_0x594187['query']['hasOwnProperty'](_0x50e8('0x2e'))){_0x5c2e04[_0x50e8('0x12')]=this[_0x50e8('0x12')](_0x594187[_0x50e8('0x29')][_0x50e8('0x12')]);_0x5c2e04[_0x50e8('0x13')]=this[_0x50e8('0x13')](_0x594187[_0x50e8('0x29')][_0x50e8('0x13')]);}_0x5c2e04[_0x50e8('0x2f')]=this['sort'](_0x594187[_0x50e8('0x29')][_0x50e8('0x14')]);_0x5c2e04[_0x50e8('0x30')]=this[_0x50e8('0x31')](_['pick'](_0x594187[_0x50e8('0x29')],_0x19e3cc[_0x50e8('0x31')]),_0x47ace2);if(_0x594187[_0x50e8('0x29')][_0x50e8('0x32')]){var _0x8e8a97=_0x47ace2;var _0x5c7bef=_0x594187['query'][_0x50e8('0x32')];if(typeof _0x5c7bef===_0x50e8('0x33')){_0x8e8a97=_['filter'](_0x47ace2,function(_0x2ebd77){return _[_0x50e8('0x34')](_0x5c7bef[_0x50e8('0x35')],_0x2ebd77[_0x50e8('0xf')]);});_0x5c7bef=_0x5c7bef[_0x50e8('0x36')];}_0x5c2e04[_0x50e8('0x30')]=_[_0x50e8('0x37')](_0x5c2e04[_0x50e8('0x30')],{'$or':_['map'](_0x8e8a97,function(_0x3d26bd){if(_0x3d26bd[_0x50e8('0x38')]!==_0x50e8('0x39')){if(_0x3e58a9){return sequelize[_0x50e8('0x30')](sequelize['fn']('lower',sequelize[_0x50e8('0x18')](_0x3d26bd[_0x50e8('0xf')])),{'$like':sequelize['fn'](_0x50e8('0x3a'),'%'+_0x594187[_0x50e8('0x29')]['filter']+'%')});}else{var _0x21dfbf={};_0x21dfbf[_0x3d26bd['name']]={'$like':'%'+_0x594187['query']['filter']+'%'};return _0x21dfbf;}}})});}_0x5c2e04=_[_0x50e8('0x37')]({},_0x5c2e04,_0x594187[_0x50e8('0x3b')]);return _0x5c2e04;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 88fbc16..0004a87 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x25131c,_0x55c347){var _0x829a63=function(_0x555ee9){while(--_0x555ee9){_0x25131c['push'](_0x25131c['shift']());}};_0x829a63(++_0x55c347);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x1a381e,_0x3030ab){var _0x4d0482=function(_0x56a0a6){while(--_0x56a0a6){_0x1a381e['push'](_0x1a381e['shift']());}};_0x4d0482(++_0x3030ab);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c359624..46d5ad4 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 _0x1579=['child_process','execSync','networkInterfaces','keys','length','family','internal','concat','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x5c5878,_0x104a5f){var _0x5cf1b0=function(_0x52de20){while(--_0x52de20){_0x5c5878['push'](_0x5c5878['shift']());}};_0x5cf1b0(++_0x104a5f);}(_0x1579,0xfd));var _0x9157=function(_0xf064a5,_0x2cf6bb){_0xf064a5=_0xf064a5-0x0;var _0x2da25a=_0x1579[_0xf064a5];return _0x2da25a;};'use strict';var _=require(_0x9157('0x0'));var os=require('os');var crypto=require(_0x9157('0x1'));var machine=require(_0x9157('0x2'));var exec=require(_0x9157('0x3'))[_0x9157('0x4')];var config=require('../environment');function getInterfaces(){var _0x5dfaaf=[];var _0x5188e0=os[_0x9157('0x5')]();var _0x20e21c=_['orderBy'](_[_0x9157('0x6')](_0x5188e0));for(var _0x5effb0=0x0;_0x5effb0<_0x20e21c[_0x9157('0x7')];_0x5effb0++){var _0x1fd7bd=_0x5188e0[_0x20e21c[_0x5effb0]]['filter'](function(_0x11bfa1){return _0x11bfa1[_0x9157('0x8')]==='IPv4'&&_0x11bfa1[_0x9157('0x9')]===![];});_0x5dfaaf=_0x5dfaaf[_0x9157('0xa')](_0x1fd7bd);}return _0x5dfaaf;}function getFirstInterface(){var _0x51752c=_['head'](getInterfaces());return{'macAddress':_0x51752c&&_0x51752c[_0x9157('0xb')]?_0x51752c[_0x9157('0xb')]:'00:00:00:00:00:00','ipAddress':_0x51752c&&_0x51752c[_0x9157('0xc')]?_0x51752c[_0x9157('0xc')]:_0x9157('0xd')};}exports[_0x9157('0xe')]=getFirstInterface;function getCPUhash(){var _0x316a53=_[_0x9157('0xf')](os[_0x9157('0x10')]()['map'](function(_0x50b696){return _0x50b696[_0x9157('0x11')];}))[_0x9157('0x12')](':');return crypto[_0x9157('0x13')](_0x9157('0x14'))[_0x9157('0x15')](_0x316a53)[_0x9157('0x16')](_0x9157('0x17'));}exports[_0x9157('0x18')]=function(){var _0x3766e8=os[_0x9157('0x19')]();var _0x2b2d7=/[0-9a-f-]{36}/;if(config[_0x9157('0x1a')]&&_0x2b2d7['test'](config[_0x9157('0x1a')])){return config['licenseToken'];}else if(_0x3766e8==='win32'){return exec(_0x9157('0x1b'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x5215eb=getFirstInterface();var _0x1481fc=getCPUhash();var _0x50701d=_0x1481fc+'|'+os[_0x9157('0x1c')]()+'|'+_0x5215eb[_0x9157('0x1d')]+'|'+_0x5215eb[_0x9157('0x1e')];var _0x1422fa=crypto[_0x9157('0x13')]('md5')['update'](_0x50701d)[_0x9157('0x16')](_0x9157('0x17'));return _0x1422fa['substring'](0x0,0x8)+'-'+_0x1422fa['substring'](0x8,0xc)+'-'+_0x1422fa[_0x9157('0x1f')](0xc,0x10)+'-'+_0x1422fa['substring'](0x10,0x14)+'-'+_0x1422fa[_0x9157('0x1f')](0x14);}}; \ No newline at end of file +var _0x8b63=['digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress'];(function(_0x3af083,_0x1342e7){var _0x44ff88=function(_0xffb3c8){while(--_0xffb3c8){_0x3af083['push'](_0x3af083['shift']());}};_0x44ff88(++_0x1342e7);}(_0x8b63,0x156));var _0x38b6=function(_0x2a6cfd,_0x558a8a){_0x2a6cfd=_0x2a6cfd-0x0;var _0x46a9c2=_0x8b63[_0x2a6cfd];return _0x46a9c2;};'use strict';var _=require(_0x38b6('0x0'));var os=require('os');var crypto=require(_0x38b6('0x1'));var machine=require(_0x38b6('0x2'));var exec=require(_0x38b6('0x3'))[_0x38b6('0x4')];var config=require(_0x38b6('0x5'));function getInterfaces(){var _0x11975a=[];var _0x5d2815=os[_0x38b6('0x6')]();var _0x490186=_[_0x38b6('0x7')](_['keys'](_0x5d2815));for(var _0x1239df=0x0;_0x1239df<_0x490186[_0x38b6('0x8')];_0x1239df++){var _0x1c4384=_0x5d2815[_0x490186[_0x1239df]][_0x38b6('0x9')](function(_0x408c8d){return _0x408c8d['family']==='IPv4'&&_0x408c8d[_0x38b6('0xa')]===![];});_0x11975a=_0x11975a['concat'](_0x1c4384);}return _0x11975a;}function getFirstInterface(){var _0x33ba51=_[_0x38b6('0xb')](getInterfaces());return{'macAddress':_0x33ba51&&_0x33ba51[_0x38b6('0xc')]?_0x33ba51[_0x38b6('0xc')]:_0x38b6('0xd'),'ipAddress':_0x33ba51&&_0x33ba51[_0x38b6('0xe')]?_0x33ba51[_0x38b6('0xe')]:_0x38b6('0xf')};}exports[_0x38b6('0x10')]=getFirstInterface;function getCPUhash(){var _0x12031c=_[_0x38b6('0x7')](os[_0x38b6('0x11')]()[_0x38b6('0x12')](function(_0xdbe6ed){return _0xdbe6ed['model'];}))[_0x38b6('0x13')](':');return crypto['createHash']('md5')[_0x38b6('0x14')](_0x12031c)['digest'](_0x38b6('0x15'));}exports[_0x38b6('0x16')]=function(){var _0x124c69=os[_0x38b6('0x17')]();var _0x1abb33=/[0-9a-f-]{36}/;if(config[_0x38b6('0x18')]&&_0x1abb33[_0x38b6('0x19')](config[_0x38b6('0x18')])){return config['licenseToken'];}else if(_0x124c69===_0x38b6('0x1a')){return exec(_0x38b6('0x1b'),{'encoding':_0x38b6('0x1c')})[_0x38b6('0x1d')]('\x0d\x0a','');}else{var _0x254a6f=getFirstInterface();var _0x5108a5=getCPUhash();var _0x2dae1e=_0x5108a5+'|'+os['hostname']()+'|'+_0x254a6f[_0x38b6('0x1e')]+'|'+_0x254a6f[_0x38b6('0x1f')];var _0x145647=crypto['createHash']('md5')['update'](_0x2dae1e)[_0x38b6('0x20')](_0x38b6('0x15'));return _0x145647['substring'](0x0,0x8)+'-'+_0x145647['substring'](0x8,0xc)+'-'+_0x145647[_0x38b6('0x21')](0xc,0x10)+'-'+_0x145647[_0x38b6('0x21')](0x10,0x14)+'-'+_0x145647['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a3fc2a6..8d36c11 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 _0xed4c=['days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','request-promise','bluebird','pkginfo','version','../../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','catch','get','data1','data2','then','active','info','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','diff','decryptString'];(function(_0x2b57cc,_0x556a66){var _0x21e589=function(_0x202ff7){while(--_0x202ff7){_0x2b57cc['push'](_0x2b57cc['shift']());}};_0x21e589(++_0x556a66);}(_0xed4c,0xde));var _0xced4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed4c[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xced4('0x0'));var moment=require('moment');var rp=require(_0xced4('0x1'));var BPromise=require(_0xced4('0x2'));var pkginfo=require(_0xced4('0x3'))(module,_0xced4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xced4('0x5'));var hardware=require('./hardware');var logger=require(_0xced4('0x6'))(_0xced4('0x7'));var HOST=_0xced4('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x473a96){return new BPromise(function(_0x5359d7,_0x1379be){var _0x365e1f=util[_0xced4('0x9')](_0xced4('0xa'),HOST,_0x473a96,module[_0xced4('0xb')][_0xced4('0x4')]);if(oldToken){_0x365e1f=util['format'](_0xced4('0xc'),HOST,_0x473a96,module[_0xced4('0xb')][_0xced4('0x4')],oldToken);}var _0x3128e0={'uri':_0x365e1f,'method':_0xced4('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3128e0)['then'](function(_0x34255e){_0x5359d7(_0x34255e);})[_0xced4('0xe')](function(_0x22345f){_0x1379be(_0x22345f);});});}function manageLicense(_0x27cb2a,_0xdfd345){var _0x330cdb=_0xdfd345[_0xced4('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x330cdb[_0xced4('0x10')]!==_0x27cb2a&&!_0x330cdb[_0xced4('0x11')]){oldToken=_0x330cdb[_0xced4('0x10')];}httpRequest(_0x27cb2a)[_0xced4('0x12')](function(_0x15161c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x15161c[_0xced4('0x13')]){isOldTokenSent=![];if(!_0x330cdb[_0xced4('0x7')]&&_0x330cdb[_0xced4('0x7')]!=_0x15161c[_0xced4('0x7')]||_0x330cdb[_0xced4('0x7')]&&_0x330cdb[_0xced4('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x330cdb['license']&&!_0x330cdb[_0xced4('0x11')]&&_0x330cdb['license']!=_0x15161c['license']){logger[_0xced4('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x330cdb['license']&&!_0x330cdb['data2']&&_0x330cdb[_0xced4('0x7')]==_0x15161c[_0xced4('0x7')]){return _0xdfd345;}return _0xdfd345[_0xced4('0x15')]({'data1':_0x27cb2a,'data2':null,'license':_0x15161c['license']});}else{if(_0x15161c[_0xced4('0x7')]||_0x330cdb[_0xced4('0x7')]){if(!_0x330cdb[_0xced4('0x11')]){if(_0x330cdb['data1']==_0x27cb2a){GRAY_PERIOD_REASON=_0xced4('0x16');logger[_0xced4('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xced4('0x17');logger['info'](_0xced4('0x18'),_0x330cdb[_0xced4('0x10')],_0x27cb2a);}logger[_0xced4('0x14')](_0xced4('0x19'),GRAY_PERIOD_REASON[_0xced4('0x1a')](),moment()[_0xced4('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0xdfd345[_0xced4('0x15')]({'data2':encryptor[_0xced4('0x1b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xced4('0x1c')](encryptor[_0xced4('0x1d')](_0x330cdb[_0xced4('0x11')]),_0xced4('0x1e'))>DAYS){logger[_0xced4('0x14')](_0xced4('0x1f'),moment()[_0xced4('0x9')](_0xced4('0x20')));isOldTokenSent=![];return _0xdfd345[_0xced4('0x15')]({'data1':_0x27cb2a,'data2':null,'license':null});}}}else{if(_0x330cdb[_0xced4('0x10')]!=_0x27cb2a){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x330cdb[_0xced4('0x10')],_0x27cb2a);return _0xdfd345['update']({'data1':_0x27cb2a,'data2':null,'license':null});}}}return _0xdfd345;})['then'](function(_0x4c5149){_0xdfd345=_0x4c5149;})[_0xced4('0xe')](function(_0x5c15a4){logger[_0xced4('0x21')](_0x5c15a4['message']);})[_0xced4('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xced4('0x23')](),_0xdfd345);},TIME);});}function defaultLicense(){var _0x249188=hardware[_0xced4('0x23')]();if(_0x249188){return db[_0xced4('0x24')][_0xced4('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x249188}})[_0xced4('0x26')](function(_0xdcf6f,_0x1a9412){logger[_0xced4('0x14')](_0xced4('0x27'),_0x249188);manageLicense(_0x249188,_0xdcf6f);})[_0xced4('0xe')](function(_0x39bbfc){logger[_0xced4('0x21')](_0x39bbfc[_0xced4('0x28')]);});}}exports[_0xced4('0x29')]=defaultLicense; \ No newline at end of file +var _0x17fa=['version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo'];(function(_0x10ca3c,_0x5ef2d5){var _0x26ec6a=function(_0x50ebd3){while(--_0x50ebd3){_0x10ca3c['push'](_0x10ca3c['shift']());}};_0x26ec6a(++_0x5ef2d5);}(_0x17fa,0xc8));var _0xa17f=function(_0x20b81b,_0x202aad){_0x20b81b=_0x20b81b-0x0;var _0x331ce4=_0x17fa[_0x20b81b];return _0x331ce4;};'use strict';var util=require(_0xa17f('0x0'));var moment=require(_0xa17f('0x1'));var rp=require(_0xa17f('0x2'));var BPromise=require(_0xa17f('0x3'));var pkginfo=require(_0xa17f('0x4'))(module,_0xa17f('0x5'));var db=require(_0xa17f('0x6'))['db'];var encryptor=require(_0xa17f('0x7'));var hardware=require(_0xa17f('0x8'));var logger=require(_0xa17f('0x9'))(_0xa17f('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1f52e5){return new BPromise(function(_0x3f21af,_0x15cad2){var _0x1fdb2c=util[_0xa17f('0xb')](_0xa17f('0xc'),HOST,_0x1f52e5,module[_0xa17f('0xd')][_0xa17f('0x5')]);if(oldToken){_0x1fdb2c=util[_0xa17f('0xb')](_0xa17f('0xe'),HOST,_0x1f52e5,module[_0xa17f('0xd')]['version'],oldToken);}var _0x2f0102={'uri':_0x1fdb2c,'method':_0xa17f('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x2f0102)[_0xa17f('0x10')](function(_0x157b66){_0x3f21af(_0x157b66);})[_0xa17f('0x11')](function(_0x425401){_0x15cad2(_0x425401);});});}function manageLicense(_0x6d5e9a,_0x3e60dd){var _0x451ec7=_0x3e60dd[_0xa17f('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x451ec7['data1']!==_0x6d5e9a&&!_0x451ec7[_0xa17f('0x13')]){oldToken=_0x451ec7[_0xa17f('0x14')];}httpRequest(_0x6d5e9a)[_0xa17f('0x10')](function(_0x5c7540){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5c7540[_0xa17f('0x15')]){isOldTokenSent=![];if(!_0x451ec7[_0xa17f('0xa')]&&_0x451ec7['license']!=_0x5c7540[_0xa17f('0xa')]||_0x451ec7[_0xa17f('0xa')]&&_0x451ec7['data2']){logger['info'](_0xa17f('0x16'));}if(_0x451ec7[_0xa17f('0xa')]&&!_0x451ec7[_0xa17f('0x13')]&&_0x451ec7[_0xa17f('0xa')]!=_0x5c7540['license']){logger[_0xa17f('0x17')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x451ec7[_0xa17f('0xa')]&&!_0x451ec7[_0xa17f('0x13')]&&_0x451ec7[_0xa17f('0xa')]==_0x5c7540[_0xa17f('0xa')]){return _0x3e60dd;}return _0x3e60dd[_0xa17f('0x18')]({'data1':_0x6d5e9a,'data2':null,'license':_0x5c7540[_0xa17f('0xa')]});}else{if(_0x5c7540['license']||_0x451ec7[_0xa17f('0xa')]){if(!_0x451ec7['data2']){if(_0x451ec7[_0xa17f('0x14')]==_0x6d5e9a){GRAY_PERIOD_REASON=_0xa17f('0x19');logger['info'](_0xa17f('0x1a'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xa17f('0x17')](_0xa17f('0x1b'),_0x451ec7[_0xa17f('0x14')],_0x6d5e9a);}logger[_0xa17f('0x17')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xa17f('0x1c')](),moment()[_0xa17f('0xb')](_0xa17f('0x1d')));return _0x3e60dd[_0xa17f('0x18')]({'data2':encryptor[_0xa17f('0x1e')](moment()[_0xa17f('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xa17f('0x1f')](encryptor[_0xa17f('0x20')](_0x451ec7[_0xa17f('0x13')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xa17f('0xb')](_0xa17f('0x1d')));isOldTokenSent=![];return _0x3e60dd[_0xa17f('0x18')]({'data1':_0x6d5e9a,'data2':null,'license':null});}}}else{if(_0x451ec7[_0xa17f('0x14')]!=_0x6d5e9a){logger[_0xa17f('0x17')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x451ec7[_0xa17f('0x14')],_0x6d5e9a);return _0x3e60dd['update']({'data1':_0x6d5e9a,'data2':null,'license':null});}}}return _0x3e60dd;})[_0xa17f('0x10')](function(_0x5471a4){_0x3e60dd=_0x5471a4;})['catch'](function(_0xeb37b){logger['error'](_0xeb37b[_0xa17f('0x21')]);})[_0xa17f('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3e60dd);},TIME);});}function defaultLicense(){var _0x2fa7a7=hardware[_0xa17f('0x23')]();if(_0x2fa7a7){return db['License'][_0xa17f('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x2fa7a7}})[_0xa17f('0x25')](function(_0x15c615,_0x4cd571){logger['info'](_0xa17f('0x26'),_0x2fa7a7);manageLicense(_0x2fa7a7,_0x15c615);})['catch'](function(_0x43c94f){logger[_0xa17f('0x27')](_0x43c94f[_0xa17f('0x21')]);});}}exports[_0xa17f('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7905948..b1e3cad 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 _0x822e=['exports','util','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','count','admin','user','users','telephones','forEach','pick','countBy','telephone'];(function(_0x470854,_0x16cc61){var _0x26d9b5=function(_0x56de6d){while(--_0x56de6d){_0x470854['push'](_0x470854['shift']());}};_0x26d9b5(++_0x16cc61);}(_0x822e,0x8b));var _0xe822=function(_0x4c5500,_0x14d2b4){_0x4c5500=_0x4c5500-0x0;var _0x18ad0b=_0x822e[_0x4c5500];return _0x18ad0b;};'use strict';var util=require(_0xe822('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xe822('0x1'));var hardware=require('./hardware');var encryptor=require(_0xe822('0x2'));var db=require(_0xe822('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe822('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe822('0x5'),'machineUuid':hardware[_0xe822('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe822('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe822('0x7'),'machineUuid':hardware[_0xe822('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5d4937){return new BPromise(function(_0x2fda49,_0x492e5e){return db['License'][_0xe822('0x8')](_['defaults'](_0x5d4937,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4c98c9){return checkLicense(_0x4c98c9,null);})[_0xe822('0x9')](function(_0x413129){_0x2fda49(_0x413129);return;})[_0xe822('0xa')](function(_0x1bc151){_0x492e5e(_0x1bc151);});});}function checkLicense(_0x44672d,_0x5b1385){if(!_0x44672d){demoLicense[_0xe822('0xb')]=_0x44672d[_0xe822('0xc')];return demoLicense;}try{var _0x6aa51=_0x5b1385||_0x44672d[_0xe822('0xd')];if(_[_0xe822('0xe')](_0x6aa51)){throw new Error(_0xe822('0xf'));}var _0x46d998=_0x44672d['data1'];var _0x4320e0=_0x44672d[_0xe822('0x10')];var _0x3fd7ae=_0x46d998[_0xe822('0x11')]('-')[0x4];var _0x7621bf=_0x46d998['split']('-')[0x0];var _0xe4a7b2=encryptor[_0xe822('0x12')](_0x6aa51,util[_0xe822('0x13')](_0xe822('0x14'),_0x3fd7ae,_0x46d998,_0x7621bf));var _0x1963fc=JSON[_0xe822('0x15')](_0xe4a7b2);_0x1963fc[_0xe822('0x16')]=![];_0x1963fc[_0xe822('0xb')]=_0x46d998;_0x1963fc[_0xe822('0x17')]=hardware[_0xe822('0x6')]();if(_0x4320e0){var _0x3c9385=encryptor[_0xe822('0x12')](_0x4320e0);_0x1963fc[_0xe822('0x18')]=_0x3c9385;_0x1963fc[_0xe822('0x19')]=moment(_0x3c9385)[_0xe822('0x1a')](0x7,_0xe822('0x1b'))[_0xe822('0x13')]();_0x1963fc[_0xe822('0x1c')]=_0x1963fc['uuid']!=_0x1963fc[_0xe822('0x17')]?_0xe822('0x1d'):_0xe822('0x1e');}return _0x1963fc;}catch(_0x505b37){breakingLicense['uuid']=_0x44672d[_0xe822('0xc')];breakingLicense['message']=_0x505b37[_0xe822('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x305cee,_0x4423f2){getLicense()[_0xe822('0x9')](function(_0x28ef9d){return db[_0xe822('0x20')][_0xe822('0x21')]({'attributes':[_0xe822('0x22'),[db[_0xe822('0x23')]['fn']('COUNT',db[_0xe822('0x23')]['col'](_0xe822('0x22'))),_0xe822('0x24')]],'group':_0xe822('0x22'),'where':{'role':{'$or':[_0xe822('0x25'),_0xe822('0x26'),'telephone']}},'raw':!![]})['then'](function(_0x295a0b){var _0x1a3faf={'user':_0x28ef9d[_0xe822('0x27')]||0x0,'telephone':_0x28ef9d[_0xe822('0x28')]||0x0};_0x295a0b[_0xe822('0x29')](function(_0x3bd85e){var _0x2646e3=_0x3bd85e['role']==='admin'?_0xe822('0x26'):_0x3bd85e[_0xe822('0x22')];_0x1a3faf[_0x2646e3]-=_0x3bd85e['count'];if(_0x1a3faf[_0x2646e3]<0x0)_0x1a3faf[_0x2646e3]=0x0;});_0x305cee(_0x1a3faf);return;});})[_0xe822('0xa')](function(_0x4a0232){_0x4423f2(_0x4a0232);});});}function checkUserLimits(_0x2d3605){return new BPromise(function(_0x4eb7c8,_0x230801){getLimits()[_0xe822('0x9')](function(_0x3fb2d2){var _0x5d8919=_[_0xe822('0x2a')](_[_0xe822('0x2b')](_0x2d3605,'role'),[_0xe822('0x25'),_0xe822('0x26'),_0xe822('0x2c')]);var _0x59690f=(_0x5d8919[_0xe822('0x25')]||0x0)+(_0x5d8919['user']||0x0);var _0x49129d=_0x5d8919[_0xe822('0x2c')]||0x0;if(_0x59690f>_0x3fb2d2[_0xe822('0x26')])return _0x230801('License\x20limit\x20reached\x20for\x20users');if(_0x49129d>_0x3fb2d2['telephone'])return _0x230801('License\x20limit\x20reached\x20for\x20telephones');return _0x4eb7c8();})[_0xe822('0xa')](function(_0x2d8347){_0x230801(_0x2d8347);});});}module[_0xe822('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0d25=['Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','days','grayReason','machineUuid','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x2e746d,_0xadce30){var _0x126d2d=function(_0x42d6b1){while(--_0x42d6b1){_0x2e746d['push'](_0x2e746d['shift']());}};_0x126d2d(++_0xadce30);}(_0x0d25,0x119));var _0x50d2=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x0d25[_0x280ae7];return _0x418b9e;};'use strict';var util=require(_0x50d2('0x0'));var _=require(_0x50d2('0x1'));var moment=require(_0x50d2('0x2'));var BPromise=require(_0x50d2('0x3'));var hardware=require(_0x50d2('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x50d2('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x50d2('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x50d2('0x7'),'machineUuid':hardware[_0x50d2('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x50d2('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x50d2('0x9'),'machineUuid':hardware[_0x50d2('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x26dde4){return new BPromise(function(_0x2d46b2,_0x56ca15){return db[_0x50d2('0xa')][_0x50d2('0xb')](_[_0x50d2('0xc')](_0x26dde4,{'raw':!![],'where':{'id':0x1}}))[_0x50d2('0xd')](function(_0x135825){return checkLicense(_0x135825,null);})[_0x50d2('0xd')](function(_0x20ef3e){_0x2d46b2(_0x20ef3e);return;})[_0x50d2('0xe')](function(_0x2d0c6c){_0x56ca15(_0x2d0c6c);});});}function checkLicense(_0x5064f9,_0x2d7443){if(!_0x5064f9){demoLicense[_0x50d2('0xf')]=_0x5064f9[_0x50d2('0x10')];return demoLicense;}try{var _0x3daa21=_0x2d7443||_0x5064f9[_0x50d2('0x11')];if(_[_0x50d2('0x12')](_0x3daa21)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x535d84=_0x5064f9['data1'];var _0x4a951a=_0x5064f9[_0x50d2('0x13')];var _0x4e527d=_0x535d84[_0x50d2('0x14')]('-')[0x4];var _0x44944e=_0x535d84['split']('-')[0x0];var _0x5016e3=encryptor[_0x50d2('0x15')](_0x3daa21,util[_0x50d2('0x16')](_0x50d2('0x17'),_0x4e527d,_0x535d84,_0x44944e));var _0x5d0345=JSON[_0x50d2('0x18')](_0x5016e3);_0x5d0345[_0x50d2('0x19')]=![];_0x5d0345[_0x50d2('0xf')]=_0x535d84;_0x5d0345['machineUuid']=hardware['getUuid']();if(_0x4a951a){var _0x5ed066=encryptor[_0x50d2('0x15')](_0x4a951a);_0x5d0345[_0x50d2('0x1a')]=_0x5ed066;_0x5d0345[_0x50d2('0x1b')]=moment(_0x5ed066)['add'](0x7,_0x50d2('0x1c'))[_0x50d2('0x16')]();_0x5d0345[_0x50d2('0x1d')]=_0x5d0345['uuid']!=_0x5d0345[_0x50d2('0x1e')]?'changed':'disabled';}return _0x5d0345;}catch(_0x54612d){breakingLicense[_0x50d2('0xf')]=_0x5064f9[_0x50d2('0x10')];breakingLicense['message']=_0x54612d[_0x50d2('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c9c76,_0x3a6843){getLicense()[_0x50d2('0xd')](function(_0x1fb9d1){return db[_0x50d2('0x20')][_0x50d2('0x21')]({'attributes':[_0x50d2('0x22'),[db[_0x50d2('0x23')]['fn'](_0x50d2('0x24'),db[_0x50d2('0x23')][_0x50d2('0x25')](_0x50d2('0x22'))),_0x50d2('0x26')]],'group':_0x50d2('0x22'),'where':{'role':{'$or':[_0x50d2('0x27'),'user',_0x50d2('0x28')]}},'raw':!![]})['then'](function(_0x11cf90){var _0x2168aa={'user':_0x1fb9d1['users']||0x0,'telephone':_0x1fb9d1[_0x50d2('0x29')]||0x0};_0x11cf90[_0x50d2('0x2a')](function(_0x3ccd5a){var _0x2ecca7=_0x3ccd5a[_0x50d2('0x22')]==='admin'?_0x50d2('0x2b'):_0x3ccd5a[_0x50d2('0x22')];_0x2168aa[_0x2ecca7]-=_0x3ccd5a[_0x50d2('0x26')];if(_0x2168aa[_0x2ecca7]<0x0)_0x2168aa[_0x2ecca7]=0x0;});_0x2c9c76(_0x2168aa);return;});})[_0x50d2('0xe')](function(_0x2edb77){_0x3a6843(_0x2edb77);});});}function checkUserLimits(_0x3ee62e){return new BPromise(function(_0x1ba23a,_0xc31bc4){getLimits()['then'](function(_0x5dc798){var _0x24975b=_[_0x50d2('0x2c')](_[_0x50d2('0x2d')](_0x3ee62e,_0x50d2('0x22')),[_0x50d2('0x27'),'user','telephone']);var _0x444728=(_0x24975b[_0x50d2('0x27')]||0x0)+(_0x24975b[_0x50d2('0x2b')]||0x0);var _0x223d71=_0x24975b[_0x50d2('0x28')]||0x0;if(_0x444728>_0x5dc798[_0x50d2('0x2b')])return _0xc31bc4('License\x20limit\x20reached\x20for\x20users');if(_0x223d71>_0x5dc798['telephone'])return _0xc31bc4(_0x50d2('0x2e'));return _0x1ba23a();})[_0x50d2('0xe')](function(_0x188961){_0xc31bc4(_0x188961);});});}module[_0x50d2('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5443321..a064d73 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 _0x6cb4=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x225116,_0x5cafec){var _0x5c66a5=function(_0xaaa81c){while(--_0xaaa81c){_0x225116['push'](_0x225116['shift']());}};_0x5c66a5(++_0x5cafec);}(_0x6cb4,0xff));var _0x46cb=function(_0x5c3f03,_0x376e4a){_0x5c3f03=_0x5c3f03-0x0;var _0x34f4c5=_0x6cb4[_0x5c3f03];return _0x34f4c5;};'use strict';module[_0x46cb('0x0')]={'DOMAIN':_0x46cb('0x1'),'SESSION_SECRET':_0x46cb('0x2'),'GOOGLE_ID':_0x46cb('0x3'),'GOOGLE_SECRET':_0x46cb('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xea28=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x2f4754,_0x373bf3){var _0x246cf8=function(_0x3161b2){while(--_0x3161b2){_0x2f4754['push'](_0x2f4754['shift']());}};_0x246cf8(++_0x373bf3);}(_0xea28,0x13a));var _0x8ea2=function(_0x21377e,_0x2cf298){_0x21377e=_0x21377e-0x0;var _0x329cf3=_0xea28[_0x21377e];return _0x329cf3;};'use strict';module[_0x8ea2('0x0')]={'DOMAIN':_0x8ea2('0x1'),'SESSION_SECRET':_0x8ea2('0x2'),'GOOGLE_ID':_0x8ea2('0x3'),'GOOGLE_SECRET':_0x8ea2('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b1e006f..fd04b36 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51b0=['exports','../utils/loggers','fileLogger'];(function(_0x33ae14,_0x15f853){var _0x15753f=function(_0x3d9b4d){while(--_0x3d9b4d){_0x33ae14['push'](_0x33ae14['shift']());}};_0x15753f(++_0x15f853);}(_0x51b0,0xf1));var _0x051b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x51b0[_0x160c73];return _0xd9302;};'use strict';var fileLogger=require(_0x051b('0x0'))[_0x051b('0x1')];module[_0x051b('0x2')]=fileLogger; \ No newline at end of file +var _0xcba8=['../utils/loggers','exports'];(function(_0x44b5b6,_0x39a246){var _0x4701a3=function(_0x38f2f6){while(--_0x38f2f6){_0x44b5b6['push'](_0x44b5b6['shift']());}};_0x4701a3(++_0x39a246);}(_0xcba8,0xde));var _0x8cba=function(_0x1aa37a,_0x4e5396){_0x1aa37a=_0x1aa37a-0x0;var _0x8bb366=_0xcba8[_0x1aa37a];return _0x8bb366;};'use strict';var fileLogger=require(_0x8cba('0x0'))['fileLogger'];module[_0x8cba('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6fafba7..eff0081 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 _0x0a6b=['ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','../../services/xdr/index.js','path','express','join','../../services/express/index.js'];(function(_0xb7368b,_0xf11033){var _0x37d43b=function(_0x4562ed){while(--_0x4562ed){_0xb7368b['push'](_0xb7368b['shift']());}};_0x37d43b(++_0xf11033);}(_0x0a6b,0x1a0));var _0xb0a6=function(_0x1ab8f8,_0x387f87){_0x1ab8f8=_0x1ab8f8-0x0;var _0x777a63=_0x0a6b[_0x1ab8f8];return _0x777a63;};'use strict';var path=require(_0xb0a6('0x0'));var os=require('os');var config={'apps':[{'name':_0xb0a6('0x1'),'script':path[_0xb0a6('0x2')](__dirname,_0xb0a6('0x3'))},{'name':_0xb0a6('0x4'),'script':path[_0xb0a6('0x2')](__dirname,_0xb0a6('0x5'))},{'name':_0xb0a6('0x6'),'script':path[_0xb0a6('0x2')](__dirname,_0xb0a6('0x7'))},{'name':_0xb0a6('0x8'),'script':path[_0xb0a6('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xb0a6('0x9'),'script':path[_0xb0a6('0x2')](__dirname,_0xb0a6('0xa'))},{'name':'xdr','script':path['join'](__dirname,_0xb0a6('0xb'))}]};module['exports']=config; \ No newline at end of file +var _0x57f7=['agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js'];(function(_0x5839d3,_0xe54d19){var _0x2367a1=function(_0x1e8292){while(--_0x1e8292){_0x5839d3['push'](_0x5839d3['shift']());}};_0x2367a1(++_0xe54d19);}(_0x57f7,0x14e));var _0x757f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x57f7[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x757f('0x0'));var os=require('os');var config={'apps':[{'name':_0x757f('0x1'),'script':path[_0x757f('0x2')](__dirname,_0x757f('0x3'))},{'name':'ami','script':path[_0x757f('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x757f('0x4'),'script':path[_0x757f('0x2')](__dirname,_0x757f('0x5'))},{'name':_0x757f('0x6'),'script':path[_0x757f('0x2')](__dirname,_0x757f('0x7'))},{'name':_0x757f('0x8'),'script':path['join'](__dirname,_0x757f('0x9'))},{'name':_0x757f('0xa'),'script':path[_0x757f('0x2')](__dirname,_0x757f('0xb'))}]};module[_0x757f('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 226d8e2..d5dce85 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 _0x2310=['list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','stop','then','disconnect','restart'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2310,0x171));var _0x0231=function(_0x2bc061,_0x20a594){_0x2bc061=_0x2bc061-0x0;var _0x3a1435=_0x2310[_0x2bc061];return _0x3a1435;};'use strict';var pm2=require(_0x0231('0x0'));var BPromise=require(_0x0231('0x1'));var config=require(_0x0231('0x2'));function connect(){return new BPromise(function(_0x3beb0b,_0x541f2d){return pm2['connect'](function(_0x527019){if(_0x527019){return _0x541f2d(_0x527019);}return _0x3beb0b(_0x0231('0x3'));});});};exports['start']=function(_0x144d00){return connect()['then'](function(){return new BPromise(function(_0x210c39,_0x2ce694){return pm2[_0x0231('0x4')](_0x144d00,function(_0x10cd73,_0x5ac923){if(_0x10cd73){return _0x2ce694(_0x10cd73);}pm2['disconnect']();return _0x210c39(_0x5ac923);});});});};exports[_0x0231('0x5')]=function(_0x583bba){return connect()[_0x0231('0x6')](function(){return new BPromise(function(_0x18cf76,_0x17d7e7){return pm2['stop'](_0x583bba,function(_0x5f24b7,_0x58186e){if(_0x5f24b7){return _0x17d7e7(_0x5f24b7);}pm2[_0x0231('0x7')]();return _0x18cf76(_0x58186e);});});});};exports[_0x0231('0x8')]=function(_0x253a5c){return connect()[_0x0231('0x6')](function(){return new BPromise(function(_0x55a3ce,_0x359e5a){return pm2['restart'](_0x253a5c,function(_0x369622,_0x217c8c){if(_0x369622){return _0x359e5a(_0x369622);}pm2[_0x0231('0x7')]();return _0x55a3ce(_0x217c8c);});});});};exports[_0x0231('0x9')]=function(){return connect()[_0x0231('0x6')](function(){return new BPromise(function(_0x475767,_0xb691b8){return pm2[_0x0231('0x9')](function(_0x13e50d,_0x1c719e){if(_0x13e50d){return _0xb691b8(_0x13e50d);}pm2[_0x0231('0x7')]();return _0x475767(_0x1c719e);});});});};exports[_0x0231('0xa')]=function(_0x1318d0){return connect()['then'](function(){return new BPromise(function(_0x5248ee,_0x1ac74a){return pm2['describe'](_0x1318d0,function(_0x4fbc4f,_0x146414){if(_0x4fbc4f){return _0x1ac74a(_0x4fbc4f);}pm2['disconnect']();return _0x5248ee(_0x146414);});});});};exports[_0x0231('0xb')]=function(_0x499aff){return connect()[_0x0231('0x6')](function(){return new BPromise(function(_0xb3b305,_0x3eea3e){return pm2[_0x0231('0xb')](_0x499aff,function(_0x33e18d,_0x9c6b7d){if(_0x33e18d){return _0x3eea3e(_0x33e18d);}pm2[_0x0231('0x7')]();return _0xb3b305(_0x9c6b7d);});});});};exports[_0x0231('0xc')]=function(){return connect()[_0x0231('0x6')](function(){return new BPromise(function(_0x1efd2b,_0x1993af){return pm2[_0x0231('0xc')](function(_0x48962b){if(_0x48962b){return _0x1993af(_0x48962b);}return _0x1efd2b(_0x0231('0xd'));});});});}; \ No newline at end of file +var _0xab77=['saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x292346,_0x4f25e4){var _0x4f1a97=function(_0x14ef70){while(--_0x14ef70){_0x292346['push'](_0x292346['shift']());}};_0x4f1a97(++_0x4f25e4);}(_0xab77,0xef));var _0x7ab7=function(_0x1bf32f,_0x2e994e){_0x1bf32f=_0x1bf32f-0x0;var _0x147063=_0xab77[_0x1bf32f];return _0x147063;};'use strict';var pm2=require(_0x7ab7('0x0'));var BPromise=require(_0x7ab7('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x42a8eb,_0x41f008){return pm2[_0x7ab7('0x2')](function(_0x313bd9){if(_0x313bd9){return _0x41f008(_0x313bd9);}return _0x42a8eb(_0x7ab7('0x3'));});});};exports[_0x7ab7('0x4')]=function(_0x509da5){return connect()[_0x7ab7('0x5')](function(){return new BPromise(function(_0x3f009b,_0xc06f99){return pm2[_0x7ab7('0x4')](_0x509da5,function(_0x4d529f,_0x5c6d20){if(_0x4d529f){return _0xc06f99(_0x4d529f);}pm2[_0x7ab7('0x6')]();return _0x3f009b(_0x5c6d20);});});});};exports[_0x7ab7('0x7')]=function(_0x1c19c9){return connect()[_0x7ab7('0x5')](function(){return new BPromise(function(_0x1e2b2b,_0x89d102){return pm2[_0x7ab7('0x7')](_0x1c19c9,function(_0x402bc1,_0x185374){if(_0x402bc1){return _0x89d102(_0x402bc1);}pm2[_0x7ab7('0x6')]();return _0x1e2b2b(_0x185374);});});});};exports[_0x7ab7('0x8')]=function(_0x3c1660){return connect()[_0x7ab7('0x5')](function(){return new BPromise(function(_0x1affe9,_0x5774b6){return pm2[_0x7ab7('0x8')](_0x3c1660,function(_0x16a56d,_0x7c1a7a){if(_0x16a56d){return _0x5774b6(_0x16a56d);}pm2[_0x7ab7('0x6')]();return _0x1affe9(_0x7c1a7a);});});});};exports[_0x7ab7('0x9')]=function(){return connect()[_0x7ab7('0x5')](function(){return new BPromise(function(_0x4b28ac,_0x29bcc7){return pm2['list'](function(_0x33b124,_0x30a52d){if(_0x33b124){return _0x29bcc7(_0x33b124);}pm2[_0x7ab7('0x6')]();return _0x4b28ac(_0x30a52d);});});});};exports[_0x7ab7('0xa')]=function(_0x15c093){return connect()[_0x7ab7('0x5')](function(){return new BPromise(function(_0xae2242,_0x315f8f){return pm2['describe'](_0x15c093,function(_0x3c2e0b,_0x130582){if(_0x3c2e0b){return _0x315f8f(_0x3c2e0b);}pm2['disconnect']();return _0xae2242(_0x130582);});});});};exports[_0x7ab7('0xb')]=function(_0x1cf6fa){return connect()[_0x7ab7('0x5')](function(){return new BPromise(function(_0x2bfb7d,_0x53449c){return pm2[_0x7ab7('0xb')](_0x1cf6fa,function(_0x522c34,_0x5553d1){if(_0x522c34){return _0x53449c(_0x522c34);}pm2[_0x7ab7('0x6')]();return _0x2bfb7d(_0x5553d1);});});});};exports[_0x7ab7('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3c26ff,_0xd686eb){return pm2[_0x7ab7('0xc')](function(_0x248f2a){if(_0x248f2a){return _0xd686eb(_0x248f2a);}return _0x3c26ff(_0x7ab7('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1ad80d8..2014822 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 _0x4a56=['lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','subtract','length','map','info','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x3f6fe6,_0x52243c){var _0xebbe7f=function(_0x49adff){while(--_0x49adff){_0x3f6fe6['push'](_0x3f6fe6['shift']());}};_0xebbe7f(++_0x52243c);}(_0x4a56,0xf3));var _0x64a5=function(_0x40f636,_0x3bef62){_0x40f636=_0x40f636-0x0;var _0x41e503=_0x4a56[_0x40f636];return _0x41e503;};'use strict';var _=require(_0x64a5('0x0'));var moment=require(_0x64a5('0x1'));var Redis=require(_0x64a5('0x2'));var util=require(_0x64a5('0x3'));var config=require(_0x64a5('0x4'));var db=require(_0x64a5('0x5'))['db'];var logger=require(_0x64a5('0x6'))('schedule');config[_0x64a5('0x7')]=_['defaults'](config[_0x64a5('0x7')],{'host':_0x64a5('0x8'),'port':0x18eb});var io=require(_0x64a5('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x216b8a=0x0;var _0x430b29=[];return db['Setting'][_0x64a5('0xa')]({'raw':!![],'attributes':['id',_0x64a5('0xb')],'where':{'id':0x1}})['then'](function(_0x3f4423){_0x216b8a=_0x3f4423[_0x64a5('0xb')];if(_0x216b8a){return db[_0x64a5('0xc')][_0x64a5('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x64a5('0xe')](_0x3f4423[_0x64a5('0xb')],'minutes')}}});}else{return[];}})['then'](function(_0x38acd6){if(_0x38acd6&&_0x38acd6[_0x64a5('0xf')]){_0x430b29=_[_0x64a5('0x10')](_0x38acd6||[],'id');logger[_0x64a5('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x430b29[_0x64a5('0x12')]());return db[_0x64a5('0xc')][_0x64a5('0x13')]({'closeReason':'system','disposition':_0x64a5('0x14'),'closed':!![],'closedAt':moment()[_0x64a5('0x15')](_0x64a5('0x16'))},{'where':{'id':_0x430b29}});}})[_0x64a5('0x17')](function(){if(_0x430b29&&_0x430b29[_0x64a5('0xf')]){logger[_0x64a5('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x430b29[_0x64a5('0x12')]());for(var _0x44b39c=0x0;_0x44b39c<_0x430b29[_0x64a5('0xf')];_0x44b39c++){io['emit']('chatInteraction:update',{'id':_0x430b29[_0x44b39c],'closed':!![]});}}})['catch'](function(_0x1d4a1a){logger[_0x64a5('0x18')](_0x64a5('0x19'),_0x1d4a1a?util[_0x64a5('0x1a')](_0x1d4a1a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x44f6=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../logger','schedule','redis','defaults','socket.io-emitter','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x44f6,0x101));var _0x644f=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x44f6[_0x33554b];return _0x256954;};'use strict';var _=require(_0x644f('0x0'));var moment=require(_0x644f('0x1'));var Redis=require('ioredis');var util=require(_0x644f('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x644f('0x3'))(_0x644f('0x4'));config[_0x644f('0x5')]=_[_0x644f('0x6')](config[_0x644f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x644f('0x7'))(new Redis(config[_0x644f('0x5')]));function closeInteractions(){var _0x4b9624=0x0;var _0x17a426=[];return db['Setting'][_0x644f('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x644f('0x9')](function(_0x31ca27){_0x4b9624=_0x31ca27[_0x644f('0xa')];if(_0x4b9624){return db[_0x644f('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x644f('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x644f('0xd')](_0x31ca27['chatTimeout'],_0x644f('0xe'))}}});}else{return[];}})[_0x644f('0x9')](function(_0x20cc4a){if(_0x20cc4a&&_0x20cc4a['length']){_0x17a426=_['map'](_0x20cc4a||[],'id');logger['info'](_0x644f('0xf'),_0x17a426[_0x644f('0x10')]());return db['ChatInteraction'][_0x644f('0x11')]({'closeReason':_0x644f('0x12'),'disposition':_0x644f('0x13'),'closed':!![],'closedAt':moment()[_0x644f('0x14')](_0x644f('0x15'))},{'where':{'id':_0x17a426}});}})['then'](function(){if(_0x17a426&&_0x17a426[_0x644f('0x16')]){logger['info'](_0x644f('0x17'),_0x17a426['join']());for(var _0x329dd9=0x0;_0x329dd9<_0x17a426[_0x644f('0x16')];_0x329dd9++){io[_0x644f('0x18')](_0x644f('0x19'),{'id':_0x17a426[_0x329dd9],'closed':!![]});}}})['catch'](function(_0x26e8d4){logger['error'](_0x644f('0x1a'),_0x26e8d4?util[_0x644f('0x1b')](_0x26e8d4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 6d6b568..a35d81f 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e14=['startAllRefreshIntervals','exports'];(function(_0x290ef5,_0x32cfa7){var _0x450d92=function(_0x4308db){while(--_0x4308db){_0x290ef5['push'](_0x290ef5['shift']());}};_0x450d92(++_0x32cfa7);}(_0x3e14,0x1d0));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';function start(){var _0x23573f=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x23573f[_0x43e1('0x0')]();}module[_0x43e1('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xcfa0=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xcfa0,0x7e));var _0x0cfa=function(_0x30e952,_0x123520){_0x30e952=_0x30e952-0x0;var _0x2cf13a=_0xcfa0[_0x30e952];return _0x2cf13a;};'use strict';function start(){var _0x598fd4=require(_0x0cfa('0x0'));return _0x598fd4[_0x0cfa('0x1')]();}module[_0x0cfa('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index f217b55..b256cd9 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 _0x5f86=['scheduled','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','isBetween','update','update\x20cron','run','path','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','Smtp','user','bcc','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','text','sendIfEmpty','request','SendMail','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x5f86,0x81));var _0x65f8=function(_0x744c69,_0x49b3be){_0x744c69=_0x744c69-0x0;var _0x3aa3e8=_0x5f86[_0x744c69];return _0x3aa3e8;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x65f8('0x0'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x65f8('0x1'));var jayson=require(_0x65f8('0x2'));var BPromise=require(_0x65f8('0x3'));var logger=require(_0x65f8('0x4'))(_0x65f8('0x5'));var db=require(_0x65f8('0x6'))['db'];var analyticCustomReportController=require(_0x65f8('0x7'));var analyticDefaultReportController=require(_0x65f8('0x8'));var client=jayson[_0x65f8('0x9')][_0x65f8('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xdae84c,_0x180aa8){return function(){logger[_0x65f8('0xb')](_0x65f8('0xc'),_0xdae84c[_0x65f8('0xd')]);var _0xacf2=!![];var _0x353102=_0xdae84c[_0x65f8('0xe')][_0x65f8('0xf')]();var _0x4e7ebf={'account':_0x353102,'message':{'from':util[_0x65f8('0x10')]('\x22%s\x22\x20<%s>',_0xdae84c[_0x65f8('0xe')]['name'],_0xdae84c['MailAccount'][_0x65f8('0xd')]||_0xdae84c[_0x65f8('0xe')][_0x65f8('0x11')][_0x65f8('0x12')]),'to':_0xdae84c[_0x65f8('0xd')],'cc':_0xdae84c['cc'],'bcc':_0xdae84c[_0x65f8('0x13')],'subject':util[_0x65f8('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x180aa8['name'],_0xdae84c['subtractNumber'],_0xdae84c[_0x65f8('0x14')])}};var _0x313dec=path[_0x65f8('0x15')](__dirname,_0x65f8('0x16'));var _0x441ef5=_0x180aa8[_0x65f8('0x17')];var _0x374cbd=util[_0x65f8('0x10')](_0x65f8('0x18'),path[_0x65f8('0x19')](_0x180aa8[_0x65f8('0x17')],path[_0x65f8('0x1a')](_0x180aa8[_0x65f8('0x17')])),_0x65f8('0x1b'));var _0x2dd7d3=path[_0x65f8('0x15')](_0x313dec,_0x441ef5);var _0x3ab0db=path[_0x65f8('0x15')](_0x313dec,_0x374cbd);if(fs[_0x65f8('0x1c')](_0x2dd7d3)){_0x180aa8['status']=_0x65f8('0x1d');_0x4e7ebf[_0x65f8('0x1e')][_0x65f8('0x1f')]=[{'filename':_0x441ef5,'path':_0x2dd7d3}];_0x4e7ebf[_0x65f8('0x1e')]['text']=util[_0x65f8('0x10')](_0x65f8('0x20'),JSON[_0x65f8('0x21')](_0x180aa8,null,0x2));}else if(fs['existsSync'](_0x3ab0db)){_0x180aa8[_0x65f8('0x22')]=_0x65f8('0x1d');_0x4e7ebf[_0x65f8('0x1e')][_0x65f8('0x1f')]=[{'filename':_0x374cbd,'path':_0x3ab0db}];}else{_0x4e7ebf[_0x65f8('0x1e')][_0x65f8('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xdae84c[_0x65f8('0x24')]){_0xacf2=![];logger[_0x65f8('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0xacf2){return client[_0x65f8('0x25')](_0x65f8('0x26'),_0x4e7ebf)['then'](function(_0x1358d8){if(_0x1358d8['error']){return logger[_0x65f8('0x27')](_0x65f8('0x28'),JSON['stringify'](_0x1358d8));}return logger[_0x65f8('0xb')](_0x65f8('0x29'));})[_0x65f8('0x2a')](function(_0xc4f6f3){return logger[_0x65f8('0x27')](_0x65f8('0x28'),JSON[_0x65f8('0x21')](_0xc4f6f3));});}};}function handleError(){return function(_0x271efc){return logger['error'](JSON[_0x65f8('0x21')](_0x271efc));};}function handleResult(_0x5bfdc7){return function(_0x2e9170){logger[_0x65f8('0xb')]('data',JSON[_0x65f8('0x21')](_0x2e9170));if(_0x5bfdc7[_0x65f8('0xe')]&&_0x5bfdc7['MailAccount']['Smtp']&&!_[_0x65f8('0x2b')](_0x5bfdc7[_0x65f8('0xd')])){setTimeout(handleSendEmail(_0x5bfdc7,_0x2e9170),0x3c*0x3e8);}};}function handleJob(_0x1d145c){return function(){try{if(_[_0x65f8('0x2b')](_0x1d145c[_0x65f8('0x2c')])){return logger['info'](_0x65f8('0x2d'));}if(_[_0x65f8('0x2b')](_0x1d145c['subtractUnit'])){return logger[_0x65f8('0xb')](_0x65f8('0x2e'));}var _0x5dbbb1={'startDate':moment()[_0x65f8('0x2f')](_0x1d145c[_0x65f8('0x2c')],_0x1d145c['subtractUnit'])['format'](_0x65f8('0x30')),'endDate':moment()[_0x65f8('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x65f8('0x31'),'output':_0x1d145c['output'],'name':_0x1d145c[_0x65f8('0x32')]};if(!_['isNil'](_0x1d145c[_0x65f8('0x33')])){logger[_0x65f8('0xb')](_0x65f8('0x34'),_0x1d145c[_0x65f8('0x33')]);return analyticDefaultReportController[_0x65f8('0x35')]({'id':_0x1d145c[_0x65f8('0x33')]},_0x5dbbb1)[_0x65f8('0x36')](handleResult(_0x1d145c))['catch'](handleError());}if(!_['isNil'](_0x1d145c[_0x65f8('0x37')])){logger[_0x65f8('0xb')](_0x65f8('0x38'),_0x1d145c[_0x65f8('0x37')]);return analyticCustomReportController['runReport']({'id':_0x1d145c[_0x65f8('0x37')]},_0x5dbbb1)[_0x65f8('0x36')](handleResult(_0x1d145c))[_0x65f8('0x2a')](handleError());}}catch(_0x35ad17){logger[_0x65f8('0x27')](JSON[_0x65f8('0x21')](_0x35ad17));}return logger['info'](_0x65f8('0x39'));};}function getJobs(_0x2fd81a){var _0x4922ea={};if(_0x2fd81a){_0x4922ea['id']=_0x2fd81a;}return db[_0x65f8('0x3a')][_0x65f8('0x3b')]({'where':_0x4922ea,'include':[{'model':db[_0x65f8('0xe')],'attributes':['id',_0x65f8('0x32'),_0x65f8('0xd')],'include':[{'model':db[_0x65f8('0x3c')],'as':'Smtp','include':[{'model':db[_0x65f8('0x3d')],'as':'CloudProvider'}]}]}]})[_0x65f8('0x36')](function(_0xf6716c){var _0x4d1cdd=_[_0x65f8('0x3e')](manager[_0x65f8('0x3f')]);var _0x869443=_[_0x65f8('0x40')](_0xf6716c,function(_0x4221e5){return _0x4221e5['id'][_0x65f8('0x41')]();});var _0x3426e5=_[_0x65f8('0x42')](_0xf6716c,function(_0x35b180){return _0x35b180['id'][_0x65f8('0x41')]();});var _0xa3dfd5=_0x2fd81a?_0x869443:_['difference'](_0x869443,_0x4d1cdd);var _0x47c789=_['intersection'](_0x869443,_0x4d1cdd);var _0x4bdb69=_[_0x65f8('0x43')](_0x4d1cdd,_0x869443);var _0x87934f;var _0x47cdf6;for(_0x87934f=0x0;_0x87934f<_0x4bdb69[_0x65f8('0x44')]&&!_0x2fd81a;_0x87934f+=0x1){_0x47cdf6=_0x4bdb69[_0x87934f][_0x65f8('0x41')]();if(manager[_0x65f8('0x45')](_0x47cdf6)){manager[_0x65f8('0x46')](_0x47cdf6);manager[_0x65f8('0x47')](_0x47cdf6);logger[_0x65f8('0xb')](_0x65f8('0x48'),_0x47cdf6);}}logger[_0x65f8('0xb')]('toRun',JSON[_0x65f8('0x21')](_0xa3dfd5));for(_0x87934f=0x0;_0x87934f<_0xa3dfd5[_0x65f8('0x44')];_0x87934f+=0x1){_0x47cdf6=_0xa3dfd5[_0x87934f][_0x65f8('0x41')]();logger[_0x65f8('0xb')](_0x65f8('0x49'),_0x47cdf6);if(_0x2fd81a){logger[_0x65f8('0xb')](_0x65f8('0x4a'),_0x2fd81a);logger[_0x65f8('0xb')](JSON[_0x65f8('0x21')](_0x3426e5[_0x47cdf6]));BPromise[_0x65f8('0x4b')]()['then'](handleJob(_0x3426e5[_0x47cdf6]));logger['info'](_0x65f8('0x4c'),_0x3426e5[_0x47cdf6]['name'],_0x3426e5[_0x47cdf6][_0x65f8('0x4d')]);}else if(_0x3426e5[_0x47cdf6]['cron']&&_0x3426e5[_0x47cdf6][_0x65f8('0x4e')]&&moment()['isBetween'](_0x3426e5[_0x47cdf6][_0x65f8('0x4f')],_0x3426e5[_0x47cdf6][_0x65f8('0x50')])){manager[_0x65f8('0x51')](_0x47cdf6,_0x3426e5[_0x47cdf6][_0x65f8('0x4d')],handleJob(_0x3426e5[_0x47cdf6]));manager[_0x65f8('0x52')](_0x47cdf6);logger['info'](_0x65f8('0x53'),_0x3426e5[_0x47cdf6][_0x65f8('0x32')],_0x3426e5[_0x47cdf6][_0x65f8('0x4d')]);}else if(manager[_0x65f8('0x45')](_0x47cdf6)){manager[_0x65f8('0x46')](_0x47cdf6);manager['deleteJob'](_0x47cdf6);logger['info'](_0x65f8('0x54'),_0x3426e5[_0x47cdf6][_0x65f8('0x32')],_0x3426e5[_0x47cdf6]['cron']);}}for(_0x87934f=0x0,_0x47cdf6;_0x87934f<_0x47c789['length']&&!_0x2fd81a;_0x87934f+=0x1){_0x47cdf6=_0x47c789[_0x87934f][_0x65f8('0x41')]();if(manager[_0x65f8('0x45')](_0x47cdf6)){if(_0x3426e5[_0x47cdf6]['cron']&&_0x3426e5[_0x47cdf6][_0x65f8('0x4e')]&&moment()[_0x65f8('0x55')](_0x3426e5[_0x47cdf6][_0x65f8('0x4f')],_0x3426e5[_0x47cdf6]['endAt'])){manager[_0x65f8('0x56')](_0x47cdf6,_0x3426e5[_0x47cdf6][_0x65f8('0x4d')],handleJob(_0x3426e5[_0x47cdf6]));logger['info'](_0x65f8('0x57'),_0x3426e5[_0x47cdf6][_0x65f8('0x32')],_0x3426e5[_0x47cdf6][_0x65f8('0x4d')]);}else{manager[_0x65f8('0x46')](_0x47cdf6);manager[_0x65f8('0x47')](_0x47cdf6);logger['info'](_0x65f8('0x54'),_0x3426e5[_0x47cdf6][_0x65f8('0x32')],_0x3426e5[_0x47cdf6]['cron']);}}}})['catch'](function(_0x47b249){logger['error'](JSON['stringify'](_0x47b249));});}exports[_0x65f8('0x58')]=function(_0x223530){return getJobs(_0x223530);};exports[_0x65f8('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x67ca=['DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','toString','difference','length','exists','stop','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop\x20cron','endAt','update','update\x20cron','path','lodash','cron-job-manager','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','http','MailAccount','format','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','savename','%s.%s','extname','zip','join','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','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x67ca,0x107));var _0xa67c=function(_0x34e58a,_0x5a7965){_0x34e58a=_0x34e58a-0x0;var _0x262cd9=_0x67ca[_0x34e58a];return _0x262cd9;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xa67c('0x0'));var _=require(_0xa67c('0x1'));var moment=require('moment');var CronJobManager=require(_0xa67c('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xa67c('0x3'));var logger=require('../logger')(_0xa67c('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xa67c('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xa67c('0x6')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x35e529,_0x4bc453){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x35e529['email']);var _0x51dd77=!![];var _0x4e3964=_0x35e529[_0xa67c('0x7')]['getSmtpOptions']();var _0x25a103={'account':_0x4e3964,'message':{'from':util[_0xa67c('0x8')](_0xa67c('0x9'),_0x35e529[_0xa67c('0x7')][_0xa67c('0xa')],_0x35e529[_0xa67c('0x7')][_0xa67c('0xb')]||_0x35e529[_0xa67c('0x7')]['Smtp'][_0xa67c('0xc')]),'to':_0x35e529[_0xa67c('0xb')],'cc':_0x35e529['cc'],'bcc':_0x35e529[_0xa67c('0xd')],'subject':util[_0xa67c('0x8')](_0xa67c('0xe'),_0x4bc453[_0xa67c('0xa')],_0x35e529[_0xa67c('0xf')],_0x35e529['subtractUnit'])}};var _0x4f8040=path['join'](__dirname,_0xa67c('0x10'));var _0x52cedf=_0x4bc453[_0xa67c('0x11')];var _0x164d57=util['format'](_0xa67c('0x12'),path['basename'](_0x4bc453['savename'],path[_0xa67c('0x13')](_0x4bc453[_0xa67c('0x11')])),_0xa67c('0x14'));var _0x1dd05b=path[_0xa67c('0x15')](_0x4f8040,_0x52cedf);var _0x3945b6=path[_0xa67c('0x15')](_0x4f8040,_0x164d57);if(fs[_0xa67c('0x16')](_0x1dd05b)){_0x4bc453['status']=_0xa67c('0x17');_0x25a103[_0xa67c('0x18')][_0xa67c('0x19')]=[{'filename':_0x52cedf,'path':_0x1dd05b}];_0x25a103[_0xa67c('0x18')][_0xa67c('0x1a')]=util[_0xa67c('0x8')](_0xa67c('0x1b'),JSON[_0xa67c('0x1c')](_0x4bc453,null,0x2));}else if(fs['existsSync'](_0x3945b6)){_0x4bc453[_0xa67c('0x1d')]=_0xa67c('0x17');_0x25a103[_0xa67c('0x18')][_0xa67c('0x19')]=[{'filename':_0x164d57,'path':_0x3945b6}];}else{_0x25a103[_0xa67c('0x18')][_0xa67c('0x1a')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x35e529[_0xa67c('0x1e')]){_0x51dd77=![];logger[_0xa67c('0x1f')](_0xa67c('0x20'));}}if(_0x51dd77){return client[_0xa67c('0x21')](_0xa67c('0x22'),_0x25a103)[_0xa67c('0x23')](function(_0x3cc01e){if(_0x3cc01e['error']){return logger[_0xa67c('0x24')](_0xa67c('0x25'),JSON[_0xa67c('0x1c')](_0x3cc01e));}return logger[_0xa67c('0x1f')](_0xa67c('0x26'));})[_0xa67c('0x27')](function(_0x168b98){return logger[_0xa67c('0x24')](_0xa67c('0x25'),JSON[_0xa67c('0x1c')](_0x168b98));});}};}function handleError(){return function(_0xd24de7){return logger[_0xa67c('0x24')](JSON['stringify'](_0xd24de7));};}function handleResult(_0x3f3d34){return function(_0x54c3f9){logger[_0xa67c('0x1f')](_0xa67c('0x28'),JSON['stringify'](_0x54c3f9));if(_0x3f3d34['MailAccount']&&_0x3f3d34['MailAccount'][_0xa67c('0x29')]&&!_[_0xa67c('0x2a')](_0x3f3d34[_0xa67c('0xb')])){setTimeout(handleSendEmail(_0x3f3d34,_0x54c3f9),0x3c*0x3e8);}};}function handleJob(_0x5e11bf){return function(){try{if(_['isNil'](_0x5e11bf[_0xa67c('0xf')])){return logger[_0xa67c('0x1f')](_0xa67c('0x2b'));}if(_[_0xa67c('0x2a')](_0x5e11bf['subtractUnit'])){return logger[_0xa67c('0x1f')]('subtractUnit\x20null\x20or\x20undefined');}var _0x53b16c={'startDate':moment()[_0xa67c('0x2c')](_0x5e11bf['subtractNumber'],_0x5e11bf[_0xa67c('0x2d')])[_0xa67c('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa67c('0x8')](_0xa67c('0x2e')),'type':_0xa67c('0x2f'),'output':_0x5e11bf[_0xa67c('0x30')],'name':_0x5e11bf[_0xa67c('0xa')]};if(!_['isNil'](_0x5e11bf['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x5e11bf[_0xa67c('0x31')]);return analyticDefaultReportController[_0xa67c('0x32')]({'id':_0x5e11bf[_0xa67c('0x31')]},_0x53b16c)['then'](handleResult(_0x5e11bf))[_0xa67c('0x27')](handleError());}if(!_[_0xa67c('0x2a')](_0x5e11bf[_0xa67c('0x33')])){logger[_0xa67c('0x1f')](_0xa67c('0x34'),_0x5e11bf['CustomReportId']);return analyticCustomReportController[_0xa67c('0x32')]({'id':_0x5e11bf[_0xa67c('0x33')]},_0x53b16c)['then'](handleResult(_0x5e11bf))[_0xa67c('0x27')](handleError());}}catch(_0x3d32bd){logger[_0xa67c('0x24')](JSON[_0xa67c('0x1c')](_0x3d32bd));}return logger[_0xa67c('0x1f')](_0xa67c('0x35'));};}function getJobs(_0x1ec3a2){var _0x5be9f4={};if(_0x1ec3a2){_0x5be9f4['id']=_0x1ec3a2;}return db[_0xa67c('0x36')][_0xa67c('0x37')]({'where':_0x5be9f4,'include':[{'model':db[_0xa67c('0x7')],'attributes':['id',_0xa67c('0xa'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xa67c('0x29'),'include':[{'model':db[_0xa67c('0x38')],'as':_0xa67c('0x38')}]}]}]})[_0xa67c('0x23')](function(_0x459b8){var _0x5eb89c=_[_0xa67c('0x39')](manager[_0xa67c('0x3a')]);var _0x3a2641=_['map'](_0x459b8,function(_0x56a816){return _0x56a816['id'][_0xa67c('0x3b')]();});var _0x98f24f=_['keyBy'](_0x459b8,function(_0x460f61){return _0x460f61['id'][_0xa67c('0x3b')]();});var _0x59be47=_0x1ec3a2?_0x3a2641:_[_0xa67c('0x3c')](_0x3a2641,_0x5eb89c);var _0x244be5=_['intersection'](_0x3a2641,_0x5eb89c);var _0x3c6d33=_[_0xa67c('0x3c')](_0x5eb89c,_0x3a2641);var _0x4cadac;var _0x482f56;for(_0x4cadac=0x0;_0x4cadac<_0x3c6d33[_0xa67c('0x3d')]&&!_0x1ec3a2;_0x4cadac+=0x1){_0x482f56=_0x3c6d33[_0x4cadac][_0xa67c('0x3b')]();if(manager[_0xa67c('0x3e')](_0x482f56)){manager[_0xa67c('0x3f')](_0x482f56);manager[_0xa67c('0x40')](_0x482f56);logger['info']('delete\x20cron',_0x482f56);}}logger[_0xa67c('0x1f')](_0xa67c('0x41'),JSON[_0xa67c('0x1c')](_0x59be47));for(_0x4cadac=0x0;_0x4cadac<_0x59be47[_0xa67c('0x3d')];_0x4cadac+=0x1){_0x482f56=_0x59be47[_0x4cadac]['toString']();logger['info']('index',_0x482f56);if(_0x1ec3a2){logger['info']('my\x20id',_0x1ec3a2);logger[_0xa67c('0x1f')](JSON[_0xa67c('0x1c')](_0x98f24f[_0x482f56]));BPromise[_0xa67c('0x42')]()[_0xa67c('0x23')](handleJob(_0x98f24f[_0x482f56]));logger['info'](_0xa67c('0x43'),_0x98f24f[_0x482f56]['name'],_0x98f24f[_0x482f56][_0xa67c('0x44')]);}else if(_0x98f24f[_0x482f56][_0xa67c('0x44')]&&_0x98f24f[_0x482f56][_0xa67c('0x45')]&&moment()[_0xa67c('0x46')](_0x98f24f[_0x482f56][_0xa67c('0x47')],_0x98f24f[_0x482f56]['endAt'])){manager['add'](_0x482f56,_0x98f24f[_0x482f56][_0xa67c('0x44')],handleJob(_0x98f24f[_0x482f56]));manager[_0xa67c('0x48')](_0x482f56);logger[_0xa67c('0x1f')](_0xa67c('0x49'),_0x98f24f[_0x482f56]['name'],_0x98f24f[_0x482f56][_0xa67c('0x44')]);}else if(manager[_0xa67c('0x3e')](_0x482f56)){manager[_0xa67c('0x3f')](_0x482f56);manager['deleteJob'](_0x482f56);logger[_0xa67c('0x1f')](_0xa67c('0x4a'),_0x98f24f[_0x482f56][_0xa67c('0xa')],_0x98f24f[_0x482f56]['cron']);}}for(_0x4cadac=0x0,_0x482f56;_0x4cadac<_0x244be5['length']&&!_0x1ec3a2;_0x4cadac+=0x1){_0x482f56=_0x244be5[_0x4cadac]['toString']();if(manager['exists'](_0x482f56)){if(_0x98f24f[_0x482f56][_0xa67c('0x44')]&&_0x98f24f[_0x482f56][_0xa67c('0x45')]&&moment()[_0xa67c('0x46')](_0x98f24f[_0x482f56]['startAt'],_0x98f24f[_0x482f56][_0xa67c('0x4b')])){manager[_0xa67c('0x4c')](_0x482f56,_0x98f24f[_0x482f56][_0xa67c('0x44')],handleJob(_0x98f24f[_0x482f56]));logger['info'](_0xa67c('0x4d'),_0x98f24f[_0x482f56][_0xa67c('0xa')],_0x98f24f[_0x482f56][_0xa67c('0x44')]);}else{manager[_0xa67c('0x3f')](_0x482f56);manager[_0xa67c('0x40')](_0x482f56);logger[_0xa67c('0x1f')](_0xa67c('0x4a'),_0x98f24f[_0x482f56]['name'],_0x98f24f[_0x482f56]['cron']);}}}})[_0xa67c('0x27')](function(_0x435105){logger[_0xa67c('0x24')](JSON['stringify'](_0x435105));});}exports['run']=function(_0x19f22a){return getJobs(_0x19f22a);};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 e4a8cf4..4e6fa0f 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 _0x6c50=['resolve','sentiment','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Negative','Neutral','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','findOne','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','catch','name','inspect','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','info','format','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason'];(function(_0x44c836,_0x11d026){var _0x2a5409=function(_0x2b2afd){while(--_0x2b2afd){_0x44c836['push'](_0x44c836['shift']());}};_0x2a5409(++_0x11d026);}(_0x6c50,0xa4));var _0x06c5=function(_0x166dd5,_0x2684ee){_0x166dd5=_0x166dd5-0x0;var _0x3d4c16=_0x6c50[_0x166dd5];return _0x3d4c16;};var _=require(_0x06c5('0x0'));var AWS=require(_0x06c5('0x1'));var rp=require(_0x06c5('0x2'));var util=require(_0x06c5('0x3'));var BPromise=require('bluebird');var db=require(_0x06c5('0x4'))['db'];var logger=require('../../config/logger')(_0x06c5('0x5'));function getTranscriptionJob(_0x2853be,_0x434003,_0x443043,_0x3c050f){return new Promise(function(_0x463f4f,_0x3f5b56){var _0x427dd6=new AWS[(_0x06c5('0x6'))]({'accessKeyId':_0x434003,'secretAccessKey':_0x2853be,'region':_0x443043});_0x427dd6[_0x06c5('0x7')]({'TranscriptionJobName':_0x3c050f},function(_0x154b0a,_0x546ae5){if(_0x154b0a){return _0x3f5b56(_0x154b0a);}else{return _0x463f4f(_0x546ae5);}});});}function sentiment(_0xe263a,_0x222e05,_0x3010af,_0x18f1e9,_0x4e863c){return new Promise(function(_0x510444,_0x5ea57c){var _0x1dc67b=new AWS['Comprehend']({'accessKeyId':_0x222e05,'secretAccessKey':_0xe263a,'region':_0x3010af});_0x1dc67b['detectSentiment']({'Text':_0x18f1e9,'LanguageCode':_0x4e863c['substring'](0x0,0x2)},function(_0x236104,_0x5613a8){if(_0x236104){return _0x5ea57c(_0x236104);}else{return _0x510444(_0x5613a8);}});});}function checkTranscribeJob(_0x319710,_0x2d7502,_0x68194e){var _0x4ce581;return new BPromise(function(_0x6546e3,_0x3cb963){logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x319710['id'],_0x319710['transcribeName']));return getTranscriptionJob(_0x68194e[_0x06c5('0xa')],_0x68194e[_0x06c5('0xb')],_0x2d7502[_0x06c5('0xc')],_0x319710['transcribeName'])[_0x06c5('0xd')](function(_0x117371){logger['info'](util[_0x06c5('0x9')](_0x06c5('0xe'),_0x319710['id'],_0x319710[_0x06c5('0xf')],_0x117371[_0x06c5('0x10')][_0x06c5('0x11')]));if(!_0x319710[_0x06c5('0x12')]){switch(_0x117371[_0x06c5('0x10')][_0x06c5('0x11')]){case _0x06c5('0x13'):var _0x2b93ba={'transcribeStatus':_0x117371[_0x06c5('0x10')][_0x06c5('0x11')],'fileUri':_0x117371[_0x06c5('0x10')][_0x06c5('0x14')][_0x06c5('0x15')]};logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x319710['id']));return rp({'uri':_0x117371[_0x06c5('0x10')][_0x06c5('0x14')][_0x06c5('0x15')],'json':!![]})[_0x06c5('0xd')](function(_0xa3659b){logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x319710['id']));if(_0xa3659b&&_0xa3659b[_0x06c5('0x16')]&&_0xa3659b[_0x06c5('0x16')][_0x06c5('0x17')]&&_0xa3659b[_0x06c5('0x16')][_0x06c5('0x17')][_0x06c5('0x18')]){_0x2b93ba[_0x06c5('0x12')]='';for(var _0x51f2a6=0x0;_0x51f2a6<_0xa3659b[_0x06c5('0x16')]['transcripts']['length'];_0x51f2a6++){_0x2b93ba['fileText']+=_0xa3659b['results'][_0x06c5('0x17')][_0x51f2a6][_0x06c5('0x19')]+'';}}return _0x319710[_0x06c5('0x1a')](_0x2b93ba);})[_0x06c5('0xd')](function(){logger[_0x06c5('0x8')](util['format'](_0x06c5('0x1b'),_0x319710['id']));if(!_0x319710[_0x06c5('0x1c')]){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x1f'));}if(!_0x2d7502['sentiment']||!_0x2d7502[_0x06c5('0x20')]||!_0x2d7502[_0x06c5('0x21')]||!_0x2d7502[_0x06c5('0x22')]||!_0x2d7502['bucket']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x23'));}if(!_0x2b93ba['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2d7502['sentimentAccountId']===_0x68194e['id']){return _0x68194e;}else{return db[_0x06c5('0x24')]['findOne']({'where':{'id':_settings[_0x06c5('0x20')]}});}})['then'](function(_0xb849b5){if(!_0xb849b5){throw new db['Sequelize'][(_0x06c5('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xb849b5['data1']||!_0xb849b5[_0x06c5('0xb')]){throw new db['Sequelize']['ValidationError'](_0x06c5('0x25'));}_0x4ce581=_0xb849b5;logger[_0x06c5('0x8')](util[_0x06c5('0x9')](_0x06c5('0x26'),_0x319710['id']));return sentiment(_0x4ce581[_0x06c5('0xa')],_0x4ce581[_0x06c5('0xb')],_0x2d7502[_0x06c5('0x21')],_0x2b93ba['fileText'],_0x2d7502[_0x06c5('0x22')]);})['then'](function(_0x49d825){logger[_0x06c5('0x8')](util[_0x06c5('0x9')](_0x06c5('0x27'),_0x319710['id']));return _0x319710[_0x06c5('0x1a')]({'sentiment':_0x49d825[_0x06c5('0x28')],'sPositive':_0x49d825[_0x06c5('0x29')][_0x06c5('0x2a')],'sNegative':_0x49d825['SentimentScore']['Negative'],'sMixed':_0x49d825[_0x06c5('0x29')][_0x06c5('0x2b')],'sNeutral':_0x49d825['SentimentScore']['Neutral']});})[_0x06c5('0xd')](function(){logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x319710['id']));_0x6546e3();});case _0x06c5('0x2c'):return _0x319710[_0x06c5('0x1a')]({'transcribeStatus':_0x06c5('0x2c'),'failureReason':_0x117371['TranscriptionJob'][_0x06c5('0x2d')]})[_0x06c5('0xd')](function(){logger['info'](util['format'](_0x06c5('0x1b'),_0x319710['id']));_0x6546e3();});default:logger['info'](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x319710['id']));break;}}else{return BPromise[_0x06c5('0x2e')]()[_0x06c5('0xd')](function(){if(!_0x319710[_0x06c5('0x1c')]){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x1f'));}if(!_0x2d7502[_0x06c5('0x2f')]||!_0x2d7502['sentimentAccountId']||!_0x2d7502[_0x06c5('0x21')]||!_0x2d7502['language']||!_0x2d7502['bucket']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x23'));}if(!_0x319710[_0x06c5('0x12')]){throw new Error(_0x06c5('0x30'));}if(_0x2d7502[_0x06c5('0x20')]===_0x68194e['id']){return _0x68194e;}else{return db[_0x06c5('0x24')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2dd49b){if(!_0x2dd49b){throw new db['Sequelize'][(_0x06c5('0x1e'))](_0x06c5('0x31'));}if(!_0x2dd49b[_0x06c5('0xa')]||!_0x2dd49b['data2']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x25'));}_0x4ce581=_0x2dd49b;logger[_0x06c5('0x8')](util[_0x06c5('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x319710['id']));return sentiment(_0x4ce581[_0x06c5('0xa')],_0x4ce581[_0x06c5('0xb')],_0x2d7502[_0x06c5('0x21')],_0x319710['fileText'],_0x2d7502[_0x06c5('0x22')]);})[_0x06c5('0xd')](function(_0x560156){logger[_0x06c5('0x8')](util[_0x06c5('0x9')](_0x06c5('0x27'),_0x319710['id']));return _0x319710['update']({'sentiment':_0x560156[_0x06c5('0x28')],'sPositive':_0x560156[_0x06c5('0x29')][_0x06c5('0x2a')],'sNegative':_0x560156[_0x06c5('0x29')][_0x06c5('0x32')],'sMixed':_0x560156['SentimentScore'][_0x06c5('0x2b')],'sNeutral':_0x560156[_0x06c5('0x29')][_0x06c5('0x33')],'transcribeStatus':_0x06c5('0x13')});})[_0x06c5('0xd')](function(){logger[_0x06c5('0x8')](util['format'](_0x06c5('0x1b'),_0x319710['id']));_0x6546e3();});}})['catch'](function(_0x2a228f){if(_0x2a228f){if(!_0x2a228f['name']||_0x2a228f['name']!==_0x06c5('0x34')){logger[_0x06c5('0x35')](util['format'](_0x06c5('0x36'),_0x319710['id']),util['inspect'](_0x2a228f,{'showHidden':![],'depth':null}));}}_0x6546e3();});});}function checkTranscribe(){var _0x536b44;var _0x364a2e;var _0x26a491;return db[_0x06c5('0x37')][_0x06c5('0x38')]({'where':{'transcribeStatus':_0x06c5('0x39')}})[_0x06c5('0xd')](function(_0x3865a0){if(!_0x3865a0||!_0x3865a0[_0x06c5('0x18')]){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x3a'));}_0x536b44=_0x3865a0;return db['Setting'][_0x06c5('0x3b')]({'where':{'id':0x1}});})[_0x06c5('0xd')](function(_0x5c4dff){if(!_0x5c4dff){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x3c'));}_0x364a2e=_0x5c4dff;if(!_0x364a2e[_0x06c5('0x5')]||!_0x364a2e['transcribeAccountId']||!_0x364a2e[_0x06c5('0xc')]||!_0x364a2e['language']||!_0x364a2e[_0x06c5('0x3d')]){throw new db['Sequelize']['ValidationError'](_0x06c5('0x3e'));}return db[_0x06c5('0x24')][_0x06c5('0x3b')]({'where':{'id':_0x364a2e[_0x06c5('0x3f')]}});})[_0x06c5('0xd')](function(_0x5cfac8){if(!_0x5cfac8){throw new db[(_0x06c5('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5cfac8[_0x06c5('0xa')]||!_0x5cfac8['data2']){throw new db[(_0x06c5('0x1d'))][(_0x06c5('0x1e'))](_0x06c5('0x25'));}_0x26a491=_0x5cfac8;var _0x478d58=[];_0x536b44[_0x06c5('0x40')](function(_0x5af034){_0x478d58['push'](checkTranscribeJob(_0x5af034,_0x364a2e,_0x26a491));});return BPromise[_0x06c5('0x41')](_0x478d58);})[_0x06c5('0x42')](function(_0x45b493){if(_0x45b493){if(!_0x45b493[_0x06c5('0x43')]||_0x45b493[_0x06c5('0x43')]!==_0x06c5('0x34')){logger[_0x06c5('0x35')](util[_0x06c5('0x44')](_0x45b493,{'showHidden':![],'depth':null}));}}});}exports[_0x06c5('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xee4e=['length','Setting','transcribeAccountId','forEach','push','error','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','TranscriptionJobStatus','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','sentimentAccountId','Sequelize','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','data2','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Negative','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xee4e,0x122));var _0xeee4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xee4e[_0x19e35c];return _0x3e1fe8;};var _=require(_0xeee4('0x0'));var AWS=require(_0xeee4('0x1'));var rp=require(_0xeee4('0x2'));var util=require('util');var BPromise=require(_0xeee4('0x3'));var db=require(_0xeee4('0x4'))['db'];var logger=require(_0xeee4('0x5'))(_0xeee4('0x6'));function getTranscriptionJob(_0x2012a1,_0x30fe5a,_0x44de5b,_0x3ac537){return new Promise(function(_0x5564f7,_0xcf3bbd){var _0x148296=new AWS[(_0xeee4('0x7'))]({'accessKeyId':_0x30fe5a,'secretAccessKey':_0x2012a1,'region':_0x44de5b});_0x148296['getTranscriptionJob']({'TranscriptionJobName':_0x3ac537},function(_0x25f0ed,_0xe75ab8){if(_0x25f0ed){return _0xcf3bbd(_0x25f0ed);}else{return _0x5564f7(_0xe75ab8);}});});}function sentiment(_0x436d6c,_0x489233,_0x45ea79,_0x1456f0,_0x10d27f){return new Promise(function(_0x59f64e,_0x1af09f){var _0x50d6f8=new AWS[(_0xeee4('0x8'))]({'accessKeyId':_0x489233,'secretAccessKey':_0x436d6c,'region':_0x45ea79});_0x50d6f8[_0xeee4('0x9')]({'Text':_0x1456f0,'LanguageCode':_0x10d27f[_0xeee4('0xa')](0x0,0x2)},function(_0x51cf42,_0x203074){if(_0x51cf42){return _0x1af09f(_0x51cf42);}else{return _0x59f64e(_0x203074);}});});}function checkTranscribeJob(_0xab281b,_0x348c96,_0x138272){var _0x59921c;return new BPromise(function(_0x4db6a3,_0x3d2721){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0xd'),_0xab281b['id'],_0xab281b[_0xeee4('0xe')]));return getTranscriptionJob(_0x138272['data1'],_0x138272['data2'],_0x348c96[_0xeee4('0xf')],_0xab281b[_0xeee4('0xe')])[_0xeee4('0x10')](function(_0x1e0af2){logger[_0xeee4('0xb')](util[_0xeee4('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xab281b['id'],_0xab281b[_0xeee4('0xe')],_0x1e0af2['TranscriptionJob'][_0xeee4('0x11')]));if(!_0xab281b['fileText']){switch(_0x1e0af2[_0xeee4('0x12')][_0xeee4('0x11')]){case _0xeee4('0x13'):var _0x557433={'transcribeStatus':_0x1e0af2[_0xeee4('0x12')][_0xeee4('0x11')],'fileUri':_0x1e0af2[_0xeee4('0x12')]['Transcript'][_0xeee4('0x14')]};logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x15'),_0xab281b['id']));return rp({'uri':_0x1e0af2['TranscriptionJob'][_0xeee4('0x16')][_0xeee4('0x14')],'json':!![]})['then'](function(_0x3a3c63){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x17'),_0xab281b['id']));if(_0x3a3c63&&_0x3a3c63['results']&&_0x3a3c63[_0xeee4('0x18')][_0xeee4('0x19')]&&_0x3a3c63[_0xeee4('0x18')]['transcripts']['length']){_0x557433[_0xeee4('0x1a')]='';for(var _0x414644=0x0;_0x414644<_0x3a3c63['results'][_0xeee4('0x19')]['length'];_0x414644++){_0x557433[_0xeee4('0x1a')]+=_0x3a3c63[_0xeee4('0x18')][_0xeee4('0x19')][_0x414644][_0xeee4('0x1b')]+'';}}return _0xab281b[_0xeee4('0x1c')](_0x557433);})[_0xeee4('0x10')](function(){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x1d'),_0xab281b['id']));if(!_0xab281b[_0xeee4('0x1e')]){throw new db['Sequelize']['ValidationError'](_0xeee4('0x1f'));}if(!_0x348c96[_0xeee4('0x20')]||!_0x348c96['sentimentAccountId']||!_0x348c96['sentimentRegion']||!_0x348c96[_0xeee4('0x21')]||!_0x348c96[_0xeee4('0x22')]){throw new db['Sequelize'][(_0xeee4('0x23'))](_0xeee4('0x24'));}if(!_0x557433['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x348c96['sentimentAccountId']===_0x138272['id']){return _0x138272;}else{return db[_0xeee4('0x25')][_0xeee4('0x26')]({'where':{'id':_settings[_0xeee4('0x27')]}});}})[_0xeee4('0x10')](function(_0x4309cf){if(!_0x4309cf){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))](_0xeee4('0x29'));}if(!_0x4309cf['data1']||!_0x4309cf['data2']){throw new db['Sequelize'][(_0xeee4('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x59921c=_0x4309cf;logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x2a'),_0xab281b['id']));return sentiment(_0x59921c[_0xeee4('0x2b')],_0x59921c[_0xeee4('0x2c')],_0x348c96[_0xeee4('0x2d')],_0x557433[_0xeee4('0x1a')],_0x348c96['language']);})[_0xeee4('0x10')](function(_0x47849e){logger['info'](util['format'](_0xeee4('0x2e'),_0xab281b['id']));return _0xab281b['update']({'sentiment':_0x47849e[_0xeee4('0x2f')],'sPositive':_0x47849e[_0xeee4('0x30')][_0xeee4('0x31')],'sNegative':_0x47849e[_0xeee4('0x30')]['Negative'],'sMixed':_0x47849e['SentimentScore'][_0xeee4('0x32')],'sNeutral':_0x47849e['SentimentScore'][_0xeee4('0x33')]});})[_0xeee4('0x10')](function(){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x1d'),_0xab281b['id']));_0x4db6a3();});case _0xeee4('0x34'):return _0xab281b['update']({'transcribeStatus':_0xeee4('0x34'),'failureReason':_0x1e0af2[_0xeee4('0x12')][_0xeee4('0x35')]})[_0xeee4('0x10')](function(){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x1d'),_0xab281b['id']));_0x4db6a3();});default:logger['info'](util[_0xeee4('0xc')](_0xeee4('0x36'),_0xab281b['id']));break;}}else{return BPromise[_0xeee4('0x37')]()[_0xeee4('0x10')](function(){if(!_0xab281b[_0xeee4('0x1e')]){throw new db[(_0xeee4('0x28'))]['ValidationError'](_0xeee4('0x1f'));}if(!_0x348c96['sentiment']||!_0x348c96['sentimentAccountId']||!_0x348c96['sentimentRegion']||!_0x348c96[_0xeee4('0x21')]||!_0x348c96[_0xeee4('0x22')]){throw new db['Sequelize'][(_0xeee4('0x23'))](_0xeee4('0x24'));}if(!_0xab281b[_0xeee4('0x1a')]){throw new Error(_0xeee4('0x38'));}if(_0x348c96[_0xeee4('0x27')]===_0x138272['id']){return _0x138272;}else{return db[_0xeee4('0x25')][_0xeee4('0x26')]({'where':{'id':_settings[_0xeee4('0x27')]}});}})[_0xeee4('0x10')](function(_0x1479ee){if(!_0x1479ee){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))](_0xeee4('0x29'));}if(!_0x1479ee[_0xeee4('0x2b')]||!_0x1479ee[_0xeee4('0x2c')]){throw new db['Sequelize']['ValidationError'](_0xeee4('0x39'));}_0x59921c=_0x1479ee;logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x2a'),_0xab281b['id']));return sentiment(_0x59921c['data1'],_0x59921c['data2'],_0x348c96[_0xeee4('0x2d')],_0xab281b[_0xeee4('0x1a')],_0x348c96[_0xeee4('0x21')]);})['then'](function(_0x5684ef){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x2e'),_0xab281b['id']));return _0xab281b[_0xeee4('0x1c')]({'sentiment':_0x5684ef[_0xeee4('0x2f')],'sPositive':_0x5684ef[_0xeee4('0x30')][_0xeee4('0x31')],'sNegative':_0x5684ef[_0xeee4('0x30')][_0xeee4('0x3a')],'sMixed':_0x5684ef[_0xeee4('0x30')][_0xeee4('0x32')],'sNeutral':_0x5684ef[_0xeee4('0x30')][_0xeee4('0x33')],'transcribeStatus':_0xeee4('0x13')});})[_0xeee4('0x10')](function(){logger[_0xeee4('0xb')](util[_0xeee4('0xc')](_0xeee4('0x1d'),_0xab281b['id']));_0x4db6a3();});}})[_0xeee4('0x3b')](function(_0x46e493){if(_0x46e493){if(!_0x46e493['name']||_0x46e493[_0xeee4('0x3c')]!=='SequelizeValidationError'){logger['error'](util['format'](_0xeee4('0x3d'),_0xab281b['id']),util[_0xeee4('0x3e')](_0x46e493,{'showHidden':![],'depth':null}));}}_0x4db6a3();});});}function checkTranscribe(){var _0x54fcda;var _0x40ef92;var _0x55587b;return db[_0xeee4('0x3f')]['findAll']({'where':{'transcribeStatus':_0xeee4('0x40')}})[_0xeee4('0x10')](function(_0x111bbb){if(!_0x111bbb||!_0x111bbb[_0xeee4('0x41')]){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x54fcda=_0x111bbb;return db[_0xeee4('0x42')][_0xeee4('0x26')]({'where':{'id':0x1}});})[_0xeee4('0x10')](function(_0x18985e){if(!_0x18985e){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))]('Settings\x20not\x20available');}_0x40ef92=_0x18985e;if(!_0x40ef92[_0xeee4('0x6')]||!_0x40ef92[_0xeee4('0x43')]||!_0x40ef92['transcribeRegion']||!_0x40ef92[_0xeee4('0x21')]||!_0x40ef92[_0xeee4('0x22')]){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))]('Transcribe\x20not\x20configured');}return db[_0xeee4('0x25')][_0xeee4('0x26')]({'where':{'id':_0x40ef92[_0xeee4('0x43')]}});})['then'](function(_0x28eef2){if(!_0x28eef2){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x28eef2[_0xeee4('0x2b')]||!_0x28eef2[_0xeee4('0x2c')]){throw new db[(_0xeee4('0x28'))][(_0xeee4('0x23'))](_0xeee4('0x39'));}_0x55587b=_0x28eef2;var _0x34a03c=[];_0x54fcda[_0xeee4('0x44')](function(_0x5b3a13){_0x34a03c[_0xeee4('0x45')](checkTranscribeJob(_0x5b3a13,_0x40ef92,_0x55587b));});return BPromise['all'](_0x34a03c);})[_0xeee4('0x3b')](function(_0xd08d9c){if(_0xd08d9c){if(!_0xd08d9c['name']||_0xd08d9c[_0xeee4('0x3c')]!=='SequelizeValidationError'){logger[_0xeee4('0x46')](util[_0xeee4('0x3e')](_0xd08d9c,{'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 52dec53..ed8c0e7 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 _0x8163=['socket.io-emitter','WhatsappInteraction','findAll','subtract','then','length','info','join','update','system','YYYY-MM-DD\x20HH:mm:ss','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis'];(function(_0x506542,_0x5e4989){var _0x6166b0=function(_0x2033d7){while(--_0x2033d7){_0x506542['push'](_0x506542['shift']());}};_0x6166b0(++_0x5e4989);}(_0x8163,0x1d8));var _0x3816=function(_0x2561d1,_0x20c77b){_0x2561d1=_0x2561d1-0x0;var _0x22d2a7=_0x8163[_0x2561d1];return _0x22d2a7;};'use strict';var _=require(_0x3816('0x0'));var moment=require(_0x3816('0x1'));var Redis=require(_0x3816('0x2'));var util=require(_0x3816('0x3'));var config=require(_0x3816('0x4'));var db=require(_0x3816('0x5'))['db'];var logger=require('../logger')(_0x3816('0x6'));config[_0x3816('0x7')]=_['defaults'](config[_0x3816('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3816('0x8'))(new Redis(config[_0x3816('0x7')]));function closeInteractions(){var _0x254858=[];return db[_0x3816('0x9')][_0x3816('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3816('0xb')](0x18,'hours')}}})[_0x3816('0xc')](function(_0x349f4f){if(_0x349f4f&&_0x349f4f[_0x3816('0xd')]){_0x254858=_['map'](_0x349f4f||[],'id');logger[_0x3816('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x254858[_0x3816('0xf')]());return db[_0x3816('0x9')][_0x3816('0x10')]({'closeReason':_0x3816('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x3816('0x12'))},{'where':{'id':_0x254858}});}})['then'](function(){if(_0x254858&&_0x254858[_0x3816('0xd')]){logger[_0x3816('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x254858[_0x3816('0xf')]());for(var _0x37646d=0x0;_0x37646d<_0x254858[_0x3816('0xd')];_0x37646d++){io[_0x3816('0x13')]('whatsappInteraction:update',{'id':_0x254858[_0x37646d],'closed':!![]});}}})[_0x3816('0x14')](function(_0x232b5b){logger[_0x3816('0x15')](_0x3816('0x16'),_0x232b5b?util[_0x3816('0x17')](_0x232b5b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfa69=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','moment','util','../../config/environment','schedule','defaults','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update'];(function(_0x2681e5,_0x4561de){var _0x28171a=function(_0x4285c4){while(--_0x4285c4){_0x2681e5['push'](_0x2681e5['shift']());}};_0x28171a(++_0x4561de);}(_0xfa69,0xb1));var _0x9fa6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa69[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var moment=require(_0x9fa6('0x0'));var Redis=require('ioredis');var util=require(_0x9fa6('0x1'));var config=require(_0x9fa6('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x9fa6('0x3'));config['redis']=_[_0x9fa6('0x4')](config[_0x9fa6('0x5')],{'host':_0x9fa6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9fa6('0x5')]));function closeInteractions(){var _0x53e364=[];return db[_0x9fa6('0x7')][_0x9fa6('0x8')]({'raw':!![],'attributes':['id',_0x9fa6('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9fa6('0xa')](0x18,_0x9fa6('0xb'))}}})['then'](function(_0x2765a4){if(_0x2765a4&&_0x2765a4[_0x9fa6('0xc')]){_0x53e364=_[_0x9fa6('0xd')](_0x2765a4||[],'id');logger['info'](_0x9fa6('0xe'),_0x53e364[_0x9fa6('0xf')]());return db['WhatsappInteraction']['update']({'closeReason':_0x9fa6('0x10'),'disposition':_0x9fa6('0x11'),'closed':!![],'closedAt':moment()[_0x9fa6('0x12')](_0x9fa6('0x13'))},{'where':{'id':_0x53e364}});}})['then'](function(){if(_0x53e364&&_0x53e364[_0x9fa6('0xc')]){logger[_0x9fa6('0x14')](_0x9fa6('0x15'),_0x53e364['join']());for(var _0x3daa8f=0x0;_0x3daa8f<_0x53e364['length'];_0x3daa8f++){io['emit'](_0x9fa6('0x16'),{'id':_0x53e364[_0x3daa8f],'closed':!![]});}}})['catch'](function(_0x41de93){logger[_0x9fa6('0x17')](_0x9fa6('0x18'),_0x41de93?util['inspect'](_0x41de93,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6f399bf..e7b4c12 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fb9=['CmContact','destroy','bulkCreate','finished\x20populating','contacts1','CmHopper','then','log','hopper1','contacts2','hopper2','push','innocenzo.biondo','@xcally.com','now','Innocenzo'];(function(_0x1ecf43,_0xf1f8a4){var _0x9b188c=function(_0x2ab1ea){while(--_0x2ab1ea){_0x1ecf43['push'](_0x1ecf43['shift']());}};_0x9b188c(++_0xf1f8a4);}(_0x9fb9,0x19b));var _0x99fb=function(_0x58db7f,_0x2bbb42){_0x58db7f=_0x58db7f-0x0;var _0x1763b2=_0x9fb9[_0x58db7f];return _0x1763b2;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x99fb('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x99fb('0x1')+i+_0x99fb('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x99fb('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x99fb('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x99fb('0x3')](),'updatedAt':Date[_0x99fb('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x99fb('0x0')]({'id':i,'firstName':_0x99fb('0x4')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x99fb('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x99fb('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x99fb('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x99fb('0x3')](),'updatedAt':Date[_0x99fb('0x3')]()});}db[_0x99fb('0x5')][_0x99fb('0x6')]({'where':{}})['then'](function(){return db[_0x99fb('0x5')][_0x99fb('0x7')](contacts);})['then'](function(){console['log'](_0x99fb('0x8'),_0x99fb('0x9'));return db['CmHopper'][_0x99fb('0x6')]({'where':{}});})['then'](function(){return db[_0x99fb('0xa')][_0x99fb('0x7')](hopper);})[_0x99fb('0xb')](function(){console[_0x99fb('0xc')](_0x99fb('0x8'),_0x99fb('0xd'));return db['CmContact'][_0x99fb('0x7')](contacts2);})['then'](function(){console[_0x99fb('0xc')]('finished\x20populating',_0x99fb('0xe'));return db[_0x99fb('0xa')]['bulkCreate'](hopper2);})[_0x99fb('0xb')](function(){console[_0x99fb('0xc')](_0x99fb('0x8'),_0x99fb('0xf'));})['catch'](function(_0xbc9829){console[_0x99fb('0xc')](_0xbc9829);}); \ No newline at end of file +var _0x6381=['then','log','finished\x20populating','hopper1','contacts2','hopper2','catch','util','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','contacts1','CmHopper','bulkCreate'];(function(_0x4317b7,_0x1cdd20){var _0xd654cf=function(_0x588687){while(--_0x588687){_0x4317b7['push'](_0x4317b7['shift']());}};_0xd654cf(++_0x1cdd20);}(_0x6381,0x111));var _0x1638=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6381[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x1638('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1638('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x1638('0x2')+i,'phone':0xf879fb460+i,'email':_0x1638('0x3')+i+_0x1638('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1638('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1638('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1638('0x1')]({'id':i,'firstName':_0x1638('0x6')+i,'lastName':_0x1638('0x2')+i,'phone':0xf879fb460+i,'email':_0x1638('0x3')+i+_0x1638('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1638('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x1638('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1638('0x5')]()});}db[_0x1638('0x7')][_0x1638('0x8')]({'where':{}})['then'](function(){return db[_0x1638('0x7')]['bulkCreate'](contacts);})['then'](function(){console['log']('finished\x20populating',_0x1638('0x9'));return db[_0x1638('0xa')][_0x1638('0x8')]({'where':{}});})['then'](function(){return db[_0x1638('0xa')][_0x1638('0xb')](hopper);})[_0x1638('0xc')](function(){console[_0x1638('0xd')](_0x1638('0xe'),_0x1638('0xf'));return db[_0x1638('0x7')]['bulkCreate'](contacts2);})['then'](function(){console[_0x1638('0xd')](_0x1638('0xe'),_0x1638('0x10'));return db[_0x1638('0xa')][_0x1638('0xb')](hopper2);})[_0x1638('0xc')](function(){console['log'](_0x1638('0xe'),_0x1638('0x11'));})[_0x1638('0x12')](function(_0x438d40){console[_0x1638('0xd')](_0x438d40);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b73af39..9d935ac 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb12e=['password','friend','udp','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x35d57c,_0x2e5292){var _0x6d9b60=function(_0x14b19e){while(--_0x14b19e){_0x35d57c['push'](_0x35d57c['shift']());}};_0x6d9b60(++_0x2e5292);}(_0xb12e,0x1c7));var _0xeb12=function(_0x494ae5,_0xf82968){_0x494ae5=_0x494ae5-0x0;var _0x408ef8=_0xb12e[_0x494ae5];return _0x408ef8;};'use strict';var util=require(_0xeb12('0x0'));var db=require(_0xeb12('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xeb12('0x2')]({'name':util[_0xeb12('0x3')](_0xeb12('0x4'),_0xeb12('0x5'),i),'fullname':util['format'](_0xeb12('0x4'),'agent',i),'email':util[_0xeb12('0x3')](_0xeb12('0x6'),_0xeb12('0x5'),i),'role':'agent','password':_0xeb12('0x7'),'internal':0xfa0+i,'type':_0xeb12('0x8'),'transport':[_0xeb12('0x9'),'ws','wss'],'disallow':[_0xeb12('0xa')],'allow':[_0xeb12('0xb')],'defaultuser':util['format'](_0xeb12('0x4'),_0xeb12('0x5'),i),'encryption':_0xeb12('0xc'),'avpf':_0xeb12('0xc'),'force_avp':_0xeb12('0xc'),'icesupport':_0xeb12('0xc'),'dtlsenable':_0xeb12('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xeb12('0xd'),'dtlssetup':_0xeb12('0xe'),'callerid':util['format'](_0xeb12('0xf'),util[_0xeb12('0x3')](_0xeb12('0x4'),'agent',i),0xfa0+i)});}db[_0xeb12('0x10')][_0xeb12('0x11')](users)[_0xeb12('0x12')](function(){console[_0xeb12('0x13')](_0xeb12('0x14'));})[_0xeb12('0x15')](function(_0x10417a){console['log'](_0x10417a);}); \ No newline at end of file +var _0xf1b2=['ulaw','format','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x50054d,_0x38ecaf){var _0x34bceb=function(_0x285574){while(--_0x285574){_0x50054d['push'](_0x50054d['shift']());}};_0x34bceb(++_0x38ecaf);}(_0xf1b2,0xc8));var _0x2f1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1b2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2f1b('0x0'));var db=require(_0x2f1b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x2f1b('0x2'),'agent',i),'fullname':util['format']('%s%s',_0x2f1b('0x3'),i),'email':util['format'](_0x2f1b('0x4'),_0x2f1b('0x3'),i),'role':_0x2f1b('0x3'),'password':_0x2f1b('0x5'),'internal':0xfa0+i,'type':_0x2f1b('0x6'),'transport':[_0x2f1b('0x7'),'ws',_0x2f1b('0x8')],'disallow':[_0x2f1b('0x9')],'allow':[_0x2f1b('0xa')],'defaultuser':util[_0x2f1b('0xb')](_0x2f1b('0x2'),_0x2f1b('0x3'),i),'encryption':_0x2f1b('0xc'),'avpf':_0x2f1b('0xc'),'force_avp':_0x2f1b('0xc'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x2f1b('0xd'),'dtlssetup':_0x2f1b('0xe'),'callerid':util['format'](_0x2f1b('0xf'),util[_0x2f1b('0xb')](_0x2f1b('0x2'),_0x2f1b('0x3'),i),0xfa0+i)});}db[_0x2f1b('0x10')]['bulkCreate'](users)[_0x2f1b('0x11')](function(){console[_0x2f1b('0x12')](_0x2f1b('0x13'));})[_0x2f1b('0x14')](function(_0x4057c2){console[_0x2f1b('0x12')](_0x4057c2);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c576abc..979cccd 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39e6=['MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueue','SmsQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','all','voice','chat','fax','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','User','Campaign','where','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e6,0x9e));var _0x639e=function(_0x4bf873,_0x22b126){_0x4bf873=_0x4bf873-0x0;var _0x1f204e=_0x39e6[_0x4bf873];return _0x1f204e;};'use strict';var _=require(_0x639e('0x0'));var util=require('util');var BPromise=require(_0x639e('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x639e('0x2')],'include':[{'as':_0x639e('0x3'),'model':db['User'],'attributes':['id',_0x639e('0x2'),_0x639e('0x4')],'raw':!![],'where':{'role':_0x639e('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x639e('0x2')],'where':{'role':_0x639e('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x639e('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x639e('0x2')],'where':{'role':_0x639e('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x639e('0x2'),_0x639e('0x7')],'where':{'type':_0x639e('0x8')}};function getAssociatedResources(_0x2fab76,_0x2a6749,_0x4410d4){return db[_0x639e('0x9')][_0x639e('0xa')]({'where':{'name':_0x2fab76,'userProfileId':_0x2a6749},'raw':!![]})[_0x639e('0xb')](function(_0x3834a6){if(_0x3834a6){if(_0x3834a6['autoAssociation']){switch(_0x2fab76){case'VoiceQueues':case _0x639e('0xc'):case _0x639e('0xd'):case _0x639e('0xe'):case _0x639e('0xf'):case _0x639e('0x10'):case _0x639e('0x11'):return db[_0x4410d4][_0x639e('0x12')](queryQueues);case'Telephones':return db[_0x4410d4]['findAll'](queryTelephones);case _0x639e('0x13'):return db[_0x4410d4][_0x639e('0x12')](queryTrunks);case _0x639e('0x14'):return db[_0x4410d4][_0x639e('0x12')](queryCampaigns);}}else{return db[_0x639e('0x15')][_0x639e('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x3834a6['id']},'raw':!![]})[_0x639e('0xb')](function(_0x20bfbb){if(_0x20bfbb){var _0x23f0f9={'where':{'id':_[_0x639e('0x16')](_0x20bfbb,'resourceId')},'raw':!![]};switch(_0x4410d4){case _0x639e('0x17'):_0x23f0f9['where'][_0x639e('0x4')]=_0x639e('0x6');break;case _0x639e('0x18'):_0x23f0f9[_0x639e('0x19')][_0x639e('0x7')]=_0x639e('0x8');break;}return db[_0x4410d4]['findAll'](_0x23f0f9);}else{return[];}});}}else{return[];}})[_0x639e('0xb')](function(_0x34baca){return _0x34baca;});}function joinOrLeaveQueues(_0x36f71d,_0x1da55e,_0x59f772,_0x28e05e){_0x36f71d[_0x1da55e](util[_0x639e('0x1a')](_0x639e('0x1b'),_0x59f772,_0x28e05e[_0x639e('0x2')]));if(_0x28e05e[_0x639e('0x3')]){for(var _0x50de77=0x0;_0x50de77<_0x28e05e[_0x639e('0x3')][_0x639e('0x1c')];_0x50de77+=0x1){_0x36f71d[_0x1da55e](util['format'](_0x639e('0x1d'),_0x28e05e['Agents'][_0x50de77]['name']));}}}function joinOrLeave(_0x224d52,_0x3813f6,_0x3ab673){var _0x24e1ad;if(_0x224d52[_0x639e('0x1e')]['query']['id']){db[_0x639e('0x17')][_0x639e('0x1f')]({'attributes':['id',_0x639e('0x2'),_0x639e('0x4'),_0x639e('0x20')],'where':{'id':_0x224d52['handshake'][_0x639e('0x21')]['id']},'include':[{'model':db[_0x639e('0x22')],'as':_0x639e('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x639e('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x639e('0x25')],'as':_0x639e('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x639e('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x639e('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x639e('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x2c8e3a){if(_0x2c8e3a){_0x24e1ad=_0x2c8e3a;_0x224d52[_0x3813f6](util[_0x639e('0x1a')](_0x639e('0x1d'),_0x2c8e3a[_0x639e('0x2')]));var _0x412176=[];switch(_0x2c8e3a[_0x639e('0x4')]){case'admin':_0x224d52[_0x3813f6](_0x639e('0x2a'));_0x224d52[_0x3813f6](_0x639e('0x2b'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x639e('0x2c')];}_0x412176[_0x639e('0x2d')](db[_0x639e('0x2e')]['findAll'](queryQueues));_0x412176[_0x639e('0x2d')](db['ChatQueue'][_0x639e('0x12')](queryQueues));_0x412176[_0x639e('0x2d')](db[_0x639e('0x2f')]['findAll'](queryQueues));_0x412176[_0x639e('0x2d')](db['SmsQueue'][_0x639e('0x12')](queryQueues));_0x412176[_0x639e('0x2d')](db[_0x639e('0x30')]['findAll'](queryQueues));_0x412176[_0x639e('0x2d')](db[_0x639e('0x31')][_0x639e('0x12')](queryQueues));_0x412176['push'](db[_0x639e('0x32')]['findAll'](queryQueues));_0x412176[_0x639e('0x2d')](db[_0x639e('0x17')][_0x639e('0x12')](queryTelephones));_0x412176[_0x639e('0x2d')](db[_0x639e('0x33')]['findAll'](queryTrunks));_0x412176[_0x639e('0x2d')](db[_0x639e('0x18')][_0x639e('0x12')](queryCampaigns));_0x412176[_0x639e('0x2d')](db['User'][_0x639e('0x12')](queryAgents));break;case _0x639e('0x34'):_0x224d52[_0x3813f6](_0x639e('0x2a'));_0x224d52[_0x3813f6]('voice:outbound');_0x412176[_0x639e('0x2d')](getAssociatedResources('VoiceQueues',_0x2c8e3a[_0x639e('0x20')],_0x639e('0x2e')));_0x412176[_0x639e('0x2d')](getAssociatedResources(_0x639e('0xc'),_0x2c8e3a[_0x639e('0x20')],_0x639e('0x35')));_0x412176['push'](getAssociatedResources(_0x639e('0xd'),_0x2c8e3a[_0x639e('0x20')],'FaxQueue'));_0x412176[_0x639e('0x2d')](getAssociatedResources('SmsQueues',_0x2c8e3a[_0x639e('0x20')],_0x639e('0x36')));_0x412176[_0x639e('0x2d')](getAssociatedResources(_0x639e('0xf'),_0x2c8e3a[_0x639e('0x20')],_0x639e('0x30')));_0x412176[_0x639e('0x2d')](getAssociatedResources(_0x639e('0x10'),_0x2c8e3a['userProfileId'],'OpenchannelQueue'));_0x412176['push'](getAssociatedResources('WhatsappQueues',_0x2c8e3a[_0x639e('0x20')],_0x639e('0x32')));_0x412176['push'](getAssociatedResources(_0x639e('0x37'),_0x2c8e3a[_0x639e('0x20')],_0x639e('0x17')));_0x412176['push'](getAssociatedResources(_0x639e('0x13'),_0x2c8e3a[_0x639e('0x20')],_0x639e('0x33')));_0x412176[_0x639e('0x2d')](getAssociatedResources(_0x639e('0x14'),_0x2c8e3a[_0x639e('0x20')],_0x639e('0x18')));_0x412176[_0x639e('0x2d')](db[_0x639e('0x17')]['findAll'](queryAgents));break;case _0x639e('0x5'):_0x224d52[_0x3813f6](_0x639e('0x2a'));_0x224d52[_0x3813f6](_0x639e('0x2b'));_0x412176[_0x639e('0x2d')](_0x2c8e3a[_0x639e('0x38')]({'attributes':['id',_0x639e('0x2')]}));_0x412176['push'](_0x2c8e3a[_0x639e('0x39')]({'attributes':['id',_0x639e('0x2')]}));_0x412176[_0x639e('0x2d')](_0x2c8e3a[_0x639e('0x3a')]({'attributes':['id',_0x639e('0x2')]}));_0x412176[_0x639e('0x2d')](_0x2c8e3a[_0x639e('0x3b')]({'attributes':['id',_0x639e('0x2')]}));_0x412176[_0x639e('0x2d')](_0x2c8e3a[_0x639e('0x3c')]({'attributes':['id',_0x639e('0x2')]}));_0x412176[_0x639e('0x2d')](_0x2c8e3a['getOpenchannelQueues']({'attributes':['id',_0x639e('0x2')]}));_0x412176['push'](_0x2c8e3a['getWhatsappQueues']({'attributes':['id',_0x639e('0x2')]}));break;}return BPromise[_0x639e('0x3d')](_0x412176);}})[_0x639e('0xb')](function(_0x47620d){if(_0x47620d&&_0x47620d[_0x639e('0x1c')]){for(var _0x5b27b6=0x0;_0x5b27b6<_0x47620d[_0x639e('0x1c')];_0x5b27b6+=0x1){for(var _0x1fa830=0x0;_0x1fa830<_0x47620d[_0x5b27b6]['length'];_0x1fa830+=0x1){switch(_0x5b27b6){case 0x0:joinOrLeaveQueues(_0x224d52,_0x3813f6,_0x639e('0x3e'),_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x1:joinOrLeaveQueues(_0x224d52,_0x3813f6,_0x639e('0x3f'),_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x2:joinOrLeaveQueues(_0x224d52,_0x3813f6,_0x639e('0x40'),_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x3:joinOrLeaveQueues(_0x224d52,_0x3813f6,'sms',_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x4:joinOrLeaveQueues(_0x224d52,_0x3813f6,_0x639e('0x41'),_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x5:joinOrLeaveQueues(_0x224d52,_0x3813f6,_0x639e('0x42'),_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x6:joinOrLeaveQueues(_0x224d52,_0x3813f6,_0x639e('0x43'),_0x47620d[_0x5b27b6][_0x1fa830]);break;case 0x7:if(_0x24e1ad[_0x639e('0x4')]!=='agent')_0x224d52[_0x3813f6](util[_0x639e('0x1a')]('telephone:%s',_0x47620d[_0x5b27b6][_0x1fa830][_0x639e('0x2')]));break;case 0x8:if(_0x24e1ad['role']!==_0x639e('0x5'))_0x224d52[_0x3813f6](util[_0x639e('0x1a')](_0x639e('0x44'),_0x47620d[_0x5b27b6][_0x1fa830][_0x639e('0x2')]));break;case 0x9:if(_0x24e1ad[_0x639e('0x4')]!=='agent')_0x224d52[_0x3813f6](util[_0x639e('0x1a')](_0x639e('0x45'),_0x47620d[_0x5b27b6][_0x1fa830][_0x639e('0x7')],_0x47620d[_0x5b27b6][_0x1fa830]['name']));break;case 0xa:_0x224d52[_0x3813f6](util[_0x639e('0x1a')](_0x639e('0x1d'),_0x47620d[_0x5b27b6][_0x1fa830][_0x639e('0x2')]));break;}}}}})[_0x639e('0xb')](function(){if(_0x3813f6==='leave'){var _0xb7afb8=_['map'](_0x24e1ad[_0x639e('0x23')],'id');return _0x24e1ad[_0x639e('0x46')](_0xb7afb8)[_0x639e('0xb')](function(){for(var _0x555629=0x0;_0x555629<_0xb7afb8['length'];_0x555629+=0x1){_0x3ab673[_0x639e('0x47')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0xb7afb8[_0x555629]),'UserId':Number(_0x24e1ad['id'])});}});}})['then'](function(){if(_0x3813f6===_0x639e('0x48')){var _0x1e9278=_[_0x639e('0x16')](_0x24e1ad[_0x639e('0x49')],'id');return _0x24e1ad['removeMailInteractions'](_0x1e9278)[_0x639e('0xb')](function(){for(var _0x9f3c5c=0x0;_0x9f3c5c<_0x1e9278[_0x639e('0x1c')];_0x9f3c5c+=0x1){_0x3ab673['emit'](_0x639e('0x4a'),{'MailInteractionId':Number(_0x1e9278[_0x9f3c5c]),'UserId':Number(_0x24e1ad['id'])});}});}})[_0x639e('0xb')](function(){if(_0x3813f6===_0x639e('0x48')){var _0x3c22a8=_[_0x639e('0x16')](_0x24e1ad[_0x639e('0x26')],'id');return _0x24e1ad[_0x639e('0x4b')](_0x3c22a8)['then'](function(){for(var _0x349cc6=0x0;_0x349cc6<_0x3c22a8[_0x639e('0x1c')];_0x349cc6+=0x1){_0x3ab673[_0x639e('0x47')](_0x639e('0x4c'),{'FaxInteractionId':Number(_0x3c22a8[_0x349cc6]),'UserId':Number(_0x24e1ad['id'])});}});}})['then'](function(){if(_0x3813f6===_0x639e('0x48')){var _0x29ee94=_[_0x639e('0x16')](_0x24e1ad['SmsInteractions'],'id');return _0x24e1ad['removeSmsInteractions'](_0x29ee94)['then'](function(){for(var _0x151cbe=0x0;_0x151cbe<_0x29ee94[_0x639e('0x1c')];_0x151cbe+=0x1){_0x3ab673['emit'](_0x639e('0x4d'),{'SmsInteractionId':Number(_0x29ee94[_0x151cbe]),'UserId':Number(_0x24e1ad['id'])});}});}})[_0x639e('0xb')](function(){if(_0x3813f6===_0x639e('0x48')){var _0x29314a=_[_0x639e('0x16')](_0x24e1ad[_0x639e('0x4e')],'id');return _0x24e1ad[_0x639e('0x4f')](_0x29314a)[_0x639e('0xb')](function(){for(var _0x51112d=0x0;_0x51112d<_0x29314a[_0x639e('0x1c')];_0x51112d+=0x1){_0x3ab673[_0x639e('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x29314a[_0x51112d]),'UserId':Number(_0x24e1ad['id'])});}});}})['then'](function(){if(_0x3813f6===_0x639e('0x48')){var _0x549d44=_[_0x639e('0x16')](_0x24e1ad[_0x639e('0x50')],'id');return _0x24e1ad[_0x639e('0x51')](_0x549d44)['then'](function(){for(var _0x6085ca=0x0;_0x6085ca<_0x549d44[_0x639e('0x1c')];_0x6085ca+=0x1){_0x3ab673[_0x639e('0x47')](_0x639e('0x52'),{'WhatsappInteractionId':Number(_0x549d44[_0x6085ca]),'UserId':Number(_0x24e1ad['id'])});}});}})['catch'](function(_0x212e27){_0x224d52[_0x639e('0x53')](_0x212e27);});}}function onDisconnect(_0x4eda16,_0x404adb){joinOrLeave(_0x4eda16,_0x639e('0x48'),_0x404adb);}function onConnect(_0x6b1b3e){joinOrLeave(_0x6b1b3e,_0x639e('0x54'));}exports[_0x639e('0x55')]=function(_0x570835){_0x570835['on'](_0x639e('0x56'),function(_0x94fab4){_0x94fab4[_0x639e('0x57')](0x0);_0x94fab4[_0x639e('0x58')]=_0x94fab4[_0x639e('0x59')][_0x639e('0x56')][_0x639e('0x5a')]+':'+_0x94fab4[_0x639e('0x59')][_0x639e('0x56')][_0x639e('0x5b')];_0x94fab4['connectedAt']=new Date();_0x94fab4['log']=function(_0xdeb345){console[_0x639e('0x53')](_0x639e('0x5c')+_0x94fab4[_0x639e('0x5d')][_0x639e('0x2')]+'['+_0x94fab4['address']+']',_0xdeb345);};_0x94fab4['on'](_0x639e('0x5e'),function(){onDisconnect(_0x94fab4,_0x570835);_0x94fab4['log'](_0x639e('0x5f'));});onConnect(_0x94fab4);_0x94fab4[_0x639e('0x53')](_0x639e('0x60'));});}; \ No newline at end of file +var _0x4d1b=['WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','user','VoiceQueue','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','map','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','format','%s:queue:%s','Agents','handshake','query','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0x4d1b,0x102));var _0xb4d1=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x4d1b[_0x2fd0f0];return _0x57f71a;};'use strict';var _=require(_0xb4d1('0x0'));var util=require('util');var BPromise=require(_0xb4d1('0x1'));var db=require(_0xb4d1('0x2'))['db'];var config=require(_0xb4d1('0x3'));var queryQueues={'attributes':['id',_0xb4d1('0x4')],'include':[{'as':'Agents','model':db[_0xb4d1('0x5')],'attributes':['id','name',_0xb4d1('0x6')],'raw':!![],'where':{'role':_0xb4d1('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb4d1('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb4d1('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb4d1('0x4')],'where':{'role':_0xb4d1('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xb4d1('0x9')],'where':{'type':_0xb4d1('0xa')}};function getAssociatedResources(_0x5388c8,_0x3f4551,_0x23c12e){return db[_0xb4d1('0xb')][_0xb4d1('0xc')]({'where':{'name':_0x5388c8,'userProfileId':_0x3f4551},'raw':!![]})[_0xb4d1('0xd')](function(_0x6a70ea){if(_0x6a70ea){if(_0x6a70ea['autoAssociation']){switch(_0x5388c8){case _0xb4d1('0xe'):case _0xb4d1('0xf'):case _0xb4d1('0x10'):case _0xb4d1('0x11'):case _0xb4d1('0x12'):case _0xb4d1('0x13'):case _0xb4d1('0x14'):return db[_0x23c12e][_0xb4d1('0x15')](queryQueues);case _0xb4d1('0x16'):return db[_0x23c12e][_0xb4d1('0x15')](queryTelephones);case _0xb4d1('0x17'):return db[_0x23c12e][_0xb4d1('0x15')](queryTrunks);case _0xb4d1('0x18'):return db[_0x23c12e][_0xb4d1('0x15')](queryCampaigns);}}else{return db[_0xb4d1('0x19')][_0xb4d1('0x15')]({'attributes':[_0xb4d1('0x1a')],'where':{'sectionId':_0x6a70ea['id']},'raw':!![]})[_0xb4d1('0xd')](function(_0x2599fd){if(_0x2599fd){var _0x433e6d={'where':{'id':_['map'](_0x2599fd,'resourceId')},'raw':!![]};switch(_0x23c12e){case _0xb4d1('0x5'):_0x433e6d[_0xb4d1('0x1b')]['role']=_0xb4d1('0x8');break;case _0xb4d1('0x1c'):_0x433e6d['where'][_0xb4d1('0x9')]=_0xb4d1('0xa');break;}return db[_0x23c12e][_0xb4d1('0x15')](_0x433e6d);}else{return[];}});}}else{return[];}})['then'](function(_0x5b7e37){return _0x5b7e37;});}function joinOrLeaveQueues(_0x2ddbe1,_0x544493,_0x4bede1,_0x459615){_0x2ddbe1[_0x544493](util[_0xb4d1('0x1d')](_0xb4d1('0x1e'),_0x4bede1,_0x459615[_0xb4d1('0x4')]));if(_0x459615['Agents']){for(var _0x41e770=0x0;_0x41e770<_0x459615['Agents']['length'];_0x41e770+=0x1){_0x2ddbe1[_0x544493](util['format']('user:%s',_0x459615[_0xb4d1('0x1f')][_0x41e770]['name']));}}}function joinOrLeave(_0x42e36f,_0x5ca43a,_0x3fe374){var _0xcdbcc4;if(_0x42e36f[_0xb4d1('0x20')][_0xb4d1('0x21')]['id']){db[_0xb4d1('0x5')]['find']({'attributes':['id',_0xb4d1('0x4'),_0xb4d1('0x6'),_0xb4d1('0x22')],'where':{'id':_0x42e36f[_0xb4d1('0x20')][_0xb4d1('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xb4d1('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb4d1('0x24')],'as':_0xb4d1('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xb4d1('0x26')],'as':_0xb4d1('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb4d1('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xb4d1('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb4d1('0x2a')],'as':_0xb4d1('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xb4d1('0xd')](function(_0x503777){if(_0x503777){_0xcdbcc4=_0x503777;_0x42e36f[_0x5ca43a](util[_0xb4d1('0x1d')](_0xb4d1('0x2c'),_0x503777[_0xb4d1('0x4')]));var _0x474973=[];switch(_0x503777[_0xb4d1('0x6')]){case _0xb4d1('0x2d'):_0x42e36f[_0x5ca43a](_0xb4d1('0x2e'));_0x42e36f[_0x5ca43a](_0xb4d1('0x2f'));if(queryQueues['hasOwnProperty'](_0xb4d1('0x30'))){delete queryQueues[_0xb4d1('0x30')];}_0x474973[_0xb4d1('0x31')](db['VoiceQueue'][_0xb4d1('0x15')](queryQueues));_0x474973['push'](db[_0xb4d1('0x32')][_0xb4d1('0x15')](queryQueues));_0x474973[_0xb4d1('0x31')](db[_0xb4d1('0x33')][_0xb4d1('0x15')](queryQueues));_0x474973[_0xb4d1('0x31')](db[_0xb4d1('0x34')][_0xb4d1('0x15')](queryQueues));_0x474973[_0xb4d1('0x31')](db[_0xb4d1('0x35')][_0xb4d1('0x15')](queryQueues));_0x474973[_0xb4d1('0x31')](db['OpenchannelQueue'][_0xb4d1('0x15')](queryQueues));_0x474973[_0xb4d1('0x31')](db[_0xb4d1('0x36')][_0xb4d1('0x15')](queryQueues));_0x474973[_0xb4d1('0x31')](db['User'][_0xb4d1('0x15')](queryTelephones));_0x474973[_0xb4d1('0x31')](db['Trunk'][_0xb4d1('0x15')](queryTrunks));_0x474973[_0xb4d1('0x31')](db[_0xb4d1('0x1c')]['findAll'](queryCampaigns));_0x474973['push'](db[_0xb4d1('0x5')][_0xb4d1('0x15')](queryAgents));break;case _0xb4d1('0x37'):_0x42e36f[_0x5ca43a](_0xb4d1('0x2e'));_0x42e36f[_0x5ca43a](_0xb4d1('0x2f'));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0xe'),_0x503777[_0xb4d1('0x22')],_0xb4d1('0x38')));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0xf'),_0x503777[_0xb4d1('0x22')],_0xb4d1('0x32')));_0x474973[_0xb4d1('0x31')](getAssociatedResources('FaxQueues',_0x503777[_0xb4d1('0x22')],_0xb4d1('0x33')));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0x11'),_0x503777[_0xb4d1('0x22')],_0xb4d1('0x34')));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0x12'),_0x503777[_0xb4d1('0x22')],_0xb4d1('0x35')));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0x13'),_0x503777[_0xb4d1('0x22')],'OpenchannelQueue'));_0x474973['push'](getAssociatedResources(_0xb4d1('0x14'),_0x503777[_0xb4d1('0x22')],_0xb4d1('0x36')));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0x16'),_0x503777['userProfileId'],'User'));_0x474973[_0xb4d1('0x31')](getAssociatedResources(_0xb4d1('0x17'),_0x503777['userProfileId'],_0xb4d1('0x39')));_0x474973[_0xb4d1('0x31')](getAssociatedResources('IvrCampaigns',_0x503777[_0xb4d1('0x22')],_0xb4d1('0x1c')));_0x474973['push'](db['User']['findAll'](queryAgents));break;case _0xb4d1('0x7'):_0x42e36f[_0x5ca43a](_0xb4d1('0x2e'));_0x42e36f[_0x5ca43a]('voice:outbound');_0x474973[_0xb4d1('0x31')](_0x503777[_0xb4d1('0x3a')]({'attributes':['id','name']}));_0x474973['push'](_0x503777[_0xb4d1('0x3b')]({'attributes':['id',_0xb4d1('0x4')]}));_0x474973[_0xb4d1('0x31')](_0x503777['getFaxQueues']({'attributes':['id',_0xb4d1('0x4')]}));_0x474973[_0xb4d1('0x31')](_0x503777[_0xb4d1('0x3c')]({'attributes':['id',_0xb4d1('0x4')]}));_0x474973['push'](_0x503777[_0xb4d1('0x3d')]({'attributes':['id',_0xb4d1('0x4')]}));_0x474973[_0xb4d1('0x31')](_0x503777[_0xb4d1('0x3e')]({'attributes':['id',_0xb4d1('0x4')]}));_0x474973[_0xb4d1('0x31')](_0x503777[_0xb4d1('0x3f')]({'attributes':['id',_0xb4d1('0x4')]}));break;}return BPromise[_0xb4d1('0x40')](_0x474973);}})[_0xb4d1('0xd')](function(_0x3f0dcf){if(_0x3f0dcf&&_0x3f0dcf['length']){for(var _0x3eeea7=0x0;_0x3eeea7<_0x3f0dcf[_0xb4d1('0x41')];_0x3eeea7+=0x1){for(var _0x14c6c5=0x0;_0x14c6c5<_0x3f0dcf[_0x3eeea7][_0xb4d1('0x41')];_0x14c6c5+=0x1){switch(_0x3eeea7){case 0x0:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,_0xb4d1('0x42'),_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x1:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,'chat',_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x2:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,_0xb4d1('0x43'),_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x3:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,_0xb4d1('0x44'),_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x4:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,_0xb4d1('0x45'),_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x5:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,_0xb4d1('0x46'),_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x6:joinOrLeaveQueues(_0x42e36f,_0x5ca43a,_0xb4d1('0x47'),_0x3f0dcf[_0x3eeea7][_0x14c6c5]);break;case 0x7:if(_0xcdbcc4[_0xb4d1('0x6')]!==_0xb4d1('0x7'))_0x42e36f[_0x5ca43a](util['format'](_0xb4d1('0x48'),_0x3f0dcf[_0x3eeea7][_0x14c6c5][_0xb4d1('0x4')]));break;case 0x8:if(_0xcdbcc4[_0xb4d1('0x6')]!=='agent')_0x42e36f[_0x5ca43a](util[_0xb4d1('0x1d')](_0xb4d1('0x49'),_0x3f0dcf[_0x3eeea7][_0x14c6c5][_0xb4d1('0x4')]));break;case 0x9:if(_0xcdbcc4[_0xb4d1('0x6')]!==_0xb4d1('0x7'))_0x42e36f[_0x5ca43a](util['format'](_0xb4d1('0x4a'),_0x3f0dcf[_0x3eeea7][_0x14c6c5][_0xb4d1('0x9')],_0x3f0dcf[_0x3eeea7][_0x14c6c5][_0xb4d1('0x4')]));break;case 0xa:_0x42e36f[_0x5ca43a](util[_0xb4d1('0x1d')](_0xb4d1('0x2c'),_0x3f0dcf[_0x3eeea7][_0x14c6c5][_0xb4d1('0x4')]));break;}}}}})[_0xb4d1('0xd')](function(){if(_0x5ca43a==='leave'){var _0x4c2b1b=_['map'](_0xcdbcc4[_0xb4d1('0x23')],'id');return _0xcdbcc4[_0xb4d1('0x4b')](_0x4c2b1b)['then'](function(){for(var _0x3e8abf=0x0;_0x3e8abf<_0x4c2b1b['length'];_0x3e8abf+=0x1){_0x3fe374[_0xb4d1('0x4c')](_0xb4d1('0x4d'),{'ChatInteractionId':Number(_0x4c2b1b[_0x3e8abf]),'UserId':Number(_0xcdbcc4['id'])});}});}})[_0xb4d1('0xd')](function(){if(_0x5ca43a===_0xb4d1('0x4e')){var _0x21ef5b=_[_0xb4d1('0x4f')](_0xcdbcc4[_0xb4d1('0x25')],'id');return _0xcdbcc4['removeMailInteractions'](_0x21ef5b)[_0xb4d1('0xd')](function(){for(var _0x1092f9=0x0;_0x1092f9<_0x21ef5b[_0xb4d1('0x41')];_0x1092f9+=0x1){_0x3fe374[_0xb4d1('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x21ef5b[_0x1092f9]),'UserId':Number(_0xcdbcc4['id'])});}});}})[_0xb4d1('0xd')](function(){if(_0x5ca43a===_0xb4d1('0x4e')){var _0x43b0a6=_[_0xb4d1('0x4f')](_0xcdbcc4[_0xb4d1('0x27')],'id');return _0xcdbcc4['removeFaxInteractions'](_0x43b0a6)[_0xb4d1('0xd')](function(){for(var _0x1c41ad=0x0;_0x1c41ad<_0x43b0a6[_0xb4d1('0x41')];_0x1c41ad+=0x1){_0x3fe374[_0xb4d1('0x4c')](_0xb4d1('0x50'),{'FaxInteractionId':Number(_0x43b0a6[_0x1c41ad]),'UserId':Number(_0xcdbcc4['id'])});}});}})[_0xb4d1('0xd')](function(){if(_0x5ca43a==='leave'){var _0x259667=_[_0xb4d1('0x4f')](_0xcdbcc4['SmsInteractions'],'id');return _0xcdbcc4[_0xb4d1('0x51')](_0x259667)[_0xb4d1('0xd')](function(){for(var _0x1898e9=0x0;_0x1898e9<_0x259667[_0xb4d1('0x41')];_0x1898e9+=0x1){_0x3fe374[_0xb4d1('0x4c')](_0xb4d1('0x52'),{'SmsInteractionId':Number(_0x259667[_0x1898e9]),'UserId':Number(_0xcdbcc4['id'])});}});}})[_0xb4d1('0xd')](function(){if(_0x5ca43a===_0xb4d1('0x4e')){var _0xaa786c=_[_0xb4d1('0x4f')](_0xcdbcc4[_0xb4d1('0x29')],'id');return _0xcdbcc4[_0xb4d1('0x53')](_0xaa786c)[_0xb4d1('0xd')](function(){for(var _0x3b21c7=0x0;_0x3b21c7<_0xaa786c[_0xb4d1('0x41')];_0x3b21c7+=0x1){_0x3fe374[_0xb4d1('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xaa786c[_0x3b21c7]),'UserId':Number(_0xcdbcc4['id'])});}});}})[_0xb4d1('0xd')](function(){if(_0x5ca43a===_0xb4d1('0x4e')){var _0x5056cc=_[_0xb4d1('0x4f')](_0xcdbcc4[_0xb4d1('0x2b')],'id');return _0xcdbcc4[_0xb4d1('0x54')](_0x5056cc)['then'](function(){for(var _0x255c91=0x0;_0x255c91<_0x5056cc['length'];_0x255c91+=0x1){_0x3fe374[_0xb4d1('0x4c')](_0xb4d1('0x55'),{'WhatsappInteractionId':Number(_0x5056cc[_0x255c91]),'UserId':Number(_0xcdbcc4['id'])});}});}})[_0xb4d1('0x56')](function(_0x413630){_0x42e36f[_0xb4d1('0x57')](_0x413630);});}}function onDisconnect(_0x46d0ae,_0x1d73d0){joinOrLeave(_0x46d0ae,_0xb4d1('0x4e'),_0x1d73d0);}function onConnect(_0x7189e7){joinOrLeave(_0x7189e7,_0xb4d1('0x58'));}exports[_0xb4d1('0x59')]=function(_0x551afc){_0x551afc['on']('connection',function(_0x1e0961){_0x1e0961[_0xb4d1('0x5a')](0x0);_0x1e0961[_0xb4d1('0x5b')]=_0x1e0961[_0xb4d1('0x5c')][_0xb4d1('0x5d')][_0xb4d1('0x5e')]+':'+_0x1e0961[_0xb4d1('0x5c')]['connection']['remotePort'];_0x1e0961[_0xb4d1('0x5f')]=new Date();_0x1e0961[_0xb4d1('0x57')]=function(_0x2cd71c){console[_0xb4d1('0x57')](_0xb4d1('0x60')+_0x1e0961[_0xb4d1('0x61')][_0xb4d1('0x4')]+'['+_0x1e0961[_0xb4d1('0x5b')]+']',_0x2cd71c);};_0x1e0961['on']('disconnect',function(){onDisconnect(_0x1e0961,_0x551afc);_0x1e0961[_0xb4d1('0x57')](_0xb4d1('0x62'));});onConnect(_0x1e0961);_0x1e0961[_0xb4d1('0x57')](_0xb4d1('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3f7e93a..31e0834 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 _0x7107=['default','length','hasOwnProperty','model','hook','callback','condition','util','jayson/promise','../logger','triggers','http','Chat','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','afterUpdate','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','error','code','catch','motionChannel','event','direction','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','channel','resolve','interface','Trigger,\x20%s','changed','closed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterUpdate','User','find','fullname','email','internal'];(function(_0x22e38e,_0x22b160){var _0x247042=function(_0x3451a9){while(--_0x3451a9){_0x22e38e['push'](_0x22e38e['shift']());}};_0x247042(++_0x22b160);}(_0x7107,0xdf));var _0x7710=function(_0x404dc4,_0x13cc13){_0x404dc4=_0x404dc4-0x0;var _0x574739=_0x7107[_0x404dc4];return _0x574739;};'use strict';var util=require(_0x7710('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7710('0x1'));var logger=require(_0x7710('0x2'))(_0x7710('0x3'));var client=jayson['client'][_0x7710('0x4')]({'port':0x232a});var triggers=[{'channel':_0x7710('0x5'),'model':'ChatInteraction','event':_0x7710('0x6'),'condition':_0x7710('0x7'),'callback':afterCreate},{'channel':_0x7710('0x5'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x7710('0x8'),'callback':afterUpdate},{'channel':_0x7710('0x5'),'model':_0x7710('0x9'),'event':'afterCreate','condition':_0x7710('0xa'),'callback':afterCreateMessage},{'channel':_0x7710('0x5'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x7710('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x7710('0xb'),'model':_0x7710('0xc'),'event':'afterCreate','condition':_0x7710('0x7'),'callback':afterCreate},{'channel':_0x7710('0xb'),'model':_0x7710('0xc'),'event':'afterUpdate','condition':_0x7710('0x8'),'callback':afterUpdate},{'channel':_0x7710('0xb'),'model':'SmsMessage','event':_0x7710('0x6'),'condition':_0x7710('0xa'),'callback':afterCreateMessage},{'channel':_0x7710('0xd'),'model':'WhatsappInteraction','event':_0x7710('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7710('0xd'),'model':_0x7710('0xe'),'event':_0x7710('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7710('0xd'),'model':'WhatsappMessage','event':_0x7710('0x6'),'condition':_0x7710('0xa'),'callback':afterCreateMessage},{'channel':_0x7710('0x10'),'model':_0x7710('0x11'),'event':'afterCreate','condition':_0x7710('0x7'),'callback':afterCreate},{'channel':_0x7710('0x10'),'model':_0x7710('0x11'),'event':'afterUpdate','condition':_0x7710('0x8'),'callback':afterUpdate},{'channel':_0x7710('0x10'),'model':'FaxMessage','event':_0x7710('0x6'),'condition':_0x7710('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x7710('0x12'),'event':'afterCreate','condition':_0x7710('0x7'),'callback':afterCreate},{'channel':_0x7710('0x13'),'model':_0x7710('0x12'),'event':'afterUpdate','condition':_0x7710('0x8'),'callback':afterUpdate},{'channel':_0x7710('0x13'),'model':_0x7710('0x14'),'event':_0x7710('0x6'),'condition':_0x7710('0xa'),'callback':afterCreateMessage},{'channel':_0x7710('0x15'),'model':_0x7710('0x16'),'event':_0x7710('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7710('0x15'),'model':_0x7710('0x16'),'event':_0x7710('0xf'),'condition':_0x7710('0x8'),'callback':afterUpdate},{'channel':_0x7710('0x15'),'model':_0x7710('0x17'),'event':_0x7710('0x6'),'condition':_0x7710('0xa'),'callback':afterCreateMessage}];function request(_0x144249){return client[_0x7710('0x18')](_0x7710('0x19'),_0x144249)[_0x7710('0x1a')](function(_0x2c5201){logger['info']('Trigger,\x20%s',_0x7710('0x19'),_0x2c5201);if(_0x2c5201[_0x7710('0x1b')]){if(_0x2c5201[_0x7710('0x1b')][_0x7710('0x1c')]===0x1f4){logger[_0x7710('0x1b')]('Trigger,\x20%s',_0x7710('0x19'),_0x2c5201[_0x7710('0x1b')]);}}})[_0x7710('0x1d')](function(_0x30da4e){logger[_0x7710('0x1b')]('Trigger,\x20%s',_0x7710('0x19'),_0x30da4e);});}function afterCreateMessage(_0x51052e){return function(_0x14ff75){_0x14ff75=_0x14ff75['get']({'plain':!![]});_0x14ff75['channel']=_0x51052e;_0x14ff75[_0x7710('0x1e')]=_0x51052e;_0x14ff75[_0x7710('0x1f')]=_0x14ff75[_0x7710('0x20')];Promise['resolve']()[_0x7710('0x1a')](function(){if(typeof _0x14ff75[_0x7710('0x21')]===_0x7710('0x22'))return null;var _0x40ad56='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x14ff75[_0x7710('0x21')];return db[_0x7710('0x23')][_0x7710('0x24')](_0x40ad56,{'type':db[_0x7710('0x25')][_0x7710('0x26')][_0x7710('0x27')],'raw':!![]});})[_0x7710('0x1a')](function(_0x34a7ca){if(_0x34a7ca){_0x14ff75[_0x7710('0x28')]=_0x34a7ca[0x0];}if(typeof _0x14ff75[_0x7710('0x29')]===_0x7710('0x22'))return;return getAgent(_0x14ff75[_0x7710('0x29')]);})[_0x7710('0x1a')](function(_0x333f6a){if(_0x333f6a){_0x14ff75['interface']=util[_0x7710('0x2a')](_0x7710('0x2b'),_0x333f6a[_0x7710('0x2c')]);_0x14ff75[_0x7710('0x2d')]=_0x333f6a;_0x14ff75['channel']=_0x51052e;return request({'event':_0x7710('0x2e'),'message':_0x14ff75});}else{return request({'event':_0x7710('0x2f'),'message':_0x14ff75});}})['catch'](function(_0x3b0916){logger['error']('Trigger,\x20%s',_0x7710('0x30'),_0x3b0916);});};}function afterCreateOfflineMessage(_0x63e739){return function(_0x1dc78e){_0x1dc78e=_0x1dc78e[_0x7710('0x31')]({'plain':!![]});_0x1dc78e['channel']=_0x63e739;_0x1dc78e[_0x7710('0x1e')]=_0x63e739;_0x1dc78e[_0x7710('0x1f')]=_0x7710('0x32');return request({'event':_0x1dc78e[_0x7710('0x1f')],'message':_0x1dc78e});};}function afterCreate(_0x3261f5,_0x265300){return function(_0x4d11f2){_0x4d11f2=_0x4d11f2[_0x7710('0x31')]({'plain':!![]});_0x4d11f2[_0x7710('0x33')]=_0x3261f5;_0x4d11f2[_0x7710('0x1e')]=_0x3261f5;_0x4d11f2[_0x7710('0x1f')]='opened';Promise[_0x7710('0x34')]()[_0x7710('0x1a')](function(){var _0x259510='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d11f2[_0x7710('0x21')];return db[_0x7710('0x23')][_0x7710('0x24')](_0x259510,{'type':db[_0x7710('0x25')][_0x7710('0x26')]['SELECT'],'raw':!![]});})[_0x7710('0x1a')](function(_0x50d543){if(_0x50d543){_0x4d11f2[_0x7710('0x28')]=_0x50d543[0x0];}if(typeof _0x4d11f2['UserId']===_0x7710('0x22'))return;return getAgent(_0x4d11f2[_0x7710('0x29')]);})[_0x7710('0x1a')](function(_0x762b23){if(_0x762b23){_0x4d11f2[_0x7710('0x35')]=util[_0x7710('0x2a')]('SIP/%s',_0x762b23[_0x7710('0x2c')]);_0x4d11f2[_0x7710('0x2d')]=_0x762b23;}return request({'event':_0x265300,'message':_0x4d11f2});})[_0x7710('0x1d')](function(_0x38852a){logger[_0x7710('0x1b')](_0x7710('0x36'),'AfterCreate',_0x38852a);});};}function afterUpdate(_0x106561){return function(_0x1a868a){var _0x13421c=_0x1a868a[_0x7710('0x37')](_0x7710('0x38'))&&_0x1a868a[_0x7710('0x38')];var _0x1a81ce=_0x1a868a[_0x7710('0x37')](_0x7710('0x39'));if(_0x13421c||_0x1a81ce){var _0x544bd6=_0x13421c?_0x7710('0x8'):'substatus';var _0xe5918=_0x1a868a['get']({'plain':!![]});_0xe5918['channel']=_0x106561;_0xe5918[_0x7710('0x1e')]=_0x106561;_0xe5918[_0x7710('0x1f')]=_0x13421c?_0x7710('0x38'):'substatus';var _0x47ec09=_0x7710('0x3a')+_0xe5918[_0x7710('0x21')];return db[_0x7710('0x23')][_0x7710('0x24')](_0x47ec09,{'type':db[_0x7710('0x25')][_0x7710('0x26')][_0x7710('0x27')],'raw':!![]})['then'](function(_0x284e35){if(_0x284e35){_0xe5918['contact']=_0x284e35[0x0];}if(typeof _0xe5918[_0x7710('0x29')]===_0x7710('0x22'))return;return getAgent(_0xe5918[_0x7710('0x29')]);})[_0x7710('0x1a')](function(_0x2879bf){if(_0x2879bf){_0xe5918[_0x7710('0x35')]=util[_0x7710('0x2a')](_0x7710('0x2b'),_0x2879bf[_0x7710('0x2c')]);_0xe5918[_0x7710('0x2d')]=_0x2879bf;}return request({'event':_0x544bd6,'message':_0xe5918});})[_0x7710('0x1d')](function(_0x1a23ae){logger[_0x7710('0x1b')](_0x7710('0x36'),_0x7710('0x3b'),_0x1a23ae);});}};}function getAgent(_0x445ccc){return db[_0x7710('0x3c')][_0x7710('0x3d')]({'where':{'id':_0x445ccc},'attributes':['id',_0x7710('0x2c'),_0x7710('0x3e'),_0x7710('0x3f'),_0x7710('0x40')],'raw':!![]})[_0x7710('0x1a')](function(_0x26310e){return _0x26310e;});}exports[_0x7710('0x41')]=function(){for(var _0x4c38b8=0x0;_0x4c38b8=_0x232051[_0x2235('0x13')]){throw Error(_0x2235('0x14'));}_0x3c885c(_0x37ec7d);})['catch'](function(_0xbba8fb){_0x30ab57(_0xbba8fb);});});}; \ No newline at end of file +var _0x5241=['mail','chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','role','agent','User','getLicense','then','agents','lodash','bluebird','../mysqldb','./license/util','voice'];(function(_0x4e7cc3,_0x47ff4){var _0x42e46d=function(_0x43bd6e){while(--_0x43bd6e){_0x4e7cc3['push'](_0x4e7cc3['shift']());}};_0x42e46d(++_0x47ff4);}(_0x5241,0xf8));var _0x1524=function(_0x39a012,_0x513f5c){_0x39a012=_0x39a012-0x0;var _0x3b103a=_0x5241[_0x39a012];return _0x3b103a;};'use strict';var _=require(_0x1524('0x0'));var BPromise=require(_0x1524('0x1'));var db=require(_0x1524('0x2'))['db'];var util=require(_0x1524('0x3'));var channels=[_0x1524('0x4'),_0x1524('0x5'),_0x1524('0x6'),_0x1524('0x7'),_0x1524('0x8'),_0x1524('0x9'),'openchannel'];exports[_0x1524('0xa')]=function(){return channels;};exports[_0x1524('0xb')]=function(_0x30b1ac){_0x30b1ac=_0x30b1ac[_0x1524('0xc')]();return _[_0x1524('0xd')](channels,_0x30b1ac);};exports[_0x1524('0xe')]=function(_0x22b465,_0x2b7b04,_0x4a0c16,_0x22e154){var _0x2924da={'loginAttempts':_0x2b7b04,'blocked':_0x4a0c16};if(!_[_0x1524('0xf')](_0x22e154)){_0x2924da[_0x1524('0x10')]=_0x22e154;}return _0x22b465['updateAttributes'](_0x2924da);};exports['getLicense']=function(_0x78f42e){return new BPromise(function(_0x1a2395,_0x312f14){var _0x1e798b=0x0;if(_0x78f42e[_0x1524('0x11')]!==_0x1524('0x12')){_0x1a2395(_0x78f42e);}db[_0x1524('0x13')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x78f42e['id']}}})['then'](function(_0x4cd8ca){_0x1e798b=_0x4cd8ca;return util[_0x1524('0x14')]();})[_0x1524('0x15')](function(_0x22255b){if(_0x22255b&&_0x22255b[_0x1524('0x16')]&&_0x1e798b>=_0x22255b[_0x1524('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1a2395(_0x78f42e);})['catch'](function(_0x4005a1){_0x312f14(_0x4005a1);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index a6b0e2f..aebd4c2 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['Bad\x20Request','Forbidden','Not\x20Found','error','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x878f,0x173));var _0xf878=function(_0x3632ca,_0x1ac8e5){_0x3632ca=_0x3632ca-0x0;var _0x4fe03c=_0x878f[_0x3632ca];return _0x4fe03c;};'use strict';var util=require('util');var logger=require(_0xf878('0x0'))(_0xf878('0x1'));var APIError=function(_0x2e1d23,_0x12df2b){this[_0xf878('0x2')]=_0x2e1d23||_0xf878('0x3');this[_0xf878('0x4')]=_0x12df2b||_0xf878('0x5');util[_0xf878('0x6')](APIError,Error);};var APIBadRequestError=function(_0xcf1927){this[_0xf878('0x2')]=_0xcf1927||'Bad\x20Request';this['name']=_0xf878('0x7');util[_0xf878('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x59e564){this['message']=_0x59e564||'Entity\x20not\x20found';this[_0xf878('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x307653){switch(_0x307653){case _0xf878('0x7'):return 0x190;case _0xf878('0x8'),'OutOfInterval':return 0x193;case _0xf878('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x1399a3){return function(_0x531b9c){logger[_0xf878('0xa')](_0x531b9c['stack']);var _0x31d3d2=getStatusCode(_0x531b9c[_0xf878('0x4')]);if(_0x531b9c[_0xf878('0x4')])delete _0x531b9c['name'];return _0x1399a3[_0xf878('0xb')](_0x31d3d2)[_0xf878('0xc')](_0x531b9c);};}module[_0xf878('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb821=['status','exports','../config/logger','api','message','Error','inherits','name','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x2d3385,_0x25e3f0){var _0x41e696=function(_0x3a4ead){while(--_0x3a4ead){_0x2d3385['push'](_0x2d3385['shift']());}};_0x41e696(++_0x25e3f0);}(_0xb821,0xa7));var _0x1b82=function(_0x2bd380,_0xbda074){_0x2bd380=_0x2bd380-0x0;var _0x8716fc=_0xb821[_0x2bd380];return _0x8716fc;};'use strict';var util=require('util');var logger=require(_0x1b82('0x0'))(_0x1b82('0x1'));var APIError=function(_0x5924c6,_0x4a4f81){this[_0x1b82('0x2')]=_0x5924c6||'Internal\x20Server\x20Error';this['name']=_0x4a4f81||_0x1b82('0x3');util[_0x1b82('0x4')](APIError,Error);};var APIBadRequestError=function(_0x3fadf0){this[_0x1b82('0x2')]=_0x3fadf0||'Bad\x20Request';this[_0x1b82('0x5')]=_0x1b82('0x6');util[_0x1b82('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3632dd){this[_0x1b82('0x2')]=_0x3632dd||_0x1b82('0x7');this[_0x1b82('0x5')]=_0x1b82('0x8');util[_0x1b82('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x4955b5){switch(_0x4955b5){case _0x1b82('0x6'):return 0x190;case _0x1b82('0x9'),_0x1b82('0xa'):return 0x193;case _0x1b82('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xcffb87){return function(_0x17a96b){logger[_0x1b82('0xb')](_0x17a96b[_0x1b82('0xc')]);var _0x5f521f=getStatusCode(_0x17a96b[_0x1b82('0x5')]);if(_0x17a96b[_0x1b82('0x5')])delete _0x17a96b[_0x1b82('0x5')];return _0xcffb87[_0x1b82('0xd')](_0x5f521f)['send'](_0x17a96b);};}module[_0x1b82('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 2f2e21f..3b0ee01 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6212=['send','status','render'];(function(_0x3dede9,_0x29082e){var _0x436d45=function(_0x110ba3){while(--_0x110ba3){_0x3dede9['push'](_0x3dede9['shift']());}};_0x436d45(++_0x29082e);}(_0x6212,0x1d2));var _0x2621=function(_0x14d6f7,_0x4207b2){_0x14d6f7=_0x14d6f7-0x0;var _0x1f256b=_0x6212[_0x14d6f7];return _0x1f256b;};'use strict';module['exports'][0x194]=function pageNotFound(_0x6fda63,_0xbe6fa3){var _0x3ece31='404';var _0x25b5df=0x194;var _0x368b8c={'status':_0x25b5df};_0xbe6fa3[_0x2621('0x0')](_0x368b8c[_0x2621('0x0')]);_0xbe6fa3[_0x2621('0x1')](_0x3ece31,{},function(_0xfe06c9,_0x3aaa35){if(_0xfe06c9){return _0xbe6fa3[_0x2621('0x0')](_0x368b8c[_0x2621('0x0')])['json'](_0x368b8c);}_0xbe6fa3[_0x2621('0x2')](_0x3aaa35);});}; \ No newline at end of file +var _0xb74e=['json','send','status'];(function(_0x4502ec,_0x586393){var _0x36cf12=function(_0x528952){while(--_0x528952){_0x4502ec['push'](_0x4502ec['shift']());}};_0x36cf12(++_0x586393);}(_0xb74e,0xe9));var _0xeb74=function(_0x37031f,_0x558f91){_0x37031f=_0x37031f-0x0;var _0x36b71c=_0xb74e[_0x37031f];return _0x36b71c;};'use strict';module['exports'][0x194]=function pageNotFound(_0x12982a,_0x2b49a1){var _0x4de55d='404';var _0x58d937=0x194;var _0x372c4b={'status':_0x58d937};_0x2b49a1[_0xeb74('0x0')](_0x372c4b[_0xeb74('0x0')]);_0x2b49a1['render'](_0x4de55d,{},function(_0x2082e3,_0x34717f){if(_0x2082e3){return _0x2b49a1['status'](_0x372c4b[_0xeb74('0x0')])[_0xeb74('0x1')](_0x372c4b);}_0x2b49a1[_0xeb74('0x2')](_0x34717f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2cc10b3..9054249 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c77=['UserId','User','UserSetting','userSetting','hasMany','VoiceRecording','VoiceQueuesRt','HopperFinals','CmHopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','user_has_chat_websites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','Contact','ContactId','CloudProvider','CloudProviderId','restrict','MailAccountId','Imap','Disposition','Dispositions','Answers','List','ListId','Agents','team_has_mail_queues','Teams','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','Dashboard','Items','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','Interactions','SmsInteraction','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','Website','Contacts','Company','cm_contact_has_tags','CmHopperId','Campaign','OneAll','AutomationAllId','Any','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','CustomReportId','ItemType','ItemTypeId','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','SalesforceAccount','SalesforceConfiguration','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','DeskConfiguration','Configurations','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesField','ToId','SessionId','ProjectId','ChatQueues','CampaignId','HopperHistories','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','Queues','Extensions','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','Smtp','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8','database','username','password','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../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','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','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','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','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','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','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','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade'];(function(_0x546321,_0x54345b){var _0x3be340=function(_0x376109){while(--_0x376109){_0x546321['push'](_0x546321['shift']());}};_0x3be340(++_0x54345b);}(_0x3c77,0xe5));var _0x73c7=function(_0x26b777,_0x44d664){_0x26b777=_0x26b777-0x0;var _0x3e8829=_0x3c77[_0x26b777];return _0x3e8829;};'use strict';var config=require(_0x73c7('0x0'));var Sequelize=require(_0x73c7('0x1'));var _=require(_0x73c7('0x2'));var jstz=require('jstz');var timezone=jstz[_0x73c7('0x3')]();config['sequelize']=_[_0x73c7('0x4')](config[_0x73c7('0x1')],{'database':_0x73c7('0x5'),'username':_0x73c7('0x6'),'password':_0x73c7('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x73c7('0x8'),'dialectOptions':{'charset':_0x73c7('0x9')},'logging':![],'timezone':timezone[_0x73c7('0xa')](),'define':{'charset':'utf8','collate':_0x73c7('0xb')}}});config[_0x73c7('0xc')]=_[_0x73c7('0x4')](config[_0x73c7('0xc')],{'database':_0x73c7('0x5'),'username':'xcall','password':_0x73c7('0x7'),'options':{'host':_0x73c7('0xd'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x73c7('0xa')](),'define':{'charset':_0x73c7('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x73c7('0x1')][_0x73c7('0xf')],config[_0x73c7('0x1')][_0x73c7('0x10')],config[_0x73c7('0x1')][_0x73c7('0x11')],config[_0x73c7('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x73c7('0xf')],config['sequelizeHistory']['username'],config[_0x73c7('0xc')]['password'],config[_0x73c7('0xc')]['options'])};db['User']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x13'));db['VoiceChanSpy']=db[_0x73c7('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x73c7('0x14')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x15'));db[_0x73c7('0x16')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x17'));db[_0x73c7('0x18')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x19'));db['VoiceQueue']=db['sequelize']['import'](_0x73c7('0x1a'));db['VoiceRecording']=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/voiceRecording/voiceRecording.model');db[_0x73c7('0x1b')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x1c'));db[_0x73c7('0x1d')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x1e'));db[_0x73c7('0x1f')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x20'));db[_0x73c7('0x21')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x22'));db[_0x73c7('0x23')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x24'));db[_0x73c7('0x25')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x26'));db[_0x73c7('0x27')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x28'));db[_0x73c7('0x29')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x2a'));db[_0x73c7('0x2b')]=db[_0x73c7('0x1')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x2c'));db[_0x73c7('0x2d')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x2e'));db['UserVoiceQueue']=db['sequelize']['import'](_0x73c7('0x2f'));db[_0x73c7('0x30')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x31'));db[_0x73c7('0x32')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x33'));db[_0x73c7('0x34')]=db['sequelize']['import'](_0x73c7('0x35'));db[_0x73c7('0x36')]=db['sequelize'][_0x73c7('0x12')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x37'));db[_0x73c7('0x38')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x39'));db[_0x73c7('0x3a')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x3b'));db[_0x73c7('0x3c')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x3d'));db[_0x73c7('0x3e')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x3f'));db[_0x73c7('0x40')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x41'));db[_0x73c7('0x42')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x43'));db[_0x73c7('0x44')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x73c7('0x45')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x46'));db[_0x73c7('0x47')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x48'));db[_0x73c7('0x49')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x73c7('0x12')]('../api/dashboard/dashboard.model');db[_0x73c7('0x4a')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x4b'));db[_0x73c7('0x4c')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x4d'));db[_0x73c7('0x4e')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x4f'));db[_0x73c7('0x50')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x51'));db['FaxMessage']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x52'));db['FaxQueue']=db[_0x73c7('0x1')]['import'](_0x73c7('0x53'));db[_0x73c7('0x54')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x55'));db['SmsAccount']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x56'));db[_0x73c7('0x57')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x58'));db['SmsInteraction']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x59'));db['SmsMessage']=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x5a'));db[_0x73c7('0x5b')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x5c'));db[_0x73c7('0x5d')]=db['sequelize']['import'](_0x73c7('0x5e'));db[_0x73c7('0x5f')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x60'));db[_0x73c7('0x61')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x62'));db[_0x73c7('0x63')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x64'));db[_0x73c7('0x65')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x66'));db['ChatWebsite']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x67'));db[_0x73c7('0x68')]=db['sequelize'][_0x73c7('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x73c7('0x69')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x6a'));db[_0x73c7('0x6b')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x6c'));db[_0x73c7('0x6d')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x6e'));db['ChatOfflineMessage']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x6f'));db['ChatQueue']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x70'));db[_0x73c7('0x71')]=db['sequelize'][_0x73c7('0x12')]('../api/chatGroup/chatGroup.model');db[_0x73c7('0x72')]=db['sequelize']['import'](_0x73c7('0x73'));db[_0x73c7('0x74')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/cmCompany/cmCompany.model');db[_0x73c7('0x75')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x76'));db[_0x73c7('0x77')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x78'));db[_0x73c7('0x79')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x7a'));db[_0x73c7('0x7b')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x7c'));db['CmHopperHistory']=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x73c7('0x7d')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x7e'));db[_0x73c7('0x7f')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x80'));db[_0x73c7('0x81')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x82'));db[_0x73c7('0x83')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/automation/automation.model');db[_0x73c7('0x84')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x85'));db['Disposition']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x86'));db[_0x73c7('0x87')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x88'));db['Interval']=db['sequelize'][_0x73c7('0x12')]('../api/interval/interval.model');db[_0x73c7('0x89')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x8a'));db['Cdr']=db['sequelize']['import']('../api/cdr/cdr.model');db[_0x73c7('0x8b')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x8c'));db['Schedule']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x8d'));db[_0x73c7('0x8e')]=db['sequelize']['import'](_0x73c7('0x8f'));db[_0x73c7('0x90')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x91'));db[_0x73c7('0x92')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x93'));db[_0x73c7('0x94')]=db[_0x73c7('0x1')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0x73c7('0x95')]=db[_0x73c7('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x73c7('0x96')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x97'));db[_0x73c7('0x98')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x99'));db[_0x73c7('0x9a')]=db['sequelize']['import'](_0x73c7('0x9b'));db[_0x73c7('0x9c')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x9d'));db[_0x73c7('0x9e')]=db['sequelize'][_0x73c7('0x12')]('../api/integrationReport/integrationReport.model');db[_0x73c7('0x9f')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xa0'));db[_0x73c7('0xa1')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xa2'));db[_0x73c7('0xa3')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x73c7('0xa4')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xa5'));db[_0x73c7('0xa6')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xa7'));db[_0x73c7('0xa8')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xa9'));db['SalesforceAccount']=db[_0x73c7('0x1')]['import'](_0x73c7('0xaa'));db['SalesforceConfiguration']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xab'));db['SalesforceField']=db['sequelize'][_0x73c7('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x73c7('0xac')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xad'));db[_0x73c7('0xae')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xaf'));db[_0x73c7('0xb0')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xb1'));db[_0x73c7('0xb2')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xb3'));db['DeskConfiguration']=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xb4'));db['DeskField']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xb5'));db['ZohoAccount']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xb6'));db['ZohoConfiguration']=db[_0x73c7('0x1')]['import'](_0x73c7('0xb7'));db[_0x73c7('0xb8')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xb9'));db[_0x73c7('0xba')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xbb'));db['ZendeskConfiguration']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xbc'));db[_0x73c7('0xbd')]=db['sequelize'][_0x73c7('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x73c7('0xbe')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x73c7('0xbf')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xc0'));db[_0x73c7('0xc1')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x73c7('0xc2')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xc3'));db['VtigerConfiguration']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xc4'));db[_0x73c7('0xc5')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xc6'));db[_0x73c7('0xc7')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xc8'));db[_0x73c7('0xc9')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x73c7('0xca')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xcb'));db[_0x73c7('0xcc')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xcd'));db['Dynamics365Configuration']=db[_0x73c7('0x1')]['import'](_0x73c7('0xce'));db[_0x73c7('0xcf')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xd0'));db[_0x73c7('0xd1')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xd2'));db['FreshsalesConfiguration']=db[_0x73c7('0x1')]['import'](_0x73c7('0xd3'));db['FreshsalesField']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xd4'));db[_0x73c7('0x9c')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xd5'));db[_0x73c7('0xd6')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xd7'));db[_0x73c7('0xd8')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x73c7('0xd9')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xda'));db[_0x73c7('0xdb')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xdc'));db[_0x73c7('0xdd')]=db[_0x73c7('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x73c7('0xde')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xdf'));db[_0x73c7('0xe0')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xe1'));db['SquareDetailsReport']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xe2'));db[_0x73c7('0xe3')]=db['sequelize'][_0x73c7('0x12')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x73c7('0x1')]['import'](_0x73c7('0xe4'));db[_0x73c7('0xe5')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xe6'));db[_0x73c7('0xe7')]=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xe8'));db[_0x73c7('0xe9')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xea'));db[_0x73c7('0xeb')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xec'));db[_0x73c7('0xed')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xee'));db['Campaign']=db[_0x73c7('0x1')][_0x73c7('0x12')]('../api/campaign/campaign.model');db[_0x73c7('0xef')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xf0'));db[_0x73c7('0xf1')]=db['sequelize']['import'](_0x73c7('0xf2'));db[_0x73c7('0xf3')]=db[_0x73c7('0x1')]['import']('../api/plugin/plugin.model');db[_0x73c7('0xf4')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xf5'));db[_0x73c7('0xf6')]=db[_0x73c7('0x1')]['import'](_0x73c7('0xf7'));db[_0x73c7('0xf8')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0xf9'));db[_0x73c7('0xfa')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xfb'));db[_0x73c7('0xfc')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xfd'));db[_0x73c7('0xfe')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0xff'));db[_0x73c7('0x100')]=db['sequelize']['import'](_0x73c7('0x101'));db[_0x73c7('0x102')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x103'));db['UserProfileSection']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x104'));db[_0x73c7('0x105')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x106'));db[_0x73c7('0x107')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x108'));db[_0x73c7('0x109')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x10a'));db[_0x73c7('0x10b')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x10c'));db[_0x73c7('0x10d')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x10e'));db['WhatsappMessage']=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x10f'));db[_0x73c7('0x110')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x111'));db[_0x73c7('0x112')]=db[_0x73c7('0x1')]['import'](_0x73c7('0x113'));db[_0x73c7('0x114')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x115'));db['CloudProvider']=db[_0x73c7('0x1')]['import'](_0x73c7('0x116'));db[_0x73c7('0x117')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x118'));db[_0x73c7('0x119')]=db[_0x73c7('0x1')][_0x73c7('0x12')](_0x73c7('0x11a'));db[_0x73c7('0x11b')]=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x11c'));db['UserSetting']=db['sequelize'][_0x73c7('0x12')](_0x73c7('0x11d'));db['User'][_0x73c7('0x11e')](db[_0x73c7('0x1d')],{'as':'VoiceMail','onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x11e')](db[_0x73c7('0x122')],{'as':_0x73c7('0x123'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x124')](db[_0x73c7('0x125')],{'as':'Recordings','foreignKey':_0x73c7('0x120')});db['User'][_0x73c7('0x124')](db[_0x73c7('0x2d')],{'as':_0x73c7('0x126'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x124')](db[_0x73c7('0x16')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x73c7('0x124')](db[_0x73c7('0x7b')],{'as':_0x73c7('0x127'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x124')](db[_0x73c7('0x128')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x73c7('0x121')][_0x73c7('0x124')](db[_0x73c7('0x7d')],{'as':_0x73c7('0x7d'),'foreignKey':'UserId'});db[_0x73c7('0x121')]['hasMany'](db[_0x73c7('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x124')](db[_0x73c7('0x6b')],{'as':_0x73c7('0x129'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x124')](db['SmsInteraction'],{'as':_0x73c7('0x12a'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x121')][_0x73c7('0x124')](db['FaxInteraction'],{'as':_0x73c7('0x12b'),'foreignKey':'UserId'});db[_0x73c7('0x121')][_0x73c7('0x124')](db[_0x73c7('0x44')],{'as':_0x73c7('0x12c'),'foreignKey':'UserId'});db[_0x73c7('0x121')][_0x73c7('0x124')](db['WhatsappInteraction'],{'as':_0x73c7('0x12d'),'foreignKey':_0x73c7('0x120')});db['User']['hasMany'](db[_0x73c7('0x107')],{'as':_0x73c7('0x12e'),'foreignKey':_0x73c7('0x12f')});db[_0x73c7('0x121')][_0x73c7('0x130')](db['UserProfile'],{'as':_0x73c7('0x102'),'foreignKey':_0x73c7('0x131')});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x71')],{'as':_0x73c7('0x133'),'through':_0x73c7('0x134')});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x75')],{'as':'Contacts','through':_0x73c7('0x135')});db[_0x73c7('0x121')][_0x73c7('0x132')](db['CmList'],{'as':_0x73c7('0x136'),'through':_0x73c7('0x137')});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0xeb')],{'through':_0x73c7('0x138')});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x44')],{'as':_0x73c7('0x12c'),'through':_0x73c7('0x139')});db[_0x73c7('0x121')][_0x73c7('0x132')](db['ChatInteraction'],{'as':_0x73c7('0x129'),'through':_0x73c7('0x13a')});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x50')],{'as':'FaxInteractions','through':_0x73c7('0x13b')});db['User'][_0x73c7('0x132')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x73c7('0x121')]['belongsToMany'](db[_0x73c7('0x61')],{'as':_0x73c7('0x13c'),'through':'user_has_openchannel_interactions'});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x10d')],{'as':_0x73c7('0x12d'),'through':_0x73c7('0x13d')});db[_0x73c7('0x121')]['belongsToMany'](db[_0x73c7('0x13e')],{'as':_0x73c7('0x13f'),'through':_0x73c7('0x140'),'required':![]});db['User'][_0x73c7('0x132')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x73c7('0x11b'),'required':![]});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x40')],{'as':_0x73c7('0x141'),'through':_0x73c7('0x32'),'required':![]});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x142')],{'as':'ChatQueues','through':_0x73c7('0x30'),'required':![],'hooks':!![]});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x143')],{'as':_0x73c7('0x144'),'through':_0x73c7('0x34'),'required':![]});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x5b')],{'as':_0x73c7('0x145'),'through':_0x73c7('0x36'),'required':![]});db[_0x73c7('0x121')][_0x73c7('0x132')](db['OpenchannelQueue'],{'as':_0x73c7('0x146'),'through':'UserOpenchannelQueue','required':![]});db[_0x73c7('0x121')][_0x73c7('0x132')](db[_0x73c7('0x114')],{'as':_0x73c7('0x147'),'through':_0x73c7('0x38'),'required':![]});db['User'][_0x73c7('0x132')](db['CmList'],{'through':_0x73c7('0x137')});db['User'][_0x73c7('0x132')](db[_0x73c7('0x148')],{'as':'ChatWebsites','through':_0x73c7('0x149')});db[_0x73c7('0x121')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':_0x73c7('0x14a')});db[_0x73c7('0x121')]['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0x73c7('0x14b')});db['User'][_0x73c7('0x132')](db[_0x73c7('0x5d')],{'as':_0x73c7('0x14c'),'through':'user_has_openchannel_accounts'});db[_0x73c7('0x121')]['belongsToMany'](db[_0x73c7('0x14d')],{'as':_0x73c7('0x14e'),'through':_0x73c7('0x14f')});db['User'][_0x73c7('0x132')](db[_0x73c7('0x109')],{'as':_0x73c7('0x150'),'through':_0x73c7('0x151')});db[_0x73c7('0x121')]['belongsToMany'](db['SquareProject'],{'as':_0x73c7('0x152'),'through':_0x73c7('0x153')});db['VoiceChanSpy'][_0x73c7('0x124')](db[_0x73c7('0x16')],{'as':_0x73c7('0x154'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x155')});db['VoiceContext'][_0x73c7('0x124')](db[_0x73c7('0x16')],{'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x16')][_0x73c7('0x124')](db[_0x73c7('0x16')],{'as':_0x73c7('0x156'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x18')][_0x73c7('0x132')](db[_0x73c7('0x8e')],{'as':_0x73c7('0x157'),'through':_0x73c7('0x158')});db[_0x73c7('0x13e')][_0x73c7('0x124')](db[_0x73c7('0x2d')],{'as':'Members','foreignKey':_0x73c7('0x159')});db[_0x73c7('0x13e')][_0x73c7('0x124')](db['CmHopper'],{'as':_0x73c7('0x15a'),'foreignKey':_0x73c7('0x159')});db[_0x73c7('0x13e')][_0x73c7('0x124')](db[_0x73c7('0x7b')],{'as':_0x73c7('0x127'),'foreignKey':_0x73c7('0x159')});db[_0x73c7('0x13e')][_0x73c7('0x124')](db[_0x73c7('0x128')],{'as':'HopperHistories','foreignKey':_0x73c7('0x159')});db[_0x73c7('0x13e')][_0x73c7('0x124')](db[_0x73c7('0x7d')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x73c7('0x13e')][_0x73c7('0x124')](db[_0x73c7('0x79')],{'as':_0x73c7('0x15b'),'foreignKey':_0x73c7('0x159')});db[_0x73c7('0x13e')][_0x73c7('0x124')](db[_0x73c7('0xdd')],{'as':_0x73c7('0x15c'),'foreignKey':'VoiceQueueId'});db[_0x73c7('0x13e')][_0x73c7('0x130')](db[_0x73c7('0x2b')],{'as':_0x73c7('0x2b'),'foreignKey':_0x73c7('0x15d')});db[_0x73c7('0x13e')][_0x73c7('0x130')](db[_0x73c7('0x2b')],{'as':_0x73c7('0x15e'),'foreignKey':_0x73c7('0x15f')});db[_0x73c7('0x13e')][_0x73c7('0x130')](db[_0x73c7('0x160')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x73c7('0x13e')][_0x73c7('0x130')](db[_0x73c7('0x89')],{'as':_0x73c7('0x161'),'foreignKey':_0x73c7('0x162')});db[_0x73c7('0x13e')][_0x73c7('0x132')](db['CmList'],{'as':'Lists','through':_0x73c7('0x163')});db[_0x73c7('0x13e')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':'Agents','through':_0x73c7('0x140')});db['VoiceQueue']['belongsToMany'](db[_0x73c7('0xeb')],{'as':'Teams','through':_0x73c7('0x117')});db[_0x73c7('0x13e')][_0x73c7('0x132')](db[_0x73c7('0xfe')],{'as':'BlackLists','through':_0x73c7('0x164')});db['VoiceRecording'][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x121'),'foreignKey':'UserId'});db[_0x73c7('0x1b')]['belongsTo'](db[_0x73c7('0x121')],{'as':_0x73c7('0x121'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x1d')]['hasMany'](db['VoiceMailMessage'],{'as':_0x73c7('0x165'),'onDelete':_0x73c7('0x11f'),'foreignKey':'mailboxuser','sourceKey':_0x73c7('0x166')});db['VoiceMailMessage'][_0x73c7('0x130')](db['VoiceMail'],{'foreignKey':_0x73c7('0x167'),'targetKey':_0x73c7('0x166')});db[_0x73c7('0x21')]['hasMany'](db[_0x73c7('0x27')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x73c7('0x21')]['hasMany'](db[_0x73c7('0x25')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x73c7('0x21')][_0x73c7('0x130')](db['User'],{'as':_0x73c7('0x121'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x21')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db['MailServerIn'][_0x73c7('0x130')](db[_0x73c7('0x3e')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x73c7('0x3a')][_0x73c7('0x130')](db[_0x73c7('0x16a')],{'as':_0x73c7('0x16a'),'foreignKey':_0x73c7('0x16b'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x3c')]['belongsTo'](db[_0x73c7('0x3e')],{'as':_0x73c7('0x3e'),'foreignKey':_0x73c7('0x16d')});db[_0x73c7('0x3c')]['belongsTo'](db[_0x73c7('0x16a')],{'as':_0x73c7('0x16a'),'foreignKey':'CloudProviderId','onDelete':_0x73c7('0x16c')});db[_0x73c7('0x3e')][_0x73c7('0x11e')](db[_0x73c7('0x3a')],{'as':_0x73c7('0x16e'),'onDelete':'cascade'});db['MailAccount']['hasOne'](db[_0x73c7('0x3c')],{'as':'Smtp','onDelete':'cascade'});db[_0x73c7('0x3e')][_0x73c7('0x124')](db[_0x73c7('0x16f')],{'as':_0x73c7('0x170'),'foreignKey':_0x73c7('0x16d'),'onDelete':_0x73c7('0x11f')});db['MailAccount'][_0x73c7('0x124')](db['CannedAnswer'],{'as':_0x73c7('0x171'),'foreignKey':_0x73c7('0x16d')});db[_0x73c7('0x3e')][_0x73c7('0x124')](db['MailMessage'],{'as':_0x73c7('0x165'),'foreignKey':'MailAccountId'});db[_0x73c7('0x3e')][_0x73c7('0x124')](db[_0x73c7('0x44')],{'as':'Interactions'});db[_0x73c7('0x3e')][_0x73c7('0x124')](db['MailApplication'],{'as':_0x73c7('0x156')});db[_0x73c7('0x3e')]['belongsTo'](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173')});db[_0x73c7('0x3e')][_0x73c7('0x130')](db[_0x73c7('0x96')],{'as':_0x73c7('0x96'),'foreignKey':'TemplateId'});db['MailAccount'][_0x73c7('0x130')](db[_0x73c7('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x73c7('0x162')});db['MailAccount'][_0x73c7('0x132')](db['User'],{'as':_0x73c7('0x174'),'through':_0x73c7('0x14b')});db[_0x73c7('0x40')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':'Agents','through':_0x73c7('0x32')});db[_0x73c7('0x40')][_0x73c7('0x132')](db['Team'],{'through':_0x73c7('0x175'),'as':_0x73c7('0x176')});db[_0x73c7('0x44')]['hasMany'](db[_0x73c7('0x45')],{'as':_0x73c7('0x165'),'onDelete':_0x73c7('0x11f'),'foreignKey':'MailInteractionId'});db[_0x73c7('0x44')][_0x73c7('0x130')](db[_0x73c7('0x3e')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x16d')});db[_0x73c7('0x44')][_0x73c7('0x130')](db['CmContact'],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x44')]['belongsTo'](db[_0x73c7('0x121')],{'as':_0x73c7('0x178'),'foreignKey':_0x73c7('0x120')});db['MailInteraction'][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x179'),'as':_0x73c7('0x17a')});db['MailInteraction'][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x179'),'as':_0x73c7('0x17b')});db[_0x73c7('0x44')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x17c'),'through':'user_has_mail_interactions','foreignKey':_0x73c7('0x17d')});db[_0x73c7('0x45')][_0x73c7('0x124')](db[_0x73c7('0xf1')],{'as':_0x73c7('0x17e'),'onDelete':_0x73c7('0x11f')});db['MailMessage']['belongsTo'](db['User'],{'as':'User'});db[_0x73c7('0x45')]['belongsTo'](db[_0x73c7('0x75')],{'onDelete':'cascade','as':_0x73c7('0x168')});db[_0x73c7('0x45')]['belongsTo'](db[_0x73c7('0x44')],{'as':_0x73c7('0x17f'),'foreignKey':'MailInteractionId'});db[_0x73c7('0x45')][_0x73c7('0x130')](db[_0x73c7('0x3e')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x16d')});db[_0x73c7('0x45')]['belongsTo'](db['ChatWebsite'],{'as':_0x73c7('0x148'),'foreignKey':'ChatWebsiteId'});db[_0x73c7('0x45')]['belongsTo'](db[_0x73c7('0x180')],{'as':_0x73c7('0x180'),'foreignKey':_0x73c7('0x181')});db[_0x73c7('0x47')]['belongsTo'](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x47')][_0x73c7('0x130')](db[_0x73c7('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0x73c7('0x130')](db[_0x73c7('0x3e')],{'onDelete':'restrict'});db[_0x73c7('0x47')][_0x73c7('0x130')](db[_0x73c7('0x160')],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x182')});db[_0x73c7('0x47')][_0x73c7('0x130')](db[_0x73c7('0x90')],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x183')});db[_0x73c7('0x49')][_0x73c7('0x130')](db[_0x73c7('0x3e')],{});db[_0x73c7('0x49')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':'List','foreignKey':_0x73c7('0x173')});db[_0x73c7('0x49')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db['MailQueueReport'][_0x73c7('0x130')](db[_0x73c7('0x44')],{});db[_0x73c7('0x49')]['belongsTo'](db[_0x73c7('0x45')],{});db[_0x73c7('0x49')]['belongsTo'](db[_0x73c7('0x121')],{});db['MailQueueReport']['belongsTo'](db[_0x73c7('0x40')],{});db[_0x73c7('0x184')]['hasMany'](db['DashboardItem'],{'as':_0x73c7('0x185'),'onDelete':_0x73c7('0x11f')});db['FaxAccount'][_0x73c7('0x124')](db['Disposition'],{'as':_0x73c7('0x170'),'foreignKey':'FaxAccountId','onDelete':_0x73c7('0x11f')});db['FaxAccount']['hasMany'](db[_0x73c7('0x84')],{'as':_0x73c7('0x171'),'foreignKey':_0x73c7('0x186')});db['FaxAccount']['hasMany'](db[_0x73c7('0x50')],{'as':'Interactions'});db[_0x73c7('0x4c')]['hasMany'](db[_0x73c7('0x4e')],{'as':_0x73c7('0x156')});db['FaxAccount'][_0x73c7('0x124')](db[_0x73c7('0x16')],{'as':_0x73c7('0x187'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x4c')][_0x73c7('0x124')](db[_0x73c7('0x188')],{'as':_0x73c7('0x165')});db[_0x73c7('0x4c')]['belongsTo'](db[_0x73c7('0x2b')],{'as':_0x73c7('0x2b')});db[_0x73c7('0x4c')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':'List','foreignKey':_0x73c7('0x173')});db[_0x73c7('0x4c')][_0x73c7('0x130')](db[_0x73c7('0x89')],{'as':_0x73c7('0x161'),'foreignKey':_0x73c7('0x162')});db[_0x73c7('0x4c')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':'user_has_fax_accounts'});db[_0x73c7('0x4e')]['belongsTo'](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x16c')});db['FaxApplication'][_0x73c7('0x130')](db[_0x73c7('0x143')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x4e')][_0x73c7('0x130')](db[_0x73c7('0x4c')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x4e')][_0x73c7('0x130')](db[_0x73c7('0x90')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x73c7('0x50')]['hasMany'](db['FaxMessage'],{'as':_0x73c7('0x165'),'onDelete':'cascade','foreignKey':_0x73c7('0x189')});db[_0x73c7('0x50')]['belongsTo'](db['FaxAccount'],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x186')});db[_0x73c7('0x50')][_0x73c7('0x130')](db['CmContact'],{'as':_0x73c7('0x168'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x73c7('0x130')](db['User'],{'as':_0x73c7('0x178'),'foreignKey':_0x73c7('0x120')});db['FaxInteraction'][_0x73c7('0x132')](db['Tag'],{'through':_0x73c7('0x18a'),'as':_0x73c7('0x17a')});db[_0x73c7('0x50')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x73c7('0x17b')});db[_0x73c7('0x50')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x17c'),'through':_0x73c7('0x13b'),'foreignKey':_0x73c7('0x189')});db['FaxMessage']['belongsTo'](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x121')});db['FaxMessage'][_0x73c7('0x130')](db[_0x73c7('0x50')],{'as':_0x73c7('0x17f'),'foreignKey':_0x73c7('0x189')});db[_0x73c7('0x188')]['belongsTo'](db[_0x73c7('0x75')],{'onDelete':_0x73c7('0x11f'),'as':'Contact'});db['FaxMessage'][_0x73c7('0x130')](db[_0x73c7('0xf1')],{'as':_0x73c7('0xf1'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x73c7('0x130')](db['FaxAccount'],{'as':'Account','foreignKey':_0x73c7('0x186')});db['FaxQueue']['belongsToMany'](db[_0x73c7('0x121')],{'as':'Agents','through':_0x73c7('0x34')});db[_0x73c7('0x143')]['belongsToMany'](db[_0x73c7('0xeb')],{'through':_0x73c7('0x18b'),'as':_0x73c7('0x176')});db[_0x73c7('0x54')][_0x73c7('0x130')](db[_0x73c7('0x4c')],{});db[_0x73c7('0x54')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173')});db[_0x73c7('0x54')]['belongsTo'](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x54')][_0x73c7('0x130')](db['FaxInteraction'],{});db[_0x73c7('0x54')][_0x73c7('0x130')](db['FaxMessage'],{});db[_0x73c7('0x54')][_0x73c7('0x130')](db['User'],{});db['FaxQueueReport'][_0x73c7('0x130')](db[_0x73c7('0x143')],{});db[_0x73c7('0x14d')][_0x73c7('0x124')](db['Disposition'],{'as':_0x73c7('0x170'),'foreignKey':_0x73c7('0x18c'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x14d')][_0x73c7('0x124')](db[_0x73c7('0x84')],{'as':_0x73c7('0x171'),'foreignKey':_0x73c7('0x18c')});db[_0x73c7('0x14d')][_0x73c7('0x124')](db['SmsMessage'],{'as':_0x73c7('0x165'),'foreignKey':_0x73c7('0x18c')});db[_0x73c7('0x14d')][_0x73c7('0x124')](db['SmsInteraction'],{'as':_0x73c7('0x18d')});db[_0x73c7('0x14d')]['hasMany'](db[_0x73c7('0x57')],{'as':'Applications'});db[_0x73c7('0x14d')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':'List','foreignKey':_0x73c7('0x173')});db[_0x73c7('0x14d')][_0x73c7('0x130')](db[_0x73c7('0x89')],{'as':_0x73c7('0x161'),'foreignKey':_0x73c7('0x162')});db[_0x73c7('0x14d')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':_0x73c7('0x14f')});db['SmsApplication'][_0x73c7('0x130')](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x57')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x73c7('0x16c')});db['SmsApplication'][_0x73c7('0x130')](db[_0x73c7('0x14d')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x57')][_0x73c7('0x130')](db[_0x73c7('0x160')],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x182')});db[_0x73c7('0x57')][_0x73c7('0x130')](db['Tag'],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x183')});db[_0x73c7('0x18e')][_0x73c7('0x124')](db[_0x73c7('0x18f')],{'as':_0x73c7('0x165'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x190')});db['SmsInteraction'][_0x73c7('0x130')](db[_0x73c7('0x14d')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x18c')});db[_0x73c7('0x18e')][_0x73c7('0x130')](db['CmContact'],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x18e')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x178'),'foreignKey':_0x73c7('0x120')});db['SmsInteraction'][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x191'),'as':_0x73c7('0x17a')});db[_0x73c7('0x18e')]['belongsToMany'](db['Tag'],{'through':_0x73c7('0x191'),'as':_0x73c7('0x17b')});db[_0x73c7('0x18e')][_0x73c7('0x132')](db['User'],{'as':_0x73c7('0x17c'),'through':'user_has_sms_interactions','foreignKey':_0x73c7('0x190')});db[_0x73c7('0x18f')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':'User'});db[_0x73c7('0x18f')][_0x73c7('0x130')](db['CmContact'],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x168')});db[_0x73c7('0x18f')][_0x73c7('0x130')](db[_0x73c7('0x18e')],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x17f'),'foreignKey':_0x73c7('0x190')});db[_0x73c7('0x18f')][_0x73c7('0x130')](db[_0x73c7('0x14d')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x18c')});db[_0x73c7('0x5b')]['belongsToMany'](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':'UserSmsQueue','foreignKey':_0x73c7('0x192')});db['SmsQueue']['belongsToMany'](db[_0x73c7('0xeb')],{'through':_0x73c7('0x193'),'as':_0x73c7('0x176')});db[_0x73c7('0x5d')][_0x73c7('0x124')](db[_0x73c7('0x16f')],{'as':_0x73c7('0x170'),'foreignKey':_0x73c7('0x194'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x5d')][_0x73c7('0x124')](db[_0x73c7('0x84')],{'as':_0x73c7('0x171'),'foreignKey':_0x73c7('0x194')});db['OpenchannelAccount'][_0x73c7('0x124')](db[_0x73c7('0x61')],{'as':_0x73c7('0x18d'),'foreignKey':_0x73c7('0x194')});db['OpenchannelAccount'][_0x73c7('0x124')](db[_0x73c7('0x63')],{'as':_0x73c7('0x165'),'foreignKey':_0x73c7('0x194')});db['OpenchannelAccount'][_0x73c7('0x124')](db[_0x73c7('0x5f')],{'as':'Applications','foreignKey':_0x73c7('0x194')});db[_0x73c7('0x5d')]['belongsTo'](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173')});db[_0x73c7('0x5d')][_0x73c7('0x130')](db[_0x73c7('0x89')],{'as':_0x73c7('0x161'),'foreignKey':_0x73c7('0x162')});db[_0x73c7('0x5d')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication']['belongsTo'](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x5f')]['belongsTo'](db[_0x73c7('0x65')],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x195')});db[_0x73c7('0x5f')][_0x73c7('0x130')](db[_0x73c7('0x5d')],{'onDelete':_0x73c7('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x73c7('0x5f')][_0x73c7('0x130')](db['Interval'],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x182')});db[_0x73c7('0x5f')][_0x73c7('0x130')](db[_0x73c7('0x90')],{'onDelete':_0x73c7('0x16c'),'foreignKey':'TagId'});db[_0x73c7('0x61')]['hasMany'](db['OpenchannelMessage'],{'as':_0x73c7('0x165'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x196')});db[_0x73c7('0x61')][_0x73c7('0x130')](db[_0x73c7('0x5d')],{'as':_0x73c7('0x177'),'foreignKey':'OpenchannelAccountId'});db[_0x73c7('0x61')][_0x73c7('0x130')](db['CmContact'],{'as':_0x73c7('0x168'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x178'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x61')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x197'),'as':'Tags'});db[_0x73c7('0x61')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x197'),'as':_0x73c7('0x17b')});db[_0x73c7('0x61')][_0x73c7('0x132')](db['User'],{'as':_0x73c7('0x17c'),'through':_0x73c7('0x198'),'foreignKey':_0x73c7('0x196')});db[_0x73c7('0x63')]['belongsTo'](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x121')});db[_0x73c7('0x63')]['belongsTo'](db[_0x73c7('0x75')],{'onDelete':'cascade','as':_0x73c7('0x168')});db[_0x73c7('0x63')][_0x73c7('0x130')](db['OpenchannelInteraction'],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x17f'),'foreignKey':'OpenchannelInteractionId'});db[_0x73c7('0x63')][_0x73c7('0x130')](db['Attachment'],{'as':_0x73c7('0xf1'),'foreignKey':_0x73c7('0x199')});db['OpenchannelMessage'][_0x73c7('0x130')](db[_0x73c7('0x5d')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x194')});db[_0x73c7('0x65')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':_0x73c7('0x19a'),'foreignKey':'OpenchannelQueueId'});db[_0x73c7('0x65')][_0x73c7('0x132')](db[_0x73c7('0xeb')],{'through':_0x73c7('0x19b'),'as':'Teams'});db[_0x73c7('0x148')][_0x73c7('0x124')](db[_0x73c7('0x16f')],{'as':_0x73c7('0x170'),'foreignKey':_0x73c7('0x19c'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x148')][_0x73c7('0x124')](db[_0x73c7('0x84')],{'as':_0x73c7('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x73c7('0x148')]['hasMany'](db[_0x73c7('0x72')],{'as':_0x73c7('0x19d')});db[_0x73c7('0x148')][_0x73c7('0x124')](db[_0x73c7('0x6b')],{'as':'Interactions'});db[_0x73c7('0x148')][_0x73c7('0x124')](db['ChatApplication'],{'as':'Applications'});db['ChatWebsite'][_0x73c7('0x124')](db[_0x73c7('0x6d')],{'as':'Messages'});db[_0x73c7('0x148')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173')});db[_0x73c7('0x148')][_0x73c7('0x130')](db[_0x73c7('0x160')],{'as':_0x73c7('0x160'),'foreignKey':_0x73c7('0x182')});db[_0x73c7('0x148')][_0x73c7('0x130')](db['MailAccount'],{'as':_0x73c7('0x3e'),'foreignKey':_0x73c7('0x16d')});db[_0x73c7('0x148')]['belongsTo'](db[_0x73c7('0x89')],{'as':_0x73c7('0x161'),'foreignKey':_0x73c7('0x162')});db[_0x73c7('0x148')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':'Agents','through':_0x73c7('0x149')});db[_0x73c7('0x68')][_0x73c7('0x130')](db[_0x73c7('0x5d')],{});db[_0x73c7('0x68')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':'ListId'});db[_0x73c7('0x68')]['belongsTo'](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x68')][_0x73c7('0x130')](db['OpenchannelInteraction'],{});db[_0x73c7('0x68')][_0x73c7('0x130')](db[_0x73c7('0x63')],{});db[_0x73c7('0x68')][_0x73c7('0x130')](db[_0x73c7('0x121')],{});db[_0x73c7('0x68')]['belongsTo'](db[_0x73c7('0x65')],{});db[_0x73c7('0x69')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x19e'),'foreignKey':_0x73c7('0x120'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x69')][_0x73c7('0x130')](db[_0x73c7('0x142')],{'as':_0x73c7('0x19f'),'foreignKey':'ChatQueueId','onDelete':_0x73c7('0x16c')});db[_0x73c7('0x69')][_0x73c7('0x130')](db[_0x73c7('0x148')],{'as':'Website','foreignKey':_0x73c7('0x19c'),'onDelete':_0x73c7('0x16c')});db['ChatApplication']['belongsTo'](db[_0x73c7('0x90')],{'onDelete':_0x73c7('0x16c'),'foreignKey':'TagId'});db[_0x73c7('0x6b')][_0x73c7('0x124')](db[_0x73c7('0x6d')],{'as':'Messages','onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1a0')});db[_0x73c7('0x6b')][_0x73c7('0x130')](db[_0x73c7('0x148')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x19c')});db[_0x73c7('0x6b')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x6b')]['belongsTo'](db['User'],{'as':_0x73c7('0x178'),'foreignKey':'UserId'});db['ChatInteraction'][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x1a1'),'as':_0x73c7('0x17a')});db[_0x73c7('0x6b')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':'chat_interaction_has_tags','as':_0x73c7('0x17b')});db[_0x73c7('0x6b')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':'Users','through':_0x73c7('0x13a'),'foreignKey':_0x73c7('0x1a0')});db[_0x73c7('0x6d')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x121')});db[_0x73c7('0x6d')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'onDelete':'cascade','as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db['ChatMessage']['belongsTo'](db[_0x73c7('0x6b')],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x17f'),'foreignKey':'ChatInteractionId'});db[_0x73c7('0x6d')]['belongsTo'](db[_0x73c7('0xf1')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x73c7('0x6d')][_0x73c7('0x130')](db[_0x73c7('0x148')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x19c')});db[_0x73c7('0x180')][_0x73c7('0x124')](db[_0x73c7('0xf1')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x73c7('0x11f'),'hooks':!![]});db[_0x73c7('0x180')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'onDelete':_0x73c7('0x11f'),'as':'Contact','foreignKey':_0x73c7('0x169')});db['ChatOfflineMessage']['belongsTo'](db[_0x73c7('0x148')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x19c')});db[_0x73c7('0x142')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0x73c7('0x1a2'),'as':_0x73c7('0x176')});db[_0x73c7('0x71')]['hasMany'](db['ChatInternalMessage'],{'as':_0x73c7('0x165'),'foreignKey':'ChatGroupId','onDelete':_0x73c7('0x11f')});db[_0x73c7('0x71')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':'Members','through':_0x73c7('0x134')});db['ChatProactiveAction'][_0x73c7('0x130')](db[_0x73c7('0x148')],{'as':_0x73c7('0x1a3'),'foreignKey':_0x73c7('0x19c')});db[_0x73c7('0x74')][_0x73c7('0x124')](db['CmContact'],{'as':_0x73c7('0x1a4'),'foreignKey':'CompanyId'});db[_0x73c7('0x75')][_0x73c7('0x124')](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db[_0x73c7('0x75')][_0x73c7('0x124')](db[_0x73c7('0x77')],{'as':'Hoppers','foreignKey':_0x73c7('0x169')});db[_0x73c7('0x75')][_0x73c7('0x124')](db['CmHopperFinal'],{'as':_0x73c7('0x127'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x75')][_0x73c7('0x124')](db[_0x73c7('0x128')],{'as':'HopperHistories','foreignKey':_0x73c7('0x169')});db[_0x73c7('0x75')][_0x73c7('0x124')](db['ReportAgentPreview'],{'as':_0x73c7('0x7d'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0x75')][_0x73c7('0x124')](db[_0x73c7('0xdd')],{'as':_0x73c7('0x15c'),'foreignKey':'ContactId'});db['CmContact'][_0x73c7('0x124')](db[_0x73c7('0x61')],{'as':_0x73c7('0x13c'),'foreignKey':_0x73c7('0x169'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x75')][_0x73c7('0x124')](db[_0x73c7('0x6b')],{'as':_0x73c7('0x129'),'foreignKey':_0x73c7('0x169'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x75')][_0x73c7('0x124')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x73c7('0x169'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x75')][_0x73c7('0x124')](db[_0x73c7('0x50')],{'as':_0x73c7('0x12b'),'foreignKey':_0x73c7('0x169'),'onDelete':'restrict'});db[_0x73c7('0x75')]['hasMany'](db[_0x73c7('0x44')],{'as':_0x73c7('0x12c'),'foreignKey':_0x73c7('0x169'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x75')][_0x73c7('0x130')](db[_0x73c7('0x74')],{'as':_0x73c7('0x1a5'),'foreignKey':'CompanyId'});db[_0x73c7('0x75')][_0x73c7('0x130')](db['CmList'],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173'),'onDelete':_0x73c7('0x11f')});db['CmContact'][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x17c'),'through':'cm_user_has_contacts'});db[_0x73c7('0x75')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'as':'Tags','through':_0x73c7('0x1a6')});db['CmContact']['belongsToMany'](db[_0x73c7('0x90')],{'through':_0x73c7('0x1a6'),'as':_0x73c7('0x17b')});db[_0x73c7('0x77')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x73c7('0x1a7')});db[_0x73c7('0x77')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169'),'onDelete':'cascade'});db[_0x73c7('0x77')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':'List','foreignKey':_0x73c7('0x173'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x77')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x19e'),'foreignKey':_0x73c7('0x120')});db[_0x73c7('0x77')]['belongsTo'](db[_0x73c7('0x13e')],{'as':_0x73c7('0x19f'),'foreignKey':_0x73c7('0x159'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x77')][_0x73c7('0x130')](db[_0x73c7('0x1a8')],{'as':_0x73c7('0x1a8'),'foreignKey':'CampaignId','onDelete':_0x73c7('0x11f')});db[_0x73c7('0x77')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x178'),'foreignKey':'OwnerId'});db[_0x73c7('0x79')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':'Contact','foreignKey':_0x73c7('0x169'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x79')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x79')]['belongsTo'](db[_0x73c7('0x13e')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x73c7('0x79')][_0x73c7('0x130')](db[_0x73c7('0x1a8')],{'as':_0x73c7('0x1a8'),'foreignKey':'CampaignId','onDelete':_0x73c7('0x11f')});db[_0x73c7('0x83')][_0x73c7('0x124')](db[_0x73c7('0x87')],{'as':{'plural':'All','singular':_0x73c7('0x1a9')},'foreignKey':_0x73c7('0x1aa'),'onDelete':_0x73c7('0x11f'),'hooks':!![]});db[_0x73c7('0x83')][_0x73c7('0x124')](db[_0x73c7('0x87')],{'as':{'plural':_0x73c7('0x1ab'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x73c7('0x11f'),'hooks':!![]});db[_0x73c7('0x83')][_0x73c7('0x124')](db[_0x73c7('0x81')],{'as':'Actions','foreignKey':_0x73c7('0x1ac'),'onDelete':_0x73c7('0x11f'),'hooks':!![]});db[_0x73c7('0x16f')][_0x73c7('0x124')](db[_0x73c7('0x16f')],{'as':_0x73c7('0x170'),'foreignKey':_0x73c7('0x1ad'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x160')][_0x73c7('0x124')](db[_0x73c7('0x160')],{'as':_0x73c7('0x1ae'),'foreignKey':'IntervalId','onDelete':_0x73c7('0x11f'),'hooks':!![],'required':![]});db[_0x73c7('0x160')][_0x73c7('0x124')](db[_0x73c7('0x16')],{'as':'Extensions','foreignKey':_0x73c7('0x182'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x160')][_0x73c7('0x124')](db[_0x73c7('0x47')],{'as':_0x73c7('0x1af'),'foreignKey':'IntervalId'});db[_0x73c7('0x160')][_0x73c7('0x124')](db[_0x73c7('0x69')],{'as':_0x73c7('0x1b0'),'foreignKey':_0x73c7('0x182')});db[_0x73c7('0x160')]['hasMany'](db[_0x73c7('0x4e')],{'as':_0x73c7('0x1b1'),'foreignKey':_0x73c7('0x182')});db[_0x73c7('0x160')][_0x73c7('0x124')](db[_0x73c7('0x57')],{'as':'SmsApplications','foreignKey':_0x73c7('0x182')});db['Schedule']['belongsTo'](db[_0x73c7('0x3e')],{});db[_0x73c7('0x1b2')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x73c7('0x1b3')});db[_0x73c7('0x8e')][_0x73c7('0x132')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x73c7('0x158'),'onDelete':'restrict'});db[_0x73c7('0x90')][_0x73c7('0x132')](db[_0x73c7('0x75')],{'through':_0x73c7('0x1a6')});db[_0x73c7('0x90')]['belongsToMany'](db['ChatInteraction'],{'through':_0x73c7('0x1a1')});db[_0x73c7('0x90')][_0x73c7('0x132')](db[_0x73c7('0x44')],{'through':_0x73c7('0x179')});db[_0x73c7('0x90')][_0x73c7('0x132')](db[_0x73c7('0x18e')],{'through':_0x73c7('0x191')});db[_0x73c7('0x90')][_0x73c7('0x132')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x73c7('0x90')][_0x73c7('0x132')](db[_0x73c7('0x61')],{'through':_0x73c7('0x197')});db[_0x73c7('0x90')][_0x73c7('0x132')](db[_0x73c7('0x10d')],{'through':'whatsapp_interaction_has_tags'});db[_0x73c7('0x94')]['belongsTo'](db[_0x73c7('0x92')],{'as':_0x73c7('0x1b4'),'foreignKey':_0x73c7('0x1b5')});db[_0x73c7('0x95')][_0x73c7('0x130')](db[_0x73c7('0x77')],{'as':'Hopper','foreignKey':_0x73c7('0x1a7')});db['CmContactHasItem'][_0x73c7('0x130')](db['CmContact'],{'as':_0x73c7('0x168'),'foreignKey':'CmContactId'});db[_0x73c7('0x98')][_0x73c7('0x124')](db['Condition'],{'as':{'plural':_0x73c7('0x1b6'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x73c7('0x11f'),'hooks':!![]});db[_0x73c7('0x98')]['hasMany'](db[_0x73c7('0x87')],{'as':{'plural':_0x73c7('0x1b7'),'singular':_0x73c7('0x1b8')},'foreignKey':_0x73c7('0x1b9'),'onDelete':_0x73c7('0x11f'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0x73c7('0x1ba'),'foreignKey':_0x73c7('0x1bb'),'onDelete':_0x73c7('0x11f'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x73c7('0x1bc'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1b3'),'hooks':!![]});db[_0x73c7('0xa1')][_0x73c7('0x124')](db[_0x73c7('0xa6')],{'as':_0x73c7('0x1bc'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1bd')});db[_0x73c7('0xa4')][_0x73c7('0x124')](db[_0x73c7('0xa6')],{'as':_0x73c7('0x1bc'),'onDelete':'cascade','foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x73c7('0x130')](db[_0x73c7('0xa4')],{'foreignKey':_0x73c7('0x1be')});db[_0x73c7('0x1bf')]['hasMany'](db[_0x73c7('0x1c0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1c0')]['hasMany'](db[_0x73c7('0x1c2')],{'as':_0x73c7('0x1c3'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0x1c0')][_0x73c7('0x124')](db[_0x73c7('0x1c2')],{'as':_0x73c7('0x1c5'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c6')});db['SalesforceConfiguration'][_0x73c7('0x124')](db['SalesforceField'],{'as':'Fields','onDelete':_0x73c7('0x11f'),'foreignKey':'FieldId'});db[_0x73c7('0x1c0')]['belongsTo'](db[_0x73c7('0x1bf')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1c2')][_0x73c7('0x124')](db[_0x73c7('0x1c2')],{'as':_0x73c7('0x1c7'),'foreignKey':'SubjectId'});db[_0x73c7('0x1c2')][_0x73c7('0x124')](db[_0x73c7('0x1c2')],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0x1c2')][_0x73c7('0x124')](db[_0x73c7('0x1c2')],{'as':_0x73c7('0x1c9'),'foreignKey':_0x73c7('0x1ca')});db['SalesforceField'][_0x73c7('0x130')](db[_0x73c7('0x9a')],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0xac')]['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0xae')]['hasMany'](db['SugarcrmField'],{'as':_0x73c7('0x1c3'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c4')});db['SugarcrmConfiguration'][_0x73c7('0x124')](db[_0x73c7('0xb0')],{'as':_0x73c7('0x1c5'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0xae')][_0x73c7('0x124')](db[_0x73c7('0xb0')],{'as':_0x73c7('0x1bc'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1ca')});db['SugarcrmConfiguration'][_0x73c7('0x130')](db[_0x73c7('0xac')],{'as':_0x73c7('0x177'),'foreignKey':'AccountId'});db[_0x73c7('0xb0')]['hasMany'](db[_0x73c7('0xb0')],{'as':'Subject','foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0xb0')]['hasMany'](db[_0x73c7('0xb0')],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db['SugarcrmField'][_0x73c7('0x124')](db['SugarcrmField'],{'as':_0x73c7('0x1c9'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x73c7('0x130')](db['Variable'],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db['DeskAccount']['hasMany'](db[_0x73c7('0x1cc')],{'as':_0x73c7('0x1cd'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1cc')][_0x73c7('0x124')](db[_0x73c7('0x1ce')],{'as':_0x73c7('0x1c3'),'onDelete':_0x73c7('0x11f'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x73c7('0x124')](db[_0x73c7('0x1ce')],{'as':_0x73c7('0x1c5'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c6')});db['DeskConfiguration'][_0x73c7('0x124')](db[_0x73c7('0x1ce')],{'as':_0x73c7('0x1bc'),'onDelete':'cascade','foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0x1cc')][_0x73c7('0x130')](db[_0x73c7('0xb2')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1cc')]['belongsToMany'](db['Tag'],{'through':_0x73c7('0x1cf')});db[_0x73c7('0x1ce')]['hasMany'](db[_0x73c7('0x1ce')],{'as':_0x73c7('0x1c7'),'foreignKey':_0x73c7('0x1c4')});db['DeskField'][_0x73c7('0x124')](db[_0x73c7('0x1ce')],{'as':_0x73c7('0x1c8'),'foreignKey':'DescriptionId'});db['DeskField'][_0x73c7('0x124')](db[_0x73c7('0x1ce')],{'as':_0x73c7('0x1c9'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0x1ce')][_0x73c7('0x130')](db['Variable'],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0x1d0')][_0x73c7('0x124')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0x73c7('0x11f'),'foreignKey':'AccountId'});db[_0x73c7('0x1d1')][_0x73c7('0x124')](db['ZohoField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0x1d1')][_0x73c7('0x124')](db[_0x73c7('0xb8')],{'as':_0x73c7('0x1c5'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0x1d1')][_0x73c7('0x124')](db[_0x73c7('0xb8')],{'as':_0x73c7('0x1bc'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0x1d1')][_0x73c7('0x130')](db[_0x73c7('0x1d0')],{'as':'Account','foreignKey':'AccountId'});db[_0x73c7('0xb8')][_0x73c7('0x124')](db[_0x73c7('0xb8')],{'as':_0x73c7('0x1c7'),'foreignKey':'SubjectId'});db[_0x73c7('0xb8')]['hasMany'](db[_0x73c7('0xb8')],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0xb8')][_0x73c7('0x124')](db['ZohoField'],{'as':'Field','foreignKey':'FieldId'});db[_0x73c7('0xb8')][_0x73c7('0x130')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x73c7('0xba')][_0x73c7('0x124')](db[_0x73c7('0x1d2')],{'as':_0x73c7('0x1cd'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1d2')][_0x73c7('0x124')](db[_0x73c7('0xbd')],{'as':'Subjects','foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0x1d2')][_0x73c7('0x124')](db['ZendeskField'],{'as':_0x73c7('0x1c5'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0x1d2')][_0x73c7('0x124')](db[_0x73c7('0xbd')],{'as':_0x73c7('0x1bc'),'foreignKey':_0x73c7('0x1ca')});db['ZendeskConfiguration'][_0x73c7('0x130')](db[_0x73c7('0xba')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1d2')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x1d3')});db[_0x73c7('0xbd')][_0x73c7('0x124')](db[_0x73c7('0xbd')],{'as':_0x73c7('0x1c7'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x73c7('0x124')](db[_0x73c7('0xbd')],{'as':_0x73c7('0x1c8'),'foreignKey':'DescriptionId'});db[_0x73c7('0xbd')][_0x73c7('0x124')](db[_0x73c7('0xbd')],{'as':_0x73c7('0x1c9'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0xbd')]['belongsTo'](db[_0x73c7('0x9a')],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0xbe')][_0x73c7('0x124')](db['FreshdeskConfiguration'],{'as':_0x73c7('0x1cd'),'onDelete':'cascade','foreignKey':_0x73c7('0x1c1')});db['FreshdeskConfiguration'][_0x73c7('0x124')](db['FreshdeskField'],{'as':_0x73c7('0x1c3'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0xbf')][_0x73c7('0x124')](db[_0x73c7('0xc1')],{'as':_0x73c7('0x1c5'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c6')});db['FreshdeskConfiguration'][_0x73c7('0x124')](db[_0x73c7('0xc1')],{'as':'Fields','onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1ca')});db['FreshdeskConfiguration'][_0x73c7('0x130')](db[_0x73c7('0xbe')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0xbf')][_0x73c7('0x132')](db['Tag'],{'through':_0x73c7('0x1d4')});db['FreshdeskField'][_0x73c7('0x124')](db[_0x73c7('0xc1')],{'as':_0x73c7('0x1c7'),'foreignKey':_0x73c7('0x1c4')});db['FreshdeskField'][_0x73c7('0x124')](db[_0x73c7('0xc1')],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0xc1')][_0x73c7('0x124')](db[_0x73c7('0xc1')],{'as':_0x73c7('0x1c9'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0xc1')][_0x73c7('0x130')](db[_0x73c7('0x9a')],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0xc2')][_0x73c7('0x124')](db[_0x73c7('0x1d5')],{'as':_0x73c7('0x1cd'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1d5')][_0x73c7('0x124')](db[_0x73c7('0xc5')],{'as':_0x73c7('0x1c3'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0x1d5')]['hasMany'](db['VtigerField'],{'as':_0x73c7('0x1c5'),'foreignKey':'DescriptionId'});db[_0x73c7('0x1d5')][_0x73c7('0x124')](db['VtigerField'],{'as':_0x73c7('0x1bc'),'foreignKey':_0x73c7('0x1ca')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0xc5')][_0x73c7('0x124')](db[_0x73c7('0xc5')],{'as':_0x73c7('0x1c7'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0xc5')][_0x73c7('0x124')](db['VtigerField'],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0xc5')][_0x73c7('0x124')](db[_0x73c7('0xc5')],{'as':_0x73c7('0x1c9'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0xc5')][_0x73c7('0x130')](db['Variable'],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0xc7')][_0x73c7('0x124')](db[_0x73c7('0xc9')],{'as':_0x73c7('0x1cd'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0xc9')][_0x73c7('0x124')](db[_0x73c7('0xca')],{'as':_0x73c7('0x1c3'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0xc9')][_0x73c7('0x124')](db['ServicenowField'],{'as':_0x73c7('0x1c5'),'foreignKey':_0x73c7('0x1c6')});db['ServicenowConfiguration'][_0x73c7('0x124')](db[_0x73c7('0xca')],{'as':'Fields','foreignKey':'FieldId'});db[_0x73c7('0xc9')]['belongsTo'](db[_0x73c7('0xc7')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x73c7('0x124')](db[_0x73c7('0xca')],{'as':_0x73c7('0x1c7'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0xca')][_0x73c7('0x124')](db[_0x73c7('0xca')],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0xca')][_0x73c7('0x124')](db['ServicenowField'],{'as':'Field','foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0xca')][_0x73c7('0x130')](db[_0x73c7('0x9a')],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0xcc')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x73c7('0x1cd'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0xcc')][_0x73c7('0x130')](db[_0x73c7('0x16a')],{'as':_0x73c7('0x16a'),'foreignKey':_0x73c7('0x16b')});db[_0x73c7('0x1d6')][_0x73c7('0x124')](db[_0x73c7('0xcf')],{'as':_0x73c7('0x1c3'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0x1d6')][_0x73c7('0x124')](db[_0x73c7('0xcf')],{'as':_0x73c7('0x1c5'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0x1d6')][_0x73c7('0x124')](db[_0x73c7('0xcf')],{'as':_0x73c7('0x1bc'),'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0x1d6')]['belongsTo'](db['Dynamics365Account'],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0xcf')][_0x73c7('0x124')](db[_0x73c7('0xcf')],{'as':_0x73c7('0x1c7'),'foreignKey':_0x73c7('0x1c4')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x73c7('0x1c8'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0xcf')][_0x73c7('0x124')](db[_0x73c7('0xcf')],{'as':_0x73c7('0x1c9'),'foreignKey':_0x73c7('0x1ca')});db['Dynamics365Field'][_0x73c7('0x130')](db[_0x73c7('0x9a')],{'as':_0x73c7('0x9a'),'foreignKey':'VariableId'});db[_0x73c7('0xd1')][_0x73c7('0x124')](db['FreshsalesConfiguration'],{'as':_0x73c7('0x1cd'),'onDelete':_0x73c7('0x11f'),'foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x73c7('0x1c3'),'foreignKey':_0x73c7('0x1c4')});db[_0x73c7('0x1d7')][_0x73c7('0x124')](db['FreshsalesField'],{'as':_0x73c7('0x1c5'),'foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0x1d7')][_0x73c7('0x124')](db[_0x73c7('0x1d8')],{'as':_0x73c7('0x1bc'),'foreignKey':_0x73c7('0x1ca')});db[_0x73c7('0x1d7')]['belongsTo'](db[_0x73c7('0xd1')],{'as':'Account','foreignKey':_0x73c7('0x1c1')});db[_0x73c7('0x1d8')][_0x73c7('0x124')](db[_0x73c7('0x1d8')],{'as':_0x73c7('0x1c7'),'foreignKey':_0x73c7('0x1c4')});db['FreshsalesField']['hasMany'](db[_0x73c7('0x1d8')],{'as':'Description','foreignKey':_0x73c7('0x1c6')});db[_0x73c7('0x1d8')]['hasMany'](db[_0x73c7('0x1d8')],{'as':_0x73c7('0x1c9'),'foreignKey':'FieldId'});db[_0x73c7('0x1d8')][_0x73c7('0x130')](db['Variable'],{'as':_0x73c7('0x9a'),'foreignKey':_0x73c7('0x1cb')});db[_0x73c7('0xd6')][_0x73c7('0x130')](db[_0x73c7('0x148')],{});db[_0x73c7('0xd6')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':'List','foreignKey':_0x73c7('0x173')});db[_0x73c7('0xd6')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':'ContactId'});db[_0x73c7('0xd6')][_0x73c7('0x130')](db[_0x73c7('0x6b')],{});db[_0x73c7('0xd6')]['belongsTo'](db[_0x73c7('0x6d')],{});db[_0x73c7('0xd6')][_0x73c7('0x130')](db['User'],{});db[_0x73c7('0xd6')][_0x73c7('0x130')](db['ChatQueue'],{});db[_0x73c7('0xd8')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x73c7('0xd8')]['belongsTo'](db[_0x73c7('0x121')],{'onDelete':_0x73c7('0x11f'),'foreignKey':_0x73c7('0x1d9')});db[_0x73c7('0xdd')][_0x73c7('0x124')](db['JscriptyQuestionReport'],{'foreignKey':_0x73c7('0x1da'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0xdd')]['hasMany'](db[_0x73c7('0xd9')],{'foreignKey':_0x73c7('0x1da'),'onDelete':'cascade'});db[_0x73c7('0xde')]['belongsTo'](db[_0x73c7('0x14d')],{});db['SmsQueueReport'][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173')});db['SmsQueueReport'][_0x73c7('0x130')](db['CmContact'],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db[_0x73c7('0xde')][_0x73c7('0x130')](db[_0x73c7('0x18e')],{});db['SmsQueueReport'][_0x73c7('0x130')](db['SmsMessage'],{});db['SmsQueueReport'][_0x73c7('0x130')](db['User'],{});db[_0x73c7('0xde')][_0x73c7('0x130')](db[_0x73c7('0x5b')],{});db['JscriptyProject'][_0x73c7('0x124')](db['JscriptySessionReport'],{'foreignKey':_0x73c7('0x1db')});db['JscriptyProject']['hasMany'](db[_0x73c7('0xdb')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x73c7('0x124')](db[_0x73c7('0xd9')],{'foreignKey':_0x73c7('0x1db')});db['SquareProject'][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x17c'),'through':_0x73c7('0x153')});db[_0x73c7('0xeb')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':_0x73c7('0x138')});db[_0x73c7('0xeb')][_0x73c7('0x132')](db[_0x73c7('0x13e')],{'through':_0x73c7('0x117'),'as':_0x73c7('0x13f')});db[_0x73c7('0xeb')]['belongsToMany'](db[_0x73c7('0x40')],{'through':_0x73c7('0x175'),'as':_0x73c7('0x141')});db['Team'][_0x73c7('0x132')](db[_0x73c7('0x142')],{'through':'team_has_chat_queues','as':_0x73c7('0x1dc')});db[_0x73c7('0xeb')][_0x73c7('0x132')](db[_0x73c7('0x143')],{'through':_0x73c7('0x18b'),'as':_0x73c7('0x144')});db[_0x73c7('0xeb')][_0x73c7('0x132')](db[_0x73c7('0x5b')],{'through':_0x73c7('0x193'),'as':_0x73c7('0x145')});db[_0x73c7('0xeb')]['belongsToMany'](db[_0x73c7('0x65')],{'through':_0x73c7('0x19b'),'as':'OpenchannelQueues'});db[_0x73c7('0xeb')][_0x73c7('0x132')](db[_0x73c7('0x114')],{'through':'team_has_whatsapp_queues','as':_0x73c7('0x147')});db[_0x73c7('0xeb')][_0x73c7('0x132')](db[_0x73c7('0x100')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x73c7('0x1a8')][_0x73c7('0x124')](db[_0x73c7('0x77')],{'as':'Hoppers','foreignKey':_0x73c7('0x1dd')});db['Campaign']['hasMany'](db['CmHopperFinal'],{'as':_0x73c7('0x127'),'foreignKey':_0x73c7('0x1dd')});db[_0x73c7('0x1a8')][_0x73c7('0x124')](db[_0x73c7('0x128')],{'as':_0x73c7('0x1de'),'foreignKey':'CampaignId'});db[_0x73c7('0x1a8')][_0x73c7('0x124')](db[_0x73c7('0x79')],{'as':_0x73c7('0x15b'),'foreignKey':_0x73c7('0x1dd')});db['Campaign'][_0x73c7('0x130')](db[_0x73c7('0x2b')],{'as':_0x73c7('0x2b'),'foreignKey':'TrunkId'});db[_0x73c7('0x1a8')][_0x73c7('0x130')](db[_0x73c7('0x2b')],{'as':_0x73c7('0x15e'),'foreignKey':'TrunkBackupId'});db[_0x73c7('0x1a8')][_0x73c7('0x130')](db['Interval'],{'as':_0x73c7('0x160'),'foreignKey':'IntervalId'});db['Campaign'][_0x73c7('0x130')](db['SquareProject'],{'as':_0x73c7('0xe7'),'foreignKey':_0x73c7('0x1df')});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0x73c7('0x136'),'through':_0x73c7('0x1e0')});db[_0x73c7('0x1a8')]['belongsToMany'](db[_0x73c7('0xfe')],{'as':_0x73c7('0x1e1'),'through':_0x73c7('0x1e2')});db[_0x73c7('0xf1')][_0x73c7('0x130')](db[_0x73c7('0x180')],{'as':_0x73c7('0x180'),'foreignKey':'ChatOfflineMessageId'});db[_0x73c7('0xf4')]['belongsTo'](db['MailMessage'],{});db['MailTransferReport']['belongsTo'](db[_0x73c7('0x44')],{});db[_0x73c7('0xf4')][_0x73c7('0x130')](db['MailAccount'],{'foreignKey':_0x73c7('0x1e3'),'as':_0x73c7('0x1e4')});db[_0x73c7('0xf4')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':_0x73c7('0x1e5'),'as':'FromAgent'});db[_0x73c7('0xf4')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':_0x73c7('0x1e6'),'as':_0x73c7('0x1e7')});db['MailTransferReport'][_0x73c7('0x130')](db['MailQueue'],{'foreignKey':_0x73c7('0x1e8'),'as':_0x73c7('0x1e9')});db[_0x73c7('0xf4')]['belongsTo'](db[_0x73c7('0x3e')],{'foreignKey':_0x73c7('0x1ea'),'as':_0x73c7('0x1eb')});db[_0x73c7('0xf6')][_0x73c7('0x130')](db[_0x73c7('0x6d')],{});db[_0x73c7('0xf6')][_0x73c7('0x130')](db[_0x73c7('0x6b')],{});db[_0x73c7('0xf6')][_0x73c7('0x130')](db[_0x73c7('0x148')],{'foreignKey':_0x73c7('0x1ec'),'as':_0x73c7('0x1e4')});db[_0x73c7('0xf6')][_0x73c7('0x130')](db['User'],{'foreignKey':_0x73c7('0x1e5'),'as':_0x73c7('0x1ed')});db[_0x73c7('0xf6')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':_0x73c7('0x1e6'),'as':_0x73c7('0x1e7')});db[_0x73c7('0xf6')][_0x73c7('0x130')](db['ChatQueue'],{'foreignKey':_0x73c7('0x1ee'),'as':_0x73c7('0x1e9')});db[_0x73c7('0xf6')]['belongsTo'](db[_0x73c7('0x148')],{'foreignKey':'ToChatWebsiteId','as':_0x73c7('0x1eb')});db[_0x73c7('0xf8')][_0x73c7('0x130')](db[_0x73c7('0x188')],{});db[_0x73c7('0xf8')][_0x73c7('0x130')](db[_0x73c7('0x50')],{});db[_0x73c7('0xf8')][_0x73c7('0x130')](db[_0x73c7('0x4c')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x73c7('0xf8')][_0x73c7('0x130')](db['User'],{'foreignKey':_0x73c7('0x1e5'),'as':_0x73c7('0x1ed')});db[_0x73c7('0xf8')][_0x73c7('0x130')](db['User'],{'foreignKey':_0x73c7('0x1e6'),'as':'ToAgent'});db[_0x73c7('0xf8')][_0x73c7('0x130')](db[_0x73c7('0x143')],{'foreignKey':_0x73c7('0x1ef'),'as':_0x73c7('0x1e9')});db[_0x73c7('0xf8')][_0x73c7('0x130')](db[_0x73c7('0x4c')],{'foreignKey':_0x73c7('0x1f0'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0x73c7('0x130')](db[_0x73c7('0x63')],{});db[_0x73c7('0xfa')][_0x73c7('0x130')](db[_0x73c7('0x61')],{});db[_0x73c7('0xfa')][_0x73c7('0x130')](db[_0x73c7('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x73c7('0x1e4')});db[_0x73c7('0xfa')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x73c7('0xfa')]['belongsTo'](db['User'],{'foreignKey':_0x73c7('0x1e6'),'as':_0x73c7('0x1e7')});db[_0x73c7('0xfa')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x73c7('0x1f1'),'as':_0x73c7('0x1e9')});db['OpenchannelTransferReport'][_0x73c7('0x130')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x73c7('0x1eb')});db['SmsTransferReport']['belongsTo'](db[_0x73c7('0x18f')],{});db[_0x73c7('0xfc')][_0x73c7('0x130')](db['SmsInteraction'],{});db[_0x73c7('0xfc')][_0x73c7('0x130')](db[_0x73c7('0x14d')],{'foreignKey':_0x73c7('0x1f2'),'as':'FromAccount'});db[_0x73c7('0xfc')]['belongsTo'](db['User'],{'foreignKey':_0x73c7('0x1e5'),'as':_0x73c7('0x1ed')});db[_0x73c7('0xfc')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':_0x73c7('0x1e6'),'as':_0x73c7('0x1e7')});db[_0x73c7('0xfc')][_0x73c7('0x130')](db[_0x73c7('0x5b')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0x73c7('0xfc')][_0x73c7('0x130')](db['SmsAccount'],{'foreignKey':_0x73c7('0x1f3'),'as':_0x73c7('0x1eb')});db[_0x73c7('0xfe')][_0x73c7('0x124')](db[_0x73c7('0x16f')],{'as':_0x73c7('0x170'),'foreignKey':_0x73c7('0x173'),'onDelete':_0x73c7('0x11f')});db['CmList']['hasMany'](db[_0x73c7('0x7f')],{'as':'CustomFields','foreignKey':_0x73c7('0x173')});db[_0x73c7('0xfe')]['hasMany'](db[_0x73c7('0x75')],{'as':_0x73c7('0x1a4'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x73c7('0xfe')][_0x73c7('0x124')](db[_0x73c7('0x7b')],{'as':_0x73c7('0x127'),'foreignKey':'ListId'});db[_0x73c7('0xfe')][_0x73c7('0x124')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x73c7('0xfe')][_0x73c7('0x124')](db[_0x73c7('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x73c7('0x173')});db[_0x73c7('0xfe')][_0x73c7('0x132')](db[_0x73c7('0x13e')],{'as':_0x73c7('0x1f4'),'through':_0x73c7('0x163')});db[_0x73c7('0xfe')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':_0x73c7('0x137')});db[_0x73c7('0x100')]['hasMany'](db['VoiceExtension'],{'as':_0x73c7('0x1f5'),'onDelete':_0x73c7('0x11f')});db['VoicePrefix'][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':_0x73c7('0x11b')});db['VoicePrefix'][_0x73c7('0x132')](db['Team'],{'through':_0x73c7('0x119'),'as':_0x73c7('0x176')});db['UserProfile'][_0x73c7('0x124')](db['User'],{'as':_0x73c7('0x17c'),'foreignKey':_0x73c7('0x131')});db['UserProfile']['hasMany'](db[_0x73c7('0x1f6')],{'as':_0x73c7('0x1f7'),'foreignKey':_0x73c7('0x131'),'onDelete':_0x73c7('0x11f')});db['UserProfileSection'][_0x73c7('0x124')](db[_0x73c7('0x105')],{'as':_0x73c7('0x1f8'),'foreignKey':_0x73c7('0x1f9'),'onDelete':_0x73c7('0x11f')});db[_0x73c7('0x109')]['hasMany'](db[_0x73c7('0x16f')],{'as':_0x73c7('0x170'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x73c7('0x109')][_0x73c7('0x124')](db[_0x73c7('0x84')],{'as':'Answers','foreignKey':_0x73c7('0x1fa')});db['WhatsappAccount'][_0x73c7('0x124')](db['WhatsappMessage'],{'as':_0x73c7('0x165'),'foreignKey':_0x73c7('0x1fa')});db[_0x73c7('0x109')][_0x73c7('0x124')](db[_0x73c7('0x10d')],{'as':_0x73c7('0x18d')});db[_0x73c7('0x109')][_0x73c7('0x124')](db[_0x73c7('0x10b')],{'as':_0x73c7('0x156')});db[_0x73c7('0x109')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':_0x73c7('0x173')});db['WhatsappAccount'][_0x73c7('0x130')](db['Pause'],{'as':_0x73c7('0x161'),'foreignKey':_0x73c7('0x162')});db['WhatsappAccount']['belongsToMany'](db['User'],{'as':_0x73c7('0x174'),'through':'user_has_whatsapp_accounts'});db[_0x73c7('0x10b')]['belongsTo'](db['User'],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x10b')][_0x73c7('0x130')](db['WhatsappQueue'],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x10b')]['belongsTo'](db[_0x73c7('0x109')],{'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x10b')]['belongsTo'](db[_0x73c7('0x160')],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x182')});db['WhatsappApplication'][_0x73c7('0x130')](db[_0x73c7('0x90')],{'onDelete':_0x73c7('0x16c'),'foreignKey':_0x73c7('0x183')});db[_0x73c7('0x10d')][_0x73c7('0x124')](db[_0x73c7('0x1fb')],{'as':_0x73c7('0x165'),'onDelete':'cascade','foreignKey':_0x73c7('0x1fc')});db['WhatsappInteraction'][_0x73c7('0x130')](db[_0x73c7('0x109')],{'as':'Account','foreignKey':_0x73c7('0x1fa')});db[_0x73c7('0x10d')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':'Contact','foreignKey':_0x73c7('0x169')});db[_0x73c7('0x10d')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x178'),'foreignKey':'UserId'});db[_0x73c7('0x10d')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x1fd'),'as':_0x73c7('0x17a')});db[_0x73c7('0x10d')][_0x73c7('0x132')](db[_0x73c7('0x90')],{'through':_0x73c7('0x1fd'),'as':_0x73c7('0x17b')});db[_0x73c7('0x10d')]['belongsToMany'](db['User'],{'as':_0x73c7('0x17c'),'through':_0x73c7('0x13d'),'foreignKey':_0x73c7('0x1fc')});db['WhatsappMessage'][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':'User'});db['WhatsappMessage'][_0x73c7('0x130')](db['CmContact'],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x168')});db['WhatsappMessage']['belongsTo'](db[_0x73c7('0x10d')],{'onDelete':_0x73c7('0x11f'),'as':_0x73c7('0x17f'),'foreignKey':_0x73c7('0x1fc')});db['WhatsappMessage'][_0x73c7('0x130')](db[_0x73c7('0x109')],{'as':_0x73c7('0x177'),'foreignKey':_0x73c7('0x1fa')});db[_0x73c7('0x110')][_0x73c7('0x130')](db[_0x73c7('0x109')],{});db[_0x73c7('0x110')][_0x73c7('0x130')](db[_0x73c7('0xfe')],{'as':_0x73c7('0x172'),'foreignKey':'ListId'});db[_0x73c7('0x110')][_0x73c7('0x130')](db[_0x73c7('0x75')],{'as':_0x73c7('0x168'),'foreignKey':_0x73c7('0x169')});db['WhatsappQueueReport']['belongsTo'](db[_0x73c7('0x10d')],{});db[_0x73c7('0x110')][_0x73c7('0x130')](db['WhatsappQueue'],{});db[_0x73c7('0x110')][_0x73c7('0x130')](db[_0x73c7('0x1fb')],{});db[_0x73c7('0x110')][_0x73c7('0x130')](db[_0x73c7('0x121')],{});db['WhatsappTransferReport'][_0x73c7('0x130')](db[_0x73c7('0x1fb')],{});db[_0x73c7('0x112')][_0x73c7('0x130')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x73c7('0x130')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x73c7('0x1e4')});db[_0x73c7('0x112')][_0x73c7('0x130')](db[_0x73c7('0x109')],{'foreignKey':_0x73c7('0x1fe'),'as':_0x73c7('0x1eb')});db[_0x73c7('0x112')][_0x73c7('0x130')](db['WhatsappQueue'],{'foreignKey':_0x73c7('0x1ff'),'as':_0x73c7('0x1e9')});db[_0x73c7('0x112')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':_0x73c7('0x1e5'),'as':_0x73c7('0x1ed')});db['WhatsappTransferReport'][_0x73c7('0x130')](db[_0x73c7('0x121')],{'foreignKey':_0x73c7('0x1e6'),'as':'ToAgent'});db[_0x73c7('0x114')][_0x73c7('0x132')](db[_0x73c7('0x121')],{'as':_0x73c7('0x174'),'through':'UserWhatsappQueue','foreignKey':_0x73c7('0x200')});db[_0x73c7('0x114')][_0x73c7('0x132')](db[_0x73c7('0xeb')],{'through':_0x73c7('0x201'),'as':_0x73c7('0x176')});db[_0x73c7('0x122')][_0x73c7('0x130')](db[_0x73c7('0x121')],{'as':_0x73c7('0x202'),'foreignKey':_0x73c7('0x120'),'onDelete':'cascade','hooks':!![]});db[_0x73c7('0x16a')]['hasOne'](db[_0x73c7('0xcc')],{'as':_0x73c7('0xcc'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x16a')]['hasOne'](db['MailServerIn'],{'as':_0x73c7('0x16e'),'onDelete':_0x73c7('0x16c')});db[_0x73c7('0x16a')][_0x73c7('0x11e')](db[_0x73c7('0x3c')],{'as':_0x73c7('0x203'),'onDelete':_0x73c7('0x16c')});module[_0x73c7('0x204')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc276=['MailInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','ChatQueues','FaxQueues','SmsQueues','WhatsappQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceMusicOnHold','Sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','CmContact','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','MailMessage','Messages','Interactions','Applications','List','ListId','Pause','Agents','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','ChatOfflineMessageId','TagId','Dashboard','Items','FaxAccountId','CannedAnswer','Exntensions','mandatoryDispositionPause','user_has_fax_accounts','FaxApplication','FaxMessage','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccount','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','Tags','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','OwnerId','CmHopperBlack','All','OneAll','Any','OneAny','AutomationAnyId','AutomationId','ParentId','FaxApplications','SmsApplications','Mohs','moh_has_sounds','fax_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','Actions','TriggerId','Fields','CustomReportId','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Description','Field','FieldId','Variable','VariableId','int_desk_configuration_has_tags','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowField','Dynamics365Account','Dynamics365Configuration','FromId','SessionId','ProjectId','team_has_sms_queues','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','FromAgent','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8_general_ci','sequelizeHistory','mysql','name','utf8','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../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','../api/cmContact/cmContact.model','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../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','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','userSetting','hasMany','VoiceRecording','Recordings','UserId','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','FaxInteractions'];(function(_0x4b0211,_0x17f347){var _0x1906fc=function(_0x9e2459){while(--_0x9e2459){_0x4b0211['push'](_0x4b0211['shift']());}};_0x1906fc(++_0x17f347);}(_0xc276,0xe3));var _0x6c27=function(_0xc95cce,_0x4a3cb4){_0xc95cce=_0xc95cce-0x0;var _0x176a2a=_0xc276[_0xc95cce];return _0x176a2a;};'use strict';var config=require(_0x6c27('0x0'));var Sequelize=require(_0x6c27('0x1'));var _=require('lodash');var jstz=require(_0x6c27('0x2'));var timezone=jstz[_0x6c27('0x3')]();config[_0x6c27('0x1')]=_[_0x6c27('0x4')](config[_0x6c27('0x1')],{'database':_0x6c27('0x5'),'username':_0x6c27('0x6'),'password':_0x6c27('0x7'),'options':{'host':_0x6c27('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6c27('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x6c27('0xa')}}});config['sequelizeHistory']=_[_0x6c27('0x4')](config[_0x6c27('0xb')],{'database':_0x6c27('0x5'),'username':_0x6c27('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6c27('0xc'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6c27('0xd')](),'define':{'charset':_0x6c27('0xe'),'collate':_0x6c27('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6c27('0x1')][_0x6c27('0xf')],config['sequelize']['username'],config['sequelize']['password'],config[_0x6c27('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x6c27('0xb')][_0x6c27('0x10')],config['sequelizeHistory'][_0x6c27('0x11')],config[_0x6c27('0xb')][_0x6c27('0x12')])};db[_0x6c27('0x13')]=db['sequelize']['import'](_0x6c27('0x14'));db[_0x6c27('0x15')]=db['sequelize']['import'](_0x6c27('0x16'));db[_0x6c27('0x17')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x19'));db[_0x6c27('0x1a')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x1b'));db['VoiceRecording']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x1c'));db[_0x6c27('0x1d')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x1e'));db[_0x6c27('0x1f')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x20'));db[_0x6c27('0x21')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x22'));db[_0x6c27('0x23')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x24'));db[_0x6c27('0x25')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x26'));db[_0x6c27('0x27')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x6c27('0x28')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x29'));db[_0x6c27('0x2a')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x2b'));db[_0x6c27('0x2c')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x2d'));db[_0x6c27('0x2e')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x2f'));db['UserVoiceQueueRt']=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x30'));db[_0x6c27('0x31')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x32'));db[_0x6c27('0x33')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x34'));db[_0x6c27('0x35')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/userMailQueue/userMailQueue.model');db[_0x6c27('0x36')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x37'));db[_0x6c27('0x38')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x39'));db[_0x6c27('0x3a')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x3b'));db[_0x6c27('0x3c')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x3d'));db[_0x6c27('0x3e')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x3f'));db[_0x6c27('0x40')]=db['sequelize'][_0x6c27('0x18')]('../api/mailServerOut/mailServerOut.model');db[_0x6c27('0x41')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x42'));db[_0x6c27('0x43')]=db['sequelize'][_0x6c27('0x18')]('../api/mailQueue/mailQueue.model');db[_0x6c27('0x44')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x45'));db[_0x6c27('0x46')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x47'));db['MailMessage']=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x48'));db[_0x6c27('0x49')]=db['sequelize']['import'](_0x6c27('0x4a'));db[_0x6c27('0x4b')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x4c'));db['Dashboard']=db['sequelize']['import'](_0x6c27('0x4d'));db[_0x6c27('0x4e')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x4f'));db[_0x6c27('0x50')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x51'));db['FaxApplication']=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/faxApplication/faxApplication.model');db[_0x6c27('0x52')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x53'));db['FaxMessage']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x54'));db[_0x6c27('0x55')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/faxQueue/faxQueue.model');db[_0x6c27('0x56')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x57'));db['SmsAccount']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x58'));db[_0x6c27('0x59')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x5a'));db[_0x6c27('0x5b')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x5c'));db[_0x6c27('0x5d')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x5e'));db[_0x6c27('0x5f')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x60'));db[_0x6c27('0x61')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x62'));db[_0x6c27('0x63')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x64'));db[_0x6c27('0x65')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/openchannelMessage/openchannelMessage.model');db[_0x6c27('0x66')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/openchannelQueue/openchannelQueue.model');db[_0x6c27('0x67')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x68'));db[_0x6c27('0x69')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x6a'));db[_0x6c27('0x6b')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x6c'));db[_0x6c27('0x6d')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x6e'));db[_0x6c27('0x6f')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x70'));db[_0x6c27('0x71')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x72'));db[_0x6c27('0x73')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x74'));db[_0x6c27('0x75')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x76'));db[_0x6c27('0x77')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x78'));db['CmContact']=db[_0x6c27('0x1')]['import'](_0x6c27('0x79'));db[_0x6c27('0x7a')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db['sequelize']['import'](_0x6c27('0x7b'));db['CmHopperFinal']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x7c'));db[_0x6c27('0x7d')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x6c27('0x7e')]=db['sequelize'][_0x6c27('0x18')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x6c27('0x7f')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x80'));db['Action']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x81'));db[_0x6c27('0x82')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x83'));db['CannedAnswer']=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x84'));db[_0x6c27('0x85')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x86'));db[_0x6c27('0x87')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x88'));db['Interval']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x89'));db['Pause']=db[_0x6c27('0x1')]['import'](_0x6c27('0x8a'));db[_0x6c27('0x8b')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x8c'));db[_0x6c27('0x8d')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x8e'));db[_0x6c27('0x8f')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x90'));db[_0x6c27('0x91')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x92'));db[_0x6c27('0x93')]=db[_0x6c27('0x1')]['import']('../api/tag/tag.model');db['ContactItemType']=db[_0x6c27('0x1')]['import'](_0x6c27('0x94'));db[_0x6c27('0x95')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x96'));db['CmHopperAdditionalPhone']=db[_0x6c27('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x6c27('0x97')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x98'));db['Trigger']=db[_0x6c27('0x1')]['import']('../api/trigger/trigger.model');db['Variable']=db[_0x6c27('0x1')]['import'](_0x6c27('0x99'));db['Integration']=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/integration/integration.model');db[_0x6c27('0x9a')]=db[_0x6c27('0x1')]['import'](_0x6c27('0x9b'));db[_0x6c27('0x9c')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x9d'));db[_0x6c27('0x9e')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x9f'));db[_0x6c27('0xa0')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xa1'));db[_0x6c27('0xa2')]=db['sequelize']['import'](_0x6c27('0xa3'));db[_0x6c27('0xa4')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xa5'));db[_0x6c27('0xa6')]=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6c27('0xa7')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0xa8'));db[_0x6c27('0xa9')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xaa'));db[_0x6c27('0xab')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xac'));db[_0x6c27('0xad')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xae'));db[_0x6c27('0xaf')]=db['sequelize'][_0x6c27('0x18')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6c27('0xb0')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xb1'));db[_0x6c27('0xb2')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0xb3'));db[_0x6c27('0xb4')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xb5'));db[_0x6c27('0xb6')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xb7'));db[_0x6c27('0xb8')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xb9'));db[_0x6c27('0xba')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xbb'));db['ZohoField']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xbc'));db[_0x6c27('0xbd')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xbe'));db[_0x6c27('0xbf')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xc0'));db['ZendeskField']=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/intZendeskField/intZendeskField.model');db[_0x6c27('0xc1')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xc2'));db[_0x6c27('0xc3')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xc4'));db[_0x6c27('0xc5')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x6c27('0xc6')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xc7'));db[_0x6c27('0xc8')]=db['sequelize'][_0x6c27('0x18')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x6c27('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x6c27('0xc9')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xca'));db[_0x6c27('0xcb')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xcc'));db['Dynamics365Account']=db[_0x6c27('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x6c27('0x1')]['import'](_0x6c27('0xcd'));db[_0x6c27('0xce')]=db[_0x6c27('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0x6c27('0xcf')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0xd0'));db[_0x6c27('0xd1')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xd2'));db[_0x6c27('0xd3')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xd4'));db[_0x6c27('0xd5')]=db['sequelize']['import'](_0x6c27('0xd6'));db['Network']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xd7'));db[_0x6c27('0xd8')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xd9'));db[_0x6c27('0xda')]=db['sequelize']['import'](_0x6c27('0xdb'));db[_0x6c27('0xdc')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xdd'));db[_0x6c27('0xde')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x6c27('0xdf')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0xe0'));db[_0x6c27('0xe1')]=db[_0x6c27('0x1')]['import'](_0x6c27('0xe2'));db['SquareReport']=db['sequelize'][_0x6c27('0x18')](_0x6c27('0xe3'));db[_0x6c27('0xe4')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0xe5'));db[_0x6c27('0xe6')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xe7'));db[_0x6c27('0xe8')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xe9'));db[_0x6c27('0xea')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/squareOdbc/squareOdbc.model');db[_0x6c27('0xeb')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xec'));db[_0x6c27('0xed')]=db[_0x6c27('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x6c27('0xee')]=db['sequelize'][_0x6c27('0x18')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xef'));db[_0x6c27('0xf0')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xf1'));db[_0x6c27('0xf2')]=db['sequelize']['import'](_0x6c27('0xf3'));db[_0x6c27('0xf4')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xf5'));db[_0x6c27('0xf6')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xf7'));db[_0x6c27('0xf8')]=db['sequelize']['import'](_0x6c27('0xf9'));db['MailTransferReport']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0xfa'));db[_0x6c27('0xfb')]=db[_0x6c27('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x6c27('0xfc')]=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x6c27('0xfd')]=db[_0x6c27('0x1')]['import'](_0x6c27('0xfe'));db[_0x6c27('0xff')]=db[_0x6c27('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x100'));db['VoicePrefix']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x101'));db[_0x6c27('0x102')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x103'));db[_0x6c27('0x104')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x105'));db[_0x6c27('0x106')]=db[_0x6c27('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x6c27('0x107')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x108'));db[_0x6c27('0x109')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/whatsappAccount/whatsappAccount.model');db[_0x6c27('0x10a')]=db['sequelize'][_0x6c27('0x18')](_0x6c27('0x10b'));db[_0x6c27('0x10c')]=db[_0x6c27('0x1')][_0x6c27('0x18')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x6c27('0x10d')]=db['sequelize']['import'](_0x6c27('0x10e'));db[_0x6c27('0x10f')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x110'));db[_0x6c27('0x111')]=db[_0x6c27('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x112'));db[_0x6c27('0x113')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x114'));db[_0x6c27('0x115')]=db['sequelize']['import'](_0x6c27('0x116'));db[_0x6c27('0x117')]=db[_0x6c27('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x6c27('0x118')]=db[_0x6c27('0x1')][_0x6c27('0x18')](_0x6c27('0x119'));db[_0x6c27('0x11a')]=db[_0x6c27('0x1')]['import']('../api/user-setting/user-setting.model');db[_0x6c27('0x13')][_0x6c27('0x11b')](db[_0x6c27('0x1f')],{'as':'VoiceMail','onDelete':_0x6c27('0x11c'),'foreignKey':'UserId'});db['User']['hasOne'](db[_0x6c27('0x11a')],{'as':_0x6c27('0x11d'),'onDelete':_0x6c27('0x11c'),'foreignKey':'UserId'});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x11f')],{'as':_0x6c27('0x120'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x122')],{'as':_0x6c27('0x123'),'foreignKey':'UserId'});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x124')],{'as':_0x6c27('0x125'),'onDelete':_0x6c27('0x11c'),'hooks':!![]});db['User'][_0x6c27('0x11e')](db[_0x6c27('0x126')],{'as':_0x6c27('0x127'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x13')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x6c27('0x121')});db[_0x6c27('0x13')]['hasMany'](db['ReportAgentPreview'],{'as':_0x6c27('0x7e'),'foreignKey':'UserId'});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x63')],{'as':_0x6c27('0x128'),'foreignKey':_0x6c27('0x121')});db['User'][_0x6c27('0x11e')](db[_0x6c27('0x6d')],{'as':_0x6c27('0x129'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x5b')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x52')],{'as':_0x6c27('0x12a'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x13')][_0x6c27('0x11e')](db['MailInteraction'],{'as':_0x6c27('0x12b'),'foreignKey':'UserId'});db[_0x6c27('0x13')]['hasMany'](db[_0x6c27('0x10c')],{'as':'WhatsappInteractions','foreignKey':_0x6c27('0x121')});db[_0x6c27('0x13')][_0x6c27('0x11e')](db[_0x6c27('0x107')],{'as':_0x6c27('0x12c'),'foreignKey':_0x6c27('0x12d')});db[_0x6c27('0x13')]['belongsTo'](db[_0x6c27('0x102')],{'as':_0x6c27('0x102'),'foreignKey':'userProfileId'});db[_0x6c27('0x13')][_0x6c27('0x12e')](db['ChatGroup'],{'as':_0x6c27('0x12f'),'through':_0x6c27('0x130')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db['CmContact'],{'as':_0x6c27('0x131'),'through':'cm_user_has_contacts'});db['User'][_0x6c27('0x12e')](db['CmList'],{'as':_0x6c27('0x132'),'through':_0x6c27('0x133')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x134')],{'through':_0x6c27('0x135')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db['MailInteraction'],{'as':_0x6c27('0x12b'),'through':'user_has_mail_interactions'});db[_0x6c27('0x13')][_0x6c27('0x12e')](db['ChatInteraction'],{'as':_0x6c27('0x129'),'through':_0x6c27('0x136')});db[_0x6c27('0x13')]['belongsToMany'](db[_0x6c27('0x52')],{'as':'FaxInteractions','through':_0x6c27('0x137')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x5b')],{'as':_0x6c27('0x138'),'through':'user_has_sms_interactions'});db[_0x6c27('0x13')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x6c27('0x128'),'through':_0x6c27('0x139')});db['User'][_0x6c27('0x12e')](db[_0x6c27('0x10c')],{'as':_0x6c27('0x13a'),'through':_0x6c27('0x13b')});db['User'][_0x6c27('0x12e')](db[_0x6c27('0x1a')],{'as':_0x6c27('0x13c'),'through':_0x6c27('0x31'),'required':![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x13d')],{'as':'VoicePrefixes','through':_0x6c27('0x118'),'required':![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x43')],{'as':'MailQueues','through':_0x6c27('0x35'),'required':![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x71')],{'as':_0x6c27('0x13e'),'through':_0x6c27('0x33'),'required':![],'hooks':!![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x55')],{'as':_0x6c27('0x13f'),'through':'UserFaxQueue','required':![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db['SmsQueue'],{'as':_0x6c27('0x140'),'through':_0x6c27('0x38'),'required':![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x66')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x141')],{'as':_0x6c27('0x142'),'through':_0x6c27('0x3c'),'required':![]});db['User'][_0x6c27('0x12e')](db[_0x6c27('0x143')],{'through':_0x6c27('0x133')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x67')],{'as':_0x6c27('0x144'),'through':_0x6c27('0x145')});db['User'][_0x6c27('0x12e')](db[_0x6c27('0x50')],{'as':_0x6c27('0x146'),'through':'user_has_fax_accounts'});db['User']['belongsToMany'](db[_0x6c27('0x41')],{'as':_0x6c27('0x147'),'through':_0x6c27('0x148')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db[_0x6c27('0x5f')],{'as':_0x6c27('0x149'),'through':_0x6c27('0x14a')});db[_0x6c27('0x13')]['belongsToMany'](db['SmsAccount'],{'as':_0x6c27('0x14b'),'through':_0x6c27('0x14c')});db[_0x6c27('0x13')][_0x6c27('0x12e')](db['WhatsappAccount'],{'as':_0x6c27('0x14d'),'through':'user_has_whatsapp_accounts'});db['User'][_0x6c27('0x12e')](db[_0x6c27('0xeb')],{'as':_0x6c27('0x14e'),'through':_0x6c27('0x14f')});db[_0x6c27('0x15')]['hasMany'](db[_0x6c27('0x124')],{'as':_0x6c27('0x150'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x151')});db[_0x6c27('0x17')]['hasMany'](db[_0x6c27('0x124')],{'onDelete':_0x6c27('0x11c')});db['VoiceExtension'][_0x6c27('0x11e')](db[_0x6c27('0x124')],{'as':'Applications','onDelete':_0x6c27('0x11c')});db[_0x6c27('0x152')][_0x6c27('0x12e')](db['Sound'],{'as':_0x6c27('0x153'),'through':'moh_has_sounds'});db[_0x6c27('0x1a')]['hasMany'](db[_0x6c27('0x122')],{'as':_0x6c27('0x154'),'foreignKey':_0x6c27('0x155')});db[_0x6c27('0x1a')][_0x6c27('0x11e')](db[_0x6c27('0x7a')],{'as':_0x6c27('0x156'),'foreignKey':_0x6c27('0x155')});db[_0x6c27('0x1a')]['hasMany'](db['CmHopperFinal'],{'as':_0x6c27('0x127'),'foreignKey':_0x6c27('0x155')});db['VoiceQueue'][_0x6c27('0x11e')](db[_0x6c27('0x7d')],{'as':'HopperHistories','foreignKey':_0x6c27('0x155')});db[_0x6c27('0x1a')]['hasMany'](db[_0x6c27('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x6c27('0x155')});db[_0x6c27('0x1a')][_0x6c27('0x11e')](db['CmHopperBlack'],{'as':_0x6c27('0x157'),'foreignKey':_0x6c27('0x155')});db[_0x6c27('0x1a')][_0x6c27('0x11e')](db[_0x6c27('0xdf')],{'as':'JscriptySessions','foreignKey':_0x6c27('0x155')});db['VoiceQueue']['belongsTo'](db[_0x6c27('0x2c')],{'as':_0x6c27('0x2c'),'foreignKey':_0x6c27('0x158')});db['VoiceQueue'][_0x6c27('0x159')](db[_0x6c27('0x2c')],{'as':_0x6c27('0x15a'),'foreignKey':_0x6c27('0x15b')});db[_0x6c27('0x1a')]['belongsTo'](db[_0x6c27('0x15c')],{'as':_0x6c27('0x15c'),'foreignKey':_0x6c27('0x15d')});db[_0x6c27('0x1a')][_0x6c27('0x159')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6c27('0x15e')});db[_0x6c27('0x1a')][_0x6c27('0x12e')](db['CmList'],{'as':_0x6c27('0x132'),'through':_0x6c27('0x15f')});db[_0x6c27('0x1a')][_0x6c27('0x12e')](db['User'],{'as':'Agents','through':_0x6c27('0x31')});db[_0x6c27('0x1a')][_0x6c27('0x12e')](db[_0x6c27('0x134')],{'as':_0x6c27('0x160'),'through':_0x6c27('0x115')});db[_0x6c27('0x1a')][_0x6c27('0x12e')](db[_0x6c27('0x143')],{'as':_0x6c27('0x161'),'through':_0x6c27('0x162')});db[_0x6c27('0x11f')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':'User','foreignKey':'UserId'});db['ScreenRecording']['belongsTo'](db[_0x6c27('0x13')],{'as':_0x6c27('0x13'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x1f')]['hasMany'](db[_0x6c27('0x21')],{'as':'Messages','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x163'),'sourceKey':_0x6c27('0x164')});db[_0x6c27('0x21')][_0x6c27('0x159')](db[_0x6c27('0x1f')],{'foreignKey':_0x6c27('0x163'),'targetKey':_0x6c27('0x164')});db[_0x6c27('0x23')]['hasMany'](db[_0x6c27('0x28')],{'as':_0x6c27('0x165'),'foreignKey':'uniqueid','constraints':![]});db[_0x6c27('0x23')][_0x6c27('0x11e')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x6c27('0x166'),'constraints':![]});db[_0x6c27('0x23')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':_0x6c27('0x13'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x23')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x3e')]['belongsTo'](db[_0x6c27('0x41')],{'as':_0x6c27('0x41'),'foreignKey':_0x6c27('0x16a')});db[_0x6c27('0x3e')][_0x6c27('0x159')](db[_0x6c27('0x113')],{'as':'CloudProvider','foreignKey':_0x6c27('0x16b'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x40')]['belongsTo'](db[_0x6c27('0x41')],{'as':_0x6c27('0x41'),'foreignKey':_0x6c27('0x16a')});db[_0x6c27('0x40')][_0x6c27('0x159')](db[_0x6c27('0x113')],{'as':_0x6c27('0x113'),'foreignKey':_0x6c27('0x16b'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x41')]['hasOne'](db[_0x6c27('0x3e')],{'as':_0x6c27('0x16d'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x41')]['hasOne'](db[_0x6c27('0x40')],{'as':_0x6c27('0x16e'),'onDelete':_0x6c27('0x11c')});db['MailAccount'][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':_0x6c27('0x16f'),'foreignKey':_0x6c27('0x16a'),'onDelete':_0x6c27('0x11c')});db['MailAccount'][_0x6c27('0x11e')](db['CannedAnswer'],{'as':_0x6c27('0x170'),'foreignKey':_0x6c27('0x16a')});db[_0x6c27('0x41')][_0x6c27('0x11e')](db[_0x6c27('0x171')],{'as':_0x6c27('0x172'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x6c27('0x11e')](db['MailInteraction'],{'as':_0x6c27('0x173')});db[_0x6c27('0x41')][_0x6c27('0x11e')](db[_0x6c27('0x49')],{'as':_0x6c27('0x174')});db['MailAccount']['belongsTo'](db[_0x6c27('0x143')],{'as':_0x6c27('0x175'),'foreignKey':_0x6c27('0x176')});db['MailAccount'][_0x6c27('0x159')](db['Template'],{'as':_0x6c27('0x97'),'foreignKey':'TemplateId'});db[_0x6c27('0x41')]['belongsTo'](db[_0x6c27('0x177')],{'as':'mandatoryDispositionPause','foreignKey':_0x6c27('0x15e')});db[_0x6c27('0x41')]['belongsToMany'](db['User'],{'as':_0x6c27('0x178'),'through':_0x6c27('0x148')});db[_0x6c27('0x43')]['belongsToMany'](db[_0x6c27('0x13')],{'as':'Agents','through':_0x6c27('0x35')});db['MailQueue']['belongsToMany'](db[_0x6c27('0x134')],{'through':_0x6c27('0x179'),'as':'Teams'});db[_0x6c27('0x46')]['hasMany'](db['MailMessage'],{'as':_0x6c27('0x172'),'onDelete':_0x6c27('0x11c'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x6c27('0x159')](db['MailAccount'],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x16a')});db['MailInteraction'][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x46')]['belongsTo'](db[_0x6c27('0x13')],{'as':_0x6c27('0x17b'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x46')][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':_0x6c27('0x17c'),'as':'Tags'});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0x6c27('0x17c'),'as':_0x6c27('0x17d')});db[_0x6c27('0x46')][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x17f'),'foreignKey':_0x6c27('0x180')});db[_0x6c27('0x171')][_0x6c27('0x11e')](db['Attachment'],{'as':'Attachments','onDelete':_0x6c27('0x11c')});db[_0x6c27('0x171')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':_0x6c27('0x13')});db[_0x6c27('0x171')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'onDelete':_0x6c27('0x11c'),'as':_0x6c27('0x168')});db[_0x6c27('0x171')][_0x6c27('0x159')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x6c27('0x180')});db[_0x6c27('0x171')][_0x6c27('0x159')](db[_0x6c27('0x41')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x16a')});db[_0x6c27('0x171')]['belongsTo'](db['ChatWebsite'],{'as':_0x6c27('0x67'),'foreignKey':'ChatWebsiteId'});db[_0x6c27('0x171')][_0x6c27('0x159')](db['ChatOfflineMessage'],{'as':_0x6c27('0x6f'),'foreignKey':_0x6c27('0x181')});db[_0x6c27('0x49')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x49')][_0x6c27('0x159')](db[_0x6c27('0x43')],{'onDelete':'restrict'});db['MailApplication'][_0x6c27('0x159')](db[_0x6c27('0x41')],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x49')][_0x6c27('0x159')](db[_0x6c27('0x15c')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x6c27('0x49')][_0x6c27('0x159')](db[_0x6c27('0x93')],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x182')});db[_0x6c27('0x4b')][_0x6c27('0x159')](db[_0x6c27('0x41')],{});db[_0x6c27('0x4b')][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':_0x6c27('0x175'),'foreignKey':'ListId'});db[_0x6c27('0x4b')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x4b')][_0x6c27('0x159')](db[_0x6c27('0x46')],{});db[_0x6c27('0x4b')][_0x6c27('0x159')](db[_0x6c27('0x171')],{});db[_0x6c27('0x4b')]['belongsTo'](db[_0x6c27('0x13')],{});db[_0x6c27('0x4b')]['belongsTo'](db[_0x6c27('0x43')],{});db[_0x6c27('0x183')][_0x6c27('0x11e')](db[_0x6c27('0x4e')],{'as':_0x6c27('0x184'),'onDelete':'cascade'});db[_0x6c27('0x50')][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':_0x6c27('0x16f'),'foreignKey':_0x6c27('0x185'),'onDelete':'cascade'});db[_0x6c27('0x50')]['hasMany'](db[_0x6c27('0x186')],{'as':_0x6c27('0x170'),'foreignKey':_0x6c27('0x185')});db[_0x6c27('0x50')][_0x6c27('0x11e')](db['FaxInteraction'],{'as':_0x6c27('0x173')});db[_0x6c27('0x50')][_0x6c27('0x11e')](db['FaxApplication'],{'as':'Applications'});db['FaxAccount'][_0x6c27('0x11e')](db[_0x6c27('0x124')],{'as':_0x6c27('0x187'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x50')][_0x6c27('0x11e')](db['FaxMessage'],{'as':_0x6c27('0x172')});db[_0x6c27('0x50')]['belongsTo'](db[_0x6c27('0x2c')],{'as':_0x6c27('0x2c')});db['FaxAccount'][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':'List','foreignKey':_0x6c27('0x176')});db[_0x6c27('0x50')][_0x6c27('0x159')](db[_0x6c27('0x177')],{'as':_0x6c27('0x188'),'foreignKey':_0x6c27('0x15e')});db['FaxAccount'][_0x6c27('0x12e')](db['User'],{'as':_0x6c27('0x178'),'through':_0x6c27('0x189')});db[_0x6c27('0x18a')]['belongsTo'](db[_0x6c27('0x13')],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x18a')][_0x6c27('0x159')](db['FaxQueue'],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x18a')][_0x6c27('0x159')](db[_0x6c27('0x50')],{'onDelete':'restrict'});db[_0x6c27('0x18a')][_0x6c27('0x159')](db[_0x6c27('0x93')],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x182')});db[_0x6c27('0x52')][_0x6c27('0x11e')](db[_0x6c27('0x18b')],{'as':_0x6c27('0x172'),'onDelete':'cascade','foreignKey':_0x6c27('0x18c')});db[_0x6c27('0x52')]['belongsTo'](db[_0x6c27('0x50')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x185')});db[_0x6c27('0x52')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':'ContactId'});db[_0x6c27('0x52')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17b'),'foreignKey':_0x6c27('0x121')});db['FaxInteraction'][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':'fax_interaction_has_tags','as':'Tags'});db['FaxInteraction'][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':'fax_interaction_has_tags','as':_0x6c27('0x17d')});db[_0x6c27('0x52')]['belongsToMany'](db['User'],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x137'),'foreignKey':_0x6c27('0x18c')});db['FaxMessage'][_0x6c27('0x159')](db[_0x6c27('0x13')],{'onDelete':'cascade','as':_0x6c27('0x13')});db['FaxMessage'][_0x6c27('0x159')](db[_0x6c27('0x52')],{'as':_0x6c27('0x18d'),'foreignKey':_0x6c27('0x18c')});db[_0x6c27('0x18b')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'onDelete':_0x6c27('0x11c'),'as':_0x6c27('0x168')});db[_0x6c27('0x18b')]['belongsTo'](db[_0x6c27('0xf6')],{'as':_0x6c27('0xf6'),'foreignKey':_0x6c27('0x18e')});db[_0x6c27('0x18b')][_0x6c27('0x159')](db[_0x6c27('0x50')],{'as':'Account','foreignKey':_0x6c27('0x185')});db[_0x6c27('0x55')]['belongsToMany'](db['User'],{'as':_0x6c27('0x178'),'through':'UserFaxQueue'});db[_0x6c27('0x55')][_0x6c27('0x12e')](db[_0x6c27('0x134')],{'through':_0x6c27('0x18f'),'as':_0x6c27('0x160')});db[_0x6c27('0x56')][_0x6c27('0x159')](db['FaxAccount'],{});db[_0x6c27('0x56')]['belongsTo'](db[_0x6c27('0x143')],{'as':_0x6c27('0x175'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x56')][_0x6c27('0x159')](db['CmContact'],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x56')][_0x6c27('0x159')](db[_0x6c27('0x52')],{});db[_0x6c27('0x56')][_0x6c27('0x159')](db[_0x6c27('0x18b')],{});db[_0x6c27('0x56')][_0x6c27('0x159')](db[_0x6c27('0x13')],{});db[_0x6c27('0x56')][_0x6c27('0x159')](db[_0x6c27('0x55')],{});db[_0x6c27('0x190')][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':_0x6c27('0x16f'),'foreignKey':_0x6c27('0x191'),'onDelete':'cascade'});db[_0x6c27('0x190')][_0x6c27('0x11e')](db['CannedAnswer'],{'as':_0x6c27('0x170'),'foreignKey':_0x6c27('0x191')});db['SmsAccount'][_0x6c27('0x11e')](db['SmsMessage'],{'as':_0x6c27('0x172'),'foreignKey':_0x6c27('0x191')});db[_0x6c27('0x190')][_0x6c27('0x11e')](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount']['hasMany'](db[_0x6c27('0x59')],{'as':_0x6c27('0x174')});db[_0x6c27('0x190')]['belongsTo'](db['CmList'],{'as':_0x6c27('0x175'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x190')][_0x6c27('0x159')](db['Pause'],{'as':_0x6c27('0x188'),'foreignKey':_0x6c27('0x15e')});db['SmsAccount'][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x178'),'through':'user_has_sms_accounts'});db[_0x6c27('0x59')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x59')][_0x6c27('0x159')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x6c27('0x59')][_0x6c27('0x159')](db[_0x6c27('0x190')],{'onDelete':'restrict'});db[_0x6c27('0x59')][_0x6c27('0x159')](db['Interval'],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x15d')});db[_0x6c27('0x59')][_0x6c27('0x159')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6c27('0x182')});db[_0x6c27('0x5b')]['hasMany'](db[_0x6c27('0x192')],{'as':_0x6c27('0x172'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x193')});db[_0x6c27('0x5b')][_0x6c27('0x159')](db['SmsAccount'],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x191')});db['SmsInteraction']['belongsTo'](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x5b')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17b'),'foreignKey':_0x6c27('0x121')});db['SmsInteraction'][_0x6c27('0x12e')](db['Tag'],{'through':_0x6c27('0x194'),'as':_0x6c27('0x195')});db[_0x6c27('0x5b')][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':_0x6c27('0x194'),'as':_0x6c27('0x17d')});db[_0x6c27('0x5b')]['belongsToMany'](db[_0x6c27('0x13')],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x196'),'foreignKey':_0x6c27('0x193')});db['SmsMessage'][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':'User'});db[_0x6c27('0x192')][_0x6c27('0x159')](db['CmContact'],{'onDelete':_0x6c27('0x11c'),'as':'Contact'});db[_0x6c27('0x192')][_0x6c27('0x159')](db[_0x6c27('0x5b')],{'onDelete':_0x6c27('0x11c'),'as':'Interaction','foreignKey':_0x6c27('0x193')});db[_0x6c27('0x192')]['belongsTo'](db['SmsAccount'],{'as':_0x6c27('0x17a'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0x6c27('0x13')],{'as':_0x6c27('0x178'),'through':_0x6c27('0x38'),'foreignKey':_0x6c27('0x197')});db[_0x6c27('0x5d')][_0x6c27('0x12e')](db[_0x6c27('0x134')],{'through':'team_has_sms_queues','as':_0x6c27('0x160')});db[_0x6c27('0x5f')][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':'Dispositions','foreignKey':_0x6c27('0x198'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x5f')][_0x6c27('0x11e')](db['CannedAnswer'],{'as':_0x6c27('0x170'),'foreignKey':_0x6c27('0x198')});db['OpenchannelAccount'][_0x6c27('0x11e')](db[_0x6c27('0x63')],{'as':_0x6c27('0x173'),'foreignKey':_0x6c27('0x198')});db[_0x6c27('0x5f')][_0x6c27('0x11e')](db[_0x6c27('0x65')],{'as':'Messages','foreignKey':_0x6c27('0x198')});db[_0x6c27('0x5f')][_0x6c27('0x11e')](db['OpenchannelApplication'],{'as':_0x6c27('0x174'),'foreignKey':_0x6c27('0x198')});db[_0x6c27('0x5f')]['belongsTo'](db['CmList'],{'as':_0x6c27('0x175'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x5f')]['belongsTo'](db[_0x6c27('0x177')],{'as':_0x6c27('0x188'),'foreignKey':_0x6c27('0x15e')});db[_0x6c27('0x5f')]['belongsToMany'](db[_0x6c27('0x13')],{'as':_0x6c27('0x178'),'through':_0x6c27('0x14a')});db[_0x6c27('0x61')][_0x6c27('0x159')](db['User'],{'onDelete':_0x6c27('0x16c')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x6c27('0x159')](db[_0x6c27('0x5f')],{'onDelete':_0x6c27('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x6c27('0x61')][_0x6c27('0x159')](db[_0x6c27('0x15c')],{'onDelete':'restrict','foreignKey':_0x6c27('0x15d')});db['OpenchannelApplication'][_0x6c27('0x159')](db[_0x6c27('0x93')],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x182')});db[_0x6c27('0x63')][_0x6c27('0x11e')](db[_0x6c27('0x65')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x6c27('0x199')});db[_0x6c27('0x63')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x198')});db[_0x6c27('0x63')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':'ContactId'});db[_0x6c27('0x63')][_0x6c27('0x159')](db['User'],{'as':'Owner','foreignKey':_0x6c27('0x121')});db['OpenchannelInteraction'][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':'openchannel_interaction_has_tags','as':_0x6c27('0x195')});db[_0x6c27('0x63')][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':_0x6c27('0x19a'),'as':_0x6c27('0x17d')});db[_0x6c27('0x63')][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x139'),'foreignKey':_0x6c27('0x199')});db[_0x6c27('0x65')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'onDelete':_0x6c27('0x11c'),'as':_0x6c27('0x13')});db[_0x6c27('0x65')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'onDelete':_0x6c27('0x11c'),'as':_0x6c27('0x168')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x6c27('0x11c'),'as':'Interaction','foreignKey':_0x6c27('0x199')});db[_0x6c27('0x65')]['belongsTo'](db[_0x6c27('0xf6')],{'as':_0x6c27('0xf6'),'foreignKey':_0x6c27('0x18e')});db[_0x6c27('0x65')]['belongsTo'](db[_0x6c27('0x5f')],{'as':'Account','foreignKey':_0x6c27('0x198')});db[_0x6c27('0x66')][_0x6c27('0x12e')](db['User'],{'as':'Agents','through':_0x6c27('0x3a'),'foreignKey':_0x6c27('0x19b')});db['OpenchannelQueue']['belongsToMany'](db[_0x6c27('0x134')],{'through':'team_has_openchannel_queues','as':_0x6c27('0x160')});db['ChatWebsite'][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':_0x6c27('0x16f'),'foreignKey':_0x6c27('0x19c'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x67')]['hasMany'](db[_0x6c27('0x186')],{'as':_0x6c27('0x170'),'foreignKey':_0x6c27('0x19c')});db['ChatWebsite']['hasMany'](db[_0x6c27('0x75')],{'as':_0x6c27('0x19d')});db[_0x6c27('0x67')][_0x6c27('0x11e')](db['ChatInteraction'],{'as':_0x6c27('0x173')});db['ChatWebsite']['hasMany'](db[_0x6c27('0x6b')],{'as':_0x6c27('0x174')});db[_0x6c27('0x67')][_0x6c27('0x11e')](db[_0x6c27('0x19e')],{'as':_0x6c27('0x172')});db[_0x6c27('0x67')]['belongsTo'](db['CmList'],{'as':_0x6c27('0x175'),'foreignKey':'ListId'});db[_0x6c27('0x67')][_0x6c27('0x159')](db[_0x6c27('0x15c')],{'as':_0x6c27('0x15c'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x6c27('0x159')](db[_0x6c27('0x41')],{'as':_0x6c27('0x41'),'foreignKey':_0x6c27('0x16a')});db[_0x6c27('0x67')]['belongsTo'](db[_0x6c27('0x177')],{'as':_0x6c27('0x188'),'foreignKey':_0x6c27('0x15e')});db[_0x6c27('0x67')][_0x6c27('0x12e')](db['User'],{'as':_0x6c27('0x178'),'through':_0x6c27('0x145')});db[_0x6c27('0x69')][_0x6c27('0x159')](db[_0x6c27('0x5f')],{});db['OpenchannelQueueReport'][_0x6c27('0x159')](db['CmList'],{'as':_0x6c27('0x175'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x69')][_0x6c27('0x159')](db['CmContact'],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db['OpenchannelQueueReport']['belongsTo'](db[_0x6c27('0x63')],{});db[_0x6c27('0x69')]['belongsTo'](db[_0x6c27('0x65')],{});db[_0x6c27('0x69')]['belongsTo'](db['User'],{});db[_0x6c27('0x69')][_0x6c27('0x159')](db[_0x6c27('0x66')],{});db[_0x6c27('0x6b')]['belongsTo'](db[_0x6c27('0x13')],{'as':_0x6c27('0x19f'),'foreignKey':_0x6c27('0x121'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x6b')][_0x6c27('0x159')](db[_0x6c27('0x71')],{'as':_0x6c27('0x1a0'),'foreignKey':_0x6c27('0x1a1'),'onDelete':_0x6c27('0x16c')});db['ChatApplication'][_0x6c27('0x159')](db[_0x6c27('0x67')],{'as':_0x6c27('0x1a2'),'foreignKey':_0x6c27('0x19c'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x6b')]['belongsTo'](db[_0x6c27('0x93')],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x182')});db[_0x6c27('0x6d')][_0x6c27('0x11e')](db['ChatMessage'],{'as':_0x6c27('0x172'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1a3')});db[_0x6c27('0x6d')][_0x6c27('0x159')](db['ChatWebsite'],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x19c')});db[_0x6c27('0x6d')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x6d')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':'Owner','foreignKey':_0x6c27('0x121')});db[_0x6c27('0x6d')][_0x6c27('0x12e')](db['Tag'],{'through':_0x6c27('0x1a4'),'as':_0x6c27('0x195')});db['ChatInteraction'][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':_0x6c27('0x1a4'),'as':_0x6c27('0x17d')});db['ChatInteraction'][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x136'),'foreignKey':_0x6c27('0x1a3')});db[_0x6c27('0x19e')][_0x6c27('0x159')](db['User'],{'onDelete':'cascade','as':_0x6c27('0x13')});db[_0x6c27('0x19e')][_0x6c27('0x159')](db['CmContact'],{'onDelete':'cascade','as':_0x6c27('0x168'),'foreignKey':'ContactId'});db[_0x6c27('0x19e')][_0x6c27('0x159')](db[_0x6c27('0x6d')],{'onDelete':'cascade','as':_0x6c27('0x18d'),'foreignKey':_0x6c27('0x1a3')});db[_0x6c27('0x19e')][_0x6c27('0x159')](db[_0x6c27('0xf6')],{'as':_0x6c27('0xf6'),'foreignKey':'AttachmentId'});db[_0x6c27('0x19e')][_0x6c27('0x159')](db[_0x6c27('0x67')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x19c')});db[_0x6c27('0x6f')][_0x6c27('0x11e')](db['Attachment'],{'as':_0x6c27('0x1a5'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x6c27('0x11c'),'hooks':!![]});db[_0x6c27('0x6f')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'onDelete':'cascade','as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db['ChatOfflineMessage'][_0x6c27('0x159')](db[_0x6c27('0x67')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x19c')});db[_0x6c27('0x71')][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':'Agents','through':_0x6c27('0x33'),'hooks':!![]});db[_0x6c27('0x71')][_0x6c27('0x12e')](db['Team'],{'through':_0x6c27('0x1a6'),'as':_0x6c27('0x160')});db[_0x6c27('0x73')]['hasMany'](db['ChatInternalMessage'],{'as':_0x6c27('0x172'),'foreignKey':'ChatGroupId','onDelete':_0x6c27('0x11c')});db['ChatGroup'][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0x6c27('0x75')]['belongsTo'](db[_0x6c27('0x67')],{'as':_0x6c27('0x1a2'),'foreignKey':_0x6c27('0x19c')});db[_0x6c27('0x77')][_0x6c27('0x11e')](db[_0x6c27('0x167')],{'as':_0x6c27('0x131'),'foreignKey':_0x6c27('0x1a7')});db[_0x6c27('0x167')][_0x6c27('0x11e')](db[_0x6c27('0x95')],{'as':_0x6c27('0x1a8'),'foreignKey':_0x6c27('0x1a9')});db[_0x6c27('0x167')]['hasMany'](db[_0x6c27('0x7a')],{'as':'Hoppers','foreignKey':_0x6c27('0x169')});db['CmContact'][_0x6c27('0x11e')](db['CmHopperFinal'],{'as':_0x6c27('0x127'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x167')][_0x6c27('0x11e')](db[_0x6c27('0x7d')],{'as':_0x6c27('0x1aa'),'foreignKey':_0x6c27('0x169')});db['CmContact'][_0x6c27('0x11e')](db[_0x6c27('0x7e')],{'as':_0x6c27('0x7e'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x167')][_0x6c27('0x11e')](db[_0x6c27('0xdf')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x6c27('0x167')][_0x6c27('0x11e')](db[_0x6c27('0x63')],{'as':_0x6c27('0x128'),'foreignKey':_0x6c27('0x169'),'onDelete':'restrict'});db[_0x6c27('0x167')]['hasMany'](db['ChatInteraction'],{'as':_0x6c27('0x129'),'foreignKey':_0x6c27('0x169'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x167')][_0x6c27('0x11e')](db[_0x6c27('0x5b')],{'as':_0x6c27('0x138'),'foreignKey':'ContactId','onDelete':_0x6c27('0x16c')});db[_0x6c27('0x167')]['hasMany'](db[_0x6c27('0x52')],{'as':'FaxInteractions','foreignKey':_0x6c27('0x169'),'onDelete':'restrict'});db[_0x6c27('0x167')][_0x6c27('0x11e')](db[_0x6c27('0x46')],{'as':_0x6c27('0x12b'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x6c27('0x167')]['belongsTo'](db['CmCompany'],{'as':_0x6c27('0x1ab'),'foreignKey':_0x6c27('0x1a7')});db[_0x6c27('0x167')][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':'List','foreignKey':_0x6c27('0x176'),'onDelete':_0x6c27('0x11c')});db['CmContact'][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x1ac')});db[_0x6c27('0x167')][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'as':_0x6c27('0x195'),'through':_0x6c27('0x1ad')});db['CmContact'][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x6c27('0x7a')][_0x6c27('0x11e')](db[_0x6c27('0x1ae')],{'as':_0x6c27('0x1af'),'foreignKey':_0x6c27('0x1b0')});db[_0x6c27('0x7a')][_0x6c27('0x159')](db['CmContact'],{'as':'Contact','foreignKey':_0x6c27('0x169'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x7a')][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':_0x6c27('0x175'),'foreignKey':_0x6c27('0x176'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x7a')]['belongsTo'](db[_0x6c27('0x13')],{'as':_0x6c27('0x19f'),'foreignKey':_0x6c27('0x121')});db[_0x6c27('0x7a')][_0x6c27('0x159')](db[_0x6c27('0x1a')],{'as':'Queue','foreignKey':_0x6c27('0x155'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x7a')][_0x6c27('0x159')](db[_0x6c27('0xf2')],{'as':_0x6c27('0xf2'),'foreignKey':_0x6c27('0x1b1'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x7a')]['belongsTo'](db[_0x6c27('0x13')],{'as':_0x6c27('0x17b'),'foreignKey':_0x6c27('0x1b2')});db[_0x6c27('0x1b3')][_0x6c27('0x159')](db['CmContact'],{'as':_0x6c27('0x168'),'foreignKey':'ContactId','onDelete':_0x6c27('0x11c')});db['CmHopperBlack'][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':'List','foreignKey':_0x6c27('0x176'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x1b3')]['belongsTo'](db['VoiceQueue'],{'as':_0x6c27('0x1a0'),'foreignKey':_0x6c27('0x155'),'onDelete':_0x6c27('0x11c')});db['CmHopperBlack'][_0x6c27('0x159')](db['Campaign'],{'as':_0x6c27('0xf2'),'foreignKey':_0x6c27('0x1b1'),'onDelete':'cascade'});db[_0x6c27('0x82')]['hasMany'](db['Condition'],{'as':{'plural':_0x6c27('0x1b4'),'singular':_0x6c27('0x1b5')},'foreignKey':'AutomationAllId','onDelete':_0x6c27('0x11c'),'hooks':!![]});db[_0x6c27('0x82')][_0x6c27('0x11e')](db[_0x6c27('0x87')],{'as':{'plural':_0x6c27('0x1b6'),'singular':_0x6c27('0x1b7')},'foreignKey':_0x6c27('0x1b8'),'onDelete':_0x6c27('0x11c'),'hooks':!![]});db['Automation'][_0x6c27('0x11e')](db['Action'],{'as':'Actions','foreignKey':_0x6c27('0x1b9'),'onDelete':'cascade','hooks':!![]});db[_0x6c27('0x85')][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':_0x6c27('0x16f'),'foreignKey':_0x6c27('0x1ba'),'onDelete':_0x6c27('0x11c')});db['Interval'][_0x6c27('0x11e')](db[_0x6c27('0x15c')],{'as':'Intervals','foreignKey':_0x6c27('0x15d'),'onDelete':_0x6c27('0x11c'),'hooks':!![],'required':![]});db[_0x6c27('0x15c')]['hasMany'](db[_0x6c27('0x124')],{'as':_0x6c27('0x125'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x6c27('0x15c')][_0x6c27('0x11e')](db[_0x6c27('0x49')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x6c27('0x15c')][_0x6c27('0x11e')](db[_0x6c27('0x6b')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x6c27('0x15c')][_0x6c27('0x11e')](db[_0x6c27('0x18a')],{'as':_0x6c27('0x1bb'),'foreignKey':_0x6c27('0x15d')});db['Interval'][_0x6c27('0x11e')](db[_0x6c27('0x59')],{'as':_0x6c27('0x1bc'),'foreignKey':_0x6c27('0x15d')});db[_0x6c27('0x8f')]['belongsTo'](db[_0x6c27('0x41')],{});db[_0x6c27('0x8f')]['belongsTo'](db[_0x6c27('0x9e')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x6c27('0x159')](db[_0x6c27('0x9c')],{'foreignKey':'CustomReportId'});db[_0x6c27('0x91')][_0x6c27('0x12e')](db[_0x6c27('0x152')],{'as':_0x6c27('0x1bd'),'through':_0x6c27('0x1be'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x93')][_0x6c27('0x12e')](db[_0x6c27('0x167')],{'through':_0x6c27('0x1ad')});db[_0x6c27('0x93')][_0x6c27('0x12e')](db[_0x6c27('0x6d')],{'through':_0x6c27('0x1a4')});db[_0x6c27('0x93')][_0x6c27('0x12e')](db['MailInteraction'],{'through':_0x6c27('0x17c')});db[_0x6c27('0x93')][_0x6c27('0x12e')](db[_0x6c27('0x5b')],{'through':_0x6c27('0x194')});db[_0x6c27('0x93')]['belongsToMany'](db[_0x6c27('0x52')],{'through':_0x6c27('0x1bf')});db[_0x6c27('0x93')][_0x6c27('0x12e')](db['OpenchannelInteraction'],{'through':_0x6c27('0x19a')});db['Tag']['belongsToMany'](db[_0x6c27('0x10c')],{'through':_0x6c27('0x1c0')});db[_0x6c27('0x95')][_0x6c27('0x159')](db['ContactItemType'],{'as':_0x6c27('0x1c1'),'foreignKey':_0x6c27('0x1c2')});db[_0x6c27('0x1ae')][_0x6c27('0x159')](db[_0x6c27('0x7a')],{'as':'Hopper','foreignKey':_0x6c27('0x1b0')});db['CmContactHasItem'][_0x6c27('0x159')](db['CmContact'],{'as':'Contact','foreignKey':_0x6c27('0x1a9')});db[_0x6c27('0x1c3')][_0x6c27('0x11e')](db[_0x6c27('0x87')],{'as':{'plural':'AllConditions','singular':_0x6c27('0x1c4')},'foreignKey':_0x6c27('0x1c5'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x6c27('0x11e')](db[_0x6c27('0x87')],{'as':{'plural':_0x6c27('0x1c6'),'singular':_0x6c27('0x1c7')},'foreignKey':_0x6c27('0x1c8'),'onDelete':_0x6c27('0x11c'),'hooks':!![]});db[_0x6c27('0x1c3')][_0x6c27('0x11e')](db[_0x6c27('0x1c9')],{'as':_0x6c27('0x1ca'),'foreignKey':_0x6c27('0x1cb'),'onDelete':_0x6c27('0x11c'),'hooks':!![]});db[_0x6c27('0x9c')][_0x6c27('0x11e')](db['AnalyticFieldReport'],{'as':_0x6c27('0x1cc'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1cd'),'hooks':!![]});db[_0x6c27('0x9e')]['hasMany'](db[_0x6c27('0xa4')],{'as':_0x6c27('0x1cc'),'onDelete':_0x6c27('0x11c'),'foreignKey':'DefaultReportId'});db[_0x6c27('0xa2')][_0x6c27('0x11e')](db[_0x6c27('0xa4')],{'as':_0x6c27('0x1cc'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1ce')});db[_0x6c27('0xa4')][_0x6c27('0x159')](db[_0x6c27('0xa2')],{'foreignKey':_0x6c27('0x1ce')});db['SalesforceAccount'][_0x6c27('0x11e')](db[_0x6c27('0xa9')],{'as':_0x6c27('0x1cf'),'onDelete':_0x6c27('0x11c'),'foreignKey':'AccountId'});db[_0x6c27('0xa9')][_0x6c27('0x11e')](db[_0x6c27('0xab')],{'as':_0x6c27('0x1d0'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xa9')]['hasMany'](db[_0x6c27('0xab')],{'as':_0x6c27('0x1d2'),'onDelete':'cascade','foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xa9')][_0x6c27('0x11e')](db[_0x6c27('0xab')],{'as':_0x6c27('0x1cc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x6c27('0xa9')][_0x6c27('0x159')](db[_0x6c27('0xa7')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xab')][_0x6c27('0x11e')](db['SalesforceField'],{'as':_0x6c27('0x1d5'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xab')][_0x6c27('0x11e')](db[_0x6c27('0xab')],{'as':_0x6c27('0x1d6'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xab')][_0x6c27('0x11e')](db[_0x6c27('0xab')],{'as':_0x6c27('0x1d7'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xab')][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':'Variable','foreignKey':_0x6c27('0x1da')});db[_0x6c27('0xad')]['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db['SugarcrmConfiguration'][_0x6c27('0x11e')](db[_0x6c27('0xb0')],{'as':_0x6c27('0x1d0'),'onDelete':'cascade','foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xaf')]['hasMany'](db[_0x6c27('0xb0')],{'as':_0x6c27('0x1d2'),'onDelete':_0x6c27('0x11c'),'foreignKey':'DescriptionId'});db[_0x6c27('0xaf')][_0x6c27('0x11e')](db[_0x6c27('0xb0')],{'as':'Fields','onDelete':_0x6c27('0x11c'),'foreignKey':'FieldId'});db[_0x6c27('0xaf')][_0x6c27('0x159')](db[_0x6c27('0xad')],{'as':'Account','foreignKey':'AccountId'});db[_0x6c27('0xb0')][_0x6c27('0x11e')](db[_0x6c27('0xb0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6c27('0xb0')][_0x6c27('0x11e')](db[_0x6c27('0xb0')],{'as':'Description','foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xb0')][_0x6c27('0x11e')](db[_0x6c27('0xb0')],{'as':_0x6c27('0x1d7'),'foreignKey':_0x6c27('0x1d8')});db['SugarcrmField'][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':_0x6c27('0x1da')});db[_0x6c27('0xb2')]['hasMany'](db['DeskConfiguration'],{'as':_0x6c27('0x1cf'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xb4')][_0x6c27('0x11e')](db[_0x6c27('0xb6')],{'as':'Subjects','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d1')});db['DeskConfiguration'][_0x6c27('0x11e')](db[_0x6c27('0xb6')],{'as':_0x6c27('0x1d2'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xb4')][_0x6c27('0x11e')](db[_0x6c27('0xb6')],{'as':'Fields','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xb4')]['belongsTo'](db['DeskAccount'],{'as':_0x6c27('0x17a'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x6c27('0x12e')](db['Tag'],{'through':_0x6c27('0x1db')});db[_0x6c27('0xb6')][_0x6c27('0x11e')](db['DeskField'],{'as':_0x6c27('0x1d5'),'foreignKey':_0x6c27('0x1d1')});db['DeskField']['hasMany'](db[_0x6c27('0xb6')],{'as':_0x6c27('0x1d6'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xb6')][_0x6c27('0x11e')](db['DeskField'],{'as':_0x6c27('0x1d7'),'foreignKey':'FieldId'});db[_0x6c27('0xb6')][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':'VariableId'});db[_0x6c27('0xb8')]['hasMany'](db[_0x6c27('0xba')],{'as':_0x6c27('0x1cf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6c27('0xba')][_0x6c27('0x11e')](db['ZohoField'],{'as':_0x6c27('0x1d0'),'onDelete':_0x6c27('0x11c'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x6c27('0x11e')](db[_0x6c27('0x1dc')],{'as':'Descriptions','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xba')]['hasMany'](db['ZohoField'],{'as':_0x6c27('0x1cc'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x6c27('0xba')]['belongsTo'](db[_0x6c27('0xb8')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0x1dc')]['hasMany'](db[_0x6c27('0x1dc')],{'as':_0x6c27('0x1d5'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0x1dc')][_0x6c27('0x11e')](db[_0x6c27('0x1dc')],{'as':'Description','foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0x1dc')][_0x6c27('0x11e')](db[_0x6c27('0x1dc')],{'as':_0x6c27('0x1d7'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0x1dc')][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':_0x6c27('0x1da')});db[_0x6c27('0xbd')][_0x6c27('0x11e')](db[_0x6c27('0xbf')],{'as':_0x6c27('0x1cf'),'onDelete':_0x6c27('0x11c'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x6c27('0x11e')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x6c27('0x1d1')});db['ZendeskConfiguration'][_0x6c27('0x11e')](db[_0x6c27('0x1dd')],{'as':_0x6c27('0x1d2'),'foreignKey':_0x6c27('0x1d3')});db['ZendeskConfiguration']['hasMany'](db[_0x6c27('0x1dd')],{'as':_0x6c27('0x1cc'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x6c27('0x159')](db[_0x6c27('0xbd')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x1d4')});db['ZendeskConfiguration']['belongsToMany'](db[_0x6c27('0x93')],{'through':_0x6c27('0x1de')});db[_0x6c27('0x1dd')][_0x6c27('0x11e')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0x1dd')][_0x6c27('0x11e')](db[_0x6c27('0x1dd')],{'as':_0x6c27('0x1d6'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0x1dd')][_0x6c27('0x11e')](db[_0x6c27('0x1dd')],{'as':_0x6c27('0x1d7'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0x1dd')]['belongsTo'](db['Variable'],{'as':_0x6c27('0x1d9'),'foreignKey':_0x6c27('0x1da')});db[_0x6c27('0xc1')][_0x6c27('0x11e')](db[_0x6c27('0xc3')],{'as':'Configurations','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xc3')][_0x6c27('0x11e')](db[_0x6c27('0xc5')],{'as':'Subjects','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xc3')][_0x6c27('0x11e')](db['FreshdeskField'],{'as':_0x6c27('0x1d2'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d3')});db['FreshdeskConfiguration'][_0x6c27('0x11e')](db[_0x6c27('0xc5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xc3')][_0x6c27('0x159')](db[_0x6c27('0xc1')],{'as':'Account','foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xc3')][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':_0x6c27('0x1df')});db[_0x6c27('0xc5')][_0x6c27('0x11e')](db[_0x6c27('0xc5')],{'as':_0x6c27('0x1d5'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xc5')][_0x6c27('0x11e')](db['FreshdeskField'],{'as':_0x6c27('0x1d6'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xc5')][_0x6c27('0x11e')](db[_0x6c27('0xc5')],{'as':'Field','foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xc5')][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':_0x6c27('0x1da')});db['VtigerAccount']['hasMany'](db[_0x6c27('0xc8')],{'as':_0x6c27('0x1cf'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xc8')][_0x6c27('0x11e')](db['VtigerField'],{'as':_0x6c27('0x1d0'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xc8')][_0x6c27('0x11e')](db[_0x6c27('0x1e0')],{'as':'Descriptions','foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xc8')][_0x6c27('0x11e')](db[_0x6c27('0x1e0')],{'as':_0x6c27('0x1cc'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xc8')][_0x6c27('0x159')](db[_0x6c27('0xc6')],{'as':_0x6c27('0x17a'),'foreignKey':'AccountId'});db['VtigerField'][_0x6c27('0x11e')](db[_0x6c27('0x1e0')],{'as':_0x6c27('0x1d5'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0x6c27('0x1e0')],{'as':_0x6c27('0x1d6'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0x1e0')][_0x6c27('0x11e')](db['VtigerField'],{'as':_0x6c27('0x1d7'),'foreignKey':'FieldId'});db[_0x6c27('0x1e0')][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':_0x6c27('0x1da')});db[_0x6c27('0xc9')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x6c27('0x1cf'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xcb')][_0x6c27('0x11e')](db[_0x6c27('0x1e1')],{'as':'Subjects','foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xcb')]['hasMany'](db[_0x6c27('0x1e1')],{'as':_0x6c27('0x1d2'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xcb')][_0x6c27('0x11e')](db[_0x6c27('0x1e1')],{'as':'Fields','foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xcb')][_0x6c27('0x159')](db[_0x6c27('0xc9')],{'as':_0x6c27('0x17a'),'foreignKey':'AccountId'});db['ServicenowField'][_0x6c27('0x11e')](db[_0x6c27('0x1e1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6c27('0x1e1')]['hasMany'](db[_0x6c27('0x1e1')],{'as':_0x6c27('0x1d6'),'foreignKey':_0x6c27('0x1d3')});db['ServicenowField'][_0x6c27('0x11e')](db[_0x6c27('0x1e1')],{'as':_0x6c27('0x1d7'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0x1e1')][_0x6c27('0x159')](db['Variable'],{'as':_0x6c27('0x1d9'),'foreignKey':'VariableId'});db[_0x6c27('0x1e2')][_0x6c27('0x11e')](db['Dynamics365Configuration'],{'as':_0x6c27('0x1cf'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0x1e2')][_0x6c27('0x159')](db[_0x6c27('0x113')],{'as':'CloudProvider','foreignKey':_0x6c27('0x16b')});db['Dynamics365Configuration'][_0x6c27('0x11e')](db[_0x6c27('0xce')],{'as':_0x6c27('0x1d0'),'onDelete':'cascade','foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0x1e3')]['hasMany'](db[_0x6c27('0xce')],{'as':_0x6c27('0x1d2'),'onDelete':'cascade','foreignKey':_0x6c27('0x1d3')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x6c27('0x1cc'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0x1e3')][_0x6c27('0x159')](db[_0x6c27('0x1e2')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x1d4')});db['Dynamics365Field'][_0x6c27('0x11e')](db[_0x6c27('0xce')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6c27('0xce')][_0x6c27('0x11e')](db[_0x6c27('0xce')],{'as':'Description','foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xce')][_0x6c27('0x11e')](db['Dynamics365Field'],{'as':_0x6c27('0x1d7'),'foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xce')]['belongsTo'](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':'VariableId'});db[_0x6c27('0xcf')]['hasMany'](db[_0x6c27('0xd1')],{'as':'Configurations','onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xd1')][_0x6c27('0x11e')](db[_0x6c27('0xd3')],{'as':_0x6c27('0x1d0'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x6c27('0x11e')](db[_0x6c27('0xd3')],{'as':_0x6c27('0x1d2'),'foreignKey':_0x6c27('0x1d3')});db[_0x6c27('0xd1')][_0x6c27('0x11e')](db['FreshsalesField'],{'as':_0x6c27('0x1cc'),'foreignKey':'FieldId'});db[_0x6c27('0xd1')]['belongsTo'](db[_0x6c27('0xcf')],{'as':'Account','foreignKey':_0x6c27('0x1d4')});db[_0x6c27('0xd3')][_0x6c27('0x11e')](db[_0x6c27('0xd3')],{'as':_0x6c27('0x1d5'),'foreignKey':_0x6c27('0x1d1')});db[_0x6c27('0xd3')][_0x6c27('0x11e')](db[_0x6c27('0xd3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6c27('0xd3')][_0x6c27('0x11e')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x6c27('0x1d8')});db[_0x6c27('0xd3')][_0x6c27('0x159')](db[_0x6c27('0x1d9')],{'as':_0x6c27('0x1d9'),'foreignKey':_0x6c27('0x1da')});db[_0x6c27('0xd8')]['belongsTo'](db[_0x6c27('0x67')],{});db[_0x6c27('0xd8')][_0x6c27('0x159')](db['CmList'],{'as':_0x6c27('0x175'),'foreignKey':'ListId'});db[_0x6c27('0xd8')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db['ChatQueueReport']['belongsTo'](db[_0x6c27('0x6d')],{});db[_0x6c27('0xd8')][_0x6c27('0x159')](db[_0x6c27('0x19e')],{});db[_0x6c27('0xd8')]['belongsTo'](db[_0x6c27('0x13')],{});db[_0x6c27('0xd8')][_0x6c27('0x159')](db[_0x6c27('0x71')],{});db[_0x6c27('0xda')]['belongsTo'](db[_0x6c27('0x13')],{'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x1e4')});db[_0x6c27('0xda')][_0x6c27('0x159')](db['User'],{'onDelete':_0x6c27('0x11c'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x6c27('0x11e')](db[_0x6c27('0xde')],{'foreignKey':_0x6c27('0x1e5'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x6c27('0x11e')](db[_0x6c27('0xdc')],{'foreignKey':_0x6c27('0x1e5'),'onDelete':'cascade'});db[_0x6c27('0xe1')][_0x6c27('0x159')](db[_0x6c27('0x190')],{});db[_0x6c27('0xe1')][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':_0x6c27('0x175'),'foreignKey':'ListId'});db[_0x6c27('0xe1')]['belongsTo'](db['CmContact'],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0xe1')]['belongsTo'](db[_0x6c27('0x5b')],{});db['SmsQueueReport'][_0x6c27('0x159')](db[_0x6c27('0x192')],{});db['SmsQueueReport'][_0x6c27('0x159')](db[_0x6c27('0x13')],{});db['SmsQueueReport'][_0x6c27('0x159')](db[_0x6c27('0x5d')],{});db['JscriptyProject'][_0x6c27('0x11e')](db[_0x6c27('0xdf')],{'foreignKey':_0x6c27('0x1e6')});db[_0x6c27('0xe6')][_0x6c27('0x11e')](db['JscriptyQuestionReport'],{'foreignKey':_0x6c27('0x1e6')});db['JscriptyProject'][_0x6c27('0x11e')](db[_0x6c27('0xdc')],{'foreignKey':'ProjectId'});db[_0x6c27('0xeb')]['belongsToMany'](db[_0x6c27('0x13')],{'as':'Users','through':_0x6c27('0x14f')});db[_0x6c27('0x134')]['belongsToMany'](db[_0x6c27('0x13')],{'as':_0x6c27('0x178'),'through':'user_has_teams'});db[_0x6c27('0x134')]['belongsToMany'](db['VoiceQueue'],{'through':_0x6c27('0x115'),'as':_0x6c27('0x13c')});db[_0x6c27('0x134')][_0x6c27('0x12e')](db[_0x6c27('0x43')],{'through':_0x6c27('0x179'),'as':'MailQueues'});db[_0x6c27('0x134')][_0x6c27('0x12e')](db['ChatQueue'],{'through':_0x6c27('0x1a6'),'as':_0x6c27('0x13e')});db[_0x6c27('0x134')][_0x6c27('0x12e')](db[_0x6c27('0x55')],{'through':_0x6c27('0x18f'),'as':_0x6c27('0x13f')});db[_0x6c27('0x134')][_0x6c27('0x12e')](db[_0x6c27('0x5d')],{'through':_0x6c27('0x1e7'),'as':_0x6c27('0x140')});db[_0x6c27('0x134')][_0x6c27('0x12e')](db[_0x6c27('0x66')],{'through':'team_has_openchannel_queues','as':_0x6c27('0x1e8')});db[_0x6c27('0x134')][_0x6c27('0x12e')](db[_0x6c27('0x141')],{'through':'team_has_whatsapp_queues','as':_0x6c27('0x142')});db[_0x6c27('0x134')][_0x6c27('0x12e')](db[_0x6c27('0x13d')],{'through':_0x6c27('0x117'),'as':'VoicePrefixes'});db[_0x6c27('0xf2')]['hasMany'](db[_0x6c27('0x7a')],{'as':_0x6c27('0x156'),'foreignKey':_0x6c27('0x1b1')});db[_0x6c27('0xf2')][_0x6c27('0x11e')](db[_0x6c27('0x126')],{'as':_0x6c27('0x127'),'foreignKey':_0x6c27('0x1b1')});db[_0x6c27('0xf2')][_0x6c27('0x11e')](db[_0x6c27('0x7d')],{'as':'HopperHistories','foreignKey':_0x6c27('0x1b1')});db[_0x6c27('0xf2')][_0x6c27('0x11e')](db[_0x6c27('0x1b3')],{'as':_0x6c27('0x157'),'foreignKey':'CampaignId'});db[_0x6c27('0xf2')]['belongsTo'](db[_0x6c27('0x2c')],{'as':_0x6c27('0x2c'),'foreignKey':_0x6c27('0x158')});db[_0x6c27('0xf2')][_0x6c27('0x159')](db[_0x6c27('0x2c')],{'as':_0x6c27('0x15a'),'foreignKey':_0x6c27('0x15b')});db[_0x6c27('0xf2')][_0x6c27('0x159')](db[_0x6c27('0x15c')],{'as':_0x6c27('0x15c'),'foreignKey':'IntervalId'});db['Campaign'][_0x6c27('0x159')](db[_0x6c27('0xeb')],{'as':_0x6c27('0xeb'),'foreignKey':_0x6c27('0x1e9')});db[_0x6c27('0xf2')][_0x6c27('0x12e')](db[_0x6c27('0x143')],{'as':_0x6c27('0x132'),'through':_0x6c27('0x1ea')});db[_0x6c27('0xf2')][_0x6c27('0x12e')](db[_0x6c27('0x143')],{'as':'BlackLists','through':_0x6c27('0x1eb')});db[_0x6c27('0xf6')]['belongsTo'](db[_0x6c27('0x6f')],{'as':_0x6c27('0x6f'),'foreignKey':_0x6c27('0x181')});db[_0x6c27('0x1ec')][_0x6c27('0x159')](db[_0x6c27('0x171')],{});db[_0x6c27('0x1ec')][_0x6c27('0x159')](db[_0x6c27('0x46')],{});db['MailTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x41')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x6c27('0x1ec')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ed'),'as':'FromAgent'});db[_0x6c27('0x1ec')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ee'),'as':_0x6c27('0x1ef')});db[_0x6c27('0x1ec')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x6c27('0x1f0'),'as':'ToQueue'});db[_0x6c27('0x1ec')][_0x6c27('0x159')](db[_0x6c27('0x41')],{'foreignKey':'ToMailAccountId','as':_0x6c27('0x1f1')});db[_0x6c27('0xfb')][_0x6c27('0x159')](db[_0x6c27('0x19e')],{});db[_0x6c27('0xfb')][_0x6c27('0x159')](db[_0x6c27('0x6d')],{});db[_0x6c27('0xfb')][_0x6c27('0x159')](db[_0x6c27('0x67')],{'foreignKey':_0x6c27('0x1f2'),'as':'FromAccount'});db[_0x6c27('0xfb')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ed'),'as':_0x6c27('0x1f3')});db[_0x6c27('0xfb')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ee'),'as':_0x6c27('0x1ef')});db[_0x6c27('0xfb')][_0x6c27('0x159')](db[_0x6c27('0x71')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db[_0x6c27('0x67')],{'foreignKey':_0x6c27('0x1f4'),'as':_0x6c27('0x1f1')});db['FaxTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x18b')],{});db['FaxTransferReport']['belongsTo'](db[_0x6c27('0x52')],{});db[_0x6c27('0xfc')][_0x6c27('0x159')](db[_0x6c27('0x50')],{'foreignKey':_0x6c27('0x1f5'),'as':_0x6c27('0x1f6')});db[_0x6c27('0xfc')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6c27('0xfc')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':'ToUserId','as':_0x6c27('0x1ef')});db[_0x6c27('0xfc')][_0x6c27('0x159')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x6c27('0x1f7')});db['FaxTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x50')],{'foreignKey':_0x6c27('0x1f8'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x63')],{});db[_0x6c27('0xfd')][_0x6c27('0x159')](db['OpenchannelAccount'],{'foreignKey':_0x6c27('0x1f9'),'as':_0x6c27('0x1f6')});db[_0x6c27('0xfd')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ed'),'as':_0x6c27('0x1f3')});db[_0x6c27('0xfd')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ee'),'as':_0x6c27('0x1ef')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6c27('0x66')],{'foreignKey':_0x6c27('0x1fa'),'as':'ToQueue'});db[_0x6c27('0xfd')][_0x6c27('0x159')](db[_0x6c27('0x5f')],{'foreignKey':_0x6c27('0x1fb'),'as':'ToAccount'});db[_0x6c27('0xff')][_0x6c27('0x159')](db[_0x6c27('0x192')],{});db[_0x6c27('0xff')][_0x6c27('0x159')](db[_0x6c27('0x5b')],{});db[_0x6c27('0xff')][_0x6c27('0x159')](db[_0x6c27('0x190')],{'foreignKey':_0x6c27('0x1fc'),'as':_0x6c27('0x1f6')});db['SmsTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':'FromUserId','as':_0x6c27('0x1f3')});db['SmsTransferReport']['belongsTo'](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ee'),'as':_0x6c27('0x1ef')});db['SmsTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x5d')],{'foreignKey':_0x6c27('0x1fd'),'as':_0x6c27('0x1f7')});db[_0x6c27('0xff')][_0x6c27('0x159')](db['SmsAccount'],{'foreignKey':_0x6c27('0x1fe'),'as':_0x6c27('0x1f1')});db['CmList'][_0x6c27('0x11e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6c27('0x176'),'onDelete':_0x6c27('0x11c')});db['CmList']['hasMany'](db[_0x6c27('0x7f')],{'as':_0x6c27('0x1ff'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x143')][_0x6c27('0x11e')](db['CmContact'],{'as':_0x6c27('0x131'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x143')]['hasMany'](db[_0x6c27('0x126')],{'as':_0x6c27('0x127'),'foreignKey':_0x6c27('0x176')});db['CmList'][_0x6c27('0x11e')](db[_0x6c27('0x7d')],{'as':_0x6c27('0x200'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x143')][_0x6c27('0x11e')](db[_0x6c27('0x7e')],{'as':_0x6c27('0x7e'),'foreignKey':_0x6c27('0x176')});db[_0x6c27('0x143')][_0x6c27('0x12e')](db[_0x6c27('0x1a')],{'as':_0x6c27('0x201'),'through':_0x6c27('0x15f')});db[_0x6c27('0x143')][_0x6c27('0x12e')](db['User'],{'as':_0x6c27('0x178'),'through':_0x6c27('0x133')});db[_0x6c27('0x13d')][_0x6c27('0x11e')](db[_0x6c27('0x124')],{'as':_0x6c27('0x125'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x13d')][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x178'),'through':'UserVoicePrefix'});db[_0x6c27('0x13d')][_0x6c27('0x12e')](db[_0x6c27('0x134')],{'through':_0x6c27('0x117'),'as':_0x6c27('0x160')});db[_0x6c27('0x102')][_0x6c27('0x11e')](db[_0x6c27('0x13')],{'as':'Users','foreignKey':_0x6c27('0x202')});db[_0x6c27('0x102')][_0x6c27('0x11e')](db[_0x6c27('0x104')],{'as':_0x6c27('0x203'),'foreignKey':_0x6c27('0x202'),'onDelete':'cascade'});db[_0x6c27('0x104')][_0x6c27('0x11e')](db[_0x6c27('0x106')],{'as':_0x6c27('0x204'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x6c27('0x109')][_0x6c27('0x11e')](db[_0x6c27('0x85')],{'as':_0x6c27('0x16f'),'foreignKey':_0x6c27('0x205'),'onDelete':_0x6c27('0x11c')});db[_0x6c27('0x109')][_0x6c27('0x11e')](db[_0x6c27('0x186')],{'as':_0x6c27('0x170'),'foreignKey':'WhatsappAccountId'});db[_0x6c27('0x109')][_0x6c27('0x11e')](db[_0x6c27('0x10d')],{'as':_0x6c27('0x172'),'foreignKey':_0x6c27('0x205')});db['WhatsappAccount'][_0x6c27('0x11e')](db[_0x6c27('0x10c')],{'as':_0x6c27('0x173')});db[_0x6c27('0x109')][_0x6c27('0x11e')](db[_0x6c27('0x10a')],{'as':'Applications'});db[_0x6c27('0x109')][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':'List','foreignKey':'ListId'});db[_0x6c27('0x109')][_0x6c27('0x159')](db[_0x6c27('0x177')],{'as':_0x6c27('0x188'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6c27('0x109')][_0x6c27('0x12e')](db[_0x6c27('0x13')],{'as':_0x6c27('0x178'),'through':_0x6c27('0x206')});db[_0x6c27('0x10a')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x10a')][_0x6c27('0x159')](db[_0x6c27('0x141')],{'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x10a')][_0x6c27('0x159')](db[_0x6c27('0x109')],{'onDelete':'restrict'});db[_0x6c27('0x10a')]['belongsTo'](db['Interval'],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x15d')});db[_0x6c27('0x10a')][_0x6c27('0x159')](db[_0x6c27('0x93')],{'onDelete':_0x6c27('0x16c'),'foreignKey':_0x6c27('0x182')});db[_0x6c27('0x10c')][_0x6c27('0x11e')](db[_0x6c27('0x10d')],{'as':_0x6c27('0x172'),'onDelete':_0x6c27('0x11c'),'foreignKey':_0x6c27('0x207')});db[_0x6c27('0x10c')][_0x6c27('0x159')](db[_0x6c27('0x109')],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x205')});db['WhatsappInteraction']['belongsTo'](db[_0x6c27('0x167')],{'as':'Contact','foreignKey':_0x6c27('0x169')});db['WhatsappInteraction'][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':_0x6c27('0x17b'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':'whatsapp_interaction_has_tags','as':_0x6c27('0x195')});db[_0x6c27('0x10c')][_0x6c27('0x12e')](db[_0x6c27('0x93')],{'through':_0x6c27('0x1c0'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x6c27('0x12e')](db['User'],{'as':_0x6c27('0x17e'),'through':_0x6c27('0x13b'),'foreignKey':_0x6c27('0x207')});db[_0x6c27('0x10d')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'as':_0x6c27('0x13')});db[_0x6c27('0x10d')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'onDelete':'cascade','as':_0x6c27('0x168')});db['WhatsappMessage'][_0x6c27('0x159')](db[_0x6c27('0x10c')],{'onDelete':_0x6c27('0x11c'),'as':_0x6c27('0x18d'),'foreignKey':_0x6c27('0x207')});db['WhatsappMessage'][_0x6c27('0x159')](db['WhatsappAccount'],{'as':_0x6c27('0x17a'),'foreignKey':_0x6c27('0x205')});db['WhatsappQueueReport'][_0x6c27('0x159')](db['WhatsappAccount'],{});db[_0x6c27('0x10f')][_0x6c27('0x159')](db[_0x6c27('0x143')],{'as':'List','foreignKey':'ListId'});db[_0x6c27('0x10f')][_0x6c27('0x159')](db[_0x6c27('0x167')],{'as':_0x6c27('0x168'),'foreignKey':_0x6c27('0x169')});db[_0x6c27('0x10f')][_0x6c27('0x159')](db[_0x6c27('0x10c')],{});db['WhatsappQueueReport'][_0x6c27('0x159')](db[_0x6c27('0x141')],{});db[_0x6c27('0x10f')]['belongsTo'](db[_0x6c27('0x10d')],{});db['WhatsappQueueReport'][_0x6c27('0x159')](db[_0x6c27('0x13')],{});db['WhatsappTransferReport'][_0x6c27('0x159')](db[_0x6c27('0x10d')],{});db[_0x6c27('0x111')][_0x6c27('0x159')](db[_0x6c27('0x10c')],{});db[_0x6c27('0x111')][_0x6c27('0x159')](db[_0x6c27('0x109')],{'foreignKey':_0x6c27('0x208'),'as':_0x6c27('0x1f6')});db['WhatsappTransferReport'][_0x6c27('0x159')](db['WhatsappAccount'],{'foreignKey':_0x6c27('0x209'),'as':_0x6c27('0x1f1')});db[_0x6c27('0x111')][_0x6c27('0x159')](db[_0x6c27('0x141')],{'foreignKey':_0x6c27('0x20a'),'as':_0x6c27('0x1f7')});db[_0x6c27('0x111')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':_0x6c27('0x1ed'),'as':_0x6c27('0x1f3')});db[_0x6c27('0x111')][_0x6c27('0x159')](db[_0x6c27('0x13')],{'foreignKey':'ToUserId','as':_0x6c27('0x1ef')});db[_0x6c27('0x141')][_0x6c27('0x12e')](db['User'],{'as':'Agents','through':_0x6c27('0x3c'),'foreignKey':_0x6c27('0x20b')});db[_0x6c27('0x141')]['belongsToMany'](db[_0x6c27('0x134')],{'through':_0x6c27('0x20c'),'as':_0x6c27('0x160')});db[_0x6c27('0x11a')]['belongsTo'](db[_0x6c27('0x13')],{'as':'user','foreignKey':_0x6c27('0x121'),'onDelete':_0x6c27('0x11c'),'hooks':!![]});db[_0x6c27('0x113')]['hasOne'](db['Dynamics365Account'],{'as':_0x6c27('0x1e2'),'onDelete':_0x6c27('0x16c')});db['CloudProvider'][_0x6c27('0x11b')](db['MailServerIn'],{'as':_0x6c27('0x16d'),'onDelete':_0x6c27('0x16c')});db[_0x6c27('0x113')][_0x6c27('0x11b')](db['MailServerOut'],{'as':_0x6c27('0x16e'),'onDelete':'restrict'});module[_0x6c27('0x20d')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f6bde53..d5cd450 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6b5=['/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./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/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','root','/snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express','./errors','setupLoggers','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField'];(function(_0x5491a4,_0x34c5ac){var _0x179e7c=function(_0x57cacb){while(--_0x57cacb){_0x5491a4['push'](_0x5491a4['shift']());}};_0x179e7c(++_0x34c5ac);}(_0xe6b5,0x19b));var _0x5e6b=function(_0x78a2d8,_0x1c2137){_0x78a2d8=_0x78a2d8-0x0;var _0x34cb72=_0xe6b5[_0x78a2d8];return _0x34cb72;};'use strict';var path=require(_0x5e6b('0x0'));var express=require(_0x5e6b('0x1'));var errors=require(_0x5e6b('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x5e6b('0x3')];var clientSideLogs=require('./api/client-side-logs');exports[_0x5e6b('0x4')]=function(_0x4b5e68){return setupLoggers(_0x4b5e68)[_0x5e6b('0x5')](function(){_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x7'),require(_0x5e6b('0x8')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x9'),require('./api/voiceChanSpy'));_0x4b5e68[_0x5e6b('0x6')]('/api/voice/contexts',require(_0x5e6b('0xa')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xb'),require(_0x5e6b('0xc')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xd'),require('./api/voiceMusicOnHold'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xe'),require(_0x5e6b('0xf')));_0x4b5e68['use'](_0x5e6b('0x10'),require(_0x5e6b('0x11')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x12'),require(_0x5e6b('0x13')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x14'),require(_0x5e6b('0x15')));_0x4b5e68[_0x5e6b('0x6')]('/api/voice/mails/messages',require(_0x5e6b('0x16')));_0x4b5e68['use']('/api/voice/calls/reports',require(_0x5e6b('0x17')));_0x4b5e68[_0x5e6b('0x6')]('/api/voice/dials/reports',require(_0x5e6b('0x18')));_0x4b5e68['use'](_0x5e6b('0x19'),require(_0x5e6b('0x1a')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x1b'),require('./api/voiceQueueReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x1c'),require(_0x5e6b('0x1d')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x1e'),require(_0x5e6b('0x1f')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x20'),require('./api/voiceTransferReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x21'),require(_0x5e6b('0x22')));_0x4b5e68['use']('/api/mail/accounts',require(_0x5e6b('0x23')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x24'),require('./api/mailQueue'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x25'),require(_0x5e6b('0x26')));_0x4b5e68[_0x5e6b('0x6')]('/api/mail/interactions',require(_0x5e6b('0x27')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x28'),require(_0x5e6b('0x29')));_0x4b5e68[_0x5e6b('0x6')]('/api/mail/applications',require(_0x5e6b('0x2a')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x2b'),require('./api/mailQueueReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x2c'),require(_0x5e6b('0x2d')));_0x4b5e68[_0x5e6b('0x6')]('/api/dashboards/items',require('./api/dashboardItem'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x2e'),require(_0x5e6b('0x2f')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x30'),require('./api/faxApplication'));_0x4b5e68[_0x5e6b('0x6')]('/api/fax/interactions',require(_0x5e6b('0x31')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x32'),require(_0x5e6b('0x33')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x34'),require('./api/faxQueue'));_0x4b5e68['use'](_0x5e6b('0x35'),require(_0x5e6b('0x36')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x37'),require(_0x5e6b('0x38')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x39'),require(_0x5e6b('0x3a')));_0x4b5e68['use'](_0x5e6b('0x3b'),require(_0x5e6b('0x3c')));_0x4b5e68[_0x5e6b('0x6')]('/api/sms/messages',require(_0x5e6b('0x3d')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x3e'),require(_0x5e6b('0x3f')));_0x4b5e68['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x4b5e68['use'](_0x5e6b('0x40'),require(_0x5e6b('0x41')));_0x4b5e68['use'](_0x5e6b('0x42'),require('./api/openchannelInteraction'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x43'),require(_0x5e6b('0x44')));_0x4b5e68[_0x5e6b('0x6')]('/api/openchannel/queues',require(_0x5e6b('0x45')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x46'),require('./api/chatWebsite'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x47'),require('./api/openchannelQueueReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x48'),require(_0x5e6b('0x49')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x4a'),require(_0x5e6b('0x4b')));_0x4b5e68[_0x5e6b('0x6')]('/api/chat/messages',require('./api/chatMessage'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x4c'),require('./api/chatOfflineMessage'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x4d'),require(_0x5e6b('0x4e')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x4f'),require('./api/chatGroup'));_0x4b5e68['use'](_0x5e6b('0x50'),require('./api/chatProactiveAction'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x51'),require(_0x5e6b('0x52')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x53'),require(_0x5e6b('0x54')));_0x4b5e68['use'](_0x5e6b('0x55'),require('./api/cmHopper'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x56'),require(_0x5e6b('0x57')));_0x4b5e68[_0x5e6b('0x6')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x4b5e68['use'](_0x5e6b('0x58'),require(_0x5e6b('0x59')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x5a'),require(_0x5e6b('0x5b')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x5c'),require('./api/action'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x5d'),require(_0x5e6b('0x5e')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x5f'),require('./api/cannedAnswer'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x60'),require(_0x5e6b('0x61')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x62'),require(_0x5e6b('0x63')));_0x4b5e68['use']('/api/intervals',require(_0x5e6b('0x64')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x65'),require(_0x5e6b('0x66')));_0x4b5e68['use'](_0x5e6b('0x67'),require(_0x5e6b('0x68')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x69'),require(_0x5e6b('0x6a')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x6b'),require(_0x5e6b('0x6c')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x6d'),require(_0x5e6b('0x6e')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x6f'),require(_0x5e6b('0x70')));_0x4b5e68['use'](_0x5e6b('0x71'),require(_0x5e6b('0x72')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x73'),require(_0x5e6b('0x74')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x75'),require(_0x5e6b('0x76')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x77'),require('./api/template'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x78'),require(_0x5e6b('0x79')));_0x4b5e68['use'](_0x5e6b('0x7a'),require(_0x5e6b('0x7b')));_0x4b5e68[_0x5e6b('0x6')]('/api/integrations',require(_0x5e6b('0x7c')));_0x4b5e68['use'](_0x5e6b('0x7d'),require(_0x5e6b('0x7e')));_0x4b5e68[_0x5e6b('0x6')]('/api/analytics/custom_reports',require(_0x5e6b('0x7f')));_0x4b5e68['use'](_0x5e6b('0x80'),require('./api/analyticDefaultReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x81'),require(_0x5e6b('0x82')));_0x4b5e68[_0x5e6b('0x6')]('/api/analytics/metrics',require(_0x5e6b('0x83')));_0x4b5e68[_0x5e6b('0x6')]('/api/analytics/field_reports',require(_0x5e6b('0x84')));_0x4b5e68[_0x5e6b('0x6')]('/api/analytics/tree_reports',require(_0x5e6b('0x85')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x86'),require('./api/intSalesforceAccount'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x87'),require(_0x5e6b('0x88')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x89'),require(_0x5e6b('0x8a')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x8b'),require(_0x5e6b('0x8c')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x8d'),require(_0x5e6b('0x8e')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x8f'),require(_0x5e6b('0x90')));_0x4b5e68['use']('/api/integrations/desk/accounts',require(_0x5e6b('0x91')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x92'),require(_0x5e6b('0x93')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x94'),require(_0x5e6b('0x95')));_0x4b5e68['use']('/api/integrations/zoho/accounts',require(_0x5e6b('0x96')));_0x4b5e68['use'](_0x5e6b('0x97'),require(_0x5e6b('0x98')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x99'),require('./api/intZohoField'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x9a'),require(_0x5e6b('0x9b')));_0x4b5e68['use']('/api/integrations/zendesk/configurations',require(_0x5e6b('0x9c')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x9d'),require(_0x5e6b('0x9e')));_0x4b5e68[_0x5e6b('0x6')]('/api/integrations/freshdesk/accounts',require(_0x5e6b('0x9f')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xa0'),require(_0x5e6b('0xa1')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xa2'),require(_0x5e6b('0xa3')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xa4'),require(_0x5e6b('0xa5')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xa6'),require(_0x5e6b('0xa7')));_0x4b5e68['use'](_0x5e6b('0xa8'),require(_0x5e6b('0xa9')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xaa'),require(_0x5e6b('0xab')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xac'),require(_0x5e6b('0xad')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xae'),require('./api/intServicenowField'));_0x4b5e68[_0x5e6b('0x6')]('/api/integrations/dynamics365/accounts',require(_0x5e6b('0xaf')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xb0'),require(_0x5e6b('0xb1')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xb2'),require(_0x5e6b('0xb3')));_0x4b5e68['use'](_0x5e6b('0xb4'),require(_0x5e6b('0xb5')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xb6'),require('./api/intFreshsalesConfiguration'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xb7'),require(_0x5e6b('0xb8')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xb9'),require(_0x5e6b('0xba')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xbb'),require(_0x5e6b('0xbc')));_0x4b5e68['use']('/api/chat/internal/messages',require(_0x5e6b('0xbd')));_0x4b5e68['use'](_0x5e6b('0xbe'),require(_0x5e6b('0xbf')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xc0'),require('./api/jscriptyQuestionReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xc1'),require(_0x5e6b('0xc2')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xc3'),require(_0x5e6b('0xc4')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xc5'),require('./api/squareReport'));_0x4b5e68['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x4b5e68[_0x5e6b('0x6')]('/api/jscripty/projects',require(_0x5e6b('0xc6')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xc7'),require('./api/setting'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xc8'),require(_0x5e6b('0xc9')));_0x4b5e68[_0x5e6b('0x6')]('/api/square/projects',require(_0x5e6b('0xca')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xcb'),require(_0x5e6b('0xcc')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xcd'),require(_0x5e6b('0xce')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xcf'),require('./api/team'));_0x4b5e68[_0x5e6b('0x6')]('/api/license',require('./api/license'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xd0'),require(_0x5e6b('0xd1')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xd2'),require('./api/migration'));_0x4b5e68['use']('/api/attachments',require(_0x5e6b('0xd3')));_0x4b5e68['use']('/api/plugins',require('./api/plugin'));_0x4b5e68['use'](_0x5e6b('0xd4'),require(_0x5e6b('0xd5')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xd6'),require('./api/chatTransferReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xd7'),require('./api/faxTransferReport'));_0x4b5e68[_0x5e6b('0x6')]('/api/openchannel/reports/transfer',require(_0x5e6b('0xd8')));_0x4b5e68['use'](_0x5e6b('0xd9'),require(_0x5e6b('0xda')));_0x4b5e68['use'](_0x5e6b('0xdb'),require(_0x5e6b('0xdc')));_0x4b5e68['use'](_0x5e6b('0xdd'),require(_0x5e6b('0xde')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xdf'),require(_0x5e6b('0xe0')));_0x4b5e68[_0x5e6b('0x6')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xe1'),require(_0x5e6b('0xe2')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xe3'),require(_0x5e6b('0xe4')));_0x4b5e68['use'](_0x5e6b('0xe5'),require(_0x5e6b('0xe6')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xe7'),require(_0x5e6b('0xe8')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xe9'),require(_0x5e6b('0xea')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xeb'),require(_0x5e6b('0xec')));_0x4b5e68['use'](_0x5e6b('0xed'),require(_0x5e6b('0xee')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xef'),require('./api/whatsappTransferReport'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xf0'),require(_0x5e6b('0xf1')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xf2'),require(_0x5e6b('0xf3')));_0x4b5e68[_0x5e6b('0x6')]('/api/realtime',require(_0x5e6b('0xf4')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xf5'),require(_0x5e6b('0xf6')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xf7'),require(_0x5e6b('0xf8')));_0x4b5e68['use'](_0x5e6b('0xf9'),require(_0x5e6b('0xfa')));_0x4b5e68['use'](_0x5e6b('0xfb'),require(_0x5e6b('0xfc')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xfd'),require(_0x5e6b('0xfe')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0xff'),require('./api/rpc'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x100'),require('./api/version'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x101'),require(_0x5e6b('0x102')));_0x4b5e68[_0x5e6b('0x6')]('/api/pm2',require('./api/pm2'));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x103'),require(_0x5e6b('0x104')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x105'),clientSideLogs);_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x106'),express[_0x5e6b('0x107')](path[_0x5e6b('0x108')](config['root'],_0x5e6b('0x106'))));_0x4b5e68['use'](_0x5e6b('0x109'),express[_0x5e6b('0x107')](path[_0x5e6b('0x108')](config['root'],'/www')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x10a'),express[_0x5e6b('0x107')](path[_0x5e6b('0x108')](config[_0x5e6b('0x10b')],_0x5e6b('0x10a'))));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x10c'),express[_0x5e6b('0x107')](path[_0x5e6b('0x108')](config[_0x5e6b('0x10b')],'snippet','3.0.0')));_0x4b5e68[_0x5e6b('0x6')](_0x5e6b('0x10d'),express['static'](path['join'](config['root'],_0x5e6b('0x10e'))));_0x4b5e68['route'](_0x5e6b('0x10f'))[_0x5e6b('0x110')](errors[0x194]);_0x4b5e68['route']('/*')[_0x5e6b('0x110')](function(_0xef27bb,_0x4a0c8e){_0x4a0c8e['sendFile'](path['resolve'](_0x4b5e68[_0x5e6b('0x110')](_0x5e6b('0x111'))+_0x5e6b('0x112')));});return _0x4b5e68;});}; \ No newline at end of file +var _0xe83c=['/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/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/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','./api/campaign','./api/migration','/api/attachments','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','/www','join','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType'];(function(_0xa72f31,_0x3f8265){var _0x3ecc9f=function(_0x2d9455){while(--_0x2d9455){_0xa72f31['push'](_0xa72f31['shift']());}};_0x3ecc9f(++_0x3f8265);}(_0xe83c,0x95));var _0xce83=function(_0x1cc925,_0x4c59a1){_0x1cc925=_0x1cc925-0x0;var _0x5a2e6c=_0xe83c[_0x1cc925];return _0x5a2e6c;};'use strict';var path=require('path');var express=require(_0xce83('0x0'));var errors=require(_0xce83('0x1'));var config=require(_0xce83('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0xce83('0x3')];var clientSideLogs=require(_0xce83('0x4'));exports[_0xce83('0x5')]=function(_0x8580f5){return setupLoggers(_0x8580f5)[_0xce83('0x6')](function(){_0x8580f5[_0xce83('0x7')](_0xce83('0x8'),require('./api/user'));_0x8580f5['use'](_0xce83('0x9'),require(_0xce83('0xa')));_0x8580f5[_0xce83('0x7')]('/api/voice/contexts',require(_0xce83('0xb')));_0x8580f5[_0xce83('0x7')](_0xce83('0xc'),require('./api/voiceExtension'));_0x8580f5[_0xce83('0x7')](_0xce83('0xd'),require(_0xce83('0xe')));_0x8580f5[_0xce83('0x7')](_0xce83('0xf'),require('./api/voiceQueue'));_0x8580f5['use'](_0xce83('0x10'),require('./api/voiceRecording'));_0x8580f5[_0xce83('0x7')](_0xce83('0x11'),require(_0xce83('0x12')));_0x8580f5[_0xce83('0x7')](_0xce83('0x13'),require(_0xce83('0x14')));_0x8580f5['use'](_0xce83('0x15'),require(_0xce83('0x16')));_0x8580f5[_0xce83('0x7')](_0xce83('0x17'),require(_0xce83('0x18')));_0x8580f5[_0xce83('0x7')]('/api/voice/dials/reports',require(_0xce83('0x19')));_0x8580f5['use'](_0xce83('0x1a'),require(_0xce83('0x1b')));_0x8580f5[_0xce83('0x7')](_0xce83('0x1c'),require('./api/voiceQueueReport'));_0x8580f5['use'](_0xce83('0x1d'),require(_0xce83('0x1e')));_0x8580f5['use'](_0xce83('0x1f'),require(_0xce83('0x20')));_0x8580f5[_0xce83('0x7')](_0xce83('0x21'),require(_0xce83('0x22')));_0x8580f5[_0xce83('0x7')](_0xce83('0x23'),require(_0xce83('0x24')));_0x8580f5[_0xce83('0x7')](_0xce83('0x25'),require(_0xce83('0x26')));_0x8580f5[_0xce83('0x7')](_0xce83('0x27'),require('./api/mailQueue'));_0x8580f5[_0xce83('0x7')](_0xce83('0x28'),require(_0xce83('0x29')));_0x8580f5[_0xce83('0x7')](_0xce83('0x2a'),require(_0xce83('0x2b')));_0x8580f5[_0xce83('0x7')](_0xce83('0x2c'),require(_0xce83('0x2d')));_0x8580f5['use']('/api/mail/applications',require(_0xce83('0x2e')));_0x8580f5[_0xce83('0x7')]('/api/mail/reports/queue',require(_0xce83('0x2f')));_0x8580f5[_0xce83('0x7')](_0xce83('0x30'),require('./api/dashboard'));_0x8580f5[_0xce83('0x7')]('/api/dashboards/items',require(_0xce83('0x31')));_0x8580f5['use'](_0xce83('0x32'),require(_0xce83('0x33')));_0x8580f5['use']('/api/fax/applications',require(_0xce83('0x34')));_0x8580f5[_0xce83('0x7')](_0xce83('0x35'),require('./api/faxInteraction'));_0x8580f5[_0xce83('0x7')](_0xce83('0x36'),require('./api/faxMessage'));_0x8580f5['use']('/api/fax/queues',require(_0xce83('0x37')));_0x8580f5['use']('/api/fax/reports/queue',require(_0xce83('0x38')));_0x8580f5['use'](_0xce83('0x39'),require(_0xce83('0x3a')));_0x8580f5[_0xce83('0x7')](_0xce83('0x3b'),require(_0xce83('0x3c')));_0x8580f5['use'](_0xce83('0x3d'),require('./api/smsInteraction'));_0x8580f5[_0xce83('0x7')](_0xce83('0x3e'),require('./api/smsMessage'));_0x8580f5['use'](_0xce83('0x3f'),require(_0xce83('0x40')));_0x8580f5[_0xce83('0x7')](_0xce83('0x41'),require(_0xce83('0x42')));_0x8580f5[_0xce83('0x7')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x8580f5[_0xce83('0x7')](_0xce83('0x43'),require(_0xce83('0x44')));_0x8580f5[_0xce83('0x7')](_0xce83('0x45'),require('./api/openchannelMessage'));_0x8580f5[_0xce83('0x7')]('/api/openchannel/queues',require(_0xce83('0x46')));_0x8580f5[_0xce83('0x7')](_0xce83('0x47'),require(_0xce83('0x48')));_0x8580f5[_0xce83('0x7')]('/api/openchannel/reports/queue',require(_0xce83('0x49')));_0x8580f5[_0xce83('0x7')](_0xce83('0x4a'),require(_0xce83('0x4b')));_0x8580f5['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x8580f5[_0xce83('0x7')](_0xce83('0x4c'),require(_0xce83('0x4d')));_0x8580f5[_0xce83('0x7')](_0xce83('0x4e'),require(_0xce83('0x4f')));_0x8580f5[_0xce83('0x7')](_0xce83('0x50'),require(_0xce83('0x51')));_0x8580f5['use'](_0xce83('0x52'),require(_0xce83('0x53')));_0x8580f5[_0xce83('0x7')](_0xce83('0x54'),require(_0xce83('0x55')));_0x8580f5['use'](_0xce83('0x56'),require(_0xce83('0x57')));_0x8580f5[_0xce83('0x7')](_0xce83('0x58'),require('./api/cmContact'));_0x8580f5['use']('/api/cm/hopper',require(_0xce83('0x59')));_0x8580f5[_0xce83('0x7')](_0xce83('0x5a'),require(_0xce83('0x5b')));_0x8580f5['use'](_0xce83('0x5c'),require(_0xce83('0x5d')));_0x8580f5['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x8580f5[_0xce83('0x7')](_0xce83('0x5e'),require('./api/cmCustomField'));_0x8580f5[_0xce83('0x7')]('/api/actions',require('./api/action'));_0x8580f5['use'](_0xce83('0x5f'),require('./api/automation'));_0x8580f5[_0xce83('0x7')](_0xce83('0x60'),require(_0xce83('0x61')));_0x8580f5[_0xce83('0x7')](_0xce83('0x62'),require('./api/disposition'));_0x8580f5[_0xce83('0x7')](_0xce83('0x63'),require(_0xce83('0x64')));_0x8580f5[_0xce83('0x7')](_0xce83('0x65'),require('./api/interval'));_0x8580f5[_0xce83('0x7')](_0xce83('0x66'),require(_0xce83('0x67')));_0x8580f5[_0xce83('0x7')]('/api/cdr',require(_0xce83('0x68')));_0x8580f5[_0xce83('0x7')]('/api/voiceQueuesLog',require(_0xce83('0x69')));_0x8580f5[_0xce83('0x7')](_0xce83('0x6a'),require(_0xce83('0x6b')));_0x8580f5[_0xce83('0x7')](_0xce83('0x6c'),require(_0xce83('0x6d')));_0x8580f5[_0xce83('0x7')](_0xce83('0x6e'),require(_0xce83('0x6f')));_0x8580f5[_0xce83('0x7')](_0xce83('0x70'),require(_0xce83('0x71')));_0x8580f5[_0xce83('0x7')](_0xce83('0x72'),require(_0xce83('0x73')));_0x8580f5[_0xce83('0x7')](_0xce83('0x74'),require('./api/cmHopperAdditionalPhone'));_0x8580f5[_0xce83('0x7')](_0xce83('0x75'),require(_0xce83('0x76')));_0x8580f5['use'](_0xce83('0x77'),require(_0xce83('0x78')));_0x8580f5[_0xce83('0x7')]('/api/variables',require(_0xce83('0x79')));_0x8580f5[_0xce83('0x7')](_0xce83('0x7a'),require(_0xce83('0x7b')));_0x8580f5[_0xce83('0x7')](_0xce83('0x7c'),require(_0xce83('0x7d')));_0x8580f5['use']('/api/analytics/custom_reports',require(_0xce83('0x7e')));_0x8580f5[_0xce83('0x7')](_0xce83('0x7f'),require('./api/analyticDefaultReport'));_0x8580f5['use']('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x8580f5['use'](_0xce83('0x80'),require(_0xce83('0x81')));_0x8580f5[_0xce83('0x7')](_0xce83('0x82'),require('./api/analyticFieldReport'));_0x8580f5['use'](_0xce83('0x83'),require(_0xce83('0x84')));_0x8580f5['use'](_0xce83('0x85'),require(_0xce83('0x86')));_0x8580f5[_0xce83('0x7')]('/api/integrations/salesforce/configurations',require(_0xce83('0x87')));_0x8580f5['use'](_0xce83('0x88'),require('./api/intSalesforceField'));_0x8580f5['use'](_0xce83('0x89'),require(_0xce83('0x8a')));_0x8580f5[_0xce83('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xce83('0x8b')));_0x8580f5[_0xce83('0x7')]('/api/integrations/sugarcrm/fields',require(_0xce83('0x8c')));_0x8580f5[_0xce83('0x7')](_0xce83('0x8d'),require(_0xce83('0x8e')));_0x8580f5['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x8580f5['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x8580f5['use']('/api/integrations/zoho/accounts',require(_0xce83('0x8f')));_0x8580f5['use'](_0xce83('0x90'),require(_0xce83('0x91')));_0x8580f5[_0xce83('0x7')](_0xce83('0x92'),require(_0xce83('0x93')));_0x8580f5[_0xce83('0x7')](_0xce83('0x94'),require(_0xce83('0x95')));_0x8580f5[_0xce83('0x7')](_0xce83('0x96'),require('./api/intZendeskConfiguration'));_0x8580f5['use'](_0xce83('0x97'),require(_0xce83('0x98')));_0x8580f5['use'](_0xce83('0x99'),require(_0xce83('0x9a')));_0x8580f5['use']('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x8580f5['use'](_0xce83('0x9b'),require('./api/intFreshdeskField'));_0x8580f5[_0xce83('0x7')](_0xce83('0x9c'),require(_0xce83('0x9d')));_0x8580f5['use'](_0xce83('0x9e'),require('./api/intVtigerConfiguration'));_0x8580f5[_0xce83('0x7')](_0xce83('0x9f'),require(_0xce83('0xa0')));_0x8580f5[_0xce83('0x7')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x8580f5['use'](_0xce83('0xa1'),require(_0xce83('0xa2')));_0x8580f5[_0xce83('0x7')](_0xce83('0xa3'),require(_0xce83('0xa4')));_0x8580f5[_0xce83('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x8580f5[_0xce83('0x7')](_0xce83('0xa5'),require(_0xce83('0xa6')));_0x8580f5['use'](_0xce83('0xa7'),require(_0xce83('0xa8')));_0x8580f5['use'](_0xce83('0xa9'),require(_0xce83('0xaa')));_0x8580f5[_0xce83('0x7')]('/api/integrations/freshsales/configurations',require(_0xce83('0xab')));_0x8580f5[_0xce83('0x7')]('/api/integrations/freshsales/fields',require(_0xce83('0xac')));_0x8580f5['use']('/api/networks',require(_0xce83('0xad')));_0x8580f5[_0xce83('0x7')](_0xce83('0xae'),require(_0xce83('0xaf')));_0x8580f5['use'](_0xce83('0xb0'),require(_0xce83('0xb1')));_0x8580f5[_0xce83('0x7')](_0xce83('0xb2'),require('./api/jscriptyAnswerReport'));_0x8580f5['use'](_0xce83('0xb3'),require(_0xce83('0xb4')));_0x8580f5[_0xce83('0x7')](_0xce83('0xb5'),require(_0xce83('0xb6')));_0x8580f5[_0xce83('0x7')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x8580f5[_0xce83('0x7')]('/api/square/reports',require(_0xce83('0xb7')));_0x8580f5[_0xce83('0x7')](_0xce83('0xb8'),require(_0xce83('0xb9')));_0x8580f5['use'](_0xce83('0xba'),require(_0xce83('0xbb')));_0x8580f5[_0xce83('0x7')](_0xce83('0xbc'),require(_0xce83('0xbd')));_0x8580f5[_0xce83('0x7')](_0xce83('0xbe'),require(_0xce83('0xbf')));_0x8580f5[_0xce83('0x7')](_0xce83('0xc0'),require(_0xce83('0xc1')));_0x8580f5[_0xce83('0x7')](_0xce83('0xc2'),require('./api/squareRecording'));_0x8580f5[_0xce83('0x7')]('/api/square/messages',require(_0xce83('0xc3')));_0x8580f5[_0xce83('0x7')](_0xce83('0xc4'),require(_0xce83('0xc5')));_0x8580f5[_0xce83('0x7')]('/api/license',require('./api/license'));_0x8580f5[_0xce83('0x7')]('/api/campaigns',require(_0xce83('0xc6')));_0x8580f5[_0xce83('0x7')]('/api/migrations',require(_0xce83('0xc7')));_0x8580f5[_0xce83('0x7')](_0xce83('0xc8'),require('./api/attachment'));_0x8580f5[_0xce83('0x7')]('/api/plugins',require(_0xce83('0xc9')));_0x8580f5['use'](_0xce83('0xca'),require('./api/mailTransferReport'));_0x8580f5[_0xce83('0x7')](_0xce83('0xcb'),require(_0xce83('0xcc')));_0x8580f5['use'](_0xce83('0xcd'),require(_0xce83('0xce')));_0x8580f5[_0xce83('0x7')](_0xce83('0xcf'),require(_0xce83('0xd0')));_0x8580f5[_0xce83('0x7')](_0xce83('0xd1'),require(_0xce83('0xd2')));_0x8580f5[_0xce83('0x7')]('/api/cm/lists',require(_0xce83('0xd3')));_0x8580f5['use'](_0xce83('0xd4'),require(_0xce83('0xd5')));_0x8580f5[_0xce83('0x7')]('/api/userProfiles',require(_0xce83('0xd6')));_0x8580f5['use'](_0xce83('0xd7'),require(_0xce83('0xd8')));_0x8580f5[_0xce83('0x7')](_0xce83('0xd9'),require(_0xce83('0xda')));_0x8580f5[_0xce83('0x7')]('/api/userNotifications',require(_0xce83('0xdb')));_0x8580f5[_0xce83('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x8580f5[_0xce83('0x7')](_0xce83('0xdc'),require(_0xce83('0xdd')));_0x8580f5['use'](_0xce83('0xde'),require(_0xce83('0xdf')));_0x8580f5[_0xce83('0x7')]('/api/whatsapp/messages',require(_0xce83('0xe0')));_0x8580f5[_0xce83('0x7')]('/api/whatsapp/reports/queue',require(_0xce83('0xe1')));_0x8580f5[_0xce83('0x7')](_0xce83('0xe2'),require('./api/whatsappTransferReport'));_0x8580f5[_0xce83('0x7')](_0xce83('0xe3'),require(_0xce83('0xe4')));_0x8580f5[_0xce83('0x7')]('/api/cloudProviders',require(_0xce83('0xe5')));_0x8580f5[_0xce83('0x7')]('/api/realtime',require(_0xce83('0xe6')));_0x8580f5[_0xce83('0x7')](_0xce83('0xe7'),require(_0xce83('0xe8')));_0x8580f5['use']('/api/auth/local',require(_0xce83('0xe9')));_0x8580f5['use']('/api/auth/google',require('./api/authGoogle'));_0x8580f5[_0xce83('0x7')](_0xce83('0xea'),require(_0xce83('0xeb')));_0x8580f5[_0xce83('0x7')](_0xce83('0xec'),require(_0xce83('0xed')));_0x8580f5['use'](_0xce83('0xee'),require(_0xce83('0xef')));_0x8580f5[_0xce83('0x7')]('/api/version',require('./api/version'));_0x8580f5[_0xce83('0x7')]('/api/system',require(_0xce83('0xf0')));_0x8580f5['use'](_0xce83('0xf1'),require(_0xce83('0xf2')));_0x8580f5[_0xce83('0x7')](_0xce83('0xf3'),require(_0xce83('0xf4')));_0x8580f5['use'](_0xce83('0xf5'),clientSideLogs);_0x8580f5[_0xce83('0x7')](_0xce83('0xf6'),express[_0xce83('0xf7')](path['join'](config['root'],'/apidoc')));_0x8580f5[_0xce83('0x7')](_0xce83('0xf8'),express[_0xce83('0xf7')](path[_0xce83('0xf9')](config[_0xce83('0xfa')],_0xce83('0xf8'))));_0x8580f5[_0xce83('0x7')](_0xce83('0xfb'),express['static'](path[_0xce83('0xf9')](config['root'],'/demo')));_0x8580f5[_0xce83('0x7')](_0xce83('0xfc'),express[_0xce83('0xf7')](path[_0xce83('0xf9')](config[_0xce83('0xfa')],_0xce83('0xfd'),_0xce83('0xfe'))));_0x8580f5['use'](_0xce83('0xff'),express['static'](path[_0xce83('0xf9')](config[_0xce83('0xfa')],_0xce83('0x100'))));_0x8580f5[_0xce83('0x101')](_0xce83('0x102'))['get'](errors[0x194]);_0x8580f5[_0xce83('0x101')]('/*')[_0xce83('0x103')](function(_0x5c6e12,_0x1ed6bc){_0x1ed6bc[_0xce83('0x104')](path['resolve'](_0x8580f5[_0xce83('0x103')](_0xce83('0x105'))+_0xce83('0x106')));});return _0x8580f5;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 6134541..655c611 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea17=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.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/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc'];(function(_0x293a9d,_0xc69dc1){var _0x2b8175=function(_0x15a710){while(--_0x15a710){_0x293a9d['push'](_0x293a9d['shift']());}};_0x2b8175(++_0xc69dc1);}(_0xea17,0x6c));var _0x7ea1=function(_0x1de5fe,_0x200a1d){_0x1de5fe=_0x1de5fe-0x0;var _0x250ac2=_0xea17[_0x1de5fe];return _0x250ac2;};'use strict';var jayson=require(_0x7ea1('0x0'));var _=require(_0x7ea1('0x1'));var config=require(_0x7ea1('0x2'));exports[_0x7ea1('0x3')]=function(){return new Promise(function(_0x36487c,_0x1b7e74){var _0x4ba9a2={};_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x5')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/voiceExtension/voiceExtension.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/voiceQueue/voiceQueue.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x6')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x7')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x8')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x9')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0xa')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/memberReport/memberReport.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/trunk/trunk.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0xb')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0xc')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0xd')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0xe')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0xf')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x10')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x11')));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x12')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x13')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x14')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x15')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/faxQueue/faxQueue.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x16')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/smsAccount/smsAccount.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/smsInteraction/smsInteraction.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/smsMessage/smsMessage.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/smsQueue/smsQueue.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x17')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x18')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x19')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x1a')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x1b')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x1c')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/cmContact/cmContact.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x1d')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x1e')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/interval/interval.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x1f')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x20')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x21')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x22')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x23')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x24')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x25')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x26')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x27')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x28')));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/squareReport/squareReport.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x29')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/squareOdbc/squareOdbc.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x2a')));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x2b')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x2c')));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/campaign/campaign.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/attachment/attachment.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x2d')));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4ba9a2=_[_0x7ea1('0x4')](_0x4ba9a2,require(_0x7ea1('0x2e')));_0x4ba9a2=_['merge'](_0x4ba9a2,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4ba9a2=_['merge'](_0x4ba9a2,require(_0x7ea1('0x2f')));var _0x490e68=jayson['server'](_0x4ba9a2)[_0x7ea1('0x30')]();var _0x138804=config[_0x7ea1('0x31')]['port']||config[_0x7ea1('0x32')]+0x1;var _0x3b664a=config[_0x7ea1('0x31')]['ip']||_0x7ea1('0x33');_0x490e68['on'](_0x7ea1('0x34'),function(_0xa12f8c){return _0x1b7e74(_0xa12f8c);});_0x490e68[_0x7ea1('0x3')](_0x138804,_0x3b664a,function(){console[_0x7ea1('0x35')](_0x7ea1('0x36'),_0x3b664a,_0x138804);require(_0x7ea1('0x37'))[_0x7ea1('0x38')]();return _0x36487c('RPC\x20listening\x20on\x20'+_0x3b664a+':'+_0x138804);});});}; \ No newline at end of file +var _0x44ff=['../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.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/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x4acfcd,_0xabaa4e){var _0x1974fc=function(_0x244739){while(--_0x244739){_0x4acfcd['push'](_0x4acfcd['shift']());}};_0x1974fc(++_0xabaa4e);}(_0x44ff,0x1c3));var _0xf44f=function(_0x2cf02d,_0x26129b){_0x2cf02d=_0x2cf02d-0x0;var _0x3651f3=_0x44ff[_0x2cf02d];return _0x3651f3;};'use strict';var jayson=require('jayson/promise');var _=require(_0xf44f('0x0'));var config=require(_0xf44f('0x1'));exports[_0xf44f('0x2')]=function(){return new Promise(function(_0x4c1d84,_0x48276e){var _0x5a995b={};_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x3')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/voiceExtension/voiceExtension.rpc'));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x5')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x6')));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x7')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x8')));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x9')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0xa')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0xb')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0xc')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0xd')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0xe')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0xf')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x10')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/mailInteraction/mailInteraction.rpc'));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x11')));_0x5a995b=_['merge'](_0x5a995b,require('../api/mailApplication/mailApplication.rpc'));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x12')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x13')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/faxApplication/faxApplication.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/faxInteraction/faxInteraction.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x14')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x15')));_0x5a995b=_['merge'](_0x5a995b,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5a995b=_['merge'](_0x5a995b,require('../api/smsAccount/smsAccount.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/smsInteraction/smsInteraction.rpc'));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x16')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x17')));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x18')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x19')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x1a')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/chatMessage/chatMessage.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x1b')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x1c')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/cmHopper/cmHopper.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x1d')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x1e')));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x1f')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x20')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x21')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/pause/pause.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/sound/sound.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x22')));_0x5a995b=_['merge'](_0x5a995b,require('../api/template/template.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x23')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x24')));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x25')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x26')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x27')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x28')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x29')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x2a')));_0x5a995b=_['merge'](_0x5a995b,require(_0xf44f('0x2b')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x2c')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x2d')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x2e')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x2f')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x30')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x31')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require('../api/squareProject/squareProject.rpc'));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x32')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x33')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x34')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x35')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x36')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x37')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x38')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x39')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x3a')));_0x5a995b=_[_0xf44f('0x4')](_0x5a995b,require(_0xf44f('0x3b')));var _0x460308=jayson[_0xf44f('0x3c')](_0x5a995b)[_0xf44f('0x3d')]();var _0x58d078=config[_0xf44f('0x3e')][_0xf44f('0x3f')]||config[_0xf44f('0x3f')]+0x1;var _0xd7ef27=config['rpc']['ip']||_0xf44f('0x40');_0x460308['on']('error',function(_0x54fd2f){return _0x48276e(_0x54fd2f);});_0x460308[_0xf44f('0x2')](_0x58d078,_0xd7ef27,function(){console[_0xf44f('0x41')](_0xf44f('0x42'),_0xd7ef27,_0x58d078);require(_0xf44f('0x43'))[_0xf44f('0x44')]();return _0x4c1d84('RPC\x20listening\x20on\x20'+_0xd7ef27+':'+_0x58d078);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 44b08cf..5fe62cf 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 _0x9572=['error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','format','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','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./error','call','setEncoding','utf8','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match'];(function(_0x5c47ba,_0x409350){var _0x5bcaf9=function(_0x517166){while(--_0x517166){_0x5c47ba['push'](_0x5c47ba['shift']());}};_0x5bcaf9(++_0x409350);}(_0x9572,0x82));var _0x2957=function(_0x33be83,_0x620828){_0x33be83=_0x33be83-0x0;var _0x3a3fa0=_0x9572[_0x33be83];return _0x3a3fa0;};'use strict';var util=require(_0x2957('0x0'));var _=require('lodash');var EventEmitter=require(_0x2957('0x1'))[_0x2957('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x2957('0x3'));function AGIChannel(_0x1410e3){var _0x4645b4=this,_0x2bd3da=new AGIReply(),_0x491450=![],_0x2eaa83={};EventEmitter[_0x2957('0x4')](_0x4645b4);_0x1410e3[_0x2957('0x5')](_0x2957('0x6'));_0x1410e3['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2bd3da[_0x2957('0x5')]('utf8');_0x2bd3da['on']('headers',function(_0x102025){for(var _0x364561 in _0x102025){_0x4645b4[_0x364561]=_0x102025[_0x364561];}_0x4645b4[_0x2957('0x7')]('ready');});_0x2bd3da['on'](_0x2957('0x8'),function(_0x35f459){if(_0x35f459[_0x2957('0x9')]()==_0x2957('0xa')){_0x4645b4[_0x2957('0x7')](_0x2957('0xa'));return;}if(_0x35f459[_0x2957('0xb')](0x0,0xb)=='520-Invalid'){_0x491450=!![];}if(_0x491450){_0x2eaa83['rx']+=_0x35f459+'\x0a';if(_0x35f459[_0x2957('0xc')](_0x2957('0xd'))!=-0x1){_0x491450=![];}}else{_0x2eaa83['rx']=_0x35f459;}if(_0x491450){return;}if(typeof _0x2eaa83['cb']==_0x2957('0xe')){var _0x4ad2d8=_0x2eaa83['rx'][_0x2957('0xb')](0x0,0x3),_0x2ebe44=null,_0x485dac=null;_0x4ad2d8=parseInt(_0x4ad2d8);if(isNaN(_0x4ad2d8)){_0x2eaa83['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2957('0xf')});return;}if(_0x4ad2d8!=0xc8){_0x2eaa83['cb'](null,{'code':_0x4ad2d8,'result':-0x1,'extra':'KO'});return;}_0x2ebe44=_0x2eaa83['rx'][_0x2957('0xb')](0x4)[_0x2957('0x10')](_0x2957('0x11'),'');if(_0x2ebe44[_0x2957('0x12')]('\x20')!=-0x1){_0x2ebe44=_0x2ebe44[_0x2957('0x13')](0x0,_0x2ebe44[_0x2957('0x12')]('\x20'));}if(_[_0x2957('0x14')](_0x2ebe44,'-1')){_0x2ebe44=parseInt(_0x2ebe44);}_0x485dac=_0x2eaa83['rx'][_0x2957('0x15')]('\x20');if(_0x485dac['length']==0x3){_0x485dac=_0x485dac[0x2][_0x2957('0xb')](0x1,_0x485dac[0x2]['length']-0x1);}else if(_0x485dac[_0x2957('0x16')]>0x3){var _0x5da646=/\((.+)\)/;var _0x3dcc7a=_0x2eaa83['rx'][_0x2957('0x17')](_0x5da646);if(_0x3dcc7a){_0x485dac=_0x3dcc7a[0x1];}else{_0x485dac=null;}}else{_0x485dac=null;}_0x2eaa83['cb'](null,{'code':_0x4ad2d8,'result':_0x2ebe44,'extra':_0x485dac});}});_0x1410e3['on'](_0x2957('0x18'),function(_0x206d68){_0x4645b4['emit']('error',new AGIError(_0x2957('0x19'),_0x206d68[_0x2957('0x1a')]));});_0x1410e3['on'](_0x2957('0x1b'),function(){_0x4645b4['emit'](_0x2957('0x1b'),new AGIError(_0x2957('0x1c')));});_0x1410e3['on'](_0x2957('0x1d'),function(){_0x4645b4[_0x2957('0x7')]('timeout',new AGIError(_0x2957('0x1e')));_0x1410e3[_0x2957('0x1f')]();});_0x1410e3[_0x2957('0x20')](_0x2bd3da);this[_0x2957('0x21')]=function(_0x48e719,_0x405c25){var _0x48e719=_0x48e719||'',_0x405c25=typeof _0x405c25=='function'?_0x405c25:new Function();_0x2eaa83={'tx':_0x48e719,'rx':'','cb':_0x405c25};_0x1410e3['write'](_0x48e719+'\x0a');},this['close']=function(){_0x1410e3[_0x2957('0x1f')]();};}util[_0x2957('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x2957('0x23')][_0x2957('0x24')]=function(_0x3f75c2){return this[_0x2957('0x21')][_0x2957('0x25')](this,_0x3f75c2);};AGIChannel[_0x2957('0x23')]['answer']=function(){return this[_0x2957('0x24')](_0x2957('0x26'));};AGIChannel['prototype']['getData']=function(_0x7fff15,_0x58b963,_0x2affd9){_0x7fff15=_0x7fff15===undefined?'beep':_0x7fff15;_0x58b963=_0x58b963===undefined?'5':_0x58b963;_0x2affd9=_0x2affd9===undefined?'1':_0x2affd9;return this[_0x2957('0x24')](util['format'](_0x2957('0x27'),_0x7fff15,_0x58b963*0x3e8,_0x2affd9));};AGIChannel[_0x2957('0x23')][_0x2957('0x28')]=function(_0x35e9c3){_0x35e9c3=_0x35e9c3||_0x2957('0x29');return this[_0x2957('0x24')](util['format'](_0x2957('0x2a'),_0x35e9c3));};AGIChannel[_0x2957('0x23')]['exec']=function(_0x175235,_0x45625e){if(_[_0x2957('0x2b')](_0x45625e)){return this[_0x2957('0x24')](util[_0x2957('0x2c')](_0x2957('0x2d'),_0x175235,_0x45625e['join'](',')));}return this['sendRequest'](util[_0x2957('0x2c')](_0x2957('0x2d'),_0x175235,_0x45625e));};AGIChannel['prototype']['setContext']=function(_0x3f0fd6){return this[_0x2957('0x24')](util[_0x2957('0x2c')](_0x2957('0x2e'),_0x3f0fd6));};AGIChannel[_0x2957('0x23')][_0x2957('0x2f')]=function(_0x4d8ac8){return this[_0x2957('0x24')](util[_0x2957('0x2c')](_0x2957('0x30'),_0x4d8ac8));};AGIChannel['prototype'][_0x2957('0x31')]=function(_0x39f4f7){return this['sendRequest'](util[_0x2957('0x2c')](_0x2957('0x32'),_0x39f4f7));};AGIChannel[_0x2957('0x23')][_0x2957('0xa')]=function(){return this['sendRequest'](_0x2957('0x33'));};AGIChannel[_0x2957('0x23')][_0x2957('0x34')]=function(_0x458d98,_0x462f10){var _0x102b80=_[_0x2957('0x35')](_0x462f10)||_[_0x2957('0x36')](_0x462f10)?_0x462f10[_0x2957('0x37')]():_0x462f10;return this[_0x2957('0x24')](util[_0x2957('0x2c')](_0x2957('0x38'),_0x458d98,_0x102b80?_0x102b80['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2957('0x23')][_0x2957('0x39')]=function(_0xd79e21,_0xc5af36){return this['sendRequest'](util['format'](_0x2957('0x3a'),_0xd79e21,_0xc5af36));};AGIChannel[_0x2957('0x23')]['sayDigits']=function(_0x5806ec,_0x392ac7){return this['sendRequest'](util['format'](_0x2957('0x3b'),_0x5806ec,_0x392ac7));};AGIChannel[_0x2957('0x23')][_0x2957('0x3c')]=function(_0x1d6dc2,_0x5cdd09){return this[_0x2957('0x24')](util[_0x2957('0x2c')](_0x2957('0x3d'),_0x1d6dc2,_0x5cdd09));};AGIChannel[_0x2957('0x23')][_0x2957('0x3e')]=function(_0x3638ed,_0x5c4721,_0x41d6eb){_0x5c4721=_0x5c4721||this['extension'];_0x41d6eb=_0x41d6eb||0x1;this['setContext'](_0x3638ed);this['setExtension'](_0x5c4721);this['setPriority'](_0x41d6eb);return this[_0x2957('0x28')](util[_0x2957('0x2c')](_0x2957('0x3f'),_0x3638ed,_0x5c4721,_0x41d6eb));};AGIChannel['prototype']['getVariable']=function(_0x5e8a52){return this[_0x2957('0x24')](util['format'](_0x2957('0x40'),_0x5e8a52));};AGIChannel[_0x2957('0x23')]['recordFile']=function(_0x25b266,_0x3426d2,_0x32dad6,_0x2e329f,_0x3bfffb,_0xaa8650){_0x3426d2=_0x3426d2||_0x2957('0x41');_0x32dad6=_0x32dad6||'';_0x2e329f=_0x2e329f===undefined?-0x1:_0x2e329f==='-1'?-0x1:_0x2e329f*0x3e8;_0x3bfffb=_0x3bfffb===undefined?'':'s='+_0x3bfffb;_0xaa8650=_0xaa8650?_0x2957('0x42'):'';return this['sendRequest'](util[_0x2957('0x2c')](_0x2957('0x43'),_0x25b266,_0x3426d2,_0x32dad6,_0x2e329f,_0xaa8650,_0x3bfffb));};AGIChannel['prototype'][_0x2957('0x44')]=function(_0x2ce110,_0x5189f3){_0x5189f3=_0x5189f3||'';return this[_0x2957('0x24')](util[_0x2957('0x2c')](_0x2957('0x45'),_0x2ce110,_0x5189f3));};AGIChannel[_0x2957('0x23')][_0x2957('0x46')]=function(_0xc2b9a6){return this['exec']('AGI',_0xc2b9a6);};AGIChannel[_0x2957('0x23')][_0x2957('0x47')]=function(_0x91af3f){return this[_0x2957('0x48')](_0x2957('0x49'),_0x91af3f);};AGIChannel[_0x2957('0x23')]['error']=function(_0x212743,_0x4b464a){this[_0x2957('0x28')](util['format'](_0x2957('0x4a'),_0x212743['id'],_0x212743[_0x2957('0x4b')],_0x4b464a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2957('0x4c')]=AGIChannel; \ No newline at end of file +var _0xef9e=['split','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','write','close','destroy','inherits','prototype','sendRequest','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','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','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','utf8','setTimeout','setEncoding','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xef9e,0x1ef));var _0xeef9=function(_0xd548a1,_0x2225e3){_0xd548a1=_0xd548a1-0x0;var _0x3a85f=_0xef9e[_0xd548a1];return _0x3a85f;};'use strict';var util=require(_0xeef9('0x0'));var _=require('lodash');var EventEmitter=require(_0xeef9('0x1'))[_0xeef9('0x2')];var AGIReply=require(_0xeef9('0x3'));var AGIError=require(_0xeef9('0x4'));function AGIChannel(_0x27f727){var _0x512df0=this,_0x5193cb=new AGIReply(),_0x3352ed=![],_0x104d98={};EventEmitter['call'](_0x512df0);_0x27f727['setEncoding'](_0xeef9('0x5'));_0x27f727[_0xeef9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x5193cb[_0xeef9('0x7')]('utf8');_0x5193cb['on'](_0xeef9('0x8'),function(_0x4b46d0){for(var _0xb8c314 in _0x4b46d0){_0x512df0[_0xb8c314]=_0x4b46d0[_0xb8c314];}_0x512df0[_0xeef9('0x9')](_0xeef9('0xa'));});_0x5193cb['on'](_0xeef9('0xb'),function(_0x3d630b){if(_0x3d630b['toLowerCase']()==_0xeef9('0xc')){_0x512df0[_0xeef9('0x9')](_0xeef9('0xc'));return;}if(_0x3d630b[_0xeef9('0xd')](0x0,0xb)==_0xeef9('0xe')){_0x3352ed=!![];}if(_0x3352ed){_0x104d98['rx']+=_0x3d630b+'\x0a';if(_0x3d630b[_0xeef9('0xf')](_0xeef9('0x10'))!=-0x1){_0x3352ed=![];}}else{_0x104d98['rx']=_0x3d630b;}if(_0x3352ed){return;}if(typeof _0x104d98['cb']==_0xeef9('0x11')){var _0x5aceb1=_0x104d98['rx'][_0xeef9('0xd')](0x0,0x3),_0x4a2e48=null,_0x1fbd25=null;_0x5aceb1=parseInt(_0x5aceb1);if(isNaN(_0x5aceb1)){_0x104d98['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xeef9('0x12')});return;}if(_0x5aceb1!=0xc8){_0x104d98['cb'](null,{'code':_0x5aceb1,'result':-0x1,'extra':'KO'});return;}_0x4a2e48=_0x104d98['rx'][_0xeef9('0xd')](0x4)['replace'](_0xeef9('0x13'),'');if(_0x4a2e48[_0xeef9('0x14')]('\x20')!=-0x1){_0x4a2e48=_0x4a2e48[_0xeef9('0x15')](0x0,_0x4a2e48[_0xeef9('0x14')]('\x20'));}if(_[_0xeef9('0x16')](_0x4a2e48,'-1')){_0x4a2e48=parseInt(_0x4a2e48);}_0x1fbd25=_0x104d98['rx'][_0xeef9('0x17')]('\x20');if(_0x1fbd25['length']==0x3){_0x1fbd25=_0x1fbd25[0x2][_0xeef9('0xd')](0x1,_0x1fbd25[0x2][_0xeef9('0x18')]-0x1);}else if(_0x1fbd25[_0xeef9('0x18')]>0x3){var _0xe2d73=/\((.+)\)/;var _0x55e855=_0x104d98['rx'][_0xeef9('0x19')](_0xe2d73);if(_0x55e855){_0x1fbd25=_0x55e855[0x1];}else{_0x1fbd25=null;}}else{_0x1fbd25=null;}_0x104d98['cb'](null,{'code':_0x5aceb1,'result':_0x4a2e48,'extra':_0x1fbd25});}});_0x27f727['on'](_0xeef9('0x1a'),function(_0x5eaab0){_0x512df0['emit'](_0xeef9('0x1a'),new AGIError(_0xeef9('0x1b'),_0x5eaab0[_0xeef9('0x1c')]));});_0x27f727['on']('close',function(){_0x512df0[_0xeef9('0x9')]('close',new AGIError(_0xeef9('0x1d')));});_0x27f727['on'](_0xeef9('0x1e'),function(){_0x512df0[_0xeef9('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x27f727['destroy']();});_0x27f727['pipe'](_0x5193cb);this['command']=function(_0x45775f,_0x44c935){var _0x45775f=_0x45775f||'',_0x44c935=typeof _0x44c935=='function'?_0x44c935:new Function();_0x104d98={'tx':_0x45775f,'rx':'','cb':_0x44c935};_0x27f727[_0xeef9('0x1f')](_0x45775f+'\x0a');},this[_0xeef9('0x20')]=function(){_0x27f727[_0xeef9('0x21')]();};}util[_0xeef9('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xeef9('0x23')][_0xeef9('0x24')]=function(_0x301eff){return this['command']['sync'](this,_0x301eff);};AGIChannel['prototype'][_0xeef9('0x25')]=function(){return this[_0xeef9('0x24')](_0xeef9('0x26'));};AGIChannel[_0xeef9('0x23')][_0xeef9('0x27')]=function(_0x53fece,_0x467605,_0x2a9a37){_0x53fece=_0x53fece===undefined?_0xeef9('0x28'):_0x53fece;_0x467605=_0x467605===undefined?'5':_0x467605;_0x2a9a37=_0x2a9a37===undefined?'1':_0x2a9a37;return this[_0xeef9('0x24')](util[_0xeef9('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x53fece,_0x467605*0x3e8,_0x2a9a37));};AGIChannel[_0xeef9('0x23')][_0xeef9('0x2a')]=function(_0x427d3e){_0x427d3e=_0x427d3e||_0xeef9('0x2b');return this['sendRequest'](util[_0xeef9('0x29')]('VERBOSE\x20\x22%s\x22',_0x427d3e));};AGIChannel[_0xeef9('0x23')]['exec']=function(_0x1d76f8,_0x229a14){if(_[_0xeef9('0x2c')](_0x229a14)){return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x2d'),_0x1d76f8,_0x229a14[_0xeef9('0x2e')](',')));}return this['sendRequest'](util[_0xeef9('0x29')](_0xeef9('0x2d'),_0x1d76f8,_0x229a14));};AGIChannel[_0xeef9('0x23')]['setContext']=function(_0x3ca029){return this[_0xeef9('0x24')](util[_0xeef9('0x29')]('SET\x20CONTEXT\x20%s',_0x3ca029));};AGIChannel['prototype'][_0xeef9('0x2f')]=function(_0x2aeb3f){return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x30'),_0x2aeb3f));};AGIChannel['prototype'][_0xeef9('0x31')]=function(_0x5b43cb){return this['sendRequest'](util['format']('SET\x20PRIORITY\x20%s',_0x5b43cb));};AGIChannel['prototype'][_0xeef9('0xc')]=function(){return this[_0xeef9('0x24')]('HANGUP');};AGIChannel['prototype'][_0xeef9('0x32')]=function(_0x491754,_0x38e177){var _0x2cc463=_['isBoolean'](_0x38e177)||_[_0xeef9('0x33')](_0x38e177)?_0x38e177[_0xeef9('0x34')]():_0x38e177;return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x35'),_0x491754,_0x2cc463?_0x2cc463[_0xeef9('0x34')]()[_0xeef9('0x36')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xeef9('0x37')]=function(_0x406ad3,_0x904bbc){return this[_0xeef9('0x24')](util[_0xeef9('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x406ad3,_0x904bbc));};AGIChannel[_0xeef9('0x23')][_0xeef9('0x38')]=function(_0x1eb0b3,_0x188c40){return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x39'),_0x1eb0b3,_0x188c40));};AGIChannel[_0xeef9('0x23')][_0xeef9('0x3a')]=function(_0x5f1015,_0x1fd08f){return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x3b'),_0x5f1015,_0x1fd08f));};AGIChannel[_0xeef9('0x23')][_0xeef9('0x3c')]=function(_0x26a0a6,_0x317619,_0x30b5f1){_0x317619=_0x317619||this['extension'];_0x30b5f1=_0x30b5f1||0x1;this[_0xeef9('0x3d')](_0x26a0a6);this['setExtension'](_0x317619);this['setPriority'](_0x30b5f1);return this[_0xeef9('0x2a')](util[_0xeef9('0x29')](_0xeef9('0x3e'),_0x26a0a6,_0x317619,_0x30b5f1));};AGIChannel[_0xeef9('0x23')]['getVariable']=function(_0x57a7cd){return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x3f'),_0x57a7cd));};AGIChannel[_0xeef9('0x23')]['recordFile']=function(_0x466a78,_0x37e62d,_0x4e798d,_0x269495,_0x47de65,_0x108cfe){_0x37e62d=_0x37e62d||'wav';_0x4e798d=_0x4e798d||'';_0x269495=_0x269495===undefined?-0x1:_0x269495==='-1'?-0x1:_0x269495*0x3e8;_0x47de65=_0x47de65===undefined?'':'s='+_0x47de65;_0x108cfe=_0x108cfe?'BEEP':'';return this[_0xeef9('0x24')](util[_0xeef9('0x29')](_0xeef9('0x40'),_0x466a78,_0x37e62d,_0x4e798d,_0x269495,_0x108cfe,_0x47de65));};AGIChannel[_0xeef9('0x23')][_0xeef9('0x41')]=function(_0x2af979,_0x5adca4){_0x5adca4=_0x5adca4||'';return this['sendRequest'](util[_0xeef9('0x29')](_0xeef9('0x42'),_0x2af979,_0x5adca4));};AGIChannel['prototype'][_0xeef9('0x43')]=function(_0x1bd409){return this['exec']('AGI',_0x1bd409);};AGIChannel[_0xeef9('0x23')][_0xeef9('0x44')]=function(_0x23af29){return this[_0xeef9('0x45')](_0xeef9('0x46'),_0x23af29);};AGIChannel[_0xeef9('0x23')][_0xeef9('0x1a')]=function(_0x4a430d,_0x155d7a){this[_0xeef9('0x2a')](util[_0xeef9('0x29')](_0xeef9('0x47'),_0x4a430d['id'],_0x4a430d[_0xeef9('0x48')],_0x155d7a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xeef9('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bc75fed..3d7ee31 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 _0x509c=['Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','exports'];(function(_0x216bb8,_0x103b3b){var _0x5756ad=function(_0x585f8f){while(--_0x585f8f){_0x216bb8['push'](_0x216bb8['shift']());}};_0x5756ad(++_0x103b3b);}(_0x509c,0x1ea));var _0xc509=function(_0x4dfe8f,_0x15d58a){_0x4dfe8f=_0x4dfe8f-0x0;var _0x525088=_0x509c[_0x4dfe8f];return _0x525088;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xc509('0x0'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xc509('0x1'),'E_AGI_SOCKET_CLOSE':_0xc509('0x2'),'E_AGI_SOCKET_TIMEOUT':_0xc509('0x3'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc509('0x4'),'E_AGI_IVR_ENTRY':_0xc509('0x5')};function AGIError(_0x4076a3){var _0x4076a3=_0x4076a3||null,_0x50675a=_0x50675a||[],_0x5ec9d1=0x1,_0x92b6c8='';if(!error[_0x4076a3]){_0x4076a3=_0xc509('0x6');}_0x50675a['push'](error[_0x4076a3]);while(arguments[_0x5ec9d1]){_0x50675a[_0xc509('0x7')](arguments[_0x5ec9d1]);_0x5ec9d1++;}_0x92b6c8=util['format']['apply'](util,_0x50675a);this[_0xc509('0x8')]=_0x92b6c8;this['name']=_0x4076a3;}module[_0xc509('0x9')]=AGIError; \ No newline at end of file +var _0x0ee1=['message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0ee1,0x113));var _0x10ee=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x0ee1[_0x3d78d7];return _0x4b6784;};'use strict';var util=require(_0x10ee('0x0'));var error={'E_AGI_UNDEFINED':_0x10ee('0x1'),'E_AGI_ARGUMENT_PORT':_0x10ee('0x2'),'E_AGI_SERVER_ERROR':_0x10ee('0x3'),'E_AGI_SERVER_CLOSE':_0x10ee('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x10ee('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x10ee('0x6'),'E_AGI_SOCKET_ERROR':_0x10ee('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x10ee('0x8'),'E_AGI_COMMAND_EMPTY':_0x10ee('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x10ee('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x193df9){var _0x193df9=_0x193df9||null,_0x5ed648=_0x5ed648||[],_0x50675d=0x1,_0x20dbfc='';if(!error[_0x193df9]){_0x193df9=_0x10ee('0xb');}_0x5ed648[_0x10ee('0xc')](error[_0x193df9]);while(arguments[_0x50675d]){_0x5ed648[_0x10ee('0xc')](arguments[_0x50675d]);_0x50675d++;}_0x20dbfc=util['format'][_0x10ee('0xd')](util,_0x5ed648);this[_0x10ee('0xe')]=_0x20dbfc;this[_0x10ee('0xf')]=_0x193df9;}module[_0x10ee('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index ba4513a..70f9c89 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf425=['localhost','subscribe','agi','error','parse','emit','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','./error','../../config/environment','redis','defaults'];(function(_0xeaadd7,_0x5d1ed6){var _0x440645=function(_0x2c59dc){while(--_0x2c59dc){_0xeaadd7['push'](_0xeaadd7['shift']());}};_0x440645(++_0x5d1ed6);}(_0xf425,0x126));var _0x5f42=function(_0x5edcd7,_0x4c5e59){_0x5edcd7=_0x5edcd7-0x0;var _0x2f5b45=_0xf425[_0x5edcd7];return _0x2f5b45;};'use strict';var _=require(_0x5f42('0x0'));var EventEmitter=require(_0x5f42('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x5f42('0x2'));var config=require(_0x5f42('0x3'));config[_0x5f42('0x4')]=_[_0x5f42('0x5')](config[_0x5f42('0x4')],{'host':_0x5f42('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x5f42('0x7')](_0x5f42('0x8'),function(_0x55bc57){if(_0x55bc57)return eventEmitter['emit'](_0x5f42('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x55bc57));});sub['on']('message',function(_0x64437e,_0x299354){if(_0x64437e!==_0x5f42('0x8'))return;try{var _0x44c100=JSON[_0x5f42('0xa')](_0x299354);eventEmitter[_0x5f42('0xb')](_0x5f42('0xc'),_0x44c100);}catch(_0x2e431a){eventEmitter[_0x5f42('0xb')](_0x5f42('0x9'),new AGIError(_0x5f42('0xd'),_0x2e431a));}});module[_0x5f42('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7e2a=['E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','EventEmitter','ioredis','./error','../../config/environment','defaults','redis','localhost','subscribe','agi','emit','error'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7e2a,0xf5));var _0xa7e2=function(_0x2f90d0,_0x1d9ec1){_0x2f90d0=_0x2f90d0-0x0;var _0x25ed4b=_0x7e2a[_0x2f90d0];return _0x25ed4b;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xa7e2('0x0')];var Redis=require(_0xa7e2('0x1'));var AGIError=require(_0xa7e2('0x2'));var config=require(_0xa7e2('0x3'));config['redis']=_[_0xa7e2('0x4')](config[_0xa7e2('0x5')],{'host':_0xa7e2('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa7e2('0x5')]);sub[_0xa7e2('0x7')](_0xa7e2('0x8'),function(_0x3d545d){if(_0x3d545d)return eventEmitter[_0xa7e2('0x9')](_0xa7e2('0xa'),new AGIError(_0xa7e2('0xb'),_0x3d545d));});sub['on'](_0xa7e2('0xc'),function(_0x2ace51,_0x4f20e4){if(_0x2ace51!==_0xa7e2('0x8'))return;try{var _0x3a9fd0=JSON[_0xa7e2('0xd')](_0x4f20e4);eventEmitter[_0xa7e2('0x9')](_0xa7e2('0xe'),_0x3a9fd0);}catch(_0x2524ce){eventEmitter[_0xa7e2('0x9')](_0xa7e2('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x2524ce));}});module[_0xa7e2('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5689c13..a341af0 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 _0xff47=['getsecretdigits','vertices','edges','numberOfEdges','addVertex','push','prototype','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','exports','agi','menu','getdigits'];(function(_0x2a6499,_0x4e66a4){var _0x54ad87=function(_0x42f82f){while(--_0x42f82f){_0x2a6499['push'](_0x2a6499['shift']());}};_0x54ad87(++_0x4e66a4);}(_0xff47,0x15c));var _0x7ff4=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xff47[_0xbf5e16];return _0x5975a5;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x7ff4('0x0'));var verticesWithRetry=[_0x7ff4('0x1'),_0x7ff4('0x2'),_0x7ff4('0x3')];var Graph=function(){this[_0x7ff4('0x4')]={};this[_0x7ff4('0x5')]={};this[_0x7ff4('0x6')]=0x0;};Graph['prototype'][_0x7ff4('0x7')]=function(_0x53f8f0){this['vertices'][_0x53f8f0['id']]=_0x53f8f0;this['edges'][_0x53f8f0['id']]=[];};Graph['prototype']['addEdge']=function(_0x7771a8,_0x87f712,_0xcebb83){this[_0x7ff4('0x5')][_0x7771a8][_0x7ff4('0x8')]({'target':_0x87f712,'condition':_0xcebb83});this[_0x7ff4('0x6')]+=0x1;};Graph[_0x7ff4('0x9')][_0x7ff4('0xa')]=function(){return _[_0x7ff4('0xa')](this[_0x7ff4('0x4')]);};Graph[_0x7ff4('0x9')][_0x7ff4('0xb')]=function(){return this[_0x7ff4('0x6')];};Graph[_0x7ff4('0x9')][_0x7ff4('0xc')]=function(_0x4ecf01){return this[_0x7ff4('0x4')][_0x4ecf01];};Graph[_0x7ff4('0x9')][_0x7ff4('0xd')]=function(_0x16ed6f,_0x25897a){if(!this[_0x7ff4('0x4')][_0x16ed6f]){return logger['info']('no\x20vertex\x20found');}var _0x2f1af0=_0x25897a(this[_0x7ff4('0x4')][_0x16ed6f]);if(!_0x2f1af0){return logger[_0x7ff4('0xe')](_0x7ff4('0xf'));}if(this[_0x7ff4('0x5')][_0x16ed6f][_0x7ff4('0x10')]===0x0){return logger[_0x7ff4('0xe')](_0x7ff4('0x11'));}for(var _0x3ae6b3=0x0,_0x3a0168=[],_0x41b58d=![];_0x3ae6b3\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','catch','indexOf','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleUnpublished','initialize','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','finally','./server','listening','connection','util','../../config/environment','../../config/logger','agi','./events','EventEmitter','defaults'];(function(_0x1a6990,_0x9956be){var _0x272590=function(_0x3c5ded){while(--_0x3c5ded){_0x1a6990['push'](_0x1a6990['shift']());}};_0x272590(++_0x9956be);}(_0x25f0,0x1a1));var _0x025f=function(_0x565a71,_0x293709){_0x565a71=_0x565a71-0x0;var _0x696d3c=_0x25f0[_0x565a71];return _0x696d3c;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x025f('0x0'));var config=require(_0x025f('0x1'));var logger=require(_0x025f('0x2'))(_0x025f('0x3'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0x025f('0x4'))[_0x025f('0x5')];var projects=[];config[_0x025f('0x3')]=_[_0x025f('0x6')](config[_0x025f('0x3')],{'ip':_0x025f('0x7'),'port':0x11dd});AGIEmitter['on'](_0x025f('0x8'),projectUpdateHandler);function connectionHandler(_0x540d2d){process[_0x025f('0x9')](function(){syncho(function(){try{setChannelVariables(_0x540d2d);agiHandler(_0x540d2d);}catch(_0x43e6af){logger[_0x025f('0xa')](_0x43e6af[_0x025f('0xb')]);}});});}function projectUpdateHandler(_0x1777d8){try{var _0x14c383=_['findIndex'](projects,['id',_0x1777d8['id']]);if(_0x14c383>-0x1){if(_0x1777d8['deleted']===!![]){projects[_0x025f('0xc')](_0x14c383,0x1);}else{projects[_0x14c383]=_0x1777d8;}}else{projects['push'](_0x1777d8);}}catch(_0x109a8d){logger[_0x025f('0xa')](_0x109a8d['stack']);}}function listeningHandler(){console[_0x025f('0xd')](_0x025f('0xe'),config[_0x025f('0x3')]['port']);logger[_0x025f('0xf')](util[_0x025f('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x025f('0x3')]['ip'],config[_0x025f('0x3')][_0x025f('0x11')]));}function errorHandler(_0x45602a){if(_0x45602a&&_0x45602a[_0x025f('0x12')]&&_0x45602a[_0x025f('0x13')]){logger[_0x025f('0xa')](util[_0x025f('0x10')](_0x025f('0x14'),_0x45602a[_0x025f('0x12')],_0x45602a[_0x025f('0x13')]));}else{logger[_0x025f('0xa')](util[_0x025f('0x10')](_0x025f('0x15'),_0x45602a[_0x025f('0xb')]));}}function closeHandler(){logger['info'](util[_0x025f('0x10')](_0x025f('0x16'),this['arg_1'],this[_0x025f('0x17')],this[_0x025f('0x18')],this[_0x025f('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x497cb9){logger[_0x025f('0xa')](_0x497cb9[_0x025f('0xb')]);}}function timeoutHandler(){logger[_0x025f('0xf')](util[_0x025f('0x10')](_0x025f('0x1a'),this[_0x025f('0x1b')],this[_0x025f('0x17')],this[_0x025f('0x18')],this[_0x025f('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x025f('0xf')](util[_0x025f('0x10')](_0x025f('0x1c'),this[_0x025f('0x1b')],this[_0x025f('0x17')],this[_0x025f('0x18')],this['dnid'],this[_0x025f('0x1d')]));this[_0x025f('0x1e')]=!![];}function createSquareReport(_0x572513,_0x43f926){rpc['createSquareReport'](_0x572513)['then'](function(_0x33ef64){if(_0x43f926){_0x43f926(null,_0x33ef64);}})[_0x025f('0x1f')](function(_0x38a3c3){if(_0x43f926){_0x43f926(null,_0x38a3c3);}});}function setChannelVariables(_0x3d1d78){for(var _0x5147f4 in _0x3d1d78){if(_0x3d1d78['hasOwnProperty'](_0x5147f4)){if(_0x5147f4[_0x025f('0x20')](_0x025f('0x21'))===0x0){_0x3d1d78[_0x5147f4['substring'](0x4)]=_0x3d1d78[_0x5147f4];delete _0x3d1d78[_0x5147f4];}}}}function agiHandler(_0x2b3657){logger['debug'](_0x025f('0x22'),JSON[_0x025f('0x23')](_0x2b3657,null,0x2));logger[_0x025f('0xf')](util[_0x025f('0x10')](_0x025f('0x24'),_0x2b3657[_0x025f('0x1b')],_0x2b3657[_0x025f('0x17')],_0x2b3657[_0x025f('0x18')],_0x2b3657[_0x025f('0x19')],_0x2b3657[_0x025f('0x1d')]));_0x2b3657['on']('error',errorHandler);_0x2b3657['on'](_0x025f('0x25'),closeHandler);_0x2b3657['on'](_0x025f('0x26'),timeoutHandler);_0x2b3657[_0x025f('0x1e')]=![];_0x2b3657['on'](_0x025f('0x27'),hangupHandler);var _0x363890=_[_0x025f('0x28')](projects,[_0x025f('0x12'),_0x2b3657[_0x025f('0x1b')]]);if(!_0x363890)return Project['handleNotFound'](_0x2b3657);if(!_0x363890['production'])return Project[_0x025f('0x29')](_0x2b3657);return Project[_0x025f('0x2a')](_0x363890,_0x2b3657);}function main(){var _0x338edd;return utilLicense[_0x025f('0x2b')]()[_0x025f('0x2c')](function(_0x6fc5d9){if(!_0x6fc5d9)return;if(_0x6fc5d9['voice']){if(_0x6fc5d9[_0x025f('0x2d')]&&_0x6fc5d9[_0x025f('0x2d')]>0x0){logger['info'](util['format'](_0x025f('0x2e'),_0x6fc5d9[_0x025f('0x2d')]));_0x338edd=_0x6fc5d9['callysquare'];}else{logger[_0x025f('0xf')](_0x025f('0x2f'));}}else{logger[_0x025f('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x338edd=-0x1;}})['then'](function(){return Project[_0x025f('0x30')]();})[_0x025f('0x2c')](function(_0x1b553c){projects=_0x1b553c;return;})[_0x025f('0x1f')](function(_0xe5f3d1){logger['error']('[LICENSE]',_0xe5f3d1[_0x025f('0xb')]);})[_0x025f('0x31')](function(){var _0x38cf10=require(_0x025f('0x32'))(config[_0x025f('0x3')][_0x025f('0x11')],config['agi']['ip'],_0x338edd);_0x38cf10['on'](_0x025f('0xa'),errorHandler);_0x38cf10['on'](_0x025f('0x33'),listeningHandler);_0x38cf10['on'](_0x025f('0x34'),connectionHandler);_0x38cf10['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x28dd=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','listening','connection','close','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','splice','error','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','evtHangup','then','indexOf','agi_','substring','debug'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x28dd,0x7c));var _0xd28d=function(_0x28d1cd,_0x192371){_0x28d1cd=_0x28d1cd-0x0;var _0xdcb892=_0x28dd[_0x28d1cd];return _0xdcb892;};'use strict';var _=require(_0xd28d('0x0'));var syncho=require('syncho');var util=require(_0xd28d('0x1'));var config=require(_0xd28d('0x2'));var logger=require(_0xd28d('0x3'))(_0xd28d('0x4'));var utilLicense=require(_0xd28d('0x5'));var rpc=require(_0xd28d('0x6'));var Project=require(_0xd28d('0x7'));var AGIEmitter=require(_0xd28d('0x8'))[_0xd28d('0x9')];var projects=[];config[_0xd28d('0x4')]=_[_0xd28d('0xa')](config[_0xd28d('0x4')],{'ip':_0xd28d('0xb'),'port':0x11dd});AGIEmitter['on'](_0xd28d('0xc'),projectUpdateHandler);function connectionHandler(_0x234ed3){process[_0xd28d('0xd')](function(){syncho(function(){try{setChannelVariables(_0x234ed3);agiHandler(_0x234ed3);}catch(_0x43b919){logger['error'](_0x43b919[_0xd28d('0xe')]);}});});}function projectUpdateHandler(_0x1bede3){try{var _0x281989=_[_0xd28d('0xf')](projects,['id',_0x1bede3['id']]);if(_0x281989>-0x1){if(_0x1bede3['deleted']===!![]){projects[_0xd28d('0x10')](_0x281989,0x1);}else{projects[_0x281989]=_0x1bede3;}}else{projects['push'](_0x1bede3);}}catch(_0x4614f7){logger[_0xd28d('0x11')](_0x4614f7['stack']);}}function listeningHandler(){console[_0xd28d('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xd28d('0x4')][_0xd28d('0x13')]);logger[_0xd28d('0x14')](util[_0xd28d('0x15')](_0xd28d('0x16'),config[_0xd28d('0x4')]['ip'],config['agi'][_0xd28d('0x13')]));}function errorHandler(_0x5e60ae){if(_0x5e60ae&&_0x5e60ae['name']&&_0x5e60ae[_0xd28d('0x17')]){logger[_0xd28d('0x11')](util['format'](_0xd28d('0x18'),_0x5e60ae['name'],_0x5e60ae[_0xd28d('0x17')]));}else{logger['error'](util['format'](_0xd28d('0x19'),_0x5e60ae[_0xd28d('0xe')]));}}function closeHandler(){logger[_0xd28d('0x14')](util['format'](_0xd28d('0x1a'),this[_0xd28d('0x1b')],this[_0xd28d('0x1c')],this[_0xd28d('0x1d')],this[_0xd28d('0x1e')],this[_0xd28d('0x1f')]));try{createSquareReport(this);}catch(_0x416e96){logger[_0xd28d('0x11')](_0x416e96[_0xd28d('0xe')]);}}function timeoutHandler(){logger['info'](util[_0xd28d('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd28d('0x1b')],this['calleridname'],this['callerid'],this['dnid'],this[_0xd28d('0x1f')]));}function hangupHandler(){logger[_0xd28d('0x14')](util[_0xd28d('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd28d('0x1b')],this['calleridname'],this[_0xd28d('0x1d')],this[_0xd28d('0x1e')],this[_0xd28d('0x1f')]));this[_0xd28d('0x20')]=!![];}function createSquareReport(_0x369b60,_0x49466d){rpc['createSquareReport'](_0x369b60)[_0xd28d('0x21')](function(_0x5474cd){if(_0x49466d){_0x49466d(null,_0x5474cd);}})['catch'](function(_0x1459a3){if(_0x49466d){_0x49466d(null,_0x1459a3);}});}function setChannelVariables(_0x5e008b){for(var _0x57e3dd in _0x5e008b){if(_0x5e008b['hasOwnProperty'](_0x57e3dd)){if(_0x57e3dd[_0xd28d('0x22')](_0xd28d('0x23'))===0x0){_0x5e008b[_0x57e3dd[_0xd28d('0x24')](0x4)]=_0x5e008b[_0x57e3dd];delete _0x5e008b[_0x57e3dd];}}}}function agiHandler(_0x20c773){logger[_0xd28d('0x25')]('variables',JSON[_0xd28d('0x26')](_0x20c773,null,0x2));logger[_0xd28d('0x14')](util['format'](_0xd28d('0x27'),_0x20c773[_0xd28d('0x1b')],_0x20c773[_0xd28d('0x1c')],_0x20c773[_0xd28d('0x1d')],_0x20c773[_0xd28d('0x1e')],_0x20c773[_0xd28d('0x1f')]));_0x20c773['on']('error',errorHandler);_0x20c773['on']('close',closeHandler);_0x20c773['on'](_0xd28d('0x28'),timeoutHandler);_0x20c773[_0xd28d('0x20')]=![];_0x20c773['on'](_0xd28d('0x29'),hangupHandler);var _0x5ab0fc=_[_0xd28d('0x2a')](projects,['name',_0x20c773[_0xd28d('0x1b')]]);if(!_0x5ab0fc)return Project['handleNotFound'](_0x20c773);if(!_0x5ab0fc['production'])return Project[_0xd28d('0x2b')](_0x20c773);return Project[_0xd28d('0x2c')](_0x5ab0fc,_0x20c773);}function main(){var _0x2dd3aa;return utilLicense[_0xd28d('0x2d')]()[_0xd28d('0x21')](function(_0x2d78ca){if(!_0x2d78ca)return;if(_0x2d78ca[_0xd28d('0x2e')]){if(_0x2d78ca['callysquare']&&_0x2d78ca[_0xd28d('0x2f')]>0x0){logger[_0xd28d('0x14')](util['format'](_0xd28d('0x30'),_0x2d78ca[_0xd28d('0x2f')]));_0x2dd3aa=_0x2d78ca[_0xd28d('0x2f')];}else{logger[_0xd28d('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd28d('0x14')](_0xd28d('0x31'));_0x2dd3aa=-0x1;}})['then'](function(){return Project['getAll']();})[_0xd28d('0x21')](function(_0x11313a){projects=_0x11313a;return;})[_0xd28d('0x32')](function(_0x55553d){logger['error']('[LICENSE]',_0x55553d['stack']);})['finally'](function(){var _0x260b9e=require('./server')(config[_0xd28d('0x4')]['port'],config[_0xd28d('0x4')]['ip'],_0x2dd3aa);_0x260b9e['on']('error',errorHandler);_0x260b9e['on'](_0xd28d('0x33'),listeningHandler);_0x260b9e['on'](_0xd28d('0x34'),connectionHandler);_0x260b9e['on'](_0xd28d('0x35'),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 bf7c8ae..a5230b0 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 _0xb280=['catch','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x3266a0,_0x2cf10c){var _0x2cdf22=function(_0x130e1f){while(--_0x130e1f){_0x3266a0['push'](_0x3266a0['shift']());}};_0x2cdf22(++_0x2cf10c);}(_0xb280,0x1af));var _0x0b28=function(_0x3d8953,_0x230f0d){_0x3d8953=_0x3d8953-0x0;var _0x1fe09e=_0xb280[_0x3d8953];return _0x1fe09e;};'use strict';var BPromise=require(_0x0b28('0x0'));var jayson=require(_0x0b28('0x1'));var client=jayson[_0x0b28('0x2')][_0x0b28('0x3')]({'port':0x232b});function request(_0x114225,_0x20bb53){return new BPromise(function(_0x28ac70,_0x4c9e90){return client[_0x0b28('0x4')](_0x114225,_0x20bb53)[_0x0b28('0x5')](function(_0x2acdb5){if(_0x2acdb5[_0x0b28('0x6')]){return _0x4c9e90(_0x2acdb5[_0x0b28('0x6')][_0x0b28('0x7')]);}else{return _0x28ac70(_0x2acdb5[_0x0b28('0x8')]);}})[_0x0b28('0x9')](function(_0x1311c5){return _0x4c9e90(_0x1311c5);});});}exports['sendMailMessage']=function(_0xdc6e75,_0x47e238){return request(_0x0b28('0xa'),{'account':_0xdc6e75,'message':_0x47e238});}; \ No newline at end of file +var _0x15ef=['client','then','error','message','catch','sendMailMessage','jayson/promise'];(function(_0x139dc7,_0x295762){var _0x2fab4d=function(_0x203574){while(--_0x203574){_0x139dc7['push'](_0x139dc7['shift']());}};_0x2fab4d(++_0x295762);}(_0x15ef,0x141));var _0xf15e=function(_0x50daf7,_0x56bad4){_0x50daf7=_0x50daf7-0x0;var _0x349faf=_0x15ef[_0x50daf7];return _0x349faf;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf15e('0x0'));var client=jayson[_0xf15e('0x1')]['http']({'port':0x232b});function request(_0x33b090,_0x57620c){return new BPromise(function(_0x380721,_0x448e4c){return client['request'](_0x33b090,_0x57620c)[_0xf15e('0x2')](function(_0x4dd8bf){if(_0x4dd8bf['error']){return _0x448e4c(_0x4dd8bf[_0xf15e('0x3')][_0xf15e('0x4')]);}else{return _0x380721(_0x4dd8bf['result']);}})[_0xf15e('0x5')](function(_0x5486bc){return _0x448e4c(_0x5486bc);});});}exports[_0xf15e('0x6')]=function(_0x28673e,_0x487f01){return request('SendMail',{'account':_0x28673e,'message':_0x487f01});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index e21fb85..1a26b3a 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x732f=['source','target','addEdge','value','toJson','mxGraphModel','root','start','debug','joinAt','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','clear','stringify','gotoc','info','context','extension','priority','agicommand','response','code','evtHangup','isUndefined','result','toString','error','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','vertex','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','exports','lodash','util','agi','./rpc','./graph','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length'];(function(_0x56d9ca,_0x285978){var _0x4c497d=function(_0x3e5ceb){while(--_0x3e5ceb){_0x56d9ca['push'](_0x56d9ca['shift']());}};_0x4c497d(++_0x285978);}(_0x732f,0x10a));var _0xf732=function(_0x584098,_0x16cb1d){_0x584098=_0x584098-0x0;var _0x242bb6=_0x732f[_0x584098];return _0x242bb6;};'use strict';var _=require(_0xf732('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0xf732('0x1'));var logger=require('../../config/logger')(_0xf732('0x2'));var rpc=require(_0xf732('0x3'));var mailRpc=require('./mailRpc');var Graph=require(_0xf732('0x4'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xf732('0x5')]()['catch'](function(_0x5df66c){logger['error'](_0xf732('0x6'),_0x5df66c['stack']);return[];});}function addVertex(_0x53b743,_0xed29d,_0x2ae445){_0xed29d['agicommand']=_0x2ae445;if(_0xed29d['hasOwnProperty'](_0xf732('0x7'))){_0xed29d['maxRetry']=parseInt(_0xed29d[_0xf732('0x7')],0xa);}_0x53b743[_0xf732('0x8')](_[_0xf732('0x9')](_0xed29d,_0xf732('0xa')));}function initGraph(_0xa29c3f,_0x74c743){var _0x38d2b9=new Graph();for(var _0x2407b7 in _0xa29c3f){if(_0xa29c3f[_0xf732('0xb')](_0x2407b7)){if(_[_0xf732('0xc')](_0xa29c3f[_0x2407b7])){for(var _0x1a1c2d=0x0;_0x1a1c2d<_0xa29c3f[_0x2407b7][_0xf732('0xd')];_0x1a1c2d+=0x1){addVertex(_0x38d2b9,_0xa29c3f[_0x2407b7][_0x1a1c2d],_0x2407b7);}}else{addVertex(_0x38d2b9,_0xa29c3f[_0x2407b7],_0x2407b7);}}}for(var _0x400593=0x0;_0x400593<_0x74c743[_0xf732('0xd')];_0x400593+=0x1){if(_0x74c743[_0x400593][_0xf732('0xe')]&&_0x74c743[_0x400593][_0xf732('0xf')]){_0x38d2b9[_0xf732('0x10')](_0x74c743[_0x400593][_0xf732('0xe')],_0x74c743[_0x400593]['target'],_0x74c743[_0x400593][_0xf732('0x11')]);}}return _0x38d2b9;}function getRoot(_0x5dc1b5){return parser[_0xf732('0x12')](_0x5dc1b5,{'object':!![]})[_0xf732('0x13')][_0xf732('0x14')];}function inspect(_0x226e53){return util['inspect'](_0x226e53,{'showHidden':![],'depth':null});}function initialize(_0x405837,_0x4209ac){var _0x2c694f=getRoot(_0x405837['production']);if(!_0x2c694f||!_0x2c694f[_0xf732('0x15')])return;var _0x2c74da,_0x3dcf65,_0x2730f6;logger[_0xf732('0x16')](_0xf732('0x14'),JSON['stringify'](_0x2c694f,null,0x2));_0x4209ac[_0xf732('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c74da=initGraph(_['omit'](_0x2c694f,_0xf732('0xa')),_0x2c694f[_0xf732('0xa')]);_0x3dcf65=new Vertices(_0x4209ac,rpc,mailRpc);logger['info'](util[_0xf732('0x18')](_0xf732('0x19'),_0x4209ac[_0xf732('0x1a')],_0x4209ac['calleridname'],_0x4209ac['callerid'],_0x4209ac[_0xf732('0x1b')],_0x4209ac[_0xf732('0x1c')]));_0x2c74da[_0xf732('0x1d')](_0x2c694f[_0xf732('0x15')]['id'],function(_0x23b6c1){try{_0x23b6c1=_0x3dcf65[_0xf732('0x1e')](_0x23b6c1);logger[_0xf732('0x16')]('vertex',JSON[_0xf732('0x1f')](_0x23b6c1,null,0x2));if(_0x23b6c1['agicommand']===_0xf732('0x20')){logger[_0xf732('0x21')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4209ac[_0xf732('0x22')]=_0x23b6c1['context']||_0x4209ac[_0xf732('0x22')];_0x4209ac[_0xf732('0x23')]=_0x23b6c1['extension'];_0x4209ac[_0xf732('0x24')]=_0x23b6c1['priority']?_0x23b6c1[_0xf732('0x24')]-0x1:0x1;return null;}else if(_0x23b6c1&&_0x3dcf65[_0x23b6c1[_0xf732('0x25')]]){_0x2730f6=_0x3dcf65[_0x23b6c1['agicommand']](_0x23b6c1);logger[_0xf732('0x21')](_0xf732('0x26'),JSON['stringify'](_0x2730f6,null,0x2));if(_0x2730f6&&_0x2730f6[_0xf732('0x27')]===AGI_CODE_SUCCESS&&_0x2730f6['result']!==AGI_RESULT_ERROR&&!_0x4209ac[_0xf732('0x28')]){logger['debug'](_0xf732('0x26'),inspect(_0x2730f6));return _[_0xf732('0x29')](_0x2730f6['result'])?null:_0x2730f6[_0xf732('0x2a')][_0xf732('0x2b')]();}else{logger[_0xf732('0x2c')](_0xf732('0x26'),inspect(_0x2730f6));return null;}}else{logger['error'](_0xf732('0x2d'));return null;}}catch(_0x3318b0){logger[_0xf732('0x2c')](_0x3318b0[_0xf732('0x2e')]);return null;}});if(_0x2c694f[_0xf732('0x2f')]){logger[_0xf732('0x21')](util[_0xf732('0x18')](_0xf732('0x30'),_0x4209ac[_0xf732('0x1a')],_0x4209ac[_0xf732('0x31')],_0x4209ac[_0xf732('0x32')],_0x4209ac['dnid'],_0x4209ac[_0xf732('0x1c')]));_0x2c74da[_0xf732('0x1d')](_0x2c694f[_0xf732('0x2f')]['id'],function(_0x324f55){try{_0x324f55=_0x3dcf65[_0xf732('0x1e')](_0x324f55);logger[_0xf732('0x16')](_0xf732('0x33'),JSON[_0xf732('0x1f')](_0x324f55,null,0x2));if(_0x324f55&&_0x3dcf65[_0x324f55[_0xf732('0x25')]]){_0x2730f6=_0x3dcf65[_0x324f55[_0xf732('0x25')]](_0x324f55);if(_0x2730f6){logger[_0xf732('0x16')](_0xf732('0x26'),inspect(_0x2730f6));return _['isUndefined'](_0x2730f6[_0xf732('0x2a')])?null:_0x2730f6[_0xf732('0x2a')][_0xf732('0x2b')]();}else{logger[_0xf732('0x2c')](_0xf732('0x26'),inspect(_0x2730f6));return null;}}else{logger[_0xf732('0x2c')]('agicommand\x20not\x20found');return null;}}catch(_0x52247b){logger[_0xf732('0x2c')](_0x52247b[_0xf732('0x2e')]);return null;}});}logger[_0xf732('0x21')](util[_0xf732('0x18')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4209ac[_0xf732('0x1a')],_0x4209ac['calleridname'],_0x4209ac['callerid'],_0x4209ac[_0xf732('0x1b')],_0x4209ac[_0xf732('0x1c')]));logger['info'](util[_0xf732('0x18')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4209ac[_0xf732('0x22')],_0x4209ac[_0xf732('0x23')],parseInt(_0x4209ac['priority'],0xa)+0x1));_0x4209ac['continueAt'](_0x4209ac[_0xf732('0x22')],_0x4209ac[_0xf732('0x23')],parseInt(_0x4209ac[_0xf732('0x24')],0xa)+0x1);_0x4209ac['close']();}function handleNotFound(_0x3ae698){logger[_0xf732('0x2c')](util['format'](_0xf732('0x34'),_0x3ae698[_0xf732('0x1a')]));_0x3ae698['continueAt'](_0x3ae698[_0xf732('0x22')],_0x3ae698[_0xf732('0x23')],parseInt(_0x3ae698[_0xf732('0x24')],0xa)+0x1);_0x3ae698['close']();}function handleUnpublished(_0xbc5c38){logger[_0xf732('0x2c')](util[_0xf732('0x18')](_0xf732('0x35'),_0xbc5c38[_0xf732('0x1a')]));_0xbc5c38['continueAt'](_0xbc5c38['context'],_0xbc5c38[_0xf732('0x23')],parseInt(_0xbc5c38[_0xf732('0x24')],0xa)+0x1);_0xbc5c38[_0xf732('0x36')]();}module[_0xf732('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xf447=['[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','retry','maxRetry','addVertex','omit','mxCell','length','source','addEdge','target','toJson','mxGraphModel','inspect','start','debug','stringify','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','arg_1','calleridname','callerid','dnid','uniqueid','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','stack','finally','format','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','info','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x22f2f7,_0x40d431){var _0x79cca5=function(_0x430f7d){while(--_0x430f7d){_0x22f2f7['push'](_0x22f2f7['shift']());}};_0x79cca5(++_0x40d431);}(_0xf447,0x1dc));var _0x7f44=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf447[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x7f44('0x0'));var moment=require('moment');var parser=require(_0x7f44('0x1'));var util=require(_0x7f44('0x2'));var logger=require(_0x7f44('0x3'))(_0x7f44('0x4'));var rpc=require(_0x7f44('0x5'));var mailRpc=require(_0x7f44('0x6'));var Graph=require(_0x7f44('0x7'));var Vertices=require(_0x7f44('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7f44('0x9')]()[_0x7f44('0xa')](function(_0x13f7c5){logger[_0x7f44('0xb')](_0x7f44('0xc'),_0x13f7c5['stack']);return[];});}function addVertex(_0x34e784,_0x383004,_0x36bbdc){_0x383004[_0x7f44('0xd')]=_0x36bbdc;if(_0x383004['hasOwnProperty'](_0x7f44('0xe'))){_0x383004[_0x7f44('0xf')]=parseInt(_0x383004[_0x7f44('0xe')],0xa);}_0x34e784[_0x7f44('0x10')](_[_0x7f44('0x11')](_0x383004,_0x7f44('0x12')));}function initGraph(_0x25a731,_0x1967c9){var _0x480b3d=new Graph();for(var _0x5778f2 in _0x25a731){if(_0x25a731['hasOwnProperty'](_0x5778f2)){if(_['isArray'](_0x25a731[_0x5778f2])){for(var _0x5616c5=0x0;_0x5616c5<_0x25a731[_0x5778f2][_0x7f44('0x13')];_0x5616c5+=0x1){addVertex(_0x480b3d,_0x25a731[_0x5778f2][_0x5616c5],_0x5778f2);}}else{addVertex(_0x480b3d,_0x25a731[_0x5778f2],_0x5778f2);}}}for(var _0x86f953=0x0;_0x86f953<_0x1967c9[_0x7f44('0x13')];_0x86f953+=0x1){if(_0x1967c9[_0x86f953][_0x7f44('0x14')]&&_0x1967c9[_0x86f953]['target']){_0x480b3d[_0x7f44('0x15')](_0x1967c9[_0x86f953]['source'],_0x1967c9[_0x86f953][_0x7f44('0x16')],_0x1967c9[_0x86f953]['value']);}}return _0x480b3d;}function getRoot(_0x249491){return parser[_0x7f44('0x17')](_0x249491,{'object':!![]})[_0x7f44('0x18')]['root'];}function inspect(_0x378dcf){return util[_0x7f44('0x19')](_0x378dcf,{'showHidden':![],'depth':null});}function initialize(_0x1ad343,_0x36f8a9){var _0x4e701e=getRoot(_0x1ad343['production']);if(!_0x4e701e||!_0x4e701e[_0x7f44('0x1a')])return;var _0x52854a,_0xdb36d4,_0xc28c11;logger[_0x7f44('0x1b')]('root',JSON[_0x7f44('0x1c')](_0x4e701e,null,0x2));_0x36f8a9['joinAt']=moment()['format'](_0x7f44('0x1d'));_0x52854a=initGraph(_[_0x7f44('0x11')](_0x4e701e,_0x7f44('0x12')),_0x4e701e['mxCell']);_0xdb36d4=new Vertices(_0x36f8a9,rpc,mailRpc);logger['info'](util['format'](_0x7f44('0x1e'),_0x36f8a9[_0x7f44('0x1f')],_0x36f8a9[_0x7f44('0x20')],_0x36f8a9[_0x7f44('0x21')],_0x36f8a9[_0x7f44('0x22')],_0x36f8a9[_0x7f44('0x23')]));_0x52854a['traverseBFS'](_0x4e701e[_0x7f44('0x1a')]['id'],function(_0x3f83fe){try{_0x3f83fe=_0xdb36d4[_0x7f44('0x24')](_0x3f83fe);logger['debug'](_0x7f44('0x25'),JSON[_0x7f44('0x1c')](_0x3f83fe,null,0x2));if(_0x3f83fe['agicommand']==='gotoc'){logger['info'](_0x7f44('0x26'));_0x36f8a9[_0x7f44('0x27')]=_0x3f83fe[_0x7f44('0x27')]||_0x36f8a9[_0x7f44('0x27')];_0x36f8a9[_0x7f44('0x28')]=_0x3f83fe['extension'];_0x36f8a9[_0x7f44('0x29')]=_0x3f83fe['priority']?_0x3f83fe['priority']-0x1:0x1;return null;}else if(_0x3f83fe&&_0xdb36d4[_0x3f83fe[_0x7f44('0xd')]]){_0xc28c11=_0xdb36d4[_0x3f83fe[_0x7f44('0xd')]](_0x3f83fe);logger['info'](_0x7f44('0x2a'),JSON['stringify'](_0xc28c11,null,0x2));if(_0xc28c11&&_0xc28c11[_0x7f44('0x2b')]===AGI_CODE_SUCCESS&&_0xc28c11[_0x7f44('0x2c')]!==AGI_RESULT_ERROR&&!_0x36f8a9[_0x7f44('0x2d')]){logger[_0x7f44('0x1b')](_0x7f44('0x2a'),inspect(_0xc28c11));return _[_0x7f44('0x2e')](_0xc28c11[_0x7f44('0x2c')])?null:_0xc28c11[_0x7f44('0x2c')]['toString']();}else{logger[_0x7f44('0xb')]('response',inspect(_0xc28c11));return null;}}else{logger[_0x7f44('0xb')](_0x7f44('0x2f'));return null;}}catch(_0x481517){logger['error'](_0x481517[_0x7f44('0x30')]);return null;}});if(_0x4e701e[_0x7f44('0x31')]){logger['info'](util[_0x7f44('0x32')](_0x7f44('0x33'),_0x36f8a9[_0x7f44('0x1f')],_0x36f8a9[_0x7f44('0x20')],_0x36f8a9[_0x7f44('0x21')],_0x36f8a9[_0x7f44('0x22')],_0x36f8a9[_0x7f44('0x23')]));_0x52854a['traverseBFS'](_0x4e701e[_0x7f44('0x31')]['id'],function(_0x42884f){try{_0x42884f=_0xdb36d4['clear'](_0x42884f);logger[_0x7f44('0x1b')](_0x7f44('0x25'),JSON['stringify'](_0x42884f,null,0x2));if(_0x42884f&&_0xdb36d4[_0x42884f[_0x7f44('0xd')]]){_0xc28c11=_0xdb36d4[_0x42884f[_0x7f44('0xd')]](_0x42884f);if(_0xc28c11){logger[_0x7f44('0x1b')](_0x7f44('0x2a'),inspect(_0xc28c11));return _[_0x7f44('0x2e')](_0xc28c11[_0x7f44('0x2c')])?null:_0xc28c11[_0x7f44('0x2c')][_0x7f44('0x34')]();}else{logger[_0x7f44('0xb')]('response',inspect(_0xc28c11));return null;}}else{logger['error'](_0x7f44('0x2f'));return null;}}catch(_0xdc3dac){logger[_0x7f44('0xb')](_0xdc3dac['stack']);return null;}});}logger[_0x7f44('0x35')](util[_0x7f44('0x32')](_0x7f44('0x36'),_0x36f8a9[_0x7f44('0x1f')],_0x36f8a9[_0x7f44('0x20')],_0x36f8a9[_0x7f44('0x21')],_0x36f8a9[_0x7f44('0x22')],_0x36f8a9[_0x7f44('0x23')]));logger['info'](util[_0x7f44('0x32')](_0x7f44('0x37'),_0x36f8a9[_0x7f44('0x27')],_0x36f8a9[_0x7f44('0x28')],parseInt(_0x36f8a9[_0x7f44('0x29')],0xa)+0x1));_0x36f8a9['continueAt'](_0x36f8a9[_0x7f44('0x27')],_0x36f8a9['extension'],parseInt(_0x36f8a9[_0x7f44('0x29')],0xa)+0x1);_0x36f8a9[_0x7f44('0x38')]();}function handleNotFound(_0x1328dd){logger['error'](util[_0x7f44('0x32')](_0x7f44('0x39'),_0x1328dd[_0x7f44('0x1f')]));_0x1328dd['continueAt'](_0x1328dd[_0x7f44('0x27')],_0x1328dd[_0x7f44('0x28')],parseInt(_0x1328dd[_0x7f44('0x29')],0xa)+0x1);_0x1328dd[_0x7f44('0x38')]();}function handleUnpublished(_0x276cf2){logger[_0x7f44('0xb')](util['format'](_0x7f44('0x3a'),_0x276cf2[_0x7f44('0x1f')]));_0x276cf2['continueAt'](_0x276cf2[_0x7f44('0x27')],_0x276cf2['extension'],parseInt(_0x276cf2[_0x7f44('0x29')],0xa)+0x1);_0x276cf2['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e0b324e..a3636e2 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 _0xe66d=['inherits','prototype','toString','indexOf','substring','length','slice','trim','emit','headers','line','util','stream','call','_localBuffer','_inBody'];(function(_0x1833af,_0x4b9573){var _0x2104ff=function(_0x22bfb5){while(--_0x22bfb5){_0x1833af['push'](_0x1833af['shift']());}};_0x2104ff(++_0x4b9573);}(_0xe66d,0x14b));var _0xde66=function(_0x2bb82d,_0x42c7f8){_0x2bb82d=_0x2bb82d-0x0;var _0x5e0b92=_0xe66d[_0x2bb82d];return _0x5e0b92;};'use strict';var util=require(_0xde66('0x0'));var Transform=require(_0xde66('0x1'))['Transform'];function AGIReply(_0x3facc4){Transform[_0xde66('0x2')](this,_0x3facc4);this[_0xde66('0x3')]='';this[_0xde66('0x4')]=![];}util[_0xde66('0x5')](AGIReply,Transform);AGIReply[_0xde66('0x6')]['_transform']=function(_0x4d9243,_0x518834,_0x57611f){var _0x2f7518='\x0a',_0x319579=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x1052f7=-0x1,_0x5ef025=-0x1,_0xaaa888='',_0x4f3503=0x0,_0x426326='',_0x4e0ed7='';this['_localBuffer']+=_0x4d9243[_0xde66('0x7')]();_0x426326=this[_0xde66('0x3')];if(!this[_0xde66('0x4')]){_0x4f3503=0x0;while(_0x319579[_0x4f3503]){while((_0x5ef025=_0x426326[_0xde66('0x8')](_0x319579[_0x4f3503]))!=-0x1){_0xaaa888=_0x319579[_0x4f3503];_0x4e0ed7=_0x426326[_0xde66('0x9')](0x0,_0x5ef025);_0x426326=_0x426326[_0xde66('0x9')](_0x5ef025+_0xaaa888[_0xde66('0xa')]);var _0x495777=_0x4e0ed7['split'](_0x2f7518),_0x42bb45=0x0,_0x16befc={},_0x29db54='',_0x43810f='',_0x4836db=-0x1;while(_0x495777[_0x42bb45]){_0x4836db=_0x495777[_0x42bb45][_0xde66('0x8')](':');if(_0x4836db!=-0x1){_0x29db54=_0x495777[_0x42bb45]['slice'](0x0,_0x4836db)['trim']();_0x43810f=_0x495777[_0x42bb45][_0xde66('0xb')](_0x4836db+0x1)[_0xde66('0xc')]();if(_0x29db54[_0xde66('0xa')]>0x0){_0x16befc[_0x29db54]=_0x43810f;}}else{}_0x42bb45++;}this[_0xde66('0xd')](_0xde66('0xe'),_0x16befc);this['_inBody']=!![];}_0x4f3503++;}this[_0xde66('0x3')]=_0x426326;}else{while((_0x1052f7=_0x426326[_0xde66('0x8')](_0x2f7518))!=-0x1){_0x4e0ed7=_0x426326[_0xde66('0x9')](0x0,_0x1052f7);this[_0xde66('0xd')](_0xde66('0xf'),_0x4e0ed7);_0x426326=_0x426326[_0xde66('0x9')](_0x1052f7+_0x2f7518[_0xde66('0xa')]);}this[_0xde66('0x3')]=_0x426326;}_0x57611f();};module['exports']=AGIReply; \ No newline at end of file +var _0x1f61=['substring','length','split','indexOf','trim','slice','emit','headers','line','util','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x1f61,0x14c));var _0x11f6=function(_0x545240,_0x5daa34){_0x545240=_0x545240-0x0;var _0x4cf537=_0x1f61[_0x545240];return _0x4cf537;};'use strict';var util=require(_0x11f6('0x0'));var Transform=require('stream')[_0x11f6('0x1')];function AGIReply(_0x3118fd){Transform[_0x11f6('0x2')](this,_0x3118fd);this['_localBuffer']='';this[_0x11f6('0x3')]=![];}util[_0x11f6('0x4')](AGIReply,Transform);AGIReply[_0x11f6('0x5')][_0x11f6('0x6')]=function(_0xb7d9f9,_0x57c33a,_0x236f49){var _0x31e7f0='\x0a',_0x393bcd=['\x0a\x0a',_0x11f6('0x7')],_0x41e8dc=-0x1,_0x3e39ab=-0x1,_0x123951='',_0x5ad05e=0x0,_0x5df163='',_0x5d0c21='';this[_0x11f6('0x8')]+=_0xb7d9f9[_0x11f6('0x9')]();_0x5df163=this[_0x11f6('0x8')];if(!this[_0x11f6('0x3')]){_0x5ad05e=0x0;while(_0x393bcd[_0x5ad05e]){while((_0x3e39ab=_0x5df163['indexOf'](_0x393bcd[_0x5ad05e]))!=-0x1){_0x123951=_0x393bcd[_0x5ad05e];_0x5d0c21=_0x5df163[_0x11f6('0xa')](0x0,_0x3e39ab);_0x5df163=_0x5df163['substring'](_0x3e39ab+_0x123951[_0x11f6('0xb')]);var _0x5e3446=_0x5d0c21[_0x11f6('0xc')](_0x31e7f0),_0x52ede9=0x0,_0x25858d={},_0x185394='',_0x77a600='',_0x34d04b=-0x1;while(_0x5e3446[_0x52ede9]){_0x34d04b=_0x5e3446[_0x52ede9][_0x11f6('0xd')](':');if(_0x34d04b!=-0x1){_0x185394=_0x5e3446[_0x52ede9]['slice'](0x0,_0x34d04b)[_0x11f6('0xe')]();_0x77a600=_0x5e3446[_0x52ede9][_0x11f6('0xf')](_0x34d04b+0x1)[_0x11f6('0xe')]();if(_0x185394['length']>0x0){_0x25858d[_0x185394]=_0x77a600;}}else{}_0x52ede9++;}this[_0x11f6('0x10')](_0x11f6('0x11'),_0x25858d);this[_0x11f6('0x3')]=!![];}_0x5ad05e++;}this['_localBuffer']=_0x5df163;}else{while((_0x41e8dc=_0x5df163[_0x11f6('0xd')](_0x31e7f0))!=-0x1){_0x5d0c21=_0x5df163[_0x11f6('0xa')](0x0,_0x41e8dc);this[_0x11f6('0x10')](_0x11f6('0x12'),_0x5d0c21);_0x5df163=_0x5df163[_0x11f6('0xa')](_0x41e8dc+_0x31e7f0[_0x11f6('0xb')]);}this[_0x11f6('0x8')]=_0x5df163;}_0x236f49();};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 d54897a..9db3d4a 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 _0xd8ee=['Interval','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','production','ShowMailAccount','Smtp','CloudProvider','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getContactByPhone','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval'];(function(_0x26817d,_0x511e2f){var _0x26bf64=function(_0x4b70cb){while(--_0x4b70cb){_0x26817d['push'](_0x26817d['shift']());}};_0x26bf64(++_0x511e2f);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x57b159,_0x4c54ac){_0x57b159=_0x57b159-0x0;var _0x2010d5=_0xd8ee[_0x57b159];return _0x2010d5;};'use strict';var _=require(_0xed8e('0x0'));var moment=require('moment');var jayson=require(_0xed8e('0x1'));var client=jayson[_0xed8e('0x2')][_0xed8e('0x3')]({'port':0x2329});function request(_0x4ad482,_0x3982a6){return new Promise(function(_0x3db0fb,_0x3402ae){return client[_0xed8e('0x4')](_0x4ad482,_0x3982a6)[_0xed8e('0x5')](function(_0xf374c6){if(_0xf374c6['error']){return _0x3402ae(_0xf374c6[_0xed8e('0x6')][_0xed8e('0x7')]);}else{return _0x3db0fb(_0xf374c6[_0xed8e('0x8')]);}})[_0xed8e('0x9')](function(_0x6c72c8){return _0x3402ae(_0x6c72c8);});});}exports[_0xed8e('0xa')]=function(){return request(_0xed8e('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xed8e('0xc')]=function(_0x4c3458){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4c3458},'attributes':[_0xed8e('0xd')]}});};exports['getMailAccountById']=function(_0x7357ad){return request(_0xed8e('0xe'),{'options':{'raw':![],'where':{'id':_0x7357ad},'include':[{'model':'MailServerOut','as':_0xed8e('0xf'),'include':[{'model':_0xed8e('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0xed8e('0x11'),'email'],'smtp':!![]}});};exports[_0xed8e('0x12')]=function(_0x20f34b){return request(_0xed8e('0x13'),{'options':{'where':{'id':_0x20f34b},'attributes':[_0xed8e('0x11')]}});};exports[_0xed8e('0x14')]=function(_0x6444ee){return request(_0xed8e('0x15'),{'options':{'where':{'id':_0x6444ee},'attributes':[_0xed8e('0x11')]}});};exports[_0xed8e('0x16')]=function(_0x17b3c7){return request(_0xed8e('0x17'),{'options':{'where':{'id':_0x17b3c7},'attributes':[_0xed8e('0x11')]}});};exports[_0xed8e('0x18')]=function(_0x4cefe4){return request(_0xed8e('0x19'),{'options':{'where':{'id':_0x4cefe4},'attributes':['dsn']}});};exports[_0xed8e('0x1a')]=function(_0xec2257){return request('ShowUser',{'options':{'where':{'id':_0xec2257},'attributes':[_0xed8e('0x11')]}});};exports[_0xed8e('0x1b')]=function(_0x1be4d5){return request('GetContactByPhone',{'options':{'where':{'phone':_0x1be4d5['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x269324){return request(_0xed8e('0x1c'),{'options':{'where':{'id':_0x269324},'attributes':[_0xed8e('0x11')]}});};exports[_0xed8e('0x1d')]=function(_0x497e09){return request('ShowSound',{'options':{'where':{'id':_0x497e09},'attributes':[_0xed8e('0x1e')]}});};exports[_0xed8e('0x1f')]=function(_0x29e6ca){return request(_0xed8e('0x20'),{'options':{'raw':![],'where':{'id':_0x29e6ca},'include':[{'model':_0xed8e('0x21'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0xe2f3da){return request('ShowSmsAccount',{'options':{'where':{'id':_0xe2f3da},'attributes':['id',_0xed8e('0x11')]}});};exports[_0xed8e('0x22')]=function(_0x4bebfc){return request(_0xed8e('0x23'),{'body':_0x4bebfc});};exports[_0xed8e('0x24')]=function(_0x521290){return request(_0xed8e('0x25'),{'body':_0x521290});};exports['createSquareReport']=function(_0x53f9d0){return request(_0xed8e('0x26'),{'body':_[_0xed8e('0x27')](_0x53f9d0,{'project_name':_0x53f9d0[_0xed8e('0x28')],'prev_project_name':_0x53f9d0[_0xed8e('0x29')]||'','is_subproject':_0x53f9d0[_0xed8e('0x29')]?!![]:![],'leaveAt':moment()[_0xed8e('0x2a')](_0xed8e('0x2b'))})});};exports[_0xed8e('0x2c')]=function(_0xbbed86){return request(_0xed8e('0x2d'),{'body':_0xbbed86});};exports[_0xed8e('0x2e')]=function(_0x4be629){return request('CreateSquareMessage',{'body':_0x4be629});};exports['createCmContact']=function(_0x3ce206){return request(_0xed8e('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3ce206['phone'],'ListId':_0x3ce206[_0xed8e('0x30')]}}})['then'](function(_0x3531ce){if(_0x3531ce){return _0x3531ce;}return request(_0xed8e('0x31'),{'body':_0x3ce206});});};exports[_0xed8e('0x32')]=function(_0xb99b19){return request(_0xed8e('0x33'),{'options':{'where':{'id':_0xb99b19},'attributes':[_0xed8e('0x11')]}});};exports[_0xed8e('0x34')]=function(_0x8970df,_0x65c098){return request('LoginUser',{'body':{'interface':_0x65c098},'options':{'where':_0x8970df}});};exports[_0xed8e('0x35')]=function(_0x120eab,_0x86356a,_0x2e90cd){return request(_0xed8e('0x36'),{'body':{'type':_0x86356a,'uniqueid':_0x2e90cd},'options':{'where':_0x120eab}});};exports[_0xed8e('0x37')]=function(_0x1e2907){return request(_0xed8e('0x38'),{'body':{},'options':{'where':_0x1e2907}});};exports[_0xed8e('0x39')]=function(_0x2c7687){return request(_0xed8e('0x3a'),{'body':{},'options':{'where':_0x2c7687}});}; \ No newline at end of file +var _0x26cf=['name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVariableById','ShowVariable','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','ShowInterval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','then','getPauseById','ShowPause','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','error','message','result','catch','GetSquareProjects'];(function(_0x8fb89f,_0xfcf7f0){var _0x31ffb4=function(_0x2c7a69){while(--_0x2c7a69){_0x8fb89f['push'](_0x8fb89f['shift']());}};_0x31ffb4(++_0xfcf7f0);}(_0x26cf,0x135));var _0xf26c=function(_0x4eb356,_0x220cf1){_0x4eb356=_0x4eb356-0x0;var _0x3b84ef=_0x26cf[_0x4eb356];return _0x3b84ef;};'use strict';var _=require('lodash');var moment=require(_0xf26c('0x0'));var jayson=require(_0xf26c('0x1'));var client=jayson['client'][_0xf26c('0x2')]({'port':0x2329});function request(_0x5357ce,_0x1a6d9c){return new Promise(function(_0x4c414f,_0x314cdf){return client[_0xf26c('0x3')](_0x5357ce,_0x1a6d9c)['then'](function(_0x1c3d77){if(_0x1c3d77[_0xf26c('0x4')]){return _0x314cdf(_0x1c3d77[_0xf26c('0x4')][_0xf26c('0x5')]);}else{return _0x4c414f(_0x1c3d77[_0xf26c('0x6')]);}})[_0xf26c('0x7')](function(_0x4c1dc7){return _0x314cdf(_0x4c1dc7);});});}exports['getSquareProjects']=function(){return request(_0xf26c('0x8'),{'options':{'raw':![],'attributes':['id',_0xf26c('0x9'),_0xf26c('0xa')]}});};exports[_0xf26c('0xb')]=function(_0x3e1c2c){return request(_0xf26c('0xc'),{'options':{'raw':![],'where':{'name':_0x3e1c2c},'attributes':[_0xf26c('0xa')]}});};exports[_0xf26c('0xd')]=function(_0x5ba445){return request(_0xf26c('0xe'),{'options':{'raw':![],'where':{'id':_0x5ba445},'include':[{'model':_0xf26c('0xf'),'as':_0xf26c('0x10'),'include':[{'model':_0xf26c('0x11'),'as':_0xf26c('0x11')}]}],'attributes':['id','name',_0xf26c('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2cb8ae){return request('ShowSquareProject',{'options':{'where':{'id':_0x2cb8ae},'attributes':[_0xf26c('0x9')]}});};exports['getVoiceQueueById']=function(_0x55166b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x55166b},'attributes':[_0xf26c('0x9')]}});};exports[_0xf26c('0x13')]=function(_0x2314b7){return request(_0xf26c('0x14'),{'options':{'where':{'id':_0x2314b7},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x181db8){return request(_0xf26c('0x15'),{'options':{'where':{'id':_0x181db8},'attributes':['dsn']}});};exports[_0xf26c('0x16')]=function(_0x7cb19e){return request(_0xf26c('0x17'),{'options':{'where':{'id':_0x7cb19e},'attributes':[_0xf26c('0x9')]}});};exports[_0xf26c('0x18')]=function(_0x570bfb){return request(_0xf26c('0x19'),{'options':{'where':{'phone':_0x570bfb[_0xf26c('0x1a')]},'attributes':['id']}});};exports[_0xf26c('0x1b')]=function(_0x36e59d){return request(_0xf26c('0x1c'),{'options':{'where':{'id':_0x36e59d},'attributes':[_0xf26c('0x9')]}});};exports['getSoundById']=function(_0x25a06a){return request(_0xf26c('0x1d'),{'options':{'where':{'id':_0x25a06a},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x15b059){return request(_0xf26c('0x1e'),{'options':{'raw':![],'where':{'id':_0x15b059},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xf26c('0x1f')]=function(_0x265cc3){return request(_0xf26c('0x20'),{'options':{'where':{'id':_0x265cc3},'attributes':['id','name']}});};exports[_0xf26c('0x21')]=function(_0x146991){return request('CreateSmsMessage',{'body':_0x146991});};exports[_0xf26c('0x22')]=function(_0x4e2366){return request(_0xf26c('0x23'),{'body':_0x4e2366});};exports[_0xf26c('0x24')]=function(_0x4f1d4d){return request(_0xf26c('0x25'),{'body':_['merge'](_0x4f1d4d,{'project_name':_0x4f1d4d['arg_1'],'prev_project_name':_0x4f1d4d[_0xf26c('0x26')]||'','is_subproject':_0x4f1d4d[_0xf26c('0x26')]?!![]:![],'leaveAt':moment()[_0xf26c('0x27')](_0xf26c('0x28'))})});};exports[_0xf26c('0x29')]=function(_0x373742){return request('CreateSquareRecording',{'body':_0x373742});};exports['createSquareMessage']=function(_0x2b93d2){return request(_0xf26c('0x2a'),{'body':_0x2b93d2});};exports[_0xf26c('0x2b')]=function(_0x33379b){return request(_0xf26c('0x2c'),{'options':{'raw':![],'where':{'phone':_0x33379b['phone'],'ListId':_0x33379b['ListId']}}})[_0xf26c('0x2d')](function(_0x4bcd8e){if(_0x4bcd8e){return _0x4bcd8e;}return request('CreateCmContact',{'body':_0x33379b});});};exports[_0xf26c('0x2e')]=function(_0x6cd75e){return request(_0xf26c('0x2f'),{'options':{'where':{'id':_0x6cd75e},'attributes':[_0xf26c('0x9')]}});};exports['agentLogin']=function(_0x191377,_0x2545a4){return request(_0xf26c('0x30'),{'body':{'interface':_0x2545a4},'options':{'where':_0x191377}});};exports['agentPause']=function(_0x495a81,_0x4df472,_0x2653ce){return request(_0xf26c('0x31'),{'body':{'type':_0x4df472,'uniqueid':_0x2653ce},'options':{'where':_0x495a81}});};exports['agentUnpause']=function(_0x187ae8){return request(_0xf26c('0x32'),{'body':{},'options':{'where':_0x187ae8}});};exports[_0xf26c('0x33')]=function(_0x1a66ff){return request(_0xf26c('0x34'),{'body':{},'options':{'where':_0x1a66ff}});}; \ 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 28cfe96..a637f00 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc949=['exports','./polly'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc949,0x181));var _0x9c94=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc949[_0xefd519];return _0x4bb882;};var polly=require(_0x9c94('0x0'));var lex=require('./lex');module[_0x9c94('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index b5a3901..4166260 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 _0x6e6c=['exports','./lib/api'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ No newline at end of file +var _0xb43b=['./lib/api','exports'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x406410,_0x5dcf89){_0x406410=_0x406410-0x0;var _0xea8eac=_0xb43b[_0x406410];return _0xea8eac;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ 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 84be285..77ff55f 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(_0x59c207,_0x591a7e){var _0x489e1b=function(_0x178515){while(--_0x178515){_0x59c207['push'](_0x59c207['shift']());}};_0x489e1b(++_0x591a7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0xa168c,_0x182f48){var _0x536137=function(_0x1f3a6c){while(--_0x1f3a6c){_0xa168c['push'](_0xa168c['shift']());}};_0x536137(++_0x182f48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 208a3f5..542fe75 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ea6=['./lib/api','exports'];(function(_0x285c71,_0x355271){var _0x55eba4=function(_0x2230c8){while(--_0x2230c8){_0x285c71['push'](_0x285c71['shift']());}};_0x55eba4(++_0x355271);}(_0x3ea6,0xcc));var _0x63ea=function(_0x304780,_0x44871c){_0x304780=_0x304780-0x0;var _0x4a8f96=_0x3ea6[_0x304780];return _0x4a8f96;};'use strict';var polly=require(_0x63ea('0x0'));module[_0x63ea('0x1')]=function(_0x14a561,_0x5c12cd,_0x3ccda0,_0x46e85d,_0x5273fa,_0x177342,_0x56c516){return polly(_0x14a561,_0x5c12cd,_0x3ccda0,_0x46e85d,_0x5273fa,_0x177342,_0x56c516);}; \ No newline at end of file +var _0xadf4=['exports','./lib/api'];(function(_0x4395e7,_0x3dd4ce){var _0x22f920=function(_0x42eb17){while(--_0x42eb17){_0x4395e7['push'](_0x4395e7['shift']());}};_0x22f920(++_0x3dd4ce);}(_0xadf4,0x111));var _0x4adf=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0xadf4[_0x20cb20];return _0x2fcf4b;};'use strict';var polly=require(_0x4adf('0x0'));module[_0x4adf('0x1')]=function(_0x5c363d,_0x7388fa,_0x315b63,_0x1e4a45,_0x34143a,_0x4650f2,_0x3c315b){return polly(_0x5c363d,_0x7388fa,_0x315b63,_0x1e4a45,_0x34143a,_0x4650f2,_0x3c315b);}; \ 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 42c1185..351b391 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 _0x5d92=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','randomstring','AudioStream'];(function(_0x32f5b8,_0xf00eca){var _0xf919bc=function(_0x245460){while(--_0x245460){_0x32f5b8['push'](_0x32f5b8['shift']());}};_0xf919bc(++_0xf00eca);}(_0x5d92,0x135));var _0x25d9=function(_0x16fe8f,_0x3c70ce){_0x16fe8f=_0x16fe8f-0x0;var _0x3e35e9=_0x5d92[_0x16fe8f];return _0x3e35e9;};'use strict';var fs=require('fs');var path=require(_0x25d9('0x0'));var BPromise=require('bluebird');var rs=require(_0x25d9('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x55a692,_0xff95d9,_0x26ae69){return new BPromise(function(_0x3dc44c,_0xdf812c){_0x55a692['synthesizeSpeech'](_0xff95d9,function(_0x1a88cc,_0x523e6d){if(_0x1a88cc){_0xdf812c(_0x1a88cc);}else if(_0x523e6d){if(_0x523e6d[_0x25d9('0x2')]instanceof Buffer){fs['writeFile'](_0x26ae69,_0x523e6d[_0x25d9('0x2')],function(_0x41528d){if(_0x41528d){_0xdf812c(_0x41528d);}else{_0x3dc44c();}});}else{_0xdf812c(new Error(_0x25d9('0x3')));}}else{_0xdf812c(new Error(_0x25d9('0x4')));}});});}module[_0x25d9('0x5')]=function(_0x4903ca,_0x4d7043,_0x528ada,_0x2eb3c8,_0x429f38,_0x47b492,_0x1c2163){var _0x4a2354=new AWS[(_0x25d9('0x6'))]({'accessKeyId':_0x4903ca,'secretAccessKey':_0x4d7043,'region':_0x528ada});var _0x4719a4={'Text':_0x429f38,'TextType':_0x47b492||'text','OutputFormat':_0x25d9('0x7'),'VoiceId':_0x2eb3c8};return pollyResult(_0x4a2354,_0x4719a4,_0x1c2163);}; \ No newline at end of file +var _0x9fff=['path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3'];(function(_0x2a1596,_0x4ab29e){var _0x206b01=function(_0x27f837){while(--_0x27f837){_0x2a1596['push'](_0x2a1596['shift']());}};_0x206b01(++_0x4ab29e);}(_0x9fff,0x1b8));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xf9ff('0x0'));var BPromise=require(_0xf9ff('0x1'));var rs=require('randomstring');var AWS=require(_0xf9ff('0x2'));function pollyResult(_0x366e57,_0xdd14e5,_0x27636d){return new BPromise(function(_0x17c747,_0x2c7751){_0x366e57[_0xf9ff('0x3')](_0xdd14e5,function(_0x4dfb59,_0x3553cd){if(_0x4dfb59){_0x2c7751(_0x4dfb59);}else if(_0x3553cd){if(_0x3553cd[_0xf9ff('0x4')]instanceof Buffer){fs[_0xf9ff('0x5')](_0x27636d,_0x3553cd[_0xf9ff('0x4')],function(_0x937fb9){if(_0x937fb9){_0x2c7751(_0x937fb9);}else{_0x17c747();}});}else{_0x2c7751(new Error(_0xf9ff('0x6')));}}else{_0x2c7751(new Error(_0xf9ff('0x7')));}});});}module[_0xf9ff('0x8')]=function(_0x10d76f,_0x378519,_0x2f6c75,_0x1e552e,_0x1866b4,_0x30701f,_0x258966){var _0x203b84=new AWS[(_0xf9ff('0x9'))]({'accessKeyId':_0x10d76f,'secretAccessKey':_0x378519,'region':_0x2f6c75});var _0x471465={'Text':_0x1866b4,'TextType':_0x30701f||'text','OutputFormat':_0xf9ff('0xa'),'VoiceId':_0x1e552e};return pollyResult(_0x203b84,_0x471465,_0x258966);}; \ 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 9c27523..ce4c152 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 _0x8a34=['exports','./lib/api'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x8a34,0x91));var _0x48a3=function(_0x128607,_0x242e5f){_0x128607=_0x128607-0x0;var _0x4ba37b=_0x8a34[_0x128607];return _0x4ba37b;};'use strict';var asr=require(_0x48a3('0x0'));module[_0x48a3('0x1')]=function(_0x287564,_0x101f12,_0x248f60,_0xd142){return asr(_0x287564,_0x101f12,_0x248f60);}; \ No newline at end of file +var _0x4c24=['exports','./lib/api'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x4c24,0x9d));var _0x44c2=function(_0x43a8b0,_0x424a8){_0x43a8b0=_0x43a8b0-0x0;var _0x5efafb=_0x4c24[_0x43a8b0];return _0x5efafb;};'use strict';var asr=require(_0x44c2('0x0'));module[_0x44c2('0x1')]=function(_0x5210e3,_0x5a134f,_0x28a554,_0x112d0c){return asr(_0x5210e3,_0x5a134f,_0x28a554);}; \ 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 a1a0ebf..c7e4433 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 _0x9bde=['base64','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x2dc2f9,_0x3f3394){var _0x7f9396=function(_0x38d080){while(--_0x38d080){_0x2dc2f9['push'](_0x2dc2f9['shift']());}};_0x7f9396(++_0x3f3394);}(_0x9bde,0xe1));var _0xe9bd=function(_0x297a56,_0x1cd565){_0x297a56=_0x297a56-0x0;var _0x446ffd=_0x9bde[_0x297a56];return _0x446ffd;};'use strict';var url=require('url');var BPromise=require(_0xe9bd('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xe9bd('0x1')]=function(_0x4c63ca,_0x51786f,_0x3005aa){return new BPromise(function(_0x131f6a,_0x1c1b34){var _0x10822d;if(typeof _0x4c63ca!==_0xe9bd('0x2')||_0x4c63ca[_0xe9bd('0x3')]===0x0){return _0x1c1b34('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x51786f!==_0xe9bd('0x2')||_0x51786f[_0xe9bd('0x3')]===0x0){return _0x1c1b34(_0xe9bd('0x4'));}if(typeof _0x3005aa!==_0xe9bd('0x5')&&(typeof _0x3005aa!==_0xe9bd('0x2')||_0x3005aa[_0xe9bd('0x3')]===0x0)){return _0x1c1b34(_0xe9bd('0x6'));}try{_0x10822d=fs[_0xe9bd('0x7')](_0x4c63ca)[_0xe9bd('0x8')](_0xe9bd('0x9'));}catch(_0x581602){return _0x1c1b34(_0x581602);}return _0x131f6a({'method':'POST','uri':host+_0xe9bd('0xa')+_0x51786f,'body':{'config':{'encoding':_0xe9bd('0xb'),'sampleRateHertz':_0xe9bd('0xc'),'languageCode':_0x3005aa},'audio':{'content':_0x10822d}},'json':!![]});});}; \ No newline at end of file +var _0xd87e=['bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x3ca3c3,_0x13a3ca){var _0x9b314b=function(_0x5ec7dd){while(--_0x5ec7dd){_0x3ca3c3['push'](_0x3ca3c3['shift']());}};_0x9b314b(++_0x13a3ca);}(_0xd87e,0x1bf));var _0xed87=function(_0x8b635c,_0x5c53b1){_0x8b635c=_0x8b635c-0x0;var _0x47f539=_0xd87e[_0x8b635c];return _0x47f539;};'use strict';var url=require(_0xed87('0x0'));var BPromise=require(_0xed87('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed87('0x2')]=function(_0x189fdd,_0x16509b,_0x5901be){return new BPromise(function(_0xbbee79,_0x5e960f){var _0x11a5d9;if(typeof _0x189fdd!==_0xed87('0x3')||_0x189fdd['length']===0x0){return _0x5e960f(_0xed87('0x4'));}if(typeof _0x16509b!=='string'||_0x16509b['length']===0x0){return _0x5e960f(_0xed87('0x5'));}if(typeof _0x5901be!==_0xed87('0x6')&&(typeof _0x5901be!==_0xed87('0x3')||_0x5901be[_0xed87('0x7')]===0x0)){return _0x5e960f('lang\x20should\x20be\x20a\x20string');}try{_0x11a5d9=fs[_0xed87('0x8')](_0x189fdd)[_0xed87('0x9')](_0xed87('0xa'));}catch(_0x3c9a3c){return _0x5e960f(_0x3c9a3c);}return _0xbbee79({'method':_0xed87('0xb'),'uri':host+_0xed87('0xc')+_0x16509b,'body':{'config':{'encoding':_0xed87('0xd'),'sampleRateHertz':'8000','languageCode':_0x5901be},'audio':{'content':_0x11a5d9}},'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 aeebfbc..ee2fa16 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 _0x8098=['exports','./asr'];(function(_0x28ff41,_0x3e835a){var _0x3f9639=function(_0x1ac685){while(--_0x1ac685){_0x28ff41['push'](_0x28ff41['shift']());}};_0x3f9639(++_0x3e835a);}(_0x8098,0x189));var _0x8809=function(_0x3d4eb7,_0x184408){_0x3d4eb7=_0x3d4eb7-0x0;var _0x32dd45=_0x8098[_0x3d4eb7];return _0x32dd45;};var asr=require(_0x8809('0x0'));module[_0x8809('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6a4c=['exports'];(function(_0x77f268,_0x5eb97e){var _0x4cd4e5=function(_0x3f7a7a){while(--_0x3f7a7a){_0x77f268['push'](_0x77f268['shift']());}};_0x4cd4e5(++_0x5eb97e);}(_0x6a4c,0x1ec));var _0xc6a4=function(_0x3b7572,_0x447d59){_0x3b7572=_0x3b7572-0x0;var _0x33d8c5=_0x6a4c[_0x3b7572];return _0x33d8c5;};var asr=require('./asr');module[_0xc6a4('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 b22e771..05b9cf1 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 _0x926b=['finish\x20download\x20file','unlink','download\x20error','pipe','protocol','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','then','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','code','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','querystring','request-promise','randomstring','google-tts-api','url','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info'];(function(_0x26830d,_0xd9c84b){var _0x3f57da=function(_0x27621e){while(--_0x27621e){_0x26830d['push'](_0x26830d['shift']());}};_0x3f57da(++_0xd9c84b);}(_0x926b,0x74));var _0xb926=function(_0x49960e,_0x27c15c){_0x49960e=_0x49960e-0x0;var _0x53c21f=_0x926b[_0x49960e];return _0x53c21f;};'use strict';var apiai=require(_0xb926('0x0'));var BPromise=require(_0xb926('0x1'));var dialogflow=require(_0xb926('0x2'));var fs=require('fs');var http=require(_0xb926('0x3'));var https=require(_0xb926('0x4'));var md5=require('md5');var path=require('path');var querystring=require(_0xb926('0x5'));var rp=require(_0xb926('0x6'));var rs=require(_0xb926('0x7'));var sox=require('sox');var tts=require(_0xb926('0x8'));var urlParse=require(_0xb926('0x9'))['parse'];var util=require('util');var aws=require(_0xb926('0xa'));var google=require(_0xb926('0xb'));var sestek=require(_0xb926('0xc'));var tilde=require(_0xb926('0xd'));var logger=require(_0xb926('0xe'))(_0xb926('0xf'));var ISPEECH_API=_0xb926('0x10');function downloadFile(_0x35dec5,_0x535e9a){return new BPromise(function(_0x3c1f0d,_0x1324b1){var _0x53118d=urlParse(_0x35dec5);var _0x146e4f=_0x53118d['protocol']===_0xb926('0x11')?https:http;var _0x293208={'host':_0x53118d[_0xb926('0x12')],'path':_0x53118d['path'],'headers':{'user-agent':_0xb926('0x13')}};_0x146e4f[_0xb926('0x14')](_0x293208,function(_0x4e7426){if(_0x4e7426[_0xb926('0x15')]!==0xc8){logger[_0xb926('0x16')](_0xb926('0x17')+_0x35dec5+_0xb926('0x18')+_0x4e7426[_0xb926('0x15')]+'\x20('+_0x4e7426['statusMessage']+')');_0x1324b1(new Error('request\x20to\x20'+_0x35dec5+_0xb926('0x18')+_0x4e7426[_0xb926('0x15')]+'\x20('+_0x4e7426[_0xb926('0x19')]+')'));return;}var _0xc9499e=fs[_0xb926('0x1a')](_0x535e9a);_0xc9499e['on']('finish',function(){logger[_0xb926('0x1b')](_0xb926('0x1c'));_0xc9499e['close'](_0x3c1f0d);});_0xc9499e['on'](_0xb926('0x16'),function(_0x475d3c){fs[_0xb926('0x1d')](_0x535e9a);logger[_0xb926('0x16')](_0xb926('0x1e'),_0x475d3c);_0x1324b1(_0x475d3c);});_0x4e7426[_0xb926('0x1f')](_0xc9499e);})['on'](_0xb926('0x16'),function(_0x434339){logger[_0xb926('0x16')](_0x434339);_0x1324b1(_0x434339);})['end']();});}function uploadFile(_0x29d134){return new BPromise(function(_0x45ecd6,_0x2d35fc){var _0x5d9787=urlParse(_0x29d134);var _0x5bfd16=_0x5d9787[_0xb926('0x20')]==='https:'?https:http;var _0x3b0f9e={'host':_0x5d9787[_0xb926('0x12')],'path':_0x5d9787['path'],'headers':{'user-agent':_0xb926('0x13')}};_0x5bfd16[_0xb926('0x14')](_0x3b0f9e,function(_0x1de09a){if(_0x1de09a[_0xb926('0x15')]!==0xc8){_0x2d35fc(new Error('request\x20to\x20'+_0x29d134+_0xb926('0x18')+_0x1de09a['statusCode']+'\x20('+_0x1de09a[_0xb926('0x19')]+')'));return;}var _0x3ea89f='';_0x1de09a['on'](_0xb926('0x21'),function(_0x409c87){_0x3ea89f+=_0x409c87;});_0x1de09a['on'](_0xb926('0x22'),function(){_0x45ecd6(_0x3ea89f);});})['on']('error',function(_0x6d5afb){_0x2d35fc(_0x6d5afb);})[_0xb926('0x22')]();});}function convertFile(_0x577998,_0x1ef03d){return new BPromise(function(_0x3d2a62,_0xba31c2){var _0x4cc46c=sox[_0xb926('0x23')](_0x577998,_0x1ef03d,{'sampleRate':0x1f40,'format':_0xb926('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4cc46c['on'](_0xb926('0x16'),function(_0x1e9888){logger[_0xb926('0x16')](_0xb926('0x25'),_0x1e9888);_0xba31c2(_0x1e9888);});_0x4cc46c['on'](_0xb926('0x22'),function(){logger[_0xb926('0x1b')](_0xb926('0x26'));_0x3d2a62();});_0x4cc46c[_0xb926('0x27')]();});}function base64Decode(_0x159c62,_0x12c04f){var _0x38bb91=path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+_0xb926('0x2b'));fs[_0xb926('0x2c')](_0x38bb91,_0x159c62,_0xb926('0x2d'));return convertFile(_0x38bb91,_0x12c04f)['then'](function(){try{fs['unlink'](_0x38bb91);fs[_0xb926('0x2e')](_0x12c04f,_0xb926('0x2f'));}catch(_0x1fdc4c){logger[_0xb926('0x16')](_0x1fdc4c);}return _0x12c04f[_0xb926('0x30')]('.')[0x0];});}function base64Encode(_0x4fb216){var _0x49bdde=fs[_0xb926('0x31')](_0x4fb216);return new Buffer(_0x49bdde)[_0xb926('0x32')]('base64');}exports[_0xb926('0x33')]=function(_0x8e15c2,_0x24cfdf,_0x5cba1c,_0x18340d,_0x423b9f,_0x25a16f){var _0x4a2201,_0xe2fb88;var _0xf0cc66=_0xb926('0x34');var _0x382816=_0xb926('0x35')+_0x8e15c2;var _0x5af785={};if(_0x24cfdf==='ssml'){_0x5af785[_0xb926('0x36')]={'ssml':_0x5cba1c};}else{_0x5af785[_0xb926('0x36')]={'text':_0x5cba1c};};_0x5af785[_0xb926('0x37')]={'languageCode':_0x18340d,'ssmlGender':_0x423b9f};_0x5af785['audioConfig']={'audioEncoding':_0xb926('0x38'),'sampleRateHertz':0x1f40};var _0x3973e4={'url':_0xf0cc66+_0xb926('0x39')+_0x382816,'method':_0xb926('0x3a'),'json':!![],'body':_0x5af785};return rp(_0x3973e4)[_0xb926('0x3b')](function(_0x1fbce9){return new BPromise(function(_0x37147c,_0x287414){_0x4a2201=path['resolve'](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+_0xb926('0x3c'));var _0x310e61=Buffer[_0xb926('0x3d')](_0x1fbce9[_0xb926('0x3e')],_0xb926('0x2d'));return fs['writeFile'](_0x4a2201,_0x310e61,function(_0xfc3432){_0x287414(_0xfc3432);},function(_0x1e2ce8){fs[_0xb926('0x2e')](_0x4a2201,_0xb926('0x2f'));_0x37147c(_0x1e2ce8);});});})[_0xb926('0x3b')](function(_0x5d7130){_0xe2fb88=path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+'.wav');return convertFile(_0x4a2201,_0xe2fb88);})[_0xb926('0x3b')](function(){try{fs[_0xb926('0x1d')](_0x4a2201);fs['chmodSync'](_0xe2fb88,_0xb926('0x2f'));}catch(_0x493e49){logger[_0xb926('0x16')](_0x493e49);}logger['info'](_0xb926('0x3f'),_0xe2fb88[_0xb926('0x30')]('.')[0x0]);return _0xe2fb88[_0xb926('0x30')]('.')[0x0];});};exports[_0xb926('0x40')]=function(_0x2b57e1,_0x35efdf){var _0x186297=_0xb926('0x41');var _0x55f2e0,_0x5998c6;var _0x550314;var _0x4111e5={'encoding':_0xb926('0x42'),'method':_0xb926('0x3a'),'timeout':0x2710,'url':_0x186297,'headers':{'Content-Type':_0xb926('0x43')},'body':_0xb926('0x44')+encodeURIComponent(JSON[_0xb926('0x45')]([[[_0xb926('0x46'),JSON[_0xb926('0x45')]([_0x2b57e1,_0x35efdf||'en',![],_0xb926('0x47')]),null,_0xb926('0x48')]]]))};return rp(_0x4111e5)[_0xb926('0x3b')](function(_0x3ceb93){try{_0x550314=eval(_0x3ceb93[_0xb926('0x49')](0x5))[0x0][0x2];}catch(_0x22d645){throw new Error(_0xb926('0x4a')+_0x3ceb93[_0xb926('0x21')]);}if(!_0x550314){if(_0x2b57e1[_0xb926('0x4b')]>0xc8){throw new Error(_0xb926('0x4c'));}else{throw new Error(_0xb926('0x4d')+_0x35efdf+_0xb926('0x4e'));}}try{_0x550314=eval(_0x550314)[0x0];}catch(_0x1fdb35){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xb926('0x21')]);}const _0x554b88=_0x550314;_0x55f2e0=path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+_0xb926('0x3c'));fs['writeFileSync'](_0x55f2e0,_0x550314,{'encoding':_0xb926('0x2d')});_0x5998c6=path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+'.wav');return convertFile(_0x55f2e0,_0x5998c6);})[_0xb926('0x3b')](function(){try{fs[_0xb926('0x1d')](_0x55f2e0);fs[_0xb926('0x2e')](_0x5998c6,'777');}catch(_0x30c436){logger[_0xb926('0x16')](_0x30c436);}logger[_0xb926('0x1b')](_0xb926('0x4f'),_0x5998c6[_0xb926('0x30')]('.')[0x0]);return _0x5998c6['split']('.')[0x0];});};exports[_0xb926('0x50')]=function(_0x370091,_0x460fd4,_0x47877f){return google['asr'](_0x370091,_0x460fd4,_0x47877f)[_0xb926('0x3b')](function(_0x2a7650){logger['info'](_0x2a7650[_0xb926('0x51')]);return rp(_0x2a7650);})[_0xb926('0x3b')](function(_0x4fecf8){var _0x5760c8='';var _0x4672dc=0x0;try{fs[_0xb926('0x1d')](_0x370091);}catch(_0x36368c){logger[_0xb926('0x16')](_0x36368c);}if(_0x4fecf8&&_0x4fecf8[_0xb926('0x52')]){_0x5760c8=_0x4fecf8['results'][_0xb926('0x53')](function(_0x53f375){return _0x53f375&&_0x53f375[_0xb926('0x54')][0x0]&&_0x53f375[_0xb926('0x54')][0x0][_0xb926('0x55')]?_0x53f375['alternatives'][0x0][_0xb926('0x55')]:'';})[_0xb926('0x56')]('\x0a');_0x4672dc=_0x4fecf8[_0xb926('0x52')][_0xb926('0x53')](function(_0x786d7f){return _0x786d7f&&_0x786d7f[_0xb926('0x54')][0x0]&&_0x786d7f['alternatives'][0x0][_0xb926('0x57')]?_0x786d7f['alternatives'][0x0][_0xb926('0x57')]:0x0;})[_0xb926('0x56')]('\x0a');}logger[_0xb926('0x1b')]('googleASR\x20transcription',_0x5760c8);logger[_0xb926('0x1b')](_0xb926('0x58'),_0x4672dc);return{'transcript':_0x5760c8,'confidence':_0x4672dc};})[_0xb926('0x59')](function(_0x5c9666){logger[_0xb926('0x16')]('[%s]\x20%s:%s',_0x5c9666[_0xb926('0x15')],_0x5c9666['name'],_0x5c9666[_0xb926('0x5a')]);});};exports[_0xb926('0x5b')]=function(_0x4c81c9,_0x14d228,_0x4f5cc6,_0x594fdf){var _0x48f8da=apiai(_0x14d228,{'language':_0x594fdf||'en'});return _0x48f8da[_0xb926('0x5c')](_0x4f5cc6,{'sessionId':md5(_0x4c81c9)})[_0xb926('0x3b')](function(_0x429a75){logger['info'](JSON['stringify'](_0x429a75));return{'source':_0x429a75[_0xb926('0x5d')][_0xb926('0x5e')],'resolvedQuery':_0x429a75[_0xb926('0x5d')][_0xb926('0x5f')],'action':_0x429a75[_0xb926('0x5d')][_0xb926('0x60')],'actionIncomplete':_0x429a75[_0xb926('0x5d')][_0xb926('0x61')],'speech':_0x429a75[_0xb926('0x5d')]['fulfillment'][_0xb926('0x62')],'score':_0x429a75[_0xb926('0x5d')][_0xb926('0x63')],'statusCode':_0x429a75[_0xb926('0x64')][_0xb926('0x65')],'endConversation':_0x429a75[_0xb926('0x5d')]['metadata']['endConversation']||![],'isFallbackIntent':_0x429a75['result']['metadata'][_0xb926('0x66')]};});};exports[_0xb926('0x67')]=function(_0x3b442f,_0x3869c5,_0x22f0e9,_0x209de6,_0x2031d3,_0x818efb){var _0x539d76=_0x209de6[_0xb926('0x68')](/\\n/g,'\x0a');var _0x214840={'credentials':{'private_key':_0x539d76,'client_email':_0x22f0e9}};var _0x58e96e=new dialogflow[(_0xb926('0x69'))](_0x214840);var _0x24d4ea=_0x58e96e[_0xb926('0x6a')](_0x3869c5,md5(_0x3b442f));var _0x52918b={'session':_0x24d4ea,'queryInput':{'text':{'text':_0x2031d3,'languageCode':_0x818efb}}};return _0x58e96e[_0xb926('0x6b')](_0x52918b)[_0xb926('0x3b')](function(_0x49594a){if(_0x49594a&&_0x49594a['length']){logger[_0xb926('0x1b')]('Dialogflow\x20V2\x20response:',JSON[_0xb926('0x45')](_0x49594a));var _0x18b0e6=_0x49594a[0x0];if(_0x18b0e6){var _0x5437fb={'action':_0x18b0e6['queryResult'][_0xb926('0x60')],'allRequiredParamsPresent':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x6d')],'endConversation':_0x18b0e6['queryResult'][_0xb926('0x6e')]&&_0x18b0e6['queryResult'][_0xb926('0x6e')][_0xb926('0x6f')]?_0x18b0e6[_0xb926('0x6c')]['diagnosticInfo'][_0xb926('0x6f')][_0xb926('0x70')][_0xb926('0x71')]:![],'fulfillmentText':_0x18b0e6['queryResult'][_0xb926('0x72')],'intentName':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x73')][_0xb926('0x74')],'intentDisplayName':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x73')][_0xb926('0x75')],'isFallbackIntent':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x73')][_0xb926('0x76')],'languageCode':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x77')],'queryText':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x78')],'responseId':_0x18b0e6[_0xb926('0x79')],'score':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x7a')],'speech':_0x18b0e6[_0xb926('0x6c')][_0xb926('0x72')],'providerResponse':JSON[_0xb926('0x45')](_0x49594a)};return _0x5437fb;}}});};exports[_0xb926('0x7b')]=function(_0x9ebab0,_0x153e5a,_0x305082,_0x5d2605){return tilde[_0xb926('0x7c')](_0x9ebab0,_0x153e5a,_0x305082,_0x5d2605)[_0xb926('0x3b')](function(_0x1fbd8a){try{fs[_0xb926('0x1d')](_0x9ebab0);}catch(_0x5bd039){logger[_0xb926('0x16')](_0x5bd039);}logger[_0xb926('0x1b')](_0xb926('0x7d'),_0x1fbd8a[_0xb926('0x55')]);logger['info'](_0xb926('0x7e'),_0x1fbd8a[_0xb926('0x57')]);return _0x1fbd8a;});};exports['awsPolly']=function(_0x302176,_0x155e1b,_0xce717f,_0x19a46e,_0x3a42b8,_0x39cc5f){var _0x383598=path['resolve'](__dirname,'tmp',rs[_0xb926('0x2a')](0x4)+_0xb926('0x3c'));var _0x7bb2c7;return aws[_0xb926('0x7f')](_0x302176,_0x155e1b,_0xce717f,_0x19a46e,_0x3a42b8,_0x39cc5f,_0x383598)[_0xb926('0x3b')](function(){_0x7bb2c7=path['resolve'](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+'.wav');return convertFile(_0x383598,_0x7bb2c7);})[_0xb926('0x3b')](function(){try{fs[_0xb926('0x1d')](_0x383598);fs[_0xb926('0x2e')](_0x7bb2c7,'777');}catch(_0x5efae2){logger[_0xb926('0x16')](_0x5efae2);}return _0x7bb2c7['split']('.')[0x0];});};exports[_0xb926('0x80')]=function(_0x2c9907,_0x38aea5,_0x4a22c8,_0x210e1d,_0x58c458,_0x9f3301){return aws[_0xb926('0x81')](_0x2c9907,_0x38aea5,_0x4a22c8,_0x210e1d,_0x58c458,_0x9f3301)[_0xb926('0x3b')](function(_0x35321e){logger[_0xb926('0x1b')](JSON[_0xb926('0x45')](_0x35321e));return _0x35321e;});};exports[_0xb926('0x82')]=function(_0xfea1a2,_0x139a5f,_0x5c368e,_0x3edf56){var _0x414e0c=util[_0xb926('0x83')](_0xb926('0x84'),ISPEECH_API,_0xfea1a2,encodeURIComponent(_0x139a5f),_0x5c368e,_0x3edf56);var _0xfaa7ac=path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+_0xb926('0x3c'));var _0x279b8b;return downloadFile(_0x414e0c,_0xfaa7ac)[_0xb926('0x3b')](function(){_0x279b8b=path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+_0xb926('0x2b'));return convertFile(_0xfaa7ac,_0x279b8b);})['then'](function(){try{fs[_0xb926('0x1d')](_0xfaa7ac);fs[_0xb926('0x2e')](_0x279b8b,_0xb926('0x2f'));}catch(_0x5e398c){logger[_0xb926('0x16')](_0x5e398c);}return _0x279b8b[_0xb926('0x30')]('.')[0x0];});};exports[_0xb926('0x85')]=function(_0x46cd6f,_0x4559a9,_0x296060,_0x1a48fa){var _0x3c24e9=util['format'](_0xb926('0x86'),ISPEECH_API,_0x4559a9,_0x296060,base64Encode(_0x46cd6f),_0x1a48fa?util[_0xb926('0x83')](_0xb926('0x87'),encodeURIComponent(_0x1a48fa)):_0xb926('0x88'));return uploadFile(_0x3c24e9)[_0xb926('0x3b')](function(_0x3f4a50){return querystring['parse'](_0x3f4a50);});};exports['sestekNDA']=function(_0x12bdab,_0x53ab84){return sestek['nda'](_0x12bdab,_0x53ab84)['then'](function(_0x14108a){logger[_0xb926('0x1b')](JSON[_0xb926('0x45')](_0x14108a));var _0x18151a={'speech':_0x14108a[_0xb926('0x89')],'action':_0x14108a[_0xb926('0x8a')]?_0x14108a[_0xb926('0x8a')][_0xb926('0x8b')]:undefined,'actiondata':_0x14108a[_0xb926('0x8a')]?_0x14108a['channelData']['CustomActionData']:undefined};if(_0x14108a[_0xb926('0x8a')]&&_0x14108a['channelData']['AudioFromTts']){return base64Decode(_0x14108a[_0xb926('0x8a')][_0xb926('0x8c')][_0xb926('0x8d')],path[_0xb926('0x28')](__dirname,_0xb926('0x29'),rs[_0xb926('0x2a')](0x4)+_0xb926('0x2b')))[_0xb926('0x3b')](function(_0x2544a4){_0x18151a[_0xb926('0x8e')]=_0x2544a4;return _0x18151a;});}return _0x18151a;});};exports[_0xb926('0x8f')]=function(){return __dirname;}; \ No newline at end of file +var _0x4680=['parse','nda','text','channelData','CustomActionData','Data','audiofile','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https:','host','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish\x20download\x20file','close','unlink','end','protocol','WHAT_EVER','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','generate','.mp3','from','audioContent','writeFile','resolve','googleTTS','utf8','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','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','model=%s'];(function(_0x38a2c6,_0x2320a6){var _0x1f201f=function(_0x7ac2c4){while(--_0x7ac2c4){_0x38a2c6['push'](_0x38a2c6['shift']());}};_0x1f201f(++_0x2320a6);}(_0x4680,0x115));var _0x0468=function(_0x49ffcb,_0x1aa6ba){_0x49ffcb=_0x49ffcb-0x0;var _0x2c0a1b=_0x4680[_0x49ffcb];return _0x2c0a1b;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x0468('0x0'));var fs=require('fs');var http=require(_0x0468('0x1'));var https=require(_0x0468('0x2'));var md5=require(_0x0468('0x3'));var path=require(_0x0468('0x4'));var querystring=require(_0x0468('0x5'));var rp=require(_0x0468('0x6'));var rs=require('randomstring');var sox=require(_0x0468('0x7'));var tts=require(_0x0468('0x8'));var urlParse=require(_0x0468('0x9'))['parse'];var util=require(_0x0468('0xa'));var aws=require(_0x0468('0xb'));var google=require(_0x0468('0xc'));var sestek=require(_0x0468('0xd'));var tilde=require(_0x0468('0xe'));var logger=require('../../../config/logger')(_0x0468('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x15700b,_0x2d5cb6){return new BPromise(function(_0x571522,_0x34a8e7){var _0x22ab9f=urlParse(_0x15700b);var _0x280fa6=_0x22ab9f['protocol']===_0x0468('0x10')?https:http;var _0x139e41={'host':_0x22ab9f[_0x0468('0x11')],'path':_0x22ab9f['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x280fa6[_0x0468('0x12')](_0x139e41,function(_0x3ab8f7){if(_0x3ab8f7[_0x0468('0x13')]!==0xc8){logger[_0x0468('0x14')](_0x0468('0x15')+_0x15700b+'\x20failed,\x20status\x20code\x20=\x20'+_0x3ab8f7[_0x0468('0x13')]+'\x20('+_0x3ab8f7[_0x0468('0x16')]+')');_0x34a8e7(new Error(_0x0468('0x15')+_0x15700b+_0x0468('0x17')+_0x3ab8f7[_0x0468('0x13')]+'\x20('+_0x3ab8f7[_0x0468('0x16')]+')'));return;}var _0x24ff8c=fs[_0x0468('0x18')](_0x2d5cb6);_0x24ff8c['on']('finish',function(){logger['info'](_0x0468('0x19'));_0x24ff8c[_0x0468('0x1a')](_0x571522);});_0x24ff8c['on'](_0x0468('0x14'),function(_0x1fee5f){fs[_0x0468('0x1b')](_0x2d5cb6);logger[_0x0468('0x14')]('download\x20error',_0x1fee5f);_0x34a8e7(_0x1fee5f);});_0x3ab8f7['pipe'](_0x24ff8c);})['on'](_0x0468('0x14'),function(_0x1a93c6){logger[_0x0468('0x14')](_0x1a93c6);_0x34a8e7(_0x1a93c6);})[_0x0468('0x1c')]();});}function uploadFile(_0x4533f4){return new BPromise(function(_0x22c008,_0x21812c){var _0x46e6a7=urlParse(_0x4533f4);var _0x598901=_0x46e6a7[_0x0468('0x1d')]==='https:'?https:http;var _0x2aa45d={'host':_0x46e6a7['host'],'path':_0x46e6a7['path'],'headers':{'user-agent':_0x0468('0x1e')}};_0x598901['get'](_0x2aa45d,function(_0xd0713c){if(_0xd0713c[_0x0468('0x13')]!==0xc8){_0x21812c(new Error('request\x20to\x20'+_0x4533f4+_0x0468('0x17')+_0xd0713c['statusCode']+'\x20('+_0xd0713c[_0x0468('0x16')]+')'));return;}var _0x28d692='';_0xd0713c['on'](_0x0468('0x1f'),function(_0x2edf80){_0x28d692+=_0x2edf80;});_0xd0713c['on'](_0x0468('0x1c'),function(){_0x22c008(_0x28d692);});})['on'](_0x0468('0x14'),function(_0x570fc4){_0x21812c(_0x570fc4);})[_0x0468('0x1c')]();});}function convertFile(_0x3d865f,_0x1c7906){return new BPromise(function(_0x2c43c7,_0x5bab0c){var _0x294463=sox[_0x0468('0x20')](_0x3d865f,_0x1c7906,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x294463['on'](_0x0468('0x14'),function(_0x4884fe){logger[_0x0468('0x14')](_0x0468('0x21'),_0x4884fe);_0x5bab0c(_0x4884fe);});_0x294463['on'](_0x0468('0x1c'),function(){logger[_0x0468('0x22')](_0x0468('0x23'));_0x2c43c7();});_0x294463[_0x0468('0x24')]();});}function base64Decode(_0x5d6c82,_0x31259e){var _0x341bd3=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x0468('0x25'));fs[_0x0468('0x26')](_0x341bd3,_0x5d6c82,_0x0468('0x27'));return convertFile(_0x341bd3,_0x31259e)[_0x0468('0x28')](function(){try{fs[_0x0468('0x1b')](_0x341bd3);fs[_0x0468('0x29')](_0x31259e,_0x0468('0x2a'));}catch(_0x51c3b5){logger['error'](_0x51c3b5);}return _0x31259e[_0x0468('0x2b')]('.')[0x0];});}function base64Encode(_0x523a73){var _0x1923b6=fs['readFileSync'](_0x523a73);return new Buffer(_0x1923b6)[_0x0468('0x2c')](_0x0468('0x27'));}exports[_0x0468('0x2d')]=function(_0x571a3a,_0x1fecfc,_0x33c89d,_0x5b4488,_0x56fec1,_0x5c43d3){var _0x7ae2fb,_0x3282c9;var _0x35d981=_0x0468('0x2e');var _0x4ca5ac=_0x0468('0x2f')+_0x571a3a;var _0x5878dd={};if(_0x1fecfc===_0x0468('0x30')){_0x5878dd[_0x0468('0x31')]={'ssml':_0x33c89d};}else{_0x5878dd[_0x0468('0x31')]={'text':_0x33c89d};};_0x5878dd[_0x0468('0x32')]={'languageCode':_0x5b4488,'ssmlGender':_0x56fec1};_0x5878dd[_0x0468('0x33')]={'audioEncoding':_0x0468('0x34'),'sampleRateHertz':0x1f40};var _0x14dc03={'url':_0x35d981+_0x0468('0x35')+_0x4ca5ac,'method':_0x0468('0x36'),'json':!![],'body':_0x5878dd};return rp(_0x14dc03)[_0x0468('0x28')](function(_0x36238d){return new BPromise(function(_0x143e7b,_0x52d2e5){_0x7ae2fb=path['resolve'](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+_0x0468('0x39'));var _0x279fdd=Buffer[_0x0468('0x3a')](_0x36238d[_0x0468('0x3b')],'base64');return fs[_0x0468('0x3c')](_0x7ae2fb,_0x279fdd,function(_0x140d16){_0x52d2e5(_0x140d16);},function(_0x2551af){fs['chmodSync'](_0x7ae2fb,_0x0468('0x2a'));_0x143e7b(_0x2551af);});});})['then'](function(_0x1aa73f){_0x3282c9=path[_0x0468('0x3d')](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+_0x0468('0x25'));return convertFile(_0x7ae2fb,_0x3282c9);})['then'](function(){try{fs[_0x0468('0x1b')](_0x7ae2fb);fs['chmodSync'](_0x3282c9,_0x0468('0x2a'));}catch(_0x24f61b){logger[_0x0468('0x14')](_0x24f61b);}logger[_0x0468('0x22')]('googleCloudTTS\x20path',_0x3282c9[_0x0468('0x2b')]('.')[0x0]);return _0x3282c9[_0x0468('0x2b')]('.')[0x0];});};exports[_0x0468('0x3e')]=function(_0x554894,_0x2d1c89){var _0x477920='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x3f7276,_0x25f537;var _0x5594ff;var _0xcb3626={'encoding':_0x0468('0x3f'),'method':_0x0468('0x36'),'timeout':0x2710,'url':_0x477920,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x0468('0x40')+encodeURIComponent(JSON[_0x0468('0x41')]([[['jQ1olc',JSON[_0x0468('0x41')]([_0x554894,_0x2d1c89||'en',![],_0x0468('0x42')]),null,_0x0468('0x43')]]]))};return rp(_0xcb3626)[_0x0468('0x28')](function(_0xcd09c3){try{_0x5594ff=eval(_0xcd09c3['slice'](0x5))[0x0][0x2];}catch(_0x502e15){throw new Error(_0x0468('0x44')+_0xcd09c3[_0x0468('0x1f')]);}if(!_0x5594ff){if(_0x554894[_0x0468('0x45')]>0xc8){throw new Error(_0x0468('0x46'));}else{throw new Error(_0x0468('0x47')+_0x2d1c89+_0x0468('0x48'));}}try{_0x5594ff=eval(_0x5594ff)[0x0];}catch(_0x1c26dd){throw new Error(_0x0468('0x44')+res[_0x0468('0x1f')]);}const _0x3d93fd=_0x5594ff;_0x3f7276=path[_0x0468('0x3d')](__dirname,'tmp',rs[_0x0468('0x38')](0x4)+_0x0468('0x39'));fs[_0x0468('0x26')](_0x3f7276,_0x5594ff,{'encoding':_0x0468('0x27')});_0x25f537=path[_0x0468('0x3d')](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+'.wav');return convertFile(_0x3f7276,_0x25f537);})[_0x0468('0x28')](function(){try{fs['unlink'](_0x3f7276);fs[_0x0468('0x29')](_0x25f537,_0x0468('0x2a'));}catch(_0x2a0fc7){logger[_0x0468('0x14')](_0x2a0fc7);}logger[_0x0468('0x22')]('goggleTTS\x20path',_0x25f537[_0x0468('0x2b')]('.')[0x0]);return _0x25f537[_0x0468('0x2b')]('.')[0x0];});};exports[_0x0468('0x49')]=function(_0x384e63,_0xb6fe76,_0x570168){return google['asr'](_0x384e63,_0xb6fe76,_0x570168)[_0x0468('0x28')](function(_0x503b59){logger['info'](_0x503b59[_0x0468('0x4a')]);return rp(_0x503b59);})[_0x0468('0x28')](function(_0x3d9688){var _0x2e23b6='';var _0x3c5ea9=0x0;try{fs[_0x0468('0x1b')](_0x384e63);}catch(_0x5a0cf0){logger['error'](_0x5a0cf0);}if(_0x3d9688&&_0x3d9688[_0x0468('0x4b')]){_0x2e23b6=_0x3d9688[_0x0468('0x4b')][_0x0468('0x4c')](function(_0x2d2e09){return _0x2d2e09&&_0x2d2e09[_0x0468('0x4d')][0x0]&&_0x2d2e09['alternatives'][0x0]['transcript']?_0x2d2e09[_0x0468('0x4d')][0x0][_0x0468('0x4e')]:'';})['join']('\x0a');_0x3c5ea9=_0x3d9688[_0x0468('0x4b')]['map'](function(_0x2a366a){return _0x2a366a&&_0x2a366a[_0x0468('0x4d')][0x0]&&_0x2a366a[_0x0468('0x4d')][0x0][_0x0468('0x4f')]?_0x2a366a[_0x0468('0x4d')][0x0][_0x0468('0x4f')]:0x0;})[_0x0468('0x50')]('\x0a');}logger[_0x0468('0x22')](_0x0468('0x51'),_0x2e23b6);logger[_0x0468('0x22')](_0x0468('0x52'),_0x3c5ea9);return{'transcript':_0x2e23b6,'confidence':_0x3c5ea9};})[_0x0468('0x53')](function(_0x166a2d){logger['error'](_0x0468('0x54'),_0x166a2d[_0x0468('0x13')],_0x166a2d[_0x0468('0x55')],_0x166a2d[_0x0468('0x56')]);});};exports['googleDialogflow']=function(_0xb73748,_0x408144,_0x1957e9,_0x424d4f){var _0x48715b=apiai(_0x408144,{'language':_0x424d4f||'en'});return _0x48715b['textRequest'](_0x1957e9,{'sessionId':md5(_0xb73748)})[_0x0468('0x28')](function(_0x4308c2){logger[_0x0468('0x22')](JSON['stringify'](_0x4308c2));return{'source':_0x4308c2[_0x0468('0x57')][_0x0468('0x58')],'resolvedQuery':_0x4308c2[_0x0468('0x57')][_0x0468('0x59')],'action':_0x4308c2[_0x0468('0x57')][_0x0468('0x5a')],'actionIncomplete':_0x4308c2['result'][_0x0468('0x5b')],'speech':_0x4308c2[_0x0468('0x57')][_0x0468('0x5c')][_0x0468('0x5d')],'score':_0x4308c2[_0x0468('0x57')]['score'],'statusCode':_0x4308c2[_0x0468('0x5e')][_0x0468('0x5f')],'endConversation':_0x4308c2['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x4308c2[_0x0468('0x57')][_0x0468('0x60')][_0x0468('0x61')]};});};exports[_0x0468('0x62')]=function(_0x5489b5,_0xa08ec,_0x5d2c23,_0x52987a,_0xfc6da,_0x4fd998){var _0x39b34c=_0x52987a[_0x0468('0x63')](/\\n/g,'\x0a');var _0x52920a={'credentials':{'private_key':_0x39b34c,'client_email':_0x5d2c23}};var _0x559fd7=new dialogflow[(_0x0468('0x64'))](_0x52920a);var _0x2f6fb4=_0x559fd7[_0x0468('0x65')](_0xa08ec,md5(_0x5489b5));var _0x3a8d3f={'session':_0x2f6fb4,'queryInput':{'text':{'text':_0xfc6da,'languageCode':_0x4fd998}}};return _0x559fd7[_0x0468('0x66')](_0x3a8d3f)[_0x0468('0x28')](function(_0x2e6b04){if(_0x2e6b04&&_0x2e6b04[_0x0468('0x45')]){logger[_0x0468('0x22')](_0x0468('0x67'),JSON['stringify'](_0x2e6b04));var _0x5ae8f2=_0x2e6b04[0x0];if(_0x5ae8f2){var _0x599945={'action':_0x5ae8f2[_0x0468('0x68')][_0x0468('0x5a')],'allRequiredParamsPresent':_0x5ae8f2[_0x0468('0x68')]['allRequiredParamsPresent'],'endConversation':_0x5ae8f2['queryResult']['diagnosticInfo']&&_0x5ae8f2['queryResult'][_0x0468('0x69')][_0x0468('0x6a')]?_0x5ae8f2[_0x0468('0x68')][_0x0468('0x69')]['fields'][_0x0468('0x6b')]['boolValue']:![],'fulfillmentText':_0x5ae8f2[_0x0468('0x68')][_0x0468('0x6c')],'intentName':_0x5ae8f2['queryResult'][_0x0468('0x6d')][_0x0468('0x55')],'intentDisplayName':_0x5ae8f2[_0x0468('0x68')]['intent'][_0x0468('0x6e')],'isFallbackIntent':_0x5ae8f2['queryResult'][_0x0468('0x6d')]['isFallback'],'languageCode':_0x5ae8f2['queryResult'][_0x0468('0x6f')],'queryText':_0x5ae8f2[_0x0468('0x68')][_0x0468('0x70')],'responseId':_0x5ae8f2[_0x0468('0x71')],'score':_0x5ae8f2[_0x0468('0x68')][_0x0468('0x72')],'speech':_0x5ae8f2['queryResult'][_0x0468('0x6c')],'providerResponse':JSON[_0x0468('0x41')](_0x2e6b04)};return _0x599945;}}});};exports[_0x0468('0x73')]=function(_0x2c6667,_0xc530ba,_0x27867a,_0x118b09){return tilde[_0x0468('0x74')](_0x2c6667,_0xc530ba,_0x27867a,_0x118b09)[_0x0468('0x28')](function(_0x13ab1b){try{fs[_0x0468('0x1b')](_0x2c6667);}catch(_0x59cd7a){logger[_0x0468('0x14')](_0x59cd7a);}logger[_0x0468('0x22')](_0x0468('0x75'),_0x13ab1b['transcript']);logger[_0x0468('0x22')](_0x0468('0x76'),_0x13ab1b[_0x0468('0x4f')]);return _0x13ab1b;});};exports[_0x0468('0x77')]=function(_0x43085a,_0x5cb318,_0x5b3b45,_0x1f6b17,_0x1b96ab,_0x4581ab){var _0x3d502b=path[_0x0468('0x3d')](__dirname,'tmp',rs[_0x0468('0x38')](0x4)+_0x0468('0x39'));var _0xf12429;return aws[_0x0468('0x78')](_0x43085a,_0x5cb318,_0x5b3b45,_0x1f6b17,_0x1b96ab,_0x4581ab,_0x3d502b)['then'](function(){_0xf12429=path[_0x0468('0x3d')](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+'.wav');return convertFile(_0x3d502b,_0xf12429);})[_0x0468('0x28')](function(){try{fs['unlink'](_0x3d502b);fs[_0x0468('0x29')](_0xf12429,'777');}catch(_0xe09a81){logger[_0x0468('0x14')](_0xe09a81);}return _0xf12429[_0x0468('0x2b')]('.')[0x0];});};exports[_0x0468('0x79')]=function(_0x325c31,_0x4f1358,_0x5e0ad5,_0x5172a1,_0x4b7908,_0x50124e){return aws[_0x0468('0x7a')](_0x325c31,_0x4f1358,_0x5e0ad5,_0x5172a1,_0x4b7908,_0x50124e)['then'](function(_0x3933c8){logger[_0x0468('0x22')](JSON['stringify'](_0x3933c8));return _0x3933c8;});};exports[_0x0468('0x7b')]=function(_0x4d948b,_0x399178,_0x190730,_0x2171fa){var _0x4c4d92=util['format'](_0x0468('0x7c'),ISPEECH_API,_0x4d948b,encodeURIComponent(_0x399178),_0x190730,_0x2171fa);var _0x23e452=path[_0x0468('0x3d')](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+'.mp3');var _0x5764bd;return downloadFile(_0x4c4d92,_0x23e452)['then'](function(){_0x5764bd=path[_0x0468('0x3d')](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+'.wav');return convertFile(_0x23e452,_0x5764bd);})['then'](function(){try{fs[_0x0468('0x1b')](_0x23e452);fs[_0x0468('0x29')](_0x5764bd,_0x0468('0x2a'));}catch(_0x30c57c){logger['error'](_0x30c57c);}return _0x5764bd['split']('.')[0x0];});};exports[_0x0468('0x7d')]=function(_0x25ec8f,_0x372274,_0x111fc3,_0x262931){var _0x42d92c=util['format'](_0x0468('0x7e'),ISPEECH_API,_0x372274,_0x111fc3,base64Encode(_0x25ec8f),_0x262931?util['format'](_0x0468('0x7f'),encodeURIComponent(_0x262931)):'freeform=3');return uploadFile(_0x42d92c)['then'](function(_0x41e9d7){return querystring[_0x0468('0x80')](_0x41e9d7);});};exports['sestekNDA']=function(_0x284873,_0x20f204){return sestek[_0x0468('0x81')](_0x284873,_0x20f204)['then'](function(_0x153973){logger[_0x0468('0x22')](JSON[_0x0468('0x41')](_0x153973));var _0x2db4e7={'speech':_0x153973[_0x0468('0x82')],'action':_0x153973[_0x0468('0x83')]?_0x153973['channelData']['CustomAction']:undefined,'actiondata':_0x153973[_0x0468('0x83')]?_0x153973[_0x0468('0x83')][_0x0468('0x84')]:undefined};if(_0x153973[_0x0468('0x83')]&&_0x153973[_0x0468('0x83')]['AudioFromTts']){return base64Decode(_0x153973['channelData']['AudioFromTts'][_0x0468('0x85')],path['resolve'](__dirname,_0x0468('0x37'),rs[_0x0468('0x38')](0x4)+_0x0468('0x25')))[_0x0468('0x28')](function(_0x5da172){_0x2db4e7[_0x0468('0x86')]=_0x5da172;return _0x2db4e7;});}return _0x2db4e7;});};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 c4dd95c..c45edc2 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 _0x053f=['./nda','exports'];(function(_0x28e9fc,_0x3f9420){var _0x5889d4=function(_0x4ada67){while(--_0x4ada67){_0x28e9fc['push'](_0x28e9fc['shift']());}};_0x5889d4(++_0x3f9420);}(_0x053f,0x1c4));var _0xf053=function(_0x8c414a,_0x23dbc3){_0x8c414a=_0x8c414a-0x0;var _0x16f5e3=_0x053f[_0x8c414a];return _0x16f5e3;};var nda=require(_0xf053('0x0'));module[_0xf053('0x1')]={'nda':nda}; \ No newline at end of file +var _0x6533=['exports','./nda'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x6533,0x15f));var _0x3653=function(_0x3510fe,_0x1c71e7){_0x3510fe=_0x3510fe-0x0;var _0x39f5d2=_0x6533[_0x3510fe];return _0x39f5d2;};var nda=require(_0x3653('0x0'));module[_0x3653('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 4f90d80..29731c2 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 _0x0cee=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0cee,0x12f));var _0xe0ce=function(_0x23135e,_0x11396e){_0x23135e=_0x23135e-0x0;var _0x55f769=_0x0cee[_0x23135e];return _0x55f769;};'use strict';var rp=require(_0xe0ce('0x0'));var url=require(_0xe0ce('0x1'));var logger=require(_0xe0ce('0x2'))(_0xe0ce('0x3'));module[_0xe0ce('0x4')]=function(_0x25ec67,_0x54f977){var _0x563553={'method':_0xe0ce('0x5'),'uri':url[_0xe0ce('0x6')](_0x54f977[_0xe0ce('0x7')],_0xe0ce('0x8')),'form':{'grant_type':_0xe0ce('0x9'),'username':_0x54f977[_0xe0ce('0xa')],'password':_0x54f977[_0xe0ce('0x9')]},'json':!![]};return rp(_0x563553)[_0xe0ce('0xb')](function(_0x494eca){var _0x27eea3={'method':_0xe0ce('0x5'),'uri':url['resolve'](_0x54f977[_0xe0ce('0xc')],_0xe0ce('0xd')),'body':{'type':_0x54f977[_0xe0ce('0xe')]||_0xe0ce('0xf'),'channelId':'Nda','conversation':{'id':_0x25ec67['uniqueid']},'from':{'id':_0x25ec67['callerid'],'name':_0x25ec67[_0xe0ce('0x10')]},'recipient':{'id':_0x25ec67[_0xe0ce('0x11')],'name':_0x25ec67[_0xe0ce('0x12')]},'text':_0x54f977[_0xe0ce('0x13')],'channelData':{}},'headers':{'Authorization':_0xe0ce('0x14')+_0x494eca[_0xe0ce('0x15')]},'json':!![]};if(_0x54f977[_0xe0ce('0x16')]){_0x27eea3[_0xe0ce('0x17')][_0xe0ce('0x18')][_0xe0ce('0x19')]=_0x54f977[_0xe0ce('0x16')];}if(_0x54f977[_0xe0ce('0x1a')]=='1'){_0x27eea3['body']['channelData'][_0xe0ce('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe0ce('0x1c')};}if(_0x54f977['custom_action']){_0x27eea3['body'][_0xe0ce('0x18')][_0xe0ce('0x1d')]=_0x54f977[_0xe0ce('0x1e')];if(_0x54f977[_0xe0ce('0x1f')]){_0x27eea3[_0xe0ce('0x17')]['channelData'][_0xe0ce('0x20')]=_0x54f977['custom_action_data'];}}logger[_0xe0ce('0x21')](JSON[_0xe0ce('0x22')](_0x27eea3));return rp(_0x27eea3);});}; \ No newline at end of file +var _0xcc73=['ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','ndauth_url','/token','password','username','POST','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','text','access_token','project','body','channelData','ProjectName'];(function(_0x3fbf6d,_0x364727){var _0x3fd3b1=function(_0x435186){while(--_0x435186){_0x3fbf6d['push'](_0x3fbf6d['shift']());}};_0x3fd3b1(++_0x364727);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xcc73[_0x2f5ac5];return _0x37c9a8;};'use strict';var rp=require('request-promise');var url=require(_0x3cc7('0x0'));var logger=require(_0x3cc7('0x1'))('agi');module['exports']=function(_0x11b326,_0x571514){var _0x445dce={'method':'POST','uri':url['resolve'](_0x571514[_0x3cc7('0x2')],_0x3cc7('0x3')),'form':{'grant_type':_0x3cc7('0x4'),'username':_0x571514[_0x3cc7('0x5')],'password':_0x571514[_0x3cc7('0x4')]},'json':!![]};return rp(_0x445dce)['then'](function(_0x416c48){var _0x37c184={'method':_0x3cc7('0x6'),'uri':url[_0x3cc7('0x7')](_0x571514['ndassistant_url'],_0x3cc7('0x8')),'body':{'type':_0x571514[_0x3cc7('0x9')]||_0x3cc7('0xa'),'channelId':_0x3cc7('0xb'),'conversation':{'id':_0x11b326[_0x3cc7('0xc')]},'from':{'id':_0x11b326[_0x3cc7('0xd')],'name':_0x11b326[_0x3cc7('0xe')]},'recipient':{'id':_0x11b326['dnid'],'name':_0x11b326['extension']},'text':_0x571514[_0x3cc7('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x416c48[_0x3cc7('0x10')]},'json':!![]};if(_0x571514[_0x3cc7('0x11')]){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x14')]=_0x571514[_0x3cc7('0x11')];}if(_0x571514[_0x3cc7('0x15')]=='1'){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3cc7('0x17')};}if(_0x571514[_0x3cc7('0x18')]){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x19')]=_0x571514[_0x3cc7('0x18')];if(_0x571514[_0x3cc7('0x1a')]){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x1b')]=_0x571514[_0x3cc7('0x1a')];}}logger[_0x3cc7('0x1c')](JSON[_0x3cc7('0x1d')](_0x37c184));return rp(_0x37c184);});}; \ 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 2a86331..70cdfa7 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 _0xbed8=['./lib/api'];(function(_0x2a65f9,_0x546910){var _0x28ab50=function(_0x1b68f4){while(--_0x1b68f4){_0x2a65f9['push'](_0x2a65f9['shift']());}};_0x28ab50(++_0x546910);}(_0xbed8,0xeb));var _0x8bed=function(_0x315861,_0x735b4){_0x315861=_0x315861-0x0;var _0x3e2b76=_0xbed8[_0x315861];return _0x3e2b76;};'use strict';var asr=require(_0x8bed('0x0'));module['exports']=function(_0x3c02d4,_0x14cadf,_0x42055b,_0x36a42c){return asr(_0x3c02d4,_0x14cadf,_0x42055b,_0x36a42c);}; \ No newline at end of file +var _0x6720=['exports','./lib/api'];(function(_0x47768e,_0xf55e32){var _0x55af83=function(_0x15357c){while(--_0x15357c){_0x47768e['push'](_0x47768e['shift']());}};_0x55af83(++_0xf55e32);}(_0x6720,0x13b));var _0x0672=function(_0x8dd437,_0x142c18){_0x8dd437=_0x8dd437-0x0;var _0x284949=_0x6720[_0x8dd437];return _0x284949;};'use strict';var asr=require(_0x0672('0x0'));module[_0x0672('0x1')]=function(_0x33991a,_0x45567a,_0x28ea09,_0x243fa2){return asr(_0x33991a,_0x45567a,_0x28ea09,_0x243fa2);}; \ 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 e639df9..754f310 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 _0x0a1a=['open','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x282320,_0x379ad6){var _0x271d54=function(_0x5bfe98){while(--_0x5bfe98){_0x282320['push'](_0x282320['shift']());}};_0x271d54(++_0x379ad6);}(_0x0a1a,0x112));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xa0a1('0x0'));var _=require(_0xa0a1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xa0a1('0x2'));var logger=require(_0xa0a1('0x3'))(_0xa0a1('0x4'));module[_0xa0a1('0x5')]=function(_0x17a759,_0x8bfcc6,_0x358fd7,_0x4425a6){return new BPromise(function(_0x2e77dc,_0x1213ea){logger[_0xa0a1('0x6')](_0xa0a1('0x7'),_0x4425a6||_0xa0a1('0x8'));var _0x5effe1=new WebSocket(_0x4425a6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x161ecb='';var _0x45eb7c='0';var _0x470ea0='1';var _0x287be3=_0xa0a1('0x9');function _0x28a231(_0x25c7fe){var _0x33031f=crypto[_0xa0a1('0xa')](_0xa0a1('0xb'));_0x33031f[_0xa0a1('0xc')](_0x25c7fe);return _0x33031f[_0xa0a1('0xd')](_0xa0a1('0xe'));}function _0x239b99(){try{logger[_0xa0a1('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x3d4a5a=moment()[_0xa0a1('0xf')]();var _0x461040=_0x28a231(_0x3d4a5a+_0x8bfcc6+_0x358fd7);_0x5effe1[_0xa0a1('0x10')](JSON[_0xa0a1('0x11')]({'appID':_0x8bfcc6,'timestamp':_0x3d4a5a,'appKey':_0x461040}));var _0x235c65=fs['createReadStream'](_0x17a759);_0x235c65['on'](_0xa0a1('0x12'),function(_0x4c5959){_0x5effe1[_0xa0a1('0x10')](_0x4c5959);});_0x235c65['on'](_0xa0a1('0x13'),function(){_0x5effe1[_0xa0a1('0x10')]('EOS');});}catch(_0x29069c){logger[_0xa0a1('0x14')](_0xa0a1('0x15'),JSON['stringify'](_0x29069c));_0x5effe1['terminate']();}}function _0x4bc8d6(_0x57f9ae){try{if(_0x57f9ae){var _0x4fc8f1=JSON[_0xa0a1('0x16')](_0x57f9ae);switch(_0x4fc8f1[_0xa0a1('0x17')]){case 0x0:if(_0x4fc8f1[_0xa0a1('0x18')]){if(_0x4fc8f1[_0xa0a1('0x18')][_0xa0a1('0x19')]){logger[_0xa0a1('0x6')](_0xa0a1('0x1a'),JSON[_0xa0a1('0x11')](_0x4fc8f1[_0xa0a1('0x18')][_0xa0a1('0x1b')]));_0x161ecb=_0x4fc8f1[_0xa0a1('0x18')][_0xa0a1('0x1b')][0x0][_0xa0a1('0x1c')];_0x45eb7c=_0x4fc8f1[_0xa0a1('0x18')][_0xa0a1('0x1b')][0x0][_0xa0a1('0x1d')];_0x470ea0='0';_0x287be3=_0xa0a1('0x1e');_0x5effe1[_0xa0a1('0x1f')]();}}break;case 0x1:logger[_0xa0a1('0x6')](_0xa0a1('0x9'));_0x470ea0='1';_0x287be3=_0xa0a1('0x9');break;case 0x2:logger[_0xa0a1('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x470ea0='2';_0x287be3='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xa0a1('0x20'));_0x470ea0='9';_0x287be3='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xa0a1('0x6')](_0xa0a1('0x21'));_0x470ea0='10';_0x287be3=_0xa0a1('0x21');break;case 0xb:logger['info'](_0xa0a1('0x22'));_0x470ea0='11';_0x287be3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x31aacf){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xa0a1('0x11')](_0x31aacf));_0x5effe1[_0xa0a1('0x1f')]();}}function _0x2c3566(){logger[_0xa0a1('0x6')](_0xa0a1('0x23'));_0x2e77dc({'transcript':_0x161ecb,'confidence':_0x45eb7c,'status':_0x470ea0,'status_message':_0x287be3});}function _0xd5c10f(_0x1e7078){logger[_0xa0a1('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xa0a1('0x24')](_0x1e7078)){logger[_0xa0a1('0x14')](_[_0xa0a1('0x25')](_0x1e7078)?JSON['stringify'](_0x1e7078):_0x1e7078);}}_0x5effe1['on'](_0xa0a1('0x26'),_0x239b99);_0x5effe1['on']('message',_0x4bc8d6);_0x5effe1['on'](_0xa0a1('0x13'),_0x2c3566);_0x5effe1['on']('error',_0xd5c10f);});}; \ No newline at end of file +var _0x8ddb=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ddb,0xc0));var _0xb8dd=function(_0x5100bc,_0x35e471){_0x5100bc=_0x5100bc-0x0;var _0x1d6ec6=_0x8ddb[_0x5100bc];return _0x1d6ec6;};'use strict';var BPromise=require(_0xb8dd('0x0'));var _=require(_0xb8dd('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb8dd('0x2'));var crypto=require(_0xb8dd('0x3'));var logger=require(_0xb8dd('0x4'))(_0xb8dd('0x5'));module['exports']=function(_0x335bc0,_0x5df8b7,_0x2413ef,_0x3020d5){return new BPromise(function(_0x4f2aaf,_0x180adf){logger[_0xb8dd('0x6')](_0xb8dd('0x7'),_0x3020d5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x499a52=new WebSocket(_0x3020d5||_0xb8dd('0x8'),{'perMessageDeflate':![]});var _0x4b46b6='';var _0x2404e3='0';var _0x131374='1';var _0x111e3f=_0xb8dd('0x9');function _0x61cf68(_0x1e819c){var _0x194ec1=crypto[_0xb8dd('0xa')](_0xb8dd('0xb'));_0x194ec1['update'](_0x1e819c);return _0x194ec1[_0xb8dd('0xc')](_0xb8dd('0xd'));}function _0x5a0b94(){try{logger['info'](_0xb8dd('0xe'));var _0x27b2bb=moment()[_0xb8dd('0xf')]();var _0x59fd97=_0x61cf68(_0x27b2bb+_0x5df8b7+_0x2413ef);_0x499a52[_0xb8dd('0x10')](JSON[_0xb8dd('0x11')]({'appID':_0x5df8b7,'timestamp':_0x27b2bb,'appKey':_0x59fd97}));var _0x4ecec4=fs['createReadStream'](_0x335bc0);_0x4ecec4['on'](_0xb8dd('0x12'),function(_0x45a109){_0x499a52[_0xb8dd('0x10')](_0x45a109);});_0x4ecec4['on']('close',function(){_0x499a52[_0xb8dd('0x10')](_0xb8dd('0x13'));});}catch(_0x2fb1b8){logger[_0xb8dd('0x14')](_0xb8dd('0x15'),JSON[_0xb8dd('0x11')](_0x2fb1b8));_0x499a52[_0xb8dd('0x16')]();}}function _0x52901f(_0x4152c0){try{if(_0x4152c0){var _0x48f52f=JSON[_0xb8dd('0x17')](_0x4152c0);switch(_0x48f52f[_0xb8dd('0x18')]){case 0x0:if(_0x48f52f['result']){if(_0x48f52f[_0xb8dd('0x19')][_0xb8dd('0x1a')]){logger[_0xb8dd('0x6')](_0xb8dd('0x1b'),JSON['stringify'](_0x48f52f[_0xb8dd('0x19')][_0xb8dd('0x1c')]));_0x4b46b6=_0x48f52f[_0xb8dd('0x19')][_0xb8dd('0x1c')][0x0][_0xb8dd('0x1d')];_0x2404e3=_0x48f52f[_0xb8dd('0x19')][_0xb8dd('0x1c')][0x0]['likelihood'];_0x131374='0';_0x111e3f='Success.';_0x499a52[_0xb8dd('0x16')]();}}break;case 0x1:logger[_0xb8dd('0x6')](_0xb8dd('0x9'));_0x131374='1';_0x111e3f=_0xb8dd('0x9');break;case 0x2:logger[_0xb8dd('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x131374='2';_0x111e3f=_0xb8dd('0x1e');break;case 0x9:logger[_0xb8dd('0x6')](_0xb8dd('0x1f'));_0x131374='9';_0x111e3f='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xb8dd('0x20'));_0x131374='10';_0x111e3f=_0xb8dd('0x20');break;case 0xb:logger[_0xb8dd('0x6')](_0xb8dd('0x21'));_0x131374='11';_0x111e3f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x225b78){logger[_0xb8dd('0x14')](_0xb8dd('0x22'),JSON['stringify'](_0x225b78));_0x499a52[_0xb8dd('0x16')]();}}function _0x3bf867(){logger[_0xb8dd('0x6')](_0xb8dd('0x23'));_0x4f2aaf({'transcript':_0x4b46b6,'confidence':_0x2404e3,'status':_0x131374,'status_message':_0x111e3f});}function _0x2500e9(_0x44d160){logger[_0xb8dd('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xb8dd('0x24')](_0x44d160)){logger[_0xb8dd('0x14')](_['isObject'](_0x44d160)?JSON[_0xb8dd('0x11')](_0x44d160):_0x44d160);}}_0x499a52['on']('open',_0x5a0b94);_0x499a52['on']('message',_0x52901f);_0x499a52['on']('close',_0x3bf867);_0x499a52['on'](_0xb8dd('0x14'),_0x2500e9);});}; \ 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 8945bcd..416e7e1 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 _0x6b7a=['exports'];(function(_0x18582a,_0xf7f8c){var _0x11c96a=function(_0xe059a8){while(--_0xe059a8){_0x18582a['push'](_0x18582a['shift']());}};_0x11c96a(++_0xf7f8c);}(_0x6b7a,0x127));var _0xa6b7=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x6b7a[_0xdc37a1];return _0x99b4fe;};var asr=require('./asr');module[_0xa6b7('0x0')]={'asr':asr}; \ No newline at end of file +var _0xb2df=['exports'];(function(_0x554afa,_0x901d46){var _0x5077ae=function(_0x80f81a){while(--_0x80f81a){_0x554afa['push'](_0x554afa['shift']());}};_0x5077ae(++_0x901d46);}(_0xb2df,0x75));var _0xfb2d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb2df[_0x3ab9ee];return _0x82ee88;};var asr=require('./asr');module[_0xfb2d('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 605004b..1387840 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7973e42..8082854 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 _0x5ec6=['condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','randomstring','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','rpc','prototype','getVariable','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','clear','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','isEmpty','%s.%s','length','saveRestApiResult','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','no\x20password\x20configured','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','toString','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block'];(function(_0x3d8995,_0x5f4f4b){var _0x5dd8ed=function(_0x55e159){while(--_0x55e159){_0x3d8995['push'](_0x3d8995['shift']());}};_0x5dd8ed(++_0x5f4f4b);}(_0x5ec6,0x7f));var _0x65ec=function(_0x47457d,_0x72eda2){_0x47457d=_0x47457d-0x0;var _0x49b115=_0x5ec6[_0x47457d];return _0x49b115;};'use strict';var fs=require('fs');var util=require(_0x65ec('0x0'));var _=require(_0x65ec('0x1'));var sh=require(_0x65ec('0x2'));var odbc=require('odbc')();var rs=require(_0x65ec('0x3'));var moment=require('moment');var Mustache=require(_0x65ec('0x4'));var rp=require('request-promise');var logger=require(_0x65ec('0x5'))('agi');var config=require(_0x65ec('0x6'));var shared=require('../../config/environment/shared');var scripts=require(_0x65ec('0x7'));var FILES_PATH=_0x65ec('0x8');var recursiveMapAttributes=['rawHeaders',_0x65ec('0x9')];var verticesWithRetry=[_0x65ec('0xa'),'getdigits',_0x65ec('0xb')];var AGIVertices=function(_0x255652,_0x300f83,_0x50e5c4){this['channel']=_0x255652;this[_0x65ec('0xc')]=_0x300f83;this['mailRpc']=_0x50e5c4;};AGIVertices[_0x65ec('0xd')][_0x65ec('0xe')]=function(_0x599b6a,_0x3416a6){this[_0x65ec('0xc')]['getVariableById'](_0x599b6a)[_0x65ec('0xf')](function(_0x45cfb0){_0x3416a6(null,_0x45cfb0?_0x45cfb0['name']:![]);})[_0x65ec('0x10')](function(_0x2af7d6){_0x3416a6(_0x2af7d6);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x11')]=function(_0x2c8314,_0x434e20){this[_0x65ec('0xc')][_0x65ec('0x12')](_0x2c8314)['then'](function(_0x28be8b){_0x434e20(null,_0x28be8b?_0x28be8b[_0x65ec('0x13')]:![]);})[_0x65ec('0x10')](function(_0x4bbe88){_0x434e20(_0x4bbe88);});};AGIVertices['prototype'][_0x65ec('0x14')]=function(_0x461bd3,_0xa597d4){this['rpc'][_0x65ec('0x15')](_0x461bd3)[_0x65ec('0xf')](function(_0x1254f8){_0xa597d4(null,_0x1254f8?_0x1254f8[_0x65ec('0x13')]:![]);})[_0x65ec('0x10')](function(_0xd81ed3){_0xa597d4(_0xd81ed3);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x16')]=function(_0x2127e2,_0x441ad0){this[_0x65ec('0xc')][_0x65ec('0x17')](_0x2127e2)[_0x65ec('0xf')](function(_0x1467ac){_0x441ad0(null,_0x1467ac?_0x1467ac[_0x65ec('0x18')]:![]);})[_0x65ec('0x10')](function(_0x15d4eb){_0x441ad0(_0x15d4eb);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x19')]=function(_0x4ff93c,_0x170703){this[_0x65ec('0xc')][_0x65ec('0x1a')](_0x4ff93c)[_0x65ec('0xf')](function(_0x1d60fb){_0x170703(null,_0x1d60fb?_0x1d60fb[_0x65ec('0x13')]:![]);})[_0x65ec('0x10')](function(_0x58239f){_0x170703(_0x58239f);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x1b')]=function(_0x13ac27,_0x353b3b){this[_0x65ec('0xc')][_0x65ec('0x1c')](_0x13ac27)[_0x65ec('0xf')](function(_0xf5adc7){_0x353b3b(null,_0xf5adc7?_0xf5adc7[_0x65ec('0x13')]:![]);})['catch'](function(_0x10baef){_0x353b3b(_0x10baef);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x1d')]=function(_0x23b1a3,_0x4de451){var _0x3f98c9=this;this['rpc'][_0x65ec('0x1e')](_0x23b1a3)[_0x65ec('0xf')](function(_0x1d0b5c){_0x4de451(null,_0x1d0b5c?_0x3f98c9[_0x65ec('0x1f')](_0x1d0b5c[_0x65ec('0x20')]):![]);})[_0x65ec('0x10')](function(_0x46bf66){_0x4de451(_0x46bf66);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x21')]=function(_0xeec5d4,_0x3c97e2){this['rpc']['getMailAccountById'](_0xeec5d4)[_0x65ec('0xf')](function(_0x5084af){_0x3c97e2(null,_0x5084af?_0x5084af:![]);})[_0x65ec('0x10')](function(_0x443b0f){_0x3c97e2(_0x443b0f);});};AGIVertices['prototype'][_0x65ec('0x22')]=function(_0x42fa88,_0x3a75e7,_0x3c8dd7){this['mailRpc'][_0x65ec('0x22')](_0x42fa88,_0x3a75e7)[_0x65ec('0xf')](function(){_0x3c8dd7(null);})[_0x65ec('0x10')](function(_0x44dda7){_0x3c8dd7(_0x44dda7);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x23')]=function(_0x38dea3,_0x43bb5f){this[_0x65ec('0xc')][_0x65ec('0x24')](_0x38dea3)['then'](function(_0x6a5861){if(_0x6a5861){if(_0x6a5861[_0x65ec('0x25')]){_0x43bb5f(null,[_0x6a5861['interval']]);}else{_0x43bb5f(null,_[_0x65ec('0x26')](_0x6a5861[_0x65ec('0x27')],_0x65ec('0x28')));}}else{_0x43bb5f(null,![]);}})[_0x65ec('0x10')](function(_0x134cce){_0x43bb5f(_0x134cce);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x1f')]=function(_0x5afcfc){return util[_0x65ec('0x29')](_0x65ec('0x2a'),FILES_PATH,_0x5afcfc);};AGIVertices[_0x65ec('0xd')][_0x65ec('0x2b')]=function(_0x5028e3,_0x5d8458,_0xaa4b9d){odbc[_0x65ec('0x2c')](_0x5028e3,function(_0x940f13){if(_0x940f13){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x940f13);_0xaa4b9d(_0x940f13);}else{logger[_0x65ec('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x65ec('0x2e')](_0x5d8458,function(_0x167564,_0x552f5e){if(_0x167564){logger[_0x65ec('0x2d')](_0x65ec('0x2f'),_0x5d8458);_0xaa4b9d(_0x167564);}else{logger[_0x65ec('0x2d')](_0x65ec('0x30'),_0x5d8458);odbc[_0x65ec('0x31')](function(_0x3b72cf){if(_0x3b72cf){logger[_0x65ec('0x32')](_0x65ec('0x33'),_0x3b72cf);}_0xaa4b9d(null,_0x552f5e);});}});}});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x34')]=function(_0x3561ef,_0x5cdb0f){this[_0x65ec('0xc')]['getSmsAccountById'](_0x3561ef)[_0x65ec('0xf')](function(_0x278d43){_0x5cdb0f(null,_0x278d43?_0x278d43:![]);})[_0x65ec('0x10')](function(_0x1bfc44){_0x5cdb0f(_0x1bfc44);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x35')]=function(_0x49ae2d,_0x309e4a){this['rpc']['createSmsMessage'](_0x49ae2d)[_0x65ec('0xf')](function(_0x339d1d){_0x309e4a(null,_0x339d1d);})[_0x65ec('0x10')](function(_0x143a11){_0x309e4a(_0x143a11);});};AGIVertices[_0x65ec('0xd')]['createSquareDetailsReport']=function(_0x4843ca,_0x1aef6d,_0x2e952e){this[_0x65ec('0xc')][_0x65ec('0x36')]({'uniqueid':this[_0x65ec('0x37')]['uniqueid'],'node':_0x4843ca['label'],'application':_0x4843ca[_0x65ec('0x38')],'data':_0x1aef6d||null,'project_name':this[_0x65ec('0x37')][_0x65ec('0x39')],'callerid':this[_0x65ec('0x37')][_0x65ec('0x3a')]})[_0x65ec('0xf')](function(_0x1230b3){if(_0x2e952e){_0x2e952e(null,_0x1230b3);}})['catch'](function(_0x2b38ee){if(_0x2e952e){_0x2e952e(_0x2b38ee);}});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x3b')]=function(_0x4fcfd4,_0x547e8b,_0x321829,_0x549c82){this[_0x65ec('0xc')][_0x65ec('0x3b')]({'uniqueid':this[_0x65ec('0x37')][_0x65ec('0x3c')],'callerid':this[_0x65ec('0x37')]['callerid'],'calleridname':this[_0x65ec('0x37')][_0x65ec('0x3d')],'context':this[_0x65ec('0x37')][_0x65ec('0x3e')],'extension':this['channel'][_0x65ec('0x3f')],'priority':this['channel'][_0x65ec('0x40')],'accountcode':this[_0x65ec('0x37')][_0x65ec('0x41')],'dnid':this['channel']['dnid'],'projectName':this[_0x65ec('0x37')][_0x65ec('0x39')],'saveName':_0x547e8b,'filename':_0x4fcfd4[_0x65ec('0x42')]||_0x547e8b,'savePath':_0x321829})[_0x65ec('0xf')](function(_0x1b3732){_0x549c82(null,_0x1b3732);})[_0x65ec('0x10')](function(_0x1c546c){_0x549c82(_0x1c546c);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x43')]=function(_0x646e97,_0x66ec67,_0x4058e4,_0x2150bc,_0x308209){this[_0x65ec('0xc')][_0x65ec('0x43')]({'uniqueid':this[_0x65ec('0x37')]['uniqueid'],'body':_0x646e97,'direction':_0x66ec67,'providerName':_0x4058e4,'providerResponse':_0x2150bc})[_0x65ec('0xf')](function(_0x2814f3){if(_0x308209){_0x308209(null,_0x2814f3);}})['catch'](function(_0x3a474c){if(_0x308209){_0x308209(_0x3a474c);}});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x44')]=function(_0x528cfa,_0x3eee1e){this[_0x65ec('0xc')][_0x65ec('0x44')]({'firstName':_['isEmpty'](_0x528cfa[_0x65ec('0x13')])||_['isNil'](_0x528cfa['name'])?_0x65ec('0x45')+Math[_0x65ec('0x46')]():_0x528cfa[_0x65ec('0x13')],'lastName':_['isEmpty'](_0x528cfa[_0x65ec('0x47')])||_[_0x65ec('0x48')](_0x528cfa[_0x65ec('0x47')])?null:_0x528cfa[_0x65ec('0x47')],'phone':_0x528cfa[_0x65ec('0x49')],'ListId':_0x528cfa[_0x65ec('0x4a')],'scheduledat':_0x528cfa[_0x65ec('0x4b')],'callbackUniqueid':this[_0x65ec('0x37')][_0x65ec('0x3c')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x528cfa[_0x65ec('0x4b')]['toString'](),'priority':_0x528cfa[_0x65ec('0x4c')]})['then'](function(_0x347336){_0x3eee1e(null,_0x347336);})[_0x65ec('0x10')](function(_0x258f96){_0x3eee1e(_0x258f96);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x4d')]=function(_0x40d6b5,_0x355c4c){this['rpc'][_0x65ec('0x4e')](_0x40d6b5)[_0x65ec('0xf')](function(_0x1b5356){_0x355c4c(null,_0x1b5356?_0x1b5356[_0x65ec('0x13')]:![]);})[_0x65ec('0x10')](function(_0x58975d){_0x355c4c(_0x58975d);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x4f')]=function(_0xb85e9a,_0x411d72,_0x44fbba){var _0x3f2fd3={'role':_0x65ec('0x50')};_0x3f2fd3[_0xb85e9a]=this[_0x65ec('0x37')]['callerid'];this[_0x65ec('0xc')][_0x65ec('0x4f')](_0x3f2fd3,_0x411d72,this[_0x65ec('0x37')][_0x65ec('0x3c')])[_0x65ec('0xf')](function(_0xebe9f4){_0x44fbba(null,_[_0x65ec('0x48')](_0xebe9f4)?![]:!![]);})['catch'](function(_0x50d006){logger[_0x65ec('0x32')](_0x50d006);_0x44fbba(null,![]);});};AGIVertices['prototype'][_0x65ec('0x51')]=function(_0x379634,_0x47ef4a){var _0x1baa17={'role':_0x65ec('0x50')};_0x1baa17[_0x379634]=this[_0x65ec('0x37')][_0x65ec('0x3a')];this[_0x65ec('0xc')][_0x65ec('0x51')](_0x1baa17)[_0x65ec('0xf')](function(_0x5df65c){_0x47ef4a(null,_['isNil'](_0x5df65c)?![]:!![]);})[_0x65ec('0x10')](function(_0x2199aa){logger[_0x65ec('0x32')](_0x2199aa);_0x47ef4a(null,![]);});};AGIVertices['prototype'][_0x65ec('0x52')]=function(_0x3783c8,_0x17059d){var _0x3d761f={'role':_0x65ec('0x50')};_0x3d761f[_0x3783c8]=this[_0x65ec('0x37')][_0x65ec('0x3a')];this['rpc'][_0x65ec('0x52')](_0x3d761f)[_0x65ec('0xf')](function(_0x136cfb){_0x17059d(null,_[_0x65ec('0x48')](_0x136cfb)?![]:!![]);})[_0x65ec('0x10')](function(_0x128bdb){logger[_0x65ec('0x32')](_0x128bdb);_0x17059d(null,![]);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x53')]=function(_0x584811,_0x59a690){var _0x41d28d={'role':'agent'};_0x41d28d[_0x584811]=this['channel'][_0x65ec('0x3a')];var _0x423f8f=_0x584811!=_0x65ec('0x54')?util['format']('%s/%s@from-sip/n',_0x65ec('0x55'),this['channel']['callerid']):undefined;this['rpc'][_0x65ec('0x53')](_0x41d28d,_0x423f8f)['then'](function(_0x2e9d67){_0x59a690(null,_[_0x65ec('0x48')](_0x2e9d67)?![]:!![]);})[_0x65ec('0x10')](function(_0x541efb){logger['error'](_0x541efb);_0x59a690(null,![]);});};AGIVertices[_0x65ec('0xd')]['shellCommand']=function(_0x244d12,_0x1c2972){sh[_0x65ec('0x56')](_[_0x65ec('0x57')](_0x244d12),function(_0xc47b30,_0x2874ea){var _0xefa74d=_0x2874ea[_0x65ec('0x58')](/(\r\n|\n|\r)/gm,'');_0x1c2972(null,_0xefa74d);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x59')]=function(_0x595c1f,_0x610b3f){scripts['googleCloudTTS'](_0x595c1f[_0x65ec('0x5a')],_0x595c1f[_0x65ec('0x5b')]||_0x65ec('0x5c'),_0x595c1f[_0x65ec('0x5c')],_0x595c1f['languageCode']||_0x65ec('0x5d'),_0x595c1f['ssmlGender']||_0x65ec('0x5e'),_0x595c1f[_0x65ec('0x5f')]||_0x65ec('0x60'))[_0x65ec('0xf')](function(_0x4ede6e){_0x610b3f(null,_0x4ede6e);})['catch'](function(_0x5d42fa){_0x610b3f(_0x5d42fa);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x61')]=function(_0x476a54,_0x161061){scripts[_0x65ec('0x61')](_0x476a54[_0x65ec('0x5c')],_0x476a54[_0x65ec('0x62')]||'en',0x1)[_0x65ec('0xf')](function(_0x3a65a3){_0x161061(null,_0x3a65a3);})[_0x65ec('0x10')](function(_0x25e989){_0x161061(_0x25e989);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x63')]=function(_0x4ed722,_0x154241){var _0x1691c6={'uri':_0x4ed722[_0x65ec('0x64')],'method':_0x4ed722[_0x65ec('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4ed722[_0x65ec('0x66')])===_0x65ec('0x67')&&parseInt(_0x4ed722[_0x65ec('0x66')])>=0x1?parseInt(_0x4ed722[_0x65ec('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x65ec('0x68')]([_0x65ec('0x69'),'PUT'],_0x1691c6[_0x65ec('0x65')]['toUpperCase']())){try{_0x1691c6['body']=_0x4ed722[_0x65ec('0x9')]?JSON[_0x65ec('0x6a')](_0x4ed722[_0x65ec('0x9')]):{};}catch(_0x80ff05){logger[_0x65ec('0x32')](_0x65ec('0x6b'),_0x80ff05);}}try{_0x1691c6[_0x65ec('0x6c')]=_0x4ed722[_0x65ec('0x6d')]?JSON['parse'](_0x4ed722[_0x65ec('0x6d')]):{};}catch(_0x4897b4){logger[_0x65ec('0x32')](_0x65ec('0x6e'),_0x4897b4);}if(_0x4ed722[_0x65ec('0x6f')]){try{var _0x5daa65=require(_0x4ed722[_0x65ec('0x6f')])[_0x65ec('0x70')](this,_0x1691c6);_0x1691c6[_0x65ec('0x71')]=Mustache[_0x65ec('0x72')](_0x4ed722[_0x65ec('0x64')],_0x5daa65,{},['$$','$$']);if(_0x1691c6[_0x65ec('0x6c')]){_0x1691c6[_0x65ec('0x6c')]=JSON['parse'](Mustache[_0x65ec('0x72')](JSON[_0x65ec('0x73')](_0x1691c6[_0x65ec('0x6c')]),_0x5daa65,{},['$$','$$']));}if(_0x1691c6[_0x65ec('0x74')]){_0x1691c6['body']=JSON['parse'](Mustache[_0x65ec('0x72')](JSON[_0x65ec('0x73')](_0x1691c6[_0x65ec('0x74')]),_0x5daa65,{},['$$','$$']));}}catch(_0x3962d4){logger[_0x65ec('0x32')](_0x65ec('0x75'),_0x3962d4);}}rp(_0x1691c6)['then'](function(_0x3b0318){var _0xf6485a={'statusCode':_0x3b0318[_0x65ec('0x76')]||0xc8,'statusMessage':_0x3b0318[_0x65ec('0x77')]||'OK','headers':_0x3b0318[_0x65ec('0x6c')]||{},'body':_0x3b0318[_0x65ec('0x74')]||{}};_0x154241(null,_0xf6485a);})[_0x65ec('0x10')](function(_0x360623){var _0x4de295={'statusCode':_0x360623[_0x65ec('0x76')]||0x1f4,'statusMessage':_0x360623[_0x65ec('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x360623[_0x65ec('0x79')][_0x65ec('0x6c')]||{},'body':_0x360623[_0x65ec('0x79')][_0x65ec('0x74')]||{}};_0x154241(null,_0x4de295);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x7a')]=function(_0x1ea142,_0x445a20){scripts[_0x65ec('0x7a')](this[_0x65ec('0x37')]['uniqueid'],_0x1ea142['key'],_0x1ea142[_0x65ec('0x5c')],_0x1ea142[_0x65ec('0x7b')]||'en')[_0x65ec('0xf')](function(_0x51df33){_0x445a20(null,_0x51df33);})[_0x65ec('0x10')](function(_0x392202){_0x445a20(_0x392202);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x7c')]=function(_0x3d79a8,_0x386eba){scripts[_0x65ec('0x7c')](this[_0x65ec('0x37')][_0x65ec('0x3c')],_0x3d79a8['dialogflowV2_project_id'],_0x3d79a8[_0x65ec('0x7d')],_0x3d79a8[_0x65ec('0x7e')],_0x3d79a8[_0x65ec('0x5c')],_0x3d79a8[_0x65ec('0x7f')]||'en')[_0x65ec('0xf')](function(_0xba5894){_0x386eba(null,_0xba5894);})['catch'](function(_0x17b4e3){_0x386eba(_0x17b4e3);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x80')]=function(_0x45873f,_0x13bfa8){scripts['sestekNDA'](this['channel'],_0x45873f)[_0x65ec('0xf')](function(_0x44e353){_0x13bfa8(null,_0x44e353);})[_0x65ec('0x10')](function(_0x1f925b){_0x13bfa8(_0x1f925b);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x81')]=function(_0x2bc3a6,_0x3d0c6c){scripts[_0x65ec('0x81')](_0x2bc3a6[_0x65ec('0x82')],_0x2bc3a6[_0x65ec('0x5c')],_0x2bc3a6['ispeech_tts_language']||_0x65ec('0x5d'),_0x2bc3a6['speed'])['then'](function(_0xd67b93){_0x3d0c6c(null,_0xd67b93);})['catch'](function(_0x42e9f2){_0x3d0c6c(_0x42e9f2);});};AGIVertices[_0x65ec('0xd')]['ispeechASR']=function(_0x569a85,_0x24658f,_0x1ebb2c){scripts['ispeechASR'](_0x24658f,_0x569a85[_0x65ec('0x82')],_0x569a85[_0x65ec('0x83')]||'en-US',this[_0x65ec('0x84')](_0x569a85[_0x65ec('0x85')])?_0x569a85[_0x65ec('0x85')]:undefined)[_0x65ec('0xf')](function(_0x565b1a){_0x1ebb2c(null,_0x565b1a);})[_0x65ec('0x10')](function(_0x1aad46){_0x1ebb2c(_0x1aad46);});};AGIVertices['prototype'][_0x65ec('0x86')]=function(_0x4905b9,_0x372a46){scripts[_0x65ec('0x86')](_0x4905b9[_0x65ec('0x87')],_0x4905b9['aws_secret_access_key'],_0x4905b9['aws_polly_region'],_0x4905b9[_0x65ec('0x88')]||_0x65ec('0x89'),_0x4905b9[_0x65ec('0x5c')],_0x4905b9[_0x65ec('0x8a')]||_0x65ec('0x5c'))['then'](function(_0x18a863){_0x372a46(null,_0x18a863);})['catch'](function(_0x5f53dc){_0x372a46(_0x5f53dc);});};AGIVertices[_0x65ec('0xd')]['awsLex']=function(_0x102e66,_0x3168c8){scripts['awsLex'](this['channel']['uniqueid'],_0x102e66[_0x65ec('0x87')],_0x102e66[_0x65ec('0x8b')],_0x102e66[_0x65ec('0x8c')],_0x102e66['text'],_0x102e66['aws_bot_name'])['then'](function(_0x353c7c){_0x3168c8(null,_0x353c7c);})[_0x65ec('0x10')](function(_0xc908a7){_0x3168c8(_0xc908a7);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x8d')]=function(_0x3bc944,_0x3ca4e9,_0x1c36c6){scripts[_0x65ec('0x8d')](_0x3ca4e9,_0x3bc944[_0x65ec('0x82')],_0x3bc944[_0x65ec('0x8e')]||'en-US')[_0x65ec('0xf')](function(_0x3e459e){_0x1c36c6(null,_0x3e459e);})[_0x65ec('0x10')](function(_0x77b7b9){_0x1c36c6(_0x77b7b9);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x8f')]=function(_0x5c6a76,_0x44d1a7,_0x38cfe3){scripts[_0x65ec('0x8f')](_0x44d1a7,_0x5c6a76['appid'],_0x5c6a76['appsecret'],_0x5c6a76[_0x65ec('0x71')])[_0x65ec('0xf')](function(_0x1be3a6){_0x38cfe3(null,_0x1be3a6);})[_0x65ec('0x10')](function(_0x20c569){_0x38cfe3(_0x20c569);});};AGIVertices[_0x65ec('0xd')][_0x65ec('0x90')]=function(_0x426631){var _0x5f5d7a=_[_0x65ec('0x68')](verticesWithRetry,_0x426631[_0x65ec('0x38')])?_0x426631:_[_0x65ec('0x91')](_0x426631);for(var _0x997a85 in _0x5f5d7a){if(_0x5f5d7a[_0x65ec('0x92')](_0x997a85)){if(_0x5f5d7a[_0x997a85]&&_['isString'](_0x5f5d7a[_0x997a85])){if(_['includes'](recursiveMapAttributes,_0x997a85)){_0x5f5d7a[_0x997a85]=this['replaceObjectAllVariables'](_0x5f5d7a[_0x997a85]);}else{_0x5f5d7a[_0x997a85]=this[_0x65ec('0x93')](_0x5f5d7a[_0x997a85]);}}}}return _0x5f5d7a;};AGIVertices[_0x65ec('0xd')][_0x65ec('0x94')]=function(_0x322f03){for(var _0x18f809 in _0x322f03){if(_0x322f03[_0x65ec('0x92')](_0x18f809)){if(_[_0x65ec('0x95')](_0x322f03[_0x18f809])){this[_0x65ec('0x94')](_0x322f03[_0x18f809]);}else if(_[_0x65ec('0x96')](_0x322f03[_0x18f809])){for(var _0x37c311=0x0;_0x37c311<_0x322f03[_0x18f809]['length'];_0x37c311++){this[_0x65ec('0x94')](_0x322f03[_0x18f809][_0x37c311]);}}else if(_[_0x65ec('0x97')](_0x322f03[_0x18f809])){_0x322f03[_0x18f809]=this[_0x65ec('0x93')](_0x322f03[_0x18f809]);}}}};AGIVertices[_0x65ec('0xd')]['saveRestApiResult']=function(_0x298c3a,_0x17ec30){for(var _0x42af46 in _0x298c3a){if(_0x298c3a[_0x65ec('0x92')](_0x42af46)){if(_[_0x65ec('0x95')](_0x298c3a[_0x42af46])){if(!_[_0x65ec('0x98')](_0x298c3a[_0x42af46])){this['saveRestApiResult'](_0x298c3a[_0x42af46],util[_0x65ec('0x29')](_0x65ec('0x99'),_0x17ec30,_0x42af46));}}else if(_[_0x65ec('0x96')](_0x298c3a[_0x42af46])){for(var _0x543b74=0x0;_0x543b74<_0x298c3a[_0x42af46][_0x65ec('0x9a')];_0x543b74++){this[_0x65ec('0x9b')](_0x298c3a[_0x42af46][_0x543b74],util[_0x65ec('0x29')](_0x65ec('0x99'),_0x17ec30,_0x42af46+'['+_0x543b74+']'));}}else{if(!_['isNil'](_0x298c3a[_0x42af46])){this['channel'][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0x99'),_0x17ec30,_0x42af46),_0x298c3a[_0x42af46]);}}}}};AGIVertices['prototype'][_0x65ec('0x9d')]=function(_0x152af1){try{var _0x41daf9=JSON['parse'](_0x152af1);this[_0x65ec('0x94')](_0x41daf9);return JSON[_0x65ec('0x73')](_0x41daf9);}catch(_0x49a6a2){return this['replaceAllVariables'](_0x152af1);}};AGIVertices[_0x65ec('0xd')][_0x65ec('0x93')]=function(_0x364d41){var _0x344923=_0x364d41[_0x65ec('0x9e')]('{');for(var _0x4587ea=0x1;_0x4587ea<_0x344923[_0x65ec('0x9a')];_0x4587ea+=0x1){var _0x514d0f=_0x344923[_0x4587ea]['split']('}');if(_0x514d0f[_0x65ec('0x9a')]>0x1){_0x364d41=_0x364d41[_0x65ec('0x9f')]('{'+_0x514d0f[0x0]+'}',this[_0x65ec('0x37')][_0x65ec('0xe')](_0x514d0f[0x0])[_0x65ec('0xa0')]||_0x514d0f[0x0]);}}if(_0x344923['length']===0x1){return _0x364d41['toString']();}return this['replaceAllVariables'](_0x364d41);};AGIVertices[_0x65ec('0xd')][_0x65ec('0xa1')]=function(_0x210376,_0x267bd9){var _0x54e4e7=this[_0x65ec('0x37')][_0x65ec('0xe')](_0x210376);if(_0x54e4e7[_0x65ec('0xa2')]===-0x1){return _0x54e4e7;}logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xa3'),_0x267bd9,_0x54e4e7['extra']));return this[_0x65ec('0x37')][_0x65ec('0x9c')](_0x267bd9,_0x54e4e7[_0x65ec('0xa0')]);};AGIVertices[_0x65ec('0xd')][_0x65ec('0x84')]=function(_0x223c94){return _0x223c94&&_0x223c94!=='0'&&_0x223c94!=='-1'&&_0x223c94!=='';};AGIVertices[_0x65ec('0xd')]['maxRetry']=function(_0x406214){this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x406214,'-');_0x406214[_0x65ec('0xa4')]=_0x406214[_0x65ec('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x65ec('0xa6')]=function(_0x561a3d){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xa7'),_0x561a3d[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x561a3d['text'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xaa'));}var _0x3a17bd='\x22'+_0x561a3d[_0x65ec('0x5c')]+'\x22';if(this[_0x65ec('0x84')](_0x561a3d[_0x65ec('0x79')])){_0x3a17bd+=','+_0x561a3d[_0x65ec('0x79')];}var _0x50dc25=this[_0x65ec('0x37')][_0x65ec('0x56')]('MRCPSynth',_0x3a17bd);if(_0x50dc25['result']===-0x1){return _0x50dc25;}return this[_0x65ec('0x37')]['noop'](util[_0x65ec('0x29')](_0x65ec('0xab'),_0x3a17bd));};AGIVertices[_0x65ec('0xd')]['mrcprecog']=function(_0x35a8ab){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xac'),_0x35a8ab[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x35a8ab[_0x65ec('0xad')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')]('no\x20grammar\x20configured');}var _0x9ddcba=_0x35a8ab['grammar'];if(this[_0x65ec('0x84')](_0x35a8ab[_0x65ec('0x79')])){_0x9ddcba+=','+_0x35a8ab[_0x65ec('0x79')];}var _0x5924ba=this['channel'][_0x65ec('0x56')]('MRCPRecog',_0x9ddcba);if(_0x5924ba['result']===-0x1){return _0x5924ba;}var _0x4f381a=this[_0x65ec('0xa1')]('RECOG_CONFIDENCE()',_0x65ec('0xae'));if(_0x4f381a[_0x65ec('0xa2')]===-0x1){return _0x4f381a;}var _0x1f49e3=this[_0x65ec('0xa1')]('RECOG_INPUT()',_0x65ec('0xaf'));if(_0x1f49e3[_0x65ec('0xa2')]===-0x1){return _0x1f49e3;}var _0x4a6d77=this[_0x65ec('0xa1')]('RECOG_INSTANCE()',_0x65ec('0xb0'));if(_0x4a6d77[_0x65ec('0xa2')]===-0x1){return _0x4a6d77;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xb1'),_0x9ddcba));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xb2')]=function(_0x403861){logger['info'](util[_0x65ec('0x29')](_0x65ec('0xb3'),_0x403861[_0x65ec('0xa8')]));return this[_0x65ec('0x37')]['agi']([_0x403861[_0x65ec('0xb4')],_0x403861[_0x65ec('0xb5')]]);};AGIVertices[_0x65ec('0xd')][_0x65ec('0xb6')]=function(_0x307fcd){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x307fcd['label']));if(this[_0x65ec('0x84')](_0x307fcd[_0x65ec('0x66')])){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xb7'),_0x307fcd[_0x65ec('0x66')]));var _0x1cba0d=this[_0x65ec('0x37')][_0x65ec('0xb8')](_0x307fcd['timeout']);if(_0x1cba0d[_0x65ec('0xa2')]===-0x1){return _0x1cba0d;}}return this[_0x65ec('0x37')][_0x65ec('0xb6')]();};AGIVertices[_0x65ec('0xd')][_0x65ec('0xb9')]=function(_0x3e3e22){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3e3e22[_0x65ec('0xa8')]));if(!this['isConfigured'](_0x3e3e22[_0x65ec('0x4a')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x3e3e22,_0x65ec('0xba'));}_0x3e3e22[_0x65ec('0x4b')]=moment();if(this[_0x65ec('0x84')](_0x3e3e22[_0x65ec('0xbb')])){_0x3e3e22[_0x65ec('0x4b')]=moment()[_0x65ec('0xbc')](_0x3e3e22[_0x65ec('0xbb')],_0x65ec('0xbd'));}if(!this[_0x65ec('0x84')](_0x3e3e22[_0x65ec('0x4c')])){_0x3e3e22[_0x65ec('0x4c')]=0x2;}this[_0x65ec('0x44')][_0x65ec('0x70')](this,_0x3e3e22);return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xbe'),_0x3e3e22[_0x65ec('0x49')],_0x3e3e22[_0x65ec('0x4a')],_0x3e3e22[_0x65ec('0x4b')]));};AGIVertices[_0x65ec('0xd')]['custom_app']=function(_0x374082){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xbf'),_0x374082[_0x65ec('0xa8')]));var _0xc2ad21=this['channel'][_0x65ec('0x56')](_0x374082[_0x65ec('0xc0')],_0x374082[_0x65ec('0x79')]);if(_0xc2ad21['result']===-0x1){return _0xc2ad21;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')]('Executed\x20command\x20%s\x20%s',_0x374082[_0x65ec('0xc0')],_0x374082[_0x65ec('0x79')]));};AGIVertices[_0x65ec('0xd')]['lumenvoxtts']=function(_0x11236f){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0xc1'),_0x11236f[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x11236f[_0x65ec('0x5c')])){return this['channel'][_0x65ec('0xa9')]('no\x20text\x20configured');}var _0xc09a0f='\x22'+_0x11236f[_0x65ec('0x5c')]+'\x22';if(this[_0x65ec('0x84')](_0x11236f[_0x65ec('0x79')])){_0xc09a0f+=','+_0x11236f[_0x65ec('0x79')];}var _0x5c41bb=this[_0x65ec('0x37')][_0x65ec('0x56')](_0x65ec('0xc2'),_0xc09a0f);if(_0x5c41bb[_0x65ec('0xa2')]===-0x1){return _0x5c41bb;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xab'),_0xc09a0f));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xc3')]=function(_0x40d8ef){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xc4'),_0x40d8ef[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x40d8ef['text'])){return this['channel']['noop'](_0x65ec('0xaa'));}var _0x233fa2='\x22'+_0x40d8ef[_0x65ec('0x5c')]+'\x22';if(this[_0x65ec('0x84')](_0x40d8ef[_0x65ec('0x79')])){_0x233fa2+=','+_0x40d8ef['options'];}var _0x1c68ee=this['channel'][_0x65ec('0x56')]('MRCPSynth',_0x233fa2);if(_0x1c68ee[_0x65ec('0xa2')]===-0x1){return _0x1c68ee;}return this['channel'][_0x65ec('0xa9')](util['format'](_0x65ec('0xab'),_0x233fa2));};AGIVertices['prototype'][_0x65ec('0xc5')]=function(_0x4420aa){logger['info'](util[_0x65ec('0x29')](_0x65ec('0xc6'),_0x4420aa[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x4420aa[_0x65ec('0xad')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xc7'));}var _0x2dff2e=_0x4420aa['grammar'];if(this[_0x65ec('0x84')](_0x4420aa[_0x65ec('0x79')])){_0x2dff2e+=','+_0x4420aa['options'];}var _0x53e92d=this[_0x65ec('0x37')][_0x65ec('0x56')](_0x65ec('0xc8'),_0x2dff2e);if(_0x53e92d[_0x65ec('0xa2')]===-0x1){return _0x53e92d;}var _0x598930=this[_0x65ec('0xa1')](_0x65ec('0xc9'),_0x65ec('0xca'));if(_0x598930[_0x65ec('0xa2')]===-0x1){return _0x598930;}var _0x3238b4=this[_0x65ec('0xa1')](_0x65ec('0xcb'),_0x65ec('0xcc'));if(_0x3238b4[_0x65ec('0xa2')]===-0x1){return _0x3238b4;}var _0x151986=this[_0x65ec('0xa1')]('RECOG_INSTANCE()',_0x65ec('0xcd'));if(_0x151986[_0x65ec('0xa2')]===-0x1){return _0x151986;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xb1'),_0x2dff2e));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xce')]=function(_0x649ff){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xcf'),_0x649ff[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x649ff['grammar'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xc7'));}var _0x36cbef=_0x649ff['grammar'];if(this['isConfigured'](_0x649ff['options'])){_0x36cbef+=','+_0x649ff['options'];}var _0xf29ebc=this[_0x65ec('0x37')][_0x65ec('0x56')](_0x65ec('0xc8'),_0x36cbef);if(_0xf29ebc['result']===-0x1){return _0xf29ebc;}var _0x23badc=this['getAndSetVariable'](_0x65ec('0xc9'),'SESTEK_ASR_CONFIDENCE');if(_0x23badc[_0x65ec('0xa2')]===-0x1){return _0x23badc;}var _0x4da116=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x4da116['result']===-0x1){return _0x4da116;}var _0x519089=this[_0x65ec('0xa1')](_0x65ec('0xd0'),_0x65ec('0xd1'));if(_0x519089['result']===-0x1){return _0x519089;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0xb1'),_0x36cbef));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xd2')]=function(_0x5a1b64){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xd3'),_0x5a1b64[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x5a1b64['odbc_id'])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x5a1b64,'no\x20database\x20selected');}var _0x4dcee0=this['getSquareOdbc']['sync'](this,_0x5a1b64[_0x65ec('0xd4')]);if(!_0x4dcee0){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x5a1b64,_0x65ec('0xd5'));}if(!this[_0x65ec('0x84')](_0x5a1b64[_0x65ec('0x2e')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x5a1b64,_0x65ec('0xd6'));}var _0x1f2e29=_0x5a1b64[_0x65ec('0x2e')][_0x65ec('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0xd7'),_0x1f2e29));var _0x1e3b53=this[_0x65ec('0x2b')][_0x65ec('0x70')](this,_0x4dcee0,_0x1f2e29);this['createSquareDetailsReport'][_0x65ec('0x70')](this,_0x5a1b64,_0x1f2e29);if(!this[_0x65ec('0x84')](_0x5a1b64['variable_id'])){return this['channel']['noop'](_0x65ec('0xd8'));}var _0x27c361=this[_0x65ec('0xe')][_0x65ec('0x70')](this,_0x5a1b64[_0x65ec('0xd9')]);if(!_0x27c361){return this['channel'][_0x65ec('0x32')](_0x5a1b64,_0x65ec('0xda'));}var _0x4a3822=this;_0x1e3b53[_0x65ec('0xdb')](function(_0x2ab6c3,_0x215134){Object[_0x65ec('0xdc')](_0x2ab6c3)['forEach'](function(_0x886c4e){_0x4a3822[_0x65ec('0x37')][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0xdd'),_0x27c361,_0x215134,_0x886c4e),_0x2ab6c3[_0x886c4e]);});});this['channel'][_0x65ec('0x9c')](util['format'](_0x65ec('0xde'),_0x27c361),_0x1e3b53[_0x65ec('0x9a')]);return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xdf'),_0x27c361));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xe0')]=function(_0x173cd3){logger['debug'](util[_0x65ec('0x29')](_0x65ec('0xe1'),_0x173cd3[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x173cd3[_0x65ec('0xe2')])){return this['channel'][_0x65ec('0x32')](_0x173cd3,'no\x20user\x20selected');}var _0x2fa462=this[_0x65ec('0x19')][_0x65ec('0x70')](this,_0x173cd3[_0x65ec('0xe2')]);if(!_0x2fa462){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x173cd3,_0x65ec('0xe3'));}var _0x4f4d70=this[_0x65ec('0x37')][_0x65ec('0x56')](_0x65ec('0xe4'),[util['format'](_0x65ec('0xe5'),_0x2fa462),_0x173cd3[_0x65ec('0x66')],_0x173cd3[_0x65ec('0xe6')],_0x173cd3[_0x65ec('0x64')]]);if(_0x4f4d70[_0x65ec('0xa2')]===-0x1){return _0x4f4d70;}return this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xe7'),_0x65ec('0xe4')));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xe8')]=function(_0xa312af){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xe9'),_0xa312af['label']));if(!this[_0x65ec('0x84')](_0xa312af[_0x65ec('0x82')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xea'));}if(!this[_0x65ec('0x84')](_0xa312af['text'])){return this[_0x65ec('0x37')]['noop'](_0x65ec('0xaa'));}this[_0x65ec('0x37')][_0x65ec('0xeb')]=!![];this[_0x65ec('0x36')](_0xa312af);this[_0x65ec('0x43')](_0xa312af[_0x65ec('0x5c')],'in','','');this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xec'),_0xa312af['text']));var _0x1cb25d=this[_0x65ec('0x7a')][_0x65ec('0x70')](this,_0xa312af);if(_0x1cb25d){for(var _0x32ab47 in _0x1cb25d){if(_0x1cb25d[_0x65ec('0x92')](_0x32ab47)){this['channel'][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0xed'),_0x32ab47[_0x65ec('0xee')]()),_0x1cb25d[_0x32ab47]);}}this[_0x65ec('0x43')](_0x1cb25d[_0x65ec('0xef')],_0x65ec('0xf0'),_0x65ec('0xe8'),'');return this[_0x65ec('0x37')]['noop'](util[_0x65ec('0x29')](_0x65ec('0xf1'),_0x1cb25d['speech']));}return this[_0x65ec('0x37')]['error'](_0xa312af,_0x65ec('0xf2'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0xf3')]=function(_0xde55da){logger['info'](util[_0x65ec('0x29')](_0x65ec('0xf4'),_0xde55da[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0xde55da['dialogflowV2_project_id'])){return this['channel'][_0x65ec('0xa9')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0xde55da['client_email'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xf5'));}if(!this[_0x65ec('0x84')](_0xde55da['private_key'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')]('no\x20private_key\x20configured');}if(!this[_0x65ec('0x84')](_0xde55da[_0x65ec('0x7f')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xf6'));}if(!this[_0x65ec('0x84')](_0xde55da[_0x65ec('0x5c')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xaa'));}this['channel'][_0x65ec('0xeb')]=!![];this['createSquareDetailsReport'](_0xde55da);this[_0x65ec('0x43')](_0xde55da[_0x65ec('0x5c')],'in','','');this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')]('Trying\x20DialogflowV2:\x20%s',_0xde55da[_0x65ec('0x5c')]));var _0x122514=this[_0x65ec('0x7c')]['sync'](this,_0xde55da);if(_0x122514){for(var _0x5da13b in _0x122514){if(_0x122514['hasOwnProperty'](_0x5da13b)){if(_0x5da13b!==_0x65ec('0xf7')){this[_0x65ec('0x37')][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0xed'),_0x5da13b['toUpperCase']()),_0x122514[_0x5da13b]);}}}this[_0x65ec('0x43')](_0x122514[_0x65ec('0xef')],_0x65ec('0xf0'),_0x65ec('0xf3'),_0x122514['providerResponse']);return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xf8'),_0x122514['speech']));}return this[_0x65ec('0x37')][_0x65ec('0x32')](_0xde55da,_0x65ec('0xf9'));};AGIVertices[_0x65ec('0xd')]['sesteknda']=function(_0x41f24b){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0xfa'),_0x41f24b[_0x65ec('0xa8')]));if(!this['isConfigured'](_0x41f24b['ndauth_url'])){return this[_0x65ec('0x37')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x41f24b[_0x65ec('0xfb')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xfc'));}if(!this[_0x65ec('0x84')](_0x41f24b['password'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xfd'));}if(!this['isConfigured'](_0x41f24b['ndassistant_url'])){return this['channel'][_0x65ec('0xa9')]('no\x20text\x20configured');}this[_0x65ec('0x37')]['bot']=!![];this[_0x65ec('0x36')](_0x41f24b);this['createSquareMessage'](_0x41f24b[_0x65ec('0x5c')],'in','','');this['channel']['noop'](util[_0x65ec('0x29')]('Trying\x20SestekNDA:\x20%s',_0x41f24b[_0x65ec('0x5c')]));var _0x330a9=this['sestekNDA']['sync'](this,_0x41f24b);if(_0x330a9){for(var _0x4f535e in _0x330a9){if(_0x330a9[_0x65ec('0x92')](_0x4f535e)){this[_0x65ec('0x37')][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0xfe'),_0x4f535e[_0x65ec('0xee')]()),_0x330a9[_0x4f535e]);}}this[_0x65ec('0x43')](_0x330a9[_0x65ec('0xef')],_0x65ec('0xf0'),_0x65ec('0xff'),'');if(_0x330a9[_0x65ec('0x100')]){this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x101'),_0x330a9['audiofile']));var _0x7db7d5=this[_0x65ec('0x37')]['streamFile'](_0x330a9['audiofile']);try{fs[_0x65ec('0x102')](_0x330a9['audiofile']+_0x65ec('0x103'));}catch(_0x3e85ca){logger[_0x65ec('0x32')](_0x3e85ca);}return _0x7db7d5;}else{return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')]('SestekNDA\x20Result\x20%s',_0x330a9[_0x65ec('0xef')]));}}return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x41f24b,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x65ec('0xd')][_0x65ec('0x104')]=function(_0x1baf25){logger[_0x65ec('0x2d')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x1baf25[_0x65ec('0xa8')]));return this[_0x65ec('0x37')]['noop'](_0x65ec('0x104'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x105')]=function(_0x3c652d){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x106'),_0x3c652d[_0x65ec('0xa8')]));var _0x4ec5a0='';if(_0x3c652d[_0x65ec('0x107')]){if(!this[_0x65ec('0x84')](_0x3c652d[_0x65ec('0x107')])){return this[_0x65ec('0x37')]['error'](_0x3c652d,_0x65ec('0x108'));}else{var _0x4af710=parseInt(_0x3c652d['trunk_id'],0xa);if(isNaN(_0x4af710)){_0x4ec5a0=_0x3c652d['trunk_id'];}else{_0x4ec5a0=this['getTrunk'][_0x65ec('0x70')](this,_0x3c652d[_0x65ec('0x107')]);if(!_0x4ec5a0){return this['channel'][_0x65ec('0x32')](_0x3c652d,'no\x20trunk\x20found');}}}}else if(_0x3c652d[_0x65ec('0x109')]){_0x4ec5a0=_0x3c652d[_0x65ec('0x109')];}else{return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x3c652d,_0x65ec('0x108'));}var _0x1fcf6f=this[_0x65ec('0x37')][_0x65ec('0x56')](_0x65ec('0xe4'),[util['format'](_0x65ec('0x10a'),_0x4ec5a0,_0x3c652d[_0x65ec('0x49')]),_0x3c652d[_0x65ec('0x66')],_0x3c652d[_0x65ec('0xe6')],_0x3c652d[_0x65ec('0x64')]]);if(_0x1fcf6f[_0x65ec('0xa2')]===-0x1){return _0x1fcf6f;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0xe7'),_0x65ec('0xe4')));};AGIVertices[_0x65ec('0xd')]['finally']=function(_0x213898){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x10b'),_0x213898['label']));return this['channel'][_0x65ec('0xa9')](_0x65ec('0x10c'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x10d')]=function(_0x427c55){logger[_0x65ec('0x2d')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x427c55[_0x65ec('0xa8')]));if(_0x427c55['retry']===0x0){return this[_0x65ec('0xa5')](_0x427c55);}_0x427c55['retry']-=0x1;if(!this[_0x65ec('0x84')](_0x427c55['file_id'])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x427c55,_0x65ec('0x10e'));}var _0xd4c2bd=this['getSound'][_0x65ec('0x70')](this,_0x427c55[_0x65ec('0x10f')]);if(!_0xd4c2bd){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x427c55,_0x65ec('0x110'));}if(!this['isConfigured'](_0x427c55[_0x65ec('0xd9')])){return this['channel']['error'](_0x65ec('0xd8'));}var _0x12d8be=this[_0x65ec('0x37')][_0x65ec('0x111')](_0xd4c2bd,_0x427c55[_0x65ec('0x112')],_0x427c55['maxdigit']);var _0x4b5590=_0x12d8be['result']?_0x12d8be['result'][_0x65ec('0x113')]():'';logger['info']('test',JSON[_0x65ec('0x73')](_0x12d8be));if(_0x12d8be[_0x65ec('0xa2')]===-0x1){this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x427c55,_0x4b5590);return _0x12d8be;}else if(_0x12d8be[_0x65ec('0xa0')]===_0x65ec('0x66')){_0x12d8be[_0x65ec('0xa2')]=_0x4b5590[_0x65ec('0x9a')]>=parseInt(_0x427c55['mindigit'])?'x':'i';}else{_0x12d8be[_0x65ec('0xa2')]=_0x4b5590['length']>=parseInt(_0x427c55['mindigit'])&&_0x4b5590[_0x65ec('0x9a')]<=parseInt(_0x427c55['maxdigit'])?'x':'i';}var _0x329da5=this['getVariable'][_0x65ec('0x70')](this,_0x427c55[_0x65ec('0xd9')]);if(!_0x329da5){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x427c55,_0x65ec('0xda'));}this['channel'][_0x65ec('0x9c')](_0x329da5,_0x4b5590);if(this[_0x65ec('0x84')](_0x427c55[_0x65ec('0x114')])){var _0x5bfbd9=parseInt(_0x427c55['hiddendigitsnum'],0xa);var _0x1934e1=rs[_0x65ec('0x115')]({'charset':'*','length':_0x5bfbd9});var _0x517c6c=_0x4b5590[_0x65ec('0x9a')];if(_0x517c6c>0x0){if(_0x517c6c>_0x5bfbd9){this['createSquareDetailsReport'][_0x65ec('0x70')](this,_0x427c55,_0x427c55['hiddendigitspos']==='first'?_0x1934e1+_0x4b5590[_0x65ec('0x116')](_0x5bfbd9):_0x4b5590[_0x65ec('0x116')](0x0,_0x517c6c-_0x5bfbd9)+_0x1934e1);}else{this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x427c55,rs[_0x65ec('0x115')]({'charset':'*','length':_0x517c6c}));}}else{this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x427c55,'');}}else{this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x427c55,_0x4b5590);}return _0x12d8be;};AGIVertices[_0x65ec('0xd')]['getsecretdigits']=function(_0x50407c){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x117'),_0x50407c['label']));return this[_0x65ec('0x10d')](_0x50407c);};AGIVertices[_0x65ec('0xd')][_0x65ec('0x118')]=function(_0x443d9d){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x119'),_0x443d9d['label']));this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x443d9d,_0x443d9d['goalname']);return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x11a'),_0x443d9d[_0x65ec('0x11b')]));};AGIVertices[_0x65ec('0xd')]['awspolly']=function(_0x448c42){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x11c'),_0x448c42[_0x65ec('0xa8')]));if(!this['isConfigured'](_0x448c42['aws_access_key_id'])||!this[_0x65ec('0x84')](_0x448c42[_0x65ec('0x8b')])){return this[_0x65ec('0x37')]['noop'](_0x65ec('0x11d'));}if(!this[_0x65ec('0x84')](_0x448c42[_0x65ec('0x5c')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')]('no\x20text\x20configured');}this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x11e'),_0x448c42[_0x65ec('0x5c')]));var _0xcdaf1=this[_0x65ec('0x86')]['sync'](this,_0x448c42);if(_0xcdaf1){this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x11f'),_0xcdaf1));var _0x3dfb9f=this['channel']['streamFile'](_0xcdaf1);try{fs['unlink'](_0xcdaf1+'.wav');}catch(_0x3e6010){logger[_0x65ec('0x32')](_0x3e6010);}return _0x3dfb9f;}return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x448c42,_0x65ec('0x120'));};AGIVertices['prototype'][_0x65ec('0x121')]=function(_0x13c782){logger[_0x65ec('0x2d')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x13c782[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x13c782[_0x65ec('0x87')])||!this[_0x65ec('0x84')](_0x13c782[_0x65ec('0x8b')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x11d'));}if(!this[_0x65ec('0x84')](_0x13c782[_0x65ec('0x122')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x123'));}if(!this['isConfigured'](_0x13c782[_0x65ec('0x5c')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xaa'));}this[_0x65ec('0x37')][_0x65ec('0xeb')]=!![];this[_0x65ec('0x36')](_0x13c782);this[_0x65ec('0x43')](_0x13c782[_0x65ec('0x5c')],'in','','');this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')]('Trying\x20Amazon\x20Lex:\x20%s',_0x13c782[_0x65ec('0x5c')]));var _0xd32bde=this['awsLex']['sync'](this,_0x13c782);if(_0xd32bde){for(var _0x139585 in _0xd32bde){if(_0xd32bde[_0x65ec('0x92')](_0x139585)&&_[_0x65ec('0x97')](_0xd32bde[_0x139585])){this[_0x65ec('0x37')]['setVariable'](util['format'](_0x65ec('0x124'),_0x139585[_0x65ec('0xee')]()),_0xd32bde[_0x139585]);}}if(_[_0x65ec('0x48')](_0xd32bde[_0x65ec('0x78')])){return this['channel'][_0x65ec('0xa9')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0xd32bde[_0x65ec('0x78')],'out','amazonlex','');return this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x125'),_0xd32bde[_0x65ec('0x78')]));}}return this[_0x65ec('0x37')]['error'](_0x13c782,_0x65ec('0x126'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x127')]=function(_0x2f168b){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x128'),_0x2f168b[_0x65ec('0xa8')],_0x2f168b[_0x65ec('0x66')]));if(!this['isConfigured'](_0x2f168b[_0x65ec('0x82')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xea'));}var _0x43c6b5=_0x65ec('0x129');var _0x540c24=util[_0x65ec('0x29')](_0x65ec('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x39e026=util[_0x65ec('0x29')](_0x65ec('0x99'),_0x540c24,_0x43c6b5);var _0xc6cb46=!![];if(_0x2f168b['beep']===_0x65ec('0x12b')){_0xc6cb46=![];}var _0x43eb08=this[_0x65ec('0x37')][_0x65ec('0x12c')](_0x540c24,_0x43c6b5,_0x2f168b[_0x65ec('0x12d')],_0x2f168b[_0x65ec('0x66')],undefined,_0xc6cb46);if(_0x43eb08[_0x65ec('0xa2')]!==-0x1){this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x12e'),_0x39e026));var _0x491609=this[_0x65ec('0x8d')][_0x65ec('0x70')](this,_0x2f168b,_0x39e026);if(_0x491609){for(var _0x566735 in _0x491609){if(_0x491609[_0x65ec('0x92')](_0x566735)){this['channel'][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0x12f'),_0x566735['toUpperCase']()),_0x491609[_0x566735]);}}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x130'),JSON[_0x65ec('0x73')](_0x491609)));}}return _0x43eb08;};AGIVertices[_0x65ec('0xd')][_0x65ec('0x131')]=function(_0x388c72){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x132'),_0x388c72['label']));if(!this[_0x65ec('0x84')](_0x388c72[_0x65ec('0x133')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x134'));}if(!this[_0x65ec('0x84')](_0x388c72[_0x65ec('0x135')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x136'));}var _0x29269a='wav';var _0x5e5173=util[_0x65ec('0x29')](_0x65ec('0x12a'),FILES_PATH,rs[_0x65ec('0x115')](0x4));var _0x32838e=util[_0x65ec('0x29')](_0x65ec('0x99'),_0x5e5173,_0x29269a);var _0x19125e=!![];if(_0x388c72[_0x65ec('0x137')]===_0x65ec('0x12b')){_0x19125e=![];}var _0x24a814=this[_0x65ec('0x37')]['recordFile'](_0x5e5173,_0x29269a,_0x388c72[_0x65ec('0x12d')],_0x388c72[_0x65ec('0x66')],undefined,_0x19125e);if(_0x24a814['result']!==-0x1){this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x138'),_0x32838e));var _0x33370b=this[_0x65ec('0x8f')][_0x65ec('0x70')](this,_0x388c72,_0x32838e);if(_0x33370b){for(var _0x3ab61a in _0x33370b){if(_0x33370b['hasOwnProperty'](_0x3ab61a)){this[_0x65ec('0x37')][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0x139'),_0x3ab61a[_0x65ec('0xee')]()),_0x33370b[_0x3ab61a]);}}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x13a'),JSON[_0x65ec('0x73')](_0x33370b)));}}return _0x24a814;};AGIVertices[_0x65ec('0xd')][_0x65ec('0x13b')]=function(_0x21db9a){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x21db9a[_0x65ec('0xa8')]));return this[_0x65ec('0x37')][_0x65ec('0x13c')](_0x21db9a[_0x65ec('0x3e')],_0x21db9a[_0x65ec('0x3f')],_0x21db9a[_0x65ec('0x40')]);};AGIVertices[_0x65ec('0xd')][_0x65ec('0x13d')]=function(_0x4149a7){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x13e'),_0x4149a7[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x4149a7[_0x65ec('0x13f')])){return this[_0x65ec('0x37')]['error'](_0x4149a7,_0x65ec('0x140'));}try{var _0x40a8d3=eval(_0x4149a7[_0x65ec('0x13f')])?_0x65ec('0x141'):_0x65ec('0x142');this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4149a7[_0x65ec('0x13f')],_0x40a8d3));return{'code':0xc8,'result':_0x40a8d3};}catch(_0x1f6378){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x65ec('0xd')]['gotoiftime']=function(_0x1f5b83){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x143'),_0x1f5b83[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x1f5b83[_0x65ec('0x144')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x1f5b83,'no\x20interval\x20configured');}var _0xc4e420=this[_0x65ec('0x23')][_0x65ec('0x70')](this,_0x1f5b83[_0x65ec('0x144')]);if(!_0xc4e420){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x1f5b83,_0x65ec('0x145'));}for(var _0x29301f=0x0;_0x29301f<_0xc4e420['length'];_0x29301f+=0x1){var _0x228eae=this['channel'][_0x65ec('0xe')](util[_0x65ec('0x29')]('IFTIME(%s?true:false)',_0xc4e420[_0x29301f]));if(_0x228eae[_0x65ec('0xa2')]===-0x1){return _0x228eae;}logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x146'),_0xc4e420[_0x29301f],_0x228eae[_0x65ec('0xa0')]));if(_0x228eae['extra']===_0x65ec('0x141')){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x146'),_0xc4e420[_0x29301f],'true'));this['channel']['noop'](util[_0x65ec('0x29')](_0x65ec('0x146'),_0xc4e420[_0x29301f],_0x65ec('0x141')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x65ec('0x29')](_0x65ec('0x146'),_0xc4e420[_0x29301f],'false'));this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')]('IFTIME\x20%s\x20%s',_0xc4e420[_0x29301f],_0x65ec('0x142')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x65ec('0x147')]=function(_0x29cea2){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x148'),_0x29cea2['label']));return this[_0x65ec('0x37')][_0x65ec('0x147')]();};AGIVertices[_0x65ec('0xd')][_0x65ec('0x149')]=function(_0x117ff5){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x14a'),_0x117ff5[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x117ff5[_0x65ec('0x82')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xea'));}var _0x5b27a7=_0x65ec('0x129');var _0x41a6de=util[_0x65ec('0x29')](_0x65ec('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x14fc11=util[_0x65ec('0x29')](_0x65ec('0x99'),_0x41a6de,_0x5b27a7);var _0xf51108=!![];if(_0x117ff5[_0x65ec('0x137')]===_0x65ec('0x12b')){_0xf51108=![];}var _0x4c3131=this['channel'][_0x65ec('0x12c')](_0x41a6de,_0x5b27a7,_0x117ff5[_0x65ec('0x12d')],_0x117ff5[_0x65ec('0x66')],undefined,_0xf51108);if(_0x4c3131[_0x65ec('0xa2')]!==-0x1){this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x14b'),_0x14fc11));var _0x46a33f=this[_0x65ec('0x14c')][_0x65ec('0x70')](this,_0x117ff5,_0x14fc11);if(_0x46a33f){for(var _0x5f15ee in _0x46a33f){if(_0x46a33f[_0x65ec('0x92')](_0x5f15ee)){this[_0x65ec('0x37')][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0x14d'),_0x5f15ee[_0x65ec('0xee')]()),_0x46a33f[_0x5f15ee]);}}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x14e'),JSON[_0x65ec('0x73')](_0x46a33f)));}}return _0x4c3131;};AGIVertices[_0x65ec('0xd')][_0x65ec('0x14f')]=function(_0x1e7e28){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x150'),_0x1e7e28[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x1e7e28['key'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xea'));}if(!this[_0x65ec('0x84')](_0x1e7e28[_0x65ec('0x5c')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xaa'));}this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x151'),_0x1e7e28[_0x65ec('0x5c')]));var _0xf513d5=this['ispeechTTS']['sync'](this,_0x1e7e28);if(_0xf513d5){this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x14b'),_0xf513d5));var _0x557082=this[_0x65ec('0x37')][_0x65ec('0x152')](_0xf513d5,_0x1e7e28['intKey']);try{fs[_0x65ec('0x102')](_0xf513d5+_0x65ec('0x103'));}catch(_0xdaab0e){logger[_0x65ec('0x32')](_0xdaab0e);}return _0x557082;}return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x1e7e28,_0x65ec('0x153'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x154')]=function(_0x55a16f){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x155'),_0x55a16f['label']));if(!this['isConfigured'](_0x55a16f[_0x65ec('0x156')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x55a16f,'no\x20find\x20by\x20configured');}logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x157'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x55a16f[_0x65ec('0x156')]));var _0x2f185b=this[_0x65ec('0x53')][_0x65ec('0x70')](this,_0x55a16f['findBy']);if(_0x2f185b){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x158'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x55a16f[_0x65ec('0x156')]));this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x158'),this[_0x65ec('0x37')]['callerid'],_0x55a16f[_0x65ec('0x156')]));return{'code':0xc8,'result':_0x65ec('0x159')};}else{logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x15a'),this[_0x65ec('0x37')]['callerid'],_0x55a16f[_0x65ec('0x156')]));this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x15a'),this[_0x65ec('0x37')]['callerid'],_0x55a16f[_0x65ec('0x156')]));return{'code':0xc8,'result':_0x65ec('0x15b')};}};AGIVertices[_0x65ec('0xd')][_0x65ec('0x15c')]=function(_0x3c327d){logger['info'](util[_0x65ec('0x29')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3c327d['label']));if(!this[_0x65ec('0x84')](_0x3c327d[_0x65ec('0x156')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x3c327d,_0x65ec('0x15d'));}logger['info'](util['format'](_0x65ec('0x157'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x3c327d['findBy']));var _0x5a5c8b=this[_0x65ec('0x52')]['sync'](this,_0x3c327d[_0x65ec('0x156')]);if(_0x5a5c8b){logger['info'](util['format'](_0x65ec('0x158'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x3c327d[_0x65ec('0x156')]));this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x158'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x3c327d[_0x65ec('0x156')]));return{'code':0xc8,'result':_0x65ec('0x159')};}else{logger[_0x65ec('0x2d')](util[_0x65ec('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x65ec('0x3a')],_0x3c327d[_0x65ec('0x156')]));this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x15a'),this['channel']['callerid'],_0x3c327d['findBy']));return{'code':0xc8,'result':_0x65ec('0x15b')};}};AGIVertices[_0x65ec('0xd')][_0x65ec('0x15e')]=function(_0x146526){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x15f'),_0x146526[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x146526[_0x65ec('0x160')])){return this['channel'][_0x65ec('0x32')](_0x146526,_0x65ec('0x161'));}this[_0x65ec('0x37')]['noop'](util[_0x65ec('0x29')](_0x65ec('0x162'),_0x146526[_0x65ec('0x160')]));var _0x4cd50f=eval(_0x146526[_0x65ec('0x160')]);if(!this[_0x65ec('0x84')](_0x146526[_0x65ec('0xd9')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xd8'));}var _0x2e9313=this[_0x65ec('0xe')]['sync'](this,_0x146526[_0x65ec('0xd9')]);if(!_0x2e9313){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x146526,'no\x20variable\x20found');}if(_[_0x65ec('0x96')](_0x4cd50f)){var _0x5e5aed=this;_0x4cd50f[_0x65ec('0xdb')](function(_0x274eeb,_0x47448c){_0x5e5aed['channel']['setVariable'](util[_0x65ec('0x29')](_0x65ec('0x163'),_0x2e9313,_0x47448c),_0x274eeb);});return this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x164'),_0x2e9313));}else{return this[_0x65ec('0x37')][_0x65ec('0x9c')](_0x2e9313,_0x4cd50f);}};AGIVertices[_0x65ec('0xd')][_0x65ec('0xa')]=function(_0x1abf23){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x165'),_0x1abf23[_0x65ec('0xa8')]));if(_0x1abf23[_0x65ec('0xa4')]===0x0){return this[_0x65ec('0xa5')](_0x1abf23);}_0x1abf23[_0x65ec('0xa4')]-=0x1;if(!this[_0x65ec('0x84')](_0x1abf23[_0x65ec('0x10f')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x1abf23,_0x65ec('0x10e'));}var _0x21da7b=this[_0x65ec('0x1d')][_0x65ec('0x70')](this,_0x1abf23['file_id']);if(!_0x21da7b){return this['channel'][_0x65ec('0x32')](_0x1abf23,_0x65ec('0x110'));}var _0x5d6500=this['channel'][_0x65ec('0x111')](_0x21da7b,_0x1abf23['response'],_0x1abf23['digit']);var _0xde8998=_0x5d6500[_0x65ec('0xa2')];if(_0x5d6500[_0x65ec('0xa2')]===-0x1){this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x1abf23,'-1');return _0x5d6500;}else if(_0x5d6500['extra']===_0x65ec('0x66')){_0x5d6500['result']=_0x5d6500[_0x65ec('0xa2')]['length']>0x0?_0x5d6500[_0x65ec('0xa2')]:'t';}else if(_[_0x65ec('0x98')](_0x5d6500['result'])){_0x5d6500['result']='#';_0xde8998='#';}if(!this[_0x65ec('0x84')](_0x1abf23[_0x65ec('0xd9')])){this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0xd8'));}else{var _0x17279a=this[_0x65ec('0xe')][_0x65ec('0x70')](this,_0x1abf23['variable_id']);if(!_0x17279a){return this['channel'][_0x65ec('0x32')](_0x1abf23,'no\x20variable\x20found');}this[_0x65ec('0x37')][_0x65ec('0x9c')](_0x17279a,_0xde8998);}this[_0x65ec('0x36')]['sync'](this,_0x1abf23,_0xde8998);return _0x5d6500;};AGIVertices['prototype']['noop']=function(_0x34ce79){logger[_0x65ec('0x2d')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x34ce79[_0x65ec('0xa8')]));return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x34ce79[_0x65ec('0x166')]||_0x34ce79[_0x65ec('0xa8')]);};AGIVertices[_0x65ec('0xd')][_0x65ec('0x167')]=function(_0x5d3dde){logger['info'](util[_0x65ec('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5d3dde[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x5d3dde[_0x65ec('0x156')])){return this['channel'][_0x65ec('0x32')](_0x5d3dde,_0x65ec('0x15d'));}logger['info'](util[_0x65ec('0x29')](_0x65ec('0x157'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x5d3dde[_0x65ec('0x156')]));var _0x41a57c=this[_0x65ec('0x4d')][_0x65ec('0x70')](this,_0x5d3dde['pause_id']);var _0x7665ac=this[_0x65ec('0x4f')][_0x65ec('0x70')](this,_0x5d3dde['findBy'],_0x41a57c);if(_0x7665ac){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x158'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x5d3dde['findBy']));this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x158'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x5d3dde[_0x65ec('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x15a'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x5d3dde[_0x65ec('0x156')]));this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x158'),this['channel'][_0x65ec('0x3a')],_0x5d3dde['findBy']));return{'code':0xc8,'result':_0x65ec('0x15b')};}};AGIVertices[_0x65ec('0xd')][_0x65ec('0x168')]=function(_0x48c3b9){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x169'),_0x48c3b9[_0x65ec('0xa8')]));if(!this['isConfigured'](_0x48c3b9[_0x65ec('0x10f')])){return this[_0x65ec('0x37')]['error'](_0x48c3b9,_0x65ec('0x10e'));}var _0x1a5454=this[_0x65ec('0x1d')][_0x65ec('0x70')](this,_0x48c3b9[_0x65ec('0x10f')]);if(!_0x1a5454){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x48c3b9,'no\x20file\x20audio\x20found');}var _0xa156e9=this[_0x65ec('0x37')][_0x65ec('0x56')]('PLAYBACK',[_0x1a5454,_0x48c3b9[_0x65ec('0xe6')]]);if(_0xa156e9['result']===-0x1){return _0xa156e9;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x16a'),_0x65ec('0x16b'),_0x1a5454));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x16c')]=function(_0x59b9ce){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x59b9ce['label']));if(!this['isConfigured'](_0x59b9ce[_0x65ec('0x16d')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x59b9ce,'no\x20queue\x20selected');}var _0x2abee6='';var _0x4ad96e=parseInt(_0x59b9ce[_0x65ec('0x16d')],0xa);if(isNaN(_0x4ad96e)){_0x2abee6=_0x59b9ce['queue_id'];}else{_0x2abee6=this[_0x65ec('0x11')][_0x65ec('0x70')](this,_0x59b9ce[_0x65ec('0x16d')]);if(!_0x2abee6){return this[_0x65ec('0x37')]['error'](_0x59b9ce,_0x65ec('0x16e'));}}var _0x384063='';if(this[_0x65ec('0x84')](_0x59b9ce[_0x65ec('0x10f')])){var _0x44e0bd=this[_0x65ec('0x1d')][_0x65ec('0x70')](this,_0x59b9ce['file_id']);if(_0x44e0bd){_0x384063=_0x44e0bd;}}this['createSquareDetailsReport'][_0x65ec('0x70')](this,_0x59b9ce,_0x2abee6);if(_0x59b9ce[_0x65ec('0xe6')][_0x65ec('0x16f')]('x')<0x0){_0x59b9ce[_0x65ec('0xe6')]+='x';}if(_0x59b9ce[_0x65ec('0xe6')]['indexOf']('X')<0x0){_0x59b9ce[_0x65ec('0xe6')]+='X';}this['channel']['setVariable'](_0x65ec('0x170'),_0x2abee6?_0x2abee6[_0x65ec('0x171')]():'');var _0x4df574=this[_0x65ec('0x37')]['exec'](_0x65ec('0x172'),[_0x2abee6,_0x59b9ce[_0x65ec('0xe6')],_0x59b9ce[_0x65ec('0x64')],_0x384063,_0x59b9ce[_0x65ec('0x66')],_0x59b9ce[_0x65ec('0xb2')],_0x59b9ce['macro'],_0x59b9ce['gosub'],'',_0x59b9ce['position']]);if(_0x4df574[_0x65ec('0xa2')]===-0x1){return _0x4df574;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x16a'),'QUEUE',_0x2abee6));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x173')]=function(_0x1bc46d){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x174'),_0x1bc46d[_0x65ec('0xa8')]));var _0x3e2b1f=_0x1bc46d[_0x65ec('0x175')]||'wav';var _0x26605c=util[_0x65ec('0x29')]('%s_%s',this[_0x65ec('0x37')][_0x65ec('0x3c')],rs['generate'](0x5));var _0x5dd634=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x26605c,_0x3e2b1f);var _0x1b3805=util[_0x65ec('0x29')](_0x65ec('0x12a'),FILES_PATH,_0x26605c);this[_0x65ec('0x3b')][_0x65ec('0x70')](this,_0x1bc46d,_0x26605c,_0x5dd634);this[_0x65ec('0x37')][_0x65ec('0x9c')](_0x65ec('0x176'),_0x26605c);logger['info'](_0x65ec('0x177'),_0x1b3805,_0x3e2b1f,_0x1bc46d[_0x65ec('0x178')],_0x1bc46d[_0x65ec('0x66')]);return this[_0x65ec('0x37')]['recordFile'](_0x1b3805,_0x3e2b1f,_0x1bc46d[_0x65ec('0x178')],_0x1bc46d[_0x65ec('0x66')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x567d62){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x179'),_0x567d62[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x567d62[_0x65ec('0x64')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x17a'));}var _0x568f74=this[_0x65ec('0x63')][_0x65ec('0x70')](this,_0x567d62);logger[_0x65ec('0x2d')](util[_0x65ec('0x29')]('Response:',util['inspect'](_0x568f74,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x567d62['variable_id'])){return this[_0x65ec('0x37')][_0x65ec('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1049a3=this['getVariable']['sync'](this,_0x567d62[_0x65ec('0xd9')]);if(!_0x1049a3){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x567d62,_0x65ec('0xda'));}this[_0x65ec('0x37')][_0x65ec('0x9c')](util[_0x65ec('0x29')](_0x65ec('0x17b'),_0x1049a3),_0x568f74[_0x65ec('0x76')]?_0x568f74['statusCode']:'200');this['channel']['setVariable'](util[_0x65ec('0x29')](_0x65ec('0x17c'),_0x1049a3),_0x568f74[_0x65ec('0x77')]?_0x568f74[_0x65ec('0x77')]:'OK');if(_0x568f74['body']){try{this[_0x65ec('0x9b')](_0x568f74[_0x65ec('0x74')],_0x1049a3);}catch(_0x3e9a6d){logger[_0x65ec('0x32')](util[_0x65ec('0x29')](_0x65ec('0x17d'),_0x1049a3));}}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0xdf'),_0x1049a3));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x17e')]=function(_0x4a5627){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x17f'),_0x4a5627[_0x65ec('0xa8')]));return this[_0x65ec('0x37')][_0x65ec('0x180')](_0x4a5627['digits'][_0x65ec('0x58')](/\s+/g,''),_0x4a5627[_0x65ec('0x178')]);};AGIVertices[_0x65ec('0xd')]['saynumber']=function(_0x2e7dab){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x181'),_0x2e7dab['label']));return this[_0x65ec('0x37')][_0x65ec('0x182')](_0x2e7dab[_0x65ec('0x67')]['replace'](/\s+/g,''),_0x2e7dab[_0x65ec('0x178')]);};AGIVertices[_0x65ec('0xd')]['sayphonetic']=function(_0x495f92){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x183'),_0x495f92[_0x65ec('0xa8')]));return this[_0x65ec('0x37')][_0x65ec('0x184')](_0x495f92[_0x65ec('0x5c')],_0x495f92[_0x65ec('0x178')]);};AGIVertices[_0x65ec('0xd')][_0x65ec('0x185')]=function(_0x55072e){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x186'),_0x55072e['label']));if(!this[_0x65ec('0x84')](_0x55072e[_0x65ec('0x187')])){return this[_0x65ec('0x37')]['noop']('no\x20mail\x20account\x20configured');}var _0x1e7f89=this[_0x65ec('0x21')][_0x65ec('0x70')](this,_0x55072e[_0x65ec('0x187')]);if(!_0x1e7f89||!_0x1e7f89['Smtp']){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x55072e,_0x65ec('0x188'));}var _0x525a39={'from':util[_0x65ec('0x29')](_0x65ec('0x189'),_0x1e7f89[_0x65ec('0x13')],_0x1e7f89['email']||_0x1e7f89['Smtp'][_0x65ec('0x18a')]),'to':_0x55072e['to']||'','cc':_0x55072e['cc']||'','bcc':_0x55072e[_0x65ec('0x18b')]||'','subject':_0x55072e[_0x65ec('0x18c')],'html':_0x55072e[_0x65ec('0x5c')],'text':_0x55072e[_0x65ec('0x5c')]};if(this[_0x65ec('0x84')](_0x55072e['template_id'])){}logger[_0x65ec('0x18d')]('sendMail\x20message',JSON[_0x65ec('0x73')](_0x525a39));this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x55072e,_0x55072e[_0x65ec('0x187')]);this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x18e'),_0x1e7f89['name']));this[_0x65ec('0x22')][_0x65ec('0x70')](this,_0x1e7f89['smtpOptions'],_0x525a39);return this['channel'][_0x65ec('0xa9')](_0x65ec('0x18f'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x190')]=function(_0xcb9fc1){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x191'),_0xcb9fc1['label']));return this['channel'][_0x65ec('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x65ec('0xd')][_0x65ec('0x192')]=function(_0x4d93ac){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x193'),_0x4d93ac[_0x65ec('0xa8')]));if(!this['isConfigured'](_0x4d93ac[_0x65ec('0x194')])){return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x195'));}var _0x42a8e6=this[_0x65ec('0x34')]['sync'](this,_0x4d93ac[_0x65ec('0x194')]);if(!_0x42a8e6){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x4d93ac,_0x65ec('0x196'));}var _0x526294={'body':_0x4d93ac[_0x65ec('0x197')],'phone':_0x4d93ac['to']||'','SmsAccountId':_0x42a8e6['id']};logger[_0x65ec('0x18d')](_0x65ec('0x198'),JSON[_0x65ec('0x73')](_0x526294));this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x4d93ac,_0x4d93ac['sms_account_id']);this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x199'),_0x42a8e6['name']));this[_0x65ec('0x35')][_0x65ec('0x70')](this,_0x526294);return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x19a'));};AGIVertices[_0x65ec('0xd')]['set']=function(_0x4eafe2){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x19b'),_0x4eafe2[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x4eafe2[_0x65ec('0xd9')])){return this['channel'][_0x65ec('0x32')](_0x4eafe2,'no\x20variable\x20selected');}var _0x4612f7=this[_0x65ec('0xe')][_0x65ec('0x70')](this,_0x4eafe2['variable_id']);if(!_0x4612f7){return this[_0x65ec('0x37')]['error'](_0x4eafe2,_0x65ec('0xda'));}return this[_0x65ec('0x37')][_0x65ec('0x9c')](_0x4612f7,_0x4eafe2['variable_value']);};AGIVertices['prototype'][_0x65ec('0x19c')]=function(_0x36831e){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x36831e[_0x65ec('0xa8')]));this[_0x65ec('0x37')]['noop'](_0x65ec('0x19d'));if(_0x36831e[_0x65ec('0xb6')]===_0x65ec('0x19e')){this['channel'][_0x65ec('0xa9')]('Answer');return this[_0x65ec('0x37')][_0x65ec('0xb6')]();}return this[_0x65ec('0x37')][_0x65ec('0xa9')](_0x65ec('0x19f'));};AGIVertices[_0x65ec('0xd')]['subproject']=function(_0x24c99a){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x1a0'),_0x24c99a['label']));if(!this[_0x65ec('0x84')](_0x24c99a[_0x65ec('0x1a1')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x24c99a,_0x65ec('0x1a2'));}var _0x61b8bf=this[_0x65ec('0x14')]['sync'](this,_0x24c99a['project_id']);if(!this[_0x65ec('0x84')](_0x61b8bf)){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x24c99a,util[_0x65ec('0x29')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x24c99a[_0x65ec('0x1a1')]));}if(_0x61b8bf===this[_0x65ec('0x37')][_0x65ec('0x39')]){return this['channel']['error'](_0x24c99a,_0x65ec('0x1a3'));}this['createSquareDetailsReport'][_0x65ec('0x70')](this,_0x24c99a,_0x61b8bf);var _0x487fff=this['channel'][_0x65ec('0x56')](_0x65ec('0x1a4'),util[_0x65ec('0x29')](_0x65ec('0x1a5'),config[_0x65ec('0xb2')][_0x65ec('0x1a6')]||_0x65ec('0x1a7'),_0x61b8bf,this[_0x65ec('0x37')][_0x65ec('0x39')]));if(_0x487fff['result']===-0x1){return _0x487fff;}return this['channel'][_0x65ec('0xa9')](util['format'](_0x65ec('0x16a'),_0x65ec('0x1a4'),_0x61b8bf));};AGIVertices['prototype']['system']=function(_0x4fb8f8){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x1a8'),_0x4fb8f8[_0x65ec('0xa8')]));var _0x303dbc=this[_0x65ec('0x1a9')][_0x65ec('0x70')](this,_0x4fb8f8[_0x65ec('0xb4')]);this[_0x65ec('0x36')][_0x65ec('0x70')](this,_0x4fb8f8,_0x4fb8f8[_0x65ec('0xb4')]);if(this[_0x65ec('0x84')](_0x4fb8f8[_0x65ec('0xd9')])){var _0x2e1347=this[_0x65ec('0xe')][_0x65ec('0x70')](this,_0x4fb8f8['variable_id']);if(_0x2e1347){this[_0x65ec('0x37')][_0x65ec('0x9c')](_0x2e1347,_0x303dbc);return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x1aa'),_0x4fb8f8[_0x65ec('0xb4')],_0x2e1347));}}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x1ab'),_0x4fb8f8[_0x65ec('0xb4')]));};AGIVertices[_0x65ec('0xd')]['google_cloud_tts']=function(_0x5c4319){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x1ac'),_0x5c4319[_0x65ec('0xa8')]));_0x5c4319[_0x65ec('0x5c')]=_0x5c4319[_0x65ec('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x65ec('0x84')](_0x5c4319[_0x65ec('0x5a')])){return this['channel'][_0x65ec('0xa9')](_0x65ec('0x1ad'));}if(!this[_0x65ec('0x84')](_0x5c4319[_0x65ec('0x5c')])){return this[_0x65ec('0x37')]['noop'](_0x65ec('0xaa'));}this[_0x65ec('0x37')]['noop'](util[_0x65ec('0x29')](_0x65ec('0x1ae'),_0x5c4319['text']));var _0x46e0f4=this['googleCloudTTS']['sync'](this,_0x5c4319);if(_0x46e0f4){this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format'](_0x65ec('0x1af'),_0x46e0f4));var _0x420f50=this['channel']['streamFile'](_0x46e0f4);try{fs['unlink'](_0x46e0f4+_0x65ec('0x103'));}catch(_0x18d26e){logger[_0x65ec('0x32')](_0x18d26e);}return _0x420f50;}return this['channel']['error'](_0x5c4319,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x65ec('0xd')][_0x65ec('0x1b0')]=function(_0x50b649){logger[_0x65ec('0x2d')](util['format'](_0x65ec('0x1b1'),_0x50b649[_0x65ec('0xa8')]));_0x50b649[_0x65ec('0x5c')]=_0x50b649[_0x65ec('0x5c')][_0x65ec('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x65ec('0x84')](_0x50b649['text'])){return this['channel'][_0x65ec('0xa9')](_0x65ec('0xaa'));}this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x1b2'),_0x50b649['text']));var _0x936d73=this['googleTTS'][_0x65ec('0x70')](this,_0x50b649);if(_0x936d73){this['channel'][_0x65ec('0xa9')](util[_0x65ec('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x936d73));var _0x3e2942=this[_0x65ec('0x37')][_0x65ec('0x152')](_0x936d73);try{fs['unlink'](_0x936d73+'.wav');}catch(_0x2378ac){logger[_0x65ec('0x32')](_0x2378ac);}return _0x3e2942;}return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x50b649,_0x65ec('0x1b3'));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x1b4')]=function(_0x45d378){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x1b5'),_0x45d378[_0x65ec('0xa8')]));if(!this[_0x65ec('0x84')](_0x45d378[_0x65ec('0x156')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0x45d378,_0x65ec('0x15d'));}logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x157'),this[_0x65ec('0x37')]['callerid'],_0x45d378[_0x65ec('0x156')]));var _0x4e1b96=this['agentUnpause'][_0x65ec('0x70')](this,_0x45d378[_0x65ec('0x156')]);if(_0x4e1b96){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x158'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x45d378[_0x65ec('0x156')]));this[_0x65ec('0x37')][_0x65ec('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x45d378['findBy']));return{'code':0xc8,'result':_0x65ec('0x159')};}else{logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x15a'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x45d378[_0x65ec('0x156')]));this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x15a'),this[_0x65ec('0x37')][_0x65ec('0x3a')],_0x45d378['findBy']));return{'code':0xc8,'result':_0x65ec('0x15b')};}};AGIVertices[_0x65ec('0xd')]['voicemail']=function(_0x41c943){logger[_0x65ec('0x2d')](util[_0x65ec('0x29')](_0x65ec('0x1b6'),_0x41c943[_0x65ec('0xa8')]));var _0x3dc0df=this[_0x65ec('0x37')][_0x65ec('0x56')](_0x65ec('0x1b7'),[_0x41c943[_0x65ec('0x1b8')],_0x41c943[_0x65ec('0x79')]]);if(_0x3dc0df['result']===-0x1){return _0x3dc0df;}return this[_0x65ec('0x37')][_0x65ec('0xa9')](util[_0x65ec('0x29')](_0x65ec('0x16a'),_0x65ec('0x1b7'),_0x41c943[_0x65ec('0x1b8')]));};AGIVertices[_0x65ec('0xd')][_0x65ec('0x1b9')]=function(_0xa086ee){logger['info'](util[_0x65ec('0x29')](_0x65ec('0x1ba'),_0xa086ee[_0x65ec('0xa8')]));if(!this['isConfigured'](_0xa086ee[_0x65ec('0xd9')])){return this[_0x65ec('0x37')][_0x65ec('0x32')](_0xa086ee,_0x65ec('0x1bb'));}var _0x2b3185=this[_0x65ec('0xe')][_0x65ec('0x70')](this,_0xa086ee['variable_id']);if(!_0x2b3185){return this['channel'][_0x65ec('0x32')](_0xa086ee,_0x65ec('0xda'));}var _0x3c6132=this[_0x65ec('0x37')][_0x65ec('0xe')](_0x2b3185);return{'code':0xc8,'result':_0x3c6132['extra']?_0x3c6132['extra']:'-'};};String[_0x65ec('0xd')][_0x65ec('0x9f')]=function(_0x3c9b8d,_0x2c0cab){return this[_0x65ec('0x9e')](_0x3c9b8d)[_0x65ec('0x1bc')](_0x2c0cab);};module[_0x65ec('0x1bd')]=AGIVertices; \ No newline at end of file +var _0x570f=['An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','dialogflowV2_language','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','getIntervals','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','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','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','success','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','getdigits','channel','rpc','mailRpc','prototype','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','render','stringify'];(function(_0x2df052,_0xd386){var _0x2b1c98=function(_0x55cf2d){while(--_0x55cf2d){_0x2df052['push'](_0x2df052['shift']());}};_0x2b1c98(++_0xd386);}(_0x570f,0x152));var _0xf570=function(_0x253b37,_0xdb7ae0){_0x253b37=_0x253b37-0x0;var _0x24b147=_0x570f[_0x253b37];return _0x24b147;};'use strict';var fs=require('fs');var util=require(_0xf570('0x0'));var _=require(_0xf570('0x1'));var sh=require(_0xf570('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xf570('0x3'));var Mustache=require(_0xf570('0x4'));var rp=require(_0xf570('0x5'));var logger=require(_0xf570('0x6'))(_0xf570('0x7'));var config=require(_0xf570('0x8'));var shared=require(_0xf570('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xf570('0xa');var recursiveMapAttributes=['rawHeaders',_0xf570('0xb')];var verticesWithRetry=['menu',_0xf570('0xc'),'getsecretdigits'];var AGIVertices=function(_0x350a32,_0x49b42f,_0x19bee1){this[_0xf570('0xd')]=_0x350a32;this[_0xf570('0xe')]=_0x49b42f;this[_0xf570('0xf')]=_0x19bee1;};AGIVertices[_0xf570('0x10')]['getVariable']=function(_0x46e6dd,_0xe4d52d){this[_0xf570('0xe')]['getVariableById'](_0x46e6dd)[_0xf570('0x11')](function(_0x3c689c){_0xe4d52d(null,_0x3c689c?_0x3c689c[_0xf570('0x12')]:![]);})['catch'](function(_0x32e0b0){_0xe4d52d(_0x32e0b0);});};AGIVertices[_0xf570('0x10')][_0xf570('0x13')]=function(_0x5242d6,_0x4c6917){this[_0xf570('0xe')][_0xf570('0x14')](_0x5242d6)[_0xf570('0x11')](function(_0x38d03e){_0x4c6917(null,_0x38d03e?_0x38d03e[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x2531f9){_0x4c6917(_0x2531f9);});};AGIVertices[_0xf570('0x10')][_0xf570('0x16')]=function(_0x43e760,_0x46a3aa){this['rpc'][_0xf570('0x17')](_0x43e760)[_0xf570('0x11')](function(_0x23aa99){_0x46a3aa(null,_0x23aa99?_0x23aa99[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x5cde47){_0x46a3aa(_0x5cde47);});};AGIVertices[_0xf570('0x10')][_0xf570('0x18')]=function(_0x29c3f4,_0x4e2649){this[_0xf570('0xe')][_0xf570('0x19')](_0x29c3f4)[_0xf570('0x11')](function(_0x1a3e91){_0x4e2649(null,_0x1a3e91?_0x1a3e91['dsn']:![]);})[_0xf570('0x15')](function(_0xd2058e){_0x4e2649(_0xd2058e);});};AGIVertices[_0xf570('0x10')][_0xf570('0x1a')]=function(_0x2488bd,_0x570703){this[_0xf570('0xe')][_0xf570('0x1b')](_0x2488bd)[_0xf570('0x11')](function(_0x1151d1){_0x570703(null,_0x1151d1?_0x1151d1['name']:![]);})[_0xf570('0x15')](function(_0x40c4f1){_0x570703(_0x40c4f1);});};AGIVertices[_0xf570('0x10')][_0xf570('0x1c')]=function(_0x45cb29,_0x210425){this['rpc'][_0xf570('0x1d')](_0x45cb29)[_0xf570('0x11')](function(_0x2a8701){_0x210425(null,_0x2a8701?_0x2a8701[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x268be7){_0x210425(_0x268be7);});};AGIVertices[_0xf570('0x10')][_0xf570('0x1e')]=function(_0xdf8fae,_0x33a603){var _0x2278b8=this;this[_0xf570('0xe')]['getSoundById'](_0xdf8fae)['then'](function(_0x2eece8){_0x33a603(null,_0x2eece8?_0x2278b8[_0xf570('0x1f')](_0x2eece8[_0xf570('0x20')]):![]);})[_0xf570('0x15')](function(_0x170eca){_0x33a603(_0x170eca);});};AGIVertices[_0xf570('0x10')][_0xf570('0x21')]=function(_0x204f06,_0x951c82){this['rpc'][_0xf570('0x22')](_0x204f06)['then'](function(_0x474faa){_0x951c82(null,_0x474faa?_0x474faa:![]);})[_0xf570('0x15')](function(_0x23ada6){_0x951c82(_0x23ada6);});};AGIVertices['prototype'][_0xf570('0x23')]=function(_0x3c1a25,_0x59c756,_0x422767){this['mailRpc'][_0xf570('0x23')](_0x3c1a25,_0x59c756)[_0xf570('0x11')](function(){_0x422767(null);})[_0xf570('0x15')](function(_0x2f21f6){_0x422767(_0x2f21f6);});};AGIVertices['prototype']['getIntervals']=function(_0x17ddf9,_0x3b1a68){this[_0xf570('0xe')][_0xf570('0x24')](_0x17ddf9)[_0xf570('0x11')](function(_0x5edb32){if(_0x5edb32){if(_0x5edb32[_0xf570('0x25')]){_0x3b1a68(null,[_0x5edb32['interval']]);}else{_0x3b1a68(null,_['map'](_0x5edb32['Intervals'],_0xf570('0x26')));}}else{_0x3b1a68(null,![]);}})['catch'](function(_0x196ac7){_0x3b1a68(_0x196ac7);});};AGIVertices[_0xf570('0x10')]['getSoundPath']=function(_0x4a9df0){return util[_0xf570('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x4a9df0);};AGIVertices['prototype'][_0xf570('0x28')]=function(_0x4ee429,_0x533291,_0x58b3d2){odbc[_0xf570('0x29')](_0x4ee429,function(_0x4120e9){if(_0x4120e9){logger[_0xf570('0x2a')](_0xf570('0x2b'),_0x4120e9);_0x58b3d2(_0x4120e9);}else{logger[_0xf570('0x2c')](_0xf570('0x2d'));odbc[_0xf570('0x2e')](_0x533291,function(_0x1af395,_0x27e956){if(_0x1af395){logger[_0xf570('0x2c')](_0xf570('0x2f'),_0x533291);_0x58b3d2(_0x1af395);}else{logger[_0xf570('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x533291);odbc[_0xf570('0x30')](function(_0x404d8f){if(_0x404d8f){logger[_0xf570('0x2a')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x404d8f);}_0x58b3d2(null,_0x27e956);});}});}});};AGIVertices[_0xf570('0x10')][_0xf570('0x31')]=function(_0x22b201,_0x1b2f1d){this[_0xf570('0xe')][_0xf570('0x32')](_0x22b201)[_0xf570('0x11')](function(_0x3ae19e){_0x1b2f1d(null,_0x3ae19e?_0x3ae19e:![]);})[_0xf570('0x15')](function(_0x1164f3){_0x1b2f1d(_0x1164f3);});};AGIVertices[_0xf570('0x10')][_0xf570('0x33')]=function(_0x3f2cfd,_0x4bab28){this[_0xf570('0xe')][_0xf570('0x33')](_0x3f2cfd)['then'](function(_0x851844){_0x4bab28(null,_0x851844);})[_0xf570('0x15')](function(_0x436689){_0x4bab28(_0x436689);});};AGIVertices[_0xf570('0x10')][_0xf570('0x34')]=function(_0xabf891,_0x4a337,_0x5cbfb3){this[_0xf570('0xe')][_0xf570('0x34')]({'uniqueid':this[_0xf570('0xd')][_0xf570('0x35')],'node':_0xabf891[_0xf570('0x36')],'application':_0xabf891[_0xf570('0x37')],'data':_0x4a337||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xf570('0xd')][_0xf570('0x38')]})[_0xf570('0x11')](function(_0x81e6ca){if(_0x5cbfb3){_0x5cbfb3(null,_0x81e6ca);}})['catch'](function(_0x1d199f){if(_0x5cbfb3){_0x5cbfb3(_0x1d199f);}});};AGIVertices[_0xf570('0x10')][_0xf570('0x39')]=function(_0x4cf025,_0x3a74c9,_0x548eb0,_0x863f87){this[_0xf570('0xe')][_0xf570('0x39')]({'uniqueid':this[_0xf570('0xd')][_0xf570('0x35')],'callerid':this[_0xf570('0xd')][_0xf570('0x38')],'calleridname':this[_0xf570('0xd')]['calleridname'],'context':this['channel'][_0xf570('0x3a')],'extension':this['channel'][_0xf570('0x3b')],'priority':this[_0xf570('0xd')][_0xf570('0x3c')],'accountcode':this[_0xf570('0xd')][_0xf570('0x3d')],'dnid':this[_0xf570('0xd')][_0xf570('0x3e')],'projectName':this[_0xf570('0xd')][_0xf570('0x3f')],'saveName':_0x3a74c9,'filename':_0x4cf025['file']||_0x3a74c9,'savePath':_0x548eb0})[_0xf570('0x11')](function(_0x5b9858){_0x863f87(null,_0x5b9858);})[_0xf570('0x15')](function(_0x53d9fb){_0x863f87(_0x53d9fb);});};AGIVertices[_0xf570('0x10')]['createSquareMessage']=function(_0x4d2d28,_0x144da0,_0x598848,_0x406949,_0x4b2295){this['rpc'][_0xf570('0x40')]({'uniqueid':this[_0xf570('0xd')][_0xf570('0x35')],'body':_0x4d2d28,'direction':_0x144da0,'providerName':_0x598848,'providerResponse':_0x406949})[_0xf570('0x11')](function(_0x2d1f3e){if(_0x4b2295){_0x4b2295(null,_0x2d1f3e);}})['catch'](function(_0x3c2aef){if(_0x4b2295){_0x4b2295(_0x3c2aef);}});};AGIVertices[_0xf570('0x10')]['createCmContact']=function(_0x2050a1,_0x4d442d){this[_0xf570('0xe')][_0xf570('0x41')]({'firstName':_[_0xf570('0x42')](_0x2050a1[_0xf570('0x12')])||_[_0xf570('0x43')](_0x2050a1['name'])?'callback_'+Math[_0xf570('0x44')]():_0x2050a1[_0xf570('0x12')],'lastName':_[_0xf570('0x42')](_0x2050a1[_0xf570('0x45')])||_['isNil'](_0x2050a1[_0xf570('0x45')])?null:_0x2050a1['lastName'],'phone':_0x2050a1[_0xf570('0x46')],'ListId':_0x2050a1[_0xf570('0x47')],'scheduledat':_0x2050a1[_0xf570('0x48')],'callbackUniqueid':this[_0xf570('0xd')]['uniqueid'],'tags':_0xf570('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x2050a1['scheduledAt'][_0xf570('0x4a')](),'priority':_0x2050a1['callback_priority']})['then'](function(_0xb93df3){_0x4d442d(null,_0xb93df3);})[_0xf570('0x15')](function(_0x4db669){_0x4d442d(_0x4db669);});};AGIVertices[_0xf570('0x10')][_0xf570('0x4b')]=function(_0x537319,_0x31aa0f){this['rpc'][_0xf570('0x4c')](_0x537319)[_0xf570('0x11')](function(_0x1f4752){_0x31aa0f(null,_0x1f4752?_0x1f4752[_0xf570('0x12')]:![]);})[_0xf570('0x15')](function(_0x512b0b){_0x31aa0f(_0x512b0b);});};AGIVertices[_0xf570('0x10')][_0xf570('0x4d')]=function(_0x535b31,_0xef9b59,_0x4e595e){var _0x4333d0={'role':_0xf570('0x4e')};_0x4333d0[_0x535b31]=this['channel'][_0xf570('0x38')];this['rpc'][_0xf570('0x4d')](_0x4333d0,_0xef9b59,this[_0xf570('0xd')][_0xf570('0x35')])[_0xf570('0x11')](function(_0x7eb8b1){_0x4e595e(null,_[_0xf570('0x43')](_0x7eb8b1)?![]:!![]);})['catch'](function(_0x5a49c8){logger['error'](_0x5a49c8);_0x4e595e(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0xe9ac6e,_0x4158ac){var _0x46da28={'role':'agent'};_0x46da28[_0xe9ac6e]=this[_0xf570('0xd')][_0xf570('0x38')];this[_0xf570('0xe')][_0xf570('0x4f')](_0x46da28)['then'](function(_0x3d7f3d){_0x4158ac(null,_[_0xf570('0x43')](_0x3d7f3d)?![]:!![]);})[_0xf570('0x15')](function(_0x5380a4){logger['error'](_0x5380a4);_0x4158ac(null,![]);});};AGIVertices[_0xf570('0x10')][_0xf570('0x50')]=function(_0x4d46cc,_0x11c1d4){var _0x4efc54={'role':'agent'};_0x4efc54[_0x4d46cc]=this['channel']['callerid'];this[_0xf570('0xe')]['agentLogout'](_0x4efc54)[_0xf570('0x11')](function(_0x418893){_0x11c1d4(null,_[_0xf570('0x43')](_0x418893)?![]:!![]);})['catch'](function(_0x36d8e0){logger[_0xf570('0x2a')](_0x36d8e0);_0x11c1d4(null,![]);});};AGIVertices['prototype'][_0xf570('0x51')]=function(_0x12becd,_0x22c8d9){var _0x57df8b={'role':_0xf570('0x4e')};_0x57df8b[_0x12becd]=this[_0xf570('0xd')][_0xf570('0x38')];var _0x275151=_0x12becd!=_0xf570('0x52')?util[_0xf570('0x27')](_0xf570('0x53'),_0xf570('0x54'),this['channel'][_0xf570('0x38')]):undefined;this[_0xf570('0xe')][_0xf570('0x51')](_0x57df8b,_0x275151)[_0xf570('0x11')](function(_0x5135d4){_0x22c8d9(null,_[_0xf570('0x43')](_0x5135d4)?![]:!![]);})[_0xf570('0x15')](function(_0x57683b){logger[_0xf570('0x2a')](_0x57683b);_0x22c8d9(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x5b0abd,_0x172c88){sh[_0xf570('0x55')](_[_0xf570('0x56')](_0x5b0abd),function(_0x17cf44,_0x12df8a){var _0x2106bc=_0x12df8a[_0xf570('0x57')](/(\r\n|\n|\r)/gm,'');_0x172c88(null,_0x2106bc);});};AGIVertices['prototype'][_0xf570('0x58')]=function(_0x5c1372,_0x1adb8a){scripts[_0xf570('0x58')](_0x5c1372[_0xf570('0x59')],_0x5c1372['google_cloud_tts_text_type']||'text',_0x5c1372[_0xf570('0x5a')],_0x5c1372[_0xf570('0x5b')]||_0xf570('0x5c'),_0x5c1372[_0xf570('0x5d')]||_0xf570('0x5e'),_0x5c1372['audioEncoding']||_0xf570('0x5f'))[_0xf570('0x11')](function(_0x2800af){_0x1adb8a(null,_0x2800af);})[_0xf570('0x15')](function(_0x193cb9){_0x1adb8a(_0x193cb9);});};AGIVertices['prototype']['googleTTS']=function(_0x43be69,_0x35b470){scripts['googleTTS'](_0x43be69[_0xf570('0x5a')],_0x43be69[_0xf570('0x60')]||'en',0x1)[_0xf570('0x11')](function(_0x569d79){_0x35b470(null,_0x569d79);})[_0xf570('0x15')](function(_0xa73978){_0x35b470(_0xa73978);});};AGIVertices['prototype'][_0xf570('0x61')]=function(_0x317dd3,_0xfa55e){var _0x4b3118={'uri':_0x317dd3[_0xf570('0x62')],'method':_0x317dd3[_0xf570('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x317dd3[_0xf570('0x64')])===_0xf570('0x65')&&parseInt(_0x317dd3[_0xf570('0x64')])>=0x1?parseInt(_0x317dd3['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xf570('0x66')]([_0xf570('0x67'),_0xf570('0x68')],_0x4b3118[_0xf570('0x63')][_0xf570('0x69')]())){try{_0x4b3118[_0xf570('0x6a')]=_0x317dd3[_0xf570('0xb')]?JSON[_0xf570('0x6b')](_0x317dd3[_0xf570('0xb')]):{};}catch(_0x58cbcf){logger[_0xf570('0x2a')](_0xf570('0x6c'),_0x58cbcf);}}try{_0x4b3118[_0xf570('0x6d')]=_0x317dd3[_0xf570('0x6e')]?JSON[_0xf570('0x6b')](_0x317dd3['rawHeaders']):{};}catch(_0x5bbe77){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5bbe77);}if(_0x317dd3[_0xf570('0x6f')]){try{var _0x127303=require(_0x317dd3[_0xf570('0x6f')])[_0xf570('0x70')](this,_0x4b3118);_0x4b3118['uri']=Mustache[_0xf570('0x71')](_0x317dd3['url'],_0x127303,{},['$$','$$']);if(_0x4b3118[_0xf570('0x6d')]){_0x4b3118[_0xf570('0x6d')]=JSON[_0xf570('0x6b')](Mustache[_0xf570('0x71')](JSON[_0xf570('0x72')](_0x4b3118[_0xf570('0x6d')]),_0x127303,{},['$$','$$']));}if(_0x4b3118['body']){_0x4b3118[_0xf570('0x6a')]=JSON[_0xf570('0x6b')](Mustache[_0xf570('0x71')](JSON[_0xf570('0x72')](_0x4b3118[_0xf570('0x6a')]),_0x127303,{},['$$','$$']));}}catch(_0x8591d7){logger[_0xf570('0x2a')](_0xf570('0x73'),_0x8591d7);}}rp(_0x4b3118)['then'](function(_0x1bf5b9){var _0xa1f33a={'statusCode':_0x1bf5b9['statusCode']||0xc8,'statusMessage':_0x1bf5b9['statusMessage']||'OK','headers':_0x1bf5b9['headers']||{},'body':_0x1bf5b9[_0xf570('0x6a')]||{}};_0xfa55e(null,_0xa1f33a);})[_0xf570('0x15')](function(_0x30c54d){var _0x2b24da={'statusCode':_0x30c54d['statusCode']||0x1f4,'statusMessage':_0x30c54d[_0xf570('0x74')]||_0xf570('0x75'),'headers':_0x30c54d[_0xf570('0x76')][_0xf570('0x6d')]||{},'body':_0x30c54d['options'][_0xf570('0x6a')]||{}};_0xfa55e(null,_0x2b24da);});};AGIVertices[_0xf570('0x10')][_0xf570('0x77')]=function(_0x3d76b2,_0xc1e6f){scripts[_0xf570('0x77')](this['channel'][_0xf570('0x35')],_0x3d76b2[_0xf570('0x78')],_0x3d76b2[_0xf570('0x5a')],_0x3d76b2['dialogflow_language']||'en')['then'](function(_0x3fd265){_0xc1e6f(null,_0x3fd265);})[_0xf570('0x15')](function(_0x143a92){_0xc1e6f(_0x143a92);});};AGIVertices[_0xf570('0x10')][_0xf570('0x79')]=function(_0x3c69b6,_0x247123){scripts[_0xf570('0x79')](this[_0xf570('0xd')][_0xf570('0x35')],_0x3c69b6[_0xf570('0x7a')],_0x3c69b6['client_email'],_0x3c69b6['private_key'],_0x3c69b6[_0xf570('0x5a')],_0x3c69b6['dialogflowV2_language']||'en')[_0xf570('0x11')](function(_0xe414e7){_0x247123(null,_0xe414e7);})[_0xf570('0x15')](function(_0x2d96db){_0x247123(_0x2d96db);});};AGIVertices[_0xf570('0x10')][_0xf570('0x7b')]=function(_0x5f4af3,_0x3053b2){scripts[_0xf570('0x7b')](this['channel'],_0x5f4af3)[_0xf570('0x11')](function(_0x2ef7c4){_0x3053b2(null,_0x2ef7c4);})[_0xf570('0x15')](function(_0x422194){_0x3053b2(_0x422194);});};AGIVertices[_0xf570('0x10')][_0xf570('0x7c')]=function(_0x2c55e8,_0x5b4f62){scripts[_0xf570('0x7c')](_0x2c55e8[_0xf570('0x78')],_0x2c55e8['text'],_0x2c55e8[_0xf570('0x7d')]||_0xf570('0x5c'),_0x2c55e8[_0xf570('0x7e')])[_0xf570('0x11')](function(_0x48f2d6){_0x5b4f62(null,_0x48f2d6);})[_0xf570('0x15')](function(_0x4f9587){_0x5b4f62(_0x4f9587);});};AGIVertices[_0xf570('0x10')][_0xf570('0x7f')]=function(_0x530347,_0x3f0fc9,_0x5bf82a){scripts[_0xf570('0x7f')](_0x3f0fc9,_0x530347['key'],_0x530347[_0xf570('0x80')]||'en-US',this[_0xf570('0x81')](_0x530347[_0xf570('0x82')])?_0x530347['model']:undefined)[_0xf570('0x11')](function(_0x354b04){_0x5bf82a(null,_0x354b04);})[_0xf570('0x15')](function(_0x2c57bb){_0x5bf82a(_0x2c57bb);});};AGIVertices[_0xf570('0x10')][_0xf570('0x83')]=function(_0x39d9cc,_0x53811c){scripts['awsPolly'](_0x39d9cc['aws_access_key_id'],_0x39d9cc[_0xf570('0x84')],_0x39d9cc['aws_polly_region'],_0x39d9cc['aws_polly_voice']||'Amy',_0x39d9cc['text'],_0x39d9cc[_0xf570('0x85')]||_0xf570('0x5a'))['then'](function(_0x1e0e6a){_0x53811c(null,_0x1e0e6a);})[_0xf570('0x15')](function(_0x441c22){_0x53811c(_0x441c22);});};AGIVertices['prototype']['awsLex']=function(_0x4b8a51,_0x1a74cc){scripts[_0xf570('0x86')](this[_0xf570('0xd')]['uniqueid'],_0x4b8a51[_0xf570('0x87')],_0x4b8a51[_0xf570('0x84')],_0x4b8a51[_0xf570('0x88')],_0x4b8a51['text'],_0x4b8a51[_0xf570('0x89')])[_0xf570('0x11')](function(_0xfdb7be){_0x1a74cc(null,_0xfdb7be);})[_0xf570('0x15')](function(_0x5db039){_0x1a74cc(_0x5db039);});};AGIVertices[_0xf570('0x10')][_0xf570('0x8a')]=function(_0xce1615,_0x1826e8,_0x4211c3){scripts[_0xf570('0x8a')](_0x1826e8,_0xce1615['key'],_0xce1615['google_asr_language']||_0xf570('0x5c'))[_0xf570('0x11')](function(_0x4c43e2){_0x4211c3(null,_0x4c43e2);})[_0xf570('0x15')](function(_0x508371){_0x4211c3(_0x508371);});};AGIVertices[_0xf570('0x10')][_0xf570('0x8b')]=function(_0x4cf38d,_0x584afc,_0x2a3c93){scripts[_0xf570('0x8b')](_0x584afc,_0x4cf38d[_0xf570('0x8c')],_0x4cf38d[_0xf570('0x8d')],_0x4cf38d[_0xf570('0x8e')])[_0xf570('0x11')](function(_0x33f5bc){_0x2a3c93(null,_0x33f5bc);})[_0xf570('0x15')](function(_0x27d204){_0x2a3c93(_0x27d204);});};AGIVertices['prototype'][_0xf570('0x8f')]=function(_0x19cfe0){var _0x2c4bc8=_[_0xf570('0x66')](verticesWithRetry,_0x19cfe0[_0xf570('0x37')])?_0x19cfe0:_['clone'](_0x19cfe0);for(var _0x2d16dd in _0x2c4bc8){if(_0x2c4bc8[_0xf570('0x90')](_0x2d16dd)){if(_0x2c4bc8[_0x2d16dd]&&_[_0xf570('0x91')](_0x2c4bc8[_0x2d16dd])){if(_[_0xf570('0x66')](recursiveMapAttributes,_0x2d16dd)){_0x2c4bc8[_0x2d16dd]=this[_0xf570('0x92')](_0x2c4bc8[_0x2d16dd]);}else{_0x2c4bc8[_0x2d16dd]=this[_0xf570('0x93')](_0x2c4bc8[_0x2d16dd]);}}}}return _0x2c4bc8;};AGIVertices[_0xf570('0x10')][_0xf570('0x94')]=function(_0x10c3bc){for(var _0x43422a in _0x10c3bc){if(_0x10c3bc['hasOwnProperty'](_0x43422a)){if(_['isPlainObject'](_0x10c3bc[_0x43422a])){this[_0xf570('0x94')](_0x10c3bc[_0x43422a]);}else if(_[_0xf570('0x95')](_0x10c3bc[_0x43422a])){for(var _0x25057c=0x0;_0x25057c<_0x10c3bc[_0x43422a][_0xf570('0x96')];_0x25057c++){this[_0xf570('0x94')](_0x10c3bc[_0x43422a][_0x25057c]);}}else if(_[_0xf570('0x91')](_0x10c3bc[_0x43422a])){_0x10c3bc[_0x43422a]=this['replaceAllVariables'](_0x10c3bc[_0x43422a]);}}}};AGIVertices['prototype'][_0xf570('0x97')]=function(_0x1eb18f,_0xe57970){for(var _0x6c1269 in _0x1eb18f){if(_0x1eb18f['hasOwnProperty'](_0x6c1269)){if(_[_0xf570('0x98')](_0x1eb18f[_0x6c1269])){if(!_[_0xf570('0x42')](_0x1eb18f[_0x6c1269])){this[_0xf570('0x97')](_0x1eb18f[_0x6c1269],util[_0xf570('0x27')]('%s.%s',_0xe57970,_0x6c1269));}}else if(_[_0xf570('0x95')](_0x1eb18f[_0x6c1269])){for(var _0xf4e6ca=0x0;_0xf4e6ca<_0x1eb18f[_0x6c1269]['length'];_0xf4e6ca++){this[_0xf570('0x97')](_0x1eb18f[_0x6c1269][_0xf4e6ca],util['format'](_0xf570('0x99'),_0xe57970,_0x6c1269+'['+_0xf4e6ca+']'));}}else{if(!_[_0xf570('0x43')](_0x1eb18f[_0x6c1269])){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('%s.%s',_0xe57970,_0x6c1269),_0x1eb18f[_0x6c1269]);}}}}};AGIVertices[_0xf570('0x10')][_0xf570('0x92')]=function(_0x320a7e){try{var _0x20af63=JSON[_0xf570('0x6b')](_0x320a7e);this['recursiveNodeIndex'](_0x20af63);return JSON['stringify'](_0x20af63);}catch(_0x1f44db){return this[_0xf570('0x93')](_0x320a7e);}};AGIVertices[_0xf570('0x10')]['replaceAllVariables']=function(_0x9fdfef){var _0x365310=_0x9fdfef[_0xf570('0x9b')]('{');for(var _0x40d916=0x1;_0x40d916<_0x365310['length'];_0x40d916+=0x1){var _0x2f5d66=_0x365310[_0x40d916][_0xf570('0x9b')]('}');if(_0x2f5d66['length']>0x1){_0x9fdfef=_0x9fdfef[_0xf570('0x9c')]('{'+_0x2f5d66[0x0]+'}',this[_0xf570('0xd')][_0xf570('0x9d')](_0x2f5d66[0x0])[_0xf570('0x9e')]||_0x2f5d66[0x0]);}}if(_0x365310[_0xf570('0x96')]===0x1){return _0x9fdfef['toString']();}return this[_0xf570('0x93')](_0x9fdfef);};AGIVertices[_0xf570('0x10')][_0xf570('0x9f')]=function(_0x7612f2,_0x1e4847){var _0x5b7144=this[_0xf570('0xd')][_0xf570('0x9d')](_0x7612f2);if(_0x5b7144[_0xf570('0xa0')]===-0x1){return _0x5b7144;}logger['info'](util[_0xf570('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1e4847,_0x5b7144[_0xf570('0x9e')]));return this['channel']['setVariable'](_0x1e4847,_0x5b7144['extra']);};AGIVertices[_0xf570('0x10')][_0xf570('0x81')]=function(_0x2b7dae){return _0x2b7dae&&_0x2b7dae!=='0'&&_0x2b7dae!=='-1'&&_0x2b7dae!=='';};AGIVertices['prototype'][_0xf570('0xa1')]=function(_0x7c7006){this[_0xf570('0x34')][_0xf570('0x70')](this,_0x7c7006,'-');_0x7c7006[_0xf570('0xa2')]=_0x7c7006['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf570('0x10')]['mrcpsynth']=function(_0x511591){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xa3'),_0x511591[_0xf570('0x36')]));if(!this['isConfigured'](_0x511591[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}var _0x2b061b='\x22'+_0x511591['text']+'\x22';if(this[_0xf570('0x81')](_0x511591['options'])){_0x2b061b+=','+_0x511591[_0xf570('0x76')];}var _0xcb9572=this[_0xf570('0xd')][_0xf570('0x55')](_0xf570('0xa6'),_0x2b061b);if(_0xcb9572['result']===-0x1){return _0xcb9572;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xa7'),_0x2b061b));};AGIVertices[_0xf570('0x10')][_0xf570('0xa8')]=function(_0x5d0fec){logger['info'](util[_0xf570('0x27')](_0xf570('0xa9'),_0x5d0fec[_0xf570('0x36')]));if(!this['isConfigured'](_0x5d0fec['grammar'])){return this[_0xf570('0xd')]['noop'](_0xf570('0xaa'));}var _0x81222f=_0x5d0fec['grammar'];if(this[_0xf570('0x81')](_0x5d0fec[_0xf570('0x76')])){_0x81222f+=','+_0x5d0fec['options'];}var _0x1d6da8=this['channel'][_0xf570('0x55')](_0xf570('0xab'),_0x81222f);if(_0x1d6da8[_0xf570('0xa0')]===-0x1){return _0x1d6da8;}var _0x57a156=this[_0xf570('0x9f')](_0xf570('0xac'),_0xf570('0xad'));if(_0x57a156[_0xf570('0xa0')]===-0x1){return _0x57a156;}var _0x308f02=this[_0xf570('0x9f')](_0xf570('0xae'),_0xf570('0xaf'));if(_0x308f02[_0xf570('0xa0')]===-0x1){return _0x308f02;}var _0x17919a=this['getAndSetVariable'](_0xf570('0xb0'),'MRCP_RECOG_INSTANCE');if(_0x17919a[_0xf570('0xa0')]===-0x1){return _0x17919a;}return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xb1'),_0x81222f));};AGIVertices[_0xf570('0x10')]['agi']=function(_0x3201ce){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3201ce[_0xf570('0x36')]));return this[_0xf570('0xd')][_0xf570('0x7')]([_0x3201ce[_0xf570('0xb2')],_0x3201ce[_0xf570('0xb3')]]);};AGIVertices[_0xf570('0x10')][_0xf570('0xb4')]=function(_0x24228d){logger['info'](util[_0xf570('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x24228d[_0xf570('0x36')]));if(this[_0xf570('0x81')](_0x24228d['timeout'])){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xb5'),_0x24228d[_0xf570('0x64')]));var _0x18afc=this['channel'][_0xf570('0xb6')](_0x24228d['timeout']);if(_0x18afc[_0xf570('0xa0')]===-0x1){return _0x18afc;}}return this[_0xf570('0xd')][_0xf570('0xb4')]();};AGIVertices['prototype'][_0xf570('0x49')]=function(_0x16a90c){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xb7'),_0x16a90c['label']));if(!this[_0xf570('0x81')](_0x16a90c['list_id'])){return this[_0xf570('0xd')]['error'](_0x16a90c,_0xf570('0xb8'));}_0x16a90c[_0xf570('0x48')]=moment();if(this[_0xf570('0x81')](_0x16a90c['delay'])){_0x16a90c['scheduledAt']=moment()[_0xf570('0xb9')](_0x16a90c['delay'],_0xf570('0xba'));}if(!this[_0xf570('0x81')](_0x16a90c['callback_priority'])){_0x16a90c[_0xf570('0xbb')]=0x2;}this['createCmContact'][_0xf570('0x70')](this,_0x16a90c);return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xbc'),_0x16a90c[_0xf570('0x46')],_0x16a90c['list_id'],_0x16a90c['scheduledAt']));};AGIVertices['prototype'][_0xf570('0xbd')]=function(_0x12e086){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xbe'),_0x12e086[_0xf570('0x36')]));var _0x39b09a=this[_0xf570('0xd')]['exec'](_0x12e086[_0xf570('0xbf')],_0x12e086[_0xf570('0x76')]);if(_0x39b09a['result']===-0x1){return _0x39b09a;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xc0'),_0x12e086[_0xf570('0xbf')],_0x12e086[_0xf570('0x76')]));};AGIVertices[_0xf570('0x10')][_0xf570('0xc1')]=function(_0x3b254c){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xc2'),_0x3b254c['label']));if(!this[_0xf570('0x81')](_0x3b254c[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}var _0x31e24a='\x22'+_0x3b254c['text']+'\x22';if(this[_0xf570('0x81')](_0x3b254c[_0xf570('0x76')])){_0x31e24a+=','+_0x3b254c[_0xf570('0x76')];}var _0x42d6aa=this[_0xf570('0xd')][_0xf570('0x55')](_0xf570('0xa6'),_0x31e24a);if(_0x42d6aa['result']===-0x1){return _0x42d6aa;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xa7'),_0x31e24a));};AGIVertices[_0xf570('0x10')][_0xf570('0xc3')]=function(_0x40cddb){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xc4'),_0x40cddb[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x40cddb[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}var _0xcd50f6='\x22'+_0x40cddb[_0xf570('0x5a')]+'\x22';if(this[_0xf570('0x81')](_0x40cddb[_0xf570('0x76')])){_0xcd50f6+=','+_0x40cddb[_0xf570('0x76')];}var _0x35fb09=this[_0xf570('0xd')]['exec'](_0xf570('0xa6'),_0xcd50f6);if(_0x35fb09[_0xf570('0xa0')]===-0x1){return _0x35fb09;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0xcd50f6));};AGIVertices[_0xf570('0x10')][_0xf570('0xc5')]=function(_0x5e7326){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xc6'),_0x5e7326[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5e7326[_0xf570('0xc7')])){return this[_0xf570('0xd')]['noop']('no\x20grammar\x20configured');}var _0x596e5e=_0x5e7326[_0xf570('0xc7')];if(this['isConfigured'](_0x5e7326[_0xf570('0x76')])){_0x596e5e+=','+_0x5e7326[_0xf570('0x76')];}var _0x5e4a27=this[_0xf570('0xd')]['exec'](_0xf570('0xab'),_0x596e5e);if(_0x5e4a27[_0xf570('0xa0')]===-0x1){return _0x5e4a27;}var _0xbf4363=this[_0xf570('0x9f')]('RECOG_CONFIDENCE()',_0xf570('0xc8'));if(_0xbf4363[_0xf570('0xa0')]===-0x1){return _0xbf4363;}var _0x4737ab=this['getAndSetVariable'](_0xf570('0xae'),_0xf570('0xc9'));if(_0x4737ab['result']===-0x1){return _0x4737ab;}var _0x568cd0=this[_0xf570('0x9f')](_0xf570('0xb0'),_0xf570('0xca'));if(_0x568cd0[_0xf570('0xa0')]===-0x1){return _0x568cd0;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xb1'),_0x596e5e));};AGIVertices[_0xf570('0x10')][_0xf570('0xcb')]=function(_0x421401){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xcc'),_0x421401['label']));if(!this[_0xf570('0x81')](_0x421401[_0xf570('0xc7')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xaa'));}var _0x30a964=_0x421401[_0xf570('0xc7')];if(this[_0xf570('0x81')](_0x421401[_0xf570('0x76')])){_0x30a964+=','+_0x421401[_0xf570('0x76')];}var _0x480777=this[_0xf570('0xd')][_0xf570('0x55')]('MRCPRecog',_0x30a964);if(_0x480777['result']===-0x1){return _0x480777;}var _0x15da0b=this[_0xf570('0x9f')](_0xf570('0xac'),_0xf570('0xcd'));if(_0x15da0b[_0xf570('0xa0')]===-0x1){return _0x15da0b;}var _0x2a2d47=this[_0xf570('0x9f')]('RECOG_INPUT()',_0xf570('0xce'));if(_0x2a2d47[_0xf570('0xa0')]===-0x1){return _0x2a2d47;}var _0x42045a=this[_0xf570('0x9f')](_0xf570('0xb0'),_0xf570('0xcf'));if(_0x42045a[_0xf570('0xa0')]===-0x1){return _0x42045a;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xb1'),_0x30a964));};AGIVertices[_0xf570('0x10')][_0xf570('0xd0')]=function(_0x28dfb9){logger[_0xf570('0x2c')](util['format'](_0xf570('0xd1'),_0x28dfb9[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x28dfb9[_0xf570('0xd2')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x28dfb9,'no\x20database\x20selected');}var _0x455e08=this[_0xf570('0x18')][_0xf570('0x70')](this,_0x28dfb9[_0xf570('0xd2')]);if(!_0x455e08){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x28dfb9,_0xf570('0xd3'));}if(!this[_0xf570('0x81')](_0x28dfb9[_0xf570('0x2e')])){return this['channel'][_0xf570('0x2a')](_0x28dfb9,_0xf570('0xd4'));}var _0xc70a04=_0x28dfb9[_0xf570('0x2e')][_0xf570('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xd5'),_0xc70a04));var _0x54aac0=this[_0xf570('0x28')][_0xf570('0x70')](this,_0x455e08,_0xc70a04);this[_0xf570('0x34')][_0xf570('0x70')](this,_0x28dfb9,_0xc70a04);if(!this[_0xf570('0x81')](_0x28dfb9[_0xf570('0xd6')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xd7'));}var _0x34b059=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x28dfb9[_0xf570('0xd6')]);if(!_0x34b059){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x28dfb9,_0xf570('0xd8'));}var _0xfecfd2=this;_0x54aac0['forEach'](function(_0x2823a6,_0x4ac239){Object[_0xf570('0xd9')](_0x2823a6)[_0xf570('0xda')](function(_0x4fdd50){_0xfecfd2[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('%s[%s][%s]',_0x34b059,_0x4ac239,_0x4fdd50),_0x2823a6[_0x4fdd50]);});});this['channel'][_0xf570('0x9a')](util['format'](_0xf570('0xdb'),_0x34b059),_0x54aac0[_0xf570('0x96')]);return this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0xdc'),_0x34b059));};AGIVertices['prototype'][_0xf570('0xdd')]=function(_0x3b8e24){logger[_0xf570('0xde')](util[_0xf570('0x27')](_0xf570('0xdf'),_0x3b8e24[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x3b8e24[_0xf570('0xe0')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x3b8e24,_0xf570('0xe1'));}var _0x17de57=this[_0xf570('0x1a')]['sync'](this,_0x3b8e24[_0xf570('0xe0')]);if(!_0x17de57){return this['channel'][_0xf570('0x2a')](_0x3b8e24,_0xf570('0xe2'));}var _0x103487=this['channel'][_0xf570('0x55')](_0xf570('0xe3'),[util[_0xf570('0x27')]('SIP/%s',_0x17de57),_0x3b8e24[_0xf570('0x64')],_0x3b8e24[_0xf570('0xe4')],_0x3b8e24['url']]);if(_0x103487[_0xf570('0xa0')]===-0x1){return _0x103487;}return this['channel'][_0xf570('0xa4')](util['format'](_0xf570('0xe5'),'DIAL'));};AGIVertices[_0xf570('0x10')]['dialogflow']=function(_0x58f9a0){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xe6'),_0x58f9a0['label']));if(!this[_0xf570('0x81')](_0x58f9a0[_0xf570('0x78')])){return this[_0xf570('0xd')]['noop'](_0xf570('0xe7'));}if(!this[_0xf570('0x81')](_0x58f9a0[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20text\x20configured');}this[_0xf570('0xd')][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x58f9a0);this['createSquareMessage'](_0x58f9a0[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xe9'),_0x58f9a0[_0xf570('0x5a')]));var _0x5923a0=this[_0xf570('0x77')][_0xf570('0x70')](this,_0x58f9a0);if(_0x5923a0){for(var _0x4cc196 in _0x5923a0){if(_0x5923a0['hasOwnProperty'](_0x4cc196)){this[_0xf570('0xd')][_0xf570('0x9a')](util['format']('DIALOGFLOW_%s',_0x4cc196['toUpperCase']()),_0x5923a0[_0x4cc196]);}}this[_0xf570('0x40')](_0x5923a0[_0xf570('0xea')],_0xf570('0xeb'),_0xf570('0xec'),'');return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('Dialogflow\x20Result\x20%s',_0x5923a0['speech']));}return this['channel'][_0xf570('0x2a')](_0x58f9a0,_0xf570('0xed'));};AGIVertices['prototype'][_0xf570('0xee')]=function(_0x5bfa1a){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5bfa1a[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0x7a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xef'));}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0xf0')])){return this['channel']['noop'](_0xf570('0xf1'));}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0xf2')])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20private_key\x20configured');}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0xf3')])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20anguage\x20configured');}if(!this[_0xf570('0x81')](_0x5bfa1a[_0xf570('0x5a')])){return this[_0xf570('0xd')]['noop'](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x5bfa1a);this[_0xf570('0x40')](_0x5bfa1a[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')][_0xf570('0xa4')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x5bfa1a[_0xf570('0x5a')]));var _0x3b82f0=this[_0xf570('0x79')]['sync'](this,_0x5bfa1a);if(_0x3b82f0){for(var _0x5cd73d in _0x3b82f0){if(_0x3b82f0[_0xf570('0x90')](_0x5cd73d)){if(_0x5cd73d!==_0xf570('0xf4')){this['channel'][_0xf570('0x9a')](util['format']('DIALOGFLOW_%s',_0x5cd73d[_0xf570('0x69')]()),_0x3b82f0[_0x5cd73d]);}}}this[_0xf570('0x40')](_0x3b82f0[_0xf570('0xea')],_0xf570('0xeb'),_0xf570('0xee'),_0x3b82f0[_0xf570('0xf4')]);return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xf5'),_0x3b82f0['speech']));}return this[_0xf570('0xd')][_0xf570('0x2a')](_0x5bfa1a,_0xf570('0xf6'));};AGIVertices[_0xf570('0x10')][_0xf570('0xf7')]=function(_0x3a963d){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0xf8'),_0x3a963d[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x3a963d['ndauth_url'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x3a963d[_0xf570('0xf9')])){return this['channel'][_0xf570('0xa4')](_0xf570('0xfa'));}if(!this[_0xf570('0x81')](_0x3a963d[_0xf570('0xfb')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xfc'));}if(!this[_0xf570('0x81')](_0x3a963d[_0xf570('0xfd')])){return this['channel'][_0xf570('0xa4')](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x3a963d);this[_0xf570('0x40')](_0x3a963d[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xfe'),_0x3a963d['text']));var _0x40afac=this[_0xf570('0x7b')][_0xf570('0x70')](this,_0x3a963d);if(_0x40afac){for(var _0x5d0f4c in _0x40afac){if(_0x40afac[_0xf570('0x90')](_0x5d0f4c)){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('SESTEK_NDA_%s',_0x5d0f4c[_0xf570('0x69')]()),_0x40afac[_0x5d0f4c]);}}this[_0xf570('0x40')](_0x40afac['speech'],'out',_0xf570('0xf7'),'');if(_0x40afac[_0xf570('0xff')]){this[_0xf570('0xd')]['noop'](util['format'](_0xf570('0x100'),_0x40afac['audiofile']));var _0x5c5154=this['channel'][_0xf570('0x101')](_0x40afac[_0xf570('0xff')]);try{fs['unlink'](_0x40afac['audiofile']+_0xf570('0x102'));}catch(_0x39f8e7){logger[_0xf570('0x2a')](_0x39f8e7);}return _0x5c5154;}else{return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x103'),_0x40afac[_0xf570('0xea')]));}}return this[_0xf570('0xd')]['error'](_0x3a963d,_0xf570('0x104'));};AGIVertices[_0xf570('0x10')][_0xf570('0x105')]=function(_0x3e3670){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x106'),_0x3e3670['label']));return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x105'));};AGIVertices[_0xf570('0x10')][_0xf570('0x107')]=function(_0x263922){logger[_0xf570('0x2c')](util['format'](_0xf570('0x108'),_0x263922[_0xf570('0x36')]));var _0x463d59='';if(_0x263922['trunk_id']){if(!this[_0xf570('0x81')](_0x263922[_0xf570('0x109')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x263922,_0xf570('0x10a'));}else{var _0xc63c1c=parseInt(_0x263922['trunk_id'],0xa);if(isNaN(_0xc63c1c)){_0x463d59=_0x263922[_0xf570('0x109')];}else{_0x463d59=this['getTrunk'][_0xf570('0x70')](this,_0x263922[_0xf570('0x109')]);if(!_0x463d59){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x263922,_0xf570('0x10b'));}}}}else if(_0x263922[_0xf570('0x10c')]){_0x463d59=_0x263922['trunk_name'];}else{return this[_0xf570('0xd')][_0xf570('0x2a')](_0x263922,_0xf570('0x10a'));}var _0x44c2ac=this['channel'][_0xf570('0x55')](_0xf570('0xe3'),[util[_0xf570('0x27')](_0xf570('0x10d'),_0x463d59,_0x263922[_0xf570('0x46')]),_0x263922[_0xf570('0x64')],_0x263922['opts'],_0x263922['url']]);if(_0x44c2ac['result']===-0x1){return _0x44c2ac;}return this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xe5'),_0xf570('0xe3')));};AGIVertices['prototype']['finally']=function(_0x415676){logger[_0xf570('0x2c')](util['format'](_0xf570('0x10e'),_0x415676[_0xf570('0x36')]));return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x10f'));};AGIVertices[_0xf570('0x10')][_0xf570('0xc')]=function(_0x49333d){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x49333d[_0xf570('0x36')]));if(_0x49333d['retry']===0x0){return this[_0xf570('0xa1')](_0x49333d);}_0x49333d[_0xf570('0xa2')]-=0x1;if(!this[_0xf570('0x81')](_0x49333d[_0xf570('0x110')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x49333d,_0xf570('0x111'));}var _0x103558=this[_0xf570('0x1e')][_0xf570('0x70')](this,_0x49333d[_0xf570('0x110')]);if(!_0x103558){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x49333d,_0xf570('0x112'));}if(!this[_0xf570('0x81')](_0x49333d[_0xf570('0xd6')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0xf570('0xd7'));}var _0x3d1bca=this[_0xf570('0xd')][_0xf570('0x113')](_0x103558,_0x49333d[_0xf570('0x114')],_0x49333d['maxdigit']);var _0x427cd0=_0x3d1bca[_0xf570('0xa0')]?_0x3d1bca[_0xf570('0xa0')][_0xf570('0x4a')]():'';logger[_0xf570('0x2c')](_0xf570('0x115'),JSON[_0xf570('0x72')](_0x3d1bca));if(_0x3d1bca[_0xf570('0xa0')]===-0x1){this[_0xf570('0x34')][_0xf570('0x70')](this,_0x49333d,_0x427cd0);return _0x3d1bca;}else if(_0x3d1bca[_0xf570('0x9e')]===_0xf570('0x64')){_0x3d1bca[_0xf570('0xa0')]=_0x427cd0['length']>=parseInt(_0x49333d[_0xf570('0x116')])?'x':'i';}else{_0x3d1bca[_0xf570('0xa0')]=_0x427cd0[_0xf570('0x96')]>=parseInt(_0x49333d['mindigit'])&&_0x427cd0[_0xf570('0x96')]<=parseInt(_0x49333d[_0xf570('0x117')])?'x':'i';}var _0x40e359=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x49333d['variable_id']);if(!_0x40e359){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x49333d,_0xf570('0xd8'));}this['channel'][_0xf570('0x9a')](_0x40e359,_0x427cd0);if(this[_0xf570('0x81')](_0x49333d['hiddendigitsnum'])){var _0x44988e=parseInt(_0x49333d[_0xf570('0x118')],0xa);var _0x3c0c51=rs[_0xf570('0x119')]({'charset':'*','length':_0x44988e});var _0x318f45=_0x427cd0[_0xf570('0x96')];if(_0x318f45>0x0){if(_0x318f45>_0x44988e){this['createSquareDetailsReport'][_0xf570('0x70')](this,_0x49333d,_0x49333d['hiddendigitspos']===_0xf570('0x11a')?_0x3c0c51+_0x427cd0[_0xf570('0x11b')](_0x44988e):_0x427cd0['substr'](0x0,_0x318f45-_0x44988e)+_0x3c0c51);}else{this[_0xf570('0x34')][_0xf570('0x70')](this,_0x49333d,rs[_0xf570('0x119')]({'charset':'*','length':_0x318f45}));}}else{this['createSquareDetailsReport'][_0xf570('0x70')](this,_0x49333d,'');}}else{this[_0xf570('0x34')][_0xf570('0x70')](this,_0x49333d,_0x427cd0);}return _0x3d1bca;};AGIVertices['prototype']['getsecretdigits']=function(_0x2b6928){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x11c'),_0x2b6928['label']));return this[_0xf570('0xc')](_0x2b6928);};AGIVertices['prototype'][_0xf570('0x11d')]=function(_0x502ae6){logger['info'](util[_0xf570('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x502ae6[_0xf570('0x36')]));this[_0xf570('0x34')][_0xf570('0x70')](this,_0x502ae6,_0x502ae6[_0xf570('0x11e')]);return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x11f'),_0x502ae6[_0xf570('0x11e')]));};AGIVertices['prototype'][_0xf570('0x120')]=function(_0x95dcaf){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x121'),_0x95dcaf[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x95dcaf[_0xf570('0x87')])||!this[_0xf570('0x81')](_0x95dcaf[_0xf570('0x84')])){return this[_0xf570('0xd')]['noop'](_0xf570('0x122'));}if(!this[_0xf570('0x81')](_0x95dcaf[_0xf570('0x5a')])){return this[_0xf570('0xd')]['noop']('no\x20text\x20configured');}this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x123'),_0x95dcaf[_0xf570('0x5a')]));var _0xed2a35=this['awsPolly'][_0xf570('0x70')](this,_0x95dcaf);if(_0xed2a35){this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x124'),_0xed2a35));var _0x48012d=this[_0xf570('0xd')][_0xf570('0x101')](_0xed2a35);try{fs[_0xf570('0x125')](_0xed2a35+_0xf570('0x102'));}catch(_0x2e18d7){logger[_0xf570('0x2a')](_0x2e18d7);}return _0x48012d;}return this[_0xf570('0xd')]['error'](_0x95dcaf,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf570('0x10')][_0xf570('0x126')]=function(_0x3ed942){logger[_0xf570('0x2c')](util['format'](_0xf570('0x127'),_0x3ed942[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x3ed942[_0xf570('0x87')])||!this[_0xf570('0x81')](_0x3ed942[_0xf570('0x84')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x122'));}if(!this[_0xf570('0x81')](_0x3ed942[_0xf570('0x89')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x128'));}if(!this[_0xf570('0x81')](_0x3ed942['text'])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}this['channel'][_0xf570('0xe8')]=!![];this[_0xf570('0x34')](_0x3ed942);this[_0xf570('0x40')](_0x3ed942[_0xf570('0x5a')],'in','','');this[_0xf570('0xd')]['noop'](util['format'](_0xf570('0x129'),_0x3ed942[_0xf570('0x5a')]));var _0x28498a=this[_0xf570('0x86')][_0xf570('0x70')](this,_0x3ed942);if(_0x28498a){for(var _0x41f333 in _0x28498a){if(_0x28498a[_0xf570('0x90')](_0x41f333)&&_[_0xf570('0x91')](_0x28498a[_0x41f333])){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x12a'),_0x41f333['toUpperCase']()),_0x28498a[_0x41f333]);}}if(_['isNil'](_0x28498a[_0xf570('0x74')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x12b'));}else{this['createSquareMessage'](_0x28498a[_0xf570('0x74')],'out',_0xf570('0x12c'),'');return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x12d'),_0x28498a[_0xf570('0x74')]));}}return this[_0xf570('0xd')][_0xf570('0x2a')](_0x3ed942,_0xf570('0x12e'));};AGIVertices[_0xf570('0x10')][_0xf570('0x12f')]=function(_0x2659aa){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2659aa[_0xf570('0x36')],_0x2659aa[_0xf570('0x64')]));if(!this[_0xf570('0x81')](_0x2659aa['key'])){return this['channel']['noop'](_0xf570('0xe7'));}var _0x5798e0=_0xf570('0x130');var _0x3bdad4=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xf570('0x119')](0x4));var _0xd88a09=util[_0xf570('0x27')](_0xf570('0x99'),_0x3bdad4,_0x5798e0);var _0x1d077a=!![];if(_0x2659aa['beep']===_0xf570('0x131')){_0x1d077a=![];}var _0x396bce=this['channel'][_0xf570('0x132')](_0x3bdad4,_0x5798e0,_0x2659aa[_0xf570('0x133')],_0x2659aa[_0xf570('0x64')],undefined,_0x1d077a);if(_0x396bce[_0xf570('0xa0')]!==-0x1){this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0x134'),_0xd88a09));var _0x3a106b=this[_0xf570('0x8a')]['sync'](this,_0x2659aa,_0xd88a09);if(_0x3a106b){for(var _0x37ed00 in _0x3a106b){if(_0x3a106b[_0xf570('0x90')](_0x37ed00)){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')]('GOOGLE_ASR_%s',_0x37ed00[_0xf570('0x69')]()),_0x3a106b[_0x37ed00]);}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x135'),JSON[_0xf570('0x72')](_0x3a106b)));}}return _0x396bce;};AGIVertices[_0xf570('0x10')][_0xf570('0x136')]=function(_0x46fe1d){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x137'),_0x46fe1d[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x46fe1d['appid'])){return this['channel'][_0xf570('0xa4')](_0xf570('0x138'));}if(!this[_0xf570('0x81')](_0x46fe1d[_0xf570('0x8d')])){return this['channel'][_0xf570('0xa4')](_0xf570('0x139'));}var _0x25f740='wav';var _0x16c63d=util[_0xf570('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2b7042=util['format'](_0xf570('0x99'),_0x16c63d,_0x25f740);var _0x1cdf4f=!![];if(_0x46fe1d[_0xf570('0x13a')]===_0xf570('0x131')){_0x1cdf4f=![];}var _0x5973fe=this['channel'][_0xf570('0x132')](_0x16c63d,_0x25f740,_0x46fe1d[_0xf570('0x133')],_0x46fe1d[_0xf570('0x64')],undefined,_0x1cdf4f);if(_0x5973fe[_0xf570('0xa0')]!==-0x1){this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x13b'),_0x2b7042));var _0x98b7bd=this[_0xf570('0x8b')]['sync'](this,_0x46fe1d,_0x2b7042);if(_0x98b7bd){for(var _0x20a79b in _0x98b7bd){if(_0x98b7bd[_0xf570('0x90')](_0x20a79b)){this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x13c'),_0x20a79b[_0xf570('0x69')]()),_0x98b7bd[_0x20a79b]);}}return this['channel'][_0xf570('0xa4')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xf570('0x72')](_0x98b7bd)));}}return _0x5973fe;};AGIVertices['prototype'][_0xf570('0x13d')]=function(_0x24af2d){logger['info'](util['format'](_0xf570('0x13e'),_0x24af2d[_0xf570('0x36')]));return this[_0xf570('0xd')][_0xf570('0x13f')](_0x24af2d['context'],_0x24af2d[_0xf570('0x3b')],_0x24af2d['priority']);};AGIVertices[_0xf570('0x10')][_0xf570('0x140')]=function(_0x21afa7){logger['info'](util[_0xf570('0x27')](_0xf570('0x141'),_0x21afa7[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x21afa7[_0xf570('0x142')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x21afa7,_0xf570('0x143'));}try{var _0x365a3e=eval(_0x21afa7[_0xf570('0x142')])?'true':_0xf570('0x144');this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0x145'),_0x21afa7[_0xf570('0x142')],_0x365a3e));return{'code':0xc8,'result':_0x365a3e};}catch(_0xdad3b9){return{'code':0xc8,'result':_0xf570('0x144')};}};AGIVertices[_0xf570('0x10')][_0xf570('0x146')]=function(_0xf9ab02){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xf9ab02[_0xf570('0x36')]));if(!this['isConfigured'](_0xf9ab02[_0xf570('0x147')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0xf9ab02,'no\x20interval\x20configured');}var _0x51e09f=this[_0xf570('0x148')][_0xf570('0x70')](this,_0xf9ab02[_0xf570('0x147')]);if(!_0x51e09f){return this[_0xf570('0xd')][_0xf570('0x2a')](_0xf9ab02,'no\x20intervals\x20found');}for(var _0x25ba15=0x0;_0x25ba15<_0x51e09f[_0xf570('0x96')];_0x25ba15+=0x1){var _0x57c80e=this['channel'][_0xf570('0x9d')](util[_0xf570('0x27')]('IFTIME(%s?true:false)',_0x51e09f[_0x25ba15]));if(_0x57c80e[_0xf570('0xa0')]===-0x1){return _0x57c80e;}logger[_0xf570('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x51e09f[_0x25ba15],_0x57c80e[_0xf570('0x9e')]));if(_0x57c80e[_0xf570('0x9e')]==='true'){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('IFTIME\x20%s\x20%s',_0x51e09f[_0x25ba15],_0xf570('0x149')));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x14a'),_0x51e09f[_0x25ba15],'true'));return{'code':0xc8,'result':_0xf570('0x149')};}else{logger[_0xf570('0x2c')](util[_0xf570('0x27')]('IFTIME\x20%s\x20%s',_0x51e09f[_0x25ba15],_0xf570('0x144')));this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x14a'),_0x51e09f[_0x25ba15],_0xf570('0x144')));}}return{'code':0xc8,'result':_0xf570('0x144')};};AGIVertices[_0xf570('0x10')][_0xf570('0x14b')]=function(_0xb48bfc){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x14c'),_0xb48bfc['label']));return this[_0xf570('0xd')][_0xf570('0x14b')]();};AGIVertices[_0xf570('0x10')][_0xf570('0x14d')]=function(_0x42dda3){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x14e'),_0x42dda3[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x42dda3[_0xf570('0x78')])){return this[_0xf570('0xd')]['noop'](_0xf570('0xe7'));}var _0x2e0f3d='wav';var _0xc82015=util['format'](_0xf570('0x14f'),FILES_PATH,rs['generate'](0x4));var _0xe6a21f=util[_0xf570('0x27')](_0xf570('0x99'),_0xc82015,_0x2e0f3d);var _0x2684e5=!![];if(_0x42dda3[_0xf570('0x13a')]===_0xf570('0x131')){_0x2684e5=![];}var _0x140efb=this['channel']['recordFile'](_0xc82015,_0x2e0f3d,_0x42dda3[_0xf570('0x133')],_0x42dda3['timeout'],undefined,_0x2684e5);if(_0x140efb['result']!==-0x1){this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('ispeech\x20%s\x20file\x20created',_0xe6a21f));var _0x12653e=this[_0xf570('0x7f')][_0xf570('0x70')](this,_0x42dda3,_0xe6a21f);if(_0x12653e){for(var _0x3ee6a8 in _0x12653e){if(_0x12653e[_0xf570('0x90')](_0x3ee6a8)){this[_0xf570('0xd')]['setVariable'](util[_0xf570('0x27')](_0xf570('0x150'),_0x3ee6a8[_0xf570('0x69')]()),_0x12653e[_0x3ee6a8]);}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x151'),JSON[_0xf570('0x72')](_0x12653e)));}}return _0x140efb;};AGIVertices[_0xf570('0x10')][_0xf570('0x152')]=function(_0x5e41fe){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x153'),_0x5e41fe[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5e41fe[_0xf570('0x78')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xe7'));}if(!this[_0xf570('0x81')](_0x5e41fe['text'])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x154'),_0x5e41fe[_0xf570('0x5a')]));var _0x4189ff=this['ispeechTTS'][_0xf570('0x70')](this,_0x5e41fe);if(_0x4189ff){this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')]('ispeech\x20%s\x20file\x20created',_0x4189ff));var _0x420107=this['channel'][_0xf570('0x101')](_0x4189ff,_0x5e41fe[_0xf570('0x133')]);try{fs[_0xf570('0x125')](_0x4189ff+_0xf570('0x102'));}catch(_0x2a62b2){logger[_0xf570('0x2a')](_0x2a62b2);}return _0x420107;}return this[_0xf570('0xd')]['error'](_0x5e41fe,_0xf570('0x155'));};AGIVertices[_0xf570('0x10')][_0xf570('0x156')]=function(_0x216a81){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x157'),_0x216a81[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x216a81[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x216a81,_0xf570('0x159'));}logger['info'](util[_0xf570('0x27')](_0xf570('0x15a'),this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81['findBy']));var _0x24eef8=this[_0xf570('0x51')][_0xf570('0x70')](this,_0x216a81['findBy']);if(_0x24eef8){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81[_0xf570('0x158')]));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this['channel']['callerid'],_0x216a81[_0xf570('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf570('0x2c')](util['format'](_0xf570('0x15c'),this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81['findBy']));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15c'),this[_0xf570('0xd')][_0xf570('0x38')],_0x216a81[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x15d')};}};AGIVertices['prototype'][_0xf570('0x15e')]=function(_0x4ece4f){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15f'),_0x4ece4f[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x4ece4f[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x4ece4f,_0xf570('0x159'));}logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15a'),this[_0xf570('0xd')][_0xf570('0x38')],_0x4ece4f['findBy']));var _0x33f61f=this[_0xf570('0x50')][_0xf570('0x70')](this,_0x4ece4f[_0xf570('0x158')]);if(_0x33f61f){logger['info'](util[_0xf570('0x27')](_0xf570('0x15b'),this['channel']['callerid'],_0x4ece4f[_0xf570('0x158')]));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')][_0xf570('0x38')],_0x4ece4f[_0xf570('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf570('0x2c')](util['format'](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x4ece4f[_0xf570('0x158')]));this['channel'][_0xf570('0xa4')](util['format'](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x4ece4f[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x15d')};}};AGIVertices[_0xf570('0x10')][_0xf570('0x160')]=function(_0x2badd1){logger['info'](util['format'](_0xf570('0x161'),_0x2badd1[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x2badd1['operation'])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x2badd1,_0xf570('0x162'));}this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')]('math\x20%s',_0x2badd1[_0xf570('0x163')]));var _0xc561d3=eval(_0x2badd1[_0xf570('0x163')]);if(!this['isConfigured'](_0x2badd1['variable_id'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xe495c=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x2badd1[_0xf570('0xd6')]);if(!_0xe495c){return this['channel']['error'](_0x2badd1,_0xf570('0xd8'));}if(_[_0xf570('0x95')](_0xc561d3)){var _0x2f048c=this;_0xc561d3['forEach'](function(_0x49e4e5,_0x2ebe05){_0x2f048c[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x164'),_0xe495c,_0x2ebe05),_0x49e4e5);});return this[_0xf570('0xd')]['noop'](util['format'](_0xf570('0x165'),_0xe495c));}else{return this[_0xf570('0xd')][_0xf570('0x9a')](_0xe495c,_0xc561d3);}};AGIVertices[_0xf570('0x10')]['menu']=function(_0x521f6c){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x166'),_0x521f6c[_0xf570('0x36')]));if(_0x521f6c[_0xf570('0xa2')]===0x0){return this[_0xf570('0xa1')](_0x521f6c);}_0x521f6c[_0xf570('0xa2')]-=0x1;if(!this['isConfigured'](_0x521f6c[_0xf570('0x110')])){return this[_0xf570('0xd')]['error'](_0x521f6c,_0xf570('0x111'));}var _0x50880b=this[_0xf570('0x1e')][_0xf570('0x70')](this,_0x521f6c[_0xf570('0x110')]);if(!_0x50880b){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x521f6c,_0xf570('0x112'));}var _0x38ed76=this[_0xf570('0xd')][_0xf570('0x113')](_0x50880b,_0x521f6c[_0xf570('0x114')],_0x521f6c['digit']);var _0x55cd8a=_0x38ed76[_0xf570('0xa0')];if(_0x38ed76['result']===-0x1){this[_0xf570('0x34')][_0xf570('0x70')](this,_0x521f6c,'-1');return _0x38ed76;}else if(_0x38ed76[_0xf570('0x9e')]===_0xf570('0x64')){_0x38ed76[_0xf570('0xa0')]=_0x38ed76['result'][_0xf570('0x96')]>0x0?_0x38ed76['result']:'t';}else if(_[_0xf570('0x42')](_0x38ed76[_0xf570('0xa0')])){_0x38ed76[_0xf570('0xa0')]='#';_0x55cd8a='#';}if(!this['isConfigured'](_0x521f6c[_0xf570('0xd6')])){this['channel'][_0xf570('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x199bc9=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x521f6c[_0xf570('0xd6')]);if(!_0x199bc9){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x521f6c,_0xf570('0xd8'));}this['channel'][_0xf570('0x9a')](_0x199bc9,_0x55cd8a);}this[_0xf570('0x34')][_0xf570('0x70')](this,_0x521f6c,_0x55cd8a);return _0x38ed76;};AGIVertices['prototype'][_0xf570('0xa4')]=function(_0x394ce3){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x167'),_0x394ce3[_0xf570('0x36')]));return this['channel']['noop'](_0x394ce3[_0xf570('0x168')]||_0x394ce3[_0xf570('0x36')]);};AGIVertices[_0xf570('0x10')]['pause']=function(_0x35637c){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x35637c[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x35637c[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x35637c,_0xf570('0x159'));}logger[_0xf570('0x2c')](util[_0xf570('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c[_0xf570('0x158')]));var _0x22ccb1=this[_0xf570('0x4b')]['sync'](this,_0x35637c['pause_id']);var _0x370e73=this['agentPause'][_0xf570('0x70')](this,_0x35637c[_0xf570('0x158')],_0x22ccb1);if(_0x370e73){logger[_0xf570('0x2c')](util[_0xf570('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c['findBy']));this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x35637c[_0xf570('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xf570('0x27')](_0xf570('0x15c'),this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c[_0xf570('0x158')]));this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')][_0xf570('0x38')],_0x35637c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xf570('0x169')]=function(_0x295921){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x16a'),_0x295921[_0xf570('0x36')]));if(!this['isConfigured'](_0x295921[_0xf570('0x110')])){return this['channel']['error'](_0x295921,'no\x20file\x20audio\x20selected');}var _0x557f19=this[_0xf570('0x1e')][_0xf570('0x70')](this,_0x295921[_0xf570('0x110')]);if(!_0x557f19){return this[_0xf570('0xd')]['error'](_0x295921,'no\x20file\x20audio\x20found');}var _0x580203=this['channel'][_0xf570('0x55')](_0xf570('0x16b'),[_0x557f19,_0x295921[_0xf570('0xe4')]]);if(_0x580203[_0xf570('0xa0')]===-0x1){return _0x580203;}return this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0xc0'),_0xf570('0x16b'),_0x557f19));};AGIVertices[_0xf570('0x10')][_0xf570('0x16c')]=function(_0x11c482){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x16d'),_0x11c482[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x11c482[_0xf570('0x16e')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x11c482,_0xf570('0x16f'));}var _0x4c2190='';var _0x6494c2=parseInt(_0x11c482[_0xf570('0x16e')],0xa);if(isNaN(_0x6494c2)){_0x4c2190=_0x11c482[_0xf570('0x16e')];}else{_0x4c2190=this[_0xf570('0x13')][_0xf570('0x70')](this,_0x11c482[_0xf570('0x16e')]);if(!_0x4c2190){return this['channel'][_0xf570('0x2a')](_0x11c482,'no\x20queue\x20found');}}var _0x29d9d9='';if(this[_0xf570('0x81')](_0x11c482[_0xf570('0x110')])){var _0x3f7404=this['getSound'][_0xf570('0x70')](this,_0x11c482[_0xf570('0x110')]);if(_0x3f7404){_0x29d9d9=_0x3f7404;}}this['createSquareDetailsReport'][_0xf570('0x70')](this,_0x11c482,_0x4c2190);if(_0x11c482[_0xf570('0xe4')][_0xf570('0x170')]('x')<0x0){_0x11c482[_0xf570('0xe4')]+='x';}if(_0x11c482[_0xf570('0xe4')][_0xf570('0x170')]('X')<0x0){_0x11c482[_0xf570('0xe4')]+='X';}this[_0xf570('0xd')]['setVariable']('XMCS-QUEUE',_0x4c2190?_0x4c2190[_0xf570('0x171')]():'');var _0x56327f=this[_0xf570('0xd')][_0xf570('0x55')]('QUEUE',[_0x4c2190,_0x11c482['opts'],_0x11c482['url'],_0x29d9d9,_0x11c482[_0xf570('0x64')],_0x11c482[_0xf570('0x7')],_0x11c482[_0xf570('0x172')],_0x11c482[_0xf570('0x173')],'',_0x11c482[_0xf570('0x174')]]);if(_0x56327f['result']===-0x1){return _0x56327f;}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xc0'),'QUEUE',_0x4c2190));};AGIVertices['prototype'][_0xf570('0x175')]=function(_0x1ef107){logger[_0xf570('0x2c')](util['format'](_0xf570('0x176'),_0x1ef107['label']));var _0x390dcf=_0x1ef107[_0xf570('0x177')]||_0xf570('0x130');var _0x135beb=util['format']('%s_%s',this['channel'][_0xf570('0x35')],rs['generate'](0x5));var _0x273a56=util[_0xf570('0x27')](_0xf570('0x178'),FILES_PATH,_0x135beb,_0x390dcf);var _0x22f01b=util[_0xf570('0x27')](_0xf570('0x14f'),FILES_PATH,_0x135beb);this[_0xf570('0x39')][_0xf570('0x70')](this,_0x1ef107,_0x135beb,_0x273a56);this[_0xf570('0xd')][_0xf570('0x9a')]('RECORDING_SAVENAME',_0x135beb);logger[_0xf570('0x2c')](_0xf570('0x179'),_0x22f01b,_0x390dcf,_0x1ef107[_0xf570('0x17a')],_0x1ef107['timeout']);return this['channel'][_0xf570('0x132')](_0x22f01b,_0x390dcf,_0x1ef107['escape_digits'],_0x1ef107[_0xf570('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xf570('0x17b')]=function(_0x3b08b){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x17c'),_0x3b08b['label']));if(!this['isConfigured'](_0x3b08b['url'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20url\x20configured');}var _0xaefaa3=this[_0xf570('0x61')][_0xf570('0x70')](this,_0x3b08b);logger[_0xf570('0x2c')](util[_0xf570('0x27')]('Response:',util[_0xf570('0x17d')](_0xaefaa3,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b08b[_0xf570('0xd6')])){return this['channel'][_0xf570('0xa4')](_0xf570('0x17e'));}var _0xf63099=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x3b08b[_0xf570('0xd6')]);if(!_0xf63099){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x3b08b,_0xf570('0xd8'));}this['channel'][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x17f'),_0xf63099),_0xaefaa3['statusCode']?_0xaefaa3[_0xf570('0x180')]:_0xf570('0x181'));this[_0xf570('0xd')][_0xf570('0x9a')](util[_0xf570('0x27')](_0xf570('0x182'),_0xf63099),_0xaefaa3[_0xf570('0x183')]?_0xaefaa3[_0xf570('0x183')]:'OK');if(_0xaefaa3[_0xf570('0x6a')]){try{this['saveRestApiResult'](_0xaefaa3[_0xf570('0x6a')],_0xf63099);}catch(_0x280851){logger['error'](util[_0xf570('0x27')](_0xf570('0x184'),_0xf63099));}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xdc'),_0xf63099));};AGIVertices[_0xf570('0x10')][_0xf570('0x185')]=function(_0x5b418f){logger['info'](util['format'](_0xf570('0x186'),_0x5b418f['label']));return this[_0xf570('0xd')][_0xf570('0x187')](_0x5b418f[_0xf570('0x188')][_0xf570('0x57')](/\s+/g,''),_0x5b418f[_0xf570('0x17a')]);};AGIVertices['prototype'][_0xf570('0x189')]=function(_0x24a0c0){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x24a0c0[_0xf570('0x36')]));return this['channel']['sayNumber'](_0x24a0c0[_0xf570('0x65')][_0xf570('0x57')](/\s+/g,''),_0x24a0c0[_0xf570('0x17a')]);};AGIVertices[_0xf570('0x10')][_0xf570('0x18a')]=function(_0xd3052f){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x18b'),_0xd3052f['label']));return this[_0xf570('0xd')]['sayPhonetic'](_0xd3052f[_0xf570('0x5a')],_0xd3052f[_0xf570('0x17a')]);};AGIVertices['prototype'][_0xf570('0x18c')]=function(_0x4f886c){logger[_0xf570('0x2c')](util['format'](_0xf570('0x18d'),_0x4f886c['label']));if(!this[_0xf570('0x81')](_0x4f886c[_0xf570('0x18e')])){return this['channel']['noop'](_0xf570('0x18f'));}var _0x5ab007=this[_0xf570('0x21')][_0xf570('0x70')](this,_0x4f886c[_0xf570('0x18e')]);if(!_0x5ab007||!_0x5ab007[_0xf570('0x190')]){return this['channel'][_0xf570('0x2a')](_0x4f886c,_0xf570('0x191'));}var _0x221628={'from':util[_0xf570('0x27')](_0xf570('0x192'),_0x5ab007['name'],_0x5ab007['email']||_0x5ab007[_0xf570('0x190')][_0xf570('0x193')]),'to':_0x4f886c['to']||'','cc':_0x4f886c['cc']||'','bcc':_0x4f886c[_0xf570('0x194')]||'','subject':_0x4f886c['subject'],'html':_0x4f886c['text'],'text':_0x4f886c[_0xf570('0x5a')]};if(this[_0xf570('0x81')](_0x4f886c[_0xf570('0x195')])){}logger['debug']('sendMail\x20message',JSON[_0xf570('0x72')](_0x221628));this[_0xf570('0x34')][_0xf570('0x70')](this,_0x4f886c,_0x4f886c[_0xf570('0x18e')]);this[_0xf570('0xd')][_0xf570('0xa4')](util['format'](_0xf570('0x196'),_0x5ab007['name']));this[_0xf570('0x23')][_0xf570('0x70')](this,_0x5ab007[_0xf570('0x197')],_0x221628);return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x198'));};AGIVertices[_0xf570('0x10')][_0xf570('0x199')]=function(_0x5f3c48){logger[_0xf570('0x2c')](util['format'](_0xf570('0x19a'),_0x5f3c48['label']));return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x19b'));};AGIVertices[_0xf570('0x10')][_0xf570('0x19c')]=function(_0xc247a9){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x19d'),_0xc247a9[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0xc247a9[_0xf570('0x19e')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x19f'));}var _0x31d27f=this[_0xf570('0x31')]['sync'](this,_0xc247a9[_0xf570('0x19e')]);if(!_0x31d27f){return this['channel'][_0xf570('0x2a')](_0xc247a9,_0xf570('0x1a0'));}var _0x2bddd2={'body':_0xc247a9[_0xf570('0x1a1')],'phone':_0xc247a9['to']||'','SmsAccountId':_0x31d27f['id']};logger[_0xf570('0xde')](_0xf570('0x1a2'),JSON['stringify'](_0x2bddd2));this[_0xf570('0x34')]['sync'](this,_0xc247a9,_0xc247a9['sms_account_id']);this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1a3'),_0x31d27f['name']));this[_0xf570('0x33')]['sync'](this,_0x2bddd2);return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x1a4'));};AGIVertices[_0xf570('0x10')]['set']=function(_0x7e9514){logger[_0xf570('0x2c')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x7e9514[_0xf570('0x36')]));if(!this['isConfigured'](_0x7e9514[_0xf570('0xd6')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x7e9514,_0xf570('0x1a5'));}var _0x1d6540=this[_0xf570('0x9d')]['sync'](this,_0x7e9514[_0xf570('0xd6')]);if(!_0x1d6540){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x7e9514,_0xf570('0xd8'));}return this[_0xf570('0xd')][_0xf570('0x9a')](_0x1d6540,_0x7e9514[_0xf570('0x1a6')]);};AGIVertices[_0xf570('0x10')][_0xf570('0x1a7')]=function(_0x3712c7){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1a8'),_0x3712c7[_0xf570('0x36')]));this['channel'][_0xf570('0xa4')]('START\x20CALLY\x20SQUARE');if(_0x3712c7[_0xf570('0xb4')]===_0xf570('0x1a9')){this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0x1aa'));return this['channel']['answer']();}return this[_0xf570('0xd')]['noop'](_0xf570('0x1ab'));};AGIVertices[_0xf570('0x10')]['subproject']=function(_0x1969f0){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1ac'),_0x1969f0['label']));if(!this[_0xf570('0x81')](_0x1969f0[_0xf570('0x1ad')])){return this[_0xf570('0xd')]['error'](_0x1969f0,'no\x20subproject\x20selected');}var _0x5a42d7=this[_0xf570('0x16')]['sync'](this,_0x1969f0['project_id']);if(!this['isConfigured'](_0x5a42d7)){return this['channel'][_0xf570('0x2a')](_0x1969f0,util[_0xf570('0x27')](_0xf570('0x1ae'),_0x1969f0[_0xf570('0x1ad')]));}if(_0x5a42d7===this[_0xf570('0xd')][_0xf570('0x3f')]){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x1969f0,_0xf570('0x1af'));}this[_0xf570('0x34')][_0xf570('0x70')](this,_0x1969f0,_0x5a42d7);var _0x3869e7=this[_0xf570('0xd')]['exec'](_0xf570('0x1b0'),util[_0xf570('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xf570('0x1b1')]||'127.0.0.1',_0x5a42d7,this[_0xf570('0xd')][_0xf570('0x3f')]));if(_0x3869e7[_0xf570('0xa0')]===-0x1){return _0x3869e7;}return this['channel']['noop'](util[_0xf570('0x27')](_0xf570('0xc0'),'AGI',_0x5a42d7));};AGIVertices[_0xf570('0x10')][_0xf570('0x1b2')]=function(_0xa3d504){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1b3'),_0xa3d504[_0xf570('0x36')]));var _0x14441a=this['shellCommand'][_0xf570('0x70')](this,_0xa3d504[_0xf570('0xb2')]);this[_0xf570('0x34')][_0xf570('0x70')](this,_0xa3d504,_0xa3d504[_0xf570('0xb2')]);if(this[_0xf570('0x81')](_0xa3d504[_0xf570('0xd6')])){var _0x39fc82=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0xa3d504[_0xf570('0xd6')]);if(_0x39fc82){this['channel']['setVariable'](_0x39fc82,_0x14441a);return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1b4'),_0xa3d504[_0xf570('0xb2')],_0x39fc82));}}return this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xa3d504[_0xf570('0xb2')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x320d4d){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x320d4d[_0xf570('0x36')]));_0x320d4d['text']=_0x320d4d[_0xf570('0x5a')][_0xf570('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf570('0x81')](_0x320d4d['apiKey'])){return this[_0xf570('0xd')][_0xf570('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0xf570('0x81')](_0x320d4d[_0xf570('0x5a')])){return this[_0xf570('0xd')][_0xf570('0xa4')](_0xf570('0xa5'));}this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1b5'),_0x320d4d[_0xf570('0x5a')]));var _0x50dcad=this[_0xf570('0x58')][_0xf570('0x70')](this,_0x320d4d);if(_0x50dcad){this['channel']['noop'](util[_0xf570('0x27')](_0xf570('0x1b6'),_0x50dcad));var _0x45692a=this[_0xf570('0xd')][_0xf570('0x101')](_0x50dcad);try{fs[_0xf570('0x125')](_0x50dcad+_0xf570('0x102'));}catch(_0x1b1210){logger[_0xf570('0x2a')](_0x1b1210);}return _0x45692a;}return this['channel'][_0xf570('0x2a')](_0x320d4d,_0xf570('0x1b7'));};AGIVertices[_0xf570('0x10')]['tts']=function(_0x2e7bf8){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1b8'),_0x2e7bf8[_0xf570('0x36')]));_0x2e7bf8['text']=_0x2e7bf8[_0xf570('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf570('0x81')](_0x2e7bf8[_0xf570('0x5a')])){return this['channel'][_0xf570('0xa4')]('no\x20text\x20configured');}this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1b9'),_0x2e7bf8['text']));var _0x397866=this['googleTTS'][_0xf570('0x70')](this,_0x2e7bf8);if(_0x397866){this[_0xf570('0xd')][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x1ba'),_0x397866));var _0xc45351=this[_0xf570('0xd')][_0xf570('0x101')](_0x397866);try{fs['unlink'](_0x397866+'.wav');}catch(_0x5727f5){logger['error'](_0x5727f5);}return _0xc45351;}return this['channel']['error'](_0x2e7bf8,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xf570('0x1bb')]=function(_0x5b9c86){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1bc'),_0x5b9c86[_0xf570('0x36')]));if(!this[_0xf570('0x81')](_0x5b9c86[_0xf570('0x158')])){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x5b9c86,_0xf570('0x159'));}logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15a'),this[_0xf570('0xd')][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));var _0x39b7a1=this[_0xf570('0x4f')][_0xf570('0x70')](this,_0x5b9c86[_0xf570('0x158')]);if(_0x39b7a1){logger['info'](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0x15b'),this[_0xf570('0xd')]['callerid'],_0x5b9c86[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x1bd')};}else{logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));this[_0xf570('0xd')]['noop'](util[_0xf570('0x27')](_0xf570('0x15c'),this['channel'][_0xf570('0x38')],_0x5b9c86[_0xf570('0x158')]));return{'code':0xc8,'result':_0xf570('0x15d')};}};AGIVertices['prototype'][_0xf570('0x1be')]=function(_0x1f85f2){logger['info'](util[_0xf570('0x27')](_0xf570('0x1bf'),_0x1f85f2[_0xf570('0x36')]));var _0x5a2a23=this[_0xf570('0xd')][_0xf570('0x55')](_0xf570('0x1c0'),[_0x1f85f2[_0xf570('0x1c1')],_0x1f85f2[_0xf570('0x76')]]);if(_0x5a2a23[_0xf570('0xa0')]===-0x1){return _0x5a2a23;}return this['channel'][_0xf570('0xa4')](util[_0xf570('0x27')](_0xf570('0xc0'),_0xf570('0x1c0'),_0x1f85f2[_0xf570('0x1c1')]));};AGIVertices['prototype'][_0xf570('0x1c2')]=function(_0x395feb){logger[_0xf570('0x2c')](util[_0xf570('0x27')](_0xf570('0x1c3'),_0x395feb[_0xf570('0x36')]));if(!this['isConfigured'](_0x395feb[_0xf570('0xd6')])){return this[_0xf570('0xd')]['error'](_0x395feb,_0xf570('0x1a5'));}var _0x18fd12=this[_0xf570('0x9d')][_0xf570('0x70')](this,_0x395feb[_0xf570('0xd6')]);if(!_0x18fd12){return this[_0xf570('0xd')][_0xf570('0x2a')](_0x395feb,_0xf570('0xd8'));}var _0x23f8f2=this['channel'][_0xf570('0x9d')](_0x18fd12);return{'code':0xc8,'result':_0x23f8f2[_0xf570('0x9e')]?_0x23f8f2[_0xf570('0x9e')]:'-'};};String['prototype'][_0xf570('0x9c')]=function(_0xb2063c,_0x58679d){return this[_0xf570('0x9b')](_0xb2063c)[_0xf570('0x1c4')](_0x58679d);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d2d704e..81513a3 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 _0x8b79=['channels','syncAgentConnect','hanguprequest','syncHangupRequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','queue','voiceQueues','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','acw','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','../ami','../../../config/logger','../rpc/user','agents','timers'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x8b79,0x1f2));var _0x98b7=function(_0x5ef7e4,_0x18f7cc){_0x5ef7e4=_0x5ef7e4-0x0;var _0x410b8e=_0x8b79[_0x5ef7e4];return _0x410b8e;};'use strict';var util=require(_0x98b7('0x0'));var _=require('lodash');var moment=require('moment');var ami=require(_0x98b7('0x1'));var logger=require(_0x98b7('0x2'))('acw');var RpcUser=require(_0x98b7('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5650e8){this['voiceQueues']=_0x5650e8['voiceQueues'];this[_0x98b7('0x4')]=_0x5650e8[_0x98b7('0x4')];this[_0x98b7('0x5')]=_0x5650e8[_0x98b7('0x5')];this[_0x98b7('0x6')]={};ami['on']('agentconnect',this[_0x98b7('0x7')]['bind'](this));ami['on'](_0x98b7('0x8'),this[_0x98b7('0x9')][_0x98b7('0xa')](this));ami['on']('hangup',this[_0x98b7('0xb')][_0x98b7('0xa')](this));ami['on'](_0x98b7('0xc'),this[_0x98b7('0xd')][_0x98b7('0xa')](this));ami['on'](_0x98b7('0xe'),this[_0x98b7('0xf')][_0x98b7('0xa')](this));ami['on'](_0x98b7('0x10'),this[_0x98b7('0x11')][_0x98b7('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x98b7('0x12')][_0x98b7('0xa')](this));}function getDiff(_0xd44017){var _0x1034b5=moment()[_0x98b7('0x13')](0x0);var _0x2ec169=moment(_0xd44017)[_0x98b7('0x13')](0x0);return _0x1034b5[_0x98b7('0x14')](_0x2ec169,_0x98b7('0x15'));}Acw[_0x98b7('0x16')]['startAcw']=function(_0x2804cc){try{var _0x3fc59a=this;var _0x5c5f3a=this['channels'][_0x2804cc]['interface'];var _0x197270=this[_0x98b7('0x6')][_0x2804cc][_0x98b7('0x17')];var _0x1df9ec=this[_0x98b7('0x18')][_0x197270];var _0x4a9efe=![];var _0x2447dd=_0x98b7('0x19');if(_0x1df9ec['mandatoryDisposition']){if(_0x1df9ec[_0x98b7('0x1a')][_0x98b7('0x1b')]){_0x4a9efe=!![];_0x2447dd=_0x1df9ec[_0x98b7('0x1a')][_0x98b7('0x1b')];}}ami[_0x98b7('0x1c')]({'action':_0x98b7('0x1d'),'interface':_0x5c5f3a,'paused':!![],'reason':_0x2447dd})['then'](function(_0x11069a){if(_0x3fc59a[_0x98b7('0x4')][_0x5c5f3a]){return RpcUser[_0x98b7('0x1e')](_0x3fc59a[_0x98b7('0x4')][_0x5c5f3a]['id'])[_0x98b7('0x1f')](function(_0x116dd7){if(_0x116dd7&&!_0x116dd7[_0x98b7('0x20')]){logger[_0x98b7('0x21')](_0x98b7('0x22'),_0x2804cc,_0x5c5f3a,_0x197270);var _0x2b44c9=_0x3fc59a['channels'][_0x2804cc]['attended']&&_0x3fc59a['channels'][_0x2804cc][_0x98b7('0x23')]?_0x3fc59a[_0x98b7('0x6')][_0x2804cc]['destlinkedid']:_0x2804cc;return RpcUser[_0x98b7('0x24')](_0x3fc59a[_0x98b7('0x4')][_0x5c5f3a],_0x2447dd,_0x2b44c9)['then'](function(_0x4b1447){if(!_0x4a9efe){_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2804cc,_0x3fc59a[_0x98b7('0x18')][_0x197270][_0x98b7('0x25')],_0x5c5f3a,_0x197270);_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a][_0x98b7('0x26')]=setTimeout(_0x3fc59a['stopAcw'][_0x98b7('0xa')](_0x3fc59a,_0x5c5f3a),_0x3fc59a['voiceQueues'][_0x197270][_0x98b7('0x25')]*0x3e8);_0x3fc59a['timers'][_0x5c5f3a][_0x98b7('0x27')]=moment()[_0x98b7('0x28')](_0x98b7('0x29'));_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a][_0x98b7('0x2a')]=_0x2804cc;_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a][_0x98b7('0x17')]=_0x197270;_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a][_0x98b7('0x2b')]=function(){var _0xb23ad9=getDiff(_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a]['lastPauseAt']);clearTimeout(_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a][_0x98b7('0x26')]);_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a][_0x98b7('0x26')]=![];RpcVoiceAgentReport[_0x98b7('0x2c')]({'acwtime':_0xb23ad9},_0x3fc59a[_0x98b7('0x5')][_0x5c5f3a]['uniqueid'],_0x5c5f3a)[_0x98b7('0x1f')](function(_0x3e3bf4){logger[_0x98b7('0x21')](_0x98b7('0x2d'),_0x2804cc,_0xb23ad9,_0x3e3bf4);})[_0x98b7('0x2e')](function(_0x34720a){logger['error'](_0x98b7('0x2f'),_0x2804cc,_0x34720a);});delete _0x3fc59a['timers'][_0x5c5f3a];};}});}else{logger[_0x98b7('0x21')](_0x98b7('0x30'),_0x2804cc,_0x5c5f3a,_0x197270);}});}})[_0x98b7('0x2e')](function(_0x1c3e24){logger[_0x98b7('0x31')](_0x98b7('0x32'),_0x2804cc,_0x3fc59a[_0x98b7('0x18')][_0x197270][_0x98b7('0x25')],_0x5c5f3a,_0x197270);})[_0x98b7('0x33')](function(){delete _0x3fc59a['channels'][_0x2804cc];});}catch(_0xeba253){logger['error'](_0x98b7('0x34'),_0xeba253['message']);}};Acw['prototype']['stopAcw']=function(_0x1b3497){try{var _0x2dd832=this;if(_0x2dd832[_0x98b7('0x5')][_0x1b3497]){_0x2dd832[_0x98b7('0x5')][_0x1b3497]['timer']=![];var _0x5dba35=_0x2dd832[_0x98b7('0x5')][_0x1b3497][_0x98b7('0x2a')];var _0x398e8d=_0x2dd832[_0x98b7('0x5')][_0x1b3497][_0x98b7('0x17')];var _0x33f3a4=_0x2dd832[_0x98b7('0x18')][_0x398e8d]['acwTimeout'];logger[_0x98b7('0x21')]('[%s][TIMER][STOP][AGENT:%s]',_0x5dba35,_0x1b3497);RpcUser[_0x98b7('0x35')](this['agents'][_0x1b3497]);RpcVoiceAgentReport[_0x98b7('0x2c')]({'acwtime':_0x33f3a4,'agentacw':!![]},_0x5dba35,_0x1b3497)['then'](function(_0x26034b){logger['info'](_0x98b7('0x2d'),_0x5dba35,_0x33f3a4,_0x26034b);})[_0x98b7('0x2e')](function(_0x842f2d){logger['error'](_0x98b7('0x2f'),_0x5dba35,_0x842f2d);});}else{logger[_0x98b7('0x31')](_0x98b7('0x36'),_0x1b3497);if(_0x2dd832[_0x98b7('0x5')]){logger[_0x98b7('0x21')](_0x98b7('0x37'),JSON[_0x98b7('0x38')](_0x2dd832[_0x98b7('0x5')]));}}}catch(_0x501ca6){logger[_0x98b7('0x31')]('[ACW][STOP]\x20%s',_0x501ca6[_0x98b7('0x39')]);}};Acw[_0x98b7('0x16')][_0x98b7('0x7')]=function(_0x2dc129){try{if(this[_0x98b7('0x18')][_0x2dc129[_0x98b7('0x17')]]&&(this[_0x98b7('0x18')][_0x2dc129[_0x98b7('0x17')]][_0x98b7('0x3a')]||this[_0x98b7('0x18')][_0x2dc129[_0x98b7('0x17')]][_0x98b7('0x3b')])){if(this[_0x98b7('0x4')][_0x2dc129[_0x98b7('0x3c')]]){this[_0x98b7('0x6')][_0x2dc129[_0x98b7('0x2a')]]={'queue':_0x2dc129[_0x98b7('0x17')],'interface':_0x2dc129[_0x98b7('0x3c')],'destlinkedid':_0x2dc129[_0x98b7('0x23')]};}}}catch(_0x2a3eb6){logger[_0x98b7('0x31')](_0x98b7('0x3d'),_0x2a3eb6[_0x98b7('0x39')]);}};Acw[_0x98b7('0x16')][_0x98b7('0x12')]=function(_0x1a2909){try{if(this[_0x98b7('0x18')][_0x1a2909[_0x98b7('0x17')]]&&(this[_0x98b7('0x18')][_0x1a2909[_0x98b7('0x17')]][_0x98b7('0x3a')]||this[_0x98b7('0x18')][_0x1a2909[_0x98b7('0x17')]][_0x98b7('0x3b')])){if(this[_0x98b7('0x4')][_0x1a2909['interface']]){this[_0x98b7('0x6')][_0x1a2909['uniqueid']]={'queue':_0x1a2909['queue'],'interface':_0x1a2909[_0x98b7('0x3c')]};}}}catch(_0x2d2137){logger[_0x98b7('0x31')](_0x98b7('0x3e'),_0x2d2137[_0x98b7('0x39')]);}};Acw[_0x98b7('0x16')][_0x98b7('0x9')]=function(_0x41c112){try{if(this['channels'][_0x41c112[_0x98b7('0x2a')]]&&_['isUndefined'](this['channels'][_0x41c112[_0x98b7('0x2a')]][_0x98b7('0x3f')])){logger['info'](_0x98b7('0x40'),_0x41c112[_0x98b7('0x2a')]);this[_0x98b7('0x41')](_0x41c112['uniqueid']);}else if(this['channels'][_0x41c112[_0x98b7('0x42')]]&&_[_0x98b7('0x43')](this['channels'][_0x41c112['linkedid']][_0x98b7('0x3f')])){logger[_0x98b7('0x21')](_0x98b7('0x44'),_0x41c112['linkedid']);this[_0x98b7('0x41')](_0x41c112['linkedid']);}}catch(_0x2bc160){logger['error'](_0x98b7('0x45'),_0x2bc160['message']);}};Acw[_0x98b7('0x16')][_0x98b7('0xb')]=function(_0x2f1943){try{if(this[_0x98b7('0x6')][_0x2f1943['uniqueid']]&&this['channels'][_0x2f1943[_0x98b7('0x2a')]]['attended']){logger[_0x98b7('0x21')](_0x98b7('0x46'),_0x2f1943[_0x98b7('0x2a')]);this[_0x98b7('0x41')](_0x2f1943['uniqueid']);}else if(this['channels'][_0x2f1943['linkedid']]&&this[_0x98b7('0x6')][_0x2f1943['linkedid']][_0x98b7('0x3f')]){logger[_0x98b7('0x21')](_0x98b7('0x47'),_0x2f1943[_0x98b7('0x42')]);this[_0x98b7('0x41')](_0x2f1943[_0x98b7('0x42')]);}}catch(_0x44e3c6){logger[_0x98b7('0x31')]('[ACW][syncHangup]\x20%s',_0x44e3c6[_0x98b7('0x39')]);}};Acw[_0x98b7('0x16')]['syncAttendedTransfer']=function(_0x38200a){try{if(!_['isNil'](this['channels'][_0x38200a[_0x98b7('0x48')]])){this[_0x98b7('0x41')](_0x38200a['transfereeuniqueid']);if(this['channels'][_0x38200a[_0x98b7('0x49')]]){this['channels'][_0x38200a[_0x98b7('0x49')]][_0x98b7('0x3f')]=!![];this['channels'][_0x38200a[_0x98b7('0x4a')]]=this[_0x98b7('0x6')][_0x38200a[_0x98b7('0x49')]];delete this[_0x98b7('0x6')][_0x38200a['secondtransfereruniqueid']];}}else if(!_[_0x98b7('0x4b')](this[_0x98b7('0x6')][_0x38200a['transfertargetuniqueid']])){this[_0x98b7('0x41')](_0x38200a[_0x98b7('0x4a')]);if(this['channels'][_0x38200a[_0x98b7('0x4c')]]){this[_0x98b7('0x6')][_0x38200a[_0x98b7('0x4c')]][_0x98b7('0x3f')]=!![];this[_0x98b7('0x6')][_0x38200a[_0x98b7('0x48')]]=this[_0x98b7('0x6')][_0x38200a[_0x98b7('0x4c')]];delete this[_0x98b7('0x6')][_0x38200a['origtransfereruniqueid']];}}}catch(_0x15053a){logger[_0x98b7('0x31')](_0x98b7('0x4d'),_0x15053a[_0x98b7('0x39')]);}};Acw['prototype'][_0x98b7('0x11')]=function(_0x2f7c53){try{if(this['channels'][_0x2f7c53[_0x98b7('0x4e')]]){logger[_0x98b7('0x21')](_0x98b7('0x4f'),JSON[_0x98b7('0x38')](_0x2f7c53[_0x98b7('0x4e')]));this[_0x98b7('0x41')](_0x2f7c53[_0x98b7('0x4e')]);}else if(this[_0x98b7('0x6')][_0x2f7c53['transfererlinkedid']]){logger[_0x98b7('0x21')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x98b7('0x38')](_0x2f7c53['transfererlinkedid']));this[_0x98b7('0x41')](_0x2f7c53['transfererlinkedid']);}}catch(_0x4c8a52){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x4c8a52['message']);}};Acw['prototype'][_0x98b7('0xd')]=function(_0x12aaa){try{if(this['voiceQueues'][_0x12aaa[_0x98b7('0x17')]]&&this[_0x98b7('0x18')][_0x12aaa[_0x98b7('0x17')]]['autopause']===_0x98b7('0x50')){if(this[_0x98b7('0x4')][_0x12aaa[_0x98b7('0x3c')]]){logger[_0x98b7('0x21')](_0x98b7('0x51'),_0x12aaa[_0x98b7('0x2a')],_0x12aaa[_0x98b7('0x3c')],_0x12aaa[_0x98b7('0x17')]);return RpcUser['savePause'](this[_0x98b7('0x4')][_0x12aaa['interface']],_0x98b7('0x52'),_0x12aaa['uniqueid']);}}}catch(_0x4cddd0){logger[_0x98b7('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4cddd0[_0x98b7('0x39')]);}};module[_0x98b7('0x53')]=Acw; \ No newline at end of file +var _0x8e39=['transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','milliseconds','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timers','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','mandatoryDisposition','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','stringify'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8e39,0xfe));var _0x98e3=function(_0x577727,_0x5b41e7){_0x577727=_0x577727-0x0;var _0x4c4270=_0x8e39[_0x577727];return _0x4c4270;};'use strict';var util=require(_0x98e3('0x0'));var _=require(_0x98e3('0x1'));var moment=require(_0x98e3('0x2'));var ami=require(_0x98e3('0x3'));var logger=require(_0x98e3('0x4'))('acw');var RpcUser=require(_0x98e3('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1cd5ae){this[_0x98e3('0x6')]=_0x1cd5ae['voiceQueues'];this[_0x98e3('0x7')]=_0x1cd5ae[_0x98e3('0x7')];this['timers']=_0x1cd5ae['timers'];this[_0x98e3('0x8')]={};ami['on']('agentconnect',this[_0x98e3('0x9')][_0x98e3('0xa')](this));ami['on'](_0x98e3('0xb'),this[_0x98e3('0xc')][_0x98e3('0xa')](this));ami['on'](_0x98e3('0xd'),this[_0x98e3('0xe')][_0x98e3('0xa')](this));ami['on'](_0x98e3('0xf'),this[_0x98e3('0x10')][_0x98e3('0xa')](this));ami['on'](_0x98e3('0x11'),this[_0x98e3('0x12')][_0x98e3('0xa')](this));ami['on'](_0x98e3('0x13'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x98e3('0x14'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x27d86a){var _0x29de30=moment()[_0x98e3('0x15')](0x0);var _0x4a1b8d=moment(_0x27d86a)[_0x98e3('0x15')](0x0);return _0x29de30['diff'](_0x4a1b8d,'seconds');}Acw['prototype'][_0x98e3('0x16')]=function(_0x252aab){try{var _0x1b38fd=this;var _0x1da97d=this[_0x98e3('0x8')][_0x252aab][_0x98e3('0x17')];var _0x279c55=this[_0x98e3('0x8')][_0x252aab][_0x98e3('0x18')];var _0x126ce1=this[_0x98e3('0x6')][_0x279c55];var _0x44abdb=![];var _0x1651ab=_0x98e3('0x19');if(_0x126ce1['mandatoryDisposition']){if(_0x126ce1[_0x98e3('0x1a')][_0x98e3('0x1b')]){_0x44abdb=!![];_0x1651ab=_0x126ce1[_0x98e3('0x1a')][_0x98e3('0x1b')];}}ami[_0x98e3('0x1c')]({'action':'QueuePause','interface':_0x1da97d,'paused':!![],'reason':_0x1651ab})[_0x98e3('0x1d')](function(_0x2b57b8){if(_0x1b38fd['agents'][_0x1da97d]){return RpcUser[_0x98e3('0x1e')](_0x1b38fd['agents'][_0x1da97d]['id'])[_0x98e3('0x1d')](function(_0x31f39d){if(_0x31f39d&&!_0x31f39d['voicePause']){logger['info'](_0x98e3('0x1f'),_0x252aab,_0x1da97d,_0x279c55);var _0x586b87=_0x1b38fd['channels'][_0x252aab][_0x98e3('0x20')]&&_0x1b38fd[_0x98e3('0x8')][_0x252aab][_0x98e3('0x21')]?_0x1b38fd[_0x98e3('0x8')][_0x252aab][_0x98e3('0x21')]:_0x252aab;return RpcUser[_0x98e3('0x22')](_0x1b38fd[_0x98e3('0x7')][_0x1da97d],_0x1651ab,_0x586b87)[_0x98e3('0x1d')](function(_0x5d625b){if(!_0x44abdb){_0x1b38fd['timers'][_0x1da97d]={};logger['info'](_0x98e3('0x23'),_0x252aab,_0x1b38fd[_0x98e3('0x6')][_0x279c55][_0x98e3('0x24')],_0x1da97d,_0x279c55);_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x26')]=setTimeout(_0x1b38fd[_0x98e3('0x27')][_0x98e3('0xa')](_0x1b38fd,_0x1da97d),_0x1b38fd[_0x98e3('0x6')][_0x279c55][_0x98e3('0x24')]*0x3e8);_0x1b38fd['timers'][_0x1da97d][_0x98e3('0x28')]=moment()['format'](_0x98e3('0x29'));_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x2a')]=_0x252aab;_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x18')]=_0x279c55;_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x2b')]=function(){var _0x4431e6=getDiff(_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x28')]);clearTimeout(_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x26')]);_0x1b38fd[_0x98e3('0x25')][_0x1da97d][_0x98e3('0x26')]=![];RpcVoiceAgentReport[_0x98e3('0x2c')]({'acwtime':_0x4431e6},_0x1b38fd[_0x98e3('0x25')][_0x1da97d]['uniqueid'],_0x1da97d)[_0x98e3('0x1d')](function(_0x483fba){logger[_0x98e3('0x2d')](_0x98e3('0x2e'),_0x252aab,_0x4431e6,_0x483fba);})['catch'](function(_0x49870b){logger[_0x98e3('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x252aab,_0x49870b);});delete _0x1b38fd[_0x98e3('0x25')][_0x1da97d];};}});}else{logger['info'](_0x98e3('0x30'),_0x252aab,_0x1da97d,_0x279c55);}});}})['catch'](function(_0x278bf4){logger['error'](_0x98e3('0x23'),_0x252aab,_0x1b38fd['voiceQueues'][_0x279c55][_0x98e3('0x24')],_0x1da97d,_0x279c55);})['finally'](function(){delete _0x1b38fd['channels'][_0x252aab];});}catch(_0x18b910){logger['error'](_0x98e3('0x31'),_0x18b910[_0x98e3('0x32')]);}};Acw[_0x98e3('0x33')]['stopAcw']=function(_0x12ff05){try{var _0x4c20b4=this;if(_0x4c20b4[_0x98e3('0x25')][_0x12ff05]){_0x4c20b4[_0x98e3('0x25')][_0x12ff05][_0x98e3('0x26')]=![];var _0x5cb414=_0x4c20b4['timers'][_0x12ff05][_0x98e3('0x2a')];var _0x10b494=_0x4c20b4[_0x98e3('0x25')][_0x12ff05]['queue'];var _0x1f8334=_0x4c20b4[_0x98e3('0x6')][_0x10b494][_0x98e3('0x24')];logger[_0x98e3('0x2d')](_0x98e3('0x34'),_0x5cb414,_0x12ff05);RpcUser[_0x98e3('0x35')](this['agents'][_0x12ff05]);RpcVoiceAgentReport[_0x98e3('0x2c')]({'acwtime':_0x1f8334,'agentacw':!![]},_0x5cb414,_0x12ff05)[_0x98e3('0x1d')](function(_0x103ef3){logger[_0x98e3('0x2d')]('[%s][UPDATE][ACWTIME:%s]',_0x5cb414,_0x1f8334,_0x103ef3);})['catch'](function(_0x38f83a){logger[_0x98e3('0x2f')](_0x98e3('0x36'),_0x5cb414,_0x38f83a);});}else{logger[_0x98e3('0x2f')](_0x98e3('0x37'),_0x12ff05);if(_0x4c20b4[_0x98e3('0x25')]){logger['info'](_0x98e3('0x38'),JSON['stringify'](_0x4c20b4[_0x98e3('0x25')]));}}}catch(_0x3d3080){logger[_0x98e3('0x2f')](_0x98e3('0x39'),_0x3d3080[_0x98e3('0x32')]);}};Acw[_0x98e3('0x33')]['syncAgentConnect']=function(_0x46cdd2){try{if(this[_0x98e3('0x6')][_0x46cdd2[_0x98e3('0x18')]]&&(this[_0x98e3('0x6')][_0x46cdd2['queue']][_0x98e3('0x3a')]||this[_0x98e3('0x6')][_0x46cdd2['queue']]['mandatoryDisposition'])){if(this['agents'][_0x46cdd2[_0x98e3('0x17')]]){this[_0x98e3('0x8')][_0x46cdd2['uniqueid']]={'queue':_0x46cdd2[_0x98e3('0x18')],'interface':_0x46cdd2['interface'],'destlinkedid':_0x46cdd2[_0x98e3('0x21')]};}}}catch(_0x12967e){logger['error'](_0x98e3('0x3b'),_0x12967e[_0x98e3('0x32')]);}};Acw[_0x98e3('0x33')][_0x98e3('0x3c')]=function(_0x1ccd78){try{if(this[_0x98e3('0x6')][_0x1ccd78[_0x98e3('0x18')]]&&(this[_0x98e3('0x6')][_0x1ccd78[_0x98e3('0x18')]]['acw']||this[_0x98e3('0x6')][_0x1ccd78[_0x98e3('0x18')]][_0x98e3('0x3d')])){if(this[_0x98e3('0x7')][_0x1ccd78[_0x98e3('0x17')]]){this[_0x98e3('0x8')][_0x1ccd78[_0x98e3('0x2a')]]={'queue':_0x1ccd78['queue'],'interface':_0x1ccd78[_0x98e3('0x17')]};}}}catch(_0x4f9be3){logger[_0x98e3('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4f9be3[_0x98e3('0x32')]);}};Acw[_0x98e3('0x33')][_0x98e3('0xc')]=function(_0xe5d899){try{if(this[_0x98e3('0x8')][_0xe5d899[_0x98e3('0x2a')]]&&_[_0x98e3('0x3e')](this[_0x98e3('0x8')][_0xe5d899[_0x98e3('0x2a')]][_0x98e3('0x20')])){logger['info'](_0x98e3('0x3f'),_0xe5d899[_0x98e3('0x2a')]);this[_0x98e3('0x16')](_0xe5d899[_0x98e3('0x2a')]);}else if(this[_0x98e3('0x8')][_0xe5d899[_0x98e3('0x40')]]&&_[_0x98e3('0x3e')](this[_0x98e3('0x8')][_0xe5d899[_0x98e3('0x40')]][_0x98e3('0x20')])){logger[_0x98e3('0x2d')]('[%s][HANGUP:LINKEDID]',_0xe5d899[_0x98e3('0x40')]);this['startAcw'](_0xe5d899['linkedid']);}}catch(_0x3a3570){logger['error'](_0x98e3('0x41'),_0x3a3570['message']);}};Acw[_0x98e3('0x33')][_0x98e3('0xe')]=function(_0x441d45){try{if(this['channels'][_0x441d45['uniqueid']]&&this[_0x98e3('0x8')][_0x441d45['uniqueid']][_0x98e3('0x20')]){logger[_0x98e3('0x2d')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x441d45[_0x98e3('0x2a')]);this[_0x98e3('0x16')](_0x441d45[_0x98e3('0x2a')]);}else if(this['channels'][_0x441d45[_0x98e3('0x40')]]&&this[_0x98e3('0x8')][_0x441d45['linkedid']]['attended']){logger[_0x98e3('0x2d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x441d45[_0x98e3('0x40')]);this['startAcw'](_0x441d45['linkedid']);}}catch(_0x45992e){logger['error'](_0x98e3('0x42'),_0x45992e['message']);}};Acw[_0x98e3('0x33')][_0x98e3('0x12')]=function(_0x247de7){try{if(!_[_0x98e3('0x43')](this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x44')]])){this[_0x98e3('0x16')](_0x247de7['transfereeuniqueid']);if(this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x45')]]){this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x45')]]['attended']=!![];this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x46')]]=this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x45')]];delete this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x45')]];}}else if(!_[_0x98e3('0x43')](this[_0x98e3('0x8')][_0x247de7['transfertargetuniqueid']])){this['startAcw'](_0x247de7[_0x98e3('0x46')]);if(this[_0x98e3('0x8')][_0x247de7['origtransfereruniqueid']]){this['channels'][_0x247de7[_0x98e3('0x47')]][_0x98e3('0x20')]=!![];this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x44')]]=this[_0x98e3('0x8')][_0x247de7['origtransfereruniqueid']];delete this[_0x98e3('0x8')][_0x247de7[_0x98e3('0x47')]];}}}catch(_0x50fe8f){logger[_0x98e3('0x2f')]('[ACW][syncAttendedTransfer]\x20%s',_0x50fe8f[_0x98e3('0x32')]);}};Acw[_0x98e3('0x33')]['syncBlindTransfer']=function(_0x46fb67){try{if(this[_0x98e3('0x8')][_0x46fb67[_0x98e3('0x48')]]){logger[_0x98e3('0x2d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x98e3('0x49')](_0x46fb67[_0x98e3('0x48')]));this[_0x98e3('0x16')](_0x46fb67[_0x98e3('0x48')]);}else if(this[_0x98e3('0x8')][_0x46fb67[_0x98e3('0x4a')]]){logger[_0x98e3('0x2d')](_0x98e3('0x4b'),JSON[_0x98e3('0x49')](_0x46fb67[_0x98e3('0x4a')]));this['startAcw'](_0x46fb67[_0x98e3('0x4a')]);}}catch(_0x344f36){logger[_0x98e3('0x2f')](_0x98e3('0x4c'),_0x344f36['message']);}};Acw['prototype'][_0x98e3('0x10')]=function(_0x26c217){try{if(this[_0x98e3('0x6')][_0x26c217['queue']]&&this[_0x98e3('0x6')][_0x26c217[_0x98e3('0x18')]][_0x98e3('0x4d')]===_0x98e3('0x4e')){if(this[_0x98e3('0x7')][_0x26c217['interface']]){logger['info'](_0x98e3('0x4f'),_0x26c217[_0x98e3('0x2a')],_0x26c217[_0x98e3('0x17')],_0x26c217[_0x98e3('0x18')]);return RpcUser[_0x98e3('0x22')](this[_0x98e3('0x7')][_0x26c217['interface']],_0x98e3('0x50'),_0x26c217['uniqueid']);}}}catch(_0x162b44){logger[_0x98e3('0x2f')](_0x98e3('0x51'),_0x162b44[_0x98e3('0x32')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b142c1b..9c5169d 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 _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(_0x3f6ba0,_0x34330f){var _0x107411=function(_0x3899c1){while(--_0x3899c1){_0x3f6ba0['push'](_0x3f6ba0['shift']());}};_0x107411(++_0x34330f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 +var _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x41b09b,_0x563a70){var _0x7db00d=function(_0xa3c32f){while(--_0xa3c32f){_0x41b09b['push'](_0x41b09b['shift']());}};_0x7db00d(++_0x563a70);}(_0xb10b,0x12a));var _0xbb10=function(_0x1026d2,_0x42fe66){_0x1026d2=_0x1026d2-0x0;var _0x4a6773=_0xb10b[_0x1026d2];return _0x4a6773;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 06f52f2..f5a0d86 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 _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x3e7629,_0x13c23e){var _0x2d812f=function(_0x2aa6c1){while(--_0x2aa6c1){_0x3e7629['push'](_0x3e7629['shift']());}};_0x2d812f(++_0x13c23e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x37e90d,_0xb6736){_0x37e90d=_0x37e90d-0x0;var _0x4499a7=_0x9ffd[_0x37e90d];return _0x4499a7;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcb91[_0x19950b];return _0x3c6b41;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('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 724f1af..5f800fc 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 _0x4dfc=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','voiceQueue','getQueue','exports','util','lodash','string','isNil','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x57c695,_0x20d10b){var _0x3509a4=function(_0x3a8ce8){while(--_0x3a8ce8){_0x57c695['push'](_0x57c695['shift']());}};_0x3509a4(++_0x20d10b);}(_0x4dfc,0x173));var _0xc4df=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0x4dfc[_0x446e61];return _0x4160a8;};'use strict';var util=require(_0xc4df('0x0'));var _=require(_0xc4df('0x1'));var moment=require('moment');function checkNameSurname(_0x54e7ce,_0x1878f8,_0x1d9b23){var _0x2e08bc='';if(!_['isNil'](_0x1878f8)&&_0xc4df('0x2')===typeof _0x1878f8){_0x2e08bc+=_0x1878f8;}if(!_[_0xc4df('0x3')](_0x1d9b23)&&_0xc4df('0x2')===typeof _0x1d9b23){_0x2e08bc+='\x20'+_0x1d9b23;}if(_0x2e08bc!==''){return _0x2e08bc;}return _0x54e7ce;}function Action(_0x3904cb,_0x403649,_0xb8d1e5){this['voiceQueue']=_0x3904cb;this[_0xc4df('0x4')]=_0xb8d1e5||undefined;this[_0xc4df('0x5')]=checkNameSurname(_0x403649[_0xc4df('0x6')][_0xc4df('0x7')],_0x403649[_0xc4df('0x6')][_0xc4df('0x8')],_0x403649[_0xc4df('0x6')][_0xc4df('0x9')]);this['number']=_0x403649[_0xc4df('0x7')];this[_0xc4df('0xa')]=_0x3904cb[_0xc4df('0x5')];this[_0xc4df('0xb')]=_0x403649[_0xc4df('0xb')]||![];this['type']=_0x3904cb[_0xc4df('0xc')];this[_0xc4df('0xd')]=_0x3904cb[_0xc4df('0xd')]||0x3;this['scheduledat']=_0x403649[_0xc4df('0xe')];this[_0xc4df('0xf')]=_0x403649[_0xc4df('0xf')];this[_0xc4df('0x10')]=_0x403649[_0xc4df('0x10')];this[_0xc4df('0x11')]=_0x403649[_0xc4df('0x11')];this[_0xc4df('0x12')]=_0x403649['countnosuchnumberretry'];this[_0xc4df('0x13')]=_0x403649[_0xc4df('0x13')];this[_0xc4df('0x14')]=_0x403649[_0xc4df('0x14')];this[_0xc4df('0x15')]=_0x403649[_0xc4df('0x15')];this[_0xc4df('0x16')]=_0x403649[_0xc4df('0x16')];this[_0xc4df('0x17')]=_0x403649[_0xc4df('0x17')];this['ListId']=_0x403649[_0xc4df('0x18')];this[_0xc4df('0x19')]=_0x403649[_0xc4df('0x19')];this[_0xc4df('0x1a')]=_0x403649[_0xc4df('0x1a')];this[_0xc4df('0x1b')]=_0x403649[_0xc4df('0x1b')];this[_0xc4df('0x1c')]=_0x403649['id'];this['ContactFirstName']=_0x403649['Contact']['firstName']||'';this['starttime']=moment()[_0xc4df('0x1d')](_0xc4df('0x1e'));this['callback']=_0x403649['callback'];this['callbackuniqueid']=_0x403649[_0xc4df('0x1f')];this[_0xc4df('0x20')]=_0x403649[_0xc4df('0x20')];this['recallme']=_0x403649[_0xc4df('0x21')];this[_0xc4df('0x22')]='';this[_0xc4df('0x23')]='';}Action[_0xc4df('0x24')][_0xc4df('0x25')]=function(){return util[_0xc4df('0x1d')](_0xc4df('0x26'),this[_0xc4df('0x5')],this['voiceQueue'][_0xc4df('0x27')]>0x0?this['number']['substring'](this[_0xc4df('0x28')][_0xc4df('0x27')]):this['number']);};Action['prototype'][_0xc4df('0x29')]=function(){return this[_0xc4df('0xa')];};module[_0xc4df('0x2a')]=Action; \ No newline at end of file +var _0x9be4=['\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','phone','Contact','firstName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype'];(function(_0x219588,_0x4f38e2){var _0x575304=function(_0x2495cf){while(--_0x2495cf){_0x219588['push'](_0x219588['shift']());}};_0x575304(++_0x4f38e2);}(_0x9be4,0x83));var _0x49be=function(_0x55ac61,_0x3a1709){_0x55ac61=_0x55ac61-0x0;var _0x13413b=_0x9be4[_0x55ac61];return _0x13413b;};'use strict';var util=require(_0x49be('0x0'));var _=require('lodash');var moment=require(_0x49be('0x1'));function checkNameSurname(_0x4356f4,_0x55a69c,_0x13adf5){var _0x419ec6='';if(!_[_0x49be('0x2')](_0x55a69c)&&_0x49be('0x3')===typeof _0x55a69c){_0x419ec6+=_0x55a69c;}if(!_[_0x49be('0x2')](_0x13adf5)&&_0x49be('0x3')===typeof _0x13adf5){_0x419ec6+='\x20'+_0x13adf5;}if(_0x419ec6!==''){return _0x419ec6;}return _0x4356f4;}function Action(_0x45f85c,_0x223be7,_0x10d281){this[_0x49be('0x4')]=_0x45f85c;this['uniqueid']=_0x10d281||undefined;this['name']=checkNameSurname(_0x223be7['Contact'][_0x49be('0x5')],_0x223be7[_0x49be('0x6')][_0x49be('0x7')],_0x223be7[_0x49be('0x6')]['lastName']);this[_0x49be('0x8')]=_0x223be7['phone'];this[_0x49be('0x9')]=_0x45f85c[_0x49be('0xa')];this[_0x49be('0xb')]=_0x223be7[_0x49be('0xb')]||![];this[_0x49be('0xc')]=_0x45f85c[_0x49be('0xc')];this[_0x49be('0xd')]=_0x45f85c[_0x49be('0xd')]||0x3;this['scheduledat']=_0x223be7[_0x49be('0xe')];this[_0x49be('0xf')]=_0x223be7[_0x49be('0xf')];this[_0x49be('0x10')]=_0x223be7['countcongestionretry'];this[_0x49be('0x11')]=_0x223be7[_0x49be('0x11')];this[_0x49be('0x12')]=_0x223be7['countnosuchnumberretry'];this[_0x49be('0x13')]=_0x223be7[_0x49be('0x13')];this[_0x49be('0x14')]=_0x223be7['countabandonedretry'];this['countmachineretry']=_0x223be7['countmachineretry'];this['countagentrejectretry']=_0x223be7[_0x49be('0x15')];this[_0x49be('0x16')]=_0x223be7['ContactId'];this[_0x49be('0x17')]=_0x223be7[_0x49be('0x17')];this[_0x49be('0x18')]=_0x223be7[_0x49be('0x18')];this[_0x49be('0x19')]=_0x223be7[_0x49be('0x19')];this[_0x49be('0x1a')]=_0x223be7[_0x49be('0x1a')];this[_0x49be('0x1b')]=_0x223be7['id'];this[_0x49be('0x1c')]=_0x223be7[_0x49be('0x6')][_0x49be('0x7')]||'';this[_0x49be('0x1d')]=moment()[_0x49be('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x49be('0x1f')]=_0x223be7[_0x49be('0x1f')];this['callbackuniqueid']=_0x223be7[_0x49be('0x20')];this[_0x49be('0x21')]=_0x223be7[_0x49be('0x21')];this[_0x49be('0x22')]=_0x223be7[_0x49be('0x22')];this['originatecalleridnum']='';this[_0x49be('0x23')]='';}Action[_0x49be('0x24')]['getCaller']=function(){return util[_0x49be('0x1e')](_0x49be('0x25'),this[_0x49be('0xa')],this['voiceQueue'][_0x49be('0x26')]>0x0?this[_0x49be('0x8')][_0x49be('0x27')](this[_0x49be('0x4')]['dialCutDigit']):this['number']);};Action[_0x49be('0x24')][_0x49be('0x28')]=function(){return this['queue'];};module[_0x49be('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 91a597d..ec13f79 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 _0x9172=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x1c14f7,_0x2d36d1){var _0x428020=function(_0x4636dd){while(--_0x4636dd){_0x1c14f7['push'](_0x1c14f7['shift']());}};_0x428020(++_0x2d36d1);}(_0x9172,0xe8));var _0x2917=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x9172[_0x38ced4];return _0x547c07;};'use strict';var util=require(_0x2917('0x0'));var _=require('lodash');var moment=require(_0x2917('0x1'));function getSeconds(_0x1d2c01,_0x77e381){var _0x5e47b8=moment(_0x1d2c01)[_0x2917('0x2')](0x0);var _0x1a5a43=moment(_0x77e381)[_0x2917('0x2')](0x0);return _0x5e47b8[_0x2917('0x3')](_0x1a5a43,_0x2917('0x4'));}function AgentComplete(_0x8960e8,_0x5da1a6){this[_0x2917('0x5')]=0x4;this[_0x2917('0x6')]='Answer';this[_0x2917('0x7')]=_0x8960e8[_0x2917('0x7')];this[_0x2917('0x8')]=_0x8960e8[_0x2917('0x8')];this['campaigntype']=_0x8960e8[_0x2917('0x8')]===_0x2917('0x9')?_0x2917('0xa'):_0x8960e8[_0x2917('0x8')];this['countbusyretry']=_0x8960e8[_0x2917('0xb')];this[_0x2917('0xc')]=_0x8960e8[_0x2917('0xc')];this[_0x2917('0xd')]=_0x8960e8[_0x2917('0xd')];this[_0x2917('0xe')]=_0x8960e8[_0x2917('0xb')]+_0x8960e8[_0x2917('0xc')]+_0x8960e8['countnoanswerretry']+_0x8960e8[_0x2917('0xf')]+_0x8960e8['countdropretry']+_0x8960e8[_0x2917('0x10')]+_0x8960e8[_0x2917('0x11')]+_0x8960e8[_0x2917('0x12')];this[_0x2917('0xf')]=_0x8960e8[_0x2917('0xf')];this[_0x2917('0x13')]=_0x8960e8[_0x2917('0x13')];this[_0x2917('0x10')]=_0x8960e8[_0x2917('0x10')];this[_0x2917('0x11')]=_0x8960e8[_0x2917('0x11')];this[_0x2917('0x12')]=_0x8960e8[_0x2917('0x12')];this['uniqueid']=_0x5da1a6[_0x2917('0x14')];this[_0x2917('0x15')]=_0x8960e8['name'];this[_0x2917('0x16')]=_0x8960e8['number'];this[_0x2917('0x17')]=_0x8960e8[_0x2917('0x17')];this[_0x2917('0x18')]=_0x8960e8[_0x2917('0x18')];this[_0x2917('0x19')]=_0x8960e8[_0x2917('0x19')];this[_0x2917('0x1a')]=moment()[_0x2917('0x1b')](_0x2917('0x1c'));this['ringtime']=getSeconds(_0x8960e8[_0x2917('0x18')],_0x8960e8[_0x2917('0x17')]);this['holdtime']=getSeconds(_0x8960e8[_0x2917('0x19')],_0x8960e8[_0x2917('0x18')]);this['talktime']=getSeconds(this[_0x2917('0x1a')],_0x8960e8[_0x2917('0x19')]);this[_0x2917('0xa')]=_0x5da1a6[_0x2917('0xa')];this[_0x2917('0x1d')]=_0x5da1a6[_0x2917('0x1d')];this['reason']=_0x5da1a6[_0x2917('0x1e')];this['callback']=_0x8960e8[_0x2917('0x1f')];this[_0x2917('0x20')]=_0x8960e8[_0x2917('0x20')];this[_0x2917('0x21')]=_0x8960e8[_0x2917('0x21')];this['recallme']=_0x8960e8[_0x2917('0x22')];this[_0x2917('0x23')]=_0x8960e8[_0x2917('0x23')];this[_0x2917('0x24')]=_0x8960e8[_0x2917('0x24')];this[_0x2917('0x25')]=_0x8960e8['UserId'];this[_0x2917('0x26')]=_0x8960e8[_0x2917('0x26')];this[_0x2917('0x27')]=_0x8960e8[_0x2917('0x27')];this['originatecalleridnum']=_0x8960e8['originatecalleridnum']||'';this[_0x2917('0x28')]=_0x8960e8[_0x2917('0x28')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xacd1=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x1ce7b9,_0xd57402){var _0x51de59=function(_0x3e58f0){while(--_0x3e58f0){_0x1ce7b9['push'](_0x1ce7b9['shift']());}};_0x51de59(++_0xd57402);}(_0xacd1,0x13b));var _0x1acd=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0xacd1[_0x2390bd];return _0x3a969d;};'use strict';var util=require(_0x1acd('0x0'));var _=require(_0x1acd('0x1'));var moment=require(_0x1acd('0x2'));function getSeconds(_0x44e64c,_0x53c1ea){var _0x5af22e=moment(_0x44e64c)['milliseconds'](0x0);var _0x5d3d63=moment(_0x53c1ea)[_0x1acd('0x3')](0x0);return _0x5af22e[_0x1acd('0x4')](_0x5d3d63,_0x1acd('0x5'));}function AgentComplete(_0x68066a,_0x272fdb){this['state']=0x4;this[_0x1acd('0x6')]=_0x1acd('0x7');this[_0x1acd('0x8')]=_0x68066a[_0x1acd('0x8')];this['type']=_0x68066a[_0x1acd('0x9')];this['campaigntype']=_0x68066a[_0x1acd('0x9')]==='outbound'?_0x1acd('0xa'):_0x68066a[_0x1acd('0x9')];this['countbusyretry']=_0x68066a[_0x1acd('0xb')];this[_0x1acd('0xc')]=_0x68066a[_0x1acd('0xc')];this['countnoanswerretry']=_0x68066a[_0x1acd('0xd')];this[_0x1acd('0xe')]=_0x68066a[_0x1acd('0xb')]+_0x68066a[_0x1acd('0xc')]+_0x68066a[_0x1acd('0xd')]+_0x68066a['countnosuchnumberretry']+_0x68066a[_0x1acd('0xf')]+_0x68066a[_0x1acd('0x10')]+_0x68066a['countmachineretry']+_0x68066a[_0x1acd('0x11')];this['countnosuchnumberretry']=_0x68066a[_0x1acd('0x12')];this['countdropretry']=_0x68066a[_0x1acd('0xf')];this[_0x1acd('0x10')]=_0x68066a['countabandonedretry'];this[_0x1acd('0x13')]=_0x68066a[_0x1acd('0x13')];this[_0x1acd('0x11')]=_0x68066a[_0x1acd('0x11')];this['uniqueid']=_0x272fdb[_0x1acd('0x14')];this[_0x1acd('0x15')]=_0x68066a['name'];this['calleridnum']=_0x68066a['number'];this[_0x1acd('0x16')]=_0x68066a[_0x1acd('0x16')];this[_0x1acd('0x17')]=_0x68066a['responsetime'];this[_0x1acd('0x18')]=_0x68066a[_0x1acd('0x18')];this[_0x1acd('0x19')]=moment()[_0x1acd('0x1a')](_0x1acd('0x1b'));this[_0x1acd('0x1c')]=getSeconds(_0x68066a[_0x1acd('0x17')],_0x68066a[_0x1acd('0x16')]);this[_0x1acd('0x1d')]=getSeconds(_0x68066a[_0x1acd('0x18')],_0x68066a['responsetime']);this[_0x1acd('0x1e')]=getSeconds(this[_0x1acd('0x19')],_0x68066a['answertime']);this[_0x1acd('0xa')]=_0x272fdb[_0x1acd('0xa')];this[_0x1acd('0x1f')]=_0x272fdb[_0x1acd('0x1f')];this[_0x1acd('0x20')]=_0x272fdb[_0x1acd('0x20')];this[_0x1acd('0x21')]=_0x68066a['callback'];this[_0x1acd('0x22')]=_0x68066a[_0x1acd('0x22')];this[_0x1acd('0x23')]=_0x68066a['callbackat'];this[_0x1acd('0x24')]=_0x68066a[_0x1acd('0x24')];this['ContactId']=_0x68066a[_0x1acd('0x25')];this['ListId']=_0x68066a['ListId'];this[_0x1acd('0x26')]=_0x68066a[_0x1acd('0x26')];this[_0x1acd('0x27')]=_0x68066a[_0x1acd('0x27')];this[_0x1acd('0x28')]=_0x68066a[_0x1acd('0x28')];this[_0x1acd('0x29')]=_0x68066a['originatecalleridnum']||'';this[_0x1acd('0x2a')]=_0x68066a[_0x1acd('0x2a')]||'';}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 aca5cc5..2e4bcfa 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 _0x1dcc=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat'];(function(_0x732721,_0x270fe4){var _0x9444ae=function(_0x2c8238){while(--_0x2c8238){_0x732721['push'](_0x732721['shift']());}};_0x9444ae(++_0x270fe4);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x22832b,_0x478ecb){_0x22832b=_0x22832b-0x0;var _0x269b11=_0x1dcc[_0x22832b];return _0x269b11;};'use strict';var util=require(_0xc1dc('0x0'));var _=require(_0xc1dc('0x1'));var moment=require(_0xc1dc('0x2'));function getSeconds(_0x151f37,_0x5c9880){var _0x934769=moment(_0x151f37)['milliseconds'](0x0);var _0x20abc9=moment(_0x5c9880)[_0xc1dc('0x3')](0x0);return _0x934769[_0xc1dc('0x4')](_0x20abc9,'seconds');}function Final(_0x4ad50f){this[_0xc1dc('0x5')]=_0x4ad50f[_0xc1dc('0x5')];this[_0xc1dc('0x6')]=_0x4ad50f['scheduledat'];this[_0xc1dc('0x7')]=_0x4ad50f[_0xc1dc('0x7')];this['campaigntype']=_0x4ad50f[_0xc1dc('0x7')]==='outbound'?_0xc1dc('0x8'):_0x4ad50f['type'];this[_0xc1dc('0x9')]=_0x4ad50f[_0xc1dc('0x9')];this[_0xc1dc('0xa')]=_0x4ad50f[_0xc1dc('0xa')];this[_0xc1dc('0xb')]=_0x4ad50f[_0xc1dc('0xb')];this[_0xc1dc('0xc')]=_0x4ad50f[_0xc1dc('0x9')]+_0x4ad50f[_0xc1dc('0xa')]+_0x4ad50f['countnoanswerretry']+_0x4ad50f[_0xc1dc('0xd')]+_0x4ad50f[_0xc1dc('0xe')]+_0x4ad50f[_0xc1dc('0xf')]+_0x4ad50f['countmachineretry']+_0x4ad50f[_0xc1dc('0x10')];this[_0xc1dc('0xd')]=_0x4ad50f[_0xc1dc('0xd')];this[_0xc1dc('0xe')]=_0x4ad50f[_0xc1dc('0xe')];this[_0xc1dc('0xf')]=_0x4ad50f[_0xc1dc('0xf')];this[_0xc1dc('0x11')]=_0x4ad50f[_0xc1dc('0x11')];this[_0xc1dc('0x10')]=_0x4ad50f[_0xc1dc('0x10')];this['queue']=_0x4ad50f[_0xc1dc('0x8')];this[_0xc1dc('0x12')]=_0x4ad50f[_0xc1dc('0x12')];this[_0xc1dc('0x13')]=_0x4ad50f['calleridnum'];this[_0xc1dc('0x14')]=_0x4ad50f[_0xc1dc('0x14')];this['responsetime']=_0x4ad50f['responsetime'];this[_0xc1dc('0x15')]=_0x4ad50f[_0xc1dc('0x16')];this[_0xc1dc('0x17')]=_0x4ad50f[_0xc1dc('0x17')]||0x0;this[_0xc1dc('0x18')]=_0x4ad50f[_0xc1dc('0x18')]||0x0;this[_0xc1dc('0x19')]=_0x4ad50f[_0xc1dc('0x19')]||0x0;this['callback']=_0x4ad50f['callback'];this['callbackuniqueid']=_0x4ad50f[_0xc1dc('0x1a')];this[_0xc1dc('0x1b')]=_0x4ad50f['callbackat'];this[_0xc1dc('0x1c')]=_0x4ad50f[_0xc1dc('0x1c')];this[_0xc1dc('0x1d')]=_0x4ad50f[_0xc1dc('0x1d')];this[_0xc1dc('0x1e')]=_0x4ad50f[_0xc1dc('0x1e')];this[_0xc1dc('0x1f')]=_0x4ad50f[_0xc1dc('0x1f')];this[_0xc1dc('0x20')]=_0x4ad50f[_0xc1dc('0x20')];this['CampaignId']=_0x4ad50f[_0xc1dc('0x21')];this[_0xc1dc('0x22')]=_0x4ad50f[_0xc1dc('0x22')]||'';this[_0xc1dc('0x23')]=_0x4ad50f['originatecalleridname']||'';}module[_0xc1dc('0x24')]=Final; \ No newline at end of file +var _0xc21e=['originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0xf119a9,_0x5b0fa1){var _0x2e83ee=function(_0x18d0ca){while(--_0x18d0ca){_0xf119a9['push'](_0xf119a9['shift']());}};_0x2e83ee(++_0x5b0fa1);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0xec21('0x0'));var moment=require(_0xec21('0x1'));function getSeconds(_0x1aa991,_0x2ad2c0){var _0xc39dad=moment(_0x1aa991)[_0xec21('0x2')](0x0);var _0x5bdeed=moment(_0x2ad2c0)[_0xec21('0x2')](0x0);return _0xc39dad[_0xec21('0x3')](_0x5bdeed,_0xec21('0x4'));}function Final(_0xd94b5d){this[_0xec21('0x5')]=_0xd94b5d[_0xec21('0x5')];this[_0xec21('0x6')]=_0xd94b5d[_0xec21('0x6')];this['type']=_0xd94b5d[_0xec21('0x7')];this[_0xec21('0x8')]=_0xd94b5d[_0xec21('0x7')]===_0xec21('0x9')?_0xec21('0xa'):_0xd94b5d['type'];this[_0xec21('0xb')]=_0xd94b5d[_0xec21('0xb')];this[_0xec21('0xc')]=_0xd94b5d['countcongestionretry'];this['countnoanswerretry']=_0xd94b5d[_0xec21('0xd')];this[_0xec21('0xe')]=_0xd94b5d['countbusyretry']+_0xd94b5d[_0xec21('0xc')]+_0xd94b5d[_0xec21('0xd')]+_0xd94b5d[_0xec21('0xf')]+_0xd94b5d[_0xec21('0x10')]+_0xd94b5d[_0xec21('0x11')]+_0xd94b5d['countmachineretry']+_0xd94b5d[_0xec21('0x12')];this['countnosuchnumberretry']=_0xd94b5d[_0xec21('0xf')];this[_0xec21('0x10')]=_0xd94b5d[_0xec21('0x10')];this['countabandonedretry']=_0xd94b5d[_0xec21('0x11')];this[_0xec21('0x13')]=_0xd94b5d[_0xec21('0x13')];this[_0xec21('0x12')]=_0xd94b5d[_0xec21('0x12')];this[_0xec21('0xa')]=_0xd94b5d[_0xec21('0xa')];this[_0xec21('0x14')]=_0xd94b5d['calleridname'];this[_0xec21('0x15')]=_0xd94b5d[_0xec21('0x15')];this[_0xec21('0x16')]=_0xd94b5d[_0xec21('0x16')];this[_0xec21('0x17')]=_0xd94b5d[_0xec21('0x17')];this[_0xec21('0x18')]=_0xd94b5d[_0xec21('0x17')];this[_0xec21('0x19')]=_0xd94b5d[_0xec21('0x19')]||0x0;this['holdtime']=_0xd94b5d['holdtime']||0x0;this[_0xec21('0x1a')]=_0xd94b5d[_0xec21('0x1a')]||0x0;this['callback']=_0xd94b5d['callback'];this[_0xec21('0x1b')]=_0xd94b5d[_0xec21('0x1b')];this[_0xec21('0x1c')]=_0xd94b5d['callbackat'];this[_0xec21('0x1d')]=_0xd94b5d[_0xec21('0x1d')];this[_0xec21('0x1e')]=_0xd94b5d['ContactId'];this[_0xec21('0x1f')]=_0xd94b5d[_0xec21('0x1f')];this[_0xec21('0x20')]=_0xd94b5d[_0xec21('0x20')];this[_0xec21('0x21')]=_0xd94b5d[_0xec21('0x21')];this['CampaignId']=_0xd94b5d[_0xec21('0x22')];this[_0xec21('0x23')]=_0xd94b5d['originatecalleridnum']||'';this[_0xec21('0x24')]=_0xd94b5d['originatecalleridname']||'';}module[_0xec21('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 2cd4393..060e98b 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 _0x0a06=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x3d90d3,_0x4fa646){var _0x4f6197=function(_0x5a7834){while(--_0x5a7834){_0x3d90d3['push'](_0x3d90d3['shift']());}};_0x4f6197(++_0x4fa646);}(_0x0a06,0x114));var _0x60a0=function(_0x3ff893,_0x53e2bd){_0x3ff893=_0x3ff893-0x0;var _0x246d70=_0x0a06[_0x3ff893];return _0x246d70;};'use strict';var util=require('util');var _=require(_0x60a0('0x0'));var moment=require('moment');function getSeconds(_0x5b1916,_0x2a48f5){var _0x2b1674=moment(_0x5b1916)['milliseconds'](0x0);var _0x3f77bf=moment(_0x2a48f5)[_0x60a0('0x1')](0x0);return _0x2b1674[_0x60a0('0x2')](_0x3f77bf,_0x60a0('0x3'));}function Hangup(_0x2f1611,_0x22e677){this['state']=0x4;this[_0x60a0('0x4')]='Answer';this[_0x60a0('0x5')]=_0x2f1611[_0x60a0('0x5')];this[_0x60a0('0x6')]=_0x2f1611[_0x60a0('0x6')];this[_0x60a0('0x7')]=_0x2f1611[_0x60a0('0x6')]===_0x60a0('0x8')?_0x60a0('0x9'):_0x2f1611[_0x60a0('0x6')];this[_0x60a0('0xa')]=_0x2f1611[_0x60a0('0xa')];this['countcongestionretry']=_0x2f1611[_0x60a0('0xb')];this[_0x60a0('0xc')]=_0x2f1611[_0x60a0('0xc')];this['countglobal']=_0x2f1611['countbusyretry']+_0x2f1611['countcongestionretry']+_0x2f1611[_0x60a0('0xc')]+_0x2f1611[_0x60a0('0xd')]+_0x2f1611[_0x60a0('0xe')]+_0x2f1611['countabandonedretry']+_0x2f1611[_0x60a0('0xf')]+_0x2f1611[_0x60a0('0x10')];this[_0x60a0('0xd')]=_0x2f1611[_0x60a0('0xd')];this[_0x60a0('0xe')]=_0x2f1611[_0x60a0('0xe')];this['countabandonedretry']=_0x2f1611[_0x60a0('0x11')];this[_0x60a0('0xf')]=_0x2f1611[_0x60a0('0xf')];this[_0x60a0('0x10')]=_0x2f1611[_0x60a0('0x10')];this[_0x60a0('0x12')]=_0x22e677[_0x60a0('0x12')];this[_0x60a0('0x13')]=_0x2f1611[_0x60a0('0x14')];this[_0x60a0('0x15')]=_0x2f1611['number'];this[_0x60a0('0x16')]=_0x2f1611[_0x60a0('0x16')];this[_0x60a0('0x17')]=_0x2f1611[_0x60a0('0x17')];this[_0x60a0('0x18')]=moment()[_0x60a0('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x60a0('0x1a')]=getSeconds(_0x2f1611[_0x60a0('0x17')],_0x2f1611[_0x60a0('0x16')]);this[_0x60a0('0x1b')]=0x0;this[_0x60a0('0x1c')]=getSeconds(this[_0x60a0('0x18')],_0x2f1611['responsetime']);this['queue']=_0x2f1611[_0x60a0('0x9')];this[_0x60a0('0x1d')]=_0x60a0('0x1e');this['reason']=_0x22e677[_0x60a0('0x1f')];this[_0x60a0('0x20')]=_0x2f1611[_0x60a0('0x20')];this[_0x60a0('0x21')]=_0x2f1611[_0x60a0('0x21')];this['callbackat']=_0x2f1611[_0x60a0('0x22')];this[_0x60a0('0x23')]=_0x2f1611['recallme'];this[_0x60a0('0x24')]=_0x2f1611[_0x60a0('0x24')];this[_0x60a0('0x25')]=_0x2f1611[_0x60a0('0x25')];this['UserId']=_0x2f1611[_0x60a0('0x26')];this[_0x60a0('0x27')]=_0x2f1611['VoiceQueueId'];this[_0x60a0('0x28')]=_0x2f1611[_0x60a0('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x285c=['membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime'];(function(_0x431493,_0x3de662){var _0x51e4d3=function(_0x27ad2b){while(--_0x27ad2b){_0x431493['push'](_0x431493['shift']());}};_0x51e4d3(++_0x3de662);}(_0x285c,0x1a2));var _0xc285=function(_0x2568cb,_0x3fbc3f){_0x2568cb=_0x2568cb-0x0;var _0x44040a=_0x285c[_0x2568cb];return _0x44040a;};'use strict';var util=require(_0xc285('0x0'));var _=require(_0xc285('0x1'));var moment=require(_0xc285('0x2'));function getSeconds(_0x43feba,_0x3f5aef){var _0x33a03e=moment(_0x43feba)[_0xc285('0x3')](0x0);var _0x4819b0=moment(_0x3f5aef)[_0xc285('0x3')](0x0);return _0x33a03e[_0xc285('0x4')](_0x4819b0,'seconds');}function Hangup(_0x1db203,_0x7e12ad){this[_0xc285('0x5')]=0x4;this['statedesc']=_0xc285('0x6');this[_0xc285('0x7')]=_0x1db203[_0xc285('0x7')];this[_0xc285('0x8')]=_0x1db203[_0xc285('0x8')];this[_0xc285('0x9')]=_0x1db203[_0xc285('0x8')]===_0xc285('0xa')?_0xc285('0xb'):_0x1db203['type'];this[_0xc285('0xc')]=_0x1db203[_0xc285('0xc')];this[_0xc285('0xd')]=_0x1db203['countcongestionretry'];this[_0xc285('0xe')]=_0x1db203[_0xc285('0xe')];this[_0xc285('0xf')]=_0x1db203[_0xc285('0xc')]+_0x1db203[_0xc285('0xd')]+_0x1db203['countnoanswerretry']+_0x1db203['countnosuchnumberretry']+_0x1db203[_0xc285('0x10')]+_0x1db203['countabandonedretry']+_0x1db203[_0xc285('0x11')]+_0x1db203[_0xc285('0x12')];this[_0xc285('0x13')]=_0x1db203['countnosuchnumberretry'];this[_0xc285('0x10')]=_0x1db203[_0xc285('0x10')];this['countabandonedretry']=_0x1db203[_0xc285('0x14')];this[_0xc285('0x11')]=_0x1db203[_0xc285('0x11')];this[_0xc285('0x12')]=_0x1db203[_0xc285('0x12')];this[_0xc285('0x15')]=_0x7e12ad[_0xc285('0x15')];this[_0xc285('0x16')]=_0x1db203['name'];this[_0xc285('0x17')]=_0x1db203[_0xc285('0x18')];this['starttime']=_0x1db203[_0xc285('0x19')];this[_0xc285('0x1a')]=_0x1db203[_0xc285('0x1a')];this[_0xc285('0x1b')]=moment()['format'](_0xc285('0x1c'));this[_0xc285('0x1d')]=getSeconds(_0x1db203[_0xc285('0x1a')],_0x1db203[_0xc285('0x19')]);this[_0xc285('0x1e')]=0x0;this[_0xc285('0x1f')]=getSeconds(this[_0xc285('0x1b')],_0x1db203[_0xc285('0x1a')]);this[_0xc285('0xb')]=_0x1db203[_0xc285('0xb')];this[_0xc285('0x20')]=_0xc285('0x21');this['reason']=_0x7e12ad[_0xc285('0x22')];this[_0xc285('0x23')]=_0x1db203[_0xc285('0x23')];this[_0xc285('0x24')]=_0x1db203[_0xc285('0x24')];this[_0xc285('0x25')]=_0x1db203['callbackat'];this[_0xc285('0x26')]=_0x1db203[_0xc285('0x26')];this['ContactId']=_0x1db203[_0xc285('0x27')];this[_0xc285('0x28')]=_0x1db203['ListId'];this['UserId']=_0x1db203[_0xc285('0x29')];this[_0xc285('0x2a')]=_0x1db203[_0xc285('0x2a')];this[_0xc285('0x2b')]=_0x1db203['CampaignId'];}module[_0xc285('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 9c72bc8..045219c 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 _0x3a13=['responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','uniqueid','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','endtime'];(function(_0x35d216,_0xf9eabf){var _0x4c4d62=function(_0x38e4a2){while(--_0x38e4a2){_0x35d216['push'](_0x35d216['shift']());}};_0x4c4d62(++_0xf9eabf);}(_0x3a13,0x138));var _0x33a1=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x3a13[_0x2160a9];return _0xa88cf7;};'use strict';var util=require('util');var _=require(_0x33a1('0x0'));var moment=require('moment');function getSeconds(_0x30121e,_0x14a7e1){var _0x5ac2e1=moment(_0x30121e)[_0x33a1('0x1')](0x0);var _0x4a9752=moment(_0x14a7e1)['milliseconds'](0x0);return _0x5ac2e1['diff'](_0x4a9752,'seconds');}function History(_0x1f1dee){this[_0x33a1('0x2')]=_0x1f1dee[_0x33a1('0x2')];this['scheduledat']=_0x1f1dee['scheduledat']||undefined;this[_0x33a1('0x3')]=_0x1f1dee['type'];this[_0x33a1('0x4')]=_0x1f1dee[_0x33a1('0x3')]==='outbound'?_0x33a1('0x5'):_0x1f1dee['type'];this[_0x33a1('0x6')]=_0x1f1dee['countbusyretry'];this[_0x33a1('0x7')]=_0x1f1dee['countcongestionretry'];this['countnoanswerretry']=_0x1f1dee['countnoanswerretry'];this[_0x33a1('0x8')]=_0x1f1dee[_0x33a1('0x6')]+_0x1f1dee[_0x33a1('0x7')]+_0x1f1dee['countnoanswerretry']+_0x1f1dee[_0x33a1('0x9')]+_0x1f1dee['countdropretry']+_0x1f1dee[_0x33a1('0xa')]+_0x1f1dee[_0x33a1('0xb')]+_0x1f1dee['countagentrejectretry'];this[_0x33a1('0x9')]=_0x1f1dee[_0x33a1('0x9')];this['countdropretry']=_0x1f1dee['countdropretry'];this[_0x33a1('0xa')]=_0x1f1dee[_0x33a1('0xa')];this['countmachineretry']=_0x1f1dee[_0x33a1('0xb')];this['countagentrejectretry']=_0x1f1dee[_0x33a1('0xc')];this[_0x33a1('0x5')]=_0x1f1dee['queue'];this[_0x33a1('0xd')]=_0x1f1dee['name'];this[_0x33a1('0xe')]=_0x1f1dee[_0x33a1('0xf')];this[_0x33a1('0x10')]=_0x1f1dee[_0x33a1('0x10')];this['responsetime']=_0x1f1dee['responsetime'];this[_0x33a1('0x11')]=_0x1f1dee[_0x33a1('0x12')];this['ringtime']=getSeconds(_0x1f1dee[_0x33a1('0x12')],_0x1f1dee[_0x33a1('0x10')]);this[_0x33a1('0x13')]=0x0;this[_0x33a1('0x14')]=0x0;this[_0x33a1('0x15')]=_0x1f1dee[_0x33a1('0x15')];this[_0x33a1('0x16')]=_0x1f1dee[_0x33a1('0x16')];this[_0x33a1('0x17')]=_0x1f1dee[_0x33a1('0x17')];this[_0x33a1('0x18')]=_0x1f1dee[_0x33a1('0x18')];this[_0x33a1('0x19')]=_0x1f1dee[_0x33a1('0x19')];this[_0x33a1('0x1a')]=_0x1f1dee[_0x33a1('0x1a')];this[_0x33a1('0x1b')]=_0x1f1dee[_0x33a1('0x1b')];this[_0x33a1('0x1c')]=_0x1f1dee[_0x33a1('0x1c')];this[_0x33a1('0x1d')]=_0x1f1dee[_0x33a1('0x1d')];this['originatecalleridnum']=_0x1f1dee[_0x33a1('0x1e')]||'';this[_0x33a1('0x1f')]=_0x1f1dee[_0x33a1('0x1f')]||'';}module[_0x33a1('0x20')]=History; \ No newline at end of file +var _0x6ae3=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x6ae3,0x1b1));var _0x36ae=function(_0x55736c,_0x59ca0b){_0x55736c=_0x55736c-0x0;var _0x3581e7=_0x6ae3[_0x55736c];return _0x3581e7;};'use strict';var util=require(_0x36ae('0x0'));var _=require(_0x36ae('0x1'));var moment=require('moment');function getSeconds(_0x34326c,_0x227fa9){var _0x517ba2=moment(_0x34326c)['milliseconds'](0x0);var _0x4fea15=moment(_0x227fa9)[_0x36ae('0x2')](0x0);return _0x517ba2['diff'](_0x4fea15,_0x36ae('0x3'));}function History(_0x1478ae){this[_0x36ae('0x4')]=_0x1478ae[_0x36ae('0x4')];this['scheduledat']=_0x1478ae[_0x36ae('0x5')]||undefined;this[_0x36ae('0x6')]=_0x1478ae[_0x36ae('0x6')];this[_0x36ae('0x7')]=_0x1478ae['type']===_0x36ae('0x8')?'queue':_0x1478ae[_0x36ae('0x6')];this[_0x36ae('0x9')]=_0x1478ae[_0x36ae('0x9')];this[_0x36ae('0xa')]=_0x1478ae[_0x36ae('0xa')];this['countnoanswerretry']=_0x1478ae[_0x36ae('0xb')];this[_0x36ae('0xc')]=_0x1478ae[_0x36ae('0x9')]+_0x1478ae[_0x36ae('0xa')]+_0x1478ae['countnoanswerretry']+_0x1478ae[_0x36ae('0xd')]+_0x1478ae[_0x36ae('0xe')]+_0x1478ae[_0x36ae('0xf')]+_0x1478ae[_0x36ae('0x10')]+_0x1478ae['countagentrejectretry'];this[_0x36ae('0xd')]=_0x1478ae['countnosuchnumberretry'];this[_0x36ae('0xe')]=_0x1478ae[_0x36ae('0xe')];this[_0x36ae('0xf')]=_0x1478ae[_0x36ae('0xf')];this[_0x36ae('0x10')]=_0x1478ae['countmachineretry'];this[_0x36ae('0x11')]=_0x1478ae[_0x36ae('0x11')];this[_0x36ae('0x12')]=_0x1478ae[_0x36ae('0x12')];this[_0x36ae('0x13')]=_0x1478ae[_0x36ae('0x14')];this[_0x36ae('0x15')]=_0x1478ae[_0x36ae('0x16')];this[_0x36ae('0x17')]=_0x1478ae[_0x36ae('0x17')];this[_0x36ae('0x18')]=_0x1478ae[_0x36ae('0x18')];this[_0x36ae('0x19')]=_0x1478ae['responsetime'];this['ringtime']=getSeconds(_0x1478ae[_0x36ae('0x18')],_0x1478ae[_0x36ae('0x17')]);this['holdtime']=0x0;this[_0x36ae('0x1a')]=0x0;this[_0x36ae('0x1b')]=_0x1478ae[_0x36ae('0x1b')];this['callbackuniqueid']=_0x1478ae[_0x36ae('0x1c')];this[_0x36ae('0x1d')]=_0x1478ae[_0x36ae('0x1d')];this[_0x36ae('0x1e')]=_0x1478ae['recallme'];this[_0x36ae('0x1f')]=_0x1478ae[_0x36ae('0x1f')];this[_0x36ae('0x20')]=_0x1478ae[_0x36ae('0x20')];this[_0x36ae('0x21')]=_0x1478ae['UserId'];this[_0x36ae('0x22')]=_0x1478ae['VoiceQueueId'];this[_0x36ae('0x23')]=_0x1478ae['CampaignId'];this['originatecalleridnum']=_0x1478ae[_0x36ae('0x24')]||'';this[_0x36ae('0x25')]=_0x1478ae[_0x36ae('0x25')]||'';}module[_0x36ae('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 7a79f97..1f3e13a 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 _0x8027=['originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','phone','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','startProgressive','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','Contact.phone','[getContactDialer2]','tryOriginatePredictive','not_inuse','RUNNING','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','redis','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','queueBooked','queueBookedRR','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','varset','syncVarSet','queuestatuscomplete','loopClearZombieChannels','getSettings','then','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','milliseconds','diff','seconds','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','dialActive','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','stringify','format','voice_queue:save','ivr','campaign:save','info','Total\x20Calls:\x20\x20\x20\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\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','starttime','[uniqueid]','clearZombieChannels','isNil','Action','status','queue','updateOriginated','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','resolve','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','SIP/%s','reachable','unmonitored','moveContactManagedDialer','uniqueid','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','statedesc','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','outboundUnknownCallsDay','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','dropreason','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','endtime','calleridname','[syncAgentComplete][createHistory][10]','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','actionid','locked','agents','stateinterface','rrmemory','push','pick','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','indexOf','true','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialMethod','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','checkDialMethod','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','Agent','user:%s','checkPreviewRecallReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','%s%s','XMD-','toUpper','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x8027,0x8f));var _0x7802=function(_0x408a02,_0x478ca0){_0x408a02=_0x408a02-0x0;var _0x579bce=_0x8027[_0x408a02];return _0x579bce;};'use strict';var util=require(_0x7802('0x0'));var _=require(_0x7802('0x1'));var BPromise=require(_0x7802('0x2'));var uuid=require(_0x7802('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x7802('0x4'));var Redis=require(_0x7802('0x5'));var ut=require(_0x7802('0x6'));var config=require(_0x7802('0x7'));var logger=require('../../../config/logger')(_0x7802('0x8'));var loggerBooked=require(_0x7802('0x9'))(_0x7802('0xa'));var loggerPredictive=require('../../../config/logger')(_0x7802('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x7802('0x9'))(_0x7802('0xc'));var ami=require('../ami');config[_0x7802('0xd')]=_['defaults'](config[_0x7802('0xd')],{'host':_0x7802('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7802('0xd')]));var cmHopper=require(_0x7802('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require(_0x7802('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x7802('0x11'));var voiceQueueRt=require(_0x7802('0x12'));var RpcSetting=require(_0x7802('0x13'));var Action=require(_0x7802('0x14'));var History=require(_0x7802('0x15'));var Final=require(_0x7802('0x16'));var AgentComplete=require(_0x7802('0x17'));var QueueCallerAbandon=require(_0x7802('0x18'));var Hangup=require('./hangup');var ipAgi=process[_0x7802('0x19')][_0x7802('0x1a')]||_0x7802('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':_0x7802('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7802('0x1d')][_0x7802('0x1e')]=function(_0x5829a0){this[_0x7802('0x1f')]=this[_0x7802('0x1f')]?this[_0x7802('0x1f')][_0x7802('0x20')](_0x5829a0):_0x5829a0();};function Dialer(_0x2c41e2,_0x12e1dd){this['sequence']=new Sequence();this[_0x7802('0x21')]=_0x12e1dd;this[_0x7802('0x22')]=_0x2c41e2[_0x7802('0x22')];this[_0x7802('0x23')]=_0x2c41e2[_0x7802('0x23')];this['agents']=_0x2c41e2['agents'];this[_0x7802('0x24')]=_0x2c41e2[_0x7802('0x24')];this['maxNumberOriginate']=config[_0x7802('0x25')]||0x2;this['channels']={};this['actions']={};this[_0x7802('0x26')]={};this[_0x7802('0x27')]={};this[_0x7802('0x28')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0x7802('0x29')]={};this[_0x7802('0x2a')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x7802('0x2b')](this));ami['on'](_0x7802('0x2c'),this[_0x7802('0x2d')][_0x7802('0x2b')](this));ami['on'](_0x7802('0x2e'),this[_0x7802('0x2f')]['bind'](this));ami['on']('agentcomplete',this[_0x7802('0x30')]['bind'](this));ami['on'](_0x7802('0x31'),this[_0x7802('0xc')][_0x7802('0x2b')](this));ami['on'](_0x7802('0x32'),this[_0x7802('0x33')][_0x7802('0x2b')](this));ami['on'](_0x7802('0x34'),this[_0x7802('0x35')][_0x7802('0x2b')](this));ami['on']('newexten',this['syncNewExten'][_0x7802('0x2b')](this));ami['on'](_0x7802('0x36'),this[_0x7802('0x37')][_0x7802('0x2b')](this));ami['on']('queuemember',this['syncQueueMember'][_0x7802('0x2b')](this));ami['on'](_0x7802('0x38'),this['syncQueueStatusComplete'][_0x7802('0x2b')](this));this['loopCampaigns']();this[_0x7802('0x39')]();RpcSetting[_0x7802('0x3a')]()[_0x7802('0x3b')](function(_0x6a137e){previewRecallmeReminderInterval=_0x6a137e['previewRecallmeReminderInterval'];});}function isNotNull(_0x474d7f){return _0x474d7f!==null&&!_[_0x7802('0x3c')](_0x474d7f);}function checkIsLoggedIn(_0x2b075d,_0x909fd7){return function(){if(_0x909fd7<=0x0){_0x2b075d['message']=_0x7802('0x3d');throw _0x2b075d[_0x7802('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1a0004){return _0x1a0004;}function checkIsActive(_0x32074a,_0x250b60){return function(){if(!isActive(_0x250b60)){_0x32074a[_0x7802('0x3f')]=_0x7802('0x40');throw _0x32074a[_0x7802('0x3e')]+_0x7802('0x41');}};}function checkInterval(_0x576980){return function(){if(!isNotNull(_0x576980[_0x7802('0x42')])){_0x576980[_0x7802('0x3f')]='INTERVAL_IS_NULL';throw _0x576980[_0x7802('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x576980[_0x7802('0x42')]['Intervals'])){_0x576980[_0x7802('0x3f')]=_0x7802('0x43');throw _0x576980['name']+_0x7802('0x44');}if(!isNotNull(_['isEmpty'](_0x576980[_0x7802('0x42')][_0x7802('0x45')]))){_0x576980[_0x7802('0x3f')]=_0x7802('0x43');throw _0x576980[_0x7802('0x3e')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4f4875,_0x5396ed,_0x130f65){return{'action':_0x4f4875,'response':_0x5396ed,'message':_0x130f65,'stack':_0x130f65};}function myreject(_0xf95ead){return function(_0xc08fce){return _0xf95ead(msgResponse(_0x7802('0x46'),'Error',JSON['stringify'](_0xc08fce)));};}function getSeconds(_0x1b1857,_0x1453e8){var _0x57dee0=moment(_0x1b1857)[_0x7802('0x47')](0x0);var _0x164c98=moment(_0x1453e8)[_0x7802('0x47')](0x0);return _0x57dee0[_0x7802('0x48')](_0x164c98,_0x7802('0x49'));}function emit(_0x1defa6,_0x13010b,_0x1501be){io['to'](_0x1defa6)[_0x7802('0x4a')](_0x13010b,_0x1501be);}function emitVoiceQueueSummary(_0xcba08){if(_0xcba08[_0x7802('0x4b')]==='outbound'){var _0x2f06c9={'id':_0xcba08['id'],'name':_0xcba08['name'],'strategy':_0xcba08[_0x7802('0x4c')],'answered':_0xcba08[_0x7802('0x4d')],'available':_0xcba08[_0x7802('0x4e')],'loggedIn':_0xcba08[_0x7802('0x4f')],'pTalking':_0xcba08[_0x7802('0x50')],'sumBillable':_0xcba08[_0x7802('0x51')],'sumDuration':_0xcba08[_0x7802('0x52')],'sumHoldTime':_0xcba08[_0x7802('0x53')]||0x0,'talking':_0xcba08[_0x7802('0x54')],'total':_0xcba08[_0x7802('0x55')],'type':_0xcba08['type'],'unmanaged':_0xcba08[_0x7802('0x56')],'abandoned':_0xcba08['abandoned'],'waiting':_0xcba08[_0x7802('0x57')],'loggedInDb':_0xcba08['loggedInDb'],'dialActive':_0xcba08[_0x7802('0x58')],'dialMethod':_0xcba08['dialMethod'],'dialOriginateCallerIdName':_0xcba08['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xcba08[_0x7802('0x59')],'dialOriginateTimeout':_0xcba08['dialOriginateTimeout'],'dialPrefix':_0xcba08['dialPrefix'],'outboundAnswerAgiCallsDay':_0xcba08[_0x7802('0x5a')],'outboundAnswerCallsDay':_0xcba08['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xcba08['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xcba08[_0x7802('0x5b')],'outboundCongestionCallsDay':_0xcba08['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xcba08[_0x7802('0x5c')],'outboundDropCallsDayCallersExit':_0xcba08[_0x7802('0x5d')],'outboundDropCallsDayTimeout':_0xcba08[_0x7802('0x5e')],'outboundNoAnswerCallsDay':_0xcba08['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xcba08[_0x7802('0x5f')],'outboundOriginateFailureCallsDay':_0xcba08[_0x7802('0x60')],'outboundReCallsDay':_0xcba08[_0x7802('0x61')],'outboundRejectCallsDay':_0xcba08['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xcba08['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xcba08[_0x7802('0x62')],'predictiveIntervalAvgHoldtime':_0xcba08[_0x7802('0x63')],'predictiveIntervalAvgTalktime':_0xcba08['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xcba08[_0x7802('0x64')],'predictiveIntervalDroppedCallsTimeout':_0xcba08[_0x7802('0x65')],'predictiveIntervalErlangCalls':_0xcba08[_0x7802('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0xcba08[_0x7802('0x67')],'predictiveIntervalHitRate':_0xcba08['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xcba08[_0x7802('0x68')],'predictiveIntervalPauses':_0xcba08['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xcba08[_0x7802('0x69')],'predictiveIntervalTotalCalls':_0xcba08[_0x7802('0x6a')],'message':_0xcba08[_0x7802('0x3f')],'originated':_0xcba08['originated'],'erlangCalls':_0xcba08[_0x7802('0x6b')],'erlangCallToSecond':_0xcba08[_0x7802('0x6c')],'erlangAbandonmentRate':_0xcba08[_0x7802('0x6d')],'erlangBusyFactor':_0xcba08[_0x7802('0x6e')],'startPredictive':_0xcba08[_0x7802('0x6f')],'startProgressive':_0xcba08['startProgressive']};if(_0xcba08[_0x7802('0x70')]){_0x2f06c9[_0x7802('0x70')]={'id':_0xcba08[_0x7802('0x70')]['id'],'name':_0xcba08[_0x7802('0x70')][_0x7802('0x3e')],'active':_0xcba08['Trunk'][_0x7802('0x71')],'callerid':_0xcba08[_0x7802('0x70')]['callerid']};}if(_0xcba08['Interval']){_0x2f06c9['Interval']={'id':_0xcba08[_0x7802('0x42')]['id'],'name':_0xcba08[_0x7802('0x42')][_0x7802('0x3e')]};}var _0x59914d=md5(JSON[_0x7802('0x72')](_0x2f06c9));if(_0xcba08[_0x7802('0x4')]!==_0x59914d){_0xcba08['md5']=_0x59914d;emit(util[_0x7802('0x73')]('voice:queue:%s',_0x2f06c9[_0x7802('0x3e')]),_0x7802('0x74'),_0x2f06c9);}}}function emitCampaignSummary(_0x59d30f){if(_0x59d30f[_0x7802('0x4b')]===_0x7802('0x75')){emit(util[_0x7802('0x73')]('campaign:ivr:%s',_0x59d30f[_0x7802('0x3e')]),_0x7802('0x76'),_0x59d30f);}}function checkGetDataPredictive(_0x54cd32){if(isNotNull(_0x54cd32)&&!_['isEmpty'](_0x54cd32)){loggerPredictive[_0x7802('0x77')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x7802('0x77')](_0x7802('0x78'),_0x54cd32['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54cd32[_0x7802('0x62')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x79'),_0x54cd32[_0x7802('0x65')]);loggerPredictive[_0x7802('0x77')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54cd32[_0x7802('0x64')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x7a'),_0x54cd32[_0x7802('0x63')]);loggerPredictive[_0x7802('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54cd32[_0x7802('0x7b')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x7c'));if(_0x54cd32['predictiveIntervalTotalCalls']>0x0){if(!_[_0x7802('0x3c')](_0x54cd32[_0x7802('0x7b')])&&_0x54cd32[_0x7802('0x7b')]>0x0){return!![];}loggerPredictive[_0x7802('0x77')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x7802('0x3c')](_0x54cd32[_0x7802('0x63')])&&_0x54cd32['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x7802('0x77')](_0x7802('0x7d'));}else{loggerPredictive['info'](_0x7802('0x7e'));}}else{loggerPredictive[_0x7802('0x77')](_0x7802('0x7f'));}return![];}function mergeDataErlangB(_0x1c4010){return function(_0x2b3348){loggerPredictive[_0x7802('0x77')](_0x7802('0x80'));loggerPredictive['info'](_0x7802('0x81'),_0x2b3348[_0x7802('0x6b')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x82'),_0x2b3348[_0x7802('0x6c')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x83'),_0x2b3348[_0x7802('0x6d')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x84'),_0x2b3348[_0x7802('0x6e')]);loggerPredictive[_0x7802('0x77')](_0x7802('0x83'),_0x2b3348[_0x7802('0x6d')]);loggerPredictive['info'](_0x7802('0x7c'));_[_0x7802('0x85')](_0x1c4010,_0x2b3348);};}function getDiff(_0x2a7256){var _0xe3204=moment()[_0x7802('0x47')](0x0);var _0x1ed818=moment(_0x2a7256)[_0x7802('0x47')](0x0);return _0xe3204[_0x7802('0x48')](_0x1ed818,_0x7802('0x49'));}function ifInterval(_0x15ee0d,_0x22b048){if(_['isUndefined'](_0x22b048)){return![];}return getDiff(_0x22b048)<_0x15ee0d*0x3c;}function freeVariablesPredictive(_0x650a36){if(isNotNull(_0x650a36)){if(!_[_0x7802('0x3c')](_0x650a36['startProgressive'])){_0x650a36['startProgressive']=undefined;loggerPredictive[_0x7802('0x77')](_0x650a36['name'],_0x7802('0x86'));}if(!_['isUndefined'](_0x650a36[_0x7802('0x6f')])){_0x650a36['startPredictive']=undefined;loggerPredictive[_0x7802('0x77')](_0x650a36['name'],_0x7802('0x87'));}if(!_[_0x7802('0x3c')](_0x650a36[_0x7802('0x88')])){clearInterval(_0x650a36['handlePredictive']);_0x650a36['handlePredictive']=undefined;loggerPredictive[_0x7802('0x77')](_0x650a36[_0x7802('0x3e')],_0x7802('0x89'));}}}function erlangb(_0x4ce8f1,_0x1b088b){if(_0x1b088b===0x0){return 0x0;}var _0xa95752=0x1;for(var _0x431609=0x1;_0x431609<=_0x1b088b;_0x431609+=0x1){_0xa95752=0x1+_0xa95752*_0x431609/_0x4ce8f1;}return 0x1/_0xa95752;}function isVoiceQueueOutbound(_0x1bcea6){return _0x1bcea6===_0x7802('0x8a');}function isNotPreview(_0x385233){return _0x385233!=='preview';}function isCampaignIvr(_0x15768f){return _0x15768f===_0x7802('0x75');}function getCallerId(_0x1d93d2,_0x43bf1e,_0x597b77){if(!_[_0x7802('0x3c')](_0x597b77)&&typeof _0x597b77===_0x7802('0x8b')&&!_[_0x7802('0x8c')](_0x597b77)){if(!_[_0x7802('0x3c')](_0x43bf1e)&&typeof _0x43bf1e===_0x7802('0x8b')&&!_[_0x7802('0x8c')](_0x43bf1e)){return util[_0x7802('0x73')](_0x7802('0x8d'),_0x43bf1e,_0x597b77);}return util[_0x7802('0x73')](_0x7802('0x8d'),_0x597b77,_0x597b77);}if(!_['isUndefined'](_0x1d93d2)&&typeof _0x1d93d2===_0x7802('0x8b')&&!_[_0x7802('0x8c')](_0x1d93d2)){return _0x1d93d2;}return _0x7802('0x8e');}function loggerCatchQueueSummary(_0xea4d3,_0x346108){return function(_0x36216a){freeVariablesPredictive(_0x346108);emitVoiceQueueSummary(_0x346108);emitCampaignSummary(_0x346108);loggerSyncQueueSummary[_0x7802('0x8f')](_0xea4d3,util[_0x7802('0x90')](_0x36216a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x486a9d,_0x46499c){return function(_0x326a22){loggerPredictive[_0x7802('0x91')](_0x46499c[_0x7802('0x3e')],_0x486a9d);loggerPredictive[_0x7802('0x91')](_0x326a22[_0x7802('0x92')]);freeVariablesPredictive(_0x46499c);};}function loggerCatch(_0x464ac3){return function(_0x4fc478){logger[_0x7802('0x91')](_0x464ac3,util[_0x7802('0x90')](_0x4fc478,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3ac7dd){return _0x3ac7dd&&!_[_0x7802('0x3c')](_0x3ac7dd)&&_0x3ac7dd[_0x7802('0x93')]>0x0;}function decremetOriginate(_0x3bf7a8){if(!_[_0x7802('0x3c')](_0x3bf7a8)&&_0x3bf7a8!==null){if(typeof _0x3bf7a8['originated']!=='undefined'){if(_0x3bf7a8['originated']>0x0){_0x3bf7a8[_0x7802('0x94')]-=0x1;}else{logger[_0x7802('0x91')](_0x7802('0x95'));}}}else{logger[_0x7802('0x91')](_0x7802('0x96'));}}function checkContactLowerLimitOriginate(_0xd2b951,_0x577336,_0xd577e3){if(_0x577336>_0xd577e3){for(var _0x3c8c24=0x0;_0x3c8c24<_0x577336-_0xd577e3;_0x3c8c24+=0x1){decremetOriginate(_0xd2b951);}}}function loggerGetContactDialer(_0x4eb839,_0x3f01ac,_0x35a8d3){return function(_0x10b09c){checkContactLowerLimitOriginate(_0x3f01ac,_0x35a8d3,0x0);logger[_0x7802('0x91')](_0x4eb839,util[_0x7802('0x90')](_0x10b09c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x596f5a){return function(_0x300d13){if(isNotNull(_0x300d13)&&isNotNull(_0x300d13[0x0])){if(_0x300d13[0x0][_0x7802('0x97')]>0x0){_0x596f5a['message']=_0x7802('0x98');logger[_0x7802('0x77')](_0x7802('0x99')+_0x596f5a[_0x7802('0x3e')],_0x300d13[0x0][_0x7802('0x97')],_0x7802('0x9a'));}else{_0x596f5a[_0x7802('0x3f')]=_0x7802('0x9b');logger['info'](_0x7802('0x9c')+_0x596f5a[_0x7802('0x3e')]);}}};}function notSendMessagesQueue(_0x1f44f5){if(_0x1f44f5['sendMessageOneNotActive']){freeVariablesPredictive(_0x1f44f5);if(_0x1f44f5['originated']===0x0&&_0x1f44f5['talking']===0x0&&_0x1f44f5['waiting']===0x0&&(_0x1f44f5[_0x7802('0x50')]||0x0)===0x0){_0x1f44f5[_0x7802('0x9d')]=![];_0x1f44f5[_0x7802('0x4e')]=0x0;_0x1f44f5['message']=_0x7802('0x40');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1f44f5['name'],_0x7802('0x9e'));}else{_0x1f44f5[_0x7802('0x3f')]=_0x7802('0x9f');loggerSyncQueueSummary[_0x7802('0x8f')](_0x7802('0xa0'),_0x1f44f5[_0x7802('0x3e')],_0x7802('0xa1'));}emitVoiceQueueSummary(_0x1f44f5);}}function notSendMessagesCampaign(_0x1edfe3){if(_0x1edfe3[_0x7802('0x9d')]){if(_0x1edfe3['originated']===0x0){_0x1edfe3[_0x7802('0x9d')]=![];_0x1edfe3[_0x7802('0x3f')]=_0x7802('0x40');loggerSyncQueueSummary[_0x7802('0x8f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1edfe3[_0x7802('0x3e')],_0x7802('0x9e'));}else{_0x1edfe3[_0x7802('0x3f')]=_0x7802('0x9f');loggerSyncQueueSummary[_0x7802('0x8f')](_0x7802('0xa2'),_0x1edfe3[_0x7802('0x3e')],_0x7802('0xa1'));}emitCampaignSummary(_0x1edfe3);}}function createObjHistory(_0x28e411,_0xb4a488,_0xb64077,_0xff107b,_0x5272f9){_0x28e411[_0x7802('0x3f')]=_0xb64077;var _0x3feb02=new Action(_0x28e411,_0xb4a488);var _0x416f4e=new History(_0x3feb02);_0x416f4e[_0x7802('0xa3')]=_0xff107b;_0x416f4e['statedesc']=_0x5272f9;_0x416f4e['endtime']=_0x3feb02[_0x7802('0xa4')];return _0x416f4e;}Dialer[_0x7802('0x1d')][_0x7802('0x39')]=function(){var _0x5b779b=this;setInterval(function(){_0x5b779b['clearZombieChannels'](_0x5b779b[_0x7802('0x27')],_0x7802('0xa5'));_0x5b779b['clearZombieChannels'](_0x5b779b['actions'],'[actions]');},0x32c8);};Dialer[_0x7802('0x1d')][_0x7802('0xa6')]=function(_0x58e456,_0x5af7e1){var _0x5afb73=this;for(var _0x248f1c in _0x58e456){if(typeof _0x58e456[_0x248f1c]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x7802('0xa7')](_0x58e456[_0x248f1c])){return ami[_0x7802('0xa8')]({'action':_0x7802('0xa9'),'channel':_0x58e456[_0x248f1c]['channel']})['catch'](function(_0x2da232){if(_0x2da232['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x58e456[_0x248f1c]&&_0x58e456[_0x248f1c][_0x7802('0x4b')]!==_0x7802('0x75')){_0x5afb73['updateOriginated'](_0x5afb73['voiceQueues'][_0x58e456[_0x248f1c][_0x7802('0xaa')]]);logger[_0x7802('0x91')]('[Dialer][checkChannel]',_0x5af7e1,_0x248f1c,_0x58e456[_0x248f1c]['queue']);delete _0x58e456[_0x248f1c];}if(_0x58e456[_0x248f1c]&&_0x58e456[_0x248f1c]['type']===_0x7802('0x75')){_0x5afb73[_0x7802('0xab')](_0x5afb73[_0x7802('0x23')][_0x58e456[_0x248f1c][_0x7802('0xaa')]]);logger[_0x7802('0x91')]('[Dialer][checkChannel][ivr]',_0x5af7e1,_0x248f1c,_0x58e456[_0x248f1c][_0x7802('0xaa')]);delete _0x58e456[_0x248f1c];}},0x2328);}});}});}}};Dialer[_0x7802('0x1d')]['countReScheduled']=function(_0x14cb95){return BPromise['resolve']()[_0x7802('0x3b')](cmHopper[_0x7802('0xac')](_0x14cb95))[_0x7802('0xad')](loggerCatch(_0x7802('0xae')));};Dialer[_0x7802('0x1d')][_0x7802('0xaf')]=function(_0x32b3c2){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopperBlack[_0x7802('0xaf')](_0x32b3c2))[_0x7802('0xad')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x7802('0xb1')]=function(_0x5cc5b0,_0x36b110,_0x103933){return BPromise[_0x7802('0xb0')]()['then'](cmHopperAdditionalPhone[_0x7802('0xb1')](_0x5cc5b0,_0x36b110,_0x103933))['catch'](loggerCatch(_0x7802('0xb2')));};Dialer['prototype'][_0x7802('0xb3')]=function(_0x3353ea,_0x69ef9a,_0x46976d){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopperAdditionalPhone[_0x7802('0xb3')](_0x3353ea,_0x69ef9a,_0x46976d))[_0x7802('0xad')](loggerCatch(_0x7802('0xb4')));};Dialer[_0x7802('0x1d')][_0x7802('0xb5')]=function(_0x457709){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopperBlack[_0x7802('0xb5')](_0x457709))[_0x7802('0xad')](loggerCatch(_0x7802('0xb6')));};Dialer[_0x7802('0x1d')][_0x7802('0xb7')]=function(_0x3674ac){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopperHistory[_0x7802('0xb8')](_0x3674ac))[_0x7802('0xad')](loggerCatch(_0x7802('0xb9')));};Dialer[_0x7802('0x1d')][_0x7802('0xba')]=function(_0x2e184f){return BPromise['resolve']()[_0x7802('0x3b')](cmHopper[_0x7802('0xba')](_0x2e184f))[_0x7802('0xad')](loggerCatch(_0x7802('0xbb')));};Dialer['prototype'][_0x7802('0xbc')]=function(_0x23e4b8,_0x330cf7,_0x2a0413){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopper[_0x7802('0xbc')](_0x23e4b8,_0x330cf7,_0x2a0413))[_0x7802('0xad')](loggerCatch(_0x7802('0xbd')));};Dialer[_0x7802('0x1d')][_0x7802('0xbe')]=function(_0x1721cd,_0x2320f9,_0x3cd876,_0x92450,_0x38c74d){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopper['getContactDialer'](_0x1721cd,_0x2320f9,_0x3cd876,_0x92450))[_0x7802('0xad')](function(_0x38af03){_0x38c74d[_0x7802('0xbf')]-=_0x3cd876;_0x38c74d[_0x7802('0xbf')]=_0x38c74d[_0x7802('0xbf')]>0x0?_0x38c74d[_0x7802('0xbf')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x38af03);});};Dialer[_0x7802('0x1d')]['getContactDialerIvr']=function(_0x4c3108,_0x294cb4,_0x15e94d,_0x1466ec){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopper[_0x7802('0xc0')](_0x4c3108,_0x294cb4,_0x15e94d))[_0x7802('0xad')](function(_0x30093b){_0x1466ec[_0x7802('0xbf')]-=_0x294cb4;_0x1466ec[_0x7802('0xbf')]=_0x1466ec[_0x7802('0xbf')]>0x0?_0x1466ec[_0x7802('0xbf')]:0x0;loggerCatch(_0x7802('0xc1'))(_0x30093b);});};Dialer[_0x7802('0x1d')][_0x7802('0xc2')]=function(_0x33f1b6){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](voiceQueueRt['getVoiceQueueRtPauses'](_0x33f1b6))[_0x7802('0xad')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7802('0x1d')]['moveContactManagedDialer']=function(_0x58aeac){return BPromise[_0x7802('0xb0')]()['then'](cmHopper['moveContactManagedDialer'](_0x58aeac))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x7802('0x1d')]['createHistory']=function(_0x5ab2b7){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopperHistory[_0x7802('0xc3')](_0x5ab2b7))[_0x7802('0xad')](loggerCatch(_0x7802('0xc4')));};Dialer[_0x7802('0x1d')]['updateOriginated']=function(_0x56994b){if(!_[_0x7802('0x3c')](_0x56994b)&&_0x56994b!==null){if(typeof _0x56994b['originated']!==_0x7802('0xc5')){if(_0x56994b[_0x7802('0x94')]>0x0){_0x56994b['originated']-=0x1;}else{logger[_0x7802('0x91')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7802('0x91')](_0x7802('0xc6'));}};Dialer[_0x7802('0x1d')][_0x7802('0xc7')]=function(_0x4281d2,_0x476872){var _0x1212b0=this;return function(_0x10556b){_0x1212b0['updateOriginated'](_0x476872);logger[_0x7802('0x91')](_0x4281d2,util['inspect'](_0x10556b,{'showHidden':![],'depth':null}));};};Dialer[_0x7802('0x1d')][_0x7802('0xc8')]=function(_0x43152d,_0x18c06b,_0x51bbf2){var _0x168522={'state':0x19,'statedesc':_0x7802('0xc9')};this[_0x7802('0xab')](_0x18c06b);this[_0x7802('0xca')](_[_0x7802('0x85')](_0x168522,_['pick'](_0x51bbf2,[_0x7802('0xcb'),_0x7802('0xcc'),_0x7802('0xcd'),_0x7802('0xce'),_0x7802('0xcf')])),_0x7802('0xd0'),'[emptyContact]');logger['error'](_0x43152d);};Dialer[_0x7802('0x1d')]['isSuccess']=function(_0x4b1b23){return _0x4b1b23===_0x7802('0xd1');};Dialer['prototype']['isTrunkReachable']=function(_0x297927){return!_[_0x7802('0x3c')](_0x297927)&&_0x297927&&!_['isUndefined'](_0x297927['name'])&&!_[_0x7802('0x3c')](_0x297927[_0x7802('0x71')])&&_0x297927['active']&&(this['trunks'][util[_0x7802('0x73')](_0x7802('0xd2'),_0x297927['name'])][_0x7802('0xa9')]===_0x7802('0xd3')||this[_0x7802('0x24')][util['format'](_0x7802('0xd2'),_0x297927[_0x7802('0x3e')])][_0x7802('0xa9')]===_0x7802('0xd4'));};Dialer[_0x7802('0x1d')][_0x7802('0xca')]=function(_0x2093e6,_0x274ca8,_0x27c968){this[_0x7802('0xc3')](_0x2093e6)[_0x7802('0xad')](loggerCatch(_0x274ca8));this[_0x7802('0xd5')](_0x2093e6)[_0x7802('0xad')](loggerCatch(_0x27c968));};Dialer[_0x7802('0x1d')][_0x7802('0x37')]=function(_0x407fea){var _0x281df3=this[_0x7802('0x27')][_0x407fea[_0x7802('0xd6')]];var _0x2602f7;if(!_[_0x7802('0xa7')](_0x407fea)&&!_[_0x7802('0xa7')](_0x407fea['variable'])&&!_['isNil'](_0x407fea['variable'][_0x7802('0xd7')])&&_0x407fea[_0x7802('0xd8')]===_0x7802('0xd9')&&_0x281df3){if(_0x281df3['type']!==_0x7802('0x75')&&this[_0x7802('0x22')][_0x281df3['queue']][_0x7802('0xda')]&&_0x407fea[_0x7802('0xdb')]===_0x7802('0xdc')){delete this[_0x7802('0x27')][_0x407fea[_0x7802('0xd6')]];this[_0x7802('0xab')](this[_0x7802('0x22')][_0x281df3['queue']]);this[_0x7802('0x22')][_0x281df3[_0x7802('0xaa')]][_0x7802('0xdd')]+=0x1;this[_0x7802('0x22')][_0x281df3[_0x7802('0xaa')]][_0x7802('0x5a')]+=0x1;_0x2602f7=new Hangup(_0x281df3,_0x407fea);_0x2602f7[_0x7802('0xa3')]=0x12;_0x2602f7[_0x7802('0xde')]='HangupInAMD';_0x2602f7[_0x7802('0xdf')]=_0x7802('0xe0');ami[_0x7802('0x4a')](_0x7802('0xe1'),ut['buildObj'](_0x2602f7,'amd'));this[_0x7802('0xca')](_0x2602f7,_0x7802('0xe2'),_0x7802('0xe3'));}if(_0x281df3[_0x7802('0x4b')]!=='ivr'&&this[_0x7802('0x22')][_0x281df3[_0x7802('0xaa')]]['dialAMDActive']&&_0x407fea[_0x7802('0xdb')]===_0x7802('0xe4')){var _0x58c071=this;return new BPromise(function(_0x16b2e9,_0x1770ed){delete _0x58c071['uniqueId'][_0x407fea[_0x7802('0xd6')]];_0x58c071[_0x7802('0xab')](_0x58c071[_0x7802('0x22')][_0x281df3[_0x7802('0xaa')]]);_0x58c071['voiceQueues'][_0x281df3[_0x7802('0xaa')]][_0x7802('0xdd')]+=0x1;_0x58c071['voiceQueues'][_0x281df3[_0x7802('0xaa')]][_0x7802('0x5a')]+=0x1;var _0x524e63=_0x58c071[_0x7802('0x22')][_0x281df3[_0x7802('0xaa')]];var _0x33c0b8=new Hangup(_0x281df3,_0x407fea);_0x33c0b8[_0x7802('0xa3')]=0x13;_0x33c0b8[_0x7802('0xde')]=_0x7802('0xe5');_0x33c0b8[_0x7802('0xdf')]=_0x7802('0xe0');_0x33c0b8[_0x7802('0xe6')]+=0x1;_0x33c0b8['countglobal']+=0x1;_0x33c0b8['amd']=!![];ami[_0x7802('0x4a')]('custom:amd',ut[_0x7802('0xe7')](_0x33c0b8,_0x7802('0xe8')));_0x58c071[_0x7802('0xc3')](_0x33c0b8)[_0x7802('0xad')](loggerCatch(_0x7802('0xe9')));if(_0x33c0b8['countbusyretry']+_0x33c0b8['countcongestionretry']+_0x33c0b8[_0x7802('0xea')]+_0x33c0b8[_0x7802('0xeb')]+_0x33c0b8[_0x7802('0xec')]+_0x33c0b8[_0x7802('0xed')]+_0x33c0b8[_0x7802('0xe6')]+_0x33c0b8[_0x7802('0xee')]>=_0x524e63[_0x7802('0xef')]){_0x58c071[_0x7802('0xf0')](_0x33c0b8,_0x16b2e9,_0x1770ed,'reason19\x20machine....');}else{if(_0x33c0b8[_0x7802('0xe6')]>=_0x524e63[_0x7802('0xf1')]){_0x58c071[_0x7802('0xf2')](_0x33c0b8,_0x16b2e9,_0x1770ed,'reason\x2019\x20machine....');}else{_0x58c071['rescheduleContact']({'active':![],'countmachineretry':_0x33c0b8['countmachineretry'],'scheduledat':moment()[_0x7802('0xf3')](_0x524e63['dialMachineRetryFrequency'],_0x7802('0xf4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33c0b8[_0x7802('0xcb')],'ListId':_0x33c0b8['ListId'],'VoiceQueueId':_0x33c0b8['VoiceQueueId']||undefined,'CampaignId':_0x33c0b8[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0xf5')));_0x16b2e9({'reschedule':0x1});}}});}if(_0x281df3[_0x7802('0x4b')]===_0x7802('0x75')&&this['campaigns'][_0x281df3[_0x7802('0xaa')]][_0x7802('0xda')]&&_0x407fea[_0x7802('0xdb')]==='HANGUP'){delete this['uniqueId'][_0x407fea['uniqueid']];this['updateOriginated'](this[_0x7802('0x23')][_0x281df3[_0x7802('0xaa')]]);_0x2602f7=new Hangup(_0x281df3,_0x407fea);_0x2602f7['state']=0x12;_0x2602f7[_0x7802('0xde')]='HangupInAMD';_0x2602f7[_0x7802('0xdf')]=_0x7802('0xe0');ami[_0x7802('0x4a')]('custom:amd',ut['buildObj'](_0x2602f7,_0x7802('0xe8')));this[_0x7802('0xca')](_0x2602f7,_0x7802('0xf6'),'[syncHangupInAMDIvr]');}if(_0x281df3['type']===_0x7802('0x75')&&this['campaigns'][_0x281df3[_0x7802('0xaa')]]['dialAMDActive']&&_0x407fea[_0x7802('0xdb')]===_0x7802('0xe4')){var _0x58c071=this;return new BPromise(function(_0x3773e9,_0x2d4448){delete _0x58c071[_0x7802('0x27')][_0x407fea['uniqueid']];_0x58c071[_0x7802('0xab')](_0x58c071['campaigns'][_0x281df3[_0x7802('0xaa')]]);_0x58c071[_0x7802('0x23')][_0x281df3[_0x7802('0xaa')]][_0x7802('0xdd')]+=0x1;_0x58c071[_0x7802('0x23')][_0x281df3[_0x7802('0xaa')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4c9be8=_0x58c071['campaigns'][_0x281df3['queue']];var _0x1fffa3=new Hangup(_0x281df3,_0x407fea);_0x1fffa3[_0x7802('0xa3')]=0x13;_0x1fffa3[_0x7802('0xde')]=_0x7802('0xe5');_0x1fffa3['membername']='AMD';_0x1fffa3[_0x7802('0xe6')]+=0x1;_0x1fffa3['countglobal']+=0x1;_0x1fffa3['amd']=!![];ami['emit'](_0x7802('0xe1'),ut[_0x7802('0xe7')](_0x1fffa3,'amd'));_0x58c071['createHistory'](_0x1fffa3)[_0x7802('0xad')](loggerCatch(_0x7802('0xe9')));if(_0x1fffa3['countbusyretry']+_0x1fffa3[_0x7802('0xf7')]+_0x1fffa3[_0x7802('0xea')]+_0x1fffa3[_0x7802('0xeb')]+_0x1fffa3[_0x7802('0xec')]+_0x1fffa3[_0x7802('0xed')]+_0x1fffa3['countmachineretry']+_0x1fffa3[_0x7802('0xee')]>=_0x4c9be8[_0x7802('0xef')]){_0x58c071[_0x7802('0xf0')](_0x1fffa3,_0x3773e9,_0x2d4448,_0x7802('0xf8'));}else{if(_0x1fffa3[_0x7802('0xe6')]>=_0x4c9be8[_0x7802('0xf1')]){_0x58c071['createStateFinal'](_0x1fffa3,_0x3773e9,_0x2d4448,_0x7802('0xf9'));}else{_0x58c071[_0x7802('0xba')]({'active':![],'countmachineretry':_0x1fffa3[_0x7802('0xe6')],'scheduledat':moment()[_0x7802('0xf3')](_0x4c9be8[_0x7802('0xfa')],_0x7802('0xf4'))[_0x7802('0x73')](_0x7802('0xfb')),'ContactId':_0x1fffa3['ContactId'],'ListId':_0x1fffa3['ListId'],'VoiceQueueId':_0x1fffa3[_0x7802('0xce')]||undefined,'CampaignId':_0x1fffa3[_0x7802('0xcf')]||undefined})['catch'](loggerCatch(_0x7802('0xf5')));_0x3773e9({'reschedule':0x1});}}});}}};Dialer[_0x7802('0x1d')][_0x7802('0x35')]=function(_0x5651e0){var _0x5200b8=this['uniqueId'][_0x5651e0[_0x7802('0xd6')]];var _0x46ba4d=this;var _0x4fd7fd;if(_0x5200b8&&_0x5200b8[_0x7802('0x4b')]==='ivr'){delete this[_0x7802('0x27')][_0x5651e0[_0x7802('0xd6')]];this[_0x7802('0xab')](this[_0x7802('0x23')][_0x5200b8[_0x7802('0xaa')]]);this[_0x7802('0x23')][_0x5200b8[_0x7802('0xaa')]][_0x7802('0xfc')]+=0x1;_0x4fd7fd=new Hangup(_0x5200b8,_0x5651e0);this[_0x7802('0xc3')](_0x4fd7fd)[_0x7802('0xad')](loggerCatch(_0x7802('0xfd')));this[_0x7802('0xd5')](_0x4fd7fd)[_0x7802('0xad')](loggerCatch('[syncHangupIvr]'));}if(_0x5200b8&&_0x5200b8['type']!==_0x7802('0x75')&&isNotNull(this[_0x7802('0x22')][_0x5200b8['queue']][_0x7802('0xfe')])){delete this[_0x7802('0x27')][_0x5651e0['uniqueid']];this[_0x7802('0xab')](this[_0x7802('0x22')][_0x5200b8[_0x7802('0xaa')]]);this[_0x7802('0x22')][_0x5200b8[_0x7802('0xaa')]][_0x7802('0xdd')]+=0x1;this[_0x7802('0x22')][_0x5200b8[_0x7802('0xaa')]][_0x7802('0x5a')]+=0x1;_0x4fd7fd=new Hangup(_0x5200b8,_0x5651e0);_0x4fd7fd[_0x7802('0xa3')]=0x10;_0x4fd7fd[_0x7802('0xde')]=_0x7802('0xff');_0x4fd7fd[_0x7802('0xdf')]=_0x7802('0x100');this[_0x7802('0xc3')](_0x4fd7fd)[_0x7802('0xad')](loggerCatch(_0x7802('0xfd')));this[_0x7802('0xd5')](_0x4fd7fd)[_0x7802('0xad')](loggerCatch(_0x7802('0x101')));}if(_0x5200b8&&_0x5200b8[_0x7802('0x4b')]!=='ivr'&&!isNotNull(this[_0x7802('0x22')][_0x5200b8[_0x7802('0xaa')]][_0x7802('0xfe')])){delete this[_0x7802('0x27')][_0x5651e0[_0x7802('0xd6')]];this[_0x7802('0xab')](this[_0x7802('0x22')][_0x5200b8['queue']]);this[_0x7802('0x22')][_0x5200b8[_0x7802('0xaa')]][_0x7802('0x102')]+=0x1;_0x4fd7fd=new Hangup(_0x5200b8,_0x5651e0);_0x4fd7fd['state']=0xc;_0x4fd7fd['statedesc']=_0x5651e0['cause-txt'];_0x4fd7fd[_0x7802('0xdf')]=_0x7802('0x103');this[_0x7802('0xc3')](_0x4fd7fd)['catch'](loggerCatch(_0x7802('0xfd')));this['moveContactManagedDialer'](_0x4fd7fd)['catch'](loggerCatch(_0x7802('0x101')));}};Dialer['prototype'][_0x7802('0x30')]=function(_0x46a8ae){var _0x1cd414=this[_0x7802('0x27')][_0x46a8ae[_0x7802('0xd6')]];var _0x19845e=this;if(this[_0x7802('0x22')][_0x46a8ae[_0x7802('0xaa')]]){if(_0x1cd414&&_0x1cd414[_0x7802('0x4b')]!==_0x7802('0x75')){delete this[_0x7802('0x27')][_0x46a8ae['uniqueid']];this['voiceQueues'][_0x46a8ae[_0x7802('0xaa')]]['outboundAnswerCallsDay']+=0x1;var _0x6667a8=new AgentComplete(_0x1cd414,_0x46a8ae);if(_0x46a8ae[_0x7802('0x104')]==='agent'){_0x6667a8['agiafterat']=this[_0x7802('0x22')][_0x46a8ae['queue']][_0x7802('0x105')]&&this[_0x7802('0x22')][_0x46a8ae['queue']][_0x7802('0x106')]?moment()['format'](_0x7802('0xfb')):undefined;}this[_0x7802('0xc3')](_0x6667a8)['catch'](loggerCatch(_0x7802('0x107')));this['moveContactManagedDialer'](_0x6667a8)[_0x7802('0xad')](loggerCatch(_0x7802('0x108')));}}};Dialer[_0x7802('0x1d')][_0x7802('0x109')]=function(_0xdf33b){if(this[_0x7802('0x22')][_0xdf33b['queue']]){if(this['uniqueId'][_0xdf33b[_0x7802('0xd6')]]&&this[_0x7802('0x27')][_0xdf33b['uniqueid']][_0x7802('0x4b')]!=='ivr'){this[_0x7802('0xab')](this[_0x7802('0x22')][_0xdf33b['queue']]);this['uniqueId'][_0xdf33b[_0x7802('0xd6')]][_0x7802('0x10a')]=moment()[_0x7802('0x73')](_0x7802('0xfb'));}}};Dialer['prototype'][_0x7802('0x10b')]=function(_0x1afd09,_0x1ad7a4){this['createHistory'](_0x1afd09)[_0x7802('0xad')](loggerCatch(_0x7802('0x107')));if(_0x1ad7a4==0x0){this[_0x7802('0xd5')](_0x1afd09)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x7802('0x1d')][_0x7802('0x2d')]=function(_0xb744fa){var _0x50e3c3=this[_0x7802('0x27')][_0xb744fa[_0x7802('0xd6')]];var _0x359740=this;var _0x209abb=![];var _0xbb237;var _0x1ce502;if(this[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]]){if(_0x50e3c3&&_0x50e3c3[_0x7802('0x4b')]!=='ivr'){delete this[_0x7802('0x27')][_0xb744fa[_0x7802('0xd6')]];this['updateOriginated'](this['voiceQueues'][_0xb744fa[_0x7802('0xaa')]]);_0x50e3c3[_0x7802('0x10c')]=moment()[_0x7802('0x73')](_0x7802('0xfb'));var _0x804b5e=new QueueCallerAbandon(_0x50e3c3,_0xb744fa);if(getSeconds(_0x50e3c3[_0x7802('0x10c')],_0x50e3c3[_0x7802('0x10d')])>=_0x50e3c3[_0x7802('0x10e')]){this[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x5e')]+=0x1;this['voiceQueues'][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x67')]+=0x1;_0x804b5e[_0x7802('0xa3')]=0xa;_0x804b5e['statedesc']='Drop';_0x804b5e[_0x7802('0x10f')]='TIMEOUT';_0x804b5e[_0x7802('0x110')]=this[_0x7802('0x22')][_0xb744fa['queue']]['dialQueueProject2']?moment()[_0x7802('0x73')](_0x7802('0xfb')):undefined;_0x804b5e[_0x7802('0xec')]+=0x1;_0x804b5e['countglobal']+=0x1;_0xbb237=this[_0x7802('0x22')][_0xb744fa['queue']][_0x7802('0x111')];_0x1ce502=this['voiceQueues'][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x112')];_0x359740['verifyAdditionalPhones'](_0x804b5e,_0x804b5e[_0x7802('0xa3')],_0x50e3c3[_0x7802('0x113')])[_0x7802('0x3b')](function(_0x1e8988){_0x209abb=_0x1e8988[_0x7802('0x114')]==0x1;if(_0x804b5e['countdropretry']>=_0x359740[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x115')]){_0x359740[_0x7802('0x10b')](_0x804b5e,_0x1e8988[_0x7802('0x114')]);}else{_0x359740[_0x7802('0xba')]({'active':![],'countdropretry':_0x804b5e[_0x7802('0xec')],'scheduledat':moment()[_0x7802('0xf3')](_0x359740[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x111')],_0x7802('0xf4'))[_0x7802('0x73')](_0x7802('0xfb')),'ContactId':_0x50e3c3['ContactId'],'ListId':_0x50e3c3[_0x7802('0xcc')],'VoiceQueueId':_0x50e3c3['VoiceQueueId']||undefined,'CampaignId':_0x50e3c3[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x116')));var _0xda0af6=new History(_0x804b5e);_0xda0af6[_0x7802('0xa3')]=0xa;_0xda0af6['statedesc']=_0x7802('0x117');_0xda0af6[_0x7802('0xa4')]=moment()['format'](_0x7802('0xfb'));_0xda0af6[_0x7802('0x118')]=_0xda0af6[_0x7802('0xa4')];_0xda0af6[_0x7802('0x119')]=_0x804b5e[_0x7802('0x119')];_0xda0af6['calleridnum']=_0x804b5e['calleridnum'];_0x359740[_0x7802('0xc3')](_0xda0af6)['catch'](loggerCatch(_0x7802('0x11a')));}})[_0x7802('0x3b')](function(_0x2ae887){if(_0x209abb)_0x359740[_0x7802('0xb3')](_0x804b5e,_0xbb237,_0x1ce502)[_0x7802('0x3b')](function(_0x2f57fd){return 0x1;});});}else{this[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x64')]+=0x1;this[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x5d')]+=0x1;_0x804b5e[_0x7802('0xa3')]=0xb;_0x804b5e['statedesc']='Abandoned';_0x804b5e[_0x7802('0x10f')]=_0x7802('0x11b');_0x804b5e[_0x7802('0xed')]+=0x1;_0x804b5e[_0x7802('0x11c')]+=0x1;_0xbb237=this[_0x7802('0x22')][_0xb744fa['queue']][_0x7802('0x11d')];_0x1ce502=this['voiceQueues'][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x112')];_0x359740[_0x7802('0xb1')](_0x804b5e,_0x804b5e[_0x7802('0xa3')],_0x50e3c3[_0x7802('0x113')])['then'](function(_0x2fd716){if(_0x804b5e[_0x7802('0xed')]>=_0x359740[_0x7802('0x22')][_0xb744fa[_0x7802('0xaa')]][_0x7802('0x11e')]){_0x359740[_0x7802('0x10b')](_0x804b5e,_0x2fd716[_0x7802('0x114')]);}else{_0x359740[_0x7802('0xba')]({'active':![],'countabandonedretry':_0x804b5e['countabandonedretry'],'scheduledat':moment()['add'](_0x359740['voiceQueues'][_0xb744fa['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0x7802('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50e3c3[_0x7802('0xcb')],'ListId':_0x50e3c3[_0x7802('0xcc')],'VoiceQueueId':_0x50e3c3[_0x7802('0xce')]||undefined,'CampaignId':_0x50e3c3[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x11f')));var _0xfbc62b=new History(_0x804b5e);_0xfbc62b['state']=0xb;_0xfbc62b[_0x7802('0xde')]=_0x7802('0x120');_0xfbc62b[_0x7802('0xa4')]=moment()[_0x7802('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0xfbc62b[_0x7802('0x118')]=_0xfbc62b[_0x7802('0xa4')];_0xfbc62b[_0x7802('0x119')]=_0x804b5e['calleridname'];_0xfbc62b['calleridnum']=_0x804b5e['calleridnum'];_0x359740['createHistory'](_0xfbc62b)['catch'](loggerCatch(_0x7802('0x121')));}})[_0x7802('0x3b')](function(_0x14bcfb){if(_0x209abb)_0x359740[_0x7802('0xb3')](_0x804b5e,_0xbb237,_0x1ce502)['then'](function(_0x424c99){return 0x1;});});}}}};Dialer['prototype'][_0x7802('0x122')]=function(_0x54e224){if(this[_0x7802('0x123')][_0x54e224['uniqueid']]){this['actions'][_0x54e224['uniqueid']][_0x7802('0x124')]=_0x54e224[_0x7802('0x124')];}if(this[_0x7802('0x27')][_0x54e224['uniqueid']]){this[_0x7802('0x27')][_0x54e224[_0x7802('0xd6')]][_0x7802('0x124')]=_0x54e224[_0x7802('0x124')];}};Dialer[_0x7802('0x1d')]['syncQueueMember']=function(_0x19200e){if(strategy[this['voiceQueues'][this[_0x7802('0x123')][_0x19200e['actionid']][_0x7802('0xaa')]][_0x7802('0x4c')]]===_0x7802('0x1c')){if(this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]]&&_[_0x7802('0xa7')](this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]][_0x7802('0x126')])&&_0x19200e['status']==='1'&&_0x19200e['paused']==='0'){if(this[_0x7802('0x127')][_0x19200e[_0x7802('0x128')]]){if(!this[_0x7802('0x127')][_0x19200e['stateinterface']][_0x7802('0x126')]){this['agents'][_0x19200e['stateinterface']][_0x7802('0x126')]=!![];this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]][_0x7802('0x126')]=!![];this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]][_0x7802('0x128')]=_0x19200e[_0x7802('0x128')];}}}}else if((strategy[this[_0x7802('0x22')][this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]]['queue']][_0x7802('0x4c')]]||_0x7802('0x129'))===_0x7802('0x129')){if(this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]]){if(this[_0x7802('0x127')][_0x19200e[_0x7802('0x128')]]){this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]]['stateinterface']=_0x19200e['stateinterface'];if(_[_0x7802('0xa7')](this['queueBooked'][this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]][_0x7802('0xaa')]])){this['queueBooked'][this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]][_0x7802('0xaa')]]=[];}this[_0x7802('0x29')][this['actions'][_0x19200e[_0x7802('0x125')]][_0x7802('0xaa')]][_0x7802('0x12a')](_[_0x7802('0x85')](_[_0x7802('0x12b')](this[_0x7802('0x123')][_0x19200e[_0x7802('0x125')]],['idHopper',_0x7802('0x128')]),{'status':_0x19200e[_0x7802('0xa9')],'paused':_0x19200e[_0x7802('0x12c')]}));}}}};function unlockQueueStatus(_0x3e5790,_0x3327a7){setTimeout(function(){if(_[_0x7802('0x3c')](_0x3e5790[_0x7802('0x12d')])){loggerBooked[_0x7802('0x91')](_0x7802('0x12e'),_0x3327a7);}_0x3e5790[_0x7802('0x12d')]=!![];loggerBooked[_0x7802('0x77')](_0x7802('0x12f'),_0x3327a7,JSON[_0x7802('0x72')](_[_0x7802('0x12b')](_0x3e5790,[_0x7802('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x7802('0x1d')][_0x7802('0x130')]=function(_0x2fde1d){var _0x5d7819=this;var _0x4800c8=_0x5d7819[_0x7802('0x22')][_0x5d7819[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]];if(strategy[this[_0x7802('0x22')][this['actions'][_0x2fde1d[_0x7802('0x125')]]['queue']][_0x7802('0x4c')]]===_0x7802('0x1c')){if(this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]]&&this[_0x7802('0x123')][_0x2fde1d['actionid']][_0x7802('0x128')]){this[_0x7802('0x21')][_0x7802('0x131')](this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0x132')],this['actions'][_0x2fde1d[_0x7802('0x125')]][_0x7802('0x128')])[_0x7802('0xad')](function(_0x2ee303){logger[_0x7802('0x91')](_0x7802('0x133'),util[_0x7802('0x90')](_0x2ee303,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5d7819[_0x7802('0xab')](_0x5d7819['voiceQueues'][_0x5d7819[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]]);_0x5d7819['agents'][_0x5d7819['actions'][_0x2fde1d[_0x7802('0x125')]]['stateinterface']][_0x7802('0x126')]=![];delete _0x5d7819['actions'][_0x2fde1d[_0x7802('0x125')]];unlockQueueStatus(_0x4800c8);});}else{this[_0x7802('0xab')](this[_0x7802('0x22')][this[_0x7802('0x123')][_0x2fde1d['actionid']][_0x7802('0xaa')]]);this[_0x7802('0xba')]({'active':![],'ContactId':this['actions'][_0x2fde1d[_0x7802('0x125')]]['ContactId'],'ListId':this[_0x7802('0x123')][_0x2fde1d['actionid']][_0x7802('0xcc')],'VoiceQueueId':this[_0x7802('0x123')][_0x2fde1d['actionid']][_0x7802('0xce')]||undefined,'CampaignId':this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xcf')]||undefined})['catch'](loggerCatch(_0x7802('0x134')));delete this['actions'][_0x2fde1d[_0x7802('0x125')]];unlockQueueStatus(_0x4800c8);}}else if((strategy[this[_0x7802('0x22')][this['actions'][_0x2fde1d[_0x7802('0x125')]]['queue']][_0x7802('0x4c')]]||'rrmemory')===_0x7802('0x129')){var _0xffe0f7;if(this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]]&&!_[_0x7802('0x8c')](this[_0x7802('0x29')][this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]])){if(this[_0x7802('0x2a')][_0x5d7819[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]]['queue']]){this['queueBookedRR'][_0x5d7819[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]]=this[_0x7802('0x2a')][this['actions'][_0x2fde1d['actionid']][_0x7802('0xaa')]]?this[_0x7802('0x2a')][this[_0x7802('0x123')][_0x2fde1d['actionid']][_0x7802('0xaa')]]:this['queueBooked'][this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]]?this['queueBooked'][this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]]['queue']][_0x7802('0x135')]||0x0:0x0;}this[_0x7802('0x29')][this['actions'][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]]['_rr']=this[_0x7802('0x2a')][this[_0x7802('0x123')][_0x2fde1d[_0x7802('0x125')]][_0x7802('0xaa')]];for(var _0x2a32c2=0x0;_0x2a32c2=0x0;})[_0x7802('0xad')](myreject(_0x1d659a)));}}else{_0x5e1f40[_0x7802('0x12a')](ami[_0x7802('0xa8')]({'action':_0x7802('0x14d'),'command':util[_0x7802('0x73')](_0x7802('0x14e'),_0x3fbb8e,!_[_0x7802('0x3c')](config[_0x7802('0x14a')][_0x342aa4])?_0x342aa4:'')})[_0x7802('0x3b')](function(_0x1fb87f){return _0x1fb87f[_0x7802('0x152')]['indexOf'](_0x7802('0x151'))>=0x0;})[_0x7802('0xad')](myreject(_0x1d659a)));}BPromise['all'](_0x5e1f40)['then'](function(_0x1b659a){var _0xee0eac=_[_0x7802('0x153')](_0x1b659a);if(_0xee0eac){return _0x4694e3(_0xee0eac);}else{_0x78bc4[_0x7802('0x3f')]=_0x4d055b?_0x7802('0x154'):_0x7802('0x155');return _0x1d659a(msgResponse(_0x7802('0x156'),'Failure',_0x7802('0x157')+_0x4d055b+'\x20'+_0x9a331b+_0x7802('0x158')+util[_0x7802('0x90')](_0x3fbb8e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x342aa4));}})['catch'](function(_0xce81be){return _0x1d659a(msgResponse('ifTime','Failure',JSON[_0x7802('0x72')](_0xce81be)));});});};Dialer[_0x7802('0x1d')]['checkDialMethod']=function(_0x3e87f2){var _0x5b8ac6=this;return function(){switch(_0x3e87f2['dialMethod']){case _0x7802('0x159'):freeVariablesPredictive(_0x3e87f2);_0x5b8ac6[_0x7802('0x15a')](_0x3e87f2,0x1);break;case _0x7802('0x15b'):freeVariablesPredictive(_0x3e87f2);_0x5b8ac6[_0x7802('0x15a')](_0x3e87f2,_0x3e87f2[_0x7802('0x15c')]);break;case _0x7802('0xb'):_0x5b8ac6[_0x7802('0xb')](_0x3e87f2);break;case _0x7802('0xa'):freeVariablesPredictive(_0x3e87f2);_0x5b8ac6['handlePower'](_0x3e87f2,0x1);break;default:freeVariablesPredictive(_0x3e87f2);logger[_0x7802('0x91')]('Queue',_0x3e87f2['name'],_0x7802('0x15d'));}};};Dialer[_0x7802('0x1d')][_0x7802('0x15e')]=function(_0x2ba256){var _0x489e68=this;return function(){_0x489e68[_0x7802('0x15f')](_0x2ba256);};};Dialer[_0x7802('0x1d')]['syncQueueSummary']=function(_0x197810){var _0xabb601=this;if(isNotPreview(_0x197810[_0x7802('0x160')])){if(isVoiceQueueOutbound(_0x197810[_0x7802('0x4b')])&&isActive(_0x197810['dialActive'])){_0x197810[_0x7802('0x9d')]=!![];BPromise[_0x7802('0xb0')]()['then'](checkIsLoggedIn(_0x197810,_0x197810['loggedIn']))[_0x7802('0x3b')](checkIsActive(_0x197810,_0x197810[_0x7802('0x58')]))[_0x7802('0x3b')](checkInterval(_0x197810))[_0x7802('0x3b')](_0xabb601[_0x7802('0x141')](_0x197810))[_0x7802('0x3b')](_0xabb601[_0x7802('0x145')](_0x197810[_0x7802('0x161')],_0x197810['dialTimezone'],_0x197810[_0x7802('0x3e')],_0x197810))['then'](_0xabb601[_0x7802('0x162')](_0x197810[_0x7802('0x42')],_0x197810[_0x7802('0x163')],_0x197810[_0x7802('0x3e')],_0x197810))[_0x7802('0x3b')](_0xabb601[_0x7802('0x164')](_0x197810))[_0x7802('0xad')](loggerCatchQueueSummary('[syncQueueSummary]',_0x197810));}else{notSendMessagesQueue(_0x197810);}}else{freeVariablesPredictive(_0x197810);}};Dialer[_0x7802('0x1d')][_0x7802('0x33')]=_[_0x7802('0x165')](function(){var _0x3b42a9=_[_0x7802('0x166')](this['voiceQueues'],function(_0x3c4de6){return _0x3c4de6[_0x7802('0x167')];});var _0x5de51a=_[_0x7802('0x166')](this['agents'],function(_0x416c1e){return _0x416c1e['online']&&_0x416c1e[_0x7802('0xa9')]==='reachable';});if(_0x3b42a9[_0x7802('0x93')]>0x0&&_0x5de51a[_0x7802('0x93')]>0x0){return BPromise[_0x7802('0xb0')]()[_0x7802('0x3b')](cmHopper[_0x7802('0x168')](_['map'](_0x3b42a9,'id'),previewRecallmeReminderInterval,_['map'](_0x5de51a,'id')))[_0x7802('0x3b')](function(_0x3aae46){for(var _0x20419b=0x0;_0x20419b<_0x3aae46['length'];_0x20419b++){var _0x268270=_0x3aae46[_0x20419b][_0x7802('0x169')]['name'];if(_0x268270)io['to'](util[_0x7802('0x73')](_0x7802('0x16a'),_0x268270))[_0x7802('0x4a')]('user:dialPreviewRecallReminder',{'hopper':_0x3aae46[_0x20419b]});}})[_0x7802('0xad')](function(_0x51b520){logger['error'](_0x7802('0x16b'),_0x51b520);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7802('0x1d')][_0x7802('0x140')]=function(){var _0x281c61=this;var _0x51a317;for(var _0x5c599e in this['campaigns']){if(typeof this[_0x7802('0x23')][_0x5c599e]!==_0x7802('0xc5')){_0x51a317=this[_0x7802('0x23')][_0x5c599e];if(isCampaignIvr(_0x51a317[_0x7802('0x4b')])&&isActive(_0x51a317[_0x7802('0x71')])){_0x51a317[_0x7802('0x9d')]=!![];BPromise[_0x7802('0xb0')]()['then'](checkIsActive(_0x51a317,_0x51a317[_0x7802('0x71')]))['then'](checkInterval(_0x51a317))[_0x7802('0x3b')](_0x281c61[_0x7802('0x141')](_0x51a317))[_0x7802('0x3b')](_0x281c61['checkIfTime'](_0x51a317['dialGlobalInterval'],_0x51a317[_0x7802('0x163')],_0x51a317[_0x7802('0x3e')],_0x51a317))[_0x7802('0x3b')](_0x281c61[_0x7802('0x162')](_0x51a317[_0x7802('0x42')],_0x51a317['dialTimezone'],_0x51a317[_0x7802('0x3e')],_0x51a317))['then'](_0x281c61['launchHandleIvr'](_0x51a317))['catch'](loggerCatchQueueSummary(_0x7802('0x16c'),_0x51a317));}else{notSendMessagesCampaign(_0x51a317);}}}};function getCallerIdRandom(_0xc7a8b3,_0x2cdb67){var _0x56f9e3;var _0x80b9bc;var _0xb665b8;if(_0x2cdb67<=0x0){_0x2cdb67=0x1;}_0x56f9e3=new RegExp(_0x7802('0x16d')+_0x2cdb67+'}$');_0x80b9bc=Math[_0x7802('0x16e')](0xa,_0x2cdb67-0x1);_0xb665b8=Math[_0x7802('0x16e')](0xa,_0x2cdb67)-0x1;return util['format']('%s',_[_0x7802('0x16f')](_0xc7a8b3,_0x56f9e3,_[_0x7802('0x170')](_0x80b9bc,_0xb665b8)));}function extractCalleridName(_0x55f8ee){var _0x30099e=_0x55f8ee[_0x7802('0x171')](/"(.*?)"/);return _0x30099e?_0x30099e[0x1]:_0x55f8ee;}function extractCalleridNumber(_0x3a5d78){var _0x5ae675=_0x3a5d78[_0x7802('0x171')](/<(.*?)>/);return _0x5ae675?_0x5ae675[0x1]:_0x3a5d78;}Dialer[_0x7802('0x1d')]['actionOriginate']=function(_0x279661,_0x220708){var _0x108009=this;var _0x56b3be=uuid['v4']();this['actions'][_0x56b3be]=new Action(_0x279661,_0x220708,_0x56b3be);return new BPromise(function(_0x2ee472,_0x5de3cf){if(_[_0x7802('0x3c')](_0x279661)&&typeof _0x279661!==_0x7802('0x172')){return _0x5de3cf(msgResponse(_0x7802('0x173'),_0x7802('0x147'),_0x7802('0x174')));}if(_[_0x7802('0x3c')](_0x220708['phone'])||_0x220708['phone']===null){return _0x5de3cf(msgResponse(_0x7802('0x173'),_0x7802('0x147'),'contact\x20is\x20undefine'));}var _0x1bf642={'XMD-CALLERID':_0x108009[_0x7802('0x123')][_0x56b3be]['getCaller'](),'XMD-AGI':_0x279661[_0x7802('0xfe')]?util[_0x7802('0x73')](_0x7802('0x175'),ipAgi,_0x279661[_0x7802('0xfe')]):_0x7802('0x176'),'XMD-AGIAFTER':_0x279661['dialQueueProject2']?util['format'](_0x7802('0x175'),ipAgi,_0x279661[_0x7802('0x105')]):'NONE','XMD-QUEUE':_0x279661[_0x7802('0x4b')]===_0x7802('0x8a')?util[_0x7802('0x73')](_0x7802('0x177'),_0x279661[_0x7802('0x3e')],_0x279661[_0x7802('0x178')]||'',_0x279661[_0x7802('0x106')]?'c':'',_0x279661['dialQueueTimeout']||0x3):_0x7802('0x176'),'XMD-CONTACTID':_0x220708[_0x7802('0xcb')],'XMD-CDRTYPE':_0x7802('0x8'),'CALLERID(all)':_0x108009[_0x7802('0x123')][_0x56b3be]['getCaller'](),'XMD-AMD':_0x279661[_0x7802('0xda')]?_0x7802('0x179'):_0x7802('0x176'),'XMD-DESTINATION':_0x7802('0xd9')};if(_0x279661[_0x7802('0xda')]){_0x1bf642['XMD-AMDINITIALSILENCE']=_0x279661[_0x7802('0x17a')]||0x9c4;_0x1bf642[_0x7802('0x17b')]=_0x279661[_0x7802('0x17c')]||0x5dc;_0x1bf642['XMD-AMDAFTERGREETINGSILENCE']=_0x279661[_0x7802('0x17d')]||0x320;_0x1bf642[_0x7802('0x17e')]=_0x279661[_0x7802('0x17f')]||0x1388;_0x1bf642['XMD-AMDMINWORDLENGTH']=_0x279661[_0x7802('0x180')]||0x64;_0x1bf642[_0x7802('0x181')]=_0x279661['dialAMDBetweenWordsSilence']||0x32;_0x1bf642[_0x7802('0x182')]=_0x279661['dialAMDMaximumNumberOfWords']||0x3;_0x1bf642[_0x7802('0x183')]=_0x279661[_0x7802('0x184')]||0x100;_0x1bf642[_0x7802('0x185')]=_0x279661[_0x7802('0x186')]||0x1388;}if(_0x279661['type']==='outbound'){_0x1bf642[_0x7802('0x187')]=_0x220708[_0x7802('0xce')];}else{_0x1bf642[_0x7802('0x188')]=_0x220708['CampaignId'];}for(var _0x1c0f86 in _0x220708['Contact']){if(typeof _0x220708['Contact'][_0x1c0f86]!==_0x7802('0xc5')){if(isNotNull(_0x220708[_0x7802('0x189')][_0x1c0f86])&&_0x1c0f86!=='id'&&_0x1c0f86!==_0x7802('0x18a')&&_0x1c0f86!=='createdAt'&&_0x1c0f86!=='updatedAt'){_0x1bf642[util['format'](_0x7802('0x18b'),_0x7802('0x18c'),_[_0x7802('0x18d')](_0x1c0f86))]=_0x220708[_0x7802('0x189')][_0x1c0f86];}}}var _0x733d77=_0x108009[_0x7802('0x142')](_0x279661[_0x7802('0x70')])?getCallerId(_0x279661['Trunk'][_0x7802('0x18e')],_0x279661[_0x7802('0x18f')],_0x279661[_0x7802('0x190')]>0x0?getCallerIdRandom(_0x279661['dialOriginateCallerIdNumber'],_0x279661[_0x7802('0x190')]):_0x279661['dialOriginateCallerIdNumber']):getCallerId(_[_0x7802('0xa7')](_0x279661[_0x7802('0x191')])?_0x279661[_0x7802('0x70')]['callerid']:_0x279661[_0x7802('0x191')][_0x7802('0x18e')],_0x279661[_0x7802('0x18f')],_0x279661[_0x7802('0x190')]>0x0?getCallerIdRandom(_0x279661[_0x7802('0x59')],_0x279661['dialRandomLastDigitCallerIdNumber']):_0x279661[_0x7802('0x59')]);if(_0x733d77){_0x1bf642[_0x7802('0x192')]=_0x108009[_0x7802('0x123')][_0x56b3be][_0x7802('0x193')]=extractCalleridName(_0x733d77);_0x1bf642[_0x7802('0x194')]=_0x220708['phone'];}return ami[_0x7802('0xa8')]({'actionid':_0x56b3be,'action':_0x7802('0x173'),'channel':_0x108009[_0x7802('0x142')](_0x279661['Trunk'])?util[_0x7802('0x73')](_0x7802('0x195'),_0x279661[_0x7802('0x70')][_0x7802('0x3e')],isNotNull(_0x279661['dialPrefix'])?_0x279661[_0x7802('0x196')][_0x7802('0x197')]()||'':'',_0x279661['dialCutDigit']>0x0?_0x220708[_0x7802('0x198')][_0x7802('0x199')](_0x279661[_0x7802('0x19a')]):_0x220708[_0x7802('0x198')]):util[_0x7802('0x73')](_0x7802('0x195'),_['isNil'](_0x279661[_0x7802('0x191')])?_0x279661[_0x7802('0x70')][_0x7802('0x3e')]:_0x279661[_0x7802('0x191')][_0x7802('0x3e')],isNotNull(_0x279661[_0x7802('0x196')])?_0x279661['dialPrefix'][_0x7802('0x197')]()||'':'',_0x279661[_0x7802('0x19a')]>0x0?_0x220708['phone'][_0x7802('0x199')](_0x279661[_0x7802('0x19a')]):_0x220708[_0x7802('0x198')]),'callerid':_0x733d77,'Exten':_0x7802('0xd9'),'Context':_0x7802('0x19b'),'Priority':'1','variable':_0x1bf642,'timeout':(_0x279661['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x56b3be})[_0x7802('0x3b')](function(_0x2ad55a){return _0x2ee472(_0x2ad55a);})[_0x7802('0xad')](function(_0x39d662){_0x279661[_0x7802('0x60')]+=0x1;var _0x4923a7=new History(_0x108009[_0x7802('0x123')][_0x56b3be]);logger[_0x7802('0x91')](util['format'](_0x7802('0x19c'),JSON[_0x7802('0x72')](_0x39d662)));_0x4923a7[_0x7802('0xa3')]=0xe;_0x4923a7[_0x7802('0xde')]=_0x7802('0x19d');_0x4923a7[_0x7802('0xa4')]=moment()[_0x7802('0x73')](_0x7802('0xfb'));_0x4923a7[_0x7802('0x118')]=_0x4923a7[_0x7802('0xa4')];_0x108009[_0x7802('0xc3')](_0x4923a7)[_0x7802('0xad')](loggerCatch(_0x7802('0x19e')));_0x108009[_0x7802('0xd5')](_0x4923a7)[_0x7802('0xad')](loggerCatch('[originate][error]'))[_0x7802('0x20')](function(){delete _0x108009['actions'][_0x56b3be];return _0x5de3cf(msgResponse(_0x7802('0x173'),_0x7802('0x19f'),_0x7802('0x1a0')));});});});};Dialer[_0x7802('0x1d')][_0x7802('0x2f')]=function(_0x243dd9){var _0x216a9f=this['actions'][_0x243dd9[_0x7802('0x125')]];if(_0x216a9f){delete this['actions'][_0x243dd9[_0x7802('0x125')]];_0x216a9f[_0x7802('0x10d')]=moment()[_0x7802('0x73')](_0x7802('0xfb'));var _0x3e44ca=_0x216a9f[_0x7802('0x4b')]===_0x7802('0x75')?this[_0x7802('0x23')][_0x216a9f[_0x7802('0xaa')]]:this['voiceQueues'][_0x216a9f[_0x7802('0x1a1')]()];if(!this['isSuccess'](_0x243dd9[_0x7802('0x1a2')])){this[_0x7802('0xab')](_0x3e44ca);return this[_0x7802('0x1a3')](_0x216a9f,_0x3e44ca,_0x243dd9)[_0x7802('0xad')](loggerCatch(_0x7802('0x1a4')));}this[_0x7802('0x27')][_0x243dd9[_0x7802('0xd6')]]=_0x216a9f;}};Dialer[_0x7802('0x1d')][_0x7802('0x1a5')]=function(_0x123ada,_0x1b93d7,_0xd82440){var _0xb97d1f=new History(_0x1b93d7);if(_0xb97d1f[_0x7802('0x1a6')]+_0xb97d1f[_0x7802('0xf7')]+_0xb97d1f[_0x7802('0xea')]+_0xb97d1f[_0x7802('0xeb')]+_0xb97d1f[_0x7802('0xec')]+_0xb97d1f[_0x7802('0xed')]+_0xb97d1f[_0x7802('0xe6')]+_0xb97d1f[_0x7802('0xee')]>=_0xd82440['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x123ada){case 0x3:if(_0xb97d1f[_0x7802('0xea')]>=_0xd82440[_0x7802('0x1a7')]-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countnoanswerretry':_0xb97d1f[_0x7802('0xea')]+=0x1,'scheduledat':moment()['add'](_0xd82440[_0x7802('0x1a8')],'minutes')[_0x7802('0x73')](_0x7802('0xfb')),'ContactId':_0xb97d1f[_0x7802('0xcb')],'ListId':_0xb97d1f[_0x7802('0xcc')],'VoiceQueueId':_0xb97d1f[_0x7802('0xce')]||undefined,'CampaignId':_0xb97d1f['CampaignId']||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x1a9')));break;case 0x5:if(_0xb97d1f['countbusyretry']>=_0xd82440['dialBusyMaxRetry']-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countbusyretry':_0xb97d1f[_0x7802('0x1a6')]+=0x1,'scheduledat':moment()['add'](_0xd82440[_0x7802('0x1aa')],_0x7802('0xf4'))[_0x7802('0x73')](_0x7802('0xfb')),'ContactId':_0xb97d1f[_0x7802('0xcb')],'ListId':_0xb97d1f[_0x7802('0xcc')],'VoiceQueueId':_0xb97d1f[_0x7802('0xce')]||undefined,'CampaignId':_0xb97d1f[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x1ab')));break;case 0x8:if(_0xb97d1f[_0x7802('0xf7')]>=_0xd82440[_0x7802('0x1ac')]-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countcongestionretry':_0xb97d1f[_0x7802('0xf7')]+=0x1,'scheduledat':moment()['add'](_0xd82440['dialCongestionRetryFrequency'],_0x7802('0xf4'))[_0x7802('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb97d1f[_0x7802('0xcb')],'ListId':_0xb97d1f['ListId'],'VoiceQueueId':_0xb97d1f[_0x7802('0xce')]||undefined,'CampaignId':_0xb97d1f['CampaignId']||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x1ad')));break;case 0x0:if(_0xb97d1f[_0x7802('0xeb')]>=_0xd82440[_0x7802('0x1ae')]-0x1){return!![];}else{this[_0x7802('0xba')]({'active':![],'countnosuchnumberretry':_0xb97d1f['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0xd82440[_0x7802('0x1af')],_0x7802('0xf4'))[_0x7802('0x73')](_0x7802('0xfb')),'ContactId':_0xb97d1f[_0x7802('0xcb')],'ListId':_0xb97d1f[_0x7802('0xcc')],'VoiceQueueId':_0xb97d1f[_0x7802('0xce')]||undefined,'CampaignId':_0xb97d1f[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x1b0')));}break;case 0xa:if(_0xb97d1f[_0x7802('0xec')]>=_0xd82440['dialDropMaxRetry']-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countdropretry':_0xb97d1f[_0x7802('0xec')]+=0x1,'scheduledat':moment()[_0x7802('0xf3')](_0xd82440[_0x7802('0x111')],_0x7802('0xf4'))[_0x7802('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb97d1f[_0x7802('0xcb')],'ListId':_0xb97d1f[_0x7802('0xcc')],'VoiceQueueId':_0xb97d1f['VoiceQueueId']||undefined,'CampaignId':_0xb97d1f[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x116')));break;case 0xb:if(_0xb97d1f[_0x7802('0xed')]>=_0xd82440[_0x7802('0x11e')]-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countabandonedretry':_0xb97d1f[_0x7802('0xed')]+=0x1,'scheduledat':moment()[_0x7802('0xf3')](_0xd82440[_0x7802('0x11d')],_0x7802('0xf4'))[_0x7802('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb97d1f[_0x7802('0xcb')],'ListId':_0xb97d1f[_0x7802('0xcc')],'VoiceQueueId':_0xb97d1f[_0x7802('0xce')]||undefined,'CampaignId':_0xb97d1f[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x11f')));break;case 0x13:if(_0xb97d1f[_0x7802('0xe6')]>=_0xd82440[_0x7802('0xf1')]-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countmachineretry':_0xb97d1f[_0x7802('0xe6')]+=0x1,'scheduledat':moment()['add'](_0xd82440[_0x7802('0xfa')],_0x7802('0xf4'))[_0x7802('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb97d1f['ContactId'],'ListId':_0xb97d1f['ListId'],'VoiceQueueId':_0xb97d1f['VoiceQueueId']||undefined,'CampaignId':_0xb97d1f[_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0xf5')));break;case 0x14:if(_0xb97d1f[_0x7802('0xee')]>=_0xd82440[_0x7802('0x1b1')]-0x1){return!![];}this[_0x7802('0xba')]({'active':![],'countagentrejectretry':_0xb97d1f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x7802('0xf3')](_0xd82440[_0x7802('0x1b2')],'minutes')[_0x7802('0x73')](_0x7802('0xfb')),'ContactId':_0xb97d1f['ContactId'],'ListId':_0xb97d1f['ListId'],'VoiceQueueId':_0xb97d1f[_0x7802('0xce')]||undefined,'CampaignId':_0xb97d1f['CampaignId']||undefined})['catch'](loggerCatch(_0x7802('0x1b3')));break;default:return!![];}};Dialer[_0x7802('0x1d')][_0x7802('0x1a3')]=function(_0x12d61d,_0xbd8714,_0x552094){var _0x3d1a14=this;var _0x40b1d9=new History(_0x12d61d);var _0x219024=![];var _0x1e81c6;var _0x4fd204;return new BPromise(function(_0x247e06,_0x271366){if(_[_0x7802('0x3c')](_0xbd8714)&&typeof _0xbd8714!==_0x7802('0x172')){return _0x271366(msgResponse(_0x7802('0x1b4'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x552094)&&typeof _0x552094!==_0x7802('0x172')){return _0x271366(msgResponse(_0x7802('0x1b4'),_0x7802('0x147'),_0x7802('0x1b5')));}_0x3d1a14['verifyAdditionalPhones'](_0x40b1d9,_0x552094[_0x7802('0x104')],_0xbd8714)[_0x7802('0x3b')](function(_0x576a65){if(_0x576a65[_0x7802('0x114')]==0x1)_0x219024=!![];switch(_0x552094[_0x7802('0x104')]){case'0':_0xbd8714[_0x7802('0x5f')]+=0x1;_0x40b1d9[_0x7802('0xa3')]=0x0;_0x40b1d9[_0x7802('0xde')]=_0x7802('0x1b6');_0x40b1d9[_0x7802('0xeb')]+=0x1;_0x40b1d9[_0x7802('0x11c')]+=0x1;ami[_0x7802('0x4a')]('custom:agentnosuchnumber',ut['buildObj'](_0x12d61d,_0x7802('0x1b7')));_0x1e81c6=_0xbd8714[_0x7802('0x1af')];_0x4fd204=_0xbd8714[_0x7802('0x112')];_0x3d1a14[_0x7802('0xc3')](_0x40b1d9)[_0x7802('0xad')](loggerCatch(_0x7802('0xe9')));if(_0x3d1a14[_0x7802('0x1a5')](0x0,_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9[_0x7802('0xeb')]>=_0xbd8714[_0x7802('0x1ae')]){_0x3d1a14[_0x7802('0xf2')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1b8'));}else{_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1b8'));}}break;case'3':_0xbd8714[_0x7802('0x1b9')]+=0x1;_0x40b1d9[_0x7802('0xa3')]=0x3;_0x40b1d9[_0x7802('0xde')]='NoAnswer';_0x40b1d9[_0x7802('0xea')]+=0x1;_0x40b1d9[_0x7802('0x11c')]+=0x1;ami[_0x7802('0x4a')](_0x7802('0x1ba'),ut[_0x7802('0xe7')](_0x12d61d,'noanswer'));_0x1e81c6=_0xbd8714[_0x7802('0x1a8')];_0x4fd204=_0xbd8714[_0x7802('0x112')];_0x3d1a14[_0x7802('0xc3')](_0x40b1d9)[_0x7802('0xad')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3d1a14[_0x7802('0x1a5')](0x3,_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9[_0x7802('0xea')]>=_0xbd8714[_0x7802('0x1a7')]){_0x3d1a14[_0x7802('0xf2')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1bb'));}else{_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1bb'));}}break;case'5':_0xbd8714[_0x7802('0x5b')]+=0x1;_0x40b1d9['state']=0x5;_0x40b1d9[_0x7802('0xde')]=_0x7802('0x1bc');_0x40b1d9[_0x7802('0x1a6')]+=0x1;_0x40b1d9[_0x7802('0x11c')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x7802('0xe7')](_0x12d61d,_0x7802('0x1bd')));_0x1e81c6=_0xbd8714[_0x7802('0x1aa')];_0x4fd204=_0xbd8714[_0x7802('0x112')];_0x3d1a14['createHistory'](_0x40b1d9)['catch'](loggerCatch(_0x7802('0x1be')));if(_0x3d1a14['checkRetriveMax'](0x5,_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9['countbusyretry']>=_0xbd8714[_0x7802('0x1bf')]){_0x3d1a14[_0x7802('0xf2')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1c0'));}else{_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1c0'));}}break;case'8':_0xbd8714[_0x7802('0x1c1')]+=0x1;_0x40b1d9[_0x7802('0xa3')]=0x8;_0x40b1d9[_0x7802('0xde')]=_0x7802('0x1c2');_0x40b1d9['countcongestionretry']+=0x1;_0x40b1d9[_0x7802('0x11c')]+=0x1;_0x1e81c6=_0xbd8714[_0x7802('0x1c3')];_0x4fd204=_0xbd8714[_0x7802('0x112')];ami['emit'](_0x7802('0x1c4'),ut['buildObj'](_0x12d61d,_0x7802('0x1c5')));_0x3d1a14[_0x7802('0xc3')](_0x40b1d9)[_0x7802('0xad')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x3d1a14[_0x7802('0x1a5')](0x8,_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9[_0x7802('0xf7')]>=_0xbd8714[_0x7802('0x1ac')]){_0x3d1a14[_0x7802('0xf2')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1c6'));}else{_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,'reason\x208\x20congestion');}}break;case'11':_0xbd8714['outboundAbandonedCallsDay']+=0x1;_0x40b1d9[_0x7802('0xa3')]=0xb;_0x40b1d9[_0x7802('0xde')]=_0x7802('0x120');_0x40b1d9[_0x7802('0xed')]+=0x1;_0x40b1d9[_0x7802('0x11c')]+=0x1;_0x1e81c6=_0xbd8714[_0x7802('0x11d')];_0x4fd204=_0xbd8714['callAdditionalPhoneAfterMin'];_0x3d1a14[_0x7802('0xc3')](_0x40b1d9)[_0x7802('0xad')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x3d1a14['checkRetriveMax'](0xb,_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9[_0x7802('0xed')]>=_0xbd8714[_0x7802('0x11e')]){_0x3d1a14['createStateFinal'](_0x40b1d9,_0x247e06,_0x271366,'reason\x2011\x20abandoned');}else{_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1c7'));}}break;case'20':_0xbd8714[_0x7802('0x1c8')]+=0x1;_0x40b1d9[_0x7802('0xa3')]=0x14;_0x40b1d9[_0x7802('0xde')]=_0x7802('0x1c9');_0x40b1d9['countagentrejectretry']+=0x1;_0x40b1d9['countglobal']+=0x1;_0x1e81c6=_0xbd8714['dialAgentRejectRetryFrequency'];_0x4fd204=_0xbd8714['callAdditionalPhoneAfterMin'];ami['emit'](_0x7802('0x1ca'),ut[_0x7802('0xe7')](_0x12d61d,'agentreject'));_0x3d1a14[_0x7802('0xc3')](_0x40b1d9)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3d1a14[_0x7802('0x1a5')](0x14,_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9['countagentrejectretry']>=_0xbd8714['dialAgentRejectMaxRetry']){_0x3d1a14[_0x7802('0xf2')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1cb'));}else{_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,_0x7802('0x1cb'));}}break;default:_0xbd8714['outboundUnknownCallsDay']+=0x1;_0x40b1d9['state']=0xc;_0x40b1d9[_0x7802('0xde')]=_0x552094[_0x7802('0x104')];_0x1e81c6=_0xbd8714['dialAgentRejectRetryFrequency'];_0x4fd204=_0xbd8714[_0x7802('0x112')];_0x3d1a14[_0x7802('0xc3')](_0x40b1d9)[_0x7802('0xad')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3d1a14[_0x7802('0x1a5')](_0x552094[_0x7802('0x104')],_0x12d61d,_0xbd8714)&&!_0x219024){if(_0x40b1d9[_0x7802('0x1a6')]+_0x40b1d9['countcongestionretry']+_0x40b1d9['countnoanswerretry']+_0x40b1d9[_0x7802('0xeb')]+_0x40b1d9[_0x7802('0xec')]+_0x40b1d9[_0x7802('0xed')]+_0x40b1d9[_0x7802('0xe6')]+_0x40b1d9[_0x7802('0xee')]>=_0xbd8714[_0x7802('0xef')]){_0x3d1a14[_0x7802('0xf0')](_0x40b1d9,_0x247e06,_0x271366,_0x552094['reason']);}else{_0x3d1a14[_0x7802('0xf2')](_0x40b1d9,_0x247e06,_0x271366,_0x552094[_0x7802('0x104')]);}}}})[_0x7802('0x3b')](function(_0x2f8493){if(_0x219024){_0x3d1a14[_0x7802('0xb3')](_0x40b1d9,_0x1e81c6,_0x4fd204)[_0x7802('0x3b')](function(_0x46f883){return _0x247e06(0x1);});}});});};Dialer['prototype'][_0x7802('0xf0')]=function(_0x340b45,_0x37fd4,_0x230737,_0x5ba863){var _0x5becf5=new Final(_0x340b45);_0x5becf5[_0x7802('0xa3')]=0xf;_0x5becf5['statedesc']=_0x7802('0x1cc');this[_0x7802('0xf2')](_0x5becf5,_0x37fd4,_0x230737,_0x5ba863);};Dialer[_0x7802('0x1d')][_0x7802('0xf2')]=function(_0x3b9bd9,_0x35dc3a,_0x205d80,_0x52cb12){this[_0x7802('0xd5')](_0x3b9bd9)[_0x7802('0x3b')](function(){return _0x35dc3a(msgResponse(_0x7802('0x1b4'),_0x7802('0xd1'),_0x52cb12));})[_0x7802('0xad')](function(){return _0x205d80(msgResponse(_0x7802('0x1cd'),_0x7802('0x147'),_0x7802('0x1ce')));});};Dialer['prototype'][_0x7802('0xb')]=function(_0x313bf9){var _0x1d762d=_0x313bf9[_0x7802('0x1cf')]/0x64;var _0x42ca56=_0x313bf9[_0x7802('0x5e')]/(_0x313bf9[_0x7802('0x5e')]+_0x313bf9[_0x7802('0xdd')]);var _0x421c17=Math['round'](_0x313bf9[_0x7802('0x69')]*(_0x313bf9['predictiveIntervalMaxThreshold']/0x64));var _0xd7c52a=Math[_0x7802('0x1d0')](_0x313bf9[_0x7802('0x69')]*(_0x313bf9[_0x7802('0x1d1')]/0x64));var _0x35b699=_0x313bf9[_0x7802('0x4e')]+_0x313bf9[_0x7802('0x54')];var _0x29137a=Math['floor'](_0x313bf9[_0x7802('0x6b')]*_0x313bf9[_0x7802('0x6d')]*_0x313bf9[_0x7802('0x1d2')]*_0x313bf9[_0x7802('0x68')]);if(_[_0x7802('0x3c')](_0x313bf9[_0x7802('0x1d3')])){if(!_['isUndefined'](_0x313bf9['startPredictive'])){_0x313bf9['startPredictive']=undefined;loggerPredictive[_0x7802('0x91')](_0x7802('0x1d4'),_0x7802('0x1d5'));}if(!_[_0x7802('0x3c')](_0x313bf9['handlePredictive'])){loggerPredictive['error'](_0x7802('0x1d4'),_0x7802('0x1d6'));clearInterval(_0x313bf9[_0x7802('0x88')]);_0x313bf9[_0x7802('0x88')]=undefined;}_0x313bf9['startProgressive']=moment()[_0x7802('0x73')](_0x7802('0xfb'));loggerPredictive[_0x7802('0x77')](_0x313bf9[_0x7802('0x3e')],'collection\x20data\x20in\x20progressive\x20at',_0x313bf9[_0x7802('0x1d3')]);this[_0x7802('0x15a')](_0x313bf9,0x1);}else if(ifInterval(_0x313bf9[_0x7802('0x1d7')],_0x313bf9['startProgressive'])){this[_0x7802('0x15a')](_0x313bf9,0x1);loggerPredictiveCalls[_0x7802('0x77')](_0x7802('0x1d8'),_0x313bf9[_0x7802('0x1d3')],_0x313bf9[_0x7802('0x3e')]);_0x313bf9['erlangCalls']=0x0;_0x313bf9[_0x7802('0x67')]=0x0;}else if(_0x1d762d<_0x42ca56&&_0x313bf9[_0x7802('0x1d9')]===_0x7802('0x1da')){freeVariablesPredictive(_0x313bf9);loggerPredictive[_0x7802('0x77')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7802('0x1db'),_0x42ca56,_0x7802('0x1d3'),_0x313bf9[_0x7802('0x3e')]);}else if(_0x29137a<_0x313bf9[_0x7802('0x67')]&&_0x313bf9[_0x7802('0x1d9')]===_0x7802('0x1da')){freeVariablesPredictive(_0x313bf9);loggerPredictive['info'](_0x7802('0x1dc'),_0x7802('0x1dd'),_0x29137a,_0x7802('0x1de'),_0x313bf9[_0x7802('0x67')],_0x7802('0x1d3'),_0x313bf9[_0x7802('0x3e')]);}else if(!ifInterval(_0x313bf9[_0x7802('0x1d7')],_0x313bf9['startProgressive'])&&_['isUndefined'](_0x313bf9[_0x7802('0x6f')])&&!_['isUndefined'](_0x313bf9['startProgressive'])){_0x313bf9[_0x7802('0x6f')]=moment()[_0x7802('0x73')](_0x7802('0xfb'));loggerPredictive[_0x7802('0x77')](_0x313bf9[_0x7802('0x3e')],_0x7802('0x1df'),_0x313bf9[_0x7802('0x6f')]);this['averageHandleTime'](_0x313bf9[_0x7802('0x1d7')])[_0x7802('0x3b')](this[_0x7802('0x1e0')](_0x313bf9))['then'](mergeDataErlangB(_0x313bf9))[_0x7802('0x3b')](this['startMethodPredictive'](_0x313bf9))[_0x7802('0xad')](loggerCatchPredictive(_0x7802('0x1e1'),_0x313bf9));}else if(!ifInterval(_0x313bf9['dialPredictiveInterval'],_0x313bf9[_0x7802('0x6f')])){_0x313bf9['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x313bf9[_0x7802('0x6f')]=moment()[_0x7802('0x73')](_0x7802('0xfb'));loggerPredictive[_0x7802('0x77')](_0x313bf9[_0x7802('0x3e')],'recalculate\x20predictive\x20at',_0x313bf9['startPredictive']);clearInterval(_0x313bf9[_0x7802('0x88')]);_0x313bf9[_0x7802('0x88')]=undefined;this[_0x7802('0xb7')](_0x313bf9['dialPredictiveInterval'])['then'](this[_0x7802('0x1e0')](_0x313bf9))[_0x7802('0x3b')](mergeDataErlangB(_0x313bf9))[_0x7802('0x3b')](this[_0x7802('0x1e2')](_0x313bf9))[_0x7802('0xad')](loggerCatchPredictive(_0x7802('0x1e3'),_0x313bf9));}else if(_0x313bf9[_0x7802('0x69')]&&_0x35b699<_0x313bf9[_0x7802('0x69')]-_0xd7c52a){freeVariablesPredictive(_0x313bf9);loggerPredictive[_0x7802('0x77')](_0x313bf9[_0x7802('0x3e')],_0x7802('0x1e4'),_0x35b699,_0x7802('0x1e5'),_0x313bf9[_0x7802('0x69')],'-',_0xd7c52a,'=',_0x313bf9[_0x7802('0x69')]-_0xd7c52a,')');}else if(_0x313bf9[_0x7802('0x69')]&&_0x35b699>_0x313bf9[_0x7802('0x69')]+_0x421c17){freeVariablesPredictive(_0x313bf9);loggerPredictive['info'](_0x313bf9['name'],_0x7802('0x1e4'),_0x35b699,_0x7802('0x1e6'),_0x313bf9[_0x7802('0x69')],'+',_0x421c17,'=',_0x313bf9[_0x7802('0x69')]+_0x421c17,')');}};Dialer['prototype'][_0x7802('0x1e0')]=function(_0x16c288){var _0x694c8d=this;return function(_0x55987e){return new BPromise(function(_0x33baaf,_0xecf3f){_[_0x7802('0x85')](_0x16c288,_0x55987e[0x0]);if(checkGetDataPredictive(_0x55987e[0x0])){var _0x391424=_0x16c288['predictiveIntervalAvailable']=_0x16c288[_0x7802('0x54')]+_0x16c288[_0x7802('0x4e')];var _0x3cad21=_0x16c288['dialPredictiveInterval']*0x3c;var _0xb76826=_0x55987e[0x0][_0x7802('0x7b')]+_0x55987e[0x0][_0x7802('0x63')];var _0x431dc1=(_0x55987e[0x0][_0x7802('0x62')]+_0x55987e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x55987e[0x0][_0x7802('0x64')])/_0x55987e[0x0][_0x7802('0x6a')];_0x16c288['predictiveIntervalHitRate']=_0x431dc1>0x0?_0x431dc1:0x1;switch(_0x16c288[_0x7802('0x1d9')]){case _0x7802('0x1da'):var _0x204fdb=_0x16c288[_0x7802('0x1cf')]/0x64;return _0x694c8d[_0x7802('0x1e7')](_0x391424,_0x3cad21,_0xb76826,_0x431dc1,_0x204fdb)[_0x7802('0x3b')](function(_0x35751d){return _0x33baaf(_0x35751d);});case _0x7802('0x1e8'):var _0x1c7c8b=_0x16c288[_0x7802('0x1cf')]/0x64;return _0x694c8d['busyFactor'](_0x391424,_0x3cad21,_0xb76826,_0x431dc1,_0x1c7c8b)[_0x7802('0x3b')](function(_0x2d6971){return _0x33baaf(_0x2d6971);});default:return _0xecf3f(msgResponse(_0x7802('0x1e9'),_0x7802('0x147'),_0x7802('0x1ea')));}}else{return _0xecf3f(msgResponse(_0x7802('0x1e9'),_0x7802('0x147'),_0x7802('0x1eb')));}});};};Dialer['prototype'][_0x7802('0x1ec')]=function(_0x59699d){var _0x830767=this;return function(_0x2e30bd){return new BPromise(function(_0x40eb7b,_0x533ff3){_[_0x7802('0x85')](_0x59699d,_0x2e30bd[0x0]);if(checkGetDataPredictive(_0x2e30bd[0x0])){loggerPredictive[_0x7802('0x77')](JSON[_0x7802('0x72')](_0x2e30bd[0x0]));if(_0x59699d['dialPredictiveOptimization']==='dropRate'){return _0x830767[_0x7802('0xc2')](_0x59699d['id'])[_0x7802('0x3b')](function(_0x5c8f8c){var _0x2b3a16=_0x59699d[_0x7802('0x4f')]-_0x5c8f8c[0x0][_0x7802('0x1ed')];var _0x252fdf=_0x59699d[_0x7802('0x1d7')]*0x3c;var _0x741339=_0x2e30bd[0x0]['predictiveIntervalAvgTalktime']+_0x2e30bd[0x0][_0x7802('0x63')];var _0xb7436f=(_0x2e30bd[0x0]['predictiveIntervalAnsweredCalls']+_0x2e30bd[0x0][_0x7802('0x65')]+_0x2e30bd[0x0][_0x7802('0x64')])/_0x2e30bd[0x0][_0x7802('0x6a')];var _0x203384=_0x59699d[_0x7802('0x1cf')]/0x64;_0x59699d[_0x7802('0x1ee')]=_0x5c8f8c[0x0][_0x7802('0x1ed')]||0x0;_0x59699d[_0x7802('0x1d2')]=_0xb7436f>0x0?_0xb7436f:0x1;return _0x830767[_0x7802('0x1e7')](_0x2b3a16,_0x252fdf,_0x741339,_0xb7436f,_0x203384);})['then'](function(_0xb43f71){return _0x40eb7b(_0xb43f71);})[_0x7802('0xad')](function(_0x3db554){return _0x533ff3(msgResponse('[CatchErlangB]',_0x7802('0x147'),JSON[_0x7802('0x72')](_0x3db554)));});}if(_0x59699d[_0x7802('0x1d9')]===_0x7802('0x1e8')){return _0x830767[_0x7802('0xc2')](_0x59699d['id'])[_0x7802('0x3b')](function(_0x56044a){var _0x6a8521=_0x59699d[_0x7802('0x4f')]-_0x56044a[0x0][_0x7802('0x1ed')];var _0x5e9e26=_0x59699d['dialPredictiveInterval']*0x3c;var _0x42add2=_0x2e30bd[0x0]['predictiveIntervalAvgTalktime']+_0x2e30bd[0x0][_0x7802('0x63')];var _0x404f67=(_0x2e30bd[0x0][_0x7802('0x62')]+_0x2e30bd[0x0][_0x7802('0x65')]+_0x2e30bd[0x0][_0x7802('0x64')])/_0x2e30bd[0x0][_0x7802('0x6a')];var _0x5b6809=_0x59699d[_0x7802('0x1cf')]/0x64;_0x59699d[_0x7802('0x1ee')]=_0x56044a[0x0]['outboundQueuePauses']||0x0;_0x59699d['predictiveIntervalHitRate']=_0x404f67>0x0?_0x404f67:0x1;return _0x830767[_0x7802('0x1ef')](_0x6a8521,_0x5e9e26,_0x42add2,_0x404f67,_0x5b6809);})[_0x7802('0x3b')](function(_0x4fba26){return _0x40eb7b(_0x4fba26);})[_0x7802('0xad')](function(_0x34cc91){return _0x533ff3(msgResponse(_0x7802('0x1f0'),_0x7802('0x147'),JSON['stringify'](_0x34cc91)));});}}else{return _0x533ff3(msgResponse('[getDataPredictive]',_0x7802('0x147'),_0x7802('0x1eb')));}});};};Dialer[_0x7802('0x1d')][_0x7802('0x1e2')]=function(_0x2c9f46){var _0x50587e=this;return function(){var _0x1cd503=0x0;var _0x4a55eb=Math[_0x7802('0x1f1')](_0x2c9f46[_0x7802('0x6c')]*0x3e8);if(_0x4a55eb>0x0){_0x4a55eb=_0x4a55eb<0x64?0x64:_0x4a55eb;loggerPredictive['info'](_0x2c9f46[_0x7802('0x3e')],_0x7802('0x1f2'),_0x4a55eb,_0x7802('0x47'));_0x2c9f46[_0x7802('0x88')]=setInterval(function(){_0x50587e[_0x7802('0x88')](_0x2c9f46);loggerPredictiveCalls['info'](_0x7802('0x1f3'),_0x1cd503+=0x1);},_0x4a55eb);}else{loggerPredictive[_0x7802('0x77')](_0x2c9f46[_0x7802('0x3e')],_0x7802('0x1f4'));}};};Dialer['prototype']['checkContactBlack']=function(_0x5eb7d6,_0x5b215d){var _0x42dfbc=this;return function(_0x10c0e2){if(_['isEmpty'](_0x10c0e2)){if(_[_0x7802('0xa7')](_0x5b215d[_0x7802('0xcd')])||!_0x5b215d[_0x7802('0x1f5')]){if(_0x5eb7d6['dialMethod']===_0x7802('0xa')){_0x5eb7d6[_0x7802('0x12d')]=_[_0x7802('0x3c')](_0x5eb7d6[_0x7802('0x12d')])?!![]:_0x5eb7d6[_0x7802('0x12d')];var _0xa3b53c=uuid['v4']();_0x42dfbc[_0x7802('0x123')][_0xa3b53c]=new Action(_0x5eb7d6,_0x5b215d,_0xa3b53c);loggerBooked['info']('[booked][checkContactBlack]',_0xa3b53c,_0x7802('0x1f6'),JSON[_0x7802('0x72')](_0x5eb7d6['queueStatusComplete']),_0x7802('0x1f7'),_0x5eb7d6[_0x7802('0x3e')]);if(_0x5eb7d6[_0x7802('0x12d')]){_0x5eb7d6[_0x7802('0x12d')]=![];_0x42dfbc['queueBooked'][_0x42dfbc[_0x7802('0x123')][_0xa3b53c][_0x7802('0xaa')]]=[];ami['Action']({'actionid':_0xa3b53c,'action':'queuestatus','queue':_0x5eb7d6[_0x7802('0x3e')]})['catch'](function(){_0x42dfbc['updateOriginated'](_0x5eb7d6);_0x42dfbc[_0x7802('0xba')]({'active':![],'ContactId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c]['ContactId'],'ListId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c][_0x7802('0xcc')],'VoiceQueueId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c][_0x7802('0xce')]||undefined,'CampaignId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c][_0x7802('0xcf')]||undefined})[_0x7802('0xad')](loggerCatch(_0x7802('0x1f8')));delete _0x42dfbc[_0x7802('0x123')][_0xa3b53c];});}else{loggerBooked[_0x7802('0x77')](_0x7802('0x1f9'),JSON['stringify'](_0x5eb7d6[_0x7802('0x12d')]),'Queue:\x20',_0x5eb7d6[_0x7802('0x3e')]);_0x42dfbc['updateOriginated'](_0x5eb7d6);_0x42dfbc[_0x7802('0xba')]({'active':![],'ContactId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c][_0x7802('0xcb')],'ListId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c][_0x7802('0xcc')],'VoiceQueueId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c]['VoiceQueueId']||undefined,'CampaignId':_0x42dfbc[_0x7802('0x123')][_0xa3b53c]['CampaignId']||undefined})['catch'](loggerCatch(_0x7802('0x1f8')));delete _0x42dfbc[_0x7802('0x123')][_0xa3b53c];}}else{return _0x42dfbc['actionOriginate'](_0x5eb7d6,_0x5b215d);}}else{if(getDiff(_0x5b215d['scheduledat'])<_0x5eb7d6[_0x7802('0x1fa')]*0x3c){if(_0x5b215d[_0x7802('0x169')]&&!_0x5b215d[_0x7802('0x169')][_0x7802('0x1fb')]){_0x42dfbc[_0x7802('0x21')][_0x7802('0x131')](_0x5b215d['id'])[_0x7802('0x20')](function(){_0x42dfbc[_0x7802('0xab')](_0x5eb7d6);});}else{_0x42dfbc[_0x7802('0xbc')]({'active':![]},_0x5b215d['id'],0x1)[_0x7802('0x20')](function(){_0x42dfbc[_0x7802('0xab')](_0x5eb7d6);});}}else{_0x5eb7d6[_0x7802('0x61')]+=0x1;_0x42dfbc[_0x7802('0xab')](_0x5eb7d6);if(_0x5eb7d6['dialRecallInQueue']){_0x42dfbc[_0x7802('0xba')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b215d[_0x7802('0xcb')],'ListId':_0x5b215d['ListId'],'VoiceQueueId':_0x5b215d['VoiceQueueId']||undefined,'CampaignId':_0x5b215d['CampaignId']||undefined})[_0x7802('0xad')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x42dfbc[_0x7802('0xc3')](createObjHistory(_0x5eb7d6,_0x5b215d,_0x7802('0x1fc'),0x17,'RecallInQueue'))[_0x7802('0xad')](loggerCatch(_0x7802('0x1fd')));}else{_0x42dfbc['saveInDb'](createObjHistory(_0x5eb7d6,_0x5b215d,_0x7802('0x1fe'),0x16,'RecallFailedTimeout'),_0x7802('0x1ff'),'[Originate][HistoryRecallClose]');}}}}else{_0x5eb7d6[_0x7802('0x200')]+=0x1;_0x42dfbc['saveInDb'](createObjHistory(_0x5eb7d6,_0x5b215d,'BLACKLIST',0xd,_0x7802('0x201')),_0x7802('0x202'),_0x7802('0x203'));throw _0x7802('0x204');}};};Dialer[_0x7802('0x1d')][_0x7802('0x15f')]=function(_0x4abe2b){var _0x66a9d6=this;var _0x173953=_0x4abe2b['limitCalls']-_0x4abe2b[_0x7802('0x94')]-_0x4abe2b[_0x7802('0xbf')];emitCampaignSummary(_0x4abe2b);if(_0x173953>0x0){if(_0x173953>this['maxNumberOriginate']){_0x173953=this[_0x7802('0x25')];}_0x4abe2b[_0x7802('0xbf')]+=_0x173953;this[_0x7802('0xc0')](_0x4abe2b['id'],_0x173953,_0x4abe2b[_0x7802('0x205')],_0x4abe2b)[_0x7802('0x3b')](function(_0x31ec97){_0x4abe2b[_0x7802('0xbf')]-=_0x173953;_0x4abe2b[_0x7802('0xbf')]=_0x4abe2b[_0x7802('0xbf')]>0x0?_0x4abe2b[_0x7802('0xbf')]:0x0;if(!checkContactEmpty(_0x31ec97)){_0x4abe2b[_0x7802('0x3f')]=_0x7802('0x9b');logger[_0x7802('0x77')](_0x7802('0x206')+_0x4abe2b[_0x7802('0x3e')]);}else{_0x4abe2b[_0x7802('0x94')]+=_0x31ec97['length'];_0x4abe2b[_0x7802('0x3f')]='RUNNING';for(var _0x127f96=0x0;_0x127f96<_0x31ec97[_0x7802('0x93')];_0x127f96+=0x1){_0x4abe2b[_0x7802('0x207')]+=0x1;if(_[_0x7802('0xa7')](_0x31ec97[_0x127f96])||_[_0x7802('0xa7')](_0x31ec97[_0x127f96]['Contact'])||_[_0x7802('0xa7')](_0x31ec97[_0x127f96][_0x7802('0x198')])){_0x66a9d6[_0x7802('0xc8')](_0x7802('0x208'),_0x4abe2b,_0x31ec97[_0x127f96]);}else{_0x66a9d6[_0x7802('0xb5')](_[_0x7802('0x12b')](_0x31ec97[_0x127f96],[_0x7802('0xcf'),'Contact.phone']))['then'](_0x66a9d6[_0x7802('0x209')](_0x4abe2b,_0x31ec97[_0x127f96]))[_0x7802('0xad')](_0x66a9d6[_0x7802('0xc7')](_0x7802('0x20a'),_0x4abe2b));}}}})['catch'](loggerGetContactDialer(_0x7802('0x20b'),_0x4abe2b,_0x173953));}};Dialer[_0x7802('0x1d')][_0x7802('0x15a')]=function(_0x4e1e83,_0x5bebc5){var _0x1a1eff=this;var _0x3ee569=[];var _0x4e6745=_0x5bebc5>=0x1?_0x5bebc5:0x1;if(_0x4e1e83[_0x7802('0x160')]===_0x7802('0xa')){_0x4e6745=0x1;}var _0x1ef89a=Math[_0x7802('0x1f1')](_0x4e1e83[_0x7802('0x4e')]*_0x4e6745)-_0x4e1e83[_0x7802('0x94')]-_0x4e1e83[_0x7802('0xbf')];emitVoiceQueueSummary(_0x4e1e83);if(_0x4e1e83[_0x7802('0x20c')]>0x0){var _0x1ae1d5=_0x4e1e83[_0x7802('0x20c')]-_0x4e1e83[_0x7802('0x94')]-_0x4e1e83['talking']-_0x4e1e83[_0x7802('0xbf')]-_0x4e1e83[_0x7802('0x50')];if(_0x1ef89a>_0x1ae1d5){_0x1ef89a=_0x1ae1d5;}}if(_0x1ef89a>0x0){if(_0x4e1e83[_0x7802('0x160')]==='booked'){_0x1ef89a=0x1;}if(_0x1ef89a>this[_0x7802('0x25')]){_0x1ef89a=this[_0x7802('0x25')];}_0x4e1e83['temp']+=_0x1ef89a;for(var _0x47f230 in this[_0x7802('0x127')]){if(typeof this[_0x7802('0x127')][_0x47f230]!=='undefined'){if(this[_0x7802('0x127')][_0x47f230][_0x7802('0xa3')]==='not_inuse'&&this[_0x7802('0x127')][_0x47f230]['status']===_0x7802('0xd3')){_0x3ee569[_0x7802('0x12a')](this[_0x7802('0x127')][_0x47f230]['id']);}}}this[_0x7802('0xbe')](_0x4e1e83['id'],_0x3ee569,_0x1ef89a,_0x4e1e83[_0x7802('0x205')],_0x4e1e83)[_0x7802('0x3b')](function(_0x565c63){_0x4e1e83[_0x7802('0xbf')]-=_0x1ef89a;_0x4e1e83[_0x7802('0xbf')]=_0x4e1e83[_0x7802('0xbf')]>0x0?_0x4e1e83['temp']:0x0;if(!checkContactEmpty(_0x565c63)){_0x1a1eff[_0x7802('0xac')](_0x4e1e83)['then'](sendMessageReschedule(_0x4e1e83))[_0x7802('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x4e1e83['originated']+=_0x565c63[_0x7802('0x93')];_0x4e1e83[_0x7802('0x3f')]=_0x4e1e83[_0x7802('0x160')]===_0x7802('0xa')?_0x7802('0x179'):'RUNNING';for(var _0x2ac979=0x0;_0x2ac979<_0x565c63[_0x7802('0x93')];_0x2ac979+=0x1){if(_[_0x7802('0xa7')](_0x565c63[_0x2ac979])||_[_0x7802('0xa7')](_0x565c63[_0x2ac979][_0x7802('0x189')])||_[_0x7802('0xa7')](_0x565c63[_0x2ac979][_0x7802('0x198')])){_0x1a1eff['emptyContact'](_0x7802('0x208'),_0x4e1e83,_0x565c63[_0x2ac979]);}else{_0x1a1eff[_0x7802('0xaf')](_[_0x7802('0x12b')](_0x565c63[_0x2ac979],[_0x7802('0xce'),_0x7802('0x20d')]))[_0x7802('0x3b')](_0x1a1eff[_0x7802('0x209')](_0x4e1e83,_0x565c63[_0x2ac979]))[_0x7802('0xad')](_0x1a1eff[_0x7802('0xc7')](_0x7802('0x208'),_0x4e1e83));}}}})[_0x7802('0xad')](loggerGetContactDialer(_0x7802('0x20e'),_0x4e1e83,_0x1ef89a));}};Dialer[_0x7802('0x1d')][_0x7802('0x88')]=function(_0x4fa4e1){if(_0x4fa4e1[_0x7802('0x20c')]>0x0){var _0x518320=_0x4fa4e1['dialLimitQueue']-_0x4fa4e1[_0x7802('0x94')]-_0x4fa4e1[_0x7802('0x54')];if(_0x518320>0x0){this[_0x7802('0x20f')](_0x4fa4e1);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x7802('0x20f')](_0x4fa4e1);}};Dialer[_0x7802('0x1d')][_0x7802('0x20f')]=function(_0x415a1f){var _0x3356bb=this;var _0x5f4f18=[];_0x415a1f['originated']+=0x1;for(var _0x1b7e4d in this[_0x7802('0x127')]){if(typeof this[_0x7802('0x127')][_0x1b7e4d]!==_0x7802('0xc5')){if(this[_0x7802('0x127')][_0x1b7e4d][_0x7802('0xa3')]===_0x7802('0x210')&&this[_0x7802('0x127')][_0x1b7e4d][_0x7802('0xa9')]===_0x7802('0xd3')){_0x5f4f18[_0x7802('0x12a')](this[_0x7802('0x127')][_0x1b7e4d]['id']);}}}this['getContactDialer'](_0x415a1f['id'],_0x5f4f18,0x1,_0x415a1f[_0x7802('0x205')],_0x415a1f)[_0x7802('0x3b')](function(_0x3ca119){if(!checkContactEmpty(_0x3ca119)){checkContactLowerLimitOriginate(_0x415a1f,0x1,0x0);_0x3356bb[_0x7802('0xac')](_0x415a1f)['then'](sendMessageReschedule(_0x415a1f))[_0x7802('0xad')](loggerCatch(_0x7802('0xae')));}else{_0x415a1f[_0x7802('0x3f')]=_0x7802('0x211');if(_[_0x7802('0xa7')](_0x3ca119[0x0])||_[_0x7802('0xa7')](_0x3ca119[0x0][_0x7802('0x189')])||_[_0x7802('0xa7')](_0x3ca119[0x0]['phone'])){_0x3356bb[_0x7802('0xc8')]('[actionOriginate]\x20',_0x415a1f,_0x3ca119[0x0]);}else{_0x3356bb[_0x7802('0xaf')](_[_0x7802('0x12b')](_0x3ca119[0x0],[_0x7802('0xce'),_0x7802('0x20d')]))[_0x7802('0x3b')](_0x3356bb[_0x7802('0x209')](_0x415a1f,_0x3ca119[0x0]))[_0x7802('0xad')](_0x3356bb[_0x7802('0xc7')]('[actionOriginatePredictive]\x20',_0x415a1f));}}})[_0x7802('0xad')](loggerGetContactDialer(_0x7802('0x212'),_0x415a1f,0x1));emitVoiceQueueSummary(_0x415a1f);};Dialer[_0x7802('0x1d')][_0x7802('0x1e7')]=function(_0x5f34ec,_0xd7e6ed,_0x38c06a,_0x76923b,_0x1d1547,_0x2a64f1){loggerPredictive[_0x7802('0x77')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x7802('0x77')](_0x7802('0x213'),_0x5f34ec);loggerPredictive['info'](_0x7802('0x214'),_0xd7e6ed);loggerPredictive[_0x7802('0x77')](_0x7802('0x215'),_0x38c06a);loggerPredictive[_0x7802('0x77')](_0x7802('0x216'),_0x76923b);loggerPredictive[_0x7802('0x77')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d1547);loggerPredictive['info'](_0x7802('0x7c'));return new BPromise(function(_0x338042,_0x22c0b8){if(_0x5f34ec<=0x0||isNaN(_0x5f34ec)){return _0x22c0b8(msgResponse(_0x7802('0x217'),_0x7802('0x19f'),_0x7802('0x218')+_0x5f34ec));}if(_0x38c06a<=0x0||isNaN(_0x38c06a)){return _0x22c0b8(msgResponse(_0x7802('0x217'),_0x7802('0x19f'),_0x7802('0x219')+_0x38c06a));}if(_0x76923b<=0x0||isNaN(_0x76923b)){return _0x22c0b8(msgResponse(_0x7802('0x217'),'Error',_0x7802('0x21a')+_0x76923b));}if(_0xd7e6ed<=0x0||isNaN(_0xd7e6ed)){return _0x22c0b8(msgResponse(_0x7802('0x217'),_0x7802('0x19f'),_0x7802('0x21b')+_0xd7e6ed));}if(_0x1d1547<=0x0||isNaN(_0x1d1547)){return _0x22c0b8(msgResponse('[abandonmentRate]',_0x7802('0x19f'),_0x7802('0x21c')+_0x1d1547));}_0x2a64f1=_0x2a64f1||0x0;var _0x2da3f1=0x1/_0x38c06a;var _0x4fd0a0=0x0;var _0x3557dd=0x0;var _0xc061a4=0x0;var _0x5a9a5b=0x0;for(var _0x180d04=0x0;_0xc061a4<_0x1d1547;_0x180d04+=0x1){_0x3557dd=_0x180d04/_0xd7e6ed;_0x4fd0a0=(_0x76923b*_0x3557dd+_0x2a64f1)/_0x2da3f1;_0xc061a4=erlangb(_0x4fd0a0,_0x5f34ec);_0x5a9a5b=_0x4fd0a0/_0x5f34ec*(0x1-erlangb(_0x4fd0a0,_0x5f34ec));}return _0x338042({'erlangCalls':_0x180d04,'erlangCallToSecond':_0xd7e6ed/_0x180d04,'erlangAbandonmentRate':_0xc061a4,'erlangBusyFactor':_0x5a9a5b});});};Dialer[_0x7802('0x1d')]['busyFactor']=function(_0x500332,_0x398f23,_0xf668d7,_0x5785a3,_0x52c559,_0x2b8f65){loggerPredictive['info'](_0x7802('0x21d'));loggerPredictive[_0x7802('0x77')]('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',_0x500332);loggerPredictive[_0x7802('0x77')](_0x7802('0x214'),_0x398f23);loggerPredictive[_0x7802('0x77')](_0x7802('0x215'),_0xf668d7);loggerPredictive['info'](_0x7802('0x216'),_0x5785a3);loggerPredictive['info'](_0x7802('0x21e'),_0x52c559);loggerPredictive[_0x7802('0x77')]('---------------------------');return new BPromise(function(_0x1ce818,_0xd15ace){if(_0x500332<=0x0||isNaN(_0x500332)){return _0xd15ace(msgResponse('[busyFactor]',_0x7802('0x19f'),_0x7802('0x218')+_0x500332));}if(_0xf668d7<=0x0||isNaN(_0xf668d7)){return _0xd15ace(msgResponse('[busyFactor]',_0x7802('0x19f'),_0x7802('0x219')+_0xf668d7));}if(_0x5785a3<=0x0||isNaN(_0x5785a3)){return _0xd15ace(msgResponse(_0x7802('0x21f'),_0x7802('0x19f'),_0x7802('0x21a')+_0x5785a3));}if(_0x398f23<=0x0||isNaN(_0x398f23)){return _0xd15ace(msgResponse(_0x7802('0x21f'),'Error','interval\x20=\x20'+_0x398f23));}if(_0x52c559<=0x0||isNaN(_0x52c559)){return _0xd15ace(msgResponse(_0x7802('0x21f'),_0x7802('0x19f'),_0x7802('0x220')+_0x52c559));}_0x2b8f65=_0x2b8f65||0x0;var _0x3ea301=0x1/_0xf668d7;var _0x5a65c1=0x0;var _0x4d78a8=0x0;var _0x33c4e9=0x0;var _0x394890=0x0;for(var _0x44a524=0x0;_0x394890<_0x52c559;_0x44a524+=0x1){_0x4d78a8=_0x44a524/_0x398f23;_0x5a65c1=(_0x5785a3*_0x4d78a8+_0x2b8f65)/_0x3ea301;_0x33c4e9=erlangb(_0x5a65c1,_0x500332);_0x394890=_0x5a65c1/_0x500332*(0x1-erlangb(_0x5a65c1,_0x500332));}return _0x1ce818({'erlangCalls':_0x44a524,'erlangCallToSecond':_0x398f23/_0x44a524,'erlangAbandonmentRate':_0x33c4e9,'erlangBusyFactor':_0x394890});});};module[_0x7802('0x221')]=Dialer; \ No newline at end of file +var _0x9099=['erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','\x22%s\x22\x20<%s>','string','inspect','error','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','debug','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','Action','status','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','membername','AMD','custom:amd','buildObj','amd','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','minutes','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','reason19\x20machine....','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','locked','paused','stateinterface','queueBooked','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','power','handlePower','dialPowerLevel','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','syncCampaigns','launchHandleIvr','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','[rescheduleContact][AgentReject]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','push','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','loggedIn','pTalking','sumBillable','sumDuration','talking','total','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x5d1fc6,_0x24221a){var _0x253768=function(_0x5723d2){while(--_0x5723d2){_0x5d1fc6['push'](_0x5d1fc6['shift']());}};_0x253768(++_0x24221a);}(_0x9099,0x1ac));var _0x9909=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x9099[_0x1b349a];return _0x5d1f7c;};'use strict';var util=require(_0x9909('0x0'));var _=require('lodash');var BPromise=require(_0x9909('0x1'));var uuid=require(_0x9909('0x2'));var moment=require(_0x9909('0x3'));var rr=require('rr');var md5=require(_0x9909('0x4'));var Redis=require(_0x9909('0x5'));var ut=require(_0x9909('0x6'));var config=require(_0x9909('0x7'));var logger=require(_0x9909('0x8'))(_0x9909('0x9'));var loggerBooked=require(_0x9909('0x8'))(_0x9909('0xa'));var loggerPredictive=require(_0x9909('0x8'))(_0x9909('0xb'));var loggerPredictiveCalls=require(_0x9909('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x9909('0x8'))('syncQueueSummary');var ami=require('../ami');config['redis']=_['defaults'](config[_0x9909('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x9909('0xd'))(new Redis(config[_0x9909('0xc')]));var cmHopper=require(_0x9909('0xe'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require(_0x9909('0xf'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x9909('0x10'));var voiceQueueRt=require(_0x9909('0x11'));var RpcSetting=require(_0x9909('0x12'));var Action=require(_0x9909('0x13'));var History=require(_0x9909('0x14'));var Final=require(_0x9909('0x15'));var AgentComplete=require(_0x9909('0x16'));var QueueCallerAbandon=require(_0x9909('0x17'));var Hangup=require(_0x9909('0x18'));var ipAgi=process[_0x9909('0x19')][_0x9909('0x1a')]||_0x9909('0x1b');var strategy={'rrmemory':_0x9909('0x1c'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9909('0x1d')]['enqueue']=function(_0x1f32cc){this['tail']=this[_0x9909('0x1e')]?this[_0x9909('0x1e')][_0x9909('0x1f')](_0x1f32cc):_0x1f32cc();};function Dialer(_0x4c4123,_0x9a16a6){this[_0x9909('0x20')]=new Sequence();this[_0x9909('0x21')]=_0x9a16a6;this[_0x9909('0x22')]=_0x4c4123[_0x9909('0x22')];this[_0x9909('0x23')]=_0x4c4123[_0x9909('0x23')];this['agents']=_0x4c4123[_0x9909('0x24')];this[_0x9909('0x25')]=_0x4c4123['trunks'];this[_0x9909('0x26')]=config[_0x9909('0x26')]||0x2;this[_0x9909('0x27')]={};this[_0x9909('0x28')]={};this[_0x9909('0x29')]={};this[_0x9909('0x2a')]={};this[_0x9909('0x2b')]={};this['startPredictive']={};this[_0x9909('0x2c')]={};this[_0x9909('0x2d')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x9909('0x2e'),this[_0x9909('0x2f')][_0x9909('0x30')](this));ami['on'](_0x9909('0x31'),this[_0x9909('0x32')]['bind'](this));ami['on']('originateresponse',this[_0x9909('0x33')][_0x9909('0x30')](this));ami['on'](_0x9909('0x34'),this[_0x9909('0x35')]['bind'](this));ami['on'](_0x9909('0x36'),this[_0x9909('0x37')][_0x9909('0x30')](this));ami['on'](_0x9909('0x38'),this['syncQueueSummaryComplete'][_0x9909('0x30')](this));ami['on'](_0x9909('0x39'),this[_0x9909('0x3a')][_0x9909('0x30')](this));ami['on']('newexten',this[_0x9909('0x3b')][_0x9909('0x30')](this));ami['on'](_0x9909('0x3c'),this[_0x9909('0x3d')][_0x9909('0x30')](this));ami['on'](_0x9909('0x3e'),this[_0x9909('0x3f')]['bind'](this));ami['on'](_0x9909('0x40'),this[_0x9909('0x41')][_0x9909('0x30')](this));this[_0x9909('0x42')]();this[_0x9909('0x43')]();RpcSetting['getSettings']()[_0x9909('0x44')](function(_0x28430b){previewRecallmeReminderInterval=_0x28430b[_0x9909('0x45')];});}function isNotNull(_0x3e599a){return _0x3e599a!==null&&!_[_0x9909('0x46')](_0x3e599a);}function checkIsLoggedIn(_0x222dd1,_0x3ce25e){return function(){if(_0x3ce25e<=0x0){_0x222dd1[_0x9909('0x47')]='AGENTS_NOT_LOGGED';throw _0x222dd1['name']+_0x9909('0x48');}};}function isActive(_0x1afb2f){return _0x1afb2f;}function checkIsActive(_0x4e19e3,_0x3f218f){return function(){if(!isActive(_0x3f218f)){_0x4e19e3[_0x9909('0x47')]=_0x9909('0x49');throw _0x4e19e3[_0x9909('0x4a')]+_0x9909('0x4b');}};}function checkInterval(_0x18ecd7){return function(){if(!isNotNull(_0x18ecd7[_0x9909('0x4c')])){_0x18ecd7['message']=_0x9909('0x4d');throw _0x18ecd7[_0x9909('0x4a')]+_0x9909('0x4e');}if(!isNotNull(_0x18ecd7[_0x9909('0x4c')][_0x9909('0x4f')])){_0x18ecd7['message']=_0x9909('0x4d');throw _0x18ecd7[_0x9909('0x4a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x9909('0x50')](_0x18ecd7[_0x9909('0x4c')][_0x9909('0x4f')]))){_0x18ecd7[_0x9909('0x47')]=_0x9909('0x4d');throw _0x18ecd7[_0x9909('0x4a')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x21c1c8,_0x1c48bc,_0x452b73){return{'action':_0x21c1c8,'response':_0x1c48bc,'message':_0x452b73,'stack':_0x452b73};}function myreject(_0x45e897){return function(_0x449074){return _0x45e897(msgResponse(_0x9909('0x51'),_0x9909('0x52'),JSON[_0x9909('0x53')](_0x449074)));};}function getSeconds(_0x222769,_0x3e4939){var _0x31fd11=moment(_0x222769)[_0x9909('0x54')](0x0);var _0x3b6bf3=moment(_0x3e4939)[_0x9909('0x54')](0x0);return _0x31fd11[_0x9909('0x55')](_0x3b6bf3,_0x9909('0x56'));}function emit(_0x42d63d,_0x3dc4e9,_0x1b5e2b){io['to'](_0x42d63d)[_0x9909('0x57')](_0x3dc4e9,_0x1b5e2b);}function emitVoiceQueueSummary(_0x31aa7e){if(_0x31aa7e[_0x9909('0x58')]===_0x9909('0x59')){var _0x583bc5={'id':_0x31aa7e['id'],'name':_0x31aa7e['name'],'strategy':_0x31aa7e[_0x9909('0x5a')],'answered':_0x31aa7e['answered'],'available':_0x31aa7e['available'],'loggedIn':_0x31aa7e[_0x9909('0x5b')],'pTalking':_0x31aa7e[_0x9909('0x5c')],'sumBillable':_0x31aa7e[_0x9909('0x5d')],'sumDuration':_0x31aa7e[_0x9909('0x5e')],'sumHoldTime':_0x31aa7e['sumHoldTime']||0x0,'talking':_0x31aa7e[_0x9909('0x5f')],'total':_0x31aa7e[_0x9909('0x60')],'type':_0x31aa7e[_0x9909('0x58')],'unmanaged':_0x31aa7e['unmanaged'],'abandoned':_0x31aa7e[_0x9909('0x61')],'waiting':_0x31aa7e[_0x9909('0x62')],'loggedInDb':_0x31aa7e[_0x9909('0x63')],'dialActive':_0x31aa7e['dialActive'],'dialMethod':_0x31aa7e[_0x9909('0x64')],'dialOriginateCallerIdName':_0x31aa7e[_0x9909('0x65')],'dialOriginateCallerIdNumber':_0x31aa7e[_0x9909('0x66')],'dialOriginateTimeout':_0x31aa7e[_0x9909('0x67')],'dialPrefix':_0x31aa7e[_0x9909('0x68')],'outboundAnswerAgiCallsDay':_0x31aa7e[_0x9909('0x69')],'outboundAnswerCallsDay':_0x31aa7e[_0x9909('0x6a')],'outboundBlacklistCallsDay':_0x31aa7e[_0x9909('0x6b')],'outboundBusyCallsDay':_0x31aa7e['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x31aa7e[_0x9909('0x6c')],'outboundDropCallsDayACS':_0x31aa7e[_0x9909('0x6d')],'outboundDropCallsDayCallersExit':_0x31aa7e['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x31aa7e[_0x9909('0x6e')],'outboundNoAnswerCallsDay':_0x31aa7e[_0x9909('0x6f')],'outboundNoSuchCallsDay':_0x31aa7e['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x31aa7e['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x31aa7e[_0x9909('0x70')],'outboundRejectCallsDay':_0x31aa7e[_0x9909('0x71')],'outboundUnknownCallsDay':_0x31aa7e[_0x9909('0x72')],'predictiveIntervalAnsweredCalls':_0x31aa7e[_0x9909('0x73')],'predictiveIntervalAvgHoldtime':_0x31aa7e[_0x9909('0x74')],'predictiveIntervalAvgTalktime':_0x31aa7e[_0x9909('0x75')],'predictiveIntervalDroppedCallsCallersExit':_0x31aa7e[_0x9909('0x76')],'predictiveIntervalDroppedCallsTimeout':_0x31aa7e[_0x9909('0x77')],'predictiveIntervalErlangCalls':_0x31aa7e[_0x9909('0x78')],'predictiveIntervalErlangCallsDroppedCalls':_0x31aa7e[_0x9909('0x79')],'predictiveIntervalHitRate':_0x31aa7e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x31aa7e[_0x9909('0x7a')],'predictiveIntervalPauses':_0x31aa7e[_0x9909('0x7b')],'predictiveIntervalAvailable':_0x31aa7e[_0x9909('0x7c')],'predictiveIntervalTotalCalls':_0x31aa7e[_0x9909('0x7d')],'message':_0x31aa7e['message'],'originated':_0x31aa7e['originated'],'erlangCalls':_0x31aa7e[_0x9909('0x7e')],'erlangCallToSecond':_0x31aa7e['erlangCallToSecond'],'erlangAbandonmentRate':_0x31aa7e[_0x9909('0x7f')],'erlangBusyFactor':_0x31aa7e[_0x9909('0x80')],'startPredictive':_0x31aa7e[_0x9909('0x81')],'startProgressive':_0x31aa7e['startProgressive']};if(_0x31aa7e[_0x9909('0x82')]){_0x583bc5[_0x9909('0x82')]={'id':_0x31aa7e[_0x9909('0x82')]['id'],'name':_0x31aa7e['Trunk'][_0x9909('0x4a')],'active':_0x31aa7e[_0x9909('0x82')][_0x9909('0x83')],'callerid':_0x31aa7e[_0x9909('0x82')][_0x9909('0x84')]};}if(_0x31aa7e[_0x9909('0x4c')]){_0x583bc5[_0x9909('0x4c')]={'id':_0x31aa7e['Interval']['id'],'name':_0x31aa7e[_0x9909('0x4c')][_0x9909('0x4a')]};}var _0x515a20=md5(JSON[_0x9909('0x53')](_0x583bc5));if(_0x31aa7e[_0x9909('0x4')]!==_0x515a20){_0x31aa7e[_0x9909('0x4')]=_0x515a20;emit(util[_0x9909('0x85')](_0x9909('0x86'),_0x583bc5['name']),_0x9909('0x87'),_0x583bc5);}}}function emitCampaignSummary(_0x4a85cf){if(_0x4a85cf[_0x9909('0x58')]===_0x9909('0x88')){emit(util[_0x9909('0x85')](_0x9909('0x89'),_0x4a85cf[_0x9909('0x4a')]),_0x9909('0x8a'),_0x4a85cf);}}function checkGetDataPredictive(_0x38b9a5){if(isNotNull(_0x38b9a5)&&!_[_0x9909('0x50')](_0x38b9a5)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x9909('0x8b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38b9a5['predictiveIntervalTotalCalls']);loggerPredictive[_0x9909('0x8b')](_0x9909('0x8c'),_0x38b9a5['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9909('0x8b')](_0x9909('0x8d'),_0x38b9a5[_0x9909('0x77')]);loggerPredictive[_0x9909('0x8b')](_0x9909('0x8e'),_0x38b9a5[_0x9909('0x76')]);loggerPredictive['info'](_0x9909('0x8f'),_0x38b9a5[_0x9909('0x74')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38b9a5[_0x9909('0x75')]);loggerPredictive['info'](_0x9909('0x90'));if(_0x38b9a5[_0x9909('0x7d')]>0x0){if(!_[_0x9909('0x46')](_0x38b9a5[_0x9909('0x75')])&&_0x38b9a5['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x9909('0x46')](_0x38b9a5[_0x9909('0x74')])&&_0x38b9a5['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x9909('0x91'));}else{loggerPredictive[_0x9909('0x8b')](_0x9909('0x92'));}}else{loggerPredictive['info'](_0x9909('0x93'));}return![];}function mergeDataErlangB(_0x42e4fe){return function(_0x4826b7){loggerPredictive[_0x9909('0x8b')](_0x9909('0x94'));loggerPredictive[_0x9909('0x8b')](_0x9909('0x95'),_0x4826b7['erlangCalls']);loggerPredictive['info'](_0x9909('0x96'),_0x4826b7[_0x9909('0x97')]);loggerPredictive[_0x9909('0x8b')](_0x9909('0x98'),_0x4826b7[_0x9909('0x7f')]);loggerPredictive[_0x9909('0x8b')](_0x9909('0x99'),_0x4826b7[_0x9909('0x80')]);loggerPredictive[_0x9909('0x8b')](_0x9909('0x98'),_0x4826b7['erlangAbandonmentRate']);loggerPredictive[_0x9909('0x8b')](_0x9909('0x90'));_[_0x9909('0x9a')](_0x42e4fe,_0x4826b7);};}function getDiff(_0x3ab49c){var _0x11fad7=moment()[_0x9909('0x54')](0x0);var _0x3cabab=moment(_0x3ab49c)[_0x9909('0x54')](0x0);return _0x11fad7[_0x9909('0x55')](_0x3cabab,_0x9909('0x56'));}function ifInterval(_0x4e5ddf,_0x8966cd){if(_[_0x9909('0x46')](_0x8966cd)){return![];}return getDiff(_0x8966cd)<_0x4e5ddf*0x3c;}function freeVariablesPredictive(_0x10521f){if(isNotNull(_0x10521f)){if(!_[_0x9909('0x46')](_0x10521f[_0x9909('0x2c')])){_0x10521f['startProgressive']=undefined;loggerPredictive[_0x9909('0x8b')](_0x10521f['name'],_0x9909('0x9b'));}if(!_[_0x9909('0x46')](_0x10521f[_0x9909('0x81')])){_0x10521f[_0x9909('0x81')]=undefined;loggerPredictive['info'](_0x10521f[_0x9909('0x4a')],_0x9909('0x9c'));}if(!_['isUndefined'](_0x10521f[_0x9909('0x9d')])){clearInterval(_0x10521f[_0x9909('0x9d')]);_0x10521f[_0x9909('0x9d')]=undefined;loggerPredictive[_0x9909('0x8b')](_0x10521f[_0x9909('0x4a')],_0x9909('0x9e'));}}}function erlangb(_0x46509a,_0x2ed52e){if(_0x2ed52e===0x0){return 0x0;}var _0x3f416d=0x1;for(var _0x48c924=0x1;_0x48c924<=_0x2ed52e;_0x48c924+=0x1){_0x3f416d=0x1+_0x3f416d*_0x48c924/_0x46509a;}return 0x1/_0x3f416d;}function isVoiceQueueOutbound(_0x5691e2){return _0x5691e2==='outbound';}function isNotPreview(_0x16aee2){return _0x16aee2!==_0x9909('0x21');}function isCampaignIvr(_0x5a15eb){return _0x5a15eb===_0x9909('0x88');}function getCallerId(_0x2e4919,_0x247e1f,_0x213a4b){if(!_[_0x9909('0x46')](_0x213a4b)&&typeof _0x213a4b==='string'&&!_['isEmpty'](_0x213a4b)){if(!_[_0x9909('0x46')](_0x247e1f)&&typeof _0x247e1f==='string'&&!_[_0x9909('0x50')](_0x247e1f)){return util[_0x9909('0x85')]('\x22%s\x22\x20<%s>',_0x247e1f,_0x213a4b);}return util[_0x9909('0x85')](_0x9909('0x9f'),_0x213a4b,_0x213a4b);}if(!_['isUndefined'](_0x2e4919)&&typeof _0x2e4919===_0x9909('0xa0')&&!_['isEmpty'](_0x2e4919)){return _0x2e4919;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x3f90d8,_0xdf805d){return function(_0x52e0f7){freeVariablesPredictive(_0xdf805d);emitVoiceQueueSummary(_0xdf805d);emitCampaignSummary(_0xdf805d);loggerSyncQueueSummary['debug'](_0x3f90d8,util[_0x9909('0xa1')](_0x52e0f7,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x303d98,_0x40a3ff){return function(_0x427f33){loggerPredictive[_0x9909('0xa2')](_0x40a3ff[_0x9909('0x4a')],_0x303d98);loggerPredictive[_0x9909('0xa2')](_0x427f33['stack']);freeVariablesPredictive(_0x40a3ff);};}function loggerCatch(_0x54b240){return function(_0x4d5d1a){logger[_0x9909('0xa2')](_0x54b240,util[_0x9909('0xa1')](_0x4d5d1a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3764b9){return _0x3764b9&&!_[_0x9909('0x46')](_0x3764b9)&&_0x3764b9[_0x9909('0xa3')]>0x0;}function decremetOriginate(_0x40b5ac){if(!_[_0x9909('0x46')](_0x40b5ac)&&_0x40b5ac!==null){if(typeof _0x40b5ac[_0x9909('0xa4')]!==_0x9909('0xa5')){if(_0x40b5ac[_0x9909('0xa4')]>0x0){_0x40b5ac['originated']-=0x1;}else{logger[_0x9909('0xa2')](_0x9909('0xa6'));}}}else{logger[_0x9909('0xa2')](_0x9909('0xa7'));}}function checkContactLowerLimitOriginate(_0x5b0cc4,_0x2fbfc5,_0x272491){if(_0x2fbfc5>_0x272491){for(var _0x4b2141=0x0;_0x4b2141<_0x2fbfc5-_0x272491;_0x4b2141+=0x1){decremetOriginate(_0x5b0cc4);}}}function loggerGetContactDialer(_0x28f223,_0x86b352,_0x514904){return function(_0x455e59){checkContactLowerLimitOriginate(_0x86b352,_0x514904,0x0);logger[_0x9909('0xa2')](_0x28f223,util['inspect'](_0x455e59,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x31ea8d){return function(_0x40f516){if(isNotNull(_0x40f516)&&isNotNull(_0x40f516[0x0])){if(_0x40f516[0x0][_0x9909('0xa8')]>0x0){_0x31ea8d[_0x9909('0x47')]=_0x9909('0xa9');logger[_0x9909('0x8b')]('[getContactDialer2][ReScheduled]'+_0x31ea8d['name'],_0x40f516[0x0][_0x9909('0xa8')],_0x9909('0xaa'));}else{_0x31ea8d[_0x9909('0x47')]=_0x9909('0xab');logger[_0x9909('0x8b')]('[getContactDialer2][Empty]'+_0x31ea8d[_0x9909('0x4a')]);}}};}function notSendMessagesQueue(_0x2045c6){if(_0x2045c6[_0x9909('0xac')]){freeVariablesPredictive(_0x2045c6);if(_0x2045c6['originated']===0x0&&_0x2045c6[_0x9909('0x5f')]===0x0&&_0x2045c6['waiting']===0x0&&(_0x2045c6[_0x9909('0x5c')]||0x0)===0x0){_0x2045c6[_0x9909('0xac')]=![];_0x2045c6[_0x9909('0xad')]=0x0;_0x2045c6[_0x9909('0x47')]=_0x9909('0x49');loggerSyncQueueSummary['debug'](_0x9909('0xae'),_0x2045c6['name'],_0x9909('0xaf'));}else{_0x2045c6['message']=_0x9909('0xb0');loggerSyncQueueSummary[_0x9909('0xb1')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2045c6[_0x9909('0x4a')],_0x9909('0xb2'));}emitVoiceQueueSummary(_0x2045c6);}}function notSendMessagesCampaign(_0xbaf812){if(_0xbaf812[_0x9909('0xac')]){if(_0xbaf812[_0x9909('0xa4')]===0x0){_0xbaf812[_0x9909('0xac')]=![];_0xbaf812[_0x9909('0x47')]=_0x9909('0x49');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xbaf812['name'],_0x9909('0xaf'));}else{_0xbaf812[_0x9909('0x47')]=_0x9909('0xb0');loggerSyncQueueSummary[_0x9909('0xb1')](_0x9909('0xb3'),_0xbaf812[_0x9909('0x4a')],_0x9909('0xb2'));}emitCampaignSummary(_0xbaf812);}}function createObjHistory(_0x538e2d,_0x115513,_0x5a442f,_0x20692c,_0x2db26e){_0x538e2d[_0x9909('0x47')]=_0x5a442f;var _0x3a6c09=new Action(_0x538e2d,_0x115513);var _0x515cde=new History(_0x3a6c09);_0x515cde[_0x9909('0xb4')]=_0x20692c;_0x515cde['statedesc']=_0x2db26e;_0x515cde['endtime']=_0x3a6c09[_0x9909('0xb5')];return _0x515cde;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x2850ad=this;setInterval(function(){_0x2850ad[_0x9909('0xb6')](_0x2850ad[_0x9909('0x2a')],_0x9909('0xb7'));_0x2850ad[_0x9909('0xb6')](_0x2850ad[_0x9909('0x28')],_0x9909('0xb8'));},0x32c8);};Dialer[_0x9909('0x1d')][_0x9909('0xb6')]=function(_0xb57d1d,_0x35a519){var _0x5f134d=this;for(var _0x55faff in _0xb57d1d){if(typeof _0xb57d1d[_0x55faff]!==_0x9909('0xa5')){this[_0x9909('0x20')][_0x9909('0xb9')](function(){if(!_[_0x9909('0xba')](_0xb57d1d[_0x55faff])){return ami[_0x9909('0xbb')]({'action':_0x9909('0xbc'),'channel':_0xb57d1d[_0x55faff]['channel']})['catch'](function(_0x3ee8ba){if(_0x3ee8ba[_0x9909('0x47')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xb57d1d[_0x55faff]&&_0xb57d1d[_0x55faff]['type']!==_0x9909('0x88')){_0x5f134d['updateOriginated'](_0x5f134d['voiceQueues'][_0xb57d1d[_0x55faff][_0x9909('0xbd')]]);logger[_0x9909('0xa2')](_0x9909('0xbe'),_0x35a519,_0x55faff,_0xb57d1d[_0x55faff][_0x9909('0xbd')]);delete _0xb57d1d[_0x55faff];}if(_0xb57d1d[_0x55faff]&&_0xb57d1d[_0x55faff]['type']==='ivr'){_0x5f134d[_0x9909('0xbf')](_0x5f134d[_0x9909('0x23')][_0xb57d1d[_0x55faff]['queue']]);logger[_0x9909('0xa2')](_0x9909('0xc0'),_0x35a519,_0x55faff,_0xb57d1d[_0x55faff][_0x9909('0xbd')]);delete _0xb57d1d[_0x55faff];}},0x2328);}});}});}}};Dialer[_0x9909('0x1d')][_0x9909('0xc1')]=function(_0x9d3d5b){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopper[_0x9909('0xc1')](_0x9d3d5b))['catch'](loggerCatch(_0x9909('0xc3')));};Dialer[_0x9909('0x1d')][_0x9909('0xc4')]=function(_0x2af4cd){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopperBlack[_0x9909('0xc4')](_0x2af4cd))[_0x9909('0xc5')](loggerCatch(_0x9909('0xc6')));};Dialer[_0x9909('0x1d')]['verifyAdditionalPhones']=function(_0x287490,_0x2d4b2e,_0x3abc48){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopperAdditionalPhone[_0x9909('0xc7')](_0x287490,_0x2d4b2e,_0x3abc48))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer['prototype'][_0x9909('0xc8')]=function(_0x422ae1,_0x1de681,_0x532b9c){return BPromise[_0x9909('0xc2')]()['then'](cmHopperAdditionalPhone[_0x9909('0xc8')](_0x422ae1,_0x1de681,_0x532b9c))[_0x9909('0xc5')](loggerCatch(_0x9909('0xc9')));};Dialer[_0x9909('0x1d')][_0x9909('0xca')]=function(_0x469e0f){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopperBlack[_0x9909('0xca')](_0x469e0f))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x9909('0x1d')]['averageHandleTime']=function(_0x376dff){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopperHistory['avgHandleTime'](_0x376dff))[_0x9909('0xc5')](loggerCatch(_0x9909('0xcb')));};Dialer[_0x9909('0x1d')][_0x9909('0xcc')]=function(_0x45e579){return BPromise['resolve']()['then'](cmHopper[_0x9909('0xcc')](_0x45e579))['catch'](loggerCatch(_0x9909('0xcd')));};Dialer[_0x9909('0x1d')]['unlockContact']=function(_0x5dde47,_0x2df845,_0x58d3f2){return BPromise['resolve']()[_0x9909('0x44')](cmHopper[_0x9909('0xce')](_0x5dde47,_0x2df845,_0x58d3f2))[_0x9909('0xc5')](loggerCatch(_0x9909('0xcf')));};Dialer[_0x9909('0x1d')][_0x9909('0xd0')]=function(_0x3cbbdf,_0x55456c,_0x48f1cd,_0x68c39f,_0x3d9921){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopper[_0x9909('0xd0')](_0x3cbbdf,_0x55456c,_0x48f1cd,_0x68c39f))['catch'](function(_0x22d6de){_0x3d9921['temp']-=_0x48f1cd;_0x3d9921[_0x9909('0xd1')]=_0x3d9921[_0x9909('0xd1')]>0x0?_0x3d9921[_0x9909('0xd1')]:0x0;loggerCatch(_0x9909('0xd2'))(_0x22d6de);});};Dialer['prototype'][_0x9909('0xd3')]=function(_0x500e3b,_0x9d45ee,_0x10bea9,_0x40f09b){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopper[_0x9909('0xd3')](_0x500e3b,_0x9d45ee,_0x10bea9))['catch'](function(_0x508f46){_0x40f09b[_0x9909('0xd1')]-=_0x9d45ee;_0x40f09b[_0x9909('0xd1')]=_0x40f09b[_0x9909('0xd1')]>0x0?_0x40f09b[_0x9909('0xd1')]:0x0;loggerCatch(_0x9909('0xd4'))(_0x508f46);});};Dialer[_0x9909('0x1d')][_0x9909('0xd5')]=function(_0x3d21d6){return BPromise['resolve']()[_0x9909('0x44')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3d21d6))[_0x9909('0xc5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x9909('0x1d')][_0x9909('0xd6')]=function(_0x4ccc97){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x4ccc97))[_0x9909('0xc5')](loggerCatch(_0x9909('0xd7')));};Dialer[_0x9909('0x1d')]['createHistory']=function(_0x4830da){return BPromise['resolve']()['then'](cmHopperHistory[_0x9909('0xd8')](_0x4830da))['catch'](loggerCatch(_0x9909('0xd9')));};Dialer[_0x9909('0x1d')][_0x9909('0xbf')]=function(_0x19022f){if(!_[_0x9909('0x46')](_0x19022f)&&_0x19022f!==null){if(typeof _0x19022f[_0x9909('0xa4')]!==_0x9909('0xa5')){if(_0x19022f[_0x9909('0xa4')]>0x0){_0x19022f[_0x9909('0xa4')]-=0x1;}else{logger[_0x9909('0xa2')](_0x9909('0xda'));}}}else{logger['error'](_0x9909('0xdb'));}};Dialer[_0x9909('0x1d')][_0x9909('0xdc')]=function(_0x1dee13,_0x3ffd65){var _0x131a50=this;return function(_0x13ef85){_0x131a50[_0x9909('0xbf')](_0x3ffd65);logger[_0x9909('0xa2')](_0x1dee13,util['inspect'](_0x13ef85,{'showHidden':![],'depth':null}));};};Dialer[_0x9909('0x1d')][_0x9909('0xdd')]=function(_0x1a1b2d,_0x6b0c60,_0x223142){var _0x54e8e8={'state':0x19,'statedesc':_0x9909('0xde')};this[_0x9909('0xbf')](_0x6b0c60);this[_0x9909('0xdf')](_['merge'](_0x54e8e8,_[_0x9909('0xe0')](_0x223142,['ContactId',_0x9909('0xe1'),'UserId','VoiceQueueId',_0x9909('0xe2')])),_0x9909('0xe3'),'[emptyContact]');logger[_0x9909('0xa2')](_0x1a1b2d);};Dialer['prototype'][_0x9909('0xe4')]=function(_0x5ecbff){return _0x5ecbff===_0x9909('0xe5');};Dialer[_0x9909('0x1d')][_0x9909('0xe6')]=function(_0x34b3ec){return!_[_0x9909('0x46')](_0x34b3ec)&&_0x34b3ec&&!_[_0x9909('0x46')](_0x34b3ec[_0x9909('0x4a')])&&!_[_0x9909('0x46')](_0x34b3ec[_0x9909('0x83')])&&_0x34b3ec[_0x9909('0x83')]&&(this[_0x9909('0x25')][util['format'](_0x9909('0xe7'),_0x34b3ec[_0x9909('0x4a')])][_0x9909('0xbc')]===_0x9909('0xe8')||this[_0x9909('0x25')][util[_0x9909('0x85')](_0x9909('0xe7'),_0x34b3ec[_0x9909('0x4a')])]['status']===_0x9909('0xe9'));};Dialer[_0x9909('0x1d')][_0x9909('0xdf')]=function(_0x61e2b,_0x244325,_0x278eb9){this[_0x9909('0xd8')](_0x61e2b)['catch'](loggerCatch(_0x244325));this[_0x9909('0xd6')](_0x61e2b)[_0x9909('0xc5')](loggerCatch(_0x278eb9));};Dialer['prototype'][_0x9909('0x3d')]=function(_0x5c8958){var _0x15728d=this[_0x9909('0x2a')][_0x5c8958[_0x9909('0xea')]];var _0x3352e8;if(!_[_0x9909('0xba')](_0x5c8958)&&!_['isNil'](_0x5c8958[_0x9909('0xeb')])&&!_[_0x9909('0xba')](_0x5c8958[_0x9909('0xeb')][_0x9909('0xec')])&&_0x5c8958[_0x9909('0xed')]===_0x9909('0xee')&&_0x15728d){if(_0x15728d[_0x9909('0x58')]!==_0x9909('0x88')&&this[_0x9909('0x22')][_0x15728d[_0x9909('0xbd')]][_0x9909('0xef')]&&_0x5c8958[_0x9909('0xf0')]===_0x9909('0xf1')){delete this['uniqueId'][_0x5c8958[_0x9909('0xea')]];this[_0x9909('0xbf')](this[_0x9909('0x22')][_0x15728d[_0x9909('0xbd')]]);this[_0x9909('0x22')][_0x15728d['queue']][_0x9909('0x6a')]+=0x1;this[_0x9909('0x22')][_0x15728d[_0x9909('0xbd')]][_0x9909('0x69')]+=0x1;_0x3352e8=new Hangup(_0x15728d,_0x5c8958);_0x3352e8[_0x9909('0xb4')]=0x12;_0x3352e8[_0x9909('0xf2')]='HangupInAMD';_0x3352e8[_0x9909('0xf3')]=_0x9909('0xf4');ami[_0x9909('0x57')](_0x9909('0xf5'),ut[_0x9909('0xf6')](_0x3352e8,_0x9909('0xf7')));this['saveInDb'](_0x3352e8,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x15728d[_0x9909('0x58')]!==_0x9909('0x88')&&this['voiceQueues'][_0x15728d['queue']][_0x9909('0xef')]&&_0x5c8958['value']==='MACHINE'){var _0x3ae047=this;return new BPromise(function(_0x30cc3b,_0x4ef2f3){delete _0x3ae047[_0x9909('0x2a')][_0x5c8958[_0x9909('0xea')]];_0x3ae047['updateOriginated'](_0x3ae047[_0x9909('0x22')][_0x15728d[_0x9909('0xbd')]]);_0x3ae047['voiceQueues'][_0x15728d[_0x9909('0xbd')]][_0x9909('0x6a')]+=0x1;_0x3ae047['voiceQueues'][_0x15728d['queue']][_0x9909('0x69')]+=0x1;var _0x339334=_0x3ae047[_0x9909('0x22')][_0x15728d[_0x9909('0xbd')]];var _0x2fc15f=new Hangup(_0x15728d,_0x5c8958);_0x2fc15f[_0x9909('0xb4')]=0x13;_0x2fc15f[_0x9909('0xf2')]=_0x9909('0xf8');_0x2fc15f[_0x9909('0xf3')]='AMD';_0x2fc15f[_0x9909('0xf9')]+=0x1;_0x2fc15f[_0x9909('0xfa')]+=0x1;_0x2fc15f[_0x9909('0xf7')]=!![];ami[_0x9909('0x57')](_0x9909('0xf5'),ut[_0x9909('0xf6')](_0x2fc15f,_0x9909('0xf7')));_0x3ae047[_0x9909('0xd8')](_0x2fc15f)[_0x9909('0xc5')](loggerCatch(_0x9909('0xfb')));if(_0x2fc15f[_0x9909('0xfc')]+_0x2fc15f[_0x9909('0xfd')]+_0x2fc15f[_0x9909('0xfe')]+_0x2fc15f[_0x9909('0xff')]+_0x2fc15f[_0x9909('0x100')]+_0x2fc15f['countabandonedretry']+_0x2fc15f['countmachineretry']+_0x2fc15f['countagentrejectretry']>=_0x339334[_0x9909('0x101')]){_0x3ae047[_0x9909('0x102')](_0x2fc15f,_0x30cc3b,_0x4ef2f3,'reason19\x20machine....');}else{if(_0x2fc15f[_0x9909('0xf9')]>=_0x339334[_0x9909('0x103')]){_0x3ae047[_0x9909('0x104')](_0x2fc15f,_0x30cc3b,_0x4ef2f3,'reason\x2019\x20machine....');}else{_0x3ae047[_0x9909('0xcc')]({'active':![],'countmachineretry':_0x2fc15f[_0x9909('0xf9')],'scheduledat':moment()['add'](_0x339334[_0x9909('0x105')],_0x9909('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2fc15f['ContactId'],'ListId':_0x2fc15f[_0x9909('0xe1')],'VoiceQueueId':_0x2fc15f[_0x9909('0x107')]||undefined,'CampaignId':_0x2fc15f['CampaignId']||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x108')));_0x30cc3b({'reschedule':0x1});}}});}if(_0x15728d[_0x9909('0x58')]===_0x9909('0x88')&&this[_0x9909('0x23')][_0x15728d[_0x9909('0xbd')]][_0x9909('0xef')]&&_0x5c8958[_0x9909('0xf0')]===_0x9909('0xf1')){delete this['uniqueId'][_0x5c8958[_0x9909('0xea')]];this[_0x9909('0xbf')](this[_0x9909('0x23')][_0x15728d[_0x9909('0xbd')]]);_0x3352e8=new Hangup(_0x15728d,_0x5c8958);_0x3352e8[_0x9909('0xb4')]=0x12;_0x3352e8[_0x9909('0xf2')]=_0x9909('0x109');_0x3352e8[_0x9909('0xf3')]=_0x9909('0xf4');ami[_0x9909('0x57')](_0x9909('0xf5'),ut[_0x9909('0xf6')](_0x3352e8,_0x9909('0xf7')));this[_0x9909('0xdf')](_0x3352e8,_0x9909('0x10a'),_0x9909('0x10b'));}if(_0x15728d[_0x9909('0x58')]===_0x9909('0x88')&&this[_0x9909('0x23')][_0x15728d[_0x9909('0xbd')]][_0x9909('0xef')]&&_0x5c8958[_0x9909('0xf0')]===_0x9909('0x10c')){var _0x3ae047=this;return new BPromise(function(_0x1bd239,_0x53e04f){delete _0x3ae047['uniqueId'][_0x5c8958[_0x9909('0xea')]];_0x3ae047['updateOriginated'](_0x3ae047['campaigns'][_0x15728d['queue']]);_0x3ae047[_0x9909('0x23')][_0x15728d[_0x9909('0xbd')]][_0x9909('0x6a')]+=0x1;_0x3ae047[_0x9909('0x23')][_0x15728d['queue']][_0x9909('0x69')]+=0x1;var _0x64e499=_0x3ae047[_0x9909('0x23')][_0x15728d['queue']];var _0x2dd097=new Hangup(_0x15728d,_0x5c8958);_0x2dd097['state']=0x13;_0x2dd097[_0x9909('0xf2')]='Machine';_0x2dd097['membername']='AMD';_0x2dd097[_0x9909('0xf9')]+=0x1;_0x2dd097[_0x9909('0xfa')]+=0x1;_0x2dd097['amd']=!![];ami[_0x9909('0x57')](_0x9909('0xf5'),ut['buildObj'](_0x2dd097,_0x9909('0xf7')));_0x3ae047['createHistory'](_0x2dd097)[_0x9909('0xc5')](loggerCatch(_0x9909('0xfb')));if(_0x2dd097[_0x9909('0xfc')]+_0x2dd097[_0x9909('0xfd')]+_0x2dd097[_0x9909('0xfe')]+_0x2dd097[_0x9909('0xff')]+_0x2dd097[_0x9909('0x100')]+_0x2dd097['countabandonedretry']+_0x2dd097['countmachineretry']+_0x2dd097['countagentrejectretry']>=_0x64e499[_0x9909('0x101')]){_0x3ae047[_0x9909('0x102')](_0x2dd097,_0x1bd239,_0x53e04f,_0x9909('0x10d'));}else{if(_0x2dd097['countmachineretry']>=_0x64e499[_0x9909('0x103')]){_0x3ae047[_0x9909('0x104')](_0x2dd097,_0x1bd239,_0x53e04f,_0x9909('0x10e'));}else{_0x3ae047[_0x9909('0xcc')]({'active':![],'countmachineretry':_0x2dd097[_0x9909('0xf9')],'scheduledat':moment()[_0x9909('0x10f')](_0x64e499['dialMachineRetryFrequency'],_0x9909('0x106'))[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x2dd097[_0x9909('0x111')],'ListId':_0x2dd097['ListId'],'VoiceQueueId':_0x2dd097[_0x9909('0x107')]||undefined,'CampaignId':_0x2dd097[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch('[rescheduleContact][Machine]'));_0x1bd239({'reschedule':0x1});}}});}}};Dialer[_0x9909('0x1d')][_0x9909('0x3a')]=function(_0x2109df){var _0x732643=this['uniqueId'][_0x2109df[_0x9909('0xea')]];var _0x229a9d=this;var _0xc6d488;if(_0x732643&&_0x732643['type']===_0x9909('0x88')){delete this[_0x9909('0x2a')][_0x2109df[_0x9909('0xea')]];this[_0x9909('0xbf')](this[_0x9909('0x23')][_0x732643['queue']]);this[_0x9909('0x23')][_0x732643[_0x9909('0xbd')]][_0x9909('0x112')]+=0x1;_0xc6d488=new Hangup(_0x732643,_0x2109df);this[_0x9909('0xd8')](_0xc6d488)[_0x9909('0xc5')](loggerCatch(_0x9909('0x113')));this['moveContactManagedDialer'](_0xc6d488)[_0x9909('0xc5')](loggerCatch(_0x9909('0x114')));}if(_0x732643&&_0x732643[_0x9909('0x58')]!==_0x9909('0x88')&&isNotNull(this['voiceQueues'][_0x732643[_0x9909('0xbd')]]['dialQueueProject'])){delete this[_0x9909('0x2a')][_0x2109df['uniqueid']];this[_0x9909('0xbf')](this[_0x9909('0x22')][_0x732643['queue']]);this['voiceQueues'][_0x732643[_0x9909('0xbd')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x732643[_0x9909('0xbd')]]['outboundAnswerAgiCallsDay']+=0x1;_0xc6d488=new Hangup(_0x732643,_0x2109df);_0xc6d488[_0x9909('0xb4')]=0x10;_0xc6d488[_0x9909('0xf2')]=_0x9909('0x115');_0xc6d488[_0x9909('0xf3')]=_0x9909('0x116');this[_0x9909('0xd8')](_0xc6d488)[_0x9909('0xc5')](loggerCatch(_0x9909('0x113')));this['moveContactManagedDialer'](_0xc6d488)[_0x9909('0xc5')](loggerCatch(_0x9909('0x114')));}if(_0x732643&&_0x732643[_0x9909('0x58')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x732643[_0x9909('0xbd')]]['dialQueueProject'])){delete this[_0x9909('0x2a')][_0x2109df[_0x9909('0xea')]];this[_0x9909('0xbf')](this[_0x9909('0x22')][_0x732643[_0x9909('0xbd')]]);this[_0x9909('0x22')][_0x732643['queue']][_0x9909('0x72')]+=0x1;_0xc6d488=new Hangup(_0x732643,_0x2109df);_0xc6d488[_0x9909('0xb4')]=0xc;_0xc6d488[_0x9909('0xf2')]=_0x2109df['cause-txt'];_0xc6d488[_0x9909('0xf3')]='Unknow';this[_0x9909('0xd8')](_0xc6d488)[_0x9909('0xc5')](loggerCatch(_0x9909('0x113')));this[_0x9909('0xd6')](_0xc6d488)[_0x9909('0xc5')](loggerCatch(_0x9909('0x114')));}};Dialer[_0x9909('0x1d')]['syncAgentComplete']=function(_0x104a88){var _0x5c701c=this['uniqueId'][_0x104a88[_0x9909('0xea')]];var _0x48beaa=this;if(this[_0x9909('0x22')][_0x104a88[_0x9909('0xbd')]]){if(_0x5c701c&&_0x5c701c[_0x9909('0x58')]!==_0x9909('0x88')){delete this['uniqueId'][_0x104a88[_0x9909('0xea')]];this[_0x9909('0x22')][_0x104a88['queue']]['outboundAnswerCallsDay']+=0x1;var _0x55dce9=new AgentComplete(_0x5c701c,_0x104a88);if(_0x104a88[_0x9909('0x117')]===_0x9909('0x118')){_0x55dce9[_0x9909('0x119')]=this[_0x9909('0x22')][_0x104a88['queue']]['dialQueueProject2']&&this[_0x9909('0x22')][_0x104a88['queue']][_0x9909('0x11a')]?moment()[_0x9909('0x85')](_0x9909('0x110')):undefined;}this[_0x9909('0xd8')](_0x55dce9)[_0x9909('0xc5')](loggerCatch(_0x9909('0x11b')));this[_0x9909('0xd6')](_0x55dce9)['catch'](loggerCatch(_0x9909('0x11c')));}}};Dialer[_0x9909('0x1d')]['syncAgentConnect']=function(_0x26c250){if(this[_0x9909('0x22')][_0x26c250['queue']]){if(this[_0x9909('0x2a')][_0x26c250[_0x9909('0xea')]]&&this[_0x9909('0x2a')][_0x26c250[_0x9909('0xea')]]['type']!==_0x9909('0x88')){this[_0x9909('0xbf')](this[_0x9909('0x22')][_0x26c250['queue']]);this[_0x9909('0x2a')][_0x26c250[_0x9909('0xea')]][_0x9909('0x11d')]=moment()['format'](_0x9909('0x110'));}}};Dialer[_0x9909('0x1d')][_0x9909('0x11e')]=function(_0x1b9025,_0x4a63eb){this['createHistory'](_0x1b9025)[_0x9909('0xc5')](loggerCatch(_0x9909('0x11b')));if(_0x4a63eb==0x0){this['moveContactManagedDialer'](_0x1b9025)[_0x9909('0xc5')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x9909('0x1d')][_0x9909('0x32')]=function(_0x4d1644){var _0x181f6a=this[_0x9909('0x2a')][_0x4d1644[_0x9909('0xea')]];var _0x9cb5f9=this;var _0x1db2c0=![];var _0x263670;var _0x5b7c13;if(this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]]){if(_0x181f6a&&_0x181f6a['type']!==_0x9909('0x88')){delete this['uniqueId'][_0x4d1644[_0x9909('0xea')]];this[_0x9909('0xbf')](this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]]);_0x181f6a[_0x9909('0x11f')]=moment()[_0x9909('0x85')](_0x9909('0x110'));var _0x1bfddf=new QueueCallerAbandon(_0x181f6a,_0x4d1644);if(getSeconds(_0x181f6a['droptime'],_0x181f6a[_0x9909('0x120')])>=_0x181f6a[_0x9909('0x121')]){this['voiceQueues'][_0x4d1644['queue']][_0x9909('0x77')]+=0x1;this['voiceQueues'][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x6e')]+=0x1;this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1bfddf[_0x9909('0xb4')]=0xa;_0x1bfddf[_0x9909('0xf2')]=_0x9909('0x122');_0x1bfddf[_0x9909('0x123')]=_0x9909('0x124');_0x1bfddf[_0x9909('0x119')]=this['voiceQueues'][_0x4d1644['queue']][_0x9909('0x125')]?moment()[_0x9909('0x85')](_0x9909('0x110')):undefined;_0x1bfddf['countdropretry']+=0x1;_0x1bfddf[_0x9909('0xfa')]+=0x1;_0x263670=this['voiceQueues'][_0x4d1644[_0x9909('0xbd')]]['dialDropRetryFrequency'];_0x5b7c13=this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x126')];_0x9cb5f9['verifyAdditionalPhones'](_0x1bfddf,_0x1bfddf[_0x9909('0xb4')],_0x181f6a[_0x9909('0x127')])[_0x9909('0x44')](function(_0x15e817){_0x1db2c0=_0x15e817[_0x9909('0x128')]==0x1;if(_0x1bfddf[_0x9909('0x100')]>=_0x9cb5f9[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x129')]){_0x9cb5f9[_0x9909('0x11e')](_0x1bfddf,_0x15e817[_0x9909('0x128')]);}else{_0x9cb5f9[_0x9909('0xcc')]({'active':![],'countdropretry':_0x1bfddf[_0x9909('0x100')],'scheduledat':moment()[_0x9909('0x10f')](_0x9cb5f9['voiceQueues'][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x12a')],_0x9909('0x106'))[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x181f6a['ContactId'],'ListId':_0x181f6a[_0x9909('0xe1')],'VoiceQueueId':_0x181f6a[_0x9909('0x107')]||undefined,'CampaignId':_0x181f6a[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch('[rescheduleContact][Drop]'));var _0x50805b=new History(_0x1bfddf);_0x50805b[_0x9909('0xb4')]=0xa;_0x50805b['statedesc']='Drop';_0x50805b[_0x9909('0xb5')]=moment()[_0x9909('0x85')](_0x9909('0x110'));_0x50805b['endtime']=_0x50805b[_0x9909('0xb5')];_0x50805b[_0x9909('0x12b')]=_0x1bfddf[_0x9909('0x12b')];_0x50805b[_0x9909('0x12c')]=_0x1bfddf[_0x9909('0x12c')];_0x9cb5f9[_0x9909('0xd8')](_0x50805b)[_0x9909('0xc5')](loggerCatch(_0x9909('0x12d')));}})[_0x9909('0x44')](function(_0x39c410){if(_0x1db2c0)_0x9cb5f9[_0x9909('0xc8')](_0x1bfddf,_0x263670,_0x5b7c13)['then'](function(_0x32e554){return 0x1;});});}else{this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x76')]+=0x1;this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x12e')]+=0x1;_0x1bfddf[_0x9909('0xb4')]=0xb;_0x1bfddf['statedesc']=_0x9909('0x12f');_0x1bfddf['dropreason']=_0x9909('0x130');_0x1bfddf[_0x9909('0x131')]+=0x1;_0x1bfddf[_0x9909('0xfa')]+=0x1;_0x263670=this[_0x9909('0x22')][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x132')];_0x5b7c13=this['voiceQueues'][_0x4d1644[_0x9909('0xbd')]][_0x9909('0x126')];_0x9cb5f9['verifyAdditionalPhones'](_0x1bfddf,_0x1bfddf[_0x9909('0xb4')],_0x181f6a['voiceQueue'])['then'](function(_0x13ee31){if(_0x1bfddf[_0x9909('0x131')]>=_0x9cb5f9[_0x9909('0x22')][_0x4d1644['queue']][_0x9909('0x133')]){_0x9cb5f9['queueCallerAbandonCreateState'](_0x1bfddf,_0x13ee31[_0x9909('0x128')]);}else{_0x9cb5f9['rescheduleContact']({'active':![],'countabandonedretry':_0x1bfddf[_0x9909('0x131')],'scheduledat':moment()[_0x9909('0x10f')](_0x9cb5f9[_0x9909('0x22')][_0x4d1644['queue']][_0x9909('0x132')],_0x9909('0x106'))[_0x9909('0x85')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x181f6a[_0x9909('0x111')],'ListId':_0x181f6a[_0x9909('0xe1')],'VoiceQueueId':_0x181f6a['VoiceQueueId']||undefined,'CampaignId':_0x181f6a[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x134')));var _0x5d26f4=new History(_0x1bfddf);_0x5d26f4[_0x9909('0xb4')]=0xb;_0x5d26f4[_0x9909('0xf2')]=_0x9909('0x12f');_0x5d26f4[_0x9909('0xb5')]=moment()[_0x9909('0x85')](_0x9909('0x110'));_0x5d26f4['endtime']=_0x5d26f4[_0x9909('0xb5')];_0x5d26f4['calleridname']=_0x1bfddf[_0x9909('0x12b')];_0x5d26f4[_0x9909('0x12c')]=_0x1bfddf[_0x9909('0x12c')];_0x9cb5f9[_0x9909('0xd8')](_0x5d26f4)[_0x9909('0xc5')](loggerCatch(_0x9909('0x135')));}})[_0x9909('0x44')](function(_0x107575){if(_0x1db2c0)_0x9cb5f9[_0x9909('0xc8')](_0x1bfddf,_0x263670,_0x5b7c13)[_0x9909('0x44')](function(_0x42af1f){return 0x1;});});}}}};Dialer[_0x9909('0x1d')][_0x9909('0x3b')]=function(_0x1bfbdf){if(this[_0x9909('0x28')][_0x1bfbdf[_0x9909('0xea')]]){this['actions'][_0x1bfbdf[_0x9909('0xea')]][_0x9909('0x136')]=_0x1bfbdf[_0x9909('0x136')];}if(this[_0x9909('0x2a')][_0x1bfbdf[_0x9909('0xea')]]){this[_0x9909('0x2a')][_0x1bfbdf[_0x9909('0xea')]][_0x9909('0x136')]=_0x1bfbdf[_0x9909('0x136')];}};Dialer['prototype'][_0x9909('0x3f')]=function(_0x3c3b06){if(strategy[this['voiceQueues'][this[_0x9909('0x28')][_0x3c3b06[_0x9909('0x137')]][_0x9909('0xbd')]][_0x9909('0x5a')]]===_0x9909('0x138')){if(this['actions'][_0x3c3b06[_0x9909('0x137')]]&&_['isNil'](this['actions'][_0x3c3b06[_0x9909('0x137')]][_0x9909('0x139')])&&_0x3c3b06[_0x9909('0xbc')]==='1'&&_0x3c3b06[_0x9909('0x13a')]==='0'){if(this['agents'][_0x3c3b06[_0x9909('0x13b')]]){if(!this[_0x9909('0x24')][_0x3c3b06['stateinterface']][_0x9909('0x139')]){this[_0x9909('0x24')][_0x3c3b06[_0x9909('0x13b')]][_0x9909('0x139')]=!![];this[_0x9909('0x28')][_0x3c3b06['actionid']][_0x9909('0x139')]=!![];this[_0x9909('0x28')][_0x3c3b06[_0x9909('0x137')]][_0x9909('0x13b')]=_0x3c3b06[_0x9909('0x13b')];}}}}else if((strategy[this['voiceQueues'][this[_0x9909('0x28')][_0x3c3b06['actionid']][_0x9909('0xbd')]][_0x9909('0x5a')]]||_0x9909('0x1c'))===_0x9909('0x1c')){if(this[_0x9909('0x28')][_0x3c3b06[_0x9909('0x137')]]){if(this['agents'][_0x3c3b06[_0x9909('0x13b')]]){this[_0x9909('0x28')][_0x3c3b06['actionid']]['stateinterface']=_0x3c3b06[_0x9909('0x13b')];if(_['isNil'](this[_0x9909('0x13c')][this[_0x9909('0x28')][_0x3c3b06[_0x9909('0x137')]][_0x9909('0xbd')]])){this[_0x9909('0x13c')][this[_0x9909('0x28')][_0x3c3b06[_0x9909('0x137')]][_0x9909('0xbd')]]=[];}this[_0x9909('0x13c')][this[_0x9909('0x28')][_0x3c3b06[_0x9909('0x137')]][_0x9909('0xbd')]]['push'](_[_0x9909('0x9a')](_['pick'](this['actions'][_0x3c3b06['actionid']],[_0x9909('0x13d'),_0x9909('0x13b')]),{'status':_0x3c3b06['status'],'paused':_0x3c3b06[_0x9909('0x13a')]}));}}}};function unlockQueueStatus(_0x154bce,_0x5305e1){setTimeout(function(){if(_['isUndefined'](_0x154bce['queueStatusComplete'])){loggerBooked[_0x9909('0xa2')](_0x9909('0x13e'),_0x5305e1);}_0x154bce[_0x9909('0x13f')]=!![];loggerBooked[_0x9909('0x8b')](_0x9909('0x140'),_0x5305e1,JSON[_0x9909('0x53')](_['pick'](_0x154bce,[_0x9909('0x4a'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x9909('0x1d')][_0x9909('0x41')]=function(_0x39fe5a){var _0x55a8da=this;var _0x225c1e=_0x55a8da[_0x9909('0x22')][_0x55a8da[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]]['queue']];if(strategy[this[_0x9909('0x22')][this[_0x9909('0x28')][_0x39fe5a['actionid']][_0x9909('0xbd')]][_0x9909('0x5a')]]===_0x9909('0x138')){if(this['actions'][_0x39fe5a[_0x9909('0x137')]]&&this['actions'][_0x39fe5a['actionid']][_0x9909('0x13b')]){this[_0x9909('0x21')][_0x9909('0x141')](this['actions'][_0x39fe5a[_0x9909('0x137')]][_0x9909('0x13d')],this['actions'][_0x39fe5a[_0x9909('0x137')]][_0x9909('0x13b')])['catch'](function(_0x4b27d5){logger['error'](_0x9909('0x142'),util['inspect'](_0x4b27d5,{'showHidden':![],'depth':null}));})['finally'](function(){_0x55a8da[_0x9909('0xbf')](_0x55a8da[_0x9909('0x22')][_0x55a8da[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]]['queue']]);_0x55a8da[_0x9909('0x24')][_0x55a8da['actions'][_0x39fe5a[_0x9909('0x137')]][_0x9909('0x13b')]][_0x9909('0x139')]=![];delete _0x55a8da[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]];unlockQueueStatus(_0x225c1e);});}else{this[_0x9909('0xbf')](this[_0x9909('0x22')][this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]]);this[_0x9909('0xcc')]({'active':![],'ContactId':this[_0x9909('0x28')][_0x39fe5a['actionid']][_0x9909('0x111')],'ListId':this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xe1')],'VoiceQueueId':this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0x107')]||undefined,'CampaignId':this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x143')));delete this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]];unlockQueueStatus(_0x225c1e);}}else if((strategy[this[_0x9909('0x22')][this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]][_0x9909('0x5a')]]||_0x9909('0x1c'))===_0x9909('0x1c')){var _0x4c970f;if(this[_0x9909('0x28')][_0x39fe5a['actionid']]&&!_['isEmpty'](this[_0x9909('0x13c')][this[_0x9909('0x28')][_0x39fe5a['actionid']]['queue']])){if(this[_0x9909('0x144')][_0x55a8da[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]]){this[_0x9909('0x144')][_0x55a8da[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]]=this[_0x9909('0x144')][this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]]?this[_0x9909('0x144')][this['actions'][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]]:this[_0x9909('0x13c')][this['actions'][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]]?this[_0x9909('0x13c')][this['actions'][_0x39fe5a['actionid']][_0x9909('0xbd')]][_0x9909('0x145')]||0x0:0x0;}this[_0x9909('0x13c')][this['actions'][_0x39fe5a[_0x9909('0x137')]]['queue']][_0x9909('0x145')]=this[_0x9909('0x144')][this[_0x9909('0x28')][_0x39fe5a[_0x9909('0x137')]][_0x9909('0xbd')]];for(var _0x19b9d3=0x0;_0x19b9d3=0x0;})['catch'](myreject(_0x158103)));}}else{_0x3cfe29['push'](ami[_0x9909('0xbb')]({'action':_0x9909('0x15a'),'command':util[_0x9909('0x85')](_0x9909('0x15b'),_0x5ee4e1,!_['isUndefined'](config['timezones'][_0x55ed83])?_0x55ed83:'')})[_0x9909('0x44')](function(_0x4f17b3){return _0x4f17b3['content'][_0x9909('0x15e')](_0x9909('0x15f'))>=0x0;})['catch'](myreject(_0x158103)));}BPromise['all'](_0x3cfe29)['then'](function(_0x268a6e){var _0x2e830e=_['some'](_0x268a6e);if(_0x2e830e){return _0xb4afbf(_0x2e830e);}else{_0x311943[_0x9909('0x47')]=_0x41b4fe?_0x9909('0x160'):_0x9909('0x161');return _0x158103(msgResponse(_0x9909('0x162'),_0x9909('0x152'),'Global:\x20'+_0x41b4fe+'\x20'+_0x163bfb+_0x9909('0x163')+util[_0x9909('0xa1')](_0x5ee4e1,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x55ed83));}})[_0x9909('0xc5')](function(_0x532c62){return _0x158103(msgResponse(_0x9909('0x151'),_0x9909('0x152'),JSON[_0x9909('0x53')](_0x532c62)));});});};Dialer['prototype'][_0x9909('0x164')]=function(_0x122161){var _0x328a7e=this;return function(){switch(_0x122161[_0x9909('0x64')]){case'progressive':freeVariablesPredictive(_0x122161);_0x328a7e['handlePower'](_0x122161,0x1);break;case _0x9909('0x165'):freeVariablesPredictive(_0x122161);_0x328a7e[_0x9909('0x166')](_0x122161,_0x122161[_0x9909('0x167')]);break;case'predictive':_0x328a7e[_0x9909('0xb')](_0x122161);break;case _0x9909('0xa'):freeVariablesPredictive(_0x122161);_0x328a7e[_0x9909('0x166')](_0x122161,0x1);break;default:freeVariablesPredictive(_0x122161);logger['error']('Queue',_0x122161[_0x9909('0x4a')],'method\x20not\x20recognized');}};};Dialer[_0x9909('0x1d')]['launchHandleIvr']=function(_0x10d9a4){var _0x1a0840=this;return function(){_0x1a0840['handleIvr'](_0x10d9a4);};};Dialer[_0x9909('0x1d')][_0x9909('0x37')]=function(_0xcf27de){var _0x340f78=this;if(isNotPreview(_0xcf27de[_0x9909('0x64')])){if(isVoiceQueueOutbound(_0xcf27de[_0x9909('0x58')])&&isActive(_0xcf27de['dialActive'])){_0xcf27de[_0x9909('0xac')]=!![];BPromise['resolve']()[_0x9909('0x44')](checkIsLoggedIn(_0xcf27de,_0xcf27de[_0x9909('0x5b')]))[_0x9909('0x44')](checkIsActive(_0xcf27de,_0xcf27de[_0x9909('0x168')]))[_0x9909('0x44')](checkInterval(_0xcf27de))[_0x9909('0x44')](_0x340f78['checkIsTrunkReachable'](_0xcf27de))[_0x9909('0x44')](_0x340f78['checkIfTime'](_0xcf27de[_0x9909('0x169')],_0xcf27de[_0x9909('0x16a')],_0xcf27de[_0x9909('0x4a')],_0xcf27de))['then'](_0x340f78[_0x9909('0x16b')](_0xcf27de[_0x9909('0x4c')],_0xcf27de['dialTimezone'],_0xcf27de['name'],_0xcf27de))[_0x9909('0x44')](_0x340f78['checkDialMethod'](_0xcf27de))[_0x9909('0xc5')](loggerCatchQueueSummary('[syncQueueSummary]',_0xcf27de));}else{notSendMessagesQueue(_0xcf27de);}}else{freeVariablesPredictive(_0xcf27de);}};Dialer[_0x9909('0x1d')][_0x9909('0x16c')]=_['throttle'](function(){var _0x402212=_[_0x9909('0x16d')](this[_0x9909('0x22')],function(_0x3c213f){return _0x3c213f[_0x9909('0x16e')];});var _0x36dc8f=_[_0x9909('0x16d')](this[_0x9909('0x24')],function(_0x1a3834){return _0x1a3834['online']&&_0x1a3834['status']==='reachable';});if(_0x402212[_0x9909('0xa3')]>0x0&&_0x36dc8f[_0x9909('0xa3')]>0x0){return BPromise[_0x9909('0xc2')]()[_0x9909('0x44')](cmHopper[_0x9909('0x16f')](_['map'](_0x402212,'id'),previewRecallmeReminderInterval,_[_0x9909('0x170')](_0x36dc8f,'id')))[_0x9909('0x44')](function(_0x2314ee){for(var _0x346317=0x0;_0x346317<_0x2314ee[_0x9909('0xa3')];_0x346317++){var _0x9860eb=_0x2314ee[_0x346317]['Agent']['name'];if(_0x9860eb)io['to'](util[_0x9909('0x85')](_0x9909('0x171'),_0x9860eb))[_0x9909('0x57')](_0x9909('0x172'),{'hopper':_0x2314ee[_0x346317]});}})[_0x9909('0xc5')](function(_0x3fe227){logger[_0x9909('0xa2')]('checkPreviewRecallReminder',_0x3fe227);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9909('0x1d')][_0x9909('0x173')]=function(){var _0x3d0a1f=this;var _0x5496eb;for(var _0xfa378b in this[_0x9909('0x23')]){if(typeof this[_0x9909('0x23')][_0xfa378b]!==_0x9909('0xa5')){_0x5496eb=this[_0x9909('0x23')][_0xfa378b];if(isCampaignIvr(_0x5496eb[_0x9909('0x58')])&&isActive(_0x5496eb[_0x9909('0x83')])){_0x5496eb[_0x9909('0xac')]=!![];BPromise[_0x9909('0xc2')]()['then'](checkIsActive(_0x5496eb,_0x5496eb[_0x9909('0x83')]))[_0x9909('0x44')](checkInterval(_0x5496eb))[_0x9909('0x44')](_0x3d0a1f[_0x9909('0x14e')](_0x5496eb))[_0x9909('0x44')](_0x3d0a1f[_0x9909('0x150')](_0x5496eb[_0x9909('0x169')],_0x5496eb['dialTimezone'],_0x5496eb[_0x9909('0x4a')],_0x5496eb))[_0x9909('0x44')](_0x3d0a1f['checkIfTimeIntervals'](_0x5496eb[_0x9909('0x4c')],_0x5496eb[_0x9909('0x16a')],_0x5496eb[_0x9909('0x4a')],_0x5496eb))['then'](_0x3d0a1f[_0x9909('0x174')](_0x5496eb))[_0x9909('0xc5')](loggerCatchQueueSummary('[syncCampaigns]',_0x5496eb));}else{notSendMessagesCampaign(_0x5496eb);}}}};function getCallerIdRandom(_0x51c7fd,_0x3e592a){var _0x3b8784;var _0xa81229;var _0x53f363;if(_0x3e592a<=0x0){_0x3e592a=0x1;}_0x3b8784=new RegExp(_0x9909('0x175')+_0x3e592a+'}$');_0xa81229=Math[_0x9909('0x176')](0xa,_0x3e592a-0x1);_0x53f363=Math[_0x9909('0x176')](0xa,_0x3e592a)-0x1;return util[_0x9909('0x85')]('%s',_['replace'](_0x51c7fd,_0x3b8784,_[_0x9909('0x177')](_0xa81229,_0x53f363)));}function extractCalleridName(_0x520246){var _0x9cc841=_0x520246['match'](/"(.*?)"/);return _0x9cc841?_0x9cc841[0x1]:_0x520246;}function extractCalleridNumber(_0x3c2b8b){var _0x481668=_0x3c2b8b[_0x9909('0x178')](/<(.*?)>/);return _0x481668?_0x481668[0x1]:_0x3c2b8b;}Dialer[_0x9909('0x1d')][_0x9909('0x179')]=function(_0x53df0a,_0x55c638){var _0x298a7d=this;var _0x1cdee2=uuid['v4']();this[_0x9909('0x28')][_0x1cdee2]=new Action(_0x53df0a,_0x55c638,_0x1cdee2);return new BPromise(function(_0x50fdeb,_0x4e5c53){if(_[_0x9909('0x46')](_0x53df0a)&&typeof _0x53df0a!==_0x9909('0x17a')){return _0x4e5c53(msgResponse(_0x9909('0x17b'),_0x9909('0x152'),_0x9909('0x17c')));}if(_[_0x9909('0x46')](_0x55c638[_0x9909('0x17d')])||_0x55c638[_0x9909('0x17d')]===null){return _0x4e5c53(msgResponse(_0x9909('0x17b'),_0x9909('0x152'),_0x9909('0x17e')));}var _0x440f37={'XMD-CALLERID':_0x298a7d[_0x9909('0x28')][_0x1cdee2][_0x9909('0x17f')](),'XMD-AGI':_0x53df0a[_0x9909('0x180')]?util[_0x9909('0x85')](_0x9909('0x181'),ipAgi,_0x53df0a['dialQueueProject']):_0x9909('0x182'),'XMD-AGIAFTER':_0x53df0a[_0x9909('0x125')]?util[_0x9909('0x85')](_0x9909('0x181'),ipAgi,_0x53df0a[_0x9909('0x125')]):'NONE','XMD-QUEUE':_0x53df0a['type']===_0x9909('0x59')?util[_0x9909('0x85')](_0x9909('0x183'),_0x53df0a[_0x9909('0x4a')],_0x53df0a[_0x9909('0x184')]||'',_0x53df0a[_0x9909('0x11a')]?'c':'',_0x53df0a[_0x9909('0x121')]||0x3):_0x9909('0x182'),'XMD-CONTACTID':_0x55c638[_0x9909('0x111')],'XMD-CDRTYPE':_0x9909('0x9'),'CALLERID(all)':_0x298a7d[_0x9909('0x28')][_0x1cdee2]['getCaller'](),'XMD-AMD':_0x53df0a[_0x9909('0xef')]?'ACTIVE':_0x9909('0x182'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x53df0a[_0x9909('0xef')]){_0x440f37[_0x9909('0x185')]=_0x53df0a[_0x9909('0x186')]||0x9c4;_0x440f37['XMD-AMDGREETING']=_0x53df0a['dialAMDGreeting']||0x5dc;_0x440f37[_0x9909('0x187')]=_0x53df0a[_0x9909('0x188')]||0x320;_0x440f37[_0x9909('0x189')]=_0x53df0a[_0x9909('0x18a')]||0x1388;_0x440f37[_0x9909('0x18b')]=_0x53df0a[_0x9909('0x18c')]||0x64;_0x440f37[_0x9909('0x18d')]=_0x53df0a['dialAMDBetweenWordsSilence']||0x32;_0x440f37['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x53df0a[_0x9909('0x18e')]||0x3;_0x440f37[_0x9909('0x18f')]=_0x53df0a[_0x9909('0x190')]||0x100;_0x440f37[_0x9909('0x191')]=_0x53df0a['dialAMDMaximumWordLength']||0x1388;}if(_0x53df0a[_0x9909('0x58')]===_0x9909('0x59')){_0x440f37[_0x9909('0x192')]=_0x55c638['VoiceQueueId'];}else{_0x440f37[_0x9909('0x193')]=_0x55c638['CampaignId'];}for(var _0x2385aa in _0x55c638[_0x9909('0x194')]){if(typeof _0x55c638[_0x9909('0x194')][_0x2385aa]!==_0x9909('0xa5')){if(isNotNull(_0x55c638['Contact'][_0x2385aa])&&_0x2385aa!=='id'&&_0x2385aa!=='tags'&&_0x2385aa!=='createdAt'&&_0x2385aa!==_0x9909('0x195')){_0x440f37[util[_0x9909('0x85')](_0x9909('0x196'),'XMD-',_[_0x9909('0x197')](_0x2385aa))]=_0x55c638[_0x9909('0x194')][_0x2385aa];}}}var _0x70c72=_0x298a7d['isTrunkReachable'](_0x53df0a[_0x9909('0x82')])?getCallerId(_0x53df0a['Trunk'][_0x9909('0x84')],_0x53df0a['dialOriginateCallerIdName'],_0x53df0a['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x53df0a[_0x9909('0x66')],_0x53df0a[_0x9909('0x198')]):_0x53df0a[_0x9909('0x66')]):getCallerId(_[_0x9909('0xba')](_0x53df0a[_0x9909('0x14f')])?_0x53df0a[_0x9909('0x82')][_0x9909('0x84')]:_0x53df0a['TrunkBackup'][_0x9909('0x84')],_0x53df0a[_0x9909('0x65')],_0x53df0a[_0x9909('0x198')]>0x0?getCallerIdRandom(_0x53df0a[_0x9909('0x66')],_0x53df0a[_0x9909('0x198')]):_0x53df0a[_0x9909('0x66')]);if(_0x70c72){_0x440f37[_0x9909('0x199')]=_0x298a7d[_0x9909('0x28')][_0x1cdee2]['originatecalleridname']=extractCalleridName(_0x70c72);_0x440f37[_0x9909('0x19a')]=_0x55c638['phone'];}return ami[_0x9909('0xbb')]({'actionid':_0x1cdee2,'action':_0x9909('0x17b'),'channel':_0x298a7d[_0x9909('0xe6')](_0x53df0a[_0x9909('0x82')])?util[_0x9909('0x85')](_0x9909('0x19b'),_0x53df0a['Trunk'][_0x9909('0x4a')],isNotNull(_0x53df0a['dialPrefix'])?_0x53df0a['dialPrefix'][_0x9909('0x19c')]()||'':'',_0x53df0a[_0x9909('0x19d')]>0x0?_0x55c638[_0x9909('0x17d')][_0x9909('0x19e')](_0x53df0a['dialCutDigit']):_0x55c638[_0x9909('0x17d')]):util[_0x9909('0x85')](_0x9909('0x19b'),_[_0x9909('0xba')](_0x53df0a[_0x9909('0x14f')])?_0x53df0a[_0x9909('0x82')][_0x9909('0x4a')]:_0x53df0a[_0x9909('0x14f')][_0x9909('0x4a')],isNotNull(_0x53df0a['dialPrefix'])?_0x53df0a[_0x9909('0x68')][_0x9909('0x19c')]()||'':'',_0x53df0a[_0x9909('0x19d')]>0x0?_0x55c638[_0x9909('0x17d')][_0x9909('0x19e')](_0x53df0a[_0x9909('0x19d')]):_0x55c638[_0x9909('0x17d')]),'callerid':_0x70c72,'Exten':_0x9909('0xee'),'Context':_0x9909('0x19f'),'Priority':'1','variable':_0x440f37,'timeout':(_0x53df0a[_0x9909('0x67')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1cdee2})[_0x9909('0x44')](function(_0x583877){return _0x50fdeb(_0x583877);})['catch'](function(_0x383523){_0x53df0a['outboundOriginateFailureCallsDay']+=0x1;var _0xba7c8b=new History(_0x298a7d['actions'][_0x1cdee2]);logger[_0x9909('0xa2')](util['format'](_0x9909('0x1a0'),JSON[_0x9909('0x53')](_0x383523)));_0xba7c8b['state']=0xe;_0xba7c8b[_0x9909('0xf2')]=_0x9909('0x1a1');_0xba7c8b[_0x9909('0xb5')]=moment()[_0x9909('0x85')]('YYYY-MM-DD\x20HH:mm:ss');_0xba7c8b[_0x9909('0x1a2')]=_0xba7c8b[_0x9909('0xb5')];_0x298a7d[_0x9909('0xd8')](_0xba7c8b)[_0x9909('0xc5')](loggerCatch(_0x9909('0x1a3')));_0x298a7d[_0x9909('0xd6')](_0xba7c8b)['catch'](loggerCatch(_0x9909('0x1a3')))['finally'](function(){delete _0x298a7d[_0x9909('0x28')][_0x1cdee2];return _0x4e5c53(msgResponse(_0x9909('0x17b'),'Error',_0x9909('0x1a4')));});});});};Dialer[_0x9909('0x1d')][_0x9909('0x33')]=function(_0x483c48){var _0x47fb3c=this['actions'][_0x483c48[_0x9909('0x137')]];if(_0x47fb3c){delete this['actions'][_0x483c48[_0x9909('0x137')]];_0x47fb3c[_0x9909('0x120')]=moment()[_0x9909('0x85')](_0x9909('0x110'));var _0x2fc7ac=_0x47fb3c[_0x9909('0x58')]==='ivr'?this['campaigns'][_0x47fb3c[_0x9909('0xbd')]]:this[_0x9909('0x22')][_0x47fb3c['getQueue']()];if(!this['isSuccess'](_0x483c48[_0x9909('0x1a5')])){this[_0x9909('0xbf')](_0x2fc7ac);return this[_0x9909('0x1a6')](_0x47fb3c,_0x2fc7ac,_0x483c48)[_0x9909('0xc5')](loggerCatch(_0x9909('0x1a7')));}this[_0x9909('0x2a')][_0x483c48[_0x9909('0xea')]]=_0x47fb3c;}};Dialer[_0x9909('0x1d')][_0x9909('0x1a8')]=function(_0xbe5e37,_0x50edbc,_0x558045){var _0x4be171=new History(_0x50edbc);if(_0x4be171[_0x9909('0xfc')]+_0x4be171[_0x9909('0xfd')]+_0x4be171[_0x9909('0xfe')]+_0x4be171['countnosuchnumberretry']+_0x4be171[_0x9909('0x100')]+_0x4be171[_0x9909('0x131')]+_0x4be171[_0x9909('0xf9')]+_0x4be171[_0x9909('0x1a9')]>=_0x558045[_0x9909('0x101')]-0x1){return!![];}switch(_0xbe5e37){case 0x3:if(_0x4be171['countnoanswerretry']>=_0x558045[_0x9909('0x1aa')]-0x1){return!![];}this[_0x9909('0xcc')]({'active':![],'countnoanswerretry':_0x4be171[_0x9909('0xfe')]+=0x1,'scheduledat':moment()[_0x9909('0x10f')](_0x558045[_0x9909('0x1ab')],_0x9909('0x106'))[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171['ListId'],'VoiceQueueId':_0x4be171[_0x9909('0x107')]||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x4be171['countbusyretry']>=_0x558045[_0x9909('0x1ac')]-0x1){return!![];}this[_0x9909('0xcc')]({'active':![],'countbusyretry':_0x4be171['countbusyretry']+=0x1,'scheduledat':moment()[_0x9909('0x10f')](_0x558045['dialBusyRetryFrequency'],_0x9909('0x106'))['format'](_0x9909('0x110')),'ContactId':_0x4be171['ContactId'],'ListId':_0x4be171['ListId'],'VoiceQueueId':_0x4be171['VoiceQueueId']||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x1ad')));break;case 0x8:if(_0x4be171[_0x9909('0xfd')]>=_0x558045['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4be171[_0x9909('0xfd')]+=0x1,'scheduledat':moment()[_0x9909('0x10f')](_0x558045[_0x9909('0x1ae')],'minutes')[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171[_0x9909('0xe1')],'VoiceQueueId':_0x4be171[_0x9909('0x107')]||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4be171['countnosuchnumberretry']>=_0x558045[_0x9909('0x1af')]-0x1){return!![];}else{this[_0x9909('0xcc')]({'active':![],'countnosuchnumberretry':_0x4be171[_0x9909('0xff')]+=0x1,'scheduledat':moment()['add'](_0x558045[_0x9909('0x1b0')],'minutes')[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171[_0x9909('0xe1')],'VoiceQueueId':_0x4be171[_0x9909('0x107')]||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4be171[_0x9909('0x100')]>=_0x558045[_0x9909('0x129')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4be171[_0x9909('0x100')]+=0x1,'scheduledat':moment()[_0x9909('0x10f')](_0x558045[_0x9909('0x12a')],_0x9909('0x106'))[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171['ListId'],'VoiceQueueId':_0x4be171[_0x9909('0x107')]||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x1b1')));break;case 0xb:if(_0x4be171[_0x9909('0x131')]>=_0x558045['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x4be171[_0x9909('0x131')]+=0x1,'scheduledat':moment()['add'](_0x558045[_0x9909('0x132')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171[_0x9909('0xe1')],'VoiceQueueId':_0x4be171['VoiceQueueId']||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x134')));break;case 0x13:if(_0x4be171[_0x9909('0xf9')]>=_0x558045[_0x9909('0x103')]-0x1){return!![];}this[_0x9909('0xcc')]({'active':![],'countmachineretry':_0x4be171[_0x9909('0xf9')]+=0x1,'scheduledat':moment()[_0x9909('0x10f')](_0x558045['dialMachineRetryFrequency'],_0x9909('0x106'))[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171['ListId'],'VoiceQueueId':_0x4be171[_0x9909('0x107')]||undefined,'CampaignId':_0x4be171['CampaignId']||undefined})['catch'](loggerCatch(_0x9909('0x108')));break;case 0x14:if(_0x4be171[_0x9909('0x1a9')]>=_0x558045['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x9909('0xcc')]({'active':![],'countagentrejectretry':_0x4be171['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x558045['dialAgentRejectRetryFrequency'],'minutes')[_0x9909('0x85')](_0x9909('0x110')),'ContactId':_0x4be171[_0x9909('0x111')],'ListId':_0x4be171[_0x9909('0xe1')],'VoiceQueueId':_0x4be171['VoiceQueueId']||undefined,'CampaignId':_0x4be171[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x1b2')));break;default:return!![];}};Dialer['prototype'][_0x9909('0x1a6')]=function(_0x529abc,_0x55b925,_0x5b4db1){var _0xa9463f=this;var _0x1996d4=new History(_0x529abc);var _0x498146=![];var _0x2d25d4;var _0x23bbf2;return new BPromise(function(_0x44937b,_0x2116a5){if(_[_0x9909('0x46')](_0x55b925)&&typeof _0x55b925!==_0x9909('0x17a')){return _0x2116a5(msgResponse('[callProgressDetecting]',_0x9909('0x152'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x5b4db1)&&typeof _0x5b4db1!=='object'){return _0x2116a5(msgResponse('[callProgressDetecting]',_0x9909('0x152'),_0x9909('0x1b3')));}_0xa9463f[_0x9909('0xc7')](_0x1996d4,_0x5b4db1[_0x9909('0x117')],_0x55b925)['then'](function(_0xe957bd){if(_0xe957bd[_0x9909('0x128')]==0x1)_0x498146=!![];switch(_0x5b4db1['reason']){case'0':_0x55b925[_0x9909('0x1b4')]+=0x1;_0x1996d4[_0x9909('0xb4')]=0x0;_0x1996d4[_0x9909('0xf2')]=_0x9909('0x1b5');_0x1996d4[_0x9909('0xff')]+=0x1;_0x1996d4[_0x9909('0xfa')]+=0x1;ami[_0x9909('0x57')]('custom:agentnosuchnumber',ut[_0x9909('0xf6')](_0x529abc,_0x9909('0x1b6')));_0x2d25d4=_0x55b925['dialNoSuchNumberRetryFrequency'];_0x23bbf2=_0x55b925[_0x9909('0x126')];_0xa9463f[_0x9909('0xd8')](_0x1996d4)[_0x9909('0xc5')](loggerCatch(_0x9909('0xfb')));if(_0xa9463f[_0x9909('0x1a8')](0x0,_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4[_0x9909('0xff')]>=_0x55b925[_0x9909('0x1af')]){_0xa9463f[_0x9909('0x104')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1b7'));}else{_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x55b925[_0x9909('0x6f')]+=0x1;_0x1996d4[_0x9909('0xb4')]=0x3;_0x1996d4['statedesc']='NoAnswer';_0x1996d4[_0x9909('0xfe')]+=0x1;_0x1996d4[_0x9909('0xfa')]+=0x1;ami['emit'](_0x9909('0x1b8'),ut['buildObj'](_0x529abc,'noanswer'));_0x2d25d4=_0x55b925[_0x9909('0x1ab')];_0x23bbf2=_0x55b925[_0x9909('0x126')];_0xa9463f['createHistory'](_0x1996d4)[_0x9909('0xc5')](loggerCatch(_0x9909('0x1b9')));if(_0xa9463f[_0x9909('0x1a8')](0x3,_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4[_0x9909('0xfe')]>=_0x55b925[_0x9909('0x1aa')]){_0xa9463f[_0x9909('0x104')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1ba'));}else{_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1ba'));}}break;case'5':_0x55b925[_0x9909('0x1bb')]+=0x1;_0x1996d4[_0x9909('0xb4')]=0x5;_0x1996d4[_0x9909('0xf2')]=_0x9909('0x1bc');_0x1996d4['countbusyretry']+=0x1;_0x1996d4['countglobal']+=0x1;ami[_0x9909('0x57')]('custom:agentbusy',ut[_0x9909('0xf6')](_0x529abc,_0x9909('0x1bd')));_0x2d25d4=_0x55b925['dialBusyRetryFrequency'];_0x23bbf2=_0x55b925['callAdditionalPhoneAfterMin'];_0xa9463f[_0x9909('0xd8')](_0x1996d4)[_0x9909('0xc5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xa9463f[_0x9909('0x1a8')](0x5,_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4['countbusyretry']>=_0x55b925[_0x9909('0x1ac')]){_0xa9463f[_0x9909('0x104')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1be'));}else{_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,'reason\x205\x20busy');}}break;case'8':_0x55b925['outboundCongestionCallsDay']+=0x1;_0x1996d4[_0x9909('0xb4')]=0x8;_0x1996d4[_0x9909('0xf2')]=_0x9909('0x1bf');_0x1996d4[_0x9909('0xfd')]+=0x1;_0x1996d4[_0x9909('0xfa')]+=0x1;_0x2d25d4=_0x55b925[_0x9909('0x1ae')];_0x23bbf2=_0x55b925[_0x9909('0x126')];ami[_0x9909('0x57')](_0x9909('0x1c0'),ut[_0x9909('0xf6')](_0x529abc,_0x9909('0x1c1')));_0xa9463f[_0x9909('0xd8')](_0x1996d4)[_0x9909('0xc5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xa9463f[_0x9909('0x1a8')](0x8,_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4['countcongestionretry']>=_0x55b925[_0x9909('0x1c2')]){_0xa9463f['createStateFinal'](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1c3'));}else{_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1c3'));}}break;case'11':_0x55b925[_0x9909('0x1c4')]+=0x1;_0x1996d4['state']=0xb;_0x1996d4['statedesc']='Abandoned';_0x1996d4[_0x9909('0x131')]+=0x1;_0x1996d4['countglobal']+=0x1;_0x2d25d4=_0x55b925['dialAbandonedRetryFrequency'];_0x23bbf2=_0x55b925[_0x9909('0x126')];_0xa9463f[_0x9909('0xd8')](_0x1996d4)[_0x9909('0xc5')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xa9463f[_0x9909('0x1a8')](0xb,_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4[_0x9909('0x131')]>=_0x55b925[_0x9909('0x133')]){_0xa9463f['createStateFinal'](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1c5'));}else{_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,'reason\x2011\x20abandoned');}}break;case'20':_0x55b925[_0x9909('0x71')]+=0x1;_0x1996d4['state']=0x14;_0x1996d4[_0x9909('0xf2')]='AgentReject';_0x1996d4[_0x9909('0x1a9')]+=0x1;_0x1996d4[_0x9909('0xfa')]+=0x1;_0x2d25d4=_0x55b925[_0x9909('0x1c6')];_0x23bbf2=_0x55b925['callAdditionalPhoneAfterMin'];ami[_0x9909('0x57')](_0x9909('0x1c7'),ut[_0x9909('0xf6')](_0x529abc,_0x9909('0x1c8')));_0xa9463f[_0x9909('0xd8')](_0x1996d4)[_0x9909('0xc5')](loggerCatch(_0x9909('0x1c9')));if(_0xa9463f['checkRetriveMax'](0x14,_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4[_0x9909('0x1a9')]>=_0x55b925[_0x9909('0x1ca')]){_0xa9463f[_0x9909('0x104')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1cb'));}else{_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,_0x9909('0x1cb'));}}break;default:_0x55b925[_0x9909('0x72')]+=0x1;_0x1996d4['state']=0xc;_0x1996d4[_0x9909('0xf2')]=_0x5b4db1[_0x9909('0x117')];_0x2d25d4=_0x55b925[_0x9909('0x1c6')];_0x23bbf2=_0x55b925[_0x9909('0x126')];_0xa9463f[_0x9909('0xd8')](_0x1996d4)[_0x9909('0xc5')](loggerCatch(_0x9909('0x1cc')));if(_0xa9463f['checkRetriveMax'](_0x5b4db1['reason'],_0x529abc,_0x55b925)&&!_0x498146){if(_0x1996d4[_0x9909('0xfc')]+_0x1996d4[_0x9909('0xfd')]+_0x1996d4[_0x9909('0xfe')]+_0x1996d4[_0x9909('0xff')]+_0x1996d4[_0x9909('0x100')]+_0x1996d4[_0x9909('0x131')]+_0x1996d4['countmachineretry']+_0x1996d4['countagentrejectretry']>=_0x55b925[_0x9909('0x101')]){_0xa9463f[_0x9909('0x102')](_0x1996d4,_0x44937b,_0x2116a5,_0x5b4db1[_0x9909('0x117')]);}else{_0xa9463f[_0x9909('0x104')](_0x1996d4,_0x44937b,_0x2116a5,_0x5b4db1[_0x9909('0x117')]);}}}})[_0x9909('0x44')](function(_0x1a0e91){if(_0x498146){_0xa9463f['swapAdditionalPhones'](_0x1996d4,_0x2d25d4,_0x23bbf2)['then'](function(_0x593161){return _0x44937b(0x1);});}});});};Dialer[_0x9909('0x1d')][_0x9909('0x102')]=function(_0x12c09b,_0x45ec39,_0x25b1cc,_0x5a11d2){var _0x4b38fc=new Final(_0x12c09b);_0x4b38fc[_0x9909('0xb4')]=0xf;_0x4b38fc[_0x9909('0xf2')]=_0x9909('0x1cd');this[_0x9909('0x104')](_0x4b38fc,_0x45ec39,_0x25b1cc,_0x5a11d2);};Dialer[_0x9909('0x1d')][_0x9909('0x104')]=function(_0x3b77e3,_0x1968cc,_0x1cbf09,_0x39e6b9){this['moveContactManagedDialer'](_0x3b77e3)[_0x9909('0x44')](function(){return _0x1968cc(msgResponse(_0x9909('0x1ce'),'Success',_0x39e6b9));})[_0x9909('0xc5')](function(){return _0x1cbf09(msgResponse(_0x9909('0x1cf'),_0x9909('0x152'),_0x9909('0x1d0')));});};Dialer['prototype'][_0x9909('0xb')]=function(_0x2ecba4){var _0x3874da=_0x2ecba4[_0x9909('0x1d1')]/0x64;var _0x1d9de5=_0x2ecba4['outboundDropCallsDayTimeout']/(_0x2ecba4['outboundDropCallsDayTimeout']+_0x2ecba4['outboundAnswerCallsDay']);var _0x1ddcb5=Math[_0x9909('0x1d2')](_0x2ecba4[_0x9909('0x7c')]*(_0x2ecba4[_0x9909('0x1d3')]/0x64));var _0x1d5bfd=Math[_0x9909('0x1d2')](_0x2ecba4[_0x9909('0x7c')]*(_0x2ecba4[_0x9909('0x1d4')]/0x64));var _0x551b2b=_0x2ecba4[_0x9909('0xad')]+_0x2ecba4[_0x9909('0x5f')];var _0x18f49b=Math[_0x9909('0x1d5')](_0x2ecba4['erlangCalls']*_0x2ecba4[_0x9909('0x7f')]*_0x2ecba4[_0x9909('0x1d6')]*_0x2ecba4['predictiveIntervalMultiplicativeFactor']);if(_[_0x9909('0x46')](_0x2ecba4[_0x9909('0x2c')])){if(!_[_0x9909('0x46')](_0x2ecba4['startPredictive'])){_0x2ecba4[_0x9909('0x81')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x9909('0x1d7'));}if(!_[_0x9909('0x46')](_0x2ecba4['handlePredictive'])){loggerPredictive[_0x9909('0xa2')](_0x9909('0x1d8'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2ecba4[_0x9909('0x9d')]);_0x2ecba4[_0x9909('0x9d')]=undefined;}_0x2ecba4[_0x9909('0x2c')]=moment()[_0x9909('0x85')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2ecba4[_0x9909('0x4a')],_0x9909('0x1d9'),_0x2ecba4[_0x9909('0x2c')]);this[_0x9909('0x166')](_0x2ecba4,0x1);}else if(ifInterval(_0x2ecba4[_0x9909('0x1da')],_0x2ecba4[_0x9909('0x2c')])){this[_0x9909('0x166')](_0x2ecba4,0x1);loggerPredictiveCalls[_0x9909('0x8b')](_0x9909('0x1db'),_0x2ecba4['startProgressive'],_0x2ecba4[_0x9909('0x4a')]);_0x2ecba4[_0x9909('0x7e')]=0x0;_0x2ecba4[_0x9909('0x79')]=0x0;}else if(_0x3874da<_0x1d9de5&&_0x2ecba4[_0x9909('0x1dc')]===_0x9909('0x1dd')){freeVariablesPredictive(_0x2ecba4);loggerPredictive['info'](_0x9909('0x1de'),_0x9909('0x1df'),_0x1d9de5,_0x9909('0x2c'),_0x2ecba4['name']);}else if(_0x18f49b<_0x2ecba4[_0x9909('0x79')]&&_0x2ecba4[_0x9909('0x1dc')]==='dropRate'){freeVariablesPredictive(_0x2ecba4);loggerPredictive['info'](_0x9909('0x1e0'),_0x9909('0x1e1'),_0x18f49b,_0x9909('0x1e2'),_0x2ecba4[_0x9909('0x79')],_0x9909('0x2c'),_0x2ecba4[_0x9909('0x4a')]);}else if(!ifInterval(_0x2ecba4[_0x9909('0x1da')],_0x2ecba4[_0x9909('0x2c')])&&_[_0x9909('0x46')](_0x2ecba4['startPredictive'])&&!_[_0x9909('0x46')](_0x2ecba4['startProgressive'])){_0x2ecba4['startPredictive']=moment()[_0x9909('0x85')](_0x9909('0x110'));loggerPredictive[_0x9909('0x8b')](_0x2ecba4[_0x9909('0x4a')],_0x9909('0x1e3'),_0x2ecba4['startPredictive']);this[_0x9909('0x1e4')](_0x2ecba4[_0x9909('0x1da')])[_0x9909('0x44')](this[_0x9909('0x1e5')](_0x2ecba4))[_0x9909('0x44')](mergeDataErlangB(_0x2ecba4))[_0x9909('0x44')](this['startMethodPredictive'](_0x2ecba4))[_0x9909('0xc5')](loggerCatchPredictive(_0x9909('0x1e6'),_0x2ecba4));}else if(!ifInterval(_0x2ecba4[_0x9909('0x1da')],_0x2ecba4['startPredictive'])){_0x2ecba4[_0x9909('0x79')]=0x0;_0x2ecba4[_0x9909('0x81')]=moment()[_0x9909('0x85')](_0x9909('0x110'));loggerPredictive[_0x9909('0x8b')](_0x2ecba4[_0x9909('0x4a')],'recalculate\x20predictive\x20at',_0x2ecba4['startPredictive']);clearInterval(_0x2ecba4[_0x9909('0x9d')]);_0x2ecba4[_0x9909('0x9d')]=undefined;this[_0x9909('0x1e4')](_0x2ecba4['dialPredictiveInterval'])['then'](this[_0x9909('0x1e5')](_0x2ecba4))[_0x9909('0x44')](mergeDataErlangB(_0x2ecba4))[_0x9909('0x44')](this[_0x9909('0x1e7')](_0x2ecba4))[_0x9909('0xc5')](loggerCatchPredictive(_0x9909('0x1e8'),_0x2ecba4));}else if(_0x2ecba4['predictiveIntervalAvailable']&&_0x551b2b<_0x2ecba4[_0x9909('0x7c')]-_0x1d5bfd){freeVariablesPredictive(_0x2ecba4);loggerPredictive['info'](_0x2ecba4['name'],_0x9909('0x1e9'),_0x551b2b,_0x9909('0x1ea'),_0x2ecba4['predictiveIntervalAvailable'],'-',_0x1d5bfd,'=',_0x2ecba4[_0x9909('0x7c')]-_0x1d5bfd,')');}else if(_0x2ecba4[_0x9909('0x7c')]&&_0x551b2b>_0x2ecba4['predictiveIntervalAvailable']+_0x1ddcb5){freeVariablesPredictive(_0x2ecba4);loggerPredictive[_0x9909('0x8b')](_0x2ecba4[_0x9909('0x4a')],_0x9909('0x1e9'),_0x551b2b,')\x20are\x20more\x20than\x20threshold\x20(',_0x2ecba4[_0x9909('0x7c')],'+',_0x1ddcb5,'=',_0x2ecba4['predictiveIntervalAvailable']+_0x1ddcb5,')');}};Dialer['prototype'][_0x9909('0x1e5')]=function(_0x67a670){var _0x49a6f3=this;return function(_0x484eca){return new BPromise(function(_0x5f4b14,_0x139a69){_['merge'](_0x67a670,_0x484eca[0x0]);if(checkGetDataPredictive(_0x484eca[0x0])){var _0xb7399a=_0x67a670['predictiveIntervalAvailable']=_0x67a670[_0x9909('0x5f')]+_0x67a670[_0x9909('0xad')];var _0x530c3f=_0x67a670[_0x9909('0x1da')]*0x3c;var _0x55dfb6=_0x484eca[0x0][_0x9909('0x75')]+_0x484eca[0x0][_0x9909('0x74')];var _0xb65c89=(_0x484eca[0x0][_0x9909('0x73')]+_0x484eca[0x0][_0x9909('0x77')]+_0x484eca[0x0][_0x9909('0x76')])/_0x484eca[0x0][_0x9909('0x7d')];_0x67a670[_0x9909('0x1d6')]=_0xb65c89>0x0?_0xb65c89:0x1;switch(_0x67a670[_0x9909('0x1dc')]){case _0x9909('0x1dd'):var _0x149783=_0x67a670[_0x9909('0x1d1')]/0x64;return _0x49a6f3[_0x9909('0x1eb')](_0xb7399a,_0x530c3f,_0x55dfb6,_0xb65c89,_0x149783)[_0x9909('0x44')](function(_0x1d7229){return _0x5f4b14(_0x1d7229);});case _0x9909('0x1ec'):var _0x4148a7=_0x67a670['dialPredictiveOptimizationPercentage']/0x64;return _0x49a6f3['busyFactor'](_0xb7399a,_0x530c3f,_0x55dfb6,_0xb65c89,_0x4148a7)[_0x9909('0x44')](function(_0x553a50){return _0x5f4b14(_0x553a50);});default:return _0x139a69(msgResponse('[getDataPredictive]',_0x9909('0x152'),_0x9909('0x1ed')));}}else{return _0x139a69(msgResponse(_0x9909('0x1ee'),'Failure','check\x20failure'));}});};};Dialer[_0x9909('0x1d')][_0x9909('0x1ef')]=function(_0x7c1d12){var _0x2d426a=this;return function(_0x28f8fb){return new BPromise(function(_0x3effee,_0x3d77d4){_[_0x9909('0x9a')](_0x7c1d12,_0x28f8fb[0x0]);if(checkGetDataPredictive(_0x28f8fb[0x0])){loggerPredictive[_0x9909('0x8b')](JSON[_0x9909('0x53')](_0x28f8fb[0x0]));if(_0x7c1d12[_0x9909('0x1dc')]===_0x9909('0x1dd')){return _0x2d426a[_0x9909('0xd5')](_0x7c1d12['id'])[_0x9909('0x44')](function(_0x54e1ee){var _0x10210e=_0x7c1d12['loggedIn']-_0x54e1ee[0x0]['outboundQueuePauses'];var _0x48f185=_0x7c1d12['dialPredictiveInterval']*0x3c;var _0x327765=_0x28f8fb[0x0]['predictiveIntervalAvgTalktime']+_0x28f8fb[0x0][_0x9909('0x74')];var _0x1b51c4=(_0x28f8fb[0x0][_0x9909('0x73')]+_0x28f8fb[0x0][_0x9909('0x77')]+_0x28f8fb[0x0][_0x9909('0x76')])/_0x28f8fb[0x0]['predictiveIntervalTotalCalls'];var _0x147f37=_0x7c1d12[_0x9909('0x1d1')]/0x64;_0x7c1d12[_0x9909('0x7b')]=_0x54e1ee[0x0][_0x9909('0x1f0')]||0x0;_0x7c1d12[_0x9909('0x1d6')]=_0x1b51c4>0x0?_0x1b51c4:0x1;return _0x2d426a[_0x9909('0x1eb')](_0x10210e,_0x48f185,_0x327765,_0x1b51c4,_0x147f37);})[_0x9909('0x44')](function(_0x179839){return _0x3effee(_0x179839);})['catch'](function(_0xd4a320){return _0x3d77d4(msgResponse(_0x9909('0x1f1'),'Failure',JSON[_0x9909('0x53')](_0xd4a320)));});}if(_0x7c1d12[_0x9909('0x1dc')]===_0x9909('0x1ec')){return _0x2d426a[_0x9909('0xd5')](_0x7c1d12['id'])[_0x9909('0x44')](function(_0x2a12a9){var _0x17978a=_0x7c1d12[_0x9909('0x5b')]-_0x2a12a9[0x0][_0x9909('0x1f0')];var _0x1b572a=_0x7c1d12[_0x9909('0x1da')]*0x3c;var _0xf32609=_0x28f8fb[0x0]['predictiveIntervalAvgTalktime']+_0x28f8fb[0x0][_0x9909('0x74')];var _0x1993ac=(_0x28f8fb[0x0]['predictiveIntervalAnsweredCalls']+_0x28f8fb[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x28f8fb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x28f8fb[0x0]['predictiveIntervalTotalCalls'];var _0x9e442f=_0x7c1d12[_0x9909('0x1d1')]/0x64;_0x7c1d12[_0x9909('0x7b')]=_0x2a12a9[0x0][_0x9909('0x1f0')]||0x0;_0x7c1d12[_0x9909('0x1d6')]=_0x1993ac>0x0?_0x1993ac:0x1;return _0x2d426a[_0x9909('0x1f2')](_0x17978a,_0x1b572a,_0xf32609,_0x1993ac,_0x9e442f);})[_0x9909('0x44')](function(_0x2bbcd0){return _0x3effee(_0x2bbcd0);})[_0x9909('0xc5')](function(_0x43105f){return _0x3d77d4(msgResponse(_0x9909('0x1f1'),_0x9909('0x152'),JSON[_0x9909('0x53')](_0x43105f)));});}}else{return _0x3d77d4(msgResponse(_0x9909('0x1ee'),_0x9909('0x152'),_0x9909('0x1f3')));}});};};Dialer[_0x9909('0x1d')][_0x9909('0x1e7')]=function(_0x1fc370){var _0x449c39=this;return function(){var _0xc0a7ac=0x0;var _0x40e0b0=Math[_0x9909('0x1d5')](_0x1fc370['erlangCallToSecond']*0x3e8);if(_0x40e0b0>0x0){_0x40e0b0=_0x40e0b0<0x64?0x64:_0x40e0b0;loggerPredictive[_0x9909('0x8b')](_0x1fc370['name'],'one\x20call\x20every:',_0x40e0b0,_0x9909('0x54'));_0x1fc370[_0x9909('0x9d')]=setInterval(function(){_0x449c39[_0x9909('0x9d')](_0x1fc370);loggerPredictiveCalls[_0x9909('0x8b')](_0x9909('0x1f4'),_0xc0a7ac+=0x1);},_0x40e0b0);}else{loggerPredictive[_0x9909('0x8b')](_0x1fc370[_0x9909('0x4a')],_0x9909('0x1f5'));}};};Dialer[_0x9909('0x1d')][_0x9909('0x1f6')]=function(_0x3ee645,_0x2a2c90){var _0x304dec=this;return function(_0xa36568){if(_['isEmpty'](_0xa36568)){if(_[_0x9909('0xba')](_0x2a2c90[_0x9909('0x1f7')])||!_0x2a2c90[_0x9909('0x1f8')]){if(_0x3ee645[_0x9909('0x64')]===_0x9909('0xa')){_0x3ee645[_0x9909('0x13f')]=_[_0x9909('0x46')](_0x3ee645[_0x9909('0x13f')])?!![]:_0x3ee645[_0x9909('0x13f')];var _0x4a8f57=uuid['v4']();_0x304dec['actions'][_0x4a8f57]=new Action(_0x3ee645,_0x2a2c90,_0x4a8f57);loggerBooked[_0x9909('0x8b')](_0x9909('0x1f9'),_0x4a8f57,'queueStatusComplete:\x20',JSON[_0x9909('0x53')](_0x3ee645[_0x9909('0x13f')]),_0x9909('0x1fa'),_0x3ee645['name']);if(_0x3ee645[_0x9909('0x13f')]){_0x3ee645['queueStatusComplete']=![];_0x304dec['queueBooked'][_0x304dec[_0x9909('0x28')][_0x4a8f57]['queue']]=[];ami['Action']({'actionid':_0x4a8f57,'action':_0x9909('0x1fb'),'queue':_0x3ee645['name']})[_0x9909('0xc5')](function(){_0x304dec[_0x9909('0xbf')](_0x3ee645);_0x304dec[_0x9909('0xcc')]({'active':![],'ContactId':_0x304dec[_0x9909('0x28')][_0x4a8f57][_0x9909('0x111')],'ListId':_0x304dec[_0x9909('0x28')][_0x4a8f57][_0x9909('0xe1')],'VoiceQueueId':_0x304dec[_0x9909('0x28')][_0x4a8f57][_0x9909('0x107')]||undefined,'CampaignId':_0x304dec[_0x9909('0x28')][_0x4a8f57][_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x1fc')));delete _0x304dec[_0x9909('0x28')][_0x4a8f57];});}else{loggerBooked[_0x9909('0x8b')](_0x9909('0x1fd'),JSON['stringify'](_0x3ee645[_0x9909('0x13f')]),_0x9909('0x1fa'),_0x3ee645[_0x9909('0x4a')]);_0x304dec[_0x9909('0xbf')](_0x3ee645);_0x304dec['rescheduleContact']({'active':![],'ContactId':_0x304dec[_0x9909('0x28')][_0x4a8f57][_0x9909('0x111')],'ListId':_0x304dec[_0x9909('0x28')][_0x4a8f57]['ListId'],'VoiceQueueId':_0x304dec[_0x9909('0x28')][_0x4a8f57]['VoiceQueueId']||undefined,'CampaignId':_0x304dec[_0x9909('0x28')][_0x4a8f57][_0x9909('0xe2')]||undefined})['catch'](loggerCatch(_0x9909('0x1fc')));delete _0x304dec[_0x9909('0x28')][_0x4a8f57];}}else{return _0x304dec[_0x9909('0x179')](_0x3ee645,_0x2a2c90);}}else{if(getDiff(_0x2a2c90[_0x9909('0x1fe')])<_0x3ee645['dialRecallMeTimeout']*0x3c){if(_0x2a2c90['Agent']&&!_0x2a2c90[_0x9909('0x1ff')]['voicePause']){_0x304dec[_0x9909('0x21')][_0x9909('0x141')](_0x2a2c90['id'])[_0x9909('0x1f')](function(){_0x304dec[_0x9909('0xbf')](_0x3ee645);});}else{_0x304dec[_0x9909('0xce')]({'active':![]},_0x2a2c90['id'],0x1)['finally'](function(){_0x304dec[_0x9909('0xbf')](_0x3ee645);});}}else{_0x3ee645[_0x9909('0x70')]+=0x1;_0x304dec[_0x9909('0xbf')](_0x3ee645);if(_0x3ee645[_0x9909('0x200')]){_0x304dec['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a2c90['ContactId'],'ListId':_0x2a2c90['ListId'],'VoiceQueueId':_0x2a2c90[_0x9909('0x107')]||undefined,'CampaignId':_0x2a2c90[_0x9909('0xe2')]||undefined})[_0x9909('0xc5')](loggerCatch(_0x9909('0x201')));_0x304dec['createHistory'](createObjHistory(_0x3ee645,_0x2a2c90,_0x9909('0x202'),0x17,_0x9909('0x203')))[_0x9909('0xc5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x304dec[_0x9909('0xdf')](createObjHistory(_0x3ee645,_0x2a2c90,_0x9909('0x204'),0x16,_0x9909('0x205')),_0x9909('0x206'),_0x9909('0x207'));}}}}else{_0x3ee645[_0x9909('0x6b')]+=0x1;_0x304dec[_0x9909('0xdf')](createObjHistory(_0x3ee645,_0x2a2c90,_0x9909('0x208'),0xd,'Blacklist'),_0x9909('0x209'),_0x9909('0x20a'));throw _0x9909('0x20b');}};};Dialer[_0x9909('0x1d')][_0x9909('0x20c')]=function(_0x5c5f40){var _0x4f4d4f=this;var _0x13b19a=_0x5c5f40['limitCalls']-_0x5c5f40[_0x9909('0xa4')]-_0x5c5f40[_0x9909('0xd1')];emitCampaignSummary(_0x5c5f40);if(_0x13b19a>0x0){if(_0x13b19a>this['maxNumberOriginate']){_0x13b19a=this[_0x9909('0x26')];}_0x5c5f40[_0x9909('0xd1')]+=_0x13b19a;this['getContactDialerIvr'](_0x5c5f40['id'],_0x13b19a,_0x5c5f40[_0x9909('0x20d')],_0x5c5f40)[_0x9909('0x44')](function(_0xd148a8){_0x5c5f40['temp']-=_0x13b19a;_0x5c5f40[_0x9909('0xd1')]=_0x5c5f40['temp']>0x0?_0x5c5f40[_0x9909('0xd1')]:0x0;if(!checkContactEmpty(_0xd148a8)){_0x5c5f40[_0x9909('0x47')]=_0x9909('0xab');logger[_0x9909('0x8b')](_0x9909('0x20e')+_0x5c5f40['name']);}else{_0x5c5f40[_0x9909('0xa4')]+=_0xd148a8[_0x9909('0xa3')];_0x5c5f40[_0x9909('0x47')]=_0x9909('0x20f');for(var _0x48615a=0x0;_0x48615a<_0xd148a8['length'];_0x48615a+=0x1){_0x5c5f40[_0x9909('0x210')]+=0x1;if(_['isNil'](_0xd148a8[_0x48615a])||_[_0x9909('0xba')](_0xd148a8[_0x48615a][_0x9909('0x194')])||_[_0x9909('0xba')](_0xd148a8[_0x48615a][_0x9909('0x17d')])){_0x4f4d4f[_0x9909('0xdd')](_0x9909('0x211'),_0x5c5f40,_0xd148a8[_0x48615a]);}else{_0x4f4d4f['checkIsBlackListIvr'](_['pick'](_0xd148a8[_0x48615a],[_0x9909('0xe2'),_0x9909('0x212')]))[_0x9909('0x44')](_0x4f4d4f[_0x9909('0x1f6')](_0x5c5f40,_0xd148a8[_0x48615a]))[_0x9909('0xc5')](_0x4f4d4f[_0x9909('0xdc')]('[actionOriginateIvr]\x20',_0x5c5f40));}}}})[_0x9909('0xc5')](loggerGetContactDialer(_0x9909('0x213'),_0x5c5f40,_0x13b19a));}};Dialer['prototype'][_0x9909('0x166')]=function(_0x59ea72,_0x2209db){var _0x46248d=this;var _0x32755e=[];var _0x5b0829=_0x2209db>=0x1?_0x2209db:0x1;if(_0x59ea72[_0x9909('0x64')]===_0x9909('0xa')){_0x5b0829=0x1;}var _0x21a7c5=Math[_0x9909('0x1d5')](_0x59ea72[_0x9909('0xad')]*_0x5b0829)-_0x59ea72[_0x9909('0xa4')]-_0x59ea72[_0x9909('0xd1')];emitVoiceQueueSummary(_0x59ea72);if(_0x59ea72[_0x9909('0x214')]>0x0){var _0x4db184=_0x59ea72[_0x9909('0x214')]-_0x59ea72[_0x9909('0xa4')]-_0x59ea72[_0x9909('0x5f')]-_0x59ea72[_0x9909('0xd1')]-_0x59ea72[_0x9909('0x5c')];if(_0x21a7c5>_0x4db184){_0x21a7c5=_0x4db184;}}if(_0x21a7c5>0x0){if(_0x59ea72['dialMethod']==='booked'){_0x21a7c5=0x1;}if(_0x21a7c5>this['maxNumberOriginate']){_0x21a7c5=this[_0x9909('0x26')];}_0x59ea72[_0x9909('0xd1')]+=_0x21a7c5;for(var _0x1ce02a in this[_0x9909('0x24')]){if(typeof this[_0x9909('0x24')][_0x1ce02a]!==_0x9909('0xa5')){if(this[_0x9909('0x24')][_0x1ce02a]['state']===_0x9909('0x215')&&this[_0x9909('0x24')][_0x1ce02a][_0x9909('0xbc')]===_0x9909('0xe8')){_0x32755e[_0x9909('0x216')](this['agents'][_0x1ce02a]['id']);}}}this[_0x9909('0xd0')](_0x59ea72['id'],_0x32755e,_0x21a7c5,_0x59ea72[_0x9909('0x20d')],_0x59ea72)[_0x9909('0x44')](function(_0x432214){_0x59ea72[_0x9909('0xd1')]-=_0x21a7c5;_0x59ea72['temp']=_0x59ea72[_0x9909('0xd1')]>0x0?_0x59ea72[_0x9909('0xd1')]:0x0;if(!checkContactEmpty(_0x432214)){_0x46248d['countReScheduled'](_0x59ea72)['then'](sendMessageReschedule(_0x59ea72))[_0x9909('0xc5')](loggerCatch(_0x9909('0xc3')));}else{_0x59ea72[_0x9909('0xa4')]+=_0x432214[_0x9909('0xa3')];_0x59ea72[_0x9909('0x47')]=_0x59ea72[_0x9909('0x64')]==='booked'?'ACTIVE':_0x9909('0x20f');for(var _0x55da84=0x0;_0x55da84<_0x432214[_0x9909('0xa3')];_0x55da84+=0x1){if(_['isNil'](_0x432214[_0x55da84])||_[_0x9909('0xba')](_0x432214[_0x55da84][_0x9909('0x194')])||_['isNil'](_0x432214[_0x55da84]['phone'])){_0x46248d[_0x9909('0xdd')]('[actionOriginate]\x20',_0x59ea72,_0x432214[_0x55da84]);}else{_0x46248d[_0x9909('0xc4')](_[_0x9909('0xe0')](_0x432214[_0x55da84],[_0x9909('0x107'),_0x9909('0x212')]))['then'](_0x46248d[_0x9909('0x1f6')](_0x59ea72,_0x432214[_0x55da84]))[_0x9909('0xc5')](_0x46248d[_0x9909('0xdc')](_0x9909('0x211'),_0x59ea72));}}}})[_0x9909('0xc5')](loggerGetContactDialer(_0x9909('0x217'),_0x59ea72,_0x21a7c5));}};Dialer['prototype']['handlePredictive']=function(_0x418f9d){if(_0x418f9d[_0x9909('0x214')]>0x0){var _0x36754c=_0x418f9d[_0x9909('0x214')]-_0x418f9d[_0x9909('0xa4')]-_0x418f9d['talking'];if(_0x36754c>0x0){this[_0x9909('0x218')](_0x418f9d);}else{loggerPredictiveCalls[_0x9909('0x8b')](_0x9909('0x219'));}}else{this[_0x9909('0x218')](_0x418f9d);}};Dialer[_0x9909('0x1d')][_0x9909('0x218')]=function(_0x5992b7){var _0x2ae5bc=this;var _0x12e956=[];_0x5992b7[_0x9909('0xa4')]+=0x1;for(var _0x399f6e in this['agents']){if(typeof this['agents'][_0x399f6e]!==_0x9909('0xa5')){if(this[_0x9909('0x24')][_0x399f6e][_0x9909('0xb4')]==='not_inuse'&&this['agents'][_0x399f6e][_0x9909('0xbc')]===_0x9909('0xe8')){_0x12e956[_0x9909('0x216')](this[_0x9909('0x24')][_0x399f6e]['id']);}}}this[_0x9909('0xd0')](_0x5992b7['id'],_0x12e956,0x1,_0x5992b7['dialOrderByScheduledAt'],_0x5992b7)['then'](function(_0x481bc8){if(!checkContactEmpty(_0x481bc8)){checkContactLowerLimitOriginate(_0x5992b7,0x1,0x0);_0x2ae5bc[_0x9909('0xc1')](_0x5992b7)[_0x9909('0x44')](sendMessageReschedule(_0x5992b7))[_0x9909('0xc5')](loggerCatch(_0x9909('0xc3')));}else{_0x5992b7['message']=_0x9909('0x20f');if(_[_0x9909('0xba')](_0x481bc8[0x0])||_['isNil'](_0x481bc8[0x0][_0x9909('0x194')])||_[_0x9909('0xba')](_0x481bc8[0x0]['phone'])){_0x2ae5bc[_0x9909('0xdd')]('[actionOriginate]\x20',_0x5992b7,_0x481bc8[0x0]);}else{_0x2ae5bc[_0x9909('0xc4')](_[_0x9909('0xe0')](_0x481bc8[0x0],[_0x9909('0x107'),'Contact.phone']))[_0x9909('0x44')](_0x2ae5bc[_0x9909('0x1f6')](_0x5992b7,_0x481bc8[0x0]))['catch'](_0x2ae5bc['loggerHandler'](_0x9909('0x21a'),_0x5992b7));}}})['catch'](loggerGetContactDialer(_0x9909('0x21b'),_0x5992b7,0x1));emitVoiceQueueSummary(_0x5992b7);};Dialer[_0x9909('0x1d')][_0x9909('0x1eb')]=function(_0xa83d29,_0x520c2a,_0x11fefa,_0x2114f0,_0x2c26fa,_0x285f6e){loggerPredictive[_0x9909('0x8b')](_0x9909('0x21c'));loggerPredictive[_0x9909('0x8b')]('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',_0xa83d29);loggerPredictive[_0x9909('0x8b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x520c2a);loggerPredictive[_0x9909('0x8b')](_0x9909('0x21d'),_0x11fefa);loggerPredictive['info']('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',_0x2114f0);loggerPredictive[_0x9909('0x8b')](_0x9909('0x21e'),_0x2c26fa);loggerPredictive[_0x9909('0x8b')](_0x9909('0x90'));return new BPromise(function(_0x5f2749,_0x4f8c7e){if(_0xa83d29<=0x0||isNaN(_0xa83d29)){return _0x4f8c7e(msgResponse(_0x9909('0x21f'),_0x9909('0x52'),_0x9909('0x220')+_0xa83d29));}if(_0x11fefa<=0x0||isNaN(_0x11fefa)){return _0x4f8c7e(msgResponse(_0x9909('0x21f'),_0x9909('0x52'),_0x9909('0x221')+_0x11fefa));}if(_0x2114f0<=0x0||isNaN(_0x2114f0)){return _0x4f8c7e(msgResponse(_0x9909('0x21f'),'Error',_0x9909('0x222')+_0x2114f0));}if(_0x520c2a<=0x0||isNaN(_0x520c2a)){return _0x4f8c7e(msgResponse('[abandonmentRate]',_0x9909('0x52'),'interval\x20=\x20'+_0x520c2a));}if(_0x2c26fa<=0x0||isNaN(_0x2c26fa)){return _0x4f8c7e(msgResponse('[abandonmentRate]',_0x9909('0x52'),_0x9909('0x223')+_0x2c26fa));}_0x285f6e=_0x285f6e||0x0;var _0x8afa2f=0x1/_0x11fefa;var _0x18ab64=0x0;var _0x363a19=0x0;var _0x4ec7dc=0x0;var _0x2f352f=0x0;for(var _0x2eb8b5=0x0;_0x4ec7dc<_0x2c26fa;_0x2eb8b5+=0x1){_0x363a19=_0x2eb8b5/_0x520c2a;_0x18ab64=(_0x2114f0*_0x363a19+_0x285f6e)/_0x8afa2f;_0x4ec7dc=erlangb(_0x18ab64,_0xa83d29);_0x2f352f=_0x18ab64/_0xa83d29*(0x1-erlangb(_0x18ab64,_0xa83d29));}return _0x5f2749({'erlangCalls':_0x2eb8b5,'erlangCallToSecond':_0x520c2a/_0x2eb8b5,'erlangAbandonmentRate':_0x4ec7dc,'erlangBusyFactor':_0x2f352f});});};Dialer[_0x9909('0x1d')][_0x9909('0x1f2')]=function(_0x44956d,_0x2118ce,_0x3e6a4c,_0x2902df,_0x218210,_0x2738dc){loggerPredictive[_0x9909('0x8b')](_0x9909('0x224'));loggerPredictive[_0x9909('0x8b')](_0x9909('0x225'),_0x44956d);loggerPredictive[_0x9909('0x8b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2118ce);loggerPredictive[_0x9909('0x8b')](_0x9909('0x21d'),_0x3e6a4c);loggerPredictive[_0x9909('0x8b')]('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',_0x2902df);loggerPredictive[_0x9909('0x8b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x218210);loggerPredictive[_0x9909('0x8b')](_0x9909('0x90'));return new BPromise(function(_0x1a35e2,_0x1678ad){if(_0x44956d<=0x0||isNaN(_0x44956d)){return _0x1678ad(msgResponse(_0x9909('0x226'),'Error','m\x20=\x20'+_0x44956d));}if(_0x3e6a4c<=0x0||isNaN(_0x3e6a4c)){return _0x1678ad(msgResponse(_0x9909('0x226'),_0x9909('0x52'),'Ts\x20=\x20'+_0x3e6a4c));}if(_0x2902df<=0x0||isNaN(_0x2902df)){return _0x1678ad(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x2902df));}if(_0x2118ce<=0x0||isNaN(_0x2118ce)){return _0x1678ad(msgResponse('[busyFactor]',_0x9909('0x52'),_0x9909('0x227')+_0x2118ce));}if(_0x218210<=0x0||isNaN(_0x218210)){return _0x1678ad(msgResponse(_0x9909('0x226'),'Error',_0x9909('0x228')+_0x218210));}_0x2738dc=_0x2738dc||0x0;var _0x172462=0x1/_0x3e6a4c;var _0x3ed203=0x0;var _0x1f6232=0x0;var _0x4d9f42=0x0;var _0x49435f=0x0;for(var _0x4d6f72=0x0;_0x49435f<_0x218210;_0x4d6f72+=0x1){_0x1f6232=_0x4d6f72/_0x2118ce;_0x3ed203=(_0x2902df*_0x1f6232+_0x2738dc)/_0x172462;_0x4d9f42=erlangb(_0x3ed203,_0x44956d);_0x49435f=_0x3ed203/_0x44956d*(0x1-erlangb(_0x3ed203,_0x44956d));}return _0x1a35e2({'erlangCalls':_0x4d6f72,'erlangCallToSecond':_0x2118ce/_0x4d6f72,'erlangAbandonmentRate':_0x4d9f42,'erlangBusyFactor':_0x49435f});});};module[_0x9909('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index a987915..9d8fae1 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 _0xbcfd=['milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment'];(function(_0x482c4a,_0x3e230c){var _0x4c0ebe=function(_0x2521e9){while(--_0x2521e9){_0x482c4a['push'](_0x482c4a['shift']());}};_0x4c0ebe(++_0x3e230c);}(_0xbcfd,0x1d7));var _0xdbcf=function(_0x21cbd7,_0xa5112a){_0x21cbd7=_0x21cbd7-0x0;var _0x11ae9e=_0xbcfd[_0x21cbd7];return _0x11ae9e;};'use strict';var util=require('util');var _=require(_0xdbcf('0x0'));var moment=require(_0xdbcf('0x1'));function getSeconds(_0x349a4c,_0x222a42){var _0x2f4a7b=moment(_0x349a4c)[_0xdbcf('0x2')](0x0);var _0x169e1c=moment(_0x222a42)['milliseconds'](0x0);return _0x2f4a7b[_0xdbcf('0x3')](_0x169e1c,_0xdbcf('0x4'));}function QueueCallerAbandon(_0x4cc37a,_0x5d7066){this[_0xdbcf('0x5')]=_0x4cc37a[_0xdbcf('0x5')];this[_0xdbcf('0x6')]=_0x4cc37a[_0xdbcf('0x6')];this[_0xdbcf('0x7')]=_0x4cc37a[_0xdbcf('0x6')]===_0xdbcf('0x8')?_0xdbcf('0x9'):_0x4cc37a[_0xdbcf('0x6')];this[_0xdbcf('0xa')]=_0x4cc37a[_0xdbcf('0xa')];this[_0xdbcf('0xb')]=_0x4cc37a['countcongestionretry'];this[_0xdbcf('0xc')]=_0x4cc37a[_0xdbcf('0xc')];this['countglobal']=_0x4cc37a[_0xdbcf('0xa')]+_0x4cc37a['countcongestionretry']+_0x4cc37a[_0xdbcf('0xc')]+_0x4cc37a[_0xdbcf('0xd')]+_0x4cc37a[_0xdbcf('0xe')]+_0x4cc37a['countabandonedretry']+_0x4cc37a[_0xdbcf('0xf')]+_0x4cc37a[_0xdbcf('0x10')];this[_0xdbcf('0xd')]=_0x4cc37a[_0xdbcf('0xd')];this['countdropretry']=_0x4cc37a[_0xdbcf('0xe')];this['countabandonedretry']=_0x4cc37a[_0xdbcf('0x11')];this[_0xdbcf('0xf')]=_0x4cc37a[_0xdbcf('0xf')];this[_0xdbcf('0x10')]=_0x4cc37a['countagentrejectretry'];this[_0xdbcf('0x12')]=_0x5d7066['uniqueid'];this[_0xdbcf('0x13')]=_0x4cc37a[_0xdbcf('0x14')];this[_0xdbcf('0x15')]=_0x4cc37a[_0xdbcf('0x16')];this[_0xdbcf('0x17')]=_0x4cc37a[_0xdbcf('0x17')];this[_0xdbcf('0x18')]=_0x4cc37a[_0xdbcf('0x18')];this[_0xdbcf('0x19')]=_0x4cc37a[_0xdbcf('0x19')];this[_0xdbcf('0x1a')]=this['droptime'];this[_0xdbcf('0x1b')]=getSeconds(_0x4cc37a[_0xdbcf('0x18')],_0x4cc37a[_0xdbcf('0x17')]);this[_0xdbcf('0x1c')]=getSeconds(this[_0xdbcf('0x19')],_0x4cc37a[_0xdbcf('0x18')]);this[_0xdbcf('0x1d')]=0x0;this[_0xdbcf('0x9')]=_0x5d7066['queue'];this[_0xdbcf('0x1e')]=_0x5d7066[_0xdbcf('0x1f')];this[_0xdbcf('0x20')]=_0x5d7066['reason'];this[_0xdbcf('0x21')]=_0x4cc37a[_0xdbcf('0x21')];this[_0xdbcf('0x22')]=_0x4cc37a['callbackuniqueid'];this['callbackat']=_0x4cc37a[_0xdbcf('0x23')];this[_0xdbcf('0x24')]=_0x4cc37a[_0xdbcf('0x24')];this[_0xdbcf('0x25')]=_0x4cc37a[_0xdbcf('0x25')];this[_0xdbcf('0x26')]=_0x4cc37a[_0xdbcf('0x26')];this[_0xdbcf('0x27')]=_0x4cc37a[_0xdbcf('0x27')];this['VoiceQueueId']=_0x4cc37a['VoiceQueueId'];this[_0xdbcf('0x28')]=_0x4cc37a[_0xdbcf('0x28')];this[_0xdbcf('0x29')]=_0x4cc37a['originatecalleridnum']||'';this[_0xdbcf('0x2a')]=_0x4cc37a[_0xdbcf('0x2a')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xb2da=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0xb2da,0x111));var _0xab2d=function(_0x371082,_0x42cd1f){_0x371082=_0x371082-0x0;var _0x490c0c=_0xb2da[_0x371082];return _0x490c0c;};'use strict';var util=require('util');var _=require(_0xab2d('0x0'));var moment=require(_0xab2d('0x1'));function getSeconds(_0x134926,_0x308869){var _0x2f608d=moment(_0x134926)['milliseconds'](0x0);var _0x4ee87f=moment(_0x308869)[_0xab2d('0x2')](0x0);return _0x2f608d['diff'](_0x4ee87f,_0xab2d('0x3'));}function QueueCallerAbandon(_0x34b5c2,_0x4d4c10){this['scheduledat']=_0x34b5c2[_0xab2d('0x4')];this[_0xab2d('0x5')]=_0x34b5c2[_0xab2d('0x5')];this[_0xab2d('0x6')]=_0x34b5c2[_0xab2d('0x5')]===_0xab2d('0x7')?'queue':_0x34b5c2[_0xab2d('0x5')];this[_0xab2d('0x8')]=_0x34b5c2[_0xab2d('0x8')];this[_0xab2d('0x9')]=_0x34b5c2[_0xab2d('0x9')];this[_0xab2d('0xa')]=_0x34b5c2[_0xab2d('0xa')];this[_0xab2d('0xb')]=_0x34b5c2[_0xab2d('0x8')]+_0x34b5c2[_0xab2d('0x9')]+_0x34b5c2[_0xab2d('0xa')]+_0x34b5c2[_0xab2d('0xc')]+_0x34b5c2[_0xab2d('0xd')]+_0x34b5c2[_0xab2d('0xe')]+_0x34b5c2[_0xab2d('0xf')]+_0x34b5c2[_0xab2d('0x10')];this['countnosuchnumberretry']=_0x34b5c2[_0xab2d('0xc')];this[_0xab2d('0xd')]=_0x34b5c2[_0xab2d('0xd')];this[_0xab2d('0xe')]=_0x34b5c2[_0xab2d('0xe')];this[_0xab2d('0xf')]=_0x34b5c2['countmachineretry'];this[_0xab2d('0x10')]=_0x34b5c2[_0xab2d('0x10')];this[_0xab2d('0x11')]=_0x4d4c10['uniqueid'];this[_0xab2d('0x12')]=_0x34b5c2[_0xab2d('0x13')];this[_0xab2d('0x14')]=_0x34b5c2['number'];this[_0xab2d('0x15')]=_0x34b5c2['starttime'];this[_0xab2d('0x16')]=_0x34b5c2[_0xab2d('0x16')];this[_0xab2d('0x17')]=_0x34b5c2[_0xab2d('0x17')];this[_0xab2d('0x18')]=this[_0xab2d('0x17')];this['ringtime']=getSeconds(_0x34b5c2['responsetime'],_0x34b5c2['starttime']);this['holdtime']=getSeconds(this[_0xab2d('0x17')],_0x34b5c2[_0xab2d('0x16')]);this['talktime']=0x0;this[_0xab2d('0x19')]=_0x4d4c10[_0xab2d('0x19')];this[_0xab2d('0x1a')]=_0x4d4c10[_0xab2d('0x1b')];this[_0xab2d('0x1c')]=_0x4d4c10[_0xab2d('0x1c')];this[_0xab2d('0x1d')]=_0x34b5c2[_0xab2d('0x1d')];this['callbackuniqueid']=_0x34b5c2[_0xab2d('0x1e')];this[_0xab2d('0x1f')]=_0x34b5c2[_0xab2d('0x1f')];this[_0xab2d('0x20')]=_0x34b5c2[_0xab2d('0x20')];this[_0xab2d('0x21')]=_0x34b5c2[_0xab2d('0x21')];this['ListId']=_0x34b5c2['ListId'];this[_0xab2d('0x22')]=_0x34b5c2[_0xab2d('0x22')];this[_0xab2d('0x23')]=_0x34b5c2[_0xab2d('0x23')];this[_0xab2d('0x24')]=_0x34b5c2[_0xab2d('0x24')];this[_0xab2d('0x25')]=_0x34b5c2[_0xab2d('0x25')]||'';this['originatecalleridname']=_0x34b5c2[_0xab2d('0x26')]||'';}module[_0xab2d('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 0992873..6395314 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(_0x3bd80d,_0x28c696){var _0x335708=function(_0x2b1d10){while(--_0x2b1d10){_0x3bd80d['push'](_0x3bd80d['shift']());}};_0x335708(++_0x28c696);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x335a4b,_0x1b8f1f){var _0x4d5319=function(_0xd91544){while(--_0xd91544){_0x335a4b['push'](_0x335a4b['shift']());}};_0x4d5319(++_0x1b8f1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 b234875..f769b3e 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 _0x979d=['unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','exports','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable'];(function(_0x579f88,_0xb8632d){var _0xcff854=function(_0x5ed35e){while(--_0x5ed35e){_0x579f88['push'](_0x579f88['shift']());}};_0xcff854(++_0xb8632d);}(_0x979d,0x7c));var _0xd979=function(_0x312b36,_0x316032){_0x312b36=_0x312b36-0x0;var _0x46beea=_0x979d[_0x312b36];return _0x46beea;};'use strict';var util=require('util');var _=require(_0xd979('0x0'));var BPromise=require(_0xd979('0x1'));var uuid=require(_0xd979('0x2'));var moment=require(_0xd979('0x3'));var path=require(_0xd979('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xd979('0x5'));var logger=require(_0xd979('0x6'))(_0xd979('0x7'));var ami=require(_0xd979('0x8'));var rpcDb=require(_0xd979('0x9'));var Channel=require(_0xd979('0xa'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd979('0xb'));var faxMessage=require(_0xd979('0xc'));function Fax(_0x5bcfb7){this[_0xd979('0xd')]={};this[_0xd979('0xe')]=_0x5bcfb7[_0xd979('0xe')];this[_0xd979('0xf')]=_0x5bcfb7['trunks'];this['actions']={};ami['on'](_0xd979('0x10'),this['syncNewchannel'][_0xd979('0x11')](this));ami['on'](_0xd979('0x12'),this[_0xd979('0x13')][_0xd979('0x11')](this));ami['on']('newstate',this[_0xd979('0x14')]['bind'](this));ami['on'](_0xd979('0x15'),this[_0xd979('0x16')][_0xd979('0x11')](this));ami['on'](_0xd979('0x17'),this['syncFaxStatus']['bind'](this));ami['on'](_0xd979('0x18'),this[_0xd979('0x19')][_0xd979('0x11')](this));ami['on'](_0xd979('0x1a'),this[_0xd979('0x1b')]['bind'](this));ami['on'](_0xd979('0x1c'),this[_0xd979('0x1d')][_0xd979('0x11')](this));}Fax['prototype'][_0xd979('0x1e')]=function(_0x21cdf2){if(_0x21cdf2[_0xd979('0x1f')]==='from-voip-provider'){for(var _0x3a3256 in this[_0xd979('0xe')]){if(this[_0xd979('0xe')][_0xd979('0x20')](_0x3a3256)){if(_0x21cdf2[_0xd979('0x21')]===this[_0xd979('0xe')][_0x3a3256]['localstationid']){this['channels'][_0x21cdf2[_0xd979('0x22')]]={};this[_0xd979('0xd')][_0x21cdf2[_0xd979('0x22')]][_0xd979('0x23')]=_0x21cdf2[_0xd979('0x23')];this[_0xd979('0xd')][_0x21cdf2['uniqueid']]['id']=this['faxAccounts'][_0x3a3256]['id'];this[_0xd979('0xd')][_0x21cdf2[_0xd979('0x22')]][_0xd979('0x24')]=this[_0xd979('0xe')][_0x3a3256][_0xd979('0x24')];logger[_0xd979('0x25')](_0x21cdf2[_0xd979('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0xd979('0x26')][_0x21cdf2['uniqueid']]){this[_0xd979('0xd')][_0x21cdf2[_0xd979('0x22')]]={};this['channels'][_0x21cdf2[_0xd979('0x22')]][_0xd979('0x23')]=_0x21cdf2[_0xd979('0x23')];logger[_0xd979('0x25')](_0x21cdf2['uniqueid'],_0xd979('0x27'));}};Fax[_0xd979('0x28')]['syncVarSet']=function(_0x2453a5){if(this[_0xd979('0xd')][_0x2453a5[_0xd979('0x22')]]){for(var _0x1cbf38 in _0x2453a5[_0xd979('0x29')]){if(_0x2453a5[_0xd979('0x29')]['hasOwnProperty'](_0x1cbf38)){this[_0xd979('0xd')][_0x2453a5['uniqueid']][_0x1cbf38]=_0x2453a5['value'];}}}};Fax['prototype'][_0xd979('0x14')]=function(_0x12af95){if(this[_0xd979('0xd')][_0x12af95['uniqueid']]){this[_0xd979('0xd')][_0x12af95['uniqueid']][_0xd979('0x2a')]=_0x12af95[_0xd979('0x2a')];this[_0xd979('0xd')][_0x12af95[_0xd979('0x22')]][_0xd979('0x2b')]=_0x12af95['channelstatedesc'];}};Fax['prototype'][_0xd979('0x16')]=function(_0x22fac7){if(this['channels'][_0x22fac7[_0xd979('0x22')]]){for(var _0x2bd6bf in _0x22fac7[_0xd979('0x29')]){if(_0x22fac7[_0xd979('0x29')][_0xd979('0x20')](_0x2bd6bf)){this[_0xd979('0xd')][_0x22fac7[_0xd979('0x22')]][_0x2bd6bf]=_0x22fac7[_0xd979('0x2c')];}}}};Fax[_0xd979('0x28')]['syncFaxStatus']=function(_0x6575d9){if(this[_0xd979('0xd')][_0x6575d9['uniqueid']]){this[_0xd979('0xd')][_0x6575d9[_0xd979('0x22')]][_0xd979('0x2d')]=_0x6575d9['operation'];this[_0xd979('0xd')][_0x6575d9['uniqueid']][_0xd979('0x2e')]=_0x6575d9['status'];this[_0xd979('0xd')][_0x6575d9[_0xd979('0x22')]]['localstationid']=_0x6575d9[_0xd979('0x2f')];this[_0xd979('0xd')][_0x6575d9[_0xd979('0x22')]]['filename']=_0x6575d9[_0xd979('0x30')];logger[_0xd979('0x25')](_0x6575d9[_0xd979('0x22')],_0xd979('0x31'));}};Fax[_0xd979('0x28')][_0xd979('0x19')]=function(_0x5897a7){var _0x50cc06=this;if(this[_0xd979('0xd')][_0x5897a7['uniqueid']]){var _0x1c9f3b=this['channels'][_0x5897a7[_0xd979('0x22')]]['id'];this[_0xd979('0xd')][_0x5897a7[_0xd979('0x22')]][_0xd979('0x32')]=_0x5897a7[_0xd979('0x32')];this[_0xd979('0xd')][_0x5897a7[_0xd979('0x22')]][_0xd979('0x33')]=_0x5897a7[_0xd979('0x33')];this[_0xd979('0xd')][_0x5897a7[_0xd979('0x22')]][_0xd979('0x2f')]=_0x5897a7[_0xd979('0x2f')];this[_0xd979('0xd')][_0x5897a7['uniqueid']][_0xd979('0x34')]=_0x5897a7['resolution'];this['channels'][_0x5897a7[_0xd979('0x22')]]['transferrate']=_0x5897a7[_0xd979('0x35')];this['channels'][_0x5897a7[_0xd979('0x22')]][_0xd979('0x30')]=_0x5897a7[_0xd979('0x30')];this[_0xd979('0xd')][_0x5897a7['uniqueid']][_0xd979('0x36')]=_0x5897a7['calleridnum'];if(this['channels'][_0x5897a7[_0xd979('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x5897a7[_0xd979('0x30')],_0xd979('0x37'),function(_0x2bcf8d){logger[_0xd979('0x25')](_0x5897a7['uniqueid'],_0xd979('0x38'),_0x2bcf8d[_0xd979('0x39')]);attachment[_0xd979('0x3a')]({'name':path[_0xd979('0x3b')](_0x5897a7[_0xd979('0x30')])[_0xd979('0x24')],'basename':path[_0xd979('0x3b')](_0x5897a7[_0xd979('0x30')])[_0xd979('0x24')]+_0xd979('0x3c'),'type':_0xd979('0x3d')})[_0xd979('0x3e')](function(_0x12ca31){faxAccount['notify'](_0x1c9f3b,{'from':_0x5897a7[_0xd979('0x36')],'mapKey':_0xd979('0x7'),'body':path[_0xd979('0x3b')](_0x5897a7[_0xd979('0x30')])[_0xd979('0x24')]+_0xd979('0x3c'),'AttachmentId':_0x12ca31['id']})['catch'](function(_0x44a715){logger[_0xd979('0x3f')](_0x5897a7['uniqueid'],_0xd979('0x40'),JSON[_0xd979('0x41')](_0x44a715));});})[_0xd979('0x42')](function(_0x469b8d){logger[_0xd979('0x3f')](_0x5897a7[_0xd979('0x22')],_0xd979('0x43'),JSON[_0xd979('0x41')](_0x469b8d));});});}logger[_0xd979('0x25')](_0x5897a7[_0xd979('0x22')],'\x20receiveFax\x20');}};Fax[_0xd979('0x28')][_0xd979('0x1d')]=function(_0x52038f){if(this[_0xd979('0x26')][_0x52038f[_0xd979('0x22')]]){_[_0xd979('0x44')](this[_0xd979('0xd')][_0x52038f[_0xd979('0x22')]],_[_0xd979('0x45')](_0x52038f,[_0xd979('0x46'),_0xd979('0x47')]));}};function updateStatus(_0x5becca){if(_0x5becca['AttachmentId']){faxMessage['update'](_0x5becca[_0xd979('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd979('0x3e')](function(_0x26b0cc){ut[_0xd979('0x49')]('[Fax][Message][Error][Updated]',_0x26b0cc);})['catch'](function(_0x3f5eff){ut[_0xd979('0x49')](_0xd979('0x4a'),_0x3f5eff);});}else{ut[_0xd979('0x49')](_0xd979('0x4b'));}}Fax[_0xd979('0x28')][_0xd979('0x4c')]=function(_0x23bbc8,_0x55bcab,_0x9dff32){var _0x42823d=this;var _0x2d2630={};if(_0x55bcab){_0x2d2630={'read':_0x55bcab};}else{_0x2d2630={'failMessage':_0x9dff32};}if(this[_0xd979('0x26')][_0x23bbc8][_0xd979('0x48')]){faxMessage[_0xd979('0x4d')](this['actions'][_0x23bbc8][_0xd979('0x48')],_0x2d2630)[_0xd979('0x3e')](function(_0xa17cab){ut[_0xd979('0x49')](_0xd979('0x4e'),_0xa17cab);})['catch'](function(_0x465695){ut['logger']('[Fax][Message][NoUpdate1]',_0x465695);})['finally'](function(){delete _0x42823d[_0xd979('0xd')][_0x23bbc8];delete _0x42823d[_0xd979('0x26')][_0x23bbc8];});}else{ut[_0xd979('0x49')](_0xd979('0x4f'));delete this['channels'][_0x23bbc8];delete this['actions'][_0x23bbc8];}};Fax['prototype'][_0xd979('0x1b')]=function(_0x454c03){var _0x15490e=this;if(this[_0xd979('0xd')][_0x454c03[_0xd979('0x22')]]){if(this['actions'][_0x454c03['uniqueid']]){this[_0xd979('0xd')][_0x454c03[_0xd979('0x22')]]['id']=this[_0xd979('0x26')][_0x454c03[_0xd979('0x22')]]['id'];this[_0xd979('0xd')][_0x454c03[_0xd979('0x22')]][_0xd979('0x24')]=this[_0xd979('0x26')][_0x454c03[_0xd979('0x22')]][_0xd979('0x24')];}logger[_0xd979('0x25')](_0x454c03[_0xd979('0x22')],this['actions'][_0x454c03[_0xd979('0x22')]]?_0xd979('0x50'):_0xd979('0x51'),JSON[_0xd979('0x41')](this['channels'][_0x454c03['uniqueid']]));if(this[_0xd979('0x26')][_0x454c03[_0xd979('0x22')]]){if(this['channels'][_0x454c03[_0xd979('0x22')]][_0xd979('0x52')]>0x0&&this['channels'][_0x454c03['uniqueid']][_0xd979('0x17')]===_0xd979('0x53')){this[_0xd979('0x4c')](_0x454c03['uniqueid'],!![]);}else{this['updateStatus'](_0x454c03[_0xd979('0x22')],![],this['channels'][_0x454c03[_0xd979('0x22')]][_0xd979('0x54')]?_0xd979('0x55')+this[_0xd979('0xd')][_0x454c03['uniqueid']]['faxstatusstring']:_0xd979('0x56'));}}}};Fax[_0xd979('0x28')][_0xd979('0x57')]=function(_0x1efa0e){var _0x42bbd1=this;return new BPromise(function(_0x48b3da,_0x32aa18){_0x42bbd1[_0xd979('0x58')](_0x1efa0e,_0x42bbd1[_0xd979('0xe')][_0x1efa0e[_0xd979('0x59')]])[_0xd979('0x3e')](function(_0x5ea6f2){ut[_0xd979('0x49')](_0xd979('0x5a'),_0x5ea6f2);_0x48b3da(ut[_0xd979('0x39')](_0xd979('0x5b')));})[_0xd979('0x42')](function(_0x5847ee){ut[_0xd979('0x49')](_0xd979('0x5c'),_0x5847ee);updateStatus(_0x1efa0e);_0x32aa18(ut[_0xd979('0x39')](_0xd979('0x5d')));});});};Fax[_0xd979('0x28')][_0xd979('0x5e')]=function(_0x1b3d44){var _0x215d8b=this;return new BPromise(function(_0x15ebe3,_0x4ec2cd){var _0xebe00d=_0x215d8b['checkTrunk'](_0x215d8b['faxAccounts'][_0x1b3d44[_0xd979('0x59')]][_0xd979('0x5f')],_0x1b3d44);if(_0xebe00d[_0xd979('0x60')]){_0x15ebe3(ut[_0xd979('0x39')]('Trunk\x20Reachable'));}else{_0x4ec2cd(ut[_0xd979('0x39')](_0xebe00d[_0xd979('0x39')]));}});};function originate(_0x28bf4c,_0x5ec47e,_0x23962c){return new BPromise(function(_0x53e706,_0x424c07){if(_0x23962c){var _0x339f53=util[_0xd979('0x61')](_0xd979('0x62'),path['parse'](_0x28bf4c[_0xd979('0x4')])[_0xd979('0x24')],_0x28bf4c[_0xd979('0x4')]);gs['execute'](_0x339f53)[_0xd979('0x3e')](function(){_0x28bf4c[_0xd979('0x4')]=util['format']('%s/%s.tif',path['parse'](_0x28bf4c[_0xd979('0x4')])[_0xd979('0x63')],path[_0xd979('0x3b')](_0x28bf4c[_0xd979('0x4')])[_0xd979('0x24')]);_0x5ec47e[_0xd979('0x64')]=_0x28bf4c['path'];ut[_0xd979('0x49')](_0xd979('0x65'),'');ami[_0xd979('0x66')](ut[_0xd979('0x67')](_0x28bf4c,_0x5ec47e))[_0xd979('0x3e')](function(_0x2d7b96){_0x53e706(_0x2d7b96);})[_0xd979('0x42')](function(_0x40b778){_0x424c07(_0x40b778);});})[_0xd979('0x42')](function(_0x33bd8e){_0x424c07(_0x33bd8e);});}else{ami[_0xd979('0x66')](ut[_0xd979('0x67')](_0x28bf4c,_0x5ec47e))['then'](function(_0x2abcd8){_0x53e706(_0x2abcd8);})[_0xd979('0x42')](function(_0x59c485){_0x424c07(_0x59c485);});}});}Fax[_0xd979('0x28')]['execOriginate']=function(_0x178afd,_0x4c073a){var _0x159615=this;return new BPromise(function(_0x5c8224,_0xd1bd22){var _0x1e2c3d=uuid['v4']();var _0x42ed75=ut['addVariables'](_0x178afd,_0x4c073a);_0x159615[_0xd979('0x26')][_0x1e2c3d]=new Action(_0x1e2c3d,_0x4c073a,_0x178afd);var _0x36beea=_0x159615[_0xd979('0x26')][_0x1e2c3d];if(path['parse'](_0x178afd[_0xd979('0x4')])[_0xd979('0x68')]==='.pdf'){originate(_0x36beea,_0x42ed75,!![])[_0xd979('0x3e')](function(_0xbc1ab5){_0x5c8224(_0xbc1ab5);})[_0xd979('0x42')](function(_0x4bc59d){_0xd1bd22(_0x4bc59d);});}else{originate(_0x36beea,_0x42ed75,![])['then'](function(_0x2d0144){_0x5c8224(_0x2d0144);})['catch'](function(_0x5c5eb5){_0xd1bd22(_0x5c5eb5);});}});};Fax[_0xd979('0x28')][_0xd979('0x69')]=function(_0x1a0873){return!_[_0xd979('0x6a')](_0x1a0873)&&!_[_0xd979('0x6a')](_0x1a0873[_0xd979('0x24')])&&!_[_0xd979('0x6a')](_0x1a0873[_0xd979('0x6b')])&&_0x1a0873['active']&&!_['isNil'](this[_0xd979('0xf')][util[_0xd979('0x61')](_0xd979('0x6c'),_0x1a0873['name'])])&&!_['isNil'](this[_0xd979('0xf')][util[_0xd979('0x61')](_0xd979('0x6c'),_0x1a0873[_0xd979('0x24')])][_0xd979('0x2e')])&&(this[_0xd979('0xf')][util[_0xd979('0x61')](_0xd979('0x6c'),_0x1a0873[_0xd979('0x24')])][_0xd979('0x2e')]===_0xd979('0x6d')||this[_0xd979('0xf')][util[_0xd979('0x61')](_0xd979('0x6c'),_0x1a0873[_0xd979('0x24')])][_0xd979('0x2e')]===_0xd979('0x6e'));};Fax[_0xd979('0x28')][_0xd979('0x6f')]=function(_0x44ed0a,_0x4c43a4){if(!this[_0xd979('0x69')](_0x44ed0a)){ut[_0xd979('0x49')](_0xd979('0x70'),_['isNil'](_0x44ed0a)?'':_0x44ed0a[_0xd979('0x24')]+_0xd979('0x71'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xd979('0x6a')](_0x4c43a4['fax'])){ut['logger'](_0xd979('0x72'),JSON[_0xd979('0x41')](_0x4c43a4));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xd979('0x6a')](_0x4c43a4['path'])){ut[_0xd979('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xd979('0x41')](_0x4c43a4));return{'isValid':![],'message':_0xd979('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xd979('0x74')]=Fax; \ No newline at end of file +var _0xf0ac=['\x20syncFaxStatus\x20','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','name','parse','.pdf','application/pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','then','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xf0ac,0x1a5));var _0xcf0a=function(_0x57216e,_0x7a2a7d){_0x57216e=_0x57216e-0x0;var _0x456e6f=_0xf0ac[_0x57216e];return _0x456e6f;};'use strict';var util=require(_0xcf0a('0x0'));var _=require(_0xcf0a('0x1'));var BPromise=require('bluebird');var uuid=require(_0xcf0a('0x2'));var moment=require(_0xcf0a('0x3'));var path=require(_0xcf0a('0x4'));var tiff2pdf=require(_0xcf0a('0x5'));var gs=require(_0xcf0a('0x6'));var logger=require(_0xcf0a('0x7'))(_0xcf0a('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xcf0a('0x9'));var ut=require(_0xcf0a('0xa'));var Action=require(_0xcf0a('0xb'));var faxAccount=require(_0xcf0a('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x9d6313){this[_0xcf0a('0xd')]={};this[_0xcf0a('0xe')]=_0x9d6313[_0xcf0a('0xe')];this[_0xcf0a('0xf')]=_0x9d6313[_0xcf0a('0xf')];this[_0xcf0a('0x10')]={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0xcf0a('0x11'),this[_0xcf0a('0x12')][_0xcf0a('0x13')](this));ami['on'](_0xcf0a('0x14'),this[_0xcf0a('0x15')]['bind'](this));ami['on'](_0xcf0a('0x16'),this[_0xcf0a('0x17')][_0xcf0a('0x13')](this));ami['on'](_0xcf0a('0x18'),this[_0xcf0a('0x19')][_0xcf0a('0x13')](this));ami['on'](_0xcf0a('0x1a'),this[_0xcf0a('0x1b')][_0xcf0a('0x13')](this));ami['on'](_0xcf0a('0x1c'),this['syncHangup'][_0xcf0a('0x13')](this));ami['on']('originateresponse',this[_0xcf0a('0x1d')][_0xcf0a('0x13')](this));}Fax[_0xcf0a('0x1e')][_0xcf0a('0x1f')]=function(_0x1b55d8){if(_0x1b55d8[_0xcf0a('0x20')]===_0xcf0a('0x21')){for(var _0x1480a9 in this[_0xcf0a('0xe')]){if(this[_0xcf0a('0xe')][_0xcf0a('0x22')](_0x1480a9)){if(_0x1b55d8['exten']===this[_0xcf0a('0xe')][_0x1480a9][_0xcf0a('0x23')]){this[_0xcf0a('0xd')][_0x1b55d8[_0xcf0a('0x24')]]={};this[_0xcf0a('0xd')][_0x1b55d8['uniqueid']]['channel']=_0x1b55d8[_0xcf0a('0x25')];this[_0xcf0a('0xd')][_0x1b55d8[_0xcf0a('0x24')]]['id']=this[_0xcf0a('0xe')][_0x1480a9]['id'];this['channels'][_0x1b55d8[_0xcf0a('0x24')]]['name']=this[_0xcf0a('0xe')][_0x1480a9]['name'];logger[_0xcf0a('0x26')](_0x1b55d8[_0xcf0a('0x24')],_0xcf0a('0x27'));}}}}if(this['actions'][_0x1b55d8[_0xcf0a('0x24')]]){this[_0xcf0a('0xd')][_0x1b55d8[_0xcf0a('0x24')]]={};this[_0xcf0a('0xd')][_0x1b55d8['uniqueid']]['channel']=_0x1b55d8[_0xcf0a('0x25')];logger[_0xcf0a('0x26')](_0x1b55d8[_0xcf0a('0x24')],_0xcf0a('0x27'));}};Fax['prototype'][_0xcf0a('0x12')]=function(_0x1113ac){if(this['channels'][_0x1113ac[_0xcf0a('0x24')]]){for(var _0x24b9b2 in _0x1113ac[_0xcf0a('0x28')]){if(_0x1113ac['variable'][_0xcf0a('0x22')](_0x24b9b2)){this[_0xcf0a('0xd')][_0x1113ac[_0xcf0a('0x24')]][_0x24b9b2]=_0x1113ac[_0xcf0a('0x29')];}}}};Fax[_0xcf0a('0x1e')][_0xcf0a('0x15')]=function(_0x14a6ee){if(this[_0xcf0a('0xd')][_0x14a6ee[_0xcf0a('0x24')]]){this['channels'][_0x14a6ee[_0xcf0a('0x24')]][_0xcf0a('0x2a')]=_0x14a6ee[_0xcf0a('0x2a')];this[_0xcf0a('0xd')][_0x14a6ee['uniqueid']][_0xcf0a('0x2b')]=_0x14a6ee[_0xcf0a('0x2b')];}};Fax[_0xcf0a('0x1e')][_0xcf0a('0x17')]=function(_0x3c5b05){if(this['channels'][_0x3c5b05[_0xcf0a('0x24')]]){for(var _0x2d5365 in _0x3c5b05[_0xcf0a('0x28')]){if(_0x3c5b05[_0xcf0a('0x28')]['hasOwnProperty'](_0x2d5365)){this[_0xcf0a('0xd')][_0x3c5b05['uniqueid']][_0x2d5365]=_0x3c5b05[_0xcf0a('0x29')];}}}};Fax[_0xcf0a('0x1e')][_0xcf0a('0x19')]=function(_0x564081){if(this[_0xcf0a('0xd')][_0x564081[_0xcf0a('0x24')]]){this[_0xcf0a('0xd')][_0x564081[_0xcf0a('0x24')]][_0xcf0a('0x2c')]=_0x564081[_0xcf0a('0x2c')];this[_0xcf0a('0xd')][_0x564081[_0xcf0a('0x24')]][_0xcf0a('0x2d')]=_0x564081[_0xcf0a('0x2d')];this['channels'][_0x564081[_0xcf0a('0x24')]][_0xcf0a('0x23')]=_0x564081['localstationid'];this[_0xcf0a('0xd')][_0x564081['uniqueid']][_0xcf0a('0x2e')]=_0x564081[_0xcf0a('0x2e')];logger['info'](_0x564081[_0xcf0a('0x24')],_0xcf0a('0x2f'));}};Fax[_0xcf0a('0x1e')][_0xcf0a('0x1b')]=function(_0xbbf125){var _0x39eed6=this;if(this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]]){var _0x3a785c=this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]]['id'];this[_0xcf0a('0xd')][_0xbbf125['uniqueid']]['remotestationid']=_0xbbf125['remotestationid'];this['channels'][_0xbbf125[_0xcf0a('0x24')]][_0xcf0a('0x30')]=_0xbbf125['pagestransferred'];this['channels'][_0xbbf125[_0xcf0a('0x24')]][_0xcf0a('0x23')]=_0xbbf125[_0xcf0a('0x23')];this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]][_0xcf0a('0x31')]=_0xbbf125[_0xcf0a('0x31')];this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]]['transferrate']=_0xbbf125['transferrate'];this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]][_0xcf0a('0x2e')]=_0xbbf125[_0xcf0a('0x2e')];this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]][_0xcf0a('0x32')]=_0xbbf125[_0xcf0a('0x32')];if(this[_0xcf0a('0xd')][_0xbbf125[_0xcf0a('0x24')]][_0xcf0a('0x30')]>0x0){tiff2pdf(_0xbbf125[_0xcf0a('0x2e')],_0xcf0a('0x33'),function(_0x5a9e3a){logger[_0xcf0a('0x26')](_0xbbf125['uniqueid'],_0xcf0a('0x34'),_0x5a9e3a[_0xcf0a('0x35')]);attachment[_0xcf0a('0x36')]({'name':path['parse'](_0xbbf125[_0xcf0a('0x2e')])[_0xcf0a('0x37')],'basename':path[_0xcf0a('0x38')](_0xbbf125[_0xcf0a('0x2e')])[_0xcf0a('0x37')]+_0xcf0a('0x39'),'type':_0xcf0a('0x3a')})['then'](function(_0x33bcb1){faxAccount['notify'](_0x3a785c,{'from':_0xbbf125[_0xcf0a('0x32')],'mapKey':_0xcf0a('0x8'),'body':path[_0xcf0a('0x38')](_0xbbf125['filename'])[_0xcf0a('0x37')]+_0xcf0a('0x39'),'AttachmentId':_0x33bcb1['id']})[_0xcf0a('0x3b')](function(_0x16af04){logger[_0xcf0a('0x3c')](_0xbbf125['uniqueid'],_0xcf0a('0x3d'),JSON[_0xcf0a('0x3e')](_0x16af04));});})['catch'](function(_0x154f2d){logger[_0xcf0a('0x3c')](_0xbbf125[_0xcf0a('0x24')],_0xcf0a('0x3f'),JSON[_0xcf0a('0x3e')](_0x154f2d));});});}logger[_0xcf0a('0x26')](_0xbbf125['uniqueid'],_0xcf0a('0x3f'));}};Fax['prototype'][_0xcf0a('0x1d')]=function(_0x2127de){if(this['actions'][_0x2127de[_0xcf0a('0x24')]]){_[_0xcf0a('0x40')](this['channels'][_0x2127de[_0xcf0a('0x24')]],_[_0xcf0a('0x41')](_0x2127de,[_0xcf0a('0x42'),_0xcf0a('0x43')]));}};function updateStatus(_0x5a0fc1){if(_0x5a0fc1[_0xcf0a('0x44')]){faxMessage[_0xcf0a('0x45')](_0x5a0fc1[_0xcf0a('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x27adfe){ut['logger'](_0xcf0a('0x46'),_0x27adfe);})[_0xcf0a('0x3b')](function(_0x366c2e){ut[_0xcf0a('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x366c2e);});}else{ut[_0xcf0a('0x47')](_0xcf0a('0x48'));}}Fax[_0xcf0a('0x1e')][_0xcf0a('0x49')]=function(_0x107ff1,_0x2566c3,_0x40f765){var _0x48c40a=this;var _0x36ee25={};if(_0x2566c3){_0x36ee25={'read':_0x2566c3};}else{_0x36ee25={'failMessage':_0x40f765};}if(this[_0xcf0a('0x10')][_0x107ff1][_0xcf0a('0x44')]){faxMessage[_0xcf0a('0x45')](this[_0xcf0a('0x10')][_0x107ff1][_0xcf0a('0x44')],_0x36ee25)['then'](function(_0x2761d9){ut['logger'](_0xcf0a('0x4a'),_0x2761d9);})[_0xcf0a('0x3b')](function(_0x1aac0b){ut['logger'](_0xcf0a('0x4b'),_0x1aac0b);})['finally'](function(){delete _0x48c40a[_0xcf0a('0xd')][_0x107ff1];delete _0x48c40a['actions'][_0x107ff1];});}else{ut[_0xcf0a('0x47')](_0xcf0a('0x4c'));delete this[_0xcf0a('0xd')][_0x107ff1];delete this[_0xcf0a('0x10')][_0x107ff1];}};Fax['prototype'][_0xcf0a('0x4d')]=function(_0x43b75c){var _0x3b7e05=this;if(this['channels'][_0x43b75c[_0xcf0a('0x24')]]){if(this[_0xcf0a('0x10')][_0x43b75c[_0xcf0a('0x24')]]){this[_0xcf0a('0xd')][_0x43b75c['uniqueid']]['id']=this[_0xcf0a('0x10')][_0x43b75c[_0xcf0a('0x24')]]['id'];this[_0xcf0a('0xd')][_0x43b75c['uniqueid']][_0xcf0a('0x37')]=this[_0xcf0a('0x10')][_0x43b75c['uniqueid']][_0xcf0a('0x37')];}logger['info'](_0x43b75c['uniqueid'],this[_0xcf0a('0x10')][_0x43b75c[_0xcf0a('0x24')]]?_0xcf0a('0x4e'):_0xcf0a('0x4f'),JSON[_0xcf0a('0x3e')](this['channels'][_0x43b75c['uniqueid']]));if(this[_0xcf0a('0x10')][_0x43b75c[_0xcf0a('0x24')]]){if(this['channels'][_0x43b75c[_0xcf0a('0x24')]][_0xcf0a('0x50')]>0x0&&this[_0xcf0a('0xd')][_0x43b75c[_0xcf0a('0x24')]]['faxstatus']===_0xcf0a('0x51')){this['updateStatus'](_0x43b75c[_0xcf0a('0x24')],!![]);}else{this[_0xcf0a('0x49')](_0x43b75c[_0xcf0a('0x24')],![],this[_0xcf0a('0xd')][_0x43b75c[_0xcf0a('0x24')]]['faxstatusstring']?_0xcf0a('0x52')+this[_0xcf0a('0xd')][_0x43b75c[_0xcf0a('0x24')]][_0xcf0a('0x53')]:_0xcf0a('0x54'));}}}};Fax[_0xcf0a('0x1e')]['send']=function(_0x10c0b6){var _0x36ffe5=this;return new BPromise(function(_0x3c8ae7,_0x28234d){_0x36ffe5[_0xcf0a('0x55')](_0x10c0b6,_0x36ffe5[_0xcf0a('0xe')][_0x10c0b6[_0xcf0a('0x56')]])[_0xcf0a('0x57')](function(_0x2992a7){ut['logger'](_0xcf0a('0x58'),_0x2992a7);_0x3c8ae7(ut[_0xcf0a('0x35')](_0xcf0a('0x59')));})[_0xcf0a('0x3b')](function(_0x4ca5ca){ut['logger'](_0xcf0a('0x5a'),_0x4ca5ca);updateStatus(_0x10c0b6);_0x28234d(ut[_0xcf0a('0x35')]('Fax\x20failed'));});});};Fax[_0xcf0a('0x1e')][_0xcf0a('0x5b')]=function(_0x108518){var _0x561b1d=this;return new BPromise(function(_0x591c86,_0x1d619c){var _0x385401=_0x561b1d[_0xcf0a('0x5c')](_0x561b1d['faxAccounts'][_0x108518[_0xcf0a('0x56')]][_0xcf0a('0x5d')],_0x108518);if(_0x385401[_0xcf0a('0x5e')]){_0x591c86(ut[_0xcf0a('0x35')]('Trunk\x20Reachable'));}else{_0x1d619c(ut[_0xcf0a('0x35')](_0x385401[_0xcf0a('0x35')]));}});};function originate(_0x74a481,_0x4a0fce,_0x1c0421){return new BPromise(function(_0xcd1cf1,_0x22ad93){if(_0x1c0421){var _0xc03e57=util[_0xcf0a('0x5f')]('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[_0xcf0a('0x38')](_0x74a481[_0xcf0a('0x4')])[_0xcf0a('0x37')],_0x74a481['path']);gs['execute'](_0xc03e57)[_0xcf0a('0x57')](function(){_0x74a481['path']=util[_0xcf0a('0x5f')](_0xcf0a('0x60'),path[_0xcf0a('0x38')](_0x74a481[_0xcf0a('0x4')])[_0xcf0a('0x61')],path[_0xcf0a('0x38')](_0x74a481[_0xcf0a('0x4')])['name']);_0x4a0fce[_0xcf0a('0x62')]=_0x74a481['path'];ut['logger'](_0xcf0a('0x63'),'');ami[_0xcf0a('0x64')](ut[_0xcf0a('0x65')](_0x74a481,_0x4a0fce))[_0xcf0a('0x57')](function(_0x2e1b5c){_0xcd1cf1(_0x2e1b5c);})[_0xcf0a('0x3b')](function(_0x5426c2){_0x22ad93(_0x5426c2);});})['catch'](function(_0x2c11aa){_0x22ad93(_0x2c11aa);});}else{ami[_0xcf0a('0x64')](ut[_0xcf0a('0x65')](_0x74a481,_0x4a0fce))[_0xcf0a('0x57')](function(_0x2ceb3d){_0xcd1cf1(_0x2ceb3d);})[_0xcf0a('0x3b')](function(_0x3eead5){_0x22ad93(_0x3eead5);});}});}Fax[_0xcf0a('0x1e')][_0xcf0a('0x55')]=function(_0x1f15b0,_0x41dd69){var _0x91e844=this;return new BPromise(function(_0x2b7f0a,_0x4efa91){var _0x4de36c=uuid['v4']();var _0x5d6820=ut[_0xcf0a('0x66')](_0x1f15b0,_0x41dd69);_0x91e844[_0xcf0a('0x10')][_0x4de36c]=new Action(_0x4de36c,_0x41dd69,_0x1f15b0);var _0xf4af45=_0x91e844['actions'][_0x4de36c];if(path['parse'](_0x1f15b0[_0xcf0a('0x4')])[_0xcf0a('0x67')]==='.pdf'){originate(_0xf4af45,_0x5d6820,!![])[_0xcf0a('0x57')](function(_0x449499){_0x2b7f0a(_0x449499);})[_0xcf0a('0x3b')](function(_0x1bcb22){_0x4efa91(_0x1bcb22);});}else{originate(_0xf4af45,_0x5d6820,![])[_0xcf0a('0x57')](function(_0x39a56f){_0x2b7f0a(_0x39a56f);})[_0xcf0a('0x3b')](function(_0x3bb8f8){_0x4efa91(_0x3bb8f8);});}});};Fax[_0xcf0a('0x1e')][_0xcf0a('0x68')]=function(_0x131b86){return!_[_0xcf0a('0x69')](_0x131b86)&&!_[_0xcf0a('0x69')](_0x131b86[_0xcf0a('0x37')])&&!_[_0xcf0a('0x69')](_0x131b86['active'])&&_0x131b86[_0xcf0a('0x6a')]&&!_['isNil'](this[_0xcf0a('0xf')][util[_0xcf0a('0x5f')](_0xcf0a('0x6b'),_0x131b86[_0xcf0a('0x37')])])&&!_[_0xcf0a('0x69')](this[_0xcf0a('0xf')][util[_0xcf0a('0x5f')](_0xcf0a('0x6b'),_0x131b86[_0xcf0a('0x37')])][_0xcf0a('0x2d')])&&(this[_0xcf0a('0xf')][util[_0xcf0a('0x5f')](_0xcf0a('0x6b'),_0x131b86['name'])][_0xcf0a('0x2d')]===_0xcf0a('0x6c')||this['trunks'][util['format']('SIP/%s',_0x131b86[_0xcf0a('0x37')])][_0xcf0a('0x2d')]==='unmonitored');};Fax[_0xcf0a('0x1e')]['checkTrunk']=function(_0x22599d,_0x16b8b8){if(!this['isTrunkReachable'](_0x22599d)){ut['logger'](_0xcf0a('0x6d'),_[_0xcf0a('0x69')](_0x22599d)?'':_0x22599d['name']+_0xcf0a('0x6e'));return{'isValid':![],'message':_0xcf0a('0x6f')};}if(_[_0xcf0a('0x69')](_0x16b8b8['fax'])){ut[_0xcf0a('0x47')](_0xcf0a('0x70'),JSON[_0xcf0a('0x3e')](_0x16b8b8));return{'isValid':![],'message':_0xcf0a('0x71')};}if(_[_0xcf0a('0x69')](_0x16b8b8['path'])){ut[_0xcf0a('0x47')](_0xcf0a('0x72'),JSON[_0xcf0a('0x3e')](_0x16b8b8));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xcf0a('0x73')};};module[_0xcf0a('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 94a5dd7..063f0fb 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 _0x2845=['preview','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger'];(function(_0x457e2a,_0x103519){var _0x4272f9=function(_0x4993e3){while(--_0x4993e3){_0x457e2a['push'](_0x457e2a['shift']());}};_0x4272f9(++_0x103519);}(_0x2845,0xe5));var _0x5284=function(_0x4bec57,_0x16ce41){_0x4bec57=_0x4bec57-0x0;var _0x134585=_0x2845[_0x4bec57];return _0x134585;};'use strict';var util=require(_0x5284('0x0'));var BPromise=require('bluebird');var logger=require(_0x5284('0x1'))(_0x5284('0x2'));var _=require(_0x5284('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x527d49){return function(_0x50aadc){logger[_0x5284('0x4')](_0x527d49,util[_0x5284('0x5')](_0x50aadc,{'showHidden':![],'depth':null}));};}exports[_0x5284('0x6')]=function(_0x3a6c0e,_0x47cc97){return BPromise[_0x5284('0x7')]()[_0x5284('0x8')](faxAccount['notify'](_0x3a6c0e,_0x47cc97))[_0x5284('0x9')](loggerCatch(_0x5284('0xa')));}; \ No newline at end of file +var _0x2e00=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve'];(function(_0x17e383,_0x2953bb){var _0x22725f=function(_0x30fbba){while(--_0x30fbba){_0x17e383['push'](_0x17e383['shift']());}};_0x22725f(++_0x2953bb);}(_0x2e00,0x105));var _0x02e0=function(_0x1cfc39,_0x1d3913){_0x1cfc39=_0x1cfc39-0x0;var _0x957a28=_0x2e00[_0x1cfc39];return _0x957a28;};'use strict';var util=require(_0x02e0('0x0'));var BPromise=require(_0x02e0('0x1'));var logger=require(_0x02e0('0x2'))(_0x02e0('0x3'));var _=require(_0x02e0('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2c5395){return function(_0x4ff6c3){logger[_0x02e0('0x5')](_0x2c5395,util[_0x02e0('0x6')](_0x4ff6c3,{'showHidden':![],'depth':null}));};}exports[_0x02e0('0x7')]=function(_0x1f1ce4,_0x5f00f4){return BPromise[_0x02e0('0x8')]()['then'](faxAccount[_0x02e0('0x7')](_0x1f1ce4,_0x5f00f4))['catch'](loggerCatch(_0x02e0('0x9')));}; \ 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 36e8e94..cd70c51 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 _0x0a0a=['fax','bluebird','child_process','execute','info','Exec\x20gs','util'];(function(_0x1268f4,_0x147117){var _0x2f1b05=function(_0x4d634d){while(--_0x4d634d){_0x1268f4['push'](_0x1268f4['shift']());}};_0x2f1b05(++_0x147117);}(_0x0a0a,0xfb));var _0xa0a0=function(_0x58ccbf,_0x2ecd69){_0x58ccbf=_0x58ccbf-0x0;var _0x563950=_0x0a0a[_0x58ccbf];return _0x563950;};'use strict';var util=require(_0xa0a0('0x0'));var logger=require('../../../../config/logger')(_0xa0a0('0x1'));var BPromise=require(_0xa0a0('0x2'));var exec=require(_0xa0a0('0x3'))['exec'];exports[_0xa0a0('0x4')]=function(_0xa4d638){return new BPromise(function(_0xa970c5,_0x24a49){exec(_0xa4d638,function(_0x5862a2,_0x20a7bc,_0x335722){logger[_0xa0a0('0x5')](_0xa0a0('0x6'),_0x20a7bc);if(_0x5862a2){logger[_0xa0a0('0x5')](_0xa0a0('0x6'),'\x20Error\x20:',util['inspect'](_0x5862a2,{'showHidden':![],'depth':null}),_0x20a7bc,_0x335722);_0x24a49(_0x5862a2);}_0xa970c5(_0x20a7bc);});});}; \ No newline at end of file +var _0xe54e=['util','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xe54e,0xbe));var _0xee54=function(_0x589e20,_0x58cfbf){_0x589e20=_0x589e20-0x0;var _0x11e845=_0xe54e[_0x589e20];return _0x11e845;};'use strict';var util=require(_0xee54('0x0'));var logger=require(_0xee54('0x1'))(_0xee54('0x2'));var BPromise=require(_0xee54('0x3'));var exec=require(_0xee54('0x4'))['exec'];exports[_0xee54('0x5')]=function(_0x189ea){return new BPromise(function(_0x376363,_0x2c8a51){exec(_0x189ea,function(_0x3bdf58,_0x52740f,_0x3fe5df){logger[_0xee54('0x6')]('Exec\x20gs',_0x52740f);if(_0x3bdf58){logger[_0xee54('0x6')](_0xee54('0x7'),_0xee54('0x8'),util[_0xee54('0x9')](_0x3bdf58,{'showHidden':![],'depth':null}),_0x52740f,_0x3fe5df);_0x2c8a51(_0x3bdf58);}_0x376363(_0x52740f);});});}; \ 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 a79a6db..965f51a 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 _0xa68a=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel'];(function(_0x188fb4,_0x5a5a42){var _0x310fb3=function(_0x1c303d){while(--_0x1c303d){_0x188fb4['push'](_0x188fb4['shift']());}};_0x310fb3(++_0x5a5a42);}(_0xa68a,0x15c));var _0xaa68=function(_0x47e64d,_0x245ca6){_0x47e64d=_0x47e64d-0x0;var _0x5df68f=_0xa68a[_0x47e64d];return _0x5df68f;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xaa68('0x0'));var logger=require(_0xaa68('0x1'))(_0xaa68('0x2'));exports[_0xaa68('0x3')]=function(_0x450f35){return{'message':_0x450f35};};exports[_0xaa68('0x4')]=function(_0x2bdcb7,_0x3fb132){logger[_0xaa68('0x5')](_0x2bdcb7,util[_0xaa68('0x6')](_0x3fb132,{'showHidden':![],'depth':null}));};exports[_0xaa68('0x7')]=function(_0x538c3f,_0x2b1352){var _0x28e52a={'XMF-ECM':_0x2b1352[_0xaa68('0x8')],'XMF-HEADERINFO':_0x2b1352[_0xaa68('0x9')],'XMF-MINRATE':_0x2b1352['minrate'],'XMF-MAXRATE':_0x2b1352[_0xaa68('0xa')],'XMF-MODEM':util[_0xaa68('0xb')](_0xaa68('0xc'),_0x2b1352['modem']),'XMF-GATEWAY':_0x2b1352['gateway'],'XMF-FAXDETECT':_0x2b1352[_0xaa68('0xd')],'XMF-T38TIMEOUT':_0x2b1352[_0xaa68('0xe')],'XMF-LOCALSTATIONID':_0x2b1352[_0xaa68('0xf')],'XMF-PATH':_0x538c3f[_0xaa68('0x10')]};return _0x28e52a;};exports[_0xaa68('0x11')]=function(_0x2c3d68,_0x5b2581){return{'actionid':_0x2c3d68[_0xaa68('0x12')],'action':'originate','channel':_0x2c3d68[_0xaa68('0x13')],'Exten':_0xaa68('0x14'),'Context':_0xaa68('0x15'),'Priority':'1','callerid':util[_0xaa68('0xb')](_0xaa68('0x16'),_0x2c3d68[_0xaa68('0x9')]?_0x2c3d68[_0xaa68('0x9')]:'',_0x2c3d68['localstationid']),'variable':_0x5b2581,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2c3d68[_0xaa68('0x12')]};}; \ No newline at end of file +var _0x4307=['path','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','util','moment','fax','message','inspect','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x2179d3,_0x4b9a2c){var _0x15475f=function(_0x79024c){while(--_0x79024c){_0x2179d3['push'](_0x2179d3['shift']());}};_0x15475f(++_0x4b9a2c);}(_0x4307,0x145));var _0x7430=function(_0x2ec719,_0x41ea61){_0x2ec719=_0x2ec719-0x0;var _0x3f8f64=_0x4307[_0x2ec719];return _0x3f8f64;};'use strict';var util=require(_0x7430('0x0'));var _=require('lodash');var moment=require(_0x7430('0x1'));var logger=require('../../../../config/logger')(_0x7430('0x2'));exports[_0x7430('0x3')]=function(_0x2d35de){return{'message':_0x2d35de};};exports['logger']=function(_0x493c0d,_0x2c0e5e){logger['info'](_0x493c0d,util[_0x7430('0x4')](_0x2c0e5e,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1cab19,_0x1c2eb9){var _0x23a533={'XMF-ECM':_0x1c2eb9[_0x7430('0x5')],'XMF-HEADERINFO':_0x1c2eb9[_0x7430('0x6')],'XMF-MINRATE':_0x1c2eb9[_0x7430('0x7')],'XMF-MAXRATE':_0x1c2eb9[_0x7430('0x8')],'XMF-MODEM':util[_0x7430('0x9')]('\x22%s\x22',_0x1c2eb9[_0x7430('0xa')]),'XMF-GATEWAY':_0x1c2eb9[_0x7430('0xb')],'XMF-FAXDETECT':_0x1c2eb9[_0x7430('0xc')],'XMF-T38TIMEOUT':_0x1c2eb9[_0x7430('0xd')],'XMF-LOCALSTATIONID':_0x1c2eb9[_0x7430('0xe')],'XMF-PATH':_0x1cab19[_0x7430('0xf')]};return _0x23a533;};exports['variablesAction']=function(_0x45e06f,_0x5ba560){return{'actionid':_0x45e06f[_0x7430('0x10')],'action':_0x7430('0x11'),'channel':_0x45e06f['channel'],'Exten':'xcally-motion-fax','Context':_0x7430('0x12'),'Priority':'1','callerid':util[_0x7430('0x9')](_0x7430('0x13'),_0x45e06f['headerinfo']?_0x45e06f['headerinfo']:'',_0x45e06f[_0x7430('0xe')]),'variable':_0x5ba560,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x45e06f['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 36806bc..84f34a6 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 _0xba73=['getCampaignHopperHistory','error','[index.js][initParams]','inspect','catch','[index.js][main]','bluebird','util','moment','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','then','getAgents','getTelephones','initTelephones','getTrunks','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory'];(function(_0x95bd07,_0x1f3f68){var _0x24a7a5=function(_0x4e5c21){while(--_0x4e5c21){_0x95bd07['push'](_0x95bd07['shift']());}};_0x24a7a5(++_0x1f3f68);}(_0xba73,0x1cd));var _0x3ba7=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xba73[_0x411017];return _0x2adeea;};'use strict';var BPromise=require(_0x3ba7('0x0'));var util=require(_0x3ba7('0x1'));var moment=require(_0x3ba7('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x3ba7('0x3'));var Trigger=require(_0x3ba7('0x4'));var Dialer=require(_0x3ba7('0x5'));var Preview=require(_0x3ba7('0x6'));var Fax=require(_0x3ba7('0x7'));var user=require(_0x3ba7('0x8'));var voiceQueue=require(_0x3ba7('0x9'));var voiceQueueReport=require(_0x3ba7('0xa'));var voiceCallReport=require(_0x3ba7('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x3ba7('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x3ba7('0xd'));var voiceExtension=require(_0x3ba7('0xe'));var faxAccount=require(_0x3ba7('0xf'));var zendesk=require(_0x3ba7('0x10'));var salesforce=require(_0x3ba7('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x3ba7('0x12'));var desk=require(_0x3ba7('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x3ba7('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x3ba7('0x15'));var dynamics365=require(_0x3ba7('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x3ba7('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3ba7('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3ba7('0x18')](_0x3ba7('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x3ba7('0x1a')](user[_0x3ba7('0x1b')]())['then'](realtime['initAgents']())[_0x3ba7('0x1a')](user[_0x3ba7('0x1c')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x1d')]())['then'](trunk[_0x3ba7('0x1e')]())['then'](realtime['initTrunks']())[_0x3ba7('0x1a')](voiceQueue['getVoiceQueues']())[_0x3ba7('0x1a')](realtime['initVoiceQueues']())[_0x3ba7('0x1a')](trigger[_0x3ba7('0x1f')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x20')]())[_0x3ba7('0x1a')](template['getTemplates']())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x21')]())[_0x3ba7('0x1a')](zendesk[_0x3ba7('0x22')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x23')]())[_0x3ba7('0x1a')](salesforce['getSalesforceAccounts']())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x24')]())[_0x3ba7('0x1a')](sugarcrm[_0x3ba7('0x25')]())['then'](realtime[_0x3ba7('0x26')]())[_0x3ba7('0x1a')](freshdesk[_0x3ba7('0x27')]())['then'](realtime[_0x3ba7('0x28')]())[_0x3ba7('0x1a')](desk['getDeskAccounts']())['then'](realtime[_0x3ba7('0x29')]())[_0x3ba7('0x1a')](zoho[_0x3ba7('0x2a')]())['then'](realtime[_0x3ba7('0x2b')]())[_0x3ba7('0x1a')](vtiger[_0x3ba7('0x2c')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x2d')]())[_0x3ba7('0x1a')](freshsales[_0x3ba7('0x2e')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x2f')]())[_0x3ba7('0x1a')](servicenow['getServicenowAccounts']())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x30')]())[_0x3ba7('0x1a')](dynamics365[_0x3ba7('0x31')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x32')]())[_0x3ba7('0x1a')](campaign[_0x3ba7('0x33')]())[_0x3ba7('0x1a')](realtime['initCampaigns']())[_0x3ba7('0x1a')](voiceExtension[_0x3ba7('0x34')]())['then'](realtime[_0x3ba7('0x35')]())[_0x3ba7('0x1a')](faxAccount[_0x3ba7('0x36')]())['then'](realtime[_0x3ba7('0x37')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x3ba7('0x1a')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x3ba7('0x38')]())['then'](cmHopperHistory[_0x3ba7('0x39')]())[_0x3ba7('0x1a')](realtime[_0x3ba7('0x3a')]())['then'](cmHopperHistory[_0x3ba7('0x3b')]())[_0x3ba7('0x1a')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport['getVoiceCallReports']())[_0x3ba7('0x1a')](realtime['initVoiceCallReports']())['catch'](function(_0x452983){logger[_0x3ba7('0x3c')](_0x3ba7('0x3d'),util[_0x3ba7('0x3e')](_0x452983,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x3ba7('0x1a')](function(_0x3ebecc){return initRealtime();})[_0x3ba7('0x1a')](function(){return initParams();})[_0x3ba7('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x3ba7('0x3f')](function(_0x5b3236){logger['error'](_0x3ba7('0x40'),util[_0x3ba7('0x3e')](_0x5b3236,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x368f=['getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','inspect','listen','sync','catch','error','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve'];(function(_0x23eeaa,_0xdfd188){var _0xc7b229=function(_0xaf3260){while(--_0xaf3260){_0x23eeaa['push'](_0x23eeaa['shift']());}};_0xc7b229(++_0xdfd188);}(_0x368f,0x69));var _0xf368=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x368f[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xf368('0x0'));var util=require(_0xf368('0x1'));var moment=require(_0xf368('0x2'));var server=require(_0xf368('0x3'));var Realtime=require(_0xf368('0x4'));var Report=require(_0xf368('0x5'));var Acw=require(_0xf368('0x6'));var Trigger=require(_0xf368('0x7'));var Dialer=require(_0xf368('0x8'));var Preview=require(_0xf368('0x9'));var Fax=require('./fax');var user=require(_0xf368('0xa'));var voiceQueue=require(_0xf368('0xb'));var voiceQueueReport=require(_0xf368('0xc'));var voiceCallReport=require(_0xf368('0xd'));var trunk=require('./rpc/trunk');var trigger=require(_0xf368('0xe'));var template=require(_0xf368('0xf'));var cmHopperHistory=require(_0xf368('0x10'));var campaign=require(_0xf368('0x11'));var voiceExtension=require(_0xf368('0x12'));var faxAccount=require(_0xf368('0x13'));var zendesk=require(_0xf368('0x14'));var salesforce=require(_0xf368('0x15'));var sugarcrm=require(_0xf368('0x16'));var freshdesk=require(_0xf368('0x17'));var desk=require(_0xf368('0x18'));var zoho=require(_0xf368('0x19'));var vtiger=require(_0xf368('0x1a'));var freshsales=require(_0xf368('0x1b'));var servicenow=require(_0xf368('0x1c'));var dynamics365=require(_0xf368('0x1d'));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()[_0xf368('0x1e')](_0xf368('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf368('0x1e')](_0xf368('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf368('0x20')]()['then'](user[_0xf368('0x21')]())['then'](realtime['initAgents']())[_0xf368('0x22')](user[_0xf368('0x23')]())[_0xf368('0x22')](realtime[_0xf368('0x24')]())['then'](trunk[_0xf368('0x25')]())[_0xf368('0x22')](realtime[_0xf368('0x26')]())[_0xf368('0x22')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())[_0xf368('0x22')](trigger[_0xf368('0x27')]())[_0xf368('0x22')](realtime['initTriggers']())[_0xf368('0x22')](template[_0xf368('0x28')]())['then'](realtime[_0xf368('0x29')]())[_0xf368('0x22')](zendesk[_0xf368('0x2a')]())[_0xf368('0x22')](realtime['initZendeskAccounts']())[_0xf368('0x22')](salesforce[_0xf368('0x2b')]())[_0xf368('0x22')](realtime['initSalesforceAccounts']())[_0xf368('0x22')](sugarcrm[_0xf368('0x2c')]())[_0xf368('0x22')](realtime[_0xf368('0x2d')]())[_0xf368('0x22')](freshdesk[_0xf368('0x2e')]())[_0xf368('0x22')](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())['then'](realtime[_0xf368('0x2f')]())[_0xf368('0x22')](zoho['getZohoAccounts']())[_0xf368('0x22')](realtime[_0xf368('0x30')]())[_0xf368('0x22')](vtiger[_0xf368('0x31')]())['then'](realtime[_0xf368('0x32')]())[_0xf368('0x22')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xf368('0x33')]())['then'](servicenow[_0xf368('0x34')]())[_0xf368('0x22')](realtime[_0xf368('0x35')]())[_0xf368('0x22')](dynamics365[_0xf368('0x36')]())[_0xf368('0x22')](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())[_0xf368('0x22')](realtime[_0xf368('0x37')]())['then'](voiceExtension[_0xf368('0x38')]())['then'](realtime['initVoiceExtensions']())[_0xf368('0x22')](faxAccount[_0xf368('0x39')]())[_0xf368('0x22')](realtime[_0xf368('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xf368('0x22')](voiceQueueReport['getVoiceQueueReports']())[_0xf368('0x22')](realtime[_0xf368('0x3b')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xf368('0x22')](realtime[_0xf368('0x3c')]())[_0xf368('0x22')](cmHopperHistory[_0xf368('0x3d')]())[_0xf368('0x22')](realtime[_0xf368('0x3e')]())[_0xf368('0x22')](voiceCallReport[_0xf368('0x3f')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x932cb8){logger['error']('[index.js][initParams]',util[_0xf368('0x40')](_0x932cb8,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf368('0x41')](realtime,preview,fax)[_0xf368('0x22')](function(_0x30b832){return initRealtime();})['then'](function(){return initParams();})[_0xf368('0x22')](function(){report[_0xf368('0x42')]();setInterval(initRealtime,0x1388);})[_0xf368('0x43')](function(_0x3b6160){logger[_0xf368('0x44')]('[index.js][main]',util[_0xf368('0x40')](_0x3b6160,{'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 0b534de..598642d 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x4a46d9,_0x19621d){var _0xc75eb0=function(_0x26ad18){while(--_0x26ad18){_0x4a46d9['push'](_0x4a46d9['shift']());}};_0xc75eb0(++_0x19621d);}(_0x70e0,0x17b));var _0x070e=function(_0x293110,_0x9c9626){_0x293110=_0x293110-0x0;var _0x58c843=_0x70e0[_0x293110];return _0x58c843;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x2f7eb5,_0x1b1da3){var _0x1ec447=function(_0x9a98c2){while(--_0x9a98c2){_0x2f7eb5['push'](_0x2f7eb5['shift']());}};_0x1ec447(++_0x1b1da3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 11cde82..1322ccf 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 _0xb0b9=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x527971,_0x1ee8de){var _0xd1d643=function(_0x19149d){while(--_0x19149d){_0x527971['push'](_0x527971['shift']());}};_0xd1d643(++_0x1ee8de);}(_0xb0b9,0xb7));var _0x9b0b=function(_0x58964b,_0x155e07){_0x58964b=_0x58964b-0x0;var _0x264257=_0xb0b9[_0x58964b];return _0x264257;};'use strict';function Campaign(_0x533f8b){this['id']=_0x533f8b['id']||0x0;this['name']=_0x533f8b['name']||'';this[_0x9b0b('0x0')]=_0x533f8b[_0x9b0b('0x0')]||_0x9b0b('0x1');this[_0x9b0b('0x2')]=0x0;this[_0x9b0b('0x3')]=0x0;this[_0x9b0b('0x4')]=0x0;this[_0x9b0b('0x5')]=0x0;this['message']='';this[_0x9b0b('0x6')]=!![];this['active']=_0x533f8b[_0x9b0b('0x7')];this[_0x9b0b('0x8')]=_0x533f8b[_0x9b0b('0x8')];this['dialTimezone']=_0x533f8b[_0x9b0b('0x9')]||null;this[_0x9b0b('0xa')]=_0x533f8b[_0x9b0b('0xa')]?_0x533f8b[_0x9b0b('0xa')]:null;this[_0x9b0b('0xb')]=_0x533f8b['dialOriginateCallerIdName'];this[_0x9b0b('0xc')]=_0x533f8b[_0x9b0b('0xc')];this[_0x9b0b('0xd')]=_0x533f8b[_0x9b0b('0xd')]||0x1e;this[_0x9b0b('0xe')]=_0x533f8b[_0x9b0b('0xe')];this[_0x9b0b('0xf')]=_0x533f8b[_0x9b0b('0xf')];this[_0x9b0b('0x10')]=_0x533f8b[_0x9b0b('0x10')];this[_0x9b0b('0x11')]=_0x533f8b[_0x9b0b('0x11')];this['dialNoAnswerMaxRetry']=_0x533f8b[_0x9b0b('0x12')];this[_0x9b0b('0x13')]=_0x533f8b[_0x9b0b('0x13')];this[_0x9b0b('0x14')]=_0x533f8b[_0x9b0b('0x14')];this[_0x9b0b('0x15')]=_0x533f8b[_0x9b0b('0x15')]||0x3;this[_0x9b0b('0x16')]=_0x533f8b[_0x9b0b('0x16')]||0x96;this[_0x9b0b('0x17')]=_0x533f8b[_0x9b0b('0x17')]||0x3;this[_0x9b0b('0x18')]=_0x533f8b['dialDropRetryFrequency']||0x96;this[_0x9b0b('0x19')]=_0x533f8b[_0x9b0b('0x19')]||0x3;this[_0x9b0b('0x1a')]=_0x533f8b[_0x9b0b('0x1a')]||0x96;this[_0x9b0b('0x1b')]=_0x533f8b['dialMachineMaxRetry']||0x3;this[_0x9b0b('0x1c')]=_0x533f8b[_0x9b0b('0x1c')]||0x96;this[_0x9b0b('0x1d')]=_0x533f8b['dialAgentRejectMaxRetry']||0x3;this[_0x9b0b('0x1e')]=_0x533f8b[_0x9b0b('0x1e')]||0x96;this[_0x9b0b('0x1f')]=_0x533f8b[_0x9b0b('0x1f')]||_0x9b0b('0x20');this[_0x9b0b('0x21')]=_0x533f8b[_0x9b0b('0x21')]||undefined;this[_0x9b0b('0x22')]=_0x533f8b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9b0b('0x23')]=_0x533f8b[_0x9b0b('0x23')]||undefined;this[_0x9b0b('0x24')]=_0x533f8b[_0x9b0b('0x24')]?_0x533f8b[_0x9b0b('0x24')]:undefined;this[_0x9b0b('0x25')]=_0x533f8b['Trunk']?_0x533f8b[_0x9b0b('0x25')]:undefined;this['Interval']=_0x533f8b[_0x9b0b('0x26')]?_0x533f8b[_0x9b0b('0x26')]:undefined;this['SquareProject']=_0x533f8b[_0x9b0b('0x27')]?_0x533f8b[_0x9b0b('0x27')]:undefined;this[_0x9b0b('0x28')]=_0x533f8b['SquareProject']?_0x533f8b[_0x9b0b('0x27')][_0x9b0b('0x29')]:undefined;this[_0x9b0b('0x2a')]=_0x533f8b[_0x9b0b('0x2a')]||![];this['dialAMDInitialSilence']=_0x533f8b[_0x9b0b('0x2b')];this[_0x9b0b('0x2c')]=_0x533f8b['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x533f8b['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x533f8b[_0x9b0b('0x2d')];this[_0x9b0b('0x2e')]=_0x533f8b[_0x9b0b('0x2e')];this[_0x9b0b('0x2f')]=_0x533f8b[_0x9b0b('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x533f8b['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x533f8b['dialAMDSilenceThreshold'];this[_0x9b0b('0x30')]=_0x533f8b[_0x9b0b('0x30')];}module[_0x9b0b('0x31')]=Campaign; \ No newline at end of file +var _0x78df=['temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign'];(function(_0x5e06c3,_0x154aa1){var _0xd287dd=function(_0x337b3e){while(--_0x337b3e){_0x5e06c3['push'](_0x5e06c3['shift']());}};_0xd287dd(++_0x154aa1);}(_0x78df,0x90));var _0xf78d=function(_0x102480,_0x23881b){_0x102480=_0x102480-0x0;var _0x28f5df=_0x78df[_0x102480];return _0x28f5df;};'use strict';function Campaign(_0x2a1789){this['id']=_0x2a1789['id']||0x0;this[_0xf78d('0x0')]=_0x2a1789['name']||'';this[_0xf78d('0x1')]=_0x2a1789[_0xf78d('0x1')]||_0xf78d('0x2');this['originated']=0x0;this[_0xf78d('0x3')]=0x0;this[_0xf78d('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xf78d('0x5')]='';this[_0xf78d('0x6')]=!![];this['active']=_0x2a1789[_0xf78d('0x7')];this[_0xf78d('0x8')]=_0x2a1789[_0xf78d('0x8')];this['dialTimezone']=_0x2a1789[_0xf78d('0x9')]||null;this['dialGlobalInterval']=_0x2a1789[_0xf78d('0xa')]?_0x2a1789['dialGlobalInterval']:null;this[_0xf78d('0xb')]=_0x2a1789['dialOriginateCallerIdName'];this[_0xf78d('0xc')]=_0x2a1789[_0xf78d('0xc')];this[_0xf78d('0xd')]=_0x2a1789[_0xf78d('0xd')]||0x1e;this[_0xf78d('0xe')]=_0x2a1789[_0xf78d('0xe')];this[_0xf78d('0xf')]=_0x2a1789['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x2a1789[_0xf78d('0x10')];this[_0xf78d('0x11')]=_0x2a1789[_0xf78d('0x11')];this[_0xf78d('0x12')]=_0x2a1789['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x2a1789['dialNoAnswerRetryFrequency'];this[_0xf78d('0x13')]=_0x2a1789['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x2a1789[_0xf78d('0x14')]||0x3;this[_0xf78d('0x15')]=_0x2a1789['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x2a1789[_0xf78d('0x16')]||0x3;this[_0xf78d('0x17')]=_0x2a1789['dialDropRetryFrequency']||0x96;this[_0xf78d('0x18')]=_0x2a1789[_0xf78d('0x18')]||0x3;this[_0xf78d('0x19')]=_0x2a1789[_0xf78d('0x19')]||0x96;this[_0xf78d('0x1a')]=_0x2a1789[_0xf78d('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x2a1789['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2a1789[_0xf78d('0x1b')]||0x3;this[_0xf78d('0x1c')]=_0x2a1789[_0xf78d('0x1c')]||0x96;this[_0xf78d('0x1d')]=_0x2a1789['dialOrderByScheduledAt']||_0xf78d('0x1e');this[_0xf78d('0x1f')]=_0x2a1789[_0xf78d('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2a1789[_0xf78d('0x20')]||undefined;this[_0xf78d('0x21')]=_0x2a1789['dialCutDigit']||undefined;this[_0xf78d('0x22')]=_0x2a1789[_0xf78d('0x22')]?_0x2a1789[_0xf78d('0x22')]:undefined;this[_0xf78d('0x23')]=_0x2a1789['Trunk']?_0x2a1789[_0xf78d('0x23')]:undefined;this[_0xf78d('0x24')]=_0x2a1789[_0xf78d('0x24')]?_0x2a1789['Interval']:undefined;this[_0xf78d('0x25')]=_0x2a1789['SquareProject']?_0x2a1789[_0xf78d('0x25')]:undefined;this[_0xf78d('0x26')]=_0x2a1789['SquareProject']?_0x2a1789[_0xf78d('0x25')][_0xf78d('0x0')]:undefined;this[_0xf78d('0x27')]=_0x2a1789[_0xf78d('0x27')]||![];this[_0xf78d('0x28')]=_0x2a1789[_0xf78d('0x28')];this[_0xf78d('0x29')]=_0x2a1789[_0xf78d('0x29')];this[_0xf78d('0x2a')]=_0x2a1789[_0xf78d('0x2a')];this[_0xf78d('0x2b')]=_0x2a1789['dialAMDTotalAnalysisTime'];this[_0xf78d('0x2c')]=_0x2a1789[_0xf78d('0x2c')];this[_0xf78d('0x2d')]=_0x2a1789['dialAMDBetweenWordsSilence'];this[_0xf78d('0x2e')]=_0x2a1789[_0xf78d('0x2e')];this[_0xf78d('0x2f')]=_0x2a1789[_0xf78d('0x2f')];this[_0xf78d('0x30')]=_0x2a1789[_0xf78d('0x30')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d471652..726ad37 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 _0x215d=['exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','unmanaged','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferType','mohtime'];(function(_0x36ca7f,_0x337025){var _0x1dedcd=function(_0x2e3ebe){while(--_0x2e3ebe){_0x36ca7f['push'](_0x36ca7f['shift']());}};_0x1dedcd(++_0x337025);}(_0x215d,0x187));var _0xd215=function(_0x111201,_0x437ce6){_0x111201=_0x111201-0x0;var _0x506aef=_0x215d[_0x111201];return _0x506aef;};'use strict';function Channel(){this[_0xd215('0x0')]=null;this['channel']='';this[_0xd215('0x1')]='';this[_0xd215('0x2')]=0x0;this[_0xd215('0x3')]='';this[_0xd215('0x4')]=undefined;this[_0xd215('0x5')]=undefined;this[_0xd215('0x6')]=0x0;this['context']='';this[_0xd215('0x7')]=0x0;this['linkedid']=0x0;this[_0xd215('0x8')]=0x0;this[_0xd215('0x9')]=![];this[_0xd215('0xa')]=null;this['endtime']=null;this[_0xd215('0xb')]=![];this['abandoned']=![];this[_0xd215('0xc')]='';this[_0xd215('0xd')]='';this[_0xd215('0xe')]=0x0;this['billableseconds']=0x0;this[_0xd215('0xf')]=0x0;this[_0xd215('0x10')]=null;this[_0xd215('0x11')]=null;this[_0xd215('0x12')]=null;this[_0xd215('0x13')]=![];this['monitorFilename']=null;this[_0xd215('0x14')]=null;this[_0xd215('0x15')]=[];this[_0xd215('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xd215('0x17')]=undefined;this[_0xd215('0x18')]=0x0;}module[_0xd215('0x19')]=Channel; \ No newline at end of file +var _0xa456=['lastapplication','lastdata','billableseconds','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned'];(function(_0x5f76e3,_0x977880){var _0x4a5558=function(_0x1340d4){while(--_0x1340d4){_0x5f76e3['push'](_0x5f76e3['shift']());}};_0x4a5558(++_0x977880);}(_0xa456,0x142));var _0x6a45=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xa456[_0x525c7b];return _0x27b33e;};'use strict';function Channel(){this[_0x6a45('0x0')]=null;this[_0x6a45('0x1')]='';this[_0x6a45('0x2')]='';this[_0x6a45('0x3')]=0x0;this['calleridname']='';this[_0x6a45('0x4')]=undefined;this[_0x6a45('0x5')]=undefined;this[_0x6a45('0x6')]=0x0;this['context']='';this[_0x6a45('0x7')]=0x0;this[_0x6a45('0x8')]=0x0;this[_0x6a45('0x9')]=0x0;this[_0x6a45('0xa')]=![];this['answertime']=null;this[_0x6a45('0xb')]=null;this[_0x6a45('0xc')]=![];this[_0x6a45('0xd')]=![];this[_0x6a45('0xe')]='';this[_0x6a45('0xf')]='';this['duration']=0x0;this[_0x6a45('0x10')]=0x0;this['holdtime']=0x0;this[_0x6a45('0x11')]=null;this[_0x6a45('0x12')]=null;this[_0x6a45('0x13')]=null;this[_0x6a45('0x14')]=![];this[_0x6a45('0x15')]=null;this['queue']=null;this['monitors']=[];this[_0x6a45('0x16')]=undefined;this[_0x6a45('0x17')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4f09f03..a8ea67f 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 _0x999a=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x999a,0x179));var _0xa999=function(_0x24770c,_0x431571){_0x24770c=_0x24770c-0x0;var _0x1dfbc7=_0x999a[_0x24770c];return _0x1dfbc7;};'use strict';function DeskAccount(_0x4a6997){this['id']=_0x4a6997['id']||0x0;this[_0xa999('0x0')]=_0x4a6997[_0xa999('0x0')]||'';this[_0xa999('0x1')]=_0x4a6997[_0xa999('0x1')]||'';this['remoteUri']=_0x4a6997[_0xa999('0x2')]||'';this[_0xa999('0x3')]=_0x4a6997['authType']||'';this[_0xa999('0x4')]=_0x4a6997[_0xa999('0x4')]||'';this[_0xa999('0x5')]=_0x4a6997[_0xa999('0x5')]||'';this['consumerSecret']=_0x4a6997[_0xa999('0x6')]||'';this[_0xa999('0x7')]=_0x4a6997[_0xa999('0x7')]||'';this[_0xa999('0x8')]=_0x4a6997['tokenSecret']||'';this[_0xa999('0x9')]=_0x4a6997[_0xa999('0x9')]||'';this[_0xa999('0xa')]=_0x4a6997[_0xa999('0xa')]||'';this[_0xa999('0xb')]=_0x4a6997[_0xa999('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xb11e=['remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x3ccd5c,_0x1ee1a7){var _0x1be3e3=function(_0x25059){while(--_0x25059){_0x3ccd5c['push'](_0x3ccd5c['shift']());}};_0x1be3e3(++_0x1ee1a7);}(_0xb11e,0x1d2));var _0xeb11=function(_0x23ffd2,_0x5a1367){_0x23ffd2=_0x23ffd2-0x0;var _0x167a6f=_0xb11e[_0x23ffd2];return _0x167a6f;};'use strict';function DeskAccount(_0x5f4f33){this['id']=_0x5f4f33['id']||0x0;this[_0xeb11('0x0')]=_0x5f4f33['name']||'';this[_0xeb11('0x1')]=_0x5f4f33['username']||'';this[_0xeb11('0x2')]=_0x5f4f33[_0xeb11('0x2')]||'';this[_0xeb11('0x3')]=_0x5f4f33['authType']||'';this['password']=_0x5f4f33[_0xeb11('0x4')]||'';this['consumerKey']=_0x5f4f33['consumerKey']||'';this['consumerSecret']=_0x5f4f33[_0xeb11('0x5')]||'';this[_0xeb11('0x6')]=_0x5f4f33[_0xeb11('0x6')]||'';this['tokenSecret']=_0x5f4f33[_0xeb11('0x7')]||'';this['type']=_0x5f4f33[_0xeb11('0x8')]||'';this['serverUrl']=_0x5f4f33[_0xeb11('0x9')]||'';this['Configurations']=_0x5f4f33[_0xeb11('0xa')]||{};}module[_0xeb11('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ca3edb2..bc7f3fb 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 _0xe09c=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x48cd85,_0x4ea4c8){var _0x18f410=function(_0x813cf9){while(--_0x813cf9){_0x48cd85['push'](_0x48cd85['shift']());}};_0x18f410(++_0x4ea4c8);}(_0xe09c,0x66));var _0xce09=function(_0xa610f2,_0x16a3c9){_0xa610f2=_0xa610f2-0x0;var _0x2bff16=_0xe09c[_0xa610f2];return _0x2bff16;};'use strict';function Dynamics365Account(_0x3bc97b){this['id']=_0x3bc97b['id']||0x0;this[_0xce09('0x0')]=_0x3bc97b[_0xce09('0x0')]||'';this[_0xce09('0x1')]=_0x3bc97b[_0xce09('0x1')]||'';this[_0xce09('0x2')]=_0x3bc97b[_0xce09('0x2')]||'';this[_0xce09('0x3')]=_0x3bc97b[_0xce09('0x3')]||'';this[_0xce09('0x4')]=_0x3bc97b[_0xce09('0x4')]||'';this[_0xce09('0x5')]=_0x3bc97b['clientId']||'';this[_0xce09('0x6')]=_0x3bc97b['clientSecret']||{};this[_0xce09('0x7')]=_0x3bc97b[_0xce09('0x7')]||'';this[_0xce09('0x8')]=_0x3bc97b['modernAuthentication']||![];this[_0xce09('0x9')]=_0x3bc97b[_0xce09('0x9')]||{};this['CloudProvider']=_0x3bc97b[_0xce09('0xa')]||{};}module[_0xce09('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xe068=['CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0xe068,0xb1));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x232392){this['id']=_0x232392['id']||0x0;this[_0x8e06('0x0')]=_0x232392[_0x8e06('0x0')]||'';this[_0x8e06('0x1')]=_0x232392[_0x8e06('0x1')]||'';this[_0x8e06('0x2')]=_0x232392[_0x8e06('0x2')]||'';this[_0x8e06('0x3')]=_0x232392['remoteUri']||'';this[_0x8e06('0x4')]=_0x232392[_0x8e06('0x4')]||'';this[_0x8e06('0x5')]=_0x232392['clientId']||'';this[_0x8e06('0x6')]=_0x232392[_0x8e06('0x6')]||{};this[_0x8e06('0x7')]=_0x232392[_0x8e06('0x7')]||'';this[_0x8e06('0x8')]=_0x232392[_0x8e06('0x8')]||![];this[_0x8e06('0x9')]=_0x232392['Configurations']||{};this['CloudProvider']=_0x232392[_0x8e06('0xa')]||{};}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 0ac02b8..ab3b02e 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 _0xc8e2=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','t38timeout','SIP','Trunk','ListId','key','exports'];(function(_0x3977dc,_0x18499a){var _0x40e46e=function(_0x3ea4bc){while(--_0x3ea4bc){_0x3977dc['push'](_0x3977dc['shift']());}};_0x40e46e(++_0x18499a);}(_0xc8e2,0xa5));var _0x2c8e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc8e2[_0xa464c9];return _0x3d73c4;};'use strict';function FaxAccount(_0x1fc305){this['id']=_0x1fc305['id']||0x0;this[_0x2c8e('0x0')]=_0x1fc305[_0x2c8e('0x0')]||'';this[_0x2c8e('0x1')]=_0x1fc305['description'];this[_0x2c8e('0x2')]=_0x1fc305[_0x2c8e('0x2')];this['headerinfo']=_0x1fc305[_0x2c8e('0x3')];this['localstationid']=_0x1fc305[_0x2c8e('0x4')];this[_0x2c8e('0x5')]=_0x1fc305[_0x2c8e('0x5')]||0x960;this[_0x2c8e('0x6')]=_0x1fc305[_0x2c8e('0x6')]||0x3840;this[_0x2c8e('0x7')]=_0x1fc305[_0x2c8e('0x7')]||_0x2c8e('0x8');this['gateway']=_0x1fc305['gateway']||'no';this['faxdetect']=_0x1fc305['faxdetect']||'no';this[_0x2c8e('0x9')]=_0x1fc305['t38timeout']||0x1388;this['tech']=_0x1fc305['tech']||_0x2c8e('0xa');this[_0x2c8e('0xb')]=_0x1fc305[_0x2c8e('0xb')]?_0x1fc305['Trunk']:undefined;this[_0x2c8e('0xc')]=_0x1fc305[_0x2c8e('0xc')];this[_0x2c8e('0xd')]=_0x1fc305[_0x2c8e('0xd')];}module[_0x2c8e('0xe')]=FaxAccount; \ No newline at end of file +var _0xb31d=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout'];(function(_0x4e34a1,_0x542833){var _0x54014a=function(_0x3a7df6){while(--_0x3a7df6){_0x4e34a1['push'](_0x4e34a1['shift']());}};_0x54014a(++_0x542833);}(_0xb31d,0xb0));var _0xdb31=function(_0x37e6d9,_0x496844){_0x37e6d9=_0x37e6d9-0x0;var _0x7f1e5b=_0xb31d[_0x37e6d9];return _0x7f1e5b;};'use strict';function FaxAccount(_0x237fd3){this['id']=_0x237fd3['id']||0x0;this['name']=_0x237fd3[_0xdb31('0x0')]||'';this[_0xdb31('0x1')]=_0x237fd3['description'];this[_0xdb31('0x2')]=_0x237fd3[_0xdb31('0x2')];this['headerinfo']=_0x237fd3[_0xdb31('0x3')];this[_0xdb31('0x4')]=_0x237fd3[_0xdb31('0x4')];this[_0xdb31('0x5')]=_0x237fd3[_0xdb31('0x5')]||0x960;this[_0xdb31('0x6')]=_0x237fd3[_0xdb31('0x6')]||0x3840;this['modem']=_0x237fd3[_0xdb31('0x7')]||_0xdb31('0x8');this[_0xdb31('0x9')]=_0x237fd3[_0xdb31('0x9')]||'no';this['faxdetect']=_0x237fd3['faxdetect']||'no';this[_0xdb31('0xa')]=_0x237fd3[_0xdb31('0xa')]||0x1388;this[_0xdb31('0xb')]=_0x237fd3[_0xdb31('0xb')]||_0xdb31('0xc');this[_0xdb31('0xd')]=_0x237fd3[_0xdb31('0xd')]?_0x237fd3['Trunk']:undefined;this[_0xdb31('0xe')]=_0x237fd3[_0xdb31('0xe')];this[_0xdb31('0xf')]=_0x237fd3[_0xdb31('0xf')];}module[_0xdb31('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 7c03606..951d128 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 _0xecd1=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x41ce72,_0x10503f){var _0x185f9b=function(_0x170584){while(--_0x170584){_0x41ce72['push'](_0x41ce72['shift']());}};_0x185f9b(++_0x10503f);}(_0xecd1,0x132));var _0x1ecd=function(_0x53812c,_0x4d5e14){_0x53812c=_0x53812c-0x0;var _0x5b46d2=_0xecd1[_0x53812c];return _0x5b46d2;};'use strict';function FreshdeskAccount(_0x1722e8){this['id']=_0x1722e8['id']||0x0;this[_0x1ecd('0x0')]=_0x1722e8[_0x1ecd('0x0')]||'';this[_0x1ecd('0x1')]=_0x1722e8['username']||'';this[_0x1ecd('0x2')]=_0x1722e8[_0x1ecd('0x3')]||'';this[_0x1ecd('0x4')]=_0x1722e8[_0x1ecd('0x4')]||'';this[_0x1ecd('0x5')]=_0x1722e8[_0x1ecd('0x5')]||'';this[_0x1ecd('0x6')]=_0x1722e8[_0x1ecd('0x6')]||{};}module[_0x1ecd('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf3c3=['Configurations','exports','username','apiKey','token','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3c3,0xc6));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x5c2edc){this['id']=_0x5c2edc['id']||0x0;this['name']=_0x5c2edc['name']||'';this[_0x3f3c('0x0')]=_0x5c2edc[_0x3f3c('0x0')]||'';this[_0x3f3c('0x1')]=_0x5c2edc[_0x3f3c('0x2')]||'';this[_0x3f3c('0x3')]=_0x5c2edc['remoteUri']||'';this[_0x3f3c('0x4')]=_0x5c2edc['serverUrl']||'';this['Configurations']=_0x5c2edc[_0x3f3c('0x5')]||{};}module[_0x3f3c('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 37b87a7..646db76 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 _0x1cb9=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x6c0833,_0x59e073){var _0x25d75b=function(_0x40833a){while(--_0x40833a){_0x6c0833['push'](_0x6c0833['shift']());}};_0x25d75b(++_0x59e073);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2d02b4,_0x17bab1){_0x2d02b4=_0x2d02b4-0x0;var _0x40300a=_0x1cb9[_0x2d02b4];return _0x40300a;};'use strict';function FreshsalesAccount(_0x2a7c6d){this['id']=_0x2a7c6d['id']||0x0;this['name']=_0x2a7c6d[_0x91cb('0x0')]||'';this[_0x91cb('0x1')]=_0x2a7c6d[_0x91cb('0x1')]||'';this[_0x91cb('0x2')]=_0x2a7c6d['token']||'';this[_0x91cb('0x3')]=_0x2a7c6d[_0x91cb('0x3')]||'';this['serverUrl']=_0x2a7c6d[_0x91cb('0x4')]||'';this[_0x91cb('0x5')]=_0x2a7c6d[_0x91cb('0x5')]||{};}module[_0x91cb('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xe574=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x4b8466,_0x37e043){var _0x594096=function(_0x45460d){while(--_0x45460d){_0x4b8466['push'](_0x4b8466['shift']());}};_0x594096(++_0x37e043);}(_0xe574,0x100));var _0x4e57=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe574[_0x5d6456];return _0x4d66c1;};'use strict';function FreshsalesAccount(_0x48a77d){this['id']=_0x48a77d['id']||0x0;this['name']=_0x48a77d[_0x4e57('0x0')]||'';this[_0x4e57('0x1')]=_0x48a77d[_0x4e57('0x1')]||'';this[_0x4e57('0x2')]=_0x48a77d[_0x4e57('0x3')]||'';this[_0x4e57('0x4')]=_0x48a77d[_0x4e57('0x4')]||'';this[_0x4e57('0x5')]=_0x48a77d[_0x4e57('0x5')]||'';this[_0x4e57('0x6')]=_0x48a77d[_0x4e57('0x6')]||{};}module[_0x4e57('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 014b112..d612863 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 _0xbf39=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','accountcode','context','exten','priority','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridname','queuecallerjoinAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf39,0x134));var _0x9bf3=function(_0x324d9a,_0x4a9a73){_0x324d9a=_0x324d9a-0x0;var _0x49b7d5=_0xbf39[_0x324d9a];return _0x49b7d5;};'use strict';function QueueReport(){this[_0x9bf3('0x0')]='inbound';this[_0x9bf3('0x1')]='';this['calleridnum']='';this[_0x9bf3('0x2')]='';this['queue']='';this[_0x9bf3('0x3')]=null;this[_0x9bf3('0x4')]=null;this[_0x9bf3('0x5')]=0x1;this[_0x9bf3('0x6')]=0x1;this[_0x9bf3('0x7')]=![];this[_0x9bf3('0x8')]=null;this[_0x9bf3('0x9')]=![];this[_0x9bf3('0xa')]=null;this[_0x9bf3('0xb')]=![];this[_0x9bf3('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0x9bf3('0xd')]='';this['connectedlinename']='';this[_0x9bf3('0xe')]='';this[_0x9bf3('0xf')]='';this[_0x9bf3('0x10')]='';this[_0x9bf3('0x11')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x9bf3('0x12')]='';this[_0x9bf3('0x13')]=_0x9bf3('0x14');this[_0x9bf3('0x15')]=0x0;this[_0x9bf3('0x16')]={};}module[_0x9bf3('0x17')]=QueueReport; \ No newline at end of file +var _0x7c5c=['queuecallerleaveAt','position','count','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables','type','inbound','calleridname'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x7c5c,0x9e));var _0xc7c5=function(_0x4aa850,_0x5d5bbf){_0x4aa850=_0x4aa850-0x0;var _0x1d4da7=_0x7c5c[_0x4aa850];return _0x1d4da7;};'use strict';function QueueReport(){this[_0xc7c5('0x0')]=_0xc7c5('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xc7c5('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xc7c5('0x3')]=null;this[_0xc7c5('0x4')]=0x1;this[_0xc7c5('0x5')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xc7c5('0x6')]=![];this['queuecallercompleteAt']=null;this[_0xc7c5('0x7')]=![];this[_0xc7c5('0x8')]=null;this[_0xc7c5('0x9')]=0x1;this[_0xc7c5('0xa')]='';this[_0xc7c5('0xb')]='';this[_0xc7c5('0xc')]='';this[_0xc7c5('0xd')]='';this[_0xc7c5('0xe')]='';this[_0xc7c5('0xf')]='';this[_0xc7c5('0x10')]='';this[_0xc7c5('0x11')]=0x0;this[_0xc7c5('0x12')]=![];this[_0xc7c5('0x13')]='';this[_0xc7c5('0x14')]=_0xc7c5('0x15');this['mohtime']=0x0;this[_0xc7c5('0x16')]={};}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 c4d1118..55efb87 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 _0xb678=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','password','clientSecret'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xb678,0x6a));var _0x8b67=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xb678[_0xc8a931];return _0x28bd27;};'use strict';function SalesforceAccount(_0x5c55ff){this['id']=_0x5c55ff['id']||0x0;this[_0x8b67('0x0')]=_0x5c55ff['name']||'';this['username']=_0x5c55ff[_0x8b67('0x1')]||'';this['remoteUri']=_0x5c55ff['remoteUri']||'';this[_0x8b67('0x2')]=_0x5c55ff['password']||'';this['clientId']=_0x5c55ff['clientId']||'';this[_0x8b67('0x3')]=_0x5c55ff[_0x8b67('0x3')]||'';this[_0x8b67('0x4')]=_0x5c55ff[_0x8b67('0x4')]||'';this[_0x8b67('0x5')]=_0x5c55ff[_0x8b67('0x5')]||_0x8b67('0x6');this[_0x8b67('0x7')]=_0x5c55ff[_0x8b67('0x7')]||'';this['Configurations']=_0x5c55ff[_0x8b67('0x8')]||{};}module[_0x8b67('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xc9b1=['clientSecret','securityToken','type','exports','name','username','remoteUri','password','clientId'];(function(_0xd0bebd,_0x1c8506){var _0x178995=function(_0x579865){while(--_0x579865){_0xd0bebd['push'](_0xd0bebd['shift']());}};_0x178995(++_0x1c8506);}(_0xc9b1,0xb8));var _0x1c9b=function(_0x2f786a,_0x2de5e8){_0x2f786a=_0x2f786a-0x0;var _0x298707=_0xc9b1[_0x2f786a];return _0x298707;};'use strict';function SalesforceAccount(_0x1aa23c){this['id']=_0x1aa23c['id']||0x0;this['name']=_0x1aa23c[_0x1c9b('0x0')]||'';this[_0x1c9b('0x1')]=_0x1aa23c[_0x1c9b('0x1')]||'';this[_0x1c9b('0x2')]=_0x1aa23c[_0x1c9b('0x2')]||'';this[_0x1c9b('0x3')]=_0x1aa23c[_0x1c9b('0x3')]||'';this[_0x1c9b('0x4')]=_0x1aa23c[_0x1c9b('0x4')]||'';this[_0x1c9b('0x5')]=_0x1aa23c[_0x1c9b('0x5')]||'';this[_0x1c9b('0x6')]=_0x1aa23c['securityToken']||'';this[_0x1c9b('0x7')]=_0x1aa23c[_0x1c9b('0x7')]||'integrationTab';this['serverUrl']=_0x1aa23c['serverUrl']||'';this['Configurations']=_0x1aa23c['Configurations']||{};}module[_0x1c9b('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 46bf76e..b943bf3 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 _0x273d=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x115e71,_0x2da149){var _0x5903c2=function(_0x1b1ff8){while(--_0x1b1ff8){_0x115e71['push'](_0x115e71['shift']());}};_0x5903c2(++_0x2da149);}(_0x273d,0x93));var _0xd273=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x273d[_0x433a86];return _0x23000c;};'use strict';function ServicenowAccount(_0x1b5b69){this['id']=_0x1b5b69['id']||0x0;this['name']=_0x1b5b69[_0xd273('0x0')]||'';this['username']=_0x1b5b69[_0xd273('0x1')]||'';this[_0xd273('0x2')]=_0x1b5b69[_0xd273('0x2')]||'';this[_0xd273('0x3')]=_0x1b5b69[_0xd273('0x3')]||'';this[_0xd273('0x4')]=_0x1b5b69[_0xd273('0x4')]||'';this[_0xd273('0x5')]=_0x1b5b69[_0xd273('0x5')]||{};}module[_0xd273('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x54ab=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x15781b,_0x2bf4ba){var _0x5efd2c=function(_0x4d5658){while(--_0x4d5658){_0x15781b['push'](_0x15781b['shift']());}};_0x5efd2c(++_0x2bf4ba);}(_0x54ab,0x1af));var _0xb54a=function(_0x3c6203,_0x228080){_0x3c6203=_0x3c6203-0x0;var _0x5ddf37=_0x54ab[_0x3c6203];return _0x5ddf37;};'use strict';function ServicenowAccount(_0x3ca8b7){this['id']=_0x3ca8b7['id']||0x0;this[_0xb54a('0x0')]=_0x3ca8b7[_0xb54a('0x0')]||'';this[_0xb54a('0x1')]=_0x3ca8b7[_0xb54a('0x1')]||'';this[_0xb54a('0x2')]=_0x3ca8b7['password']||'';this[_0xb54a('0x3')]=_0x3ca8b7['remoteUri']||'';this['serverUrl']=_0x3ca8b7[_0xb54a('0x4')]||'';this[_0xb54a('0x5')]=_0x3ca8b7[_0xb54a('0x5')]||{};}module[_0xb54a('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d5ac73e..67357e4 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 _0xe7c2=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0xe7c2,0x156));var _0x2e7c=function(_0x371ac3,_0x1e8971){_0x371ac3=_0x371ac3-0x0;var _0xafd474=_0xe7c2[_0x371ac3];return _0xafd474;};'use strict';function SugarcrmAccount(_0x3be108){this['id']=_0x3be108['id']||0x0;this[_0x2e7c('0x0')]=_0x3be108[_0x2e7c('0x0')]||'';this[_0x2e7c('0x1')]=_0x3be108[_0x2e7c('0x1')]||'';this[_0x2e7c('0x2')]=_0x3be108[_0x2e7c('0x2')]||'';this[_0x2e7c('0x3')]=_0x3be108[_0x2e7c('0x3')]||'';this[_0x2e7c('0x4')]=_0x3be108['serverUrl']||'';this['Configurations']=_0x3be108[_0x2e7c('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x1760=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x50de74,_0x2622e4){var _0x23d2f3=function(_0x4e246d){while(--_0x4e246d){_0x50de74['push'](_0x50de74['shift']());}};_0x23d2f3(++_0x2622e4);}(_0x1760,0x94));var _0x0176=function(_0x457e6c,_0x8aa556){_0x457e6c=_0x457e6c-0x0;var _0x3eeef9=_0x1760[_0x457e6c];return _0x3eeef9;};'use strict';function SugarcrmAccount(_0x1bc176){this['id']=_0x1bc176['id']||0x0;this[_0x0176('0x0')]=_0x1bc176[_0x0176('0x0')]||'';this[_0x0176('0x1')]=_0x1bc176[_0x0176('0x1')]||'';this[_0x0176('0x2')]=_0x1bc176[_0x0176('0x2')]||'';this[_0x0176('0x3')]=_0x1bc176[_0x0176('0x3')]||'';this[_0x0176('0x4')]=_0x1bc176[_0x0176('0x4')]||'';this[_0x0176('0x5')]=_0x1bc176[_0x0176('0x5')]||{};}module[_0x0176('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9caf756..3b2026f 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 _0xc3a1=['name','state','unknown','stateTime','exports'];(function(_0x38b0a1,_0x29da11){var _0x27d217=function(_0x6cf605){while(--_0x6cf605){_0x38b0a1['push'](_0x38b0a1['shift']());}};_0x27d217(++_0x29da11);}(_0xc3a1,0x11d));var _0x1c3a=function(_0x4df091,_0x57af5f){_0x4df091=_0x4df091-0x0;var _0x4b6de7=_0xc3a1[_0x4df091];return _0x4b6de7;};'use strict';function Telephone(_0x86f01c){this['id']=_0x86f01c['id']||0x0;this[_0x1c3a('0x0')]=_0x86f01c[_0x1c3a('0x0')]||'';this['accountcode']=_0x86f01c['accountcode']||'';this[_0x1c3a('0x1')]=_0x1c3a('0x2');this[_0x1c3a('0x3')]=0x0;this['status']=_0x1c3a('0x2');this['address']='';}module[_0x1c3a('0x4')]=Telephone; \ No newline at end of file +var _0x969e=['state','unknown','address','exports','name','accountcode'];(function(_0x48104c,_0x34cf8f){var _0x5e2060=function(_0x21692f){while(--_0x21692f){_0x48104c['push'](_0x48104c['shift']());}};_0x5e2060(++_0x34cf8f);}(_0x969e,0x136));var _0xe969=function(_0x266855,_0x163880){_0x266855=_0x266855-0x0;var _0x1c8757=_0x969e[_0x266855];return _0x1c8757;};'use strict';function Telephone(_0xec145d){this['id']=_0xec145d['id']||0x0;this[_0xe969('0x0')]=_0xec145d['name']||'';this[_0xe969('0x1')]=_0xec145d[_0xe969('0x1')]||'';this[_0xe969('0x2')]='unknown';this['stateTime']=0x0;this['status']=_0xe969('0x3');this[_0xe969('0x4')]='';}module[_0xe969('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a690919..79f7f51 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x253e84,_0x21ecba){var _0x17c7c9=function(_0x13d26c){while(--_0x13d26c){_0x253e84['push'](_0x253e84['shift']());}};_0x17c7c9(++_0x21ecba);}(_0xb10b,0x12a));var _0xbb10=function(_0x10b434,_0x521745){_0x10b434=_0x10b434-0x0;var _0x31050b=_0xb10b[_0x10b434];return _0x31050b;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x206e31,_0x5adf4f){var _0x3d7905=function(_0x2e493d){while(--_0x2e493d){_0x206e31['push'](_0x206e31['shift']());}};_0x3d7905(++_0x5adf4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 35a3632..bbde944 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x768b6f,_0x2b4ce5){var _0x6f7d73=function(_0x4904ea){while(--_0x4904ea){_0x768b6f['push'](_0x768b6f['shift']());}};_0x6f7d73(++_0x2b4ce5);}(_0x2032,0xd9));var _0x2203=function(_0x4acc8b,_0x422f04){_0x4acc8b=_0x4acc8b-0x0;var _0x182f0f=_0x2032[_0x4acc8b];return _0x182f0f;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x323a4f,_0x5bfea7){var _0x1b96d7=function(_0x103666){while(--_0x103666){_0x323a4f['push'](_0x323a4f['shift']());}};_0x1b96d7(++_0x5bfea7);}(_0x757a,0xde));var _0xa757=function(_0x41d472,_0xa0b08){_0x41d472=_0x41d472-0x0;var _0xa6779e=_0x757a[_0x41d472];return _0xa6779e;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 633299f..840013c 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 _0x373a=['unknown','status','registry','indexOf','split','port','refresh','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x9c1f48,_0x25da55){var _0x52ecd4=function(_0x47aef6){while(--_0x47aef6){_0x9c1f48['push'](_0x9c1f48['shift']());}};_0x52ecd4(++_0x25da55);}(_0x373a,0x1e7));var _0xa373=function(_0x1def6f,_0x1d4c97){_0x1def6f=_0x1def6f-0x0;var _0x3349be=_0x373a[_0x1def6f];return _0x3349be;};'use strict';function Trunk(_0x91f206){this['id']=_0x91f206['id']||0x0;this[_0xa373('0x0')]=_0x91f206[_0xa373('0x0')]||![];this[_0xa373('0x1')]=_0x91f206[_0xa373('0x1')]||'';this[_0xa373('0x2')]=_0xa373('0x3');this['stateTime']=0x0;this[_0xa373('0x4')]='unknown';this[_0xa373('0x5')]=_0x91f206[_0xa373('0x5')]&&_0x91f206[_0xa373('0x5')][_0xa373('0x6')](':')?_0x91f206['registry'][_0xa373('0x7')](':')[0x0]:'';this['host']='';this[_0xa373('0x8')]='';this['domain']='';this['domainport']='';this[_0xa373('0x9')]='';this['stateRegistry']=_0xa373('0x3');this[_0xa373('0xa')]='';this[_0xa373('0xb')]='';this[_0xa373('0xc')]=_0x91f206[_0xa373('0xc')]||'';}module[_0xa373('0xd')]=Trunk; \ No newline at end of file +var _0x995e=['domainport','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','indexOf','registry','split','host','port','domain'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x995e,0xa9));var _0xe995=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x995e[_0x20a584];return _0x4b41a8;};'use strict';function Trunk(_0xc81bd6){this['id']=_0xc81bd6['id']||0x0;this[_0xe995('0x0')]=_0xc81bd6[_0xe995('0x0')]||![];this['name']=_0xc81bd6[_0xe995('0x1')]||'';this['state']=_0xe995('0x2');this[_0xe995('0x3')]=0x0;this[_0xe995('0x4')]=_0xe995('0x2');this['registry']=_0xc81bd6['registry']&&_0xc81bd6['registry'][_0xe995('0x5')](':')?_0xc81bd6[_0xe995('0x6')][_0xe995('0x7')](':')[0x0]:'';this[_0xe995('0x8')]='';this[_0xe995('0x9')]='';this[_0xe995('0xa')]='';this[_0xe995('0xb')]='';this['refresh']='';this['stateRegistry']=_0xe995('0x2');this[_0xe995('0xc')]='';this[_0xe995('0xd')]='';this[_0xe995('0xe')]=_0xc81bd6[_0xe995('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index bc32759..3c1bdfe 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 _0xe2c2=['recordingFormat','none','exten'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2c2,0x197));var _0x2e2c=function(_0xc0696f,_0x112640){_0xc0696f=_0xc0696f-0x0;var _0x44b884=_0xe2c2[_0xc0696f];return _0x44b884;};'use strict';function voiceExtension(_0x4cedb0){this['id']=_0x4cedb0['id']||0x0;this[_0x2e2c('0x0')]=_0x4cedb0[_0x2e2c('0x0')]||'';this[_0x2e2c('0x1')]=_0x4cedb0[_0x2e2c('0x1')]||_0x2e2c('0x2');this['mandatoryDisposition']=_0x4cedb0['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x0b71=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0b71,0x150));var _0x10b7=function(_0x3fe197,_0xbb937c){_0x3fe197=_0x3fe197-0x0;var _0x214432=_0x0b71[_0x3fe197];return _0x214432;};'use strict';function voiceExtension(_0xbeeba6){this['id']=_0xbeeba6['id']||0x0;this['exten']=_0xbeeba6[_0x10b7('0x0')]||'';this[_0x10b7('0x1')]=_0xbeeba6['recordingFormat']||_0x10b7('0x2');this['mandatoryDisposition']=_0xbeeba6[_0x10b7('0x3')]||![];}module[_0x10b7('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 bd77724..f1b7bd3 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 _0x5808=['callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','waiting','talking','total','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x4db008,_0xb9de89){var _0x29644c=function(_0x40dffd){while(--_0x40dffd){_0x4db008['push'](_0x4db008['shift']());}};_0x29644c(++_0xb9de89);}(_0x5808,0x126));var _0x8580=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5808[_0x1992f1];return _0x413dfe;};'use strict';var statusDesc=[_0x8580('0x0'),'not_inuse','inuse',_0x8580('0x1'),'invalid',_0x8580('0x2'),_0x8580('0x3'),_0x8580('0x4'),_0x8580('0x5')];var monitorFormat={'wav':_0x8580('0x6'),'wav49':_0x8580('0x7'),'gsm':_0x8580('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x1fa38a){this['id']=_0x1fa38a['id']||0x0;this[_0x8580('0x9')]=_0x1fa38a[_0x8580('0x9')]||'';this[_0x8580('0xa')]=_0x1fa38a[_0x8580('0xa')]||'';this['type']=_0x1fa38a[_0x8580('0xb')]||'inbound';this[_0x8580('0xc')]=0x0;this[_0x8580('0xd')]=0x0;this[_0x8580('0xe')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x8580('0xf')]=0x0;this[_0x8580('0x10')]=0x0;this[_0x8580('0x11')]=0x0;this[_0x8580('0x12')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x8580('0x13')]=_0x1fa38a[_0x8580('0x13')]||![];this[_0x8580('0x14')]=_0x1fa38a[_0x8580('0x14')]||0xa;this[_0x8580('0x15')]=_0x1fa38a[_0x8580('0x15')]||'no';this[_0x8580('0x16')]=!![];this['message']='';this[_0x8580('0x17')]=0x0;this[_0x8580('0x18')]=0x0;this[_0x8580('0x19')]=_0x1fa38a[_0x8580('0x19')]||null;this[_0x8580('0x1a')]=_0x1fa38a['dialGlobalInterval']?_0x1fa38a[_0x8580('0x1a')]:null;this[_0x8580('0x1b')]=_0x1fa38a[_0x8580('0x1b')];this['dialMethod']=_0x1fa38a[_0x8580('0x1c')]||_0x8580('0x1d');this[_0x8580('0x1e')]=_0x1fa38a[_0x8580('0x1e')]||0x0;this[_0x8580('0x1f')]=_0x1fa38a[_0x8580('0x1f')]||0x0;this['dialPowerLevel']=_0x1fa38a[_0x8580('0x20')]||0x1;this[_0x8580('0x21')]=_0x1fa38a[_0x8580('0x21')]||_0x8580('0x22');this['dialPredictiveOptimizationPercentage']=_0x1fa38a['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x1fa38a[_0x8580('0x23')]||0x258;this[_0x8580('0x24')]=_0x1fa38a[_0x8580('0x24')]||_0x8580('0x25');this['dialOriginateCallerIdNumber']=_0x1fa38a[_0x8580('0x26')]||_0x8580('0x25');this[_0x8580('0x27')]=_0x1fa38a[_0x8580('0x27')]||0x1e;this['dialQueueOptions']=_0x1fa38a['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x1fa38a[_0x8580('0x28')]||0x3;this[_0x8580('0x29')]=_0x1fa38a[_0x8580('0x29')]||undefined;this['dialCongestionMaxRetry']=_0x1fa38a[_0x8580('0x2a')]||0x3;this[_0x8580('0x2b')]=_0x1fa38a[_0x8580('0x2b')]||0x96;this['dialBusyMaxRetry']=_0x1fa38a['dialBusyMaxRetry']||0x3;this[_0x8580('0x2c')]=_0x1fa38a['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x1fa38a[_0x8580('0x2d')]||0x3;this[_0x8580('0x2e')]=_0x1fa38a[_0x8580('0x2e')]||0x96;this[_0x8580('0x2f')]=_0x1fa38a[_0x8580('0x2f')]||0x3;this[_0x8580('0x30')]=_0x1fa38a[_0x8580('0x30')]||0x96;this[_0x8580('0x31')]=_0x1fa38a[_0x8580('0x31')]||0x3;this[_0x8580('0x32')]=_0x1fa38a[_0x8580('0x32')]||0x96;this[_0x8580('0x33')]=_0x1fa38a[_0x8580('0x33')]||0x3;this[_0x8580('0x34')]=_0x1fa38a[_0x8580('0x34')]||0x96;this['dialMachineMaxRetry']=_0x1fa38a[_0x8580('0x35')]||0x3;this[_0x8580('0x36')]=_0x1fa38a['dialMachineRetryFrequency']||0x96;this[_0x8580('0x37')]=_0x1fa38a[_0x8580('0x37')]||0x3;this[_0x8580('0x38')]=_0x1fa38a[_0x8580('0x38')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1fa38a[_0x8580('0x39')]||0x3;this[_0x8580('0x3a')]=_0x1fa38a[_0x8580('0x3a')]||0x4;this[_0x8580('0x3b')]=_0x1fa38a[_0x8580('0x3b')]?_0x1fa38a[_0x8580('0x3b')]:undefined;this[_0x8580('0x3c')]=_0x1fa38a[_0x8580('0x3c')]?_0x1fa38a['TrunkBackup']:undefined;this['dialPrefix']=_0x1fa38a[_0x8580('0x3d')]||undefined;this['Interval']=_0x1fa38a[_0x8580('0x3e')]?_0x1fa38a['Interval']:undefined;this[_0x8580('0x3f')]=_0x1fa38a['dialOrderByScheduledAt']||_0x8580('0x40');this[_0x8580('0x41')]=_0x1fa38a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8580('0x42')]=_0x1fa38a[_0x8580('0x42')]||undefined;this[_0x8580('0x43')]=strategy[_0x1fa38a[_0x8580('0x43')]]||_0x8580('0x44');this[_0x8580('0x45')]=!![];this[_0x8580('0x46')]=_0x1fa38a[_0x8580('0x46')]||![];this[_0x8580('0x47')]=_0x1fa38a['dialAMDInitialSilence'];this[_0x8580('0x48')]=_0x1fa38a[_0x8580('0x48')];this[_0x8580('0x49')]=_0x1fa38a['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1fa38a[_0x8580('0x4a')];this[_0x8580('0x4b')]=_0x1fa38a['dialAMDMinWordLength'];this[_0x8580('0x4c')]=_0x1fa38a[_0x8580('0x4c')];this['dialAMDMaximumNumberOfWords']=_0x1fa38a['dialAMDMaximumNumberOfWords'];this[_0x8580('0x4d')]=_0x1fa38a[_0x8580('0x4d')];this[_0x8580('0x4e')]=_0x1fa38a[_0x8580('0x4e')];this[_0x8580('0x4f')]=0x0;this[_0x8580('0x50')]=0x0;this[_0x8580('0x51')]=_0x1fa38a[_0x8580('0x51')];this[_0x8580('0x52')]=0x0;this[_0x8580('0x53')]=0x0;this[_0x8580('0x54')]=0x0;this[_0x8580('0x55')]=0x0;this[_0x8580('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x8580('0x57')]=0x0;this[_0x8580('0x58')]=0x0;this[_0x8580('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x8580('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x8580('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x8580('0x5c')]=undefined;this[_0x8580('0x5d')]=undefined;this[_0x8580('0x5e')]=undefined;this[_0x8580('0x5f')]=1.05;this[_0x8580('0x60')]=0x0;this[_0x8580('0x61')]=0x0;this[_0x8580('0x62')]=0x0;this[_0x8580('0x63')]=0x0;this[_0x8580('0x64')]=0x0;this[_0x8580('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x8580('0x66')]=0x0;this[_0x8580('0x67')]=_0x1fa38a[_0x8580('0x68')]||0x14;this[_0x8580('0x69')]=_0x1fa38a[_0x8580('0x68')]||0xa;this[_0x8580('0x6a')]=0x0;this[_0x8580('0x6b')]=0x0;this[_0x8580('0x6c')]=0x1;this[_0x8580('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x1fa38a['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x1fa38a['dialRecallInQueue']||![];this[_0x8580('0x6e')]=!!_0x1fa38a[_0x8580('0x6e')]||![];this['dialPreviewRecallmeReminder']=!!_0x1fa38a['dialPreviewRecallmeReminder']||![];this[_0x8580('0x6f')]=_0x1fa38a['dialQueueProject2']||undefined;this[_0x8580('0x70')]=_0x1fa38a['dialAgiAfterHangupClient']||![];this[_0x8580('0x71')]=_0x1fa38a['dialAgiAfterHangupAgent']||![];this[_0x8580('0xa')]=monitorFormat[_0x1fa38a[_0x8580('0xa')]]?monitorFormat[_0x1fa38a[_0x8580('0xa')]]:undefined;this[_0x8580('0x72')]=_0x1fa38a['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x1fa38a[_0x8580('0x73')]?_0x1fa38a[_0x8580('0x73')]:undefined;}module[_0x8580('0x74')]=VoiceQueue; \ No newline at end of file +var _0x13e8=['dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x37326d,_0x247d56){var _0x30b38b=function(_0x10ac5a){while(--_0x10ac5a){_0x37326d['push'](_0x37326d['shift']());}};_0x30b38b(++_0x247d56);}(_0x13e8,0xa6));var _0x813e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x13e8[_0x2c91e9];return _0x13f0ff;};'use strict';var statusDesc=[_0x813e('0x0'),_0x813e('0x1'),_0x813e('0x2'),_0x813e('0x3'),_0x813e('0x4'),'unavailable','ringing',_0x813e('0x5'),_0x813e('0x6')];var monitorFormat={'wav':_0x813e('0x7'),'wav49':_0x813e('0x8'),'gsm':_0x813e('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x14ede2){this['id']=_0x14ede2['id']||0x0;this[_0x813e('0xa')]=_0x14ede2[_0x813e('0xa')]||'';this['monitor_format']=_0x14ede2[_0x813e('0xb')]||'';this[_0x813e('0xc')]=_0x14ede2['type']||_0x813e('0xd');this[_0x813e('0xe')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0x813e('0xf')]=0x0;this['sumDuration']=0x0;this[_0x813e('0x10')]=0x0;this[_0x813e('0x11')]=0x0;this['unmanaged']=0x0;this[_0x813e('0x12')]=0x0;this[_0x813e('0x13')]=0x0;this[_0x813e('0x14')]=0x0;this[_0x813e('0x15')]=_0x14ede2[_0x813e('0x15')]||![];this[_0x813e('0x16')]=_0x14ede2['acwTimeout']||0xa;this[_0x813e('0x17')]=_0x14ede2['autopause']||'no';this[_0x813e('0x18')]=!![];this[_0x813e('0x19')]='';this['originated']=0x0;this[_0x813e('0x1a')]=0x0;this[_0x813e('0x1b')]=_0x14ede2[_0x813e('0x1b')]||null;this[_0x813e('0x1c')]=_0x14ede2[_0x813e('0x1c')]?_0x14ede2[_0x813e('0x1c')]:null;this[_0x813e('0x1d')]=_0x14ede2[_0x813e('0x1d')];this[_0x813e('0x1e')]=_0x14ede2[_0x813e('0x1e')]||'progressive';this['dialLimitChannel']=_0x14ede2['dialLimitChannel']||0x0;this[_0x813e('0x1f')]=_0x14ede2['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x14ede2[_0x813e('0x20')]||0x1;this['dialPredictiveOptimization']=_0x14ede2['dialPredictiveOptimization']||_0x813e('0x21');this[_0x813e('0x22')]=_0x14ede2[_0x813e('0x22')]||0.03;this['dialPredictiveInterval']=_0x14ede2[_0x813e('0x23')]||0x258;this[_0x813e('0x24')]=_0x14ede2[_0x813e('0x24')]||_0x813e('0x25');this[_0x813e('0x26')]=_0x14ede2[_0x813e('0x26')]||_0x813e('0x25');this[_0x813e('0x27')]=_0x14ede2['dialOriginateTimeout']||0x1e;this[_0x813e('0x28')]=_0x14ede2[_0x813e('0x28')]||_0x813e('0x29');this[_0x813e('0x2a')]=_0x14ede2[_0x813e('0x2a')]||0x3;this[_0x813e('0x2b')]=_0x14ede2[_0x813e('0x2b')]||undefined;this[_0x813e('0x2c')]=_0x14ede2['dialCongestionMaxRetry']||0x3;this[_0x813e('0x2d')]=_0x14ede2[_0x813e('0x2d')]||0x96;this['dialBusyMaxRetry']=_0x14ede2[_0x813e('0x2e')]||0x3;this['dialBusyRetryFrequency']=_0x14ede2[_0x813e('0x2f')]||0x96;this[_0x813e('0x30')]=_0x14ede2[_0x813e('0x30')]||0x3;this[_0x813e('0x31')]=_0x14ede2[_0x813e('0x31')]||0x96;this[_0x813e('0x32')]=_0x14ede2[_0x813e('0x32')]||0x3;this[_0x813e('0x33')]=_0x14ede2[_0x813e('0x33')]||0x96;this[_0x813e('0x34')]=_0x14ede2[_0x813e('0x34')]||0x3;this[_0x813e('0x35')]=_0x14ede2[_0x813e('0x35')]||0x96;this['dialAbandonedMaxRetry']=_0x14ede2['dialAbandonedMaxRetry']||0x3;this[_0x813e('0x36')]=_0x14ede2['dialAbandonedRetryFrequency']||0x96;this[_0x813e('0x37')]=_0x14ede2[_0x813e('0x37')]||0x3;this[_0x813e('0x38')]=_0x14ede2[_0x813e('0x38')]||0x96;this[_0x813e('0x39')]=_0x14ede2[_0x813e('0x39')]||0x3;this['dialAgentRejectRetryFrequency']=_0x14ede2[_0x813e('0x3a')]||0x96;this[_0x813e('0x3b')]=_0x14ede2[_0x813e('0x3b')]||0x3;this['dialGlobalMaxRetry']=_0x14ede2[_0x813e('0x3c')]||0x4;this['Trunk']=_0x14ede2[_0x813e('0x3d')]?_0x14ede2[_0x813e('0x3d')]:undefined;this[_0x813e('0x3e')]=_0x14ede2[_0x813e('0x3e')]?_0x14ede2[_0x813e('0x3e')]:undefined;this[_0x813e('0x3f')]=_0x14ede2[_0x813e('0x3f')]||undefined;this[_0x813e('0x40')]=_0x14ede2[_0x813e('0x40')]?_0x14ede2[_0x813e('0x40')]:undefined;this[_0x813e('0x41')]=_0x14ede2[_0x813e('0x41')]||'DESC';this[_0x813e('0x42')]=_0x14ede2[_0x813e('0x42')]||undefined;this['dialCutDigit']=_0x14ede2[_0x813e('0x43')]||undefined;this[_0x813e('0x44')]=strategy[_0x14ede2[_0x813e('0x44')]]||_0x813e('0x45');this[_0x813e('0x46')]=!![];this[_0x813e('0x47')]=_0x14ede2[_0x813e('0x47')]||![];this['dialAMDInitialSilence']=_0x14ede2[_0x813e('0x48')];this[_0x813e('0x49')]=_0x14ede2[_0x813e('0x49')];this[_0x813e('0x4a')]=_0x14ede2[_0x813e('0x4a')];this[_0x813e('0x4b')]=_0x14ede2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x14ede2[_0x813e('0x4c')];this[_0x813e('0x4d')]=_0x14ede2[_0x813e('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x14ede2[_0x813e('0x4e')];this[_0x813e('0x4f')]=_0x14ede2[_0x813e('0x4f')];this['dialAMDMaximumWordLength']=_0x14ede2[_0x813e('0x50')];this['outboundRejectCallsDay']=0x0;this[_0x813e('0x51')]=0x0;this[_0x813e('0x52')]=_0x14ede2[_0x813e('0x52')];this['outboundAnswerCallsDay']=0x0;this[_0x813e('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x813e('0x54')]=0x0;this[_0x813e('0x55')]=0x0;this[_0x813e('0x56')]=0x0;this[_0x813e('0x57')]=0x0;this[_0x813e('0x58')]=0x0;this[_0x813e('0x59')]=0x0;this[_0x813e('0x5a')]=0x0;this[_0x813e('0x5b')]=0x0;this[_0x813e('0x5c')]=0x0;this[_0x813e('0x5d')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x813e('0x5e')]=undefined;this[_0x813e('0x5f')]=1.05;this[_0x813e('0x60')]=0x0;this[_0x813e('0x61')]=0x0;this[_0x813e('0x62')]=0x0;this[_0x813e('0x63')]=0x0;this[_0x813e('0x64')]=0x0;this[_0x813e('0x65')]=0x0;this[_0x813e('0x66')]=0x0;this[_0x813e('0x67')]=0x0;this[_0x813e('0x68')]=_0x14ede2['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x813e('0x69')]=_0x14ede2[_0x813e('0x6a')]||0xa;this[_0x813e('0x6b')]=0x0;this[_0x813e('0x6c')]=0x0;this[_0x813e('0x6d')]=0x1;this[_0x813e('0x6e')]=0x0;this[_0x813e('0x6f')]=0x0;this[_0x813e('0x70')]=0x0;this[_0x813e('0x71')]=0x0;this['dialRecallMeTimeout']=_0x14ede2['dialRecallMeTimeout']||0x1e;this[_0x813e('0x72')]=_0x14ede2['dialRecallInQueue']||![];this[_0x813e('0x73')]=!!_0x14ede2[_0x813e('0x73')]||![];this[_0x813e('0x74')]=!!_0x14ede2[_0x813e('0x74')]||![];this[_0x813e('0x75')]=_0x14ede2['dialQueueProject2']||undefined;this[_0x813e('0x76')]=_0x14ede2[_0x813e('0x76')]||![];this[_0x813e('0x77')]=_0x14ede2[_0x813e('0x77')]||![];this[_0x813e('0xb')]=monitorFormat[_0x14ede2['monitor_format']]?monitorFormat[_0x14ede2[_0x813e('0xb')]]:undefined;this[_0x813e('0x78')]=_0x14ede2[_0x813e('0x78')]||![];this[_0x813e('0x79')]=_0x14ede2[_0x813e('0x79')]?_0x14ede2[_0x813e('0x79')]:undefined;}module[_0x813e('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a390299..73224c7 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 _0x8eb5=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x48aa18,_0x3c5c3a){var _0x544ec9=function(_0x29e207){while(--_0x29e207){_0x48aa18['push'](_0x48aa18['shift']());}};_0x544ec9(++_0x3c5c3a);}(_0x8eb5,0xe3));var _0x58eb=function(_0x264818,_0x335dd3){_0x264818=_0x264818-0x0;var _0x58f0cc=_0x8eb5[_0x264818];return _0x58f0cc;};'use strict';function VtigerAccount(_0x535bc3){this['id']=_0x535bc3['id']||0x0;this[_0x58eb('0x0')]=_0x535bc3[_0x58eb('0x0')]||'';this[_0x58eb('0x1')]=_0x535bc3[_0x58eb('0x1')]||'';this[_0x58eb('0x2')]=_0x535bc3[_0x58eb('0x2')]||'';this[_0x58eb('0x3')]=_0x535bc3[_0x58eb('0x3')]||'';this[_0x58eb('0x4')]=_0x535bc3['serverUrl']||'';this[_0x58eb('0x5')]=_0x535bc3[_0x58eb('0x5')]||{};}module[_0x58eb('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe673=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x434f2e,_0x68493e){var _0x76c0b9=function(_0x7db698){while(--_0x7db698){_0x434f2e['push'](_0x434f2e['shift']());}};_0x76c0b9(++_0x68493e);}(_0xe673,0xcd));var _0x3e67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe673[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x578ae6){this['id']=_0x578ae6['id']||0x0;this['name']=_0x578ae6[_0x3e67('0x0')]||'';this[_0x3e67('0x1')]=_0x578ae6[_0x3e67('0x1')]||'';this['accessKey']=_0x578ae6['accessKey']||'';this[_0x3e67('0x2')]=_0x578ae6['remoteUri']||'';this[_0x3e67('0x3')]=_0x578ae6[_0x3e67('0x3')]||'';this['Configurations']=_0x578ae6[_0x3e67('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index b6e11b6..0adc23b 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 _0x467c=['remoteUri','type','integrationTab','serverUrl','Configurations','exports','name','password'];(function(_0x277aa9,_0x4f674e){var _0x578d03=function(_0x221459){while(--_0x221459){_0x277aa9['push'](_0x277aa9['shift']());}};_0x578d03(++_0x4f674e);}(_0x467c,0xae));var _0xc467=function(_0x4302e6,_0xe15f87){_0x4302e6=_0x4302e6-0x0;var _0x539ace=_0x467c[_0x4302e6];return _0x539ace;};'use strict';function ZendeskAccount(_0x44e9db){this['id']=_0x44e9db['id']||0x0;this[_0xc467('0x0')]=_0x44e9db[_0xc467('0x0')]||'';this['username']=_0x44e9db['username']||'';this[_0xc467('0x1')]=_0x44e9db[_0xc467('0x1')]||'';this['token']=_0x44e9db['token']||'';this[_0xc467('0x2')]=_0x44e9db[_0xc467('0x2')]||'';this['authType']=_0x44e9db['authType']||'';this[_0xc467('0x3')]=_0x44e9db[_0xc467('0x3')]||_0xc467('0x4');this[_0xc467('0x5')]=_0x44e9db[_0xc467('0x5')]||'';this[_0xc467('0x6')]=_0x44e9db[_0xc467('0x6')]||{};}module[_0xc467('0x7')]=ZendeskAccount; \ No newline at end of file +var _0x084f=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x084f,0x14a));var _0xf084=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x084f[_0x484e36];return _0xafc85d;};'use strict';function ZendeskAccount(_0x1a9c64){this['id']=_0x1a9c64['id']||0x0;this[_0xf084('0x0')]=_0x1a9c64[_0xf084('0x0')]||'';this[_0xf084('0x1')]=_0x1a9c64[_0xf084('0x1')]||'';this[_0xf084('0x2')]=_0x1a9c64['password']||'';this[_0xf084('0x3')]=_0x1a9c64[_0xf084('0x3')]||'';this[_0xf084('0x4')]=_0x1a9c64[_0xf084('0x4')]||'';this[_0xf084('0x5')]=_0x1a9c64['authType']||'';this[_0xf084('0x6')]=_0x1a9c64[_0xf084('0x6')]||_0xf084('0x7');this[_0xf084('0x8')]=_0x1a9c64['serverUrl']||'';this['Configurations']=_0x1a9c64[_0xf084('0x9')]||{};}module[_0xf084('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3705b44..5872e50 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 _0x0d67=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x1324fc,_0x321dc2){var _0x842ec3=function(_0x2d0ab4){while(--_0x2d0ab4){_0x1324fc['push'](_0x1324fc['shift']());}};_0x842ec3(++_0x321dc2);}(_0x0d67,0x152));var _0x70d6=function(_0x1b4492,_0x24daf8){_0x1b4492=_0x1b4492-0x0;var _0x7ebb71=_0x0d67[_0x1b4492];return _0x7ebb71;};'use strict';function ZohoAccount(_0x463b70){this['id']=_0x463b70['id']||0x0;this[_0x70d6('0x0')]=_0x463b70[_0x70d6('0x0')]||'';this[_0x70d6('0x1')]=_0x463b70[_0x70d6('0x1')]||'';this[_0x70d6('0x2')]=_0x463b70['host']||'';this[_0x70d6('0x3')]=_0x463b70['zone']||'';this[_0x70d6('0x4')]=_0x463b70[_0x70d6('0x4')]||'';this[_0x70d6('0x5')]=_0x463b70[_0x70d6('0x5')]||'';this[_0x70d6('0x6')]=_0x463b70['serverUrl']||'';this[_0x70d6('0x7')]=_0x463b70[_0x70d6('0x7')]||'';this[_0x70d6('0x8')]=_0x463b70[_0x70d6('0x8')]||'';this['Configurations']=_0x463b70[_0x70d6('0x9')]||{};}module[_0x70d6('0xa')]=ZohoAccount; \ No newline at end of file +var _0xca23=['name','description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x7a0dc4,_0x3ad603){var _0x205820=function(_0x540c07){while(--_0x540c07){_0x7a0dc4['push'](_0x7a0dc4['shift']());}};_0x205820(++_0x3ad603);}(_0xca23,0xa0));var _0x3ca2=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xca23[_0x4a747d];return _0x3a5b5c;};'use strict';function ZohoAccount(_0x3ab07e){this['id']=_0x3ab07e['id']||0x0;this[_0x3ca2('0x0')]=_0x3ab07e[_0x3ca2('0x0')]||'';this['description']=_0x3ab07e[_0x3ca2('0x1')]||'';this['host']=_0x3ab07e['host']||'';this[_0x3ca2('0x2')]=_0x3ab07e[_0x3ca2('0x2')]||'';this['clientId']=_0x3ab07e[_0x3ca2('0x3')]||'';this['clientSecret']=_0x3ab07e[_0x3ca2('0x4')]||'';this[_0x3ca2('0x5')]=_0x3ab07e[_0x3ca2('0x5')]||'';this[_0x3ca2('0x6')]=_0x3ab07e[_0x3ca2('0x6')]||'';this[_0x3ca2('0x7')]=_0x3ab07e[_0x3ca2('0x7')]||'';this[_0x3ca2('0x8')]=_0x3ab07e['Configurations']||{};}module[_0x3ca2('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9bcc657..0eeb78b 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 _0x1893=['type','queue','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','idContact','name'];(function(_0x2f4098,_0x9d1898){var _0x3ae0b7=function(_0x540e66){while(--_0x540e66){_0x2f4098['push'](_0x2f4098['shift']());}};_0x3ae0b7(++_0x9d1898);}(_0x1893,0xa2));var _0x3189=function(_0x4135e7,_0x14f68b){_0x4135e7=_0x4135e7-0x0;var _0x3032f9=_0x1893[_0x4135e7];return _0x3032f9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3189('0x0'));function checkNameSurname(_0x3aec2b,_0x1b12ad,_0x106df4){var _0x10c189='';if(!_[_0x3189('0x1')](_0x1b12ad)&&_0x3189('0x2')===typeof _0x1b12ad){_0x10c189+=_0x1b12ad;}if(!_['isNil'](_0x106df4)&&_0x3189('0x2')===typeof _0x106df4){_0x10c189+='\x20'+_0x106df4;}if(_0x10c189!==''){return _0x10c189;}return _0x3aec2b;}function Action(_0x4faebf,_0x2333e6,_0x4080a9,_0x77c566,_0x118970){this[_0x3189('0x3')]=_0x4080a9||undefined;this[_0x3189('0x4')]=_0x4faebf['id'];this['queue']=_0x2333e6[_0x3189('0x5')];this['type']=_0x2333e6[_0x3189('0x6')];this['campaigntype']=_0x3189('0x7');this[_0x3189('0x8')]=![];this[_0x3189('0x9')]=_[_0x3189('0x1')](_0x4faebf['Agent'])?undefined:_0x4faebf[_0x3189('0xa')][_0x3189('0x5')];this[_0x3189('0xb')]=this[_0x3189('0x9')]?util[_0x3189('0xc')]('SIP/%s',this[_0x3189('0x9')]):_0x77c566||undefined;this[_0x3189('0xd')]=checkNameSurname(_0x4faebf[_0x3189('0xe')][_0x3189('0xf')],_0x4faebf[_0x3189('0xe')][_0x3189('0x10')],_0x4faebf[_0x3189('0xe')][_0x3189('0x11')]);this['active']=_0x4faebf[_0x3189('0x12')]||![];this[_0x3189('0x13')]=_0x4faebf[_0x3189('0xf')];this[_0x3189('0x14')]=_0x4faebf['scheduledat'];this[_0x3189('0x15')]=_0x4faebf['countbusyretry']||0x0;this['countcongestionretry']=_0x4faebf[_0x3189('0x16')]||0x0;this['countnoanswerretry']=_0x4faebf[_0x3189('0x17')]||0x0;this[_0x3189('0x18')]=(_0x4faebf[_0x3189('0x15')]||0x0)+(_0x4faebf[_0x3189('0x16')]||0x0)+(_0x4faebf['countnoanswerretry']||0x0)+(_0x4faebf[_0x3189('0x19')]||0x0)+(_0x4faebf[_0x3189('0x1a')]||0x0)+(_0x4faebf[_0x3189('0x1b')]||0x0)+(_0x4faebf['countmachineretry']||0x0)+(_0x4faebf[_0x3189('0x1c')]||0x0);this[_0x3189('0x19')]=_0x4faebf[_0x3189('0x19')]||0x0;this[_0x3189('0x1a')]=_0x4faebf[_0x3189('0x1a')]||0x0;this['countabandonedretry']=_0x4faebf[_0x3189('0x1b')]||0x0;this[_0x3189('0x1d')]=_0x4faebf[_0x3189('0x1d')]||0x0;this['countagentrejectretry']=_0x4faebf[_0x3189('0x1c')]||0x0;this['callback']=_0x4faebf[_0x3189('0x1e')];this[_0x3189('0x1f')]=_0x4faebf[_0x3189('0x1f')];this[_0x3189('0x20')]=_0x4faebf[_0x3189('0x20')];this[_0x3189('0x21')]=_0x4faebf['recallme'];this['ContactId']=_0x4faebf[_0x3189('0x22')];this[_0x3189('0x23')]=_0x4faebf[_0x3189('0x23')];this[_0x3189('0x24')]=_[_0x3189('0x1')](_0x4faebf[_0x3189('0xa')])?_0x4faebf[_0x3189('0x24')]:_0x4faebf[_0x3189('0xa')]['id'];this[_0x3189('0x25')]=_0x4faebf[_0x3189('0x25')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x3189('0x26')]=function(){return util[_0x3189('0xc')](_0x3189('0x27'),this[_0x3189('0xd')],this[_0x3189('0x28')]);};module[_0x3189('0x29')]=Action; \ No newline at end of file +var _0xdd4f=['SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','isNil','string','idContact','name','type','queue','membername','Agent','channelAgent','format'];(function(_0x15fa77,_0x93eaff){var _0x1385ff=function(_0x165e02){while(--_0x165e02){_0x15fa77['push'](_0x15fa77['shift']());}};_0x1385ff(++_0x93eaff);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2168e4,_0x2f5602){_0x2168e4=_0x2168e4-0x0;var _0x4c647c=_0xdd4f[_0x2168e4];return _0x4c647c;};'use strict';var util=require(_0xfdd4('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x55d8f9,_0x291ae7,_0x19cda7){var _0x5918d1='';if(!_[_0xfdd4('0x1')](_0x291ae7)&&_0xfdd4('0x2')===typeof _0x291ae7){_0x5918d1+=_0x291ae7;}if(!_[_0xfdd4('0x1')](_0x19cda7)&&'string'===typeof _0x19cda7){_0x5918d1+='\x20'+_0x19cda7;}if(_0x5918d1!==''){return _0x5918d1;}return _0x55d8f9;}function Action(_0x398015,_0x43cbcf,_0x30e080,_0x307ac6,_0x3c72d4){this['uniqueid']=_0x30e080||undefined;this[_0xfdd4('0x3')]=_0x398015['id'];this['queue']=_0x43cbcf[_0xfdd4('0x4')];this[_0xfdd4('0x5')]=_0x43cbcf[_0xfdd4('0x5')];this['campaigntype']=_0xfdd4('0x6');this['dialAnswer']=![];this[_0xfdd4('0x7')]=_[_0xfdd4('0x1')](_0x398015[_0xfdd4('0x8')])?undefined:_0x398015[_0xfdd4('0x8')][_0xfdd4('0x4')];this[_0xfdd4('0x9')]=this[_0xfdd4('0x7')]?util[_0xfdd4('0xa')](_0xfdd4('0xb'),this[_0xfdd4('0x7')]):_0x307ac6||undefined;this[_0xfdd4('0xc')]=checkNameSurname(_0x398015['Contact'][_0xfdd4('0xd')],_0x398015[_0xfdd4('0xe')][_0xfdd4('0xf')],_0x398015['Contact'][_0xfdd4('0x10')]);this['active']=_0x398015[_0xfdd4('0x11')]||![];this[_0xfdd4('0x12')]=_0x398015[_0xfdd4('0xd')];this[_0xfdd4('0x13')]=_0x398015[_0xfdd4('0x13')];this['countbusyretry']=_0x398015['countbusyretry']||0x0;this['countcongestionretry']=_0x398015[_0xfdd4('0x14')]||0x0;this[_0xfdd4('0x15')]=_0x398015[_0xfdd4('0x15')]||0x0;this[_0xfdd4('0x16')]=(_0x398015[_0xfdd4('0x17')]||0x0)+(_0x398015[_0xfdd4('0x14')]||0x0)+(_0x398015[_0xfdd4('0x15')]||0x0)+(_0x398015[_0xfdd4('0x18')]||0x0)+(_0x398015[_0xfdd4('0x19')]||0x0)+(_0x398015['countabandonedretry']||0x0)+(_0x398015[_0xfdd4('0x1a')]||0x0)+(_0x398015[_0xfdd4('0x1b')]||0x0);this[_0xfdd4('0x18')]=_0x398015[_0xfdd4('0x18')]||0x0;this[_0xfdd4('0x19')]=_0x398015[_0xfdd4('0x19')]||0x0;this[_0xfdd4('0x1c')]=_0x398015[_0xfdd4('0x1c')]||0x0;this['countmachineretry']=_0x398015[_0xfdd4('0x1a')]||0x0;this[_0xfdd4('0x1b')]=_0x398015[_0xfdd4('0x1b')]||0x0;this[_0xfdd4('0x1d')]=_0x398015[_0xfdd4('0x1d')];this[_0xfdd4('0x1e')]=_0x398015[_0xfdd4('0x1e')];this[_0xfdd4('0x1f')]=_0x398015['callbackat'];this[_0xfdd4('0x20')]=_0x398015[_0xfdd4('0x20')];this[_0xfdd4('0x21')]=_0x398015['ContactId'];this[_0xfdd4('0x22')]=_0x398015[_0xfdd4('0x22')];this[_0xfdd4('0x23')]=_[_0xfdd4('0x1')](_0x398015[_0xfdd4('0x8')])?_0x398015['UserId']:_0x398015[_0xfdd4('0x8')]['id'];this[_0xfdd4('0x24')]=_0x398015[_0xfdd4('0x24')];this[_0xfdd4('0x25')]='';this[_0xfdd4('0x26')]='';}Action[_0xfdd4('0x27')][_0xfdd4('0x28')]=function(){return util[_0xfdd4('0xa')]('\x22%s\x22\x20<%s>',this[_0xfdd4('0xc')],this[_0xfdd4('0x29')]);};module[_0xfdd4('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index db38f6c..f9c18d6 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 _0x2675=['countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','statedesc','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangBusyFactor','startProgressive','Trunk','name','active','callerid','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','available','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','clearZombieChannel','recallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','logger2','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','NOANSWER','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','countnoanswerretry'];(function(_0x5d0746,_0x511b2d){var _0x19a392=function(_0x111382){while(--_0x111382){_0x5d0746['push'](_0x5d0746['shift']());}};_0x19a392(++_0x511b2d);}(_0x2675,0x75));var _0x5267=function(_0x121c35,_0x5689d6){_0x121c35=_0x121c35-0x0;var _0x126c65=_0x2675[_0x121c35];return _0x126c65;};'use strict';var util=require(_0x5267('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x5267('0x1'));var md5=require(_0x5267('0x2'));var Redis=require('ioredis');var config=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('preview');var loggerAction=require(_0x5267('0x4'))(_0x5267('0x5'));var ami=require(_0x5267('0x6'));var rpcDb=require(_0x5267('0x7'));var cmHopperAdditionalPhone=require(_0x5267('0x8'));var Action=require(_0x5267('0x9'));var ut=require('./util/util');config[_0x5267('0xa')]=_[_0x5267('0xb')](config['redis'],{'host':_0x5267('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5267('0xa')]));var Sequence=function(){};Sequence[_0x5267('0xd')][_0x5267('0xe')]=function(_0x534c2b){this[_0x5267('0xf')]=this['tail']?this[_0x5267('0xf')]['finally'](_0x534c2b):_0x534c2b();};function Preview(_0x31ea34){this[_0x5267('0x10')]=new Sequence();this[_0x5267('0x11')]=_0x31ea34[_0x5267('0x12')];this[_0x5267('0x13')]=_0x31ea34[_0x5267('0x13')];this[_0x5267('0x14')]={};this[_0x5267('0x15')]=_0x31ea34[_0x5267('0x15')];this[_0x5267('0x16')]=0x0;ami['on'](_0x5267('0x17'),this[_0x5267('0x18')][_0x5267('0x19')](this));ami['on']('hangup',this['syncHangup'][_0x5267('0x19')](this));ami['on'](_0x5267('0x1a'),this[_0x5267('0x1b')][_0x5267('0x19')](this));ami['on'](_0x5267('0x1c'),this[_0x5267('0x1d')][_0x5267('0x19')](this));ami['on'](_0x5267('0x1e'),this[_0x5267('0x1f')][_0x5267('0x19')](this));ami['on'](_0x5267('0x20'),this[_0x5267('0x21')]['bind'](this));ami['on'](_0x5267('0x22'),this[_0x5267('0x23')]['bind'](this));ami['on'](_0x5267('0x24'),this['syncBlindTransfer'][_0x5267('0x19')](this));this[_0x5267('0x25')](this[_0x5267('0x11')]);}function emit(_0x2a9f99,_0x5ca9c6,_0x4dd637){io['to'](_0x2a9f99)[_0x5267('0x26')](_0x5ca9c6,_0x4dd637);}function emitCampaignPreview(_0x5aebdd){if(_0x5aebdd[_0x5267('0x27')]===_0x5267('0x28')){var _0x3b53ac={'id':_0x5aebdd['id'],'name':_0x5aebdd['name'],'strategy':_0x5aebdd['strategy'],'answered':_0x5aebdd['answered'],'available':_0x5aebdd['available'],'loggedIn':_0x5aebdd['loggedIn'],'pTalking':_0x5aebdd[_0x5267('0x29')],'sumBillable':_0x5aebdd[_0x5267('0x2a')],'sumDuration':_0x5aebdd[_0x5267('0x2b')],'sumHoldTime':_0x5aebdd[_0x5267('0x2c')]||0x0,'talking':_0x5aebdd[_0x5267('0x2d')],'total':_0x5aebdd[_0x5267('0x2e')],'type':_0x5aebdd[_0x5267('0x27')],'unmanaged':_0x5aebdd[_0x5267('0x2f')],'abandoned':_0x5aebdd[_0x5267('0x30')],'waiting':_0x5aebdd['waiting'],'loggedInDb':_0x5aebdd['loggedInDb'],'dialActive':_0x5aebdd[_0x5267('0x31')],'dialMethod':_0x5aebdd[_0x5267('0x32')],'dialOriginateCallerIdName':_0x5aebdd['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5aebdd[_0x5267('0x33')],'dialOriginateTimeout':_0x5aebdd['dialOriginateTimeout'],'dialPrefix':_0x5aebdd['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5aebdd[_0x5267('0x34')],'outboundAnswerCallsDay':_0x5aebdd[_0x5267('0x35')],'outboundBlacklistCallsDay':_0x5aebdd[_0x5267('0x36')],'outboundBusyCallsDay':_0x5aebdd[_0x5267('0x37')],'outboundCongestionCallsDay':_0x5aebdd[_0x5267('0x38')],'outboundDropCallsDayACS':_0x5aebdd['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5aebdd['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5aebdd[_0x5267('0x39')],'outboundNoAnswerCallsDay':_0x5aebdd[_0x5267('0x3a')],'outboundNoSuchCallsDay':_0x5aebdd[_0x5267('0x3b')],'outboundOriginateFailureCallsDay':_0x5aebdd['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5aebdd['outboundReCallsDay'],'outboundRejectCallsDay':_0x5aebdd[_0x5267('0x3c')],'outboundUnknownCallsDay':_0x5aebdd[_0x5267('0x3d')],'outboundAbandonedCallsDay':_0x5aebdd[_0x5267('0x3e')],'predictiveIntervalAnsweredCalls':_0x5aebdd['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5aebdd['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5aebdd[_0x5267('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x5aebdd[_0x5267('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x5aebdd[_0x5267('0x41')],'predictiveIntervalErlangCalls':_0x5aebdd[_0x5267('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x5aebdd['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5aebdd[_0x5267('0x43')],'predictiveIntervalMultiplicativeFactor':_0x5aebdd[_0x5267('0x44')],'predictiveIntervalPauses':_0x5aebdd[_0x5267('0x45')],'predictiveIntervalAvailable':_0x5aebdd[_0x5267('0x46')],'predictiveIntervalTotalCalls':_0x5aebdd[_0x5267('0x47')],'message':_0x5aebdd[_0x5267('0x48')],'originated':_0x5aebdd[_0x5267('0x49')],'erlangCalls':_0x5aebdd[_0x5267('0x4a')],'erlangCallToSecond':_0x5aebdd['erlangCallToSecond'],'erlangAbandonmentRate':_0x5aebdd['erlangAbandonmentRate'],'erlangBusyFactor':_0x5aebdd[_0x5267('0x4b')],'startPredictive':_0x5aebdd['startPredictive'],'startProgressive':_0x5aebdd[_0x5267('0x4c')]};if(_0x5aebdd[_0x5267('0x4d')]){_0x3b53ac[_0x5267('0x4d')]={'id':_0x5aebdd[_0x5267('0x4d')]['id'],'name':_0x5aebdd['Trunk'][_0x5267('0x4e')],'active':_0x5aebdd[_0x5267('0x4d')][_0x5267('0x4f')],'callerid':_0x5aebdd[_0x5267('0x4d')][_0x5267('0x50')]};}if(_0x5aebdd[_0x5267('0x51')]){_0x3b53ac[_0x5267('0x51')]={'id':_0x5aebdd[_0x5267('0x51')]['id'],'name':_0x5aebdd['Interval'][_0x5267('0x4e')]};}var _0x4fdee0=md5(JSON[_0x5267('0x52')](_0x3b53ac));if(_0x5aebdd[_0x5267('0x2')]!==_0x4fdee0){_0x5aebdd[_0x5267('0x2')]=_0x4fdee0;emit(util[_0x5267('0x53')](_0x5267('0x54'),_0x3b53ac[_0x5267('0x4e')]),_0x5267('0x55'),_0x3b53ac);}}}function emitVoiceQueueChannelRemove(_0x4f7961){logger[_0x5267('0x56')](_0x5267('0x57'),JSON[_0x5267('0x52')](_0x4f7961));emit(util[_0x5267('0x53')](_0x5267('0x54'),_0x4f7961[_0x5267('0x4e')]),_0x5267('0x58'),_0x4f7961);io['emit'](_0x5267('0x59'),_0x4f7961);}function notSendMessagesQueue(_0x5ef02e){if(_0x5ef02e[_0x5267('0x5a')]){if(_0x5ef02e['originated']===0x0&&_0x5ef02e['pTalking']===0x0){_0x5ef02e['sendMessageOneNotActive']=![];_0x5ef02e[_0x5267('0x5b')]=0x0;_0x5ef02e['paused']=0x0;_0x5ef02e[_0x5267('0x48')]=_0x5267('0x5c');ut[_0x5267('0x5d')](_0x5267('0x5e'),_0x5ef02e['name']+_0x5267('0x5f'));}else{_0x5ef02e[_0x5267('0x48')]='DEACTIVATED';ut['logger'](_0x5267('0x5e'),_0x5ef02e['name']+_0x5267('0x60'));}emitCampaignPreview(_0x5ef02e);}}Preview[_0x5267('0xd')][_0x5267('0x25')]=function(){var _0x3e0add=this;setInterval(function(){_0x3e0add[_0x5267('0x61')]();},0x7cf);};Preview[_0x5267('0xd')][_0x5267('0x61')]=function(){var _0x5697b3=this['campaignsPreview'];this[_0x5267('0x16')]+=0x1;for(var _0x56e627 in _0x5697b3){if(_0x5697b3[_0x5267('0x62')](_0x56e627)&&(_0x5697b3[_0x56e627][_0x5267('0x32')]==='preview'||_0x5697b3[_0x56e627][_0x5267('0x32')]===_0x5267('0x63'))&&_0x5697b3[_0x56e627][_0x5267('0x27')]===_0x5267('0x28')){if(this[_0x5267('0x16')]>0x7){this[_0x5267('0x16')]=0x0;this[_0x5267('0x64')]();}}if(_0x5697b3[_0x5267('0x62')](_0x56e627)&&_0x5697b3[_0x56e627][_0x5267('0x32')]==='preview'&&_0x5697b3[_0x56e627][_0x5267('0x27')]===_0x5267('0x28')){if(_0x5697b3[_0x56e627][_0x5267('0x31')]){this[_0x5267('0x65')](_0x5697b3[_0x56e627]);if(_0x5697b3[_0x56e627][_0x5267('0x66')])this['recallMe'](_0x5697b3[_0x56e627]);}else{notSendMessagesQueue(_0x5697b3[_0x56e627]);}}}};Preview[_0x5267('0xd')]['clearZombieChannel']=function(_0x21e2cb){var _0x5cda8c=this;this['sequence'][_0x5267('0xe')](function(){if(!_['isNil'](_0x5cda8c[_0x5267('0x14')][_0x21e2cb])){loggerAction[_0x5267('0x56')](_0x5267('0x67'),_0x21e2cb,_0x5267('0x68'),_0x5cda8c['actions'][_0x21e2cb][_0x5267('0x69')],'originated:\x20',JSON['stringify'](_0x5cda8c[_0x5267('0x11')][_0x5cda8c[_0x5267('0x14')][_0x21e2cb]['queue']]['originated']),_0x5267('0x6a'),JSON[_0x5267('0x52')](_0x5cda8c[_0x5267('0x11')][_0x5cda8c[_0x5267('0x14')][_0x21e2cb][_0x5267('0x69')]][_0x5267('0x29')]),JSON[_0x5267('0x52')](_0x5cda8c[_0x5267('0x14')][_0x21e2cb][_0x5267('0x6b')]),JSON[_0x5267('0x52')](_[_0x5267('0x6c')](_0x5cda8c[_0x5267('0x14')][_0x21e2cb],[_0x5267('0x6d'),_0x5267('0x6e'),'VoiceQueueId',_0x5267('0x6f')])));return ami[_0x5267('0x70')]({'action':_0x5267('0x71'),'channel':_0x5cda8c['actions'][_0x21e2cb][_0x5267('0x72')]})[_0x5267('0x73')](function(_0x31b722){if(_0x31b722[_0x5267('0x48')]===_0x5267('0x74')){setTimeout(function(){if(_0x5cda8c[_0x5267('0x14')][_0x21e2cb]){ut['updateOriginated'](_0x5cda8c[_0x5267('0x11')][_0x5cda8c['actions'][_0x21e2cb][_0x5267('0x69')]],_0x5267('0x75'));if(_0x5cda8c[_0x5267('0x14')][_0x21e2cb][_0x5267('0x6b')]===!![]){ut[_0x5267('0x76')](_0x5cda8c[_0x5267('0x11')][_0x5cda8c[_0x5267('0x14')][_0x21e2cb]['queue']],'[clearZombieChannel]');ut[_0x5267('0x77')](_0x5267('0x78')+_0x21e2cb,_0x5cda8c['actions'][_0x21e2cb][_0x5267('0x69')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x21e2cb,_0x5cda8c[_0x5267('0x14')][_0x21e2cb][_0x5267('0x69')]);delete _0x5cda8c[_0x5267('0x14')][_0x21e2cb];}},0x2328);}});}});};Preview[_0x5267('0xd')][_0x5267('0x64')]=function(){var _0x3e7e6a=this;loggerAction[_0x5267('0x56')](_0x5267('0x79'),_[_0x5267('0x7a')](this[_0x5267('0x14')]));for(var _0x512c61 in this[_0x5267('0x14')]){if(_0x3e7e6a[_0x5267('0x14')][_0x5267('0x62')](_0x512c61)){_0x3e7e6a[_0x5267('0x7b')](_0x512c61);}}};Preview[_0x5267('0xd')][_0x5267('0x7c')]=function(_0x552211){var _0x195575=this;rpcDb['getContactRecallMe'](_0x552211['id'],ut[_0x5267('0x7d')](this[_0x5267('0x15')]))[_0x5267('0x7e')](function(_0x4a72c3){if(!_[_0x5267('0x7f')](_0x4a72c3)){for(var _0x161dab=0x0;_0x161dab<_0x4a72c3[_0x5267('0x80')];_0x161dab+=0x1){if(ut[_0x5267('0x81')](_0x4a72c3[_0x161dab][_0x5267('0x82')])<_0x552211[_0x5267('0x83')]*0x3c){if(_0x4a72c3[_0x161dab]['Agent']&&!_0x4a72c3[_0x161dab][_0x5267('0x84')][_0x5267('0x85')]){_0x195575[_0x5267('0x86')](_0x4a72c3[_0x161dab]['id'])[_0x5267('0x7e')](ut['logger2']('[RecallMe]'))[_0x5267('0x73')](ut['logger2'](_0x5267('0x87')));}else{rpcDb[_0x5267('0x88')](_0x4a72c3[_0x161dab]['id']);}}else{var _0x4e3771=new Action(_0x4a72c3[_0x161dab],_0x552211);_0x4e3771['starttime']=moment()[_0x5267('0x53')](_0x5267('0x89'));_0x552211[_0x5267('0x8a')]+=0x1;ut['logCustomer'](_0x4e3771,0x17,_0x5267('0x8b'));if(_0x552211[_0x5267('0x8c')]){rpcDb[_0x5267('0x8d')](ut[_0x5267('0x8e')](_0x4a72c3[_0x161dab]));rpcDb['createCustomerHistory'](_0x4e3771,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x4e3771,0x16,_0x5267('0x8f'));rpcDb[_0x5267('0x90')](_0x4e3771,_0x5267('0x91'));rpcDb[_0x5267('0x92')](_0x4e3771,_0x5267('0x91'));}}}}})[_0x5267('0x73')](ut[_0x5267('0x93')](_0x5267('0x94')));};Preview['prototype'][_0x5267('0x65')]=function(_0x667b5d){_0x667b5d['sendMessageOneNotActive']=!![];if(ut[_0x5267('0x95')](_0x667b5d[_0x5267('0x96')])){_0x667b5d[_0x5267('0x48')]=_0x5267('0x97');}else if(!ut[_0x5267('0x98')](_0x667b5d[_0x5267('0x31')])){_0x667b5d['message']=_0x5267('0x5c');}else if(!this[_0x5267('0x99')](_0x667b5d[_0x5267('0x4d')])){if(!this[_0x5267('0x99')](_0x667b5d[_0x5267('0x9a')])){_0x667b5d[_0x5267('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x667b5d[_0x5267('0x48')]=_0x5267('0x9b');}}else{_0x667b5d[_0x5267('0x48')]=_0x5267('0x9b');}emitCampaignPreview(_0x667b5d);};Preview[_0x5267('0xd')][_0x5267('0x9c')]=function(_0x47d359,_0x283423,_0x41299c){var _0x9aef0=this;var _0x3bedcf=this['actions'][_0x283423];var _0x516e6e=this['campaignsPreview'][_0x3bedcf[_0x5267('0x69')]];var _0x5cca85;var _0xd7789e=![];var _0x580748=0x2;var _0x3992b2=0x3;if(_0x516e6e){switch(_0x41299c){case'1':_0x516e6e[_0x5267('0x3b')]+=0x1;_0x3bedcf[_0x5267('0x9d')]+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0x0,_0x5267('0xa1'));ami[_0x5267('0x26')]('custom:agentnosuchnumber',ut['buildObj'](_0x3bedcf,'nosuchnumber'));rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xa2'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'0',_0x516e6e)[_0x5267('0x7e')](function(_0x4974d1){_0xd7789e=_0x4974d1[_0x5267('0xa4')]==0x1;_0x580748=_0x516e6e[_0x5267('0xa5')];_0x3992b2=_0x516e6e[_0x5267('0xa6')];if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e['dialGlobalMaxRetry']){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb['createCustomerFinal'](_0x5cca85,_0x5267('0xa9'));}else{if(_0x3bedcf[_0x5267('0x9d')]>=_0x516e6e['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x3bedcf,_0x5267('0xa9'));}else{rpcDb[_0x5267('0xaa')](ut['scheduledAt'](_0x3bedcf,'countnosuchnumberretry',_0x516e6e[_0x5267('0xa5')]),_0x3bedcf[_0x5267('0xab')],_0x3bedcf[_0x5267('0xac')]);}}delete this[_0x5267('0x14')][_0x47d359[_0x5267('0xad')]];}else{_0x3bedcf['countnosuchnumberretry']++;logger[_0x5267('0x56')](_0x5267('0xae'),_0x3bedcf['countnosuchnumberretry']);logger[_0x5267('0x56')]('id',_0x3bedcf[_0x5267('0xaf')]);_0x9aef0[_0x5267('0xb0')]({'id':_0x3bedcf[_0x5267('0xaf')],'field':{'countnosuchnumberretry':_0x3bedcf[_0x5267('0x9d')]}})[_0x5267('0x7e')](function(){_0x9aef0[_0x5267('0xb1')](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});break;case'ANSWER':var _0x4fdd81=moment()[_0x5267('0x53')](_0x5267('0x89'));_0x3bedcf[_0x5267('0xb2')]=_0x4fdd81;_0x3bedcf[_0x5267('0xb3')]=_0x4fdd81;_0x3bedcf['dialAnswer']=!![];_0x516e6e[_0x5267('0x29')]+=0x1;logger['info'](_0x5267('0xb4'),_0x3bedcf[_0x5267('0xb5')],_0x5267('0xb6'),_0x516e6e[_0x5267('0x4e')],'pTalking:\x20',_0x516e6e['pTalking']);ami[_0x5267('0x26')](_0x5267('0xb7'),ut[_0x5267('0xb8')](_0x3bedcf,_0x5267('0xb9'),this[_0x5267('0x11')][_0x3bedcf[_0x5267('0x69')]]));if(_0x516e6e['acw']){ami[_0x5267('0x26')]('custom:agentConnectPreview',ut[_0x5267('0xba')](_0x3bedcf));}break;case'16':ami['emit'](_0x5267('0xbb'),ut[_0x5267('0xb8')](_0x3bedcf,_0x5267('0xbc'),this[_0x5267('0x11')][_0x3bedcf[_0x5267('0x69')]]));emitVoiceQueueChannelRemove(ut[_0x5267('0xb8')](_0x3bedcf,_0x5267('0xbc')));_0x516e6e[_0x5267('0x35')]+=0x1;_0x516e6e[_0x5267('0x2e')]+=0x1;_0x516e6e[_0x5267('0xbd')]+=0x1;ut[_0x5267('0x76')](_0x516e6e,'[16]');_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut['logCustomer'](_0x3bedcf,0x4,_0x5267('0xbe'));rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xbf'));rpcDb[_0x5267('0x92')](_0x3bedcf,_0x5267('0xc0'));rpcDb[_0x5267('0xc1')](_0x3bedcf);_0x516e6e[_0x5267('0x2b')]+=_0x3bedcf['talktime'];_0x516e6e[_0x5267('0x2a')]+=_0x3bedcf[_0x5267('0xc2')];logger[_0x5267('0x56')](_0x5267('0xc3'),_0x3bedcf[_0x5267('0xb5')],'\x20Queue',_0x516e6e['name'],_0x5267('0x6a'),_0x516e6e[_0x5267('0x29')]);delete this[_0x5267('0x14')][_0x47d359[_0x5267('0xad')]];break;case'BUSY':_0x516e6e[_0x5267('0x37')]+=0x1;_0x3bedcf[_0x5267('0xc4')]+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0x5,_0x5267('0xc5'));_0x580748=_0x516e6e[_0x5267('0xc6')];_0x3992b2=_0x516e6e[_0x5267('0xa6')];ami[_0x5267('0x26')](_0x5267('0xc7'),ut[_0x5267('0xb8')](_0x3bedcf,_0x5267('0xc8')));rpcDb[_0x5267('0x90')](_0x3bedcf,'[callProgressDetectingCustomer][logBusy]');_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'5',_0x516e6e)[_0x5267('0x7e')](function(_0x45d1cc){_0xd7789e=_0x45d1cc[_0x5267('0xa4')]==0x1;if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e[_0x5267('0xc9')]){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb[_0x5267('0x92')](_0x5cca85,_0x5267('0xca'));}else{if(_0x3bedcf[_0x5267('0xc4')]>=_0x516e6e[_0x5267('0xcb')]){rpcDb[_0x5267('0x92')](_0x3bedcf,_0x5267('0xcc'));}else{rpcDb[_0x5267('0xaa')](ut[_0x5267('0xcd')](_0x3bedcf,_0x5267('0xc4'),_0x516e6e[_0x5267('0xc6')]),_0x3bedcf[_0x5267('0xab')],_0x3bedcf[_0x5267('0xac')]);}}}else{_0x3bedcf[_0x5267('0xc4')]++;_0x9aef0[_0x5267('0xb0')]({'id':_0x3bedcf[_0x5267('0xaf')],'field':{'countbusyretry':_0x3bedcf['countbusyretry']}})[_0x5267('0x7e')](function(){_0x9aef0[_0x5267('0xb1')](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});break;case _0x5267('0xce'):_0x516e6e[_0x5267('0x3a')]+=0x1;_0x3bedcf['countnoanswerretry']+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut['logCustomer'](_0x3bedcf,0x3,'NoAnswer');_0x580748=_0x516e6e['dialNoAnswerRetryFrequency'];_0x3992b2=_0x516e6e[_0x5267('0xa6')];ami['emit'](_0x5267('0xcf'),ut['buildObj'](_0x3bedcf,'noanswer'));rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xd0'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'3',_0x516e6e)[_0x5267('0x7e')](function(_0x315e10){_0xd7789e=_0x315e10['additional']==0x1;if(!_0xd7789e){if(ut['totalGlobal'](_0x3bedcf)>=_0x516e6e[_0x5267('0xc9')]){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb[_0x5267('0x92')](_0x5cca85,_0x5267('0xd1'));}else{if(_0x3bedcf['countnoanswerretry']>=_0x516e6e[_0x5267('0xd2')]){rpcDb['createCustomerFinal'](_0x3bedcf,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x5267('0xaa')](ut['scheduledAt'](_0x3bedcf,'countnoanswerretry',_0x516e6e[_0x5267('0xd3')]),_0x3bedcf[_0x5267('0xab')],_0x3bedcf['activeContact']);}}}else{_0x3bedcf['countnoanswerretry']++;_0x9aef0['incrementPreviewCounters']({'id':_0x3bedcf[_0x5267('0xaf')],'field':{'countnoanswerretry':_0x3bedcf['countnoanswerretry']}})[_0x5267('0x7e')](function(){_0x9aef0['swapAdditionalPhones'](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});break;case _0x5267('0xd4'):_0x516e6e['outboundCongestionCallsDay']+=0x1;_0x3bedcf[_0x5267('0xd5')]+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0x8,_0x5267('0xd6'));_0x580748=_0x516e6e[_0x5267('0xd7')];_0x3992b2=_0x516e6e['callAdditionalPhoneAfterMin'];ami['emit'](_0x5267('0xd8'),ut['buildObj'](_0x3bedcf,'congestion'));rpcDb[_0x5267('0x90')](_0x3bedcf,'[callProgressDetectingCustomer][logCongestion]');_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'8',_0x516e6e)['then'](function(_0x67f1c9){_0xd7789e=_0x67f1c9['additional']==0x1;if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e[_0x5267('0xc9')]){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb[_0x5267('0x92')](_0x5cca85,_0x5267('0xd9'));}else{if(_0x3bedcf[_0x5267('0xd5')]>=_0x516e6e['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x3bedcf,_0x5267('0xda'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3bedcf,'countcongestionretry',_0x516e6e['dialBusyRetryFrequency']),_0x3bedcf['unlockAgent'],_0x3bedcf['activeContact']);}}}else{_0x3bedcf[_0x5267('0xd5')]++;_0x9aef0[_0x5267('0xb0')]({'id':_0x3bedcf[_0x5267('0xaf')],'field':{'countcongestionretry':_0x3bedcf[_0x5267('0xd5')]}})[_0x5267('0x7e')](function(){_0x9aef0[_0x5267('0xb1')](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});break;case _0x5267('0xdb'):_0x516e6e['outboundRejectCallsDay']+=0x1;_0x3bedcf['countagentrejectretry']+=0x1;_0x3bedcf['countglobal']=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0x14,'AgentReject');_0x580748=_0x516e6e[_0x5267('0xdc')];_0x3992b2=_0x516e6e[_0x5267('0xa6')];ami[_0x5267('0x26')](_0x5267('0xdd'),ut['buildObj'](_0x3bedcf,'agentreject'));rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xde'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'20',_0x516e6e)[_0x5267('0x7e')](function(_0x3e4240){_0xd7789e=_0x3e4240[_0x5267('0xa4')]==0x1;if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e['dialGlobalMaxRetry']){_0x5cca85=ut['cloneAction'](_0x3bedcf,0x14,'AgentReject');rpcDb[_0x5267('0x92')](_0x5cca85,_0x5267('0xdf'));}else{if(_0x3bedcf[_0x5267('0xe0')]>=_0x516e6e[_0x5267('0xe1')]){rpcDb[_0x5267('0x92')](_0x3bedcf,_0x5267('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0x5267('0xcd')](_0x3bedcf,'countagentrejectretry',_0x516e6e[_0x5267('0xdc')]),_0x3bedcf[_0x5267('0xab')],_0x3bedcf[_0x5267('0xac')]);}}}else{_0x3bedcf[_0x5267('0xe2')]++;_0x9aef0[_0x5267('0xb0')]({'id':_0x3bedcf['idContact'],'field':{'countnoanswerretry':_0x3bedcf[_0x5267('0xe2')]}})[_0x5267('0x7e')](function(){_0x9aef0[_0x5267('0xb1')](_0x3bedcf,_0x580748,_0x3992b2)['then'](function(){});});}});break;case'ABANDONED':_0x516e6e['outboundAbandonedCallsDay']+=0x1;_0x3bedcf[_0x5267('0xe3')]+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x3bedcf,_0x5267('0xe4'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'11',_0x516e6e)['then'](function(_0x39e329){_0xd7789e=_0x39e329[_0x5267('0xa4')]==0x1;if(!_0xd7789e){if(ut['totalGlobal'](_0x3bedcf)>=_0x516e6e['dialGlobalMaxRetry']){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb['createCustomerFinal'](_0x5cca85,_0x5267('0xe4'));}else{if(_0x3bedcf[_0x5267('0xe5')]>=_0x516e6e[_0x5267('0xe6')]){rpcDb[_0x5267('0x92')](_0x3bedcf,_0x5267('0xe4'));}else{rpcDb[_0x5267('0xaa')](ut[_0x5267('0xcd')](_0x3bedcf,_0x5267('0xe3'),_0x516e6e[_0x5267('0xe7')]),_0x3bedcf['unlockAgent'],_0x3bedcf['activeContact']);}}}else{_0x3bedcf[_0x5267('0xe2')]++;_0x9aef0['incrementPreviewCounters']({'id':_0x3bedcf[_0x5267('0xaf')],'field':{'countnoanswerretry':_0x3bedcf[_0x5267('0xe2')]}})[_0x5267('0x7e')](function(){_0x9aef0[_0x5267('0xb1')](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});break;case'18':_0x516e6e[_0x5267('0x3d')]+=0x1;_0x3bedcf[_0x5267('0xe8')]+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0x12,_0x47d359[_0x5267('0xe9')]||_0x47d359[_0x5267('0xea')]);ami['emit'](_0x5267('0xeb'),ut['buildObj'](_0x3bedcf,'amd'));rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xec'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'18',_0x516e6e)['then'](function(_0x2c5d55){_0xd7789e=_0x2c5d55[_0x5267('0xa4')]==0x1;if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e[_0x5267('0xc9')]){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0x12,_0x5267('0xa8'));rpcDb[_0x5267('0x92')](_0x5cca85,_0x5267('0xec'));}else{rpcDb[_0x5267('0x92')](_0x3bedcf,_0x5267('0xec'));}}else{_0x3bedcf[_0x5267('0xe2')]++;_0x9aef0[_0x5267('0xb0')]({'id':_0x3bedcf['idContact'],'field':{'countnoanswerretry':_0x3bedcf[_0x5267('0xe2')]}})[_0x5267('0x7e')](function(){_0x9aef0['swapAdditionalPhones'](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});delete this[_0x5267('0x14')][_0x47d359[_0x5267('0xad')]];break;case'19':_0x516e6e[_0x5267('0x3d')]+=0x1;_0x3bedcf['countglobal']=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0x13,_0x47d359[_0x5267('0xe9')]||_0x47d359['dialstatus']);ami[_0x5267('0x26')](_0x5267('0xeb'),ut[_0x5267('0xb8')](_0x3bedcf,_0x5267('0xed')));rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xee'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'18',_0x516e6e)[_0x5267('0x7e')](function(_0x140adc){_0xd7789e=_0x140adc['additional']==0x1;if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e[_0x5267('0xc9')]){_0x5cca85=ut['cloneAction'](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb['createCustomerFinal'](_0x5cca85,_0x5267('0xee'));}else{rpcDb['createCustomerFinal'](_0x3bedcf,_0x5267('0xee'));}}else{_0x3bedcf[_0x5267('0xe2')]++;_0x9aef0['incrementPreviewCounters']({'id':_0x3bedcf['idContact'],'field':{'countnoanswerretry':_0x3bedcf[_0x5267('0xe2')]}})[_0x5267('0x7e')](function(){_0x9aef0[_0x5267('0xb1')](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(){});});}});delete this[_0x5267('0x14')][_0x47d359['linkedid']];break;default:if(_0x3bedcf[_0x5267('0x6b')]){ut['decrementTalkink'](_0x516e6e,'[default]');ut['loggerError'](_0x5267('0xef')+_0x516e6e[_0x5267('0x4e')],_0x47d359);}_0x516e6e[_0x5267('0x3d')]+=0x1;_0x3bedcf[_0x5267('0x9e')]=ut[_0x5267('0x9f')](_0x3bedcf);ut[_0x5267('0xa0')](_0x3bedcf,0xc,_0x47d359[_0x5267('0xe9')]||_0x47d359['dialstatus']);_0x580748=_0x516e6e['dialAgentRejectRetryFrequency'];_0x3992b2=_0x516e6e[_0x5267('0xa6')];rpcDb[_0x5267('0x90')](_0x3bedcf,_0x5267('0xf0'));_0x9aef0[_0x5267('0xa3')](_0x3bedcf,'20',_0x516e6e)[_0x5267('0x7e')](function(_0x5cc150){_0xd7789e=_0x5cc150[_0x5267('0xa4')]==0x1;if(!_0xd7789e){if(ut[_0x5267('0x9f')](_0x3bedcf)>=_0x516e6e[_0x5267('0xc9')]){_0x5cca85=ut[_0x5267('0xa7')](_0x3bedcf,0xf,_0x5267('0xa8'));rpcDb['createCustomerFinal'](_0x5cca85,_0x5267('0xf1'));}else{rpcDb[_0x5267('0x92')](_0x3bedcf,_0x5267('0xf1'));}delete this['actions'][_0x47d359[_0x5267('0xad')]];}else{_0x9aef0['swapAdditionalPhones'](_0x3bedcf,_0x580748,_0x3992b2)[_0x5267('0x7e')](function(_0x2974d2){});}});}if(!(_0x3bedcf['dialAnswer']&&_0x41299c==='16')){ut[_0x5267('0xf2')](_0x516e6e,'[callProgressDetectingCustomer]');logger[_0x5267('0x56')](_0x5267('0xf3'),_0x3bedcf['uniqueid'],_0x5267('0xb6'),_0x516e6e[_0x5267('0x4e')],'originated:\x20',_0x516e6e[_0x5267('0x49')]);}if(_0x41299c!==_0x5267('0xf4')){delete this[_0x5267('0x14')][_0x47d359[_0x5267('0xad')]];delete this[_0x5267('0x14')][_0x47d359['destlinkedid']];}}};Preview['prototype'][_0x5267('0xf5')]=function(_0x4117c1,_0x4db940,_0x286978){if(_['isUndefined'](_0x4db940)&&_0x5267('0xf6')!==typeof _0x4db940){return;}if(_[_0x5267('0xf7')](_0x286978)&&_0x5267('0xf6')!==typeof _0x286978){return;}switch(_0x286978[_0x5267('0xf8')]){case'0':ut[_0x5267('0xf9')](_0x4117c1,0x0,_0x5267('0xa1'));rpcDb[_0x5267('0xfa')](_0x4117c1,_0x5267('0xfb'));break;case'3':ut[_0x5267('0xf9')](_0x4117c1,0x3,_0x5267('0xfc'));rpcDb[_0x5267('0xfa')](_0x4117c1,_0x5267('0xfd'));break;case'5':ut['logAgent'](_0x4117c1,0x5,_0x5267('0xc5'));rpcDb[_0x5267('0xfa')](_0x4117c1,_0x5267('0xfe'));break;case'8':ut[_0x5267('0xf9')](_0x4117c1,0x8,_0x5267('0xd6'));rpcDb[_0x5267('0xfa')](_0x4117c1,_0x5267('0xff'));break;case'22':ut[_0x5267('0xf9')](_0x4117c1,0x16,_0x5267('0x100'));rpcDb[_0x5267('0xfa')](_0x4117c1,_0x5267('0x101'));break;default:ut[_0x5267('0xf9')](_0x4117c1,0xc,_0x286978[_0x5267('0xf8')]);rpcDb[_0x5267('0xfa')](_0x4117c1,_0x5267('0xff'));}ut['updateOriginated'](_0x4db940,_0x5267('0x102'));logger[_0x5267('0x56')](_0x5267('0x103'),_0x4117c1['uniqueid'],'\x20Queue',_0x4db940[_0x5267('0x4e')],'originated:\x20',_0x4db940['originated']);delete this[_0x5267('0x14')][_0x4117c1[_0x5267('0xb5')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x1dc9be,_0x385f89,_0x29ecb9){return BPromise[_0x5267('0x104')]()['then'](cmHopperAdditionalPhone[_0x5267('0xa3')](_0x1dc9be,_0x385f89,_0x29ecb9))[_0x5267('0x73')](logger['info'](_0x5267('0x105')));};Preview[_0x5267('0xd')][_0x5267('0xb1')]=function(_0x12bb10,_0x310ac9,_0x2b3014){return BPromise[_0x5267('0x104')]()[_0x5267('0x7e')](cmHopperAdditionalPhone[_0x5267('0xb1')](_0x12bb10,_0x310ac9,_0x2b3014))[_0x5267('0x73')](logger[_0x5267('0x56')](_0x5267('0x106')));};Preview[_0x5267('0xd')][_0x5267('0xb0')]=function(_0x18c540){return BPromise[_0x5267('0x104')]()['then'](cmHopperAdditionalPhone[_0x5267('0xb0')](_0x18c540))[_0x5267('0x73')](logger[_0x5267('0x56')](_0x5267('0x107')));};Preview[_0x5267('0xd')][_0x5267('0x108')]=function(_0x387fbc,_0x4db61b,_0x12b78b,_0x5e1d2e,_0x1e8fa8){var _0x3642b7=this;return new BPromise(function(_0x3570bb,_0x2abb1a){if(_[_0x5267('0x7f')](_0x4db61b)||_['isNil'](_0x4db61b[_0x5267('0x109')])||_[_0x5267('0x7f')](_0x4db61b[_0x5267('0x10a')])||_[_0x5267('0x7f')](_0x4db61b['VoiceQueueId'])){_0x2abb1a(ut['message'](_0x5267('0x10b'),_0x5e1d2e,_0x1e8fa8));return;}var _0x1fcdf9=uuid['v4']();var _0x544bf3=_0x3642b7[_0x5267('0x11')][_0x4db61b[_0x5267('0x68')][_0x5267('0x4e')]];var _0x433d75=_0x12b78b?_0x3642b7['agents'][_0x12b78b]['id']:undefined;_0x3642b7[_0x5267('0x14')][_0x1fcdf9]=new Action(_0x4db61b,_0x544bf3,_0x1fcdf9,_0x12b78b,_0x433d75);var _0x58a6d6=_0x3642b7['actions'][_0x1fcdf9];_0x58a6d6[_0x5267('0xab')]=_0x5e1d2e;_0x58a6d6[_0x5267('0xac')]=_0x1e8fa8;_0x58a6d6[_0x5267('0x10c')]=_0x12b78b;if(_['isEmpty'](_0x387fbc)){_0x3642b7[_0x5267('0x10d')](_0x58a6d6,_0x544bf3,_0x4db61b,_0x12b78b)[_0x5267('0x7e')](function(_0x4af8d9){logger[_0x5267('0x56')]('[Preview][execCall][success]','Queue:\x20'+_0x58a6d6['queue']+_0x5267('0x10e')+_0x58a6d6[_0x5267('0xaf')],JSON['stringify'](_0x4af8d9));ami[_0x5267('0x26')](_0x5267('0x10f'),ut[_0x5267('0xb8')](_0x58a6d6,_0x5267('0x110'),_0x3642b7[_0x5267('0x11')][_0x58a6d6[_0x5267('0x69')]]));_0x3570bb(ut[_0x5267('0x48')](_0x5267('0x111')));})[_0x5267('0x73')](function(_0x1a7cd3){ut[_0x5267('0x5d')]('[Preview][execCall][failure]',_0x1a7cd3);_0x2abb1a(ut[_0x5267('0x48')]('Call\x20failed',_0x5e1d2e,_0x1e8fa8));});}else{_0x544bf3[_0x5267('0x36')]+=0x1;ut[_0x5267('0x112')](_0x58a6d6);rpcDb[_0x5267('0x113')](_0x58a6d6,_0x5267('0x114'));delete _0x3642b7[_0x5267('0x14')][_0x1fcdf9];_0x2abb1a(ut[_0x5267('0x48')]('Contact\x20in\x20black\x20List',_0x5e1d2e,_0x1e8fa8));}});};Preview[_0x5267('0xd')][_0x5267('0x99')]=function(_0x1ba6f2){return!_['isNil'](_0x1ba6f2)&&!_[_0x5267('0x7f')](_0x1ba6f2[_0x5267('0x4e')])&&!_['isNil'](_0x1ba6f2[_0x5267('0x4f')])&&_0x1ba6f2[_0x5267('0x4f')]&&!_[_0x5267('0x7f')](this[_0x5267('0x13')][util[_0x5267('0x53')]('SIP/%s',_0x1ba6f2[_0x5267('0x4e')])])&&!_[_0x5267('0x7f')](this[_0x5267('0x13')][util['format'](_0x5267('0x115'),_0x1ba6f2[_0x5267('0x4e')])][_0x5267('0x71')])&&(this[_0x5267('0x13')][util[_0x5267('0x53')](_0x5267('0x115'),_0x1ba6f2[_0x5267('0x4e')])][_0x5267('0x71')]===_0x5267('0x116')||this[_0x5267('0x13')][util['format']('SIP/%s',_0x1ba6f2[_0x5267('0x4e')])]['status']===_0x5267('0x117'));};Preview['prototype']['run']=function(_0x1f0675,_0x4c8231){var _0x342232=this;return new BPromise(function(_0x901cee,_0x5f5be6){_0x342232[_0x5267('0x118')](_0x1f0675,_0x4c8231)['then'](function(_0x455366){_0x901cee(_[_0x5267('0x6c')](_0x455366,['message']));})['catch'](function(_0x2c06c2){if(_0x2c06c2[_0x5267('0x119')]){rpcDb[_0x5267('0x11a')](_0x1f0675);}if(_0x2c06c2['active']){rpcDb[_0x5267('0x88')](_0x1f0675);}_0x5f5be6(_[_0x5267('0x6c')](_0x2c06c2,[_0x5267('0x48')]));});});};Preview[_0x5267('0xd')][_0x5267('0x118')]=function(_0x2cd33e,_0x1fa69f){var _0x3c129a=this;return new BPromise(function(_0x518d4d,_0xa7eae){var _0xc603c8,_0x34608d;rpcDb[_0x5267('0x11b')](_0x2cd33e)['then'](function(_0x5f5342){if(!_['isNil'](_0x5f5342[0x0])){_0x34608d=_0x5f5342[0x0][_0x5267('0x11c')]?![]:!![];_0xc603c8=_0x5f5342[0x0][_0x5267('0x11c')]?!![]:![];_0xc603c8=_0x1fa69f?!![]:_0xc603c8;}var _0x1a956f=_0x3c129a[_0x5267('0x11d')](_0x5f5342);if(_0x1a956f[_0x5267('0x11e')]){rpcDb[_0x5267('0x11f')](_[_0x5267('0x6c')](_0x5f5342[0x0],[_0x5267('0x120'),'phone']))[_0x5267('0x7e')](function(_0x1c37c2){_0x3c129a[_0x5267('0x108')](_0x1c37c2,_0x5f5342[0x0],_0x1fa69f,_0x34608d,_0xc603c8)['then'](function(_0x16764f){_0x518d4d(_0x16764f);})[_0x5267('0x73')](function(_0x50fb73){_0xa7eae(_0x50fb73);});})['catch'](function(_0x40ad26){ut['logger'](_0x5267('0x121'),_0x40ad26);_0xa7eae(ut[_0x5267('0x48')](_0x5267('0x122'),_0x34608d,_0xc603c8));});}else{_0xa7eae(ut['message'](_0x1a956f[_0x5267('0x48')],_0x34608d,_0xc603c8));}})[_0x5267('0x73')](function(_0x17fea5){ut[_0x5267('0x5d')]('[Preview][getContactPreview]',_0x17fea5);_0xa7eae(ut[_0x5267('0x48')](_0x5267('0x122'),![],!![]));});});};Preview[_0x5267('0xd')][_0x5267('0x11d')]=function(_0x46dc94){if(_[_0x5267('0x7f')](_0x46dc94)||_[_0x5267('0x123')](_0x46dc94)||!_[_0x5267('0x7f')](_0x46dc94[0x0][_0x5267('0x84')])&&_[_0x5267('0x7f')](_0x46dc94[0x0][_0x5267('0x84')][_0x5267('0x4e')])){ut[_0x5267('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x46dc94);return{'isValid':![],'message':_0x5267('0x124')};}var _0x103faa=this[_0x5267('0x11')][_0x46dc94[0x0][_0x5267('0x68')][_0x5267('0x4e')]];_0x103faa[_0x5267('0x48')]=_0x5267('0x9b');if(_[_0x5267('0x7f')](_0x103faa)){ut[_0x5267('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x103faa);return{'isValid':![],'message':_0x5267('0x125')};}if(!this[_0x5267('0x99')](_0x103faa[_0x5267('0x4d')])){ut['logger'](_0x5267('0x126'),_0x5267('0x127')+_0x103faa[_0x5267('0x4e')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x103faa[_0x5267('0x9a')])){ut[_0x5267('0x5d')](_0x5267('0x126'),_0x103faa['name']+_0x5267('0x128'));return{'isValid':![],'message':_0x5267('0x129')};}}if(!ut[_0x5267('0x98')](_0x103faa['dialActive'])){ut['logger'](_0x5267('0x12a'),_0x103faa[_0x5267('0x4e')]+_0x5267('0x12b'));return{'isValid':![],'message':_0x5267('0x127')+_0x103faa[_0x5267('0x4e')]+_0x5267('0x12b')};}return{'isValid':!![],'message':_0x5267('0x12c')};};Preview['prototype']['execCall']=function(_0x1ad1de,_0x5295f6,_0x136f6d,_0x348f7b){var _0x1f0407=this;return new BPromise(function(_0x1b30c2,_0x2a0afb){var _0x5095b8=_0x1ad1de[_0x5267('0xb5')];var _0x244050=_0x1f0407['isTrunkReachable'](_0x5295f6[_0x5267('0x4d')])?util[_0x5267('0x53')](_0x5267('0x12d'),_0x5295f6['Trunk'][_0x5267('0x4e')],_['isNil'](_0x5295f6[_0x5267('0x12e')])?'':_0x5295f6[_0x5267('0x12e')][_0x5267('0x12f')]()||'',_0x5295f6[_0x5267('0x130')]>0x0?_0x136f6d[_0x5267('0x10a')][_0x5267('0x131')](_0x5295f6['dialCutDigit']):_0x136f6d['phone']):util['format'](_0x5267('0x12d'),_[_0x5267('0x7f')](_0x5295f6['TrunkBackup'])?_0x5295f6['Trunk']['name']:_0x5295f6[_0x5267('0x9a')]['name'],_['isNil'](_0x5295f6[_0x5267('0x12e')])?'':_0x5295f6[_0x5267('0x12e')][_0x5267('0x12f')]()||'',_0x5295f6[_0x5267('0x130')]>0x0?_0x136f6d[_0x5267('0x10a')][_0x5267('0x131')](_0x5295f6[_0x5267('0x130')]):_0x136f6d['phone']);var _0x3870b1=_0x1f0407[_0x5267('0x99')](_0x5295f6[_0x5267('0x4d')])?ut[_0x5267('0x132')](_0x5295f6[_0x5267('0x4d')][_0x5267('0x50')],_0x5295f6[_0x5267('0x133')],_0x5295f6['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x5267('0x134')](_0x5295f6['dialOriginateCallerIdNumber'],_0x5295f6[_0x5267('0x135')]):_0x5295f6[_0x5267('0x33')]):ut['getCallerId'](_[_0x5267('0x7f')](_0x5295f6['TrunkBackup'])?_0x5295f6[_0x5267('0x4d')][_0x5267('0x50')]:_0x5295f6[_0x5267('0x9a')][_0x5267('0x50')],_0x5295f6[_0x5267('0x133')],_0x5295f6[_0x5267('0x135')]>0x0?ut[_0x5267('0x134')](_0x5295f6[_0x5267('0x33')],_0x5295f6['dialRandomLastDigitCallerIdNumber']):_0x5295f6[_0x5267('0x33')]);if(_0x3870b1){_0x1ad1de[_0x5267('0x136')]=ut[_0x5267('0x137')](_0x3870b1);_0x1ad1de[_0x5267('0x138')]=ut['extractCalleridNumber'](_0x3870b1);}var _0x3fe69f=ut[_0x5267('0x139')](_0x5295f6,_0x136f6d,_0x244050,_0x3870b1,_0x5095b8,_0x1ad1de);_[_0x5267('0x13a')](_0x1ad1de,ut[_0x5267('0x13b')](_0x3fe69f));_0x1ad1de[_0x5267('0x13c')]=moment()['format'](_0x5267('0x89'));ami[_0x5267('0x70')](ut['variablesAction'](_0x1ad1de,_0x5295f6,_0x3fe69f,_0x1ad1de[_0x5267('0xac')],_0x348f7b))[_0x5267('0x7e')](function(_0xaecb5e){_0x5295f6[_0x5267('0x49')]+=0x1;logger[_0x5267('0x56')](_0x5267('0x13d'),_0x5095b8,_0x5267('0xb6'),_0x5295f6[_0x5267('0x4e')],_0x5267('0x13e'),_0x5295f6[_0x5267('0x49')]);_0x1b30c2(_0xaecb5e);})[_0x5267('0x73')](function(_0x55a727){ut[_0x5267('0xf9')](_0x1ad1de,0xe,_0x5267('0x13f'));rpcDb['createAgentHistory'](_0x1ad1de,_0x5267('0x140'));_0x2a0afb(_0x55a727);});});};Preview[_0x5267('0xd')][_0x5267('0x1f')]=function(_0x1c6a83){if(this[_0x5267('0x14')][_0x1c6a83[_0x5267('0xad')]]){this[_0x5267('0x14')][_0x1c6a83[_0x5267('0xad')]][_0x5267('0x72')]=_0x1c6a83['channel'];}};Preview[_0x5267('0xd')][_0x5267('0x18')]=function(_0x48aa0c){var _0x3ee861=this;var _0xa0c239=this[_0x5267('0x14')][_0x48aa0c[_0x5267('0x141')]];if(_0xa0c239){if(_0xa0c239[_0x5267('0x10c')]&&this[_0x5267('0x15')][_0xa0c239['lookAgent']]){ut[_0x5267('0x142')](_0xa0c239,this[_0x5267('0x15')][_0xa0c239[_0x5267('0x10c')]][_0x5267('0x4e')],this[_0x5267('0x15')][_0xa0c239['lookAgent']]['id']);}var _0x2dbcbf=_[_0x5267('0x143')](_0xa0c239);_0x2dbcbf[_0x5267('0xb2')]=moment()[_0x5267('0x53')](_0x5267('0x89'));var _0x51db3d=_0x3ee861[_0x5267('0x11')][_0xa0c239['queue']];if(ut[_0x5267('0x144')](_0x48aa0c['response'])){if(_0xa0c239[_0x5267('0xab')]){rpcDb[_0x5267('0x11a')](_0xa0c239[_0x5267('0xaf')]);}if(_0xa0c239[_0x5267('0xac')]){rpcDb[_0x5267('0x88')](_0xa0c239[_0x5267('0xaf')]);}ami[_0x5267('0x26')](_0x5267('0x145'),ut[_0x5267('0xb8')](_0xa0c239,_0x5267('0x146'),this[_0x5267('0x11')][_0xa0c239[_0x5267('0x69')]]));this[_0x5267('0xf5')](_0x2dbcbf,_0x51db3d,_0x48aa0c);}else{_0xa0c239[_0x5267('0x13c')]=moment()['format'](_0x5267('0x89'));ut['logAgent'](_0x2dbcbf,0x4,_0x5267('0xbe'));rpcDb['createAgentHistory'](_0x2dbcbf,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x5267('0x147')]=function(_0x98979e){var _0x3f09e1=this;var _0x8e421c=this[_0x5267('0x14')][_0x98979e[_0x5267('0xad')]];var _0x567388;if(_0x8e421c){_0x567388=this[_0x5267('0x11')][_0x8e421c[_0x5267('0x69')]];logger[_0x5267('0x56')](_0x5267('0x148'),_0x98979e[_0x5267('0xad')],'\x20Queue',_0x567388[_0x5267('0x4e')],'pTalking:\x20',_0x567388[_0x5267('0x29')]);}if(this[_0x5267('0x14')][_0x98979e[_0x5267('0xad')]]&&_0x98979e[_0x5267('0xad')]!==_0x98979e[_0x5267('0xb5')]){if(_0x98979e['cause']==='16'&&this['actions'][_0x98979e[_0x5267('0xad')]]['dialAnswer']){this[_0x5267('0x9c')](_0x98979e,_0x98979e[_0x5267('0xad')],_0x98979e[_0x5267('0x149')]);}else if(this[_0x5267('0x14')][_0x98979e[_0x5267('0xad')]][_0x5267('0x6b')]){logger[_0x5267('0x56')]('[syncHangup][talking][cause]',_0x98979e['linkedid'],_0x98979e[_0x5267('0x149')],'\x20Queue',_0x567388['name'],_0x5267('0x6a'),_0x567388[_0x5267('0x29')]);this['callProgressDetectingCustomer'](_0x98979e,_0x98979e['linkedid'],_0x98979e['cause']);}}else if(_0x8e421c&&_[_0x5267('0x7f')](_0x8e421c[_0x5267('0x14a')])&&_0x567388['dialQueueProject']&&_0x98979e['linkedid']===_0x98979e[_0x5267('0xb5')]&&_['isNil'](_0x98979e[_0x5267('0xf8')])&&_0x98979e[_0x5267('0x149')]==='16'&&_0x98979e['channelstate']==='6'&&_[_0x5267('0xf7')](_0x8e421c['transfer'])){if(_0x8e421c[_0x5267('0xab')]){rpcDb[_0x5267('0x11a')](_0x8e421c['idContact']);}if(_0x8e421c[_0x5267('0xac')]){rpcDb[_0x5267('0x88')](_0x8e421c['idContact']);}_0x98979e[_0x5267('0xf8')]='22';this['callProgressDetectingAgent'](_0x8e421c,_0x567388,_0x98979e);}else if(_0x8e421c&&_0x8e421c['transfer']){if(_0x98979e[_0x5267('0x149')]==='16'&&this['actions'][_0x98979e[_0x5267('0xad')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x98979e[_0x5267('0xad')],_0x98979e[_0x5267('0x149')],_0x5267('0xb6'),_0x567388[_0x5267('0x4e')],_0x5267('0x6a'),_0x567388['pTalking']);this[_0x5267('0x9c')](_0x98979e,_0x98979e[_0x5267('0xad')],_0x98979e[_0x5267('0x149')]);}else if(this['actions'][_0x98979e['linkedid']][_0x5267('0x6b')]){logger['info'](_0x5267('0x14b'),_0x98979e[_0x5267('0xad')],_0x98979e['cause'],_0x5267('0xb6'),_0x567388[_0x5267('0x4e')],_0x5267('0x6a'),_0x567388[_0x5267('0x29')]);this[_0x5267('0x9c')](_0x98979e,_0x98979e[_0x5267('0xad')],_0x98979e[_0x5267('0x149')]);}}};Preview[_0x5267('0xd')][_0x5267('0x1d')]=function(_0x25a627){if(this[_0x5267('0x14')][_0x25a627[_0x5267('0x14c')]]&&_0x25a627[_0x5267('0x14c')]!==_0x25a627[_0x5267('0x14d')]){this[_0x5267('0x9c')](_0x25a627,_0x25a627['destlinkedid'],_0x25a627[_0x5267('0xea')]);}};Preview[_0x5267('0xd')][_0x5267('0x1b')]=function(_0x30bc98){if(this['actions'][_0x30bc98[_0x5267('0xad')]]&&_0x30bc98[_0x5267('0xad')]!==_0x30bc98[_0x5267('0xb5')]&&!this[_0x5267('0x14')][_0x30bc98[_0x5267('0xad')]]['dialAnswer']){if(_0x30bc98[_0x5267('0x149')]==='1'){this[_0x5267('0x9c')](_0x30bc98,_0x30bc98['linkedid'],_0x30bc98[_0x5267('0x149')]);}}};Preview['prototype'][_0x5267('0x14e')]=function(_0x59c936,_0x2f518c,_0x3bf129){if(this[_0x5267('0x14')][_0x59c936]){if(_['isNil'](this['actions'][_0x59c936]['variables'])){this[_0x5267('0x14')][_0x59c936][_0x5267('0x14f')]={};}this[_0x5267('0x14')][_0x59c936][_0x5267('0x14f')][_0x2f518c]=_0x3bf129;}};Preview[_0x5267('0xd')][_0x5267('0x21')]=function(_0x237860){try{if(!_[_0x5267('0x7f')](_0x237860)){if(ut['filterKey'](_[_0x5267('0x150')](_0x237860[_0x5267('0x151')])[0x0])){this['addVariable'](_0x237860[_0x5267('0xb5')],_[_0x5267('0x150')](_0x237860[_0x5267('0x151')])[0x0],_0x237860[_0x5267('0x152')]);}}}catch(_0x18a895){logger['error'](_0x5267('0x153'),util['inspect'](_0x18a895,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x5267('0x23')]=function(_0x50debf){if(_0x50debf){if(this['actions'][_0x50debf['transfertargetlinkedid']]){this[_0x5267('0x14')][_0x50debf[_0x5267('0x154')]]['transfer']=!![];}}};Preview['prototype'][_0x5267('0x155')]=function(_0x328d60){if(_0x328d60){if(this['actions'][_0x328d60[_0x5267('0x156')]]){this[_0x5267('0x14')][_0x328d60['transfererlinkedid']]['transfer']=!![];}}};module[_0x5267('0x157')]=Preview; \ No newline at end of file +var _0xdc97=['syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','type','outbound','name','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','emit','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','actions','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','linkedid','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','uniqueid','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','cloneAction','unlockAgent','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','activeContact','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','SIP/%s','reachable','unmonitored','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','phone','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','response','rejected','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3a69b4,_0x1f6073){_0x3a69b4=_0x3a69b4-0x0;var _0x52cce7=_0xdc97[_0x3a69b4];return _0x52cce7;};'use strict';var util=require(_0x7dc9('0x0'));var _=require(_0x7dc9('0x1'));var BPromise=require(_0x7dc9('0x2'));var uuid=require('uuid');var moment=require(_0x7dc9('0x3'));var md5=require('md5');var Redis=require(_0x7dc9('0x4'));var config=require(_0x7dc9('0x5'));var logger=require('../../../config/logger')(_0x7dc9('0x6'));var loggerAction=require(_0x7dc9('0x7'))(_0x7dc9('0x8'));var ami=require(_0x7dc9('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x7dc9('0xa'));var Action=require('./action');var ut=require('./util/util');config[_0x7dc9('0xb')]=_[_0x7dc9('0xc')](config[_0x7dc9('0xb')],{'host':_0x7dc9('0xd'),'port':0x18eb});var io=require(_0x7dc9('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x7dc9('0xf')][_0x7dc9('0x10')]=function(_0x37dfc){this[_0x7dc9('0x11')]=this[_0x7dc9('0x11')]?this[_0x7dc9('0x11')][_0x7dc9('0x12')](_0x37dfc):_0x37dfc();};function Preview(_0x4e8e65){this['sequence']=new Sequence();this['campaignsPreview']=_0x4e8e65['voiceQueues'];this[_0x7dc9('0x13')]=_0x4e8e65[_0x7dc9('0x13')];this['actions']={};this[_0x7dc9('0x14')]=_0x4e8e65[_0x7dc9('0x14')];this[_0x7dc9('0x15')]=0x0;ami['on'](_0x7dc9('0x16'),this[_0x7dc9('0x17')][_0x7dc9('0x18')](this));ami['on']('hangup',this[_0x7dc9('0x19')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x1a'),this[_0x7dc9('0x1b')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x1c'),this[_0x7dc9('0x1d')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x1e'),this['syncNewExten'][_0x7dc9('0x18')](this));ami['on']('varset',this[_0x7dc9('0x1f')][_0x7dc9('0x18')](this));ami['on']('attendedtransfer',this[_0x7dc9('0x20')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x21'),this[_0x7dc9('0x22')][_0x7dc9('0x18')](this));this[_0x7dc9('0x23')](this[_0x7dc9('0x24')]);}function emit(_0x2895f5,_0x155cc4,_0x2b38d6){io['to'](_0x2895f5)['emit'](_0x155cc4,_0x2b38d6);}function emitCampaignPreview(_0x593e60){if(_0x593e60[_0x7dc9('0x25')]===_0x7dc9('0x26')){var _0x596e0f={'id':_0x593e60['id'],'name':_0x593e60[_0x7dc9('0x27')],'strategy':_0x593e60[_0x7dc9('0x28')],'answered':_0x593e60['answered'],'available':_0x593e60[_0x7dc9('0x29')],'loggedIn':_0x593e60[_0x7dc9('0x2a')],'pTalking':_0x593e60[_0x7dc9('0x2b')],'sumBillable':_0x593e60['sumBillable'],'sumDuration':_0x593e60[_0x7dc9('0x2c')],'sumHoldTime':_0x593e60[_0x7dc9('0x2d')]||0x0,'talking':_0x593e60[_0x7dc9('0x2e')],'total':_0x593e60['total'],'type':_0x593e60['type'],'unmanaged':_0x593e60['unmanaged'],'abandoned':_0x593e60[_0x7dc9('0x2f')],'waiting':_0x593e60[_0x7dc9('0x30')],'loggedInDb':_0x593e60['loggedInDb'],'dialActive':_0x593e60['dialActive'],'dialMethod':_0x593e60[_0x7dc9('0x31')],'dialOriginateCallerIdName':_0x593e60['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x593e60[_0x7dc9('0x32')],'dialOriginateTimeout':_0x593e60[_0x7dc9('0x33')],'dialPrefix':_0x593e60[_0x7dc9('0x34')],'outboundAnswerAgiCallsDay':_0x593e60[_0x7dc9('0x35')],'outboundAnswerCallsDay':_0x593e60[_0x7dc9('0x36')],'outboundBlacklistCallsDay':_0x593e60[_0x7dc9('0x37')],'outboundBusyCallsDay':_0x593e60[_0x7dc9('0x38')],'outboundCongestionCallsDay':_0x593e60[_0x7dc9('0x39')],'outboundDropCallsDayACS':_0x593e60[_0x7dc9('0x3a')],'outboundDropCallsDayCallersExit':_0x593e60[_0x7dc9('0x3b')],'outboundDropCallsDayTimeout':_0x593e60[_0x7dc9('0x3c')],'outboundNoAnswerCallsDay':_0x593e60[_0x7dc9('0x3d')],'outboundNoSuchCallsDay':_0x593e60['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x593e60['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x593e60['outboundReCallsDay'],'outboundRejectCallsDay':_0x593e60['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x593e60['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x593e60['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x593e60['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x593e60['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x593e60[_0x7dc9('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x593e60[_0x7dc9('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x593e60[_0x7dc9('0x40')],'predictiveIntervalErlangCalls':_0x593e60[_0x7dc9('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x593e60[_0x7dc9('0x42')],'predictiveIntervalHitRate':_0x593e60[_0x7dc9('0x43')],'predictiveIntervalMultiplicativeFactor':_0x593e60['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x593e60['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x593e60['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x593e60[_0x7dc9('0x44')],'message':_0x593e60['message'],'originated':_0x593e60[_0x7dc9('0x45')],'erlangCalls':_0x593e60[_0x7dc9('0x46')],'erlangCallToSecond':_0x593e60[_0x7dc9('0x47')],'erlangAbandonmentRate':_0x593e60[_0x7dc9('0x48')],'erlangBusyFactor':_0x593e60[_0x7dc9('0x49')],'startPredictive':_0x593e60[_0x7dc9('0x4a')],'startProgressive':_0x593e60[_0x7dc9('0x4b')]};if(_0x593e60[_0x7dc9('0x4c')]){_0x596e0f['Trunk']={'id':_0x593e60[_0x7dc9('0x4c')]['id'],'name':_0x593e60['Trunk'][_0x7dc9('0x27')],'active':_0x593e60[_0x7dc9('0x4c')][_0x7dc9('0x4d')],'callerid':_0x593e60[_0x7dc9('0x4c')]['callerid']};}if(_0x593e60[_0x7dc9('0x4e')]){_0x596e0f['Interval']={'id':_0x593e60[_0x7dc9('0x4e')]['id'],'name':_0x593e60['Interval']['name']};}var _0x265a5f=md5(JSON[_0x7dc9('0x4f')](_0x596e0f));if(_0x593e60[_0x7dc9('0x50')]!==_0x265a5f){_0x593e60[_0x7dc9('0x50')]=_0x265a5f;emit(util['format'](_0x7dc9('0x51'),_0x596e0f[_0x7dc9('0x27')]),_0x7dc9('0x52'),_0x596e0f);}}}function emitVoiceQueueChannelRemove(_0x437e6d){logger[_0x7dc9('0x53')](_0x7dc9('0x54'),JSON[_0x7dc9('0x4f')](_0x437e6d));emit(util[_0x7dc9('0x55')](_0x7dc9('0x51'),_0x437e6d[_0x7dc9('0x27')]),_0x7dc9('0x56'),_0x437e6d);io[_0x7dc9('0x57')]('voice_queue_presence:remove',_0x437e6d);}function notSendMessagesQueue(_0x34b5c9){if(_0x34b5c9[_0x7dc9('0x58')]){if(_0x34b5c9[_0x7dc9('0x45')]===0x0&&_0x34b5c9[_0x7dc9('0x2b')]===0x0){_0x34b5c9['sendMessageOneNotActive']=![];_0x34b5c9[_0x7dc9('0x29')]=0x0;_0x34b5c9[_0x7dc9('0x59')]=0x0;_0x34b5c9[_0x7dc9('0x5a')]=_0x7dc9('0x5b');ut[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x34b5c9['name']+'\x20is\x20not\x20active');}else{_0x34b5c9[_0x7dc9('0x5a')]=_0x7dc9('0x5e');ut['logger'](_0x7dc9('0x5d'),_0x34b5c9['name']+_0x7dc9('0x5f'));}emitCampaignPreview(_0x34b5c9);}}Preview[_0x7dc9('0xf')][_0x7dc9('0x23')]=function(){var _0x5e056e=this;setInterval(function(){_0x5e056e[_0x7dc9('0x60')]();},0x7cf);};Preview[_0x7dc9('0xf')][_0x7dc9('0x60')]=function(){var _0x95513c=this[_0x7dc9('0x24')];this[_0x7dc9('0x15')]+=0x1;for(var _0xc75f21 in _0x95513c){if(_0x95513c['hasOwnProperty'](_0xc75f21)&&(_0x95513c[_0xc75f21][_0x7dc9('0x31')]==='preview'||_0x95513c[_0xc75f21]['dialMethod']===_0x7dc9('0x61'))&&_0x95513c[_0xc75f21][_0x7dc9('0x25')]===_0x7dc9('0x26')){if(this[_0x7dc9('0x15')]>0x7){this[_0x7dc9('0x15')]=0x0;this[_0x7dc9('0x62')]();}}if(_0x95513c[_0x7dc9('0x63')](_0xc75f21)&&_0x95513c[_0xc75f21][_0x7dc9('0x31')]===_0x7dc9('0x6')&&_0x95513c[_0xc75f21]['type']===_0x7dc9('0x26')){if(_0x95513c[_0xc75f21][_0x7dc9('0x64')]){this[_0x7dc9('0x65')](_0x95513c[_0xc75f21]);if(_0x95513c[_0xc75f21][_0x7dc9('0x66')])this[_0x7dc9('0x67')](_0x95513c[_0xc75f21]);}else{notSendMessagesQueue(_0x95513c[_0xc75f21]);}}}};Preview[_0x7dc9('0xf')]['clearZombieChannel']=function(_0x3774cb){var _0x42e110=this;this['sequence'][_0x7dc9('0x10')](function(){if(!_[_0x7dc9('0x68')](_0x42e110[_0x7dc9('0x69')][_0x3774cb])){loggerAction['info'](_0x7dc9('0x6a'),_0x3774cb,'Queue',_0x42e110['actions'][_0x3774cb][_0x7dc9('0x6b')],_0x7dc9('0x6c'),JSON[_0x7dc9('0x4f')](_0x42e110['campaignsPreview'][_0x42e110['actions'][_0x3774cb][_0x7dc9('0x6b')]]['originated']),_0x7dc9('0x6d'),JSON[_0x7dc9('0x4f')](_0x42e110['campaignsPreview'][_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6b')]][_0x7dc9('0x2b')]),JSON[_0x7dc9('0x4f')](_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6e')]),JSON[_0x7dc9('0x4f')](_[_0x7dc9('0x6f')](_0x42e110[_0x7dc9('0x69')][_0x3774cb],[_0x7dc9('0x70'),_0x7dc9('0x71'),_0x7dc9('0x72'),_0x7dc9('0x73')])));return ami['Action']({'action':_0x7dc9('0x74'),'channel':_0x42e110['actions'][_0x3774cb]['channel']})[_0x7dc9('0x75')](function(_0x22423e){if(_0x22423e[_0x7dc9('0x5a')]===_0x7dc9('0x76')){setTimeout(function(){if(_0x42e110[_0x7dc9('0x69')][_0x3774cb]){ut['updateOriginated'](_0x42e110[_0x7dc9('0x24')][_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6b')]],'[clearZombieChannel]');if(_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6e')]===!![]){ut[_0x7dc9('0x77')](_0x42e110[_0x7dc9('0x24')][_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6b')]],'[clearZombieChannel]');ut[_0x7dc9('0x78')](_0x7dc9('0x79')+_0x3774cb,_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6b')]);}ut[_0x7dc9('0x78')](_0x7dc9('0x7a')+_0x3774cb,_0x42e110[_0x7dc9('0x69')][_0x3774cb][_0x7dc9('0x6b')]);delete _0x42e110[_0x7dc9('0x69')][_0x3774cb];}},0x2328);}});}});};Preview[_0x7dc9('0xf')][_0x7dc9('0x62')]=function(){var _0x3819e5=this;loggerAction['info'](_0x7dc9('0x7b'),_[_0x7dc9('0x7c')](this[_0x7dc9('0x69')]));for(var _0xe1146e in this[_0x7dc9('0x69')]){if(_0x3819e5['actions'][_0x7dc9('0x63')](_0xe1146e)){_0x3819e5[_0x7dc9('0x7d')](_0xe1146e);}}};Preview[_0x7dc9('0xf')][_0x7dc9('0x67')]=function(_0x2a1db8){var _0x2f01a0=this;rpcDb['getContactRecallMe'](_0x2a1db8['id'],ut['agentReadyId'](this['agents']))[_0x7dc9('0x7e')](function(_0x3daf33){if(!_[_0x7dc9('0x68')](_0x3daf33)){for(var _0x2afefc=0x0;_0x2afefc<_0x3daf33['length'];_0x2afefc+=0x1){if(ut['getDiff'](_0x3daf33[_0x2afefc][_0x7dc9('0x7f')])<_0x2a1db8[_0x7dc9('0x80')]*0x3c){if(_0x3daf33[_0x2afefc][_0x7dc9('0x81')]&&!_0x3daf33[_0x2afefc][_0x7dc9('0x81')][_0x7dc9('0x82')]){_0x2f01a0[_0x7dc9('0x83')](_0x3daf33[_0x2afefc]['id'])[_0x7dc9('0x7e')](ut['logger2'](_0x7dc9('0x84')))[_0x7dc9('0x75')](ut[_0x7dc9('0x85')](_0x7dc9('0x84')));}else{rpcDb[_0x7dc9('0x86')](_0x3daf33[_0x2afefc]['id']);}}else{var _0x4bbf8b=new Action(_0x3daf33[_0x2afefc],_0x2a1db8);_0x4bbf8b[_0x7dc9('0x87')]=moment()[_0x7dc9('0x55')](_0x7dc9('0x88'));_0x2a1db8[_0x7dc9('0x89')]+=0x1;ut[_0x7dc9('0x8a')](_0x4bbf8b,0x17,_0x7dc9('0x8b'));if(_0x2a1db8[_0x7dc9('0x8c')]){rpcDb[_0x7dc9('0x8d')](ut[_0x7dc9('0x8e')](_0x3daf33[_0x2afefc]));rpcDb[_0x7dc9('0x8f')](_0x4bbf8b,_0x7dc9('0x90'));}else{ut[_0x7dc9('0x8a')](_0x4bbf8b,0x16,_0x7dc9('0x91'));rpcDb['createCustomerHistory'](_0x4bbf8b,_0x7dc9('0x92'));rpcDb['createCustomerFinal'](_0x4bbf8b,_0x7dc9('0x92'));}}}}})[_0x7dc9('0x75')](ut['logger2'](_0x7dc9('0x93')));};Preview[_0x7dc9('0xf')]['setMessage']=function(_0x441a7f){_0x441a7f[_0x7dc9('0x58')]=!![];if(ut[_0x7dc9('0x94')](_0x441a7f['loggedIn'])){_0x441a7f['message']=_0x7dc9('0x95');}else if(!ut[_0x7dc9('0x96')](_0x441a7f[_0x7dc9('0x64')])){_0x441a7f[_0x7dc9('0x5a')]=_0x7dc9('0x5b');}else if(!this[_0x7dc9('0x97')](_0x441a7f[_0x7dc9('0x4c')])){if(!this[_0x7dc9('0x97')](_0x441a7f[_0x7dc9('0x98')])){_0x441a7f['message']=_0x7dc9('0x99');}else{_0x441a7f[_0x7dc9('0x5a')]=_0x7dc9('0x9a');}}else{_0x441a7f['message']='ACTIVE';}emitCampaignPreview(_0x441a7f);};Preview[_0x7dc9('0xf')][_0x7dc9('0x9b')]=function(_0x123fa8,_0x2cf485,_0x59f3bd){var _0x4c7c6b=this;var _0x3045f0=this[_0x7dc9('0x69')][_0x2cf485];var _0x25f8b3=this[_0x7dc9('0x24')][_0x3045f0['queue']];var _0xea1728;var _0x2db560=![];var _0x436b0d=0x2;var _0x3d0988=0x3;if(_0x25f8b3){switch(_0x59f3bd){case'1':_0x25f8b3[_0x7dc9('0x9c')]+=0x1;_0x3045f0[_0x7dc9('0x9d')]+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut['totalGlobal'](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x0,_0x7dc9('0x9f'));ami['emit']('custom:agentnosuchnumber',ut[_0x7dc9('0xa0')](_0x3045f0,'nosuchnumber'));rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xa1'));_0x4c7c6b[_0x7dc9('0xa2')](_0x3045f0,'0',_0x25f8b3)[_0x7dc9('0x7e')](function(_0x3a09cb){_0x2db560=_0x3a09cb[_0x7dc9('0xa3')]==0x1;_0x436b0d=_0x25f8b3[_0x7dc9('0xa4')];_0x3d0988=_0x25f8b3[_0x7dc9('0xa5')];if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3[_0x7dc9('0xa7')]){_0xea1728=ut['cloneAction'](_0x3045f0,0xf,_0x7dc9('0xa8'));rpcDb[_0x7dc9('0xa9')](_0xea1728,_0x7dc9('0xaa'));}else{if(_0x3045f0['countnosuchnumberretry']>=_0x25f8b3[_0x7dc9('0xab')]){rpcDb['createCustomerFinal'](_0x3045f0,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x7dc9('0xac')](ut[_0x7dc9('0xad')](_0x3045f0,'countnosuchnumberretry',_0x25f8b3[_0x7dc9('0xa4')]),_0x3045f0['unlockAgent'],_0x3045f0['activeContact']);}}delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xae')]];}else{_0x3045f0[_0x7dc9('0x9d')]++;logger[_0x7dc9('0x53')]('actioncountonusuch',_0x3045f0[_0x7dc9('0x9d')]);logger[_0x7dc9('0x53')]('id',_0x3045f0[_0x7dc9('0xaf')]);_0x4c7c6b[_0x7dc9('0xb0')]({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countnosuchnumberretry':_0x3045f0[_0x7dc9('0x9d')]}})[_0x7dc9('0x7e')](function(){_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)['then'](function(){});});}});break;case'ANSWER':var _0x1fa0ab=moment()['format'](_0x7dc9('0x88'));_0x3045f0[_0x7dc9('0xb2')]=_0x1fa0ab;_0x3045f0[_0x7dc9('0xb3')]=_0x1fa0ab;_0x3045f0[_0x7dc9('0x6e')]=!![];_0x25f8b3['pTalking']+=0x1;logger[_0x7dc9('0x53')](_0x7dc9('0xb4'),_0x3045f0['uniqueid'],_0x7dc9('0xb5'),_0x25f8b3[_0x7dc9('0x27')],_0x7dc9('0x6d'),_0x25f8b3[_0x7dc9('0x2b')]);ami['emit'](_0x7dc9('0xb6'),ut[_0x7dc9('0xa0')](_0x3045f0,'connect',this['campaignsPreview'][_0x3045f0[_0x7dc9('0x6b')]]));if(_0x25f8b3[_0x7dc9('0xb7')]){ami['emit'](_0x7dc9('0xb8'),ut['buildAcw'](_0x3045f0));}break;case'16':ami[_0x7dc9('0x57')](_0x7dc9('0xb9'),ut[_0x7dc9('0xa0')](_0x3045f0,'complete',this[_0x7dc9('0x24')][_0x3045f0[_0x7dc9('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x7dc9('0xa0')](_0x3045f0,'complete'));_0x25f8b3[_0x7dc9('0x36')]+=0x1;_0x25f8b3['total']+=0x1;_0x25f8b3['answered']+=0x1;ut[_0x7dc9('0x77')](_0x25f8b3,_0x7dc9('0xba'));_0x3045f0[_0x7dc9('0x9e')]=ut[_0x7dc9('0xa6')](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x4,'Answer');rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xbb'));rpcDb[_0x7dc9('0xa9')](_0x3045f0,_0x7dc9('0xbc'));rpcDb[_0x7dc9('0xbd')](_0x3045f0);_0x25f8b3['sumDuration']+=_0x3045f0[_0x7dc9('0xbe')];_0x25f8b3[_0x7dc9('0xbf')]+=_0x3045f0[_0x7dc9('0xbe')];logger[_0x7dc9('0x53')]('[syncHangup][talking][decrement]',_0x3045f0[_0x7dc9('0xc0')],'\x20Queue',_0x25f8b3['name'],_0x7dc9('0x6d'),_0x25f8b3['pTalking']);delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xae')]];break;case _0x7dc9('0xc1'):_0x25f8b3[_0x7dc9('0x38')]+=0x1;_0x3045f0[_0x7dc9('0xc2')]+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut['totalGlobal'](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x5,_0x7dc9('0xc3'));_0x436b0d=_0x25f8b3[_0x7dc9('0xc4')];_0x3d0988=_0x25f8b3[_0x7dc9('0xa5')];ami[_0x7dc9('0x57')]('custom:agentbusy',ut[_0x7dc9('0xa0')](_0x3045f0,'busy'));rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xc5'));_0x4c7c6b[_0x7dc9('0xa2')](_0x3045f0,'5',_0x25f8b3)['then'](function(_0x45f796){_0x2db560=_0x45f796[_0x7dc9('0xa3')]==0x1;if(!_0x2db560){if(ut['totalGlobal'](_0x3045f0)>=_0x25f8b3[_0x7dc9('0xa7')]){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0xf,_0x7dc9('0xa8'));rpcDb[_0x7dc9('0xa9')](_0xea1728,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3045f0[_0x7dc9('0xc2')]>=_0x25f8b3['dialBusyMaxRetry']){rpcDb[_0x7dc9('0xa9')](_0x3045f0,_0x7dc9('0xc5'));}else{rpcDb[_0x7dc9('0xac')](ut['scheduledAt'](_0x3045f0,_0x7dc9('0xc2'),_0x25f8b3[_0x7dc9('0xc4')]),_0x3045f0[_0x7dc9('0xc7')],_0x3045f0['activeContact']);}}}else{_0x3045f0['countbusyretry']++;_0x4c7c6b[_0x7dc9('0xb0')]({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countbusyretry':_0x3045f0['countbusyretry']}})['then'](function(){_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)[_0x7dc9('0x7e')](function(){});});}});break;case'NOANSWER':_0x25f8b3[_0x7dc9('0x3d')]+=0x1;_0x3045f0['countnoanswerretry']+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut[_0x7dc9('0xa6')](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x3,_0x7dc9('0xc8'));_0x436b0d=_0x25f8b3[_0x7dc9('0xc9')];_0x3d0988=_0x25f8b3[_0x7dc9('0xa5')];ami['emit'](_0x7dc9('0xca'),ut[_0x7dc9('0xa0')](_0x3045f0,_0x7dc9('0xcb')));rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xcc'));_0x4c7c6b['verifyAdditionalPhones'](_0x3045f0,'3',_0x25f8b3)[_0x7dc9('0x7e')](function(_0x2d7c09){_0x2db560=_0x2d7c09[_0x7dc9('0xa3')]==0x1;if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3['dialGlobalMaxRetry']){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0xf,_0x7dc9('0xa8'));rpcDb['createCustomerFinal'](_0xea1728,_0x7dc9('0xcd'));}else{if(_0x3045f0['countnoanswerretry']>=_0x25f8b3[_0x7dc9('0xce')]){rpcDb[_0x7dc9('0xa9')](_0x3045f0,_0x7dc9('0xcc'));}else{rpcDb[_0x7dc9('0xac')](ut[_0x7dc9('0xad')](_0x3045f0,_0x7dc9('0xcf'),_0x25f8b3[_0x7dc9('0xc9')]),_0x3045f0[_0x7dc9('0xc7')],_0x3045f0['activeContact']);}}}else{_0x3045f0[_0x7dc9('0xcf')]++;_0x4c7c6b[_0x7dc9('0xb0')]({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countnoanswerretry':_0x3045f0[_0x7dc9('0xcf')]}})[_0x7dc9('0x7e')](function(){_0x4c7c6b['swapAdditionalPhones'](_0x3045f0,_0x436b0d,_0x3d0988)[_0x7dc9('0x7e')](function(){});});}});break;case _0x7dc9('0xd0'):_0x25f8b3[_0x7dc9('0x39')]+=0x1;_0x3045f0[_0x7dc9('0xd1')]+=0x1;_0x3045f0['countglobal']=ut[_0x7dc9('0xa6')](_0x3045f0);ut['logCustomer'](_0x3045f0,0x8,_0x7dc9('0xd2'));_0x436b0d=_0x25f8b3['dialCongestionRetryFrequency'];_0x3d0988=_0x25f8b3[_0x7dc9('0xa5')];ami[_0x7dc9('0x57')](_0x7dc9('0xd3'),ut[_0x7dc9('0xa0')](_0x3045f0,_0x7dc9('0xd4')));rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xd5'));_0x4c7c6b[_0x7dc9('0xa2')](_0x3045f0,'8',_0x25f8b3)[_0x7dc9('0x7e')](function(_0x25eedc){_0x2db560=_0x25eedc[_0x7dc9('0xa3')]==0x1;if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3['dialGlobalMaxRetry']){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0xf,_0x7dc9('0xa8'));rpcDb[_0x7dc9('0xa9')](_0xea1728,_0x7dc9('0xd6'));}else{if(_0x3045f0['countcongestionretry']>=_0x25f8b3[_0x7dc9('0xd7')]){rpcDb[_0x7dc9('0xa9')](_0x3045f0,_0x7dc9('0xd5'));}else{rpcDb[_0x7dc9('0xac')](ut['scheduledAt'](_0x3045f0,_0x7dc9('0xd1'),_0x25f8b3[_0x7dc9('0xc4')]),_0x3045f0[_0x7dc9('0xc7')],_0x3045f0['activeContact']);}}}else{_0x3045f0['countcongestionretry']++;_0x4c7c6b[_0x7dc9('0xb0')]({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countcongestionretry':_0x3045f0[_0x7dc9('0xd1')]}})[_0x7dc9('0x7e')](function(){_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)['then'](function(){});});}});break;case _0x7dc9('0xd8'):_0x25f8b3[_0x7dc9('0xd9')]+=0x1;_0x3045f0[_0x7dc9('0xda')]+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut['totalGlobal'](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x14,'AgentReject');_0x436b0d=_0x25f8b3[_0x7dc9('0xdb')];_0x3d0988=_0x25f8b3['callAdditionalPhoneAfterMin'];ami[_0x7dc9('0x57')](_0x7dc9('0xdc'),ut[_0x7dc9('0xa0')](_0x3045f0,'agentreject'));rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xdd'));_0x4c7c6b['verifyAdditionalPhones'](_0x3045f0,'20',_0x25f8b3)['then'](function(_0x11396a){_0x2db560=_0x11396a['additional']==0x1;if(!_0x2db560){if(ut['totalGlobal'](_0x3045f0)>=_0x25f8b3[_0x7dc9('0xa7')]){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0x14,_0x7dc9('0xde'));rpcDb['createCustomerFinal'](_0xea1728,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3045f0['countagentrejectretry']>=_0x25f8b3[_0x7dc9('0xdf')]){rpcDb[_0x7dc9('0xa9')](_0x3045f0,_0x7dc9('0xe0'));}else{rpcDb[_0x7dc9('0xac')](ut['scheduledAt'](_0x3045f0,'countagentrejectretry',_0x25f8b3[_0x7dc9('0xdb')]),_0x3045f0[_0x7dc9('0xc7')],_0x3045f0[_0x7dc9('0xe1')]);}}}else{_0x3045f0['countnoanswerretry']++;_0x4c7c6b['incrementPreviewCounters']({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countnoanswerretry':_0x3045f0['countnoanswerretry']}})[_0x7dc9('0x7e')](function(){_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)['then'](function(){});});}});break;case _0x7dc9('0xe2'):_0x25f8b3[_0x7dc9('0xe3')]+=0x1;_0x3045f0[_0x7dc9('0xe4')]+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut[_0x7dc9('0xa6')](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0xb,_0x7dc9('0xe5'));rpcDb[_0x7dc9('0x8f')](_0x3045f0,'[callProgressDetectingCustomer][logAbandoned]');_0x4c7c6b[_0x7dc9('0xa2')](_0x3045f0,'11',_0x25f8b3)['then'](function(_0x1381a1){_0x2db560=_0x1381a1['additional']==0x1;if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3[_0x7dc9('0xa7')]){_0xea1728=ut['cloneAction'](_0x3045f0,0xf,_0x7dc9('0xa8'));rpcDb[_0x7dc9('0xa9')](_0xea1728,_0x7dc9('0xe6'));}else{if(_0x3045f0[_0x7dc9('0xe7')]>=_0x25f8b3[_0x7dc9('0xe8')]){rpcDb['createCustomerFinal'](_0x3045f0,_0x7dc9('0xe6'));}else{rpcDb['rescheduleContact'](ut[_0x7dc9('0xad')](_0x3045f0,_0x7dc9('0xe4'),_0x25f8b3[_0x7dc9('0xe9')]),_0x3045f0[_0x7dc9('0xc7')],_0x3045f0['activeContact']);}}}else{_0x3045f0[_0x7dc9('0xcf')]++;_0x4c7c6b[_0x7dc9('0xb0')]({'id':_0x3045f0['idContact'],'field':{'countnoanswerretry':_0x3045f0[_0x7dc9('0xcf')]}})[_0x7dc9('0x7e')](function(){_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)[_0x7dc9('0x7e')](function(){});});}});break;case'18':_0x25f8b3['outboundUnknownCallsDay']+=0x1;_0x3045f0[_0x7dc9('0xea')]+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut[_0x7dc9('0xa6')](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x12,_0x123fa8[_0x7dc9('0xeb')]||_0x123fa8['dialstatus']);ami[_0x7dc9('0x57')](_0x7dc9('0xec'),ut[_0x7dc9('0xa0')](_0x3045f0,_0x7dc9('0xed')));rpcDb['createCustomerHistory'](_0x3045f0,_0x7dc9('0xee'));_0x4c7c6b['verifyAdditionalPhones'](_0x3045f0,'18',_0x25f8b3)['then'](function(_0x4e19f4){_0x2db560=_0x4e19f4[_0x7dc9('0xa3')]==0x1;if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3[_0x7dc9('0xa7')]){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0x12,_0x7dc9('0xa8'));rpcDb[_0x7dc9('0xa9')](_0xea1728,_0x7dc9('0xee'));}else{rpcDb[_0x7dc9('0xa9')](_0x3045f0,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x3045f0[_0x7dc9('0xcf')]++;_0x4c7c6b[_0x7dc9('0xb0')]({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countnoanswerretry':_0x3045f0['countnoanswerretry']}})[_0x7dc9('0x7e')](function(){_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)[_0x7dc9('0x7e')](function(){});});}});delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xae')]];break;case'19':_0x25f8b3[_0x7dc9('0xef')]+=0x1;_0x3045f0[_0x7dc9('0x9e')]=ut[_0x7dc9('0xa6')](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0x13,_0x123fa8[_0x7dc9('0xeb')]||_0x123fa8[_0x7dc9('0xf0')]);ami[_0x7dc9('0x57')](_0x7dc9('0xec'),ut[_0x7dc9('0xa0')](_0x3045f0,_0x7dc9('0xed')));rpcDb[_0x7dc9('0x8f')](_0x3045f0,_0x7dc9('0xf1'));_0x4c7c6b[_0x7dc9('0xa2')](_0x3045f0,'18',_0x25f8b3)[_0x7dc9('0x7e')](function(_0x26868d){_0x2db560=_0x26868d['additional']==0x1;if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3['dialGlobalMaxRetry']){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0xf,'Global');rpcDb['createCustomerFinal'](_0xea1728,_0x7dc9('0xf1'));}else{rpcDb[_0x7dc9('0xa9')](_0x3045f0,'[callProgressDetectingCustomer][machine]');}}else{_0x3045f0[_0x7dc9('0xcf')]++;_0x4c7c6b['incrementPreviewCounters']({'id':_0x3045f0[_0x7dc9('0xaf')],'field':{'countnoanswerretry':_0x3045f0[_0x7dc9('0xcf')]}})['then'](function(){_0x4c7c6b['swapAdditionalPhones'](_0x3045f0,_0x436b0d,_0x3d0988)[_0x7dc9('0x7e')](function(){});});}});delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xae')]];break;default:if(_0x3045f0[_0x7dc9('0x6e')]){ut['decrementTalkink'](_0x25f8b3,_0x7dc9('0xf2'));ut[_0x7dc9('0x78')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x25f8b3[_0x7dc9('0x27')],_0x123fa8);}_0x25f8b3[_0x7dc9('0xef')]+=0x1;_0x3045f0['countglobal']=ut['totalGlobal'](_0x3045f0);ut[_0x7dc9('0x8a')](_0x3045f0,0xc,_0x123fa8[_0x7dc9('0xeb')]||_0x123fa8[_0x7dc9('0xf0')]);_0x436b0d=_0x25f8b3[_0x7dc9('0xdb')];_0x3d0988=_0x25f8b3['callAdditionalPhoneAfterMin'];rpcDb[_0x7dc9('0x8f')](_0x3045f0,'[callProgressDetectingCustomer][logUnknown]');_0x4c7c6b['verifyAdditionalPhones'](_0x3045f0,'20',_0x25f8b3)[_0x7dc9('0x7e')](function(_0x21c674){_0x2db560=_0x21c674[_0x7dc9('0xa3')]==0x1;if(!_0x2db560){if(ut[_0x7dc9('0xa6')](_0x3045f0)>=_0x25f8b3[_0x7dc9('0xa7')]){_0xea1728=ut[_0x7dc9('0xc6')](_0x3045f0,0xf,_0x7dc9('0xa8'));rpcDb['createCustomerFinal'](_0xea1728,_0x7dc9('0xf3'));}else{rpcDb[_0x7dc9('0xa9')](_0x3045f0,_0x7dc9('0xf3'));}delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xae')]];}else{_0x4c7c6b[_0x7dc9('0xb1')](_0x3045f0,_0x436b0d,_0x3d0988)[_0x7dc9('0x7e')](function(_0x56e7e8){});}});}if(!(_0x3045f0[_0x7dc9('0x6e')]&&_0x59f3bd==='16')){ut[_0x7dc9('0xf4')](_0x25f8b3,_0x7dc9('0xf5'));logger[_0x7dc9('0x53')](_0x7dc9('0xf6'),_0x3045f0['uniqueid'],_0x7dc9('0xb5'),_0x25f8b3['name'],_0x7dc9('0x6c'),_0x25f8b3[_0x7dc9('0x45')]);}if(_0x59f3bd!=='ANSWER'){delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xae')]];delete this[_0x7dc9('0x69')][_0x123fa8[_0x7dc9('0xf7')]];}}};Preview[_0x7dc9('0xf')][_0x7dc9('0xf8')]=function(_0x566f00,_0x15f172,_0x380766){if(_['isUndefined'](_0x15f172)&&_0x7dc9('0xf9')!==typeof _0x15f172){return;}if(_[_0x7dc9('0xfa')](_0x380766)&&'object'!==typeof _0x380766){return;}switch(_0x380766['reason']){case'0':ut[_0x7dc9('0xfb')](_0x566f00,0x0,_0x7dc9('0x9f'));rpcDb[_0x7dc9('0xfc')](_0x566f00,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x7dc9('0xfb')](_0x566f00,0x3,'NoAnswer');rpcDb[_0x7dc9('0xfc')](_0x566f00,_0x7dc9('0xfd'));break;case'5':ut[_0x7dc9('0xfb')](_0x566f00,0x5,'Busy');rpcDb[_0x7dc9('0xfc')](_0x566f00,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x566f00,0x8,_0x7dc9('0xd2'));rpcDb[_0x7dc9('0xfc')](_0x566f00,_0x7dc9('0xfe'));break;case'22':ut[_0x7dc9('0xfb')](_0x566f00,0x16,_0x7dc9('0xff'));rpcDb['createAgentHistory'](_0x566f00,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x7dc9('0xfb')](_0x566f00,0xc,_0x380766[_0x7dc9('0x100')]);rpcDb[_0x7dc9('0xfc')](_0x566f00,_0x7dc9('0xfe'));}ut['updateOriginated'](_0x15f172,_0x7dc9('0x101'));logger['info'](_0x7dc9('0x102'),_0x566f00['uniqueid'],_0x7dc9('0xb5'),_0x15f172[_0x7dc9('0x27')],'originated:\x20',_0x15f172[_0x7dc9('0x45')]);delete this[_0x7dc9('0x69')][_0x566f00[_0x7dc9('0xc0')]];};Preview[_0x7dc9('0xf')][_0x7dc9('0xa2')]=function(_0x5b1711,_0x2491ea,_0x1ec900){return BPromise[_0x7dc9('0x103')]()[_0x7dc9('0x7e')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5b1711,_0x2491ea,_0x1ec900))[_0x7dc9('0x75')](logger[_0x7dc9('0x53')](_0x7dc9('0x104')));};Preview[_0x7dc9('0xf')]['swapAdditionalPhones']=function(_0x528746,_0x48e807,_0xf20cc0){return BPromise[_0x7dc9('0x103')]()[_0x7dc9('0x7e')](cmHopperAdditionalPhone[_0x7dc9('0xb1')](_0x528746,_0x48e807,_0xf20cc0))['catch'](logger[_0x7dc9('0x53')]('[swapAdditionalPhone]\x20'));};Preview['prototype']['incrementPreviewCounters']=function(_0x2e1bf9){return BPromise[_0x7dc9('0x103')]()[_0x7dc9('0x7e')](cmHopperAdditionalPhone[_0x7dc9('0xb0')](_0x2e1bf9))['catch'](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0x7dc9('0xf')][_0x7dc9('0x105')]=function(_0x6d8cd0,_0x29c7c5,_0x1f0722,_0x1b2a9a,_0x4b707c){var _0x85ca86=this;return new BPromise(function(_0x34ef15,_0x8a3fd1){if(_[_0x7dc9('0x68')](_0x29c7c5)||_[_0x7dc9('0x68')](_0x29c7c5[_0x7dc9('0x106')])||_[_0x7dc9('0x68')](_0x29c7c5['phone'])||_['isNil'](_0x29c7c5[_0x7dc9('0x72')])){_0x8a3fd1(ut[_0x7dc9('0x5a')](_0x7dc9('0x107'),_0x1b2a9a,_0x4b707c));return;}var _0x542860=uuid['v4']();var _0x3bce10=_0x85ca86[_0x7dc9('0x24')][_0x29c7c5[_0x7dc9('0x108')][_0x7dc9('0x27')]];var _0x3d22b8=_0x1f0722?_0x85ca86[_0x7dc9('0x14')][_0x1f0722]['id']:undefined;_0x85ca86[_0x7dc9('0x69')][_0x542860]=new Action(_0x29c7c5,_0x3bce10,_0x542860,_0x1f0722,_0x3d22b8);var _0x2f24ef=_0x85ca86[_0x7dc9('0x69')][_0x542860];_0x2f24ef[_0x7dc9('0xc7')]=_0x1b2a9a;_0x2f24ef[_0x7dc9('0xe1')]=_0x4b707c;_0x2f24ef[_0x7dc9('0x109')]=_0x1f0722;if(_[_0x7dc9('0x10a')](_0x6d8cd0)){_0x85ca86[_0x7dc9('0x10b')](_0x2f24ef,_0x3bce10,_0x29c7c5,_0x1f0722)['then'](function(_0x3d3d25){logger[_0x7dc9('0x53')](_0x7dc9('0x10c'),_0x7dc9('0x10d')+_0x2f24ef[_0x7dc9('0x6b')]+_0x7dc9('0x10e')+_0x2f24ef['idContact'],JSON[_0x7dc9('0x4f')](_0x3d3d25));ami[_0x7dc9('0x57')](_0x7dc9('0x10f'),ut[_0x7dc9('0xa0')](_0x2f24ef,_0x7dc9('0x110'),_0x85ca86['campaignsPreview'][_0x2f24ef[_0x7dc9('0x6b')]]));_0x34ef15(ut[_0x7dc9('0x5a')]('Calling'));})[_0x7dc9('0x75')](function(_0x5f1bb2){ut[_0x7dc9('0x5c')](_0x7dc9('0x111'),_0x5f1bb2);_0x8a3fd1(ut[_0x7dc9('0x5a')](_0x7dc9('0x112'),_0x1b2a9a,_0x4b707c));});}else{_0x3bce10[_0x7dc9('0x37')]+=0x1;ut[_0x7dc9('0x113')](_0x2f24ef);rpcDb['createHistory'](_0x2f24ef,'[Blacklist][error]');delete _0x85ca86[_0x7dc9('0x69')][_0x542860];_0x8a3fd1(ut[_0x7dc9('0x5a')]('Contact\x20in\x20black\x20List',_0x1b2a9a,_0x4b707c));}});};Preview[_0x7dc9('0xf')][_0x7dc9('0x97')]=function(_0x3529c3){return!_[_0x7dc9('0x68')](_0x3529c3)&&!_[_0x7dc9('0x68')](_0x3529c3[_0x7dc9('0x27')])&&!_[_0x7dc9('0x68')](_0x3529c3[_0x7dc9('0x4d')])&&_0x3529c3[_0x7dc9('0x4d')]&&!_[_0x7dc9('0x68')](this['trunks'][util[_0x7dc9('0x55')](_0x7dc9('0x114'),_0x3529c3[_0x7dc9('0x27')])])&&!_['isNil'](this[_0x7dc9('0x13')][util[_0x7dc9('0x55')](_0x7dc9('0x114'),_0x3529c3['name'])][_0x7dc9('0x74')])&&(this[_0x7dc9('0x13')][util['format'](_0x7dc9('0x114'),_0x3529c3[_0x7dc9('0x27')])][_0x7dc9('0x74')]===_0x7dc9('0x115')||this[_0x7dc9('0x13')][util[_0x7dc9('0x55')](_0x7dc9('0x114'),_0x3529c3[_0x7dc9('0x27')])][_0x7dc9('0x74')]===_0x7dc9('0x116'));};Preview[_0x7dc9('0xf')][_0x7dc9('0x83')]=function(_0x1b011e,_0x400112){var _0x219778=this;return new BPromise(function(_0x27c12f,_0x162879){_0x219778['execRun'](_0x1b011e,_0x400112)['then'](function(_0x2ace9e){_0x27c12f(_[_0x7dc9('0x6f')](_0x2ace9e,[_0x7dc9('0x5a')]));})[_0x7dc9('0x75')](function(_0x5bd320){if(_0x5bd320[_0x7dc9('0x117')]){rpcDb[_0x7dc9('0x118')](_0x1b011e);}if(_0x5bd320[_0x7dc9('0x4d')]){rpcDb[_0x7dc9('0x86')](_0x1b011e);}_0x162879(_[_0x7dc9('0x6f')](_0x5bd320,[_0x7dc9('0x5a')]));});});};Preview[_0x7dc9('0xf')]['execRun']=function(_0xd2d434,_0x2e3e9e){var _0x16b570=this;return new BPromise(function(_0x55be66,_0x1d3352){var _0x582b74,_0x246db1;rpcDb[_0x7dc9('0x119')](_0xd2d434)[_0x7dc9('0x7e')](function(_0x3f7d9f){if(!_[_0x7dc9('0x68')](_0x3f7d9f[0x0])){_0x246db1=_0x3f7d9f[0x0][_0x7dc9('0x11a')]?![]:!![];_0x582b74=_0x3f7d9f[0x0]['recallme']?!![]:![];_0x582b74=_0x2e3e9e?!![]:_0x582b74;}var _0x2ea347=_0x16b570[_0x7dc9('0x11b')](_0x3f7d9f);if(_0x2ea347[_0x7dc9('0x11c')]){rpcDb[_0x7dc9('0x11d')](_[_0x7dc9('0x6f')](_0x3f7d9f[0x0],['VoiceQueueId','phone']))['then'](function(_0x454da2){_0x16b570[_0x7dc9('0x105')](_0x454da2,_0x3f7d9f[0x0],_0x2e3e9e,_0x246db1,_0x582b74)[_0x7dc9('0x7e')](function(_0x5c1fb1){_0x55be66(_0x5c1fb1);})['catch'](function(_0x2c6f00){_0x1d3352(_0x2c6f00);});})['catch'](function(_0x277eb7){ut[_0x7dc9('0x5c')]('[Preview][checkIsBlackList]',_0x277eb7);_0x1d3352(ut['message']('Call\x20unsuccessful',_0x246db1,_0x582b74));});}else{_0x1d3352(ut[_0x7dc9('0x5a')](_0x2ea347[_0x7dc9('0x5a')],_0x246db1,_0x582b74));}})[_0x7dc9('0x75')](function(_0x10948f){ut[_0x7dc9('0x5c')](_0x7dc9('0x11e'),_0x10948f);_0x1d3352(ut[_0x7dc9('0x5a')](_0x7dc9('0x11f'),![],!![]));});});};Preview[_0x7dc9('0xf')][_0x7dc9('0x11b')]=function(_0x32ed48){if(_[_0x7dc9('0x68')](_0x32ed48)||_[_0x7dc9('0x10a')](_0x32ed48)||!_[_0x7dc9('0x68')](_0x32ed48[0x0]['Agent'])&&_[_0x7dc9('0x68')](_0x32ed48[0x0][_0x7dc9('0x81')][_0x7dc9('0x27')])){ut[_0x7dc9('0x5c')](_0x7dc9('0x120'),_0x32ed48);return{'isValid':![],'message':_0x7dc9('0x121')};}var _0x204d0d=this[_0x7dc9('0x24')][_0x32ed48[0x0][_0x7dc9('0x108')][_0x7dc9('0x27')]];_0x204d0d[_0x7dc9('0x5a')]=_0x7dc9('0x9a');if(_['isNil'](_0x204d0d)){ut[_0x7dc9('0x5c')](_0x7dc9('0x122'),_0x204d0d);return{'isValid':![],'message':_0x7dc9('0x123')};}if(!this[_0x7dc9('0x97')](_0x204d0d[_0x7dc9('0x4c')])){ut[_0x7dc9('0x5c')](_0x7dc9('0x124'),_0x7dc9('0x125')+_0x204d0d[_0x7dc9('0x27')]+_0x7dc9('0x126'));if(!this[_0x7dc9('0x97')](_0x204d0d[_0x7dc9('0x98')])){ut[_0x7dc9('0x5c')](_0x7dc9('0x124'),_0x204d0d[_0x7dc9('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x7dc9('0x127')};}}if(!ut[_0x7dc9('0x96')](_0x204d0d[_0x7dc9('0x64')])){ut[_0x7dc9('0x5c')](_0x7dc9('0x128'),_0x204d0d['name']+_0x7dc9('0x129'));return{'isValid':![],'message':_0x7dc9('0x125')+_0x204d0d[_0x7dc9('0x27')]+_0x7dc9('0x129')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x7dc9('0xf')][_0x7dc9('0x10b')]=function(_0x1676dd,_0x518581,_0x45957b,_0x483dcf){var _0x316911=this;return new BPromise(function(_0x559aa7,_0x2ece67){var _0x179743=_0x1676dd['uniqueid'];var _0x4ede85=_0x316911[_0x7dc9('0x97')](_0x518581[_0x7dc9('0x4c')])?util[_0x7dc9('0x55')](_0x7dc9('0x12a'),_0x518581[_0x7dc9('0x4c')][_0x7dc9('0x27')],_[_0x7dc9('0x68')](_0x518581['dialPrefix'])?'':_0x518581[_0x7dc9('0x34')][_0x7dc9('0x12b')]()||'',_0x518581['dialCutDigit']>0x0?_0x45957b[_0x7dc9('0x12c')][_0x7dc9('0x12d')](_0x518581[_0x7dc9('0x12e')]):_0x45957b['phone']):util[_0x7dc9('0x55')]('SIP/%s/%s%s',_[_0x7dc9('0x68')](_0x518581[_0x7dc9('0x98')])?_0x518581['Trunk'][_0x7dc9('0x27')]:_0x518581['TrunkBackup'][_0x7dc9('0x27')],_[_0x7dc9('0x68')](_0x518581[_0x7dc9('0x34')])?'':_0x518581[_0x7dc9('0x34')][_0x7dc9('0x12b')]()||'',_0x518581['dialCutDigit']>0x0?_0x45957b[_0x7dc9('0x12c')][_0x7dc9('0x12d')](_0x518581[_0x7dc9('0x12e')]):_0x45957b[_0x7dc9('0x12c')]);var _0x2b0f9c=_0x316911['isTrunkReachable'](_0x518581[_0x7dc9('0x4c')])?ut[_0x7dc9('0x12f')](_0x518581[_0x7dc9('0x4c')][_0x7dc9('0x130')],_0x518581['dialOriginateCallerIdName'],_0x518581['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x518581[_0x7dc9('0x32')],_0x518581[_0x7dc9('0x131')]):_0x518581[_0x7dc9('0x32')]):ut['getCallerId'](_[_0x7dc9('0x68')](_0x518581[_0x7dc9('0x98')])?_0x518581[_0x7dc9('0x4c')][_0x7dc9('0x130')]:_0x518581[_0x7dc9('0x98')][_0x7dc9('0x130')],_0x518581[_0x7dc9('0x132')],_0x518581[_0x7dc9('0x131')]>0x0?ut[_0x7dc9('0x133')](_0x518581[_0x7dc9('0x32')],_0x518581['dialRandomLastDigitCallerIdNumber']):_0x518581[_0x7dc9('0x32')]);if(_0x2b0f9c){_0x1676dd[_0x7dc9('0x134')]=ut[_0x7dc9('0x135')](_0x2b0f9c);_0x1676dd['originatecalleridnum']=ut[_0x7dc9('0x136')](_0x2b0f9c);}var _0x326792=ut[_0x7dc9('0x137')](_0x518581,_0x45957b,_0x4ede85,_0x2b0f9c,_0x179743,_0x1676dd);_[_0x7dc9('0x138')](_0x1676dd,ut['toLowerVariables'](_0x326792));_0x1676dd[_0x7dc9('0x87')]=moment()[_0x7dc9('0x55')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut['variablesAction'](_0x1676dd,_0x518581,_0x326792,_0x1676dd['activeContact'],_0x483dcf))[_0x7dc9('0x7e')](function(_0x25ea73){_0x518581[_0x7dc9('0x45')]+=0x1;logger['info'](_0x7dc9('0x139'),_0x179743,_0x7dc9('0xb5'),_0x518581[_0x7dc9('0x27')],'originated:\x20',_0x518581['originated']);_0x559aa7(_0x25ea73);})[_0x7dc9('0x75')](function(_0xe411e7){ut[_0x7dc9('0xfb')](_0x1676dd,0xe,'OriginateError');rpcDb[_0x7dc9('0xfc')](_0x1676dd,_0x7dc9('0x13a'));_0x2ece67(_0xe411e7);});});};Preview[_0x7dc9('0xf')][_0x7dc9('0x13b')]=function(_0x41b416){if(this[_0x7dc9('0x69')][_0x41b416[_0x7dc9('0xae')]]){this[_0x7dc9('0x69')][_0x41b416[_0x7dc9('0xae')]]['channel']=_0x41b416[_0x7dc9('0x13c')];}};Preview['prototype']['syncOriginateResponse']=function(_0x17f3ac){var _0x2fb596=this;var _0x28fb2e=this[_0x7dc9('0x69')][_0x17f3ac[_0x7dc9('0x13d')]];if(_0x28fb2e){if(_0x28fb2e[_0x7dc9('0x109')]&&this[_0x7dc9('0x14')][_0x28fb2e[_0x7dc9('0x109')]]){ut[_0x7dc9('0x13e')](_0x28fb2e,this['agents'][_0x28fb2e['lookAgent']][_0x7dc9('0x27')],this[_0x7dc9('0x14')][_0x28fb2e[_0x7dc9('0x109')]]['id']);}var _0x26a03d=_[_0x7dc9('0x13f')](_0x28fb2e);_0x26a03d['responsetime']=moment()[_0x7dc9('0x55')](_0x7dc9('0x88'));var _0x4f4e80=_0x2fb596[_0x7dc9('0x24')][_0x28fb2e[_0x7dc9('0x6b')]];if(ut['isFailure'](_0x17f3ac[_0x7dc9('0x140')])){if(_0x28fb2e['unlockAgent']){rpcDb[_0x7dc9('0x118')](_0x28fb2e['idContact']);}if(_0x28fb2e[_0x7dc9('0xe1')]){rpcDb[_0x7dc9('0x86')](_0x28fb2e[_0x7dc9('0xaf')]);}ami[_0x7dc9('0x57')]('custom:agentringnoanswer',ut['buildObj'](_0x28fb2e,_0x7dc9('0x141'),this[_0x7dc9('0x24')][_0x28fb2e['queue']]));this[_0x7dc9('0xf8')](_0x26a03d,_0x4f4e80,_0x17f3ac);}else{_0x28fb2e[_0x7dc9('0x87')]=moment()[_0x7dc9('0x55')](_0x7dc9('0x88'));ut[_0x7dc9('0xfb')](_0x26a03d,0x4,_0x7dc9('0x142'));rpcDb[_0x7dc9('0xfc')](_0x26a03d,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x7dc9('0xf')][_0x7dc9('0x19')]=function(_0x109018){var _0x732bc3=this;var _0x5e7cf2=this[_0x7dc9('0x69')][_0x109018[_0x7dc9('0xae')]];var _0xef7258;if(_0x5e7cf2){_0xef7258=this[_0x7dc9('0x24')][_0x5e7cf2[_0x7dc9('0x6b')]];logger['info'](_0x7dc9('0x143'),_0x109018[_0x7dc9('0xae')],_0x7dc9('0xb5'),_0xef7258[_0x7dc9('0x27')],_0x7dc9('0x6d'),_0xef7258[_0x7dc9('0x2b')]);}if(this[_0x7dc9('0x69')][_0x109018[_0x7dc9('0xae')]]&&_0x109018[_0x7dc9('0xae')]!==_0x109018[_0x7dc9('0xc0')]){if(_0x109018['cause']==='16'&&this['actions'][_0x109018[_0x7dc9('0xae')]][_0x7dc9('0x6e')]){this[_0x7dc9('0x9b')](_0x109018,_0x109018[_0x7dc9('0xae')],_0x109018[_0x7dc9('0x144')]);}else if(this[_0x7dc9('0x69')][_0x109018[_0x7dc9('0xae')]][_0x7dc9('0x6e')]){logger['info'](_0x7dc9('0x145'),_0x109018[_0x7dc9('0xae')],_0x109018[_0x7dc9('0x144')],_0x7dc9('0xb5'),_0xef7258[_0x7dc9('0x27')],'pTalking:\x20',_0xef7258[_0x7dc9('0x2b')]);this[_0x7dc9('0x9b')](_0x109018,_0x109018[_0x7dc9('0xae')],_0x109018['cause']);}}else if(_0x5e7cf2&&_[_0x7dc9('0x68')](_0x5e7cf2[_0x7dc9('0x146')])&&_0xef7258[_0x7dc9('0x147')]&&_0x109018[_0x7dc9('0xae')]===_0x109018[_0x7dc9('0xc0')]&&_[_0x7dc9('0x68')](_0x109018[_0x7dc9('0x100')])&&_0x109018[_0x7dc9('0x144')]==='16'&&_0x109018[_0x7dc9('0x148')]==='6'&&_['isUndefined'](_0x5e7cf2[_0x7dc9('0x149')])){if(_0x5e7cf2[_0x7dc9('0xc7')]){rpcDb['unlockContact'](_0x5e7cf2[_0x7dc9('0xaf')]);}if(_0x5e7cf2[_0x7dc9('0xe1')]){rpcDb[_0x7dc9('0x86')](_0x5e7cf2['idContact']);}_0x109018[_0x7dc9('0x100')]='22';this[_0x7dc9('0xf8')](_0x5e7cf2,_0xef7258,_0x109018);}else if(_0x5e7cf2&&_0x5e7cf2[_0x7dc9('0x149')]){if(_0x109018['cause']==='16'&&this['actions'][_0x109018[_0x7dc9('0xae')]]['dialAnswer']){logger['info'](_0x7dc9('0x14a'),_0x109018[_0x7dc9('0xae')],_0x109018[_0x7dc9('0x144')],_0x7dc9('0xb5'),_0xef7258[_0x7dc9('0x27')],_0x7dc9('0x6d'),_0xef7258[_0x7dc9('0x2b')]);this[_0x7dc9('0x9b')](_0x109018,_0x109018['linkedid'],_0x109018['cause']);}else if(this[_0x7dc9('0x69')][_0x109018[_0x7dc9('0xae')]]['dialAnswer']){logger['info'](_0x7dc9('0x145'),_0x109018[_0x7dc9('0xae')],_0x109018[_0x7dc9('0x144')],_0x7dc9('0xb5'),_0xef7258[_0x7dc9('0x27')],_0x7dc9('0x6d'),_0xef7258['pTalking']);this[_0x7dc9('0x9b')](_0x109018,_0x109018[_0x7dc9('0xae')],_0x109018['cause']);}}};Preview[_0x7dc9('0xf')]['syncDialEnd']=function(_0xc3201b){if(this[_0x7dc9('0x69')][_0xc3201b[_0x7dc9('0xf7')]]&&_0xc3201b[_0x7dc9('0xf7')]!==_0xc3201b[_0x7dc9('0x14b')]){this['callProgressDetectingCustomer'](_0xc3201b,_0xc3201b[_0x7dc9('0xf7')],_0xc3201b['dialstatus']);}};Preview['prototype'][_0x7dc9('0x1b')]=function(_0x5db2ef){if(this[_0x7dc9('0x69')][_0x5db2ef[_0x7dc9('0xae')]]&&_0x5db2ef[_0x7dc9('0xae')]!==_0x5db2ef[_0x7dc9('0xc0')]&&!this[_0x7dc9('0x69')][_0x5db2ef['linkedid']]['dialAnswer']){if(_0x5db2ef[_0x7dc9('0x144')]==='1'){this['callProgressDetectingCustomer'](_0x5db2ef,_0x5db2ef[_0x7dc9('0xae')],_0x5db2ef[_0x7dc9('0x144')]);}}};Preview[_0x7dc9('0xf')][_0x7dc9('0x14c')]=function(_0xcac261,_0x2eef5e,_0x2865c6){if(this[_0x7dc9('0x69')][_0xcac261]){if(_['isNil'](this['actions'][_0xcac261]['variables'])){this[_0x7dc9('0x69')][_0xcac261]['variables']={};}this['actions'][_0xcac261][_0x7dc9('0x14d')][_0x2eef5e]=_0x2865c6;}};Preview['prototype']['syncVarSet']=function(_0x8cda77){try{if(!_[_0x7dc9('0x68')](_0x8cda77)){if(ut[_0x7dc9('0x14e')](_[_0x7dc9('0x14f')](_0x8cda77[_0x7dc9('0x150')])[0x0])){this[_0x7dc9('0x14c')](_0x8cda77[_0x7dc9('0xc0')],_[_0x7dc9('0x14f')](_0x8cda77[_0x7dc9('0x150')])[0x0],_0x8cda77['value']);}}}catch(_0x596e62){logger[_0x7dc9('0x151')]('[syncVarSet][Preview]',util[_0x7dc9('0x152')](_0x596e62,{'showHidden':![],'depth':null}));}};Preview[_0x7dc9('0xf')]['syncAttendedTransfer']=function(_0x4c0b64){if(_0x4c0b64){if(this[_0x7dc9('0x69')][_0x4c0b64['transfertargetlinkedid']]){this[_0x7dc9('0x69')][_0x4c0b64[_0x7dc9('0x153')]][_0x7dc9('0x149')]=!![];}}};Preview[_0x7dc9('0xf')][_0x7dc9('0x22')]=function(_0x1f190b){if(_0x1f190b){if(this[_0x7dc9('0x69')][_0x1f190b[_0x7dc9('0x154')]]){this[_0x7dc9('0x69')][_0x1f190b['transfererlinkedid']]['transfer']=!![];}}};module[_0x7dc9('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index acf2e49..92bf0e7 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 _0xe7c3=['moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20'];(function(_0x2516f2,_0x10b694){var _0x1cdcad=function(_0x206ae0){while(--_0x206ae0){_0x2516f2['push'](_0x2516f2['shift']());}};_0x1cdcad(++_0x10b694);}(_0xe7c3,0x18d));var _0x3e7c=function(_0x372727,_0x39eba5){_0x372727=_0x372727-0x0;var _0x31bb4b=_0xe7c3[_0x372727];return _0x31bb4b;};'use strict';var util=require(_0x3e7c('0x0'));var BPromise=require(_0x3e7c('0x1'));var logger=require(_0x3e7c('0x2'))(_0x3e7c('0x3'));var _=require(_0x3e7c('0x4'));var cmHopper=require(_0x3e7c('0x5'));var cmHopperFinal=require(_0x3e7c('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x3e7c('0x7'));var voiceQueueRt=require(_0x3e7c('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x3e7c('0x9'));function loggerCatch(_0x446782){return function(_0x145369){logger[_0x3e7c('0xa')](_0x446782,util['inspect'](_0x145369,{'showHidden':![],'depth':null}));};}function create(_0x1f997f){return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](cmHopperHistory[_0x3e7c('0xd')](_0x1f997f))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0xf')));}function createAgent(_0x446a96){return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](agentReportPreview['createHistory'](_0x446a96))['catch'](loggerCatch(_0x3e7c('0xf')));}function moveContact(_0x3534fc){return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](cmHopper[_0x3e7c('0x10')](_0x3534fc,!![]))['catch'](loggerCatch(_0x3e7c('0x11')));}exports[_0x3e7c('0x12')]=function(_0x39b016){return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](cmHopperBlack[_0x3e7c('0x12')](_0x39b016))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0x13')));};exports[_0x3e7c('0x14')]=function(_0x5afb22){return BPromise[_0x3e7c('0xb')]()['then'](cmHopper[_0x3e7c('0x14')](_0x5afb22))['catch'](loggerCatch(_0x3e7c('0x15')));};exports[_0x3e7c('0xd')]=function(_0x10a8f0,_0x42c2b9){create(_0x10a8f0)[_0x3e7c('0xe')](loggerCatch(_0x42c2b9));moveContact(_0x10a8f0)[_0x3e7c('0xe')](loggerCatch(_0x42c2b9));};exports[_0x3e7c('0x16')]=function(_0x1486e7,_0x95db1a){createAgent(_0x1486e7)[_0x3e7c('0xe')](loggerCatch(_0x95db1a));};exports['createCustomerHistory']=function(_0x1f6070,_0x318804){create(_0x1f6070)[_0x3e7c('0xe')](loggerCatch(_0x318804));};exports[_0x3e7c('0x17')]=function(_0x42f128,_0x30bbf2){moveContact(_0x42f128)[_0x3e7c('0xe')](loggerCatch(_0x30bbf2));};exports[_0x3e7c('0x18')]=function(_0x59587d,_0x2cf2ab,_0x3b80c1){if(_0x2cf2ab){_0x59587d['UserId']=null;}if(_0x3b80c1){_0x59587d[_0x3e7c('0x19')]=![];}return BPromise[_0x3e7c('0xb')]()['then'](cmHopper['rescheduleContact'](_0x59587d))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0x1a')));};exports[_0x3e7c('0x1b')]=function(_0x4f2203){return BPromise['resolve']()['then'](cmHopper[_0x3e7c('0x1b')](_0x4f2203))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0x1c')));};exports[_0x3e7c('0x1d')]=function(_0x266b1d){return BPromise[_0x3e7c('0xb')]()['then'](cmHopper[_0x3e7c('0x1d')]({'UserId':null},_0x266b1d,0x1))[_0x3e7c('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x3e7c('0x1e')]=function(_0x390bc6){return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](cmHopper['unlockContact']({'active':![]},_0x390bc6,0x1))['catch'](loggerCatch(_0x3e7c('0x1f')));};exports['crateCustomerReportQueue']=function(_0x58e70f){var _0x2bb364={};_0x2bb364[_0x3e7c('0x20')]=_0x58e70f[_0x3e7c('0x20')];_0x2bb364[_0x3e7c('0x21')]=_0x58e70f[_0x3e7c('0x21')];_0x2bb364[_0x3e7c('0x22')]=_0x58e70f[_0x3e7c('0x22')];_0x2bb364['calleridname']=_0x58e70f[_0x3e7c('0x23')];_0x2bb364[_0x3e7c('0x24')]=_0x58e70f[_0x3e7c('0x24')];_0x2bb364['queuecallerjoinAt']=_0x58e70f['answertime'];_0x2bb364[_0x3e7c('0x25')]=_0x58e70f[_0x3e7c('0x26')];_0x2bb364[_0x3e7c('0x27')]=0x1;_0x2bb364[_0x3e7c('0x28')]=_0x58e70f[_0x3e7c('0x29')];_0x2bb364[_0x3e7c('0x2a')]=_0x58e70f[_0x3e7c('0x2b')];_0x2bb364[_0x3e7c('0x2c')]=_0x3e7c('0x2d');_0x2bb364[_0x3e7c('0x2e')]=_0x3e7c('0x2f');_0x2bb364[_0x3e7c('0x30')]=0x0;_0x2bb364[_0x3e7c('0x31')]=0x1;_0x2bb364[_0x3e7c('0x32')]=_0x58e70f[_0x3e7c('0x2b')];_0x2bb364[_0x3e7c('0x33')]=_0x3e7c('0x34');return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](voiceQueueReport[_0x3e7c('0x35')](_0x2bb364))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0x36')));};exports['getContactRecallMe']=function(_0x4b2689,_0x179b0a){return BPromise[_0x3e7c('0xb')]()[_0x3e7c('0xc')](cmHopper[_0x3e7c('0x37')](_0x4b2689,_0x179b0a))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0x38')));};exports[_0x3e7c('0x39')]=function(_0x78d0ce){return BPromise['resolve']()[_0x3e7c('0xc')](cmHopper[_0x3e7c('0x18')](_0x78d0ce,!![],!![]))[_0x3e7c('0xe')](loggerCatch(_0x3e7c('0x3a')));}; \ No newline at end of file +var _0x17d6=['lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview'];(function(_0x36bc91,_0x42a880){var _0x1e2dc7=function(_0x66a156){while(--_0x66a156){_0x36bc91['push'](_0x36bc91['shift']());}};_0x1e2dc7(++_0x42a880);}(_0x17d6,0x120));var _0x617d=function(_0x3b2b7b,_0x99791d){_0x3b2b7b=_0x3b2b7b-0x0;var _0x1b4723=_0x17d6[_0x3b2b7b];return _0x1b4723;};'use strict';var util=require(_0x617d('0x0'));var BPromise=require(_0x617d('0x1'));var logger=require(_0x617d('0x2'))('preview');var _=require(_0x617d('0x3'));var cmHopper=require(_0x617d('0x4'));var cmHopperFinal=require(_0x617d('0x5'));var cmHopperHistory=require(_0x617d('0x6'));var cmHopperBlack=require(_0x617d('0x7'));var voiceQueueRt=require(_0x617d('0x8'));var agentReportPreview=require(_0x617d('0x9'));var voiceQueueReport=require(_0x617d('0xa'));function loggerCatch(_0x54563c){return function(_0x52589b){logger['error'](_0x54563c,util['inspect'](_0x52589b,{'showHidden':![],'depth':null}));};}function create(_0x5d02c3){return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](cmHopperHistory[_0x617d('0xd')](_0x5d02c3))[_0x617d('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x459503){return BPromise[_0x617d('0xb')]()['then'](agentReportPreview['createHistory'](_0x459503))[_0x617d('0xe')](loggerCatch(_0x617d('0xf')));}function moveContact(_0x5788aa){return BPromise['resolve']()[_0x617d('0xc')](cmHopper[_0x617d('0x10')](_0x5788aa,!![]))['catch'](loggerCatch(_0x617d('0x11')));}exports['checkIsBlackList']=function(_0x1ae3e4){return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](cmHopperBlack[_0x617d('0x12')](_0x1ae3e4))[_0x617d('0xe')](loggerCatch(_0x617d('0x13')));};exports[_0x617d('0x14')]=function(_0x7dfa5e){return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](cmHopper[_0x617d('0x14')](_0x7dfa5e))[_0x617d('0xe')](loggerCatch(_0x617d('0x15')));};exports[_0x617d('0xd')]=function(_0x4581fb,_0x5cddd7){create(_0x4581fb)[_0x617d('0xe')](loggerCatch(_0x5cddd7));moveContact(_0x4581fb)[_0x617d('0xe')](loggerCatch(_0x5cddd7));};exports[_0x617d('0x16')]=function(_0x598491,_0xd56073){createAgent(_0x598491)[_0x617d('0xe')](loggerCatch(_0xd56073));};exports[_0x617d('0x17')]=function(_0x5286a9,_0xaa8d72){create(_0x5286a9)[_0x617d('0xe')](loggerCatch(_0xaa8d72));};exports[_0x617d('0x18')]=function(_0x160364,_0x56650d){moveContact(_0x160364)[_0x617d('0xe')](loggerCatch(_0x56650d));};exports[_0x617d('0x19')]=function(_0x116830,_0x4c6f89,_0x17eed9){if(_0x4c6f89){_0x116830[_0x617d('0x1a')]=null;}if(_0x17eed9){_0x116830[_0x617d('0x1b')]=![];}return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](cmHopper[_0x617d('0x19')](_0x116830))[_0x617d('0xe')](loggerCatch(_0x617d('0x1c')));};exports[_0x617d('0x1d')]=function(_0x2bce0a){return BPromise['resolve']()[_0x617d('0xc')](cmHopper[_0x617d('0x1d')](_0x2bce0a))[_0x617d('0xe')](loggerCatch(_0x617d('0x1e')));};exports[_0x617d('0x1f')]=function(_0x4941be){return BPromise['resolve']()[_0x617d('0xc')](cmHopper[_0x617d('0x1f')]({'UserId':null},_0x4941be,0x1))[_0x617d('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x617d('0x20')]=function(_0xee8cfc){return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](cmHopper[_0x617d('0x1f')]({'active':![]},_0xee8cfc,0x1))[_0x617d('0xe')](loggerCatch(_0x617d('0x21')));};exports[_0x617d('0x22')]=function(_0x5aaf9f){var _0x18ea1a={};_0x18ea1a[_0x617d('0x23')]=_0x5aaf9f[_0x617d('0x23')];_0x18ea1a[_0x617d('0x24')]=_0x5aaf9f[_0x617d('0x24')];_0x18ea1a[_0x617d('0x25')]=_0x5aaf9f[_0x617d('0x25')];_0x18ea1a[_0x617d('0x26')]=_0x5aaf9f[_0x617d('0x26')];_0x18ea1a[_0x617d('0x27')]=_0x5aaf9f[_0x617d('0x27')];_0x18ea1a['queuecallerjoinAt']=_0x5aaf9f['answertime'];_0x18ea1a[_0x617d('0x28')]=_0x5aaf9f['answertime'];_0x18ea1a['queuecallercomplete']=0x1;_0x18ea1a['queuecallercompleteAt']=_0x5aaf9f[_0x617d('0x29')];_0x18ea1a[_0x617d('0x2a')]=_0x5aaf9f[_0x617d('0x2b')];_0x18ea1a[_0x617d('0x2c')]=_0x617d('0x2d');_0x18ea1a[_0x617d('0x2e')]=_0x617d('0x2f');_0x18ea1a['holdtime']=0x0;_0x18ea1a['assigned']=0x1;_0x18ea1a[_0x617d('0x30')]=_0x5aaf9f[_0x617d('0x2b')];_0x18ea1a['queuecallerexitreason']=_0x617d('0x31');return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](voiceQueueReport[_0x617d('0x32')](_0x18ea1a))[_0x617d('0xe')](loggerCatch(_0x617d('0x33')));};exports[_0x617d('0x34')]=function(_0x212f1a,_0x198424){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x212f1a,_0x198424))[_0x617d('0xe')](loggerCatch(_0x617d('0x35')));};exports[_0x617d('0x36')]=function(_0x83d71b){return BPromise[_0x617d('0xb')]()[_0x617d('0xc')](cmHopper[_0x617d('0x19')](_0x83d71b,!![],!![]))[_0x617d('0xe')](loggerCatch(_0x617d('0x37')));}; \ 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 7229e95..ddcac09 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 _0x15f6=['timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','not_inuse','status','reachable','getDiff','diff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','statedesc','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview'];(function(_0x5d7a36,_0x1092a8){var _0x5ee40e=function(_0x12fdc9){while(--_0x12fdc9){_0x5d7a36['push'](_0x5d7a36['shift']());}};_0x5ee40e(++_0x1092a8);}(_0x15f6,0x15c));var _0x615f=function(_0x54a798,_0x3cc14d){_0x54a798=_0x54a798-0x0;var _0x2421ab=_0x15f6[_0x54a798];return _0x2421ab;};'use strict';var util=require(_0x615f('0x0'));var _=require(_0x615f('0x1'));var moment=require('moment');var logger=require(_0x615f('0x2'))(_0x615f('0x3'));var ipAgi=process[_0x615f('0x4')][_0x615f('0x5')]||_0x615f('0x6');function getSeconds(_0x1ecf3f,_0xbfdc4c){var _0x40d41b=moment(_0x1ecf3f)[_0x615f('0x7')](0x0);var _0x149b87=moment(_0xbfdc4c)['milliseconds'](0x0);return _0x40d41b['diff'](_0x149b87,_0x615f('0x8'));}exports[_0x615f('0x9')]=function(_0x1438ba){return function(_0x5db584){logger[_0x615f('0xa')](_0x1438ba,util[_0x615f('0xb')](_0x5db584,{'showHidden':![],'depth':null}));};};exports[_0x615f('0xc')]=function(_0x28dc79,_0x3b6fe7){logger[_0x615f('0xd')](_0x28dc79,util['inspect'](_0x3b6fe7,{'showHidden':![],'depth':null}));};exports[_0x615f('0xe')]=function(_0x4a907e,_0x1d9fa4){logger[_0x615f('0xa')](_0x4a907e,util[_0x615f('0xb')](_0x1d9fa4,{'showHidden':![],'depth':null}));};exports[_0x615f('0xf')]=function(_0x4e5147){return function(_0x3ac5ba){logger[_0x615f('0xd')](_0x4e5147,util[_0x615f('0xb')](_0x3ac5ba,{'showHidden':![],'depth':null}));};};exports[_0x615f('0x10')]=function(_0x53f8f3,_0x132e84,_0x3d3a82){return{'message':_0x53f8f3,'unlock':_0x132e84,'active':_0x3d3a82};};exports['getCallerId']=function(_0x221733,_0x4041a7,_0x15cd00){if(!_[_0x615f('0x11')](_0x15cd00)&&_0x615f('0x12')===typeof _0x15cd00&&!_[_0x615f('0x13')](_0x15cd00)){if(!_[_0x615f('0x11')](_0x4041a7)&&_0x615f('0x12')===typeof _0x4041a7&&!_[_0x615f('0x13')](_0x4041a7)){return util[_0x615f('0x14')]('\x22%s\x22\x20<%s>',_0x4041a7,_0x15cd00);}return util[_0x615f('0x14')](_0x615f('0x15'),_0x15cd00,_0x15cd00);}if(!_[_0x615f('0x11')](_0x221733)&&_0x615f('0x12')===typeof _0x221733&&!_['isEmpty'](_0x221733)){return _0x221733;}return _0x615f('0x16');};exports[_0x615f('0x17')]=function(_0x5f2045){if(_[_0x615f('0x18')](_0x5f2045)){return![];}return _0x5f2045;};exports[_0x615f('0x19')]=function(_0x259817,_0x104e85,_0x59a109,_0x4514a4,_0x114283,_0x1d2d7d){var _0x5c43fd={'XMD-QUEUE':_0x104e85[_0x615f('0x1a')]?_0x104e85[_0x615f('0x1a')]['name']:'','XMD-CALLERID':_0x4514a4,'XMD-CALLERID-PREVIEW':_0x1d2d7d?util['format'](_0x615f('0x15'),_0x1d2d7d[_0x615f('0x1b')],_0x1d2d7d[_0x615f('0x1c')]):_0x4514a4,'XMD-DIALID':_0x114283,'XMD-CONTACTID':_0x104e85[_0x615f('0x1d')],'XMD-CDRTYPE':_0x615f('0x1e'),'CALLERID(all)':_0x4514a4,'XMD-VOICEQUEUEID':_0x104e85[_0x615f('0x1f')],'XMD-DIALCHANNEL':_0x59a109,'XMD-DIALTIMEOUT':_0x259817[_0x615f('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x615f('0x14')](_0x615f('0x21'),_0x259817['dialQueueProject2']?'g':'',_['isEmpty'](_0x259817[_0x615f('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x259817[_0x615f('0x23')]||'','XMD-AGI':_0x259817['dialQueueProject']?util[_0x615f('0x14')](_0x615f('0x24'),ipAgi,_0x259817[_0x615f('0x25')]):_0x615f('0x26'),'XMD-AGIAFTER':_0x259817[_0x615f('0x27')]?util[_0x615f('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x259817[_0x615f('0x27')]):_0x615f('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x1d2d7d?_0x1d2d7d[_0x615f('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x1d2d7d?_0x1d2d7d['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x615f('0x29')};if(!_[_0x615f('0x13')](_0x259817['monitor_format'])){_0x5c43fd[util['format']('%s',_0x615f('0x2a'))]=_0x259817[_0x615f('0x22')];_0x5c43fd[util[_0x615f('0x14')]('%s',_0x615f('0x2b'))]=_0x114283;}if(_0x104e85&&_0x104e85[_0x615f('0x2c')]){for(var _0x3b5efb in _0x104e85[_0x615f('0x2c')]){if(_0x104e85[_0x615f('0x2c')][_0x615f('0x2d')](_0x3b5efb)){if(!_[_0x615f('0x18')](_0x104e85[_0x615f('0x2c')][_0x3b5efb])&&_0x3b5efb!=='id'&&_0x3b5efb!==_0x615f('0x2e')&&_0x3b5efb!==_0x615f('0x2f')&&_0x3b5efb!==_0x615f('0x30')){_0x5c43fd[util[_0x615f('0x14')](_0x615f('0x31'),_0x615f('0x32'),_[_0x615f('0x33')](_0x3b5efb))]=_0x104e85[_0x615f('0x2c')][_0x3b5efb];}}}}return _0x5c43fd;};exports[_0x615f('0x34')]=function(_0x42a5dd){var _0x3a233e={};for(var _0x5701db in _0x42a5dd){if(_0x42a5dd['hasOwnProperty'](_0x5701db)){_0x3a233e[util['format']('%s',_[_0x615f('0x35')](_0x5701db))]=_0x42a5dd[_0x5701db];}}return{'variables':_0x3a233e};};exports['updateOriginated']=function(_0x51a390,_0x2cfb62){if(!_[_0x615f('0x18')](_0x51a390)){if(_0x51a390[_0x615f('0x2d')](_0x615f('0x36'))){if(_0x51a390['originated']>0x0){_0x51a390[_0x615f('0x36')]-=0x1;}else{logger[_0x615f('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2cfb62);}}}else{logger[_0x615f('0xa')](_0x615f('0x37'),_0x2cfb62);}};exports[_0x615f('0x38')]=function(_0xf1afeb){var _0x3c1b81=moment()[_0x615f('0x14')](_0x615f('0x39'));_0xf1afeb[_0x615f('0x3a')]=0xd;_0xf1afeb['statedesc']=_0x615f('0x3b');_0xf1afeb[_0x615f('0x3c')]=_0x3c1b81;_0xf1afeb[_0x615f('0x3d')]=_0x3c1b81;_0xf1afeb[_0x615f('0x3e')]=_0x3c1b81;};exports[_0x615f('0x3f')]=function(_0x51c82c,_0x25b202,_0x345e5f){var _0xf278de=moment()[_0x615f('0x14')](_0x615f('0x39'));_0x51c82c[_0x615f('0x3a')]=_0x25b202;_0x51c82c['statedesc']=_0x345e5f;_0x51c82c[_0x615f('0x3d')]=_0xf278de;_0x51c82c[_0x615f('0x40')]=getSeconds(_0x51c82c[_0x615f('0x3d')],_0x51c82c[_0x615f('0x3c')]);};exports[_0x615f('0x41')]=function(_0x246610,_0x239a3b,_0x1e0efa){_0x246610[_0x615f('0x42')]=_0x239a3b;_0x246610[_0x615f('0x43')]=_0x1e0efa;};exports[_0x615f('0x44')]=function(_0x2139f9,_0x13595f,_0x5ac4c0){var _0x16e9c9=moment()['format'](_0x615f('0x39'));_0x2139f9[_0x615f('0x3a')]=_0x13595f;_0x2139f9[_0x615f('0x45')]=_0x5ac4c0;_0x2139f9[_0x615f('0x3d')]=_0x2139f9[_0x615f('0x3d')]?_0x2139f9[_0x615f('0x3d')]:_0x16e9c9;_0x2139f9['endtime']=_0x2139f9[_0x615f('0x3e')]?_0x2139f9[_0x615f('0x3e')]:_0x16e9c9;_0x2139f9[_0x615f('0x40')]=getSeconds(_0x2139f9[_0x615f('0x3d')]||0x0,_0x2139f9[_0x615f('0x3c')]||0x0);_0x2139f9['talktime']=_0x2139f9[_0x615f('0x46')]?getSeconds(_0x2139f9[_0x615f('0x3e')],_0x2139f9[_0x615f('0x46')]):0x0;};exports['isFailure']=function(_0x3028f9){return _0x3028f9==='Failure';};exports[_0x615f('0x47')]=function(_0x342e86,_0x3d3c06,_0x3cf1d1,_0xbe6e77,_0x54bb78){var _0x2afb49=_0xbe6e77?_0x615f('0x48'):_0x342e86[_0x615f('0x1b')];_0x2afb49=_0x54bb78?_0x615f('0x49'):_0x2afb49;return{'actionid':_0x342e86[_0x615f('0x4a')],'action':_0x615f('0x4b'),'channel':_0x342e86[_0x615f('0x4c')],'callerid':util[_0x615f('0x14')](_0x615f('0x15'),_0x2afb49,_0x342e86['calleridnum']),'Exten':_0x615f('0x4d'),'Context':'from-sip','Priority':'1','variable':_0x3cf1d1,'timeout':(_0x3d3c06[_0x615f('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x342e86['uniqueid']};};exports['totalGlobal']=function(_0x271157){return _0x271157[_0x615f('0x4f')]+_0x271157[_0x615f('0x50')]+_0x271157[_0x615f('0x51')]+_0x271157[_0x615f('0x52')]+_0x271157[_0x615f('0x53')];};exports['cloneAction']=function(_0xffd1d7){var _0xe1252e=_[_0x615f('0x54')](_0xffd1d7);_0xe1252e['state']=0xf;_0xe1252e[_0x615f('0x45')]=_0x615f('0x55');return _0xe1252e;};exports[_0x615f('0x56')]=function(_0x2827cd,_0x1e30a6,_0x2f1c35){var _0x309c49={};_0x309c49[_0x1e30a6]=_0x2827cd[_0x1e30a6];_0x309c49[_0x615f('0x57')]=![];_0x309c49[_0x615f('0x58')]=moment()[_0x615f('0x59')](_0x2f1c35,'minutes')[_0x615f('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x309c49[_0x615f('0x1d')]=_0x2827cd['ContactId'];_0x309c49[_0x615f('0x5a')]=_0x2827cd['ListId'];_0x309c49[_0x615f('0x1f')]=_0x2827cd['VoiceQueueId']||undefined;return _0x309c49;};exports[_0x615f('0x5b')]=function(_0x10511f,_0x4d74e4){if(!_[_0x615f('0x18')](_0x10511f)){if(_0x10511f['pTalking']>0x0){_0x10511f['pTalking']-=0x1;}else{logger[_0x615f('0xa')](_0x4d74e4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x615f('0xa')](_0x4d74e4,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x615f('0x5c')]=function(_0x41ed65){if(_0x41ed65<=0x0){return!![];}return![];};exports['buildObj']=function(_0x4c52ea,_0x5852df,_0x2c35e7){_0x4c52ea[_0x615f('0x5d')]=_0x5852df;_0x4c52ea[_0x615f('0x5e')]=_0x4c52ea[_0x615f('0x5f')];_0x4c52ea[_0x615f('0x60')]=_0x4c52ea[_0x615f('0x4c')];_0x4c52ea[_0x615f('0x61')]=_0x615f('0x62');if(_0x2c35e7){_0x4c52ea[_0x615f('0x63')]=_0x2c35e7[_0x615f('0x63')];}return _0x4c52ea;};exports['buildAcw']=function(_0x3cd39d){var _0x4ee713={};_0x4ee713['queue']=_0x3cd39d[_0x615f('0x5f')];_0x4ee713[_0x615f('0x60')]=_0x3cd39d[_0x615f('0x4c')];_0x4ee713[_0x615f('0x4a')]=_0x3cd39d[_0x615f('0x4a')];return _0x4ee713;};exports['agentReadyId']=function(_0xe44cbf){var _0x39de43=[];for(var _0x39fded in _0xe44cbf){if(_0xe44cbf['hasOwnProperty'](_0x39fded)){if(!_[_0x615f('0x18')](_0xe44cbf[_0x39fded])&&_0xe44cbf[_0x39fded][_0x615f('0x3a')]===_0x615f('0x64')&&_0xe44cbf[_0x39fded][_0x615f('0x65')]===_0x615f('0x66')){_0x39de43['push'](_0xe44cbf[_0x39fded]['id']);}}}return _0x39de43;};exports[_0x615f('0x67')]=function(_0xb9c633){var _0x484e16=moment()[_0x615f('0x7')](0x0);var _0x3f8f79=moment(_0xb9c633)[_0x615f('0x7')](0x0);return _0x484e16[_0x615f('0x68')](_0x3f8f79,_0x615f('0x8'));};exports[_0x615f('0x69')]=function(_0x295c59){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x295c59[_0x615f('0x1d')],'ListId':_0x295c59[_0x615f('0x5a')],'VoiceQueueId':_0x295c59[_0x615f('0x1f')]||undefined,'CampaignId':_0x295c59[_0x615f('0x6a')]||undefined};};exports[_0x615f('0x6b')]=function(_0xad2f01){if(_0xad2f01===_0x615f('0x4a')||_0xad2f01===_0x615f('0x6c')||_0xad2f01===_0x615f('0x5f')||_0xad2f01==='type'||_0xad2f01===_0x615f('0x6d')||_0xad2f01===_0x615f('0x6e')||_0xad2f01===_0x615f('0x42')||_0xad2f01===_0x615f('0x4c')||_0xad2f01==='calleridname'||_0xad2f01==='active'||_0xad2f01==='calleridnum'||_0xad2f01===_0x615f('0x58')||_0xad2f01===_0x615f('0x4f')||_0xad2f01===_0x615f('0x50')||_0xad2f01==='countnoanswerretry'||_0xad2f01===_0x615f('0x6f')||_0xad2f01===_0x615f('0x70')||_0xad2f01===_0x615f('0x71')||_0xad2f01===_0x615f('0x72')||_0xad2f01===_0x615f('0x73')||_0xad2f01===_0x615f('0x1d')||_0xad2f01===_0x615f('0x5a')||_0xad2f01===_0x615f('0x43')||_0xad2f01===_0x615f('0x1f')||_0xad2f01===_0x615f('0x74')||_0xad2f01===_0x615f('0x75')||_0xad2f01===_0x615f('0x76')||_0xad2f01==='xmd-phone'||_0xad2f01===_0x615f('0x77')||_0xad2f01===_0x615f('0x78')||_0xad2f01===_0x615f('0x79')||_0xad2f01===_0x615f('0x7a')||_0xad2f01===_0x615f('0x7b')||_0xad2f01==='xmd-dialchannel'||_0xad2f01===_0x615f('0x7c')||_0xad2f01===_0x615f('0x7d')||_0xad2f01==='xmd-callerid'||_0xad2f01===_0x615f('0x7e')||_0xad2f01===_0x615f('0x7f')||_0xad2f01===_0x615f('0x80')||_0xad2f01===_0x615f('0x81')||_0xad2f01===_0x615f('0x82')||_0xad2f01===_0x615f('0x83')||_0xad2f01==='rtpaudioqosloss'||_0xad2f01===_0x615f('0x84')||_0xad2f01===_0x615f('0x85')||_0xad2f01===_0x615f('0x86')||_0xad2f01===_0x615f('0x80')||_0xad2f01===_0x615f('0x81')||_0xad2f01===_0x615f('0x82')||_0xad2f01==='rtpaudioqosjitterbridged'||_0xad2f01==='rtpaudioqosloss'||_0xad2f01===_0x615f('0x84')||_0xad2f01===_0x615f('0x85')||_0xad2f01==='rtpaudioqosrttbridged'||_0xad2f01===_0x615f('0x87')||_0xad2f01==='bridgepvtcallid'||_0xad2f01==='state'||_0xad2f01===_0x615f('0x45')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x54ef3c,_0x2122c7){var _0x3c0bc8,_0x3aea0a,_0xa802c6;if(_0x2122c7<=0x0){_0x2122c7=0x1;}_0x3c0bc8=new RegExp(_0x615f('0x88')+_0x2122c7+'}$');_0x3aea0a=Math[_0x615f('0x89')](0xa,_0x2122c7-0x1);_0xa802c6=Math[_0x615f('0x89')](0xa,_0x2122c7)-0x1;return util['format']('%s',_[_0x615f('0x8a')](_0x54ef3c,_0x3c0bc8,_[_0x615f('0x8b')](_0x3aea0a,_0xa802c6)));};exports['extractCalleridName']=function(_0x238f6c){var _0x50a530=_0x238f6c[_0x615f('0x8c')](/"(.*?)"/);return _0x50a530?_0x50a530[0x1]:_0x238f6c;};exports[_0x615f('0x8d')]=function(_0x8b576f){var _0x4eb9e7=_0x8b576f[_0x615f('0x8c')](/<(.*?)>/);return _0x4eb9e7?_0x4eb9e7[0x1]:_0x8b576f;}; \ No newline at end of file +var _0xc8ef=['IsNotLoggedIn','buildObj','lastevent','motionChannel','voice','mandatoryDisposition','buildAcw','queue','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','calleridnum','countbusyretry','countnoanswerretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqos','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','logLookAgent','membername','UserId','starttime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined'];(function(_0x403505,_0x2485f5){var _0x2cdfde=function(_0x1444fe){while(--_0x1444fe){_0x403505['push'](_0x403505['shift']());}};_0x2cdfde(++_0x2485f5);}(_0xc8ef,0x15a));var _0xfc8e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xc8ef[_0x5447fd];return _0x15b28a;};'use strict';var util=require(_0xfc8e('0x0'));var _=require(_0xfc8e('0x1'));var moment=require('moment');var logger=require(_0xfc8e('0x2'))(_0xfc8e('0x3'));var ipAgi=process[_0xfc8e('0x4')][_0xfc8e('0x5')]||'127.0.0.1';function getSeconds(_0x5f1b0e,_0x229abe){var _0x45c488=moment(_0x5f1b0e)[_0xfc8e('0x6')](0x0);var _0x415161=moment(_0x229abe)[_0xfc8e('0x6')](0x0);return _0x45c488[_0xfc8e('0x7')](_0x415161,_0xfc8e('0x8'));}exports[_0xfc8e('0x9')]=function(_0x2042c9){return function(_0x1595a6){logger[_0xfc8e('0xa')](_0x2042c9,util[_0xfc8e('0xb')](_0x1595a6,{'showHidden':![],'depth':null}));};};exports[_0xfc8e('0xc')]=function(_0x54ff98,_0x445af4){logger[_0xfc8e('0xd')](_0x54ff98,util['inspect'](_0x445af4,{'showHidden':![],'depth':null}));};exports[_0xfc8e('0xe')]=function(_0x1b16a4,_0x37263e){logger['error'](_0x1b16a4,util[_0xfc8e('0xb')](_0x37263e,{'showHidden':![],'depth':null}));};exports[_0xfc8e('0xf')]=function(_0x4f3046){return function(_0x12967d){logger[_0xfc8e('0xd')](_0x4f3046,util[_0xfc8e('0xb')](_0x12967d,{'showHidden':![],'depth':null}));};};exports[_0xfc8e('0x10')]=function(_0x3f24de,_0x483e6b,_0x1a46e9){return{'message':_0x3f24de,'unlock':_0x483e6b,'active':_0x1a46e9};};exports[_0xfc8e('0x11')]=function(_0x5e57b4,_0x2459bf,_0x5ec420){if(!_[_0xfc8e('0x12')](_0x5ec420)&&_0xfc8e('0x13')===typeof _0x5ec420&&!_[_0xfc8e('0x14')](_0x5ec420)){if(!_['isUndefined'](_0x2459bf)&&_0xfc8e('0x13')===typeof _0x2459bf&&!_[_0xfc8e('0x14')](_0x2459bf)){return util['format'](_0xfc8e('0x15'),_0x2459bf,_0x5ec420);}return util[_0xfc8e('0x16')](_0xfc8e('0x15'),_0x5ec420,_0x5ec420);}if(!_[_0xfc8e('0x12')](_0x5e57b4)&&'string'===typeof _0x5e57b4&&!_[_0xfc8e('0x14')](_0x5e57b4)){return _0x5e57b4;}return _0xfc8e('0x17');};exports[_0xfc8e('0x18')]=function(_0x1b1fa6){if(_[_0xfc8e('0x19')](_0x1b1fa6)){return![];}return _0x1b1fa6;};exports['addVariables']=function(_0x56a37,_0x477deb,_0xf8bf9c,_0x5cc5c0,_0x4014bb,_0x500b99){var _0x5b79e8={'XMD-QUEUE':_0x477deb[_0xfc8e('0x1a')]?_0x477deb[_0xfc8e('0x1a')][_0xfc8e('0x1b')]:'','XMD-CALLERID':_0x5cc5c0,'XMD-CALLERID-PREVIEW':_0x500b99?util[_0xfc8e('0x16')]('\x22%s\x22\x20<%s>',_0x500b99[_0xfc8e('0x1c')],_0x500b99['calleridnum']):_0x5cc5c0,'XMD-DIALID':_0x4014bb,'XMD-CONTACTID':_0x477deb[_0xfc8e('0x1d')],'XMD-CDRTYPE':_0xfc8e('0x1e'),'CALLERID(all)':_0x5cc5c0,'XMD-VOICEQUEUEID':_0x477deb[_0xfc8e('0x1f')],'XMD-DIALCHANNEL':_0xf8bf9c,'XMD-DIALTIMEOUT':_0x56a37[_0xfc8e('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xfc8e('0x16')]('\x22rtTxX%s%s\x22',_0x56a37[_0xfc8e('0x21')]?'g':'',_[_0xfc8e('0x14')](_0x56a37[_0xfc8e('0x22')])?'':_0xfc8e('0x23')),'XMD-DIALURL':_0x56a37[_0xfc8e('0x24')]||'','XMD-AGI':_0x56a37[_0xfc8e('0x25')]?util[_0xfc8e('0x16')](_0xfc8e('0x26'),ipAgi,_0x56a37['dialQueueProject']):_0xfc8e('0x27'),'XMD-AGIAFTER':_0x56a37[_0xfc8e('0x21')]?util[_0xfc8e('0x16')](_0xfc8e('0x26'),ipAgi,_0x56a37[_0xfc8e('0x21')]):_0xfc8e('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x500b99?_0x500b99[_0xfc8e('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x500b99?_0x500b99[_0xfc8e('0x29')]:'','XMD-DESTINATION':_0xfc8e('0x2a'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x56a37[_0xfc8e('0x22')])){_0x5b79e8[util[_0xfc8e('0x16')]('%s',_0xfc8e('0x2b'))]=_0x56a37[_0xfc8e('0x22')];_0x5b79e8[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4014bb;}if(_0x477deb&&_0x477deb['Contact']){for(var _0x54fb08 in _0x477deb[_0xfc8e('0x2c')]){if(_0x477deb[_0xfc8e('0x2c')][_0xfc8e('0x2d')](_0x54fb08)){if(!_[_0xfc8e('0x19')](_0x477deb[_0xfc8e('0x2c')][_0x54fb08])&&_0x54fb08!=='id'&&_0x54fb08!=='tags'&&_0x54fb08!==_0xfc8e('0x2e')&&_0x54fb08!=='updatedAt'){_0x5b79e8[util[_0xfc8e('0x16')](_0xfc8e('0x2f'),'XMD-',_[_0xfc8e('0x30')](_0x54fb08))]=_0x477deb['Contact'][_0x54fb08];}}}}return _0x5b79e8;};exports[_0xfc8e('0x31')]=function(_0x46ccb3){var _0x1ef979={};for(var _0x196357 in _0x46ccb3){if(_0x46ccb3['hasOwnProperty'](_0x196357)){_0x1ef979[util[_0xfc8e('0x16')]('%s',_[_0xfc8e('0x32')](_0x196357))]=_0x46ccb3[_0x196357];}}return{'variables':_0x1ef979};};exports[_0xfc8e('0x33')]=function(_0x570608,_0x5f1b5c){if(!_['isNil'](_0x570608)){if(_0x570608[_0xfc8e('0x2d')](_0xfc8e('0x34'))){if(_0x570608['originated']>0x0){_0x570608[_0xfc8e('0x34')]-=0x1;}else{logger[_0xfc8e('0xa')](_0xfc8e('0x35'),_0x5f1b5c);}}}else{logger['error'](_0xfc8e('0x36'),_0x5f1b5c);}};exports['logBlacklist']=function(_0x4e5afa){var _0xd8cc2c=moment()[_0xfc8e('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e5afa[_0xfc8e('0x37')]=0xd;_0x4e5afa[_0xfc8e('0x38')]=_0xfc8e('0x39');_0x4e5afa['starttime']=_0xd8cc2c;_0x4e5afa['responsetime']=_0xd8cc2c;_0x4e5afa[_0xfc8e('0x3a')]=_0xd8cc2c;};exports[_0xfc8e('0x3b')]=function(_0x1a3d5a,_0x2f3191,_0x205bdf){var _0x2b81b6=moment()[_0xfc8e('0x16')](_0xfc8e('0x3c'));_0x1a3d5a[_0xfc8e('0x37')]=_0x2f3191;_0x1a3d5a[_0xfc8e('0x38')]=_0x205bdf;_0x1a3d5a[_0xfc8e('0x3d')]=_0x2b81b6;_0x1a3d5a[_0xfc8e('0x3e')]=getSeconds(_0x1a3d5a[_0xfc8e('0x3d')],_0x1a3d5a['starttime']);};exports[_0xfc8e('0x3f')]=function(_0x776b86,_0x5d52b4,_0x3f6ef3){_0x776b86[_0xfc8e('0x40')]=_0x5d52b4;_0x776b86[_0xfc8e('0x41')]=_0x3f6ef3;};exports['logCustomer']=function(_0x1f0620,_0x3e305d,_0x39a8b3){var _0x4330ad=moment()[_0xfc8e('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f0620['state']=_0x3e305d;_0x1f0620['statedesc']=_0x39a8b3;_0x1f0620[_0xfc8e('0x3d')]=_0x1f0620[_0xfc8e('0x3d')]?_0x1f0620[_0xfc8e('0x3d')]:_0x4330ad;_0x1f0620[_0xfc8e('0x3a')]=_0x1f0620[_0xfc8e('0x3a')]?_0x1f0620[_0xfc8e('0x3a')]:_0x4330ad;_0x1f0620[_0xfc8e('0x3e')]=getSeconds(_0x1f0620[_0xfc8e('0x3d')]||0x0,_0x1f0620[_0xfc8e('0x42')]||0x0);_0x1f0620[_0xfc8e('0x43')]=_0x1f0620[_0xfc8e('0x44')]?getSeconds(_0x1f0620[_0xfc8e('0x3a')],_0x1f0620[_0xfc8e('0x44')]):0x0;};exports['isFailure']=function(_0x299492){return _0x299492===_0xfc8e('0x45');};exports[_0xfc8e('0x46')]=function(_0x5cb4b7,_0x1d41a5,_0x50a27c,_0x1ee66a,_0x3e4bd2){var _0x13f6a1=_0x1ee66a?_0xfc8e('0x47'):_0x5cb4b7[_0xfc8e('0x1c')];_0x13f6a1=_0x3e4bd2?_0xfc8e('0x48'):_0x13f6a1;return{'actionid':_0x5cb4b7['uniqueid'],'action':_0xfc8e('0x49'),'channel':_0x5cb4b7[_0xfc8e('0x4a')],'callerid':util[_0xfc8e('0x16')](_0xfc8e('0x15'),_0x13f6a1,_0x5cb4b7['calleridnum']),'Exten':_0xfc8e('0x2a'),'Context':_0xfc8e('0x4b'),'Priority':'1','variable':_0x50a27c,'timeout':(_0x1d41a5[_0xfc8e('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cb4b7[_0xfc8e('0x4d')]};};exports[_0xfc8e('0x4e')]=function(_0x24acc3){return _0x24acc3['countbusyretry']+_0x24acc3[_0xfc8e('0x4f')]+_0x24acc3['countnoanswerretry']+_0x24acc3[_0xfc8e('0x50')]+_0x24acc3[_0xfc8e('0x51')];};exports[_0xfc8e('0x52')]=function(_0x142e83){var _0x37b6a3=_[_0xfc8e('0x53')](_0x142e83);_0x37b6a3[_0xfc8e('0x37')]=0xf;_0x37b6a3[_0xfc8e('0x38')]=_0xfc8e('0x54');return _0x37b6a3;};exports[_0xfc8e('0x55')]=function(_0xf37dbf,_0x5af0e4,_0x131b8e){var _0x337132={};_0x337132[_0x5af0e4]=_0xf37dbf[_0x5af0e4];_0x337132[_0xfc8e('0x56')]=![];_0x337132[_0xfc8e('0x57')]=moment()[_0xfc8e('0x58')](_0x131b8e,_0xfc8e('0x59'))[_0xfc8e('0x16')](_0xfc8e('0x3c'));_0x337132[_0xfc8e('0x1d')]=_0xf37dbf['ContactId'];_0x337132['ListId']=_0xf37dbf[_0xfc8e('0x5a')];_0x337132[_0xfc8e('0x1f')]=_0xf37dbf['VoiceQueueId']||undefined;return _0x337132;};exports[_0xfc8e('0x5b')]=function(_0x1d6171,_0x6da46f){if(!_[_0xfc8e('0x19')](_0x1d6171)){if(_0x1d6171[_0xfc8e('0x5c')]>0x0){_0x1d6171[_0xfc8e('0x5c')]-=0x1;}else{logger['error'](_0x6da46f,_0xfc8e('0x5d'));}}else{logger['error'](_0x6da46f,_0xfc8e('0x5e'));}};exports[_0xfc8e('0x5f')]=function(_0x4a6024){if(_0x4a6024<=0x0){return!![];}return![];};exports[_0xfc8e('0x60')]=function(_0x4a65ba,_0x435707,_0x3bc07b){_0x4a65ba[_0xfc8e('0x61')]=_0x435707;_0x4a65ba[_0xfc8e('0x1b')]=_0x4a65ba['queue'];_0x4a65ba['interface']=_0x4a65ba['channelAgent'];_0x4a65ba[_0xfc8e('0x62')]=_0xfc8e('0x63');if(_0x3bc07b){_0x4a65ba[_0xfc8e('0x64')]=_0x3bc07b[_0xfc8e('0x64')];}return _0x4a65ba;};exports[_0xfc8e('0x65')]=function(_0x890ac8){var _0x3eef4f={};_0x3eef4f[_0xfc8e('0x66')]=_0x890ac8['queue'];_0x3eef4f[_0xfc8e('0x67')]=_0x890ac8[_0xfc8e('0x4a')];_0x3eef4f[_0xfc8e('0x4d')]=_0x890ac8['uniqueid'];return _0x3eef4f;};exports[_0xfc8e('0x68')]=function(_0x3deedf){var _0x31611c=[];for(var _0x1eecf3 in _0x3deedf){if(_0x3deedf[_0xfc8e('0x2d')](_0x1eecf3)){if(!_[_0xfc8e('0x19')](_0x3deedf[_0x1eecf3])&&_0x3deedf[_0x1eecf3]['state']===_0xfc8e('0x69')&&_0x3deedf[_0x1eecf3][_0xfc8e('0x6a')]===_0xfc8e('0x6b')){_0x31611c[_0xfc8e('0x6c')](_0x3deedf[_0x1eecf3]['id']);}}}return _0x31611c;};exports[_0xfc8e('0x6d')]=function(_0x2730cf){var _0x4e00b7=moment()[_0xfc8e('0x6')](0x0);var _0x1d63ca=moment(_0x2730cf)[_0xfc8e('0x6')](0x0);return _0x4e00b7['diff'](_0x1d63ca,_0xfc8e('0x8'));};exports[_0xfc8e('0x6e')]=function(_0x4a0996){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a0996[_0xfc8e('0x1d')],'ListId':_0x4a0996[_0xfc8e('0x5a')],'VoiceQueueId':_0x4a0996['VoiceQueueId']||undefined,'CampaignId':_0x4a0996[_0xfc8e('0x6f')]||undefined};};exports[_0xfc8e('0x70')]=function(_0x1d849a){if(_0x1d849a===_0xfc8e('0x4d')||_0x1d849a===_0xfc8e('0x71')||_0x1d849a===_0xfc8e('0x66')||_0x1d849a===_0xfc8e('0x72')||_0x1d849a==='campaigntype'||_0x1d849a===_0xfc8e('0x73')||_0x1d849a===_0xfc8e('0x40')||_0x1d849a===_0xfc8e('0x4a')||_0x1d849a===_0xfc8e('0x1c')||_0x1d849a===_0xfc8e('0x56')||_0x1d849a===_0xfc8e('0x74')||_0x1d849a===_0xfc8e('0x57')||_0x1d849a===_0xfc8e('0x75')||_0x1d849a===_0xfc8e('0x4f')||_0x1d849a===_0xfc8e('0x76')||_0x1d849a===_0xfc8e('0x77')||_0x1d849a===_0xfc8e('0x78')||_0x1d849a==='callbackuniqueid'||_0x1d849a===_0xfc8e('0x79')||_0x1d849a===_0xfc8e('0x7a')||_0x1d849a===_0xfc8e('0x1d')||_0x1d849a===_0xfc8e('0x5a')||_0x1d849a==='UserId'||_0x1d849a==='VoiceQueueId'||_0x1d849a===_0xfc8e('0x7b')||_0x1d849a==='xmd-voicequeueid'||_0x1d849a===_0xfc8e('0x7c')||_0x1d849a===_0xfc8e('0x7d')||_0x1d849a==='xmd-listid'||_0x1d849a==='xmd-dialurl'||_0x1d849a===_0xfc8e('0x7e')||_0x1d849a===_0xfc8e('0x7f')||_0x1d849a===_0xfc8e('0x80')||_0x1d849a===_0xfc8e('0x81')||_0x1d849a==='xmd-contactid'||_0x1d849a===_0xfc8e('0x82')||_0x1d849a===_0xfc8e('0x83')||_0x1d849a===_0xfc8e('0x84')||_0x1d849a===_0xfc8e('0x85')||_0x1d849a==='rtpaudioqos'||_0x1d849a===_0xfc8e('0x86')||_0x1d849a===_0xfc8e('0x87')||_0x1d849a===_0xfc8e('0x88')||_0x1d849a==='rtpaudioqosloss'||_0x1d849a==='rtpaudioqoslossbridged'||_0x1d849a===_0xfc8e('0x89')||_0x1d849a==='rtpaudioqosrttbridged'||_0x1d849a===_0xfc8e('0x8a')||_0x1d849a===_0xfc8e('0x86')||_0x1d849a===_0xfc8e('0x87')||_0x1d849a===_0xfc8e('0x88')||_0x1d849a==='rtpaudioqosloss'||_0x1d849a==='rtpaudioqoslossbridged'||_0x1d849a===_0xfc8e('0x89')||_0x1d849a==='rtpaudioqosrttbridged'||_0x1d849a===_0xfc8e('0x8b')||_0x1d849a==='bridgepvtcallid'||_0x1d849a===_0xfc8e('0x37')||_0x1d849a==='statedesc'){return![];}return!![];};exports[_0xfc8e('0x8c')]=function(_0x212880,_0x3c9989){var _0x3527f4,_0x3d9378,_0x49d807;if(_0x3c9989<=0x0){_0x3c9989=0x1;}_0x3527f4=new RegExp(_0xfc8e('0x8d')+_0x3c9989+'}$');_0x3d9378=Math['pow'](0xa,_0x3c9989-0x1);_0x49d807=Math[_0xfc8e('0x8e')](0xa,_0x3c9989)-0x1;return util[_0xfc8e('0x16')]('%s',_[_0xfc8e('0x8f')](_0x212880,_0x3527f4,_['random'](_0x3d9378,_0x49d807)));};exports[_0xfc8e('0x90')]=function(_0x452f96){var _0x54533f=_0x452f96[_0xfc8e('0x91')](/"(.*?)"/);return _0x54533f?_0x54533f[0x1]:_0x452f96;};exports[_0xfc8e('0x92')]=function(_0x2cfc3e){var _0x2460ce=_0x2cfc3e[_0xfc8e('0x91')](/<(.*?)>/);return _0x2460ce?_0x2460ce[0x1]:_0x2cfc3e;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3443b0d..0d212e8 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 _0xc5bf=['voicechannel','voicequeuechannelhangup','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x5b24ba,_0x1636fd){var _0x355352=function(_0x3e23f3){while(--_0x3e23f3){_0x5b24ba['push'](_0x5b24ba['shift']());}};_0x355352(++_0x1636fd);}(_0xc5bf,0xad));var _0xfc5b=function(_0x4ba0b6,_0x6987ef){_0x4ba0b6=_0x4ba0b6-0x0;var _0x2aaf3e=_0xc5bf[_0x4ba0b6];return _0x2aaf3e;};'use strict';exports['queueadd']={'queue':{'type':_0xfc5b('0x0'),'required':!![]},'interface':{'type':_0xfc5b('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xfc5b('0x1'),'required':![]},'paused':{'type':_0xfc5b('0x2'),'required':![]}};exports[_0xfc5b('0x3')]={'queue':{'type':_0xfc5b('0x0'),'required':!![]},'interface':{'type':_0xfc5b('0x0'),'required':!![]}};exports[_0xfc5b('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0xfc5b('0x5')]={'module':{'type':_0xfc5b('0x0'),'required':![]}};exports[_0xfc5b('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xfc5b('0x7')]={'uniqueid':{'type':_0xfc5b('0x0'),'required':!![]},'filename':{'type':_0xfc5b('0x0')},'format':{'type':_0xfc5b('0x0')},'mixmonitorid':{'type':_0xfc5b('0x0')}};exports[_0xfc5b('0x8')]={'uniqueid':{'type':_0xfc5b('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xfc5b('0x0'),'required':!![]},'exten':{'type':_0xfc5b('0x0'),'required':!![]},'context':{'type':_0xfc5b('0x0')}}; \ No newline at end of file +var _0xce33=['number','boolean','queuepause','reload','queueadd','string'];(function(_0x17d334,_0x33a7f9){var _0x2226c6=function(_0xb08c5a){while(--_0xb08c5a){_0x17d334['push'](_0x17d334['shift']());}};_0x2226c6(++_0x33a7f9);}(_0xce33,0x1de));var _0x3ce3=function(_0x217605,_0x347798){_0x217605=_0x217605-0x0;var _0x13b50e=_0xce33[_0x217605];return _0x13b50e;};'use strict';exports[_0x3ce3('0x0')]={'queue':{'type':_0x3ce3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x3ce3('0x1'),'required':!![]},'penalty':{'type':_0x3ce3('0x2'),'required':![]},'paused':{'type':_0x3ce3('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x3ce3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x3ce3('0x4')]={'interface':{'type':_0x3ce3('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x3ce3('0x1'),'required':![]}};exports[_0x3ce3('0x5')]={'module':{'type':_0x3ce3('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x3ce3('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x3ce3('0x1')},'mixmonitorid':{'type':_0x3ce3('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3ce3('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x3ce3('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x3ce3('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index defdf9e..d887037 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 _0xd3df=['queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','SquareProject','exports','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','uniqueid','queue','queuecallerexit','unmanaged','queuecallerleaveAt','seconds','sumDuration','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallerjoinAt'];(function(_0x4c57c3,_0x230301){var _0x20315c=function(_0x59ff4e){while(--_0x59ff4e){_0x4c57c3['push'](_0x4c57c3['shift']());}};_0x20315c(++_0x230301);}(_0xd3df,0xd7));var _0xfd3d=function(_0x1cb9eb,_0x5bff99){_0x1cb9eb=_0x1cb9eb-0x0;var _0x28f380=_0xd3df[_0x1cb9eb];return _0x28f380;};'use strict';var BPromise=require('bluebird');var util=require(_0xfd3d('0x0'));var _=require(_0xfd3d('0x1'));var moment=require('moment');var Agent=require(_0xfd3d('0x2'));var Telephone=require(_0xfd3d('0x3'));var Trunk=require(_0xfd3d('0x4'));var VoiceQueue=require(_0xfd3d('0x5'));var Trigger=require(_0xfd3d('0x6'));var Template=require(_0xfd3d('0x7'));var Campaign=require(_0xfd3d('0x8'));var VoiceExtension=require(_0xfd3d('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xfd3d('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xfd3d('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xfd3d('0xc'));var ServicenowAccount=require(_0xfd3d('0xd'));var Dynamics365Account=require(_0xfd3d('0xe'));var FreshsalesAccount=require(_0xfd3d('0xf'));var FaxAccount=require(_0xfd3d('0x10'));var Realtime=function(){this[_0xfd3d('0x11')]={};this[_0xfd3d('0x12')]={};this[_0xfd3d('0x13')]={};this['voiceQueues']={};this[_0xfd3d('0x14')]={};this[_0xfd3d('0x15')]={};this[_0xfd3d('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfd3d('0x17')]={};this[_0xfd3d('0x18')]={};this[_0xfd3d('0x19')]={};this[_0xfd3d('0x1a')]={};this[_0xfd3d('0x1b')]={};this[_0xfd3d('0x1c')]={};this[_0xfd3d('0x1d')]={};this[_0xfd3d('0x1e')]={};this[_0xfd3d('0x1f')]={};this[_0xfd3d('0x20')]={};this['zohoAccounts']={};this[_0xfd3d('0x21')]={};this[_0xfd3d('0x22')]={};this[_0xfd3d('0x23')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0xfd3d('0x24')]={};};function freeIsNotKey(_0x1bc205,_0x29e675,_0x3bb788){var _0x5cb8d5=_[_0xfd3d('0x25')](_0x1bc205,function(_0x540e7a,_0x554477){return _0x540e7a[_0x3bb788];});for(var _0x59c684 in _0x29e675){if(_0x29e675[_0xfd3d('0x26')](_0x59c684)){if(!_0x5cb8d5[_0x59c684]){delete _0x29e675[_0x59c684];}}}}function freeIsNotKeySip(_0x51fdc6,_0x6a7d03){var _0x1ce778=_[_0xfd3d('0x25')](_0x51fdc6,function(_0x261dac,_0x25c7f6){return util[_0xfd3d('0x27')](_0xfd3d('0x28'),_0x261dac[_0xfd3d('0x29')]);});for(var _0x4b828c in _0x6a7d03){if(_0x6a7d03[_0xfd3d('0x26')](_0x4b828c)){if(!_0x1ce778[_0x4b828c]){delete _0x6a7d03[_0x4b828c];}}}}function freeIsNotKeyAgent(_0x18acd1,_0xad9dde){var _0x2acf81=_[_0xfd3d('0x25')](_0x18acd1,function(_0x38257e,_0x482437){var _0x2ee547=_['isNil'](_0x38257e[_0xfd3d('0x2a')])?util[_0xfd3d('0x27')]('SIP/%s',_0x38257e[_0xfd3d('0x29')]):_0x38257e['interface'];return _0x2ee547;});for(var _0x39c22e in _0xad9dde){if(_0xad9dde[_0xfd3d('0x26')](_0x39c22e)){if(!_0x2acf81[_0x39c22e]){delete _0xad9dde[_0x39c22e];}}}}function clearVoiceCallReports(_0x10cc82){_0x10cc82[_0xfd3d('0x2b')]=0x0;_0x10cc82[_0xfd3d('0x2c')]=0x0;_0x10cc82[_0xfd3d('0x2d')]=0x0;_0x10cc82['sumDuration']=0x0;_0x10cc82[_0xfd3d('0x2e')]=0x0;}function clearCampaigns(_0x263c63){if(!_[_0xfd3d('0x2f')](_0x263c63)){for(var _0x22b89b in _0x263c63){if(_0x263c63['hasOwnProperty'](_0x22b89b)){_0x263c63[_0x22b89b][_0xfd3d('0x30')]=0x0;_0x263c63[_0x22b89b][_0xfd3d('0x31')]=0x0;}}}}function clearVoiceQueues(_0xc8968b){if(!_['isEmpty'](_0xc8968b)){for(var _0x5b58a8 in _0xc8968b){if(_0xc8968b['hasOwnProperty'](_0x5b58a8)){_0xc8968b[_0x5b58a8]['total']=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x2c')]=0x0;_0xc8968b[_0x5b58a8]['unmanaged']=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x32')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x2d')]=0x0;_0xc8968b[_0x5b58a8]['sumDuration']=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x2e')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x33')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x34')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x35')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x36')]=0x0;_0xc8968b[_0x5b58a8]['outboundNoSuchCallsDay']=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x37')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x38')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x39')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x3a')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x3b')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x3c')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x3d')]=0x0;_0xc8968b[_0x5b58a8]['outboundAnswerAgiCallsDay']=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x3e')]=0x0;_0xc8968b[_0x5b58a8][_0xfd3d('0x3f')]=!![];}}}}Realtime['prototype'][_0xfd3d('0x40')]=function(_0x369729,_0x11607b){for(var _0x2c0dfd in _0x11607b){if(_0x369729[_0xfd3d('0x26')](_0x2c0dfd)){_0x369729[_0x2c0dfd]=_0x11607b[_0x2c0dfd];}}};Realtime[_0xfd3d('0x41')]['initAgents']=function(){var _0x45d517=this;return function(_0xab1730){if(_0xab1730){freeIsNotKeyAgent(_0xab1730,_0x45d517[_0xfd3d('0x11')]);for(var _0x5563d0=0x0,_0x575a06={},_0x364779={};_0x5563d0<_0xab1730[_0xfd3d('0x42')];_0x5563d0+=0x1){_0x575a06=_0xab1730[_0x5563d0];var _0x29e1ee=_[_0xfd3d('0x43')](_0x575a06[_0xfd3d('0x2a')])?util['format'](_0xfd3d('0x28'),_0x575a06[_0xfd3d('0x29')]):_0x575a06['interface'];if(_[_0xfd3d('0x44')](_0x45d517[_0xfd3d('0x11')][_0x29e1ee])){_0x45d517[_0xfd3d('0x11')][_0x29e1ee]=new Agent(_0x575a06);}else{_0x45d517[_0xfd3d('0x40')](_0x45d517[_0xfd3d('0x11')][_0x29e1ee],_0x575a06);}}}return _0x45d517[_0xfd3d('0x11')];};};Realtime['prototype'][_0xfd3d('0x45')]=function(){var _0x397668=this;return function(_0x2c9d44){if(_0x2c9d44){freeIsNotKeySip(_0x2c9d44,_0x397668[_0xfd3d('0x12')]);for(var _0x258c1e=0x0,_0x13c072={},_0x21ac3c={};_0x258c1e<_0x2c9d44[_0xfd3d('0x42')];_0x258c1e+=0x1){_0x13c072=_0x2c9d44[_0x258c1e];if(_[_0xfd3d('0x44')](_0x397668[_0xfd3d('0x12')][util[_0xfd3d('0x27')]('SIP/%s',_0x13c072['name'])])){_0x397668[_0xfd3d('0x12')][util[_0xfd3d('0x27')]('SIP/%s',_0x13c072['name'])]=new Telephone(_0x13c072);}else{_0x397668[_0xfd3d('0x40')](_0x397668[_0xfd3d('0x12')][util['format']('SIP/%s',_0x13c072[_0xfd3d('0x29')])],_0x13c072);}}}return _0x397668[_0xfd3d('0x12')];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x46')]=function(){var _0x30e4ad=this;return function(_0x560504){if(_0x560504){freeIsNotKeySip(_0x560504,_0x30e4ad[_0xfd3d('0x13')]);for(var _0x589584=0x0,_0x13e0da={},_0x46537a={};_0x589584<_0x560504['length'];_0x589584+=0x1){_0x13e0da=_0x560504[_0x589584];if(_[_0xfd3d('0x44')](_0x30e4ad[_0xfd3d('0x13')][util[_0xfd3d('0x27')](_0xfd3d('0x28'),_0x13e0da[_0xfd3d('0x29')])])){_0x30e4ad['trunks'][util[_0xfd3d('0x27')]('SIP/%s',_0x13e0da['name'])]=new Trunk(_0x13e0da);}else{_0x30e4ad['mergeFromDatabase'](_0x30e4ad[_0xfd3d('0x13')][util['format']('SIP/%s',_0x13e0da[_0xfd3d('0x29')])],_0x13e0da);}}}return _0x30e4ad[_0xfd3d('0x13')];};};Realtime['prototype'][_0xfd3d('0x47')]=function(){var _0x2214f7=this;return function(_0xd55925){if(_0xd55925){freeIsNotKey(_0xd55925,_0x2214f7[_0xfd3d('0x48')],_0xfd3d('0x29'));for(var _0x386fce=0x0,_0x5ebf0e={},_0x273ad8={};_0x386fce<_0xd55925['length'];_0x386fce+=0x1){_0x5ebf0e=_0xd55925[_0x386fce];if(_[_0xfd3d('0x44')](_0x2214f7[_0xfd3d('0x48')][_0x5ebf0e[_0xfd3d('0x29')]])){_0x2214f7[_0xfd3d('0x48')][_0x5ebf0e[_0xfd3d('0x29')]]=new VoiceQueue(_0x5ebf0e);}else{_0x2214f7[_0xfd3d('0x40')](_0x2214f7[_0xfd3d('0x48')][_0x5ebf0e[_0xfd3d('0x29')]],_0x5ebf0e);}}}return _0x2214f7[_0xfd3d('0x48')];};};Realtime['prototype'][_0xfd3d('0x49')]=function(){var _0x590d25=this;return function(_0x460c81){if(_0x460c81){freeIsNotKey(_0x460c81,_0x590d25[_0xfd3d('0x14')],'id');for(var _0x1247f1=0x0,_0xf0b8a={},_0x4ed7b0={};_0x1247f1<_0x460c81['length'];_0x1247f1+=0x1){_0xf0b8a=_0x460c81[_0x1247f1];if(_[_0xfd3d('0x44')](_0x590d25[_0xfd3d('0x14')][_0xf0b8a['id']])){_0x590d25['triggers'][_0xf0b8a['id']]=new Trigger(_0xf0b8a);}else{_0x590d25[_0xfd3d('0x40')](_0x590d25[_0xfd3d('0x14')][_0xf0b8a['id']],_0xf0b8a);}}}return _0x590d25['triggers'];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x4a')]=function(){var _0x3acd2e=this;return function(_0x3e2460){if(_0x3e2460){freeIsNotKey(_0x3e2460,_0x3acd2e['templates'],'id');for(var _0x24d7e8=0x0,_0x7e0aaf={},_0x32316d={};_0x24d7e8<_0x3e2460[_0xfd3d('0x42')];_0x24d7e8+=0x1){_0x7e0aaf=_0x3e2460[_0x24d7e8];if(_[_0xfd3d('0x44')](_0x3acd2e[_0xfd3d('0x16')][_0x7e0aaf['id']])){_0x3acd2e['templates'][_0x7e0aaf['id']]=new Template(_0x7e0aaf);}else{_0x3acd2e[_0xfd3d('0x40')](_0x3acd2e[_0xfd3d('0x16')][_0x7e0aaf['id']],_0x7e0aaf);}}}return _0x3acd2e['templates'];};};Realtime[_0xfd3d('0x41')]['initZendeskAccounts']=function(){var _0x3b189c=this;return function(_0x21e355){if(_0x21e355){freeIsNotKey(_0x21e355,_0x3b189c[_0xfd3d('0x1d')],'id');for(var _0x2898f2=0x0,_0x1d7323={},_0xa049ae={};_0x2898f2<_0x21e355[_0xfd3d('0x42')];_0x2898f2+=0x1){_0x1d7323=_0x21e355[_0x2898f2];if(_['isUndefined'](_0x3b189c[_0xfd3d('0x1d')][_0x1d7323['id']])){_0x3b189c['zendeskAccounts'][_0x1d7323['id']]=new ZendeskAccount(_0x1d7323);}else{_0x3b189c[_0xfd3d('0x40')](_0x3b189c[_0xfd3d('0x1d')][_0x1d7323['id']],_0x1d7323);}}}return _0x3b189c[_0xfd3d('0x1d')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x29c26c=this;return function(_0x358dbb){if(_0x358dbb){freeIsNotKey(_0x358dbb,_0x29c26c['salesforceAccounts'],'id');for(var _0x187000=0x0,_0x247459={},_0x4972d1={};_0x187000<_0x358dbb['length'];_0x187000+=0x1){_0x247459=_0x358dbb[_0x187000];if(_['isUndefined'](_0x29c26c[_0xfd3d('0x1e')][_0x247459['id']])){_0x29c26c[_0xfd3d('0x1e')][_0x247459['id']]=new SalesforceAccount(_0x247459);}else{_0x29c26c[_0xfd3d('0x40')](_0x29c26c['salesforceAccounts'][_0x247459['id']],_0x247459);}}}return _0x29c26c[_0xfd3d('0x1e')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2cee26=this;return function(_0x3d012a){if(_0x3d012a){freeIsNotKey(_0x3d012a,_0x2cee26[_0xfd3d('0x20')],'id');for(var _0x3ccf84=0x0,_0x4e42ad={},_0x18c02a={};_0x3ccf84<_0x3d012a['length'];_0x3ccf84+=0x1){_0x4e42ad=_0x3d012a[_0x3ccf84];if(_['isUndefined'](_0x2cee26[_0xfd3d('0x20')][_0x4e42ad['id']])){_0x2cee26[_0xfd3d('0x20')][_0x4e42ad['id']]=new FreshdeskAccount(_0x4e42ad);}else{_0x2cee26[_0xfd3d('0x40')](_0x2cee26['freshdeskAccounts'][_0x4e42ad['id']],_0x4e42ad);}}}return _0x2cee26[_0xfd3d('0x20')];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x4b')]=function(){var _0x58bcc7=this;return function(_0x2ed4ed){if(_0x2ed4ed){freeIsNotKey(_0x2ed4ed,_0x58bcc7[_0xfd3d('0x4c')],'id');for(var _0x3e3be4=0x0,_0x497835={},_0x394779={};_0x3e3be4<_0x2ed4ed[_0xfd3d('0x42')];_0x3e3be4+=0x1){_0x497835=_0x2ed4ed[_0x3e3be4];if(_[_0xfd3d('0x44')](_0x58bcc7[_0xfd3d('0x4c')][_0x497835['id']])){_0x58bcc7[_0xfd3d('0x4c')][_0x497835['id']]=new ZohoAccount(_0x497835);}else{_0x58bcc7[_0xfd3d('0x40')](_0x58bcc7[_0xfd3d('0x4c')][_0x497835['id']],_0x497835);}}}return _0x58bcc7[_0xfd3d('0x4c')];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x4d')]=function(){var _0x15eb96=this;return function(_0x20dfd1){if(_0x20dfd1){freeIsNotKey(_0x20dfd1,_0x15eb96['deskAccounts'],'id');for(var _0x1118b3=0x0,_0x55a9f0={},_0x2b185b={};_0x1118b3<_0x20dfd1['length'];_0x1118b3+=0x1){_0x55a9f0=_0x20dfd1[_0x1118b3];if(_[_0xfd3d('0x44')](_0x15eb96[_0xfd3d('0x21')][_0x55a9f0['id']])){_0x15eb96['deskAccounts'][_0x55a9f0['id']]=new DeskAccount(_0x55a9f0);}else{_0x15eb96[_0xfd3d('0x40')](_0x15eb96[_0xfd3d('0x21')][_0x55a9f0['id']],_0x55a9f0);}}}return _0x15eb96[_0xfd3d('0x21')];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x4e')]=function(){var _0x1e2b3b=this;return function(_0x301bdc){if(_0x301bdc){freeIsNotKey(_0x301bdc,_0x1e2b3b[_0xfd3d('0x1f')],'id');for(var _0x355c2a=0x0,_0x47dded={},_0x40b0fc={};_0x355c2a<_0x301bdc[_0xfd3d('0x42')];_0x355c2a+=0x1){_0x47dded=_0x301bdc[_0x355c2a];if(_[_0xfd3d('0x44')](_0x1e2b3b[_0xfd3d('0x1f')][_0x47dded['id']])){_0x1e2b3b[_0xfd3d('0x1f')][_0x47dded['id']]=new SugarcrmAccount(_0x47dded);}else{_0x1e2b3b[_0xfd3d('0x40')](_0x1e2b3b['sugarcrmAccounts'][_0x47dded['id']],_0x47dded);}}}return _0x1e2b3b[_0xfd3d('0x1f')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x147099=this;return function(_0x48f3c0){if(_0x48f3c0){freeIsNotKey(_0x48f3c0,_0x147099['vtigerAccounts'],'id');for(var _0x22eee2=0x0,_0x49df45={},_0x211d0a={};_0x22eee2<_0x48f3c0[_0xfd3d('0x42')];_0x22eee2+=0x1){_0x49df45=_0x48f3c0[_0x22eee2];if(_[_0xfd3d('0x44')](_0x147099['vtigerAccounts'][_0x49df45['id']])){_0x147099[_0xfd3d('0x22')][_0x49df45['id']]=new VtigerAccount(_0x49df45);}else{_0x147099[_0xfd3d('0x40')](_0x147099[_0xfd3d('0x22')][_0x49df45['id']],_0x49df45);}}}return _0x147099['vtigerAccounts'];};};Realtime['prototype'][_0xfd3d('0x4f')]=function(){var _0x1554b5=this;return function(_0x530414){if(_0x530414){freeIsNotKey(_0x530414,_0x1554b5[_0xfd3d('0x23')],'id');for(var _0x3c9f30=0x0,_0x5e6939={},_0x10a822={};_0x3c9f30<_0x530414['length'];_0x3c9f30+=0x1){_0x5e6939=_0x530414[_0x3c9f30];if(_[_0xfd3d('0x44')](_0x1554b5[_0xfd3d('0x23')][_0x5e6939['id']])){_0x1554b5[_0xfd3d('0x23')][_0x5e6939['id']]=new ServicenowAccount(_0x5e6939);}else{_0x1554b5[_0xfd3d('0x40')](_0x1554b5[_0xfd3d('0x23')][_0x5e6939['id']],_0x5e6939);}}}return _0x1554b5[_0xfd3d('0x23')];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x50')]=function(){var _0x428c0a=this;return function(_0x2d7f79){if(_0x2d7f79){freeIsNotKey(_0x2d7f79,_0x428c0a[_0xfd3d('0x51')],'id');for(var _0x194222=0x0,_0x316d16={},_0x4adf52={};_0x194222<_0x2d7f79[_0xfd3d('0x42')];_0x194222+=0x1){_0x316d16=_0x2d7f79[_0x194222];if(_[_0xfd3d('0x44')](_0x428c0a[_0xfd3d('0x51')][_0x316d16['id']])){_0x428c0a[_0xfd3d('0x51')][_0x316d16['id']]=new Dynamics365Account(_0x316d16);}else{_0x428c0a['mergeFromDatabase'](_0x428c0a[_0xfd3d('0x51')][_0x316d16['id']],_0x316d16);}}}return _0x428c0a['dynamics365Accounts'];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x52')]=function(){var _0x43bf57=this;return function(_0x4305a7){if(_0x4305a7){freeIsNotKey(_0x4305a7,_0x43bf57[_0xfd3d('0x53')],'id');for(var _0x20a3a6=0x0,_0x444c7f={},_0x23aff4={};_0x20a3a6<_0x4305a7[_0xfd3d('0x42')];_0x20a3a6+=0x1){_0x444c7f=_0x4305a7[_0x20a3a6];if(_[_0xfd3d('0x44')](_0x43bf57[_0xfd3d('0x53')][_0x444c7f['id']])){_0x43bf57[_0xfd3d('0x53')][_0x444c7f['id']]=new FreshsalesAccount(_0x444c7f);}else{_0x43bf57[_0xfd3d('0x40')](_0x43bf57[_0xfd3d('0x53')][_0x444c7f['id']],_0x444c7f);}}}return _0x43bf57[_0xfd3d('0x53')];};};Realtime[_0xfd3d('0x41')][_0xfd3d('0x54')]=function(){var _0x3003af=this;return function(_0x75ab4c){for(var _0xd25a77=0x0;_0xd25a77<_0x75ab4c[_0xfd3d('0x42')];_0xd25a77+=0x1){_[_0xfd3d('0x55')](_0x3003af[_0xfd3d('0x48')][_0x75ab4c[_0xd25a77][_0xfd3d('0x29')]],_0x75ab4c[_0xd25a77]);}return _0x3003af['voiceQueues'];};};Realtime[_0xfd3d('0x41')]['initVoiceQueueReports']=function(){var _0xe66b7c=this;return function(_0xdee0e1){clearVoiceQueues(_0xe66b7c[_0xfd3d('0x48')]);if(_0xdee0e1){_0xdee0e1=_['groupBy'](_0xdee0e1,_0xfd3d('0x56'));for(var _0x1992ab in _0xdee0e1){if(_0xdee0e1[_0xfd3d('0x26')](_0x1992ab)){var _0x2f41cd={};for(var _0x4630f6=0x0;_0x4630f6<_0xdee0e1[_0x1992ab][_0xfd3d('0x42')];_0x4630f6+=0x1){var _0x1aeffe=_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x57')];if(_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe]){if(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x58')]){_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x59')]+=0x1;}if(_0xdee0e1[_0x1992ab][_0x4630f6]['queuecallerabandon']){_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x32')]+=0x1;}_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x2d')]+=moment(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x5a')])['diff'](moment(_0xdee0e1[_0x1992ab][_0x4630f6]['queuecallerjoinAt']),_0xfd3d('0x5b'))||0x0;if(_0x4630f6===_0xdee0e1[_0x1992ab][_0xfd3d('0x42')]-0x1){_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x5c')]+=moment(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x5d')]||_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x5e')]||_0xdee0e1[_0x1992ab][_0x4630f6]['queuecallerexitAt'])[_0xfd3d('0x5f')](moment(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x60')]),_0xfd3d('0x5b'))||0x0;_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x2b')]+=0x1;if(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x61')]){_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x2c')]+=0x1;_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x2e')]+=moment(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x5d')])['diff'](moment(_0xdee0e1[_0x1992ab][_0x4630f6][_0xfd3d('0x5a')]),'seconds')||0x0;}}else{_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x5c')]+=_0xe66b7c[_0xfd3d('0x48')][_0x1aeffe][_0xfd3d('0x2d')]||0x0;}}}}}}return _0xe66b7c[_0xfd3d('0x48')];};};Realtime['prototype'][_0xfd3d('0x62')]=function(){var _0x44a265=this;return function(_0x7c45d4){clearVoiceCallReports(_0x44a265[_0xfd3d('0x63')]);if(_0x7c45d4){for(var _0xe236b=0x0;_0xe236b<_0x7c45d4[_0xfd3d('0x42')];_0xe236b+=0x1){_0x44a265[_0xfd3d('0x63')][_0xfd3d('0x2b')]+=0x1;_0x44a265[_0xfd3d('0x63')][_0xfd3d('0x5c')]+=_0x7c45d4[_0xe236b][_0xfd3d('0x64')];if(_0x7c45d4[_0xe236b]['disposition']==='ANSWERED'){_0x44a265[_0xfd3d('0x63')][_0xfd3d('0x2c')]+=0x1;_0x44a265[_0xfd3d('0x63')]['sumHoldTime']+=_0x7c45d4[_0xe236b][_0xfd3d('0x64')]-_0x7c45d4[_0xe236b][_0xfd3d('0x65')]||0x0;_0x44a265['outbound'][_0xfd3d('0x2e')]+=_0x7c45d4[_0xe236b][_0xfd3d('0x65')];}}}return _0x44a265[_0xfd3d('0x63')];};};Realtime[_0xfd3d('0x41')]['initCampaigns']=function(){var _0x54c497=this;return function(_0x211652){if(_0x211652){freeIsNotKey(_0x211652,_0x54c497[_0xfd3d('0x15')],_0xfd3d('0x29'));for(var _0x54c130=0x0,_0x31bb13={};_0x54c130<_0x211652['length'];_0x54c130+=0x1){_0x31bb13=_0x211652[_0x54c130];if(_[_0xfd3d('0x44')](_0x54c497[_0xfd3d('0x15')][_0x31bb13[_0xfd3d('0x29')]])){_0x54c497['campaigns'][_0x31bb13[_0xfd3d('0x29')]]=new Campaign(_0x31bb13);}else{_0x54c497[_0xfd3d('0x40')](_0x54c497['campaigns'][_0x31bb13[_0xfd3d('0x29')]],_0x31bb13);_0x54c497[_0xfd3d('0x15')][_0x31bb13[_0xfd3d('0x29')]]['dialQueueProject']=_0x31bb13[_0xfd3d('0x66')]?_0x31bb13[_0xfd3d('0x66')][_0xfd3d('0x29')]:undefined;}}}return _0x54c497[_0xfd3d('0x15')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x2fd136=this;return function(_0x388e15){if(_0x388e15){freeIsNotKey(_0x388e15,_0x2fd136['voiceExtensions'],'id');for(var _0x239b1f=0x0,_0x51bb3b={};_0x239b1f<_0x388e15[_0xfd3d('0x42')];_0x239b1f+=0x1){_0x51bb3b=_0x388e15[_0x239b1f];if(_['isUndefined'](_0x2fd136[_0xfd3d('0x17')][_0x51bb3b['id']])){_0x2fd136['voiceExtensions'][_0x51bb3b['id']]=new VoiceExtension(_0x51bb3b);}else{_0x2fd136['mergeFromDatabase'](_0x2fd136[_0xfd3d('0x17')][_0x51bb3b['id']],_0x51bb3b);}}}return _0x2fd136[_0xfd3d('0x17')];};};Realtime[_0xfd3d('0x41')]['initCampaignHopperHistory']=function(){var _0xb161cc=this;return function(_0x4a97b7){clearCampaigns(_0xb161cc['campaigns']);for(var _0x109c0c=0x0;_0x109c0c<_0x4a97b7[_0xfd3d('0x42')];_0x109c0c+=0x1){_[_0xfd3d('0x55')](_0xb161cc[_0xfd3d('0x15')][_0x4a97b7[_0x109c0c][_0xfd3d('0x29')]],_0x4a97b7[_0x109c0c]);}return _0xb161cc[_0xfd3d('0x15')];};};Realtime[_0xfd3d('0x41')]['initFaxAccounts']=function(){var _0x4bd854=this;return function(_0x2c61f0){if(_0x2c61f0){freeIsNotKey(_0x2c61f0,_0x4bd854[_0xfd3d('0x24')],'id');for(var _0x30328d=0x0,_0x118a83={},_0x2e2d29={};_0x30328d<_0x2c61f0[_0xfd3d('0x42')];_0x30328d+=0x1){_0x118a83=_0x2c61f0[_0x30328d];if(_[_0xfd3d('0x44')](_0x4bd854[_0xfd3d('0x24')][_0x118a83['id']])){_0x4bd854[_0xfd3d('0x24')][_0x118a83['id']]=new FaxAccount(_0x118a83);}else{_0x4bd854[_0xfd3d('0x40')](_0x4bd854[_0xfd3d('0x24')][_0x118a83['id']],_0x118a83);}}}return _0x4bd854[_0xfd3d('0x24')];};};module[_0xfd3d('0x67')]=Realtime; \ No newline at end of file +var _0xf2b9=['queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','total','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','bluebird','../model/agent','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','length','isNil','isUndefined','agents','mergeFromDatabase','initTelephones','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initSalesforceAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit'];(function(_0x436b38,_0x263f5b){var _0x5db3e1=function(_0x3192aa){while(--_0x3192aa){_0x436b38['push'](_0x436b38['shift']());}};_0x5db3e1(++_0x263f5b);}(_0xf2b9,0x1bc));var _0x9f2b=function(_0x2e2b08,_0x246475){_0x2e2b08=_0x2e2b08-0x0;var _0x72346e=_0xf2b9[_0x2e2b08];return _0x72346e;};'use strict';var BPromise=require(_0x9f2b('0x0'));var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require(_0x9f2b('0x1'));var Telephone=require('../model/telephone');var Trunk=require(_0x9f2b('0x2'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x9f2b('0x3'));var Template=require(_0x9f2b('0x4'));var Campaign=require(_0x9f2b('0x5'));var VoiceExtension=require(_0x9f2b('0x6'));var ZendeskAccount=require(_0x9f2b('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x9f2b('0x8'));var ZohoAccount=require(_0x9f2b('0x9'));var DeskAccount=require(_0x9f2b('0xa'));var VtigerAccount=require(_0x9f2b('0xb'));var ServicenowAccount=require(_0x9f2b('0xc'));var Dynamics365Account=require(_0x9f2b('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x9f2b('0xe'));var Realtime=function(){this['agents']={};this[_0x9f2b('0xf')]={};this[_0x9f2b('0x10')]={};this[_0x9f2b('0x11')]={};this['triggers']={};this[_0x9f2b('0x12')]={};this['templates']={};this[_0x9f2b('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9f2b('0x14')]={};this[_0x9f2b('0x15')]={};this[_0x9f2b('0x16')]={};this[_0x9f2b('0x17')]={};this['timers']={};this[_0x9f2b('0x18')]={};this[_0x9f2b('0x19')]={};this[_0x9f2b('0x1a')]={};this[_0x9f2b('0x1b')]={};this[_0x9f2b('0x1c')]={};this[_0x9f2b('0x1d')]={};this[_0x9f2b('0x1e')]={};this[_0x9f2b('0x1f')]={};this[_0x9f2b('0x20')]={};this[_0x9f2b('0x21')]={};this[_0x9f2b('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0xf005bb,_0x3aff7d,_0x1c1c69){var _0x51440d=_[_0x9f2b('0x23')](_0xf005bb,function(_0x1e5e20,_0x1fb767){return _0x1e5e20[_0x1c1c69];});for(var _0x25a1f8 in _0x3aff7d){if(_0x3aff7d[_0x9f2b('0x24')](_0x25a1f8)){if(!_0x51440d[_0x25a1f8]){delete _0x3aff7d[_0x25a1f8];}}}}function freeIsNotKeySip(_0x17a0df,_0x4c7a38){var _0x7228f0=_[_0x9f2b('0x23')](_0x17a0df,function(_0x1aa538,_0x46ea40){return util[_0x9f2b('0x25')](_0x9f2b('0x26'),_0x1aa538[_0x9f2b('0x27')]);});for(var _0x53238a in _0x4c7a38){if(_0x4c7a38[_0x9f2b('0x24')](_0x53238a)){if(!_0x7228f0[_0x53238a]){delete _0x4c7a38[_0x53238a];}}}}function freeIsNotKeyAgent(_0x4d58fd,_0x439699){var _0x2a61c6=_['mapKeys'](_0x4d58fd,function(_0x361b3d,_0x3da8e7){var _0x11fab1=_['isNil'](_0x361b3d['interface'])?util[_0x9f2b('0x25')](_0x9f2b('0x26'),_0x361b3d['name']):_0x361b3d[_0x9f2b('0x28')];return _0x11fab1;});for(var _0x28b030 in _0x439699){if(_0x439699[_0x9f2b('0x24')](_0x28b030)){if(!_0x2a61c6[_0x28b030]){delete _0x439699[_0x28b030];}}}}function clearVoiceCallReports(_0x31d10c){_0x31d10c['total']=0x0;_0x31d10c[_0x9f2b('0x29')]=0x0;_0x31d10c[_0x9f2b('0x2a')]=0x0;_0x31d10c[_0x9f2b('0x2b')]=0x0;_0x31d10c['sumBillable']=0x0;}function clearCampaigns(_0x2a9257){if(!_[_0x9f2b('0x2c')](_0x2a9257)){for(var _0xea9ce9 in _0x2a9257){if(_0x2a9257[_0x9f2b('0x24')](_0xea9ce9)){_0x2a9257[_0xea9ce9][_0x9f2b('0x2d')]=0x0;_0x2a9257[_0xea9ce9][_0x9f2b('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x103dd2){if(!_['isEmpty'](_0x103dd2)){for(var _0x338ddc in _0x103dd2){if(_0x103dd2['hasOwnProperty'](_0x338ddc)){_0x103dd2[_0x338ddc]['total']=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x29')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x2f')]=0x0;_0x103dd2[_0x338ddc]['abandoned']=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x2a')]=0x0;_0x103dd2[_0x338ddc]['sumDuration']=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x30')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x31')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x32')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x33')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x34')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x35')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x36')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x37')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x38')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x39')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x3a')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x3b')]=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x3c')]=0x0;_0x103dd2[_0x338ddc]['outboundAnswerAgiCallsDay']=0x0;_0x103dd2[_0x338ddc][_0x9f2b('0x3d')]=0x0;_0x103dd2[_0x338ddc]['queueStatusComplete']=!![];}}}}Realtime[_0x9f2b('0x3e')]['mergeFromDatabase']=function(_0x35de60,_0x251350){for(var _0x238a6b in _0x251350){if(_0x35de60[_0x9f2b('0x24')](_0x238a6b)){_0x35de60[_0x238a6b]=_0x251350[_0x238a6b];}}};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x3f')]=function(){var _0x4a9125=this;return function(_0x290858){if(_0x290858){freeIsNotKeyAgent(_0x290858,_0x4a9125['agents']);for(var _0x43ba4d=0x0,_0x21103b={},_0x57aacf={};_0x43ba4d<_0x290858[_0x9f2b('0x40')];_0x43ba4d+=0x1){_0x21103b=_0x290858[_0x43ba4d];var _0x1ecf4c=_[_0x9f2b('0x41')](_0x21103b[_0x9f2b('0x28')])?util[_0x9f2b('0x25')](_0x9f2b('0x26'),_0x21103b[_0x9f2b('0x27')]):_0x21103b[_0x9f2b('0x28')];if(_[_0x9f2b('0x42')](_0x4a9125['agents'][_0x1ecf4c])){_0x4a9125[_0x9f2b('0x43')][_0x1ecf4c]=new Agent(_0x21103b);}else{_0x4a9125[_0x9f2b('0x44')](_0x4a9125[_0x9f2b('0x43')][_0x1ecf4c],_0x21103b);}}}return _0x4a9125[_0x9f2b('0x43')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x45')]=function(){var _0x1053d3=this;return function(_0x3c2c51){if(_0x3c2c51){freeIsNotKeySip(_0x3c2c51,_0x1053d3[_0x9f2b('0xf')]);for(var _0x59154d=0x0,_0x10b5a1={},_0x5f17c8={};_0x59154d<_0x3c2c51[_0x9f2b('0x40')];_0x59154d+=0x1){_0x10b5a1=_0x3c2c51[_0x59154d];if(_[_0x9f2b('0x42')](_0x1053d3['telephones'][util['format'](_0x9f2b('0x26'),_0x10b5a1[_0x9f2b('0x27')])])){_0x1053d3[_0x9f2b('0xf')][util['format'](_0x9f2b('0x26'),_0x10b5a1['name'])]=new Telephone(_0x10b5a1);}else{_0x1053d3[_0x9f2b('0x44')](_0x1053d3[_0x9f2b('0xf')][util[_0x9f2b('0x25')](_0x9f2b('0x26'),_0x10b5a1[_0x9f2b('0x27')])],_0x10b5a1);}}}return _0x1053d3['telephones'];};};Realtime['prototype']['initTrunks']=function(){var _0x432612=this;return function(_0x2a779e){if(_0x2a779e){freeIsNotKeySip(_0x2a779e,_0x432612[_0x9f2b('0x10')]);for(var _0xb5a748=0x0,_0x35bb7b={},_0x29a864={};_0xb5a748<_0x2a779e['length'];_0xb5a748+=0x1){_0x35bb7b=_0x2a779e[_0xb5a748];if(_['isUndefined'](_0x432612[_0x9f2b('0x10')][util['format'](_0x9f2b('0x26'),_0x35bb7b[_0x9f2b('0x27')])])){_0x432612['trunks'][util[_0x9f2b('0x25')](_0x9f2b('0x26'),_0x35bb7b[_0x9f2b('0x27')])]=new Trunk(_0x35bb7b);}else{_0x432612[_0x9f2b('0x44')](_0x432612[_0x9f2b('0x10')][util[_0x9f2b('0x25')](_0x9f2b('0x26'),_0x35bb7b[_0x9f2b('0x27')])],_0x35bb7b);}}}return _0x432612['trunks'];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x46')]=function(){var _0x1b98f9=this;return function(_0x370d39){if(_0x370d39){freeIsNotKey(_0x370d39,_0x1b98f9[_0x9f2b('0x11')],_0x9f2b('0x27'));for(var _0x44f3e1=0x0,_0x1437d8={},_0x27349a={};_0x44f3e1<_0x370d39[_0x9f2b('0x40')];_0x44f3e1+=0x1){_0x1437d8=_0x370d39[_0x44f3e1];if(_[_0x9f2b('0x42')](_0x1b98f9[_0x9f2b('0x11')][_0x1437d8[_0x9f2b('0x27')]])){_0x1b98f9[_0x9f2b('0x11')][_0x1437d8[_0x9f2b('0x27')]]=new VoiceQueue(_0x1437d8);}else{_0x1b98f9[_0x9f2b('0x44')](_0x1b98f9['voiceQueues'][_0x1437d8[_0x9f2b('0x27')]],_0x1437d8);}}}return _0x1b98f9[_0x9f2b('0x11')];};};Realtime['prototype'][_0x9f2b('0x47')]=function(){var _0x4b433a=this;return function(_0x357cdb){if(_0x357cdb){freeIsNotKey(_0x357cdb,_0x4b433a[_0x9f2b('0x48')],'id');for(var _0xb0edad=0x0,_0x349ba6={},_0x132b3d={};_0xb0edad<_0x357cdb[_0x9f2b('0x40')];_0xb0edad+=0x1){_0x349ba6=_0x357cdb[_0xb0edad];if(_[_0x9f2b('0x42')](_0x4b433a[_0x9f2b('0x48')][_0x349ba6['id']])){_0x4b433a[_0x9f2b('0x48')][_0x349ba6['id']]=new Trigger(_0x349ba6);}else{_0x4b433a['mergeFromDatabase'](_0x4b433a['triggers'][_0x349ba6['id']],_0x349ba6);}}}return _0x4b433a[_0x9f2b('0x48')];};};Realtime['prototype'][_0x9f2b('0x49')]=function(){var _0x11dca5=this;return function(_0x5e021a){if(_0x5e021a){freeIsNotKey(_0x5e021a,_0x11dca5['templates'],'id');for(var _0x1203be=0x0,_0x5f1432={},_0x250eaf={};_0x1203be<_0x5e021a[_0x9f2b('0x40')];_0x1203be+=0x1){_0x5f1432=_0x5e021a[_0x1203be];if(_[_0x9f2b('0x42')](_0x11dca5[_0x9f2b('0x4a')][_0x5f1432['id']])){_0x11dca5[_0x9f2b('0x4a')][_0x5f1432['id']]=new Template(_0x5f1432);}else{_0x11dca5[_0x9f2b('0x44')](_0x11dca5['templates'][_0x5f1432['id']],_0x5f1432);}}}return _0x11dca5[_0x9f2b('0x4a')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0xa6d2ec=this;return function(_0x519f7a){if(_0x519f7a){freeIsNotKey(_0x519f7a,_0xa6d2ec[_0x9f2b('0x19')],'id');for(var _0x5889e2=0x0,_0x31f392={},_0x235db4={};_0x5889e2<_0x519f7a['length'];_0x5889e2+=0x1){_0x31f392=_0x519f7a[_0x5889e2];if(_[_0x9f2b('0x42')](_0xa6d2ec[_0x9f2b('0x19')][_0x31f392['id']])){_0xa6d2ec[_0x9f2b('0x19')][_0x31f392['id']]=new ZendeskAccount(_0x31f392);}else{_0xa6d2ec[_0x9f2b('0x44')](_0xa6d2ec['zendeskAccounts'][_0x31f392['id']],_0x31f392);}}}return _0xa6d2ec[_0x9f2b('0x19')];};};Realtime['prototype'][_0x9f2b('0x4b')]=function(){var _0x35559e=this;return function(_0x344b80){if(_0x344b80){freeIsNotKey(_0x344b80,_0x35559e['salesforceAccounts'],'id');for(var _0x57cb06=0x0,_0x1fc144={},_0x1ec228={};_0x57cb06<_0x344b80['length'];_0x57cb06+=0x1){_0x1fc144=_0x344b80[_0x57cb06];if(_[_0x9f2b('0x42')](_0x35559e[_0x9f2b('0x1a')][_0x1fc144['id']])){_0x35559e['salesforceAccounts'][_0x1fc144['id']]=new SalesforceAccount(_0x1fc144);}else{_0x35559e[_0x9f2b('0x44')](_0x35559e[_0x9f2b('0x1a')][_0x1fc144['id']],_0x1fc144);}}}return _0x35559e[_0x9f2b('0x1a')];};};Realtime[_0x9f2b('0x3e')]['initFreshdeskAccounts']=function(){var _0x4e4c5c=this;return function(_0x96f8a8){if(_0x96f8a8){freeIsNotKey(_0x96f8a8,_0x4e4c5c[_0x9f2b('0x1c')],'id');for(var _0x5eec01=0x0,_0x20a6a8={},_0x34538d={};_0x5eec01<_0x96f8a8[_0x9f2b('0x40')];_0x5eec01+=0x1){_0x20a6a8=_0x96f8a8[_0x5eec01];if(_[_0x9f2b('0x42')](_0x4e4c5c[_0x9f2b('0x1c')][_0x20a6a8['id']])){_0x4e4c5c['freshdeskAccounts'][_0x20a6a8['id']]=new FreshdeskAccount(_0x20a6a8);}else{_0x4e4c5c[_0x9f2b('0x44')](_0x4e4c5c[_0x9f2b('0x1c')][_0x20a6a8['id']],_0x20a6a8);}}}return _0x4e4c5c[_0x9f2b('0x1c')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x25e0de=this;return function(_0x4d7939){if(_0x4d7939){freeIsNotKey(_0x4d7939,_0x25e0de[_0x9f2b('0x1d')],'id');for(var _0x2f5bf7=0x0,_0x401f8b={},_0x4d90ca={};_0x2f5bf7<_0x4d7939[_0x9f2b('0x40')];_0x2f5bf7+=0x1){_0x401f8b=_0x4d7939[_0x2f5bf7];if(_['isUndefined'](_0x25e0de[_0x9f2b('0x1d')][_0x401f8b['id']])){_0x25e0de[_0x9f2b('0x1d')][_0x401f8b['id']]=new ZohoAccount(_0x401f8b);}else{_0x25e0de[_0x9f2b('0x44')](_0x25e0de[_0x9f2b('0x1d')][_0x401f8b['id']],_0x401f8b);}}}return _0x25e0de['zohoAccounts'];};};Realtime[_0x9f2b('0x3e')]['initDeskAccounts']=function(){var _0x402466=this;return function(_0x31187e){if(_0x31187e){freeIsNotKey(_0x31187e,_0x402466[_0x9f2b('0x1e')],'id');for(var _0x36cc5d=0x0,_0x5c3b01={},_0x281639={};_0x36cc5d<_0x31187e[_0x9f2b('0x40')];_0x36cc5d+=0x1){_0x5c3b01=_0x31187e[_0x36cc5d];if(_[_0x9f2b('0x42')](_0x402466[_0x9f2b('0x1e')][_0x5c3b01['id']])){_0x402466['deskAccounts'][_0x5c3b01['id']]=new DeskAccount(_0x5c3b01);}else{_0x402466[_0x9f2b('0x44')](_0x402466['deskAccounts'][_0x5c3b01['id']],_0x5c3b01);}}}return _0x402466[_0x9f2b('0x1e')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x4c')]=function(){var _0x1cade1=this;return function(_0x37442e){if(_0x37442e){freeIsNotKey(_0x37442e,_0x1cade1[_0x9f2b('0x1b')],'id');for(var _0x3966eb=0x0,_0x245bd9={},_0x3e3fa4={};_0x3966eb<_0x37442e[_0x9f2b('0x40')];_0x3966eb+=0x1){_0x245bd9=_0x37442e[_0x3966eb];if(_['isUndefined'](_0x1cade1[_0x9f2b('0x1b')][_0x245bd9['id']])){_0x1cade1['sugarcrmAccounts'][_0x245bd9['id']]=new SugarcrmAccount(_0x245bd9);}else{_0x1cade1[_0x9f2b('0x44')](_0x1cade1[_0x9f2b('0x1b')][_0x245bd9['id']],_0x245bd9);}}}return _0x1cade1['sugarcrmAccounts'];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x4d')]=function(){var _0x2824d7=this;return function(_0x3089d2){if(_0x3089d2){freeIsNotKey(_0x3089d2,_0x2824d7['vtigerAccounts'],'id');for(var _0x22c961=0x0,_0x31fa40={},_0x1e2219={};_0x22c961<_0x3089d2[_0x9f2b('0x40')];_0x22c961+=0x1){_0x31fa40=_0x3089d2[_0x22c961];if(_[_0x9f2b('0x42')](_0x2824d7[_0x9f2b('0x1f')][_0x31fa40['id']])){_0x2824d7[_0x9f2b('0x1f')][_0x31fa40['id']]=new VtigerAccount(_0x31fa40);}else{_0x2824d7[_0x9f2b('0x44')](_0x2824d7[_0x9f2b('0x1f')][_0x31fa40['id']],_0x31fa40);}}}return _0x2824d7[_0x9f2b('0x1f')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x4e')]=function(){var _0x5bf540=this;return function(_0x17ca93){if(_0x17ca93){freeIsNotKey(_0x17ca93,_0x5bf540['servicenowAccounts'],'id');for(var _0x312ee8=0x0,_0x297110={},_0x5947ac={};_0x312ee8<_0x17ca93[_0x9f2b('0x40')];_0x312ee8+=0x1){_0x297110=_0x17ca93[_0x312ee8];if(_['isUndefined'](_0x5bf540[_0x9f2b('0x20')][_0x297110['id']])){_0x5bf540[_0x9f2b('0x20')][_0x297110['id']]=new ServicenowAccount(_0x297110);}else{_0x5bf540[_0x9f2b('0x44')](_0x5bf540[_0x9f2b('0x20')][_0x297110['id']],_0x297110);}}}return _0x5bf540[_0x9f2b('0x20')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x4f')]=function(){var _0x4b6e34=this;return function(_0x44a16e){if(_0x44a16e){freeIsNotKey(_0x44a16e,_0x4b6e34[_0x9f2b('0x21')],'id');for(var _0x45e9ed=0x0,_0x704665={},_0x2ab7df={};_0x45e9ed<_0x44a16e[_0x9f2b('0x40')];_0x45e9ed+=0x1){_0x704665=_0x44a16e[_0x45e9ed];if(_['isUndefined'](_0x4b6e34[_0x9f2b('0x21')][_0x704665['id']])){_0x4b6e34[_0x9f2b('0x21')][_0x704665['id']]=new Dynamics365Account(_0x704665);}else{_0x4b6e34[_0x9f2b('0x44')](_0x4b6e34['dynamics365Accounts'][_0x704665['id']],_0x704665);}}}return _0x4b6e34[_0x9f2b('0x21')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x50')]=function(){var _0x4243a4=this;return function(_0x574c8d){if(_0x574c8d){freeIsNotKey(_0x574c8d,_0x4243a4[_0x9f2b('0x22')],'id');for(var _0x2823c2=0x0,_0x1f0c5a={},_0x51175d={};_0x2823c2<_0x574c8d['length'];_0x2823c2+=0x1){_0x1f0c5a=_0x574c8d[_0x2823c2];if(_[_0x9f2b('0x42')](_0x4243a4[_0x9f2b('0x22')][_0x1f0c5a['id']])){_0x4243a4[_0x9f2b('0x22')][_0x1f0c5a['id']]=new FreshsalesAccount(_0x1f0c5a);}else{_0x4243a4['mergeFromDatabase'](_0x4243a4['freshsalesAccounts'][_0x1f0c5a['id']],_0x1f0c5a);}}}return _0x4243a4[_0x9f2b('0x22')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x51')]=function(){var _0x57f34f=this;return function(_0x13139e){for(var _0xd21ab6=0x0;_0xd21ab6<_0x13139e[_0x9f2b('0x40')];_0xd21ab6+=0x1){_[_0x9f2b('0x52')](_0x57f34f[_0x9f2b('0x11')][_0x13139e[_0xd21ab6]['name']],_0x13139e[_0xd21ab6]);}return _0x57f34f['voiceQueues'];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x53')]=function(){var _0x4193d1=this;return function(_0x2c42f7){clearVoiceQueues(_0x4193d1[_0x9f2b('0x11')]);if(_0x2c42f7){_0x2c42f7=_[_0x9f2b('0x54')](_0x2c42f7,'uniqueid');for(var _0x3fe92f in _0x2c42f7){if(_0x2c42f7[_0x9f2b('0x24')](_0x3fe92f)){var _0x4ccf90={};for(var _0x555747=0x0;_0x555747<_0x2c42f7[_0x3fe92f][_0x9f2b('0x40')];_0x555747+=0x1){var _0x1889fe=_0x2c42f7[_0x3fe92f][_0x555747]['queue'];if(_0x4193d1[_0x9f2b('0x11')][_0x1889fe]){if(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x55')]){_0x4193d1[_0x9f2b('0x11')][_0x1889fe]['unmanaged']+=0x1;}if(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x56')]){_0x4193d1[_0x9f2b('0x11')][_0x1889fe][_0x9f2b('0x57')]+=0x1;}_0x4193d1[_0x9f2b('0x11')][_0x1889fe][_0x9f2b('0x2a')]+=moment(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x58')])[_0x9f2b('0x59')](moment(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x5a')]),_0x9f2b('0x5b'))||0x0;if(_0x555747===_0x2c42f7[_0x3fe92f]['length']-0x1){_0x4193d1[_0x9f2b('0x11')][_0x1889fe][_0x9f2b('0x2b')]+=moment(_0x2c42f7[_0x3fe92f][_0x555747]['queuecallercompleteAt']||_0x2c42f7[_0x3fe92f][_0x555747]['queuecallerabandonAt']||_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x5c')])[_0x9f2b('0x59')](moment(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x5a')]),_0x9f2b('0x5b'))||0x0;_0x4193d1[_0x9f2b('0x11')][_0x1889fe]['total']+=0x1;if(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x5d')]){_0x4193d1['voiceQueues'][_0x1889fe]['answered']+=0x1;_0x4193d1[_0x9f2b('0x11')][_0x1889fe][_0x9f2b('0x30')]+=moment(_0x2c42f7[_0x3fe92f][_0x555747][_0x9f2b('0x5e')])[_0x9f2b('0x59')](moment(_0x2c42f7[_0x3fe92f][_0x555747]['queuecallerleaveAt']),_0x9f2b('0x5b'))||0x0;}}else{_0x4193d1['voiceQueues'][_0x1889fe]['sumDuration']+=_0x4193d1[_0x9f2b('0x11')][_0x1889fe][_0x9f2b('0x2a')]||0x0;}}}}}}return _0x4193d1['voiceQueues'];};};Realtime[_0x9f2b('0x3e')]['initVoiceCallReports']=function(){var _0xebfa4a=this;return function(_0x738004){clearVoiceCallReports(_0xebfa4a[_0x9f2b('0x13')]);if(_0x738004){for(var _0x4d8101=0x0;_0x4d8101<_0x738004['length'];_0x4d8101+=0x1){_0xebfa4a[_0x9f2b('0x13')][_0x9f2b('0x5f')]+=0x1;_0xebfa4a[_0x9f2b('0x13')][_0x9f2b('0x2b')]+=_0x738004[_0x4d8101]['duration'];if(_0x738004[_0x4d8101]['disposition']===_0x9f2b('0x60')){_0xebfa4a['outbound'][_0x9f2b('0x29')]+=0x1;_0xebfa4a['outbound'][_0x9f2b('0x2a')]+=_0x738004[_0x4d8101][_0x9f2b('0x61')]-_0x738004[_0x4d8101][_0x9f2b('0x62')]||0x0;_0xebfa4a[_0x9f2b('0x13')][_0x9f2b('0x30')]+=_0x738004[_0x4d8101][_0x9f2b('0x62')];}}}return _0xebfa4a['outbound'];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x63')]=function(){var _0x1598c4=this;return function(_0x5e10b2){if(_0x5e10b2){freeIsNotKey(_0x5e10b2,_0x1598c4[_0x9f2b('0x12')],'name');for(var _0x24a4b3=0x0,_0x3f8f66={};_0x24a4b3<_0x5e10b2[_0x9f2b('0x40')];_0x24a4b3+=0x1){_0x3f8f66=_0x5e10b2[_0x24a4b3];if(_['isUndefined'](_0x1598c4['campaigns'][_0x3f8f66[_0x9f2b('0x27')]])){_0x1598c4[_0x9f2b('0x12')][_0x3f8f66[_0x9f2b('0x27')]]=new Campaign(_0x3f8f66);}else{_0x1598c4[_0x9f2b('0x44')](_0x1598c4[_0x9f2b('0x12')][_0x3f8f66[_0x9f2b('0x27')]],_0x3f8f66);_0x1598c4[_0x9f2b('0x12')][_0x3f8f66[_0x9f2b('0x27')]][_0x9f2b('0x64')]=_0x3f8f66[_0x9f2b('0x65')]?_0x3f8f66['SquareProject'][_0x9f2b('0x27')]:undefined;}}}return _0x1598c4[_0x9f2b('0x12')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x66')]=function(){var _0x2fc6e2=this;return function(_0xdfaeaa){if(_0xdfaeaa){freeIsNotKey(_0xdfaeaa,_0x2fc6e2[_0x9f2b('0x14')],'id');for(var _0xea083=0x0,_0x1f722e={};_0xea083<_0xdfaeaa[_0x9f2b('0x40')];_0xea083+=0x1){_0x1f722e=_0xdfaeaa[_0xea083];if(_['isUndefined'](_0x2fc6e2[_0x9f2b('0x14')][_0x1f722e['id']])){_0x2fc6e2[_0x9f2b('0x14')][_0x1f722e['id']]=new VoiceExtension(_0x1f722e);}else{_0x2fc6e2[_0x9f2b('0x44')](_0x2fc6e2[_0x9f2b('0x14')][_0x1f722e['id']],_0x1f722e);}}}return _0x2fc6e2[_0x9f2b('0x14')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x67')]=function(){var _0x3e617d=this;return function(_0x7ff270){clearCampaigns(_0x3e617d[_0x9f2b('0x12')]);for(var _0x5a8d0a=0x0;_0x5a8d0a<_0x7ff270['length'];_0x5a8d0a+=0x1){_[_0x9f2b('0x52')](_0x3e617d[_0x9f2b('0x12')][_0x7ff270[_0x5a8d0a][_0x9f2b('0x27')]],_0x7ff270[_0x5a8d0a]);}return _0x3e617d[_0x9f2b('0x12')];};};Realtime[_0x9f2b('0x3e')][_0x9f2b('0x68')]=function(){var _0x3e852e=this;return function(_0x5e3670){if(_0x5e3670){freeIsNotKey(_0x5e3670,_0x3e852e[_0x9f2b('0x69')],'id');for(var _0x277fb3=0x0,_0x19ac15={},_0x398e11={};_0x277fb3<_0x5e3670['length'];_0x277fb3+=0x1){_0x19ac15=_0x5e3670[_0x277fb3];if(_[_0x9f2b('0x42')](_0x3e852e[_0x9f2b('0x69')][_0x19ac15['id']])){_0x3e852e[_0x9f2b('0x69')][_0x19ac15['id']]=new FaxAccount(_0x19ac15);}else{_0x3e852e['mergeFromDatabase'](_0x3e852e[_0x9f2b('0x69')][_0x19ac15['id']],_0x19ac15);}}}return _0x3e852e[_0x9f2b('0x69')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c7b89aa..9ad5926 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 _0x72c6=['xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','SIP/%s','length','connectedlinenum','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','keys','getCallType','getAgentByInternal','internal','destination','exten','type','dialer','queue','lastdata','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','format','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','split','create','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','findAgent','membername','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync'];(function(_0x2d9f58,_0x2d9db6){var _0x59f362=function(_0x32f7fb){while(--_0x32f7fb){_0x2d9f58['push'](_0x2d9f58['shift']());}};_0x59f362(++_0x2d9db6);}(_0x72c6,0xa7));var _0x672c=function(_0x234dbc,_0x143b83){_0x234dbc=_0x234dbc-0x0;var _0x50becc=_0x72c6[_0x234dbc];return _0x50becc;};'use strict';var _=require('lodash');var moment=require(_0x672c('0x0'));var util=require(_0x672c('0x1'));var config=require(_0x672c('0x2'));var ami=require(_0x672c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x672c('0x4'));var RpcVoiceDialReport=require(_0x672c('0x5'));var RpcMemberReport=require(_0x672c('0x6'));var RpcVoiceQueueReport=require(_0x672c('0x7'));var RpcVoiceRecording=require(_0x672c('0x8'));var RpcVoiceTransferReport=require(_0x672c('0x9'));var VoiceQueueReport=require(_0x672c('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x672c('0xb'));var VoiceDialReport=require(_0x672c('0xc'));var UserReport=require(_0x672c('0xd'));function Report(_0x355111){this[_0x672c('0xe')]=_0x355111;this['agents']=_0x355111[_0x672c('0xf')];this['telephones']=_0x355111[_0x672c('0x10')];}Report[_0x672c('0x11')][_0x672c('0x12')]=function(_0xaca512){var _0x1e931e=new VoiceQueueReport(this['realtime']);var _0x471c0b=new VoiceAgentReport(this[_0x672c('0xe')]);var _0x37b71a=new VoiceDialReport(this['realtime']);var _0x3aa010=new VoiceCallReport(this[_0x672c('0xe')]);var _0x477bf8=new UserReport(this[_0x672c('0xe')]);if(config[_0x672c('0x13')]&&config['xdr'][_0x672c('0x14')]){ami['on'](_0x672c('0x15'),this[_0x672c('0x16')][_0x672c('0x17')](this));ami['on'](_0x672c('0x18'),this[_0x672c('0x19')][_0x672c('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0x672c('0x1a')][_0x672c('0x17')](this));ami['on'](_0x672c('0x1b'),this[_0x672c('0x1c')]['bind'](this));ami['on']('blindtransfer',this['blindTransfer']['bind'](this));ami['on'](_0x672c('0x1d'),this[_0x672c('0x1e')]['bind'](this));}};Report[_0x672c('0x11')]['findAgent']=function(_0x13b6a4){var _0x1d1e5d;_0x1d1e5d=_[_0x672c('0x1f')](this[_0x672c('0xf')],function(_0x2b2cd2){return _0x2b2cd2[_0x672c('0x20')]==_0x13b6a4||_0x2b2cd2[_0x672c('0x21')]==_0x13b6a4;});if(_[_0x672c('0x22')](_0x1d1e5d)){var _0x46d9e1=_[_0x672c('0x1f')](this[_0x672c('0x10')],function(_0x58c811){return _0x58c811[_0x672c('0x20')]==_0x13b6a4||_0x58c811[_0x672c('0x21')]==_0x13b6a4;});if(_0x46d9e1){_0x1d1e5d=_['find'](this['agents'],function(_0x5b1832){return _0x5b1832['interface']==util['format'](_0x672c('0x23'),_0x46d9e1[_0x672c('0x21')]);});}}return _0x1d1e5d;};Report[_0x672c('0x11')]['voiceQueueReport']=function(_0x21b5ad){for(var _0x15f604=0x0;_0x15f604<_0x21b5ad[_0x672c('0x24')];_0x15f604+=0x1){var _0x156a4f=this['findAgent'](_0x21b5ad[_0x15f604][_0x672c('0x25')]);if(_0x156a4f){_0x21b5ad[_0x15f604][_0x672c('0x20')]=_0x156a4f[_0x672c('0x20')];_0x21b5ad[_0x15f604]['assigned']=!![];_0x21b5ad[_0x15f604]['lastAssignedTo']=_0x156a4f[_0x672c('0x21')];_0x21b5ad[_0x15f604][_0x672c('0x26')]=_[_0x672c('0x22')](_0x156a4f[_0x672c('0x26')])?util['format']('SIP/%s',_0x156a4f[_0x672c('0x21')]):_0x156a4f[_0x672c('0x26')];if(_0x21b5ad[_0x15f604]['queuecallercomplete']){_0x21b5ad[_0x15f604][_0x672c('0x27')]=moment()['format'](_0x672c('0x28'));}if(_0x21b5ad[_0x15f604][_0x672c('0x29')]){_0x21b5ad[_0x15f604]['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x672c('0x16')](_0x21b5ad[_0x15f604]);}RpcVoiceQueueReport['create'](_0x21b5ad[_0x15f604]);}};function extractCalleridNumber(_0xb4ec7b){var _0x58325c=_0xb4ec7b[_0x672c('0x2a')](/<(.*?)>/);return _0x58325c?_0x58325c[0x1]:_0xb4ec7b;}Report['prototype']['getAgentByInternal']=function(_0x1236a9){for(var _0x51ad45=0x0;_0x51ad45','calleridname','transfers','transfereelinkedid','linkedid','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','find','accountcode','isNil','interface','format','SIP/%s','name','length','findAgent','assigned'];(function(_0x4fa71a,_0x1fec08){var _0x15276e=function(_0x1b5ee5){while(--_0x1b5ee5){_0x4fa71a['push'](_0x4fa71a['shift']());}};_0x15276e(++_0x1fec08);}(_0x7347,0x149));var _0x7734=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7347[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x7734('0x0'));var moment=require(_0x7734('0x1'));var util=require(_0x7734('0x2'));var config=require(_0x7734('0x3'));var ami=require(_0x7734('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x7734('0x5'));var RpcMemberReport=require(_0x7734('0x6'));var RpcVoiceQueueReport=require(_0x7734('0x7'));var RpcVoiceRecording=require(_0x7734('0x8'));var RpcVoiceTransferReport=require(_0x7734('0x9'));var VoiceQueueReport=require(_0x7734('0xa'));var VoiceCallReport=require(_0x7734('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7734('0xc'));var UserReport=require(_0x7734('0xd'));function Report(_0x44e60d){this[_0x7734('0xe')]=_0x44e60d;this[_0x7734('0xf')]=_0x44e60d[_0x7734('0xf')];this[_0x7734('0x10')]=_0x44e60d[_0x7734('0x10')];}Report[_0x7734('0x11')][_0x7734('0x12')]=function(_0x1b0a1b){var _0x22c79c=new VoiceQueueReport(this[_0x7734('0xe')]);var _0x5542b3=new VoiceAgentReport(this[_0x7734('0xe')]);var _0x406774=new VoiceDialReport(this[_0x7734('0xe')]);var _0x14f961=new VoiceCallReport(this[_0x7734('0xe')]);var _0x3290f7=new UserReport(this[_0x7734('0xe')]);if(config[_0x7734('0x13')]&&config[_0x7734('0x13')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x7734('0x14')]['bind'](this));ami['on'](_0x7734('0x15'),this[_0x7734('0x16')][_0x7734('0x17')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x7734('0x17')](this));ami['on'](_0x7734('0x18'),this[_0x7734('0x19')][_0x7734('0x17')](this));ami['on'](_0x7734('0x1a'),this[_0x7734('0x1b')][_0x7734('0x17')](this));ami['on']('attendedtransfer',this[_0x7734('0x1c')]['bind'](this));}};Report['prototype']['findAgent']=function(_0x23559a){var _0x547979;_0x547979=_[_0x7734('0x1d')](this[_0x7734('0xf')],function(_0x542597){return _0x542597[_0x7734('0x1e')]==_0x23559a||_0x542597['name']==_0x23559a;});if(_[_0x7734('0x1f')](_0x547979)){var _0x4ab756=_[_0x7734('0x1d')](this[_0x7734('0x10')],function(_0x956b73){return _0x956b73['accountcode']==_0x23559a||_0x956b73['name']==_0x23559a;});if(_0x4ab756){_0x547979=_[_0x7734('0x1d')](this[_0x7734('0xf')],function(_0x1b1b8c){return _0x1b1b8c[_0x7734('0x20')]==util[_0x7734('0x21')](_0x7734('0x22'),_0x4ab756[_0x7734('0x23')]);});}}return _0x547979;};Report[_0x7734('0x11')]['voiceQueueReport']=function(_0x337819){for(var _0x3035b9=0x0;_0x3035b9<_0x337819[_0x7734('0x24')];_0x3035b9+=0x1){var _0x569394=this[_0x7734('0x25')](_0x337819[_0x3035b9]['connectedlinenum']);if(_0x569394){_0x337819[_0x3035b9][_0x7734('0x1e')]=_0x569394[_0x7734('0x1e')];_0x337819[_0x3035b9][_0x7734('0x26')]=!![];_0x337819[_0x3035b9][_0x7734('0x27')]=_0x569394['name'];_0x337819[_0x3035b9][_0x7734('0x20')]=_[_0x7734('0x1f')](_0x569394[_0x7734('0x20')])?util['format']('SIP/%s',_0x569394[_0x7734('0x23')]):_0x569394['interface'];if(_0x337819[_0x3035b9][_0x7734('0x28')]){_0x337819[_0x3035b9][_0x7734('0x29')]=moment()[_0x7734('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x337819[_0x3035b9][_0x7734('0x2a')]){_0x337819[_0x3035b9][_0x7734('0x2b')]=moment()[_0x7734('0x21')](_0x7734('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x337819[_0x3035b9]);}RpcVoiceQueueReport[_0x7734('0x2d')](_0x337819[_0x3035b9]);}};function extractCalleridNumber(_0x604d85){var _0x3dfa66=_0x604d85[_0x7734('0x2e')](/<(.*?)>/);return _0x3dfa66?_0x3dfa66[0x1]:_0x604d85;}Report[_0x7734('0x11')][_0x7734('0x2f')]=function(_0x49c451){for(var _0x1a2be7=0x0;_0x1a2be70x0?_0x97b15c:0x0;this[_0x4fc6('0xf')][_0x7da92f['queue']]['talking']=this['voiceQueues'][_0x7da92f['queue']][_0x4fc6('0x2b')]>_[_0x4fc6('0x6d')](_0x7da92f['loggedin'])?_[_0x4fc6('0x6d')](_0x7da92f[_0x4fc6('0x6e')]):this['voiceQueues'][_0x7da92f[_0x4fc6('0x69')]][_0x4fc6('0x2b')];this[_0x4fc6('0x4b')](this['voiceQueues'][_0x7da92f[_0x4fc6('0x69')]],_0x4fc6('0x13'));}logger['debug'](_0x4fc6('0x6f'),util['inspect'](this[_0x4fc6('0xf')][_0x7da92f[_0x4fc6('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4fc6('0x70'),this[_0x4fc6('0xf')][_0x7da92f['queue']]);}}}catch(_0x3acf9c){logger[_0x4fc6('0x37')](_0x4fc6('0x68'),util[_0x4fc6('0x39')](_0x3acf9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4fc6('0xa')][_0x4fc6('0x71')]=function(_0x252bbd){logger[_0x4fc6('0x41')](_0x4fc6('0x72'),util[_0x4fc6('0x39')](_0x252bbd,{'showHidden':![],'depth':null}));ami[_0x4fc6('0x3f')](_0x4fc6('0x73'),{});this[_0x4fc6('0x10')]=!![];};VoiceQueueReport[_0x4fc6('0xa')]['syncQueueCallerJoin']=function(_0x570560){try{if(this[_0x4fc6('0x61')](_0x570560)){logger[_0x4fc6('0x41')](_0x4fc6('0x74'),_0x570560['uniqueid'],util[_0x4fc6('0x39')](_0x570560,{'showHidden':![],'depth':null}));if(_[_0x4fc6('0x62')](this[_0x4fc6('0xc')][_0x570560[_0x4fc6('0x44')]]))this[_0x4fc6('0xc')][_0x570560[_0x4fc6('0x44')]]=[];if(_[_0x4fc6('0x62')](this[_0x4fc6('0xe')][_0x570560[_0x4fc6('0x44')]]))this[_0x4fc6('0xe')][_0x570560[_0x4fc6('0x44')]]={};var _0x896c94=new QueueReport();_0x896c94[_0x4fc6('0x4e')]=_0x570560[_0x4fc6('0x69')];_0x896c94[_0x4fc6('0x4c')]=this[_0x4fc6('0xf')][_0x896c94[_0x4fc6('0x4e')]]&&this['voiceQueues'][_0x896c94['name']][_0x4fc6('0x4c')]?this['voiceQueues'][_0x896c94[_0x4fc6('0x4e')]][_0x4fc6('0x4c')]||'inbound':'inbound';_0x896c94['queue']=_0x570560[_0x4fc6('0x69')];_0x896c94[_0x4fc6('0x75')]=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));_0x896c94[_0x4fc6('0x77')]=_0x570560[_0x4fc6('0x77')];_0x896c94[_0x4fc6('0x78')]=_0x570560[_0x4fc6('0x78')];_0x896c94[_0x4fc6('0x44')]=_0x570560[_0x4fc6('0x44')];_0x896c94[_0x4fc6('0x79')]=this['channels'][_0x570560[_0x4fc6('0x44')]][_0x4fc6('0x79')];logger['info'](_0x4fc6('0x7a'),_0x896c94['name'],_0x896c94[_0x4fc6('0x4c')]);_[_0x4fc6('0x7b')](_0x896c94,_[_0x4fc6('0x7c')](_0x570560,_[_0x4fc6('0x7d')](_0x896c94)));this[_0x4fc6('0xc')][_0x570560[_0x4fc6('0x44')]][_0x4fc6('0x7e')](_0x896c94);this['channels'][_0x570560[_0x4fc6('0x44')]]=_0x896c94;this[_0x4fc6('0x40')](_0x896c94,'queuecallerjoin');}}catch(_0x29f08f){logger[_0x4fc6('0x37')](_0x4fc6('0x74'),_0x570560[_0x4fc6('0x44')],util[_0x4fc6('0x39')](_0x29f08f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x12068b){try{if(this[_0x4fc6('0x61')](_0x12068b)){logger[_0x4fc6('0x41')](_0x4fc6('0x7f'),_0x12068b[_0x4fc6('0x44')],util[_0x4fc6('0x39')](_0x12068b,{'showHidden':![],'depth':null}));if(this[_0x4fc6('0xc')][_0x12068b[_0x4fc6('0x44')]]){var _0x4988c4=_[_0x4fc6('0x80')](this['queueReports'][_0x12068b['uniqueid']]);_0x4988c4[_0x4fc6('0x81')]=![];_0x4988c4[_0x4fc6('0x82')]=null;_0x4988c4[_0x4fc6('0x83')]=_0x12068b[_0x4fc6('0x83')];_0x4988c4[_0x4fc6('0x84')]=_0x12068b[_0x4fc6('0x84')];_0x4988c4[_0x4fc6('0x18')]=!![];_0x4988c4[_0x4fc6('0x85')]=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));_0x4988c4['queuecallerexitreason']=_0x4fc6('0x86');_0x4988c4[_0x4fc6('0x87')]=null;logger[_0x4fc6('0x6a')](_0x4fc6('0x88'),_0x4988c4[_0x4fc6('0x4e')],_0x4988c4[_0x4fc6('0x4c')]);this[_0x4fc6('0xe')][_0x12068b['uniqueid']]=_0x4988c4;this[_0x4fc6('0x3d')](_0x4988c4,'queuecallerabandon');}}}catch(_0x7797ed){logger[_0x4fc6('0x37')]('[%s][voiceQueueReport][queuecallerabandon]',_0x12068b[_0x4fc6('0x44')],util[_0x4fc6('0x39')](_0x7797ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4fc6('0xa')][_0x4fc6('0x1b')]=function(_0x56d655){try{if(this[_0x4fc6('0x61')](_0x56d655)){logger[_0x4fc6('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x56d655['uniqueid'],util['inspect'](_0x56d655,{'showHidden':![],'depth':null}));if(this[_0x4fc6('0xc')][_0x56d655[_0x4fc6('0x44')]]){var _0xbc465e=_['last'](this[_0x4fc6('0xc')][_0x56d655['uniqueid']]);_0xbc465e['queuecallerleaveAt']=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));_0xbc465e[_0x4fc6('0x89')]=_0x56d655[_0x4fc6('0x89')];_0xbc465e[_0x4fc6('0x8a')]=_0x56d655[_0x4fc6('0x8a')];logger[_0x4fc6('0x6a')](_0x4fc6('0x8b'),_0xbc465e[_0x4fc6('0x4e')],_0xbc465e[_0x4fc6('0x4c')],_0x56d655['connectedlinenum'],_0x56d655[_0x4fc6('0x8a')]);this['channels'][_0x56d655[_0x4fc6('0x44')]]=_0xbc465e;this['emitVoiceQueueChannelSave'](_0xbc465e,'queuecallerleave');}}}catch(_0x11adde){logger['error'](_0x4fc6('0x8c'),_0x56d655[_0x4fc6('0x44')],util['inspect'](_0x11adde,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4fc6('0xa')][_0x4fc6('0x1e')]=function(_0x3cf62a){try{if(this[_0x4fc6('0x61')](_0x3cf62a)){logger[_0x4fc6('0x41')](_0x4fc6('0x8d'),_0x3cf62a['uniqueid'],util[_0x4fc6('0x39')](_0x3cf62a,{'showHidden':![],'depth':null}));if(this[_0x4fc6('0xc')][_0x3cf62a[_0x4fc6('0x44')]]){var _0x4d9185=_[_0x4fc6('0x80')](this['queueReports'][_0x3cf62a[_0x4fc6('0x44')]]);_0x4d9185[_0x4fc6('0x81')]=!![];_0x4d9185['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x4fc6('0x6a')](_0x4fc6('0x8e'),_0x4d9185[_0x4fc6('0x4e')],_0x4d9185[_0x4fc6('0x4c')]);}}}catch(_0x32ca4b){logger[_0x4fc6('0x37')](_0x4fc6('0x8d'),_0x3cf62a[_0x4fc6('0x44')],util['inspect'](_0x32ca4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4fc6('0xa')][_0x4fc6('0x1c')]=function(_0x58dadd){try{if(this[_0x4fc6('0x61')](_0x58dadd)){logger[_0x4fc6('0x41')](_0x4fc6('0x8f'),_0x58dadd[_0x4fc6('0x44')],util[_0x4fc6('0x39')](_0x58dadd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x58dadd[_0x4fc6('0x44')]]){var _0x5667f8=_[_0x4fc6('0x80')](this[_0x4fc6('0xc')][_0x58dadd[_0x4fc6('0x44')]]);_0x5667f8[_0x4fc6('0x18')]=![];_0x5667f8[_0x4fc6('0x85')]=null;_0x5667f8[_0x4fc6('0x90')]=!![];_0x5667f8[_0x4fc6('0x87')]=_0x58dadd[_0x4fc6('0x91')];_0x5667f8['holdtime']=_0x58dadd['holdtime'];_0x5667f8[_0x4fc6('0x81')]=!![];_0x5667f8[_0x4fc6('0x92')]=![];_0x5667f8[_0x4fc6('0x93')]=null;if(!_0x5667f8[_0x4fc6('0x94')]){if(_0x58dadd['reason']==_0x4fc6('0x94')){_0x5667f8[_0x4fc6('0x48')]='COMPLETED';logger[_0x4fc6('0x6a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5667f8[_0x4fc6('0x4e')],_0x5667f8[_0x4fc6('0x4c')]);}else{if(_[_0x4fc6('0x95')](_0x58dadd['channel'][_0x4fc6('0x96')](),_0x4fc6('0x97'))){if(this[_0x4fc6('0xc')][_0x58dadd[_0x4fc6('0x98')]]){var _0x3a3edf=_[_0x4fc6('0x80')](this[_0x4fc6('0xc')][_0x58dadd[_0x4fc6('0x98')]]);_0x3a3edf[_0x4fc6('0x81')]=![];_0x3a3edf['queuecallerexit']=!![];_0x3a3edf[_0x4fc6('0x93')]=moment(_0x5667f8['queuecallerjoinAt'])[_0x4fc6('0x99')](_0x58dadd[_0x4fc6('0x83')],_0x4fc6('0x9a'))[_0x4fc6('0x45')](_0x4fc6('0x76'));_0x3a3edf[_0x4fc6('0x48')]='FORWARDTRANSFER';_0x3a3edf[_0x4fc6('0x94')]=!![];_0x3a3edf[_0x4fc6('0x9b')]=_0x4fc6('0x9c');_0x3a3edf[_0x4fc6('0x9d')]=_0x58dadd[_0x4fc6('0x9e')];_0x3a3edf[_0x4fc6('0x9f')]=_0x58dadd[_0x4fc6('0x44')];logger[_0x4fc6('0x6a')](_0x4fc6('0xa0'),_0x3a3edf[_0x4fc6('0x4e')],_0x3a3edf[_0x4fc6('0x4c')]);var _0x7b8e=this[_0x4fc6('0xc')][_0x58dadd['linkedid']];this[_0x4fc6('0xc')][_0x58dadd['linkedid']]=this['queueReports'][_0x58dadd[_0x4fc6('0x44')]];this[_0x4fc6('0xc')][_0x58dadd[_0x4fc6('0x44')]]=_0x7b8e;}}else{_0x5667f8[_0x4fc6('0x48')]='COMPLETEDBY'+_0x58dadd['reason']['toUpperCase']();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5667f8[_0x4fc6('0x4e')],_0x5667f8[_0x4fc6('0x4c')],_0x5667f8[_0x4fc6('0x48')]);}}}this[_0x4fc6('0xe')][_0x58dadd[_0x4fc6('0x44')]]=_0x5667f8;this[_0x4fc6('0x3d')](_0x5667f8,'agentcomplete');}}}catch(_0x45c9e6){logger[_0x4fc6('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x58dadd[_0x4fc6('0x44')],util['inspect'](_0x45c9e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4fc6('0xa')]['syncVarSet']=function(_0x150ee3){try{if(this[_0x4fc6('0x61')](_0x150ee3)){logger[_0x4fc6('0x41')](_0x4fc6('0xa1'),_0x150ee3[_0x4fc6('0x44')],util[_0x4fc6('0x39')](_0x150ee3,{'showHidden':![],'depth':null}));this[_0x4fc6('0xa2')](_0x150ee3[_0x4fc6('0x44')],_[_0x4fc6('0x7d')](_0x150ee3[_0x4fc6('0xa3')])[0x0],_0x150ee3['value']);if(this[_0x4fc6('0xc')][_0x150ee3[_0x4fc6('0x44')]]){var _0x2209e3=_[_0x4fc6('0x80')](this[_0x4fc6('0xc')][_0x150ee3[_0x4fc6('0x44')]]);if(_0x2209e3){if(this[_0x4fc6('0x61')](_0x150ee3[_0x4fc6('0xa3')])&&this[_0x4fc6('0x61')](_0x150ee3[_0x4fc6('0xa3')]['queuestatus'])){switch(_0x150ee3['value']){case _0x4fc6('0xa4'):_0x2209e3[_0x4fc6('0x92')]=![];_0x2209e3[_0x4fc6('0x93')]=null;break;case _0x4fc6('0xa5'):_0x2209e3[_0x4fc6('0xa6')]='timeout';_0x2209e3[_0x4fc6('0x92')]=!![];_0x2209e3[_0x4fc6('0x93')]=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));_0x2209e3['queuecallerleaveAt']=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));logger[_0x4fc6('0x41')](_0x4fc6('0xa7'),_0x150ee3['uniqueid'],util[_0x4fc6('0x39')](_0x2209e3,{'showHidden':![],'depth':null}));ami[_0x4fc6('0x3f')](_0x4fc6('0xa8'),_0x2209e3);break;default:_0x2209e3[_0x4fc6('0x92')]=!![];_0x2209e3[_0x4fc6('0x93')]=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));_0x2209e3['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2209e3[_0x4fc6('0x18')]=![];_0x2209e3[_0x4fc6('0x85')]=null;_0x2209e3[_0x4fc6('0x48')]=_0x150ee3[_0x4fc6('0xa9')];this[_0x4fc6('0xe')][_0x150ee3[_0x4fc6('0x44')]]=_0x2209e3;this['emitVoiceQueueChannelRemove'](_0x2209e3,_0x4fc6('0x1f'));}else if(this[_0x4fc6('0x61')](_0x150ee3['variable'])&&this[_0x4fc6('0x61')](_0x150ee3['variable']['queueposition'])){if(!_0x2209e3[_0x4fc6('0x18')]){_0x2209e3[_0x4fc6('0x92')]=!![];_0x2209e3[_0x4fc6('0x93')]=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));_0x2209e3['queuecallerexitreason']='EXITWITHKEY';_0x2209e3[_0x4fc6('0xaa')]=moment()[_0x4fc6('0x45')](_0x4fc6('0x76'));this['channels'][_0x150ee3[_0x4fc6('0x44')]]=_0x2209e3;}}logger['info'](_0x4fc6('0xab'),_0x150ee3[_0x4fc6('0x44')],_0x2209e3[_0x4fc6('0x4e')],_0x2209e3[_0x4fc6('0x4c')],_[_0x4fc6('0x7d')](_0x150ee3[_0x4fc6('0xa3')])[0x0],_0x150ee3[_0x4fc6('0xa9')]);_0x2209e3[_0x4fc6('0x12')]=this[_0x4fc6('0x12')][_0x150ee3['uniqueid']];}}}}catch(_0x23421b){logger[_0x4fc6('0x37')](_0x4fc6('0xa1'),_0x150ee3['uniqueid'],util[_0x4fc6('0x39')](_0x23421b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4fc6('0xa')][_0x4fc6('0xa2')]=function(_0x3986c5,_0x4f2329,_0x59b182){var _0x5a09c2=['rtpaudioqos',_0x4fc6('0xac'),_0x4fc6('0xad'),_0x4fc6('0xae'),_0x4fc6('0xaf'),_0x4fc6('0xb0'),_0x4fc6('0xb1'),'rtpaudioqosrttbridged',_0x4fc6('0xb2'),_0x4fc6('0xb3'),_0x4fc6('0xb4'),_0x4fc6('0xb5'),_0x4fc6('0xb6'),_0x4fc6('0xb7'),_0x4fc6('0xb8'),_0x4fc6('0xb9'),_0x4fc6('0x91'),_0x4fc6('0xba'),'memberrealtime'];if(!_[_0x4fc6('0x32')](_0x4f2329)&&!_[_0x4fc6('0xbb')](_0x5a09c2,_0x4f2329)){if(_[_0x4fc6('0x62')](this[_0x4fc6('0x12')][_0x3986c5])){this[_0x4fc6('0x12')][_0x3986c5]={};}this[_0x4fc6('0x12')][_0x3986c5][_0x4f2329]=_0x59b182;}};VoiceQueueReport[_0x4fc6('0xa')][_0x4fc6('0xbc')]=function(_0x129087,_0x10b8b4,_0x218ce0){var _0x103489={};for(var _0x122358=0x0;_0x1223580x0?_0x535fd6:0x0;this['voiceQueues'][_0x2a25c3[_0x6a04('0x6c')]][_0x6a04('0x5d')]=this['voiceQueues'][_0x2a25c3[_0x6a04('0x6c')]]['talking']>_['toNumber'](_0x2a25c3[_0x6a04('0x74')])?_[_0x6a04('0x72')](_0x2a25c3[_0x6a04('0x74')]):this[_0x6a04('0x12')][_0x2a25c3[_0x6a04('0x6c')]][_0x6a04('0x5d')];this[_0x6a04('0x75')](this[_0x6a04('0x12')][_0x2a25c3['queue']],_0x6a04('0x16'));}logger[_0x6a04('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x6a04('0x40')](this[_0x6a04('0x12')][_0x2a25c3[_0x6a04('0x6c')]],{'showHidden':![],'depth':null}));ami[_0x6a04('0x47')](_0x6a04('0x76'),this[_0x6a04('0x12')][_0x2a25c3[_0x6a04('0x6c')]]);}}}catch(_0x43e8b2){logger[_0x6a04('0x3e')]('[voiceQueueReport][queuesummary]',util[_0x6a04('0x40')](_0x43e8b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a04('0x35')][_0x6a04('0x1a')]=function(_0x3aa7f1){logger[_0x6a04('0x49')](_0x6a04('0x77'),util[_0x6a04('0x40')](_0x3aa7f1,{'showHidden':![],'depth':null}));ami[_0x6a04('0x47')](_0x6a04('0x78'),{});this[_0x6a04('0x13')]=!![];};VoiceQueueReport['prototype'][_0x6a04('0x79')]=function(_0x4df2da){try{if(this[_0x6a04('0x66')](_0x4df2da)){logger[_0x6a04('0x49')](_0x6a04('0x7a'),_0x4df2da[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x4df2da,{'showHidden':![],'depth':null}));if(_[_0x6a04('0x67')](this[_0x6a04('0x41')][_0x4df2da[_0x6a04('0x4a')]]))this[_0x6a04('0x41')][_0x4df2da[_0x6a04('0x4a')]]=[];if(_[_0x6a04('0x67')](this[_0x6a04('0x10')][_0x4df2da[_0x6a04('0x4a')]]))this['channels'][_0x4df2da['uniqueid']]={};var _0x479551=new QueueReport();_0x479551[_0x6a04('0x4d')]=_0x4df2da[_0x6a04('0x6c')];_0x479551['type']=this[_0x6a04('0x12')][_0x479551[_0x6a04('0x4d')]]&&this['voiceQueues'][_0x479551[_0x6a04('0x4d')]][_0x6a04('0x57')]?this['voiceQueues'][_0x479551['name']][_0x6a04('0x57')]||_0x6a04('0x58'):'inbound';_0x479551['queue']=_0x4df2da[_0x6a04('0x6c')];_0x479551[_0x6a04('0x7b')]=moment()[_0x6a04('0x4b')](_0x6a04('0x7c'));_0x479551['position']=_0x4df2da[_0x6a04('0x7d')];_0x479551[_0x6a04('0x7e')]=_0x4df2da[_0x6a04('0x7e')];_0x479551['uniqueid']=_0x4df2da['uniqueid'];_0x479551[_0x6a04('0x7f')]=this[_0x6a04('0x10')][_0x4df2da[_0x6a04('0x4a')]][_0x6a04('0x7f')];logger[_0x6a04('0x6e')](_0x6a04('0x80'),_0x479551[_0x6a04('0x4d')],_0x479551[_0x6a04('0x57')]);_[_0x6a04('0x81')](_0x479551,_[_0x6a04('0x82')](_0x4df2da,_[_0x6a04('0x83')](_0x479551)));this[_0x6a04('0x41')][_0x4df2da[_0x6a04('0x4a')]][_0x6a04('0x84')](_0x479551);this[_0x6a04('0x10')][_0x4df2da[_0x6a04('0x4a')]]=_0x479551;this['emitVoiceQueueChannelSave'](_0x479551,'queuecallerjoin');}}catch(_0x18f0cb){logger[_0x6a04('0x3e')](_0x6a04('0x7a'),_0x4df2da[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x18f0cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a04('0x35')]['syncQueueCallerAbandon']=function(_0x10b0b1){try{if(this[_0x6a04('0x66')](_0x10b0b1)){logger[_0x6a04('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x10b0b1[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x10b0b1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x10b0b1[_0x6a04('0x4a')]]){var _0x50639c=_[_0x6a04('0x85')](this['queueReports'][_0x10b0b1[_0x6a04('0x4a')]]);_0x50639c[_0x6a04('0x86')]=![];_0x50639c[_0x6a04('0x87')]=null;_0x50639c['holdtime']=_0x10b0b1[_0x6a04('0x88')];_0x50639c['originalposition']=_0x10b0b1[_0x6a04('0x89')];_0x50639c[_0x6a04('0x1c')]=!![];_0x50639c[_0x6a04('0x8a')]=moment()[_0x6a04('0x4b')](_0x6a04('0x7c'));_0x50639c[_0x6a04('0x53')]=_0x6a04('0x8b');_0x50639c[_0x6a04('0x8c')]=null;logger['info'](_0x6a04('0x8d'),_0x50639c['name'],_0x50639c['type']);this['channels'][_0x10b0b1[_0x6a04('0x4a')]]=_0x50639c;this[_0x6a04('0x50')](_0x50639c,_0x6a04('0x1c'));}}}catch(_0x231764){logger[_0x6a04('0x3e')](_0x6a04('0x8e'),_0x10b0b1['uniqueid'],util[_0x6a04('0x40')](_0x231764,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a04('0x8f')]=function(_0x3dae35){try{if(this['isNotNull'](_0x3dae35)){logger[_0x6a04('0x49')]('[%s][voiceQueueReport][queuecallerleave]',_0x3dae35[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x3dae35,{'showHidden':![],'depth':null}));if(this[_0x6a04('0x41')][_0x3dae35[_0x6a04('0x4a')]]){var _0x440c80=_[_0x6a04('0x85')](this[_0x6a04('0x41')][_0x3dae35['uniqueid']]);_0x440c80['queuecallerleaveAt']=moment()[_0x6a04('0x4b')](_0x6a04('0x7c'));_0x440c80['connectedlinenum']=_0x3dae35['connectedlinenum'];_0x440c80[_0x6a04('0x90')]=_0x3dae35[_0x6a04('0x90')];logger[_0x6a04('0x6e')](_0x6a04('0x91'),_0x440c80[_0x6a04('0x4d')],_0x440c80[_0x6a04('0x57')],_0x3dae35[_0x6a04('0x92')],_0x3dae35['connectedlinename']);this[_0x6a04('0x10')][_0x3dae35[_0x6a04('0x4a')]]=_0x440c80;this[_0x6a04('0x48')](_0x440c80,'queuecallerleave');}}}catch(_0x1b83bb){logger[_0x6a04('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x3dae35[_0x6a04('0x4a')],util['inspect'](_0x1b83bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a04('0x35')][_0x6a04('0x22')]=function(_0x5c89d8){try{if(this[_0x6a04('0x66')](_0x5c89d8)){logger[_0x6a04('0x49')](_0x6a04('0x93'),_0x5c89d8[_0x6a04('0x4a')],util['inspect'](_0x5c89d8,{'showHidden':![],'depth':null}));if(this[_0x6a04('0x41')][_0x5c89d8[_0x6a04('0x4a')]]){var _0x365a79=_[_0x6a04('0x85')](this[_0x6a04('0x41')][_0x5c89d8[_0x6a04('0x4a')]]);_0x365a79[_0x6a04('0x86')]=!![];_0x365a79[_0x6a04('0x53')]=_0x6a04('0x94');logger[_0x6a04('0x6e')](_0x6a04('0x95'),_0x365a79[_0x6a04('0x4d')],_0x365a79[_0x6a04('0x57')]);}}}catch(_0x386c98){logger['error'](_0x6a04('0x93'),_0x5c89d8['uniqueid'],util[_0x6a04('0x40')](_0x386c98,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a04('0x35')][_0x6a04('0x20')]=function(_0x330ab5){try{if(this[_0x6a04('0x66')](_0x330ab5)){logger['debug'](_0x6a04('0x96'),_0x330ab5['uniqueid'],util[_0x6a04('0x40')](_0x330ab5,{'showHidden':![],'depth':null}));if(this[_0x6a04('0x41')][_0x330ab5[_0x6a04('0x4a')]]){var _0x4a59e2=_[_0x6a04('0x85')](this['queueReports'][_0x330ab5['uniqueid']]);_0x4a59e2[_0x6a04('0x1c')]=![];_0x4a59e2[_0x6a04('0x8a')]=null;_0x4a59e2[_0x6a04('0x97')]=!![];_0x4a59e2[_0x6a04('0x8c')]=_0x330ab5['membername'];_0x4a59e2['holdtime']=_0x330ab5[_0x6a04('0x88')];_0x4a59e2[_0x6a04('0x86')]=!![];_0x4a59e2[_0x6a04('0x98')]=![];_0x4a59e2[_0x6a04('0x99')]=null;if(!_0x4a59e2[_0x6a04('0x9a')]){if(_0x330ab5[_0x6a04('0x9b')]==_0x6a04('0x9a')){_0x4a59e2[_0x6a04('0x53')]='COMPLETED';logger[_0x6a04('0x6e')](_0x6a04('0x9c'),_0x4a59e2[_0x6a04('0x4d')],_0x4a59e2[_0x6a04('0x57')]);}else{if(_['startsWith'](_0x330ab5[_0x6a04('0x9d')][_0x6a04('0x9e')](),_0x6a04('0x9f'))){if(this[_0x6a04('0x41')][_0x330ab5['linkedid']]){var _0x2a751d=_[_0x6a04('0x85')](this['queueReports'][_0x330ab5['linkedid']]);_0x2a751d[_0x6a04('0x86')]=![];_0x2a751d[_0x6a04('0x98')]=!![];_0x2a751d[_0x6a04('0x99')]=moment(_0x4a59e2[_0x6a04('0x7b')])[_0x6a04('0xa0')](_0x330ab5[_0x6a04('0x88')],_0x6a04('0xa1'))[_0x6a04('0x4b')](_0x6a04('0x7c'));_0x2a751d[_0x6a04('0x53')]=_0x6a04('0xa2');_0x2a751d[_0x6a04('0x9a')]=!![];_0x2a751d[_0x6a04('0xa3')]='FORWARD';_0x2a751d[_0x6a04('0xa4')]=_0x330ab5['destexten'];_0x2a751d['transferuniqueid']=_0x330ab5[_0x6a04('0x4a')];logger['info'](_0x6a04('0xa5'),_0x2a751d[_0x6a04('0x4d')],_0x2a751d[_0x6a04('0x57')]);var _0x411dff=this[_0x6a04('0x41')][_0x330ab5[_0x6a04('0xa6')]];this['queueReports'][_0x330ab5[_0x6a04('0xa6')]]=this[_0x6a04('0x41')][_0x330ab5[_0x6a04('0x4a')]];this[_0x6a04('0x41')][_0x330ab5[_0x6a04('0x4a')]]=_0x411dff;}}else{_0x4a59e2[_0x6a04('0x53')]='COMPLETEDBY'+_0x330ab5['reason'][_0x6a04('0xa7')]();logger[_0x6a04('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4a59e2[_0x6a04('0x4d')],_0x4a59e2[_0x6a04('0x57')],_0x4a59e2[_0x6a04('0x53')]);}}}this[_0x6a04('0x10')][_0x330ab5[_0x6a04('0x4a')]]=_0x4a59e2;this[_0x6a04('0x50')](_0x4a59e2,'agentcomplete');}}}catch(_0x5a7aa6){logger['error'](_0x6a04('0x96'),_0x330ab5[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x5a7aa6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a04('0x35')][_0x6a04('0x24')]=function(_0x3a3f6c){try{if(this['isNotNull'](_0x3a3f6c)){logger[_0x6a04('0x49')](_0x6a04('0xa8'),_0x3a3f6c[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x3a3f6c,{'showHidden':![],'depth':null}));this[_0x6a04('0xa9')](_0x3a3f6c['uniqueid'],_[_0x6a04('0x83')](_0x3a3f6c[_0x6a04('0xaa')])[0x0],_0x3a3f6c[_0x6a04('0xab')]);if(this['queueReports'][_0x3a3f6c['uniqueid']]){var _0x4ed74d=_['last'](this['queueReports'][_0x3a3f6c['uniqueid']]);if(_0x4ed74d){if(this[_0x6a04('0x66')](_0x3a3f6c[_0x6a04('0xaa')])&&this[_0x6a04('0x66')](_0x3a3f6c[_0x6a04('0xaa')][_0x6a04('0xac')])){switch(_0x3a3f6c[_0x6a04('0xab')]){case'CONTINUE':_0x4ed74d[_0x6a04('0x98')]=![];_0x4ed74d[_0x6a04('0x99')]=null;break;case _0x6a04('0xad'):_0x4ed74d[_0x6a04('0xae')]='timeout';_0x4ed74d['queuecallerexit']=!![];_0x4ed74d[_0x6a04('0x99')]=moment()[_0x6a04('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ed74d[_0x6a04('0xaf')]=moment()[_0x6a04('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6a04('0x49')](_0x6a04('0xb0'),_0x3a3f6c[_0x6a04('0x4a')],util['inspect'](_0x4ed74d,{'showHidden':![],'depth':null}));ami['emit'](_0x6a04('0xb1'),_0x4ed74d);break;default:_0x4ed74d[_0x6a04('0x98')]=!![];_0x4ed74d[_0x6a04('0x99')]=moment()['format'](_0x6a04('0x7c'));_0x4ed74d[_0x6a04('0xaf')]=moment()[_0x6a04('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ed74d[_0x6a04('0x1c')]=![];_0x4ed74d[_0x6a04('0x8a')]=null;_0x4ed74d[_0x6a04('0x53')]=_0x3a3f6c['value'];this[_0x6a04('0x10')][_0x3a3f6c[_0x6a04('0x4a')]]=_0x4ed74d;this[_0x6a04('0x50')](_0x4ed74d,_0x6a04('0x23'));}else if(this[_0x6a04('0x66')](_0x3a3f6c[_0x6a04('0xaa')])&&this[_0x6a04('0x66')](_0x3a3f6c[_0x6a04('0xaa')][_0x6a04('0xb2')])){if(!_0x4ed74d[_0x6a04('0x1c')]){_0x4ed74d['queuecallerexit']=!![];_0x4ed74d[_0x6a04('0x99')]=moment()['format'](_0x6a04('0x7c'));_0x4ed74d['queuecallerexitreason']=_0x6a04('0xb3');_0x4ed74d[_0x6a04('0xaf')]=moment()[_0x6a04('0x4b')](_0x6a04('0x7c'));this[_0x6a04('0x10')][_0x3a3f6c[_0x6a04('0x4a')]]=_0x4ed74d;}}logger[_0x6a04('0x6e')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3a3f6c[_0x6a04('0x4a')],_0x4ed74d[_0x6a04('0x4d')],_0x4ed74d[_0x6a04('0x57')],_[_0x6a04('0x83')](_0x3a3f6c[_0x6a04('0xaa')])[0x0],_0x3a3f6c[_0x6a04('0xab')]);_0x4ed74d[_0x6a04('0x15')]=this['variables'][_0x3a3f6c['uniqueid']];}}}}catch(_0x214c86){logger['error'](_0x6a04('0xa8'),_0x3a3f6c[_0x6a04('0x4a')],util[_0x6a04('0x40')](_0x214c86,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a04('0x35')][_0x6a04('0xa9')]=function(_0x4b2ca9,_0x398c4b,_0x5ecd33){var _0x15ac75=['rtpaudioqos',_0x6a04('0xb4'),_0x6a04('0xb5'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x6a04('0xb6'),_0x6a04('0xb7'),'rtpaudioqosrttbridged',_0x6a04('0xb8'),_0x6a04('0xb9'),'bridgepeer',_0x6a04('0xba'),_0x6a04('0xbb'),_0x6a04('0xbc'),_0x6a04('0xbd'),_0x6a04('0xbe'),_0x6a04('0xbf'),_0x6a04('0xc0'),_0x6a04('0xc1')];if(!_['isNil'](_0x398c4b)&&!_[_0x6a04('0xc2')](_0x15ac75,_0x398c4b)){if(_['isUndefined'](this[_0x6a04('0x15')][_0x4b2ca9])){this[_0x6a04('0x15')][_0x4b2ca9]={};}this[_0x6a04('0x15')][_0x4b2ca9][_0x398c4b]=_0x5ecd33;}};VoiceQueueReport[_0x6a04('0x35')][_0x6a04('0xc3')]=function(_0x48eeff,_0x795a3b,_0xdaede6){var _0x21f5b7={};for(var _0x39eb4f=0x0;_0x39eb4f=0x0?moment(_0x67e19e['endtime'])[_0x8fb3('0x17')](_0x67e19e[_0x8fb3('0x15')],_0x8fb3('0xd')):null,'data1':_0x8fb3('0x18'),'data2':_0x67e19e[_0x8fb3('0x11')],'data3':_0x67e19e['exten'],'data4':_0x67e19e[_0x8fb3('0x19')]||null,'role':_0x8fb3('0x10'),'internal':_0x67e19e[_0x8fb3('0x11')]?_['toNumber'](_0x67e19e['accountcode']):undefined,'uniqueid':_0x67e19e['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x6ff5=['queuecallercompleteAt','Request','CreateMemberReport','isNil','format','lastAssignedTo','interface','queuecallerleaveAt','diff','seconds','inbound','exten','agent','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','accountcode','dialstring','moment','lodash','util','../client','voiceQueueReport'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x6ff5,0x1ab));var _0x56ff=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6ff5[_0x5f0089];return _0x193892;};'use strict';var moment=require(_0x56ff('0x0'));var _=require(_0x56ff('0x1'));var util=require(_0x56ff('0x2'));var client=require(_0x56ff('0x3'));exports[_0x56ff('0x4')]=function(_0x2728df){var _0x488494=_0x2728df[_0x56ff('0x5')]||_0x2728df['queuecallerexitAt'];return client[_0x56ff('0x6')](_0x56ff('0x7'),{'body':{'channel':'voice','membername':_0x2728df['lastAssignedTo'],'interface':_[_0x56ff('0x8')](_0x2728df['interface'])?util[_0x56ff('0x9')]('SIP/%s',_0x2728df[_0x56ff('0xa')]):_0x2728df[_0x56ff('0xb')],'type':'TALKING','enterAt':_0x2728df[_0x56ff('0xc')],'exitAt':_0x488494,'duration':moment(_0x488494)[_0x56ff('0xd')](_0x2728df[_0x56ff('0xc')],_0x56ff('0xe')),'data1':_0x56ff('0xf'),'data2':_0x2728df['calleridnum'],'data3':_0x2728df[_0x56ff('0x10')],'data4':null,'data5':_0x2728df['queue'],'role':_0x56ff('0x11'),'internal':_0x2728df['accountcode']?_[_0x56ff('0x12')](_0x2728df['accountcode']):undefined,'uniqueid':_0x2728df[_0x56ff('0x13')]},'log':'CreateMemberReport'});};exports[_0x56ff('0x14')]=function(_0x32098c){return client[_0x56ff('0x6')](_0x56ff('0x7'),{'body':{'channel':'voice','membername':_0x32098c[_0x56ff('0x15')],'interface':_0x32098c[_0x56ff('0xb')],'type':'TALKING','enterAt':_0x32098c[_0x56ff('0x16')],'exitAt':_0x32098c['endtime'],'duration':moment(_0x32098c['endtime'])['diff'](_0x32098c[_0x56ff('0x16')],_0x56ff('0xe'))>=0x0?moment(_0x32098c[_0x56ff('0x17')])['diff'](_0x32098c[_0x56ff('0x16')],_0x56ff('0xe')):null,'data1':_0x56ff('0x18'),'data2':_0x32098c[_0x56ff('0x19')],'data3':_0x32098c[_0x56ff('0x10')],'data4':_0x32098c[_0x56ff('0x1a')]||null,'role':'agent','internal':_0x32098c[_0x56ff('0x19')]?_[_0x56ff('0x12')](_0x32098c[_0x56ff('0x19')]):undefined,'uniqueid':_0x32098c[_0x56ff('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index acfef8b..e782634 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 _0xbb59=['GetSettings','../client','getSettings','Request','previewRecallmeReminderInterval'];(function(_0x712130,_0x32ab7f){var _0x174ba6=function(_0x430946){while(--_0x430946){_0x712130['push'](_0x712130['shift']());}};_0x174ba6(++_0x32ab7f);}(_0xbb59,0xec));var _0x9bb5=function(_0x26af89,_0x2d2522){_0x26af89=_0x26af89-0x0;var _0x4c2838=_0xbb59[_0x26af89];return _0x4c2838;};'use strict';var client=require(_0x9bb5('0x0'));exports[_0x9bb5('0x1')]=function(){return client[_0x9bb5('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x9bb5('0x3')]},'log':_0x9bb5('0x4')});}; \ No newline at end of file +var _0xd456=['Request','stopRecordingOnTransfer','GetSettings','getSettings'];(function(_0x28013e,_0x5c7445){var _0x473a33=function(_0x2d12d2){while(--_0x2d12d2){_0x28013e['push'](_0x28013e['shift']());}};_0x473a33(++_0x5c7445);}(_0xd456,0x107));var _0x6d45=function(_0x3ddf9b,_0x589b9d){_0x3ddf9b=_0x3ddf9b-0x0;var _0x3fdd50=_0xd456[_0x3ddf9b];return _0x3fdd50;};'use strict';var client=require('../client');exports[_0x6d45('0x0')]=function(){return client[_0x6d45('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6d45('0x2'),'previewRecallmeReminderInterval']},'log':_0x6d45('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1c66977..12ee1d5 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 _0x19cb=['Request','name','getTemplates'];(function(_0x20eca8,_0x5cf63f){var _0x1dd774=function(_0x85e754){while(--_0x85e754){_0x20eca8['push'](_0x20eca8['shift']());}};_0x1dd774(++_0x5cf63f);}(_0x19cb,0x146));var _0xb19c=function(_0x4104ba,_0x245a2d){_0x4104ba=_0x4104ba-0x0;var _0xf2db59=_0x19cb[_0x4104ba];return _0xf2db59;};'use strict';var client=require('../client');exports[_0xb19c('0x0')]=function(_0x1d15d0){return function(_0x4a135c){return client[_0xb19c('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xb19c('0x2'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xf4e9=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x588a8c,_0x32918e){var _0x4c6b38=function(_0x4a49fe){while(--_0x4a49fe){_0x588a8c['push'](_0x588a8c['shift']());}};_0x4c6b38(++_0x32918e);}(_0xf4e9,0x174));var _0x9f4e=function(_0x1bf002,_0x564016){_0x1bf002=_0x1bf002-0x0;var _0x101820=_0xf4e9[_0x1bf002];return _0x101820;};'use strict';var client=require(_0x9f4e('0x0'));exports[_0x9f4e('0x1')]=function(_0x45ec69){return function(_0x2c8e32){return client[_0x9f4e('0x2')](_0x9f4e('0x3'),{'options':{'raw':!![],'attributes':['id',_0x9f4e('0x4'),_0x9f4e('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ab43b54..25b5967 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 _0xc954=['operator','value','Actions','action','data1','data2','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','field'];(function(_0x37ef76,_0x51c851){var _0x4d7799=function(_0x385e96){while(--_0x385e96){_0x37ef76['push'](_0x37ef76['shift']());}};_0x4d7799(++_0x51c851);}(_0xc954,0x1e5));var _0x4c95=function(_0x3634a4,_0x438bed){_0x3634a4=_0x3634a4-0x0;var _0x1c3dfd=_0xc954[_0x3634a4];return _0x1c3dfd;};'use strict';var client=require(_0x4c95('0x0'));exports[_0x4c95('0x1')]=function(_0x189af1){return function(_0xeb2529){return client[_0x4c95('0x2')](_0x4c95('0x3'),{'options':{'raw':![],'attributes':['id',_0x4c95('0x4'),_0x4c95('0x5'),'status'],'include':[{'model':_0x4c95('0x6'),'as':'AllConditions','attributes':['id',_0x4c95('0x7'),_0x4c95('0x8'),_0x4c95('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x4c95('0x7'),_0x4c95('0x8'),_0x4c95('0x9')]},{'model':'Action','as':_0x4c95('0xa'),'attributes':['id',_0x4c95('0xb'),_0x4c95('0xc'),_0x4c95('0xd'),'data3','data4',_0x4c95('0xe'),_0x4c95('0xf'),_0x4c95('0x10')]}]},'log':_0x4c95('0x3')});};}; \ No newline at end of file +var _0x7d8d=['Action','Actions','action','data3','data4','data5','data6','data7','GetTrigger','../client','Request','status','Condition','AllConditions','operator','value','field'];(function(_0x4207bb,_0x44f265){var _0xad6ff8=function(_0x3cfea2){while(--_0x3cfea2){_0x4207bb['push'](_0x4207bb['shift']());}};_0xad6ff8(++_0x44f265);}(_0x7d8d,0x17f));var _0xd7d8=function(_0x259fd6,_0x474f2f){_0x259fd6=_0x259fd6-0x0;var _0xabcd2b=_0x7d8d[_0x259fd6];return _0xabcd2b;};'use strict';var client=require(_0xd7d8('0x0'));exports['getTriggers']=function(_0x3968c8){return function(_0x4632d3){return client[_0xd7d8('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0xd7d8('0x2')],'include':[{'model':_0xd7d8('0x3'),'as':_0xd7d8('0x4'),'attributes':['id','field',_0xd7d8('0x5'),_0xd7d8('0x6')]},{'model':_0xd7d8('0x3'),'as':'AnyConditions','attributes':['id',_0xd7d8('0x7'),'operator',_0xd7d8('0x6')]},{'model':_0xd7d8('0x8'),'as':_0xd7d8('0x9'),'attributes':['id',_0xd7d8('0xa'),'data1','data2',_0xd7d8('0xb'),_0xd7d8('0xc'),_0xd7d8('0xd'),_0xd7d8('0xe'),_0xd7d8('0xf')]}]},'log':_0xd7d8('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7757582..8829cf1 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 _0x56d8=['name','registry','defaultuser','../client','Request','GetTrunk'];(function(_0x303baf,_0x3ac2e3){var _0x3c2f56=function(_0x19d940){while(--_0x19d940){_0x303baf['push'](_0x303baf['shift']());}};_0x3c2f56(++_0x3ac2e3);}(_0x56d8,0x1a1));var _0x856d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x56d8[_0x13b8f3];return _0x1a6d06;};'use strict';var client=require(_0x856d('0x0'));exports['getTrunks']=function(_0x5104cf){return function(_0x17b340){return client[_0x856d('0x1')](_0x856d('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x856d('0x3'),_0x856d('0x4'),_0x856d('0x5')]},'log':_0x856d('0x2')});};}; \ No newline at end of file +var _0xd3c6=['defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x445a2e,_0x2a568b){var _0x307908=function(_0x2ac0e5){while(--_0x2ac0e5){_0x445a2e['push'](_0x445a2e['shift']());}};_0x307908(++_0x2a568b);}(_0xd3c6,0x121));var _0x6d3c=function(_0x5e8853,_0x584390){_0x5e8853=_0x5e8853-0x0;var _0x4b497c=_0xd3c6[_0x5e8853];return _0x4b497c;};'use strict';var client=require(_0x6d3c('0x0'));exports[_0x6d3c('0x1')]=function(_0x282148){return function(_0x3ccaa2){return client[_0x6d3c('0x2')](_0x6d3c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6d3c('0x4'),'registry',_0x6d3c('0x5')]},'log':_0x6d3c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index af972b8..949de8a 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x5a8d09,_0x12c32e){var _0x3196de=function(_0x4b5134){while(--_0x4b5134){_0x5a8d09['push'](_0x5a8d09['shift']());}};_0x3196de(++_0x12c32e);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cc3ae2f..79dc024 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 _0xd85d=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x330913,_0x526adb){var _0x3698c6=function(_0x2fc7bd){while(--_0x2fc7bd){_0x330913['push'](_0x330913['shift']());}};_0x3698c6(++_0x526adb);}(_0xd85d,0x186));var _0xdd85=function(_0x1e0abd,_0x543219){_0x1e0abd=_0x1e0abd-0x0;var _0xb4d44=_0xd85d[_0x1e0abd];return _0xb4d44;};'use strict';var client=require(_0xdd85('0x0'));exports[_0xdd85('0x1')]=function(_0x153108){return client[_0xdd85('0x2')](_0xdd85('0x3'),{'body':_0x153108,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x1ac53c,_0x1a5e37,_0x4c805d){return client[_0xdd85('0x2')](_0xdd85('0x4'),{'body':_0x1ac53c,'options':{'where':{'uniqueid':_0x1a5e37,'interface':_0x4c805d,'agentcomplete':!![]}},'log':_0xdd85('0x4')});}; \ No newline at end of file +var _0x0280=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x35a823,_0x3b6dcb){var _0x31eb0c=function(_0x38acd6){while(--_0x38acd6){_0x35a823['push'](_0x35a823['shift']());}};_0x31eb0c(++_0x3b6dcb);}(_0x0280,0x181));var _0x0028=function(_0x1acc70,_0xddf964){_0x1acc70=_0x1acc70-0x0;var _0x110d2d=_0x0280[_0x1acc70];return _0x110d2d;};'use strict';var client=require(_0x0028('0x0'));exports[_0x0028('0x1')]=function(_0xa0fdbe){return client[_0x0028('0x2')](_0x0028('0x3'),{'body':_0xa0fdbe,'log':'CreateVoiceAgentReport'});};exports[_0x0028('0x4')]=function(_0x248254,_0x2bca0d,_0x3d4388){return client['Request'](_0x0028('0x5'),{'body':_0x248254,'options':{'where':{'uniqueid':_0x2bca0d,'interface':_0x3d4388,'agentcomplete':!![]}},'log':_0x0028('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 838e15b..8373c19 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 _0x66ca=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','Request','GetVoiceCallReport','day','format'];(function(_0x2afbff,_0x347121){var _0x2cfd90=function(_0x51fb11){while(--_0x51fb11){_0x2afbff['push'](_0x2afbff['shift']());}};_0x2cfd90(++_0x347121);}(_0x66ca,0xf6));var _0xa66c=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0x66ca[_0x1eb82d];return _0x2c9502;};'use strict';var moment=require(_0xa66c('0x0'));var util=require(_0xa66c('0x1'));var _=require(_0xa66c('0x2'));var client=require(_0xa66c('0x3'));exports[_0xa66c('0x4')]=function(_0x4abbcb){return client['Request'](_0xa66c('0x5'),{'body':_[_0xa66c('0x6')](_0x4abbcb,{'source':_0x4abbcb['calleridnum'],'destinationcontext':_0x4abbcb[_0xa66c('0x7')],'callerid':_0x4abbcb[_0xa66c('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xa66c('0x5')});};exports[_0xa66c('0x9')]=function(){return function(){return client[_0xa66c('0xa')](_0xa66c('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xa66c('0xc'))[_0xa66c('0xd')](_0xa66c('0xe')),moment()[_0xa66c('0xf')](_0xa66c('0xc'))[_0xa66c('0xd')](_0xa66c('0xe'))]}},'attributes':[_0xa66c('0x10'),'disposition',_0xa66c('0x11'),_0xa66c('0x12')]},'log':_0xa66c('0x13')});};}; \ No newline at end of file +var _0x0dd8=['billableseconds','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','type','disposition','duration'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x0dd8,0x18e));var _0x80dd=function(_0x1a10c1,_0x33a87f){_0x1a10c1=_0x1a10c1-0x0;var _0x3bc5b8=_0x0dd8[_0x1a10c1];return _0x3bc5b8;};'use strict';var moment=require(_0x80dd('0x0'));var util=require(_0x80dd('0x1'));var _=require(_0x80dd('0x2'));var client=require('../client');exports['create']=function(_0x5e7c7f){return client[_0x80dd('0x3')](_0x80dd('0x4'),{'body':_[_0x80dd('0x5')](_0x5e7c7f,{'source':_0x5e7c7f['calleridnum'],'destinationcontext':_0x5e7c7f[_0x80dd('0x6')],'callerid':_0x5e7c7f[_0x80dd('0x7')],'amaflags':_0x80dd('0x8')}),'log':_0x80dd('0x4')});};exports[_0x80dd('0x9')]=function(){return function(){return client['Request'](_0x80dd('0xa'),{'options':{'where':{'type':[_0x80dd('0xb')],'createdAt':{'$between':[moment()[_0x80dd('0xc')]('day')['format'](_0x80dd('0xd')),moment()[_0x80dd('0xe')](_0x80dd('0xf'))[_0x80dd('0x10')](_0x80dd('0xd'))]}},'attributes':[_0x80dd('0x11'),_0x80dd('0x12'),_0x80dd('0x13'),_0x80dd('0x14')]},'log':_0x80dd('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 014caaa..199bd84 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 _0x08db=['../client','create','CreateVoiceDialReport'];(function(_0x43c7dd,_0x4c381d){var _0x10ffba=function(_0x24a864){while(--_0x24a864){_0x43c7dd['push'](_0x43c7dd['shift']());}};_0x10ffba(++_0x4c381d);}(_0x08db,0xd8));var _0xb08d=function(_0x19e6bf,_0x54efe3){_0x19e6bf=_0x19e6bf-0x0;var _0x52530c=_0x08db[_0x19e6bf];return _0x52530c;};'use strict';var client=require(_0xb08d('0x0'));exports[_0xb08d('0x1')]=function(_0x26221a){return client['Request'](_0xb08d('0x2'),{'body':_0x26221a,'log':_0xb08d('0x2')});}; \ No newline at end of file +var _0xaafd=['Request','../client'];(function(_0x42bfc9,_0x92ccf5){var _0x645e2b=function(_0x5d7d7d){while(--_0x5d7d7d){_0x42bfc9['push'](_0x42bfc9['shift']());}};_0x645e2b(++_0x92ccf5);}(_0xaafd,0xeb));var _0xdaaf=function(_0x17a28b,_0x5d1465){_0x17a28b=_0x17a28b-0x0;var _0x9cbb5a=_0xaafd[_0x17a28b];return _0x9cbb5a;};'use strict';var client=require(_0xdaaf('0x0'));exports['create']=function(_0x43d5f1){return client[_0xdaaf('0x1')]('CreateVoiceDialReport',{'body':_0x43d5f1,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 8e4495c..1acd46d 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 _0x34ab=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x5da6ce,_0x1a8f83){var _0x280a89=function(_0x376e34){while(--_0x376e34){_0x5da6ce['push'](_0x5da6ce['shift']());}};_0x280a89(++_0x1a8f83);}(_0x34ab,0x169));var _0xb34a=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x34ab[_0x5a6961];return _0x4af0a6;};'use strict';var client=require(_0xb34a('0x0'));exports[_0xb34a('0x1')]=function(){return function(){return client[_0xb34a('0x2')](_0xb34a('0x3'),{'options':{'raw':!![],'attributes':['id',_0xb34a('0x4'),_0xb34a('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xb34a('0x1')});};}; \ No newline at end of file +var _0x2bc6=['Request','../client','getVoiceExtensions'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x2bc6,0x163));var _0x62bc=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0x2bc6[_0x2dfd0e];return _0x343af6;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(){return function(){return client[_0x62bc('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 434b44d..79b4d32 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 _0x80a6=['dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x80a6,0x10d));var _0x680a=function(_0x3c9a0e,_0x1a3679){_0x3c9a0e=_0x3c9a0e-0x0;var _0x193061=_0x80a6[_0x3c9a0e];return _0x193061;};'use strict';var client=require('../client');exports[_0x680a('0x0')]=function(){return function(){return client['Request'](_0x680a('0x1'),{'options':{'raw':![],'attributes':['id',_0x680a('0x2'),'acw',_0x680a('0x3'),'autopause',_0x680a('0x4'),_0x680a('0x5'),_0x680a('0x6'),'dialMethod',_0x680a('0x7'),_0x680a('0x8'),'dialPowerLevel',_0x680a('0x9'),'dialPredictiveOptimizationPercentage',_0x680a('0xa'),_0x680a('0xb'),'dialOriginateCallerIdNumber',_0x680a('0xc'),_0x680a('0xd'),_0x680a('0xe'),'dialQueueProject',_0x680a('0xf'),_0x680a('0x10'),_0x680a('0x11'),_0x680a('0x12'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x680a('0x13'),'dialTimezone',_0x680a('0x14'),_0x680a('0x15'),_0x680a('0x16'),_0x680a('0x17'),'dialAMDInitialSilence',_0x680a('0x18'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x680a('0x19'),_0x680a('0x1a'),_0x680a('0x1b'),_0x680a('0x1c'),_0x680a('0x1d'),_0x680a('0x1e'),_0x680a('0x1f'),_0x680a('0x20'),_0x680a('0x21'),_0x680a('0x22'),'dialQueueProject2',_0x680a('0x4'),_0x680a('0x23'),_0x680a('0x24'),_0x680a('0x25'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x680a('0x26'),'dialDropRetryFrequency',_0x680a('0x27'),_0x680a('0x28'),_0x680a('0x29'),_0x680a('0x2a'),'dialAgentRejectMaxRetry',_0x680a('0x2b'),_0x680a('0x2c'),_0x680a('0x2d'),_0x680a('0x2e'),_0x680a('0x2f'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':_0x680a('0x30'),'as':'Trunk','attributes':['id',_0x680a('0x2'),_0x680a('0x31'),_0x680a('0x32')]},{'model':_0x680a('0x33'),'as':_0x680a('0x34'),'attributes':['id',_0x680a('0x2')]},{'model':_0x680a('0x30'),'as':'TrunkBackup','attributes':['id',_0x680a('0x2'),_0x680a('0x31'),'active']},{'model':_0x680a('0x35'),'as':_0x680a('0x35'),'attributes':['id','name'],'include':[{'model':_0x680a('0x35'),'as':_0x680a('0x36'),'attributes':['id','name',_0x680a('0x37')]}]}]},'log':_0x680a('0x0')});};}; \ No newline at end of file +var _0x8c09=['dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','monitor_format','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient'];(function(_0x15b92a,_0x4b400d){var _0x1fdcfd=function(_0x650260){while(--_0x650260){_0x15b92a['push'](_0x15b92a['shift']());}};_0x1fdcfd(++_0x4b400d);}(_0x8c09,0x151));var _0x98c0=function(_0x5f0b26,_0x53434a){_0x5f0b26=_0x5f0b26-0x0;var _0x4f3866=_0x8c09[_0x5f0b26];return _0x4f3866;};'use strict';var client=require(_0x98c0('0x0'));exports[_0x98c0('0x1')]=function(){return function(){return client[_0x98c0('0x2')](_0x98c0('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x98c0('0x4'),'autopause',_0x98c0('0x5'),'type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel',_0x98c0('0x6'),_0x98c0('0x7'),'dialPredictiveInterval',_0x98c0('0x8'),_0x98c0('0x9'),_0x98c0('0xa'),_0x98c0('0xb'),'dialQueueTimeout',_0x98c0('0xc'),_0x98c0('0xd'),_0x98c0('0xe'),_0x98c0('0xf'),_0x98c0('0x10'),_0x98c0('0x11'),_0x98c0('0x12'),_0x98c0('0x13'),'dialTimezone',_0x98c0('0x14'),_0x98c0('0x15'),_0x98c0('0x16'),'dialAMDActive',_0x98c0('0x17'),_0x98c0('0x18'),_0x98c0('0x19'),_0x98c0('0x1a'),'dialAMDMinWordLength',_0x98c0('0x1b'),'dialAMDMaximumNumberOfWords',_0x98c0('0x1c'),'dialAMDMaximumWordLength',_0x98c0('0x1d'),_0x98c0('0x1e'),_0x98c0('0x1f'),_0x98c0('0x20'),'dialAgiAfterHangupAgent',_0x98c0('0x21'),_0x98c0('0x22'),_0x98c0('0x5'),_0x98c0('0x23'),'dialRandomLastDigitCallerIdNumber',_0x98c0('0x24'),'dialNoSuchNumberMaxRetry',_0x98c0('0x25'),'dialDropMaxRetry',_0x98c0('0x26'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x98c0('0x27'),_0x98c0('0x28'),'dialAgentRejectRetryFrequency',_0x98c0('0x29'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x98c0('0x2a'),_0x98c0('0x2b')],'include':[{'model':'Trunk','as':_0x98c0('0x2c'),'attributes':['id',_0x98c0('0x2d'),_0x98c0('0x2e'),_0x98c0('0x2f')]},{'model':_0x98c0('0x30'),'as':_0x98c0('0x31'),'attributes':['id','name']},{'model':_0x98c0('0x2c'),'as':_0x98c0('0x32'),'attributes':['id',_0x98c0('0x2d'),_0x98c0('0x2e'),_0x98c0('0x2f')]},{'model':_0x98c0('0x33'),'as':_0x98c0('0x33'),'attributes':['id',_0x98c0('0x2d')],'include':[{'model':_0x98c0('0x33'),'as':_0x98c0('0x34'),'attributes':['id',_0x98c0('0x2d'),'interval']}]}]},'log':_0x98c0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0d5572e..63c5611 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(_0x34abef,_0x4b63db){var _0x59f66b=function(_0x24e74f){while(--_0x24e74f){_0x34abef['push'](_0x34abef['shift']());}};_0x59f66b(++_0x4b63db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4eb957,_0x5af043){var _0x33b09a=function(_0x5c5cb4){while(--_0x5c5cb4){_0x4eb957['push'](_0x4eb957['shift']());}};_0x33b09a(++_0x5af043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 7a0d8bf..4970bec 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 _0x58bb=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x6d4831,_0x334108){var _0x28f8f8=function(_0x21b7d4){while(--_0x21b7d4){_0x6d4831['push'](_0x6d4831['shift']());}};_0x28f8f8(++_0x334108);}(_0x58bb,0x1df));var _0xb58b=function(_0x30b5f0,_0x48074e){_0x30b5f0=_0x30b5f0-0x0;var _0x3c83ab=_0x58bb[_0x30b5f0];return _0x3c83ab;};'use strict';var client=require(_0xb58b('0x0'));exports[_0xb58b('0x1')]=function(_0x4c7ac7){return function(){return client['Request'](_0xb58b('0x2'),{'options':{'where':{'VoiceQueueId':_0x4c7ac7,'paused':!![]},'raw':!![]},'log':_0xb58b('0x1')});};}; \ No newline at end of file +var _0x9c04=['getVoiceQueueRtPauses','Request','../client'];(function(_0x4df3ab,_0x1f66e7){var _0x399cf6=function(_0x14eb64){while(--_0x14eb64){_0x4df3ab['push'](_0x4df3ab['shift']());}};_0x399cf6(++_0x1f66e7);}(_0x9c04,0x158));var _0x49c0=function(_0x449340,_0x2233e1){_0x449340=_0x449340-0x0;var _0x1a188d=_0x9c04[_0x449340];return _0x1a188d;};'use strict';var client=require(_0x49c0('0x0'));exports[_0x49c0('0x1')]=function(_0x59dd59){return function(){return client[_0x49c0('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x59dd59,'paused':!![]},'raw':!![]},'log':_0x49c0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f20b157..966dc28 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x16bd3c,_0x5850db){var _0x138ba2=function(_0x48bc06){while(--_0x48bc06){_0x16bd3c['push'](_0x16bd3c['shift']());}};_0x138ba2(++_0x5850db);}(_0x7a54,0x106));var _0x47a5=function(_0x1fb2bd,_0x329019){_0x1fb2bd=_0x1fb2bd-0x0;var _0x3bd737=_0x7a54[_0x1fb2bd];return _0x3bd737;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x42b1b9,_0x37015c){var _0x3a59e0=function(_0x3a649f){while(--_0x3a649f){_0x42b1b9['push'](_0x42b1b9['shift']());}};_0x3a59e0(++_0x37015c);}(_0x7a54,0x106));var _0x47a5=function(_0x507348,_0x3e9ece){_0x507348=_0x507348-0x0;var _0x5c2338=_0x7a54[_0x507348];return _0x5c2338;};'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 2f5bbd3..aa57454 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 _0xf855=['origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x2a213d,_0x544260){var _0x2550d4=function(_0x320982){while(--_0x320982){_0x2a213d['push'](_0x2a213d['shift']());}};_0x2550d4(++_0x544260);}(_0xf855,0xdd));var _0x5f85=function(_0x5090a9,_0x301337){_0x5090a9=_0x5090a9-0x0;var _0x515db1=_0xf855[_0x5090a9];return _0x515db1;};'use strict';var client=require(_0x5f85('0x0'));exports[_0x5f85('0x1')]={};exports['blindTransfer']=function(_0x31623d){return client[_0x5f85('0x2')](_0x5f85('0x3'),{'body':{'result':_0x31623d[_0x5f85('0x4')],'transfererchannel':_0x31623d['transfererchannel'],'transferercalleridnum':_0x31623d[_0x5f85('0x5')],'transferercalleridname':_0x31623d[_0x5f85('0x6')],'transfererconnectedlinenum':_0x31623d[_0x5f85('0x7')],'transfererconnectedlinename':_0x31623d['transfererconnectedlinename'],'transfereraccountcode':_0x31623d['transfereraccountcode'],'transferercontext':_0x31623d['transferercontext'],'transfererexten':_0x31623d['transfererexten'],'transfererlinkedid':_0x31623d['transfererlinkedid'],'transfereechannel':_0x31623d[_0x5f85('0x8')],'transfereecalleridnum':_0x31623d[_0x5f85('0x9')],'transfereecalleridname':_0x31623d['transfereecalleridname'],'transfereeconnectedlinenum':_0x31623d[_0x5f85('0xa')],'transfereeconnectedlinename':_0x31623d[_0x5f85('0xb')],'transfereeaccountcode':_0x31623d[_0x5f85('0xc')],'transfereecontext':_0x31623d['transfereecontext'],'transfereeexten':_0x31623d[_0x5f85('0xd')],'transfereelinkedid':_0x31623d[_0x5f85('0xe')],'isexternal':_0x31623d[_0x5f85('0xf')],'context':_0x31623d['context'],'extension':_0x31623d[_0x5f85('0x10')],'type':'blind'},'log':_0x5f85('0x3')});};exports[_0x5f85('0x11')]=function(_0x512504){return client[_0x5f85('0x2')](_0x5f85('0x3'),{'body':{'result':_0x512504[_0x5f85('0x4')],'transfererchannel':_0x512504[_0x5f85('0x12')],'transferercalleridnum':_0x512504[_0x5f85('0x13')],'transferercalleridname':_0x512504['origtransferercalleridname'],'transfererconnectedlinenum':_0x512504[_0x5f85('0x14')],'transfererconnectedlinename':_0x512504[_0x5f85('0x15')],'transfereraccountcode':_0x512504[_0x5f85('0x16')],'transferercontext':_0x512504[_0x5f85('0x17')],'transfererexten':_0x512504['secondtransfererexten'],'transfererlinkedid':_0x512504[_0x5f85('0x18')],'transfereechannel':_0x512504['transfertargetchannel'],'transfereecalleridnum':_0x512504[_0x5f85('0x19')],'transfereecalleridname':_0x512504[_0x5f85('0x1a')],'transfereeconnectedlinenum':_0x512504[_0x5f85('0x1b')],'transfereeconnectedlinename':_0x512504[_0x5f85('0x1c')],'transfereeaccountcode':_0x512504[_0x5f85('0x1d')],'transfereecontext':_0x512504[_0x5f85('0x1e')],'transfereeexten':_0x512504[_0x5f85('0x1f')],'transfereelinkedid':_0x512504[_0x5f85('0x20')],'isexternal':_0x512504['isexternal'],'context':_0x512504['origtransferercontext'],'extension':_0x512504[_0x5f85('0x21')],'type':_0x5f85('0x22')},'log':_0x5f85('0x3')});}; \ No newline at end of file +var _0x922a=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x922a,0x108));var _0xa922=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x922a[_0x4709c0];return _0x13348b;};'use strict';var client=require(_0xa922('0x0'));exports[_0xa922('0x1')]={};exports['blindTransfer']=function(_0x3fc461){return client[_0xa922('0x2')](_0xa922('0x3'),{'body':{'result':_0x3fc461[_0xa922('0x4')],'transfererchannel':_0x3fc461['transfererchannel'],'transferercalleridnum':_0x3fc461[_0xa922('0x5')],'transferercalleridname':_0x3fc461[_0xa922('0x6')],'transfererconnectedlinenum':_0x3fc461[_0xa922('0x7')],'transfererconnectedlinename':_0x3fc461[_0xa922('0x8')],'transfereraccountcode':_0x3fc461[_0xa922('0x9')],'transferercontext':_0x3fc461[_0xa922('0xa')],'transfererexten':_0x3fc461[_0xa922('0xb')],'transfererlinkedid':_0x3fc461[_0xa922('0xc')],'transfereechannel':_0x3fc461[_0xa922('0xd')],'transfereecalleridnum':_0x3fc461[_0xa922('0xe')],'transfereecalleridname':_0x3fc461[_0xa922('0xf')],'transfereeconnectedlinenum':_0x3fc461[_0xa922('0x10')],'transfereeconnectedlinename':_0x3fc461[_0xa922('0x11')],'transfereeaccountcode':_0x3fc461[_0xa922('0x12')],'transfereecontext':_0x3fc461[_0xa922('0x13')],'transfereeexten':_0x3fc461[_0xa922('0x14')],'transfereelinkedid':_0x3fc461[_0xa922('0x15')],'isexternal':_0x3fc461[_0xa922('0x16')],'context':_0x3fc461[_0xa922('0x17')],'extension':_0x3fc461[_0xa922('0x18')],'type':_0xa922('0x19')},'log':_0xa922('0x3')});};exports[_0xa922('0x1a')]=function(_0x3095e0){return client['Request'](_0xa922('0x3'),{'body':{'result':_0x3095e0['result'],'transfererchannel':_0x3095e0[_0xa922('0x1b')],'transferercalleridnum':_0x3095e0[_0xa922('0x1c')],'transferercalleridname':_0x3095e0[_0xa922('0x1d')],'transfererconnectedlinenum':_0x3095e0[_0xa922('0x1e')],'transfererconnectedlinename':_0x3095e0[_0xa922('0x1f')],'transfereraccountcode':_0x3095e0[_0xa922('0x20')],'transferercontext':_0x3095e0['secondtransferercontext'],'transfererexten':_0x3095e0['secondtransfererexten'],'transfererlinkedid':_0x3095e0[_0xa922('0x21')],'transfereechannel':_0x3095e0[_0xa922('0x22')],'transfereecalleridnum':_0x3095e0[_0xa922('0x23')],'transfereecalleridname':_0x3095e0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3095e0[_0xa922('0x24')],'transfereeconnectedlinename':_0x3095e0[_0xa922('0x25')],'transfereeaccountcode':_0x3095e0['transfertargetaccountcode'],'transfereecontext':_0x3095e0[_0xa922('0x26')],'transfereeexten':_0x3095e0['transfertargetexten'],'transfereelinkedid':_0x3095e0[_0xa922('0x27')],'isexternal':_0x3095e0[_0xa922('0x16')],'context':_0x3095e0[_0xa922('0x28')],'extension':_0x3095e0['origtransfererexten'],'type':_0xa922('0x29')},'log':_0xa922('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2c26e57..b3cb0cd 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 _0x6075=['moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','module','Reload','Action','then','message','catch','command','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumHoldTime','talking','total','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','validate','bluebird'];(function(_0x53908a,_0x255910){var _0x41daec=function(_0x47867f){while(--_0x47867f){_0x53908a['push'](_0x53908a['shift']());}};_0x41daec(++_0x255910);}(_0x6075,0x191));var _0x5607=function(_0x48af9f,_0x164b32){_0x48af9f=_0x48af9f-0x0;var _0x2677f3=_0x6075[_0x48af9f];return _0x2677f3;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var jayson=require(_0x5607('0x1'));var schema=require(_0x5607('0x2'));var BPromise=require(_0x5607('0x3'));var moment=require(_0x5607('0x4'));var config=require(_0x5607('0x5'));var properties=require(_0x5607('0x6'));var ami=require(_0x5607('0x7'));exports[_0x5607('0x8')]=function(_0x4d333d,_0x1f4637,_0xabf691){return new BPromise(function(_0x14b9f4,_0x5ab18d){var _0x53f825={'QueuePause':function(_0x3dc860){return new Promise(function(_0x25107d,_0x24d9da){var _0x299836=util[_0x5607('0x9')]('%s/%s',_0x5607('0xa'),_0x3dc860[_0x5607('0xb')]);if(_0x4d333d[_0x5607('0xc')]&&_0x4d333d['timers'][_0x299836]&&_0x4d333d[_0x5607('0xc')][_0x299836]['timer']){_0x4d333d['timers'][_0x299836][_0x5607('0xd')]();}if(_0x4d333d[_0x5607('0xe')][_0x299836]){_0x4d333d[_0x5607('0xe')][_0x299836]['updateStatusRealtime']({'statePause':_0x3dc860[_0x5607('0xf')]?!![]:![]});}_0x25107d({'code':0xc8,'message':_0x5607('0x10')});});},'Reload':function(_0xc534bd){var _0x39fc33=this;return new Promise(function(_0xe6368d,_0x33c436){if(ami[_0x5607('0x11')]()==![]){return _0x33c436(_0x39fc33[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config['asterisk'][_0x5607('0x14')],_0x5607('0x15')][_0x5607('0x16')]('\x20')));}_0xc534bd=_['pick'](_0xc534bd,_['keys'](properties[_0x5607('0x17')]));_0xc534bd['action']=_0x5607('0x18');return ami[_0x5607('0x19')](_0xc534bd)[_0x5607('0x1a')](function(_0x1375e9){_0xe6368d({'code':0xc8,'message':_0x1375e9[_0x5607('0x1b')]});})[_0x5607('0x1c')](function(_0x55689e){_0x33c436(_0x39fc33[_0x5607('0x12')](0x1f5,_0x55689e['message']));});});},'Command':function(_0x180775){var _0x3e071b=this;return new Promise(function(_0x430f68,_0x5f080d){if(ami[_0x5607('0x11')]()==![]){return _0x5f080d(_0x3e071b[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config['asterisk'][_0x5607('0x14')],_0x5607('0x15')][_0x5607('0x16')]('\x20')));}_0x180775=_['pick'](_0x180775,_0x5607('0x1d'));_0x180775['action']='Command';return ami[_0x5607('0x19')](_0x180775)[_0x5607('0x1a')](function(_0x32d30a){_0x430f68({'code':0xc8,'message':_0x32d30a[_0x5607('0x1e')]});})[_0x5607('0x1c')](function(_0x34df69){_0x5f080d(_0x3e071b[_0x5607('0x12')](0x1f5,_0x34df69[_0x5607('0x1b')]));});});},'VoiceQueues':function(_0x8a7592){return new Promise(function(_0x42a1af,_0x593df7){var _0x20ae60=[];for(var _0x27e144 in _0x4d333d['voiceQueues']){if(_0x4d333d[_0x5607('0x1f')][_0x5607('0x20')](_0x27e144)){var _0xdb07c8=_0x4d333d[_0x5607('0x1f')][_0x27e144];var _0x447042={'id':_0xdb07c8['id'],'name':_0xdb07c8[_0x5607('0xb')],'strategy':_0xdb07c8[_0x5607('0x21')],'answered':_0xdb07c8[_0x5607('0x22')],'available':_0xdb07c8['available'],'loggedIn':_0xdb07c8[_0x5607('0x23')],'pTalking':_0xdb07c8[_0x5607('0x24')],'sumBillable':_0xdb07c8['sumBillable'],'sumDuration':_0xdb07c8['sumDuration'],'sumHoldTime':_0xdb07c8[_0x5607('0x25')]||0x0,'talking':_0xdb07c8[_0x5607('0x26')],'total':_0xdb07c8[_0x5607('0x27')],'type':_0xdb07c8[_0x5607('0x28')],'unmanaged':_0xdb07c8[_0x5607('0x29')],'abandoned':_0xdb07c8['abandoned'],'waiting':_0xdb07c8[_0x5607('0x2a')],'loggedInDb':_0xdb07c8['loggedInDb']};if(_0xdb07c8[_0x5607('0x28')]===_0x5607('0x2b')){_0x447042[_0x5607('0x2c')]=_0xdb07c8['dialActive'];_0x447042[_0x5607('0x2d')]=_0xdb07c8['dialMethod'];_0x447042[_0x5607('0x2e')]=_0xdb07c8[_0x5607('0x2e')];_0x447042[_0x5607('0x2f')]=_0xdb07c8[_0x5607('0x2f')];_0x447042[_0x5607('0x30')]=_0xdb07c8['dialOriginateTimeout'];_0x447042[_0x5607('0x31')]=_0xdb07c8['dialPrefix'];_0x447042[_0x5607('0x32')]=_0xdb07c8[_0x5607('0x32')];_0x447042['outboundAnswerAgiCallsDay']=_0xdb07c8[_0x5607('0x33')];_0x447042[_0x5607('0x34')]=_0xdb07c8[_0x5607('0x34')];_0x447042['outboundBlacklistCallsDay']=_0xdb07c8[_0x5607('0x35')];_0x447042[_0x5607('0x36')]=_0xdb07c8[_0x5607('0x36')];_0x447042[_0x5607('0x37')]=_0xdb07c8['outboundCongestionCallsDay'];_0x447042[_0x5607('0x38')]=_0xdb07c8[_0x5607('0x38')];_0x447042['outboundDropCallsDayCallersExit']=_0xdb07c8[_0x5607('0x39')];_0x447042[_0x5607('0x3a')]=_0xdb07c8[_0x5607('0x3a')];_0x447042['outboundNoAnswerCallsDay']=_0xdb07c8[_0x5607('0x3b')];_0x447042['outboundNoSuchCallsDay']=_0xdb07c8[_0x5607('0x3c')];_0x447042[_0x5607('0x3d')]=_0xdb07c8[_0x5607('0x3d')];_0x447042['outboundReCallsDay']=_0xdb07c8['outboundReCallsDay'];_0x447042['outboundRejectCallsDay']=_0xdb07c8[_0x5607('0x3e')];_0x447042[_0x5607('0x3f')]=_0xdb07c8[_0x5607('0x3f')];_0x447042[_0x5607('0x40')]=_0xdb07c8[_0x5607('0x40')];_0x447042[_0x5607('0x41')]=_0xdb07c8[_0x5607('0x41')];_0x447042[_0x5607('0x42')]=_0xdb07c8['predictiveIntervalAvgTalktime'];_0x447042[_0x5607('0x43')]=_0xdb07c8[_0x5607('0x43')];_0x447042[_0x5607('0x44')]=_0xdb07c8[_0x5607('0x44')];_0x447042['predictiveIntervalErlangCalls']=_0xdb07c8[_0x5607('0x45')];_0x447042[_0x5607('0x46')]=_0xdb07c8['predictiveIntervalErlangCallsDroppedCalls'];_0x447042['predictiveIntervalHitRate']=_0xdb07c8[_0x5607('0x47')];_0x447042[_0x5607('0x48')]=_0xdb07c8[_0x5607('0x48')];_0x447042['predictiveIntervalPauses']=_0xdb07c8['predictiveIntervalPauses'];_0x447042['predictiveIntervalAvailable']=_0xdb07c8[_0x5607('0x49')];_0x447042[_0x5607('0x4a')]=_0xdb07c8[_0x5607('0x4a')];_0x447042['message']=_0xdb07c8[_0x5607('0x1b')];_0x447042[_0x5607('0x4b')]=_0xdb07c8[_0x5607('0x4b')];_0x447042[_0x5607('0x4c')]=_0xdb07c8[_0x5607('0x4c')];_0x447042[_0x5607('0x4d')]=_0xdb07c8[_0x5607('0x4d')];_0x447042['erlangAbandonmentRate']=_0xdb07c8['erlangAbandonmentRate'];_0x447042[_0x5607('0x4e')]=_0xdb07c8[_0x5607('0x4e')];_0x447042[_0x5607('0x4f')]=_0xdb07c8['startPredictive'];_0x447042[_0x5607('0x50')]=_0xdb07c8[_0x5607('0x50')];}if(_0xdb07c8['Trunk']){_0x447042[_0x5607('0x51')]={'id':_0xdb07c8[_0x5607('0x51')]['id'],'name':_0xdb07c8['Trunk']['name'],'active':_0xdb07c8[_0x5607('0x51')][_0x5607('0x52')],'callerid':_0xdb07c8[_0x5607('0x51')]['callerid']};}if(_0xdb07c8[_0x5607('0x53')]){_0x447042[_0x5607('0x53')]={'id':_0xdb07c8['Interval']['id'],'name':_0xdb07c8[_0x5607('0x53')][_0x5607('0xb')]};}_0x20ae60['push'](_0x447042);}}_0x42a1af({'count':_0x20ae60[_0x5607('0x54')],'rows':_0x20ae60});});},'UpdateVoiceQueue':function(_0x1dbb00){return new Promise(function(_0x4388b8,_0x5522d8){var _0x2dd1f8=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x1f')],{'id':parseInt(_0x1dbb00['id'])});var _0x2dddb2=_[_0x5607('0x56')](_0x1dbb00,['id']);if(_0x2dd1f8){for(var _0x517cc5 in _0x2dddb2){if(typeof _0x2dddb2[_0x517cc5]!==_0x5607('0x57')&&typeof _0x2dd1f8[_0x517cc5]!==_0x5607('0x57')){_0x2dd1f8[_0x517cc5]=_0x2dddb2[_0x517cc5];}}_0x4388b8(_0x2dd1f8);}else{_0x5522d8();}});},'VoiceChannels':function(_0x1bae90){return new Promise(function(_0x285306,_0xd0f24f){var _0x51c1fc=_[_0x5607('0x58')](_0x4d333d['channels']);_0x285306({'count':_0x51c1fc[_0x5607('0x54')],'rows':_0x51c1fc});});},'VoiceChannelMixMonitor':function(_0x4d88d){var _0x7ab0f9=this;return new Promise(function(_0x1a0975,_0x1b52b3){if(ami[_0x5607('0x11')]()==![]){return _0x1b52b3(_0x7ab0f9['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x5607('0x14')],_0x5607('0x15')]['join']('\x20')));}var _0xa6e098=schema(properties[_0x5607('0x59')])[_0x5607('0x2')](_0x4d88d);if(_0xa6e098[_0x5607('0x54')]>0x0){return _0x1b52b3(_0x7ab0f9[_0x5607('0x12')](0x1f4,_[_0x5607('0x5a')](_0xa6e098,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0xa10e08=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x5b')],{'uniqueid':_0x4d88d[_0x5607('0x5c')]});if(_0xa10e08&&_0xa10e08[_0x5607('0x5d')]){var _0x13b009=util[_0x5607('0x9')](_0x5607('0x5e'),_0x4d88d[_0x5607('0x5f')]||_0x4d88d['uniqueid'],_0x4d88d[_0x5607('0x9')]||'wav');return ami[_0x5607('0x19')]({'action':_0x5607('0x60'),'channel':_0xa10e08[_0x5607('0x5d')],'file':_0x13b009,'options':_0x5607('0x61')})[_0x5607('0x1a')](function(_0x1427eb){var _0x56d456=_[_0x5607('0x55')](_0xa10e08['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x13b009[_0x5607('0x62')]()});if(_[_0x5607('0x63')](_0x56d456)){_0xa10e08[_0x5607('0x64')][_0x5607('0x65')]({'filename':'/var/spool/asterisk/monitor/'+_0x13b009[_0x5607('0x62')](),'createdAt':moment()['format'](_0x5607('0x66')),'mixmonitorid':_0x1427eb[_0x5607('0x67')],'status':_0x5607('0x68')});}else{_0x56d456[_0x5607('0x67')]=_0x1427eb['mixmonitorid'];_0x56d456[_0x5607('0x69')]=_0x5607('0x68');}_0x1a0975({'code':0xc8,'message':[_0x4d88d['uniqueid'],_0x5607('0x6a'),_0x1427eb['mixmonitorid']][_0x5607('0x16')]('\x20'),'mixmonitorid':_0x1427eb[_0x5607('0x67')]});})[_0x5607('0x1c')](function(_0x335b82){_0x1b52b3(_0x7ab0f9[_0x5607('0x12')](0x1f5,[_0x4d88d['uniqueid'],_0x335b82[_0x5607('0x1b')][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x1b52b3(_0x7ab0f9[_0x5607('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x316b43){var _0x29b46f=this;return new Promise(function(_0x4fdf0e,_0x4da3f9){if(ami[_0x5607('0x11')]()==![]){return _0x4da3f9(_0x29b46f[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config[_0x5607('0x13')][_0x5607('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x279420=schema(properties['voicechannel'])[_0x5607('0x2')](_0x316b43);if(_0x279420['length']>0x0){return _0x4da3f9(_0x29b46f['error'](0x1f4,_['map'](_0x279420,'message')[_0x5607('0x16')](',\x20')));}var _0x3fc9be=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x5b')],{'uniqueid':_0x316b43[_0x5607('0x5c')]});if(_0x3fc9be){return BPromise[_0x5607('0x6b')]()[_0x5607('0x1a')](function(){if(_0x3fc9be['channel']){return ami[_0x5607('0x19')]({'action':_0x5607('0x6c'),'channel':_0x3fc9be[_0x5607('0x5d')],'mixmonitorid':_0x316b43['mixmonitorid']})[_0x5607('0x1c')](function(_0xb27fd7){});}})['then'](function(){if(_0x3fc9be[_0x5607('0x6d')]){return ami['Action']({'action':_0x5607('0x6c'),'channel':_0x3fc9be[_0x5607('0x6d')],'mixmonitorid':_0x316b43['mixmonitorid']})[_0x5607('0x1c')](function(_0x1291a0){});}})[_0x5607('0x1a')](function(_0x7cf9a9){var _0x25543d=_[_0x5607('0x55')](_0x3fc9be[_0x5607('0x64')],{'mixmonitorid':_0x316b43['mixmonitorid']});if(_0x25543d){_0x25543d['status']=_0x5607('0x6e');}})[_0x5607('0x1a')](function(){var _0x24638f=util[_0x5607('0x9')](_0x5607('0x5e'),_0x316b43[_0x5607('0x5f')]||_0x316b43[_0x5607('0x5c')],_0x316b43[_0x5607('0x9')]||_0x5607('0x6f'));var _0x1c92fb=_['find'](_0x3fc9be[_0x5607('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x24638f[_0x5607('0x62')]()});if(_0x1c92fb){_0x1c92fb[_0x5607('0x69')]=_0x5607('0x6e');}})['then'](function(){_0x4fdf0e({'code':0xc8,'message':[_0x316b43['uniqueid'],_0x5607('0x70')]['join']('\x20')});})['catch'](function(_0x48a075){_0x4da3f9(_0x29b46f['error'](0x1f5,[_0x316b43[_0x5607('0x5c')],_0x48a075[_0x5607('0x1b')][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x4da3f9(_0x29b46f[_0x5607('0x12')](0x1f5,_0x5607('0x71')));}});},'VoiceQueuesChannels':function(_0x3aba9c){return new Promise(function(_0x4f1945,_0x1e0f58){var _0x325ef1=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x72')]);_0x4f1945({'count':_0x325ef1[_0x5607('0x54')],'rows':_0x325ef1});});},'VoiceQueuesChannel':function(_0x5e746c){var _0x150dcd=this;return new Promise(function(_0xf440e3,_0x37308e){var _0x559011=schema(properties[_0x5607('0x73')])[_0x5607('0x2')](_0x5e746c);if(_0x559011[_0x5607('0x54')]>0x0){return _0x37308e(_0x150dcd['error'](0x1f4,_[_0x5607('0x5a')](_0x559011,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0x29d020=_['find'](_0x4d333d[_0x5607('0x72')],{'uniqueid':_0x5e746c[_0x5607('0x5c')]});if(_0x29d020){_0xf440e3(_0x29d020);}else{return _0x37308e(_0x150dcd[_0x5607('0x12')](0x1f5,_0x5607('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x302113){var _0x2bd4e2=this;return new Promise(function(_0x251e26,_0x23448a){if(ami['isConnected']()==![]){return _0x23448a(_0x2bd4e2['error'](0x1f4,[config[_0x5607('0x13')]['ip'],config[_0x5607('0x13')][_0x5607('0x14')],_0x5607('0x15')][_0x5607('0x16')]('\x20')));}var _0x2f65c3=schema(properties['voicequeuechannelhangup'])[_0x5607('0x2')](_0x302113);if(_0x2f65c3[_0x5607('0x54')]>0x0){return _0x23448a(_0x2bd4e2[_0x5607('0x12')](0x1f4,_[_0x5607('0x5a')](_0x2f65c3,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0x40f1ab=_[_0x5607('0x55')](_0x4d333d['queueChannels'],{'uniqueid':_0x302113[_0x5607('0x5c')]});if(_0x40f1ab&&_0x40f1ab[_0x5607('0x5d')]){return ami['Action']({'action':'Hangup','channel':_0x40f1ab[_0x5607('0x5d')]})['then'](function(_0x1e4d49){_0x251e26({'code':0xc8,'message':[_0x302113['uniqueid'],_0x1e4d49['message'][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')});})['catch'](function(_0x5a4ccd){_0x23448a(_0x2bd4e2[_0x5607('0x12')](0x1f5,[_0x302113['uniqueid'],_0x5a4ccd['message'][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x23448a(_0x2bd4e2[_0x5607('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3acdd2){var _0x5757e4=this;return new Promise(function(_0x9ded24,_0x201920){if(ami[_0x5607('0x11')]()==![]){return _0x201920(_0x5757e4[_0x5607('0x12')](0x1f4,[config[_0x5607('0x13')]['ip'],config['asterisk'][_0x5607('0x14')],'ami\x20disconnected'][_0x5607('0x16')]('\x20')));}var _0x4a2384=schema(properties[_0x5607('0x74')])[_0x5607('0x2')](_0x3acdd2);if(_0x4a2384[_0x5607('0x54')]>0x0){return _0x201920(_0x5757e4[_0x5607('0x12')](0x1f4,_['map'](_0x4a2384,_0x5607('0x1b'))[_0x5607('0x16')](',\x20')));}var _0x34e1c3=_[_0x5607('0x55')](_0x4d333d[_0x5607('0x72')],{'uniqueid':_0x3acdd2[_0x5607('0x5c')]});if(_0x34e1c3&&_0x34e1c3[_0x5607('0x5d')]){return ami[_0x5607('0x19')]({'action':_0x5607('0x75'),'channel':_0x34e1c3[_0x5607('0x5d')],'exten':_0x3acdd2[_0x5607('0x76')],'context':_0x3acdd2[_0x5607('0x77')]||_0x34e1c3[_0x5607('0x77')],'priority':0x1})[_0x5607('0x1a')](function(_0x41eea5){_0x9ded24({'code':0xc8,'message':[_0x3acdd2[_0x5607('0x5c')],_0x41eea5[_0x5607('0x1b')][_0x5607('0x62')]()]['join']('\x20')});})[_0x5607('0x1c')](function(_0x4ebc44){_0x201920(_0x5757e4[_0x5607('0x12')](0x1f5,[_0x3acdd2['uniqueid'],_0x4ebc44[_0x5607('0x1b')][_0x5607('0x62')]()][_0x5607('0x16')]('\x20')));});}else{return _0x201920(_0x5757e4[_0x5607('0x12')](0x1f5,_0x5607('0x71')));}});},'Agents':function(_0xd775c6){return new Promise(function(_0x14c794,_0x394640){var _0x13a4ba=_['values'](_0x4d333d['agents']);_0x14c794({'count':_0x13a4ba[_0x5607('0x54')],'rows':_0x13a4ba});});},'Telephones':function(_0x43bae9){return new Promise(function(_0x1dd3d6,_0x4191df){var _0x40f7c8=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x78')]);_0x1dd3d6({'count':_0x40f7c8['length'],'rows':_0x40f7c8});});},'Trunks':function(_0x5c9959){return new Promise(function(_0x4e0d74,_0x4eef90){var _0x4b2916=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x79')]);_0x4e0d74({'count':_0x4b2916[_0x5607('0x54')],'rows':_0x4b2916});});},'OutboundChannels':function(_0x1488ec){return new Promise(function(_0x5f672c,_0x2e45a5){var _0x39e6e9=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x7a')]);_0x5f672c({'count':_0x39e6e9[_0x5607('0x54')],'rows':_0x39e6e9});});},'Outbound':function(_0x2d8f0a){return new Promise(function(_0x4a638d,_0x2afbc6){_0x4a638d(_0x4d333d[_0x5607('0x2b')]);});},'Campaigns':function(_0x1f13f9){return new Promise(function(_0xd4f4de,_0x2dda7a){var _0x464259=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x7b')]);_0xd4f4de({'count':_0x464259[_0x5607('0x54')],'rows':_0x464259});});},'VoiceQueuesPreview':function(_0x59ede7){var _0x5b04da=this;return new Promise(function(_0x5eb939,_0x429ec8){_0x1f4637[_0x5607('0x7c')](_0x59ede7['id'])[_0x5607('0x1a')](function(_0x22c57f){_0x5eb939({'code':0xc8,'message':_0x22c57f[_0x5607('0x1b')]});})[_0x5607('0x1c')](function(_0x321197){_0x429ec8(_0x5b04da['error'](0x1f4,_0x321197[_0x5607('0x1b')]));});});},'EventManager':function(_0x3c8b56){var _0xad467=this;return new Promise(function(_0x1e9af2,_0x265fa3){if(!_0x3c8b56[_0x5607('0x7d')]){return _0x265fa3(_0xad467[_0x5607('0x12')](0x1f4,_0x5607('0x7e')));}ami[_0x5607('0x7f')](_0x5607('0x80')+_0x3c8b56[_0x5607('0x7d')],_0x3c8b56['message']);_0x1e9af2({'code':0xc8,'message':_0x3c8b56});});},'FaxAccounts':function(_0x1f404b){return new Promise(function(_0x179dc2,_0x438219){var _0x442588=_[_0x5607('0x58')](_0x4d333d[_0x5607('0x81')]);_0x179dc2({'count':_0x442588['length'],'rows':_0x442588});});},'SendFax':function(_0x2c48f8){var _0x2ee540=this;return new Promise(function(_0x11129a,_0x107b2f){_0xabf691['send'](_0x2c48f8)[_0x5607('0x1a')](function(_0x2085cc){_0x11129a({'code':0xc8,'message':_0x2085cc['message']});})['catch'](function(_0x1fc3ca){_0x107b2f(_0x2ee540['error'](0x1f4,_0x1fc3ca[_0x5607('0x1b')]));});});},'CheckAfterSend':function(_0x4ab236){var _0x2bd9c2=this;return new Promise(function(_0x2f4c43,_0x5df978){_0xabf691['checkAfterSend'](_0x4ab236)[_0x5607('0x1a')](function(_0x3a38c0){_0x2f4c43({'code':0xc8,'message':_0x3a38c0[_0x5607('0x1b')]});})['catch'](function(_0x548ed1){_0x5df978(_0x2bd9c2[_0x5607('0x12')](0x1f4,_0x548ed1[_0x5607('0x1b')]));});});}};var _0x2a59ec=jayson[_0x5607('0x82')](_0x53f825)[_0x5607('0x83')]();_0x2a59ec['on']('error',function(_0x5789a0){return _0x5ab18d(_0x5789a0);});_0x2a59ec[_0x5607('0x8')](0x232a,_0x5607('0x84'),function(){console[_0x5607('0x85')](_0x5607('0x86'),0x232a);return _0x14b9f4('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xacf4=['loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','undefined','values','map','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','toLowerCase','isNil','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','catch','resolve','StopMixMonitor','destinationchannel','StopMixMonitor\x20Success','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','faxAccounts','checkAfterSend','server','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','SIP','name','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','join','keys','module','action','then','message','ami\x20disconnected','command','Action','content','voiceQueues','strategy','answered','available'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xacf4,0xe7));var _0x4acf=function(_0x353fc2,_0x26b193){_0x353fc2=_0x353fc2-0x0;var _0x4c98b3=_0xacf4[_0x353fc2];return _0x4c98b3;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x4acf('0x0'));var schema=require(_0x4acf('0x1'));var BPromise=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var config=require(_0x4acf('0x4'));var properties=require(_0x4acf('0x5'));var ami=require(_0x4acf('0x6'));exports['listen']=function(_0x380435,_0x2124c8,_0x4e0c43){return new BPromise(function(_0x24bf24,_0x2ba08a){var _0x649ad2={'QueuePause':function(_0x45a5a4){return new Promise(function(_0x25d345,_0x50f5f4){var _0x55f61d=util[_0x4acf('0x7')]('%s/%s',_0x4acf('0x8'),_0x45a5a4[_0x4acf('0x9')]);if(_0x380435[_0x4acf('0xa')]&&_0x380435['timers'][_0x55f61d]&&_0x380435[_0x4acf('0xa')][_0x55f61d][_0x4acf('0xb')]){_0x380435['timers'][_0x55f61d]['updateAcw']();}if(_0x380435[_0x4acf('0xc')][_0x55f61d]){_0x380435['agents'][_0x55f61d]['updateStatusRealtime']({'statePause':_0x45a5a4[_0x4acf('0xd')]?!![]:![]});}_0x25d345({'code':0xc8,'message':_0x4acf('0xe')});});},'Reload':function(_0x3734e1){var _0x32dc33=this;return new Promise(function(_0x18629e,_0x1a9949){if(ami[_0x4acf('0xf')]()==![]){return _0x1a9949(_0x32dc33[_0x4acf('0x10')](0x1f4,[config[_0x4acf('0x11')]['ip'],config[_0x4acf('0x11')][_0x4acf('0x12')],'ami\x20disconnected'][_0x4acf('0x13')]('\x20')));}_0x3734e1=_['pick'](_0x3734e1,_[_0x4acf('0x14')](properties[_0x4acf('0x15')]));_0x3734e1[_0x4acf('0x16')]='Reload';return ami['Action'](_0x3734e1)[_0x4acf('0x17')](function(_0x40cb8d){_0x18629e({'code':0xc8,'message':_0x40cb8d[_0x4acf('0x18')]});})['catch'](function(_0x2a678b){_0x1a9949(_0x32dc33[_0x4acf('0x10')](0x1f5,_0x2a678b[_0x4acf('0x18')]));});});},'Command':function(_0x8b55f8){var _0x2f0cec=this;return new Promise(function(_0x21e385,_0x2049ba){if(ami[_0x4acf('0xf')]()==![]){return _0x2049ba(_0x2f0cec[_0x4acf('0x10')](0x1f4,[config[_0x4acf('0x11')]['ip'],config[_0x4acf('0x11')]['username'],_0x4acf('0x19')][_0x4acf('0x13')]('\x20')));}_0x8b55f8=_['pick'](_0x8b55f8,_0x4acf('0x1a'));_0x8b55f8[_0x4acf('0x16')]='Command';return ami[_0x4acf('0x1b')](_0x8b55f8)[_0x4acf('0x17')](function(_0x433b7a){_0x21e385({'code':0xc8,'message':_0x433b7a[_0x4acf('0x1c')]});})['catch'](function(_0x1a2286){_0x2049ba(_0x2f0cec[_0x4acf('0x10')](0x1f5,_0x1a2286['message']));});});},'VoiceQueues':function(_0x32771e){return new Promise(function(_0x1af4e9,_0x52a84a){var _0x126522=[];for(var _0x7ebb in _0x380435[_0x4acf('0x1d')]){if(_0x380435[_0x4acf('0x1d')]['hasOwnProperty'](_0x7ebb)){var _0x50236d=_0x380435[_0x4acf('0x1d')][_0x7ebb];var _0x3f548a={'id':_0x50236d['id'],'name':_0x50236d[_0x4acf('0x9')],'strategy':_0x50236d[_0x4acf('0x1e')],'answered':_0x50236d[_0x4acf('0x1f')],'available':_0x50236d[_0x4acf('0x20')],'loggedIn':_0x50236d[_0x4acf('0x21')],'pTalking':_0x50236d[_0x4acf('0x22')],'sumBillable':_0x50236d[_0x4acf('0x23')],'sumDuration':_0x50236d[_0x4acf('0x24')],'sumHoldTime':_0x50236d['sumHoldTime']||0x0,'talking':_0x50236d[_0x4acf('0x25')],'total':_0x50236d[_0x4acf('0x26')],'type':_0x50236d[_0x4acf('0x27')],'unmanaged':_0x50236d[_0x4acf('0x28')],'abandoned':_0x50236d[_0x4acf('0x29')],'waiting':_0x50236d[_0x4acf('0x2a')],'loggedInDb':_0x50236d[_0x4acf('0x2b')]};if(_0x50236d['type']===_0x4acf('0x2c')){_0x3f548a[_0x4acf('0x2d')]=_0x50236d[_0x4acf('0x2d')];_0x3f548a['dialMethod']=_0x50236d[_0x4acf('0x2e')];_0x3f548a[_0x4acf('0x2f')]=_0x50236d[_0x4acf('0x2f')];_0x3f548a[_0x4acf('0x30')]=_0x50236d['dialOriginateCallerIdNumber'];_0x3f548a[_0x4acf('0x31')]=_0x50236d[_0x4acf('0x31')];_0x3f548a[_0x4acf('0x32')]=_0x50236d['dialPrefix'];_0x3f548a[_0x4acf('0x33')]=_0x50236d[_0x4acf('0x33')];_0x3f548a[_0x4acf('0x34')]=_0x50236d[_0x4acf('0x34')];_0x3f548a[_0x4acf('0x35')]=_0x50236d[_0x4acf('0x35')];_0x3f548a['outboundBlacklistCallsDay']=_0x50236d[_0x4acf('0x36')];_0x3f548a[_0x4acf('0x37')]=_0x50236d['outboundBusyCallsDay'];_0x3f548a[_0x4acf('0x38')]=_0x50236d['outboundCongestionCallsDay'];_0x3f548a['outboundDropCallsDayACS']=_0x50236d['outboundDropCallsDayACS'];_0x3f548a['outboundDropCallsDayCallersExit']=_0x50236d['outboundDropCallsDayCallersExit'];_0x3f548a['outboundDropCallsDayTimeout']=_0x50236d['outboundDropCallsDayTimeout'];_0x3f548a[_0x4acf('0x39')]=_0x50236d[_0x4acf('0x39')];_0x3f548a['outboundNoSuchCallsDay']=_0x50236d[_0x4acf('0x3a')];_0x3f548a[_0x4acf('0x3b')]=_0x50236d[_0x4acf('0x3b')];_0x3f548a[_0x4acf('0x3c')]=_0x50236d[_0x4acf('0x3c')];_0x3f548a[_0x4acf('0x3d')]=_0x50236d[_0x4acf('0x3d')];_0x3f548a[_0x4acf('0x3e')]=_0x50236d[_0x4acf('0x3e')];_0x3f548a[_0x4acf('0x3f')]=_0x50236d['predictiveIntervalAnsweredCalls'];_0x3f548a['predictiveIntervalAvgHoldtime']=_0x50236d[_0x4acf('0x40')];_0x3f548a[_0x4acf('0x41')]=_0x50236d['predictiveIntervalAvgTalktime'];_0x3f548a[_0x4acf('0x42')]=_0x50236d[_0x4acf('0x42')];_0x3f548a[_0x4acf('0x43')]=_0x50236d[_0x4acf('0x43')];_0x3f548a['predictiveIntervalErlangCalls']=_0x50236d['predictiveIntervalErlangCalls'];_0x3f548a[_0x4acf('0x44')]=_0x50236d[_0x4acf('0x44')];_0x3f548a[_0x4acf('0x45')]=_0x50236d[_0x4acf('0x45')];_0x3f548a['predictiveIntervalMultiplicativeFactor']=_0x50236d[_0x4acf('0x46')];_0x3f548a[_0x4acf('0x47')]=_0x50236d['predictiveIntervalPauses'];_0x3f548a['predictiveIntervalAvailable']=_0x50236d['predictiveIntervalAvailable'];_0x3f548a['predictiveIntervalTotalCalls']=_0x50236d[_0x4acf('0x48')];_0x3f548a[_0x4acf('0x18')]=_0x50236d[_0x4acf('0x18')];_0x3f548a['originated']=_0x50236d[_0x4acf('0x49')];_0x3f548a[_0x4acf('0x4a')]=_0x50236d[_0x4acf('0x4a')];_0x3f548a[_0x4acf('0x4b')]=_0x50236d[_0x4acf('0x4b')];_0x3f548a[_0x4acf('0x4c')]=_0x50236d[_0x4acf('0x4c')];_0x3f548a[_0x4acf('0x4d')]=_0x50236d[_0x4acf('0x4d')];_0x3f548a[_0x4acf('0x4e')]=_0x50236d[_0x4acf('0x4e')];_0x3f548a['startProgressive']=_0x50236d[_0x4acf('0x4f')];}if(_0x50236d[_0x4acf('0x50')]){_0x3f548a[_0x4acf('0x50')]={'id':_0x50236d[_0x4acf('0x50')]['id'],'name':_0x50236d[_0x4acf('0x50')]['name'],'active':_0x50236d['Trunk'][_0x4acf('0x51')],'callerid':_0x50236d[_0x4acf('0x50')][_0x4acf('0x52')]};}if(_0x50236d[_0x4acf('0x53')]){_0x3f548a[_0x4acf('0x53')]={'id':_0x50236d[_0x4acf('0x53')]['id'],'name':_0x50236d['Interval'][_0x4acf('0x9')]};}_0x126522['push'](_0x3f548a);}}_0x1af4e9({'count':_0x126522[_0x4acf('0x54')],'rows':_0x126522});});},'UpdateVoiceQueue':function(_0x3c3e65){return new Promise(function(_0x54b2a8,_0x53ec11){var _0x173dad=_[_0x4acf('0x55')](_0x380435[_0x4acf('0x1d')],{'id':parseInt(_0x3c3e65['id'])});var _0x3e4a0e=_['omit'](_0x3c3e65,['id']);if(_0x173dad){for(var _0x2f1d23 in _0x3e4a0e){if(typeof _0x3e4a0e[_0x2f1d23]!==_0x4acf('0x56')&&typeof _0x173dad[_0x2f1d23]!==_0x4acf('0x56')){_0x173dad[_0x2f1d23]=_0x3e4a0e[_0x2f1d23];}}_0x54b2a8(_0x173dad);}else{_0x53ec11();}});},'VoiceChannels':function(_0x31860b){return new Promise(function(_0xfb4611,_0x1afdab){var _0x1bd7d0=_[_0x4acf('0x57')](_0x380435['channels']);_0xfb4611({'count':_0x1bd7d0['length'],'rows':_0x1bd7d0});});},'VoiceChannelMixMonitor':function(_0x1f5c5f){var _0x209d25=this;return new Promise(function(_0x33b23a,_0x33bc52){if(ami[_0x4acf('0xf')]()==![]){return _0x33bc52(_0x209d25[_0x4acf('0x10')](0x1f4,[config[_0x4acf('0x11')]['ip'],config[_0x4acf('0x11')][_0x4acf('0x12')],_0x4acf('0x19')][_0x4acf('0x13')]('\x20')));}var _0x9aa592=schema(properties['voicechannel'])[_0x4acf('0x1')](_0x1f5c5f);if(_0x9aa592[_0x4acf('0x54')]>0x0){return _0x33bc52(_0x209d25[_0x4acf('0x10')](0x1f4,_[_0x4acf('0x58')](_0x9aa592,_0x4acf('0x18'))[_0x4acf('0x13')](',\x20')));}var _0x2785b9=_[_0x4acf('0x55')](_0x380435[_0x4acf('0x59')],{'uniqueid':_0x1f5c5f[_0x4acf('0x5a')]});if(_0x2785b9&&_0x2785b9[_0x4acf('0x5b')]){var _0x3ad746=util[_0x4acf('0x7')](_0x4acf('0x5c'),_0x1f5c5f[_0x4acf('0x5d')]||_0x1f5c5f[_0x4acf('0x5a')],_0x1f5c5f['format']||_0x4acf('0x5e'));return ami[_0x4acf('0x1b')]({'action':_0x4acf('0x5f'),'channel':_0x2785b9['channel'],'file':_0x3ad746,'options':_0x4acf('0x60')})[_0x4acf('0x17')](function(_0xd87769){var _0x3cf3df=_['find'](_0x2785b9['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x3ad746[_0x4acf('0x61')]()});if(_[_0x4acf('0x62')](_0x3cf3df)){_0x2785b9[_0x4acf('0x63')]['push']({'filename':_0x4acf('0x64')+_0x3ad746[_0x4acf('0x61')](),'createdAt':moment()['format'](_0x4acf('0x65')),'mixmonitorid':_0xd87769[_0x4acf('0x66')],'status':_0x4acf('0x67')});}else{_0x3cf3df[_0x4acf('0x66')]=_0xd87769['mixmonitorid'];_0x3cf3df[_0x4acf('0x68')]=_0x4acf('0x67');}_0x33b23a({'code':0xc8,'message':[_0x1f5c5f[_0x4acf('0x5a')],_0x4acf('0x69'),_0xd87769['mixmonitorid']][_0x4acf('0x13')]('\x20'),'mixmonitorid':_0xd87769['mixmonitorid']});})[_0x4acf('0x6a')](function(_0x4bc18f){_0x33bc52(_0x209d25[_0x4acf('0x10')](0x1f5,[_0x1f5c5f[_0x4acf('0x5a')],_0x4bc18f[_0x4acf('0x18')][_0x4acf('0x61')]()]['join']('\x20')));});}else{return _0x33bc52(_0x209d25['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x14b634){var _0x5a2ac6=this;return new Promise(function(_0x4c8d4b,_0x312729){if(ami[_0x4acf('0xf')]()==![]){return _0x312729(_0x5a2ac6['error'](0x1f4,[config[_0x4acf('0x11')]['ip'],config[_0x4acf('0x11')]['username'],_0x4acf('0x19')][_0x4acf('0x13')]('\x20')));}var _0x1a696f=schema(properties['voicechannel'])[_0x4acf('0x1')](_0x14b634);if(_0x1a696f[_0x4acf('0x54')]>0x0){return _0x312729(_0x5a2ac6[_0x4acf('0x10')](0x1f4,_[_0x4acf('0x58')](_0x1a696f,'message')[_0x4acf('0x13')](',\x20')));}var _0x8c1c3c=_[_0x4acf('0x55')](_0x380435['channels'],{'uniqueid':_0x14b634[_0x4acf('0x5a')]});if(_0x8c1c3c){return BPromise[_0x4acf('0x6b')]()[_0x4acf('0x17')](function(){if(_0x8c1c3c[_0x4acf('0x5b')]){return ami[_0x4acf('0x1b')]({'action':_0x4acf('0x6c'),'channel':_0x8c1c3c[_0x4acf('0x5b')],'mixmonitorid':_0x14b634[_0x4acf('0x66')]})[_0x4acf('0x6a')](function(_0x31c8dd){});}})[_0x4acf('0x17')](function(){if(_0x8c1c3c[_0x4acf('0x6d')]){return ami[_0x4acf('0x1b')]({'action':_0x4acf('0x6c'),'channel':_0x8c1c3c[_0x4acf('0x6d')],'mixmonitorid':_0x14b634['mixmonitorid']})[_0x4acf('0x6a')](function(_0x313ed9){});}})[_0x4acf('0x17')](function(_0x2cbf10){var _0xa2faf9=_[_0x4acf('0x55')](_0x8c1c3c[_0x4acf('0x63')],{'mixmonitorid':_0x14b634[_0x4acf('0x66')]});if(_0xa2faf9){_0xa2faf9['status']='stop';}})[_0x4acf('0x17')](function(){var _0x5e0f64=util[_0x4acf('0x7')]('%s.%s',_0x14b634['filename']||_0x14b634['uniqueid'],_0x14b634[_0x4acf('0x7')]||_0x4acf('0x5e'));var _0x3b9ed2=_[_0x4acf('0x55')](_0x8c1c3c[_0x4acf('0x63')],{'filename':_0x4acf('0x64')+_0x5e0f64['toLowerCase']()});if(_0x3b9ed2){_0x3b9ed2['status']='stop';}})[_0x4acf('0x17')](function(){_0x4c8d4b({'code':0xc8,'message':[_0x14b634[_0x4acf('0x5a')],_0x4acf('0x6e')]['join']('\x20')});})[_0x4acf('0x6a')](function(_0x96b3da){_0x312729(_0x5a2ac6[_0x4acf('0x10')](0x1f5,[_0x14b634[_0x4acf('0x5a')],_0x96b3da[_0x4acf('0x18')][_0x4acf('0x61')]()]['join']('\x20')));});}else{return _0x312729(_0x5a2ac6[_0x4acf('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x166d31){return new Promise(function(_0x1d22ba,_0x1572dd){var _0x49a5ab=_[_0x4acf('0x57')](_0x380435[_0x4acf('0x6f')]);_0x1d22ba({'count':_0x49a5ab[_0x4acf('0x54')],'rows':_0x49a5ab});});},'VoiceQueuesChannel':function(_0xc0d942){var _0x1dfe70=this;return new Promise(function(_0x41bf9a,_0x8eef26){var _0x203734=schema(properties['voicequeuechannel'])[_0x4acf('0x1')](_0xc0d942);if(_0x203734[_0x4acf('0x54')]>0x0){return _0x8eef26(_0x1dfe70[_0x4acf('0x10')](0x1f4,_[_0x4acf('0x58')](_0x203734,_0x4acf('0x18'))[_0x4acf('0x13')](',\x20')));}var _0x29d81c=_[_0x4acf('0x55')](_0x380435[_0x4acf('0x6f')],{'uniqueid':_0xc0d942[_0x4acf('0x5a')]});if(_0x29d81c){_0x41bf9a(_0x29d81c);}else{return _0x8eef26(_0x1dfe70['error'](0x1f5,_0x4acf('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x3bb101){var _0x4a55b1=this;return new Promise(function(_0x1e6e0e,_0x4735c8){if(ami['isConnected']()==![]){return _0x4735c8(_0x4a55b1[_0x4acf('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x4acf('0x12')],'ami\x20disconnected'][_0x4acf('0x13')]('\x20')));}var _0xe57598=schema(properties[_0x4acf('0x71')])[_0x4acf('0x1')](_0x3bb101);if(_0xe57598['length']>0x0){return _0x4735c8(_0x4a55b1[_0x4acf('0x10')](0x1f4,_[_0x4acf('0x58')](_0xe57598,'message')['join'](',\x20')));}var _0x47e558=_[_0x4acf('0x55')](_0x380435['queueChannels'],{'uniqueid':_0x3bb101[_0x4acf('0x5a')]});if(_0x47e558&&_0x47e558[_0x4acf('0x5b')]){return ami[_0x4acf('0x1b')]({'action':'Hangup','channel':_0x47e558[_0x4acf('0x5b')]})[_0x4acf('0x17')](function(_0x591d0b){_0x1e6e0e({'code':0xc8,'message':[_0x3bb101[_0x4acf('0x5a')],_0x591d0b[_0x4acf('0x18')]['toLowerCase']()][_0x4acf('0x13')]('\x20')});})[_0x4acf('0x6a')](function(_0x1115aa){_0x4735c8(_0x4a55b1[_0x4acf('0x10')](0x1f5,[_0x3bb101[_0x4acf('0x5a')],_0x1115aa[_0x4acf('0x18')]['toLowerCase']()][_0x4acf('0x13')]('\x20')));});}else{return _0x4735c8(_0x4a55b1['error'](0x1f5,_0x4acf('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x292419){var _0x52e62e=this;return new Promise(function(_0x51d683,_0x47b50a){if(ami[_0x4acf('0xf')]()==![]){return _0x47b50a(_0x52e62e['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x4acf('0x12')],'ami\x20disconnected'][_0x4acf('0x13')]('\x20')));}var _0x375be6=schema(properties[_0x4acf('0x72')])[_0x4acf('0x1')](_0x292419);if(_0x375be6[_0x4acf('0x54')]>0x0){return _0x47b50a(_0x52e62e['error'](0x1f4,_['map'](_0x375be6,_0x4acf('0x18'))[_0x4acf('0x13')](',\x20')));}var _0x22eeb0=_[_0x4acf('0x55')](_0x380435[_0x4acf('0x6f')],{'uniqueid':_0x292419['uniqueid']});if(_0x22eeb0&&_0x22eeb0[_0x4acf('0x5b')]){return ami[_0x4acf('0x1b')]({'action':_0x4acf('0x73'),'channel':_0x22eeb0[_0x4acf('0x5b')],'exten':_0x292419[_0x4acf('0x74')],'context':_0x292419[_0x4acf('0x75')]||_0x22eeb0[_0x4acf('0x75')],'priority':0x1})['then'](function(_0x22ef53){_0x51d683({'code':0xc8,'message':[_0x292419['uniqueid'],_0x22ef53[_0x4acf('0x18')][_0x4acf('0x61')]()][_0x4acf('0x13')]('\x20')});})[_0x4acf('0x6a')](function(_0x416108){_0x47b50a(_0x52e62e['error'](0x1f5,[_0x292419[_0x4acf('0x5a')],_0x416108['message'][_0x4acf('0x61')]()][_0x4acf('0x13')]('\x20')));});}else{return _0x47b50a(_0x52e62e['error'](0x1f5,_0x4acf('0x70')));}});},'Agents':function(_0x3b2789){return new Promise(function(_0x2cddf3,_0x4110c5){var _0x107e40=_['values'](_0x380435[_0x4acf('0xc')]);_0x2cddf3({'count':_0x107e40['length'],'rows':_0x107e40});});},'Telephones':function(_0x5ee39d){return new Promise(function(_0x303f1e,_0x46f88f){var _0x14918d=_[_0x4acf('0x57')](_0x380435['telephones']);_0x303f1e({'count':_0x14918d['length'],'rows':_0x14918d});});},'Trunks':function(_0xf8c35b){return new Promise(function(_0x1a0b9b,_0xc627d){var _0xe86c1f=_[_0x4acf('0x57')](_0x380435[_0x4acf('0x76')]);_0x1a0b9b({'count':_0xe86c1f[_0x4acf('0x54')],'rows':_0xe86c1f});});},'OutboundChannels':function(_0x423c50){return new Promise(function(_0x57f0fa,_0x5a968c){var _0x2dd9ac=_[_0x4acf('0x57')](_0x380435[_0x4acf('0x77')]);_0x57f0fa({'count':_0x2dd9ac[_0x4acf('0x54')],'rows':_0x2dd9ac});});},'Outbound':function(_0x2ca832){return new Promise(function(_0x40acb1,_0x40b639){_0x40acb1(_0x380435[_0x4acf('0x2c')]);});},'Campaigns':function(_0x407bcd){return new Promise(function(_0x4c2904,_0x300a8e){var _0x3b3fef=_[_0x4acf('0x57')](_0x380435[_0x4acf('0x78')]);_0x4c2904({'count':_0x3b3fef[_0x4acf('0x54')],'rows':_0x3b3fef});});},'VoiceQueuesPreview':function(_0x7f2a11){var _0x3b07f7=this;return new Promise(function(_0x1c57ce,_0x37870c){_0x2124c8[_0x4acf('0x79')](_0x7f2a11['id'])[_0x4acf('0x17')](function(_0x467114){_0x1c57ce({'code':0xc8,'message':_0x467114[_0x4acf('0x18')]});})['catch'](function(_0x39093){_0x37870c(_0x3b07f7['error'](0x1f4,_0x39093[_0x4acf('0x18')]));});});},'EventManager':function(_0x322e45){var _0x51c071=this;return new Promise(function(_0x24bca9,_0x21480e){if(!_0x322e45['event']){return _0x21480e(_0x51c071['error'](0x1f4,_0x4acf('0x7a')));}ami[_0x4acf('0x7b')]('custom:'+_0x322e45['event'],_0x322e45[_0x4acf('0x18')]);_0x24bca9({'code':0xc8,'message':_0x322e45});});},'FaxAccounts':function(_0x1df97b){return new Promise(function(_0x26fed7,_0x201bc9){var _0x4ae333=_[_0x4acf('0x57')](_0x380435[_0x4acf('0x7c')]);_0x26fed7({'count':_0x4ae333[_0x4acf('0x54')],'rows':_0x4ae333});});},'SendFax':function(_0x34e1ea){var _0x43e9bf=this;return new Promise(function(_0x367ad4,_0x1091cb){_0x4e0c43['send'](_0x34e1ea)[_0x4acf('0x17')](function(_0x176b0d){_0x367ad4({'code':0xc8,'message':_0x176b0d[_0x4acf('0x18')]});})['catch'](function(_0x40cccb){_0x1091cb(_0x43e9bf[_0x4acf('0x10')](0x1f4,_0x40cccb[_0x4acf('0x18')]));});});},'CheckAfterSend':function(_0x1ab81f){var _0x37ffab=this;return new Promise(function(_0x414008,_0x470712){_0x4e0c43[_0x4acf('0x7d')](_0x1ab81f)['then'](function(_0x4d1f7c){_0x414008({'code':0xc8,'message':_0x4d1f7c['message']});})['catch'](function(_0x488b47){_0x470712(_0x37ffab[_0x4acf('0x10')](0x1f4,_0x488b47['message']));});});}};var _0x46f97b=jayson[_0x4acf('0x7e')](_0x649ad2)['http']();_0x46f97b['on'](_0x4acf('0x10'),function(_0x14ef45){return _0x2ba08a(_0x14ef45);});_0x46f97b[_0x4acf('0x7f')](0x232a,_0x4acf('0x80'),function(){console[_0x4acf('0x81')](_0x4acf('0x82'),0x232a);return _0x24bf24(_0x4acf('0x83')+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 f926bc1..dddf603 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 _0x1ae7=['../../../../config/environment','trigger','defaults','redis','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','destcalleridnum','mobile','fax','createdAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util'];(function(_0x57e1ed,_0xb45f4d){var _0x545270=function(_0x312041){while(--_0x312041){_0x57e1ed['push'](_0x57e1ed['shift']());}};_0x545270(++_0xb45f4d);}(_0x1ae7,0xe0));var _0x71ae=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x1ae7[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x71ae('0x0'));var BPromise=require(_0x71ae('0x1'));var Redis=require(_0x71ae('0x2'));var util=require(_0x71ae('0x3'));var config=require(_0x71ae('0x4'));var logger=require('../../../../config/logger')(_0x71ae('0x5'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x71ae('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x71ae('0x7')]));function emit(_0x114524,_0x580bc1,_0x599146,_0x59a626,_0x21c294){logger[_0x71ae('0x8')](_0x71ae('0x9'),_0x114524,_0x580bc1['id'],_0x599146,_0x59a626,JSON[_0x71ae('0xa')](_0x21c294));io['to'](_0x599146)[_0x71ae('0xb')](_0x59a626,_0x21c294);}exports[_0x71ae('0xc')]=function(_0x44983c,_0xcaeae6,_0x52c7ac,_0x662386){var _0x54b4b5,_0x3867e3;var _0xfad423={};var _0x477ee4;var _0x255543=Number(_0x52c7ac[_0x71ae('0xd')]);var _0x1a0ba4=_0x52c7ac[_0x71ae('0xe')]?Boolean(Number(_0x52c7ac[_0x71ae('0xe')])):![];var _0xb0df83;var _0x3be9ee=![];if(!_[_0x71ae('0xf')](_0x52c7ac[_0x71ae('0x10')])){if(_0x52c7ac['data5']=='1')_0x3be9ee=!![];}if(!_0x3be9ee){if(_0x662386[_0x71ae('0x11')]){_0xfad423['id']=_0x662386['xmd-contactid'];}}if(!_0xfad423['id']){_0xfad423[_0x71ae('0x12')]=_0x255543;_0xb0df83=_0x52c7ac[_0x71ae('0x13')]&&_0x52c7ac[_0x71ae('0x13')]!=='0'?_0x52c7ac[_0x71ae('0x13')][_0x71ae('0x14')](','):[_0x71ae('0x15')];_0xfad423[_0x71ae('0x16')]=_[_0x71ae('0x17')](_0xb0df83,function(_0x9c1071){var _0xe98dc3={};_0xe98dc3[_0x9c1071]=_0x662386[_0x71ae('0x18')]?_0x662386['destcalleridnum']:_0x662386[_0x71ae('0x19')];return _0xe98dc3;});_0x477ee4=_0x662386['routeId']?_0x662386[_0x71ae('0x1a')]:_0x662386[_0x71ae('0x19')];}var _0x40cbbe=['id','firstName','lastName',_0x71ae('0x15'),_0x71ae('0x1b'),_0x71ae('0x1c'),_0x71ae('0x12'),_0x71ae('0x1d'),'scheduledAt',_0x71ae('0x1e')];var _0x1b3a67=_[_0x71ae('0x1f')](_0x40cbbe,_0xb0df83);BPromise[_0x71ae('0x20')]()[_0x71ae('0x21')](cmContactRpc['getContacts']({'attributes':_0x1b3a67,'where':_0xfad423,'phone':_0x477ee4}))[_0x71ae('0x21')](function(_0x1abf62){_0x3867e3=_0x1abf62;if(!_[_0x71ae('0x22')](_0x3867e3)){if(_0x3867e3[_0x71ae('0x23')]===0x1){_0x54b4b5=_0x3867e3[0x0];logger[_0x71ae('0x8')](_0x71ae('0x24'),_0x662386[_0x71ae('0x25')],_0xcaeae6['id'],_0x54b4b5['id']);}else{logger[_0x71ae('0x8')](_0x71ae('0x26'),_0x662386[_0x71ae('0x25')],_0xcaeae6['id'],_[_0x71ae('0x17')](_0x3867e3,'id')[_0x71ae('0x27')](','));}return;}else{logger[_0x71ae('0x8')](_0x71ae('0x28'),_0x662386['uniqueid'],_0xcaeae6['id']);var _0x26416d={'ListId':_0x255543};var _0xc82f95=_0x52c7ac['data4']&&_0x52c7ac[_0x71ae('0x29')]!=='0'?_0x52c7ac[_0x71ae('0x29')]:_0x71ae('0x15');if(_0x1a0ba4){logger['info'](_0x71ae('0x2a'),_0x662386[_0x71ae('0x25')],_0xcaeae6['id']);_0x26416d[_0xc82f95]=_[_0x71ae('0xf')](_0x662386[_0x71ae('0x18')])?_0x662386[_0x71ae('0x19')]:_0x662386[_0x71ae('0x1a')];if(_[_0x71ae('0xf')](_0x662386[_0x71ae('0x18')])){_0x26416d[_0x71ae('0x2b')]=_0x662386[_0x71ae('0x2c')]&&_0x662386[_0x71ae('0x2c')]!==''?_0x662386[_0x71ae('0x2c')]:_0x71ae('0x2d');}else{_0x26416d['firstName']=_0x662386['destcalleridname']&&_0x662386[_0x71ae('0x2e')]!==_0x71ae('0x2f')?_0x662386[_0x71ae('0x2e')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x26416d))[_0x71ae('0x21')](function(_0x45fbb3){_0x54b4b5=_0x45fbb3;_0x3867e3[_0x71ae('0x30')](_0x45fbb3);if(_0x54b4b5){logger[_0x71ae('0x8')](_0x71ae('0x31'),_0x662386[_0x71ae('0x25')],_0xcaeae6['id'],_0x54b4b5['id']);}return;});}else{logger[_0x71ae('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x662386[_0x71ae('0x25')],_0xcaeae6['id']);_0x26416d[_0xc82f95]=_[_0x71ae('0xf')](_0x662386[_0x71ae('0x18')])?_0x662386[_0x71ae('0x19')]:_0x662386['destcalleridnum'];if(_[_0x71ae('0xf')](_0x662386['routeId'])){_0x26416d[_0x71ae('0x2b')]=_0x662386[_0x71ae('0x2c')]&&_0x662386['calleridname']!==_0x71ae('0x2f')?_0x662386['calleridname']:'Unknown';}else{_0x26416d[_0x71ae('0x2b')]=_0x662386[_0x71ae('0x2e')]&&_0x662386[_0x71ae('0x2e')]!==''?_0x662386[_0x71ae('0x2e')]:_0x71ae('0x2d');}_0x54b4b5=_0x26416d;_0x3867e3[_0x71ae('0x30')](_0x26416d);return;}}})[_0x71ae('0x21')](function(){if(_0x44983c){emit(_0x662386[_0x71ae('0x25')],_0xcaeae6,util[_0x71ae('0x32')](_0x71ae('0x33'),_0x44983c[_0x71ae('0x34')]),util[_0x71ae('0x32')](_0x71ae('0x35'),_0x52c7ac[_0x71ae('0x36')][_0x71ae('0x37')]()),{'evt':_[_0x71ae('0x38')](_0x662386,{'autoCreate':_0x1a0ba4}),'contact':_0x54b4b5===undefined?{}:_0x54b4b5,'contacts':_0x3867e3[_0x71ae('0x23')]===0x0?undefined:_0x3867e3});}});}; \ No newline at end of file +var _0xcb10=['[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','scheduledAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','info'];(function(_0x595bae,_0x52f914){var _0x21b4f3=function(_0x52e1d7){while(--_0x52e1d7){_0x595bae['push'](_0x595bae['shift']());}};_0x21b4f3(++_0x52f914);}(_0xcb10,0x104));var _0x0cb1=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xcb10[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x0cb1('0x0'));var BPromise=require(_0x0cb1('0x1'));var Redis=require('ioredis');var util=require(_0x0cb1('0x2'));var config=require(_0x0cb1('0x3'));var logger=require('../../../../config/logger')(_0x0cb1('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x0cb1('0x5')]=_[_0x0cb1('0x6')](config[_0x0cb1('0x5')],{'host':_0x0cb1('0x7'),'port':0x18eb});var io=require(_0x0cb1('0x8'))(new Redis(config[_0x0cb1('0x5')]));function emit(_0x390335,_0xdda18c,_0x575138,_0x43620c,_0x1f815e){logger[_0x0cb1('0x9')](_0x0cb1('0xa'),_0x390335,_0xdda18c['id'],_0x575138,_0x43620c,JSON[_0x0cb1('0xb')](_0x1f815e));io['to'](_0x575138)[_0x0cb1('0xc')](_0x43620c,_0x1f815e);}exports[_0x0cb1('0xd')]=function(_0x488a4f,_0x4eae6f,_0x555c10,_0x1c97f2){var _0x75e7d9,_0x59c936;var _0x5638ff={};var _0x597a57;var _0x3201b5=Number(_0x555c10['data1']);var _0x6b6477=_0x555c10[_0x0cb1('0xe')]?Boolean(Number(_0x555c10[_0x0cb1('0xe')])):![];var _0xdc3a39;var _0x831933=![];if(!_[_0x0cb1('0xf')](_0x555c10['data5'])){if(_0x555c10[_0x0cb1('0x10')]=='1')_0x831933=!![];}if(!_0x831933){if(_0x1c97f2[_0x0cb1('0x11')]){_0x5638ff['id']=_0x1c97f2['xmd-contactid'];}}if(!_0x5638ff['id']){_0x5638ff[_0x0cb1('0x12')]=_0x3201b5;_0xdc3a39=_0x555c10['data3']&&_0x555c10[_0x0cb1('0x13')]!=='0'?_0x555c10[_0x0cb1('0x13')]['split'](','):[_0x0cb1('0x14')];_0x5638ff[_0x0cb1('0x15')]=_[_0x0cb1('0x16')](_0xdc3a39,function(_0x1f3434){var _0x516a50={};_0x516a50[_0x1f3434]=_0x1c97f2[_0x0cb1('0x17')]?_0x1c97f2[_0x0cb1('0x18')]:_0x1c97f2[_0x0cb1('0x19')];return _0x516a50;});_0x597a57=_0x1c97f2['routeId']?_0x1c97f2['destcalleridnum']:_0x1c97f2[_0x0cb1('0x19')];}var _0x109db9=['id','firstName',_0x0cb1('0x1a'),'phone',_0x0cb1('0x1b'),'fax',_0x0cb1('0x12'),_0x0cb1('0x1c'),_0x0cb1('0x1d'),'updatedAt'];var _0x2ec66f=_[_0x0cb1('0x1e')](_0x109db9,_0xdc3a39);BPromise[_0x0cb1('0x1f')]()[_0x0cb1('0x20')](cmContactRpc['getContacts']({'attributes':_0x2ec66f,'where':_0x5638ff,'phone':_0x597a57}))[_0x0cb1('0x20')](function(_0x5215d7){_0x59c936=_0x5215d7;if(!_[_0x0cb1('0x21')](_0x59c936)){if(_0x59c936[_0x0cb1('0x22')]===0x1){_0x75e7d9=_0x59c936[0x0];logger[_0x0cb1('0x9')](_0x0cb1('0x23'),_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f['id'],_0x75e7d9['id']);}else{logger[_0x0cb1('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f['id'],_[_0x0cb1('0x16')](_0x59c936,'id')[_0x0cb1('0x25')](','));}return;}else{logger[_0x0cb1('0x9')](_0x0cb1('0x26'),_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f['id']);var _0x4a45b5={'ListId':_0x3201b5};var _0x2f0cee=_0x555c10[_0x0cb1('0x27')]&&_0x555c10[_0x0cb1('0x27')]!=='0'?_0x555c10['data4']:_0x0cb1('0x14');if(_0x6b6477){logger['info'](_0x0cb1('0x28'),_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f['id']);_0x4a45b5[_0x2f0cee]=_[_0x0cb1('0xf')](_0x1c97f2[_0x0cb1('0x17')])?_0x1c97f2[_0x0cb1('0x19')]:_0x1c97f2['destcalleridnum'];if(_[_0x0cb1('0xf')](_0x1c97f2[_0x0cb1('0x17')])){_0x4a45b5[_0x0cb1('0x29')]=_0x1c97f2[_0x0cb1('0x2a')]&&_0x1c97f2['calleridname']!==''?_0x1c97f2[_0x0cb1('0x2a')]:_0x0cb1('0x2b');}else{_0x4a45b5[_0x0cb1('0x29')]=_0x1c97f2[_0x0cb1('0x2c')]&&_0x1c97f2[_0x0cb1('0x2c')]!==_0x0cb1('0x2d')?_0x1c97f2[_0x0cb1('0x2c')]:_0x0cb1('0x2b');}return BPromise[_0x0cb1('0x1f')]()[_0x0cb1('0x20')](cmContactRpc['createContact'](_0x4a45b5))[_0x0cb1('0x20')](function(_0x52e023){_0x75e7d9=_0x52e023;_0x59c936['push'](_0x52e023);if(_0x75e7d9){logger[_0x0cb1('0x9')](_0x0cb1('0x2e'),_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f['id'],_0x75e7d9['id']);}return;});}else{logger[_0x0cb1('0x9')](_0x0cb1('0x2f'),_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f['id']);_0x4a45b5[_0x2f0cee]=_['isNil'](_0x1c97f2[_0x0cb1('0x17')])?_0x1c97f2[_0x0cb1('0x19')]:_0x1c97f2[_0x0cb1('0x18')];if(_['isNil'](_0x1c97f2[_0x0cb1('0x17')])){_0x4a45b5[_0x0cb1('0x29')]=_0x1c97f2[_0x0cb1('0x2a')]&&_0x1c97f2[_0x0cb1('0x2a')]!==_0x0cb1('0x2d')?_0x1c97f2['calleridname']:_0x0cb1('0x2b');}else{_0x4a45b5[_0x0cb1('0x29')]=_0x1c97f2['destcalleridname']&&_0x1c97f2['destcalleridname']!==_0x0cb1('0x2d')?_0x1c97f2[_0x0cb1('0x2c')]:'Unknown';}_0x75e7d9=_0x4a45b5;_0x59c936['push'](_0x4a45b5);return;}}})['then'](function(){if(_0x488a4f){emit(_0x1c97f2[_0x0cb1('0x24')],_0x4eae6f,util[_0x0cb1('0x30')](_0x0cb1('0x31'),_0x488a4f[_0x0cb1('0x32')]),util[_0x0cb1('0x30')](_0x0cb1('0x33'),_0x555c10[_0x0cb1('0x34')][_0x0cb1('0x35')]()),{'evt':_['merge'](_0x1c97f2,{'autoCreate':_0x6b6477}),'contact':_0x75e7d9===undefined?{}:_0x75e7d9,'contacts':_0x59c936['length']===0x0?undefined:_0x59c936});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a226604..37548d5 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 _0xe9f2=['ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','agent','membername','lastevent','null','substatus','offlineMessage','exports','util','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','defaults','localhost','socket.io-emitter','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','stringify','motionChannel','undefined','voice','checkTriggers','status','merge','variables','Actions','interface','action','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','600','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','emit','trigger:%s','contactmanager','integration','exec','queue','routeId','urlforward','buildUri','parse','search','checkTrigger','channel','length','every','AllConditions','AnyConditions','checkConditions','field','account','chat'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe9f2,0x10f));var _0x2e9f=function(_0xe2f72f,_0x1f8854){_0xe2f72f=_0xe2f72f-0x0;var _0x146422=_0xe9f2[_0xe2f72f];return _0x146422;};'use strict';var util=require(_0x2e9f('0x0'));var _=require(_0x2e9f('0x1'));var url=require(_0x2e9f('0x2'));var Mustache=require('mustache');var Redis=require(_0x2e9f('0x3'));var urlforward=require(_0x2e9f('0x4'));var integration=require(_0x2e9f('0x5'));var cmContact=require(_0x2e9f('0x6'));var script=require(_0x2e9f('0x7'));var config=require(_0x2e9f('0x8'));var logger=require(_0x2e9f('0x9'))(_0x2e9f('0xa'));var ami=require('../ami');config['redis']=_[_0x2e9f('0xb')](config['redis'],{'host':_0x2e9f('0xc'),'port':0x18eb});var io=require(_0x2e9f('0xd'))(new Redis(config[_0x2e9f('0xe')]));var operators={'equals':function(_0xc4901f,_0x99b721){return _0xc4901f==_0x99b721;},'not_equals':function(_0x2a6e93,_0xf00746){return _0x2a6e93!=_0xf00746;}};var barAndWebActions=[_0x2e9f('0xf'),'url',_0x2e9f('0x10')];function Trigger(_0x502fc3){this[_0x2e9f('0x11')]=_0x502fc3[_0x2e9f('0x11')];this[_0x2e9f('0x12')]=_0x502fc3[_0x2e9f('0x12')];this[_0x2e9f('0x13')]=_0x502fc3[_0x2e9f('0x13')];this[_0x2e9f('0x14')]=_0x502fc3[_0x2e9f('0x14')];this[_0x2e9f('0x15')]=_0x502fc3[_0x2e9f('0x15')];this[_0x2e9f('0x16')]=_0x502fc3[_0x2e9f('0x16')];this[_0x2e9f('0x17')]=_0x502fc3[_0x2e9f('0x17')];this[_0x2e9f('0x18')]=_0x502fc3[_0x2e9f('0x18')];this[_0x2e9f('0x19')]=_0x502fc3[_0x2e9f('0x19')];this[_0x2e9f('0x1a')]=_0x502fc3['zohoAccounts'];this[_0x2e9f('0x1b')]=_0x502fc3[_0x2e9f('0x1b')];this[_0x2e9f('0x1c')]=_0x502fc3[_0x2e9f('0x1c')];this[_0x2e9f('0x1d')]=_0x502fc3[_0x2e9f('0x1d')];this[_0x2e9f('0x1e')]=_0x502fc3['dynamics365Accounts'];this['freshsalesAccounts']=_0x502fc3[_0x2e9f('0x1f')];this[_0x2e9f('0x20')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x2e9f('0x18')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x2e9f('0x19')],'zoho':this[_0x2e9f('0x1a')],'desk':this[_0x2e9f('0x1b')],'vtiger':this[_0x2e9f('0x1c')],'dynamics365':this[_0x2e9f('0x1e')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x23'),this['syncCustomEvent'][_0x2e9f('0x22')](this));ami['on']('custom:agentringnoanswer',this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x24'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x25'),this['syncCustomEvent'][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x26'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x27'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0x2e9f('0x29'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x2a'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x2b'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x2c'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x2d'),this['syncAgentDial'][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x2e'),this[_0x2e9f('0x2f')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x30'),this[_0x2e9f('0x2f')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x31'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x32'),this[_0x2e9f('0x21')]['bind'](this));ami['on'](_0x2e9f('0x33'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x34'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x2e9f('0x35'),this['syncCustomEvent']['bind'](this));ami['on'](_0x2e9f('0x36'),this[_0x2e9f('0x21')][_0x2e9f('0x22')](this));ami['on'](_0x2e9f('0x37'),this['syncCustomEvent']['bind'](this));}Trigger[_0x2e9f('0x38')]['emit']=function(_0xb03fb1,_0x4bf552,_0x49ad8e){logger['info'](_0xb03fb1,_0x4bf552,JSON[_0x2e9f('0x39')](_0x49ad8e));io['to'](_0xb03fb1)['emit'](_0x4bf552,_0x49ad8e);};Trigger['prototype'][_0x2e9f('0x21')]=function(_0x54c956){var _0x4d8afa=_['clone'](_0x54c956);if(typeof _0x4d8afa[_0x2e9f('0x3a')]===_0x2e9f('0x3b')){_0x4d8afa[_0x2e9f('0x3a')]=_0x2e9f('0x3c');}this[_0x2e9f('0x3d')](_0x4d8afa);};Trigger['prototype']['syncAgentDial']=function(_0x29639d){if(this['agents'][_0x29639d['interface']]){this[_0x2e9f('0x21')](_0x29639d);}};Trigger[_0x2e9f('0x38')]['checkTriggers']=function(_0x4dc389){var _0x1524b7;for(var _0x498fea in this[_0x2e9f('0x11')]){if(this[_0x2e9f('0x11')]['hasOwnProperty'](_0x498fea)){if(this[_0x2e9f('0x11')][_0x498fea][_0x2e9f('0x3e')]){_0x1524b7=this['checkTrigger'](this['triggers'][_0x498fea],_0x4dc389);if(_0x1524b7){_[_0x2e9f('0x3f')](_0x4dc389,_0x4dc389[_0x2e9f('0x40')]);for(var _0x34750e=0x0,_0x4f0380,_0x6874bf,_0x290fb4;_0x34750e0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x5fc3[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index aed5694..1ddf8da 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 _0xdaf5=['util','md5','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','calleridnum','contacts','/systemusers(','Bearer\x20','body','headers','odata-entityid','substring','enduserId','destcalleridnum','telephone1','&$filter=','replace','%2b','value','length','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','lastIndexOf','format','user:%s','emit','modernAuthentication','stripTrailingSlash','remoteUri','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise'];(function(_0x31e4c6,_0x27d39c){var _0x56c225=function(_0x54fb1a){while(--_0x54fb1a){_0x31e4c6['push'](_0x31e4c6['shift']());}};_0x56c225(++_0x27d39c);}(_0xdaf5,0x68));var _0x5daf=function(_0x582ccd,_0xa9ab43){_0x582ccd=_0x582ccd-0x0;var _0x11545d=_0xdaf5[_0x582ccd];return _0x11545d;};'use strict';var _=require(_0x5daf('0x0'));var rp=require(_0x5daf('0x1'));var util=require(_0x5daf('0x2'));var intUtil=require('./util');var md5=require(_0x5daf('0x3'));var Redis=require('ioredis');var logger=require(_0x5daf('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0x5daf('0x5')]=_[_0x5daf('0x6')](config[_0x5daf('0x5')],{'host':_0x5daf('0x7'),'port':0x18eb});var io=require(_0x5daf('0x8'))(new Redis(config[_0x5daf('0x5')]));function getAuthToken(_0x409acb,_0x3943c5,_0x57bcfd){if(_0x409acb['modernAuthentication']){_0x409acb['remoteUri']=_0x409acb[_0x5daf('0x9')][_0x5daf('0xa')];_0x409acb[_0x5daf('0xb')]=_0x409acb[_0x5daf('0x9')][_0x5daf('0xc')];return Promise[_0x5daf('0xd')](_0x409acb[_0x5daf('0x9')][_0x5daf('0xe')]);}var _0x1562da={'method':_0x5daf('0xf'),'uri':_0x3943c5,'form':{'client_id':_0x409acb[_0x5daf('0x10')],'resource':_0x409acb['remoteUri'],'username':_0x409acb[_0x5daf('0x11')],'password':_0x409acb[_0x5daf('0x12')],'grant_type':_0x5daf('0x12'),'client_secret':_0x409acb['clientSecret']},'json':!![]};return rp(_0x1562da)[_0x5daf('0x13')](function(_0x4ded8a){return _0x4ded8a[_0x5daf('0x14')];})['catch'](function(_0x3765fc){logger[_0x5daf('0x15')]('['+[_0x57bcfd[_0x5daf('0x16')]()]+_0x5daf('0x17'));return _0x3765fc[_0x5daf('0x18')];});}function getUser(_0x2ac79f,_0x377bf3,_0x4c7ad5,_0x2a9492,_0x14ecbb,_0x23fab1){return new Promise(function(_0x1887ba,_0x47ffe9){return getAuthToken(_0x377bf3,_0x2a9492,_0x23fab1)[_0x5daf('0x13')](function(_0x58d050){var _0x2cc45c={'method':_0x5daf('0x19'),'uri':_0x14ecbb+_0x5daf('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x58d050,'OData-Version':_0x5daf('0x1b')},'json':!![]};return rp(_0x2cc45c);})[_0x5daf('0x13')](function(_0x1f0140){var _0x4152df=_0x1f0140['value'];var _0x3141f3=![];var _0x22f725=null;if(!_[_0x5daf('0x1c')](_0x4c7ad5)){if(intUtil[_0x5daf('0x1d')](_0x4c7ad5[_0x5daf('0x1e')])){_0x2ac79f[_0x5daf('0x1f')]=_0x4c7ad5['email'];for(_0x22f725=0x0;_0x22f725<_0x4152df['length'];_0x22f725++){if(_0x4152df[_0x22f725][_0x5daf('0x20')]===_0x4c7ad5[_0x5daf('0x1e')]&&!_0x4152df[_0x22f725][_0x5daf('0x21')]){_0x3141f3=!![];logger[_0x5daf('0x22')]('['+[_0x23fab1['toUpperCase']()]+_0x5daf('0x23')+_0x4152df[_0x22f725][_0x5daf('0x24')]+'!');_0x2ac79f[_0x5daf('0x25')]=_0x4152df[_0x22f725][_0x5daf('0x24')];}}}}if(!_0x3141f3){logger['info']('['+[_0x23fab1[_0x5daf('0x16')]()]+_0x5daf('0x26'));_0x2ac79f[_0x5daf('0x1f')]=_0x377bf3[_0x5daf('0x11')];for(_0x22f725=0x0;_0x22f725<_0x4152df['length'];_0x22f725++){if(_0x4152df[_0x22f725]['internalemailaddress']===_0x377bf3[_0x5daf('0x11')]){_0x2ac79f['userId']=_0x4152df[_0x22f725]['systemuserid'];}}}_0x1887ba(_0x2ac79f);})[_0x5daf('0x27')](function(_0x2a68e3){_0x47ffe9(_0x2a68e3[_0x5daf('0x18')]);});});}function createEndUser(_0x4c9d99,_0x10c84e,_0x3f93e4,_0x585486,_0xd2c396,_0x1ce33a,_0x108bad){return new Promise(function(_0x309895,_0x436fc7){return getAuthToken(_0x10c84e,_0x3f93e4,_0x1ce33a)[_0x5daf('0x13')](function(_0x5e0a4f){var _0x58a6f9=_0x1ce33a[_0x5daf('0x28')]()===_0x5daf('0x29')?_0xd2c396['destcalleridnum']:_0xd2c396[_0x5daf('0x2a')];var _0x149e3c={'method':_0x5daf('0xf'),'uri':_0x585486+_0x5daf('0x2b'),'body':{'fullname':_0x58a6f9,'firstname':_0x58a6f9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5daf('0x2c')+_0x4c9d99[_0x5daf('0x25')]+')'},'headers':{'Authorization':_0x5daf('0x2d')+_0x5e0a4f,'OData-Version':_0x5daf('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x149e3c[_0x5daf('0x2e')][_0x108bad]=_0x58a6f9;return rp(_0x149e3c);})[_0x5daf('0x13')](function(_0x3ba7d5){var _0xeeb542=_0x3ba7d5[_0x5daf('0x2f')][_0x5daf('0x30')];var _0x198397=_0xeeb542[_0x5daf('0x31')](_0xeeb542['lastIndexOf']('(')+0x1,_0xeeb542['lastIndexOf'](')'));_0x4c9d99[_0x5daf('0x32')]=_0x198397;_0x309895(_0x4c9d99);})[_0x5daf('0x27')](function(_0x276479){_0x436fc7(_0x276479[_0x5daf('0x18')]);});});}function getEndUser(_0x5727ab,_0x22b9b5,_0x3650ef,_0x1781c5,_0x2bf9d3,_0xb28c23,_0x3512d8,_0xa0240e){var _0x39cc87=_0xb28c23[_0x5daf('0x28')]()==='outbound'?_0x2bf9d3[_0x5daf('0x33')]:_0x2bf9d3[_0x5daf('0x2a')];return getAuthToken(_0x22b9b5,_0x3650ef,_0xb28c23)[_0x5daf('0x13')](function(_0x59ab8e){_0xa0240e=_0xa0240e?_0xa0240e:_0x5daf('0x34');var _0x884cfe={'method':_0x5daf('0x19'),'uri':_0x1781c5+'contacts?$select='+_0xa0240e+_0x5daf('0x35')+_0xa0240e+'\x20eq\x20\x27'+_0x39cc87[_0x5daf('0x36')]('+',_0x5daf('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x59ab8e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x884cfe);})[_0x5daf('0x13')](function(_0x32c031){var _0x42b3ea=![];if(!_0x32c031)return _0x42b3ea;var _0x39ae1b=_0x32c031[_0x5daf('0x38')];for(var _0x4f1994=0x0;_0x4f1994<_0x39ae1b[_0x5daf('0x39')];_0x4f1994++){if(_0x39ae1b[_0x4f1994][_0xa0240e]===_0x39cc87){_0x42b3ea=!![];_0x5727ab[_0x5daf('0x32')]=_0x39ae1b[_0x4f1994][_0x5daf('0x3a')];}}return _0x42b3ea;})[_0x5daf('0x13')](function(_0xfb011d){if(_0xfb011d)return _0x5727ab;if(_0x3512d8===_0x5daf('0x3b')){logger['info']('['+[_0xb28c23[_0x5daf('0x16')]()]+_0x5daf('0x3c'));return _0x5727ab;}return createEndUser(_0x5727ab,_0x22b9b5,_0x3650ef,_0x1781c5,_0x2bf9d3,_0xb28c23,_0xa0240e)[_0x5daf('0x13')](function(_0x3cdf87){logger['info']('['+[_0xb28c23[_0x5daf('0x16')]()]+']\x20Enduser\x20created!',_0x3cdf87[_0x5daf('0x32')]);return _0x3cdf87;});});}function getCustomFields(_0x1c82f9,_0x229aee,_0x2b5dc3){var _0x2ea6da={};if(_0x1c82f9[_0x5daf('0x39')]>0x0){_[_0x5daf('0x3d')](_0x1c82f9,function(_0x4d83e8){if(_[_0x5daf('0x3e')]([_0x5daf('0x3f'),_0x5daf('0x40')],_0x4d83e8['type'])&&_0x4d83e8[_0x5daf('0x41')]&&!_0x4d83e8[_0x5daf('0x42')]){var _0x319bfa=_0x4d83e8[_0x5daf('0x43')]['toLowerCase']();var _0x9265d7=_0x319bfa[_0x5daf('0x31')](0x0,_0x319bfa[_0x5daf('0x44')]('_'));var _0x39421e=_0x319bfa[_0x5daf('0x31')](_0x319bfa[_0x5daf('0x44')]('_')+0x1);if(_0x9265d7===_0x2b5dc3){_0x2ea6da[_0x39421e]=_0x4d83e8[_0x5daf('0x45')];}}});}return _0x2ea6da;}function getTicket(_0x23f4cb,_0x512093,_0x2be5e6,_0x108a2c,_0x3a0c31,_0x5e426c,_0x3308db){return new Promise(function(_0x30a8d1,_0x435c5a){var _0x196b70;return getAuthToken(_0x512093,_0x2be5e6,_0x3308db)['then'](function(_0x274408){if(_0x5e426c[_0x5daf('0x46')]==='incident'){_0x196b70={'method':_0x5daf('0xf'),'uri':_0x108a2c+'incidents','body':Object[_0x5daf('0x47')]({},{'title':intUtil[_0x5daf('0x48')](_0x5e426c[_0x5daf('0x49')],_0x3a0c31,'\x20'),'description':intUtil[_0x5daf('0x48')](_0x5e426c[_0x5daf('0x4a')],_0x3a0c31,'\x0a'),'customerid_contact@odata.bind':_0x23f4cb['enduserId']?_0x5daf('0x4b')+_0x23f4cb[_0x5daf('0x32')]+')':undefined,'ownerid@odata.bind':_0x5daf('0x2c')+_0x23f4cb[_0x5daf('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x5e426c['Fields'],_0x3a0c31,_0x5e426c[_0x5daf('0x46')])),'headers':{'Authorization':_0x5daf('0x2d')+_0x274408,'OData-Version':_0x5daf('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5e426c['ticketType']===_0x5daf('0x4c')){var _0x5a1066=_0x23f4cb[_0x5daf('0x32')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x23f4cb['userId']+')','participationtypemask':_0x23f4cb[_0x5daf('0x4d')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5daf('0x4b')+_0x23f4cb['enduserId']+')','participationtypemask':_0x23f4cb['callDirection']===_0x5daf('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x23f4cb[_0x5daf('0x25')]+')','participationtypemask':_0x23f4cb[_0x5daf('0x4d')]==='queue'?0x2:0x1}];_0x196b70={'method':_0x5daf('0xf'),'uri':_0x108a2c+_0x5daf('0x4f'),'body':Object[_0x5daf('0x47')]({},{'subject':intUtil[_0x5daf('0x48')](_0x5e426c[_0x5daf('0x49')],_0x3a0c31,'\x20'),'phonenumber':String(_0x3a0c31[_0x5daf('0x2a')]),'description':intUtil['getString'](_0x5e426c[_0x5daf('0x4a')],_0x3a0c31,'\x0a'),'regardingobjectid_contact@odata.bind':_0x23f4cb[_0x5daf('0x32')]?_0x5daf('0x4b')+_0x23f4cb[_0x5daf('0x32')]+')':undefined,'ownerid@odata.bind':_0x5daf('0x2c')+_0x23f4cb[_0x5daf('0x25')]+')','directioncode':_0x23f4cb[_0x5daf('0x4d')]===_0x5daf('0x4e')?![]:!![],'phonecall_activity_parties':_0x5a1066},getCustomFields(_0x5e426c['Fields'],_0x3a0c31,_0x5e426c[_0x5daf('0x46')])),'headers':{'Authorization':_0x5daf('0x2d')+_0x274408,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x196b70);})['then'](function(_0x554ca7){var _0x543af7=_0x554ca7[_0x5daf('0x2f')][_0x5daf('0x30')];var _0x121730=_0x543af7[_0x5daf('0x31')](_0x543af7[_0x5daf('0x50')]('(')+0x1,_0x543af7[_0x5daf('0x50')](')'));_0x23f4cb['ticketId']=_0x121730;_0x30a8d1(_0x23f4cb);})[_0x5daf('0x27')](function(_0x3c665a){_0x435c5a(_0x3c665a['message']);});});}function emit(_0x3710f2,_0x477537,_0x43d7e8,_0x47226c){var _0x1c8032={'uri':util[_0x5daf('0x51')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3710f2,_0x43d7e8,_0x47226c)};io['to'](util[_0x5daf('0x51')](_0x5daf('0x52'),_0x477537))[_0x5daf('0x53')]('trigger:browser:url',_0x1c8032);}exports['cs']=function(_0x1f4b2b,_0x1901b6,_0x536bbc,_0x436987,_0x1913ff,_0x5a6f76,_0x1712f3,_0xbbaf03){var _0x323e0d={};_0x5a6f76['remoteUri']=_0x5a6f76[_0x5daf('0x54')]?intUtil[_0x5daf('0x55')](_0x5a6f76['CloudProvider'][_0x5daf('0xa')]):intUtil[_0x5daf('0x55')](_0x5a6f76[_0x5daf('0x56')]);_0x5a6f76[_0x5daf('0x57')]=intUtil[_0x5daf('0x55')](_0x5a6f76[_0x5daf('0x57')]);_0x323e0d[_0x5daf('0x4d')]=_0xbbaf03==='queue'||_0xbbaf03===_0x5daf('0x58')?_0x5daf('0x4e'):_0x5daf('0x29');var _0x3742f9=_0x5a6f76[_0x5daf('0x54')]?util[_0x5daf('0x51')](_0x5daf('0x59'),_0x5a6f76[_0x5daf('0x9')][_0x5daf('0xa')]):util[_0x5daf('0x51')](_0x5daf('0x59'),_0x5a6f76[_0x5daf('0x56')]);var _0x33f8ea=util[_0x5daf('0x51')](_0x5daf('0x5a'),_0x5a6f76[_0x5daf('0xb')]);var _0x2bf62a=util['format'](_0x5daf('0x5b'),_0x5a6f76['serverUrl'],_0x1901b6[_0x5daf('0x5c')],md5(_0x1901b6[_0x5daf('0x5c')]));if(_0x1913ff&&_0x1913ff[_0x5daf('0x5d')]){logger[_0x5daf('0x22')](_0x5daf('0x5e'),'Recording\x20is\x20enabled!');_0x1901b6[_0x5daf('0x5f')]=_0x2bf62a;}else if(_0x1712f3&&_0x1712f3[_0x5daf('0x60')]&&_0x1712f3[_0x5daf('0x60')]!==_0x5daf('0x61')){logger[_0x5daf('0x22')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1901b6[_0x5daf('0x5f')]=_0x2bf62a;}else{_0x1901b6[_0x5daf('0x5f')]='';}return getUser(_0x323e0d,_0x5a6f76,_0x436987,_0x33f8ea,_0x3742f9,_0xbbaf03)['then'](function(_0x5bbb65){logger[_0x5daf('0x22')]('['+_0xbbaf03['toUpperCase']()+_0x5daf('0x62'),_0x5bbb65[_0x5daf('0x25')]);logger[_0x5daf('0x22')]('['+_0xbbaf03[_0x5daf('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x5bbb65['userEmail']);return getEndUser(_0x5bbb65,_0x5a6f76,_0x33f8ea,_0x3742f9,_0x1901b6,_0xbbaf03,_0x536bbc[_0x5daf('0x63')],_0x536bbc[_0x5daf('0x64')]);})[_0x5daf('0x13')](function(_0x2ddc78){logger[_0x5daf('0x22')]('['+_0xbbaf03[_0x5daf('0x16')]()+_0x5daf('0x65'),_0x2ddc78[_0x5daf('0x32')]);logger[_0x5daf('0x22')]('['+_0xbbaf03[_0x5daf('0x16')]()+_0x5daf('0x66'),_0x1901b6[_0x5daf('0x2a')]);return getTicket(_0x2ddc78,_0x5a6f76,_0x33f8ea,_0x3742f9,_0x1901b6,_0x536bbc,_0xbbaf03);})['then'](function(_0x182dfe){logger[_0x5daf('0x22')](util[_0x5daf('0x51')]('['+_0xbbaf03[_0x5daf('0x16')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x536bbc[_0x5daf('0x46')],_0x182dfe['ticketId']));logger[_0x5daf('0x22')](util[_0x5daf('0x51')]('['+_0xbbaf03['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0xbbaf03));if(_0xbbaf03!==_0x5daf('0x58')&&_0x536bbc['openNewTab']){logger[_0x5daf('0x22')]('['+_0xbbaf03[_0x5daf('0x16')]()+']',_0x5daf('0x67'));emit(_0x5a6f76['remoteUri'],_0x436987['name'],_0x536bbc[_0x5daf('0x46')],_0x182dfe[_0x5daf('0x68')]);}})[_0x5daf('0x27')](function(_0x261324){logger[_0x5daf('0x15')]('['+_0xbbaf03[_0x5daf('0x16')]()+_0x5daf('0x69'),_0x261324[_0x5daf('0x18')]);console[_0x5daf('0x15')]('Error\x20running\x20Dynamics365\x20integration',_0x261324);});}; \ No newline at end of file +var _0x2b2d=['Descriptions','ticketId','format','user:%s','emit','data7','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','POST','clientId','username','password','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','length','internalemailaddress','message','toLowerCase','outbound','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','&$filter=','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','picklist','type','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','phonecalls'];(function(_0x2dfa90,_0x599a04){var _0x3022e7=function(_0x104754){while(--_0x104754){_0x2dfa90['push'](_0x2dfa90['shift']());}};_0x3022e7(++_0x599a04);}(_0x2b2d,0x1b8));var _0xd2b2=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0x2b2d[_0x3b0e76];return _0x1e4af4;};'use strict';var _=require(_0xd2b2('0x0'));var rp=require(_0xd2b2('0x1'));var util=require(_0xd2b2('0x2'));var intUtil=require(_0xd2b2('0x3'));var md5=require(_0xd2b2('0x4'));var Redis=require(_0xd2b2('0x5'));var logger=require(_0xd2b2('0x6'))('dynamics365');var config=require('../../../../config/environment');config[_0xd2b2('0x7')]=_[_0xd2b2('0x8')](config['redis'],{'host':_0xd2b2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2b2('0x7')]));function getAuthToken(_0x336a58,_0x55b5c7,_0x144891){if(_0x336a58[_0xd2b2('0xa')]){_0x336a58[_0xd2b2('0xb')]=_0x336a58[_0xd2b2('0xc')]['data7'];_0x336a58[_0xd2b2('0xd')]=_0x336a58[_0xd2b2('0xc')][_0xd2b2('0xe')];return Promise[_0xd2b2('0xf')](_0x336a58[_0xd2b2('0xc')]['data5']);}var _0x53a34b={'method':_0xd2b2('0x10'),'uri':_0x55b5c7,'form':{'client_id':_0x336a58[_0xd2b2('0x11')],'resource':_0x336a58['remoteUri'],'username':_0x336a58[_0xd2b2('0x12')],'password':_0x336a58[_0xd2b2('0x13')],'grant_type':_0xd2b2('0x13'),'client_secret':_0x336a58['clientSecret']},'json':!![]};return rp(_0x53a34b)['then'](function(_0x2891f6){return _0x2891f6[_0xd2b2('0x14')];})[_0xd2b2('0x15')](function(_0xc83412){logger[_0xd2b2('0x16')]('['+[_0x144891[_0xd2b2('0x17')]()]+_0xd2b2('0x18'));return _0xc83412['message'];});}function getUser(_0x198208,_0xa02f93,_0x37a8fa,_0x1dcc3b,_0x334e00,_0x3b1e73){return new Promise(function(_0x47301f,_0x2a9e18){return getAuthToken(_0xa02f93,_0x1dcc3b,_0x3b1e73)[_0xd2b2('0x19')](function(_0x388877){var _0x280acd={'method':_0xd2b2('0x1a'),'uri':_0x334e00+_0xd2b2('0x1b'),'headers':{'Authorization':_0xd2b2('0x1c')+_0x388877,'OData-Version':_0xd2b2('0x1d')},'json':!![]};return rp(_0x280acd);})[_0xd2b2('0x19')](function(_0x2337f6){var _0x2e24ab=_0x2337f6[_0xd2b2('0x1e')];var _0x36e4d2=![];var _0xf34e66=null;if(!_[_0xd2b2('0x1f')](_0x37a8fa)){if(intUtil[_0xd2b2('0x20')](_0x37a8fa[_0xd2b2('0x21')])){_0x198208[_0xd2b2('0x22')]=_0x37a8fa[_0xd2b2('0x21')];for(_0xf34e66=0x0;_0xf34e66<_0x2e24ab['length'];_0xf34e66++){if(_0x2e24ab[_0xf34e66]['internalemailaddress']===_0x37a8fa[_0xd2b2('0x21')]&&!_0x2e24ab[_0xf34e66][_0xd2b2('0x23')]){_0x36e4d2=!![];logger[_0xd2b2('0x24')]('['+[_0x3b1e73[_0xd2b2('0x17')]()]+_0xd2b2('0x25')+_0x2e24ab[_0xf34e66]['systemuserid']+'!');_0x198208[_0xd2b2('0x26')]=_0x2e24ab[_0xf34e66][_0xd2b2('0x27')];}}}}if(!_0x36e4d2){logger['info']('['+[_0x3b1e73[_0xd2b2('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x198208[_0xd2b2('0x22')]=_0xa02f93[_0xd2b2('0x12')];for(_0xf34e66=0x0;_0xf34e66<_0x2e24ab[_0xd2b2('0x28')];_0xf34e66++){if(_0x2e24ab[_0xf34e66][_0xd2b2('0x29')]===_0xa02f93[_0xd2b2('0x12')]){_0x198208['userId']=_0x2e24ab[_0xf34e66]['systemuserid'];}}}_0x47301f(_0x198208);})[_0xd2b2('0x15')](function(_0x399a3e){_0x2a9e18(_0x399a3e[_0xd2b2('0x2a')]);});});}function createEndUser(_0x358708,_0x3e2aae,_0x512506,_0x14859e,_0x4c9cb9,_0x174f2d,_0x3200cf){return new Promise(function(_0x553d17,_0x2f6ccb){return getAuthToken(_0x3e2aae,_0x512506,_0x174f2d)[_0xd2b2('0x19')](function(_0x250be4){var _0x26f2c1=_0x174f2d[_0xd2b2('0x2b')]()===_0xd2b2('0x2c')?_0x4c9cb9['destcalleridnum']:_0x4c9cb9[_0xd2b2('0x2d')];var _0x5df6cc={'method':_0xd2b2('0x10'),'uri':_0x14859e+_0xd2b2('0x2e'),'body':{'fullname':_0x26f2c1,'firstname':_0x26f2c1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd2b2('0x2f')+_0x358708[_0xd2b2('0x26')]+')'},'headers':{'Authorization':_0xd2b2('0x1c')+_0x250be4,'OData-Version':_0xd2b2('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x5df6cc[_0xd2b2('0x30')][_0x3200cf]=_0x26f2c1;return rp(_0x5df6cc);})[_0xd2b2('0x19')](function(_0x590c6d){var _0x411d66=_0x590c6d[_0xd2b2('0x31')][_0xd2b2('0x32')];var _0x28fa26=_0x411d66[_0xd2b2('0x33')](_0x411d66[_0xd2b2('0x34')]('(')+0x1,_0x411d66[_0xd2b2('0x34')](')'));_0x358708[_0xd2b2('0x35')]=_0x28fa26;_0x553d17(_0x358708);})[_0xd2b2('0x15')](function(_0x535124){_0x2f6ccb(_0x535124[_0xd2b2('0x2a')]);});});}function getEndUser(_0x7e9dd5,_0xd31a7a,_0xa8da2,_0x43317d,_0x4b68f5,_0x43fef1,_0x92675f,_0x555ad6){var _0x3c8884=_0x43fef1[_0xd2b2('0x2b')]()==='outbound'?_0x4b68f5[_0xd2b2('0x36')]:_0x4b68f5[_0xd2b2('0x2d')];return getAuthToken(_0xd31a7a,_0xa8da2,_0x43fef1)['then'](function(_0x6cf550){_0x555ad6=_0x555ad6?_0x555ad6:_0xd2b2('0x37');var _0x523e42={'method':_0xd2b2('0x1a'),'uri':_0x43317d+'contacts?$select='+_0x555ad6+_0xd2b2('0x38')+_0x555ad6+'\x20eq\x20\x27'+_0x3c8884['replace']('+',_0xd2b2('0x39'))+'\x27','headers':{'Authorization':_0xd2b2('0x1c')+_0x6cf550,'If-None-Match':null,'OData-Version':_0xd2b2('0x1d')},'json':!![]};return rp(_0x523e42);})[_0xd2b2('0x19')](function(_0x504d88){var _0x3f7928=![];if(!_0x504d88)return _0x3f7928;var _0x3ae472=_0x504d88[_0xd2b2('0x1e')];for(var _0xe7cb9b=0x0;_0xe7cb9b<_0x3ae472[_0xd2b2('0x28')];_0xe7cb9b++){if(_0x3ae472[_0xe7cb9b][_0x555ad6]===_0x3c8884){_0x3f7928=!![];_0x7e9dd5['enduserId']=_0x3ae472[_0xe7cb9b][_0xd2b2('0x3a')];}}return _0x3f7928;})[_0xd2b2('0x19')](function(_0x2fb0b0){if(_0x2fb0b0)return _0x7e9dd5;if(_0x92675f===_0xd2b2('0x3b')){logger[_0xd2b2('0x24')]('['+[_0x43fef1[_0xd2b2('0x17')]()]+_0xd2b2('0x3c'));return _0x7e9dd5;}return createEndUser(_0x7e9dd5,_0xd31a7a,_0xa8da2,_0x43317d,_0x4b68f5,_0x43fef1,_0x555ad6)[_0xd2b2('0x19')](function(_0x508eb9){logger[_0xd2b2('0x24')]('['+[_0x43fef1[_0xd2b2('0x17')]()]+']\x20Enduser\x20created!',_0x508eb9[_0xd2b2('0x35')]);return _0x508eb9;});});}function getCustomFields(_0x1e3613,_0x1c349e,_0x3ae730){var _0x769650={};if(_0x1e3613[_0xd2b2('0x28')]>0x0){_[_0xd2b2('0x3d')](_0x1e3613,function(_0x32ed7f){if(_['includes']([_0xd2b2('0x3e'),_0xd2b2('0x3f')],_0x32ed7f[_0xd2b2('0x40')])&&_0x32ed7f['nameField']&&!_0x32ed7f[_0xd2b2('0x41')]){var _0x4f108f=_0x32ed7f[_0xd2b2('0x42')]['toLowerCase']();var _0x22198f=_0x4f108f['substring'](0x0,_0x4f108f[_0xd2b2('0x43')]('_'));var _0x58eea6=_0x4f108f[_0xd2b2('0x33')](_0x4f108f[_0xd2b2('0x43')]('_')+0x1);if(_0x22198f===_0x3ae730){_0x769650[_0x58eea6]=_0x32ed7f['content'];}}});}return _0x769650;}function getTicket(_0x531612,_0x234212,_0x2282c7,_0x41f6fd,_0x2a4946,_0x2b88e8,_0x46ebf5){return new Promise(function(_0x1c0f56,_0x2f32e2){var _0x24de58;return getAuthToken(_0x234212,_0x2282c7,_0x46ebf5)[_0xd2b2('0x19')](function(_0xac90be){if(_0x2b88e8[_0xd2b2('0x44')]===_0xd2b2('0x45')){_0x24de58={'method':_0xd2b2('0x10'),'uri':_0x41f6fd+_0xd2b2('0x46'),'body':Object[_0xd2b2('0x47')]({},{'title':intUtil[_0xd2b2('0x48')](_0x2b88e8[_0xd2b2('0x49')],_0x2a4946,'\x20'),'description':intUtil[_0xd2b2('0x48')](_0x2b88e8['Descriptions'],_0x2a4946,'\x0a'),'customerid_contact@odata.bind':_0x531612[_0xd2b2('0x35')]?_0xd2b2('0x4a')+_0x531612['enduserId']+')':undefined,'ownerid@odata.bind':_0xd2b2('0x2f')+_0x531612[_0xd2b2('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x2b88e8[_0xd2b2('0x4b')],_0x2a4946,_0x2b88e8[_0xd2b2('0x44')])),'headers':{'Authorization':_0xd2b2('0x1c')+_0xac90be,'OData-Version':_0xd2b2('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2b88e8['ticketType']===_0xd2b2('0x4c')){var _0x72f2de=_0x531612['enduserId']?[{'partyid_systemuser@odata.bind':_0xd2b2('0x2f')+_0x531612[_0xd2b2('0x26')]+')','participationtypemask':_0x531612[_0xd2b2('0x4d')]===_0xd2b2('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0xd2b2('0x4a')+_0x531612[_0xd2b2('0x35')]+')','participationtypemask':_0x531612['callDirection']===_0xd2b2('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd2b2('0x2f')+_0x531612[_0xd2b2('0x26')]+')','participationtypemask':_0x531612['callDirection']===_0xd2b2('0x4e')?0x2:0x1}];_0x24de58={'method':_0xd2b2('0x10'),'uri':_0x41f6fd+_0xd2b2('0x4f'),'body':Object[_0xd2b2('0x47')]({},{'subject':intUtil['getString'](_0x2b88e8[_0xd2b2('0x49')],_0x2a4946,'\x20'),'phonenumber':String(_0x2a4946[_0xd2b2('0x2d')]),'description':intUtil[_0xd2b2('0x48')](_0x2b88e8[_0xd2b2('0x50')],_0x2a4946,'\x0a'),'regardingobjectid_contact@odata.bind':_0x531612[_0xd2b2('0x35')]?_0xd2b2('0x4a')+_0x531612[_0xd2b2('0x35')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x531612[_0xd2b2('0x26')]+')','directioncode':_0x531612['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x72f2de},getCustomFields(_0x2b88e8[_0xd2b2('0x4b')],_0x2a4946,_0x2b88e8[_0xd2b2('0x44')])),'headers':{'Authorization':_0xd2b2('0x1c')+_0xac90be,'OData-Version':_0xd2b2('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x24de58);})[_0xd2b2('0x19')](function(_0x3a3aa8){var _0x32190f=_0x3a3aa8[_0xd2b2('0x31')][_0xd2b2('0x32')];var _0x450c34=_0x32190f[_0xd2b2('0x33')](_0x32190f[_0xd2b2('0x34')]('(')+0x1,_0x32190f[_0xd2b2('0x34')](')'));_0x531612[_0xd2b2('0x51')]=_0x450c34;_0x1c0f56(_0x531612);})[_0xd2b2('0x15')](function(_0x6dbdf0){_0x2f32e2(_0x6dbdf0[_0xd2b2('0x2a')]);});});}function emit(_0x1947cf,_0x27bfe8,_0x282060,_0x1306c3){var _0x369c0b={'uri':util[_0xd2b2('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1947cf,_0x282060,_0x1306c3)};io['to'](util[_0xd2b2('0x52')](_0xd2b2('0x53'),_0x27bfe8))[_0xd2b2('0x54')]('trigger:browser:url',_0x369c0b);}exports['cs']=function(_0x48c225,_0x45af7a,_0x253ce2,_0x215391,_0x32d7aa,_0x4907dc,_0x1f583d,_0x32b2d0){var _0x49ce47={};_0x4907dc[_0xd2b2('0xb')]=_0x4907dc[_0xd2b2('0xa')]?intUtil['stripTrailingSlash'](_0x4907dc[_0xd2b2('0xc')][_0xd2b2('0x55')]):intUtil[_0xd2b2('0x56')](_0x4907dc['remoteUri']);_0x4907dc[_0xd2b2('0x57')]=intUtil['stripTrailingSlash'](_0x4907dc['serverUrl']);_0x49ce47[_0xd2b2('0x4d')]=_0x32b2d0==='queue'||_0x32b2d0==='unmanaged'?_0xd2b2('0x4e'):_0xd2b2('0x2c');var _0x263109=_0x4907dc[_0xd2b2('0xa')]?util[_0xd2b2('0x52')]('%s/api/data/v9.0/',_0x4907dc[_0xd2b2('0xc')][_0xd2b2('0x55')]):util[_0xd2b2('0x52')](_0xd2b2('0x58'),_0x4907dc[_0xd2b2('0xb')]);var _0x6e4a6b=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x4907dc[_0xd2b2('0xd')]);var _0x467b2c=util[_0xd2b2('0x52')](_0xd2b2('0x59'),_0x4907dc[_0xd2b2('0x57')],_0x45af7a[_0xd2b2('0x5a')],md5(_0x45af7a['uniqueid']));if(_0x32d7aa&&_0x32d7aa[_0xd2b2('0x5b')]){logger[_0xd2b2('0x24')](_0xd2b2('0x5c'),_0xd2b2('0x5d'));_0x45af7a[_0xd2b2('0x5e')]=_0x467b2c;}else if(_0x1f583d&&_0x1f583d[_0xd2b2('0x5f')]&&_0x1f583d[_0xd2b2('0x5f')]!==_0xd2b2('0x60')){logger[_0xd2b2('0x24')](_0xd2b2('0x61'),_0xd2b2('0x5d'));_0x45af7a[_0xd2b2('0x5e')]=_0x467b2c;}else{_0x45af7a[_0xd2b2('0x5e')]='';}return getUser(_0x49ce47,_0x4907dc,_0x215391,_0x6e4a6b,_0x263109,_0x32b2d0)[_0xd2b2('0x19')](function(_0x1f6732){logger['info']('['+_0x32b2d0[_0xd2b2('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x1f6732[_0xd2b2('0x26')]);logger['info']('['+_0x32b2d0[_0xd2b2('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x1f6732[_0xd2b2('0x22')]);return getEndUser(_0x1f6732,_0x4907dc,_0x6e4a6b,_0x263109,_0x45af7a,_0x32b2d0,_0x253ce2['moduleCreate'],_0x253ce2[_0xd2b2('0x62')]);})['then'](function(_0x551509){logger[_0xd2b2('0x24')]('['+_0x32b2d0[_0xd2b2('0x17')]()+_0xd2b2('0x63'),_0x551509[_0xd2b2('0x35')]);logger[_0xd2b2('0x24')]('['+_0x32b2d0[_0xd2b2('0x17')]()+_0xd2b2('0x64'),_0x45af7a[_0xd2b2('0x2d')]);return getTicket(_0x551509,_0x4907dc,_0x6e4a6b,_0x263109,_0x45af7a,_0x253ce2,_0x32b2d0);})[_0xd2b2('0x19')](function(_0x49cc02){logger[_0xd2b2('0x24')](util[_0xd2b2('0x52')]('['+_0x32b2d0['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x253ce2[_0xd2b2('0x44')],_0x49cc02['ticketId']));logger['info'](util[_0xd2b2('0x52')]('['+_0x32b2d0['toUpperCase']()+_0xd2b2('0x65'),_0x32b2d0));if(_0x32b2d0!==_0xd2b2('0x66')&&_0x253ce2['openNewTab']){logger[_0xd2b2('0x24')]('['+_0x32b2d0[_0xd2b2('0x17')]()+']',_0xd2b2('0x67'));emit(_0x4907dc['remoteUri'],_0x215391['name'],_0x253ce2[_0xd2b2('0x44')],_0x49cc02[_0xd2b2('0x51')]);}})['catch'](function(_0x228592){logger[_0xd2b2('0x16')]('['+_0x32b2d0['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x228592[_0xd2b2('0x2a')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x228592);});}; \ 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 2e5fd93..577c548 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 _0x4505=['stringify','GET','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]','user:%s','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','defaults','redis','application/json','emit','merge','format','Caller\x20-\x20%s','getString','Subjects','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','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'];(function(_0x53360d,_0x1f2dc4){var _0x5b86f7=function(_0x4fe27f){while(--_0x4fe27f){_0x53360d['push'](_0x53360d['shift']());}};_0x5b86f7(++_0x1f2dc4);}(_0x4505,0x13a));var _0x5450=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x4505[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x5450('0x0'));var rp=require(_0x5450('0x1'));var md5=require(_0x5450('0x2'));var util=require(_0x5450('0x3'));var Redis=require(_0x5450('0x4'));var intUtil=require('./util');var config=require(_0x5450('0x5'));var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x5450('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5450('0x7')]));var headers={'Content-Type':_0x5450('0x8'),'Accept':_0x5450('0x8')};function emit(_0x2f4dfb,_0x3272f6,_0x32efbe){io['to'](_0x2f4dfb)[_0x5450('0x9')](_0x3272f6,_0x32efbe);}function getTicket(_0x568125,_0x43a0aa,_0x3b1d6d,_0x4f2128,_0x4f7c2d){logger['info']('Creating\x20new\x20ticket...');var _0x23f7ac=_[_0x5450('0xa')]({'responder_id':_0x43a0aa['id'],'requester_id':_0x3b1d6d['id'],'name':util[_0x5450('0xb')](_0x5450('0xc'),_0x4f7c2d['calleridname']),'phone':_0x4f7c2d['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5450('0xd')](_0x4f2128[_0x5450('0xe')],_0x4f7c2d,'\x20'),'description':intUtil[_0x5450('0xd')](_0x4f2128['Descriptions'],_0x4f7c2d,'
'),'tags':getTags(_0x4f2128[_0x5450('0xf')],_0x5450('0x10'))},getCustomFields(_0x4f2128['Fields'],_0x4f7c2d));_0x23f7ac[_0x5450('0x11')]=_[_0x5450('0x12')](_['keyBy'](_0x23f7ac['custom_fields'],'id'),_0x5450('0x13'));return request({'uri':util[_0x5450('0xb')](_0x5450('0x14'),_0x568125[_0x5450('0x15')]),'method':_0x5450('0x16'),'body':_0x23f7ac})[_0x5450('0x17')](function(_0x45ae96){logger[_0x5450('0x18')](_0x5450('0x19'));return _0x45ae96;});}function getUser(_0x1bc22c,_0x4a13fe){if(intUtil[_0x5450('0x1a')](_0x4a13fe)){return request({'uri':util[_0x5450('0xb')](_0x5450('0x1b'),_0x1bc22c['remoteUri']),'qs':{'email':_0x4a13fe}})[_0x5450('0x17')](function(_0xea8e37){if(_0xea8e37[_0x5450('0x1c')]){logger['info'](_0x5450('0x1d'));return _[_0x5450('0x1e')](_0xea8e37,function(_0x19acb4){return _0x19acb4[_0x5450('0x1f')][_0x5450('0x20')]===_0x4a13fe;});}else{logger[_0x5450('0x18')](_0x5450('0x21'));return request({'uri':util[_0x5450('0xb')]('%s/api/v2/agents/me',_0x1bc22c[_0x5450('0x15')])})[_0x5450('0x17')](function(_0x37d7cc){logger['info'](_0x5450('0x22'));return _0x37d7cc;});}});}else{logger[_0x5450('0x18')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5450('0xb')](_0x5450('0x23'),_0x1bc22c[_0x5450('0x15')])})[_0x5450('0x17')](function(_0x2365f9){logger[_0x5450('0x18')](_0x5450('0x22'));return _0x2365f9;});}}function getEndUser(_0x4b9434,_0xe29c8c,_0x56961e){logger['info'](_0x5450('0x24'),_0x56961e);return request({'uri':util[_0x5450('0xb')](_0x5450('0x25'),_0x4b9434[_0x5450('0x15')]),'qs':{'phone':_0x56961e}})['then'](function(_0x3ef6c9){if(_0x3ef6c9[_0x5450('0x1c')]){logger[_0x5450('0x18')](_0x5450('0x26'));return _[_0x5450('0x1e')](_0x3ef6c9,{'phone':_0x56961e});}else{logger[_0x5450('0x18')](_0x5450('0x27'));return request({'uri':util[_0x5450('0xb')](_0x5450('0x25'),_0x4b9434[_0x5450('0x15')]),'method':_0x5450('0x16'),'body':{'name':_0xe29c8c,'phone':_0x56961e}})['then'](function(_0x2ac3b7){logger['info'](_0x5450('0x28'));return _0x2ac3b7;});}});}function getAuth(_0x46f72c){return util[_0x5450('0xb')](_0x5450('0x29'),new Buffer(_0x46f72c[_0x5450('0x2a')]+':X')[_0x5450('0x2b')](_0x5450('0x2c')));}function request(_0x37bc1a){logger[_0x5450('0x2d')]('[HTTP]',JSON[_0x5450('0x2e')](_0x37bc1a));return rp(_['defaults'](_0x37bc1a,{'method':_0x5450('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x34ee9f,_0x349f7c){var _0x114e44=[];if(_0x34ee9f&&_0x34ee9f[_0x5450('0x1c')]>0x0){_0x114e44=_['map'](_0x34ee9f,_0x349f7c);}return _0x114e44;}function getCustomFields(_0x36059e,_0x1adc59){var _0x56ed83=[];var _0x45259f={'custom_fields':[]};if(_0x36059e[_0x5450('0x1c')]>0x0){_[_0x5450('0x30')](_0x36059e,function(_0x15919f){if(_[_0x5450('0x31')]([_0x5450('0x32'),_0x5450('0x33')],_0x15919f[_0x5450('0x34')])&&_0x15919f['nameField']&&!_0x15919f[_0x5450('0x35')]){_0x45259f[_0x15919f[_0x5450('0x36')][_0x5450('0x37')]()]=_0x15919f[_0x5450('0x38')][_0x5450('0x2b')]();}else if(_[_0x5450('0x31')]([_0x5450('0x32'),_0x5450('0x33')],_0x15919f[_0x5450('0x34')])&&_0x15919f[_0x5450('0x39')]&&_0x15919f[_0x5450('0x35')]){_0x45259f[_0x5450('0x11')][_0x5450('0x3a')]({'id':_0x15919f[_0x5450('0x39')],'value':_0x15919f[_0x5450('0x38')]['toString']()});}else if(_0x15919f[_0x5450('0x34')]===_0x5450('0x3b')&&_0x15919f['variableName']&&_0x15919f[_0x5450('0x39')]&&_0x15919f[_0x5450('0x35')]){_0x1adc59[_0x15919f[_0x5450('0x3c')]]&&_0x45259f[_0x5450('0x11')][_0x5450('0x3a')]({'id':_0x15919f['idField'],'value':_0x1adc59[_0x15919f[_0x5450('0x3c')]][_0x5450('0x2b')]()});}else if(_0x15919f[_0x5450('0x34')]===_0x5450('0x3d')&&_0x15919f[_0x5450('0x3e')]&&_0x15919f[_0x5450('0x3e')]['name']&&_0x15919f['idField']&&_0x15919f['customField']){_0x1adc59[_0x15919f[_0x5450('0x3e')][_0x5450('0x10')][_0x5450('0x37')]()]&&_0x45259f[_0x5450('0x11')][_0x5450('0x3a')]({'id':_0x15919f[_0x5450('0x39')],'value':_0x1adc59[_0x15919f[_0x5450('0x3e')][_0x5450('0x10')][_0x5450('0x37')]()]['toString']()});}});}return _0x45259f;}exports[_0x5450('0x3f')]=function(_0x5a3437,_0x8260ab,_0x210090,_0xb1e30c,_0x436161,_0x16c71d){var _0x2df87c,_0x229c7d;_0x16c71d['remoteUri']=intUtil['stripTrailingSlash'](_0x16c71d[_0x5450('0x15')]);_0x16c71d['serverUrl']=intUtil[_0x5450('0x40')](_0x16c71d['serverUrl']);if(_0x436161&&_0x436161[_0x5450('0x41')]){logger[_0x5450('0x18')](_0x5450('0x42'),_0x5450('0x43'));_0x8260ab['recordingURL']=util['format'](_0x5450('0x44'),_0x16c71d[_0x5450('0x45')],_0x8260ab[_0x5450('0x46')],md5(_0x8260ab[_0x5450('0x46')]));}else{_0x8260ab[_0x5450('0x47')]='';}headers[_0x5450('0x48')]=getAuth(_0x16c71d);return getUser(_0x16c71d,_0xb1e30c['email'])[_0x5450('0x17')](function(_0x513309){_0x2df87c=_0x513309;logger[_0x5450('0x18')](_0x5450('0x49'),_0x2df87c['id']);return getEndUser(_0x16c71d,_0x8260ab[_0x5450('0x4a')],_0x8260ab[_0x5450('0x4b')]);})['then'](function(_0x1e55ab){_0x229c7d=_0x1e55ab;logger[_0x5450('0x18')](_0x5450('0x4c'),_0x229c7d['id']);return getTicket(_0x16c71d,_0x2df87c,_0x229c7d,_0x210090,_0x8260ab);})[_0x5450('0x17')](function(_0x21fd42){if(_0x21fd42&&_0x21fd42['id']){logger[_0x5450('0x18')](_0x5450('0x19'));logger[_0x5450('0x18')](_0x5450('0x4d'),_0x21fd42['id']);logger[_0x5450('0x18')](_0x5450('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5450('0xb')]('user:%s',_0xb1e30c[_0x5450('0x10')]),_0x5450('0x4e'),{'uri':util['format'](_0x5450('0x4f'),_0x16c71d['remoteUri'],_0x21fd42['id'])});}})[_0x5450('0x50')](function(_0x5f28f4){logger[_0x5450('0x51')](_0x5450('0x42'),JSON[_0x5450('0x2e')](_0x5f28f4));});};exports[_0x5450('0x52')]=function(_0x252dd7,_0x29edc4,_0x297741,_0x22939a,_0x19b146,_0x55ccac,_0xd59b51){var _0xb22d4b,_0x41fc8d;_0x55ccac[_0x5450('0x15')]=intUtil[_0x5450('0x40')](_0x55ccac['remoteUri']);_0x55ccac['serverUrl']=intUtil[_0x5450('0x40')](_0x55ccac[_0x5450('0x45')]);if(_0xd59b51&&_0xd59b51[_0x5450('0x53')]&&_0xd59b51[_0x5450('0x53')]!==_0x5450('0x54')){logger['info']('[OUTBOUND]',_0x5450('0x43'));_0x29edc4[_0x5450('0x47')]=util['format'](_0x5450('0x44'),_0x55ccac['serverUrl'],_0x29edc4[_0x5450('0x46')],md5(_0x29edc4[_0x5450('0x46')]));}headers[_0x5450('0x48')]=getAuth(_0x55ccac);return getUser(_0x55ccac,_0x22939a['email'])['then'](function(_0x482b86){_0xb22d4b=_0x482b86;logger[_0x5450('0x18')]('The\x20User\x20ID\x20is:',_0xb22d4b['id']);return getEndUser(_0x55ccac,_0x29edc4[_0x5450('0x55')],_0x29edc4['destcalleridnum']);})['then'](function(_0x567884){_0x41fc8d=_0x567884;logger['info'](_0x5450('0x4c'),_0x41fc8d['id']);return getTicket(_0x55ccac,_0xb22d4b,_0x41fc8d,_0x297741,_0x29edc4);})['then'](function(_0x56fb8b){if(_0x56fb8b&&_0x56fb8b['id']){logger[_0x5450('0x18')]('Ticket\x20created!');logger[_0x5450('0x18')](_0x5450('0x4d'),_0x56fb8b['id']);logger[_0x5450('0x18')](_0x5450('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5450('0xb')](_0x5450('0x57'),_0x22939a[_0x5450('0x10')]),_0x5450('0x4e'),{'uri':util[_0x5450('0xb')]('%s/helpdesk/tickets/%d',_0x55ccac[_0x5450('0x15')],_0x56fb8b['id'])});}})[_0x5450('0x50')](function(_0x2f4d9b){logger['error'](_0x5450('0x56'),JSON[_0x5450('0x2e')](_0x2f4d9b));});};exports[_0x5450('0x58')]=function(_0x5c26ab,_0xc684a,_0x10a979,_0x14fa11,_0xd8b327,_0x3e19de){var _0xee082e,_0x30dd19;_0x3e19de[_0x5450('0x15')]=intUtil[_0x5450('0x40')](_0x3e19de[_0x5450('0x15')]);_0x3e19de[_0x5450('0x45')]=intUtil['stripTrailingSlash'](_0x3e19de[_0x5450('0x45')]);if(_0xd8b327&&_0xd8b327[_0x5450('0x41')]){logger[_0x5450('0x18')]('['+_0xc684a[_0x5450('0x59')]['toUpperCase']()+']',_0x5450('0x43'));_0xc684a[_0x5450('0x47')]=util['format'](_0x5450('0x44'),_0x3e19de[_0x5450('0x45')],_0xc684a['uniqueid'],md5(_0xc684a['uniqueid']));}else{_0xc684a['recordingURL']='';}headers[_0x5450('0x48')]=getAuth(_0x3e19de);return getUser(_0x3e19de,'')[_0x5450('0x17')](function(_0x55fefd){_0xee082e=_0x55fefd;logger[_0x5450('0x18')](_0x5450('0x49'),_0xee082e['id']);return getEndUser(_0x3e19de,_0xc684a[_0x5450('0x4a')],_0xc684a[_0x5450('0x4b')]);})[_0x5450('0x17')](function(_0x5bb7f2){_0x30dd19=_0x5bb7f2;logger[_0x5450('0x18')](_0x5450('0x4c'),_0x30dd19['id']);return getTicket(_0x3e19de,_0xee082e,_0x30dd19,_0x10a979,_0xc684a);})[_0x5450('0x17')](function(_0x2ba430){if(_0x2ba430){logger[_0x5450('0x18')](_0x5450('0x19'));logger[_0x5450('0x18')](_0x5450('0x4d'),_0x2ba430['id']);}})[_0x5450('0x50')](function(_0x955895){logger[_0x5450('0x51')]('['+_0xc684a[_0x5450('0x59')]['toUpperCase']()+']',JSON[_0x5450('0x2e')](_0x955895));});}; \ No newline at end of file +var _0x76ea=['./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','string','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Authorization','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x76ea,0x1c3));var _0xa76e=function(_0x3c0d7e,_0x267014){_0x3c0d7e=_0x3c0d7e-0x0;var _0x2aca37=_0x76ea[_0x3c0d7e];return _0x2aca37;};'use strict';var _=require('lodash');var rp=require(_0xa76e('0x0'));var md5=require(_0xa76e('0x1'));var util=require(_0xa76e('0x2'));var Redis=require(_0xa76e('0x3'));var intUtil=require(_0xa76e('0x4'));var config=require(_0xa76e('0x5'));var logger=require('../../../../config/logger')(_0xa76e('0x6'));config[_0xa76e('0x7')]=_['defaults'](config['redis'],{'host':_0xa76e('0x8'),'port':0x18eb});var io=require(_0xa76e('0x9'))(new Redis(config[_0xa76e('0x7')]));var headers={'Content-Type':_0xa76e('0xa'),'Accept':_0xa76e('0xa')};function emit(_0x2cf1f6,_0x4a9d68,_0x46854f){io['to'](_0x2cf1f6)['emit'](_0x4a9d68,_0x46854f);}function getTicket(_0x3745eb,_0x2d37cc,_0x53de59,_0xfa05f3,_0x547f94){logger[_0xa76e('0xb')](_0xa76e('0xc'));var _0x550add=_[_0xa76e('0xd')]({'responder_id':_0x2d37cc['id'],'requester_id':_0x53de59['id'],'name':util[_0xa76e('0xe')]('Caller\x20-\x20%s',_0x547f94[_0xa76e('0xf')]),'phone':_0x547f94[_0xa76e('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xa76e('0x11')](_0xfa05f3[_0xa76e('0x12')],_0x547f94,'\x20'),'description':intUtil['getString'](_0xfa05f3[_0xa76e('0x13')],_0x547f94,_0xa76e('0x14')),'tags':getTags(_0xfa05f3[_0xa76e('0x15')],_0xa76e('0x16'))},getCustomFields(_0xfa05f3[_0xa76e('0x17')],_0x547f94));_0x550add[_0xa76e('0x18')]=_[_0xa76e('0x19')](_[_0xa76e('0x1a')](_0x550add[_0xa76e('0x18')],'id'),'value');return request({'uri':util['format'](_0xa76e('0x1b'),_0x3745eb[_0xa76e('0x1c')]),'method':_0xa76e('0x1d'),'body':_0x550add})[_0xa76e('0x1e')](function(_0x114f3a){logger[_0xa76e('0xb')]('Ticket\x20created!');return _0x114f3a;});}function getUser(_0x2bfa79,_0x25ef07){if(intUtil[_0xa76e('0x1f')](_0x25ef07)){return request({'uri':util['format']('%s/api/v2/agents',_0x2bfa79['remoteUri']),'qs':{'email':_0x25ef07}})[_0xa76e('0x1e')](function(_0x315a4c){if(_0x315a4c['length']){logger[_0xa76e('0xb')](_0xa76e('0x20'));return _[_0xa76e('0x21')](_0x315a4c,function(_0x4c0e4d){return _0x4c0e4d[_0xa76e('0x22')][_0xa76e('0x23')]===_0x25ef07;});}else{logger[_0xa76e('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa76e('0xe')](_0xa76e('0x24'),_0x2bfa79['remoteUri'])})['then'](function(_0x47ccd2){logger[_0xa76e('0xb')](_0xa76e('0x25'));return _0x47ccd2;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa76e('0xe')](_0xa76e('0x24'),_0x2bfa79[_0xa76e('0x1c')])})[_0xa76e('0x1e')](function(_0x2750da){logger[_0xa76e('0xb')](_0xa76e('0x25'));return _0x2750da;});}}function getEndUser(_0x4b5229,_0x48579e,_0x224c32){logger['info'](_0xa76e('0x26'),_0x224c32);return request({'uri':util[_0xa76e('0xe')]('%s/api/v2/contacts',_0x4b5229['remoteUri']),'qs':{'phone':_0x224c32}})[_0xa76e('0x1e')](function(_0x153159){if(_0x153159[_0xa76e('0x27')]){logger['info']('Enduser\x20found!');return _[_0xa76e('0x21')](_0x153159,{'phone':_0x224c32});}else{logger[_0xa76e('0xb')](_0xa76e('0x28'));return request({'uri':util[_0xa76e('0xe')](_0xa76e('0x29'),_0x4b5229[_0xa76e('0x1c')]),'method':'POST','body':{'name':_0x48579e,'phone':_0x224c32}})[_0xa76e('0x1e')](function(_0x24b493){logger[_0xa76e('0xb')]('Enduser\x20created.');return _0x24b493;});}});}function getAuth(_0xd530f0){return util[_0xa76e('0xe')](_0xa76e('0x2a'),new Buffer(_0xd530f0['apiKey']+':X')[_0xa76e('0x2b')](_0xa76e('0x2c')));}function request(_0x1feab1){logger[_0xa76e('0x2d')](_0xa76e('0x2e'),JSON[_0xa76e('0x2f')](_0x1feab1));return rp(_[_0xa76e('0x30')](_0x1feab1,{'method':_0xa76e('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1d476d,_0x1f0cae){var _0x495380=[];if(_0x1d476d&&_0x1d476d[_0xa76e('0x27')]>0x0){_0x495380=_[_0xa76e('0x32')](_0x1d476d,_0x1f0cae);}return _0x495380;}function getCustomFields(_0x169020,_0x43e935){var _0x5dfa21=[];var _0x187092={'custom_fields':[]};if(_0x169020[_0xa76e('0x27')]>0x0){_[_0xa76e('0x33')](_0x169020,function(_0x257e12){if(_[_0xa76e('0x34')](['string',_0xa76e('0x35')],_0x257e12[_0xa76e('0x36')])&&_0x257e12[_0xa76e('0x37')]&&!_0x257e12[_0xa76e('0x38')]){_0x187092[_0x257e12['nameField'][_0xa76e('0x39')]()]=_0x257e12['content']['toString']();}else if(_['includes']([_0xa76e('0x3a'),_0xa76e('0x35')],_0x257e12[_0xa76e('0x36')])&&_0x257e12[_0xa76e('0x3b')]&&_0x257e12[_0xa76e('0x38')]){_0x187092['custom_fields']['push']({'id':_0x257e12[_0xa76e('0x3b')],'value':_0x257e12['content'][_0xa76e('0x2b')]()});}else if(_0x257e12[_0xa76e('0x36')]===_0xa76e('0x3c')&&_0x257e12[_0xa76e('0x3d')]&&_0x257e12[_0xa76e('0x3b')]&&_0x257e12[_0xa76e('0x38')]){_0x43e935[_0x257e12[_0xa76e('0x3d')]]&&_0x187092[_0xa76e('0x18')]['push']({'id':_0x257e12['idField'],'value':_0x43e935[_0x257e12[_0xa76e('0x3d')]][_0xa76e('0x2b')]()});}else if(_0x257e12[_0xa76e('0x36')]===_0xa76e('0x3e')&&_0x257e12['Variable']&&_0x257e12[_0xa76e('0x3f')][_0xa76e('0x16')]&&_0x257e12[_0xa76e('0x3b')]&&_0x257e12[_0xa76e('0x38')]){_0x43e935[_0x257e12[_0xa76e('0x3f')][_0xa76e('0x16')]['toLowerCase']()]&&_0x187092['custom_fields']['push']({'id':_0x257e12[_0xa76e('0x3b')],'value':_0x43e935[_0x257e12['Variable']['name'][_0xa76e('0x39')]()][_0xa76e('0x2b')]()});}});}return _0x187092;}exports['queue']=function(_0x4b4620,_0xe9304,_0x4eca4c,_0xe4c2fa,_0x1c16e0,_0x47c1e5){var _0x2dd6a8,_0x4e635a;_0x47c1e5['remoteUri']=intUtil[_0xa76e('0x40')](_0x47c1e5['remoteUri']);_0x47c1e5[_0xa76e('0x41')]=intUtil[_0xa76e('0x40')](_0x47c1e5[_0xa76e('0x41')]);if(_0x1c16e0&&_0x1c16e0[_0xa76e('0x42')]){logger['info'](_0xa76e('0x43'),_0xa76e('0x44'));_0xe9304[_0xa76e('0x45')]=util[_0xa76e('0xe')](_0xa76e('0x46'),_0x47c1e5[_0xa76e('0x41')],_0xe9304['uniqueid'],md5(_0xe9304[_0xa76e('0x47')]));}else{_0xe9304[_0xa76e('0x45')]='';}headers['Authorization']=getAuth(_0x47c1e5);return getUser(_0x47c1e5,_0xe4c2fa[_0xa76e('0x23')])[_0xa76e('0x1e')](function(_0x4684ca){_0x2dd6a8=_0x4684ca;logger[_0xa76e('0xb')](_0xa76e('0x48'),_0x2dd6a8['id']);return getEndUser(_0x47c1e5,_0xe9304[_0xa76e('0xf')],_0xe9304[_0xa76e('0x10')]);})['then'](function(_0x534ef3){_0x4e635a=_0x534ef3;logger['info'](_0xa76e('0x49'),_0x4e635a['id']);return getTicket(_0x47c1e5,_0x2dd6a8,_0x4e635a,_0x4eca4c,_0xe9304);})[_0xa76e('0x1e')](function(_0xdb5a83){if(_0xdb5a83&&_0xdb5a83['id']){logger[_0xa76e('0xb')](_0xa76e('0x4a'));logger[_0xa76e('0xb')](_0xa76e('0x4b'),_0xdb5a83['id']);logger['info'](_0xa76e('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa76e('0xe')](_0xa76e('0x4c'),_0xe4c2fa[_0xa76e('0x16')]),'trigger:browser:url',{'uri':util[_0xa76e('0xe')](_0xa76e('0x4d'),_0x47c1e5[_0xa76e('0x1c')],_0xdb5a83['id'])});}})[_0xa76e('0x4e')](function(_0x16585f){logger[_0xa76e('0x4f')]('[QUEUE]',JSON[_0xa76e('0x2f')](_0x16585f));});};exports[_0xa76e('0x50')]=function(_0x3e0de5,_0x3f8816,_0x19df5b,_0x1db6ea,_0x316997,_0xbc2dbf,_0x261dd7){var _0x4a27b7,_0x5b7ae5;_0xbc2dbf[_0xa76e('0x1c')]=intUtil[_0xa76e('0x40')](_0xbc2dbf[_0xa76e('0x1c')]);_0xbc2dbf['serverUrl']=intUtil['stripTrailingSlash'](_0xbc2dbf[_0xa76e('0x41')]);if(_0x261dd7&&_0x261dd7['recordingFormat']&&_0x261dd7[_0xa76e('0x51')]!==_0xa76e('0x52')){logger['info']('[OUTBOUND]',_0xa76e('0x44'));_0x3f8816[_0xa76e('0x45')]=util[_0xa76e('0xe')](_0xa76e('0x46'),_0xbc2dbf[_0xa76e('0x41')],_0x3f8816[_0xa76e('0x47')],md5(_0x3f8816['uniqueid']));}headers[_0xa76e('0x53')]=getAuth(_0xbc2dbf);return getUser(_0xbc2dbf,_0x1db6ea[_0xa76e('0x23')])['then'](function(_0x2ef835){_0x4a27b7=_0x2ef835;logger[_0xa76e('0xb')](_0xa76e('0x48'),_0x4a27b7['id']);return getEndUser(_0xbc2dbf,_0x3f8816['destcalleridname'],_0x3f8816[_0xa76e('0x54')]);})[_0xa76e('0x1e')](function(_0x31547a){_0x5b7ae5=_0x31547a;logger[_0xa76e('0xb')](_0xa76e('0x49'),_0x5b7ae5['id']);return getTicket(_0xbc2dbf,_0x4a27b7,_0x5b7ae5,_0x19df5b,_0x3f8816);})['then'](function(_0x39864f){if(_0x39864f&&_0x39864f['id']){logger['info'](_0xa76e('0x4a'));logger['info'](_0xa76e('0x4b'),_0x39864f['id']);logger[_0xa76e('0xb')](_0xa76e('0x55'),_0xa76e('0x56'));emit(util[_0xa76e('0xe')]('user:%s',_0x1db6ea['name']),_0xa76e('0x57'),{'uri':util[_0xa76e('0xe')](_0xa76e('0x4d'),_0xbc2dbf[_0xa76e('0x1c')],_0x39864f['id'])});}})[_0xa76e('0x4e')](function(_0x487799){logger['error'](_0xa76e('0x55'),JSON[_0xa76e('0x2f')](_0x487799));});};exports[_0xa76e('0x58')]=function(_0x3d6641,_0x4715eb,_0x1c3076,_0x180afa,_0x38efa9,_0x3afc87){var _0x224345,_0x316ee3;_0x3afc87['remoteUri']=intUtil[_0xa76e('0x40')](_0x3afc87['remoteUri']);_0x3afc87[_0xa76e('0x41')]=intUtil[_0xa76e('0x40')](_0x3afc87['serverUrl']);if(_0x38efa9&&_0x38efa9[_0xa76e('0x42')]){logger[_0xa76e('0xb')]('['+_0x4715eb[_0xa76e('0x59')][_0xa76e('0x5a')]()+']',_0xa76e('0x44'));_0x4715eb[_0xa76e('0x45')]=util[_0xa76e('0xe')](_0xa76e('0x46'),_0x3afc87[_0xa76e('0x41')],_0x4715eb[_0xa76e('0x47')],md5(_0x4715eb[_0xa76e('0x47')]));}else{_0x4715eb[_0xa76e('0x45')]='';}headers['Authorization']=getAuth(_0x3afc87);return getUser(_0x3afc87,'')[_0xa76e('0x1e')](function(_0x47fcc3){_0x224345=_0x47fcc3;logger[_0xa76e('0xb')](_0xa76e('0x48'),_0x224345['id']);return getEndUser(_0x3afc87,_0x4715eb[_0xa76e('0xf')],_0x4715eb[_0xa76e('0x10')]);})[_0xa76e('0x1e')](function(_0x4b4381){_0x316ee3=_0x4b4381;logger['info'](_0xa76e('0x49'),_0x316ee3['id']);return getTicket(_0x3afc87,_0x224345,_0x316ee3,_0x1c3076,_0x4715eb);})[_0xa76e('0x1e')](function(_0x47ce7b){if(_0x47ce7b){logger[_0xa76e('0xb')](_0xa76e('0x4a'));logger[_0xa76e('0xb')](_0xa76e('0x4b'),_0x47ce7b['id']);}})[_0xa76e('0x4e')](function(_0xd7496){logger['error']('['+_0x4715eb[_0xa76e('0x59')][_0xa76e('0x5a')]()+']',JSON[_0xa76e('0x2f')](_0xd7496));});}; \ 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 d83c6bd..b3f9a54 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 _0x5118=['toUpperCase','message','info','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','userEmail','catch','error','GET','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','./util','../../../../config/environment','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found'];(function(_0x38ac7b,_0x2dc75f){var _0x2c3cd5=function(_0x10ddc9){while(--_0x10ddc9){_0x38ac7b['push'](_0x38ac7b['shift']());}};_0x2c3cd5(++_0x2dc75f);}(_0x5118,0x1ce));var _0x8511=function(_0x2934c3,_0x32f837){_0x2934c3=_0x2934c3-0x0;var _0x3b20e7=_0x5118[_0x2934c3];return _0x3b20e7;};'use strict';var _=require(_0x8511('0x0'));var rp=require(_0x8511('0x1'));var md5=require(_0x8511('0x2'));var util=require(_0x8511('0x3'));var moment=require('moment');var Promise=require(_0x8511('0x4'));var Redis=require('ioredis');var intUtil=require(_0x8511('0x5'));var config=require(_0x8511('0x6'));var logger=require('../../../../config/logger')('freshsales');config['redis']=_['defaults'](config['redis'],{'host':_0x8511('0x7'),'port':0x18eb});var io=require(_0x8511('0x8'))(new Redis(config['redis']));function getAdminId(_0x13a261,_0x541560,_0x24e83e,_0x16e7e1){return new Promise(function(_0x1de57b,_0x1ef242){var _0x4bd7f7=![];var _0x2fa56b={'method':'GET','uri':_0x16e7e1+_0x8511('0x9'),'json':!![]};_0x2fa56b[_0x8511('0xa')]=_0x24e83e;logger['info'](_0x8511('0xb'));return rp(_0x2fa56b)['then'](function(_0x3c1346){if(_0x3c1346){var _0x5b5540=_0x3c1346[_0x8511('0xc')];var _0x28267d=null;for(_0x28267d=0x0;_0x28267d<_0x5b5540[_0x8511('0xd')];_0x28267d++){if(_0x5b5540[_0x28267d][_0x8511('0xe')]===_0x13a261[_0x8511('0xf')]){_0x13a261[_0x8511('0x10')]=_0x5b5540[_0x28267d]['id'];_0x4bd7f7=!![];}}if(_0x4bd7f7){logger['info']('Admin\x20found:',_0x13a261[_0x8511('0x10')]);_0x1de57b(_0x13a261);}else{_0x1ef242({'statusCode':0x194,'message':_0x8511('0x11')});}}else{_0x1ef242({'statusCode':0x194,'message':_0x8511('0x11')});}})['catch'](function(_0x5f58b4){logger['error']('['+[_0x541560[_0x8511('0x12')]()]+']',_0x5f58b4[_0x8511('0x13')]);_0x1ef242(_0x5f58b4);});});}function getUser(_0x5db399,_0x5959d9,_0x65610e){return function(_0x346025){return new Promise(function(_0x3579f4,_0x26c329){var _0x3c7880={'method':'GET','uri':_0x65610e+_0x8511('0x9'),'json':!![]};_0x3c7880[_0x8511('0xa')]=_0x5959d9;logger[_0x8511('0x14')](_0x8511('0x15'));return rp(_0x3c7880)[_0x8511('0x16')](function(_0x295972){if(_0x295972){var _0x4b1a96=_0x295972['users'];var _0x210fc5=![];var _0x34f3a0=null;if(_0x346025[_0x8511('0x17')]!==null){logger['info'](_0x8511('0x18'),_0x346025[_0x8511('0x17')]);_0x346025['userEmail']=_0x346025[_0x8511('0x17')];for(_0x34f3a0=0x0;_0x34f3a0<_0x4b1a96[_0x8511('0xd')];_0x34f3a0++){if(_0x4b1a96[_0x34f3a0]['email']===_0x346025[_0x8511('0x17')]){_0x210fc5=!![];_0x346025['userId']=_0x4b1a96[_0x34f3a0]['id'];logger[_0x8511('0x14')](_0x8511('0x19'),_0x346025[_0x8511('0x1a')]);}}}if(!_0x210fc5){logger[_0x8511('0x14')]('Admin\x20selected');_0x346025[_0x8511('0x1b')]=_0x346025['adminEmail'];_0x346025[_0x8511('0x1a')]=_0x346025['adminId'];_0x210fc5=!![];}if(_0x210fc5){_0x3579f4(_0x346025);}else{_0x26c329({'statusCode':0x194,'message':_0x8511('0x11')});}}else{_0x26c329({'statusCode':0x194,'message':_0x8511('0x11')});}})[_0x8511('0x1c')](function(_0xbccde6){logger[_0x8511('0x1d')]('['+[_0x5db399['toUpperCase']()]+']',_0xbccde6['message']);_0x26c329(_0xbccde6);});});};}function searchContact(_0x12a5f9,_0x4761ae,_0x3d38ff,_0x3335b0){return new Promise(function(_0x1964ee,_0x50a209){var _0x585de1={'method':_0x8511('0x1e'),'headers':_0x4761ae,'uri':_0x12a5f9+_0x8511('0x1f')+_0x3335b0+_0x8511('0x20')+_0x3d38ff+_0x8511('0x21'),'json':!![]};rp(_0x585de1)[_0x8511('0x16')](function(_0x40ea43){var _0x26df29=_['find'](_0x40ea43[_0x8511('0x22')][_0x8511('0x22')],[_0x3d38ff,_0x3335b0]);_0x1964ee(_0x26df29);})['catch'](function(_0x3aefd6){_0x50a209(_0x3aefd6);});});}function getEndUser(_0x19608c,_0x193b55,_0x4ec4da){return function(_0x1ae28f){return new Promise(function(_0x5c87c0,_0x3d1ac9){logger[_0x8511('0x14')](util[_0x8511('0x23')](_0x8511('0x24'),_0x1ae28f[_0x8511('0x25')]));searchContact(_0x4ec4da,_0x193b55,_0x8511('0x26'),_0x1ae28f[_0x8511('0x25')])[_0x8511('0x16')](function(_0x56cab1){if(_0x56cab1){_0x1ae28f['endUserId']=_0x56cab1['id'];logger[_0x8511('0x14')](_0x8511('0x27'),_0x1ae28f['endUserId']);return _0x5c87c0(_0x1ae28f);}searchContact(_0x4ec4da,_0x193b55,'work_number',_0x1ae28f[_0x8511('0x25')])[_0x8511('0x16')](function(_0x15e6ed){if(_0x15e6ed){_0x1ae28f[_0x8511('0x28')]=_0x15e6ed['id'];logger['info'](_0x8511('0x29'),_0x1ae28f[_0x8511('0x28')]);return _0x5c87c0(_0x1ae28f);}createEndUser(_0x1ae28f,_0x19608c,_0x193b55,_0x4ec4da)[_0x8511('0x16')](function(_0x55d120){logger[_0x8511('0x14')](_0x8511('0x2a'),_0x55d120['endUserId']);return _0x5c87c0(_0x55d120);});});})['catch'](function(_0x48e881){_0x3d1ac9(_0x48e881);});});};}function createEndUser(_0x19305e,_0x530f46,_0x27c677,_0x4b9e96){return new Promise(function(_0x100b20,_0x3d54fc){var _0x15829b=moment();var _0x5c45f8={'method':_0x8511('0x2b'),'uri':_0x4b9e96+'/api/contacts','body':{'contact':{'last_name':_0x19305e[_0x8511('0x25')],'work_number':_0x19305e['contactNumber'],'mobile_number':_0x19305e[_0x8511('0x25')],'owner_id':_0x19305e[_0x8511('0x1a')],'created_at':_0x15829b[_0x8511('0x23')](_0x8511('0x2c'))}},'json':!![]};_0x5c45f8['headers']=_0x27c677;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5c45f8)[_0x8511('0x16')](function(_0x3461a8){_0x19305e[_0x8511('0x28')]=_0x3461a8[_0x8511('0x2d')]['id'];_0x100b20(_0x19305e);})[_0x8511('0x1c')](function(_0x581489){logger[_0x8511('0x1d')]('['+[_0x530f46[_0x8511('0x12')]()]+']',_0x581489[_0x8511('0x13')]);_0x3d54fc(_0x581489[_0x8511('0x13')]);});});}function getTicket(_0x209697,_0x2ab49f,_0x21ed27,_0x35be8a,_0x26c620){return function(_0x25f92c){logger[_0x8511('0x14')](_0x8511('0x2e'));return new Promise(function(_0x411f81,_0x1d8187){var _0x2ddf82=moment();var _0x57ed69={'method':'POST','uri':_0x21ed27+_0x8511('0x2f'),'body':{'title':intUtil['getString'](_0x35be8a[_0x8511('0x30')],_0x26c620,'\x20'),'description':intUtil['getString'](_0x35be8a['Descriptions'],_0x26c620,'\x0a'),'owner_id':_0x25f92c['userId'],'creater_id':_0x25f92c[_0x8511('0x10')],'targetable_id':_0x25f92c[_0x8511('0x28')],'targetable_type':_0x8511('0x31'),'created_at':_0x2ddf82[_0x8511('0x23')](_0x8511('0x2c')),'due_date':_0x2ddf82[_0x8511('0x32')](0x1e,'m')[_0x8511('0x23')](_0x8511('0x2c'))},'json':!![]};_0x57ed69[_0x8511('0xa')]=_0x2ab49f;return rp(_0x57ed69)['then'](function(_0x1971b4){_0x25f92c[_0x8511('0x33')]=_0x1971b4[_0x8511('0x34')]['id'];logger['info']('Task\x20created:',_0x25f92c['ticketId']);_0x411f81(_0x25f92c);})[_0x8511('0x1c')](function(_0x2fbaf8){logger['error']('['+[_0x209697[_0x8511('0x12')]()]+']',_0x2fbaf8['message']);_0x1d8187(_0x2fbaf8[_0x8511('0x13')]);});});};}function emit(_0x23d47b,_0x26b451,_0x27d67f){var _0x53603b={'uri':_0x23d47b+_0x8511('0x35')+_0x27d67f};io['to'](util['format'](_0x8511('0x36'),_0x26b451))[_0x8511('0x37')](_0x8511('0x38'),_0x53603b);}exports['cs']=function(_0x1d6c06,_0x2c867a,_0x5c0612,_0x6cb6fe,_0x236941,_0x3b8cfb,_0x1f3675,_0x23281a){var _0x1e322d={};var _0x2fe203={'Authorization':'Token\x20token='+_0x3b8cfb['apiKey']};_0x3b8cfb['remoteUri']=intUtil[_0x8511('0x39')](_0x3b8cfb[_0x8511('0x3a')]);_0x3b8cfb['serverUrl']=intUtil['stripTrailingSlash'](_0x3b8cfb[_0x8511('0x3b')]);var _0x3c7459=_0x3b8cfb[_0x8511('0x3a')];_0x1e322d[_0x8511('0xf')]=_0x3b8cfb[_0x8511('0x3c')];_0x1e322d['contactNumber']=_0x23281a[_0x8511('0x3d')]()===_0x8511('0x3e')?_0x2c867a[_0x8511('0x3f')]:_0x2c867a['calleridnum'];_0x1e322d['callDirection']=_0x23281a==='queue'||_0x23281a===_0x8511('0x40')?_0x8511('0x41'):_0x8511('0x3e');if(_0x6cb6fe){_0x1e322d['agentEmail']=_0x6cb6fe['email'];}var _0xb31b7b=util[_0x8511('0x23')](_0x8511('0x42'),_0x3b8cfb[_0x8511('0x3b')],_0x2c867a[_0x8511('0x43')],md5(_0x2c867a[_0x8511('0x43')]));if(_0x236941&&_0x236941[_0x8511('0x44')]){logger['info'](_0x8511('0x45'),'Recording\x20is\x20enabled!');_0x2c867a[_0x8511('0x46')]=_0xb31b7b;}else if(_0x1f3675&&_0x1f3675[_0x8511('0x47')]&&_0x1f3675[_0x8511('0x47')]!==_0x8511('0x48')){logger[_0x8511('0x14')](_0x8511('0x49'),_0x8511('0x4a'));_0x2c867a['recordingURL']=_0xb31b7b;}else{_0x2c867a['recordingURL']='';}return getAdminId(_0x1e322d,_0x23281a,_0x2fe203,_0x3c7459)['then'](getUser(_0x23281a,_0x2fe203,_0x3c7459))['then'](getEndUser(_0x23281a,_0x2fe203,_0x3c7459))[_0x8511('0x16')](getTicket(_0x23281a,_0x2fe203,_0x3c7459,_0x5c0612,_0x2c867a))['then'](function(_0x5302bb){logger[_0x8511('0x14')](util[_0x8511('0x23')](_0x8511('0x4b'),_0x5302bb[_0x8511('0x33')]));if(_0x23281a!==_0x8511('0x40')){logger[_0x8511('0x14')]('['+[_0x23281a[_0x8511('0x12')]()]+']',_0x8511('0x4c'));emit(_0x3c7459,_0x6cb6fe[_0x8511('0x4d')],_0x5302bb['endUserId']);}})[_0x8511('0x1c')](function(_0x1754d1){logger['error']('['+[_0x23281a[_0x8511('0x12')]()]+_0x8511('0x4e'),util[_0x8511('0x4f')](_0x1754d1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xee00=['defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','then','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','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','contact','/api/tasks','getString','Subjects','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','queue','unmanaged','uniqueid','monitor_format','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','freshsales','redis'];(function(_0x13683f,_0x3ceb55){var _0x4628ec=function(_0x384fee){while(--_0x384fee){_0x13683f['push'](_0x13683f['shift']());}};_0x4628ec(++_0x3ceb55);}(_0xee00,0x143));var _0x0ee0=function(_0x103df9,_0x4da2af){_0x103df9=_0x103df9-0x0;var _0x15c2f7=_0xee00[_0x103df9];return _0x15c2f7;};'use strict';var _=require('lodash');var rp=require(_0x0ee0('0x0'));var md5=require(_0x0ee0('0x1'));var util=require(_0x0ee0('0x2'));var moment=require(_0x0ee0('0x3'));var Promise=require(_0x0ee0('0x4'));var Redis=require(_0x0ee0('0x5'));var intUtil=require(_0x0ee0('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x0ee0('0x7'));config[_0x0ee0('0x8')]=_[_0x0ee0('0x9')](config[_0x0ee0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0ee0('0xa'))(new Redis(config[_0x0ee0('0x8')]));function getAdminId(_0x4165bf,_0x1c76e5,_0x3b0888,_0x3f2e43){return new Promise(function(_0x42056f,_0x4cc84a){var _0xc0748f=![];var _0x512d9b={'method':_0x0ee0('0xb'),'uri':_0x3f2e43+_0x0ee0('0xc'),'json':!![]};_0x512d9b[_0x0ee0('0xd')]=_0x3b0888;logger[_0x0ee0('0xe')](_0x0ee0('0xf'));return rp(_0x512d9b)['then'](function(_0x18cf6e){if(_0x18cf6e){var _0x388eac=_0x18cf6e['users'];var _0x1e3292=null;for(_0x1e3292=0x0;_0x1e3292<_0x388eac[_0x0ee0('0x10')];_0x1e3292++){if(_0x388eac[_0x1e3292][_0x0ee0('0x11')]===_0x4165bf[_0x0ee0('0x12')]){_0x4165bf['adminId']=_0x388eac[_0x1e3292]['id'];_0xc0748f=!![];}}if(_0xc0748f){logger[_0x0ee0('0xe')](_0x0ee0('0x13'),_0x4165bf[_0x0ee0('0x14')]);_0x42056f(_0x4165bf);}else{_0x4cc84a({'statusCode':0x194,'message':_0x0ee0('0x15')});}}else{_0x4cc84a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0ee0('0x16')](function(_0x3ff010){logger[_0x0ee0('0x17')]('['+[_0x1c76e5['toUpperCase']()]+']',_0x3ff010[_0x0ee0('0x18')]);_0x4cc84a(_0x3ff010);});});}function getUser(_0x4412db,_0x48e3f5,_0x5a86e0){return function(_0x20d5e4){return new Promise(function(_0x2e4576,_0x30ee9c){var _0x23e6c1={'method':'GET','uri':_0x5a86e0+_0x0ee0('0xc'),'json':!![]};_0x23e6c1[_0x0ee0('0xd')]=_0x48e3f5;logger['info']('Getting\x20user\x20list');return rp(_0x23e6c1)[_0x0ee0('0x19')](function(_0x78ced2){if(_0x78ced2){var _0x36c6c0=_0x78ced2[_0x0ee0('0x1a')];var _0x268df9=![];var _0x314513=null;if(_0x20d5e4[_0x0ee0('0x1b')]!==null){logger[_0x0ee0('0xe')](_0x0ee0('0x1c'),_0x20d5e4[_0x0ee0('0x1b')]);_0x20d5e4[_0x0ee0('0x1d')]=_0x20d5e4[_0x0ee0('0x1b')];for(_0x314513=0x0;_0x314513<_0x36c6c0[_0x0ee0('0x10')];_0x314513++){if(_0x36c6c0[_0x314513]['email']===_0x20d5e4[_0x0ee0('0x1b')]){_0x268df9=!![];_0x20d5e4[_0x0ee0('0x1e')]=_0x36c6c0[_0x314513]['id'];logger[_0x0ee0('0xe')](_0x0ee0('0x1f'),_0x20d5e4[_0x0ee0('0x1e')]);}}}if(!_0x268df9){logger[_0x0ee0('0xe')]('Admin\x20selected');_0x20d5e4[_0x0ee0('0x1d')]=_0x20d5e4['adminEmail'];_0x20d5e4[_0x0ee0('0x1e')]=_0x20d5e4[_0x0ee0('0x14')];_0x268df9=!![];}if(_0x268df9){_0x2e4576(_0x20d5e4);}else{_0x30ee9c({'statusCode':0x194,'message':_0x0ee0('0x15')});}}else{_0x30ee9c({'statusCode':0x194,'message':_0x0ee0('0x15')});}})[_0x0ee0('0x16')](function(_0x4bfa79){logger[_0x0ee0('0x17')]('['+[_0x4412db[_0x0ee0('0x20')]()]+']',_0x4bfa79['message']);_0x30ee9c(_0x4bfa79);});});};}function searchContact(_0x313e97,_0x5d677a,_0x494868,_0x96ec9){return new Promise(function(_0x23e395,_0x1bfe62){var _0x55aa2e={'method':_0x0ee0('0xb'),'headers':_0x5d677a,'uri':_0x313e97+_0x0ee0('0x21')+_0x96ec9+_0x0ee0('0x22')+_0x494868+_0x0ee0('0x23'),'json':!![]};rp(_0x55aa2e)[_0x0ee0('0x19')](function(_0x8e9229){var _0x1ff9eb=_[_0x0ee0('0x24')](_0x8e9229['contacts'][_0x0ee0('0x25')],[_0x494868,_0x96ec9]);_0x23e395(_0x1ff9eb);})['catch'](function(_0x5488bd){_0x1bfe62(_0x5488bd);});});}function getEndUser(_0x2ac084,_0x45253f,_0x1ad46f){return function(_0x138f29){return new Promise(function(_0xc83046,_0x4e4823){logger[_0x0ee0('0xe')](util['format'](_0x0ee0('0x26'),_0x138f29[_0x0ee0('0x27')]));searchContact(_0x1ad46f,_0x45253f,_0x0ee0('0x28'),_0x138f29['contactNumber'])['then'](function(_0x1494bd){if(_0x1494bd){_0x138f29[_0x0ee0('0x29')]=_0x1494bd['id'];logger[_0x0ee0('0xe')](_0x0ee0('0x2a'),_0x138f29[_0x0ee0('0x29')]);return _0xc83046(_0x138f29);}searchContact(_0x1ad46f,_0x45253f,_0x0ee0('0x2b'),_0x138f29[_0x0ee0('0x27')])['then'](function(_0x413b5e){if(_0x413b5e){_0x138f29[_0x0ee0('0x29')]=_0x413b5e['id'];logger[_0x0ee0('0xe')](_0x0ee0('0x2c'),_0x138f29['endUserId']);return _0xc83046(_0x138f29);}createEndUser(_0x138f29,_0x2ac084,_0x45253f,_0x1ad46f)[_0x0ee0('0x19')](function(_0x445760){logger[_0x0ee0('0xe')](_0x0ee0('0x2d'),_0x445760[_0x0ee0('0x29')]);return _0xc83046(_0x445760);});});})[_0x0ee0('0x16')](function(_0x5f540d){_0x4e4823(_0x5f540d);});});};}function createEndUser(_0x3321a2,_0x2be9b9,_0x28e7f5,_0x16ad1f){return new Promise(function(_0x24ce30,_0x199626){var _0x1b2928=moment();var _0x3e17fa={'method':_0x0ee0('0x2e'),'uri':_0x16ad1f+_0x0ee0('0x2f'),'body':{'contact':{'last_name':_0x3321a2['contactNumber'],'work_number':_0x3321a2[_0x0ee0('0x27')],'mobile_number':_0x3321a2[_0x0ee0('0x27')],'owner_id':_0x3321a2[_0x0ee0('0x1e')],'created_at':_0x1b2928['format'](_0x0ee0('0x30'))}},'json':!![]};_0x3e17fa[_0x0ee0('0xd')]=_0x28e7f5;logger[_0x0ee0('0xe')](_0x0ee0('0x31'));return rp(_0x3e17fa)['then'](function(_0x2f1c39){_0x3321a2['endUserId']=_0x2f1c39[_0x0ee0('0x32')]['id'];_0x24ce30(_0x3321a2);})[_0x0ee0('0x16')](function(_0x585392){logger[_0x0ee0('0x17')]('['+[_0x2be9b9[_0x0ee0('0x20')]()]+']',_0x585392[_0x0ee0('0x18')]);_0x199626(_0x585392['message']);});});}function getTicket(_0x187f6b,_0x55817a,_0x1090be,_0x4356e1,_0x3e98ff){return function(_0x2e77ff){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x3a46bc,_0x588486){var _0x3cc83a=moment();var _0x5eb912={'method':_0x0ee0('0x2e'),'uri':_0x1090be+_0x0ee0('0x33'),'body':{'title':intUtil[_0x0ee0('0x34')](_0x4356e1[_0x0ee0('0x35')],_0x3e98ff,'\x20'),'description':intUtil[_0x0ee0('0x34')](_0x4356e1['Descriptions'],_0x3e98ff,'\x0a'),'owner_id':_0x2e77ff[_0x0ee0('0x1e')],'creater_id':_0x2e77ff[_0x0ee0('0x14')],'targetable_id':_0x2e77ff[_0x0ee0('0x29')],'targetable_type':_0x0ee0('0x36'),'created_at':_0x3cc83a[_0x0ee0('0x37')](_0x0ee0('0x30')),'due_date':_0x3cc83a[_0x0ee0('0x38')](0x1e,'m')[_0x0ee0('0x37')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5eb912['headers']=_0x55817a;return rp(_0x5eb912)[_0x0ee0('0x19')](function(_0x1c256f){_0x2e77ff[_0x0ee0('0x39')]=_0x1c256f[_0x0ee0('0x3a')]['id'];logger[_0x0ee0('0xe')](_0x0ee0('0x3b'),_0x2e77ff['ticketId']);_0x3a46bc(_0x2e77ff);})[_0x0ee0('0x16')](function(_0x143b63){logger[_0x0ee0('0x17')]('['+[_0x187f6b[_0x0ee0('0x20')]()]+']',_0x143b63[_0x0ee0('0x18')]);_0x588486(_0x143b63['message']);});});};}function emit(_0xc4007c,_0x2af64a,_0x34a048){var _0x5cff09={'uri':_0xc4007c+_0x0ee0('0x3c')+_0x34a048};io['to'](util[_0x0ee0('0x37')](_0x0ee0('0x3d'),_0x2af64a))['emit'](_0x0ee0('0x3e'),_0x5cff09);}exports['cs']=function(_0x3a3c38,_0x5d6410,_0x545eb4,_0x4a4461,_0x92817e,_0x14507a,_0x46c75a,_0x268c2a){var _0x45903f={};var _0x2a1d8d={'Authorization':_0x0ee0('0x3f')+_0x14507a[_0x0ee0('0x40')]};_0x14507a['remoteUri']=intUtil[_0x0ee0('0x41')](_0x14507a[_0x0ee0('0x42')]);_0x14507a[_0x0ee0('0x43')]=intUtil[_0x0ee0('0x41')](_0x14507a[_0x0ee0('0x43')]);var _0x4de599=_0x14507a[_0x0ee0('0x42')];_0x45903f[_0x0ee0('0x12')]=_0x14507a[_0x0ee0('0x44')];_0x45903f['contactNumber']=_0x268c2a[_0x0ee0('0x45')]()===_0x0ee0('0x46')?_0x5d6410[_0x0ee0('0x47')]:_0x5d6410['calleridnum'];_0x45903f['callDirection']=_0x268c2a===_0x0ee0('0x48')||_0x268c2a===_0x0ee0('0x49')?_0x0ee0('0x48'):_0x0ee0('0x46');if(_0x4a4461){_0x45903f['agentEmail']=_0x4a4461['email'];}var _0x4d7815=util[_0x0ee0('0x37')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14507a[_0x0ee0('0x43')],_0x5d6410['uniqueid'],md5(_0x5d6410[_0x0ee0('0x4a')]));if(_0x92817e&&_0x92817e[_0x0ee0('0x4b')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5d6410['recordingURL']=_0x4d7815;}else if(_0x46c75a&&_0x46c75a[_0x0ee0('0x4c')]&&_0x46c75a[_0x0ee0('0x4c')]!==_0x0ee0('0x4d')){logger[_0x0ee0('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5d6410[_0x0ee0('0x4e')]=_0x4d7815;}else{_0x5d6410[_0x0ee0('0x4e')]='';}return getAdminId(_0x45903f,_0x268c2a,_0x2a1d8d,_0x4de599)[_0x0ee0('0x19')](getUser(_0x268c2a,_0x2a1d8d,_0x4de599))['then'](getEndUser(_0x268c2a,_0x2a1d8d,_0x4de599))[_0x0ee0('0x19')](getTicket(_0x268c2a,_0x2a1d8d,_0x4de599,_0x545eb4,_0x5d6410))[_0x0ee0('0x19')](function(_0x28640d){logger['info'](util[_0x0ee0('0x37')](_0x0ee0('0x4f'),_0x28640d['ticketId']));if(_0x268c2a!==_0x0ee0('0x49')){logger[_0x0ee0('0xe')]('['+[_0x268c2a[_0x0ee0('0x20')]()]+']',_0x0ee0('0x50'));emit(_0x4de599,_0x4a4461[_0x0ee0('0x51')],_0x28640d[_0x0ee0('0x29')]);}})[_0x0ee0('0x16')](function(_0x17fd97){logger[_0x0ee0('0x17')]('['+[_0x268c2a[_0x0ee0('0x20')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x0ee0('0x52')](_0x17fd97,{'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 069260e..0cb2715 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 _0x19bb=['data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','log','unknown\x20integration','error','[EXEC]','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations'];(function(_0xe8c951,_0x5cf707){var _0x42dee3=function(_0xa35ab7){while(--_0xa35ab7){_0xe8c951['push'](_0xe8c951['shift']());}};_0x42dee3(++_0x5cf707);}(_0x19bb,0xc1));var _0xb19b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x19bb[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xb19b('0x0'));var util=require('util');var zendesk=require(_0xb19b('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xb19b('0x2'));var freshdesk=require(_0xb19b('0x3'));var zoho=require(_0xb19b('0x4'));var desk=require(_0xb19b('0x5'));var vtiger=require(_0xb19b('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0xb19b('0x7'));var freshsales=require(_0xb19b('0x8'));var integrations=[_0xb19b('0x9'),'salesforce',_0xb19b('0xa'),_0xb19b('0xb'),_0xb19b('0xc'),_0xb19b('0xd'),'vtiger','dynamics365',_0xb19b('0xe'),_0xb19b('0xf')];exports[_0xb19b('0x10')]=function(_0x4a7677,_0x445984,_0x15ff77,_0x55d4f6,_0x396a8a,_0x517b2d){if(_0x15ff77){if(_[_0xb19b('0x11')](integrations,_0x4a7677[_0xb19b('0x12')][_0xb19b('0x13')]())){try{var _0x2749b2=null;var _0x53c7e8='';var _0x828796=_0x15ff77[_0x4a7677[_0xb19b('0x12')][_0xb19b('0x13')]()];if(_0x828796){var _0x4e52c7=_0x828796[_0x4a7677[_0xb19b('0x14')]];if(_0x4e52c7){var _0x49957b=_[_0xb19b('0x15')](_0x4e52c7[_0xb19b('0x16')],{'id':parseInt(_0x4a7677[_0xb19b('0x17')],0xa)});if(_0x49957b){if(_0x55d4f6){if(_0x396a8a&&_0x445984[_0xb19b('0x18')]){_0x53c7e8=_0xb19b('0x18');}else if(_0x445984['routeId']){_0x53c7e8=_0xb19b('0x19');}else{console['log'](_0xb19b('0x1a'),_0x445984);}}else{_0x53c7e8=_0xb19b('0x1b');}switch(_0x4a7677[_0xb19b('0x12')][_0xb19b('0x13')]()){case _0xb19b('0x9'):zendesk[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case _0xb19b('0x1c'):salesforce[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case _0xb19b('0xa'):sugarcrm[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case _0xb19b('0xb'):freshdesk[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case _0xb19b('0xc'):zoho[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case _0xb19b('0xd'):desk[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case'vtiger':vtiger[_0x53c7e8](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d);break;case _0xb19b('0xe'):freshsales['cs'](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d,_0x53c7e8);break;case _0xb19b('0xf'):servicenow['cs'](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d,_0x53c7e8);break;case'dynamics365':dynamics365['cs'](_0x4a7677,_0x445984,_0x49957b,_0x55d4f6,_0x396a8a,_0x4e52c7,_0x517b2d,_0x53c7e8);break;default:console[_0xb19b('0x1d')](_0xb19b('0x1e'));}}else{_0x2749b2=require('../../../../config/logger')(_0x4a7677[_0xb19b('0x12')]['toLowerCase']());_0x2749b2[_0xb19b('0x1f')](_0xb19b('0x20'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x4a7677['data1'][_0xb19b('0x13')](),_0x4a7677['data3']));}}else{_0x2749b2=require(_0xb19b('0x21'))(_0x4a7677['data1'][_0xb19b('0x13')]());_0x2749b2[_0xb19b('0x1f')]('[EXEC]',util[_0xb19b('0x22')](_0xb19b('0x23'),_0x4a7677[_0xb19b('0x12')]['toLowerCase'](),_0x4a7677['data2']));}}else{}}catch(_0x36473f){console[_0xb19b('0x1f')](_0x36473f);}}}}; \ No newline at end of file +var _0xfa3f=['data1','zendesk','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','includes','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged'];(function(_0x2e6a25,_0x44d155){var _0x74dbd3=function(_0x1eb571){while(--_0x1eb571){_0x2e6a25['push'](_0x2e6a25['shift']());}};_0x74dbd3(++_0x44d155);}(_0xfa3f,0x1dd));var _0xffa3=function(_0x32b7d2,_0x3d178f){_0x32b7d2=_0x32b7d2-0x0;var _0x39caaa=_0xfa3f[_0x32b7d2];return _0x39caaa;};'use strict';var _=require(_0xffa3('0x0'));var util=require(_0xffa3('0x1'));var zendesk=require(_0xffa3('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xffa3('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xffa3('0x4'));var vtiger=require(_0xffa3('0x5'));var servicenow=require(_0xffa3('0x6'));var dynamics365=require(_0xffa3('0x7'));var freshsales=require(_0xffa3('0x8'));var integrations=['zendesk',_0xffa3('0x9'),'sugarcrm',_0xffa3('0xa'),'zoho',_0xffa3('0xb'),_0xffa3('0xc'),_0xffa3('0xd'),_0xffa3('0xe'),_0xffa3('0xf')];exports['exec']=function(_0x554645,_0x4a7977,_0x11099f,_0x44014c,_0xf02b73,_0x44c7fe){if(_0x11099f){if(_[_0xffa3('0x10')](integrations,_0x554645['data1'][_0xffa3('0x11')]())){try{var _0x44dec0=null;var _0x341632='';var _0x54b16d=_0x11099f[_0x554645['data1'][_0xffa3('0x11')]()];if(_0x54b16d){var _0x51e730=_0x54b16d[_0x554645[_0xffa3('0x12')]];if(_0x51e730){var _0x18b4fa=_[_0xffa3('0x13')](_0x51e730[_0xffa3('0x14')],{'id':parseInt(_0x554645[_0xffa3('0x15')],0xa)});if(_0x18b4fa){if(_0x44014c){if(_0xf02b73&&_0x4a7977[_0xffa3('0x16')]){_0x341632=_0xffa3('0x16');}else if(_0x4a7977['routeId']){_0x341632=_0xffa3('0x17');}else{console[_0xffa3('0x18')](_0xffa3('0x19'),_0x4a7977);}}else{_0x341632=_0xffa3('0x1a');}switch(_0x554645[_0xffa3('0x1b')][_0xffa3('0x11')]()){case _0xffa3('0x1c'):zendesk[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case _0xffa3('0x9'):salesforce[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case'sugarcrm':sugarcrm[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case _0xffa3('0xa'):freshdesk[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case _0xffa3('0x1d'):zoho[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case _0xffa3('0xb'):desk[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case _0xffa3('0xc'):vtiger[_0x341632](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe);break;case _0xffa3('0xe'):freshsales['cs'](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe,_0x341632);break;case _0xffa3('0xf'):servicenow['cs'](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe,_0x341632);break;case'dynamics365':dynamics365['cs'](_0x554645,_0x4a7977,_0x18b4fa,_0x44014c,_0xf02b73,_0x51e730,_0x44c7fe,_0x341632);break;default:console[_0xffa3('0x18')](_0xffa3('0x1e'));}}else{_0x44dec0=require(_0xffa3('0x1f'))(_0x554645[_0xffa3('0x1b')][_0xffa3('0x11')]());_0x44dec0[_0xffa3('0x20')](_0xffa3('0x21'),util[_0xffa3('0x22')](_0xffa3('0x23'),_0x554645[_0xffa3('0x1b')][_0xffa3('0x11')](),_0x554645[_0xffa3('0x15')]));}}else{_0x44dec0=require(_0xffa3('0x1f'))(_0x554645[_0xffa3('0x1b')][_0xffa3('0x11')]());_0x44dec0['error'](_0xffa3('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x554645[_0xffa3('0x1b')]['toLowerCase'](),_0x554645[_0xffa3('0x12')]));}}else{}}catch(_0x38b555){console[_0xffa3('0x20')](_0x38b555);}}}}; \ 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 6b17038..f68de59 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 _0x7ffb=['Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','additionalSearchAccount','Lead','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','customVariable','Variable','name','toString','password','concat','securityToken','Connection','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','jsforce','ioredis','./util','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','IsReminderSet','IsRecurrence','contact','endUserType','lead','account','WhatId'];(function(_0x5e1a2c,_0x5dc878){var _0x58ed39=function(_0x24a9ad){while(--_0x24a9ad){_0x5e1a2c['push'](_0x5e1a2c['shift']());}};_0x58ed39(++_0x5dc878);}(_0x7ffb,0x1ec));var _0xb7ff=function(_0x25b439,_0xb20872){_0x25b439=_0x25b439-0x0;var _0xbf2210=_0x7ffb[_0x25b439];return _0xbf2210;};'use strict';var _=require(_0xb7ff('0x0'));var rp=require(_0xb7ff('0x1'));var moment=require('moment');var BPromise=require(_0xb7ff('0x2'));var md5=require('md5');var jsforce=require(_0xb7ff('0x3'));var util=require('util');var Redis=require(_0xb7ff('0x4'));var intUtil=require(_0xb7ff('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xb7ff('0x6'));config['redis']=_[_0xb7ff('0x7')](config[_0xb7ff('0x8')],{'host':_0xb7ff('0x9'),'port':0x18eb});var io=require(_0xb7ff('0xa'))(new Redis(config[_0xb7ff('0x8')]));function emit(_0x3313e5,_0x568f09,_0xa4ef86){io['to'](_0x3313e5)[_0xb7ff('0xb')](_0x568f09,_0xa4ef86);}function getTicket(_0x16b9d7,_0xb2869c,_0x52357d,_0x39e0ab,_0x3f896f,_0xab9a84,_0x5ca54b,_0x321bd7){var _0x409e96=Object[_0xb7ff('0xc')]({},{'OwnerId':_0xb2869c['id'],'Subject':intUtil[_0xb7ff('0xd')](_0x39e0ab[_0xb7ff('0xe')],_0x3f896f,'\x20'),'Description':intUtil[_0xb7ff('0xd')](_0x39e0ab[_0xb7ff('0xf')],_0x3f896f,'\x0a')},getCustomFields(_0xab9a84,_0x3f896f));if(_0x52357d){if(_0x39e0ab[_0xb7ff('0x10')]==='Task'){_0x409e96['ActivityDate']=moment['utc']();_0x409e96[_0xb7ff('0x11')]=![];_0x409e96[_0xb7ff('0x12')]=![];if(_0x52357d['endUserType']===_0xb7ff('0x13')||_0x52357d[_0xb7ff('0x14')]===_0xb7ff('0x15')){_0x409e96['WhoId']=_0x52357d['id'];}else if(_0x52357d[_0xb7ff('0x14')]===_0xb7ff('0x16')){_0x409e96[_0xb7ff('0x17')]=_0x52357d['id'];}}else if(_0x39e0ab[_0xb7ff('0x10')]===_0xb7ff('0x18')){if(_0x52357d['endUserType']===_0xb7ff('0x13')){_0x409e96[_0xb7ff('0x19')]=_0x52357d['id'];}else if(_0x52357d[_0xb7ff('0x14')]===_0xb7ff('0x16')){_0x409e96[_0xb7ff('0x1a')]=_0x52357d['id'];}else if(_0x52357d['endUserType']===_0xb7ff('0x15')&&_0x39e0ab[_0xb7ff('0x1b')]){_0x409e96[_0x39e0ab[_0xb7ff('0x1b')]]=_0x52357d['id'];}else{logger[_0xb7ff('0x1c')](_0xb7ff('0x1d'));}}}return _0x5ca54b['sobject'](_0x39e0ab['ticketType'])[_0xb7ff('0x1e')](_0x409e96);}function getUser(_0x242f43,_0x37613c,_0x1d88f8){if(!_['isNil'](_0x37613c)&&intUtil[_0xb7ff('0x1f')](_0x37613c)){var _0x1d2de4={'Email':_0x37613c};var _0x2908c6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1d88f8[_0xb7ff('0x20')](_0xb7ff('0x21'))[_0xb7ff('0x22')](_0x1d2de4,_0x2908c6)[_0xb7ff('0x23')]()['then'](function(_0x3be959){if(_0x3be959[_0xb7ff('0x24')]){var _0x4f81c5=_['find'](_0x3be959,function(_0x309939){return _0x309939[_0xb7ff('0x25')]===_0x37613c;});if(_0x4f81c5){logger[_0xb7ff('0x1c')](_0xb7ff('0x26'),_0x37613c);return BPromise[_0xb7ff('0x27')]({'id':_0x4f81c5['Id'],'name':_0x4f81c5['Name']});}}else{logger[_0xb7ff('0x1c')](_0xb7ff('0x28'),_0x37613c);return _0x1d88f8[_0xb7ff('0x29')]()[_0xb7ff('0x2a')](function(_0x1c2585){return BPromise[_0xb7ff('0x27')]({'id':_0x1c2585[_0xb7ff('0x2b')],'name':_0x1c2585[_0xb7ff('0x2c')]});});}});}else{logger[_0xb7ff('0x1c')](_0xb7ff('0x28'),_0x37613c);return _0x1d88f8[_0xb7ff('0x29')]()[_0xb7ff('0x2a')](function(_0xf4e307){return BPromise[_0xb7ff('0x27')]({'id':_0xf4e307[_0xb7ff('0x2b')],'name':_0xf4e307[_0xb7ff('0x2c')]});});}}function getEndUser(_0x2fcef2,_0x3036ee,_0x218a22,_0x3a23b0,_0x5dd40e){var _0x1993ad={'$or':{'Phone':_0x3a23b0}};var _0x31ca2a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb7ff('0x27')]()[_0xb7ff('0x2a')](function(){logger[_0xb7ff('0x1c')](_0xb7ff('0x2d'),_0x3a23b0,_0x3036ee[_0xb7ff('0x2e')]);switch(_0x3036ee[_0xb7ff('0x2e')]){case _0xb7ff('0x2f'):var _0x1c4e76=_[_0xb7ff('0x30')](_0x1993ad);if(_0x3036ee['additionalSearchContact']){var _0xb24d73={};_0xb24d73[_0x3036ee[_0xb7ff('0x31')]]=_0x3a23b0;_['merge'](_0x1c4e76[_0xb7ff('0x32')],_0xb24d73);}return _0x5dd40e[_0xb7ff('0x20')](_0xb7ff('0x33'))[_0xb7ff('0x22')](_0x1c4e76,_0x31ca2a)[_0xb7ff('0x23')]()[_0xb7ff('0x2a')](function(_0x42567c){if(_0x42567c&&_0x42567c[_0xb7ff('0x24')]){return _0x42567c;}else{var _0x503cf3=_['cloneDeep'](_0x1993ad);if(_0x3036ee[_0xb7ff('0x34')]){var _0x770560={};_0x770560[_0x3036ee[_0xb7ff('0x34')]]=_0x3a23b0;_[_0xb7ff('0x35')](_0x503cf3[_0xb7ff('0x32')],_0x770560);}return _0x5dd40e[_0xb7ff('0x20')]('Lead')[_0xb7ff('0x22')](_0x503cf3,_0x31ca2a);}});case'account_contact_lead':var _0x18ac45=_[_0xb7ff('0x30')](_0x1993ad);if(_0x3036ee[_0xb7ff('0x36')]){var _0xb24d73={};_0xb24d73[_0x3036ee[_0xb7ff('0x36')]]=_0x3a23b0;_['merge'](_0x18ac45[_0xb7ff('0x32')],_0xb24d73);}return _0x5dd40e[_0xb7ff('0x20')]('Account')[_0xb7ff('0x22')](_0x18ac45,_0x31ca2a)[_0xb7ff('0x23')]()[_0xb7ff('0x2a')](function(_0x3d61e4){if(_0x3d61e4&&_0x3d61e4[_0xb7ff('0x24')]){return _0x3d61e4;}else{var _0x25aaf6=_[_0xb7ff('0x30')](_0x1993ad);if(_0x3036ee[_0xb7ff('0x31')]){var _0x3a80c5={};_0x3a80c5[_0x3036ee[_0xb7ff('0x31')]]=_0x3a23b0;_[_0xb7ff('0x35')](_0x25aaf6[_0xb7ff('0x32')],_0x3a80c5);}return _0x5dd40e[_0xb7ff('0x20')](_0xb7ff('0x33'))['find'](_0x25aaf6,_0x31ca2a)[_0xb7ff('0x2a')](function(_0x3a2d79){if(_0x3a2d79&&_0x3a2d79[_0xb7ff('0x24')]){return _0x3a2d79;}else{var _0x1bbd8f=_[_0xb7ff('0x30')](_0x1993ad);if(_0x3036ee[_0xb7ff('0x34')]){var _0x46605e={};_0x46605e[_0x3036ee[_0xb7ff('0x34')]]=_0x3a23b0;_[_0xb7ff('0x35')](_0x1bbd8f[_0xb7ff('0x32')],_0x46605e);}return _0x5dd40e[_0xb7ff('0x20')](_0xb7ff('0x37'))['find'](_0x1bbd8f,_0x31ca2a);}});}});case'contact':var _0x1c4e76=_['cloneDeep'](_0x1993ad);if(_0x3036ee['additionalSearchContact']){var _0xb24d73={};_0xb24d73[_0x3036ee[_0xb7ff('0x31')]]=_0x3a23b0;_[_0xb7ff('0x35')](_0x1c4e76[_0xb7ff('0x32')],_0xb24d73);}return _0x5dd40e['sobject'](_0xb7ff('0x33'))[_0xb7ff('0x22')](_0x1c4e76,_0x31ca2a)['execute']();case _0xb7ff('0x15'):var _0x2dc4fd=_[_0xb7ff('0x30')](_0x1993ad);if(_0x3036ee[_0xb7ff('0x34')]){var _0xb24d73={};_0xb24d73[_0x3036ee[_0xb7ff('0x34')]]=_0x3a23b0;_[_0xb7ff('0x35')](_0x2dc4fd[_0xb7ff('0x32')],_0xb24d73);}return _0x5dd40e[_0xb7ff('0x20')](_0xb7ff('0x37'))[_0xb7ff('0x22')](_0x2dc4fd,_0x31ca2a);case _0xb7ff('0x16'):var _0x18ac45=_[_0xb7ff('0x30')](_0x1993ad);if(_0x3036ee[_0xb7ff('0x36')]){var _0xb24d73={};_0xb24d73[_0x3036ee[_0xb7ff('0x36')]]=_0x3a23b0;_['merge'](_0x18ac45[_0xb7ff('0x32')],_0xb24d73);}return _0x5dd40e[_0xb7ff('0x20')](_0xb7ff('0x38'))['find'](_0x18ac45,_0x31ca2a);default:return null;}})[_0xb7ff('0x2a')](function(_0x465c78){if(_0x465c78&&_0x465c78[_0xb7ff('0x24')]){var _0xae4dfc=_[_0xb7ff('0x39')](_0x465c78);if(_0xae4dfc){return BPromise[_0xb7ff('0x27')]({'id':_0xae4dfc['Id'],'name':_0xae4dfc[_0xb7ff('0x3a')],'phone':_0xae4dfc['Phone'],'endUserType':_0xae4dfc[_0xb7ff('0x3b')][_0xb7ff('0x3c')][_0xb7ff('0x3d')]()});}}})[_0xb7ff('0x2a')](function(_0x3ca78c){if(_0x3ca78c){logger['info'](_0xb7ff('0x3e'),_0x3ca78c[_0xb7ff('0x14')],_0x3a23b0);return BPromise[_0xb7ff('0x27')](_0x3ca78c);}else{logger[_0xb7ff('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x3a23b0);var _0x2b723e={'Phone':_0x3a23b0};if(_0x3036ee[_0xb7ff('0x3f')]){if(_0x3036ee[_0xb7ff('0x3f')]===_0xb7ff('0x13')){logger[_0xb7ff('0x1c')](_0xb7ff('0x40'),_0x3a23b0,_0x3036ee[_0xb7ff('0x3f')]);_0x2b723e[_0xb7ff('0x41')]=_0x218a22!==''?_0x218a22:util[_0xb7ff('0x42')](_0xb7ff('0x43'),_0x3a23b0);}else if(_0x3036ee['moduleCreate']==='lead'){logger[_0xb7ff('0x1c')](_0xb7ff('0x40'),_0x3a23b0,_0x3036ee[_0xb7ff('0x3f')]);_0x2b723e['LastName']=_0x218a22!==''?_0x218a22:util[_0xb7ff('0x42')](_0xb7ff('0x43'),_0x3a23b0);_0x2b723e[_0xb7ff('0x44')]=_0xb7ff('0x45');}else if(_0x3036ee[_0xb7ff('0x3f')]==='account'){logger['info'](_0xb7ff('0x40'),_0x3a23b0,_0x3036ee[_0xb7ff('0x3f')]);_0x2b723e['Name']=_0x218a22!==_0xb7ff('0x46')?_0x218a22:util['format'](_0xb7ff('0x43'),_0x3a23b0);}else{return null;}}return _0x5dd40e[_0xb7ff('0x20')](_[_0xb7ff('0x47')](_0x3036ee[_0xb7ff('0x3f')]))[_0xb7ff('0x1e')](_0x2b723e)[_0xb7ff('0x2a')](function(_0xba1a77){return BPromise['resolve']({'id':_0xba1a77['id'],'endUserType':_0x3036ee[_0xb7ff('0x3f')]});});}});}function getCustomFields(_0x1362d3,_0x369da0){var _0x2ee3ee={};if(_0x1362d3[_0xb7ff('0x24')]>0x0){_[_0xb7ff('0x48')](_0x1362d3,function(_0x405d2d){if(_[_0xb7ff('0x49')]([_0xb7ff('0x4a'),_0xb7ff('0x4b')],_0x405d2d[_0xb7ff('0x3c')])&&_0x405d2d[_0xb7ff('0x4c')]){_0x2ee3ee[_0x405d2d[_0xb7ff('0x4c')]]=_0x405d2d[_0xb7ff('0x4d')]['toString']();}else if(_0x405d2d['type']===_0xb7ff('0x4e')&&_0x405d2d['variableName']&&_0x405d2d[_0xb7ff('0x4c')]){_0x369da0[_0x405d2d[_0xb7ff('0x4f')]]&&(_0x2ee3ee[_0x405d2d['idField']]=_0x369da0[_0x405d2d[_0xb7ff('0x4f')]]['toString']());}else if(_0x405d2d[_0xb7ff('0x3c')]===_0xb7ff('0x50')&&_0x405d2d[_0xb7ff('0x51')]&&_0x405d2d[_0xb7ff('0x51')][_0xb7ff('0x52')]&&_0x405d2d[_0xb7ff('0x4c')]){_0x369da0[_0x405d2d['Variable'][_0xb7ff('0x52')][_0xb7ff('0x3d')]()]&&(_0x2ee3ee[_0x405d2d['idField']]=_0x369da0[_0x405d2d[_0xb7ff('0x51')][_0xb7ff('0x52')]['toLowerCase']()][_0xb7ff('0x53')]());}});}return _0x2ee3ee;}function getConnection(_0x5a0bb5){var _0x6fa983=_0x5a0bb5[_0xb7ff('0x54')][_0xb7ff('0x55')](_0x5a0bb5[_0xb7ff('0x56')]);var _0x3f0c88=new jsforce[(_0xb7ff('0x57'))]({'oauth2':{'loginUrl':_0x5a0bb5['remoteUri']||'https://login.salesforce.com','clientId':_0x5a0bb5[_0xb7ff('0x58')],'clientSecret':_0x5a0bb5['clientSecret']}});return _0x3f0c88[_0xb7ff('0x59')](_0x5a0bb5['username'],_0x6fa983)[_0xb7ff('0x2a')](function(){logger['info'](_0xb7ff('0x5a'));return _0x3f0c88;});}exports[_0xb7ff('0x5b')]=function(_0x23c534,_0x36ec38,_0x4be2e3,_0x216022,_0x48def3,_0x2b2eb6){var _0x4c32da,_0x4b12fd,_0x845c60,_0x5eb9cb;_0x2b2eb6[_0xb7ff('0x5c')]=intUtil[_0xb7ff('0x5d')](_0x2b2eb6[_0xb7ff('0x5c')]);_0x2b2eb6[_0xb7ff('0x5e')]=intUtil[_0xb7ff('0x5d')](_0x2b2eb6[_0xb7ff('0x5e')]);if(_0x48def3&&_0x48def3[_0xb7ff('0x5f')]){logger[_0xb7ff('0x1c')](_0xb7ff('0x60'),_0xb7ff('0x61'));_0x36ec38[_0xb7ff('0x62')]=util[_0xb7ff('0x42')](_0xb7ff('0x63'),_0x2b2eb6[_0xb7ff('0x5c')],_0x36ec38[_0xb7ff('0x64')],md5(_0x36ec38[_0xb7ff('0x64')]));}else{_0x36ec38[_0xb7ff('0x62')]='';}return getConnection(_0x2b2eb6)[_0xb7ff('0x2a')](function(_0x65eb80){_0x5eb9cb=_0x65eb80;return getUser(_0x2b2eb6,_0x216022['email'],_0x5eb9cb);})[_0xb7ff('0x2a')](function(_0x54ea5e){_0x4c32da=_0x54ea5e;return getEndUser(_0x2b2eb6,_0x4be2e3,_0x36ec38[_0xb7ff('0x65')],_0x36ec38[_0xb7ff('0x66')],_0x5eb9cb);})[_0xb7ff('0x2a')](function(_0x504d12){_0x4b12fd=_0x504d12;return getTicket(_0x2b2eb6,_0x4c32da,_0x4b12fd,_0x4be2e3,_0x36ec38,_0x4be2e3[_0xb7ff('0x67')],_0x5eb9cb,_0xb7ff('0x5b'));})['then'](function(_0x2539ca){_0x845c60=_0x2539ca;logger[_0xb7ff('0x1c')](_0xb7ff('0x68'),_0x845c60['id']);logger[_0xb7ff('0x1c')](_0xb7ff('0x69'),_0x845c60['id'],_0x216022[_0xb7ff('0x52')],_0x2b2eb6['type']);switch(_0x2b2eb6['type']){case _0xb7ff('0x6a'):emit(util['format'](_0xb7ff('0x6b'),_0x216022[_0xb7ff('0x52')]),_0xb7ff('0x6c'),{'recordId':_0x845c60['id']});break;case _0xb7ff('0x6d'):emit(util[_0xb7ff('0x42')]('user:%s',_0x216022[_0xb7ff('0x52')]),'trigger:browser:url',{'uri':util['format'](_0xb7ff('0x6e'),_0x5eb9cb[_0xb7ff('0x6f')],_0x845c60['id'])});break;default:logger[_0xb7ff('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xb7ff('0x71')](function(_0x21e631){logger[_0xb7ff('0x70')](_0xb7ff('0x60'),_0x21e631);});};exports[_0xb7ff('0x72')]=function(_0x2e9f7b,_0xfc0a53,_0x428153,_0x2b1a03,_0x438af9,_0x385f2d,_0x1bd13e){var _0x53311e,_0x25cdbe,_0x550eb9,_0x5b327b;_0x385f2d[_0xb7ff('0x5c')]=intUtil['stripTrailingSlash'](_0x385f2d[_0xb7ff('0x5c')]);_0x385f2d[_0xb7ff('0x5e')]=intUtil[_0xb7ff('0x5d')](_0x385f2d[_0xb7ff('0x5e')]);if(_0x1bd13e&&_0x1bd13e['recordingFormat']&&_0x1bd13e[_0xb7ff('0x73')]!==_0xb7ff('0x74')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xfc0a53[_0xb7ff('0x62')]=util[_0xb7ff('0x42')](_0xb7ff('0x63'),_0x385f2d[_0xb7ff('0x5c')],_0xfc0a53[_0xb7ff('0x64')],md5(_0xfc0a53[_0xb7ff('0x64')]));}return getConnection(_0x385f2d)[_0xb7ff('0x2a')](function(_0x5e23ea){_0x5b327b=_0x5e23ea;return getUser(_0x385f2d,_0x2b1a03[_0xb7ff('0x75')],_0x5b327b);})['then'](function(_0x36dc0e){_0x53311e=_0x36dc0e;return getEndUser(_0x385f2d,_0x428153,_0xfc0a53[_0xb7ff('0x76')],_0xfc0a53[_0xb7ff('0x77')],_0x5b327b);})[_0xb7ff('0x2a')](function(_0x1141c7){_0x25cdbe=_0x1141c7;return getTicket(_0x385f2d,_0x53311e,_0x25cdbe,_0x428153,_0xfc0a53,_0x428153[_0xb7ff('0x67')],_0x5b327b,_0xb7ff('0x72'));})[_0xb7ff('0x2a')](function(_0x19d8cb){_0x550eb9=_0x19d8cb;logger[_0xb7ff('0x1c')](_0xb7ff('0x78'),_0x550eb9['id']);logger[_0xb7ff('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x550eb9['id'],_0x2b1a03[_0xb7ff('0x52')],_0x385f2d[_0xb7ff('0x3c')]);switch(_0x385f2d[_0xb7ff('0x3c')]){case _0xb7ff('0x6a'):emit(util[_0xb7ff('0x42')]('user:%s',_0x2b1a03[_0xb7ff('0x52')]),'trigger:salesforce:display',{'recordId':_0x550eb9['id']});break;case _0xb7ff('0x6d'):emit(util[_0xb7ff('0x42')]('user:%s',_0x2b1a03[_0xb7ff('0x52')]),_0xb7ff('0x79'),{'uri':util[_0xb7ff('0x42')]('%s/%s/e',_0x5b327b[_0xb7ff('0x6f')],_0x550eb9['id'])});break;default:logger[_0xb7ff('0x70')]('[OUTBOUND]',_0xb7ff('0x7a'));}})[_0xb7ff('0x71')](function(_0x1495dc){logger[_0xb7ff('0x70')](_0xb7ff('0x7b'),_0x1495dc);});};exports['unmanaged']=function(_0x3bb018,_0x43f65,_0x47cc02,_0x589daa,_0x39876f,_0x140ad4){var _0x2dba21,_0x1dfef0,_0x58d4a3,_0x147dd1;_0x140ad4['serverUrl']=intUtil['stripTrailingSlash'](_0x140ad4[_0xb7ff('0x5c')]);_0x140ad4[_0xb7ff('0x5e')]=intUtil[_0xb7ff('0x5d')](_0x140ad4[_0xb7ff('0x5e')]);if(_0x39876f&&_0x39876f[_0xb7ff('0x5f')]){logger['info']('['+_0x43f65[_0xb7ff('0x7c')][_0xb7ff('0x7d')]()+']','Recording\x20is\x20enabled!');_0x43f65['recordingURL']=util['format'](_0xb7ff('0x63'),_0x140ad4[_0xb7ff('0x5c')],_0x43f65[_0xb7ff('0x64')],md5(_0x43f65[_0xb7ff('0x64')]));}else{_0x43f65[_0xb7ff('0x62')]='';}return getConnection(_0x140ad4)[_0xb7ff('0x2a')](function(_0xa749e){_0x147dd1=_0xa749e;if(!_[_0xb7ff('0x7e')](_0x589daa)){return getUser(_0x140ad4,_0x589daa[_0xb7ff('0x52')],_0x147dd1);}else{return getUser(_0x140ad4,null,_0x147dd1);}})[_0xb7ff('0x2a')](function(_0x2d615d){_0x2dba21=_0x2d615d;return getEndUser(_0x140ad4,_0x47cc02,_0x43f65['calleridname'],_0x43f65['calleridnum'],_0x147dd1);})[_0xb7ff('0x2a')](function(_0x3249ec){_0x1dfef0=_0x3249ec;return getTicket(_0x140ad4,_0x2dba21,_0x1dfef0,_0x47cc02,_0x43f65,_0x47cc02[_0xb7ff('0x67')],_0x147dd1);})[_0xb7ff('0x2a')](function(_0x242d9e){_0x58d4a3=_0x242d9e;logger[_0xb7ff('0x1c')]('['+_0x43f65['lastevent'][_0xb7ff('0x7d')]()+_0xb7ff('0x7f'),_0x58d4a3['id']);logger[_0xb7ff('0x1c')]('['+_0x43f65[_0xb7ff('0x7c')][_0xb7ff('0x7d')]()+_0xb7ff('0x80'),_0x140ad4['type']);})[_0xb7ff('0x71')](function(_0x31e2e1){logger[_0xb7ff('0x70')]('['+_0x43f65[_0xb7ff('0x7c')][_0xb7ff('0x7d')]()+']',_0x31e2e1);});}; \ No newline at end of file +var _0xb1ff=['cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','Caller\x20-\x20%s','','format','Company','No\x20Company','create','includes','type','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','recordingFormat','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','moment','bluebird','jsforce','util','ioredis','./util','salesforce','redis','localhost','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','info','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x179a0c,_0x2ca073){var _0x1c8b9a=function(_0xfa6124){while(--_0xfa6124){_0x179a0c['push'](_0x179a0c['shift']());}};_0x1c8b9a(++_0x2ca073);}(_0xb1ff,0x139));var _0xfb1f=function(_0x2812c2,_0x2b382d){_0x2812c2=_0x2812c2-0x0;var _0x218ac9=_0xb1ff[_0x2812c2];return _0x218ac9;};'use strict';var _=require(_0xfb1f('0x0'));var rp=require('request-promise');var moment=require(_0xfb1f('0x1'));var BPromise=require(_0xfb1f('0x2'));var md5=require('md5');var jsforce=require(_0xfb1f('0x3'));var util=require(_0xfb1f('0x4'));var Redis=require(_0xfb1f('0x5'));var intUtil=require(_0xfb1f('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfb1f('0x7'));config[_0xfb1f('0x8')]=_['defaults'](config[_0xfb1f('0x8')],{'host':_0xfb1f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfb1f('0x8')]));function emit(_0x5c36c8,_0x5be3d6,_0x46c420){io['to'](_0x5c36c8)[_0xfb1f('0xa')](_0x5be3d6,_0x46c420);}function getTicket(_0x59c846,_0x1ad1ef,_0x3ccfc5,_0x142ea9,_0x40f615,_0x411ca8,_0x5c9094,_0x57ac7f){var _0x1a0f27=Object[_0xfb1f('0xb')]({},{'OwnerId':_0x1ad1ef['id'],'Subject':intUtil['getString'](_0x142ea9[_0xfb1f('0xc')],_0x40f615,'\x20'),'Description':intUtil['getString'](_0x142ea9[_0xfb1f('0xd')],_0x40f615,'\x0a')},getCustomFields(_0x411ca8,_0x40f615));if(_0x3ccfc5){if(_0x142ea9[_0xfb1f('0xe')]===_0xfb1f('0xf')){_0x1a0f27[_0xfb1f('0x10')]=moment[_0xfb1f('0x11')]();_0x1a0f27[_0xfb1f('0x12')]=![];_0x1a0f27[_0xfb1f('0x13')]=![];if(_0x3ccfc5[_0xfb1f('0x14')]===_0xfb1f('0x15')||_0x3ccfc5['endUserType']===_0xfb1f('0x16')){_0x1a0f27[_0xfb1f('0x17')]=_0x3ccfc5['id'];}else if(_0x3ccfc5[_0xfb1f('0x14')]===_0xfb1f('0x18')){_0x1a0f27[_0xfb1f('0x19')]=_0x3ccfc5['id'];}}else if(_0x142ea9[_0xfb1f('0xe')]===_0xfb1f('0x1a')){if(_0x3ccfc5[_0xfb1f('0x14')]===_0xfb1f('0x15')){_0x1a0f27[_0xfb1f('0x1b')]=_0x3ccfc5['id'];}else if(_0x3ccfc5[_0xfb1f('0x14')]===_0xfb1f('0x18')){_0x1a0f27['AccountId']=_0x3ccfc5['id'];}else if(_0x3ccfc5[_0xfb1f('0x14')]===_0xfb1f('0x16')&&_0x142ea9['leadId']){_0x1a0f27[_0x142ea9['leadId']]=_0x3ccfc5['id'];}else{logger[_0xfb1f('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5c9094[_0xfb1f('0x1d')](_0x142ea9[_0xfb1f('0xe')])['create'](_0x1a0f27);}function getUser(_0x5b35d5,_0x32f9db,_0x235600){if(!_[_0xfb1f('0x1e')](_0x32f9db)&&intUtil[_0xfb1f('0x1f')](_0x32f9db)){var _0x4b6241={'Email':_0x32f9db};var _0xb429fa={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x235600[_0xfb1f('0x1d')](_0xfb1f('0x20'))[_0xfb1f('0x21')](_0x4b6241,_0xb429fa)[_0xfb1f('0x22')]()[_0xfb1f('0x23')](function(_0x136e53){if(_0x136e53[_0xfb1f('0x24')]){var _0x30de30=_[_0xfb1f('0x21')](_0x136e53,function(_0x56b91a){return _0x56b91a[_0xfb1f('0x25')]===_0x32f9db;});if(_0x30de30){logger[_0xfb1f('0x1c')](_0xfb1f('0x26'),_0x32f9db);return BPromise['resolve']({'id':_0x30de30['Id'],'name':_0x30de30[_0xfb1f('0x27')]});}}else{logger[_0xfb1f('0x1c')](_0xfb1f('0x28'),_0x32f9db);return _0x235600['identity']()['then'](function(_0x4a495e){return BPromise[_0xfb1f('0x29')]({'id':_0x4a495e[_0xfb1f('0x2a')],'name':_0x4a495e[_0xfb1f('0x2b')]});});}});}else{logger['info'](_0xfb1f('0x28'),_0x32f9db);return _0x235600[_0xfb1f('0x2c')]()[_0xfb1f('0x23')](function(_0x3c80f2){return BPromise[_0xfb1f('0x29')]({'id':_0x3c80f2[_0xfb1f('0x2a')],'name':_0x3c80f2[_0xfb1f('0x2b')]});});}}function getEndUser(_0x48e935,_0x4b2692,_0x57a9ad,_0x224584,_0x9e1f47){var _0x2be286={'$or':{'Phone':_0x224584}};var _0x425b39={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xfb1f('0x23')](function(){logger['info'](_0xfb1f('0x2d'),_0x224584,_0x4b2692[_0xfb1f('0x2e')]);switch(_0x4b2692[_0xfb1f('0x2e')]){case'contact_lead':var _0x35de33=_[_0xfb1f('0x2f')](_0x2be286);if(_0x4b2692[_0xfb1f('0x30')]){var _0x5cf5c6={};_0x5cf5c6[_0x4b2692['additionalSearchContact']]=_0x224584;_['merge'](_0x35de33[_0xfb1f('0x31')],_0x5cf5c6);}return _0x9e1f47['sobject'](_0xfb1f('0x32'))[_0xfb1f('0x21')](_0x35de33,_0x425b39)[_0xfb1f('0x22')]()['then'](function(_0x49b7d8){if(_0x49b7d8&&_0x49b7d8[_0xfb1f('0x24')]){return _0x49b7d8;}else{var _0x53fc56=_['cloneDeep'](_0x2be286);if(_0x4b2692[_0xfb1f('0x33')]){var _0xe6c54b={};_0xe6c54b[_0x4b2692['additionalSearchLead']]=_0x224584;_[_0xfb1f('0x34')](_0x53fc56['$or'],_0xe6c54b);}return _0x9e1f47['sobject'](_0xfb1f('0x35'))['find'](_0x53fc56,_0x425b39);}});case _0xfb1f('0x36'):var _0x563b1e=_[_0xfb1f('0x2f')](_0x2be286);if(_0x4b2692[_0xfb1f('0x37')]){var _0x5cf5c6={};_0x5cf5c6[_0x4b2692[_0xfb1f('0x37')]]=_0x224584;_[_0xfb1f('0x34')](_0x563b1e[_0xfb1f('0x31')],_0x5cf5c6);}return _0x9e1f47[_0xfb1f('0x1d')](_0xfb1f('0x38'))[_0xfb1f('0x21')](_0x563b1e,_0x425b39)[_0xfb1f('0x22')]()[_0xfb1f('0x23')](function(_0x7987b){if(_0x7987b&&_0x7987b[_0xfb1f('0x24')]){return _0x7987b;}else{var _0x4b62c9=_[_0xfb1f('0x2f')](_0x2be286);if(_0x4b2692['additionalSearchContact']){var _0x4124dd={};_0x4124dd[_0x4b2692[_0xfb1f('0x30')]]=_0x224584;_['merge'](_0x4b62c9[_0xfb1f('0x31')],_0x4124dd);}return _0x9e1f47[_0xfb1f('0x1d')](_0xfb1f('0x32'))[_0xfb1f('0x21')](_0x4b62c9,_0x425b39)[_0xfb1f('0x23')](function(_0x47cc7d){if(_0x47cc7d&&_0x47cc7d[_0xfb1f('0x24')]){return _0x47cc7d;}else{var _0xc0a4fe=_[_0xfb1f('0x2f')](_0x2be286);if(_0x4b2692[_0xfb1f('0x33')]){var _0x483c70={};_0x483c70[_0x4b2692[_0xfb1f('0x33')]]=_0x224584;_[_0xfb1f('0x34')](_0xc0a4fe[_0xfb1f('0x31')],_0x483c70);}return _0x9e1f47['sobject'](_0xfb1f('0x35'))['find'](_0xc0a4fe,_0x425b39);}});}});case _0xfb1f('0x15'):var _0x35de33=_['cloneDeep'](_0x2be286);if(_0x4b2692[_0xfb1f('0x30')]){var _0x5cf5c6={};_0x5cf5c6[_0x4b2692['additionalSearchContact']]=_0x224584;_[_0xfb1f('0x34')](_0x35de33['$or'],_0x5cf5c6);}return _0x9e1f47[_0xfb1f('0x1d')](_0xfb1f('0x32'))[_0xfb1f('0x21')](_0x35de33,_0x425b39)[_0xfb1f('0x22')]();case _0xfb1f('0x16'):var _0x3bb789=_[_0xfb1f('0x2f')](_0x2be286);if(_0x4b2692[_0xfb1f('0x33')]){var _0x5cf5c6={};_0x5cf5c6[_0x4b2692['additionalSearchLead']]=_0x224584;_[_0xfb1f('0x34')](_0x3bb789['$or'],_0x5cf5c6);}return _0x9e1f47[_0xfb1f('0x1d')]('Lead')[_0xfb1f('0x21')](_0x3bb789,_0x425b39);case _0xfb1f('0x18'):var _0x563b1e=_[_0xfb1f('0x2f')](_0x2be286);if(_0x4b2692['additionalSearchAccount']){var _0x5cf5c6={};_0x5cf5c6[_0x4b2692[_0xfb1f('0x37')]]=_0x224584;_['merge'](_0x563b1e['$or'],_0x5cf5c6);}return _0x9e1f47[_0xfb1f('0x1d')](_0xfb1f('0x38'))[_0xfb1f('0x21')](_0x563b1e,_0x425b39);default:return null;}})[_0xfb1f('0x23')](function(_0x30e87d){if(_0x30e87d&&_0x30e87d['length']){var _0x2de5d2=_[_0xfb1f('0x39')](_0x30e87d);if(_0x2de5d2){return BPromise['resolve']({'id':_0x2de5d2['Id'],'name':_0x2de5d2[_0xfb1f('0x27')],'phone':_0x2de5d2[_0xfb1f('0x3a')],'endUserType':_0x2de5d2[_0xfb1f('0x3b')]['type'][_0xfb1f('0x3c')]()});}}})[_0xfb1f('0x23')](function(_0x41b669){if(_0x41b669){logger[_0xfb1f('0x1c')](_0xfb1f('0x3d'),_0x41b669[_0xfb1f('0x14')],_0x224584);return BPromise[_0xfb1f('0x29')](_0x41b669);}else{logger[_0xfb1f('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x224584);var _0x4e048d={'Phone':_0x224584};if(_0x4b2692['moduleCreate']){if(_0x4b2692[_0xfb1f('0x3e')]===_0xfb1f('0x15')){logger[_0xfb1f('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x224584,_0x4b2692[_0xfb1f('0x3e')]);_0x4e048d[_0xfb1f('0x3f')]=_0x57a9ad!==''?_0x57a9ad:util['format'](_0xfb1f('0x40'),_0x224584);}else if(_0x4b2692[_0xfb1f('0x3e')]===_0xfb1f('0x16')){logger[_0xfb1f('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x224584,_0x4b2692['moduleCreate']);_0x4e048d[_0xfb1f('0x3f')]=_0x57a9ad!==_0xfb1f('0x41')?_0x57a9ad:util[_0xfb1f('0x42')](_0xfb1f('0x40'),_0x224584);_0x4e048d[_0xfb1f('0x43')]=_0xfb1f('0x44');}else if(_0x4b2692[_0xfb1f('0x3e')]===_0xfb1f('0x18')){logger[_0xfb1f('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x224584,_0x4b2692[_0xfb1f('0x3e')]);_0x4e048d[_0xfb1f('0x27')]=_0x57a9ad!==_0xfb1f('0x41')?_0x57a9ad:util['format'](_0xfb1f('0x40'),_0x224584);}else{return null;}}return _0x9e1f47[_0xfb1f('0x1d')](_['upperFirst'](_0x4b2692[_0xfb1f('0x3e')]))[_0xfb1f('0x45')](_0x4e048d)[_0xfb1f('0x23')](function(_0x1b5543){return BPromise[_0xfb1f('0x29')]({'id':_0x1b5543['id'],'endUserType':_0x4b2692['moduleCreate']});});}});}function getCustomFields(_0x55c985,_0x2658e0){var _0xe3a5f6={};if(_0x55c985[_0xfb1f('0x24')]>0x0){_['forEach'](_0x55c985,function(_0x2fb510){if(_[_0xfb1f('0x46')](['string','picklist'],_0x2fb510[_0xfb1f('0x47')])&&_0x2fb510['idField']){_0xe3a5f6[_0x2fb510[_0xfb1f('0x48')]]=_0x2fb510[_0xfb1f('0x49')][_0xfb1f('0x4a')]();}else if(_0x2fb510[_0xfb1f('0x47')]===_0xfb1f('0x4b')&&_0x2fb510[_0xfb1f('0x4c')]&&_0x2fb510[_0xfb1f('0x48')]){_0x2658e0[_0x2fb510['variableName']]&&(_0xe3a5f6[_0x2fb510['idField']]=_0x2658e0[_0x2fb510[_0xfb1f('0x4c')]][_0xfb1f('0x4a')]());}else if(_0x2fb510[_0xfb1f('0x47')]==='customVariable'&&_0x2fb510[_0xfb1f('0x4d')]&&_0x2fb510[_0xfb1f('0x4d')][_0xfb1f('0x4e')]&&_0x2fb510[_0xfb1f('0x48')]){_0x2658e0[_0x2fb510[_0xfb1f('0x4d')]['name']['toLowerCase']()]&&(_0xe3a5f6[_0x2fb510[_0xfb1f('0x48')]]=_0x2658e0[_0x2fb510[_0xfb1f('0x4d')]['name'][_0xfb1f('0x3c')]()][_0xfb1f('0x4a')]());}});}return _0xe3a5f6;}function getConnection(_0x51efef){var _0x18d436=_0x51efef[_0xfb1f('0x4f')][_0xfb1f('0x50')](_0x51efef[_0xfb1f('0x51')]);var _0x301894=new jsforce[(_0xfb1f('0x52'))]({'oauth2':{'loginUrl':_0x51efef[_0xfb1f('0x53')]||'https://login.salesforce.com','clientId':_0x51efef['clientId'],'clientSecret':_0x51efef[_0xfb1f('0x54')]}});return _0x301894['login'](_0x51efef[_0xfb1f('0x55')],_0x18d436)[_0xfb1f('0x23')](function(){logger[_0xfb1f('0x1c')](_0xfb1f('0x56'));return _0x301894;});}exports[_0xfb1f('0x57')]=function(_0x47af81,_0x590aa6,_0x11687b,_0x8f796f,_0x267db2,_0x1b5562){var _0x126b03,_0x236caf,_0x1c7cd5,_0x1b779c;_0x1b5562[_0xfb1f('0x58')]=intUtil[_0xfb1f('0x59')](_0x1b5562[_0xfb1f('0x58')]);_0x1b5562[_0xfb1f('0x53')]=intUtil[_0xfb1f('0x59')](_0x1b5562[_0xfb1f('0x53')]);if(_0x267db2&&_0x267db2[_0xfb1f('0x5a')]){logger[_0xfb1f('0x1c')](_0xfb1f('0x5b'),_0xfb1f('0x5c'));_0x590aa6[_0xfb1f('0x5d')]=util[_0xfb1f('0x42')](_0xfb1f('0x5e'),_0x1b5562[_0xfb1f('0x58')],_0x590aa6[_0xfb1f('0x5f')],md5(_0x590aa6['uniqueid']));}else{_0x590aa6[_0xfb1f('0x5d')]='';}return getConnection(_0x1b5562)[_0xfb1f('0x23')](function(_0x335f7c){_0x1b779c=_0x335f7c;return getUser(_0x1b5562,_0x8f796f[_0xfb1f('0x60')],_0x1b779c);})['then'](function(_0x2bea78){_0x126b03=_0x2bea78;return getEndUser(_0x1b5562,_0x11687b,_0x590aa6[_0xfb1f('0x61')],_0x590aa6['calleridnum'],_0x1b779c);})[_0xfb1f('0x23')](function(_0x3365ee){_0x236caf=_0x3365ee;return getTicket(_0x1b5562,_0x126b03,_0x236caf,_0x11687b,_0x590aa6,_0x11687b[_0xfb1f('0x62')],_0x1b779c,_0xfb1f('0x57'));})[_0xfb1f('0x23')](function(_0x521a15){_0x1c7cd5=_0x521a15;logger[_0xfb1f('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1c7cd5['id']);logger[_0xfb1f('0x1c')](_0xfb1f('0x63'),_0x1c7cd5['id'],_0x8f796f['name'],_0x1b5562['type']);switch(_0x1b5562[_0xfb1f('0x47')]){case _0xfb1f('0x64'):emit(util[_0xfb1f('0x42')]('user:%s',_0x8f796f[_0xfb1f('0x4e')]),_0xfb1f('0x65'),{'recordId':_0x1c7cd5['id']});break;case _0xfb1f('0x66'):emit(util['format'](_0xfb1f('0x67'),_0x8f796f['name']),_0xfb1f('0x68'),{'uri':util[_0xfb1f('0x42')](_0xfb1f('0x69'),_0x1b779c['instanceUrl'],_0x1c7cd5['id'])});break;default:logger['error'](_0xfb1f('0x6a'));}})['catch'](function(_0x415cca){logger[_0xfb1f('0x6b')](_0xfb1f('0x5b'),_0x415cca);});};exports['outbound']=function(_0x46d15f,_0x3083d3,_0x3f052f,_0x479db8,_0x11e8cd,_0x285be9,_0x307bcb){var _0x3b5719,_0x25ff05,_0x35f862,_0x5dd3ed;_0x285be9[_0xfb1f('0x58')]=intUtil[_0xfb1f('0x59')](_0x285be9[_0xfb1f('0x58')]);_0x285be9[_0xfb1f('0x53')]=intUtil['stripTrailingSlash'](_0x285be9[_0xfb1f('0x53')]);if(_0x307bcb&&_0x307bcb[_0xfb1f('0x6c')]&&_0x307bcb[_0xfb1f('0x6c')]!=='none'){logger[_0xfb1f('0x1c')](_0xfb1f('0x6d'),'Recording\x20is\x20enabled!');_0x3083d3[_0xfb1f('0x5d')]=util[_0xfb1f('0x42')](_0xfb1f('0x5e'),_0x285be9['serverUrl'],_0x3083d3[_0xfb1f('0x5f')],md5(_0x3083d3[_0xfb1f('0x5f')]));}return getConnection(_0x285be9)['then'](function(_0x4870f0){_0x5dd3ed=_0x4870f0;return getUser(_0x285be9,_0x479db8['email'],_0x5dd3ed);})[_0xfb1f('0x23')](function(_0xeb6eac){_0x3b5719=_0xeb6eac;return getEndUser(_0x285be9,_0x3f052f,_0x3083d3[_0xfb1f('0x6e')],_0x3083d3['destcalleridnum'],_0x5dd3ed);})[_0xfb1f('0x23')](function(_0xff7b2b){_0x25ff05=_0xff7b2b;return getTicket(_0x285be9,_0x3b5719,_0x25ff05,_0x3f052f,_0x3083d3,_0x3f052f['Fields'],_0x5dd3ed,_0xfb1f('0x6f'));})[_0xfb1f('0x23')](function(_0x1b3138){_0x35f862=_0x1b3138;logger['info'](_0xfb1f('0x70'),_0x35f862['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x35f862['id'],_0x479db8[_0xfb1f('0x4e')],_0x285be9[_0xfb1f('0x47')]);switch(_0x285be9['type']){case'integrationTab':emit(util[_0xfb1f('0x42')](_0xfb1f('0x67'),_0x479db8['name']),'trigger:salesforce:display',{'recordId':_0x35f862['id']});break;case _0xfb1f('0x66'):emit(util[_0xfb1f('0x42')](_0xfb1f('0x67'),_0x479db8[_0xfb1f('0x4e')]),_0xfb1f('0x68'),{'uri':util['format'](_0xfb1f('0x69'),_0x5dd3ed[_0xfb1f('0x71')],_0x35f862['id'])});break;default:logger[_0xfb1f('0x6b')](_0xfb1f('0x6d'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x2217b6){logger[_0xfb1f('0x6b')](_0xfb1f('0x6d'),_0x2217b6);});};exports[_0xfb1f('0x72')]=function(_0x548e40,_0x3267d3,_0xf856d2,_0x48c92a,_0x1d0c76,_0x29dba7){var _0x59e14d,_0x317820,_0x4908b5,_0x972629;_0x29dba7[_0xfb1f('0x58')]=intUtil[_0xfb1f('0x59')](_0x29dba7['serverUrl']);_0x29dba7[_0xfb1f('0x53')]=intUtil[_0xfb1f('0x59')](_0x29dba7[_0xfb1f('0x53')]);if(_0x1d0c76&&_0x1d0c76[_0xfb1f('0x5a')]){logger[_0xfb1f('0x1c')]('['+_0x3267d3[_0xfb1f('0x73')][_0xfb1f('0x74')]()+']','Recording\x20is\x20enabled!');_0x3267d3[_0xfb1f('0x5d')]=util[_0xfb1f('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29dba7[_0xfb1f('0x58')],_0x3267d3[_0xfb1f('0x5f')],md5(_0x3267d3[_0xfb1f('0x5f')]));}else{_0x3267d3[_0xfb1f('0x5d')]='';}return getConnection(_0x29dba7)['then'](function(_0x4fab3f){_0x972629=_0x4fab3f;if(!_['isNil'](_0x48c92a)){return getUser(_0x29dba7,_0x48c92a['name'],_0x972629);}else{return getUser(_0x29dba7,null,_0x972629);}})[_0xfb1f('0x23')](function(_0x34eb89){_0x59e14d=_0x34eb89;return getEndUser(_0x29dba7,_0xf856d2,_0x3267d3['calleridname'],_0x3267d3['calleridnum'],_0x972629);})[_0xfb1f('0x23')](function(_0x1ea426){_0x317820=_0x1ea426;return getTicket(_0x29dba7,_0x59e14d,_0x317820,_0xf856d2,_0x3267d3,_0xf856d2[_0xfb1f('0x62')],_0x972629);})['then'](function(_0x58d3dd){_0x4908b5=_0x58d3dd;logger[_0xfb1f('0x1c')]('['+_0x3267d3[_0xfb1f('0x73')][_0xfb1f('0x74')]()+_0xfb1f('0x75'),_0x4908b5['id']);logger[_0xfb1f('0x1c')]('['+_0x3267d3[_0xfb1f('0x73')][_0xfb1f('0x74')]()+_0xfb1f('0x76'),_0x29dba7[_0xfb1f('0x47')]);})[_0xfb1f('0x77')](function(_0x7c7b36){logger[_0xfb1f('0x6b')]('['+_0x3267d3[_0xfb1f('0x73')]['toUpperCase']()+']',_0x7c7b36);});}; \ 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 5c5eb12..5fa9241 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 _0x83d1=['uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','sys_id','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','customField','idField','variableName','customVariable','Variable','name','incident','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','email','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x52ba41,_0x142e16){var _0x51cbea=function(_0x1377d8){while(--_0x1377d8){_0x52ba41['push'](_0x52ba41['shift']());}};_0x51cbea(++_0x142e16);}(_0x83d1,0x1a4));var _0x183d=function(_0xcc17c2,_0x4deb44){_0xcc17c2=_0xcc17c2-0x0;var _0x452bae=_0x83d1[_0xcc17c2];return _0x452bae;};'use strict';var _=require(_0x183d('0x0'));var Promise=require('bluebird');var rp=require(_0x183d('0x1'));var util=require(_0x183d('0x2'));var md5=require(_0x183d('0x3'));var Redis=require('ioredis');var intUtil=require(_0x183d('0x4'));var config=require(_0x183d('0x5'));var logger=require(_0x183d('0x6'))(_0x183d('0x7'));config[_0x183d('0x8')]=_['defaults'](config[_0x183d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x183d('0x9'))(new Redis(config[_0x183d('0x8')]));function getAdminUser(_0x46ee53,_0x2d70ef,_0x439f1c,_0x3a4bf9,_0x36031e,_0x5f34a4){return new Promise(function(_0x1d3237,_0x515ce5){var _0x5b1885={'method':_0x183d('0xa'),'uri':_0x3a4bf9+_0x183d('0xb')+'&'+_0x36031e+'&'+_0x5f34a4,'auth':_0x2d70ef,'json':!![]};return rp(_0x5b1885)[_0x183d('0xc')](function(_0x2e6259){if(_0x2e6259[_0x183d('0xd')][_0x183d('0xe')]>0x0){_0x439f1c[_0x183d('0xf')]=_0x2e6259['result'][0x0]['sys_id'];}logger['info']('['+[_0x46ee53[_0x183d('0x10')]()]+_0x183d('0x11'),_0x439f1c);_0x1d3237(_0x439f1c);})[_0x183d('0x12')](function(_0x509a25){logger[_0x183d('0x13')]('['+[_0x46ee53[_0x183d('0x10')]()]+']',_0x509a25[_0x183d('0x14')]);_0x515ce5(_0x509a25[_0x183d('0x14')]);});});}function getUser(_0x325951,_0x35c127,_0xe4803d,_0x51a489,_0x17cb26){return function(_0x26b12f){logger[_0x183d('0x15')]('['+[_0x325951[_0x183d('0x10')]()]+_0x183d('0x16'),_0x26b12f);return new Promise(function(_0x3e88fc,_0x495d0b){if(intUtil[_0x183d('0x17')](_0x26b12f[_0x183d('0x18')])){var _0x6d94fd={'method':_0x183d('0xa'),'uri':_0xe4803d+_0x183d('0x19')+_0x26b12f[_0x183d('0x18')]+'&'+_0x51a489+'&'+_0x17cb26,'auth':_0x35c127,'json':!![]};logger['info']('['+[_0x325951['toUpperCase']()]+_0x183d('0x1a'),_0x6d94fd);return rp(_0x6d94fd)[_0x183d('0xc')](function(_0x270d7b){logger['info']('['+[_0x325951['toUpperCase']()]+'],\x20getUser\x20entity',_0x270d7b);if(_0x270d7b[_0x183d('0xd')][_0x183d('0xe')]>0x0&&String(_0x270d7b['result'][0x0][_0x183d('0x1b')])===_0x183d('0x1c')){_0x26b12f[_0x183d('0x1d')]=_0x270d7b[_0x183d('0xd')][0x0]['sys_id'];}else{_0x26b12f[_0x183d('0x1d')]=_0x26b12f[_0x183d('0xf')];_0x26b12f[_0x183d('0x18')]=_0x26b12f[_0x183d('0x1e')];}logger[_0x183d('0x15')]('['+[_0x325951['toUpperCase']()]+_0x183d('0x1f'),_0x26b12f);_0x3e88fc(_0x26b12f);})[_0x183d('0x12')](function(_0x172a69){logger[_0x183d('0x13')]('['+[_0x325951['toUpperCase']()]+']',_0x172a69[_0x183d('0x14')]);_0x495d0b(_0x172a69['message']);});}else{logger[_0x183d('0x15')]('['+[_0x325951[_0x183d('0x10')]()]+']\x20using\x20admin\x20profile');_0x26b12f[_0x183d('0x1d')]=_0x26b12f['adminId'];_0x26b12f[_0x183d('0x18')]=_0x26b12f['adminEmail'];_0x3e88fc(_0x26b12f);}});};}function createEndUser(_0x54b02e,_0x20d733,_0x1d1411,_0x3b49d1,_0x3628a2){logger[_0x183d('0x15')]('['+[_0x54b02e[_0x183d('0x10')]()]+_0x183d('0x20'),_0x1d1411);return new Promise(function(_0x1dc80a,_0x46b68d){var _0x54cd5e={'method':_0x183d('0x21'),'uri':_0x3b49d1+_0x183d('0x22')+_0x3628a2,'body':{'user_name':_0x1d1411[_0x183d('0x23')],'roles':_0x183d('0x24'),'first_name':_0x1d1411['endUserNumber'],'active':'true','date_format':_0x183d('0x25'),'phone':_0x1d1411['endUserNumber']},'auth':_0x20d733,'json':!![]};return rp(_0x54cd5e)[_0x183d('0xc')](function(_0x4764f1){logger['info']('['+[_0x54b02e[_0x183d('0x10')]()]+'],\x20EndUser\x20schema',_0x4764f1['result']);_0x1d1411[_0x183d('0x26')]=_0x4764f1['result'][_0x183d('0x27')];_0x1dc80a(_0x1d1411);})[_0x183d('0x12')](function(_0x4d93a7){logger[_0x183d('0x13')]('['+[_0x54b02e['toUpperCase']()]+']',_0x4d93a7['message']);_0x46b68d(_0x4d93a7['message']);});});}function getEndUser(_0x1ddfc9,_0x3d33df,_0x47e3e7,_0x29b02e,_0x267d56){return function(_0x2a6e4f){logger[_0x183d('0x15')]('['+[_0x1ddfc9[_0x183d('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x2a6e4f);return new Promise(function(_0x765213,_0x272dd4){var _0x55832d={'method':_0x183d('0xa'),'uri':_0x47e3e7+_0x183d('0x28')+_0x2a6e4f['endUserNumber']+'&'+_0x29b02e+'&'+_0x267d56,'auth':_0x3d33df,'json':!![]};return rp(_0x55832d)[_0x183d('0xc')](function(_0x1f38ab){if(_0x1f38ab[_0x183d('0xd')][_0x183d('0xe')]>0x0){_0x2a6e4f['endUserId']=_0x1f38ab[_0x183d('0xd')][0x0][_0x183d('0x27')];logger[_0x183d('0x15')]('['+[_0x1ddfc9[_0x183d('0x10')]()]+'],\x20getEndUser\x20crm',_0x2a6e4f);_0x765213(_0x2a6e4f);}else{return createEndUser(_0x1ddfc9,_0x3d33df,_0x2a6e4f,_0x47e3e7,_0x29b02e)[_0x183d('0xc')](function(_0x2be78e){logger[_0x183d('0x15')]('['+[_0x1ddfc9[_0x183d('0x10')]()]+_0x183d('0x29'),_0x2be78e);_0x765213(_0x2be78e);});}})[_0x183d('0x12')](function(_0x381829){logger[_0x183d('0x13')]('['+[_0x1ddfc9[_0x183d('0x10')]()]+']',_0x381829[_0x183d('0x14')]);_0x272dd4(_0x381829[_0x183d('0x14')]);});});};}function getCustomFields(_0x17981f,_0x2189a7){var _0x2e1f77={};if(_0x17981f[_0x183d('0xe')]>0x0){_[_0x183d('0x2a')](_0x17981f,function(_0x1f77a5){if(_[_0x183d('0x2b')]([_0x183d('0x2c'),_0x183d('0x2d')],_0x1f77a5[_0x183d('0x2e')])&&_0x1f77a5['nameField']&&!_0x1f77a5['customField']){_0x2e1f77[_0x1f77a5[_0x183d('0x2f')][_0x183d('0x30')]()]=_0x1f77a5[_0x183d('0x31')][_0x183d('0x32')]();}else if(_['includes']([_0x183d('0x2c'),_0x183d('0x2d')],_0x1f77a5[_0x183d('0x2e')])&&_0x1f77a5['idField']&&_0x1f77a5[_0x183d('0x33')]){_0x2e1f77[_0x1f77a5[_0x183d('0x34')][_0x183d('0x30')]()]=_0x1f77a5[_0x183d('0x31')]['toString']();}else if(_0x1f77a5[_0x183d('0x2e')]==='variable'&&_0x1f77a5[_0x183d('0x35')]&&_0x1f77a5['idField']&&_0x1f77a5[_0x183d('0x33')]){_0x2e1f77[_0x1f77a5[_0x183d('0x34')]['toLowerCase']()]=_0x2189a7[_0x1f77a5['variableName']][_0x183d('0x32')]();}else if(_0x1f77a5[_0x183d('0x2e')]===_0x183d('0x36')&&_0x1f77a5[_0x183d('0x37')]&&_0x1f77a5['Variable'][_0x183d('0x38')]&&_0x1f77a5[_0x183d('0x34')]&&_0x1f77a5['customField']){_0x2e1f77[_0x1f77a5[_0x183d('0x34')][_0x183d('0x30')]()]=_0x2189a7[_0x1f77a5[_0x183d('0x37')][_0x183d('0x38')]['toLowerCase']()][_0x183d('0x32')]();}});}return _0x2e1f77;}function getTicket(_0x433413,_0x44565b,_0x2ae96a,_0x29de99,_0x1c1df9,_0x60812f){return function(_0x34507e){logger[_0x183d('0x15')]('['+[_0x433413[_0x183d('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x34507e);return new Promise(function(_0x4bc239,_0xb86703){var _0x138831=_0x433413['toLowerCase']()==='outbound'?_0x34507e[_0x183d('0x1d')]:_0x34507e[_0x183d('0x26')];var _0x1f417a={'method':'POST','uri':_0x2ae96a+_0x183d('0x39')+'?'+_0x60812f,'body':Object['assign']({},{'active':_0x183d('0x1c'),'caller_id':_0x138831,'assigned_to':_0x34507e['userId'],'short_description':intUtil[_0x183d('0x3a')](_0x29de99[_0x183d('0x3b')],_0x1c1df9,'\x20'),'description':intUtil['getString'](_0x29de99[_0x183d('0x3c')],_0x1c1df9,'\x0a')},getCustomFields(_0x29de99['Fields'],_0x1c1df9)),'auth':_0x44565b,'json':!![]};return rp(_0x1f417a)[_0x183d('0xc')](function(_0x12e599){logger['info']('['+[_0x433413[_0x183d('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x12e599[_0x183d('0xd')]);_0x34507e[_0x183d('0x3d')]=_0x12e599['result'][_0x183d('0x27')];_0x34507e[_0x183d('0x3e')]=_0x12e599['result']['number'];logger[_0x183d('0x15')]('['+[_0x433413['toUpperCase']()]+_0x183d('0x3f'),_0x34507e);_0x4bc239(_0x34507e);})[_0x183d('0x12')](function(_0xad2f82){logger['error']('['+[_0x433413[_0x183d('0x10')]()]+']',_0xad2f82[_0x183d('0x14')]);_0xb86703(_0xad2f82[_0x183d('0x14')]);});});};}function createRemoteTag(_0x25b31e,_0x2c792f,_0xc9e22a,_0x17ff4c){return new Promise(function(_0x19fb76,_0xc51b03){var _0x52ec8a={'method':_0x183d('0x21'),'uri':_0xc9e22a+_0x183d('0x40')+'?'+_0x17ff4c,'body':{'short_description':_0x25b31e,'global':!![],'active':!![],'name':_0x25b31e},'auth':_0x2c792f,'json':!![]};return rp(_0x52ec8a)[_0x183d('0xc')](function(_0x4cf80b){var _0x5bea6e=_0x4cf80b[_0x183d('0xd')][_0x183d('0x27')];_0x19fb76(_0x5bea6e);});});}function getRemoteTag(_0x3c09db,_0x1baeb4,_0x255529,_0x50e12c,_0x1a0d37){return new Promise(function(_0x2186af,_0x1af1ba){var _0x4c2966={'method':'GET','uri':_0x255529+_0x183d('0x40')+_0x183d('0x41')+_0x3c09db+'&'+_0x50e12c,'auth':_0x1baeb4,'json':!![]};return rp(_0x4c2966)[_0x183d('0xc')](function(_0x27cb2a){if(_0x27cb2a[_0x183d('0xd')]['length']>0x0){var _0x1d7669=_0x27cb2a['result'][0x0][_0x183d('0x27')];_0x2186af(_0x1d7669);}else{return createRemoteTag(_0x3c09db,_0x1baeb4,_0x255529,_0x50e12c)[_0x183d('0xc')](function(_0x1ed41e){_0x2186af(_0x1ed41e);});}});});}function assignTagToIncident(_0x193a0a,_0x443021,_0x3e5150,_0x4aa174,_0x10c0f4){return new Promise(function(_0x3b4924,_0x2a7412){var _0x55b82d={'method':_0x183d('0x21'),'uri':_0x3e5150+'label_entry'+'?'+_0x10c0f4,'body':{'label':_0x193a0a,'table':_0x183d('0x39'),'id_type':_0x183d('0x42'),'table_key':_0x4aa174['ticketId'],'title':'Incident\x20-\x20'+_0x4aa174[_0x183d('0x3e')],'id_display':_0x4aa174[_0x183d('0x3e')]},'auth':_0x443021,'json':!![]};return rp(_0x55b82d)[_0x183d('0xc')](function(_0x2728fe){_0x3b4924();})[_0x183d('0x12')](function(){_0x3b4924();});});}function manageTags(_0x2c3685,_0xdfd007,_0x384ab1,_0x46893c,_0x7aa654,_0x24128d,_0x492afc){return new Promise(function(_0x4d586f,_0x1506f5){var _0x430f54=[];_0xdfd007['forEach'](function(_0x5bde92){_0x430f54[_0x183d('0x43')](getRemoteTag(_0x5bde92,_0x384ab1,_0x46893c,_0x24128d,_0x492afc));});return Promise[_0x183d('0x44')](_0x430f54)[_0x183d('0xc')](function(_0xc52bfb){if(_0xc52bfb['length']){logger[_0x183d('0x15')]('['+[_0x2c3685[_0x183d('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xc52bfb);var _0x4d0dfb=[];_0xc52bfb[_0x183d('0x2a')](function(_0x2857eb){_0x4d0dfb[_0x183d('0x43')](assignTagToIncident(_0x2857eb,_0x384ab1,_0x46893c,_0x7aa654,_0x24128d));});return Promise[_0x183d('0x44')](_0x4d0dfb)[_0x183d('0xc')](function(){_0x4d586f();})[_0x183d('0x12')](function(){_0x4d586f();});}else{_0x4d586f();}});});}function getTags(_0x12967f,_0xdd5bd8,_0x31aa80,_0x4c10b8,_0x1cad2f,_0x1ba13c){return function(_0x403eec){return new Promise(function(_0x349709,_0x1d8a8c){var _0x250d47=[];var _0x13834f=_0x4c10b8[_0x183d('0x45')];if(_0x13834f&&_0x13834f[_0x183d('0xe')]>0x0){_0x250d47=_[_0x183d('0x46')](_0x13834f,'name');}if(_0x250d47['length']>0x0){return manageTags(_0x12967f,_0x250d47,_0xdd5bd8,_0x31aa80,_0x403eec,_0x1cad2f,_0x1ba13c)['then'](function(){_0x349709(_0x403eec);});}else{_0x349709(_0x403eec);}});};}function emit(_0x56a719,_0xe2da3,_0x182a5a){var _0x42a340=_0x183d('0x47')+_0x183d('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x183d('0x49');var _0x128b62={'uri':_0x56a719+_0x183d('0x4a')+_0x182a5a+_0x42a340};io['to'](util[_0x183d('0x4b')](_0x183d('0x4c'),_0xe2da3))['emit']('trigger:browser:url',_0x128b62);}exports['cs']=function(_0x2a3dec,_0x17ba23,_0xd3501,_0x4f7717,_0x17098b,_0x381f4f,_0x20bbf0,_0x2b41c2){var _0x44c46a={};var _0x2b962b={'user':_0x381f4f['username'],'pass':_0x381f4f[_0x183d('0x4d')]};var _0x49db33=_0x183d('0x4e');var _0x11d650=_0x183d('0x4f');_0x381f4f['remoteUri']=intUtil['stripTrailingSlash'](_0x381f4f[_0x183d('0x50')]);_0x381f4f[_0x183d('0x51')]=intUtil['stripTrailingSlash'](_0x381f4f[_0x183d('0x51')]);var _0xd9c2f0=util['format'](_0x183d('0x52'),_0x381f4f[_0x183d('0x50')]);_0x44c46a[_0x183d('0x18')]=!_['isNil'](_0x4f7717)?_0x4f7717['email']:null;_0x44c46a['adminEmail']=_0x381f4f[_0x183d('0x53')];_0x44c46a['endUserNumber']=_0x2b41c2[_0x183d('0x30')]()===_0x183d('0x54')?_0x17ba23[_0x183d('0x55')]:_0x17ba23[_0x183d('0x56')];_0x44c46a[_0x183d('0x57')]=_0x2b41c2===_0x183d('0x58')||_0x2b41c2==='unmanaged'?_0x183d('0x58'):_0x183d('0x54');var _0x360903=util[_0x183d('0x4b')](_0x183d('0x59'),_0x381f4f['serverUrl'],_0x17ba23[_0x183d('0x5a')],md5(_0x17ba23[_0x183d('0x5a')]));if(_0x17098b&&_0x17098b[_0x183d('0x5b')]){logger[_0x183d('0x15')](_0x183d('0x5c'),_0x183d('0x5d'));_0x17ba23[_0x183d('0x5e')]=_0x360903;}else if(_0x20bbf0&&_0x20bbf0[_0x183d('0x5f')]&&_0x20bbf0[_0x183d('0x5f')]!==_0x183d('0x60')){logger['info'](_0x183d('0x61'),_0x183d('0x5d'));_0x17ba23[_0x183d('0x5e')]=_0x360903;}else{_0x17ba23[_0x183d('0x5e')]='';}return getAdminUser(_0x2b41c2,_0x2b962b,_0x44c46a,_0xd9c2f0,_0x11d650,_0x49db33)[_0x183d('0xc')](getUser(_0x2b41c2,_0x2b962b,_0xd9c2f0,_0x11d650,_0x49db33))[_0x183d('0xc')](getEndUser(_0x2b41c2,_0x2b962b,_0xd9c2f0,_0x11d650,_0x49db33))[_0x183d('0xc')](getTicket(_0x2b41c2,_0x2b962b,_0xd9c2f0,_0xd3501,_0x17ba23,_0x11d650))['then'](function(_0x4df8ee){logger[_0x183d('0x15')](util[_0x183d('0x4b')](_0x183d('0x62'),_0x4df8ee[_0x183d('0x3d')]));logger['info'](util['format'](_0x183d('0x63'),_0x2b41c2));if(_0x2b41c2!=='unmanaged'){logger[_0x183d('0x15')]('['+[_0x2b41c2[_0x183d('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x381f4f[_0x183d('0x50')],_0x4f7717['name'],_0x4df8ee['ticketId']);}})[_0x183d('0x12')](function(_0x358dde){logger[_0x183d('0x13')]('['+[_0x2b41c2[_0x183d('0x10')]()]+_0x183d('0x64'),util[_0x183d('0x65')](_0x358dde,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa38c=['monitor_format','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','./util','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','adminEmail','catch','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','toString','variable','variableName','Variable','name','outbound','userId','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xa38c,0xd8));var _0xca38=function(_0x48d7aa,_0x52349c){_0x48d7aa=_0x48d7aa-0x0;var _0x138fc6=_0xa38c[_0x48d7aa];return _0x138fc6;};'use strict';var _=require(_0xca38('0x0'));var Promise=require(_0xca38('0x1'));var rp=require(_0xca38('0x2'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0xca38('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0xca38('0x4')]=_[_0xca38('0x5')](config[_0xca38('0x4')],{'host':_0xca38('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x4bfadf,_0x377efc,_0x2f44af,_0x1b51db,_0x1b23fc,_0x4948f7){return new Promise(function(_0x49ae41,_0x5a7e7b){var _0xbea0f2={'method':_0xca38('0x7'),'uri':_0x1b51db+_0xca38('0x8')+'&'+_0x1b23fc+'&'+_0x4948f7,'auth':_0x377efc,'json':!![]};return rp(_0xbea0f2)[_0xca38('0x9')](function(_0x390abe){if(_0x390abe[_0xca38('0xa')]['length']>0x0){_0x2f44af[_0xca38('0xb')]=_0x390abe[_0xca38('0xa')][0x0]['sys_id'];}logger[_0xca38('0xc')]('['+[_0x4bfadf[_0xca38('0xd')]()]+'],\x20getAdminUser\x20crm',_0x2f44af);_0x49ae41(_0x2f44af);})['catch'](function(_0x5c3fb5){logger['error']('['+[_0x4bfadf['toUpperCase']()]+']',_0x5c3fb5['message']);_0x5a7e7b(_0x5c3fb5['message']);});});}function getUser(_0x49d487,_0x5d807a,_0x38a7f6,_0x1e34e0,_0x5cec68){return function(_0x289e85){logger[_0xca38('0xc')]('['+[_0x49d487['toUpperCase']()]+_0xca38('0xe'),_0x289e85);return new Promise(function(_0x2315ad,_0x2267f1){if(intUtil[_0xca38('0xf')](_0x289e85['userEmail'])){var _0x122548={'method':_0xca38('0x7'),'uri':_0x38a7f6+_0xca38('0x10')+_0x289e85[_0xca38('0x11')]+'&'+_0x1e34e0+'&'+_0x5cec68,'auth':_0x5d807a,'json':!![]};logger[_0xca38('0xc')]('['+[_0x49d487[_0xca38('0xd')]()]+_0xca38('0x12'),_0x122548);return rp(_0x122548)[_0xca38('0x9')](function(_0x143bb2){logger[_0xca38('0xc')]('['+[_0x49d487['toUpperCase']()]+_0xca38('0x13'),_0x143bb2);if(_0x143bb2[_0xca38('0xa')]['length']>0x0&&String(_0x143bb2[_0xca38('0xa')][0x0]['active'])===_0xca38('0x14')){_0x289e85['userId']=_0x143bb2['result'][0x0]['sys_id'];}else{_0x289e85['userId']=_0x289e85[_0xca38('0xb')];_0x289e85['userEmail']=_0x289e85[_0xca38('0x15')];}logger[_0xca38('0xc')]('['+[_0x49d487[_0xca38('0xd')]()]+'],\x20getUser\x20crm',_0x289e85);_0x2315ad(_0x289e85);})[_0xca38('0x16')](function(_0x371878){logger['error']('['+[_0x49d487[_0xca38('0xd')]()]+']',_0x371878['message']);_0x2267f1(_0x371878[_0xca38('0x17')]);});}else{logger[_0xca38('0xc')]('['+[_0x49d487[_0xca38('0xd')]()]+_0xca38('0x18'));_0x289e85['userId']=_0x289e85[_0xca38('0xb')];_0x289e85[_0xca38('0x11')]=_0x289e85[_0xca38('0x15')];_0x2315ad(_0x289e85);}});};}function createEndUser(_0x22db42,_0x2764bb,_0x890127,_0x3cdd39,_0x4c867b){logger['info']('['+[_0x22db42[_0xca38('0xd')]()]+_0xca38('0x19'),_0x890127);return new Promise(function(_0x4a976f,_0x227e6a){var _0x5b3bf3={'method':_0xca38('0x1a'),'uri':_0x3cdd39+_0xca38('0x1b')+_0x4c867b,'body':{'user_name':_0x890127['endUserNumber'],'roles':_0xca38('0x1c'),'first_name':_0x890127['endUserNumber'],'active':_0xca38('0x14'),'date_format':_0xca38('0x1d'),'phone':_0x890127[_0xca38('0x1e')]},'auth':_0x2764bb,'json':!![]};return rp(_0x5b3bf3)[_0xca38('0x9')](function(_0x3afa24){logger['info']('['+[_0x22db42[_0xca38('0xd')]()]+_0xca38('0x1f'),_0x3afa24[_0xca38('0xa')]);_0x890127[_0xca38('0x20')]=_0x3afa24[_0xca38('0xa')]['sys_id'];_0x4a976f(_0x890127);})[_0xca38('0x16')](function(_0x3207c8){logger[_0xca38('0x21')]('['+[_0x22db42['toUpperCase']()]+']',_0x3207c8[_0xca38('0x17')]);_0x227e6a(_0x3207c8[_0xca38('0x17')]);});});}function getEndUser(_0x462c8a,_0x11db56,_0x541448,_0x5c8f98,_0x25ac93){return function(_0x215e60){logger[_0xca38('0xc')]('['+[_0x462c8a['toUpperCase']()]+_0xca38('0x22'),_0x215e60);return new Promise(function(_0x2b3376,_0x589f9a){var _0x4c4388={'method':'GET','uri':_0x541448+_0xca38('0x23')+_0x215e60['endUserNumber']+'&'+_0x5c8f98+'&'+_0x25ac93,'auth':_0x11db56,'json':!![]};return rp(_0x4c4388)[_0xca38('0x9')](function(_0x29162d){if(_0x29162d[_0xca38('0xa')][_0xca38('0x24')]>0x0){_0x215e60[_0xca38('0x20')]=_0x29162d['result'][0x0][_0xca38('0x25')];logger[_0xca38('0xc')]('['+[_0x462c8a[_0xca38('0xd')]()]+_0xca38('0x26'),_0x215e60);_0x2b3376(_0x215e60);}else{return createEndUser(_0x462c8a,_0x11db56,_0x215e60,_0x541448,_0x5c8f98)[_0xca38('0x9')](function(_0x2c246e){logger[_0xca38('0xc')]('['+[_0x462c8a[_0xca38('0xd')]()]+_0xca38('0x27'),_0x2c246e);_0x2b3376(_0x2c246e);});}})[_0xca38('0x16')](function(_0x4a90c5){logger['error']('['+[_0x462c8a['toUpperCase']()]+']',_0x4a90c5[_0xca38('0x17')]);_0x589f9a(_0x4a90c5[_0xca38('0x17')]);});});};}function getCustomFields(_0x3a51d2,_0x9bc1a8){var _0x346999={};if(_0x3a51d2[_0xca38('0x24')]>0x0){_[_0xca38('0x28')](_0x3a51d2,function(_0x23244e){if(_[_0xca38('0x29')](['string',_0xca38('0x2a')],_0x23244e[_0xca38('0x2b')])&&_0x23244e[_0xca38('0x2c')]&&!_0x23244e[_0xca38('0x2d')]){_0x346999[_0x23244e['nameField'][_0xca38('0x2e')]()]=_0x23244e[_0xca38('0x2f')]['toString']();}else if(_[_0xca38('0x29')]([_0xca38('0x30'),_0xca38('0x2a')],_0x23244e[_0xca38('0x2b')])&&_0x23244e[_0xca38('0x31')]&&_0x23244e[_0xca38('0x2d')]){_0x346999[_0x23244e[_0xca38('0x31')][_0xca38('0x2e')]()]=_0x23244e[_0xca38('0x2f')][_0xca38('0x32')]();}else if(_0x23244e['type']===_0xca38('0x33')&&_0x23244e[_0xca38('0x34')]&&_0x23244e['idField']&&_0x23244e[_0xca38('0x2d')]){_0x346999[_0x23244e[_0xca38('0x31')][_0xca38('0x2e')]()]=_0x9bc1a8[_0x23244e[_0xca38('0x34')]]['toString']();}else if(_0x23244e[_0xca38('0x2b')]==='customVariable'&&_0x23244e[_0xca38('0x35')]&&_0x23244e[_0xca38('0x35')][_0xca38('0x36')]&&_0x23244e[_0xca38('0x31')]&&_0x23244e[_0xca38('0x2d')]){_0x346999[_0x23244e[_0xca38('0x31')][_0xca38('0x2e')]()]=_0x9bc1a8[_0x23244e[_0xca38('0x35')][_0xca38('0x36')][_0xca38('0x2e')]()][_0xca38('0x32')]();}});}return _0x346999;}function getTicket(_0x53a943,_0x4b791d,_0x47446b,_0x4d0a3f,_0x11566f,_0xcc5dcd){return function(_0x273c5b){logger[_0xca38('0xc')]('['+[_0x53a943[_0xca38('0xd')]()]+']\x20getTicket\x20input\x20crm',_0x273c5b);return new Promise(function(_0x139cdb,_0x1c8b2d){var _0x357c40=_0x53a943[_0xca38('0x2e')]()===_0xca38('0x37')?_0x273c5b[_0xca38('0x38')]:_0x273c5b[_0xca38('0x20')];var _0x35f96b={'method':_0xca38('0x1a'),'uri':_0x47446b+_0xca38('0x39')+'?'+_0xcc5dcd,'body':Object['assign']({},{'active':_0xca38('0x14'),'caller_id':_0x357c40,'assigned_to':_0x273c5b[_0xca38('0x38')],'short_description':intUtil[_0xca38('0x3a')](_0x4d0a3f[_0xca38('0x3b')],_0x11566f,'\x20'),'description':intUtil[_0xca38('0x3a')](_0x4d0a3f[_0xca38('0x3c')],_0x11566f,'\x0a')},getCustomFields(_0x4d0a3f[_0xca38('0x3d')],_0x11566f)),'auth':_0x4b791d,'json':!![]};return rp(_0x35f96b)[_0xca38('0x9')](function(_0x199b74){logger[_0xca38('0xc')]('['+[_0x53a943['toUpperCase']()]+_0xca38('0x3e'),_0x199b74[_0xca38('0xa')]);_0x273c5b[_0xca38('0x3f')]=_0x199b74[_0xca38('0xa')][_0xca38('0x25')];_0x273c5b['ticketNumber']=_0x199b74[_0xca38('0xa')][_0xca38('0x40')];logger[_0xca38('0xc')]('['+[_0x53a943[_0xca38('0xd')]()]+_0xca38('0x41'),_0x273c5b);_0x139cdb(_0x273c5b);})[_0xca38('0x16')](function(_0x532577){logger[_0xca38('0x21')]('['+[_0x53a943[_0xca38('0xd')]()]+']',_0x532577['message']);_0x1c8b2d(_0x532577[_0xca38('0x17')]);});});};}function createRemoteTag(_0x5071f1,_0x444184,_0x19f5be,_0x37eaa0){return new Promise(function(_0x398486,_0x205841){var _0x2be745={'method':_0xca38('0x1a'),'uri':_0x19f5be+_0xca38('0x42')+'?'+_0x37eaa0,'body':{'short_description':_0x5071f1,'global':!![],'active':!![],'name':_0x5071f1},'auth':_0x444184,'json':!![]};return rp(_0x2be745)[_0xca38('0x9')](function(_0x53b96f){var _0x32b774=_0x53b96f[_0xca38('0xa')]['sys_id'];_0x398486(_0x32b774);});});}function getRemoteTag(_0x2aa6e7,_0x54e089,_0xe18146,_0x28a3e2,_0x3e21e6){return new Promise(function(_0x2c4864,_0x1ae68f){var _0x3e2172={'method':_0xca38('0x7'),'uri':_0xe18146+_0xca38('0x42')+_0xca38('0x43')+_0x2aa6e7+'&'+_0x28a3e2,'auth':_0x54e089,'json':!![]};return rp(_0x3e2172)['then'](function(_0x3a4c67){if(_0x3a4c67[_0xca38('0xa')][_0xca38('0x24')]>0x0){var _0x1735dd=_0x3a4c67[_0xca38('0xa')][0x0][_0xca38('0x25')];_0x2c4864(_0x1735dd);}else{return createRemoteTag(_0x2aa6e7,_0x54e089,_0xe18146,_0x28a3e2)[_0xca38('0x9')](function(_0x5db4c9){_0x2c4864(_0x5db4c9);});}});});}function assignTagToIncident(_0x51e60d,_0x543e17,_0x168616,_0x42017b,_0x7d6af3){return new Promise(function(_0x3550e8,_0x4b5047){var _0x2016ed={'method':_0xca38('0x1a'),'uri':_0x168616+_0xca38('0x44')+'?'+_0x7d6af3,'body':{'label':_0x51e60d,'table':_0xca38('0x39'),'id_type':_0xca38('0x45'),'table_key':_0x42017b[_0xca38('0x3f')],'title':_0xca38('0x46')+_0x42017b[_0xca38('0x47')],'id_display':_0x42017b[_0xca38('0x47')]},'auth':_0x543e17,'json':!![]};return rp(_0x2016ed)[_0xca38('0x9')](function(_0x3b94a6){_0x3550e8();})[_0xca38('0x16')](function(){_0x3550e8();});});}function manageTags(_0x588f99,_0x4ee08f,_0x268852,_0x1d940b,_0x3d5e1e,_0x152118,_0xbdb0e4){return new Promise(function(_0x311ceb,_0x22bef3){var _0x5f1cd9=[];_0x4ee08f[_0xca38('0x28')](function(_0x73160f){_0x5f1cd9[_0xca38('0x48')](getRemoteTag(_0x73160f,_0x268852,_0x1d940b,_0x152118,_0xbdb0e4));});return Promise['all'](_0x5f1cd9)[_0xca38('0x9')](function(_0x1f8b65){if(_0x1f8b65[_0xca38('0x24')]){logger['info']('['+[_0x588f99[_0xca38('0xd')]()]+_0xca38('0x49'),_0x1f8b65);var _0x3b1399=[];_0x1f8b65['forEach'](function(_0x2c2641){_0x3b1399[_0xca38('0x48')](assignTagToIncident(_0x2c2641,_0x268852,_0x1d940b,_0x3d5e1e,_0x152118));});return Promise['all'](_0x3b1399)[_0xca38('0x9')](function(){_0x311ceb();})[_0xca38('0x16')](function(){_0x311ceb();});}else{_0x311ceb();}});});}function getTags(_0x3e71dc,_0x4cfcd9,_0xc95d0b,_0x15225a,_0x4eedf1,_0x37ae83){return function(_0x1ee6ad){return new Promise(function(_0x2a53fa,_0x184812){var _0x3aa968=[];var _0x318e29=_0x15225a[_0xca38('0x4a')];if(_0x318e29&&_0x318e29[_0xca38('0x24')]>0x0){_0x3aa968=_['map'](_0x318e29,_0xca38('0x36'));}if(_0x3aa968[_0xca38('0x24')]>0x0){return manageTags(_0x3e71dc,_0x3aa968,_0x4cfcd9,_0xc95d0b,_0x1ee6ad,_0x4eedf1,_0x37ae83)[_0xca38('0x9')](function(){_0x2a53fa(_0x1ee6ad);});}else{_0x2a53fa(_0x1ee6ad);}});};}function emit(_0x299c07,_0x4a2242,_0x417431){var _0x3980bc=_0xca38('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xca38('0x4c');var _0x3b8fdf={'uri':_0x299c07+_0xca38('0x4d')+_0x417431+_0x3980bc};io['to'](util['format'](_0xca38('0x4e'),_0x4a2242))[_0xca38('0x4f')](_0xca38('0x50'),_0x3b8fdf);}exports['cs']=function(_0x211add,_0x2b11a8,_0x4dbd72,_0xe09948,_0xa02a56,_0x2377bc,_0x2b6588,_0x29bccf){var _0x17a67b={};var _0x38cfe1={'user':_0x2377bc[_0xca38('0x51')],'pass':_0x2377bc[_0xca38('0x52')]};var _0x1e939f=_0xca38('0x53');var _0x130998='sysparm_display_value=true';_0x2377bc[_0xca38('0x54')]=intUtil['stripTrailingSlash'](_0x2377bc[_0xca38('0x54')]);_0x2377bc[_0xca38('0x55')]=intUtil[_0xca38('0x56')](_0x2377bc[_0xca38('0x55')]);var _0x1786e0=util[_0xca38('0x57')](_0xca38('0x58'),_0x2377bc[_0xca38('0x54')]);_0x17a67b[_0xca38('0x11')]=!_[_0xca38('0x59')](_0xe09948)?_0xe09948[_0xca38('0x5a')]:null;_0x17a67b[_0xca38('0x15')]=_0x2377bc[_0xca38('0x5a')];_0x17a67b['endUserNumber']=_0x29bccf[_0xca38('0x2e')]()===_0xca38('0x37')?_0x2b11a8[_0xca38('0x5b')]:_0x2b11a8[_0xca38('0x5c')];_0x17a67b['callDirection']=_0x29bccf===_0xca38('0x5d')||_0x29bccf===_0xca38('0x5e')?_0xca38('0x5d'):_0xca38('0x37');var _0xe49983=util[_0xca38('0x57')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2377bc['serverUrl'],_0x2b11a8[_0xca38('0x5f')],md5(_0x2b11a8[_0xca38('0x5f')]));if(_0xa02a56&&_0xa02a56[_0xca38('0x60')]){logger[_0xca38('0xc')]('[QUEUE]',_0xca38('0x61'));_0x2b11a8[_0xca38('0x62')]=_0xe49983;}else if(_0x2b6588&&_0x2b6588['recordingFormat']&&_0x2b6588['recordingFormat']!=='none'){logger[_0xca38('0xc')](_0xca38('0x63'),_0xca38('0x61'));_0x2b11a8[_0xca38('0x62')]=_0xe49983;}else{_0x2b11a8[_0xca38('0x62')]='';}return getAdminUser(_0x29bccf,_0x38cfe1,_0x17a67b,_0x1786e0,_0x130998,_0x1e939f)['then'](getUser(_0x29bccf,_0x38cfe1,_0x1786e0,_0x130998,_0x1e939f))[_0xca38('0x9')](getEndUser(_0x29bccf,_0x38cfe1,_0x1786e0,_0x130998,_0x1e939f))[_0xca38('0x9')](getTicket(_0x29bccf,_0x38cfe1,_0x1786e0,_0x4dbd72,_0x2b11a8,_0x130998))['then'](function(_0x40b89c){logger[_0xca38('0xc')](util['format'](_0xca38('0x64'),_0x40b89c[_0xca38('0x3f')]));logger[_0xca38('0xc')](util[_0xca38('0x57')](_0xca38('0x65'),_0x29bccf));if(_0x29bccf!==_0xca38('0x5e')){logger[_0xca38('0xc')]('['+[_0x29bccf['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2377bc[_0xca38('0x54')],_0xe09948[_0xca38('0x36')],_0x40b89c[_0xca38('0x3f')]);}})['catch'](function(_0xa4036d){logger[_0xca38('0x21')]('['+[_0x29bccf[_0xca38('0xd')]()]+_0xca38('0x66'),util[_0xca38('0x67')](_0xa4036d,{'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 9e4ae75..9b7beda 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 _0x8576=['toUpperCase','isNil','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','push','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','idField','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','then','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','serverUrl','%s/service/v4_1/rest.php','recordingFormat','destcalleridnum','[OUTBOUND]','catch','unmanaged'];(function(_0xbdcdd7,_0x25f55e){var _0x2bbb91=function(_0x590fe8){while(--_0x590fe8){_0xbdcdd7['push'](_0xbdcdd7['shift']());}};_0x2bbb91(++_0x25f55e);}(_0x8576,0x78));var _0x6857=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x8576[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x6857('0x0'));var rp=require('request-promise');var BPromise=require(_0x6857('0x1'));var md5=require(_0x6857('0x2'));var util=require(_0x6857('0x3'));var Redis=require(_0x6857('0x4'));var intUtil=require(_0x6857('0x5'));var config=require(_0x6857('0x6'));var logger=require(_0x6857('0x7'))(_0x6857('0x8'));config[_0x6857('0x9')]=_['defaults'](config[_0x6857('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x6857('0xa'))(new Redis(config['redis']));var def={'method':_0x6857('0xb'),'json':!![]};function emit(_0x102d30,_0x20bc86,_0x3ca654){io['to'](_0x102d30)[_0x6857('0xc')](_0x20bc86,_0x3ca654);}function getTicket(_0x12d68c,_0x39301d,_0x1be921,_0x38b6a3,_0x4ae4e4,_0x387b57,_0x28ff97,_0x8caa97){logger['info'](_0x6857('0xd'));var _0x2187fc=new Date();var _0x306db9=[{'name':_0x6857('0xe'),'value':intUtil[_0x6857('0xf')](_0x38b6a3[_0x6857('0x10')],_0x4ae4e4,'\x20')},{'name':'assigned_user_id','value':_0x39301d['id']},{'name':'created_by','value':_0x39301d['id']},{'name':_0x6857('0x11'),'value':intUtil[_0x6857('0xf')](_0x38b6a3[_0x6857('0x12')],_0x4ae4e4,'\x0a')},{'name':_0x6857('0x13'),'value':_0x2187fc[_0x6857('0x14')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x6857('0x15'),'value':'0'},{'name':_0x6857('0x16'),'value':'15'},{'name':_0x6857('0x17'),'value':_0x1be921['id']},{'name':_0x6857('0x18'),'value':_0x6857('0x19')},{'name':_0x6857('0x1a'),'value':_0x1be921['name']},{'name':'direction','value':_0x8caa97}];if(_0x387b57[_0x6857('0x1b')]){_[_0x6857('0x1c')](_0x387b57,function(_0x1bd129){if(_0x4ae4e4[_0x1bd129['variableName']]){_0x306db9[_0x6857('0x1d')]({'name':_0x1bd129['idField'],'value':_0x4ae4e4[_0x1bd129[_0x6857('0x1e')]]});}});}return request({'form':{'method':_0x6857('0x1f'),'input_type':_0x6857('0x20'),'response_type':_0x6857('0x20'),'rest_data':JSON[_0x6857('0x21')]({'session':_0x28ff97['id'],'module_name':_0x6857('0x22'),'name_value_list':_0x306db9})}});}function getAuth(_0x3eba75){return util[_0x6857('0x23')](_0x6857('0x24'),new Buffer(_0x3eba75[_0x6857('0x25')]+':X')[_0x6857('0x26')](_0x6857('0x27')));}function getServerInfo(_0x478fe5){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x6857('0x20'),'rest_data':JSON[_0x6857('0x21')]({'session':_0x478fe5['id']})}});}function getUser(_0x27183b,_0x1e6c54,_0x5496f7){if(!_['isNil'](_0x1e6c54)){logger[_0x6857('0x28')]('Getting\x20agent\x20with\x20name',_0x1e6c54);return request({'form':{'method':'get_entry_list','input_type':_0x6857('0x20'),'response_type':_0x6857('0x20'),'rest_data':JSON['stringify']({'session':_0x5496f7['id'],'module_name':_0x6857('0x29'),'query':util[_0x6857('0x23')](_0x6857('0x2a'),_0x1e6c54),'order_by':'','offset':'0','select_fields':['id','name',_0x6857('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xd6906){if(_0xd6906['entry_list'][_0x6857('0x1b')]){var _0x384978=_[_0x6857('0x2c')](_0xd6906[_0x6857('0x2d')],function(_0x3937e9){return _0x3937e9[_0x6857('0x2e')][_0x6857('0x2b')]['value']===_0x1e6c54;});if(_0x384978){logger[_0x6857('0x28')](_0x6857('0x2f'));return BPromise['resolve']({'id':_0x384978[_0x6857('0x2e')]['id'][_0x6857('0x30')],'name':_0x384978[_0x6857('0x2e')][_0x6857('0xe')]['value']});}}logger[_0x6857('0x28')](_0x6857('0x31'));return BPromise[_0x6857('0x32')]({'id':_0x5496f7['name_value_list'][_0x6857('0x33')][_0x6857('0x30')],'name':_0x5496f7['name_value_list'][_0x6857('0x2b')]['value']});});}else{logger[_0x6857('0x28')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6857('0x32')]({'id':_0x5496f7[_0x6857('0x2e')]['user_id'][_0x6857('0x30')],'name':_0x5496f7['name_value_list'][_0x6857('0x2b')][_0x6857('0x30')]});}}function getEndUser(_0x467279,_0x4a77dd,_0x48d187,_0x49475e){logger['info'](_0x6857('0x34'),_0x48d187);return request({'form':{'method':_0x6857('0x35'),'input_type':_0x6857('0x20'),'response_type':_0x6857('0x20'),'rest_data':JSON[_0x6857('0x21')]({'session':_0x49475e['id'],'module_name':_0x6857('0x19'),'query':util['format'](_0x6857('0x36'),_0x48d187),'order_by':'','offset':'0','select_fields':['id',_0x6857('0xe'),_0x6857('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1a5cf1){if(_0x1a5cf1[_0x6857('0x2d')][_0x6857('0x1b')]){var _0xcfe195=_[_0x6857('0x2c')](_0x1a5cf1['entry_list'],function(_0x4e5ac6){return _0x4e5ac6['name_value_list'][_0x6857('0x37')]['value']===_0x48d187;});if(_0xcfe195){logger[_0x6857('0x28')]('Enduser\x20found!');return BPromise['resolve']({'id':_0xcfe195['name_value_list']['id'][_0x6857('0x30')],'name':_0xcfe195[_0x6857('0x2e')]['name'][_0x6857('0x30')],'phone':_0xcfe195[_0x6857('0x2e')][_0x6857('0x37')][_0x6857('0x30')]});}}else{logger[_0x6857('0x28')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x6857('0x1f'),'input_type':'JSON','response_type':_0x6857('0x20'),'rest_data':JSON[_0x6857('0x21')]({'session':_0x49475e['id'],'module_name':_0x6857('0x19'),'name_value_list':[{'name':_0x6857('0x38'),'value':_0x4a77dd!==_0x6857('0x39')?_0x4a77dd:util[_0x6857('0x23')](_0x6857('0x3a'),_0x48d187)},{'name':_0x6857('0x37'),'value':_0x48d187}]})}})['then'](function(_0x8eae28){logger[_0x6857('0x28')](_0x6857('0x3b'));return BPromise['resolve']({'id':_0x8eae28['id'],'name':_0x8eae28['entry_list'][_0x6857('0x38')][_0x6857('0x30')],'phone':_0x8eae28['entry_list'][_0x6857('0x37')][_0x6857('0x30')]});});}});}function request(_0x1d60a4){logger[_0x6857('0x3c')]('[HTTP]',JSON['stringify'](_0x1d60a4));return rp(_[_0x6857('0x3d')](def,_0x1d60a4));}function getTags(_0x4b2db4,_0x5ce402){var _0x1028af=[];if(_0x4b2db4&&_0x4b2db4['length']>0x0){_0x1028af=_['map'](_0x4b2db4,_0x5ce402);}return _0x1028af;}function getCustomFields(_0x1b458f,_0x4547fa){var _0x29db81=[];var _0x263b4c={'custom_fields':[]};if(_0x1b458f[_0x6857('0x1b')]>0x0){_[_0x6857('0x1c')](_0x1b458f,function(_0x2bea4b){if(_0x2bea4b[_0x6857('0x3e')]===_0x6857('0x3f')&&_0x2bea4b[_0x6857('0x40')]&&!_0x2bea4b[_0x6857('0x41')]){_0x263b4c[_0x2bea4b[_0x6857('0x40')][_0x6857('0x42')]()]=_0x2bea4b[_0x6857('0x43')][_0x6857('0x26')]();}else if(_0x2bea4b[_0x6857('0x3e')]===_0x6857('0x3f')&&_0x2bea4b['idField']&&_0x2bea4b[_0x6857('0x41')]){_0x263b4c[_0x6857('0x44')][_0x6857('0x1d')]({'id':_0x2bea4b['idField'],'value':_0x2bea4b['content'][_0x6857('0x26')]()});}else if(_0x2bea4b[_0x6857('0x3e')]===_0x6857('0x45')&&_0x2bea4b[_0x6857('0x1e')]&&_0x2bea4b[_0x6857('0x46')]&&_0x2bea4b[_0x6857('0x41')]){_0x4547fa[_0x2bea4b[_0x6857('0x1e')]]&&_0x263b4c['custom_fields'][_0x6857('0x1d')]({'id':_0x2bea4b[_0x6857('0x46')],'value':_0x4547fa[_0x2bea4b[_0x6857('0x1e')]][_0x6857('0x26')]()});}else if(_0x2bea4b['type']===_0x6857('0x47')&&_0x2bea4b[_0x6857('0x48')]&&_0x2bea4b[_0x6857('0x48')][_0x6857('0xe')]&&_0x2bea4b[_0x6857('0x46')]&&_0x2bea4b[_0x6857('0x41')]){_0x4547fa[_0x2bea4b[_0x6857('0x48')]['name'][_0x6857('0x42')]()]&&_0x263b4c[_0x6857('0x44')][_0x6857('0x1d')]({'id':_0x2bea4b[_0x6857('0x46')],'value':_0x4547fa[_0x2bea4b[_0x6857('0x48')]['name']['toLowerCase']()][_0x6857('0x26')]()});}});}return _0x263b4c;}function getConnection(_0x58d464){return request({'method':_0x6857('0xb'),'form':{'method':_0x6857('0x49'),'input_type':_0x6857('0x20'),'response_type':_0x6857('0x20'),'rest_data':JSON[_0x6857('0x21')]({'user_auth':{'user_name':_0x58d464[_0x6857('0x4a')],'password':_0x58d464[_0x6857('0x4b')],'encryption':_0x6857('0x4c')},'application':_0x6857('0x4d')})}})[_0x6857('0x4e')](function(_0x2bfb3b){var _0x564c1=_0x2bfb3b;if(_0x564c1['id']){def[_0x6857('0x4f')]=_0x564c1['id'];return BPromise[_0x6857('0x32')](_0x564c1);}else{throw new Error(util['format'](_0x6857('0x50'),_0x58d464['id']));}});}function setRelationship(_0x1c23dc,_0x1e0cb2,_0x7ee4e2,_0x23c032){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x6857('0x20'),'rest_data':JSON['stringify']({'session':_0x1c23dc['id'],'module_name':'Calls','module_id':_0x7ee4e2['id'],'link_field_name':_0x23c032,'related_ids':[_0x1e0cb2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6857('0x51')]=function(_0x4f628c,_0x416e90,_0x866bf7,_0x2a0bcd,_0x38b203,_0x1956b9){var _0x5c152f,_0x8f8857,_0x3e5b13,_0x1773e1;_0x1956b9[_0x6857('0x52')]=intUtil['stripTrailingSlash'](_0x1956b9[_0x6857('0x52')]);_0x1956b9['serverUrl']=intUtil[_0x6857('0x53')](_0x1956b9['serverUrl']);def[_0x6857('0x54')]=util['format']('%s/service/v4_1/rest.php',_0x1956b9['remoteUri']);if(_0x38b203&&_0x38b203[_0x6857('0x55')]){logger['info'](_0x6857('0x56'),_0x6857('0x57'));_0x416e90[_0x6857('0x58')]=util[_0x6857('0x23')](_0x6857('0x59'),_0x1956b9['serverUrl'],_0x416e90[_0x6857('0x5a')],md5(_0x416e90['uniqueid']));}else{_0x416e90['recordingURL']='';}return getConnection(_0x1956b9)[_0x6857('0x4e')](function(_0x48606a){_0x1773e1=_0x48606a;return getUser(_0x1956b9,_0x2a0bcd[_0x6857('0xe')],_0x1773e1);})[_0x6857('0x4e')](function(_0x266b03){_0x5c152f=_0x266b03;logger[_0x6857('0x28')](_0x6857('0x5b'),_0x5c152f['id']);return getEndUser(_0x1956b9,_0x416e90[_0x6857('0x5c')],_0x416e90[_0x6857('0x5d')],_0x1773e1);})[_0x6857('0x4e')](function(_0x381642){_0x8f8857=_0x381642;logger[_0x6857('0x28')](_0x6857('0x5e'),_0x8f8857['id']);return getTicket(_0x1956b9,_0x5c152f,_0x8f8857,_0x866bf7,_0x416e90,_0x866bf7[_0x6857('0x5f')],_0x1773e1,_0x6857('0x60'));})[_0x6857('0x4e')](function(_0x5cb2bf){_0x3e5b13=_0x5cb2bf;logger[_0x6857('0x28')](_0x6857('0x61'));logger[_0x6857('0x28')]('The\x20Ticket\x20ID\x20is:',_0x3e5b13['id']);return setRelationship(_0x1773e1,_0x5c152f,_0x3e5b13,_0x6857('0x62'));})[_0x6857('0x4e')](function(){return setRelationship(_0x1773e1,_0x8f8857,_0x3e5b13,_0x6857('0x63'));})[_0x6857('0x4e')](function(){return getServerInfo(_0x1773e1);})[_0x6857('0x4e')](function(_0x3cd7d1){var _0x5444cd=parseInt(_0x3cd7d1[_0x6857('0x64')][_0x6857('0x65')](0x0));var _0x184333=util[_0x6857('0x23')](_0x6857('0x66'),_0x1956b9[_0x6857('0x52')],_0x3e5b13['id']);if(_0x5444cd>0x6){_0x184333=util[_0x6857('0x23')](_0x6857('0x67'),_0x1956b9['remoteUri'],_0x3e5b13['id']);}logger['info']('[QUEUE]',_0x6857('0x68'));emit(util[_0x6857('0x23')](_0x6857('0x69'),_0x2a0bcd[_0x6857('0xe')]),_0x6857('0x6a'),{'uri':_0x184333});})['catch'](function(_0x2dc008){logger[_0x6857('0x6b')](_0x6857('0x56'),JSON[_0x6857('0x21')](_0x2dc008));});};exports[_0x6857('0x6c')]=function(_0x365e54,_0x1f2e72,_0x2b74b0,_0x4885b0,_0x4bcb3f,_0x5e3079,_0x2d9d96){var _0x2a9084,_0x432ecf,_0x196374,_0x4c5790;_0x5e3079[_0x6857('0x52')]=intUtil['stripTrailingSlash'](_0x5e3079['remoteUri']);_0x5e3079[_0x6857('0x6d')]=intUtil[_0x6857('0x53')](_0x5e3079[_0x6857('0x6d')]);def[_0x6857('0x54')]=util[_0x6857('0x23')](_0x6857('0x6e'),_0x5e3079[_0x6857('0x52')]);if(_0x2d9d96&&_0x2d9d96[_0x6857('0x6f')]&&_0x2d9d96[_0x6857('0x6f')]!=='none'){logger[_0x6857('0x28')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1f2e72[_0x6857('0x58')]=util[_0x6857('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e3079[_0x6857('0x6d')],_0x1f2e72[_0x6857('0x5a')],md5(_0x1f2e72['uniqueid']));}return getConnection(_0x5e3079)[_0x6857('0x4e')](function(_0x3c6251){_0x4c5790=_0x3c6251;return getUser(_0x5e3079,_0x4885b0[_0x6857('0xe')],_0x4c5790);})[_0x6857('0x4e')](function(_0x1456f7){_0x2a9084=_0x1456f7;logger[_0x6857('0x28')](_0x6857('0x5b'),_0x2a9084['id']);return getEndUser(_0x5e3079,_0x1f2e72['destcalleridname'],_0x1f2e72[_0x6857('0x70')],_0x4c5790);})[_0x6857('0x4e')](function(_0x139506){_0x432ecf=_0x139506;logger[_0x6857('0x28')](_0x6857('0x5e'),_0x432ecf['id']);return getTicket(_0x5e3079,_0x2a9084,_0x432ecf,_0x2b74b0,_0x1f2e72,_0x2b74b0['Fields'],_0x4c5790,'Outbound');})[_0x6857('0x4e')](function(_0x2ef56f){_0x196374=_0x2ef56f;logger[_0x6857('0x28')](_0x6857('0x61'));logger[_0x6857('0x28')]('The\x20Ticket\x20ID\x20is:',_0x196374['id']);return setRelationship(_0x4c5790,_0x2a9084,_0x196374,_0x6857('0x62'));})[_0x6857('0x4e')](function(){return setRelationship(_0x4c5790,_0x432ecf,_0x196374,_0x6857('0x63'));})[_0x6857('0x4e')](function(){return getServerInfo(_0x4c5790);})[_0x6857('0x4e')](function(_0x270611){var _0x5a27f6=parseInt(_0x270611['version'][_0x6857('0x65')](0x0));var _0x10ca29=util['format'](_0x6857('0x66'),_0x5e3079[_0x6857('0x52')],_0x196374['id']);if(_0x5a27f6>0x6){_0x10ca29=util['format'](_0x6857('0x67'),_0x5e3079['remoteUri'],_0x196374['id']);}logger[_0x6857('0x28')](_0x6857('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6857('0x23')](_0x6857('0x69'),_0x4885b0[_0x6857('0xe')]),_0x6857('0x6a'),{'uri':_0x10ca29});})[_0x6857('0x72')](function(_0x12e1e9){logger[_0x6857('0x6b')](_0x6857('0x71'),JSON['stringify'](_0x12e1e9));});};exports[_0x6857('0x73')]=function(_0x313791,_0x29a939,_0x36ad98,_0x2205b9,_0x2c9392,_0x5b8dcb){var _0x1ed2b0,_0x429fe8,_0x1ccbf6,_0x507582;_0x5b8dcb[_0x6857('0x52')]=intUtil[_0x6857('0x53')](_0x5b8dcb[_0x6857('0x52')]);_0x5b8dcb[_0x6857('0x6d')]=intUtil[_0x6857('0x53')](_0x5b8dcb[_0x6857('0x6d')]);def[_0x6857('0x54')]=util['format'](_0x6857('0x6e'),_0x5b8dcb[_0x6857('0x52')]);if(_0x2c9392&&_0x2c9392['monitor_format']){logger['info']('['+_0x29a939['lastevent'][_0x6857('0x74')]()+']',_0x6857('0x57'));_0x29a939[_0x6857('0x58')]=util[_0x6857('0x23')](_0x6857('0x59'),_0x5b8dcb['serverUrl'],_0x29a939['uniqueid'],md5(_0x29a939['uniqueid']));}else{_0x29a939[_0x6857('0x58')]='';}return getConnection(_0x5b8dcb)[_0x6857('0x4e')](function(_0x5a46d6){_0x507582=_0x5a46d6;if(!_[_0x6857('0x75')](_0x2205b9)){return getUser(_0x5b8dcb,_0x2205b9['name'],_0x507582);}else{return getUser(_0x5b8dcb,null,_0x507582);}})[_0x6857('0x4e')](function(_0x381a55){_0x1ed2b0=_0x381a55;logger[_0x6857('0x28')](_0x6857('0x5b'),_0x1ed2b0['id']);return getEndUser(_0x5b8dcb,_0x29a939[_0x6857('0x5c')],_0x29a939['calleridnum'],_0x507582);})[_0x6857('0x4e')](function(_0x5066f0){_0x429fe8=_0x5066f0;logger[_0x6857('0x28')]('The\x20Enduser\x20ID\x20is:',_0x429fe8['id']);return getTicket(_0x5b8dcb,_0x1ed2b0,_0x429fe8,_0x36ad98,_0x29a939,_0x36ad98[_0x6857('0x5f')],_0x507582,_0x6857('0x60'));})[_0x6857('0x4e')](function(_0x19571f){_0x1ccbf6=_0x19571f;logger[_0x6857('0x28')](_0x6857('0x61'));logger[_0x6857('0x28')]('The\x20Ticket\x20ID\x20is:',_0x1ccbf6['id']);return setRelationship(_0x507582,_0x1ed2b0,_0x1ccbf6,'users');})[_0x6857('0x4e')](function(){return setRelationship(_0x507582,_0x429fe8,_0x1ccbf6,'contacts');})[_0x6857('0x4e')](function(){return getServerInfo(_0x507582);})[_0x6857('0x72')](function(_0x518cc9){logger[_0x6857('0x6b')]('['+_0x29a939['lastevent'][_0x6857('0x74')]()+']',JSON['stringify'](_0x518cc9));});}; \ No newline at end of file +var _0x1f19=['toISOString','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','idField','variableName','set_entry','stringify','format','Basic\x20%s','toString','base64','get_server_info','JSON','info','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','first_name','[HTTP]','type','nameField','customField','toLowerCase','content','string','push','customVariable','Variable','custom_fields','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','error','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridname','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','Descriptions','date_start'];(function(_0x205659,_0x482ef3){var _0x22754d=function(_0x37d264){while(--_0x37d264){_0x205659['push'](_0x205659['shift']());}};_0x22754d(++_0x482ef3);}(_0x1f19,0x13f));var _0x91f1=function(_0x32c348,_0x16260e){_0x32c348=_0x32c348-0x0;var _0x20adf6=_0x1f19[_0x32c348];return _0x20adf6;};'use strict';var _=require(_0x91f1('0x0'));var rp=require(_0x91f1('0x1'));var BPromise=require('bluebird');var md5=require(_0x91f1('0x2'));var util=require('util');var Redis=require(_0x91f1('0x3'));var intUtil=require(_0x91f1('0x4'));var config=require('../../../../config/environment');var logger=require(_0x91f1('0x5'))(_0x91f1('0x6'));config[_0x91f1('0x7')]=_[_0x91f1('0x8')](config[_0x91f1('0x7')],{'host':_0x91f1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x91f1('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x124d4a,_0x4410bb,_0x5bb7bc){io['to'](_0x124d4a)['emit'](_0x4410bb,_0x5bb7bc);}function getTicket(_0x169f8a,_0x48dcc2,_0x204286,_0x130e85,_0x4140fe,_0x46a51d,_0x36f072,_0x364fb6){logger['info'](_0x91f1('0xa'));var _0x3f61db=new Date();var _0x29b1bb=[{'name':_0x91f1('0xb'),'value':intUtil[_0x91f1('0xc')](_0x130e85[_0x91f1('0xd')],_0x4140fe,'\x20')},{'name':_0x91f1('0xe'),'value':_0x48dcc2['id']},{'name':'created_by','value':_0x48dcc2['id']},{'name':'description','value':intUtil['getString'](_0x130e85[_0x91f1('0xf')],_0x4140fe,'\x0a')},{'name':_0x91f1('0x10'),'value':_0x3f61db[_0x91f1('0x11')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x91f1('0x12'),'value':'15'},{'name':_0x91f1('0x13'),'value':_0x204286['id']},{'name':_0x91f1('0x14'),'value':_0x91f1('0x15')},{'name':_0x91f1('0x16'),'value':_0x204286[_0x91f1('0xb')]},{'name':_0x91f1('0x17'),'value':_0x364fb6}];if(_0x46a51d[_0x91f1('0x18')]){_[_0x91f1('0x19')](_0x46a51d,function(_0x1540a9){if(_0x4140fe[_0x1540a9['variableName']]){_0x29b1bb['push']({'name':_0x1540a9[_0x91f1('0x1a')],'value':_0x4140fe[_0x1540a9[_0x91f1('0x1b')]]});}});}return request({'form':{'method':_0x91f1('0x1c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x91f1('0x1d')]({'session':_0x36f072['id'],'module_name':'Calls','name_value_list':_0x29b1bb})}});}function getAuth(_0x22a7e3){return util[_0x91f1('0x1e')](_0x91f1('0x1f'),new Buffer(_0x22a7e3['apiKey']+':X')[_0x91f1('0x20')](_0x91f1('0x21')));}function getServerInfo(_0x86b3e7){return request({'form':{'method':_0x91f1('0x22'),'input_type':'JSON','response_type':_0x91f1('0x23'),'rest_data':JSON[_0x91f1('0x1d')]({'session':_0x86b3e7['id']})}});}function getUser(_0x148a99,_0x9b6a4c,_0x177331){if(!_['isNil'](_0x9b6a4c)){logger[_0x91f1('0x24')]('Getting\x20agent\x20with\x20name',_0x9b6a4c);return request({'form':{'method':_0x91f1('0x25'),'input_type':_0x91f1('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x177331['id'],'module_name':'Employees','query':util[_0x91f1('0x1e')](_0x91f1('0x26'),_0x9b6a4c),'order_by':'','offset':'0','select_fields':['id',_0x91f1('0xb'),_0x91f1('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xeb0a8){if(_0xeb0a8[_0x91f1('0x28')][_0x91f1('0x18')]){var _0x122a30=_[_0x91f1('0x29')](_0xeb0a8[_0x91f1('0x28')],function(_0x29cc2e){return _0x29cc2e[_0x91f1('0x2a')]['user_name'][_0x91f1('0x2b')]===_0x9b6a4c;});if(_0x122a30){logger[_0x91f1('0x24')](_0x91f1('0x2c'));return BPromise['resolve']({'id':_0x122a30[_0x91f1('0x2a')]['id']['value'],'name':_0x122a30[_0x91f1('0x2a')]['name'][_0x91f1('0x2b')]});}}logger[_0x91f1('0x24')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x91f1('0x2d')]({'id':_0x177331['name_value_list']['user_id'][_0x91f1('0x2b')],'name':_0x177331[_0x91f1('0x2a')][_0x91f1('0x27')][_0x91f1('0x2b')]});});}else{logger['info'](_0x91f1('0x2e'));return BPromise[_0x91f1('0x2d')]({'id':_0x177331[_0x91f1('0x2a')][_0x91f1('0x2f')][_0x91f1('0x2b')],'name':_0x177331[_0x91f1('0x2a')][_0x91f1('0x27')]['value']});}}function getEndUser(_0x50a226,_0x1dd087,_0x41672d,_0x34e347){logger['info'](_0x91f1('0x30'),_0x41672d);return request({'form':{'method':_0x91f1('0x25'),'input_type':'JSON','response_type':_0x91f1('0x23'),'rest_data':JSON[_0x91f1('0x1d')]({'session':_0x34e347['id'],'module_name':_0x91f1('0x15'),'query':util[_0x91f1('0x1e')](_0x91f1('0x31'),_0x41672d),'order_by':'','offset':'0','select_fields':['id',_0x91f1('0xb'),_0x91f1('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x91f1('0x33')](function(_0x1b2b1f){if(_0x1b2b1f['entry_list']['length']){var _0x57ca85=_[_0x91f1('0x29')](_0x1b2b1f[_0x91f1('0x28')],function(_0x57d4b4){return _0x57d4b4[_0x91f1('0x2a')]['phone_home'][_0x91f1('0x2b')]===_0x41672d;});if(_0x57ca85){logger[_0x91f1('0x24')](_0x91f1('0x34'));return BPromise[_0x91f1('0x2d')]({'id':_0x57ca85[_0x91f1('0x2a')]['id']['value'],'name':_0x57ca85[_0x91f1('0x2a')][_0x91f1('0xb')][_0x91f1('0x2b')],'phone':_0x57ca85[_0x91f1('0x2a')]['phone_home'][_0x91f1('0x2b')]});}}else{logger['info'](_0x91f1('0x35'));return request({'form':{'method':_0x91f1('0x1c'),'input_type':_0x91f1('0x23'),'response_type':_0x91f1('0x23'),'rest_data':JSON[_0x91f1('0x1d')]({'session':_0x34e347['id'],'module_name':_0x91f1('0x15'),'name_value_list':[{'name':'first_name','value':_0x1dd087!==_0x91f1('0x36')?_0x1dd087:util['format'](_0x91f1('0x37'),_0x41672d)},{'name':_0x91f1('0x32'),'value':_0x41672d}]})}})[_0x91f1('0x33')](function(_0x357cd9){logger['info']('Enduser\x20created.');return BPromise[_0x91f1('0x2d')]({'id':_0x357cd9['id'],'name':_0x357cd9[_0x91f1('0x28')][_0x91f1('0x38')]['value'],'phone':_0x357cd9[_0x91f1('0x28')][_0x91f1('0x32')]['value']});});}});}function request(_0xf354fa){logger['debug'](_0x91f1('0x39'),JSON['stringify'](_0xf354fa));return rp(_['merge'](def,_0xf354fa));}function getTags(_0xd79bbf,_0x5db295){var _0x50837f=[];if(_0xd79bbf&&_0xd79bbf[_0x91f1('0x18')]>0x0){_0x50837f=_['map'](_0xd79bbf,_0x5db295);}return _0x50837f;}function getCustomFields(_0x2e2945,_0x589039){var _0x2c9ce7=[];var _0xce37cf={'custom_fields':[]};if(_0x2e2945[_0x91f1('0x18')]>0x0){_[_0x91f1('0x19')](_0x2e2945,function(_0x4ae53a){if(_0x4ae53a[_0x91f1('0x3a')]==='string'&&_0x4ae53a[_0x91f1('0x3b')]&&!_0x4ae53a[_0x91f1('0x3c')]){_0xce37cf[_0x4ae53a[_0x91f1('0x3b')][_0x91f1('0x3d')]()]=_0x4ae53a[_0x91f1('0x3e')][_0x91f1('0x20')]();}else if(_0x4ae53a[_0x91f1('0x3a')]===_0x91f1('0x3f')&&_0x4ae53a['idField']&&_0x4ae53a[_0x91f1('0x3c')]){_0xce37cf['custom_fields'][_0x91f1('0x40')]({'id':_0x4ae53a[_0x91f1('0x1a')],'value':_0x4ae53a['content'][_0x91f1('0x20')]()});}else if(_0x4ae53a[_0x91f1('0x3a')]==='variable'&&_0x4ae53a[_0x91f1('0x1b')]&&_0x4ae53a[_0x91f1('0x1a')]&&_0x4ae53a[_0x91f1('0x3c')]){_0x589039[_0x4ae53a[_0x91f1('0x1b')]]&&_0xce37cf['custom_fields'][_0x91f1('0x40')]({'id':_0x4ae53a['idField'],'value':_0x589039[_0x4ae53a[_0x91f1('0x1b')]][_0x91f1('0x20')]()});}else if(_0x4ae53a[_0x91f1('0x3a')]===_0x91f1('0x41')&&_0x4ae53a[_0x91f1('0x42')]&&_0x4ae53a[_0x91f1('0x42')][_0x91f1('0xb')]&&_0x4ae53a['idField']&&_0x4ae53a['customField']){_0x589039[_0x4ae53a['Variable'][_0x91f1('0xb')][_0x91f1('0x3d')]()]&&_0xce37cf[_0x91f1('0x43')]['push']({'id':_0x4ae53a[_0x91f1('0x1a')],'value':_0x589039[_0x4ae53a[_0x91f1('0x42')][_0x91f1('0xb')]['toLowerCase']()][_0x91f1('0x20')]()});}});}return _0xce37cf;}function getConnection(_0x37a3a0){return request({'method':'POST','form':{'method':'login','input_type':_0x91f1('0x23'),'response_type':_0x91f1('0x23'),'rest_data':JSON[_0x91f1('0x1d')]({'user_auth':{'user_name':_0x37a3a0[_0x91f1('0x44')],'password':_0x37a3a0[_0x91f1('0x45')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x54b7da){var _0x44c9de=_0x54b7da;if(_0x44c9de['id']){def[_0x91f1('0x46')]=_0x44c9de['id'];return BPromise[_0x91f1('0x2d')](_0x44c9de);}else{throw new Error(util[_0x91f1('0x1e')](_0x91f1('0x47'),_0x37a3a0['id']));}});}function setRelationship(_0x249505,_0x10ca38,_0x158bbc,_0x500c82){return request({'form':{'method':_0x91f1('0x48'),'input_type':'JSON','response_type':_0x91f1('0x23'),'rest_data':JSON[_0x91f1('0x1d')]({'session':_0x249505['id'],'module_name':_0x91f1('0x49'),'module_id':_0x158bbc['id'],'link_field_name':_0x500c82,'related_ids':[_0x10ca38['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x91f1('0x4a')]=function(_0x3b6572,_0x22ae85,_0x5cff9f,_0x4ce4e1,_0x4e4bbc,_0xddfc53){var _0x37efd0,_0x176655,_0x5239a2,_0x1a21a9;_0xddfc53['remoteUri']=intUtil[_0x91f1('0x4b')](_0xddfc53[_0x91f1('0x4c')]);_0xddfc53[_0x91f1('0x4d')]=intUtil[_0x91f1('0x4b')](_0xddfc53['serverUrl']);def[_0x91f1('0x4e')]=util[_0x91f1('0x1e')](_0x91f1('0x4f'),_0xddfc53[_0x91f1('0x4c')]);if(_0x4e4bbc&&_0x4e4bbc['monitor_format']){logger[_0x91f1('0x24')](_0x91f1('0x50'),'Recording\x20is\x20enabled!');_0x22ae85[_0x91f1('0x51')]=util[_0x91f1('0x1e')](_0x91f1('0x52'),_0xddfc53[_0x91f1('0x4d')],_0x22ae85['uniqueid'],md5(_0x22ae85[_0x91f1('0x53')]));}else{_0x22ae85[_0x91f1('0x51')]='';}return getConnection(_0xddfc53)[_0x91f1('0x33')](function(_0x25d99e){_0x1a21a9=_0x25d99e;return getUser(_0xddfc53,_0x4ce4e1[_0x91f1('0xb')],_0x1a21a9);})[_0x91f1('0x33')](function(_0x13baa0){_0x37efd0=_0x13baa0;logger[_0x91f1('0x24')](_0x91f1('0x54'),_0x37efd0['id']);return getEndUser(_0xddfc53,_0x22ae85['calleridname'],_0x22ae85[_0x91f1('0x55')],_0x1a21a9);})[_0x91f1('0x33')](function(_0x27d820){_0x176655=_0x27d820;logger[_0x91f1('0x24')](_0x91f1('0x56'),_0x176655['id']);return getTicket(_0xddfc53,_0x37efd0,_0x176655,_0x5cff9f,_0x22ae85,_0x5cff9f[_0x91f1('0x57')],_0x1a21a9,_0x91f1('0x58'));})[_0x91f1('0x33')](function(_0x3c708b){_0x5239a2=_0x3c708b;logger[_0x91f1('0x24')](_0x91f1('0x59'));logger[_0x91f1('0x24')](_0x91f1('0x5a'),_0x5239a2['id']);return setRelationship(_0x1a21a9,_0x37efd0,_0x5239a2,_0x91f1('0x5b'));})['then'](function(){return setRelationship(_0x1a21a9,_0x176655,_0x5239a2,_0x91f1('0x5c'));})[_0x91f1('0x33')](function(){return getServerInfo(_0x1a21a9);})['then'](function(_0x37c960){var _0x35d58b=parseInt(_0x37c960[_0x91f1('0x5d')][_0x91f1('0x5e')](0x0));var _0x1b3072=util[_0x91f1('0x1e')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xddfc53['remoteUri'],_0x5239a2['id']);if(_0x35d58b>0x6){_0x1b3072=util['format'](_0x91f1('0x5f'),_0xddfc53[_0x91f1('0x4c')],_0x5239a2['id']);}logger['info'](_0x91f1('0x50'),_0x91f1('0x60'));emit(util[_0x91f1('0x1e')](_0x91f1('0x61'),_0x4ce4e1[_0x91f1('0xb')]),'trigger:browser:url',{'uri':_0x1b3072});})[_0x91f1('0x62')](function(_0x439b5f){logger['error'](_0x91f1('0x50'),JSON['stringify'](_0x439b5f));});};exports['outbound']=function(_0x2fad6c,_0x1af125,_0x3e00ae,_0x3d6c84,_0x152059,_0x96e925,_0x4e7594){var _0x5f1fd1,_0x2ba4bb,_0x1fb932,_0x5a12f9;_0x96e925[_0x91f1('0x4c')]=intUtil[_0x91f1('0x4b')](_0x96e925[_0x91f1('0x4c')]);_0x96e925[_0x91f1('0x4d')]=intUtil['stripTrailingSlash'](_0x96e925['serverUrl']);def[_0x91f1('0x4e')]=util[_0x91f1('0x1e')]('%s/service/v4_1/rest.php',_0x96e925[_0x91f1('0x4c')]);if(_0x4e7594&&_0x4e7594[_0x91f1('0x63')]&&_0x4e7594[_0x91f1('0x63')]!=='none'){logger[_0x91f1('0x24')](_0x91f1('0x64'),_0x91f1('0x65'));_0x1af125[_0x91f1('0x51')]=util[_0x91f1('0x1e')](_0x91f1('0x52'),_0x96e925[_0x91f1('0x4d')],_0x1af125[_0x91f1('0x53')],md5(_0x1af125[_0x91f1('0x53')]));}return getConnection(_0x96e925)[_0x91f1('0x33')](function(_0x59953d){_0x5a12f9=_0x59953d;return getUser(_0x96e925,_0x3d6c84['name'],_0x5a12f9);})['then'](function(_0x48c878){_0x5f1fd1=_0x48c878;logger[_0x91f1('0x24')](_0x91f1('0x54'),_0x5f1fd1['id']);return getEndUser(_0x96e925,_0x1af125[_0x91f1('0x66')],_0x1af125[_0x91f1('0x67')],_0x5a12f9);})['then'](function(_0x49e099){_0x2ba4bb=_0x49e099;logger[_0x91f1('0x24')](_0x91f1('0x56'),_0x2ba4bb['id']);return getTicket(_0x96e925,_0x5f1fd1,_0x2ba4bb,_0x3e00ae,_0x1af125,_0x3e00ae[_0x91f1('0x57')],_0x5a12f9,'Outbound');})[_0x91f1('0x33')](function(_0x558c73){_0x1fb932=_0x558c73;logger[_0x91f1('0x24')](_0x91f1('0x59'));logger['info'](_0x91f1('0x5a'),_0x1fb932['id']);return setRelationship(_0x5a12f9,_0x5f1fd1,_0x1fb932,_0x91f1('0x5b'));})[_0x91f1('0x33')](function(){return setRelationship(_0x5a12f9,_0x2ba4bb,_0x1fb932,_0x91f1('0x5c'));})[_0x91f1('0x33')](function(){return getServerInfo(_0x5a12f9);})[_0x91f1('0x33')](function(_0x54ee9c){var _0x17aad1=parseInt(_0x54ee9c[_0x91f1('0x5d')][_0x91f1('0x5e')](0x0));var _0x41f60d=util['format'](_0x91f1('0x68'),_0x96e925[_0x91f1('0x4c')],_0x1fb932['id']);if(_0x17aad1>0x6){_0x41f60d=util['format'](_0x91f1('0x5f'),_0x96e925[_0x91f1('0x4c')],_0x1fb932['id']);}logger[_0x91f1('0x24')](_0x91f1('0x64'),_0x91f1('0x60'));emit(util[_0x91f1('0x1e')](_0x91f1('0x61'),_0x3d6c84['name']),'trigger:browser:url',{'uri':_0x41f60d});})[_0x91f1('0x62')](function(_0x38e037){logger[_0x91f1('0x69')]('[OUTBOUND]',JSON[_0x91f1('0x1d')](_0x38e037));});};exports[_0x91f1('0x6a')]=function(_0x192471,_0x53122d,_0x1dbb22,_0x908fc4,_0x4b1b67,_0x19c527){var _0x544a24,_0x3ff749,_0x2d8bc5,_0x523108;_0x19c527[_0x91f1('0x4c')]=intUtil[_0x91f1('0x4b')](_0x19c527[_0x91f1('0x4c')]);_0x19c527['serverUrl']=intUtil[_0x91f1('0x4b')](_0x19c527['serverUrl']);def[_0x91f1('0x4e')]=util[_0x91f1('0x1e')](_0x91f1('0x4f'),_0x19c527[_0x91f1('0x4c')]);if(_0x4b1b67&&_0x4b1b67[_0x91f1('0x6b')]){logger[_0x91f1('0x24')]('['+_0x53122d[_0x91f1('0x6c')][_0x91f1('0x6d')]()+']',_0x91f1('0x65'));_0x53122d[_0x91f1('0x51')]=util['format'](_0x91f1('0x52'),_0x19c527[_0x91f1('0x4d')],_0x53122d[_0x91f1('0x53')],md5(_0x53122d[_0x91f1('0x53')]));}else{_0x53122d[_0x91f1('0x51')]='';}return getConnection(_0x19c527)['then'](function(_0x546cd5){_0x523108=_0x546cd5;if(!_[_0x91f1('0x6e')](_0x908fc4)){return getUser(_0x19c527,_0x908fc4[_0x91f1('0xb')],_0x523108);}else{return getUser(_0x19c527,null,_0x523108);}})[_0x91f1('0x33')](function(_0x22b9a9){_0x544a24=_0x22b9a9;logger[_0x91f1('0x24')](_0x91f1('0x54'),_0x544a24['id']);return getEndUser(_0x19c527,_0x53122d[_0x91f1('0x6f')],_0x53122d['calleridnum'],_0x523108);})[_0x91f1('0x33')](function(_0x9014b){_0x3ff749=_0x9014b;logger['info'](_0x91f1('0x56'),_0x3ff749['id']);return getTicket(_0x19c527,_0x544a24,_0x3ff749,_0x1dbb22,_0x53122d,_0x1dbb22['Fields'],_0x523108,_0x91f1('0x58'));})[_0x91f1('0x33')](function(_0x8c0023){_0x2d8bc5=_0x8c0023;logger[_0x91f1('0x24')]('Ticket\x20created!');logger[_0x91f1('0x24')](_0x91f1('0x5a'),_0x2d8bc5['id']);return setRelationship(_0x523108,_0x544a24,_0x2d8bc5,_0x91f1('0x5b'));})[_0x91f1('0x33')](function(){return setRelationship(_0x523108,_0x3ff749,_0x2d8bc5,_0x91f1('0x5c'));})['then'](function(){return getServerInfo(_0x523108);})[_0x91f1('0x62')](function(_0x504aef){logger[_0x91f1('0x69')]('['+_0x53122d[_0x91f1('0x6c')][_0x91f1('0x6d')]()+']',JSON[_0x91f1('0x1d')](_0x504aef));});}; \ 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 8ffc7b7..9dd2f2c 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 _0xd967=['string','content','type','variable','variableName','Variable','name','toLowerCase','push','keyValue','key','%s:\x20%s','keyContent','keyType','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xd967,0x19d));var _0x7d96=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xd967[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0x7d96('0x0'));var util=require(_0x7d96('0x1'));exports['getString']=function(_0x43bce2,_0x32ea86,_0x44504f){var _0x1e13de=[];if(_0x43bce2[_0x7d96('0x2')]>0x0){var _0x439a9d=_['sortBy'](_0x43bce2,['id']);for(var _0x2b45ce=0x0;_0x2b45ce<_0x439a9d['length'];_0x2b45ce++){var _0x5f1da0=_0x439a9d[_0x2b45ce];if(_0x5f1da0['type']===_0x7d96('0x3')){_0x1e13de['push'](_0x5f1da0[_0x7d96('0x4')]);}else if(_0x5f1da0[_0x7d96('0x5')]===_0x7d96('0x6')&&_0x5f1da0[_0x7d96('0x7')]){_0x32ea86[_0x5f1da0[_0x7d96('0x7')]]&&_0x1e13de['push'](_0x32ea86[_0x5f1da0[_0x7d96('0x7')]]['toString']());}else if(_0x5f1da0[_0x7d96('0x5')]==='customVariable'&&_0x5f1da0[_0x7d96('0x8')]&&_0x5f1da0[_0x7d96('0x8')]['name']){_0x32ea86[_0x5f1da0[_0x7d96('0x8')][_0x7d96('0x9')][_0x7d96('0xa')]()]&&_0x1e13de[_0x7d96('0xb')](_0x32ea86[_0x5f1da0['Variable']['name']['toLowerCase']()]['toString']());}else if(_0x5f1da0[_0x7d96('0x5')]===_0x7d96('0xc')){if(_0x5f1da0['keyType']==='string'&&_0x5f1da0[_0x7d96('0xd')]){_0x1e13de[_0x7d96('0xb')](util['format'](_0x7d96('0xe'),_0x5f1da0['key'],_0x5f1da0[_0x7d96('0xf')]));}else if(_0x5f1da0['keyType']===_0x7d96('0x6')&&_0x5f1da0[_0x7d96('0x7')]&&_0x5f1da0[_0x7d96('0xd')]){_0x32ea86[_0x5f1da0['variableName']]&&_0x1e13de[_0x7d96('0xb')](util['format'](_0x7d96('0xe'),_0x5f1da0[_0x7d96('0xd')],_0x32ea86[_0x5f1da0[_0x7d96('0x7')]]));}else if(_0x5f1da0[_0x7d96('0x10')]===_0x7d96('0x11')&&_0x5f1da0['Variable']&&_0x5f1da0[_0x7d96('0x8')]['name']&&_0x5f1da0['key']){_0x32ea86[_0x5f1da0[_0x7d96('0x8')][_0x7d96('0x9')][_0x7d96('0xa')]()]&&_0x1e13de['push'](util['format']('%s:\x20%s',_0x5f1da0[_0x7d96('0xd')],_0x32ea86[_0x5f1da0['Variable'][_0x7d96('0x9')][_0x7d96('0xa')]()]));}}}}return _0x1e13de[_0x7d96('0x12')](_0x44504f);};exports[_0x7d96('0x13')]=function(_0x47651f){var _0x1b1b6a=_0x47651f[_0x7d96('0x14')](-0x1);if(_0x1b1b6a==='/'){_0x47651f=_0x47651f[_0x7d96('0x15')](0x0,_0x47651f[_0x7d96('0x16')](_0x1b1b6a));}return _0x47651f;};exports[_0x7d96('0x17')]=function(_0x4be91d){if(!_[_0x7d96('0x18')](_0x4be91d)&&_0x4be91d!==''){var _0x1e64d5=/^(([^<>()\[\]\\.,;:\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 _0x1e64d5[_0x7d96('0x19')](String(_0x4be91d)[_0x7d96('0xa')]());}else{return![];}}; \ No newline at end of file +var _0x9ab3=['length','sortBy','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','validateEmail','isNil','test','util','getString'];(function(_0x3e2296,_0x1f0b1f){var _0x330b1f=function(_0x42abd9){while(--_0x42abd9){_0x3e2296['push'](_0x3e2296['shift']());}};_0x330b1f(++_0x1f0b1f);}(_0x9ab3,0x1e4));var _0x39ab=function(_0x329bd1,_0x2e265f){_0x329bd1=_0x329bd1-0x0;var _0x625752=_0x9ab3[_0x329bd1];return _0x625752;};'use strict';var _=require('lodash');var util=require(_0x39ab('0x0'));exports[_0x39ab('0x1')]=function(_0x1450e4,_0x41a6bf,_0xbe1963){var _0x4c8ab3=[];if(_0x1450e4[_0x39ab('0x2')]>0x0){var _0x3e8ff3=_[_0x39ab('0x3')](_0x1450e4,['id']);for(var _0x27e55a=0x0;_0x27e55a<_0x3e8ff3[_0x39ab('0x2')];_0x27e55a++){var _0x291c9d=_0x3e8ff3[_0x27e55a];if(_0x291c9d[_0x39ab('0x4')]===_0x39ab('0x5')){_0x4c8ab3['push'](_0x291c9d[_0x39ab('0x6')]);}else if(_0x291c9d['type']===_0x39ab('0x7')&&_0x291c9d[_0x39ab('0x8')]){_0x41a6bf[_0x291c9d['variableName']]&&_0x4c8ab3[_0x39ab('0x9')](_0x41a6bf[_0x291c9d[_0x39ab('0x8')]][_0x39ab('0xa')]());}else if(_0x291c9d[_0x39ab('0x4')]===_0x39ab('0xb')&&_0x291c9d[_0x39ab('0xc')]&&_0x291c9d[_0x39ab('0xc')][_0x39ab('0xd')]){_0x41a6bf[_0x291c9d[_0x39ab('0xc')][_0x39ab('0xd')][_0x39ab('0xe')]()]&&_0x4c8ab3[_0x39ab('0x9')](_0x41a6bf[_0x291c9d['Variable'][_0x39ab('0xd')]['toLowerCase']()][_0x39ab('0xa')]());}else if(_0x291c9d['type']===_0x39ab('0xf')){if(_0x291c9d[_0x39ab('0x10')]===_0x39ab('0x5')&&_0x291c9d[_0x39ab('0x11')]){_0x4c8ab3[_0x39ab('0x9')](util[_0x39ab('0x12')](_0x39ab('0x13'),_0x291c9d['key'],_0x291c9d[_0x39ab('0x14')]));}else if(_0x291c9d[_0x39ab('0x10')]===_0x39ab('0x7')&&_0x291c9d[_0x39ab('0x8')]&&_0x291c9d['key']){_0x41a6bf[_0x291c9d[_0x39ab('0x8')]]&&_0x4c8ab3[_0x39ab('0x9')](util[_0x39ab('0x12')](_0x39ab('0x13'),_0x291c9d[_0x39ab('0x11')],_0x41a6bf[_0x291c9d[_0x39ab('0x8')]]));}else if(_0x291c9d[_0x39ab('0x10')]===_0x39ab('0xb')&&_0x291c9d[_0x39ab('0xc')]&&_0x291c9d[_0x39ab('0xc')]['name']&&_0x291c9d['key']){_0x41a6bf[_0x291c9d[_0x39ab('0xc')][_0x39ab('0xd')]['toLowerCase']()]&&_0x4c8ab3[_0x39ab('0x9')](util[_0x39ab('0x12')](_0x39ab('0x13'),_0x291c9d[_0x39ab('0x11')],_0x41a6bf[_0x291c9d[_0x39ab('0xc')][_0x39ab('0xd')][_0x39ab('0xe')]()]));}}}}return _0x4c8ab3['join'](_0xbe1963);};exports[_0x39ab('0x15')]=function(_0x4f77ee){var _0x14fc9a=_0x4f77ee[_0x39ab('0x16')](-0x1);if(_0x14fc9a==='/'){_0x4f77ee=_0x4f77ee[_0x39ab('0x17')](0x0,_0x4f77ee['lastIndexOf'](_0x14fc9a));}return _0x4f77ee;};exports[_0x39ab('0x18')]=function(_0x42c486){if(!_[_0x39ab('0x19')](_0x42c486)&&_0x42c486!==''){var _0x268ce9=/^(([^<>()\[\]\\.,;:\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 _0x268ce9[_0x39ab('0x1a')](String(_0x42c486)[_0x39ab('0xe')]());}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 c9262e4..0a45446 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x993946,_0xfed55a){var _0x511b90=function(_0x17ab7b){while(--_0x17ab7b){_0x993946['push'](_0x993946['shift']());}};_0x511b90(++_0xfed55a);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index c5a7100..9d27726 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 _0xa0e4=['content','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','recordingFormat','email','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','recordingURL','catch','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','%s:%s','token','%s/token:%s','username','Basic\x20%s','base64','debug','[HTTP]','stringify','defaults','GET','forEach','picklist','type','nameField','customField','toLowerCase','toString','includes','custom_fields','idField'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xa0e4,0x1e1));var _0x4a0e=function(_0x3e978c,_0x1d5774){_0x3e978c=_0x3e978c-0x0;var _0x295585=_0xa0e4[_0x3e978c];return _0x295585;};'use strict';var _=require(_0x4a0e('0x0'));var rp=require(_0x4a0e('0x1'));var md5=require(_0x4a0e('0x2'));var util=require(_0x4a0e('0x3'));var Redis=require(_0x4a0e('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x4a0e('0x5'))(_0x4a0e('0x6'));config[_0x4a0e('0x7')]=_['defaults'](config[_0x4a0e('0x7')],{'host':_0x4a0e('0x8'),'port':0x18eb});var io=require(_0x4a0e('0x9'))(new Redis(config[_0x4a0e('0x7')]));function emit(_0x24aa26,_0x4ea1f0,_0x3aee46){io['to'](_0x24aa26)[_0x4a0e('0xa')](_0x4ea1f0,_0x3aee46);}var headers={'Content-Type':'application/json','Accept':_0x4a0e('0xb')};function getTicket(_0x28153c,_0x32be31,_0xad3cb9,_0x2f4fc1,_0x384ed5){logger[_0x4a0e('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x4a0e('0xd')](_0x4a0e('0xe'),_0x28153c[_0x4a0e('0xf')]),'method':_0x4a0e('0x10'),'body':{'ticket':_[_0x4a0e('0x11')]({'requester_id':_0xad3cb9['id'],'submitter_id':_0x32be31?_0x32be31['id']:undefined,'assignee_id':_0x32be31?_0x32be31['id']:undefined,'tags':getTags(_0x2f4fc1['Tags'],_0x4a0e('0x12')),'subject':intUtil[_0x4a0e('0x13')](_0x2f4fc1[_0x4a0e('0x14')],_0x384ed5,'\x20'),'description':intUtil['getString'](_0x2f4fc1[_0x4a0e('0x15')],_0x384ed5,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4a0e('0x13')](_0x2f4fc1[_0x4a0e('0x15')],_0x384ed5,'\x0a')}},getCustomFields(_0x2f4fc1[_0x4a0e('0x16')],_0x384ed5))}})[_0x4a0e('0x17')](function(_0x52fc6a){logger[_0x4a0e('0xc')](_0x4a0e('0x18'));return _0x52fc6a['ticket'];});}function getUser(_0x2fbedb,_0x3e9338){if(intUtil[_0x4a0e('0x19')](_0x3e9338)){logger[_0x4a0e('0xc')](_0x4a0e('0x1a'),_0x3e9338);return request({'uri':util['format'](_0x4a0e('0x1b'),_0x2fbedb[_0x4a0e('0xf')]),'qs':{'query':util['format'](_0x4a0e('0x1c'),_0x3e9338)}})[_0x4a0e('0x17')](function(_0x377910){if(_0x377910[_0x4a0e('0x1d')]){logger['info'](_0x4a0e('0x1e'));return _[_0x4a0e('0x1f')](_0x377910['results'],{'email':_0x3e9338,'role':_0x4a0e('0x20')});}else{logger[_0x4a0e('0xc')](_0x4a0e('0x21'));return request({'uri':util['format'](_0x4a0e('0x22'),_0x2fbedb[_0x4a0e('0xf')])})[_0x4a0e('0x17')](function(_0x1e4956){logger[_0x4a0e('0xc')](_0x4a0e('0x23'));return _0x1e4956[_0x4a0e('0x24')];});}});}else{logger[_0x4a0e('0xc')](_0x4a0e('0x21'));return request({'uri':util[_0x4a0e('0xd')](_0x4a0e('0x22'),_0x2fbedb[_0x4a0e('0xf')])})[_0x4a0e('0x17')](function(_0x122f5b){logger[_0x4a0e('0xc')]('Admin\x20account\x20selected.');return _0x122f5b[_0x4a0e('0x24')];});}}function getEndUser(_0x573345,_0x4bc340,_0x51370c){logger[_0x4a0e('0xc')]('Searching\x20enduser\x20with\x20phone',_0x51370c);return request({'uri':util[_0x4a0e('0xd')](_0x4a0e('0x1b'),_0x573345[_0x4a0e('0xf')]),'qs':{'query':util['format'](_0x4a0e('0x25'),_0x51370c)}})[_0x4a0e('0x17')](function(_0x43108d){var _0x4c7580;if(_0x43108d[_0x4a0e('0x26')][_0x4a0e('0x27')]){_0x43108d[_0x4a0e('0x26')]=_[_0x4a0e('0x28')](_0x43108d[_0x4a0e('0x26')],{'suspended':![],'role':_0x4a0e('0x29')});if(_0x43108d[_0x4a0e('0x26')][_0x4a0e('0x27')]){_0x4c7580=_[_0x4a0e('0x2a')](_0x43108d[_0x4a0e('0x26')]);}}if(_0x4c7580){logger[_0x4a0e('0xc')](_0x4a0e('0x2b'));return _0x4c7580;}else{logger['info'](_0x4a0e('0x2c'));return request({'uri':util[_0x4a0e('0xd')](_0x4a0e('0x2d'),_0x573345[_0x4a0e('0xf')]),'method':_0x4a0e('0x10'),'body':{'user':{'role':_0x4a0e('0x29'),'name':util[_0x4a0e('0xd')]('Caller\x20-\x20%s',_0x4bc340||_0x51370c),'phone':_0x51370c}}})[_0x4a0e('0x17')](function(_0x1e5df6){logger[_0x4a0e('0xc')](_0x4a0e('0x2e'));return _0x1e5df6[_0x4a0e('0x24')];});}});}function getAuth(_0x1fee20){var _0x596031;if(_0x1fee20[_0x4a0e('0x2f')]==='password'){_0x596031=util[_0x4a0e('0xd')](_0x4a0e('0x30'),_0x1fee20['username'],_0x1fee20['password']);}else if(_0x1fee20[_0x4a0e('0x2f')]===_0x4a0e('0x31')){_0x596031=util[_0x4a0e('0xd')](_0x4a0e('0x32'),_0x1fee20[_0x4a0e('0x33')],_0x1fee20['token']);}return util[_0x4a0e('0xd')](_0x4a0e('0x34'),new Buffer(_0x596031)['toString'](_0x4a0e('0x35')));}function request(_0x44c6e4){logger[_0x4a0e('0x36')](_0x4a0e('0x37'),JSON[_0x4a0e('0x38')](_0x44c6e4));return rp(_[_0x4a0e('0x39')](_0x44c6e4,{'method':_0x4a0e('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x42770b,_0x4ba0df){var _0x672a0f=[];if(_0x42770b&&_0x42770b[_0x4a0e('0x27')]>0x0){_0x672a0f=_['map'](_0x42770b,_0x4ba0df);}return _0x672a0f;}function getCustomFields(_0x52dc20,_0x833512){var _0x33f782=[];var _0x115e95={'custom_fields':[]};if(_0x52dc20[_0x4a0e('0x27')]>0x0){_[_0x4a0e('0x3b')](_0x52dc20,function(_0x59e9df){if(_['includes'](['string',_0x4a0e('0x3c')],_0x59e9df[_0x4a0e('0x3d')])&&_0x59e9df[_0x4a0e('0x3e')]&&!_0x59e9df[_0x4a0e('0x3f')]){_0x115e95[_0x59e9df['nameField'][_0x4a0e('0x40')]()]=_0x59e9df['content'][_0x4a0e('0x41')]();}else if(_[_0x4a0e('0x42')](['string','picklist'],_0x59e9df[_0x4a0e('0x3d')])&&_0x59e9df['idField']&&_0x59e9df['customField']){_0x115e95[_0x4a0e('0x43')]['push']({'id':_0x59e9df[_0x4a0e('0x44')],'value':_0x59e9df[_0x4a0e('0x45')][_0x4a0e('0x41')]()});}else if(_0x59e9df[_0x4a0e('0x3d')]===_0x4a0e('0x46')&&_0x59e9df[_0x4a0e('0x47')]&&_0x59e9df['idField']&&_0x59e9df[_0x4a0e('0x3f')]){_0x833512[_0x59e9df[_0x4a0e('0x47')]]&&_0x115e95[_0x4a0e('0x43')][_0x4a0e('0x48')]({'id':_0x59e9df[_0x4a0e('0x44')],'value':_0x833512[_0x59e9df[_0x4a0e('0x47')]][_0x4a0e('0x41')]()});}else if(_0x59e9df['type']===_0x4a0e('0x49')&&_0x59e9df[_0x4a0e('0x4a')]&&_0x59e9df[_0x4a0e('0x4a')][_0x4a0e('0x12')]&&_0x59e9df['idField']&&_0x59e9df[_0x4a0e('0x3f')]){_0x833512[_0x59e9df[_0x4a0e('0x4a')][_0x4a0e('0x12')][_0x4a0e('0x40')]()]&&_0x115e95[_0x4a0e('0x43')][_0x4a0e('0x48')]({'id':_0x59e9df[_0x4a0e('0x44')],'value':_0x833512[_0x59e9df[_0x4a0e('0x4a')][_0x4a0e('0x12')]['toLowerCase']()][_0x4a0e('0x41')]()});}});}return _0x115e95;}exports[_0x4a0e('0x4b')]=function(_0x28449e,_0x521200,_0x5a4f46,_0x2c4354,_0x33a5b6,_0x41f1b){var _0xd456f,_0x1450b7;_0x41f1b[_0x4a0e('0xf')]=intUtil[_0x4a0e('0x4c')](_0x41f1b['remoteUri']);_0x41f1b[_0x4a0e('0x4d')]=intUtil[_0x4a0e('0x4c')](_0x41f1b[_0x4a0e('0x4d')]);if(_0x33a5b6&&_0x33a5b6[_0x4a0e('0x4e')]){logger[_0x4a0e('0xc')](_0x4a0e('0x4f'),_0x4a0e('0x50'));_0x521200['recordingURL']=util[_0x4a0e('0xd')](_0x4a0e('0x51'),_0x41f1b['serverUrl'],_0x521200[_0x4a0e('0x52')],md5(_0x521200[_0x4a0e('0x52')]));}else{_0x521200['recordingURL']='';}headers[_0x4a0e('0x53')]=getAuth(_0x41f1b);return getUser(_0x41f1b,_0x2c4354['email'])['then'](function(_0x5d713b){_0xd456f=_0x5d713b;logger[_0x4a0e('0xc')]('The\x20User\x20ID\x20is:',_0xd456f['id']);return getEndUser(_0x41f1b,_0x521200[_0x4a0e('0x54')],_0x521200[_0x4a0e('0x55')]);})[_0x4a0e('0x17')](function(_0x39ed21){_0x1450b7=_0x39ed21;logger['info'](_0x4a0e('0x56'),_0x1450b7['id']);return getTicket(_0x41f1b,_0xd456f,_0x1450b7,_0x5a4f46,_0x521200);})['then'](function(_0x492414){if(_0x492414){logger[_0x4a0e('0xc')](_0x4a0e('0x57'),_0x492414['id']);switch(_0x41f1b[_0x4a0e('0x3d')]){case'integrationTab':logger[_0x4a0e('0xc')](_0x4a0e('0x4f'),_0x4a0e('0x58'));return request({'uri':util['format'](_0x4a0e('0x59'),_0x41f1b['remoteUri'],_0xd456f['id'],_0x492414['id']),'method':_0x4a0e('0x10')});case _0x4a0e('0x5a'):logger[_0x4a0e('0xc')](_0x4a0e('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4a0e('0x5b'),_0x2c4354[_0x4a0e('0x12')]),_0x4a0e('0x5c'),{'uri':util[_0x4a0e('0xd')](_0x4a0e('0x5d'),_0x41f1b[_0x4a0e('0xf')]['replace'](_0x4a0e('0x5e'),''),_0x492414['id'])});break;default:logger[_0x4a0e('0x5f')](_0x4a0e('0x4f'),_0x4a0e('0x60'));}}})['catch'](function(_0x50c685){logger[_0x4a0e('0x5f')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a0e('0x61')](_0x50c685,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1c7a7b,_0x136b94,_0x52f8eb,_0x4825cd,_0x3543d4,_0x5d41df,_0x579222){var _0xf9a57a,_0x481115;_0x5d41df[_0x4a0e('0xf')]=intUtil[_0x4a0e('0x4c')](_0x5d41df['remoteUri']);_0x5d41df['serverUrl']=intUtil['stripTrailingSlash'](_0x5d41df['serverUrl']);if(_0x579222&&_0x579222[_0x4a0e('0x62')]&&_0x579222['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0x4a0e('0x50'));_0x136b94['recordingURL']=util[_0x4a0e('0xd')](_0x4a0e('0x51'),_0x5d41df['serverUrl'],_0x136b94[_0x4a0e('0x52')],md5(_0x136b94[_0x4a0e('0x52')]));}headers[_0x4a0e('0x53')]=getAuth(_0x5d41df);return getUser(_0x5d41df,_0x4825cd[_0x4a0e('0x63')])[_0x4a0e('0x17')](function(_0x2126a5){_0xf9a57a=_0x2126a5;logger[_0x4a0e('0xc')](_0x4a0e('0x64'),_0xf9a57a['id']);return getEndUser(_0x5d41df,_0x136b94['destcalleridname'],_0x136b94[_0x4a0e('0x65')]);})['then'](function(_0x598ad2){_0x481115=_0x598ad2;logger[_0x4a0e('0xc')](_0x4a0e('0x56'),_0x481115['id']);return getTicket(_0x5d41df,_0xf9a57a,_0x481115,_0x52f8eb,_0x136b94);})[_0x4a0e('0x17')](function(_0x40b8df){if(_0x40b8df){logger[_0x4a0e('0xc')](_0x4a0e('0x57'),_0x40b8df['id']);switch(_0x5d41df[_0x4a0e('0x3d')]){case'integrationTab':logger[_0x4a0e('0xc')](_0x4a0e('0x66'),_0x4a0e('0x58'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5d41df['remoteUri'],_0xf9a57a['id'],_0x40b8df['id']),'method':_0x4a0e('0x10')});case _0x4a0e('0x5a'):logger[_0x4a0e('0xc')](_0x4a0e('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4a0e('0xd')](_0x4a0e('0x5b'),_0x4825cd['name']),_0x4a0e('0x5c'),{'uri':util[_0x4a0e('0xd')](_0x4a0e('0x5d'),_0x5d41df['remoteUri']['replace'](_0x4a0e('0x5e'),''),_0x40b8df['id'])});break;default:logger[_0x4a0e('0x5f')]('[OUTBOUND]',_0x4a0e('0x60'));}}})['catch'](function(_0x21f9c4){logger[_0x4a0e('0x5f')](_0x4a0e('0x67'),util['inspect'](_0x21f9c4,{'showHidden':!![],'depth':null}));});};exports[_0x4a0e('0x68')]=function(_0x7d73d6,_0x5f4a76,_0x452430,_0x30d0fa,_0x37a624,_0x2d63a9){var _0x2a7abc,_0x344a06;_0x2d63a9[_0x4a0e('0xf')]=intUtil[_0x4a0e('0x4c')](_0x2d63a9['remoteUri']);_0x2d63a9['serverUrl']=intUtil[_0x4a0e('0x4c')](_0x2d63a9[_0x4a0e('0x4d')]);if(_0x37a624&&_0x37a624[_0x4a0e('0x4e')]){logger['info']('['+_0x5f4a76['lastevent'][_0x4a0e('0x69')]()+']',_0x4a0e('0x50'));_0x5f4a76[_0x4a0e('0x6a')]=util[_0x4a0e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d63a9[_0x4a0e('0x4d')],_0x5f4a76[_0x4a0e('0x52')],md5(_0x5f4a76[_0x4a0e('0x52')]));}else{_0x5f4a76[_0x4a0e('0x6a')]='';}headers['Authorization']=getAuth(_0x2d63a9);return getUser(_0x2d63a9)[_0x4a0e('0x17')](function(_0x6a5d7d){_0x2a7abc=_0x6a5d7d;logger[_0x4a0e('0xc')](_0x4a0e('0x64'),_0x2a7abc['id']);return getEndUser(_0x2d63a9,_0x5f4a76['calleridname'],_0x5f4a76[_0x4a0e('0x55')]);})['then'](function(_0x223ad1){_0x344a06=_0x223ad1;logger[_0x4a0e('0xc')](_0x4a0e('0x56'),_0x344a06['id']);return getTicket(_0x2d63a9,_0x2a7abc,_0x344a06,_0x452430,_0x5f4a76);})['then'](function(_0x10371f){if(_0x10371f){logger[_0x4a0e('0xc')](_0x4a0e('0x57'),_0x10371f['id']);}})[_0x4a0e('0x6b')](function(_0x21d15b){logger[_0x4a0e('0x5f')]('['+_0x5f4a76[_0x4a0e('0x6c')]['toUpperCase']()+']'+_0x4a0e('0x6d'),util[_0x4a0e('0x61')](_0x21d15b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1a38=['variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','username','token','%s/token:%s','toString','base64','[HTTP]','stringify','defaults','GET','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField'];(function(_0xb8135c,_0x46c002){var _0x4e54e5=function(_0x5689bd){while(--_0x5689bd){_0xb8135c['push'](_0xb8135c['shift']());}};_0x4e54e5(++_0x46c002);}(_0x1a38,0x106));var _0x81a3=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x1a38[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x81a3('0x0'));var rp=require('request-promise');var md5=require(_0x81a3('0x1'));var util=require(_0x81a3('0x2'));var Redis=require(_0x81a3('0x3'));var intUtil=require(_0x81a3('0x4'));var config=require('../../../../config/environment');var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));config[_0x81a3('0x7')]=_['defaults'](config[_0x81a3('0x7')],{'host':_0x81a3('0x8'),'port':0x18eb});var io=require(_0x81a3('0x9'))(new Redis(config[_0x81a3('0x7')]));function emit(_0xa2a091,_0x360c81,_0x4df97a){io['to'](_0xa2a091)['emit'](_0x360c81,_0x4df97a);}var headers={'Content-Type':_0x81a3('0xa'),'Accept':'application/json'};function getTicket(_0x20050f,_0x5c60ea,_0x21a67e,_0x359df1,_0x31e225){logger[_0x81a3('0xb')](_0x81a3('0xc'));return request({'uri':util[_0x81a3('0xd')](_0x81a3('0xe'),_0x20050f[_0x81a3('0xf')]),'method':'POST','body':{'ticket':_[_0x81a3('0x10')]({'requester_id':_0x21a67e['id'],'submitter_id':_0x5c60ea?_0x5c60ea['id']:undefined,'assignee_id':_0x5c60ea?_0x5c60ea['id']:undefined,'tags':getTags(_0x359df1[_0x81a3('0x11')],_0x81a3('0x12')),'subject':intUtil[_0x81a3('0x13')](_0x359df1[_0x81a3('0x14')],_0x31e225,'\x20'),'description':intUtil['getString'](_0x359df1[_0x81a3('0x15')],_0x31e225,'\x0a'),'comment':{'public':![],'body':intUtil[_0x81a3('0x13')](_0x359df1[_0x81a3('0x15')],_0x31e225,'\x0a')}},getCustomFields(_0x359df1[_0x81a3('0x16')],_0x31e225))}})[_0x81a3('0x17')](function(_0x1c1661){logger[_0x81a3('0xb')](_0x81a3('0x18'));return _0x1c1661[_0x81a3('0x19')];});}function getUser(_0x351ad8,_0x547e0b){if(intUtil[_0x81a3('0x1a')](_0x547e0b)){logger['info'](_0x81a3('0x1b'),_0x547e0b);return request({'uri':util[_0x81a3('0xd')]('%s/search.json',_0x351ad8[_0x81a3('0xf')]),'qs':{'query':util[_0x81a3('0xd')]('type:user\x20role:agent\x20email:%s',_0x547e0b)}})['then'](function(_0x277d8c){if(_0x277d8c['count']){logger[_0x81a3('0xb')](_0x81a3('0x1c'));return _[_0x81a3('0x1d')](_0x277d8c[_0x81a3('0x1e')],{'email':_0x547e0b,'role':_0x81a3('0x1f')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x81a3('0x20'),_0x351ad8[_0x81a3('0xf')])})[_0x81a3('0x17')](function(_0x1ca4ce){logger[_0x81a3('0xb')](_0x81a3('0x21'));return _0x1ca4ce[_0x81a3('0x22')];});}});}else{logger[_0x81a3('0xb')](_0x81a3('0x23'));return request({'uri':util[_0x81a3('0xd')]('%s/users/me.json',_0x351ad8[_0x81a3('0xf')])})['then'](function(_0x5a1fe0){logger[_0x81a3('0xb')](_0x81a3('0x21'));return _0x5a1fe0[_0x81a3('0x22')];});}}function getEndUser(_0x1c8e0f,_0x1631bb,_0x351f19){logger['info'](_0x81a3('0x24'),_0x351f19);return request({'uri':util['format']('%s/search.json',_0x1c8e0f[_0x81a3('0xf')]),'qs':{'query':util[_0x81a3('0xd')](_0x81a3('0x25'),_0x351f19)}})[_0x81a3('0x17')](function(_0x2c4b84){var _0x3757b0;if(_0x2c4b84[_0x81a3('0x1e')][_0x81a3('0x26')]){_0x2c4b84[_0x81a3('0x1e')]=_[_0x81a3('0x27')](_0x2c4b84[_0x81a3('0x1e')],{'suspended':![],'role':_0x81a3('0x28')});if(_0x2c4b84['results'][_0x81a3('0x26')]){_0x3757b0=_[_0x81a3('0x29')](_0x2c4b84['results']);}}if(_0x3757b0){logger[_0x81a3('0xb')](_0x81a3('0x2a'));return _0x3757b0;}else{logger['info'](_0x81a3('0x2b'));return request({'uri':util[_0x81a3('0xd')](_0x81a3('0x2c'),_0x1c8e0f[_0x81a3('0xf')]),'method':_0x81a3('0x2d'),'body':{'user':{'role':_0x81a3('0x28'),'name':util['format'](_0x81a3('0x2e'),_0x1631bb||_0x351f19),'phone':_0x351f19}}})[_0x81a3('0x17')](function(_0x1794dc){logger['info']('Enduser\x20created.');return _0x1794dc[_0x81a3('0x22')];});}});}function getAuth(_0x2d5c24){var _0x4766d8;if(_0x2d5c24['authType']==='password'){_0x4766d8=util[_0x81a3('0xd')]('%s:%s',_0x2d5c24[_0x81a3('0x2f')],_0x2d5c24['password']);}else if(_0x2d5c24['authType']===_0x81a3('0x30')){_0x4766d8=util[_0x81a3('0xd')](_0x81a3('0x31'),_0x2d5c24['username'],_0x2d5c24['token']);}return util[_0x81a3('0xd')]('Basic\x20%s',new Buffer(_0x4766d8)[_0x81a3('0x32')](_0x81a3('0x33')));}function request(_0x29f4a5){logger['debug'](_0x81a3('0x34'),JSON[_0x81a3('0x35')](_0x29f4a5));return rp(_[_0x81a3('0x36')](_0x29f4a5,{'method':_0x81a3('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x49bfd7,_0x1256da){var _0x1e7d19=[];if(_0x49bfd7&&_0x49bfd7['length']>0x0){_0x1e7d19=_['map'](_0x49bfd7,_0x1256da);}return _0x1e7d19;}function getCustomFields(_0x15a325,_0x5ae53b){var _0xce3cde=[];var _0x347768={'custom_fields':[]};if(_0x15a325[_0x81a3('0x26')]>0x0){_['forEach'](_0x15a325,function(_0x988b47){if(_[_0x81a3('0x38')]([_0x81a3('0x39'),_0x81a3('0x3a')],_0x988b47[_0x81a3('0x3b')])&&_0x988b47[_0x81a3('0x3c')]&&!_0x988b47[_0x81a3('0x3d')]){_0x347768[_0x988b47[_0x81a3('0x3c')][_0x81a3('0x3e')]()]=_0x988b47[_0x81a3('0x3f')][_0x81a3('0x32')]();}else if(_['includes']([_0x81a3('0x39'),_0x81a3('0x3a')],_0x988b47['type'])&&_0x988b47[_0x81a3('0x40')]&&_0x988b47['customField']){_0x347768['custom_fields']['push']({'id':_0x988b47[_0x81a3('0x40')],'value':_0x988b47['content'][_0x81a3('0x32')]()});}else if(_0x988b47[_0x81a3('0x3b')]===_0x81a3('0x41')&&_0x988b47[_0x81a3('0x42')]&&_0x988b47[_0x81a3('0x40')]&&_0x988b47[_0x81a3('0x3d')]){_0x5ae53b[_0x988b47[_0x81a3('0x42')]]&&_0x347768[_0x81a3('0x43')][_0x81a3('0x44')]({'id':_0x988b47[_0x81a3('0x40')],'value':_0x5ae53b[_0x988b47[_0x81a3('0x42')]][_0x81a3('0x32')]()});}else if(_0x988b47[_0x81a3('0x3b')]===_0x81a3('0x45')&&_0x988b47['Variable']&&_0x988b47[_0x81a3('0x46')][_0x81a3('0x12')]&&_0x988b47['idField']&&_0x988b47[_0x81a3('0x3d')]){_0x5ae53b[_0x988b47[_0x81a3('0x46')][_0x81a3('0x12')][_0x81a3('0x3e')]()]&&_0x347768[_0x81a3('0x43')]['push']({'id':_0x988b47[_0x81a3('0x40')],'value':_0x5ae53b[_0x988b47[_0x81a3('0x46')]['name'][_0x81a3('0x3e')]()][_0x81a3('0x32')]()});}});}return _0x347768;}exports[_0x81a3('0x47')]=function(_0x1a4fee,_0x26f12d,_0x1828f0,_0x29c857,_0x4b65f6,_0x35239a){var _0x5d702d,_0x107bf7;_0x35239a['remoteUri']=intUtil[_0x81a3('0x48')](_0x35239a[_0x81a3('0xf')]);_0x35239a[_0x81a3('0x49')]=intUtil[_0x81a3('0x48')](_0x35239a['serverUrl']);if(_0x4b65f6&&_0x4b65f6[_0x81a3('0x4a')]){logger[_0x81a3('0xb')]('[QUEUE]',_0x81a3('0x4b'));_0x26f12d[_0x81a3('0x4c')]=util[_0x81a3('0xd')](_0x81a3('0x4d'),_0x35239a['serverUrl'],_0x26f12d['uniqueid'],md5(_0x26f12d[_0x81a3('0x4e')]));}else{_0x26f12d[_0x81a3('0x4c')]='';}headers[_0x81a3('0x4f')]=getAuth(_0x35239a);return getUser(_0x35239a,_0x29c857[_0x81a3('0x50')])[_0x81a3('0x17')](function(_0xafd961){_0x5d702d=_0xafd961;logger[_0x81a3('0xb')](_0x81a3('0x51'),_0x5d702d['id']);return getEndUser(_0x35239a,_0x26f12d['calleridname'],_0x26f12d[_0x81a3('0x52')]);})[_0x81a3('0x17')](function(_0x50c6d7){_0x107bf7=_0x50c6d7;logger[_0x81a3('0xb')](_0x81a3('0x53'),_0x107bf7['id']);return getTicket(_0x35239a,_0x5d702d,_0x107bf7,_0x1828f0,_0x26f12d);})['then'](function(_0x17aaac){if(_0x17aaac){logger[_0x81a3('0xb')]('The\x20Ticket\x20ID\x20is:',_0x17aaac['id']);switch(_0x35239a[_0x81a3('0x3b')]){case'integrationTab':logger[_0x81a3('0xb')](_0x81a3('0x54'),_0x81a3('0x55'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x35239a['remoteUri'],_0x5d702d['id'],_0x17aaac['id']),'method':_0x81a3('0x2d')});case _0x81a3('0x56'):logger['info'](_0x81a3('0x54'),_0x81a3('0x57'));emit(util[_0x81a3('0xd')]('user:%s',_0x29c857[_0x81a3('0x12')]),_0x81a3('0x58'),{'uri':util[_0x81a3('0xd')](_0x81a3('0x59'),_0x35239a[_0x81a3('0xf')][_0x81a3('0x5a')](_0x81a3('0x5b'),''),_0x17aaac['id'])});break;default:logger[_0x81a3('0x5c')](_0x81a3('0x54'),_0x81a3('0x5d'));}}})[_0x81a3('0x5e')](function(_0x3fabf2){logger[_0x81a3('0x5c')](_0x81a3('0x5f'),util[_0x81a3('0x60')](_0x3fabf2,{'showHidden':!![],'depth':null}));});};exports[_0x81a3('0x61')]=function(_0xf242ce,_0x247a6b,_0x1b4962,_0x57bfc4,_0x5cf29d,_0x3bb4b2,_0x49fcf9){var _0x459b6d,_0x2d9377;_0x3bb4b2[_0x81a3('0xf')]=intUtil[_0x81a3('0x48')](_0x3bb4b2[_0x81a3('0xf')]);_0x3bb4b2[_0x81a3('0x49')]=intUtil[_0x81a3('0x48')](_0x3bb4b2['serverUrl']);if(_0x49fcf9&&_0x49fcf9['recordingFormat']&&_0x49fcf9[_0x81a3('0x62')]!=='none'){logger['info'](_0x81a3('0x63'),_0x81a3('0x4b'));_0x247a6b[_0x81a3('0x4c')]=util['format'](_0x81a3('0x4d'),_0x3bb4b2[_0x81a3('0x49')],_0x247a6b[_0x81a3('0x4e')],md5(_0x247a6b[_0x81a3('0x4e')]));}headers[_0x81a3('0x4f')]=getAuth(_0x3bb4b2);return getUser(_0x3bb4b2,_0x57bfc4[_0x81a3('0x50')])['then'](function(_0x38f3af){_0x459b6d=_0x38f3af;logger[_0x81a3('0xb')](_0x81a3('0x51'),_0x459b6d['id']);return getEndUser(_0x3bb4b2,_0x247a6b[_0x81a3('0x64')],_0x247a6b[_0x81a3('0x65')]);})[_0x81a3('0x17')](function(_0x23b383){_0x2d9377=_0x23b383;logger['info'](_0x81a3('0x53'),_0x2d9377['id']);return getTicket(_0x3bb4b2,_0x459b6d,_0x2d9377,_0x1b4962,_0x247a6b);})['then'](function(_0x39fe5f){if(_0x39fe5f){logger['info'](_0x81a3('0x66'),_0x39fe5f['id']);switch(_0x3bb4b2[_0x81a3('0x3b')]){case _0x81a3('0x67'):logger[_0x81a3('0xb')](_0x81a3('0x63'),_0x81a3('0x55'));return request({'uri':util[_0x81a3('0xd')](_0x81a3('0x68'),_0x3bb4b2[_0x81a3('0xf')],_0x459b6d['id'],_0x39fe5f['id']),'method':'POST'});case _0x81a3('0x56'):logger[_0x81a3('0xb')](_0x81a3('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x57bfc4[_0x81a3('0x12')]),'trigger:browser:url',{'uri':util[_0x81a3('0xd')](_0x81a3('0x59'),_0x3bb4b2[_0x81a3('0xf')]['replace']('/api/v2',''),_0x39fe5f['id'])});break;default:logger[_0x81a3('0x5c')]('[OUTBOUND]',_0x81a3('0x5d'));}}})['catch'](function(_0xc096bc){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xc096bc,{'showHidden':!![],'depth':null}));});};exports[_0x81a3('0x69')]=function(_0x32055d,_0x3dce7d,_0x2ae5c9,_0x2dd9b6,_0x4b7d4d,_0x3fbfe8){var _0x55f84c,_0x5cdc9b;_0x3fbfe8[_0x81a3('0xf')]=intUtil['stripTrailingSlash'](_0x3fbfe8[_0x81a3('0xf')]);_0x3fbfe8[_0x81a3('0x49')]=intUtil[_0x81a3('0x48')](_0x3fbfe8[_0x81a3('0x49')]);if(_0x4b7d4d&&_0x4b7d4d[_0x81a3('0x4a')]){logger[_0x81a3('0xb')]('['+_0x3dce7d[_0x81a3('0x6a')][_0x81a3('0x6b')]()+']',_0x81a3('0x4b'));_0x3dce7d['recordingURL']=util[_0x81a3('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3fbfe8[_0x81a3('0x49')],_0x3dce7d[_0x81a3('0x4e')],md5(_0x3dce7d[_0x81a3('0x4e')]));}else{_0x3dce7d[_0x81a3('0x4c')]='';}headers[_0x81a3('0x4f')]=getAuth(_0x3fbfe8);return getUser(_0x3fbfe8)[_0x81a3('0x17')](function(_0x4d4389){_0x55f84c=_0x4d4389;logger[_0x81a3('0xb')]('The\x20User\x20ID\x20is:',_0x55f84c['id']);return getEndUser(_0x3fbfe8,_0x3dce7d[_0x81a3('0x6c')],_0x3dce7d[_0x81a3('0x52')]);})[_0x81a3('0x17')](function(_0x1464e1){_0x5cdc9b=_0x1464e1;logger[_0x81a3('0xb')](_0x81a3('0x53'),_0x5cdc9b['id']);return getTicket(_0x3fbfe8,_0x55f84c,_0x5cdc9b,_0x2ae5c9,_0x3dce7d);})[_0x81a3('0x17')](function(_0x4784eb){if(_0x4784eb){logger['info']('The\x20Ticket\x20ID\x20is:',_0x4784eb['id']);}})[_0x81a3('0x5e')](function(_0x23784c){logger[_0x81a3('0x5c')]('['+_0x3dce7d['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x23784c,{'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 8515d8b..b2e066e 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 _0xfb89=['refresh_token','then','add','catch','error','stack','info','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','/crm/v2/','role','first_name','last_name','data','SUCCESS','enduserType','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','https://www.zohoapis.','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Inbound','merge','/crm/v2/Calls','Call\x20created!','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','toUpperCase','calleridname','md5','./util','moment','ioredis','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','stringify','forEach','string','picklist','type','idField','variable','variableName','toString','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId'];(function(_0x3c86dc,_0x5d22fc){var _0x4aeb79=function(_0x29d7c8){while(--_0x29d7c8){_0x3c86dc['push'](_0x3c86dc['shift']());}};_0x4aeb79(++_0x5d22fc);}(_0xfb89,0x196));var _0x9fb8=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xfb89[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x9fb8('0x0'));var util=require('util');var intUtil=require(_0x9fb8('0x1'));var moment=require(_0x9fb8('0x2'));var Redis=require(_0x9fb8('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x9fb8('0x4'))(_0x9fb8('0x5'));config[_0x9fb8('0x6')]=_['defaults'](config[_0x9fb8('0x6')],{'host':_0x9fb8('0x7'),'port':0x18eb});var io=require(_0x9fb8('0x8'))(new Redis(config[_0x9fb8('0x6')]));function emit(_0xf1373d,_0x5cc1b1,_0x38bc2c){io['to'](_0xf1373d)[_0x9fb8('0x9')](_0x5cc1b1,_0x38bc2c);}function request(_0x1a48e8){logger[_0x9fb8('0xa')]('[HTTP]',JSON[_0x9fb8('0xb')](_0x1a48e8));return rp(_0x1a48e8);}function getCustomFields(_0x5f19dd,_0x1acaae){var _0x2de7c0={};if(_0x5f19dd['length']>0x0){_[_0x9fb8('0xc')](_0x5f19dd,function(_0x4483a4){if(_['includes']([_0x9fb8('0xd'),_0x9fb8('0xe')],_0x4483a4[_0x9fb8('0xf')])&&_0x4483a4['idField']){_0x2de7c0[_0x4483a4[_0x9fb8('0x10')]]=_0x4483a4['content']['toString']();}else if(_0x4483a4[_0x9fb8('0xf')]===_0x9fb8('0x11')&&_0x4483a4[_0x9fb8('0x12')]&&_0x4483a4[_0x9fb8('0x10')]&&_0x1acaae[_0x4483a4[_0x9fb8('0x12')]]){_0x2de7c0[_0x4483a4[_0x9fb8('0x10')]]=_0x1acaae[_0x4483a4[_0x9fb8('0x12')]][_0x9fb8('0x13')]();}else if(_0x4483a4[_0x9fb8('0xf')]===_0x9fb8('0x14')&&_0x4483a4[_0x9fb8('0x15')]&&_0x4483a4[_0x9fb8('0x15')]['name']&&_0x4483a4[_0x9fb8('0x10')]&&_0x1acaae[_0x4483a4[_0x9fb8('0x15')]['name'][_0x9fb8('0x16')]()]){_0x2de7c0[_0x4483a4[_0x9fb8('0x10')]]=_0x1acaae[_0x4483a4[_0x9fb8('0x15')][_0x9fb8('0x17')][_0x9fb8('0x16')]()]['toString']();}});}return _0x2de7c0;}function getName(_0x199732){if(_0x199732[_0x9fb8('0x18')]('\x20')>0x0){var _0x3d2318=_0x199732[_0x9fb8('0x19')](/ (.+)/);if(_0x3d2318[0x1]){return _0x3d2318;}}return[_0x199732,_0x199732];}var accountsTokens={};function getAccessToken(_0x3ce10c){return new Promise(function(_0x1da262,_0x19b87e){if(!_[_0x9fb8('0x1a')](accountsTokens[_0x3ce10c['id']])&&!_[_0x9fb8('0x1a')](accountsTokens[_0x3ce10c['id']][_0x9fb8('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x3ce10c['id']]['expires_in'])){_0x1da262(accountsTokens[_0x3ce10c['id']]['access_token']);}}var _0x5e19ab;switch(_0x3ce10c[_0x9fb8('0x1c')]){case'US':_0x5e19ab=_0x9fb8('0x1d');break;case'AU':_0x5e19ab=_0x9fb8('0x1e');break;case'EU':_0x5e19ab=_0x9fb8('0x1f');break;case'IN':_0x5e19ab=_0x9fb8('0x20');break;case'CN':_0x5e19ab=_0x9fb8('0x21');break;default:_0x5e19ab=_0x9fb8('0x1f');break;}var _0x30d748={'method':_0x9fb8('0x22'),'uri':_0x5e19ab+_0x9fb8('0x23'),'qs':{'refresh_token':_0x3ce10c[_0x9fb8('0x24')],'client_id':_0x3ce10c[_0x9fb8('0x25')],'client_secret':_0x3ce10c['clientSecret'],'grant_type':_0x9fb8('0x26')},'json':!![]};return rp(_0x30d748)[_0x9fb8('0x27')](function(_0xf717bf){accountsTokens[_0x3ce10c['id']]={'access_token':_0xf717bf['access_token'],'expires_in':moment()[_0x9fb8('0x28')](_0xf717bf['expires_in'],'seconds')};_0x1da262(_0xf717bf[_0x9fb8('0x1b')]);})[_0x9fb8('0x29')](function(_0x335e02){logger[_0x9fb8('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x335e02[_0x9fb8('0x2b')]);_0x19b87e(_0x335e02);});});}function getUser(_0x144b5f,_0x38c29c,_0x236f5c,_0x5dd6b9){logger[_0x9fb8('0x2c')]('Search\x20user');return request({'method':'GET','uri':util[_0x9fb8('0x2d')](_0x9fb8('0x2e'),_0x38c29c),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x9fb8('0x2f')+_0x144b5f},'json':!![]})[_0x9fb8('0x27')](function(_0x56a442){if(_0x56a442['users']){var _0x2388f4=-0x1;if(_[_0x9fb8('0x30')](_0x56a442[_0x9fb8('0x31')])){if(!_[_0x9fb8('0x1a')](_0x5dd6b9)){_0x2388f4=_[_0x9fb8('0x32')](_0x56a442['users'],function(_0x49777d){return _0x49777d[_0x9fb8('0x33')]===_0x5dd6b9;});}if(_0x2388f4>=0x0){logger[_0x9fb8('0x2c')]('Agent\x20found!');}else{logger[_0x9fb8('0x2c')](_0x9fb8('0x34'));_0x2388f4=_[_0x9fb8('0x32')](_0x56a442['users'],function(_0x350044){return _0x350044['profile'][_0x9fb8('0x17')]==='Administrator';});}return _0x56a442[_0x9fb8('0x31')][_0x2388f4];}else{if(_0x56a442[_0x9fb8('0x35')]['profile'][_0x9fb8('0x17')]==='Administrator'){logger[_0x9fb8('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x56a442[_0x9fb8('0x35')];return user;}else{logger[_0x9fb8('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x9fb8('0xb')](_0x56a442));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x9fb8('0xb')](_0x56a442));}}}else{logger['error'](_0x9fb8('0x36'),JSON['stringify'](_0x56a442));throw new Error(_0x9fb8('0x37')+JSON[_0x9fb8('0xb')](_0x56a442));}})[_0x9fb8('0x29')](function(_0x33403c){console['error'](_0x33403c);});}function getZohoUser(_0x42482b,_0x1ac62b){return new BPromise(function(_0xbc8f6c,_0x582ca4){request(_0x42482b)[_0x9fb8('0x27')](function(_0x133550){var _0x4ab68a=null;if(_0x133550){_0x4ab68a=_0x133550['data'][0x0];_0x4ab68a['enduserType']=_0x1ac62b;}_0xbc8f6c(_0x4ab68a);})['catch'](function(_0x409002){_0x582ca4(_0x409002);});});}function createEndUser(_0x199b23,_0x1f9aac,_0x2c71d8,_0x1e6922,_0xbf48e9,_0x366e3e){var _0x2c71d8=getName(_0x2c71d8);return request({'method':_0x9fb8('0x22'),'uri':'https://www.zohoapis.'+_0x1f9aac+_0x9fb8('0x38')+_['startCase'](_0x366e3e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x2c71d8[0x1],'First_Name':_0x2c71d8[0x0],'Phone':_0x1e6922,'Owner':{'name':!_[_0x9fb8('0x1a')](_0xbf48e9['role'][_0x9fb8('0x17')])?_0xbf48e9[_0x9fb8('0x39')]['name']:!_['isNil'](_0xbf48e9[_0x9fb8('0x3a')])?_0xbf48e9[_0x9fb8('0x3a')]+'\x20'+_0xbf48e9[_0x9fb8('0x3b')]:_0xbf48e9['last_name'],'id':_0xbf48e9['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x199b23},'json':!![]})['then'](function(_0x3ad2df){if(_0x3ad2df&&_0x3ad2df[_0x9fb8('0x3c')][0x0]['code']===_0x9fb8('0x3d')){var _0xe72ca0=_0x3ad2df['data'][0x0]['details'];_0xe72ca0[_0x9fb8('0x3e')]=_[_0x9fb8('0x3f')](_0x366e3e[_0x9fb8('0x40')])+'s';return _0xe72ca0;}logger[_0x9fb8('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x9fb8('0xb')](data));throw new Error(_0x9fb8('0x41')+JSON[_0x9fb8('0xb')](data));})['catch'](function(_0x1c0315){console[_0x9fb8('0x42')](_0x9fb8('0x43'),_0x1c0315);});}function getEndUser(_0x21ae38,_0x4f8b58,_0x9f8ea6,_0x572b31,_0xbf2619,_0x515e06,_0x54e87c){var _0x1f6740={'method':_0x9fb8('0x44'),'uri':'','headers':{'Authorization':_0x9fb8('0x2f')+_0x21ae38},'json':!![]};switch(_0x54e87c[_0x9fb8('0x45')]){case _0x9fb8('0x46'):_0x1f6740[_0x9fb8('0x47')]='https://www.zohoapis.'+_0x4f8b58+_0x9fb8('0x48')+_0xbf2619+'))';return getZohoUser(_0x1f6740,_0x9fb8('0x49'))[_0x9fb8('0x27')](function(_0x257a31){if(_0x257a31)return _0x257a31;_0x1f6740['uri']='https://www.zohoapis.'+_0x4f8b58+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xbf2619+'))';return getZohoUser(_0x1f6740,'Leads')[_0x9fb8('0x27')](function(_0x2e9f6b){if(_0x2e9f6b)return _0x2e9f6b;if(_0x54e87c['moduleCreate']!=_0x9fb8('0x4a')){return createEndUser(_0x21ae38,_0x4f8b58,_0x572b31,_0xbf2619,_0x515e06,_0x54e87c);}else{return{};}});});break;case _0x9fb8('0x4b'):_0x1f6740[_0x9fb8('0x47')]=_0x9fb8('0x4c')+_0x4f8b58+_0x9fb8('0x48')+_0xbf2619+'))';return getZohoUser(_0x1f6740,'Contacts')['then'](function(_0x433022){if(_0x433022)return _0x433022;if(_0x54e87c[_0x9fb8('0x40')]!=_0x9fb8('0x4a')){return createEndUser(_0x21ae38,_0x4f8b58,_0x572b31,_0xbf2619,_0x515e06,_0x54e87c);}else{return{};}});break;case _0x9fb8('0x4d'):_0x1f6740['uri']=_0x9fb8('0x4c')+_0x4f8b58+_0x9fb8('0x4e')+_0xbf2619+'))';return getZohoUser(_0x1f6740,_0x9fb8('0x4f'))['then'](function(_0x5a5dce){if(_0x5a5dce)return _0x5a5dce;if(_0x54e87c[_0x9fb8('0x40')]!=_0x9fb8('0x4a')){return createEndUser(_0x21ae38,_0x4f8b58,_0x572b31,_0xbf2619,_0x515e06,_0x54e87c);}else{return{};}});break;}}function getCall(_0x4f6c18,_0x9f6efc,_0x321efb,_0x136ab5,_0x3280ce,_0x53065a,_0x35a18e,_0x4a59ba){logger[_0x9fb8('0x2c')](_0x9fb8('0x50'));var _0x975d3c={};_0x975d3c[_0x9fb8('0x51')]={'name':!_['isNil'](_0x136ab5['role'][_0x9fb8('0x17')])&&!_[_0x9fb8('0x1a')](_0x136ab5[_0x9fb8('0x52')]['name'])&&_0x136ab5['profile']['name']===_0x9fb8('0x53')?_0x136ab5['role']['name']:!_[_0x9fb8('0x1a')](_0x136ab5[_0x9fb8('0x3a')])?_0x136ab5[_0x9fb8('0x3a')]+'\x20'+_0x136ab5[_0x9fb8('0x3b')]:_0x136ab5[_0x9fb8('0x3b')],'id':_0x136ab5['id']};_0x975d3c[_0x9fb8('0x54')]=intUtil[_0x9fb8('0x55')](_0x53065a['Subjects'],_0x35a18e,'\x20');_0x975d3c[_0x9fb8('0x56')]=intUtil['getString'](_0x53065a[_0x9fb8('0x57')],_0x35a18e,'\x0a');if(_0x3280ce[_0x9fb8('0x3e')]===_0x9fb8('0x49')){_0x975d3c[_0x9fb8('0x58')]={'name':!_[_0x9fb8('0x1a')](_0x3280ce[_0x9fb8('0x59')])?_0x3280ce[_0x9fb8('0x59')]:!_[_0x9fb8('0x1a')](_0x3280ce[_0x9fb8('0x5a')])?_0x3280ce[_0x9fb8('0x5a')]+'\x20'+_0x3280ce[_0x9fb8('0x5b')]:_0x3280ce['Last_Name'],'id':_0x3280ce['id']};}if(_0x3280ce[_0x9fb8('0x3e')]===_0x9fb8('0x4f')){_0x975d3c['What_Id']={'name':!_['isNil'](_0x3280ce[_0x9fb8('0x59')])?_0x3280ce[_0x9fb8('0x59')]:!_[_0x9fb8('0x1a')](_0x3280ce[_0x9fb8('0x5a')])?_0x3280ce['First_Name']+'\x20'+_0x3280ce['Last_Name']:_0x3280ce[_0x9fb8('0x5b')],'id':_0x3280ce['id']};_0x975d3c[_0x9fb8('0x5c')]=_[_0x9fb8('0x3f')](_0x3280ce[_0x9fb8('0x3e')]);}if(_0x35a18e[_0x9fb8('0x5d')]){_0x975d3c[_0x9fb8('0x5e')]=moment['utc'](parseInt(_0x35a18e[_0x9fb8('0x5d')])*0x3e8)[_0x9fb8('0x2d')](_0x9fb8('0x5f'));}else if(_0x35a18e[_0x9fb8('0x60')]&&_0x35a18e[_0x9fb8('0x61')]){_0x975d3c['Call_Duration']=moment['utc'](moment(_0x35a18e[_0x9fb8('0x61')],_0x9fb8('0x62'))[_0x9fb8('0x63')](moment(_0x35a18e['starttime'],_0x9fb8('0x62'))))[_0x9fb8('0x2d')](_0x9fb8('0x5f'));}switch(_0x35a18e[_0x9fb8('0x64')]){case _0x9fb8('0x65'):_0x975d3c[_0x9fb8('0x66')]='Called';break;case _0x9fb8('0x67'):case'connect':_0x975d3c[_0x9fb8('0x66')]=_0x9fb8('0x68');break;case _0x9fb8('0x69'):_0x975d3c['Call_Result']=_0x9fb8('0x6a');break;case _0x9fb8('0x6b'):_0x975d3c[_0x9fb8('0x66')]=_0x9fb8('0x6c');break;case _0x9fb8('0x6d'):_0x975d3c[_0x9fb8('0x66')]=_0x9fb8('0x6e');default:}_0x975d3c[_0x9fb8('0x6f')]=(_0x4a59ba===_0x9fb8('0x70')?moment(_0x35a18e[_0x9fb8('0x71')])[_0x9fb8('0x2d')](_0x9fb8('0x62')):moment(_0x35a18e[_0x9fb8('0x72')])['format'](_0x9fb8('0x62')))||moment()[_0x9fb8('0x2d')]('YYYY-MM-DDTHH:mm:ss');_0x975d3c['Call_Type']=_0x4a59ba||_0x9fb8('0x73');_0x975d3c=_[_0x9fb8('0x74')](_0x975d3c,getCustomFields(_0x53065a['Fields'],_0x35a18e));return request({'method':_0x9fb8('0x22'),'uri':'https://www.zohoapis.'+_0x9f6efc+_0x9fb8('0x75'),'headers':{'Authorization':_0x9fb8('0x2f')+_0x4f6c18},'body':{'data':[_0x975d3c]},'json':!![]})[_0x9fb8('0x27')](function(_0x52e027){if(_0x52e027&&_0x52e027['data'][0x0]['code']===_0x9fb8('0x3d')){logger[_0x9fb8('0x2c')](_0x9fb8('0x76'));return{'id':_0x52e027[_0x9fb8('0x3c')][0x0][_0x9fb8('0x77')]['id']};}})[_0x9fb8('0x29')](function(_0x4bda47){logger['info'](_0x9fb8('0x78'),_0x4bda47[_0x9fb8('0x2b')]);console[_0x9fb8('0x42')](_0x9fb8('0x78'),_0x4bda47);});}exports[_0x9fb8('0x79')]=function(_0x1af870,_0x322907,_0x3dc2f7,_0xfb85e1,_0x13fd30,_0x197003){var _0x518d13,_0x20e3b2,_0x546e47;_0x197003[_0x9fb8('0x7a')]=intUtil['stripTrailingSlash'](_0x197003['host']);_0x197003[_0x9fb8('0x7b')]=intUtil[_0x9fb8('0x7c')](_0x197003['serverUrl']);if(_0x13fd30&&_0x13fd30[_0x9fb8('0x7d')]){logger[_0x9fb8('0x2c')](_0x9fb8('0x7e'),_0x9fb8('0x7f'));_0x322907[_0x9fb8('0x80')]=_0x197003['serverUrl']+_0x9fb8('0x81')+_0x322907[_0x9fb8('0x82')]+_0x9fb8('0x83')+md5(_0x322907[_0x9fb8('0x82')]);}else{_0x322907[_0x9fb8('0x80')]='';}var _0x22d973=_0x197003[_0x9fb8('0x7a')]===_0x9fb8('0x84')?'eu':_0x9fb8('0x85');return getAccessToken(_0x197003)['then'](function(_0x3b52f7){_0x546e47=_0x3b52f7;return getUser(_0x546e47,_0x22d973,_0x197003,_0xfb85e1['email']);})[_0x9fb8('0x27')](function(_0x5946d0){_0x518d13=_0x5946d0;logger[_0x9fb8('0x2c')](_0x9fb8('0x86'),_0x518d13['id']);return getEndUser(_0x546e47,_0x22d973,_0x197003,_0x322907['calleridname'],_0x322907[_0x9fb8('0x87')],_0x518d13,_0x3dc2f7);})['then'](function(_0x116a01){_0x20e3b2=_0x116a01;return getCall(_0x546e47,_0x22d973,_0x197003,_0x518d13,_0x20e3b2,_0x3dc2f7,_0x322907,_0x9fb8('0x73'));})[_0x9fb8('0x27')](function(_0x16db7f){if(_0x16db7f){logger['info'](_0x9fb8('0x88'),_0x16db7f['id']);logger[_0x9fb8('0x2c')](_0x9fb8('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0xfb85e1[_0x9fb8('0x17')]),_0x9fb8('0x89'),{'uri':_0x9fb8('0x8a')+_0x197003[_0x9fb8('0x7a')]+_0x9fb8('0x8b')+_0x16db7f['id']});}})[_0x9fb8('0x29')](function(_0x33cdfe){logger[_0x9fb8('0x2a')](_0x9fb8('0x7e'),JSON[_0x9fb8('0xb')](_0x33cdfe));});};exports['outbound']=function(_0x518e45,_0x5d68f6,_0x655a1a,_0x582028,_0x37abb4,_0x378806,_0x52ded2){var _0x59567e,_0xe3b8c2,_0x1c9e09;_0x378806[_0x9fb8('0x7a')]=intUtil[_0x9fb8('0x7c')](_0x378806[_0x9fb8('0x7a')]);_0x378806[_0x9fb8('0x7b')]=intUtil[_0x9fb8('0x7c')](_0x378806[_0x9fb8('0x7b')]);if(_0x52ded2&&_0x52ded2[_0x9fb8('0x8c')]&&_0x52ded2[_0x9fb8('0x8c')]!==_0x9fb8('0x8d')){logger[_0x9fb8('0x2c')](_0x9fb8('0x8e'),_0x9fb8('0x7f'));_0x5d68f6[_0x9fb8('0x80')]=_0x378806[_0x9fb8('0x7b')]+'/api/voice/recordings/'+_0x5d68f6['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5d68f6[_0x9fb8('0x82')]);}var _0x296c7d=_0x378806[_0x9fb8('0x7a')]===_0x9fb8('0x84')?'eu':_0x9fb8('0x85');return getAccessToken(_0x378806)['then'](function(_0xf44f9b){_0x1c9e09=_0xf44f9b;return getUser(_0x1c9e09,_0x296c7d,_0x378806,_0x582028[_0x9fb8('0x33')]);})[_0x9fb8('0x27')](function(_0x369a25){_0x59567e=_0x369a25;logger[_0x9fb8('0x2c')](_0x9fb8('0x86'),_0x59567e['id']);return getEndUser(_0x1c9e09,_0x296c7d,_0x378806,_0x5d68f6[_0x9fb8('0x8f')],_0x5d68f6[_0x9fb8('0x90')],_0x59567e,_0x655a1a);})[_0x9fb8('0x27')](function(_0x11b2e4){_0xe3b8c2=_0x11b2e4;return getCall(_0x1c9e09,_0x296c7d,_0x378806,_0x59567e,_0xe3b8c2,_0x655a1a,_0x5d68f6,'Outbound');})[_0x9fb8('0x27')](function(_0x379d14){if(_0x379d14){logger[_0x9fb8('0x2c')](_0x9fb8('0x88'),_0x379d14['id']);logger[_0x9fb8('0x2c')](_0x9fb8('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9fb8('0x91'),_0x582028['name']),_0x9fb8('0x89'),{'uri':_0x9fb8('0x8a')+_0x378806[_0x9fb8('0x7a')]+_0x9fb8('0x8b')+_0x379d14['id']});}})[_0x9fb8('0x29')](function(_0x4b97e8){logger[_0x9fb8('0x2a')]('[OUTBOUND]',JSON[_0x9fb8('0xb')](_0x4b97e8));});};exports['unmanaged']=function(_0x4a35d6,_0xe13355,_0x283648,_0x4190c6,_0x51b950,_0x253442){var _0x21e06f,_0x56c545,_0xd8caf6;_0x253442[_0x9fb8('0x7a')]=intUtil[_0x9fb8('0x7c')](_0x253442['host']);_0x253442[_0x9fb8('0x7b')]=intUtil[_0x9fb8('0x7c')](_0x253442[_0x9fb8('0x7b')]);if(_0x51b950&&_0x51b950[_0x9fb8('0x7d')]){logger[_0x9fb8('0x2c')]('['+_0xe13355[_0x9fb8('0x64')][_0x9fb8('0x92')]()+']',_0x9fb8('0x7f'));_0xe13355[_0x9fb8('0x80')]=_0x253442[_0x9fb8('0x7b')]+'/api/voice/recordings/'+_0xe13355['uniqueid']+_0x9fb8('0x83')+md5(_0xe13355['uniqueid']);}else{_0xe13355[_0x9fb8('0x80')]='';}var _0x46b3a4=_0x253442[_0x9fb8('0x7a')]==='zoho.eu'?'eu':_0x9fb8('0x85');return getAccessToken(_0x253442)[_0x9fb8('0x27')](function(_0x3853ac){_0xd8caf6=_0x3853ac;return getUser(_0xd8caf6,_0x46b3a4,_0x253442);})[_0x9fb8('0x27')](function(_0x325b78){_0x21e06f=_0x325b78;logger[_0x9fb8('0x2c')](_0x9fb8('0x86'),_0x21e06f['id']);return getEndUser(_0xd8caf6,_0x46b3a4,_0x253442,_0xe13355[_0x9fb8('0x93')],_0xe13355[_0x9fb8('0x87')],_0x21e06f,_0x283648);})[_0x9fb8('0x27')](function(_0x19284a){_0x56c545=_0x19284a;return getCall(_0xd8caf6,_0x46b3a4,_0x253442,_0x21e06f,_0x56c545,_0x283648,_0xe13355,_0x9fb8('0x73'));})[_0x9fb8('0x27')](function(_0x59727d){if(_0x59727d){logger[_0x9fb8('0x2c')](_0x9fb8('0x88'),_0x59727d['id']);}})['catch'](function(_0x582fe7){logger[_0x9fb8('0x2a')]('['+_0xe13355[_0x9fb8('0x64')]['toUpperCase']()+']',JSON['stringify'](_0x582fe7));});}; \ No newline at end of file +var _0x80a7=['com','calleridname','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','Outbound','calleridnum','Inbound','The\x20Call\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','[HTTP]','length','forEach','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','format','lastevent','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu'];(function(_0x19ee3a,_0x1c597f){var _0x3d7d89=function(_0x59d619){while(--_0x59d619){_0x19ee3a['push'](_0x19ee3a['shift']());}};_0x3d7d89(++_0x1c597f);}(_0x80a7,0xae));var _0x780a=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x80a7[_0x128bef];return _0x1ba862;};'use strict';var _=require(_0x780a('0x0'));var rp=require(_0x780a('0x1'));var md5=require(_0x780a('0x2'));var util=require('util');var intUtil=require(_0x780a('0x3'));var moment=require(_0x780a('0x4'));var Redis=require('ioredis');var BPromise=require(_0x780a('0x5'));var config=require('../../../../config/environment');var logger=require(_0x780a('0x6'))(_0x780a('0x7'));config[_0x780a('0x8')]=_[_0x780a('0x9')](config[_0x780a('0x8')],{'host':_0x780a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x780a('0x8')]));function emit(_0x46e516,_0x3d01b2,_0x2252a4){io['to'](_0x46e516)[_0x780a('0xb')](_0x3d01b2,_0x2252a4);}function request(_0x3c1e23){logger['debug'](_0x780a('0xc'),JSON['stringify'](_0x3c1e23));return rp(_0x3c1e23);}function getCustomFields(_0x5b662a,_0x14ff8f){var _0x39b69d={};if(_0x5b662a[_0x780a('0xd')]>0x0){_[_0x780a('0xe')](_0x5b662a,function(_0x2361c6){if(_['includes']([_0x780a('0xf'),_0x780a('0x10')],_0x2361c6['type'])&&_0x2361c6[_0x780a('0x11')]){_0x39b69d[_0x2361c6['idField']]=_0x2361c6[_0x780a('0x12')][_0x780a('0x13')]();}else if(_0x2361c6[_0x780a('0x14')]===_0x780a('0x15')&&_0x2361c6[_0x780a('0x16')]&&_0x2361c6[_0x780a('0x11')]&&_0x14ff8f[_0x2361c6[_0x780a('0x16')]]){_0x39b69d[_0x2361c6['idField']]=_0x14ff8f[_0x2361c6[_0x780a('0x16')]][_0x780a('0x13')]();}else if(_0x2361c6[_0x780a('0x14')]===_0x780a('0x17')&&_0x2361c6[_0x780a('0x18')]&&_0x2361c6['Variable']['name']&&_0x2361c6[_0x780a('0x11')]&&_0x14ff8f[_0x2361c6['Variable']['name']['toLowerCase']()]){_0x39b69d[_0x2361c6['idField']]=_0x14ff8f[_0x2361c6[_0x780a('0x18')][_0x780a('0x19')][_0x780a('0x1a')]()][_0x780a('0x13')]();}});}return _0x39b69d;}function getName(_0x31c966){if(_0x31c966[_0x780a('0x1b')]('\x20')>0x0){var _0x551736=_0x31c966['split'](/ (.+)/);if(_0x551736[0x1]){return _0x551736;}}return[_0x31c966,_0x31c966];}var accountsTokens={};function getAccessToken(_0x9f1967){return new Promise(function(_0x19dae3,_0x471de2){if(!_[_0x780a('0x1c')](accountsTokens[_0x9f1967['id']])&&!_[_0x780a('0x1c')](accountsTokens[_0x9f1967['id']]['access_token'])){if(moment()[_0x780a('0x1d')](accountsTokens[_0x9f1967['id']][_0x780a('0x1e')])){_0x19dae3(accountsTokens[_0x9f1967['id']][_0x780a('0x1f')]);}}var _0x32ff49;switch(_0x9f1967[_0x780a('0x20')]){case'US':_0x32ff49=_0x780a('0x21');break;case'AU':_0x32ff49='https://accounts.zoho.com.au';break;case'EU':_0x32ff49='https://accounts.zoho.eu';break;case'IN':_0x32ff49=_0x780a('0x22');break;case'CN':_0x32ff49=_0x780a('0x23');break;default:_0x32ff49=_0x780a('0x24');break;}var _0x1cf194={'method':'POST','uri':_0x32ff49+_0x780a('0x25'),'qs':{'refresh_token':_0x9f1967['refreshToken'],'client_id':_0x9f1967[_0x780a('0x26')],'client_secret':_0x9f1967[_0x780a('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1cf194)[_0x780a('0x28')](function(_0x4959d2){accountsTokens[_0x9f1967['id']]={'access_token':_0x4959d2[_0x780a('0x1f')],'expires_in':moment()[_0x780a('0x29')](_0x4959d2[_0x780a('0x1e')],_0x780a('0x2a'))};_0x19dae3(_0x4959d2[_0x780a('0x1f')]);})[_0x780a('0x2b')](function(_0x384d86){logger[_0x780a('0x2c')](_0x780a('0x2d'),_0x384d86['stack']);_0x471de2(_0x384d86);});});}function getUser(_0x365d0f,_0x55af6b,_0x442ff3,_0x28f220){logger[_0x780a('0x2e')](_0x780a('0x2f'));return request({'method':_0x780a('0x30'),'uri':util['format'](_0x780a('0x31'),_0x55af6b),'qs':{'type':_0x780a('0x32')},'headers':{'Authorization':_0x780a('0x33')+_0x365d0f},'json':!![]})[_0x780a('0x28')](function(_0x475a88){if(_0x475a88[_0x780a('0x34')]){var _0x5373f8=-0x1;if(_[_0x780a('0x35')](_0x475a88[_0x780a('0x34')])){if(!_[_0x780a('0x1c')](_0x28f220)){_0x5373f8=_[_0x780a('0x36')](_0x475a88[_0x780a('0x34')],function(_0x209422){return _0x209422[_0x780a('0x37')]===_0x28f220;});}if(_0x5373f8>=0x0){logger[_0x780a('0x2e')]('Agent\x20found!');}else{logger[_0x780a('0x2e')](_0x780a('0x38'));_0x5373f8=_['findIndex'](_0x475a88[_0x780a('0x34')],function(_0x2f25ba){return _0x2f25ba[_0x780a('0x39')][_0x780a('0x19')]===_0x780a('0x3a');});}return _0x475a88[_0x780a('0x34')][_0x5373f8];}else{if(_0x475a88[_0x780a('0x3b')]['profile'][_0x780a('0x19')]===_0x780a('0x3a')){logger[_0x780a('0x2e')](_0x780a('0x38'));user=_0x475a88[_0x780a('0x3b')];return user;}else{logger[_0x780a('0x2c')](_0x780a('0x3c'),JSON['stringify'](_0x475a88));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x780a('0x3d')](_0x475a88));}}}else{logger[_0x780a('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x780a('0x3d')](_0x475a88));throw new Error(_0x780a('0x3e')+JSON['stringify'](_0x475a88));}})['catch'](function(_0x4f7a20){console['error'](_0x4f7a20);});}function getZohoUser(_0x11dc0f,_0x2c9fbb){return new BPromise(function(_0x20bc4f,_0x15e5f8){request(_0x11dc0f)[_0x780a('0x28')](function(_0x5f1078){var _0x28542a=null;if(_0x5f1078){_0x28542a=_0x5f1078[_0x780a('0x3f')][0x0];_0x28542a[_0x780a('0x40')]=_0x2c9fbb;}_0x20bc4f(_0x28542a);})[_0x780a('0x2b')](function(_0x4f6347){_0x15e5f8(_0x4f6347);});});}function createEndUser(_0x49db22,_0xf1f254,_0x16da0f,_0x2ff56a,_0x51fcba,_0x4825fa){var _0x16da0f=getName(_0x16da0f);return request({'method':_0x780a('0x41'),'uri':_0x780a('0x42')+_0xf1f254+'/crm/v2/'+_['startCase'](_0x4825fa[_0x780a('0x43')])+'s','body':{'data':[{'Last_Name':_0x16da0f[0x1],'First_Name':_0x16da0f[0x0],'Phone':_0x2ff56a,'Owner':{'name':!_['isNil'](_0x51fcba[_0x780a('0x44')][_0x780a('0x19')])?_0x51fcba[_0x780a('0x44')][_0x780a('0x19')]:!_[_0x780a('0x1c')](_0x51fcba[_0x780a('0x45')])?_0x51fcba[_0x780a('0x45')]+'\x20'+_0x51fcba['last_name']:_0x51fcba[_0x780a('0x46')],'id':_0x51fcba['id']}}]},'headers':{'Authorization':_0x780a('0x33')+_0x49db22},'json':!![]})['then'](function(_0x332cd0){if(_0x332cd0&&_0x332cd0[_0x780a('0x3f')][0x0][_0x780a('0x47')]===_0x780a('0x48')){var _0xa2e343=_0x332cd0['data'][0x0][_0x780a('0x49')];_0xa2e343[_0x780a('0x40')]=_[_0x780a('0x4a')](_0x4825fa[_0x780a('0x43')])+'s';return _0xa2e343;}logger['error'](_0x780a('0x3c'),JSON[_0x780a('0x3d')](data));throw new Error(_0x780a('0x4b')+JSON['stringify'](data));})[_0x780a('0x2b')](function(_0x29cdf9){console['log'](_0x780a('0x4c'),_0x29cdf9);});}function getEndUser(_0x388f9d,_0x32691b,_0x1bc3a1,_0x58c27d,_0x2ba923,_0x2de901,_0x4b4a11){var _0x5ceb1f={'method':_0x780a('0x30'),'uri':'','headers':{'Authorization':_0x780a('0x33')+_0x388f9d},'json':!![]};switch(_0x4b4a11[_0x780a('0x4d')]){case'contact_lead':_0x5ceb1f[_0x780a('0x4e')]=_0x780a('0x42')+_0x32691b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2ba923+'))';return getZohoUser(_0x5ceb1f,_0x780a('0x4f'))[_0x780a('0x28')](function(_0x526125){if(_0x526125)return _0x526125;_0x5ceb1f[_0x780a('0x4e')]=_0x780a('0x42')+_0x32691b+_0x780a('0x50')+_0x2ba923+'))';return getZohoUser(_0x5ceb1f,_0x780a('0x51'))[_0x780a('0x28')](function(_0x3156f1){if(_0x3156f1)return _0x3156f1;if(_0x4b4a11[_0x780a('0x43')]!=_0x780a('0x52')){return createEndUser(_0x388f9d,_0x32691b,_0x58c27d,_0x2ba923,_0x2de901,_0x4b4a11);}else{return{};}});});break;case _0x780a('0x53'):_0x5ceb1f['uri']=_0x780a('0x42')+_0x32691b+_0x780a('0x54')+_0x2ba923+'))';return getZohoUser(_0x5ceb1f,_0x780a('0x4f'))[_0x780a('0x28')](function(_0x1dc122){if(_0x1dc122)return _0x1dc122;if(_0x4b4a11[_0x780a('0x43')]!=_0x780a('0x52')){return createEndUser(_0x388f9d,_0x32691b,_0x58c27d,_0x2ba923,_0x2de901,_0x4b4a11);}else{return{};}});break;case _0x780a('0x55'):_0x5ceb1f['uri']=_0x780a('0x42')+_0x32691b+_0x780a('0x50')+_0x2ba923+'))';return getZohoUser(_0x5ceb1f,_0x780a('0x51'))[_0x780a('0x28')](function(_0x4ae274){if(_0x4ae274)return _0x4ae274;if(_0x4b4a11['moduleCreate']!='nothing'){return createEndUser(_0x388f9d,_0x32691b,_0x58c27d,_0x2ba923,_0x2de901,_0x4b4a11);}else{return{};}});break;}}function getCall(_0x255cdb,_0x201273,_0xfaeb22,_0x32292c,_0x551cf7,_0x156041,_0x308409,_0x4fdbda){logger[_0x780a('0x2e')](_0x780a('0x56'));var _0x16804d={};_0x16804d[_0x780a('0x57')]={'name':!_['isNil'](_0x32292c[_0x780a('0x44')][_0x780a('0x19')])&&!_[_0x780a('0x1c')](_0x32292c['profile']['name'])&&_0x32292c[_0x780a('0x39')][_0x780a('0x19')]==='administrator'?_0x32292c['role'][_0x780a('0x19')]:!_['isNil'](_0x32292c[_0x780a('0x45')])?_0x32292c['first_name']+'\x20'+_0x32292c[_0x780a('0x46')]:_0x32292c[_0x780a('0x46')],'id':_0x32292c['id']};_0x16804d[_0x780a('0x58')]=intUtil[_0x780a('0x59')](_0x156041[_0x780a('0x5a')],_0x308409,'\x20');_0x16804d[_0x780a('0x5b')]=intUtil[_0x780a('0x59')](_0x156041['Descriptions'],_0x308409,'\x0a');if(_0x551cf7[_0x780a('0x40')]==='Contacts'){_0x16804d[_0x780a('0x5c')]={'name':!_['isNil'](_0x551cf7[_0x780a('0x5d')])?_0x551cf7[_0x780a('0x5d')]:!_[_0x780a('0x1c')](_0x551cf7[_0x780a('0x5e')])?_0x551cf7[_0x780a('0x5e')]+'\x20'+_0x551cf7[_0x780a('0x5f')]:_0x551cf7[_0x780a('0x5f')],'id':_0x551cf7['id']};}if(_0x551cf7[_0x780a('0x40')]===_0x780a('0x51')){_0x16804d['What_Id']={'name':!_[_0x780a('0x1c')](_0x551cf7[_0x780a('0x5d')])?_0x551cf7[_0x780a('0x5d')]:!_['isNil'](_0x551cf7[_0x780a('0x5e')])?_0x551cf7[_0x780a('0x5e')]+'\x20'+_0x551cf7['Last_Name']:_0x551cf7[_0x780a('0x5f')],'id':_0x551cf7['id']};_0x16804d[_0x780a('0x60')]=_[_0x780a('0x4a')](_0x551cf7[_0x780a('0x40')]);}if(_0x308409[_0x780a('0x61')]){_0x16804d[_0x780a('0x62')]=moment[_0x780a('0x63')](parseInt(_0x308409[_0x780a('0x61')])*0x3e8)['format'](_0x780a('0x64'));}else if(_0x308409['answertime']&&_0x308409[_0x780a('0x65')]){_0x16804d[_0x780a('0x62')]=moment[_0x780a('0x63')](moment(_0x308409[_0x780a('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x780a('0x66')](moment(_0x308409[_0x780a('0x67')],_0x780a('0x68'))))[_0x780a('0x69')](_0x780a('0x64'));}switch(_0x308409[_0x780a('0x6a')]){case'called':_0x16804d[_0x780a('0x6b')]=_0x780a('0x6c');break;case'complete':case _0x780a('0x6d'):_0x16804d['Call_Result']=_0x780a('0x6e');break;case _0x780a('0x6f'):_0x16804d['Call_Result']=_0x780a('0x70');break;case _0x780a('0x71'):_0x16804d[_0x780a('0x6b')]=_0x780a('0x72');break;case _0x780a('0x73'):_0x16804d[_0x780a('0x6b')]=_0x780a('0x74');default:}_0x16804d[_0x780a('0x75')]=(_0x4fdbda===_0x780a('0x76')?moment(_0x308409[_0x780a('0x67')])[_0x780a('0x69')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x308409[_0x780a('0x77')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x780a('0x69')](_0x780a('0x68'));_0x16804d['Call_Type']=_0x4fdbda||'Inbound';_0x16804d=_[_0x780a('0x78')](_0x16804d,getCustomFields(_0x156041[_0x780a('0x79')],_0x308409));return request({'method':_0x780a('0x41'),'uri':_0x780a('0x42')+_0x201273+_0x780a('0x7a'),'headers':{'Authorization':_0x780a('0x33')+_0x255cdb},'body':{'data':[_0x16804d]},'json':!![]})[_0x780a('0x28')](function(_0x4b17ab){if(_0x4b17ab&&_0x4b17ab[_0x780a('0x3f')][0x0]['code']==='SUCCESS'){logger[_0x780a('0x2e')](_0x780a('0x7b'));return{'id':_0x4b17ab[_0x780a('0x3f')][0x0][_0x780a('0x49')]['id']};}})['catch'](function(_0x55d409){logger['info'](_0x780a('0x7c'),_0x55d409[_0x780a('0x7d')]);console['log'](_0x780a('0x7c'),_0x55d409);});}exports[_0x780a('0x7e')]=function(_0x53e452,_0xa294a5,_0x16e915,_0x470796,_0xdcb132,_0x4c810e){var _0x5f0bf9,_0x3c0433,_0x2f9085;_0x4c810e[_0x780a('0x7f')]=intUtil['stripTrailingSlash'](_0x4c810e['host']);_0x4c810e[_0x780a('0x80')]=intUtil[_0x780a('0x81')](_0x4c810e['serverUrl']);if(_0xdcb132&&_0xdcb132[_0x780a('0x82')]){logger['info']('[QUEUE]',_0x780a('0x83'));_0xa294a5[_0x780a('0x84')]=_0x4c810e['serverUrl']+_0x780a('0x85')+_0xa294a5[_0x780a('0x86')]+'/downloads?type=uniqueid&token='+md5(_0xa294a5[_0x780a('0x86')]);}else{_0xa294a5[_0x780a('0x84')]='';}var _0x29f69f=_0x4c810e[_0x780a('0x7f')]===_0x780a('0x87')?'eu':_0x780a('0x88');return getAccessToken(_0x4c810e)[_0x780a('0x28')](function(_0x254b10){_0x2f9085=_0x254b10;return getUser(_0x2f9085,_0x29f69f,_0x4c810e,_0x470796[_0x780a('0x37')]);})[_0x780a('0x28')](function(_0x219356){_0x5f0bf9=_0x219356;logger[_0x780a('0x2e')]('The\x20User\x20ID\x20is:',_0x5f0bf9['id']);return getEndUser(_0x2f9085,_0x29f69f,_0x4c810e,_0xa294a5[_0x780a('0x89')],_0xa294a5['calleridnum'],_0x5f0bf9,_0x16e915);})[_0x780a('0x28')](function(_0x30292c){_0x3c0433=_0x30292c;return getCall(_0x2f9085,_0x29f69f,_0x4c810e,_0x5f0bf9,_0x3c0433,_0x16e915,_0xa294a5,'Inbound');})[_0x780a('0x28')](function(_0x5ca926){if(_0x5ca926){logger[_0x780a('0x2e')]('The\x20Call\x20ID\x20is:',_0x5ca926['id']);logger['info'](_0x780a('0x8a'),_0x780a('0x8b'));emit(util[_0x780a('0x69')](_0x780a('0x8c'),_0x470796[_0x780a('0x19')]),_0x780a('0x8d'),{'uri':_0x780a('0x8e')+_0x4c810e[_0x780a('0x7f')]+_0x780a('0x8f')+_0x5ca926['id']});}})[_0x780a('0x2b')](function(_0x5d5090){logger[_0x780a('0x2c')](_0x780a('0x8a'),JSON[_0x780a('0x3d')](_0x5d5090));});};exports['outbound']=function(_0x1a449f,_0x31321a,_0x5dd8b0,_0x2ab676,_0x470ecc,_0x12dbd0,_0x4dea83){var _0x21d744,_0x30c95f,_0x1b071a;_0x12dbd0[_0x780a('0x7f')]=intUtil[_0x780a('0x81')](_0x12dbd0[_0x780a('0x7f')]);_0x12dbd0[_0x780a('0x80')]=intUtil[_0x780a('0x81')](_0x12dbd0['serverUrl']);if(_0x4dea83&&_0x4dea83[_0x780a('0x90')]&&_0x4dea83[_0x780a('0x90')]!==_0x780a('0x91')){logger[_0x780a('0x2e')](_0x780a('0x92'),_0x780a('0x83'));_0x31321a[_0x780a('0x84')]=_0x12dbd0[_0x780a('0x80')]+_0x780a('0x85')+_0x31321a[_0x780a('0x86')]+_0x780a('0x93')+md5(_0x31321a[_0x780a('0x86')]);}var _0x234f6e=_0x12dbd0[_0x780a('0x7f')]===_0x780a('0x87')?'eu':_0x780a('0x88');return getAccessToken(_0x12dbd0)[_0x780a('0x28')](function(_0x140d20){_0x1b071a=_0x140d20;return getUser(_0x1b071a,_0x234f6e,_0x12dbd0,_0x2ab676[_0x780a('0x37')]);})[_0x780a('0x28')](function(_0x13d5b6){_0x21d744=_0x13d5b6;logger[_0x780a('0x2e')](_0x780a('0x94'),_0x21d744['id']);return getEndUser(_0x1b071a,_0x234f6e,_0x12dbd0,_0x31321a[_0x780a('0x95')],_0x31321a['destcalleridnum'],_0x21d744,_0x5dd8b0);})[_0x780a('0x28')](function(_0x2bb174){_0x30c95f=_0x2bb174;return getCall(_0x1b071a,_0x234f6e,_0x12dbd0,_0x21d744,_0x30c95f,_0x5dd8b0,_0x31321a,_0x780a('0x96'));})[_0x780a('0x28')](function(_0x2b32f3){if(_0x2b32f3){logger['info']('The\x20Call\x20ID\x20is:',_0x2b32f3['id']);logger[_0x780a('0x2e')](_0x780a('0x92'),_0x780a('0x8b'));emit(util[_0x780a('0x69')](_0x780a('0x8c'),_0x2ab676[_0x780a('0x19')]),_0x780a('0x8d'),{'uri':'https://crm.'+_0x12dbd0['host']+_0x780a('0x8f')+_0x2b32f3['id']});}})['catch'](function(_0x2507dd){logger[_0x780a('0x2c')](_0x780a('0x92'),JSON[_0x780a('0x3d')](_0x2507dd));});};exports['unmanaged']=function(_0x1fdcd2,_0x1ad620,_0x454f55,_0x245df0,_0x49a866,_0x439c24){var _0x181c9f,_0x200c03,_0xbc7d1d;_0x439c24['host']=intUtil['stripTrailingSlash'](_0x439c24['host']);_0x439c24['serverUrl']=intUtil['stripTrailingSlash'](_0x439c24[_0x780a('0x80')]);if(_0x49a866&&_0x49a866[_0x780a('0x82')]){logger['info']('['+_0x1ad620['lastevent']['toUpperCase']()+']',_0x780a('0x83'));_0x1ad620[_0x780a('0x84')]=_0x439c24[_0x780a('0x80')]+_0x780a('0x85')+_0x1ad620[_0x780a('0x86')]+_0x780a('0x93')+md5(_0x1ad620['uniqueid']);}else{_0x1ad620['recordingURL']='';}var _0x579ffb=_0x439c24[_0x780a('0x7f')]===_0x780a('0x87')?'eu':_0x780a('0x88');return getAccessToken(_0x439c24)[_0x780a('0x28')](function(_0x18f98d){_0xbc7d1d=_0x18f98d;return getUser(_0xbc7d1d,_0x579ffb,_0x439c24);})[_0x780a('0x28')](function(_0x23a5af){_0x181c9f=_0x23a5af;logger['info'](_0x780a('0x94'),_0x181c9f['id']);return getEndUser(_0xbc7d1d,_0x579ffb,_0x439c24,_0x1ad620['calleridname'],_0x1ad620[_0x780a('0x97')],_0x181c9f,_0x454f55);})[_0x780a('0x28')](function(_0x4d68c4){_0x200c03=_0x4d68c4;return getCall(_0xbc7d1d,_0x579ffb,_0x439c24,_0x181c9f,_0x200c03,_0x454f55,_0x1ad620,_0x780a('0x98'));})[_0x780a('0x28')](function(_0x4358b1){if(_0x4358b1){logger[_0x780a('0x2e')](_0x780a('0x99'),_0x4358b1['id']);}})[_0x780a('0x2b')](function(_0x2ad317){logger[_0x780a('0x2c')]('['+_0x1ad620[_0x780a('0x6a')][_0x780a('0x9a')]()+']',JSON[_0x780a('0x3d')](_0x2ad317));});}; \ 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 dc929f7..00a67db 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 _0x59bd=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x30986c,_0x39ce58){var _0x57c209=function(_0x557c36){while(--_0x557c36){_0x30986c['push'](_0x30986c['shift']());}};_0x57c209(++_0x39ce58);}(_0x59bd,0x1bd));var _0xd59b=function(_0xc4572b,_0x35030a){_0xc4572b=_0xc4572b-0x0;var _0x1ce699=_0x59bd[_0xc4572b];return _0x1ce699;};'use strict';var util=require(_0xd59b('0x0'));var sh=require(_0xd59b('0x1'));var Mustache=require(_0xd59b('0x2'));var logger=require(_0xd59b('0x3'))('trigger');exports[_0xd59b('0x4')]=function(_0x5ee9e7,_0x53252b){var _0x326f3a=_0x5ee9e7[_0xd59b('0x5')]?_0x5ee9e7[_0xd59b('0x5')]:_0xd59b('0x6');var _0x4dea62=_0x5ee9e7[_0xd59b('0x7')]?Mustache['render'](_0x5ee9e7['data3'],_0x53252b):_0x53252b;sh[_0xd59b('0x4')](_0x4dea62,function(_0x493954,_0x7d9598,_0x4ac9e4){if(_0x493954!==0x0){logger[_0xd59b('0x8')](util[_0xd59b('0x9')](_0xd59b('0xa'),_0x326f3a,_0x4dea62,_0x493954,_0x4ac9e4));}else{logger['info'](util[_0xd59b('0x9')](_0xd59b('0xb'),_0x326f3a,_0x4dea62,_0x7d9598));}});}; \ No newline at end of file +var _0x8020=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x52f065,_0x541e4c){var _0xf1f125=function(_0x39d9d5){while(--_0x39d9d5){_0x52f065['push'](_0x52f065['shift']());}};_0xf1f125(++_0x541e4c);}(_0x8020,0x81));var _0x0802=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x8020[_0x1e7b16];return _0x37fadc;};'use strict';var util=require(_0x0802('0x0'));var sh=require(_0x0802('0x1'));var Mustache=require(_0x0802('0x2'));var logger=require(_0x0802('0x3'))(_0x0802('0x4'));exports[_0x0802('0x5')]=function(_0x1d82f6,_0x48550a){var _0x156301=_0x1d82f6[_0x0802('0x6')]?_0x1d82f6['data2']:'Script';var _0x1d9f57=_0x1d82f6[_0x0802('0x7')]?Mustache[_0x0802('0x8')](_0x1d82f6[_0x0802('0x7')],_0x48550a):_0x48550a;sh['exec'](_0x1d9f57,function(_0x351244,_0xa62d69,_0x4d5a8a){if(_0x351244!==0x0){logger[_0x0802('0x9')](util[_0x0802('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x156301,_0x1d9f57,_0x351244,_0x4d5a8a));}else{logger[_0x0802('0xb')](util[_0x0802('0xa')](_0x0802('0xc'),_0x156301,_0x1d9f57,_0xa62d69));}});}; \ 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 96a428d..7cf7ff8 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 _0x7f36=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','data6','parse','error','GET','DELETE','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','statusCode'];(function(_0x44caf2,_0x8ffb16){var _0x25978d=function(_0x1a2e61){while(--_0x1a2e61){_0x44caf2['push'](_0x44caf2['shift']());}};_0x25978d(++_0x8ffb16);}(_0x7f36,0x93));var _0x67f3=function(_0x1a49c0,_0x14cbf4){_0x1a49c0=_0x1a49c0-0x0;var _0x1ce917=_0x7f36[_0x1a49c0];return _0x1ce917;};'use strict';var rp=require(_0x67f3('0x0'));var util=require(_0x67f3('0x1'));var _=require('lodash');var Mustache=require(_0x67f3('0x2'));var logger=require(_0x67f3('0x3'))(_0x67f3('0x4'));exports[_0x67f3('0x5')]=function(_0x458b69,_0x1b7e57){var _0x5057d3,_0x841dc6;var _0x5aec1b={'method':_0x458b69[_0x67f3('0x6')][_0x67f3('0x7')](),'uri':Mustache[_0x67f3('0x8')](_0x458b69['data2'],_0x1b7e57),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x458b69[_0x67f3('0x9')])===_0x67f3('0xa')&&parseInt(_0x458b69[_0x67f3('0x9')])>=0x1&&parseInt(_0x458b69[_0x67f3('0x9')])<=0xa?parseInt(_0x458b69[_0x67f3('0x9')])*0x3e8:0x5*0x3e8};try{_0x5aec1b['headers']=_0x458b69[_0x67f3('0xb')]?JSON[_0x67f3('0xc')](Mustache[_0x67f3('0x8')](_0x458b69[_0x67f3('0xb')],_0x1b7e57)):{};}catch(_0x398eb6){logger[_0x67f3('0xd')](_0x398eb6['stack']);}switch(_0x458b69[_0x67f3('0x6')]['toUpperCase']()){case _0x67f3('0xe'):case _0x67f3('0xf'):_0x5057d3=null;_0x5aec1b['qs']=_0x1b7e57;break;case _0x67f3('0x10'):case _0x67f3('0x11'):if(_0x458b69[_0x67f3('0x12')]){try{_0x5057d3=JSON['parse'](Mustache[_0x67f3('0x8')](_0x458b69[_0x67f3('0x12')],_0x1b7e57));_0x5aec1b[_0x67f3('0x13')]=_0x5057d3;}catch(_0x460510){logger['error'](_0x460510[_0x67f3('0x14')]);logger['error'](_0x67f3('0x15'));}}else{_0x5057d3=_0x1b7e57;_0x5aec1b['body']=_0x5057d3;}break;}logger[_0x67f3('0x16')](util[_0x67f3('0x17')](_0x67f3('0x18'),_0x458b69[_0x67f3('0x6')],_0x458b69['data2'],JSON[_0x67f3('0x19')](_0x5aec1b)));rp(_0x5aec1b)[_0x67f3('0x1a')](function(_0x3bc7ce){_0x5057d3=!_[_0x67f3('0x1b')](_0x5057d3)?_0x67f3('0x1c')+_0x5057d3:'';_0x841dc6=typeof _0x3bc7ce[_0x67f3('0x13')]===_0x67f3('0x1d')?JSON[_0x67f3('0x19')](_0x3bc7ce[_0x67f3('0x13')]):_0x3bc7ce['body'];logger[_0x67f3('0x16')](util[_0x67f3('0x17')](_0x67f3('0x1e'),_0x458b69[_0x67f3('0x6')],_0x458b69[_0x67f3('0x1f')],_0x3bc7ce[_0x67f3('0x20')],_0x841dc6));})[_0x67f3('0x21')](function(_0x4495b8){logger[_0x67f3('0xd')](util[_0x67f3('0x17')](_0x67f3('0x22'),_0x458b69[_0x67f3('0x6')],_0x458b69[_0x67f3('0x1f')],_0x4495b8['statusCode'],_0x4495b8['name'],_0x4495b8[_0x67f3('0x23')]));});}; \ No newline at end of file +var _0x041a=['data1','POST','PUT','data7','parse','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','body','object','statusCode','catch','name','message','request-promise','lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','number','headers','error'];(function(_0x311d91,_0x4b9dc9){var _0x3705e1=function(_0xb1ad01){while(--_0xb1ad01){_0x311d91['push'](_0x311d91['shift']());}};_0x3705e1(++_0x4b9dc9);}(_0x041a,0xe4));var _0xa041=function(_0x145015,_0x441289){_0x145015=_0x145015-0x0;var _0x3f237c=_0x041a[_0x145015];return _0x3f237c;};'use strict';var rp=require(_0xa041('0x0'));var util=require('util');var _=require(_0xa041('0x1'));var Mustache=require(_0xa041('0x2'));var logger=require('../../../../config/logger')(_0xa041('0x3'));exports[_0xa041('0x4')]=function(_0xb66fe5,_0x25c8c8){var _0x1702b1,_0xa8503b;var _0x236a3c={'method':_0xb66fe5['data1'][_0xa041('0x5')](),'uri':Mustache[_0xa041('0x6')](_0xb66fe5[_0xa041('0x7')],_0x25c8c8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xb66fe5[_0xa041('0x8')])===_0xa041('0x9')&&parseInt(_0xb66fe5[_0xa041('0x8')])>=0x1&&parseInt(_0xb66fe5['data5'])<=0xa?parseInt(_0xb66fe5[_0xa041('0x8')])*0x3e8:0x5*0x3e8};try{_0x236a3c[_0xa041('0xa')]=_0xb66fe5['data6']?JSON['parse'](Mustache[_0xa041('0x6')](_0xb66fe5['data6'],_0x25c8c8)):{};}catch(_0x3b4556){logger[_0xa041('0xb')](_0x3b4556['stack']);}switch(_0xb66fe5[_0xa041('0xc')][_0xa041('0x5')]()){case'GET':case'DELETE':_0x1702b1=null;_0x236a3c['qs']=_0x25c8c8;break;case _0xa041('0xd'):case _0xa041('0xe'):if(_0xb66fe5[_0xa041('0xf')]){try{_0x1702b1=JSON[_0xa041('0x10')](Mustache['render'](_0xb66fe5[_0xa041('0xf')],_0x25c8c8));_0x236a3c['body']=_0x1702b1;}catch(_0x4dcced){logger[_0xa041('0xb')](_0x4dcced[_0xa041('0x11')]);logger['error'](_0xa041('0x12'));}}else{_0x1702b1=_0x25c8c8;_0x236a3c['body']=_0x1702b1;}break;}logger['info'](util[_0xa041('0x13')](_0xa041('0x14'),_0xb66fe5['data1'],_0xb66fe5[_0xa041('0x7')],JSON[_0xa041('0x15')](_0x236a3c)));rp(_0x236a3c)['then'](function(_0x38810a){_0x1702b1=!_[_0xa041('0x16')](_0x1702b1)?_0xa041('0x17')+_0x1702b1:'';_0xa8503b=typeof _0x38810a[_0xa041('0x18')]===_0xa041('0x19')?JSON[_0xa041('0x15')](_0x38810a[_0xa041('0x18')]):_0x38810a['body'];logger['info'](util[_0xa041('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xb66fe5['data1'],_0xb66fe5['data2'],_0x38810a[_0xa041('0x1a')],_0xa8503b));})[_0xa041('0x1b')](function(_0x1580d2){logger[_0xa041('0xb')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0xb66fe5['data1'],_0xb66fe5[_0xa041('0x7')],_0x1580d2[_0xa041('0x1a')],_0x1580d2[_0xa041('0x1c')],_0x1580d2[_0xa041('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1b93825..077aa62 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 _0xa771=['exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x14b684,_0x3b2d29){var _0x10223c=function(_0x5a5487){while(--_0x5a5487){_0x14b684['push'](_0x14b684['shift']());}};_0x10223c(++_0x3b2d29);}(_0xa771,0xf1));var _0x1a77=function(_0x41618a,_0x249775){_0x41618a=_0x41618a-0x0;var _0x1445ae=_0xa771[_0x41618a];return _0x1445ae;};'use strict';var jayson=require(_0x1a77('0x0'));var BPromise=require(_0x1a77('0x1'));var logger=require(_0x1a77('0x2'))(_0x1a77('0x3'));var client=jayson['client'][_0x1a77('0x4')]({'port':0x2329});client[_0x1a77('0x5')]=function(_0x515497,_0x370aae){return new BPromise(function(_0x1f12df,_0x252d8c){return client[_0x1a77('0x6')](_0x515497,_0x370aae)[_0x1a77('0x7')](function(_0x5374a7){logger[_0x1a77('0x8')](_0x1a77('0x9'),_0x1a77('0x3'),_0x515497,_0x370aae,_0x5374a7);if(_0x5374a7[_0x1a77('0xa')]){logger[_0x1a77('0xa')](_0x1a77('0x9'),_0x1a77('0x3'),_0x515497,_0x5374a7['error'][_0x1a77('0xb')],_0x370aae);return _0x252d8c(_0x5374a7[_0x1a77('0xa')][_0x1a77('0xb')]);}else{return _0x1f12df(_0x5374a7[_0x1a77('0xc')]);}})[_0x1a77('0xd')](function(_0x37126e){logger[_0x1a77('0xa')]('rpc',_0x1a77('0x3'),_0x515497,_0x37126e,_0x370aae);return _0x252d8c(_0x37126e);});});};module[_0x1a77('0xe')]=client; \ No newline at end of file +var _0x7d7b=['catch','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message'];(function(_0x3a3a7d,_0x58e12f){var _0x82c974=function(_0x252de6){while(--_0x252de6){_0x3a3a7d['push'](_0x3a3a7d['shift']());}};_0x82c974(++_0x58e12f);}(_0x7d7b,0x1cf));var _0xb7d7=function(_0x45d77d,_0x45ffa0){_0x45d77d=_0x45d77d-0x0;var _0x3e8fd0=_0x7d7b[_0x45d77d];return _0x3e8fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb7d7('0x0'))(_0xb7d7('0x1'));var client=jayson[_0xb7d7('0x2')][_0xb7d7('0x3')]({'port':0x2329});client[_0xb7d7('0x4')]=function(_0x28bd0b,_0xf54107){return new BPromise(function(_0x22103a,_0x1a255c){return client['request'](_0x28bd0b,_0xf54107)[_0xb7d7('0x5')](function(_0x436ebb){logger[_0xb7d7('0x6')](_0xb7d7('0x7'),_0xb7d7('0x1'),_0x28bd0b,_0xf54107,_0x436ebb);if(_0x436ebb[_0xb7d7('0x8')]){logger['error'](_0xb7d7('0x7'),_0xb7d7('0x1'),_0x28bd0b,_0x436ebb[_0xb7d7('0x8')][_0xb7d7('0x9')],_0xf54107);return _0x1a255c(_0x436ebb[_0xb7d7('0x8')]['message']);}else{return _0x22103a(_0x436ebb['result']);}})[_0xb7d7('0xa')](function(_0xc13bc){logger[_0xb7d7('0x8')](_0xb7d7('0x7'),_0xb7d7('0x1'),_0x28bd0b,_0xc13bc,_0xf54107);return _0x1a255c(_0xc13bc);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1cced95..b3190b0 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 _0x1b8f=['./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization'];(function(_0xcc9583,_0x29df55){var _0x19f298=function(_0x5c9dfe){while(--_0x5c9dfe){_0xcc9583['push'](_0xcc9583['shift']());}};_0x19f298(++_0x29df55);}(_0x1b8f,0x110));var _0xf1b8=function(_0x5ad317,_0x4c8eb0){_0x5ad317=_0x5ad317-0x0;var _0x200567=_0x1b8f[_0x5ad317];return _0x200567;};'use strict';var server=require(_0xf1b8('0x0'));var Realtime=require(_0xf1b8('0x1'));var EmailChannel=require(_0xf1b8('0x2'));var mailAccount=require(_0xf1b8('0x3'));var setting=require('./rpc/setting');var logger=require(_0xf1b8('0x4'))(_0xf1b8('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf1b8('0x6')]()[_0xf1b8('0x7')](mailAccount['getMailAccounts']())[_0xf1b8('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0xf1b8('0x8')](realtime[_0xf1b8('0x9')]);return realtime;});}function main(){return server[_0xf1b8('0xa')](realtime,email)[_0xf1b8('0x7')](function(){return initRealtime();})[_0xf1b8('0x7')](function(){return setting[_0xf1b8('0xb')]();})[_0xf1b8('0x7')](function(_0xd3e10){return setInterval(initRealtime,_0xd3e10[_0xf1b8('0xc')]*0x3e8);})[_0xf1b8('0xd')](function(_0x12ccff){logger[_0xf1b8('0xe')](_0xf1b8('0xf'),_0x12ccff);});}main(); \ No newline at end of file +var _0xb4c6=['./lib/email','./rpc/mailAccount','email','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','./server','./realtime'];(function(_0x18f6ee,_0x241f93){var _0x42ac3f=function(_0x10efa9){while(--_0x10efa9){_0x18f6ee['push'](_0x18f6ee['shift']());}};_0x42ac3f(++_0x241f93);}(_0xb4c6,0x184));var _0x6b4c=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0xb4c6[_0x55d58f];return _0x1ad6e6;};'use strict';var server=require(_0x6b4c('0x0'));var Realtime=require(_0x6b4c('0x1'));var EmailChannel=require(_0x6b4c('0x2'));var mailAccount=require(_0x6b4c('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x6b4c('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x6b4c('0x5')](mailAccount[_0x6b4c('0x6')]())[_0x6b4c('0x5')](realtime[_0x6b4c('0x7')]())[_0x6b4c('0x5')](function(){email[_0x6b4c('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x6b4c('0x9')](realtime,email)[_0x6b4c('0x5')](function(){return initRealtime();})[_0x6b4c('0x5')](function(){return setting[_0x6b4c('0xa')]();})[_0x6b4c('0x5')](function(_0x9d0324){return setInterval(initRealtime,_0x9d0324[_0x6b4c('0xb')]*0x3e8);})[_0x6b4c('0xc')](function(_0x880d5){logger['error']('Email\x20service\x20initialization',_0x880d5);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6aa83ba..3a8473f 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 _0xb145=['disabled','messageStatus','status','connected','name','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','smtp','send','verifySmtp','Smtp','lastSync','verify','catch','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','prototype','emit','active','Imap','stringify','mailAccount:update','refresh','hasOwnProperty','provider','custom','service','imapAccounts','email','box','handleImapBox','bind','end','handleImapEnd','error','isNil'];(function(_0x19db0c,_0x293c62){var _0x5ec062=function(_0x2bdd95){while(--_0x2bdd95){_0x19db0c['push'](_0x19db0c['shift']());}};_0x5ec062(++_0x293c62);}(_0xb145,0x166));var _0x5b14=function(_0x1b6263,_0x43cbe6){_0x1b6263=_0x1b6263-0x0;var _0xa94002=_0xb145[_0x1b6263];return _0xa94002;};'use strict';var _=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require('bluebird');var md5=require(_0x5b14('0x2'));var Redis=require(_0x5b14('0x3'));var config=require(_0x5b14('0x4'));var logger=require(_0x5b14('0x5'))('email');config[_0x5b14('0x6')]=_[_0x5b14('0x7')](config[_0x5b14('0x6')],{'host':_0x5b14('0x8'),'port':0x18eb});var io=require(_0x5b14('0x9'))(new Redis(config[_0x5b14('0x6')]));var EmailImap=require(_0x5b14('0xa'));var EmailSmtp=require(_0x5b14('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5e2d0d){logger['info'](_0x5b14('0xc'));this[_0x5b14('0xd')]=_0x5e2d0d['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x5b14('0xe')][_0x5b14('0xf')]=function(_0x4497c4){var _0x4ca8fb=this[_0x5b14('0xd')][_0x4497c4];var _0xb68aa5={'id':_0x4ca8fb['id'],'name':_0x4ca8fb['name'],'key':_0x4ca8fb['key'],'active':_0x4ca8fb[_0x5b14('0x10')],'Imap':{'status':_0x4ca8fb['Imap']['status'],'messageStatus':_0x4ca8fb['Imap']['messageStatus'],'total':_0x4ca8fb[_0x5b14('0x11')]['total']}};if(_['isNil'](md5Accounts[_0x4497c4])){md5Accounts[_0x4497c4]={};}var _0x472758=md5(JSON[_0x5b14('0x12')](_0xb68aa5));if(md5Accounts[_0x4497c4]['md5']!==_0x472758){md5Accounts[_0x4497c4]['md5']=_0x472758;io['emit'](_0x5b14('0x13'),_0xb68aa5);}};EmailChannel[_0x5b14('0xe')][_0x5b14('0x14')]=function(_0xf14a4){for(var _0x18148b in _0xf14a4){if(_0xf14a4[_0x5b14('0x15')](_0x18148b)){if(_0xf14a4[_0x18148b][_0x5b14('0x11')]&&_0xf14a4[_0x18148b][_0x5b14('0x10')]){var _0x17d29b=_0xf14a4[_0x18148b][_0x5b14('0x11')];if(!_0x17d29b['service']&&_0xf14a4[_0x18148b][_0x5b14('0x16')]!==_0x5b14('0x17'))_0x17d29b[_0x5b14('0x18')]=_0xf14a4[_0x18148b]['provider'];if(!this[_0x5b14('0x19')][_0x5b14('0x15')](_0x17d29b['id'])){this[_0x5b14('0x19')][_0x17d29b['id']]=new EmailImap(_0x17d29b,_0xf14a4[_0x18148b][_0x5b14('0x1a')]);this[_0x5b14('0x19')][_0x17d29b['id']]['on'](_0x5b14('0x1b'),this[_0x5b14('0x1c')][_0x5b14('0x1d')](this,_0x18148b));this['imapAccounts'][_0x17d29b['id']]['on'](_0x5b14('0x1a'),this['handleImapEmail'][_0x5b14('0x1d')](this,_0x18148b));this[_0x5b14('0x19')][_0x17d29b['id']]['on'](_0x5b14('0x1e'),this[_0x5b14('0x1f')][_0x5b14('0x1d')](this,_0x18148b));this['imapAccounts'][_0x17d29b['id']]['on'](_0x5b14('0x20'),this['handleImapError']['bind'](this,_0x18148b));}}else{if(_[_0x5b14('0x21')](this[_0x5b14('0xd')][_0x18148b][_0x5b14('0x11')])){this[_0x5b14('0xd')][_0x18148b][_0x5b14('0x11')]={};}this['mailAccounts'][_0x18148b]['Imap']['status']=_0x5b14('0x22');this[_0x5b14('0xd')][_0x18148b][_0x5b14('0x11')][_0x5b14('0x23')]='';this[_0x5b14('0xf')](_0x18148b);}}}};EmailChannel['prototype'][_0x5b14('0x1c')]=function(_0x545b96,_0x31976d){if(this[_0x5b14('0xd')][_0x545b96]){this[_0x5b14('0xd')][_0x545b96][_0x5b14('0x11')][_0x5b14('0x24')]=_0x5b14('0x25');this[_0x5b14('0xd')][_0x545b96][_0x5b14('0x11')]['messageStatus']=_0x31976d[_0x5b14('0x26')];if(_0x31976d[_0x5b14('0x27')]){this[_0x5b14('0xd')][_0x545b96][_0x5b14('0x11')][_0x5b14('0x28')]=_0x31976d[_0x5b14('0x27')][_0x5b14('0x28')];}return this[_0x5b14('0xf')](_0x545b96);}};EmailChannel[_0x5b14('0xe')]['handleImapEmail']=function(_0x31fbbc,_0x9eba98){logger[_0x5b14('0x29')](_0x5b14('0x2a'),_0x9eba98[_0x5b14('0x2b')],_0x9eba98['lastName'],_0x9eba98[_0x5b14('0x2c')],_0x31fbbc);if(this[_0x5b14('0xd')][_0x31fbbc]){return mailAccount[_0x5b14('0x2d')](_0x31fbbc,_0x9eba98)[_0x5b14('0x2e')](function(_0x457ab7){if(_0x457ab7){logger[_0x5b14('0x29')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x465bbc){logger[_0x5b14('0x20')](_0x5b14('0x2f'),JSON[_0x5b14('0x12')](_0x465bbc));});}};EmailChannel['prototype'][_0x5b14('0x1f')]=function(_0x488dbc){if(this[_0x5b14('0xd')][_0x488dbc]&&this['mailAccounts'][_0x488dbc][_0x5b14('0x11')]){if(this[_0x5b14('0x19')][this[_0x5b14('0xd')][_0x488dbc]['Imap']['id']]){delete this['imapAccounts'][this[_0x5b14('0xd')][_0x488dbc]['Imap']['id']];}this['mailAccounts'][_0x488dbc][_0x5b14('0x11')]['lastSync']=moment();this[_0x5b14('0xf')](_0x488dbc);}};EmailChannel[_0x5b14('0xe')][_0x5b14('0x30')]=function(_0xe6f200,_0x42331d){if(this['mailAccounts'][_0xe6f200]){this['mailAccounts'][_0xe6f200]['Imap'][_0x5b14('0x24')]='error';this[_0x5b14('0xd')][_0xe6f200][_0x5b14('0x11')]['messageStatus']=_0x42331d;return this[_0x5b14('0xf')](_0xe6f200);}};EmailChannel[_0x5b14('0xe')]['sendMail']=function(_0x16afbb,_0x195668){return this[_0x5b14('0x31')][_0x5b14('0x32')](_0x16afbb,_0x195668);};EmailChannel[_0x5b14('0xe')][_0x5b14('0x33')]=function(_0x12f1c7){var _0x42ff47=this;if(this[_0x5b14('0xd')][_0x12f1c7['id']]){if(_[_0x5b14('0x21')](this[_0x5b14('0xd')][_0x12f1c7['id']][_0x5b14('0x34')])){this[_0x5b14('0xd')][_0x12f1c7['id']][_0x5b14('0x34')]={};}this[_0x5b14('0xd')][_0x12f1c7['id']][_0x5b14('0x34')][_0x5b14('0x35')]=moment();return new BPromise(function(_0x5a2885,_0xbd1d71){return _0x42ff47[_0x5b14('0x31')][_0x5b14('0x36')](_0x12f1c7)[_0x5b14('0x2e')](function(_0x213f42){_0x42ff47[_0x5b14('0xd')][_0x12f1c7['id']][_0x5b14('0x34')][_0x5b14('0x24')]='verified';_0x42ff47[_0x5b14('0xd')][_0x12f1c7['id']]['Smtp'][_0x5b14('0x23')]='';_0x42ff47[_0x5b14('0xf')](_0x12f1c7['id']);_0x5a2885(_0x213f42);})[_0x5b14('0x37')](function(_0x1df3d6){_0x42ff47[_0x5b14('0xd')][_0x12f1c7['id']][_0x5b14('0x34')][_0x5b14('0x24')]=_0x5b14('0x20');_0x42ff47[_0x5b14('0xd')][_0x12f1c7['id']][_0x5b14('0x34')][_0x5b14('0x23')]=_0x1df3d6;_0x42ff47[_0x5b14('0xf')](_0x12f1c7['id']);_0xbd1d71(_0x1df3d6);});});}return this[_0x5b14('0x31')][_0x5b14('0x36')](_0x12f1c7);};module['exports']=EmailChannel; \ No newline at end of file +var _0x3ddd=['exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','Imap','status','total','isNil','stringify','md5','mailAccount:update','provider','custom','imapAccounts','hasOwnProperty','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','Smtp','verified'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3ddd,0x71));var _0xd3dd=function(_0x13e479,_0x309640){_0x13e479=_0x13e479-0x0;var _0x5066dd=_0x3ddd[_0x13e479];return _0x5066dd;};'use strict';var _=require(_0xd3dd('0x0'));var moment=require(_0xd3dd('0x1'));var BPromise=require(_0xd3dd('0x2'));var md5=require('md5');var Redis=require(_0xd3dd('0x3'));var config=require(_0xd3dd('0x4'));var logger=require(_0xd3dd('0x5'))(_0xd3dd('0x6'));config[_0xd3dd('0x7')]=_[_0xd3dd('0x8')](config['redis'],{'host':_0xd3dd('0x9'),'port':0x18eb});var io=require(_0xd3dd('0xa'))(new Redis(config[_0xd3dd('0x7')]));var EmailImap=require(_0xd3dd('0xb'));var EmailSmtp=require(_0xd3dd('0xc'));var mailAccount=require(_0xd3dd('0xd'));var md5Accounts={};function EmailChannel(_0x16a0b9){logger[_0xd3dd('0xe')]('start\x20email\x20channel');this[_0xd3dd('0xf')]=_0x16a0b9[_0xd3dd('0xf')];this['imapAccounts']={};this[_0xd3dd('0x10')]=new EmailSmtp();}EmailChannel[_0xd3dd('0x11')][_0xd3dd('0x12')]=function(_0x4ee2c6){var _0x2364f1=this[_0xd3dd('0xf')][_0x4ee2c6];var _0x2b4ee7={'id':_0x2364f1['id'],'name':_0x2364f1[_0xd3dd('0x13')],'key':_0x2364f1[_0xd3dd('0x14')],'active':_0x2364f1['active'],'Imap':{'status':_0x2364f1[_0xd3dd('0x15')][_0xd3dd('0x16')],'messageStatus':_0x2364f1[_0xd3dd('0x15')]['messageStatus'],'total':_0x2364f1['Imap'][_0xd3dd('0x17')]}};if(_[_0xd3dd('0x18')](md5Accounts[_0x4ee2c6])){md5Accounts[_0x4ee2c6]={};}var _0x638d0f=md5(JSON[_0xd3dd('0x19')](_0x2b4ee7));if(md5Accounts[_0x4ee2c6][_0xd3dd('0x1a')]!==_0x638d0f){md5Accounts[_0x4ee2c6][_0xd3dd('0x1a')]=_0x638d0f;io[_0xd3dd('0x12')](_0xd3dd('0x1b'),_0x2b4ee7);}};EmailChannel[_0xd3dd('0x11')]['refresh']=function(_0x49d495){for(var _0x3da771 in _0x49d495){if(_0x49d495['hasOwnProperty'](_0x3da771)){if(_0x49d495[_0x3da771][_0xd3dd('0x15')]&&_0x49d495[_0x3da771]['active']){var _0x167d4c=_0x49d495[_0x3da771]['Imap'];if(!_0x167d4c['service']&&_0x49d495[_0x3da771][_0xd3dd('0x1c')]!==_0xd3dd('0x1d'))_0x167d4c['service']=_0x49d495[_0x3da771][_0xd3dd('0x1c')];if(!this[_0xd3dd('0x1e')][_0xd3dd('0x1f')](_0x167d4c['id'])){this[_0xd3dd('0x1e')][_0x167d4c['id']]=new EmailImap(_0x167d4c,_0x49d495[_0x3da771][_0xd3dd('0x6')]);this[_0xd3dd('0x1e')][_0x167d4c['id']]['on'](_0xd3dd('0x20'),this[_0xd3dd('0x21')]['bind'](this,_0x3da771));this[_0xd3dd('0x1e')][_0x167d4c['id']]['on'](_0xd3dd('0x6'),this[_0xd3dd('0x22')][_0xd3dd('0x23')](this,_0x3da771));this[_0xd3dd('0x1e')][_0x167d4c['id']]['on'](_0xd3dd('0x24'),this[_0xd3dd('0x25')][_0xd3dd('0x23')](this,_0x3da771));this[_0xd3dd('0x1e')][_0x167d4c['id']]['on'](_0xd3dd('0x26'),this[_0xd3dd('0x27')][_0xd3dd('0x23')](this,_0x3da771));}}else{if(_[_0xd3dd('0x18')](this[_0xd3dd('0xf')][_0x3da771][_0xd3dd('0x15')])){this['mailAccounts'][_0x3da771][_0xd3dd('0x15')]={};}this[_0xd3dd('0xf')][_0x3da771][_0xd3dd('0x15')]['status']=_0xd3dd('0x28');this['mailAccounts'][_0x3da771][_0xd3dd('0x15')][_0xd3dd('0x29')]='';this[_0xd3dd('0x12')](_0x3da771);}}}};EmailChannel['prototype'][_0xd3dd('0x21')]=function(_0x20fd13,_0x54a402){if(this['mailAccounts'][_0x20fd13]){this[_0xd3dd('0xf')][_0x20fd13][_0xd3dd('0x15')]['status']=_0xd3dd('0x2a');this[_0xd3dd('0xf')][_0x20fd13][_0xd3dd('0x15')][_0xd3dd('0x29')]=_0x54a402[_0xd3dd('0x13')];if(_0x54a402['messages']){this[_0xd3dd('0xf')][_0x20fd13][_0xd3dd('0x15')][_0xd3dd('0x17')]=_0x54a402['messages'][_0xd3dd('0x17')];}return this[_0xd3dd('0x12')](_0x20fd13);}};EmailChannel['prototype'][_0xd3dd('0x22')]=function(_0x2c50a0,_0x47b458){logger[_0xd3dd('0xe')](_0xd3dd('0x2b'),_0x47b458[_0xd3dd('0x2c')],_0x47b458['lastName'],_0x47b458[_0xd3dd('0x2d')],_0x2c50a0);if(this['mailAccounts'][_0x2c50a0]){return mailAccount[_0xd3dd('0x2e')](_0x2c50a0,_0x47b458)[_0xd3dd('0x2f')](function(_0xbf3afb){if(_0xbf3afb){logger[_0xd3dd('0xe')](_0xd3dd('0x30'));}})[_0xd3dd('0x31')](function(_0x5eea7f){logger[_0xd3dd('0x26')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xd3dd('0x19')](_0x5eea7f));});}};EmailChannel[_0xd3dd('0x11')]['handleImapEnd']=function(_0x343285){if(this['mailAccounts'][_0x343285]&&this[_0xd3dd('0xf')][_0x343285][_0xd3dd('0x15')]){if(this[_0xd3dd('0x1e')][this[_0xd3dd('0xf')][_0x343285][_0xd3dd('0x15')]['id']]){delete this['imapAccounts'][this[_0xd3dd('0xf')][_0x343285][_0xd3dd('0x15')]['id']];}this['mailAccounts'][_0x343285]['Imap'][_0xd3dd('0x32')]=moment();this[_0xd3dd('0x12')](_0x343285);}};EmailChannel[_0xd3dd('0x11')][_0xd3dd('0x27')]=function(_0x543739,_0x4d1c1c){if(this['mailAccounts'][_0x543739]){this[_0xd3dd('0xf')][_0x543739][_0xd3dd('0x15')][_0xd3dd('0x16')]=_0xd3dd('0x26');this['mailAccounts'][_0x543739][_0xd3dd('0x15')][_0xd3dd('0x29')]=_0x4d1c1c;return this[_0xd3dd('0x12')](_0x543739);}};EmailChannel[_0xd3dd('0x11')][_0xd3dd('0x33')]=function(_0x4d659a,_0x253a91){return this['smtp'][_0xd3dd('0x34')](_0x4d659a,_0x253a91);};EmailChannel[_0xd3dd('0x11')]['verifySmtp']=function(_0x1f77c9){var _0x372b91=this;if(this[_0xd3dd('0xf')][_0x1f77c9['id']]){if(_[_0xd3dd('0x18')](this['mailAccounts'][_0x1f77c9['id']]['Smtp'])){this[_0xd3dd('0xf')][_0x1f77c9['id']][_0xd3dd('0x35')]={};}this[_0xd3dd('0xf')][_0x1f77c9['id']]['Smtp'][_0xd3dd('0x32')]=moment();return new BPromise(function(_0x4a1d7f,_0x191242){return _0x372b91[_0xd3dd('0x10')]['verify'](_0x1f77c9)['then'](function(_0x5463eb){_0x372b91[_0xd3dd('0xf')][_0x1f77c9['id']][_0xd3dd('0x35')][_0xd3dd('0x16')]=_0xd3dd('0x36');_0x372b91[_0xd3dd('0xf')][_0x1f77c9['id']][_0xd3dd('0x35')][_0xd3dd('0x29')]='';_0x372b91['emit'](_0x1f77c9['id']);_0x4a1d7f(_0x5463eb);})[_0xd3dd('0x31')](function(_0x3f0581){_0x372b91[_0xd3dd('0xf')][_0x1f77c9['id']][_0xd3dd('0x35')][_0xd3dd('0x16')]=_0xd3dd('0x26');_0x372b91[_0xd3dd('0xf')][_0x1f77c9['id']][_0xd3dd('0x35')][_0xd3dd('0x29')]=_0x3f0581;_0x372b91[_0xd3dd('0x12')](_0x1f77c9['id']);_0x191242(_0x3f0581);});});}return this[_0xd3dd('0x10')]['verify'](_0x1f77c9);};module[_0xd3dd('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 86bc423..e37fbae 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 _0xadb5=['events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','CloudProvider','password','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','textCode','hasOwnProperty','exports','util','mailparser','simpleParser','iconv'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xadb5,0xad));var _0x5adb=function(_0x36aa5d,_0xd98c51){_0x36aa5d=_0x36aa5d-0x0;var _0xc979f1=_0xadb5[_0x36aa5d];return _0xc979f1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var Imap=require('imap');var simpleParser=require(_0x5adb('0x1'))[_0x5adb('0x2')];var Iconv=require(_0x5adb('0x3'))['Iconv'];var EventEmitter=require(_0x5adb('0x4'))[_0x5adb('0x5')];var utils=require(_0x5adb('0x6'));var logger=require('../../../config/logger')(_0x5adb('0x7'));function EmailImap(_0x168d89,_0x3e2555){this[_0x5adb('0x8')]=_0x5adb('0x9');this[_0x5adb('0xa')]=this[_0x5adb('0xb')](_0x168d89,_0x3e2555);this[_0x5adb('0xc')]=new Imap(this[_0x5adb('0xa')]);this[_0x5adb('0xc')][_0x5adb('0xd')](_0x5adb('0xe'),this[_0x5adb('0xf')][_0x5adb('0x10')](this));this['imap']['once'](_0x5adb('0x11'),this[_0x5adb('0x12')][_0x5adb('0x10')](this));this['imap']['on'](_0x5adb('0x13'),this['handleError'][_0x5adb('0x10')](this));this['imap'][_0x5adb('0x14')]();}util[_0x5adb('0x15')](EmailImap,EventEmitter);EmailImap[_0x5adb('0x16')]['getAccount']=function(_0x2a545b,_0x34af2c){var _0xf82f72={'connTimeout':_0x2a545b['connTimeout']?_0x2a545b[_0x5adb('0x17')]*0x3e8:0x2710,'authTimeout':_0x2a545b['authTimeout']?_0x2a545b[_0x5adb('0x18')]*0x3e8:0x1388};if(_0x2a545b[_0x5adb('0x19')]){_0xf82f72[_0x5adb('0x1a')]=_0x2a545b[_0x5adb('0x1a')];_0xf82f72[_0x5adb('0x7')]=_0x34af2c||_0x2a545b[_0x5adb('0x1a')]||_0x5adb('0x1b');if(_0x2a545b[_0x5adb('0x1c')]){_0xf82f72[_0x5adb('0x1d')]=utils['generateXOAuth2Token'](_0x2a545b[_0x5adb('0x1e')]['data5'],_0x2a545b[_0x5adb('0x1a')]);}else{_0xf82f72['password']=_0x2a545b[_0x5adb('0x1f')];}}else{if(_0x2a545b['authentication']){_0xf82f72['user']=_0x2a545b[_0x5adb('0x1a')];_0xf82f72[_0x5adb('0x1f')]=_0x2a545b[_0x5adb('0x1f')];}}_0xf82f72[_0x5adb('0x20')]=_0x2a545b[_0x5adb('0x20')];_0xf82f72['port']=_0x2a545b[_0x5adb('0x21')]||0x3e1;if(_0x2a545b['tls']){_0xf82f72['tls']=!![];}else{_0xf82f72[_0x5adb('0x22')]=![];_0xf82f72[_0x5adb('0x23')]=_0x5adb('0x24');}return _0xf82f72;};EmailImap[_0x5adb('0x16')][_0x5adb('0xf')]=function(){this[_0x5adb('0xc')][_0x5adb('0x25')](this['mailbox'],![],this[_0x5adb('0x26')][_0x5adb('0x10')](this));};EmailImap[_0x5adb('0x16')][_0x5adb('0x26')]=function(_0xeb556c,_0x49f203){if(_0xeb556c){this[_0x5adb('0x27')](_0xeb556c,!![]);}else{this[_0x5adb('0x28')]('box',_0x49f203);this[_0x5adb('0x29')]();}};EmailImap[_0x5adb('0x16')][_0x5adb('0x2a')]=function(_0x55b40a){if(_0x55b40a){this[_0x5adb('0x27')](_0x55b40a,!![]);}else{this[_0x5adb('0xc')][_0x5adb('0x11')]();}};EmailImap[_0x5adb('0x16')][_0x5adb('0x29')]=function(){this[_0x5adb('0xc')]['search'](['UNSEEN'],this['handleReadUnseen'][_0x5adb('0x10')](this));};EmailImap[_0x5adb('0x16')][_0x5adb('0x2b')]=function(_0x512bab,_0x137a5c){if(_0x512bab){this['handleError'](_0x512bab,!![]);}else{if(_0x137a5c[_0x5adb('0x2c')]){try{var _0x34b793=this[_0x5adb('0xc')][_0x5adb('0x2d')](_0x137a5c,{'bodies':'','markSeen':!![]});_0x34b793['on'](_0x5adb('0x2e'),this[_0x5adb('0x2f')][_0x5adb('0x10')](this));_0x34b793[_0x5adb('0xd')](_0x5adb('0x13'),this[_0x5adb('0x30')]['bind'](this));_0x34b793[_0x5adb('0xd')]('end',this[_0x5adb('0x31')][_0x5adb('0x10')](this));}catch(_0x5d1441){logger[_0x5adb('0x13')](_0x5d1441);}}else{this[_0x5adb('0xc')][_0x5adb('0x32')](!![],this['handleCloseBox'][_0x5adb('0x10')](this));}}};EmailImap[_0x5adb('0x16')]['handleFetchMessage']=function(_0x5bb227){_0x5bb227['on'](_0x5adb('0x33'),this['handleMessageBody'][_0x5adb('0x10')](this));_0x5bb227[_0x5adb('0xd')](_0x5adb('0x34'),this[_0x5adb('0x35')][_0x5adb('0x10')](this));_0x5bb227['once'](_0x5adb('0x11'),this[_0x5adb('0x36')][_0x5adb('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x32eb69){simpleParser(_0x32eb69,{'Iconv':Iconv},this[_0x5adb('0x37')]['bind'](this));};EmailImap[_0x5adb('0x16')]['handleMessageAttributes']=function(){};EmailImap[_0x5adb('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x5adb('0x16')]['handleSimpleParser']=function(_0x1d9681,_0x23a1db){if(_0x1d9681){logger['error'](_0x1d9681);}else{var _0x4761e3=this;utils['parser'](this[_0x5adb('0xa')],_0x23a1db,function(_0x34e828){_0x4761e3[_0x5adb('0x28')]('email',_0x34e828);});}};EmailImap[_0x5adb('0x16')][_0x5adb('0x31')]=function(){this[_0x5adb('0xc')][_0x5adb('0x32')](!![],this[_0x5adb('0x2a')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x599999){this[_0x5adb('0x27')](_0x599999);this[_0x5adb('0xc')][_0x5adb('0x32')](!![],this[_0x5adb('0x2a')][_0x5adb('0x10')](this));};EmailImap[_0x5adb('0x16')][_0x5adb('0x12')]=function(){this[_0x5adb('0x28')]('end');};EmailImap['prototype'][_0x5adb('0x27')]=function(_0x48eb26,_0xa9f72d){logger[_0x5adb('0x13')](_0x5adb('0x27'),this[_0x5adb('0xa')][_0x5adb('0x7')],JSON['stringify'](_0x48eb26));var _0x43d320='';if(_0x48eb26){if(_0x48eb26[_0x5adb('0x38')]){_0x43d320=_0x48eb26['textCode'];}else{for(var _0x4160ad in _0x48eb26){if(_0x48eb26[_0x5adb('0x39')](_0x4160ad)){_0x43d320+=_['upperFirst'](_0x4160ad)+':\x20'+_0x48eb26[_0x4160ad]+'\x0a';}}}}if(_0xa9f72d){this[_0x5adb('0xc')][_0x5adb('0x11')]();}else{this[_0x5adb('0x28')](_0x5adb('0x13'),_0x43d320);this[_0x5adb('0x28')](_0x5adb('0x11'));}};module[_0x5adb('0x3a')]=EmailImap; \ No newline at end of file +var _0x2ef3=['email','mailbox','INBOX','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','connect','inherits','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger'];(function(_0x4967a8,_0x45de4e){var _0x2ef38a=function(_0x185195){while(--_0x185195){_0x4967a8['push'](_0x4967a8['shift']());}};_0x2ef38a(++_0x45de4e);}(_0x2ef3,0xba));var _0x32ef=function(_0x429ab1,_0x133c99){_0x429ab1=_0x429ab1-0x0;var _0x84b7d2=_0x2ef3[_0x429ab1];return _0x84b7d2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var Imap=require(_0x32ef('0x2'));var simpleParser=require(_0x32ef('0x3'))[_0x32ef('0x4')];var Iconv=require(_0x32ef('0x5'))['Iconv'];var EventEmitter=require(_0x32ef('0x6'))[_0x32ef('0x7')];var utils=require('./utils');var logger=require(_0x32ef('0x8'))(_0x32ef('0x9'));function EmailImap(_0x4c8104,_0x5dfa09){this[_0x32ef('0xa')]=_0x32ef('0xb');this[_0x32ef('0xc')]=this[_0x32ef('0xd')](_0x4c8104,_0x5dfa09);this[_0x32ef('0x2')]=new Imap(this[_0x32ef('0xc')]);this[_0x32ef('0x2')][_0x32ef('0xe')](_0x32ef('0xf'),this[_0x32ef('0x10')]['bind'](this));this['imap'][_0x32ef('0xe')](_0x32ef('0x11'),this[_0x32ef('0x12')][_0x32ef('0x13')](this));this['imap']['on'](_0x32ef('0x14'),this['handleError'][_0x32ef('0x13')](this));this['imap'][_0x32ef('0x15')]();}util[_0x32ef('0x16')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x19ce1,_0x4d8009){var _0x326fce={'connTimeout':_0x19ce1[_0x32ef('0x17')]?_0x19ce1[_0x32ef('0x17')]*0x3e8:0x2710,'authTimeout':_0x19ce1[_0x32ef('0x18')]?_0x19ce1['authTimeout']*0x3e8:0x1388};if(_0x19ce1['service']){_0x326fce['user']=_0x19ce1[_0x32ef('0x19')];_0x326fce[_0x32ef('0x9')]=_0x4d8009||_0x19ce1[_0x32ef('0x19')]||'anonymous@xcally.com';if(_0x19ce1['modernAuthentication']){_0x326fce[_0x32ef('0x1a')]=utils[_0x32ef('0x1b')](_0x19ce1[_0x32ef('0x1c')]['data5'],_0x19ce1[_0x32ef('0x19')]);}else{_0x326fce[_0x32ef('0x1d')]=_0x19ce1['password'];}}else{if(_0x19ce1[_0x32ef('0x1e')]){_0x326fce[_0x32ef('0x19')]=_0x19ce1[_0x32ef('0x19')];_0x326fce[_0x32ef('0x1d')]=_0x19ce1[_0x32ef('0x1d')];}}_0x326fce[_0x32ef('0x1f')]=_0x19ce1['host'];_0x326fce[_0x32ef('0x20')]=_0x19ce1['port']||0x3e1;if(_0x19ce1[_0x32ef('0x21')]){_0x326fce[_0x32ef('0x21')]=!![];}else{_0x326fce['tls']=![];_0x326fce[_0x32ef('0x22')]=_0x32ef('0x23');}return _0x326fce;};EmailImap[_0x32ef('0x24')]['handleReady']=function(){this['imap'][_0x32ef('0x25')](this[_0x32ef('0xa')],![],this[_0x32ef('0x26')]['bind'](this));};EmailImap['prototype'][_0x32ef('0x26')]=function(_0x4d584b,_0x51a412){if(_0x4d584b){this[_0x32ef('0x27')](_0x4d584b,!![]);}else{this[_0x32ef('0x28')](_0x32ef('0x29'),_0x51a412);this[_0x32ef('0x2a')]();}};EmailImap[_0x32ef('0x24')][_0x32ef('0x2b')]=function(_0x1874ea){if(_0x1874ea){this[_0x32ef('0x27')](_0x1874ea,!![]);}else{this[_0x32ef('0x2')][_0x32ef('0x11')]();}};EmailImap[_0x32ef('0x24')][_0x32ef('0x2a')]=function(){this['imap'][_0x32ef('0x2c')]([_0x32ef('0x2d')],this['handleReadUnseen'][_0x32ef('0x13')](this));};EmailImap[_0x32ef('0x24')][_0x32ef('0x2e')]=function(_0x26e207,_0x50a95b){if(_0x26e207){this[_0x32ef('0x27')](_0x26e207,!![]);}else{if(_0x50a95b[_0x32ef('0x2f')]){try{var _0x31dbc3=this[_0x32ef('0x2')][_0x32ef('0x30')](_0x50a95b,{'bodies':'','markSeen':!![]});_0x31dbc3['on'](_0x32ef('0x31'),this[_0x32ef('0x32')]['bind'](this));_0x31dbc3[_0x32ef('0xe')]('error',this[_0x32ef('0x33')][_0x32ef('0x13')](this));_0x31dbc3['once'](_0x32ef('0x11'),this[_0x32ef('0x34')][_0x32ef('0x13')](this));}catch(_0x20b467){logger[_0x32ef('0x14')](_0x20b467);}}else{this['imap']['closeBox'](!![],this[_0x32ef('0x2b')]['bind'](this));}}};EmailImap[_0x32ef('0x24')][_0x32ef('0x32')]=function(_0x2f1349){_0x2f1349['on'](_0x32ef('0x35'),this[_0x32ef('0x36')][_0x32ef('0x13')](this));_0x2f1349['once']('attributes',this['handleMessageAttributes'][_0x32ef('0x13')](this));_0x2f1349[_0x32ef('0xe')](_0x32ef('0x11'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x32ef('0x24')][_0x32ef('0x36')]=function(_0x410334){simpleParser(_0x410334,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x32ef('0x24')][_0x32ef('0x37')]=function(){};EmailImap[_0x32ef('0x24')][_0x32ef('0x38')]=function(){};EmailImap[_0x32ef('0x24')][_0x32ef('0x39')]=function(_0x3223d5,_0x21da90){if(_0x3223d5){logger[_0x32ef('0x14')](_0x3223d5);}else{var _0x4de939=this;utils[_0x32ef('0x3a')](this[_0x32ef('0xc')],_0x21da90,function(_0x14b54f){_0x4de939['emit'](_0x32ef('0x9'),_0x14b54f);});}};EmailImap[_0x32ef('0x24')][_0x32ef('0x34')]=function(){this[_0x32ef('0x2')][_0x32ef('0x3b')](!![],this[_0x32ef('0x2b')][_0x32ef('0x13')](this));};EmailImap[_0x32ef('0x24')][_0x32ef('0x33')]=function(_0x57a3c0){this[_0x32ef('0x27')](_0x57a3c0);this[_0x32ef('0x2')]['closeBox'](!![],this[_0x32ef('0x2b')][_0x32ef('0x13')](this));};EmailImap[_0x32ef('0x24')][_0x32ef('0x12')]=function(){this[_0x32ef('0x28')](_0x32ef('0x11'));};EmailImap[_0x32ef('0x24')]['handleError']=function(_0x538758,_0x399caa){logger[_0x32ef('0x14')](_0x32ef('0x27'),this[_0x32ef('0xc')]['email'],JSON[_0x32ef('0x3c')](_0x538758));var _0x1f323a='';if(_0x538758){if(_0x538758['textCode']){_0x1f323a=_0x538758[_0x32ef('0x3d')];}else{for(var _0x4bc5bc in _0x538758){if(_0x538758[_0x32ef('0x3e')](_0x4bc5bc)){_0x1f323a+=_[_0x32ef('0x3f')](_0x4bc5bc)+':\x20'+_0x538758[_0x4bc5bc]+'\x0a';}}}}if(_0x399caa){this[_0x32ef('0x2')][_0x32ef('0x11')]();}else{this[_0x32ef('0x28')](_0x32ef('0x14'),_0x1f323a);this[_0x32ef('0x28')](_0x32ef('0x11'));}};module[_0x32ef('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e5f1b0d..a2831bd 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 _0x1762=['use','sendMail','verify','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x57b429,_0x140a08){var _0xb4e63b=function(_0x39902e){while(--_0x39902e){_0x57b429['push'](_0x57b429['shift']());}};_0xb4e63b(++_0x140a08);}(_0x1762,0x1c9));var _0x2176=function(_0x3b32a9,_0x3c30d9){_0x3b32a9=_0x3b32a9-0x0;var _0x128c34=_0x1762[_0x3b32a9];return _0x128c34;};'use strict';var nodemailer=require(_0x2176('0x0'));var inlineBase64=require(_0x2176('0x1'));function EmailSmtp(){}EmailSmtp[_0x2176('0x2')][_0x2176('0x3')]=function(_0x2ad371,_0x376727){return new Promise(function(_0x40f3a1,_0x2b44c6){var _0x2864fc=nodemailer[_0x2176('0x4')](_0x2ad371);_0x2864fc[_0x2176('0x5')]('compile',inlineBase64());_0x2864fc[_0x2176('0x6')](_0x376727,function(_0x244848,_0x86994d){if(_0x244848){_0x2b44c6(_0x244848['toString']());}else{_0x40f3a1(_0x86994d);}});});};EmailSmtp[_0x2176('0x2')][_0x2176('0x7')]=function(_0x4987dd){return new Promise(function(_0x38c70e,_0x29ebd0){var _0x49ba91=nodemailer[_0x2176('0x4')](_0x4987dd);_0x49ba91[_0x2176('0x7')](function(_0x2221da,_0x4e5985){if(_0x2221da){_0x29ebd0(_0x2221da[_0x2176('0x8')]());}else{if(_0x4e5985){_0x38c70e(_0x4e5985);}else{_0x29ebd0(_0x2176('0x9'));}}});});};module[_0x2176('0xa')]=EmailSmtp; \ No newline at end of file +var _0xdfb4=['toString','nodemailer','nodemailer-plugin-inline-base64','prototype','use','compile','sendMail','verify'];(function(_0x14e2dc,_0x5f3535){var _0x1843c3=function(_0x56f5cc){while(--_0x56f5cc){_0x14e2dc['push'](_0x14e2dc['shift']());}};_0x1843c3(++_0x5f3535);}(_0xdfb4,0x161));var _0x4dfb=function(_0x2b2195,_0x5efc30){_0x2b2195=_0x2b2195-0x0;var _0x435786=_0xdfb4[_0x2b2195];return _0x435786;};'use strict';var nodemailer=require(_0x4dfb('0x0'));var inlineBase64=require(_0x4dfb('0x1'));function EmailSmtp(){}EmailSmtp[_0x4dfb('0x2')]['send']=function(_0x16f8b5,_0x37413f){return new Promise(function(_0x34230b,_0x4cddc5){var _0x5b6311=nodemailer['createTransport'](_0x16f8b5);_0x5b6311[_0x4dfb('0x3')](_0x4dfb('0x4'),inlineBase64());_0x5b6311[_0x4dfb('0x5')](_0x37413f,function(_0x381d51,_0x4f0c91){if(_0x381d51){_0x4cddc5(_0x381d51['toString']());}else{_0x34230b(_0x4f0c91);}});});};EmailSmtp[_0x4dfb('0x2')]['verify']=function(_0xbae73){return new Promise(function(_0x2f8fcd,_0x3e8373){var _0x1fbe66=nodemailer['createTransport'](_0xbae73);_0x1fbe66[_0x4dfb('0x6')](function(_0x5718ef,_0x4e352e){if(_0x5718ef){_0x3e8373(_0x5718ef[_0x4dfb('0x7')]());}else{if(_0x4e352e){_0x2f8fcd(_0x4e352e);}else{_0x3e8373('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e256762..457472e 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 _0x09cc=['toString','base64','lodash','randomstring','path','util','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','generate','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','includes','originCc','bcc','attachments','attach','type','attachment','filename','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8'];(function(_0x188018,_0x933130){var _0x21b287=function(_0xf42397){while(--_0xf42397){_0x188018['push'](_0x188018['shift']());}};_0x21b287(++_0x933130);}(_0x09cc,0x98));var _0xc09c=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x09cc[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xc09c('0x0'));var moment=require('moment');var random=require(_0xc09c('0x1'));var fs=require('fs');var path=require(_0xc09c('0x2'));var util=require(_0xc09c('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xc09c('0x4'));var config=require(_0xc09c('0x5'));function getAddress(_0x43cb78){var _0x4de51b=_[_0xc09c('0x6')](_0x43cb78[_0xc09c('0x7')]);return _0x4de51b&&_0x4de51b['address']?_0x4de51b[_0xc09c('0x8')]:_0xc09c('0x9')+random['generate'](0x6)+_0xc09c('0xa');}function getFirstName(_0x3eeb2a){var _0x5b40c2=_['head'](_0x3eeb2a[_0xc09c('0x7')]);if(_0x5b40c2&&_0x5b40c2[_0xc09c('0xb')]){if(_0x5b40c2[_0xc09c('0xb')]==_0x5b40c2[_0xc09c('0x8')]){return _0x5b40c2['name'][_0xc09c('0xc')](0x0,_0x5b40c2['name'][_0xc09c('0xd')]('@'));}var _0x3413a7=_0x5b40c2[_0xc09c('0xb')][_0xc09c('0xe')](/\s+/);return _0x3413a7['length']>0x1?_0x3413a7[_0xc09c('0xf')](0x0,-0x1)[_0xc09c('0x10')]('\x20'):_0x5b40c2[_0xc09c('0xb')];}return _0xc09c('0x11');}function getLastName(_0x5d643d){var _0x3a73cb=_[_0xc09c('0x6')](_0x5d643d[_0xc09c('0x7')]);if(_0x3a73cb&&_0x3a73cb[_0xc09c('0xb')]){var _0x355bbb=_0x3a73cb[_0xc09c('0xb')][_0xc09c('0xe')](/\s+/);return _0x355bbb[_0xc09c('0x12')]>0x1?_0x355bbb[_0xc09c('0x13')]():'';}return'';}function getMails(_0x29bc9c,_0x205e09){var _0x4dfd76='';for(var _0x52ea90=0x0;_0x52ea90<_0x205e09[_0xc09c('0x7')][_0xc09c('0x12')];_0x52ea90+=0x1){if(_0x205e09[_0xc09c('0x7')][_0x52ea90]['address']!==_0x29bc9c){if(!_[_0xc09c('0x14')](_0x4dfd76)){_0x4dfd76+=',';}_0x4dfd76+=_0x205e09[_0xc09c('0x7')][_0x52ea90][_0xc09c('0xb')]||_0x205e09['value'][_0x52ea90]['address']||'';_0x4dfd76+='\x20<';_0x4dfd76+=_0x205e09[_0xc09c('0x7')][_0x52ea90][_0xc09c('0x8')]?_0x205e09[_0xc09c('0x7')][_0x52ea90][_0xc09c('0x8')]:_0xc09c('0x9')+random[_0xc09c('0x15')](0x6)+_0xc09c('0xa');_0x4dfd76+='>';}}return _0x4dfd76;}function parseEmail(_0x28b974,_0x22e8f4,_0x4f2646){if(_0x22e8f4[_0xc09c('0x16')]){var _0x50bc60=/)<[^<]*)*<\/script>/gi;while(_0x50bc60['test'](_0x22e8f4[_0xc09c('0x16')])){_0x22e8f4[_0xc09c('0x16')]=_0x22e8f4['html'][_0xc09c('0x17')](_0x50bc60,'');}if(_0x22e8f4[_0xc09c('0x16')]['includes'](_0xc09c('0x18'))){var _0x1aa999=[];_0x22e8f4['attachments']['forEach'](_0x404448=>{_0x1aa999[_0xc09c('0x19')](_0x404448['filename']);});var _0x3e3178=/]+>/g;var _0x549387=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x392a12=_0x22e8f4[_0xc09c('0x16')][_0xc09c('0x17')](_0x549387,_0xc09c('0x1a'));var _0x2b45ea=_0x392a12[_0xc09c('0x17')](_0x3e3178,_0xc09c('0x1b'));for(let _0x54ac67=0x0;_0x54ac67<_0x1aa999[_0xc09c('0x12')];_0x54ac67++){var _0x134397=_0x2b45ea['replace']('_IMG',_0xc09c('0x1c')+_0x1aa999[_0x54ac67]+_0xc09c('0x1d'));_0x2b45ea=_0x134397;}_0x22e8f4[_0xc09c('0x16')]=_0x2b45ea;}_0x4f2646[_0xc09c('0x1e')]=_0x22e8f4[_0xc09c('0x16')];}else{_0x4f2646[_0xc09c('0x1e')]=_0x22e8f4[_0xc09c('0x1f')];}if(_0x4f2646[_0xc09c('0x1e')]){_0x4f2646['body']=_0x4f2646[_0xc09c('0x1e')][_0xc09c('0x17')](/0x0){var _0x40397a=[_0xc09c('0x33'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x9df070=0x0;_0x9df070<_0x22e8f4['headerLines'][_0xc09c('0x12')];_0x9df070++){var _0x11fb50=_[_0xc09c('0xd')](_0x40397a,_0x22e8f4[_0xc09c('0x32')][_0x9df070][_0xc09c('0x34')]);if(_0x11fb50>=0x0){_0x4f2646[_0xc09c('0x35')]=!![];}}}return _0x4f2646;}exports[_0xc09c('0x36')]=function(_0x54994c,_0x57c4e1,_0x2d9965){var _0x4c6c5b={'from':getAddress(_0x57c4e1[_0xc09c('0x37')]),'firstName':getFirstName(_0x57c4e1[_0xc09c('0x37')]),'lastName':getLastName(_0x57c4e1[_0xc09c('0x37')]),'mapKey':_0xc09c('0x4'),'message':{'from':getMails(_0x54994c[_0xc09c('0x4')],_0x57c4e1[_0xc09c('0x37')]),'to':_0x54994c[_0xc09c('0x4')],'cc':'','subject':_0x57c4e1[_0xc09c('0x38')]||'','messageId':_0x57c4e1[_0xc09c('0x39')],'inReplyTo':_0x57c4e1[_0xc09c('0x3a')],'sentAt':moment(_0x57c4e1[_0xc09c('0x3b')])[_0xc09c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x57c4e1[_0xc09c('0x16')]&&!_0x57c4e1['textAsHtml']){var _0x4de981=_[_0xc09c('0x3c')](_0x57c4e1[_0xc09c('0x25')],{'contentType':_0xc09c('0x3d')});if(_0x4de981['length']){logger[_0xc09c('0x3e')](util[_0xc09c('0x2b')](_0xc09c('0x3f'),_0x57c4e1['messageId']));tnef[_0xc09c('0x40')](_['first'](_0x4de981)[_0xc09c('0x30')],function(_0x496810,_0xee6290){if(_0xee6290){_0x57c4e1[_0xc09c('0x16')]=_0xee6290[_0xc09c('0x41')]||_0xc09c('0x42');if(_0xee6290[_0xc09c('0x43')]){for(var _0x1101b1=0x0;_0x1101b1<_0xee6290['Attachments'][_0xc09c('0x12')];_0x1101b1++){var _0x1eaa93=_0xee6290['Attachments'][_0x1101b1];_0x4c6c5b[_0xc09c('0x20')]['attachments']['push']({'filename':_0x1eaa93[_0xc09c('0x44')],'content':Buffer['from'](_0x1eaa93['Data'])});}}}_0x2d9965(parseEmail(_0x54994c,_0x57c4e1,_0x4c6c5b));});}else{_0x57c4e1[_0xc09c('0x16')]=_0xc09c('0x42');_0x2d9965(parseEmail(_0x54994c,_0x57c4e1,_0x4c6c5b));}}else{_0x2d9965(parseEmail(_0x54994c,_0x57c4e1,_0x4c6c5b));}};exports[_0xc09c('0x45')]=function(_0x590d11,_0x37298e){var _0x6c76af=[_0xc09c('0x46')+(_0x37298e||''),_0xc09c('0x47')+_0x590d11,'',''];return Buffer['from'](_0x6c76af[_0xc09c('0x10')](''),_0xc09c('0x48'))[_0xc09c('0x49')](_0xc09c('0x4a'));}; \ No newline at end of file +var _0x3487=['moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','@xcally.com','name','indexOf','split','length','slice','join','Anonymous','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','utf-8','toString','base64','lodash'];(function(_0x373528,_0x2fd8fe){var _0x11fde3=function(_0x593ff6){while(--_0x593ff6){_0x373528['push'](_0x373528['shift']());}};_0x11fde3(++_0x2fd8fe);}(_0x3487,0x1b5));var _0x7348=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x3487[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x7348('0x0'));var moment=require(_0x7348('0x1'));var random=require(_0x7348('0x2'));var fs=require('fs');var path=require(_0x7348('0x3'));var util=require('util');var tnef=require(_0x7348('0x4'));var logger=require(_0x7348('0x5'))(_0x7348('0x6'));var config=require('../../../config/environment');function getAddress(_0x2a81ec){var _0x21ba20=_[_0x7348('0x7')](_0x2a81ec[_0x7348('0x8')]);return _0x21ba20&&_0x21ba20[_0x7348('0x9')]?_0x21ba20['address']:_0x7348('0xa')+random['generate'](0x6)+_0x7348('0xb');}function getFirstName(_0x1bc52c){var _0x285c32=_[_0x7348('0x7')](_0x1bc52c[_0x7348('0x8')]);if(_0x285c32&&_0x285c32[_0x7348('0xc')]){if(_0x285c32['name']==_0x285c32['address']){return _0x285c32['name']['substring'](0x0,_0x285c32['name'][_0x7348('0xd')]('@'));}var _0x216e5b=_0x285c32['name'][_0x7348('0xe')](/\s+/);return _0x216e5b[_0x7348('0xf')]>0x1?_0x216e5b[_0x7348('0x10')](0x0,-0x1)[_0x7348('0x11')]('\x20'):_0x285c32[_0x7348('0xc')];}return _0x7348('0x12');}function getLastName(_0x534a67){var _0x53bef1=_[_0x7348('0x7')](_0x534a67[_0x7348('0x8')]);if(_0x53bef1&&_0x53bef1[_0x7348('0xc')]){var _0x5b3973=_0x53bef1['name'][_0x7348('0xe')](/\s+/);return _0x5b3973[_0x7348('0xf')]>0x1?_0x5b3973['pop']():'';}return'';}function getMails(_0x501886,_0x4bebdf){var _0x427edd='';for(var _0x4cd4ba=0x0;_0x4cd4ba<_0x4bebdf[_0x7348('0x8')][_0x7348('0xf')];_0x4cd4ba+=0x1){if(_0x4bebdf['value'][_0x4cd4ba][_0x7348('0x9')]!==_0x501886){if(!_[_0x7348('0x13')](_0x427edd)){_0x427edd+=',';}_0x427edd+=_0x4bebdf[_0x7348('0x8')][_0x4cd4ba][_0x7348('0xc')]||_0x4bebdf[_0x7348('0x8')][_0x4cd4ba]['address']||'';_0x427edd+='\x20<';_0x427edd+=_0x4bebdf[_0x7348('0x8')][_0x4cd4ba][_0x7348('0x9')]?_0x4bebdf[_0x7348('0x8')][_0x4cd4ba][_0x7348('0x9')]:'anonymous'+random[_0x7348('0x14')](0x6)+'@xcally.com';_0x427edd+='>';}}return _0x427edd;}function parseEmail(_0x2d128b,_0x34a688,_0x2f9f4a){if(_0x34a688[_0x7348('0x15')]){var _0x6ae113=/)<[^<]*)*<\/script>/gi;while(_0x6ae113[_0x7348('0x16')](_0x34a688['html'])){_0x34a688[_0x7348('0x15')]=_0x34a688['html'][_0x7348('0x17')](_0x6ae113,'');}if(_0x34a688[_0x7348('0x15')][_0x7348('0x18')](_0x7348('0x19'))){var _0x3d996b=[];_0x34a688[_0x7348('0x1a')]['forEach'](_0x48762a=>{_0x3d996b[_0x7348('0x1b')](_0x48762a[_0x7348('0x1c')]);});var _0x3796eb=/]+>/g;var _0x788218=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2c0065=_0x34a688['html'][_0x7348('0x17')](_0x788218,_0x7348('0x1d'));var _0x55b809=_0x2c0065[_0x7348('0x17')](_0x3796eb,'_IMG');for(let _0x49a609=0x0;_0x49a609<_0x3d996b[_0x7348('0xf')];_0x49a609++){var _0x44a96f=_0x55b809[_0x7348('0x17')](_0x7348('0x1e'),_0x7348('0x1f')+_0x3d996b[_0x49a609]+_0x7348('0x20'));_0x55b809=_0x44a96f;}_0x34a688[_0x7348('0x15')]=_0x55b809;}_0x2f9f4a[_0x7348('0x21')]=_0x34a688[_0x7348('0x15')];}else{_0x2f9f4a[_0x7348('0x21')]=_0x34a688[_0x7348('0x22')];}if(_0x2f9f4a[_0x7348('0x21')]){_0x2f9f4a[_0x7348('0x21')]=_0x2f9f4a[_0x7348('0x21')]['replace'](/0x0){var _0x3da537=[_0x7348('0x31'),_0x7348('0x32'),_0x7348('0x33')];for(var _0x34661a=0x0;_0x34661a<_0x34a688[_0x7348('0x30')][_0x7348('0xf')];_0x34661a++){var _0x2d2cbb=_[_0x7348('0xd')](_0x3da537,_0x34a688[_0x7348('0x30')][_0x34661a]['line']);if(_0x2d2cbb>=0x0){_0x2f9f4a[_0x7348('0x34')]=!![];}}}return _0x2f9f4a;}exports[_0x7348('0x35')]=function(_0x383ce2,_0x3290ee,_0x45e8e5){var _0x3232bf={'from':getAddress(_0x3290ee[_0x7348('0x36')]),'firstName':getFirstName(_0x3290ee['from']),'lastName':getLastName(_0x3290ee['from']),'mapKey':_0x7348('0x6'),'message':{'from':getMails(_0x383ce2[_0x7348('0x6')],_0x3290ee[_0x7348('0x36')]),'to':_0x383ce2['email'],'cc':'','subject':_0x3290ee[_0x7348('0x37')]||'','messageId':_0x3290ee[_0x7348('0x38')],'inReplyTo':_0x3290ee[_0x7348('0x39')],'sentAt':moment(_0x3290ee[_0x7348('0x3a')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3290ee['html']&&!_0x3290ee[_0x7348('0x22')]){var _0x2232e3=_[_0x7348('0x3b')](_0x3290ee[_0x7348('0x1a')],{'contentType':_0x7348('0x3c')});if(_0x2232e3[_0x7348('0xf')]){logger[_0x7348('0x3d')](util['format'](_0x7348('0x3e'),_0x3290ee[_0x7348('0x38')]));tnef['parseBuffer'](_[_0x7348('0x3f')](_0x2232e3)[_0x7348('0x2f')],function(_0x1e2599,_0x41ec56){if(_0x41ec56){_0x3290ee['html']=_0x41ec56[_0x7348('0x40')]||_0x7348('0x41');if(_0x41ec56[_0x7348('0x42')]){for(var _0x439c27=0x0;_0x439c27<_0x41ec56[_0x7348('0x42')][_0x7348('0xf')];_0x439c27++){var _0x5f67d3=_0x41ec56[_0x7348('0x42')][_0x439c27];_0x3232bf[_0x7348('0x24')]['attachments'][_0x7348('0x1b')]({'filename':_0x5f67d3[_0x7348('0x43')],'content':Buffer[_0x7348('0x36')](_0x5f67d3['Data'])});}}}_0x45e8e5(parseEmail(_0x383ce2,_0x3290ee,_0x3232bf));});}else{_0x3290ee[_0x7348('0x15')]=_0x7348('0x41');_0x45e8e5(parseEmail(_0x383ce2,_0x3290ee,_0x3232bf));}}else{_0x45e8e5(parseEmail(_0x383ce2,_0x3290ee,_0x3232bf));}};exports[_0x7348('0x44')]=function(_0xc3b2d6,_0x379d34){var _0x2314b1=[_0x7348('0x45')+(_0x379d34||''),'auth=Bearer\x20'+_0xc3b2d6,'',''];return Buffer[_0x7348('0x36')](_0x2314b1['join'](''),_0x7348('0x46'))[_0x7348('0x47')](_0x7348('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index eff6990..395da81 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 _0xf765=['Service','key','active','Imap','Smtp','lodash','name'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xf765,0x140));var _0x5f76=function(_0x2d14b3,_0x20873c){_0x2d14b3=_0x2d14b3-0x0;var _0x12d071=_0xf765[_0x2d14b3];return _0x12d071;};'use strict';var _=require(_0x5f76('0x0'));function MailAccount(_0x20f6bd){this['id']=_0x20f6bd['id']||0x0;this[_0x5f76('0x1')]=_0x20f6bd['name']||_0x5f76('0x2');this[_0x5f76('0x3')]=_0x20f6bd['key']||'SERV';this[_0x5f76('0x4')]=_0x20f6bd[_0x5f76('0x4')]||![];this[_0x5f76('0x5')]=_0x20f6bd[_0x5f76('0x5')]||[];this['Smtp']=_0x20f6bd[_0x5f76('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x72a5=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0xfd7cb3,_0x7f7744){var _0x4a7f70=function(_0x27bf82){while(--_0x27bf82){_0xfd7cb3['push'](_0xfd7cb3['shift']());}};_0x4a7f70(++_0x7f7744);}(_0x72a5,0x1cc));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x572a('0x0'));function MailAccount(_0x22ef79){this['id']=_0x22ef79['id']||0x0;this[_0x572a('0x1')]=_0x22ef79[_0x572a('0x1')]||_0x572a('0x2');this[_0x572a('0x3')]=_0x22ef79[_0x572a('0x3')]||_0x572a('0x4');this[_0x572a('0x5')]=_0x22ef79[_0x572a('0x5')]||![];this['Imap']=_0x22ef79[_0x572a('0x6')]||[];this[_0x572a('0x7')]=_0x22ef79[_0x572a('0x7')]||[];}module[_0x572a('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5eeb385..01865a6 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 _0xf085=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','mailAccounts','../model/mailAccount'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0xf085,0x1ee));var _0x5f08=function(_0xe8668f,_0x42446c){_0xe8668f=_0xe8668f-0x0;var _0xf3d4ff=_0xf085[_0xe8668f];return _0xf3d4ff;};'use strict';var _=require('lodash');var MailAccount=require(_0x5f08('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x415561,_0x51e3fe,_0x1597c2){var _0x4b6908=_[_0x5f08('0x1')](_0x415561,function(_0x62dacf,_0x203518){return _0x62dacf[_0x1597c2];});for(var _0x222ced in _0x51e3fe){if(_0x51e3fe[_0x5f08('0x2')](_0x222ced)){if(!_0x4b6908[_0x222ced]){delete _0x51e3fe[_0x222ced];}}}}Realtime[_0x5f08('0x3')][_0x5f08('0x4')]=function(_0x23fc52,_0x54de71){for(var _0x33ab60 in _0x54de71){if(_0x23fc52['hasOwnProperty'](_0x33ab60)){_0x23fc52[_0x33ab60]=_0x54de71[_0x33ab60];}}};Realtime[_0x5f08('0x3')][_0x5f08('0x5')]=function(){var _0xb90fa5=this;return function(_0x52c74a){if(_0x52c74a){freeIsNotKey(_0x52c74a,_0xb90fa5['mailAccounts'],'id');for(var _0x12a1ff=0x0,_0x2125a7={},_0x583a83={};_0x12a1ff<_0x52c74a[_0x5f08('0x6')];_0x12a1ff+=0x1){_0x2125a7=_0x52c74a[_0x12a1ff];if(_[_0x5f08('0x7')](_0xb90fa5['mailAccounts'][_0x2125a7['id']])){_0xb90fa5['mailAccounts'][_0x2125a7['id']]=new MailAccount(_0x2125a7);}else{_['merge'](_0xb90fa5[_0x5f08('0x8')][_0x2125a7['id']],_0x2125a7);}}}return _0xb90fa5[_0x5f08('0x8')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe656=['hasOwnProperty','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xe656,0x131));var _0x6e65=function(_0x399d32,_0x236e4c){_0x399d32=_0x399d32-0x0;var _0x29e82d=_0xe656[_0x399d32];return _0x29e82d;};'use strict';var _=require(_0x6e65('0x0'));var MailAccount=require(_0x6e65('0x1'));var Realtime=function(){this[_0x6e65('0x2')]={};};function freeIsNotKey(_0x44ee69,_0x231e59,_0x55a063){var _0x3d1972=_[_0x6e65('0x3')](_0x44ee69,function(_0x5a7939,_0x3c0987){return _0x5a7939[_0x55a063];});for(var _0x58dc57 in _0x231e59){if(_0x231e59['hasOwnProperty'](_0x58dc57)){if(!_0x3d1972[_0x58dc57]){delete _0x231e59[_0x58dc57];}}}}Realtime[_0x6e65('0x4')]['mergeFromDatabase']=function(_0x34923c,_0x58cf43){for(var _0x68f6d5 in _0x58cf43){if(_0x34923c[_0x6e65('0x5')](_0x68f6d5)){_0x34923c[_0x68f6d5]=_0x58cf43[_0x68f6d5];}}};Realtime[_0x6e65('0x4')]['initMailAccounts']=function(){var _0x4f3a3e=this;return function(_0x412f7c){if(_0x412f7c){freeIsNotKey(_0x412f7c,_0x4f3a3e[_0x6e65('0x2')],'id');for(var _0x50ec47=0x0,_0x55a651={},_0x12ec5c={};_0x50ec47<_0x412f7c[_0x6e65('0x6')];_0x50ec47+=0x1){_0x55a651=_0x412f7c[_0x50ec47];if(_[_0x6e65('0x7')](_0x4f3a3e['mailAccounts'][_0x55a651['id']])){_0x4f3a3e['mailAccounts'][_0x55a651['id']]=new MailAccount(_0x55a651);}else{_[_0x6e65('0x8')](_0x4f3a3e[_0x6e65('0x2')][_0x55a651['id']],_0x55a651);}}}return _0x4f3a3e[_0x6e65('0x2')];};};module[_0x6e65('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index fc2fbfa..f32697d 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 _0xf8cc=['service','type','CloudProvider','MailServerOut','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','email','active','key','ListId'];(function(_0x4e321d,_0x2f1138){var _0x28b273=function(_0x4b2100){while(--_0x4b2100){_0x4e321d['push'](_0x4e321d['shift']());}};_0x28b273(++_0x2f1138);}(_0xf8cc,0x1e4));var _0xcf8c=function(_0xda63b9,_0xa38a9e){_0xda63b9=_0xda63b9-0x0;var _0x4a0867=_0xf8cc[_0xda63b9];return _0x4a0867;};'use strict';var client=require(_0xcf8c('0x0'));exports[_0xcf8c('0x1')]=function(){return function(){return client[_0xcf8c('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xcf8c('0x3'),_0xcf8c('0x4'),'service',_0xcf8c('0x5'),_0xcf8c('0x6'),_0xcf8c('0x7'),_0xcf8c('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':'CloudProvider','attributes':['id','name',_0xcf8c('0x9'),_0xcf8c('0xa'),'data5'],'as':_0xcf8c('0xb')}]},{'model':_0xcf8c('0xc'),'as':'Smtp','include':[{'model':_0xcf8c('0xb'),'attributes':['id',_0xcf8c('0x3'),_0xcf8c('0x9'),_0xcf8c('0xa'),_0xcf8c('0xd')],'as':_0xcf8c('0xb')}]}]},'log':_0xcf8c('0xe')});};};exports[_0xcf8c('0xf')]=function(_0x2db9b8,_0x399225){return client[_0xcf8c('0x2')](_0xcf8c('0x10'),{'account':{'id':_0x2db9b8},'body':_0x399225,'log':_0xcf8c('0x10')});}; \ No newline at end of file +var _0xffc8=['getMailAccounts','Request','GetMailAccount','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x23629f,_0x4b37fa){var _0x4d810a=function(_0x4a6d95){while(--_0x4a6d95){_0x23629f['push'](_0x23629f['shift']());}};_0x4d810a(++_0x4b37fa);}(_0xffc8,0xd1));var _0x8ffc=function(_0x122cd2,_0x108116){_0x122cd2=_0x122cd2-0x0;var _0x5c3f2e=_0xffc8[_0x122cd2];return _0x5c3f2e;};'use strict';var client=require(_0x8ffc('0x0'));exports[_0x8ffc('0x1')]=function(){return function(){return client[_0x8ffc('0x2')](_0x8ffc('0x3'),{'options':{'attributes':['id','name',_0x8ffc('0x4'),_0x8ffc('0x5'),'email',_0x8ffc('0x6'),_0x8ffc('0x7'),_0x8ffc('0x8'),_0x8ffc('0x9')],'raw':![],'include':[{'model':_0x8ffc('0xa'),'as':_0x8ffc('0xb'),'include':[{'model':_0x8ffc('0xc'),'attributes':['id',_0x8ffc('0xd'),'service',_0x8ffc('0xe'),_0x8ffc('0xf')],'as':_0x8ffc('0xc')}]},{'model':_0x8ffc('0x10'),'as':_0x8ffc('0x11'),'include':[{'model':'CloudProvider','attributes':['id',_0x8ffc('0xd'),'service',_0x8ffc('0xe'),_0x8ffc('0xf')],'as':'CloudProvider'}]}]},'log':_0x8ffc('0x12')});};};exports[_0x8ffc('0x13')]=function(_0x3242d6,_0xd0aa81){return client['Request'](_0x8ffc('0x14'),{'account':{'id':_0x3242d6},'body':_0xd0aa81,'log':_0x8ffc('0x14')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 014419b..dd51913 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 _0x3a56=['GetSettings','../client','loginMailFrequency'];(function(_0xb65df6,_0x4331a4){var _0x4416bc=function(_0x592ea0){while(--_0x592ea0){_0xb65df6['push'](_0xb65df6['shift']());}};_0x4416bc(++_0x4331a4);}(_0x3a56,0xac));var _0x63a5=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x3a56[_0x17e771];return _0x1f3a6d;};'use strict';var client=require(_0x63a5('0x0'));exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x63a5('0x1')]},'log':_0x63a5('0x2')});}; \ No newline at end of file +var _0x7673=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x152f66,_0x26c348){var _0x1caa67=function(_0x2279e7){while(--_0x2279e7){_0x152f66['push'](_0x152f66['shift']());}};_0x1caa67(++_0x26c348);}(_0x7673,0x1e5));var _0x3767=function(_0x7b28fe,_0x14b077){_0x7b28fe=_0x7b28fe-0x0;var _0x3eea1b=_0x7673[_0x7b28fe];return _0x3eea1b;};'use strict';var client=require('../client');exports[_0x3767('0x0')]=function(){return client[_0x3767('0x1')](_0x3767('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3767('0x3')]},'log':_0x3767('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f71740e..13d01ce 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 4ef307d..2eba0c9 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 _0x7c93=['Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','timeout','port','websocket','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x7c93,0x1ba));var _0x37c9=function(_0x1e9b9a,_0x3a47f3){_0x1e9b9a=_0x1e9b9a-0x0;var _0x355171=_0x7c93[_0x1e9b9a];return _0x355171;};'use strict';var _=require(_0x37c9('0x0'));var http=require(_0x37c9('0x1'));var express=require(_0x37c9('0x2'));var sticky=require(_0x37c9('0x3'));var Redis=require(_0x37c9('0x4'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x37c9('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x37c9('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x37c9('0x7'),'polling']});config[_0x37c9('0x8')]=_['defaults'](config[_0x37c9('0x8')],{'host':_0x37c9('0x9'),'port':0x18eb});socketio[_0x37c9('0xa')](require(_0x37c9('0xb'))({'pubClient':new Redis(config[_0x37c9('0x8')]),'subClient':new Redis(config[_0x37c9('0x8')])}));require(_0x37c9('0xc'))['default']();require(_0x37c9('0xd'))[_0x37c9('0xe')](socketio);require(_0x37c9('0xf'))[_0x37c9('0xe')](app);require(_0x37c9('0x10'))[_0x37c9('0xe')](app);}else{server[_0x37c9('0x11')](_0x37c9('0x12'),function(){console[_0x37c9('0x13')](_0x37c9('0x14'),config[_0x37c9('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x2eb0=['../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express'];(function(_0x27f663,_0x7565ba){var _0x17cc0f=function(_0x5ed36f){while(--_0x5ed36f){_0x27f663['push'](_0x27f663['shift']());}};_0x17cc0f(++_0x7565ba);}(_0x2eb0,0x89));var _0x02eb=function(_0x43646,_0x296b96){_0x43646=_0x43646-0x0;var _0x18de62=_0x2eb0[_0x43646];return _0x18de62;};'use strict';var _=require(_0x02eb('0x0'));var http=require(_0x02eb('0x1'));var express=require(_0x02eb('0x2'));var sticky=require(_0x02eb('0x3'));var Redis=require(_0x02eb('0x4'));var config=require(_0x02eb('0x5'));var app=express();var server=http[_0x02eb('0x6')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x02eb('0x7')])){var socketio=require(_0x02eb('0x8'))(server,{'transports':['websocket',_0x02eb('0x9')]});config[_0x02eb('0xa')]=_['defaults'](config[_0x02eb('0xa')],{'host':_0x02eb('0xb'),'port':0x18eb});socketio[_0x02eb('0xc')](require(_0x02eb('0xd'))({'pubClient':new Redis(config[_0x02eb('0xa')]),'subClient':new Redis(config[_0x02eb('0xa')])}));require(_0x02eb('0xe'))[_0x02eb('0xf')]();require('../../config/socketio')[_0x02eb('0xf')](socketio);require(_0x02eb('0x10'))[_0x02eb('0xf')](app);require(_0x02eb('0x11'))[_0x02eb('0xf')](app);}else{server[_0x02eb('0x12')](_0x02eb('0x13'),function(){console['log'](_0x02eb('0x14'),config['port']);});}exports=module[_0x02eb('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 319f41a..bfc8355 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 _0xc6b1=['rpc','message','catch','exports','jayson/promise','bluebird','routing','client','http','request','then','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc6b1,0x1e4));var _0x1c6b=function(_0x355387,_0x257705){_0x355387=_0x355387-0x0;var _0x62617f=_0xc6b1[_0x355387];return _0x62617f;};'use strict';var jayson=require(_0x1c6b('0x0'));var BPromise=require(_0x1c6b('0x1'));var logger=require('../../config/logger')(_0x1c6b('0x2'));var client=jayson[_0x1c6b('0x3')][_0x1c6b('0x4')]({'port':0x2329});client['Request']=function(_0x529f15,_0x582858){return new BPromise(function(_0x2a307f,_0x15bdfa){return client[_0x1c6b('0x5')](_0x529f15,_0x582858)[_0x1c6b('0x6')](function(_0x25f33c){logger['debug']('rpc',_0x1c6b('0x2'),_0x529f15,_0x582858,_0x25f33c);if(_0x25f33c[_0x1c6b('0x7')]){logger[_0x1c6b('0x7')](_0x1c6b('0x8'),_0x1c6b('0x2'),_0x529f15,_0x25f33c[_0x1c6b('0x7')][_0x1c6b('0x9')],_0x582858);return _0x15bdfa(_0x25f33c[_0x1c6b('0x7')][_0x1c6b('0x9')]);}else{return _0x2a307f(_0x25f33c['result']);}})[_0x1c6b('0xa')](function(_0x15674a){logger[_0x1c6b('0x7')](_0x1c6b('0x8'),'routing',_0x529f15,_0x15674a,_0x582858);return _0x15bdfa(_0x15674a);});});};module[_0x1c6b('0xb')]=client; \ No newline at end of file +var _0x6e3a=['result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request','debug','rpc','routing','error','message'];(function(_0x538194,_0xf8a104){var _0x120d82=function(_0x78e82f){while(--_0x78e82f){_0x538194['push'](_0x538194['shift']());}};_0x120d82(++_0xf8a104);}(_0x6e3a,0xff));var _0xa6e3=function(_0x5d9ca7,_0x1ea975){_0x5d9ca7=_0x5d9ca7-0x0;var _0x4b6389=_0x6e3a[_0x5d9ca7];return _0x4b6389;};'use strict';var jayson=require(_0xa6e3('0x0'));var BPromise=require('bluebird');var logger=require(_0xa6e3('0x1'))('routing');var client=jayson[_0xa6e3('0x2')][_0xa6e3('0x3')]({'port':0x2329});client[_0xa6e3('0x4')]=function(_0x5c55d2,_0xf219fc){return new BPromise(function(_0x4fa9d9,_0x5056b6){return client[_0xa6e3('0x5')](_0x5c55d2,_0xf219fc)['then'](function(_0x3c6f2f){logger[_0xa6e3('0x6')](_0xa6e3('0x7'),_0xa6e3('0x8'),_0x5c55d2,_0xf219fc,_0x3c6f2f);if(_0x3c6f2f[_0xa6e3('0x9')]){logger[_0xa6e3('0x9')](_0xa6e3('0x7'),_0xa6e3('0x8'),_0x5c55d2,_0x3c6f2f[_0xa6e3('0x9')][_0xa6e3('0xa')],_0xf219fc);return _0x5056b6(_0x3c6f2f[_0xa6e3('0x9')][_0xa6e3('0xa')]);}else{return _0x4fa9d9(_0x3c6f2f[_0xa6e3('0xb')]);}})[_0xa6e3('0xc')](function(_0x3f7d06){logger[_0xa6e3('0x9')](_0xa6e3('0x7'),_0xa6e3('0x8'),_0x5c55d2,_0x3f7d06,_0xf219fc);return _0x5056b6(_0x3f7d06);});});};module[_0xa6e3('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 0e644e8..fe33964 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 _0xf790=['./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','./server','./realtime'];(function(_0x79a1b,_0x4392bf){var _0x31cef5=function(_0x879b92){while(--_0x879b92){_0x79a1b['push'](_0x79a1b['shift']());}};_0x31cef5(++_0x4392bf);}(_0xf790,0xfb));var _0x0f79=function(_0x46b2ca,_0xee59d6){_0x46b2ca=_0x46b2ca-0x0;var _0x4de573=_0xf790[_0x46b2ca];return _0x4de573;};'use strict';var BPromise=require('bluebird');var server=require(_0x0f79('0x0'));var Realtime=require(_0x0f79('0x1'));var user=require(_0x0f79('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x0f79('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x0f79('0x4'));var mailQueue=require(_0x0f79('0x5'));var faxQueue=require(_0x0f79('0x6'));var whatsappQueue=require(_0x0f79('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0f79('0x8')]()[_0x0f79('0x9')](user[_0x0f79('0xa')]())['then'](realtime['initAgents']())[_0x0f79('0x9')](interval[_0x0f79('0xb')]())[_0x0f79('0x9')](realtime['initIntervals']())[_0x0f79('0x9')](openchannelQueue[_0x0f79('0xc')]())[_0x0f79('0x9')](realtime[_0x0f79('0xd')]())[_0x0f79('0x9')](chatQueue[_0x0f79('0xe')]())[_0x0f79('0x9')](realtime['initChatQueues']())[_0x0f79('0x9')](smsQueue[_0x0f79('0xf')]())[_0x0f79('0x9')](realtime[_0x0f79('0x10')]())[_0x0f79('0x9')](mailQueue[_0x0f79('0x11')]())[_0x0f79('0x9')](realtime[_0x0f79('0x12')]())[_0x0f79('0x9')](faxQueue[_0x0f79('0x13')]())[_0x0f79('0x9')](realtime[_0x0f79('0x14')]())[_0x0f79('0x9')](whatsappQueue[_0x0f79('0x15')]())[_0x0f79('0x9')](realtime['initWhatsappQueues']())[_0x0f79('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x0f79('0x9')](function(_0x1bb584){return initRealtime();})[_0x0f79('0x9')](function(_0x510da2){return setInterval(initRealtime,0x1388);})[_0x0f79('0x16')](function(_0x5c721e){console['log'](_0x5c721e);});}main(); \ No newline at end of file +var _0x969e=['then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0x4acdfa,_0x279033){var _0x87a909=function(_0x557a03){while(--_0x557a03){_0x4acdfa['push'](_0x4acdfa['shift']());}};_0x87a909(++_0x279033);}(_0x969e,0x9c));var _0xe969=function(_0x35d39e,_0x39b8c2){_0x35d39e=_0x35d39e-0x0;var _0x4f0df8=_0x969e[_0x35d39e];return _0x4f0df8;};'use strict';var BPromise=require(_0xe969('0x0'));var server=require('./server');var Realtime=require(_0xe969('0x1'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xe969('0x2'));var faxQueue=require(_0xe969('0x3'));var whatsappQueue=require(_0xe969('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xe969('0x5')](user[_0xe969('0x6')]())[_0xe969('0x5')](realtime['initAgents']())[_0xe969('0x5')](interval[_0xe969('0x7')]())[_0xe969('0x5')](realtime['initIntervals']())[_0xe969('0x5')](openchannelQueue[_0xe969('0x8')]())[_0xe969('0x5')](realtime[_0xe969('0x9')]())['then'](chatQueue[_0xe969('0xa')]())[_0xe969('0x5')](realtime[_0xe969('0xb')]())[_0xe969('0x5')](smsQueue[_0xe969('0xc')]())[_0xe969('0x5')](realtime[_0xe969('0xd')]())[_0xe969('0x5')](mailQueue[_0xe969('0xe')]())[_0xe969('0x5')](realtime[_0xe969('0xf')]())[_0xe969('0x5')](faxQueue[_0xe969('0x10')]())['then'](realtime[_0xe969('0x11')]())[_0xe969('0x5')](whatsappQueue[_0xe969('0x12')]())[_0xe969('0x5')](realtime[_0xe969('0x13')]())[_0xe969('0x5')](function(){return realtime;});}function main(){return server[_0xe969('0x14')](realtime)[_0xe969('0x5')](function(_0x20061e){return initRealtime();})[_0xe969('0x5')](function(_0xbae68b){return setInterval(initRealtime,0x1388);})[_0xe969('0x15')](function(_0x4bb178){console[_0xe969('0x16')](_0x4bb178);});}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 a70c064..411dd8c 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x3baa05,_0x207228){_0x3baa05=_0x3baa05-0x0;var _0x3b2b8d=_0x1261[_0x3baa05];return _0x3b2b8d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x3d4e6a,_0x56ab68){var _0xb3ae87=function(_0x5ab6b1){while(--_0x5ab6b1){_0x3d4e6a['push'](_0x3d4e6a['shift']());}};_0xb3ae87(++_0x56ab68);}(_0xe14b,0x93));var _0xbe14=function(_0x12bab4,_0x189f77){_0x12bab4=_0x12bab4-0x0;var _0x347d8d=_0xe14b[_0x12bab4];return _0x347d8d;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 27bf0df..cd67dac 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 _0x5e42=['error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','http','request'];(function(_0x1dbfaa,_0x1eedb1){var _0x13df94=function(_0x8f1879){while(--_0x8f1879){_0x1dbfaa['push'](_0x1dbfaa['shift']());}};_0x13df94(++_0x1eedb1);}(_0x5e42,0xc2));var _0x25e4=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x5e42[_0x37c8ef];return _0x5eaee9;};'use strict';var BPromise=require(_0x25e4('0x0'));var jayson=require(_0x25e4('0x1'));var client=jayson['client'][_0x25e4('0x2')]({'port':0x232b});function request(_0x48a344,_0x26c08e){return new BPromise(function(_0x2f1068,_0x4d01b5){return client[_0x25e4('0x3')](_0x48a344,_0x26c08e)['then'](function(_0x26fb42){if(_0x26fb42[_0x25e4('0x4')]){return _0x4d01b5(_0x26fb42[_0x25e4('0x4')][_0x25e4('0x5')]);}else{return _0x2f1068(_0x26fb42[_0x25e4('0x6')]);}})['catch'](function(_0x1601fe){return _0x4d01b5(_0x1601fe);});});}exports[_0x25e4('0x7')]=function(_0x2905f9,_0x395bb7){return request(_0x25e4('0x8'),{'account':_0x2905f9,'message':_0x395bb7});}; \ No newline at end of file +var _0xa822=['SendMail','client','request','then','error','catch','sendMailMessage'];(function(_0x2566ae,_0x37b99a){var _0x5745c9=function(_0x4f9c2b){while(--_0x4f9c2b){_0x2566ae['push'](_0x2566ae['shift']());}};_0x5745c9(++_0x37b99a);}(_0xa822,0x182));var _0x2a82=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0xa822[_0x56085e];return _0x4de130;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x2a82('0x0')]['http']({'port':0x232b});function request(_0x8cb253,_0x4e8e42){return new BPromise(function(_0x15f6fc,_0x3e9625){return client[_0x2a82('0x1')](_0x8cb253,_0x4e8e42)[_0x2a82('0x2')](function(_0x182145){if(_0x182145[_0x2a82('0x3')]){return _0x3e9625(_0x182145[_0x2a82('0x3')]['message']);}else{return _0x15f6fc(_0x182145['result']);}})[_0x2a82('0x4')](function(_0x22df4e){return _0x3e9625(_0x22df4e);});});}exports[_0x2a82('0x5')]=function(_0x507dbe,_0x439497){return request(_0x2a82('0x6'),{'account':_0x507dbe,'message':_0x439497});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5ecd748..fcc9455 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 _0x560e=['smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','fax','sms','length','Status','StatusTime','toNumber','format','chatPause','chatStatusTime','mailCurrentCapacity','faxStatusTime','faxCurrentCapacity','smsStatusTime','whatsappStatus','stringify','emit','user:save','exports','moment','md5','redis','defaults','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','smsStatus'];(function(_0x4eca04,_0x403333){var _0x3308b3=function(_0x1b7465){while(--_0x1b7465){_0x4eca04['push'](_0x4eca04['shift']());}};_0x3308b3(++_0x403333);}(_0x560e,0x141));var _0xe560=function(_0x3d7183,_0x319b5f){_0x3d7183=_0x3d7183-0x0;var _0x5419ae=_0x560e[_0x3d7183];return _0x5419ae;};'use strict';var _=require('lodash');var moment=require(_0xe560('0x0'));var md5=require(_0xe560('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe560('0x2')]=_[_0xe560('0x3')](config[_0xe560('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe560('0x2')]));function Agent(_0x1cf103){this['id']=_0x1cf103['id']||0x0;this[_0xe560('0x4')]=_0x1cf103[_0xe560('0x4')]||'';this[_0xe560('0x5')]=_0x1cf103['online']||!![];this[_0xe560('0x6')]=_0x1cf103[_0xe560('0x6')]||![];this['chatPause']=_0x1cf103['chatPause']||![];this[_0xe560('0x7')]=_0x1cf103[_0xe560('0x7')]||![];this[_0xe560('0x8')]=_0x1cf103['faxPause']||![];this[_0xe560('0x9')]=_0x1cf103['smsPause']||![];this['openchannelPause']=_0x1cf103[_0xe560('0xa')]||![];this[_0xe560('0xb')]=_0xe560('0xc');this['chatStatusTime']=0x0;this['chatCapacity']=_0x1cf103[_0xe560('0xd')]||0x0;this[_0xe560('0xe')]=0x0;this[_0xe560('0xf')]=_0xe560('0xc');this[_0xe560('0x10')]=0x0;this[_0xe560('0x11')]=_0x1cf103[_0xe560('0x11')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xe560('0x12')]='unknown';this['faxStatusTime']=0x0;this[_0xe560('0x13')]=_0x1cf103[_0xe560('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xe560('0x14')]=_0xe560('0xc');this['smsStatusTime']=0x0;this[_0xe560('0x15')]=_0x1cf103['smsCapacity']||0x0;this[_0xe560('0x16')]=0x0;this['whatsappStatus']=_0xe560('0xc');this[_0xe560('0x17')]=0x0;this[_0xe560('0x18')]=_0x1cf103[_0xe560('0x18')]||0x0;this[_0xe560('0x19')]=0x0;this['openchannelStatus']=_0xe560('0xc');this[_0xe560('0x1a')]=0x0;this[_0xe560('0x1b')]=_0x1cf103[_0xe560('0x1b')]||0x0;this[_0xe560('0x1c')]=0x0;this[_0xe560('0x1d')]=![];this[_0xe560('0x1e')]=undefined;this['md5']='';this[_0xe560('0x1f')]();}Agent['prototype'][_0xe560('0x20')]=function(_0x4cb4c1){if(this[_0x4cb4c1+_0xe560('0x21')]>0x0){if(this[_0x4cb4c1+'Capacity']>0x0&&this[_0x4cb4c1+_0xe560('0x21')]>=this[_0x4cb4c1+_0xe560('0x22')]){return _0xe560('0x23');}else{return _0xe560('0x24');}}else{return _0xe560('0x25');}};Agent['prototype'][_0xe560('0x1f')]=function(){var _0x5dcefa=['mail',_0xe560('0x26'),'openchannel',_0xe560('0x27'),_0xe560('0x28'),'whatsapp'];for(var _0x168c84=0x0;_0x168c84<_0x5dcefa[_0xe560('0x29')];_0x168c84+=0x1){var _0x181964=this[_0xe560('0x20')](_0x5dcefa[_0x168c84]);if(this[_0x5dcefa[_0x168c84]+_0xe560('0x2a')]!==_0x181964){this[_0x5dcefa[_0x168c84]+_0xe560('0x2b')]=_[_0xe560('0x2c')](moment()[_0xe560('0x2d')]('x'));}this[_0x5dcefa[_0x168c84]+_0xe560('0x2a')]=_0x181964;}var _0x46835f={'id':this['id'],'name':this['name'],'online':this[_0xe560('0x5')],'voicePause':this[_0xe560('0x6')],'chatPause':this[_0xe560('0x2e')],'mailPause':this['mailPause'],'smsPause':this[_0xe560('0x9')],'faxPause':this['faxPause'],'openchannelPause':this[_0xe560('0xa')],'chatStatus':this[_0xe560('0xb')],'chatStatusTime':this[_0xe560('0x2f')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe560('0xe')],'mailStatus':this[_0xe560('0xf')],'mailStatusTime':this[_0xe560('0x10')],'mailCapacity':this[_0xe560('0x11')],'mailCurrentCapacity':this[_0xe560('0x30')],'faxStatus':this[_0xe560('0x12')],'faxStatusTime':this[_0xe560('0x31')],'faxCapacity':this[_0xe560('0x13')],'faxCurrentCapacity':this[_0xe560('0x32')],'smsStatus':this[_0xe560('0x14')],'smsStatusTime':this[_0xe560('0x33')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xe560('0x34')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xe560('0x18')],'whatsappCurrentCapacity':this[_0xe560('0x19')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xe560('0x1b')],'openchannelCurrentCapacity':this[_0xe560('0x1c')],'busy':this[_0xe560('0x1d')],'busyQueue':this[_0xe560('0x1e')]};var _0x2dfa4d=md5(JSON[_0xe560('0x35')](_0x46835f));if(this[_0xe560('0x1')]!==_0x2dfa4d){this[_0xe560('0x1')]=_0x2dfa4d;io[_0xe560('0x36')](_0xe560('0x37'),_0x46835f);}};module[_0xe560('0x38')]=Agent; \ No newline at end of file +var _0x884b=['faxStatus','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','length','toNumber','format','smsPause','chatStatusTime','openchannelCapacity','busy','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x884b,0x195));var _0xb884=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x884b[_0x1db481];return _0x3db95b;};'use strict';var _=require(_0xb884('0x0'));var moment=require(_0xb884('0x1'));var md5=require('md5');var Redis=require(_0xb884('0x2'));var config=require(_0xb884('0x3'));config[_0xb884('0x4')]=_[_0xb884('0x5')](config[_0xb884('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb884('0x6'))(new Redis(config[_0xb884('0x4')]));function Agent(_0x1cc29e){this['id']=_0x1cc29e['id']||0x0;this['name']=_0x1cc29e[_0xb884('0x7')]||'';this[_0xb884('0x8')]=_0x1cc29e[_0xb884('0x8')]||!![];this[_0xb884('0x9')]=_0x1cc29e['voicePause']||![];this[_0xb884('0xa')]=_0x1cc29e[_0xb884('0xa')]||![];this[_0xb884('0xb')]=_0x1cc29e[_0xb884('0xb')]||![];this[_0xb884('0xc')]=_0x1cc29e[_0xb884('0xc')]||![];this['smsPause']=_0x1cc29e['smsPause']||![];this[_0xb884('0xd')]=_0x1cc29e[_0xb884('0xd')]||![];this[_0xb884('0xe')]=_0xb884('0xf');this['chatStatusTime']=0x0;this['chatCapacity']=_0x1cc29e[_0xb884('0x10')]||0x0;this[_0xb884('0x11')]=0x0;this[_0xb884('0x12')]=_0xb884('0xf');this[_0xb884('0x13')]=0x0;this[_0xb884('0x14')]=_0x1cc29e[_0xb884('0x14')]||0x0;this[_0xb884('0x15')]=0x0;this[_0xb884('0x16')]=_0xb884('0xf');this[_0xb884('0x17')]=0x0;this['faxCapacity']=_0x1cc29e['faxCapacity']||0x0;this[_0xb884('0x18')]=0x0;this[_0xb884('0x19')]=_0xb884('0xf');this[_0xb884('0x1a')]=0x0;this[_0xb884('0x1b')]=_0x1cc29e[_0xb884('0x1b')]||0x0;this[_0xb884('0x1c')]=0x0;this[_0xb884('0x1d')]=_0xb884('0xf');this[_0xb884('0x1e')]=0x0;this[_0xb884('0x1f')]=_0x1cc29e[_0xb884('0x1f')]||0x0;this[_0xb884('0x20')]=0x0;this[_0xb884('0x21')]=_0xb884('0xf');this[_0xb884('0x22')]=0x0;this['openchannelCapacity']=_0x1cc29e['openchannelCapacity']||0x0;this[_0xb884('0x23')]=0x0;this['busy']=![];this[_0xb884('0x24')]=undefined;this[_0xb884('0x25')]='';this[_0xb884('0x26')]();}Agent[_0xb884('0x27')][_0xb884('0x28')]=function(_0x47d027){if(this[_0x47d027+_0xb884('0x29')]>0x0){if(this[_0x47d027+'Capacity']>0x0&&this[_0x47d027+_0xb884('0x29')]>=this[_0x47d027+'Capacity']){return _0xb884('0x2a');}else{return _0xb884('0x2b');}}else{return _0xb884('0x2c');}};Agent[_0xb884('0x27')][_0xb884('0x26')]=function(){var _0x13e056=[_0xb884('0x2d'),'chat',_0xb884('0x2e'),_0xb884('0x2f'),_0xb884('0x30'),_0xb884('0x31')];for(var _0xb4e811=0x0;_0xb4e811<_0x13e056[_0xb884('0x32')];_0xb4e811+=0x1){var _0x5490fe=this[_0xb884('0x28')](_0x13e056[_0xb4e811]);if(this[_0x13e056[_0xb4e811]+'Status']!==_0x5490fe){this[_0x13e056[_0xb4e811]+'StatusTime']=_[_0xb884('0x33')](moment()[_0xb884('0x34')]('x'));}this[_0x13e056[_0xb4e811]+'Status']=_0x5490fe;}var _0x31565d={'id':this['id'],'name':this['name'],'online':this[_0xb884('0x8')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xb884('0xb')],'smsPause':this[_0xb884('0x35')],'faxPause':this[_0xb884('0xc')],'openchannelPause':this[_0xb884('0xd')],'chatStatus':this[_0xb884('0xe')],'chatStatusTime':this[_0xb884('0x36')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xb884('0x11')],'mailStatus':this[_0xb884('0x12')],'mailStatusTime':this[_0xb884('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xb884('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xb884('0x17')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xb884('0x18')],'smsStatus':this[_0xb884('0x19')],'smsStatusTime':this[_0xb884('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xb884('0x1e')],'whatsappCapacity':this[_0xb884('0x1f')],'whatsappCurrentCapacity':this[_0xb884('0x20')],'openchannelStatus':this[_0xb884('0x21')],'openchannelStatusTime':this[_0xb884('0x22')],'openchannelCapacity':this[_0xb884('0x37')],'openchannelCurrentCapacity':this[_0xb884('0x23')],'busy':this[_0xb884('0x38')],'busyQueue':this[_0xb884('0x24')]};var _0xb8ebbc=md5(JSON[_0xb884('0x39')](_0x31565d));if(this[_0xb884('0x25')]!==_0xb8ebbc){this[_0xb884('0x25')]=_0xb8ebbc;io[_0xb884('0x3a')](_0xb884('0x3b'),_0x31565d);}};module[_0xb884('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b85f048..6e3d8e7 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 _0xd281=['paused','online','available','stringify','format','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn'];(function(_0x2609da,_0x54ff92){var _0x7f9b88=function(_0x4241f3){while(--_0x4241f3){_0x2609da['push'](_0x2609da['shift']());}};_0x7f9b88(++_0x54ff92);}(_0xd281,0xaf));var _0x1d28=function(_0x33a89f,_0x12e234){_0x33a89f=_0x33a89f-0x0;var _0x292f0c=_0xd281[_0x33a89f];return _0x292f0c;};'use strict';var _=require(_0x1d28('0x0'));var md5=require(_0x1d28('0x1'));var util=require(_0x1d28('0x2'));var Redis=require(_0x1d28('0x3'));var config=require(_0x1d28('0x4'));config[_0x1d28('0x5')]=_[_0x1d28('0x6')](config['redis'],{'host':_0x1d28('0x7'),'port':0x18eb});var io=require(_0x1d28('0x8'))(new Redis(config['redis']));function ChatQueue(_0x2b2d5e){this['id']=_0x2b2d5e['id']||0x0;this[_0x1d28('0x9')]=_0x2b2d5e[_0x1d28('0x9')]||'';this[_0x1d28('0xa')]=_0x2b2d5e['timeout']||0xa;this[_0x1d28('0xb')]=_0x2b2d5e[_0x1d28('0xb')]||'beepall';this[_0x1d28('0xc')]=_0x2b2d5e[_0x1d28('0xc')];this['mapAgentsId']={};this[_0x1d28('0xd')]=0x0;this['md5']='';this[_0x1d28('0xe')]();this[_0x1d28('0xf')]();}ChatQueue[_0x1d28('0x10')][_0x1d28('0xe')]=function(){var _0x52c21e=this[_0x1d28('0x11')][_0x1d28('0x12')];this[_0x1d28('0x11')]=_[_0x1d28('0x13')](this[_0x1d28('0xc')],'id');this['mapAgentsId'][_0x1d28('0x12')]=_0x52c21e;};ChatQueue[_0x1d28('0x10')][_0x1d28('0xf')]=function(){this[_0x1d28('0x14')]=0x0;this[_0x1d28('0x15')]=0x0;for(var _0x552c71=0x0;_0x552c71=0x0?this[_0x1d28('0x17')]:0x0;var _0x453abd={'id':this['id'],'available':this[_0x1d28('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x1d28('0x9')],'paused':this['paused'],'waiting':this[_0x1d28('0xd')]};var _0x5a442c=md5(JSON[_0x1d28('0x18')](_0x453abd));if(this[_0x1d28('0x1')]!==_0x5a442c){this[_0x1d28('0x1')]=_0x5a442c;io['to'](util[_0x1d28('0x19')]('chat:queue:%s',_0x453abd[_0x1d28('0x9')]))[_0x1d28('0x1a')](_0x1d28('0x1b'),_0x453abd);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x8610=['_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x456349,_0x2c3188){var _0xac41bd=function(_0x3bb4ff){while(--_0x3bb4ff){_0x456349['push'](_0x456349['shift']());}};_0xac41bd(++_0x2c3188);}(_0x8610,0x163));var _0x0861=function(_0x5e28f8,_0x2f819f){_0x5e28f8=_0x5e28f8-0x0;var _0x3b1668=_0x8610[_0x5e28f8];return _0x3b1668;};'use strict';var _=require(_0x0861('0x0'));var md5=require(_0x0861('0x1'));var util=require(_0x0861('0x2'));var Redis=require('ioredis');var config=require(_0x0861('0x3'));config[_0x0861('0x4')]=_[_0x0861('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0861('0x6'))(new Redis(config[_0x0861('0x4')]));function ChatQueue(_0x50d27f){this['id']=_0x50d27f['id']||0x0;this['name']=_0x50d27f[_0x0861('0x7')]||'';this[_0x0861('0x8')]=_0x50d27f[_0x0861('0x8')]||0xa;this[_0x0861('0x9')]=_0x50d27f['strategy']||_0x0861('0xa');this['Agents']=_0x50d27f[_0x0861('0xb')];this[_0x0861('0xc')]={};this[_0x0861('0xd')]=0x0;this[_0x0861('0x1')]='';this[_0x0861('0xe')]();this[_0x0861('0xf')]();}ChatQueue[_0x0861('0x10')][_0x0861('0xe')]=function(){var _0x33f67f=this[_0x0861('0xc')][_0x0861('0x11')];this[_0x0861('0xc')]=_[_0x0861('0x12')](this['Agents'],'id');this[_0x0861('0xc')]['_rr']=_0x33f67f;};ChatQueue[_0x0861('0x10')][_0x0861('0xf')]=function(){this[_0x0861('0x13')]=0x0;this[_0x0861('0x14')]=0x0;for(var _0x40f886=0x0;_0x40f886=0x0?this[_0x0861('0x18')]:0x0;var _0x2d7fd3={'id':this['id'],'available':this[_0x0861('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x0861('0x7')],'paused':this[_0x0861('0x14')],'waiting':this[_0x0861('0xd')]};var _0x66bc75=md5(JSON[_0x0861('0x19')](_0x2d7fd3));if(this[_0x0861('0x1')]!==_0x66bc75){this[_0x0861('0x1')]=_0x66bc75;io['to'](util[_0x0861('0x1a')](_0x0861('0x1b'),_0x2d7fd3['name']))[_0x0861('0x1c')](_0x0861('0x1d'),_0x2d7fd3);}};module[_0x0861('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 45d8bda..a9bf019 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 _0x9e11=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x500438,_0x3a05ec){var _0x14155a=function(_0x4680c9){while(--_0x4680c9){_0x500438['push'](_0x500438['shift']());}};_0x14155a(++_0x3a05ec);}(_0x9e11,0x15f));var _0x19e1=function(_0x1c7fc6,_0x1f7d27){_0x1c7fc6=_0x1c7fc6-0x0;var _0x2e4bf7=_0x9e11[_0x1c7fc6];return _0x2e4bf7;};'use strict';var _=require(_0x19e1('0x0'));var md5=require(_0x19e1('0x1'));var util=require(_0x19e1('0x2'));var Redis=require(_0x19e1('0x3'));var config=require(_0x19e1('0x4'));config[_0x19e1('0x5')]=_['defaults'](config[_0x19e1('0x5')],{'host':_0x19e1('0x6'),'port':0x18eb});var io=require(_0x19e1('0x7'))(new Redis(config['redis']));function FaxQueue(_0x27291a){this['id']=_0x27291a['id']||0x0;this[_0x19e1('0x8')]=_0x27291a['name']||'';this[_0x19e1('0x9')]=_0x27291a['timeout']||0xa;this[_0x19e1('0xa')]=_0x27291a['strategy']||_0x19e1('0xb');this[_0x19e1('0xc')]=_0x27291a['Agents'];this[_0x19e1('0xd')]={};this[_0x19e1('0xe')]=0x0;this[_0x19e1('0x1')]='';this[_0x19e1('0xf')]();this[_0x19e1('0x10')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x182712=this[_0x19e1('0xd')]['_rr'];this[_0x19e1('0xd')]=_['map'](this[_0x19e1('0xc')],'id');this['mapAgentsId'][_0x19e1('0x11')]=_0x182712;};FaxQueue['prototype'][_0x19e1('0x10')]=function(){this[_0x19e1('0x12')]=0x0;this[_0x19e1('0x13')]=0x0;for(var _0x5a74d4=0x0;_0x5a74d4=0x0?this[_0x19e1('0x16')]:0x0;var _0x1f4a62={'id':this['id'],'available':this[_0x19e1('0x16')],'loggedIn':this[_0x19e1('0x12')],'name':this[_0x19e1('0x8')],'paused':this[_0x19e1('0x13')],'waiting':this[_0x19e1('0xe')]};var _0xa4f77=md5(JSON[_0x19e1('0x17')](_0x1f4a62));if(this[_0x19e1('0x1')]!==_0xa4f77){this[_0x19e1('0x1')]=_0xa4f77;io['to'](util[_0x19e1('0x18')](_0x19e1('0x19'),_0x1f4a62[_0x19e1('0x8')]))['emit'](_0x19e1('0x1a'),_0x1f4a62);}};module[_0x19e1('0x1b')]=FaxQueue; \ No newline at end of file +var _0x08ad=['updateRouting','_rr','map','prototype','updateRealtime','paused','length','online','loggedIn','faxPause','available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x5cb93d,_0x4394e0){var _0x1e536a=function(_0x21483d){while(--_0x21483d){_0x5cb93d['push'](_0x5cb93d['shift']());}};_0x1e536a(++_0x4394e0);}(_0x08ad,0x89));var _0xd08a=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x08ad[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xd08a('0x0'));var md5=require(_0xd08a('0x1'));var util=require(_0xd08a('0x2'));var Redis=require(_0xd08a('0x3'));var config=require('../../../config/environment');config[_0xd08a('0x4')]=_[_0xd08a('0x5')](config[_0xd08a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd08a('0x6'))(new Redis(config[_0xd08a('0x4')]));function FaxQueue(_0x314373){this['id']=_0x314373['id']||0x0;this[_0xd08a('0x7')]=_0x314373['name']||'';this[_0xd08a('0x8')]=_0x314373[_0xd08a('0x8')]||0xa;this[_0xd08a('0x9')]=_0x314373[_0xd08a('0x9')]||_0xd08a('0xa');this[_0xd08a('0xb')]=_0x314373[_0xd08a('0xb')];this[_0xd08a('0xc')]={};this['waiting']=0x0;this[_0xd08a('0x1')]='';this[_0xd08a('0xd')]();this['updateRealtime']();}FaxQueue['prototype'][_0xd08a('0xd')]=function(){var _0x4406c4=this['mapAgentsId'][_0xd08a('0xe')];this[_0xd08a('0xc')]=_[_0xd08a('0xf')](this[_0xd08a('0xb')],'id');this[_0xd08a('0xc')][_0xd08a('0xe')]=_0x4406c4;};FaxQueue[_0xd08a('0x10')][_0xd08a('0x11')]=function(){this['loggedIn']=0x0;this[_0xd08a('0x12')]=0x0;for(var _0x22d1c8=0x0;_0x22d1c8=0x0?this['available']:0x0;var _0x472cd5={'id':this['id'],'available':this[_0xd08a('0x17')],'loggedIn':this[_0xd08a('0x15')],'name':this['name'],'paused':this[_0xd08a('0x12')],'waiting':this[_0xd08a('0x18')]};var _0x19356c=md5(JSON['stringify'](_0x472cd5));if(this['md5']!==_0x19356c){this['md5']=_0x19356c;io['to'](util[_0xd08a('0x19')](_0xd08a('0x1a'),_0x472cd5[_0xd08a('0x7')]))[_0xd08a('0x1b')](_0xd08a('0x1c'),_0x472cd5);}};module[_0xd08a('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index bd8758d..9816969 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 _0x5fd6=['name','Intervals','exports'];(function(_0x3d2345,_0x1fc9ac){var _0x3d1f0f=function(_0x529e28){while(--_0x529e28){_0x3d2345['push'](_0x3d2345['shift']());}};_0x3d1f0f(++_0x1fc9ac);}(_0x5fd6,0x168));var _0x65fd=function(_0x550aa0,_0x3a7264){_0x550aa0=_0x550aa0-0x0;var _0x25ba56=_0x5fd6[_0x550aa0];return _0x25ba56;};'use strict';function Interval(_0x43c5f2){this['id']=_0x43c5f2['id']||0x0;this[_0x65fd('0x0')]=_0x43c5f2[_0x65fd('0x0')]||'';this[_0x65fd('0x1')]=_0x43c5f2[_0x65fd('0x1')]||{};}module[_0x65fd('0x2')]=Interval; \ No newline at end of file +var _0xb3dd=['name','Intervals'];(function(_0x5b7537,_0x5283a0){var _0x285056=function(_0x1fa09c){while(--_0x1fa09c){_0x5b7537['push'](_0x5b7537['shift']());}};_0x285056(++_0x5283a0);}(_0xb3dd,0x1b4));var _0xdb3d=function(_0x119bc9,_0xb970d9){_0x119bc9=_0x119bc9-0x0;var _0x45a704=_0xb3dd[_0x119bc9];return _0x45a704;};'use strict';function Interval(_0x3fde94){this['id']=_0x3fde94['id']||0x0;this[_0xdb3d('0x0')]=_0x3fde94[_0xdb3d('0x0')]||'';this[_0xdb3d('0x1')]=_0x3fde94[_0xdb3d('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 2d71dc7..cb5ce71 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 _0x75bc=['mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','mailPause','available','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75bc,0x156));var _0xc75b=function(_0x3b39d1,_0x305984){_0x3b39d1=_0x3b39d1-0x0;var _0x5f302a=_0x75bc[_0x3b39d1];return _0x5f302a;};'use strict';var _=require(_0xc75b('0x0'));var md5=require(_0xc75b('0x1'));var util=require('util');var Redis=require(_0xc75b('0x2'));var config=require(_0xc75b('0x3'));config['redis']=_['defaults'](config[_0xc75b('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x1e6bb2){this['id']=_0x1e6bb2['id']||0x0;this['name']=_0x1e6bb2[_0xc75b('0x5')]||'';this[_0xc75b('0x6')]=_0x1e6bb2[_0xc75b('0x6')]||0xa;this[_0xc75b('0x7')]=_0x1e6bb2[_0xc75b('0x7')]||_0xc75b('0x8');this['Agents']=_0x1e6bb2[_0xc75b('0x9')];this[_0xc75b('0xa')]={};this[_0xc75b('0xb')]=0x0;this['md5']='';this[_0xc75b('0xc')]();this[_0xc75b('0xd')]();}MailQueue[_0xc75b('0xe')][_0xc75b('0xc')]=function(){var _0x40d579=this[_0xc75b('0xa')][_0xc75b('0xf')];this[_0xc75b('0xa')]=_[_0xc75b('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xc75b('0xf')]=_0x40d579;};MailQueue[_0xc75b('0xe')][_0xc75b('0xd')]=function(){this[_0xc75b('0x11')]=0x0;this[_0xc75b('0x12')]=0x0;for(var _0x894e09=0x0;_0x894e09=0x0?this[_0xc75b('0x14')]:0x0;var _0x21202d={'id':this['id'],'available':this[_0xc75b('0x14')],'loggedIn':this[_0xc75b('0x11')],'name':this['name'],'paused':this[_0xc75b('0x12')],'waiting':this[_0xc75b('0xb')]};var _0x508bd0=md5(JSON['stringify'](_0x21202d));if(this[_0xc75b('0x1')]!==_0x508bd0){this[_0xc75b('0x1')]=_0x508bd0;io['to'](util[_0xc75b('0x15')](_0xc75b('0x16'),_0x21202d[_0xc75b('0x5')]))[_0xc75b('0x17')](_0xc75b('0x18'),_0x21202d);}};module[_0xc75b('0x19')]=MailQueue; \ No newline at end of file +var _0x2418=['updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2418,0x1d1));var _0x8241=function(_0x522b78,_0x1115d5){_0x522b78=_0x522b78-0x0;var _0x1bf68b=_0x2418[_0x522b78];return _0x1bf68b;};'use strict';var _=require(_0x8241('0x0'));var md5=require(_0x8241('0x1'));var util=require(_0x8241('0x2'));var Redis=require(_0x8241('0x3'));var config=require(_0x8241('0x4'));config[_0x8241('0x5')]=_[_0x8241('0x6')](config[_0x8241('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8241('0x7'))(new Redis(config['redis']));function MailQueue(_0x554642){this['id']=_0x554642['id']||0x0;this[_0x8241('0x8')]=_0x554642[_0x8241('0x8')]||'';this[_0x8241('0x9')]=_0x554642[_0x8241('0x9')]||0xa;this[_0x8241('0xa')]=_0x554642['strategy']||_0x8241('0xb');this[_0x8241('0xc')]=_0x554642[_0x8241('0xc')];this[_0x8241('0xd')]={};this[_0x8241('0xe')]=0x0;this[_0x8241('0x1')]='';this[_0x8241('0xf')]();this[_0x8241('0x10')]();}MailQueue[_0x8241('0x11')]['updateRouting']=function(){var _0x2acbd1=this[_0x8241('0xd')]['_rr'];this['mapAgentsId']=_[_0x8241('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x8241('0x13')]=_0x2acbd1;};MailQueue[_0x8241('0x11')][_0x8241('0x10')]=function(){this[_0x8241('0x14')]=0x0;this[_0x8241('0x15')]=0x0;for(var _0x12913e=0x0;_0x12913e=0x0?this[_0x8241('0x19')]:0x0;var _0x1d5497={'id':this['id'],'available':this[_0x8241('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x8241('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x45abc8=md5(JSON[_0x8241('0x1a')](_0x1d5497));if(this[_0x8241('0x1')]!==_0x45abc8){this['md5']=_0x45abc8;io['to'](util[_0x8241('0x1b')](_0x8241('0x1c'),_0x1d5497['name']))[_0x8241('0x1d')](_0x8241('0x1e'),_0x1d5497);}};module[_0x8241('0x1f')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 0fd6001..6349a9f 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x326f,0xd1));var _0xf326=function(_0x39e622,_0x43c39e){_0x39e622=_0x39e622-0x0;var _0x48c2b0=_0x326f[_0x39e622];return _0x48c2b0;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3b3fdd,_0x2d3cbd){var _0x3a7077=function(_0x5a782f){while(--_0x5a782f){_0x3b3fdd['push'](_0x3b3fdd['shift']());}};_0x3a7077(++_0x2d3cbd);}(_0x814b,0x1a2));var _0xb814=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0x814b[_0x58b6c7];return _0x5f50d0;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 415a4da..3a36661 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 _0x89c3=['updateRealtime','_rr','prototype','loggedIn','online','smsPause','paused','available','name','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1f7746,_0x1fc648){var _0x528352=function(_0x2271b1){while(--_0x2271b1){_0x1f7746['push'](_0x1f7746['shift']());}};_0x528352(++_0x1fc648);}(_0x89c3,0xff));var _0x389c=function(_0xad944c,_0x59b9b9){_0xad944c=_0xad944c-0x0;var _0x3f97ae=_0x89c3[_0xad944c];return _0x3f97ae;};'use strict';var _=require(_0x389c('0x0'));var md5=require(_0x389c('0x1'));var util=require(_0x389c('0x2'));var Redis=require(_0x389c('0x3'));var config=require(_0x389c('0x4'));config[_0x389c('0x5')]=_[_0x389c('0x6')](config[_0x389c('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x389c('0x7'))(new Redis(config['redis']));function SmsQueue(_0x283ff9){this['id']=_0x283ff9['id']||0x0;this['name']=_0x283ff9['name']||'';this[_0x389c('0x8')]=_0x283ff9['timeout']||0xa;this['strategy']=_0x283ff9[_0x389c('0x9')]||_0x389c('0xa');this[_0x389c('0xb')]=_0x283ff9[_0x389c('0xb')];this[_0x389c('0xc')]={};this[_0x389c('0xd')]=0x0;this[_0x389c('0x1')]='';this[_0x389c('0xe')]();this[_0x389c('0xf')]();}SmsQueue['prototype'][_0x389c('0xe')]=function(){var _0xe6852f=this[_0x389c('0xc')][_0x389c('0x10')];this[_0x389c('0xc')]=_['map'](this['Agents'],'id');this[_0x389c('0xc')][_0x389c('0x10')]=_0xe6852f;};SmsQueue[_0x389c('0x11')]['updateRealtime']=function(){this[_0x389c('0x12')]=0x0;this['paused']=0x0;for(var _0x36e855=0x0;_0x36e855=0x0?this['available']:0x0;var _0x335c3e={'id':this['id'],'available':this[_0x389c('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x389c('0x17')],'paused':this[_0x389c('0x15')],'waiting':this[_0x389c('0xd')]};var _0x102637=md5(JSON[_0x389c('0x18')](_0x335c3e));if(this[_0x389c('0x1')]!==_0x102637){this[_0x389c('0x1')]=_0x102637;io['to'](util[_0x389c('0x19')](_0x389c('0x1a'),_0x335c3e['name']))[_0x389c('0x1b')](_0x389c('0x1c'),_0x335c3e);}};module[_0x389c('0x1d')]=SmsQueue; \ No newline at end of file +var _0x81bd=['updateRealtime','prototype','_rr','loggedIn','length','online','smsPause','available','paused','stringify','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x81bd,0x7c));var _0xd81b=function(_0x45ec0b,_0x260c5d){_0x45ec0b=_0x45ec0b-0x0;var _0x99a3d8=_0x81bd[_0x45ec0b];return _0x99a3d8;};'use strict';var _=require(_0xd81b('0x0'));var md5=require(_0xd81b('0x1'));var util=require(_0xd81b('0x2'));var Redis=require(_0xd81b('0x3'));var config=require(_0xd81b('0x4'));config[_0xd81b('0x5')]=_[_0xd81b('0x6')](config['redis'],{'host':_0xd81b('0x7'),'port':0x18eb});var io=require(_0xd81b('0x8'))(new Redis(config[_0xd81b('0x5')]));function SmsQueue(_0x4d8e7e){this['id']=_0x4d8e7e['id']||0x0;this[_0xd81b('0x9')]=_0x4d8e7e[_0xd81b('0x9')]||'';this[_0xd81b('0xa')]=_0x4d8e7e['timeout']||0xa;this['strategy']=_0x4d8e7e[_0xd81b('0xb')]||'beepall';this[_0xd81b('0xc')]=_0x4d8e7e[_0xd81b('0xc')];this[_0xd81b('0xd')]={};this[_0xd81b('0xe')]=0x0;this[_0xd81b('0x1')]='';this[_0xd81b('0xf')]();this[_0xd81b('0x10')]();}SmsQueue[_0xd81b('0x11')][_0xd81b('0xf')]=function(){var _0x23c789=this[_0xd81b('0xd')][_0xd81b('0x12')];this[_0xd81b('0xd')]=_['map'](this[_0xd81b('0xc')],'id');this['mapAgentsId'][_0xd81b('0x12')]=_0x23c789;};SmsQueue[_0xd81b('0x11')]['updateRealtime']=function(){this[_0xd81b('0x13')]=0x0;this['paused']=0x0;for(var _0x13dd00=0x0;_0x13dd00=0x0?this[_0xd81b('0x17')]:0x0;var _0x6746f0={'id':this['id'],'available':this[_0xd81b('0x17')],'loggedIn':this[_0xd81b('0x13')],'name':this[_0xd81b('0x9')],'paused':this[_0xd81b('0x18')],'waiting':this[_0xd81b('0xe')]};var _0xfa27e0=md5(JSON[_0xd81b('0x19')](_0x6746f0));if(this[_0xd81b('0x1')]!==_0xfa27e0){this[_0xd81b('0x1')]=_0xfa27e0;io['to'](util['format']('sms:queue:%s',_0x6746f0[_0xd81b('0x9')]))[_0xd81b('0x1a')](_0xd81b('0x1b'),_0x6746f0);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 58f9518..881637b 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 _0x4690=['defaults','localhost','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x4690,0x19e));var _0x0469=function(_0x367796,_0x11c4a6){_0x367796=_0x367796-0x0;var _0x4f75dd=_0x4690[_0x367796];return _0x4f75dd;};'use strict';var _=require(_0x0469('0x0'));var md5=require(_0x0469('0x1'));var util=require(_0x0469('0x2'));var Redis=require(_0x0469('0x3'));var config=require(_0x0469('0x4'));config[_0x0469('0x5')]=_[_0x0469('0x6')](config[_0x0469('0x5')],{'host':_0x0469('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x4919a9){this['id']=_0x4919a9['id']||0x0;this[_0x0469('0x8')]=_0x4919a9[_0x0469('0x8')]||'';this[_0x0469('0x9')]=_0x4919a9[_0x0469('0x9')]||0xa;this['strategy']=_0x4919a9[_0x0469('0xa')]||_0x0469('0xb');this[_0x0469('0xc')]=_0x4919a9[_0x0469('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x0469('0x1')]='';this['updateRouting']();this[_0x0469('0xd')]();}WhatsappQueue[_0x0469('0xe')]['updateRouting']=function(){var _0x1e96f2=this[_0x0469('0xf')][_0x0469('0x10')];this[_0x0469('0xf')]=_[_0x0469('0x11')](this[_0x0469('0xc')],'id');this[_0x0469('0xf')][_0x0469('0x10')]=_0x1e96f2;};WhatsappQueue['prototype'][_0x0469('0xd')]=function(){this[_0x0469('0x12')]=0x0;this[_0x0469('0x13')]=0x0;for(var _0x1666c0=0x0;_0x1666c0=0x0?this[_0x0469('0x17')]:0x0;var _0x58b0bf={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0469('0x12')],'name':this[_0x0469('0x8')],'paused':this['paused'],'waiting':this[_0x0469('0x18')]};var _0x4d25c5=md5(JSON['stringify'](_0x58b0bf));if(this[_0x0469('0x1')]!==_0x4d25c5){this[_0x0469('0x1')]=_0x4d25c5;io['to'](util[_0x0469('0x19')](_0x0469('0x1a'),_0x58b0bf[_0x0469('0x8')]))[_0x0469('0x1b')](_0x0469('0x1c'),_0x58b0bf);}};module[_0x0469('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x79d5=['waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0xcd3806,_0x3182ad){var _0x5e3594=function(_0x12874d){while(--_0x12874d){_0xcd3806['push'](_0xcd3806['shift']());}};_0x5e3594(++_0x3182ad);}(_0x79d5,0x91));var _0x579d=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x79d5[_0x1b6186];return _0x186121;};'use strict';var _=require('lodash');var md5=require(_0x579d('0x0'));var util=require(_0x579d('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x579d('0x2')](config[_0x579d('0x3')],{'host':_0x579d('0x4'),'port':0x18eb});var io=require(_0x579d('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x35dd53){this['id']=_0x35dd53['id']||0x0;this[_0x579d('0x6')]=_0x35dd53[_0x579d('0x6')]||'';this[_0x579d('0x7')]=_0x35dd53[_0x579d('0x7')]||0xa;this[_0x579d('0x8')]=_0x35dd53[_0x579d('0x8')]||'beepall';this['Agents']=_0x35dd53[_0x579d('0x9')];this[_0x579d('0xa')]={};this[_0x579d('0xb')]=0x0;this['md5']='';this[_0x579d('0xc')]();this[_0x579d('0xd')]();}WhatsappQueue[_0x579d('0xe')][_0x579d('0xc')]=function(){var _0x37f61f=this[_0x579d('0xa')]['_rr'];this[_0x579d('0xa')]=_['map'](this[_0x579d('0x9')],'id');this[_0x579d('0xa')][_0x579d('0xf')]=_0x37f61f;};WhatsappQueue[_0x579d('0xe')]['updateRealtime']=function(){this[_0x579d('0x10')]=0x0;this[_0x579d('0x11')]=0x0;for(var _0x298fd6=0x0;_0x298fd6=0x0?this[_0x579d('0x15')]:0x0;var _0xbf94bf={'id':this['id'],'available':this['available'],'loggedIn':this[_0x579d('0x10')],'name':this[_0x579d('0x6')],'paused':this[_0x579d('0x11')],'waiting':this[_0x579d('0xb')]};var _0x3f4dc1=md5(JSON[_0x579d('0x16')](_0xbf94bf));if(this[_0x579d('0x0')]!==_0x3f4dc1){this[_0x579d('0x0')]=_0x3f4dc1;io['to'](util[_0x579d('0x17')](_0x579d('0x18'),_0xbf94bf[_0x579d('0x6')]))[_0x579d('0x19')]('whatsapp_queue:save',_0xbf94bf);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c7e73bb..663fe89 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 ab2cc4f..2ecc34a 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 _0x8e5e=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x4f0ca8,_0x21b183){var _0x57c484=function(_0x4a0c36){while(--_0x4a0c36){_0x4f0ca8['push'](_0x4f0ca8['shift']());}};_0x57c484(++_0x21b183);}(_0x8e5e,0x10a));var _0xe8e5=function(_0x1c4903,_0x2c8ecd){_0x1c4903=_0x1c4903-0x0;var _0x1f0af5=_0x8e5e[_0x1c4903];return _0x1f0af5;};'use strict';var client=require(_0xe8e5('0x0'));exports[_0xe8e5('0x1')]=function(_0x20b02d,_0x41a385){return client[_0xe8e5('0x2')](_0xe8e5('0x3'),{'body':_0x41a385,'options':{'where':{'id':_0x20b02d}},'log':_0xe8e5('0x4')});};exports[_0xe8e5('0x5')]=function(_0x1bdd7f,_0x1de5ba){return client['Request'](_0xe8e5('0x6'),{'body':_0x1de5ba,'options':{'where':{'id':_0x1bdd7f}},'log':_0xe8e5('0x7')});}; \ No newline at end of file +var _0x65a0=['addTagsToChatInteraction','../client','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x65a0,0x1b4));var _0x065a=function(_0x433a53,_0x3b893a){_0x433a53=_0x433a53-0x0;var _0x31aaae=_0x65a0[_0x433a53];return _0x31aaae;};'use strict';var client=require(_0x065a('0x0'));exports['update']=function(_0x2304aa,_0x2d54dd){return client['Request'](_0x065a('0x1'),{'body':_0x2d54dd,'options':{'where':{'id':_0x2304aa}},'log':_0x065a('0x2')});};exports[_0x065a('0x3')]=function(_0x151f73,_0x29c7a5){return client['Request']('AddTagsToChatInteraction',{'body':_0x29c7a5,'options':{'where':{'id':_0x151f73}},'log':_0x065a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index d6ca004..24ec327 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 _0x8824=['create','Request','CreateChatMessage'];(function(_0x4e4096,_0x597e8c){var _0x37eb4c=function(_0x472136){while(--_0x472136){_0x4e4096['push'](_0x4e4096['shift']());}};_0x37eb4c(++_0x597e8c);}(_0x8824,0x96));var _0x4882=function(_0x56cdd6,_0x7b8552){_0x56cdd6=_0x56cdd6-0x0;var _0x305eaa=_0x8824[_0x56cdd6];return _0x305eaa;};'use strict';var client=require('../client');exports[_0x4882('0x0')]=function(_0x1bbf7c){return client[_0x4882('0x1')](_0x4882('0x2'),{'body':_0x1bbf7c,'log':'createChatMessage'});}; \ No newline at end of file +var _0x219a=['create','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x219a,0x158));var _0xa219=function(_0x50b78c,_0x1d573b){_0x50b78c=_0x50b78c-0x0;var _0x309a9a=_0x219a[_0x50b78c];return _0x309a9a;};'use strict';var client=require('../client');exports[_0xa219('0x0')]=function(_0x26f6ce){return client[_0xa219('0x1')]('CreateChatMessage',{'body':_0x26f6ce,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8d9a746..69c15f3 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 _0xc0a4=['Agents','name','chatPause','getChatQueues','Request','GetChatQueue','timeout','strategy','User'];(function(_0x4900e4,_0x125f32){var _0x3ed7f5=function(_0x3083c2){while(--_0x3083c2){_0x4900e4['push'](_0x4900e4['shift']());}};_0x3ed7f5(++_0x125f32);}(_0xc0a4,0x147));var _0x4c0a=function(_0x559ffc,_0x23b668){_0x559ffc=_0x559ffc-0x0;var _0x2c0412=_0xc0a4[_0x559ffc];return _0x2c0412;};'use strict';var client=require('../client');exports[_0x4c0a('0x0')]=function(){return function(){return client[_0x4c0a('0x1')](_0x4c0a('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4c0a('0x3'),_0x4c0a('0x4')],'include':[{'model':_0x4c0a('0x5'),'as':_0x4c0a('0x6'),'attributes':['id',_0x4c0a('0x7'),'online',_0x4c0a('0x8')]}]},'log':_0x4c0a('0x0')});};}; \ No newline at end of file +var _0x27bf=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0x30d249,_0xe500b9){var _0xa668f7=function(_0x3ddd61){while(--_0x3ddd61){_0x30d249['push'](_0x30d249['shift']());}};_0xa668f7(++_0xe500b9);}(_0x27bf,0x117));var _0xf27b=function(_0x314e4f,_0x5df5bb){_0x314e4f=_0x314e4f-0x0;var _0xbebf10=_0x27bf[_0x314e4f];return _0xbebf10;};'use strict';var client=require(_0xf27b('0x0'));exports[_0xf27b('0x1')]=function(){return function(){return client[_0xf27b('0x2')](_0xf27b('0x3'),{'options':{'raw':![],'attributes':['id',_0xf27b('0x4'),_0xf27b('0x5'),_0xf27b('0x6')],'include':[{'model':_0xf27b('0x7'),'as':_0xf27b('0x8'),'attributes':['id',_0xf27b('0x4'),_0xf27b('0x9'),'chatPause']}]},'log':_0xf27b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b95a00d..777b02c 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 _0x447b=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0x447b,0xe4));var _0xb447=function(_0x16f521,_0x528892){_0x16f521=_0x16f521-0x0;var _0x647a97=_0x447b[_0x16f521];return _0x647a97;};'use strict';var client=require(_0xb447('0x0'));exports[_0xb447('0x1')]=function(_0x5ea4fc){return client[_0xb447('0x2')](_0xb447('0x3'),{'body':_0x5ea4fc,'log':_0xb447('0x3')});};exports[_0xb447('0x4')]=function(_0xf3dd0a,_0xf8a88b){return client[_0xb447('0x2')](_0xb447('0x5'),{'body':_0xf8a88b,'options':{'where':{'uniqueid':_0xf3dd0a},'order':[['id',_0xb447('0x6')]],'limit':0x1},'log':_0xb447('0x5')});}; \ No newline at end of file +var _0x4ef1=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x311311,_0x1eef00){var _0x5be4ef=function(_0xb443a7){while(--_0xb443a7){_0x311311['push'](_0x311311['shift']());}};_0x5be4ef(++_0x1eef00);}(_0x4ef1,0xeb));var _0x14ef=function(_0xd4ac62,_0x396930){_0xd4ac62=_0xd4ac62-0x0;var _0x5f38d3=_0x4ef1[_0xd4ac62];return _0x5f38d3;};'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 3ea274d..776e799 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x45fd68,_0x3f60a2){var _0x2ff2b8=function(_0x4599bc){while(--_0x4599bc){_0x45fd68['push'](_0x45fd68['shift']());}};_0x2ff2b8(++_0x3f60a2);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x7a253,_0x3502bf){var _0x13a79d=function(_0x262c0f){while(--_0x262c0f){_0x7a253['push'](_0x7a253['shift']());}};_0x13a79d(++_0x3502bf);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 6e554fb..c3141e1 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 _0xa2eb=['CreateFaxMessage','createFaxMessage','Request'];(function(_0x1c0e09,_0x109a80){var _0x29363c=function(_0x230665){while(--_0x230665){_0x1c0e09['push'](_0x1c0e09['shift']());}};_0x29363c(++_0x109a80);}(_0xa2eb,0x131));var _0xba2e=function(_0x4a83f4,_0x50f589){_0x4a83f4=_0x4a83f4-0x0;var _0x1fc810=_0xa2eb[_0x4a83f4];return _0x1fc810;};'use strict';var client=require('../client');exports['create']=function(_0x329c90){return client[_0xba2e('0x0')](_0xba2e('0x1'),{'body':_0x329c90,'log':_0xba2e('0x2')});}; \ No newline at end of file +var _0xa87b=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x1670f8,_0x19f94d){var _0x4a0979=function(_0x45f5f4){while(--_0x45f5f4){_0x1670f8['push'](_0x1670f8['shift']());}};_0x4a0979(++_0x19f94d);}(_0xa87b,0x6e));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xba87('0x0'));exports[_0xba87('0x1')]=function(_0x2a9d3a){return client[_0xba87('0x2')](_0xba87('0x3'),{'body':_0x2a9d3a,'log':_0xba87('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 35c69cb..f851fc2 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 _0x2e16=['name','timeout','strategy','User','Agents','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2e16,0x1bf));var _0x62e1=function(_0x37d25c,_0x44ff78){_0x37d25c=_0x37d25c-0x0;var _0x2b0eb3=_0x2e16[_0x37d25c];return _0x2b0eb3;};'use strict';var client=require('../client');exports[_0x62e1('0x0')]=function(){return function(){return client[_0x62e1('0x1')](_0x62e1('0x2'),{'options':{'raw':![],'attributes':['id',_0x62e1('0x3'),_0x62e1('0x4'),_0x62e1('0x5')],'include':[{'model':_0x62e1('0x6'),'as':_0x62e1('0x7'),'attributes':['id','name','online',_0x62e1('0x8')]}]},'log':_0x62e1('0x0')});};}; \ No newline at end of file +var _0x7ffd=['GetFaxQueue','name','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request'];(function(_0x206339,_0x272c50){var _0x37ba6f=function(_0x1d0f53){while(--_0x1d0f53){_0x206339['push'](_0x206339['shift']());}};_0x37ba6f(++_0x272c50);}(_0x7ffd,0x16f));var _0xd7ff=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x7ffd[_0x100e36];return _0x1df0c9;};'use strict';var client=require(_0xd7ff('0x0'));exports[_0xd7ff('0x1')]=function(){return function(){return client[_0xd7ff('0x2')](_0xd7ff('0x3'),{'options':{'raw':![],'attributes':['id',_0xd7ff('0x4'),'timeout',_0xd7ff('0x5')],'include':[{'model':_0xd7ff('0x6'),'as':_0xd7ff('0x7'),'attributes':['id',_0xd7ff('0x4'),_0xd7ff('0x8'),_0xd7ff('0x9')]}]},'log':_0xd7ff('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 38b0bc8..1dec14b 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 _0xc11b=['CreateFaxQueueReport','DESC','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc11b,0x1a1));var _0xbc11=function(_0x5d5ea3,_0x3d2c62){_0x5d5ea3=_0x5d5ea3-0x0;var _0x564782=_0xc11b[_0x5d5ea3];return _0x564782;};'use strict';var client=require(_0xbc11('0x0'));exports[_0xbc11('0x1')]=function(_0x229acf){return client[_0xbc11('0x2')](_0xbc11('0x3'),{'body':_0x229acf,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x34bbe7,_0x43a87a){return client['Request']('UpdateFaxQueueReport',{'body':_0x43a87a,'options':{'where':{'uniqueid':_0x34bbe7},'order':[['id',_0xbc11('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x6711=['create','Request','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x2aad02,_0x556ae7){var _0x546e5b=function(_0x129356){while(--_0x129356){_0x2aad02['push'](_0x2aad02['shift']());}};_0x546e5b(++_0x556ae7);}(_0x6711,0x6b));var _0x1671=function(_0xb20b3f,_0x4ac2ce){_0xb20b3f=_0xb20b3f-0x0;var _0x413304=_0x6711[_0xb20b3f];return _0x413304;};'use strict';var client=require(_0x1671('0x0'));exports[_0x1671('0x1')]=function(_0x534b50){return client[_0x1671('0x2')]('CreateFaxQueueReport',{'body':_0x534b50,'log':'CreateFaxQueueReport'});};exports[_0x1671('0x3')]=function(_0x45fa71,_0x5c5faf){return client[_0x1671('0x2')](_0x1671('0x4'),{'body':_0x5c5faf,'options':{'where':{'uniqueid':_0x45fa71},'order':[['id',_0x1671('0x5')]],'limit':0x1},'log':_0x1671('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b986b3b..08d6e6d 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 _0xe08e=['name','Interval','Intervals','interval','getIntervals','Request','GetInterval'];(function(_0x473db8,_0x19a2eb){var _0x27334e=function(_0x4fd2cd){while(--_0x4fd2cd){_0x473db8['push'](_0x473db8['shift']());}};_0x27334e(++_0x19a2eb);}(_0xe08e,0xbb));var _0xee08=function(_0x35a6a5,_0x1abeee){_0x35a6a5=_0x35a6a5-0x0;var _0x56e3b0=_0xe08e[_0x35a6a5];return _0x56e3b0;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xee08('0x0')](_0xee08('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xee08('0x2')],'include':[{'model':_0xee08('0x3'),'as':_0xee08('0x4'),'attributes':['id',_0xee08('0x2'),_0xee08('0x5')]}]},'log':_0xee08('0x6')});};}; \ No newline at end of file +var _0x5afd=['getIntervals','../client','Request','GetInterval','name','Interval','Intervals'];(function(_0xd077aa,_0x284f7d){var _0x17068d=function(_0x506871){while(--_0x506871){_0xd077aa['push'](_0xd077aa['shift']());}};_0x17068d(++_0x284f7d);}(_0x5afd,0x127));var _0xd5af=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x5afd[_0x2125f0];return _0x12d6eb;};'use strict';var client=require(_0xd5af('0x0'));exports['getIntervals']=function(){return function(){return client[_0xd5af('0x1')](_0xd5af('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd5af('0x3')],'include':[{'model':_0xd5af('0x4'),'as':_0xd5af('0x5'),'attributes':['id',_0xd5af('0x3'),'interval']}]},'log':_0xd5af('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f5e5a0e..bb00cea 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 _0x1967=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x94c3f,_0x280854){var _0x5b181a=function(_0x85ccc5){while(--_0x85ccc5){_0x94c3f['push'](_0x94c3f['shift']());}};_0x5b181a(++_0x280854);}(_0x1967,0x173));var _0x7196=function(_0x428e0a,_0x4b82e6){_0x428e0a=_0x428e0a-0x0;var _0x25ff8e=_0x1967[_0x428e0a];return _0x25ff8e;};'use strict';var client=require('../client');exports[_0x7196('0x0')]=function(_0xdb72bb,_0x4d0a98){return client[_0x7196('0x1')](_0x7196('0x2'),{'body':_0x4d0a98,'options':{'where':{'id':_0xdb72bb}},'log':_0x7196('0x3')});};exports[_0x7196('0x4')]=function(_0x1aaddd,_0x458ae8){return client[_0x7196('0x1')]('AddTagsToMailInteraction',{'body':_0x458ae8,'options':{'where':{'id':_0x1aaddd}},'log':_0x7196('0x5')});}; \ No newline at end of file +var _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x2ba979,_0x3fc376){var _0x1a407c=function(_0x4ba58a){while(--_0x4ba58a){_0x2ba979['push'](_0x2ba979['shift']());}};_0x1a407c(++_0x3fc376);}(_0x3de3,0x1ce));var _0x33de=function(_0x3041ce,_0x4cbd52){_0x3041ce=_0x3041ce-0x0;var _0x2b5850=_0x3de3[_0x3041ce];return _0x2b5850;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'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 b5c819b..88f5187 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 _0xbec8=['create','createMailMessage','../client'];(function(_0x18e1b7,_0x136076){var _0x520aad=function(_0x2931e3){while(--_0x2931e3){_0x18e1b7['push'](_0x18e1b7['shift']());}};_0x520aad(++_0x136076);}(_0xbec8,0x1df));var _0x8bec=function(_0x8c51b6,_0x431aff){_0x8c51b6=_0x8c51b6-0x0;var _0x2fe4b7=_0xbec8[_0x8c51b6];return _0x2fe4b7;};'use strict';var client=require(_0x8bec('0x0'));exports[_0x8bec('0x1')]=function(_0x1e754f){return client['Request']('CreateMailMessage',{'body':_0x1e754f,'log':_0x8bec('0x2')});}; \ No newline at end of file +var _0x3a25=['create','Request','createMailMessage','../client'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3a25,0x1bb));var _0x53a2=function(_0x5db016,_0x3f2163){_0x5db016=_0x5db016-0x0;var _0x1cb524=_0x3a25[_0x5db016];return _0x1cb524;};'use strict';var client=require(_0x53a2('0x0'));exports[_0x53a2('0x1')]=function(_0x4b259f){return client[_0x53a2('0x2')]('CreateMailMessage',{'body':_0x4b259f,'log':_0x53a2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ef13f3f..5c00208 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 _0x3c82=['mailPause','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','name'];(function(_0xcc9e6c,_0x526103){var _0x184863=function(_0x161d11){while(--_0x161d11){_0xcc9e6c['push'](_0xcc9e6c['shift']());}};_0x184863(++_0x526103);}(_0x3c82,0xeb));var _0x23c8=function(_0x29fcaf,_0x20c943){_0x29fcaf=_0x29fcaf-0x0;var _0x4adcb2=_0x3c82[_0x29fcaf];return _0x4adcb2;};'use strict';var client=require('../client');exports[_0x23c8('0x0')]=function(){return function(){return client[_0x23c8('0x1')](_0x23c8('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x23c8('0x3'),_0x23c8('0x4')],'include':[{'model':_0x23c8('0x5'),'as':_0x23c8('0x6'),'attributes':['id',_0x23c8('0x7'),'online',_0x23c8('0x8')]}]},'log':_0x23c8('0x0')});};}; \ No newline at end of file +var _0xa8e3=['GetMailQueue','timeout','strategy','User','Agents','name','mailPause','../client','getMailQueues','Request'];(function(_0xd3f853,_0xccd664){var _0x414a6e=function(_0x5cb100){while(--_0x5cb100){_0xd3f853['push'](_0xd3f853['shift']());}};_0x414a6e(++_0xccd664);}(_0xa8e3,0x101));var _0x3a8e=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xa8e3[_0x3203a1];return _0x24215e;};'use strict';var client=require(_0x3a8e('0x0'));exports[_0x3a8e('0x1')]=function(){return function(){return client[_0x3a8e('0x2')](_0x3a8e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3a8e('0x4'),_0x3a8e('0x5')],'include':[{'model':_0x3a8e('0x6'),'as':_0x3a8e('0x7'),'attributes':['id',_0x3a8e('0x8'),'online',_0x3a8e('0x9')]}]},'log':_0x3a8e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1697e86..6a3a715 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 _0x24b7=['DESC','../client','create','Request'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0x24b7,0xe9));var _0x724b=function(_0x2190e4,_0x461535){_0x2190e4=_0x2190e4-0x0;var _0x2bef97=_0x24b7[_0x2190e4];return _0x2bef97;};'use strict';var client=require(_0x724b('0x0'));exports[_0x724b('0x1')]=function(_0xab8940){return client[_0x724b('0x2')]('CreateMailQueueReport',{'body':_0xab8940,'log':'CreateMailQueueReport'});};exports['update']=function(_0x5d4719,_0x4a2740){return client['Request']('UpdateMailQueueReport',{'body':_0x4a2740,'options':{'where':{'uniqueid':_0x5d4719},'order':[['id',_0x724b('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x1160=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0x1160,0x1e9));var _0x0116=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0x1160[_0x112e2a];return _0x4f8af9;};'use strict';var client=require(_0x0116('0x0'));exports[_0x0116('0x1')]=function(_0x582201){return client[_0x0116('0x2')](_0x0116('0x3'),{'body':_0x582201,'log':'CreateMailQueueReport'});};exports['update']=function(_0x652f95,_0x4b7c08){return client[_0x0116('0x2')](_0x0116('0x4'),{'body':_0x4b7c08,'options':{'where':{'uniqueid':_0x652f95},'order':[['id',_0x0116('0x5')]],'limit':0x1},'log':_0x0116('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5a77781..a8f53c1 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 _0x04db=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x250985,_0x2f37b4){var _0x4a7bb0=function(_0x4589e8){while(--_0x4589e8){_0x250985['push'](_0x250985['shift']());}};_0x4a7bb0(++_0x2f37b4);}(_0x04db,0xd7));var _0xb04d=function(_0x4033c8,_0x16a128){_0x4033c8=_0x4033c8-0x0;var _0x297027=_0x04db[_0x4033c8];return _0x297027;};'use strict';var client=require(_0xb04d('0x0'));exports['update']=function(_0xd783a0,_0x46e0cd){return client[_0xb04d('0x1')](_0xb04d('0x2'),{'body':_0x46e0cd,'options':{'where':{'id':_0xd783a0}},'log':_0xb04d('0x3')});};exports[_0xb04d('0x4')]=function(_0x2a0f08,_0x14b748){return client['Request'](_0xb04d('0x5'),{'body':_0x14b748,'options':{'where':{'id':_0x2a0f08}},'log':_0xb04d('0x6')});}; \ No newline at end of file +var _0xb868=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x88c775,_0x103950){var _0x4b17cc=function(_0x2155d4){while(--_0x2155d4){_0x88c775['push'](_0x88c775['shift']());}};_0x4b17cc(++_0x103950);}(_0xb868,0x1db));var _0x8b86=function(_0x46829f,_0x43dfb7){_0x46829f=_0x46829f-0x0;var _0x2d1b30=_0xb868[_0x46829f];return _0x2d1b30;};'use strict';var client=require(_0x8b86('0x0'));exports[_0x8b86('0x1')]=function(_0x5d8f25,_0x4b2d42){return client['Request'](_0x8b86('0x2'),{'body':_0x4b2d42,'options':{'where':{'id':_0x5d8f25}},'log':_0x8b86('0x3')});};exports[_0x8b86('0x4')]=function(_0x36578a,_0x5f465c){return client[_0x8b86('0x5')](_0x8b86('0x6'),{'body':_0x5f465c,'options':{'where':{'id':_0x36578a}},'log':_0x8b86('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 6de4131..aec2dd3 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 _0x270f=['create','Request','CreateOpenchannelMessage'];(function(_0xd41069,_0x3dd47d){var _0x1262d8=function(_0xff173a){while(--_0xff173a){_0xd41069['push'](_0xd41069['shift']());}};_0x1262d8(++_0x3dd47d);}(_0x270f,0xd8));var _0xf270=function(_0x4cb272,_0x52c0e9){_0x4cb272=_0x4cb272-0x0;var _0x57b4aa=_0x270f[_0x4cb272];return _0x57b4aa;};'use strict';var client=require('../client');exports[_0xf270('0x0')]=function(_0xc57dd1){return client[_0xf270('0x1')](_0xf270('0x2'),{'body':_0xc57dd1,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x3661=['../client','Request','CreateOpenchannelMessage'];(function(_0x2f0f90,_0x411945){var _0x3da03a=function(_0xf37754){while(--_0xf37754){_0x2f0f90['push'](_0x2f0f90['shift']());}};_0x3da03a(++_0x411945);}(_0x3661,0xae));var _0x1366=function(_0x32e1d9,_0x246def){_0x32e1d9=_0x32e1d9-0x0;var _0x3b0c4d=_0x3661[_0x32e1d9];return _0x3b0c4d;};'use strict';var client=require(_0x1366('0x0'));exports['create']=function(_0x8182c3){return client[_0x1366('0x1')](_0x1366('0x2'),{'body':_0x8182c3,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d31c063..92befc2 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 _0x0f28=['online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy','Agents'];(function(_0x2d517e,_0x42bd37){var _0x1ab245=function(_0x16f4b5){while(--_0x16f4b5){_0x2d517e['push'](_0x2d517e['shift']());}};_0x1ab245(++_0x42bd37);}(_0x0f28,0x85));var _0x80f2=function(_0x208128,_0x9e2557){_0x208128=_0x208128-0x0;var _0x213a02=_0x0f28[_0x208128];return _0x213a02;};'use strict';var client=require(_0x80f2('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x80f2('0x1')](_0x80f2('0x2'),{'options':{'raw':![],'attributes':['id',_0x80f2('0x3'),_0x80f2('0x4'),_0x80f2('0x5')],'include':[{'model':'User','as':_0x80f2('0x6'),'attributes':['id',_0x80f2('0x3'),_0x80f2('0x7'),_0x80f2('0x8')]}]},'log':_0x80f2('0x9')});};}; \ No newline at end of file +var _0xd14c=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents'];(function(_0x3b3ec5,_0x365d68){var _0x827b73=function(_0x181e00){while(--_0x181e00){_0x3b3ec5['push'](_0x3b3ec5['shift']());}};_0x827b73(++_0x365d68);}(_0xd14c,0x142));var _0xcd14=function(_0x42997b,_0x56239d){_0x42997b=_0x42997b-0x0;var _0x588775=_0xd14c[_0x42997b];return _0x588775;};'use strict';var client=require('../client');exports[_0xcd14('0x0')]=function(){return function(){return client[_0xcd14('0x1')](_0xcd14('0x2'),{'options':{'raw':![],'attributes':['id',_0xcd14('0x3'),_0xcd14('0x4'),_0xcd14('0x5')],'include':[{'model':'User','as':_0xcd14('0x6'),'attributes':['id','name','online','openchannelPause']}]},'log':_0xcd14('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2357a61..9e10b91 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 _0xb666=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x402311,_0x21f1f8){var _0x359ab1=function(_0xbb2424){while(--_0xbb2424){_0x402311['push'](_0x402311['shift']());}};_0x359ab1(++_0x21f1f8);}(_0xb666,0x1e6));var _0x6b66=function(_0x20ea26,_0x5512f8){_0x20ea26=_0x20ea26-0x0;var _0xcbc4d7=_0xb666[_0x20ea26];return _0xcbc4d7;};'use strict';var client=require(_0x6b66('0x0'));exports[_0x6b66('0x1')]=function(_0x353493){return client[_0x6b66('0x2')](_0x6b66('0x3'),{'body':_0x353493,'log':_0x6b66('0x3')});};exports['update']=function(_0x3474c2,_0x272f81){return client[_0x6b66('0x2')](_0x6b66('0x4'),{'body':_0x272f81,'options':{'where':{'uniqueid':_0x3474c2},'order':[['id',_0x6b66('0x5')]],'limit':0x1},'log':_0x6b66('0x4')});}; \ No newline at end of file +var _0x4845=['Request','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4845,0x1a8));var _0x5484=function(_0x2e6815,_0x3de5cb){_0x2e6815=_0x2e6815-0x0;var _0x838205=_0x4845[_0x2e6815];return _0x838205;};'use strict';var client=require(_0x5484('0x0'));exports[_0x5484('0x1')]=function(_0x17e2ee){return client[_0x5484('0x2')]('CreateOpenchannelQueueReport',{'body':_0x17e2ee,'log':'CreateOpenchannelQueueReport'});};exports[_0x5484('0x3')]=function(_0x11d37c,_0x2fac44){return client[_0x5484('0x2')](_0x5484('0x4'),{'body':_0x2fac44,'options':{'where':{'uniqueid':_0x11d37c},'order':[['id',_0x5484('0x5')]],'limit':0x1},'log':_0x5484('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f2fbb99..cfe785b 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 _0x3435=['Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x4d0810,_0x13e15f){var _0x3e47e0=function(_0x202853){while(--_0x202853){_0x4d0810['push'](_0x4d0810['shift']());}};_0x3e47e0(++_0x13e15f);}(_0x3435,0xfa));var _0x5343=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x3435[_0x28611e];return _0x530f69;};'use strict';var client=require(_0x5343('0x0'));exports[_0x5343('0x1')]=function(_0x84fe04,_0x9ab4a3){return client[_0x5343('0x2')](_0x5343('0x3'),{'body':_0x9ab4a3,'options':{'where':{'id':_0x84fe04}},'log':'updateSmsInteraction'});};exports[_0x5343('0x4')]=function(_0x3ae07e,_0x578a24){return client['Request'](_0x5343('0x5'),{'body':_0x578a24,'options':{'where':{'id':_0x3ae07e}},'log':_0x5343('0x6')});}; \ No newline at end of file +var _0xa4fb=['../client','update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x2ad95b,_0x1142ff){var _0x5654ce=function(_0x59b3e4){while(--_0x59b3e4){_0x2ad95b['push'](_0x2ad95b['shift']());}};_0x5654ce(++_0x1142ff);}(_0xa4fb,0x150));var _0xba4f=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xa4fb[_0x561f25];return _0x150e4c;};'use strict';var client=require(_0xba4f('0x0'));exports[_0xba4f('0x1')]=function(_0x45a5dc,_0x473226){return client['Request']('UpdateSmsInteraction',{'body':_0x473226,'options':{'where':{'id':_0x45a5dc}},'log':_0xba4f('0x2')});};exports[_0xba4f('0x3')]=function(_0x27a519,_0x4ac34c){return client[_0xba4f('0x4')](_0xba4f('0x5'),{'body':_0x4ac34c,'options':{'where':{'id':_0x27a519}},'log':_0xba4f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d0d4e91..fb256e8 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 _0x95bd=['createSmsMessage','../client','create','Request'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x95bd,0x169));var _0xd95b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95bd[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xd95b('0x0'));exports[_0xd95b('0x1')]=function(_0x31108a){return client[_0xd95b('0x2')]('CreateSmsMessage',{'body':_0x31108a,'log':_0xd95b('0x3')});}; \ No newline at end of file +var _0x6741=['../client','create','Request','CreateSmsMessage'];(function(_0x5bfee6,_0x3e9443){var _0x4aad05=function(_0x5ab2da){while(--_0x5ab2da){_0x5bfee6['push'](_0x5bfee6['shift']());}};_0x4aad05(++_0x3e9443);}(_0x6741,0x80));var _0x1674=function(_0x370c7f,_0x5284c9){_0x370c7f=_0x370c7f-0x0;var _0x2a2a04=_0x6741[_0x370c7f];return _0x2a2a04;};'use strict';var client=require(_0x1674('0x0'));exports[_0x1674('0x1')]=function(_0x367be3){return client[_0x1674('0x2')](_0x1674('0x3'),{'body':_0x367be3,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 39f1da3..e46e173 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x5ba5fe,_0x240d8a){var _0x60aae8=function(_0x36fdfe){while(--_0x36fdfe){_0x5ba5fe['push'](_0x5ba5fe['shift']());}};_0x60aae8(++_0x240d8a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x56a3a4,_0x3ef7cf){var _0xb96e1f=function(_0x1b9ae4){while(--_0x1b9ae4){_0x56a3a4['push'](_0x56a3a4['shift']());}};_0xb96e1f(++_0x3ef7cf);}(_0xe706,0xa3));var _0x6e70=function(_0x35e768,_0xbe0d60){_0x35e768=_0x35e768-0x0;var _0x58cc5f=_0xe706[_0x35e768];return _0x58cc5f;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 31d8a44..09f4e4b 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xedd9,0xfc));var _0x9edd=function(_0x3aed24,_0x2e66bc){_0x3aed24=_0x3aed24-0x0;var _0x5ac16b=_0xedd9[_0x3aed24];return _0x5ac16b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2d69bc,_0x2c63b9){var _0x4dec44=function(_0x403e39){while(--_0x403e39){_0x2d69bc['push'](_0x2d69bc['shift']());}};_0x4dec44(++_0x2c63b9);}(_0x55ca,0x126));var _0xa55c=function(_0x5d76cc,_0x195736){_0x5d76cc=_0x5d76cc-0x0;var _0x4acce4=_0x55ca[_0x5d76cc];return _0x4acce4;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 40616ea..6ec7abc 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(_0x17cf7c,_0x4b0ac0){var _0x47f948=function(_0x358008){while(--_0x358008){_0x17cf7c['push'](_0x17cf7c['shift']());}};_0x47f948(++_0x4b0ac0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x2ab0fb,_0xf21f9e){var _0x578c50=function(_0x1223b3){while(--_0x1223b3){_0x2ab0fb['push'](_0x2ab0fb['shift']());}};_0x578c50(++_0xf21f9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 820570a..cef2240 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 _0xe2fe=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xee2f('0x0'));exports['update']=function(_0x521787,_0xb0780a){return client['Request'](_0xee2f('0x1'),{'body':_0xb0780a,'options':{'where':{'id':_0x521787}},'log':_0xee2f('0x2')});};exports[_0xee2f('0x3')]=function(_0x2d2b03,_0xcb45e6){return client['Request'](_0xee2f('0x4'),{'body':_0xcb45e6,'options':{'where':{'id':_0x2d2b03}},'log':_0xee2f('0x5')});}; \ No newline at end of file +var _0xfcbe=['updateWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x32aa44,_0x380234){_0x32aa44=_0x32aa44-0x0;var _0x4b0211=_0xfcbe[_0x32aa44];return _0x4b0211;};'use strict';var client=require('../client');exports[_0xefcb('0x0')]=function(_0x35eabe,_0x1dc3ed){return client[_0xefcb('0x1')](_0xefcb('0x2'),{'body':_0x1dc3ed,'options':{'where':{'id':_0x35eabe}},'log':_0xefcb('0x3')});};exports['addTags']=function(_0xbfb8c6,_0x14f3b5){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x14f3b5,'options':{'where':{'id':_0xbfb8c6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 47e2d0d..4727ac3 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 _0xf446=['Request','createWhatsappMessage','../client','create'];(function(_0x3235a7,_0x24cb3b){var _0x56d0b5=function(_0x3c4e91){while(--_0x3c4e91){_0x3235a7['push'](_0x3235a7['shift']());}};_0x56d0b5(++_0x24cb3b);}(_0xf446,0xda));var _0x6f44=function(_0x112301,_0x1fcaa1){_0x112301=_0x112301-0x0;var _0x3aba7a=_0xf446[_0x112301];return _0x3aba7a;};'use strict';var client=require(_0x6f44('0x0'));exports[_0x6f44('0x1')]=function(_0x33a455){return client[_0x6f44('0x2')]('CreateWhatsappMessage',{'body':_0x33a455,'log':_0x6f44('0x3')});}; \ No newline at end of file +var _0xbb4a=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1b7a28,_0x19e1f4){var _0x2033c8=function(_0x2a827d){while(--_0x2a827d){_0x1b7a28['push'](_0x1b7a28['shift']());}};_0x2033c8(++_0x19e1f4);}(_0xbb4a,0x76));var _0xabb4=function(_0x142006,_0x49a524){_0x142006=_0x142006-0x0;var _0x26a9ac=_0xbb4a[_0x142006];return _0x26a9ac;};'use strict';var client=require(_0xabb4('0x0'));exports[_0xabb4('0x1')]=function(_0x87aa1a){return client[_0xabb4('0x2')](_0xabb4('0x3'),{'body':_0x87aa1a,'log':_0xabb4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7eb9888..02932da 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 _0xba4a=['Request','timeout','strategy','User','Agents','name','online','whatsappPause','../client'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xba4a,0xb3));var _0xaba4=function(_0x1cb3be,_0x31817d){_0x1cb3be=_0x1cb3be-0x0;var _0x5e9a94=_0xba4a[_0x1cb3be];return _0x5e9a94;};'use strict';var client=require(_0xaba4('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xaba4('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xaba4('0x2'),_0xaba4('0x3')],'include':[{'model':_0xaba4('0x4'),'as':_0xaba4('0x5'),'attributes':['id',_0xaba4('0x6'),_0xaba4('0x7'),_0xaba4('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x9900=['Request','GetWhatsappQueue','timeout','strategy','User','Agents','online','getWhatsappQueues'];(function(_0x3a63a4,_0x3cfd6e){var _0x18c172=function(_0x434337){while(--_0x434337){_0x3a63a4['push'](_0x3a63a4['shift']());}};_0x18c172(++_0x3cfd6e);}(_0x9900,0x19f));var _0x0990=function(_0x189f0d,_0x3b5da2){_0x189f0d=_0x189f0d-0x0;var _0x9a4871=_0x9900[_0x189f0d];return _0x9a4871;};'use strict';var client=require('../client');exports[_0x0990('0x0')]=function(){return function(){return client[_0x0990('0x1')](_0x0990('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0990('0x3'),_0x0990('0x4')],'include':[{'model':_0x0990('0x5'),'as':_0x0990('0x6'),'attributes':['id','name',_0x0990('0x7'),'whatsappPause']}]},'log':_0x0990('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index eb2469e..ff2e80c 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 _0x6ed8=['update','UpdateWhatsappQueueReport','create','Request','CreateWhatsappQueueReport'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x6ed8,0x115));var _0x86ed=function(_0x4e924f,_0x2b7e01){_0x4e924f=_0x4e924f-0x0;var _0xb9a6a2=_0x6ed8[_0x4e924f];return _0xb9a6a2;};'use strict';var client=require('../client');exports[_0x86ed('0x0')]=function(_0x4a91cd){return client[_0x86ed('0x1')](_0x86ed('0x2'),{'body':_0x4a91cd,'log':_0x86ed('0x2')});};exports[_0x86ed('0x3')]=function(_0xbbfe47,_0x56a382){return client[_0x86ed('0x1')](_0x86ed('0x4'),{'body':_0x56a382,'options':{'where':{'uniqueid':_0xbbfe47},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x3c45=['DESC','../client','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x198ed9,_0x5974ae){var _0x5d02c7=function(_0x39d778){while(--_0x39d778){_0x198ed9['push'](_0x198ed9['shift']());}};_0x5d02c7(++_0x5974ae);}(_0x3c45,0xdf));var _0x53c4=function(_0x2b84cb,_0x149228){_0x2b84cb=_0x2b84cb-0x0;var _0x3639cc=_0x3c45[_0x2b84cb];return _0x3639cc;};'use strict';var client=require(_0x53c4('0x0'));exports['create']=function(_0x344c6b){return client['Request'](_0x53c4('0x1'),{'body':_0x344c6b,'log':_0x53c4('0x1')});};exports[_0x53c4('0x2')]=function(_0x1a12f2,_0x54ebc0){return client[_0x53c4('0x3')](_0x53c4('0x4'),{'body':_0x54ebc0,'options':{'where':{'uniqueid':_0x1a12f2},'order':[['id',_0x53c4('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 bca8def..db30c1b 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 _0x3c0a=['agent','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','message','join','stop','agents','createQueue','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x3f2db0,_0x533daa){var _0x3f714a=function(_0x4ba464){while(--_0x4ba464){_0x3f2db0['push'](_0x3f2db0['shift']());}};_0x3f714a(++_0x533daa);}(_0x3c0a,0x179));var _0xa3c0=function(_0x5a7db2,_0x5267d0){_0x5a7db2=_0x5a7db2-0x0;var _0x1e4c52=_0x3c0a[_0x5a7db2];return _0x1e4c52;};'use strict';var schema=require(_0xa3c0('0x0'));var _=require(_0xa3c0('0x1'));var util=require(_0xa3c0('0x2'));var seqqueue=require(_0xa3c0('0x3'));var logger=require(_0xa3c0('0x4'))(_0xa3c0('0x5'));var strategy=require(_0xa3c0('0x6'));var queue=schema({'name':{'type':_0xa3c0('0x7'),'required':!![],'message':_0xa3c0('0x8')},'timeout':{'type':_0xa3c0('0x9'),'message':_0xa3c0('0xa')}});function writeLog(_0x53eb40,_0x5aca32,_0xd72d9){return logger[_0xa3c0('0xb')](util[_0xa3c0('0xc')](_0xa3c0('0xd'),_0x53eb40,_0x5aca32[_0xa3c0('0xe')],_0xd72d9));}function handleFindAgent(_0x4d1397){return function(_0x188c9d){return _0x188c9d[_0xa3c0('0xe')][_0xa3c0('0xf')]()===_0x4d1397[_0xa3c0('0xf')]();};}exports['consequence']=function(_0x7f8581,_0x49df90,_0x4ec341,_0x3b6fcb){return function(_0x127504){try{var _0x21902f={'name':_0x49df90[0x0],'timeout':_0x49df90[0x1]};var _0x3a701d=queue[_0xa3c0('0x0')](_0x21902f,{'typecast':!![]});if(_0x3a701d['length']){logger[_0xa3c0('0x10')](_0xa3c0('0x11'),_0x7f8581,_['map'](_0x3a701d,_0xa3c0('0x12'))[_0xa3c0('0x13')](',\x20'));_0x127504[_0xa3c0('0x14')]();}else{var _0x473092=_['find'](_0x4ec341[_0xa3c0('0x15')],handleFindAgent(_0x21902f[_0xa3c0('0xe')]));if(_0x473092){var _0xbe2a06=(_0x21902f['timeout']||0xa)*0x3e8;var _0x1f1405,_0x4cea04;var _0x39f6fe=seqqueue[_0xa3c0('0x16')](_0xbe2a06);_0x39f6fe['id']=_0x7f8581;_0x39f6fe['atimeout']=_0xbe2a06;_0x39f6fe['channel']=_0x3b6fcb['channel'];writeLog(_0x7f8581,_0x473092,util[_0xa3c0('0xc')](_0xa3c0('0x17'),_0xbe2a06));_0x4ec341['rules'][_0x7f8581]['on'](_0xa3c0('0x18'),function(){logger[_0xa3c0('0xb')](_0xa3c0('0x19'),_0x7f8581);clearTimeout(_0x4cea04);_0x4cea04=undefined;_0x39f6fe[_0xa3c0('0x1a')]();if(_0x4ec341[_0xa3c0('0x1b')][_0x7f8581]){delete _0x4ec341[_0xa3c0('0x1b')][_0x7f8581];}_0x127504[_0xa3c0('0x14')]();});_0x4ec341[_0xa3c0('0x1b')][_0x7f8581]['on'](_0xa3c0('0x1c'),function(){if(_0x4ec341[_0xa3c0('0x1b')][_0x7f8581]){delete _0x4ec341[_0xa3c0('0x1b')][_0x7f8581];}});_0x4cea04=setTimeout(function(){logger['info'](_0xa3c0('0x1d'),_0x7f8581);clearTimeout(_0x4cea04);_0x39f6fe[_0xa3c0('0x1a')]();_0x127504[_0xa3c0('0x1e')]();},_0xbe2a06);strategy[_0xa3c0('0x1f')](_0x39f6fe,_0x473092,_0x4ec341,_0x3b6fcb);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x7f8581,_0x21902f[_0xa3c0('0xe')]);_0x127504['stop']();}}}catch(_0xa2d80e){console['log'](_0xa2d80e);logger[_0xa3c0('0x10')](_0xa3c0('0x20'),_0x7f8581,_0xa2d80e[_0xa3c0('0x21')]);_0x127504['stop']();}};}; \ No newline at end of file +var _0xc640=['rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','stop','log','error','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','message','join','agents','timeout','createQueue','channel'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xc640,0x1ab));var _0x0c64=function(_0x200e38,_0x419435){_0x200e38=_0x200e38-0x0;var _0x12f14c=_0xc640[_0x200e38];return _0x12f14c;};'use strict';var schema=require(_0x0c64('0x0'));var _=require(_0x0c64('0x1'));var util=require(_0x0c64('0x2'));var seqqueue=require(_0x0c64('0x3'));var logger=require(_0x0c64('0x4'))('routing');var strategy=require(_0x0c64('0x5'));var queue=schema({'name':{'type':_0x0c64('0x6'),'required':!![],'message':_0x0c64('0x7')},'timeout':{'type':_0x0c64('0x8'),'message':_0x0c64('0x9')}});function writeLog(_0x1573f7,_0x5611c6,_0x3c68d3){return logger[_0x0c64('0xa')](util[_0x0c64('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1573f7,_0x5611c6['name'],_0x3c68d3));}function handleFindAgent(_0x279684){return function(_0x42a06b){return _0x42a06b[_0x0c64('0xc')][_0x0c64('0xd')]()===_0x279684[_0x0c64('0xd')]();};}exports[_0x0c64('0xe')]=function(_0x134819,_0x569fb8,_0x3af9a5,_0x3b599c){return function(_0x194b4d){try{var _0x3b80c5={'name':_0x569fb8[0x0],'timeout':_0x569fb8[0x1]};var _0x34fd4c=queue['validate'](_0x3b80c5,{'typecast':!![]});if(_0x34fd4c['length']){logger['error']('[%s][AGENT]\x20%s',_0x134819,_['map'](_0x34fd4c,_0x0c64('0xf'))[_0x0c64('0x10')](',\x20'));_0x194b4d['stop']();}else{var _0x715977=_['find'](_0x3af9a5[_0x0c64('0x11')],handleFindAgent(_0x3b80c5[_0x0c64('0xc')]));if(_0x715977){var _0xdee22a=(_0x3b80c5[_0x0c64('0x12')]||0xa)*0x3e8;var _0x5ad11a,_0x5ba2dd;var _0x30c0a8=seqqueue[_0x0c64('0x13')](_0xdee22a);_0x30c0a8['id']=_0x134819;_0x30c0a8['atimeout']=_0xdee22a;_0x30c0a8['channel']=_0x3b599c[_0x0c64('0x14')];writeLog(_0x134819,_0x715977,util['format']('START:%s',_0xdee22a));_0x3af9a5[_0x0c64('0x15')][_0x134819]['on'](_0x0c64('0x16'),function(){logger[_0x0c64('0xa')](_0x0c64('0x17'),_0x134819);clearTimeout(_0x5ba2dd);_0x5ba2dd=undefined;_0x30c0a8[_0x0c64('0x18')]();if(_0x3af9a5[_0x0c64('0x15')][_0x134819]){delete _0x3af9a5[_0x0c64('0x15')][_0x134819];}_0x194b4d['stop']();});_0x3af9a5['rules'][_0x134819]['on'](_0x0c64('0x19'),function(){if(_0x3af9a5['rules'][_0x134819]){delete _0x3af9a5[_0x0c64('0x15')][_0x134819];}});_0x5ba2dd=setTimeout(function(){logger[_0x0c64('0xa')](_0x0c64('0x1a'),_0x134819);clearTimeout(_0x5ba2dd);_0x30c0a8[_0x0c64('0x18')]();_0x194b4d['next']();},_0xdee22a);strategy[_0x0c64('0x1b')](_0x30c0a8,_0x715977,_0x3af9a5,_0x3b599c);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x134819,_0x3b80c5[_0x0c64('0xc')]);_0x194b4d[_0x0c64('0x1c')]();}}}catch(_0x2d8d5f){console[_0x0c64('0x1d')](_0x2d8d5f);logger[_0x0c64('0x1e')](_0x0c64('0x1f'),_0x134819,_0x2d8d5f['stack']);_0x194b4d[_0x0c64('0x1c')]();}};}; \ 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 967f33f..c334bc3 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 _0x50ac=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','providerName','amazonlex','providerResponse','stringify','then','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','body','catch','error','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x50ac,0xc8));var _0xc50a=function(_0x6863d6,_0x8aa718){_0x6863d6=_0x6863d6-0x0;var _0x469d56=_0x50ac[_0x6863d6];return _0x469d56;};'use strict';var _=require(_0xc50a('0x0'));var moment=require('moment');var AWS=require(_0xc50a('0x1'));var utils=require(_0xc50a('0x2'));var logger=require(_0xc50a('0x3'))('routing');var rpc={'chatMessage':require(_0xc50a('0x4')),'openchannelMessage':require(_0xc50a('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc50a('0x6')),'whatsappMessage':require(_0xc50a('0x7'))};exports[_0xc50a('0x8')]=function(_0x5904e6,_0xcbe205){return function(_0x16792e){try{if(!_[_0xc50a('0x9')](this[_0xc50a('0xa')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x5904e6,_0xc50a('0xb'));return _0x16792e[_0xc50a('0xc')]();}var _0x2fcd4b={'ContactId':this[_0xc50a('0xd')]['id'],'sentAt':moment()[_0xc50a('0xe')](_0xc50a('0xf')),'direction':_0xc50a('0x10')};if(this[_0xc50a('0x11')]===_0xc50a('0x12')||this[_0xc50a('0x11')]===_0xc50a('0x13')){_0x2fcd4b['phone']=this[_0xc50a('0xa')][_0xc50a('0x14')];}var _0x41b064=this['channel'];if(_0x41b064==='chat'){_0x2fcd4b[_0xc50a('0x15')]=this[_0xc50a('0x16')]['id'];}else{_0x2fcd4b[_[_0xc50a('0x17')](_0x41b064)+_0xc50a('0x18')]=this['account']['id'];}_0x2fcd4b[_['upperFirst'](_0x41b064)+_0xc50a('0x19')]=this[_0xc50a('0xa')]['id'];if(this[_0xc50a('0xa')][_0xc50a('0x1a')]){var _0x465447=_0xcbe205[0x4];if(!_['isEmpty'](_0x465447)){_0x2fcd4b['body']=utils[_0xc50a('0x1b')](_0x465447,this);return rpc[_0x41b064+_0xc50a('0x1c')][_0xc50a('0x1d')](_0x2fcd4b)['then'](function(_0x170962){logger['info'](_0xc50a('0x1e'),_0x5904e6,_0x2fcd4b[_0xc50a('0x1f')]);})[_0xc50a('0x20')](function(_0xdc434){logger[_0xc50a('0x21')](_0xc50a('0x1e'),_0x5904e6,JSON['stringify'](_0xdc434));})['finally'](function(){logger[_0xc50a('0x22')](_0xc50a('0x23'),_0x5904e6);_0x16792e[_0xc50a('0x24')]();});}else{logger[_0xc50a('0x22')](_0xc50a('0x25'),_0x5904e6);_0x16792e[_0xc50a('0x24')]();}}else{var _0x5d7277=this;var _0x5eea50=new AWS[(_0xc50a('0x26'))]({'accessKeyId':_0xcbe205[0x0],'secretAccessKey':_0xcbe205[0x1],'region':_0xcbe205[0x2]});var _0x429dc1={'botAlias':'$LATEST','botName':_0xcbe205[0x3],'inputText':this['message'][_0xc50a('0x1f')],'userId':this[_0xc50a('0x11')]+':'+this[_0xc50a('0xa')]['id']['toString']()};_0x5eea50['postText'](_0x429dc1,function(_0xe58e1a,_0x2fd366){if(_0xe58e1a){logger[_0xc50a('0x21')](_0xc50a('0x1e'),_0x5904e6,_0xe58e1a[_0xc50a('0x27')]);_0x16792e[_0xc50a('0xc')]();}else if(_0x2fd366&&_0x2fd366['message']){_0x5d7277[_0xc50a('0x1f')]['amazonlex']=_0x2fd366;_0x2fcd4b[_0xc50a('0x1f')]=_0x2fd366[_0xc50a('0x27')];_0x2fcd4b[_0xc50a('0x28')]=_0xc50a('0x29');_0x2fcd4b[_0xc50a('0x2a')]=JSON[_0xc50a('0x2b')](_0x2fd366);return rpc[_0x41b064+_0xc50a('0x1c')][_0xc50a('0x1d')](_0x2fcd4b)[_0xc50a('0x2c')](function(_0x2bf140){logger['info'](_0xc50a('0x1e'),_0x5904e6,_0x2fcd4b['body']);if(_0x2fd366[_0xc50a('0x2d')]==_0xc50a('0x2e')){_0x16792e[_0xc50a('0xc')]();}else{_0x16792e[_0xc50a('0x24')]();}})[_0xc50a('0x20')](function(_0x40a1f4){logger['error'](_0xc50a('0x1e'),_0x5904e6,JSON[_0xc50a('0x2b')](_0x40a1f4));_0x16792e[_0xc50a('0xc')]();});}else{_0x16792e['next']();}});}}catch(_0x2b1d54){logger[_0xc50a('0x21')]('[%s][AMAZONLEX]\x20%s',_0x5904e6,JSON[_0xc50a('0x2b')](_0x2b1d54));_0x16792e['stop']();}};}; \ No newline at end of file +var _0x9802=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','body','getMustacheRender','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','next','amazonlex','providerName','stringify','Message','dialogState','Failed','lodash','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x232a5b,_0x746396){var _0x4d3e8b=function(_0x5a69a7){while(--_0x5a69a7){_0x232a5b['push'](_0x232a5b['shift']());}};_0x4d3e8b(++_0x746396);}(_0x9802,0x7b));var _0x2980=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9802[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x2980('0x0'));var moment=require(_0x2980('0x1'));var AWS=require(_0x2980('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2980('0x3'));var rpc={'chatMessage':require(_0x2980('0x4')),'openchannelMessage':require(_0x2980('0x5')),'mailMessage':require(_0x2980('0x6')),'smsMessage':require(_0x2980('0x7')),'faxMessage':require(_0x2980('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2980('0x9')]=function(_0x358985,_0x34c621){return function(_0x444e26){try{if(!_[_0x2980('0xa')](this['interaction'][_0x2980('0xb')])){logger[_0x2980('0xc')]('[%s][AMAZONLEX]\x20%s',_0x358985,_0x2980('0xd'));return _0x444e26['next']();}var _0x2279f9={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2980('0xe')};if(this[_0x2980('0xf')]===_0x2980('0x10')||this[_0x2980('0xf')]===_0x2980('0x11')){_0x2279f9[_0x2980('0x12')]=this[_0x2980('0x13')][_0x2980('0x12')];}var _0x493f42=this[_0x2980('0xf')];if(_0x493f42===_0x2980('0x14')){_0x2279f9[_0x2980('0x15')]=this[_0x2980('0x16')]['id'];}else{_0x2279f9[_[_0x2980('0x17')](_0x493f42)+_0x2980('0x18')]=this[_0x2980('0x16')]['id'];}_0x2279f9[_['upperFirst'](_0x493f42)+'InteractionId']=this[_0x2980('0x13')]['id'];if(this['interaction']['created']){var _0x588585=_0x34c621[0x4];if(!_['isEmpty'](_0x588585)){_0x2279f9[_0x2980('0x19')]=utils[_0x2980('0x1a')](_0x588585,this);return rpc[_0x493f42+'Message'][_0x2980('0x1b')](_0x2279f9)[_0x2980('0x1c')](function(_0x170ab8){logger[_0x2980('0xc')](_0x2980('0x1d'),_0x358985,_0x2279f9[_0x2980('0x19')]);})[_0x2980('0x1e')](function(_0x43accd){logger[_0x2980('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x358985,JSON['stringify'](_0x43accd));})['finally'](function(){logger[_0x2980('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x358985);_0x444e26[_0x2980('0x20')]();});}else{logger[_0x2980('0xc')](_0x2980('0x21'),_0x358985);_0x444e26[_0x2980('0x20')]();}}else{var _0x23bf34=this;var _0xf2f222=new AWS[(_0x2980('0x22'))]({'accessKeyId':_0x34c621[0x0],'secretAccessKey':_0x34c621[0x1],'region':_0x34c621[0x2]});var _0x13f257={'botAlias':'$LATEST','botName':_0x34c621[0x3],'inputText':this[_0x2980('0x23')][_0x2980('0x19')],'userId':this[_0x2980('0xf')]+':'+this['interaction']['id']['toString']()};_0xf2f222['postText'](_0x13f257,function(_0x1e9a3e,_0x30bf09){if(_0x1e9a3e){logger['error'](_0x2980('0x1d'),_0x358985,_0x1e9a3e[_0x2980('0x23')]);_0x444e26[_0x2980('0x24')]();}else if(_0x30bf09&&_0x30bf09[_0x2980('0x23')]){_0x23bf34[_0x2980('0x19')][_0x2980('0x25')]=_0x30bf09;_0x2279f9[_0x2980('0x19')]=_0x30bf09[_0x2980('0x23')];_0x2279f9[_0x2980('0x26')]=_0x2980('0x25');_0x2279f9['providerResponse']=JSON[_0x2980('0x27')](_0x30bf09);return rpc[_0x493f42+_0x2980('0x28')]['create'](_0x2279f9)[_0x2980('0x1c')](function(_0x27b51a){logger['info'](_0x2980('0x1d'),_0x358985,_0x2279f9[_0x2980('0x19')]);if(_0x30bf09[_0x2980('0x29')]==_0x2980('0x2a')){_0x444e26[_0x2980('0x24')]();}else{_0x444e26['stop']();}})['catch'](function(_0x332f96){logger['error'](_0x2980('0x1d'),_0x358985,JSON[_0x2980('0x27')](_0x332f96));_0x444e26[_0x2980('0x24')]();});}else{_0x444e26['next']();}});}}catch(_0xe9b447){logger[_0x2980('0x1f')](_0x2980('0x1d'),_0x358985,JSON[_0x2980('0x27')](_0xe9b447));_0x444e26[_0x2980('0x20')]();}};}; \ 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 ef95e09..c93a38f 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 _0x52f2=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','isNil','created','interaction','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','Message','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','resolve','Interaction','stop','lodash','moment','./utils','../../../../config/logger'];(function(_0x1c797b,_0x320587){var _0x38dea4=function(_0x46f378){while(--_0x46f378){_0x1c797b['push'](_0x1c797b['shift']());}};_0x38dea4(++_0x320587);}(_0x52f2,0x114));var _0x252f=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x52f2[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x252f('0x0'));var moment=require(_0x252f('0x1'));var utils=require(_0x252f('0x2'));var logger=require(_0x252f('0x3'))(_0x252f('0x4'));var rpc={'chatMessage':require(_0x252f('0x5')),'openchannelMessage':require(_0x252f('0x6')),'mailMessage':require(_0x252f('0x7')),'smsMessage':require(_0x252f('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x252f('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x252f('0xa')),'smsInteraction':require(_0x252f('0xb')),'faxInteraction':require(_0x252f('0xc')),'whatsappInteraction':require(_0x252f('0xd'))};var mailRpc=require(_0x252f('0xe'));exports['consequence']=function(_0x39cb0c,_0x5273d5,_0x11aad2,_0x5e0baa){return function(_0xaf3927){try{var _0xeb434a=this[_0x252f('0xf')];if(_0xeb434a===_0x252f('0x10')&&_0x5e0baa[_0x252f('0x11')][_0x252f('0x12')]){logger[_0x252f('0x13')](_0x252f('0x14'),_0x39cb0c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0xaf3927['next']();}if(_0x5273d5[0x0]==='1'&&(_[_0x252f('0x15')](this['interaction'][_0x252f('0x16')])||!this[_0x252f('0x17')][_0x252f('0x16')])){logger[_0x252f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x39cb0c,_0x252f('0x18'));return _0xaf3927[_0x252f('0x19')]();}if(_0x5273d5[0x0]==='2'&&this[_0x252f('0x17')][_0x252f('0x1a')]){logger[_0x252f('0x13')](_0x252f('0x1b'),_0x39cb0c,_0x252f('0x1c'));return _0xaf3927['next']();}var _0x18dc9f={'ContactId':this[_0x252f('0x1d')]['id'],'sentAt':moment()[_0x252f('0x1e')](_0x252f('0x1f')),'direction':_0x252f('0x20')};if(this[_0x252f('0xf')]==='mail'){_0x18dc9f['body']=utils[_0x252f('0x21')](_0x5273d5[0x2],this);}else{_0x18dc9f[_0x252f('0x11')]=utils[_0x252f('0x21')](_0x5273d5[0x1],this);}if(this[_0x252f('0x22')]){_0x18dc9f['to']=this[_0x252f('0x22')][_0x252f('0x23')]||'';if(this[_0x252f('0xf')]===_0x252f('0x10')&&_0x5273d5[0x1]==='1'){_0x18dc9f['cc']=this[_0x252f('0x22')]['cc']||'';}_0x18dc9f[_0x252f('0x23')]=this[_0x252f('0x22')]['to']||'';_0x18dc9f[_0x252f('0x24')]=this[_0x252f('0x22')][_0x252f('0x24')]||'';_0x18dc9f['read']=!![];if(this[_0x252f('0x22')][_0x252f('0x25')]){_0x18dc9f[_0x252f('0x25')]='';_0x18dc9f[_0x252f('0x25')]+=_[_0x252f('0x26')](this['message'][_0x252f('0x25')],_0x252f('0x27'))?'':'Re:\x20';_0x18dc9f[_0x252f('0x25')]+=this[_0x252f('0x22')][_0x252f('0x25')];}}if(this['channel']===_0x252f('0x28')){_0x18dc9f[_0x252f('0x29')]=this[_0x252f('0x2a')]['id'];}else{_0x18dc9f[_[_0x252f('0x2b')](this[_0x252f('0xf')])+'AccountId']=this['account']['id'];}_0x18dc9f[_[_0x252f('0x2b')](this['channel'])+'InteractionId']=this['interaction']['id'];var _0x23fdf1=this['interaction'];if(rpc[this['channel']+_0x252f('0x2c')]){if(this[_0x252f('0xf')]==='mail'){_0x18dc9f[_0x252f('0x2d')]=this[_0x252f('0x22')]['messageId'];_0x18dc9f[_0x252f('0x2e')]=_0x252f('0x2f')+_[_0x252f('0x30')](_0x18dc9f[_0x252f('0x11')],_0x252f('0x31'),_0x252f('0x32'))+_0x252f('0x33');_0x18dc9f[_0x252f('0x34')]={'Auto-Submitted':_0x252f('0x35'),'X-Auto-Response-Suppress':_0x252f('0x36'),'Precedence':_0x252f('0x37')};return mailRpc['sendMailMessage'](this[_0x252f('0x2a')][_0x252f('0x38')],_0x18dc9f)['then'](function(_0x20cc75){logger['info'](_0x252f('0x39'),_0x39cb0c);_0x18dc9f['messageId']=_0x20cc75[_0x252f('0x22')]['messageId'];return rpc[_0xeb434a+_0x252f('0x2c')]['create'](_0x18dc9f);})[_0x252f('0x3a')](function(_0x1d183b){logger[_0x252f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x39cb0c,JSON['stringify'](_0x1d183b));})[_0x252f('0x3b')](function(_0x578b15){logger[_0x252f('0x3c')](_0x252f('0x3d'),_0x39cb0c,JSON[_0x252f('0x3e')](_0x578b15));})['finally'](function(){Promise['resolve']()[_0x252f('0x3a')](function(){if(_0x5273d5[0x0]!=='2'||_0x23fdf1[_0x252f('0x1a')])return;return rpc[_0xeb434a+'Interaction'][_0x252f('0x3f')](_0x23fdf1['id'],{'autoreplyExecuted':!![]})[_0x252f('0x3a')](function(_0x3172cf){logger[_0x252f('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x39cb0c,JSON[_0x252f('0x3e')](_0x3172cf));})[_0x252f('0x3b')](function(_0x55e75c){logger[_0x252f('0x3c')](_0x252f('0x40'),_0x39cb0c,JSON['stringify'](_0x55e75c));});})[_0x252f('0x3a')](function(){_0xaf3927[_0x252f('0x19')]();});});}else{return rpc[this['channel']+'Message'][_0x252f('0x41')](_0x18dc9f)[_0x252f('0x3a')](function(){logger[_0x252f('0x13')](_0x252f('0x14'),_0x39cb0c,_0x18dc9f['body']);})['catch'](function(_0x36b0aa){logger[_0x252f('0x3c')](_0x252f('0x14'),_0x39cb0c,JSON['stringify'](_0x36b0aa));})[_0x252f('0x42')](function(){Promise[_0x252f('0x43')]()['then'](function(){if(_0x5273d5[0x0]!=='2'||_0x23fdf1[_0x252f('0x1a')])return;return rpc[_0xeb434a+_0x252f('0x44')][_0x252f('0x3f')](_0x23fdf1['id'],{'autoreplyExecuted':!![]})['then'](function(_0xf7d816){logger[_0x252f('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x39cb0c,JSON[_0x252f('0x3e')](_0xf7d816));})[_0x252f('0x3b')](function(_0x36fe6a){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x39cb0c,JSON[_0x252f('0x3e')](_0x36fe6a));});})[_0x252f('0x3a')](function(){_0xaf3927['next']();});});}}}catch(_0x384dce){logger[_0x252f('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x39cb0c,JSON[_0x252f('0x3e')](_0x384dce));_0xaf3927[_0x252f('0x45')]();}};}; \ No newline at end of file +var _0xf61d=['created','interaction','next','autoreplyExecuted','format','YYYY-MM-DD\x20HH:mm:ss','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','AccountId','upperFirst','Message','inReplyTo','messageId','html','replace','','headers','auto-replied','All','auto_reply','account','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil'];(function(_0x3d1f64,_0x90f0a8){var _0x2f8dde=function(_0x43fdf2){while(--_0x43fdf2){_0x3d1f64['push'](_0x3d1f64['shift']());}};_0x2f8dde(++_0x90f0a8);}(_0xf61d,0xb6));var _0xdf61=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xf61d[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0xdf61('0x0'));var moment=require(_0xdf61('0x1'));var utils=require(_0xdf61('0x2'));var logger=require('../../../../config/logger')(_0xdf61('0x3'));var rpc={'chatMessage':require(_0xdf61('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdf61('0x5')),'smsMessage':require(_0xdf61('0x6')),'faxMessage':require(_0xdf61('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xdf61('0x8')),'openchannelInteraction':require(_0xdf61('0x9')),'mailInteraction':require(_0xdf61('0xa')),'smsInteraction':require(_0xdf61('0xb')),'faxInteraction':require(_0xdf61('0xc')),'whatsappInteraction':require(_0xdf61('0xd'))};var mailRpc=require('../../mailRpc');exports[_0xdf61('0xe')]=function(_0x3f3bbf,_0x2f1c89,_0x4d91a0,_0x1b2932){return function(_0x3bf68a){try{var _0x2cfb16=this[_0xdf61('0xf')];if(_0x2cfb16==='mail'&&_0x1b2932[_0xdf61('0x10')][_0xdf61('0x11')]){logger[_0xdf61('0x12')](_0xdf61('0x13'),_0x3f3bbf,_0xdf61('0x14'));return _0x3bf68a['next']();}if(_0x2f1c89[0x0]==='1'&&(_[_0xdf61('0x15')](this['interaction'][_0xdf61('0x16')])||!this[_0xdf61('0x17')][_0xdf61('0x16')])){logger[_0xdf61('0x12')](_0xdf61('0x13'),_0x3f3bbf,'Autoreply\x20already\x20sent');return _0x3bf68a[_0xdf61('0x18')]();}if(_0x2f1c89[0x0]==='2'&&this[_0xdf61('0x17')][_0xdf61('0x19')]){logger[_0xdf61('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3f3bbf,'One\x20Time\x20already\x20sent');return _0x3bf68a[_0xdf61('0x18')]();}var _0x48adfc={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdf61('0x1a')](_0xdf61('0x1b')),'direction':'out'};if(this[_0xdf61('0xf')]===_0xdf61('0x1c')){_0x48adfc[_0xdf61('0x10')]=utils[_0xdf61('0x1d')](_0x2f1c89[0x2],this);}else{_0x48adfc[_0xdf61('0x10')]=utils['getMustacheRender'](_0x2f1c89[0x1],this);}if(this['message']){_0x48adfc['to']=this[_0xdf61('0x1e')][_0xdf61('0x1f')]||'';if(this['channel']==='mail'&&_0x2f1c89[0x1]==='1'){_0x48adfc['cc']=this['message']['cc']||'';}_0x48adfc['from']=this['message']['to']||'';_0x48adfc[_0xdf61('0x20')]=this['message']['phone']||'';_0x48adfc[_0xdf61('0x21')]=!![];if(this['message'][_0xdf61('0x22')]){_0x48adfc['subject']='';_0x48adfc[_0xdf61('0x22')]+=_[_0xdf61('0x23')](this[_0xdf61('0x1e')][_0xdf61('0x22')],'Re:')?'':_0xdf61('0x24');_0x48adfc[_0xdf61('0x22')]+=this[_0xdf61('0x1e')][_0xdf61('0x22')];}}if(this[_0xdf61('0xf')]===_0xdf61('0x25')){_0x48adfc[_0xdf61('0x26')]=this['account']['id'];}else{_0x48adfc[_['upperFirst'](this[_0xdf61('0xf')])+_0xdf61('0x27')]=this['account']['id'];}_0x48adfc[_[_0xdf61('0x28')](this[_0xdf61('0xf')])+'InteractionId']=this['interaction']['id'];var _0x53e1a0=this[_0xdf61('0x17')];if(rpc[this[_0xdf61('0xf')]+_0xdf61('0x29')]){if(this[_0xdf61('0xf')]===_0xdf61('0x1c')){_0x48adfc[_0xdf61('0x2a')]=this[_0xdf61('0x1e')][_0xdf61('0x2b')];_0x48adfc[_0xdf61('0x2c')]=''+_[_0xdf61('0x2d')](_0x48adfc[_0xdf61('0x10')],_0xdf61('0x2e'),_0xdf61('0x2f'))+_0xdf61('0x30');_0x48adfc[_0xdf61('0x31')]={'Auto-Submitted':_0xdf61('0x32'),'X-Auto-Response-Suppress':_0xdf61('0x33'),'Precedence':_0xdf61('0x34')};return mailRpc['sendMailMessage'](this[_0xdf61('0x35')][_0xdf61('0x36')],_0x48adfc)[_0xdf61('0x37')](function(_0x14c10f){logger['info'](_0xdf61('0x38'),_0x3f3bbf);_0x48adfc[_0xdf61('0x2b')]=_0x14c10f[_0xdf61('0x1e')][_0xdf61('0x2b')];return rpc[_0x2cfb16+_0xdf61('0x29')][_0xdf61('0x39')](_0x48adfc);})[_0xdf61('0x37')](function(_0x572157){logger[_0xdf61('0x12')](_0xdf61('0x13'),_0x3f3bbf,JSON[_0xdf61('0x3a')](_0x572157));})['catch'](function(_0x1b7c69){logger['error'](_0xdf61('0x3b'),_0x3f3bbf,JSON[_0xdf61('0x3a')](_0x1b7c69));})[_0xdf61('0x3c')](function(){Promise[_0xdf61('0x3d')]()['then'](function(){if(_0x2f1c89[0x0]!=='2'||_0x53e1a0[_0xdf61('0x19')])return;return rpc[_0x2cfb16+_0xdf61('0x3e')]['update'](_0x53e1a0['id'],{'autoreplyExecuted':!![]})[_0xdf61('0x37')](function(_0x531156){logger[_0xdf61('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3f3bbf,JSON[_0xdf61('0x3a')](_0x531156));})[_0xdf61('0x3f')](function(_0x57a296){logger[_0xdf61('0x40')](_0xdf61('0x41'),_0x3f3bbf,JSON[_0xdf61('0x3a')](_0x57a296));});})[_0xdf61('0x37')](function(){_0x3bf68a[_0xdf61('0x18')]();});});}else{return rpc[this[_0xdf61('0xf')]+_0xdf61('0x29')][_0xdf61('0x39')](_0x48adfc)['then'](function(){logger[_0xdf61('0x12')](_0xdf61('0x13'),_0x3f3bbf,_0x48adfc[_0xdf61('0x10')]);})['catch'](function(_0x4583dd){logger[_0xdf61('0x40')](_0xdf61('0x13'),_0x3f3bbf,JSON[_0xdf61('0x3a')](_0x4583dd));})[_0xdf61('0x3c')](function(){Promise[_0xdf61('0x3d')]()['then'](function(){if(_0x2f1c89[0x0]!=='2'||_0x53e1a0['autoreplyExecuted'])return;return rpc[_0x2cfb16+_0xdf61('0x3e')][_0xdf61('0x42')](_0x53e1a0['id'],{'autoreplyExecuted':!![]})[_0xdf61('0x37')](function(_0x2674cb){logger[_0xdf61('0x12')](_0xdf61('0x43'),_0x3f3bbf,JSON[_0xdf61('0x3a')](_0x2674cb));})[_0xdf61('0x3f')](function(_0x29ef63){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3f3bbf,JSON['stringify'](_0x29ef63));});})[_0xdf61('0x37')](function(){_0x3bf68a[_0xdf61('0x18')]();});});}}}catch(_0xb9a4c0){logger[_0xdf61('0x40')](_0xdf61('0x13'),_0x3f3bbf,JSON[_0xdf61('0x3a')](_0xb9a4c0));_0x3bf68a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 5add8b0..9ad4128 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2daf=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x2daf,0x7c));var _0xf2da=function(_0x4f140e,_0x574bee){_0x4f140e=_0x4f140e-0x0;var _0x357343=_0x2daf[_0x4f140e];return _0x357343;};'use strict';var moment=require(_0xf2da('0x0'));var logger=require(_0xf2da('0x1'))('routing');var rpc={'chatInteraction':require(_0xf2da('0x2')),'openchannelInteraction':require(_0xf2da('0x3')),'smsInteraction':require(_0xf2da('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xf2da('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xf2da('0x6')]=function(_0x37b25c,_0x2feec1,_0x572d4d,_0x37f498){return function(_0x47f84c){try{logger['info'](_0xf2da('0x7'),_0x37b25c,_0x2feec1[0x0]);var _0x47f423={'closed':0x1,'closedAt':moment()[_0xf2da('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xf2da('0x9'),'disposition':_0x2feec1[0x0]};if(rpc[_0x37f498['channel']+'Interaction']){rpc[_0x37f498[_0xf2da('0xa')]+_0xf2da('0xb')][_0xf2da('0xc')](_0x37f498[_0xf2da('0xd')]['id'],_0x47f423)['then'](function(_0x5b3c18){logger[_0xf2da('0xe')](_0xf2da('0xf'),_0x37b25c,_0x37f498['interaction']['id']);})[_0xf2da('0x10')](function(_0x4eac41){logger['error'](_0xf2da('0x11'),_0x37b25c,JSON[_0xf2da('0x12')](_0x4eac41));})[_0xf2da('0x13')](function(){_0x47f84c[_0xf2da('0x14')]();});}}catch(_0x24deb3){logger['error'](_0xf2da('0x11'),_0x37b25c,JSON[_0xf2da('0x12')](_0x24deb3));_0x47f84c['stop']();}};}; \ No newline at end of file +var _0x0bb3=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','stop','moment','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x0bb3,0x18c));var _0x30bb=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x0bb3[_0x2df507];return _0x1f7167;};'use strict';var moment=require(_0x30bb('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x30bb('0x1')),'openchannelInteraction':require(_0x30bb('0x2')),'smsInteraction':require(_0x30bb('0x3')),'mailInteraction':require(_0x30bb('0x4')),'faxInteraction':require(_0x30bb('0x5')),'whatsappInteraction':require(_0x30bb('0x6'))};exports[_0x30bb('0x7')]=function(_0x14074d,_0x5cea85,_0x52897f,_0x44b7c2){return function(_0x154642){try{logger['info'](_0x30bb('0x8'),_0x14074d,_0x5cea85[0x0]);var _0xec9bd={'closed':0x1,'closedAt':moment()[_0x30bb('0x9')](_0x30bb('0xa')),'closeReason':_0x30bb('0xb'),'disposition':_0x5cea85[0x0]};if(rpc[_0x44b7c2[_0x30bb('0xc')]+_0x30bb('0xd')]){rpc[_0x44b7c2[_0x30bb('0xc')]+_0x30bb('0xd')][_0x30bb('0xe')](_0x44b7c2[_0x30bb('0xf')]['id'],_0xec9bd)[_0x30bb('0x10')](function(_0x773db8){logger[_0x30bb('0x11')](_0x30bb('0x12'),_0x14074d,_0x44b7c2[_0x30bb('0xf')]['id']);})[_0x30bb('0x13')](function(_0x3a1bc9){logger[_0x30bb('0x14')]('[%s][CLOSE]\x20%s',_0x14074d,JSON[_0x30bb('0x15')](_0x3a1bc9));})['finally'](function(){_0x154642[_0x30bb('0x16')]();});}}catch(_0x129b88){logger[_0x30bb('0x14')]('[%s][CLOSE]\x20%s',_0x14074d,JSON[_0x30bb('0x15')](_0x129b88));_0x154642[_0x30bb('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 651ebf0..5cb0ad2 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ca4=['InteractionId','created','isEmpty','then','body','catch','[%s][DIALOGFLOW]\x20%s','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','dialogflow','fulfillment','speech','providerName','providerResponse','stringify','Message','create','result','metadata','endConversation','error','lodash','moment','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account'];(function(_0x14efb5,_0x463841){var _0x34efcd=function(_0x132237){while(--_0x132237){_0x14efb5['push'](_0x14efb5['shift']());}};_0x34efcd(++_0x463841);}(_0x3ca4,0x17d));var _0x43ca=function(_0xd9970b,_0x5db849){_0xd9970b=_0xd9970b-0x0;var _0x1628b7=_0x3ca4[_0xd9970b];return _0x1628b7;};'use strict';var _=require(_0x43ca('0x0'));var moment=require(_0x43ca('0x1'));var apiai=require(_0x43ca('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x43ca('0x3'))(_0x43ca('0x4'));var rpc={'chatMessage':require(_0x43ca('0x5')),'openchannelMessage':require(_0x43ca('0x6')),'mailMessage':require(_0x43ca('0x7')),'smsMessage':require(_0x43ca('0x8')),'faxMessage':require(_0x43ca('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x43ca('0xa')]=function(_0x1ba987,_0x2e6edf){return function(_0x609e75){try{if(!_[_0x43ca('0xb')](this[_0x43ca('0xc')][_0x43ca('0xd')])){logger[_0x43ca('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x1ba987,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x609e75[_0x43ca('0xf')]();}var _0x134855={'ContactId':this[_0x43ca('0x10')]['id'],'sentAt':moment()[_0x43ca('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x43ca('0x12')};if(this[_0x43ca('0x13')]===_0x43ca('0x14')||this[_0x43ca('0x13')]===_0x43ca('0x15')){_0x134855[_0x43ca('0x16')]=this[_0x43ca('0xc')][_0x43ca('0x16')];}var _0x2150be=this['channel'];if(_0x2150be===_0x43ca('0x17')){_0x134855[_0x43ca('0x18')]=this['account']['id'];}else{_0x134855[_[_0x43ca('0x19')](_0x2150be)+'AccountId']=this[_0x43ca('0x1a')]['id'];}_0x134855[_['upperFirst'](_0x2150be)+_0x43ca('0x1b')]=this[_0x43ca('0xc')]['id'];if(this['interaction'][_0x43ca('0x1c')]){var _0x366180=_0x2e6edf[0x2];if(!_[_0x43ca('0x1d')](_0x366180)){_0x134855['body']=utils['getMustacheRender'](_0x366180,this);return rpc[_0x2150be+'Message']['create'](_0x134855)[_0x43ca('0x1e')](function(_0x268817){logger[_0x43ca('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x1ba987,_0x134855[_0x43ca('0x1f')]);})[_0x43ca('0x20')](function(_0x321ccd){logger['error'](_0x43ca('0x21'),_0x1ba987,JSON['stringify'](_0x321ccd));})[_0x43ca('0x22')](function(){logger[_0x43ca('0xe')](_0x43ca('0x23'),_0x1ba987);_0x609e75['stop']();});}else{logger[_0x43ca('0xe')](_0x43ca('0x24'),_0x1ba987);_0x609e75[_0x43ca('0x25')]();}}else{var _0x2ad8fa=this;var _0x35d34c=apiai(_0x2e6edf[0x0],{'language':_0x2e6edf[0x1]||'en'});return _0x35d34c['textRequest'](this[_0x43ca('0x26')][_0x43ca('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0x43ca('0x1e')](function(_0x22d6ac){_0x2ad8fa[_0x43ca('0x1f')][_0x43ca('0x27')]=_0x22d6ac;_0x134855[_0x43ca('0x1f')]=_0x22d6ac['result'][_0x43ca('0x28')][_0x43ca('0x29')];_0x134855[_0x43ca('0x2a')]=_0x43ca('0x27');_0x134855[_0x43ca('0x2b')]=JSON[_0x43ca('0x2c')](_0x22d6ac);return rpc[_0x2150be+_0x43ca('0x2d')][_0x43ca('0x2e')](_0x134855)['then'](function(_0x4c6b44){logger['info'](_0x43ca('0x21'),_0x1ba987,_0x134855[_0x43ca('0x1f')]);if(_0x22d6ac[_0x43ca('0x2f')][_0x43ca('0x30')][_0x43ca('0x31')]){_0x609e75[_0x43ca('0xf')]();}else{_0x609e75[_0x43ca('0x25')]();}})[_0x43ca('0x20')](function(_0x5f37ff){logger[_0x43ca('0x32')]('[%s][DIALOGFLOW]\x20%s',_0x1ba987,JSON['stringify'](_0x5f37ff));_0x609e75[_0x43ca('0xf')]();});})[_0x43ca('0x20')](function(_0x313518){logger[_0x43ca('0x32')](_0x43ca('0x21'),_0x1ba987,_0x313518['message']);_0x609e75[_0x43ca('0xf')]();});}}catch(_0x5eae09){logger[_0x43ca('0x32')]('[%s][DIALOGFLOW]\x20%s',_0x1ba987,JSON[_0x43ca('0x2c')](_0x5eae09));_0x609e75[_0x43ca('0x25')]();}};}; \ No newline at end of file +var _0x6c65=['[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','interaction','chat','account','AccountId','InteractionId','body','Message','then','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','providerResponse','metadata','endConversation','stop','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info'];(function(_0x404ecf,_0x18ae85){var _0xe753a1=function(_0x12584f){while(--_0x12584f){_0x404ecf['push'](_0x404ecf['shift']());}};_0xe753a1(++_0x18ae85);}(_0x6c65,0x78));var _0x56c6=function(_0x32dd50,_0x5cde6b){_0x32dd50=_0x32dd50-0x0;var _0x52d87f=_0x6c65[_0x32dd50];return _0x52d87f;};'use strict';var _=require(_0x56c6('0x0'));var moment=require(_0x56c6('0x1'));var apiai=require(_0x56c6('0x2'));var md5=require(_0x56c6('0x3'));var utils=require(_0x56c6('0x4'));var logger=require(_0x56c6('0x5'))('routing');var rpc={'chatMessage':require(_0x56c6('0x6')),'openchannelMessage':require(_0x56c6('0x7')),'mailMessage':require(_0x56c6('0x8')),'smsMessage':require(_0x56c6('0x9')),'faxMessage':require(_0x56c6('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x56c6('0xb')]=function(_0x2f7d43,_0x12834a){return function(_0x3123cb){try{if(!_[_0x56c6('0xc')](this['interaction'][_0x56c6('0xd')])){logger[_0x56c6('0xe')](_0x56c6('0xf'),_0x2f7d43,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3123cb[_0x56c6('0x10')]();}var _0x30a2f2={'ContactId':this[_0x56c6('0x11')]['id'],'sentAt':moment()[_0x56c6('0x12')](_0x56c6('0x13')),'direction':_0x56c6('0x14')};if(this['channel']===_0x56c6('0x15')||this['channel']==='whatsapp'){_0x30a2f2[_0x56c6('0x16')]=this[_0x56c6('0x17')][_0x56c6('0x16')];}var _0x1b992f=this['channel'];if(_0x1b992f===_0x56c6('0x18')){_0x30a2f2['ChatWebsiteId']=this[_0x56c6('0x19')]['id'];}else{_0x30a2f2[_['upperFirst'](_0x1b992f)+_0x56c6('0x1a')]=this['account']['id'];}_0x30a2f2[_['upperFirst'](_0x1b992f)+_0x56c6('0x1b')]=this['interaction']['id'];if(this[_0x56c6('0x17')]['created']){var _0x17d183=_0x12834a[0x2];if(!_['isEmpty'](_0x17d183)){_0x30a2f2[_0x56c6('0x1c')]=utils['getMustacheRender'](_0x17d183,this);return rpc[_0x1b992f+_0x56c6('0x1d')]['create'](_0x30a2f2)[_0x56c6('0x1e')](function(_0x288325){logger['info'](_0x56c6('0xf'),_0x2f7d43,_0x30a2f2[_0x56c6('0x1c')]);})[_0x56c6('0x1f')](function(_0x2eb4a7){logger['error'](_0x56c6('0xf'),_0x2f7d43,JSON[_0x56c6('0x20')](_0x2eb4a7));})[_0x56c6('0x21')](function(){logger[_0x56c6('0xe')](_0x56c6('0x22'),_0x2f7d43);_0x3123cb['stop']();});}else{logger[_0x56c6('0xe')](_0x56c6('0x23'),_0x2f7d43);_0x3123cb['stop']();}}else{var _0x40d7be=this;var _0x4d33f7=apiai(_0x12834a[0x0],{'language':_0x12834a[0x1]||'en'});return _0x4d33f7['textRequest'](this[_0x56c6('0x24')][_0x56c6('0x1c')],{'sessionId':md5(this[_0x56c6('0x17')]['id'])})['then'](function(_0x27806e){_0x40d7be[_0x56c6('0x1c')][_0x56c6('0x25')]=_0x27806e;_0x30a2f2[_0x56c6('0x1c')]=_0x27806e[_0x56c6('0x26')][_0x56c6('0x27')]['speech'];_0x30a2f2['providerName']=_0x56c6('0x25');_0x30a2f2[_0x56c6('0x28')]=JSON['stringify'](_0x27806e);return rpc[_0x1b992f+_0x56c6('0x1d')]['create'](_0x30a2f2)[_0x56c6('0x1e')](function(_0x52e761){logger[_0x56c6('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x2f7d43,_0x30a2f2[_0x56c6('0x1c')]);if(_0x27806e[_0x56c6('0x26')][_0x56c6('0x29')][_0x56c6('0x2a')]){_0x3123cb[_0x56c6('0x10')]();}else{_0x3123cb[_0x56c6('0x2b')]();}})[_0x56c6('0x1f')](function(_0x3938d4){logger[_0x56c6('0x2c')](_0x56c6('0xf'),_0x2f7d43,JSON[_0x56c6('0x20')](_0x3938d4));_0x3123cb['next']();});})[_0x56c6('0x1f')](function(_0x22a98e){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x2f7d43,_0x22a98e[_0x56c6('0x24')]);_0x3123cb['next']();});}}catch(_0x3e6433){logger['error'](_0x56c6('0xf'),_0x2f7d43,JSON[_0x56c6('0x20')](_0x3e6433));_0x3123cb[_0x56c6('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index ec538e4..b5d17b9 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe152=['../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','catch','stringify','consequence','isNil','interaction','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','created','getMustacheRender','Message','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','message','lodash','dialogflow','md5','moment','bluebird'];(function(_0x1aab47,_0x4804e3){var _0x756ce1=function(_0x1c73f3){while(--_0x1c73f3){_0x1aab47['push'](_0x1aab47['shift']());}};_0x756ce1(++_0x4804e3);}(_0xe152,0x91));var _0x2e15=function(_0x1ee8a6,_0x1f193b){_0x1ee8a6=_0x1ee8a6-0x0;var _0x2f6280=_0xe152[_0x1ee8a6];return _0x2f6280;};'use strict';var _=require(_0x2e15('0x0'));var dialogflow=require(_0x2e15('0x1'));var md5=require(_0x2e15('0x2'));var moment=require(_0x2e15('0x3'));var Promise=require(_0x2e15('0x4'));var logger=require(_0x2e15('0x5'))(_0x2e15('0x6'));var utils=require(_0x2e15('0x7'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2e15('0x8')),'mailMessage':require(_0x2e15('0x9')),'smsMessage':require(_0x2e15('0xa')),'faxMessage':require(_0x2e15('0xb')),'whatsappMessage':require(_0x2e15('0xc'))};function createMessage(_0x7d7680,_0x324b2f,_0x3bc3d3,_0x55b377){return new Promise(function(_0x1f604d,_0x1202d5){var _0x48568d=_[_0x2e15('0xd')](_0x3bc3d3);_0x48568d[_0x2e15('0xe')]=_0x55b377;return rpc[_0x324b2f+'Message'][_0x2e15('0xf')](_0x48568d)[_0x2e15('0x10')](function(){logger[_0x2e15('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x7d7680,_0x48568d[_0x2e15('0xe')]);_0x1f604d();})[_0x2e15('0x12')](function(_0x2137f1){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x7d7680,JSON[_0x2e15('0x13')](_0x2137f1));_0x1202d5(_0x2137f1);});});}exports[_0x2e15('0x14')]=function(_0x40278d,_0x343860){return function(_0x5a1b02){try{if(!_[_0x2e15('0x15')](this[_0x2e15('0x16')][_0x2e15('0x17')])){logger[_0x2e15('0x11')](_0x2e15('0x18'),_0x40278d,_0x2e15('0x19'));return _0x5a1b02[_0x2e15('0x1a')]();}var _0x183448={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2e15('0x1b')](_0x2e15('0x1c')),'direction':'out'};if(this[_0x2e15('0x1d')]===_0x2e15('0x1e')||this[_0x2e15('0x1d')]===_0x2e15('0x1f')){_0x183448[_0x2e15('0x20')]=this['interaction'][_0x2e15('0x20')];}var _0x43238b=this['channel'];if(_0x43238b==='chat'){_0x183448[_0x2e15('0x21')]=this['account']['id'];}else{_0x183448[_[_0x2e15('0x22')](_0x43238b)+_0x2e15('0x23')]=this[_0x2e15('0x24')]['id'];}_0x183448[_[_0x2e15('0x22')](_0x43238b)+'InteractionId']=this[_0x2e15('0x16')]['id'];if(this[_0x2e15('0x16')][_0x2e15('0x25')]){var _0x3bd3c1=_0x343860[0x4];if(!_['isEmpty'](_0x3bd3c1)){_0x183448[_0x2e15('0xe')]=utils[_0x2e15('0x26')](_0x3bd3c1,this);return rpc[_0x43238b+_0x2e15('0x27')]['create'](_0x183448)[_0x2e15('0x10')](function(_0x525e23){logger[_0x2e15('0x11')](_0x2e15('0x18'),_0x40278d,_0x183448[_0x2e15('0xe')]);})['catch'](function(_0x22283a){logger[_0x2e15('0x28')]('[%s][DIALOGFLOWV2]\x20%s',_0x40278d,JSON[_0x2e15('0x13')](_0x22283a));})[_0x2e15('0x29')](function(){logger['info'](_0x2e15('0x2a'),_0x40278d);_0x5a1b02[_0x2e15('0x2b')]();});}else{logger[_0x2e15('0x11')](_0x2e15('0x2c'),_0x40278d);_0x5a1b02['stop']();}}else{var _0x3c1891=this;var _0x4040fa=_0x343860[0x2][_0x2e15('0x2d')](/\\n/g,'\x0a');var _0x31024b={'credentials':{'private_key':_0x4040fa,'client_email':_0x343860[0x1]}};var _0x54c07f=new dialogflow[(_0x2e15('0x2e'))](_0x31024b);var _0x443f95=_0x54c07f[_0x2e15('0x2f')](_0x343860[0x0],md5(_0x3c1891[_0x2e15('0x16')]['id']));var _0x37829a={'session':_0x443f95,'queryInput':{'text':{'text':_0x3c1891['message'][_0x2e15('0xe')],'languageCode':_0x343860[0x3]||'en'}}};return _0x54c07f[_0x2e15('0x30')](_0x37829a)[_0x2e15('0x10')](function(_0x58c17a){if(_0x58c17a&&_0x58c17a[_0x2e15('0x31')]){_0x3c1891[_0x2e15('0xe')][_0x2e15('0x32')]=_0x58c17a;var _0x2a4232=_0x58c17a[0x0];var _0x2fa846=_0x2a4232[_0x2e15('0x33')][_0x2e15('0x34')]&&_0x2a4232[_0x2e15('0x33')][_0x2e15('0x34')][_0x2e15('0x35')]?_0x2a4232[_0x2e15('0x33')][_0x2e15('0x34')][_0x2e15('0x35')][_0x2e15('0x36')][_0x2e15('0x37')]:![];_0x3c1891[_0x2e15('0xe')][_0x2e15('0x38')]=_0x2a4232[_0x2e15('0x33')]['action'];_0x3c1891['body'][_0x2e15('0x39')]=_0x2a4232[_0x2e15('0x33')][_0x2e15('0x3a')];_0x3c1891[_0x2e15('0xe')][_0x2e15('0x3b')]=_0x2a4232[_0x2e15('0x33')][_0x2e15('0x34')]&&_0x2a4232[_0x2e15('0x33')][_0x2e15('0x34')][_0x2e15('0x35')]?_0x2a4232[_0x2e15('0x33')][_0x2e15('0x34')][_0x2e15('0x35')][_0x2e15('0x36')]['boolValue']:![];_0x3c1891[_0x2e15('0xe')][_0x2e15('0x3c')]=_0x2a4232[_0x2e15('0x33')][_0x2e15('0x3d')][_0x2e15('0x3e')];_0x3c1891[_0x2e15('0xe')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2a4232[_0x2e15('0x33')]['intent'][_0x2e15('0x3f')];_0x3c1891[_0x2e15('0xe')][_0x2e15('0x40')]=_0x2a4232[_0x2e15('0x33')]['intent'][_0x2e15('0x41')];_0x3c1891[_0x2e15('0xe')][_0x2e15('0x42')]=_0x2a4232[_0x2e15('0x33')][_0x2e15('0x43')];_0x3c1891['body'][_0x2e15('0x44')]=_0x2a4232[_0x2e15('0x33')]['queryText'];_0x3c1891[_0x2e15('0xe')][_0x2e15('0x45')]=_0x2a4232[_0x2e15('0x33')][_0x2e15('0x46')];_0x183448[_0x2e15('0x47')]=_0x2e15('0x32');_0x183448['providerResponse']=JSON['stringify'](_0x58c17a);var _0x459848=[];for(var _0x399561=0x0;_0x399561<_0x58c17a[_0x2e15('0x31')];_0x399561++){var _0x357cce=_0x58c17a[_0x399561];if(_0x357cce&&_0x357cce[_0x2e15('0x33')]&&_0x357cce[_0x2e15('0x33')][_0x2e15('0x48')]){_0x459848[_0x2e15('0x49')](createMessage(_0x40278d,_0x43238b,_0x183448,_0x357cce['queryResult'][_0x2e15('0x48')]));}}return Promise['all'](_0x459848)[_0x2e15('0x10')](function(){if(_0x2fa846){_0x5a1b02['next']();}else{_0x5a1b02['stop']();}})[_0x2e15('0x12')](function(_0x3cd820){logger[_0x2e15('0x28')](_0x2e15('0x18'),_0x40278d,JSON['stringify'](_0x3cd820));_0x5a1b02[_0x2e15('0x1a')]();});}})[_0x2e15('0x12')](function(_0x5e1934){logger[_0x2e15('0x28')]('[%s][DIALOGFLOWV2]\x20%s',_0x40278d,_0x5e1934[_0x2e15('0x4a')]);_0x5a1b02[_0x2e15('0x1a')]();});}}catch(_0x4aaf64){logger[_0x2e15('0x28')](_0x2e15('0x18'),_0x40278d,JSON[_0x2e15('0x13')](_0x4aaf64));_0x5a1b02[_0x2e15('0x2b')]();}};}; \ No newline at end of file +var _0x7d15=['lodash','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','length','fulfillmentText','push','all'];(function(_0x2fc11f,_0x384559){var _0x5097f1=function(_0x30252b){while(--_0x30252b){_0x2fc11f['push'](_0x2fc11f['shift']());}};_0x5097f1(++_0x384559);}(_0x7d15,0x14f));var _0x57d1=function(_0x4edc53,_0x577a65){_0x4edc53=_0x4edc53-0x0;var _0x21e4cf=_0x7d15[_0x4edc53];return _0x21e4cf;};'use strict';var _=require(_0x57d1('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x57d1('0x1'));var moment=require('moment');var Promise=require(_0x57d1('0x2'));var logger=require(_0x57d1('0x3'))(_0x57d1('0x4'));var utils=require(_0x57d1('0x5'));var rpc={'chatMessage':require(_0x57d1('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x57d1('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x57d1('0x8'))};function createMessage(_0x2281ed,_0x122580,_0x16a85e,_0x2ce483){return new Promise(function(_0x5003d8,_0x1288a4){var _0x49f061=_['clone'](_0x16a85e);_0x49f061['body']=_0x2ce483;return rpc[_0x122580+'Message'][_0x57d1('0x9')](_0x49f061)[_0x57d1('0xa')](function(){logger[_0x57d1('0xb')](_0x57d1('0xc'),_0x2281ed,_0x49f061[_0x57d1('0xd')]);_0x5003d8();})[_0x57d1('0xe')](function(_0x2af659){logger[_0x57d1('0xf')](_0x57d1('0xc'),_0x2281ed,JSON[_0x57d1('0x10')](_0x2af659));_0x1288a4(_0x2af659);});});}exports[_0x57d1('0x11')]=function(_0x338f60,_0x5e5be8){return function(_0x57a482){try{if(!_[_0x57d1('0x12')](this[_0x57d1('0x13')]['UserId'])){logger[_0x57d1('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x338f60,_0x57d1('0x14'));return _0x57a482[_0x57d1('0x15')]();}var _0x594a79={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x57d1('0x16')),'direction':_0x57d1('0x17')};if(this[_0x57d1('0x18')]===_0x57d1('0x19')||this[_0x57d1('0x18')]===_0x57d1('0x1a')){_0x594a79[_0x57d1('0x1b')]=this[_0x57d1('0x13')][_0x57d1('0x1b')];}var _0x14ad6f=this[_0x57d1('0x18')];if(_0x14ad6f===_0x57d1('0x1c')){_0x594a79[_0x57d1('0x1d')]=this['account']['id'];}else{_0x594a79[_[_0x57d1('0x1e')](_0x14ad6f)+_0x57d1('0x1f')]=this[_0x57d1('0x20')]['id'];}_0x594a79[_[_0x57d1('0x1e')](_0x14ad6f)+_0x57d1('0x21')]=this[_0x57d1('0x13')]['id'];if(this[_0x57d1('0x13')]['created']){var _0x74bfa9=_0x5e5be8[0x4];if(!_[_0x57d1('0x22')](_0x74bfa9)){_0x594a79[_0x57d1('0xd')]=utils[_0x57d1('0x23')](_0x74bfa9,this);return rpc[_0x14ad6f+'Message'][_0x57d1('0x9')](_0x594a79)[_0x57d1('0xa')](function(_0x46f7e3){logger[_0x57d1('0xb')](_0x57d1('0xc'),_0x338f60,_0x594a79[_0x57d1('0xd')]);})[_0x57d1('0xe')](function(_0x5add81){logger[_0x57d1('0xf')](_0x57d1('0xc'),_0x338f60,JSON[_0x57d1('0x10')](_0x5add81));})[_0x57d1('0x24')](function(){logger[_0x57d1('0xb')](_0x57d1('0x25'),_0x338f60);_0x57a482[_0x57d1('0x26')]();});}else{logger[_0x57d1('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x338f60);_0x57a482['stop']();}}else{var _0x2ad152=this;var _0x314302=_0x5e5be8[0x2][_0x57d1('0x27')](/\\n/g,'\x0a');var _0x5ee9a3={'credentials':{'private_key':_0x314302,'client_email':_0x5e5be8[0x1]}};var _0x575a08=new dialogflow[(_0x57d1('0x28'))](_0x5ee9a3);var _0x7b039b=_0x575a08['sessionPath'](_0x5e5be8[0x0],md5(_0x2ad152[_0x57d1('0x13')]['id']));var _0x50607a={'session':_0x7b039b,'queryInput':{'text':{'text':_0x2ad152[_0x57d1('0x29')][_0x57d1('0xd')],'languageCode':_0x5e5be8[0x3]||'en'}}};return _0x575a08[_0x57d1('0x2a')](_0x50607a)['then'](function(_0x35d1c8){if(_0x35d1c8&&_0x35d1c8['length']){_0x2ad152[_0x57d1('0xd')][_0x57d1('0x2b')]=_0x35d1c8;var _0x131ca3=_0x35d1c8[0x0];var _0x4f41bb=_0x131ca3[_0x57d1('0x2c')]['diagnosticInfo']&&_0x131ca3['queryResult'][_0x57d1('0x2d')][_0x57d1('0x2e')]?_0x131ca3['queryResult'][_0x57d1('0x2d')][_0x57d1('0x2e')][_0x57d1('0x2f')][_0x57d1('0x30')]:![];_0x2ad152[_0x57d1('0xd')][_0x57d1('0x31')]=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x32')];_0x2ad152[_0x57d1('0xd')][_0x57d1('0x33')]=_0x131ca3['queryResult'][_0x57d1('0x34')];_0x2ad152[_0x57d1('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x2d')]&&_0x131ca3['queryResult'][_0x57d1('0x2d')][_0x57d1('0x2e')]?_0x131ca3[_0x57d1('0x2c')]['diagnosticInfo'][_0x57d1('0x2e')][_0x57d1('0x2f')][_0x57d1('0x30')]:![];_0x2ad152['body']['DIALOGFLOWV2_INTENTNAME']=_0x131ca3['queryResult'][_0x57d1('0x35')][_0x57d1('0x36')];_0x2ad152[_0x57d1('0xd')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x35')][_0x57d1('0x37')];_0x2ad152[_0x57d1('0xd')][_0x57d1('0x38')]=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x35')]['isFallback'];_0x2ad152[_0x57d1('0xd')][_0x57d1('0x39')]=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x3a')];_0x2ad152[_0x57d1('0xd')][_0x57d1('0x3b')]=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x3c')];_0x2ad152[_0x57d1('0xd')][_0x57d1('0x3d')]=_0x131ca3[_0x57d1('0x2c')][_0x57d1('0x3e')];_0x594a79['providerName']='dialogflowV2';_0x594a79['providerResponse']=JSON[_0x57d1('0x10')](_0x35d1c8);var _0x3b58c4=[];for(var _0x44a594=0x0;_0x44a594<_0x35d1c8[_0x57d1('0x3f')];_0x44a594++){var _0x43bd53=_0x35d1c8[_0x44a594];if(_0x43bd53&&_0x43bd53['queryResult']&&_0x43bd53[_0x57d1('0x2c')][_0x57d1('0x40')]){_0x3b58c4[_0x57d1('0x41')](createMessage(_0x338f60,_0x14ad6f,_0x594a79,_0x43bd53[_0x57d1('0x2c')]['fulfillmentText']));}}return Promise[_0x57d1('0x42')](_0x3b58c4)[_0x57d1('0xa')](function(){if(_0x4f41bb){_0x57a482[_0x57d1('0x15')]();}else{_0x57a482[_0x57d1('0x26')]();}})[_0x57d1('0xe')](function(_0x729425){logger['error'](_0x57d1('0xc'),_0x338f60,JSON[_0x57d1('0x10')](_0x729425));_0x57a482[_0x57d1('0x15')]();});}})['catch'](function(_0x4213f0){logger[_0x57d1('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x338f60,_0x4213f0[_0x57d1('0x29')]);_0x57a482[_0x57d1('0x15')]();});}}catch(_0x34e5b8){logger[_0x57d1('0xf')](_0x57d1('0xc'),_0x338f60,JSON[_0x57d1('0x10')](_0x34e5b8));_0x57a482['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 7cff1f0..1da0631 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f6c=['validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7f6c,0xa0));var _0xc7f6=function(_0x31a974,_0x5874d8){_0x31a974=_0x31a974-0x0;var _0x3798b6=_0x7f6c[_0x31a974];return _0x3798b6;};'use strict';var schema=require(_0xc7f6('0x0'));var _=require(_0xc7f6('0x1'));var htmlToText=require(_0xc7f6('0x2'));var utils=require(_0xc7f6('0x3'));var logger=require(_0xc7f6('0x4'))(_0xc7f6('0x5'));var gotoif=schema({'condition':{'type':_0xc7f6('0x6'),'required':!![],'message':_0xc7f6('0x7')},'priorityTrue':{'type':'number','message':_0xc7f6('0x8')},'priorityFalse':{'type':_0xc7f6('0x9'),'message':_0xc7f6('0xa')}});exports[_0xc7f6('0xb')]=function(_0x4e1d85,_0x1ee29c){return function(_0x1cbf90){try{var _0x4ba77e={'condition':htmlToText[_0xc7f6('0xc')](utils[_0xc7f6('0xd')](_0x1ee29c[0x0],this),{'wordwrap':![]})[_0xc7f6('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ee29c[0x1],'priorityFalse':_0x1ee29c[0x2]};var _0x52e40d=gotoif['validate'](_0x4ba77e,{'typecast':!![]});if(_0x52e40d[_0xc7f6('0xf')]){logger[_0xc7f6('0x10')](_0xc7f6('0x11'),_0x4e1d85,_[_0xc7f6('0x12')](_0x52e40d,_0xc7f6('0x13'))['join'](',\x20'));_0x1cbf90[_0xc7f6('0x14')]();}else{try{var _0x441abb=eval('('+_0x4ba77e[_0xc7f6('0x15')]+')');var _0x6fa3aa=_0x441abb?_0x4ba77e[_0xc7f6('0x16')]:_0x4ba77e[_0xc7f6('0x17')];logger['info'](_0xc7f6('0x18'),_0x4e1d85,_0x4ba77e[_0xc7f6('0x15')],_0x441abb,_0x6fa3aa||_0xc7f6('0x19'));if(_0x6fa3aa){var _0x5d04e1=_[_0xc7f6('0x1a')](_0x1cbf90[_0xc7f6('0x1b')](),{'p':_0x6fa3aa});if(_0x5d04e1>=0x0){logger[_0xc7f6('0x1c')](_0xc7f6('0x1d'),_0x4e1d85,_0x6fa3aa||_0xc7f6('0x19'),_0x5d04e1);_0x1cbf90[_0xc7f6('0x19')](_0x5d04e1);}else{logger[_0xc7f6('0x1c')](_0xc7f6('0x1e'),_0x4e1d85,_0x6fa3aa||'next');_0x1cbf90[_0xc7f6('0x14')]();}}else{_0x1cbf90['next']();}}catch(_0x4a215b){logger[_0xc7f6('0x10')](_0xc7f6('0x1f'),_0x4e1d85,_0x4a215b[_0xc7f6('0x13')]);_0x1cbf90['stop']();}}}catch(_0x2000df){logger[_0xc7f6('0x10')](_0xc7f6('0x11'),_0x4e1d85,JSON['stringify'](_0x2000df));_0x1cbf90['stop']();}};}; \ No newline at end of file +var _0x6156=['findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join','stop','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x6156,0xe5));var _0x6615=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6156[_0x2d7f0e];return _0x110b07;};'use strict';var schema=require('validate');var _=require(_0x6615('0x0'));var htmlToText=require(_0x6615('0x1'));var utils=require(_0x6615('0x2'));var logger=require(_0x6615('0x3'))(_0x6615('0x4'));var gotoif=schema({'condition':{'type':_0x6615('0x5'),'required':!![],'message':_0x6615('0x6')},'priorityTrue':{'type':_0x6615('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x6615('0x7'),'message':_0x6615('0x8')}});exports[_0x6615('0x9')]=function(_0x4a9e30,_0x10952){return function(_0x40d8d5){try{var _0x2d214c={'condition':htmlToText[_0x6615('0xa')](utils[_0x6615('0xb')](_0x10952[0x0],this),{'wordwrap':![]})[_0x6615('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x10952[0x1],'priorityFalse':_0x10952[0x2]};var _0x17bac3=gotoif[_0x6615('0xd')](_0x2d214c,{'typecast':!![]});if(_0x17bac3['length']){logger[_0x6615('0xe')](_0x6615('0xf'),_0x4a9e30,_[_0x6615('0x10')](_0x17bac3,_0x6615('0x11'))[_0x6615('0x12')](',\x20'));_0x40d8d5[_0x6615('0x13')]();}else{try{var _0x5b49f0=eval('('+_0x2d214c['condition']+')');var _0x3de656=_0x5b49f0?_0x2d214c['priorityTrue']:_0x2d214c['priorityFalse'];logger['info'](_0x6615('0x14'),_0x4a9e30,_0x2d214c[_0x6615('0x15')],_0x5b49f0,_0x3de656||_0x6615('0x16'));if(_0x3de656){var _0x2bc367=_[_0x6615('0x17')](_0x40d8d5[_0x6615('0x18')](),{'p':_0x3de656});if(_0x2bc367>=0x0){logger['info'](_0x6615('0x19'),_0x4a9e30,_0x3de656||_0x6615('0x16'),_0x2bc367);_0x40d8d5[_0x6615('0x16')](_0x2bc367);}else{logger['info'](_0x6615('0x1a'),_0x4a9e30,_0x3de656||_0x6615('0x16'));_0x40d8d5[_0x6615('0x13')]();}}else{_0x40d8d5[_0x6615('0x16')]();}}catch(_0x29c555){logger[_0x6615('0xe')](_0x6615('0x1b'),_0x4a9e30,_0x29c555[_0x6615('0x11')]);_0x40d8d5[_0x6615('0x13')]();}}}catch(_0x180269){logger['error'](_0x6615('0xf'),_0x4a9e30,JSON['stringify'](_0x180269));_0x40d8d5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index e43b9e7..b7a854d 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 _0x7753=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join'];(function(_0x43cce0,_0x5b432b){var _0x663f7e=function(_0x59c38c){while(--_0x59c38c){_0x43cce0['push'](_0x43cce0['shift']());}};_0x663f7e(++_0x5b432b);}(_0x7753,0x19a));var _0x3775=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x7753[_0x5180c3];return _0x55c975;};'use strict';var schema=require(_0x3775('0x0'));var _=require('lodash');var logger=require(_0x3775('0x1'))(_0x3775('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3775('0x3')}});exports[_0x3775('0x4')]=function(_0x57e28f,_0x5e81df){return function(_0x29bec2){try{var _0x8b917a={'priority':_0x5e81df[0x0]};var _0x3d5b8b=gotop[_0x3775('0x0')](_0x8b917a,{'typecast':!![]});if(_0x3d5b8b[_0x3775('0x5')]){logger[_0x3775('0x6')](_0x3775('0x7'),_0x57e28f,_[_0x3775('0x8')](_0x3d5b8b,'message')[_0x3775('0x9')](',\x20'));_0x29bec2[_0x3775('0xa')]();}else{logger[_0x3775('0xb')](_0x3775('0xc'),_0x57e28f,_0x8b917a[_0x3775('0xd')]);if(_0x8b917a[_0x3775('0xd')]){var _0xb8b701=_[_0x3775('0xe')](_0x29bec2[_0x3775('0xf')](),{'p':_0x8b917a[_0x3775('0xd')]});if(_0xb8b701>=0x0){logger['info'](_0x3775('0x10'),_0x57e28f,_0x8b917a['priority']||_0x3775('0x11'),_0xb8b701);_0x29bec2[_0x3775('0x11')](_0xb8b701);}else{logger['info'](_0x3775('0x12'),_0x57e28f,_0x8b917a['priority']||_0x3775('0x11'));_0x29bec2[_0x3775('0xa')]();}}else{_0x29bec2['next']();}}}catch(_0x1fbad0){logger[_0x3775('0x6')](_0x3775('0x7'),_0x57e28f,JSON[_0x3775('0x13')](_0x1fbad0));_0x29bec2[_0x3775('0xa')]();}};}; \ No newline at end of file +var _0x7a45=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','[%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','stop','stringify','lodash','../../../../config/logger','routing'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x7a45,0x9d));var _0x57a4=function(_0x8acd34,_0xc17fcd){_0x8acd34=_0x8acd34-0x0;var _0x308954=_0x7a45[_0x8acd34];return _0x308954;};'use strict';var schema=require('validate');var _=require(_0x57a4('0x0'));var logger=require(_0x57a4('0x1'))(_0x57a4('0x2'));var gotop=schema({'priority':{'type':_0x57a4('0x3'),'required':!![],'message':_0x57a4('0x4')}});exports[_0x57a4('0x5')]=function(_0x5941bd,_0x47f25a){return function(_0x1bc3b7){try{var _0x5d75e0={'priority':_0x47f25a[0x0]};var _0x24ba7e=gotop['validate'](_0x5d75e0,{'typecast':!![]});if(_0x24ba7e[_0x57a4('0x6')]){logger[_0x57a4('0x7')](_0x57a4('0x8'),_0x5941bd,_['map'](_0x24ba7e,'message')[_0x57a4('0x9')](',\x20'));_0x1bc3b7['stop']();}else{logger['info'](_0x57a4('0xa'),_0x5941bd,_0x5d75e0[_0x57a4('0xb')]);if(_0x5d75e0[_0x57a4('0xb')]){var _0x4e4839=_[_0x57a4('0xc')](_0x1bc3b7[_0x57a4('0xd')](),{'p':_0x5d75e0[_0x57a4('0xb')]});if(_0x4e4839>=0x0){logger['info'](_0x57a4('0xe'),_0x5941bd,_0x5d75e0[_0x57a4('0xb')]||'next',_0x4e4839);_0x1bc3b7[_0x57a4('0xf')](_0x4e4839);}else{logger[_0x57a4('0x10')](_0x57a4('0x11'),_0x5941bd,_0x5d75e0['priority']||_0x57a4('0xf'));_0x1bc3b7[_0x57a4('0x12')]();}}else{_0x1bc3b7[_0x57a4('0xf')]();}}}catch(_0xb53d0a){logger[_0x57a4('0x7')](_0x57a4('0x8'),_0x5941bd,JSON[_0x57a4('0x13')](_0xb53d0a));_0x1bc3b7['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 55d2347..2e164a9 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 _0x4f37=['Message','create','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId'];(function(_0x550a68,_0x194192){var _0x2f7c9e=function(_0x5b6136){while(--_0x5b6136){_0x550a68['push'](_0x550a68['shift']());}};_0x2f7c9e(++_0x194192);}(_0x4f37,0xa4));var _0x74f3=function(_0x36a6ab,_0x1343b4){_0x36a6ab=_0x36a6ab-0x0;var _0xa8ec3d=_0x4f37[_0x36a6ab];return _0xa8ec3d;};'use strict';var _=require(_0x74f3('0x0'));var utils=require(_0x74f3('0x1'));var logger=require(_0x74f3('0x2'))(_0x74f3('0x3'));var rpc={'chatMessage':require(_0x74f3('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x74f3('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x74f3('0x6')),'whatsappMessage':require(_0x74f3('0x7'))};exports[_0x74f3('0x8')]=function(_0x3ce17b,_0x4a85a3){return function(_0x20926c){try{var _0x1f7004={'body':utils[_0x74f3('0x9')](_0x4a85a3[0x0],this),'ContactId':this[_0x74f3('0xa')]['id']};if(this['channel']===_0x74f3('0xb')){_0x1f7004[_0x74f3('0xc')]=this[_0x74f3('0xd')]['id'];}else{_0x1f7004[_[_0x74f3('0xe')](this[_0x74f3('0xf')])+_0x74f3('0x10')]=this[_0x74f3('0xd')]['id'];}_0x1f7004[_[_0x74f3('0xe')](this['channel'])+_0x74f3('0x11')]=this['interaction']['id'];if(rpc[this[_0x74f3('0xf')]+'Message']){return rpc[this['channel']+_0x74f3('0x12')][_0x74f3('0x13')](_0x1f7004)['then'](function(_0x46d50f){logger[_0x74f3('0x14')](_0x74f3('0x15'),_0x3ce17b,_0x1f7004['body']);_0x20926c[_0x74f3('0x16')]();})['catch'](function(_0x4a3e88){logger[_0x74f3('0x17')](_0x74f3('0x15'),_0x3ce17b,JSON[_0x74f3('0x18')](_0x4a3e88));_0x20926c[_0x74f3('0x19')]();});}}catch(_0x13e10a){logger[_0x74f3('0x17')](_0x74f3('0x15'),_0x3ce17b,JSON[_0x74f3('0x18')](_0x13e10a));_0x20926c[_0x74f3('0x19')]();}};}; \ No newline at end of file +var _0x755e=['../../rpc/mailMessage','../../rpc/faxMessage','consequence','contact','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x755e,0x96));var _0xe755=function(_0x9ccc17,_0x1d087c){_0x9ccc17=_0x9ccc17-0x0;var _0x46e989=_0x755e[_0x9ccc17];return _0x46e989;};'use strict';var _=require(_0xe755('0x0'));var utils=require(_0xe755('0x1'));var logger=require(_0xe755('0x2'))(_0xe755('0x3'));var rpc={'chatMessage':require(_0xe755('0x4')),'openchannelMessage':require(_0xe755('0x5')),'mailMessage':require(_0xe755('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe755('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe755('0x8')]=function(_0x36eb84,_0xe29839){return function(_0x3b82da){try{var _0x3184c3={'body':utils['getMustacheRender'](_0xe29839[0x0],this),'ContactId':this[_0xe755('0x9')]['id']};if(this['channel']===_0xe755('0xa')){_0x3184c3['ChatWebsiteId']=this[_0xe755('0xb')]['id'];}else{_0x3184c3[_[_0xe755('0xc')](this[_0xe755('0xd')])+_0xe755('0xe')]=this[_0xe755('0xb')]['id'];}_0x3184c3[_[_0xe755('0xc')](this[_0xe755('0xd')])+_0xe755('0xf')]=this[_0xe755('0x10')]['id'];if(rpc[this[_0xe755('0xd')]+_0xe755('0x11')]){return rpc[this[_0xe755('0xd')]+'Message'][_0xe755('0x12')](_0x3184c3)[_0xe755('0x13')](function(_0x48d347){logger[_0xe755('0x14')](_0xe755('0x15'),_0x36eb84,_0x3184c3[_0xe755('0x16')]);_0x3b82da['next']();})[_0xe755('0x17')](function(_0x306ddc){logger['error'](_0xe755('0x15'),_0x36eb84,JSON[_0xe755('0x18')](_0x306ddc));_0x3b82da['stop']();});}}catch(_0x245763){logger['error'](_0xe755('0x15'),_0x36eb84,JSON[_0xe755('0x18')](_0x245763));_0x3b82da[_0xe755('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 4640096..be86fd8 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 _0xa068=['consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x2d20ff,_0x27576a){var _0x239ed5=function(_0x553cf2){while(--_0x553cf2){_0x2d20ff['push'](_0x2d20ff['shift']());}};_0x239ed5(++_0x27576a);}(_0xa068,0x93));var _0x8a06=function(_0x3ad7f7,_0x15e052){_0x3ad7f7=_0x3ad7f7-0x0;var _0x780cfa=_0xa068[_0x3ad7f7];return _0x780cfa;};'use strict';var utils=require(_0x8a06('0x0'));var logger=require(_0x8a06('0x1'))(_0x8a06('0x2'));exports[_0x8a06('0x3')]=function(_0x3377b9,_0x99f216){return function(_0x4e348b){try{logger[_0x8a06('0x4')]('[%s][NOOP]\x20%s',_0x3377b9,utils[_0x8a06('0x5')](_0x99f216[0x0],this));_0x4e348b[_0x8a06('0x6')]();}catch(_0x26c348){logger['error'](_0x8a06('0x7'),_0x3377b9,JSON[_0x8a06('0x8')](_0x26c348));_0x4e348b[_0x8a06('0x9')]();}};}; \ No newline at end of file +var _0xf30a=['routing','consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger'];(function(_0x44a792,_0x4b05e9){var _0x2464b5=function(_0x3fa126){while(--_0x3fa126){_0x44a792['push'](_0x44a792['shift']());}};_0x2464b5(++_0x4b05e9);}(_0xf30a,0xc6));var _0xaf30=function(_0x1bdfaa,_0x558233){_0x1bdfaa=_0x1bdfaa-0x0;var _0x4e057d=_0xf30a[_0x1bdfaa];return _0x4e057d;};'use strict';var utils=require(_0xaf30('0x0'));var logger=require(_0xaf30('0x1'))(_0xaf30('0x2'));exports[_0xaf30('0x3')]=function(_0x2fd1fb,_0x3799ce){return function(_0x1d9098){try{logger[_0xaf30('0x4')]('[%s][NOOP]\x20%s',_0x2fd1fb,utils[_0xaf30('0x5')](_0x3799ce[0x0],this));_0x1d9098[_0xaf30('0x6')]();}catch(_0x21cbc3){logger['error'](_0xaf30('0x7'),_0x2fd1fb,JSON[_0xaf30('0x8')](_0x21cbc3));_0x1d9098[_0xaf30('0x9')]();}};}; \ 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 361acf8..6dc295e 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 _0x22be=['body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','atimeout','rules','end','close','complete','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x22be,0x15c));var _0xe22b=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x22be[_0x178f52];return _0x556f99;};'use strict';var schema=require('validate');var _=require(_0xe22b('0x0'));var util=require('util');var seqqueue=require(_0xe22b('0x1'));var moment=require(_0xe22b('0x2'));var Redis=require(_0xe22b('0x3'));var config=require(_0xe22b('0x4'));var logger=require(_0xe22b('0x5'))('routing');var strategy=require(_0xe22b('0x6'));config[_0xe22b('0x7')]=_[_0xe22b('0x8')](config[_0xe22b('0x7')],{'host':_0xe22b('0x9'),'port':0x18eb});var io=require(_0xe22b('0xa'))(new Redis(config[_0xe22b('0x7')]));var attributes=['id',_0xe22b('0xb'),_0xe22b('0xc'),_0xe22b('0xd'),_0xe22b('0xe'),_0xe22b('0xf')];function emit(_0x4c7281,_0x3ff17e,_0x58b0ee){io['to'](_0x4c7281)[_0xe22b('0x10')](_0x3ff17e,_0x58b0ee);}function emitChannelQueueInteraction(_0x26925f,_0x16fc68,_0x2c54ea,_0x1a3df9,_0x5785a9,_0x174571,_0x5537be,_0x255607){var _0x48eb5c=_[_0xe22b('0x11')](_0x2c54ea);_0x48eb5c[_0xe22b('0xb')]=_0x255607;_0x48eb5c[_0xe22b('0xd')]=_0x16fc68;_0x48eb5c[_0xe22b('0xc')]=_0x1a3df9;_0x48eb5c['id']=_0x5785a9;if(_0x174571){_0x5537be[util[_0xe22b('0x12')]('%sQueuesWaitingInteractions',_0x26925f)][_0x5785a9]=_[_0xe22b('0x13')](_0x48eb5c,attributes);}else{delete _0x5537be[util[_0xe22b('0x12')]('%sQueuesWaitingInteractions',_0x26925f)][_0x5785a9];}emit(util[_0xe22b('0x12')](_0xe22b('0x14'),_0x26925f,_0x16fc68),util[_0xe22b('0x12')]('%s_queue_waiting_interaction:%s',_0x26925f,_0x174571?_0xe22b('0x15'):_0xe22b('0x16')),_[_0xe22b('0x13')](_0x48eb5c,attributes));}var rpc={'openchannelQueueReport':require(_0xe22b('0x17')),'mailQueueReport':require(_0xe22b('0x18')),'chatQueueReport':require(_0xe22b('0x19')),'smsQueueReport':require(_0xe22b('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe22b('0x1b'))};var queue=schema({'name':{'type':_0xe22b('0x1c'),'required':!![],'message':_0xe22b('0x1d')},'timeout':{'type':'number','message':_0xe22b('0x1e')}});function startRouting(_0x4510a9,_0x129fdc,_0x10e60e,_0x368c1b){if(_0x4510a9&&_0x129fdc&&_0x10e60e){_0x129fdc[_0xe22b('0x1f')]+=0x1;var _0x5c93e6={'uniqueid':_0x4510a9,'from':_0x10e60e[_0xe22b('0x20')]?_0x10e60e[_0xe22b('0x20')][_0xe22b('0xe')]:'','joinAt':moment()['format'](_0xe22b('0x21')),'ContactId':_0x10e60e[_0xe22b('0x22')]?_0x10e60e['contact']['id']:null,'ListId':_0x10e60e[_0xe22b('0x23')]?_0x10e60e[_0xe22b('0x23')]['id']:null};_0x5c93e6[_[_0xe22b('0x24')](_0x10e60e[_0xe22b('0x25')])+_0xe22b('0x26')]=_0x129fdc['id']||null;_0x5c93e6[_[_0xe22b('0x24')](_0x10e60e['channel'])+_0xe22b('0x27')]=_0x10e60e[_0xe22b('0x28')]?_0x10e60e[_0xe22b('0x28')]['id']:null;_0x5c93e6[_[_0xe22b('0x24')](_0x10e60e[_0xe22b('0x25')])+_0xe22b('0x29')]=_0x10e60e[_0xe22b('0x2a')]?_0x10e60e[_0xe22b('0x2a')]['id']:null;_0x5c93e6[_['upperFirst'](_0x10e60e[_0xe22b('0x25')])+(_0x10e60e[_0xe22b('0x25')]!==_0xe22b('0x2b')?_0xe22b('0x2c'):_0xe22b('0x2d'))]=_0x10e60e[_0xe22b('0xc')]?_0x10e60e['account']['id']:null;logger[_0xe22b('0x2e')](util['format'](_0xe22b('0x2f'),_0x4510a9,_0x129fdc[_0xe22b('0x30')]));emitChannelQueueInteraction(_0x10e60e[_0xe22b('0x25')],_0x129fdc['name'],_0x5c93e6,_0x10e60e[_0xe22b('0xc')]['name'],_0x10e60e['message']['id'],!![],_0x368c1b,_0x129fdc['id']);if(rpc[_0x10e60e[_0xe22b('0x25')]+_0xe22b('0x31')]){return rpc[_0x10e60e[_0xe22b('0x25')]+'QueueReport'][_0xe22b('0x32')](_0x5c93e6)[_0xe22b('0x33')](function(_0xf69419){logger[_0xe22b('0x34')]('create\x20queue\x20report');});}}}function stopRouting(_0x454ad8,_0x39cb06,_0x290405,_0x3100aa){if(_0x454ad8&&_0x39cb06){_0x39cb06['waiting']-=0x1;var _0x170c36={'leaveAt':moment()['format'](_0xe22b('0x21')),'acceptAt':moment()[_0xe22b('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe22b('0x35')};logger[_0xe22b('0x2e')](util[_0xe22b('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x454ad8,_0x39cb06[_0xe22b('0x30')]));emitChannelQueueInteraction(_0x290405[_0xe22b('0x25')],_0x39cb06[_0xe22b('0x30')],_0x290405[_0xe22b('0x20')],_0x290405[_0xe22b('0xc')][_0xe22b('0x30')],_0x290405[_0xe22b('0x2a')]['id'],![],_0x3100aa,_0x39cb06['id']);if(rpc[_0x290405[_0xe22b('0x25')]+'QueueReport']){return rpc[_0x290405['channel']+_0xe22b('0x31')][_0xe22b('0x36')](_0x454ad8,_0x170c36)['catch'](function(_0x930f4e){logger[_0xe22b('0x34')]('update\x20queue\x20report');});}}}function endRouting(_0x428b17,_0x3d55c1,_0x5c006b,_0xa1643f){if(_0x428b17&&_0x3d55c1){_0x3d55c1['waiting']-=0x1;var _0x5af6ea={'leaveAt':moment()[_0xe22b('0x12')](_0xe22b('0x21')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe22b('0x37')};logger[_0xe22b('0x2e')](util[_0xe22b('0x12')](_0xe22b('0x38'),_0x428b17,_0x3d55c1['name']));emitChannelQueueInteraction(_0x5c006b['channel'],_0x3d55c1[_0xe22b('0x30')],_0x5c006b[_0xe22b('0x20')],_0x5c006b[_0xe22b('0xc')][_0xe22b('0x30')],_0x5c006b[_0xe22b('0x2a')]['id'],![],_0xa1643f);if(rpc[_0x5c006b[_0xe22b('0x25')]+'QueueReport']){return rpc[_0x5c006b[_0xe22b('0x25')]+'QueueReport'][_0xe22b('0x36')](_0x428b17,_0x5af6ea)[_0xe22b('0x33')](function(_0x5d5b20){logger[_0xe22b('0x34')](_0xe22b('0x39'));});}}}function handleFindQueue(_0x2fbe07){return function(_0x25d73c){return _0x25d73c[_0xe22b('0x30')][_0xe22b('0x3a')]()===_0x2fbe07[_0xe22b('0x3a')]();};}exports[_0xe22b('0x3b')]=function(_0x4bb68e,_0x56309d,_0x427272,_0x424a47){return function(_0x34a00a){try{var _0x14c52f={'name':_0x56309d[0x0],'timeout':_0x56309d[0x1]};var _0x3cd7e7=queue[_0xe22b('0x3c')](_0x14c52f,{'typecast':!![]});if(_0x3cd7e7[_0xe22b('0x3d')]){logger[_0xe22b('0x34')](_0xe22b('0x3e'),_0x4bb68e,_['map'](_0x3cd7e7,'message')[_0xe22b('0x3f')](',\x20'));_0x34a00a[_0xe22b('0x40')]();}else{var _0x31c02a=_[_0xe22b('0x41')](_0x427272[_0x424a47[_0xe22b('0x25')]+'Queues'],handleFindQueue(_0x14c52f[_0xe22b('0x30')]));if(_0x31c02a){startRouting(_0x4bb68e,_0x31c02a,_0x424a47,_0x427272);var _0x276768=(_0x31c02a[_0xe22b('0x37')]||0xa)*0x3e8;var _0x2b75ec=(_0x14c52f[_0xe22b('0x37')]||0x14)*0x3e8;var _0xc425cd,_0x4eb177;if(_0x276768>_0x2b75ec){_0x2b75ec=_0x276768;}var _0x342515=seqqueue['createQueue'](_0x276768);_0x342515['id']=_0x4bb68e;_0x342515[_0xe22b('0x42')]=_0x276768;_0x342515['qtimeout']=_0x2b75ec;_0x342515['channel']=_0x424a47[_0xe22b('0x25')];_0x427272[_0xe22b('0x43')][_0x4bb68e]['on'](_0xe22b('0x44'),function(){logger[_0xe22b('0x2e')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4bb68e);stopRouting(_0x4bb68e,_0x31c02a,_0x424a47,_0x427272);clearTimeout(_0xc425cd);_0xc425cd=undefined;_0x342515[_0xe22b('0x45')](!![]);if(_0x427272[_0xe22b('0x43')][_0x4bb68e]){delete _0x427272[_0xe22b('0x43')][_0x4bb68e];}_0x34a00a[_0xe22b('0x40')]();});_0x427272[_0xe22b('0x43')][_0x4bb68e]['on'](_0xe22b('0x46'),function(){if(_0x427272[_0xe22b('0x43')][_0x4bb68e]){delete _0x427272[_0xe22b('0x43')][_0x4bb68e];}});_0xc425cd=setTimeout(function(){logger[_0xe22b('0x2e')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4bb68e);endRouting(_0x4bb68e,_0x31c02a,_0x424a47,_0x427272);clearTimeout(_0xc425cd);_0x342515[_0xe22b('0x45')](!![]);_0x34a00a['next']();},_0x2b75ec);switch(_0x31c02a[_0xe22b('0x47')]){case'rrmemory':strategy[_0xe22b('0x48')](_0x342515,_0x31c02a,_0x427272,_0x424a47);break;default:strategy[_0xe22b('0x49')](_0x342515,_0x31c02a,_0x427272,_0x424a47);}}else{logger[_0xe22b('0x34')](_0xe22b('0x4a'),_0x4bb68e,_0x14c52f[_0xe22b('0x30')]);_0x34a00a[_0xe22b('0x40')]();}}}catch(_0x1bea71){console[_0xe22b('0x4b')](_0x1bea71);logger[_0xe22b('0x34')](_0xe22b('0x3e'),_0x4bb68e,_0x1bea71['stack']);_0x34a00a['stop']();}};}; \ No newline at end of file +var _0x2779=['Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','clone','queue','format','%sQueuesWaitingInteractions','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find'];(function(_0x39b964,_0x48dfe5){var _0xbdda3b=function(_0x309ddf){while(--_0x309ddf){_0x39b964['push'](_0x39b964['shift']());}};_0xbdda3b(++_0x48dfe5);}(_0x2779,0x143));var _0x9277=function(_0x11fe30,_0x32f54b){_0x11fe30=_0x11fe30-0x0;var _0x4cf5dc=_0x2779[_0x11fe30];return _0x4cf5dc;};'use strict';var schema=require(_0x9277('0x0'));var _=require(_0x9277('0x1'));var util=require(_0x9277('0x2'));var seqqueue=require(_0x9277('0x3'));var moment=require(_0x9277('0x4'));var Redis=require(_0x9277('0x5'));var config=require(_0x9277('0x6'));var logger=require(_0x9277('0x7'))(_0x9277('0x8'));var strategy=require('./strategy');config[_0x9277('0x9')]=_[_0x9277('0xa')](config[_0x9277('0x9')],{'host':_0x9277('0xb'),'port':0x18eb});var io=require(_0x9277('0xc'))(new Redis(config[_0x9277('0x9')]));var attributes=['id',_0x9277('0xd'),_0x9277('0xe'),'queue',_0x9277('0xf'),_0x9277('0x10')];function emit(_0x5d670a,_0x88fce1,_0x33b6c2){io['to'](_0x5d670a)['emit'](_0x88fce1,_0x33b6c2);}function emitChannelQueueInteraction(_0x5b62e8,_0x1799fd,_0x39d53a,_0x143bb4,_0x3c8660,_0xc1f721,_0x50d7af,_0x56195b){var _0x1d2af1=_[_0x9277('0x11')](_0x39d53a);_0x1d2af1[_0x9277('0xd')]=_0x56195b;_0x1d2af1[_0x9277('0x12')]=_0x1799fd;_0x1d2af1[_0x9277('0xe')]=_0x143bb4;_0x1d2af1['id']=_0x3c8660;if(_0xc1f721){_0x50d7af[util[_0x9277('0x13')](_0x9277('0x14'),_0x5b62e8)][_0x3c8660]=_['pick'](_0x1d2af1,attributes);}else{delete _0x50d7af[util[_0x9277('0x13')](_0x9277('0x14'),_0x5b62e8)][_0x3c8660];}emit(util[_0x9277('0x13')]('%s:queue:%s',_0x5b62e8,_0x1799fd),util[_0x9277('0x13')]('%s_queue_waiting_interaction:%s',_0x5b62e8,_0xc1f721?_0x9277('0x15'):_0x9277('0x16')),_['pick'](_0x1d2af1,attributes));}var rpc={'openchannelQueueReport':require(_0x9277('0x17')),'mailQueueReport':require(_0x9277('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x9277('0x19')),'faxQueueReport':require(_0x9277('0x1a')),'whatsappQueueReport':require(_0x9277('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x9277('0x1c')},'timeout':{'type':_0x9277('0x1d'),'message':_0x9277('0x1e')}});function startRouting(_0x4785b6,_0x440039,_0x443282,_0x5ad362){if(_0x4785b6&&_0x440039&&_0x443282){_0x440039['waiting']+=0x1;var _0x3e11c9={'uniqueid':_0x4785b6,'from':_0x443282[_0x9277('0x1f')]?_0x443282[_0x9277('0x1f')]['from']:'','joinAt':moment()['format'](_0x9277('0x20')),'ContactId':_0x443282['contact']?_0x443282[_0x9277('0x21')]['id']:null,'ListId':_0x443282[_0x9277('0x22')]?_0x443282[_0x9277('0x22')]['id']:null};_0x3e11c9[_[_0x9277('0x23')](_0x443282[_0x9277('0x24')])+_0x9277('0x25')]=_0x440039['id']||null;_0x3e11c9[_[_0x9277('0x23')](_0x443282[_0x9277('0x24')])+_0x9277('0x26')]=_0x443282[_0x9277('0x27')]?_0x443282[_0x9277('0x27')]['id']:null;_0x3e11c9[_[_0x9277('0x23')](_0x443282[_0x9277('0x24')])+_0x9277('0x28')]=_0x443282[_0x9277('0x29')]?_0x443282[_0x9277('0x29')]['id']:null;_0x3e11c9[_[_0x9277('0x23')](_0x443282[_0x9277('0x24')])+(_0x443282['channel']!==_0x9277('0x2a')?'AccountId':_0x9277('0x2b'))]=_0x443282[_0x9277('0xe')]?_0x443282[_0x9277('0xe')]['id']:null;logger[_0x9277('0x2c')](util['format'](_0x9277('0x2d'),_0x4785b6,_0x440039['name']));emitChannelQueueInteraction(_0x443282[_0x9277('0x24')],_0x440039[_0x9277('0x2e')],_0x3e11c9,_0x443282[_0x9277('0xe')][_0x9277('0x2e')],_0x443282[_0x9277('0x29')]['id'],!![],_0x5ad362,_0x440039['id']);if(rpc[_0x443282['channel']+_0x9277('0x2f')]){return rpc[_0x443282[_0x9277('0x24')]+_0x9277('0x2f')]['create'](_0x3e11c9)[_0x9277('0x30')](function(_0x3c3a4d){logger[_0x9277('0x31')](_0x9277('0x32'));});}}}function stopRouting(_0x4694a8,_0x23f7cc,_0x48c74a,_0x133174){if(_0x4694a8&&_0x23f7cc){_0x23f7cc['waiting']-=0x1;var _0x56b52a={'leaveAt':moment()[_0x9277('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x9277('0x13')](_0x9277('0x20')),'reason':'accepted'};logger[_0x9277('0x2c')](util[_0x9277('0x13')](_0x9277('0x33'),_0x4694a8,_0x23f7cc[_0x9277('0x2e')]));emitChannelQueueInteraction(_0x48c74a['channel'],_0x23f7cc[_0x9277('0x2e')],_0x48c74a[_0x9277('0x1f')],_0x48c74a[_0x9277('0xe')][_0x9277('0x2e')],_0x48c74a['message']['id'],![],_0x133174,_0x23f7cc['id']);if(rpc[_0x48c74a[_0x9277('0x24')]+_0x9277('0x2f')]){return rpc[_0x48c74a[_0x9277('0x24')]+'QueueReport'][_0x9277('0x34')](_0x4694a8,_0x56b52a)[_0x9277('0x30')](function(_0x18ed47){logger[_0x9277('0x31')](_0x9277('0x35'));});}}}function endRouting(_0x583ed2,_0x4246eb,_0xc16fc3,_0x1cfce2){if(_0x583ed2&&_0x4246eb){_0x4246eb['waiting']-=0x1;var _0xee625e={'leaveAt':moment()[_0x9277('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x9277('0x13')](_0x9277('0x20')),'reason':_0x9277('0x36')};logger[_0x9277('0x2c')](util[_0x9277('0x13')](_0x9277('0x37'),_0x583ed2,_0x4246eb[_0x9277('0x2e')]));emitChannelQueueInteraction(_0xc16fc3[_0x9277('0x24')],_0x4246eb['name'],_0xc16fc3['body'],_0xc16fc3[_0x9277('0xe')][_0x9277('0x2e')],_0xc16fc3[_0x9277('0x29')]['id'],![],_0x1cfce2);if(rpc[_0xc16fc3['channel']+_0x9277('0x2f')]){return rpc[_0xc16fc3['channel']+_0x9277('0x2f')][_0x9277('0x34')](_0x583ed2,_0xee625e)[_0x9277('0x30')](function(_0x25b9f9){logger[_0x9277('0x31')](_0x9277('0x35'));});}}}function handleFindQueue(_0x24a8ec){return function(_0x343d96){return _0x343d96[_0x9277('0x2e')]['toLowerCase']()===_0x24a8ec[_0x9277('0x38')]();};}exports[_0x9277('0x39')]=function(_0xdbbc,_0x26797c,_0x217006,_0x148a16){return function(_0x29d62b){try{var _0x3010dc={'name':_0x26797c[0x0],'timeout':_0x26797c[0x1]};var _0x4c5689=queue[_0x9277('0x0')](_0x3010dc,{'typecast':!![]});if(_0x4c5689['length']){logger[_0x9277('0x31')](_0x9277('0x3a'),_0xdbbc,_[_0x9277('0x3b')](_0x4c5689,_0x9277('0x29'))['join'](',\x20'));_0x29d62b[_0x9277('0x3c')]();}else{var _0x54794b=_[_0x9277('0x3d')](_0x217006[_0x148a16['channel']+_0x9277('0x3e')],handleFindQueue(_0x3010dc['name']));if(_0x54794b){startRouting(_0xdbbc,_0x54794b,_0x148a16,_0x217006);var _0x13790b=(_0x54794b[_0x9277('0x36')]||0xa)*0x3e8;var _0x6f7aba=(_0x3010dc[_0x9277('0x36')]||0x14)*0x3e8;var _0x51d1ce,_0x29d5f5;if(_0x13790b>_0x6f7aba){_0x6f7aba=_0x13790b;}var _0x2024ae=seqqueue['createQueue'](_0x13790b);_0x2024ae['id']=_0xdbbc;_0x2024ae[_0x9277('0x3f')]=_0x13790b;_0x2024ae['qtimeout']=_0x6f7aba;_0x2024ae[_0x9277('0x24')]=_0x148a16[_0x9277('0x24')];_0x217006[_0x9277('0x40')][_0xdbbc]['on'](_0x9277('0x41'),function(){logger[_0x9277('0x2c')](_0x9277('0x42'),_0xdbbc);stopRouting(_0xdbbc,_0x54794b,_0x148a16,_0x217006);clearTimeout(_0x51d1ce);_0x51d1ce=undefined;_0x2024ae[_0x9277('0x43')](!![]);if(_0x217006['rules'][_0xdbbc]){delete _0x217006[_0x9277('0x40')][_0xdbbc];}_0x29d62b[_0x9277('0x3c')]();});_0x217006[_0x9277('0x40')][_0xdbbc]['on'](_0x9277('0x44'),function(){if(_0x217006[_0x9277('0x40')][_0xdbbc]){delete _0x217006[_0x9277('0x40')][_0xdbbc];}});_0x51d1ce=setTimeout(function(){logger[_0x9277('0x2c')](_0x9277('0x45'),_0xdbbc);endRouting(_0xdbbc,_0x54794b,_0x148a16,_0x217006);clearTimeout(_0x51d1ce);_0x2024ae[_0x9277('0x43')](!![]);_0x29d62b[_0x9277('0x46')]();},_0x6f7aba);switch(_0x54794b[_0x9277('0x47')]){case _0x9277('0x48'):strategy[_0x9277('0x48')](_0x2024ae,_0x54794b,_0x217006,_0x148a16);break;default:strategy[_0x9277('0x49')](_0x2024ae,_0x54794b,_0x217006,_0x148a16);}}else{logger[_0x9277('0x31')](_0x9277('0x4a'),_0xdbbc,_0x3010dc[_0x9277('0x2e')]);_0x29d62b[_0x9277('0x3c')]();}}}catch(_0x17c4ba){console[_0x9277('0x4b')](_0x17c4ba);logger[_0x9277('0x31')](_0x9277('0x3a'),_0xdbbc,_0x17c4ba[_0x9277('0x4c')]);_0x29d62b[_0x9277('0x3c')]();}};}; \ 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 2015ae2..1b28113 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 _0xa63f=['isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','RINGING','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xa63f,0xa4));var _0xfa63=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0xa63f[_0x2eea9a];return _0x1ec61e;};'use strict';var _=require('lodash');var uuid=require(_0xfa63('0x0'));var util=require('./util');var logger=require(_0xfa63('0x1'))(_0xfa63('0x2'));var Agent=function(_0x230dbd,_0x4ffc8a,_0xd8139,_0x17815d){this[_0xfa63('0x3')]=uuid['v4']();this[_0xfa63('0x4')]=_0x230dbd;this[_0xfa63('0x5')]=_0x4ffc8a;this[_0xfa63('0x6')]=_0xd8139;this['routing']=_0x17815d;this[_0xfa63('0x4')][_0xfa63('0x7')](this[_0xfa63('0x8')][_0xfa63('0x9')](this),this[_0xfa63('0xa')][_0xfa63('0x9')](this));this['squeue']['on'](_0xfa63('0xb'),this['handleTimeout'][_0xfa63('0x9')](this));this[_0xfa63('0x4')]['on'](_0xfa63('0xc'),this['handleDrained'][_0xfa63('0x9')](this));};Agent[_0xfa63('0xd')][_0xfa63('0x7')]=function(){this[_0xfa63('0x4')]['push'](this[_0xfa63('0x8')][_0xfa63('0x9')](this),this['handleTimeout'][_0xfa63('0x9')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xfa63('0xd')][_0xfa63('0x8')]=function(){logger[_0xfa63('0xe')](_0xfa63('0xf'),this[_0xfa63('0x4')]['id'],this['agent']['id']);if(_[_0xfa63('0x10')](this[_0xfa63('0x6')][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']])){logger[_0xfa63('0xe')](_0xfa63('0x12'),this[_0xfa63('0x4')]['id'],this[_0xfa63('0x5')]['id']);setTimeout(this['push'][_0xfa63('0x9')](this),0x3e8);}else{if(this['routing'][_0xfa63('0x13')]||util[_0xfa63('0x14')](this[_0xfa63('0x4')]['id'],this['realtime'][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']],this[_0xfa63('0x4')]['channel'],![])){this[_0xfa63('0x6')][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']][_0xfa63('0x15')]=!![];this['realtime'][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']][_0xfa63('0x16')]=undefined;util[_0xfa63('0x17')](this['notificationId'],this[_0xfa63('0x4')]['id'],this['realtime'][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']],null,this[_0xfa63('0x2')]);util['writeLog'](this[_0xfa63('0x4')]['id'],this[_0xfa63('0x6')][_0xfa63('0x11')][this['agent']['id']],_0xfa63('0x18')+(this[_0xfa63('0x2')][_0xfa63('0x13')]?':FORCED':''));}else{logger[_0xfa63('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xfa63('0x4')]['id'],this[_0xfa63('0x5')]['id']);setTimeout(this[_0xfa63('0x7')][_0xfa63('0x9')](this),0x3e8);}}};Agent[_0xfa63('0xd')][_0xfa63('0xa')]=function(_0x2b9c7b){if(_[_0xfa63('0x10')](this[_0xfa63('0x6')][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']])){return logger[_0xfa63('0xe')](_0xfa63('0x12'),this[_0xfa63('0x4')]['id'],this[_0xfa63('0x5')]['id']);}else{logger[_0xfa63('0xe')](_0xfa63('0x19'),this[_0xfa63('0x4')]['id'],this[_0xfa63('0x5')]['id']);util[_0xfa63('0x1a')](this[_0xfa63('0x3')],this[_0xfa63('0x4')]['id'],this[_0xfa63('0x6')]['agents'][this[_0xfa63('0x5')]['id']],null,this[_0xfa63('0x2')]);this[_0xfa63('0x6')]['agents'][this[_0xfa63('0x5')]['id']][_0xfa63('0x15')]=![];this['realtime'][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0xfa63('0x4')]['id'],this[_0xfa63('0x6')][_0xfa63('0x11')][this[_0xfa63('0x5')]['id']],_0x2b9c7b?_0xfa63('0x1b'):_0xfa63('0x1c'));}if(!_0x2b9c7b){setTimeout(this[_0xfa63('0x7')][_0xfa63('0x9')](this),0x3e8);}};function agent(_0x50d579,_0x14ddf1,_0x52eed8,_0x2a1fe5){return new Agent(_0x50d579,_0x14ddf1,_0x52eed8,_0x2a1fe5);}module[_0xfa63('0x1d')]=agent; \ No newline at end of file +var _0xe754=['routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger'];(function(_0x231835,_0x573ef5){var _0x44cfb3=function(_0x400e38){while(--_0x400e38){_0x231835['push'](_0x231835['shift']());}};_0x44cfb3(++_0x573ef5);}(_0xe754,0x12e));var _0x4e75=function(_0x5a378a,_0x5448da){_0x5a378a=_0x5a378a-0x0;var _0x70a234=_0xe754[_0x5a378a];return _0x70a234;};'use strict';var _=require(_0x4e75('0x0'));var uuid=require(_0x4e75('0x1'));var util=require(_0x4e75('0x2'));var logger=require(_0x4e75('0x3'))(_0x4e75('0x4'));var Agent=function(_0x1fb13,_0x403e16,_0x387b16,_0x2addf0){this[_0x4e75('0x5')]=uuid['v4']();this[_0x4e75('0x6')]=_0x1fb13;this[_0x4e75('0x7')]=_0x403e16;this['realtime']=_0x387b16;this['routing']=_0x2addf0;this['squeue']['push'](this[_0x4e75('0x8')][_0x4e75('0x9')](this),this[_0x4e75('0xa')][_0x4e75('0x9')](this));this[_0x4e75('0x6')]['on'](_0x4e75('0xb'),this['handleTimeout'][_0x4e75('0x9')](this));this[_0x4e75('0x6')]['on'](_0x4e75('0xc'),this[_0x4e75('0xd')][_0x4e75('0x9')](this));};Agent[_0x4e75('0xe')]['push']=function(){this[_0x4e75('0x6')][_0x4e75('0xf')](this[_0x4e75('0x8')][_0x4e75('0x9')](this),this[_0x4e75('0xa')]['bind'](this));};Agent[_0x4e75('0xe')][_0x4e75('0xd')]=function(){this[_0x4e75('0xa')](!![]);};Agent[_0x4e75('0xe')][_0x4e75('0x8')]=function(){logger[_0x4e75('0x10')](_0x4e75('0x11'),this[_0x4e75('0x6')]['id'],this[_0x4e75('0x7')]['id']);if(_['isNil'](this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']])){logger[_0x4e75('0x10')](_0x4e75('0x14'),this[_0x4e75('0x6')]['id'],this[_0x4e75('0x7')]['id']);setTimeout(this[_0x4e75('0xf')][_0x4e75('0x9')](this),0x3e8);}else{if(this['routing'][_0x4e75('0x15')]||util[_0x4e75('0x16')](this[_0x4e75('0x6')]['id'],this['realtime']['agents'][this[_0x4e75('0x7')]['id']],this[_0x4e75('0x6')][_0x4e75('0x17')],![])){this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']]['busy']=!![];this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']][_0x4e75('0x18')]=undefined;util[_0x4e75('0x19')](this[_0x4e75('0x5')],this['squeue']['id'],this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']],null,this[_0x4e75('0x4')]);util[_0x4e75('0x1a')](this[_0x4e75('0x6')]['id'],this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']],'RINGING'+(this[_0x4e75('0x4')][_0x4e75('0x15')]?_0x4e75('0x1b'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x4e75('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0x4e75('0xa')]=function(_0x13f7f6){if(_[_0x4e75('0x1c')](this[_0x4e75('0x12')]['agents'][this['agent']['id']])){return logger['debug'](_0x4e75('0x14'),this[_0x4e75('0x6')]['id'],this[_0x4e75('0x7')]['id']);}else{logger[_0x4e75('0x10')](_0x4e75('0x1d'),this[_0x4e75('0x6')]['id'],this[_0x4e75('0x7')]['id']);util[_0x4e75('0x1e')](this[_0x4e75('0x5')],this['squeue']['id'],this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']],null,this[_0x4e75('0x4')]);this[_0x4e75('0x12')][_0x4e75('0x13')][this[_0x4e75('0x7')]['id']]['busy']=![];this[_0x4e75('0x12')][_0x4e75('0x13')][this['agent']['id']][_0x4e75('0x18')]=undefined;util[_0x4e75('0x1a')](this['squeue']['id'],this['realtime']['agents'][this[_0x4e75('0x7')]['id']],_0x13f7f6?_0x4e75('0x1f'):_0x4e75('0x20'));}if(!_0x13f7f6){setTimeout(this['push'][_0x4e75('0x9')](this),0x3e8);}};function agent(_0x20a546,_0x449f9a,_0x45b3ac,_0x19b926){return new Agent(_0x20a546,_0x449f9a,_0x45b3ac,_0x19b926);}module[_0x4e75('0x21')]=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 1313e1e..1d2d0ae 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 _0x0434=['notificationId','squeue','queue','realtime','push','handleTimeout','bind','timeout','drained','prototype','handleDrained','handleRun','isNil','Agents','length','agents','debug','channel','writeLog','busyQueue','name','showNotification','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x2089fc,_0x2fe652){var _0x50cd31=function(_0x546a2f){while(--_0x546a2f){_0x2089fc['push'](_0x2089fc['shift']());}};_0x50cd31(++_0x2fe652);}(_0x0434,0x1ad));var _0x4043=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x0434[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require(_0x4043('0x0'));var uuid=require(_0x4043('0x1'));var util=require(_0x4043('0x2'));var logger=require(_0x4043('0x3'))(_0x4043('0x4'));var Beepall=function(_0x56e8f3,_0x4ca779,_0x2e6bdf,_0xfa9ae8){this[_0x4043('0x5')]=uuid['v4']();this[_0x4043('0x6')]=_0x56e8f3;this[_0x4043('0x7')]=_0x4ca779;this[_0x4043('0x8')]=_0x2e6bdf;this['routing']=_0xfa9ae8;this[_0x4043('0x6')][_0x4043('0x9')](this['handleRun']['bind'](this),this[_0x4043('0xa')][_0x4043('0xb')](this));this[_0x4043('0x6')]['on'](_0x4043('0xc'),this[_0x4043('0xa')][_0x4043('0xb')](this));this[_0x4043('0x6')]['on'](_0x4043('0xd'),this['handleDrained'][_0x4043('0xb')](this));};Beepall[_0x4043('0xe')][_0x4043('0x9')]=function(){this[_0x4043('0x6')][_0x4043('0x9')](this['handleRun'][_0x4043('0xb')](this),this[_0x4043('0xa')][_0x4043('0xb')](this));};Beepall[_0x4043('0xe')][_0x4043('0xf')]=function(){this['handleTimeout'](!![]);};Beepall[_0x4043('0xe')][_0x4043('0x10')]=function(){var _0x3d91ee=!![];if(!_[_0x4043('0x11')](this[_0x4043('0x7')])&&!_[_0x4043('0x11')](this[_0x4043('0x7')][_0x4043('0x12')])&&this[_0x4043('0x7')][_0x4043('0x12')][_0x4043('0x13')]>0x0){for(var _0x38aefa=0x0,_0x560602;_0x38aefa0x0){for(var _0x32e9ae=0x0,_0x27d498;_0x32e9ae0x0&&_0xb68f92[_0x11cc67+_0x5dbf('0x24')]>=_0xb68f92[_0x11cc67+_0x5dbf('0x23')]){writeLog(_0x58e9ac,_0xb68f92,_0x11cc67[_0x5dbf('0x25')]()+_0x5dbf('0x26'));return![];}}return!![];};exports[_0x5dbf('0x27')]=function(_0x3f9e60,_0x407741,_0x729d8f,_0x17f135,_0x466985){return sendNotification(!![],_0x3f9e60,_0x407741,_0x729d8f,_0x17f135,_0x466985);};exports[_0x5dbf('0x28')]=function(_0x159e61,_0x22ec42,_0x6a9757,_0x471027,_0x21cd00){return sendNotification(![],_0x159e61,_0x22ec42,_0x6a9757,_0x471027,_0x21cd00);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x2675=['debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','writeLog','lodash','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','user:%s','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','name','notification:%s','save'];(function(_0xce9f9a,_0x420c1e){var _0x1e4a3b=function(_0x171f9b){while(--_0x171f9b){_0xce9f9a['push'](_0xce9f9a['shift']());}};_0x1e4a3b(++_0x420c1e);}(_0x2675,0x75));var _0x5267=function(_0x5888a8,_0x13ed4f){_0x5888a8=_0x5888a8-0x0;var _0x276411=_0x2675[_0x5888a8];return _0x276411;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var utils=require('../utils');var Redis=require('ioredis');var config=require(_0x5267('0x1'));var logger=require(_0x5267('0x2'))('routing');config[_0x5267('0x3')]=_[_0x5267('0x4')](config['redis'],{'host':_0x5267('0x5'),'port':0x18eb});var io=require(_0x5267('0x6'))(new Redis(config[_0x5267('0x3')]));function sendNotification(_0x10f92c,_0x20f065,_0xc56cd5,_0x527c16,_0x9e0a27,_0x46bfdf){io['to'](util['format'](_0x5267('0x7'),_0x527c16['name']))[_0x5267('0x8')](_0x5267('0x9'),_0x527c16);var _0x26e22b=_0x46bfdf||{};var _0x534c2b=_0xc56cd5[_0x5267('0xa')]('.');var _0x5060b3={'uniqueid':_0x20f065,'channel':_0x534c2b[0x0],'id':_0x534c2b[0x1],'title':_0x534c2b[0x0]+_0x5267('0xb'),'interactionId':_0x534c2b[0x2],'queue':_0x9e0a27?_0x9e0a27['name']:null,'sound':_0x26e22b[_0x5267('0xc')][_0x5267('0xd')],'shake':_0x26e22b[_0x5267('0xc')][_0x5267('0xe')]};try{if(!_0x26e22b[_0x5267('0xf')]){_0x26e22b[_0x5267('0xf')]={};}if(_0x9e0a27){_0x26e22b[_0x5267('0xf')][_0x5267('0x10')]=_0x9e0a27;}else if(_0x26e22b[_0x5267('0xf')][_0x5267('0x10')]){delete _0x26e22b[_0x5267('0xf')][_0x5267('0x10')];}_0x5060b3[_0x5267('0x11')]=utils['getMustacheRender'](_0x26e22b['account'][_0x5267('0x12')],_0x26e22b);}catch(_0x40d897){_0x5060b3[_0x5267('0x11')]=_0x5267('0x13');logger[_0x5267('0x14')](util[_0x5267('0x15')](_0x5267('0x16'),_0x20f065,_0x40d897[_0x5267('0x17')]));}io['to'](util[_0x5267('0x15')](_0x5267('0x7'),_0x527c16[_0x5267('0x18')]))[_0x5267('0x8')](util['format'](_0x5267('0x19'),_0x10f92c?_0x5267('0x1a'):'remove'),_0x5060b3);}function writeLog(_0x20cb50,_0x56733e,_0x1cf835){return logger[_0x5267('0x1b')](util[_0x5267('0x15')](_0x5267('0x1c'),_0x20cb50,_0x56733e[_0x5267('0x18')],_0x1cf835));}exports['isAgentAvailable']=function(_0x100fcd,_0x5aebdd,_0xa32663,_0x420fb8){if(_0x5aebdd[_0x5267('0x1d')]){writeLog(_0x100fcd,_0x5aebdd,'BUSY');return![];}if(!_0x5aebdd['online']){writeLog(_0x100fcd,_0x5aebdd,'OFFLINE');return![];}if(_0x5aebdd[_0xa32663+'Pause']){writeLog(_0x100fcd,_0x5aebdd,'PAUSE');return![];}if(_0x420fb8&&_0x5aebdd[_0x5267('0x1e')](_0xa32663+_0x5267('0x1f'))&&_0x5aebdd[_0x5267('0x1e')](_0xa32663+_0x5267('0x20'))){if(_0x5aebdd[_0xa32663+_0x5267('0x1f')]>0x0&&_0x5aebdd[_0xa32663+_0x5267('0x20')]>=_0x5aebdd[_0xa32663+_0x5267('0x1f')]){writeLog(_0x100fcd,_0x5aebdd,_0xa32663[_0x5267('0x21')]()+_0x5267('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x5cb64f,_0x354111,_0x472938,_0x5abf95,_0x45373e){return sendNotification(!![],_0x5cb64f,_0x354111,_0x472938,_0x5abf95,_0x45373e);};exports['hideNotification']=function(_0x4d7c2a,_0x43e7e7,_0x273769,_0x1f33b7,_0x2d2ace){return sendNotification(![],_0x4d7c2a,_0x43e7e7,_0x273769,_0x1f33b7,_0x2d2ace);};exports[_0x5267('0x23')]=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 1084b47..b7aabc6 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 _0xc46b=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','join','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x42990d,_0x264124){var _0x56fcb8=function(_0x1995d9){while(--_0x1995d9){_0x42990d['push'](_0x42990d['shift']());}};_0x56fcb8(++_0x264124);}(_0xc46b,0x14c));var _0xbc46=function(_0x5573ec,_0x547d1d){_0x5573ec=_0x5573ec-0x0;var _0x32cf22=_0xc46b[_0x5573ec];return _0x32cf22;};'use strict';var schema=require(_0xbc46('0x0'));var sh=require('shelljs');var _=require(_0xbc46('0x1'));var utils=require(_0xbc46('0x2'));var logger=require('../../../../config/logger')(_0xbc46('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xbc46('0x4')}});exports[_0xbc46('0x5')]=function(_0x4cbf8c,_0x5c97a8){return function(_0x2ba403){try{var _0x496fb6={'command':_0x5c97a8[0x0]};var _0x2f9699=system[_0xbc46('0x0')](_0x496fb6,{'typecast':!![]});if(_0x2f9699[_0xbc46('0x6')]){logger['error'](_0xbc46('0x7'),_0x4cbf8c,_[_0xbc46('0x8')](_0x2f9699,'message')[_0xbc46('0x9')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4cbf8c);_0x2ba403['next']();}else{var _0x3be30d=this;var _0x3fc7c7=utils[_0xbc46('0xa')](_0x5c97a8[0x0],this);logger[_0xbc46('0xb')](_0xbc46('0xc'),_0x4cbf8c,_0x3fc7c7);sh['exec'](_[_0xbc46('0xd')](_0x3fc7c7),function(_0x3fbac1,_0x177725){logger[_0xbc46('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4cbf8c,_0x3fbac1);if(_0x3fbac1==0x0){var _0x284305=_0x177725[_0xbc46('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xbc46('0xf')](_0x5c97a8[0x1])||_[_0xbc46('0x10')](_0x5c97a8[0x1])){logger['info'](_0xbc46('0x11'),_0x4cbf8c);_0x3be30d[_0xbc46('0x12')][_0x5c97a8[0x1]]=_0x284305;}else{logger[_0xbc46('0xb')](_0xbc46('0x13'),_0x4cbf8c,_0x5c97a8[0x1],_0x284305);_0x3be30d['body'][_0x5c97a8[0x1]]=_0x284305;}}_0x2ba403[_0xbc46('0x14')]();});}}catch(_0x2748fd){logger[_0xbc46('0x15')]('[%s][SYSTEM]\x20%s',_0x4cbf8c,_[_0xbc46('0x16')](_0x2748fd)?JSON[_0xbc46('0x17')](_0x2748fd):_0x2748fd);logger[_0xbc46('0xb')](_0xbc46('0x18'),_0x4cbf8c);_0x2ba403[_0xbc46('0x14')]();}};}; \ No newline at end of file +var _0xa3d4=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','next','getMustacheRender','info'];(function(_0x479343,_0x7bf4a1){var _0xf1cfad=function(_0x5df7e9){while(--_0x5df7e9){_0x479343['push'](_0x479343['shift']());}};_0xf1cfad(++_0x7bf4a1);}(_0xa3d4,0x12d));var _0x4a3d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xa3d4[_0x3b0731];return _0x4204d7;};'use strict';var schema=require(_0x4a3d('0x0'));var sh=require(_0x4a3d('0x1'));var _=require(_0x4a3d('0x2'));var utils=require(_0x4a3d('0x3'));var logger=require(_0x4a3d('0x4'))(_0x4a3d('0x5'));var system=schema({'command':{'type':_0x4a3d('0x6'),'required':!![],'message':_0x4a3d('0x7')}});exports[_0x4a3d('0x8')]=function(_0x355747,_0x3a7462){return function(_0x38c81b){try{var _0x4f57be={'command':_0x3a7462[0x0]};var _0x43012c=system['validate'](_0x4f57be,{'typecast':!![]});if(_0x43012c[_0x4a3d('0x9')]){logger[_0x4a3d('0xa')](_0x4a3d('0xb'),_0x355747,_[_0x4a3d('0xc')](_0x43012c,_0x4a3d('0xd'))[_0x4a3d('0xe')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x355747);_0x38c81b[_0x4a3d('0xf')]();}else{var _0xe90452=this;var _0x518348=utils[_0x4a3d('0x10')](_0x3a7462[0x0],this);logger[_0x4a3d('0x11')](_0x4a3d('0x12'),_0x355747,_0x518348);sh[_0x4a3d('0x13')](_[_0x4a3d('0x14')](_0x518348),function(_0x6d392,_0x175e2e){logger[_0x4a3d('0x11')](_0x4a3d('0x15'),_0x355747,_0x6d392);if(_0x6d392==0x0){var _0x14b9f0=_0x175e2e['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x4a3d('0x16')](_0x3a7462[0x1])||_[_0x4a3d('0x17')](_0x3a7462[0x1])){logger[_0x4a3d('0x11')](_0x4a3d('0x18'),_0x355747);_0xe90452[_0x4a3d('0x19')][_0x3a7462[0x1]]=_0x14b9f0;}else{logger[_0x4a3d('0x11')](_0x4a3d('0x1a'),_0x355747,_0x3a7462[0x1],_0x14b9f0);_0xe90452['body'][_0x3a7462[0x1]]=_0x14b9f0;}}_0x38c81b[_0x4a3d('0xf')]();});}}catch(_0x26aea9){logger[_0x4a3d('0xa')](_0x4a3d('0xb'),_0x355747,_[_0x4a3d('0x1b')](_0x26aea9)?JSON['stringify'](_0x26aea9):_0x26aea9);logger['info'](_0x4a3d('0x1c'),_0x355747);_0x38c81b[_0x4a3d('0xf')]();}};}; \ 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 df5c460..599a6fc 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 _0xa529=['map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s'];(function(_0x17d0ea,_0x227e5e){var _0x36f095=function(_0x3037d1){while(--_0x3037d1){_0x17d0ea['push'](_0x17d0ea['shift']());}};_0x36f095(++_0x227e5e);}(_0xa529,0xcb));var _0x9a52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa529[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x9a52('0x0'));var _=require(_0x9a52('0x1'));var rpc={'chatInteraction':require(_0x9a52('0x2')),'openchannelInteraction':require(_0x9a52('0x3')),'smsInteraction':require(_0x9a52('0x4')),'mailInteraction':require(_0x9a52('0x5')),'faxInteraction':require(_0x9a52('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x9a52('0x7'))(_0x9a52('0x8'));var tag=schema({'tag':{'type':_0x9a52('0x9'),'required':!![],'message':_0x9a52('0xa')}});exports['consequence']=function(_0x142020,_0x2b4d84,_0x39ed6b,_0x56d012){return function(_0x136725){try{var _0x26dc77={'tag':_0x2b4d84[0x0]};var _0x5c48ad=tag[_0x9a52('0x0')](_0x26dc77,{'typecast':!![]});if(_0x5c48ad['length']){logger[_0x9a52('0xb')](_0x9a52('0xc'),_0x142020,_[_0x9a52('0xd')](_0x5c48ad,'message')['join'](',\x20'));logger[_0x9a52('0xe')](_0x9a52('0xf'),_0x142020);_0x136725[_0x9a52('0x10')]();}else{var _0x4fac6e={'ids':[_0x2b4d84[0x0]]};if(rpc[_0x56d012[_0x9a52('0x11')]+_0x9a52('0x12')]){rpc[_0x56d012[_0x9a52('0x11')]+_0x9a52('0x12')][_0x9a52('0x13')](_0x56d012[_0x9a52('0x14')]['id'],_0x4fac6e)[_0x9a52('0x15')](function(_0x433f43){logger[_0x9a52('0xe')](_0x9a52('0x16'),_0x142020,_0x2b4d84[0x1],_0x56d012[_0x9a52('0x11')],_0x56d012[_0x9a52('0x14')]['id']);})[_0x9a52('0x17')](function(_0x2fbe59){logger['error'](_0x9a52('0xc'),_0x142020,JSON[_0x9a52('0x18')](_0x2fbe59));logger[_0x9a52('0xe')](_0x9a52('0xf'),_0x142020);})[_0x9a52('0x19')](function(){_0x136725[_0x9a52('0x10')]();});}}}catch(_0x2efd33){logger['error'](_0x9a52('0xc'),_0x142020,_[_0x9a52('0x1a')](_0x2efd33)?JSON['stringify'](_0x2efd33):_0x2efd33);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x142020);_0x136725[_0x9a52('0x10')]();}};}; \ No newline at end of file +var _0x499b=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message','join','info'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x499b,0x15e));var _0xb499=function(_0x85cae,_0x3c498f){_0x85cae=_0x85cae-0x0;var _0x55b553=_0x499b[_0x85cae];return _0x55b553;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xb499('0x0')),'openchannelInteraction':require(_0xb499('0x1')),'smsInteraction':require(_0xb499('0x2')),'mailInteraction':require(_0xb499('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xb499('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb499('0x5')}});exports[_0xb499('0x6')]=function(_0x27cc10,_0x554e0a,_0x4ed350,_0x454aa2){return function(_0x36df06){try{var _0x1bf6e0={'tag':_0x554e0a[0x0]};var _0x5f13cb=tag[_0xb499('0x7')](_0x1bf6e0,{'typecast':!![]});if(_0x5f13cb['length']){logger[_0xb499('0x8')](_0xb499('0x9'),_0x27cc10,_[_0xb499('0xa')](_0x5f13cb,_0xb499('0xb'))[_0xb499('0xc')](',\x20'));logger[_0xb499('0xd')](_0xb499('0xe'),_0x27cc10);_0x36df06[_0xb499('0xf')]();}else{var _0x448cb6={'ids':[_0x554e0a[0x0]]};if(rpc[_0x454aa2[_0xb499('0x10')]+'Interaction']){rpc[_0x454aa2[_0xb499('0x10')]+_0xb499('0x11')][_0xb499('0x12')](_0x454aa2[_0xb499('0x13')]['id'],_0x448cb6)[_0xb499('0x14')](function(_0x2d69ca){logger[_0xb499('0xd')](_0xb499('0x15'),_0x27cc10,_0x554e0a[0x1],_0x454aa2[_0xb499('0x10')],_0x454aa2[_0xb499('0x13')]['id']);})[_0xb499('0x16')](function(_0x21eb1b){logger[_0xb499('0x8')](_0xb499('0x9'),_0x27cc10,JSON[_0xb499('0x17')](_0x21eb1b));logger['info'](_0xb499('0xe'),_0x27cc10);})[_0xb499('0x18')](function(){_0x36df06['next']();});}}}catch(_0x237aae){logger['error'](_0xb499('0x9'),_0x27cc10,_[_0xb499('0x19')](_0x237aae)?JSON[_0xb499('0x17')](_0x237aae):_0x237aae);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x27cc10);_0x36df06[_0xb499('0xf')]();}};}; \ 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 af53f5e..a5bc21c 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 _0x67c8=['urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','push','params','stringify','utf8','application/json-rpc','result','logged','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','lodash','consequence','replace','\x20-\x20','includes'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x67c8,0xbb));var _0x867c=function(_0x1a08fa,_0x488d9f){_0x1a08fa=_0x1a08fa-0x0;var _0x279df5=_0x67c8[_0x1a08fa];return _0x279df5;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require(_0x867c('0x0'));var arr=[];exports[_0x867c('0x1')]=function(_0x26e837,_0x2d306c){return function(_0x5ef2ce){var _0x543a44=_0x2d306c[0xa];var _0x1e3437=_0x2d306c[0xb];var _0x47e094=_0x2d306c[0xc];var _0x196f77=_0x2d306c[0xd];var _0x19615d=_0x2d306c[0xe];var _0x308cd5=_0x2d306c[0xf][_0x867c('0x2')](/\n/g,_0x867c('0x3'));var _0x476b05=_0x2d306c[0x10][_0x867c('0x2')](/\n/g,'\x20');if(!arr[_0x867c('0x4')](_0x1e3437)){arr['push'](_0x1e3437);var _0x1a3c08=_0x2d306c[0x3];var _0x467660=_0x2d306c[0x4];var _0x2911e6=_0x2d306c[0x1];var _0x347e0c=_0x2d306c[0x0];var _0x3d3ee2={};_0x3d3ee2[_0x867c('0x5')]=_0x2d306c[0x8]+_0x867c('0x6')+_0x47e094+'|'+_0x543a44+'|'+_0x196f77+'|'+_0x1e3437+'|'+_0x19615d;_0x3d3ee2[_0x867c('0x7')]=_0x2d306c[0x7]+_0x867c('0x6')+_0x47e094+'|'+_0x543a44+'|'+_0x196f77+'|'+_0x1e3437+'|'+_0x19615d+'|'+_0x308cd5+'|'+_0x476b05;_0x3d3ee2[_0x867c('0x8')]=_0x2d306c[0x9];var _0x102b7c={};_0x102b7c[_0x867c('0x9')]='2.0';_0x102b7c[_0x867c('0xa')]=_0x867c('0xb');var _0x21acb7=[];_0x21acb7['push'](_0x2d306c[0x2]);_0x21acb7[_0x867c('0xc')](_0x2d306c[0x5]);_0x21acb7[_0x867c('0xc')](_0x2d306c[0x6]);_0x102b7c[_0x867c('0xd')]=_0x21acb7;_0x102b7c['id']=0x1;var _0xa3c18c=JSON[_0x867c('0xe')](_0x102b7c);var _0x5247d4={'encoding':_0x867c('0xf'),'method':'POST','timeout':0x2710,'url':_0x1a3c08,'headers':{'Content-Type':_0x867c('0x10')},'body':_0xa3c18c};return rp(_0x5247d4)['then'](function(_0x1840d1){const _0x470ae2=JSON['parse'](_0x1840d1);if(!_0x470ae2[_0x867c('0x11')][_0x867c('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x33fe51=_0x1e3437;var _0x249576=_0x867c('0x13')+_0x2911e6+_0x867c('0x14')+_0x347e0c+_0x867c('0x15')+_0x33fe51+_0x867c('0x16')+JSON[_0x867c('0xe')](_0x3d3ee2);var _0x235148=_0x467660+'?'+_0x249576;return rp(_0x235148);})[_0x867c('0x17')](function(_0x45c627){logger[_0x867c('0x18')](_0x867c('0x19'),_0x26e837,_0x45c627);_0x5ef2ce[_0x867c('0x1a')]();})[_0x867c('0x1b')](function(_0x4e765a){logger[_0x867c('0x1c')]('[%s][TVOX]\x20%s',_0x26e837,_[_0x867c('0x1d')](_0x4e765a)?JSON[_0x867c('0xe')](_0x4e765a):_0x4e765a);_0x5ef2ce[_0x867c('0x1a')]();});}else{logger[_0x867c('0x18')](_0x867c('0x1e'),_0x26e837);_0x5ef2ce[_0x867c('0x1f')]();}};}; \ No newline at end of file +var _0xb9bb=['stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','params','POST','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xb9bb,0x8e));var _0xbb9b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb9bb[_0x42cae2];return _0x5f256f;};'use strict';var rp=require(_0xbb9b('0x0'));var logger=require(_0xbb9b('0x1'))(_0xbb9b('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x558260,_0x30c1b7){return function(_0x158520){var _0x34f443=_0x30c1b7[0xa];var _0x5036b3=_0x30c1b7[0xb];var _0x383eb6=_0x30c1b7[0xc];var _0x2f3cf9=_0x30c1b7[0xd];var _0x2b46f2=_0x30c1b7[0xe];var _0x53bd62=_0x30c1b7[0xf][_0xbb9b('0x3')](/\n/g,_0xbb9b('0x4'));var _0x1a3b21=_0x30c1b7[0x10][_0xbb9b('0x3')](/\n/g,'\x20');if(!arr[_0xbb9b('0x5')](_0x5036b3)){arr['push'](_0x5036b3);var _0x434303=_0x30c1b7[0x3];var _0x591f60=_0x30c1b7[0x4];var _0x416cc9=_0x30c1b7[0x1];var _0x167f38=_0x30c1b7[0x0];var _0xce6b2e={};_0xce6b2e[_0xbb9b('0x6')]=_0x30c1b7[0x8]+_0xbb9b('0x7')+_0x383eb6+'|'+_0x34f443+'|'+_0x2f3cf9+'|'+_0x5036b3+'|'+_0x2b46f2;_0xce6b2e[_0xbb9b('0x8')]=_0x30c1b7[0x7]+_0xbb9b('0x7')+_0x383eb6+'|'+_0x34f443+'|'+_0x2f3cf9+'|'+_0x5036b3+'|'+_0x2b46f2+'|'+_0x53bd62+'|'+_0x1a3b21;_0xce6b2e[_0xbb9b('0x9')]=_0x30c1b7[0x9];var _0x38ffb9={};_0x38ffb9[_0xbb9b('0xa')]=_0xbb9b('0xb');_0x38ffb9[_0xbb9b('0xc')]=_0xbb9b('0xd');var _0x4aec4f=[];_0x4aec4f[_0xbb9b('0xe')](_0x30c1b7[0x2]);_0x4aec4f['push'](_0x30c1b7[0x5]);_0x4aec4f[_0xbb9b('0xe')](_0x30c1b7[0x6]);_0x38ffb9[_0xbb9b('0xf')]=_0x4aec4f;_0x38ffb9['id']=0x1;var _0x13d429=JSON['stringify'](_0x38ffb9);var _0x6ca842={'encoding':'utf8','method':_0xbb9b('0x10'),'timeout':0x2710,'url':_0x434303,'headers':{'Content-Type':'application/json-rpc'},'body':_0x13d429};return rp(_0x6ca842)[_0xbb9b('0x11')](function(_0x469d01){const _0x5d83ee=JSON[_0xbb9b('0x12')](_0x469d01);if(!_0x5d83ee[_0xbb9b('0x13')][_0xbb9b('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x1a4a4e=_0x5036b3;var _0x1f8626=_0xbb9b('0x15')+_0x416cc9+_0xbb9b('0x16')+_0x167f38+_0xbb9b('0x17')+_0x1a4a4e+_0xbb9b('0x18')+JSON[_0xbb9b('0x19')](_0xce6b2e);var _0x284071=_0x591f60+'?'+_0x1f8626;return rp(_0x284071);})['then'](function(_0x13125e){logger[_0xbb9b('0x1a')](_0xbb9b('0x1b'),_0x558260,_0x13125e);_0x158520[_0xbb9b('0x1c')]();})[_0xbb9b('0x1d')](function(_0x3e3440){logger['error'](_0xbb9b('0x1e'),_0x558260,_[_0xbb9b('0x1f')](_0x3e3440)?JSON[_0xbb9b('0x19')](_0x3e3440):_0x3e3440);_0x158520['stop']();});}else{logger[_0xbb9b('0x1a')](_0xbb9b('0x20'),_0x558260);_0x158520[_0xbb9b('0x21')]();}};}; \ 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 cdd64ee..e88f52d 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3f1904,_0x3087d0){var _0x8565c2=function(_0x25c11f){while(--_0x25c11f){_0x3f1904['push'](_0x3f1904['shift']());}};_0x8565c2(++_0x3087d0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x56e329,_0x48819a){var _0x56d081=function(_0x2a213c){while(--_0x2a213c){_0x56e329['push'](_0x56e329['shift']());}};_0x56d081(++_0x48819a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 c71d1a7..ee4506c 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 _0x39c4=['format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','length','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflowv2','appdata','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','condition','intervals','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','name','paused','mailQueues','available','waiting','openchannelQueues','loggedIn','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine'];(function(_0x101010,_0x12a49c){var _0x3fc5a7=function(_0x3f8b34){while(--_0x3f8b34){_0x101010['push'](_0x101010['shift']());}};_0x3fc5a7(++_0x12a49c);}(_0x39c4,0x174));var _0x439c=function(_0x3b6334,_0x17e4e4){_0x3b6334=_0x3b6334-0x0;var _0x28d37f=_0x39c4[_0x3b6334];return _0x28d37f;};'use strict';var _=require('lodash');var util=require(_0x439c('0x0'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x439c('0x1'));var uuid=require(_0x439c('0x2'));var utils=require('./applications/utils');var config=require('../../../config/environment');var logger=require(_0x439c('0x3'))(_0x439c('0x4'));var rpc={'openchannelQueueReport':require(_0x439c('0x5')),'mailQueueReport':require(_0x439c('0x6')),'chatQueueReport':require(_0x439c('0x7')),'smsQueueReport':require(_0x439c('0x8')),'faxQueueReport':require(_0x439c('0x9')),'whatsappQueueReport':require(_0x439c('0xa'))};var RuleEngine=require(_0x439c('0xb'));function getId(_0x13af21,_0x425264,_0x46a4f7){return util[_0x439c('0xc')](_0x439c('0xd'),_0x13af21,_0x425264||0x0,_0x46a4f7||0x0);}function getIntervals(_0x237e38,_0x4c0ff4){var _0x1a0c8d=[];if(!_[_0x439c('0xe')](_0x4c0ff4[_0x439c('0xf')])&&!_[_0x439c('0xe')](_0x237e38[_0x4c0ff4[_0x439c('0xf')]])&&!_[_0x439c('0xe')](_0x237e38[_0x4c0ff4[_0x439c('0xf')]][_0x439c('0x10')])){_0x1a0c8d=_[_0x439c('0x11')](_0x237e38[_0x4c0ff4[_0x439c('0xf')]][_0x439c('0x10')],_0x439c('0x12'));}else if(!_['isNil'](_0x4c0ff4[_0x439c('0x12')])){_0x1a0c8d=[_0x4c0ff4['interval']];}return _0x1a0c8d;}exports['listen']=function(_0x1e367a){_0x1e367a[_0x439c('0x13')]={};return new BPromise(function(_0x486451,_0x425c3f){var _0x1b72db={'Start':function(_0x5b8898){var _0x4f5b71=this;return new Promise(function(_0x38d60d,_0x5478b4){if(_0x5b8898){try{var _0x64d6d1=[];var _0xa448bd=getId(_0x5b8898[_0x439c('0x14')],_0x5b8898['message']?_0x5b8898[_0x439c('0x15')]['id']:0x0,_0x5b8898[_0x439c('0x16')]?_0x5b8898[_0x439c('0x16')]['id']:0x0);if(_0x5b8898[_0x439c('0x17')]&&_['isArray'](_0x5b8898[_0x439c('0x17')])&&_0x5b8898[_0x439c('0x17')][_0x439c('0x18')]){for(var _0x52fe98=0x0;_0x52fe98<_0x5b8898[_0x439c('0x17')]['length'];_0x52fe98+=0x1){var _0x5278e2=_0x5b8898[_0x439c('0x17')][_0x52fe98];if(fs['existsSync'](path[_0x439c('0x19')](__dirname,_0x439c('0x17'),_0x5278e2[_0x439c('0x1a')]+_0x439c('0x1b')))){var _0x35727a=[];switch(_0x5278e2[_0x439c('0x1a')][_0x439c('0x1c')]()){case _0x439c('0x1d'):var _0x20cbaa=_0x5278e2['appdata'][_0x439c('0x1e')](',');if(_0x5b8898[_0x439c('0x14')]==='mail'){_0x35727a[_0x439c('0x1f')](_0x20cbaa[0x0]);_0x35727a['push'](_0x20cbaa[0x1]);_0x35727a['push'](_0x20cbaa[_0x439c('0x20')](0x2,_0x20cbaa['length'])[_0x439c('0x19')](','));}else{_0x35727a[_0x439c('0x1f')](_0x20cbaa[0x0]);_0x35727a[_0x439c('0x1f')](_0x20cbaa[_0x439c('0x20')](0x1,_0x20cbaa[_0x439c('0x18')])['join'](','));}break;case'dialogflow':var _0x1ea9f9=_0x5278e2['appdata'][_0x439c('0x1e')](',');_0x35727a['push'](_0x1ea9f9[0x0]);_0x35727a[_0x439c('0x1f')](_0x1ea9f9[0x1]);_0x35727a[_0x439c('0x1f')](_0x1ea9f9[_0x439c('0x20')](0x2,_0x1ea9f9[_0x439c('0x18')])['join'](','));break;case _0x439c('0x21'):var _0x1fa033=_0x5278e2[_0x439c('0x22')][_0x439c('0x1e')](',');_0x35727a[_0x439c('0x1f')](_0x1fa033[0x0]);_0x35727a[_0x439c('0x1f')](_0x1fa033[0x1]);_0x35727a[_0x439c('0x1f')](_0x1fa033[0x2]);_0x35727a[_0x439c('0x1f')](_0x1fa033[0x3]);_0x35727a[_0x439c('0x1f')](_0x1fa033[_0x439c('0x20')](0x4,_0x1fa033[_0x439c('0x18')])[_0x439c('0x19')](','));break;case _0x439c('0x23'):var _0x338345=_0x5278e2['appdata']['split'](',');_0x35727a[_0x439c('0x1f')](_0x338345[0x0]);_0x35727a[_0x439c('0x1f')](_0x338345[0x1]);_0x35727a['push'](_0x338345[0x2]);_0x35727a[_0x439c('0x1f')](_0x338345[0x3]);_0x35727a[_0x439c('0x1f')](_0x338345[_0x439c('0x20')](0x4,_0x338345[_0x439c('0x18')])[_0x439c('0x19')](','));break;case'message':_0x35727a[_0x439c('0x1f')](_0x5278e2[_0x439c('0x22')]);break;case'tag':_0x35727a[_0x439c('0x1f')](_0x5278e2[_0x439c('0x24')]);_0x35727a[_0x439c('0x1f')](_0x5278e2[_0x439c('0x22')]);break;case _0x439c('0x25'):var _0x2c637b=utils[_0x439c('0x26')](_0x5b8898[_0x439c('0x27')][_0x439c('0x28')],_0x5b8898);var _0x31664a=_0x5278e2[_0x439c('0x22')]['split'](',');_0x35727a[_0x439c('0x1f')](_0x31664a[0x0]);_0x35727a['push'](_0x31664a[0x1]);_0x35727a[_0x439c('0x1f')](_0x31664a[0x2]);_0x35727a[_0x439c('0x1f')](_0x31664a[0x3]);_0x35727a['push'](_0x31664a[0x4]);_0x35727a[_0x439c('0x1f')](_0x31664a[0x5]);_0x35727a[_0x439c('0x1f')](_0x31664a[0x6]);_0x35727a['push'](_0x31664a[0x7]);_0x35727a['push'](_0x31664a[0x8]);_0x35727a[_0x439c('0x1f')](_0x31664a[0x9]);_0x35727a['push'](_0x31664a[0xa]);_0x35727a[_0x439c('0x1f')](_0x5b8898['interaction']['id']);_0x35727a[_0x439c('0x1f')](_0x5b8898[_0x439c('0x15')]['id']);_0x35727a[_0x439c('0x1f')](_0x5278e2[_0x439c('0x29')]);_0x35727a[_0x439c('0x1f')](_0x5b8898[_0x439c('0x16')]['ContactId']);_0x35727a[_0x439c('0x1f')](_0x5b8898['body'][_0x439c('0x2a')]);_0x35727a['push'](_0x2c637b);break;default:_0x35727a=_[_0x439c('0xe')](_0x5278e2[_0x439c('0x22')])?[]:_0x5278e2[_0x439c('0x22')][_0x439c('0x1e')](',');}var _0x12d09a={'id':util[_0x439c('0xc')](_0x439c('0x2b'),_0xa448bd,_0x5278e2['id'],_0x5278e2['app']),'condition':require('./interval')[_0x439c('0x2c')](_0xa448bd,getIntervals(_0x1e367a[_0x439c('0x2d')],_0x5278e2),_0x1e367a),'consequence':require('./applications/'+_0x5278e2[_0x439c('0x1a')])['consequence'](_0xa448bd,_0x35727a,_0x1e367a,_0x5b8898),'p':_0x5278e2['priority']||0x0};logger[_0x439c('0x2e')](_0x439c('0x2f'),_0x12d09a['id'],_0x439c('0x30'),getIntervals(_0x1e367a[_0x439c('0x2d')],_0x5278e2)[_0x439c('0x19')](_0x439c('0x31')));_0x64d6d1[_0x439c('0x1f')](_0x12d09a);}else{logger['error'](_0x439c('0x32'),path[_0x439c('0x19')](__dirname,_0x439c('0x17'),_0x5278e2[_0x439c('0x1a')]+_0x439c('0x1b')));}}_0x1e367a['rules'][_0xa448bd]=new RuleEngine(_0x64d6d1);_0x1e367a[_0x439c('0x13')][_0xa448bd][_0x439c('0x33')](_0x5b8898,function(_0xce1f17){logger[_0x439c('0x2e')]('Applications\x20executed',JSON[_0x439c('0x34')](_0xce1f17[_0x439c('0x35')]));if(_0x1e367a['rules'][_0xa448bd]){_0x1e367a['rules'][_0xa448bd]['emit']('complete');}});return _0x38d60d({'code':0xc8,'message':_0x5b8898});}else{logger[_0x439c('0x2e')]('No\x20applications\x20to\x20execute');return _0x38d60d({'code':0xc8,'message':_0x5b8898});}}catch(_0x524589){logger[_0x439c('0x36')](_0x524589[_0x439c('0x37')]);return _0x5478b4(_0x4f5b71['error'](0x1f4,_0x524589));}}return _0x5478b4(_0x439c('0x38'));});},'AcceptMessage':function(_0xe606cc){var _0x2952aa=this;return new Promise(function(_0xed2634,_0x12286c){if(_0xe606cc['agent']&&_0xe606cc[_0x439c('0x39')]['id']){if(_0x1e367a[_0x439c('0x3a')][_0xe606cc[_0x439c('0x39')]['id']]){_0x1e367a[_0x439c('0x3a')][_0xe606cc[_0x439c('0x39')]['id']][_0x439c('0x3b')]=![];_0x1e367a[_0x439c('0x3a')][_0xe606cc[_0x439c('0x39')]['id']][_0x439c('0x3c')]=undefined;}}if(_0xe606cc[_0x439c('0x15')]&&_0xe606cc[_0x439c('0x15')]['id']){try{var _0x15d23a=getId(_0xe606cc['channel'],_0xe606cc[_0x439c('0x15')]?_0xe606cc[_0x439c('0x15')]['id']:0x0,_0xe606cc[_0x439c('0x16')]?_0xe606cc['interaction']['id']:0x0);if(_0x1e367a[_0x439c('0x13')][_0x15d23a]){_0x1e367a[_0x439c('0x13')][_0x15d23a][_0x439c('0x3d')](_0x439c('0x3e'));if(rpc[_0xe606cc[_0x439c('0x14')]+'QueueReport']){rpc[_0xe606cc[_0x439c('0x14')]+_0x439c('0x3f')][_0x439c('0x40')](_0x15d23a,{'UserId':_0xe606cc[_0x439c('0x15')][_0x439c('0x41')]})[_0x439c('0x42')](function(_0x5dfebc){logger[_0x439c('0x36')](_0x439c('0x43'));});}}return _0xed2634({'code':0xc8,'message':_0xe606cc});}catch(_0x2a6c51){logger['error'](_0x2a6c51[_0x439c('0x37')]);return _0x12286c(_0x2952aa[_0x439c('0x36')](0x1f4,_0x2a6c51));}}logger['error'](_0x439c('0x44'));return _0x12286c(_0x2952aa['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x204cbf){var _0x348847=this;return new Promise(function(_0x43ebf5,_0x57e81e){if(_0x204cbf[_0x439c('0x39')]&&_0x204cbf[_0x439c('0x39')]['id']){try{if(_0x1e367a[_0x439c('0x3a')][_0x204cbf[_0x439c('0x39')]['id']]){_0x1e367a['agents'][_0x204cbf['agent']['id']]['busy']=![];_0x1e367a[_0x439c('0x3a')][_0x204cbf[_0x439c('0x39')]['id']]['busyQueue']=undefined;}return _0x43ebf5({'code':0xc8,'message':_0x204cbf});}catch(_0xe329f7){logger[_0x439c('0x36')](_0xe329f7[_0x439c('0x37')]);return _0x57e81e(_0x348847[_0x439c('0x36')](0x1f4,_0xe329f7));}}logger['error'](_0x439c('0x44'));return _0x57e81e(_0x348847[_0x439c('0x36')](0x1f4,_0x439c('0x44')));});},'AbandonInteraction':function(_0x258aaf){var _0x5efea6=this;return new Promise(function(_0x2e2509,_0x9b7561){if(_0x258aaf[_0x439c('0x14')]&&_0x258aaf[_0x439c('0x16')]&&_0x258aaf[_0x439c('0x16')]['id']){try{var _0x2c8d4d=getId(_0x258aaf['channel'],_0x258aaf[_0x439c('0x15')]?_0x258aaf[_0x439c('0x15')]['id']:0x0,_0x258aaf[_0x439c('0x16')]?_0x258aaf[_0x439c('0x16')]['id']:0x0);if(_0x1e367a[_0x439c('0x13')][_0x2c8d4d]){_0x1e367a[_0x439c('0x13')][_0x2c8d4d][_0x439c('0x3d')]('end');}return _0x2e2509({'code':0xc8,'message':_0x258aaf});}catch(_0x43afbd){logger['error'](_0x43afbd[_0x439c('0x37')]);return _0x9b7561(_0x5efea6[_0x439c('0x36')](0x1f4,_0x43afbd));}}logger[_0x439c('0x36')]('message\x20is\x20empty');return _0x9b7561(_0x5efea6['error'](0x1f4,_0x439c('0x44')));});},'AgentCapacity':function(_0x50e65c){var _0x16723e=this;return new Promise(function(_0x37ddd4,_0x3efb9e){if(_0x1e367a[_0x439c('0x3a')][_0x439c('0x45')](_0x50e65c['id'])){for(var _0x314d88 in _0x50e65c['capacity']){if(_0x50e65c['capacity'][_0x439c('0x45')](_0x314d88)){if(_0x1e367a[_0x439c('0x3a')][_0x50e65c['id']][_0x439c('0x45')](_0x314d88+'CurrentCapacity')){_0x1e367a[_0x439c('0x3a')][_0x50e65c['id']][_0x314d88+_0x439c('0x46')]=parseInt(_0x50e65c[_0x439c('0x47')][_0x314d88],0xa);}}}_0x1e367a['agents'][_0x50e65c['id']][_0x439c('0x48')]();return _0x37ddd4({'code':0xc8,'message':_0x1e367a[_0x439c('0x3a')][_0x50e65c['id']]});}else{return _0x3efb9e(_0x16723e[_0x439c('0x36')](0x1f4,_0x439c('0x49')));}});},'Agents':function(_0x395486){return new Promise(function(_0x48d1da,_0xe27f3){var _0x481481=_[_0x439c('0x4a')](_0x1e367a[_0x439c('0x3a')]);_0x48d1da({'count':_0x481481['length'],'rows':_0x481481});});},'ChatQueues':function(_0x2aa589){return new Promise(function(_0x5bb5c4,_0x950a8e){var _0xe4d9f6=[];for(var _0x14e615 in _0x1e367a[_0x439c('0x4b')]){if(_0x1e367a[_0x439c('0x4b')][_0x439c('0x45')](_0x14e615)){var _0x22c674=_0x1e367a[_0x439c('0x4b')][_0x14e615];var _0x59bd8d={'id':_0x22c674['id'],'available':_0x22c674['available'],'loggedIn':_0x22c674['loggedIn'],'name':_0x22c674[_0x439c('0x4c')],'paused':_0x22c674[_0x439c('0x4d')],'waiting':_0x22c674['waiting']};_0xe4d9f6['push'](_0x59bd8d);}}_0x5bb5c4({'count':_0xe4d9f6['length'],'rows':_0xe4d9f6});});},'MailQueues':function(_0x33fc5d){return new Promise(function(_0x2e9aa5,_0x51f7a2){var _0x5642f5=[];for(var _0x1223cf in _0x1e367a[_0x439c('0x4e')]){if(_0x1e367a[_0x439c('0x4e')][_0x439c('0x45')](_0x1223cf)){var _0x395711=_0x1e367a[_0x439c('0x4e')][_0x1223cf];var _0x539861={'id':_0x395711['id'],'available':_0x395711[_0x439c('0x4f')],'loggedIn':_0x395711['loggedIn'],'name':_0x395711[_0x439c('0x4c')],'paused':_0x395711[_0x439c('0x4d')],'waiting':_0x395711[_0x439c('0x50')]};_0x5642f5[_0x439c('0x1f')](_0x539861);}}_0x2e9aa5({'count':_0x5642f5[_0x439c('0x18')],'rows':_0x5642f5});});},'OpenchannelQueues':function(_0xa7467){return new Promise(function(_0x338905,_0x1ddd58){var _0x4543f8=[];for(var _0x3406ab in _0x1e367a[_0x439c('0x51')]){if(_0x1e367a[_0x439c('0x51')][_0x439c('0x45')](_0x3406ab)){var _0x7ff032=_0x1e367a[_0x439c('0x51')][_0x3406ab];var _0x1c991d={'id':_0x7ff032['id'],'available':_0x7ff032[_0x439c('0x4f')],'loggedIn':_0x7ff032[_0x439c('0x52')],'name':_0x7ff032['name'],'paused':_0x7ff032[_0x439c('0x4d')],'waiting':_0x7ff032[_0x439c('0x50')]};_0x4543f8[_0x439c('0x1f')](_0x1c991d);}}_0x338905({'count':_0x4543f8['length'],'rows':_0x4543f8});});},'SmsQueues':function(_0x31851f){return new Promise(function(_0x5b902e,_0x1b89f5){var _0x5c30ce=[];for(var _0xb5133a in _0x1e367a['smsQueues']){if(_0x1e367a[_0x439c('0x53')]['hasOwnProperty'](_0xb5133a)){var _0x5a5205=_0x1e367a[_0x439c('0x53')][_0xb5133a];var _0x9ba6f2={'id':_0x5a5205['id'],'available':_0x5a5205[_0x439c('0x4f')],'loggedIn':_0x5a5205[_0x439c('0x52')],'name':_0x5a5205[_0x439c('0x4c')],'paused':_0x5a5205[_0x439c('0x4d')],'waiting':_0x5a5205[_0x439c('0x50')]};_0x5c30ce[_0x439c('0x1f')](_0x9ba6f2);}}_0x5b902e({'count':_0x5c30ce['length'],'rows':_0x5c30ce});});},'FaxQueues':function(_0x372d34){return new Promise(function(_0x2ac2f7,_0x5a7c40){var _0x2fd8b6=[];for(var _0x355360 in _0x1e367a[_0x439c('0x54')]){if(_0x1e367a['faxQueues'][_0x439c('0x45')](_0x355360)){var _0x593615=_0x1e367a[_0x439c('0x54')][_0x355360];var _0x5e6593={'id':_0x593615['id'],'available':_0x593615[_0x439c('0x4f')],'loggedIn':_0x593615[_0x439c('0x52')],'name':_0x593615[_0x439c('0x4c')],'paused':_0x593615[_0x439c('0x4d')],'waiting':_0x593615[_0x439c('0x50')]};_0x2fd8b6[_0x439c('0x1f')](_0x5e6593);}}_0x2ac2f7({'count':_0x2fd8b6[_0x439c('0x18')],'rows':_0x2fd8b6});});},'WhatsappQueues':function(_0x34e57f){return new Promise(function(_0x43db54,_0x22bf22){var _0x35414f=[];for(var _0x189a34 in _0x1e367a['whatsappQueues']){if(_0x1e367a['whatsappQueues'][_0x439c('0x45')](_0x189a34)){var _0x48ca1f=_0x1e367a['whatsappQueues'][_0x189a34];var _0x5318aa={'id':_0x48ca1f['id'],'available':_0x48ca1f[_0x439c('0x4f')],'loggedIn':_0x48ca1f[_0x439c('0x52')],'name':_0x48ca1f[_0x439c('0x4c')],'paused':_0x48ca1f[_0x439c('0x4d')],'waiting':_0x48ca1f['waiting']};_0x35414f['push'](_0x5318aa);}}_0x43db54({'count':_0x35414f[_0x439c('0x18')],'rows':_0x35414f});});},'ChatQueuesWaitingInteractions':function(_0x42a54a){return new Promise(function(_0x19c2fd,_0x2ae6ae){var _0x1f6613=_[_0x439c('0x4a')](_0x1e367a['chatQueuesWaitingInteractions']);_0x19c2fd({'count':_0x1f6613[_0x439c('0x18')],'rows':_0x1f6613});});},'MailQueuesWaitingInteractions':function(_0x4acedd){return new Promise(function(_0x3de920,_0x3c6dcb){var _0xf940c5=_[_0x439c('0x4a')](_0x1e367a[_0x439c('0x55')]);_0x3de920({'count':_0xf940c5[_0x439c('0x18')],'rows':_0xf940c5});});},'OpenchannelQueuesWaitingInteractions':function(_0x482801){return new Promise(function(_0x448463,_0x914ef2){var _0x5ecda7=_[_0x439c('0x4a')](_0x1e367a[_0x439c('0x56')]);_0x448463({'count':_0x5ecda7[_0x439c('0x18')],'rows':_0x5ecda7});});},'SmsQueuesWaitingInteractions':function(_0x21fbba){return new Promise(function(_0x40de54,_0xa3538a){var _0x3293e0=_[_0x439c('0x4a')](_0x1e367a[_0x439c('0x57')]);_0x40de54({'count':_0x3293e0[_0x439c('0x18')],'rows':_0x3293e0});});},'FaxQueuesWaitingInteractions':function(_0x41985f){return new Promise(function(_0x5f3b88,_0x50f880){var _0x29c31d=_[_0x439c('0x4a')](_0x1e367a['faxQueuesWaitingInteractions']);_0x5f3b88({'count':_0x29c31d[_0x439c('0x18')],'rows':_0x29c31d});});},'WhatsappQueuesWaitingInteractions':function(_0x102870){return new Promise(function(_0x306072,_0x3edb2c){var _0x4856fd=_[_0x439c('0x4a')](_0x1e367a[_0x439c('0x58')]);_0x306072({'count':_0x4856fd[_0x439c('0x18')],'rows':_0x4856fd});});}};var _0x5a63fc=jayson[_0x439c('0x59')](_0x1b72db)[_0x439c('0x5a')]();_0x5a63fc['on'](_0x439c('0x36'),function(_0x324a2e){logger[_0x439c('0x36')](JSON[_0x439c('0x34')](_0x324a2e));return _0x425c3f(_0x324a2e);});_0x5a63fc[_0x439c('0x5b')](0x232c,_0x439c('0x5c'),function(){console[_0x439c('0x5d')](_0x439c('0x5e'),0x232c);return _0x486451(_0x439c('0x5f')+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(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x153f,0x15b));var _0xf153=function(_0x3e8a3c,_0x11b6da){_0x3e8a3c=_0x3e8a3c-0x0;var _0x20889b=_0x153f[_0x3e8a3c];return _0x20889b;};'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 48ce383..f3f6599 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 _0x6c53=['\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','lodash','routing','http','request','then','error','message','result','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','catch','some','join'];(function(_0x52b861,_0x2ca6ac){var _0x7f1bed=function(_0x588561){while(--_0x588561){_0x52b861['push'](_0x52b861['shift']());}};_0x7f1bed(++_0x2ca6ac);}(_0x6c53,0xdd));var _0x36c5=function(_0x3e3da7,_0x1ddae5){_0x3e3da7=_0x3e3da7-0x0;var _0x2a0847=_0x6c53[_0x3e3da7];return _0x2a0847;};'use strict';var util=require(_0x36c5('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x36c5('0x1'));var logger=require('../../../config/logger')(_0x36c5('0x2'));var client=jayson['client'][_0x36c5('0x3')]({'port':0x232a});function request(_0x40190c,_0x3c0f35){return new BPromise(function(_0x14a5a8,_0x2ce241){return client[_0x36c5('0x4')](_0x40190c,_0x3c0f35)[_0x36c5('0x5')](function(_0x19a819){if(_0x19a819['error']){return _0x2ce241(_0x19a819[_0x36c5('0x6')][_0x36c5('0x7')]);}else{return _0x14a5a8(_0x19a819[_0x36c5('0x8')]);}})['catch'](function(_0x24abd7){return _0x2ce241(_0x24abd7);});});}exports[_0x36c5('0x9')]=function(_0x6ead50,_0x2cef55,_0x178780){return function(_0x406683){if(_0x178780['rules']&&!_0x178780['rules'][_0x6ead50]){logger[_0x36c5('0xa')](_0x36c5('0xb'),_0x6ead50);return _0x406683[_0x36c5('0xc')]();}var _0x1be31f=[];for(var _0x582aa0=0x0;_0x582aa0<_0x2cef55['length'];_0x582aa0+=0x1){_0x1be31f[_0x36c5('0xd')](request(_0x36c5('0xe'),{'command':util[_0x36c5('0xf')](_0x36c5('0x10'),_0x2cef55[_0x582aa0])})[_0x36c5('0x5')](function(_0x5e8ecc){return _0x5e8ecc&&_0x5e8ecc[_0x36c5('0x7')]&&_0x5e8ecc[_0x36c5('0x7')][_0x36c5('0x11')](_0x36c5('0x12'))>=0x0?!![]:![];})[_0x36c5('0x13')](function(_0x593d38){logger[_0x36c5('0x6')]('[%s][INTERVAL]\x20%s',_0x6ead50,_0x2cef55[_0x582aa0]);}));}BPromise['all'](_0x1be31f)['then'](function(_0x662a5e){var _0x5cb1af=_[_0x36c5('0x14')](_0x662a5e);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x6ead50,_0x2cef55[_0x36c5('0x15')](_0x36c5('0x16')),_0x5cb1af);_0x406683[_0x36c5('0x17')](_0x5cb1af);})[_0x36c5('0x13')](function(_0x37f5b0){console[_0x36c5('0x18')](_0x37f5b0);logger[_0x36c5('0x6')](_0x36c5('0x19'),_0x6ead50,_0x2cef55[_0x36c5('0x15')](_0x36c5('0x16')),_0x37f5b0[_0x36c5('0x1a')]);_0x406683[_0x36c5('0xc')]();});};}; \ No newline at end of file +var _0xdee9=['client','request','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','when','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xdee9,0x8b));var _0x9dee=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xdee9[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x9dee('0x0'));var BPromise=require(_0x9dee('0x1'));var jayson=require(_0x9dee('0x2'));var _=require(_0x9dee('0x3'));var logger=require(_0x9dee('0x4'))(_0x9dee('0x5'));var client=jayson[_0x9dee('0x6')]['http']({'port':0x232a});function request(_0x68a24d,_0x40199d){return new BPromise(function(_0x3e13ef,_0x156836){return client[_0x9dee('0x7')](_0x68a24d,_0x40199d)['then'](function(_0x3ba31b){if(_0x3ba31b[_0x9dee('0x8')]){return _0x156836(_0x3ba31b[_0x9dee('0x8')]['message']);}else{return _0x3e13ef(_0x3ba31b[_0x9dee('0x9')]);}})[_0x9dee('0xa')](function(_0x482917){return _0x156836(_0x482917);});});}exports[_0x9dee('0xb')]=function(_0x5f3280,_0x245a41,_0x2fd3cb){return function(_0x5baf44){if(_0x2fd3cb[_0x9dee('0xc')]&&!_0x2fd3cb['rules'][_0x5f3280]){logger[_0x9dee('0xd')](_0x9dee('0xe'),_0x5f3280);return _0x5baf44[_0x9dee('0xf')]();}var _0x58a540=[];for(var _0x1ff951=0x0;_0x1ff951<_0x245a41['length'];_0x1ff951+=0x1){_0x58a540[_0x9dee('0x10')](request(_0x9dee('0x11'),{'command':util['format'](_0x9dee('0x12'),_0x245a41[_0x1ff951])})[_0x9dee('0x13')](function(_0x594b17){return _0x594b17&&_0x594b17['message']&&_0x594b17['message'][_0x9dee('0x14')](_0x9dee('0x15'))>=0x0?!![]:![];})[_0x9dee('0xa')](function(_0x1f55bc){logger['error'](_0x9dee('0x16'),_0x5f3280,_0x245a41[_0x1ff951]);}));}BPromise[_0x9dee('0x17')](_0x58a540)[_0x9dee('0x13')](function(_0x1d3693){var _0x5ca6e8=_[_0x9dee('0x18')](_0x1d3693);logger[_0x9dee('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x5f3280,_0x245a41[_0x9dee('0x19')]('\x20|\x20'),_0x5ca6e8);_0x5baf44[_0x9dee('0x1a')](_0x5ca6e8);})[_0x9dee('0xa')](function(_0x2a5607){console['log'](_0x2a5607);logger[_0x9dee('0x8')](_0x9dee('0x1b'),_0x5f3280,_0x245a41[_0x9dee('0x19')]('\x20|\x20'),_0x2a5607[_0x9dee('0x1c')]);_0x5baf44[_0x9dee('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c893db1..ef7ffff 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 _0x282b=['talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','agentconnectAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','clone','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','lastevent','called','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','holdtime','ringtime'];(function(_0x2bff11,_0x42c7f6){var _0x3e5d9a=function(_0x529b14){while(--_0x529b14){_0x2bff11['push'](_0x2bff11['shift']());}};_0x3e5d9a(++_0x42c7f6);}(_0x282b,0xec));var _0xb282=function(_0x201cb9,_0x162aae){_0x201cb9=_0x201cb9-0x0;var _0x52ed31=_0x282b[_0x201cb9];return _0x52ed31;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var utils=require(_0xb282('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2251b5,_0x527989){utils['info'](util['format'](_0xb282('0x3'),_0x2251b5['uniqueid'],_0x2251b5[_0xb282('0x4')],_0x2251b5[_0xb282('0x5')],_0x2251b5[_0xb282('0x6')],_0x2251b5[_0xb282('0x7')],_0x2251b5[_0xb282('0x8')],_0x2251b5[_0xb282('0x9')],_0x2251b5['lastevent']));if(_0x2251b5['queue']){utils[_0xb282('0xa')](_0x2251b5[_0xb282('0x5')])['then'](function(_0x2928cf){if(_0x2928cf){_0x2251b5[_0xb282('0xb')]=_0x2928cf[_0xb282('0xb')];_0x2251b5[_0xb282('0xc')]=_0x2251b5['agentcomplete']?_0x2928cf['acw']:![];_0x2251b5[_0xb282('0xd')]=_0x2251b5[_0xb282('0xc')]?_0x2928cf[_0xb282('0xe')]:0x0;}utils[_0xb282('0xf')](_0xb282('0x10'),_0x2251b5);});}else{utils['request']('CreateVoiceAgentReport',_0x2251b5);}if(_0x527989){delete transfers[_0x2251b5[_0xb282('0x11')]];}else{delete agents[_0x2251b5[_0xb282('0x12')]];}}exports[_0xb282('0x13')]=function(_0x9e9072){try{utils[_0xb282('0x14')](util['format'](_0xb282('0x15'),_0x9e9072['uniqueid']),_0x9e9072);agents[_0x9e9072[_0xb282('0x12')]]=_0x9e9072;agents[_0x9e9072[_0xb282('0x12')]]['agentcalledAt']=utils['now']();agents[_0x9e9072['destuniqueid']][_0xb282('0x16')]=_0xb282('0x17');agents[_0x9e9072[_0xb282('0x12')]][_0xb282('0x9')]=null;agents[_0x9e9072[_0xb282('0x12')]]['connectedlinename']=null;utils[_0xb282('0x18')](util[_0xb282('0x19')](_0xb282('0x1a'),_0x9e9072[_0xb282('0x11')],agents[_0x9e9072[_0xb282('0x12')]]['membername'],_0x9e9072['destuniqueid']));}catch(_0xcea320){utils[_0xb282('0x1b')](util['format'](_0xb282('0x15'),_0x9e9072[_0xb282('0x11')]),_0xcea320);}};exports[_0xb282('0x1c')]=function(_0x438dbe){try{if(!_[_0xb282('0x1d')](agents[_0x438dbe['destuniqueid']])){utils[_0xb282('0x14')](util[_0xb282('0x19')](_0xb282('0x1e'),_0x438dbe['uniqueid']),_0x438dbe);utils[_0xb282('0x18')](util[_0xb282('0x19')](_0xb282('0x1f'),_0x438dbe[_0xb282('0x11')],agents[_0x438dbe[_0xb282('0x12')]]['membername'],_0x438dbe['destuniqueid']));agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x1c')]=!![];agents[_0x438dbe['destuniqueid']]['agentringnoanswerAt']=utils[_0xb282('0x20')]();agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x16')]=_0xb282('0x21');agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x22')]='timeout';agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x23')]=_0x438dbe['ringtime']?parseInt(_0x438dbe[_0xb282('0x24')])/0x3e8:0x0;agents[_0x438dbe[_0xb282('0x12')]][_0xb282('0x25')]=0x0;unanswered[_0xb282('0x26')](_0x438dbe['destuniqueid']);}}catch(_0x1520b1){utils[_0xb282('0x1b')](util[_0xb282('0x19')](_0xb282('0x1e'),_0x438dbe[_0xb282('0x11')]),_0x1520b1);}};exports[_0xb282('0x27')]=function(_0x22f657){try{_['forIn'](agents,function(_0x1b15b5,_0x1e2861){if(_0x1b15b5[_0xb282('0x11')]==_0x22f657[_0xb282('0x11')]&&!_[_0xb282('0x28')](unanswered,_0x1b15b5['destuniqueid'])){utils[_0xb282('0x14')](util['format'](_0xb282('0x29'),_0x22f657[_0xb282('0x11')]),_0x22f657);utils[_0xb282('0x18')](util['format'](_0xb282('0x2a'),_0x22f657['uniqueid'],_0x1b15b5[_0xb282('0x6')],_0x1b15b5[_0xb282('0x12')]));_0x1b15b5[_0xb282('0x1c')]=!![];_0x1b15b5[_0xb282('0x2b')]=utils[_0xb282('0x20')]();_0x1b15b5[_0xb282('0x16')]='abandoned';_0x1b15b5[_0xb282('0x22')]=_0xb282('0x2c');_0x1b15b5['holdtime']=_0x22f657['holdtime'];_0x1b15b5[_0xb282('0x25')]=0x0;writeDB(_0x1b15b5);}});}catch(_0x271643){utils[_0xb282('0x1b')](util['format']('[%s][agents][queuecallerabandon]',_0x22f657['uniqueid']),_0x271643);}};exports[_0xb282('0x2d')]=function(_0x2a7362){try{if(agents[_0x2a7362[_0xb282('0x12')]]){utils[_0xb282('0x14')](util[_0xb282('0x19')](_0xb282('0x2e'),_0x2a7362[_0xb282('0x11')]),_0x2a7362);utils['info'](util[_0xb282('0x19')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2a7362[_0xb282('0x11')],agents[_0x2a7362[_0xb282('0x12')]][_0xb282('0x6')],_0x2a7362['destuniqueid']));agents[_0x2a7362[_0xb282('0x12')]]['agentconnectAt']=utils[_0xb282('0x20')]();agents[_0x2a7362[_0xb282('0x12')]][_0xb282('0x9')]=_0x2a7362[_0xb282('0x9')];agents[_0x2a7362['destuniqueid']]['connectedlinename']=_0x2a7362[_0xb282('0x2f')];agents[_0x2a7362[_0xb282('0x12')]][_0xb282('0x23')]=_0x2a7362[_0xb282('0x24')];agents[_0x2a7362['destuniqueid']][_0xb282('0x16')]='connect';_[_0xb282('0x30')](agents,function(_0x1a1b50,_0x482ff9){if(_0x1a1b50[_0xb282('0x12')]!=_0x2a7362[_0xb282('0x12')]&&_0x1a1b50[_0xb282('0x11')]==_0x2a7362[_0xb282('0x11')]){_0x1a1b50[_0xb282('0x25')]=0x0;_0x1a1b50[_0xb282('0x23')]=_0x2a7362[_0xb282('0x24')];_0x1a1b50[_0xb282('0x1c')]=!![];_0x1a1b50[_0xb282('0x2b')]=utils[_0xb282('0x20')]();_0x1a1b50[_0xb282('0x16')]=_0xb282('0x31');_0x1a1b50[_0xb282('0x22')]=_0xb282('0x31');_0x1a1b50[_0xb282('0x32')]=_0x2a7362[_0xb282('0x12')];_0x1a1b50[_0xb282('0x33')]=_0x2a7362[_0xb282('0x6')];writeDB(_0x1a1b50);}});}}catch(_0x573da7){utils[_0xb282('0x1b')](util['format'](_0xb282('0x2e'),_0x2a7362[_0xb282('0x11')]),_0x573da7);}};exports[_0xb282('0x34')]=function(_0x2f2ce8){try{if(!_[_0xb282('0x1d')](agents[_0x2f2ce8[_0xb282('0x12')]])){utils['debug'](util['format'](_0xb282('0x35'),_0x2f2ce8['uniqueid']),_0x2f2ce8);utils[_0xb282('0x18')](util[_0xb282('0x19')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2f2ce8[_0xb282('0x11')],agents[_0x2f2ce8[_0xb282('0x12')]][_0xb282('0x6')],_0x2f2ce8['destuniqueid']));agents[_0x2f2ce8['destuniqueid']][_0xb282('0x34')]=!![];agents[_0x2f2ce8['destuniqueid']][_0xb282('0x36')]=utils[_0xb282('0x20')]();agents[_0x2f2ce8[_0xb282('0x12')]][_0xb282('0x25')]=utils[_0xb282('0x37')](agents[_0x2f2ce8[_0xb282('0x12')]]['agentcompleteAt'],agents[_0x2f2ce8[_0xb282('0x12')]][_0xb282('0x38')]);agents[_0x2f2ce8[_0xb282('0x12')]]['reason']=_0x2f2ce8[_0xb282('0x22')];agents[_0x2f2ce8['destuniqueid']][_0xb282('0x16')]='complete';writeDB(agents[_0x2f2ce8[_0xb282('0x12')]]);}}catch(_0x4ac56f){utils['error'](util['format'](_0xb282('0x35'),_0x2f2ce8[_0xb282('0x11')]),_0x4ac56f);}};exports[_0xb282('0x39')]=function(_0x7a5aa4){try{if(!_['isNil'](agents[_0x7a5aa4['transfereruniqueid']])){utils['debug'](util[_0xb282('0x19')](_0xb282('0x3a'),_0x7a5aa4[_0xb282('0x11')]),_0x7a5aa4);utils[_0xb282('0x18')](util['format'](_0xb282('0x3b'),_0x7a5aa4[_0xb282('0x11')],agents[_0x7a5aa4['transfereruniqueid']][_0xb282('0x6')],agents[_0x7a5aa4[_0xb282('0x3c')]][_0xb282('0x11')]));agents[_0x7a5aa4[_0xb282('0x3c')]][_0xb282('0x3d')]=!![];agents[_0x7a5aa4['transfereruniqueid']][_0xb282('0x3e')]=_0xb282('0x3f');agents[_0x7a5aa4[_0xb282('0x3c')]][_0xb282('0x40')]=_0x7a5aa4[_0xb282('0x41')];agents[_0x7a5aa4[_0xb282('0x3c')]]['transferuniqueid']=agents[_0x7a5aa4[_0xb282('0x3c')]]['uniqueid'];}}catch(_0x4554f1){utils[_0xb282('0x1b')](util['format'](_0xb282('0x3a'),_0x7a5aa4[_0xb282('0x11')]),_0x4554f1);}};exports[_0xb282('0x42')]=function(_0x49fc44){try{utils['debug'](util[_0xb282('0x19')](_0xb282('0x43'),_0x49fc44[_0xb282('0x44')]),_0x49fc44);if(_0x49fc44['origtransfereruniqueid']==_0x49fc44[_0xb282('0x45')]){if(!_['isNil'](agents[_0x49fc44[_0xb282('0x46')]])){utils[_0xb282('0x18')](util['format'](_0xb282('0x47'),_0x49fc44['origtransfereruniqueid'],agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x6')]));agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x3d')]=!![];agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x3e')]='ATTENDED';agents[_0x49fc44[_0xb282('0x46')]]['transferexten']=_0x49fc44[_0xb282('0x48')];agents[_0x49fc44[_0xb282('0x46')]]['transferuniqueid']=_0x49fc44['origtransfereruniqueid'];}if(_0x49fc44[_0xb282('0x49')]&&agents[_0x49fc44[_0xb282('0x49')]]){agents[_0x49fc44[_0xb282('0x49')]]['agententerreason']=0x1;transfers[_0x49fc44['transfereeuniqueid']]=_[_0xb282('0x4a')](agents[_0x49fc44[_0xb282('0x49')]]);transfers[_0x49fc44[_0xb282('0x49')]]['calleridnum']=agents[_0x49fc44[_0xb282('0x46')]]['calleridnum'];transfers[_0x49fc44[_0xb282('0x49')]][_0xb282('0x4b')]=agents[_0x49fc44[_0xb282('0x46')]][_0xb282('0x4b')];transfers[_0x49fc44[_0xb282('0x49')]][_0xb282('0x4c')]=utils[_0xb282('0x20')]();transfers[_0x49fc44['transfereeuniqueid']][_0xb282('0x38')]=utils[_0xb282('0x20')]();transfers[_0x49fc44[_0xb282('0x49')]]['holdtime']=0x0;transfers[_0x49fc44['transfereeuniqueid']][_0xb282('0x4d')]=0x2;}}else if(_0x49fc44[_0xb282('0x46')]==_0x49fc44[_0xb282('0x4e')]){if(!_['isNil'](agents[_0x49fc44['origtransfereruniqueid']])){utils[_0xb282('0x18')](util[_0xb282('0x19')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x49fc44[_0xb282('0x44')],agents[_0x49fc44[_0xb282('0x44')]][_0xb282('0x6')]));agents[_0x49fc44['origtransfereruniqueid']][_0xb282('0x3d')]=!![];agents[_0x49fc44[_0xb282('0x44')]]['transfertype']=_0xb282('0x4f');agents[_0x49fc44[_0xb282('0x44')]][_0xb282('0x40')]=_0x49fc44[_0xb282('0x50')];agents[_0x49fc44['origtransfereruniqueid']]['transferuniqueid']=_0x49fc44[_0xb282('0x46')];}if(_0x49fc44[_0xb282('0x51')]&&agents[_0x49fc44['transfertargetuniqueid']]){agents[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4d')]=0x1;transfers[_0x49fc44[_0xb282('0x51')]]=_[_0xb282('0x4a')](agents[_0x49fc44[_0xb282('0x51')]]);transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x8')]=agents[_0x49fc44[_0xb282('0x44')]]['calleridnum'];transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4b')]=agents[_0x49fc44[_0xb282('0x44')]]['calleridname'];transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4c')]=utils['now']();transfers[_0x49fc44['transfertargetuniqueid']][_0xb282('0x38')]=utils[_0xb282('0x20')]();transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x23')]=0x0;transfers[_0x49fc44[_0xb282('0x51')]][_0xb282('0x4d')]=0x2;}}}catch(_0x3cb0c6){utils[_0xb282('0x1b')](util[_0xb282('0x19')](_0xb282('0x43'),_0x49fc44[_0xb282('0x44')]),_0x3cb0c6);}};exports[_0xb282('0x52')]=function(_0x88dfa6){try{utils[_0xb282('0x14')](util[_0xb282('0x19')](_0xb282('0x53'),_0x88dfa6['uniqueid']),_0x88dfa6);if(agents[_0x88dfa6[_0xb282('0x11')]]&&agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')]===_0xb282('0x21')){if(_0x88dfa6[_0xb282('0x54')]==='21'){agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')]=_0xb282('0x55');agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]=_0xb282('0x55');}utils['info'](util[_0xb282('0x19')](_0xb282('0x56'),_0x88dfa6[_0xb282('0x11')],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x6')],agents[_0x88dfa6['uniqueid']]['reason'],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]));writeDB(agents[_0x88dfa6[_0xb282('0x11')]]);var _0x449adc=unanswered[_0xb282('0x57')](_0x88dfa6[_0xb282('0x11')]);if(_0x449adc>-0x1){unanswered[_0xb282('0x58')](_0x449adc,0x1);}}if(transfers[_0x88dfa6['uniqueid']]){transfers[_0x88dfa6['uniqueid']][_0xb282('0x34')]=!![];transfers[_0x88dfa6[_0xb282('0x11')]]['agentcompleteAt']=utils['now']();transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x25')]=utils[_0xb282('0x37')](transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x36')],transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x38')]);transfers[_0x88dfa6['uniqueid']][_0xb282('0x22')]=_0xb282('0x59');transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]=_0xb282('0x5a');utils[_0xb282('0x18')](util[_0xb282('0x19')](_0xb282('0x56'),_0x88dfa6[_0xb282('0x11')],transfers[_0x88dfa6[_0xb282('0x11')]]['membername'],transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')],transfers[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]));writeDB(transfers[_0x88dfa6[_0xb282('0x11')]],!![]);}if(agents[_0x88dfa6[_0xb282('0x11')]]&&agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x38')]){agents[_0x88dfa6['uniqueid']][_0xb282('0x34')]=!![];agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x36')]=utils[_0xb282('0x20')]();agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x25')]=utils['diffTime'](agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x36')],agents[_0x88dfa6[_0xb282('0x11')]]['agentconnectAt']);agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')]=agents[_0x88dfa6['uniqueid']][_0xb282('0x3d')]?_0xb282('0x3d'):_0xb282('0x59');agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]=_0xb282('0x5a');utils[_0xb282('0x18')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x88dfa6[_0xb282('0x11')],agents[_0x88dfa6['uniqueid']][_0xb282('0x6')],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x22')],agents[_0x88dfa6[_0xb282('0x11')]][_0xb282('0x16')]));writeDB(agents[_0x88dfa6['uniqueid']]);}}catch(_0xa1f33c){utils[_0xb282('0x1b')](util[_0xb282('0x19')]('[%s][agents][hangup]',_0x88dfa6[_0xb282('0x11')]),_0xa1f33c);}}; \ No newline at end of file +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(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x84a0,0x66));var _0x084a=function(_0x5b9f70,_0x28f96b){_0x5b9f70=_0x5b9f70-0x0;var _0x2ef954=_0x84a0[_0x5b9f70];return _0x2ef954;};'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 diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 43c45e6..9e1e789 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 _0xed65=['billableseconds','endtime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','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','source','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','newexten','appdata','application','toLowerCase','set','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','systemanswertime','channelstate','destinationchannel','answertime','disposition','[%s][calls][newstate]','hangup','[%s][calls][hangup]','calleridname','callerid','cause-txt','duration','diffTime','starttime'];(function(_0x570ced,_0x34262b){var _0x2cf1dc=function(_0x4823d9){while(--_0x4823d9){_0x570ced['push'](_0x570ced['shift']());}};_0x2cf1dc(++_0x34262b);}(_0xed65,0xa1));var _0x5ed6=function(_0x323c60,_0x219b72){_0x323c60=_0x323c60-0x0;var _0x103f23=_0xed65[_0x323c60];return _0x103f23;};'use strict';var _=require(_0x5ed6('0x0'));var util=require(_0x5ed6('0x1'));var utils=require(_0x5ed6('0x2'));var transfers=require(_0x5ed6('0x3'));var dispositions=['NO\x20ANSWER',_0x5ed6('0x4'),'FAILED',_0x5ed6('0x5'),'NO\x20ANSWER','NO\x20ANSWER',_0x5ed6('0x6'),'BUSY',_0x5ed6('0x4'),_0x5ed6('0x4'),_0x5ed6('0x4')];var channels={};function writeDB(_0x296205){var _0x14cde4;if(transfers[_0x5ed6('0x7')][_0x296205[_0x5ed6('0x8')]]){_0x14cde4=_0x296205[_0x5ed6('0x8')];_0x296205['uniqueid']=transfers[_0x5ed6('0x7')][_0x296205[_0x5ed6('0x8')]][_0x5ed6('0x9')];}utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0xc'),_0x296205[_0x5ed6('0x8')],_0x296205[_0x5ed6('0xd')],_0x296205[_0x5ed6('0xe')],_0x296205[_0x5ed6('0xf')],_0x296205[_0x5ed6('0x10')],_0x296205[_0x5ed6('0x11')],_0x296205['connectedlinenum'],_0x296205[_0x5ed6('0x12')]));if(_0x296205[_0x5ed6('0x13')]){utils[_0x5ed6('0x14')](_0x296205[_0x5ed6('0x13')])[_0x5ed6('0x15')](function(_0x3162ef){if(_0x3162ef){_0x296205[_0x5ed6('0x16')]=_0x3162ef['id'];}utils[_0x5ed6('0x17')](_0x5ed6('0x18'),_0x296205);});}else{utils[_0x5ed6('0x17')](_0x5ed6('0x18'),_0x296205);}if(channels[_0x296205[_0x5ed6('0x8')]]){delete channels[_0x296205[_0x5ed6('0x8')]];}else if(_0x14cde4&&channels[_0x14cde4]){if(!transfers[_0x5ed6('0x7')][_0x14cde4][_0x5ed6('0x19')])delete transfers[_0x5ed6('0x7')][_0x14cde4];delete channels[_0x14cde4];}}exports['newchannel']=function(_0x676869){try{utils[_0x5ed6('0x1a')](util[_0x5ed6('0xb')](_0x5ed6('0x1b'),_0x676869[_0x5ed6('0x8')]),_0x676869);if(_0x676869[_0x5ed6('0x8')]==_0x676869[_0x5ed6('0x1c')]&&_0x676869[_0x5ed6('0xd')]!='OutgoingSpoolFailed'){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x1d'),_0x676869[_0x5ed6('0x8')],_0x676869[_0x5ed6('0x1e')],_0x676869[_0x5ed6('0x1f')]));channels[_0x676869[_0x5ed6('0x8')]]={'uniqueid':_0x676869['uniqueid'],'accountcode':_0x676869[_0x5ed6('0x13')],'source':_0x676869[_0x5ed6('0x11')],'destination':_0x676869[_0x5ed6('0x1f')],'destinationcontext':_0x676869[_0x5ed6('0x1e')],'channel':_0x676869[_0x5ed6('0xd')],'starttime':utils[_0x5ed6('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5ed6('0x5'),'amaflags':_0x5ed6('0x21')};}}catch(_0x4077c5){utils[_0x5ed6('0x22')](util['format'](_0x5ed6('0x1b'),_0x676869['uniqueid']),_0x4077c5);}};exports[_0x5ed6('0x23')]=function(_0x2e1f67){try{utils[_0x5ed6('0x1a')](util[_0x5ed6('0xb')]('[%s][calls][newstate]',_0x2e1f67['uniqueid']),_0x2e1f67);if(!_[_0x5ed6('0x24')](channels[_0x2e1f67['uniqueid']])&&_0x2e1f67['channelstate']==0x6){utils['info'](util[_0x5ed6('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2e1f67['uniqueid'],_0x2e1f67[_0x5ed6('0x1e')],_0x2e1f67[_0x5ed6('0xd')]));if(_[_0x5ed6('0x24')](channels[_0x2e1f67[_0x5ed6('0x8')]][_0x5ed6('0x25')])){channels[_0x2e1f67['uniqueid']][_0x5ed6('0x25')]=utils[_0x5ed6('0x20')]();}}else if(!_[_0x5ed6('0x24')](channels[_0x2e1f67[_0x5ed6('0x1c')]])&&_0x2e1f67[_0x5ed6('0x26')]==0x6&&_0x2e1f67[_0x5ed6('0x1e')]!='transfer'){utils[_0x5ed6('0xa')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2e1f67[_0x5ed6('0x8')],_0x2e1f67[_0x5ed6('0x1c')],_0x2e1f67['context'],_0x2e1f67[_0x5ed6('0xd')]));channels[_0x2e1f67[_0x5ed6('0x1c')]][_0x5ed6('0x13')]=_0x2e1f67[_0x5ed6('0x13')];channels[_0x2e1f67[_0x5ed6('0x1c')]][_0x5ed6('0x27')]=_0x2e1f67[_0x5ed6('0xd')];if(_['isNil'](channels[_0x2e1f67[_0x5ed6('0x1c')]][_0x5ed6('0x28')])){channels[_0x2e1f67[_0x5ed6('0x1c')]][_0x5ed6('0x28')]=utils[_0x5ed6('0x20')]();}channels[_0x2e1f67[_0x5ed6('0x1c')]][_0x5ed6('0x29')]=dispositions[_['toNumber'](_0x2e1f67[_0x5ed6('0x26')])]||_0x5ed6('0x6');}}catch(_0x219ad5){utils[_0x5ed6('0x22')](util['format'](_0x5ed6('0x2a'),_0x2e1f67[_0x5ed6('0x8')]),_0x219ad5);}};exports[_0x5ed6('0x2b')]=function(_0x235bae){try{if(!_[_0x5ed6('0x24')](channels[_0x235bae[_0x5ed6('0x8')]])){utils[_0x5ed6('0x1a')](util['format'](_0x5ed6('0x2c'),_0x235bae['uniqueid']),_0x235bae);if(_[_0x5ed6('0x24')](channels[_0x235bae['uniqueid']]['callerid'])){channels[_0x235bae[_0x5ed6('0x8')]]['callerid']=_0x235bae[_0x5ed6('0x2d')]+'\x20<'+_0x235bae['calleridnum']+'>';}utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x235bae[_0x5ed6('0x8')],channels[_0x235bae[_0x5ed6('0x8')]][_0x5ed6('0x2e')],_0x235bae[_0x5ed6('0x2f')]));channels[_0x235bae[_0x5ed6('0x8')]]['endtime']=utils[_0x5ed6('0x20')]();channels[_0x235bae[_0x5ed6('0x8')]][_0x5ed6('0x30')]=utils[_0x5ed6('0x31')](channels[_0x235bae[_0x5ed6('0x8')]]['endtime'],channels[_0x235bae[_0x5ed6('0x8')]][_0x5ed6('0x32')]);channels[_0x235bae['uniqueid']][_0x5ed6('0x33')]=channels[_0x235bae[_0x5ed6('0x8')]]['answertime']?utils[_0x5ed6('0x31')](channels[_0x235bae['uniqueid']][_0x5ed6('0x34')],channels[_0x235bae[_0x5ed6('0x8')]][_0x5ed6('0x28')]):0x0;writeDB(channels[_0x235bae[_0x5ed6('0x8')]]);}}catch(_0x25027c){utils[_0x5ed6('0x22')](util['format'](_0x5ed6('0x2c'),_0x235bae[_0x5ed6('0x8')]),_0x25027c);}};exports[_0x5ed6('0x35')]=function(_0x4fdf1b){try{if(!_[_0x5ed6('0x24')](channels[_0x4fdf1b['localtwolinkedid']])){utils[_0x5ed6('0x1a')](util[_0x5ed6('0xb')](_0x5ed6('0x36'),_0x4fdf1b[_0x5ed6('0x37')]),_0x4fdf1b);if(channels[_0x4fdf1b[_0x5ed6('0x38')]][_0x5ed6('0xd')]==_0x4fdf1b[_0x5ed6('0x39')]){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x3a'),_0x4fdf1b['origtransfereruniqueid'],_0x4fdf1b[_0x5ed6('0x38')],_0x4fdf1b[_0x5ed6('0x3b')]));channels[_0x4fdf1b['localtwolinkedid']][_0x5ed6('0x27')]=_0x4fdf1b[_0x5ed6('0x3b')];channels[_0x4fdf1b[_0x5ed6('0x38')]][_0x5ed6('0x3c')]=_0x5ed6('0x3d');}else if(channels[_0x4fdf1b[_0x5ed6('0x38')]][_0x5ed6('0xd')]=_0x4fdf1b[_0x5ed6('0x3e')]){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x3a'),_0x4fdf1b[_0x5ed6('0x37')],_0x4fdf1b[_0x5ed6('0x38')],_0x4fdf1b[_0x5ed6('0x3f')]));channels[_0x4fdf1b['localtwolinkedid']][_0x5ed6('0x27')]=_0x4fdf1b['origtransfererchannel'];channels[_0x4fdf1b[_0x5ed6('0x38')]]['userfield']=_0x5ed6('0x3d');}}}catch(_0x138c0a){utils[_0x5ed6('0x22')](util[_0x5ed6('0xb')](_0x5ed6('0x36'),_0x4fdf1b[_0x5ed6('0x37')]),_0x138c0a);}};exports[_0x5ed6('0x40')]=function(_0x491719){try{if(!_[_0x5ed6('0x24')](channels[_0x491719[_0x5ed6('0x8')]])){utils['debug'](util['format'](_0x5ed6('0x41'),_0x491719[_0x5ed6('0x8')]),_0x491719);channels[_0x491719[_0x5ed6('0x8')]][_0x5ed6('0x42')]=utils['now']();utils[_0x5ed6('0xa')](util['format'](_0x5ed6('0x43'),_0x491719['uniqueid'],channels[_0x491719[_0x5ed6('0x8')]]['musiconholdstartAt']));}}catch(_0x2b1df6){utils[_0x5ed6('0x22')](util['format'](_0x5ed6('0x41'),_0x491719['uniqueid']),_0x2b1df6);}};exports[_0x5ed6('0x44')]=function(_0x3c4e26){try{if(!_[_0x5ed6('0x24')](channels[_0x3c4e26['uniqueid']])){utils['debug'](util[_0x5ed6('0xb')](_0x5ed6('0x45'),_0x3c4e26[_0x5ed6('0x8')]),_0x3c4e26);if(!_['isNil'](channels[_0x3c4e26[_0x5ed6('0x8')]][_0x5ed6('0x42')])){channels[_0x3c4e26['uniqueid']]['mohtime']+=utils[_0x5ed6('0x31')](utils['now'](),channels[_0x3c4e26['uniqueid']][_0x5ed6('0x42')]);utils[_0x5ed6('0xa')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3c4e26[_0x5ed6('0x8')],channels[_0x3c4e26[_0x5ed6('0x8')]][_0x5ed6('0x46')]));delete channels[_0x3c4e26[_0x5ed6('0x8')]][_0x5ed6('0x42')];}}}catch(_0x526788){utils[_0x5ed6('0x22')](util[_0x5ed6('0xb')](_0x5ed6('0x45'),_0x3c4e26[_0x5ed6('0x8')]),_0x526788);}};exports[_0x5ed6('0x47')]=function(_0x228b5d){try{if(!_[_0x5ed6('0x24')](channels[_0x228b5d[_0x5ed6('0x8')]])){utils[_0x5ed6('0x1a')](util['format'](_0x5ed6('0x48'),_0x228b5d[_0x5ed6('0x8')]),_0x228b5d);if(!_[_0x5ed6('0x24')](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x4a')])){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x4b'),_0x228b5d[_0x5ed6('0x8')],_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d[_0x5ed6('0x8')]][_0x5ed6('0x4d')]=_0x228b5d[_0x5ed6('0x4c')];}if(!_[_0x5ed6('0x24')](_0x228b5d['variable'][_0x5ed6('0x4e')])){utils[_0x5ed6('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x228b5d[_0x5ed6('0x8')],_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d[_0x5ed6('0x8')]]['destination']=_0x228b5d[_0x5ed6('0x4c')];channels[_0x228b5d[_0x5ed6('0x8')]][_0x5ed6('0x2e')]='\x22'+_0x228b5d[_0x5ed6('0x4c')]+_0x5ed6('0x4f')+_0x228b5d['value']+'>';}if(!_[_0x5ed6('0x24')](_0x228b5d['variable'][_0x5ed6('0x50')])||!_['isNil'](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x51')])){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x52'),_0x228b5d['uniqueid'],!_[_0x5ed6('0x24')](_0x228b5d['variable'][_0x5ed6('0x50')])?_0x5ed6('0x50'):_0x5ed6('0x51'),_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d[_0x5ed6('0x8')]][_0x5ed6('0x2e')]=_0x228b5d[_0x5ed6('0x4c')];}if(!_[_0x5ed6('0x24')](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x53')])||!_[_0x5ed6('0x24')](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x54')])){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x228b5d['uniqueid'],!_[_0x5ed6('0x24')](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x53')])?_0x5ed6('0x53'):_0x5ed6('0x54'),_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d['uniqueid']][_0x5ed6('0x55')]='Queue';channels[_0x228b5d[_0x5ed6('0x8')]]['lastdata']=_0x228b5d[_0x5ed6('0x4c')];channels[_0x228b5d['uniqueid']][_0x5ed6('0xe')]=!![];}if(!_['isNil'](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x56')])){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x57'),_0x228b5d[_0x5ed6('0x8')],_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d[_0x5ed6('0x8')]][_0x5ed6('0x58')]=_0x228b5d[_0x5ed6('0x4c')];}if(!_[_0x5ed6('0x24')](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x59')])){utils['info'](util[_0x5ed6('0xb')](_0x5ed6('0x5a'),_0x228b5d['uniqueid'],_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d['uniqueid']][_0x5ed6('0x5b')]=_0x228b5d[_0x5ed6('0x4c')];}if(!_['isNil'](_0x228b5d[_0x5ed6('0x49')][_0x5ed6('0x5c')])){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')](_0x5ed6('0x5d'),_0x228b5d[_0x5ed6('0x8')],_0x228b5d['value']));channels[_0x228b5d[_0x5ed6('0x8')]]['routeid']=_0x228b5d[_0x5ed6('0x4c')];}if(!_[_0x5ed6('0x24')](_0x228b5d[_0x5ed6('0x49')]['sipcallid'])){utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x228b5d[_0x5ed6('0x8')],_0x228b5d[_0x5ed6('0x4c')]));channels[_0x228b5d['uniqueid']][_0x5ed6('0x5e')]=_0x228b5d[_0x5ed6('0x4c')];}}}catch(_0x534b4b){utils[_0x5ed6('0x22')](util[_0x5ed6('0xb')]('[%s][calls][varset]',_0x228b5d[_0x5ed6('0x8')]),_0x534b4b);}};exports[_0x5ed6('0x5f')]=function(_0x24403e){try{if(!_['isNil'](channels[_0x24403e[_0x5ed6('0x8')]])){utils[_0x5ed6('0x1a')](util[_0x5ed6('0xb')]('[%s][calls][newexten]',_0x24403e[_0x5ed6('0x8')]),_0x24403e);utils[_0x5ed6('0xa')](util[_0x5ed6('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x24403e[_0x5ed6('0x8')],_0x24403e['application'],_0x24403e[_0x5ed6('0x60')]));if(_0x24403e[_0x5ed6('0x61')][_0x5ed6('0x62')]()==_0x5ed6('0x63')&&_['startsWith'](_0x24403e['appdata'][_0x5ed6('0x62')](),'cdr')){var _0x401403=_0x24403e[_0x5ed6('0x60')]['split']('=');var _0x22ebb5=_0x401403[0x0]['substring'](_0x401403[0x0]['lastIndexOf']('(')+0x1,_0x401403[0x0][_0x5ed6('0x64')](')'));var _0x5f63de=_0x401403[0x1];channels[_0x24403e[_0x5ed6('0x8')]][_0x22ebb5]=_0x5f63de;}if(!_[_0x5ed6('0x65')]([_0x5ed6('0x2b'),_0x5ed6('0x66'),_0x5ed6('0x67'),'set',_0x5ed6('0x68')],_0x24403e['application'][_0x5ed6('0x62')]())){channels[_0x24403e[_0x5ed6('0x8')]][_0x5ed6('0x55')]=_0x24403e[_0x5ed6('0x61')];channels[_0x24403e[_0x5ed6('0x8')]]['lastdata']=_0x24403e['appdata'];}}}catch(_0x5454da){utils[_0x5ed6('0x22')](util['format'](_0x5ed6('0x69'),_0x24403e[_0x5ed6('0x8')]),_0x5454da);}}; \ No newline at end of file +var _0x80b2=['[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','split','substring','lastIndexOf','includes','noop','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','channel','queue','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','error','isNil','channelstate','systemanswertime','transfer','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid'];(function(_0x5c85d3,_0x1aaa12){var _0x4ed4f5=function(_0x572a9c){while(--_0x572a9c){_0x5c85d3['push'](_0x5c85d3['shift']());}};_0x4ed4f5(++_0x1aaa12);}(_0x80b2,0x141));var _0x280b=function(_0x257191,_0x56895d){_0x257191=_0x257191-0x0;var _0x19e7de=_0x80b2[_0x257191];return _0x19e7de;};'use strict';var _=require(_0x280b('0x0'));var util=require(_0x280b('0x1'));var utils=require('./utils');var transfers=require(_0x280b('0x2'));var dispositions=[_0x280b('0x3'),'FAILED',_0x280b('0x4'),_0x280b('0x3'),_0x280b('0x3'),_0x280b('0x3'),_0x280b('0x5'),'BUSY',_0x280b('0x4'),_0x280b('0x4'),'FAILED'];var channels={};function writeDB(_0xb676eb){var _0x1263a4;if(transfers[_0x280b('0x6')][_0xb676eb['uniqueid']]){_0x1263a4=_0xb676eb[_0x280b('0x7')];_0xb676eb[_0x280b('0x7')]=transfers[_0x280b('0x6')][_0xb676eb[_0x280b('0x7')]][_0x280b('0x8')];}utils[_0x280b('0x9')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xb676eb[_0x280b('0x7')],_0xb676eb[_0x280b('0xa')],_0xb676eb[_0x280b('0xb')],_0xb676eb[_0x280b('0xc')],_0xb676eb[_0x280b('0xd')],_0xb676eb['calleridnum'],_0xb676eb[_0x280b('0xe')],_0xb676eb['lastevent']));if(_0xb676eb[_0x280b('0xf')]){utils[_0x280b('0x10')](_0xb676eb[_0x280b('0xf')])[_0x280b('0x11')](function(_0x202611){if(_0x202611){_0xb676eb[_0x280b('0x12')]=_0x202611['id'];}utils[_0x280b('0x13')](_0x280b('0x14'),_0xb676eb);});}else{utils[_0x280b('0x13')](_0x280b('0x14'),_0xb676eb);}if(channels[_0xb676eb[_0x280b('0x7')]]){delete channels[_0xb676eb[_0x280b('0x7')]];}else if(_0x1263a4&&channels[_0x1263a4]){if(!transfers[_0x280b('0x6')][_0x1263a4][_0x280b('0x15')])delete transfers[_0x280b('0x6')][_0x1263a4];delete channels[_0x1263a4];}}exports[_0x280b('0x16')]=function(_0x2a7bc7){try{utils[_0x280b('0x17')](util[_0x280b('0x18')](_0x280b('0x19'),_0x2a7bc7['uniqueid']),_0x2a7bc7);if(_0x2a7bc7[_0x280b('0x7')]==_0x2a7bc7[_0x280b('0x1a')]&&_0x2a7bc7['channel']!='OutgoingSpoolFailed'){utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x1b'),_0x2a7bc7[_0x280b('0x7')],_0x2a7bc7[_0x280b('0x1c')],_0x2a7bc7[_0x280b('0x1d')]));channels[_0x2a7bc7[_0x280b('0x7')]]={'uniqueid':_0x2a7bc7[_0x280b('0x7')],'accountcode':_0x2a7bc7['accountcode'],'source':_0x2a7bc7[_0x280b('0x1e')],'destination':_0x2a7bc7[_0x280b('0x1d')],'destinationcontext':_0x2a7bc7[_0x280b('0x1c')],'channel':_0x2a7bc7['channel'],'starttime':utils[_0x280b('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x280b('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x1109dc){utils[_0x280b('0x20')](util[_0x280b('0x18')](_0x280b('0x19'),_0x2a7bc7[_0x280b('0x7')]),_0x1109dc);}};exports['newstate']=function(_0x2d8b45){try{utils[_0x280b('0x17')](util[_0x280b('0x18')]('[%s][calls][newstate]',_0x2d8b45['uniqueid']),_0x2d8b45);if(!_[_0x280b('0x21')](channels[_0x2d8b45['uniqueid']])&&_0x2d8b45[_0x280b('0x22')]==0x6){utils[_0x280b('0x9')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2d8b45[_0x280b('0x7')],_0x2d8b45[_0x280b('0x1c')],_0x2d8b45['channel']));if(_[_0x280b('0x21')](channels[_0x2d8b45[_0x280b('0x7')]]['systemanswertime'])){channels[_0x2d8b45[_0x280b('0x7')]][_0x280b('0x23')]=utils[_0x280b('0x1f')]();}}else if(!_['isNil'](channels[_0x2d8b45[_0x280b('0x1a')]])&&_0x2d8b45[_0x280b('0x22')]==0x6&&_0x2d8b45[_0x280b('0x1c')]!=_0x280b('0x24')){utils[_0x280b('0x9')](util[_0x280b('0x18')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2d8b45[_0x280b('0x7')],_0x2d8b45[_0x280b('0x1a')],_0x2d8b45[_0x280b('0x1c')],_0x2d8b45[_0x280b('0xa')]));channels[_0x2d8b45['linkedid']][_0x280b('0xf')]=_0x2d8b45[_0x280b('0xf')];channels[_0x2d8b45[_0x280b('0x1a')]]['destinationchannel']=_0x2d8b45['channel'];if(_[_0x280b('0x21')](channels[_0x2d8b45[_0x280b('0x1a')]][_0x280b('0x25')])){channels[_0x2d8b45[_0x280b('0x1a')]][_0x280b('0x25')]=utils['now']();}channels[_0x2d8b45[_0x280b('0x1a')]][_0x280b('0x26')]=dispositions[_[_0x280b('0x27')](_0x2d8b45[_0x280b('0x22')])]||_0x280b('0x5');}}catch(_0x40e6c5){utils['error'](util[_0x280b('0x18')](_0x280b('0x28'),_0x2d8b45['uniqueid']),_0x40e6c5);}};exports[_0x280b('0x29')]=function(_0x25b7a5){try{if(!_[_0x280b('0x21')](channels[_0x25b7a5['uniqueid']])){utils[_0x280b('0x17')](util['format'](_0x280b('0x2a'),_0x25b7a5['uniqueid']),_0x25b7a5);if(_[_0x280b('0x21')](channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x2b')])){channels[_0x25b7a5[_0x280b('0x7')]]['callerid']=_0x25b7a5['calleridname']+'\x20<'+_0x25b7a5['calleridnum']+'>';}utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x2c'),_0x25b7a5[_0x280b('0x7')],channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x2b')],_0x25b7a5[_0x280b('0x2d')]));channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x2e')]=utils[_0x280b('0x1f')]();channels[_0x25b7a5['uniqueid']][_0x280b('0x2f')]=utils[_0x280b('0x30')](channels[_0x25b7a5[_0x280b('0x7')]]['endtime'],channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x31')]);channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x32')]=channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x25')]?utils[_0x280b('0x30')](channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x2e')],channels[_0x25b7a5[_0x280b('0x7')]][_0x280b('0x25')]):0x0;writeDB(channels[_0x25b7a5[_0x280b('0x7')]]);}}catch(_0x3b58f7){utils[_0x280b('0x20')](util[_0x280b('0x18')](_0x280b('0x2a'),_0x25b7a5[_0x280b('0x7')]),_0x3b58f7);}};exports[_0x280b('0x33')]=function(_0x5ad2c6){try{if(!_[_0x280b('0x21')](channels[_0x5ad2c6['localtwolinkedid']])){utils[_0x280b('0x17')](util[_0x280b('0x18')](_0x280b('0x34'),_0x5ad2c6[_0x280b('0x35')]),_0x5ad2c6);if(channels[_0x5ad2c6[_0x280b('0x36')]][_0x280b('0xa')]==_0x5ad2c6[_0x280b('0x37')]){utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x38'),_0x5ad2c6[_0x280b('0x35')],_0x5ad2c6['localtwolinkedid'],_0x5ad2c6['secondtransfererchannel']));channels[_0x5ad2c6[_0x280b('0x36')]][_0x280b('0x39')]=_0x5ad2c6[_0x280b('0x3a')];channels[_0x5ad2c6[_0x280b('0x36')]]['userfield']=_0x280b('0x3b');}else if(channels[_0x5ad2c6[_0x280b('0x36')]][_0x280b('0xa')]=_0x5ad2c6[_0x280b('0x3c')]){utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x38'),_0x5ad2c6[_0x280b('0x35')],_0x5ad2c6[_0x280b('0x36')],_0x5ad2c6[_0x280b('0x3d')]));channels[_0x5ad2c6[_0x280b('0x36')]][_0x280b('0x39')]=_0x5ad2c6['origtransfererchannel'];channels[_0x5ad2c6[_0x280b('0x36')]][_0x280b('0x3e')]='_attended';}}}catch(_0x5e5a5f){utils[_0x280b('0x20')](util[_0x280b('0x18')]('[%s][calls][attendedtransfer]',_0x5ad2c6[_0x280b('0x35')]),_0x5e5a5f);}};exports[_0x280b('0x3f')]=function(_0x4ec63e){try{if(!_['isNil'](channels[_0x4ec63e['uniqueid']])){utils[_0x280b('0x17')](util[_0x280b('0x18')]('[%s][calls][musiconholdstart]',_0x4ec63e[_0x280b('0x7')]),_0x4ec63e);channels[_0x4ec63e[_0x280b('0x7')]][_0x280b('0x40')]=utils[_0x280b('0x1f')]();utils['info'](util['format'](_0x280b('0x41'),_0x4ec63e[_0x280b('0x7')],channels[_0x4ec63e['uniqueid']][_0x280b('0x40')]));}}catch(_0xc9acb8){utils[_0x280b('0x20')](util[_0x280b('0x18')](_0x280b('0x42'),_0x4ec63e['uniqueid']),_0xc9acb8);}};exports['musiconholdstop']=function(_0x2a09e3){try{if(!_[_0x280b('0x21')](channels[_0x2a09e3[_0x280b('0x7')]])){utils[_0x280b('0x17')](util['format'](_0x280b('0x43'),_0x2a09e3[_0x280b('0x7')]),_0x2a09e3);if(!_[_0x280b('0x21')](channels[_0x2a09e3[_0x280b('0x7')]][_0x280b('0x40')])){channels[_0x2a09e3['uniqueid']][_0x280b('0x44')]+=utils[_0x280b('0x30')](utils['now'](),channels[_0x2a09e3[_0x280b('0x7')]][_0x280b('0x40')]);utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x45'),_0x2a09e3[_0x280b('0x7')],channels[_0x2a09e3[_0x280b('0x7')]]['mohtime']));delete channels[_0x2a09e3['uniqueid']][_0x280b('0x40')];}}}catch(_0x7a7c8){utils[_0x280b('0x20')](util[_0x280b('0x18')]('[%s][calls][musiconholdstop]',_0x2a09e3[_0x280b('0x7')]),_0x7a7c8);}};exports[_0x280b('0x46')]=function(_0x34dbc9){try{if(!_[_0x280b('0x21')](channels[_0x34dbc9['uniqueid']])){utils['debug'](util['format'](_0x280b('0x47'),_0x34dbc9['uniqueid']),_0x34dbc9);if(!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')][_0x280b('0x49')])){utils[_0x280b('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x34dbc9[_0x280b('0x7')],_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9[_0x280b('0x7')]][_0x280b('0x4b')]=_0x34dbc9[_0x280b('0x4a')];}if(!_[_0x280b('0x21')](_0x34dbc9['variable']['xmd-phone'])){utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x4c'),_0x34dbc9[_0x280b('0x7')],_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9['uniqueid']][_0x280b('0x4d')]=_0x34dbc9[_0x280b('0x4a')];channels[_0x34dbc9[_0x280b('0x7')]]['callerid']='\x22'+_0x34dbc9[_0x280b('0x4a')]+'\x22\x20<'+_0x34dbc9[_0x280b('0x4a')]+'>';}if(!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')][_0x280b('0x4e')])||!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')]['xmd-callerid'])){utils[_0x280b('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x34dbc9[_0x280b('0x7')],!_['isNil'](_0x34dbc9[_0x280b('0x48')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0x280b('0x4f'),_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9[_0x280b('0x7')]]['callerid']=_0x34dbc9['value'];}if(!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')][_0x280b('0x50')])||!_['isNil'](_0x34dbc9[_0x280b('0x48')]['xmcs-queue'])){utils['info'](util[_0x280b('0x18')](_0x280b('0x51'),_0x34dbc9[_0x280b('0x7')],!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')][_0x280b('0x50')])?_0x280b('0x50'):'xmcs-queue',_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9[_0x280b('0x7')]][_0x280b('0x52')]='Queue';channels[_0x34dbc9[_0x280b('0x7')]][_0x280b('0x53')]=_0x34dbc9[_0x280b('0x4a')];channels[_0x34dbc9[_0x280b('0x7')]][_0x280b('0xb')]=!![];}if(!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')][_0x280b('0x54')])){utils[_0x280b('0x9')](util['format'](_0x280b('0x55'),_0x34dbc9[_0x280b('0x7')],_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9[_0x280b('0x7')]]['ContactId']=_0x34dbc9['value'];}if(!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')][_0x280b('0x56')])){utils[_0x280b('0x9')](util[_0x280b('0x18')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x34dbc9[_0x280b('0x7')],_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9[_0x280b('0x7')]][_0x280b('0x57')]=_0x34dbc9[_0x280b('0x4a')];}if(!_['isNil'](_0x34dbc9[_0x280b('0x48')][_0x280b('0x58')])){utils[_0x280b('0x9')](util[_0x280b('0x18')](_0x280b('0x59'),_0x34dbc9[_0x280b('0x7')],_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9['uniqueid']][_0x280b('0x5a')]=_0x34dbc9['value'];}if(!_[_0x280b('0x21')](_0x34dbc9[_0x280b('0x48')]['sipcallid'])){utils['info'](util[_0x280b('0x18')](_0x280b('0x5b'),_0x34dbc9[_0x280b('0x7')],_0x34dbc9[_0x280b('0x4a')]));channels[_0x34dbc9[_0x280b('0x7')]][_0x280b('0x5c')]=_0x34dbc9[_0x280b('0x4a')];}}}catch(_0x522316){utils[_0x280b('0x20')](util[_0x280b('0x18')]('[%s][calls][varset]',_0x34dbc9[_0x280b('0x7')]),_0x522316);}};exports[_0x280b('0x5d')]=function(_0x3532fc){try{if(!_[_0x280b('0x21')](channels[_0x3532fc[_0x280b('0x7')]])){utils[_0x280b('0x17')](util['format'](_0x280b('0x5e'),_0x3532fc['uniqueid']),_0x3532fc);utils[_0x280b('0x9')](util[_0x280b('0x18')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3532fc['uniqueid'],_0x3532fc[_0x280b('0x5f')],_0x3532fc[_0x280b('0x60')]));if(_0x3532fc['application'][_0x280b('0x61')]()=='set'&&_['startsWith'](_0x3532fc[_0x280b('0x60')][_0x280b('0x61')](),'cdr')){var _0x1ff74b=_0x3532fc[_0x280b('0x60')][_0x280b('0x62')]('=');var _0x12d91f=_0x1ff74b[0x0][_0x280b('0x63')](_0x1ff74b[0x0]['lastIndexOf']('(')+0x1,_0x1ff74b[0x0][_0x280b('0x64')](')'));var _0x12062e=_0x1ff74b[0x1];channels[_0x3532fc[_0x280b('0x7')]][_0x12d91f]=_0x12062e;}if(!_[_0x280b('0x65')]([_0x280b('0x29'),_0x280b('0x66'),'execif','set','gotoif'],_0x3532fc[_0x280b('0x5f')]['toLowerCase']())){channels[_0x3532fc[_0x280b('0x7')]][_0x280b('0x52')]=_0x3532fc['application'];channels[_0x3532fc[_0x280b('0x7')]][_0x280b('0x53')]=_0x3532fc['appdata'];}}}catch(_0x11b3db){utils[_0x280b('0x20')](util[_0x280b('0x18')]('[%s][calls][newexten]',_0x3532fc[_0x280b('0x7')]),_0x11b3db);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1e7ab9e..b9cb179 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 _0xa757=['[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted'];(function(_0x367c17,_0x2eded5){var _0x3a66a5=function(_0x4f68d9){while(--_0x4f68d9){_0x367c17['push'](_0x367c17['shift']());}};_0x3a66a5(++_0x2eded5);}(_0xa757,0x179));var _0x7a75=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa757[_0x618414];return _0x21c19a;};'use strict';var utils=require(_0x7a75('0x0'));exports[_0x7a75('0x1')]=function(){utils['info'](_0x7a75('0x2'));};exports[_0x7a75('0x3')]=function(){utils[_0x7a75('0x4')](_0x7a75('0x5'));};exports[_0x7a75('0x6')]=function(){utils[_0x7a75('0x4')](_0x7a75('0x7'));};exports[_0x7a75('0x8')]=function(_0x541183){utils[_0x7a75('0x8')](_0x7a75('0x9'),_0x541183);};exports[_0x7a75('0xa')]=function(){utils['info']('[core]\x20close');};exports[_0x7a75('0xb')]=function(_0xbbe3e){}; \ No newline at end of file +var _0xdcd8=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x560dc5,_0x41db76){var _0x40aedf=function(_0x586ce7){while(--_0x586ce7){_0x560dc5['push'](_0x560dc5['shift']());}};_0x40aedf(++_0x41db76);}(_0xdcd8,0x122));var _0x8dcd=function(_0x4540f0,_0xe6dd95){_0x4540f0=_0x4540f0-0x0;var _0x52d1e6=_0xdcd8[_0x4540f0];return _0x52d1e6;};'use strict';var utils=require(_0x8dcd('0x0'));exports[_0x8dcd('0x1')]=function(){utils[_0x8dcd('0x2')](_0x8dcd('0x3'));};exports['shutdown']=function(){utils[_0x8dcd('0x2')](_0x8dcd('0x4'));};exports[_0x8dcd('0x5')]=function(){utils['info'](_0x8dcd('0x6'));};exports[_0x8dcd('0x7')]=function(_0x11c71a){utils[_0x8dcd('0x7')](_0x8dcd('0x8'),_0x11c71a);};exports[_0x8dcd('0x9')]=function(){utils[_0x8dcd('0x2')](_0x8dcd('0xa'));};exports[_0x8dcd('0xb')]=function(_0x4ed1d3){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fc9c34a..6b93e97 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 _0x875a=['calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring'];(function(_0x347884,_0xd8ef37){var _0x2cd3fa=function(_0xbeb1b8){while(--_0xbeb1b8){_0x347884['push'](_0x347884['shift']());}};_0x2cd3fa(++_0xd8ef37);}(_0x875a,0x178));var _0xa875=function(_0x3bf85f,_0x143280){_0x3bf85f=_0x3bf85f-0x0;var _0x1ff400=_0x875a[_0x3bf85f];return _0x1ff400;};'use strict';var _=require(_0xa875('0x0'));var util=require(_0xa875('0x1'));var utils=require(_0xa875('0x2'));var dials={};function writeDB(_0x3a3bc0){utils[_0xa875('0x3')](util[_0xa875('0x4')](_0xa875('0x5'),_0x3a3bc0[_0xa875('0x6')],_0x3a3bc0[_0xa875('0x7')],_0x3a3bc0[_0xa875('0x8')],_0x3a3bc0[_0xa875('0x9')],_0x3a3bc0[_0xa875('0xa')],_0x3a3bc0[_0xa875('0xb')]));utils[_0xa875('0xc')](_0xa875('0xd'),_0x3a3bc0);delete dials[_0x3a3bc0[_0xa875('0x6')]];}exports[_0xa875('0xe')]=function(_0x7bc861){try{utils[_0xa875('0xf')](util['format']('[%s][dials][newexten]',_0x7bc861['uniqueid']),_0x7bc861);utils[_0xa875('0x3')](util[_0xa875('0x4')](_0xa875('0x10'),_0x7bc861['uniqueid'],_0x7bc861[_0xa875('0x11')],_0x7bc861[_0xa875('0x12')]));if(_0x7bc861[_0xa875('0x11')][_0xa875('0x13')]()=='set'&&_[_0xa875('0x14')](_0x7bc861['appdata']['toLowerCase'](),_0xa875('0x15'))){var _0x33ccff=_0x7bc861['appdata'][_0xa875('0x16')]('=');dials[_0x7bc861['uniqueid']]={'routeId':_0x33ccff[0x1]};}}catch(_0x4455ba){utils['error'](util['format'](_0xa875('0x17'),_0x7bc861['uniqueid']),_0x4455ba);}};exports[_0xa875('0x18')]=function(_0x128239){try{utils[_0xa875('0xf')](util['format'](_0xa875('0x19'),_0x128239['uniqueid']),_0x128239);if(!_[_0xa875('0x1a')](_0x128239[_0xa875('0x1b')]['outboundrouteid'])){utils[_0xa875('0x3')](util[_0xa875('0x4')](_0xa875('0x1c'),_0x128239[_0xa875('0x6')],_0x128239[_0xa875('0x1d')]));dials[_0x128239[_0xa875('0x6')]]={'routeId':_0x128239[_0xa875('0x1d')]};}}catch(_0x1ecd06){utils['error'](util[_0xa875('0x4')]('[%s][dials][varset]',_0x128239['uniqueid']),_0x1ecd06);}};exports[_0xa875('0x1e')]=function(_0x5961cc){try{if(!_[_0xa875('0x1a')](dials[_0x5961cc[_0xa875('0x6')]])){utils['debug'](util[_0xa875('0x4')]('[%s][dials][dialbegin]',_0x5961cc[_0xa875('0x6')]),_0x5961cc);dials[_0x5961cc[_0xa875('0x6')]]=_['assign'](dials[_0x5961cc[_0xa875('0x6')]],_0x5961cc);dials[_0x5961cc[_0xa875('0x6')]][_0xa875('0x1f')]=utils[_0xa875('0x20')]();dials[_0x5961cc[_0xa875('0x6')]][_0xa875('0x21')]=_0xa875('0x22');utils['info'](util['format'](_0xa875('0x23'),_0x5961cc[_0xa875('0x6')],dials[_0x5961cc[_0xa875('0x6')]][_0xa875('0x1f')]));}}catch(_0x15f372){utils[_0xa875('0x24')](util[_0xa875('0x4')](_0xa875('0x25'),_0x5961cc[_0xa875('0x6')]),_0x15f372);}};exports[_0xa875('0x26')]=function(_0x22fedb){try{if(!_['isNil'](dials[_0x22fedb[_0xa875('0x6')]])){utils[_0xa875('0xf')](util[_0xa875('0x4')](_0xa875('0x27'),_0x22fedb[_0xa875('0x6')]),_0x22fedb);dials[_0x22fedb[_0xa875('0x6')]][_0xa875('0xb')]=_0x22fedb[_0xa875('0xb')];if(_0x22fedb[_0xa875('0xb')]==_0xa875('0x28')){dials[_0x22fedb[_0xa875('0x6')]]=_[_0xa875('0x29')](dials[_0x22fedb['uniqueid']],_0x22fedb);dials[_0x22fedb[_0xa875('0x6')]][_0xa875('0x2a')]=utils[_0xa875('0x20')]();dials[_0x22fedb[_0xa875('0x6')]]['lastevent']=_0xa875('0x2b');utils[_0xa875('0x3')](util[_0xa875('0x4')](_0xa875('0x2c'),_0x22fedb[_0xa875('0x6')],_0x22fedb[_0xa875('0xb')],dials[_0x22fedb[_0xa875('0x6')]]['answertime']));}else{utils['info'](util[_0xa875('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x22fedb['uniqueid'],_0x22fedb['dialstatus']));}}}catch(_0x179133){utils['error'](util[_0xa875('0x4')](_0xa875('0x27'),_0x22fedb[_0xa875('0x6')]),_0x179133);}};exports[_0xa875('0x2d')]=function(_0x458307){try{if(!_[_0xa875('0x1a')](dials[_0x458307['uniqueid']])){utils[_0xa875('0xf')](util['format'](_0xa875('0x2e'),_0x458307[_0xa875('0x6')]),_0x458307);utils[_0xa875('0x3')](util[_0xa875('0x4')](_0xa875('0x2f'),_0x458307[_0xa875('0x6')],_0x458307[_0xa875('0x9')],_0x458307[_0xa875('0x30')],_0x458307['cause-txt']));dials[_0x458307[_0xa875('0x6')]]=_[_0xa875('0x29')](dials[_0x458307[_0xa875('0x6')]],{'endtime':utils[_0xa875('0x20')](),'lastevent':_0xa875('0x31')});dials[_0x458307['uniqueid']][_0xa875('0x32')]=utils[_0xa875('0x33')](dials[_0x458307[_0xa875('0x6')]][_0xa875('0x34')],dials[_0x458307['uniqueid']][_0xa875('0x1f')]);dials[_0x458307[_0xa875('0x6')]][_0xa875('0x35')]=utils[_0xa875('0x33')](dials[_0x458307[_0xa875('0x6')]][_0xa875('0x2a')]||dials[_0x458307[_0xa875('0x6')]][_0xa875('0x34')],dials[_0x458307[_0xa875('0x6')]][_0xa875('0x1f')]);dials[_0x458307[_0xa875('0x6')]][_0xa875('0x36')]=dials[_0x458307[_0xa875('0x6')]]['answertime']?utils[_0xa875('0x33')](dials[_0x458307[_0xa875('0x6')]][_0xa875('0x34')],dials[_0x458307[_0xa875('0x6')]]['answertime']):0x0;writeDB(dials[_0x458307[_0xa875('0x6')]]);}}catch(_0x29b80d){utils['error'](util['format'](_0xa875('0x2e'),_0x458307[_0xa875('0x6')]),_0x29b80d);}}; \ No newline at end of file +var _0xdb4d=['uniqueid','channel','dialstring','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridnum','calleridname','complete','duration','endtime','holdtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xdb4d,0x14b));var _0xddb4=function(_0x3f647e,_0x456176){_0x3f647e=_0x3f647e-0x0;var _0xcc8ba0=_0xdb4d[_0x3f647e];return _0xcc8ba0;};'use strict';var _=require(_0xddb4('0x0'));var util=require('util');var utils=require(_0xddb4('0x1'));var dials={};function writeDB(_0x57418c){utils[_0xddb4('0x2')](util[_0xddb4('0x3')](_0xddb4('0x4'),_0x57418c[_0xddb4('0x5')],_0x57418c[_0xddb4('0x6')],_0x57418c[_0xddb4('0x7')],_0x57418c['calleridnum'],_0x57418c['connectedlinenum'],_0x57418c['dialstatus']));utils['request'](_0xddb4('0x8'),_0x57418c);delete dials[_0x57418c[_0xddb4('0x5')]];}exports[_0xddb4('0x9')]=function(_0x2f5da6){try{utils[_0xddb4('0xa')](util[_0xddb4('0x3')](_0xddb4('0xb'),_0x2f5da6[_0xddb4('0x5')]),_0x2f5da6);utils['info'](util[_0xddb4('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2f5da6[_0xddb4('0x5')],_0x2f5da6['application'],_0x2f5da6[_0xddb4('0xc')]));if(_0x2f5da6[_0xddb4('0xd')][_0xddb4('0xe')]()==_0xddb4('0xf')&&_[_0xddb4('0x10')](_0x2f5da6[_0xddb4('0xc')][_0xddb4('0xe')](),_0xddb4('0x11'))){var _0x372a90=_0x2f5da6['appdata']['split']('=');dials[_0x2f5da6[_0xddb4('0x5')]]={'routeId':_0x372a90[0x1]};}}catch(_0x1495ad){utils['error'](util[_0xddb4('0x3')]('[%s][dials][newexten]',_0x2f5da6[_0xddb4('0x5')]),_0x1495ad);}};exports[_0xddb4('0x12')]=function(_0x300247){try{utils[_0xddb4('0xa')](util[_0xddb4('0x3')](_0xddb4('0x13'),_0x300247[_0xddb4('0x5')]),_0x300247);if(!_['isNil'](_0x300247[_0xddb4('0x14')][_0xddb4('0x15')])){utils[_0xddb4('0x2')](util[_0xddb4('0x3')](_0xddb4('0x16'),_0x300247[_0xddb4('0x5')],_0x300247[_0xddb4('0x17')]));dials[_0x300247[_0xddb4('0x5')]]={'routeId':_0x300247['value']};}}catch(_0x1d6e2a){utils[_0xddb4('0x18')](util[_0xddb4('0x3')](_0xddb4('0x13'),_0x300247[_0xddb4('0x5')]),_0x1d6e2a);}};exports[_0xddb4('0x19')]=function(_0x42ac3c){try{if(!_[_0xddb4('0x1a')](dials[_0x42ac3c['uniqueid']])){utils[_0xddb4('0xa')](util[_0xddb4('0x3')](_0xddb4('0x1b'),_0x42ac3c[_0xddb4('0x5')]),_0x42ac3c);dials[_0x42ac3c['uniqueid']]=_['assign'](dials[_0x42ac3c[_0xddb4('0x5')]],_0x42ac3c);dials[_0x42ac3c[_0xddb4('0x5')]][_0xddb4('0x1c')]=utils[_0xddb4('0x1d')]();dials[_0x42ac3c['uniqueid']][_0xddb4('0x1e')]='called';utils[_0xddb4('0x2')](util['format'](_0xddb4('0x1f'),_0x42ac3c[_0xddb4('0x5')],dials[_0x42ac3c[_0xddb4('0x5')]][_0xddb4('0x1c')]));}}catch(_0x5f1e11){utils[_0xddb4('0x18')](util[_0xddb4('0x3')]('[%s][dials][dialbegin]',_0x42ac3c['uniqueid']),_0x5f1e11);}};exports[_0xddb4('0x20')]=function(_0x3ab722){try{if(!_['isNil'](dials[_0x3ab722['uniqueid']])){utils['debug'](util[_0xddb4('0x3')](_0xddb4('0x21'),_0x3ab722[_0xddb4('0x5')]),_0x3ab722);dials[_0x3ab722[_0xddb4('0x5')]]['dialstatus']=_0x3ab722[_0xddb4('0x22')];if(_0x3ab722[_0xddb4('0x22')]==_0xddb4('0x23')){dials[_0x3ab722[_0xddb4('0x5')]]=_[_0xddb4('0x24')](dials[_0x3ab722['uniqueid']],_0x3ab722);dials[_0x3ab722[_0xddb4('0x5')]][_0xddb4('0x25')]=utils[_0xddb4('0x1d')]();dials[_0x3ab722[_0xddb4('0x5')]][_0xddb4('0x1e')]=_0xddb4('0x26');utils[_0xddb4('0x2')](util[_0xddb4('0x3')](_0xddb4('0x27'),_0x3ab722[_0xddb4('0x5')],_0x3ab722['dialstatus'],dials[_0x3ab722[_0xddb4('0x5')]][_0xddb4('0x25')]));}else{utils[_0xddb4('0x2')](util[_0xddb4('0x3')](_0xddb4('0x28'),_0x3ab722['uniqueid'],_0x3ab722[_0xddb4('0x22')]));}}}catch(_0xc9f01e){utils[_0xddb4('0x18')](util['format'](_0xddb4('0x21'),_0x3ab722[_0xddb4('0x5')]),_0xc9f01e);}};exports[_0xddb4('0x29')]=function(_0x33591c){try{if(!_[_0xddb4('0x1a')](dials[_0x33591c[_0xddb4('0x5')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x33591c['uniqueid']),_0x33591c);utils['info'](util[_0xddb4('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x33591c[_0xddb4('0x5')],_0x33591c[_0xddb4('0x2a')],_0x33591c[_0xddb4('0x2b')],_0x33591c['cause-txt']));dials[_0x33591c[_0xddb4('0x5')]]=_[_0xddb4('0x24')](dials[_0x33591c[_0xddb4('0x5')]],{'endtime':utils[_0xddb4('0x1d')](),'lastevent':_0xddb4('0x2c')});dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x2d')]=utils['diffTime'](dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x2e')],dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x1c')]);dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x2f')]=utils['diffTime'](dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x25')]||dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x2e')],dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x1c')]);dials[_0x33591c[_0xddb4('0x5')]]['billableseconds']=dials[_0x33591c[_0xddb4('0x5')]]['answertime']?utils['diffTime'](dials[_0x33591c[_0xddb4('0x5')]]['endtime'],dials[_0x33591c[_0xddb4('0x5')]][_0xddb4('0x25')]):0x0;writeDB(dials[_0x33591c[_0xddb4('0x5')]]);}}catch(_0x39bceb){utils[_0xddb4('0x18')](util[_0xddb4('0x3')]('[%s][dials][hangup]',_0x33591c['uniqueid']),_0x39bceb);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bbee2d6..01419f6 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 _0xce4c=['env','production','asterisk','port','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled'];(function(_0x1ec11a,_0x1024c1){var _0x724293=function(_0x7000a8){while(--_0x7000a8){_0x1ec11a['push'](_0x1ec11a['shift']());}};_0x724293(++_0x1024c1);}(_0xce4c,0x83));var _0xcce4=function(_0x198b05,_0x141c13){_0x198b05=_0x198b05-0x0;var _0x56f07d=_0xce4c[_0x198b05];return _0x56f07d;};var AsteriskManager=require(_0xcce4('0x0'));var config=require('../../config/environment');var utils=require(_0xcce4('0x1'));var util=require(_0xcce4('0x2'));var isXDREnabled=config[_0xcce4('0x3')]&&config[_0xcce4('0x3')][_0xcce4('0x4')]?!config[_0xcce4('0x3')][_0xcce4('0x4')]:!![];var isProduction=config[_0xcce4('0x5')]===_0xcce4('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0xcce4('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xcce4('0x7')][_0xcce4('0x8')],config['asterisk']['ip'],config['asterisk'][_0xcce4('0x9')],config[_0xcce4('0x7')][_0xcce4('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0xcce4('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xcce4('0xc')](_0xcce4('0xd'));}else{var agents=require(_0xcce4('0xe'));var calls=require('./calls.controller');var queues=require(_0xcce4('0xf'));var recordings=require(_0xcce4('0x10'));var members=require('./members.controller');var dials=require(_0xcce4('0x11'));var transfers=require(_0xcce4('0x12'));var core=require(_0xcce4('0x13'));ami['on']('connect',core[_0xcce4('0x14')]);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0xcce4('0x15')]);ami['on'](_0xcce4('0x16'),core[_0xcce4('0x16')]);ami['on'](_0xcce4('0x17'),core['close']);ami['on']('managerevent',core[_0xcce4('0x18')]);ami['on'](_0xcce4('0x19'),function(_0x22e688){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x1c'),_0x22e688['device']),_0x22e688);members[_0xcce4('0x19')](_0x22e688);}catch(_0x36f74d){utils['error'](util[_0xcce4('0x1b')](_0xcce4('0x1c'),_0x22e688['device']),_0x36f74d);}});ami['on'](_0xcce4('0x1d'),function(_0x1e3dcb){try{utils[_0xcce4('0x1a')](util['format'](_0xcce4('0x1e'),_0x1e3dcb[_0xcce4('0x1f')]),_0x1e3dcb);agents[_0xcce4('0x1d')](_0x1e3dcb);}catch(_0x3345a7){utils[_0xcce4('0x16')](util['format'](_0xcce4('0x1e'),_0x1e3dcb['uniqueid']),_0x3345a7);}});ami['on']('agentringnoanswer',function(_0x36834b){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x20'),_0x36834b[_0xcce4('0x1f')]),_0x36834b);agents[_0xcce4('0x21')](_0x36834b);}catch(_0x1632ea){utils[_0xcce4('0x16')](util['format'](_0xcce4('0x20'),_0x36834b[_0xcce4('0x1f')]),_0x1632ea);}});ami['on']('agentconnect',function(_0x160f6b){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')]('[%s][index][agentconnect]',_0x160f6b['uniqueid']),_0x160f6b);agents[_0xcce4('0x22')](_0x160f6b);queues[_0xcce4('0x22')](_0x160f6b);}catch(_0x4c9263){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x23'),_0x160f6b[_0xcce4('0x1f')]),_0x4c9263);}});ami['on'](_0xcce4('0x24'),function(_0x48e976){try{utils['debug'](util[_0xcce4('0x1b')](_0xcce4('0x25'),_0x48e976[_0xcce4('0x1f')]),_0x48e976);agents[_0xcce4('0x24')](_0x48e976);queues[_0xcce4('0x24')](_0x48e976);members[_0xcce4('0x24')](_0x48e976);}catch(_0x59fa31){utils['error'](util['format'](_0xcce4('0x25'),_0x48e976['uniqueid']),_0x59fa31);}});ami['on'](_0xcce4('0x26'),function(_0x59c775){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')]('[%s][index][queuecallerabandon]',_0x59c775[_0xcce4('0x1f')]),_0x59c775);agents[_0xcce4('0x26')](_0x59c775);queues[_0xcce4('0x26')](_0x59c775);}catch(_0x38a8e2){utils[_0xcce4('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x59c775[_0xcce4('0x1f')]),_0x38a8e2);}});ami['on']('queuecallerjoin',function(_0x4c3afa){try{utils[_0xcce4('0x1a')](util['format']('[%s][index][queuecallerjoin]',_0x4c3afa[_0xcce4('0x1f')]),_0x4c3afa);queues['queuecallerjoin'](_0x4c3afa);recordings[_0xcce4('0x27')](_0x4c3afa);}catch(_0x7cad4c){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x28'),_0x4c3afa[_0xcce4('0x1f')]),_0x7cad4c);}});ami['on']('queuecallerleave',function(_0x384ee0){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x29'),_0x384ee0[_0xcce4('0x1f')]),_0x384ee0);queues[_0xcce4('0x2a')](_0x384ee0);}catch(_0x41cdf2){utils[_0xcce4('0x16')](util['format'](_0xcce4('0x29'),_0x384ee0[_0xcce4('0x1f')]),_0x41cdf2);}});ami['on'](_0xcce4('0x2b'),function(_0x905d98){try{utils['debug'](util['format'](_0xcce4('0x2c'),_0x905d98['uniqueid']),_0x905d98);queues[_0xcce4('0x2b')](_0x905d98);calls[_0xcce4('0x2b')](_0x905d98);}catch(_0x1545ac){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x2c'),_0x905d98[_0xcce4('0x1f')]),_0x1545ac);}});ami['on'](_0xcce4('0x2d'),function(_0x35ebc3){try{utils['debug'](util[_0xcce4('0x1b')](_0xcce4('0x2e'),_0x35ebc3[_0xcce4('0x1f')]),_0x35ebc3);queues[_0xcce4('0x2d')](_0x35ebc3);calls['musiconholdstop'](_0x35ebc3);}catch(_0x572e22){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x35ebc3['uniqueid']),_0x572e22);}});ami['on'](_0xcce4('0x2f'),function(_0x20094e){try{utils['debug'](util['format']('[%s][index][newstate]',_0x20094e[_0xcce4('0x1f')]),_0x20094e);calls[_0xcce4('0x2f')](_0x20094e);recordings['newstate'](_0x20094e);}catch(_0x24d949){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x30'),_0x20094e[_0xcce4('0x1f')]),_0x24d949);}});ami['on'](_0xcce4('0x31'),function(_0x5bf37e){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x32'),_0x5bf37e[_0xcce4('0x1f')]),_0x5bf37e);calls['hangup'](_0x5bf37e);recordings[_0xcce4('0x31')](_0x5bf37e);dials[_0xcce4('0x31')](_0x5bf37e);agents['hangup'](_0x5bf37e);queues[_0xcce4('0x31')](_0x5bf37e);}catch(_0x593e38){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x32'),_0x5bf37e[_0xcce4('0x1f')]),_0x593e38);}});ami['on'](_0xcce4('0x33'),function(_0x32fbd5){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x34'),_0x32fbd5[_0xcce4('0x1f')]),_0x32fbd5);members[_0xcce4('0x33')](_0x32fbd5);}catch(_0x10f7d8){utils['error'](util['format'](_0xcce4('0x34'),_0x32fbd5[_0xcce4('0x1f')]),_0x10f7d8);}});ami['on'](_0xcce4('0x35'),function(_0x4705f6){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x36'),_0x4705f6[_0xcce4('0x1f')]),_0x4705f6);queues[_0xcce4('0x35')](_0x4705f6);agents[_0xcce4('0x35')](_0x4705f6);transfers[_0xcce4('0x35')](_0x4705f6);recordings[_0xcce4('0x35')](_0x4705f6);}catch(_0x5a9b2e){utils['error'](util['format'](_0xcce4('0x36'),_0x4705f6['uniqueid']),_0x5a9b2e);}});ami['on'](_0xcce4('0x37'),function(_0x314a5d){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x38'),_0x314a5d[_0xcce4('0x39')]),_0x314a5d);queues[_0xcce4('0x37')](_0x314a5d);transfers['attendedtransfer'](_0x314a5d);agents[_0xcce4('0x37')](_0x314a5d);calls[_0xcce4('0x37')](_0x314a5d);}catch(_0x4526cc){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')]('[%s][index][attendedtransfer]',_0x314a5d['origtransfereruniqueid']),_0x4526cc);}});ami['on'](_0xcce4('0x3a'),function(_0x17355a){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x3b'),_0x17355a['uniqueid']),_0x17355a);queues['varset'](_0x17355a);recordings[_0xcce4('0x3a')](_0x17355a);calls['varset'](_0x17355a);dials[_0xcce4('0x3a')](_0x17355a);}catch(_0x3b563d){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x3b'),_0x17355a[_0xcce4('0x1f')]),_0x3b563d);}});ami['on'](_0xcce4('0x3c'),function(_0x245df0){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x3d'),_0x245df0['uniqueid']),_0x245df0);calls['newexten'](_0x245df0);recordings[_0xcce4('0x3c')](_0x245df0);dials[_0xcce4('0x3c')](_0x245df0);}catch(_0x4dbd9e){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x3d'),_0x245df0[_0xcce4('0x1f')]),_0x4dbd9e);}});ami['on']('newchannel',function(_0x1fa0ec){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x3e'),_0x1fa0ec['uniqueid']),_0x1fa0ec);calls['newchannel'](_0x1fa0ec);recordings['newchannel'](_0x1fa0ec);}catch(_0x2ecce0){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x3e'),_0x1fa0ec[_0xcce4('0x1f')]),_0x2ecce0);}});ami['on'](_0xcce4('0x3f'),function(_0x211ae9){try{utils['debug'](util[_0xcce4('0x1b')](_0xcce4('0x40'),_0x211ae9[_0xcce4('0x1f')]),_0x211ae9);dials[_0xcce4('0x3f')](_0x211ae9);}catch(_0x4d56cb){utils[_0xcce4('0x16')](util['format'](_0xcce4('0x41'),_0x211ae9[_0xcce4('0x1f')]),_0x4d56cb);}});ami['on'](_0xcce4('0x42'),function(_0x2f3d8f){try{utils[_0xcce4('0x1a')](util[_0xcce4('0x1b')](_0xcce4('0x43'),_0x2f3d8f[_0xcce4('0x1f')]),_0x2f3d8f);dials[_0xcce4('0x42')](_0x2f3d8f);}catch(_0x2f3da3){utils[_0xcce4('0x16')](util[_0xcce4('0x1b')](_0xcce4('0x43'),_0x2f3d8f[_0xcce4('0x1f')]),_0x2f3da3);}});} \ No newline at end of file +var _0xdb77=['disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','device','error','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr'];(function(_0x4233aa,_0x4e707c){var _0xf4bdaf=function(_0x1c6456){while(--_0x1c6456){_0x4233aa['push'](_0x4233aa['shift']());}};_0xf4bdaf(++_0x4e707c);}(_0xdb77,0x1b3));var _0x7db7=function(_0x3778bc,_0x4dd190){_0x3778bc=_0x3778bc-0x0;var _0xf242f4=_0xdb77[_0x3778bc];return _0xf242f4;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x7db7('0x0'));var util=require(_0x7db7('0x1'));var isXDREnabled=config[_0x7db7('0x2')]&&config[_0x7db7('0x2')][_0x7db7('0x3')]?!config[_0x7db7('0x2')][_0x7db7('0x3')]:!![];var isProduction=config[_0x7db7('0x4')]===_0x7db7('0x5')||![];var isLocalAsterisk=config[_0x7db7('0x2')]&&config[_0x7db7('0x2')][_0x7db7('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x7db7('0x7')][_0x7db7('0x8')],config[_0x7db7('0x7')]['ip'],config[_0x7db7('0x7')][_0x7db7('0x9')],config[_0x7db7('0x7')][_0x7db7('0xa')],!![]);ami[_0x7db7('0xb')]();if(!isXDREnabled){utils[_0x7db7('0xc')](_0x7db7('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7db7('0xc')](_0x7db7('0xe'));}else{var agents=require(_0x7db7('0xf'));var calls=require(_0x7db7('0x10'));var queues=require(_0x7db7('0x11'));var recordings=require(_0x7db7('0x12'));var members=require(_0x7db7('0x13'));var dials=require(_0x7db7('0x14'));var transfers=require(_0x7db7('0x15'));var core=require(_0x7db7('0x16'));ami['on'](_0x7db7('0x17'),core[_0x7db7('0x17')]);ami['on'](_0x7db7('0x18'),core[_0x7db7('0x18')]);ami['on']('fullybooted',core[_0x7db7('0x19')]);ami['on']('error',core['error']);ami['on'](_0x7db7('0x1a'),core[_0x7db7('0x1a')]);ami['on'](_0x7db7('0x1b'),core[_0x7db7('0x1b')]);ami['on'](_0x7db7('0x1c'),function(_0xdb1edc){try{utils[_0x7db7('0x1d')](util['format']('[%s][index][devicestatechange]',_0xdb1edc[_0x7db7('0x1e')]),_0xdb1edc);members['devicestatechange'](_0xdb1edc);}catch(_0x2b528e){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x21'),_0xdb1edc[_0x7db7('0x1e')]),_0x2b528e);}});ami['on'](_0x7db7('0x22'),function(_0x23f4c0){try{utils['debug'](util[_0x7db7('0x20')](_0x7db7('0x23'),_0x23f4c0['uniqueid']),_0x23f4c0);agents['agentcalled'](_0x23f4c0);}catch(_0x55fb0c){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')]('[%s][index][agentcalled]',_0x23f4c0[_0x7db7('0x24')]),_0x55fb0c);}});ami['on'](_0x7db7('0x25'),function(_0x521645){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x26'),_0x521645['uniqueid']),_0x521645);agents[_0x7db7('0x25')](_0x521645);}catch(_0x2caba0){utils['error'](util[_0x7db7('0x20')](_0x7db7('0x26'),_0x521645['uniqueid']),_0x2caba0);}});ami['on'](_0x7db7('0x27'),function(_0xe62b1b){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x28'),_0xe62b1b[_0x7db7('0x24')]),_0xe62b1b);agents[_0x7db7('0x27')](_0xe62b1b);queues['agentconnect'](_0xe62b1b);}catch(_0x3916f8){utils['error'](util[_0x7db7('0x20')](_0x7db7('0x28'),_0xe62b1b['uniqueid']),_0x3916f8);}});ami['on'](_0x7db7('0x29'),function(_0x1b98ba){try{utils[_0x7db7('0x1d')](util['format'](_0x7db7('0x2a'),_0x1b98ba[_0x7db7('0x24')]),_0x1b98ba);agents[_0x7db7('0x29')](_0x1b98ba);queues[_0x7db7('0x29')](_0x1b98ba);members['agentcomplete'](_0x1b98ba);}catch(_0x4e92ef){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x2a'),_0x1b98ba[_0x7db7('0x24')]),_0x4e92ef);}});ami['on'](_0x7db7('0x2b'),function(_0x51a93c){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x2c'),_0x51a93c[_0x7db7('0x24')]),_0x51a93c);agents[_0x7db7('0x2b')](_0x51a93c);queues[_0x7db7('0x2b')](_0x51a93c);}catch(_0x13165e){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x2c'),_0x51a93c[_0x7db7('0x24')]),_0x13165e);}});ami['on'](_0x7db7('0x2d'),function(_0x4952df){try{utils[_0x7db7('0x1d')](util['format'](_0x7db7('0x2e'),_0x4952df['uniqueid']),_0x4952df);queues[_0x7db7('0x2d')](_0x4952df);recordings['queuecallerjoin'](_0x4952df);}catch(_0x2c1e69){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x2e'),_0x4952df[_0x7db7('0x24')]),_0x2c1e69);}});ami['on']('queuecallerleave',function(_0x4acdb2){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')]('[%s][index][queuecallerleave]',_0x4acdb2[_0x7db7('0x24')]),_0x4acdb2);queues[_0x7db7('0x2f')](_0x4acdb2);}catch(_0x5421e6){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x30'),_0x4acdb2['uniqueid']),_0x5421e6);}});ami['on']('musiconholdstart',function(_0x635d58){try{utils['debug'](util['format'](_0x7db7('0x31'),_0x635d58['uniqueid']),_0x635d58);queues['musiconholdstart'](_0x635d58);calls[_0x7db7('0x32')](_0x635d58);}catch(_0xbe2240){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x31'),_0x635d58['uniqueid']),_0xbe2240);}});ami['on'](_0x7db7('0x33'),function(_0xfa1f68){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x34'),_0xfa1f68[_0x7db7('0x24')]),_0xfa1f68);queues['musiconholdstop'](_0xfa1f68);calls[_0x7db7('0x33')](_0xfa1f68);}catch(_0x8caa73){utils['error'](util[_0x7db7('0x20')]('[%s][index][musiconholdstop]',_0xfa1f68[_0x7db7('0x24')]),_0x8caa73);}});ami['on']('newstate',function(_0x5989d9){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x35'),_0x5989d9[_0x7db7('0x24')]),_0x5989d9);calls[_0x7db7('0x36')](_0x5989d9);recordings[_0x7db7('0x36')](_0x5989d9);}catch(_0x144835){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')]('[%s][index][newstate]',_0x5989d9['uniqueid']),_0x144835);}});ami['on'](_0x7db7('0x37'),function(_0x13d515){try{utils[_0x7db7('0x1d')](util['format'](_0x7db7('0x38'),_0x13d515[_0x7db7('0x24')]),_0x13d515);calls['hangup'](_0x13d515);recordings[_0x7db7('0x37')](_0x13d515);dials[_0x7db7('0x37')](_0x13d515);agents[_0x7db7('0x37')](_0x13d515);queues['hangup'](_0x13d515);}catch(_0x2e58fe){utils[_0x7db7('0x1f')](util['format'](_0x7db7('0x38'),_0x13d515[_0x7db7('0x24')]),_0x2e58fe);}});ami['on']('cdr',function(_0x2e04c7){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x39'),_0x2e04c7['uniqueid']),_0x2e04c7);members['cdr'](_0x2e04c7);}catch(_0x338ab7){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')]('[%s][index][cdr]',_0x2e04c7[_0x7db7('0x24')]),_0x338ab7);}});ami['on'](_0x7db7('0x3a'),function(_0x4ed0f2){try{utils[_0x7db7('0x1d')](util['format'](_0x7db7('0x3b'),_0x4ed0f2[_0x7db7('0x24')]),_0x4ed0f2);queues[_0x7db7('0x3a')](_0x4ed0f2);agents[_0x7db7('0x3a')](_0x4ed0f2);transfers[_0x7db7('0x3a')](_0x4ed0f2);recordings[_0x7db7('0x3a')](_0x4ed0f2);}catch(_0x2b7b5e){utils['error'](util[_0x7db7('0x20')](_0x7db7('0x3b'),_0x4ed0f2['uniqueid']),_0x2b7b5e);}});ami['on'](_0x7db7('0x3c'),function(_0x4880ca){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x3d'),_0x4880ca[_0x7db7('0x3e')]),_0x4880ca);queues[_0x7db7('0x3c')](_0x4880ca);transfers[_0x7db7('0x3c')](_0x4880ca);agents[_0x7db7('0x3c')](_0x4880ca);calls[_0x7db7('0x3c')](_0x4880ca);}catch(_0x40e354){utils['error'](util['format'](_0x7db7('0x3d'),_0x4880ca[_0x7db7('0x3e')]),_0x40e354);}});ami['on'](_0x7db7('0x3f'),function(_0x542295){try{utils[_0x7db7('0x1d')](util['format'](_0x7db7('0x40'),_0x542295[_0x7db7('0x24')]),_0x542295);queues[_0x7db7('0x3f')](_0x542295);recordings[_0x7db7('0x3f')](_0x542295);calls[_0x7db7('0x3f')](_0x542295);dials[_0x7db7('0x3f')](_0x542295);}catch(_0x1d8ed8){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x40'),_0x542295[_0x7db7('0x24')]),_0x1d8ed8);}});ami['on'](_0x7db7('0x41'),function(_0x564446){try{utils['debug'](util[_0x7db7('0x20')]('[%s][index][newexten]',_0x564446[_0x7db7('0x24')]),_0x564446);calls['newexten'](_0x564446);recordings[_0x7db7('0x41')](_0x564446);dials[_0x7db7('0x41')](_0x564446);}catch(_0x370605){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')]('[%s][index][newexten]',_0x564446[_0x7db7('0x24')]),_0x370605);}});ami['on'](_0x7db7('0x42'),function(_0x11cf15){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x43'),_0x11cf15['uniqueid']),_0x11cf15);calls[_0x7db7('0x42')](_0x11cf15);recordings[_0x7db7('0x42')](_0x11cf15);}catch(_0x52fcae){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x43'),_0x11cf15[_0x7db7('0x24')]),_0x52fcae);}});ami['on'](_0x7db7('0x44'),function(_0x5c1cd8){try{utils[_0x7db7('0x1d')](util[_0x7db7('0x20')](_0x7db7('0x45'),_0x5c1cd8[_0x7db7('0x24')]),_0x5c1cd8);dials[_0x7db7('0x44')](_0x5c1cd8);}catch(_0x94525a){utils[_0x7db7('0x1f')](util[_0x7db7('0x20')](_0x7db7('0x46'),_0x5c1cd8[_0x7db7('0x24')]),_0x94525a);}});ami['on'](_0x7db7('0x47'),function(_0x2f5f0b){try{utils['debug'](util[_0x7db7('0x20')](_0x7db7('0x48'),_0x2f5f0b['uniqueid']),_0x2f5f0b);dials[_0x7db7('0x47')](_0x2f5f0b);}catch(_0x5b55b8){utils['error'](util[_0x7db7('0x20')](_0x7db7('0x48'),_0x2f5f0b['uniqueid']),_0x5b55b8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3c48c3c..3c51cac 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 _0x0922=['state','INUSE','voice','now','NOT_INUSE','isNil','exitAt','duration','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','split','type','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','info','interface','channel','data2','membername','then','name','request','CreateMemberReport','getUserByName','internal','catch','error','format','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0x29a636,_0x591f93){var _0x4146b7=function(_0x1f7aa9){while(--_0x1f7aa9){_0x29a636['push'](_0x29a636['shift']());}};_0x4146b7(++_0x591f93);}(_0x0922,0x77));var _0x2092=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x0922[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var utils=require(_0x2092('0x2'));var members={};var exclude=[_0x2092('0x3'),'Queue:'];function writeDB(_0x63616d){utils[_0x2092('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x63616d['uniqueid'],_0x63616d[_0x2092('0x5')],_0x63616d[_0x2092('0x6')],_0x63616d[_0x2092('0x7')],_0x63616d[_0x2092('0x8')],_0x63616d['type']));if(_0x63616d[_0x2092('0x5')]){utils['getUserByInterface'](_0x63616d[_0x2092('0x5')])[_0x2092('0x9')](function(_0xacb39c){if(_0xacb39c){_0x63616d['membername']=_0xacb39c[_0x2092('0xa')];_0x63616d['internal']=_0xacb39c['internal'];utils[_0x2092('0xb')](_0x2092('0xc'),_0x63616d);}else{utils[_0x2092('0xd')](_0x63616d['interface']['split']('/')[0x1])[_0x2092('0x9')](function(_0x2b87af){if(_0x2b87af){_0x63616d[_0x2092('0x8')]=_0x2b87af['name'];_0x63616d['internal']=_0x2b87af[_0x2092('0xe')];utils[_0x2092('0xb')](_0x2092('0xc'),_0x63616d);}});}})[_0x2092('0xf')](function(_0x518696){utils[_0x2092('0x10')](util[_0x2092('0x11')](_0x2092('0x12'),_0x63616d[_0x2092('0x13')]),_0x518696);});}delete members[_0x63616d[_0x2092('0x5')]];}function startsWith(_0x408370,_0x1f679e){return _[_0x2092('0x14')](_0x408370,function(_0x1bcb7f){return _['startsWith'](_0x1f679e,_0x1bcb7f);});}exports[_0x2092('0x15')]=function(_0x5d9938){try{utils[_0x2092('0x16')](util[_0x2092('0x11')]('[%s][members][devicestatechange]',members[_0x5d9938[_0x2092('0x17')]]?members[_0x5d9938[_0x2092('0x17')]]['uniqueid']:_0x5d9938['device']),_0x5d9938);utils['info'](util['format'](_0x2092('0x18'),members[_0x5d9938['device']]?members[_0x5d9938[_0x2092('0x17')]][_0x2092('0x13')]:_0x5d9938[_0x2092('0x17')],_0x5d9938[_0x2092('0x19')],_0x5d9938[_0x2092('0x17')]));switch(_0x5d9938['state']){case _0x2092('0x1a'):case'BUSY':if(!startsWith(exclude,_0x5d9938[_0x2092('0x17')])){members[_0x5d9938[_0x2092('0x17')]]={'channel':_0x2092('0x1b'),'interface':_0x5d9938['device'],'type':'TALKING','enterAt':utils[_0x2092('0x1c')](),'role':'agent'};}break;case _0x2092('0x1d'):if(!_[_0x2092('0x1e')](members[_0x5d9938[_0x2092('0x17')]])){members[_0x5d9938[_0x2092('0x17')]][_0x2092('0x1f')]=utils[_0x2092('0x1c')]();members[_0x5d9938[_0x2092('0x17')]][_0x2092('0x20')]=utils['diffTime'](members[_0x5d9938[_0x2092('0x17')]]['exitAt'],members[_0x5d9938[_0x2092('0x17')]]['enterAt']);if(members[_0x5d9938[_0x2092('0x17')]][_0x2092('0x13')]){writeDB(members[_0x5d9938[_0x2092('0x17')]]);}}break;default:break;}}catch(_0x2e935f){utils[_0x2092('0x10')](util[_0x2092('0x11')](_0x2092('0x21'),members[_0x5d9938[_0x2092('0x17')]]?members[_0x5d9938[_0x2092('0x17')]][_0x2092('0x13')]:_0x5d9938[_0x2092('0x17')]),_0x2e935f);}};exports[_0x2092('0x22')]=function(_0x3e314e){try{if(!_[_0x2092('0x1e')](members[_0x3e314e[_0x2092('0x5')]])){utils['debug'](util[_0x2092('0x11')](_0x2092('0x23'),_0x3e314e[_0x2092('0x13')]),_0x3e314e);utils[_0x2092('0x4')](util[_0x2092('0x11')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3e314e[_0x2092('0x13')],_0x3e314e['interface'],_0x3e314e[_0x2092('0x24')]));members[_0x3e314e[_0x2092('0x5')]]=_[_0x2092('0x25')](members[_0x3e314e[_0x2092('0x5')]],{'data4':_0x3e314e[_0x2092('0x24')],'uniqueid':_0x3e314e['uniqueid']});}}catch(_0x39b0f0){utils[_0x2092('0x10')](util['format'](_0x2092('0x23'),_0x3e314e[_0x2092('0x13')]),_0x39b0f0);}};exports[_0x2092('0x26')]=function(_0x311a41){try{utils[_0x2092('0x16')](util[_0x2092('0x11')](_0x2092('0x27'),_0x311a41[_0x2092('0x13')]),_0x311a41);if(_0x311a41[_0x2092('0x6')]){var _0x55c454=_0x311a41['channel'][_0x2092('0x28')]('-')[0x0];if(!_[_0x2092('0x1e')](members[_0x55c454])){members[_0x55c454]=_['assign'](members[_0x55c454],{'data1':members[_0x55c454]['data1']||_0x311a41[_0x2092('0x29')],'data2':members[_0x55c454][_0x2092('0x7')]||_0x311a41[_0x2092('0x2a')],'data3':members[_0x55c454][_0x2092('0x2b')]||_0x311a41['destination'],'uniqueid':members[_0x55c454][_0x2092('0x13')]||_0x311a41[_0x2092('0x13')]});utils[_0x2092('0x4')](util[_0x2092('0x11')](_0x2092('0x2c'),_0x311a41['uniqueid'],members[_0x55c454][_0x2092('0x2d')],members[_0x55c454][_0x2092('0x7')],members[_0x55c454]['data3']));if(members[_0x55c454][_0x2092('0x1f')]){writeDB(members[_0x55c454]);}}}if(_0x311a41[_0x2092('0x2e')]){var _0x2ae6b7=_0x311a41['destinationchannel'][_0x2092('0x28')]('-')[0x0];if(!_[_0x2092('0x1e')](members[_0x2ae6b7])){members[_0x2ae6b7]=_[_0x2092('0x25')](members[_0x2ae6b7],{'data1':members[_0x2ae6b7]['data1']||_0x311a41[_0x2092('0x29')],'data2':members[_0x2ae6b7]['data2']||_0x311a41[_0x2092('0x2a')],'data3':members[_0x2ae6b7][_0x2092('0x2b')]||_0x311a41[_0x2092('0x2f')],'uniqueid':members[_0x2ae6b7][_0x2092('0x13')]||_0x311a41[_0x2092('0x13')]});utils[_0x2092('0x4')](util[_0x2092('0x11')](_0x2092('0x2c'),_0x311a41[_0x2092('0x13')],members[_0x2ae6b7][_0x2092('0x2d')],members[_0x2ae6b7][_0x2092('0x7')],members[_0x2ae6b7]['data3']));if(members[_0x2ae6b7][_0x2092('0x1f')]){writeDB(members[_0x2ae6b7]);}}}}catch(_0x3d7791){utils[_0x2092('0x10')](util['format']('[%s][members][cdr]',_0x311a41[_0x2092('0x13')]),_0x3d7791);}}; \ No newline at end of file +var _0xa553=['NOT_INUSE','isNil','duration','diffTime','exitAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','then','name','internal','split','membername','request','CreateMemberReport','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','agent'];(function(_0xd32b55,_0x1b2696){var _0x5b86fd=function(_0x3a667a){while(--_0x3a667a){_0xd32b55['push'](_0xd32b55['shift']());}};_0x5b86fd(++_0x1b2696);}(_0xa553,0x158));var _0x3a55=function(_0x370732,_0x304cac){_0x370732=_0x370732-0x0;var _0x3226d8=_0xa553[_0x370732];return _0x3226d8;};'use strict';var _=require(_0x3a55('0x0'));var util=require(_0x3a55('0x1'));var utils=require(_0x3a55('0x2'));var members={};var exclude=[_0x3a55('0x3'),_0x3a55('0x4')];function writeDB(_0x41dd31){utils[_0x3a55('0x5')](util['format'](_0x3a55('0x6'),_0x41dd31[_0x3a55('0x7')],_0x41dd31[_0x3a55('0x8')],_0x41dd31[_0x3a55('0x9')],_0x41dd31[_0x3a55('0xa')],_0x41dd31['membername'],_0x41dd31['type']));if(_0x41dd31[_0x3a55('0x8')]){utils[_0x3a55('0xb')](_0x41dd31[_0x3a55('0x8')])[_0x3a55('0xc')](function(_0x54afe5){if(_0x54afe5){_0x41dd31['membername']=_0x54afe5[_0x3a55('0xd')];_0x41dd31[_0x3a55('0xe')]=_0x54afe5[_0x3a55('0xe')];utils['request']('CreateMemberReport',_0x41dd31);}else{utils['getUserByName'](_0x41dd31[_0x3a55('0x8')][_0x3a55('0xf')]('/')[0x1])[_0x3a55('0xc')](function(_0x376df5){if(_0x376df5){_0x41dd31[_0x3a55('0x10')]=_0x376df5[_0x3a55('0xd')];_0x41dd31[_0x3a55('0xe')]=_0x376df5[_0x3a55('0xe')];utils[_0x3a55('0x11')](_0x3a55('0x12'),_0x41dd31);}});}})[_0x3a55('0x13')](function(_0x30bc78){utils['error'](util['format'](_0x3a55('0x14'),_0x41dd31[_0x3a55('0x7')]),_0x30bc78);});}delete members[_0x41dd31[_0x3a55('0x8')]];}function startsWith(_0x2d29ed,_0x2657cf){return _[_0x3a55('0x15')](_0x2d29ed,function(_0x3dadd8){return _[_0x3a55('0x16')](_0x2657cf,_0x3dadd8);});}exports[_0x3a55('0x17')]=function(_0xc0e0c0){try{utils[_0x3a55('0x18')](util[_0x3a55('0x19')](_0x3a55('0x1a'),members[_0xc0e0c0[_0x3a55('0x1b')]]?members[_0xc0e0c0[_0x3a55('0x1b')]]['uniqueid']:_0xc0e0c0['device']),_0xc0e0c0);utils[_0x3a55('0x5')](util[_0x3a55('0x19')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xc0e0c0[_0x3a55('0x1b')]]?members[_0xc0e0c0[_0x3a55('0x1b')]][_0x3a55('0x7')]:_0xc0e0c0['device'],_0xc0e0c0['state'],_0xc0e0c0[_0x3a55('0x1b')]));switch(_0xc0e0c0[_0x3a55('0x1c')]){case _0x3a55('0x1d'):case _0x3a55('0x1e'):if(!startsWith(exclude,_0xc0e0c0[_0x3a55('0x1b')])){members[_0xc0e0c0[_0x3a55('0x1b')]]={'channel':_0x3a55('0x1f'),'interface':_0xc0e0c0[_0x3a55('0x1b')],'type':_0x3a55('0x20'),'enterAt':utils['now'](),'role':_0x3a55('0x21')};}break;case _0x3a55('0x22'):if(!_[_0x3a55('0x23')](members[_0xc0e0c0[_0x3a55('0x1b')]])){members[_0xc0e0c0['device']]['exitAt']=utils['now']();members[_0xc0e0c0[_0x3a55('0x1b')]][_0x3a55('0x24')]=utils[_0x3a55('0x25')](members[_0xc0e0c0[_0x3a55('0x1b')]][_0x3a55('0x26')],members[_0xc0e0c0[_0x3a55('0x1b')]]['enterAt']);if(members[_0xc0e0c0['device']][_0x3a55('0x7')]){writeDB(members[_0xc0e0c0['device']]);}}break;default:break;}}catch(_0xb1097){utils[_0x3a55('0x27')](util['format'](_0x3a55('0x1a'),members[_0xc0e0c0[_0x3a55('0x1b')]]?members[_0xc0e0c0[_0x3a55('0x1b')]][_0x3a55('0x7')]:_0xc0e0c0[_0x3a55('0x1b')]),_0xb1097);}};exports[_0x3a55('0x28')]=function(_0x40b567){try{if(!_[_0x3a55('0x23')](members[_0x40b567[_0x3a55('0x8')]])){utils[_0x3a55('0x18')](util[_0x3a55('0x19')](_0x3a55('0x29'),_0x40b567[_0x3a55('0x7')]),_0x40b567);utils[_0x3a55('0x5')](util[_0x3a55('0x19')](_0x3a55('0x2a'),_0x40b567[_0x3a55('0x7')],_0x40b567[_0x3a55('0x8')],_0x40b567[_0x3a55('0x2b')]));members[_0x40b567[_0x3a55('0x8')]]=_[_0x3a55('0x2c')](members[_0x40b567['interface']],{'data4':_0x40b567[_0x3a55('0x2b')],'uniqueid':_0x40b567['uniqueid']});}}catch(_0x5253ea){utils[_0x3a55('0x27')](util[_0x3a55('0x19')](_0x3a55('0x29'),_0x40b567[_0x3a55('0x7')]),_0x5253ea);}};exports[_0x3a55('0x2d')]=function(_0x484767){try{utils[_0x3a55('0x18')](util[_0x3a55('0x19')](_0x3a55('0x2e'),_0x484767[_0x3a55('0x7')]),_0x484767);if(_0x484767[_0x3a55('0x9')]){var _0x23f73d=_0x484767[_0x3a55('0x9')][_0x3a55('0xf')]('-')[0x0];if(!_[_0x3a55('0x23')](members[_0x23f73d])){members[_0x23f73d]=_[_0x3a55('0x2c')](members[_0x23f73d],{'data1':members[_0x23f73d][_0x3a55('0x2f')]||_0x484767['type'],'data2':members[_0x23f73d][_0x3a55('0xa')]||_0x484767[_0x3a55('0x30')],'data3':members[_0x23f73d][_0x3a55('0x31')]||_0x484767[_0x3a55('0x32')],'uniqueid':members[_0x23f73d][_0x3a55('0x7')]||_0x484767[_0x3a55('0x7')]});utils[_0x3a55('0x5')](util[_0x3a55('0x19')](_0x3a55('0x33'),_0x484767[_0x3a55('0x7')],members[_0x23f73d][_0x3a55('0x2f')],members[_0x23f73d][_0x3a55('0xa')],members[_0x23f73d]['data3']));if(members[_0x23f73d][_0x3a55('0x26')]){writeDB(members[_0x23f73d]);}}}if(_0x484767['destinationchannel']){var _0x41a446=_0x484767[_0x3a55('0x34')][_0x3a55('0xf')]('-')[0x0];if(!_[_0x3a55('0x23')](members[_0x41a446])){members[_0x41a446]=_[_0x3a55('0x2c')](members[_0x41a446],{'data1':members[_0x41a446][_0x3a55('0x2f')]||_0x484767[_0x3a55('0x35')],'data2':members[_0x41a446][_0x3a55('0xa')]||_0x484767[_0x3a55('0x30')],'data3':members[_0x41a446][_0x3a55('0x31')]||_0x484767[_0x3a55('0x32')],'uniqueid':members[_0x41a446][_0x3a55('0x7')]||_0x484767[_0x3a55('0x7')]});utils[_0x3a55('0x5')](util[_0x3a55('0x19')](_0x3a55('0x33'),_0x484767[_0x3a55('0x7')],members[_0x41a446][_0x3a55('0x2f')],members[_0x41a446][_0x3a55('0xa')],members[_0x41a446][_0x3a55('0x31')]));if(members[_0x41a446]['exitAt']){writeDB(members[_0x41a446]);}}}}catch(_0xfae8dc){utils[_0x3a55('0x27')](util['format']('[%s][members][cdr]',_0x484767[_0x3a55('0x7')]),_0xfae8dc);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 006d34c..c984893 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 _0x37d0=['queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','value','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','membername','assigned','accountcode','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','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','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable'];(function(_0x6ba424,_0x42fbe3){var _0x3db995=function(_0x5dc5d2){while(--_0x5dc5d2){_0x6ba424['push'](_0x6ba424['shift']());}};_0x3db995(++_0x42fbe3);}(_0x37d0,0x173));var _0x037d=function(_0x11e2d3,_0x4eaa4a){_0x11e2d3=_0x11e2d3-0x0;var _0x30b66d=_0x37d0[_0x11e2d3];return _0x30b66d;};'use strict';var _=require('lodash');var util=require(_0x037d('0x0'));var utils=require(_0x037d('0x1'));var queues={};function writeDB(_0x5129bc){utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x4'),_0x5129bc[_0x037d('0x5')],_0x5129bc[_0x037d('0x6')],_0x5129bc[_0x037d('0x7')],_0x5129bc[_0x037d('0x8')],_0x5129bc[_0x037d('0x9')],_0x5129bc['accountcode'],_0x5129bc[_0x037d('0xa')]));if(_0x5129bc[_0x037d('0x7')]){utils[_0x037d('0xb')](_0x5129bc['queue'])[_0x037d('0xc')](function(_0x4c785a){if(_0x4c785a){_0x5129bc[_0x037d('0xd')]=_0x4c785a['type'];}utils[_0x037d('0xe')](_0x037d('0xf'),_0x5129bc);});}else{utils[_0x037d('0xe')](_0x037d('0xf'),_0x5129bc);}if(_0x5129bc[_0x037d('0x10')]){delete queues[_0x5129bc[_0x037d('0x10')]];}else{delete queues[_0x5129bc['uniqueid']];}}exports[_0x037d('0x11')]=function(_0x17b3e1){try{utils[_0x037d('0x12')](util[_0x037d('0x3')]('[%s][queues][queuecallerjoin]',_0x17b3e1[_0x037d('0x5')]),_0x17b3e1);utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x13'),_0x17b3e1['uniqueid'],_0x17b3e1[_0x037d('0x7')],_0x17b3e1[_0x037d('0x14')]));queues[_0x17b3e1[_0x037d('0x5')]]=_['assign'](_0x17b3e1,{'originalposition':_0x17b3e1[_0x037d('0x14')],'queuecallerjoinAt':utils[_0x037d('0x15')](),'mohtime':0x0});}catch(_0x4e1b9c){utils[_0x037d('0x16')](util[_0x037d('0x3')](_0x037d('0x17'),_0x17b3e1[_0x037d('0x5')]),_0x4e1b9c);}};exports['hangup']=function(_0x258848){try{if(!_[_0x037d('0x18')](queues[_0x258848['uniqueid']])){utils[_0x037d('0x12')](util[_0x037d('0x3')](_0x037d('0x19'),_0x258848['uniqueid']),_0x258848);if(queues[_0x258848['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x258848[_0x037d('0x5')]][_0x037d('0x1a')]&&!queues[_0x258848[_0x037d('0x5')]][_0x037d('0x1b')]){queues[_0x258848[_0x037d('0x5')]][_0x037d('0x1c')]=!![];queues[_0x258848['uniqueid']][_0x037d('0x1d')]=utils[_0x037d('0x15')]();queues[_0x258848[_0x037d('0x5')]][_0x037d('0xa')]='COMPLETEDBYAGENT';}utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x1e'),_0x258848['uniqueid'],queues[_0x258848[_0x037d('0x5')]][_0x037d('0x1f')],queues[_0x258848[_0x037d('0x5')]][_0x037d('0xa')]));writeDB(queues[_0x258848['uniqueid']]);}else if(queues[_0x258848['uniqueid']][_0x037d('0x10')]){utils['info'](util[_0x037d('0x3')](_0x037d('0x20'),_0x258848[_0x037d('0x5')],queues[_0x258848[_0x037d('0x5')]][_0x037d('0x1f')],queues[_0x258848[_0x037d('0x5')]][_0x037d('0x10')]));queues[queues[_0x258848['uniqueid']][_0x037d('0x10')]]=queues[_0x258848['uniqueid']];queues[queues[_0x258848['uniqueid']][_0x037d('0x10')]][_0x037d('0x21')]=0x2;delete queues[_0x258848[_0x037d('0x5')]];}}}catch(_0x12aea2){utils[_0x037d('0x16')](util['format'](_0x037d('0x19'),_0x258848[_0x037d('0x5')]),_0x12aea2);}};exports[_0x037d('0x22')]=function(_0x2afbbf){try{utils[_0x037d('0x12')](util['format'](_0x037d('0x23'),_0x2afbbf[_0x037d('0x5')]),_0x2afbbf);if(!_[_0x037d('0x18')](_0x2afbbf[_0x037d('0x24')][_0x037d('0x25')])&&_0x2afbbf['value'][_0x037d('0x26')]()!==_0x037d('0x27')){if(!_[_0x037d('0x18')](queues[_0x2afbbf[_0x037d('0x5')]])){queues[_0x2afbbf['uniqueid']][_0x037d('0x1a')]=![];queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0x28')]=null;queues[_0x2afbbf[_0x037d('0x5')]]['queuecallerexit']=!![];queues[_0x2afbbf[_0x037d('0x5')]]['queuecallerexitAt']=utils[_0x037d('0x15')]();queues[_0x2afbbf['uniqueid']][_0x037d('0xa')]=_0x2afbbf[_0x037d('0x29')]['toUpperCase']();utils[_0x037d('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2afbbf[_0x037d('0x5')],queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0x1f')],_0x2afbbf['value'],queues[_0x2afbbf['uniqueid']][_0x037d('0xa')]));writeDB(queues[_0x2afbbf['uniqueid']]);}}else if(!_['isNil'](_0x2afbbf[_0x037d('0x24')][_0x037d('0x2a')])){if(!_['isNil'](queues[_0x2afbbf[_0x037d('0x5')]])&&!queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0x1a')]){queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0x1a')]=![];queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0x28')]=null;queues[_0x2afbbf['uniqueid']][_0x037d('0x1b')]=!![];queues[_0x2afbbf[_0x037d('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0xa')]=_0x037d('0x2b');utils['info'](util['format'](_0x037d('0x2c'),_0x2afbbf[_0x037d('0x5')],queues[_0x2afbbf[_0x037d('0x5')]]['name'],_0x2afbbf[_0x037d('0x29')],queues[_0x2afbbf[_0x037d('0x5')]][_0x037d('0xa')]));}}}catch(_0x3271f1){utils[_0x037d('0x16')](util['format']('[%s][queues][varset]',_0x2afbbf[_0x037d('0x5')]),_0x3271f1);}};exports[_0x037d('0x1a')]=function(_0x4e68a3){try{if(!_['isNil'](queues[_0x4e68a3[_0x037d('0x5')]])){utils[_0x037d('0x12')](util[_0x037d('0x3')]('[%s][queues][queuecallerabandon]',_0x4e68a3[_0x037d('0x5')]),_0x4e68a3);queues[_0x4e68a3[_0x037d('0x5')]]['queuecallerexit']=![];queues[_0x4e68a3['uniqueid']]['queuecallerexitAt']=null;queues[_0x4e68a3[_0x037d('0x5')]][_0x037d('0x1a')]=!![];queues[_0x4e68a3['uniqueid']][_0x037d('0x28')]=utils[_0x037d('0x15')]();queues[_0x4e68a3[_0x037d('0x5')]][_0x037d('0xa')]=_0x037d('0x2d');utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x2e'),_0x4e68a3['uniqueid'],queues[_0x4e68a3[_0x037d('0x5')]]['name'],queues[_0x4e68a3[_0x037d('0x5')]][_0x037d('0xa')]));}}catch(_0x3a6274){utils[_0x037d('0x16')](util[_0x037d('0x3')]('[%s][queues][queuecallerabandon]',_0x4e68a3[_0x037d('0x5')]),_0x3a6274);}};exports[_0x037d('0x2f')]=function(_0x1791da){try{if(!_[_0x037d('0x18')](queues[_0x1791da[_0x037d('0x5')]])){utils[_0x037d('0x12')](util[_0x037d('0x3')]('[%s][queues][queuecallerleave]',_0x1791da[_0x037d('0x5')]),_0x1791da);utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x30'),_0x1791da['uniqueid'],queues[_0x1791da['uniqueid']][_0x037d('0x1f')],_0x1791da[_0x037d('0x31')],_0x1791da[_0x037d('0x32')]));queues[_0x1791da[_0x037d('0x5')]][_0x037d('0x2f')]=!![];queues[_0x1791da['uniqueid']][_0x037d('0x33')]=utils[_0x037d('0x15')]();queues[_0x1791da[_0x037d('0x5')]][_0x037d('0x34')]=utils[_0x037d('0x35')](queues[_0x1791da[_0x037d('0x5')]]['queuecallerleaveAt'],queues[_0x1791da['uniqueid']]['queuecallerjoinAt']);queues[_0x1791da[_0x037d('0x5')]][_0x037d('0x14')]=_0x1791da[_0x037d('0x14')];queues[_0x1791da['uniqueid']]['count']=_0x1791da[_0x037d('0x36')];queues[_0x1791da[_0x037d('0x5')]][_0x037d('0x31')]=_0x1791da[_0x037d('0x31')];queues[_0x1791da[_0x037d('0x5')]]['connectedlinename']=_0x1791da['connectedlinename'];}}catch(_0x1d3218){utils[_0x037d('0x16')](util[_0x037d('0x3')](_0x037d('0x37'),_0x1791da[_0x037d('0x5')]),_0x1d3218);}};exports[_0x037d('0x38')]=function(_0x28ed03){try{if(!_[_0x037d('0x18')](queues[_0x28ed03['uniqueid']])){utils[_0x037d('0x12')](util['format'](_0x037d('0x39'),_0x28ed03[_0x037d('0x5')]),_0x28ed03);utils[_0x037d('0x2')](util[_0x037d('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x28ed03[_0x037d('0x5')],queues[_0x28ed03[_0x037d('0x5')]][_0x037d('0x1f')],_0x28ed03[_0x037d('0x3a')],_0x28ed03['destaccountcode']));queues[_0x28ed03[_0x037d('0x5')]]['queuecallerabandon']=![];queues[_0x28ed03[_0x037d('0x5')]]['queuecallerabandon']=![];queues[_0x28ed03[_0x037d('0x5')]][_0x037d('0x28')]=null;queues[_0x28ed03['uniqueid']][_0x037d('0x1b')]=![];queues[_0x28ed03[_0x037d('0x5')]]['queuecallerexitreason']=null;queues[_0x28ed03[_0x037d('0x5')]]['queuecallerexitAt']=null;queues[_0x28ed03[_0x037d('0x5')]][_0x037d('0x3b')]=!![];queues[_0x28ed03['uniqueid']][_0x037d('0x3c')]=_0x28ed03[_0x037d('0x3d')];queues[_0x28ed03[_0x037d('0x5')]][_0x037d('0x8')]=_0x28ed03[_0x037d('0x3a')];}}catch(_0x3d2460){utils['error'](util[_0x037d('0x3')](_0x037d('0x39'),_0x28ed03[_0x037d('0x5')]),_0x3d2460);}};exports[_0x037d('0x3e')]=function(_0x33db13){try{if(!_['isNil'](queues[_0x33db13[_0x037d('0x5')]])){if(queues[_0x33db13['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x037d('0x3')](_0x037d('0x3f'),_0x33db13['uniqueid']),_0x33db13);queues[_0x33db13[_0x037d('0x5')]]['queuecallerabandon']=![];queues[_0x33db13[_0x037d('0x5')]][_0x037d('0x1a')]=![];queues[_0x33db13[_0x037d('0x5')]][_0x037d('0x28')]=null;queues[_0x33db13[_0x037d('0x5')]][_0x037d('0x1b')]=![];queues[_0x33db13[_0x037d('0x5')]]['queuecallerexitAt']=null;queues[_0x33db13['uniqueid']][_0x037d('0x3b')]=!![];queues[_0x33db13[_0x037d('0x5')]][_0x037d('0x8')]=_0x33db13[_0x037d('0x3a')];queues[_0x33db13[_0x037d('0x5')]]['queuecallercomplete']=!![];queues[_0x33db13['uniqueid']][_0x037d('0x1d')]=utils[_0x037d('0x15')]();if(_0x33db13['reason']=='transfer'){if(!queues[_0x33db13[_0x037d('0x5')]][_0x037d('0x40')]){queues[_0x33db13[_0x037d('0x5')]][_0x037d('0xa')]='TRANSFER';}}else{queues[_0x33db13[_0x037d('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x33db13[_0x037d('0x41')][_0x037d('0x26')]();}utils[_0x037d('0x2')](util['format'](_0x037d('0x42'),_0x33db13[_0x037d('0x5')],queues[_0x33db13[_0x037d('0x5')]]['name'],_0x33db13[_0x037d('0x3a')],queues[_0x33db13[_0x037d('0x5')]][_0x037d('0xa')]));writeDB(queues[_0x33db13[_0x037d('0x5')]]);}}}catch(_0x305514){utils[_0x037d('0x16')](util[_0x037d('0x3')](_0x037d('0x3f'),_0x33db13[_0x037d('0x5')]),_0x305514);}};exports['blindtransfer']=function(_0x285261){try{if(!_['isNil'](queues[_0x285261[_0x037d('0x43')]])){utils[_0x037d('0x12')](util[_0x037d('0x3')](_0x037d('0x44'),_0x285261['uniqueid']),_0x285261);queues[_0x285261[_0x037d('0x43')]][_0x037d('0x40')]=!![];queues[_0x285261[_0x037d('0x43')]][_0x037d('0x45')]='BLIND';queues[_0x285261[_0x037d('0x43')]][_0x037d('0x46')]=_0x285261['extension'];queues[_0x285261[_0x037d('0x43')]][_0x037d('0x47')]=_0x285261[_0x037d('0x43')];queues[_0x285261[_0x037d('0x43')]][_0x037d('0xa')]=_0x037d('0x48');utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x49'),_0x285261[_0x037d('0x5')],queues[_0x285261['transfereeuniqueid']][_0x037d('0x1f')],_0x285261['transfereeuniqueid'],_0x285261['extension']));}}catch(_0x9716bc){utils['error'](util[_0x037d('0x3')](_0x037d('0x44'),_0x285261[_0x037d('0x5')]),_0x9716bc);}};exports[_0x037d('0x4a')]=function(_0x1f2836){try{utils[_0x037d('0x12')](util['format'](_0x037d('0x4b'),_0x1f2836[_0x037d('0x4c')]),_0x1f2836);if(_0x1f2836[_0x037d('0x4c')]==_0x1f2836[_0x037d('0x4d')]){if(!_['isNil'](queues[_0x1f2836[_0x037d('0x4e')]])){utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x4f'),_0x1f2836['origtransfereruniqueid'],queues[_0x1f2836[_0x037d('0x4e')]][_0x037d('0x1f')],_0x1f2836[_0x037d('0x50')]));queues[_0x1f2836[_0x037d('0x4e')]][_0x037d('0x40')]=!![];queues[_0x1f2836[_0x037d('0x4e')]][_0x037d('0x45')]=_0x037d('0x51');queues[_0x1f2836[_0x037d('0x4e')]][_0x037d('0x46')]=_0x1f2836['origtransfererexten'];queues[_0x1f2836[_0x037d('0x4e')]]['transferuniqueid']=_0x1f2836[_0x037d('0x4c')];queues[_0x1f2836['secondtransfererlinkedid']][_0x037d('0xa')]=_0x037d('0x52');}if(!_['isNil'](queues[_0x1f2836['origtransfererlinkedid']])){if(_0x1f2836[_0x037d('0x53')]&&queues[_0x1f2836[_0x037d('0x53')]]){queues[_0x1f2836['transfereelinkedid']][_0x037d('0x21')]=0x1;queues[_0x1f2836[_0x037d('0x43')]]=_[_0x037d('0x54')](queues[_0x1f2836[_0x037d('0x53')]]);queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x10')]=_0x1f2836[_0x037d('0x55')];queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x21')]=0x2;queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x9')]=queues[_0x1f2836['secondtransfererlinkedid']][_0x037d('0x9')];queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x56')]=queues[_0x1f2836['secondtransfererlinkedid']][_0x037d('0x56')];queues[_0x1f2836['transfereeuniqueid']][_0x037d('0x57')]=utils['now']();queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x33')]=utils['now']();queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x34')]=0x0;queues[_0x1f2836[_0x037d('0x43')]][_0x037d('0x58')]=0x0;utils[_0x037d('0x2')](util['format'](_0x037d('0x59'),_0x1f2836[_0x037d('0x4c')],queues[_0x1f2836['transfereeuniqueid']][_0x037d('0x1f')],queues[_0x1f2836['transfereeuniqueid']][_0x037d('0x9')],queues[_0x1f2836['transfereeuniqueid']]['calleridname']));}else{utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x5a'),_0x1f2836[_0x037d('0x4c')],queues[_0x1f2836['origtransfererlinkedid']][_0x037d('0x1f')],_0x1f2836['secondtransfererlinkedid']));queues[_0x1f2836['origtransfererlinkedid']]['transfereduniqueid']=_0x1f2836[_0x037d('0x4e')];}}}else if(_0x1f2836[_0x037d('0x5b')]==_0x1f2836[_0x037d('0x4e')]){if(!_[_0x037d('0x18')](queues[_0x1f2836[_0x037d('0x4d')]])){utils['info'](util[_0x037d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1f2836[_0x037d('0x4c')],queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0x1f')],_0x1f2836[_0x037d('0x5b')],_0x1f2836[_0x037d('0x5c')]));queues[_0x1f2836['origtransfererlinkedid']][_0x037d('0x40')]=!![];queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0x45')]=_0x037d('0x51');queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0x46')]=_0x1f2836[_0x037d('0x5c')];queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0x47')]=_0x1f2836['secondtransfereruniqueid'];queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0xa')]=_0x037d('0x52');}if(!_[_0x037d('0x18')](queues[_0x1f2836['secondtransfererlinkedid']])){if(_0x1f2836[_0x037d('0x5d')]&&queues[_0x1f2836[_0x037d('0x5d')]]){queues[_0x1f2836['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x1f2836[_0x037d('0x55')]]=_[_0x037d('0x54')](queues[_0x1f2836['transfertargetlinkedid']]);queues[_0x1f2836[_0x037d('0x55')]][_0x037d('0x10')]=_0x1f2836[_0x037d('0x55')];queues[_0x1f2836['transfertargetuniqueid']][_0x037d('0x21')]=0x2;queues[_0x1f2836[_0x037d('0x55')]][_0x037d('0x9')]=queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0x9')];queues[_0x1f2836[_0x037d('0x55')]]['calleridname']=queues[_0x1f2836[_0x037d('0x4d')]][_0x037d('0x56')];queues[_0x1f2836['transfertargetuniqueid']][_0x037d('0x57')]=utils['now']();queues[_0x1f2836[_0x037d('0x55')]][_0x037d('0x33')]=utils['now']();queues[_0x1f2836[_0x037d('0x55')]][_0x037d('0x34')]=0x0;queues[_0x1f2836[_0x037d('0x55')]]['mohtime']=0x0;utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x5e'),_0x1f2836[_0x037d('0x4c')],queues[_0x1f2836['transfertargetuniqueid']][_0x037d('0x1f')],queues[_0x1f2836[_0x037d('0x55')]][_0x037d('0x10')],queues[_0x1f2836[_0x037d('0x55')]]['calleridnum'],queues[_0x1f2836[_0x037d('0x55')]][_0x037d('0x56')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1f2836[_0x037d('0x4c')],queues[_0x1f2836['secondtransfererlinkedid']][_0x037d('0x1f')],_0x1f2836[_0x037d('0x4d')]));queues[_0x1f2836[_0x037d('0x4e')]]['transfereduniqueid']=_0x1f2836[_0x037d('0x4d')];}}}}catch(_0x14c262){utils[_0x037d('0x16')](util[_0x037d('0x3')](_0x037d('0x4b'),_0x1f2836['origtransfereruniqueid']),_0x14c262);}};exports[_0x037d('0x5f')]=function(_0xd85461){try{if(!_['isNil'](queues[_0xd85461['uniqueid']])){utils[_0x037d('0x12')](util['format'](_0x037d('0x60'),_0xd85461[_0x037d('0x5')]),_0xd85461);queues[_0xd85461[_0x037d('0x5')]][_0x037d('0x61')]=utils[_0x037d('0x15')]();utils[_0x037d('0x2')](util[_0x037d('0x3')](_0x037d('0x62'),_0xd85461['uniqueid'],queues[_0xd85461['uniqueid']]['name'],queues[_0xd85461[_0x037d('0x5')]][_0x037d('0x61')]));}}catch(_0x54a1bc){utils['error'](util[_0x037d('0x3')](_0x037d('0x60'),_0xd85461['uniqueid']),_0x54a1bc);}};exports[_0x037d('0x63')]=function(_0x54054c){try{if(!_['isNil'](queues[_0x54054c[_0x037d('0x5')]])){if(!_[_0x037d('0x18')](queues[_0x54054c[_0x037d('0x5')]][_0x037d('0x61')])){utils[_0x037d('0x12')](util['format'](_0x037d('0x64'),_0x54054c['uniqueid']),_0x54054c);queues[_0x54054c['uniqueid']][_0x037d('0x58')]+=utils[_0x037d('0x35')](utils[_0x037d('0x15')](),queues[_0x54054c[_0x037d('0x5')]]['musiconholdstartAt']);utils['info'](util[_0x037d('0x3')](_0x037d('0x65'),_0x54054c[_0x037d('0x5')],queues[_0x54054c[_0x037d('0x5')]][_0x037d('0x1f')],queues[_0x54054c[_0x037d('0x5')]]['mohtime']));delete queues[_0x54054c['uniqueid']]['musiconholdstartAt'];}}}catch(_0x286ed3){utils['error'](util[_0x037d('0x3')](_0x037d('0x64'),_0x54054c['uniqueid']),_0x286ed3);}}; \ No newline at end of file +var _0x1f8b=['holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','accountcode','destaccountcode','lastAssignedTo','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','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','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','now','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','error','[%s][queues][hangup]','varset','queuestatus','value','toUpperCase','CONTINUE','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','queuecallerexitAt','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'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x1f8b,0x1d9));var _0xb1f8=function(_0x1cfa91,_0x588609){_0x1cfa91=_0x1cfa91-0x0;var _0x4bd965=_0x1f8b[_0x1cfa91];return _0x4bd965;};'use strict';var _=require(_0xb1f8('0x0'));var util=require(_0xb1f8('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x1bc1db){utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x4'),_0x1bc1db['uniqueid'],_0x1bc1db[_0xb1f8('0x5')],_0x1bc1db[_0xb1f8('0x6')],_0x1bc1db['lastAssignedTo'],_0x1bc1db[_0xb1f8('0x7')],_0x1bc1db['accountcode'],_0x1bc1db[_0xb1f8('0x8')]));if(_0x1bc1db['queue']){utils['getVoiceQueueByName'](_0x1bc1db[_0xb1f8('0x6')])[_0xb1f8('0x9')](function(_0xae605f){if(_0xae605f){_0x1bc1db[_0xb1f8('0xa')]=_0xae605f[_0xb1f8('0xa')];}utils[_0xb1f8('0xb')](_0xb1f8('0xc'),_0x1bc1db);});}else{utils[_0xb1f8('0xb')]('CreateVoiceQueueReport',_0x1bc1db);}if(_0x1bc1db[_0xb1f8('0xd')]){delete queues[_0x1bc1db[_0xb1f8('0xd')]];}else{delete queues[_0x1bc1db[_0xb1f8('0xe')]];}}exports[_0xb1f8('0xf')]=function(_0x12009f){try{utils[_0xb1f8('0x10')](util['format'](_0xb1f8('0x11'),_0x12009f[_0xb1f8('0xe')]),_0x12009f);utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x12009f[_0xb1f8('0xe')],_0x12009f['queue'],_0x12009f[_0xb1f8('0x12')]));queues[_0x12009f['uniqueid']]=_['assign'](_0x12009f,{'originalposition':_0x12009f[_0xb1f8('0x12')],'queuecallerjoinAt':utils[_0xb1f8('0x13')](),'mohtime':0x0});}catch(_0x460f07){utils['error'](util[_0xb1f8('0x3')](_0xb1f8('0x11'),_0x12009f[_0xb1f8('0xe')]),_0x460f07);}};exports[_0xb1f8('0x14')]=function(_0x543d3b){try{if(!_[_0xb1f8('0x15')](queues[_0x543d3b[_0xb1f8('0xe')]])){utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')]('[%s][queues][hangup]',_0x543d3b['uniqueid']),_0x543d3b);if(queues[_0x543d3b[_0xb1f8('0xe')]]['queuecallerleaveAt']){if(!queues[_0x543d3b[_0xb1f8('0xe')]][_0xb1f8('0x16')]&&!queues[_0x543d3b['uniqueid']][_0xb1f8('0x17')]){queues[_0x543d3b[_0xb1f8('0xe')]][_0xb1f8('0x18')]=!![];queues[_0x543d3b['uniqueid']][_0xb1f8('0x19')]=utils['now']();queues[_0x543d3b[_0xb1f8('0xe')]][_0xb1f8('0x8')]=_0xb1f8('0x1a');}utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x543d3b['uniqueid'],queues[_0x543d3b['uniqueid']]['name'],queues[_0x543d3b['uniqueid']][_0xb1f8('0x8')]));writeDB(queues[_0x543d3b[_0xb1f8('0xe')]]);}else if(queues[_0x543d3b['uniqueid']][_0xb1f8('0xd')]){utils[_0xb1f8('0x2')](util['format'](_0xb1f8('0x1b'),_0x543d3b[_0xb1f8('0xe')],queues[_0x543d3b[_0xb1f8('0xe')]][_0xb1f8('0x1c')],queues[_0x543d3b['uniqueid']][_0xb1f8('0xd')]));queues[queues[_0x543d3b[_0xb1f8('0xe')]][_0xb1f8('0xd')]]=queues[_0x543d3b[_0xb1f8('0xe')]];queues[queues[_0x543d3b[_0xb1f8('0xe')]][_0xb1f8('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x543d3b['uniqueid']];}}}catch(_0x43d060){utils[_0xb1f8('0x1d')](util[_0xb1f8('0x3')](_0xb1f8('0x1e'),_0x543d3b[_0xb1f8('0xe')]),_0x43d060);}};exports[_0xb1f8('0x1f')]=function(_0x3dd716){try{utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')]('[%s][queues][varset]',_0x3dd716[_0xb1f8('0xe')]),_0x3dd716);if(!_[_0xb1f8('0x15')](_0x3dd716['variable'][_0xb1f8('0x20')])&&_0x3dd716[_0xb1f8('0x21')][_0xb1f8('0x22')]()!==_0xb1f8('0x23')){if(!_[_0xb1f8('0x15')](queues[_0x3dd716[_0xb1f8('0xe')]])){queues[_0x3dd716[_0xb1f8('0xe')]]['queuecallerabandon']=![];queues[_0x3dd716[_0xb1f8('0xe')]]['queuecallerabandonAt']=null;queues[_0x3dd716[_0xb1f8('0xe')]]['queuecallerexit']=!![];queues[_0x3dd716['uniqueid']]['queuecallerexitAt']=utils[_0xb1f8('0x13')]();queues[_0x3dd716[_0xb1f8('0xe')]][_0xb1f8('0x8')]=_0x3dd716[_0xb1f8('0x21')][_0xb1f8('0x22')]();utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x24'),_0x3dd716['uniqueid'],queues[_0x3dd716[_0xb1f8('0xe')]][_0xb1f8('0x1c')],_0x3dd716['value'],queues[_0x3dd716[_0xb1f8('0xe')]][_0xb1f8('0x8')]));writeDB(queues[_0x3dd716[_0xb1f8('0xe')]]);}}else if(!_[_0xb1f8('0x15')](_0x3dd716[_0xb1f8('0x25')][_0xb1f8('0x26')])){if(!_[_0xb1f8('0x15')](queues[_0x3dd716[_0xb1f8('0xe')]])&&!queues[_0x3dd716[_0xb1f8('0xe')]]['queuecallerabandon']){queues[_0x3dd716[_0xb1f8('0xe')]][_0xb1f8('0x16')]=![];queues[_0x3dd716[_0xb1f8('0xe')]][_0xb1f8('0x27')]=null;queues[_0x3dd716['uniqueid']][_0xb1f8('0x17')]=!![];queues[_0x3dd716['uniqueid']][_0xb1f8('0x28')]=utils[_0xb1f8('0x13')]();queues[_0x3dd716[_0xb1f8('0xe')]][_0xb1f8('0x8')]=_0xb1f8('0x29');utils[_0xb1f8('0x2')](util['format'](_0xb1f8('0x2a'),_0x3dd716[_0xb1f8('0xe')],queues[_0x3dd716['uniqueid']][_0xb1f8('0x1c')],_0x3dd716[_0xb1f8('0x21')],queues[_0x3dd716[_0xb1f8('0xe')]]['queuecallerexitreason']));}}}catch(_0x400f89){utils[_0xb1f8('0x1d')](util[_0xb1f8('0x3')]('[%s][queues][varset]',_0x3dd716[_0xb1f8('0xe')]),_0x400f89);}};exports[_0xb1f8('0x16')]=function(_0x2f0db8){try{if(!_['isNil'](queues[_0x2f0db8[_0xb1f8('0xe')]])){utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')](_0xb1f8('0x2b'),_0x2f0db8[_0xb1f8('0xe')]),_0x2f0db8);queues[_0x2f0db8[_0xb1f8('0xe')]][_0xb1f8('0x17')]=![];queues[_0x2f0db8[_0xb1f8('0xe')]]['queuecallerexitAt']=null;queues[_0x2f0db8[_0xb1f8('0xe')]]['queuecallerabandon']=!![];queues[_0x2f0db8['uniqueid']][_0xb1f8('0x27')]=utils['now']();queues[_0x2f0db8[_0xb1f8('0xe')]][_0xb1f8('0x8')]=_0xb1f8('0x2c');utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x2d'),_0x2f0db8[_0xb1f8('0xe')],queues[_0x2f0db8['uniqueid']][_0xb1f8('0x1c')],queues[_0x2f0db8[_0xb1f8('0xe')]][_0xb1f8('0x8')]));}}catch(_0x203562){utils[_0xb1f8('0x1d')](util[_0xb1f8('0x3')](_0xb1f8('0x2b'),_0x2f0db8[_0xb1f8('0xe')]),_0x203562);}};exports[_0xb1f8('0x2e')]=function(_0x2bb05b){try{if(!_[_0xb1f8('0x15')](queues[_0x2bb05b[_0xb1f8('0xe')]])){utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')](_0xb1f8('0x2f'),_0x2bb05b[_0xb1f8('0xe')]),_0x2bb05b);utils['info'](util['format'](_0xb1f8('0x30'),_0x2bb05b['uniqueid'],queues[_0x2bb05b[_0xb1f8('0xe')]][_0xb1f8('0x1c')],_0x2bb05b[_0xb1f8('0x31')],_0x2bb05b[_0xb1f8('0x32')]));queues[_0x2bb05b['uniqueid']]['queuecallerleave']=!![];queues[_0x2bb05b[_0xb1f8('0xe')]][_0xb1f8('0x33')]=utils[_0xb1f8('0x13')]();queues[_0x2bb05b[_0xb1f8('0xe')]][_0xb1f8('0x34')]=utils[_0xb1f8('0x35')](queues[_0x2bb05b[_0xb1f8('0xe')]][_0xb1f8('0x33')],queues[_0x2bb05b['uniqueid']][_0xb1f8('0x36')]);queues[_0x2bb05b[_0xb1f8('0xe')]]['position']=_0x2bb05b[_0xb1f8('0x12')];queues[_0x2bb05b['uniqueid']][_0xb1f8('0x37')]=_0x2bb05b[_0xb1f8('0x37')];queues[_0x2bb05b[_0xb1f8('0xe')]]['connectedlinenum']=_0x2bb05b[_0xb1f8('0x31')];queues[_0x2bb05b[_0xb1f8('0xe')]][_0xb1f8('0x32')]=_0x2bb05b['connectedlinename'];}}catch(_0x361a48){utils[_0xb1f8('0x1d')](util['format'](_0xb1f8('0x2f'),_0x2bb05b['uniqueid']),_0x361a48);}};exports[_0xb1f8('0x38')]=function(_0x3f4505){try{if(!_[_0xb1f8('0x15')](queues[_0x3f4505[_0xb1f8('0xe')]])){utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')](_0xb1f8('0x39'),_0x3f4505[_0xb1f8('0xe')]),_0x3f4505);utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x3a'),_0x3f4505[_0xb1f8('0xe')],queues[_0x3f4505[_0xb1f8('0xe')]][_0xb1f8('0x1c')],_0x3f4505[_0xb1f8('0x3b')],_0x3f4505['destaccountcode']));queues[_0x3f4505['uniqueid']][_0xb1f8('0x16')]=![];queues[_0x3f4505[_0xb1f8('0xe')]][_0xb1f8('0x16')]=![];queues[_0x3f4505[_0xb1f8('0xe')]][_0xb1f8('0x27')]=null;queues[_0x3f4505[_0xb1f8('0xe')]][_0xb1f8('0x17')]=![];queues[_0x3f4505['uniqueid']]['queuecallerexitreason']=null;queues[_0x3f4505[_0xb1f8('0xe')]][_0xb1f8('0x28')]=null;queues[_0x3f4505[_0xb1f8('0xe')]]['assigned']=!![];queues[_0x3f4505['uniqueid']][_0xb1f8('0x3c')]=_0x3f4505[_0xb1f8('0x3d')];queues[_0x3f4505['uniqueid']][_0xb1f8('0x3e')]=_0x3f4505['membername'];}}catch(_0x340ba1){utils['error'](util['format']('[%s][queues][agentconnect]',_0x3f4505[_0xb1f8('0xe')]),_0x340ba1);}};exports[_0xb1f8('0x3f')]=function(_0x1319fa){try{if(!_['isNil'](queues[_0x1319fa[_0xb1f8('0xe')]])){if(queues[_0x1319fa['uniqueid']][_0xb1f8('0x33')]){utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')]('[%s][queues][agentcomplete]',_0x1319fa[_0xb1f8('0xe')]),_0x1319fa);queues[_0x1319fa[_0xb1f8('0xe')]]['queuecallerabandon']=![];queues[_0x1319fa[_0xb1f8('0xe')]]['queuecallerabandon']=![];queues[_0x1319fa['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1319fa['uniqueid']][_0xb1f8('0x17')]=![];queues[_0x1319fa[_0xb1f8('0xe')]][_0xb1f8('0x28')]=null;queues[_0x1319fa['uniqueid']]['assigned']=!![];queues[_0x1319fa[_0xb1f8('0xe')]]['lastAssignedTo']=_0x1319fa[_0xb1f8('0x3b')];queues[_0x1319fa['uniqueid']][_0xb1f8('0x18')]=!![];queues[_0x1319fa['uniqueid']][_0xb1f8('0x19')]=utils[_0xb1f8('0x13')]();if(_0x1319fa[_0xb1f8('0x40')]=='transfer'){if(!queues[_0x1319fa[_0xb1f8('0xe')]][_0xb1f8('0x41')]){queues[_0x1319fa[_0xb1f8('0xe')]]['queuecallerexitreason']=_0xb1f8('0x42');}}else{queues[_0x1319fa['uniqueid']][_0xb1f8('0x8')]=_0xb1f8('0x43')+_0x1319fa[_0xb1f8('0x40')][_0xb1f8('0x22')]();}utils[_0xb1f8('0x2')](util['format'](_0xb1f8('0x44'),_0x1319fa[_0xb1f8('0xe')],queues[_0x1319fa['uniqueid']][_0xb1f8('0x1c')],_0x1319fa[_0xb1f8('0x3b')],queues[_0x1319fa[_0xb1f8('0xe')]][_0xb1f8('0x8')]));writeDB(queues[_0x1319fa[_0xb1f8('0xe')]]);}}}catch(_0x3af774){utils[_0xb1f8('0x1d')](util[_0xb1f8('0x3')](_0xb1f8('0x45'),_0x1319fa[_0xb1f8('0xe')]),_0x3af774);}};exports['blindtransfer']=function(_0x3d18f2){try{if(!_[_0xb1f8('0x15')](queues[_0x3d18f2[_0xb1f8('0x46')]])){utils[_0xb1f8('0x10')](util['format'](_0xb1f8('0x47'),_0x3d18f2[_0xb1f8('0xe')]),_0x3d18f2);queues[_0x3d18f2[_0xb1f8('0x46')]]['transfer']=!![];queues[_0x3d18f2[_0xb1f8('0x46')]][_0xb1f8('0x48')]=_0xb1f8('0x49');queues[_0x3d18f2[_0xb1f8('0x46')]]['transferexten']=_0x3d18f2[_0xb1f8('0x4a')];queues[_0x3d18f2[_0xb1f8('0x46')]]['transferuniqueid']=_0x3d18f2[_0xb1f8('0x46')];queues[_0x3d18f2[_0xb1f8('0x46')]][_0xb1f8('0x8')]=_0xb1f8('0x4b');utils['info'](util[_0xb1f8('0x3')](_0xb1f8('0x4c'),_0x3d18f2[_0xb1f8('0xe')],queues[_0x3d18f2[_0xb1f8('0x46')]][_0xb1f8('0x1c')],_0x3d18f2['transfereeuniqueid'],_0x3d18f2['extension']));}}catch(_0x5dec78){utils[_0xb1f8('0x1d')](util['format']('[%s][queues][blindtransfer]',_0x3d18f2[_0xb1f8('0xe')]),_0x5dec78);}};exports[_0xb1f8('0x4d')]=function(_0x5ed2f5){try{utils['debug'](util[_0xb1f8('0x3')](_0xb1f8('0x4e'),_0x5ed2f5['origtransfereruniqueid']),_0x5ed2f5);if(_0x5ed2f5[_0xb1f8('0x4f')]==_0x5ed2f5[_0xb1f8('0x50')]){if(!_[_0xb1f8('0x15')](queues[_0x5ed2f5[_0xb1f8('0x51')]])){utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x52'),_0x5ed2f5[_0xb1f8('0x4f')],queues[_0x5ed2f5[_0xb1f8('0x51')]][_0xb1f8('0x1c')],_0x5ed2f5[_0xb1f8('0x53')]));queues[_0x5ed2f5[_0xb1f8('0x51')]][_0xb1f8('0x41')]=!![];queues[_0x5ed2f5[_0xb1f8('0x51')]]['transfertype']='ATTENDED';queues[_0x5ed2f5['secondtransfererlinkedid']][_0xb1f8('0x54')]=_0x5ed2f5[_0xb1f8('0x53')];queues[_0x5ed2f5['secondtransfererlinkedid']]['transferuniqueid']=_0x5ed2f5['origtransfereruniqueid'];queues[_0x5ed2f5[_0xb1f8('0x51')]][_0xb1f8('0x8')]=_0xb1f8('0x55');}if(!_[_0xb1f8('0x15')](queues[_0x5ed2f5['origtransfererlinkedid']])){if(_0x5ed2f5[_0xb1f8('0x56')]&&queues[_0x5ed2f5[_0xb1f8('0x56')]]){queues[_0x5ed2f5[_0xb1f8('0x56')]]['queuecallerenterreason']=0x1;queues[_0x5ed2f5[_0xb1f8('0x46')]]=_[_0xb1f8('0x57')](queues[_0x5ed2f5[_0xb1f8('0x56')]]);queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0xd')]=_0x5ed2f5[_0xb1f8('0x58')];queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x59')]=0x2;queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x7')]=queues[_0x5ed2f5['secondtransfererlinkedid']][_0xb1f8('0x7')];queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x5a')]=queues[_0x5ed2f5[_0xb1f8('0x51')]]['calleridname'];queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x36')]=utils[_0xb1f8('0x13')]();queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x33')]=utils[_0xb1f8('0x13')]();queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x34')]=0x0;queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x5b')]=0x0;utils[_0xb1f8('0x2')](util['format'](_0xb1f8('0x5c'),_0x5ed2f5['origtransfereruniqueid'],queues[_0x5ed2f5['transfereeuniqueid']][_0xb1f8('0x1c')],queues[_0x5ed2f5[_0xb1f8('0x46')]][_0xb1f8('0x7')],queues[_0x5ed2f5['transfereeuniqueid']]['calleridname']));}else{utils[_0xb1f8('0x2')](util['format'](_0xb1f8('0x5d'),_0x5ed2f5['origtransfereruniqueid'],queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x1c')],_0x5ed2f5[_0xb1f8('0x51')]));queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0xd')]=_0x5ed2f5[_0xb1f8('0x51')];}}}else if(_0x5ed2f5[_0xb1f8('0x5e')]==_0x5ed2f5['secondtransfererlinkedid']){if(!_[_0xb1f8('0x15')](queues[_0x5ed2f5[_0xb1f8('0x50')]])){utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x5f'),_0x5ed2f5[_0xb1f8('0x4f')],queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x1c')],_0x5ed2f5[_0xb1f8('0x5e')],_0x5ed2f5[_0xb1f8('0x60')]));queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x41')]=!![];queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x48')]=_0xb1f8('0x61');queues[_0x5ed2f5['origtransfererlinkedid']][_0xb1f8('0x54')]=_0x5ed2f5[_0xb1f8('0x60')];queues[_0x5ed2f5[_0xb1f8('0x50')]]['transferuniqueid']=_0x5ed2f5[_0xb1f8('0x5e')];queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xb1f8('0x15')](queues[_0x5ed2f5[_0xb1f8('0x51')]])){if(_0x5ed2f5['transfertargetlinkedid']&&queues[_0x5ed2f5['transfertargetlinkedid']]){queues[_0x5ed2f5['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x5ed2f5[_0xb1f8('0x58')]]=_['clone'](queues[_0x5ed2f5[_0xb1f8('0x62')]]);queues[_0x5ed2f5['transfertargetuniqueid']][_0xb1f8('0xd')]=_0x5ed2f5[_0xb1f8('0x58')];queues[_0x5ed2f5[_0xb1f8('0x58')]][_0xb1f8('0x59')]=0x2;queues[_0x5ed2f5['transfertargetuniqueid']][_0xb1f8('0x7')]=queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x7')];queues[_0x5ed2f5[_0xb1f8('0x58')]][_0xb1f8('0x5a')]=queues[_0x5ed2f5[_0xb1f8('0x50')]][_0xb1f8('0x5a')];queues[_0x5ed2f5[_0xb1f8('0x58')]][_0xb1f8('0x36')]=utils[_0xb1f8('0x13')]();queues[_0x5ed2f5[_0xb1f8('0x58')]]['queuecallerleaveAt']=utils['now']();queues[_0x5ed2f5[_0xb1f8('0x58')]][_0xb1f8('0x34')]=0x0;queues[_0x5ed2f5[_0xb1f8('0x58')]]['mohtime']=0x0;utils['info'](util[_0xb1f8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5ed2f5['origtransfereruniqueid'],queues[_0x5ed2f5[_0xb1f8('0x58')]]['name'],queues[_0x5ed2f5['transfertargetuniqueid']][_0xb1f8('0xd')],queues[_0x5ed2f5[_0xb1f8('0x58')]][_0xb1f8('0x7')],queues[_0x5ed2f5['transfertargetuniqueid']][_0xb1f8('0x5a')]));}else{utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')](_0xb1f8('0x5d'),_0x5ed2f5['origtransfereruniqueid'],queues[_0x5ed2f5[_0xb1f8('0x51')]][_0xb1f8('0x1c')],_0x5ed2f5[_0xb1f8('0x50')]));queues[_0x5ed2f5[_0xb1f8('0x51')]][_0xb1f8('0xd')]=_0x5ed2f5[_0xb1f8('0x50')];}}}}catch(_0x33b6d1){utils[_0xb1f8('0x1d')](util[_0xb1f8('0x3')](_0xb1f8('0x4e'),_0x5ed2f5[_0xb1f8('0x4f')]),_0x33b6d1);}};exports[_0xb1f8('0x63')]=function(_0x156215){try{if(!_[_0xb1f8('0x15')](queues[_0x156215[_0xb1f8('0xe')]])){utils[_0xb1f8('0x10')](util[_0xb1f8('0x3')](_0xb1f8('0x64'),_0x156215[_0xb1f8('0xe')]),_0x156215);queues[_0x156215[_0xb1f8('0xe')]]['musiconholdstartAt']=utils[_0xb1f8('0x13')]();utils[_0xb1f8('0x2')](util['format'](_0xb1f8('0x65'),_0x156215['uniqueid'],queues[_0x156215[_0xb1f8('0xe')]][_0xb1f8('0x1c')],queues[_0x156215[_0xb1f8('0xe')]][_0xb1f8('0x66')]));}}catch(_0x363c22){utils[_0xb1f8('0x1d')](util['format'](_0xb1f8('0x64'),_0x156215['uniqueid']),_0x363c22);}};exports[_0xb1f8('0x67')]=function(_0x2c62f9){try{if(!_['isNil'](queues[_0x2c62f9[_0xb1f8('0xe')]])){if(!_[_0xb1f8('0x15')](queues[_0x2c62f9[_0xb1f8('0xe')]][_0xb1f8('0x66')])){utils[_0xb1f8('0x10')](util['format']('[%s][queues][musiconholdstop]',_0x2c62f9[_0xb1f8('0xe')]),_0x2c62f9);queues[_0x2c62f9[_0xb1f8('0xe')]][_0xb1f8('0x5b')]+=utils[_0xb1f8('0x35')](utils['now'](),queues[_0x2c62f9['uniqueid']]['musiconholdstartAt']);utils[_0xb1f8('0x2')](util[_0xb1f8('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x2c62f9[_0xb1f8('0xe')],queues[_0x2c62f9[_0xb1f8('0xe')]][_0xb1f8('0x1c')],queues[_0x2c62f9[_0xb1f8('0xe')]]['mohtime']));delete queues[_0x2c62f9[_0xb1f8('0xe')]][_0xb1f8('0x66')];}}}catch(_0x345473){utils[_0xb1f8('0x1d')](util[_0xb1f8('0x3')](_0xb1f8('0x68'),_0x2c62f9[_0xb1f8('0xe')]),_0x345473);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 41a7c99..81a6027 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 _0x7d08=['[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereruniqueid','recording','util','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','outbound','connectedlinename','forEach','clone'];(function(_0x23c394,_0xb6323b){var _0x35e6ac=function(_0x3a4fb9){while(--_0x3a4fb9){_0x23c394['push'](_0x23c394['shift']());}};_0x35e6ac(++_0xb6323b);}(_0x7d08,0xa0));var _0x87d0=function(_0x5256eb,_0x2e6837){_0x5256eb=_0x5256eb-0x0;var _0x172367=_0x7d08[_0x5256eb];return _0x172367;};'use strict';var _=require('lodash');var util=require(_0x87d0('0x0'));var utils=require('./utils');var transfers=require(_0x87d0('0x1'));var recordings={};function writeDB(_0x56d8b2){var _0x2bfdb2;utils[_0x87d0('0x2')](util[_0x87d0('0x3')](_0x87d0('0x4'),_0x56d8b2['uniqueid']));if(transfers[_0x87d0('0x5')][_0x56d8b2[_0x87d0('0x6')]]){_0x2bfdb2=_0x56d8b2[_0x87d0('0x6')];_0x56d8b2['uniqueid']=transfers[_0x87d0('0x5')][_0x56d8b2[_0x87d0('0x6')]]['transfereeuniqueid'];}if(_0x56d8b2[_0x87d0('0x7')]){utils[_0x87d0('0x8')](_0x56d8b2[_0x87d0('0x7')])[_0x87d0('0x9')](function(_0x39f40e){if(_0x39f40e){_0x56d8b2[_0x87d0('0xa')]=_0x39f40e['name'];_0x56d8b2[_0x87d0('0xb')]=_0x39f40e['id'];}utils[_0x87d0('0xc')]('CreateVoiceRecording',_0x56d8b2);});}else{utils[_0x87d0('0xc')](_0x87d0('0xd'),_0x56d8b2);}if(_0x2bfdb2)delete transfers[_0x87d0('0x5')][_0x2bfdb2];}exports['newchannel']=function(_0x56b57e){try{utils[_0x87d0('0xe')](util[_0x87d0('0x3')](_0x87d0('0xf'),_0x56b57e[_0x87d0('0x6')]),_0x56b57e);if(_0x56b57e['uniqueid']==_0x56b57e[_0x87d0('0x10')]){utils[_0x87d0('0x2')](util[_0x87d0('0x3')](_0x87d0('0x11'),_0x56b57e[_0x87d0('0x6')],_0x56b57e[_0x87d0('0x12')],_0x56b57e['exten']));recordings[_0x56b57e[_0x87d0('0x6')]]={'uniqueid':_0x56b57e[_0x87d0('0x6')],'accountcode':_0x56b57e[_0x87d0('0x7')],'exten':_0x56b57e[_0x87d0('0x13')],'context':_0x56b57e[_0x87d0('0x12')],'channel':_0x56b57e[_0x87d0('0x14')],'monitors':[]};}}catch(_0x5cc527){utils[_0x87d0('0x15')](util[_0x87d0('0x3')]('[%s][recordings][newchannel]',_0x56b57e['uniqueid']),_0x5cc527);}};exports['newstate']=function(_0x467013){try{utils[_0x87d0('0xe')](util[_0x87d0('0x3')](_0x87d0('0x16'),_0x467013['uniqueid']),_0x467013);if(!_[_0x87d0('0x17')](recordings[_0x467013[_0x87d0('0x6')]])&&_0x467013['channelstate']==0x6){utils[_0x87d0('0x2')](util[_0x87d0('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x467013['uniqueid'],_0x467013[_0x87d0('0x12')],_0x467013['channel']));}else if(!_[_0x87d0('0x17')](recordings[_0x467013[_0x87d0('0x10')]])&&_0x467013[_0x87d0('0x18')]==0x6&&_0x467013[_0x87d0('0x12')]!=_0x87d0('0x19')){utils[_0x87d0('0x2')](util[_0x87d0('0x3')](_0x87d0('0x1a'),_0x467013[_0x87d0('0x6')],_0x467013['linkedid'],_0x467013[_0x87d0('0x12')],_0x467013[_0x87d0('0x14')]));recordings[_0x467013[_0x87d0('0x10')]]['accountcode']=_0x467013[_0x87d0('0x7')];}}catch(_0x154369){utils[_0x87d0('0x15')](util['format']('[%s][recordings][newstate]',_0x467013[_0x87d0('0x6')]),_0x154369);}};exports[_0x87d0('0x1b')]=function(_0x3969ec){try{if(!_[_0x87d0('0x17')](_0x3969ec[_0x87d0('0x1c')])&&!_[_0x87d0('0x17')](_0x3969ec[_0x87d0('0x1c')][_0x87d0('0x1d')])){utils[_0x87d0('0xe')](util[_0x87d0('0x3')]('[%s][recordings][varset]',_0x3969ec[_0x87d0('0x6')]),_0x3969ec);utils['info'](util[_0x87d0('0x3')](_0x87d0('0x1e'),_0x3969ec['uniqueid'],_0x3969ec[_0x87d0('0x1c')],_0x3969ec[_0x87d0('0x1f')]));if(_[_0x87d0('0x20')](_0x3969ec['value'],_0x87d0('0x21'))){_0x3969ec['value']=_0x3969ec[_0x87d0('0x1f')]['replace'](_0x87d0('0x21'),_0x87d0('0x22'));}if(recordings[_0x3969ec[_0x87d0('0x10')]]){var _0x5d0e8f=_[_0x87d0('0x23')](recordings[_0x3969ec[_0x87d0('0x10')]]['monitors'],{'value':_0x3969ec[_0x87d0('0x1f')]});if(_['isNil'](_0x5d0e8f)){recordings[_0x3969ec[_0x87d0('0x10')]][_0x87d0('0x24')][_0x87d0('0x25')]({'value':_0x3969ec['value']});}}}}catch(_0x2a716c){utils['error'](util[_0x87d0('0x3')](_0x87d0('0x26'),_0x3969ec['uniqueid']),_0x2a716c);}};exports['hangup']=function(_0x4af1df){try{if(!_[_0x87d0('0x17')](recordings[_0x4af1df[_0x87d0('0x6')]])){utils[_0x87d0('0xe')](util[_0x87d0('0x3')]('[%s][recordings][hangup]',_0x4af1df[_0x87d0('0x6')]),_0x4af1df);utils[_0x87d0('0x2')](util[_0x87d0('0x3')](_0x87d0('0x27'),_0x4af1df[_0x87d0('0x6')],_0x4af1df[_0x87d0('0x28')],_0x4af1df['calleridname'],_0x4af1df['cause-txt']));recordings[_0x4af1df[_0x87d0('0x6')]][_0x87d0('0x28')]=_0x4af1df[_0x87d0('0x28')];recordings[_0x4af1df['uniqueid']][_0x87d0('0x29')]=_0x4af1df[_0x87d0('0x29')];recordings[_0x4af1df[_0x87d0('0x6')]]['connectedlinenum']=_0x4af1df[_0x87d0('0x2a')];recordings[_0x4af1df['uniqueid']]['connectedlinename']=_0x4af1df['connectedlinename'];if(recordings[_0x4af1df[_0x87d0('0x6')]]['type']==_0x87d0('0x2b')&&recordings[_0x4af1df[_0x87d0('0x6')]]['accountcode']){recordings[_0x4af1df[_0x87d0('0x6')]]['connectedlinenum']=recordings[_0x4af1df['uniqueid']][_0x87d0('0x7')];recordings[_0x4af1df['uniqueid']][_0x87d0('0x2c')]='';}recordings[_0x4af1df[_0x87d0('0x6')]]['monitors'][_0x87d0('0x2d')](function(_0x3d9a54){var _0x2fea55=_[_0x87d0('0x2e')](recordings[_0x4af1df[_0x87d0('0x6')]]);_0x2fea55['value']=_0x3d9a54[_0x87d0('0x1f')];writeDB(_0x2fea55);});delete recordings[_0x4af1df[_0x87d0('0x6')]];}}catch(_0x43a433){utils[_0x87d0('0x15')](util['format']('[%s][recordings][hangup]',_0x4af1df[_0x87d0('0x6')]),_0x43a433);}};exports['newexten']=function(_0x2e1107){try{if(!_[_0x87d0('0x17')](recordings[_0x2e1107['uniqueid']])){utils['debug'](util[_0x87d0('0x3')](_0x87d0('0x2f'),_0x2e1107[_0x87d0('0x6')]),_0x2e1107);utils['info'](util[_0x87d0('0x3')](_0x87d0('0x30'),_0x2e1107['uniqueid'],_0x2e1107['application'],_0x2e1107['appdata']));if(_0x2e1107[_0x87d0('0x31')][_0x87d0('0x32')]()==_0x87d0('0x33')&&_[_0x87d0('0x34')](_0x2e1107[_0x87d0('0x35')][_0x87d0('0x32')](),_0x87d0('0x36'))){var _0x3b2163=_0x2e1107[_0x87d0('0x35')][_0x87d0('0x37')]('=');var _0x845177=_0x3b2163[0x0][_0x87d0('0x38')](_0x3b2163[0x0][_0x87d0('0x39')]('(')+0x1,_0x3b2163[0x0]['lastIndexOf'](')'));var _0x180d99=_0x3b2163[0x1];recordings[_0x2e1107[_0x87d0('0x6')]][_0x845177]=_0x180d99;}}}catch(_0x21fcb0){utils[_0x87d0('0x15')](util[_0x87d0('0x3')]('[%s][recordings][newexten]',_0x2e1107['uniqueid']),_0x21fcb0);}};exports[_0x87d0('0x3a')]=function(_0x7c86e9){try{if(!_[_0x87d0('0x17')](recordings[_0x7c86e9[_0x87d0('0x6')]])){utils[_0x87d0('0xe')](util['format'](_0x87d0('0x3b'),_0x7c86e9[_0x87d0('0x6')]),_0x7c86e9);utils['info'](util['format'](_0x87d0('0x3c'),_0x7c86e9[_0x87d0('0x6')],_0x7c86e9[_0x87d0('0x3d')]));recordings[_0x7c86e9[_0x87d0('0x6')]][_0x87d0('0x3d')]=_0x7c86e9[_0x87d0('0x3d')];}}catch(_0x405fa8){utils[_0x87d0('0x15')](util['format']('[%s][recordings][queuecallerjoin]',_0x7c86e9[_0x87d0('0x6')]),_0x405fa8);}};exports[_0x87d0('0x3e')]=function(_0x2ec7f5){try{utils[_0x87d0('0xe')](util[_0x87d0('0x3')](_0x87d0('0x3f'),_0x2ec7f5['uniqueid']),_0x2ec7f5);utils[_0x87d0('0x2')](util[_0x87d0('0x3')](_0x87d0('0x40'),_0x2ec7f5['uniqueid'],_0x2ec7f5[_0x87d0('0x41')],_0x2ec7f5['transferercalleridname'],_0x2ec7f5[_0x87d0('0x42')],_0x2ec7f5['transfereecalleridname']));if(recordings[_0x2ec7f5[_0x87d0('0x43')]]&&transfers['blinds'][_0x2ec7f5[_0x87d0('0x43')]]){transfers[_0x87d0('0x5')][_0x2ec7f5[_0x87d0('0x43')]][_0x87d0('0x44')]=!![];}}catch(_0x178a9c){utils[_0x87d0('0x15')](util[_0x87d0('0x3')](_0x87d0('0x3f'),_0x2ec7f5[_0x87d0('0x6')]),_0x178a9c);}}; \ No newline at end of file +var _0xa23c=['appdata','toLowerCase','set','cdr','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s'];(function(_0x20b44e,_0x29a958){var _0x3c1a20=function(_0x40b1b9){while(--_0x40b1b9){_0x20b44e['push'](_0x20b44e['shift']());}};_0x3c1a20(++_0x29a958);}(_0xa23c,0x17e));var _0xca23=function(_0x5bfeb1,_0x11637a){_0x5bfeb1=_0x5bfeb1-0x0;var _0x417e08=_0xa23c[_0x5bfeb1];return _0x417e08;};'use strict';var _=require(_0xca23('0x0'));var util=require(_0xca23('0x1'));var utils=require(_0xca23('0x2'));var transfers=require(_0xca23('0x3'));var recordings={};function writeDB(_0x2d8170){var _0xb3c7d9;utils[_0xca23('0x4')](util[_0xca23('0x5')](_0xca23('0x6'),_0x2d8170[_0xca23('0x7')]));if(transfers[_0xca23('0x8')][_0x2d8170[_0xca23('0x7')]]){_0xb3c7d9=_0x2d8170[_0xca23('0x7')];_0x2d8170[_0xca23('0x7')]=transfers['blinds'][_0x2d8170['uniqueid']]['transfereeuniqueid'];}if(_0x2d8170[_0xca23('0x9')]){utils[_0xca23('0xa')](_0x2d8170[_0xca23('0x9')])[_0xca23('0xb')](function(_0x171e49){if(_0x171e49){_0x2d8170[_0xca23('0xc')]=_0x171e49[_0xca23('0xd')];_0x2d8170['UserId']=_0x171e49['id'];}utils['request'](_0xca23('0xe'),_0x2d8170);});}else{utils[_0xca23('0xf')]('CreateVoiceRecording',_0x2d8170);}if(_0xb3c7d9)delete transfers[_0xca23('0x8')][_0xb3c7d9];}exports[_0xca23('0x10')]=function(_0x485dbb){try{utils[_0xca23('0x11')](util[_0xca23('0x5')](_0xca23('0x12'),_0x485dbb[_0xca23('0x7')]),_0x485dbb);if(_0x485dbb[_0xca23('0x7')]==_0x485dbb[_0xca23('0x13')]){utils['info'](util[_0xca23('0x5')](_0xca23('0x14'),_0x485dbb[_0xca23('0x7')],_0x485dbb[_0xca23('0x15')],_0x485dbb['exten']));recordings[_0x485dbb['uniqueid']]={'uniqueid':_0x485dbb[_0xca23('0x7')],'accountcode':_0x485dbb[_0xca23('0x9')],'exten':_0x485dbb[_0xca23('0x16')],'context':_0x485dbb[_0xca23('0x15')],'channel':_0x485dbb['channel'],'monitors':[]};}}catch(_0x375f1f){utils[_0xca23('0x17')](util[_0xca23('0x5')](_0xca23('0x12'),_0x485dbb[_0xca23('0x7')]),_0x375f1f);}};exports[_0xca23('0x18')]=function(_0x4fab48){try{utils[_0xca23('0x11')](util[_0xca23('0x5')](_0xca23('0x19'),_0x4fab48[_0xca23('0x7')]),_0x4fab48);if(!_[_0xca23('0x1a')](recordings[_0x4fab48[_0xca23('0x7')]])&&_0x4fab48[_0xca23('0x1b')]==0x6){utils[_0xca23('0x4')](util[_0xca23('0x5')](_0xca23('0x1c'),_0x4fab48['uniqueid'],_0x4fab48['context'],_0x4fab48[_0xca23('0x1d')]));}else if(!_[_0xca23('0x1a')](recordings[_0x4fab48['linkedid']])&&_0x4fab48['channelstate']==0x6&&_0x4fab48[_0xca23('0x15')]!=_0xca23('0x1e')){utils[_0xca23('0x4')](util[_0xca23('0x5')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4fab48[_0xca23('0x7')],_0x4fab48[_0xca23('0x13')],_0x4fab48[_0xca23('0x15')],_0x4fab48[_0xca23('0x1d')]));recordings[_0x4fab48[_0xca23('0x13')]][_0xca23('0x9')]=_0x4fab48['accountcode'];}}catch(_0x1dcc35){utils[_0xca23('0x17')](util['format'](_0xca23('0x19'),_0x4fab48[_0xca23('0x7')]),_0x1dcc35);}};exports[_0xca23('0x1f')]=function(_0xb78d25){try{if(!_[_0xca23('0x1a')](_0xb78d25[_0xca23('0x20')])&&!_[_0xca23('0x1a')](_0xb78d25['variable'][_0xca23('0x21')])){utils[_0xca23('0x11')](util[_0xca23('0x5')](_0xca23('0x22'),_0xb78d25[_0xca23('0x7')]),_0xb78d25);utils[_0xca23('0x4')](util[_0xca23('0x5')](_0xca23('0x23'),_0xb78d25['uniqueid'],_0xb78d25[_0xca23('0x20')],_0xb78d25[_0xca23('0x24')]));if(_[_0xca23('0x25')](_0xb78d25[_0xca23('0x24')],_0xca23('0x26'))){_0xb78d25['value']=_0xb78d25[_0xca23('0x24')][_0xca23('0x27')]('.wav49','.WAV');}if(recordings[_0xb78d25[_0xca23('0x13')]]){var _0x21b57b=_['find'](recordings[_0xb78d25[_0xca23('0x13')]]['monitors'],{'value':_0xb78d25[_0xca23('0x24')]});if(_[_0xca23('0x1a')](_0x21b57b)){recordings[_0xb78d25[_0xca23('0x13')]][_0xca23('0x28')]['push']({'value':_0xb78d25[_0xca23('0x24')]});}}}}catch(_0x257958){utils[_0xca23('0x17')](util['format'](_0xca23('0x22'),_0xb78d25[_0xca23('0x7')]),_0x257958);}};exports[_0xca23('0x29')]=function(_0x1444fb){try{if(!_[_0xca23('0x1a')](recordings[_0x1444fb['uniqueid']])){utils[_0xca23('0x11')](util[_0xca23('0x5')](_0xca23('0x2a'),_0x1444fb[_0xca23('0x7')]),_0x1444fb);utils['info'](util[_0xca23('0x5')](_0xca23('0x2b'),_0x1444fb[_0xca23('0x7')],_0x1444fb[_0xca23('0x2c')],_0x1444fb[_0xca23('0x2d')],_0x1444fb[_0xca23('0x2e')]));recordings[_0x1444fb[_0xca23('0x7')]][_0xca23('0x2c')]=_0x1444fb['calleridnum'];recordings[_0x1444fb['uniqueid']][_0xca23('0x2d')]=_0x1444fb[_0xca23('0x2d')];recordings[_0x1444fb[_0xca23('0x7')]]['connectedlinenum']=_0x1444fb[_0xca23('0x2f')];recordings[_0x1444fb['uniqueid']][_0xca23('0x30')]=_0x1444fb['connectedlinename'];if(recordings[_0x1444fb[_0xca23('0x7')]][_0xca23('0x31')]==_0xca23('0x32')&&recordings[_0x1444fb['uniqueid']][_0xca23('0x9')]){recordings[_0x1444fb['uniqueid']][_0xca23('0x2f')]=recordings[_0x1444fb[_0xca23('0x7')]][_0xca23('0x9')];recordings[_0x1444fb['uniqueid']][_0xca23('0x30')]='';}recordings[_0x1444fb[_0xca23('0x7')]][_0xca23('0x28')][_0xca23('0x33')](function(_0x495c5c){var _0x1447fc=_[_0xca23('0x34')](recordings[_0x1444fb[_0xca23('0x7')]]);_0x1447fc[_0xca23('0x24')]=_0x495c5c[_0xca23('0x24')];writeDB(_0x1447fc);});delete recordings[_0x1444fb[_0xca23('0x7')]];}}catch(_0x54da4b){utils[_0xca23('0x17')](util[_0xca23('0x5')]('[%s][recordings][hangup]',_0x1444fb[_0xca23('0x7')]),_0x54da4b);}};exports[_0xca23('0x35')]=function(_0x377f74){try{if(!_[_0xca23('0x1a')](recordings[_0x377f74['uniqueid']])){utils[_0xca23('0x11')](util[_0xca23('0x5')](_0xca23('0x36'),_0x377f74[_0xca23('0x7')]),_0x377f74);utils[_0xca23('0x4')](util[_0xca23('0x5')](_0xca23('0x37'),_0x377f74[_0xca23('0x7')],_0x377f74['application'],_0x377f74[_0xca23('0x38')]));if(_0x377f74['application'][_0xca23('0x39')]()==_0xca23('0x3a')&&_['startsWith'](_0x377f74[_0xca23('0x38')][_0xca23('0x39')](),_0xca23('0x3b'))){var _0x15ede2=_0x377f74[_0xca23('0x38')]['split']('=');var _0x271079=_0x15ede2[0x0][_0xca23('0x3c')](_0x15ede2[0x0][_0xca23('0x3d')]('(')+0x1,_0x15ede2[0x0][_0xca23('0x3d')](')'));var _0x1202b0=_0x15ede2[0x1];recordings[_0x377f74[_0xca23('0x7')]][_0x271079]=_0x1202b0;}}}catch(_0x308964){utils['error'](util['format'](_0xca23('0x36'),_0x377f74[_0xca23('0x7')]),_0x308964);}};exports[_0xca23('0x3e')]=function(_0x3019dc){try{if(!_[_0xca23('0x1a')](recordings[_0x3019dc[_0xca23('0x7')]])){utils[_0xca23('0x11')](util[_0xca23('0x5')]('[%s][recordings][queuecallerjoin]',_0x3019dc[_0xca23('0x7')]),_0x3019dc);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3019dc[_0xca23('0x7')],_0x3019dc[_0xca23('0x3f')]));recordings[_0x3019dc['uniqueid']][_0xca23('0x3f')]=_0x3019dc['queue'];}}catch(_0x52805b){utils['error'](util[_0xca23('0x5')](_0xca23('0x40'),_0x3019dc[_0xca23('0x7')]),_0x52805b);}};exports[_0xca23('0x41')]=function(_0x237672){try{utils[_0xca23('0x11')](util[_0xca23('0x5')](_0xca23('0x42'),_0x237672[_0xca23('0x7')]),_0x237672);utils['info'](util[_0xca23('0x5')](_0xca23('0x43'),_0x237672[_0xca23('0x7')],_0x237672['transferercalleridnum'],_0x237672[_0xca23('0x44')],_0x237672[_0xca23('0x45')],_0x237672[_0xca23('0x46')]));if(recordings[_0x237672[_0xca23('0x47')]]&&transfers['blinds'][_0x237672[_0xca23('0x47')]]){transfers[_0xca23('0x8')][_0x237672[_0xca23('0x47')]][_0xca23('0x48')]=!![];}}catch(_0x5cf653){utils[_0xca23('0x17')](util[_0xca23('0x5')](_0xca23('0x42'),_0x237672['uniqueid']),_0x5cf653);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 0fda618..5502e56 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 _0x3b9e=['[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','info','format','attended','uniqueid','type','request','blinds','blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','[%s][transfers][blindtransfer]','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid'];(function(_0x31f8a9,_0x1e1165){var _0x136850=function(_0x117c7a){while(--_0x117c7a){_0x31f8a9['push'](_0x31f8a9['shift']());}};_0x136850(++_0x1e1165);}(_0x3b9e,0x156));var _0xe3b9=function(_0xaee914,_0x3e601d){_0xaee914=_0xaee914-0x0;var _0x52ec79=_0x3b9e[_0xaee914];return _0x52ec79;};'use strict';var _=require(_0xe3b9('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x394587){utils[_0xe3b9('0x1')](util[_0xe3b9('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x394587['type']===_0xe3b9('0x3')?_0x394587['origtransfereruniqueid']:_0x394587[_0xe3b9('0x4')],_0x394587[_0xe3b9('0x5')]));utils[_0xe3b9('0x6')]('CreateVoiceTransferReport',_0x394587);}exports[_0xe3b9('0x7')]={};exports[_0xe3b9('0x8')]=function(_0x255540){try{utils['debug'](util[_0xe3b9('0x2')]('[%s][transfers][blindtransfer]',_0x255540[_0xe3b9('0x4')]),_0x255540);utils[_0xe3b9('0x1')](util['format'](_0xe3b9('0x9'),_0x255540[_0xe3b9('0x4')],_0x255540[_0xe3b9('0xa')],_0x255540[_0xe3b9('0xb')],_0x255540[_0xe3b9('0xc')],_0x255540[_0xe3b9('0xd')]));_0x255540[_0xe3b9('0x5')]='blind';exports['blinds'][_0x255540['transfereruniqueid']]=_0x255540;writeDB(_0x255540);}catch(_0x73109c){utils['error'](util[_0xe3b9('0x2')](_0xe3b9('0xe'),_0x255540[_0xe3b9('0x4')]),_0x73109c);}};exports['attendedtransfer']=function(_0x50aa46){try{utils[_0xe3b9('0xf')](util[_0xe3b9('0x2')](_0xe3b9('0x10'),_0x50aa46[_0xe3b9('0x11')]),_0x50aa46);utils[_0xe3b9('0x1')](util[_0xe3b9('0x2')](_0xe3b9('0x12'),_0x50aa46[_0xe3b9('0x11')],_0x50aa46[_0xe3b9('0x13')],_0x50aa46[_0xe3b9('0x14')],_0x50aa46[_0xe3b9('0x15')],_0x50aa46['transfertargetcalleridname']));_0x50aa46=_[_0xe3b9('0x16')](_0x50aa46,{'transfererchannel':_0x50aa46[_0xe3b9('0x17')],'transferercalleridnum':_0x50aa46[_0xe3b9('0x13')],'transferercalleridname':_0x50aa46[_0xe3b9('0x14')],'transfererconnectedlinenum':_0x50aa46[_0xe3b9('0x18')],'transfererconnectedlinename':_0x50aa46[_0xe3b9('0x19')],'transfereraccountcode':_0x50aa46[_0xe3b9('0x1a')],'transferercontext':_0x50aa46[_0xe3b9('0x1b')],'transfererexten':_0x50aa46['secondtransfererexten'],'transfererlinkedid':_0x50aa46[_0xe3b9('0x1c')],'context':_0x50aa46[_0xe3b9('0x1d')],'extension':_0x50aa46['origtransfererexten'],'type':_0xe3b9('0x3')});if(_[_0xe3b9('0x1e')](_0x50aa46['transfereechannel'])){_0x50aa46=_['assign'](_0x50aa46,{'transfereechannel':_0x50aa46['transfertargetchannel'],'transfereecalleridnum':_0x50aa46[_0xe3b9('0x15')],'transfereecalleridname':_0x50aa46['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x50aa46[_0xe3b9('0x1f')],'transfereeconnectedlinename':_0x50aa46[_0xe3b9('0x20')],'transfereeaccountcode':_0x50aa46['transfertargetaccountcode'],'transfereecontext':_0x50aa46[_0xe3b9('0x21')],'transfereeexten':_0x50aa46[_0xe3b9('0x22')],'transfereelinkedid':_0x50aa46[_0xe3b9('0x23')]});}writeDB(_0x50aa46);}catch(_0x1f4d01){utils['error'](util[_0xe3b9('0x2')](_0xe3b9('0x10'),_0x50aa46[_0xe3b9('0x11')]),_0x1f4d01);}}; \ No newline at end of file +var _0xb6fb=['transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','attended','transfereechannel','assign','transfertargetchannel','transfertargetaccountcode','transfertargetexten','origtransfereruniqueid','lodash','info','[%s][transfers][writeDB]\x20type:%s','uniqueid','type','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname'];(function(_0xa4c1dc,_0x2c9a85){var _0x2308f6=function(_0x5dc7dd){while(--_0x5dc7dd){_0xa4c1dc['push'](_0xa4c1dc['shift']());}};_0x2308f6(++_0x2c9a85);}(_0xb6fb,0xef));var _0xbb6f=function(_0x5c2b44,_0x48bf27){_0x5c2b44=_0x5c2b44-0x0;var _0x67a96f=_0xb6fb[_0x5c2b44];return _0x67a96f;};'use strict';var _=require(_0xbb6f('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x3a4f82){utils[_0xbb6f('0x1')](util['format'](_0xbb6f('0x2'),_0x3a4f82['type']==='attended'?_0x3a4f82['origtransfereruniqueid']:_0x3a4f82[_0xbb6f('0x3')],_0x3a4f82[_0xbb6f('0x4')]));utils['request'](_0xbb6f('0x5'),_0x3a4f82);}exports[_0xbb6f('0x6')]={};exports[_0xbb6f('0x7')]=function(_0x2f03f7){try{utils[_0xbb6f('0x8')](util[_0xbb6f('0x9')](_0xbb6f('0xa'),_0x2f03f7[_0xbb6f('0x3')]),_0x2f03f7);utils[_0xbb6f('0x1')](util[_0xbb6f('0x9')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2f03f7[_0xbb6f('0x3')],_0x2f03f7[_0xbb6f('0xb')],_0x2f03f7[_0xbb6f('0xc')],_0x2f03f7['transfereecalleridnum'],_0x2f03f7[_0xbb6f('0xd')]));_0x2f03f7[_0xbb6f('0x4')]=_0xbb6f('0xe');exports[_0xbb6f('0x6')][_0x2f03f7[_0xbb6f('0xf')]]=_0x2f03f7;writeDB(_0x2f03f7);}catch(_0x478504){utils[_0xbb6f('0x10')](util[_0xbb6f('0x9')]('[%s][transfers][blindtransfer]',_0x2f03f7[_0xbb6f('0x3')]),_0x478504);}};exports[_0xbb6f('0x11')]=function(_0x314704){try{utils[_0xbb6f('0x8')](util[_0xbb6f('0x9')](_0xbb6f('0x12'),_0x314704['origtransfereruniqueid']),_0x314704);utils[_0xbb6f('0x1')](util[_0xbb6f('0x9')](_0xbb6f('0x13'),_0x314704['origtransfereruniqueid'],_0x314704[_0xbb6f('0x14')],_0x314704[_0xbb6f('0x15')],_0x314704[_0xbb6f('0x16')],_0x314704[_0xbb6f('0x17')]));_0x314704=_['assign'](_0x314704,{'transfererchannel':_0x314704['origtransfererchannel'],'transferercalleridnum':_0x314704[_0xbb6f('0x14')],'transferercalleridname':_0x314704[_0xbb6f('0x15')],'transfererconnectedlinenum':_0x314704['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x314704[_0xbb6f('0x18')],'transfereraccountcode':_0x314704[_0xbb6f('0x19')],'transferercontext':_0x314704[_0xbb6f('0x1a')],'transfererexten':_0x314704['secondtransfererexten'],'transfererlinkedid':_0x314704['origtransfererlinkedid'],'context':_0x314704[_0xbb6f('0x1b')],'extension':_0x314704[_0xbb6f('0x1c')],'type':_0xbb6f('0x1d')});if(_['isNil'](_0x314704[_0xbb6f('0x1e')])){_0x314704=_[_0xbb6f('0x1f')](_0x314704,{'transfereechannel':_0x314704[_0xbb6f('0x20')],'transfereecalleridnum':_0x314704[_0xbb6f('0x16')],'transfereecalleridname':_0x314704[_0xbb6f('0x17')],'transfereeconnectedlinenum':_0x314704['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x314704['transfertargetconnectedlinename'],'transfereeaccountcode':_0x314704[_0xbb6f('0x21')],'transfereecontext':_0x314704['transfertargetcontext'],'transfereeexten':_0x314704[_0xbb6f('0x22')],'transfereelinkedid':_0x314704['transfertargetlinkedid']});}writeDB(_0x314704);}catch(_0x2b656b){utils['error'](util['format'](_0xbb6f('0x12'),_0x314704[_0xbb6f('0x23')]),_0x2b656b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c3ae2e5..1bc720c 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 _0x53f5=['getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','../../config/logger','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x53f5,0x198));var _0x553f=function(_0x518cd1,_0x366d53){_0x518cd1=_0x518cd1-0x0;var _0x40d339=_0x53f5[_0x518cd1];return _0x40d339;};'use strict';var BPromise=require(_0x553f('0x0'));var jayson=require(_0x553f('0x1'));var moment=require('moment');var util=require(_0x553f('0x2'));var client=jayson[_0x553f('0x3')]['http']({'port':0x2329});var logger=require(_0x553f('0x4'))(_0x553f('0x5'));exports[_0x553f('0x6')]=function(_0x4bb208,_0x464e62){logger[_0x553f('0x6')](_0x4bb208,_0x464e62?util[_0x553f('0x7')](_0x464e62,{'showHidden':![],'depth':null}):'');};exports[_0x553f('0x8')]=function(_0x3a96a6,_0x2dd7c1){logger[_0x553f('0x8')](_0x3a96a6,_0x2dd7c1?util['inspect'](_0x2dd7c1,{'showHidden':![],'depth':null}):'');};exports[_0x553f('0x9')]=function(_0xf068a4,_0x4bb451){logger['error'](_0xf068a4,_0x4bb451?util[_0x553f('0x7')](_0x4bb451,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3b46e6,_0x1b0637){return client[_0x553f('0xa')](_0x3b46e6,{'body':_0x1b0637})['then'](function(_0x471f7e){logger[_0x553f('0x8')]('[utils][request]\x20name:%s',_0x3b46e6,_0x471f7e?util['inspect'](_0x471f7e,{'showHidden':![],'depth':null}):'');})[_0x553f('0xb')](function(_0x281b28){logger[_0x553f('0x9')](_0x553f('0xc'),_0x3b46e6,_0x281b28?util[_0x553f('0x7')](_0x281b28,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2d15ee){return client[_0x553f('0xa')](_0x553f('0xd'),{'options':{'raw':!![],'attributes':['id',_0x553f('0xe'),'name',_0x553f('0xf')],'where':_0x2d15ee,'limit':0x1}})['then'](function(_0x3b536c){logger[_0x553f('0x8')](_0x553f('0x10'),JSON[_0x553f('0x11')](_0x2d15ee),_0x3b536c?util[_0x553f('0x7')](_0x3b536c,{'showHidden':![],'depth':null}):'');return _0x3b536c[_0x553f('0x12')][_0x553f('0x13')]?_0x3b536c[_0x553f('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x46f83f){return new BPromise(function(_0x54b94c,_0x266549){if(_0x46f83f){return getUser({'internal':_0x46f83f})[_0x553f('0x14')](function(_0x7a4ae5){logger['info'](_0x553f('0x15'),_0x46f83f,_0x7a4ae5?_0x553f('0x16'):'notfound');return _0x54b94c(_0x7a4ae5);})[_0x553f('0xb')](function(_0x38b99d){logger[_0x553f('0x9')](_0x553f('0x17'),_0x38b99d?util[_0x553f('0x7')](_0x38b99d,{'showHidden':![],'depth':null}):'');return _0x54b94c(null);});}return _0x54b94c(null);});};exports[_0x553f('0x18')]=function(_0xfef34d){return new BPromise(function(_0x3a05fd,_0x1a045f){if(_0xfef34d){return getUser({'interface':_0xfef34d})[_0x553f('0x14')](function(_0x2029b9){logger[_0x553f('0x6')](_0x553f('0x19'),_0xfef34d,_0x2029b9?'found':_0x553f('0x1a'));return _0x3a05fd(_0x2029b9);})['catch'](function(_0x36b518){logger['error']('[utils][getUserByInterface]',_0x36b518?util[_0x553f('0x7')](_0x36b518,{'showHidden':![],'depth':null}):'');return _0x3a05fd(null);});}return _0x3a05fd(null);});};exports[_0x553f('0x1b')]=function(_0x37297a){return new BPromise(function(_0x393086,_0x545640){if(_0x37297a){return getUser({'name':_0x37297a})[_0x553f('0x14')](function(_0x133c3a){logger[_0x553f('0x6')](_0x553f('0x1c'),_0x37297a,_0x133c3a?'found':'notfound');return _0x393086(_0x133c3a);})['catch'](function(_0x4540fa){logger['error'](_0x553f('0x1d'),_0x4540fa?util[_0x553f('0x7')](_0x4540fa,{'showHidden':![],'depth':null}):'');return _0x393086(null);});}return _0x393086(null);});};exports[_0x553f('0x1e')]=function(_0x54cca4){return new BPromise(function(_0x75d756,_0x46f509){if(_0x54cca4){return client[_0x553f('0xa')](_0x553f('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x553f('0x20'),_0x553f('0x21'),_0x553f('0x22'),'acwTimeout'],'where':{'name':_0x54cca4},'limit':0x1}})['then'](function(_0x3150b3){logger[_0x553f('0x8')](_0x553f('0x23'),_0x54cca4,_0x3150b3?util['inspect'](_0x3150b3,{'showHidden':![],'depth':null}):'');logger[_0x553f('0x6')](_0x553f('0x24'),_0x54cca4,_0x3150b3?_0x553f('0x16'):_0x553f('0x1a'));return _0x75d756(_0x3150b3[_0x553f('0x12')][_0x553f('0x13')]?_0x3150b3[_0x553f('0x12')][0x0]:null);})[_0x553f('0xb')](function(_0x1478ee){logger[_0x553f('0x9')](_0x553f('0x25'),_0x1478ee?util[_0x553f('0x7')](_0x1478ee,{'showHidden':![],'depth':null}):'');return _0x75d756(null);});}return _0x75d756(null);});};exports[_0x553f('0x26')]=function(_0x2503ce,_0x5d98a5){return moment(_0x2503ce)[_0x553f('0x27')](_0x5d98a5,_0x553f('0x28'))[_0x553f('0x29')](_0x553f('0x2a'));};exports[_0x553f('0x2b')]=function(_0x5d4469,_0x3880a3){return moment(_0x5d4469)['subtract'](_0x3880a3,_0x553f('0x28'))[_0x553f('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x553f('0x2c')]=function(_0x15d9f6,_0x431211){return moment(_0x15d9f6)['diff'](moment(_0x431211),_0x553f('0x28'));};exports['sumTime']=function(_0x57c6c3,_0x38ea6d){return parseInt(_0x57c6c3,0xa)+parseInt(_0x38ea6d,0xa);};exports[_0x553f('0x2d')]=function(){return moment()[_0x553f('0x29')](_0x553f('0x2a'));};exports['isAfter']=function(_0x7b02e6,_0x31cf3c){if(_0x31cf3c){return moment(_0x7b02e6)[_0x553f('0x2e')](_0x31cf3c);}return!![];};exports[_0x553f('0x2f')]=function(_0x4dcffa,_0x3380fe){if(_0x3380fe){return moment(_0x4dcffa)[_0x553f('0x2f')](_0x3380fe);}else if(_0x4dcffa){return!![];}return![];}; \ No newline at end of file +var _0x9e84=['diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x9e84,0x196));var _0x49e8=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x9e84[_0x3ce2c4];return _0x4047c1;};'use strict';var BPromise=require(_0x49e8('0x0'));var jayson=require(_0x49e8('0x1'));var moment=require(_0x49e8('0x2'));var util=require('util');var client=jayson['client'][_0x49e8('0x3')]({'port':0x2329});var logger=require(_0x49e8('0x4'))(_0x49e8('0x5'));exports[_0x49e8('0x6')]=function(_0x1c6545,_0x5e1f4c){logger[_0x49e8('0x6')](_0x1c6545,_0x5e1f4c?util[_0x49e8('0x7')](_0x5e1f4c,{'showHidden':![],'depth':null}):'');};exports[_0x49e8('0x8')]=function(_0x53d2b9,_0x145220){logger[_0x49e8('0x8')](_0x53d2b9,_0x145220?util[_0x49e8('0x7')](_0x145220,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x125903,_0x24b893){logger[_0x49e8('0x9')](_0x125903,_0x24b893?util['inspect'](_0x24b893,{'showHidden':![],'depth':null}):'');};exports[_0x49e8('0xa')]=function(_0x5626d0,_0x4b93d0){return client[_0x49e8('0xa')](_0x5626d0,{'body':_0x4b93d0})[_0x49e8('0xb')](function(_0x59b485){logger['debug'](_0x49e8('0xc'),_0x5626d0,_0x59b485?util[_0x49e8('0x7')](_0x59b485,{'showHidden':![],'depth':null}):'');})[_0x49e8('0xd')](function(_0x3ec1d8){logger[_0x49e8('0x9')](_0x49e8('0xc'),_0x5626d0,_0x3ec1d8?util['inspect'](_0x3ec1d8,{'showHidden':![],'depth':null}):'');});};function getUser(_0xea59c2){return client[_0x49e8('0xa')](_0x49e8('0xe'),{'options':{'raw':!![],'attributes':['id',_0x49e8('0xf'),'name',_0x49e8('0x10')],'where':_0xea59c2,'limit':0x1}})[_0x49e8('0xb')](function(_0x5273fe){logger[_0x49e8('0x8')](_0x49e8('0x11'),JSON[_0x49e8('0x12')](_0xea59c2),_0x5273fe?util[_0x49e8('0x7')](_0x5273fe,{'showHidden':![],'depth':null}):'');return _0x5273fe['result'][_0x49e8('0x13')]?_0x5273fe[_0x49e8('0x14')][0x0]:null;});}exports[_0x49e8('0x15')]=function(_0x13abd9){return new BPromise(function(_0x100e2a,_0x442371){if(_0x13abd9){return getUser({'internal':_0x13abd9})[_0x49e8('0xb')](function(_0x3ddfe7){logger[_0x49e8('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x13abd9,_0x3ddfe7?'found':_0x49e8('0x16'));return _0x100e2a(_0x3ddfe7);})[_0x49e8('0xd')](function(_0x2997d9){logger[_0x49e8('0x9')](_0x49e8('0x17'),_0x2997d9?util['inspect'](_0x2997d9,{'showHidden':![],'depth':null}):'');return _0x100e2a(null);});}return _0x100e2a(null);});};exports[_0x49e8('0x18')]=function(_0x3b6050){return new BPromise(function(_0x36c807,_0x15a2b8){if(_0x3b6050){return getUser({'interface':_0x3b6050})[_0x49e8('0xb')](function(_0x517211){logger['info'](_0x49e8('0x19'),_0x3b6050,_0x517211?_0x49e8('0x1a'):_0x49e8('0x16'));return _0x36c807(_0x517211);})['catch'](function(_0x5ddd01){logger[_0x49e8('0x9')](_0x49e8('0x1b'),_0x5ddd01?util['inspect'](_0x5ddd01,{'showHidden':![],'depth':null}):'');return _0x36c807(null);});}return _0x36c807(null);});};exports[_0x49e8('0x1c')]=function(_0x20f633){return new BPromise(function(_0x21149f,_0x592d0a){if(_0x20f633){return getUser({'name':_0x20f633})[_0x49e8('0xb')](function(_0x17b3ad){logger[_0x49e8('0x6')](_0x49e8('0x1d'),_0x20f633,_0x17b3ad?_0x49e8('0x1a'):'notfound');return _0x21149f(_0x17b3ad);})[_0x49e8('0xd')](function(_0x415c5c){logger[_0x49e8('0x9')](_0x49e8('0x1e'),_0x415c5c?util['inspect'](_0x415c5c,{'showHidden':![],'depth':null}):'');return _0x21149f(null);});}return _0x21149f(null);});};exports[_0x49e8('0x1f')]=function(_0x165d7c){return new BPromise(function(_0x2cbdbe,_0x3b1e3e){if(_0x165d7c){return client[_0x49e8('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x49e8('0x20'),_0x49e8('0x21'),_0x49e8('0x22')],'where':{'name':_0x165d7c},'limit':0x1}})[_0x49e8('0xb')](function(_0x85efec){logger['debug'](_0x49e8('0x23'),_0x165d7c,_0x85efec?util[_0x49e8('0x7')](_0x85efec,{'showHidden':![],'depth':null}):'');logger[_0x49e8('0x6')](_0x49e8('0x24'),_0x165d7c,_0x85efec?_0x49e8('0x1a'):'notfound');return _0x2cbdbe(_0x85efec['result'][_0x49e8('0x13')]?_0x85efec['result'][0x0]:null);})[_0x49e8('0xd')](function(_0x411057){logger[_0x49e8('0x9')](_0x49e8('0x25'),_0x411057?util[_0x49e8('0x7')](_0x411057,{'showHidden':![],'depth':null}):'');return _0x2cbdbe(null);});}return _0x2cbdbe(null);});};exports[_0x49e8('0x26')]=function(_0x12c8f8,_0xcc8a08){return moment(_0x12c8f8)['add'](_0xcc8a08,'seconds')[_0x49e8('0x27')](_0x49e8('0x28'));};exports[_0x49e8('0x29')]=function(_0x50351e,_0x46523f){return moment(_0x50351e)[_0x49e8('0x2a')](_0x46523f,_0x49e8('0x2b'))['format'](_0x49e8('0x28'));};exports[_0x49e8('0x2c')]=function(_0x1eaea9,_0x14a7b){return moment(_0x1eaea9)[_0x49e8('0x2d')](moment(_0x14a7b),'seconds');};exports[_0x49e8('0x2e')]=function(_0x477538,_0x4af4cc){return parseInt(_0x477538,0xa)+parseInt(_0x4af4cc,0xa);};exports[_0x49e8('0x2f')]=function(){return moment()[_0x49e8('0x27')](_0x49e8('0x28'));};exports[_0x49e8('0x30')]=function(_0x42db39,_0x40687b){if(_0x40687b){return moment(_0x42db39)[_0x49e8('0x30')](_0x40687b);}return!![];};exports[_0x49e8('0x31')]=function(_0x13faf6,_0x225a0d){if(_0x225a0d){return moment(_0x13faf6)[_0x49e8('0x31')](_0x225a0d);}else if(_0x13faf6){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 544ea2a..2d67320 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9388=['express-winston','path','util','./loggers','fileLogger','join','log','xcally','client','role','ensureDir','then','catch','user','data','timestamp','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','device','other','agent_name','test','setupLoggers','fs-extra','lodash'];(function(_0x352761,_0x186c0b){var _0x3c4db9=function(_0x4b6bf0){while(--_0x4b6bf0){_0x352761['push'](_0x352761['shift']());}};_0x3c4db9(++_0x186c0b);}(_0x9388,0x1d7));var _0x8938=function(_0x1631a5,_0xc3cfd8){_0x1631a5=_0x1631a5-0x0;var _0x4e14c8=_0x9388[_0x1631a5];return _0x4e14c8;};var fs=require(_0x8938('0x0'));var _=require(_0x8938('0x1'));var ewinston=require(_0x8938('0x2'));var path=require(_0x8938('0x3'));var util=require(_0x8938('0x4'));var fileLogger=require(_0x8938('0x5'))[_0x8938('0x6')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0xda3cc4(_0x4677a8){var _0x266674=path[_0x8938('0x7')]('/var',_0x8938('0x8'),_0x8938('0x9'));var _0x5e1569=path[_0x8938('0x7')](_0x8938('0xa'),_0x4677a8[_0x8938('0xb')]+'-'+_0x4677a8['name']);return fs[_0x8938('0xc')](path[_0x8938('0x7')](_0x266674,_0x5e1569))[_0x8938('0xd')](function(){var _0x37a473=fileLogger('client',path[_0x8938('0x7')](_0x266674,_0x5e1569));return _0x37a473;})[_0x8938('0xe')](function(_0x2b7f36){throw _0x2b7f36;});}this['log']=function(_0x5e9c94,_0x2626f1,_0x468dbf,_0x2d560e){return _0xda3cc4(_0x5e9c94[_0x8938('0xf')])[_0x8938('0xd')](function(_0x3d1a3a){var _0x3a4d69=_0x3d1a3a[_0x2626f1];return _0x3a4d69;})[_0x8938('0xd')](function(_0x102c0b){var _0x120b80=_0x5e9c94[_0x8938('0xf')]?_0x5e9c94[_0x8938('0xf')]['id']:'no-user';var _0x44307b=_0x2d560e[_0x8938('0x10')];var _0x585ac3=_0x2d560e[_0x8938('0x11')];var _0x7dd16d=new Date(Number(_0x585ac3));return _0x102c0b(_0x120b80,_0x7dd16d,_0x468dbf,_0x44307b);})[_0x8938('0xe')](function(_0x3b4457){fileLogger('client')['error'](_0x3b4457);});};}function setupLoggers(_0x4863f1){return new Promise(function(_0x2253c2){var _0x3d5c44=new ClientSideLogger();var _0x3b9188=fileLogger('api');var _0x33ab01=fileLogger(_0x8938('0x12'));_0x4863f1[_0x8938('0x13')](_0x8938('0x14'),_0x3d5c44);_0x4863f1[_0x8938('0x15')](ewinston['logger']({'winstonInstance':_0x3b9188,'meta':![],'statusLevels':!![],'msg':function(_0x1674e9,_0x92fa6f){var _0x55bb57=_0x8938('0x16');if(!_['isEmpty'](_0x1674e9[_0x8938('0x17')])){_0x55bb57+=_0x8938('0x18');var _0x7a1eba=_0x1674e9['body'];maskSensitiveData(_0x7a1eba);}return safeTemplate(util[_0x8938('0x19')](_0x55bb57,_0x1674e9[_0x8938('0x1a')],_0x1674e9[_0x8938('0x1b')][_0x8938('0x1c')]?_0x1674e9[_0x8938('0x1b')]['x-forwarded-for']:_0x1674e9[_0x8938('0x1d')][_0x8938('0x1e')]||_0x1674e9['ip'],_0x1674e9['url'],_0x92fa6f['statusCode'],_0x92fa6f['responseTime'],_0x1674e9['user']?_0x1674e9['user']['id']:null,_0x1674e9['user']?_0x1674e9[_0x8938('0xf')][_0x8938('0x1f')]:null,_0x1674e9[_0x8938('0xf')]?_0x1674e9[_0x8938('0xf')][_0x8938('0xb')]:null,_0x7a1eba?util[_0x8938('0x20')](_0x7a1eba,![],null):''));}}));_0x4863f1[_0x8938('0x15')](ewinston[_0x8938('0x21')]({'winstonInstance':_0x33ab01,'meta':![],'statusLevels':!![],'msg':function(_0x4fa88f,_0xa577a4){var _0x2de207=_0x8938('0x22');if(_0x4fa88f[_0x8938('0x17')]&&_0x4fa88f[_0x8938('0x17')]['device']&&_0x4fa88f[_0x8938('0x17')][_0x8938('0x23')]){_0x2de207=_0x8938('0x24');}return util[_0x8938('0x19')](_0x2de207,_0x4fa88f['method'],_0x4fa88f['headers'][_0x8938('0x1c')]?_0x4fa88f[_0x8938('0x1b')][_0x8938('0x1c')]:_0x4fa88f[_0x8938('0x1d')][_0x8938('0x1e')]||_0x4fa88f['ip'],_0x4fa88f['url'],_0xa577a4[_0x8938('0x25')],_0xa577a4['responseTime'],_0x4fa88f[_0x8938('0xf')]?_0x4fa88f[_0x8938('0xf')]['id']:null,_0x4fa88f[_0x8938('0xf')]?_0x4fa88f[_0x8938('0xf')]['name']:null,_0x4fa88f[_0x8938('0xf')]?_0x4fa88f[_0x8938('0xf')][_0x8938('0xb')]:null,_0x4fa88f[_0x8938('0x17')]&&_0x4fa88f[_0x8938('0x17')][_0x8938('0x26')]?_0x4fa88f[_0x8938('0x17')][_0x8938('0x26')]:_0x8938('0x27'),_0x4fa88f[_0x8938('0x17')]&&_0x4fa88f['body'][_0x8938('0x23')]?_0x4fa88f[_0x8938('0x17')][_0x8938('0x23')]:'',_0x4fa88f['body']&&_0x4fa88f[_0x8938('0x17')][_0x8938('0x28')]?_0x4fa88f[_0x8938('0x17')]['agent_name']:'');},'ignoreRoute':function(_0xb3cb7){var _0x1b79c6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1b79c6[_0x8938('0x29')](_0xb3cb7['url']);}}));return _0x2253c2();});}exports[_0x8938('0x2a')]=setupLoggers; \ No newline at end of file +var _0x52eb=['fs-extra','lodash','path','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','x-forwarded-for','connection','remoteAddress','url','statusCode','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','responseTime','other','agent_name','test','setupLoggers'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x52eb,0x1b9));var _0xb52e=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x52eb[_0x4c73ac];return _0x9839ee;};var fs=require(_0xb52e('0x0'));var _=require(_0xb52e('0x1'));var ewinston=require('express-winston');var path=require(_0xb52e('0x2'));var util=require('util');var fileLogger=require(_0xb52e('0x3'))['fileLogger'];var safeTemplate=require('./safe-template')[_0xb52e('0x4')];var maskSensitiveData=require(_0xb52e('0x5'))[_0xb52e('0x6')];function ClientSideLogger(){function _0x3da733(_0x202c27){var _0x2cb29f=path[_0xb52e('0x7')](_0xb52e('0x8'),_0xb52e('0x9'),_0xb52e('0xa'));var _0x1ef7c1=path['join'](_0xb52e('0xb'),_0x202c27['role']+'-'+_0x202c27[_0xb52e('0xc')]);return fs[_0xb52e('0xd')](path[_0xb52e('0x7')](_0x2cb29f,_0x1ef7c1))[_0xb52e('0xe')](function(){var _0x237be2=fileLogger(_0xb52e('0xb'),path[_0xb52e('0x7')](_0x2cb29f,_0x1ef7c1));return _0x237be2;})[_0xb52e('0xf')](function(_0xe155b5){throw _0xe155b5;});}this[_0xb52e('0x9')]=function(_0x9a53c0,_0x5159e1,_0x17b7af,_0x3a7124){return _0x3da733(_0x9a53c0[_0xb52e('0x10')])[_0xb52e('0xe')](function(_0x428583){var _0x230434=_0x428583[_0x5159e1];return _0x230434;})[_0xb52e('0xe')](function(_0x3ff184){var _0x2cd02c=_0x9a53c0[_0xb52e('0x10')]?_0x9a53c0[_0xb52e('0x10')]['id']:_0xb52e('0x11');var _0x2ac59c=_0x3a7124[_0xb52e('0x12')];var _0x256520=_0x3a7124[_0xb52e('0x13')];var _0x3a50f4=new Date(Number(_0x256520));return _0x3ff184(_0x2cd02c,_0x3a50f4,_0x17b7af,_0x2ac59c);})[_0xb52e('0xf')](function(_0x3ba1c9){fileLogger('client')[_0xb52e('0x14')](_0x3ba1c9);});};}function setupLoggers(_0x277136){return new Promise(function(_0x55f98c){var _0x177e50=new ClientSideLogger();var _0x566c4a=fileLogger(_0xb52e('0x15'));var _0xdf1682=fileLogger(_0xb52e('0x16'));_0x277136[_0xb52e('0x17')](_0xb52e('0x18'),_0x177e50);_0x277136[_0xb52e('0x19')](ewinston[_0xb52e('0x1a')]({'winstonInstance':_0x566c4a,'meta':![],'statusLevels':!![],'msg':function(_0xeb90,_0x44575a){var _0x50dc92=_0xb52e('0x1b');if(!_[_0xb52e('0x1c')](_0xeb90['body'])){_0x50dc92+=_0xb52e('0x1d');var _0xcdba98=_0xeb90[_0xb52e('0x1e')];maskSensitiveData(_0xcdba98);}return safeTemplate(util[_0xb52e('0x1f')](_0x50dc92,_0xeb90[_0xb52e('0x20')],_0xeb90['headers'][_0xb52e('0x21')]?_0xeb90['headers']['x-forwarded-for']:_0xeb90[_0xb52e('0x22')][_0xb52e('0x23')]||_0xeb90['ip'],_0xeb90[_0xb52e('0x24')],_0x44575a[_0xb52e('0x25')],_0x44575a['responseTime'],_0xeb90[_0xb52e('0x10')]?_0xeb90[_0xb52e('0x10')]['id']:null,_0xeb90[_0xb52e('0x10')]?_0xeb90[_0xb52e('0x10')][_0xb52e('0xc')]:null,_0xeb90[_0xb52e('0x10')]?_0xeb90[_0xb52e('0x10')][_0xb52e('0x26')]:null,_0xcdba98?util[_0xb52e('0x27')](_0xcdba98,![],null):''));}}));_0x277136[_0xb52e('0x19')](ewinston['logger']({'winstonInstance':_0xdf1682,'meta':![],'statusLevels':!![],'msg':function(_0x190142,_0x210114){var _0x5cefc7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x190142[_0xb52e('0x1e')]&&_0x190142[_0xb52e('0x1e')][_0xb52e('0x28')]&&_0x190142[_0xb52e('0x1e')][_0xb52e('0x29')]){_0x5cefc7=_0xb52e('0x2a');}return util[_0xb52e('0x1f')](_0x5cefc7,_0x190142['method'],_0x190142['headers']['x-forwarded-for']?_0x190142[_0xb52e('0x2b')]['x-forwarded-for']:_0x190142[_0xb52e('0x22')][_0xb52e('0x23')]||_0x190142['ip'],_0x190142[_0xb52e('0x24')],_0x210114['statusCode'],_0x210114[_0xb52e('0x2c')],_0x190142[_0xb52e('0x10')]?_0x190142[_0xb52e('0x10')]['id']:null,_0x190142[_0xb52e('0x10')]?_0x190142[_0xb52e('0x10')][_0xb52e('0xc')]:null,_0x190142[_0xb52e('0x10')]?_0x190142[_0xb52e('0x10')][_0xb52e('0x26')]:null,_0x190142[_0xb52e('0x1e')]&&_0x190142[_0xb52e('0x1e')][_0xb52e('0x28')]?_0x190142[_0xb52e('0x1e')][_0xb52e('0x28')]:_0xb52e('0x2d'),_0x190142[_0xb52e('0x1e')]&&_0x190142[_0xb52e('0x1e')][_0xb52e('0x29')]?_0x190142['body']['agent_id']:'',_0x190142[_0xb52e('0x1e')]&&_0x190142['body'][_0xb52e('0x2e')]?_0x190142[_0xb52e('0x1e')]['agent_name']:'');},'ignoreRoute':function(_0x528b39){var _0x462c80=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x462c80[_0xb52e('0x2f')](_0x528b39['url']);}}));return _0x55f98c();});}exports[_0xb52e('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 21f5cc3..269ac4d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04d9=['util','winston','debugLevel','toLowerCase','info','redBG\x20white','white','bold\x20green','bold\x20cyan','addColors','/var/log/xcally','format','message','{{{','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','%s-%s','error','File','fileLogger','path'];(function(_0x5acecc,_0x4890b8){var _0x468b4c=function(_0x3a5272){while(--_0x3a5272){_0x5acecc['push'](_0x5acecc['shift']());}};_0x468b4c(++_0x4890b8);}(_0x04d9,0x1df));var _0x904d=function(_0x4aaea1,_0x3fdc18){_0x4aaea1=_0x4aaea1-0x0;var _0x192566=_0x04d9[_0x4aaea1];return _0x192566;};'use strict';var path=require(_0x904d('0x0'));var util=require(_0x904d('0x1'));var moment=require('moment');var winston=require(_0x904d('0x2'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x904d('0x3')][_0x904d('0x4')]():_0x904d('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x904d('0x6'),'error':'red','warn':'bold\x20yellow','info':_0x904d('0x7'),'print':'bold\x20white','success':_0x904d('0x8'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x904d('0x9')};winston[_0x904d('0xa')](XC_LOG_COLORS);function getLogFileName(_0x520e16,_0xc08bea,_0x254fe6){var _0x1210f7=_0x520e16||_0x904d('0xb');return path['join'](_0x1210f7,util[_0x904d('0xc')]('%s-%s.log',_0xc08bea,_0x254fe6));}function formatter(_0x198043,_0x27d761){_0x27d761[_0x904d('0xd')]=_0x27d761['message']['replace'](/@@{/g,_0x904d('0xe'))[_0x904d('0xf')](/}@@/g,_0x904d('0x10'))['replace'](/@{/g,'{{')[_0x904d('0xf')](/}@/g,'}}');return util[_0x904d('0xc')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x904d('0xc')](_0x904d('0x11')),_0x27d761[_0x904d('0x12')][_0x904d('0x13')](),_0x198043,_0x27d761['message']);}function fileFormat(_0x410249,_0x5e704e){_0x5e704e[_0x904d('0xd')]=_0x5e704e['message'][_0x904d('0xf')](/@@{/g,_0x904d('0xe'))['replace'](/}@@/g,_0x904d('0x10'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x30a18a=_0x5e704e['meta']&&Object[_0x904d('0x14')](_0x5e704e['meta'])[_0x904d('0x15')]?'\x0a\x09'+JSON[_0x904d('0x16')](_0x5e704e['meta']):'';return util[_0x904d('0xc')](_0x904d('0x17'),moment()[_0x904d('0xc')](_0x904d('0x11')),_0x5e704e[_0x904d('0x12')][_0x904d('0x13')](),_0x410249,_0x5e704e[_0x904d('0xd')],_0x30a18a);}function consoleLogger(){var _0x2796c9=new winston[(_0x904d('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x904d('0x19'))][(_0x904d('0x1a'))]({'level':_0x904d('0x1b'),'json':![],'formatter':function(_0xe3f673){return formatter('',_0xe3f673);}})]});return _0x2796c9;}function fileLogger(_0xe5d659,_0x191c2a){var _0x547f09=new winston[(_0x904d('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util['format'](_0x904d('0x1c'),_0xe5d659,_0x904d('0x1d')),'filename':getLogFileName(_0x191c2a,_0xe5d659,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x201e0d){return fileFormat(_0xe5d659,_0x201e0d);}}),new winston[(_0x904d('0x19'))][(_0x904d('0x1e'))]({'name':util[_0x904d('0xc')]('%s-%s',_0xe5d659,debugLevel),'filename':getLogFileName(_0x191c2a,_0xe5d659,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x20c29f){return fileFormat(_0xe5d659,_0x20c29f);}}),new winston[(_0x904d('0x19'))]['Console']({'level':_0x904d('0x1b'),'json':![],'formatter':function(_0x5ef372){return fileFormat(_0xe5d659,_0x5ef372);}})]});return _0x547f09;}exports['consoleLogger']=consoleLogger;exports[_0x904d('0x1f')]=fileLogger; \ No newline at end of file +var _0x7d1a=['meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Console','warn','Logger','transports','error','File','%s-%s','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','info','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','join','%s-%s.log','message','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','}}}'];(function(_0x3a2311,_0x128d22){var _0x5ac570=function(_0x540498){while(--_0x540498){_0x3a2311['push'](_0x3a2311['shift']());}};_0x5ac570(++_0x128d22);}(_0x7d1a,0x7c));var _0xa7d1=function(_0x5e73fa,_0x7d29be){_0x5e73fa=_0x5e73fa-0x0;var _0x821398=_0x7d1a[_0x5e73fa];return _0x821398;};'use strict';var path=require(_0xa7d1('0x0'));var util=require('util');var moment=require(_0xa7d1('0x1'));var winston=require(_0xa7d1('0x2'));var config=require(_0xa7d1('0x3'));var debugLevel=config['debugLevel']?config[_0xa7d1('0x4')][_0xa7d1('0x5')]():_0xa7d1('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':'bold\x20yellow','info':'white','print':_0xa7d1('0x7'),'success':_0xa7d1('0x8'),'http':_0xa7d1('0x9'),'verbose':_0xa7d1('0xa'),'debug':_0xa7d1('0xb'),'silly':_0xa7d1('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x32023d,_0x1be79e,_0x44fbd2){var _0x1f2d85=_0x32023d||'/var/log/xcally';return path[_0xa7d1('0xd')](_0x1f2d85,util['format'](_0xa7d1('0xe'),_0x1be79e,_0x44fbd2));}function formatter(_0x3a5a6f,_0x1f728f){_0x1f728f[_0xa7d1('0xf')]=_0x1f728f[_0xa7d1('0xf')][_0xa7d1('0x10')](/@@{/g,'{{{')[_0xa7d1('0x10')](/}@@/g,'}}}')[_0xa7d1('0x10')](/@{/g,'{{')[_0xa7d1('0x10')](/}@/g,'}}');return util[_0xa7d1('0x11')](_0xa7d1('0x12'),moment()[_0xa7d1('0x11')](_0xa7d1('0x13')),_0x1f728f[_0xa7d1('0x14')][_0xa7d1('0x15')](),_0x3a5a6f,_0x1f728f[_0xa7d1('0xf')]);}function fileFormat(_0x5659ba,_0x278df1){_0x278df1[_0xa7d1('0xf')]=_0x278df1[_0xa7d1('0xf')][_0xa7d1('0x10')](/@@{/g,_0xa7d1('0x16'))[_0xa7d1('0x10')](/}@@/g,_0xa7d1('0x17'))[_0xa7d1('0x10')](/@{/g,'{{')[_0xa7d1('0x10')](/}@/g,'}}');var _0x2d7068=_0x278df1[_0xa7d1('0x18')]&&Object['keys'](_0x278df1[_0xa7d1('0x18')])[_0xa7d1('0x19')]?'\x0a\x09'+JSON[_0xa7d1('0x1a')](_0x278df1['meta']):'';return util[_0xa7d1('0x11')](_0xa7d1('0x1b'),moment()['format'](_0xa7d1('0x13')),_0x278df1[_0xa7d1('0x14')][_0xa7d1('0x15')](),_0x5659ba,_0x278df1[_0xa7d1('0xf')],_0x2d7068);}function consoleLogger(){var _0xccac4e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa7d1('0x1c'))]({'level':_0xa7d1('0x1d'),'json':![],'formatter':function(_0x4a349b){return formatter('',_0x4a349b);}})]});return _0xccac4e;}function fileLogger(_0x10332a,_0x49f9d8){var _0x4e1b7f=new winston[(_0xa7d1('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa7d1('0x1f'))]['File']({'name':util[_0xa7d1('0x11')]('%s-%s',_0x10332a,_0xa7d1('0x20')),'filename':getLogFileName(_0x49f9d8,_0x10332a,_0xa7d1('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x25bf61){return fileFormat(_0x10332a,_0x25bf61);}}),new winston[(_0xa7d1('0x1f'))][(_0xa7d1('0x21'))]({'name':util[_0xa7d1('0x11')](_0xa7d1('0x22'),_0x10332a,debugLevel),'filename':getLogFileName(_0x49f9d8,_0x10332a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a6cd5){return fileFormat(_0x10332a,_0x1a6cd5);}}),new winston[(_0xa7d1('0x1f'))]['Console']({'level':'warn','json':![],'formatter':function(_0x5319a4){return fileFormat(_0x10332a,_0x5319a4);}})]});return _0x4e1b7f;}exports[_0xa7d1('0x23')]=consoleLogger;exports[_0xa7d1('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index f7c549c..c98794d 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x1967,0x173));var _0x7196=function(_0x41be16,_0x4d3c6b){_0x41be16=_0x41be16-0x0;var _0x5e8070=_0x1967[_0x41be16];return _0x5e8070;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x359551,_0x5c0775){var _0x2662ae=function(_0x449dc5){while(--_0x449dc5){_0x359551['push'](_0x359551['shift']());}};_0x2662ae(++_0x5c0775);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c3274,_0x2f1a9f){_0x1c3274=_0x1c3274-0x0;var _0x2b2b36=_0x5f2f[_0x1c3274];return _0x2b2b36;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 6921a0d..0ab17e4 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['replace','isArray','map','isPlainObject','reduce','exports','lodash','\x20}\x20}','string'];(function(_0x2fe4f0,_0x106cbd){var _0x3104ef=function(_0x3ccc3f){while(--_0x3ccc3f){_0x2fe4f0['push'](_0x2fe4f0['shift']());}};_0x3104ef(++_0x106cbd);}(_0xefda,0x96));var _0xaefd=function(_0x46e399,_0x5eebf6){_0x46e399=_0x46e399-0x0;var _0x2b92db=_0xefda[_0x46e399];return _0x2b92db;};var _=require(_0xaefd('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4ae616){return _0x4ae616==='{{'?'{\x20{\x20':_0xaefd('0x1');}function safeTemplate(_0x2ccc67){var _0x4ae272=_0x2ccc67;if(typeof _0x2ccc67===_0xaefd('0x2')){_0x4ae272=_0x2ccc67[_0xaefd('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xaefd('0x4')](_0x2ccc67)){_0x4ae272=_0x2ccc67[_0xaefd('0x5')](function(_0x1ef6b4){return safeTemplate(_0x1ef6b4);});}else if(_[_0xaefd('0x6')](_0x2ccc67)){_0x4ae272=Object['keys'](_0x2ccc67)[_0xaefd('0x7')](function(_0x3b9736,_0x24d10c){_0x3b9736[_0x24d10c]=safeTemplate(_0x2ccc67[_0x24d10c]);return _0x3b9736;},{});}return _0x4ae272;}module[_0xaefd('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5c1353,_0x328298){_0x5c1353=_0x5c1353-0x0;var _0x31e2e6=_0x9c00[_0x5c1353];return _0x31e2e6;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file